From e4be5919fc5d1b94700bc0340c7b4a56dba293d0 Mon Sep 17 00:00:00 2001 From: Andres Kasekamp Date: Mon, 8 Jan 2024 15:37:41 +0200 Subject: [PATCH] Added rotate windmills --- app.js | 16 +- dist/assets/AnalysisToolBase-3A13PdgS.js | 1 - dist/assets/AnalysisToolBase-olyQy6lh.js | 1 + ...jkk3JIRT.js => AnalysisView3D-XCzG0Hzh.js} | 2 +- ....js => AnchorElementViewModel-7brFN9z4.js} | 2 +- dist/assets/AreaMeasurement2D-5lnD5-Sk.js | 1 - dist/assets/AreaMeasurement2D-GQCBQvJv.js | 1 + ...HGg9B.js => AreaMeasurement3D-ZnoqUVHu.js} | 2 +- .../AreaMeasurementAnalysisView3D-AasBQOV-.js | 26 - .../AreaMeasurementAnalysisView3D-RBc-E7CZ.js | 26 + dist/assets/AttachmentInfo-kbEMEIl0.js | 1 - .../assets/BaseDynamicLayerView3D-HrHMPsDQ.js | 1 + .../assets/BaseDynamicLayerView3D-aiAW9HKo.js | 1 - ...-nWGHAt7P.js => BaseProcessor-yc_MfkjR.js} | 2 +- dist/assets/BingMapsLayer-UB9V9S3W.js | 1 + dist/assets/BingMapsLayer-d48O8tVq.js | 1 - ...re-wmwfHjhp.js => BoundsStore-_-dPK5c-.js} | 2 +- .../{Box-gJ8-sOXE.js => Box-7JWnlTvk.js} | 2 +- .../BuildingComponentSublayer-0DIX8n0s.js | 1 + .../BuildingComponentSublayer-j8wian8V.js | 1 - ...h.js => BuildingGroupSublayer-UJvyv8qt.js} | 2 +- dist/assets/BuildingSceneLayer-Bnoa9yAy.js | 1 + dist/assets/BuildingSceneLayer-YaRBOuhA.js | 1 - .../BuildingSceneLayerView3D-9E-CA71T.js | 3 + .../BuildingSceneLayerView3D-jychJ4lg.js | 3 - ...{Button-1STHXt3M.js => Button-HXGuX8_s.js} | 2 +- ...uXl.js => CIMSymbolRasterizer-uvvL-Oh3.js} | 2 +- dist/assets/CSVLayer-iQyfu2e9.js | 1 + dist/assets/CSVLayer-tIBvmg-7.js | 1 - dist/assets/CSVLayerView3D-WZv0l0uX.js | 1 + dist/assets/CSVLayerView3D-t0wtEtZq.js | 1 - ...lkXsKJn.js => CSVSourceWorker-4-dU7rZu.js} | 4 +- ...orSet-j9kKRPwP.js => ColorSet-tH4rJdGx.js} | 2 +- ...O.js => CustomParametersMixin-7nmugR3Y.js} | 2 +- ...e-T7-VnRhA.js => DefaultTheme-uOYPzulo.js} | 2 +- ...itionExpressionSceneLayerView-Z1V4X6Kq.js} | 2 +- ... DeleteForwardEditsParameters-ZTiTrFCh.js} | 2 +- ...js => DimensionAnalysisView3D-6H84TLcJ.js} | 2 +- dist/assets/DimensionLayer-WWUzEsQc.js | 1 - dist/assets/DimensionLayer-pDBYhz_R.js | 1 + dist/assets/DimensionLayerView3D-fNUV7ooO.js | 7 + dist/assets/DimensionLayerView3D-sKnmIRMF.js | 7 - .../DirectLineMeasurement3D-3Pkkgamv.js | 1 - .../DirectLineMeasurement3D-D1LkQv4r.js | 1 + ...LineMeasurementAnalysisView3D-iWb0_QxT.js} | 6 +- dist/assets/DistanceMeasurement2D-0EP_w-h3.js | 1 - dist/assets/DistanceMeasurement2D-Ss5XZk94.js | 1 + dist/assets/Draw-DYxsSuyr.js | 1 - dist/assets/Draw-yCejAdh-.js | 1 + dist/assets/DynamicLayerView3D-4lztpXo0.js | 1 - dist/assets/DynamicLayerView3D-XykdNh09.js | 1 + ...pG.js => EdgeProcessingWorker-sY3QTnTZ.js} | 2 +- .../assets/EditGeometryOperations-TPE5Wzab.js | 1 - .../assets/EditGeometryOperations-vpHcsZOg.js | 1 + ...Zv.js => ElevationLayerView3D-fn8Lf5lz.js} | 2 +- .../assets/ElevationProfileView2D-5R-6KsXv.js | 1 + .../assets/ElevationProfileView2D-KdZmS2un.js | 1 - .../assets/ElevationProfileView3D-bd56oGje.js | 1 - .../assets/ElevationProfileView3D-ffQcLfOL.js | 1 + ....js => ElevationSamplerWorker-k8_PEq10.js} | 2 +- dist/assets/EngineVisualElement-eZNKTKsI.js | 1 - dist/assets/EngineVisualElement-u0-BOxGn.js | 1 + ...Set-JGlFrfoR.js => EventedSet-TJfupI82.js} | 2 +- ... => ExtendedLineVisualElement-VJvEdv3K.js} | 2 +- ...e37b.js => ExtentTooltipInfos-EukgtOIT.js} | 2 +- dist/assets/External-GV0jSEES.js | 1 - dist/assets/External-Pb5poJ0S.js | 1 + ...actory-m-O4WAoG.js => Factory-EVPOwZPk.js} | 2 +- ...eatureCollectionSnappingSource-AwpfuxVk.js | 1 - ...eatureCollectionSnappingSource-noadiOim.js | 1 + ...-5bEV-xG1.js => FeatureEffect-0Jn9Z0sQ.js} | 2 +- ...pIG5.js => FeatureEffectLayer-OK0TB5f6.js} | 2 +- dist/assets/FeatureFilter-_YQPNaln.js | 1 + dist/assets/FeatureFilter-w5_DYl72.js | 1 - dist/assets/FeatureLayer--S4epFk-.js | 7 - dist/assets/FeatureLayer-9tNCmEbA.js | 7 + ...Fp8gE3.js => FeatureLayerBase-mvqC7cJs.js} | 2 +- dist/assets/FeatureLayerSource-AZE5JEq3.js | 7 - dist/assets/FeatureLayerSource-hKAUR546.js | 7 + dist/assets/FeatureLayerView3D-t6NDkLO0.js | 1 - dist/assets/FeatureLayerView3D-vzwVkoh-.js | 1 + .../assets/FeatureLayerViewBase3D-VurTj7t3.js | 1 - .../assets/FeatureLayerViewBase3D-W0Qwl4g_.js | 1 + dist/assets/FeatureReductionLayer-2X2_PJv9.js | 1 + dist/assets/FeatureReductionLayer-RlitE1N6.js | 1 - ... FeatureServiceSnappingSource-LrGkMfSm.js} | 6 +- ...ureServiceSnappingSourceWorker-GdDLcUBl.js | 1 + ...ureServiceSnappingSourceWorker-TBw9rhlL.js | 1 - dist/assets/FeatureSet-d4S1oKME.js | 1 - ...e-X-AIJLo2.js => FeatureStore-PXMUgn0j.js} | 2 +- ...UgbbA00.js => FeatureTemplate-vSzbyslg.js} | 2 +- .../FeatureTileTree3DDebugger-ZBfyCqfy.js | 1 - .../FeatureTileTree3DDebugger-y_91jAgc.js | 1 + ...pe-MpRe7WJj.js => FeatureType-0WPvBvpQ.js} | 2 +- ...-BghsONry.js => FloatingArrow-FUeqM5kw.js} | 4 +- dist/assets/GeoJSONLayer--Go-c1Ql.js | 7 + dist/assets/GeoJSONLayer-T9kwyVNs.js | 7 - dist/assets/GeoJSONLayerView3D-4MSCbPJp.js | 1 - dist/assets/GeoJSONLayerView3D-lumzM4UY.js | 1 + dist/assets/GeoJSONSourceWorker-KDFieIXt.js | 1 + dist/assets/GeoJSONSourceWorker-Sd5A35h-.js | 1 - ...er-hfhcgYql.js => GeoRSSLayer-mvh9EmL0.js} | 2 +- dist/assets/GraphicManipulator-59Uc2I6c.js | 1 + dist/assets/GraphicManipulator-ku6oRBpa.js | 1 - ...r-DhG5Ib7v.js => GraphicMover-kaBR5sTE.js} | 2 +- dist/assets/GraphicState-2UcU5UAX.js | 1 - dist/assets/GraphicState-JOHpeXmF.js | 1 + .../assets/Graphics3DObjectStates--mMi4sdi.js | 1 - .../assets/Graphics3DObjectStates-JUKhPt0b.js | 1 + ...2EU.js => GraphicsLayerView3D-WVV0TMGR.js} | 2 +- dist/assets/GraphicsProcessor-QBvSewdt.js | 1 + dist/assets/GraphicsProcessor-rh5nA4fc.js | 1 - .../assets/GraphicsSnappingSource-0y5Y2-KL.js | 1 + .../assets/GraphicsSnappingSource-FqTOI9A3.js | 1 - ...6FUUKif_.js => GraphicsView3D-o82vqKJR.js} | 2 +- dist/assets/GroupLayerView-Ck4zCvvf.js | 1 + dist/assets/GroupLayerView-do80uFuS.js | 1 - dist/assets/HeatmapDensity.glsl-de3m0xZZ.js | 38 + dist/assets/HeatmapDensity.glsl-y7dUg--m.js | 38 - ...9jD0nx.js => HeatmapProcessor-E3j18Ktz.js} | 2 +- ...-BD2phuV6.js => HoveredPoints-dZcdNiOr.js} | 2 +- dist/assets/I3SMeshView3D-OXYwZo0p.js | 7 - dist/assets/I3SMeshView3D-frxYFPRW.js | 7 + ...3SNode-5SPByfpU.js => I3SNode-A9aOJfXV.js} | 2 +- dist/assets/I3SOverrides-5dCbMm3h.js | 1 - dist/assets/I3SOverrides-XXafrk1K.js | 1 + dist/assets/I3SQueryFeatureStore-CLo7XXT-.js | 7 - dist/assets/I3SQueryFeatureStore-LSdoLFw0.js | 7 + dist/assets/I3STreeDebugger-kGP6iO8T.js | 1 + dist/assets/I3STreeDebugger-tPVEJfH8.js | 1 - ...TERQ1-w.js => IdentityManager-YS7SZXzi.js} | 6 +- .../ImageHistogramParameters-qqqpsay3.js | 1 + .../ImageHistogramParameters-sFtZwJ9j.js | 1 - ...jVc_.js => ImageMaterial.glsl-PU0wbmEN.js} | 10 +- dist/assets/ImageryLayer-G7gb-fJC.js | 7 - dist/assets/ImageryLayer-STU2SwYQ.js | 7 + ...-b41.js => ImageryLayerView3D-BaVb1zzV.js} | 2 +- dist/assets/ImageryTileLayer-7zhL4pR_.js | 8 + dist/assets/ImageryTileLayer-ce5u7kmi.js | 8 - .../assets/ImageryTileLayerView3D-OR6Vjdkd.js | 1 + .../assets/ImageryTileLayerView3D-kyd0hRhY.js | 1 - dist/assets/IntegratedMeshLayer-T6vTIezB.js | 1 - dist/assets/IntegratedMeshLayer-cHWMTQWg.js | 1 + .../IntegratedMeshLayerView3D-3obO3XcM.js | 1 + .../IntegratedMeshLayerView3D-EW3nzBgf.js | 1 - .../InteractiveAnalysisViewModel-RI-qFGDH.js | 1 - .../InteractiveAnalysisViewModel-jrNLjGZR.js | 1 + dist/assets/InteractiveToolBase-6mltmL27.js | 1 + dist/assets/InteractiveToolBase-WDic4GPF.js | 1 - dist/assets/KMLLayer-c7r_kLDp.js | 1 - dist/assets/KMLLayer-pgkQk7d5.js | 1 + ...vjcCsAw.js => Laserlines.glsl-U7nZFq0e.js} | 18 +- ...View-efDufa6j.js => LayerView-ixwLVnzr.js} | 2 +- dist/assets/LayerView3D-57OghbRh.js | 1 + dist/assets/LayerView3D-iOx2MD1g.js | 1 - ..._HnPDNi.js => LengthDimension-tb0JjnxZ.js} | 2 +- ...ker-e_UqPfL3.js => LercWorker-p4NiAClL.js} | 2 +- .../LineOfSightAnalysisView3D-lX-OBMBB.js | 1 - .../LineOfSightAnalysisView3D-oCrG9jF8.js | 1 + ...oACZan.js => LineOfSightLayer-5jg3FABh.js} | 2 +- .../assets/LineOfSightLayerView3D-rUjgrEFl.js | 7 - .../assets/LineOfSightLayerView3D-uRdo1RJr.js | 7 + ...ies-VcEznTH7.js => LineSeries-yr_9erUD.js} | 2 +- ...10o6v.js => LineVisualElement-iKo1s90I.js} | 2 +- dist/assets/LinkChartLayer-bx0B-Kgd.js | 7 + dist/assets/LinkChartLayer-uIn6uT3L.js | 7 - dist/assets/MapImageLayer-oZq_Q4o2.js | 1 + dist/assets/MapImageLayer-qMOOMfH7.js | 1 - ...WiM.js => MapImageLayerView3D-XQURj3BI.js} | 2 +- dist/assets/MapNotesLayer-CdG3vHcH.js | 1 - dist/assets/MapNotesLayer-ldLz1FWK.js | 1 + ... => MapServiceLayerViewHelper-45ApjWde.js} | 4 +- ...s => MeasurementWidgetContent-PH9XFoV4.js} | 4 +- dist/assets/MediaElementView-ezYHddnZ.js | 1 - dist/assets/MediaElementView-pYfW8oR4.js | 1 + dist/assets/MediaLayer-39dmiD7K.js | 1 - dist/assets/MediaLayer-PKp6pKCX.js | 1 + ...dxGOiQ.js => MediaLayerView3D-LfY78zh1.js} | 2 +- ...TL5J.js => MemorySourceWorker-6wu4D2bo.js} | 2 +- dist/assets/OGCFeatureLayer--w0HTnNu.js | 1 - dist/assets/OGCFeatureLayer-hko6jm86.js | 1 + dist/assets/OGCFeatureLayerView3D-FLI41Ca4.js | 1 - dist/assets/OGCFeatureLayerView3D-a9b4I66a.js | 1 + ...l.js => Object3DVisualElement-8HoU366x.js} | 2 +- ...Q-kN.js => OpenStreetMapLayer-qslplUAm.js} | 2 +- ...r-M7k5gLgx.js => OrderedLayer-XNaJwl_G.js} | 2 +- dist/assets/OrientedImageryLayer-F57-BGcl.js | 1 + dist/assets/OrientedImageryLayer-LKoItije.js | 1 - dist/assets/PBFDecoderWorker--NqrOA1Y.js | 1 - dist/assets/PBFDecoderWorker-mLYHZi4e.js | 1 + dist/assets/Pipeline--6jAENf8.js | 22 - dist/assets/Pipeline-PlEwhMAg.js | 22 + ...VzMPRjJ.js => PointCloudLayer-EgPyZPkK.js} | 4 +- ...Z.js => PointCloudLayerView3D-LHTTpHpk.js} | 20 +- .../PointCloudUniqueValueRenderer-RbbyNiwC.js | 1 - .../PointCloudUniqueValueRenderer-mGlOSV4H.js | 1 + ...niuzRB.js => PointCloudWorker-rfPDyXh6.js} | 2 +- ...Qu.js => PointCloudWorkerUtil-uutRAft1.js} | 2 +- dist/assets/PointSnappingHint-ULetRXiW.js | 1 - dist/assets/PointSnappingHint-bwlQAyn6.js | 1 + ...4FqS.js => PointVisualElement-m9C0-AJh.js} | 2 +- ...sh-o8tLYBG5.js => PooledRBush-rhLtoPG7.js} | 2 +- .../{Popup-aRK3Vd3w.js => Popup-a4-j6aRT.js} | 6 +- ...YqF.js => PopupSceneLayerView-1BvuVn-Q.js} | 2 +- dist/assets/QueryEngine-8tLWlkSE.js | 7 - dist/assets/QueryEngine-uvDs-vBe.js | 7 + dist/assets/QueryTask-91TvtrTt.js | 7 - dist/assets/QueryTask-Di0fqnMV.js | 7 + ...r-0s4_fI9v.js => RasterWorker-dDXhiR2p.js} | 2 +- ...et-HLstcUcf.js => ReactiveSet-_4-UpKXZ.js} | 2 +- dist/assets/RefreshableLayerView-DVYs7L04.js | 1 + dist/assets/RefreshableLayerView-Pd4dLcWr.js | 1 - dist/assets/Reshape-J0NI6bzM.js | 1 - dist/assets/Reshape-c3RtsBQr.js | 1 + ...ive-QKXcW_1q.js => Responsive-QlPOQ03r.js} | 2 +- ...> RightAngleQuadVisualElement-Jj11oqLR.js} | 2 +- ...yer-GamYzZdr.js => RouteLayer-HsRHI0PF.js} | 4 +- ...y-WtTD.js => RouteLayerView3D-EnI30QTX.js} | 2 +- .../SceneLayerGraphicsView3D-Abn6jwJk.js | 7 - .../SceneLayerGraphicsView3D-KM9RpQwS.js | 7 + .../SceneLayerSnappingSource-u6yw_bMd.js | 1 - .../SceneLayerSnappingSource-wfFr0F0T.js | 1 + ...SceneLayerSnappingSourceWorker-Ty-SvQ0f.js | 1 + ...SceneLayerSnappingSourceWorker-gaKuqg8q.js | 1 - dist/assets/SceneLayerView-MZstNOoI.js | 7 - dist/assets/SceneLayerView-Z2vMKB9z.js | 7 + dist/assets/SceneLayerView3D-7NpyxR5M.js | 1 - dist/assets/SceneLayerView3D-wSIS3UPq.js | 1 + ...OZRrjZ.js => SceneLayerWorker-fjNBmTGi.js} | 4 +- dist/assets/SceneModification-E4lNPbBQ.js | 1 + dist/assets/SceneModification-dyp2M_Yg.js | 1 - .../SceneSnappingManagerPool-OpebO9Di.js | 1 - .../SceneSnappingManagerPool-V-V1M2q0.js | 1 + dist/assets/Segment-TQS1M_Ix.js | 1 + dist/assets/Segment-hN2uWAPW.js | 1 - ...s => ShadedColorMaterial.glsl-L0JVQzbX.js} | 24 +- dist/assets/SliceAnalysisView3D--IcVdus9.js | 1 - dist/assets/SliceAnalysisView3D--Kqu5Yhm.js | 1 + .../SlicePlaneMaterial.glsl-RxywoUhm.js | 22 - .../SlicePlaneMaterial.glsl-xVEc2mct.js | 22 + ...K6JmvvY.js => SnappingContext-ax0tf6c6.js} | 2 +- .../SnappingDragPipelineStep-HDAWWRgo.js | 1 + .../SnappingDragPipelineStep-THHIXt-p.js | 1 - ...8wt1k.js => SnappingOperation-hED0OM8D.js} | 2 +- dist/assets/SnappingVisualizer2D-JqQy3X5x.js | 1 + dist/assets/SnappingVisualizer2D-NnEm1PvQ.js | 1 - dist/assets/SnappingVisualizer3D-KWlqByBu.js | 1 - dist/assets/SnappingVisualizer3D-PUGfSdbO.js | 1 + ...-CXhA7RaJ.js => SpatialFilter-h73GoH-a.js} | 2 +- .../{Stop-W76EJiT2.js => Stop-d3MLMjE8.js} | 2 +- ..._c.js => StreamFeatureManager-Iguqr18K.js} | 2 +- dist/assets/StreamLayer-FMdUAhtW.js | 7 + dist/assets/StreamLayer-KHxHoWyI.js | 7 - dist/assets/StreamLayerView3D-kATjjzFd.js | 1 + dist/assets/StreamLayerView3D-nu_wqFzJ.js | 1 - ...hXfhILC.js => StyleRepository-TpBuuKhf.js} | 2 +- dist/assets/SublayersOwner-8xrm3MkT.js | 7 - dist/assets/SublayersOwner-Hx1szNtg.js | 7 + dist/assets/SubtypeGroupLayer-lkxtOZrq.js | 7 + dist/assets/SubtypeGroupLayer-xK5RtU9X.js | 7 - dist/assets/SymbolProcessor-dUsJwb8f.js | 7 + dist/assets/SymbolProcessor-pXDjnfSh.js | 7 - ... => TerrainTileTree3DDebugger-3kUE1gqF.js} | 2 +- dist/assets/TextOverlayItem-YHZxWGyg.js | 1 + dist/assets/TextOverlayItem-eCjvS6IO.js | 1 - .../{Theme-QNc_77AM.js => Theme-5CV7oVsW.js} | 2 +- .../{Tick-WQ_bPwW2.js => Tick-bu1aEuYp.js} | 2 +- dist/assets/TileLayer-RB9GhSe4.js | 1 + dist/assets/TileLayer-bPSfr5GU.js | 1 - ...Hf3FIEh.js => TileLayerView3D-KbvgzCEw.js} | 2 +- dist/assets/TileTreeDebugger-2DVbY5sQ.js | 1 - dist/assets/TileTreeDebugger-MxH50s1q.js | 1 + dist/assets/TiledLayerView3D-Av58zTxG.js | 1 - dist/assets/TiledLayerView3D-_U1Q993H.js | 1 + ...eOnly-ljWtUK7N.js => TimeOnly-gkehHHJx.js} | 2 +- ...ooltip-lrFZgXdG.js => Tooltip-4JsqFz5S.js} | 2 +- ...ooltip-ON77BKb3.js => Tooltip-a9KqLK1p.js} | 4 +- dist/assets/TopFeaturesQuery-E6D2tV-x.js | 1 - ...O.js => TranslateTooltipInfos-DywsDtXz.js} | 2 +- dist/assets/TurboLine-SWK4qRwh.js | 7 - dist/assets/TurboLine-cWldrV9L.js | 7 + dist/assets/UnitNormalizer-19C91v_m.js | 1 - dist/assets/UnitNormalizer-RQizSo9a.js | 1 + ...r-3OKGB96U.js => UnknownLayer-lHoSTlsX.js} | 2 +- dist/assets/UnsupportedLayer--BUwN-ET.js | 1 + dist/assets/UnsupportedLayer-s0OShVnj.js | 1 - dist/assets/VectorTileLayer-0SVRfneU.js | 1 - dist/assets/VectorTileLayer-3l6dancR.js | 1 + dist/assets/VectorTileLayerView3D-eTryeubP.js | 555 +++++++++++ dist/assets/VectorTileLayerView3D-eexSRj3E.js | 555 ----------- ...js => VertexSnappingCandidate-YEvkEqQJ.js} | 2 +- ...c.js => VerticesVisualElement-QZStMB48.js} | 2 +- ...-kjYXz27t.js => VisualElement--2Scr6Yq.js} | 2 +- dist/assets/VoxelLayer-NKOtejie.js | 1 - dist/assets/VoxelLayer-ggmlUmsY.js | 1 + ...uX8zyo.js => VoxelLayerView3D-4VCjvhwH.js} | 2 +- dist/assets/VoxelWasmPerSceneView-YeZpknKe.js | 7 - dist/assets/VoxelWasmPerSceneView-xko8AJDS.js | 7 + dist/assets/WFSLayer-8l6HCYA6.js | 1 + dist/assets/WFSLayer-VPxAc_vg.js | 1 - dist/assets/WFSLayerView3D-OjHmKjv_.js | 1 - dist/assets/WFSLayerView3D-_qadKQVq.js | 1 + dist/assets/WFSSourceWorker-AqESE9b6.js | 1 + dist/assets/WFSSourceWorker-iUwpu94Y.js | 1 - ...HO_hwLwX.js => WMSLayerView3D-OqbPQcsr.js} | 2 +- dist/assets/WMTSLayer-Qx8zOTb2.js | 1 - dist/assets/WMTSLayer-TE5fyme_.js | 1 + dist/assets/WMTSLayerView3D-6XYesvf9.js | 1 + dist/assets/WMTSLayerView3D-oO1etwl-.js | 1 - ...r-JxqArsF7.js => WebTileLayer-jfo0VJmw.js} | 2 +- ...se-XAMIZ4-B.js => WhereClause-FOYoIAAW.js} | 6 +- dist/assets/WorkerTileHandler-9KieSe2P.js | 2 - dist/assets/WorkerTileHandler-znQwxG7k.js | 2 + ...{action-W5zDPNjG.js => action-bN6v5--b.js} | 4 +- ...p-8XaPC2xM.js => action-group-6S1AUKwx.js} | 2 +- ...nu-h_LAlWK7.js => action-menu-FiGuYhhw.js} | 6 +- dist/assets/analysisViewUtils-AQaQeJpR.js | 1 - dist/assets/analysisViewUtils-lJExoyyw.js | 1 + dist/assets/apng-_AWHiAIA.js | 1 + dist/assets/apng-yUSt3z2o.js | 1 - ...DugP.js => arcadeAsyncRuntime-RaDNZAaP.js} | 2 +- ...ls-OUqwHs4P.js => arcadeUtils-vGyJZHQt.js} | 22 +- ... arcgis-knowledge-client-core-FOb54Y-y.js} | 6 +- ...is-knowledge-client-core-simd-VjZZ0mc4.js} | 6 +- ...s-Ja4-CB3n.js => arcgisLayers-SSMNCJNX.js} | 4 +- .../automaticAreaMeasurementUtils-kRuWnHc-.js | 1 + .../automaticAreaMeasurementUtils-nVd6Y5mX.js | 1 - ...rOzl2Q.js => basis_transcoder-5u4h2z6s.js} | 2 +- ...{button-dkwNndhL.js => button-4hsayCiP.js} | 2 +- dist/assets/calcite-action-GYDrwtQs.js | 5 + ...eCZY.js => calcite-action-bar-1xecS7ni.js} | 6 +- dist/assets/calcite-action-group-ZfO11pHg.js | 5 + dist/assets/calcite-action-group-_Xoggrsa.js | 5 - dist/assets/calcite-action-mEzyoc-Z.js | 5 - dist/assets/calcite-button-rIOy-85Y.js | 5 + dist/assets/calcite-button-tOn16zeN.js | 5 - ...FCWd7i.js => calcite-checkbox-u3DU2spl.js} | 2 +- ...p-MkTbFpRn.js => calcite-chip-SaUQXOua.js} | 4 +- ...QD.js => calcite-color-picker--cLRGCVy.js} | 18 +- ....js => calcite-dropdown-group-5Uhho6JI.js} | 2 +- ...H.js => calcite-dropdown-item-UdaqM-Sc.js} | 2 +- ...xGPYrb.js => calcite-dropdown-r3pviJNw.js} | 4 +- ...w-A39UdeqN.js => calcite-flow-Hhr0ymgr.js} | 2 +- ...WFd-U.js => calcite-flow-item-cLwEh1ST.js} | 6 +- ...n-itD416se.js => calcite-icon-ZhRmLRGh.js} | 2 +- dist/assets/calcite-input-1VO9g4ut.js | 5 + dist/assets/calcite-input-V4_hyPVg.js | 5 - ...-lSeWOYbm.js => calcite-label-DHrtVvrs.js} | 2 +- ...t-LJfGqLbO.js => calcite-list-KbTGTbJq.js} | 2 +- ...yVNHT.js => calcite-list-item-ewhQm-Oo.js} | 8 +- ...js => calcite-list-item-group-L6UN1q3l.js} | 2 +- ...Z65agR8e.js => calcite-loader-IfjW-6zZ.js} | 2 +- ...zH528nES.js => calcite-notice-6pbWdSt0.js} | 2 +- ...LMeeGK3H.js => calcite-option-XCvROySu.js} | 2 +- dist/assets/calcite-popover-Lvoq79Pm.js | 5 + dist/assets/calcite-popover-PeZ1jQob.js | 5 - ...-iUD6Tmec.js => calcite-scrim-eUqm3Zfl.js} | 2 +- ...0Yw6DsYN.js => calcite-select-h4uorzoD.js} | 6 +- ...-uw2bYfU.js => calcite-slider-czDRxbAt.js} | 4 +- ...ucKIjb_.js => calcite-tooltip-ewJ_kzN3.js} | 4 +- ...on-ZPkVkRIK.js => chartCommon-OKgpftOz.js} | 2 +- dist/assets/chartUtils-24xN4NV-.js | 2 + dist/assets/chartUtils-P39aKol1.js | 2 - ...-QfmFJ3lc.js => chartUtilsAm5-owLhGEU2.js} | 2 +- dist/assets/cimAnalyzer-DtyBzAGI.js | 1 - dist/assets/cimAnalyzer-X6MTpVAO.js | 1 + ...nR0g.js => clientSideDefaults-63pOkJ4Y.js} | 4 +- ...55zipTI.js => conditionalSlot-OgY0Ln74.js} | 2 +- ...pGVnSc.js => createConnection-iXdhuUHv.js} | 4 +- dist/assets/createSymbolSchema-Tv2jMAOE.js | 1 - dist/assets/createSymbolSchema-cxObHUlP.js | 1 + dist/assets/dataUtils-_QoSHbCE.js | 7 + dist/assets/dataUtils-s_UKlouc.js | 7 - ...ns-DqQMJYPH.js => definitions-SVBNHUSH.js} | 2 +- ...> dehydratedFeatureComparison-IJSogXWn.js} | 2 +- dist/assets/deleteForwardEdits-Pq-0h4Vp.js | 1 - dist/assets/deleteForwardEdits-kZj3bKFL.js | 1 + dist/assets/dragEventPipeline3D-4CqrlxD2.js | 1 - dist/assets/dragEventPipeline3D-H_IlIVP7.js | 1 + ...ls-9db1OpTX.js => drapedUtils-F1ywqHD-.js} | 2 +- dist/assets/drawSurfaces-t1mGEx1r.js | 1 + ...tils-woTYaREB.js => drawUtils-0wb2c6-q.js} | 2 +- dist/assets/editPlaneUtils-4qxd7h1E.js | 1 - dist/assets/editPlaneUtils-TRKNVTzb.js | 1 + dist/assets/editingSupport-EiPa9PKq.js | 1 - dist/assets/editingSupport-HfkJiqt7.js | 1 + dist/assets/editingTools-1yHclJT1.js | 1 - dist/assets/editingTools-KuLEWRoO.js | 1 + dist/assets/editingTools-eh7FxppI.js | 1 - dist/assets/editingTools-ht4PZFTE.js | 1 + dist/assets/editsZScale-4-dTv58d.js | 1 + dist/assets/editsZScale-Wgw9kbYG.js | 1 - .../euclideanAreaMeasurementUtils-jpli3_gk.js | 1 + .../euclideanAreaMeasurementUtils-zmzttSyV.js | 1 - ...uclideanLengthMeasurementUtils-Kj2RYqri.js | 1 + ...uclideanLengthMeasurementUtils-VQw5qWk6.js | 1 - dist/assets/executeForIds-PXSIkRGk.js | 1 + dist/assets/executeForIds-wXO8-pll.js | 1 - dist/assets/executeForTopCount-Cgs-qCAg.js | 1 + dist/assets/executeForTopCount-bR-K9CPn.js | 1 - dist/assets/executeForTopExtents--je_5dPa.js | 1 - dist/assets/executeForTopExtents-H5vst4yE.js | 1 + dist/assets/executeForTopIds-JVLS00pE.js | 1 + dist/assets/executeForTopIds-kKHpaQVu.js | 1 - dist/assets/executeQueryJSON-ACj9qY0y.js | 1 - dist/assets/executeQueryPBF-P21isUTI.js | 1 + dist/assets/executeQueryPBF-vdaOUMid.js | 1 - .../executeRelationshipQuery-A9rcFpIX.js | 1 - .../executeRelationshipQuery-ZKqwTeNc.js | 1 + .../executeTopFeaturesQuery-pxkhoyar.js | 1 + .../executeTopFeaturesQuery-se6h6fh4.js | 1 - ...B7eEP.js => featureLayerUtils-m5wDrekx.js} | 2 +- dist/assets/featureSetUtils-0rkR6o7D.js | 7 + dist/assets/featureSetUtils-DaHg3px6.js | 7 - ...s-itZGjo5c.js => featureUtils-aSzMyCi0.js} | 2 +- dist/assets/featuresetbase-WjFIOCEy.js | 1 - dist/assets/featuresetbase-ggs9CyN5.js | 1 + ...3-0z5YnY.js => featuresetgeom-WIoEup4p.js} | 2 +- ...fM8OXOZ.js => featuresetstats-XgeLbwEn.js} | 2 +- ...3R_cQ2.js => featuresetstring-fiKCNpVo.js} | 2 +- ...e-wPWKuma6.js => fetchService-cGWNcQnc.js} | 2 +- ...ui-McpI0u1Z.js => floating-ui-C10Xvlxv.js} | 2 +- .../{form-2Iq0hI3D.js => form-1U5Kiwxm.js} | 4 +- ...H.js => generateRendererUtils-3JJTfr19.js} | 2 +- dist/assets/geojson-162a_hNo.js | 1 + dist/assets/geojson-fSjaGZrp.js | 1 - dist/assets/geomasync-7v4-s3fM.js | 1 + dist/assets/geomasync-_hAyjeTi.js | 1 - ...riy.js => geometryEngineAsync-ly7k1Z_H.js} | 2 +- ...I0L3.js => geometryEngineJSON-0_tJeUzi.js} | 2 +- dist/assets/geometryEngineWorker-8ZL1nHC2.js | 1 + dist/assets/geometryEngineWorker-yTomxYzK.js | 1 - .../{gif--X7Hb6fX.js => gif-NERjgkz0.js} | 2 +- ...ort-gleus-sO.js => gltfexport-W1GDjMOr.js} | 2 +- dist/assets/groupLayerUtils-ciLlAkrK.js | 1 - dist/assets/groupLayerUtils-dIBU5FCY.js | 1 + .../{i3s-038C_b0B.js => i3s-Sea9P9GD.js} | 4 +- .../{icon-ZwpY5ksA.js => icon-BW6RCrUr.js} | 4 +- dist/assets/imageryUtils-UiAX5Jos.js | 1 + dist/assets/imageryUtils-djrWgZtb.js | 1 - ...{index-PpMPqKeV.css => index-4b4radwv.css} | 2 +- .../{index-J0iiHjMT.js => index-pCX-0tJH.js} | 910 +++++++++--------- .../{input-9jE7tcJD.js => input-_z9XIoLu.js} | 2 +- ...ve-NKzPUNL4.js => interactive-9W9APeiw.js} | 2 +- ...xt-cWV_-jAj.js => jsonContext-EgdQULbU.js} | 2 +- ...{label2-d2vWQ7x7.js => label2-JXqLMBYY.js} | 4 +- ...int-ysDT9nFH.js => labelPoint-1MOq4I_J.js} | 2 +- ...-aC1PvuFa.js => layersCreator-kgscMbpL.js} | 2 +- dist/assets/layersLoader-5063dwjn.js | 1 - dist/assets/layersLoader-zT5u6Dmk.js | 1 + ...ayout-osE6VX-O.js => lclayout-28FIPR98.js} | 6 +- ...wasm-v7WMG2so.js => lerc-wasm-WW-RihuZ.js} | 2 +- ...ibtess-R_Me7Q5k.js => libtess-TicJCr20.js} | 2 +- ...sm-MMunuWgb.js => libtess-asm-k59Sl_HW.js} | 2 +- dist/assets/loadGLTFMesh-g6BxZi9G.js | 8 - dist/assets/loadGLTFMesh-lqLpAMsK.js | 8 + dist/assets/loadable-sxY2K1G3.js | 5 - dist/assets/loadable-uNbe2Ndt.js | 5 + ...{loader-QqciGs1c.js => loader-plQ4Tft5.js} | 2 +- ...{locale-pfkq1d6A.js => locale-tKMV0J87.js} | 2 +- dist/assets/manipulatorUtils-165rCtzd.js | 1 + dist/assets/manipulatorUtils-1y2yxq3d.js | 1 - dist/assets/measurementUtils-69EiqRp6.js | 1 + dist/assets/measurementUtils-84-ZBArh.js | 1 - dist/assets/measurementUtils-St7B-HxA.js | 1 - dist/assets/measurementUtils-U47xEmCr.js | 1 + dist/assets/meshFeatureSet-42GYfSGc.js | 7 + dist/assets/meshFeatureSet-Mcou8mDC.js | 7 - ...Thlh.js => normalizeUtilsSync-GeARMwm8.js} | 2 +- ...vers-JyBmMU24.js => observers-eNe735aq.js} | 2 +- ...tzP0u64.js => ogcFeatureUtils-8dWL_GtH.js} | 2 +- ...Oy2q.js => openCloseComponent-lU2sdEaR.js} | 2 +- ...izedFeatureQueryEngineAdapter-46ccFTR0.js} | 2 +- dist/assets/pbf-o0zzptPp.js | 1 - dist/assets/pbfQueryUtils-pWizwTQZ.js | 1 - ...e-wasm-Rr_waIie.js => pe-wasm--uz9mK5K.js} | 2 +- ...Chart-w-OTuuJJ.js => pieChart-DJY-uQgy.js} | 2 +- ...opover-Jm1QI0N1.js => popover-QEcoULsC.js} | 6 +- ...s-AqjAd9kT.js => portalLayers-Au1cdQPl.js} | 2 +- dist/assets/portalUtils-MqaWunxU.js | 1 - dist/assets/portalUtils-siGJ35LN.js | 1 + dist/assets/previewCIMSymbol-ZetpgWRs.js | 1 - dist/assets/previewCIMSymbol-mCxoLtDl.js | 1 + dist/assets/previewSymbol2D-GOMXlSDG.js | 1 + dist/assets/previewSymbol2D-V05bql6S.js | 1 - dist/assets/previewWebStyleSymbol--GeGTS2s.js | 1 - dist/assets/previewWebStyleSymbol-UL5fXUcj.js | 1 + ...gress-puB9lhY4.js => progress-TBzcAK5D.js} | 2 +- ...ooHn.js => projectExtentUtils-Q4rXasWA.js} | 2 +- dist/assets/quantityFormatUtils-NiAiojad.js | 1 - dist/assets/quantityFormatUtils-oYgdvR_2.js | 1 + dist/assets/query-rG0aX6cE.js | 1 - dist/assets/queryAttachments-2yka8D_T.js | 1 - dist/assets/queryAttachments-cBLHPfAO.js | 1 + ...1SWi13.js => queryEngineUtils-bbt-XRJJ.js} | 2 +- .../queryForSymbologySnapping-I1fFQTD_.js | 1 - .../queryForSymbologySnapping-MXWRIdj-.js | 1 + dist/assets/queryTopFeatures-L2nDK2pi.js | 1 - dist/assets/queryTopFeatures-WO1xu2NM.js | 1 + dist/assets/queryZScale-IaMm02_2.js | 1 - dist/assets/quickselect-0UUnLNDW.js | 1 + dist/assets/quickselect-UFB0jJTZ.js | 1 - ....js => rasterProjectionHelper-3sL58SxG.js} | 2 +- ...0UGdzr.js => rasterizingUtils-_-kX1RtA.js} | 2 +- ...equest-VBZq5-ns.js => request-94B0_41T.js} | 2 +- dist/assets/requestPresets-18nzHK5y.js | 1 - dist/assets/requestPresets-f6ZAWLqV.js | 1 + .../{scrim-OeyGkB0-.js => scrim-yAG2Pcs1.js} | 2 +- ...s => serviceCapabilitiesUtils-f-iBP4uh.js} | 2 +- dist/assets/settings-QjT8PN4S.js | 1 + dist/assets/settings-YeKUIkGh.js | 1 - ...ls-zbywPEXK.js => sourceUtils-nEhsDpwC.js} | 4 +- ...er-HfKfr9Es.js => statsWorker-Z_8Cn8It.js} | 2 +- ...6jl5bN.js => streamLayerUtils-NpNI_H_p.js} | 2 +- .../surfaceCoordinateSystems-siQq4eBA.js | 1 - ...ngrYnW.js => symbolLayerUtils-5Hw4LbZb.js} | 4 +- .../symbologySnappingCandidates-Sz0MFOvR.js | 1 - .../symbologySnappingCandidates-d1xE3f-Q.js | 1 + .../{t9n-od6MEnI1.js => t9n-KLe7iM0R.js} | 2 +- dist/assets/uploadAssets-aQgp-D__.js | 1 - dist/assets/uploadAssets-e680_sb_.js | 1 + .../{utils-4xKNo3Tf.js => utils-7NyN8ES_.js} | 2 +- .../{utils-rBsg-VY8.js => utils-YxtTVBu2.js} | 2 +- .../{utils-P5wTOmqv.js => utils-jVYIoPxv.js} | 2 +- ...{utils3-_ao2jQXg.js => utils3--QEgMxFs.js} | 2 +- ...s-4v9zIDlv.js => versionUtils-idhrDltC.js} | 2 +- ...Layer-oRewqFuR.js => vxlLayer-t5pvmNBM.js} | 2 +- dist/assets/webStyleUtils-0RWyEn-J.js | 1 + dist/assets/webStyleUtils-7PxVkooF.js | 1 - ...Utils-6CAR46-c.js => wfsUtils-vzWdLJRB.js} | 2 +- ...yChart-pkay2Qkc.js => xyChart-CbyBbMYg.js} | 2 +- dist/index.html | 53 +- index.html | 38 +- modules/rotatingWindmill.js | 841 ++++++++++++++++ modules/windmillAMD.js | 684 +++++++++++++ package-lock.json | 8 +- package.json | 17 +- 537 files changed, 3390 insertions(+), 1765 deletions(-) delete mode 100644 dist/assets/AnalysisToolBase-3A13PdgS.js create mode 100644 dist/assets/AnalysisToolBase-olyQy6lh.js rename dist/assets/{AnalysisView3D-jkk3JIRT.js => AnalysisView3D-XCzG0Hzh.js} (88%) rename dist/assets/{AnchorElementViewModel-SDYg-P9c.js => AnchorElementViewModel-7brFN9z4.js} (85%) delete mode 100644 dist/assets/AreaMeasurement2D-5lnD5-Sk.js create mode 100644 dist/assets/AreaMeasurement2D-GQCBQvJv.js rename dist/assets/{AreaMeasurement3D-GOBHGg9B.js => AreaMeasurement3D-ZnoqUVHu.js} (79%) delete mode 100644 dist/assets/AreaMeasurementAnalysisView3D-AasBQOV-.js create mode 100644 dist/assets/AreaMeasurementAnalysisView3D-RBc-E7CZ.js delete mode 100644 dist/assets/AttachmentInfo-kbEMEIl0.js create mode 100644 dist/assets/BaseDynamicLayerView3D-HrHMPsDQ.js delete mode 100644 dist/assets/BaseDynamicLayerView3D-aiAW9HKo.js rename dist/assets/{BaseProcessor-nWGHAt7P.js => BaseProcessor-yc_MfkjR.js} (92%) create mode 100644 dist/assets/BingMapsLayer-UB9V9S3W.js delete mode 100644 dist/assets/BingMapsLayer-d48O8tVq.js rename dist/assets/{BoundsStore-wmwfHjhp.js => BoundsStore-_-dPK5c-.js} (93%) rename dist/assets/{Box-gJ8-sOXE.js => Box-7JWnlTvk.js} (88%) create mode 100644 dist/assets/BuildingComponentSublayer-0DIX8n0s.js delete mode 100644 dist/assets/BuildingComponentSublayer-j8wian8V.js rename dist/assets/{BuildingGroupSublayer-xf_JzVTh.js => BuildingGroupSublayer-UJvyv8qt.js} (84%) create mode 100644 dist/assets/BuildingSceneLayer-Bnoa9yAy.js delete mode 100644 dist/assets/BuildingSceneLayer-YaRBOuhA.js create mode 100644 dist/assets/BuildingSceneLayerView3D-9E-CA71T.js delete mode 100644 dist/assets/BuildingSceneLayerView3D-jychJ4lg.js rename dist/assets/{Button-1STHXt3M.js => Button-HXGuX8_s.js} (93%) rename dist/assets/{CIMSymbolRasterizer-o8gx_uXl.js => CIMSymbolRasterizer-uvvL-Oh3.js} (64%) create mode 100644 dist/assets/CSVLayer-iQyfu2e9.js delete mode 100644 dist/assets/CSVLayer-tIBvmg-7.js create mode 100644 dist/assets/CSVLayerView3D-WZv0l0uX.js delete mode 100644 dist/assets/CSVLayerView3D-t0wtEtZq.js rename dist/assets/{CSVSourceWorker-GlkXsKJn.js => CSVSourceWorker-4-dU7rZu.js} (81%) rename dist/assets/{ColorSet-j9kKRPwP.js => ColorSet-tH4rJdGx.js} (95%) rename dist/assets/{CustomParametersMixin-Y1bOcayO.js => CustomParametersMixin-7nmugR3Y.js} (82%) rename dist/assets/{DefaultTheme-T7-VnRhA.js => DefaultTheme-uOYPzulo.js} (99%) rename dist/assets/{DefinitionExpressionSceneLayerView-oAOUEjm-.js => DefinitionExpressionSceneLayerView-Z1V4X6Kq.js} (93%) rename dist/assets/{DeleteForwardEditsParameters-DGoRlX6R.js => DeleteForwardEditsParameters-ZTiTrFCh.js} (73%) rename dist/assets/{DimensionAnalysisView3D-W2fgoQBr.js => DimensionAnalysisView3D-6H84TLcJ.js} (82%) delete mode 100644 dist/assets/DimensionLayer-WWUzEsQc.js create mode 100644 dist/assets/DimensionLayer-pDBYhz_R.js create mode 100644 dist/assets/DimensionLayerView3D-fNUV7ooO.js delete mode 100644 dist/assets/DimensionLayerView3D-sKnmIRMF.js delete mode 100644 dist/assets/DirectLineMeasurement3D-3Pkkgamv.js create mode 100644 dist/assets/DirectLineMeasurement3D-D1LkQv4r.js rename dist/assets/{DirectLineMeasurementAnalysisView3D-AgdgP6Nj.js => DirectLineMeasurementAnalysisView3D-iWb0_QxT.js} (76%) delete mode 100644 dist/assets/DistanceMeasurement2D-0EP_w-h3.js create mode 100644 dist/assets/DistanceMeasurement2D-Ss5XZk94.js delete mode 100644 dist/assets/Draw-DYxsSuyr.js create mode 100644 dist/assets/Draw-yCejAdh-.js delete mode 100644 dist/assets/DynamicLayerView3D-4lztpXo0.js create mode 100644 dist/assets/DynamicLayerView3D-XykdNh09.js rename dist/assets/{EdgeProcessingWorker-V8L8etpG.js => EdgeProcessingWorker-sY3QTnTZ.js} (92%) delete mode 100644 dist/assets/EditGeometryOperations-TPE5Wzab.js create mode 100644 dist/assets/EditGeometryOperations-vpHcsZOg.js rename dist/assets/{ElevationLayerView3D-aDJhr4Zv.js => ElevationLayerView3D-fn8Lf5lz.js} (52%) create mode 100644 dist/assets/ElevationProfileView2D-5R-6KsXv.js delete mode 100644 dist/assets/ElevationProfileView2D-KdZmS2un.js delete mode 100644 dist/assets/ElevationProfileView3D-bd56oGje.js create mode 100644 dist/assets/ElevationProfileView3D-ffQcLfOL.js rename dist/assets/{ElevationSamplerWorker-_kiMcA-u.js => ElevationSamplerWorker-k8_PEq10.js} (92%) delete mode 100644 dist/assets/EngineVisualElement-eZNKTKsI.js create mode 100644 dist/assets/EngineVisualElement-u0-BOxGn.js rename dist/assets/{EventedSet-JGlFrfoR.js => EventedSet-TJfupI82.js} (92%) rename dist/assets/{ExtendedLineVisualElement-YbjiXiBG.js => ExtendedLineVisualElement-VJvEdv3K.js} (88%) rename dist/assets/{ExtentTooltipInfos-LPjFe37b.js => ExtentTooltipInfos-EukgtOIT.js} (82%) delete mode 100644 dist/assets/External-GV0jSEES.js create mode 100644 dist/assets/External-Pb5poJ0S.js rename dist/assets/{Factory-m-O4WAoG.js => Factory-EVPOwZPk.js} (97%) delete mode 100644 dist/assets/FeatureCollectionSnappingSource-AwpfuxVk.js create mode 100644 dist/assets/FeatureCollectionSnappingSource-noadiOim.js rename dist/assets/{FeatureEffect-5bEV-xG1.js => FeatureEffect-0Jn9Z0sQ.js} (86%) rename dist/assets/{FeatureEffectLayer-oBa8pIG5.js => FeatureEffectLayer-OK0TB5f6.js} (67%) create mode 100644 dist/assets/FeatureFilter-_YQPNaln.js delete mode 100644 dist/assets/FeatureFilter-w5_DYl72.js delete mode 100644 dist/assets/FeatureLayer--S4epFk-.js create mode 100644 dist/assets/FeatureLayer-9tNCmEbA.js rename dist/assets/{FeatureLayerBase-jpFp8gE3.js => FeatureLayerBase-mvqC7cJs.js} (84%) delete mode 100644 dist/assets/FeatureLayerSource-AZE5JEq3.js create mode 100644 dist/assets/FeatureLayerSource-hKAUR546.js delete mode 100644 dist/assets/FeatureLayerView3D-t6NDkLO0.js create mode 100644 dist/assets/FeatureLayerView3D-vzwVkoh-.js delete mode 100644 dist/assets/FeatureLayerViewBase3D-VurTj7t3.js create mode 100644 dist/assets/FeatureLayerViewBase3D-W0Qwl4g_.js create mode 100644 dist/assets/FeatureReductionLayer-2X2_PJv9.js delete mode 100644 dist/assets/FeatureReductionLayer-RlitE1N6.js rename dist/assets/{FeatureServiceSnappingSource-El1DZ1LB.js => FeatureServiceSnappingSource-LrGkMfSm.js} (69%) create mode 100644 dist/assets/FeatureServiceSnappingSourceWorker-GdDLcUBl.js delete mode 100644 dist/assets/FeatureServiceSnappingSourceWorker-TBw9rhlL.js delete mode 100644 dist/assets/FeatureSet-d4S1oKME.js rename dist/assets/{FeatureStore-X-AIJLo2.js => FeatureStore-PXMUgn0j.js} (88%) rename dist/assets/{FeatureTemplate-kUgbbA00.js => FeatureTemplate-vSzbyslg.js} (94%) delete mode 100644 dist/assets/FeatureTileTree3DDebugger-ZBfyCqfy.js create mode 100644 dist/assets/FeatureTileTree3DDebugger-y_91jAgc.js rename dist/assets/{FeatureType-MpRe7WJj.js => FeatureType-0WPvBvpQ.js} (84%) rename dist/assets/{FloatingArrow-BghsONry.js => FloatingArrow-FUeqM5kw.js} (84%) create mode 100644 dist/assets/GeoJSONLayer--Go-c1Ql.js delete mode 100644 dist/assets/GeoJSONLayer-T9kwyVNs.js delete mode 100644 dist/assets/GeoJSONLayerView3D-4MSCbPJp.js create mode 100644 dist/assets/GeoJSONLayerView3D-lumzM4UY.js create mode 100644 dist/assets/GeoJSONSourceWorker-KDFieIXt.js delete mode 100644 dist/assets/GeoJSONSourceWorker-Sd5A35h-.js rename dist/assets/{GeoRSSLayer-hfhcgYql.js => GeoRSSLayer-mvh9EmL0.js} (73%) create mode 100644 dist/assets/GraphicManipulator-59Uc2I6c.js delete mode 100644 dist/assets/GraphicManipulator-ku6oRBpa.js rename dist/assets/{GraphicMover-DhG5Ib7v.js => GraphicMover-kaBR5sTE.js} (87%) delete mode 100644 dist/assets/GraphicState-2UcU5UAX.js create mode 100644 dist/assets/GraphicState-JOHpeXmF.js delete mode 100644 dist/assets/Graphics3DObjectStates--mMi4sdi.js create mode 100644 dist/assets/Graphics3DObjectStates-JUKhPt0b.js rename dist/assets/{GraphicsLayerView3D-TqJxY2EU.js => GraphicsLayerView3D-WVV0TMGR.js} (84%) create mode 100644 dist/assets/GraphicsProcessor-QBvSewdt.js delete mode 100644 dist/assets/GraphicsProcessor-rh5nA4fc.js create mode 100644 dist/assets/GraphicsSnappingSource-0y5Y2-KL.js delete mode 100644 dist/assets/GraphicsSnappingSource-FqTOI9A3.js rename dist/assets/{GraphicsView3D-6FUUKif_.js => GraphicsView3D-o82vqKJR.js} (81%) create mode 100644 dist/assets/GroupLayerView-Ck4zCvvf.js delete mode 100644 dist/assets/GroupLayerView-do80uFuS.js create mode 100644 dist/assets/HeatmapDensity.glsl-de3m0xZZ.js delete mode 100644 dist/assets/HeatmapDensity.glsl-y7dUg--m.js rename dist/assets/{HeatmapProcessor-QI9jD0nx.js => HeatmapProcessor-E3j18Ktz.js} (91%) rename dist/assets/{HoveredPoints-BD2phuV6.js => HoveredPoints-dZcdNiOr.js} (89%) delete mode 100644 dist/assets/I3SMeshView3D-OXYwZo0p.js create mode 100644 dist/assets/I3SMeshView3D-frxYFPRW.js rename dist/assets/{I3SNode-5SPByfpU.js => I3SNode-A9aOJfXV.js} (86%) delete mode 100644 dist/assets/I3SOverrides-5dCbMm3h.js create mode 100644 dist/assets/I3SOverrides-XXafrk1K.js delete mode 100644 dist/assets/I3SQueryFeatureStore-CLo7XXT-.js create mode 100644 dist/assets/I3SQueryFeatureStore-LSdoLFw0.js create mode 100644 dist/assets/I3STreeDebugger-kGP6iO8T.js delete mode 100644 dist/assets/I3STreeDebugger-tPVEJfH8.js rename dist/assets/{IdentityManager-DTERQ1-w.js => IdentityManager-YS7SZXzi.js} (91%) create mode 100644 dist/assets/ImageHistogramParameters-qqqpsay3.js delete mode 100644 dist/assets/ImageHistogramParameters-sFtZwJ9j.js rename dist/assets/{ImageMaterial.glsl-TdPtjVc_.js => ImageMaterial.glsl-PU0wbmEN.js} (67%) delete mode 100644 dist/assets/ImageryLayer-G7gb-fJC.js create mode 100644 dist/assets/ImageryLayer-STU2SwYQ.js rename dist/assets/{ImageryLayerView3D-Ajt9-b41.js => ImageryLayerView3D-BaVb1zzV.js} (65%) create mode 100644 dist/assets/ImageryTileLayer-7zhL4pR_.js delete mode 100644 dist/assets/ImageryTileLayer-ce5u7kmi.js create mode 100644 dist/assets/ImageryTileLayerView3D-OR6Vjdkd.js delete mode 100644 dist/assets/ImageryTileLayerView3D-kyd0hRhY.js delete mode 100644 dist/assets/IntegratedMeshLayer-T6vTIezB.js create mode 100644 dist/assets/IntegratedMeshLayer-cHWMTQWg.js create mode 100644 dist/assets/IntegratedMeshLayerView3D-3obO3XcM.js delete mode 100644 dist/assets/IntegratedMeshLayerView3D-EW3nzBgf.js delete mode 100644 dist/assets/InteractiveAnalysisViewModel-RI-qFGDH.js create mode 100644 dist/assets/InteractiveAnalysisViewModel-jrNLjGZR.js create mode 100644 dist/assets/InteractiveToolBase-6mltmL27.js delete mode 100644 dist/assets/InteractiveToolBase-WDic4GPF.js delete mode 100644 dist/assets/KMLLayer-c7r_kLDp.js create mode 100644 dist/assets/KMLLayer-pgkQk7d5.js rename dist/assets/{Laserlines.glsl-nvjcCsAw.js => Laserlines.glsl-U7nZFq0e.js} (83%) rename dist/assets/{LayerView-efDufa6j.js => LayerView-ixwLVnzr.js} (66%) create mode 100644 dist/assets/LayerView3D-57OghbRh.js delete mode 100644 dist/assets/LayerView3D-iOx2MD1g.js rename dist/assets/{LengthDimension-A_HnPDNi.js => LengthDimension-tb0JjnxZ.js} (87%) rename dist/assets/{LercWorker-e_UqPfL3.js => LercWorker-p4NiAClL.js} (98%) delete mode 100644 dist/assets/LineOfSightAnalysisView3D-lX-OBMBB.js create mode 100644 dist/assets/LineOfSightAnalysisView3D-oCrG9jF8.js rename dist/assets/{LineOfSightLayer-JMoACZan.js => LineOfSightLayer-5jg3FABh.js} (93%) delete mode 100644 dist/assets/LineOfSightLayerView3D-rUjgrEFl.js create mode 100644 dist/assets/LineOfSightLayerView3D-uRdo1RJr.js rename dist/assets/{LineSeries-VcEznTH7.js => LineSeries-yr_9erUD.js} (99%) rename dist/assets/{LineVisualElement-4BP10o6v.js => LineVisualElement-iKo1s90I.js} (90%) create mode 100644 dist/assets/LinkChartLayer-bx0B-Kgd.js delete mode 100644 dist/assets/LinkChartLayer-uIn6uT3L.js create mode 100644 dist/assets/MapImageLayer-oZq_Q4o2.js delete mode 100644 dist/assets/MapImageLayer-qMOOMfH7.js rename dist/assets/{MapImageLayerView3D-GIO-oWiM.js => MapImageLayerView3D-XQURj3BI.js} (77%) delete mode 100644 dist/assets/MapNotesLayer-CdG3vHcH.js create mode 100644 dist/assets/MapNotesLayer-ldLz1FWK.js rename dist/assets/{MapServiceLayerViewHelper-a8WMaeWS.js => MapServiceLayerViewHelper-45ApjWde.js} (57%) rename dist/assets/{MeasurementWidgetContent-d8uX7Gw_.js => MeasurementWidgetContent-PH9XFoV4.js} (86%) delete mode 100644 dist/assets/MediaElementView-ezYHddnZ.js create mode 100644 dist/assets/MediaElementView-pYfW8oR4.js delete mode 100644 dist/assets/MediaLayer-39dmiD7K.js create mode 100644 dist/assets/MediaLayer-PKp6pKCX.js rename dist/assets/{MediaLayerView3D-CIdxGOiQ.js => MediaLayerView3D-LfY78zh1.js} (75%) rename dist/assets/{MemorySourceWorker-K3WXTL5J.js => MemorySourceWorker-6wu4D2bo.js} (81%) delete mode 100644 dist/assets/OGCFeatureLayer--w0HTnNu.js create mode 100644 dist/assets/OGCFeatureLayer-hko6jm86.js delete mode 100644 dist/assets/OGCFeatureLayerView3D-FLI41Ca4.js create mode 100644 dist/assets/OGCFeatureLayerView3D-a9b4I66a.js rename dist/assets/{Object3DVisualElement-TMb7y_wl.js => Object3DVisualElement-8HoU366x.js} (91%) rename dist/assets/{OpenStreetMapLayer-6XrQQ-kN.js => OpenStreetMapLayer-qslplUAm.js} (94%) rename dist/assets/{OrderedLayer-M7k5gLgx.js => OrderedLayer-XNaJwl_G.js} (89%) create mode 100644 dist/assets/OrientedImageryLayer-F57-BGcl.js delete mode 100644 dist/assets/OrientedImageryLayer-LKoItije.js delete mode 100644 dist/assets/PBFDecoderWorker--NqrOA1Y.js create mode 100644 dist/assets/PBFDecoderWorker-mLYHZi4e.js delete mode 100644 dist/assets/Pipeline--6jAENf8.js create mode 100644 dist/assets/Pipeline-PlEwhMAg.js rename dist/assets/{PointCloudLayer-qVzMPRjJ.js => PointCloudLayer-EgPyZPkK.js} (82%) rename dist/assets/{PointCloudLayerView3D-KHREaqUZ.js => PointCloudLayerView3D-LHTTpHpk.js} (63%) delete mode 100644 dist/assets/PointCloudUniqueValueRenderer-RbbyNiwC.js create mode 100644 dist/assets/PointCloudUniqueValueRenderer-mGlOSV4H.js rename dist/assets/{PointCloudWorker-UgniuzRB.js => PointCloudWorker-rfPDyXh6.js} (82%) rename dist/assets/{PointCloudWorkerUtil-q8ml4JQu.js => PointCloudWorkerUtil-uutRAft1.js} (70%) delete mode 100644 dist/assets/PointSnappingHint-ULetRXiW.js create mode 100644 dist/assets/PointSnappingHint-bwlQAyn6.js rename dist/assets/{PointVisualElement-bX-_4FqS.js => PointVisualElement-m9C0-AJh.js} (92%) rename dist/assets/{PooledRBush-o8tLYBG5.js => PooledRBush-rhLtoPG7.js} (83%) rename dist/assets/{Popup-aRK3Vd3w.js => Popup-a4-j6aRT.js} (65%) rename dist/assets/{PopupSceneLayerView-cRxapYqF.js => PopupSceneLayerView-1BvuVn-Q.js} (87%) delete mode 100644 dist/assets/QueryEngine-8tLWlkSE.js create mode 100644 dist/assets/QueryEngine-uvDs-vBe.js delete mode 100644 dist/assets/QueryTask-91TvtrTt.js create mode 100644 dist/assets/QueryTask-Di0fqnMV.js rename dist/assets/{RasterWorker-0s4_fI9v.js => RasterWorker-dDXhiR2p.js} (89%) rename dist/assets/{ReactiveSet-HLstcUcf.js => ReactiveSet-_4-UpKXZ.js} (92%) create mode 100644 dist/assets/RefreshableLayerView-DVYs7L04.js delete mode 100644 dist/assets/RefreshableLayerView-Pd4dLcWr.js delete mode 100644 dist/assets/Reshape-J0NI6bzM.js create mode 100644 dist/assets/Reshape-c3RtsBQr.js rename dist/assets/{Responsive-QKXcW_1q.js => Responsive-QlPOQ03r.js} (98%) rename dist/assets/{RightAngleQuadVisualElement-y_W8r903.js => RightAngleQuadVisualElement-Jj11oqLR.js} (73%) rename dist/assets/{RouteLayer-GamYzZdr.js => RouteLayer-HsRHI0PF.js} (78%) rename dist/assets/{RouteLayerView3D-tOy-WtTD.js => RouteLayerView3D-EnI30QTX.js} (84%) delete mode 100644 dist/assets/SceneLayerGraphicsView3D-Abn6jwJk.js create mode 100644 dist/assets/SceneLayerGraphicsView3D-KM9RpQwS.js delete mode 100644 dist/assets/SceneLayerSnappingSource-u6yw_bMd.js create mode 100644 dist/assets/SceneLayerSnappingSource-wfFr0F0T.js create mode 100644 dist/assets/SceneLayerSnappingSourceWorker-Ty-SvQ0f.js delete mode 100644 dist/assets/SceneLayerSnappingSourceWorker-gaKuqg8q.js delete mode 100644 dist/assets/SceneLayerView-MZstNOoI.js create mode 100644 dist/assets/SceneLayerView-Z2vMKB9z.js delete mode 100644 dist/assets/SceneLayerView3D-7NpyxR5M.js create mode 100644 dist/assets/SceneLayerView3D-wSIS3UPq.js rename dist/assets/{SceneLayerWorker-o7OZRrjZ.js => SceneLayerWorker-fjNBmTGi.js} (75%) create mode 100644 dist/assets/SceneModification-E4lNPbBQ.js delete mode 100644 dist/assets/SceneModification-dyp2M_Yg.js delete mode 100644 dist/assets/SceneSnappingManagerPool-OpebO9Di.js create mode 100644 dist/assets/SceneSnappingManagerPool-V-V1M2q0.js create mode 100644 dist/assets/Segment-TQS1M_Ix.js delete mode 100644 dist/assets/Segment-hN2uWAPW.js rename dist/assets/{ShadedColorMaterial.glsl-Fp4o6LjC.js => ShadedColorMaterial.glsl-L0JVQzbX.js} (69%) delete mode 100644 dist/assets/SliceAnalysisView3D--IcVdus9.js create mode 100644 dist/assets/SliceAnalysisView3D--Kqu5Yhm.js delete mode 100644 dist/assets/SlicePlaneMaterial.glsl-RxywoUhm.js create mode 100644 dist/assets/SlicePlaneMaterial.glsl-xVEc2mct.js rename dist/assets/{SnappingContext-6K6JmvvY.js => SnappingContext-ax0tf6c6.js} (78%) create mode 100644 dist/assets/SnappingDragPipelineStep-HDAWWRgo.js delete mode 100644 dist/assets/SnappingDragPipelineStep-THHIXt-p.js rename dist/assets/{SnappingOperation-2U48wt1k.js => SnappingOperation-hED0OM8D.js} (92%) create mode 100644 dist/assets/SnappingVisualizer2D-JqQy3X5x.js delete mode 100644 dist/assets/SnappingVisualizer2D-NnEm1PvQ.js delete mode 100644 dist/assets/SnappingVisualizer3D-KWlqByBu.js create mode 100644 dist/assets/SnappingVisualizer3D-PUGfSdbO.js rename dist/assets/{SpatialFilter-CXhA7RaJ.js => SpatialFilter-h73GoH-a.js} (96%) rename dist/assets/{Stop-W76EJiT2.js => Stop-d3MLMjE8.js} (99%) rename dist/assets/{StreamFeatureManager-QrKJ84_c.js => StreamFeatureManager-Iguqr18K.js} (98%) create mode 100644 dist/assets/StreamLayer-FMdUAhtW.js delete mode 100644 dist/assets/StreamLayer-KHxHoWyI.js create mode 100644 dist/assets/StreamLayerView3D-kATjjzFd.js delete mode 100644 dist/assets/StreamLayerView3D-nu_wqFzJ.js rename dist/assets/{StyleRepository-UhXfhILC.js => StyleRepository-TpBuuKhf.js} (90%) delete mode 100644 dist/assets/SublayersOwner-8xrm3MkT.js create mode 100644 dist/assets/SublayersOwner-Hx1szNtg.js create mode 100644 dist/assets/SubtypeGroupLayer-lkxtOZrq.js delete mode 100644 dist/assets/SubtypeGroupLayer-xK5RtU9X.js create mode 100644 dist/assets/SymbolProcessor-dUsJwb8f.js delete mode 100644 dist/assets/SymbolProcessor-pXDjnfSh.js rename dist/assets/{TerrainTileTree3DDebugger-Or7WvqAU.js => TerrainTileTree3DDebugger-3kUE1gqF.js} (58%) create mode 100644 dist/assets/TextOverlayItem-YHZxWGyg.js delete mode 100644 dist/assets/TextOverlayItem-eCjvS6IO.js rename dist/assets/{Theme-QNc_77AM.js => Theme-5CV7oVsW.js} (99%) rename dist/assets/{Tick-WQ_bPwW2.js => Tick-bu1aEuYp.js} (99%) create mode 100644 dist/assets/TileLayer-RB9GhSe4.js delete mode 100644 dist/assets/TileLayer-bPSfr5GU.js rename dist/assets/{TileLayerView3D-5Hf3FIEh.js => TileLayerView3D-KbvgzCEw.js} (78%) delete mode 100644 dist/assets/TileTreeDebugger-2DVbY5sQ.js create mode 100644 dist/assets/TileTreeDebugger-MxH50s1q.js delete mode 100644 dist/assets/TiledLayerView3D-Av58zTxG.js create mode 100644 dist/assets/TiledLayerView3D-_U1Q993H.js rename dist/assets/{TimeOnly-ljWtUK7N.js => TimeOnly-gkehHHJx.js} (97%) rename dist/assets/{Tooltip-lrFZgXdG.js => Tooltip-4JsqFz5S.js} (99%) rename dist/assets/{Tooltip-ON77BKb3.js => Tooltip-a9KqLK1p.js} (76%) delete mode 100644 dist/assets/TopFeaturesQuery-E6D2tV-x.js rename dist/assets/{TranslateTooltipInfos-J6BygtUO.js => TranslateTooltipInfos-DywsDtXz.js} (94%) delete mode 100644 dist/assets/TurboLine-SWK4qRwh.js create mode 100644 dist/assets/TurboLine-cWldrV9L.js delete mode 100644 dist/assets/UnitNormalizer-19C91v_m.js create mode 100644 dist/assets/UnitNormalizer-RQizSo9a.js rename dist/assets/{UnknownLayer-3OKGB96U.js => UnknownLayer-lHoSTlsX.js} (83%) create mode 100644 dist/assets/UnsupportedLayer--BUwN-ET.js delete mode 100644 dist/assets/UnsupportedLayer-s0OShVnj.js delete mode 100644 dist/assets/VectorTileLayer-0SVRfneU.js create mode 100644 dist/assets/VectorTileLayer-3l6dancR.js create mode 100644 dist/assets/VectorTileLayerView3D-eTryeubP.js delete mode 100644 dist/assets/VectorTileLayerView3D-eexSRj3E.js rename dist/assets/{VertexSnappingCandidate-sgrBHAMS.js => VertexSnappingCandidate-YEvkEqQJ.js} (51%) rename dist/assets/{VerticesVisualElement-oQAA_hbc.js => VerticesVisualElement-QZStMB48.js} (92%) rename dist/assets/{VisualElement-kjYXz27t.js => VisualElement--2Scr6Yq.js} (94%) delete mode 100644 dist/assets/VoxelLayer-NKOtejie.js create mode 100644 dist/assets/VoxelLayer-ggmlUmsY.js rename dist/assets/{VoxelLayerView3D-FruX8zyo.js => VoxelLayerView3D-4VCjvhwH.js} (62%) delete mode 100644 dist/assets/VoxelWasmPerSceneView-YeZpknKe.js create mode 100644 dist/assets/VoxelWasmPerSceneView-xko8AJDS.js create mode 100644 dist/assets/WFSLayer-8l6HCYA6.js delete mode 100644 dist/assets/WFSLayer-VPxAc_vg.js delete mode 100644 dist/assets/WFSLayerView3D-OjHmKjv_.js create mode 100644 dist/assets/WFSLayerView3D-_qadKQVq.js create mode 100644 dist/assets/WFSSourceWorker-AqESE9b6.js delete mode 100644 dist/assets/WFSSourceWorker-iUwpu94Y.js rename dist/assets/{WMSLayerView3D-HO_hwLwX.js => WMSLayerView3D-OqbPQcsr.js} (81%) delete mode 100644 dist/assets/WMTSLayer-Qx8zOTb2.js create mode 100644 dist/assets/WMTSLayer-TE5fyme_.js create mode 100644 dist/assets/WMTSLayerView3D-6XYesvf9.js delete mode 100644 dist/assets/WMTSLayerView3D-oO1etwl-.js rename dist/assets/{WebTileLayer-JxqArsF7.js => WebTileLayer-jfo0VJmw.js} (87%) rename dist/assets/{WhereClause-XAMIZ4-B.js => WhereClause-FOYoIAAW.js} (94%) delete mode 100644 dist/assets/WorkerTileHandler-9KieSe2P.js create mode 100644 dist/assets/WorkerTileHandler-znQwxG7k.js rename dist/assets/{action-W5zDPNjG.js => action-bN6v5--b.js} (94%) rename dist/assets/{action-group-8XaPC2xM.js => action-group-6S1AUKwx.js} (89%) rename dist/assets/{action-menu-h_LAlWK7.js => action-menu-FiGuYhhw.js} (91%) delete mode 100644 dist/assets/analysisViewUtils-AQaQeJpR.js create mode 100644 dist/assets/analysisViewUtils-lJExoyyw.js create mode 100644 dist/assets/apng-_AWHiAIA.js delete mode 100644 dist/assets/apng-yUSt3z2o.js rename dist/assets/{arcadeAsyncRuntime-RlgIDugP.js => arcadeAsyncRuntime-RaDNZAaP.js} (98%) rename dist/assets/{arcadeUtils-OUqwHs4P.js => arcadeUtils-vGyJZHQt.js} (93%) rename dist/assets/{arcgis-knowledge-client-core-k0_SaRI-.js => arcgis-knowledge-client-core-FOb54Y-y.js} (91%) rename dist/assets/{arcgis-knowledge-client-core-simd-wFoqgd0S.js => arcgis-knowledge-client-core-simd-VjZZ0mc4.js} (91%) rename dist/assets/{arcgisLayers-Ja4-CB3n.js => arcgisLayers-SSMNCJNX.js} (85%) create mode 100644 dist/assets/automaticAreaMeasurementUtils-kRuWnHc-.js delete mode 100644 dist/assets/automaticAreaMeasurementUtils-nVd6Y5mX.js rename dist/assets/{basis_transcoder-FsrOzl2Q.js => basis_transcoder-5u4h2z6s.js} (99%) rename dist/assets/{button-dkwNndhL.js => button-4hsayCiP.js} (98%) create mode 100644 dist/assets/calcite-action-GYDrwtQs.js rename dist/assets/{calcite-action-bar-yKX8eCZY.js => calcite-action-bar-1xecS7ni.js} (88%) create mode 100644 dist/assets/calcite-action-group-ZfO11pHg.js delete mode 100644 dist/assets/calcite-action-group-_Xoggrsa.js delete mode 100644 dist/assets/calcite-action-mEzyoc-Z.js create mode 100644 dist/assets/calcite-button-rIOy-85Y.js delete mode 100644 dist/assets/calcite-button-tOn16zeN.js rename dist/assets/{calcite-checkbox-OaFCWd7i.js => calcite-checkbox-u3DU2spl.js} (93%) rename dist/assets/{calcite-chip-MkTbFpRn.js => calcite-chip-SaUQXOua.js} (95%) rename dist/assets/{calcite-color-picker-iQ658ZQD.js => calcite-color-picker--cLRGCVy.js} (98%) rename dist/assets/{calcite-dropdown-group-bJt5U1w-.js => calcite-dropdown-group-5Uhho6JI.js} (95%) rename dist/assets/{calcite-dropdown-item-HvBJs5CH.js => calcite-dropdown-item-UdaqM-Sc.js} (96%) rename dist/assets/{calcite-dropdown-caxGPYrb.js => calcite-dropdown-r3pviJNw.js} (92%) rename dist/assets/{calcite-flow-A39UdeqN.js => calcite-flow-Hhr0ymgr.js} (95%) rename dist/assets/{calcite-flow-item-mBjWFd-U.js => calcite-flow-item-cLwEh1ST.js} (90%) rename dist/assets/{calcite-icon-itD416se.js => calcite-icon-ZhRmLRGh.js} (69%) create mode 100644 dist/assets/calcite-input-1VO9g4ut.js delete mode 100644 dist/assets/calcite-input-V4_hyPVg.js rename dist/assets/{calcite-label-lSeWOYbm.js => calcite-label-DHrtVvrs.js} (96%) rename dist/assets/{calcite-list-LJfGqLbO.js => calcite-list-KbTGTbJq.js} (98%) rename dist/assets/{calcite-list-item-OtIyVNHT.js => calcite-list-item-ewhQm-Oo.js} (94%) rename dist/assets/{calcite-list-item-group-havhVECR.js => calcite-list-item-group-L6UN1q3l.js} (93%) rename dist/assets/{calcite-loader-Z65agR8e.js => calcite-loader-IfjW-6zZ.js} (69%) rename dist/assets/{calcite-notice-zH528nES.js => calcite-notice-6pbWdSt0.js} (95%) rename dist/assets/{calcite-option-LMeeGK3H.js => calcite-option-XCvROySu.js} (94%) create mode 100644 dist/assets/calcite-popover-Lvoq79Pm.js delete mode 100644 dist/assets/calcite-popover-PeZ1jQob.js rename dist/assets/{calcite-scrim-iUD6Tmec.js => calcite-scrim-eUqm3Zfl.js} (50%) rename dist/assets/{calcite-select-0Yw6DsYN.js => calcite-select-h4uorzoD.js} (91%) rename dist/assets/{calcite-slider--uw2bYfU.js => calcite-slider-czDRxbAt.js} (97%) rename dist/assets/{calcite-tooltip-DucKIjb_.js => calcite-tooltip-ewJ_kzN3.js} (94%) rename dist/assets/{chartCommon-ZPkVkRIK.js => chartCommon-OKgpftOz.js} (96%) create mode 100644 dist/assets/chartUtils-24xN4NV-.js delete mode 100644 dist/assets/chartUtils-P39aKol1.js rename dist/assets/{chartUtilsAm5-QfmFJ3lc.js => chartUtilsAm5-owLhGEU2.js} (99%) delete mode 100644 dist/assets/cimAnalyzer-DtyBzAGI.js create mode 100644 dist/assets/cimAnalyzer-X6MTpVAO.js rename dist/assets/{clientSideDefaults-F-CNnR0g.js => clientSideDefaults-63pOkJ4Y.js} (86%) rename dist/assets/{conditionalSlot-e55zipTI.js => conditionalSlot-OgY0Ln74.js} (83%) rename dist/assets/{createConnection-4ppGVnSc.js => createConnection-iXdhuUHv.js} (71%) delete mode 100644 dist/assets/createSymbolSchema-Tv2jMAOE.js create mode 100644 dist/assets/createSymbolSchema-cxObHUlP.js create mode 100644 dist/assets/dataUtils-_QoSHbCE.js delete mode 100644 dist/assets/dataUtils-s_UKlouc.js rename dist/assets/{definitions-DqQMJYPH.js => definitions-SVBNHUSH.js} (71%) rename dist/assets/{dehydratedFeatureComparison-hdPq-zad.js => dehydratedFeatureComparison-IJSogXWn.js} (96%) delete mode 100644 dist/assets/deleteForwardEdits-Pq-0h4Vp.js create mode 100644 dist/assets/deleteForwardEdits-kZj3bKFL.js delete mode 100644 dist/assets/dragEventPipeline3D-4CqrlxD2.js create mode 100644 dist/assets/dragEventPipeline3D-H_IlIVP7.js rename dist/assets/{drapedUtils-9db1OpTX.js => drapedUtils-F1ywqHD-.js} (96%) create mode 100644 dist/assets/drawSurfaces-t1mGEx1r.js rename dist/assets/{drawUtils-woTYaREB.js => drawUtils-0wb2c6-q.js} (57%) delete mode 100644 dist/assets/editPlaneUtils-4qxd7h1E.js create mode 100644 dist/assets/editPlaneUtils-TRKNVTzb.js delete mode 100644 dist/assets/editingSupport-EiPa9PKq.js create mode 100644 dist/assets/editingSupport-HfkJiqt7.js delete mode 100644 dist/assets/editingTools-1yHclJT1.js create mode 100644 dist/assets/editingTools-KuLEWRoO.js delete mode 100644 dist/assets/editingTools-eh7FxppI.js create mode 100644 dist/assets/editingTools-ht4PZFTE.js create mode 100644 dist/assets/editsZScale-4-dTv58d.js delete mode 100644 dist/assets/editsZScale-Wgw9kbYG.js create mode 100644 dist/assets/euclideanAreaMeasurementUtils-jpli3_gk.js delete mode 100644 dist/assets/euclideanAreaMeasurementUtils-zmzttSyV.js create mode 100644 dist/assets/euclideanLengthMeasurementUtils-Kj2RYqri.js delete mode 100644 dist/assets/euclideanLengthMeasurementUtils-VQw5qWk6.js create mode 100644 dist/assets/executeForIds-PXSIkRGk.js delete mode 100644 dist/assets/executeForIds-wXO8-pll.js create mode 100644 dist/assets/executeForTopCount-Cgs-qCAg.js delete mode 100644 dist/assets/executeForTopCount-bR-K9CPn.js delete mode 100644 dist/assets/executeForTopExtents--je_5dPa.js create mode 100644 dist/assets/executeForTopExtents-H5vst4yE.js create mode 100644 dist/assets/executeForTopIds-JVLS00pE.js delete mode 100644 dist/assets/executeForTopIds-kKHpaQVu.js delete mode 100644 dist/assets/executeQueryJSON-ACj9qY0y.js create mode 100644 dist/assets/executeQueryPBF-P21isUTI.js delete mode 100644 dist/assets/executeQueryPBF-vdaOUMid.js delete mode 100644 dist/assets/executeRelationshipQuery-A9rcFpIX.js create mode 100644 dist/assets/executeRelationshipQuery-ZKqwTeNc.js create mode 100644 dist/assets/executeTopFeaturesQuery-pxkhoyar.js delete mode 100644 dist/assets/executeTopFeaturesQuery-se6h6fh4.js rename dist/assets/{featureLayerUtils-o55B7eEP.js => featureLayerUtils-m5wDrekx.js} (77%) create mode 100644 dist/assets/featureSetUtils-0rkR6o7D.js delete mode 100644 dist/assets/featureSetUtils-DaHg3px6.js rename dist/assets/{featureUtils-itZGjo5c.js => featureUtils-aSzMyCi0.js} (80%) delete mode 100644 dist/assets/featuresetbase-WjFIOCEy.js create mode 100644 dist/assets/featuresetbase-ggs9CyN5.js rename dist/assets/{featuresetgeom-3-0z5YnY.js => featuresetgeom-WIoEup4p.js} (88%) rename dist/assets/{featuresetstats-NfM8OXOZ.js => featuresetstats-XgeLbwEn.js} (91%) rename dist/assets/{featuresetstring-bt3R_cQ2.js => featuresetstring-fiKCNpVo.js} (95%) rename dist/assets/{fetchService-wPWKuma6.js => fetchService-cGWNcQnc.js} (90%) rename dist/assets/{floating-ui-McpI0u1Z.js => floating-ui-C10Xvlxv.js} (99%) rename dist/assets/{form-2Iq0hI3D.js => form-1U5Kiwxm.js} (66%) rename dist/assets/{generateRendererUtils-_1jVE02H.js => generateRendererUtils-3JJTfr19.js} (94%) create mode 100644 dist/assets/geojson-162a_hNo.js delete mode 100644 dist/assets/geojson-fSjaGZrp.js create mode 100644 dist/assets/geomasync-7v4-s3fM.js delete mode 100644 dist/assets/geomasync-_hAyjeTi.js rename dist/assets/{geometryEngineAsync-QjQc0riy.js => geometryEngineAsync-ly7k1Z_H.js} (74%) rename dist/assets/{geometryEngineJSON-FxYgI0L3.js => geometryEngineJSON-0_tJeUzi.js} (98%) create mode 100644 dist/assets/geometryEngineWorker-8ZL1nHC2.js delete mode 100644 dist/assets/geometryEngineWorker-yTomxYzK.js rename dist/assets/{gif--X7Hb6fX.js => gif-NERjgkz0.js} (94%) rename dist/assets/{gltfexport-gleus-sO.js => gltfexport-W1GDjMOr.js} (88%) delete mode 100644 dist/assets/groupLayerUtils-ciLlAkrK.js create mode 100644 dist/assets/groupLayerUtils-dIBU5FCY.js rename dist/assets/{i3s-038C_b0B.js => i3s-Sea9P9GD.js} (93%) rename dist/assets/{icon-ZwpY5ksA.js => icon-BW6RCrUr.js} (73%) create mode 100644 dist/assets/imageryUtils-UiAX5Jos.js delete mode 100644 dist/assets/imageryUtils-djrWgZtb.js rename dist/assets/{index-PpMPqKeV.css => index-4b4radwv.css} (87%) rename dist/assets/{index-J0iiHjMT.js => index-pCX-0tJH.js} (52%) rename dist/assets/{input-9jE7tcJD.js => input-_z9XIoLu.js} (98%) rename dist/assets/{interactive-NKzPUNL4.js => interactive-9W9APeiw.js} (98%) rename dist/assets/{jsonContext-cWV_-jAj.js => jsonContext-EgdQULbU.js} (92%) rename dist/assets/{label2-d2vWQ7x7.js => label2-JXqLMBYY.js} (58%) rename dist/assets/{labelPoint-ysDT9nFH.js => labelPoint-1MOq4I_J.js} (85%) rename dist/assets/{layersCreator-aC1PvuFa.js => layersCreator-kgscMbpL.js} (95%) delete mode 100644 dist/assets/layersLoader-5063dwjn.js create mode 100644 dist/assets/layersLoader-zT5u6Dmk.js rename dist/assets/{lclayout-osE6VX-O.js => lclayout-28FIPR98.js} (89%) rename dist/assets/{lerc-wasm-v7WMG2so.js => lerc-wasm-WW-RihuZ.js} (99%) rename dist/assets/{libtess-R_Me7Q5k.js => libtess-TicJCr20.js} (78%) rename dist/assets/{libtess-asm-MMunuWgb.js => libtess-asm-k59Sl_HW.js} (88%) delete mode 100644 dist/assets/loadGLTFMesh-g6BxZi9G.js create mode 100644 dist/assets/loadGLTFMesh-lqLpAMsK.js delete mode 100644 dist/assets/loadable-sxY2K1G3.js create mode 100644 dist/assets/loadable-uNbe2Ndt.js rename dist/assets/{loader-QqciGs1c.js => loader-plQ4Tft5.js} (98%) rename dist/assets/{locale-pfkq1d6A.js => locale-tKMV0J87.js} (98%) create mode 100644 dist/assets/manipulatorUtils-165rCtzd.js delete mode 100644 dist/assets/manipulatorUtils-1y2yxq3d.js create mode 100644 dist/assets/measurementUtils-69EiqRp6.js delete mode 100644 dist/assets/measurementUtils-84-ZBArh.js delete mode 100644 dist/assets/measurementUtils-St7B-HxA.js create mode 100644 dist/assets/measurementUtils-U47xEmCr.js create mode 100644 dist/assets/meshFeatureSet-42GYfSGc.js delete mode 100644 dist/assets/meshFeatureSet-Mcou8mDC.js rename dist/assets/{normalizeUtilsSync-zfJiThlh.js => normalizeUtilsSync-GeARMwm8.js} (78%) rename dist/assets/{observers-JyBmMU24.js => observers-eNe735aq.js} (95%) rename dist/assets/{ogcFeatureUtils-dtzP0u64.js => ogcFeatureUtils-8dWL_GtH.js} (80%) rename dist/assets/{openCloseComponent-yw47Oy2q.js => openCloseComponent-lU2sdEaR.js} (97%) rename dist/assets/{optimizedFeatureQueryEngineAdapter-KnoSHZzG.js => optimizedFeatureQueryEngineAdapter-46ccFTR0.js} (79%) delete mode 100644 dist/assets/pbf-o0zzptPp.js delete mode 100644 dist/assets/pbfQueryUtils-pWizwTQZ.js rename dist/assets/{pe-wasm-Rr_waIie.js => pe-wasm--uz9mK5K.js} (99%) rename dist/assets/{pieChart-w-OTuuJJ.js => pieChart-DJY-uQgy.js} (98%) rename dist/assets/{popover-Jm1QI0N1.js => popover-QEcoULsC.js} (92%) rename dist/assets/{portalLayers-AqjAd9kT.js => portalLayers-Au1cdQPl.js} (89%) delete mode 100644 dist/assets/portalUtils-MqaWunxU.js create mode 100644 dist/assets/portalUtils-siGJ35LN.js delete mode 100644 dist/assets/previewCIMSymbol-ZetpgWRs.js create mode 100644 dist/assets/previewCIMSymbol-mCxoLtDl.js create mode 100644 dist/assets/previewSymbol2D-GOMXlSDG.js delete mode 100644 dist/assets/previewSymbol2D-V05bql6S.js delete mode 100644 dist/assets/previewWebStyleSymbol--GeGTS2s.js create mode 100644 dist/assets/previewWebStyleSymbol-UL5fXUcj.js rename dist/assets/{progress-puB9lhY4.js => progress-TBzcAK5D.js} (96%) rename dist/assets/{projectExtentUtils-TwA6ooHn.js => projectExtentUtils-Q4rXasWA.js} (84%) delete mode 100644 dist/assets/quantityFormatUtils-NiAiojad.js create mode 100644 dist/assets/quantityFormatUtils-oYgdvR_2.js delete mode 100644 dist/assets/query-rG0aX6cE.js delete mode 100644 dist/assets/queryAttachments-2yka8D_T.js create mode 100644 dist/assets/queryAttachments-cBLHPfAO.js rename dist/assets/{queryEngineUtils-0F1SWi13.js => queryEngineUtils-bbt-XRJJ.js} (60%) delete mode 100644 dist/assets/queryForSymbologySnapping-I1fFQTD_.js create mode 100644 dist/assets/queryForSymbologySnapping-MXWRIdj-.js delete mode 100644 dist/assets/queryTopFeatures-L2nDK2pi.js create mode 100644 dist/assets/queryTopFeatures-WO1xu2NM.js delete mode 100644 dist/assets/queryZScale-IaMm02_2.js create mode 100644 dist/assets/quickselect-0UUnLNDW.js delete mode 100644 dist/assets/quickselect-UFB0jJTZ.js rename dist/assets/{rasterProjectionHelper-KvYWHIT_.js => rasterProjectionHelper-3sL58SxG.js} (81%) rename dist/assets/{rasterizingUtils-6P0UGdzr.js => rasterizingUtils-_-kX1RtA.js} (96%) rename dist/assets/{request-VBZq5-ns.js => request-94B0_41T.js} (93%) delete mode 100644 dist/assets/requestPresets-18nzHK5y.js create mode 100644 dist/assets/requestPresets-f6ZAWLqV.js rename dist/assets/{scrim-OeyGkB0-.js => scrim-yAG2Pcs1.js} (91%) rename dist/assets/{serviceCapabilitiesUtils-26KpT1VN.js => serviceCapabilitiesUtils-f-iBP4uh.js} (95%) create mode 100644 dist/assets/settings-QjT8PN4S.js delete mode 100644 dist/assets/settings-YeKUIkGh.js rename dist/assets/{sourceUtils-zbywPEXK.js => sourceUtils-nEhsDpwC.js} (50%) rename dist/assets/{statsWorker-HfKfr9Es.js => statsWorker-Z_8Cn8It.js} (95%) rename dist/assets/{streamLayerUtils-j16jl5bN.js => streamLayerUtils-NpNI_H_p.js} (64%) delete mode 100644 dist/assets/surfaceCoordinateSystems-siQq4eBA.js rename dist/assets/{symbolLayerUtils-VVngrYnW.js => symbolLayerUtils-5Hw4LbZb.js} (67%) delete mode 100644 dist/assets/symbologySnappingCandidates-Sz0MFOvR.js create mode 100644 dist/assets/symbologySnappingCandidates-d1xE3f-Q.js rename dist/assets/{t9n-od6MEnI1.js => t9n-KLe7iM0R.js} (90%) delete mode 100644 dist/assets/uploadAssets-aQgp-D__.js create mode 100644 dist/assets/uploadAssets-e680_sb_.js rename dist/assets/{utils-4xKNo3Tf.js => utils-7NyN8ES_.js} (92%) rename dist/assets/{utils-rBsg-VY8.js => utils-YxtTVBu2.js} (71%) rename dist/assets/{utils-P5wTOmqv.js => utils-jVYIoPxv.js} (53%) rename dist/assets/{utils3-_ao2jQXg.js => utils3--QEgMxFs.js} (98%) rename dist/assets/{versionUtils-4v9zIDlv.js => versionUtils-idhrDltC.js} (98%) rename dist/assets/{vxlLayer-oRewqFuR.js => vxlLayer-t5pvmNBM.js} (99%) create mode 100644 dist/assets/webStyleUtils-0RWyEn-J.js delete mode 100644 dist/assets/webStyleUtils-7PxVkooF.js rename dist/assets/{wfsUtils-6CAR46-c.js => wfsUtils-vzWdLJRB.js} (73%) rename dist/assets/{xyChart-pkay2Qkc.js => xyChart-CbyBbMYg.js} (97%) create mode 100644 modules/rotatingWindmill.js create mode 100644 modules/windmillAMD.js diff --git a/app.js b/app.js index a9f338e..90b46e6 100644 --- a/app.js +++ b/app.js @@ -15,7 +15,6 @@ // Esri imports import Conversion from "@arcgis/core/widgets/CoordinateConversion/support/Conversion.js"; -//import Measurement from "@arcgis/core/widgets/Measurement.js"; // Local imports import { @@ -63,6 +62,9 @@ import { createURL, setupViewPoint, } from "./modules/goToLocation.js"; +import { + displayWindmills +} from "./modules/rotatingWindmill"; /************************************************************ * Init scene (/w layers) and view @@ -101,6 +103,11 @@ const akDTM = setupElevationLayer( const view = setupWebView(scene); + + + + + view.when(() => { /************************************** * Geology layer setup @@ -255,6 +262,12 @@ view.when(() => { setupSketch(view, graphicsLayer); + /************************************** + * Rotating windmills + **************************************/ + + displayWindmills(view); + /************************************** * Reordering layers **************************************/ @@ -350,6 +363,5 @@ view.when(() => { if (locationArray !== null) { const viewpoint = setupViewPoint(locationArray); view.goTo(viewpoint, { animate: false }); - console.log(basemaps); } }); diff --git a/dist/assets/AnalysisToolBase-3A13PdgS.js b/dist/assets/AnalysisToolBase-3A13PdgS.js deleted file mode 100644 index 1678c25..0000000 --- a/dist/assets/AnalysisToolBase-3A13PdgS.js +++ /dev/null @@ -1 +0,0 @@ -import{e as s,y as i,c as a,d as r,A as o}from"./index-J0iiHjMT.js";import{l}from"./InteractiveToolBase-WDic4GPF.js";let t=class extends l{constructor(e){super(e)}initialize(){this.addHandles(r(()=>this.analysisViewData.visible,e=>this.visible=e,o))}deactivate(){this.onDeactivate(),this.created||this.analysis.clear()}resetCreated(){this._set("created",!1)}};s([i({constructOnly:!0})],t.prototype,"analysis",void 0),s([i()],t.prototype,"analysisViewData",void 0),t=s([a("esri.views.interactive.AnalysisToolBase")],t);export{t as a}; diff --git a/dist/assets/AnalysisToolBase-olyQy6lh.js b/dist/assets/AnalysisToolBase-olyQy6lh.js new file mode 100644 index 0000000..ea81755 --- /dev/null +++ b/dist/assets/AnalysisToolBase-olyQy6lh.js @@ -0,0 +1 @@ +import{e,y as i,c as a,B as r,T as o}from"./index-pCX-0tJH.js";import{l}from"./InteractiveToolBase-6mltmL27.js";let s=class extends l{constructor(t){super(t)}initialize(){this.addHandles(r(()=>this.analysisViewData.visible,t=>this.visible=t,o))}deactivate(){this.onDeactivate(),this.created||this.analysis.clear()}resetCreated(){this._set("created",!1)}};e([i({constructOnly:!0})],s.prototype,"analysis",void 0),e([i()],s.prototype,"analysisViewData",void 0),s=e([a("esri.views.interactive.AnalysisToolBase")],s);export{s as a}; diff --git a/dist/assets/AnalysisView3D-jkk3JIRT.js b/dist/assets/AnalysisView3D-XCzG0Hzh.js similarity index 88% rename from dist/assets/AnalysisView3D-jkk3JIRT.js rename to dist/assets/AnalysisView3D-XCzG0Hzh.js index 0b45294..ef3ae56 100644 --- a/dist/assets/AnalysisView3D-jkk3JIRT.js +++ b/dist/assets/AnalysisView3D-XCzG0Hzh.js @@ -1 +1 @@ -import{cZ as o,a2 as s,e as t,y as i,c as a}from"./index-J0iiHjMT.js";const p=n=>{let e=class extends o(n){constructor(){super(...arguments),this.parent=null,this._userInteractive=!1,this._interactiveViewModelCount=0}get interactive(){return this._interactiveViewModelCount>0||this._userInteractive}set interactive(r){this._userInteractive=r}get updating(){return!1}get visible(){return this.parent==null||this.parent.visible&&!this.parent.suspended}set visible(r){this._overrideIfSome("visible",r)}forceInteractiveForViewModel(){return this._interactiveViewModelCount++,s(()=>this._interactiveViewModelCount--)}};return t([i({readOnly:!0})],e.prototype,"type",void 0),t([i({constructOnly:!0})],e.prototype,"analysis",void 0),t([i({constructOnly:!0})],e.prototype,"parent",void 0),t([i({constructOnly:!0})],e.prototype,"view",void 0),t([i({type:Boolean})],e.prototype,"interactive",null),t([i()],e.prototype,"_userInteractive",void 0),t([i({readOnly:!0})],e.prototype,"updating",null),t([i()],e.prototype,"visible",null),t([i()],e.prototype,"_interactiveViewModelCount",void 0),e=t([a("esri.views.3d.analysis.AnalysisView3D")],e),e};export{p as s}; +import{cQ as o,a0 as s,e as t,y as i,c as a}from"./index-pCX-0tJH.js";const p=n=>{let e=class extends o(n){constructor(){super(...arguments),this.parent=null,this._userInteractive=!1,this._interactiveViewModelCount=0}get interactive(){return this._interactiveViewModelCount>0||this._userInteractive}set interactive(r){this._userInteractive=r}get updating(){return!1}get visible(){return this.parent==null||this.parent.visible&&!this.parent.suspended}set visible(r){this._overrideIfSome("visible",r)}forceInteractiveForViewModel(){return this._interactiveViewModelCount++,s(()=>this._interactiveViewModelCount--)}};return t([i({readOnly:!0})],e.prototype,"type",void 0),t([i({constructOnly:!0})],e.prototype,"analysis",void 0),t([i({constructOnly:!0})],e.prototype,"parent",void 0),t([i({constructOnly:!0})],e.prototype,"view",void 0),t([i({type:Boolean})],e.prototype,"interactive",null),t([i()],e.prototype,"_userInteractive",void 0),t([i({readOnly:!0})],e.prototype,"updating",null),t([i()],e.prototype,"visible",null),t([i()],e.prototype,"_interactiveViewModelCount",void 0),e=t([a("esri.views.3d.analysis.AnalysisView3D")],e),e};export{p as s}; diff --git a/dist/assets/AnchorElementViewModel-SDYg-P9c.js b/dist/assets/AnchorElementViewModel-7brFN9z4.js similarity index 85% rename from dist/assets/AnchorElementViewModel-SDYg-P9c.js rename to dist/assets/AnchorElementViewModel-7brFN9z4.js index 99397f6..4256b6a 100644 --- a/dist/assets/AnchorElementViewModel-SDYg-P9c.js +++ b/dist/assets/AnchorElementViewModel-7brFN9z4.js @@ -1 +1 @@ -import{K as c,F as l,d as r,e as o,y as i,c as a}from"./index-J0iiHjMT.js";let t=class extends c.EventedAccessor{constructor(n){super(n),this.location=null,this.screenLocationEnabled=!1,this.view=null,this.addHandles([l(()=>{const e=this.screenLocationEnabled?this.view:null;return e?[e.size,e.type==="3d"?e.camera:e.viewpoint]:null},()=>this.notifyChange("screenLocation")),r(()=>this.screenLocation,(e,s)=>{e!=null&&s!=null&&this.emit("view-change")})])}destroy(){this.view=null}get screenLocation(){const{location:n,view:e,screenLocationEnabled:s}=this;return s&&n!=null&&e!=null&&e.ready?e.toScreen(n):null}};o([i()],t.prototype,"location",void 0),o([i()],t.prototype,"screenLocation",null),o([i()],t.prototype,"screenLocationEnabled",void 0),o([i()],t.prototype,"view",void 0),t=o([a("esri.widgets.support.AnchorElementViewModel")],t);const p=t;export{p as c}; +import{z as c,v as l,B as r,e as o,y as i,c as a}from"./index-pCX-0tJH.js";let t=class extends c.EventedAccessor{constructor(n){super(n),this.location=null,this.screenLocationEnabled=!1,this.view=null,this.addHandles([l(()=>{const e=this.screenLocationEnabled?this.view:null;return e?[e.size,e.type==="3d"?e.camera:e.viewpoint]:null},()=>this.notifyChange("screenLocation")),r(()=>this.screenLocation,(e,s)=>{e!=null&&s!=null&&this.emit("view-change")})])}destroy(){this.view=null}get screenLocation(){const{location:n,view:e,screenLocationEnabled:s}=this;return s&&n!=null&&e!=null&&e.ready?e.toScreen(n):null}};o([i()],t.prototype,"location",void 0),o([i()],t.prototype,"screenLocation",null),o([i()],t.prototype,"screenLocationEnabled",void 0),o([i()],t.prototype,"view",void 0),t=o([a("esri.widgets.support.AnchorElementViewModel")],t);const p=t;export{p as c}; diff --git a/dist/assets/AreaMeasurement2D-5lnD5-Sk.js b/dist/assets/AreaMeasurement2D-5lnD5-Sk.js deleted file mode 100644 index 08c5c14..0000000 --- a/dist/assets/AreaMeasurement2D-5lnD5-Sk.js +++ /dev/null @@ -1 +0,0 @@ -import{e as a,y as o,c as U,Q as R,kw as I,kx as P,d as $,P as T,n as M,d$ as Q,T as W,O as X,S as L,bX as Y,hS as q,a8 as Z,c1 as ee,ky as te,kz as se,kA as ie,J as z,N as B,kB as C,kC as f,e1 as v,ar as k,kD as A,kE as H,l as re,kF as b,kG as S,kH as O,kI as ae,aD as ne,kJ as oe,hx as V,cy as E,cK as le,cF as ue,cG as me,cB as ce,kK as he,kL as D,w as pe,e0 as de,kM as x,hl as ve,hn as N,ao as ye,kN as j,kO as we}from"./index-J0iiHjMT.js";import{l as _e}from"./Draw-DYxsSuyr.js";import{l as fe,d as ge,v as be,x as $e}from"./InteractiveToolBase-WDic4GPF.js";import{S as ke}from"./GraphicManipulator-ku6oRBpa.js";import{n as Le,u as Me}from"./MeasurementWidgetContent-d8uX7Gw_.js";import"./SnappingVisualizer2D-NnEm1PvQ.js";import"./SnappingContext-6K6JmvvY.js";import"./PointSnappingHint-ULetRXiW.js";import"./EditGeometryOperations-TPE5Wzab.js";import"./SnappingOperation-2U48wt1k.js";import"./surfaceCoordinateSystems-siQq4eBA.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./SnappingDragPipelineStep-THHIXt-p.js";import"./drawUtils-woTYaREB.js";import"./drapedUtils-9db1OpTX.js";const y=1e5;let w=class extends fe{constructor(e){super(e),this._drawActive=!1,this._measurementLayer=new R({internal:!0,listMode:"hide",visible:!1}),this._manipulatorLayer=new R({internal:!0,listMode:"hide",visible:!1}),this._vertices=[],this.geodesicDistanceThreshold=1e5,this.measurement=null,this.measurementLabel=null}initialize(){I("esri/core/t9n/Units").then(t=>{this.messages=t}),this.addHandles(P(async()=>{this.messages=await I("esri/core/t9n/Units")}));const e=this.view;this._draw=new _e({view:e}),e.map.addMany([this._measurementLayer,this._manipulatorLayer]),e.focus(),this.addHandles([$(()=>[this.unit,this.geodesicDistanceThreshold,this.messages],()=>{this._updateGraphics()},T),$(()=>[this.view.effectiveTheme.accentColor,this.view.effectiveTheme.textColor],()=>{if(!this._vertices.length)return;const t=this._vertices.map(({coord:i})=>i);for(const{handle:i}of this._vertices)i.remove();this._vertices=[],this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this.manipulators.removeAll(),this._updateSketch(t)})])}destroy(){const{map:e}=this.view;this._draw.view=null,this._draw=M(this._draw),e.removeMany([this._measurementLayer,this._manipulatorLayer]),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._measurementLayer=M(this._measurementLayer),this._manipulatorLayer=M(this._manipulatorLayer),this._resetVertices()}get cursor(){return this._drawActive?"crosshair":null}set editable(e){this._set("editable",e),e||this._draw.reset()}onActivate(){this._drawActive||this._vertices.length!==0||this._startSketch()}onShow(){this._measurementLayer.visible=!0,this._manipulatorLayer.visible=!0}onHide(){this._measurementLayer.visible=!1,this._manipulatorLayer.visible=!1}reset(){this.manipulators.removeAll(),this._resetVertices(),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._draw.reset(),this._drawActive=!1}_resetVertices(){for(const{handle:e}of this._vertices)e.remove();this._vertices=[]}_startSketch(){this._drawActive=!0;const e=this._draw.create("polyline",{mode:"click"});e.on(["vertex-add","vertex-update","vertex-remove","cursor-update","undo","redo"],t=>this._updateSketch(t.vertices)),e.on("draw-complete",()=>this._stopSketch())}_stopSketch(){if(this._vertices.length<3)return this.reset(),void this._startSketch();this.manipulators.forEach(({manipulator:e})=>{e.interactive=!0}),this._drawActive=!1,this.finishToolCreation()}_updateSketch(e){const t=this.view.spatialReference;if(t&&(!K(t)||Q())){for(;this._vertices.length>e.length;){const{handle:i,manipulator:r}=this._vertices.pop();i.remove(),this.manipulators.remove(r)}for(let i=this._vertices.length;i{s.next(be(this.view)).next($e(n.graphic,X.Local)).next(()=>{const c=n.graphic.geometry;this._vertices[i].coord=[c.x,c.y],this._updateGraphics()})});this._vertices.push({manipulator:l,coord:[r,u],handle:m})}if(this._vertices.length){const i=this._vertices.length-1,r=this._vertices[i],[u,l]=e[i];r.coord[0]===u&&r.coord[1]===l||(r.coord=[u,l],r.manipulator.graphic.geometry=new W({x:u,y:l,spatialReference:t}));const m=this._drawActive?this._vertices[i].manipulator:null;this.manipulators.forEach(({manipulator:n})=>{n.interactive=m==null||n!==m})}this._updateGraphics()}}_updateGraphics(){if(this._vertices.length<2)return void this._measurementLayer.removeAll();const e=Se(this._vertices.map(({coord:d})=>d),this.view.spatialReference,this.geodesicDistanceThreshold);if(!e)return;const{measurement:t,fillGeometry:i,outlineGeometry:r}=e;this._set("measurement",t);const u=t?De(this.messages,t,this.unit):null;if(this._set("measurementLabel",u),!i&&!r)return;let l,m,n;const{graphics:s}=this._measurementLayer,c=s.length===3,{effectiveTheme:h}=this.view;c?(l=s.at(0),m=s.at(1),n=s.at(2)):(l=new L({symbol:new Y({color:q(h.accentColor,.3),outline:null})}),m=new L({symbol:new Z({color:h.accentColor,width:2})}),n=new L({symbol:new ee({color:h.textColor,font:new te({size:14,family:"sans-serif"}),haloColor:q(se(h.textColor,ie.Low),.5),haloSize:2})}),s.removeAll(),s.addMany([l,m,n])),l.geometry=i,m.geometry=r,n.geometry=i==null?void 0:i.centroid,n.symbol.text=(u==null?void 0:u.area)??""}};function Ae(e,t,i){const u={style:"circle",color:q(t.effectiveTheme.accentColor,.5),outline:{type:"simple-line",width:0}},l=new z({...u,size:8}),m=new z({...u,size:1.5*8}),n=new L({geometry:e,symbol:l});return new ke({view:t,layer:i,graphic:n,focusedSymbol:m})}function Se(e,t,i){if(e.length===2){const c=new B({paths:e,spatialReference:t});let h;if(t!=null&&t.isGeographic)if(C(t))h=f(c,y);else{const d=v(c,k.WGS84),g=f(d,y);h=v(g,t)}else if(t!=null&&t.isWebMercator)h=A(c,y,"meters");else if(H(c,"meters")>=i){const d=v(c,k.WGS84),g=f(d,y);h=v(g,t)}else h=c;return{measurement:null,fillGeometry:null,outlineGeometry:h}}e.push(e[0]);const r=new B({paths:[e],spatialReference:t}),u=new re({rings:[e],spatialReference:t});let l,m,n=null,s=null;if(t!=null&&t.isGeographic)if(C(t)){if(n=f(r,y),s=f(u,y),s=b(s),!s)return null;l=S([r],"meters")[0],m=O([s],"square-meters")[0]}else{const c=k.WGS84,h=v(r,c),d=v(u,c);if(n=f(h,y),s=f(d,y),s=b(s),!s)return null;l=S([h],"meters")[0],m=O([s],"square-meters")[0],n=v(n,t),s=v(s,t)}else if(t!=null&&t.isWebMercator){if(n=A(r,y,"meters"),s=A(u,y,"meters"),s=b(s),!s)return null;l=ae(r,"meters"),m=ne(s,"square-meters")}else{const c=H(r,"meters");if(c>=i){const h=k.WGS84,d=v(r,h),g=v(u,h);if(n=f(d,y),s=f(g,y),s=b(s),!s)return null;l=S([d],"meters")[0],m=O([s],"square-meters")[0],n=v(n,t),s=v(s,t)}else{if(n=r,s=b(u),!s)return null;l=c,m=oe(s,"square-meters")}}return{measurement:{geometry:s,area:m,perimeter:l},fillGeometry:s,outlineGeometry:n}}function Oe(e){return e!=null}function K(e){if(!e)return!1;const{isGeographic:t,isWebMercator:i,isWGS84:r}=e;return t&&!r&&!C(e)||!t&&!i}function De(e,t,i){if(!t||!e)return null;const r={area:null,perimeter:null},{area:u,perimeter:l}=t;switch(i){case"metric":r.area=ue(e,u,"square-meters");break;case"imperial":r.area=le(e,u,"square-meters");break;default:{const n=V(u,"square-meters",i);r.area=E(e,n,i);break}}const m=xe(i);if(m)switch(m){case"metric":r.perimeter=ce(e,l,"meters");break;case"imperial":r.perimeter=me(e,l,"meters");break;default:{const n=V(l,"meters",m);r.perimeter=E(e,n,m);break}}else r.perimeter="";return r}function xe(e){switch(e){case"metric":case"ares":case"hectares":return"metric";case"imperial":case"acres":return"imperial";case"square-inches":return"inches";case"square-feet":return"feet";case"square-yards":return"yards";case"square-miles":return"miles";case"square-us-feet":return"us-feet";case"square-meters":return"meters";case"square-kilometers":return"kilometers";case"square-millimeters":return"millimeters";case"square-centimeters":return"centimeters";case"square-decimeters":return"decimeters";default:return null}}a([o()],w.prototype,"_drawActive",void 0),a([o({readOnly:!0})],w.prototype,"cursor",null),a([o({value:!0})],w.prototype,"editable",null),a([o({type:Number})],w.prototype,"geodesicDistanceThreshold",void 0),a([o({readOnly:!0})],w.prototype,"measurement",void 0),a([o({readOnly:!0})],w.prototype,"measurementLabel",void 0),a([o()],w.prototype,"messages",void 0),a([o()],w.prototype,"unit",void 0),a([o({constructOnly:!0})],w.prototype,"view",void 0),w=a([U("esri.widgets.AreaMeasurement2D.AreaMeasurement2DTool")],w);let _=class extends Le{constructor(e){super(e),this.supportedViewType="2d",this.unsupportedErrorMessage="AreaMeasurement2DViewModel is only supported in 2D views.",this.geodesicDistanceThreshold=1e5}initialize(){this.addHandles([$(()=>{var e;return(e=this.view)==null?void 0:e.spatialReference},()=>this.clear()),$(()=>this.unit,e=>{this.tool!=null&&(this.tool.unit=e)},T),$(()=>this.geodesicDistanceThreshold,e=>{this.tool!=null&&(this.tool.geodesicDistanceThreshold=e)},T)])}get measurement(){return this.tool!=null?this.tool.measurement:null}get measurementLabel(){return this.tool!=null?this.tool.measurementLabel:null}get state(){var e;return this.disabled||this.view==null||!Oe(this.view.spatialReference)?"disabled":(e=this.tool)!=null&&e.measurement?this.tool.active?"measuring":"measured":"ready"}get unit(){return this._validateUnit(this.defaultUnit)}set unit(e){this._overrideIfSome("unit",this._validateUnit(e))}get unitOptions(){return D}set unitOptions(e){this._overrideIfSome("unitOptions",this._validateUnits(e))}async start(){const e=this.view;e!=null&&(await pe(()=>e.ready),K(e.spatialReference)&&await de()),this.createTool({interactive:!0})}clear(){this.removeTool()}constructTool(){return new w({view:this.view,visible:this.visible,geodesicDistanceThreshold:this.geodesicDistanceThreshold,unit:this.unit})}_validateUnit(e){const{unitOptions:t,defaultUnit:i}=this;return e!=null&&t.includes(e)?e:t.includes(i)?i:t.length>0?t[0]:i}_validateUnits(e){if(e==null)return[];const t=e.filter(i=>D.includes(i));return t.length===0?D.slice():t}};a([o(he)],_.prototype,"defaultUnit",void 0),a([o({type:Number})],_.prototype,"geodesicDistanceThreshold",void 0),a([o({readOnly:!0})],_.prototype,"measurement",null),a([o({readOnly:!0})],_.prototype,"measurementLabel",null),a([o({readOnly:!0})],_.prototype,"state",null),a([o({type:String})],_.prototype,"unit",null),a([o({type:[String]})],_.prototype,"unitOptions",null),_=a([U("esri.widgets.AreaMeasurement2D.AreaMeasurement2DViewModel")],_);const F=_,J="esri-area-measurement-2d",G={base:J,newMeasurementButton:`${J}__clear-button`,widgetIcon:we.measureArea};let p=class extends ve{constructor(e,t){super(e,t),this.iconClass=G.widgetIcon,this.icon=null,this.messages=null,this.messagesUnits=null,this.messagesCommon=null,this.viewModel=new F}get active(){return this.viewModel.active}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){const{messages:e,messagesCommon:t,messagesUnits:i,unit:r,unitOptions:u,viewModel:l,visible:m}=this,{active:n,measurementLabel:s,state:c,supported:h}=l;return N("div",{"aria-label":e.widgetLabel,class:this.classes(G.base,j.widget,j.panel),key:this,role:"presentation"},m?N(Me,{active:n,measurementItems:[{key:"area",title:i==null?void 0:i.measures.area,value:s==null?void 0:s.area},{key:"perimeter",title:e.perimeter,value:s==null?void 0:s.perimeter}],messages:{...e,notApplicable:t.notApplicable},newMeasurementButtonClass:G.newMeasurementButton,state:c,supported:h,unit:r,unitOptions:u,onNewMeasurementClick:()=>{ye(l.start())},onUnitChange:d=>{this.unit=d}}):null)}};a([o({readOnly:!0})],p.prototype,"active",null),a([o()],p.prototype,"iconClass",void 0),a([o()],p.prototype,"icon",void 0),a([o()],p.prototype,"label",null),a([o(),x("esri/widgets/AreaMeasurement2D/t9n/AreaMeasurement2D")],p.prototype,"messages",void 0),a([o(),x("esri/core/t9n/Units")],p.prototype,"messagesUnits",void 0),a([o(),x("esri/t9n/common")],p.prototype,"messagesCommon",void 0),a([o()],p.prototype,"uiStrings",void 0),a([o()],p.prototype,"unit",null),a([o()],p.prototype,"unitOptions",null),a([o()],p.prototype,"view",null),a([o({type:F})],p.prototype,"viewModel",void 0),a([o({type:Boolean})],p.prototype,"visible",null),p=a([U("esri.widgets.AreaMeasurement2D")],p);const Je=p;export{Je as default}; diff --git a/dist/assets/AreaMeasurement2D-GQCBQvJv.js b/dist/assets/AreaMeasurement2D-GQCBQvJv.js new file mode 100644 index 0000000..bde3254 --- /dev/null +++ b/dist/assets/AreaMeasurement2D-GQCBQvJv.js @@ -0,0 +1 @@ +import{e as a,y as o,c as U,G as R,kI as W,kJ as J,B as k,P as x,b as M,dU as Q,L as I,F as X,K as L,aw as Y,hR as G,a6 as Z,aC as ee,kK as te,kL as se,kM as ie,x as V,E as z,kN as C,kO as f,dW as v,d2 as $,kP as A,kQ as B,j as re,kR as b,kS as S,kF as O,kT as ae,d9 as ne,kU as oe,hr as E,co as H,cA as le,cv as ue,cw as me,cr as ce,kV as he,kW as D,aa as pe,dV as de,kX as T,hD as ve,hF as N,br as ye,kY as j,kZ as we}from"./index-pCX-0tJH.js";import{l as _e}from"./Draw-yCejAdh-.js";import{l as fe,d as ge,v as be,x as ke}from"./InteractiveToolBase-6mltmL27.js";import{S as $e}from"./GraphicManipulator-59Uc2I6c.js";import{n as Le,u as Me}from"./MeasurementWidgetContent-PH9XFoV4.js";import"./SnappingVisualizer2D-JqQy3X5x.js";import"./SnappingContext-ax0tf6c6.js";import"./PointSnappingHint-bwlQAyn6.js";import"./EditGeometryOperations-vpHcsZOg.js";import"./SnappingOperation-hED0OM8D.js";import"./drawSurfaces-t1mGEx1r.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./SnappingDragPipelineStep-HDAWWRgo.js";import"./drawUtils-0wb2c6-q.js";import"./drapedUtils-F1ywqHD-.js";const y=1e5;let w=class extends fe{constructor(e){super(e),this._drawActive=!1,this._measurementLayer=new R({internal:!0,listMode:"hide",visible:!1}),this._manipulatorLayer=new R({internal:!0,listMode:"hide",visible:!1}),this._vertices=[],this.geodesicDistanceThreshold=1e5,this.measurement=null,this.measurementLabel=null}initialize(){W("esri/core/t9n/Units").then(t=>{this.messages=t}),this.addHandles(J(async()=>{this.messages=await W("esri/core/t9n/Units")}));const e=this.view;this._draw=new _e({view:e}),e.map.addMany([this._measurementLayer,this._manipulatorLayer]),e.focus(),this.addHandles([k(()=>[this.unit,this.geodesicDistanceThreshold,this.messages],()=>{this._updateGraphics()},x),k(()=>[this.view.effectiveTheme.accentColor,this.view.effectiveTheme.textColor],()=>{if(!this._vertices.length)return;const t=this._vertices.map(({coord:i})=>i);for(const{handle:i}of this._vertices)i.remove();this._vertices=[],this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this.manipulators.removeAll(),this._updateSketch(t)})])}destroy(){const{map:e}=this.view;this._draw.view=null,this._draw=M(this._draw),e.removeMany([this._measurementLayer,this._manipulatorLayer]),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._measurementLayer=M(this._measurementLayer),this._manipulatorLayer=M(this._manipulatorLayer),this._resetVertices()}get cursor(){return this._drawActive?"crosshair":null}set editable(e){this._set("editable",e),e||this._draw.reset()}onActivate(){this._drawActive||this._vertices.length!==0||this._startSketch()}onShow(){this._measurementLayer.visible=!0,this._manipulatorLayer.visible=!0}onHide(){this._measurementLayer.visible=!1,this._manipulatorLayer.visible=!1}reset(){this.manipulators.removeAll(),this._resetVertices(),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._draw.reset(),this._drawActive=!1}_resetVertices(){for(const{handle:e}of this._vertices)e.remove();this._vertices=[]}_startSketch(){this._drawActive=!0;const e=this._draw.create("polyline",{mode:"click"});e.on(["vertex-add","vertex-update","vertex-remove","cursor-update","undo","redo"],t=>this._updateSketch(t.vertices)),e.on("draw-complete",()=>this._stopSketch())}_stopSketch(){if(this._vertices.length<3)return this.reset(),void this._startSketch();this.manipulators.forEach(({manipulator:e})=>{e.interactive=!0}),this._drawActive=!1,this.finishToolCreation()}_updateSketch(e){const t=this.view.spatialReference;if(t&&(!K(t)||Q())){for(;this._vertices.length>e.length;){const{handle:i,manipulator:r}=this._vertices.pop();i.remove(),this.manipulators.remove(r)}for(let i=this._vertices.length;i{s.next(be(this.view)).next(ke(n.graphic,X.Local)).next(()=>{const c=n.graphic.geometry;this._vertices[i].coord=[c.x,c.y],this._updateGraphics()})});this._vertices.push({manipulator:l,coord:[r,u],handle:m})}if(this._vertices.length){const i=this._vertices.length-1,r=this._vertices[i],[u,l]=e[i];r.coord[0]===u&&r.coord[1]===l||(r.coord=[u,l],r.manipulator.graphic.geometry=new I({x:u,y:l,spatialReference:t}));const m=this._drawActive?this._vertices[i].manipulator:null;this.manipulators.forEach(({manipulator:n})=>{n.interactive=m==null||n!==m})}this._updateGraphics()}}_updateGraphics(){if(this._vertices.length<2)return void this._measurementLayer.removeAll();const e=Se(this._vertices.map(({coord:d})=>d),this.view.spatialReference,this.geodesicDistanceThreshold);if(!e)return;const{measurement:t,fillGeometry:i,outlineGeometry:r}=e;this._set("measurement",t);const u=t?De(this.messages,t,this.unit):null;if(this._set("measurementLabel",u),!i&&!r)return;let l,m,n;const{graphics:s}=this._measurementLayer,c=s.length===3,{effectiveTheme:h}=this.view;c?(l=s.at(0),m=s.at(1),n=s.at(2)):(l=new L({symbol:new Y({color:G(h.accentColor,.3),outline:null})}),m=new L({symbol:new Z({color:h.accentColor,width:2})}),n=new L({symbol:new ee({color:h.textColor,font:new te({size:14,family:"sans-serif"}),haloColor:G(se(h.textColor,ie.Low),.5),haloSize:2})}),s.removeAll(),s.addMany([l,m,n])),l.geometry=i,m.geometry=r,n.geometry=i==null?void 0:i.centroid,n.symbol.text=(u==null?void 0:u.area)??""}};function Ae(e,t,i){const u={style:"circle",color:G(t.effectiveTheme.accentColor,.5),outline:{type:"simple-line",width:0}},l=new V({...u,size:8}),m=new V({...u,size:1.5*8}),n=new L({geometry:e,symbol:l});return new $e({view:t,layer:i,graphic:n,focusedSymbol:m})}function Se(e,t,i){if(e.length===2){const c=new z({paths:e,spatialReference:t});let h;if(t!=null&&t.isGeographic)if(C(t))h=f(c,y);else{const d=v(c,$.WGS84),g=f(d,y);h=v(g,t)}else if(t!=null&&t.isWebMercator)h=A(c,y,"meters");else if(B(c,"meters")>=i){const d=v(c,$.WGS84),g=f(d,y);h=v(g,t)}else h=c;return{measurement:null,fillGeometry:null,outlineGeometry:h}}e.push(e[0]);const r=new z({paths:[e],spatialReference:t}),u=new re({rings:[e],spatialReference:t});let l,m,n=null,s=null;if(t!=null&&t.isGeographic)if(C(t)){if(n=f(r,y),s=f(u,y),s=b(s),!s)return null;l=S([r],"meters")[0],m=O([s],"square-meters")[0]}else{const c=$.WGS84,h=v(r,c),d=v(u,c);if(n=f(h,y),s=f(d,y),s=b(s),!s)return null;l=S([h],"meters")[0],m=O([s],"square-meters")[0],n=v(n,t),s=v(s,t)}else if(t!=null&&t.isWebMercator){if(n=A(r,y,"meters"),s=A(u,y,"meters"),s=b(s),!s)return null;l=ae(r,"meters"),m=ne(s,"square-meters")}else{const c=B(r,"meters");if(c>=i){const h=$.WGS84,d=v(r,h),g=v(u,h);if(n=f(d,y),s=f(g,y),s=b(s),!s)return null;l=S([d],"meters")[0],m=O([s],"square-meters")[0],n=v(n,t),s=v(s,t)}else{if(n=r,s=b(u),!s)return null;l=c,m=oe(s,"square-meters")}}return{measurement:{geometry:s,area:m,perimeter:l},fillGeometry:s,outlineGeometry:n}}function Oe(e){return e!=null}function K(e){if(!e)return!1;const{isGeographic:t,isWebMercator:i,isWGS84:r}=e;return t&&!r&&!C(e)||!t&&!i}function De(e,t,i){if(!t||!e)return null;const r={area:null,perimeter:null},{area:u,perimeter:l}=t;switch(i){case"metric":r.area=ue(e,u,"square-meters");break;case"imperial":r.area=le(e,u,"square-meters");break;default:{const n=E(u,"square-meters",i);r.area=H(e,n,i);break}}const m=Te(i);if(m)switch(m){case"metric":r.perimeter=ce(e,l,"meters");break;case"imperial":r.perimeter=me(e,l,"meters");break;default:{const n=E(l,"meters",m);r.perimeter=H(e,n,m);break}}else r.perimeter="";return r}function Te(e){switch(e){case"metric":case"ares":case"hectares":return"metric";case"imperial":case"acres":return"imperial";case"square-inches":return"inches";case"square-feet":return"feet";case"square-yards":return"yards";case"square-miles":return"miles";case"square-us-feet":return"us-feet";case"square-meters":return"meters";case"square-kilometers":return"kilometers";case"square-millimeters":return"millimeters";case"square-centimeters":return"centimeters";case"square-decimeters":return"decimeters";default:return null}}a([o()],w.prototype,"_drawActive",void 0),a([o({readOnly:!0})],w.prototype,"cursor",null),a([o({value:!0})],w.prototype,"editable",null),a([o({type:Number})],w.prototype,"geodesicDistanceThreshold",void 0),a([o({readOnly:!0})],w.prototype,"measurement",void 0),a([o({readOnly:!0})],w.prototype,"measurementLabel",void 0),a([o()],w.prototype,"messages",void 0),a([o()],w.prototype,"unit",void 0),a([o({constructOnly:!0})],w.prototype,"view",void 0),w=a([U("esri.widgets.AreaMeasurement2D.AreaMeasurement2DTool")],w);let _=class extends Le{constructor(e){super(e),this.supportedViewType="2d",this.unsupportedErrorMessage="AreaMeasurement2DViewModel is only supported in 2D views.",this.geodesicDistanceThreshold=1e5}initialize(){this.addHandles([k(()=>{var e;return(e=this.view)==null?void 0:e.spatialReference},()=>this.clear()),k(()=>this.unit,e=>{this.tool!=null&&(this.tool.unit=e)},x),k(()=>this.geodesicDistanceThreshold,e=>{this.tool!=null&&(this.tool.geodesicDistanceThreshold=e)},x)])}get measurement(){return this.tool!=null?this.tool.measurement:null}get measurementLabel(){return this.tool!=null?this.tool.measurementLabel:null}get state(){var e;return this.disabled||this.view==null||!Oe(this.view.spatialReference)?"disabled":(e=this.tool)!=null&&e.measurement?this.tool.active?"measuring":"measured":"ready"}get unit(){return this._validateUnit(this.defaultUnit)}set unit(e){this._overrideIfSome("unit",this._validateUnit(e))}get unitOptions(){return D}set unitOptions(e){this._overrideIfSome("unitOptions",this._validateUnits(e))}async start(){const e=this.view;e!=null&&(await pe(()=>e.ready),K(e.spatialReference)&&await de()),this.createTool({interactive:!0})}clear(){this.removeTool()}constructTool(){return new w({view:this.view,visible:this.visible,geodesicDistanceThreshold:this.geodesicDistanceThreshold,unit:this.unit})}_validateUnit(e){const{unitOptions:t,defaultUnit:i}=this;return e!=null&&t.includes(e)?e:t.includes(i)?i:t.length>0?t[0]:i}_validateUnits(e){if(e==null)return[];const t=e.filter(i=>D.includes(i));return t.length===0?D.slice():t}};a([o(he)],_.prototype,"defaultUnit",void 0),a([o({type:Number})],_.prototype,"geodesicDistanceThreshold",void 0),a([o({readOnly:!0})],_.prototype,"measurement",null),a([o({readOnly:!0})],_.prototype,"measurementLabel",null),a([o({readOnly:!0})],_.prototype,"state",null),a([o({type:String})],_.prototype,"unit",null),a([o({type:[String]})],_.prototype,"unitOptions",null),_=a([U("esri.widgets.AreaMeasurement2D.AreaMeasurement2DViewModel")],_);const P=_,F="esri-area-measurement-2d",q={base:F,newMeasurementButton:`${F}__clear-button`,widgetIcon:we.measureArea};let p=class extends ve{constructor(e,t){super(e,t),this.iconClass=q.widgetIcon,this.icon=null,this.messages=null,this.messagesUnits=null,this.messagesCommon=null,this.viewModel=new P}get active(){return this.viewModel.active}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){const{messages:e,messagesCommon:t,messagesUnits:i,unit:r,unitOptions:u,viewModel:l,visible:m}=this,{active:n,measurementLabel:s,state:c,supported:h}=l;return N("div",{"aria-label":e.widgetLabel,class:this.classes(q.base,j.widget,j.panel),key:this,role:"presentation"},m?N(Me,{active:n,measurementItems:[{key:"area",title:i==null?void 0:i.measures.area,value:s==null?void 0:s.area},{key:"perimeter",title:e.perimeter,value:s==null?void 0:s.perimeter}],messages:{...e,notApplicable:t.notApplicable},newMeasurementButtonClass:q.newMeasurementButton,state:c,supported:h,unit:r,unitOptions:u,onNewMeasurementClick:()=>{ye(l.start())},onUnitChange:d=>{this.unit=d}}):null)}};a([o({readOnly:!0})],p.prototype,"active",null),a([o()],p.prototype,"iconClass",void 0),a([o()],p.prototype,"icon",void 0),a([o()],p.prototype,"label",null),a([o(),T("esri/widgets/AreaMeasurement2D/t9n/AreaMeasurement2D")],p.prototype,"messages",void 0),a([o(),T("esri/core/t9n/Units")],p.prototype,"messagesUnits",void 0),a([o(),T("esri/t9n/common")],p.prototype,"messagesCommon",void 0),a([o()],p.prototype,"uiStrings",void 0),a([o()],p.prototype,"unit",null),a([o()],p.prototype,"unitOptions",null),a([o()],p.prototype,"view",null),a([o({type:P})],p.prototype,"viewModel",void 0),a([o({type:Boolean})],p.prototype,"visible",null),p=a([U("esri.widgets.AreaMeasurement2D")],p);const Fe=p;export{Fe as default}; diff --git a/dist/assets/AreaMeasurement3D-GOBHGg9B.js b/dist/assets/AreaMeasurement3D-ZnoqUVHu.js similarity index 79% rename from dist/assets/AreaMeasurement3D-GOBHGg9B.js rename to dist/assets/AreaMeasurement3D-ZnoqUVHu.js index 550d77a..426e8ec 100644 --- a/dist/assets/AreaMeasurement3D-GOBHGg9B.js +++ b/dist/assets/AreaMeasurement3D-ZnoqUVHu.js @@ -1 +1 @@ -import{e as a,y as n,l as J,kL as M,c as f,l2 as X,Z as Y,fo as Z,aa as x,aX as Q,aY as tt,i3 as $,n as w,aJ as et,nk as A,kn as it,d as _,C as st,oc as at,ab as k,kz as nt,k as ot,gD as rt,an as v,T as C,A as P,nn as lt,ao as S,kS as L,kK as pt,kM as b,hl as ht,hn as H,kN as U,kO as ut}from"./index-J0iiHjMT.js";import{W as T}from"./measurementUtils-St7B-HxA.js";import{O as dt}from"./SnappingVisualizer3D-KWlqByBu.js";import{F as gt,A as ct}from"./dragEventPipeline3D-4CqrlxD2.js";import{w as E,e as I,$ as R}from"./ShadedColorMaterial.glsl-Fp4o6LjC.js";import{c as mt}from"./Laserlines.glsl-nvjcCsAw.js";import{i as G,d as _t}from"./InteractiveToolBase-WDic4GPF.js";import{a as yt}from"./AnalysisToolBase-3A13PdgS.js";import{V as wt,p as vt,w as Mt}from"./EditGeometryOperations-TPE5Wzab.js";import{a as ft}from"./SceneSnappingManagerPool-OpebO9Di.js";import{e as Vt}from"./SnappingContext-6K6JmvvY.js";import{f as bt}from"./SnappingDragPipelineStep-THHIXt-p.js";import{p as Dt}from"./SnappingOperation-2U48wt1k.js";import{u as Pt}from"./InteractiveAnalysisViewModel-RI-qFGDH.js";import{u as St}from"./MeasurementWidgetContent-d8uX7Gw_.js";import"./ExtendedLineVisualElement-YbjiXiBG.js";import"./vec4f32-NvfHy9q7.js";import"./EngineVisualElement-eZNKTKsI.js";import"./VisualElement-kjYXz27t.js";import"./PointVisualElement-bX-_4FqS.js";import"./Object3DVisualElement-TMb7y_wl.js";import"./RightAngleQuadVisualElement-y_W8r903.js";import"./drawUtils-woTYaREB.js";import"./PointSnappingHint-ULetRXiW.js";import"./dehydratedFeatureComparison-hdPq-zad.js";let m=class extends X{constructor(e){super(e),this.type="area-measurement",this.unit=null}set geometry(e){e!=null?(e.rings.length>1&&Y.getLogger(this).warn("Measuring polygons with multiple rings is not supported."),this._set("geometry",e.clone())):this._set("geometry",null)}get requiredPropertiesForEditing(){if(this.geometry!=null&&this.geometry.rings.length===1){const e=this.geometry.rings[0];if(e.length<=2||!Z(e[0],e[e.length-1]))return[null]}return[this.geometry]}clear(){this.geometry=null}};a([n({type:["area-measurement"]})],m.prototype,"type",void 0),a([n({value:null,type:J})],m.prototype,"geometry",null),a([n({type:M,value:null})],m.prototype,"unit",void 0),a([n({readOnly:!0})],m.prototype,"requiredPropertiesForEditing",null),m=a([f("esri.analysis.AreaMeasurementAnalysis")],m);const N=m;class Ot{constructor(e,i=null){this.screenPoint=e,this.result=i}}class xt{constructor(e,i){this.scenePoint=e,this.mapPoint=i}}class $t{constructor(e){this.vertexManipulators=[],this._destroyed=!1,this._isManipulatorsOwner=!0,this._visible=!0,this._listenerHandles=null,this._tempHandlePosition=x();const{analysisViewData:i,manipulators:s,toolState:r,view:o,visible:l}=e;this._analysisViewData=i,this._toolState=r,s!=null?(this._manipulators=s,this._isManipulatorsOwner=!1):this._manipulators=new G,this._view=o,this._intersector=Q(o.state.viewingMode),this._intersector.options.store=tt.MIN;const p=E(this._handleColor),d=[new I($(p,1,32,32))],c=new R({view:o,renderObjects:d});c.available=!1,c.radius=z,c.interactive=!1,this._manipulators.add(c),this._cursorManipulator=c,this._cursorManipulatorMaterial=p,this._laserLine=new mt({view:o,attached:!0,style:{glowWidth:kt,glowFalloff:Ct,innerWidth:Lt},isDecoration:!0}),this._updateVisibility(l??!0)}destroy(){this._listenerHandles=w(this._listenerHandles),this._isManipulatorsOwner?this._manipulators=w(this._manipulators):this._manipulators=null,this._laserLine=w(this._laserLine),this._destroyed=!0}get destroyed(){return this._destroyed}get visible(){return this._visible}set visible(e){e?this.show():this.hide()}get testData(){const e=this._laserLine.testData;return{laserLineRenderer:e!=null?{heightManifoldEnabled:e.heightManifoldEnabled,heightManifoldTarget:e.heightManifoldTarget,pointDistanceEnabled:e.pointDistanceEnabled,pointDistanceOrigin:e.pointDistanceOrigin,pointDistanceTarget:e.pointDistanceTarget,lineVerticalPlaneEnabled:e.lineVerticalPlaneEnabled}:{heightManifoldEnabled:!1,heightManifoldTarget:null,pointDistanceEnabled:!1,pointDistanceOrigin:null,pointDistanceTarget:null,lineVerticalPlaneEnabled:!1}}}show(){this._setVisibility(!0)}hide(){this._setVisibility(!1)}_setVisibility(e){this._destroyed||this._visible===e||this._updateVisibility(e)}_updateVisibility(e){this._visible=e,this._laserLine.visible=e,e?(this._initializeListeners(),this._updateAll()):(this._destroyListeners(),this.vertexManipulators.forEach(({manipulator:i})=>this._removeVertexManipulator(i)),this.vertexManipulators=[],this._view.cursor=null)}vertexHandleAt(e,i){const s=this._manipulators.intersect(e,i);return s==null?void 0:s.metadata}pick(e){const i=this._view.spatialReference,s=et(e.screenPoint);this._view.sceneIntersectionHelper.intersectToolIntersectorScreen(s,this._intersector);const r=this._intersector.results.min,o=x();if(!r.getIntersectionPoint(o))return null;const l=this._view.renderCoordsHelper.fromRenderCoords(o,i);return l==null?null:new xt(o,l)}_updateAll(){this._visible&&(this._updateVertexManipulators(),this._updateLaserLine())}_createVertexManipulator(){const e=E(this._handleColor),i=[new I($(e,1,32,32))],s=new R({view:this._view,renderObjects:i});return s.radius=z,this._manipulators.add(s),{manipulator:s,material:e}}_removeVertexManipulator(e){this._manipulators.remove(e)}_updateVertexManipulators(){const{viewData:e}=this._analysisViewData,i=this._analysisViewData.path?this._analysisViewData.path.vertices:[],s=this.vertexManipulators;At(s,i.length,()=>this._createVertexManipulator(),({manipulator:r})=>this._removeVertexManipulator(r)),s.forEach(({manipulator:r},o)=>{r.metadata=i[o],r.renderLocation=e.positionsRenderCoords[o],r.cursor=o===0&&this._toolState.polygonState==="drawing"?"crosshair":null}),this._toolState.polygonState==="drawing"&&this._analysisViewData.stagedPoint!=null?(this._cursorManipulator.available=!0,this._cursorManipulator.location=this._analysisViewData.stagedPoint):this._cursorManipulator.available=!1}get _handleColor(){return A(this._view.effectiveTheme.accentColor,.5)}_getFocusPoint(){const{lastDraggedVertex:e}=this._analysisViewData;switch(this._toolState.polygonState){case"drawing":return this._analysisViewData.stagedPoint!=null?this._analysisViewData.stagedPoint:e!=null?this._analysisViewData.path.getVertexPositionAsPoint(e):this._analysisViewData.path.lastPoint;case"editing":return e!=null?this._analysisViewData.path.getVertexPositionAsPoint(e):null;default:return this._analysisViewData.stagedPoint}}_updateLaserLine(){const e=this._toolState.polygonState!=="measured"&&this._toolState.active,i=this._getFocusPoint();if(e&&i!=null){const s=this._tempHandlePosition;this._view.renderCoordsHelper.toRenderCoords(i,s),this._laserLine.heightManifoldTarget=s}else this._laserLine.heightManifoldTarget=null}_initializeListeners(){this._listenerHandles=new it,this._listenerHandles.add([_(()=>this._toolState.polygonState,()=>this._updateLaserLine()),_(()=>this._analysisViewData.viewData,()=>this._updateAll(),st),_(()=>({lastDraggedVertex:this._analysisViewData.lastDraggedVertex,cursorPoint:this._analysisViewData.stagedPoint}),()=>this._updateLaserLine()),_(()=>this._toolState.active,()=>this._updateAll()),_(()=>this._view.effectiveTheme.accentColor,e=>{const i=A(e,.5);for(const{material:d}of this.vertexManipulators)d.setParameters({color:i});this._cursorManipulatorMaterial.setParameters({color:i});const s=k.toUnitRGB(e),r=k.toUnitRGB(nt(e)),o=.75*e.a,l=this._laserLine,p=l.style;l.style={...p,glowColor:s,innerColor:r,globalAlpha:o}},{initial:!0,equals:at})])}_destroyListeners(){this._listenerHandles=w(this._listenerHandles)}}function At(t,e,i,s){for(;t.lengthe;)s(t.pop());else t.length=e}const kt=8,Ct=8,Lt=1,z=5;let u=class extends yt{constructor(t){super(t),this._updatingHandles=new ot,this.polygonState="initial",this.manipulators=new G,this._getSnappingContext=rt(e=>new Vt({elevationInfo:{mode:"absolute-height",offset:0},pointer:e,editGeometryOperations:new wt(new vt("point",Mt(!0,!1,this.view.spatialReference))),visualizer:new dt}))}initialize(){const{view:t,analysisViewData:e,manipulators:i,visible:s}=this;this.measurementView=new $t({view:t,analysisViewData:e,toolState:this,manipulators:i,visible:s});const r=ft(t);this._snappingManagerResult=r,this.addHandles(r),this._snappingOperation=new Dt({view:t}),this._updatingHandles.add(()=>this.stagedPoint,o=>{this.analysisViewData.stagedPoint=o!=null?v(o,new C):null},P),lt(this,()=>{const o=this.view.inputManager.latestPointerType??"mouse",l=this._getSnappingContext(o);this._updatingHandles.addPromise(S(this._snappingOperation.resnap(this._snappingManager,l)))}),this._setupManipulators(),this.addHandles([_(()=>this.state,o=>{o==="measured"&&this.finishToolCreation()},P),this.analysisViewData.path.on("change",()=>{const o=this.analysisViewData.path;this.polygonState!=="initial"||o.isEmptyPolygon||(o.isValidPolygon?this.polygonState="measured":this.polygonState="drawing")})])}destroy(){this.measurementView.destroy(),this._set("measurementView",null),this._updatingHandles=w(this._updatingHandles)}get _snappingManager(){return this._snappingManagerResult.snappingManager}get state(){return this.analysisViewData.path.numVertices===0?"ready":this.analysisViewData.path.isValidPolygon&&this.polygonState!=="editing"?"measured":"measuring"}get cursor(){return this.state==="ready"||this.polygonState==="drawing"?"crosshair":null}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get stagedPoint(){return this._snappingOperation.stagedPoint}set stagedPoint(t){this._snappingOperation.stagedPoint=t}get snappingOptions(){return this._snappingManager.options}finishMeasurement(){const{path:t}=this.analysisViewData;t.numVertices<3?(t.clear(),this.polygonState="initial"):(t.close(),this.polygonState="measured"),this._resetSnappingState()}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._resetSnappingState()}onInputEvent(t){switch(t.type){case"immediate-double-click":this._handleImmediateDoubleClick(t);break;case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t);break;case"drag":this._handleDrag(t);break;case"key-down":this._handleKeyDown(t)}}_setupManipulators(){const t=i=>i.events.on("grab-changed",()=>{if(this.analysisViewData.path.isValidPolygon){const s=this.manipulators.some(r=>r.manipulator.grabbing);this.polygonState=s?"editing":"measured"}}),e=i=>{this.addHandles([_t(i,(s,r,o,l)=>{const p=ct(s),d=s.metadata,c=this._snappingManager,V=this._getSnappingContext(l),q=this._updatingHandles,{snappingStep:K,cancelSnapping:W}=bt({snappingManager:c,snappingContext:V,updatingHandles:q});o=o.next(p).next(y=>(this.analysisViewData.lastDraggedVertex=null,this.analysisViewData.path.setVertexPosition(d,O),s.location=O,y)).next(W),r.next(p).next(gt(this.view)).next(...K).next(y=>{s.location=y.mapEnd,this.analysisViewData.lastDraggedVertex=y.action==="end"?null:d,this.analysisViewData.path.setVertexPosition(d,v(y.mapEnd))});const O=v(this.analysisViewData.path.getVertexPositionAsPoint(d))}),t(i)],i)};this.manipulators.forEach(({manipulator:i})=>{e(i)}),this.addHandles([this.manipulators.on("after-add",({item:{manipulator:i}})=>{e(i)}),this.manipulators.on("after-remove",({item:{manipulator:i}})=>this.removeHandles(i))])}_handleImmediateDoubleClick(t){T(t)&&(this.polygonState==="drawing"&&this.finishMeasurement(),t.stopPropagation())}_handleDrag(t){this.polygonState==="editing"&&t.stopPropagation()}_handleImmediateClick(t){if(!T(t))return;const e=L(t),{pointerType:i}=t;if(this.active)switch(this.polygonState){case"initial":if(this._addVertexAt(e,i))return this.stagedPoint=null,this.polygonState="drawing",void t.stopPropagation();break;case"drawing":{const s=this.measurementView.vertexHandleAt(e,i);if(s==null){if(this._addVertexAt(e,i))return this.stagedPoint=null,void t.stopPropagation()}else s.index===0&&(this.finishMeasurement(),t.stopPropagation());break}}t.pointerType==="mouse"&&this._hoverAt(e)}_handlePointerMove(t){if(t.pointerType==="mouse"){const e=L(t);this._hoverAt(e)}}_handleKeyDown(t){const{path:e}=this.analysisViewData;t.key==="Enter"&&this.polygonState==="drawing"&&e.numVertices>=3&&(this.stagedPoint=null,this.finishMeasurement(),t.stopPropagation())}_hoverAt(t){const{polygonState:e}=this;if(this.active&&(e==="initial"||e==="drawing")){const i=this._pick(t);if((i==null?void 0:i.mapPoint)!=null){const s=this._getSnappingContext("mouse");this._updatingHandles.addPromise(S(this._snappingOperation.snap({point:i.mapPoint},this._snappingManager,s)))}}else this.stagedPoint=null}_addVertexAt(t,e){const i=this._pick(t);if((i==null?void 0:i.mapPoint)!=null){const{mapPoint:s}=i,r=this._getSnappingContext(e),o=this._snappingOperation.update({point:s},this._snappingManager,r),l=v(o,new C);return this.analysisViewData.path.add(l),!0}return!1}_pick(t){const e=new Ot(t);return this.measurementView.pick(e)}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}get test(){return{snappingManager:this._snappingManager}}};a([n({readOnly:!0})],u.prototype,"state",null),a([n()],u.prototype,"polygonState",void 0),a([n({readOnly:!0})],u.prototype,"cursor",null),a([n()],u.prototype,"measurementView",void 0),a([n({constructOnly:!0})],u.prototype,"view",void 0),a([n({constructOnly:!0})],u.prototype,"analysis",void 0),a([n({constructOnly:!0})],u.prototype,"analysisViewData",void 0),a([n({readOnly:!0})],u.prototype,"manipulators",void 0),a([n()],u.prototype,"updating",null),a([n()],u.prototype,"stagedPoint",null),a([n()],u.prototype,"snappingOptions",null),u=a([f("esri.views.3d.interactive.measurementTools.areaMeasurement3D.AreaMeasurement3DTool")],u);const Ht=u;let g=class extends Pt{constructor(t){super(t),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="AreaMeasurement3DViewModel is only supported in 3D views.",this._userUnitOptions=null,this._userUnit=null}initialize(){this.addHandles(_(()=>({analysis:this.analysis,unit:this.unit}),({analysis:t,unit:e})=>{t!=null&&(t.unit=e)},P))}get state(){return this.disabled||!this.ready?"disabled":this.tool==null?"ready":this.tool.state}get measurement(){if(this.tool==null||this.disabled||this.tool.destroyed)return null;const{analysisView:t}=this;if(t==null)return null;const e=t.analysisVisualization,i=e.viewData,s=i.measurementData,r=s.validMeasurement,o=i.mode==="euclidean",l=(o?s.intersectingSegments:s.geodesicIntersectingSegments).size===0,p=l?r?"available":"unavailable":"invalid";return{mode:o?"euclidean":"geodesic",area:{text:l&&r?e.areaLabel:null,state:p},perimeterLength:{text:l&&r?e.perimeterLengthLabel:null,state:p}}}set unitOptions(t){this._userUnitOptions=t,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(t){this._userUnit=t?this._findSelectableUnit(t,this._userUnit):null}get unit(){return this._userUnit!=null?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}constructAnalysis(){return new N}constructTool(){return new Ht({view:this.view,analysis:this.analysis,analysisViewData:this.analysisView,visible:this.visible})}_findSelectableUnit(t,e){const{unitOptions:i}=this;return i.includes(t)?t:e!=null?this._findSelectableUnit(e):i[0]}_filteredOrAllUnits(t){if(t==null)return M.slice();const e=t.filter(i=>M.includes(i));return e.length===0?M.slice():e}};a([n({type:N})],g.prototype,"analysis",void 0),a([n({readOnly:!0})],g.prototype,"state",null),a([n({readOnly:!0})],g.prototype,"measurement",null),a([n()],g.prototype,"unitOptions",null),a([n()],g.prototype,"unit",null),a([n(pt)],g.prototype,"defaultUnit",void 0),a([n()],g.prototype,"_userUnit",void 0),g=a([f("esri.widgets.AreaMeasurement3D.AreaMeasurement3DViewModel")],g);const j=g,F="esri-area-measurement-3d",D={base:F,newMeasurementButton:`${F}__clear-button`,widgetIcon:ut.measureArea};let h=class extends ht{constructor(t,e){super(t,e),this.iconClass=D.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.viewModel=new j}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(t){this.viewModel.analysis=t}get label(){var t;return((t=this.messages)==null?void 0:t.widgetLabel)??""}set label(t){this._overrideIfSome("label",t)}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(t){this.viewModel.unitOptions=t}get unit(){return this.viewModel.unit}set unit(t){this.viewModel.unit=t}render(){const{messages:t,messagesCommon:e,messagesUnits:i,unit:s,unitOptions:r,viewModel:o}=this,{active:l,measurement:p,state:d,supported:c}=o;return H("div",{"aria-label":this.messages.widgetLabel,class:this.classes(D.base,U.widget,U.panel),key:this,role:"presentation"},this.visible?H(St,{active:l,measurementItems:[{key:"direct",title:i.measures.area,value:B(p==null?void 0:p.area)},{key:"perimeter",title:t.perimeterLength,value:B(p==null?void 0:p.perimeterLength)}],messages:{...t,notApplicable:e.notApplicable},newMeasurementButtonClass:D.newMeasurementButton,state:d,supported:c,unit:s,unitOptions:r,onNewMeasurementClick:()=>{S(this.viewModel.start())},onUnitChange:V=>{this.unit=V}}):null)}};function B(t){return(t==null?void 0:t.state)==="available"?t.text:null}a([n()],h.prototype,"view",null),a([n()],h.prototype,"visible",null),a([n()],h.prototype,"active",null),a([n({constructOnly:!0,nonNullable:!0})],h.prototype,"analysis",null),a([n()],h.prototype,"iconClass",void 0),a([n()],h.prototype,"icon",void 0),a([n()],h.prototype,"label",null),a([n(),b("esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D")],h.prototype,"messages",void 0),a([n(),b("esri/t9n/common")],h.prototype,"messagesCommon",void 0),a([n(),b("esri/core/t9n/Units")],h.prototype,"messagesUnits",void 0),a([n()],h.prototype,"uiStrings",void 0),a([n({type:j})],h.prototype,"viewModel",void 0),a([n()],h.prototype,"unitOptions",null),a([n()],h.prototype,"unit",null),h=a([f("esri.widgets.AreaMeasurement3D")],h);const re=h;export{re as default}; +import{e as a,y as n,j as Y,kW as M,c as b,la as Z,R as X,fj as J,a8 as x,cb as Q,cc as tt,hZ as $,b as w,bY as et,nF as A,kv as it,B as _,a9 as st,oo as at,W as L,kL as nt,h as ot,gA as rt,bp as v,L as C,T as P,nB as lt,br as S,kH as k,kV as pt,kX as V,hD as ht,hF as H,kY as U,kZ as ut}from"./index-pCX-0tJH.js";import{W as T}from"./measurementUtils-U47xEmCr.js";import{O as dt}from"./SnappingVisualizer3D-PUGfSdbO.js";import{F as gt,A as ct}from"./dragEventPipeline3D-H_IlIVP7.js";import{w as E,e as I,$ as R}from"./ShadedColorMaterial.glsl-L0JVQzbX.js";import{c as mt}from"./Laserlines.glsl-U7nZFq0e.js";import{i as W,d as _t}from"./InteractiveToolBase-6mltmL27.js";import{a as yt}from"./AnalysisToolBase-olyQy6lh.js";import{V as wt,p as vt,w as Mt}from"./EditGeometryOperations-vpHcsZOg.js";import{a as bt}from"./SceneSnappingManagerPool-V-V1M2q0.js";import{e as ft}from"./SnappingContext-ax0tf6c6.js";import{f as Vt}from"./SnappingDragPipelineStep-HDAWWRgo.js";import{p as Dt}from"./SnappingOperation-hED0OM8D.js";import{u as Pt}from"./InteractiveAnalysisViewModel-jrNLjGZR.js";import{u as St}from"./MeasurementWidgetContent-PH9XFoV4.js";import"./ExtendedLineVisualElement-VJvEdv3K.js";import"./vec4f32-NvfHy9q7.js";import"./EngineVisualElement-u0-BOxGn.js";import"./VisualElement--2Scr6Yq.js";import"./PointVisualElement-m9C0-AJh.js";import"./Object3DVisualElement-8HoU366x.js";import"./RightAngleQuadVisualElement-Jj11oqLR.js";import"./drawUtils-0wb2c6-q.js";import"./PointSnappingHint-bwlQAyn6.js";import"./dehydratedFeatureComparison-IJSogXWn.js";let m=class extends Z{constructor(e){super(e),this.type="area-measurement",this.unit=null}set geometry(e){e!=null?(e.rings.length>1&&X.getLogger(this).warn("Measuring polygons with multiple rings is not supported."),this._set("geometry",e.clone())):this._set("geometry",null)}get requiredPropertiesForEditing(){if(this.geometry!=null&&this.geometry.rings.length===1){const e=this.geometry.rings[0];if(e.length<=2||!J(e[0],e[e.length-1]))return[null]}return[this.geometry]}clear(){this.geometry=null}};a([n({type:["area-measurement"]})],m.prototype,"type",void 0),a([n({value:null,type:Y})],m.prototype,"geometry",null),a([n({type:M,value:null})],m.prototype,"unit",void 0),a([n({readOnly:!0})],m.prototype,"requiredPropertiesForEditing",null),m=a([b("esri.analysis.AreaMeasurementAnalysis")],m);const j=m;class Ot{constructor(e,i=null){this.screenPoint=e,this.result=i}}class xt{constructor(e,i){this.scenePoint=e,this.mapPoint=i}}class $t{constructor(e){this.vertexManipulators=[],this._destroyed=!1,this._isManipulatorsOwner=!0,this._visible=!0,this._listenerHandles=null,this._tempHandlePosition=x();const{analysisViewData:i,manipulators:s,toolState:r,view:o,visible:l}=e;this._analysisViewData=i,this._toolState=r,s!=null?(this._manipulators=s,this._isManipulatorsOwner=!1):this._manipulators=new W,this._view=o,this._intersector=Q(o.state.viewingMode),this._intersector.options.store=tt.MIN;const p=E(this._handleColor),d=[new I($(p,1,32,32))],c=new R({view:o,renderObjects:d});c.available=!1,c.radius=F,c.interactive=!1,this._manipulators.add(c),this._cursorManipulator=c,this._cursorManipulatorMaterial=p,this._laserLine=new mt({view:o,attached:!0,style:{glowWidth:Lt,glowFalloff:Ct,innerWidth:kt},isDecoration:!0}),this._updateVisibility(l??!0)}destroy(){this._listenerHandles=w(this._listenerHandles),this._isManipulatorsOwner?this._manipulators=w(this._manipulators):this._manipulators=null,this._laserLine=w(this._laserLine),this._destroyed=!0}get destroyed(){return this._destroyed}get visible(){return this._visible}set visible(e){e?this.show():this.hide()}get testData(){const e=this._laserLine.testData;return{laserLineRenderer:e!=null?{heightManifoldEnabled:e.heightManifoldEnabled,heightManifoldTarget:e.heightManifoldTarget,pointDistanceEnabled:e.pointDistanceEnabled,pointDistanceOrigin:e.pointDistanceOrigin,pointDistanceTarget:e.pointDistanceTarget,lineVerticalPlaneEnabled:e.lineVerticalPlaneEnabled}:{heightManifoldEnabled:!1,heightManifoldTarget:null,pointDistanceEnabled:!1,pointDistanceOrigin:null,pointDistanceTarget:null,lineVerticalPlaneEnabled:!1}}}show(){this._setVisibility(!0)}hide(){this._setVisibility(!1)}_setVisibility(e){this._destroyed||this._visible===e||this._updateVisibility(e)}_updateVisibility(e){this._visible=e,this._laserLine.visible=e,e?(this._initializeListeners(),this._updateAll()):(this._destroyListeners(),this.vertexManipulators.forEach(({manipulator:i})=>this._removeVertexManipulator(i)),this.vertexManipulators=[],this._view.cursor=null)}vertexHandleAt(e,i){const s=this._manipulators.intersect(e,i);return s==null?void 0:s.metadata}pick(e){const i=this._view.spatialReference,s=et(e.screenPoint);this._view.sceneIntersectionHelper.intersectToolIntersectorScreen(s,this._intersector);const r=this._intersector.results.min,o=x();if(!r.getIntersectionPoint(o))return null;const l=this._view.renderCoordsHelper.fromRenderCoords(o,i);return l==null?null:new xt(o,l)}_updateAll(){this._visible&&(this._updateVertexManipulators(),this._updateLaserLine())}_createVertexManipulator(){const e=E(this._handleColor),i=[new I($(e,1,32,32))],s=new R({view:this._view,renderObjects:i});return s.radius=F,this._manipulators.add(s),{manipulator:s,material:e}}_removeVertexManipulator(e){this._manipulators.remove(e)}_updateVertexManipulators(){const{viewData:e}=this._analysisViewData,i=this._analysisViewData.path?this._analysisViewData.path.vertices:[],s=this.vertexManipulators;At(s,i.length,()=>this._createVertexManipulator(),({manipulator:r})=>this._removeVertexManipulator(r)),s.forEach(({manipulator:r},o)=>{r.metadata=i[o],r.renderLocation=e.positionsRenderCoords[o],r.cursor=o===0&&this._toolState.polygonState==="drawing"?"crosshair":null}),this._toolState.polygonState==="drawing"&&this._analysisViewData.stagedPoint!=null?(this._cursorManipulator.available=!0,this._cursorManipulator.location=this._analysisViewData.stagedPoint):this._cursorManipulator.available=!1}get _handleColor(){return A(this._view.effectiveTheme.accentColor,.5)}_getFocusPoint(){const{lastDraggedVertex:e}=this._analysisViewData;switch(this._toolState.polygonState){case"drawing":return this._analysisViewData.stagedPoint!=null?this._analysisViewData.stagedPoint:e!=null?this._analysisViewData.path.getVertexPositionAsPoint(e):this._analysisViewData.path.lastPoint;case"editing":return e!=null?this._analysisViewData.path.getVertexPositionAsPoint(e):null;default:return this._analysisViewData.stagedPoint}}_updateLaserLine(){const e=this._toolState.polygonState!=="measured"&&this._toolState.active,i=this._getFocusPoint();if(e&&i!=null){const s=this._tempHandlePosition;this._view.renderCoordsHelper.toRenderCoords(i,s),this._laserLine.heightManifoldTarget=s}else this._laserLine.heightManifoldTarget=null}_initializeListeners(){this._listenerHandles=new it,this._listenerHandles.add([_(()=>this._toolState.polygonState,()=>this._updateLaserLine()),_(()=>this._analysisViewData.viewData,()=>this._updateAll(),st),_(()=>({lastDraggedVertex:this._analysisViewData.lastDraggedVertex,cursorPoint:this._analysisViewData.stagedPoint}),()=>this._updateLaserLine()),_(()=>this._toolState.active,()=>this._updateAll()),_(()=>this._view.effectiveTheme.accentColor,e=>{const i=A(e,.5);for(const{material:d}of this.vertexManipulators)d.setParameters({color:i});this._cursorManipulatorMaterial.setParameters({color:i});const s=L.toUnitRGB(e),r=L.toUnitRGB(nt(e)),o=.75*e.a,l=this._laserLine,p=l.style;l.style={...p,glowColor:s,innerColor:r,globalAlpha:o}},{initial:!0,equals:at})])}_destroyListeners(){this._listenerHandles=w(this._listenerHandles)}}function At(t,e,i,s){for(;t.lengthe;)s(t.pop());else t.length=e}const Lt=8,Ct=8,kt=1,F=5;let u=class extends yt{constructor(t){super(t),this._updatingHandles=new ot,this.polygonState="initial",this.manipulators=new W,this._getSnappingContext=rt(e=>new ft({elevationInfo:{mode:"absolute-height",offset:0},pointer:e,editGeometryOperations:new wt(new vt("point",Mt(!0,!1,this.view.spatialReference))),visualizer:new dt}))}initialize(){const{view:t,analysisViewData:e,manipulators:i,visible:s}=this;this.measurementView=new $t({view:t,analysisViewData:e,toolState:this,manipulators:i,visible:s});const r=bt(t);this._snappingManagerResult=r,this.addHandles(r),this._snappingOperation=new Dt({view:t}),this._updatingHandles.add(()=>this.stagedPoint,o=>{this.analysisViewData.stagedPoint=o!=null?v(o,new C):null},P),lt(this,()=>{const o=this.view.inputManager.latestPointerType??"mouse",l=this._getSnappingContext(o);this._updatingHandles.addPromise(S(this._snappingOperation.resnap(this._snappingManager,l)))}),this._setupManipulators(),this.addHandles([_(()=>this.state,o=>{o==="measured"&&this.finishToolCreation()},P),this.analysisViewData.path.on("change",()=>{const o=this.analysisViewData.path;this.polygonState!=="initial"||o.isEmptyPolygon||(o.isValidPolygon?this.polygonState="measured":this.polygonState="drawing")})])}destroy(){this.measurementView.destroy(),this._set("measurementView",null),this._updatingHandles=w(this._updatingHandles)}get _snappingManager(){return this._snappingManagerResult.snappingManager}get state(){return this.analysisViewData.path.numVertices===0?"ready":this.analysisViewData.path.isValidPolygon&&this.polygonState!=="editing"?"measured":"measuring"}get cursor(){return this.state==="ready"||this.polygonState==="drawing"?"crosshair":null}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get stagedPoint(){return this._snappingOperation.stagedPoint}set stagedPoint(t){this._snappingOperation.stagedPoint=t}get snappingOptions(){return this._snappingManager.options}finishMeasurement(){const{path:t}=this.analysisViewData;t.numVertices<3?(t.clear(),this.polygonState="initial"):(t.close(),this.polygonState="measured"),this._resetSnappingState()}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._resetSnappingState()}onInputEvent(t){switch(t.type){case"immediate-double-click":this._handleImmediateDoubleClick(t);break;case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t);break;case"drag":this._handleDrag(t);break;case"key-down":this._handleKeyDown(t)}}_setupManipulators(){const t=i=>i.events.on("grab-changed",()=>{if(this.analysisViewData.path.isValidPolygon){const s=this.manipulators.some(r=>r.manipulator.grabbing);this.polygonState=s?"editing":"measured"}}),e=i=>{this.addHandles([_t(i,(s,r,o,l)=>{const p=ct(s),d=s.metadata,c=this._snappingManager,f=this._getSnappingContext(l),q=this._updatingHandles,{snappingStep:N,cancelSnapping:K}=Vt({snappingManager:c,snappingContext:f,updatingHandles:q});o=o.next(p).next(y=>(this.analysisViewData.lastDraggedVertex=null,this.analysisViewData.path.setVertexPosition(d,O),s.location=O,y)).next(K),r.next(p).next(gt(this.view)).next(...N).next(y=>{s.location=y.mapEnd,this.analysisViewData.lastDraggedVertex=y.action==="end"?null:d,this.analysisViewData.path.setVertexPosition(d,v(y.mapEnd))});const O=v(this.analysisViewData.path.getVertexPositionAsPoint(d))}),t(i)],i)};this.manipulators.forEach(({manipulator:i})=>{e(i)}),this.addHandles([this.manipulators.on("after-add",({item:{manipulator:i}})=>{e(i)}),this.manipulators.on("after-remove",({item:{manipulator:i}})=>this.removeHandles(i))])}_handleImmediateDoubleClick(t){T(t)&&(this.polygonState==="drawing"&&this.finishMeasurement(),t.stopPropagation())}_handleDrag(t){this.polygonState==="editing"&&t.stopPropagation()}_handleImmediateClick(t){if(!T(t))return;const e=k(t),{pointerType:i}=t;if(this.active)switch(this.polygonState){case"initial":if(this._addVertexAt(e,i))return this.stagedPoint=null,this.polygonState="drawing",void t.stopPropagation();break;case"drawing":{const s=this.measurementView.vertexHandleAt(e,i);if(s==null){if(this._addVertexAt(e,i))return this.stagedPoint=null,void t.stopPropagation()}else s.index===0&&(this.finishMeasurement(),t.stopPropagation());break}}t.pointerType==="mouse"&&this._hoverAt(e)}_handlePointerMove(t){if(t.pointerType==="mouse"){const e=k(t);this._hoverAt(e)}}_handleKeyDown(t){const{path:e}=this.analysisViewData;t.key==="Enter"&&this.polygonState==="drawing"&&e.numVertices>=3&&(this.stagedPoint=null,this.finishMeasurement(),t.stopPropagation())}_hoverAt(t){const{polygonState:e}=this;if(this.active&&(e==="initial"||e==="drawing")){const i=this._pick(t);if((i==null?void 0:i.mapPoint)!=null){const s=this._getSnappingContext("mouse");this._updatingHandles.addPromise(S(this._snappingOperation.snap({point:i.mapPoint},this._snappingManager,s)))}}else this.stagedPoint=null}_addVertexAt(t,e){const i=this._pick(t);if((i==null?void 0:i.mapPoint)!=null){const{mapPoint:s}=i,r=this._getSnappingContext(e),o=this._snappingOperation.update({point:s},this._snappingManager,r),l=v(o,new C);return this.analysisViewData.path.add(l),!0}return!1}_pick(t){const e=new Ot(t);return this.measurementView.pick(e)}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}get test(){return{snappingManager:this._snappingManager}}};a([n({readOnly:!0})],u.prototype,"state",null),a([n()],u.prototype,"polygonState",void 0),a([n({readOnly:!0})],u.prototype,"cursor",null),a([n()],u.prototype,"measurementView",void 0),a([n({constructOnly:!0})],u.prototype,"view",void 0),a([n({constructOnly:!0})],u.prototype,"analysis",void 0),a([n({constructOnly:!0})],u.prototype,"analysisViewData",void 0),a([n({readOnly:!0})],u.prototype,"manipulators",void 0),a([n()],u.prototype,"updating",null),a([n()],u.prototype,"stagedPoint",null),a([n()],u.prototype,"snappingOptions",null),u=a([b("esri.views.3d.interactive.measurementTools.areaMeasurement3D.AreaMeasurement3DTool")],u);const Ht=u;let g=class extends Pt{constructor(t){super(t),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="AreaMeasurement3DViewModel is only supported in 3D views.",this._userUnitOptions=null,this._userUnit=null}initialize(){this.addHandles(_(()=>({analysis:this.analysis,unit:this.unit}),({analysis:t,unit:e})=>{t!=null&&(t.unit=e)},P))}get state(){return this.disabled||!this.ready?"disabled":this.tool==null?"ready":this.tool.state}get measurement(){if(this.tool==null||this.disabled||this.tool.destroyed)return null;const{analysisView:t}=this;if(t==null)return null;const e=t.analysisVisualization,i=e.viewData,s=i.measurementData,r=s.validMeasurement,o=i.mode==="euclidean",l=(o?s.intersectingSegments:s.geodesicIntersectingSegments).size===0,p=l?r?"available":"unavailable":"invalid";return{mode:o?"euclidean":"geodesic",area:{text:l&&r?e.areaLabel:null,state:p},perimeterLength:{text:l&&r?e.perimeterLengthLabel:null,state:p}}}set unitOptions(t){this._userUnitOptions=t,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(t){this._userUnit=t?this._findSelectableUnit(t,this._userUnit):null}get unit(){return this._userUnit!=null?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}constructAnalysis(){return new j}constructTool(){return new Ht({view:this.view,analysis:this.analysis,analysisViewData:this.analysisView,visible:this.visible})}_findSelectableUnit(t,e){const{unitOptions:i}=this;return i.includes(t)?t:e!=null?this._findSelectableUnit(e):i[0]}_filteredOrAllUnits(t){if(t==null)return M.slice();const e=t.filter(i=>M.includes(i));return e.length===0?M.slice():e}};a([n({type:j})],g.prototype,"analysis",void 0),a([n({readOnly:!0})],g.prototype,"state",null),a([n({readOnly:!0})],g.prototype,"measurement",null),a([n()],g.prototype,"unitOptions",null),a([n()],g.prototype,"unit",null),a([n(pt)],g.prototype,"defaultUnit",void 0),a([n()],g.prototype,"_userUnit",void 0),g=a([b("esri.widgets.AreaMeasurement3D.AreaMeasurement3DViewModel")],g);const G=g,z="esri-area-measurement-3d",D={base:z,newMeasurementButton:`${z}__clear-button`,widgetIcon:ut.measureArea};let h=class extends ht{constructor(t,e){super(t,e),this.iconClass=D.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.viewModel=new G}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(t){this.viewModel.analysis=t}get label(){var t;return((t=this.messages)==null?void 0:t.widgetLabel)??""}set label(t){this._overrideIfSome("label",t)}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(t){this.viewModel.unitOptions=t}get unit(){return this.viewModel.unit}set unit(t){this.viewModel.unit=t}render(){const{messages:t,messagesCommon:e,messagesUnits:i,unit:s,unitOptions:r,viewModel:o}=this,{active:l,measurement:p,state:d,supported:c}=o;return H("div",{"aria-label":this.messages.widgetLabel,class:this.classes(D.base,U.widget,U.panel),key:this,role:"presentation"},this.visible?H(St,{active:l,measurementItems:[{key:"direct",title:i.measures.area,value:B(p==null?void 0:p.area)},{key:"perimeter",title:t.perimeterLength,value:B(p==null?void 0:p.perimeterLength)}],messages:{...t,notApplicable:e.notApplicable},newMeasurementButtonClass:D.newMeasurementButton,state:d,supported:c,unit:s,unitOptions:r,onNewMeasurementClick:()=>{S(this.viewModel.start())},onUnitChange:f=>{this.unit=f}}):null)}};function B(t){return(t==null?void 0:t.state)==="available"?t.text:null}a([n()],h.prototype,"view",null),a([n()],h.prototype,"visible",null),a([n()],h.prototype,"active",null),a([n({constructOnly:!0,nonNullable:!0})],h.prototype,"analysis",null),a([n()],h.prototype,"iconClass",void 0),a([n()],h.prototype,"icon",void 0),a([n()],h.prototype,"label",null),a([n(),V("esri/widgets/AreaMeasurement3D/t9n/AreaMeasurement3D")],h.prototype,"messages",void 0),a([n(),V("esri/t9n/common")],h.prototype,"messagesCommon",void 0),a([n(),V("esri/core/t9n/Units")],h.prototype,"messagesUnits",void 0),a([n()],h.prototype,"uiStrings",void 0),a([n({type:G})],h.prototype,"viewModel",void 0),a([n()],h.prototype,"unitOptions",null),a([n()],h.prototype,"unit",null),h=a([b("esri.widgets.AreaMeasurement3D")],h);const re=h;export{re as default}; diff --git a/dist/assets/AreaMeasurementAnalysisView3D-AasBQOV-.js b/dist/assets/AreaMeasurementAnalysisView3D-AasBQOV-.js deleted file mode 100644 index 1040f38..0000000 --- a/dist/assets/AreaMeasurementAnalysisView3D-AasBQOV-.js +++ /dev/null @@ -1,26 +0,0 @@ -import{aE as Me,at as Q,bn as q,aU as T,aF as Ve,aa as p,ou as Re,cs as J,ct as xe,y$ as Oe,cp as I,a9 as ne,az as Ie,nw as Ee,z0 as oe,aG as Te,bb as We,hL as ae,ax as D,au as Y,cT as le,z1 as Ue,mJ as je,rt as ke,kc as he,sY as de,cS as Fe,ar as qe,pl as He,ay as Z,aA as Ne,i5 as Be,e as a,y as d,c as K,p as ie,d as R,C as ce,cu as Ke,cv as Xe,Z as Ye,K as Ze,ek as ue,z2 as Qe,A as ee,i4 as Je,T as et,xz as tt,xE as st,bf as H,xy as pe,xH as it,yH as rt,xF as ge,xD as nt,xK as W,xM as ot,de as at,y7 as lt,uY as U,xO as ht,xP as dt,y6 as ct,xQ as ut,xS as pt,ym as gt,xU as mt,xV as _t,xW as yt,xL as V,xN as ft,y9 as vt,xA as me,lX as j,yb as Lt,yc as Ct,x_ as wt,x$ as St,oW as Ge,bi as N,b2 as x,rv as Pt,b4 as _e,b5 as ye,s_ as bt,by as At,bz as fe,kY as $t,nk as ve,kz as Le,kA as Mt,hS as Ce,bA as Vt,kZ as xt,kx as Gt,P as Dt,n as P,z3 as zt,hx as Rt,bw as Ot,cz as It,z4 as Et,z5 as Tt,z6 as Wt,z7 as Ut,kw as jt,kK as kt}from"./index-J0iiHjMT.js";import{s as Ft}from"./AnalysisView3D-jkk3JIRT.js";import{e as te}from"./interfaces-tkyofe_Z.js";import{T as qt,d as Ht,M as Nt,G as Bt,w as Kt,b as Xt,S as Yt,L as Zt}from"./measurementUtils-St7B-HxA.js";import{t as se,a as Qt}from"./UnitNormalizer-19C91v_m.js";import{U as we}from"./euclideanAreaMeasurementUtils-zmzttSyV.js";import{t as Jt,u as E}from"./LineVisualElement-4BP10o6v.js";import{V as Se,p as es,w as ts,l as ss}from"./EditGeometryOperations-TPE5Wzab.js";import{h as Pe}from"./quantityFormatUtils-NiAiojad.js";import{g as be,_ as is,m as rs}from"./Segment-hN2uWAPW.js";import{a as ns}from"./Object3DVisualElement-TMb7y_wl.js";import"./measurementUtils-84-ZBArh.js";import"./VisualElement-kjYXz27t.js";import"./TextOverlayItem-eCjvS6IO.js";function Ae(t,e,s,i,r){Me(k,t),Q(F,t,e),q(k,s,k,r),q(F,s,F,r),T(i,F,k),Ve(i,i)}const k=p(),F=p();class os{get numVertices(){return this._length}get hasStagedVertex(){return this._hasCursorPoint}constructor(e,s){this.validMeasurement=!1,this.positionsWorldCoords=[],this.positionsRenderCoords=[],this.positionsProjectedWorldCoords=[],this.positionsFittedRenderCoords=[],this.positionsGeographic=[],this.positionsSpherical=[],this.positionsStereographic=[],this.pathSegmentLengths=[],this.geodesicPathSegmentLengths=[],this.perimeterSegmentLengths=[],this.intersectingSegments=new Set,this.geodesicIntersectingSegments=new Set,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.areaCentroidWorldCoords=p(),this.areaCentroidRenderCoords=p(),this.geodesicAreaCentroidRenderCoords=p(),this.area=null,this.geodesicArea=null,this.pathLength=null,this.geodesicPathLength=null,this.perimeterLength=null,this._length=0,this._centroidRenderCoords=p(),this._planeWorldCoords=Re(),this._worldUp=p(),this._worldTangent=p(),this._frame=[p(),p(),p()],this._pathVersion=-1,this._hasCursorPoint=!1,this._mode=null,this._tempU=p(),this._tempV=p(),this._tempVec3=p(),this._tempSphere={center:p(),radius:0},this._sceneView=e,this.unitNormalizer=s}update(e,s,i,r,n,o){const l=s!=null,h=this._pathVersion===e.version,u=this._hasCursorPoint===l,c=this._mode===n;return!(h&&!o&&u&&c&&e.isValidPolygon)&&(this._pathVersion=e.version,this._hasCursorPoint=l,this._updateCursorSegmentLength(e,s),this._update(e,s,i,r,n),!0)}_update(e,s,i,r,n){const o=this.unitNormalizer,l=this._sceneView.renderSpatialReference,h=this.unitNormalizer.spatialReference;let u=e.numVertices;const c=!(s==null||s.equals(e.lastPoint)||u>2&&s.equals(e.firstPoint));c&&(u+=1);const g=!e.polygonIsClosed&&u>2,m=e.polygonIsClosed||g;this._resize(u);const y=J(i.spatialReference),b=xe(i.spatialReference,y)&&Oe(i.spatialReference),{positionsGeographic:C,positionsWorldCoords:$,positionsRenderCoords:A,positionsSpherical:G}=this,O=(f,v)=>{as(i.elevationProvider,f),Z(f,$[v],h),Z(f,A[v],l),b&&(Ne(f,C[v]),Z(f,G[v],y),Ve(G[v],G[v]))};e.forEachVertexPosition((f,v)=>O(f,v)),c&&O(s,u-1);const S=this._updatePathLengths(m);if(this.pathLength=this._length>1?I(o.normalizeDistance(S),"meters"):null,b){const f=this._updateGeodesicPathLengths(m,h);this.geodesicPathLength=this._length>1?I(f,"meters"):null}else this.geodesicPathLength=null;if(this._updateMode(n),!m)return this.area=null,this.geodesicArea=null,this.perimeterLength=null,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.intersectingSegments.clear(),this.geodesicIntersectingSegments.clear(),void(this.validMeasurement=!1);this._updateAreaAndPerimeterLength(i,o,l,h,r),b&&this._updateGeodesicArea(i),this.validMeasurement=!0}getData(){return{validMeasurement:this.validMeasurement,numVertices:this.numVertices,hasStagedVertex:this.hasStagedVertex,positionsWorldCoords:this.positionsWorldCoords,positionsRenderCoords:this.positionsRenderCoords,positionsProjectedWorldCoords:this.positionsProjectedWorldCoords,positionsFittedRenderCoords:this.positionsFittedRenderCoords,positionsGeographic:this.positionsGeographic,positionsSpherical:this.positionsSpherical,positionsStereographic:this.positionsStereographic,pathSegmentLengths:this.pathSegmentLengths,geodesicPathSegmentLengths:this.geodesicPathSegmentLengths,perimeterSegmentLengths:this.perimeterSegmentLengths,intersectingSegments:this.intersectingSegments,geodesicIntersectingSegments:this.geodesicIntersectingSegments,triangleIndices:this.triangleIndices,geodesicTriangleIndices:this.geodesicTriangleIndices,areaCentroidWorldCoords:this.areaCentroidWorldCoords,areaCentroidRenderCoords:this.areaCentroidRenderCoords,geodesicAreaCentroidRenderCoords:this.geodesicAreaCentroidRenderCoords,fittingMode:this.fittingMode,area:this.area,geodesicArea:this.geodesicArea,pathLength:this.pathLength,geodesicPathLength:this.geodesicPathLength,perimeterLength:this.perimeterLength,unitNormalizer:this.unitNormalizer,actualMeasurementMode:this.actualMeasurementMode}}_resize(e){for(e2&&Ht(l,g),this.fittingMode=this._selectFittingMode(g,l,this._worldUp,n);let y=0;if(this.fittingMode==="horizontal"){let S=-1/0;h.forEach((f,v)=>{const re=o.getAltitude(h[v]);re>S&&(S=re,y=v)})}const b=l[y];let C=g,$=this._worldTangent;this.fittingMode==="horizontal"?C=this._worldUp:this.fittingMode==="vertical"&&(C=this._tempVec3,$=this._worldUp,oe(g,this._worldUp,C)),Me(this._frame[2],C),oe($,C,this._frame[0]),Te(this._frame[1],this._frame[0],this._frame[2]),We(this._frame[1],this._frame[1]);const A=this._tempVec3,G=this._tempU,O=this._tempV;for(let S=0;S0?I(s.normalizeDistance(this._updatePerimeterLengths()),"meters"):null,se(c,this.areaCentroidRenderCoords),q(this.areaCentroidRenderCoords,i,this.areaCentroidWorldCoords,r),this._updateIntersectingSegments(),this.area=this.intersectingSegments.size===0?le(s.normalizeArea(this._computeArea()),"square-meters"):null}_updateGeodesicArea(e){const{renderCoordsHelper:s,spatialReference:i}=e,{positionsSpherical:r,positionsStereographic:n}=this,o=this._tempVec3,l=Nt(r,o);if(!l)return void(this.geodesicArea=null);const h=this._tempU,u=this._tempV;Ue(o,h,u);for(let c=0;cMath.abs(Kt(e,c))).reduce((c,g)=>Math.max(c,g),0);Xt(s,this._tempSphere);const o=n/(2*this._tempSphere.radius),l=oMath.cos(He(r.verticalAngleThreshold))?"horizontal":"vertical"),u}_updateCursorSegmentLength(e,s){const i=e.lastPoint;e.isValidPolygon||i==null||s==null?(this.geodesicStagedSegmentLength=null,this.stagedSegmentLength=null):(this.geodesicStagedSegmentLength=I(Yt(i,s),"meters"),this.stagedSegmentLength=I(this.unitNormalizer.normalizeDistance(Zt(i,s,this.unitNormalizer.spatialReference)),"meters"))}_updateMode(e){if(e===te.Auto){this.actualMeasurementMode="euclidean";let s=0;this.geodesicPathLength!=null&&(s+=this.geodesicPathLength.value),s>ls&&(this.actualMeasurementMode="geodesic")}else this.actualMeasurementMode=e===te.Euclidean?"euclidean":"geodesic";this.geodesicPathLength==null&&(this.actualMeasurementMode="euclidean"),this._mode=e}}function as(t,e){e.hasZ||(e.z=Be(t,e,"ground")??0)}const ls=1e5;let z=class extends ie{constructor(t){super(t)}initialize(){const t=this.view.spatialReference,e=J(t),s=e===Ke?Xe:e,i=!t||xe(t,s)?s:t,r=new Qt(i);this._measurementDataManager=new os(this.view,r),this.addHandles([this.analysisViewData.path.on("change",()=>this._update()),R(()=>this.analysisViewData.stagedPoint,()=>this._update(),ce),R(()=>this.analysisViewData.mode,()=>this._update(),ce)]),this._update()}_update(t=!1){const{analysisViewData:e,view:s}=this,i={maxRelativeErrorCoplanar:.005,maxRelativeErrorAlmostCoplanar:.01,verticalAngleThreshold:80};this._measurementDataManager.update(e.path,e.stagedPoint,s,i,e.mode,t)&&(e.measurementData=this._measurementDataManager.getData())}};a([d({constructOnly:!0})],z.prototype,"view",void 0),a([d({constructOnly:!0})],z.prototype,"analysis",void 0),a([d({constructOnly:!0})],z.prototype,"analysisViewData",void 0),z=a([K("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementController")],z);const De="esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurement3DPathHelper",hs=Ye.getLogger(De);let w=class extends Ze.EventedAccessor{constructor(t={}){super(t),this._version=0,this._internalGeometryChange=!1,this._extent=ue()}set areaMeasurement(t){this._set("areaMeasurement",t),t!=null&&this.view!=null&&this._initialize(t,this.view)}set view(t){this._set("view",t),t!=null&&this.areaMeasurement!=null&&this._initialize(this.areaMeasurement,t)}get constructed(){return this.areaMeasurement!=null&&this.view!=null}get version(){return this._version}get isEmptyPolygon(){return!this.constructed||this._editGeometry.components.length===0}get isValidPolygon(){return this.constructed&&this.polygonIsClosed}get extent(){if(this.constructed&&this._editGeometry.components.length>0&&this._editGeometry.components[0].vertices.length>0){const t=ue(this._extent);return this.forEachVertex(e=>{Qe(t,e.pos)}),t}return null}get spatialReference(){return this.constructed?this._editGeometry.coordinateHelper.spatialReference:null}_initialize(t,e){this.removeAllHandles(),this.addHandles(R(()=>t.geometry,()=>{this._updateEditGeometryFromModelGeometry(t,e)},ee)),this._makeDirty(!0)}_makeDirty(t=!1){this.notifyChange("polygonIsClosed"),this.notifyChange("isValidPolygon"),this.notifyChange("initialized"),this.notifyChange("extent"),t&&this.notifyChange("numVertices")}_updateEditGeometryFromModelGeometry(t,e){if(this._version++,this._internalGeometryChange)return;this.removeHandles("EditGeometry");let s=t.geometry;if(s!=null){const i=Je(s,e.spatialReference);i==null&&Jt(t,s.spatialReference,hs),s=i}this._editGeometryOperations=s!=null?Se.fromGeometry(s,e.state.viewingMode):new Se(new es("polygon",ts(!0,!1,e.spatialReference))),this._makeDirty(!0),this.emit("change"),this.addHandles(this._editGeometry.on("change",i=>{this._makeDirty(i.addedVertices!=null||i.removedVertices!=null),this._internalGeometryChange=!0,t.geometry=this.numVertices>0?this._editGeometry.geometry:null,this._internalGeometryChange=!1}),"EditGeometry")}get _editGeometry(){return this._editGeometryOperations.data}get vertices(){const t=[];return this.forEachVertex(e=>{t.push(e)}),t}get numVertices(){return this.constructed&&this._editGeometry.components.length>0?this._editGeometry.components[0].vertices.length:0}get polygonIsClosed(){return this._editGeometry.components.length>0&&this._editGeometry.components[0].isClosed()}get firstPoint(){if(this.constructed&&this._editGeometry.components.length>0){const t=this._editGeometry.components[0].getFirstVertex();if(t!=null)return this._editGeometry.coordinateHelper.vectorToPoint(t.pos)}return null}get lastPoint(){if(this.constructed&&this._editGeometry.components.length>0){const t=this._editGeometry.components[0].getLastVertex();if(t!=null)return this._editGeometry.coordinateHelper.vectorToPoint(t.pos)}return null}getVertex(t){if(!this.constructed||this._editGeometry.components.length===0||this._editGeometry.components[0].vertices.length===0)return null;const e=this._editGeometry.components[0].vertices[0];let s=e;do{if(s.index===t)return s;s=s.rightEdge.rightVertex}while(s!==e&&s!=null);return null}getVertexPositionAsPoint(t){return this._editGeometry.coordinateHelper.vectorToPoint(t.pos)}getVertexPositionAsPointFromIndex(t){return this._editGeometry.coordinateHelper.vectorToPoint(this.getVertex(t).pos)}forEachVertex(t){this.constructed&&this._editGeometry.components.length>0&&this._editGeometry.components[0].iterateVertices(t)}forEachVertexPosition(t){const e=this._editGeometry.coordinateHelper;this.forEachVertex((s,i)=>{e.vectorToPoint(s.pos,$e),t($e,i)})}clear(){this.areaMeasurement!=null&&(this.areaMeasurement.geometry=null)}add(t){if(!this.constructed)return null;if(this._editGeometry.components.length===0){const s=this.view;this._editGeometry.components.push(new ss(s.spatialReference,s.state.viewingMode))}const e=this._editGeometryOperations.appendVertex(this._editGeometry.coordinateHelper.pointToVector(t));return this.emit("change"),e}close(){if(!this.constructed||this._editGeometry.components.length===0)return null;const t=this._editGeometryOperations.closeComponent(this._editGeometry.components[0]);return this.emit("change"),t}ensureContains(t,e=""){let s=!1;if(this._editGeometry.components.forEach(i=>{i.iterateVertices(r=>{r===t&&(s=!0)})}),!s)throw new Error(`vertex doesnt exist ${e}`);return s}setVertexPosition(t,e){if(!this.constructed)return null;const s=this._editGeometryOperations.setVertexPosition(t,this._editGeometry.coordinateHelper.pointToVector(e));return this.emit("change"),s}equals(t){if(this.numVertices!==t.numVertices)return!1;let e=!0;return this.forEachVertexPosition((s,i)=>{const r=t.getVertexPositionAsPointFromIndex(i);s.equals(r)||(e=!1)}),!!e}};a([d({value:null})],w.prototype,"areaMeasurement",null),a([d({value:null})],w.prototype,"view",null),a([d()],w.prototype,"isEmptyPolygon",null),a([d()],w.prototype,"isValidPolygon",null),a([d()],w.prototype,"extent",null),a([d()],w.prototype,"spatialReference",null),a([d()],w.prototype,"numVertices",null),a([d()],w.prototype,"polygonIsClosed",null),w=a([K(De)],w);const $e=new et;function ze(t){const e=new tt,{vertex:s,fragment:i}=e;return st(s,t),e.attributes.add(H.POSITION,"vec3"),e.attributes.add(H.UV0,"vec2"),e.varyings.add("vUV","vec2"),t.multipassEnabled&&e.varyings.add("depth","float"),s.code.add(pe` - void main(void) { - vUV = uv0; - ${t.multipassEnabled?"depth = (view * vec4(position, 1.0)).z;":""} - gl_Position = proj * view * vec4(position, 1.0); - } - `),e.include(it,t),i.uniforms.add(new rt("size",r=>r.size)),i.uniforms.add(new ge("color1",r=>r.color1)),i.uniforms.add(new ge("color2",r=>r.color2)),i.include(nt),i.code.add(pe` - void main() { - ${t.multipassEnabled?"terrainDepthTest(depth);":""} - vec2 uvScaled = vUV / (2.0 * size); - - vec2 uv = fract(uvScaled - 0.25); - vec2 ab = clamp((abs(uv - 0.5) - 0.25) / fwidth(uvScaled), -0.5, 0.5); - float fade = smoothstep(0.25, 0.5, max(fwidth(uvScaled.x), fwidth(uvScaled.y))); - float t = mix(abs(ab.x + ab.y), 0.5, fade); - - fragColor = mix(color2, color1, t); - ${t.transparencyPassType===W.Color?"fragColor = premultiplyAlpha(fragColor);":""} - } - `),e}const ds=Object.freeze(Object.defineProperty({__proto__:null,build:ze},Symbol.toStringTag,{value:"Module"}));class X extends ht{initializeProgram(e){return new dt(e.rctx,X.shader.get().build(this.configuration),ct)}_setPipelineState(e){const s=this.configuration,i=e===W.NONE,r=e===W.FrontFace;return ut({blending:s.transparent?i?us:pt(e):null,depthTest:{func:gt(e)},depthWrite:i?s.writeDepth?mt:null:_t(e),colorWrite:yt,polygonOffset:i||r?s.polygonOffset?cs:null:{factor:-1,units:-25}})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}}X.shader=new ot(ds,()=>at(()=>Promise.resolve().then(()=>vs),void 0));const cs={factor:0,units:-25},us=lt(U.SRC_ALPHA,U.ONE,U.ONE_MINUS_SRC_ALPHA,U.ONE_MINUS_SRC_ALPHA);class M extends ft{constructor(){super(...arguments),this.transparencyPassType=W.NONE,this.transparent=!1,this.writeDepth=!0,this.polygonOffset=!1,this.multipassEnabled=!1,this.cullAboveGround=!1}}a([V({count:W.COUNT})],M.prototype,"transparencyPassType",void 0),a([V()],M.prototype,"transparent",void 0),a([V()],M.prototype,"writeDepth",void 0),a([V()],M.prototype,"polygonOffset",void 0),a([V()],M.prototype,"multipassEnabled",void 0),a([V()],M.prototype,"cullAboveGround",void 0),a([V({constValue:!1})],M.prototype,"occlusionPass",void 0);class ps extends vt{constructor(e){super(e,new ms),this._configuration=new M}getConfiguration(e,s){return this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.transparencyPassType=s.transparencyPassType,this._configuration.multipassEnabled=s.multipassEnabled,this._configuration.cullAboveGround=s.multipassTerrain.cullAboveGround,this._configuration}produces(e,s){return s===me.Color||s===me.Alpha?e===(this.parameters.transparent?this.parameters.writeDepth?j.TRANSPARENT_MATERIAL:j.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:j.OPAQUE_MATERIAL)||e===j.DRAPED_MATERIAL:!1}createGLMaterial(e){return new gs(e)}createBufferWriter(){return new Lt(Ct)}}class gs extends wt{beginSlot(e){return this.ensureTechnique(X,e)}}class ms extends St{constructor(){super(...arguments),this.size=Ge(1,1),this.color1=N(.75,.75,.75,1),this.color2=N(.5,.5,.5,1),this.transparent=!1,this.writeDepth=!0,this.polygonOffset=!1}}class _s extends ns{constructor(e){super(e),this._checkerBoardMaterial=null,this._renderOccluded=x.OccludeAndTransparent,this._geometry=null,this._size=Ge(1,1),this._color1=N(1,.5,0,.5),this._color2=N(1,1,1,.5),this.applyProperties(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get size(){return this._size}set size(e){Pt(this._size,e),this._updateMaterial()}get color1(){return this._color1}set color1(e){_e(e,this._color1)||(ye(this._color1,e),this._updateMaterial())}get color2(){return this._color2}set color2(e){_e(e,this._color2)||(ye(this._color2,e),this._updateMaterial())}_updateMaterial(){this._checkerBoardMaterial!=null&&this._checkerBoardMaterial.setParameters({size:this._size,color1:this._color1,color2:this._color2,renderOccluded:this._renderOccluded})}createExternalResources(){this._checkerBoardMaterial=new ps({size:this._size,color1:this._color1,color2:this._color2,transparent:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:this.isDecoration})}destroyExternalResources(){this._checkerBoardMaterial=null}forEachExternalMaterial(e){this._checkerBoardMaterial!=null&&e(this._checkerBoardMaterial)}createGeometries(e){if(this._geometry==null||this._checkerBoardMaterial==null)return;const s=ys;bt(s,this.transform);const i=this._geometry,r=[],n=p();i.position.forEach(h=>{T(n,h,s),r.push(n[0],n[1],n[2])});const o=[];i.uv.forEach(h=>{o.push(h[0],h[1])});const l=new At(this._checkerBoardMaterial,[[H.POSITION,new fe(r,i.triangleIndices,3,!0)],[H.UV0,new fe(o,i.triangleIndices,2,!0)]]);e.addGeometry(l)}}const ys=p();let L=class extends ie{get _parameters(){const{accentColor:t,textColor:e}=this.view.effectiveTheme,s=$t(t),i=ve(t,.5),r=ve(Le(t),.5),n=Le(e,Mt.Low);return{accentColor:s,transparentAccentColor:i,transparentContrastColor:r,intersectingLineColor:[1,.2,0,1],textColor:e,textBackgroundColor:Ce(n,.6),textCalloutColor:Ce(n,.5),pathLineWidth:3,perimeterLineWidth:2,projectionLineWidth:2,projectionLineStippleSize:5,labelDistance:25}}get visible(){return this.analysisViewData.visible}get testData(){return{labels:{area:this._areaLabel,perimeterLength:this._perimeterLengthLabel}}}constructor(t){super(t),this._path=null,this._intersectedPath=null,this._perimeter=null,this._intersectedPerimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._perimeterLengthLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._origin=p(),this._originTransform=Vt(),this.messages=null,this.viewData=fs,this.areaLabel=null,this.perimeterLengthLabel=null,this.loadingMessages=!0}initialize(){const{analysisViewData:t,_parameters:e,view:s}=this;this._path=new E({view:s,attached:!0,width:e.pathLineWidth,polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),this._intersectedPath=new E({view:s,attached:!0,width:e.pathLineWidth,polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),this._perimeter=new E({view:s,attached:!0,width:e.perimeterLineWidth,polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),this._intersectedPerimeter=new E({view:s,attached:!0,width:e.perimeterLineWidth,color:e.intersectingLineColor,polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),this._projectionLines=new E({view:s,attached:!0,width:e.projectionLineWidth,stipplePattern:xt(e.projectionLineStippleSize),polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),this._measurementArea=new _s({view:s,attached:!0,isDecoration:!0});const i={attached:!0,view:s,isDecoration:!0};this._areaLabel=new be({...i,fontSize:B.Large}),this._perimeterLengthLabel=new be({...i,fontSize:B.Small}),this.addHandles([R(()=>[t.mode,this.visible,t.unit,t.measurementData,t.stagedPoint],()=>this._update(),ee),R(()=>{var r;return(r=s.state)==null?void 0:r.camera},()=>this._updateLabels(),ee),Gt(()=>this._updateMessageBundle()),R(()=>this._parameters,({accentColor:r,transparentAccentColor:n,transparentContrastColor:o,textColor:l,textBackgroundColor:h,textCalloutColor:u})=>{const{_path:c,_intersectedPath:g,_perimeter:m,_projectionLines:y,_measurementArea:b,_areaLabel:C,_perimeterLengthLabel:$}=this;c.color=r,g.color=r,m.color=r,y.color=r,b.color1=n,b.color2=o,C.textColor=l,C.backgroundColor=h,C.calloutColor=u,$.textColor=l,$.backgroundColor=h,$.calloutColor=u},Dt)]),this._updateMessageBundle()}destroy(){this._measurementArea=P(this._measurementArea),this._path=P(this._path),this._intersectedPath=P(this._intersectedPath),this._perimeter=P(this._perimeter),this._intersectedPerimeter=P(this._intersectedPerimeter),this._areaLabel=P(this._areaLabel),this._perimeterLengthLabel=P(this._perimeterLengthLabel),this._projectionLines=P(this._projectionLines),this.set("view",null)}_update(){if(this.destroyed||!this.view.ready||!this.view.renderCoordsHelper)return;const{analysisViewData:{measurementData:t},analysisViewData:e}=this;t!=null&&(this._updateViewData(t,e.path,e.stagedPoint),this._updateOrigin(),this._updatePathSegments(),this._updatePerimeterSegments(),this._updateArea(),this._updateProjectionLines(),this._updateLabels())}_updateViewData(t,e,s){const i=t.validMeasurement,r=t.actualMeasurementMode==="geodesic",n=r?t.geodesicArea:t.area;let o=1;if(n){const h=this._toPreferredAreaUnit(n,this.analysisViewData.unit);o=zt(Math.sqrt(h.value)/Math.sqrt(300)),o*=Math.sqrt(Rt(1,h.unit,"square-meters")),o/=t.unitNormalizer.normalizeDistance(1)}const l={validMeasurement:i,numVertices:t.numVertices,hasStagedVertex:t.hasStagedVertex,path:e,pathVersion:e.version,stagedPoint:s,measurementData:t,mode:t.actualMeasurementMode,positionsGeographic:t.positionsGeographic,positionsRenderCoords:t.positionsRenderCoords,positionsProjected:t.positionsProjectedWorldCoords,positionsFittedRenderCoords:t.positionsFittedRenderCoords,intersectingSegments:r?t.geodesicIntersectingSegments:t.intersectingSegments,triangleIndices:r?t.geodesicTriangleIndices:t.triangleIndices,fittingMode:t.fittingMode,areaCentroid:r?t.geodesicAreaCentroidRenderCoords:t.areaCentroidRenderCoords,pathLengthLabelSegmentIndex:i?0:e.numVertices-2,perimeterLengthLabelSegmentIndex:0,checkerSize:o};this._set("viewData",l)}_updateOrigin(){const t=this.viewData;se(t.positionsRenderCoords,this._origin),Ot(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(t){const e=this.viewData,s=this.view.renderCoordsHelper.spatialReference,i=e.mode,r=[],n=[],o=[],l=e.numVertices,h=e.validMeasurement?l:l-1;for(let c=0;c=2?u=r[r.length-2]:e.hasStagedVertex&&h>=1&&(u=r[r.length-1]),{all:r,nonIntersecting:n,intersecting:o,stagedSegment:u}}_updatePathSegments(){const{visible:t}=this,e=this._createSegments("positionsRenderCoords");this._path.setGeometryFromSegments(e.nonIntersecting,this._origin),this._path.visible=t,this._intersectedPath.setGeometryFromSegments(e.intersecting,this._origin),this._intersectedPath.visible=t,this._pathSegments=e.all}_updatePerimeterSegments(){const t=this.visible&&this.viewData.mode==="euclidean",e=this._createSegments("positionsFittedRenderCoords");this._perimeter.setGeometryFromSegments(e.nonIntersecting,this._origin),this._perimeter.visible=t,this._intersectedPerimeter.setGeometryFromSegments(e.intersecting,this._origin),this._intersectedPerimeter.visible=t,this._perimeterSegments=e.all}_updateArea(){const t=this.viewData;switch(t.mode){case"euclidean":this._updateAreaEuclidean(t);break;case"geodesic":this._updateAreaGeodesic()}}_updateAreaEuclidean(t){const e=this.visible;t.validMeasurement&&t.intersectingSegments.size===0&&t.triangleIndices?(this._measurementArea.geometry={uv:t.positionsProjected,position:t.positionsFittedRenderCoords,triangleIndices:t.triangleIndices},this._measurementArea.size=[t.checkerSize,t.checkerSize],this._measurementArea.visible=e):this._measurementArea.visible=!1}_updateAreaGeodesic(){this._measurementArea.visible=!1}_updateProjectionLines(){const t=this.viewData,e=this.visible,s=t.mode,i=t.numVertices;if(i>0&&t.validMeasurement&&s==="euclidean"){const r=[];for(let n=0;n{this.messages=t,this.view&&this._update()}).finally(()=>{this.loadingMessages=!1})}};var B;a([d()],L.prototype,"_parameters",null),a([d()],L.prototype,"view",void 0),a([d()],L.prototype,"messages",void 0),a([d()],L.prototype,"analysis",void 0),a([d()],L.prototype,"viewData",void 0),a([d()],L.prototype,"analysisViewData",void 0),a([d({readOnly:!0})],L.prototype,"areaLabel",void 0),a([d({readOnly:!0})],L.prototype,"perimeterLengthLabel",void 0),a([d()],L.prototype,"loadingMessages",void 0),a([d()],L.prototype,"visible",null),L=a([K("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization")],L),function(t){t[t.Small=12]="Small",t[t.Large=16]="Large"}(B||(B={}));const fs={validMeasurement:!1,numVertices:0,hasStagedVertex:!1,path:null,pathVersion:-1,stagedPoint:null,measurementData:null,mode:null,positionsGeographic:null,positionsRenderCoords:null,positionsProjected:null,positionsFittedRenderCoords:null,intersectingSegments:null,triangleIndices:null,fittingMode:null,areaCentroid:null,pathLengthLabelSegmentIndex:null,perimeterLengthLabelSegmentIndex:null,checkerSize:null};let _=class extends Ft(ie){constructor(t){super(t),this.type="area-measurement-view-3d",this.analysis=null,this.measurementData=null,this.lastDraggedVertex=null,this.stagedPoint=null,this.mode=te.Auto}initialize(){const{analysis:t,view:e}=this;this.path=new w({view:e,areaMeasurement:t}),this.analysisVisualization=new L({view:e,analysis:t,analysisViewData:this}),this.analysisController=new z({view:e,analysis:t,analysisViewData:this})}destroy(){this.analysisController=P(this.analysisController),this.analysisVisualization=P(this.analysisVisualization),this.path.destroy()}get updating(){var t;return!!((t=this.analysisVisualization)!=null&&t.loadingMessages)}get result(){const{measurementData:t}=this;return t==null?{area:null,mode:null,perimeter:null}:t.actualMeasurementMode==="euclidean"?{area:t.area,perimeter:t.perimeterLength,mode:"euclidean"}:{area:t.geodesicArea,perimeter:t.pathLength,mode:"geodesic"}}get viewData(){return this.analysisVisualization.viewData}get validMeasurement(){return this.path.isValidPolygon}get unit(){return this.analysis.unit??this._defaultUnit}get testData(){return{visualization:this.analysisVisualization,controller:this.analysisController}}};a([d({readOnly:!0})],_.prototype,"type",void 0),a([d({constructOnly:!0,nonNullable:!0})],_.prototype,"analysis",void 0),a([d()],_.prototype,"updating",null),a([d()],_.prototype,"analysisVisualization",void 0),a([d()],_.prototype,"analysisController",void 0),a([d()],_.prototype,"result",null),a([d()],_.prototype,"measurementData",void 0),a([d()],_.prototype,"viewData",null),a([d()],_.prototype,"validMeasurement",null),a([d()],_.prototype,"path",void 0),a([d()],_.prototype,"lastDraggedVertex",void 0),a([d()],_.prototype,"stagedPoint",void 0),a([d()],_.prototype,"mode",void 0),a([d()],_.prototype,"unit",null),a([d(kt)],_.prototype,"_defaultUnit",void 0),_=a([K("esri.views.3d.analysis.AreaMeasurementAnalysisView3D")],_);const Rs=_,vs=Object.freeze(Object.defineProperty({__proto__:null,build:ze},Symbol.toStringTag,{value:"Module"}));export{Rs as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = [] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/AreaMeasurementAnalysisView3D-RBc-E7CZ.js b/dist/assets/AreaMeasurementAnalysisView3D-RBc-E7CZ.js new file mode 100644 index 0000000..a2d4ff4 --- /dev/null +++ b/dist/assets/AreaMeasurementAnalysisView3D-RBc-E7CZ.js @@ -0,0 +1,26 @@ +import{b3 as Me,bO as Y,bx as q,b4 as E,bL as Ve,a8 as p,oH as ze,ci as Z,cj as xe,zi as Oe,bu as I,a7 as ne,by as Ie,nw as Te,zj as oe,c6 as Ee,be as je,hJ as ae,c9 as D,ca as K,cK as le,zk as We,mS as ke,sj as Ue,kk as he,t9 as de,cJ as Fe,d2 as qe,py as He,d5 as Q,d6 as Ne,i2 as Be,e as a,y as d,c as J,g as ie,B as z,a9 as ce,ck as Je,cl as Xe,R as Ke,z as Qe,ed as ue,zl as Ye,T as ee,i1 as Ze,L as et,xS as tt,xX as st,bi as H,xR as pe,x_ as it,y_ as rt,xY as ge,xW as nt,y1 as j,y3 as ot,de as at,yq as lt,va as W,y5 as ht,y6 as dt,yp as ct,y7 as ut,y9 as pt,yF as gt,yb as mt,yc as _t,yd as yt,y2 as V,y4 as ft,ys as vt,xT as me,m3 as k,yu as Lt,yv as Ct,yh as wt,yi as St,p7 as Ge,bA as N,b2 as x,sl as Pt,b7 as _e,b8 as ye,tb as bt,bR as $t,bS as fe,l0 as At,nF as ve,kL as Le,kM as Mt,hR as Ce,bT as Vt,l1 as xt,kJ as Gt,P as Dt,b as P,zm as Rt,hr as zt,bP as Ot,cp as It,zn as Tt,zo as Et,zp as jt,zq as Wt,kI as kt,kV as Ut}from"./index-pCX-0tJH.js";import{s as Ft}from"./AnalysisView3D-XCzG0Hzh.js";import{e as te}from"./interfaces-tkyofe_Z.js";import{T as qt,d as Ht,M as Nt,G as Bt,w as Jt,b as Xt,S as Kt,L as Qt}from"./measurementUtils-U47xEmCr.js";import{t as se,a as Yt}from"./UnitNormalizer-RQizSo9a.js";import{U as we}from"./euclideanAreaMeasurementUtils-jpli3_gk.js";import{t as Zt,u as T}from"./LineVisualElement-iKo1s90I.js";import{V as Se,p as es,w as ts,l as ss}from"./EditGeometryOperations-vpHcsZOg.js";import{h as Pe}from"./quantityFormatUtils-oYgdvR_2.js";import{g as be,_ as is,m as rs}from"./Segment-TQS1M_Ix.js";import{a as ns}from"./Object3DVisualElement-8HoU366x.js";import"./measurementUtils-69EiqRp6.js";import"./VisualElement--2Scr6Yq.js";import"./TextOverlayItem-YHZxWGyg.js";function $e(t,e,s,i,r){Me(U,t),Y(F,t,e),q(U,s,U,r),q(F,s,F,r),E(i,F,U),Ve(i,i)}const U=p(),F=p();class os{get numVertices(){return this._length}get hasStagedVertex(){return this._hasCursorPoint}constructor(e,s){this.validMeasurement=!1,this.positionsWorldCoords=[],this.positionsRenderCoords=[],this.positionsProjectedWorldCoords=[],this.positionsFittedRenderCoords=[],this.positionsGeographic=[],this.positionsSpherical=[],this.positionsStereographic=[],this.pathSegmentLengths=[],this.geodesicPathSegmentLengths=[],this.perimeterSegmentLengths=[],this.intersectingSegments=new Set,this.geodesicIntersectingSegments=new Set,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.areaCentroidWorldCoords=p(),this.areaCentroidRenderCoords=p(),this.geodesicAreaCentroidRenderCoords=p(),this.area=null,this.geodesicArea=null,this.pathLength=null,this.geodesicPathLength=null,this.perimeterLength=null,this._length=0,this._centroidRenderCoords=p(),this._planeWorldCoords=ze(),this._worldUp=p(),this._worldTangent=p(),this._frame=[p(),p(),p()],this._pathVersion=-1,this._hasCursorPoint=!1,this._mode=null,this._tempU=p(),this._tempV=p(),this._tempVec3=p(),this._tempSphere={center:p(),radius:0},this._sceneView=e,this.unitNormalizer=s}update(e,s,i,r,n,o){const l=s!=null,h=this._pathVersion===e.version,u=this._hasCursorPoint===l,c=this._mode===n;return!(h&&!o&&u&&c&&e.isValidPolygon)&&(this._pathVersion=e.version,this._hasCursorPoint=l,this._updateCursorSegmentLength(e,s),this._update(e,s,i,r,n),!0)}_update(e,s,i,r,n){const o=this.unitNormalizer,l=this._sceneView.renderSpatialReference,h=this.unitNormalizer.spatialReference;let u=e.numVertices;const c=!(s==null||s.equals(e.lastPoint)||u>2&&s.equals(e.firstPoint));c&&(u+=1);const g=!e.polygonIsClosed&&u>2,m=e.polygonIsClosed||g;this._resize(u);const y=Z(i.spatialReference),b=xe(i.spatialReference,y)&&Oe(i.spatialReference),{positionsGeographic:C,positionsWorldCoords:A,positionsRenderCoords:$,positionsSpherical:G}=this,O=(f,v)=>{as(i.elevationProvider,f),Q(f,A[v],h),Q(f,$[v],l),b&&(Ne(f,C[v]),Q(f,G[v],y),Ve(G[v],G[v]))};e.forEachVertexPosition((f,v)=>O(f,v)),c&&O(s,u-1);const S=this._updatePathLengths(m);if(this.pathLength=this._length>1?I(o.normalizeDistance(S),"meters"):null,b){const f=this._updateGeodesicPathLengths(m,h);this.geodesicPathLength=this._length>1?I(f,"meters"):null}else this.geodesicPathLength=null;if(this._updateMode(n),!m)return this.area=null,this.geodesicArea=null,this.perimeterLength=null,this.triangleIndices=null,this.geodesicTriangleIndices=null,this.intersectingSegments.clear(),this.geodesicIntersectingSegments.clear(),void(this.validMeasurement=!1);this._updateAreaAndPerimeterLength(i,o,l,h,r),b&&this._updateGeodesicArea(i),this.validMeasurement=!0}getData(){return{validMeasurement:this.validMeasurement,numVertices:this.numVertices,hasStagedVertex:this.hasStagedVertex,positionsWorldCoords:this.positionsWorldCoords,positionsRenderCoords:this.positionsRenderCoords,positionsProjectedWorldCoords:this.positionsProjectedWorldCoords,positionsFittedRenderCoords:this.positionsFittedRenderCoords,positionsGeographic:this.positionsGeographic,positionsSpherical:this.positionsSpherical,positionsStereographic:this.positionsStereographic,pathSegmentLengths:this.pathSegmentLengths,geodesicPathSegmentLengths:this.geodesicPathSegmentLengths,perimeterSegmentLengths:this.perimeterSegmentLengths,intersectingSegments:this.intersectingSegments,geodesicIntersectingSegments:this.geodesicIntersectingSegments,triangleIndices:this.triangleIndices,geodesicTriangleIndices:this.geodesicTriangleIndices,areaCentroidWorldCoords:this.areaCentroidWorldCoords,areaCentroidRenderCoords:this.areaCentroidRenderCoords,geodesicAreaCentroidRenderCoords:this.geodesicAreaCentroidRenderCoords,fittingMode:this.fittingMode,area:this.area,geodesicArea:this.geodesicArea,pathLength:this.pathLength,geodesicPathLength:this.geodesicPathLength,perimeterLength:this.perimeterLength,unitNormalizer:this.unitNormalizer,actualMeasurementMode:this.actualMeasurementMode}}_resize(e){for(e2&&Ht(l,g),this.fittingMode=this._selectFittingMode(g,l,this._worldUp,n);let y=0;if(this.fittingMode==="horizontal"){let S=-1/0;h.forEach((f,v)=>{const re=o.getAltitude(h[v]);re>S&&(S=re,y=v)})}const b=l[y];let C=g,A=this._worldTangent;this.fittingMode==="horizontal"?C=this._worldUp:this.fittingMode==="vertical"&&(C=this._tempVec3,A=this._worldUp,oe(g,this._worldUp,C)),Me(this._frame[2],C),oe(A,C,this._frame[0]),Ee(this._frame[1],this._frame[0],this._frame[2]),je(this._frame[1],this._frame[1]);const $=this._tempVec3,G=this._tempU,O=this._tempV;for(let S=0;S0?I(s.normalizeDistance(this._updatePerimeterLengths()),"meters"):null,se(c,this.areaCentroidRenderCoords),q(this.areaCentroidRenderCoords,i,this.areaCentroidWorldCoords,r),this._updateIntersectingSegments(),this.area=this.intersectingSegments.size===0?le(s.normalizeArea(this._computeArea()),"square-meters"):null}_updateGeodesicArea(e){const{renderCoordsHelper:s,spatialReference:i}=e,{positionsSpherical:r,positionsStereographic:n}=this,o=this._tempVec3,l=Nt(r,o);if(!l)return void(this.geodesicArea=null);const h=this._tempU,u=this._tempV;We(o,h,u);for(let c=0;cMath.abs(Jt(e,c))).reduce((c,g)=>Math.max(c,g),0);Xt(s,this._tempSphere);const o=n/(2*this._tempSphere.radius),l=oMath.cos(He(r.verticalAngleThreshold))?"horizontal":"vertical"),u}_updateCursorSegmentLength(e,s){const i=e.lastPoint;e.isValidPolygon||i==null||s==null?(this.geodesicStagedSegmentLength=null,this.stagedSegmentLength=null):(this.geodesicStagedSegmentLength=I(Kt(i,s),"meters"),this.stagedSegmentLength=I(this.unitNormalizer.normalizeDistance(Qt(i,s,this.unitNormalizer.spatialReference)),"meters"))}_updateMode(e){if(e===te.Auto){this.actualMeasurementMode="euclidean";let s=0;this.geodesicPathLength!=null&&(s+=this.geodesicPathLength.value),s>ls&&(this.actualMeasurementMode="geodesic")}else this.actualMeasurementMode=e===te.Euclidean?"euclidean":"geodesic";this.geodesicPathLength==null&&(this.actualMeasurementMode="euclidean"),this._mode=e}}function as(t,e){e.hasZ||(e.z=Be(t,e,"ground")??0)}const ls=1e5;let R=class extends ie{constructor(t){super(t)}initialize(){const t=this.view.spatialReference,e=Z(t),s=e===Je?Xe:e,i=!t||xe(t,s)?s:t,r=new Yt(i);this._measurementDataManager=new os(this.view,r),this.addHandles([this.analysisViewData.path.on("change",()=>this._update()),z(()=>this.analysisViewData.stagedPoint,()=>this._update(),ce),z(()=>this.analysisViewData.mode,()=>this._update(),ce)]),this._update()}_update(t=!1){const{analysisViewData:e,view:s}=this,i={maxRelativeErrorCoplanar:.005,maxRelativeErrorAlmostCoplanar:.01,verticalAngleThreshold:80};this._measurementDataManager.update(e.path,e.stagedPoint,s,i,e.mode,t)&&(e.measurementData=this._measurementDataManager.getData())}};a([d({constructOnly:!0})],R.prototype,"view",void 0),a([d({constructOnly:!0})],R.prototype,"analysis",void 0),a([d({constructOnly:!0})],R.prototype,"analysisViewData",void 0),R=a([J("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementController")],R);const De="esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurement3DPathHelper",hs=Ke.getLogger(De);let w=class extends Qe.EventedAccessor{constructor(t={}){super(t),this._version=0,this._internalGeometryChange=!1,this._extent=ue()}set areaMeasurement(t){this._set("areaMeasurement",t),t!=null&&this.view!=null&&this._initialize(t,this.view)}set view(t){this._set("view",t),t!=null&&this.areaMeasurement!=null&&this._initialize(this.areaMeasurement,t)}get constructed(){return this.areaMeasurement!=null&&this.view!=null}get version(){return this._version}get isEmptyPolygon(){return!this.constructed||this._editGeometry.components.length===0}get isValidPolygon(){return this.constructed&&this.polygonIsClosed}get extent(){if(this.constructed&&this._editGeometry.components.length>0&&this._editGeometry.components[0].vertices.length>0){const t=ue(this._extent);return this.forEachVertex(e=>{Ye(t,e.pos)}),t}return null}get spatialReference(){return this.constructed?this._editGeometry.coordinateHelper.spatialReference:null}_initialize(t,e){this.removeAllHandles(),this.addHandles(z(()=>t.geometry,()=>{this._updateEditGeometryFromModelGeometry(t,e)},ee)),this._makeDirty(!0)}_makeDirty(t=!1){this.notifyChange("polygonIsClosed"),this.notifyChange("isValidPolygon"),this.notifyChange("initialized"),this.notifyChange("extent"),t&&this.notifyChange("numVertices")}_updateEditGeometryFromModelGeometry(t,e){if(this._version++,this._internalGeometryChange)return;this.removeHandles("EditGeometry");let s=t.geometry;if(s!=null){const i=Ze(s,e.spatialReference);i==null&&Zt(t,s.spatialReference,hs),s=i}this._editGeometryOperations=s!=null?Se.fromGeometry(s,e.state.viewingMode):new Se(new es("polygon",ts(!0,!1,e.spatialReference))),this._makeDirty(!0),this.emit("change"),this.addHandles(this._editGeometry.on("change",i=>{this._makeDirty(i.addedVertices!=null||i.removedVertices!=null),this._internalGeometryChange=!0,t.geometry=this.numVertices>0?this._editGeometry.geometry:null,this._internalGeometryChange=!1}),"EditGeometry")}get _editGeometry(){return this._editGeometryOperations.data}get vertices(){const t=[];return this.forEachVertex(e=>{t.push(e)}),t}get numVertices(){return this.constructed&&this._editGeometry.components.length>0?this._editGeometry.components[0].vertices.length:0}get polygonIsClosed(){return this._editGeometry.components.length>0&&this._editGeometry.components[0].isClosed()}get firstPoint(){if(this.constructed&&this._editGeometry.components.length>0){const t=this._editGeometry.components[0].getFirstVertex();if(t!=null)return this._editGeometry.coordinateHelper.vectorToPoint(t.pos)}return null}get lastPoint(){if(this.constructed&&this._editGeometry.components.length>0){const t=this._editGeometry.components[0].getLastVertex();if(t!=null)return this._editGeometry.coordinateHelper.vectorToPoint(t.pos)}return null}getVertex(t){if(!this.constructed||this._editGeometry.components.length===0||this._editGeometry.components[0].vertices.length===0)return null;const e=this._editGeometry.components[0].vertices[0];let s=e;do{if(s.index===t)return s;s=s.rightEdge.rightVertex}while(s!==e&&s!=null);return null}getVertexPositionAsPoint(t){return this._editGeometry.coordinateHelper.vectorToPoint(t.pos)}getVertexPositionAsPointFromIndex(t){return this._editGeometry.coordinateHelper.vectorToPoint(this.getVertex(t).pos)}forEachVertex(t){this.constructed&&this._editGeometry.components.length>0&&this._editGeometry.components[0].iterateVertices(t)}forEachVertexPosition(t){const e=this._editGeometry.coordinateHelper;this.forEachVertex((s,i)=>{e.vectorToPoint(s.pos,Ae),t(Ae,i)})}clear(){this.areaMeasurement!=null&&(this.areaMeasurement.geometry=null)}add(t){if(!this.constructed)return null;if(this._editGeometry.components.length===0){const s=this.view;this._editGeometry.components.push(new ss(s.spatialReference,s.state.viewingMode))}const e=this._editGeometryOperations.appendVertex(this._editGeometry.coordinateHelper.pointToVector(t));return this.emit("change"),e}close(){if(!this.constructed||this._editGeometry.components.length===0)return null;const t=this._editGeometryOperations.closeComponent(this._editGeometry.components[0]);return this.emit("change"),t}ensureContains(t,e=""){let s=!1;if(this._editGeometry.components.forEach(i=>{i.iterateVertices(r=>{r===t&&(s=!0)})}),!s)throw new Error(`vertex doesnt exist ${e}`);return s}setVertexPosition(t,e){if(!this.constructed)return null;const s=this._editGeometryOperations.setVertexPosition(t,this._editGeometry.coordinateHelper.pointToVector(e));return this.emit("change"),s}equals(t){if(this.numVertices!==t.numVertices)return!1;let e=!0;return this.forEachVertexPosition((s,i)=>{const r=t.getVertexPositionAsPointFromIndex(i);s.equals(r)||(e=!1)}),!!e}};a([d({value:null})],w.prototype,"areaMeasurement",null),a([d({value:null})],w.prototype,"view",null),a([d()],w.prototype,"isEmptyPolygon",null),a([d()],w.prototype,"isValidPolygon",null),a([d()],w.prototype,"extent",null),a([d()],w.prototype,"spatialReference",null),a([d()],w.prototype,"numVertices",null),a([d()],w.prototype,"polygonIsClosed",null),w=a([J(De)],w);const Ae=new et;function Re(t){const e=new tt,{vertex:s,fragment:i}=e;return st(s,t),e.attributes.add(H.POSITION,"vec3"),e.attributes.add(H.UV0,"vec2"),e.varyings.add("vUV","vec2"),t.multipassEnabled&&e.varyings.add("depth","float"),s.code.add(pe` + void main(void) { + vUV = uv0; + ${t.multipassEnabled?"depth = (view * vec4(position, 1.0)).z;":""} + gl_Position = proj * view * vec4(position, 1.0); + } + `),e.include(it,t),i.uniforms.add(new rt("size",r=>r.size)),i.uniforms.add(new ge("color1",r=>r.color1)),i.uniforms.add(new ge("color2",r=>r.color2)),i.include(nt),i.code.add(pe` + void main() { + ${t.multipassEnabled?"terrainDepthTest(depth);":""} + vec2 uvScaled = vUV / (2.0 * size); + + vec2 uv = fract(uvScaled - 0.25); + vec2 ab = clamp((abs(uv - 0.5) - 0.25) / fwidth(uvScaled), -0.5, 0.5); + float fade = smoothstep(0.25, 0.5, max(fwidth(uvScaled.x), fwidth(uvScaled.y))); + float t = mix(abs(ab.x + ab.y), 0.5, fade); + + fragColor = mix(color2, color1, t); + ${t.transparencyPassType===j.Color?"fragColor = premultiplyAlpha(fragColor);":""} + } + `),e}const ds=Object.freeze(Object.defineProperty({__proto__:null,build:Re},Symbol.toStringTag,{value:"Module"}));class X extends ht{initializeProgram(e){return new dt(e.rctx,X.shader.get().build(this.configuration),ct)}_setPipelineState(e){const s=this.configuration,i=e===j.NONE,r=e===j.FrontFace;return ut({blending:s.transparent?i?us:pt(e):null,depthTest:{func:gt(e)},depthWrite:i?s.writeDepth?mt:null:_t(e),colorWrite:yt,polygonOffset:i||r?s.polygonOffset?cs:null:{factor:-1,units:-25}})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}}X.shader=new ot(ds,()=>at(()=>Promise.resolve().then(()=>vs),void 0));const cs={factor:0,units:-25},us=lt(W.SRC_ALPHA,W.ONE,W.ONE_MINUS_SRC_ALPHA,W.ONE_MINUS_SRC_ALPHA);class M extends ft{constructor(){super(...arguments),this.transparencyPassType=j.NONE,this.transparent=!1,this.writeDepth=!0,this.polygonOffset=!1,this.multipassEnabled=!1,this.cullAboveGround=!1}}a([V({count:j.COUNT})],M.prototype,"transparencyPassType",void 0),a([V()],M.prototype,"transparent",void 0),a([V()],M.prototype,"writeDepth",void 0),a([V()],M.prototype,"polygonOffset",void 0),a([V()],M.prototype,"multipassEnabled",void 0),a([V()],M.prototype,"cullAboveGround",void 0),a([V({constValue:!1})],M.prototype,"occlusionPass",void 0);class ps extends vt{constructor(e){super(e,new ms),this._configuration=new M}getConfiguration(e,s){return this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.transparencyPassType=s.transparencyPassType,this._configuration.multipassEnabled=s.multipassEnabled,this._configuration.cullAboveGround=s.multipassTerrain.cullAboveGround,this._configuration}produces(e,s){return s===me.Color||s===me.Alpha?e===(this.parameters.transparent?this.parameters.writeDepth?k.TRANSPARENT_MATERIAL:k.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:k.OPAQUE_MATERIAL)||e===k.DRAPED_MATERIAL:!1}createGLMaterial(e){return new gs(e)}createBufferWriter(){return new Lt(Ct)}}class gs extends wt{beginSlot(e){return this.ensureTechnique(X,e)}}class ms extends St{constructor(){super(...arguments),this.size=Ge(1,1),this.color1=N(.75,.75,.75,1),this.color2=N(.5,.5,.5,1),this.transparent=!1,this.writeDepth=!0,this.polygonOffset=!1}}class _s extends ns{constructor(e){super(e),this._checkerBoardMaterial=null,this._renderOccluded=x.OccludeAndTransparent,this._geometry=null,this._size=Ge(1,1),this._color1=N(1,.5,0,.5),this._color2=N(1,1,1,.5),this.applyProperties(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get size(){return this._size}set size(e){Pt(this._size,e),this._updateMaterial()}get color1(){return this._color1}set color1(e){_e(e,this._color1)||(ye(this._color1,e),this._updateMaterial())}get color2(){return this._color2}set color2(e){_e(e,this._color2)||(ye(this._color2,e),this._updateMaterial())}_updateMaterial(){this._checkerBoardMaterial!=null&&this._checkerBoardMaterial.setParameters({size:this._size,color1:this._color1,color2:this._color2,renderOccluded:this._renderOccluded})}createExternalResources(){this._checkerBoardMaterial=new ps({size:this._size,color1:this._color1,color2:this._color2,transparent:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:this.isDecoration})}destroyExternalResources(){this._checkerBoardMaterial=null}forEachExternalMaterial(e){this._checkerBoardMaterial!=null&&e(this._checkerBoardMaterial)}createGeometries(e){if(this._geometry==null||this._checkerBoardMaterial==null)return;const s=ys;bt(s,this.transform);const i=this._geometry,r=[],n=p();i.position.forEach(h=>{E(n,h,s),r.push(n[0],n[1],n[2])});const o=[];i.uv.forEach(h=>{o.push(h[0],h[1])});const l=new $t(this._checkerBoardMaterial,[[H.POSITION,new fe(r,i.triangleIndices,3,!0)],[H.UV0,new fe(o,i.triangleIndices,2,!0)]]);e.addGeometry(l)}}const ys=p();let L=class extends ie{get _parameters(){const{accentColor:t,textColor:e}=this.view.effectiveTheme,s=At(t),i=ve(t,.5),r=ve(Le(t),.5),n=Le(e,Mt.Low);return{accentColor:s,transparentAccentColor:i,transparentContrastColor:r,intersectingLineColor:[1,.2,0,1],textColor:e,textBackgroundColor:Ce(n,.6),textCalloutColor:Ce(n,.5),pathLineWidth:3,perimeterLineWidth:2,projectionLineWidth:2,projectionLineStippleSize:5,labelDistance:25}}get visible(){return this.analysisViewData.visible}get testData(){return{labels:{area:this._areaLabel,perimeterLength:this._perimeterLengthLabel}}}constructor(t){super(t),this._path=null,this._intersectedPath=null,this._perimeter=null,this._intersectedPerimeter=null,this._projectionLines=null,this._measurementArea=null,this._areaLabel=null,this._perimeterLengthLabel=null,this._pathSegments=[],this._perimeterSegments=[],this._origin=p(),this._originTransform=Vt(),this.messages=null,this.viewData=fs,this.areaLabel=null,this.perimeterLengthLabel=null,this.loadingMessages=!0}initialize(){const{analysisViewData:t,_parameters:e,view:s}=this;this._path=new T({view:s,attached:!0,width:e.pathLineWidth,polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),this._intersectedPath=new T({view:s,attached:!0,width:e.pathLineWidth,polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),this._perimeter=new T({view:s,attached:!0,width:e.perimeterLineWidth,polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),this._intersectedPerimeter=new T({view:s,attached:!0,width:e.perimeterLineWidth,color:e.intersectingLineColor,polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),this._projectionLines=new T({view:s,attached:!0,width:e.projectionLineWidth,stipplePattern:xt(e.projectionLineStippleSize),polygonOffset:!0,renderOccluded:x.OccludeAndTransparent,isDecoration:!0}),this._measurementArea=new _s({view:s,attached:!0,isDecoration:!0});const i={attached:!0,view:s,isDecoration:!0};this._areaLabel=new be({...i,fontSize:B.Large}),this._perimeterLengthLabel=new be({...i,fontSize:B.Small}),this.addHandles([z(()=>[t.mode,this.visible,t.unit,t.measurementData,t.stagedPoint],()=>this._update(),ee),z(()=>{var r;return(r=s.state)==null?void 0:r.camera},()=>this._updateLabels(),ee),Gt(()=>this._updateMessageBundle()),z(()=>this._parameters,({accentColor:r,transparentAccentColor:n,transparentContrastColor:o,textColor:l,textBackgroundColor:h,textCalloutColor:u})=>{const{_path:c,_intersectedPath:g,_perimeter:m,_projectionLines:y,_measurementArea:b,_areaLabel:C,_perimeterLengthLabel:A}=this;c.color=r,g.color=r,m.color=r,y.color=r,b.color1=n,b.color2=o,C.textColor=l,C.backgroundColor=h,C.calloutColor=u,A.textColor=l,A.backgroundColor=h,A.calloutColor=u},Dt)]),this._updateMessageBundle()}destroy(){this._measurementArea=P(this._measurementArea),this._path=P(this._path),this._intersectedPath=P(this._intersectedPath),this._perimeter=P(this._perimeter),this._intersectedPerimeter=P(this._intersectedPerimeter),this._areaLabel=P(this._areaLabel),this._perimeterLengthLabel=P(this._perimeterLengthLabel),this._projectionLines=P(this._projectionLines),this.set("view",null)}_update(){if(this.destroyed||!this.view.ready||!this.view.renderCoordsHelper)return;const{analysisViewData:{measurementData:t},analysisViewData:e}=this;t!=null&&(this._updateViewData(t,e.path,e.stagedPoint),this._updateOrigin(),this._updatePathSegments(),this._updatePerimeterSegments(),this._updateArea(),this._updateProjectionLines(),this._updateLabels())}_updateViewData(t,e,s){const i=t.validMeasurement,r=t.actualMeasurementMode==="geodesic",n=r?t.geodesicArea:t.area;let o=1;if(n){const h=this._toPreferredAreaUnit(n,this.analysisViewData.unit);o=Rt(Math.sqrt(h.value)/Math.sqrt(300)),o*=Math.sqrt(zt(1,h.unit,"square-meters")),o/=t.unitNormalizer.normalizeDistance(1)}const l={validMeasurement:i,numVertices:t.numVertices,hasStagedVertex:t.hasStagedVertex,path:e,pathVersion:e.version,stagedPoint:s,measurementData:t,mode:t.actualMeasurementMode,positionsGeographic:t.positionsGeographic,positionsRenderCoords:t.positionsRenderCoords,positionsProjected:t.positionsProjectedWorldCoords,positionsFittedRenderCoords:t.positionsFittedRenderCoords,intersectingSegments:r?t.geodesicIntersectingSegments:t.intersectingSegments,triangleIndices:r?t.geodesicTriangleIndices:t.triangleIndices,fittingMode:t.fittingMode,areaCentroid:r?t.geodesicAreaCentroidRenderCoords:t.areaCentroidRenderCoords,pathLengthLabelSegmentIndex:i?0:e.numVertices-2,perimeterLengthLabelSegmentIndex:0,checkerSize:o};this._set("viewData",l)}_updateOrigin(){const t=this.viewData;se(t.positionsRenderCoords,this._origin),Ot(this._originTransform,this._origin),this._measurementArea.transform=this._originTransform,this._projectionLines.transform=this._originTransform}_createSegments(t){const e=this.viewData,s=this.view.renderCoordsHelper.spatialReference,i=e.mode,r=[],n=[],o=[],l=e.numVertices,h=e.validMeasurement?l:l-1;for(let c=0;c=2?u=r[r.length-2]:e.hasStagedVertex&&h>=1&&(u=r[r.length-1]),{all:r,nonIntersecting:n,intersecting:o,stagedSegment:u}}_updatePathSegments(){const{visible:t}=this,e=this._createSegments("positionsRenderCoords");this._path.setGeometryFromSegments(e.nonIntersecting,this._origin),this._path.visible=t,this._intersectedPath.setGeometryFromSegments(e.intersecting,this._origin),this._intersectedPath.visible=t,this._pathSegments=e.all}_updatePerimeterSegments(){const t=this.visible&&this.viewData.mode==="euclidean",e=this._createSegments("positionsFittedRenderCoords");this._perimeter.setGeometryFromSegments(e.nonIntersecting,this._origin),this._perimeter.visible=t,this._intersectedPerimeter.setGeometryFromSegments(e.intersecting,this._origin),this._intersectedPerimeter.visible=t,this._perimeterSegments=e.all}_updateArea(){const t=this.viewData;switch(t.mode){case"euclidean":this._updateAreaEuclidean(t);break;case"geodesic":this._updateAreaGeodesic()}}_updateAreaEuclidean(t){const e=this.visible;t.validMeasurement&&t.intersectingSegments.size===0&&t.triangleIndices?(this._measurementArea.geometry={uv:t.positionsProjected,position:t.positionsFittedRenderCoords,triangleIndices:t.triangleIndices},this._measurementArea.size=[t.checkerSize,t.checkerSize],this._measurementArea.visible=e):this._measurementArea.visible=!1}_updateAreaGeodesic(){this._measurementArea.visible=!1}_updateProjectionLines(){const t=this.viewData,e=this.visible,s=t.mode,i=t.numVertices;if(i>0&&t.validMeasurement&&s==="euclidean"){const r=[];for(let n=0;n{this.messages=t,this.view&&this._update()}).finally(()=>{this.loadingMessages=!1})}};var B;a([d()],L.prototype,"_parameters",null),a([d()],L.prototype,"view",void 0),a([d()],L.prototype,"messages",void 0),a([d()],L.prototype,"analysis",void 0),a([d()],L.prototype,"viewData",void 0),a([d()],L.prototype,"analysisViewData",void 0),a([d({readOnly:!0})],L.prototype,"areaLabel",void 0),a([d({readOnly:!0})],L.prototype,"perimeterLengthLabel",void 0),a([d()],L.prototype,"loadingMessages",void 0),a([d()],L.prototype,"visible",null),L=a([J("esri.views.3d.analysis.AreaMeasurement.support.AreaMeasurementVisualization")],L),function(t){t[t.Small=12]="Small",t[t.Large=16]="Large"}(B||(B={}));const fs={validMeasurement:!1,numVertices:0,hasStagedVertex:!1,path:null,pathVersion:-1,stagedPoint:null,measurementData:null,mode:null,positionsGeographic:null,positionsRenderCoords:null,positionsProjected:null,positionsFittedRenderCoords:null,intersectingSegments:null,triangleIndices:null,fittingMode:null,areaCentroid:null,pathLengthLabelSegmentIndex:null,perimeterLengthLabelSegmentIndex:null,checkerSize:null};let _=class extends Ft(ie){constructor(t){super(t),this.type="area-measurement-view-3d",this.analysis=null,this.measurementData=null,this.lastDraggedVertex=null,this.stagedPoint=null,this.mode=te.Auto}initialize(){const{analysis:t,view:e}=this;this.path=new w({view:e,areaMeasurement:t}),this.analysisVisualization=new L({view:e,analysis:t,analysisViewData:this}),this.analysisController=new R({view:e,analysis:t,analysisViewData:this})}destroy(){this.analysisController=P(this.analysisController),this.analysisVisualization=P(this.analysisVisualization),this.path.destroy()}get updating(){var t;return!!((t=this.analysisVisualization)!=null&&t.loadingMessages)}get result(){const{measurementData:t}=this;return t==null?{area:null,mode:null,perimeter:null}:t.actualMeasurementMode==="euclidean"?{area:t.area,perimeter:t.perimeterLength,mode:"euclidean"}:{area:t.geodesicArea,perimeter:t.pathLength,mode:"geodesic"}}get viewData(){return this.analysisVisualization.viewData}get validMeasurement(){return this.path.isValidPolygon}get unit(){return this.analysis.unit??this._defaultUnit}get testData(){return{visualization:this.analysisVisualization,controller:this.analysisController}}};a([d({readOnly:!0})],_.prototype,"type",void 0),a([d({constructOnly:!0,nonNullable:!0})],_.prototype,"analysis",void 0),a([d()],_.prototype,"updating",null),a([d()],_.prototype,"analysisVisualization",void 0),a([d()],_.prototype,"analysisController",void 0),a([d()],_.prototype,"result",null),a([d()],_.prototype,"measurementData",void 0),a([d()],_.prototype,"viewData",null),a([d()],_.prototype,"validMeasurement",null),a([d()],_.prototype,"path",void 0),a([d()],_.prototype,"lastDraggedVertex",void 0),a([d()],_.prototype,"stagedPoint",void 0),a([d()],_.prototype,"mode",void 0),a([d()],_.prototype,"unit",null),a([d(Ut)],_.prototype,"_defaultUnit",void 0),_=a([J("esri.views.3d.analysis.AreaMeasurementAnalysisView3D")],_);const zs=_,vs=Object.freeze(Object.defineProperty({__proto__:null,build:Re},Symbol.toStringTag,{value:"Module"}));export{zs as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = [] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/AttachmentInfo-kbEMEIl0.js b/dist/assets/AttachmentInfo-kbEMEIl0.js deleted file mode 100644 index d8041fc..0000000 --- a/dist/assets/AttachmentInfo-kbEMEIl0.js +++ /dev/null @@ -1 +0,0 @@ -import{e as o,y as e,ey as s,c as u,dr as f}from"./index-J0iiHjMT.js";function y(n){const{exifInfo:r,exifName:l,tagName:i}=n;if(!r||!l||!i)return null;const a=r.find(p=>p.name===l);return a?c({tagName:i,tags:a.tags}):null}function c(n){const{tagName:r,tags:l}=n;if(!l||!r)return null;const i=l.find(a=>a.name===r);return(i==null?void 0:i.value)||null}var d;const m={1:{id:1,rotation:0,mirrored:!1},2:{id:2,rotation:0,mirrored:!0},3:{id:3,rotation:180,mirrored:!1},4:{id:4,rotation:180,mirrored:!0},5:{id:5,rotation:-90,mirrored:!0},6:{id:6,rotation:90,mirrored:!1},7:{id:7,rotation:90,mirrored:!0},8:{id:8,rotation:-90,mirrored:!1}};let t=d=class extends f{constructor(n){super(n),this.contentType=null,this.exifInfo=null,this.id=null,this.globalId=null,this.keywords=null,this.name=null,this.parentGlobalId=null,this.parentObjectId=null,this.size=null,this.url=null}get orientationInfo(){const{exifInfo:n}=this,r=y({exifName:"Exif IFD0",tagName:"Orientation",exifInfo:n});return m[r]||null}clone(){return new d({contentType:this.contentType,exifInfo:this.exifInfo,id:this.id,globalId:this.globalId,keywords:this.keywords,name:this.name,parentGlobalId:this.parentGlobalId,parentObjectId:this.parentObjectId,size:this.size,url:this.url})}};o([e({type:String})],t.prototype,"contentType",void 0),o([e()],t.prototype,"exifInfo",void 0),o([e({readOnly:!0})],t.prototype,"orientationInfo",null),o([e({type:s})],t.prototype,"id",void 0),o([e({type:String})],t.prototype,"globalId",void 0),o([e({type:String})],t.prototype,"keywords",void 0),o([e({type:String})],t.prototype,"name",void 0),o([e({json:{read:!1}})],t.prototype,"parentGlobalId",void 0),o([e({json:{read:!1}})],t.prototype,"parentObjectId",void 0),o([e({type:s})],t.prototype,"size",void 0),o([e({json:{read:!1}})],t.prototype,"url",void 0),t=d=o([u("esri.layers.support.AttachmentInfo")],t);const h=t;export{h as l}; diff --git a/dist/assets/BaseDynamicLayerView3D-HrHMPsDQ.js b/dist/assets/BaseDynamicLayerView3D-HrHMPsDQ.js new file mode 100644 index 0000000..68f0e52 --- /dev/null +++ b/dist/assets/BaseDynamicLayerView3D-HrHMPsDQ.js @@ -0,0 +1 @@ +import{e as r,c as e}from"./index-pCX-0tJH.js";import{N as o}from"./DynamicLayerView3D-XykdNh09.js";import"./LayerView3D-57OghbRh.js";import"./projectExtentUtils-Q4rXasWA.js";import"./ImageMaterial.glsl-PU0wbmEN.js";import"./LayerView-ixwLVnzr.js";import"./RefreshableLayerView-DVYs7L04.js";let t=class extends o{constructor(){super(...arguments),this.type="base-dynamic-3d"}};t=r([e("esri.views.3d.layers.BaseDynamicLayerView3D")],t);const d=t;export{d as default}; diff --git a/dist/assets/BaseDynamicLayerView3D-aiAW9HKo.js b/dist/assets/BaseDynamicLayerView3D-aiAW9HKo.js deleted file mode 100644 index 9945da4..0000000 --- a/dist/assets/BaseDynamicLayerView3D-aiAW9HKo.js +++ /dev/null @@ -1 +0,0 @@ -import{e as r,c as e}from"./index-J0iiHjMT.js";import{N as o}from"./DynamicLayerView3D-4lztpXo0.js";import"./LayerView3D-iOx2MD1g.js";import"./projectExtentUtils-TwA6ooHn.js";import"./ImageMaterial.glsl-TdPtjVc_.js";import"./LayerView-efDufa6j.js";import"./RefreshableLayerView-Pd4dLcWr.js";let t=class extends o{constructor(){super(...arguments),this.type="base-dynamic-3d"}};t=r([e("esri.views.3d.layers.BaseDynamicLayerView3D")],t);const d=t;export{d as default}; diff --git a/dist/assets/BaseProcessor-nWGHAt7P.js b/dist/assets/BaseProcessor-yc_MfkjR.js similarity index 92% rename from dist/assets/BaseProcessor-nWGHAt7P.js rename to dist/assets/BaseProcessor-yc_MfkjR.js index 655130b..a9d87ab 100644 --- a/dist/assets/BaseProcessor-nWGHAt7P.js +++ b/dist/assets/BaseProcessor-yc_MfkjR.js @@ -1 +1 @@ -import{e as o,y as r,c as u,p as y}from"./index-J0iiHjMT.js";function f(s,c,p,i){const e=s.clone(),n=1<=n?(e.col=l-n,e.world+=1):e.col=l,e.row=a,e}let t=class extends y{initialize(){}destroy(){}get supportsTileUpdates(){return!1}get spatialReference(){const s=this.tileStore.tileScheme.spatialReference;return s&&s.toJSON()||null}};o([r({readOnly:!0})],t.prototype,"supportsTileUpdates",null),o([r({constructOnly:!0})],t.prototype,"remoteClient",void 0),o([r({constructOnly:!0})],t.prototype,"service",void 0),o([r()],t.prototype,"spatialReference",null),o([r({constructOnly:!0})],t.prototype,"tileInfo",void 0),o([r({constructOnly:!0})],t.prototype,"tileStore",void 0),t=o([u("esri.views.2d.layers.features.processors.BaseProcessor")],t);const v=t;export{f as o,v as p}; +import{e as o,y as r,c as u,g as y}from"./index-pCX-0tJH.js";function f(s,c,p,i){const e=s.clone(),n=1<=n?(e.col=l-n,e.world+=1):e.col=l,e.row=a,e}let t=class extends y{initialize(){}destroy(){}get supportsTileUpdates(){return!1}get spatialReference(){const s=this.tileStore.tileScheme.spatialReference;return s&&s.toJSON()||null}};o([r({readOnly:!0})],t.prototype,"supportsTileUpdates",null),o([r({constructOnly:!0})],t.prototype,"remoteClient",void 0),o([r({constructOnly:!0})],t.prototype,"service",void 0),o([r()],t.prototype,"spatialReference",null),o([r({constructOnly:!0})],t.prototype,"tileInfo",void 0),o([r({constructOnly:!0})],t.prototype,"tileStore",void 0),t=o([u("esri.views.2d.layers.features.processors.BaseProcessor")],t);const v=t;export{f as o,v as p}; diff --git a/dist/assets/BingMapsLayer-UB9V9S3W.js b/dist/assets/BingMapsLayer-UB9V9S3W.js new file mode 100644 index 0000000..7705de1 --- /dev/null +++ b/dist/assets/BingMapsLayer-UB9V9S3W.js @@ -0,0 +1 @@ +import{dF as f,dJ as j,dG as x,eW as b,d2 as c,dO as B,cf as U,av as h,eZ as M,r as d,e as r,y as s,c as T,ii as P,aI as R,dp as $,dH as k,dK as I,L,eX as a}from"./index-pCX-0tJH.js";var v;const y=new P("0/0/0",0,0,0,void 0);let u=v=class extends f(j(x(R))){constructor(){super(...arguments),this.tileInfo=b.create({spatialReference:c.WebMercator,size:256}),this.type="base-tile",this.fullExtent=new B(-20037508342787e-6,-2003750834278e-5,2003750834278e-5,20037508342787e-6,c.WebMercator),this.spatialReference=c.WebMercator}getTileBounds(e,t,i,l){const n=l||U();return y.level=e,y.row=t,y.col=i,y.extent=n,this.tileInfo.updateTileInfo(y),y.extent=void 0,n}fetchTile(e,t,i,l={}){const{signal:n}=l,p=this.getTileUrl(e,t,i),g={responseType:"image",signal:n,query:{...this.refreshParameters}};return h(p??"",g).then(m=>m.data)}async fetchImageBitmapTile(e,t,i,l={}){const{signal:n}=l;if(this.fetchTile!==v.prototype.fetchTile){const S=await this.fetchTile(e,t,i,l);return M(S,e,t,i,n)}const p=this.getTileUrl(e,t,i)??"",g={responseType:"blob",signal:n,query:{...this.refreshParameters}},{data:m}=await h(p,g);return M(m,e,t,i,n)}getTileUrl(){throw new d("basetilelayer:gettileurl-not-implemented","getTileUrl() is not implemented")}};r([s({type:b})],u.prototype,"tileInfo",void 0),r([s({type:["show","hide"]})],u.prototype,"listMode",void 0),r([s({readOnly:!0,value:"base-tile"})],u.prototype,"type",void 0),r([s({nonNullable:!0})],u.prototype,"fullExtent",void 0),r([s()],u.prototype,"spatialReference",void 0),u=v=r([T("esri.layers.BaseTileLayer")],u);const _=u,w=new $({BingMapsAerial:"aerial",BingMapsRoad:"road",BingMapsHybrid:"hybrid"}),O="https://dev.virtualearth.net";let o=class extends f(k(I(_))){constructor(e){super(e),this.type="bing-maps",this.tileInfo=new b({size:[256,256],dpi:96,origin:new L({x:-20037508342787e-6,y:20037508342787e-6,spatialReference:c.WebMercator}),spatialReference:c.WebMercator,lods:[new a({level:1,resolution:78271.5169639999,scale:295828763795777e-6}),new a({level:2,resolution:39135.7584820001,scale:147914381897889e-6}),new a({level:3,resolution:19567.8792409999,scale:73957190948944e-6}),new a({level:4,resolution:9783.93962049996,scale:36978595474472e-6}),new a({level:5,resolution:4891.96981024998,scale:18489297737236e-6}),new a({level:6,resolution:2445.98490512499,scale:9244648868618e-6}),new a({level:7,resolution:1222.99245256249,scale:4622324434309e-6}),new a({level:8,resolution:611.49622628138,scale:2311162217155e-6}),new a({level:9,resolution:305.748113140558,scale:1155581108577e-6}),new a({level:10,resolution:152.874056570411,scale:577790.554289}),new a({level:11,resolution:76.4370282850732,scale:288895.277144}),new a({level:12,resolution:38.2185141425366,scale:144447.638572}),new a({level:13,resolution:19.1092570712683,scale:72223.819286}),new a({level:14,resolution:9.55462853563415,scale:36111.909643}),new a({level:15,resolution:4.77731426794937,scale:18055.954822}),new a({level:16,resolution:2.38865713397468,scale:9027.977411}),new a({level:17,resolution:1.19432856685505,scale:4513.988705}),new a({level:18,resolution:.597164283559817,scale:2256.994353}),new a({level:19,resolution:.298582141647617,scale:1128.497176}),new a({level:20,resolution:.1492910708238085,scale:564.248588})]}),this.key=null,this.style="road",this.culture="en-US",this.region=null,this.portalUrl=null,this.hasAttributionData=!0}get bingMetadata(){return this._get("bingMetadata")}set bingMetadata(e){this._set("bingMetadata",e)}get copyright(){return this.bingMetadata!=null?this.bingMetadata.copyright:null}get operationalLayerType(){return w.toJSON(this.style)}get bingLogo(){return this.bingMetadata!=null?this.bingMetadata.brandLogoUri:null}load(e){return this.key?this.addResolvingPromise(this._getMetadata()):this.portalUrl?this.addResolvingPromise(this._getPortalBingKey().then(()=>this._getMetadata())):this.addResolvingPromise(Promise.reject(new d("bingmapslayer:load","Bing layer must have bing key."))),Promise.resolve(this)}getTileUrl(e,t,i){if(!this.loaded||this.bingMetadata==null)return null;const l=this.bingMetadata.resourceSets[0].resources[0],n=l.imageUrlSubdomains[t%l.imageUrlSubdomains.length],p=this._getQuadKey(e,t,i);return l.imageUrl.replace("{subdomain}",n).replace("{quadkey}",p)}async fetchAttributionData(){return this.load().then(()=>this.bingMetadata==null?null:{contributors:this.bingMetadata.resourceSets[0].resources[0].imageryProviders.map(e=>({attribution:e.attribution,coverageAreas:e.coverageAreas.map(t=>({zoomMin:t.zoomMin,zoomMax:t.zoomMax,score:1,bbox:[t.bbox[0],t.bbox[1],t.bbox[2],t.bbox[3]]}))}))})}_getMetadata(){const e={road:"roadOnDemand",aerial:"aerial",hybrid:"aerialWithLabelsOnDemand"}[this.style];return h(`${O}/REST/v1/Imagery/Metadata/${e}`,{responseType:"json",query:{include:"ImageryProviders",uriScheme:"https",key:this.key,suppressStatus:!0,output:"json",culture:this.culture,userRegion:this.region}}).then(t=>{const i=t.data;if(i.statusCode!==200)throw new d("bingmapslayer:getmetadata",i.statusDescription);if(this.bingMetadata=i,this.bingMetadata.resourceSets.length===0)throw new d("bingmapslayer:getmetadata","no bing resourcesets");if(this.bingMetadata.resourceSets[0].resources.length===0)throw new d("bingmapslayer:getmetadata","no bing resources")}).catch(t=>{throw new d("bingmapslayer:getmetadata",t.message)})}_getPortalBingKey(){return h(this.portalUrl??"",{responseType:"json",authMode:"no-prompt",query:{f:"json"}}).then(e=>{if(!e.data.bingKey)throw new d("bingmapslayer:getportalbingkey","The referenced Portal does not contain a valid bing key");this.key=e.data.bingKey}).catch(e=>{throw new d("bingmapslayer:getportalbingkey",e.message)})}_getQuadKey(e,t,i){let l="";for(let n=e;n>0;n--){let p=0;const g=1<m.data)}async fetchImageBitmapTile(e,t,i,l={}){const{signal:n}=l;if(this.fetchTile!==v.prototype.fetchTile){const S=await this.fetchTile(e,t,i,l);return M(S,e,t,i,n)}const p=this.getTileUrl(e,t,i)??"",g={responseType:"blob",signal:n,query:{...this.refreshParameters}},{data:m}=await h(p,g);return M(m,e,t,i,n)}getTileUrl(){throw new u("basetilelayer:gettileurl-not-implemented","getTileUrl() is not implemented")}};r([s({type:b})],d.prototype,"tileInfo",void 0),r([s({type:["show","hide"]})],d.prototype,"listMode",void 0),r([s({readOnly:!0,value:"base-tile"})],d.prototype,"type",void 0),r([s({nonNullable:!0})],d.prototype,"fullExtent",void 0),r([s()],d.prototype,"spatialReference",void 0),d=v=r([T("esri.layers.BaseTileLayer")],d);const _=d,w=new R({BingMapsAerial:"aerial",BingMapsRoad:"road",BingMapsHybrid:"hybrid"}),O="https://dev.virtualearth.net";let o=class extends f(k(I(_))){constructor(e){super(e),this.type="bing-maps",this.tileInfo=new b({size:[256,256],dpi:96,origin:new L({x:-20037508342787e-6,y:20037508342787e-6,spatialReference:c.WebMercator}),spatialReference:c.WebMercator,lods:[new a({level:1,resolution:78271.5169639999,scale:295828763795777e-6}),new a({level:2,resolution:39135.7584820001,scale:147914381897889e-6}),new a({level:3,resolution:19567.8792409999,scale:73957190948944e-6}),new a({level:4,resolution:9783.93962049996,scale:36978595474472e-6}),new a({level:5,resolution:4891.96981024998,scale:18489297737236e-6}),new a({level:6,resolution:2445.98490512499,scale:9244648868618e-6}),new a({level:7,resolution:1222.99245256249,scale:4622324434309e-6}),new a({level:8,resolution:611.49622628138,scale:2311162217155e-6}),new a({level:9,resolution:305.748113140558,scale:1155581108577e-6}),new a({level:10,resolution:152.874056570411,scale:577790.554289}),new a({level:11,resolution:76.4370282850732,scale:288895.277144}),new a({level:12,resolution:38.2185141425366,scale:144447.638572}),new a({level:13,resolution:19.1092570712683,scale:72223.819286}),new a({level:14,resolution:9.55462853563415,scale:36111.909643}),new a({level:15,resolution:4.77731426794937,scale:18055.954822}),new a({level:16,resolution:2.38865713397468,scale:9027.977411}),new a({level:17,resolution:1.19432856685505,scale:4513.988705}),new a({level:18,resolution:.597164283559817,scale:2256.994353}),new a({level:19,resolution:.298582141647617,scale:1128.497176}),new a({level:20,resolution:.1492910708238085,scale:564.248588})]}),this.key=null,this.style="road",this.culture="en-US",this.region=null,this.portalUrl=null,this.hasAttributionData=!0}get bingMetadata(){return this._get("bingMetadata")}set bingMetadata(e){this._set("bingMetadata",e)}get copyright(){return this.bingMetadata!=null?this.bingMetadata.copyright:null}get operationalLayerType(){return w.toJSON(this.style)}get bingLogo(){return this.bingMetadata!=null?this.bingMetadata.brandLogoUri:null}load(e){return this.key?this.addResolvingPromise(this._getMetadata()):this.portalUrl?this.addResolvingPromise(this._getPortalBingKey().then(()=>this._getMetadata())):this.addResolvingPromise(Promise.reject(new u("bingmapslayer:load","Bing layer must have bing key."))),Promise.resolve(this)}getTileUrl(e,t,i){if(!this.loaded||this.bingMetadata==null)return null;const l=this.bingMetadata.resourceSets[0].resources[0],n=l.imageUrlSubdomains[t%l.imageUrlSubdomains.length],p=this._getQuadKey(e,t,i);return l.imageUrl.replace("{subdomain}",n).replace("{quadkey}",p)}async fetchAttributionData(){return this.load().then(()=>this.bingMetadata==null?null:{contributors:this.bingMetadata.resourceSets[0].resources[0].imageryProviders.map(e=>({attribution:e.attribution,coverageAreas:e.coverageAreas.map(t=>({zoomMin:t.zoomMin,zoomMax:t.zoomMax,score:1,bbox:[t.bbox[0],t.bbox[1],t.bbox[2],t.bbox[3]]}))}))})}_getMetadata(){const e={road:"roadOnDemand",aerial:"aerial",hybrid:"aerialWithLabelsOnDemand"}[this.style];return h(`${O}/REST/v1/Imagery/Metadata/${e}`,{responseType:"json",query:{include:"ImageryProviders",uriScheme:"https",key:this.key,suppressStatus:!0,output:"json",culture:this.culture,userRegion:this.region}}).then(t=>{const i=t.data;if(i.statusCode!==200)throw new u("bingmapslayer:getmetadata",i.statusDescription);if(this.bingMetadata=i,this.bingMetadata.resourceSets.length===0)throw new u("bingmapslayer:getmetadata","no bing resourcesets");if(this.bingMetadata.resourceSets[0].resources.length===0)throw new u("bingmapslayer:getmetadata","no bing resources")}).catch(t=>{throw new u("bingmapslayer:getmetadata",t.message)})}_getPortalBingKey(){return h(this.portalUrl??"",{responseType:"json",authMode:"no-prompt",query:{f:"json"}}).then(e=>{if(!e.data.bingKey)throw new u("bingmapslayer:getportalbingkey","The referenced Portal does not contain a valid bing key");this.key=e.data.bingKey}).catch(e=>{throw new u("bingmapslayer:getportalbingkey",e.message)})}_getQuadKey(e,t,i){let l="";for(let n=e;n>0;n--){let p=0;const g=1<({minX:s[0],minY:s[1],maxX:s[2],maxY:s[3]}):["[0]","[1]","[2]","[3]"]),this._loadIndex=()=>{if(this._indexInvalid){const s=new Array(this._idByBounds.size);let d=0;this._idByBounds.forEach((n,e)=>{s[d++]=e}),this._indexInvalid=!1,this._index.clear(),this._index.load(s)}else this._boundsToLoad.length&&(this._index.load(Array.from(new Set(this._boundsToLoad.filter(s=>this._idByBounds.has(s))))),this._boundsToLoad.length=0)}}get fullBounds(){if(!this._boundsById.size)return null;const s=h();for(const d of this._boundsById.values())d&&(s[0]=Math.min(d[0],s[0]),s[1]=Math.min(d[1],s[1]),s[2]=Math.max(d[2],s[2]),s[3]=Math.max(d[3],s[3]));return s}get valid(){return!this._indexInvalid}clear(){this._indexInvalid=!1,this._boundsToLoad.length=0,this._boundsById.clear(),this._idByBounds.clear(),this._index.clear()}delete(s){const d=this._boundsById.get(s);this._boundsById.delete(s),d&&(this._idByBounds.delete(d),this._indexInvalid||this._index.remove(d))}forEachInBounds(s,d){this._loadIndex(),l(this._index,s,n=>d(this._idByBounds.get(n)))}get(s){return this._boundsById.get(s)}has(s){return this._boundsById.has(s)}invalidateIndex(){this._indexInvalid||(this._indexInvalid=!0,this._boundsToLoad.length=0)}set(s,d){if(!this._indexInvalid){const n=this._boundsById.get(s);n&&(this._index.remove(n),this._idByBounds.delete(n))}this._boundsById.set(s,d),d&&(this._idByBounds.set(d,s),this._indexInvalid||(this._boundsToLoad.push(d),this._boundsToLoad.length>_&&this._loadIndex()))}}export{B as o}; +import{dE as o,ed as h}from"./index-pCX-0tJH.js";import{s as a}from"./PooledRBush-rhLtoPG7.js";const _=5e4,t={minX:0,minY:0,maxX:0,maxY:0};function u(i){t.minX=i[0],t.minY=i[1],t.maxX=i[2],t.maxY=i[3]}function l(i,s,d){u(s),i.search(t,d)}class B{constructor(){this._indexInvalid=!1,this._boundsToLoad=[],this._boundsById=new Map,this._idByBounds=new Map,this._index=new a(9,o("esri-csp-restrictions")?s=>({minX:s[0],minY:s[1],maxX:s[2],maxY:s[3]}):["[0]","[1]","[2]","[3]"]),this._loadIndex=()=>{if(this._indexInvalid){const s=new Array(this._idByBounds.size);let d=0;this._idByBounds.forEach((n,e)=>{s[d++]=e}),this._indexInvalid=!1,this._index.clear(),this._index.load(s)}else this._boundsToLoad.length&&(this._index.load(Array.from(new Set(this._boundsToLoad.filter(s=>this._idByBounds.has(s))))),this._boundsToLoad.length=0)}}get fullBounds(){if(!this._boundsById.size)return null;const s=h();for(const d of this._boundsById.values())d&&(s[0]=Math.min(d[0],s[0]),s[1]=Math.min(d[1],s[1]),s[2]=Math.max(d[2],s[2]),s[3]=Math.max(d[3],s[3]));return s}get valid(){return!this._indexInvalid}clear(){this._indexInvalid=!1,this._boundsToLoad.length=0,this._boundsById.clear(),this._idByBounds.clear(),this._index.clear()}delete(s){const d=this._boundsById.get(s);this._boundsById.delete(s),d&&(this._idByBounds.delete(d),this._indexInvalid||this._index.remove(d))}forEachInBounds(s,d){this._loadIndex(),l(this._index,s,n=>d(this._idByBounds.get(n)))}get(s){return this._boundsById.get(s)}has(s){return this._boundsById.has(s)}invalidateIndex(){this._indexInvalid||(this._indexInvalid=!0,this._boundsToLoad.length=0)}set(s,d){if(!this._indexInvalid){const n=this._boundsById.get(s);n&&(this._index.remove(n),this._idByBounds.delete(n))}this._boundsById.set(s,d),d&&(this._idByBounds.set(d,s),this._indexInvalid||(this._boundsToLoad.push(d),this._boundsToLoad.length>_&&this._loadIndex()))}}export{B as o}; diff --git a/dist/assets/Box-gJ8-sOXE.js b/dist/assets/Box-7JWnlTvk.js similarity index 88% rename from dist/assets/Box-gJ8-sOXE.js rename to dist/assets/Box-7JWnlTvk.js index a3d3706..cd92d4c 100644 --- a/dist/assets/Box-gJ8-sOXE.js +++ b/dist/assets/Box-7JWnlTvk.js @@ -1 +1 @@ -import{l as B,N as K,hp as P,T as v,hq as nt,J as S,bX as D,a8 as ct,K as lt,L as Q,ae as k,R as U,af as F,F as pt,d as b,n as V,S as R,I as _t,e as d,y as g,_ as ut,A as dt,P as gt,c as vt}from"./index-J0iiHjMT.js";import{i as x,s as O,a as mt,m as yt}from"./drawUtils-woTYaREB.js";import{l as ft,U as Gt}from"./GraphicMover-DhG5Ib7v.js";import{d as bt}from"./settings-YeKUIkGh.js";import{i as xt,p as wt}from"./ExtentTooltipInfos-LPjFe37b.js";import{u as q,m as z}from"./Tooltip-ON77BKb3.js";import{r as St}from"./TranslateTooltipInfos-J6BygtUO.js";import"./featureUtils-itZGjo5c.js";import"./GraphicManipulator-ku6oRBpa.js";import"./drapedUtils-9db1OpTX.js";import"./euclideanLengthMeasurementUtils-VQw5qWk6.js";import"./measurementUtils-84-ZBArh.js";import"./quantityFormatUtils-NiAiojad.js";function L(t,i,e,s){const o=[];for(const a of t){const h=a.slice(0);o.push(h);const c=i*(a[0]-s.x)-e*(a[1]-s.y)+s.x,r=e*(a[0]-s.x)+i*(a[1]-s.y)+s.y;h[0]=c,h[1]=r}return o}function H(t,i,e){const{hasM:s,hasZ:o,spatialReference:a}=t,h=i*Math.PI/180,c=Math.cos(h),r=Math.sin(h);if("xmin"in t&&(e=e??t.center,t=new B({spatialReference:a,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]})),"paths"in t){e=e??t.extent.center;const l=[];for(const n of t.paths)l.push(L(n,c,r,e));return new K({hasM:s,hasZ:o,spatialReference:a,paths:l})}if("rings"in t){e=e??t.extent.center;const l=[];for(const n of t.rings){const p=P(n),m=L(n,c,r,e);P(m)!==p&&m.reverse(),l.push(m)}return new B({hasM:s,hasZ:o,spatialReference:a,rings:l})}if("x"in t){e=e??t;const l=new v({x:c*(t.x-e.x)-r*(t.y-e.y)+e.x,y:r*(t.x-e.x)+c*(t.y-e.y)+e.y,spatialReference:a});return t.z!=null&&(l.z=t.z),t.m!=null&&(l.m=t.m),l}return"points"in t?(e=e??t.extent.center,new nt({hasM:s,hasZ:o,points:L(t.points,c,r,e),spatialReference:a})):null}class kt{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.dx=s,this.dy=o,this.type="move-start"}}class Rt{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.dx=s,this.dy=o,this.type="move"}}class Z{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.dx=s,this.dy=o,this.type="move-stop"}}class Mt{constructor(i,e,s){this.graphics=i,this.mover=e,this.angle=s,this.type="rotate-start"}}class It{constructor(i,e,s){this.graphics=i,this.mover=e,this.angle=s,this.type="rotate"}}class j{constructor(i,e,s){this.graphics=i,this.mover=e,this.angle=s,this.type="rotate-stop"}}class Ct{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.xScale=s,this.yScale=o,this.type="scale-start"}}class Ot{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.xScale=s,this.yScale=o,this.type="scale"}}class J{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.xScale=s,this.yScale=o,this.type="scale-stop"}}const _=bt.transformGraphics,Ht={centerIndicator:new S({style:"cross",size:_.center.size,color:_.center.color}),fill:{default:new D({color:_.fill.color,outline:{color:_.fill.outlineColor,join:"round",width:1}}),active:new D({color:_.fill.stagedColor,outline:{color:_.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new S({style:"square",size:_.vertex.size,color:_.vertex.color,outline:{color:_.vertex.outlineColor,width:1}}),hover:new S({style:"square",size:_.vertex.hoverSize,color:_.vertex.hoverColor,outline:{color:_.vertex.hoverOutlineColor,width:1}})},rotator:{default:new S({style:"circle",size:_.vertex.size,color:_.vertex.color,outline:{color:_.vertex.outlineColor,width:1}}),hover:new S({style:"circle",size:_.vertex.hoverSize,color:_.vertex.hoverColor,outline:{color:_.vertex.hoverOutlineColor,width:1}})},rotatorLine:new ct({color:_.line.color,width:1})};let u=class extends lt.EventedAccessor{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._tooltip=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=Ht,this.tooltipOptions=new Q,this.view=null,this._getBounds=(()=>{const i=k();return(e,s)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const o of s){if(!o)continue;let a,h,c,r;if(o.type==="point")a=c=o.x,h=r=o.y;else if(o.type==="multipoint"){const l=U(o);[a,h,c,r]=F(i,[l])}else if(o.type==="extent")[a,h,c,r]=[o.xmin,o.ymin,o.xmax,o.ymax];else{const l=U(o);[a,h,c,r]=F(i,l)}e[0]=Math.min(a,e[0]),e[1]=Math.min(h,e[1]),e[2]=Math.max(c,e[2]),e[3]=Math.max(r,e[3])}return e}})()}initialize(){const t=this.view;this._highlightHelper=new ft({view:t}),this._tooltip=new q({view:t}),this._setup(),this.addHandles([pt(()=>t==null?void 0:t.ready,()=>{const{layer:i,view:e}=this;ut(e,i)},{once:!0,initial:!0}),b(()=>this.preserveAspectRatio,()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))}),b(()=>t==null?void 0:t.scale,()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()}),b(()=>this.graphics,()=>this.refresh()),b(()=>this.layer,(i,e)=>{e&&this._resetGraphics(e),this.refresh()}),b(()=>this.highlightsEnabled,()=>{var i;(i=this._highlightHelper)==null||i.removeAll(),this._setUpHighlights()}),b(()=>this.tooltipOptions.enabled,i=>{this._tooltip=i?new q({view:this.view}):V(this._tooltip)},dt),b(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),gt),this.on("move-start",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onMoveStart)==null?void 0:s.call(e,i)}),this.on("move",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onMove)==null?void 0:s.call(e,i)}),this.on("move-stop",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onMoveStop)==null?void 0:s.call(e,i)}),this.on("rotate-start",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onRotateStart)==null?void 0:s.call(e,i)}),this.on("rotate",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onRotate)==null?void 0:s.call(e,i)}),this.on("rotate-stop",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onRotateStop)==null?void 0:s.call(e,i)}),this.on("scale-start",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onScaleStart)==null?void 0:s.call(e,i)}),this.on("scale",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onScale)==null?void 0:s.call(e,i)}),this.on("scale-stop",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onScaleStop)==null?void 0:s.call(e,i)})])}destroy(){this._reset(),this._tooltip=V(this._tooltip)}get state(){var e;const t=((e=this.view)==null?void 0:e.ready)??!1,i=this.graphics.length&&this.layer;return t&&i?"active":t?"ready":"disabled"}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,i){if(this._mover&&this.graphics.length){for(const e of this.graphics){const s=e.geometry,o=x(s,t,i,this.view);e.geometry=o}this.refresh(),this.emit("move-stop",new Z(this.graphics,null,t,i))}}scale(t,i){if(this._mover&&this.graphics.length){for(const e of this.graphics){const s=e.geometry,o=O(s,t,i);e.geometry=o}this.refresh(),this.emit("scale-stop",new J(this.graphics,null,t,i))}}rotate(t,i){if(this._mover&&this.graphics.length){if(!i){const e=this._vertexGraphics[1].geometry.x,s=this._vertexGraphics[3].geometry.y;i=new v(e,s,this.view.spatialReference)}for(const e of this.graphics){const s=e.geometry,o=H(s,t,i);e.geometry=o}this.refresh(),this.emit("rotate-stop",new j(this.graphics,null,t))}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){this.state==="active"&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){var t;(t=this._highlightHelper)==null||t.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new Gt({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:i=>this._onGraphicClickCallback(i),onGraphicMoveStart:i=>this._onGraphicMoveStartCallback(i),onGraphicMove:i=>this._onGraphicMoveCallback(i),onGraphicMoveStop:i=>this._onGraphicMoveStopCallback(i),onGraphicPointerOver:i=>this._onGraphicPointerOverCallback(i),onGraphicPointerOut:i=>this._onGraphicPointerOutCallback(i)}})}_getStartInfo(t){const[i,e,s,o]=this._getBoxBounds(k()),a=Math.abs(s-i),h=Math.abs(o-e),c=(s+i)/2,r=(o+e)/2,{x:l,y:n}=t.geometry;return{width:a,height:h,centerX:c,centerY:r,startX:l,startY:n,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map(t=>this._getGraphicInfo(t))}_getGraphicInfo(t){const i=t.geometry,[e,s,o,a]=this._getBounds(k(),[i]);return{width:Math.abs(o-e),height:Math.abs(a-s),centerX:(o+e)/2,centerY:(a+s)/2,geometry:i}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:i,_xScale:e,_yScale:s,_backgroundGraphic:o,_vertexGraphics:a,_rotateHandleGraphic:h,symbols:c}=this,r=t.graphic;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=c.fill.active,this._startInfo=this._getStartInfo(r),this._updateTooltip(r,t.viewEvent),r===h?(this.view.cursor="grabbing",this.emit("rotate-start",new Mt(this.graphics,r,i))):a.includes(r)?(this._activeHandleGraphic=r,this.emit("scale-start",new Ct(this.graphics,r,e,s))):this.emit("move-start",new kt(this.graphics,r,t.dx,t.dy))}_onGraphicMoveCallback(t){const i=t.graphic;if(this._startInfo)if(this._vertexGraphics.includes(i))this._scaleGraphic(i),this._updateTooltip(i,t.viewEvent),this.emit("scale",new Ot(this.graphics,i,this._xScale,this._yScale));else if(i===this._rotateHandleGraphic)this._rotateGraphic(i),this._updateTooltip(i,t.viewEvent),this.emit("rotate",new It(this.graphics,i,this._angleOfRotation));else{const{dx:e,dy:s}=t;this._totalDx+=e,this._totalDy+=s,this._moveGraphic(i,e,s),this._updateTooltip(i,t.viewEvent),this.emit("move",new Rt(this.graphics,i,e,s))}}_onGraphicMoveStopCallback(t){const i=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:e,_totalDx:s,_totalDy:o,_xScale:a,_yScale:h,_vertexGraphics:c,_rotateHandleGraphic:r}=this;this.refresh(),i===r?(this.view.cursor="pointer",this.emit("rotate-stop",new j(this.graphics,i,e))):c.includes(i)?this.emit("scale-stop",new J(this.graphics,i,a,h)):this.emit("move-stop",new Z(this.graphics,i,s,o))}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:i,_vertexGraphics:e,graphics:s,_rotateHandleGraphic:o,symbols:a,view:h}=this,c=t.graphic;if(this._hoveredGraphic=c,c===o)return o.symbol=a.rotator.hover,h.cursor="pointer",void this._updateTooltip(c);if(s.includes(c)||c===i)return void(h.cursor="move");if(!e.includes(c))return void(h.cursor="pointer");this._updateTooltip(c),t.graphic.symbol=a.handles.hover;const r=h.rotation;let l,n=t.index;switch(n<8&&(r>=0&&r<45?n%=8:n=r>=45&&r<90?(n+1)%8:r>=90&&r<135?(n+2)%8:r>=135&&r<180?(n+3)%8:r>=180&&r<225?(n+4)%8:r>=225&&r<270?(n+5)%8:r>=270&&r<315?(n+6)%8:(n+7)%8),n){case 0:case 4:l="nwse-resize";break;case 1:case 5:l="ns-resize";break;case 2:case 6:l="nesw-resize";break;case 3:case 7:l="ew-resize";break;default:l="pointer"}h.cursor=l}_onGraphicPointerOutCallback(t){const{_vertexGraphics:i,_rotateHandleGraphic:e,symbols:s,view:o}=this;this._hoveredGraphic=null,t.graphic===e?e.symbol=s.rotator.default:i.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),o.cursor="default",this._updateTooltip()}_scaleGraphic(t){var Y;const{_startInfo:i,_vertexGraphics:e,preserveAspectRatio:s,view:o}=this,{centerX:a,centerY:h,startX:c,startY:r}=i,{resolution:l,transform:n}=o.state,p=e.indexOf(t);p!==1&&p!==5||this._updateX(t,a),p!==3&&p!==7||this._updateY(t,h);const{x:m,y}=t.geometry,T=n[0]*m+n[2]*y+n[4],$=n[1]*m+n[3]*y+n[5],M=((Y=i.graphicInfos)==null?void 0:Y.map(w=>w.geometry))??[];if(s){const w=n[0]*a+n[2]*h+n[4],I=n[1]*a+n[3]*h+n[5],f=n[0]*c+n[2]*r+n[4],G=n[1]*c+n[3]*r+n[5];this._xScale=this._yScale=mt(w,I,f,G,T,$);for(const C of M){const E=M.indexOf(C);this.graphics[E].geometry=O(C,this._xScale,this._yScale,[a,h])}this._updateBackgroundGraphic()}else{const{width:w,height:I}=i;let f=m-c,G=r-y;if(p===1||p===5?f=0:p!==3&&p!==7||(G=0),f===0&&G===0)return;const C=w+(c>a?f:-1*f),E=I+(ry.geometry))??[];for(const y of p){const T=p.indexOf(y),$=H(y,this._angleOfRotation,l);this.graphics[T].geometry=$}this._backgroundGraphic.geometry=H(a,this._angleOfRotation,l),this._rotateHandleGraphic.geometry=H(h,this._angleOfRotation,l)}_moveGraphic(t,i,e){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=x(s,i,e,this.view);for(const o of this.graphics)o!==t&&(o.geometry=x(o.geometry,i,e,this.view))}else if(t===this._centerGraphic){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=x(s,i,e,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=x(s.geometry,i,e,this.view)}_setUpHighlights(){var t;this.highlightsEnabled&&this.graphics.length&&((t=this._highlightHelper)==null||t.add(this.graphics))}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new R(null,i.centerIndicator,t),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new R(null,i.fill.default,t),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new R(null,i.rotatorLine,t),this._rotateHandleGraphic=new R(null,i.rotator.default,t),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let e=0;e<8;e++)this._vertexGraphics.push(new R(null,i.handles.default,t));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){var i,e;const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:(i=this.symbols.fill.active)==null?void 0:i.clone().set("outline.color",t),default:(e=this.symbols.fill.default)==null?void 0:e.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const s of this._vertexGraphics)s.symbol=s===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach(t=>t.visible=!1)}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach((i,e)=>{const[s,o]=t[e];this._updateXY(i,s,o)})}_updateBackgroundGraphic(){const t=this._getCoordinates();this._backgroundGraphic.geometry=new B({rings:t,spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,i,e,s]=this._getBoxBounds(k()),o=(e+t)/2,a=(s+i)/2;this._centerGraphic.geometry=new v(o,a,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:i}=this._vertexGraphics[1].geometry,e=i+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new v(t,e,this.view.spatialReference)}_updateRotateLineGraphic(){var e;if(!this._vertexGraphics.length||!((e=this._rotateHandleGraphic)!=null&&e.geometry))return;const t=this._vertexGraphics[1].geometry,i=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new K({paths:[[t.x,t.y],[i.x,i.y]],spatialReference:this.view.spatialReference})}_updateXY(t,i,e){t.geometry=new v(i,e,this.view.spatialReference)}_updateX(t,i){const e=t.geometry.y;t.geometry=new v(i,e,this.view.spatialReference)}_updateY(t,i){const e=t.geometry.x;t.geometry=new v(e,i,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some(t=>(t==null?void 0:t.geometry)!=null&&t.geometry.type==="extent")}_getBoxBounds(t){const i=this.graphics.map(e=>e.geometry);return this._getBounds(t,i)}_getCoordinates(t){const[i,e,s,o]=this._getBoxBounds(k());if(t){const a=(i+s)/2,h=(o+e)/2;return[[i,o],[a,o],[s,o],[s,h],[s,e],[a,e],[i,e],[i,h]]}return[[i,o],[s,o],[s,e],[i,e]]}_updateTooltip(t,i){if(this._tooltip==null)return;if(!t)return void this._tooltip.clear();const{_backgroundGraphic:e,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:a}=this;t===a?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===e)&&this._updateMoveTooltip(i)}_updateRotateTooltip(){this._tooltip!=null&&(this._tooltip.info=new xt({tooltipOptions:this.tooltipOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{_tooltip:t,_xScale:i,_yScale:e,tooltipOptions:s,view:o}=this;if(t==null)return;const a=o.spatialReference,h=this._getCoordinates(),c=new v(h[0][0],h[0][1],a),r=new v(h[1][0],h[1][1],a),l=new v(h[2][0],h[2][1],a),n=z(c,r),p=z(r,l);if(n==null||p==null)return;const m=Math.abs(i),y=Math.abs(e);t.info=new wt({tooltipOptions:s,xScale:m,yScale:y,xSize:n,ySize:p})}_updateMoveTooltip(t){const{_tooltip:i,tooltipOptions:e,view:s}=this;if(i==null)return;const o=new St({tooltipOptions:e});if(t){const{x:a,y:h}=t.origin,c=s.toMap(t),r=s.toMap({x:a,y:h}),l=z(r,c);o.distance=l??_t}i.info=o}};d([g()],u.prototype,"_tooltip",void 0),d([g({readOnly:!0})],u.prototype,"type",void 0),d([g()],u.prototype,"callbacks",void 0),d([g()],u.prototype,"enableMovement",void 0),d([g()],u.prototype,"enableRotation",void 0),d([g()],u.prototype,"enableScaling",void 0),d([g()],u.prototype,"graphics",void 0),d([g()],u.prototype,"highlightsEnabled",void 0),d([g()],u.prototype,"layer",void 0),d([g()],u.prototype,"preserveAspectRatio",void 0),d([g()],u.prototype,"showCenterGraphic",void 0),d([g({readOnly:!0})],u.prototype,"state",null),d([g()],u.prototype,"symbols",void 0),d([g({type:Q})],u.prototype,"tooltipOptions",void 0),d([g({constructOnly:!0})],u.prototype,"view",void 0),u=d([vt("esri.views.draw.support.Box")],u);const Ft=u;export{Ft as default}; +import{j as L,E as K,hn as X,L as v,ho as nt,x as S,aw as D,a6 as ct,z as lt,A as Q,cf as k,J as U,cg as V,v as pt,B as b,b as F,K as R,w as _t,e as d,y as g,S as ut,T as dt,P as gt,c as vt}from"./index-pCX-0tJH.js";import{i as x,s as O,a as mt,m as yt}from"./drawUtils-0wb2c6-q.js";import{l as ft,U as Gt}from"./GraphicMover-kaBR5sTE.js";import{d as bt}from"./settings-QjT8PN4S.js";import{i as xt,p as wt}from"./ExtentTooltipInfos-EukgtOIT.js";import{u as Z,m as z}from"./Tooltip-a9KqLK1p.js";import{r as St}from"./TranslateTooltipInfos-DywsDtXz.js";import"./featureUtils-aSzMyCi0.js";import"./GraphicManipulator-59Uc2I6c.js";import"./drapedUtils-F1ywqHD-.js";import"./euclideanLengthMeasurementUtils-Kj2RYqri.js";import"./measurementUtils-69EiqRp6.js";import"./quantityFormatUtils-oYgdvR_2.js";function B(t,i,e,s){const o=[];for(const a of t){const h=a.slice(0);o.push(h);const c=i*(a[0]-s.x)-e*(a[1]-s.y)+s.x,r=e*(a[0]-s.x)+i*(a[1]-s.y)+s.y;h[0]=c,h[1]=r}return o}function H(t,i,e){const{hasM:s,hasZ:o,spatialReference:a}=t,h=i*Math.PI/180,c=Math.cos(h),r=Math.sin(h);if("xmin"in t&&(e=e??t.center,t=new L({spatialReference:a,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]})),"paths"in t){e=e??t.extent.center;const l=[];for(const n of t.paths)l.push(B(n,c,r,e));return new K({hasM:s,hasZ:o,spatialReference:a,paths:l})}if("rings"in t){e=e??t.extent.center;const l=[];for(const n of t.rings){const p=X(n),m=B(n,c,r,e);X(m)!==p&&m.reverse(),l.push(m)}return new L({hasM:s,hasZ:o,spatialReference:a,rings:l})}if("x"in t){e=e??t;const l=new v({x:c*(t.x-e.x)-r*(t.y-e.y)+e.x,y:r*(t.x-e.x)+c*(t.y-e.y)+e.y,spatialReference:a});return t.z!=null&&(l.z=t.z),t.m!=null&&(l.m=t.m),l}return"points"in t?(e=e??t.extent.center,new nt({hasM:s,hasZ:o,points:B(t.points,c,r,e),spatialReference:a})):null}class kt{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.dx=s,this.dy=o,this.type="move-start"}}class Rt{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.dx=s,this.dy=o,this.type="move"}}class j{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.dx=s,this.dy=o,this.type="move-stop"}}class Mt{constructor(i,e,s){this.graphics=i,this.mover=e,this.angle=s,this.type="rotate-start"}}class It{constructor(i,e,s){this.graphics=i,this.mover=e,this.angle=s,this.type="rotate"}}class q{constructor(i,e,s){this.graphics=i,this.mover=e,this.angle=s,this.type="rotate-stop"}}class Ct{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.xScale=s,this.yScale=o,this.type="scale-start"}}class Ot{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.xScale=s,this.yScale=o,this.type="scale"}}class J{constructor(i,e,s,o){this.graphics=i,this.mover=e,this.xScale=s,this.yScale=o,this.type="scale-stop"}}const _=bt.transformGraphics,Ht={centerIndicator:new S({style:"cross",size:_.center.size,color:_.center.color}),fill:{default:new D({color:_.fill.color,outline:{color:_.fill.outlineColor,join:"round",width:1}}),active:new D({color:_.fill.stagedColor,outline:{color:_.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new S({style:"square",size:_.vertex.size,color:_.vertex.color,outline:{color:_.vertex.outlineColor,width:1}}),hover:new S({style:"square",size:_.vertex.hoverSize,color:_.vertex.hoverColor,outline:{color:_.vertex.hoverOutlineColor,width:1}})},rotator:{default:new S({style:"circle",size:_.vertex.size,color:_.vertex.color,outline:{color:_.vertex.outlineColor,width:1}}),hover:new S({style:"circle",size:_.vertex.hoverSize,color:_.vertex.hoverColor,outline:{color:_.vertex.hoverOutlineColor,width:1}})},rotatorLine:new ct({color:_.line.color,width:1})};let u=class extends lt.EventedAccessor{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._tooltip=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=Ht,this.tooltipOptions=new Q,this.view=null,this._getBounds=(()=>{const i=k();return(e,s)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const o of s){if(!o)continue;let a,h,c,r;if(o.type==="point")a=c=o.x,h=r=o.y;else if(o.type==="multipoint"){const l=U(o);[a,h,c,r]=V(i,[l])}else if(o.type==="extent")[a,h,c,r]=[o.xmin,o.ymin,o.xmax,o.ymax];else{const l=U(o);[a,h,c,r]=V(i,l)}e[0]=Math.min(a,e[0]),e[1]=Math.min(h,e[1]),e[2]=Math.max(c,e[2]),e[3]=Math.max(r,e[3])}return e}})()}initialize(){const t=this.view;this._highlightHelper=new ft({view:t}),this._tooltip=new Z({view:t}),this._setup(),this.addHandles([pt(()=>t==null?void 0:t.ready,()=>{const{layer:i,view:e}=this;ut(e,i)},{once:!0,initial:!0}),b(()=>this.preserveAspectRatio,()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))}),b(()=>t==null?void 0:t.scale,()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()}),b(()=>this.graphics,()=>this.refresh()),b(()=>this.layer,(i,e)=>{e&&this._resetGraphics(e),this.refresh()}),b(()=>this.highlightsEnabled,()=>{var i;(i=this._highlightHelper)==null||i.removeAll(),this._setUpHighlights()}),b(()=>this.tooltipOptions.enabled,i=>{this._tooltip=i?new Z({view:this.view}):F(this._tooltip)},dt),b(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),gt),this.on("move-start",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onMoveStart)==null?void 0:s.call(e,i)}),this.on("move",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onMove)==null?void 0:s.call(e,i)}),this.on("move-stop",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onMoveStop)==null?void 0:s.call(e,i)}),this.on("rotate-start",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onRotateStart)==null?void 0:s.call(e,i)}),this.on("rotate",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onRotate)==null?void 0:s.call(e,i)}),this.on("rotate-stop",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onRotateStop)==null?void 0:s.call(e,i)}),this.on("scale-start",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onScaleStart)==null?void 0:s.call(e,i)}),this.on("scale",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onScale)==null?void 0:s.call(e,i)}),this.on("scale-stop",i=>{var e,s;return(s=(e=this.callbacks)==null?void 0:e.onScaleStop)==null?void 0:s.call(e,i)})])}destroy(){this._reset(),this._tooltip=F(this._tooltip)}get state(){var e;const t=((e=this.view)==null?void 0:e.ready)??!1,i=this.graphics.length&&this.layer;return t&&i?"active":t?"ready":"disabled"}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,i){if(this._mover&&this.graphics.length){for(const e of this.graphics){const s=e.geometry,o=x(s,t,i,this.view);e.geometry=o}this.refresh(),this.emit("move-stop",new j(this.graphics,null,t,i))}}scale(t,i){if(this._mover&&this.graphics.length){for(const e of this.graphics){const s=e.geometry,o=O(s,t,i);e.geometry=o}this.refresh(),this.emit("scale-stop",new J(this.graphics,null,t,i))}}rotate(t,i){if(this._mover&&this.graphics.length){if(!i){const e=this._vertexGraphics[1].geometry.x,s=this._vertexGraphics[3].geometry.y;i=new v(e,s,this.view.spatialReference)}for(const e of this.graphics){const s=e.geometry,o=H(s,t,i);e.geometry=o}this.refresh(),this.emit("rotate-stop",new q(this.graphics,null,t))}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){this.state==="active"&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){var t;(t=this._highlightHelper)==null||t.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new Gt({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:i=>this._onGraphicClickCallback(i),onGraphicMoveStart:i=>this._onGraphicMoveStartCallback(i),onGraphicMove:i=>this._onGraphicMoveCallback(i),onGraphicMoveStop:i=>this._onGraphicMoveStopCallback(i),onGraphicPointerOver:i=>this._onGraphicPointerOverCallback(i),onGraphicPointerOut:i=>this._onGraphicPointerOutCallback(i)}})}_getStartInfo(t){const[i,e,s,o]=this._getBoxBounds(k()),a=Math.abs(s-i),h=Math.abs(o-e),c=(s+i)/2,r=(o+e)/2,{x:l,y:n}=t.geometry;return{width:a,height:h,centerX:c,centerY:r,startX:l,startY:n,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map(t=>this._getGraphicInfo(t))}_getGraphicInfo(t){const i=t.geometry,[e,s,o,a]=this._getBounds(k(),[i]);return{width:Math.abs(o-e),height:Math.abs(a-s),centerX:(o+e)/2,centerY:(a+s)/2,geometry:i}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:i,_xScale:e,_yScale:s,_backgroundGraphic:o,_vertexGraphics:a,_rotateHandleGraphic:h,symbols:c}=this,r=t.graphic;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=c.fill.active,this._startInfo=this._getStartInfo(r),this._updateTooltip(r,t.viewEvent),r===h?(this.view.cursor="grabbing",this.emit("rotate-start",new Mt(this.graphics,r,i))):a.includes(r)?(this._activeHandleGraphic=r,this.emit("scale-start",new Ct(this.graphics,r,e,s))):this.emit("move-start",new kt(this.graphics,r,t.dx,t.dy))}_onGraphicMoveCallback(t){const i=t.graphic;if(this._startInfo)if(this._vertexGraphics.includes(i))this._scaleGraphic(i),this._updateTooltip(i,t.viewEvent),this.emit("scale",new Ot(this.graphics,i,this._xScale,this._yScale));else if(i===this._rotateHandleGraphic)this._rotateGraphic(i),this._updateTooltip(i,t.viewEvent),this.emit("rotate",new It(this.graphics,i,this._angleOfRotation));else{const{dx:e,dy:s}=t;this._totalDx+=e,this._totalDy+=s,this._moveGraphic(i,e,s),this._updateTooltip(i,t.viewEvent),this.emit("move",new Rt(this.graphics,i,e,s))}}_onGraphicMoveStopCallback(t){const i=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:e,_totalDx:s,_totalDy:o,_xScale:a,_yScale:h,_vertexGraphics:c,_rotateHandleGraphic:r}=this;this.refresh(),i===r?(this.view.cursor="pointer",this.emit("rotate-stop",new q(this.graphics,i,e))):c.includes(i)?this.emit("scale-stop",new J(this.graphics,i,a,h)):this.emit("move-stop",new j(this.graphics,i,s,o))}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:i,_vertexGraphics:e,graphics:s,_rotateHandleGraphic:o,symbols:a,view:h}=this,c=t.graphic;if(this._hoveredGraphic=c,c===o)return o.symbol=a.rotator.hover,h.cursor="pointer",void this._updateTooltip(c);if(s.includes(c)||c===i)return void(h.cursor="move");if(!e.includes(c))return void(h.cursor="pointer");this._updateTooltip(c),t.graphic.symbol=a.handles.hover;const r=h.rotation;let l,n=t.index;switch(n<8&&(r>=0&&r<45?n%=8:n=r>=45&&r<90?(n+1)%8:r>=90&&r<135?(n+2)%8:r>=135&&r<180?(n+3)%8:r>=180&&r<225?(n+4)%8:r>=225&&r<270?(n+5)%8:r>=270&&r<315?(n+6)%8:(n+7)%8),n){case 0:case 4:l="nwse-resize";break;case 1:case 5:l="ns-resize";break;case 2:case 6:l="nesw-resize";break;case 3:case 7:l="ew-resize";break;default:l="pointer"}h.cursor=l}_onGraphicPointerOutCallback(t){const{_vertexGraphics:i,_rotateHandleGraphic:e,symbols:s,view:o}=this;this._hoveredGraphic=null,t.graphic===e?e.symbol=s.rotator.default:i.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),o.cursor="default",this._updateTooltip()}_scaleGraphic(t){var Y;const{_startInfo:i,_vertexGraphics:e,preserveAspectRatio:s,view:o}=this,{centerX:a,centerY:h,startX:c,startY:r}=i,{resolution:l,transform:n}=o.state,p=e.indexOf(t);p!==1&&p!==5||this._updateX(t,a),p!==3&&p!==7||this._updateY(t,h);const{x:m,y}=t.geometry,T=n[0]*m+n[2]*y+n[4],$=n[1]*m+n[3]*y+n[5],M=((Y=i.graphicInfos)==null?void 0:Y.map(w=>w.geometry))??[];if(s){const w=n[0]*a+n[2]*h+n[4],I=n[1]*a+n[3]*h+n[5],f=n[0]*c+n[2]*r+n[4],G=n[1]*c+n[3]*r+n[5];this._xScale=this._yScale=mt(w,I,f,G,T,$);for(const C of M){const E=M.indexOf(C);this.graphics[E].geometry=O(C,this._xScale,this._yScale,[a,h])}this._updateBackgroundGraphic()}else{const{width:w,height:I}=i;let f=m-c,G=r-y;if(p===1||p===5?f=0:p!==3&&p!==7||(G=0),f===0&&G===0)return;const C=w+(c>a?f:-1*f),E=I+(ry.geometry))??[];for(const y of p){const T=p.indexOf(y),$=H(y,this._angleOfRotation,l);this.graphics[T].geometry=$}this._backgroundGraphic.geometry=H(a,this._angleOfRotation,l),this._rotateHandleGraphic.geometry=H(h,this._angleOfRotation,l)}_moveGraphic(t,i,e){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=x(s,i,e,this.view);for(const o of this.graphics)o!==t&&(o.geometry=x(o.geometry,i,e,this.view))}else if(t===this._centerGraphic){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=x(s,i,e,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=x(s.geometry,i,e,this.view)}_setUpHighlights(){var t;this.highlightsEnabled&&this.graphics.length&&((t=this._highlightHelper)==null||t.add(this.graphics))}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new R(null,i.centerIndicator,t),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new R(null,i.fill.default,t),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new R(null,i.rotatorLine,t),this._rotateHandleGraphic=new R(null,i.rotator.default,t),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let e=0;e<8;e++)this._vertexGraphics.push(new R(null,i.handles.default,t));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){var i,e;const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:(i=this.symbols.fill.active)==null?void 0:i.clone().set("outline.color",t),default:(e=this.symbols.fill.default)==null?void 0:e.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const s of this._vertexGraphics)s.symbol=s===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach(t=>t.visible=!1)}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach((i,e)=>{const[s,o]=t[e];this._updateXY(i,s,o)})}_updateBackgroundGraphic(){const t=this._getCoordinates();this._backgroundGraphic.geometry=new L({rings:t,spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,i,e,s]=this._getBoxBounds(k()),o=(e+t)/2,a=(s+i)/2;this._centerGraphic.geometry=new v(o,a,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:i}=this._vertexGraphics[1].geometry,e=i+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new v(t,e,this.view.spatialReference)}_updateRotateLineGraphic(){var e;if(!this._vertexGraphics.length||!((e=this._rotateHandleGraphic)!=null&&e.geometry))return;const t=this._vertexGraphics[1].geometry,i=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new K({paths:[[t.x,t.y],[i.x,i.y]],spatialReference:this.view.spatialReference})}_updateXY(t,i,e){t.geometry=new v(i,e,this.view.spatialReference)}_updateX(t,i){const e=t.geometry.y;t.geometry=new v(i,e,this.view.spatialReference)}_updateY(t,i){const e=t.geometry.x;t.geometry=new v(e,i,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some(t=>(t==null?void 0:t.geometry)!=null&&t.geometry.type==="extent")}_getBoxBounds(t){const i=this.graphics.map(e=>e.geometry);return this._getBounds(t,i)}_getCoordinates(t){const[i,e,s,o]=this._getBoxBounds(k());if(t){const a=(i+s)/2,h=(o+e)/2;return[[i,o],[a,o],[s,o],[s,h],[s,e],[a,e],[i,e],[i,h]]}return[[i,o],[s,o],[s,e],[i,e]]}_updateTooltip(t,i){if(this._tooltip==null)return;if(!t)return void this._tooltip.clear();const{_backgroundGraphic:e,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:a}=this;t===a?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===e)&&this._updateMoveTooltip(i)}_updateRotateTooltip(){this._tooltip!=null&&(this._tooltip.info=new xt({tooltipOptions:this.tooltipOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{_tooltip:t,_xScale:i,_yScale:e,tooltipOptions:s,view:o}=this;if(t==null)return;const a=o.spatialReference,h=this._getCoordinates(),c=new v(h[0][0],h[0][1],a),r=new v(h[1][0],h[1][1],a),l=new v(h[2][0],h[2][1],a),n=z(c,r),p=z(r,l);if(n==null||p==null)return;const m=Math.abs(i),y=Math.abs(e);t.info=new wt({tooltipOptions:s,xScale:m,yScale:y,xSize:n,ySize:p})}_updateMoveTooltip(t){const{_tooltip:i,tooltipOptions:e,view:s}=this;if(i==null)return;const o=new St({tooltipOptions:e});if(t){const{x:a,y:h}=t.origin,c=s.toMap(t),r=s.toMap({x:a,y:h}),l=z(r,c);o.distance=l??_t}i.info=o}};d([g()],u.prototype,"_tooltip",void 0),d([g({readOnly:!0})],u.prototype,"type",void 0),d([g()],u.prototype,"callbacks",void 0),d([g()],u.prototype,"enableMovement",void 0),d([g()],u.prototype,"enableRotation",void 0),d([g()],u.prototype,"enableScaling",void 0),d([g()],u.prototype,"graphics",void 0),d([g()],u.prototype,"highlightsEnabled",void 0),d([g()],u.prototype,"layer",void 0),d([g()],u.prototype,"preserveAspectRatio",void 0),d([g()],u.prototype,"showCenterGraphic",void 0),d([g({readOnly:!0})],u.prototype,"state",null),d([g()],u.prototype,"symbols",void 0),d([g({type:Q})],u.prototype,"tooltipOptions",void 0),d([g({constructOnly:!0})],u.prototype,"view",void 0),u=d([vt("esri.views.draw.support.Box")],u);const Vt=u;export{Vt as default}; diff --git a/dist/assets/BuildingComponentSublayer-0DIX8n0s.js b/dist/assets/BuildingComponentSublayer-0DIX8n0s.js new file mode 100644 index 0000000..8bf6660 --- /dev/null +++ b/dist/assets/BuildingComponentSublayer-0DIX8n0s.js @@ -0,0 +1 @@ +import{a as m,e as t,y as r,dt as y,er as v,ij as u,c as h,ik as b,R as L,il as w,cQ as F,eL as I,im as O,io as S,av as j,ip as x,aL as T,fC as q,fD as $,fB as E,iq as Q,r as p,K as A,ir as D,is as P,it as R,iu as N,dO as U,d2 as _,hA as B,iv as C,iw as K,ix as M,iy as Z,dp as k,iz as V}from"./index-pCX-0tJH.js";import g from"./FeatureLayer-9tNCmEbA.js";let n=class extends m(b){constructor(e){super(e),this.title="",this.id=-1,this.modelName=null,this.isEmpty=null,this.legendEnabled=!0,this.visible=!0,this.opacity=1}readTitle(e,s){return typeof s.alias=="string"?s.alias:typeof s.name=="string"?s.name:""}readIdOnlyOnce(e){return this.id!==-1?this.id:typeof e=="number"?e:-1}};t([r({type:String,json:{origins:{"web-scene":{write:!0},"portal-item":{write:!0}}}})],n.prototype,"title",void 0),t([y("service","title",["alias","name"])],n.prototype,"readTitle",null),t([r()],n.prototype,"layer",void 0),t([r({type:v,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],n.prototype,"id",void 0),t([y("service","id")],n.prototype,"readIdOnlyOnce",null),t([r(u(String))],n.prototype,"modelName",void 0),t([r(u(Boolean))],n.prototype,"isEmpty",void 0),t([r({type:Boolean,nonNullable:!0})],n.prototype,"legendEnabled",void 0),t([r({type:Boolean,json:{name:"visibility",write:!0}})],n.prototype,"visible",void 0),t([r({type:Number,json:{write:!0}})],n.prototype,"opacity",void 0),n=t([h("esri.layers.buildingSublayers.BuildingSublayer")],n);const z=n,f="esri.layers.buildingSublayers.BuildingComponentSublayer",G=L.getLogger(f),c=V();let i=class extends w.LoadableMixin(F(z)){constructor(e){super(e),this.type="building-component",this.nodePages=null,this.materialDefinitions=[],this.textureSetDefinitions=[],this.geometryDefinitions=[],this.indexInfo=null,this.serviceUpdateTimeStamp=null,this.store=null,this.attributeStorageInfo=[],this.fields=[],this.associatedLayer=null,this.outFields=null,this.listMode="show",this.renderer=null,this.definitionExpression=null,this.popupEnabled=!0,this.popupTemplate=null,this.layerType="3d-object"}get parsedUrl(){var e,s;return this.layer?{path:`${(e=this.layer.parsedUrl)==null?void 0:e.path}/sublayers/${this.id}`,query:(s=this.layer.parsedUrl)==null?void 0:s.query}:{path:""}}get fieldsIndex(){return new I(this.fields)}readAssociatedLayer(e,s){const a=this.layer.associatedFeatureServiceItem,o=s.associatedLayerID;return a!=null&&typeof o=="number"?new g({portalItem:a,layerId:o}):null}get objectIdField(){if(this.fields!=null){for(const e of this.fields)if(e.type==="oid")return e.name}return null}get displayField(){return this.associatedLayer!=null?this.associatedLayer.displayField:void 0}get apiKey(){return this.layer.apiKey}get fullExtent(){return this.layer.fullExtent}get spatialReference(){return this.layer.spatialReference}get version(){return this.layer.version}get elevationInfo(){return this.layer.elevationInfo}get minScale(){return this.layer.minScale}get maxScale(){return this.layer.maxScale}get effectiveScaleRange(){return this.layer.effectiveScaleRange}get defaultPopupTemplate(){return this.createPopupTemplate()}load(e){const s=e!=null?e.signal:null,a=this._fetchService(s).then(()=>{this.indexInfo=O(this.parsedUrl.path,this.rootNode,this.nodePages,this.apiKey,G,s)});return this.addResolvingPromise(a),Promise.resolve(this)}createPopupTemplate(e){return S(this,e)}async _fetchService(e){const s=(await j(this.parsedUrl.path,{query:{f:"json",token:this.apiKey},responseType:"json",signal:e})).data;this.read(s,{origin:"service",url:this.parsedUrl})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,s){var o,l,d;const a=(l=(o=this.getFeatureType(s==null?void 0:s.feature))==null?void 0:o.domains)==null?void 0:l[e];return a&&a.type!=="inherited"?a:((d=this.getField(e))==null?void 0:d.domain)??null}getFeatureType(e){return e&&this.associatedLayer!=null?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer!=null?this.associatedLayer.types??[]:[]}get typeIdField(){return this.associatedLayer!=null?this.associatedLayer.typeIdField:null}get geometryType(){return this.layerType==="3d-object"?"mesh":"point"}get profile(){return this.layerType==="3d-object"?"mesh-pyramids":"points"}get capabilities(){const e=this.associatedLayer!=null&&this.associatedLayer.capabilities?this.associatedLayer.capabilities:x,{query:s,data:{supportsZ:a,supportsM:o,isVersioned:l}}=e;return{query:s,data:{supportsZ:a,supportsM:o,isVersioned:l}}}createQuery(){const e=new T;return this.geometryType!=="mesh"&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e}queryExtent(e,s){return this._getAssociatedLayerForQuery().then(a=>a.queryExtent(e||this.createQuery(),s))}queryFeatureCount(e,s){return this._getAssociatedLayerForQuery().then(a=>a.queryFeatureCount(e||this.createQuery(),s))}queryFeatures(e,s){return this._getAssociatedLayerForQuery().then(a=>a.queryFeatures(e||this.createQuery(),s)).then(a=>{if(a!=null&&a.features)for(const o of a.features)o.layer=this.layer,o.sourceLayer=this;return a})}queryObjectIds(e,s){return this._getAssociatedLayerForQuery().then(a=>a.queryObjectIds(e||this.createQuery(),s))}async queryCachedAttributes(e,s){const a=q(this.fieldsIndex,await $(this,E(this)));return Q(this.parsedUrl.path,this.attributeStorageInfo,e,s,a)}async queryCachedFeature(e,s){const a=await this.queryCachedAttributes(e,[s]);if(!a||a.length===0)throw new p("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const o=new A;return o.attributes=a[0],o.layer=this,o.sourceLayer=this,o}getFieldUsageInfo(e){return this.fieldsIndex.has(e)?{supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1}:{supportsLabelingInfo:!1,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:this.associatedLayer!=null}}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e!=null&&e.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),this.associatedLayer==null)throw new p("buildingscenelayer:query-not-available","BuildingSceneLayer component layer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new p("buildingscenelayer:query-not-available","BuildingSceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}};t([r({readOnly:!0})],i.prototype,"parsedUrl",null),t([r({type:D,readOnly:!0})],i.prototype,"nodePages",void 0),t([r({type:[P],readOnly:!0})],i.prototype,"materialDefinitions",void 0),t([r({type:[R],readOnly:!0})],i.prototype,"textureSetDefinitions",void 0),t([r({type:[N],readOnly:!0})],i.prototype,"geometryDefinitions",void 0),t([r({readOnly:!0})],i.prototype,"serviceUpdateTimeStamp",void 0),t([r({readOnly:!0})],i.prototype,"store",void 0),t([r({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],i.prototype,"rootNode",void 0),t([r({readOnly:!0})],i.prototype,"attributeStorageInfo",void 0),t([r(c.fields)],i.prototype,"fields",void 0),t([r({readOnly:!0})],i.prototype,"fieldsIndex",null),t([r({readOnly:!0,type:g})],i.prototype,"associatedLayer",void 0),t([y("service","associatedLayer",["associatedLayerID"])],i.prototype,"readAssociatedLayer",null),t([r(c.outFields)],i.prototype,"outFields",void 0),t([r({type:String,readOnly:!0})],i.prototype,"objectIdField",null),t([r({readOnly:!0,type:String,json:{read:!1}})],i.prototype,"displayField",null),t([r({readOnly:!0,type:String})],i.prototype,"apiKey",null),t([r({readOnly:!0,type:U})],i.prototype,"fullExtent",null),t([r({readOnly:!0,type:_})],i.prototype,"spatialReference",null),t([r({readOnly:!0})],i.prototype,"version",null),t([r({readOnly:!0,type:B})],i.prototype,"elevationInfo",null),t([r({readOnly:!0,type:Number})],i.prototype,"minScale",null),t([r({readOnly:!0,type:Number})],i.prototype,"maxScale",null),t([r({readOnly:!0,type:Number})],i.prototype,"effectiveScaleRange",null),t([r({type:["hide","show"],json:{write:!0}})],i.prototype,"listMode",void 0),t([r({types:C,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],i.prototype,"renderer",void 0),t([r({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],i.prototype,"definitionExpression",void 0),t([r(K)],i.prototype,"popupEnabled",void 0),t([r({type:M,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],i.prototype,"popupTemplate",void 0),t([r({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],i.prototype,"normalReferenceFrame",void 0),t([r({readOnly:!0,json:{read:!1}})],i.prototype,"defaultPopupTemplate",null),t([r()],i.prototype,"types",null),t([r()],i.prototype,"typeIdField",null),t([r({json:{write:!1}}),Z(new k({"3DObject":"3d-object",Point:"point"}))],i.prototype,"layerType",void 0),t([r()],i.prototype,"geometryType",null),t([r()],i.prototype,"profile",null),t([r({readOnly:!0,json:{read:!1}})],i.prototype,"capabilities",null),i=t([h(f)],i);const W=i;export{W as C,z as n}; diff --git a/dist/assets/BuildingComponentSublayer-j8wian8V.js b/dist/assets/BuildingComponentSublayer-j8wian8V.js deleted file mode 100644 index f7eebde..0000000 --- a/dist/assets/BuildingComponentSublayer-j8wian8V.js +++ /dev/null @@ -1 +0,0 @@ -import{m,e as t,y as r,dt as y,ey as v,ih as u,c as h,ii as b,Z as L,ij as w,cZ as F,eQ as I,ik as S,il as O,bW as j,im as x,ca as T,fH as q,fI as $,fG as E,io as Q,E as p,S as P,ip as A,iq as D,ir as N,is as R,dT as U,ar as _,hs as B,it as C,iu as Z,iv as M,iw as K,dp as k,ix as G}from"./index-J0iiHjMT.js";import g from"./FeatureLayer--S4epFk-.js";let n=class extends m(b){constructor(e){super(e),this.title="",this.id=-1,this.modelName=null,this.isEmpty=null,this.legendEnabled=!0,this.visible=!0,this.opacity=1}readTitle(e,s){return typeof s.alias=="string"?s.alias:typeof s.name=="string"?s.name:""}readIdOnlyOnce(e){return this.id!==-1?this.id:typeof e=="number"?e:-1}};t([r({type:String,json:{origins:{"web-scene":{write:!0},"portal-item":{write:!0}}}})],n.prototype,"title",void 0),t([y("service","title",["alias","name"])],n.prototype,"readTitle",null),t([r()],n.prototype,"layer",void 0),t([r({type:v,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],n.prototype,"id",void 0),t([y("service","id")],n.prototype,"readIdOnlyOnce",null),t([r(u(String))],n.prototype,"modelName",void 0),t([r(u(Boolean))],n.prototype,"isEmpty",void 0),t([r({type:Boolean,nonNullable:!0})],n.prototype,"legendEnabled",void 0),t([r({type:Boolean,json:{name:"visibility",write:!0}})],n.prototype,"visible",void 0),t([r({type:Number,json:{write:!0}})],n.prototype,"opacity",void 0),n=t([h("esri.layers.buildingSublayers.BuildingSublayer")],n);const V=n,f="esri.layers.buildingSublayers.BuildingComponentSublayer",H=L.getLogger(f),c=G();let i=class extends w.LoadableMixin(F(V)){constructor(e){super(e),this.type="building-component",this.nodePages=null,this.materialDefinitions=[],this.textureSetDefinitions=[],this.geometryDefinitions=[],this.indexInfo=null,this.serviceUpdateTimeStamp=null,this.store=null,this.attributeStorageInfo=[],this.fields=[],this.associatedLayer=null,this.outFields=null,this.listMode="show",this.renderer=null,this.definitionExpression=null,this.popupEnabled=!0,this.popupTemplate=null,this.layerType="3d-object"}get parsedUrl(){var e,s;return this.layer?{path:`${(e=this.layer.parsedUrl)==null?void 0:e.path}/sublayers/${this.id}`,query:(s=this.layer.parsedUrl)==null?void 0:s.query}:{path:""}}get fieldsIndex(){return new I(this.fields)}readAssociatedLayer(e,s){const a=this.layer.associatedFeatureServiceItem,o=s.associatedLayerID;return a!=null&&typeof o=="number"?new g({portalItem:a,layerId:o}):null}get objectIdField(){if(this.fields!=null){for(const e of this.fields)if(e.type==="oid")return e.name}return null}get displayField(){return this.associatedLayer!=null?this.associatedLayer.displayField:void 0}get apiKey(){return this.layer.apiKey}get fullExtent(){return this.layer.fullExtent}get spatialReference(){return this.layer.spatialReference}get version(){return this.layer.version}get elevationInfo(){return this.layer.elevationInfo}get minScale(){return this.layer.minScale}get maxScale(){return this.layer.maxScale}get effectiveScaleRange(){return this.layer.effectiveScaleRange}get defaultPopupTemplate(){return this.createPopupTemplate()}load(e){const s=e!=null?e.signal:null,a=this._fetchService(s).then(()=>{this.indexInfo=S(this.parsedUrl.path,this.rootNode,this.nodePages,this.apiKey,H,s)});return this.addResolvingPromise(a),Promise.resolve(this)}createPopupTemplate(e){return O(this,e)}async _fetchService(e){const s=(await j(this.parsedUrl.path,{query:{f:"json",token:this.apiKey},responseType:"json",signal:e})).data;this.read(s,{origin:"service",url:this.parsedUrl})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,s){var o,l,d;const a=(l=(o=this.getFeatureType(s==null?void 0:s.feature))==null?void 0:o.domains)==null?void 0:l[e];return a&&a.type!=="inherited"?a:((d=this.getField(e))==null?void 0:d.domain)??null}getFeatureType(e){return e&&this.associatedLayer!=null?this.associatedLayer.getFeatureType(e):null}get types(){return this.associatedLayer!=null?this.associatedLayer.types??[]:[]}get typeIdField(){return this.associatedLayer!=null?this.associatedLayer.typeIdField:null}get geometryType(){return this.layerType==="3d-object"?"mesh":"point"}get profile(){return this.layerType==="3d-object"?"mesh-pyramids":"points"}get capabilities(){const e=this.associatedLayer!=null&&this.associatedLayer.capabilities?this.associatedLayer.capabilities:x,{query:s,data:{supportsZ:a,supportsM:o,isVersioned:l}}=e;return{query:s,data:{supportsZ:a,supportsM:o,isVersioned:l}}}createQuery(){const e=new T;return this.geometryType!=="mesh"&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e}queryExtent(e,s){return this._getAssociatedLayerForQuery().then(a=>a.queryExtent(e||this.createQuery(),s))}queryFeatureCount(e,s){return this._getAssociatedLayerForQuery().then(a=>a.queryFeatureCount(e||this.createQuery(),s))}queryFeatures(e,s){return this._getAssociatedLayerForQuery().then(a=>a.queryFeatures(e||this.createQuery(),s)).then(a=>{if(a!=null&&a.features)for(const o of a.features)o.layer=this.layer,o.sourceLayer=this;return a})}queryObjectIds(e,s){return this._getAssociatedLayerForQuery().then(a=>a.queryObjectIds(e||this.createQuery(),s))}async queryCachedAttributes(e,s){const a=q(this.fieldsIndex,await $(this,E(this)));return Q(this.parsedUrl.path,this.attributeStorageInfo,e,s,a)}async queryCachedFeature(e,s){const a=await this.queryCachedAttributes(e,[s]);if(!a||a.length===0)throw new p("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const o=new P;return o.attributes=a[0],o.layer=this,o.sourceLayer=this,o}getFieldUsageInfo(e){return this.fieldsIndex.has(e)?{supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1}:{supportsLabelingInfo:!1,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:this.associatedLayer!=null}}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e!=null&&e.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),this.associatedLayer==null)throw new p("buildingscenelayer:query-not-available","BuildingSceneLayer component layer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new p("buildingscenelayer:query-not-available","BuildingSceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}};t([r({readOnly:!0})],i.prototype,"parsedUrl",null),t([r({type:A,readOnly:!0})],i.prototype,"nodePages",void 0),t([r({type:[D],readOnly:!0})],i.prototype,"materialDefinitions",void 0),t([r({type:[N],readOnly:!0})],i.prototype,"textureSetDefinitions",void 0),t([r({type:[R],readOnly:!0})],i.prototype,"geometryDefinitions",void 0),t([r({readOnly:!0})],i.prototype,"serviceUpdateTimeStamp",void 0),t([r({readOnly:!0})],i.prototype,"store",void 0),t([r({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],i.prototype,"rootNode",void 0),t([r({readOnly:!0})],i.prototype,"attributeStorageInfo",void 0),t([r(c.fields)],i.prototype,"fields",void 0),t([r({readOnly:!0})],i.prototype,"fieldsIndex",null),t([r({readOnly:!0,type:g})],i.prototype,"associatedLayer",void 0),t([y("service","associatedLayer",["associatedLayerID"])],i.prototype,"readAssociatedLayer",null),t([r(c.outFields)],i.prototype,"outFields",void 0),t([r({type:String,readOnly:!0})],i.prototype,"objectIdField",null),t([r({readOnly:!0,type:String,json:{read:!1}})],i.prototype,"displayField",null),t([r({readOnly:!0,type:String})],i.prototype,"apiKey",null),t([r({readOnly:!0,type:U})],i.prototype,"fullExtent",null),t([r({readOnly:!0,type:_})],i.prototype,"spatialReference",null),t([r({readOnly:!0})],i.prototype,"version",null),t([r({readOnly:!0,type:B})],i.prototype,"elevationInfo",null),t([r({readOnly:!0,type:Number})],i.prototype,"minScale",null),t([r({readOnly:!0,type:Number})],i.prototype,"maxScale",null),t([r({readOnly:!0,type:Number})],i.prototype,"effectiveScaleRange",null),t([r({type:["hide","show"],json:{write:!0}})],i.prototype,"listMode",void 0),t([r({types:C,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],i.prototype,"renderer",void 0),t([r({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],i.prototype,"definitionExpression",void 0),t([r(Z)],i.prototype,"popupEnabled",void 0),t([r({type:M,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],i.prototype,"popupTemplate",void 0),t([r({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],i.prototype,"normalReferenceFrame",void 0),t([r({readOnly:!0,json:{read:!1}})],i.prototype,"defaultPopupTemplate",null),t([r()],i.prototype,"types",null),t([r()],i.prototype,"typeIdField",null),t([r({json:{write:!1}}),K(new k({"3DObject":"3d-object",Point:"point"}))],i.prototype,"layerType",void 0),t([r()],i.prototype,"geometryType",null),t([r()],i.prototype,"profile",null),t([r({readOnly:!0,json:{read:!1}})],i.prototype,"capabilities",null),i=t([h(f)],i);const J=i;export{J as C,V as n}; diff --git a/dist/assets/BuildingGroupSublayer-xf_JzVTh.js b/dist/assets/BuildingGroupSublayer-UJvyv8qt.js similarity index 84% rename from dist/assets/BuildingGroupSublayer-xf_JzVTh.js rename to dist/assets/BuildingGroupSublayer-UJvyv8qt.js index 59061a2..63f8f7a 100644 --- a/dist/assets/BuildingGroupSublayer-xf_JzVTh.js +++ b/dist/assets/BuildingGroupSublayer-UJvyv8qt.js @@ -1 +1 @@ -import{e as i,y as l,c,V as p,dm as b,dn as g}from"./index-J0iiHjMT.js";import{n as h,C as f}from"./BuildingComponentSublayer-j8wian8V.js";var a;const y={type:p,readOnly:!0,json:{origins:{service:{read:{source:"sublayers",reader:d}}},read:!1}};function d(e,o,s){if(e&&Array.isArray(e))return new p(e.map(r=>{const u=m(r);if(u){const t=new u;return t.read(r,s),t}return s!=null&&s.messages&&r&&s.messages.push(new b("building-scene-layer:unsupported-sublayer-type","Building scene sublayer of type '"+(r.type||"unknown")+"' are not supported",{definition:r,context:s})),null}))}let n=a=class extends h{constructor(e){super(e),this.type="building-group",this.listMode="show",this.sublayers=null}loadAll(){return g(this,e=>a.forEachSublayer(this.sublayers,o=>{o.type!=="building-group"&&e(o)}))}};function m(e){return e.layerType==="group"?n:f}i([l({type:["hide","show","hide-children"],json:{write:!0}})],n.prototype,"listMode",void 0),i([l(y)],n.prototype,"sublayers",void 0),n=a=i([c("esri.layers.buildingSublayers.BuildingGroupSublayer")],n),function(e){function o(s,r){s.forEach(u=>{r(u),u.type==="building-group"&&o(u.sublayers,r)})}e.sublayersProperty=y,e.readSublayers=d,e.forEachSublayer=o}(n||(n={}));const v=n;export{v as d}; +import{e as i,y as l,c,V as p,dm as b,dn as g}from"./index-pCX-0tJH.js";import{n as h,C as f}from"./BuildingComponentSublayer-0DIX8n0s.js";var a;const y={type:p,readOnly:!0,json:{origins:{service:{read:{source:"sublayers",reader:d}}},read:!1}};function d(e,o,s){if(e&&Array.isArray(e))return new p(e.map(r=>{const u=m(r);if(u){const t=new u;return t.read(r,s),t}return s!=null&&s.messages&&r&&s.messages.push(new b("building-scene-layer:unsupported-sublayer-type","Building scene sublayer of type '"+(r.type||"unknown")+"' are not supported",{definition:r,context:s})),null}))}let n=a=class extends h{constructor(e){super(e),this.type="building-group",this.listMode="show",this.sublayers=null}loadAll(){return g(this,e=>a.forEachSublayer(this.sublayers,o=>{o.type!=="building-group"&&e(o)}))}};function m(e){return e.layerType==="group"?n:f}i([l({type:["hide","show","hide-children"],json:{write:!0}})],n.prototype,"listMode",void 0),i([l(y)],n.prototype,"sublayers",void 0),n=a=i([c("esri.layers.buildingSublayers.BuildingGroupSublayer")],n),function(e){function o(s,r){s.forEach(u=>{r(u),u.type==="building-group"&&o(u.sublayers,r)})}e.sublayersProperty=y,e.readSublayers=d,e.forEachSublayer=o}(n||(n={}));const v=n;export{v as d}; diff --git a/dist/assets/BuildingSceneLayer-Bnoa9yAy.js b/dist/assets/BuildingSceneLayer-Bnoa9yAy.js new file mode 100644 index 0000000..cd9aea8 --- /dev/null +++ b/dist/assets/BuildingSceneLayer-Bnoa9yAy.js @@ -0,0 +1 @@ +import{e as t,y as s,c as a,dr as u,ah as y,V as j,iy as G,qo as Y,pi as Z,il as ee,cQ as te,R as b,av as re,iR as se,ef as ie,dH as oe,dI as le,dJ as ae,dK as ne,eg as pe,fK as ye,r as q,h8 as de,dL as ue,ep as ce,iS as V,di as he,iT as K,iU as ge,iV as ve,dt as P,qp as me,dQ as fe,ij as be,iI as Se,aI as we,d2 as $e}from"./index-pCX-0tJH.js";import{C}from"./BuildingComponentSublayer-0DIX8n0s.js";import{d as c}from"./BuildingGroupSublayer-UJvyv8qt.js";import"./FeatureLayer-9tNCmEbA.js";import"./FeatureLayerBase-mvqC7cJs.js";import"./serviceCapabilitiesUtils-f-iBP4uh.js";import"./editsZScale-4-dTv58d.js";import"./CustomParametersMixin-7nmugR3Y.js";import"./FeatureEffectLayer-OK0TB5f6.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./FeatureReductionLayer-2X2_PJv9.js";import"./OrderedLayer-XNaJwl_G.js";import"./FeatureTemplate-vSzbyslg.js";import"./FeatureType-0WPvBvpQ.js";import"./versionUtils-idhrDltC.js";let S=class extends u{constructor(){super(...arguments),this.type=null}};t([s({type:String,readOnly:!0,json:{write:!0}})],S.prototype,"type",void 0),S=t([a("esri.layers.support.BuildingFilterAuthoringInfo")],S);const z=S;var T;let g=T=class extends u{constructor(){super(...arguments),this.filterType=null,this.filterValues=null}clone(){return new T({filterType:this.filterType,filterValues:y(this.filterValues)})}};t([s({type:String,json:{write:!0}})],g.prototype,"filterType",void 0),t([s({type:[String],json:{write:!0}})],g.prototype,"filterValues",void 0),g=T=t([a("esri.layers.support.BuildingFilterAuthoringInfoType")],g);const xe=g;var F;const Oe=j.ofType(xe);let w=F=class extends u{clone(){return new F({filterTypes:y(this.filterTypes)})}};t([s({type:Oe,json:{write:!0}})],w.prototype,"filterTypes",void 0),w=F=t([a("esri.layers.support.BuildingFilterAuthoringInfoBlock")],w);const je=w;var _;const Ie=j.ofType(je);let v=_=class extends z{constructor(){super(...arguments),this.type="checkbox"}clone(){return new _({filterBlocks:y(this.filterBlocks)})}};t([s({type:["checkbox"]})],v.prototype,"type",void 0),t([s({type:Ie,json:{write:!0}})],v.prototype,"filterBlocks",void 0),v=_=t([a("esri.layers.support.BuildingFilterAuthoringInfoCheckbox")],v);const J=v;let $=class extends u{};t([s({readOnly:!0,json:{read:!1}})],$.prototype,"type",void 0),$=t([a("esri.layers.support.BuildingFilterMode")],$);const I=$;var A;let x=A=class extends I{constructor(){super(...arguments),this.type="solid"}clone(){return new A}};t([s({type:["solid"],readOnly:!0,json:{write:!0}})],x.prototype,"type",void 0),x=A=t([a("esri.layers.support.BuildingFilterModeSolid")],x);const E=x;var L;let m=L=class extends I{constructor(){super(...arguments),this.type="wire-frame",this.edges=null}clone(){return new L({edges:y(this.edges)})}};t([G({wireFrame:"wire-frame"})],m.prototype,"type",void 0),t([s(Y)],m.prototype,"edges",void 0),m=L=t([a("esri.layers.support.BuildingFilterModeWireFrame")],m);const U=m;var k;let O=k=class extends I{constructor(){super(...arguments),this.type="x-ray"}clone(){return new k}};t([s({type:["x-ray"],readOnly:!0,json:{write:!0}})],O.prototype,"type",void 0),O=k=t([a("esri.layers.support.BuildingFilterModeXRay")],O);const H=O;var R;const Be={nonNullable:!0,types:{key:"type",base:I,typeMap:{solid:E,"wire-frame":U,"x-ray":H}},json:{read:e=>{switch(e==null?void 0:e.type){case"solid":return E.fromJSON(e);case"wireFrame":return U.fromJSON(e);case"x-ray":return H.fromJSON(e);default:return}},write:{enabled:!0,isRequired:!0}}};let h=R=class extends u{constructor(){super(...arguments),this.filterExpression=null,this.filterMode=new E,this.title=""}clone(){return new R({filterExpression:this.filterExpression,filterMode:y(this.filterMode),title:this.title})}};t([s({type:String,json:{write:{enabled:!0,isRequired:!0}}})],h.prototype,"filterExpression",void 0),t([s(Be)],h.prototype,"filterMode",void 0),t([s({type:String,json:{write:{enabled:!0,isRequired:!0}}})],h.prototype,"title",void 0),h=R=t([a("esri.layers.support.BuildingFilterBlock")],h);const Te=h;var M;const Fe=j.ofType(Te);let d=M=class extends u{constructor(){super(...arguments),this.description=null,this.filterBlocks=null,this.id=Z(),this.name=null}clone(){return new M({description:this.description,filterBlocks:y(this.filterBlocks),id:this.id,name:this.name,filterAuthoringInfo:y(this.filterAuthoringInfo)})}};t([s({type:String,json:{write:!0}})],d.prototype,"description",void 0),t([s({type:Fe,json:{write:{enabled:!0,isRequired:!0}}})],d.prototype,"filterBlocks",void 0),t([s({types:{key:"type",base:z,typeMap:{checkbox:J}},json:{read:e=>(e==null?void 0:e.type)==="checkbox"?J.fromJSON(e):null,write:!0}})],d.prototype,"filterAuthoringInfo",void 0),t([s({type:String,constructOnly:!0,json:{write:{enabled:!0,isRequired:!0}}})],d.prototype,"id",void 0),t([s({type:String,json:{write:{enabled:!0,isRequired:!0}}})],d.prototype,"name",void 0),d=M=t([a("esri.layers.support.BuildingFilter")],d);const _e=d;let p=class extends u{constructor(){super(...arguments),this.fieldName=null,this.modelName=null,this.label=null,this.min=null,this.max=null,this.mostFrequentValues=null,this.subLayerIds=null}};t([s({type:String})],p.prototype,"fieldName",void 0),t([s({type:String})],p.prototype,"modelName",void 0),t([s({type:String})],p.prototype,"label",void 0),t([s({type:Number})],p.prototype,"min",void 0),t([s({type:Number})],p.prototype,"max",void 0),t([s({json:{read:e=>Array.isArray(e)&&(e.every(r=>typeof r=="string")||e.every(r=>typeof r=="number"))?e.slice():null}})],p.prototype,"mostFrequentValues",void 0),t([s({type:[Number]})],p.prototype,"subLayerIds",void 0),p=t([a("esri.layers.support.BuildingFieldStatistics")],p);let f=class extends ee.LoadableMixin(te(u)){constructor(){super(...arguments),this.url=null}get fields(){return this.loaded||this.loadStatus==="loading"?this._get("fields"):(b.getLogger(this).error("building summary statistics are not loaded"),null)}load(e){const r=e!=null?e.signal:null;return this.addResolvingPromise(this._fetchService(r)),Promise.resolve(this)}async _fetchService(e){const r=(await re(this.url,{query:{f:"json"},responseType:"json",signal:e})).data;this.read(r,{origin:"service"})}};t([s({constructOnly:!0,type:String})],f.prototype,"url",void 0),t([s({readOnly:!0,type:[p],json:{read:{source:"summary"}}})],f.prototype,"fields",null),f=t([a("esri.layers.support.BuildingSummaryStatistics")],f);const W=f,X=j.ofType(_e),D=y(c.sublayersProperty);var Q;const B=(Q=D.json)==null?void 0:Q.origins;B&&(B["web-scene"]={type:[C],write:{enabled:!0,overridePolicy:()=>({enabled:!1})}},B["portal-item"]={type:[C],write:{enabled:!0,overridePolicy:()=>({enabled:!1})}});let i=class extends se(ie(oe(le(ae(ne(pe(we))))))){constructor(e){super(e),this.operationalLayerType="BuildingSceneLayer",this.allSublayers=new ye({getCollections:()=>[this.sublayers],getChildrenFunction:r=>r.type==="building-group"?r.sublayers:null}),this.sublayers=null,this._sublayerOverrides=null,this.filters=new X,this.activeFilterId=null,this.summaryStatistics=null,this.outFields=null,this.legendEnabled=!0,this.type="building-scene"}normalizeCtorArgs(e){return typeof e=="string"?{url:e}:e??{}}destroy(){this.allSublayers.destroy()}readSublayers(e,r,o){const l=c.readSublayers(e,r,o);return c.forEachSublayer(l,n=>n.layer=this),this._sublayerOverrides&&(this.applySublayerOverrides(l,this._sublayerOverrides),this._sublayerOverrides=null),l}applySublayerOverrides(e,{overrides:r,context:o}){c.forEachSublayer(e,l=>l.read(r.get(l.id),o))}readSublayerOverrides(e,r){var l;const o=new Map;for(const n of e)n!=null&&typeof n=="object"&&typeof n.id=="number"?o.set(n.id,n):(l=r.messages)==null||l.push(new q("building-scene-layer:invalid-sublayer-override","Invalid value for sublayer override. Not an object or no id specified.",{value:n}));return{overrides:o,context:r}}writeSublayerOverrides(e,r,o){const l=[];c.forEachSublayer(this.sublayers,n=>{const N=n.write({},o);Object.keys(N).length>1&&l.push(N)}),l.length>0&&(r.sublayers=l)}writeUnappliedOverrides(e,r){r.sublayers=[],e.overrides.forEach(o=>{r.sublayers.push(y(o))})}write(e,r){return e=super.write(e,r),!r||r.origin!=="web-scene"&&r.origin!=="portal-item"||(this.sublayers?this.writeSublayerOverrides(this.sublayers,e,r):this._sublayerOverrides&&this.writeUnappliedOverrides(this._sublayerOverrides,e)),e}read(e,r){if(super.read(e,r),r&&(r.origin==="web-scene"||r.origin==="portal-item")&&e!=null&&Array.isArray(e.sublayers)){const o=this.readSublayerOverrides(e.sublayers,r);this.sublayers?this.applySublayerOverrides(this.sublayers,o):this._sublayerOverrides=o}}readSummaryStatistics(e,r){var o;if(typeof r.statisticsHRef=="string"){const l=de((o=this.parsedUrl)==null?void 0:o.path,r.statisticsHRef);return new W({url:l})}return null}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}load(e){const r=e!=null?e.signal:null,o=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(ue).then(()=>this._fetchService(r)).then(()=>this._fetchAssociatedFeatureService(r));return this.addResolvingPromise(o),Promise.resolve(this)}loadAll(){return ce(this,e=>{c.forEachSublayer(this.sublayers,r=>{r.type!=="building-group"&&e(r)}),this.summaryStatistics&&e(this.summaryStatistics)})}async saveAs(e,r){return this._debouncedSaveOperations(V.SAVE_AS,{...r,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"building-scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"building-scene"};return this._debouncedSaveOperations(V.SAVE,e)}validateLayer(e){if(!e.layerType||e.layerType!=="Building")throw new q("buildingscenelayer:layer-type-not-supported","BuildingSceneLayer does not support this layer type",{layerType:e.layerType})}_getTypeKeywords(){return["Building"]}async _fetchAssociatedFeatureService(e){try{const{portalItem:r}=await he(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,apiKey:this.apiKey,signal:e});this.associatedFeatureServiceItem=r}catch(r){b.getLogger(this).warn("Associated feature service item could not be loaded",r)}}_validateElevationInfo(){const e=this.elevationInfo,r="Building scene layers";K(b.getLogger(this),ge(r,"absolute-height",e)),K(b.getLogger(this),ve(r,e))}};t([s({type:["BuildingSceneLayer"]})],i.prototype,"operationalLayerType",void 0),t([s({readOnly:!0})],i.prototype,"allSublayers",void 0),t([s(D)],i.prototype,"sublayers",void 0),t([P("service","sublayers")],i.prototype,"readSublayers",null),t([s({type:X,nonNullable:!0,json:{write:!0}})],i.prototype,"filters",void 0),t([s({type:String,json:{write:!0}})],i.prototype,"activeFilterId",void 0),t([s({readOnly:!0,type:W})],i.prototype,"summaryStatistics",void 0),t([P("summaryStatistics",["statisticsHRef"])],i.prototype,"readSummaryStatistics",null),t([s({type:[String],json:{read:!1}})],i.prototype,"outFields",void 0),t([s(me)],i.prototype,"fullExtent",void 0),t([s(fe)],i.prototype,"legendEnabled",void 0),t([s({type:["show","hide","hide-children"]})],i.prototype,"listMode",void 0),t([s(be($e))],i.prototype,"spatialReference",void 0),t([s(Se)],i.prototype,"elevationInfo",null),t([s({json:{read:!1},readOnly:!0})],i.prototype,"type",void 0),t([s()],i.prototype,"associatedFeatureServiceItem",void 0),i=t([a("esri.layers.BuildingSceneLayer")],i);const ze=i;export{ze as default}; diff --git a/dist/assets/BuildingSceneLayer-YaRBOuhA.js b/dist/assets/BuildingSceneLayer-YaRBOuhA.js deleted file mode 100644 index ad1a230..0000000 --- a/dist/assets/BuildingSceneLayer-YaRBOuhA.js +++ /dev/null @@ -1 +0,0 @@ -import{e as t,y as s,c as a,dr as u,bI as y,V as j,iw as D,qb as G,p5 as Y,ij as ee,cZ as te,Z as b,bW as re,iO as se,em as ie,dM as oe,dN as le,dO as ae,dP as ne,en as pe,fP as ye,E as P,h6 as de,dQ as ue,ew as ce,iP as q,di as he,iQ as V,iR as ge,iS as ve,dt as K,qc as me,dV as fe,ih as be,iH as Se,c7 as we,ar as $e}from"./index-J0iiHjMT.js";import{C}from"./BuildingComponentSublayer-j8wian8V.js";import{d as c}from"./BuildingGroupSublayer-xf_JzVTh.js";import"./FeatureLayer--S4epFk-.js";import"./FeatureLayerBase-jpFp8gE3.js";import"./serviceCapabilitiesUtils-26KpT1VN.js";import"./editsZScale-Wgw9kbYG.js";import"./queryZScale-IaMm02_2.js";import"./FeatureSet-d4S1oKME.js";import"./CustomParametersMixin-Y1bOcayO.js";import"./FeatureEffectLayer-oBa8pIG5.js";import"./FeatureEffect-5bEV-xG1.js";import"./FeatureReductionLayer-RlitE1N6.js";import"./OrderedLayer-M7k5gLgx.js";import"./FeatureTemplate-kUgbbA00.js";import"./FeatureType-MpRe7WJj.js";import"./versionUtils-4v9zIDlv.js";import"./TopFeaturesQuery-E6D2tV-x.js";let S=class extends u{constructor(){super(...arguments),this.type=null}};t([s({type:String,readOnly:!0,json:{write:!0}})],S.prototype,"type",void 0),S=t([a("esri.layers.support.BuildingFilterAuthoringInfo")],S);const W=S;var T;let g=T=class extends u{constructor(){super(...arguments),this.filterType=null,this.filterValues=null}clone(){return new T({filterType:this.filterType,filterValues:y(this.filterValues)})}};t([s({type:String,json:{write:!0}})],g.prototype,"filterType",void 0),t([s({type:[String],json:{write:!0}})],g.prototype,"filterValues",void 0),g=T=t([a("esri.layers.support.BuildingFilterAuthoringInfoType")],g);const Oe=g;var F;const xe=j.ofType(Oe);let w=F=class extends u{clone(){return new F({filterTypes:y(this.filterTypes)})}};t([s({type:xe,json:{write:!0}})],w.prototype,"filterTypes",void 0),w=F=t([a("esri.layers.support.BuildingFilterAuthoringInfoBlock")],w);const je=w;var _;const Be=j.ofType(je);let v=_=class extends W{constructor(){super(...arguments),this.type="checkbox"}clone(){return new _({filterBlocks:y(this.filterBlocks)})}};t([s({type:["checkbox"]})],v.prototype,"type",void 0),t([s({type:Be,json:{write:!0}})],v.prototype,"filterBlocks",void 0),v=_=t([a("esri.layers.support.BuildingFilterAuthoringInfoCheckbox")],v);const H=v;let $=class extends u{};t([s({readOnly:!0,json:{read:!1}})],$.prototype,"type",void 0),$=t([a("esri.layers.support.BuildingFilterMode")],$);const B=$;var A;let O=A=class extends B{constructor(){super(...arguments),this.type="solid"}clone(){return new A}};t([s({type:["solid"],readOnly:!0,json:{write:!0}})],O.prototype,"type",void 0),O=A=t([a("esri.layers.support.BuildingFilterModeSolid")],O);const E=O;var k;let m=k=class extends B{constructor(){super(...arguments),this.type="wire-frame",this.edges=null}clone(){return new k({edges:y(this.edges)})}};t([D({wireFrame:"wire-frame"})],m.prototype,"type",void 0),t([s(G)],m.prototype,"edges",void 0),m=k=t([a("esri.layers.support.BuildingFilterModeWireFrame")],m);const J=m;var L;let x=L=class extends B{constructor(){super(...arguments),this.type="x-ray"}clone(){return new L}};t([s({type:["x-ray"],readOnly:!0,json:{write:!0}})],x.prototype,"type",void 0),x=L=t([a("esri.layers.support.BuildingFilterModeXRay")],x);const U=x;var M;const Ie={nonNullable:!0,types:{key:"type",base:B,typeMap:{solid:E,"wire-frame":J,"x-ray":U}},json:{read:e=>{switch(e==null?void 0:e.type){case"solid":return E.fromJSON(e);case"wireFrame":return J.fromJSON(e);case"x-ray":return U.fromJSON(e);default:return}},write:{enabled:!0,isRequired:!0}}};let h=M=class extends u{constructor(){super(...arguments),this.filterExpression=null,this.filterMode=new E,this.title=""}clone(){return new M({filterExpression:this.filterExpression,filterMode:y(this.filterMode),title:this.title})}};t([s({type:String,json:{write:{enabled:!0,isRequired:!0}}})],h.prototype,"filterExpression",void 0),t([s(Ie)],h.prototype,"filterMode",void 0),t([s({type:String,json:{write:{enabled:!0,isRequired:!0}}})],h.prototype,"title",void 0),h=M=t([a("esri.layers.support.BuildingFilterBlock")],h);const Te=h;var N;const Fe=j.ofType(Te);let d=N=class extends u{constructor(){super(...arguments),this.description=null,this.filterBlocks=null,this.id=Y(),this.name=null}clone(){return new N({description:this.description,filterBlocks:y(this.filterBlocks),id:this.id,name:this.name,filterAuthoringInfo:y(this.filterAuthoringInfo)})}};t([s({type:String,json:{write:!0}})],d.prototype,"description",void 0),t([s({type:Fe,json:{write:{enabled:!0,isRequired:!0}}})],d.prototype,"filterBlocks",void 0),t([s({types:{key:"type",base:W,typeMap:{checkbox:H}},json:{read:e=>(e==null?void 0:e.type)==="checkbox"?H.fromJSON(e):null,write:!0}})],d.prototype,"filterAuthoringInfo",void 0),t([s({type:String,constructOnly:!0,json:{write:{enabled:!0,isRequired:!0}}})],d.prototype,"id",void 0),t([s({type:String,json:{write:{enabled:!0,isRequired:!0}}})],d.prototype,"name",void 0),d=N=t([a("esri.layers.support.BuildingFilter")],d);const _e=d;let p=class extends u{constructor(){super(...arguments),this.fieldName=null,this.modelName=null,this.label=null,this.min=null,this.max=null,this.mostFrequentValues=null,this.subLayerIds=null}};t([s({type:String})],p.prototype,"fieldName",void 0),t([s({type:String})],p.prototype,"modelName",void 0),t([s({type:String})],p.prototype,"label",void 0),t([s({type:Number})],p.prototype,"min",void 0),t([s({type:Number})],p.prototype,"max",void 0),t([s({json:{read:e=>Array.isArray(e)&&(e.every(r=>typeof r=="string")||e.every(r=>typeof r=="number"))?e.slice():null}})],p.prototype,"mostFrequentValues",void 0),t([s({type:[Number]})],p.prototype,"subLayerIds",void 0),p=t([a("esri.layers.support.BuildingFieldStatistics")],p);let f=class extends ee.LoadableMixin(te(u)){constructor(){super(...arguments),this.url=null}get fields(){return this.loaded||this.loadStatus==="loading"?this._get("fields"):(b.getLogger(this).error("building summary statistics are not loaded"),null)}load(e){const r=e!=null?e.signal:null;return this.addResolvingPromise(this._fetchService(r)),Promise.resolve(this)}async _fetchService(e){const r=(await re(this.url,{query:{f:"json"},responseType:"json",signal:e})).data;this.read(r,{origin:"service"})}};t([s({constructOnly:!0,type:String})],f.prototype,"url",void 0),t([s({readOnly:!0,type:[p],json:{read:{source:"summary"}}})],f.prototype,"fields",null),f=t([a("esri.layers.support.BuildingSummaryStatistics")],f);const Z=f,z=j.ofType(_e),X=y(c.sublayersProperty);var Q;const I=(Q=X.json)==null?void 0:Q.origins;I&&(I["web-scene"]={type:[C],write:{enabled:!0,overridePolicy:()=>({enabled:!1})}},I["portal-item"]={type:[C],write:{enabled:!0,overridePolicy:()=>({enabled:!1})}});let i=class extends se(ie(oe(le(ae(ne(pe(we))))))){constructor(e){super(e),this.operationalLayerType="BuildingSceneLayer",this.allSublayers=new ye({getCollections:()=>[this.sublayers],getChildrenFunction:r=>r.type==="building-group"?r.sublayers:null}),this.sublayers=null,this._sublayerOverrides=null,this.filters=new z,this.activeFilterId=null,this.summaryStatistics=null,this.outFields=null,this.legendEnabled=!0,this.type="building-scene"}normalizeCtorArgs(e){return typeof e=="string"?{url:e}:e??{}}destroy(){this.allSublayers.destroy()}readSublayers(e,r,o){const l=c.readSublayers(e,r,o);return c.forEachSublayer(l,n=>n.layer=this),this._sublayerOverrides&&(this.applySublayerOverrides(l,this._sublayerOverrides),this._sublayerOverrides=null),l}applySublayerOverrides(e,{overrides:r,context:o}){c.forEachSublayer(e,l=>l.read(r.get(l.id),o))}readSublayerOverrides(e,r){var l;const o=new Map;for(const n of e)n!=null&&typeof n=="object"&&typeof n.id=="number"?o.set(n.id,n):(l=r.messages)==null||l.push(new P("building-scene-layer:invalid-sublayer-override","Invalid value for sublayer override. Not an object or no id specified.",{value:n}));return{overrides:o,context:r}}writeSublayerOverrides(e,r,o){const l=[];c.forEachSublayer(this.sublayers,n=>{const R=n.write({},o);Object.keys(R).length>1&&l.push(R)}),l.length>0&&(r.sublayers=l)}writeUnappliedOverrides(e,r){r.sublayers=[],e.overrides.forEach(o=>{r.sublayers.push(y(o))})}write(e,r){return e=super.write(e,r),!r||r.origin!=="web-scene"&&r.origin!=="portal-item"||(this.sublayers?this.writeSublayerOverrides(this.sublayers,e,r):this._sublayerOverrides&&this.writeUnappliedOverrides(this._sublayerOverrides,e)),e}read(e,r){if(super.read(e,r),r&&(r.origin==="web-scene"||r.origin==="portal-item")&&e!=null&&Array.isArray(e.sublayers)){const o=this.readSublayerOverrides(e.sublayers,r);this.sublayers?this.applySublayerOverrides(this.sublayers,o):this._sublayerOverrides=o}}readSummaryStatistics(e,r){var o;if(typeof r.statisticsHRef=="string"){const l=de((o=this.parsedUrl)==null?void 0:o.path,r.statisticsHRef);return new Z({url:l})}return null}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}load(e){const r=e!=null?e.signal:null,o=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(ue).then(()=>this._fetchService(r)).then(()=>this._fetchAssociatedFeatureService(r));return this.addResolvingPromise(o),Promise.resolve(this)}loadAll(){return ce(this,e=>{c.forEachSublayer(this.sublayers,r=>{r.type!=="building-group"&&e(r)}),this.summaryStatistics&&e(this.summaryStatistics)})}async saveAs(e,r){return this._debouncedSaveOperations(q.SAVE_AS,{...r,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"building-scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"building-scene"};return this._debouncedSaveOperations(q.SAVE,e)}validateLayer(e){if(!e.layerType||e.layerType!=="Building")throw new P("buildingscenelayer:layer-type-not-supported","BuildingSceneLayer does not support this layer type",{layerType:e.layerType})}_getTypeKeywords(){return["Building"]}async _fetchAssociatedFeatureService(e){try{const{portalItem:r}=await he(`${this.url}/layers/${this.layerId}`,{sceneLayerItem:this.portalItem,apiKey:this.apiKey,signal:e});this.associatedFeatureServiceItem=r}catch(r){b.getLogger(this).warn("Associated feature service item could not be loaded",r)}}_validateElevationInfo(){const e=this.elevationInfo,r="Building scene layers";V(b.getLogger(this),ge(r,"absolute-height",e)),V(b.getLogger(this),ve(r,e))}};t([s({type:["BuildingSceneLayer"]})],i.prototype,"operationalLayerType",void 0),t([s({readOnly:!0})],i.prototype,"allSublayers",void 0),t([s(X)],i.prototype,"sublayers",void 0),t([K("service","sublayers")],i.prototype,"readSublayers",null),t([s({type:z,nonNullable:!0,json:{write:!0}})],i.prototype,"filters",void 0),t([s({type:String,json:{write:!0}})],i.prototype,"activeFilterId",void 0),t([s({readOnly:!0,type:Z})],i.prototype,"summaryStatistics",void 0),t([K("summaryStatistics",["statisticsHRef"])],i.prototype,"readSummaryStatistics",null),t([s({type:[String],json:{read:!1}})],i.prototype,"outFields",void 0),t([s(me)],i.prototype,"fullExtent",void 0),t([s(fe)],i.prototype,"legendEnabled",void 0),t([s({type:["show","hide","hide-children"]})],i.prototype,"listMode",void 0),t([s(be($e))],i.prototype,"spatialReference",void 0),t([s(Se)],i.prototype,"elevationInfo",null),t([s({json:{read:!1},readOnly:!0})],i.prototype,"type",void 0),t([s()],i.prototype,"associatedFeatureServiceItem",void 0),i=t([a("esri.layers.BuildingSceneLayer")],i);const Xe=i;export{Xe as default}; diff --git a/dist/assets/BuildingSceneLayerView3D-9E-CA71T.js b/dist/assets/BuildingSceneLayerView3D-9E-CA71T.js new file mode 100644 index 0000000..812a0b8 --- /dev/null +++ b/dist/assets/BuildingSceneLayerView3D-9E-CA71T.js @@ -0,0 +1,3 @@ +import{cQ as Q,a as P,z as A,e as n,y as a,c as _,op as O,oq as B,i3 as G,g as R,fM as N,P as F,R as y,k0 as U,nW as m,fC as E,K as b,fD as W,fB as v,fE as T,r as x,aL as V,bn as k,fP as H,dx as j,V as S,or as z,I as D,B as $,T as I,ac as X,os as Y,gE as K,ag as J,fq as Z,fd as ee}from"./index-pCX-0tJH.js";import"./BuildingGroupSublayer-UJvyv8qt.js";import{x as te}from"./WhereClause-FOYoIAAW.js";import"./BuildingComponentSublayer-0DIX8n0s.js";import{E as re,c as ie,a as se}from"./I3SMeshView3D-frxYFPRW.js";import{L as C,d as le,l as ne,o as ae}from"./I3SQueryFeatureStore-LSdoLFw0.js";import{t as oe}from"./DefinitionExpressionSceneLayerView-Z1V4X6Kq.js";import{n as ue}from"./LayerView3D-57OghbRh.js";import{u as de}from"./LayerView-ixwLVnzr.js";import"./TimeOnly-gkehHHJx.js";import"./FeatureLayer-9tNCmEbA.js";import"./FeatureLayerBase-mvqC7cJs.js";import"./serviceCapabilitiesUtils-f-iBP4uh.js";import"./editsZScale-4-dTv58d.js";import"./CustomParametersMixin-7nmugR3Y.js";import"./FeatureEffectLayer-OK0TB5f6.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./FeatureReductionLayer-2X2_PJv9.js";import"./OrderedLayer-XNaJwl_G.js";import"./FeatureTemplate-vSzbyslg.js";import"./FeatureType-0WPvBvpQ.js";import"./versionUtils-idhrDltC.js";import"./I3SOverrides-XXafrk1K.js";import"./I3SNode-A9aOJfXV.js";import"./ReactiveSet-_4-UpKXZ.js";import"./meshFeatureSet-42GYfSGc.js";import"./External-Pb5poJ0S.js";import"./FeatureLayerView3D-vzwVkoh-.js";import"./FeatureLayerViewBase3D-W0Qwl4g_.js";import"./HeatmapDensity.glsl-de3m0xZZ.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./queryForSymbologySnapping-MXWRIdj-.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./QueryEngine-uvDs-vBe.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./FeatureStore-PXMUgn0j.js";import"./BoundsStore-_-dPK5c-.js";import"./projectExtentUtils-Q4rXasWA.js";import"./EventedSet-TJfupI82.js";import"./RefreshableLayerView-DVYs7L04.js";import"./SceneModification-E4lNPbBQ.js";import"./SceneLayerWorker-fjNBmTGi.js";const L=(e,t)=>{let r=class extends Q(P(A.EventedMixin(e))){constructor(i){super(i),this.sublayer=null,this.parent=null,this.view=null}initialize(){}get suspended(){return!this.canResume()}get updating(){return!this.suspended&&this.isUpdating()}get visible(){var i;return!!((i=this.sublayer)!=null&&i.visible)}set visible(i){this._overrideIfSome("visible",i)}get fullOpacity(){var s,l;const i=u=>u??1;return i((s=this.sublayer)==null?void 0:s.opacity)*i((l=this.parent)==null?void 0:l.fullOpacity)}canResume(){var i,s;return!((i=this.parent)!=null&&i.suspended)&&((s=this.view)==null?void 0:s.ready)&&this.visible||!1}isUpdating(){return!1}};return n([a()],r.prototype,"sublayer",void 0),n([a()],r.prototype,"parent",void 0),n([a({readOnly:!0})],r.prototype,"suspended",null),n([a({type:Boolean,readOnly:!0})],r.prototype,"updating",null),n([a()],r.prototype,"view",void 0),n([a()],r.prototype,"visible",null),n([a()],r.prototype,"fullOpacity",null),r=n([_("esri.views.3d.layers.BuildingSublayerView3D")],r),r};var p;(function(e){e[e.Solid=0]="Solid",e[e.WireFrame=1]="WireFrame",e[e.XRay=2]="XRay"})(p||(p={}));const q=.15,pe=.5*q;function he(e){switch(e.filterMode.type){case"solid":return{mode:p.Solid};case"wire-frame":return{mode:p.WireFrame,edgeMaterial:O(e.filterMode.edges,{})};case"x-ray":return{mode:p.XRay}}}function M(e,t){if(t==null)return e.color[3]=0,e.edgeMaterial=null,void(e.pickable=!1);switch(t.mode){case p.Solid:return;case p.WireFrame:return e.color[3]=0,e.edgeMaterial=t.edgeMaterial,void(e.pickable=!1);case p.XRay:return e.color[0]=1,e.color[1]=1,e.color[2]=1,e.color[3]*=q,e.colorMixMode=B.Replace,e.castShadows=!1,e.pickable=!1,void(e.edgeMaterial=ye(e.edgeMaterial))}}function ye(e){return e==null?null:(g.lastMaterial!==e&&(g.cachedMaterial=ce(e),g.lastMaterial=e),g.cachedMaterial)}function ce(e){const t=G(e.color);return t[3]*=pe,{...e,color:t}}const g={cachedMaterial:null,lastMaterial:null};class f extends R{constructor(){super(...arguments),this.sublayer=null}get updating(){return!1}get suspended(){return!1}get availableFields(){return[]}get filter(){return null}set filter(t){throw new Error("Not implemented")}queryFeatures(t,r){throw new Error("Not implemented")}queryObjectIds(t,r){throw new Error("Not implemented")}queryFeatureCount(t,r){throw new Error("Not implemented")}createQuery(){throw new Error("Not implemented")}queryExtent(t,r){throw new Error("Not implemented")}highlight(t){throw new Error("Not implemented")}}n([a()],f.prototype,"sublayer",void 0),n([a()],f.prototype,"availableFields",null),n([a()],f.prototype,"filter",null);let o=class extends oe(re(L(f))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!1,this.requiredFields=[],this.progressiveLoadFactor=1,this._queryEngine=null}get i3slayer(){return this.sublayer}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}get layerId(){return this.sublayer.layer.id}get sublayerId(){return this.sublayer.id}get layerPopupEnabledAndHasTemplate(){var e,t;return this.sublayer.popupEnabled&&N(this.sublayer,(t=(e=this.layerView)==null?void 0:e.view.popup)==null?void 0:t.defaultPopupTemplateEnabled)}initialize(){this._updatingHandles.add(()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields],()=>this._updateRequiredFields()),this._updatingHandles.add(()=>this.sublayer.renderer,t=>this._rendererChange(t),F);const e=()=>this._filterChange();this._updatingHandles.add(()=>this.parsedDefinitionExpression,e),this._updatingHandles.add(()=>this._filter!=null?this._filter.sortedObjectIds:null,e),this._updatingHandles.add(()=>this._filter!=null?this._filter.parsedWhereClause:null,e),this._updatingHandles.add(()=>[this._filter!=null?this._filter.parsedGeometry:null,this.filter!=null?this.filter.spatialRelationship:null],()=>this._geometryFilterChange()),this._updatingHandles.add(()=>this.parsedFilterExpressions,()=>this._updateSymbologyOverride(),F),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.object.lodFactor}get parsedFilterExpressions(){return this.sublayer.modelName!=="Overview"&&this.layerView?this.layerView.filterExpressions.map(([e,t])=>{let r;try{r=te.create(e,this.sublayer.fieldsIndex)}catch(l){return y.getLogger(this).error("Failed to parse filterExpression: "+l),null}if(!r.isStandardized)return y.getLogger(this).error("filterExpression is using non standard function"),null;const i=[],s=r.fieldNames;return U(s,this.sublayer.fields,{missingFields:i}),i.length>0?(y.getLogger(this).error(`filterExpression references unknown fields: ${i.join(", ")}`),null):[r,t]}).filter(e=>e!=null):[]}get filter(){return this._filter!=null?this._filter.viewFilter:null}set filter(e){e!=null&&C.checkSupport(e)?this._filter!=null?this._filter.viewFilter=e:this._filter=new C({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:t=>this._loadAsyncModule(t),addSqlFilter:(t,r)=>this.addSqlFilter(t,r,this.logError)}):this._filter=null}isUpdating(){return super.isUpdating()||this._filter!=null&&this._filter.updating}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride((t,r)=>{for(const[i,s]of e)try{if(i.testFeature(t))return M(r,s)}catch(l){this.logError(l)}return M(r,null)},this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return m(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce((e,[t])=>e.concat(t.fieldNames),new Array))}get availableFields(){const e=this.sublayer,t=e.fieldsIndex;let r=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];r=[...E(t,i),...r]}return m(t,r)}_createLayerGraphic(e){const t=new b(null,null,e);return t.layer=this.sublayer.layer,t.sourceLayer=this.sublayer,t}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeatures(e,t){const r=this._validateFetchPopupFeatures(t);if(r)throw r;if(!(t!=null&&t.clientGraphics)||t.clientGraphics.length===0)return[];const i=[],s=[],l=this.sublayer.associatedLayer!=null?await this.sublayer.associatedLayer.load():this.sublayer,u=E(this.sublayer.fieldsIndex,await W(l,v(this.sublayer,t))),c=new Set;for(const h of t.clientGraphics)T(u,h,c)?s.push(h):i.push(h);return s.length===0?i:(this.sublayer.associatedLayer!=null&&await this.sublayer.associatedLayer.load().catch(()=>y.getLogger(this).warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes.")),this.whenGraphicAttributes(s,Array.from(c)).catch(()=>s).then(h=>i.concat(h)))}async _updateRequiredFields(){const e=m(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields||[],...this.filterExpressionFields||[]]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:t}=this,{popupEnabled:r}=t;return r?v(t,e)?void 0:new x("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:t}):new x("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:t})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this._filter!=null&&this._filter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return this.filter!=null?this.filter.createQuery(e):new V(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t==null?void 0:t.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t==null?void 0:t.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t==null?void 0:t.signal).then(r=>{if(!(r!=null&&r.features))return r;const i=this.sublayer,s=i.layer;for(const l of r.features)l.layer=s,l.sourceLayer=i;return r})}queryObjectIds(e,t){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t==null?void 0:t.signal)}_ensureQueryEngine(){return this._queryEngine==null&&(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=ie(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new le({layerView:this,priority:k.FEATURE_QUERY_ENGINE,spatialIndex:new ne({featureAdapter:new ae({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(t,r)=>this._forAllFeatures((i,s,l)=>t({id:i,index:s,meta:l}),r,se.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:H(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():V.from(e))}};n([a()],o.prototype,"i3slayer",null),n([a()],o.prototype,"layerView",void 0),n([a()],o.prototype,"lodFactor",null),n([a({readOnly:!0})],o.prototype,"parsedFilterExpressions",null),n([a({type:j})],o.prototype,"filter",null),n([a()],o.prototype,"_filter",void 0),n([a({type:[String],readOnly:!0})],o.prototype,"filterExpressionFields",null),n([a({type:[String],readOnly:!0})],o.prototype,"requiredFields",void 0),n([a({type:[String],readOnly:!0})],o.prototype,"availableFields",null),o=n([_("esri.views.3d.layers.BuildingComponentSublayerView3D")],o);const ge=o;class w extends de{constructor(t){super(t),this.layer=null,this.sublayerViews=null}highlight(t){throw new Error("Not implemented")}}n([a()],w.prototype,"layer",void 0),n([a()],w.prototype,"sublayerViews",void 0);const fe=L(R);let d=class extends ue(w){constructor(e){super(e),this.type="building-scene-3d",this.sublayerViews=new S,this._abortController=new AbortController,this._loadingComponents=0,this._pendingWhenSublayerViews=new Map,this.ignoresMemoryFactor=!1}get filterExpression(){var i;const e=this.layer.activeFilterId,t=e!=null?this.layer.filters.find(s=>s.id===e):null,r=t!=null?(i=t.filterBlocks)==null?void 0:i.find(s=>s.filterMode.type==="solid"):null;return r?r.filterExpression:null}get filterExpressions(){const e=this.layer.activeFilterId,t=e!=null?this.layer.filters.find(r=>r.id===e):null;return t!=null&&t.filterBlocks?t.filterBlocks.toArray().map(r=>[r.filterExpression??"",he(r)]):[]}get updatingProgressValue(){const e=this.sublayerViews,t=this._loadingComponents+(e?e.length:0);return e.reduce((r,i)=>r+i.updatingProgress,0)/t}isUpdating(){return this._loadingComponents>0||this.sublayerViews&&this.sublayerViews.some(e=>e.updating)}initialize(){z(this.layer.spatialReference,this.view.spatialReference,this.view.viewingMode),this._initializeSubLayerViews(this.layer.sublayers,this)}destroy(){this.sublayerViews&&(this.sublayerViews.forEach(e=>e.destroy()),this.sublayerViews=null),this._abortController=D(this._abortController)}_initializeSubLayerViews(e,t){const r=this,i=this.view;e.forEach(s=>{if(!s.isEmpty)if(s.type==="building-group"){const l=new fe({sublayer:s,view:i,parent:t});this._initializeSubLayerViews(s.sublayers,l)}else s.geometryType==="mesh"&&(this._loadingComponents++,s.load({signal:this._abortController.signal}).then(()=>{const l=new ge({sublayer:s,layerView:r,view:i,parent:t});this.sublayerViews.push(l);const u=this._pendingWhenSublayerViews.get(s);if(u){for(const c of u)c.resolve(l);this._pendingWhenSublayerViews.delete(s)}this.addHandles([$(()=>l.updating,()=>this.notifyChange("updating"),I),$(()=>l.updatingProgress,()=>this.notifyChange("updatingProgressValue"),I)])}).catch(l=>{X(l)||y.getLogger(this).error(`Error while creating view for sublayer ${s.id} +Layer: ${this.layer.url} +`,l)}).then(()=>{this._loadingComponents--,this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}))})}getGraphicFromIntersectorTarget(e){for(const t of this.sublayerViews.items)if(t.sublayer.uid===e.sublayerUid)return t.getGraphicFromIntersectorTarget(e);return null}async fetchPopupFeatures(e,t){if(!(t!=null&&t.clientGraphics)||t.clientGraphics.length===0)return[];const r=Y(t.clientGraphics,s=>s.sourceLayer),i=[];for(const[s,l]of r){const u=this._findComponent(s);u!=null&&i.push(u.fetchPopupFeatures(e,{...t,clientGraphics:l}))}return(await K(i)).flat()}whenGraphicBounds(e){const t=this._findComponent(e.sourceLayer);return t==null?Promise.reject():t.whenGraphicBounds(e)}getAABBFromIntersectorTarget(e){for(const t of this.sublayerViews.items)if(t.sublayer.uid===e.sublayerUid)return t.getAABBFromIntersectorTarget(e);return null}async whenSublayerView(e){const t=this._findComponent(e);if(t!=null)return t;const r=this._pendingWhenSublayerViews.get(e),i=J();return r?r.push(i):this._pendingWhenSublayerViews.set(e,[i]),i.promise}_findComponent(e){return this.sublayerViews.find(t=>e===t.sublayer)}highlight(e){e instanceof b?e=[e]:e instanceof S&&(e=e.toArray());const t=[];if(Array.isArray(e)&&e.length>0&&e[0]instanceof b){const r=e,i=new Map;for(const s of r){let l=i.get(s.sourceLayer);l==null&&(l=[],i.set(s.sourceLayer,l)),l.push(s)}this.sublayerViews.forEach(s=>{const l=i.get(s.sublayer);l&&t.push(s.highlight(l))})}return Z(t)}get usedMemory(){return this.sublayerViews.reduce((e,t)=>e+t.usedMemory,0)}get unloadedMemory(){return this.sublayerViews.reduce((e,t)=>e+t.unloadedMemory,0)}};n([a()],d.prototype,"sublayerViews",void 0),n([a({readOnly:!0})],d.prototype,"filterExpression",null),n([a({readOnly:!0})],d.prototype,"filterExpressions",null),n([a(ee)],d.prototype,"updatingProgress",void 0),n([a({readOnly:!0,dependsOn:[]})],d.prototype,"updatingProgressValue",null),d=n([_("esri.views.3d.layers.BuildingSceneLayerView3D")],d);const ht=d;export{ht as default}; diff --git a/dist/assets/BuildingSceneLayerView3D-jychJ4lg.js b/dist/assets/BuildingSceneLayerView3D-jychJ4lg.js deleted file mode 100644 index b673753..0000000 --- a/dist/assets/BuildingSceneLayerView3D-jychJ4lg.js +++ /dev/null @@ -1,3 +0,0 @@ -import{cZ as Q,m as P,K as A,e as n,y as a,c as _,od as O,oe as G,i6 as B,p as M,fR as N,P as F,Z as y,jV as U,nK as m,fH as E,S as b,fI as H,fG as v,fJ as W,E as x,ca as V,ai as j,fU as T,dC as k,V as S,of as z,a as D,d as $,A as I,f as X,og as K,gH as Y,bH as Z,fv as J,fi as ee}from"./index-J0iiHjMT.js";import"./BuildingGroupSublayer-xf_JzVTh.js";import{x as te}from"./WhereClause-XAMIZ4-B.js";import"./BuildingComponentSublayer-j8wian8V.js";import{E as re,c as ie,a as se}from"./I3SMeshView3D-OXYwZo0p.js";import{L as C,d as le,l as ne,o as ae}from"./I3SQueryFeatureStore-CLo7XXT-.js";import{t as oe}from"./DefinitionExpressionSceneLayerView-oAOUEjm-.js";import{n as ue}from"./LayerView3D-iOx2MD1g.js";import{u as de}from"./LayerView-efDufa6j.js";import"./TimeOnly-ljWtUK7N.js";import"./FeatureLayer--S4epFk-.js";import"./FeatureLayerBase-jpFp8gE3.js";import"./serviceCapabilitiesUtils-26KpT1VN.js";import"./editsZScale-Wgw9kbYG.js";import"./queryZScale-IaMm02_2.js";import"./FeatureSet-d4S1oKME.js";import"./CustomParametersMixin-Y1bOcayO.js";import"./FeatureEffectLayer-oBa8pIG5.js";import"./FeatureEffect-5bEV-xG1.js";import"./FeatureReductionLayer-RlitE1N6.js";import"./OrderedLayer-M7k5gLgx.js";import"./FeatureTemplate-kUgbbA00.js";import"./FeatureType-MpRe7WJj.js";import"./versionUtils-4v9zIDlv.js";import"./TopFeaturesQuery-E6D2tV-x.js";import"./I3SOverrides-5dCbMm3h.js";import"./I3SNode-5SPByfpU.js";import"./ReactiveSet-HLstcUcf.js";import"./meshFeatureSet-Mcou8mDC.js";import"./External-GV0jSEES.js";import"./FeatureLayerView3D-t6NDkLO0.js";import"./FeatureLayerViewBase3D-VurTj7t3.js";import"./HeatmapDensity.glsl-y7dUg--m.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./queryForSymbologySnapping-I1fFQTD_.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./QueryEngine-8tLWlkSE.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./FeatureStore-X-AIJLo2.js";import"./BoundsStore-wmwfHjhp.js";import"./projectExtentUtils-TwA6ooHn.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./EventedSet-JGlFrfoR.js";import"./RefreshableLayerView-Pd4dLcWr.js";import"./SceneModification-dyp2M_Yg.js";import"./SceneLayerWorker-o7OZRrjZ.js";const L=(e,t)=>{let r=class extends Q(P(A.EventedMixin(e))){constructor(i){super(i),this.sublayer=null,this.parent=null,this.view=null}initialize(){}get suspended(){return!this.canResume()}get updating(){return!this.suspended&&this.isUpdating()}get visible(){var i;return!!((i=this.sublayer)!=null&&i.visible)}set visible(i){this._overrideIfSome("visible",i)}get fullOpacity(){var s,l;const i=u=>u??1;return i((s=this.sublayer)==null?void 0:s.opacity)*i((l=this.parent)==null?void 0:l.fullOpacity)}canResume(){var i,s;return!((i=this.parent)!=null&&i.suspended)&&((s=this.view)==null?void 0:s.ready)&&this.visible||!1}isUpdating(){return!1}};return n([a()],r.prototype,"sublayer",void 0),n([a()],r.prototype,"parent",void 0),n([a({readOnly:!0})],r.prototype,"suspended",null),n([a({type:Boolean,readOnly:!0})],r.prototype,"updating",null),n([a()],r.prototype,"view",void 0),n([a()],r.prototype,"visible",null),n([a()],r.prototype,"fullOpacity",null),r=n([_("esri.views.3d.layers.BuildingSublayerView3D")],r),r};var p;(function(e){e[e.Solid=0]="Solid",e[e.WireFrame=1]="WireFrame",e[e.XRay=2]="XRay"})(p||(p={}));const q=.15,pe=.5*q;function he(e){switch(e.filterMode.type){case"solid":return{mode:p.Solid};case"wire-frame":return{mode:p.WireFrame,edgeMaterial:O(e.filterMode.edges,{})};case"x-ray":return{mode:p.XRay}}}function R(e,t){if(t==null)return e.color[3]=0,e.edgeMaterial=null,void(e.pickable=!1);switch(t.mode){case p.Solid:return;case p.WireFrame:return e.color[3]=0,e.edgeMaterial=t.edgeMaterial,void(e.pickable=!1);case p.XRay:return e.color[0]=1,e.color[1]=1,e.color[2]=1,e.color[3]*=q,e.colorMixMode=G.Replace,e.castShadows=!1,e.pickable=!1,void(e.edgeMaterial=ye(e.edgeMaterial))}}function ye(e){return e==null?null:(g.lastMaterial!==e&&(g.cachedMaterial=ce(e),g.lastMaterial=e),g.cachedMaterial)}function ce(e){const t=B(e.color);return t[3]*=pe,{...e,color:t}}const g={cachedMaterial:null,lastMaterial:null};class f extends M{constructor(){super(...arguments),this.sublayer=null}get updating(){return!1}get suspended(){return!1}get availableFields(){return[]}get filter(){return null}set filter(t){throw new Error("Not implemented")}queryFeatures(t,r){throw new Error("Not implemented")}queryObjectIds(t,r){throw new Error("Not implemented")}queryFeatureCount(t,r){throw new Error("Not implemented")}createQuery(){throw new Error("Not implemented")}queryExtent(t,r){throw new Error("Not implemented")}highlight(t){throw new Error("Not implemented")}}n([a()],f.prototype,"sublayer",void 0),n([a()],f.prototype,"availableFields",null),n([a()],f.prototype,"filter",null);let o=class extends oe(re(L(f))){constructor(){super(...arguments),this.type="building-component-sublayer-3d",this.layerView=null,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!1,this.requiredFields=[],this.progressiveLoadFactor=1,this._queryEngine=null}get i3slayer(){return this.sublayer}get layerUid(){return this.sublayer.layer.uid}get sublayerUid(){return this.sublayer.uid}get layerId(){return this.sublayer.layer.id}get sublayerId(){return this.sublayer.id}get layerPopupEnabledAndHasTemplate(){var e,t;return this.sublayer.popupEnabled&&N(this.sublayer,(t=(e=this.layerView)==null?void 0:e.view.popup)==null?void 0:t.defaultPopupTemplateEnabled)}initialize(){this._updatingHandles.add(()=>[this.sublayer.renderer,this.definitionExpressionFields,this.filterExpressionFields],()=>this._updateRequiredFields()),this._updatingHandles.add(()=>this.sublayer.renderer,t=>this._rendererChange(t),F);const e=()=>this._filterChange();this._updatingHandles.add(()=>this.parsedDefinitionExpression,e),this._updatingHandles.add(()=>this._filter!=null?this._filter.sortedObjectIds:null,e),this._updatingHandles.add(()=>this._filter!=null?this._filter.parsedWhereClause:null,e),this._updatingHandles.add(()=>[this._filter!=null?this._filter.parsedGeometry:null,this.filter!=null?this.filter.spatialRelationship:null],()=>this._geometryFilterChange()),this._updatingHandles.add(()=>this.parsedFilterExpressions,()=>this._updateSymbologyOverride(),F),this.addResolvingPromise(this._updateRequiredFields())}get lodFactor(){return this.view.qualitySettings.sceneService.object.lodFactor}get parsedFilterExpressions(){return this.sublayer.modelName!=="Overview"&&this.layerView?this.layerView.filterExpressions.map(([e,t])=>{let r;try{r=te.create(e,this.sublayer.fieldsIndex)}catch(l){return y.getLogger(this).error("Failed to parse filterExpression: "+l),null}if(!r.isStandardized)return y.getLogger(this).error("filterExpression is using non standard function"),null;const i=[],s=r.fieldNames;return U(s,this.sublayer.fields,{missingFields:i}),i.length>0?(y.getLogger(this).error(`filterExpression references unknown fields: ${i.join(", ")}`),null):[r,t]}).filter(e=>e!=null):[]}get filter(){return this._filter!=null?this._filter.viewFilter:null}set filter(e){e!=null&&C.checkSupport(e)?this._filter!=null?this._filter.viewFilter=e:this._filter=new C({viewFilter:e,layerFieldsIndex:this.sublayer.fieldsIndex,loadAsyncModule:t=>this._loadAsyncModule(t),addSqlFilter:(t,r)=>this.addSqlFilter(t,r,this.logError)}):this._filter=null}isUpdating(){return super.isUpdating()||this._filter!=null&&this._filter.updating}_updateSymbologyOverride(){const e=this.parsedFilterExpressions;e.length>0?this._setSymbologyOverride((t,r)=>{for(const[i,s]of e)try{if(i.testFeature(t))return R(r,s)}catch(l){this.logError(l)}return R(r,null)},this.filterExpressionFields):this._setSymbologyOverride(null,null)}get filterExpressionFields(){return m(this.sublayer.fieldsIndex,this.parsedFilterExpressions.reduce((e,[t])=>e.concat(t.fieldNames),new Array))}get availableFields(){const e=this.sublayer,t=e.fieldsIndex;let r=this.requiredFields;if(e.outFields||e.layer.outFields){const i=[...e.outFields||[],...e.layer.outFields||[]];r=[...E(t,i),...r]}return m(t,r)}_createLayerGraphic(e){const t=new b(null,null,e);return t.layer=this.sublayer.layer,t.sourceLayer=this.sublayer,t}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}async fetchPopupFeatures(e,t){const r=this._validateFetchPopupFeatures(t);if(r)throw r;if(!(t!=null&&t.clientGraphics)||t.clientGraphics.length===0)return[];const i=[],s=[],l=this.sublayer.associatedLayer!=null?await this.sublayer.associatedLayer.load():this.sublayer,u=E(this.sublayer.fieldsIndex,await H(l,v(this.sublayer,t))),c=new Set;for(const h of t.clientGraphics)W(u,h,c)?s.push(h):i.push(h);return s.length===0?i:(this.sublayer.associatedLayer!=null&&await this.sublayer.associatedLayer.load().catch(()=>y.getLogger(this).warn("Failed to load associated feature layer. Displaying popup attributes from cached attributes.")),this.whenGraphicAttributes(s,Array.from(c)).catch(()=>s).then(h=>i.concat(h)))}async _updateRequiredFields(){const e=m(this.sublayer.fieldsIndex,[...this.sublayer.renderer?await this.sublayer.renderer.getRequiredFields(this.sublayer.fieldsIndex):[],...this.definitionExpressionFields||[],...this.filterExpressionFields||[]]);this._set("requiredFields",e)}_validateFetchPopupFeatures(e){const{sublayer:t}=this,{popupEnabled:r}=t;return r?v(t,e)?void 0:new x("buildingscenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{sublayer:t}):new x("buildingscenelayerview3d:fetchPopupFeatures","Popups are disabled",{sublayer:t})}getFilters(){const e=super.getFilters();return this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this._filter!=null&&this._filter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return this.filter!=null?this.filter.createQuery(e):new V(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t==null?void 0:t.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t==null?void 0:t.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t==null?void 0:t.signal).then(r=>{if(!(r!=null&&r.features))return r;const i=this.sublayer,s=i.layer;for(const l of r.features)l.layer=s,l.sourceLayer=i;return r})}queryObjectIds(e,t){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t==null?void 0:t.signal)}_ensureQueryEngine(){return this._queryEngine==null&&(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=ie(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new le({layerView:this,priority:j.FEATURE_QUERY_ENGINE,spatialIndex:new ne({featureAdapter:new ae({objectIdField:this.sublayer.objectIdField,attributeStorageInfo:this.sublayer.attributeStorageInfo,getFeatureExtent:e}),forAllFeatures:(t,r)=>this._forAllFeatures((i,s,l)=>t({id:i,index:s,meta:l}),r,se.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:T(this.sublayer),viewSpatialReference:this.view.spatialReference})})}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():V.from(e))}};n([a()],o.prototype,"i3slayer",null),n([a()],o.prototype,"layerView",void 0),n([a()],o.prototype,"lodFactor",null),n([a({readOnly:!0})],o.prototype,"parsedFilterExpressions",null),n([a({type:k})],o.prototype,"filter",null),n([a()],o.prototype,"_filter",void 0),n([a({type:[String],readOnly:!0})],o.prototype,"filterExpressionFields",null),n([a({type:[String],readOnly:!0})],o.prototype,"requiredFields",void 0),n([a({type:[String],readOnly:!0})],o.prototype,"availableFields",null),o=n([_("esri.views.3d.layers.BuildingComponentSublayerView3D")],o);const ge=o;class w extends de{constructor(t){super(t),this.layer=null,this.sublayerViews=null}highlight(t){throw new Error("Not implemented")}}n([a()],w.prototype,"layer",void 0),n([a()],w.prototype,"sublayerViews",void 0);const fe=L(M);let d=class extends ue(w){constructor(e){super(e),this.type="building-scene-3d",this.sublayerViews=new S,this._abortController=new AbortController,this._loadingComponents=0,this._pendingWhenSublayerViews=new Map,this.ignoresMemoryFactor=!1}get filterExpression(){var i;const e=this.layer.activeFilterId,t=e!=null?this.layer.filters.find(s=>s.id===e):null,r=t!=null?(i=t.filterBlocks)==null?void 0:i.find(s=>s.filterMode.type==="solid"):null;return r?r.filterExpression:null}get filterExpressions(){const e=this.layer.activeFilterId,t=e!=null?this.layer.filters.find(r=>r.id===e):null;return t!=null&&t.filterBlocks?t.filterBlocks.toArray().map(r=>[r.filterExpression??"",he(r)]):[]}get updatingProgressValue(){const e=this.sublayerViews,t=this._loadingComponents+(e?e.length:0);return e.reduce((r,i)=>r+i.updatingProgress,0)/t}isUpdating(){return this._loadingComponents>0||this.sublayerViews&&this.sublayerViews.some(e=>e.updating)}initialize(){z(this.layer.spatialReference,this.view.spatialReference,this.view.viewingMode),this._initializeSubLayerViews(this.layer.sublayers,this)}destroy(){this.sublayerViews&&(this.sublayerViews.forEach(e=>e.destroy()),this.sublayerViews=null),this._abortController=D(this._abortController)}_initializeSubLayerViews(e,t){const r=this,i=this.view;e.forEach(s=>{if(!s.isEmpty)if(s.type==="building-group"){const l=new fe({sublayer:s,view:i,parent:t});this._initializeSubLayerViews(s.sublayers,l)}else s.geometryType==="mesh"&&(this._loadingComponents++,s.load({signal:this._abortController.signal}).then(()=>{const l=new ge({sublayer:s,layerView:r,view:i,parent:t});this.sublayerViews.push(l);const u=this._pendingWhenSublayerViews.get(s);if(u){for(const c of u)c.resolve(l);this._pendingWhenSublayerViews.delete(s)}this.addHandles([$(()=>l.updating,()=>this.notifyChange("updating"),I),$(()=>l.updatingProgress,()=>this.notifyChange("updatingProgressValue"),I)])}).catch(l=>{X(l)||y.getLogger(this).error(`Error while creating view for sublayer ${s.id} -Layer: ${this.layer.url} -`,l)}).then(()=>{this._loadingComponents--,this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}))})}getGraphicFromIntersectorTarget(e){for(const t of this.sublayerViews.items)if(t.sublayer.uid===e.sublayerUid)return t.getGraphicFromIntersectorTarget(e);return null}async fetchPopupFeatures(e,t){if(!(t!=null&&t.clientGraphics)||t.clientGraphics.length===0)return[];const r=K(t.clientGraphics,s=>s.sourceLayer),i=[];for(const[s,l]of r){const u=this._findComponent(s);u!=null&&i.push(u.fetchPopupFeatures(e,{...t,clientGraphics:l}))}return(await Y(i)).flat()}whenGraphicBounds(e){const t=this._findComponent(e.sourceLayer);return t==null?Promise.reject():t.whenGraphicBounds(e)}getAABBFromIntersectorTarget(e){for(const t of this.sublayerViews.items)if(t.sublayer.uid===e.sublayerUid)return t.getAABBFromIntersectorTarget(e);return null}async whenSublayerView(e){const t=this._findComponent(e);if(t!=null)return t;const r=this._pendingWhenSublayerViews.get(e),i=Z();return r?r.push(i):this._pendingWhenSublayerViews.set(e,[i]),i.promise}_findComponent(e){return this.sublayerViews.find(t=>e===t.sublayer)}highlight(e){e instanceof b?e=[e]:e instanceof S&&(e=e.toArray());const t=[];if(Array.isArray(e)&&e.length>0&&e[0]instanceof b){const r=e,i=new Map;for(const s of r){let l=i.get(s.sourceLayer);l==null&&(l=[],i.set(s.sourceLayer,l)),l.push(s)}this.sublayerViews.forEach(s=>{const l=i.get(s.sublayer);l&&t.push(s.highlight(l))})}return J(t)}get usedMemory(){return this.sublayerViews.reduce((e,t)=>e+t.usedMemory,0)}get unloadedMemory(){return this.sublayerViews.reduce((e,t)=>e+t.unloadedMemory,0)}};n([a()],d.prototype,"sublayerViews",void 0),n([a({readOnly:!0})],d.prototype,"filterExpression",null),n([a({readOnly:!0})],d.prototype,"filterExpressions",null),n([a(ee)],d.prototype,"updatingProgress",void 0),n([a({readOnly:!0,dependsOn:[]})],d.prototype,"updatingProgressValue",null),d=n([_("esri.views.3d.layers.BuildingSceneLayerView3D")],d);const bt=d;export{bt as default}; diff --git a/dist/assets/Button-1STHXt3M.js b/dist/assets/Button-HXGuX8_s.js similarity index 93% rename from dist/assets/Button-1STHXt3M.js rename to dist/assets/Button-HXGuX8_s.js index 659eebe..d8f2fa1 100644 --- a/dist/assets/Button-1STHXt3M.js +++ b/dist/assets/Button-HXGuX8_s.js @@ -1 +1 @@ -import{V as f,Q as R,l as _,j as u,b as T,p as g}from"./Theme-QNc_77AM.js";class p extends f{_beforeChanged(){super._beforeChanged(),(this.isDirty("cornerRadiusTL")||this.isDirty("cornerRadiusTR")||this.isDirty("cornerRadiusBR")||this.isDirty("cornerRadiusBL"))&&(this._clear=!0)}_draw(){let s=this.width(),e=this.height(),t=s,i=e,l=t/Math.abs(s),c=i/Math.abs(e);if(_(t)&&_(i)){let b=Math.min(t,i)/2,r=u(this.get("cornerRadiusTL",8),b),n=u(this.get("cornerRadiusTR",8),b),o=u(this.get("cornerRadiusBR",8),b),h=u(this.get("cornerRadiusBL",8),b),d=Math.min(Math.abs(t/2),Math.abs(i/2));r=g(r,0,d),n=g(n,0,d),o=g(o,0,d),h=g(h,0,d);const a=this._display;a.moveTo(r*l,0),a.lineTo(t-n*l,0),n>0&&a.arcTo(t,0,t,n*c,n),a.lineTo(t,i-o*c),o>0&&a.arcTo(t,i,t-o*l,i,o),a.lineTo(h*l,i),h>0&&a.arcTo(0,i,0,i-h*c,h),a.lineTo(0,r*c),r>0&&a.arcTo(0,0,r*l,0,r),a.closePath()}}}Object.defineProperty(p,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RoundedRectangle"}),Object.defineProperty(p,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:f.classNames.concat([p.className])});class m extends R{_afterNew(){this._settings.themeTags=T(this._settings.themeTags,["button"]),super._afterNew(),this._settings.background||this.set("background",p.new(this._root,{themeTags:T(this._settings.themeTags,["background"])}))}_prepareChildren(){if(super._prepareChildren(),this.isDirty("icon")){const s=this._prevSettings.icon,e=this.get("icon");e!==s&&(this._disposeProperty("icon"),s&&s.dispose(),e&&this.children.push(e),this._prevSettings.icon=e)}if(this.isDirty("label")){const s=this._prevSettings.label,e=this.get("label");e!==s&&(this._disposeProperty("label"),s&&s.dispose(),e&&this.children.push(e),this._prevSettings.label=e)}}}Object.defineProperty(m,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Button"}),Object.defineProperty(m,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:R.classNames.concat([m.className])});export{p as n,m as o}; +import{V as f,Q as R,l as _,j as u,b as T,p as g}from"./Theme-5CV7oVsW.js";class p extends f{_beforeChanged(){super._beforeChanged(),(this.isDirty("cornerRadiusTL")||this.isDirty("cornerRadiusTR")||this.isDirty("cornerRadiusBR")||this.isDirty("cornerRadiusBL"))&&(this._clear=!0)}_draw(){let s=this.width(),e=this.height(),t=s,i=e,l=t/Math.abs(s),c=i/Math.abs(e);if(_(t)&&_(i)){let b=Math.min(t,i)/2,r=u(this.get("cornerRadiusTL",8),b),n=u(this.get("cornerRadiusTR",8),b),o=u(this.get("cornerRadiusBR",8),b),h=u(this.get("cornerRadiusBL",8),b),d=Math.min(Math.abs(t/2),Math.abs(i/2));r=g(r,0,d),n=g(n,0,d),o=g(o,0,d),h=g(h,0,d);const a=this._display;a.moveTo(r*l,0),a.lineTo(t-n*l,0),n>0&&a.arcTo(t,0,t,n*c,n),a.lineTo(t,i-o*c),o>0&&a.arcTo(t,i,t-o*l,i,o),a.lineTo(h*l,i),h>0&&a.arcTo(0,i,0,i-h*c,h),a.lineTo(0,r*c),r>0&&a.arcTo(0,0,r*l,0,r),a.closePath()}}}Object.defineProperty(p,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RoundedRectangle"}),Object.defineProperty(p,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:f.classNames.concat([p.className])});class m extends R{_afterNew(){this._settings.themeTags=T(this._settings.themeTags,["button"]),super._afterNew(),this._settings.background||this.set("background",p.new(this._root,{themeTags:T(this._settings.themeTags,["background"])}))}_prepareChildren(){if(super._prepareChildren(),this.isDirty("icon")){const s=this._prevSettings.icon,e=this.get("icon");e!==s&&(this._disposeProperty("icon"),s&&s.dispose(),e&&this.children.push(e),this._prevSettings.icon=e)}if(this.isDirty("label")){const s=this._prevSettings.label,e=this.get("label");e!==s&&(this._disposeProperty("label"),s&&s.dispose(),e&&this.children.push(e),this._prevSettings.label=e)}}}Object.defineProperty(m,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Button"}),Object.defineProperty(m,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:R.classNames.concat([m.className])});export{p as n,m as o}; diff --git a/dist/assets/CIMSymbolRasterizer-o8gx_uXl.js b/dist/assets/CIMSymbolRasterizer-uvvL-Oh3.js similarity index 64% rename from dist/assets/CIMSymbolRasterizer-o8gx_uXl.js rename to dist/assets/CIMSymbolRasterizer-uvvL-Oh3.js index 76ed75c..a7f295e 100644 --- a/dist/assets/CIMSymbolRasterizer-o8gx_uXl.js +++ b/dist/assets/CIMSymbolRasterizer-uvvL-Oh3.js @@ -1 +1 @@ -import{mb as G,gX as J,fW as j,mc as B,gZ as Q,s as V,md as Z,me as M,gO as D,mf as K,bW as $,ab as ee,mg as te,mh as Y}from"./index-J0iiHjMT.js";import{d as ae,n as F,a as N,t as q,b as re,r as ie,l as se,e as ne,j as oe,V as ce,Q as he}from"./cimAnalyzer-DtyBzAGI.js";import{r as le,e as me}from"./rasterizingUtils-6P0UGdzr.js";import"./labelPoint-ysDT9nFH.js";import"./TileClipper-NSFZXMR1.js";import"./definitions-DqQMJYPH.js";import"./number-sTjsTbdA.js";import"./BidiEngine-8z8MVveq.js";class ge{constructor(){this._resourceMap=new Map,this._inFlightResourceMap=new Map,this.geometryEngine=null,this.geometryEnginePromise=null}destroy(){this._inFlightResourceMap.clear(),this._resourceMap.clear()}getResource(e){return this._resourceMap.get(e)??null}async fetchResource(e,t){const o=this._resourceMap.get(e);if(o)return{width:o.width,height:o.height};let a=this._inFlightResourceMap.get(e);return a?a.then(r=>({width:r.width,height:r.height})):(a=G(e,t),this._inFlightResourceMap.set(e,a),a.then(r=>(this._inFlightResourceMap.delete(e),this._resourceMap.set(e,r),{width:r.width,height:r.height}),()=>({width:0,height:0})))}deleteResource(e){this._inFlightResourceMap.delete(e),this._resourceMap.delete(e)}loadFont(e){return J(e)}}const ue=512;class fe{constructor(e){this._resourceManager=e,this._lazyRasterizationCanvas=null}dispose(){this._lazyRasterizationCanvas=null}get _rasterizationCanvas(){return this._lazyRasterizationCanvas==null&&(this._lazyRasterizationCanvas=document.createElement("canvas"),this._lazyRasterizationCanvas.getContext("2d",{willReadFrequently:!0})),this._lazyRasterizationCanvas}rasterizeJSONResource(e,t,o){if(e.type==="simple-fill"||e.type==="esriSFS"){const[i,l,p]=le(this._rasterizationCanvas,e.style,t);return{size:[l,p],image:new Uint32Array(i.buffer),sdf:!1,simplePattern:!0,anchorX:0,anchorY:0,rasterizationScale:j(Math.ceil(t))}}if(e.type==="simple-line"||e.type==="esriSLS"||e.type==="line"&&e.dashTemplate){let i,l;if(e.type==="simple-line"||e.type==="esriSLS")switch(i=ae(e.style,e.cap),e.cap){case"butt":l="Butt";break;case"square":l="Square";break;default:l="Round"}else i=e.dashTemplate,l=e.cim.capStyle;const[p,f,d]=me(i,l);return{size:[f,d],image:new Uint32Array(p.buffer),sdf:!0,simplePattern:!0,anchorX:0,anchorY:0}}let a,r=null,c=null,n=1;if(e.type==="simple-marker"||e.type==="esriSMS"||e.type==="line-marker"?(a=F.fromSimpleMarker(e),c=N(a)):e.cim&&e.cim.type==="CIMHatchFill"?(a=F.fromCIMHatchFill(e.cim,t),r=new q(a.frame.xmin,-a.frame.ymax,a.frame.xmax-a.frame.xmin,a.frame.ymax-a.frame.ymin),n=t):e.cim.markerPlacement&&e.cim.markerPlacement.type==="CIMMarkerPlacementInsidePolygon"?(a=F.fromCIMInsidePolygon(e.cim),r=new q(a.frame.xmin,-a.frame.ymax,a.frame.xmax-a.frame.xmin,a.frame.ymax-a.frame.ymin)):(a=e.cim,e.avoidSDFRasterization||(c=N(a))),c&&!o){const[i,l,p]=re(c);return i?{size:[l,p],image:new Uint32Array(i.buffer),sdf:!0,simplePattern:!0,anchorX:0,anchorY:0,rasterizationScale:n}:null}const[s,y,m,g,u]=F.rasterize(this._rasterizationCanvas,a,r,this._resourceManager,!o);return s?{size:[y,m],image:new Uint32Array(s.buffer),sdf:!1,simplePattern:!1,anchorX:g,anchorY:u}:null}rasterizeImageResource(e,t,o,a){this._rasterizationCanvas.width=e,this._rasterizationCanvas.height=t;const r=this._rasterizationCanvas.getContext("2d");o instanceof ImageData?r.putImageData(o,0,0):(o.setAttribute("width",`${e}px`),o.setAttribute("height",`${t}px`),r.drawImage(o,0,0,e,t));const c=r.getImageData(0,0,e,t),n=new Uint8Array(c.data);if(a){for(const i of a)if(i&&i.oldColor&&i.oldColor.length===4&&i.newColor&&i.newColor.length===4){const[l,p,f,d]=i.oldColor,[z,h,I,w]=i.newColor;if(l===z&&p===h&&f===I&&d===w)continue;for(let C=0;C=u||g>=u){const i=m/g;i>1?(m=u,g=Math.round(u/i)):(g=u,m=Math.round(u*i)),y=new Uint8Array(4*m*g);const l=new Uint8ClampedArray(y.buffer);B(n,e,t,l,m,g,!1)}return{size:[m,g],image:new Uint32Array(y.buffer),sdf:!1,simplePattern:!1,anchorX:0,anchorY:0}}}const T=b=>b!=null&&b.scaleFactor?b.scaleFactor:1,de=96/72;class Ie{constructor(e,t){this._spatialReference=e,this._avoidSDF=t,this._resourceCache=new Map,this._lazyImageDataCanvas=null,this._pictureMarkerCache=new Map,this._textRasterizer=new ie,this._cimResourceManager=new ge,this._rasterizer=new fe(this._cimResourceManager)}get _imageDataCanvas(){return this._lazyImageDataCanvas??(this._lazyImageDataCanvas=document.createElement("canvas")),this._lazyImageDataCanvas}get _imageDataContext(){return this._imageDataCanvas.getContext("2d",{willReadFrequently:!0})}get resourceManager(){return this._cimResourceManager}async rasterizeCIMSymbolAsync(e,t,o,a,r,c,n,s,y){if(!e)return null;const{data:m}=e;if(!m||m.type!=="CIMSymbolReference"||!m.symbol)return null;const{symbol:g}=m;c||(c=Q(g));const u=await se.resolveSymbolOverrides(m,t,this._spatialReference,r,c,n,s),i=this._imageDataCanvas,l=this._cimResourceManager,p=[];F.fetchResources(u,l,p),F.fetchFonts(u,l,p),p.length>0&&await Promise.all(p);const{width:f,height:d}=o,z=ye(c,f,d,a),h=F.getEnvelope(u,z,l);if(!h)return null;const I=(window.devicePixelRatio||1)*de;let w=1,C=0,R=0;switch(g.type){case"CIMPointSymbol":case"CIMTextSymbol":{let k=1;h.width>f&&(k=f/h.width);let _=1;h.height>d&&(_=d/h.height),a==="preview"&&(h.widthd)&&(w=d/h.height),R=h.y+h.height/2;const k=h.x*w+f/2,_=(h.x+h.width)*w+f/2,{paths:x}=z;x[0][0][0]-=k/w,x[0][2][0]-=(_-f)/w}break;case"CIMPolygonSymbol":{C=h.x+h.width/2,R=h.y+h.height/2;const k=h.x*w+f/2,_=(h.x+h.width)*w+f/2,x=h.y*w+d/2,X=(h.y+h.height)*w+d/2,{rings:S}=z;k<0&&(S[0][0][0]-=k,S[0][3][0]-=k,S[0][4][0]-=k),x<0&&(S[0][0][1]+=x,S[0][1][1]+=x,S[0][4][1]+=x),_>f&&(S[0][1][0]-=_-f,S[0][2][0]-=_-f),X>d&&(S[0][2][1]+=X-d,S[0][3][1]+=X-d)}}i.width=f*I,i.height=d*I;const v=1;i.width+=2*v,i.height+=2*v;const P=this._imageDataContext,A=he.createIdentity();return A.translate(-C,-R),A.scale(w*I,-w*I),A.translate(f*I/2+v,d*I/2+v),P.clearRect(0,0,i.width,i.height),new ne(P,l,A,!0).drawSymbol(u,z),P.getImageData(0,0,i.width,i.height)}async analyzeCIMSymbol3D(e,t,o,a,r){const c=[],n=t?{geometryType:a,spatialReference:this._spatialReference,fields:t}:null,s=[];F.fetchFonts(e.data.symbol,this._cimResourceManager,s),await Promise.all(s);const y=new oe(this._cimResourceManager,n);let m;await y.analyzeSymbolReference(e.data,this._avoidSDF,c),V(r);for(const g of c)g.cim.type!=="CIMPictureMarker"&&g.cim.type!=="CIMPictureFill"&&g.cim.type!=="CIMPictureStroke"||(m||(m=[]),m.push(this._fetchPictureMarkerResource(g,r))),o&&g.type==="text"&&typeof g.text=="string"&&g.text.includes("[")&&(g.text=Z(o,g.text,g.cim.textCase));return m&&await Promise.all(m),c}rasterizeCIMSymbol3D(e,t,o,a,r,c){const n=[];for(const s of e){a&&typeof a.scaleFactor=="function"&&(a.scaleFactor=a.scaleFactor(t,r,c));const y=this._getRasterizedResource(s,t,o,a,r,c);if(!y)continue;let m=0,g=y.anchorX||0,u=y.anchorY||0,i=!1,l=0,p=0;if(o==="esriGeometryPoint"){const f=T(a);if(l=M(s.offsetX,t,r,c)*f||0,p=M(s.offsetY,t,r,c)*f||0,s.type==="marker")m=M(s.rotation,t,r,c)||0,i=s.rotateClockwise??!1;else if(s.type==="text"){if(m=M(s.angle,t,r,c)||0,s.horizontalAlignment!==void 0)switch(s.horizontalAlignment){case"left":g=-.5;break;case"right":g=.5;break;default:g=0}if(s.verticalAlignment!==void 0)switch(s.verticalAlignment){case"top":u=.5;break;case"bottom":u=-.5;break;case"baseline":u=-.25;break;default:u=0}}}y!=null&&n.push({angle:m,rotateClockWise:i,anchorX:g,anchorY:u,offsetX:l,offsetY:p,rasterizedResource:y})}return this.getSymbolImage(n)}getSymbolImage(e){const t=document.createElement("canvas"),o=t.getContext("2d");let a=0,r=0,c=0,n=0;const s=[];for(let u=0;uc?v:c,n=P>n?P:n;const A=o.createImageData(l.size[0],l.size[1]);A.data.set(new Uint8ClampedArray(l.image.buffer));const k={offsetX:f,offsetY:d,rotateClockwise:I,angle:w,rasterizedImage:A,anchorX:z,anchorY:h};s.push(k)}t.width=c-a,t.height=n-r;const y=-a,m=n;for(let u=0;u1?D(t):D(t)/r:a.width,n=t?r>1?D(t)*r:D(t):a.height;return{image:this._imageTo32Array(a,c,n,o),width:c,height:n}}}function ye(b,e,t,o){const r=-e/2+1,c=e/2-1,n=t/2-1,s=-t/2+1;switch(b){case"esriGeometryPoint":return{x:0,y:0};case"esriGeometryPolyline":return{paths:[[[r,0],[0,0],[c,0]]]};default:return o==="legend"?{rings:[[[r,n],[c,0],[c,s],[r,s],[r,n]]]}:{rings:[[[r,n],[c,n],[c,s],[r,s],[r,n]]]}}}function pe(b,e,t,o){let a,r;return typeof b.materialHash=="function"?(a=(0,b.materialHash)(e,t,o),r=ce(b.cim,b.materialOverrides)):(a=b.materialHash,r=b.cim),{analyzedCIM:r,hash:a}}export{Ie as CIMSymbolRasterizer}; +import{mj as j,gU as G,fR as J,mk as B,gW as Q,ab as V,ml as K,mm as M,gL as D,mn as Z,av as $,W as ee,mo as te,mp as Y}from"./index-pCX-0tJH.js";import{d as ae,n as F,a as N,t as q,b as re,r as ie,l as se,e as ne,j as oe,V as ce,Q as le}from"./cimAnalyzer-X6MTpVAO.js";import{r as he,e as me}from"./rasterizingUtils-_-kX1RtA.js";import"./labelPoint-1MOq4I_J.js";import"./TileClipper-NSFZXMR1.js";import"./definitions-SVBNHUSH.js";import"./number-sTjsTbdA.js";import"./BidiEngine-8z8MVveq.js";class ge{constructor(){this._resourceMap=new Map,this._inFlightResourceMap=new Map,this.geometryEngine=null,this.geometryEnginePromise=null}destroy(){this._inFlightResourceMap.clear(),this._resourceMap.clear()}getResource(e){return this._resourceMap.get(e)??null}async fetchResource(e,t){const o=this._resourceMap.get(e);if(o)return{width:o.width,height:o.height};let a=this._inFlightResourceMap.get(e);return a?a.then(r=>({width:r.width,height:r.height})):(a=j(e,t),this._inFlightResourceMap.set(e,a),a.then(r=>(this._inFlightResourceMap.delete(e),this._resourceMap.set(e,r),{width:r.width,height:r.height}),()=>({width:0,height:0})))}deleteResource(e){this._inFlightResourceMap.delete(e),this._resourceMap.delete(e)}loadFont(e){return G(e)}}const ue=512;class fe{constructor(e){this._resourceManager=e,this._lazyRasterizationCanvas=null}dispose(){this._lazyRasterizationCanvas=null}get _rasterizationCanvas(){return this._lazyRasterizationCanvas==null&&(this._lazyRasterizationCanvas=document.createElement("canvas"),this._lazyRasterizationCanvas.getContext("2d",{willReadFrequently:!0})),this._lazyRasterizationCanvas}rasterizeJSONResource(e,t,o){if(e.type==="simple-fill"||e.type==="esriSFS"){const[i,h,p]=he(this._rasterizationCanvas,e.style,t);return{size:[h,p],image:new Uint32Array(i.buffer),sdf:!1,simplePattern:!0,anchorX:0,anchorY:0,rasterizationScale:J(Math.ceil(t))}}if(e.type==="simple-line"||e.type==="esriSLS"||e.type==="line"&&e.dashTemplate){let i,h;if(e.type==="simple-line"||e.type==="esriSLS")switch(i=ae(e.style,e.cap),e.cap){case"butt":h="Butt";break;case"square":h="Square";break;default:h="Round"}else i=e.dashTemplate,h=e.cim.capStyle;const[p,f,d]=me(i,h);return{size:[f,d],image:new Uint32Array(p.buffer),sdf:!0,simplePattern:!0,anchorX:0,anchorY:0}}let a,r=null,c=null,n=1;if(e.type==="simple-marker"||e.type==="esriSMS"||e.type==="line-marker"?(a=F.fromSimpleMarker(e),c=N(a)):e.cim&&e.cim.type==="CIMHatchFill"?(a=F.fromCIMHatchFill(e.cim,t),r=new q(a.frame.xmin,-a.frame.ymax,a.frame.xmax-a.frame.xmin,a.frame.ymax-a.frame.ymin),n=t):e.cim.markerPlacement&&e.cim.markerPlacement.type==="CIMMarkerPlacementInsidePolygon"?(a=F.fromCIMInsidePolygon(e.cim),r=new q(a.frame.xmin,-a.frame.ymax,a.frame.xmax-a.frame.xmin,a.frame.ymax-a.frame.ymin)):(a=e.cim,e.avoidSDFRasterization||(c=N(a))),c&&!o){const[i,h,p]=re(c);return i?{size:[h,p],image:new Uint32Array(i.buffer),sdf:!0,simplePattern:!0,anchorX:0,anchorY:0,rasterizationScale:n}:null}const[s,y,m,g,u]=F.rasterize(this._rasterizationCanvas,a,r,this._resourceManager,!o);return s?{size:[y,m],image:new Uint32Array(s.buffer),sdf:!1,simplePattern:!1,anchorX:g,anchorY:u}:null}rasterizeImageResource(e,t,o,a){this._rasterizationCanvas.width=e,this._rasterizationCanvas.height=t;const r=this._rasterizationCanvas.getContext("2d");o instanceof ImageData?r.putImageData(o,0,0):(o.setAttribute("width",`${e}px`),o.setAttribute("height",`${t}px`),r.drawImage(o,0,0,e,t));const c=r.getImageData(0,0,e,t),n=new Uint8Array(c.data);if(a){for(const i of a)if(i&&i.oldColor&&i.oldColor.length===4&&i.newColor&&i.newColor.length===4){const[h,p,f,d]=i.oldColor,[z,l,I,w]=i.newColor;if(h===z&&p===l&&f===I&&d===w)continue;for(let C=0;C=u||g>=u){const i=m/g;i>1?(m=u,g=Math.round(u/i)):(g=u,m=Math.round(u*i)),y=new Uint8Array(4*m*g);const h=new Uint8ClampedArray(y.buffer);B(n,e,t,h,m,g,!1)}return{size:[m,g],image:new Uint32Array(y.buffer),sdf:!1,simplePattern:!1,anchorX:0,anchorY:0}}}const T=R=>R!=null&&R.scaleFactor?R.scaleFactor:1,de=96/72;class Ie{constructor(e,t){this._spatialReference=e,this._avoidSDF=t,this._resourceCache=new Map,this._lazyImageDataCanvas=null,this._pictureMarkerCache=new Map,this._textRasterizer=new ie,this._cimResourceManager=new ge,this._rasterizer=new fe(this._cimResourceManager)}get _imageDataCanvas(){return this._lazyImageDataCanvas??(this._lazyImageDataCanvas=document.createElement("canvas")),this._lazyImageDataCanvas}get _imageDataContext(){return this._imageDataCanvas.getContext("2d",{willReadFrequently:!0})}get resourceManager(){return this._cimResourceManager}async rasterizeCIMSymbolAsync(e,t,o,a,r,c,n,s,y){if(!e)return null;const{data:m}=e;if(!m||m.type!=="CIMSymbolReference"||!m.symbol)return null;const{symbol:g}=m;c||(c=Q(g));const u=await se.resolveSymbolOverrides(m,t,this._spatialReference,r,c,n,s),i=this._imageDataCanvas,h=this._cimResourceManager,p=[];F.fetchResources(u,h,p),F.fetchFonts(u,h,p),p.length>0&&await Promise.all(p);const{width:f,height:d}=o,z=ye(c,f,d,a),l=F.getEnvelope(u,z,h);if(!l)return null;const I=(window.devicePixelRatio||1)*de;let w=1,C=0,b=0;switch(g.type){case"CIMPointSymbol":case"CIMTextSymbol":{let k=1;l.width>f&&(k=f/l.width);let _=1;l.height>d&&(_=d/l.height),a==="preview"&&(l.widthd)&&(w=d/l.height),b=l.y+l.height/2;const k=l.x*w+f/2,_=(l.x+l.width)*w+f/2,{paths:x}=z;x[0][0][0]-=k/w,x[0][2][0]-=(_-f)/w}break;case"CIMPolygonSymbol":{C=l.x+l.width/2,b=l.y+l.height/2;const k=l.x*w+f/2,_=(l.x+l.width)*w+f/2,x=l.y*w+d/2,X=(l.y+l.height)*w+d/2,{rings:S}=z;k<0&&(S[0][0][0]-=k,S[0][3][0]-=k,S[0][4][0]-=k),x<0&&(S[0][0][1]+=x,S[0][1][1]+=x,S[0][4][1]+=x),_>f&&(S[0][1][0]-=_-f,S[0][2][0]-=_-f),X>d&&(S[0][2][1]+=X-d,S[0][3][1]+=X-d)}}i.width=f*I,i.height=d*I;const v=1;i.width+=2*v,i.height+=2*v;const P=this._imageDataContext,A=le.createIdentity();return A.translate(-C,-b),A.scale(w*I,-w*I),A.translate(f*I/2+v,d*I/2+v),P.clearRect(0,0,i.width,i.height),new ne(P,h,A,!0).drawSymbol(u,z),P.getImageData(0,0,i.width,i.height)}async analyzeCIMSymbol3D(e,t,o,a,r){const c=[],n=t?{geometryType:a,spatialReference:this._spatialReference,fields:t}:null,s=[];F.fetchFonts(e.data.symbol,this._cimResourceManager,s),await Promise.all(s);const y=new oe(this._cimResourceManager,n);let m;await y.analyzeSymbolReference(e.data,this._avoidSDF,c),V(r);for(const g of c)g.cim.type!=="CIMPictureMarker"&&g.cim.type!=="CIMPictureFill"&&g.cim.type!=="CIMPictureStroke"||(m||(m=[]),m.push(this._fetchPictureMarkerResource(g,r))),o&&g.type==="text"&&typeof g.text=="string"&&g.text.includes("[")&&(g.text=K(o,g.text,g.cim.textCase));return m&&await Promise.all(m),c}rasterizeCIMSymbol3D(e,t,o,a,r,c){const n=[];for(const s of e){a&&typeof a.scaleFactor=="function"&&(a.scaleFactor=a.scaleFactor(t,r,c));const y=this._getRasterizedResource(s,t,o,a,r,c);if(!y)continue;let m=0,g=y.anchorX||0,u=y.anchorY||0,i=!1,h=0,p=0;if(o==="esriGeometryPoint"){const f=T(a);if(h=M(s.offsetX,t,r,c)*f||0,p=M(s.offsetY,t,r,c)*f||0,s.type==="marker")m=M(s.rotation,t,r,c)||0,i=s.rotateClockwise??!1;else if(s.type==="text"){if(m=M(s.angle,t,r,c)||0,s.horizontalAlignment!==void 0)switch(s.horizontalAlignment){case"left":g=-.5;break;case"right":g=.5;break;default:g=0}if(s.verticalAlignment!==void 0)switch(s.verticalAlignment){case"top":u=.5;break;case"bottom":u=-.5;break;case"baseline":u=-.25;break;default:u=0}}}y!=null&&n.push({angle:m,rotateClockWise:i,anchorX:g,anchorY:u,offsetX:h,offsetY:p,rasterizedResource:y})}return this.getSymbolImage(n)}getSymbolImage(e){const t=document.createElement("canvas"),o=t.getContext("2d");let a=0,r=0,c=0,n=0;const s=[];for(let u=0;uc?v:c,n=P>n?P:n;const A=o.createImageData(h.size[0],h.size[1]);A.data.set(new Uint8ClampedArray(h.image.buffer));const k={offsetX:f,offsetY:d,rotateClockwise:I,angle:w,rasterizedImage:A,anchorX:z,anchorY:l};s.push(k)}t.width=c-a,t.height=n-r;const y=-a,m=n;for(let u=0;u1?D(t):D(t)/r:a.width,n=t?r>1?D(t)*r:D(t):a.height;return{image:this._imageTo32Array(a,c,n,o),width:c,height:n}}}function ye(R,e,t,o){const r=-e/2+1,c=e/2-1,n=t/2-1,s=-t/2+1;switch(R){case"esriGeometryPoint":return{x:0,y:0};case"esriGeometryPolyline":return{paths:[[[r,0],[0,0],[c,0]]]};default:return o==="legend"?{rings:[[[r,n],[c,0],[c,s],[r,s],[r,n]]]}:{rings:[[[r,n],[c,n],[c,s],[r,s],[r,n]]]}}}function pe(R,e,t,o){let a,r;return typeof R.materialHash=="function"?(a=(0,R.materialHash)(e,t,o),r=ce(R.cim,R.materialOverrides)):(a=R.materialHash,r=R.cim),{analyzedCIM:r,hash:a}}export{Ie as CIMSymbolRasterizer}; diff --git a/dist/assets/CSVLayer-iQyfu2e9.js b/dist/assets/CSVLayer-iQyfu2e9.js new file mode 100644 index 0000000..ef1dcff --- /dev/null +++ b/dist/assets/CSVLayer-iQyfu2e9.js @@ -0,0 +1 @@ +import{e as i,y as r,c as h,il as v,bs as w,h6 as S,dO as O,f_ as F,dE as b,dt as I,iA as q,iB as N,d2 as _,dL as J,au as C,aL as l,r as y}from"./index-pCX-0tJH.js";import P from"./FeatureLayer-9tNCmEbA.js";import{l as j}from"./clientSideDefaults-63pOkJ4Y.js";import"./FeatureLayerBase-mvqC7cJs.js";import"./serviceCapabilitiesUtils-f-iBP4uh.js";import"./editsZScale-4-dTv58d.js";import"./CustomParametersMixin-7nmugR3Y.js";import"./FeatureEffectLayer-OK0TB5f6.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./FeatureReductionLayer-2X2_PJv9.js";import"./OrderedLayer-XNaJwl_G.js";import"./FeatureTemplate-vSzbyslg.js";import"./FeatureType-0WPvBvpQ.js";import"./versionUtils-idhrDltC.js";import"./QueryEngineCapabilities-PzVpW5yD.js";let a=class extends v{constructor(e){super(e),this.type="csv",this.refresh=w(async t=>{await this.load();const{extent:o,timeExtent:n}=await this._connection.invoke("refresh",t);return o&&(this.sourceJSON.extent=o),n&&(this.sourceJSON.timeInfo.timeExtent=[n.start,n.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){const t=e!=null?e.signal:null;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){var e;(e=this._connection)==null||e.close(),this._connection=null}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeatures(e,t={}){await this.load(t);const o=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t);return S.fromJSON(o)}async queryFeaturesJSON(e,t={}){return await this.load(t),this._connection.invoke("queryFeatures",e?e.toJSON():null,t)}async queryFeatureCount(e,t={}){return await this.load(t),this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t)}async queryObjectIds(e,t={}){return await this.load(t),this._connection.invoke("queryObjectIds",e?e.toJSON():null,t)}async queryExtent(e,t={}){await this.load(t);const o=await this._connection.invoke("queryExtent",e?e.toJSON():null,t);return{count:o.count,extent:O.fromJSON(o.extent)}}async querySnapping(e,t={}){return await this.load(t),this._connection.invoke("querySnapping",e,t)}async _startWorker(e){this._connection=await F("CSVSourceWorker",{strategy:b("feature-layers-workers")?"dedicated":"local",signal:e,registryTarget:this});const{url:t,delimiter:o,fields:n,latitudeField:m,longitudeField:f,spatialReference:u,timeInfo:d}=this.loadOptions,c=await this._connection.invoke("load",{url:t,customParameters:this.customParameters,parsingOptions:{delimiter:o,fields:n==null?void 0:n.map(g=>g.toJSON()),latitudeField:m,longitudeField:f,spatialReference:u==null?void 0:u.toJSON(),timeInfo:d==null?void 0:d.toJSON()}},{signal:e});this.locationInfo=c.locationInfo,this.sourceJSON=c.layerDefinition,this.delimiter=c.delimiter}};i([r()],a.prototype,"type",void 0),i([r()],a.prototype,"loadOptions",void 0),i([r()],a.prototype,"customParameters",void 0),i([r()],a.prototype,"locationInfo",void 0),i([r()],a.prototype,"sourceJSON",void 0),i([r()],a.prototype,"delimiter",void 0),a=i([h("esri.layers.graphics.sources.CSVSource")],a);function p(e,t){throw new y(t,`CSVLayer (title: ${e.title}, id: ${e.id}) cannot be saved to a portal item`)}let s=class extends P{constructor(...e){super(...e),this.geometryType="point",this.capabilities=j(!1,!1),this.delimiter=null,this.editingEnabled=!1,this.fields=null,this.latitudeField=null,this.locationType="coordinates",this.longitudeField=null,this.operationalLayerType="CSV",this.outFields=["*"],this.path=null,this.spatialReference=_.WGS84,this.source=null,this.type="csv"}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}load(e){const t=e!=null?e.signal:null,o=this.loadFromPortal({supportedTypes:["CSV"],supportsData:!1},e).catch(J).then(async()=>this.initLayerProperties(await this.createGraphicsSource(t)));return this.addResolvingPromise(o),Promise.resolve(this)}get isTable(){return this.loaded&&this.geometryType==null}readWebMapLabelsVisible(e,t){var o,n;return t.showLabels!=null?t.showLabels:!!((n=(o=t.layerDefinition)==null?void 0:o.drawingInfo)!=null&&n.labelingInfo)}set url(e){if(!e)return void this._set("url",e);const t=C(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async createGraphicsSource(e){const t=new a({loadOptions:{delimiter:this.delimiter,fields:this.fields,latitudeField:this.latitudeField??void 0,longitudeField:this.longitudeField??void 0,spatialReference:this.spatialReference??void 0,timeInfo:this.timeInfo??void 0,url:this.url},customParameters:this.customParameters??void 0});return this._set("source",t),await t.load({signal:e}),this.read({locationInfo:t.locationInfo,columnDelimiter:t.delimiter},{origin:"service",url:this.parsedUrl}),t}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(l.from(e)||this.createQuery())).then(o=>{if(o!=null&&o.features)for(const n of o.features)n.layer=n.sourceLayer=this;return o})}queryObjectIds(e,t){return this.load().then(()=>this.source.queryObjectIds(l.from(e)||this.createQuery()))}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(l.from(e)||this.createQuery()))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(l.from(e)||this.createQuery()))}read(e,t){super.read(e,t),t&&t.origin==="service"&&this.revert(["latitudeField","longitudeField"],"service")}write(e,t){return super.write(e,{...t,writeLayerSchema:!0})}clone(){throw new y("csv-layer:clone",`CSVLayer (title: ${this.title}, id: ${this.id}) cannot be cloned`)}async save(e){return p(this,"csv-layer:save")}async saveAs(e,t){return p(this,"csv-layer:save-as")}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return t!=null&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}_verifyFields(){}_verifySource(){}_hasMemorySource(){return!1}};i([r({readOnly:!0,json:{read:!1,write:!1}})],s.prototype,"capabilities",void 0),i([r({type:[","," ",";","|"," "],json:{read:{source:"columnDelimiter"},write:{target:"columnDelimiter",ignoreOrigin:!0}}})],s.prototype,"delimiter",void 0),i([r({readOnly:!0,type:Boolean,json:{origins:{"web-scene":{read:!1,write:!1}}}})],s.prototype,"editingEnabled",void 0),i([r({json:{read:{source:"layerDefinition.fields"},write:{target:"layerDefinition.fields"}}})],s.prototype,"fields",void 0),i([r({type:Boolean,readOnly:!0})],s.prototype,"isTable",null),i([I("web-map","labelsVisible",["layerDefinition.drawingInfo.labelingInfo","showLabels"])],s.prototype,"readWebMapLabelsVisible",null),i([r({type:String,json:{read:{source:"locationInfo.latitudeFieldName"},write:{target:"locationInfo.latitudeFieldName",ignoreOrigin:!0}}})],s.prototype,"latitudeField",void 0),i([r({type:["show","hide"]})],s.prototype,"listMode",void 0),i([r({type:["coordinates"],json:{read:{source:"locationInfo.locationType"},write:{target:"locationInfo.locationType",ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"locationType",void 0),i([r({type:String,json:{read:{source:"locationInfo.longitudeFieldName"},write:{target:"locationInfo.longitudeFieldName",ignoreOrigin:!0}}})],s.prototype,"longitudeField",void 0),i([r({type:["CSV"]})],s.prototype,"operationalLayerType",void 0),i([r()],s.prototype,"outFields",void 0),i([r({type:String,json:{origins:{"web-scene":{read:!1,write:!1}},read:!1,write:!1}})],s.prototype,"path",void 0),i([r({json:{read:!1},cast:null,type:a,readOnly:!0})],s.prototype,"source",void 0),i([r({json:{read:!1},value:"csv",readOnly:!0})],s.prototype,"type",void 0),i([r({json:{read:q,write:{isRequired:!0,ignoreOrigin:!0,writer:N}}})],s.prototype,"url",null),s=i([h("esri.layers.CSVLayer")],s);const U=s;export{U as default}; diff --git a/dist/assets/CSVLayer-tIBvmg-7.js b/dist/assets/CSVLayer-tIBvmg-7.js deleted file mode 100644 index e9e8cc9..0000000 --- a/dist/assets/CSVLayer-tIBvmg-7.js +++ /dev/null @@ -1 +0,0 @@ -import{e as i,y as r,c as h,ij as v,ah as w,dT as S,g1 as O,dJ as F,dt as b,iz as I,iA as q,ar as N,dQ as _,bV as J,ca as l,E as y}from"./index-J0iiHjMT.js";import j from"./FeatureLayer--S4epFk-.js";import{d as C}from"./FeatureSet-d4S1oKME.js";import{l as P}from"./clientSideDefaults-F-CNnR0g.js";import"./FeatureLayerBase-jpFp8gE3.js";import"./serviceCapabilitiesUtils-26KpT1VN.js";import"./editsZScale-Wgw9kbYG.js";import"./queryZScale-IaMm02_2.js";import"./CustomParametersMixin-Y1bOcayO.js";import"./FeatureEffectLayer-oBa8pIG5.js";import"./FeatureEffect-5bEV-xG1.js";import"./FeatureReductionLayer-RlitE1N6.js";import"./OrderedLayer-M7k5gLgx.js";import"./FeatureTemplate-kUgbbA00.js";import"./FeatureType-MpRe7WJj.js";import"./versionUtils-4v9zIDlv.js";import"./TopFeaturesQuery-E6D2tV-x.js";import"./QueryEngineCapabilities-PzVpW5yD.js";let a=class extends v{constructor(e){super(e),this.type="csv",this.refresh=w(async t=>{await this.load();const{extent:o,timeExtent:n}=await this._connection.invoke("refresh",t);return o&&(this.sourceJSON.extent=o),n&&(this.sourceJSON.timeInfo.timeExtent=[n.start,n.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){const t=e!=null?e.signal:null;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){var e;(e=this._connection)==null||e.close(),this._connection=null}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeatures(e,t={}){await this.load(t);const o=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t);return C.fromJSON(o)}async queryFeaturesJSON(e,t={}){return await this.load(t),this._connection.invoke("queryFeatures",e?e.toJSON():null,t)}async queryFeatureCount(e,t={}){return await this.load(t),this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t)}async queryObjectIds(e,t={}){return await this.load(t),this._connection.invoke("queryObjectIds",e?e.toJSON():null,t)}async queryExtent(e,t={}){await this.load(t);const o=await this._connection.invoke("queryExtent",e?e.toJSON():null,t);return{count:o.count,extent:S.fromJSON(o.extent)}}async querySnapping(e,t={}){return await this.load(t),this._connection.invoke("querySnapping",e,t)}async _startWorker(e){this._connection=await O("CSVSourceWorker",{strategy:F("feature-layers-workers")?"dedicated":"local",signal:e,registryTarget:this});const{url:t,delimiter:o,fields:n,latitudeField:m,longitudeField:f,spatialReference:u,timeInfo:d}=this.loadOptions,c=await this._connection.invoke("load",{url:t,customParameters:this.customParameters,parsingOptions:{delimiter:o,fields:n==null?void 0:n.map(g=>g.toJSON()),latitudeField:m,longitudeField:f,spatialReference:u==null?void 0:u.toJSON(),timeInfo:d==null?void 0:d.toJSON()}},{signal:e});this.locationInfo=c.locationInfo,this.sourceJSON=c.layerDefinition,this.delimiter=c.delimiter}};i([r()],a.prototype,"type",void 0),i([r()],a.prototype,"loadOptions",void 0),i([r()],a.prototype,"customParameters",void 0),i([r()],a.prototype,"locationInfo",void 0),i([r()],a.prototype,"sourceJSON",void 0),i([r()],a.prototype,"delimiter",void 0),a=i([h("esri.layers.graphics.sources.CSVSource")],a);function p(e,t){throw new y(t,`CSVLayer (title: ${e.title}, id: ${e.id}) cannot be saved to a portal item`)}let s=class extends j{constructor(...e){super(...e),this.geometryType="point",this.capabilities=P(!1,!1),this.delimiter=null,this.editingEnabled=!1,this.fields=null,this.latitudeField=null,this.locationType="coordinates",this.longitudeField=null,this.operationalLayerType="CSV",this.outFields=["*"],this.path=null,this.spatialReference=N.WGS84,this.source=null,this.type="csv"}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}load(e){const t=e!=null?e.signal:null,o=this.loadFromPortal({supportedTypes:["CSV"],supportsData:!1},e).catch(_).then(async()=>this.initLayerProperties(await this.createGraphicsSource(t)));return this.addResolvingPromise(o),Promise.resolve(this)}get isTable(){return this.loaded&&this.geometryType==null}readWebMapLabelsVisible(e,t){var o,n;return t.showLabels!=null?t.showLabels:!!((n=(o=t.layerDefinition)==null?void 0:o.drawingInfo)!=null&&n.labelingInfo)}set url(e){if(!e)return void this._set("url",e);const t=J(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async createGraphicsSource(e){const t=new a({loadOptions:{delimiter:this.delimiter,fields:this.fields,latitudeField:this.latitudeField??void 0,longitudeField:this.longitudeField??void 0,spatialReference:this.spatialReference??void 0,timeInfo:this.timeInfo??void 0,url:this.url},customParameters:this.customParameters??void 0});return this._set("source",t),await t.load({signal:e}),this.read({locationInfo:t.locationInfo,columnDelimiter:t.delimiter},{origin:"service",url:this.parsedUrl}),t}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(l.from(e)||this.createQuery())).then(o=>{if(o!=null&&o.features)for(const n of o.features)n.layer=n.sourceLayer=this;return o})}queryObjectIds(e,t){return this.load().then(()=>this.source.queryObjectIds(l.from(e)||this.createQuery()))}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(l.from(e)||this.createQuery()))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(l.from(e)||this.createQuery()))}read(e,t){super.read(e,t),t&&t.origin==="service"&&this.revert(["latitudeField","longitudeField"],"service")}write(e,t){return super.write(e,{...t,writeLayerSchema:!0})}clone(){throw new y("csv-layer:clone",`CSVLayer (title: ${this.title}, id: ${this.id}) cannot be cloned`)}async save(e){return p(this,"csv-layer:save")}async saveAs(e,t){return p(this,"csv-layer:save-as")}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return t!=null&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}_verifyFields(){}_verifySource(){}_hasMemorySource(){return!1}};i([r({readOnly:!0,json:{read:!1,write:!1}})],s.prototype,"capabilities",void 0),i([r({type:[","," ",";","|"," "],json:{read:{source:"columnDelimiter"},write:{target:"columnDelimiter",ignoreOrigin:!0}}})],s.prototype,"delimiter",void 0),i([r({readOnly:!0,type:Boolean,json:{origins:{"web-scene":{read:!1,write:!1}}}})],s.prototype,"editingEnabled",void 0),i([r({json:{read:{source:"layerDefinition.fields"},write:{target:"layerDefinition.fields"}}})],s.prototype,"fields",void 0),i([r({type:Boolean,readOnly:!0})],s.prototype,"isTable",null),i([b("web-map","labelsVisible",["layerDefinition.drawingInfo.labelingInfo","showLabels"])],s.prototype,"readWebMapLabelsVisible",null),i([r({type:String,json:{read:{source:"locationInfo.latitudeFieldName"},write:{target:"locationInfo.latitudeFieldName",ignoreOrigin:!0}}})],s.prototype,"latitudeField",void 0),i([r({type:["show","hide"]})],s.prototype,"listMode",void 0),i([r({type:["coordinates"],json:{read:{source:"locationInfo.locationType"},write:{target:"locationInfo.locationType",ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"locationType",void 0),i([r({type:String,json:{read:{source:"locationInfo.longitudeFieldName"},write:{target:"locationInfo.longitudeFieldName",ignoreOrigin:!0}}})],s.prototype,"longitudeField",void 0),i([r({type:["CSV"]})],s.prototype,"operationalLayerType",void 0),i([r()],s.prototype,"outFields",void 0),i([r({type:String,json:{origins:{"web-scene":{read:!1,write:!1}},read:!1,write:!1}})],s.prototype,"path",void 0),i([r({json:{read:!1},cast:null,type:a,readOnly:!0})],s.prototype,"source",void 0),i([r({json:{read:!1},value:"csv",readOnly:!0})],s.prototype,"type",void 0),i([r({json:{read:I,write:{isRequired:!0,ignoreOrigin:!0,writer:q}}})],s.prototype,"url",null),s=i([h("esri.layers.CSVLayer")],s);const H=s;export{H as default}; diff --git a/dist/assets/CSVLayerView3D-WZv0l0uX.js b/dist/assets/CSVLayerView3D-WZv0l0uX.js new file mode 100644 index 0000000..5db8d82 --- /dev/null +++ b/dist/assets/CSVLayerView3D-WZv0l0uX.js @@ -0,0 +1 @@ +import{e as r,y as o,c as p}from"./index-pCX-0tJH.js";import{_ as i}from"./FeatureLayerViewBase3D-W0Qwl4g_.js";import"./HeatmapDensity.glsl-de3m0xZZ.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./queryForSymbologySnapping-MXWRIdj-.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./QueryEngine-uvDs-vBe.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./FeatureStore-PXMUgn0j.js";import"./BoundsStore-_-dPK5c-.js";import"./projectExtentUtils-Q4rXasWA.js";import"./LayerView3D-57OghbRh.js";import"./EventedSet-TJfupI82.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./LayerView-ixwLVnzr.js";import"./RefreshableLayerView-DVYs7L04.js";let t=class extends i{constructor(){super(...arguments),this.type="csv-3d"}};r([o()],t.prototype,"layer",void 0),t=r([p("esri.views.3d.layers.CSVLayerView3D")],t);const q=t;export{q as default}; diff --git a/dist/assets/CSVLayerView3D-t0wtEtZq.js b/dist/assets/CSVLayerView3D-t0wtEtZq.js deleted file mode 100644 index 2dd011a..0000000 --- a/dist/assets/CSVLayerView3D-t0wtEtZq.js +++ /dev/null @@ -1 +0,0 @@ -import{e as r,y as o,c as p}from"./index-J0iiHjMT.js";import{_ as i}from"./FeatureLayerViewBase3D-VurTj7t3.js";import"./HeatmapDensity.glsl-y7dUg--m.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./queryForSymbologySnapping-I1fFQTD_.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./QueryEngine-8tLWlkSE.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./FeatureSet-d4S1oKME.js";import"./FeatureStore-X-AIJLo2.js";import"./BoundsStore-wmwfHjhp.js";import"./projectExtentUtils-TwA6ooHn.js";import"./LayerView3D-iOx2MD1g.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./EventedSet-JGlFrfoR.js";import"./FeatureEffect-5bEV-xG1.js";import"./LayerView-efDufa6j.js";import"./RefreshableLayerView-Pd4dLcWr.js";let t=class extends i{constructor(){super(...arguments),this.type="csv-3d"}};r([o()],t.prototype,"layer",void 0),t=r([p("esri.views.3d.layers.CSVLayerView3D")],t);const F=t;export{F as default}; diff --git a/dist/assets/CSVSourceWorker-GlkXsKJn.js b/dist/assets/CSVSourceWorker-4-dU7rZu.js similarity index 81% rename from dist/assets/CSVSourceWorker-GlkXsKJn.js rename to dist/assets/CSVSourceWorker-4-dU7rZu.js index 26da709..ee03b29 100644 --- a/dist/assets/CSVSourceWorker-GlkXsKJn.js +++ b/dist/assets/CSVSourceWorker-4-dU7rZu.js @@ -1,4 +1,4 @@ -import{k0 as j,eX as _,ff as R,E as I,b as V,f as P,Z as L,bV as A,bW as Q,eQ as w,eR as E,ga as G,al as M,eF as Z,k1 as Y,k2 as B,ar as J,eZ as W,e_ as U,eV as H,dh as K}from"./index-J0iiHjMT.js";import{e as X,n as z}from"./date-be_IQzZd.js";import{t as ee}from"./json-v6EOeNTY.js";import{m as te}from"./FeatureStore-X-AIJLo2.js";import{W as ie,x as ne}from"./QueryEngine-8tLWlkSE.js";import{i as se,o as re}from"./clientSideDefaults-F-CNnR0g.js";import"./BoundsStore-wmwfHjhp.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";const T=/^\s*"([\S\s]*)"\s*$/,S=/""/g,O=` +import{k7 as j,eS as _,fa as R,r as I,N as P,ac as V,R as L,au as A,av as Q,eL as N,eM as T,g7 as G,bt as M,ez as Z,k8 as Y,k9 as B,d2 as J,eU as U,eV as W,eQ as z,dh as H}from"./index-pCX-0tJH.js";import{e as K,n as X}from"./date-be_IQzZd.js";import{t as ee}from"./json-v6EOeNTY.js";import{m as te}from"./FeatureStore-PXMUgn0j.js";import{W as ie,x as ne}from"./QueryEngine-uvDs-vBe.js";import{i as se,o as re}from"./clientSideDefaults-63pOkJ4Y.js";import"./BoundsStore-_-dPK5c-.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";const E=/^\s*"([\S\s]*)"\s*$/,S=/""/g,O=` `,oe=[","," ",";","|"," "];function*$(s,t,e){let i=0;for(;i<=s.length;){const n=s.indexOf(t,i),r=s.substring(i,n>-1?n:void 0);i+=r.length+t.length,e&&!r.trim()||(yield r)}}function q(s){const t=s.includes(`\r `)?`\r -`:O;return $(s,t,!0)}function C(s,t){return $(s,t,!1)}function ae(s,t,e){s=s.trim(),t=t==null?void 0:t.trim();const i=[],n=Array.from(new Set([e==null?void 0:e.delimiter,...oe])).filter(o=>o!=null);for(const o of n){const a=N(s,o).length,u=N(t,o).length??a;a>1&&i.push({weight:Math.min(a,u),delimiter:o})}const r=i.sort(({weight:o},{weight:a})=>a-o).map(({delimiter:o})=>o);for(const o of r){const a=le(v(s,o).names,e==null?void 0:e.longitudeField,e==null?void 0:e.latitudeField);if(a.longitudeFieldName&&a.latitudeFieldName)return{delimiter:o,locationInfo:a}}return{delimiter:r[0],locationInfo:null}}function*k(s,t,e,i=()=>Object.create(null)){const n=q(s);n.next();let r="",o="",a=0,u=i(),d=0;e:for(const h of n){const m=C(h,e);for(const y of m)if(r+=o+y,o="",a+=D(y),a%2==0){if(a>0){const g=T.exec(r);if(!g){u=i(),d=0,r="",a=0;continue e}u[t[d]]=g[1].replaceAll(S,'"'),d++}else u[t[d]]=r,d++;r="",a=0}else o=e;a===0?(yield u,u=i(),d=0):o=O}}function v(s,t){const e=N(s,t).filter(n=>n!=null),i=e.map(n=>_(n));for(let n=i.length-1;n>=0;n--)i[n]||(i.splice(n,1),e.splice(n,1));return{names:i,aliases:e}}function N(s,t){if(!(s!=null&&s.length))return[];const e=[];let i="",n="",r=0;const o=C(s,t);for(const a of o)if(i+=n+a,n="",r+=D(a),r%2==0){if(r>0){const u=T.exec(i);u&&e.push(u[1].replaceAll(S,'"'))}else e.push(i);i="",r=0}else n=t;return e}function D(s){let t=0,e=0;for(e=s.indexOf('"',e);e>=0;)t++,e=s.indexOf('"',e+1);return t}function le(s,t,e){var o,a;t=(o=_(t))==null?void 0:o.toLowerCase(),e=(a=_(e))==null?void 0:a.toLowerCase();const i=s.map(u=>u.toLowerCase()),n=t?s[i.indexOf(t)]:null,r=e?s[i.indexOf(e)]:null;return{longitudeFieldName:n||s[i.indexOf(fe.find(u=>i.includes(u)))],latitudeFieldName:r||s[i.indexOf(de.find(u=>i.includes(u)))]}}function ce(s,t,e,i,n){const r=[],o=k(s,e,t),a=[];for(const u of o){if(a.length===10)break;a.push(u)}for(let u=0;uy[d]))){case"integer":m="esriFieldTypeInteger";break;case"double":m="esriFieldTypeDouble";break;case"date":m="esriFieldTypeDate";break;default:m="esriFieldTypeString"}r.push({name:d,type:m,alias:h,length:R(m)})}}return r}function ue(s){if(!s.length)return"string";const t=/[^+\-.,0-9]/;return s.map(e=>{if(e!==""){if(!t.test(e)){let i=x(e);if(!isNaN(i))return/[.,]/.test(e)||!Number.isInteger(i)||i>214783647||i<-214783648?"double":"integer";if(e.includes("E")&&(i=Number(e),!Number.isNaN(i)||e.includes(",")&&(e=e.replace(",","."),i=Number(e),!Number.isNaN(i))))return"double"}return X(e)?"date":"string"}}).reduce((e,i)=>e===void 0?i:i===void 0?e:e===i?i:e==="string"||i==="string"?"string":e==="double"||i==="double"?"double":void 0)}const x=function(){const s=j(),t=new RegExp("^"+s.regexp+"$"),e=new RegExp("["+s.group+"\\s\\xa0]","g"),i=s.factor;return n=>{const r=t.exec(n);if(s.factor=i,!r)return NaN;let o=r[1];if(!r[1]){if(!r[2])return NaN;o=r[2],s.factor*=-1}return o=o.replace(e,"").replace(s.decimal,"."),+o*s.factor}}(),de=["lat","latitude","latitude83","latdecdeg","lat_dd","y","ycenter","point_y"],fe=["lon","lng","long","longitude","longitude83","longdecdeg","long_dd","x","xcenter","point_x"],me=re("esriGeometryPoint"),pe=["csv"],he=[0,0];class ye{constructor(t,e){this.x=t,this.y=e}}class ve{constructor(){this._queryEngine=null,this._snapshotFeatures=async t=>{const e=await this._fetch(t);return this._createFeatures(e)}}destroy(){var t;(t=this._queryEngine)==null||t.destroy(),this._queryEngine=null}async load(t,e={}){var u;this._loadOptions=t;const[i]=await Promise.all([this._fetch(e.signal),this._checkProjection((u=t==null?void 0:t.parsingOptions)==null?void 0:u.spatialReference)]),n=ge(i,t);this._locationInfo=n.locationInfo,this._delimiter=n.delimiter,this._queryEngine=this._createQueryEngine(n);const r=await this._createFeatures(i);this._queryEngine.featureStore.addMany(r);const{fullExtent:o,timeExtent:a}=await this._queryEngine.fetchRecomputedExtents();if(n.layerDefinition.extent=o,a){const{start:d,end:h}=a;n.layerDefinition.timeInfo.timeExtent=[d,h]}return n}async applyEdits(){throw new I("csv-layer:editing-not-supported","applyEdits() is not supported on CSVLayer")}async queryFeatures(t={},e={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(t,e.signal)}async queryFeatureCount(t={},e={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(t,e.signal)}async queryObjectIds(t={},e={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(t,e.signal)}async queryExtent(t={},e={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(t,e.signal)}async querySnapping(t,e={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(t,e.signal)}async refresh(t){var n;this._loadOptions.customParameters=t,(n=this._snapshotTask)==null||n.abort(),this._snapshotTask=V(this._snapshotFeatures),this._snapshotTask.promise.then(r=>{this._queryEngine.featureStore.clear(),r&&this._queryEngine.featureStore.addMany(r)},r=>{this._queryEngine.featureStore.clear(),P(r)||L.getLogger("esri.layers.CSVLayer").error(new I("csv-layer:refresh","An error occurred during refresh",{error:r}))}),await this._waitSnapshotComplete();const{fullExtent:e,timeExtent:i}=await this._queryEngine.fetchRecomputedExtents();return{extent:e,timeExtent:i}}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(t){const{url:e,customParameters:i}=this._loadOptions;if(!e)throw new I("csv-layer:invalid-source","url not defined");const n=A(e);return(await Q(n.path,{query:{...n.query,...i},responseType:"text",signal:t})).data}_createQueryEngine(t){const{objectIdField:e,fields:i,extent:n,timeInfo:r}=t.layerDefinition,o=new te({geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1});return new ie({fieldsIndex:w.fromLayerJSON({fields:i,dateFieldsTimeReference:{timeZoneIANA:E}}),geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1,timeInfo:r,objectIdField:e,spatialReference:n.spatialReference||{wkid:4326},cacheSpatialQueries:!0,featureStore:o})}async _createFeatures(t){const{latitudeFieldName:e,longitudeFieldName:i}=this._locationInfo,{objectIdField:n,fieldsIndex:r,spatialReference:o}=this._queryEngine;let a=[];const u=[],d=r.fields.filter(l=>l.name!==n).map(l=>l.name);let h=0;const m={};for(const l of r.fields)if(l.type!=="esriFieldTypeOID"&&l.type!=="esriFieldTypeGlobalID"){const p=G(l);p!==void 0&&(m[l.name]=p)}const y=k(t,d,this._delimiter,se(m,n));for(const l of y){const p=this._parseCoordinateValue(l[e]),F=this._parseCoordinateValue(l[i]);if(F!=null&&p!=null&&!isNaN(p)&&!isNaN(F)){l[e]=p,l[i]=F;for(const c in l)if(c!==e&&c!==i){if(r.isDateField(c))l[c]=z(l[c]);else if(r.isNumericField(c)){const f=x(l[c]);isNaN(f)?l[c]=null:l[c]=f}}l[n]=h,h++,a.push(new ye(F,p)),u.push(l)}}if(!M({wkid:4326},o))if(Z(o))for(const l of a)[l.x,l.y]=Y(l.x,l.y,he);else a=B(ee,a,J.WGS84,o,null,null);const g=[];for(let l=0;l181)&&(e=parseFloat(t)),e}async _checkProjection(t){try{await ne(H,t)}catch{throw new I("csv-layer:projection-not-supported","Projection not supported")}}}function ge(s,t){var l,p,F;const e=t.parsingOptions||{},i={delimiter:e.delimiter,layerDefinition:null,locationInfo:{latitudeFieldName:e.latitudeField,longitudeFieldName:e.longitudeField}},n=i.layerDefinition={name:K(t.url,pe)||"csv",dateFieldsTimeReference:{timeZoneIANA:E},drawingInfo:me,geometryType:"esriGeometryPoint",objectIdField:null,fields:[],timeInfo:e.timeInfo,extent:{xmin:Number.POSITIVE_INFINITY,ymin:Number.POSITIVE_INFINITY,xmax:Number.NEGATIVE_INFINITY,ymax:Number.NEGATIVE_INFINITY,spatialReference:e.spatialReference||{wkid:4326}}},r=q(s),o=(l=r.next().value)==null?void 0:l.trim(),a=(p=r.next().value)==null?void 0:p.trim();if(!o)throw new I("csv-layer:empty-csv","CSV is empty",{csv:s});const{delimiter:u,locationInfo:d}=ae(o,a,e);if(!u)throw new I("csv-layer:invalid-delimiter","Unable to detect the delimiter from CSV",{firstLine:o,secondLine:a,parsingOptions:e});if(!d)throw new I("csv-layer:location-fields-not-found","Unable to identify latitude and longitude fields from the CSV file",{firstLine:o,secondLine:a,parsingOptions:e});i.locationInfo=d,i.delimiter=u;const{names:h,aliases:m}=v(o,u),y=ce(s,i.delimiter,h,m,i.locationInfo);if((F=e.fields)!=null&&F.length){const c=new w(e.fields);for(const f of y){const b=c.get(f.name);b&&Object.assign(f,b)}}if(!y.some(c=>c.type==="esriFieldTypeOID"&&(n.objectIdField=c.name,!0))){const c={name:"__OBJECTID",alias:"__OBJECTID",type:"esriFieldTypeOID",editable:!1,nullable:!1};n.objectIdField=c.name,y.unshift(c)}n.fields=y;const g=new w(n.fields);if(i.locationInfo&&(i.locationInfo.latitudeFieldName=g.get(i.locationInfo.latitudeFieldName).name,i.locationInfo.longitudeFieldName=g.get(i.locationInfo.longitudeFieldName).name),n.timeInfo){const c=n.timeInfo;if(c.startTimeField){const f=g.get(c.startTimeField);f?(c.startTimeField=f.name,f.type="esriFieldTypeDate"):c.startTimeField=null}if(c.endTimeField){const f=g.get(c.endTimeField);f?(c.endTimeField=f.name,f.type="esriFieldTypeDate"):c.endTimeField=null}if(c.trackIdField){const f=g.get(c.trackIdField);c.trackIdField=f?f.name:null}c.startTimeField||c.endTimeField||(n.timeInfo=null)}return i}export{ve as default}; +`:O;return $(s,t,!0)}function C(s,t){return $(s,t,!1)}function ae(s,t,e){s=s.trim(),t=t==null?void 0:t.trim();const i=[],n=Array.from(new Set([e==null?void 0:e.delimiter,...oe])).filter(o=>o!=null);for(const o of n){const a=w(s,o).length,u=w(t,o).length??a;a>1&&i.push({weight:Math.min(a,u),delimiter:o})}const r=i.sort(({weight:o},{weight:a})=>a-o).map(({delimiter:o})=>o);for(const o of r){const a=le(v(s,o).names,e==null?void 0:e.longitudeField,e==null?void 0:e.latitudeField);if(a.longitudeFieldName&&a.latitudeFieldName)return{delimiter:o,locationInfo:a}}return{delimiter:r[0],locationInfo:null}}function*k(s,t,e,i=()=>Object.create(null)){const n=q(s);n.next();let r="",o="",a=0,u=i(),d=0;e:for(const h of n){const m=C(h,e);for(const y of m)if(r+=o+y,o="",a+=D(y),a%2==0){if(a>0){const g=E.exec(r);if(!g){u=i(),d=0,r="",a=0;continue e}u[t[d]]=g[1].replaceAll(S,'"'),d++}else u[t[d]]=r,d++;r="",a=0}else o=e;a===0?(yield u,u=i(),d=0):o=O}}function v(s,t){const e=w(s,t).filter(n=>n!=null),i=e.map(n=>_(n));for(let n=i.length-1;n>=0;n--)i[n]||(i.splice(n,1),e.splice(n,1));return{names:i,aliases:e}}function w(s,t){if(!(s!=null&&s.length))return[];const e=[];let i="",n="",r=0;const o=C(s,t);for(const a of o)if(i+=n+a,n="",r+=D(a),r%2==0){if(r>0){const u=E.exec(i);u&&e.push(u[1].replaceAll(S,'"'))}else e.push(i);i="",r=0}else n=t;return e}function D(s){let t=0,e=0;for(e=s.indexOf('"',e);e>=0;)t++,e=s.indexOf('"',e+1);return t}function le(s,t,e){var o,a;t=(o=_(t))==null?void 0:o.toLowerCase(),e=(a=_(e))==null?void 0:a.toLowerCase();const i=s.map(u=>u.toLowerCase()),n=t?s[i.indexOf(t)]:null,r=e?s[i.indexOf(e)]:null;return{longitudeFieldName:n||s[i.indexOf(fe.find(u=>i.includes(u)))],latitudeFieldName:r||s[i.indexOf(de.find(u=>i.includes(u)))]}}function ce(s,t,e,i,n){const r=[],o=k(s,e,t),a=[];for(const u of o){if(a.length===10)break;a.push(u)}for(let u=0;uy[d]))){case"integer":m="esriFieldTypeInteger";break;case"double":m="esriFieldTypeDouble";break;case"date":m="esriFieldTypeDate";break;default:m="esriFieldTypeString"}r.push({name:d,type:m,alias:h,length:R(m)})}}return r}function ue(s){if(!s.length)return"string";const t=/[^+\-.,0-9]/;return s.map(e=>{if(e!==""){if(!t.test(e)){let i=x(e);if(!isNaN(i))return/[.,]/.test(e)||!Number.isInteger(i)||i>214783647||i<-214783648?"double":"integer";if(e.includes("E")&&(i=Number(e),!Number.isNaN(i)||e.includes(",")&&(e=e.replace(",","."),i=Number(e),!Number.isNaN(i))))return"double"}return K(e)?"date":"string"}}).reduce((e,i)=>e===void 0?i:i===void 0?e:e===i?i:e==="string"||i==="string"?"string":e==="double"||i==="double"?"double":void 0)}const x=function(){const s=j(),t=new RegExp("^"+s.regexp+"$"),e=new RegExp("["+s.group+"\\s\\xa0]","g"),i=s.factor;return n=>{const r=t.exec(n);if(s.factor=i,!r)return NaN;let o=r[1];if(!r[1]){if(!r[2])return NaN;o=r[2],s.factor*=-1}return o=o.replace(e,"").replace(s.decimal,"."),+o*s.factor}}(),de=["lat","latitude","latitude83","latdecdeg","lat_dd","y","ycenter","point_y"],fe=["lon","lng","long","longitude","longitude83","longdecdeg","long_dd","x","xcenter","point_x"],me=re("esriGeometryPoint"),pe=["csv"],he=[0,0];class ye{constructor(t,e){this.x=t,this.y=e}}class ve{constructor(){this._queryEngine=null,this._snapshotFeatures=async t=>{const e=await this._fetch(t);return this._createFeatures(e)}}destroy(){var t;(t=this._queryEngine)==null||t.destroy(),this._queryEngine=null}async load(t,e={}){var u;this._loadOptions=t;const[i]=await Promise.all([this._fetch(e.signal),this._checkProjection((u=t==null?void 0:t.parsingOptions)==null?void 0:u.spatialReference)]),n=ge(i,t);this._locationInfo=n.locationInfo,this._delimiter=n.delimiter,this._queryEngine=this._createQueryEngine(n);const r=await this._createFeatures(i);this._queryEngine.featureStore.addMany(r);const{fullExtent:o,timeExtent:a}=await this._queryEngine.fetchRecomputedExtents();if(n.layerDefinition.extent=o,a){const{start:d,end:h}=a;n.layerDefinition.timeInfo.timeExtent=[d,h]}return n}async applyEdits(){throw new I("csv-layer:editing-not-supported","applyEdits() is not supported on CSVLayer")}async queryFeatures(t={},e={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(t,e.signal)}async queryFeatureCount(t={},e={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(t,e.signal)}async queryObjectIds(t={},e={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(t,e.signal)}async queryExtent(t={},e={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(t,e.signal)}async querySnapping(t,e={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(t,e.signal)}async refresh(t){var n;this._loadOptions.customParameters=t,(n=this._snapshotTask)==null||n.abort(),this._snapshotTask=P(this._snapshotFeatures),this._snapshotTask.promise.then(r=>{this._queryEngine.featureStore.clear(),r&&this._queryEngine.featureStore.addMany(r)},r=>{this._queryEngine.featureStore.clear(),V(r)||L.getLogger("esri.layers.CSVLayer").error(new I("csv-layer:refresh","An error occurred during refresh",{error:r}))}),await this._waitSnapshotComplete();const{fullExtent:e,timeExtent:i}=await this._queryEngine.fetchRecomputedExtents();return{extent:e,timeExtent:i}}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(t){const{url:e,customParameters:i}=this._loadOptions;if(!e)throw new I("csv-layer:invalid-source","url not defined");const n=A(e);return(await Q(n.path,{query:{...n.query,...i},responseType:"text",signal:t})).data}_createQueryEngine(t){const{objectIdField:e,fields:i,extent:n,timeInfo:r}=t.layerDefinition,o=new te({geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1});return new ie({fieldsIndex:N.fromLayerJSON({fields:i,dateFieldsTimeReference:{timeZoneIANA:T}}),geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1,timeInfo:r,objectIdField:e,spatialReference:n.spatialReference||{wkid:4326},cacheSpatialQueries:!0,featureStore:o})}async _createFeatures(t){const{latitudeFieldName:e,longitudeFieldName:i}=this._locationInfo,{objectIdField:n,fieldsIndex:r,spatialReference:o}=this._queryEngine;let a=[];const u=[],d=r.fields.filter(l=>l.name!==n).map(l=>l.name);let h=0;const m={};for(const l of r.fields)if(l.type!=="esriFieldTypeOID"&&l.type!=="esriFieldTypeGlobalID"){const p=G(l);p!==void 0&&(m[l.name]=p)}const y=k(t,d,this._delimiter,se(m,n));for(const l of y){const p=this._parseCoordinateValue(l[e]),F=this._parseCoordinateValue(l[i]);if(F!=null&&p!=null&&!isNaN(p)&&!isNaN(F)){l[e]=p,l[i]=F;for(const c in l)if(c!==e&&c!==i){if(r.isDateField(c))l[c]=X(l[c]);else if(r.isNumericField(c)){const f=x(l[c]);isNaN(f)?l[c]=null:l[c]=f}}l[n]=h,h++,a.push(new ye(F,p)),u.push(l)}}if(!M({wkid:4326},o))if(Z(o))for(const l of a)[l.x,l.y]=Y(l.x,l.y,he);else a=B(ee,a,J.WGS84,o,null,null);const g=[];for(let l=0;l181)&&(e=parseFloat(t)),e}async _checkProjection(t){try{await ne(z,t)}catch{throw new I("csv-layer:projection-not-supported","Projection not supported")}}}function ge(s,t){var l,p,F;const e=t.parsingOptions||{},i={delimiter:e.delimiter,layerDefinition:null,locationInfo:{latitudeFieldName:e.latitudeField,longitudeFieldName:e.longitudeField}},n=i.layerDefinition={name:H(t.url,pe)||"csv",dateFieldsTimeReference:{timeZoneIANA:T},drawingInfo:me,geometryType:"esriGeometryPoint",objectIdField:null,fields:[],timeInfo:e.timeInfo,extent:{xmin:Number.POSITIVE_INFINITY,ymin:Number.POSITIVE_INFINITY,xmax:Number.NEGATIVE_INFINITY,ymax:Number.NEGATIVE_INFINITY,spatialReference:e.spatialReference||{wkid:4326}}},r=q(s),o=(l=r.next().value)==null?void 0:l.trim(),a=(p=r.next().value)==null?void 0:p.trim();if(!o)throw new I("csv-layer:empty-csv","CSV is empty",{csv:s});const{delimiter:u,locationInfo:d}=ae(o,a,e);if(!u)throw new I("csv-layer:invalid-delimiter","Unable to detect the delimiter from CSV",{firstLine:o,secondLine:a,parsingOptions:e});if(!d)throw new I("csv-layer:location-fields-not-found","Unable to identify latitude and longitude fields from the CSV file",{firstLine:o,secondLine:a,parsingOptions:e});i.locationInfo=d,i.delimiter=u;const{names:h,aliases:m}=v(o,u),y=ce(s,i.delimiter,h,m,i.locationInfo);if((F=e.fields)!=null&&F.length){const c=new N(e.fields);for(const f of y){const b=c.get(f.name);b&&Object.assign(f,b)}}if(!y.some(c=>c.type==="esriFieldTypeOID"&&(n.objectIdField=c.name,!0))){const c={name:"__OBJECTID",alias:"__OBJECTID",type:"esriFieldTypeOID",editable:!1,nullable:!1};n.objectIdField=c.name,y.unshift(c)}n.fields=y;const g=new N(n.fields);if(i.locationInfo&&(i.locationInfo.latitudeFieldName=g.get(i.locationInfo.latitudeFieldName).name,i.locationInfo.longitudeFieldName=g.get(i.locationInfo.longitudeFieldName).name),n.timeInfo){const c=n.timeInfo;if(c.startTimeField){const f=g.get(c.startTimeField);f?(c.startTimeField=f.name,f.type="esriFieldTypeDate"):c.startTimeField=null}if(c.endTimeField){const f=g.get(c.endTimeField);f?(c.endTimeField=f.name,f.type="esriFieldTypeDate"):c.endTimeField=null}if(c.trackIdField){const f=g.get(c.trackIdField);c.trackIdField=f?f.name:null}c.startTimeField||c.endTimeField||(n.timeInfo=null)}return i}export{ve as default}; diff --git a/dist/assets/ColorSet-j9kKRPwP.js b/dist/assets/ColorSet-tH4rJdGx.js similarity index 95% rename from dist/assets/ColorSet-j9kKRPwP.js rename to dist/assets/ColorSet-tH4rJdGx.js index b77674f..20f57f4 100644 --- a/dist/assets/ColorSet-j9kKRPwP.js +++ b/dist/assets/ColorSet-tH4rJdGx.js @@ -1 +1 @@ -import{E as c,Z as h}from"./Theme-QNc_77AM.js";class u extends c{_afterNew(){super._afterNewApplyThemes(),this._dirty.colors=!1}_beforeChanged(){this.isDirty("colors")&&this.reset()}generateColors(){this.setPrivate("currentPass",this.getPrivate("currentPass",0)+1);const e=this.getPrivate("currentPass"),t=this.get("colors",[this.get("baseColor",h.fromHex(16711680))]);this.getPrivate("numColors")||this.setPrivate("numColors",t.length);const r=this.getPrivate("numColors"),g=0,i=this.get("passOptions"),P=this.get("reuse");for(let a=g;a1;)n-=1;let s=o.s+(i.saturation||0)*e;s>1&&(s=1),s<0&&(s=0);let l=o.l+(i.lightness||0)*e;for(;l>1;)l-=1;t.push(h.fromHSL(n,s,l))}}getIndex(e){const t=this.get("colors",[]),r=this.get("saturation");return e>=t.length?(this.generateColors(),this.getIndex(e)):r!=null?h.saturate(t[e],r):t[e]}next(){let e=this.getPrivate("currentStep",this.get("startIndex",0));return this.setPrivate("currentStep",e+this.get("step",1)),this.getIndex(e)}reset(){this.setPrivate("currentStep",this.get("startIndex",0)),this.setPrivate("currentPass",0)}}Object.defineProperty(u,"className",{enumerable:!0,configurable:!0,writable:!0,value:"ColorSet"}),Object.defineProperty(u,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:c.classNames.concat([u.className])});export{u as s}; +import{E as c,Z as h}from"./Theme-5CV7oVsW.js";class u extends c{_afterNew(){super._afterNewApplyThemes(),this._dirty.colors=!1}_beforeChanged(){this.isDirty("colors")&&this.reset()}generateColors(){this.setPrivate("currentPass",this.getPrivate("currentPass",0)+1);const e=this.getPrivate("currentPass"),t=this.get("colors",[this.get("baseColor",h.fromHex(16711680))]);this.getPrivate("numColors")||this.setPrivate("numColors",t.length);const r=this.getPrivate("numColors"),g=0,i=this.get("passOptions"),P=this.get("reuse");for(let a=g;a1;)n-=1;let s=o.s+(i.saturation||0)*e;s>1&&(s=1),s<0&&(s=0);let l=o.l+(i.lightness||0)*e;for(;l>1;)l-=1;t.push(h.fromHSL(n,s,l))}}getIndex(e){const t=this.get("colors",[]),r=this.get("saturation");return e>=t.length?(this.generateColors(),this.getIndex(e)):r!=null?h.saturate(t[e],r):t[e]}next(){let e=this.getPrivate("currentStep",this.get("startIndex",0));return this.setPrivate("currentStep",e+this.get("step",1)),this.getIndex(e)}reset(){this.setPrivate("currentStep",this.get("startIndex",0)),this.setPrivate("currentPass",0)}}Object.defineProperty(u,"className",{enumerable:!0,configurable:!0,writable:!0,value:"ColorSet"}),Object.defineProperty(u,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:c.classNames.concat([u.className])});export{u as s}; diff --git a/dist/assets/CustomParametersMixin-Y1bOcayO.js b/dist/assets/CustomParametersMixin-7nmugR3Y.js similarity index 82% rename from dist/assets/CustomParametersMixin-Y1bOcayO.js rename to dist/assets/CustomParametersMixin-7nmugR3Y.js index 4e88b6c..43ebd0d 100644 --- a/dist/assets/CustomParametersMixin-Y1bOcayO.js +++ b/dist/assets/CustomParametersMixin-7nmugR3Y.js @@ -1 +1 @@ -import{e as r,y as o,c as i}from"./index-J0iiHjMT.js";const a=s=>{let e=class extends s{constructor(){super(...arguments),this.customParameters=null}};return r([o({type:Object,json:{write:{overridePolicy:t=>({enabled:!!(t&&Object.keys(t).length>0)})}}})],e.prototype,"customParameters",void 0),e=r([i("esri.layers.mixins.CustomParametersMixin")],e),e};export{a as o}; +import{e as r,y as o,c as i}from"./index-pCX-0tJH.js";const a=s=>{let e=class extends s{constructor(){super(...arguments),this.customParameters=null}};return r([o({type:Object,json:{write:{overridePolicy:t=>({enabled:!!(t&&Object.keys(t).length>0)})}}})],e.prototype,"customParameters",void 0),e=r([i("esri.layers.mixins.CustomParametersMixin")],e),e};export{a as o}; diff --git a/dist/assets/DefaultTheme-T7-VnRhA.js b/dist/assets/DefaultTheme-uOYPzulo.js similarity index 99% rename from dist/assets/DefaultTheme-T7-VnRhA.js rename to dist/assets/DefaultTheme-uOYPzulo.js index b696596..93af7fe 100644 --- a/dist/assets/DefaultTheme-T7-VnRhA.js +++ b/dist/assets/DefaultTheme-uOYPzulo.js @@ -1 +1 @@ -import{i as R,Z as i,x as c,X as n,Y as r,A as h,C as u}from"./Theme-QNc_77AM.js";function a(g,s,o,d){g.set(s,o.get(d)),o.on(d,p=>{g.set(s,p)})}class A extends R{setupDefaultRules(){super.setupDefaultRules();const s=this._root.language,o=this._root.interfaceColors,d=this._root.horizontalLayout,p=this._root.verticalLayout,e=this.rule.bind(this);e("InterfaceColors").setAll({stroke:i.fromHex(15066597),fill:i.fromHex(15987699),primaryButton:i.fromHex(6788316),primaryButtonHover:i.fromHex(6779356),primaryButtonDown:i.fromHex(6872182),primaryButtonActive:i.fromHex(6872182),primaryButtonText:i.fromHex(16777215),primaryButtonStroke:i.fromHex(16777215),secondaryButton:i.fromHex(14277081),secondaryButtonHover:i.fromHex(10724259),secondaryButtonDown:i.fromHex(9276813),secondaryButtonActive:i.fromHex(15132390),secondaryButtonText:i.fromHex(0),secondaryButtonStroke:i.fromHex(16777215),grid:i.fromHex(0),background:i.fromHex(16777215),alternativeBackground:i.fromHex(0),text:i.fromHex(0),alternativeText:i.fromHex(16777215),disabled:i.fromHex(11382189),positive:i.fromHex(5288704),negative:i.fromHex(11730944)});{const t=e("ColorSet");t.setAll({passOptions:{hue:.05,saturation:0,lightness:0},colors:[i.fromHex(6797276)],step:1,reuse:!1,startIndex:0}),t.setPrivate("currentStep",0),t.setPrivate("currentPass",0)}e("Entity").setAll({stateAnimationDuration:0,stateAnimationEasing:c(u)}),e("Component").setAll({interpolationDuration:0,interpolationEasing:c(u)}),e("Sprite").setAll({visible:!0,scale:1,opacity:1,rotation:0,position:"relative",tooltipX:n,tooltipY:n,tooltipPosition:"fixed",isMeasured:!0}),e("Sprite").states.create("default",{visible:!0,opacity:1}),e("Container").setAll({interactiveChildren:!0,setStateOnChildren:!1}),e("Graphics").setAll({strokeWidth:1}),e("Chart").setAll({width:r,height:r,interactiveChildren:!1}),e("Sprite",["horizontal","center"]).setAll({centerX:n,x:n}),e("Sprite",["vertical","center"]).setAll({centerY:n,y:n}),e("Container",["horizontal","layout"]).setAll({layout:d}),e("Container",["vertical","layout"]).setAll({layout:p}),e("Pattern").setAll({repetition:"repeat",width:50,height:50,rotation:0,fillOpacity:1}),e("LinePattern").setAll({gap:6,colorOpacity:1,width:49,height:49}),e("RectanglePattern").setAll({gap:6,checkered:!1,centered:!0,maxWidth:5,maxHeight:5,width:48,height:48,strokeWidth:0}),e("CirclePattern").setAll({gap:5,checkered:!1,centered:!1,radius:3,strokeWidth:0,width:45,height:45}),e("LinearGradient").setAll({rotation:90}),e("Legend").setAll({fillField:"fill",strokeField:"stroke",nameField:"name",layout:h.new(this._root,{}),layer:30,clickTarget:"itemContainer"}),e("Container",["legend","item","itemcontainer"]).setAll({paddingLeft:5,paddingRight:5,paddingBottom:5,paddingTop:5,layout:d,setStateOnChildren:!0,interactiveChildren:!1,ariaChecked:!0,focusable:!0,ariaLabel:s.translate("Press ENTER to toggle"),role:"checkbox"});{const t=e("Rectangle",["legend","item","background"]);t.setAll({fillOpacity:0}),a(t,"fill",o,"background")}e("Container",["legend","marker"]).setAll({setStateOnChildren:!0,centerY:n,paddingLeft:0,paddingRight:0,paddingBottom:0,paddingTop:0,width:18,height:18}),e("RoundedRectangle",["legend","marker","rectangle"]).setAll({width:r,height:r,cornerRadiusBL:3,cornerRadiusTL:3,cornerRadiusBR:3,cornerRadiusTR:3});{const t=e("RoundedRectangle",["legend","marker","rectangle"]).states.create("disabled",{});a(t,"fill",o,"disabled"),a(t,"stroke",o,"disabled")}e("Label",["legend","label"]).setAll({centerY:n,marginLeft:5,paddingRight:0,paddingLeft:0,paddingTop:0,paddingBottom:0,populateText:!0}),a(e("Label",["legend","label"]).states.create("disabled",{}),"fill",o,"disabled"),e("Label",["legend","value","label"]).setAll({centerY:n,marginLeft:5,paddingRight:0,paddingLeft:0,paddingTop:0,paddingBottom:0,width:50,centerX:r,populateText:!0}),a(e("Label",["legend","value","label"]).states.create("disabled",{}),"fill",o,"disabled"),e("HeatLegend").setAll({stepCount:1}),e("RoundedRectangle",["heatlegend","marker"]).setAll({cornerRadiusTR:0,cornerRadiusBR:0,cornerRadiusTL:0,cornerRadiusBL:0}),e("RoundedRectangle",["vertical","heatlegend","marker"]).setAll({height:r,width:15}),e("RoundedRectangle",["horizontal","heatlegend","marker"]).setAll({width:r,height:15}),e("HeatLegend",["vertical"]).setAll({height:r}),e("HeatLegend",["horizontal"]).setAll({width:r}),e("Label",["heatlegend","start"]).setAll({paddingLeft:5,paddingRight:5,paddingTop:5,paddingBottom:5}),e("Label",["heatlegend","end"]).setAll({paddingLeft:5,paddingRight:5,paddingTop:5,paddingBottom:5});{const t=e("Label");t.setAll({paddingTop:8,paddingBottom:8,paddingLeft:10,paddingRight:10,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontSize:"1em",populateText:!1}),a(t,"fill",o,"text")}e("RadialLabel").setAll({textType:"regular",centerY:n,centerX:n,inside:!1,radius:0,baseRadius:r,orientation:"auto",textAlign:"center"}),e("RoundedRectangle").setAll({cornerRadiusTL:8,cornerRadiusBL:8,cornerRadiusTR:8,cornerRadiusBR:8}),e("PointedRectangle").setAll({pointerBaseWidth:15,pointerLength:10,cornerRadius:8}),e("Slice").setAll({shiftRadius:0,dRadius:0,dInnerRadius:0});{const t=e("Tick");t.setAll({strokeOpacity:.15,isMeasured:!1,length:4.5,position:"absolute",crisp:!0}),a(t,"stroke",o,"grid")}e("Bullet").setAll({locationX:.5,locationY:.5}),e("Tooltip").setAll({position:"absolute",getFillFromSprite:!0,getStrokeFromSprite:!1,autoTextColor:!0,paddingTop:9,paddingBottom:8,paddingLeft:10,paddingRight:10,marginBottom:5,pointerOrientation:"vertical",centerX:n,centerY:n,animationEasing:c(u),exportable:!1}),e("Polygon").setAll({animationEasing:c(u)}),e("PointedRectangle",["tooltip","background"]).setAll({strokeOpacity:.9,cornerRadius:4,pointerLength:4,pointerBaseWidth:8,fillOpacity:.9,stroke:i.fromHex(16777215)});{const t=e("Label",["tooltip"]);t.setAll({role:"tooltip",populateText:!0,paddingRight:0,paddingTop:0,paddingLeft:0,paddingBottom:0}),a(t,"fill",o,"alternativeText")}e("Button").setAll({paddingTop:8,paddingBottom:8,paddingLeft:10,paddingRight:10,interactive:!0,layout:d,interactiveChildren:!1,setStateOnChildren:!0,focusable:!0}),e("Button").states.create("hover",{}),e("Button").states.create("down",{stateAnimationDuration:0}),e("Button").states.create("active",{});{const t=e("RoundedRectangle",["button","background"]);a(t,"fill",o,"primaryButton"),a(t,"stroke",o,"primaryButtonStroke")}a(e("RoundedRectangle",["button","background"]).states.create("hover",{}),"fill",o,"primaryButtonHover"),a(e("RoundedRectangle",["button","background"]).states.create("down",{stateAnimationDuration:0}),"fill",o,"primaryButtonDown"),a(e("RoundedRectangle",["button","background"]).states.create("active",{}),"fill",o,"primaryButtonActive"),a(e("Graphics",["button","icon"]),"stroke",o,"primaryButtonText"),a(e("Label",["button"]),"fill",o,"primaryButtonText"),e("Button",["zoom"]).setAll({paddingTop:18,paddingBottom:18,paddingLeft:12,paddingRight:12,centerX:46,centerY:-10,y:0,x:r,role:"button",ariaLabel:s.translate("Zoom Out"),layer:30});{const t=e("RoundedRectangle",["background","button","zoom"]);t.setAll({cornerRadiusBL:40,cornerRadiusBR:40,cornerRadiusTL:40,cornerRadiusTR:40}),a(t,"fill",o,"primaryButton")}a(e("RoundedRectangle",["background","button","zoom"]).states.create("hover",{}),"fill",o,"primaryButtonHover"),a(e("RoundedRectangle",["background","button","zoom"]).states.create("down",{stateAnimationDuration:0}),"fill",o,"primaryButtonDown");{const t=e("Graphics",["icon","button","zoom"]);t.setAll({crisp:!0,strokeOpacity:.7,draw:l=>{l.moveTo(0,0),l.lineTo(12,0)}}),a(t,"stroke",o,"primaryButtonText")}e("Button",["resize"]).setAll({paddingTop:9,paddingBottom:9,paddingLeft:13,paddingRight:13,draggable:!0,centerX:n,centerY:n,position:"absolute",role:"slider",ariaValueMin:"0",ariaValueMax:"100",ariaLabel:s.translate("Use up and down arrows to move selection")});{const t=e("RoundedRectangle",["background","resize","button"]);t.setAll({cornerRadiusBL:40,cornerRadiusBR:40,cornerRadiusTL:40,cornerRadiusTR:40}),a(t,"fill",o,"secondaryButton"),a(t,"stroke",o,"secondaryButtonStroke")}a(e("RoundedRectangle",["background","resize","button"]).states.create("hover",{}),"fill",o,"secondaryButtonHover"),a(e("RoundedRectangle",["background","resize","button"]).states.create("down",{stateAnimationDuration:0}),"fill",o,"secondaryButtonDown");{const t=e("Graphics",["resize","button","icon"]);t.setAll({interactive:!1,crisp:!0,strokeOpacity:.5,draw:l=>{l.moveTo(0,.5),l.lineTo(0,12.5),l.moveTo(4,.5),l.lineTo(4,12.5)}}),a(t,"stroke",o,"secondaryButtonText")}e("Button",["resize","vertical"]).setAll({rotation:90,cursorOverStyle:"ns-resize"}),e("Button",["resize","horizontal"]).setAll({cursorOverStyle:"ew-resize"}),e("Button",["play"]).setAll({paddingTop:13,paddingBottom:13,paddingLeft:14,paddingRight:14,ariaLabel:s.translate("Play"),toggleKey:"active"});{const t=e("RoundedRectangle",["play","background"]);t.setAll({strokeOpacity:.5,cornerRadiusBL:100,cornerRadiusBR:100,cornerRadiusTL:100,cornerRadiusTR:100}),a(t,"fill",o,"primaryButton")}{const t=e("Graphics",["play","icon"]);t.setAll({stateAnimationDuration:0,dx:1,draw:l=>{l.moveTo(0,-5),l.lineTo(8,0),l.lineTo(0,5),l.lineTo(0,-5)}}),a(t,"fill",o,"primaryButtonText")}e("Graphics",["play","icon"]).states.create("default",{stateAnimationDuration:0}),e("Graphics",["play","icon"]).states.create("active",{stateAnimationDuration:0,draw:t=>{t.moveTo(-4,-5),t.lineTo(-1,-5),t.lineTo(-1,5),t.lineTo(-4,5),t.lineTo(-4,-5),t.moveTo(4,-5),t.lineTo(1,-5),t.lineTo(1,5),t.lineTo(4,5),t.lineTo(4,-5)}}),e("Button",["switch"]).setAll({paddingTop:4,paddingBottom:4,paddingLeft:4,paddingRight:4,ariaLabel:s.translate("Press ENTER to toggle"),toggleKey:"active",width:40,height:24,layout:null});{const t=e("RoundedRectangle",["switch","background"]);t.setAll({strokeOpacity:.5,cornerRadiusBL:100,cornerRadiusBR:100,cornerRadiusTL:100,cornerRadiusTR:100}),a(t,"fill",o,"primaryButton")}{const t=e("Circle",["switch","icon"]);t.setAll({radius:8,centerY:0,centerX:0,dx:0}),a(t,"fill",o,"primaryButtonText")}e("Graphics",["switch","icon"]).states.create("active",{dx:16}),e("Scrollbar").setAll({start:0,end:1,layer:30,animationEasing:c(u)}),e("Scrollbar",["vertical"]).setAll({marginRight:13,marginLeft:13,minWidth:12,height:r}),e("Scrollbar",["horizontal"]).setAll({marginTop:13,marginBottom:13,minHeight:12,width:r}),this.rule("Button",["scrollbar"]).setAll({exportable:!1});{const t=e("RoundedRectangle",["scrollbar","main","background"]);t.setAll({cornerRadiusTL:8,cornerRadiusBL:8,cornerRadiusTR:8,cornerRadiusBR:8,fillOpacity:.8}),a(t,"fill",o,"fill")}{const t=e("RoundedRectangle",["scrollbar","thumb"]);t.setAll({role:"slider",ariaLive:"polite",position:"absolute",draggable:!0}),a(t,"fill",o,"secondaryButton")}a(e("RoundedRectangle",["scrollbar","thumb"]).states.create("hover",{}),"fill",o,"secondaryButtonHover"),a(e("RoundedRectangle",["scrollbar","thumb"]).states.create("down",{stateAnimationDuration:0}),"fill",o,"secondaryButtonDown"),e("RoundedRectangle",["scrollbar","thumb","vertical"]).setAll({x:n,width:r,centerX:n,ariaLabel:s.translate("Use up and down arrows to move selection")}),e("RoundedRectangle",["scrollbar","thumb","horizontal"]).setAll({y:n,centerY:n,height:r,ariaLabel:s.translate("Use left and right arrows to move selection")});{const t=e("PointedRectangle",["axis","tooltip","background"]);t.setAll({cornerRadius:0}),a(t,"fill",o,"alternativeBackground")}e("Label",["axis","tooltip"]).setAll({role:void 0}),e("Label",["axis","tooltip","y"]).setAll({textAlign:"right"}),e("Label",["axis","tooltip","y","opposite"]).setAll({textAlign:"left"}),e("Label",["axis","tooltip","x"]).setAll({textAlign:"center"}),e("Tooltip",["categoryaxis"]).setAll({labelText:"{category}"}),e("Star").setAll({spikes:5,innerRadius:5,radius:10}),e("Tooltip",["stock"]).setAll({paddingTop:6,paddingBottom:5,paddingLeft:7,paddingRight:7}),e("PointedRectangle",["tooltip","stock","axis"]).setAll({pointerLength:0,pointerBaseWidth:0,cornerRadius:3}),e("Label",["tooltip","stock"]).setAll({fontSize:"0.8em"}),e("SpriteResizer").setAll({rotationStep:10}),e("Container",["resizer","grip"]).states.create("hover",{});{const t=e("RoundedRectangle",["resizer","grip"]);t.setAll({strokeOpacity:.7,strokeWidth:1,fillOpacity:1,width:12,height:12}),a(t,"fill",o,"background"),a(t,"stroke",o,"alternativeBackground")}{const t=e("RoundedRectangle",["resizer","grip","outline"]);t.setAll({strokeOpacity:0,fillOpacity:0,width:20,height:20}),t.states.create("hover",{fillOpacity:.3}),a(t,"fill",o,"alternativeBackground")}e("RoundedRectangle",["resizer","grip","left"]).setAll({cornerRadiusBL:0,cornerRadiusBR:0,cornerRadiusTL:0,cornerRadiusTR:0}),e("RoundedRectangle",["resizer","grip","right"]).setAll({cornerRadiusBL:0,cornerRadiusBR:0,cornerRadiusTL:0,cornerRadiusTR:0});{const t=e("Rectangle",["resizer","rectangle"]);t.setAll({strokeDasharray:[2,2],strokeOpacity:.5,strokeWidth:1}),a(t,"stroke",o,"alternativeBackground")}}}export{a as l,A as s}; +import{i as R,Z as i,x as c,X as n,Y as r,A as h,C as u}from"./Theme-5CV7oVsW.js";function a(g,s,o,d){g.set(s,o.get(d)),o.on(d,p=>{g.set(s,p)})}class A extends R{setupDefaultRules(){super.setupDefaultRules();const s=this._root.language,o=this._root.interfaceColors,d=this._root.horizontalLayout,p=this._root.verticalLayout,e=this.rule.bind(this);e("InterfaceColors").setAll({stroke:i.fromHex(15066597),fill:i.fromHex(15987699),primaryButton:i.fromHex(6788316),primaryButtonHover:i.fromHex(6779356),primaryButtonDown:i.fromHex(6872182),primaryButtonActive:i.fromHex(6872182),primaryButtonText:i.fromHex(16777215),primaryButtonStroke:i.fromHex(16777215),secondaryButton:i.fromHex(14277081),secondaryButtonHover:i.fromHex(10724259),secondaryButtonDown:i.fromHex(9276813),secondaryButtonActive:i.fromHex(15132390),secondaryButtonText:i.fromHex(0),secondaryButtonStroke:i.fromHex(16777215),grid:i.fromHex(0),background:i.fromHex(16777215),alternativeBackground:i.fromHex(0),text:i.fromHex(0),alternativeText:i.fromHex(16777215),disabled:i.fromHex(11382189),positive:i.fromHex(5288704),negative:i.fromHex(11730944)});{const t=e("ColorSet");t.setAll({passOptions:{hue:.05,saturation:0,lightness:0},colors:[i.fromHex(6797276)],step:1,reuse:!1,startIndex:0}),t.setPrivate("currentStep",0),t.setPrivate("currentPass",0)}e("Entity").setAll({stateAnimationDuration:0,stateAnimationEasing:c(u)}),e("Component").setAll({interpolationDuration:0,interpolationEasing:c(u)}),e("Sprite").setAll({visible:!0,scale:1,opacity:1,rotation:0,position:"relative",tooltipX:n,tooltipY:n,tooltipPosition:"fixed",isMeasured:!0}),e("Sprite").states.create("default",{visible:!0,opacity:1}),e("Container").setAll({interactiveChildren:!0,setStateOnChildren:!1}),e("Graphics").setAll({strokeWidth:1}),e("Chart").setAll({width:r,height:r,interactiveChildren:!1}),e("Sprite",["horizontal","center"]).setAll({centerX:n,x:n}),e("Sprite",["vertical","center"]).setAll({centerY:n,y:n}),e("Container",["horizontal","layout"]).setAll({layout:d}),e("Container",["vertical","layout"]).setAll({layout:p}),e("Pattern").setAll({repetition:"repeat",width:50,height:50,rotation:0,fillOpacity:1}),e("LinePattern").setAll({gap:6,colorOpacity:1,width:49,height:49}),e("RectanglePattern").setAll({gap:6,checkered:!1,centered:!0,maxWidth:5,maxHeight:5,width:48,height:48,strokeWidth:0}),e("CirclePattern").setAll({gap:5,checkered:!1,centered:!1,radius:3,strokeWidth:0,width:45,height:45}),e("LinearGradient").setAll({rotation:90}),e("Legend").setAll({fillField:"fill",strokeField:"stroke",nameField:"name",layout:h.new(this._root,{}),layer:30,clickTarget:"itemContainer"}),e("Container",["legend","item","itemcontainer"]).setAll({paddingLeft:5,paddingRight:5,paddingBottom:5,paddingTop:5,layout:d,setStateOnChildren:!0,interactiveChildren:!1,ariaChecked:!0,focusable:!0,ariaLabel:s.translate("Press ENTER to toggle"),role:"checkbox"});{const t=e("Rectangle",["legend","item","background"]);t.setAll({fillOpacity:0}),a(t,"fill",o,"background")}e("Container",["legend","marker"]).setAll({setStateOnChildren:!0,centerY:n,paddingLeft:0,paddingRight:0,paddingBottom:0,paddingTop:0,width:18,height:18}),e("RoundedRectangle",["legend","marker","rectangle"]).setAll({width:r,height:r,cornerRadiusBL:3,cornerRadiusTL:3,cornerRadiusBR:3,cornerRadiusTR:3});{const t=e("RoundedRectangle",["legend","marker","rectangle"]).states.create("disabled",{});a(t,"fill",o,"disabled"),a(t,"stroke",o,"disabled")}e("Label",["legend","label"]).setAll({centerY:n,marginLeft:5,paddingRight:0,paddingLeft:0,paddingTop:0,paddingBottom:0,populateText:!0}),a(e("Label",["legend","label"]).states.create("disabled",{}),"fill",o,"disabled"),e("Label",["legend","value","label"]).setAll({centerY:n,marginLeft:5,paddingRight:0,paddingLeft:0,paddingTop:0,paddingBottom:0,width:50,centerX:r,populateText:!0}),a(e("Label",["legend","value","label"]).states.create("disabled",{}),"fill",o,"disabled"),e("HeatLegend").setAll({stepCount:1}),e("RoundedRectangle",["heatlegend","marker"]).setAll({cornerRadiusTR:0,cornerRadiusBR:0,cornerRadiusTL:0,cornerRadiusBL:0}),e("RoundedRectangle",["vertical","heatlegend","marker"]).setAll({height:r,width:15}),e("RoundedRectangle",["horizontal","heatlegend","marker"]).setAll({width:r,height:15}),e("HeatLegend",["vertical"]).setAll({height:r}),e("HeatLegend",["horizontal"]).setAll({width:r}),e("Label",["heatlegend","start"]).setAll({paddingLeft:5,paddingRight:5,paddingTop:5,paddingBottom:5}),e("Label",["heatlegend","end"]).setAll({paddingLeft:5,paddingRight:5,paddingTop:5,paddingBottom:5});{const t=e("Label");t.setAll({paddingTop:8,paddingBottom:8,paddingLeft:10,paddingRight:10,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',fontSize:"1em",populateText:!1}),a(t,"fill",o,"text")}e("RadialLabel").setAll({textType:"regular",centerY:n,centerX:n,inside:!1,radius:0,baseRadius:r,orientation:"auto",textAlign:"center"}),e("RoundedRectangle").setAll({cornerRadiusTL:8,cornerRadiusBL:8,cornerRadiusTR:8,cornerRadiusBR:8}),e("PointedRectangle").setAll({pointerBaseWidth:15,pointerLength:10,cornerRadius:8}),e("Slice").setAll({shiftRadius:0,dRadius:0,dInnerRadius:0});{const t=e("Tick");t.setAll({strokeOpacity:.15,isMeasured:!1,length:4.5,position:"absolute",crisp:!0}),a(t,"stroke",o,"grid")}e("Bullet").setAll({locationX:.5,locationY:.5}),e("Tooltip").setAll({position:"absolute",getFillFromSprite:!0,getStrokeFromSprite:!1,autoTextColor:!0,paddingTop:9,paddingBottom:8,paddingLeft:10,paddingRight:10,marginBottom:5,pointerOrientation:"vertical",centerX:n,centerY:n,animationEasing:c(u),exportable:!1}),e("Polygon").setAll({animationEasing:c(u)}),e("PointedRectangle",["tooltip","background"]).setAll({strokeOpacity:.9,cornerRadius:4,pointerLength:4,pointerBaseWidth:8,fillOpacity:.9,stroke:i.fromHex(16777215)});{const t=e("Label",["tooltip"]);t.setAll({role:"tooltip",populateText:!0,paddingRight:0,paddingTop:0,paddingLeft:0,paddingBottom:0}),a(t,"fill",o,"alternativeText")}e("Button").setAll({paddingTop:8,paddingBottom:8,paddingLeft:10,paddingRight:10,interactive:!0,layout:d,interactiveChildren:!1,setStateOnChildren:!0,focusable:!0}),e("Button").states.create("hover",{}),e("Button").states.create("down",{stateAnimationDuration:0}),e("Button").states.create("active",{});{const t=e("RoundedRectangle",["button","background"]);a(t,"fill",o,"primaryButton"),a(t,"stroke",o,"primaryButtonStroke")}a(e("RoundedRectangle",["button","background"]).states.create("hover",{}),"fill",o,"primaryButtonHover"),a(e("RoundedRectangle",["button","background"]).states.create("down",{stateAnimationDuration:0}),"fill",o,"primaryButtonDown"),a(e("RoundedRectangle",["button","background"]).states.create("active",{}),"fill",o,"primaryButtonActive"),a(e("Graphics",["button","icon"]),"stroke",o,"primaryButtonText"),a(e("Label",["button"]),"fill",o,"primaryButtonText"),e("Button",["zoom"]).setAll({paddingTop:18,paddingBottom:18,paddingLeft:12,paddingRight:12,centerX:46,centerY:-10,y:0,x:r,role:"button",ariaLabel:s.translate("Zoom Out"),layer:30});{const t=e("RoundedRectangle",["background","button","zoom"]);t.setAll({cornerRadiusBL:40,cornerRadiusBR:40,cornerRadiusTL:40,cornerRadiusTR:40}),a(t,"fill",o,"primaryButton")}a(e("RoundedRectangle",["background","button","zoom"]).states.create("hover",{}),"fill",o,"primaryButtonHover"),a(e("RoundedRectangle",["background","button","zoom"]).states.create("down",{stateAnimationDuration:0}),"fill",o,"primaryButtonDown");{const t=e("Graphics",["icon","button","zoom"]);t.setAll({crisp:!0,strokeOpacity:.7,draw:l=>{l.moveTo(0,0),l.lineTo(12,0)}}),a(t,"stroke",o,"primaryButtonText")}e("Button",["resize"]).setAll({paddingTop:9,paddingBottom:9,paddingLeft:13,paddingRight:13,draggable:!0,centerX:n,centerY:n,position:"absolute",role:"slider",ariaValueMin:"0",ariaValueMax:"100",ariaLabel:s.translate("Use up and down arrows to move selection")});{const t=e("RoundedRectangle",["background","resize","button"]);t.setAll({cornerRadiusBL:40,cornerRadiusBR:40,cornerRadiusTL:40,cornerRadiusTR:40}),a(t,"fill",o,"secondaryButton"),a(t,"stroke",o,"secondaryButtonStroke")}a(e("RoundedRectangle",["background","resize","button"]).states.create("hover",{}),"fill",o,"secondaryButtonHover"),a(e("RoundedRectangle",["background","resize","button"]).states.create("down",{stateAnimationDuration:0}),"fill",o,"secondaryButtonDown");{const t=e("Graphics",["resize","button","icon"]);t.setAll({interactive:!1,crisp:!0,strokeOpacity:.5,draw:l=>{l.moveTo(0,.5),l.lineTo(0,12.5),l.moveTo(4,.5),l.lineTo(4,12.5)}}),a(t,"stroke",o,"secondaryButtonText")}e("Button",["resize","vertical"]).setAll({rotation:90,cursorOverStyle:"ns-resize"}),e("Button",["resize","horizontal"]).setAll({cursorOverStyle:"ew-resize"}),e("Button",["play"]).setAll({paddingTop:13,paddingBottom:13,paddingLeft:14,paddingRight:14,ariaLabel:s.translate("Play"),toggleKey:"active"});{const t=e("RoundedRectangle",["play","background"]);t.setAll({strokeOpacity:.5,cornerRadiusBL:100,cornerRadiusBR:100,cornerRadiusTL:100,cornerRadiusTR:100}),a(t,"fill",o,"primaryButton")}{const t=e("Graphics",["play","icon"]);t.setAll({stateAnimationDuration:0,dx:1,draw:l=>{l.moveTo(0,-5),l.lineTo(8,0),l.lineTo(0,5),l.lineTo(0,-5)}}),a(t,"fill",o,"primaryButtonText")}e("Graphics",["play","icon"]).states.create("default",{stateAnimationDuration:0}),e("Graphics",["play","icon"]).states.create("active",{stateAnimationDuration:0,draw:t=>{t.moveTo(-4,-5),t.lineTo(-1,-5),t.lineTo(-1,5),t.lineTo(-4,5),t.lineTo(-4,-5),t.moveTo(4,-5),t.lineTo(1,-5),t.lineTo(1,5),t.lineTo(4,5),t.lineTo(4,-5)}}),e("Button",["switch"]).setAll({paddingTop:4,paddingBottom:4,paddingLeft:4,paddingRight:4,ariaLabel:s.translate("Press ENTER to toggle"),toggleKey:"active",width:40,height:24,layout:null});{const t=e("RoundedRectangle",["switch","background"]);t.setAll({strokeOpacity:.5,cornerRadiusBL:100,cornerRadiusBR:100,cornerRadiusTL:100,cornerRadiusTR:100}),a(t,"fill",o,"primaryButton")}{const t=e("Circle",["switch","icon"]);t.setAll({radius:8,centerY:0,centerX:0,dx:0}),a(t,"fill",o,"primaryButtonText")}e("Graphics",["switch","icon"]).states.create("active",{dx:16}),e("Scrollbar").setAll({start:0,end:1,layer:30,animationEasing:c(u)}),e("Scrollbar",["vertical"]).setAll({marginRight:13,marginLeft:13,minWidth:12,height:r}),e("Scrollbar",["horizontal"]).setAll({marginTop:13,marginBottom:13,minHeight:12,width:r}),this.rule("Button",["scrollbar"]).setAll({exportable:!1});{const t=e("RoundedRectangle",["scrollbar","main","background"]);t.setAll({cornerRadiusTL:8,cornerRadiusBL:8,cornerRadiusTR:8,cornerRadiusBR:8,fillOpacity:.8}),a(t,"fill",o,"fill")}{const t=e("RoundedRectangle",["scrollbar","thumb"]);t.setAll({role:"slider",ariaLive:"polite",position:"absolute",draggable:!0}),a(t,"fill",o,"secondaryButton")}a(e("RoundedRectangle",["scrollbar","thumb"]).states.create("hover",{}),"fill",o,"secondaryButtonHover"),a(e("RoundedRectangle",["scrollbar","thumb"]).states.create("down",{stateAnimationDuration:0}),"fill",o,"secondaryButtonDown"),e("RoundedRectangle",["scrollbar","thumb","vertical"]).setAll({x:n,width:r,centerX:n,ariaLabel:s.translate("Use up and down arrows to move selection")}),e("RoundedRectangle",["scrollbar","thumb","horizontal"]).setAll({y:n,centerY:n,height:r,ariaLabel:s.translate("Use left and right arrows to move selection")});{const t=e("PointedRectangle",["axis","tooltip","background"]);t.setAll({cornerRadius:0}),a(t,"fill",o,"alternativeBackground")}e("Label",["axis","tooltip"]).setAll({role:void 0}),e("Label",["axis","tooltip","y"]).setAll({textAlign:"right"}),e("Label",["axis","tooltip","y","opposite"]).setAll({textAlign:"left"}),e("Label",["axis","tooltip","x"]).setAll({textAlign:"center"}),e("Tooltip",["categoryaxis"]).setAll({labelText:"{category}"}),e("Star").setAll({spikes:5,innerRadius:5,radius:10}),e("Tooltip",["stock"]).setAll({paddingTop:6,paddingBottom:5,paddingLeft:7,paddingRight:7}),e("PointedRectangle",["tooltip","stock","axis"]).setAll({pointerLength:0,pointerBaseWidth:0,cornerRadius:3}),e("Label",["tooltip","stock"]).setAll({fontSize:"0.8em"}),e("SpriteResizer").setAll({rotationStep:10}),e("Container",["resizer","grip"]).states.create("hover",{});{const t=e("RoundedRectangle",["resizer","grip"]);t.setAll({strokeOpacity:.7,strokeWidth:1,fillOpacity:1,width:12,height:12}),a(t,"fill",o,"background"),a(t,"stroke",o,"alternativeBackground")}{const t=e("RoundedRectangle",["resizer","grip","outline"]);t.setAll({strokeOpacity:0,fillOpacity:0,width:20,height:20}),t.states.create("hover",{fillOpacity:.3}),a(t,"fill",o,"alternativeBackground")}e("RoundedRectangle",["resizer","grip","left"]).setAll({cornerRadiusBL:0,cornerRadiusBR:0,cornerRadiusTL:0,cornerRadiusTR:0}),e("RoundedRectangle",["resizer","grip","right"]).setAll({cornerRadiusBL:0,cornerRadiusBR:0,cornerRadiusTL:0,cornerRadiusTR:0});{const t=e("Rectangle",["resizer","rectangle"]);t.setAll({strokeDasharray:[2,2],strokeOpacity:.5,strokeWidth:1}),a(t,"stroke",o,"alternativeBackground")}}}export{a as l,A as s}; diff --git a/dist/assets/DefinitionExpressionSceneLayerView-oAOUEjm-.js b/dist/assets/DefinitionExpressionSceneLayerView-Z1V4X6Kq.js similarity index 93% rename from dist/assets/DefinitionExpressionSceneLayerView-oAOUEjm-.js rename to dist/assets/DefinitionExpressionSceneLayerView-Z1V4X6Kq.js index a32019a..59d5dc7 100644 --- a/dist/assets/DefinitionExpressionSceneLayerView-oAOUEjm-.js +++ b/dist/assets/DefinitionExpressionSceneLayerView-Z1V4X6Kq.js @@ -1 +1 @@ -import{e as o,y as a,c as d,Z as t,jV as l}from"./index-J0iiHjMT.js";import{x as f}from"./WhereClause-XAMIZ4-B.js";const h="updating";function x(s){return s==="updating"?null:s}function g(s){return s==="updating"}const c=s=>{let n=class extends s{constructor(){super(...arguments),this._definitionExpressionErrors=0,this._maxDefinitionExpressionErrors=20,this.logError=r=>{this._definitionExpressionErrors0?(t.getLogger(this).error(`definitionExpression references unknown fields: ${i.join(", ")}`),null):(this._definitionExpressionErrors=0,e)}catch(e){return t.getLogger(this).error("Failed to parse definitionExpression: "+e),null}}get definitionExpressionFields(){return this.parsedDefinitionExpression?this.parsedDefinitionExpression.fieldNames:[]}_evaluateClause(r,e){try{return r.testFeature(e)}catch(i){return this.logError(i),!1}}_addDefinitionExpressionToQuery(r){if(!this.parsedDefinitionExpression)return r;const e=this.i3slayer.definitionExpression,i=r.clone();return i.where?i.where=`(${e}) AND (${i.where})`:i.where=e,i}};return o([a()],n.prototype,"i3slayer",void 0),o([a({readOnly:!0})],n.prototype,"parsedDefinitionExpression",null),o([a({readOnly:!0})],n.prototype,"definitionExpressionFields",null),n=o([d("esri.views.3d.layers.support.DefinitionExpressionSceneLayerView")],n),n};export{x as a,h as n,c as t,g as u}; +import{e as o,y as a,c as d,R as t,k0 as l}from"./index-pCX-0tJH.js";import{x as f}from"./WhereClause-FOYoIAAW.js";const h="updating";function x(s){return s==="updating"?null:s}function g(s){return s==="updating"}const c=s=>{let n=class extends s{constructor(){super(...arguments),this._definitionExpressionErrors=0,this._maxDefinitionExpressionErrors=20,this.logError=r=>{this._definitionExpressionErrors0?(t.getLogger(this).error(`definitionExpression references unknown fields: ${i.join(", ")}`),null):(this._definitionExpressionErrors=0,e)}catch(e){return t.getLogger(this).error("Failed to parse definitionExpression: "+e),null}}get definitionExpressionFields(){return this.parsedDefinitionExpression?this.parsedDefinitionExpression.fieldNames:[]}_evaluateClause(r,e){try{return r.testFeature(e)}catch(i){return this.logError(i),!1}}_addDefinitionExpressionToQuery(r){if(!this.parsedDefinitionExpression)return r;const e=this.i3slayer.definitionExpression,i=r.clone();return i.where?i.where=`(${e}) AND (${i.where})`:i.where=e,i}};return o([a()],n.prototype,"i3slayer",void 0),o([a({readOnly:!0})],n.prototype,"parsedDefinitionExpression",null),o([a({readOnly:!0})],n.prototype,"definitionExpressionFields",null),n=o([d("esri.views.3d.layers.support.DefinitionExpressionSceneLayerView")],n),n};export{x as a,h as n,c as t,g as u}; diff --git a/dist/assets/DeleteForwardEditsParameters-DGoRlX6R.js b/dist/assets/DeleteForwardEditsParameters-ZTiTrFCh.js similarity index 73% rename from dist/assets/DeleteForwardEditsParameters-DGoRlX6R.js rename to dist/assets/DeleteForwardEditsParameters-ZTiTrFCh.js index e48f84e..3efde3e 100644 --- a/dist/assets/DeleteForwardEditsParameters-DGoRlX6R.js +++ b/dist/assets/DeleteForwardEditsParameters-ZTiTrFCh.js @@ -1 +1 @@ -import{e as s,y as r,c as n,dr as m,g0 as p}from"./index-J0iiHjMT.js";var o;let e=o=class extends m{static from(t){return p(o,t)}constructor(t){super(t),this.sessionId=void 0,this.moment=null}};s([r({type:String,json:{write:!0}})],e.prototype,"sessionId",void 0),s([r({type:Date,json:{type:Number,write:{writer:(t,i)=>{i.moment=t?t.getTime():null}}}})],e.prototype,"moment",void 0),e=o=s([n("esri.rest.versionManagement.gdbVersion.support.PostParameters")],e);const d=e;export{d as default}; +import{e as s,y as r,c as n,dr as m,fY as p}from"./index-pCX-0tJH.js";var o;let e=o=class extends m{static from(t){return p(o,t)}constructor(t){super(t),this.sessionId=void 0,this.moment=null}};s([r({type:String,json:{write:!0}})],e.prototype,"sessionId",void 0),s([r({type:Date,json:{type:Number,write:{writer:(t,i)=>{i.moment=t?t.getTime():null}}}})],e.prototype,"moment",void 0),e=o=s([n("esri.rest.versionManagement.gdbVersion.support.PostParameters")],e);const d=e;export{d as default}; diff --git a/dist/assets/DimensionAnalysisView3D-W2fgoQBr.js b/dist/assets/DimensionAnalysisView3D-6H84TLcJ.js similarity index 82% rename from dist/assets/DimensionAnalysisView3D-W2fgoQBr.js rename to dist/assets/DimensionAnalysisView3D-6H84TLcJ.js index 1aed901..d8fc8c3 100644 --- a/dist/assets/DimensionAnalysisView3D-W2fgoQBr.js +++ b/dist/assets/DimensionAnalysisView3D-6H84TLcJ.js @@ -1 +1 @@ -import{rh as Ht,ri as zt,cz as tt,aa as b,aE as T,br as g,nw as Rt,o3 as Le,pl as Ge,h9 as Ie,q3 as k,aG as F,ax as E,pU as it,bv as X,aF as kt,bA as De,cM as de,an as Y,rj as Ue,bB as Vt,cP as Me,e as d,y as u,c as G,p as Z,rk as fe,fw as ae,rl as Et,d as v,A as x,hx as Lt,Z as nt,ab as j,hS as Gt,kz as It,q8 as at,i3 as Ut,b8 as ee,au as se,rm as R,ou as Ft,P as te,rn as jt,gO as A,T as W,iC as we,aV as Pe,aT as be,aU as st,o1 as Fe,aq as ot,ro as Bt,aQ as rt,bx as lt,as as dt,b2 as P,b6 as q,b1 as ce,cQ as qt,ag as Nt,by as Wt,bf as je,bz as Be,kn as ct,k as Xt,gD as Zt,kZ as ue,C as Ce,nn as Kt,ao as qe,n as Te,F as xe,rp as Oe,aX as Qt,aY as Yt,a2 as ut,X as Ne,rq as Jt,ak as ei,nZ as ti,bw as ii,rr as pt,i7 as ni,i8 as ai,rs as si,o8 as K,kx as oi,kw as ri,V as li,a as We}from"./index-J0iiHjMT.js";import{s as di}from"./AnalysisView3D-jkk3JIRT.js";import{t as _,r as ci,u as ui}from"./LengthDimension-A_HnPDNi.js";import{m as B,g as pi}from"./Segment-hN2uWAPW.js";import{x as mi,z as hi}from"./euclideanLengthMeasurementUtils-VQw5qWk6.js";import{$ as _e,w as gi,e as H,D as mt,F as fi,M as Ae,O as re}from"./ShadedColorMaterial.glsl-Fp4o6LjC.js";import{F as _i,H as ht,A as He}from"./dragEventPipeline3D-4CqrlxD2.js";import{g as gt}from"./ImageMaterial.glsl-TdPtjVc_.js";import{d as oe,R as ze,U as vi}from"./InteractiveToolBase-WDic4GPF.js";import{l as yi}from"./Factory-m-O4WAoG.js";import{O as Si}from"./SnappingVisualizer3D-KWlqByBu.js";import{u as I,r as Mi,t as wi}from"./LineVisualElement-4BP10o6v.js";import{d as Pi}from"./VerticesVisualElement-oQAA_hbc.js";import{V as bi,p as Ci,w as Oi}from"./EditGeometryOperations-TPE5Wzab.js";import{a as $i}from"./SceneSnappingManagerPool-OpebO9Di.js";import{e as Di}from"./SnappingContext-6K6JmvvY.js";import{f as Ti}from"./SnappingDragPipelineStep-THHIXt-p.js";import{p as xi}from"./SnappingOperation-2U48wt1k.js";import{a as Ai}from"./AnalysisToolBase-3A13PdgS.js";import{h as Hi}from"./quantityFormatUtils-NiAiojad.js";import{r as zi,t as Ri}from"./vec4f32-NvfHy9q7.js";import{a as ki}from"./Object3DVisualElement-TMb7y_wl.js";import{a as Vi,v as Ei,l as Li}from"./analysisViewUtils-AQaQeJpR.js";import"./VisualElement-kjYXz27t.js";import"./TextOverlayItem-eCjvS6IO.js";import"./measurementUtils-84-ZBArh.js";import"./drawUtils-woTYaREB.js";import"./ExtendedLineVisualElement-YbjiXiBG.js";import"./EngineVisualElement-eZNKTKsI.js";import"./Laserlines.glsl-nvjcCsAw.js";import"./PointVisualElement-bX-_4FqS.js";import"./RightAngleQuadVisualElement-y_W8r903.js";import"./PointSnappingHint-ULetRXiW.js";import"./dehydratedFeatureComparison-hdPq-zad.js";function Gi(e,t,i){if(e==null)return null;const n=e.dimensionSegment.startRenderSpace,a=e.dimensionSegment.endRenderSpace,s=mi(n,a,e.spatialReference);if(s==null)return null;const o=t===_.Vertical?Ht(s.value,s.unit,i):zt(s.value,s.unit,i);return tt(s,o)}function pe(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:i,dimension:{offset:n,measureType:a,orientation:s}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:i,offset:n,measureType:a,orientation:s}}function me({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,offset:i,measureType:n,orientation:a},s,o=null){if(e==null||t==null)return null;const l=_t(o!=null?o.directSegment:new B,{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t},s),r=o!=null?o.primaryOffsetAxis:b();ve(r,{measureType:n,elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,directSegment:l,orientation:a,renderCoordsHelper:s});const c=o!=null?o.dimensionSegment:new B;return Re({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t})&&n===_.Vertical?(T(c.startRenderSpace,l.startRenderSpace),T(c.endRenderSpace,l.endRenderSpace)):vt(c,{offsetAxis:r,offset:i,relativeToSegment:l,renderCoordsHelper:s}),{directSegment:l,dimensionSegment:c,primaryOffsetAxis:r,spatialReference:s.spatialReference}}function Xe(e,t,i,n){return t===ie.Start?(T(e.startRenderSpace,i.startRenderSpace),T(e.endRenderSpace,n.startRenderSpace)):(T(e.startRenderSpace,i.endRenderSpace),T(e.endRenderSpace,n.endRenderSpace)),e}var ie;function Ii(e,t,i,n){de(e.startRenderSpace,t.startRenderSpace,i,n),de(e.endRenderSpace,t.endRenderSpace,i,n)}function ft(e,t,i,n){switch(t){case _.Direct:return _t(e,i,n);case _.Horizontal:case _.Vertical:{const{elevationAlignedStartPoint:a,elevationAlignedEndPoint:s,dimension:o,geometry:l}=i;let r;o.measureType===_.Direct?(r=Ui(l,n)===a.z>s.z,t===_.Horizontal&&(r=!r)):r=!Fi(l);const[c,p]=r?[a,s]:[s,a],h=Y(p,ji);return t===_.Horizontal?h.z=c.z:(h.x=c.x,h.y=c.y),n.toRenderCoords(c,e.startRenderSpace),n.toRenderCoords(h,e.endRenderSpace),e}}}function _t(e,t,i){return i.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),i.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function Ui(e,t){const i=e.directSegment.eval(.5,g.get()),n=t.worldUpAtPosition(i,g.get()),a=e.dimensionSegment.eval(.5,g.get()),s=k(g.get(),a,i);return!it(s,X)&&E(s,n)>0}function Fi(e){const{startRenderSpace:t,endRenderSpace:i}=e.dimensionSegment,{startRenderSpace:n,endRenderSpace:a}=e.directSegment;return Ue(n,t)s?[o,n]:[n,o]}function ye(e,t,i){const n=t.directSegment.eval(.5,g.get());return i.worldUpAtPosition(n,e)}function ke(e,t){const{startRenderSpace:i,endRenderSpace:n}=t.directSegment;return k(e,n,i)}function Ve(e,t,i={invert:!1}){const{startRenderSpace:n,endRenderSpace:a}=t.dimensionSegment;return i.invert?k(e,n,a):k(e,a,n)}function $e(e,t){const i=e.directSegment.eval(.5,g.get());return t.headingAtPosition(i,e.primaryOffsetAxis)}function Wi(e,t){return Me(Ve(Xi,e))/t**2}const Xi=b();function yt(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:i}=e;if(t==null||i==null)return!1;const n=hi(t,i);return n!=null&&tt(n,"meters").value>St}const St=1e5;function ne(e){return e.geometry!=null}let U=class extends Z{constructor(t){super(t)}initialize(){const t=fe(()=>this.analysisViewData.computations,({computation:i})=>this._watchComputation(i));this.addHandles(ae(t))}get analysis(){return this.analysisViewData.analysis}get _defaultUnit(){return Et(this.view)}_watchComputation(t){return v(()=>pe(t),i=>{const{measureType:n}=i;if(yt(i)&&n!==_.Direct){const s=Math.round(Lt(St,"meters","kilometers"));return nt.getLogger(this).warnOnce(`A ${n} dimension in the analysis (id: '${this.analysis.id}') will not display, because only direct dimensions can measure lengths greater than ${s} km. Update the measureType of the affected dimension to "direct" to display it.`),void(t.geometry=null)}const a=me(i,this.view.renderCoordsHelper,t.geometry);t.geometry=a,t.result.length=Gi(a,n,this._defaultUnit)},x)}};d([u({constructOnly:!0})],U.prototype,"analysisViewData",void 0),d([u({constructOnly:!0})],U.prototype,"view",void 0),d([u()],U.prototype,"analysis",null),d([u()],U.prototype,"_defaultUnit",null),U=d([G("esri.views.3d.analysis.Dimension.support.DimensionController")],U);function he(e){return Gt(e.accentColor,.5)}function Zi(e){return It(e.accentColor)}const Mt=5,Ki=new j([127,127,127,.5]),wt=.8,Qi=4,Yi=6,Ji=.1,Pt=.5,en=18,tn=2,nn=.3,an=2,sn=.25,on=20,rn=5,Ze=5,Ke=10,ln=2500,dn=50,cn=2;class un{constructor(t){this.start=t.start,this.end=t.end,this.offset=t.offset,this.heading=t.heading,this.rotation=t.rotation,this.direct=t.direct,this.horizontal=t.horizontal,this.vertical=t.vertical}manipulatorName(t){return Object.keys(this).find(i=>this.hasOwnProperty(i)&&t===this[i])}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(t){for(const i of ci)t(this.manipulatorForMeasureType(i),i)}manipulatorForMeasureType(t){switch(t){case _.Direct:return this.direct;case _.Horizontal:return this.horizontal;case _.Vertical:return this.vertical}}}class pn extends _e{constructor(t,i){const n=gi(j.toUnitRGBA(he(t.effectiveTheme))),a=[new H(Ut(n,1,32,32),V)];super({view:t,renderObjects:a,metadata:i.metadata,available:!1,grabCursor:"crosshair",radius:Mt,collisionPriority:1}),this._themeHandle=v(()=>({color:j.toUnitRGBA(he(t.effectiveTheme))}),s=>n.setParameters(s))}destroy(){this._themeHandle.remove(),super.destroy()}}function mn(e,t){const i=[ce(-.5,0,0),ce(.5,0,0)],n=ee(t.unfocusedMaterial,i.map(s=>se(b(),s,Pt))),a=n.instantiate({material:t.focusedMaterial});return new _e({view:e,renderObjects:[new H(n,R.Unfocused|R.Selected|V),new H(a,R.Focused|V)],collisionType:{type:"line",paths:[i]},radius:Ee(t.lineSizePt)/2,metadata:t.metadata,available:!1,...mt})}class Qe extends _e{constructor(t,{lineSizePt:i,material:n,metadata:a}){super({view:t,autoScaleRenderObjects:!1,collisionPriority:1,metadata:a}),this._options={calloutColor:Ft(),lineSizePt:i,material:n},this._themeHandle=v(()=>j.toUnitRGBA(he(t.effectiveTheme)),s=>{this._options.calloutColor=s,Je(this,Ye({...this._options,metadata:this.metadata}))},te)}update({lineSizePt:t,material:i}){this._options.lineSizePt=t,this._options.material=i,Je(this,Ye({...this._options,metadata:this.metadata}))}destroy(){this._themeHandle.remove(),super.destroy()}}function Ye({calloutColor:e,lineSizePt:t,material:i,metadata:n}){return{calloutLength:.25*jt*wt*A(t)+en,calloutColor:e,calloutWidth:tn,customStateMask:V,discScale:nn,focusMultiplier:an,material:i,metadata:n}}function hn(e,t){const i=[ce(-.5,0,0),ce(.5,0,0)],n=ee(t.thinOffsetManipulatorMaterial,i),a=ee(t.unfocusedMaterial,i.map(o=>se(b(),o,Pt))),s=a.instantiate({material:t.focusedMaterial});return new _e({view:e,renderObjects:[new H(a,R.Unfocused|V),new H(s,R.Focused|V),new H(n,V)],collisionType:{type:"line",paths:[i]},radius:Ee(t.lineSizePt)/2,available:!1,metadata:t.metadata,...mt})}function gn(e,{isStart:t,createSnappingPipelineStep:i,dimension:n,onUpdate:a,view:s}){const o=t?"startPoint":"endPoint";return[oe(e,(r,c,p,h)=>{const m=He(r),{snappingStep:S,cancelSnapping:f}=i(h);p=p.next(m).next(ze(n,[o,"measureType","orientation"])).next(f),c.next(m).next(_i(s)).next(...S).next(M=>{const y=Y(M.mapEnd,new W);a(o==="startPoint"?{startPoint:y}:{endPoint:y})})})]}function fn(e,{computation:t,view:i}){return[oe(e,(n,a,s)=>{if(!ne(t)||!n.selected)return;const{geometry:o,dimension:l}=t,r=He(n);a.next(r).next(Ct(i,l,o.dimensionSegment,o.primaryOffsetAxis)),s.next(r).next(ze(l,["offset"]))})]}function _n(e,{computation:t,view:i}){return[oe(e,(n,a,s)=>{bt({cancel:s,computation:t,settingHeading:!0,steps:a,view:i})})]}function vn(e,{computation:t,view:i}){return[oe(e,(n,a,s)=>{bt({cancel:s,computation:t,settingHeading:!1,steps:a,view:i})}),e.events.on("immediate-click",n=>{yn(n,t,i)})]}function yn(e,t,i){const{dimension:n,geometry:a}=t;if(n.orientation===90||n.orientation===270)return n.orientation=0,void e.stopPropagation();if(a==null)return;const{renderCoordsHelper:s}=i,o=me({...pe(t),orientation:90},s),l=me({...pe(t),orientation:270},s);if(o==null||l==null)return;const r=$e(o,s),c=$e(l,s),p=Ot(a,i),h=we.shortestSignedDiff(p,r),m=we.shortestSignedDiff(p,c);n.orientation=Math.abs(h){f.action==="start"&&T(c,f.renderStart);const M=qt(m),y=fi(c,f.renderEnd,p,M);let L=S-Nt(y);n||(L=Sn(L)),l.orientation=L}),t.next(ze(l,["orientation"]))}function Sn(e){const t=we.normalize(e)%90;return t{if(l.action!=="start"||!ne(t))return;const{dimension:r,geometry:c}=t;a=r.measureType,s=r.offset,o=r.orientation;const p=T(g.get(),e.renderLocation);r.measureType=i,r.offset=Bi(p,i,c,n.renderCoordsHelper),r.orientation=0}),oe(e,(l,r,c)=>{if(!ne(t))return;const{geometry:p,dimension:h}=t,{renderCoordsHelper:m}=n,S=ft(xt,i,t,m),f=ve(g.get(),{measureType:i,directSegment:p.directSegment,renderCoordsHelper:m}),M=He(l);r.next(M).next(Ct(n,h,S,f)),c.next(M).next(y=>(h.measureType=a,h.offset=s,h.orientation=o,y))})]}function Ct(e,t,i,n){const a=st(g.get(),i.endRenderSpace,i.startRenderSpace);F(a,a,n);const s=Pe(i.startRenderSpace,a,be()),o=Pe(i.startRenderSpace,n,be()),l=t.offset;let r,c=0;const p=new vi;return p.next(ht(e,s)).next(h=>{h.action==="start"&&(c=Fe(o,h.renderStart));const m=(Fe(o,h.renderEnd)-c)*e.renderCoordsHelper.unitInMeters;t.offset=l+m,r=h}),h=>(p.execute(h),r)}function Ot(e,t){const{directSegment:i}=e,{renderCoordsHelper:n}=t,a=ye(g.get(),e,n),s=ke(g.get(),e),o=F(g.get(),s,a),{viewForward:l}=t.state.camera;E(o,l)>0&&se(o,o,-1);const r=i.eval(.5,g.get());return n.headingAtPosition(r,o)}function wn(e,t,i){const{dimensionSegment:n,primaryOffsetAxis:a}=t,s=Ve(J,t),o=ot(s,X)?Bt(ge):Ae(s,a,X,ge),l=Math.max(rt(s),Ji/i.unitInMeters);lt(o,o,dt(J,l,l,l)),e.modelTransform=o,e.renderLocation=n.eval(.5,J)}function Pn(e,t,i){$t(e,t,i,{forHeading:!0})}function bn(e,t,i){$t(e,t,i,{forHeading:!1})}function $t(e,t,i,{forHeading:n}){const{dimension:a,geometry:s}=t,{primaryOffsetAxis:o}=s,l=se(Cn,o,a.offset>=0?1:-1),r=Tt(On,{forHeading:n,geometry:s,renderCoordsHelper:i});F(r,r,l);const c=Ae(l,r,X,ge);e.modelTransform=c,e.renderLocation=Dt(J,s,s.dimensionSegment,i)}const Cn=b(),On=b();function $n(e,t,i,n){const{geometry:a}=t,s=ft(xt,i,t,n),o=ve(J,{measureType:i,directSegment:a.directSegment,renderCoordsHelper:n}),l=k(Se,s.endRenderSpace,s.startRenderSpace),r=Ae(l,o,X,ge),c=rt(l);lt(r,r,dt(Se,c,c,c)),e.modelTransform=r,e.renderLocation=s.eval(.5,Se)}function Dt(e,t,i,n){const{startRenderSpace:a,endRenderSpace:s}=i,o=Dn(t,n)?a:s;return T(e,o)}function Tt(e,{forHeading:t,geometry:i,renderCoordsHelper:n}){return t?ye(e,i,n):Ve(e,i,{invert:!0})}function Dn(e,t){const i=ke(Tn,e),n=ye(xn,e,t);return E(i,n)>0}const Tn=b(),xn=b();function An(e){return A(e)+Qi}function Ee(e){return A(e)+Yi}function Je(e,t){var S;const i=t.material??new gt({transparent:!0,writeDepth:!1,textureId:(S=t.texture)==null?void 0:S.id,renderOccluded:P.Opaque,isDecoration:!0}),n=t.focusMultiplier??re.focusMultiplier,a=t.calloutLength??re.calloutLength,s=re.discRadius*(t.discScale??1),o=s*n,l=(f,M)=>{const y=[0,1,2,2,3,0];return new Wt(M,[[je.POSITION,new Be([a-f,-f,0,a+f,-f,0,a+f,f,0,a-f,f,0],y,3,!0)],[je.UV0,new Be([0,0,1,0,1,1,0,1],y,2,!0)]])},r=t.calloutWidth??re.calloutWidth,c=new q({width:r,color:t.calloutColor,renderOccluded:P.OccludeAndTransparent,isDecoration:!0}),p=ee(c,[[0,0,0],[a-s,0,0]]),h=ee(c,[[0,0,0],[a-o,0,0]]),m=t.customStateMask??at.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[a,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=s,e.renderObjects=[new H(l(s,i),R.Unfocused|m),new H(p,R.Unfocused|m),new H(l(o,i),R.Focused|m),new H(h,R.Focused|m)]}const V=at.Custom1,J=b(),Se=b(),ge=De(),xt=new B;var D;function Hn(e,t){return{enabled:t.effectiveFeatureEnabled,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,geometry:e.geometry}}function zn(e,t){if(yt(e))return D.Direct;if(!e.enabled)return null;const{geometry:i}=e;if(i==null||ot(i.directSegment.startRenderSpace,i.directSegment.endRenderSpace))return null;const{camera:n}=t.state,a=ye(g.get(),i,t.renderCoordsHelper),s=ke(g.get(),i),o=se(g.get(),a,E(s,a)),l=st(g.get(),s,o),r=Me(l),c=Me(o),{startRenderSpace:p,endRenderSpace:h}=i.directSegment,m=Math.max(n.computeScreenPixelSizeAt(p)*Ke,n.computeScreenPixelSizeAt(h)*Ke)**2;return r{"startPoint"in t?r.startPoint=t.startPoint:"endPoint"in t&&(r.endPoint=t.endPoint)};if(n==null)h(),c!=null&&p!=null&&(r.measureType=p.measureType,r.orientation=p.orientation);else switch(r.measureType=_.Direct,n){case D.Horizontal:if(n!==c&&(r.orientation=0),"startPoint"in t){const m=t.startPoint;m!=null&&(m.z=s.z),r.startPoint=m}else if("endPoint"in t){const m=t.endPoint;m!=null&&(m.z=a.z),r.endPoint=m}break;case D.Vertical:if(n!==c&&(r.orientation=Ot(o,l)),"startPoint"in t){const m=t.startPoint;m!=null&&(m.x=s.x,m.y=s.y),r.startPoint=m}else if("endPoint"in t){const m=t.endPoint;m!=null&&(m.x=a.x,m.y=a.y),r.endPoint=m}break;case D.Direct:n!==c&&p!=null&&(r.orientation=p.orientation),h()}e.previousConstraint=n,e.unconstrainedGeometry=o}(function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.Direct=2]="Direct"})(D||(D={}));let w=class extends Z{constructor(e){super(e),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new ct,this._orientationManipulatorTexture=null,this._updatingHandles=new Xt,this._getSnappingContext=Zt(n=>new Di({elevationInfo:{mode:"absolute-height",offset:0},pointer:n,editGeometryOperations:new bi(new Ci("point",Oi(!0,!1,this.view.spatialReference))),visualizer:new Si}));const{view:t}=e;this._snappingManagerResult=$i(t),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:ue(2)}),this._constraintSnappingIndicator=new I({view:t,attached:!0,width:1,renderOccluded:P.OccludeAndTransparent,stipplePattern:ue(5),isDecoration:!0});const i=j.toUnitRGBA(Ki);this._stagedStartIndicator=new Pi({view:t,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:e.view.renderCoordsHelper.spatialReference,color:i,size:2*Mt,outlineSize:0,renderOccluded:P.OccludeAndTransparent,isDecoration:!0})}initialize(){var n;const{view:e}=this;this._snappingOperation=new xi({view:e});const t=!((n=e._stage)!=null&&n.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result);this._orientationManipulatorMaterial=new gt({transparent:!0,writeDepth:!1,renderOccluded:P.Opaque,isDecoration:!0}),this.addHandles(v(()=>({accentColor:he(e.effectiveTheme),contrastColor:Zi(e.effectiveTheme)}),({accentColor:a,contrastColor:s})=>{const o=this._orientationManipulatorTexture,l=yi(e.textures,{accentColor:a,contrastColor:s,preMultiplyAlpha:t});this._orientationManipulatorMaterial.setParameters({textureId:l.texture.id}),this._orientationManipulatorTexture=l,o==null||o.release();const r=j.toUnitRGBA(a);this._unfocusedOffsetManipulatorMaterial.setParameters({color:r}),this._focusedOffsetManipulatorMaterial.setParameters({color:r}),this._thinOffsetManipulatorMaterial.setParameters({color:r}),this._constraintSnappingIndicator.color=r},te));const i=fe(()=>this.analysisViewData.computations,({computation:a})=>this._createManipulators(a));this.addHandles(ae(i)),this.addHandles([v(()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation}),({stagedPoint:a,stagedComputation:s})=>{if(s==null||a==null)return;const o=Y(a,new W);this._applyPointUpdate(s,{endPoint:o})},Ce),v(()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}),(a,s)=>{const{stagedDimension:o,selectedComputation:l,firstGrabbedManipulator:r}=a;if(o===(s==null?void 0:s.stagedDimension)&&r===(s==null?void 0:s.firstGrabbedManipulator)){for(const c of[l,s==null?void 0:s.selectedComputation])if(c!=null){const p=this._computationManipulators.get(c);p!=null&&this._updateManipulators(c,p,a)}}else for(const[c,p]of this._computationManipulators)this._updateManipulators(c,p,a)},x),v(()=>this.analysis.style.lineSize,a=>{this._updateManipulatorStyle(a)},te),v(()=>this.view.state.camera,()=>{this._stagedComputation!=null&&this._updateStagedDimensionOffset(this._stagedComputation)}),v(()=>{const a=this._stagedComputation;if(!a)return null;const s=a.elevationAlignedStartPoint,o=b();return s!=null&&this.view.renderCoordsHelper.toRenderCoords(s,o)?o:null},a=>{a!=null?(this._stagedStartIndicator.vertices=[a],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1})]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),Kt(this,()=>{const a=this._activeComputation,s=this._stagedComputation;if(a==null||s!=null){const o=this.view.inputManager.latestPointerType??"mouse",l=this._getSnappingContext(o);this._updatingHandles.addPromise(qe(this._snappingOperation.resnap(this._snappingManager,l)))}if(a!=null){const{start:o,end:l}=this._computationManipulators.get(a);if(o.grabbing||l.grabbing){const r=o.grabbing?"start":"end",c=this._computeConstraint(a);Rn(a,r,{constraint:c,view:this.view})}}})}destroy(){var e;this._snappingOperation=Te(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),(e=this._orientationManipulatorTexture)==null||e.release()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(this._stagedComputation!=null)return this._stagedComputation;const{selectedComputation:e}=this.analysisViewData;return this.hasGrabbedManipulators&&e!=null?e:null}get _stagedComputation(){var i;const e=this._stagedDimension,t=(i=this.analysisViewData.computations.at(-1))==null?void 0:i.computation;return e==null||t==null||t.dimension!==e?null:t}get _constraintHandles(){return[xe(()=>this.analysisViewData.selectedComputation,e=>{e.previousConstraint=this._computeConstraint(e)},{...x,equals:Oe}),v(()=>{const e=this._activeComputation;if(e==null)return null;const{measureType:t,orientation:i}=e.dimension;return{measureType:t,orientation:i,computation:e}},(e,t)=>{if(e!=null&&t==null){const{measureType:i,orientation:n,computation:a}=e;switch(a.previousConstraint){case D.Horizontal:a.preConstraintProperties={measureType:_.Horizontal,orientation:0};break;case D.Vertical:a.preConstraintProperties={measureType:_.Vertical,orientation:0};break;case D.Direct:a.preConstraintProperties={measureType:_.Direct,orientation:n};break;default:a.preConstraintProperties={measureType:i,orientation:n}}}e==null&&t!=null&&(t.computation.preConstraintProperties=null)},Ce)]}get _snappingIndicatorHandles(){const e="snapping-indicator-event-handles";return[v(()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation}),({stagedComputation:t,activeComputation:i})=>{const n=this._constraintSnappingIndicator;if(this.removeHandles(e),i!=null)if(i===t)n.attached=!0;else{const{start:a,end:s}=this._computationManipulators.get(i),o=()=>{n.attached=a.grabbing||s.grabbing};o(),this.addHandles([a.events.on("grab-changed",o),s.events.on("grab-changed",o)],e)}else n.attached=!1}),v(()=>{const t=this._activeComputation;return t!=null?{geometry:t.geometry,constraint:t.previousConstraint}:{}},({geometry:t,constraint:i})=>{const n=this._constraintSnappingIndicator;t!=null&&i!=null&&i!==D.Direct?(n.visible=!0,n.setGeometryFromSegment(t.directSegment)):n.visible=!1})]}removeStaged(){return this._stagedDimension!=null&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(e){const{_stagedDimension:t}=this;if(t==null){const i=this._onUnstagedClick(e);return this.analysis.dimensions.add(i),null}return this._onStagedClick(e),t}onPointerMove({mapPoint:e,pointerType:t}){if(t==="touch")return;const i=this._getSnappingContext(t);this._updatingHandles.addPromise(qe(this._snappingOperation.snap({point:e},this._snappingManager,i)))}onManipulatorSelectionChanged(){this.analysisViewData.selectedComputation!=null&&(this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null))}_onUnstagedClick({mapPoint:e,pointerType:t}){let i=e;if(t==="mouse"){const a=this._getSnappingContext(t);i=this._snappingManager.update({point:e,context:a})}const n=new ui({startPoint:Y(i,new W),endPoint:null,measureType:_.Horizontal});return this._stagedDimension=n,this._resetSnappingState(),n}_onStagedClick({mapPoint:e,pointerType:t}){const i=this._stagedComputation;if(i==null)return;let n=e;if(t==="mouse"){const s=this._getSnappingContext(t);n=this._snappingManager.update({point:e,context:s})}const a=Y(n,new W);this._applyPointUpdate(i,{endPoint:a}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(e){const t=this._setupPointManipulator(e,{isStart:!0}),i=this._setupPointManipulator(e,{isStart:!1}),n=this._setupOffsetManipulator(e),a=this._setupHeadingManipulator(e),s=this._setupRotationManipulator(e),o=this._setupMeasureTypeManipulator(e,_.Direct),l=this._setupMeasureTypeManipulator(e,_.Horizontal),r=this._setupMeasureTypeManipulator(e,_.Vertical),c=new un({start:t,end:i,offset:n,heading:a,rotation:s,direct:o,horizontal:l,vertical:r});return this._setupComputationToManipulatorsSync(e,c),this._computationManipulators.set(e,c),this.manipulators.addMany(c.values()),{manipulators:c,remove:()=>{this._computationHandles.remove(e),this._computationManipulators.delete(e);for(const p of c.values())this.manipulators.remove(p)}}}_setupComputationToManipulatorsSync(e,t){this._computationHandles.add([v(()=>e.geometry,()=>this._updateManipulators(e,t),{...x,equals:Oe})],e)}_setupPointManipulator(e,t){const{view:i}=this,{dimension:n}=e,a=new pn(i,{metadata:n}),s=gn(a,{isStart:t.isStart,createSnappingPipelineStep:o=>Ti({snappingContext:this._getSnappingContext(o),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:n,onUpdate:o=>this._applyPointUpdate(e,o),view:i});return this._computationHandles.add(s,e),a}_setupOffsetManipulator(e){const{view:t}=this,i=mn(t,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:e.dimension}),n=fn(i,{computation:e,view:t});return this._computationHandles.add(n,e),i}_setupHeadingManipulator(e){const{view:t}=this,i=new Qe(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),n=_n(i,{computation:e,view:t});return this._computationHandles.add(n,e),i}_setupRotationManipulator(e){const{view:t}=this,i=new Qe(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),n=vn(i,{computation:e,view:t});return this._computationHandles.add(n,e),i}_setupMeasureTypeManipulator(e,t){const{view:i}=this,n=hn(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:e.dimension}),a=Mn(n,{computation:e,manipulatorMeasureType:t,view:i});return this._computationHandles.add(a,e),n}_updateManipulators(e,t,i={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:n,selectedComputation:a,firstGrabbedManipulator:s}=i,{start:o,end:l,offset:r,heading:c,rotation:p}=t,h=a===e,m=ne(e),{dimension:S}=e;for(const y of t.values()){const L=m&&n==null&&(s==null||y===s);y===r?(y.available=L,y.selected=h):y.available=L&&h}if(!m)return;this._computeConstraint(e)!=null?t.forEachMeasureTypeManipulator(y=>y.available=!1):t.manipulatorForMeasureType(S.measureType).available=!1;for(const y of[c,p])S.measureType===_.Direct&&S.offset!==0||(y.available=!1);Re(e)?p.available=!1:c.available=!1;const{geometry:f}=e;o.renderLocation=f.directSegment.startRenderSpace,l.renderLocation=f.directSegment.endRenderSpace;const{renderCoordsHelper:M}=this.view;wn(r,f,M),c.available&&Pn(c,e,M),p.available&&bn(p,e,M),t.forEachMeasureTypeManipulator((y,L)=>{y.available&&$n(y,e,L,M)})}_updateManipulatorStyle(e){const t=An(e),i=Ee(e),n={lineSizePt:e,material:this._orientationManipulatorMaterial};for(const{offset:a,heading:s,rotation:o}of this._computationManipulators.values())a.radius=i/2,s.update(n),o.update(n);this._unfocusedOffsetManipulatorMaterial.setParameters({width:t}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(e,t){const{view:i}=this,n=pe(e);"startPoint"in t&&(n.elevationAlignedStartPoint=t.startPoint),"endPoint"in t&&(n.elevationAlignedEndPoint=t.endPoint);const a=me(n,i.renderCoordsHelper);if(a==null)return;const s=this._computeConstraint({...n,geometry:a});At(e,t,{...n,constraint:s,unconstrainedGeometry:a,view:i}),e===this._stagedComputation&&this._updateStagedDimensionOffset(e)}_updateStagedDimensionOffset(e){if(e.geometry==null)return;e.geometry.directSegment.eval(.5,et);const t=this.view.state.camera.computeScreenPixelSizeAt(et);e.dimension.offset=dn*t}_computeConstraint(e){return zn(Hn(e,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){return new q({width:1,renderOccluded:P.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get testInfo(){const e=t=>{var i;return(i=this.analysisViewData.computations.find(({computation:n})=>n.dimension===t))==null?void 0:i.computation};return{disableManipulatorPartialOcclusion:()=>{this._stagedStartIndicator.renderOccluded=P.Occlude,this.manipulators.forEach(({manipulator:t})=>{for(const{geometry:i}of t.renderObjects)i.material.setParameters({renderOccluded:P.Occlude})})},getManipulatorsForDimension:t=>this._computationManipulators.get(e(t)),getComputationForDimension:t=>e(t),getConstraintForDimension:t=>{const i=e(t);return i!=null?this._computeConstraint(i):null},stagedDimension:this._stagedDimension,stagedStartIndicator:this._stagedStartIndicator,constraintSnappingIndicator:this._constraintSnappingIndicator,snappingManager:this._snappingManager}}};d([u({constructOnly:!0})],w.prototype,"analysis",void 0),d([u({constructOnly:!0})],w.prototype,"analysisViewData",void 0),d([u({constructOnly:!0})],w.prototype,"manipulators",void 0),d([u({constructOnly:!0})],w.prototype,"parentTool",void 0),d([u({constructOnly:!0,nonNullable:!0})],w.prototype,"view",void 0),d([u({readOnly:!0})],w.prototype,"updating",null),d([u()],w.prototype,"firstGrabbedManipulator",null),d([u()],w.prototype,"hasGrabbedManipulators",null),d([u()],w.prototype,"snappingOptions",null),d([u()],w.prototype,"_stagedDimension",void 0),d([u()],w.prototype,"_activeComputation",null),d([u()],w.prototype,"_stagedComputation",null),w=d([G("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],w);const et=b();var N;(function(e){e.Ready="ready",e.Creating="creating",e.Created="created"})(N||(N={}));let O=class extends Ai{constructor(e){super(e),this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this._pointerMoveTimerMs=ln,this._prevPointerMoveTimeout=null}initialize(){this._intersector=Qt(this.view.state.viewingMode),this._intersector.options.store=Yt.MIN,this._lengthDimensionSubTool=new w({analysis:this.analysis,analysisViewData:this.analysisViewData,manipulators:this.manipulators,parentTool:this,view:this.view}),this.addHandles([ae(this._lengthDimensionSubTool),ut(()=>this._clearPointerMoveTimeout()),v(()=>this.state,e=>{e===N.Created&&this.finishToolCreation()},x),xe(()=>this.firstGrabbedManipulator,e=>{this.selectedDimension=e.metadata},x),v(()=>this.selectedDimension,()=>this._resetPointerMoveTimeout(),x)])}get state(){return this.analysis.dimensions.some(e=>e.type==="length")?this._activeSubTool!=null?N.Creating:N.Created:N.Ready}get updating(){return this._lengthDimensionSubTool.updating}get cursor(){return this.active?"crosshair":null}get selectedDimension(){return this.analysisViewData.selectedDimension}set selectedDimension(e){this.analysisViewData.selectedDimension=e}onInputEvent(e){switch(e.type){case"immediate-click":this._clickHandler(e);break;case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e);break;case"key-down":if(Ne.cancel===e.key){if(this._activeSubTool!=null&&this._activeSubTool.removeStaged())return void e.stopPropagation();this.active||(this.selectedDimension=null)}else Ne.delete.includes(e.key)&&this._deleteKeyHandler()}}onActivate(){this._activeSubTool=this._lengthDimensionSubTool}onDeactivate(){this._activeSubTool!=null&&(this._activeSubTool.onDeactivate(),this._activeSubTool=null)}onShow(){this._resetPointerMoveTimeout()}onManipulatorSelectionChanged(){this._lengthDimensionSubTool.onManipulatorSelectionChanged()}onHide(){this.selectedDimension=null}_clickHandler(e){if(this.hasFocusedManipulators)return void e.stopPropagation();if(this._activeSubTool==null)return;const t=this._intersectScreen(e);t!=null&&(this.selectedDimension=this._activeSubTool.onClick({mapPoint:t,pointerType:e.pointerType}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.view.activeTool=null,e.stopPropagation())}_pointerMoveHandler(e){if(this._resetPointerMoveTimeout(),this._activeSubTool==null||this.hasFocusedManipulators)return;const t=this._intersectScreen(e);t!=null&&this._activeSubTool.onPointerMove({mapPoint:t,pointerType:e.pointerType})}_deleteKeyHandler(){this._activeSubTool!=null&&this._activeSubTool.removeStaged(),this._removeSelected()}_intersectScreen(e){const t=Jt(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const i=this._intersector.results.min,n=g.get();return i.getIntersectionPoint(n)?this.view.renderCoordsHelper.fromRenderCoords(n,this.view.spatialReference):null}_removeSelected(){this.selectedDimension!=null&&(this.analysis.dimensions.remove(this.selectedDimension),this.selectedDimension=null)}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=ei(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.manipulators.forEach(e=>e.manipulator.state|=V),this._prevPointerMoveTimeout=ti.setTimeout(()=>{this.manipulators.forEach(e=>e.manipulator.state&=~V)},this._pointerMoveTimerMs)}get testInfo(){return{...this._lengthDimensionSubTool.testInfo,setManipulatorAutoHideDelay:e=>{this._pointerMoveTimerMs=e,this._resetPointerMoveTimeout()}}}};d([u({constructOnly:!0})],O.prototype,"view",void 0),d([u({constructOnly:!0})],O.prototype,"analysis",void 0),d([u({readOnly:!0})],O.prototype,"state",null),d([u({readOnly:!0})],O.prototype,"updating",null),d([u({readOnly:!0})],O.prototype,"cursor",null),d([u({constructOnly:!0})],O.prototype,"analysisViewData",void 0),d([u()],O.prototype,"selectedDimension",null),d([u()],O.prototype,"automaticManipulatorSelection",void 0),d([u()],O.prototype,"_activeSubTool",void 0),d([u()],O.prototype,"_lengthDimensionSubTool",void 0),O=d([G("esri.views.3d.analysis.Dimension.DimensionTool")],O);class kn extends ki{constructor(t,i){super(t),this._hasExternalMaterial=!1,this._renderOccluded=P.OccludeAndTransparent,this._width=1,this._color=zi(1,0,1,1),this._placement="end",this._markerPrimitive="arrow",this._material=i,this._hasExternalMaterial=i!=null,this.applyProperties(t)}setGeometryFromSegment(t,i){const n=t.endRenderSpace;this.transform=ii(Vn,n),this._normal=i;const{points:a}=t.createRenderGeometry(n,this.view.renderCoordsHelper);this.geometry=[a]}get renderOccluded(){return this._material!=null?this._material.parameters.renderOccluded:this._renderOccluded}set renderOccluded(t){this._renderOccluded=t,this._material!=null&&this._material.setParameters({renderOccluded:t})}get geometry(){return this._geometry}set geometry(t){this._geometry=t,this.recreateGeometry()}get normal(){return this._normal}set normal(t){this._normal=t,this.recreateGeometry()}get width(){return this._material!=null?this._material.parameters.width:this._width}set width(t){this._width=t,this._material!=null&&this._material.setParameters({width:t})}get color(){return this._material!=null?this._material.parameters.color:this._color}set color(t){this._color=Ri(t),this._material!=null&&this._material.setParameters({color:this._color})}get placement(){return this._material!=null?this._material.parameters.placement:this._placement}set placement(t){this._placement=t,this._material!=null&&this._material.setParameters({placement:this._placement})}get markerPrimitive(){var t;return((t=this._material)==null?void 0:t.parameters.markerPrimitive)??this._markerPrimitive}set markerPrimitive(t){this._markerPrimitive=t,this._material!=null&&this._material.setParameters({markerPrimitive:t})}createExternalResources(){this._hasExternalMaterial||(this._material=new pt({width:this._width,color:this._color,placement:this._placement,renderOccluded:this._renderOccluded,markerPrimitive:this._markerPrimitive,isDecoration:this.isDecoration}))}destroyExternalResources(){this._hasExternalMaterial||(this._material=null)}createGeometries(t){for(const i of ni(this.geometry,this.normal)){const n=ai(this._material,i);t.addGeometry(n)}}forEachExternalMaterial(t){this._hasExternalMaterial||t(this._material)}}const Vn=De();let En=class{set visible(t){for(const i of this._visualElements.values())i.attached=t}constructor(t){this.destroyed=!1,this._handles=new ct,this._messages=null,this._labelSegment=new B;const{analysis:i,computation:n,view:a,messages:s,isDecoration:o}=t;this.analysis=i,this.computation=n,this.view=a,this._messages=s;const l=t.visible,r={view:a,attached:l,isDecoration:o},{fontSize:c,textColor:p,textBackgroundColor:h}=i.style;this._visualElements=new Un({marker:new kn(r,t.markerMaterial),dimension:new I(r,t.dimensionLineMaterial),startOffset:new I(r,t.offsetLineMaterial),endOffset:new I(r,t.offsetLineMaterial),dimensionSmall:new I(r,t.smallDimensionLineMaterial),startOffsetSmall:new I(r,t.smallOffsetLineMaterial),endOffsetSmall:new I(r,t.smallOffsetLineMaterial),label:new pi({view:a,attached:l,distance:0,geometry:{type:"segment",sampleLocation:"center",segment:this._labelSegment,callout:!1},fontSize:A(c),textColor:p.clone(),backgroundColor:h.clone(),isDecoration:o})}),this._handles.add([v(()=>n.geometry,m=>{this.updateCameraDependentElements(a.state.camera,m,i.style),n.geometry!=null&&this._updateLines(n.geometry)},{...te,equals:Oe}),v(()=>n.length,m=>this._updateLabelContent(m),te)])}destroy(){this.destroyed=!0,this._handles=Te(this._handles);for(const t of this._visualElements.values())t.destroy()}get testInfo(){return{dimensionVisualElement:this._visualElements.dimension,label:this._visualElements.label}}_updateLines(t){const i=Xe(Ln,ie.Start,t.directSegment,t.dimensionSegment),n=Xe(Gn,ie.End,t.directSegment,t.dimensionSegment),a=this._visualElements;a.marker.setGeometryFromSegment(t.dimensionSegment,t.primaryOffsetAxis),a.dimension.setGeometryFromSegment(t.dimensionSegment),a.startOffset.setGeometryFromSegment(i),a.endOffset.setGeometryFromSegment(n),a.dimensionSmall.setGeometryFromSegment(t.dimensionSegment),a.startOffsetSmall.setGeometryFromSegment(i),a.endOffsetSmall.setGeometryFromSegment(n)}updateCameraDependentElements(t,i,n){const a=this._visualElements;if(i==null){for(const M of a.values())M.visible=!1;return}const s=t.computeScreenPixelSizeAt(i.dimensionSegment.eval(.5,In)),o=Wi(i,s),l=o<(A(n.lineSize)*cn)**2,r=!l;a.marker.visible=r,a.dimension.visible=r,a.startOffset.visible=r,a.endOffset.visible=r,a.dimensionSmall.visible=l,a.startOffsetSmall.visible=l,a.endOffsetSmall.visible=l;const c=A(n.fontSize)*rn,{label:p}=a;if(p.visible=o>=c**2,!p.visible)return;const{dimensionSegment:h,primaryOffsetAxis:m}=i,{offset:S}=this.computation.dimension,f=(Math.sign(S)>=0?1:-1)*this._labelOffsetPx(n)*s;Ii(this._labelSegment,h,m,f),p.updateLabelPosition()}updateLabelStyle(t){const{label:i}=this._visualElements;i.fontSize=A(t.fontSize),i.textColor=t.textColor,i.backgroundColor=t.textBackgroundColor}updateUnitsMessages(t){this._messages=t;const{length:i}=this.computation;this._updateLabelContent(i)}_updateLabelContent(t){const{label:i}=this._visualElements;t!=null&&this._messages!=null?i.text=Hi(this._messages,t,t.unit):i.text=""}_labelOffsetPx(t){return 1.5*A(t.fontSize)+on+A(t.lineSize/2)}};const Ln=new B,Gn=new B,In=b();class Un{constructor(t){this.marker=t.marker,this.dimension=t.dimension,this.startOffset=t.startOffset,this.endOffset=t.endOffset,this.dimensionSmall=t.dimensionSmall,this.startOffsetSmall=t.startOffsetSmall,this.endOffsetSmall=t.endOffsetSmall,this.label=t.label}values(){return[this.marker,this.dimension,this.startOffset,this.endOffset,this.dimensionSmall,this.startOffsetSmall,this.endOffsetSmall,this.label]}}let z=class extends Z{get analysis(){return this.analysisViewData.analysis}get visible(){return this.analysisViewData.visible}constructor(e){super(e),this.loadingMessages=!1,this._messages=null}initialize(){const e=this.isDecoration;this._markerMaterial=new pt({width:1,anchor:si.Tip,color:K,placement:"begin-end",worldSpace:!0,hideOnShortSegments:!0,hasTip:!0,renderOccluded:P.OccludeAndTransparent,markerPrimitive:"triangle",isDecoration:e}),this._dimensionLineMaterial=new q({width:1,color:K,renderOccluded:P.OccludeAndTransparent,markerParameters:this._markerMaterial.parameters,isDecoration:e}),this._offsetLineMaterial=new q({width:1,color:K,renderOccluded:P.OccludeAndTransparent,stipplePattern:ue(5),isDecoration:e}),this._smallDimensionLineMaterial=new q({width:1,color:K,renderOccluded:P.OccludeAndTransparent,isDecoration:e}),this._smallOffsetLineMaterial=new q({width:1,color:K,renderOccluded:P.OccludeAndTransparent,stipplePattern:ue(5),isDecoration:e});for(const i of this._lineMaterials())this.view._stage.add(i),this.addHandles(ut(()=>{var n;(n=this.view._stage)==null||n.remove(i)}));const t=fe(()=>this.analysisViewData.computations,({computation:i})=>this._createVisualization(i));this._dimensionVisualizations=t,this.addHandles([ae(t),v(()=>j.toUnitRGBA(this.analysis.style.color),i=>{for(const n of this._lineMaterials())n.setParameters({color:i})},x),v(()=>this.analysis.style.lineSize,i=>{const n=A(i);this._markerMaterial.setParameters({width:n*wt}),this._dimensionLineMaterial.setParameters({width:n,markerParameters:this._markerMaterial.parameters});const a=Math.max(n*sn,1);this._offsetLineMaterial.setParameters({width:a})},x),v(()=>({camera:this.view.state.camera,style:Fn(this.analysis)}),({camera:i,style:n})=>{for(const{visualization:a}of this._dimensionVisualizations)a.updateCameraDependentElements(i,a.computation.geometry,n),a.updateLabelStyle(n)}),v(()=>this.visible,i=>{for(const{visualization:n}of this._dimensionVisualizations)n.visible=i})]),this.addHandles([oi(()=>this._updateMessageBundle()),xe(()=>!this.loadingMessages,()=>{for(const{visualization:i}of this._dimensionVisualizations)i.updateUnitsMessages(this._messages)},Ce)]),this._updateMessageBundle()}get testInfo(){return{visualizations:this._dimensionVisualizations.items.map(({visualization:e})=>e),disablePartialOcclusion:()=>{for(const e of this._lineMaterials())e.setParameters({renderOccluded:P.Occlude})}}}_createVisualization(e){const t=new En({analysis:this.analysis,computation:e,view:this.view,visible:this.visible,markerMaterial:this._markerMaterial,dimensionLineMaterial:this._dimensionLineMaterial,offsetLineMaterial:this._offsetLineMaterial,smallDimensionLineMaterial:this._smallDimensionLineMaterial,smallOffsetLineMaterial:this._smallOffsetLineMaterial,messages:this._messages,isDecoration:this.isDecoration});return{visualization:t,remove:()=>t.destroy()}}_lineMaterials(){return[this._markerMaterial,this._dimensionLineMaterial,this._offsetLineMaterial,this._smallDimensionLineMaterial,this._smallOffsetLineMaterial]}async _updateMessageBundle(){this.loadingMessages=!0;try{this._messages=await ri("esri/core/t9n/Units")}finally{this.loadingMessages=!1}}};function Fn(e){const{fontSize:t,lineSize:i,textColor:n,textBackgroundColor:a}=e.style;return{fontSize:t,lineSize:i,textBackgroundColor:a.clone(),textColor:n.clone()}}d([u({constructOnly:!0})],z.prototype,"analysisViewData",void 0),d([u({constructOnly:!0,nonNullable:!0})],z.prototype,"view",void 0),d([u({constructOnly:!0})],z.prototype,"isDecoration",void 0),d([u()],z.prototype,"analysis",null),d([u()],z.prototype,"visible",null),d([u()],z.prototype,"loadingMessages",void 0),z=d([G("esri.views.3d.analysis.Dimension.DimensionVisualization")],z);let Q=class extends Z{constructor(e){super(e),this.dimension=null,this.length=null}};d([u({constructOnly:!0,nonNullable:!0})],Q.prototype,"dimension",void 0),d([u()],Q.prototype,"length",void 0),Q=d([G("esri.views.3d.analysis.LengthDimensionResult")],Q);const jn=Q;let $=class extends Z{constructor(e){super(e),this.geometry=null,this.unconstrainedGeometry=null,this.elevationAlignedStartPoint=null,this.elevationAlignedEndPoint=null}normalizeCtorArgs(e){const{dimension:t,...i}=e;return{result:new jn({dimension:t}),...i}}initialize(){this.addHandles([v(()=>this.dimension.startPoint,e=>this.elevationAlignedStartPoint=this.projectAndAlignPoint(e),x),v(()=>this.dimension.endPoint,e=>this.elevationAlignedEndPoint=this.projectAndAlignPoint(e),x)])}get dimension(){return this.result.dimension}get length(){return this.result.length}};d([u({constructOnly:!0,nonNullable:!0})],$.prototype,"result",void 0),d([u({constructOnly:!0,nonNullable:!0})],$.prototype,"projectAndAlignPoint",void 0),d([u()],$.prototype,"dimension",null),d([u()],$.prototype,"length",null),d([u()],$.prototype,"geometry",void 0),d([u()],$.prototype,"unconstrainedGeometry",void 0),d([u()],$.prototype,"elevationAlignedStartPoint",void 0),d([u()],$.prototype,"elevationAlignedEndPoint",void 0),d([u()],$.prototype,"preConstraintProperties",void 0),d([u()],$.prototype,"previousConstraint",void 0),$=d([G("esri.views.3d.analysis.LengthDimensionComputation")],$);const Bn=e=>{let t=class extends e{constructor(...i){super(...i),this.analysis=null,this.tool=null,this.selectedDimension=null,this.interactive=!1,this.visible=null}get results(){return new li}createLengthDimensions(i){throw new Error("Method not implemented.")}};return d([u({constructOnly:!0})],t.prototype,"view",void 0),d([u({constructOnly:!0,nonNullable:!0})],t.prototype,"analysis",void 0),d([u()],t.prototype,"tool",void 0),d([u({readOnly:!0})],t.prototype,"results",null),d([u()],t.prototype,"selectedDimension",void 0),d([u()],t.prototype,"interactive",void 0),d([u()],t.prototype,"visible",void 0),t=d([G("esri.views.analysis.DimensionAnalysisView")],t),t};let C=class extends Bn(di(Z)){constructor(e){super(e),this.type="dimension-view-3d",this.tool=null,this.selectedDimension=null,this._dimensionsToComputations=new Map,this._placementTask=null,this._projectAndAlignPoint=null}initialize(){this._projectAndAlignPoint=t=>{if(t==null)return null;const{spatialReference:i,elevationProvider:n}=this.view,a=Mi(t,i,n);return a==null&&wi(this.analysis,t.spatialReference,nt.getLogger(this)),a};const e=fe(()=>this.analysis.dimensions,t=>this._createComputation(t));this.computations=e,this.addHandles([Vi(this,O),ae(e)]),this._analysisVisualization=new z({analysisViewData:this,view:this.view,isDecoration:!this.parent}),this._analysisController=new U({analysisViewData:this,view:this.view})}destroy(){this._placementTask=We(this._placementTask),this._analysisVisualization=Te(this._analysisVisualization),Ei(this)}get updating(){var e;return((e=this._analysisVisualization)==null?void 0:e.loadingMessages)??!1}get results(){return this.analysis.dimensions.map(e=>this._dimensionsToComputations.get(e).result)}get selectedComputation(){const{selectedDimension:e}=this;return e==null?null:this._dimensionsToComputations.get(e)}get testInfo(){return{visualization:this._analysisVisualization,controller:this._analysisController}}async createLengthDimensions(e){return this.selectedDimension=null,this._placementTask=We(this._placementTask),this._placementTask=Li(this,e),this._placementTask.promise}_createComputation(e){const{_dimensionsToComputations:t}=this,i=new $({dimension:e,projectAndAlignPoint:this._projectAndAlignPoint});return t.set(e,i),{computation:i,remove:()=>this._removeComputation(i)}}_removeComputation(e){const{dimension:t}=e;t===this.selectedDimension&&(this.selectedDimension=null),this._dimensionsToComputations.delete(t),e.destroy()}};d([u({readOnly:!0})],C.prototype,"type",void 0),d([u()],C.prototype,"tool",void 0),d([u()],C.prototype,"updating",null),d([u({readOnly:!0})],C.prototype,"results",null),d([u()],C.prototype,"computations",void 0),d([u()],C.prototype,"selectedDimension",void 0),d([u()],C.prototype,"selectedComputation",null),d([u()],C.prototype,"_analysisVisualization",void 0),d([u()],C.prototype,"_analysisController",void 0),d([u()],C.prototype,"_dimensionsToComputations",void 0),d([u()],C.prototype,"_placementTask",void 0),C=d([G("esri.views.3d.analysis.DimensionAnalysisView3D")],C);const $a=C;export{$a as default}; +import{ru as Ht,rv as zt,cp as tt,a8 as b,b3 as T,bI as g,nw as Rt,of as Le,py as Ge,hb as Ie,qg as k,c6 as F,c9 as V,q5 as it,bN as J,bL as kt,bT as De,cD as de,bp as Y,rw as Ue,bU as Et,cG as Me,e as d,y as u,c as G,g as K,rx as fe,fr as ae,ry as Vt,B as v,T as A,hr as Lt,R as nt,W as j,hR as Gt,kL as It,ql as at,hZ as Ut,bb as ee,ca as se,rz as R,oH as Ft,P as te,rA as jt,gL as x,L as W,iD as we,c7 as Pe,c5 as be,b4 as st,od as Fe,b6 as ot,rB as Bt,c2 as rt,bQ as lt,bz as dt,b2 as P,b9 as q,b1 as ce,cH as qt,ch as Nt,bR as Wt,bi as je,bS as Be,kv as ct,h as Jt,gA as Kt,l1 as ue,a9 as Ce,nB as Qt,br as qe,b as Te,v as Ae,rC as Oe,cb as Xt,cc as Yt,a0 as ut,O as Ne,rD as Zt,bq as ei,o9 as ti,bP as ii,rE as pt,i4 as ni,i5 as ai,rF as si,ok as Q,kJ as oi,kI as ri,V as li,I as We}from"./index-pCX-0tJH.js";import{s as di}from"./AnalysisView3D-XCzG0Hzh.js";import{t as _,r as ci,u as ui}from"./LengthDimension-tb0JjnxZ.js";import{m as B,g as pi}from"./Segment-TQS1M_Ix.js";import{x as mi,z as hi}from"./euclideanLengthMeasurementUtils-Kj2RYqri.js";import{$ as _e,w as gi,e as H,D as mt,F as fi,M as xe,O as re}from"./ShadedColorMaterial.glsl-L0JVQzbX.js";import{F as _i,H as ht,A as He}from"./dragEventPipeline3D-H_IlIVP7.js";import{g as gt}from"./ImageMaterial.glsl-PU0wbmEN.js";import{d as oe,R as ze,U as vi}from"./InteractiveToolBase-6mltmL27.js";import{l as yi}from"./Factory-EVPOwZPk.js";import{O as Si}from"./SnappingVisualizer3D-PUGfSdbO.js";import{u as I,r as Mi,t as wi}from"./LineVisualElement-iKo1s90I.js";import{d as Pi}from"./VerticesVisualElement-QZStMB48.js";import{V as bi,p as Ci,w as Oi}from"./EditGeometryOperations-vpHcsZOg.js";import{a as $i}from"./SceneSnappingManagerPool-V-V1M2q0.js";import{e as Di}from"./SnappingContext-ax0tf6c6.js";import{f as Ti}from"./SnappingDragPipelineStep-HDAWWRgo.js";import{p as Ai}from"./SnappingOperation-hED0OM8D.js";import{a as xi}from"./AnalysisToolBase-olyQy6lh.js";import{h as Hi}from"./quantityFormatUtils-oYgdvR_2.js";import{r as zi,t as Ri}from"./vec4f32-NvfHy9q7.js";import{a as ki}from"./Object3DVisualElement-8HoU366x.js";import{a as Ei,v as Vi,l as Li}from"./analysisViewUtils-lJExoyyw.js";import"./VisualElement--2Scr6Yq.js";import"./TextOverlayItem-YHZxWGyg.js";import"./measurementUtils-69EiqRp6.js";import"./drawUtils-0wb2c6-q.js";import"./ExtendedLineVisualElement-VJvEdv3K.js";import"./EngineVisualElement-u0-BOxGn.js";import"./Laserlines.glsl-U7nZFq0e.js";import"./PointVisualElement-m9C0-AJh.js";import"./RightAngleQuadVisualElement-Jj11oqLR.js";import"./PointSnappingHint-bwlQAyn6.js";import"./dehydratedFeatureComparison-IJSogXWn.js";function Gi(e,t,i){if(e==null)return null;const n=e.dimensionSegment.startRenderSpace,a=e.dimensionSegment.endRenderSpace,s=mi(n,a,e.spatialReference);if(s==null)return null;const o=t===_.Vertical?Ht(s.value,s.unit,i):zt(s.value,s.unit,i);return tt(s,o)}function pe(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:i,dimension:{offset:n,measureType:a,orientation:s}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:i,offset:n,measureType:a,orientation:s}}function me({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,offset:i,measureType:n,orientation:a},s,o=null){if(e==null||t==null)return null;const l=_t(o!=null?o.directSegment:new B,{elevationAlignedStartPoint:e,elevationAlignedEndPoint:t},s),r=o!=null?o.primaryOffsetAxis:b();ve(r,{measureType:n,elevationAlignedStartPoint:e,elevationAlignedEndPoint:t,directSegment:l,orientation:a,renderCoordsHelper:s});const c=o!=null?o.dimensionSegment:new B;return Re({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t})&&n===_.Vertical?(T(c.startRenderSpace,l.startRenderSpace),T(c.endRenderSpace,l.endRenderSpace)):vt(c,{offsetAxis:r,offset:i,relativeToSegment:l,renderCoordsHelper:s}),{directSegment:l,dimensionSegment:c,primaryOffsetAxis:r,spatialReference:s.spatialReference}}function Je(e,t,i,n){return t===ie.Start?(T(e.startRenderSpace,i.startRenderSpace),T(e.endRenderSpace,n.startRenderSpace)):(T(e.startRenderSpace,i.endRenderSpace),T(e.endRenderSpace,n.endRenderSpace)),e}var ie;function Ii(e,t,i,n){de(e.startRenderSpace,t.startRenderSpace,i,n),de(e.endRenderSpace,t.endRenderSpace,i,n)}function ft(e,t,i,n){switch(t){case _.Direct:return _t(e,i,n);case _.Horizontal:case _.Vertical:{const{elevationAlignedStartPoint:a,elevationAlignedEndPoint:s,dimension:o,geometry:l}=i;let r;o.measureType===_.Direct?(r=Ui(l,n)===a.z>s.z,t===_.Horizontal&&(r=!r)):r=!Fi(l);const[c,p]=r?[a,s]:[s,a],h=Y(p,ji);return t===_.Horizontal?h.z=c.z:(h.x=c.x,h.y=c.y),n.toRenderCoords(c,e.startRenderSpace),n.toRenderCoords(h,e.endRenderSpace),e}}}function _t(e,t,i){return i.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),i.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function Ui(e,t){const i=e.directSegment.eval(.5,g.get()),n=t.worldUpAtPosition(i,g.get()),a=e.dimensionSegment.eval(.5,g.get()),s=k(g.get(),a,i);return!it(s,J)&&V(s,n)>0}function Fi(e){const{startRenderSpace:t,endRenderSpace:i}=e.dimensionSegment,{startRenderSpace:n,endRenderSpace:a}=e.directSegment;return Ue(n,t)s?[o,n]:[n,o]}function ye(e,t,i){const n=t.directSegment.eval(.5,g.get());return i.worldUpAtPosition(n,e)}function ke(e,t){const{startRenderSpace:i,endRenderSpace:n}=t.directSegment;return k(e,n,i)}function Ee(e,t,i={invert:!1}){const{startRenderSpace:n,endRenderSpace:a}=t.dimensionSegment;return i.invert?k(e,n,a):k(e,a,n)}function $e(e,t){const i=e.directSegment.eval(.5,g.get());return t.headingAtPosition(i,e.primaryOffsetAxis)}function Wi(e,t){return Me(Ee(Ji,e))/t**2}const Ji=b();function yt(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:i}=e;if(t==null||i==null)return!1;const n=hi(t,i);return n!=null&&tt(n,"meters").value>St}const St=1e5;function ne(e){return e.geometry!=null}let U=class extends K{constructor(t){super(t)}initialize(){const t=fe(()=>this.analysisViewData.computations,({computation:i})=>this._watchComputation(i));this.addHandles(ae(t))}get analysis(){return this.analysisViewData.analysis}get _defaultUnit(){return Vt(this.view)}_watchComputation(t){return v(()=>pe(t),i=>{const{measureType:n}=i;if(yt(i)&&n!==_.Direct){const s=Math.round(Lt(St,"meters","kilometers"));return nt.getLogger(this).warnOnce(`A ${n} dimension in the analysis (id: '${this.analysis.id}') will not display, because only direct dimensions can measure lengths greater than ${s} km. Update the measureType of the affected dimension to "direct" to display it.`),void(t.geometry=null)}const a=me(i,this.view.renderCoordsHelper,t.geometry);t.geometry=a,t.result.length=Gi(a,n,this._defaultUnit)},A)}};d([u({constructOnly:!0})],U.prototype,"analysisViewData",void 0),d([u({constructOnly:!0})],U.prototype,"view",void 0),d([u()],U.prototype,"analysis",null),d([u()],U.prototype,"_defaultUnit",null),U=d([G("esri.views.3d.analysis.Dimension.support.DimensionController")],U);function he(e){return Gt(e.accentColor,.5)}function Ki(e){return It(e.accentColor)}const Mt=5,Qi=new j([127,127,127,.5]),wt=.8,Xi=4,Yi=6,Zi=.1,Pt=.5,en=18,tn=2,nn=.3,an=2,sn=.25,on=20,rn=5,Ke=5,Qe=10,ln=2500,dn=50,cn=2;class un{constructor(t){this.start=t.start,this.end=t.end,this.offset=t.offset,this.heading=t.heading,this.rotation=t.rotation,this.direct=t.direct,this.horizontal=t.horizontal,this.vertical=t.vertical}manipulatorName(t){return Object.keys(this).find(i=>this.hasOwnProperty(i)&&t===this[i])}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(t){for(const i of ci)t(this.manipulatorForMeasureType(i),i)}manipulatorForMeasureType(t){switch(t){case _.Direct:return this.direct;case _.Horizontal:return this.horizontal;case _.Vertical:return this.vertical}}}class pn extends _e{constructor(t,i){const n=gi(j.toUnitRGBA(he(t.effectiveTheme))),a=[new H(Ut(n,1,32,32),E)];super({view:t,renderObjects:a,metadata:i.metadata,available:!1,grabCursor:"crosshair",radius:Mt,collisionPriority:1}),this._themeHandle=v(()=>({color:j.toUnitRGBA(he(t.effectiveTheme))}),s=>n.setParameters(s))}destroy(){this._themeHandle.remove(),super.destroy()}}function mn(e,t){const i=[ce(-.5,0,0),ce(.5,0,0)],n=ee(t.unfocusedMaterial,i.map(s=>se(b(),s,Pt))),a=n.instantiate({material:t.focusedMaterial});return new _e({view:e,renderObjects:[new H(n,R.Unfocused|R.Selected|E),new H(a,R.Focused|E)],collisionType:{type:"line",paths:[i]},radius:Ve(t.lineSizePt)/2,metadata:t.metadata,available:!1,...mt})}class Xe extends _e{constructor(t,{lineSizePt:i,material:n,metadata:a}){super({view:t,autoScaleRenderObjects:!1,collisionPriority:1,metadata:a}),this._options={calloutColor:Ft(),lineSizePt:i,material:n},this._themeHandle=v(()=>j.toUnitRGBA(he(t.effectiveTheme)),s=>{this._options.calloutColor=s,Ze(this,Ye({...this._options,metadata:this.metadata}))},te)}update({lineSizePt:t,material:i}){this._options.lineSizePt=t,this._options.material=i,Ze(this,Ye({...this._options,metadata:this.metadata}))}destroy(){this._themeHandle.remove(),super.destroy()}}function Ye({calloutColor:e,lineSizePt:t,material:i,metadata:n}){return{calloutLength:.25*jt*wt*x(t)+en,calloutColor:e,calloutWidth:tn,customStateMask:E,discScale:nn,focusMultiplier:an,material:i,metadata:n}}function hn(e,t){const i=[ce(-.5,0,0),ce(.5,0,0)],n=ee(t.thinOffsetManipulatorMaterial,i),a=ee(t.unfocusedMaterial,i.map(o=>se(b(),o,Pt))),s=a.instantiate({material:t.focusedMaterial});return new _e({view:e,renderObjects:[new H(a,R.Unfocused|E),new H(s,R.Focused|E),new H(n,E)],collisionType:{type:"line",paths:[i]},radius:Ve(t.lineSizePt)/2,available:!1,metadata:t.metadata,...mt})}function gn(e,{isStart:t,createSnappingPipelineStep:i,dimension:n,onUpdate:a,view:s}){const o=t?"startPoint":"endPoint";return[oe(e,(r,c,p,h)=>{const m=He(r),{snappingStep:S,cancelSnapping:f}=i(h);p=p.next(m).next(ze(n,[o,"measureType","orientation"])).next(f),c.next(m).next(_i(s)).next(...S).next(M=>{const y=Y(M.mapEnd,new W);a(o==="startPoint"?{startPoint:y}:{endPoint:y})})})]}function fn(e,{computation:t,view:i}){return[oe(e,(n,a,s)=>{if(!ne(t)||!n.selected)return;const{geometry:o,dimension:l}=t,r=He(n);a.next(r).next(Ct(i,l,o.dimensionSegment,o.primaryOffsetAxis)),s.next(r).next(ze(l,["offset"]))})]}function _n(e,{computation:t,view:i}){return[oe(e,(n,a,s)=>{bt({cancel:s,computation:t,settingHeading:!0,steps:a,view:i})})]}function vn(e,{computation:t,view:i}){return[oe(e,(n,a,s)=>{bt({cancel:s,computation:t,settingHeading:!1,steps:a,view:i})}),e.events.on("immediate-click",n=>{yn(n,t,i)})]}function yn(e,t,i){const{dimension:n,geometry:a}=t;if(n.orientation===90||n.orientation===270)return n.orientation=0,void e.stopPropagation();if(a==null)return;const{renderCoordsHelper:s}=i,o=me({...pe(t),orientation:90},s),l=me({...pe(t),orientation:270},s);if(o==null||l==null)return;const r=$e(o,s),c=$e(l,s),p=Ot(a,i),h=we.shortestSignedDiff(p,r),m=we.shortestSignedDiff(p,c);n.orientation=Math.abs(h){f.action==="start"&&T(c,f.renderStart);const M=qt(m),y=fi(c,f.renderEnd,p,M);let L=S-Nt(y);n||(L=Sn(L)),l.orientation=L}),t.next(ze(l,["orientation"]))}function Sn(e){const t=we.normalize(e)%90;return t{if(l.action!=="start"||!ne(t))return;const{dimension:r,geometry:c}=t;a=r.measureType,s=r.offset,o=r.orientation;const p=T(g.get(),e.renderLocation);r.measureType=i,r.offset=Bi(p,i,c,n.renderCoordsHelper),r.orientation=0}),oe(e,(l,r,c)=>{if(!ne(t))return;const{geometry:p,dimension:h}=t,{renderCoordsHelper:m}=n,S=ft(At,i,t,m),f=ve(g.get(),{measureType:i,directSegment:p.directSegment,renderCoordsHelper:m}),M=He(l);r.next(M).next(Ct(n,h,S,f)),c.next(M).next(y=>(h.measureType=a,h.offset=s,h.orientation=o,y))})]}function Ct(e,t,i,n){const a=st(g.get(),i.endRenderSpace,i.startRenderSpace);F(a,a,n);const s=Pe(i.startRenderSpace,a,be()),o=Pe(i.startRenderSpace,n,be()),l=t.offset;let r,c=0;const p=new vi;return p.next(ht(e,s)).next(h=>{h.action==="start"&&(c=Fe(o,h.renderStart));const m=(Fe(o,h.renderEnd)-c)*e.renderCoordsHelper.unitInMeters;t.offset=l+m,r=h}),h=>(p.execute(h),r)}function Ot(e,t){const{directSegment:i}=e,{renderCoordsHelper:n}=t,a=ye(g.get(),e,n),s=ke(g.get(),e),o=F(g.get(),s,a),{viewForward:l}=t.state.camera;V(o,l)>0&&se(o,o,-1);const r=i.eval(.5,g.get());return n.headingAtPosition(r,o)}function wn(e,t,i){const{dimensionSegment:n,primaryOffsetAxis:a}=t,s=Ee(Z,t),o=ot(s,J)?Bt(ge):xe(s,a,J,ge),l=Math.max(rt(s),Zi/i.unitInMeters);lt(o,o,dt(Z,l,l,l)),e.modelTransform=o,e.renderLocation=n.eval(.5,Z)}function Pn(e,t,i){$t(e,t,i,{forHeading:!0})}function bn(e,t,i){$t(e,t,i,{forHeading:!1})}function $t(e,t,i,{forHeading:n}){const{dimension:a,geometry:s}=t,{primaryOffsetAxis:o}=s,l=se(Cn,o,a.offset>=0?1:-1),r=Tt(On,{forHeading:n,geometry:s,renderCoordsHelper:i});F(r,r,l);const c=xe(l,r,J,ge);e.modelTransform=c,e.renderLocation=Dt(Z,s,s.dimensionSegment,i)}const Cn=b(),On=b();function $n(e,t,i,n){const{geometry:a}=t,s=ft(At,i,t,n),o=ve(Z,{measureType:i,directSegment:a.directSegment,renderCoordsHelper:n}),l=k(Se,s.endRenderSpace,s.startRenderSpace),r=xe(l,o,J,ge),c=rt(l);lt(r,r,dt(Se,c,c,c)),e.modelTransform=r,e.renderLocation=s.eval(.5,Se)}function Dt(e,t,i,n){const{startRenderSpace:a,endRenderSpace:s}=i,o=Dn(t,n)?a:s;return T(e,o)}function Tt(e,{forHeading:t,geometry:i,renderCoordsHelper:n}){return t?ye(e,i,n):Ee(e,i,{invert:!0})}function Dn(e,t){const i=ke(Tn,e),n=ye(An,e,t);return V(i,n)>0}const Tn=b(),An=b();function xn(e){return x(e)+Xi}function Ve(e){return x(e)+Yi}function Ze(e,t){var S;const i=t.material??new gt({transparent:!0,writeDepth:!1,textureId:(S=t.texture)==null?void 0:S.id,renderOccluded:P.Opaque,isDecoration:!0}),n=t.focusMultiplier??re.focusMultiplier,a=t.calloutLength??re.calloutLength,s=re.discRadius*(t.discScale??1),o=s*n,l=(f,M)=>{const y=[0,1,2,2,3,0];return new Wt(M,[[je.POSITION,new Be([a-f,-f,0,a+f,-f,0,a+f,f,0,a-f,f,0],y,3,!0)],[je.UV0,new Be([0,0,1,0,1,1,0,1],y,2,!0)]])},r=t.calloutWidth??re.calloutWidth,c=new q({width:r,color:t.calloutColor,renderOccluded:P.OccludeAndTransparent,isDecoration:!0}),p=ee(c,[[0,0,0],[a-s,0,0]]),h=ee(c,[[0,0,0],[a-o,0,0]]),m=t.customStateMask??at.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[a,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=s,e.renderObjects=[new H(l(s,i),R.Unfocused|m),new H(p,R.Unfocused|m),new H(l(o,i),R.Focused|m),new H(h,R.Focused|m)]}const E=at.Custom1,Z=b(),Se=b(),ge=De(),At=new B;var D;function Hn(e,t){return{enabled:t.effectiveFeatureEnabled,elevationAlignedStartPoint:e.elevationAlignedStartPoint,elevationAlignedEndPoint:e.elevationAlignedEndPoint,geometry:e.geometry}}function zn(e,t){if(yt(e))return D.Direct;if(!e.enabled)return null;const{geometry:i}=e;if(i==null||ot(i.directSegment.startRenderSpace,i.directSegment.endRenderSpace))return null;const{camera:n}=t.state,a=ye(g.get(),i,t.renderCoordsHelper),s=ke(g.get(),i),o=se(g.get(),a,V(s,a)),l=st(g.get(),s,o),r=Me(l),c=Me(o),{startRenderSpace:p,endRenderSpace:h}=i.directSegment,m=Math.max(n.computeScreenPixelSizeAt(p)*Qe,n.computeScreenPixelSizeAt(h)*Qe)**2;return r{"startPoint"in t?r.startPoint=t.startPoint:"endPoint"in t&&(r.endPoint=t.endPoint)};if(n==null)h(),c!=null&&p!=null&&(r.measureType=p.measureType,r.orientation=p.orientation);else switch(r.measureType=_.Direct,n){case D.Horizontal:if(n!==c&&(r.orientation=0),"startPoint"in t){const m=t.startPoint;m!=null&&(m.z=s.z),r.startPoint=m}else if("endPoint"in t){const m=t.endPoint;m!=null&&(m.z=a.z),r.endPoint=m}break;case D.Vertical:if(n!==c&&(r.orientation=Ot(o,l)),"startPoint"in t){const m=t.startPoint;m!=null&&(m.x=s.x,m.y=s.y),r.startPoint=m}else if("endPoint"in t){const m=t.endPoint;m!=null&&(m.x=a.x,m.y=a.y),r.endPoint=m}break;case D.Direct:n!==c&&p!=null&&(r.orientation=p.orientation),h()}e.previousConstraint=n,e.unconstrainedGeometry=o}(function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical",e[e.Direct=2]="Direct"})(D||(D={}));let w=class extends K{constructor(e){super(e),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new ct,this._orientationManipulatorTexture=null,this._updatingHandles=new Jt,this._getSnappingContext=Kt(n=>new Di({elevationInfo:{mode:"absolute-height",offset:0},pointer:n,editGeometryOperations:new bi(new Ci("point",Oi(!0,!1,this.view.spatialReference))),visualizer:new Si}));const{view:t}=e;this._snappingManagerResult=$i(t),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:ue(2)}),this._constraintSnappingIndicator=new I({view:t,attached:!0,width:1,renderOccluded:P.OccludeAndTransparent,stipplePattern:ue(5),isDecoration:!0});const i=j.toUnitRGBA(Qi);this._stagedStartIndicator=new Pi({view:t,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:e.view.renderCoordsHelper.spatialReference,color:i,size:2*Mt,outlineSize:0,renderOccluded:P.OccludeAndTransparent,isDecoration:!0})}initialize(){var n;const{view:e}=this;this._snappingOperation=new Ai({view:e});const t=!((n=e._stage)!=null&&n.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result);this._orientationManipulatorMaterial=new gt({transparent:!0,writeDepth:!1,renderOccluded:P.Opaque,isDecoration:!0}),this.addHandles(v(()=>({accentColor:he(e.effectiveTheme),contrastColor:Ki(e.effectiveTheme)}),({accentColor:a,contrastColor:s})=>{const o=this._orientationManipulatorTexture,l=yi(e.textures,{accentColor:a,contrastColor:s,preMultiplyAlpha:t});this._orientationManipulatorMaterial.setParameters({textureId:l.texture.id}),this._orientationManipulatorTexture=l,o==null||o.release();const r=j.toUnitRGBA(a);this._unfocusedOffsetManipulatorMaterial.setParameters({color:r}),this._focusedOffsetManipulatorMaterial.setParameters({color:r}),this._thinOffsetManipulatorMaterial.setParameters({color:r}),this._constraintSnappingIndicator.color=r},te));const i=fe(()=>this.analysisViewData.computations,({computation:a})=>this._createManipulators(a));this.addHandles(ae(i)),this.addHandles([v(()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation}),({stagedPoint:a,stagedComputation:s})=>{if(s==null||a==null)return;const o=Y(a,new W);this._applyPointUpdate(s,{endPoint:o})},Ce),v(()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}),(a,s)=>{const{stagedDimension:o,selectedComputation:l,firstGrabbedManipulator:r}=a;if(o===(s==null?void 0:s.stagedDimension)&&r===(s==null?void 0:s.firstGrabbedManipulator)){for(const c of[l,s==null?void 0:s.selectedComputation])if(c!=null){const p=this._computationManipulators.get(c);p!=null&&this._updateManipulators(c,p,a)}}else for(const[c,p]of this._computationManipulators)this._updateManipulators(c,p,a)},A),v(()=>this.analysis.style.lineSize,a=>{this._updateManipulatorStyle(a)},te),v(()=>this.view.state.camera,()=>{this._stagedComputation!=null&&this._updateStagedDimensionOffset(this._stagedComputation)}),v(()=>{const a=this._stagedComputation;if(!a)return null;const s=a.elevationAlignedStartPoint,o=b();return s!=null&&this.view.renderCoordsHelper.toRenderCoords(s,o)?o:null},a=>{a!=null?(this._stagedStartIndicator.vertices=[a],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1})]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),Qt(this,()=>{const a=this._activeComputation,s=this._stagedComputation;if(a==null||s!=null){const o=this.view.inputManager.latestPointerType??"mouse",l=this._getSnappingContext(o);this._updatingHandles.addPromise(qe(this._snappingOperation.resnap(this._snappingManager,l)))}if(a!=null){const{start:o,end:l}=this._computationManipulators.get(a);if(o.grabbing||l.grabbing){const r=o.grabbing?"start":"end",c=this._computeConstraint(a);Rn(a,r,{constraint:c,view:this.view})}}})}destroy(){var e;this._snappingOperation=Te(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),(e=this._orientationManipulatorTexture)==null||e.release()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(this._stagedComputation!=null)return this._stagedComputation;const{selectedComputation:e}=this.analysisViewData;return this.hasGrabbedManipulators&&e!=null?e:null}get _stagedComputation(){var i;const e=this._stagedDimension,t=(i=this.analysisViewData.computations.at(-1))==null?void 0:i.computation;return e==null||t==null||t.dimension!==e?null:t}get _constraintHandles(){return[Ae(()=>this.analysisViewData.selectedComputation,e=>{e.previousConstraint=this._computeConstraint(e)},{...A,equals:Oe}),v(()=>{const e=this._activeComputation;if(e==null)return null;const{measureType:t,orientation:i}=e.dimension;return{measureType:t,orientation:i,computation:e}},(e,t)=>{if(e!=null&&t==null){const{measureType:i,orientation:n,computation:a}=e;switch(a.previousConstraint){case D.Horizontal:a.preConstraintProperties={measureType:_.Horizontal,orientation:0};break;case D.Vertical:a.preConstraintProperties={measureType:_.Vertical,orientation:0};break;case D.Direct:a.preConstraintProperties={measureType:_.Direct,orientation:n};break;default:a.preConstraintProperties={measureType:i,orientation:n}}}e==null&&t!=null&&(t.computation.preConstraintProperties=null)},Ce)]}get _snappingIndicatorHandles(){const e="snapping-indicator-event-handles";return[v(()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation}),({stagedComputation:t,activeComputation:i})=>{const n=this._constraintSnappingIndicator;if(this.removeHandles(e),i!=null)if(i===t)n.attached=!0;else{const{start:a,end:s}=this._computationManipulators.get(i),o=()=>{n.attached=a.grabbing||s.grabbing};o(),this.addHandles([a.events.on("grab-changed",o),s.events.on("grab-changed",o)],e)}else n.attached=!1}),v(()=>{const t=this._activeComputation;return t!=null?{geometry:t.geometry,constraint:t.previousConstraint}:{}},({geometry:t,constraint:i})=>{const n=this._constraintSnappingIndicator;t!=null&&i!=null&&i!==D.Direct?(n.visible=!0,n.setGeometryFromSegment(t.directSegment)):n.visible=!1})]}removeStaged(){return this._stagedDimension!=null&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(e){const{_stagedDimension:t}=this;if(t==null){const i=this._onUnstagedClick(e);return this.analysis.dimensions.add(i),null}return this._onStagedClick(e),t}onPointerMove({mapPoint:e,pointerType:t}){if(t==="touch")return;const i=this._getSnappingContext(t);this._updatingHandles.addPromise(qe(this._snappingOperation.snap({point:e},this._snappingManager,i)))}onManipulatorSelectionChanged(){this.analysisViewData.selectedComputation!=null&&(this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null))}_onUnstagedClick({mapPoint:e,pointerType:t}){let i=e;if(t==="mouse"){const a=this._getSnappingContext(t);i=this._snappingManager.update({point:e,context:a})}const n=new ui({startPoint:Y(i,new W),endPoint:null,measureType:_.Horizontal});return this._stagedDimension=n,this._resetSnappingState(),n}_onStagedClick({mapPoint:e,pointerType:t}){const i=this._stagedComputation;if(i==null)return;let n=e;if(t==="mouse"){const s=this._getSnappingContext(t);n=this._snappingManager.update({point:e,context:s})}const a=Y(n,new W);this._applyPointUpdate(i,{endPoint:a}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(e){const t=this._setupPointManipulator(e,{isStart:!0}),i=this._setupPointManipulator(e,{isStart:!1}),n=this._setupOffsetManipulator(e),a=this._setupHeadingManipulator(e),s=this._setupRotationManipulator(e),o=this._setupMeasureTypeManipulator(e,_.Direct),l=this._setupMeasureTypeManipulator(e,_.Horizontal),r=this._setupMeasureTypeManipulator(e,_.Vertical),c=new un({start:t,end:i,offset:n,heading:a,rotation:s,direct:o,horizontal:l,vertical:r});return this._setupComputationToManipulatorsSync(e,c),this._computationManipulators.set(e,c),this.manipulators.addMany(c.values()),{manipulators:c,remove:()=>{this._computationHandles.remove(e),this._computationManipulators.delete(e);for(const p of c.values())this.manipulators.remove(p)}}}_setupComputationToManipulatorsSync(e,t){this._computationHandles.add([v(()=>e.geometry,()=>this._updateManipulators(e,t),{...A,equals:Oe})],e)}_setupPointManipulator(e,t){const{view:i}=this,{dimension:n}=e,a=new pn(i,{metadata:n}),s=gn(a,{isStart:t.isStart,createSnappingPipelineStep:o=>Ti({snappingContext:this._getSnappingContext(o),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:n,onUpdate:o=>this._applyPointUpdate(e,o),view:i});return this._computationHandles.add(s,e),a}_setupOffsetManipulator(e){const{view:t}=this,i=mn(t,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:e.dimension}),n=fn(i,{computation:e,view:t});return this._computationHandles.add(n,e),i}_setupHeadingManipulator(e){const{view:t}=this,i=new Xe(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),n=_n(i,{computation:e,view:t});return this._computationHandles.add(n,e),i}_setupRotationManipulator(e){const{view:t}=this,i=new Xe(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),n=vn(i,{computation:e,view:t});return this._computationHandles.add(n,e),i}_setupMeasureTypeManipulator(e,t){const{view:i}=this,n=hn(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:e.dimension}),a=Mn(n,{computation:e,manipulatorMeasureType:t,view:i});return this._computationHandles.add(a,e),n}_updateManipulators(e,t,i={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:n,selectedComputation:a,firstGrabbedManipulator:s}=i,{start:o,end:l,offset:r,heading:c,rotation:p}=t,h=a===e,m=ne(e),{dimension:S}=e;for(const y of t.values()){const L=m&&n==null&&(s==null||y===s);y===r?(y.available=L,y.selected=h):y.available=L&&h}if(!m)return;this._computeConstraint(e)!=null?t.forEachMeasureTypeManipulator(y=>y.available=!1):t.manipulatorForMeasureType(S.measureType).available=!1;for(const y of[c,p])S.measureType===_.Direct&&S.offset!==0||(y.available=!1);Re(e)?p.available=!1:c.available=!1;const{geometry:f}=e;o.renderLocation=f.directSegment.startRenderSpace,l.renderLocation=f.directSegment.endRenderSpace;const{renderCoordsHelper:M}=this.view;wn(r,f,M),c.available&&Pn(c,e,M),p.available&&bn(p,e,M),t.forEachMeasureTypeManipulator((y,L)=>{y.available&&$n(y,e,L,M)})}_updateManipulatorStyle(e){const t=xn(e),i=Ve(e),n={lineSizePt:e,material:this._orientationManipulatorMaterial};for(const{offset:a,heading:s,rotation:o}of this._computationManipulators.values())a.radius=i/2,s.update(n),o.update(n);this._unfocusedOffsetManipulatorMaterial.setParameters({width:t}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(e,t){const{view:i}=this,n=pe(e);"startPoint"in t&&(n.elevationAlignedStartPoint=t.startPoint),"endPoint"in t&&(n.elevationAlignedEndPoint=t.endPoint);const a=me(n,i.renderCoordsHelper);if(a==null)return;const s=this._computeConstraint({...n,geometry:a});xt(e,t,{...n,constraint:s,unconstrainedGeometry:a,view:i}),e===this._stagedComputation&&this._updateStagedDimensionOffset(e)}_updateStagedDimensionOffset(e){if(e.geometry==null)return;e.geometry.directSegment.eval(.5,et);const t=this.view.state.camera.computeScreenPixelSizeAt(et);e.dimension.offset=dn*t}_computeConstraint(e){return zn(Hn(e,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){return new q({width:1,renderOccluded:P.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get testInfo(){const e=t=>{var i;return(i=this.analysisViewData.computations.find(({computation:n})=>n.dimension===t))==null?void 0:i.computation};return{disableManipulatorPartialOcclusion:()=>{this._stagedStartIndicator.renderOccluded=P.Occlude,this.manipulators.forEach(({manipulator:t})=>{for(const{geometry:i}of t.renderObjects)i.material.setParameters({renderOccluded:P.Occlude})})},getManipulatorsForDimension:t=>this._computationManipulators.get(e(t)),getComputationForDimension:t=>e(t),getConstraintForDimension:t=>{const i=e(t);return i!=null?this._computeConstraint(i):null},stagedDimension:this._stagedDimension,stagedStartIndicator:this._stagedStartIndicator,constraintSnappingIndicator:this._constraintSnappingIndicator,snappingManager:this._snappingManager}}};d([u({constructOnly:!0})],w.prototype,"analysis",void 0),d([u({constructOnly:!0})],w.prototype,"analysisViewData",void 0),d([u({constructOnly:!0})],w.prototype,"manipulators",void 0),d([u({constructOnly:!0})],w.prototype,"parentTool",void 0),d([u({constructOnly:!0,nonNullable:!0})],w.prototype,"view",void 0),d([u({readOnly:!0})],w.prototype,"updating",null),d([u()],w.prototype,"firstGrabbedManipulator",null),d([u()],w.prototype,"hasGrabbedManipulators",null),d([u()],w.prototype,"snappingOptions",null),d([u()],w.prototype,"_stagedDimension",void 0),d([u()],w.prototype,"_activeComputation",null),d([u()],w.prototype,"_stagedComputation",null),w=d([G("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],w);const et=b();var N;(function(e){e.Ready="ready",e.Creating="creating",e.Created="created"})(N||(N={}));let O=class extends xi{constructor(e){super(e),this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this._pointerMoveTimerMs=ln,this._prevPointerMoveTimeout=null}initialize(){this._intersector=Xt(this.view.state.viewingMode),this._intersector.options.store=Yt.MIN,this._lengthDimensionSubTool=new w({analysis:this.analysis,analysisViewData:this.analysisViewData,manipulators:this.manipulators,parentTool:this,view:this.view}),this.addHandles([ae(this._lengthDimensionSubTool),ut(()=>this._clearPointerMoveTimeout()),v(()=>this.state,e=>{e===N.Created&&this.finishToolCreation()},A),Ae(()=>this.firstGrabbedManipulator,e=>{this.selectedDimension=e.metadata},A),v(()=>this.selectedDimension,()=>this._resetPointerMoveTimeout(),A)])}get state(){return this.analysis.dimensions.some(e=>e.type==="length")?this._activeSubTool!=null?N.Creating:N.Created:N.Ready}get updating(){return this._lengthDimensionSubTool.updating}get cursor(){return this.active?"crosshair":null}get selectedDimension(){return this.analysisViewData.selectedDimension}set selectedDimension(e){this.analysisViewData.selectedDimension=e}onInputEvent(e){switch(e.type){case"immediate-click":this._clickHandler(e);break;case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e);break;case"key-down":if(Ne.cancel===e.key){if(this._activeSubTool!=null&&this._activeSubTool.removeStaged())return void e.stopPropagation();this.active||(this.selectedDimension=null)}else Ne.delete.includes(e.key)&&this._deleteKeyHandler()}}onActivate(){this._activeSubTool=this._lengthDimensionSubTool}onDeactivate(){this._activeSubTool!=null&&(this._activeSubTool.onDeactivate(),this._activeSubTool=null)}onShow(){this._resetPointerMoveTimeout()}onManipulatorSelectionChanged(){this._lengthDimensionSubTool.onManipulatorSelectionChanged()}onHide(){this.selectedDimension=null}_clickHandler(e){if(this.hasFocusedManipulators)return void e.stopPropagation();if(this._activeSubTool==null)return;const t=this._intersectScreen(e);t!=null&&(this.selectedDimension=this._activeSubTool.onClick({mapPoint:t,pointerType:e.pointerType}),e.stopPropagation())}_doubleClickHandler(e){this.active&&(this.view.activeTool=null,e.stopPropagation())}_pointerMoveHandler(e){if(this._resetPointerMoveTimeout(),this._activeSubTool==null||this.hasFocusedManipulators)return;const t=this._intersectScreen(e);t!=null&&this._activeSubTool.onPointerMove({mapPoint:t,pointerType:e.pointerType})}_deleteKeyHandler(){this._activeSubTool!=null&&this._activeSubTool.removeStaged(),this._removeSelected()}_intersectScreen(e){const t=Zt(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const i=this._intersector.results.min,n=g.get();return i.getIntersectionPoint(n)?this.view.renderCoordsHelper.fromRenderCoords(n,this.view.spatialReference):null}_removeSelected(){this.selectedDimension!=null&&(this.analysis.dimensions.remove(this.selectedDimension),this.selectedDimension=null)}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=ei(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.manipulators.forEach(e=>e.manipulator.state|=E),this._prevPointerMoveTimeout=ti.setTimeout(()=>{this.manipulators.forEach(e=>e.manipulator.state&=~E)},this._pointerMoveTimerMs)}get testInfo(){return{...this._lengthDimensionSubTool.testInfo,setManipulatorAutoHideDelay:e=>{this._pointerMoveTimerMs=e,this._resetPointerMoveTimeout()}}}};d([u({constructOnly:!0})],O.prototype,"view",void 0),d([u({constructOnly:!0})],O.prototype,"analysis",void 0),d([u({readOnly:!0})],O.prototype,"state",null),d([u({readOnly:!0})],O.prototype,"updating",null),d([u({readOnly:!0})],O.prototype,"cursor",null),d([u({constructOnly:!0})],O.prototype,"analysisViewData",void 0),d([u()],O.prototype,"selectedDimension",null),d([u()],O.prototype,"automaticManipulatorSelection",void 0),d([u()],O.prototype,"_activeSubTool",void 0),d([u()],O.prototype,"_lengthDimensionSubTool",void 0),O=d([G("esri.views.3d.analysis.Dimension.DimensionTool")],O);class kn extends ki{constructor(t,i){super(t),this._hasExternalMaterial=!1,this._renderOccluded=P.OccludeAndTransparent,this._width=1,this._color=zi(1,0,1,1),this._placement="end",this._markerPrimitive="arrow",this._material=i,this._hasExternalMaterial=i!=null,this.applyProperties(t)}setGeometryFromSegment(t,i){const n=t.endRenderSpace;this.transform=ii(En,n),this._normal=i;const{points:a}=t.createRenderGeometry(n,this.view.renderCoordsHelper);this.geometry=[a]}get renderOccluded(){return this._material!=null?this._material.parameters.renderOccluded:this._renderOccluded}set renderOccluded(t){this._renderOccluded=t,this._material!=null&&this._material.setParameters({renderOccluded:t})}get geometry(){return this._geometry}set geometry(t){this._geometry=t,this.recreateGeometry()}get normal(){return this._normal}set normal(t){this._normal=t,this.recreateGeometry()}get width(){return this._material!=null?this._material.parameters.width:this._width}set width(t){this._width=t,this._material!=null&&this._material.setParameters({width:t})}get color(){return this._material!=null?this._material.parameters.color:this._color}set color(t){this._color=Ri(t),this._material!=null&&this._material.setParameters({color:this._color})}get placement(){return this._material!=null?this._material.parameters.placement:this._placement}set placement(t){this._placement=t,this._material!=null&&this._material.setParameters({placement:this._placement})}get markerPrimitive(){var t;return((t=this._material)==null?void 0:t.parameters.markerPrimitive)??this._markerPrimitive}set markerPrimitive(t){this._markerPrimitive=t,this._material!=null&&this._material.setParameters({markerPrimitive:t})}createExternalResources(){this._hasExternalMaterial||(this._material=new pt({width:this._width,color:this._color,placement:this._placement,renderOccluded:this._renderOccluded,markerPrimitive:this._markerPrimitive,isDecoration:this.isDecoration}))}destroyExternalResources(){this._hasExternalMaterial||(this._material=null)}createGeometries(t){for(const i of ni(this.geometry,this.normal)){const n=ai(this._material,i);t.addGeometry(n)}}forEachExternalMaterial(t){this._hasExternalMaterial||t(this._material)}}const En=De();let Vn=class{set visible(t){for(const i of this._visualElements.values())i.attached=t}constructor(t){this.destroyed=!1,this._handles=new ct,this._messages=null,this._labelSegment=new B;const{analysis:i,computation:n,view:a,messages:s,isDecoration:o}=t;this.analysis=i,this.computation=n,this.view=a,this._messages=s;const l=t.visible,r={view:a,attached:l,isDecoration:o},{fontSize:c,textColor:p,textBackgroundColor:h}=i.style;this._visualElements=new Un({marker:new kn(r,t.markerMaterial),dimension:new I(r,t.dimensionLineMaterial),startOffset:new I(r,t.offsetLineMaterial),endOffset:new I(r,t.offsetLineMaterial),dimensionSmall:new I(r,t.smallDimensionLineMaterial),startOffsetSmall:new I(r,t.smallOffsetLineMaterial),endOffsetSmall:new I(r,t.smallOffsetLineMaterial),label:new pi({view:a,attached:l,distance:0,geometry:{type:"segment",sampleLocation:"center",segment:this._labelSegment,callout:!1},fontSize:x(c),textColor:p.clone(),backgroundColor:h.clone(),isDecoration:o})}),this._handles.add([v(()=>n.geometry,m=>{this.updateCameraDependentElements(a.state.camera,m,i.style),n.geometry!=null&&this._updateLines(n.geometry)},{...te,equals:Oe}),v(()=>n.length,m=>this._updateLabelContent(m),te)])}destroy(){this.destroyed=!0,this._handles=Te(this._handles);for(const t of this._visualElements.values())t.destroy()}get testInfo(){return{dimensionVisualElement:this._visualElements.dimension,label:this._visualElements.label}}_updateLines(t){const i=Je(Ln,ie.Start,t.directSegment,t.dimensionSegment),n=Je(Gn,ie.End,t.directSegment,t.dimensionSegment),a=this._visualElements;a.marker.setGeometryFromSegment(t.dimensionSegment,t.primaryOffsetAxis),a.dimension.setGeometryFromSegment(t.dimensionSegment),a.startOffset.setGeometryFromSegment(i),a.endOffset.setGeometryFromSegment(n),a.dimensionSmall.setGeometryFromSegment(t.dimensionSegment),a.startOffsetSmall.setGeometryFromSegment(i),a.endOffsetSmall.setGeometryFromSegment(n)}updateCameraDependentElements(t,i,n){const a=this._visualElements;if(i==null){for(const M of a.values())M.visible=!1;return}const s=t.computeScreenPixelSizeAt(i.dimensionSegment.eval(.5,In)),o=Wi(i,s),l=o<(x(n.lineSize)*cn)**2,r=!l;a.marker.visible=r,a.dimension.visible=r,a.startOffset.visible=r,a.endOffset.visible=r,a.dimensionSmall.visible=l,a.startOffsetSmall.visible=l,a.endOffsetSmall.visible=l;const c=x(n.fontSize)*rn,{label:p}=a;if(p.visible=o>=c**2,!p.visible)return;const{dimensionSegment:h,primaryOffsetAxis:m}=i,{offset:S}=this.computation.dimension,f=(Math.sign(S)>=0?1:-1)*this._labelOffsetPx(n)*s;Ii(this._labelSegment,h,m,f),p.updateLabelPosition()}updateLabelStyle(t){const{label:i}=this._visualElements;i.fontSize=x(t.fontSize),i.textColor=t.textColor,i.backgroundColor=t.textBackgroundColor}updateUnitsMessages(t){this._messages=t;const{length:i}=this.computation;this._updateLabelContent(i)}_updateLabelContent(t){const{label:i}=this._visualElements;t!=null&&this._messages!=null?i.text=Hi(this._messages,t,t.unit):i.text=""}_labelOffsetPx(t){return 1.5*x(t.fontSize)+on+x(t.lineSize/2)}};const Ln=new B,Gn=new B,In=b();class Un{constructor(t){this.marker=t.marker,this.dimension=t.dimension,this.startOffset=t.startOffset,this.endOffset=t.endOffset,this.dimensionSmall=t.dimensionSmall,this.startOffsetSmall=t.startOffsetSmall,this.endOffsetSmall=t.endOffsetSmall,this.label=t.label}values(){return[this.marker,this.dimension,this.startOffset,this.endOffset,this.dimensionSmall,this.startOffsetSmall,this.endOffsetSmall,this.label]}}let z=class extends K{get analysis(){return this.analysisViewData.analysis}get visible(){return this.analysisViewData.visible}constructor(e){super(e),this.loadingMessages=!1,this._messages=null}initialize(){const e=this.isDecoration;this._markerMaterial=new pt({width:1,anchor:si.Tip,color:Q,placement:"begin-end",worldSpace:!0,hideOnShortSegments:!0,hasTip:!0,renderOccluded:P.OccludeAndTransparent,markerPrimitive:"triangle",isDecoration:e}),this._dimensionLineMaterial=new q({width:1,color:Q,renderOccluded:P.OccludeAndTransparent,markerParameters:this._markerMaterial.parameters,isDecoration:e}),this._offsetLineMaterial=new q({width:1,color:Q,renderOccluded:P.OccludeAndTransparent,stipplePattern:ue(5),isDecoration:e}),this._smallDimensionLineMaterial=new q({width:1,color:Q,renderOccluded:P.OccludeAndTransparent,isDecoration:e}),this._smallOffsetLineMaterial=new q({width:1,color:Q,renderOccluded:P.OccludeAndTransparent,stipplePattern:ue(5),isDecoration:e});for(const i of this._lineMaterials())this.view._stage.add(i),this.addHandles(ut(()=>{var n;(n=this.view._stage)==null||n.remove(i)}));const t=fe(()=>this.analysisViewData.computations,({computation:i})=>this._createVisualization(i));this._dimensionVisualizations=t,this.addHandles([ae(t),v(()=>j.toUnitRGBA(this.analysis.style.color),i=>{for(const n of this._lineMaterials())n.setParameters({color:i})},A),v(()=>this.analysis.style.lineSize,i=>{const n=x(i);this._markerMaterial.setParameters({width:n*wt}),this._dimensionLineMaterial.setParameters({width:n,markerParameters:this._markerMaterial.parameters});const a=Math.max(n*sn,1);this._offsetLineMaterial.setParameters({width:a})},A),v(()=>({camera:this.view.state.camera,style:Fn(this.analysis)}),({camera:i,style:n})=>{for(const{visualization:a}of this._dimensionVisualizations)a.updateCameraDependentElements(i,a.computation.geometry,n),a.updateLabelStyle(n)}),v(()=>this.visible,i=>{for(const{visualization:n}of this._dimensionVisualizations)n.visible=i})]),this.addHandles([oi(()=>this._updateMessageBundle()),Ae(()=>!this.loadingMessages,()=>{for(const{visualization:i}of this._dimensionVisualizations)i.updateUnitsMessages(this._messages)},Ce)]),this._updateMessageBundle()}get testInfo(){return{visualizations:this._dimensionVisualizations.items.map(({visualization:e})=>e),disablePartialOcclusion:()=>{for(const e of this._lineMaterials())e.setParameters({renderOccluded:P.Occlude})}}}_createVisualization(e){const t=new Vn({analysis:this.analysis,computation:e,view:this.view,visible:this.visible,markerMaterial:this._markerMaterial,dimensionLineMaterial:this._dimensionLineMaterial,offsetLineMaterial:this._offsetLineMaterial,smallDimensionLineMaterial:this._smallDimensionLineMaterial,smallOffsetLineMaterial:this._smallOffsetLineMaterial,messages:this._messages,isDecoration:this.isDecoration});return{visualization:t,remove:()=>t.destroy()}}_lineMaterials(){return[this._markerMaterial,this._dimensionLineMaterial,this._offsetLineMaterial,this._smallDimensionLineMaterial,this._smallOffsetLineMaterial]}async _updateMessageBundle(){this.loadingMessages=!0;try{this._messages=await ri("esri/core/t9n/Units")}finally{this.loadingMessages=!1}}};function Fn(e){const{fontSize:t,lineSize:i,textColor:n,textBackgroundColor:a}=e.style;return{fontSize:t,lineSize:i,textBackgroundColor:a.clone(),textColor:n.clone()}}d([u({constructOnly:!0})],z.prototype,"analysisViewData",void 0),d([u({constructOnly:!0,nonNullable:!0})],z.prototype,"view",void 0),d([u({constructOnly:!0})],z.prototype,"isDecoration",void 0),d([u()],z.prototype,"analysis",null),d([u()],z.prototype,"visible",null),d([u()],z.prototype,"loadingMessages",void 0),z=d([G("esri.views.3d.analysis.Dimension.DimensionVisualization")],z);let X=class extends K{constructor(e){super(e),this.dimension=null,this.length=null}};d([u({constructOnly:!0,nonNullable:!0})],X.prototype,"dimension",void 0),d([u()],X.prototype,"length",void 0),X=d([G("esri.views.3d.analysis.LengthDimensionResult")],X);const jn=X;let $=class extends K{constructor(e){super(e),this.geometry=null,this.unconstrainedGeometry=null,this.elevationAlignedStartPoint=null,this.elevationAlignedEndPoint=null}normalizeCtorArgs(e){const{dimension:t,...i}=e;return{result:new jn({dimension:t}),...i}}initialize(){this.addHandles([v(()=>this.dimension.startPoint,e=>this.elevationAlignedStartPoint=this.projectAndAlignPoint(e),A),v(()=>this.dimension.endPoint,e=>this.elevationAlignedEndPoint=this.projectAndAlignPoint(e),A)])}get dimension(){return this.result.dimension}get length(){return this.result.length}};d([u({constructOnly:!0,nonNullable:!0})],$.prototype,"result",void 0),d([u({constructOnly:!0,nonNullable:!0})],$.prototype,"projectAndAlignPoint",void 0),d([u()],$.prototype,"dimension",null),d([u()],$.prototype,"length",null),d([u()],$.prototype,"geometry",void 0),d([u()],$.prototype,"unconstrainedGeometry",void 0),d([u()],$.prototype,"elevationAlignedStartPoint",void 0),d([u()],$.prototype,"elevationAlignedEndPoint",void 0),d([u()],$.prototype,"preConstraintProperties",void 0),d([u()],$.prototype,"previousConstraint",void 0),$=d([G("esri.views.3d.analysis.LengthDimensionComputation")],$);const Bn=e=>{let t=class extends e{constructor(...i){super(...i),this.analysis=null,this.tool=null,this.selectedDimension=null,this.interactive=!1,this.visible=null}get results(){return new li}createLengthDimensions(i){throw new Error("Method not implemented.")}};return d([u({constructOnly:!0})],t.prototype,"view",void 0),d([u({constructOnly:!0,nonNullable:!0})],t.prototype,"analysis",void 0),d([u()],t.prototype,"tool",void 0),d([u({readOnly:!0})],t.prototype,"results",null),d([u()],t.prototype,"selectedDimension",void 0),d([u()],t.prototype,"interactive",void 0),d([u()],t.prototype,"visible",void 0),t=d([G("esri.views.analysis.DimensionAnalysisView")],t),t};let C=class extends Bn(di(K)){constructor(e){super(e),this.type="dimension-view-3d",this.tool=null,this.selectedDimension=null,this._dimensionsToComputations=new Map,this._placementTask=null,this._projectAndAlignPoint=null}initialize(){this._projectAndAlignPoint=t=>{if(t==null)return null;const{spatialReference:i,elevationProvider:n}=this.view,a=Mi(t,i,n);return a==null&&wi(this.analysis,t.spatialReference,nt.getLogger(this)),a};const e=fe(()=>this.analysis.dimensions,t=>this._createComputation(t));this.computations=e,this.addHandles([Ei(this,O),ae(e)]),this._analysisVisualization=new z({analysisViewData:this,view:this.view,isDecoration:!this.parent}),this._analysisController=new U({analysisViewData:this,view:this.view})}destroy(){this._placementTask=We(this._placementTask),this._analysisVisualization=Te(this._analysisVisualization),Vi(this)}get updating(){var e;return((e=this._analysisVisualization)==null?void 0:e.loadingMessages)??!1}get results(){return this.analysis.dimensions.map(e=>this._dimensionsToComputations.get(e).result)}get selectedComputation(){const{selectedDimension:e}=this;return e==null?null:this._dimensionsToComputations.get(e)}get testInfo(){return{visualization:this._analysisVisualization,controller:this._analysisController}}async createLengthDimensions(e){return this.selectedDimension=null,this._placementTask=We(this._placementTask),this._placementTask=Li(this,e),this._placementTask.promise}_createComputation(e){const{_dimensionsToComputations:t}=this,i=new $({dimension:e,projectAndAlignPoint:this._projectAndAlignPoint});return t.set(e,i),{computation:i,remove:()=>this._removeComputation(i)}}_removeComputation(e){const{dimension:t}=e;t===this.selectedDimension&&(this.selectedDimension=null),this._dimensionsToComputations.delete(t),e.destroy()}};d([u({readOnly:!0})],C.prototype,"type",void 0),d([u()],C.prototype,"tool",void 0),d([u()],C.prototype,"updating",null),d([u({readOnly:!0})],C.prototype,"results",null),d([u()],C.prototype,"computations",void 0),d([u()],C.prototype,"selectedDimension",void 0),d([u()],C.prototype,"selectedComputation",null),d([u()],C.prototype,"_analysisVisualization",void 0),d([u()],C.prototype,"_analysisController",void 0),d([u()],C.prototype,"_dimensionsToComputations",void 0),d([u()],C.prototype,"_placementTask",void 0),C=d([G("esri.views.3d.analysis.DimensionAnalysisView3D")],C);const $a=C;export{$a as default}; diff --git a/dist/assets/DimensionLayer-WWUzEsQc.js b/dist/assets/DimensionLayer-WWUzEsQc.js deleted file mode 100644 index 59d2d5e..0000000 --- a/dist/assets/DimensionLayer-WWUzEsQc.js +++ /dev/null @@ -1 +0,0 @@ -import{iB as R,ab as u,e as t,y as n,ey as y,l1 as f,a4 as $,c as m,iE as O,V as x,fs as N,l2 as j,d as b,A as v,ef as E,l3 as S,dT as g,dM as q,dP as D,du as k,c7 as z}from"./index-J0iiHjMT.js";import{u as P}from"./LengthDimension-A_HnPDNi.js";let r=class extends R(O){constructor(e){super(e),this.type="simple",this.color=new u("black"),this.lineSize=2,this.fontSize=10,this.textColor=new u("black"),this.textBackgroundColor=new u([255,255,255,.6])}};t([n({type:["simple"],readOnly:!0,json:{write:{isRequired:!0}}})],r.prototype,"type",void 0),t([n({type:u,nonNullable:!0,json:{type:[y],write:{isRequired:!0}}})],r.prototype,"color",void 0),t([n({type:Number,cast:f,nonNullable:!0,range:{min:$(1)},json:{write:{isRequired:!0}}})],r.prototype,"lineSize",void 0),t([n({type:Number,cast:f,nonNullable:!0,json:{write:{isRequired:!0}}})],r.prototype,"fontSize",void 0),t([n({type:u,nonNullable:!0,json:{type:[y],write:{isRequired:!0}}})],r.prototype,"textColor",void 0),t([n({type:u,nonNullable:!0,json:{type:[y],write:{isRequired:!0}}})],r.prototype,"textBackgroundColor",void 0),r=t([m("esri.analysis.DimensionSimpleStyle")],r);const h=r,c=x.ofType(P);let l=class extends j{constructor(e){super(e),this.type="dimension",this.style=new h,this.extent=null}initialize(){this.addHandles(b(()=>this._computeExtent(),e=>{(e==null?void 0:e.pending)==null&&this._set("extent",e!=null?e.extent:null)},v))}get dimensions(){return this._get("dimensions")||new c}set dimensions(e){this._set("dimensions",E(e,this.dimensions,c))}get spatialReference(){for(const e of this.dimensions){if(e.startPoint!=null)return e.startPoint.spatialReference;if(e.endPoint!=null)return e.endPoint.spatialReference}return null}get requiredPropertiesForEditing(){return this.dimensions.reduce((e,s)=>(e.push(s.startPoint,s.endPoint),e),[])}async waitComputeExtent(){const e=this._computeExtent();return e!=null?e.pending:Promise.resolve()}_computeExtent(){const e=this.spatialReference;if(e==null)return{pending:null,extent:null};const s=[];for(const o of this.dimensions)o.startPoint!=null&&s.push(o.startPoint),o.endPoint!=null&&s.push(o.endPoint);const a=S(s,e);if(a.pending!=null)return{pending:a.pending,extent:null};let d=null;return a.geometries!=null&&(d=a.geometries.reduce((o,p)=>o==null?p!=null?g.fromPoint(p):null:p!=null?o.union(g.fromPoint(p)):o,null)),{pending:null,extent:d}}clear(){this.dimensions.removeAll()}};t([n({type:["dimension"]})],l.prototype,"type",void 0),t([n({cast:N,type:c,nonNullable:!0})],l.prototype,"dimensions",null),t([n({readOnly:!0})],l.prototype,"spatialReference",null),t([n({types:{key:"type",base:null,typeMap:{simple:h}},nonNullable:!0})],l.prototype,"style",void 0),t([n({value:null,readOnly:!0})],l.prototype,"extent",void 0),t([n({readOnly:!0})],l.prototype,"requiredPropertiesForEditing",null),l=t([m("esri.analysis.DimensionAnalysis")],l);const w=l;let i=class extends q(D(z)){constructor(e){if(super(e),this.type="dimension",this.operationalLayerType="ArcGISDimensionLayer",this.source=new w,this.opacity=1,e){const{source:s,style:a}=e;s&&a&&(s.style=a)}}initialize(){this.addHandles([b(()=>this.source,(e,s)=>{s!=null&&s.parent===this&&(s.parent=null),e!=null&&(e.parent=this)},v)])}async load(){return this.addResolvingPromise(this.source.waitComputeExtent()),this}get spatialReference(){return this.source.spatialReference}get style(){return this.source.style}set style(e){this.source.style=e}get fullExtent(){return this.source.extent}releaseAnalysis(e){this.source===e&&(this.source=new w)}get analysis(){return this.source}set analysis(e){this.source=e}get dimensions(){return this.source.dimensions}set dimensions(e){this.source.dimensions=e}writeDimensions(e,s,a,d){s.dimensions=e.filter(({startPoint:o,endPoint:p})=>o!=null&&p!=null).map(o=>o.toJSON(d)).toJSON()}};t([n({json:{read:!1},readOnly:!0})],i.prototype,"type",void 0),t([n({type:["ArcGISDimensionLayer"]})],i.prototype,"operationalLayerType",void 0),t([n({nonNullable:!0})],i.prototype,"source",void 0),t([n({readOnly:!0})],i.prototype,"spatialReference",null),t([n({types:{key:"type",base:null,typeMap:{simple:h}},json:{write:{ignoreOrigin:!0}}})],i.prototype,"style",null),t([n({readOnly:!0})],i.prototype,"fullExtent",null),t([n({readOnly:!0,json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}}})],i.prototype,"opacity",void 0),t([n({type:["show","hide"]})],i.prototype,"listMode",void 0),t([n({type:x.ofType(P),json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{ignoreOrigin:!0}}}}})],i.prototype,"dimensions",null),t([k("web-scene","dimensions")],i.prototype,"writeDimensions",null),i=t([m("esri.layers.DimensionLayer")],i);const T=i;export{T as default}; diff --git a/dist/assets/DimensionLayer-pDBYhz_R.js b/dist/assets/DimensionLayer-pDBYhz_R.js new file mode 100644 index 0000000..1709414 --- /dev/null +++ b/dist/assets/DimensionLayer-pDBYhz_R.js @@ -0,0 +1 @@ +import{iC as R,W as u,e as t,y as n,er as y,l9 as g,a2 as $,c as m,iF as O,V as x,fn as N,la as j,B as b,T as v,e8 as S,lb as E,dO as f,dH as q,dK as C,du as D,aI as k}from"./index-pCX-0tJH.js";import{u as P}from"./LengthDimension-tb0JjnxZ.js";let r=class extends R(O){constructor(e){super(e),this.type="simple",this.color=new u("black"),this.lineSize=2,this.fontSize=10,this.textColor=new u("black"),this.textBackgroundColor=new u([255,255,255,.6])}};t([n({type:["simple"],readOnly:!0,json:{write:{isRequired:!0}}})],r.prototype,"type",void 0),t([n({type:u,nonNullable:!0,json:{type:[y],write:{isRequired:!0}}})],r.prototype,"color",void 0),t([n({type:Number,cast:g,nonNullable:!0,range:{min:$(1)},json:{write:{isRequired:!0}}})],r.prototype,"lineSize",void 0),t([n({type:Number,cast:g,nonNullable:!0,json:{write:{isRequired:!0}}})],r.prototype,"fontSize",void 0),t([n({type:u,nonNullable:!0,json:{type:[y],write:{isRequired:!0}}})],r.prototype,"textColor",void 0),t([n({type:u,nonNullable:!0,json:{type:[y],write:{isRequired:!0}}})],r.prototype,"textBackgroundColor",void 0),r=t([m("esri.analysis.DimensionSimpleStyle")],r);const h=r,c=x.ofType(P);let l=class extends j{constructor(e){super(e),this.type="dimension",this.style=new h,this.extent=null}initialize(){this.addHandles(b(()=>this._computeExtent(),e=>{(e==null?void 0:e.pending)==null&&this._set("extent",e!=null?e.extent:null)},v))}get dimensions(){return this._get("dimensions")||new c}set dimensions(e){this._set("dimensions",S(e,this.dimensions,c))}get spatialReference(){for(const e of this.dimensions){if(e.startPoint!=null)return e.startPoint.spatialReference;if(e.endPoint!=null)return e.endPoint.spatialReference}return null}get requiredPropertiesForEditing(){return this.dimensions.reduce((e,s)=>(e.push(s.startPoint,s.endPoint),e),[])}async waitComputeExtent(){const e=this._computeExtent();return e!=null?e.pending:Promise.resolve()}_computeExtent(){const e=this.spatialReference;if(e==null)return{pending:null,extent:null};const s=[];for(const o of this.dimensions)o.startPoint!=null&&s.push(o.startPoint),o.endPoint!=null&&s.push(o.endPoint);const a=E(s,e);if(a.pending!=null)return{pending:a.pending,extent:null};let d=null;return a.geometries!=null&&(d=a.geometries.reduce((o,p)=>o==null?p!=null?f.fromPoint(p):null:p!=null?o.union(f.fromPoint(p)):o,null)),{pending:null,extent:d}}clear(){this.dimensions.removeAll()}};t([n({type:["dimension"]})],l.prototype,"type",void 0),t([n({cast:N,type:c,nonNullable:!0})],l.prototype,"dimensions",null),t([n({readOnly:!0})],l.prototype,"spatialReference",null),t([n({types:{key:"type",base:null,typeMap:{simple:h}},nonNullable:!0})],l.prototype,"style",void 0),t([n({value:null,readOnly:!0})],l.prototype,"extent",void 0),t([n({readOnly:!0})],l.prototype,"requiredPropertiesForEditing",null),l=t([m("esri.analysis.DimensionAnalysis")],l);const w=l;let i=class extends q(C(k)){constructor(e){if(super(e),this.type="dimension",this.operationalLayerType="ArcGISDimensionLayer",this.source=new w,this.opacity=1,e){const{source:s,style:a}=e;s&&a&&(s.style=a)}}initialize(){this.addHandles([b(()=>this.source,(e,s)=>{s!=null&&s.parent===this&&(s.parent=null),e!=null&&(e.parent=this)},v)])}async load(){return this.addResolvingPromise(this.source.waitComputeExtent()),this}get spatialReference(){return this.source.spatialReference}get style(){return this.source.style}set style(e){this.source.style=e}get fullExtent(){return this.source.extent}releaseAnalysis(e){this.source===e&&(this.source=new w)}get analysis(){return this.source}set analysis(e){this.source=e}get dimensions(){return this.source.dimensions}set dimensions(e){this.source.dimensions=e}writeDimensions(e,s,a,d){s.dimensions=e.filter(({startPoint:o,endPoint:p})=>o!=null&&p!=null).map(o=>o.toJSON(d)).toJSON()}};t([n({json:{read:!1},readOnly:!0})],i.prototype,"type",void 0),t([n({type:["ArcGISDimensionLayer"]})],i.prototype,"operationalLayerType",void 0),t([n({nonNullable:!0})],i.prototype,"source",void 0),t([n({readOnly:!0})],i.prototype,"spatialReference",null),t([n({types:{key:"type",base:null,typeMap:{simple:h}},json:{write:{ignoreOrigin:!0}}})],i.prototype,"style",null),t([n({readOnly:!0})],i.prototype,"fullExtent",null),t([n({readOnly:!0,json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}}})],i.prototype,"opacity",void 0),t([n({type:["show","hide"]})],i.prototype,"listMode",void 0),t([n({type:x.ofType(P),json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{ignoreOrigin:!0}}}}})],i.prototype,"dimensions",null),t([D("web-scene","dimensions")],i.prototype,"writeDimensions",null),i=t([m("esri.layers.DimensionLayer")],i);const T=i;export{T as default}; diff --git a/dist/assets/DimensionLayerView3D-fNUV7ooO.js b/dist/assets/DimensionLayerView3D-fNUV7ooO.js new file mode 100644 index 0000000..3fbbc74 --- /dev/null +++ b/dist/assets/DimensionLayerView3D-fNUV7ooO.js @@ -0,0 +1,7 @@ +import{e as a,y as t,c as y,V as h,jW as w,B as u,T as d,r as V,N as c,b as p,I as _,ad as m,de as v}from"./index-pCX-0tJH.js";import{n as A}from"./LayerView3D-57OghbRh.js";import{u as f}from"./LayerView-ixwLVnzr.js";const D=i=>{let s=class extends i{constructor(...e){super(...e),this.layer=null}get interactive(){return this.analysisView!=null&&this.analysisView.interactive}set interactive(e){this.analysisView!=null&&(this.analysisView.interactive=e)}get results(){return this.analysisView!=null?this.analysisView.results:new h}get selectedDimension(){return this.analysisView!=null?this.analysisView.selectedDimension:null}set selectedDimension(e){this.analysisView!=null&&(this.analysisView.selectedDimension=e)}async createLengthDimensions(e){if(this.analysisView==null)throw w();await this.analysisView.createLengthDimensions(e)}};return a([t()],s.prototype,"layer",void 0),a([t()],s.prototype,"interactive",null),a([t({readOnly:!0})],s.prototype,"results",null),a([t()],s.prototype,"selectedDimension",null),a([t()],s.prototype,"analysisView",void 0),s=a([y("esri.views.layers.DimensionLayerView")],s),s},o="analysis-view-handles";let n=class extends A(D(f)){constructor(i){super(i),this.type="dimension-3d",this._analysisModule=null}initialize(){this.addHandles(u(()=>this.layer.source,i=>{this._destroyAnalysisView(),i!=null&&this._createAnalysisView(i)},d),o)}destroy(){this.removeHandles(o),this._destroyAnalysisView()}isUpdating(){return this._createAnalysisViewTask!=null||this.analysisView!=null&&this.analysisView.updating}async whenAnalysisView(){if(this.analysisView!=null)return this.analysisView;if(this._createAnalysisViewTask!=null)return this._createAnalysisViewTask.promise;throw new V("layerview:no-analysisview-for-analysis","The analysis has not been set on the DimensionLayer of this layer view")}_createAnalysisView(i){const s=c(async e=>(this.analysisView=await this._createAnalysisViewPromise(i,e),this._createAnalysisViewTask===s&&(this._createAnalysisViewTask=null),this.analysisView));this.addResolvingPromise(s.promise),this._createAnalysisViewTask=s}_destroyAnalysisView(){this.analysisView=p(this.analysisView),this._createAnalysisViewTask=_(this._createAnalysisViewTask)}async _createAnalysisViewPromise(i,s){let e=this._analysisModule;if(e==null){const r=await this._loadAnalysisModule();this._analysisModule=r,e=r}const l=new e.default({analysis:i,view:this.view,parent:this});if(await l.when(),m(s))throw l.destroy(),w();return l}_loadAnalysisModule(){return v(()=>import("./DimensionAnalysisView3D-6H84TLcJ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))}};a([t()],n.prototype,"type",void 0),a([t()],n.prototype,"analysisView",void 0),a([t()],n.prototype,"_createAnalysisViewTask",void 0),n=a([y("esri.views.3d.layers.DimensionLayerView3D")],n);const g=n;export{g as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/DimensionAnalysisView3D-6H84TLcJ.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/AnalysisView3D-XCzG0Hzh.js","assets/LengthDimension-tb0JjnxZ.js","assets/Segment-TQS1M_Ix.js","assets/VisualElement--2Scr6Yq.js","assets/TextOverlayItem-YHZxWGyg.js","assets/euclideanLengthMeasurementUtils-Kj2RYqri.js","assets/measurementUtils-69EiqRp6.js","assets/ShadedColorMaterial.glsl-L0JVQzbX.js","assets/dragEventPipeline3D-H_IlIVP7.js","assets/InteractiveToolBase-6mltmL27.js","assets/drawUtils-0wb2c6-q.js","assets/ImageMaterial.glsl-PU0wbmEN.js","assets/Factory-EVPOwZPk.js","assets/SnappingVisualizer3D-PUGfSdbO.js","assets/ExtendedLineVisualElement-VJvEdv3K.js","assets/vec4f32-NvfHy9q7.js","assets/EngineVisualElement-u0-BOxGn.js","assets/Laserlines.glsl-U7nZFq0e.js","assets/PointVisualElement-m9C0-AJh.js","assets/Object3DVisualElement-8HoU366x.js","assets/RightAngleQuadVisualElement-Jj11oqLR.js","assets/SnappingContext-ax0tf6c6.js","assets/PointSnappingHint-bwlQAyn6.js","assets/LineVisualElement-iKo1s90I.js","assets/VerticesVisualElement-QZStMB48.js","assets/EditGeometryOperations-vpHcsZOg.js","assets/SceneSnappingManagerPool-V-V1M2q0.js","assets/SnappingDragPipelineStep-HDAWWRgo.js","assets/dehydratedFeatureComparison-IJSogXWn.js","assets/SnappingOperation-hED0OM8D.js","assets/AnalysisToolBase-olyQy6lh.js","assets/quantityFormatUtils-oYgdvR_2.js","assets/analysisViewUtils-lJExoyyw.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/DimensionLayerView3D-sKnmIRMF.js b/dist/assets/DimensionLayerView3D-sKnmIRMF.js deleted file mode 100644 index 48f447c..0000000 --- a/dist/assets/DimensionLayerView3D-sKnmIRMF.js +++ /dev/null @@ -1,7 +0,0 @@ -import{e as a,y as t,c as y,V as h,jP as w,d as u,A as d,E as V,b as c,n as p,a as _,g as m,de as v}from"./index-J0iiHjMT.js";import{n as A}from"./LayerView3D-iOx2MD1g.js";import{u as f}from"./LayerView-efDufa6j.js";const D=i=>{let s=class extends i{constructor(...e){super(...e),this.layer=null}get interactive(){return this.analysisView!=null&&this.analysisView.interactive}set interactive(e){this.analysisView!=null&&(this.analysisView.interactive=e)}get results(){return this.analysisView!=null?this.analysisView.results:new h}get selectedDimension(){return this.analysisView!=null?this.analysisView.selectedDimension:null}set selectedDimension(e){this.analysisView!=null&&(this.analysisView.selectedDimension=e)}async createLengthDimensions(e){if(this.analysisView==null)throw w();await this.analysisView.createLengthDimensions(e)}};return a([t()],s.prototype,"layer",void 0),a([t()],s.prototype,"interactive",null),a([t({readOnly:!0})],s.prototype,"results",null),a([t()],s.prototype,"selectedDimension",null),a([t()],s.prototype,"analysisView",void 0),s=a([y("esri.views.layers.DimensionLayerView")],s),s},o="analysis-view-handles";let n=class extends A(D(f)){constructor(i){super(i),this.type="dimension-3d",this._analysisModule=null}initialize(){this.addHandles(u(()=>this.layer.source,i=>{this._destroyAnalysisView(),i!=null&&this._createAnalysisView(i)},d),o)}destroy(){this.removeHandles(o),this._destroyAnalysisView()}isUpdating(){return this._createAnalysisViewTask!=null||this.analysisView!=null&&this.analysisView.updating}async whenAnalysisView(){if(this.analysisView!=null)return this.analysisView;if(this._createAnalysisViewTask!=null)return this._createAnalysisViewTask.promise;throw new V("layerview:no-analysisview-for-analysis","The analysis has not been set on the DimensionLayer of this layer view")}_createAnalysisView(i){const s=c(async e=>(this.analysisView=await this._createAnalysisViewPromise(i,e),this._createAnalysisViewTask===s&&(this._createAnalysisViewTask=null),this.analysisView));this.addResolvingPromise(s.promise),this._createAnalysisViewTask=s}_destroyAnalysisView(){this.analysisView=p(this.analysisView),this._createAnalysisViewTask=_(this._createAnalysisViewTask)}async _createAnalysisViewPromise(i,s){let e=this._analysisModule;if(e==null){const r=await this._loadAnalysisModule();this._analysisModule=r,e=r}const l=new e.default({analysis:i,view:this.view,parent:this});if(await l.when(),m(s))throw l.destroy(),w();return l}_loadAnalysisModule(){return v(()=>import("./DimensionAnalysisView3D-W2fgoQBr.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))}};a([t()],n.prototype,"type",void 0),a([t()],n.prototype,"analysisView",void 0),a([t()],n.prototype,"_createAnalysisViewTask",void 0),n=a([y("esri.views.3d.layers.DimensionLayerView3D")],n);const $=n;export{$ as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/DimensionAnalysisView3D-W2fgoQBr.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/AnalysisView3D-jkk3JIRT.js","assets/LengthDimension-A_HnPDNi.js","assets/Segment-hN2uWAPW.js","assets/VisualElement-kjYXz27t.js","assets/TextOverlayItem-eCjvS6IO.js","assets/euclideanLengthMeasurementUtils-VQw5qWk6.js","assets/measurementUtils-84-ZBArh.js","assets/ShadedColorMaterial.glsl-Fp4o6LjC.js","assets/dragEventPipeline3D-4CqrlxD2.js","assets/InteractiveToolBase-WDic4GPF.js","assets/drawUtils-woTYaREB.js","assets/ImageMaterial.glsl-TdPtjVc_.js","assets/Factory-m-O4WAoG.js","assets/SnappingVisualizer3D-KWlqByBu.js","assets/ExtendedLineVisualElement-YbjiXiBG.js","assets/vec4f32-NvfHy9q7.js","assets/EngineVisualElement-eZNKTKsI.js","assets/Laserlines.glsl-nvjcCsAw.js","assets/PointVisualElement-bX-_4FqS.js","assets/Object3DVisualElement-TMb7y_wl.js","assets/RightAngleQuadVisualElement-y_W8r903.js","assets/SnappingContext-6K6JmvvY.js","assets/PointSnappingHint-ULetRXiW.js","assets/LineVisualElement-4BP10o6v.js","assets/VerticesVisualElement-oQAA_hbc.js","assets/EditGeometryOperations-TPE5Wzab.js","assets/SceneSnappingManagerPool-OpebO9Di.js","assets/SnappingDragPipelineStep-THHIXt-p.js","assets/dehydratedFeatureComparison-hdPq-zad.js","assets/SnappingOperation-2U48wt1k.js","assets/AnalysisToolBase-3A13PdgS.js","assets/quantityFormatUtils-NiAiojad.js","assets/analysisViewUtils-AQaQeJpR.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/DirectLineMeasurement3D-3Pkkgamv.js b/dist/assets/DirectLineMeasurement3D-3Pkkgamv.js deleted file mode 100644 index 7e87a0c..0000000 --- a/dist/assets/DirectLineMeasurement3D-3Pkkgamv.js +++ /dev/null @@ -1 +0,0 @@ -import{e as i,y as n,T as H,kP as V,c as L,l2 as it,p as nt,d as D,n as A,ab as z,kz as st,nk as at,b9 as rt,nl as lt,nm as ot,P as $,aa as x,i3 as ut,k as dt,gD as ht,A as q,nn as pt,kS as G,i5 as ct,an as gt,kK as mt,kM as I,hl as vt,hn as R,ao as yt,kN as F,kO as wt}from"./index-J0iiHjMT.js";import{W as _t}from"./measurementUtils-St7B-HxA.js";import{O as bt}from"./SnappingVisualizer3D-KWlqByBu.js";import{G as Pt,F as ft,A as Dt}from"./dragEventPipeline3D-4CqrlxD2.js";import{e as Mt}from"./interfaces-tkyofe_Z.js";import{e as W}from"./interfaces-lHX1zDRv.js";import{$ as B,w as Lt,e as St}from"./ShadedColorMaterial.glsl-Fp4o6LjC.js";import{c as Vt}from"./Laserlines.glsl-nvjcCsAw.js";import{a as Ot}from"./AnalysisToolBase-3A13PdgS.js";import{V as $t,p as xt,w as Ct}from"./EditGeometryOperations-TPE5Wzab.js";import{d as Tt,R as Ut}from"./InteractiveToolBase-WDic4GPF.js";import{a as Ht}from"./SceneSnappingManagerPool-OpebO9Di.js";import{e as At}from"./SnappingContext-6K6JmvvY.js";import{f as kt}from"./SnappingDragPipelineStep-THHIXt-p.js";import{u as Et}from"./InteractiveAnalysisViewModel-RI-qFGDH.js";import{u as zt}from"./MeasurementWidgetContent-d8uX7Gw_.js";import"./ExtendedLineVisualElement-YbjiXiBG.js";import"./vec4f32-NvfHy9q7.js";import"./EngineVisualElement-eZNKTKsI.js";import"./VisualElement-kjYXz27t.js";import"./PointVisualElement-bX-_4FqS.js";import"./Object3DVisualElement-TMb7y_wl.js";import"./RightAngleQuadVisualElement-y_W8r903.js";import"./drawUtils-woTYaREB.js";import"./PointSnappingHint-ULetRXiW.js";import"./dehydratedFeatureComparison-hdPq-zad.js";let f=class extends it{constructor(t){super(t),this.type="direct-line-measurement",this.startPoint=null,this.endPoint=null,this.unit=null}get requiredPropertiesForEditing(){return[this.startPoint,this.endPoint]}clear(){this.startPoint=null,this.endPoint=null}};i([n({type:["direct-line-measurement"]})],f.prototype,"type",void 0),i([n({type:H})],f.prototype,"startPoint",void 0),i([n({type:H})],f.prototype,"endPoint",void 0),i([n({type:V,value:null})],f.prototype,"unit",void 0),i([n({readOnly:!0})],f.prototype,"requiredPropertiesForEditing",null),f=i([L("esri.analysis.DirectLineMeasurementAnalysis")],f);const j=f;var M;(function(t){t.Manipulators="manipulators",t.AnalysisViewDestroyed="analysis-view-destroyed",t.AnalysisView="analysis-view"})(M||(M={}));let d=class extends nt{constructor(t){super(t),this.cursorPoint=null,this._visible=!1,this._laserLine=null,this.laserLineEnabled=!0,this._lastDraggedHandle=null}initialize(){this._laserLine=new Vt({view:this.view,attached:!0,isDecoration:!0}),this._updateVisibility(this._visible),this._connectToAnalysisView(),this.addHandles(D(()=>this._params,({laserLineGlowColor:t,laserLineInnerColor:e,laserLineGlobalAlpha:s})=>{const a=this._laserLine,l=a.style;a.style={...l,innerColor:e,glowColor:t,globalAlpha:s}}))}destroy(){this._laserLine=A(this._laserLine)}get _params(){const{accentColor:t}=this.view.effectiveTheme;return{laserLineGlowColor:z.toUnitRGB(t),laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:z.toUnitRGB(st(t)),laserLineInnerWidth:.75,laserLineGlobalAlpha:.75*t.a,handleColor:at(t,.5),handleRadius:5}}get visible(){return this._visible}set visible(t){t?this.show():this.hide()}get testData(){const t=this._laserLine.testData,e=this.analysisViewData.testData;return{labels:e==null?void 0:e.labels,stripeLength:e==null?void 0:e.stripeLength,laserLineRenderer:{heightManifoldEnabled:t!=null&&t.heightManifoldEnabled,heightManifoldTarget:t!=null?t.heightManifoldTarget:null,pointDistanceEnabled:t!=null&&t.pointDistanceEnabled,pointDistanceOrigin:t!=null?t.pointDistanceOrigin:null,pointDistanceTarget:t!=null?t.pointDistanceTarget:null,lineVerticalPlaneEnabled:t!=null&&t.lineVerticalPlaneEnabled}}}get _cursorPosition(){const t=x(),e=this.cursorPoint;return e&&this.view.renderCoordsHelper.toRenderCoords(e,t),t}get _startPosition(){const t=x(),e=this.analysis.startPoint;return e&&this.view.renderCoordsHelper.toRenderCoords(e,t),t}get _endPosition(){const t=x(),e=this.analysis.endPoint;return e&&this.view.renderCoordsHelper.toRenderCoords(e,t),t}get _laserLineParams(){const t=this._focusPosition,{active:e,lineState:s}=this.toolState,a=this.analysisViewData,l=this.laserLineEnabled&&!!t&&s!=="measured"&&e;if(!l||!this.visible||a==null||a.destroyed)return{heightManifoldTarget:null,pointDistanceLine:null,lineVerticalPlaneSegment:null};const o=a.actualVisualizedMeasurement,r=this.view.viewingMode!=="local"&&l&&!!this.analysis.startPoint&&o==="geodesic",h=l&&a.viewMode===W.Triangle;return{heightManifoldTarget:o==="euclidean"?t:null,pointDistanceLine:r?this._pointDistanceLine:null,lineVerticalPlaneSegment:h?rt(this._startPosition,this._endPosition):null}}get _focusPosition(){const{lineState:t}=this.toolState,e=this.analysisViewData,s=e!=null&&!e.destroyed&&e.measurementMode===Mt.Euclidean&&e.viewMode===W.Direct;switch(t){case"drawing":return s?this._startPosition:this.analysis.endPoint?this._endPosition:this._startPosition;case"editing":return s?this._lastDraggedHandle==="start"?this._endPosition:this._startPosition:this._lastDraggedHandle==="start"?this._startPosition:this._endPosition;default:return this.cursorPoint!=null?this._cursorPosition:null}}get _pointDistanceLine(){return{origin:this.toolState.lineState==="drawing"||this._lastDraggedHandle==="end"?this._startPosition:this._endPosition,target:this._focusPosition}}createManipulators(){const t=this._params,{view:e}=this,s=()=>{const u=Lt(t.handleColor),P=[new St(ut(u,1,32,32))],_=new B({view:e,renderObjects:P});return _.available=!1,_.radius=t.handleRadius,[_,u]},[a,l]=s(),[o,r]=s(),h=new B({view:this.view});h.available=!1,h.interactive=!1,this.analysis.startPoint!=null&&(a.location=this.analysis.startPoint,a.available=!0),this.analysis.endPoint!=null&&(o.location=this.analysis.endPoint,o.available=!0);const g=()=>{let u=this._lastDraggedHandle;a.grabbing&&!o.grabbing&&(u="start"),o.grabbing&&!a.grabbing&&(u="end"),a.grabbing||o.grabbing||(u=null),this._lastDraggedHandle=u},b=a.events.on("grab-changed",g),w=o.events.on("grab-changed",g);return this.addHandles([b,w,D(()=>ot(this._params.handleColor),u=>{l.setParameters({color:u}),r.setParameters({color:u})},{equals:lt})],M.Manipulators),{start:a,end:o,cursor:h}}show(){this.destroyed||this._visible||this._updateVisibility(!0)}hide(){!this.destroyed&&this._visible&&this._updateVisibility(!1)}_connectToAnalysisView(){this.removeHandles(M.AnalysisView),this.addHandles([D(()=>{var t;return(t=this.analysisViewData)==null?void 0:t.destroyed},t=>{t&&this.removeHandles(M.AnalysisView)},$),D(()=>[this.toolState.lineState==="measured",this.analysisViewData],([t,e])=>{e==null||e.destroyed||(e.allowVisualElementsOrientationChange=!t)},$),D(()=>this._laserLineParams,t=>{const e=this._laserLine;e.heightManifoldTarget=t.heightManifoldTarget,e.pointDistanceLine=t.pointDistanceLine,e.lineVerticalPlaneSegment=t.lineVerticalPlaneSegment},$)],M.AnalysisView)}_updateVisibility(t){this.initialized&&(this._visible=t,t?this._laserLine.style={innerColor:this._params.laserLineInnerColor,innerWidth:this._params.laserLineInnerWidth,glowColor:this._params.laserLineGlowColor,glowWidth:this._params.laserLineGlowWidth,glowFalloff:this._params.laserLineGlowFalloff,globalAlpha:this._params.laserLineGlobalAlpha}:this.view.cursor=null,this._laserLine.visible=t)}};i([n({constructOnly:!0})],d.prototype,"view",void 0),i([n()],d.prototype,"_params",null),i([n({constructOnly:!0})],d.prototype,"analysis",void 0),i([n({constructOnly:!0})],d.prototype,"analysisViewData",void 0),i([n()],d.prototype,"cursorPoint",void 0),i([n()],d.prototype,"toolState",void 0),i([n()],d.prototype,"visible",null),i([n()],d.prototype,"testData",null),i([n()],d.prototype,"_visible",void 0),i([n()],d.prototype,"_laserLine",void 0),i([n({constructOnly:!0})],d.prototype,"laserLineEnabled",void 0),i([n()],d.prototype,"_cursorPosition",null),i([n()],d.prototype,"_startPosition",null),i([n()],d.prototype,"_endPosition",null),i([n()],d.prototype,"_lastDraggedHandle",void 0),i([n()],d.prototype,"_laserLineParams",null),i([n()],d.prototype,"_focusPosition",null),i([n()],d.prototype,"_pointDistanceLine",null),d=i([L("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DView")],d);let p=class extends Ot{constructor(t){super(t),this._updatingHandles=new dt,this._emulatedDrag=null,this.lineState="initial",this.startPointSurfaceLocation=null,this.endPointSurfaceLocation=null,this.cursorPointSurfaceLocation=null,this.startManipulator=null,this.endManipulator=null,this.cursorManipulator=null,this._getSnappingContext=ht(e=>new At({elevationInfo:{mode:"absolute-height",offset:0},pointer:e,editGeometryOperations:new $t(new xt("point",Ct(!0,!1,this.view.spatialReference))),visualizer:new bt}))}initialize(){const{view:t,analysis:e,analysisViewData:s,visible:a}=this;this.measurementView=new d({toolState:this,view:t,analysis:e,analysisViewData:s,visible:a});const l=Ht(t);this._snappingManagerResult=l,this.addHandles(l);const{start:o,end:r,cursor:h}=this.measurementView.createManipulators(),g=(w,u,P)=>Tt(w,(_,J,S,k)=>{const E=Dt(_),Q=this._snappingManager,X=this._getSnappingContext(k),Y=this._updatingHandles,{lineState:Z}=this;S=S.next(E).next(Ut(this,[P,u])).next(m=>{if(u!=="cursorPoint"){const v=this.analysis[u];v!=null&&(_.location=v)}return m});const tt=ft(this.view),et=m=>{const v=tt(m);return v||this.lineState!=="drawing"&&this.lineState!=="initial"||(this[u]=null,this[P]=null),v};let O=J.next(E).next(et);if(k!=="touch"||Z==="editing"){const{snappingStep:m,cancelSnapping:v}=kt({snappingManager:Q,snappingContext:X,updatingHandles:Y});S=S.next(v),O=O.next(...m)}O.next(m=>m.action!=="start"?m:null).next(m=>{const v=gt(m.mapEnd,new H);this[u]=v,_.location=v,this[P]=this._surfaceLocation(v,m.surfaceType)})}),b=w=>w.events.on("grab-changed",()=>{const u=o.grabbing||r.grabbing;this.lineState=u?"editing":"measured"});this.addHandles([g(o,"startPoint","startPointSurfaceLocation"),g(r,"endPoint","endPointSurfaceLocation"),g(h,"cursorPoint","cursorPointSurfaceLocation"),b(o),b(r)]),this.manipulators.add(o),this.manipulators.add(r),this.manipulators.add(h),this.startManipulator=o,this.endManipulator=r,this.cursorManipulator=h,this.addHandles(D(()=>this.state,w=>{w==="measured"&&this.finishToolCreation()},q)),pt(this)}destroy(){this._updatingHandles=A(this._updatingHandles),this.measurementView=A(this.measurementView)}get _snappingManager(){return this._snappingManagerResult.snappingManager}get state(){const{analysis:t}=this;if(t.startPoint==null&&t.endPoint==null)return"ready";const{lineState:e}=this;return this.validMeasurement&&e!=="editing"&&e!=="drawing"?"measured":"measuring"}get cursor(){return this.state==="ready"||this.lineState==="drawing"?"crosshair":null}get startPoint(){return this.analysis.startPoint}set startPoint(t){this.analysis.startPoint=t}get endPoint(){return this.analysis.endPoint}set endPoint(t){this.analysis.endPoint=t}get cursorPoint(){return this.measurementView.cursorPoint}set cursorPoint(t){this.measurementView.cursorPoint=t}get snappingOptions(){return this._snappingManager.options}get validMeasurement(){return this.analysis.startPoint!=null&&this.analysis.endPoint!=null}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}onShow(){this.measurementView.show(),this._updateManipulatorAvailability()}onHide(){this.measurementView.hide()}onDeactivate(){var t;(t=this._emulatedDrag)==null||t.cancel(),this._emulatedDrag=null}onInputEvent(t){switch(t.type){case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t)}this._updateManipulatorAvailability()}_handlePointerMove(t){var h,g;if(!this.active||this.view.navigating)return;const{pointerType:e}=t;if(e!=="mouse")return;const s=G(t),{lineState:a,cursorManipulator:l,endManipulator:o}=this;let r=!1;this.cursorPoint==null&&((h=this._emulatedDrag)==null||h.cancel(),this._emulatedDrag=C(l,e,s),r=!0),a==="initial"&&((g=this._emulatedDrag)==null||g.update(s),r=!0),a==="drawing"&&(o.events.emit("drag",{action:"update",start:s,screenPoint:s}),r=!0),r&&t.stopPropagation()}_handleImmediateClick(t){var g,b,w,u,P;if(!this.active||!_t(t))return;const e=G(t),{pointerType:s}=t,{cursorManipulator:a,startManipulator:l,endManipulator:o,lineState:r}=this;let h=!1;switch(this.cursorPoint==null&&((g=this._emulatedDrag)==null||g.cancel(),this._emulatedDrag=C(a,s,e)),r){case"initial":if((b=this._emulatedDrag)==null||b.update(e),this.cursorPoint!=null){(w=this._emulatedDrag)==null||w.end(e),this._emulatedDrag=null;const{cursorPoint:_}=this;this.startPoint=_,this.startPointSurfaceLocation=this.cursorPointSurfaceLocation,l.location=_,l.interactive=!1,o.interactive=!1,this.lineState="drawing",this._emulatedDrag=C(o,s,e),h=!0}break;case"drawing":(u=this._emulatedDrag)==null||u.update(e),this.endPoint!=null&&((P=this._emulatedDrag)==null||P.end(e),this._emulatedDrag=null,l.interactive=!0,o.interactive=!0,this.lineState="measured",h=!0)}h&&t.stopPropagation()}_surfaceLocation(t,e){return e===Pt.GROUND?"on-the-surface":(t.z??0)>=this._getElevation(t)?"above-the-surface":"below-the-surface"}_updateManipulatorAvailability(){this.startManipulator.available=this.analysis.startPoint!=null,this.endManipulator.available=this.analysis.endPoint!=null}_getElevation(t){return this.view.basemapTerrain.ready?ct(this.view.elevationProvider,t)??0:0}get test(){return{snappingManager:this._snappingManager}}};function C(t,e,s){return t.events.emit("drag",{action:"start",pointerType:e,start:s,screenPoint:s}),{update:a=>t.events.emit("drag",{action:"update",start:a,screenPoint:a}),end:a=>t.events.emit("drag",{action:"end",start:a,screenPoint:a}),cancel:()=>t.events.emit("drag",{action:"cancel"})}}i([n({readOnly:!0})],p.prototype,"state",null),i([n()],p.prototype,"lineState",void 0),i([n({readOnly:!0})],p.prototype,"cursor",null),i([n()],p.prototype,"startPoint",null),i([n()],p.prototype,"endPoint",null),i([n()],p.prototype,"cursorPoint",null),i([n({constructOnly:!0})],p.prototype,"analysis",void 0),i([n({constructOnly:!0})],p.prototype,"analysisViewData",void 0),i([n()],p.prototype,"measurementView",void 0),i([n({constructOnly:!0})],p.prototype,"view",void 0),i([n({readOnly:!0})],p.prototype,"validMeasurement",null),i([n({value:null})],p.prototype,"startPointSurfaceLocation",void 0),i([n({value:null})],p.prototype,"endPointSurfaceLocation",void 0),i([n({value:null})],p.prototype,"cursorPointSurfaceLocation",void 0),i([n()],p.prototype,"updating",null),p=i([L("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DTool")],p);const Gt=p;let y=class extends Et{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="DirectLineMeasurement3DViewModel is only supported in 3D views.",this._userUnit=null,this._userUnitOptions=null}initialize(){this.addHandles(D(()=>({analysis:this.analysis,unit:this.unit}),({analysis:e,unit:s})=>{e!=null&&(e.unit=s)},q))}get state(){return this.disabled||!this.ready?"disabled":this.tool==null?"ready":this.tool.state}get measurement(){if(this.tool==null)return null;const e={mode:"euclidean",directDistance:{text:null,state:"unavailable"},horizontalDistance:{text:null,state:"unavailable"},verticalDistance:{text:null,state:"unavailable"}},{analysisViewData:s}=this.tool;if(s==null)return e;const a=s.actualVisualizedMeasurement,l=s.result!=null?"available":"unavailable";switch(a){case"euclidean":return{mode:"euclidean",directDistance:{text:s.directLabelText,state:l},horizontalDistance:{text:s.horizontalLabelText,state:l},verticalDistance:{text:s.verticalLabelText,state:l}};case"geodesic":return{mode:"geodesic",directDistance:{text:null,state:"unavailable"},horizontalDistance:{text:s.horizontalLabelText,state:l},verticalDistance:{text:s.verticalLabelText,state:l}};default:return e}}set unitOptions(e){this._userUnitOptions=e,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(e){this._userUnit=e?this._findSelectableUnit(e,this._userUnit):null}get unit(){return this._userUnit?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}constructAnalysis(){return new j}constructTool(){return new Gt({view:this.view,analysis:this.analysis,analysisViewData:this.analysisView,visible:this.visible})}_findSelectableUnit(e,s){const a=this.unitOptions;return a.includes(e)?e:s?this._findSelectableUnit(s):a[0]}_filteredOrAllUnits(e){if(!e)return V.slice();const s=e.filter(a=>V.includes(a));return s.length===0?V.slice():s}};i([n({type:j})],y.prototype,"analysis",void 0),i([n({readOnly:!0})],y.prototype,"state",null),i([n({readOnly:!0})],y.prototype,"measurement",null),i([n()],y.prototype,"unitOptions",null),i([n()],y.prototype,"unit",null),i([n(mt)],y.prototype,"defaultUnit",void 0),i([n()],y.prototype,"_userUnit",void 0),i([n()],y.prototype,"_userUnitOptions",void 0),y=i([L("esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel")],y);const K=y,N="esri-direct-line-measurement-3d",T={base:N,newMeasurementButton:`${N}__clear-button`,widgetIcon:wt.measureLine};let c=class extends vt{constructor(t,e){super(t,e),this.iconClass=T.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.viewModel=new K}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(t){this.viewModel.analysis=t}get label(){var t;return((t=this.messages)==null?void 0:t.widgetLabel)??""}set label(t){this._overrideIfSome("label",t)}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(t){this.viewModel.unitOptions=t}get unit(){return this.viewModel.unit}set unit(t){this.viewModel.unit=t}render(){const{messages:t,messagesCommon:e,unit:s,unitOptions:a,viewModel:l}=this,{active:o,measurement:r,state:h,supported:g}=l;return R("div",{"aria-label":this.messages.widgetLabel,class:this.classes(T.base,F.widget,F.panel),key:this,role:"presentation"},this.visible?R(zt,{active:o,measurementItems:[{key:"direct",title:t.direct,value:U(r==null?void 0:r.directDistance)},{key:"horizontal",title:t.horizontal,value:U(r==null?void 0:r.horizontalDistance)},{key:"vertical",title:t.vertical,value:U(r==null?void 0:r.verticalDistance)}],messages:{...t,notApplicable:e==null?void 0:e.notApplicable},newMeasurementButtonClass:T.newMeasurementButton,state:h,supported:g,unit:s,unitOptions:a,onNewMeasurementClick:()=>{yt(this.viewModel.start())},onUnitChange:b=>{this.unit=b}}):null)}};function U(t){return(t==null?void 0:t.state)==="available"?t.text:null}i([n()],c.prototype,"view",null),i([n()],c.prototype,"visible",null),i([n()],c.prototype,"active",null),i([n({constructOnly:!0,nonNullable:!0})],c.prototype,"analysis",null),i([n()],c.prototype,"iconClass",void 0),i([n()],c.prototype,"icon",void 0),i([n()],c.prototype,"label",null),i([n(),I("esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D")],c.prototype,"messages",void 0),i([n(),I("esri/t9n/common")],c.prototype,"messagesCommon",void 0),i([n()],c.prototype,"uiStrings",void 0),i([n({type:K})],c.prototype,"viewModel",void 0),i([n()],c.prototype,"unitOptions",null),i([n()],c.prototype,"unit",null),c=i([L("esri.widgets.DirectLineMeasurement3D")],c);const ce=c;export{ce as default}; diff --git a/dist/assets/DirectLineMeasurement3D-D1LkQv4r.js b/dist/assets/DirectLineMeasurement3D-D1LkQv4r.js new file mode 100644 index 0000000..608c729 --- /dev/null +++ b/dist/assets/DirectLineMeasurement3D-D1LkQv4r.js @@ -0,0 +1 @@ +import{e as i,y as n,L as U,k_ as V,c as L,la as it,g as nt,B as D,b as A,W as k,kL as st,nF as at,bc as rt,nG as lt,nH as ot,P as $,a8 as x,hZ as ut,h as dt,gA as ht,T as N,nB as pt,kH as z,i2 as ct,bp as gt,kV as mt,kX as I,hD as vt,hF as R,br as yt,kY as F,kZ as wt}from"./index-pCX-0tJH.js";import{W as _t}from"./measurementUtils-U47xEmCr.js";import{O as bt}from"./SnappingVisualizer3D-PUGfSdbO.js";import{G as Pt,F as ft,A as Dt}from"./dragEventPipeline3D-H_IlIVP7.js";import{e as Mt}from"./interfaces-tkyofe_Z.js";import{e as W}from"./interfaces-lHX1zDRv.js";import{$ as B,w as Lt,e as St}from"./ShadedColorMaterial.glsl-L0JVQzbX.js";import{c as Vt}from"./Laserlines.glsl-U7nZFq0e.js";import{a as Ot}from"./AnalysisToolBase-olyQy6lh.js";import{V as $t,p as xt,w as Ct}from"./EditGeometryOperations-vpHcsZOg.js";import{d as Ht,R as Tt}from"./InteractiveToolBase-6mltmL27.js";import{a as Ut}from"./SceneSnappingManagerPool-V-V1M2q0.js";import{e as At}from"./SnappingContext-ax0tf6c6.js";import{f as Et}from"./SnappingDragPipelineStep-HDAWWRgo.js";import{u as Gt}from"./InteractiveAnalysisViewModel-jrNLjGZR.js";import{u as kt}from"./MeasurementWidgetContent-PH9XFoV4.js";import"./ExtendedLineVisualElement-VJvEdv3K.js";import"./vec4f32-NvfHy9q7.js";import"./EngineVisualElement-u0-BOxGn.js";import"./VisualElement--2Scr6Yq.js";import"./PointVisualElement-m9C0-AJh.js";import"./Object3DVisualElement-8HoU366x.js";import"./RightAngleQuadVisualElement-Jj11oqLR.js";import"./drawUtils-0wb2c6-q.js";import"./PointSnappingHint-bwlQAyn6.js";import"./dehydratedFeatureComparison-IJSogXWn.js";let f=class extends it{constructor(t){super(t),this.type="direct-line-measurement",this.startPoint=null,this.endPoint=null,this.unit=null}get requiredPropertiesForEditing(){return[this.startPoint,this.endPoint]}clear(){this.startPoint=null,this.endPoint=null}};i([n({type:["direct-line-measurement"]})],f.prototype,"type",void 0),i([n({type:U})],f.prototype,"startPoint",void 0),i([n({type:U})],f.prototype,"endPoint",void 0),i([n({type:V,value:null})],f.prototype,"unit",void 0),i([n({readOnly:!0})],f.prototype,"requiredPropertiesForEditing",null),f=i([L("esri.analysis.DirectLineMeasurementAnalysis")],f);const Z=f;var M;(function(t){t.Manipulators="manipulators",t.AnalysisViewDestroyed="analysis-view-destroyed",t.AnalysisView="analysis-view"})(M||(M={}));let d=class extends nt{constructor(t){super(t),this.cursorPoint=null,this._visible=!1,this._laserLine=null,this.laserLineEnabled=!0,this._lastDraggedHandle=null}initialize(){this._laserLine=new Vt({view:this.view,attached:!0,isDecoration:!0}),this._updateVisibility(this._visible),this._connectToAnalysisView(),this.addHandles(D(()=>this._params,({laserLineGlowColor:t,laserLineInnerColor:e,laserLineGlobalAlpha:s})=>{const a=this._laserLine,l=a.style;a.style={...l,innerColor:e,glowColor:t,globalAlpha:s}}))}destroy(){this._laserLine=A(this._laserLine)}get _params(){const{accentColor:t}=this.view.effectiveTheme;return{laserLineGlowColor:k.toUnitRGB(t),laserLineGlowWidth:8,laserLineGlowFalloff:8,laserLineInnerColor:k.toUnitRGB(st(t)),laserLineInnerWidth:.75,laserLineGlobalAlpha:.75*t.a,handleColor:at(t,.5),handleRadius:5}}get visible(){return this._visible}set visible(t){t?this.show():this.hide()}get testData(){const t=this._laserLine.testData,e=this.analysisViewData.testData;return{labels:e==null?void 0:e.labels,stripeLength:e==null?void 0:e.stripeLength,laserLineRenderer:{heightManifoldEnabled:t!=null&&t.heightManifoldEnabled,heightManifoldTarget:t!=null?t.heightManifoldTarget:null,pointDistanceEnabled:t!=null&&t.pointDistanceEnabled,pointDistanceOrigin:t!=null?t.pointDistanceOrigin:null,pointDistanceTarget:t!=null?t.pointDistanceTarget:null,lineVerticalPlaneEnabled:t!=null&&t.lineVerticalPlaneEnabled}}}get _cursorPosition(){const t=x(),e=this.cursorPoint;return e&&this.view.renderCoordsHelper.toRenderCoords(e,t),t}get _startPosition(){const t=x(),e=this.analysis.startPoint;return e&&this.view.renderCoordsHelper.toRenderCoords(e,t),t}get _endPosition(){const t=x(),e=this.analysis.endPoint;return e&&this.view.renderCoordsHelper.toRenderCoords(e,t),t}get _laserLineParams(){const t=this._focusPosition,{active:e,lineState:s}=this.toolState,a=this.analysisViewData,l=this.laserLineEnabled&&!!t&&s!=="measured"&&e;if(!l||!this.visible||a==null||a.destroyed)return{heightManifoldTarget:null,pointDistanceLine:null,lineVerticalPlaneSegment:null};const o=a.actualVisualizedMeasurement,r=this.view.viewingMode!=="local"&&l&&!!this.analysis.startPoint&&o==="geodesic",h=l&&a.viewMode===W.Triangle;return{heightManifoldTarget:o==="euclidean"?t:null,pointDistanceLine:r?this._pointDistanceLine:null,lineVerticalPlaneSegment:h?rt(this._startPosition,this._endPosition):null}}get _focusPosition(){const{lineState:t}=this.toolState,e=this.analysisViewData,s=e!=null&&!e.destroyed&&e.measurementMode===Mt.Euclidean&&e.viewMode===W.Direct;switch(t){case"drawing":return s?this._startPosition:this.analysis.endPoint?this._endPosition:this._startPosition;case"editing":return s?this._lastDraggedHandle==="start"?this._endPosition:this._startPosition:this._lastDraggedHandle==="start"?this._startPosition:this._endPosition;default:return this.cursorPoint!=null?this._cursorPosition:null}}get _pointDistanceLine(){return{origin:this.toolState.lineState==="drawing"||this._lastDraggedHandle==="end"?this._startPosition:this._endPosition,target:this._focusPosition}}createManipulators(){const t=this._params,{view:e}=this,s=()=>{const u=Lt(t.handleColor),P=[new St(ut(u,1,32,32))],_=new B({view:e,renderObjects:P});return _.available=!1,_.radius=t.handleRadius,[_,u]},[a,l]=s(),[o,r]=s(),h=new B({view:this.view});h.available=!1,h.interactive=!1,this.analysis.startPoint!=null&&(a.location=this.analysis.startPoint,a.available=!0),this.analysis.endPoint!=null&&(o.location=this.analysis.endPoint,o.available=!0);const g=()=>{let u=this._lastDraggedHandle;a.grabbing&&!o.grabbing&&(u="start"),o.grabbing&&!a.grabbing&&(u="end"),a.grabbing||o.grabbing||(u=null),this._lastDraggedHandle=u},b=a.events.on("grab-changed",g),w=o.events.on("grab-changed",g);return this.addHandles([b,w,D(()=>ot(this._params.handleColor),u=>{l.setParameters({color:u}),r.setParameters({color:u})},{equals:lt})],M.Manipulators),{start:a,end:o,cursor:h}}show(){this.destroyed||this._visible||this._updateVisibility(!0)}hide(){!this.destroyed&&this._visible&&this._updateVisibility(!1)}_connectToAnalysisView(){this.removeHandles(M.AnalysisView),this.addHandles([D(()=>{var t;return(t=this.analysisViewData)==null?void 0:t.destroyed},t=>{t&&this.removeHandles(M.AnalysisView)},$),D(()=>[this.toolState.lineState==="measured",this.analysisViewData],([t,e])=>{e==null||e.destroyed||(e.allowVisualElementsOrientationChange=!t)},$),D(()=>this._laserLineParams,t=>{const e=this._laserLine;e.heightManifoldTarget=t.heightManifoldTarget,e.pointDistanceLine=t.pointDistanceLine,e.lineVerticalPlaneSegment=t.lineVerticalPlaneSegment},$)],M.AnalysisView)}_updateVisibility(t){this.initialized&&(this._visible=t,t?this._laserLine.style={innerColor:this._params.laserLineInnerColor,innerWidth:this._params.laserLineInnerWidth,glowColor:this._params.laserLineGlowColor,glowWidth:this._params.laserLineGlowWidth,glowFalloff:this._params.laserLineGlowFalloff,globalAlpha:this._params.laserLineGlobalAlpha}:this.view.cursor=null,this._laserLine.visible=t)}};i([n({constructOnly:!0})],d.prototype,"view",void 0),i([n()],d.prototype,"_params",null),i([n({constructOnly:!0})],d.prototype,"analysis",void 0),i([n({constructOnly:!0})],d.prototype,"analysisViewData",void 0),i([n()],d.prototype,"cursorPoint",void 0),i([n()],d.prototype,"toolState",void 0),i([n()],d.prototype,"visible",null),i([n()],d.prototype,"testData",null),i([n()],d.prototype,"_visible",void 0),i([n()],d.prototype,"_laserLine",void 0),i([n({constructOnly:!0})],d.prototype,"laserLineEnabled",void 0),i([n()],d.prototype,"_cursorPosition",null),i([n()],d.prototype,"_startPosition",null),i([n()],d.prototype,"_endPosition",null),i([n()],d.prototype,"_lastDraggedHandle",void 0),i([n()],d.prototype,"_laserLineParams",null),i([n()],d.prototype,"_focusPosition",null),i([n()],d.prototype,"_pointDistanceLine",null),d=i([L("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DView")],d);let p=class extends Ot{constructor(t){super(t),this._updatingHandles=new dt,this._emulatedDrag=null,this.lineState="initial",this.startPointSurfaceLocation=null,this.endPointSurfaceLocation=null,this.cursorPointSurfaceLocation=null,this.startManipulator=null,this.endManipulator=null,this.cursorManipulator=null,this._getSnappingContext=ht(e=>new At({elevationInfo:{mode:"absolute-height",offset:0},pointer:e,editGeometryOperations:new $t(new xt("point",Ct(!0,!1,this.view.spatialReference))),visualizer:new bt}))}initialize(){const{view:t,analysis:e,analysisViewData:s,visible:a}=this;this.measurementView=new d({toolState:this,view:t,analysis:e,analysisViewData:s,visible:a});const l=Ut(t);this._snappingManagerResult=l,this.addHandles(l);const{start:o,end:r,cursor:h}=this.measurementView.createManipulators(),g=(w,u,P)=>Ht(w,(_,X,S,E)=>{const G=Dt(_),Y=this._snappingManager,J=this._getSnappingContext(E),K=this._updatingHandles,{lineState:Q}=this;S=S.next(G).next(Tt(this,[P,u])).next(m=>{if(u!=="cursorPoint"){const v=this.analysis[u];v!=null&&(_.location=v)}return m});const tt=ft(this.view),et=m=>{const v=tt(m);return v||this.lineState!=="drawing"&&this.lineState!=="initial"||(this[u]=null,this[P]=null),v};let O=X.next(G).next(et);if(E!=="touch"||Q==="editing"){const{snappingStep:m,cancelSnapping:v}=Et({snappingManager:Y,snappingContext:J,updatingHandles:K});S=S.next(v),O=O.next(...m)}O.next(m=>m.action!=="start"?m:null).next(m=>{const v=gt(m.mapEnd,new U);this[u]=v,_.location=v,this[P]=this._surfaceLocation(v,m.surfaceType)})}),b=w=>w.events.on("grab-changed",()=>{const u=o.grabbing||r.grabbing;this.lineState=u?"editing":"measured"});this.addHandles([g(o,"startPoint","startPointSurfaceLocation"),g(r,"endPoint","endPointSurfaceLocation"),g(h,"cursorPoint","cursorPointSurfaceLocation"),b(o),b(r)]),this.manipulators.add(o),this.manipulators.add(r),this.manipulators.add(h),this.startManipulator=o,this.endManipulator=r,this.cursorManipulator=h,this.addHandles(D(()=>this.state,w=>{w==="measured"&&this.finishToolCreation()},N)),pt(this)}destroy(){this._updatingHandles=A(this._updatingHandles),this.measurementView=A(this.measurementView)}get _snappingManager(){return this._snappingManagerResult.snappingManager}get state(){const{analysis:t}=this;if(t.startPoint==null&&t.endPoint==null)return"ready";const{lineState:e}=this;return this.validMeasurement&&e!=="editing"&&e!=="drawing"?"measured":"measuring"}get cursor(){return this.state==="ready"||this.lineState==="drawing"?"crosshair":null}get startPoint(){return this.analysis.startPoint}set startPoint(t){this.analysis.startPoint=t}get endPoint(){return this.analysis.endPoint}set endPoint(t){this.analysis.endPoint=t}get cursorPoint(){return this.measurementView.cursorPoint}set cursorPoint(t){this.measurementView.cursorPoint=t}get snappingOptions(){return this._snappingManager.options}get validMeasurement(){return this.analysis.startPoint!=null&&this.analysis.endPoint!=null}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}onShow(){this.measurementView.show(),this._updateManipulatorAvailability()}onHide(){this.measurementView.hide()}onDeactivate(){var t;(t=this._emulatedDrag)==null||t.cancel(),this._emulatedDrag=null}onInputEvent(t){switch(t.type){case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t)}this._updateManipulatorAvailability()}_handlePointerMove(t){var h,g;if(!this.active||this.view.navigating)return;const{pointerType:e}=t;if(e!=="mouse")return;const s=z(t),{lineState:a,cursorManipulator:l,endManipulator:o}=this;let r=!1;this.cursorPoint==null&&((h=this._emulatedDrag)==null||h.cancel(),this._emulatedDrag=C(l,e,s),r=!0),a==="initial"&&((g=this._emulatedDrag)==null||g.update(s),r=!0),a==="drawing"&&(o.events.emit("drag",{action:"update",start:s,screenPoint:s}),r=!0),r&&t.stopPropagation()}_handleImmediateClick(t){var g,b,w,u,P;if(!this.active||!_t(t))return;const e=z(t),{pointerType:s}=t,{cursorManipulator:a,startManipulator:l,endManipulator:o,lineState:r}=this;let h=!1;switch(this.cursorPoint==null&&((g=this._emulatedDrag)==null||g.cancel(),this._emulatedDrag=C(a,s,e)),r){case"initial":if((b=this._emulatedDrag)==null||b.update(e),this.cursorPoint!=null){(w=this._emulatedDrag)==null||w.end(e),this._emulatedDrag=null;const{cursorPoint:_}=this;this.startPoint=_,this.startPointSurfaceLocation=this.cursorPointSurfaceLocation,l.location=_,l.interactive=!1,o.interactive=!1,this.lineState="drawing",this._emulatedDrag=C(o,s,e),h=!0}break;case"drawing":(u=this._emulatedDrag)==null||u.update(e),this.endPoint!=null&&((P=this._emulatedDrag)==null||P.end(e),this._emulatedDrag=null,l.interactive=!0,o.interactive=!0,this.lineState="measured",h=!0)}h&&t.stopPropagation()}_surfaceLocation(t,e){return e===Pt.GROUND?"on-the-surface":(t.z??0)>=this._getElevation(t)?"above-the-surface":"below-the-surface"}_updateManipulatorAvailability(){this.startManipulator.available=this.analysis.startPoint!=null,this.endManipulator.available=this.analysis.endPoint!=null}_getElevation(t){return this.view.basemapTerrain.ready?ct(this.view.elevationProvider,t)??0:0}get test(){return{snappingManager:this._snappingManager}}};function C(t,e,s){return t.events.emit("drag",{action:"start",pointerType:e,start:s,screenPoint:s}),{update:a=>t.events.emit("drag",{action:"update",start:a,screenPoint:a}),end:a=>t.events.emit("drag",{action:"end",start:a,screenPoint:a}),cancel:()=>t.events.emit("drag",{action:"cancel"})}}i([n({readOnly:!0})],p.prototype,"state",null),i([n()],p.prototype,"lineState",void 0),i([n({readOnly:!0})],p.prototype,"cursor",null),i([n()],p.prototype,"startPoint",null),i([n()],p.prototype,"endPoint",null),i([n()],p.prototype,"cursorPoint",null),i([n({constructOnly:!0})],p.prototype,"analysis",void 0),i([n({constructOnly:!0})],p.prototype,"analysisViewData",void 0),i([n()],p.prototype,"measurementView",void 0),i([n({constructOnly:!0})],p.prototype,"view",void 0),i([n({readOnly:!0})],p.prototype,"validMeasurement",null),i([n({value:null})],p.prototype,"startPointSurfaceLocation",void 0),i([n({value:null})],p.prototype,"endPointSurfaceLocation",void 0),i([n({value:null})],p.prototype,"cursorPointSurfaceLocation",void 0),i([n()],p.prototype,"updating",null),p=i([L("esri.views.3d.interactive.measurementTools.directLineMeasurement3D.DirectLineMeasurement3DTool")],p);const zt=p;let y=class extends Gt{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="DirectLineMeasurement3DViewModel is only supported in 3D views.",this._userUnit=null,this._userUnitOptions=null}initialize(){this.addHandles(D(()=>({analysis:this.analysis,unit:this.unit}),({analysis:e,unit:s})=>{e!=null&&(e.unit=s)},N))}get state(){return this.disabled||!this.ready?"disabled":this.tool==null?"ready":this.tool.state}get measurement(){if(this.tool==null)return null;const e={mode:"euclidean",directDistance:{text:null,state:"unavailable"},horizontalDistance:{text:null,state:"unavailable"},verticalDistance:{text:null,state:"unavailable"}},{analysisViewData:s}=this.tool;if(s==null)return e;const a=s.actualVisualizedMeasurement,l=s.result!=null?"available":"unavailable";switch(a){case"euclidean":return{mode:"euclidean",directDistance:{text:s.directLabelText,state:l},horizontalDistance:{text:s.horizontalLabelText,state:l},verticalDistance:{text:s.verticalLabelText,state:l}};case"geodesic":return{mode:"geodesic",directDistance:{text:null,state:"unavailable"},horizontalDistance:{text:s.horizontalLabelText,state:l},verticalDistance:{text:s.verticalLabelText,state:l}};default:return e}}set unitOptions(e){this._userUnitOptions=e,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(e){this._userUnit=e?this._findSelectableUnit(e,this._userUnit):null}get unit(){return this._userUnit?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}constructAnalysis(){return new Z}constructTool(){return new zt({view:this.view,analysis:this.analysis,analysisViewData:this.analysisView,visible:this.visible})}_findSelectableUnit(e,s){const a=this.unitOptions;return a.includes(e)?e:s?this._findSelectableUnit(s):a[0]}_filteredOrAllUnits(e){if(!e)return V.slice();const s=e.filter(a=>V.includes(a));return s.length===0?V.slice():s}};i([n({type:Z})],y.prototype,"analysis",void 0),i([n({readOnly:!0})],y.prototype,"state",null),i([n({readOnly:!0})],y.prototype,"measurement",null),i([n()],y.prototype,"unitOptions",null),i([n()],y.prototype,"unit",null),i([n(mt)],y.prototype,"defaultUnit",void 0),i([n()],y.prototype,"_userUnit",void 0),i([n()],y.prototype,"_userUnitOptions",void 0),y=i([L("esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel")],y);const j=y,q="esri-direct-line-measurement-3d",H={base:q,newMeasurementButton:`${q}__clear-button`,widgetIcon:wt.measureLine};let c=class extends vt{constructor(t,e){super(t,e),this.iconClass=H.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.viewModel=new j}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(t){this.viewModel.analysis=t}get label(){var t;return((t=this.messages)==null?void 0:t.widgetLabel)??""}set label(t){this._overrideIfSome("label",t)}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(t){this.viewModel.unitOptions=t}get unit(){return this.viewModel.unit}set unit(t){this.viewModel.unit=t}render(){const{messages:t,messagesCommon:e,unit:s,unitOptions:a,viewModel:l}=this,{active:o,measurement:r,state:h,supported:g}=l;return R("div",{"aria-label":this.messages.widgetLabel,class:this.classes(H.base,F.widget,F.panel),key:this,role:"presentation"},this.visible?R(kt,{active:o,measurementItems:[{key:"direct",title:t.direct,value:T(r==null?void 0:r.directDistance)},{key:"horizontal",title:t.horizontal,value:T(r==null?void 0:r.horizontalDistance)},{key:"vertical",title:t.vertical,value:T(r==null?void 0:r.verticalDistance)}],messages:{...t,notApplicable:e==null?void 0:e.notApplicable},newMeasurementButtonClass:H.newMeasurementButton,state:h,supported:g,unit:s,unitOptions:a,onNewMeasurementClick:()=>{yt(this.viewModel.start())},onUnitChange:b=>{this.unit=b}}):null)}};function T(t){return(t==null?void 0:t.state)==="available"?t.text:null}i([n()],c.prototype,"view",null),i([n()],c.prototype,"visible",null),i([n()],c.prototype,"active",null),i([n({constructOnly:!0,nonNullable:!0})],c.prototype,"analysis",null),i([n()],c.prototype,"iconClass",void 0),i([n()],c.prototype,"icon",void 0),i([n()],c.prototype,"label",null),i([n(),I("esri/widgets/DirectLineMeasurement3D/t9n/DirectLineMeasurement3D")],c.prototype,"messages",void 0),i([n(),I("esri/t9n/common")],c.prototype,"messagesCommon",void 0),i([n()],c.prototype,"uiStrings",void 0),i([n({type:j})],c.prototype,"viewModel",void 0),i([n()],c.prototype,"unitOptions",null),i([n()],c.prototype,"unit",null),c=i([L("esri.widgets.DirectLineMeasurement3D")],c);const ce=c;export{ce as default}; diff --git a/dist/assets/DirectLineMeasurementAnalysisView3D-AgdgP6Nj.js b/dist/assets/DirectLineMeasurementAnalysisView3D-iWb0_QxT.js similarity index 76% rename from dist/assets/DirectLineMeasurementAnalysisView3D-AgdgP6Nj.js rename to dist/assets/DirectLineMeasurementAnalysisView3D-iWb0_QxT.js index 27f8157..2a201db 100644 --- a/dist/assets/DirectLineMeasurementAnalysisView3D-AgdgP6Nj.js +++ b/dist/assets/DirectLineMeasurementAnalysisView3D-iWb0_QxT.js @@ -1,11 +1,11 @@ -import{Z as Me,e as o,y as d,c as ce,p as de,aa as b,cs as De,ct as ge,d as C,A as O,ay as Q,az as le,z8 as k,N as Te,kB as Re,kG as Ge,kI as je,aA as pe,aB as ke,cu as Ne,cv as He,aH as Ie,xz as Ue,xE as We,xx as q,bf as L,xy as X,xF as K,xM as Fe,de as Be,xL as Y,xK as he,xO as Qe,xP as qe,y6 as Xe,xQ as Ke,xR as Ye,xS as Ze,lZ as Je,xU as et,xW as tt,uS as it,xN as st,y0 as nt,xY as at,xA as _e,lX as me,x_ as rt,x$ as ot,bi as Z,as as J,aF as ee,aU as Oe,aG as lt,h9 as te,bA as ct,b2 as j,ou as ve,nl as ye,b5 as be,kn as dt,n as f,br as N,b8 as ht,kY as we,nk as ut,kz as fe,kA as gt,hS as Le,kZ as ie,kx as pt,P as _t,au as mt,at as vt,cz as se,z6 as yt,z3 as bt,hx as wt,kw as ft,pL as Pe,pl as Lt,j_ as Ve,lL as ue,kK as Pt}from"./index-J0iiHjMT.js";import{s as Ct}from"./AnalysisView3D-jkk3JIRT.js";import{e as T}from"./interfaces-tkyofe_Z.js";import{r as At,t as Et,u as H}from"./LineVisualElement-4BP10o6v.js";import{a as zt,i as ne}from"./UnitNormalizer-19C91v_m.js";import{h as I,R as ae,y as St,L as re,d as Ot}from"./quantityFormatUtils-NiAiojad.js";import{e as y,o as S}from"./interfaces-lHX1zDRv.js";import{g as oe,_ as Ce,m as G,C as Ae}from"./Segment-hN2uWAPW.js";import{a as Vt}from"./Object3DVisualElement-TMb7y_wl.js";import{z as $t}from"./RightAngleQuadVisualElement-y_W8r903.js";import"./VisualElement-kjYXz27t.js";import"./TextOverlayItem-eCjvS6IO.js";import"./EngineVisualElement-eZNKTKsI.js";const $e="esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementController",xt=Me.getLogger($e),Mt=1e5;let x=class extends de{constructor(e){super(e),this._unitNormalizer=new zt,this._tempStartPosition=b(),this._tempEndPosition=b(),this._tempCornerPosition=b()}initialize(){const e=this.view.spatialReference,i=De(e),s=i===Ne?He:i;this._sphericalPCPF=s;const n=ge(e,s);this._unitNormalizer.spatialReference=n?s:e,this.addHandles([C(()=>({viewData:this.viewData,startPoint:this.analysis.startPoint}),({viewData:a,startPoint:r})=>{a.elevationAlignedStartPoint=this._applyProjectionAndElevationAlignment(r)},O),C(()=>({viewData:this.viewData,endPoint:this.analysis.endPoint}),({viewData:a,endPoint:r})=>{a.elevationAlignedEndPoint=this._applyProjectionAndElevationAlignment(r)},O),C(()=>({result:this._computedResult,viewData:this.viewData}),({result:a,viewData:r})=>{r.result=a},O)])}_applyProjectionAndElevationAlignment(e){if(e==null)return e;const{spatialReference:i,elevationProvider:s}=this.view;return At(e,i,s)??(Et(this.analysis,e.spatialReference,xt),null)}get _computedResult(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:i,measurementMode:s}=this.viewData;if(e==null||i==null)return null;const n=this._euclideanDistances(e,i),a=this._geodesicDistance(e,i,n.horizontal.value),r=s===T.Geodesic||s===T.Auto&&n.horizontal.value>Mt?"geodesic":"euclidean";return{mode:r,distance:r==="euclidean"?n.direct:a,directDistance:n.direct,horizontalDistance:n.horizontal,verticalDistance:n.vertical,geodesicDistance:a}}_euclideanDistances(e,i){const s=e.clone();s.z=i.z;const n=this._tempStartPosition,a=this._tempEndPosition,r=this._tempCornerPosition,u=this.view.spatialReference,c=this._sphericalPCPF,h=ge(u,c)?c:u;Q(e,n,h),Q(i,a,h),Q(s,r,h);const l=le(n,a),g=le(r,a),m=Math.abs(i.z-e.z),p=P=>this._unitNormalizer.normalizeDistance(P),A=p(l),M=p(g),E=p(m);return{direct:k(A,"meters"),horizontal:k(M,"meters"),vertical:k(E,"meters")}}_geodesicDistance(e,i,s){const n=e.spatialReference,a=new Te({spatialReference:n});a.addPath([e,i]);const r=n.isGeographic&&Re(n)?Ge([a],"meters")[0]:n.isWebMercator?je(a,"meters"):null,u=r??this._fallbackGeodesicDistance(e,i,s);return k(u,"meters")}_fallbackGeodesicDistance(e,i,s){if(pe(e,Ee)&&pe(i,ze)){const n=new Ie;return ke(n,Ee,ze),n.distance}return s}};o([d()],x.prototype,"view",void 0),o([d()],x.prototype,"analysis",void 0),o([d()],x.prototype,"viewData",void 0),o([d()],x.prototype,"_computedResult",null),x=o([ce($e)],x);const Ee=b(),ze=b();function xe(t){const e=new Ue,{vertex:i,fragment:s}=e;We(i,t),i.uniforms.add(new q("width",a=>a.width)),e.attributes.add(L.POSITION,"vec3"),e.attributes.add(L.NORMAL,"vec3"),e.attributes.add(L.UV0,"vec2"),e.attributes.add(L.AUXPOS1,"float"),e.varyings.add("vtc","vec2"),e.varyings.add("vlength","float"),e.varyings.add("vradius","float"),i.code.add(X`void main(void) { +import{R as De,e as o,y as d,c as ce,g as de,a8 as b,ci as Te,cj as ge,B as C,T as z,d5 as B,by as le,zr as k,E as xe,kN as Re,kS as Ge,kT as je,d6 as pe,d7 as ke,ck as Ne,cl as He,da as Ie,xS as We,xX as Fe,xQ as q,bi as L,xR as X,xY as Y,y3 as Qe,de as Ue,y2 as J,y1 as he,y5 as Be,y6 as qe,yp as Xe,y7 as Ye,y8 as Je,y9 as Ke,m5 as Ze,yb as et,yd as tt,v4 as it,y4 as st,yj as nt,yf as at,xT as _e,m3 as me,yh as rt,yi as ot,bA as K,bz as Z,bL as ee,b4 as ze,c6 as lt,hb as te,bT as ct,b2 as j,oH as ve,nG as ye,b8 as be,kv as dt,b as f,bI as N,bb as ht,l0 as we,nF as ut,kL as fe,kM as gt,hR as Le,l1 as ie,kJ as pt,P as _t,ca as mt,bO as vt,cp as se,zp as yt,zm as bt,hr as wt,kI as ft,pY as Pe,py as Lt,k5 as Ve,lT as ue,kV as Pt}from"./index-pCX-0tJH.js";import{s as Ct}from"./AnalysisView3D-XCzG0Hzh.js";import{e as x}from"./interfaces-tkyofe_Z.js";import{r as Et,t as At,u as H}from"./LineVisualElement-iKo1s90I.js";import{a as Ot,i as ne}from"./UnitNormalizer-RQizSo9a.js";import{h as I,R as ae,y as St,L as re,d as zt}from"./quantityFormatUtils-oYgdvR_2.js";import{e as y,o as S}from"./interfaces-lHX1zDRv.js";import{g as oe,_ as Ce,m as G,C as Ee}from"./Segment-TQS1M_Ix.js";import{a as Vt}from"./Object3DVisualElement-8HoU366x.js";import{z as $t}from"./RightAngleQuadVisualElement-Jj11oqLR.js";import"./VisualElement--2Scr6Yq.js";import"./TextOverlayItem-YHZxWGyg.js";import"./EngineVisualElement-u0-BOxGn.js";const $e="esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementController",Mt=De.getLogger($e),Dt=1e5;let M=class extends de{constructor(e){super(e),this._unitNormalizer=new Ot,this._tempStartPosition=b(),this._tempEndPosition=b(),this._tempCornerPosition=b()}initialize(){const e=this.view.spatialReference,i=Te(e),s=i===Ne?He:i;this._sphericalPCPF=s;const n=ge(e,s);this._unitNormalizer.spatialReference=n?s:e,this.addHandles([C(()=>({viewData:this.viewData,startPoint:this.analysis.startPoint}),({viewData:a,startPoint:r})=>{a.elevationAlignedStartPoint=this._applyProjectionAndElevationAlignment(r)},z),C(()=>({viewData:this.viewData,endPoint:this.analysis.endPoint}),({viewData:a,endPoint:r})=>{a.elevationAlignedEndPoint=this._applyProjectionAndElevationAlignment(r)},z),C(()=>({result:this._computedResult,viewData:this.viewData}),({result:a,viewData:r})=>{r.result=a},z)])}_applyProjectionAndElevationAlignment(e){if(e==null)return e;const{spatialReference:i,elevationProvider:s}=this.view;return Et(e,i,s)??(At(this.analysis,e.spatialReference,Mt),null)}get _computedResult(){const{elevationAlignedStartPoint:e,elevationAlignedEndPoint:i,measurementMode:s}=this.viewData;if(e==null||i==null)return null;const n=this._euclideanDistances(e,i),a=this._geodesicDistance(e,i,n.horizontal.value),r=s===x.Geodesic||s===x.Auto&&n.horizontal.value>Dt?"geodesic":"euclidean";return{mode:r,distance:r==="euclidean"?n.direct:a,directDistance:n.direct,horizontalDistance:n.horizontal,verticalDistance:n.vertical,geodesicDistance:a}}_euclideanDistances(e,i){const s=e.clone();s.z=i.z;const n=this._tempStartPosition,a=this._tempEndPosition,r=this._tempCornerPosition,u=this.view.spatialReference,c=this._sphericalPCPF,h=ge(u,c)?c:u;B(e,n,h),B(i,a,h),B(s,r,h);const l=le(n,a),g=le(r,a),m=Math.abs(i.z-e.z),p=P=>this._unitNormalizer.normalizeDistance(P),E=p(l),D=p(g),A=p(m);return{direct:k(E,"meters"),horizontal:k(D,"meters"),vertical:k(A,"meters")}}_geodesicDistance(e,i,s){const n=e.spatialReference,a=new xe({spatialReference:n});a.addPath([e,i]);const r=n.isGeographic&&Re(n)?Ge([a],"meters")[0]:n.isWebMercator?je(a,"meters"):null,u=r??this._fallbackGeodesicDistance(e,i,s);return k(u,"meters")}_fallbackGeodesicDistance(e,i,s){if(pe(e,Ae)&&pe(i,Oe)){const n=new Ie;return ke(n,Ae,Oe),n.distance}return s}};o([d()],M.prototype,"view",void 0),o([d()],M.prototype,"analysis",void 0),o([d()],M.prototype,"viewData",void 0),o([d()],M.prototype,"_computedResult",null),M=o([ce($e)],M);const Ae=b(),Oe=b();function Me(t){const e=new We,{vertex:i,fragment:s}=e;Fe(i,t),i.uniforms.add(new q("width",a=>a.width)),e.attributes.add(L.POSITION,"vec3"),e.attributes.add(L.NORMAL,"vec3"),e.attributes.add(L.UV0,"vec2"),e.attributes.add(L.AUXPOS1,"float"),e.varyings.add("vtc","vec2"),e.varyings.add("vlength","float"),e.varyings.add("vradius","float"),i.code.add(X`void main(void) { vec3 bitangent = normal; vtc = uv0; vlength = auxpos1; vradius = 0.5 * width; vec4 pos = view * vec4(position + vradius * bitangent * uv0.y, 1.0); gl_Position = proj * pos; -}`),s.uniforms.add(new q("outlineSize",a=>a.outlineSize),new K("outlineColor",a=>a.outlineColor),new q("stripeLength",a=>a.stripeLength),new K("stripeEvenColor",a=>a.stripeEvenColor),new K("stripeOddColor",a=>a.stripeOddColor));const n=1/Math.sqrt(2);return s.code.add(X` +}`),s.uniforms.add(new q("outlineSize",a=>a.outlineSize),new Y("outlineColor",a=>a.outlineColor),new q("stripeLength",a=>a.stripeLength),new Y("stripeEvenColor",a=>a.stripeEvenColor),new Y("stripeOddColor",a=>a.stripeOddColor));const n=1/Math.sqrt(2);return s.code.add(X` const float INV_SQRT2 = ${X.float(n)}; vec4 arrowColor(vec2 tc, float len) { @@ -30,7 +30,7 @@ gl_Position = proj * pos; } fragColor = color; } - `),e}const Dt=Object.freeze(Object.defineProperty({__proto__:null,build:xe},Symbol.toStringTag,{value:"Module"}));class W extends Qe{constructor(e,i,s){super(e,i,s)}initializeProgram(e){return new qe(e.rctx,W.shader.get().build(this.configuration),Xe)}_setPipelineState(e){const i=e===he.NONE,s=this.configuration;return Ke({blending:s.transparent?i?Ye:Ze(e):null,polygonOffset:this.configuration.polygonOffsetEnabled?{factor:0,units:-4}:null,depthTest:{func:Je.LESS},depthWrite:et,colorWrite:tt})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}get primitiveType(){return it.TRIANGLE_STRIP}}W.shader=new Fe(Dt,()=>Be(()=>Promise.resolve().then(()=>Zt),void 0));let U=class extends st{constructor(){super(...arguments),this.polygonOffsetEnabled=!1,this.transparent=!1,this.transparencyPassType=he.NONE}};o([Y()],U.prototype,"polygonOffsetEnabled",void 0),o([Y()],U.prototype,"transparent",void 0),o([Y({count:he.COUNT})],U.prototype,"transparencyPassType",void 0);class Tt extends at{constructor(e){super(e,new Gt),this._configuration=new U}getConfiguration(e,i){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration}intersect(){}produces(e,i){return i===_e.Color||i===_e.Alpha?e===(this._transparent?me.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:me.OPAQUE_MATERIAL):!1}createGLMaterial(e){return new Rt(e)}createBufferWriter(){return new Wt}get _transparent(){const{parameters:e}=this;return e.outlineColor[3]<1||e.stripeEvenColor[3]<1||e.stripeOddColor[3]<1}}class Rt extends rt{beginSlot(e){return this.ensureTechnique(W,e)}}class Gt extends ot{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=Z(1,.5,0,1),this.stripeEvenColor=Z(1,1,1,1),this.stripeOddColor=Z(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const jt=nt().vec3f(L.POSITION).vec3f(L.NORMAL).vec2f(L.UV0).f32(L.AUXPOS1),kt=b(),Nt=b(),Ht=b(),It=b(),Ut=b();let Wt=class{constructor(){this.vertexBufferLayout=jt}elementCount(e){return 2*(e.attributes.get(L.POSITION).indices.length/2+1)}write(e,i,s,n,a){const{data:r,indices:u}=s.attributes.get(L.POSITION),c=s.attributes.get(L.NORMAL).data,h=r.length/3;u&&u.length!==2*(h-1)&&console.warn("MeasurementArrowMaterial does not support indices");const l=kt,g=Nt,m=Ht,p=It,A=Ut,M=n.position,E=n.normal,P=n.uv0;let z=0;for(let w=0;wthis.view.state.camera,()=>{this._viewChanged()}))}destroyExternalResources(){this._arrowMaterial=null,this._handles=f(this._handles)}forEachExternalMaterial(e){e(this._arrowMaterial)}createGeometries(e){var s;if(((s=this._geometry)==null?void 0:s.startRenderSpace)==null||this._geometry.endRenderSpace==null)return;const i=this._createArrowGeometry(this._geometry.startRenderSpace,this._geometry.endRenderSpace,this._origin,this._geometry);i.transformation=this._originTransform,e.addGeometry(i),this._viewChanged()}_createArrowGeometry(e,i,s,n){const a=this.view.renderCoordsHelper,r=[],u=[],c=(h,l)=>{const g=N.get();Oe(g,h,s),r.push(g),u.push(l)};if(n.type==="euclidean"){n.eval(.5,this._arrowCenter);const h=N.get();a.worldUpAtPosition(this._arrowCenter,h),c(e,h),c(i,h)}else{n.eval(.5,this._arrowCenter);const h=this._arrowSubdivisions+1&-2;for(let l=0;l{const{elevationAlignedStartPoint:l,elevationAlignedEndPoint:g}=this.analysisView,m=this.view;return{view:m,camera:m.state.camera,viewMode:this.viewMode,elevationAlignedStartPoint:l,elevationAlignedEndPoint:g,orientation:this._actualVisualElementsOrientation,visualizedMeasurement:this.actualVisualizedMeasurement,stripeLength:this._measurementArrowStripeLength}},l=>this._updateGeometryAndViewMode(l),O),C(()=>({visible:this.visible,viewMode:this.viewMode}),l=>this._updateVisualElementVisibility(l),O),C(()=>({text:this._labelsText,visualizedMeasurement:this.actualVisualizedMeasurement}),l=>this._updateLabelText(l),O),C(()=>({visible:this.visible,viewMode:this.viewMode}),l=>this._updateLabelVisibility(l),O),C(()=>this._measurementArrowStripeLength,l=>this._updateSegmentStripeLength(l),O),pt(async()=>this._updateMessageBundle()),C(()=>this._parameters,({textBackgroundColor:l,textCalloutColor:g,textColor:m,translucentAccentColor:p,accentColor:A,contrastColor:M})=>{const{_segmentLabel:E,_verticalLabel:P,_horizontalLabel:z,_triangleVisualElement:F,_rightAngleQuad:w,_projectedGeodesicLine:R,_geodesicStartHint:B,_geodesicEndHint:V,_segmentVisualElement:$}=this;E.backgroundColor=l,E.calloutColor=g,E.textColor=m,P.backgroundColor=l,P.calloutColor=g,P.textColor=m,z.backgroundColor=l,z.calloutColor=g,z.textColor=m,F.color=p,w.color=p,R.color=p,B.color=p,V.color=p,$.color=A,$.contrastColor=M},_t)]),this._updateMessageBundle()}destroy(){this._segmentVisualElement=f(this._segmentVisualElement),this._triangleVisualElement=f(this._triangleVisualElement),this._rightAngleQuad=f(this._rightAngleQuad),this._projectedGeodesicLine=f(this._projectedGeodesicLine),this._geodesicStartHint=f(this._geodesicStartHint),this._geodesicEndHint=f(this._geodesicEndHint),this._segmentLabel=f(this._segmentLabel),this._verticalLabel=f(this._verticalLabel),this._horizontalLabel=f(this._horizontalLabel),this.set("view",null)}_updateVisualElementVisibility({visible:t,viewMode:e}){if(this._segmentVisualElement.visible=!1,this._triangleVisualElement.visible=!1,this._rightAngleQuad.visible=!1,this._projectedGeodesicLine.visible=!1,this._geodesicStartHint.visible=!1,this._geodesicEndHint.visible=!1,t)switch(e){case y.None:break;case y.Direct:this._segmentVisualElement.visible=!0;break;case y.Triangle:this._segmentVisualElement.visible=!0,this._triangleVisualElement.visible=!0,this._rightAngleQuad.visible=!0;break;case y.ProjectedGeodesic:this._segmentVisualElement.visible=!0,this._projectedGeodesicLine.visible=!0,this._geodesicStartHint.visible=!0,this._geodesicEndHint.visible=!0}}_updateGeometryAndViewMode({view:t,camera:e,viewMode:i,elevationAlignedStartPoint:s,elevationAlignedEndPoint:n,orientation:a,visualizedMeasurement:r,stripeLength:u}){const c=t.renderCoordsHelper;if(c==null||s==null||n==null||s.equals(n))return;let h=this._startPosition,l=this._endPosition;c.toRenderCoords(s,h),c.toRenderCoords(n,l);const g=a===S.AboveSegment?1:-1,m=g*(c.getAltitude(l)-c.getAltitude(h));m<0&&(h=this._endPosition,l=this._startPosition);const p=r==="geodesic"?new Ce(this._startPosition,this._endPosition,c.spatialReference):new G(this._startPosition,this._endPosition);switch(this._segmentVisualElement.geometry=p,this._updateSegmentStripeLength(u),i){case y.Direct:this._updateSegment(p,a);break;case y.Triangle:this._updateSegmentAndTriangle({view:t,camera:e,segment:p,orientation:a,startPosition:h,endPosition:l,deltaSign:g,altitudeDelta:m});break;case y.ProjectedGeodesic:this._updateSegmentAndProjection({view:t,orientation:a,startPosition:h,endPosition:l})}}_updateSegment(t,e){this._segmentLabel.anchor=e===S.AboveSegment?"top":"bottom",this._segmentLabel.geometry={type:"segment",segment:t,sampleLocation:"center"}}_updateSegmentAndTriangle({view:{renderCoordsHelper:t},camera:e,segment:i,orientation:s,startPosition:n,endPosition:a,deltaSign:r,altitudeDelta:u}){const c=this._cornerPosition;t.worldUpAtPosition(n,c),mt(c,c,r*Math.abs(u)),vt(c,c,n),this._triangleVisualElement.geometry=[[[n[0],n[1],n[2]],[c[0],c[1],c[2]],[a[0],a[1],a[2]]]],this._rightAngleQuad.geometry={previous:n,center:c,next:a};const h=new G(n,c),l=new G(c,a),g=Bt(n,a,c,s,e);this._segmentLabel.anchor=g.segment,this._segmentLabel.geometry={type:"segment",segment:i,sampleLocation:"center"},this._verticalLabel.geometry={type:"segment",segment:h,sampleLocation:"center"},this._verticalLabel.anchor=g.vertical,this._horizontalLabel.geometry={type:"segment",segment:l,sampleLocation:"center"},this._horizontalLabel.anchor=g.horizontal}_updateSegmentAndProjection({view:{renderCoordsHelper:t},orientation:e,startPosition:i,endPosition:s}){t.setAltitude(this._startPositionAtSeaLevel,0,i),t.setAltitude(this._endPositionAtSeaLevel,0,s);const n=new Ce(this._startPositionAtSeaLevel,this._endPositionAtSeaLevel,t.spatialReference);this._projectedGeodesicLine.setGeometryFromSegment(n),this._geodesicStartHint.setGeometryFromSegment(new G(this._startPositionAtSeaLevel,i)),this._geodesicEndHint.setGeometryFromSegment(new G(this._endPositionAtSeaLevel,s)),this._segmentLabel.geometry={type:"segment",segment:n,sampleLocation:"center"},this._segmentLabel.anchor=e===S.AboveSegment?"top":"bottom"}_updateLabelText({text:t,visualizedMeasurement:e}){t!=null?(this._segmentLabel.text=e==="euclidean"?t.euclideanDistance:t.geodesicDistance,this._horizontalLabel.text=t.horizontalDistance,this._verticalLabel.text=t.verticalDistance):(this._segmentLabel.text=null,this._horizontalLabel.text=null,this._verticalLabel.text=null),this.notifyChange("labels")}_updateLabelVisibility({visible:t,viewMode:e}){const i=this._segmentLabel,s=this._horizontalLabel,n=this._verticalLabel;if(i.visible=!1,s.visible=!1,n.visible=!1,t)switch(e){case y.Direct:i.visible=!0;break;case y.Triangle:i.visible=!0,s.visible=!0,n.visible=!0;break;case y.ProjectedGeodesic:i.visible=!0;case y.None:}}get _labelsText(){if(this.destroyed)return null;const t=this.messages,e=this.analysisView.result;if(e==null||t==null)return null;const{directDistance:i,horizontalDistance:s,verticalDistance:n,geodesicDistance:a}=e,r=this.analysisView.unit,u=c=>({euclideanDistance:"",geodesicDistance:"",horizontalDistance:"",verticalDistance:"",...c});switch(r){case"metric":return u({euclideanDistance:i&&re(t,i),geodesicDistance:a&&re(t,a),horizontalDistance:s&&re(t,s),verticalDistance:n&&Ot(t,n)});case"imperial":return u({euclideanDistance:i&&ae(t,i),geodesicDistance:a&&ae(t,a),horizontalDistance:s&&ae(t,s),verticalDistance:n&&St(t,n)});default:return u({euclideanDistance:i&&I(t,i,r),geodesicDistance:a&&I(t,a,r),horizontalDistance:s&&I(t,s,r),verticalDistance:n&&I(t,n,r)})}}_updateSegmentStripeLength(t){const e=this._segmentVisualElement;t!=null?(e.stripeLength=t,e.stripesEnabled=!0):e.stripesEnabled=!1}get _actualVisualElementsOrientation(){if(this._triangleOrientationOverride!=null)return this._triangleOrientationOverride;const t=this.visualElementOrientation;return t===S.Auto?this.view.state.camera.aboveGround?S.AboveSegment:S.BelowSegment:t}_requiresGeodesicGuideAt(t){const e=this.view;if(!(e!=null&&e.state))return!1;const i=e.state.camera,s=e.renderCoordsHelper;if(!s)return!1;const n=i.computeScreenPixelSizeAt(t);return s.getAltitude(t)/n>=10}get _measurementArrowStripeLength(){const{result:t,unit:e}=this.analysisView;if(t==null)return null;let i=null;const s=t.directDistance;switch(e){case"metric":i=s&&se(s,"meters");break;case"imperial":i=s&&se(s,yt(s.value,s.unit));break;default:i=s&&se(s,e)}return i==null?null:bt(i.value/30)*wt(1,i.unit,"meters")}_updateMessageBundle(){this.loadingMessages=!0,ft("esri/core/t9n/Units").then(t=>{this.messages=t}).finally(()=>{this.loadingMessages=!1})}get testData(){var t;return{labels:this.labels,stripeLength:(t=this._segmentVisualElement)==null?void 0:t.stripeLength}}};function Bt(t,e,i,s,n){const a=Qt,r=qt;n.projectToRenderScreen(i,a),n.projectToRenderScreen(e,r);const u={segment:"bottom",horizontal:"top",vertical:a[0]=Se){const l=Math.sign(c[1])===Math.sign(h[1]);u.segment=l?Ae(u.vertical):u.vertical}else{const l=Yt;ne(i,e,l,n),Pe(l,h)>=Se&&(u.segment=Math.sign(l[0])===Math.sign(h[0])?Ae(u.horizontal):u.horizontal)}}if(s===S.BelowSegment){const c=h=>h==="top"?"bottom":"top";u.segment=c(u.segment),u.horizontal=c(u.horizontal),u.vertical=c(u.vertical)}return u}o([d()],v.prototype,"_parameters",null),o([d()],v.prototype,"_triangleOrientationOverride",void 0),o([d()],v.prototype,"messages",void 0),o([d()],v.prototype,"view",void 0),o([d()],v.prototype,"analysis",void 0),o([d()],v.prototype,"analysisView",void 0),o([d()],v.prototype,"loadingMessages",void 0),o([d()],v.prototype,"visible",null),o([d()],v.prototype,"viewMode",null),o([d()],v.prototype,"actualVisualizedMeasurement",null),o([d()],v.prototype,"visualElementOrientation",void 0),o([d()],v.prototype,"triangleCollapseRatioThreshold",void 0),o([d()],v.prototype,"allowVisualElementsOrientationChange",null),o([d()],v.prototype,"labels",null),o([d()],v.prototype,"_labelsText",null),o([d()],v.prototype,"_actualVisualElementsOrientation",null),o([d()],v.prototype,"_measurementArrowStripeLength",null),v=o([ce("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementVisualization")],v);const Se=Math.cos(Lt(12)),Qt=Ve(),qt=Ve(),Xt=ue(),Kt=ue(),Yt=ue();let _=class extends Ct(de){constructor(t){super(t),this.type="direct-line-measurement-view-3d",this.analysis=null,this.result=null,this.measurementMode=T.Auto,this.elevationAlignedStartPoint=null,this.elevationAlignedEndPoint=null}initialize(){const t=this.view,e=this.analysis;this._analysisVisualization=new v({view:t,analysis:e,analysisView:this}),this._analysisController=new x({view:t,analysis:e,viewData:this})}destroy(){this._analysisController=f(this._analysisController),this._analysisVisualization=f(this._analysisVisualization)}get updating(){var t;return!!((t=this._analysisVisualization)!=null&&t.loadingMessages)}get viewMode(){return this._analysisVisualization.viewMode}get actualVisualizedMeasurement(){return this._analysisVisualization.actualVisualizedMeasurement}get visualElementOrientation(){return this._analysisVisualization.visualElementOrientation}set visualElementOrientation(t){this._analysisVisualization.visualElementOrientation=t}get allowVisualElementsOrientationChange(){return this._analysisVisualization.allowVisualElementsOrientationChange}set allowVisualElementsOrientationChange(t){this._analysisVisualization.allowVisualElementsOrientationChange=t}get triangleCollapseRatioThreshold(){return this._analysisVisualization.triangleCollapseRatioThreshold}set triangleCollapseRatioThreshold(t){this._analysisVisualization.triangleCollapseRatioThreshold=t}get directLabelText(){var t;return((t=this._analysisVisualization.labels.direct)==null?void 0:t.text)??""}get horizontalLabelText(){var t;return((t=this._analysisVisualization.labels.horizontal)==null?void 0:t.text)??""}get verticalLabelText(){var t;return((t=this._analysisVisualization.labels.vertical)==null?void 0:t.text)??""}get unit(){return this.analysis.unit??this._defaultUnit}get testData(){var t;return this.destroyed?{labels:null,stripeLength:null,visualization:null,controller:null}:{...(t=this._analysisVisualization)==null?void 0:t.testData,visualization:this._analysisVisualization,controller:this._analysisController}}};o([d()],_.prototype,"updating",null),o([d({readOnly:!0})],_.prototype,"type",void 0),o([d({constructOnly:!0,nonNullable:!0})],_.prototype,"analysis",void 0),o([d()],_.prototype,"result",void 0),o([d()],_.prototype,"measurementMode",void 0),o([d()],_.prototype,"elevationAlignedStartPoint",void 0),o([d()],_.prototype,"elevationAlignedEndPoint",void 0),o([d({readOnly:!0})],_.prototype,"viewMode",null),o([d({readOnly:!0})],_.prototype,"actualVisualizedMeasurement",null),o([d()],_.prototype,"visualElementOrientation",null),o([d()],_.prototype,"allowVisualElementsOrientationChange",null),o([d()],_.prototype,"triangleCollapseRatioThreshold",null),o([d({readOnly:!0})],_.prototype,"directLabelText",null),o([d({readOnly:!0})],_.prototype,"horizontalLabelText",null),o([d({readOnly:!0})],_.prototype,"verticalLabelText",null),o([d()],_.prototype,"_analysisVisualization",void 0),o([d()],_.prototype,"_analysisController",void 0),o([d()],_.prototype,"unit",null),o([d(Pt)],_.prototype,"_defaultUnit",void 0),_=o([ce("esri.views.3d.analysis.DirectLineMeasurementAnalysisView3D")],_);const mi=_,Zt=Object.freeze(Object.defineProperty({__proto__:null,build:xe},Symbol.toStringTag,{value:"Module"}));export{mi as default}; + `),e}const Tt=Object.freeze(Object.defineProperty({__proto__:null,build:Me},Symbol.toStringTag,{value:"Module"}));class F extends Be{constructor(e,i,s){super(e,i,s)}initializeProgram(e){return new qe(e.rctx,F.shader.get().build(this.configuration),Xe)}_setPipelineState(e){const i=e===he.NONE,s=this.configuration;return Ye({blending:s.transparent?i?Je:Ke(e):null,polygonOffset:this.configuration.polygonOffsetEnabled?{factor:0,units:-4}:null,depthTest:{func:Ze.LESS},depthWrite:et,colorWrite:tt})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}get primitiveType(){return it.TRIANGLE_STRIP}}F.shader=new Qe(Tt,()=>Ue(()=>Promise.resolve().then(()=>Kt),void 0));let W=class extends st{constructor(){super(...arguments),this.polygonOffsetEnabled=!1,this.transparent=!1,this.transparencyPassType=he.NONE}};o([J()],W.prototype,"polygonOffsetEnabled",void 0),o([J()],W.prototype,"transparent",void 0),o([J({count:he.COUNT})],W.prototype,"transparencyPassType",void 0);class xt extends at{constructor(e){super(e,new Gt),this._configuration=new W}getConfiguration(e,i){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration}intersect(){}produces(e,i){return i===_e.Color||i===_e.Alpha?e===(this._transparent?me.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:me.OPAQUE_MATERIAL):!1}createGLMaterial(e){return new Rt(e)}createBufferWriter(){return new Ft}get _transparent(){const{parameters:e}=this;return e.outlineColor[3]<1||e.stripeEvenColor[3]<1||e.stripeOddColor[3]<1}}class Rt extends rt{beginSlot(e){return this.ensureTechnique(F,e)}}class Gt extends ot{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=K(1,.5,0,1),this.stripeEvenColor=K(1,1,1,1),this.stripeOddColor=K(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const jt=nt().vec3f(L.POSITION).vec3f(L.NORMAL).vec2f(L.UV0).f32(L.AUXPOS1),kt=b(),Nt=b(),Ht=b(),It=b(),Wt=b();let Ft=class{constructor(){this.vertexBufferLayout=jt}elementCount(e){return 2*(e.attributes.get(L.POSITION).indices.length/2+1)}write(e,i,s,n,a){const{data:r,indices:u}=s.attributes.get(L.POSITION),c=s.attributes.get(L.NORMAL).data,h=r.length/3;u&&u.length!==2*(h-1)&&console.warn("MeasurementArrowMaterial does not support indices");const l=kt,g=Nt,m=Ht,p=It,E=Wt,D=n.position,A=n.normal,P=n.uv0;let O=0;for(let w=0;wthis.view.state.camera,()=>{this._viewChanged()}))}destroyExternalResources(){this._arrowMaterial=null,this._handles=f(this._handles)}forEachExternalMaterial(e){e(this._arrowMaterial)}createGeometries(e){var s;if(((s=this._geometry)==null?void 0:s.startRenderSpace)==null||this._geometry.endRenderSpace==null)return;const i=this._createArrowGeometry(this._geometry.startRenderSpace,this._geometry.endRenderSpace,this._origin,this._geometry);i.transformation=this._originTransform,e.addGeometry(i),this._viewChanged()}_createArrowGeometry(e,i,s,n){const a=this.view.renderCoordsHelper,r=[],u=[],c=(h,l)=>{const g=N.get();ze(g,h,s),r.push(g),u.push(l)};if(n.type==="euclidean"){n.eval(.5,this._arrowCenter);const h=N.get();a.worldUpAtPosition(this._arrowCenter,h),c(e,h),c(i,h)}else{n.eval(.5,this._arrowCenter);const h=this._arrowSubdivisions+1&-2;for(let l=0;l{const{elevationAlignedStartPoint:l,elevationAlignedEndPoint:g}=this.analysisView,m=this.view;return{view:m,camera:m.state.camera,viewMode:this.viewMode,elevationAlignedStartPoint:l,elevationAlignedEndPoint:g,orientation:this._actualVisualElementsOrientation,visualizedMeasurement:this.actualVisualizedMeasurement,stripeLength:this._measurementArrowStripeLength}},l=>this._updateGeometryAndViewMode(l),z),C(()=>({visible:this.visible,viewMode:this.viewMode}),l=>this._updateVisualElementVisibility(l),z),C(()=>({text:this._labelsText,visualizedMeasurement:this.actualVisualizedMeasurement}),l=>this._updateLabelText(l),z),C(()=>({visible:this.visible,viewMode:this.viewMode}),l=>this._updateLabelVisibility(l),z),C(()=>this._measurementArrowStripeLength,l=>this._updateSegmentStripeLength(l),z),pt(async()=>this._updateMessageBundle()),C(()=>this._parameters,({textBackgroundColor:l,textCalloutColor:g,textColor:m,translucentAccentColor:p,accentColor:E,contrastColor:D})=>{const{_segmentLabel:A,_verticalLabel:P,_horizontalLabel:O,_triangleVisualElement:Q,_rightAngleQuad:w,_projectedGeodesicLine:R,_geodesicStartHint:U,_geodesicEndHint:V,_segmentVisualElement:$}=this;A.backgroundColor=l,A.calloutColor=g,A.textColor=m,P.backgroundColor=l,P.calloutColor=g,P.textColor=m,O.backgroundColor=l,O.calloutColor=g,O.textColor=m,Q.color=p,w.color=p,R.color=p,U.color=p,V.color=p,$.color=E,$.contrastColor=D},_t)]),this._updateMessageBundle()}destroy(){this._segmentVisualElement=f(this._segmentVisualElement),this._triangleVisualElement=f(this._triangleVisualElement),this._rightAngleQuad=f(this._rightAngleQuad),this._projectedGeodesicLine=f(this._projectedGeodesicLine),this._geodesicStartHint=f(this._geodesicStartHint),this._geodesicEndHint=f(this._geodesicEndHint),this._segmentLabel=f(this._segmentLabel),this._verticalLabel=f(this._verticalLabel),this._horizontalLabel=f(this._horizontalLabel),this.set("view",null)}_updateVisualElementVisibility({visible:t,viewMode:e}){if(this._segmentVisualElement.visible=!1,this._triangleVisualElement.visible=!1,this._rightAngleQuad.visible=!1,this._projectedGeodesicLine.visible=!1,this._geodesicStartHint.visible=!1,this._geodesicEndHint.visible=!1,t)switch(e){case y.None:break;case y.Direct:this._segmentVisualElement.visible=!0;break;case y.Triangle:this._segmentVisualElement.visible=!0,this._triangleVisualElement.visible=!0,this._rightAngleQuad.visible=!0;break;case y.ProjectedGeodesic:this._segmentVisualElement.visible=!0,this._projectedGeodesicLine.visible=!0,this._geodesicStartHint.visible=!0,this._geodesicEndHint.visible=!0}}_updateGeometryAndViewMode({view:t,camera:e,viewMode:i,elevationAlignedStartPoint:s,elevationAlignedEndPoint:n,orientation:a,visualizedMeasurement:r,stripeLength:u}){const c=t.renderCoordsHelper;if(c==null||s==null||n==null||s.equals(n))return;let h=this._startPosition,l=this._endPosition;c.toRenderCoords(s,h),c.toRenderCoords(n,l);const g=a===S.AboveSegment?1:-1,m=g*(c.getAltitude(l)-c.getAltitude(h));m<0&&(h=this._endPosition,l=this._startPosition);const p=r==="geodesic"?new Ce(this._startPosition,this._endPosition,c.spatialReference):new G(this._startPosition,this._endPosition);switch(this._segmentVisualElement.geometry=p,this._updateSegmentStripeLength(u),i){case y.Direct:this._updateSegment(p,a);break;case y.Triangle:this._updateSegmentAndTriangle({view:t,camera:e,segment:p,orientation:a,startPosition:h,endPosition:l,deltaSign:g,altitudeDelta:m});break;case y.ProjectedGeodesic:this._updateSegmentAndProjection({view:t,orientation:a,startPosition:h,endPosition:l})}}_updateSegment(t,e){this._segmentLabel.anchor=e===S.AboveSegment?"top":"bottom",this._segmentLabel.geometry={type:"segment",segment:t,sampleLocation:"center"}}_updateSegmentAndTriangle({view:{renderCoordsHelper:t},camera:e,segment:i,orientation:s,startPosition:n,endPosition:a,deltaSign:r,altitudeDelta:u}){const c=this._cornerPosition;t.worldUpAtPosition(n,c),mt(c,c,r*Math.abs(u)),vt(c,c,n),this._triangleVisualElement.geometry=[[[n[0],n[1],n[2]],[c[0],c[1],c[2]],[a[0],a[1],a[2]]]],this._rightAngleQuad.geometry={previous:n,center:c,next:a};const h=new G(n,c),l=new G(c,a),g=Ut(n,a,c,s,e);this._segmentLabel.anchor=g.segment,this._segmentLabel.geometry={type:"segment",segment:i,sampleLocation:"center"},this._verticalLabel.geometry={type:"segment",segment:h,sampleLocation:"center"},this._verticalLabel.anchor=g.vertical,this._horizontalLabel.geometry={type:"segment",segment:l,sampleLocation:"center"},this._horizontalLabel.anchor=g.horizontal}_updateSegmentAndProjection({view:{renderCoordsHelper:t},orientation:e,startPosition:i,endPosition:s}){t.setAltitude(this._startPositionAtSeaLevel,0,i),t.setAltitude(this._endPositionAtSeaLevel,0,s);const n=new Ce(this._startPositionAtSeaLevel,this._endPositionAtSeaLevel,t.spatialReference);this._projectedGeodesicLine.setGeometryFromSegment(n),this._geodesicStartHint.setGeometryFromSegment(new G(this._startPositionAtSeaLevel,i)),this._geodesicEndHint.setGeometryFromSegment(new G(this._endPositionAtSeaLevel,s)),this._segmentLabel.geometry={type:"segment",segment:n,sampleLocation:"center"},this._segmentLabel.anchor=e===S.AboveSegment?"top":"bottom"}_updateLabelText({text:t,visualizedMeasurement:e}){t!=null?(this._segmentLabel.text=e==="euclidean"?t.euclideanDistance:t.geodesicDistance,this._horizontalLabel.text=t.horizontalDistance,this._verticalLabel.text=t.verticalDistance):(this._segmentLabel.text=null,this._horizontalLabel.text=null,this._verticalLabel.text=null),this.notifyChange("labels")}_updateLabelVisibility({visible:t,viewMode:e}){const i=this._segmentLabel,s=this._horizontalLabel,n=this._verticalLabel;if(i.visible=!1,s.visible=!1,n.visible=!1,t)switch(e){case y.Direct:i.visible=!0;break;case y.Triangle:i.visible=!0,s.visible=!0,n.visible=!0;break;case y.ProjectedGeodesic:i.visible=!0;case y.None:}}get _labelsText(){if(this.destroyed)return null;const t=this.messages,e=this.analysisView.result;if(e==null||t==null)return null;const{directDistance:i,horizontalDistance:s,verticalDistance:n,geodesicDistance:a}=e,r=this.analysisView.unit,u=c=>({euclideanDistance:"",geodesicDistance:"",horizontalDistance:"",verticalDistance:"",...c});switch(r){case"metric":return u({euclideanDistance:i&&re(t,i),geodesicDistance:a&&re(t,a),horizontalDistance:s&&re(t,s),verticalDistance:n&&zt(t,n)});case"imperial":return u({euclideanDistance:i&&ae(t,i),geodesicDistance:a&&ae(t,a),horizontalDistance:s&&ae(t,s),verticalDistance:n&&St(t,n)});default:return u({euclideanDistance:i&&I(t,i,r),geodesicDistance:a&&I(t,a,r),horizontalDistance:s&&I(t,s,r),verticalDistance:n&&I(t,n,r)})}}_updateSegmentStripeLength(t){const e=this._segmentVisualElement;t!=null?(e.stripeLength=t,e.stripesEnabled=!0):e.stripesEnabled=!1}get _actualVisualElementsOrientation(){if(this._triangleOrientationOverride!=null)return this._triangleOrientationOverride;const t=this.visualElementOrientation;return t===S.Auto?this.view.state.camera.aboveGround?S.AboveSegment:S.BelowSegment:t}_requiresGeodesicGuideAt(t){const e=this.view;if(!(e!=null&&e.state))return!1;const i=e.state.camera,s=e.renderCoordsHelper;if(!s)return!1;const n=i.computeScreenPixelSizeAt(t);return s.getAltitude(t)/n>=10}get _measurementArrowStripeLength(){const{result:t,unit:e}=this.analysisView;if(t==null)return null;let i=null;const s=t.directDistance;switch(e){case"metric":i=s&&se(s,"meters");break;case"imperial":i=s&&se(s,yt(s.value,s.unit));break;default:i=s&&se(s,e)}return i==null?null:bt(i.value/30)*wt(1,i.unit,"meters")}_updateMessageBundle(){this.loadingMessages=!0,ft("esri/core/t9n/Units").then(t=>{this.messages=t}).finally(()=>{this.loadingMessages=!1})}get testData(){var t;return{labels:this.labels,stripeLength:(t=this._segmentVisualElement)==null?void 0:t.stripeLength}}};function Ut(t,e,i,s,n){const a=Bt,r=qt;n.projectToRenderScreen(i,a),n.projectToRenderScreen(e,r);const u={segment:"bottom",horizontal:"top",vertical:a[0]=Se){const l=Math.sign(c[1])===Math.sign(h[1]);u.segment=l?Ee(u.vertical):u.vertical}else{const l=Jt;ne(i,e,l,n),Pe(l,h)>=Se&&(u.segment=Math.sign(l[0])===Math.sign(h[0])?Ee(u.horizontal):u.horizontal)}}if(s===S.BelowSegment){const c=h=>h==="top"?"bottom":"top";u.segment=c(u.segment),u.horizontal=c(u.horizontal),u.vertical=c(u.vertical)}return u}o([d()],v.prototype,"_parameters",null),o([d()],v.prototype,"_triangleOrientationOverride",void 0),o([d()],v.prototype,"messages",void 0),o([d()],v.prototype,"view",void 0),o([d()],v.prototype,"analysis",void 0),o([d()],v.prototype,"analysisView",void 0),o([d()],v.prototype,"loadingMessages",void 0),o([d()],v.prototype,"visible",null),o([d()],v.prototype,"viewMode",null),o([d()],v.prototype,"actualVisualizedMeasurement",null),o([d()],v.prototype,"visualElementOrientation",void 0),o([d()],v.prototype,"triangleCollapseRatioThreshold",void 0),o([d()],v.prototype,"allowVisualElementsOrientationChange",null),o([d()],v.prototype,"labels",null),o([d()],v.prototype,"_labelsText",null),o([d()],v.prototype,"_actualVisualElementsOrientation",null),o([d()],v.prototype,"_measurementArrowStripeLength",null),v=o([ce("esri.views.3d.analysis.DirectLineMeasurement.DirectLineMeasurementVisualization")],v);const Se=Math.cos(Lt(12)),Bt=Ve(),qt=Ve(),Xt=ue(),Yt=ue(),Jt=ue();let _=class extends Ct(de){constructor(t){super(t),this.type="direct-line-measurement-view-3d",this.analysis=null,this.result=null,this.measurementMode=x.Auto,this.elevationAlignedStartPoint=null,this.elevationAlignedEndPoint=null}initialize(){const t=this.view,e=this.analysis;this._analysisVisualization=new v({view:t,analysis:e,analysisView:this}),this._analysisController=new M({view:t,analysis:e,viewData:this})}destroy(){this._analysisController=f(this._analysisController),this._analysisVisualization=f(this._analysisVisualization)}get updating(){var t;return!!((t=this._analysisVisualization)!=null&&t.loadingMessages)}get viewMode(){return this._analysisVisualization.viewMode}get actualVisualizedMeasurement(){return this._analysisVisualization.actualVisualizedMeasurement}get visualElementOrientation(){return this._analysisVisualization.visualElementOrientation}set visualElementOrientation(t){this._analysisVisualization.visualElementOrientation=t}get allowVisualElementsOrientationChange(){return this._analysisVisualization.allowVisualElementsOrientationChange}set allowVisualElementsOrientationChange(t){this._analysisVisualization.allowVisualElementsOrientationChange=t}get triangleCollapseRatioThreshold(){return this._analysisVisualization.triangleCollapseRatioThreshold}set triangleCollapseRatioThreshold(t){this._analysisVisualization.triangleCollapseRatioThreshold=t}get directLabelText(){var t;return((t=this._analysisVisualization.labels.direct)==null?void 0:t.text)??""}get horizontalLabelText(){var t;return((t=this._analysisVisualization.labels.horizontal)==null?void 0:t.text)??""}get verticalLabelText(){var t;return((t=this._analysisVisualization.labels.vertical)==null?void 0:t.text)??""}get unit(){return this.analysis.unit??this._defaultUnit}get testData(){var t;return this.destroyed?{labels:null,stripeLength:null,visualization:null,controller:null}:{...(t=this._analysisVisualization)==null?void 0:t.testData,visualization:this._analysisVisualization,controller:this._analysisController}}};o([d()],_.prototype,"updating",null),o([d({readOnly:!0})],_.prototype,"type",void 0),o([d({constructOnly:!0,nonNullable:!0})],_.prototype,"analysis",void 0),o([d()],_.prototype,"result",void 0),o([d()],_.prototype,"measurementMode",void 0),o([d()],_.prototype,"elevationAlignedStartPoint",void 0),o([d()],_.prototype,"elevationAlignedEndPoint",void 0),o([d({readOnly:!0})],_.prototype,"viewMode",null),o([d({readOnly:!0})],_.prototype,"actualVisualizedMeasurement",null),o([d()],_.prototype,"visualElementOrientation",null),o([d()],_.prototype,"allowVisualElementsOrientationChange",null),o([d()],_.prototype,"triangleCollapseRatioThreshold",null),o([d({readOnly:!0})],_.prototype,"directLabelText",null),o([d({readOnly:!0})],_.prototype,"horizontalLabelText",null),o([d({readOnly:!0})],_.prototype,"verticalLabelText",null),o([d()],_.prototype,"_analysisVisualization",void 0),o([d()],_.prototype,"_analysisController",void 0),o([d()],_.prototype,"unit",null),o([d(Pt)],_.prototype,"_defaultUnit",void 0),_=o([ce("esri.views.3d.analysis.DirectLineMeasurementAnalysisView3D")],_);const mi=_,Kt=Object.freeze(Object.defineProperty({__proto__:null,build:Me},Symbol.toStringTag,{value:"Module"}));export{mi as default}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] diff --git a/dist/assets/DistanceMeasurement2D-0EP_w-h3.js b/dist/assets/DistanceMeasurement2D-0EP_w-h3.js deleted file mode 100644 index 00d8559..0000000 --- a/dist/assets/DistanceMeasurement2D-0EP_w-h3.js +++ /dev/null @@ -1 +0,0 @@ -import{e as s,y as i,c as k,Q as x,kw as T,kx as W,d as y,P as S,n as f,T as A,O as j,S as D,a3 as q,kz as I,c1 as F,hS as E,kA as J,ky as K,J as R,N as Q,kB as H,kG as b,kC as M,e1 as w,ar as U,kI as X,kD as Y,kE as Z,cy as ee,hx as te,cG as se,cB as ie,kK as re,kP as L,w as ne,e0 as oe,kM as G,hl as ae,hn as B,ao as le,kN as z,kO as he}from"./index-J0iiHjMT.js";import{l as ce}from"./Draw-DYxsSuyr.js";import{l as ue,d as me,v as de,x as pe}from"./InteractiveToolBase-WDic4GPF.js";import{S as ve}from"./GraphicManipulator-ku6oRBpa.js";import{n as ye,u as we}from"./MeasurementWidgetContent-d8uX7Gw_.js";import"./SnappingVisualizer2D-NnEm1PvQ.js";import"./SnappingContext-6K6JmvvY.js";import"./PointSnappingHint-ULetRXiW.js";import"./EditGeometryOperations-TPE5Wzab.js";import"./SnappingOperation-2U48wt1k.js";import"./surfaceCoordinateSystems-siQq4eBA.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./SnappingDragPipelineStep-THHIXt-p.js";import"./drawUtils-woTYaREB.js";import"./drapedUtils-9db1OpTX.js";const g=1e5;let m=class extends ue{constructor(e){super(e),this._drawActive=!1,this._measurementLayer=new x({internal:!0,listMode:"hide",visible:!1}),this._manipulatorLayer=new x({internal:!0,listMode:"hide",visible:!1}),this._vertices=[],this.geodesicDistanceThreshold=1e5,this.measurement=null,this.measurementLabel=null}initialize(){T("esri/core/t9n/Units").then(t=>{this.messages=t}),this.addHandles(W(async()=>{this.messages=await T("esri/core/t9n/Units")}));const e=this.view;this._draw=new ce({view:e}),e.map.addMany([this._measurementLayer,this._manipulatorLayer]),e.focus(),this.addHandles([y(()=>[this.unit,this.geodesicDistanceThreshold,this.messages],()=>{this._updatePolylines()},S),y(()=>[this.view.effectiveTheme.accentColor,this.view.effectiveTheme.textColor],()=>{if(!this._vertices.length)return;const t=this._vertices.map(({coord:r})=>r);for(const{handle:r}of this._vertices)r.remove();this._vertices=[],this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this.manipulators.removeAll(),this._updateSketch(t)})])}destroy(){const{map:e}=this.view;this._draw.view=null,this._draw=f(this._draw),e.removeMany([this._measurementLayer,this._manipulatorLayer]),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._measurementLayer=f(this._measurementLayer),this._manipulatorLayer=f(this._manipulatorLayer),this._resetVertices()}get cursor(){return this._drawActive?"crosshair":null}set editable(e){this._set("editable",e),e||this._draw.reset()}onActivate(){this._drawActive||this._vertices.length!==0||this._startSketch()}onShow(){this._measurementLayer.visible=!0,this._manipulatorLayer.visible=!0}onHide(){this._measurementLayer.visible=!1,this._manipulatorLayer.visible=!1}_resetVertices(){for(const{handle:e}of this._vertices)e.remove();this._vertices=[]}_startSketch(){this._drawActive=!0;const e=this._draw.create("polyline",{mode:"click"});e.on(["vertex-add","vertex-update","vertex-remove","cursor-update","undo","redo"],t=>this._updateSketch(t.vertices)),e.on("draw-complete",()=>{this._stopSketch()})}_stopSketch(){this.manipulators.forEach(({manipulator:e})=>{e.interactive=!0}),this._drawActive=!1,this.finishToolCreation()}_updateSketch(e){const{spatialReference:t}=this.view;for(;this._vertices.length>e.length;){const{handle:n,manipulator:u}=this._vertices.pop();n.remove(),this.manipulators.remove(u)}for(let n=this._vertices.length;n{V.next(de(this.view)).next(pe(C.graphic,j.Local)).next(()=>{const O=C.graphic.geometry;this._vertices[n].coord=[O.x,O.y],this._updatePolylines()})});this._vertices.push({manipulator:v,coord:[u,p],handle:_})}const r=this._vertices.length-1,o=this._vertices[r],[l,a]=e[r];o.coord[0]===l&&o.coord[1]===a||(o.coord=[l,a],o.manipulator.graphic.geometry=new A({x:l,y:a,spatialReference:t}));const h=this._drawActive?this._vertices[r].manipulator:null;this.manipulators.forEach(({manipulator:n})=>{n.interactive=h==null||n!==h}),this._updatePolylines()}_updatePolylines(){var v;if(this._vertices.length<2)return void this._measurementLayer.removeAll();const e=this._vertices.map(({coord:_})=>_),{measurement:t,drawing:r,original:o}=_e(e,this.view.spatialReference,this.geodesicDistanceThreshold);this._set("measurement",t);const l=Me(this.messages,t,this.unit);let a,h;this._set("measurementLabel",l);const{graphics:n}=this._measurementLayer,u=n.length===2,{effectiveTheme:p}=this.view;u?(a=n.at(0),h=n.at(1)):(a=new D({symbol:new q({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[14,12],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",width:3.5,color:I(p.accentColor).toArray()},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:5,color:p.accentColor.toArray()}]}}})}),h=new D({symbol:new F({color:p.textColor,haloColor:E(I(p.textColor,J.Low),.5),haloSize:2,font:new K({size:14,family:"sans-serif"})})}),n.removeAll(),n.addMany([a,h])),a.geometry=r,h.geometry=(v=o.extent)==null?void 0:v.center,h.symbol.text=l}};function ge(e,t,r){const o=E(t.effectiveTheme.accentColor,.5),l={type:"simple-line",width:0},a=8,h=new R({style:"circle",color:o,size:a,outline:l}),n=new R({style:"circle",color:o,size:1.5*a,outline:l}),u=new D({geometry:e,symbol:h});return new ve({view:t,layer:r,graphic:u,focusedSymbol:n})}function _e(e,t,r){const o=new Q({paths:[e],spatialReference:t});let l,a;if(t.isGeographic)if(H(t))l=b([o],"meters")[0],a=M(o,g);else{const h=w(o,U.WGS84),n=M(h,g);l=b([h],"meters")[0],a=w(n,t)}else if(t.isWebMercator)l=X(o,"meters"),a=Y(o,g,"meters");else{const h=Z(o,"meters");if(h>=r){const n=w(o,U.WGS84),u=M(n,g);l=b([n],"meters")[0],a=w(u,t)}else l=h,a=o}return{measurement:{geometry:a,length:l},original:o,drawing:a}}function fe(e){return e!=null}function be(e){if(!e)return!1;const{isGeographic:t,isWebMercator:r,isWGS84:o}=e;return t&&!o&&!H(e)||!t&&!r}function Me(e,t,r){if(!t||!e)return"";switch(r){case"metric":return ie(e,t.length,"meters");case"imperial":return se(e,t.length,"meters");default:return ee(e,te(t.length,"meters",r),r)}}s([i()],m.prototype,"_drawActive",void 0),s([i({readOnly:!0})],m.prototype,"cursor",null),s([i({value:!0})],m.prototype,"editable",null),s([i({type:Number})],m.prototype,"geodesicDistanceThreshold",void 0),s([i({readOnly:!0})],m.prototype,"measurement",void 0),s([i({readOnly:!0})],m.prototype,"measurementLabel",void 0),s([i()],m.prototype,"messages",void 0),s([i()],m.prototype,"unit",void 0),s([i({constructOnly:!0})],m.prototype,"view",void 0),m=s([k("esri.widgets.DistanceMeasurement2D.DistanceMeasurement2DTool")],m);let d=class extends ye{constructor(e){super(e),this.supportedViewType="2d",this.unsupportedErrorMessage="DistanceMeasurement2DViewModel is only supported in 2D views.",this.geodesicDistanceThreshold=1e5}initialize(){this.addHandles([y(()=>{var e;return(e=this.view)==null?void 0:e.spatialReference},()=>this.clear()),y(()=>this.unit,e=>{this.tool!=null&&(this.tool.unit=e)},S),y(()=>this.geodesicDistanceThreshold,e=>{this.tool!=null&&(this.tool.geodesicDistanceThreshold=e)},S)])}get measurement(){return this.tool!=null?this.tool.measurement:null}get measurementLabel(){return this.tool!=null?this.tool.measurementLabel:null}get state(){var e;return this.disabled||this.view==null||!fe((e=this.view)==null?void 0:e.spatialReference)?"disabled":this.tool!=null&&this.measurement?this.tool.active?"measuring":"measured":"ready"}get unit(){return this._validateUnit(this.defaultUnit)}set unit(e){this._overrideIfSome("unit",this._validateUnit(e))}get unitOptions(){return L}set unitOptions(e){this._overrideIfSome("unitOptions",this._validateUnits(e))}async start(){const e=this.view;e!=null&&(await ne(()=>e.ready),be(e.spatialReference)&&await oe()),this.createTool({interactive:!0})}clear(){this.removeTool()}constructTool(){return new m({view:this.view,visible:this.visible,geodesicDistanceThreshold:this.geodesicDistanceThreshold,unit:this.unit})}_validateUnit(e){const{unitOptions:t,defaultUnit:r}=this;return e!=null&&t.includes(e)?e:t.includes(r)?r:t.length>0?t[0]:r}_validateUnits(e){if(e==null)return[];const t=e.filter(r=>L.includes(r));return t.length===0?L.slice():t}};s([i(re)],d.prototype,"defaultUnit",void 0),s([i({type:Number})],d.prototype,"geodesicDistanceThreshold",void 0),s([i({readOnly:!0})],d.prototype,"measurement",null),s([i({readOnly:!0})],d.prototype,"measurementLabel",null),s([i({readOnly:!0})],d.prototype,"state",null),s([i({type:String})],d.prototype,"unit",null),s([i({type:[String]})],d.prototype,"unitOptions",null),d=s([k("esri.widgets.DistanceMeasurement2D.DistanceMeasurement2DViewModel")],d);const N=d,P="esri-distance-measurement-2d",$={base:P,newMeasurementButton:`${P}__clear-button`,widgetIcon:he.measureLine};let c=class extends ae{constructor(e,t){super(e,t),this.iconClass=$.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.viewModel=new N}get active(){return this.viewModel.active}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){const{messages:e,messagesCommon:t,unit:r,unitOptions:o,viewModel:l}=this,{active:a,measurementLabel:h,state:n,supported:u}=l;return B("div",{"aria-label":this.messages.widgetLabel,class:this.classes($.base,z.widget,z.panel),key:this,role:"presentation"},this.visible?B(we,{active:a,measurementItems:[{key:"distance",title:e.distance,value:h}],messages:{...e,notApplicable:t.notApplicable},newMeasurementButtonClass:$.newMeasurementButton,state:n,supported:u,unit:r,unitOptions:o,onNewMeasurementClick:()=>{le(this.viewModel.start())},onUnitChange:p=>{this.unit=p}}):null)}};s([i({readOnly:!0})],c.prototype,"active",null),s([i()],c.prototype,"iconClass",void 0),s([i()],c.prototype,"icon",void 0),s([i()],c.prototype,"label",null),s([i()],c.prototype,"uiStrings",void 0),s([i(),G("esri/widgets/DistanceMeasurement2D/t9n/DistanceMeasurement2D")],c.prototype,"messages",void 0),s([i(),G("esri/t9n/common")],c.prototype,"messagesCommon",void 0),s([i()],c.prototype,"unit",null),s([i()],c.prototype,"unitOptions",null),s([i()],c.prototype,"view",null),s([i({type:N})],c.prototype,"viewModel",void 0),s([i({type:Boolean})],c.prototype,"visible",null),c=s([k("esri.widgets.DistanceMeasurement2D")],c);const ze=c;export{ze as default}; diff --git a/dist/assets/DistanceMeasurement2D-Ss5XZk94.js b/dist/assets/DistanceMeasurement2D-Ss5XZk94.js new file mode 100644 index 0000000..e154339 --- /dev/null +++ b/dist/assets/DistanceMeasurement2D-Ss5XZk94.js @@ -0,0 +1 @@ +import{e as s,y as i,c as k,G as T,kI as x,kJ as N,B as y,P as D,b as f,L as A,F,K as S,a1 as j,kL as R,aC as q,hR as z,kM as K,kK as J,x as I,E as Q,kN as E,kS as b,kO as M,dW as w,d2 as U,kT as X,kP as Y,kQ as Z,co as ee,hr as te,cw as se,cr as ie,kV as re,k_ as L,aa as ne,dV as oe,kX as G,hD as ae,hF as B,br as le,kY as P,kZ as he}from"./index-pCX-0tJH.js";import{l as ce}from"./Draw-yCejAdh-.js";import{l as ue,d as me,v as de,x as pe}from"./InteractiveToolBase-6mltmL27.js";import{S as ve}from"./GraphicManipulator-59Uc2I6c.js";import{n as ye,u as we}from"./MeasurementWidgetContent-PH9XFoV4.js";import"./SnappingVisualizer2D-JqQy3X5x.js";import"./SnappingContext-ax0tf6c6.js";import"./PointSnappingHint-bwlQAyn6.js";import"./EditGeometryOperations-vpHcsZOg.js";import"./SnappingOperation-hED0OM8D.js";import"./drawSurfaces-t1mGEx1r.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./SnappingDragPipelineStep-HDAWWRgo.js";import"./drawUtils-0wb2c6-q.js";import"./drapedUtils-F1ywqHD-.js";const g=1e5;let m=class extends ue{constructor(e){super(e),this._drawActive=!1,this._measurementLayer=new T({internal:!0,listMode:"hide",visible:!1}),this._manipulatorLayer=new T({internal:!0,listMode:"hide",visible:!1}),this._vertices=[],this.geodesicDistanceThreshold=1e5,this.measurement=null,this.measurementLabel=null}initialize(){x("esri/core/t9n/Units").then(t=>{this.messages=t}),this.addHandles(N(async()=>{this.messages=await x("esri/core/t9n/Units")}));const e=this.view;this._draw=new ce({view:e}),e.map.addMany([this._measurementLayer,this._manipulatorLayer]),e.focus(),this.addHandles([y(()=>[this.unit,this.geodesicDistanceThreshold,this.messages],()=>{this._updatePolylines()},D),y(()=>[this.view.effectiveTheme.accentColor,this.view.effectiveTheme.textColor],()=>{if(!this._vertices.length)return;const t=this._vertices.map(({coord:r})=>r);for(const{handle:r}of this._vertices)r.remove();this._vertices=[],this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this.manipulators.removeAll(),this._updateSketch(t)})])}destroy(){const{map:e}=this.view;this._draw.view=null,this._draw=f(this._draw),e.removeMany([this._measurementLayer,this._manipulatorLayer]),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._measurementLayer=f(this._measurementLayer),this._manipulatorLayer=f(this._manipulatorLayer),this._resetVertices()}get cursor(){return this._drawActive?"crosshair":null}set editable(e){this._set("editable",e),e||this._draw.reset()}onActivate(){this._drawActive||this._vertices.length!==0||this._startSketch()}onShow(){this._measurementLayer.visible=!0,this._manipulatorLayer.visible=!0}onHide(){this._measurementLayer.visible=!1,this._manipulatorLayer.visible=!1}_resetVertices(){for(const{handle:e}of this._vertices)e.remove();this._vertices=[]}_startSketch(){this._drawActive=!0;const e=this._draw.create("polyline",{mode:"click"});e.on(["vertex-add","vertex-update","vertex-remove","cursor-update","undo","redo"],t=>this._updateSketch(t.vertices)),e.on("draw-complete",()=>{this._stopSketch()})}_stopSketch(){this.manipulators.forEach(({manipulator:e})=>{e.interactive=!0}),this._drawActive=!1,this.finishToolCreation()}_updateSketch(e){const{spatialReference:t}=this.view;for(;this._vertices.length>e.length;){const{handle:n,manipulator:u}=this._vertices.pop();n.remove(),this.manipulators.remove(u)}for(let n=this._vertices.length;n{H.next(de(this.view)).next(pe(C.graphic,F.Local)).next(()=>{const O=C.graphic.geometry;this._vertices[n].coord=[O.x,O.y],this._updatePolylines()})});this._vertices.push({manipulator:v,coord:[u,p],handle:_})}const r=this._vertices.length-1,o=this._vertices[r],[l,a]=e[r];o.coord[0]===l&&o.coord[1]===a||(o.coord=[l,a],o.manipulator.graphic.geometry=new A({x:l,y:a,spatialReference:t}));const h=this._drawActive?this._vertices[r].manipulator:null;this.manipulators.forEach(({manipulator:n})=>{n.interactive=h==null||n!==h}),this._updatePolylines()}_updatePolylines(){var v;if(this._vertices.length<2)return void this._measurementLayer.removeAll();const e=this._vertices.map(({coord:_})=>_),{measurement:t,drawing:r,original:o}=_e(e,this.view.spatialReference,this.geodesicDistanceThreshold);this._set("measurement",t);const l=Me(this.messages,t,this.unit);let a,h;this._set("measurementLabel",l);const{graphics:n}=this._measurementLayer,u=n.length===2,{effectiveTheme:p}=this.view;u?(a=n.at(0),h=n.at(1)):(a=new S({symbol:new j({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[14,12],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",width:3.5,color:R(p.accentColor).toArray()},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:5,color:p.accentColor.toArray()}]}}})}),h=new S({symbol:new q({color:p.textColor,haloColor:z(R(p.textColor,K.Low),.5),haloSize:2,font:new J({size:14,family:"sans-serif"})})}),n.removeAll(),n.addMany([a,h])),a.geometry=r,h.geometry=(v=o.extent)==null?void 0:v.center,h.symbol.text=l}};function ge(e,t,r){const o=z(t.effectiveTheme.accentColor,.5),l={type:"simple-line",width:0},a=8,h=new I({style:"circle",color:o,size:a,outline:l}),n=new I({style:"circle",color:o,size:1.5*a,outline:l}),u=new S({geometry:e,symbol:h});return new ve({view:t,layer:r,graphic:u,focusedSymbol:n})}function _e(e,t,r){const o=new Q({paths:[e],spatialReference:t});let l,a;if(t.isGeographic)if(E(t))l=b([o],"meters")[0],a=M(o,g);else{const h=w(o,U.WGS84),n=M(h,g);l=b([h],"meters")[0],a=w(n,t)}else if(t.isWebMercator)l=X(o,"meters"),a=Y(o,g,"meters");else{const h=Z(o,"meters");if(h>=r){const n=w(o,U.WGS84),u=M(n,g);l=b([n],"meters")[0],a=w(u,t)}else l=h,a=o}return{measurement:{geometry:a,length:l},original:o,drawing:a}}function fe(e){return e!=null}function be(e){if(!e)return!1;const{isGeographic:t,isWebMercator:r,isWGS84:o}=e;return t&&!o&&!E(e)||!t&&!r}function Me(e,t,r){if(!t||!e)return"";switch(r){case"metric":return ie(e,t.length,"meters");case"imperial":return se(e,t.length,"meters");default:return ee(e,te(t.length,"meters",r),r)}}s([i()],m.prototype,"_drawActive",void 0),s([i({readOnly:!0})],m.prototype,"cursor",null),s([i({value:!0})],m.prototype,"editable",null),s([i({type:Number})],m.prototype,"geodesicDistanceThreshold",void 0),s([i({readOnly:!0})],m.prototype,"measurement",void 0),s([i({readOnly:!0})],m.prototype,"measurementLabel",void 0),s([i()],m.prototype,"messages",void 0),s([i()],m.prototype,"unit",void 0),s([i({constructOnly:!0})],m.prototype,"view",void 0),m=s([k("esri.widgets.DistanceMeasurement2D.DistanceMeasurement2DTool")],m);let d=class extends ye{constructor(e){super(e),this.supportedViewType="2d",this.unsupportedErrorMessage="DistanceMeasurement2DViewModel is only supported in 2D views.",this.geodesicDistanceThreshold=1e5}initialize(){this.addHandles([y(()=>{var e;return(e=this.view)==null?void 0:e.spatialReference},()=>this.clear()),y(()=>this.unit,e=>{this.tool!=null&&(this.tool.unit=e)},D),y(()=>this.geodesicDistanceThreshold,e=>{this.tool!=null&&(this.tool.geodesicDistanceThreshold=e)},D)])}get measurement(){return this.tool!=null?this.tool.measurement:null}get measurementLabel(){return this.tool!=null?this.tool.measurementLabel:null}get state(){var e;return this.disabled||this.view==null||!fe((e=this.view)==null?void 0:e.spatialReference)?"disabled":this.tool!=null&&this.measurement?this.tool.active?"measuring":"measured":"ready"}get unit(){return this._validateUnit(this.defaultUnit)}set unit(e){this._overrideIfSome("unit",this._validateUnit(e))}get unitOptions(){return L}set unitOptions(e){this._overrideIfSome("unitOptions",this._validateUnits(e))}async start(){const e=this.view;e!=null&&(await ne(()=>e.ready),be(e.spatialReference)&&await oe()),this.createTool({interactive:!0})}clear(){this.removeTool()}constructTool(){return new m({view:this.view,visible:this.visible,geodesicDistanceThreshold:this.geodesicDistanceThreshold,unit:this.unit})}_validateUnit(e){const{unitOptions:t,defaultUnit:r}=this;return e!=null&&t.includes(e)?e:t.includes(r)?r:t.length>0?t[0]:r}_validateUnits(e){if(e==null)return[];const t=e.filter(r=>L.includes(r));return t.length===0?L.slice():t}};s([i(re)],d.prototype,"defaultUnit",void 0),s([i({type:Number})],d.prototype,"geodesicDistanceThreshold",void 0),s([i({readOnly:!0})],d.prototype,"measurement",null),s([i({readOnly:!0})],d.prototype,"measurementLabel",null),s([i({readOnly:!0})],d.prototype,"state",null),s([i({type:String})],d.prototype,"unit",null),s([i({type:[String]})],d.prototype,"unitOptions",null),d=s([k("esri.widgets.DistanceMeasurement2D.DistanceMeasurement2DViewModel")],d);const W=d,V="esri-distance-measurement-2d",$={base:V,newMeasurementButton:`${V}__clear-button`,widgetIcon:he.measureLine};let c=class extends ae{constructor(e,t){super(e,t),this.iconClass=$.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.viewModel=new W}get active(){return this.viewModel.active}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){const{messages:e,messagesCommon:t,unit:r,unitOptions:o,viewModel:l}=this,{active:a,measurementLabel:h,state:n,supported:u}=l;return B("div",{"aria-label":this.messages.widgetLabel,class:this.classes($.base,P.widget,P.panel),key:this,role:"presentation"},this.visible?B(we,{active:a,measurementItems:[{key:"distance",title:e.distance,value:h}],messages:{...e,notApplicable:t.notApplicable},newMeasurementButtonClass:$.newMeasurementButton,state:n,supported:u,unit:r,unitOptions:o,onNewMeasurementClick:()=>{le(this.viewModel.start())},onUnitChange:p=>{this.unit=p}}):null)}};s([i({readOnly:!0})],c.prototype,"active",null),s([i()],c.prototype,"iconClass",void 0),s([i()],c.prototype,"icon",void 0),s([i()],c.prototype,"label",null),s([i()],c.prototype,"uiStrings",void 0),s([i(),G("esri/widgets/DistanceMeasurement2D/t9n/DistanceMeasurement2D")],c.prototype,"messages",void 0),s([i(),G("esri/t9n/common")],c.prototype,"messagesCommon",void 0),s([i()],c.prototype,"unit",null),s([i()],c.prototype,"unitOptions",null),s([i()],c.prototype,"view",null),s([i({type:W})],c.prototype,"viewModel",void 0),s([i({type:Boolean})],c.prototype,"visible",null),c=s([k("esri.widgets.DistanceMeasurement2D")],c);const Pe=c;export{Pe as default}; diff --git a/dist/assets/Draw-DYxsSuyr.js b/dist/assets/Draw-DYxsSuyr.js deleted file mode 100644 index 2944b25..0000000 --- a/dist/assets/Draw-DYxsSuyr.js +++ /dev/null @@ -1 +0,0 @@ -import{K as C,Q as U,O as b,n as y,bI as G,aR as S,bB as Z,ao as M,e as n,y as r,c as u,$ as s,kS as p,X as a,T as x,np as R,p as $}from"./index-J0iiHjMT.js";import{S as K}from"./SnappingVisualizer2D-NnEm1PvQ.js";import{w as z,V as A,p as E,l as D}from"./EditGeometryOperations-TPE5Wzab.js";import{e as F}from"./SnappingContext-6K6JmvvY.js";import{p as N}from"./SnappingOperation-2U48wt1k.js";import{k as B,o as Y,r as Q,c as k,e as I,F as X}from"./surfaceCoordinateSystems-siQq4eBA.js";import{l as j}from"./InteractiveToolBase-WDic4GPF.js";var P;let l=P=class extends C.EventedAccessor{constructor(e){super(e),this._hasZ=null,this._cursorScreenPoint=null,this._activePointerId=null,this._stagedVertexUnsnapped=null,this._lastVertexUnsnapped=null,this._viewHandlesKey="view-handles",this._undoRedoHandlesKey="undo-redo-handles",this._drawToolHandlesKey="draw-tool",this._nativeEventHistory={undoStack:[],redoStack:[]},this.interactiveUndoDisabled=!1,this.history=[],this.redoHistory=[],this.snapToScene=!1,this.view=null,this.elevationInfo=null,this.defaultZ=0,this._coordinateHelper=z(!!e.hasZ,!1,e.view.spatialReference),this._snappingManager=e.snappingManager,this._editGeometryOperations=new A(new E(e.editGeometryType??"polygon",this._coordinateHelper)),this._snappingGraphicsLayer=new U({id:P.SNAPPING_GRAPHICS_LAYER_ID,listMode:"hide",internal:!0}),this._snappingContext=new F({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:"mouse",visualizer:new K(this._snappingGraphicsLayer)}),this._activeComponent=new D(e.view.spatialReference,b.Local),this._editGeometryOperations.data.components.push(this._activeComponent)}normalizeCtorArgs(e){const t={...e};return delete t.editGeometryType,t}initialize(){this._snappingOperation=new N({view:this.view}),this.view.type==="2d"&&this.view.map.layers.add(this._snappingGraphicsLayer)}destroy(){this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy(),this._snappingManager!=null&&this._snappingManager.doneSnapping(),this._snappingOperation=y(this._snappingOperation),this._editGeometryOperations.destroy()}get _committedVertices(){return this._editGeometryOperations.data.components[0].vertices.map(e=>e.pos)}get vertices(){return this._stagedVertex!=null?[...this._committedVertices,this._coordinateHelper.pointToArray(this._stagedVertex)]:this._committedVertices}get hasZ(){return this._hasZ!=null?this._hasZ:this.view.type==="3d"}set hasZ(e){this._hasZ=e,this.notifyChange("hasZ")}get _stagedVertex(){return this._snappingOperation.stagedPoint}set _stagedVertex(e){this._snappingOperation.stagedPoint=G(e)}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this.canUndo&&this._editGeometryOperations.undo()}redo(){this.canRedo&&this._editGeometryOperations.redo()}getCoordsFromScreenPoint(e){const t=e&&this.screenToMap(e);return t==null?null:t.hasZ?[t.x,t.y,t.z]:[t.x,t.y]}getCoordsAndPointFromScreenPoint(e){const t=this.screenToMap(e);return t==null?null:t.hasZ?{vertex:[t.x,t.y,t.z],mapPoint:t}:{vertex:[t.x,t.y],mapPoint:t}}screenToMap(e){let t=null;if(this.view.type==="3d")if(this.hasZ){const i=this.elevationInfo??q;t=this.view.sceneIntersectionHelper.intersectElevationFromScreen(S(e.x,e.y),i,this._getGeometryZValue())}else{const i=this.elevationInfo??J;t=this.view.sceneIntersectionHelper.intersectElevationFromScreen(S(e.x,e.y),i,0),t!=null&&(t.z=void 0)}else t=this.view.toMap(e),t!=null&&(t.z=this.hasZ?this._getGeometryZValue():void 0);return t}_pushCursorVertex(e,t){const i=Z(e[0],e[1],void 0,this.view.spatialReference);this._stagedVertexUnsnapped=i;const o=this._snappingManager;if(o==null)return this._stagedVertex=i,void t();M(this._snappingOperation.snap({point:i},o,this._snappingContext)).then(()=>{t()})}_popCursorVertex(){this._stagedVertexUnsnapped=null,this._stagedVertex=null}_getGeometryZValue(){return this.defaultZ}_abortSnapping(){this._snappingOperation.abort()}_isDuplicateOfLastVertex(e){var d;const t=(d=this._editGeometryOperations.data.components[0].getLastVertex())==null?void 0:d.pos;if(t&&e[0]===t[0]&&e[1]===t[1])return!0;const{x:i,y:o}=this._coordinateHelper.vectorToDehydratedPoint(e);return this._lastVertexUnsnapped!=null&&i===this._lastVertexUnsnapped.x&&o===this._lastVertexUnsnapped.y}_shouldHandlePointerEvent(e){return this._isPrimaryPointerAction(e)&&(this._activePointerId==null||this._activePointerId===e.pointerId)}_vertexAddHandler(e){const t=this._stagedVertex!=null?this._coordinateHelper.pointToArray(this._stagedVertex):this.getCoordsFromScreenPoint(this._cursorScreenPoint);t!=null&&this._addVertex(t,e.native)}_drawCompleteHandler(e){this._completeDrawing(e.native)}_isPrimaryPointerAction(e){return e.pointerType!=="mouse"||e.button===0}};l.SNAPPING_GRAPHICS_LAYER_ID="DrawAction-snapping-graphics-layer",n([r({readOnly:!0})],l.prototype,"vertices",null),n([r({type:Boolean,nonNullable:!0})],l.prototype,"interactiveUndoDisabled",void 0),n([r({readOnly:!0})],l.prototype,"history",void 0),n([r({readOnly:!0})],l.prototype,"redoHistory",void 0),n([r()],l.prototype,"snapToScene",void 0),n([r()],l.prototype,"view",void 0),n([r()],l.prototype,"elevationInfo",void 0),n([r({nonNullable:!0})],l.prototype,"defaultZ",void 0),n([r()],l.prototype,"hasZ",null),n([r()],l.prototype,"_snappingOperation",void 0),n([r()],l.prototype,"_stagedVertex",null),l=P=n([u("esri.views.draw.DrawAction")],l);const q={mode:"absolute-height",offset:0},J={mode:"on-the-ground",offset:0},O=l;class c{constructor(t,i,o,d){this.view=t,this.native=i,this.vertexIndex=o,this.vertices=d,this.defaultPrevented=!1,this.type="vertex-add"}preventDefault(){this.defaultPrevented=!0}}class f{constructor(t,i,o,d){this.view=t,this.native=i,this.vertexIndex=o,this.vertices=d,this.defaultPrevented=!1,this.type="vertex-remove"}preventDefault(){this.defaultPrevented=!0}}class _{constructor(t,i,o,d,L=null){this.view=t,this.native=i,this.vertexIndex=o,this.vertices=d,this.mapPoint=L,this.coordinates=null,this.defaultPrevented=!1,this.type="cursor-update",this.coordinates=d.length===1?d[0]:null}preventDefault(){this.defaultPrevented=!0}}class v{constructor(t,i){this.native=t,this.vertices=i,this.coordinates=null,this.defaultPrevented=!1,this.type="draw-complete",this.coordinates=i.length===1?i[0]:null}preventDefault(){this.defaultPrevented=!0}}let V=class extends O{constructor(e){super(e),this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1}initialize(){this._addViewHandles(),this._addUndoRedoHandles()}destroy(){this._removeViewHandles(),this._removeUndoRedoHandles(),this.emit("destroy")}undo(){super.undo(),this.notifyChange("vertices")}redo(){super.redo(),this.notifyChange("vertices")}complete(){this._completeDrawing()}_addViewHandles(){this._removeViewHandles(),this.addHandles([this.view.on("click",e=>{e.stopPropagation()},s.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(e),e.pointerType==="touch"&&this._updateCursor(e.native))},s.TOOL),this.view.on("pointer-move",e=>{this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._abortSnapping(),this._cursorScreenPoint=p(e),e.pointerType!=="touch"&&this._updateCursor(e.native)},s.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._addVertexOnPointerUp=!1)},s.TOOL),this.view.on("pointer-up",e=>{if(this._shouldHandlePointerEvent(e))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp)this._vertexAddHandler(e);else{const t=e.pointerType==="touch";this._updateCursor(e.native,t)}},s.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},s.TOOL),this.view.on("double-click",e=>{e.stopPropagation(),this._drawCompleteHandler(e)},s.TOOL),this.view.on("double-click",["Control"],e=>{e.stopPropagation(),this._drawCompleteHandler(e)},s.TOOL),this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t===a.vertexAdd&&!i&&this._cursorScreenPoint?(e.stopPropagation(),this._abortSnapping(),this._vertexAddHandler(e)):t!==a.complete||i?t!==a.undo||this.interactiveUndoDisabled||i?t!==a.redo||this.interactiveUndoDisabled||i?t!==a.pan||i||e.stopPropagation():(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e))},s.TOOL),this.view.on("key-up",e=>{e.key===a.pan&&e.stopPropagation()},s.TOOL)],this._viewHandlesKey)}_addUndoRedoHandles(){this._removeUndoRedoHandles(),this.addHandles([this._editGeometryOperations.on("vertex-remove",e=>{if(this.notifyChange("vertices"),e.operation==="undo"){const t=this._nativeEventHistory.undoStack.pop();this._nativeEventHistory.redoStack.push(t);const i=[...this._committedVertices];this._stagedVertex!=null&&i.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new f(this.view,t,e.vertices[0].index,i))}}),this._editGeometryOperations.on("vertex-add",e=>{if(this.notifyChange("vertices"),e.operation==="apply"){const t=this._nativeEventHistory.undoStack[this._nativeEventHistory.undoStack.length],i=this._committedVertices.length-1,o=new c(this.view,t,i,this.vertices);this.emit("vertex-add",o),o.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if(e.operation==="redo"){const t=this._nativeEventHistory.redoStack.pop();this._nativeEventHistory.undoStack.push(t);const i=[...this._committedVertices];this._stagedVertex!=null&&i.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new c(this.view,t,e.vertices[0].index,i))}})],this._undoRedoHandlesKey)}_removeViewHandles(){this.removeHandles(this._viewHandlesKey)}_removeUndoRedoHandles(){this.removeHandles(this._undoRedoHandlesKey)}_addVertex(e,t){const i=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(i))return;this._popCursorVertex(),this._editGeometryOperations.appendVertex(i);const o=t||new Event("placeholder");this._nativeEventHistory.undoStack.push(o)}_updateCursor(e,t=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const i=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);i==null||t||this._pushCursorVertex(i.vertex,()=>this.emit("cursor-update",new _(this.view,e,this._activeComponent.vertices.length,this.vertices,this._stagedVertex!=null?new x(this._stagedVertex):null)))}_completeDrawing(e){if(this._activePointerId=null,this._popCursorVertex(),this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;const t=new v(e,this.vertices);this.emit("draw-complete",t),t.defaultPrevented||this._removeViewHandles()}};V=n([u("esri.views.draw.MultipointDrawAction")],V);let h=class extends C.EventedMixin(j){constructor(t){super(t),this.defaultZ=0,this.elevationInfo=null,this.hasZ=!0,this.mode=null,this.snapToScene=null,this.type="draw-3d"}initialize(){const t=this.view,i=R(this.hasZ,this.elevationInfo);this.drawOperation=new B({view:t,manipulators:this.manipulators,geometryType:this.geometryType,drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:t.type==="3d"?new Y(t,i):null,elevationDrawSurface:t.type==="3d"?new Q(i,this.defaultZ,t):null,hasM:!1,elevationInfo:i}),this.addHandles([this.drawOperation.on("vertex-add",o=>this.onVertexAdd(o)),this.drawOperation.on("vertex-remove",o=>this.onVertexRemove(o)),this.drawOperation.on("vertex-update",o=>this.onVertexUpdate(o)),this.drawOperation.on("cursor-update",o=>this.onCursorUpdate(o)),this.drawOperation.on("complete",o=>this.onComplete(o))]),this.finishToolCreation()}destroy(){this.drawOperation=y(this.drawOperation),this._set("view",null)}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set enabled(t){this.drawOperation.interactive=t,this._set("enabled",t)}get updating(){var t;return((t=this.drawOperation)==null?void 0:t.updating)??!1}completeCreateOperation(){this.drawOperation.complete()}onDeactivate(){this.drawOperation.isCompleted||this.drawOperation.cancel()}getVertexCoords(){return this.drawOperation.vertices}onInputEvent(t){this.drawOperation.onInputEvent(t)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo()}onComplete(t){this.emit("complete",t)}onCursorUpdate(t){this.emit("cursor-update",t)}onVertexAdd(t){this.emit("vertex-add",t)}onVertexRemove(t){this.emit("vertex-remove",t)}onVertexUpdate(t){this.emit("vertex-update",t)}};n([r({constructOnly:!0,nonNullable:!0})],h.prototype,"defaultZ",void 0),n([r()],h.prototype,"drawOperation",void 0),n([r({constructOnly:!0})],h.prototype,"elevationInfo",void 0),n([r({value:!0})],h.prototype,"enabled",null),n([r({constructOnly:!0})],h.prototype,"geometryType",void 0),n([r({constructOnly:!0})],h.prototype,"hasZ",void 0),n([r({constructOnly:!0})],h.prototype,"mode",void 0),n([r()],h.prototype,"snapToScene",void 0),n([r({readOnly:!0})],h.prototype,"type",void 0),n([r({readOnly:!0})],h.prototype,"updating",null),n([r({constructOnly:!0,nonNullable:!0})],h.prototype,"view",void 0),h=n([u("esri.views.draw.DrawTool")],h);let T=class extends O{constructor(t){super(t),this._addVertexOnPointerUp=!1}initialize(){this.view.type==="2d"?this._addViewHandles():this._addDrawTool()}destroy(){this.view.type==="2d"?this._removeViewHandles():this._removeDrawTool(),this.emit("destroy")}complete(){this.view.type==="2d"?this._cursorScreenPoint&&this._completeDrawing():this._drawTool.completeCreateOperation()}_addViewHandles(){this._removeViewHandles(),this.addHandles([this.view.on("pointer-down",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._activePointerId=t.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(t),t.pointerType==="touch"&&this._updateCursor(t.native))},s.TOOL),this.view.on("pointer-move",t=>{this._abortSnapping(),this._cursorScreenPoint=p(t),t.pointerType!=="touch"&&this._updateCursor(t.native)},s.TOOL),this.view.on("pointer-drag",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._addVertexOnPointerUp=!1)},s.TOOL),this.view.on("pointer-up",t=>{if(this._shouldHandlePointerEvent(t))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp)t.stopPropagation(),this._vertexAddHandler(t);else{const i=t.pointerType==="touch";this._updateCursor(t.native,i)}},s.TOOL),this.view.on("drag",["Shift"],t=>{t.stopPropagation()},s.TOOL),this.view.on("key-down",t=>{t.key===a.complete&&this._cursorScreenPoint&&(this._abortSnapping(),this._vertexAddHandler(t))},s.TOOL)],this._viewHandlesKey)}_removeViewHandles(){this.removeHandles(this._viewHandlesKey)}_addDrawTool(){this._drawTool=new h({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"point",mode:"click"}),this.view.addAndActivateTool(this._drawTool),this.addHandles([this._drawTool.on("cursor-update",t=>{t.vertices.length===1&&this.emit("cursor-update",new _(this.view,null,t.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("complete",t=>{this.emit("draw-complete",new v(null,this._drawTool.getVertexCoords())),this._removeDrawTool()})],this._drawToolHandlesKey)}_removeDrawTool(){this.removeHandles(this._drawToolHandlesKey),this.view.tools.remove(this._drawTool),this._drawTool=null}_addVertex(t){const i=this._coordinateHelper.arrayToVector(t);this._isDuplicateOfLastVertex(i)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(i),this.notifyChange("vertices"),this._completeDrawing())}_updateCursor(t,i=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const o=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);o==null||i||this._pushCursorVertex(o.vertex,()=>this.emit("cursor-update",new _(this.view,t,this._activeComponent.vertices.length,this.vertices,this._stagedVertex!=null?new x(this._stagedVertex):null)))}_completeDrawing(t){this._activePointerId=null,this._popCursorVertex(),this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping();const i=new v(t,this.vertices);this.emit("draw-complete",i),i.defaultPrevented||this._removeViewHandles()}};T=n([u("esri.views.draw.PointDrawAction")],T);let w=class extends O{constructor(t){super(t),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this.mode=I}initialize(){this.view.type==="2d"?(this._addViewHandles(),this._addUndoRedoHandles()):this._addDrawTool()}destroy(){this.view.type==="2d"?(this._removeViewHandles(),this._removeUndoRedoHandles()):this._removeDrawTool(),this.emit("destroy")}get _dragEnabled(){return this.mode==="freehand"||this.mode==="hybrid"}get _clickEnabled(){return this.mode==="click"||this.mode==="hybrid"}undo(){super.undo(),this.notifyChange("vertices")}redo(){super.redo(),this.notifyChange("vertices")}complete(){this.view.type==="2d"?this._completeDrawing():this._drawTool.completeCreateOperation()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this._removeViewHandles(),this.addHandles([this.view.on("click",t=>{t.stopPropagation()},s.TOOL),this.view.on("pointer-down",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._activePointerId=t.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(t),t.pointerType==="touch"&&this._updateCursor(t.native))},s.TOOL),this.view.on("pointer-move",t=>{this._abortSnapping(),this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._cursorScreenPoint=p(t),t.pointerType!=="touch"&&this._updateCursor(t.native)},s.TOOL),this.view.on("pointer-drag",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._cursorScreenPoint=p(t),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(t):this._addVertexOnPointerUp=!1)},s.TOOL),this.view.on("pointer-up",t=>{if(this._shouldHandlePointerEvent(t))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp){if(!this._clickEnabled)return this.vertices.length===1&&this.vertices.pop(),void this._drawCompleteHandler(t);this._vertexAddHandler(t)}else{const i=t.pointerType==="touch";this._updateCursor(t.native,i)}},s.TOOL),this.view.on("drag",t=>{this._dragEnabled&&this._activePointerId!=null&&!this._panEnabled&&t.stopPropagation()},s.TOOL),this.view.on("drag",["Shift"],t=>{t.stopPropagation()},s.TOOL),this.view.on("double-click",t=>{t.stopPropagation(),this._drawCompleteHandler(t)},s.TOOL),this.view.on("double-click",["Control"],t=>{t.stopPropagation(),this._drawCompleteHandler(t)},s.TOOL),this.view.on("key-down",t=>{const{key:i,repeat:o}=t;i===a.vertexAdd&&!o&&this._cursorScreenPoint?(t.stopPropagation(),this._abortSnapping(),this._vertexAddHandler(t)):i!==a.complete||o?i!==a.undo||this.interactiveUndoDisabled||o?i!==a.redo||this.interactiveUndoDisabled||o?i!==a.pan||o||(t.stopPropagation(),this._panEnabled=!0):(t.stopPropagation(),this.redo()):(t.stopPropagation(),this.undo()):(t.stopPropagation(),this._drawCompleteHandler(t))},s.TOOL),this.view.on("key-up",t=>{t.key===a.pan&&(t.stopPropagation(),this._panEnabled=!1)},s.TOOL)],this._viewHandlesKey)}_addUndoRedoHandles(){this._removeUndoRedoHandles(),this.addHandles([this._editGeometryOperations.on("vertex-remove",t=>{if(this.notifyChange("vertices"),t.operation==="undo"){const i=this._nativeEventHistory.undoStack.pop();this._nativeEventHistory.redoStack.push(i);const o=[...this._committedVertices];this._stagedVertex!=null&&o.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new f(this.view,i,t.vertices[0].index,o))}}),this._editGeometryOperations.on("vertex-add",t=>{if(this.notifyChange("vertices"),t.operation==="apply"){const i=this._nativeEventHistory.undoStack[this._nativeEventHistory.undoStack.length],o=this._committedVertices.length-1,d=new c(this.view,i,o,this.vertices);this.emit("vertex-add",d),d.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if(t.operation==="redo"){const i=this._nativeEventHistory.redoStack.pop();this._nativeEventHistory.undoStack.push(i);const o=[...this._committedVertices];this._stagedVertex!=null&&o.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new c(this.view,i,t.vertices[0].index,o))}})],this._undoRedoHandlesKey)}_removeViewHandles(){this.removeHandles(this._viewHandlesKey)}_removeUndoRedoHandles(){this.removeHandles(this._undoRedoHandlesKey)}_addDrawTool(){this._drawTool=new h({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polygon",mode:this.mode}),this.view.addAndActivateTool(this._drawTool),this._drawTool.on("vertex-add",t=>{t.vertices.length===1&&this.emit("vertex-add",new c(this.view,null,t.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("cursor-update",t=>{t.vertices.length===1&&this.emit("cursor-update",new _(this.view,null,t.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("complete",t=>{this.emit("draw-complete",new v(null,this._drawTool.getVertexCoords())),this._removeDrawTool()})}_removeDrawTool(){this.removeHandles(this._drawToolHandlesKey),this.view.tools.remove(this._drawTool),this._drawTool=y(this._drawTool)}_addVertex(t,i){const o=this._coordinateHelper.arrayToVector(t);if(this._isDuplicateOfLastVertex(o))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(o);const d=i||new Event("placeholder");this._nativeEventHistory.undoStack.push(d)}_updateCursor(t,i=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const o=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);o==null||i||this._pushCursorVertex(o.vertex,()=>this.emit("cursor-update",new _(this.view,t,this._activeComponent.vertices.length,this.vertices,this._stagedVertex!=null?new x(this._stagedVertex):null)))}_completeDrawing(t){if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<3)return;this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping();const i=new v(t,this.vertices);this.emit("draw-complete",i),i.defaultPrevented||this._removeViewHandles()}};n([r()],w.prototype,"_dragEnabled",null),n([r()],w.prototype,"_clickEnabled",null),n([r({type:k})],w.prototype,"mode",void 0),w=n([u("esri.views.draw.PolygonDrawAction")],w);let g=class extends O{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this.mode=I}initialize(){this.view.type==="2d"?(this._addViewHandles(),this._addUndoRedoHandles()):this._addDrawTool()}destroy(){this.view.type==="2d"?(this._removeViewHandles(),this._removeUndoRedoHandles()):this._removeDrawTool(),this.emit("destroy")}get _clickEnabled(){return this.mode==="click"||this.mode==="hybrid"}get _dragEnabled(){return this.mode==="freehand"||this.mode==="hybrid"}undo(){super.undo(),this.notifyChange("vertices")}redo(){super.redo(),this.notifyChange("vertices")}complete(){this.view.type==="2d"?this._completeDrawing():this._drawTool.completeCreateOperation()}_addViewHandles(){this._removeViewHandles(),this.addHandles([this.view.on("click",e=>{e.stopPropagation()},s.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&!this._panEnabled&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(e),e.pointerType==="touch"&&this._updateCursor(e.native))},s.TOOL),this.view.on("pointer-move",e=>{this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._abortSnapping(),this._cursorScreenPoint=p(e),e.pointerType!=="touch"&&this._updateCursor(e.native)},s.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=p(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)},s.TOOL),this.view.on("pointer-up",e=>{if(this._shouldHandlePointerEvent(e))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp){if(!this._clickEnabled)return this.vertices.length===1&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}else{const t=e.pointerType==="touch";this._updateCursor(e.native,t)}},s.TOOL),this.view.on("drag",e=>{this._dragEnabled&&this._activePointerId!=null&&!this._panEnabled&&e.stopPropagation()},s.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},s.TOOL),this.view.on("double-click",e=>{e.stopPropagation(),this._drawCompleteHandler(e)},s.TOOL),this.view.on("double-click",["Control"],e=>{e.stopPropagation(),this._drawCompleteHandler(e)},s.TOOL),this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t===a.vertexAdd&&!i&&this._cursorScreenPoint?(e.stopPropagation(),this._abortSnapping(),this._vertexAddHandler(e)):t!==a.complete||i?t!==a.undo||this.interactiveUndoDisabled||i?t!==a.redo||this.interactiveUndoDisabled||i?t!==a.pan||i||(e.stopPropagation(),this._panEnabled=!0):(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e))},s.TOOL),this.view.on("key-up",e=>{e.key===a.pan&&(e.stopPropagation(),this._panEnabled=!1)},s.TOOL)],this._viewHandlesKey)}_addUndoRedoHandles(){this._removeUndoRedoHandles(),this.addHandles([this._editGeometryOperations.on("vertex-remove",e=>{if(this.notifyChange("vertices"),e.operation==="undo"){const t=this._nativeEventHistory.undoStack.pop();this._nativeEventHistory.redoStack.push(t);const i=[...this._committedVertices];this._stagedVertex!=null&&i.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new f(this.view,t,e.vertices[0].index,i))}}),this._editGeometryOperations.on("vertex-add",e=>{if(this.notifyChange("vertices"),e.operation==="apply"){const t=this._nativeEventHistory.undoStack[this._nativeEventHistory.undoStack.length],i=this._committedVertices.length-1,o=new c(this.view,t,i,this.vertices);this.emit("vertex-add",o),o.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if(e.operation==="redo"){const t=this._nativeEventHistory.redoStack.pop();this._nativeEventHistory.undoStack.push(t);const i=[...this._committedVertices];this._stagedVertex!=null&&i.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new c(this.view,t,e.vertices[0].index,i))}})],this._undoRedoHandlesKey)}_removeViewHandles(){this.removeHandles(this._viewHandlesKey)}_removeUndoRedoHandles(){this.removeHandles(this._undoRedoHandlesKey)}_addDrawTool(){this._drawTool=new h({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polyline",mode:this.mode}),this.view.addAndActivateTool(this._drawTool),this.addHandles([this._drawTool.on("vertex-add",e=>{e.vertices.length===1&&this.emit("vertex-add",new c(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("cursor-update",e=>{e.vertices.length===1&&this.emit("cursor-update",new _(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("complete",e=>{this.emit("draw-complete",new v(null,this._drawTool.getVertexCoords())),this._removeDrawTool()})],this._drawToolHandlesKey)}_removeDrawTool(){this.removeHandles(this._drawToolHandlesKey),this.view.tools.remove(this._drawTool),this._drawTool=y(this._drawTool)}_addVertex(e,t){const i=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(i))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(i);const o=t||new Event("placeholder");this._nativeEventHistory.undoStack.push(o)}_updateCursor(e,t=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const i=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);i==null||t||this._pushCursorVertex(i.vertex,()=>this.emit("cursor-update",new _(this.view,e,this._activeComponent.vertices.length,this.vertices,this._stagedVertex!=null?new x(this._stagedVertex):null)))}_completeDrawing(e){if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<2)return;this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping();const t=new v(e,this.vertices);this.emit("draw-complete",t),t.defaultPrevented||this._removeViewHandles()}};n([r()],g.prototype,"_clickEnabled",null),n([r()],g.prototype,"_dragEnabled",null),n([r({type:k})],g.prototype,"mode",void 0),g=n([u("esri.views.draw.PolylineDrawAction")],g);const W=["freehand","click"];let H=class extends O{constructor(e){super(e),this._isDragging=!1,this._panEnabled=!1,this._addVertexOnPointerUp=!1,this.viewAlignedCoordinateSystem=null,this.mode="freehand"}initialize(){this.view.type==="2d"?this._addViewHandles():this._addDrawTool()}destroy(){this.view.type==="2d"?this._removeViewHandles():this._removeDrawTool(),this.emit("destroy")}complete(){this.view.type==="2d"?this._completeDrawing():this._drawTool.completeCreateOperation()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this._removeViewHandles(),this.mode==="click"?this.addHandles(this._getClickModeViewHandles(),this._viewHandlesKey):this.addHandles(this._getDragModeViewHandles(),this._viewHandlesKey)}_getDragModeViewHandles(){return[this.view.on("immediate-click",e=>{e.stopPropagation(),e.mapPoint&&!this._panEnabled&&this.getCoordsFromScreenPoint(p(e))!=null&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},s.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._panEnabled||(this._resetGeometry(),this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(e),this._activePointerId=e.pointerId,this._vertexAddHandler(e),this._isDragging=!1,e.pointerType==="touch"&&this._updateCursor(e.native)))},s.TOOL),this.view.on("pointer-move",e=>{this._abortSnapping(),this._activePointerId==null&&e.pointerType!=="touch"&&(this._cursorScreenPoint=p(e),this._updateCursor(e.native))},s.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0,this._cursorScreenPoint=p(e),this._updateCursor(e.native))},s.TOOL),this.view.on("pointer-up",e=>{this._shouldHandlePointerEvent(e)&&this._addVertexOnPointerUp&&(this._abortSnapping(),this._activePointerId=null,this._isDragging&&this._vertexAddHandler(e),this._committedVertices.length===2&&this._drawCompleteHandler(e),this._isDragging=!1)},s.TOOL),this.view.on("key-down",e=>{e.key===a.complete&&this._cursorScreenPoint?(this._abortSnapping(),this._vertexAddHandler(e),this._drawCompleteHandler(e)):e.key===a.pan&&(this._panEnabled=!0)},s.TOOL),this.view.on("key-up",e=>{e.key===a.pan&&(this._panEnabled=!1)},s.TOOL),this.view.on("drag",e=>{this._activePointerId!=null&&e.stopPropagation()},s.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},s.TOOL)]}_getClickModeViewHandles(){return[this.view.on("pointer-down",e=>{this._abortSnapping(),this._cursorScreenPoint=p(e),this._activePointerId=e.pointerId,this._isDragging=!1,e.pointerType==="touch"&&this._updateCursor(e.native)},s.TOOL),this.view.on("pointer-move",e=>{this._abortSnapping(),this._cursorScreenPoint=p(e),this._activePointerId==null&&e.pointerType!=="touch"&&this._updateCursor(e.native)},s.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0)},s.TOOL),this.view.on("pointer-up",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=null,e.stopPropagation(),this._isDragging||this._vertexAddHandler(e),this.vertices.length!==2||this._isDragging||this._drawCompleteHandler(e),this._isDragging=!1)},s.TOOL),this.view.on("key-down",e=>{e.key===a.vertexAdd&&this._cursorScreenPoint&&(this._vertexAddHandler(e),this.vertices.length===2&&this._drawCompleteHandler(e)),e.key===a.complete&&this._cursorScreenPoint&&this.vertices.length===2&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},s.TOOL)]}_removeViewHandles(){this.removeHandles(this._viewHandlesKey)}_addDrawTool(){this._drawTool=new h({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"segment",mode:this.mode}),this.view.addAndActivateTool(this._drawTool),this.addHandles([this._drawTool.on("vertex-add",e=>{e.vertices.length===1&&this.emit("vertex-add",new c(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("cursor-update",e=>{e.vertices.length===1&&this.emit("cursor-update",new _(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("complete",e=>{this.emit("draw-complete",new v(null,this._drawTool.getVertexCoords())),this._removeDrawTool()})],this._drawToolHandlesKey)}_removeDrawTool(){this.removeHandles(this._drawToolHandlesKey),this.view.tools.remove(this._drawTool),this._drawTool=y(this._drawTool)}_addVertex(e,t){const i=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(i))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(i),this._committedVertices.length===1&&(this.viewAlignedCoordinateSystem=X(this.view,this._committedVertices[0]));const o=this._committedVertices.length-1,d=new c(this.view,t,o,this.vertices);this.emit("vertex-add",d)}_updateCursor(e){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);t!=null&&this._pushCursorVertex(t.vertex,()=>this.emit("cursor-update",new _(this.view,e,this._activeComponent.vertices.length,this.vertices,this._stagedVertex!=null?new x(this._stagedVertex):null)))}_completeDrawing(e){if(this._activePointerId=null,this._popCursorVertex(),this._cursorScreenPoint=null,this._isDragging=!1,this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;const t=new v(e,this.vertices);this.emit("draw-complete",t),t.defaultPrevented||this._removeViewHandles()}_resetGeometry(){this._editGeometryOperations.destroy(),this._editGeometryOperations=new A(new E("polygon",this._coordinateHelper)),this._activeComponent=new D(this._coordinateHelper.spatialReference,b.Local),this._editGeometryOperations.data.components.push(this._activeComponent)}};n([r({type:W})],H.prototype,"mode",void 0),H=n([u("esri/views/2d/engine/markup/SegmentDrawAction")],H);let m=class extends ${constructor(){super(...arguments),this.activeAction=null,this.type="draw",this.view=null}destroy(){this.activeAction&&(this.activeAction.destroy(),this.activeAction=null)}create(e,t){this.reset();const i={view:this.view,...t};switch(e){case"point":i.editGeometryType="point",this.activeAction=new T(i);break;case"polyline":i.editGeometryType="polyline",this.activeAction=new g(i);break;case"multipoint":i.editGeometryType="polygon",this.activeAction=new V(i);break;case"polygon":i.editGeometryType="polygon",this.activeAction=new w(i);break;case"rectangle":case"circle":case"ellipse":case"triangle":i.editGeometryType="polygon",this.activeAction=new H(i)}return this.activeAction}complete(){this.activeAction&&this.activeAction.complete(),this.activeAction=null}reset(){this.activeAction&&this.activeAction.destroy(),this.activeAction=null}};n([r()],m.prototype,"activeAction",void 0),n([r({readOnly:!0})],m.prototype,"type",void 0),n([r()],m.prototype,"view",void 0),m=n([u("esri.views.draw.Draw")],m);const pe=m;export{pe as l}; diff --git a/dist/assets/Draw-yCejAdh-.js b/dist/assets/Draw-yCejAdh-.js new file mode 100644 index 0000000..847db6d --- /dev/null +++ b/dist/assets/Draw-yCejAdh-.js @@ -0,0 +1 @@ +import{z as C,G as U,F as b,b as y,ah as G,c3 as S,bU as Z,br as M,e as n,y as r,c as u,_ as s,kH as p,O as a,L as x,nA as R,g as $}from"./index-pCX-0tJH.js";import{S as K}from"./SnappingVisualizer2D-JqQy3X5x.js";import{w as z,V as A,p as E,l as D}from"./EditGeometryOperations-vpHcsZOg.js";import{e as F}from"./SnappingContext-ax0tf6c6.js";import{p as N}from"./SnappingOperation-hED0OM8D.js";import{k as Y,o as B,r as j,c as k,e as I,F as q}from"./drawSurfaces-t1mGEx1r.js";import{l as J}from"./InteractiveToolBase-6mltmL27.js";var P;let l=P=class extends C.EventedAccessor{constructor(e){super(e),this._hasZ=null,this._cursorScreenPoint=null,this._activePointerId=null,this._stagedVertexUnsnapped=null,this._lastVertexUnsnapped=null,this._viewHandlesKey="view-handles",this._undoRedoHandlesKey="undo-redo-handles",this._drawToolHandlesKey="draw-tool",this._nativeEventHistory={undoStack:[],redoStack:[]},this.interactiveUndoDisabled=!1,this.history=[],this.redoHistory=[],this.snapToScene=!1,this.view=null,this.elevationInfo=null,this.defaultZ=0,this._coordinateHelper=z(!!e.hasZ,!1,e.view.spatialReference),this._snappingManager=e.snappingManager,this._editGeometryOperations=new A(new E(e.editGeometryType??"polygon",this._coordinateHelper)),this._snappingGraphicsLayer=new U({id:P.SNAPPING_GRAPHICS_LAYER_ID,listMode:"hide",internal:!0}),this._snappingContext=new F({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:"mouse",visualizer:new K(this._snappingGraphicsLayer)}),this._activeComponent=new D(e.view.spatialReference,b.Local),this._editGeometryOperations.data.components.push(this._activeComponent)}normalizeCtorArgs(e){const t={...e};return delete t.editGeometryType,t}initialize(){this._snappingOperation=new N({view:this.view}),this.view.type==="2d"&&this.view.map.layers.add(this._snappingGraphicsLayer)}destroy(){this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy(),this._snappingManager!=null&&this._snappingManager.doneSnapping(),this._snappingOperation=y(this._snappingOperation),this._editGeometryOperations.destroy()}get _committedVertices(){return this._editGeometryOperations.data.components[0].vertices.map(e=>e.pos)}get vertices(){return this._stagedVertex!=null?[...this._committedVertices,this._coordinateHelper.pointToArray(this._stagedVertex)]:this._committedVertices}get hasZ(){return this._hasZ!=null?this._hasZ:this.view.type==="3d"}set hasZ(e){this._hasZ=e,this.notifyChange("hasZ")}get _stagedVertex(){return this._snappingOperation.stagedPoint}set _stagedVertex(e){this._snappingOperation.stagedPoint=G(e)}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this.canUndo&&this._editGeometryOperations.undo()}redo(){this.canRedo&&this._editGeometryOperations.redo()}getCoordsFromScreenPoint(e){const t=e&&this.screenToMap(e);return t==null?null:t.hasZ?[t.x,t.y,t.z]:[t.x,t.y]}getCoordsAndPointFromScreenPoint(e){const t=this.screenToMap(e);return t==null?null:t.hasZ?{vertex:[t.x,t.y,t.z],mapPoint:t}:{vertex:[t.x,t.y],mapPoint:t}}screenToMap(e){let t=null;if(this.view.type==="3d")if(this.hasZ){const i=this.elevationInfo??Q;t=this.view.sceneIntersectionHelper.intersectElevationFromScreen(S(e.x,e.y),i,this._getGeometryZValue())}else{const i=this.elevationInfo??W;t=this.view.sceneIntersectionHelper.intersectElevationFromScreen(S(e.x,e.y),i,0),t!=null&&(t.z=void 0)}else t=this.view.toMap(e),t!=null&&(t.z=this.hasZ?this._getGeometryZValue():void 0);return t}_pushCursorVertex(e,t){const i=Z(e[0],e[1],void 0,this.view.spatialReference);this._stagedVertexUnsnapped=i;const o=this._snappingManager;if(o==null)return this._stagedVertex=i,void t();M(this._snappingOperation.snap({point:i},o,this._snappingContext)).then(()=>{t()})}_popCursorVertex(){this._stagedVertexUnsnapped=null,this._stagedVertex=null}_getGeometryZValue(){return this.defaultZ}_abortSnapping(){this._snappingOperation.abort()}_isDuplicateOfLastVertex(e){var d;const t=(d=this._editGeometryOperations.data.components[0].getLastVertex())==null?void 0:d.pos;if(t&&e[0]===t[0]&&e[1]===t[1])return!0;const{x:i,y:o}=this._coordinateHelper.vectorToDehydratedPoint(e);return this._lastVertexUnsnapped!=null&&i===this._lastVertexUnsnapped.x&&o===this._lastVertexUnsnapped.y}_shouldHandlePointerEvent(e){return this._isPrimaryPointerAction(e)&&(this._activePointerId==null||this._activePointerId===e.pointerId)}_vertexAddHandler(e){const t=this._stagedVertex!=null?this._coordinateHelper.pointToArray(this._stagedVertex):this.getCoordsFromScreenPoint(this._cursorScreenPoint);t!=null&&this._addVertex(t,e.native)}_drawCompleteHandler(e){this._completeDrawing(e.native)}_isPrimaryPointerAction(e){return e.pointerType!=="mouse"||e.button===0}};l.SNAPPING_GRAPHICS_LAYER_ID="DrawAction-snapping-graphics-layer",n([r({readOnly:!0})],l.prototype,"vertices",null),n([r({type:Boolean,nonNullable:!0})],l.prototype,"interactiveUndoDisabled",void 0),n([r({readOnly:!0})],l.prototype,"history",void 0),n([r({readOnly:!0})],l.prototype,"redoHistory",void 0),n([r()],l.prototype,"snapToScene",void 0),n([r()],l.prototype,"view",void 0),n([r()],l.prototype,"elevationInfo",void 0),n([r({nonNullable:!0})],l.prototype,"defaultZ",void 0),n([r()],l.prototype,"hasZ",null),n([r()],l.prototype,"_snappingOperation",void 0),n([r()],l.prototype,"_stagedVertex",null),l=P=n([u("esri.views.draw.DrawAction")],l);const Q={mode:"absolute-height",offset:0},W={mode:"on-the-ground",offset:0},O=l;class c{constructor(t,i,o,d){this.view=t,this.native=i,this.vertexIndex=o,this.vertices=d,this.defaultPrevented=!1,this.type="vertex-add"}preventDefault(){this.defaultPrevented=!0}}class f{constructor(t,i,o,d){this.view=t,this.native=i,this.vertexIndex=o,this.vertices=d,this.defaultPrevented=!1,this.type="vertex-remove"}preventDefault(){this.defaultPrevented=!0}}class _{constructor(t,i,o,d,L=null){this.view=t,this.native=i,this.vertexIndex=o,this.vertices=d,this.mapPoint=L,this.coordinates=null,this.defaultPrevented=!1,this.type="cursor-update",this.coordinates=d.length===1?d[0]:null}preventDefault(){this.defaultPrevented=!0}}class v{constructor(t,i){this.native=t,this.vertices=i,this.coordinates=null,this.defaultPrevented=!1,this.type="draw-complete",this.coordinates=i.length===1?i[0]:null}preventDefault(){this.defaultPrevented=!0}}let V=class extends O{constructor(e){super(e),this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1}initialize(){this._addViewHandles(),this._addUndoRedoHandles()}destroy(){this._removeViewHandles(),this._removeUndoRedoHandles(),this.emit("destroy")}undo(){super.undo(),this.notifyChange("vertices")}redo(){super.redo(),this.notifyChange("vertices")}complete(){this._completeDrawing()}_addViewHandles(){this._removeViewHandles(),this.addHandles([this.view.on("click",e=>{e.stopPropagation()},s.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(e),e.pointerType==="touch"&&this._updateCursor(e.native))},s.TOOL),this.view.on("pointer-move",e=>{this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._abortSnapping(),this._cursorScreenPoint=p(e),e.pointerType!=="touch"&&this._updateCursor(e.native)},s.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._addVertexOnPointerUp=!1)},s.TOOL),this.view.on("pointer-up",e=>{if(this._shouldHandlePointerEvent(e))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp)this._vertexAddHandler(e);else{const t=e.pointerType==="touch";this._updateCursor(e.native,t)}},s.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},s.TOOL),this.view.on("double-click",e=>{e.stopPropagation(),this._drawCompleteHandler(e)},s.TOOL),this.view.on("double-click",["Control"],e=>{e.stopPropagation(),this._drawCompleteHandler(e)},s.TOOL),this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t===a.vertexAdd&&!i&&this._cursorScreenPoint?(e.stopPropagation(),this._abortSnapping(),this._vertexAddHandler(e)):t!==a.complete||i?t!==a.undo||this.interactiveUndoDisabled||i?t!==a.redo||this.interactiveUndoDisabled||i?t!==a.pan||i||e.stopPropagation():(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e))},s.TOOL),this.view.on("key-up",e=>{e.key===a.pan&&e.stopPropagation()},s.TOOL)],this._viewHandlesKey)}_addUndoRedoHandles(){this._removeUndoRedoHandles(),this.addHandles([this._editGeometryOperations.on("vertex-remove",e=>{if(this.notifyChange("vertices"),e.operation==="undo"){const t=this._nativeEventHistory.undoStack.pop();this._nativeEventHistory.redoStack.push(t);const i=[...this._committedVertices];this._stagedVertex!=null&&i.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new f(this.view,t,e.vertices[0].index,i))}}),this._editGeometryOperations.on("vertex-add",e=>{if(this.notifyChange("vertices"),e.operation==="apply"){const t=this._nativeEventHistory.undoStack[this._nativeEventHistory.undoStack.length],i=this._committedVertices.length-1,o=new c(this.view,t,i,this.vertices);this.emit("vertex-add",o),o.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if(e.operation==="redo"){const t=this._nativeEventHistory.redoStack.pop();this._nativeEventHistory.undoStack.push(t);const i=[...this._committedVertices];this._stagedVertex!=null&&i.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new c(this.view,t,e.vertices[0].index,i))}})],this._undoRedoHandlesKey)}_removeViewHandles(){this.removeHandles(this._viewHandlesKey)}_removeUndoRedoHandles(){this.removeHandles(this._undoRedoHandlesKey)}_addVertex(e,t){const i=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(i))return;this._popCursorVertex(),this._editGeometryOperations.appendVertex(i);const o=t||new Event("placeholder");this._nativeEventHistory.undoStack.push(o)}_updateCursor(e,t=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const i=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);i==null||t||this._pushCursorVertex(i.vertex,()=>this.emit("cursor-update",new _(this.view,e,this._activeComponent.vertices.length,this.vertices,this._stagedVertex!=null?new x(this._stagedVertex):null)))}_completeDrawing(e){if(this._activePointerId=null,this._popCursorVertex(),this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;const t=new v(e,this.vertices);this.emit("draw-complete",t),t.defaultPrevented||this._removeViewHandles()}};V=n([u("esri.views.draw.MultipointDrawAction")],V);let h=class extends C.EventedMixin(J){constructor(t){super(t),this.defaultZ=0,this.elevationInfo=null,this.hasZ=!0,this.mode=null,this.snapToScene=null,this.type="draw-3d"}initialize(){const t=this.view,i=R(this.hasZ,this.elevationInfo);this.drawOperation=new Y({view:t,manipulators:this.manipulators,geometryType:this.geometryType,drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:t.type==="3d"?new B(t,i):null,elevationDrawSurface:t.type==="3d"?new j(i,this.defaultZ,t):null,hasM:!1,elevationInfo:i}),this.addHandles([this.drawOperation.on("vertex-add",o=>this.onVertexAdd(o)),this.drawOperation.on("vertex-remove",o=>this.onVertexRemove(o)),this.drawOperation.on("vertex-update",o=>this.onVertexUpdate(o)),this.drawOperation.on("cursor-update",o=>this.onCursorUpdate(o)),this.drawOperation.on("complete",o=>this.onComplete(o))]),this.finishToolCreation()}destroy(){this.drawOperation=y(this.drawOperation),this._set("view",null)}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set enabled(t){this.drawOperation.interactive=t,this._set("enabled",t)}get updating(){var t;return((t=this.drawOperation)==null?void 0:t.updating)??!1}completeCreateOperation(){this.drawOperation.complete()}onDeactivate(){this.drawOperation.isCompleted||this.drawOperation.cancel()}getVertexCoords(){return this.drawOperation.vertices}onInputEvent(t){this.drawOperation.onInputEvent(t)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo()}onComplete(t){this.emit("complete",t)}onCursorUpdate(t){this.emit("cursor-update",t)}onVertexAdd(t){this.emit("vertex-add",t)}onVertexRemove(t){this.emit("vertex-remove",t)}onVertexUpdate(t){this.emit("vertex-update",t)}};n([r({constructOnly:!0,nonNullable:!0})],h.prototype,"defaultZ",void 0),n([r()],h.prototype,"drawOperation",void 0),n([r({constructOnly:!0})],h.prototype,"elevationInfo",void 0),n([r({value:!0})],h.prototype,"enabled",null),n([r({constructOnly:!0})],h.prototype,"geometryType",void 0),n([r({constructOnly:!0})],h.prototype,"hasZ",void 0),n([r({constructOnly:!0})],h.prototype,"mode",void 0),n([r()],h.prototype,"snapToScene",void 0),n([r({readOnly:!0})],h.prototype,"type",void 0),n([r({readOnly:!0})],h.prototype,"updating",null),n([r({constructOnly:!0,nonNullable:!0})],h.prototype,"view",void 0),h=n([u("esri.views.draw.DrawTool")],h);let T=class extends O{constructor(t){super(t),this._addVertexOnPointerUp=!1}initialize(){this.view.type==="2d"?this._addViewHandles():this._addDrawTool()}destroy(){this.view.type==="2d"?this._removeViewHandles():this._removeDrawTool(),this.emit("destroy")}complete(){this.view.type==="2d"?this._cursorScreenPoint&&this._completeDrawing():this._drawTool.completeCreateOperation()}_addViewHandles(){this._removeViewHandles(),this.addHandles([this.view.on("pointer-down",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._activePointerId=t.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(t),t.pointerType==="touch"&&this._updateCursor(t.native))},s.TOOL),this.view.on("pointer-move",t=>{this._abortSnapping(),this._cursorScreenPoint=p(t),t.pointerType!=="touch"&&this._updateCursor(t.native)},s.TOOL),this.view.on("pointer-drag",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._addVertexOnPointerUp=!1)},s.TOOL),this.view.on("pointer-up",t=>{if(this._shouldHandlePointerEvent(t))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp)t.stopPropagation(),this._vertexAddHandler(t);else{const i=t.pointerType==="touch";this._updateCursor(t.native,i)}},s.TOOL),this.view.on("drag",["Shift"],t=>{t.stopPropagation()},s.TOOL),this.view.on("key-down",t=>{t.key===a.complete&&this._cursorScreenPoint&&(this._abortSnapping(),this._vertexAddHandler(t))},s.TOOL)],this._viewHandlesKey)}_removeViewHandles(){this.removeHandles(this._viewHandlesKey)}_addDrawTool(){this._drawTool=new h({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"point",mode:"click"}),this.view.addAndActivateTool(this._drawTool),this.addHandles([this._drawTool.on("cursor-update",t=>{t.vertices.length===1&&this.emit("cursor-update",new _(this.view,null,t.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("complete",t=>{this.emit("draw-complete",new v(null,this._drawTool.getVertexCoords())),this._removeDrawTool()})],this._drawToolHandlesKey)}_removeDrawTool(){this.removeHandles(this._drawToolHandlesKey),this.view.tools.remove(this._drawTool),this._drawTool=null}_addVertex(t){const i=this._coordinateHelper.arrayToVector(t);this._isDuplicateOfLastVertex(i)||(this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(i),this.notifyChange("vertices"),this._completeDrawing())}_updateCursor(t,i=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const o=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);o==null||i||this._pushCursorVertex(o.vertex,()=>this.emit("cursor-update",new _(this.view,t,this._activeComponent.vertices.length,this.vertices,this._stagedVertex!=null?new x(this._stagedVertex):null)))}_completeDrawing(t){this._activePointerId=null,this._popCursorVertex(),this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping();const i=new v(t,this.vertices);this.emit("draw-complete",i),i.defaultPrevented||this._removeViewHandles()}};T=n([u("esri.views.draw.PointDrawAction")],T);let w=class extends O{constructor(t){super(t),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this.mode=I}initialize(){this.view.type==="2d"?(this._addViewHandles(),this._addUndoRedoHandles()):this._addDrawTool()}destroy(){this.view.type==="2d"?(this._removeViewHandles(),this._removeUndoRedoHandles()):this._removeDrawTool(),this.emit("destroy")}get _dragEnabled(){return this.mode==="freehand"||this.mode==="hybrid"}get _clickEnabled(){return this.mode==="click"||this.mode==="hybrid"}undo(){super.undo(),this.notifyChange("vertices")}redo(){super.redo(),this.notifyChange("vertices")}complete(){this.view.type==="2d"?this._completeDrawing():this._drawTool.completeCreateOperation()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this._removeViewHandles(),this.addHandles([this.view.on("click",t=>{t.stopPropagation()},s.TOOL),this.view.on("pointer-down",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._activePointerId=t.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(t),t.pointerType==="touch"&&this._updateCursor(t.native))},s.TOOL),this.view.on("pointer-move",t=>{this._abortSnapping(),this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._cursorScreenPoint=p(t),t.pointerType!=="touch"&&this._updateCursor(t.native)},s.TOOL),this.view.on("pointer-drag",t=>{this._shouldHandlePointerEvent(t)&&(this._abortSnapping(),this._cursorScreenPoint=p(t),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(t):this._addVertexOnPointerUp=!1)},s.TOOL),this.view.on("pointer-up",t=>{if(this._shouldHandlePointerEvent(t))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp){if(!this._clickEnabled)return this.vertices.length===1&&this.vertices.pop(),void this._drawCompleteHandler(t);this._vertexAddHandler(t)}else{const i=t.pointerType==="touch";this._updateCursor(t.native,i)}},s.TOOL),this.view.on("drag",t=>{this._dragEnabled&&this._activePointerId!=null&&!this._panEnabled&&t.stopPropagation()},s.TOOL),this.view.on("drag",["Shift"],t=>{t.stopPropagation()},s.TOOL),this.view.on("double-click",t=>{t.stopPropagation(),this._drawCompleteHandler(t)},s.TOOL),this.view.on("double-click",["Control"],t=>{t.stopPropagation(),this._drawCompleteHandler(t)},s.TOOL),this.view.on("key-down",t=>{const{key:i,repeat:o}=t;i===a.vertexAdd&&!o&&this._cursorScreenPoint?(t.stopPropagation(),this._abortSnapping(),this._vertexAddHandler(t)):i!==a.complete||o?i!==a.undo||this.interactiveUndoDisabled||o?i!==a.redo||this.interactiveUndoDisabled||o?i!==a.pan||o||(t.stopPropagation(),this._panEnabled=!0):(t.stopPropagation(),this.redo()):(t.stopPropagation(),this.undo()):(t.stopPropagation(),this._drawCompleteHandler(t))},s.TOOL),this.view.on("key-up",t=>{t.key===a.pan&&(t.stopPropagation(),this._panEnabled=!1)},s.TOOL)],this._viewHandlesKey)}_addUndoRedoHandles(){this._removeUndoRedoHandles(),this.addHandles([this._editGeometryOperations.on("vertex-remove",t=>{if(this.notifyChange("vertices"),t.operation==="undo"){const i=this._nativeEventHistory.undoStack.pop();this._nativeEventHistory.redoStack.push(i);const o=[...this._committedVertices];this._stagedVertex!=null&&o.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new f(this.view,i,t.vertices[0].index,o))}}),this._editGeometryOperations.on("vertex-add",t=>{if(this.notifyChange("vertices"),t.operation==="apply"){const i=this._nativeEventHistory.undoStack[this._nativeEventHistory.undoStack.length],o=this._committedVertices.length-1,d=new c(this.view,i,o,this.vertices);this.emit("vertex-add",d),d.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if(t.operation==="redo"){const i=this._nativeEventHistory.redoStack.pop();this._nativeEventHistory.undoStack.push(i);const o=[...this._committedVertices];this._stagedVertex!=null&&o.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new c(this.view,i,t.vertices[0].index,o))}})],this._undoRedoHandlesKey)}_removeViewHandles(){this.removeHandles(this._viewHandlesKey)}_removeUndoRedoHandles(){this.removeHandles(this._undoRedoHandlesKey)}_addDrawTool(){this._drawTool=new h({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polygon",mode:this.mode}),this.view.addAndActivateTool(this._drawTool),this._drawTool.on("vertex-add",t=>{t.vertices.length===1&&this.emit("vertex-add",new c(this.view,null,t.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("cursor-update",t=>{t.vertices.length===1&&this.emit("cursor-update",new _(this.view,null,t.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("complete",t=>{this.emit("draw-complete",new v(null,this._drawTool.getVertexCoords())),this._removeDrawTool()})}_removeDrawTool(){this.removeHandles(this._drawToolHandlesKey),this.view.tools.remove(this._drawTool),this._drawTool=y(this._drawTool)}_addVertex(t,i){const o=this._coordinateHelper.arrayToVector(t);if(this._isDuplicateOfLastVertex(o))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(o);const d=i||new Event("placeholder");this._nativeEventHistory.undoStack.push(d)}_updateCursor(t,i=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const o=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);o==null||i||this._pushCursorVertex(o.vertex,()=>this.emit("cursor-update",new _(this.view,t,this._activeComponent.vertices.length,this.vertices,this._stagedVertex!=null?new x(this._stagedVertex):null)))}_completeDrawing(t){if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<3)return;this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping();const i=new v(t,this.vertices);this.emit("draw-complete",i),i.defaultPrevented||this._removeViewHandles()}};n([r()],w.prototype,"_dragEnabled",null),n([r()],w.prototype,"_clickEnabled",null),n([r({type:k})],w.prototype,"mode",void 0),w=n([u("esri.views.draw.PolygonDrawAction")],w);let g=class extends O{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this.mode=I}initialize(){this.view.type==="2d"?(this._addViewHandles(),this._addUndoRedoHandles()):this._addDrawTool()}destroy(){this.view.type==="2d"?(this._removeViewHandles(),this._removeUndoRedoHandles()):this._removeDrawTool(),this.emit("destroy")}get _clickEnabled(){return this.mode==="click"||this.mode==="hybrid"}get _dragEnabled(){return this.mode==="freehand"||this.mode==="hybrid"}undo(){super.undo(),this.notifyChange("vertices")}redo(){super.redo(),this.notifyChange("vertices")}complete(){this.view.type==="2d"?this._completeDrawing():this._drawTool.completeCreateOperation()}_addViewHandles(){this._removeViewHandles(),this.addHandles([this.view.on("click",e=>{e.stopPropagation()},s.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&!this._panEnabled&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(e),e.pointerType==="touch"&&this._updateCursor(e.native))},s.TOOL),this.view.on("pointer-move",e=>{this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._abortSnapping(),this._cursorScreenPoint=p(e),e.pointerType!=="touch"&&this._updateCursor(e.native)},s.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=p(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)},s.TOOL),this.view.on("pointer-up",e=>{if(this._shouldHandlePointerEvent(e))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp){if(!this._clickEnabled)return this.vertices.length===1&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}else{const t=e.pointerType==="touch";this._updateCursor(e.native,t)}},s.TOOL),this.view.on("drag",e=>{this._dragEnabled&&this._activePointerId!=null&&!this._panEnabled&&e.stopPropagation()},s.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},s.TOOL),this.view.on("double-click",e=>{e.stopPropagation(),this._drawCompleteHandler(e)},s.TOOL),this.view.on("double-click",["Control"],e=>{e.stopPropagation(),this._drawCompleteHandler(e)},s.TOOL),this.view.on("key-down",e=>{const{key:t,repeat:i}=e;t===a.vertexAdd&&!i&&this._cursorScreenPoint?(e.stopPropagation(),this._abortSnapping(),this._vertexAddHandler(e)):t!==a.complete||i?t!==a.undo||this.interactiveUndoDisabled||i?t!==a.redo||this.interactiveUndoDisabled||i?t!==a.pan||i||(e.stopPropagation(),this._panEnabled=!0):(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e))},s.TOOL),this.view.on("key-up",e=>{e.key===a.pan&&(e.stopPropagation(),this._panEnabled=!1)},s.TOOL)],this._viewHandlesKey)}_addUndoRedoHandles(){this._removeUndoRedoHandles(),this.addHandles([this._editGeometryOperations.on("vertex-remove",e=>{if(this.notifyChange("vertices"),e.operation==="undo"){const t=this._nativeEventHistory.undoStack.pop();this._nativeEventHistory.redoStack.push(t);const i=[...this._committedVertices];this._stagedVertex!=null&&i.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new f(this.view,t,e.vertices[0].index,i))}}),this._editGeometryOperations.on("vertex-add",e=>{if(this.notifyChange("vertices"),e.operation==="apply"){const t=this._nativeEventHistory.undoStack[this._nativeEventHistory.undoStack.length],i=this._committedVertices.length-1,o=new c(this.view,t,i,this.vertices);this.emit("vertex-add",o),o.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if(e.operation==="redo"){const t=this._nativeEventHistory.redoStack.pop();this._nativeEventHistory.undoStack.push(t);const i=[...this._committedVertices];this._stagedVertex!=null&&i.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new c(this.view,t,e.vertices[0].index,i))}})],this._undoRedoHandlesKey)}_removeViewHandles(){this.removeHandles(this._viewHandlesKey)}_removeUndoRedoHandles(){this.removeHandles(this._undoRedoHandlesKey)}_addDrawTool(){this._drawTool=new h({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polyline",mode:this.mode}),this.view.addAndActivateTool(this._drawTool),this.addHandles([this._drawTool.on("vertex-add",e=>{e.vertices.length===1&&this.emit("vertex-add",new c(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("cursor-update",e=>{e.vertices.length===1&&this.emit("cursor-update",new _(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("complete",e=>{this.emit("draw-complete",new v(null,this._drawTool.getVertexCoords())),this._removeDrawTool()})],this._drawToolHandlesKey)}_removeDrawTool(){this.removeHandles(this._drawToolHandlesKey),this.view.tools.remove(this._drawTool),this._drawTool=y(this._drawTool)}_addVertex(e,t){const i=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(i))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(i);const o=t||new Event("placeholder");this._nativeEventHistory.undoStack.push(o)}_updateCursor(e,t=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const i=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);i==null||t||this._pushCursorVertex(i.vertex,()=>this.emit("cursor-update",new _(this.view,e,this._activeComponent.vertices.length,this.vertices,this._stagedVertex!=null?new x(this._stagedVertex):null)))}_completeDrawing(e){if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<2)return;this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping();const t=new v(e,this.vertices);this.emit("draw-complete",t),t.defaultPrevented||this._removeViewHandles()}};n([r()],g.prototype,"_clickEnabled",null),n([r()],g.prototype,"_dragEnabled",null),n([r({type:k})],g.prototype,"mode",void 0),g=n([u("esri.views.draw.PolylineDrawAction")],g);const X=["freehand","click"];let H=class extends O{constructor(e){super(e),this._isDragging=!1,this._panEnabled=!1,this._addVertexOnPointerUp=!1,this.viewAlignedCoordinateSystem=null,this.mode="freehand"}initialize(){this.view.type==="2d"?this._addViewHandles():this._addDrawTool()}destroy(){this.view.type==="2d"?this._removeViewHandles():this._removeDrawTool(),this.emit("destroy")}complete(){this.view.type==="2d"?this._completeDrawing():this._drawTool.completeCreateOperation()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this._removeViewHandles(),this.mode==="click"?this.addHandles(this._getClickModeViewHandles(),this._viewHandlesKey):this.addHandles(this._getDragModeViewHandles(),this._viewHandlesKey)}_getDragModeViewHandles(){return[this.view.on("immediate-click",e=>{e.stopPropagation(),e.mapPoint&&!this._panEnabled&&this.getCoordsFromScreenPoint(p(e))!=null&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},s.TOOL),this.view.on("pointer-down",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._panEnabled||(this._resetGeometry(),this._addVertexOnPointerUp=!0,this._cursorScreenPoint=p(e),this._activePointerId=e.pointerId,this._vertexAddHandler(e),this._isDragging=!1,e.pointerType==="touch"&&this._updateCursor(e.native)))},s.TOOL),this.view.on("pointer-move",e=>{this._abortSnapping(),this._activePointerId==null&&e.pointerType!=="touch"&&(this._cursorScreenPoint=p(e),this._updateCursor(e.native))},s.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0,this._cursorScreenPoint=p(e),this._updateCursor(e.native))},s.TOOL),this.view.on("pointer-up",e=>{this._shouldHandlePointerEvent(e)&&this._addVertexOnPointerUp&&(this._abortSnapping(),this._activePointerId=null,this._isDragging&&this._vertexAddHandler(e),this._committedVertices.length===2&&this._drawCompleteHandler(e),this._isDragging=!1)},s.TOOL),this.view.on("key-down",e=>{e.key===a.complete&&this._cursorScreenPoint?(this._abortSnapping(),this._vertexAddHandler(e),this._drawCompleteHandler(e)):e.key===a.pan&&(this._panEnabled=!0)},s.TOOL),this.view.on("key-up",e=>{e.key===a.pan&&(this._panEnabled=!1)},s.TOOL),this.view.on("drag",e=>{this._activePointerId!=null&&e.stopPropagation()},s.TOOL),this.view.on("drag",["Shift"],e=>{e.stopPropagation()},s.TOOL)]}_getClickModeViewHandles(){return[this.view.on("pointer-down",e=>{this._abortSnapping(),this._cursorScreenPoint=p(e),this._activePointerId=e.pointerId,this._isDragging=!1,e.pointerType==="touch"&&this._updateCursor(e.native)},s.TOOL),this.view.on("pointer-move",e=>{this._abortSnapping(),this._cursorScreenPoint=p(e),this._activePointerId==null&&e.pointerType!=="touch"&&this._updateCursor(e.native)},s.TOOL),this.view.on("pointer-drag",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._isDragging=!0)},s.TOOL),this.view.on("pointer-up",e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=null,e.stopPropagation(),this._isDragging||this._vertexAddHandler(e),this.vertices.length!==2||this._isDragging||this._drawCompleteHandler(e),this._isDragging=!1)},s.TOOL),this.view.on("key-down",e=>{e.key===a.vertexAdd&&this._cursorScreenPoint&&(this._vertexAddHandler(e),this.vertices.length===2&&this._drawCompleteHandler(e)),e.key===a.complete&&this._cursorScreenPoint&&this.vertices.length===2&&(this._vertexAddHandler(e),this._drawCompleteHandler(e))},s.TOOL)]}_removeViewHandles(){this.removeHandles(this._viewHandlesKey)}_addDrawTool(){this._drawTool=new h({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"segment",mode:this.mode}),this.view.addAndActivateTool(this._drawTool),this.addHandles([this._drawTool.on("vertex-add",e=>{e.vertices.length===1&&this.emit("vertex-add",new c(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("cursor-update",e=>{e.vertices.length===1&&this.emit("cursor-update",new _(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))}),this._drawTool.on("complete",e=>{this.emit("draw-complete",new v(null,this._drawTool.getVertexCoords())),this._removeDrawTool()})],this._drawToolHandlesKey)}_removeDrawTool(){this.removeHandles(this._drawToolHandlesKey),this.view.tools.remove(this._drawTool),this._drawTool=y(this._drawTool)}_addVertex(e,t){const i=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(i))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(i),this._committedVertices.length===1&&(this.viewAlignedCoordinateSystem=q(this.view,this._committedVertices[0]));const o=this._committedVertices.length-1,d=new c(this.view,t,o,this.vertices);this.emit("vertex-add",d)}_updateCursor(e){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const t=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);t!=null&&this._pushCursorVertex(t.vertex,()=>this.emit("cursor-update",new _(this.view,e,this._activeComponent.vertices.length,this.vertices,this._stagedVertex!=null?new x(this._stagedVertex):null)))}_completeDrawing(e){if(this._activePointerId=null,this._popCursorVertex(),this._cursorScreenPoint=null,this._isDragging=!1,this._abortSnapping(),this._snappingManager!=null&&this._snappingManager.doneSnapping(),this.vertices.length<1)return;const t=new v(e,this.vertices);this.emit("draw-complete",t),t.defaultPrevented||this._removeViewHandles()}_resetGeometry(){this._editGeometryOperations.destroy(),this._editGeometryOperations=new A(new E("polygon",this._coordinateHelper)),this._activeComponent=new D(this._coordinateHelper.spatialReference,b.Local),this._editGeometryOperations.data.components.push(this._activeComponent)}};n([r({type:X})],H.prototype,"mode",void 0),H=n([u("esri/views/2d/engine/markup/SegmentDrawAction")],H);let m=class extends ${constructor(){super(...arguments),this.activeAction=null,this.type="draw",this.view=null}destroy(){this.activeAction&&(this.activeAction.destroy(),this.activeAction=null)}create(e,t){this.reset();const i={view:this.view,...t};switch(e){case"point":i.editGeometryType="point",this.activeAction=new T(i);break;case"polyline":i.editGeometryType="polyline",this.activeAction=new g(i);break;case"multipoint":i.editGeometryType="polygon",this.activeAction=new V(i);break;case"polygon":i.editGeometryType="polygon",this.activeAction=new w(i);break;case"rectangle":case"circle":case"ellipse":case"triangle":i.editGeometryType="polygon",this.activeAction=new H(i)}return this.activeAction}complete(){this.activeAction&&this.activeAction.complete(),this.activeAction=null}reset(){this.activeAction&&this.activeAction.destroy(),this.activeAction=null}};n([r()],m.prototype,"activeAction",void 0),n([r({readOnly:!0})],m.prototype,"type",void 0),n([r()],m.prototype,"view",void 0),m=n([u("esri.views.draw.Draw")],m);const pe=m;export{pe as l}; diff --git a/dist/assets/DynamicLayerView3D-4lztpXo0.js b/dist/assets/DynamicLayerView3D-4lztpXo0.js deleted file mode 100644 index 74deb39..0000000 --- a/dist/assets/DynamicLayerView3D-4lztpXo0.js +++ /dev/null @@ -1 +0,0 @@ -import{jI as S,jJ as v,jK as V,jL as q,h$ as F,jM as W,by as Z,bf as M,bz as b,c3 as k,G as B,ah as J,f as $,Z as y,a2 as K,eB as Q,ae as O,dT as j,jN as Y,jO as X,a as N,fZ as ee,g as te,jP as ae,jQ as C,s as D,fu as L,fz as ie,fA as H,jR as se,jS as x,b7 as re,jT as ne,jU as oe,w as le,e as w,y as R,c as he}from"./index-J0iiHjMT.js";import{n as de}from"./LayerView3D-iOx2MD1g.js";import{l as ce}from"./projectExtentUtils-TwA6ooHn.js";import{g as ue}from"./ImageMaterial.glsl-TdPtjVc_.js";import{u as ge}from"./LayerView-efDufa6j.js";import{a as me}from"./RefreshableLayerView-Pd4dLcWr.js";function fe(a,e,t){const i=S(a)/v(a),s={width:t,height:t};return i>1.0001?s.height=t/i:i<.9999&&(s.width=t*i),s.width=Math.round(s.width/(S(a)/S(e))),s.height=Math.round(s.height/(v(a)/v(e))),s}function z(a,e){return V(a,[[e[0],e[1],-1],[e[2],e[1],-1],[e[2],e[3],-1],[e[0],e[3],-1]])}function pe(a,e,t){if(!q(e,t))return z(a,t);const i=[e[1]-t[1],Math.min(e[3],t[3])-Math.max(e[1],t[1]),t[3]-e[3],123456],s=[e[0]-t[0],Math.min(e[2],t[2])-Math.max(e[0],t[0]),t[2]-e[2],123456],l=t[2]-t[0],n=t[3]-t[1],r=s[0]>0&&s[2]>0?3:2,h=i[0]>0&&i[2]>0?3:2,o=(h+1)*(r+1),c=F(3*o),u=W(2*o),d=new Array(6*(h*r-1));let E=0,I=0,P=0,g=0,f=0;for(let p=0;p<4;p++){const T=i[p];if(T<=0)continue;let A=0;for(let _=0;_<4;_++){const G=s[_];G<=0||(c[I++]=t[0]+A,c[I++]=t[1]+E,c[I++]=-1,u[P++]=A/l,u[P++]=E/n,_<3&&p<3&&(_!==1||p!==1)&&(d[f++]=g,d[f++]=g+1,d[f++]=g+r+1,d[f++]=g+1,d[f++]=g+r+2,d[f++]=g+r+1),g++,A+=G)}E+=T}const U=new Array(d.length);return new Z(a,[[M.POSITION,new b(c,d,3,!0)],[M.NORMAL,new b(_e,U,3,!0)],[M.UV0,new b(u,d,2,!0)]])}const _e=[0,0,1];let m=class extends me(de(ge)){constructor(){super(...arguments),this.drapeSourceType=k.RasterImage,this.updatePolicy=B.SYNC,this.fullExtentInLocalViewSpatialReference=null,this.maximumDataResolution=null,this._images=new Array,this._extents=new Array,this._overlays=new Array,this.updateWhenStationary=!0,this._drapeSourceRenderer=null,this.refreshDebounced=J(async a=>{this.destroyed||await this._doRefresh(a).catch(e=>{$(e)||y.getLogger(this).error(e)})},2e3)}initialize(){this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerGeometryDrapeSource(this),this.addHandles(K(()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this))),this.addResolvingPromise(ce(this).then(a=>this._set("fullExtentInLocalViewSpatialReference",a))),this._updatingHandles.add(()=>this.suspended,()=>this._suspendedChangeHandler()),this.addHandles(this.view.resourceController.scheduler.registerIdleStateCallbacks(()=>{this._isScaleRangeActive()&&this.notifyChange("suspended")},()=>{})),this._isScaleRangeLayer()&&this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this.notifyChange("suspended"))}destroy(){this.clear()}setDrapingExtent(a,e){this._spatialReference=e,a.forEach((t,i)=>{this._overlays[i]=t,this._updateImageExtent(t,i)})}_updateImageExtent(a,e){const t=this._clippedExtent(a.extent,we);if(t==null)return;const i=fe(a.extent,t,a.resolution);let s=a.pixelRatio*this.view.state.pixelRatio;const{layer:l}=this;if("imageMaxWidth"in l&&l.imageMaxWidth!=null||"imageMaxHeight"in l&&l.imageMaxHeight!=null){const r=l.imageMaxWidth,h=l.imageMaxHeight;if(i.width>r){const o=r/i.width;i.height=Math.floor(i.height*o),i.width=r,s*=o}if(i.height>h){const o=h/i.height;i.width=Math.floor(i.width*o),i.height=h,s*=o}}const n=this._extents[e];n&&Q(n.extent,t)&&this._imageSizeEquals(t,n.imageSize,i)||(this._extents[e]={extent:O(t),imageSize:i,pixelRatio:s},this.suspended||this._fetch(e).catch(r=>{$(r)||y.getLogger(this).error(r)}))}clear(){for(let a=0;a0&&i>e)return!1}return!0}async processResult(a,e,t){(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement)&&(a.image=e)}findExtentInfoAt(a){for(const e of this._extents){const t=e.extent;if(new j(t[0],t[1],t[2],t[3],this._spatialReference).contains(a))return e}return null}getFetchOptions(){}async redraw(a,e){await Y(this._images,async(t,i)=>{t&&(await a(t,e),await this._createStageObjects(i,t.image,e))})}_imageSizeEquals(a,e,t){if(!this.maximumDataResolution)return!1;const i=S(a)/this.maximumDataResolution.x,s=v(a)/this.maximumDataResolution.y,l=i/e.width,n=s/e.height,r=i/t.width,h=s/t.height,o=Math.abs(l-r),c=Math.abs(n-h),u=X.TESTS_DISABLE_OPTIMIZATIONS?0:1.5;return o<=u&&c<=u}async _fetch(a,e){if(this.suspended)return;const t=this._extents[a],i=t.extent;this._images[a]||(this._images[a]={texture:null,material:null,renderGeometry:null,loadingPromise:null,loadingAbortController:null,image:null,pixelData:null,renderExtent:O(i)});const s=this._images[a];s.loadingAbortController=N(s.loadingAbortController);const l=new j(i[0],i[1],i[2],i[3],this._spatialReference);if(l.width===0||l.height===0)return void this._clearImage(a);const n=new AbortController;s.loadingAbortController=n,ee(e,()=>n.abort());const r=n.signal,h=this._waitFetchReady(r).then(async()=>{const o={requestAsImageElement:!0,pixelRatio:this._overlays[a].pixelRatio,...this.getFetchOptions(),signal:r},{height:c,width:u}=t.imageSize;return this.layer.fetchImage(l,u,c,o)}).then(o=>{if(te(r))throw y.getLogger(this).warnOnce("A call to fetchImage resolved even though the request was aborted. fetchImage should not resolve if options.signal.aborted is true."),ae();return this.processResult(s,o)}).then(()=>{C(s.renderExtent,i)});s.loadingPromise=h,await this._updatingHandles.addPromise(h.then(async()=>{D(r),await this._createStageObjects(a,s.image,r)}).catch(o=>{throw o&&!$(o)&&y.getLogger(this).error(o),o}).finally(()=>{h===s.loadingPromise&&(s.loadingPromise=null,s.loadingAbortController=null)}))}_clearImage(a){const e=this._images[a];if(e){e.renderGeometry!=null&&(this._drapeSourceRenderer.removeGeometries([e.renderGeometry],L.UPDATE),e.renderGeometry=null);const t=this.view._stage,i=e.texture;i==null||i.unload(),t.remove(i),e.texture=null,t.remove(e.material),e.material=null,e.loadingAbortController=N(e.loadingAbortController),e.loadingPromise=null,e.image=null,e.pixelData=null}}async _createStageObjects(a,e,t){const i=this.view._stage,s=this._images[a],l=()=>{var n;(n=s.texture)==null||n.unload(),i.remove(s.texture),s.texture=null,s.renderGeometry&&(this._drapeSourceRenderer.removeGeometries([s.renderGeometry],L.UPDATE),s.renderGeometry=null)};if(e){const n=new ie(e,{width:e.width,height:e.height,preMultiplyAlpha:!0,wrap:{s:H.CLAMP_TO_EDGE,t:H.CLAMP_TO_EDGE}});let r;if(await se(this._images[a===x.INNER?x.OUTER:x.INNER].loadingPromise),D(t),l(),await i.schedule(()=>n.load(i.renderView.renderingContext),t),i.add(n),s.texture=n,s.material==null?(s.material=new ue({transparent:!0,textureId:n.id}),i.add(s.material)):s.material.setParameters({textureId:n.id}),a===x.INNER)r=z(s.material,s.renderExtent);else{const h=this._images[0].renderExtent;if(!h)return void l();r=pe(s.material,h,s.renderExtent)}s.renderGeometry=new re(r),s.renderGeometry.localOrigin=this._overlays[a].renderLocalOrigin,this._drapeSourceRenderer.addGeometries([s.renderGeometry],L.UPDATE)}else l(),i.remove(s.material),s.material=null}_isScaleRangeLayer(){return"effectiveScaleRange"in this.layer}_isScaleRangeActive(){const a=this.layer;if(!this._isScaleRangeLayer())return!1;const{minScale:e,maxScale:t}=a.effectiveScaleRange;return ne(e,t)}_clippedExtent(a,e){if(this.view.viewingMode!=="local")return C(e,a);const t=this.view.basemapTerrain;return t.ready?oe(a,t.extent,e):C(e,a)}_suspendedChangeHandler(){this.suspended?this.clear():this.refreshDebounced()}async _waitFetchReady(a){await le(()=>this.view.stationary,a),D(a)}};w([R()],m.prototype,"layer",void 0),w([R()],m.prototype,"suspended",void 0),w([R({readOnly:!0})],m.prototype,"fullExtentInLocalViewSpatialReference",void 0),w([R()],m.prototype,"updating",void 0),m=w([he("esri.views.3d.layers.DynamicLayerView3D")],m);const Ie=m,we=O();export{Ie as N}; diff --git a/dist/assets/DynamicLayerView3D-XykdNh09.js b/dist/assets/DynamicLayerView3D-XykdNh09.js new file mode 100644 index 0000000..da91d0e --- /dev/null +++ b/dist/assets/DynamicLayerView3D-XykdNh09.js @@ -0,0 +1 @@ +import{jP as v,jQ as S,jR as z,jS as W,hV as q,jT as F,bR as k,bi as A,bS as M,aE as Y,C as Z,bs as B,ac as $,R as y,a0 as Q,ev as X,cf as P,dO as G,jU as J,jV as K,I as H,fU as ee,ad as te,jW as ae,jX as C,ab as D,fp as O,fu as ie,fv as N,jY as se,jZ as x,ba as re,j_ as ne,j$ as oe,aa as le,e as w,y as R,c as he}from"./index-pCX-0tJH.js";import{n as de}from"./LayerView3D-57OghbRh.js";import{l as ce}from"./projectExtentUtils-Q4rXasWA.js";import{g as ue}from"./ImageMaterial.glsl-PU0wbmEN.js";import{u as ge}from"./LayerView-ixwLVnzr.js";import{a as me}from"./RefreshableLayerView-DVYs7L04.js";function fe(a,e,t){const i=v(a)/S(a),s={width:t,height:t};return i>1.0001?s.height=t/i:i<.9999&&(s.width=t*i),s.width=Math.round(s.width/(v(a)/v(e))),s.height=Math.round(s.height/(S(a)/S(e))),s}function V(a,e){return z(a,[[e[0],e[1],-1],[e[2],e[1],-1],[e[2],e[3],-1],[e[0],e[3],-1]])}function pe(a,e,t){if(!W(e,t))return V(a,t);const i=[e[1]-t[1],Math.min(e[3],t[3])-Math.max(e[1],t[1]),t[3]-e[3],123456],s=[e[0]-t[0],Math.min(e[2],t[2])-Math.max(e[0],t[0]),t[2]-e[2],123456],l=t[2]-t[0],n=t[3]-t[1],r=s[0]>0&&s[2]>0?3:2,h=i[0]>0&&i[2]>0?3:2,o=(h+1)*(r+1),c=q(3*o),u=F(2*o),d=new Array(6*(h*r-1));let E=0,I=0,L=0,g=0,f=0;for(let p=0;p<4;p++){const T=i[p];if(T<=0)continue;let b=0;for(let _=0;_<4;_++){const j=s[_];j<=0||(c[I++]=t[0]+b,c[I++]=t[1]+E,c[I++]=-1,u[L++]=b/l,u[L++]=E/n,_<3&&p<3&&(_!==1||p!==1)&&(d[f++]=g,d[f++]=g+1,d[f++]=g+r+1,d[f++]=g+1,d[f++]=g+r+2,d[f++]=g+r+1),g++,b+=j)}E+=T}const U=new Array(d.length);return new k(a,[[A.POSITION,new M(c,d,3,!0)],[A.NORMAL,new M(_e,U,3,!0)],[A.UV0,new M(u,d,2,!0)]])}const _e=[0,0,1];let m=class extends me(de(ge)){constructor(){super(...arguments),this.drapeSourceType=Y.RasterImage,this.updatePolicy=Z.SYNC,this.fullExtentInLocalViewSpatialReference=null,this.maximumDataResolution=null,this._images=new Array,this._extents=new Array,this._overlays=new Array,this.updateWhenStationary=!0,this._drapeSourceRenderer=null,this.refreshDebounced=B(async a=>{this.destroyed||await this._doRefresh(a).catch(e=>{$(e)||y.getLogger(this).error(e)})},2e3)}initialize(){this._drapeSourceRenderer=this.view.basemapTerrain.overlayManager.registerGeometryDrapeSource(this),this.addHandles(Q(()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this))),this.addResolvingPromise(ce(this).then(a=>this._set("fullExtentInLocalViewSpatialReference",a))),this._updatingHandles.add(()=>this.suspended,()=>this._suspendedChangeHandler()),this.addHandles(this.view.resourceController.scheduler.registerIdleStateCallbacks(()=>{this._isScaleRangeActive()&&this.notifyChange("suspended")},()=>{})),this._isScaleRangeLayer()&&this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this.notifyChange("suspended"))}destroy(){this.clear()}setDrapingExtent(a,e){this._spatialReference=e,a.forEach((t,i)=>{this._overlays[i]=t,this._updateImageExtent(t,i)})}_updateImageExtent(a,e){const t=this._clippedExtent(a.extent,we);if(t==null)return;const i=fe(a.extent,t,a.resolution);let s=a.pixelRatio*this.view.state.pixelRatio;const{layer:l}=this;if("imageMaxWidth"in l&&l.imageMaxWidth!=null||"imageMaxHeight"in l&&l.imageMaxHeight!=null){const r=l.imageMaxWidth,h=l.imageMaxHeight;if(i.width>r){const o=r/i.width;i.height=Math.floor(i.height*o),i.width=r,s*=o}if(i.height>h){const o=h/i.height;i.width=Math.floor(i.width*o),i.height=h,s*=o}}const n=this._extents[e];n&&X(n.extent,t)&&this._imageSizeEquals(t,n.imageSize,i)||(this._extents[e]={extent:P(t),imageSize:i,pixelRatio:s},this.suspended||this._fetch(e).catch(r=>{$(r)||y.getLogger(this).error(r)}))}clear(){for(let a=0;a0&&i>e)return!1}return!0}async processResult(a,e,t){(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement)&&(a.image=e)}findExtentInfoAt(a){for(const e of this._extents){const t=e.extent;if(new G(t[0],t[1],t[2],t[3],this._spatialReference).contains(a))return e}return null}getFetchOptions(){}async redraw(a,e){await J(this._images,async(t,i)=>{t&&(await a(t,e),await this._createStageObjects(i,t.image,e))})}_imageSizeEquals(a,e,t){if(!this.maximumDataResolution)return!1;const i=v(a)/this.maximumDataResolution.x,s=S(a)/this.maximumDataResolution.y,l=i/e.width,n=s/e.height,r=i/t.width,h=s/t.height,o=Math.abs(l-r),c=Math.abs(n-h),u=K.TESTS_DISABLE_OPTIMIZATIONS?0:1.5;return o<=u&&c<=u}async _fetch(a,e){if(this.suspended)return;const t=this._extents[a],i=t.extent;this._images[a]||(this._images[a]={texture:null,material:null,renderGeometry:null,loadingPromise:null,loadingAbortController:null,image:null,pixelData:null,renderExtent:P(i)});const s=this._images[a];s.loadingAbortController=H(s.loadingAbortController);const l=new G(i[0],i[1],i[2],i[3],this._spatialReference);if(l.width===0||l.height===0)return void this._clearImage(a);const n=new AbortController;s.loadingAbortController=n,ee(e,()=>n.abort());const r=n.signal,h=this._waitFetchReady(r).then(async()=>{const o={requestAsImageElement:!0,pixelRatio:this._overlays[a].pixelRatio,...this.getFetchOptions(),signal:r},{height:c,width:u}=t.imageSize;return this.layer.fetchImage(l,u,c,o)}).then(o=>{if(te(r))throw y.getLogger(this).warnOnce("A call to fetchImage resolved even though the request was aborted. fetchImage should not resolve if options.signal.aborted is true."),ae();return this.processResult(s,o)}).then(()=>{C(s.renderExtent,i)});s.loadingPromise=h,await this._updatingHandles.addPromise(h.then(async()=>{D(r),await this._createStageObjects(a,s.image,r)}).catch(o=>{throw o&&!$(o)&&y.getLogger(this).error(o),o}).finally(()=>{h===s.loadingPromise&&(s.loadingPromise=null,s.loadingAbortController=null)}))}_clearImage(a){const e=this._images[a];if(e){e.renderGeometry!=null&&(this._drapeSourceRenderer.removeGeometries([e.renderGeometry],O.UPDATE),e.renderGeometry=null);const t=this.view._stage,i=e.texture;i==null||i.unload(),t.remove(i),e.texture=null,t.remove(e.material),e.material=null,e.loadingAbortController=H(e.loadingAbortController),e.loadingPromise=null,e.image=null,e.pixelData=null}}async _createStageObjects(a,e,t){const i=this.view._stage,s=this._images[a],l=()=>{var n;(n=s.texture)==null||n.unload(),i.remove(s.texture),s.texture=null,s.renderGeometry&&(this._drapeSourceRenderer.removeGeometries([s.renderGeometry],O.UPDATE),s.renderGeometry=null)};if(e){const n=new ie(e,{width:e.width,height:e.height,preMultiplyAlpha:!0,wrap:{s:N.CLAMP_TO_EDGE,t:N.CLAMP_TO_EDGE}});let r;if(await se(this._images[a===x.INNER?x.OUTER:x.INNER].loadingPromise),D(t),l(),await i.schedule(()=>n.load(i.renderView.renderingContext),t),i.add(n),s.texture=n,s.material==null?(s.material=new ue({transparent:!0,textureId:n.id}),i.add(s.material)):s.material.setParameters({textureId:n.id}),a===x.INNER)r=V(s.material,s.renderExtent);else{const h=this._images[0].renderExtent;if(!h)return void l();r=pe(s.material,h,s.renderExtent)}s.renderGeometry=new re(r),s.renderGeometry.localOrigin=this._overlays[a].renderLocalOrigin,this._drapeSourceRenderer.addGeometries([s.renderGeometry],O.UPDATE)}else l(),i.remove(s.material),s.material=null}_isScaleRangeLayer(){return"effectiveScaleRange"in this.layer}_isScaleRangeActive(){const a=this.layer;if(!this._isScaleRangeLayer())return!1;const{minScale:e,maxScale:t}=a.effectiveScaleRange;return ne(e,t)}_clippedExtent(a,e){if(this.view.viewingMode!=="local")return C(e,a);const t=this.view.basemapTerrain;return t.ready?oe(a,t.extent,e):C(e,a)}_suspendedChangeHandler(){this.suspended?this.clear():this.refreshDebounced()}async _waitFetchReady(a){await le(()=>this.view.stationary,a),D(a)}};w([R()],m.prototype,"layer",void 0),w([R()],m.prototype,"suspended",void 0),w([R({readOnly:!0})],m.prototype,"fullExtentInLocalViewSpatialReference",void 0),w([R()],m.prototype,"updating",void 0),m=w([he("esri.views.3d.layers.DynamicLayerView3D")],m);const Ie=m,we=P();export{Ie as N}; diff --git a/dist/assets/EdgeProcessingWorker-V8L8etpG.js b/dist/assets/EdgeProcessingWorker-sY3QTnTZ.js similarity index 92% rename from dist/assets/EdgeProcessingWorker-V8L8etpG.js rename to dist/assets/EdgeProcessingWorker-sY3QTnTZ.js index 3fe9692..47b5d40 100644 --- a/dist/assets/EdgeProcessingWorker-V8L8etpG.js +++ b/dist/assets/EdgeProcessingWorker-sY3QTnTZ.js @@ -1 +1 @@ -import{g2 as d,g3 as c,g4 as l,g5 as r,g6 as g,g7 as f,g8 as p}from"./index-J0iiHjMT.js";class I{async extract(e){const t=o(e),n=d(t),i=[t.data.buffer];return{result:h(n,i),transferList:i}}async extractComponentsEdgeLocations(e){const t=o(e),n=c(t.data,t.skipDeduplicate,t.indices,t.indicesLength),i=l(n,m,u),a=[];return{result:r(i.regular.instancesData,a),transferList:a}}async extractEdgeLocations(e){const t=o(e),n=c(t.data,t.skipDeduplicate,t.indices,t.indicesLength),i=l(n,D,u),a=[];return{result:r(i.regular.instancesData,a),transferList:a}}}function o(s){return{data:g.createView(s.dataBuffer),indices:s.indicesType==="Uint32Array"?new Uint32Array(s.indices):s.indicesType==="Uint16Array"?new Uint16Array(s.indices):s.indices,indicesLength:s.indicesLength,writerSettings:s.writerSettings,skipDeduplicate:s.skipDeduplicate}}function h(s,e){return e.push(s.regular.lodInfo.lengths.buffer),e.push(s.silhouette.lodInfo.lengths.buffer),{regular:{instancesData:r(s.regular.instancesData,e),lodInfo:{lengths:s.regular.lodInfo.lengths.buffer}},silhouette:{instancesData:r(s.silhouette.instancesData,e),lodInfo:{lengths:s.silhouette.lodInfo.lengths.buffer}},averageEdgeLength:s.averageEdgeLength}}class L{allocate(e){return f.createBuffer(e)}trim(e,t){return e.slice(0,t)}write(e,t,n){e.position0.setVec(t,n.position0),e.position1.setVec(t,n.position1)}}class w{allocate(e){return p.createBuffer(e)}trim(e,t){return e.slice(0,t)}write(e,t,n){e.position0.setVec(t,n.position0),e.position1.setVec(t,n.position1),e.componentIndex.set(t,n.componentIndex)}}const D=new L,m=new w,u={allocate:()=>null,write:()=>{},trim:()=>null};export{I as default}; +import{f$ as d,g0 as c,g1 as l,g2 as r,g3 as g,g4 as f,g5 as p}from"./index-pCX-0tJH.js";class I{async extract(e){const t=o(e),n=d(t),i=[t.data.buffer];return{result:h(n,i),transferList:i}}async extractComponentsEdgeLocations(e){const t=o(e),n=c(t.data,t.skipDeduplicate,t.indices,t.indicesLength),i=l(n,m,u),a=[];return{result:r(i.regular.instancesData,a),transferList:a}}async extractEdgeLocations(e){const t=o(e),n=c(t.data,t.skipDeduplicate,t.indices,t.indicesLength),i=l(n,D,u),a=[];return{result:r(i.regular.instancesData,a),transferList:a}}}function o(s){return{data:g.createView(s.dataBuffer),indices:s.indicesType==="Uint32Array"?new Uint32Array(s.indices):s.indicesType==="Uint16Array"?new Uint16Array(s.indices):s.indices,indicesLength:s.indicesLength,writerSettings:s.writerSettings,skipDeduplicate:s.skipDeduplicate}}function h(s,e){return e.push(s.regular.lodInfo.lengths.buffer),e.push(s.silhouette.lodInfo.lengths.buffer),{regular:{instancesData:r(s.regular.instancesData,e),lodInfo:{lengths:s.regular.lodInfo.lengths.buffer}},silhouette:{instancesData:r(s.silhouette.instancesData,e),lodInfo:{lengths:s.silhouette.lodInfo.lengths.buffer}},averageEdgeLength:s.averageEdgeLength}}class L{allocate(e){return f.createBuffer(e)}trim(e,t){return e.slice(0,t)}write(e,t,n){e.position0.setVec(t,n.position0),e.position1.setVec(t,n.position1)}}class w{allocate(e){return p.createBuffer(e)}trim(e,t){return e.slice(0,t)}write(e,t,n){e.position0.setVec(t,n.position0),e.position1.setVec(t,n.position1),e.componentIndex.set(t,n.componentIndex)}}const D=new L,m=new w,u={allocate:()=>null,write:()=>{},trim:()=>null};export{I as default}; diff --git a/dist/assets/EditGeometryOperations-TPE5Wzab.js b/dist/assets/EditGeometryOperations-TPE5Wzab.js deleted file mode 100644 index 99f1ed0..0000000 --- a/dist/assets/EditGeometryOperations-TPE5Wzab.js +++ /dev/null @@ -1 +0,0 @@ -import{a9 as V,oW as Z,T as E,oV as ce,rt as te,ru as le,rv as de,as as T,aa as c,rw as pe,b1 as R,hP as ue,az as ie,qa as _e,aE as w,pU as L,ou as ge,bi as S,rx as fe,i1 as me,b5 as xe,ry as ye,e4 as ve,O as Ve,K as se,N as Ee,l as Te,fo as $,qM as De,aT as B,rz as H,rA as we,ax as b,bb as q,aG as G,aF as A,at as D,aV as Pe,o1 as C,rB as Me,rC as F,a0 as j,hJ as Ae,pL as Ce,au as Ze,rD as W,rE as I,rF as Re,cQ as X,pl as $e,rG as ze,oU as Se,pK as K,a2 as be}from"./index-J0iiHjMT.js";var l;(function(n){n[n.Z=0]="Z",n[n.M=1]="M"})(l||(l={}));class Ge{constructor(e){this.spatialReference=e}createVector(){return this._tag(V())}pointToVector(e){return this._tag(Z(e.x,e.y))}arrayToVector(e){return this._tag(Z(e[0],e[1]))}vectorToArray(e){return[e[0],e[1]]}pointToArray(e){return[e.x,e.y]}vectorToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.hasZ=!1,t.hasM=!1,t.spatialReference=this.spatialReference,t}lerp(e,t,i,s){return ce(s,e,t,i)}addDelta(e,t,i){e[0]+=t,e[1]+=i}distance(e,t){return te(e,t)}getZ(e,t=void 0){return t}hasZ(){return!1}getM(e,t=void 0){return t}hasM(){return!1}clone(e){return this._tag(le(e))}copy(e,t){return de(t,e)}fromXYZ(e){return this._tag(Z(e[0],e[1]))}toXYZ(e,t=c()){return T(t,e[0],e[1],0)}pointToXYZ(e,t=c()){return T(t,e.x,e.y,0)}equals(e,t){return pe(e,t)}_tag(e){return e}}class Q{constructor(e,t){this._valueType=e,this.spatialReference=t}createVector(){return this._tag(c())}pointToVector(e){return this._tag(R(e.x,e.y,this._valueType===l.Z?e.z:e.m))}arrayToVector(e){return this._tag(R(e[0],e[1],e[2]||0))}vectorToArray(e){return[e[0],e[1],e[2]]}pointToArray(e){return this._valueType===l.Z?[e.x,e.y,e.z]:[e.x,e.y,e.m]}vectorToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=this._valueType===l.Z?e[2]:void 0,t.m=this._valueType===l.M?e[2]:void 0,t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=this._valueType===l.Z?e[2]:void 0,t.m=this._valueType===l.M?e[2]:void 0,t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){const i=this._valueType===l.Z,s=this._valueType===l.M;return t.x=e[0],t.y=e[1],t.z=i?e[2]:void 0,t.m=s?e[2]:void 0,t.hasZ=i,t.hasM=s,t.spatialReference=this.spatialReference,t}lerp(e,t,i,s){return ue(s,e,t,i)}addDelta(e,t,i,s){e[0]+=t,e[1]+=i,this._valueType===l.Z&&(e[2]+=s)}distance(e,t){return this._valueType===l.Z?ie(e,t):te(e,t)}getZ(e,t=void 0){return this._valueType===l.Z?e[2]:t}hasZ(){return this._valueType===l.Z}getM(e,t=void 0){return this._valueType===l.M?e[2]:t}hasM(){return this._valueType===l.M}clone(e){return this._tag(_e(e))}copy(e,t){return w(t,e)}fromXYZ(e,t=0,i=0){return this._tag(R(e[0],e[1],this._valueType===l.Z?e.length>2?e[2]:t:i))}toXYZ(e,t=c()){return T(t,e[0],e[1],this._valueType===l.Z?e[2]:0)}pointToXYZ(e,t=c()){return T(t,e.x,e.y,this._valueType===l.Z?e.z??0:0)}equals(e,t){return L(e,t)}_tag(e){return e}}class Ie{constructor(e){this.spatialReference=e}createVector(){return this._tag(ge())}pointToVector(e){return this._tag(S(e.x,e.y,e.z,e.m))}arrayToVector(e){return this._tag(S(e[0],e[1],e[2]||0,e[3]||0))}vectorToArray(e){return[e[0],e[1],e[2],e[3]]}pointToArray(e){return[e.x,e.y,e.z,e.m]}vectorToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.hasZ=!0,t.hasM=!0,t.spatialReference=this.spatialReference,t}lerp(e,t,i,s){return fe(s,e,t,i)}addDelta(e,t,i,s){e[0]+=t,e[1]+=i,e[2]+=s}distance(e,t){return ie(e,t)}getZ(e){return e[2]}hasZ(){return!0}getM(e){return e[3]}hasM(){return!0}clone(e){return this._tag(me(e))}copy(e,t){return xe(t,e)}fromXYZ(e,t=0,i=0){return this._tag(S(e[0],e[1],e.length>2?e[2]:t,i))}toXYZ(e,t=c()){return T(t,e[0],e[1],e[2])}pointToXYZ(e,t=c()){return T(t,e.x,e.y,e.z??0)}equals(e,t){return ye(e,t)}_tag(e){return e}}function Xe(n,e,t){return n&&e?new Ie(t):e?new Q(l.M,t):n?new Q(l.Z,t):new Ge(t)}function Ue(n,e){if(!e.supported)return;let t=1/0,i=-1/0;const s=e.upperBoundX-e.lowerBoundX;n.forEach(o=>{let a=o.pos[0];for(;ae.upperBoundX;)a-=s;t=Math.min(t,a),i=Math.max(i,a),o.pos[0]=a});const r=i-t;s-r{o.pos[0]<0&&(o.pos[0]+=s)})}function Le(n,e){const t=ve(n);return e===Ve.Global&&t?{supported:!0,lowerBoundX:t.valid[0],upperBoundX:t.valid[1]}:{supported:!1,lowerBoundX:null,upperBoundX:null}}class P{constructor(e){this.component=e,this.leftEdge=null,this.rightEdge=null,this.type="vertex",this.index=null}get pos(){return this._pos}set pos(e){this._pos=e,this.component.unnormalizeVertexPositions()}}let x=class{constructor(e,t,i){this.component=e,this.leftVertex=t,this.rightVertex=i,this.type="edge",t.rightEdge=this,i.leftEdge=this}};class U{constructor(e,t){this._spatialReference=e,this._viewingMode=t,this.vertices=[],this.edges=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||Ue(this.vertices,Le(this._spatialReference,this._viewingMode))}updateVertexIndex(e,t){if(this.vertices.length===0)return;const i=this.vertices[0];let s=null,r=e,o=t;do s=r,s.index=o++,r=s.rightEdge?s.rightEdge.rightVertex:null;while(r!=null&&r!==i);s.leftEdge&&s!==this.vertices[this.vertices.length-1]&&this.swapVertices(this.vertices.indexOf(s),this.vertices.length-1)}getFirstVertex(){return this.vertices.length===0?null:this.vertices[0]}getLastVertex(){return this.vertices.length===0?null:this.vertices[this.vertices.length-1]}isClosed(){return this.vertices.length>2&&this.vertices[0].leftEdge!==null}swapVertices(e,t){const i=this.vertices[e];this.vertices[e]=this.vertices[t],this.vertices[t]=i}iterateVertices(e){if(this.vertices.length===0)return;const t=this.vertices[0];let i=t;do e(i,i.index),i=i.rightEdge!=null?i.rightEdge.rightVertex:null;while(i!==t&&i!=null)}}class Y extends se{constructor(e,t){super(),this.type=e,this.coordinateHelper=t,this._geometry=null,this._dirty=!0,this.components=[]}get geometry(){if(this._dirty){switch(this.type){case"point":this._geometry=this._toPoint();break;case"polyline":this._geometry=this._toPolyline();break;case"polygon":this._geometry=this._toPolygon()}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}notifyChanges(e){this._dirty=!0,this.emit("change",e)}_toPoint(){return this.components.length===0||this.components[0].vertices.length===0?null:this.coordinateHelper.vectorToPoint(this.components[0].vertices[0].pos)}_toPolyline(){const e=[],t=this.coordinateHelper.vectorToArray;for(const i of this.components){if(i.vertices.length<1)continue;const s=[];let r=i.vertices.find(a=>a.leftEdge==null);const o=r;do s.push(t(r.pos)),r=r.rightEdge?r.rightEdge.rightVertex:null;while(r&&r!==o);e.push(s)}return new Ee({paths:e,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){const e=[],t=this.coordinateHelper.vectorToArray;for(const i of this.components){if(i.vertices.length<1)continue;const s=[],r=i.vertices[0];let o=r;const a=o;do s.push(t(o.pos)),o=o.rightEdge!=null?o.rightEdge.rightVertex:null;while(o&&o!==a);i.isClosed()&&s.push(t(r.pos)),e.push(s)}return new Te({rings:e,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(e,t){const i=e.spatialReference,s=Xe(e.hasZ,e.hasM,i),r=new Y(e.type,s);switch(e.type){case"polygon":{const o=e.rings;for(let a=0;a2&&$(p[0],p[p.length-1]),v=y?p.length-1:p.length;for(let d=0;dthis.operation.apply(e)),this._editGeometry.components.forEach(e=>e.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:this._undone?"redo":"apply",updatedVertices:this._vertices})}undo(){this._vertices.forEach(e=>this.operation.undo(e)),this._editGeometry.notifyChanges({operation:"undo",updatedVertices:this._vertices}),this._undone=!0}canAccumulate(e){if(this._undone||e._vertices.length!==this._vertices.length)return!1;for(let t=0;tthis.operation.accumulate(t,e.operation)),this.operation.accumulateParams(e.operation),this._editGeometry.components.forEach(t=>t.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:"apply",updatedVertices:this._vertices}),!0)}};var g;(function(n){n[n.CUMULATIVE=0]="CUMULATIVE",n[n.REPLACE=1]="REPLACE"})(g||(g={}));let Ne=class{constructor(e,t,i=0){this._editGeometry=e,this._vertices=t,this._minNumberOfVertices=i,this.removedVertices=null}apply(){let e="redo";if(this.removedVertices==null){const t=this.removedVertices=[];this._vertices.forEach(i=>{const s=this._removeVertex(i);s!=null&&t.push(s)}),e="apply"}else this.removedVertices.forEach(t=>{this._removeVertex(t.removedVertex)});this._editGeometry.notifyChanges({operation:e,removedVertices:this._vertices})}undo(){var e;(e=this.removedVertices)==null||e.forEach(t=>{this._undoRemoveVertex(t)}),this._editGeometry.notifyChanges({operation:"undo",addedVertices:this._vertices})}accumulate(){return!1}_removeVertex(e){const t=e.component;if(t.vertices.length<=this._minNumberOfVertices)return null;const i={removedVertex:e,createdEdge:null},s=e.leftEdge,r=e.rightEdge;return t.vertices.splice(t.vertices.indexOf(e),1),s&&(t.edges.splice(t.edges.indexOf(s),1),s.leftVertex.rightEdge=null),r&&(t.edges.splice(t.edges.indexOf(r),1),r.rightVertex.leftEdge=null),e.index===0&&r&&this._vertices.length>0&&t.swapVertices(t.vertices.indexOf(r.rightVertex),0),s&&r&&(i.createdEdge=new x(t,s.leftVertex,r.rightVertex),t.edges.push(i.createdEdge)),r&&t.updateVertexIndex(r.rightVertex,r.rightVertex.index-1),i}_undoRemoveVertex(e){const t=e.removedVertex,i=e.removedVertex.component,s=t.leftEdge,r=t.rightEdge;e.createdEdge&&i.edges.splice(i.edges.indexOf(e.createdEdge),1),i.vertices.push(t),s&&(i.edges.push(s),s.leftVertex.rightEdge=s),r&&(i.edges.push(r),r.rightVertex.leftEdge=r),i.updateVertexIndex(t,t.index)}};class ke{constructor(e,t,i){this._editGeometry=e,this._edge=t,this._t=i,this.createdVertex=null,this._left=null,this._right=null}apply(){let e="redo";const t=this._edge,i=t.component,s=t.leftVertex,r=t.rightVertex;i.edges.splice(i.edges.indexOf(t),1),this.createdVertex==null&&(e="apply",this.createdVertex=new P(t.component)),i.vertices.push(this.createdVertex),this.createdVertex.pos=this._editGeometry.coordinateHelper.lerp(t.leftVertex.pos,t.rightVertex.pos,this._t,this._editGeometry.coordinateHelper.createVector()),this._left==null&&(this._left=new x(i,s,this.createdVertex)),this._left.leftVertex.leftEdge?i.edges.push(this._left):i.edges.unshift(this._left),s.rightEdge=this._left,this._right==null&&(this._right=new x(i,this.createdVertex,r)),i.edges.push(this._right),r.leftEdge=this._right,i.updateVertexIndex(this.createdVertex,s.index+1),this._editGeometry.notifyChanges({operation:e,addedVertices:[this.createdVertex]})}undo(){if(this.createdVertex==null||this._left==null||this._right==null)return null;const e=this._edge,t=e.component,i=this.createdVertex.leftEdge,s=this.createdVertex.rightEdge,r=i==null?void 0:i.leftVertex,o=s==null?void 0:s.rightVertex;t.vertices.splice(t.vertices.indexOf(this.createdVertex),1),t.edges.splice(t.edges.indexOf(this._left),1),t.edges.splice(t.edges.indexOf(this._right),1),this._edge.leftVertex.leftEdge?t.edges.push(this._edge):t.edges.unshift(this._edge),r&&(r.rightEdge=e),o&&(o.leftEdge=e),r&&t.updateVertexIndex(r,r.index),this._editGeometry.notifyChanges({operation:"undo",removedVertices:[this.createdVertex]})}accumulate(){return!1}}let Be=class ne{constructor(e,t,i){this._editGeometry=e,this._vertex=t,this._pos=i}apply(){const e=this._originalPosition==null;e&&(this._originalPosition=this._vertex.pos),this._apply(e?"apply":"redo")}undo(){this._vertex.pos=this._originalPosition,this._editGeometry.notifyChanges({operation:"undo",updatedVertices:[this._vertex]})}accumulate(e){return e instanceof ne&&e._vertex===this._vertex&&(this._pos=e._pos,this._apply("apply"),!0)}_apply(e){this._vertex.pos=this._pos,this._editGeometry.components.forEach(t=>t.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:e,updatedVertices:[this._vertex]})}};class He{constructor(e,t){this._editGeometry=e,this._component=t,this._createdEdge=null}apply(){let e="redo";if(this._createdEdge==null){e="apply";const t=this._component.getFirstVertex(),i=this._component.getLastVertex();if(this._component.isClosed()||this._component.vertices.length<3||t==null||i==null)return;this._createdEdge=new x(this._component,i,t)}this._createdEdge.leftVertex.rightEdge=this._createdEdge,this._createdEdge.rightVertex.leftEdge=this._createdEdge,this._component.edges.push(this._createdEdge),this._editGeometry.notifyChanges({operation:e})}undo(){this._createdEdge!=null&&(De(this._component.edges,this._createdEdge),this._createdEdge.leftVertex.rightEdge=null,this._createdEdge.rightVertex.leftEdge=null,this._editGeometry.notifyChanges({operation:"undo"}))}accumulate(){return!1}}let qe=class oe{constructor(e,t,i,s){this._helper=e,this.dx=t,this.dy=i,this.dz=s}_move(e,t,i,s){this._helper.addDelta(e.pos,t,i,s)}apply(e){this._move(e,this.dx,this.dy,this.dz)}undo(e){this._move(e,-this.dx,-this.dy,-this.dz)}canAccumulate(e){return e instanceof oe}accumulate(e,t){this._move(e,t.dx,t.dy,t.dz)}accumulateParams(e){this.dx+=e.dx,this.dy+=e.dy,this.dz+=e.dz}};class z{get plane(){return this._plane}get requiresSplitEdgeLeft(){return!this._left.isOriginalDirection}get requiresSplitEdgeRight(){return!this._right.isOriginalDirection}get edgeDirection(){return this._edgeDirection}constructor(e,t,i,s=0,r=M.IMMEDIATE){this._helper=e,this._planeType=t,this._edge=i,this.distance=s,this._plane=B(),this._offsetPlane=B(),this._minDistance=-1/0,this._maxDistance=1/0,this._selectedArrow=1,r===M.IMMEDIATE&&this._initialize()}_initialize(){this._initializeNeighbors(),this._initializePlane(),this._initializeDistanceConstraints()}_initializeNeighbors(){var r,o,a,p;const e=this._toXYZ(this._edge.leftVertex.pos),t=this._toXYZ((o=(r=this._edge.leftVertex.leftEdge)==null?void 0:r.leftVertex)==null?void 0:o.pos),i=this._toXYZ(this._edge.rightVertex.pos),s=this._toXYZ((p=(a=this._edge.rightVertex.rightEdge)==null?void 0:a.rightVertex)==null?void 0:p.pos);this._edgeDirection=H(c(),e,i),this._left=this._computeNeighbor(e,t,this._edgeDirection),this._right=this._computeNeighbor(i,s,this._edgeDirection)}_toXYZ(e){return e!=null?this._helper.toXYZ(e):null}_pointToXYZ(e){return this._toXYZ(this._helper.pointToVector(e))}_computeNeighbor(e,t,i){if(t==null)return{start:e,end:t,direction:R(-i[1],i[0],0),isOriginalDirection:!0};const s=H(c(),e,t),r=!this._passesBisectingAngleThreshold(s,i);return{start:e,end:t,direction:r?this._bisectVectorsPerpendicular(i,s):s,isOriginalDirection:!r}}_passesBisectingAngleThreshold(e,t){const i=Math.abs(we(t,e));return i>=J&&i<=Math.PI-J}_bisectVectorsPerpendicular(e,t){const i=b(e,t)<0?e:q(c(),e),s=Math.abs(b(i,t));if(!(s1-ee))return this._bisectDirection(i,t);const r=G(c(),i,[0,0,1]);return A(r,r)}_bisectDirection(e,t){const i=D(c(),e,t);return A(i,i)}_initializePlane(){const e=this._computeNormalDirection(this._left),t=this._computeNormalDirection(this._right);b(e,t)<0&&q(t,t),Pe(this._left.start,this._bisectDirection(e,t),this._plane)}_computeNormalDirection(e){const t=G(c(),e.direction,this._edgeDirection);A(t,t);const i=G(c(),this._edgeDirection,t);return this._planeType===O.XY&&(i[2]=0),A(i,i)}_initializeDistanceConstraints(){this._left.end==null||this.requiresSplitEdgeLeft||this._updateDistanceConstraint(C(this._plane,this._left.end)),this._right.end==null||this.requiresSplitEdgeRight||this._updateDistanceConstraint(C(this._plane,this._right.end)),this._updateIntersectDistanceConstraint(this._plane)}_updateDistanceConstraint(e){e<=0&&(this._minDistance=Math.max(this._minDistance,e)),e>=0&&(this._maxDistance=Math.min(this._maxDistance,e))}_updateIntersectDistanceConstraint(e){const t=X(e),i=this._edgeDirection,s=D(c(),this._left.start,this._left.direction),r=D(c(),this._right.start,this._right.direction),o=this._pointInBasis2D(V(),t,i,this._left.start),a=this._pointInBasis2D(V(),t,i,s),p=this._pointInBasis2D(V(),t,i,this._right.start),h=this._pointInBasis2D(V(),t,i,r),[y]=Me({start:a,end:o,type:F.LINE},{start:h,end:p,type:F.LINE});if(!y)return;const v=j(V(),o,a);Ae(v,v);const u=j(V(),y,a),d=Ce(v,u),_=D(c(),s,Ze(c(),this._left.direction,-d)),f=C(e,_);this._updateDistanceConstraint(f)}_pointInBasis2D(e,t,i,s){return e[0]=W(t,s),e[1]=W(i,s),e}_offset(e,t){Number.isFinite(this._minDistance)&&(t=Math.max(this._minDistance,t)),Number.isFinite(this._maxDistance)&&(t=Math.min(this._maxDistance,t)),I(this._offsetPlane,this._plane),this._offsetPlane[3]-=t;const i=(r,o,a)=>o!=null&&ze(this._offsetPlane,r,D(c(),r,o),a),s=c();(e===this._edge.leftVertex?i(this._left.start,this._left.direction,s):i(this._right.start,this._right.direction,s))&&this._helper.copy(this._helper.fromXYZ(s,void 0,this._helper.getM(e.pos)),e.pos)}selectArrowFromStartPoint(e){this._selectedArrow=Re(this.plane,this._pointToXYZ(e))?1:-1}get selectedArrow(){return this._selectedArrow}signedDistanceToPoint(e){return C(this.plane,this._pointToXYZ(e))}apply(e){this._offset(e,this.distance)}undo(e){this._offset(e,0)}canAccumulate(e){return e instanceof z&&this._edge.leftVertex.index===e._edge.leftVertex.index&&this._edge.rightVertex.index===e._edge.rightVertex.index&&this._edge.component===e._edge.component&&this._maybeEqualsVec3(this._left.direction,e._left.direction)&&this._maybeEqualsVec3(this._right.direction,e._right.direction)&&L(X(this._plane),X(e._plane))}accumulate(e,t){const i=this._plane[3]-t._plane[3]+t.distance;this._offset(e,i)}accumulateParams(e){const t=e.distance-e._plane[3];this.distance=t+this._plane[3]}clone(){const e=new z(this._helper,this._planeType,this._edge,this.distance,M.DEFERRED);return I(e._plane,this._plane),I(e._offsetPlane,this._offsetPlane),e._maxDistance=this._maxDistance,e._minDistance=this._minDistance,e._left=this._cloneNeighbor(this._left),e._right=this._cloneNeighbor(this._right),e._edgeDirection=w(c(),this._edgeDirection),e}_maybeEqualsVec3(e,t){return e==null&&t==null||e!=null&&t!=null&&L(e,t)}_cloneNeighbor({start:e,end:t,direction:i,isOriginalDirection:s}){return{start:w(c(),e),end:t!=null?w(c(),t):null,direction:w(c(),i),isOriginalDirection:s}}}const J=$e(15),ee=.001;var O,M;(function(n){n[n.XYZ=0]="XYZ",n[n.XY=1]="XY"})(O||(O={})),function(n){n[n.IMMEDIATE=0]="IMMEDIATE",n[n.DEFERRED=1]="DEFERRED"}(M||(M={}));class N{constructor(e,t,i=g.CUMULATIVE){this.origin=e,this.angle=t,this._accumulationType=i}_rotate(e,t){Se(e.pos,e.pos,this.origin,t)}apply(e){this._rotate(e,this.angle)}undo(e){this._rotate(e,-this.angle)}canAccumulate(e){return e instanceof N&&$(this.origin,e.origin)}accumulate(e,t){const i=t._accumulationType===g.REPLACE;this._rotate(e,i?t.angle-this.angle:t.angle)}accumulateParams(e){const t=e._accumulationType===g.REPLACE;this.angle=t?e.angle:this.angle+e.angle}}class k{constructor(e,t,i,s,r=g.CUMULATIVE){this.origin=e,this.axis1=t,this.factor1=i,this.factor2=s,this._accumulationType=r,this.axis2=Z(t[1],-t[0])}_scale(e,t,i){K(e.pos,e.pos,this.origin,this.axis1,t),K(e.pos,e.pos,this.origin,this.axis2,i)}apply(e){this._scale(e,this.factor1,this.factor2)}undo(e){this._scale(e,1/this.factor1,1/this.factor2)}canAccumulate(e){return e instanceof k&&$(this.origin,e.origin)&&$(this.axis1,e.axis1)}accumulate(e,t){t._accumulationType===g.REPLACE?this._scale(e,t.factor1/this.factor1,t.factor2/this.factor2):this._scale(e,t.factor1,t.factor2)}accumulateParams(e){const t=e._accumulationType===g.REPLACE;this.factor1=t?e.factor1:this.factor1*e.factor1,this.factor2=t?e.factor2:this.factor2*e.factor2}}class Fe{constructor(){this._operations=[],this._closed=!1}close(){this._closed=!0}apply(){for(const e of this._operations)e.apply()}undo(){for(let e=this._operations.length-1;e>=0;e--)this._operations[e].undo()}accumulate(e){if(this._closed)return!1;const t=this._operations.length?this._operations[this._operations.length-1]:null;return t&&t.accumulate(e)||(this._operations.push(e),e.apply()),!0}}class ae extends se{constructor(e){super(),this.data=e,this._undoStack=[],this._redoStack=[],this._listener=this.data.on("change",t=>{t.addedVertices&&this.emit("vertex-add",{type:"vertex-add",vertices:t.addedVertices,operation:t.operation}),t.removedVertices&&this.emit("vertex-remove",{type:"vertex-remove",vertices:t.removedVertices,operation:t.operation}),t.updatedVertices&&this.emit("vertex-update",{type:"vertex-update",vertices:t.updatedVertices,operation:t.operation})})}destroy(){this._listener.remove()}splitEdge(e,t){return this._apply(new ke(this.data,e,t))}updateVertices(e,t,i=m.ACCUMULATE_STEPS){return this._apply(new Ye(this.data,e,t),i)}moveVertices(e,t,i,s,r=m.ACCUMULATE_STEPS){return this.updateVertices(e,new qe(this.data.coordinateHelper,t,i,s),r)}scaleVertices(e,t,i,s,r,o=m.ACCUMULATE_STEPS,a=g.CUMULATIVE){return this.updateVertices(e,new k(t,i,s,r,a),o)}rotateVertices(e,t,i,s=m.ACCUMULATE_STEPS,r=g.CUMULATIVE){return this.updateVertices(e,new N(t,i,r),s)}removeVertices(e){return this._apply(new Ne(this.data,e,this._minNumVerticesPerType))}appendVertex(e){return this.data.components.length===0?null:this._apply(new Oe(this.data,this.data.components[0],e))}setVertexPosition(e,t){return this._apply(new Be(this.data,e,t))}offsetEdge(e,t,i,s=m.ACCUMULATE_STEPS){return this.updateVertices([t.leftVertex,t.rightVertex],new z(this.data.coordinateHelper,e,t,i),s)}closeComponent(e){return this.data.components.includes(e)?this._apply(new He(this.data,e)):null}canRemoveVertex(e){return e.vertices.length>this._minNumVerticesPerType}createUndoGroup(){const e=new Fe;return this._apply(e),be(()=>e.close())}undo(){if(this._undoStack.length>0){const e=this._undoStack.pop();return e.undo(),this._redoStack.push(e),e}return null}redo(){if(this._redoStack.length>0){const e=this._redoStack.pop();return e.apply(),this._undoStack.push(e),e}return null}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}get lastOperation(){return this._undoStack.length>0?this._undoStack[this._undoStack.length-1]:null}get _minNumVerticesPerType(){switch(this.data.type){case"point":return 1;case"polyline":return 2;case"polygon":return 3;default:return 0}}_apply(e,t=m.ACCUMULATE_STEPS){return t!==m.NEW_STEP&&this.lastOperation!=null&&this.lastOperation.accumulate(e)||(e.apply(),this._undoStack.push(e),this._redoStack=[]),e}static fromGeometry(e,t){return new ae(Y.fromGeometry(e,t))}}export{m as E,z as N,ae as V,qe as a,k as c,g as e,U as l,Y as p,N as s,Ye as t,Xe as w,O as y}; diff --git a/dist/assets/EditGeometryOperations-vpHcsZOg.js b/dist/assets/EditGeometryOperations-vpHcsZOg.js new file mode 100644 index 0000000..82a686a --- /dev/null +++ b/dist/assets/EditGeometryOperations-vpHcsZOg.js @@ -0,0 +1 @@ +import{a7 as V,p7 as C,L as E,p6 as ce,sj as te,sk as le,sl as de,bz as T,a8 as c,sm as pe,b1 as R,hO as ue,by as ie,qn as _e,b3 as D,q5 as U,oH as ge,bA as S,sn as fe,hX as me,b8 as xe,so as ye,dZ as ve,F as Ve,z as se,E as Ee,j as Te,fj as $,qZ as we,c5 as H,sp as B,sq as De,c9 as b,be as q,c6 as X,bL as Z,bO as w,c7 as Pe,od as A,sr as Me,ss as F,Z as j,hH as Ze,pY as Ae,ca as Ce,st as W,su as I,sv as Re,cH as G,py as $e,sw as ze,p5 as Se,pX as Q,a0 as be}from"./index-pCX-0tJH.js";var l;(function(n){n[n.Z=0]="Z",n[n.M=1]="M"})(l||(l={}));class Xe{constructor(e){this.spatialReference=e}createVector(){return this._tag(V())}pointToVector(e){return this._tag(C(e.x,e.y))}arrayToVector(e){return this._tag(C(e[0],e[1]))}vectorToArray(e){return[e[0],e[1]]}pointToArray(e){return[e.x,e.y]}vectorToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){return t.x=e[0],t.y=e[1],t.z=void 0,t.m=void 0,t.hasZ=!1,t.hasM=!1,t.spatialReference=this.spatialReference,t}lerp(e,t,i,s){return ce(s,e,t,i)}addDelta(e,t,i){e[0]+=t,e[1]+=i}distance(e,t){return te(e,t)}getZ(e,t=void 0){return t}hasZ(){return!1}getM(e,t=void 0){return t}hasM(){return!1}clone(e){return this._tag(le(e))}copy(e,t){return de(t,e)}fromXYZ(e){return this._tag(C(e[0],e[1]))}toXYZ(e,t=c()){return T(t,e[0],e[1],0)}pointToXYZ(e,t=c()){return T(t,e.x,e.y,0)}equals(e,t){return pe(e,t)}_tag(e){return e}}class J{constructor(e,t){this._valueType=e,this.spatialReference=t}createVector(){return this._tag(c())}pointToVector(e){return this._tag(R(e.x,e.y,this._valueType===l.Z?e.z:e.m))}arrayToVector(e){return this._tag(R(e[0],e[1],e[2]||0))}vectorToArray(e){return[e[0],e[1],e[2]]}pointToArray(e){return this._valueType===l.Z?[e.x,e.y,e.z]:[e.x,e.y,e.m]}vectorToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=this._valueType===l.Z?e[2]:void 0,t.m=this._valueType===l.M?e[2]:void 0,t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=this._valueType===l.Z?e[2]:void 0,t.m=this._valueType===l.M?e[2]:void 0,t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){const i=this._valueType===l.Z,s=this._valueType===l.M;return t.x=e[0],t.y=e[1],t.z=i?e[2]:void 0,t.m=s?e[2]:void 0,t.hasZ=i,t.hasM=s,t.spatialReference=this.spatialReference,t}lerp(e,t,i,s){return ue(s,e,t,i)}addDelta(e,t,i,s){e[0]+=t,e[1]+=i,this._valueType===l.Z&&(e[2]+=s)}distance(e,t){return this._valueType===l.Z?ie(e,t):te(e,t)}getZ(e,t=void 0){return this._valueType===l.Z?e[2]:t}hasZ(){return this._valueType===l.Z}getM(e,t=void 0){return this._valueType===l.M?e[2]:t}hasM(){return this._valueType===l.M}clone(e){return this._tag(_e(e))}copy(e,t){return D(t,e)}fromXYZ(e,t=0,i=0){return this._tag(R(e[0],e[1],this._valueType===l.Z?e.length>2?e[2]:t:i))}toXYZ(e,t=c()){return T(t,e[0],e[1],this._valueType===l.Z?e[2]:0)}pointToXYZ(e,t=c()){return T(t,e.x,e.y,this._valueType===l.Z?e.z??0:0)}equals(e,t){return U(e,t)}_tag(e){return e}}class Ie{constructor(e){this.spatialReference=e}createVector(){return this._tag(ge())}pointToVector(e){return this._tag(S(e.x,e.y,e.z,e.m))}arrayToVector(e){return this._tag(S(e[0],e[1],e[2]||0,e[3]||0))}vectorToArray(e){return[e[0],e[1],e[2],e[3]]}pointToArray(e){return[e.x,e.y,e.z,e.m]}vectorToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.spatialReference=this.spatialReference,t}arrayToPoint(e,t=new E){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.spatialReference=this.spatialReference,t}vectorToDehydratedPoint(e,t={x:void 0,y:void 0,z:void 0,m:void 0,hasZ:void 0,hasM:void 0,spatialReference:void 0,type:"point"}){return t.x=e[0],t.y=e[1],t.z=e[2],t.m=e[3],t.hasZ=!0,t.hasM=!0,t.spatialReference=this.spatialReference,t}lerp(e,t,i,s){return fe(s,e,t,i)}addDelta(e,t,i,s){e[0]+=t,e[1]+=i,e[2]+=s}distance(e,t){return ie(e,t)}getZ(e){return e[2]}hasZ(){return!0}getM(e){return e[3]}hasM(){return!0}clone(e){return this._tag(me(e))}copy(e,t){return xe(t,e)}fromXYZ(e,t=0,i=0){return this._tag(S(e[0],e[1],e.length>2?e[2]:t,i))}toXYZ(e,t=c()){return T(t,e[0],e[1],e[2])}pointToXYZ(e,t=c()){return T(t,e.x,e.y,e.z??0)}equals(e,t){return ye(e,t)}_tag(e){return e}}function Ge(n,e,t){return n&&e?new Ie(t):e?new J(l.M,t):n?new J(l.Z,t):new Xe(t)}function Le(n,e){if(!e.supported)return;let t=1/0,i=-1/0;const s=e.upperBoundX-e.lowerBoundX;n.forEach(o=>{let h=o.pos[0];for(;he.upperBoundX;)h-=s;t=Math.min(t,h),i=Math.max(i,h),o.pos[0]=h});const r=i-t;s-r{o.pos[0]<0&&(o.pos[0]+=s)})}function Ue(n,e){const t=ve(n);return e===Ve.Global&&t?{supported:!0,lowerBoundX:t.valid[0],upperBoundX:t.valid[1]}:{supported:!1,lowerBoundX:null,upperBoundX:null}}class P{constructor(e){this.component=e,this.leftEdge=null,this.rightEdge=null,this.type="vertex",this.index=null}get pos(){return this._pos}set pos(e){this._pos=e,this.component.unnormalizeVertexPositions()}}let x=class{constructor(e,t,i){this.component=e,this.leftVertex=t,this.rightVertex=i,this.type="edge",t.rightEdge=this,i.leftEdge=this}};class L{constructor(e,t){this._spatialReference=e,this._viewingMode=t,this.vertices=[],this.edges=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||Le(this.vertices,Ue(this._spatialReference,this._viewingMode))}updateVertexIndex(e,t){if(this.vertices.length===0)return;const i=this.vertices[0];let s=null,r=e,o=t;do s=r,s.index=o++,r=s.rightEdge?s.rightEdge.rightVertex:null;while(r!=null&&r!==i);s.leftEdge&&s!==this.vertices[this.vertices.length-1]&&this.swapVertices(this.vertices.indexOf(s),this.vertices.length-1)}getFirstVertex(){return this.vertices.length===0?null:this.vertices[0]}getLastVertex(){return this.vertices.length===0?null:this.vertices[this.vertices.length-1]}isClosed(){return this.vertices.length>2&&this.vertices[0].leftEdge!==null}swapVertices(e,t){const i=this.vertices[e];this.vertices[e]=this.vertices[t],this.vertices[t]=i}iterateVertices(e){if(this.vertices.length===0)return;const t=this.vertices[0];let i=t;do e(i,i.index),i=i.rightEdge!=null?i.rightEdge.rightVertex:null;while(i!==t&&i!=null)}}class Y extends se{constructor(e,t){super(),this.type=e,this.coordinateHelper=t,this._geometry=null,this._dirty=!0,this.components=[]}get geometry(){if(this._dirty){switch(this.type){case"point":this._geometry=this._toPoint();break;case"polyline":this._geometry=this._toPolyline();break;case"polygon":this._geometry=this._toPolygon()}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}notifyChanges(e){this._dirty=!0,this.emit("change",e)}_toPoint(){return this.components.length===0||this.components[0].vertices.length===0?null:this.coordinateHelper.vectorToPoint(this.components[0].vertices[0].pos)}_toPolyline(){const e=[],t=this.coordinateHelper.vectorToArray;for(const i of this.components){if(i.vertices.length<1)continue;const s=[];let r=i.vertices.find(h=>h.leftEdge==null);const o=r;do s.push(t(r.pos)),r=r.rightEdge?r.rightEdge.rightVertex:null;while(r&&r!==o);e.push(s)}return new Ee({paths:e,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){const e=[],t=this.coordinateHelper.vectorToArray;for(const i of this.components){if(i.vertices.length<1)continue;const s=[],r=i.vertices[0];let o=r;const h=o;do s.push(t(o.pos)),o=o.rightEdge!=null?o.rightEdge.rightVertex:null;while(o&&o!==h);i.isClosed()&&s.push(t(r.pos)),e.push(s)}return new Te({rings:e,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(e,t){const i=e.spatialReference,s=Ge(e.hasZ,e.hasM,i),r=new Y(e.type,s);switch(e.type){case"polygon":{const o=e.rings;for(let h=0;h2&&$(p[0],p[p.length-1]),v=y?p.length-1:p.length;for(let d=0;dthis.operation.apply(e)),this._editGeometry.components.forEach(e=>e.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:this._undone?"redo":"apply",updatedVertices:this._vertices})}undo(){this._vertices.forEach(e=>this.operation.undo(e)),this._editGeometry.notifyChanges({operation:"undo",updatedVertices:this._vertices}),this._undone=!0}canAccumulate(e){if(this._undone||e._vertices.length!==this._vertices.length)return!1;for(let t=0;tthis.operation.accumulate(t,e.operation)),this.operation.accumulateParams(e.operation),this._editGeometry.components.forEach(t=>t.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:"apply",updatedVertices:this._vertices}),!0)}};var g;(function(n){n[n.CUMULATIVE=0]="CUMULATIVE",n[n.REPLACE=1]="REPLACE"})(g||(g={}));let ke=class{constructor(e,t,i=0){this._editGeometry=e,this._vertices=t,this._minNumberOfVertices=i,this.removedVertices=null}apply(){let e="redo";if(this.removedVertices==null){const t=this.removedVertices=[];this._vertices.forEach(i=>{const s=this._removeVertex(i);s!=null&&t.push(s)}),e="apply"}else this.removedVertices.forEach(t=>{this._removeVertex(t.removedVertex)});this._editGeometry.notifyChanges({operation:e,removedVertices:this._vertices})}undo(){var e;(e=this.removedVertices)==null||e.forEach(t=>{this._undoRemoveVertex(t)}),this._editGeometry.notifyChanges({operation:"undo",addedVertices:this._vertices})}accumulate(){return!1}_removeVertex(e){const t=e.component;if(t.vertices.length<=this._minNumberOfVertices)return null;const i={removedVertex:e,createdEdge:null},s=e.leftEdge,r=e.rightEdge;return t.vertices.splice(t.vertices.indexOf(e),1),s&&(t.edges.splice(t.edges.indexOf(s),1),s.leftVertex.rightEdge=null),r&&(t.edges.splice(t.edges.indexOf(r),1),r.rightVertex.leftEdge=null),e.index===0&&r&&this._vertices.length>0&&t.swapVertices(t.vertices.indexOf(r.rightVertex),0),s&&r&&(i.createdEdge=new x(t,s.leftVertex,r.rightVertex),t.edges.push(i.createdEdge)),r&&t.updateVertexIndex(r.rightVertex,r.rightVertex.index-1),i}_undoRemoveVertex(e){const t=e.removedVertex,i=e.removedVertex.component,s=t.leftEdge,r=t.rightEdge;e.createdEdge&&i.edges.splice(i.edges.indexOf(e.createdEdge),1),i.vertices.push(t),s&&(i.edges.push(s),s.leftVertex.rightEdge=s),r&&(i.edges.push(r),r.rightVertex.leftEdge=r),i.updateVertexIndex(t,t.index)}};class Ne{constructor(e,t,i){this._editGeometry=e,this._edge=t,this._t=i,this.createdVertex=null,this._left=null,this._right=null}apply(){let e="redo";const t=this._edge,i=t.component,s=t.leftVertex,r=t.rightVertex;i.edges.splice(i.edges.indexOf(t),1),this.createdVertex==null&&(e="apply",this.createdVertex=new P(t.component)),i.vertices.push(this.createdVertex),this.createdVertex.pos=this._editGeometry.coordinateHelper.lerp(t.leftVertex.pos,t.rightVertex.pos,this._t,this._editGeometry.coordinateHelper.createVector()),this._left==null&&(this._left=new x(i,s,this.createdVertex)),this._left.leftVertex.leftEdge?i.edges.push(this._left):i.edges.unshift(this._left),s.rightEdge=this._left,this._right==null&&(this._right=new x(i,this.createdVertex,r)),i.edges.push(this._right),r.leftEdge=this._right,i.updateVertexIndex(this.createdVertex,s.index+1),this._editGeometry.notifyChanges({operation:e,addedVertices:[this.createdVertex]})}undo(){if(this.createdVertex==null||this._left==null||this._right==null)return null;const e=this._edge,t=e.component,i=this.createdVertex.leftEdge,s=this.createdVertex.rightEdge,r=i==null?void 0:i.leftVertex,o=s==null?void 0:s.rightVertex;t.vertices.splice(t.vertices.indexOf(this.createdVertex),1),t.edges.splice(t.edges.indexOf(this._left),1),t.edges.splice(t.edges.indexOf(this._right),1),this._edge.leftVertex.leftEdge?t.edges.push(this._edge):t.edges.unshift(this._edge),r&&(r.rightEdge=e),o&&(o.leftEdge=e),r&&t.updateVertexIndex(r,r.index),this._editGeometry.notifyChanges({operation:"undo",removedVertices:[this.createdVertex]})}accumulate(){return!1}}let He=class ne{constructor(e,t,i){this._editGeometry=e,this._vertex=t,this._pos=i}apply(){const e=this._originalPosition==null;e&&(this._originalPosition=this._vertex.pos),this._apply(e?"apply":"redo")}undo(){this._vertex.pos=this._originalPosition,this._editGeometry.notifyChanges({operation:"undo",updatedVertices:[this._vertex]})}accumulate(e){return e instanceof ne&&e._vertex===this._vertex&&(this._pos=e._pos,this._apply("apply"),!0)}_apply(e){this._vertex.pos=this._pos,this._editGeometry.components.forEach(t=>t.unnormalizeVertexPositions()),this._editGeometry.notifyChanges({operation:e,updatedVertices:[this._vertex]})}};class Be{constructor(e,t){this._editGeometry=e,this._component=t,this._createdEdge=null}apply(){let e="redo";if(this._createdEdge==null){e="apply";const t=this._component.getFirstVertex(),i=this._component.getLastVertex();if(this._component.isClosed()||this._component.vertices.length<3||t==null||i==null)return;this._createdEdge=new x(this._component,i,t)}this._createdEdge.leftVertex.rightEdge=this._createdEdge,this._createdEdge.rightVertex.leftEdge=this._createdEdge,this._component.edges.push(this._createdEdge),this._editGeometry.notifyChanges({operation:e})}undo(){this._createdEdge!=null&&(we(this._component.edges,this._createdEdge),this._createdEdge.leftVertex.rightEdge=null,this._createdEdge.rightVertex.leftEdge=null,this._editGeometry.notifyChanges({operation:"undo"}))}accumulate(){return!1}}let qe=class oe{constructor(e,t,i,s){this._helper=e,this.dx=t,this.dy=i,this.dz=s}_move(e,t,i,s){this._helper.addDelta(e.pos,t,i,s)}apply(e){this._move(e,this.dx,this.dy,this.dz)}undo(e){this._move(e,-this.dx,-this.dy,-this.dz)}canAccumulate(e){return e instanceof oe}accumulate(e,t){this._move(e,t.dx,t.dy,t.dz)}accumulateParams(e){this.dx+=e.dx,this.dy+=e.dy,this.dz+=e.dz}};class z{get plane(){return this._plane}get requiresSplitEdgeLeft(){return!this._left.isOriginalDirection}get requiresSplitEdgeRight(){return!this._right.isOriginalDirection}get edgeDirection(){return this._edgeDirection}constructor(e,t,i,s=0,r=M.IMMEDIATE){this._helper=e,this._planeType=t,this._edge=i,this.distance=s,this._plane=H(),this._offsetPlane=H(),this._minDistance=-1/0,this._maxDistance=1/0,this._selectedArrow=1,r===M.IMMEDIATE&&this._initialize()}_initialize(){this._initializeNeighbors(),this._initializePlane(),this._initializeDistanceConstraints()}_initializeNeighbors(){var r,o,h,p;const e=this._toXYZ(this._edge.leftVertex.pos),t=this._toXYZ((o=(r=this._edge.leftVertex.leftEdge)==null?void 0:r.leftVertex)==null?void 0:o.pos),i=this._toXYZ(this._edge.rightVertex.pos),s=this._toXYZ((p=(h=this._edge.rightVertex.rightEdge)==null?void 0:h.rightVertex)==null?void 0:p.pos);this._edgeDirection=B(c(),e,i),this._left=this._computeNeighbor(e,t,this._edgeDirection),this._right=this._computeNeighbor(i,s,this._edgeDirection)}_toXYZ(e){return e!=null?this._helper.toXYZ(e):null}_pointToXYZ(e){return this._toXYZ(this._helper.pointToVector(e))}_computeNeighbor(e,t,i){if(t==null)return{start:e,end:t,direction:R(-i[1],i[0],0),isOriginalDirection:!0};const s=B(c(),e,t),r=!this._passesBisectingAngleThreshold(s,i);return{start:e,end:t,direction:r?this._bisectVectorsPerpendicular(i,s):s,isOriginalDirection:!r}}_passesBisectingAngleThreshold(e,t){const i=Math.abs(De(t,e));return i>=K&&i<=Math.PI-K}_bisectVectorsPerpendicular(e,t){const i=b(e,t)<0?e:q(c(),e),s=Math.abs(b(i,t));if(!(s1-ee))return this._bisectDirection(i,t);const r=X(c(),i,[0,0,1]);return Z(r,r)}_bisectDirection(e,t){const i=w(c(),e,t);return Z(i,i)}_initializePlane(){const e=this._computeNormalDirection(this._left),t=this._computeNormalDirection(this._right);b(e,t)<0&&q(t,t),Pe(this._left.start,this._bisectDirection(e,t),this._plane)}_computeNormalDirection(e){const t=X(c(),e.direction,this._edgeDirection);Z(t,t);const i=X(c(),this._edgeDirection,t);return this._planeType===O.XY&&(i[2]=0),Z(i,i)}_initializeDistanceConstraints(){this._left.end==null||this.requiresSplitEdgeLeft||this._updateDistanceConstraint(A(this._plane,this._left.end)),this._right.end==null||this.requiresSplitEdgeRight||this._updateDistanceConstraint(A(this._plane,this._right.end)),this._updateIntersectDistanceConstraint(this._plane)}_updateDistanceConstraint(e){e<=0&&(this._minDistance=Math.max(this._minDistance,e)),e>=0&&(this._maxDistance=Math.min(this._maxDistance,e))}_updateIntersectDistanceConstraint(e){const t=G(e),i=this._edgeDirection,s=w(c(),this._left.start,this._left.direction),r=w(c(),this._right.start,this._right.direction),o=this._pointInBasis2D(V(),t,i,this._left.start),h=this._pointInBasis2D(V(),t,i,s),p=this._pointInBasis2D(V(),t,i,this._right.start),a=this._pointInBasis2D(V(),t,i,r),[y]=Me({start:h,end:o,type:F.LINE},{start:a,end:p,type:F.LINE});if(!y)return;const v=j(V(),o,h);Ze(v,v);const u=j(V(),y,h),d=Ae(v,u),_=w(c(),s,Ce(c(),this._left.direction,-d)),f=A(e,_);this._updateDistanceConstraint(f)}_pointInBasis2D(e,t,i,s){return e[0]=W(t,s),e[1]=W(i,s),e}_offset(e,t){Number.isFinite(this._minDistance)&&(t=Math.max(this._minDistance,t)),Number.isFinite(this._maxDistance)&&(t=Math.min(this._maxDistance,t)),I(this._offsetPlane,this._plane),this._offsetPlane[3]-=t;const i=(r,o,h)=>o!=null&&ze(this._offsetPlane,r,w(c(),r,o),h),s=c();(e===this._edge.leftVertex?i(this._left.start,this._left.direction,s):i(this._right.start,this._right.direction,s))&&this._helper.copy(this._helper.fromXYZ(s,void 0,this._helper.getM(e.pos)),e.pos)}selectArrowFromStartPoint(e){this._selectedArrow=Re(this.plane,this._pointToXYZ(e))?1:-1}get selectedArrow(){return this._selectedArrow}signedDistanceToPoint(e){return A(this.plane,this._pointToXYZ(e))}apply(e){this._offset(e,this.distance)}undo(e){this._offset(e,0)}canAccumulate(e){return e instanceof z&&this._edge.leftVertex.index===e._edge.leftVertex.index&&this._edge.rightVertex.index===e._edge.rightVertex.index&&this._edge.component===e._edge.component&&this._maybeEqualsVec3(this._left.direction,e._left.direction)&&this._maybeEqualsVec3(this._right.direction,e._right.direction)&&U(G(this._plane),G(e._plane))}accumulate(e,t){const i=this._plane[3]-t._plane[3]+t.distance;this._offset(e,i)}accumulateParams(e){const t=e.distance-e._plane[3];this.distance=t+this._plane[3]}clone(){const e=new z(this._helper,this._planeType,this._edge,this.distance,M.DEFERRED);return I(e._plane,this._plane),I(e._offsetPlane,this._offsetPlane),e._maxDistance=this._maxDistance,e._minDistance=this._minDistance,e._left=this._cloneNeighbor(this._left),e._right=this._cloneNeighbor(this._right),e._edgeDirection=D(c(),this._edgeDirection),e}_maybeEqualsVec3(e,t){return e==null&&t==null||e!=null&&t!=null&&U(e,t)}_cloneNeighbor({start:e,end:t,direction:i,isOriginalDirection:s}){return{start:D(c(),e),end:t!=null?D(c(),t):null,direction:D(c(),i),isOriginalDirection:s}}}const K=$e(15),ee=.001;var O,M;(function(n){n[n.XYZ=0]="XYZ",n[n.XY=1]="XY"})(O||(O={})),function(n){n[n.IMMEDIATE=0]="IMMEDIATE",n[n.DEFERRED=1]="DEFERRED"}(M||(M={}));class k{constructor(e,t,i=g.CUMULATIVE){this.origin=e,this.angle=t,this._accumulationType=i}_rotate(e,t){Se(e.pos,e.pos,this.origin,t)}apply(e){this._rotate(e,this.angle)}undo(e){this._rotate(e,-this.angle)}canAccumulate(e){return e instanceof k&&$(this.origin,e.origin)}accumulate(e,t){const i=t._accumulationType===g.REPLACE;this._rotate(e,i?t.angle-this.angle:t.angle)}accumulateParams(e){const t=e._accumulationType===g.REPLACE;this.angle=t?e.angle:this.angle+e.angle}}class N{constructor(e,t,i,s,r=g.CUMULATIVE){this.origin=e,this.axis1=t,this.factor1=i,this.factor2=s,this._accumulationType=r,this.axis2=C(t[1],-t[0])}_scale(e,t,i){Q(e.pos,e.pos,this.origin,this.axis1,t),Q(e.pos,e.pos,this.origin,this.axis2,i)}apply(e){this._scale(e,this.factor1,this.factor2)}undo(e){this._scale(e,1/this.factor1,1/this.factor2)}canAccumulate(e){return e instanceof N&&$(this.origin,e.origin)&&$(this.axis1,e.axis1)}accumulate(e,t){t._accumulationType===g.REPLACE?this._scale(e,t.factor1/this.factor1,t.factor2/this.factor2):this._scale(e,t.factor1,t.factor2)}accumulateParams(e){const t=e._accumulationType===g.REPLACE;this.factor1=t?e.factor1:this.factor1*e.factor1,this.factor2=t?e.factor2:this.factor2*e.factor2}}class Fe{constructor(){this._operations=[],this._closed=!1}close(){this._closed=!0}apply(){for(const e of this._operations)e.apply()}undo(){for(let e=this._operations.length-1;e>=0;e--)this._operations[e].undo()}accumulate(e){if(this._closed)return!1;const t=this._operations.length?this._operations[this._operations.length-1]:null;return t&&t.accumulate(e)||(this._operations.push(e),e.apply()),!0}}class he extends se{constructor(e){super(),this.data=e,this._undoStack=[],this._redoStack=[],this._listener=this.data.on("change",t=>{t.addedVertices&&this.emit("vertex-add",{type:"vertex-add",vertices:t.addedVertices,operation:t.operation}),t.removedVertices&&this.emit("vertex-remove",{type:"vertex-remove",vertices:t.removedVertices,operation:t.operation}),t.updatedVertices&&this.emit("vertex-update",{type:"vertex-update",vertices:t.updatedVertices,operation:t.operation})})}destroy(){this._listener.remove()}splitEdge(e,t){return this._apply(new Ne(this.data,e,t))}updateVertices(e,t,i=m.ACCUMULATE_STEPS){return this._apply(new Ye(this.data,e,t),i)}moveVertices(e,t,i,s,r=m.ACCUMULATE_STEPS){return this.updateVertices(e,new qe(this.data.coordinateHelper,t,i,s),r)}scaleVertices(e,t,i,s,r,o=m.ACCUMULATE_STEPS,h=g.CUMULATIVE){return this.updateVertices(e,new N(t,i,s,r,h),o)}rotateVertices(e,t,i,s=m.ACCUMULATE_STEPS,r=g.CUMULATIVE){return this.updateVertices(e,new k(t,i,r),s)}removeVertices(e){return this._apply(new ke(this.data,e,this._minNumVerticesPerType))}appendVertex(e){return this.data.components.length===0?null:this._apply(new Oe(this.data,this.data.components[0],e))}setVertexPosition(e,t){return this._apply(new He(this.data,e,t))}offsetEdge(e,t,i,s=m.ACCUMULATE_STEPS){return this.updateVertices([t.leftVertex,t.rightVertex],new z(this.data.coordinateHelper,e,t,i),s)}closeComponent(e){return this.data.components.includes(e)?this._apply(new Be(this.data,e)):null}canRemoveVertex(e){return e.vertices.length>this._minNumVerticesPerType}createUndoGroup(){const e=new Fe;return this._apply(e),be(()=>e.close())}undo(){if(this._undoStack.length>0){const e=this._undoStack.pop();return e.undo(),this._redoStack.push(e),e}return null}redo(){if(this._redoStack.length>0){const e=this._redoStack.pop();return e.apply(),this._undoStack.push(e),e}return null}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}get lastOperation(){return this._undoStack.length>0?this._undoStack[this._undoStack.length-1]:null}get _minNumVerticesPerType(){switch(this.data.type){case"point":return 1;case"polyline":return 2;case"polygon":return 3;default:return 0}}_apply(e,t=m.ACCUMULATE_STEPS){return t!==m.NEW_STEP&&this.lastOperation!=null&&this.lastOperation.accumulate(e)||(e.apply(),this._undoStack.push(e),this._redoStack=[]),e}static fromGeometry(e,t){return new he(Y.fromGeometry(e,t))}}export{m as E,z as N,he as V,qe as a,N as c,g as e,L as l,Y as p,k as s,Ye as t,Ge as w,O as y}; diff --git a/dist/assets/ElevationLayerView3D-aDJhr4Zv.js b/dist/assets/ElevationLayerView3D-fn8Lf5lz.js similarity index 52% rename from dist/assets/ElevationLayerView3D-aDJhr4Zv.js rename to dist/assets/ElevationLayerView3D-fn8Lf5lz.js index 63dba05..99561b5 100644 --- a/dist/assets/ElevationLayerView3D-aDJhr4Zv.js +++ b/dist/assets/ElevationLayerView3D-fn8Lf5lz.js @@ -1 +1 @@ -import{E as c,e as i,y,c as h}from"./index-J0iiHjMT.js";import{n as u}from"./LayerView3D-iOx2MD1g.js";import{o as v}from"./TiledLayerView3D-Av58zTxG.js";import{u as f}from"./LayerView-efDufa6j.js";let e=class extends v(u(f)){constructor(){super(...arguments),this.type="elevation-3d"}get tileInfo(){return this.layer.tileInfo}initialize(){var r,s,l,a,n;const t=(s=(r=this.view)==null?void 0:r.map)==null?void 0:s.allLayers,d=t&&t.includes(this.layer),o=(n=(a=(l=this.view)==null?void 0:l.map)==null?void 0:a.ground)==null?void 0:n.layers,m=o&&o.includes(this.layer);if(d&&!m){const p=new c("layerview:elevation-layer-only","3D elevation layer '"+this.layer.id+"' can only be added to layers in map.ground");this.addResolvingPromise(Promise.reject(p))}this._addTilingSchemeMatchPromise()}};i([y()],e.prototype,"layer",void 0),i([y()],e.prototype,"tileInfo",null),e=i([h("esri.views.3d.layers.ElevationLayerView3D")],e);const x=e;export{x as default}; +import{r as c,e as i,y,c as h}from"./index-pCX-0tJH.js";import{n as u}from"./LayerView3D-57OghbRh.js";import{o as v}from"./TiledLayerView3D-_U1Q993H.js";import{u as f}from"./LayerView-ixwLVnzr.js";let e=class extends v(u(f)){constructor(){super(...arguments),this.type="elevation-3d"}get tileInfo(){return this.layer.tileInfo}initialize(){var o,s,l,a,n;const t=(s=(o=this.view)==null?void 0:o.map)==null?void 0:s.allLayers,d=t&&t.includes(this.layer),r=(n=(a=(l=this.view)==null?void 0:l.map)==null?void 0:a.ground)==null?void 0:n.layers,m=r&&r.includes(this.layer);if(d&&!m){const p=new c("layerview:elevation-layer-only","3D elevation layer '"+this.layer.id+"' can only be added to layers in map.ground");this.addResolvingPromise(Promise.reject(p))}this._addTilingSchemeMatchPromise()}};i([y()],e.prototype,"layer",void 0),i([y()],e.prototype,"tileInfo",null),e=i([h("esri.views.3d.layers.ElevationLayerView3D")],e);const x=e;export{x as default}; diff --git a/dist/assets/ElevationProfileView2D-5R-6KsXv.js b/dist/assets/ElevationProfileView2D-5R-6KsXv.js new file mode 100644 index 0000000..ebe9a9f --- /dev/null +++ b/dist/assets/ElevationProfileView2D-5R-6KsXv.js @@ -0,0 +1 @@ +import{I as r,bq as d,N as p,ab as u,ku as g,kv as _,B as l,T as o,b as a,kw as v}from"./index-pCX-0tJH.js";import{a as c}from"./HoveredPoints-dZcdNiOr.js";import"./AnchorElementViewModel-7brFN9z4.js";class m{constructor(t){this._params=t,this._highlightTask=null,this._highlightHandle=null}destroy(){this.remove()}remove(){this._highlightTask=r(this._highlightTask),this._highlightHandle=d(this._highlightHandle)}update(t){if(this.remove(),t==null||!w(t))return;const i=t.layer;this._highlightTask=p(async e=>{const h=await this._params.view.whenLayerView(i);u(e);const n=g(h)?h:null;n&&(this._highlightHandle=n.highlight(t))})}}function w(s){return s.geometry!=null&&s.geometry.type==="polyline"}class b{constructor(t,i){this._handles=new _,this._inputRepresentation=new m({view:t}),this._hoveredPoints=new c({view:t}),this._handles.add([l(()=>i.viewModel.hoveredPoints,e=>this._hoveredPoints.update(e),o),l(()=>{const{state:e,highlightEnabled:h,viewModel:n}=i;return{input:n.input,state:e,highlightEnabled:h}},e=>this._updateInputRepresentation(e),o)])}destroy(){this._handles=a(this._handles),this._inputRepresentation=a(this._inputRepresentation),this._hoveredPoints=a(this._hoveredPoints)}_updateInputRepresentation({input:t,state:i,highlightEnabled:e}){i===v.Selected&&e?this._inputRepresentation.update(t):this._inputRepresentation.remove()}}export{b as ElevationProfileView2D}; diff --git a/dist/assets/ElevationProfileView2D-KdZmS2un.js b/dist/assets/ElevationProfileView2D-KdZmS2un.js deleted file mode 100644 index 39ca514..0000000 --- a/dist/assets/ElevationProfileView2D-KdZmS2un.js +++ /dev/null @@ -1 +0,0 @@ -import{a as r,ak as d,b as p,s as u,km as g,kn as _,d as l,A as o,n as a,ko as v}from"./index-J0iiHjMT.js";import{a as m}from"./HoveredPoints-BD2phuV6.js";import"./AnchorElementViewModel-SDYg-P9c.js";class c{constructor(t){this._params=t,this._highlightTask=null,this._highlightHandle=null}destroy(){this.remove()}remove(){this._highlightTask=r(this._highlightTask),this._highlightHandle=d(this._highlightHandle)}update(t){if(this.remove(),t==null||!w(t))return;const i=t.layer;this._highlightTask=p(async e=>{const h=await this._params.view.whenLayerView(i);u(e);const n=g(h)?h:null;n&&(this._highlightHandle=n.highlight(t))})}}function w(s){return s.geometry!=null&&s.geometry.type==="polyline"}class P{constructor(t,i){this._handles=new _,this._inputRepresentation=new c({view:t}),this._hoveredPoints=new m({view:t}),this._handles.add([l(()=>i.viewModel.hoveredPoints,e=>this._hoveredPoints.update(e),o),l(()=>{const{state:e,highlightEnabled:h,viewModel:n}=i;return{input:n.input,state:e,highlightEnabled:h}},e=>this._updateInputRepresentation(e),o)])}destroy(){this._handles=a(this._handles),this._inputRepresentation=a(this._inputRepresentation),this._hoveredPoints=a(this._hoveredPoints)}_updateInputRepresentation({input:t,state:i,highlightEnabled:e}){i===v.Selected&&e?this._inputRepresentation.update(t):this._inputRepresentation.remove()}}export{P as ElevationProfileView2D}; diff --git a/dist/assets/ElevationProfileView3D-bd56oGje.js b/dist/assets/ElevationProfileView3D-bd56oGje.js deleted file mode 100644 index 4428e12..0000000 --- a/dist/assets/ElevationProfileView3D-bd56oGje.js +++ /dev/null @@ -1 +0,0 @@ -import{a as y,ak as _,b as $,s as E,km as D,aP as R,b2 as b,d as h,fw as H,fv as L,e as m,y as v,c as P,p as k,ma as T,A as d,i1 as z,ab as V,N as G,gL as O,kn as S,n as c,ko as f}from"./index-J0iiHjMT.js";import{a as I}from"./HoveredPoints-BD2phuV6.js";import{z as M,w,e as x}from"./GraphicState-2UcU5UAX.js";import"./AnchorElementViewModel-SDYg-P9c.js";import"./ExtendedLineVisualElement-YbjiXiBG.js";import"./vec4f32-NvfHy9q7.js";import"./EngineVisualElement-eZNKTKsI.js";import"./VisualElement-kjYXz27t.js";import"./Laserlines.glsl-nvjcCsAw.js";let A=class{constructor(e){this._params=e,this._highlightTask=null,this._highlightHandle=null,this._visualElementHandle=null,this._settings=new M({getTheme:()=>this._params.view.effectiveTheme})}destroy(){this.remove()}remove(){this._highlightTask=y(this._highlightTask),this._highlightHandle=_(this._highlightHandle),this._visualElementHandle=_(this._visualElementHandle)}showHighlight(e){if(this.remove(),e==null||!g(e))return;const i=e.layer;this._highlightTask=$(async t=>{const n=await this._params.view.whenLayerView(i);E(t),D(n)&&(this._highlightHandle=n.highlight(e))})}showReshaping(e){if(this.remove(),e==null)return;const i=this._params.view,t=new w({view:i,geometry:g(e)?e.geometry:null,attached:!1,elevationInfo:R(e),renderOccluded:b.OccludeAndTransparentStencil,isDecoration:!0}),n=new x({graphic:e}),s=[h(()=>n.isDraped,o=>{t.isDraped=o}),n.on("changed",()=>{t.geometry=g(e)?e.geometry:null}),i.trackGraphicState(n),i.maskOccludee(e),H(t)];this._settings.visualElements.lineGraphics.outline.apply(t),t.attached=!0,this._visualElementHandle=L(s)}};function g(a){return a.geometry!=null&&a.geometry.type==="polyline"}const C=100;let p=class extends k{constructor(a){super(a),this._chartData=null,this._visualElements=[]}initialize(){const a=T(e=>{this._update(e)},C);this.addHandles([h(()=>({spatialReference:this.view.spatialReference,chartData:this._chartData}),a,d),a])}destroy(){this._destroyVisualElements()}remove(){this._destroyVisualElements()}update(a){this._chartData=a}_update(a){const{chartData:e}=a;if(e==null)return this.remove();if(!e.refined)return;const i=this._visualElements,t=e.lines.filter(l=>l.viewVisualizationEnabled),n=t.length;for(;i.length>n;)i.pop().destroy();const s=O().profileLinesStyle3D;for(;i.lengtha.destroy()),this._visualElements.length=0}};m([v()],p.prototype,"view",void 0),m([v()],p.prototype,"_chartData",void 0),p=m([P("esri.widgets.ElevationProfile.support.ProfileLines3D")],p);class Q{constructor(e,i){this._handles=new S,this._inputRepresentation=new A({view:e}),this._hoveredPoints=new I({view:e}),this._profileLines=new p({view:e}),this._handles.add([h(()=>i.viewModel.hoveredPoints,t=>this._hoveredPoints.update(t),d),h(()=>{const{state:t,editable:n,highlightEnabled:s,viewModel:o}=i,l=o.input;return l&&(l.commitProperty("geometry"),l.commitProperty("layer")),{input:l,state:t,editable:n,highlightEnabled:s}},t=>this._updateInputRepresentation(t),d),h(()=>i.viewModel.chartData,t=>this._profileLines.update(t),d),h(()=>{var t;return(t=i.viewModel.input)==null?void 0:t.geometry},()=>{this._profileLines.remove()},d)])}destroy(){this._handles=c(this._handles),this._inputRepresentation=c(this._inputRepresentation),this._hoveredPoints=c(this._hoveredPoints),this._profileLines=c(this._profileLines)}_updateInputRepresentation({input:e,state:i,editable:t,highlightEnabled:n}){const s=this._inputRepresentation;if(!n)return s.remove();i===f.Selected?s.showHighlight(e):i!==f.Created||t?s.remove():s.showReshaping(e)}}export{Q as ElevationProfileView3D}; diff --git a/dist/assets/ElevationProfileView3D-ffQcLfOL.js b/dist/assets/ElevationProfileView3D-ffQcLfOL.js new file mode 100644 index 0000000..8e28ee0 --- /dev/null +++ b/dist/assets/ElevationProfileView3D-ffQcLfOL.js @@ -0,0 +1 @@ +import{I as y,bq as _,N as $,ab as E,ku as D,bl as b,b2 as R,B as h,fr as H,fq as L,e as m,y as v,c as P,g as k,mi as T,T as d,hX as z,W as I,E as V,gI as G,kv as O,b as c,kw as f}from"./index-pCX-0tJH.js";import{a as S}from"./HoveredPoints-dZcdNiOr.js";import{z as M,w,e as x}from"./GraphicState-JOHpeXmF.js";import"./AnchorElementViewModel-7brFN9z4.js";import"./ExtendedLineVisualElement-VJvEdv3K.js";import"./vec4f32-NvfHy9q7.js";import"./EngineVisualElement-u0-BOxGn.js";import"./VisualElement--2Scr6Yq.js";import"./Laserlines.glsl-U7nZFq0e.js";let A=class{constructor(e){this._params=e,this._highlightTask=null,this._highlightHandle=null,this._visualElementHandle=null,this._settings=new M({getTheme:()=>this._params.view.effectiveTheme})}destroy(){this.remove()}remove(){this._highlightTask=y(this._highlightTask),this._highlightHandle=_(this._highlightHandle),this._visualElementHandle=_(this._visualElementHandle)}showHighlight(e){if(this.remove(),e==null||!g(e))return;const i=e.layer;this._highlightTask=$(async t=>{const a=await this._params.view.whenLayerView(i);E(t),D(a)&&(this._highlightHandle=a.highlight(e))})}showReshaping(e){if(this.remove(),e==null)return;const i=this._params.view,t=new w({view:i,geometry:g(e)?e.geometry:null,attached:!1,elevationInfo:b(e),renderOccluded:R.OccludeAndTransparentStencil,isDecoration:!0}),a=new x({graphic:e}),s=[h(()=>a.isDraped,o=>{t.isDraped=o}),a.on("changed",()=>{t.geometry=g(e)?e.geometry:null}),i.trackGraphicState(a),i.maskOccludee(e),H(t)];this._settings.visualElements.lineGraphics.outline.apply(t),t.attached=!0,this._visualElementHandle=L(s)}};function g(n){return n.geometry!=null&&n.geometry.type==="polyline"}const C=100;let p=class extends k{constructor(n){super(n),this._chartData=null,this._visualElements=[]}initialize(){const n=T(e=>{this._update(e)},C);this.addHandles([h(()=>({spatialReference:this.view.spatialReference,chartData:this._chartData}),n,d),n])}destroy(){this._destroyVisualElements()}remove(){this._destroyVisualElements()}update(n){this._chartData=n}_update(n){const{chartData:e}=n;if(e==null)return this.remove();if(!e.refined)return;const i=this._visualElements,t=e.lines.filter(l=>l.viewVisualizationEnabled),a=t.length;for(;i.length>a;)i.pop().destroy();const s=G().profileLinesStyle3D;for(;i.lengthn.destroy()),this._visualElements.length=0}};m([v()],p.prototype,"view",void 0),m([v()],p.prototype,"_chartData",void 0),p=m([P("esri.widgets.ElevationProfile.support.ProfileLines3D")],p);class K{constructor(e,i){this._handles=new O,this._inputRepresentation=new A({view:e}),this._hoveredPoints=new S({view:e}),this._profileLines=new p({view:e}),this._handles.add([h(()=>i.viewModel.hoveredPoints,t=>this._hoveredPoints.update(t),d),h(()=>{const{state:t,editable:a,highlightEnabled:s,viewModel:o}=i,l=o.input;return l&&(l.commitProperty("geometry"),l.commitProperty("layer")),{input:l,state:t,editable:a,highlightEnabled:s}},t=>this._updateInputRepresentation(t),d),h(()=>i.viewModel.chartData,t=>this._profileLines.update(t),d),h(()=>{var t;return(t=i.viewModel.input)==null?void 0:t.geometry},()=>{this._profileLines.remove()},d)])}destroy(){this._handles=c(this._handles),this._inputRepresentation=c(this._inputRepresentation),this._hoveredPoints=c(this._hoveredPoints),this._profileLines=c(this._profileLines)}_updateInputRepresentation({input:e,state:i,editable:t,highlightEnabled:a}){const s=this._inputRepresentation;if(!a)return s.remove();i===f.Selected?s.showHighlight(e):i!==f.Created||t?s.remove():s.showReshaping(e)}}export{K as ElevationProfileView3D}; diff --git a/dist/assets/ElevationSamplerWorker-_kiMcA-u.js b/dist/assets/ElevationSamplerWorker-k8_PEq10.js similarity index 92% rename from dist/assets/ElevationSamplerWorker-_kiMcA-u.js rename to dist/assets/ElevationSamplerWorker-k8_PEq10.js index 85e9e06..c776ddb 100644 --- a/dist/assets/ElevationSamplerWorker-_kiMcA-u.js +++ b/dist/assets/ElevationSamplerWorker-k8_PEq10.js @@ -1 +1 @@ -import{g9 as p,dJ as h}from"./index-J0iiHjMT.js";import{s as l}from"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";class f{async createIndex(t,n){var c;const r=new Array;if(!((c=t.vertexAttributes)!=null&&c.position))return new l;const a=this._createMeshData(t),o=n!=null?await n.invoke("createIndexThread",a,{transferList:r}):this.createIndexThread(a).result;return this._createPooledRBush().fromJSON(o)}createIndexThread(t){const n=new Float64Array(t.position),r=this._createPooledRBush();return t.components?this._createIndexComponentsThread(r,n,t.components.map(a=>new Uint32Array(a))):this._createIndexAllThread(r,n)}_createIndexAllThread(t,n){const r=new Array(n.length/9);let a=0;for(let o=0;o!r.faces)?{position:n}:{position:n,components:t.components.map(r=>r.faces)}}_createPooledRBush(){return new l(9,h("esri-csp-restrictions")?t=>t:[".minX",".minY",".maxX",".maxY"])}}function m(e,t,n,r){return{minX:Math.min(e[t],e[n],e[r]),maxX:Math.max(e[t],e[n],e[r]),minY:Math.min(e[t+1],e[n+1],e[r+1]),maxY:Math.max(e[t+1],e[n+1],e[r+1]),p0:[e[t],e[t+1],e[t+2]],p1:[e[n],e[n+1],e[n+2]],p2:[e[r],e[r+1],e[r+2]]}}export{f as default}; +import{g6 as p,dE as h}from"./index-pCX-0tJH.js";import{s as l}from"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";class f{async createIndex(t,n){var c;const r=new Array;if(!((c=t.vertexAttributes)!=null&&c.position))return new l;const a=this._createMeshData(t),o=n!=null?await n.invoke("createIndexThread",a,{transferList:r}):this.createIndexThread(a).result;return this._createPooledRBush().fromJSON(o)}createIndexThread(t){const n=new Float64Array(t.position),r=this._createPooledRBush();return t.components?this._createIndexComponentsThread(r,n,t.components.map(a=>new Uint32Array(a))):this._createIndexAllThread(r,n)}_createIndexAllThread(t,n){const r=new Array(n.length/9);let a=0;for(let o=0;o!r.faces)?{position:n}:{position:n,components:t.components.map(r=>r.faces)}}_createPooledRBush(){return new l(9,h("esri-csp-restrictions")?t=>t:[".minX",".minY",".maxX",".maxY"])}}function m(e,t,n,r){return{minX:Math.min(e[t],e[n],e[r]),maxX:Math.max(e[t],e[n],e[r]),minY:Math.min(e[t+1],e[n+1],e[r+1]),maxY:Math.max(e[t+1],e[n+1],e[r+1]),p0:[e[t],e[t+1],e[t+2]],p1:[e[n],e[n+1],e[n+2]],p2:[e[r],e[r+1],e[r+2]]}}export{f as default}; diff --git a/dist/assets/EngineVisualElement-eZNKTKsI.js b/dist/assets/EngineVisualElement-eZNKTKsI.js deleted file mode 100644 index f6e04bd..0000000 --- a/dist/assets/EngineVisualElement-eZNKTKsI.js +++ /dev/null @@ -1 +0,0 @@ -import{m,c3 as v,G as y,hQ as p,e as h,y as d,c as b,p as G,fu as l,kW as t,bD as g,bE as w,d as D,P as x}from"./index-J0iiHjMT.js";import{t as F}from"./VisualElement-kjYXz27t.js";class f{constructor(e){this._resourceFactory=e,this._resources=null,this._visible=!0,this._attached=!1,this._renderGroup=p.Outline}destroy(){this._destroyResources()}get resources(){return this._resources!=null?this._resources.external:null}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this._syncGeometriesToRenderer())}get attached(){return this._attached}set attached(e){e!==this._attached&&(this._attached=e,this._createOrDestroyResources())}get renderGroup(){return this._renderGroup}set renderGroup(e){var r;this._renderGroup=e;const s=(r=this._resources)==null?void 0:r.layerView;s&&(s.renderGroup=e)}recreate(){this.attached&&this._createResources()}recreateGeometry(){this._resourceFactory.recreateGeometry?this._resources!=null&&(this._ensureRenderGeometriesRemoved(),this._resourceFactory.recreateGeometry(this._resources.external),this._syncGeometriesToRenderer()):this.recreate()}_createOrDestroyResources(){this._attached?this._resources==null&&this._createResources():this._destroyResources()}_createResources(){var i;this._destroyResources();const e=this._resourceFactory.createResources(),s=new o({view:this._resourceFactory.view,renderGroup:this._renderGroup}),r=(i=this._resourceFactory.view.basemapTerrain)==null?void 0:i.overlayManager;this._resources={layerView:new o({view:this._resourceFactory.view,renderGroup:this._renderGroup}),external:e,geometriesAdded:!1},r&&(this._resources.drapeSourceRenderer=r.registerGeometryDrapeSource(s)),this._syncGeometriesToRenderer()}_destroyResources(){var s;if(this._resources==null)return;this._ensureRenderGeometriesRemoved();const e=(s=this._resourceFactory.view.basemapTerrain)==null?void 0:s.overlayManager;e&&e.unregisterDrapeSource(this._resources.layerView),this._resourceFactory.destroyResources(this._resources.external),this._resources=null}_syncGeometriesToRenderer(){this._visible?this._ensureRenderGeometriesAdded():this._ensureRenderGeometriesRemoved()}_ensureRenderGeometriesRemoved(){var e;((e=this._resources)==null?void 0:e.drapeSourceRenderer)!=null&&this._resources.geometriesAdded&&(this._resources.drapeSourceRenderer.removeGeometries(this._resources.external.geometries,l.UPDATE),this._resources.geometriesAdded=!1)}_ensureRenderGeometriesAdded(){var e;((e=this._resources)==null?void 0:e.drapeSourceRenderer)!=null&&(this._resources.geometriesAdded||(this._resources.drapeSourceRenderer.addGeometries(this._resources.external.geometries,l.UPDATE),this._resources.geometriesAdded=!0))}}let o=class extends m(G){constructor(a){super(a),this.drapeSourceType=v.Features,this.updatePolicy=y.SYNC,this.renderGroup=p.Outline}};h([d({constructOnly:!0})],o.prototype,"view",void 0),h([d({readOnly:!0})],o.prototype,"drapeSourceType",void 0),h([d()],o.prototype,"renderGroup",void 0),o=h([b("DrapedVisualElementLayerView")],o);class j{constructor(e){this._resourceFactory=e,this._resources=null,this._visible=!0,this._attached=!1}destroy(){this._destroyResources()}get object(){return this._resources!=null?this._resources.object:null}get resources(){return this._resources!=null?this._resources.external:null}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this._syncVisible())}get attached(){return this._attached}set attached(e){e!==this._attached&&(this._attached=e,this._createOrDestroyResources())}recreate(){this.attached&&this._createResources()}recreateGeometry(){if(!this._resourceFactory.recreateGeometry)return void this.recreate();const e=this._resourceFactory.view._stage;if(this._resources==null||!e)return;const s=this._resources.object;this._resources.external.forEach(r=>{r.type!==t.Mesh&&r.type!==t.Line&&r.type!==t.Point||e.remove(r)}),s.removeAllGeometries(),this._resourceFactory.recreateGeometry(this._resources.external,s,this._resources.layer),this._resources.external.forEach(r=>{r.type!==t.Mesh&&r.type!==t.Line&&r.type!==t.Point||e.add(r)})}_createOrDestroyResources(){this._attached?this._resources||this._createResources():this._destroyResources()}_createResources(){this._destroyResources();const e=this._resourceFactory,s=e.view,r=s._stage;if(!r)return;const i=new g(r,{pickable:!1,updatePolicy:y.SYNC}),u=new w({castShadow:!1}),n=e.createResources(u,i);n.forEach(c=>{r.add(c),c.type===t.Texture&&c.load(r.renderView.renderingContext)}),r.add(u),i.add(u);const _=e.cameraChanged,R=_?D(()=>s.state.camera,c=>_(c),x):null;this._resources={layer:i,object:u,external:n,cameraHandle:R},this._syncVisible()}_destroyResources(){var s;if(this._resources==null)return;const e=this._resourceFactory.view._stage;e&&(e.remove(this._resources.object),this._resources.layer.destroy(),this._resources.external.forEach(r=>{e.remove(r),r.type===t.Texture&&r.unload()})),this._resources.object.dispose(),(s=this._resources.cameraHandle)==null||s.remove(),this._resourceFactory.destroyResources(this._resources.external),this._resources=null}_syncVisible(){this._resources!=null&&(this._resources.object.visible=this._visible)}}class V extends F{constructor(e){super(e),this._isDraped=!1,this.object3dResources=new j(this.createObject3DResourceFactory(e.view)),this.drapedResources=new f(this.createDrapedResourceFactory(e.view)),this.isDraped=e.isDraped??!1}get isDraped(){return this._isDraped}set isDraped(e){e!==this._isDraped&&(this._isDraped=e,this.object3dResources.attached=this.attached&&!e,this.drapedResources.attached=this.attached&&e)}get renderGroup(){return this.drapedResources.renderGroup}set renderGroup(e){this.drapedResources.renderGroup=e}createResources(){this.object3dResources.attached=!this._isDraped,this.drapedResources.attached=this._isDraped}destroyResources(){this.object3dResources.attached=!1,this.drapedResources.attached=!1}recreate(){this.object3dResources.recreate(),this.drapedResources.recreate()}recreateGeometry(){this.object3dResources.recreateGeometry(),this.drapedResources.recreateGeometry()}destroy(){this.object3dResources.destroy(),this.drapedResources.destroy(),super.destroy()}updateVisibility(e){this.object3dResources.visible=e,this.drapedResources.visible=e}}export{V as t}; diff --git a/dist/assets/EngineVisualElement-u0-BOxGn.js b/dist/assets/EngineVisualElement-u0-BOxGn.js new file mode 100644 index 0000000..19b37df --- /dev/null +++ b/dist/assets/EngineVisualElement-u0-BOxGn.js @@ -0,0 +1 @@ +import{a as m,aE as v,C as y,hP as p,e as h,y as d,c as b,g as G,fp as l,l8 as t,bW as g,bX as w,B as D,P as x}from"./index-pCX-0tJH.js";import{t as F}from"./VisualElement--2Scr6Yq.js";class f{constructor(e){this._resourceFactory=e,this._resources=null,this._visible=!0,this._attached=!1,this._renderGroup=p.Outline}destroy(){this._destroyResources()}get resources(){return this._resources!=null?this._resources.external:null}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this._syncGeometriesToRenderer())}get attached(){return this._attached}set attached(e){e!==this._attached&&(this._attached=e,this._createOrDestroyResources())}get renderGroup(){return this._renderGroup}set renderGroup(e){var r;this._renderGroup=e;const s=(r=this._resources)==null?void 0:r.layerView;s&&(s.renderGroup=e)}recreate(){this.attached&&this._createResources()}recreateGeometry(){this._resourceFactory.recreateGeometry?this._resources!=null&&(this._ensureRenderGeometriesRemoved(),this._resourceFactory.recreateGeometry(this._resources.external),this._syncGeometriesToRenderer()):this.recreate()}_createOrDestroyResources(){this._attached?this._resources==null&&this._createResources():this._destroyResources()}_createResources(){var i;this._destroyResources();const e=this._resourceFactory.createResources(),s=new o({view:this._resourceFactory.view,renderGroup:this._renderGroup}),r=(i=this._resourceFactory.view.basemapTerrain)==null?void 0:i.overlayManager;this._resources={layerView:new o({view:this._resourceFactory.view,renderGroup:this._renderGroup}),external:e,geometriesAdded:!1},r&&(this._resources.drapeSourceRenderer=r.registerGeometryDrapeSource(s)),this._syncGeometriesToRenderer()}_destroyResources(){var s;if(this._resources==null)return;this._ensureRenderGeometriesRemoved();const e=(s=this._resourceFactory.view.basemapTerrain)==null?void 0:s.overlayManager;e&&e.unregisterDrapeSource(this._resources.layerView),this._resourceFactory.destroyResources(this._resources.external),this._resources=null}_syncGeometriesToRenderer(){this._visible?this._ensureRenderGeometriesAdded():this._ensureRenderGeometriesRemoved()}_ensureRenderGeometriesRemoved(){var e;((e=this._resources)==null?void 0:e.drapeSourceRenderer)!=null&&this._resources.geometriesAdded&&(this._resources.drapeSourceRenderer.removeGeometries(this._resources.external.geometries,l.UPDATE),this._resources.geometriesAdded=!1)}_ensureRenderGeometriesAdded(){var e;((e=this._resources)==null?void 0:e.drapeSourceRenderer)!=null&&(this._resources.geometriesAdded||(this._resources.drapeSourceRenderer.addGeometries(this._resources.external.geometries,l.UPDATE),this._resources.geometriesAdded=!0))}}let o=class extends m(G){constructor(a){super(a),this.drapeSourceType=v.Features,this.updatePolicy=y.SYNC,this.renderGroup=p.Outline}};h([d({constructOnly:!0})],o.prototype,"view",void 0),h([d({readOnly:!0})],o.prototype,"drapeSourceType",void 0),h([d()],o.prototype,"renderGroup",void 0),o=h([b("DrapedVisualElementLayerView")],o);class j{constructor(e){this._resourceFactory=e,this._resources=null,this._visible=!0,this._attached=!1}destroy(){this._destroyResources()}get object(){return this._resources!=null?this._resources.object:null}get resources(){return this._resources!=null?this._resources.external:null}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this._syncVisible())}get attached(){return this._attached}set attached(e){e!==this._attached&&(this._attached=e,this._createOrDestroyResources())}recreate(){this.attached&&this._createResources()}recreateGeometry(){if(!this._resourceFactory.recreateGeometry)return void this.recreate();const e=this._resourceFactory.view._stage;if(this._resources==null||!e)return;const s=this._resources.object;this._resources.external.forEach(r=>{r.type!==t.Mesh&&r.type!==t.Line&&r.type!==t.Point||e.remove(r)}),s.removeAllGeometries(),this._resourceFactory.recreateGeometry(this._resources.external,s,this._resources.layer),this._resources.external.forEach(r=>{r.type!==t.Mesh&&r.type!==t.Line&&r.type!==t.Point||e.add(r)})}_createOrDestroyResources(){this._attached?this._resources||this._createResources():this._destroyResources()}_createResources(){this._destroyResources();const e=this._resourceFactory,s=e.view,r=s._stage;if(!r)return;const i=new g(r,{pickable:!1,updatePolicy:y.SYNC}),u=new w({castShadow:!1}),n=e.createResources(u,i);n.forEach(c=>{r.add(c),c.type===t.Texture&&c.load(r.renderView.renderingContext)}),r.add(u),i.add(u);const _=e.cameraChanged,R=_?D(()=>s.state.camera,c=>_(c),x):null;this._resources={layer:i,object:u,external:n,cameraHandle:R},this._syncVisible()}_destroyResources(){var s;if(this._resources==null)return;const e=this._resourceFactory.view._stage;e&&(e.remove(this._resources.object),this._resources.layer.destroy(),this._resources.external.forEach(r=>{e.remove(r),r.type===t.Texture&&r.unload()})),this._resources.object.dispose(),(s=this._resources.cameraHandle)==null||s.remove(),this._resourceFactory.destroyResources(this._resources.external),this._resources=null}_syncVisible(){this._resources!=null&&(this._resources.object.visible=this._visible)}}class V extends F{constructor(e){super(e),this._isDraped=!1,this.object3dResources=new j(this.createObject3DResourceFactory(e.view)),this.drapedResources=new f(this.createDrapedResourceFactory(e.view)),this.isDraped=e.isDraped??!1}get isDraped(){return this._isDraped}set isDraped(e){e!==this._isDraped&&(this._isDraped=e,this.object3dResources.attached=this.attached&&!e,this.drapedResources.attached=this.attached&&e)}get renderGroup(){return this.drapedResources.renderGroup}set renderGroup(e){this.drapedResources.renderGroup=e}createResources(){this.object3dResources.attached=!this._isDraped,this.drapedResources.attached=this._isDraped}destroyResources(){this.object3dResources.attached=!1,this.drapedResources.attached=!1}recreate(){this.object3dResources.recreate(),this.drapedResources.recreate()}recreateGeometry(){this.object3dResources.recreateGeometry(),this.drapedResources.recreateGeometry()}destroy(){this.object3dResources.destroy(),this.drapedResources.destroy(),super.destroy()}updateVisibility(e){this.object3dResources.visible=e,this.drapedResources.visible=e}}export{V as t}; diff --git a/dist/assets/EventedSet-JGlFrfoR.js b/dist/assets/EventedSet-TJfupI82.js similarity index 92% rename from dist/assets/EventedSet-JGlFrfoR.js rename to dist/assets/EventedSet-TJfupI82.js index 750b74e..ac79a63 100644 --- a/dist/assets/EventedSet-JGlFrfoR.js +++ b/dist/assets/EventedSet-TJfupI82.js @@ -1 +1 @@ -import{K as h,fq as r,fr as i}from"./index-J0iiHjMT.js";class d extends h{constructor(){super(...arguments),this._set=new Set}clear(){if(this._set.size>0){const e=this.toArray();this._set.clear(),this.emit("after-changes",{type:r.REMOVE}),this.emit("change",{added:[],removed:e})}}get length(){return this._set.size}addMany(e){if(e.length!==0){for(const t of e)this._set.add(t);this.emit("after-changes",{type:r.ADD}),this.emit("change",{added:e,removed:[]})}}remove(e){this._set.delete(e)&&(this.emit("after-changes",{type:r.REMOVE}),this.emit("change",{added:[],removed:[e]}))}removeMany(e){const t=[];for(const s of e)this._set.delete(s)&&t.push(s);t.length>0&&(this.emit("after-changes",{type:r.REMOVE}),this.emit("change",{added:[],removed:t}))}toArray(){return[...this._set]}find(e){let t;return i(this._set,s=>!!e(s)&&(t=s,!0)),t}forEach(e){this._set.forEach(t=>e(t))}}export{d as r}; +import{z as h,fl as r,fm as i}from"./index-pCX-0tJH.js";class d extends h{constructor(){super(...arguments),this._set=new Set}clear(){if(this._set.size>0){const e=this.toArray();this._set.clear(),this.emit("after-changes",{type:r.REMOVE}),this.emit("change",{added:[],removed:e})}}get length(){return this._set.size}addMany(e){if(e.length!==0){for(const t of e)this._set.add(t);this.emit("after-changes",{type:r.ADD}),this.emit("change",{added:e,removed:[]})}}remove(e){this._set.delete(e)&&(this.emit("after-changes",{type:r.REMOVE}),this.emit("change",{added:[],removed:[e]}))}removeMany(e){const t=[];for(const s of e)this._set.delete(s)&&t.push(s);t.length>0&&(this.emit("after-changes",{type:r.REMOVE}),this.emit("change",{added:[],removed:t}))}toArray(){return[...this._set]}find(e){let t;return i(this._set,s=>!!e(s)&&(t=s,!0)),t}forEach(e){this._set.forEach(t=>e(t))}}export{d as r}; diff --git a/dist/assets/ExtendedLineVisualElement-YbjiXiBG.js b/dist/assets/ExtendedLineVisualElement-VJvEdv3K.js similarity index 88% rename from dist/assets/ExtendedLineVisualElement-YbjiXiBG.js rename to dist/assets/ExtendedLineVisualElement-VJvEdv3K.js index 07f0dca..bb43c24 100644 --- a/dist/assets/ExtendedLineVisualElement-YbjiXiBG.js +++ b/dist/assets/ExtendedLineVisualElement-VJvEdv3K.js @@ -1 +1 @@ -import{a$ as C,b0 as P,aI as G,aa as o,b1 as S,b2 as u,aE as p,aU as T,b3 as f,aq as D,b4 as y,b5 as g,b6 as O,b7 as j,b8 as v,b9 as E,ba as M,bb as V,bc as I,bd as W,be as F,bf as m,bg as L,bh as _}from"./index-J0iiHjMT.js";import{r as w,t as N}from"./vec4f32-NvfHy9q7.js";import{t as $}from"./EngineVisualElement-eZNKTKsI.js";import{c as U}from"./Laserlines.glsl-nvjcCsAw.js";class B extends ${constructor(e){super(e),this._ray=G(),this._isWorldDown=!1,this._start=o(),this._end=S(1,0,0),this._width=1,this._color=w(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=w(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=a.LINE,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=u.OccludeAndTransparent,this._fadedExtensions=x,this._laserline=new U({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:t=>this._createObject3DResources(t),destroyResources:t=>this._destroyExternalResources(t),recreateGeometry:(t,s)=>this._recreateObject3DGeometry(t,s),cameraChanged:()=>this._updateGeometry()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:t=>this._destroyExternalResources(t),recreateGeometry:t=>this._recreateDrapedGeometry(t)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(e){this._isWorldDown=!0,p(this._start,e),this.view.renderCoordsHelper.worldUpAtPosition(e,this._end),T(this._end,e,this._end),f(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(e){this._isWorldDown=!1,D(this._start,e)||(p(this._start,e),f(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(e){this._isWorldDown=!1,D(this._end,e)||(p(this._end,e),f(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){y(e,this._color)||(g(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){y(e,this._innerColor)||(g(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e!=null&&this._stippleOffColor!=null&&y(e,this._stippleOffColor)||(this._stippleOffColor=e!=null?N(e):null,this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&this._laserlineStyle!=null&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===u.OccludeAndTransparentStencil?u.OccludeAndTransparent:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??x,this.recreateGeometry()}_updateMaterial(){var t,s;const{materialParameters:e}=this;(t=this.object3dResources.resources)==null||t.material.setParameters(e),(s=this.drapedResources.resources)==null||s.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,hasPolygonOffset:this._polygonOffset,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){const t=new O(this.materialParameters),s=new Array;return this._createObject3DGeometry(t,e,s),{material:t,geometries:s,forEach:r=>{r(t),s.forEach(r)}}}_destroyExternalResources(e){e.geometries=[]}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,s){const r=this._createGeometry(e);s.push(r),t.addGeometry(r),this._updateVerticesObject3D(t)}_createDrapedResources(){const e=new O(this.materialParameters);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){const t=this._createGeometry(e);return this._updateVerticesDraped(t),new j(t)}_createGeometry(e){const t=this.extensionType===a.FADED,s=t?[o(),o(),o(),o()]:[o(),o()];return v(e,s,null,t?[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0]:null)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this._lineSegment;this._updateVertexAttributesObject3D(e,t),this._laserline.intersectsLine=t}_updateVerticesDraped(e){this._updateVertexAttributesDraped(e,this._lineSegment)}get _lineSegment(){return this._extensionType===a.FADED?this._updateLineSegmentFinite(A):this._updateLineSegmentInfinite(this._extensionType,A)}_updateLineSegmentFinite(e){return E(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){const s=this.view.state.camera;switch(M(this._ray,l),e){case a.LINE:l.c0=-Number.MAX_VALUE;break;case a.RAY:case a.GROUND_RAY:{const i=this._ray.origin,c=this.view.elevationProvider.getElevation(i[0],i[1],i[2],this.view.renderCoordsHelper.spatialReference,"ground")??0,b=this.view.renderCoordsHelper.getAltitude(i);this._isWorldDown&&bthis._createObject3DResources(t),destroyResources:t=>this._destroyExternalResources(t),recreateGeometry:(t,s)=>this._recreateObject3DGeometry(t,s),cameraChanged:()=>this._updateGeometry()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:t=>this._destroyExternalResources(t),recreateGeometry:t=>this._recreateDrapedGeometry(t)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(e){this._isWorldDown=!0,p(this._start,e),this.view.renderCoordsHelper.worldUpAtPosition(e,this._end),j(this._end,e,this._end),f(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(e){this._isWorldDown=!1,D(this._start,e)||(p(this._start,e),f(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(e){this._isWorldDown=!1,D(this._end,e)||(p(this._end,e),f(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){y(e,this._color)||(g(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){y(e,this._innerColor)||(g(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e!=null&&this._stippleOffColor!=null&&y(e,this._stippleOffColor)||(this._stippleOffColor=e!=null?N(e):null,this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&this._laserlineStyle!=null&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===u.OccludeAndTransparentStencil?u.OccludeAndTransparent:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??x,this.recreateGeometry()}_updateMaterial(){var t,s;const{materialParameters:e}=this;(t=this.object3dResources.resources)==null||t.material.setParameters(e),(s=this.drapedResources.resources)==null||s.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,hasPolygonOffset:this._polygonOffset,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){const t=new O(this.materialParameters),s=new Array;return this._createObject3DGeometry(t,e,s),{material:t,geometries:s,forEach:r=>{r(t),s.forEach(r)}}}_destroyExternalResources(e){e.geometries=[]}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,s){const r=this._createGeometry(e);s.push(r),t.addGeometry(r),this._updateVerticesObject3D(t)}_createDrapedResources(){const e=new O(this.materialParameters);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){const t=this._createGeometry(e);return this._updateVerticesDraped(t),new T(t)}_createGeometry(e){const t=this.extensionType===a.FADED,s=t?[o(),o(),o(),o()]:[o(),o()];return v(e,s,null,t?[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0]:null)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this._lineSegment;this._updateVertexAttributesObject3D(e,t),this._laserline.intersectsLine=t}_updateVerticesDraped(e){this._updateVertexAttributesDraped(e,this._lineSegment)}get _lineSegment(){return this._extensionType===a.FADED?this._updateLineSegmentFinite(A):this._updateLineSegmentInfinite(this._extensionType,A)}_updateLineSegmentFinite(e){return w(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){const s=this.view.state.camera;switch(M(this._ray,l),e){case a.LINE:l.c0=-Number.MAX_VALUE;break;case a.RAY:case a.GROUND_RAY:{const i=this._ray.origin,c=this.view.elevationProvider.getElevation(i[0],i[1],i[2],this.view.renderCoordsHelper.spatialReference,"ground")??0,b=this.view.renderCoordsHelper.getAltitude(i);this._isWorldDown&&be.equals(t))}isOnService(r){return this.parts.every(e=>e.isOnService(r))}makeHash(){let r="";for(const e of this.parts)r+=e.partHash;return r}async toBlob(r){const{parts:e}=this;if(e.length===1)return e[0].toBlob(r);const t=await Promise.all(e.map(a=>a.toBlob(r)));return p(r),new Blob(t)}}class H{constructor(r,e){this.partUrl=r,this.partHash=e}equals(r){return this===r||this.partUrl===r.partUrl&&this.partHash===r.partHash}isOnService(r){return this.partUrl.startsWith(`${r.path}/assets/`)}async toBlob(r){const{data:e}=await g(this.partUrl,{responseType:"blob"});return p(r),e}}function M(s){return $(s==null?void 0:s.source)}function u(s){return Array.isArray(s)?s.every(r=>r instanceof m):!1}const c=/^(model\/gltf\+json)|(model\/gltf-binary)$/,f=/\.(gltf|glb)/i;function $(s){return s?Array.isArray(s)?s.some(l):l(s):!1}function l(s){if(s instanceof File){const{type:r,name:e}=s;return c.test(r)||f.test(e)}return c.test(s.assetMimeType)||f.test(s.assetName)}function O(s,r){if(!s)return!1;const{source:e}=s;return T(e,r)}function U(s,r){if(s===r)return!0;const{source:e}=s,{source:t}=r;if(e===t)return!0;if(u(e)&&u(t)){if(e.length!==t.length)return!1;const a=(n,o)=>n.assetNameo.assetName?1:0,i=[...e].sort(a),y=[...t].sort(a);for(let n=0;n0&&e.every(t=>h(t,r))}return h(s,r)}function h(s,r){return s instanceof m&&s.isOnService(r)}function q(s,r){return s instanceof File?N(s,r):A(s.assetMimeType,r)??v(s.assetName,r)}function S(s){return Array.isArray(s)?s:[s]}function d(s){return!!s.original}export{S as A,q as N,O as h,m as i,H as o,M as u,d as v,U as y}; diff --git a/dist/assets/External-Pb5poJ0S.js b/dist/assets/External-Pb5poJ0S.js new file mode 100644 index 0000000..7cf112d --- /dev/null +++ b/dist/assets/External-Pb5poJ0S.js @@ -0,0 +1 @@ +import{fj as b,ab as p,av as g,fk as N,an as v,ao as A}from"./index-pCX-0tJH.js";class m{constructor(r,s,t){this.assetName=r,this.assetMimeType=s,this.parts=t}equals(r){return this===r||this.assetName===r.assetName&&this.assetMimeType===r.assetMimeType&&b(this.parts,r.parts,(s,t)=>s.equals(t))}isOnService(r){return this.parts.every(s=>s.isOnService(r))}makeHash(){let r="";for(const s of this.parts)r+=s.partHash;return r}async toBlob(r){const{parts:s}=this;if(s.length===1)return s[0].toBlob(r);const t=await Promise.all(s.map(a=>a.toBlob(r)));return p(r),new Blob(t)}}class H{constructor(r,s){this.partUrl=r,this.partHash=s}equals(r){return this===r||this.partUrl===r.partUrl&&this.partHash===r.partHash}isOnService(r){return this.partUrl.startsWith(`${r.path}/assets/`)}async toBlob(r){const{data:s}=await g(this.partUrl,{responseType:"blob"});return p(r),s}}function M(e){return $(e==null?void 0:e.source)}function u(e){return Array.isArray(e)?e.every(r=>r instanceof m):!1}const c=/^(model\/gltf\+json)|(model\/gltf-binary)$/,f=/\.(gltf|glb)/i;function $(e){return e?Array.isArray(e)?e.some(l):l(e):!1}function l(e){if(e instanceof File){const{type:r,name:s}=e;return c.test(r)||f.test(s)}return c.test(e.assetMimeType)||f.test(e.assetName)}function U(e,r){if(!e)return!1;const{source:s}=e;return T(s,r)}function q(e,r){if(e===r)return!0;const{source:s}=e,{source:t}=r;if(s===t)return!0;if(u(s)&&u(t)){if(s.length!==t.length)return!1;const a=(n,o)=>n.assetNameo.assetName?1:0,i=[...s].sort(a),y=[...t].sort(a);for(let n=0;n0&&s.every(t=>h(t,r))}return h(e,r)}function h(e,r){return e instanceof m&&e.isOnService(r)}function O(e,r){return e instanceof File?N(e,r):v(e.assetMimeType,r)??A(e.assetName,r)}function S(e){return Array.isArray(e)?e:[e]}function d(e){return!!e.original}export{S as A,O as N,U as h,m as i,H as o,M as u,d as v,q as y}; diff --git a/dist/assets/Factory-m-O4WAoG.js b/dist/assets/Factory-EVPOwZPk.js similarity index 97% rename from dist/assets/Factory-m-O4WAoG.js rename to dist/assets/Factory-EVPOwZPk.js index 35f86b4..e3a4663 100644 --- a/dist/assets/Factory-m-O4WAoG.js +++ b/dist/assets/Factory-EVPOwZPk.js @@ -1,4 +1,4 @@ -import{fz as r}from"./index-J0iiHjMT.js";const s="theme-style";function m(c,t){return u(M(g(N(c),t)),t.size)}function g(c,{accentColor:t,contrastColor:o}){const a=t.toHex(),i=t.a,n=o.toHex(),e=o.a,l=c.getElementsByTagNameNS("http://www.w3.org/2000/svg","style").namedItem(s);return l&&(l.innerHTML=` +import{fu as r}from"./index-pCX-0tJH.js";const s="theme-style";function m(c,t){return u(M(g(N(c),t)),t.size)}function g(c,{accentColor:t,contrastColor:o}){const a=t.toHex(),i=t.a,n=o.toHex(),e=o.a,l=c.getElementsByTagNameNS("http://www.w3.org/2000/svg","style").namedItem(s);return l&&(l.innerHTML=` .contrast-fill { fill: ${n}; fill-opacity: ${e}; } .contrast-stroke { stroke: ${n}; stroke-opacity: ${e}; } .accent-fill { fill: ${a}; fill-opacity: ${i}; } diff --git a/dist/assets/FeatureCollectionSnappingSource-AwpfuxVk.js b/dist/assets/FeatureCollectionSnappingSource-AwpfuxVk.js deleted file mode 100644 index a2e4e19..0000000 --- a/dist/assets/FeatureCollectionSnappingSource-AwpfuxVk.js +++ /dev/null @@ -1 +0,0 @@ -import{p as E,gC as F,d as h,P as d,fl as V,gD as C,gE as D,gF as $,s as p,e as o,y as r,c as A,gG as I}from"./index-J0iiHjMT.js";import{o as G,a as P}from"./queryEngineUtils-0F1SWi13.js";import{i as v,r as q,n as S}from"./symbologySnappingCandidates-Sz0MFOvR.js";import"./VertexSnappingCandidate-sgrBHAMS.js";import"./PointSnappingHint-ULetRXiW.js";let a=class extends E{get availability(){return 1}get updating(){return this.layerSource.updating}get _snappingElevationAligner(){const{view:e}=this,{layer:t}=this.layerSource,i=e!=null&&e.type==="3d";if(!i||t.type==="subtype-group")return v();const n=async(l,s)=>(await I(e.whenLayerView(t),s)).elevationAlignPointsInFeatures(l,s);return v(i,{elevationInfo:t.elevationInfo,alignPointsInFeatures:n})}get _snappingElevationFilter(){const{view:e}=this,t=e!=null&&e.type==="3d"&&this.layerSource.layer.type!=="subtype-group";return q(t)}get _symbologySnappingFetcher(){const{view:e}=this,{layer:t}=this.layerSource;return e!=null&&e.type==="3d"&&t.type!=="subtype-group"?S(this._symbologySnappingSupported,async(i,n)=>{const l=await e.whenLayerView(t);return p(n),l.queryForSymbologySnapping({candidates:i,spatialReference:e.spatialReference},n)}):S()}get _symbologySnappingSupported(){return this._layerView3D!=null&&this._layerView3D.symbologySnappingSupported}initialize(){const{view:e}=this,{layer:t}=this.layerSource;e!=null&&e.type==="3d"&&t.type!=="subtype-group"&&(e.whenLayerView(t).then(i=>this._layerView3D=i),this.addHandles([e.elevationProvider.on("elevation-change",({context:i})=>{const{elevationInfo:n}=t;F(i,n)&&this._snappingElevationAligner.notifyElevationSourceChange()}),h(()=>t.elevationInfo,()=>this._snappingElevationAligner.notifyElevationSourceChange(),d),h(()=>{var i;return this._layerView3D!=null?(i=this._layerView3D.processor)==null?void 0:i.renderer:null},()=>this._symbologySnappingFetcher.notifySymbologyChange(),d),V(()=>{var i;return(i=this._layerView3D)==null?void 0:i.layer},["edits","apply-edits","graphic-update"],()=>this._symbologySnappingFetcher.notifySymbologyChange())]))}constructor(e){super(e),this.view=null,this._layerView3D=null,this._memoizedMakeGetGroundElevation=C(G)}refresh(){}async fetchCandidates(e,t){var c;const{layer:i}=this.layerSource,n=i.source;if(!(n!=null&&n.querySnapping))return[];const l=D(i),s=$(e,((c=this.view)==null?void 0:c.type)??"2d",l),w=await n.querySnapping(s,{signal:t});p(t);const g=e.coordinateHelper.spatialReference,y=await this._snappingElevationAligner.alignCandidates(w.candidates,g,t);p(t);const u=await this._symbologySnappingFetcher.fetch(y,t);p(t);const m=u.length===0?y:[...y,...u],_=this._snappingElevationFilter.filter(s,m),f=this._memoizedMakeGetGroundElevation(this.view,g);return _.map(b=>P(b,f))}};o([r({constructOnly:!0})],a.prototype,"layerSource",void 0),o([r({constructOnly:!0})],a.prototype,"view",void 0),o([r()],a.prototype,"_snappingElevationAligner",null),o([r()],a.prototype,"_snappingElevationFilter",null),o([r()],a.prototype,"_symbologySnappingFetcher",null),o([r()],a.prototype,"_layerView3D",void 0),o([r()],a.prototype,"_symbologySnappingSupported",null),a=o([A("esri.views.interactive.snapping.featureSources.FeatureCollectionSnappingSource")],a);export{a as FeatureCollectionSnappingSource}; diff --git a/dist/assets/FeatureCollectionSnappingSource-noadiOim.js b/dist/assets/FeatureCollectionSnappingSource-noadiOim.js new file mode 100644 index 0000000..396a9b7 --- /dev/null +++ b/dist/assets/FeatureCollectionSnappingSource-noadiOim.js @@ -0,0 +1 @@ +import{g as E,gz as F,B as h,P as d,fg as V,gA as C,gB as D,gC as A,ab as p,e as o,y as r,c as $,gD as I}from"./index-pCX-0tJH.js";import{o as P,a as z}from"./queryEngineUtils-bbt-XRJJ.js";import{i as v,r as G,n as S}from"./symbologySnappingCandidates-d1xE3f-Q.js";import"./VertexSnappingCandidate-YEvkEqQJ.js";import"./PointSnappingHint-bwlQAyn6.js";let a=class extends E{get availability(){return 1}get updating(){return this.layerSource.updating}get _snappingElevationAligner(){const{view:e}=this,{layer:t}=this.layerSource,i=e!=null&&e.type==="3d";if(!i||t.type==="subtype-group")return v();const n=async(l,s)=>(await I(e.whenLayerView(t),s)).elevationAlignPointsInFeatures(l,s);return v(i,{elevationInfo:t.elevationInfo,alignPointsInFeatures:n})}get _snappingElevationFilter(){const{view:e}=this,t=e!=null&&e.type==="3d"&&this.layerSource.layer.type!=="subtype-group";return G(t)}get _symbologySnappingFetcher(){const{view:e}=this,{layer:t}=this.layerSource;return e!=null&&e.type==="3d"&&t.type!=="subtype-group"?S(this._symbologySnappingSupported,async(i,n)=>{const l=await e.whenLayerView(t);return p(n),l.queryForSymbologySnapping({candidates:i,spatialReference:e.spatialReference},n)}):S()}get _symbologySnappingSupported(){return this._layerView3D!=null&&this._layerView3D.symbologySnappingSupported}initialize(){const{view:e}=this,{layer:t}=this.layerSource;e!=null&&e.type==="3d"&&t.type!=="subtype-group"&&(e.whenLayerView(t).then(i=>this._layerView3D=i),this.addHandles([e.elevationProvider.on("elevation-change",({context:i})=>{const{elevationInfo:n}=t;F(i,n)&&this._snappingElevationAligner.notifyElevationSourceChange()}),h(()=>t.elevationInfo,()=>this._snappingElevationAligner.notifyElevationSourceChange(),d),h(()=>{var i;return this._layerView3D!=null?(i=this._layerView3D.processor)==null?void 0:i.renderer:null},()=>this._symbologySnappingFetcher.notifySymbologyChange(),d),V(()=>{var i;return(i=this._layerView3D)==null?void 0:i.layer},["edits","apply-edits","graphic-update"],()=>this._symbologySnappingFetcher.notifySymbologyChange())]))}constructor(e){super(e),this.view=null,this._layerView3D=null,this._memoizedMakeGetGroundElevation=C(P)}refresh(){}async fetchCandidates(e,t){var c;const{layer:i}=this.layerSource,n=i.source;if(!(n!=null&&n.querySnapping))return[];const l=D(i),s=A(e,((c=this.view)==null?void 0:c.type)??"2d",l),w=await n.querySnapping(s,{signal:t});p(t);const g=e.coordinateHelper.spatialReference,y=await this._snappingElevationAligner.alignCandidates(w.candidates,g,t);p(t);const u=await this._symbologySnappingFetcher.fetch(y,t);p(t);const m=u.length===0?y:[...y,...u],_=this._snappingElevationFilter.filter(s,m),f=this._memoizedMakeGetGroundElevation(this.view,g);return _.map(b=>z(b,f))}};o([r({constructOnly:!0})],a.prototype,"layerSource",void 0),o([r({constructOnly:!0})],a.prototype,"view",void 0),o([r()],a.prototype,"_snappingElevationAligner",null),o([r()],a.prototype,"_snappingElevationFilter",null),o([r()],a.prototype,"_symbologySnappingFetcher",null),o([r()],a.prototype,"_layerView3D",void 0),o([r()],a.prototype,"_symbologySnappingSupported",null),a=o([$("esri.views.interactive.snapping.featureSources.FeatureCollectionSnappingSource")],a);export{a as FeatureCollectionSnappingSource}; diff --git a/dist/assets/FeatureEffect-5bEV-xG1.js b/dist/assets/FeatureEffect-0Jn9Z0sQ.js similarity index 86% rename from dist/assets/FeatureEffect-5bEV-xG1.js rename to dist/assets/FeatureEffect-0Jn9Z0sQ.js index 4969b52..3e903e0 100644 --- a/dist/assets/FeatureEffect-5bEV-xG1.js +++ b/dist/assets/FeatureEffect-0Jn9Z0sQ.js @@ -1 +1 @@ -import{e as s,y as u,dC as y,dD as c,c as E,dE as h,dF as b,dr as x,E as f}from"./index-J0iiHjMT.js";var n;const a={read:{reader:h},write:{writer:b,overridePolicy(){return{allowNull:this.excludedEffect!=null,isRequired:this.excludedEffect==null}}}},p={read:{reader:h},write:{writer:b,overridePolicy(){return{allowNull:this.includedEffect!=null,isRequired:this.includedEffect==null}}}},w={name:"showExcludedLabels",default:!0};let r=n=class extends x{constructor(l){super(l),this.filter=null,this.includedEffect=null,this.excludedEffect=null,this.excludedLabelsVisible=!1}write(l,e){var d,i;const t=super.write(l,e);if(e!=null&&e.origin){if(t.filter){const o=Object.keys(t.filter);if(o.length>1||o[0]!=="where")return(d=e.messages)==null||d.push(new f("web-document-write:unsupported-feature-effect","Invalid feature effect 'filter'. A filter can only contain a 'where' property",{layer:e.layer,effect:this})),null}if("showExcludedLabels"in t)return(i=e.messages)==null||i.push(new f("web-document-write:unsupported-feature-effect","Invalid value for property 'excludedLabelsVisible' which should always be 'true'",{layer:e.layer,effect:this})),null}return t}clone(){return new n({filter:this.filter!=null?this.filter.clone():null,includedEffect:this.includedEffect,excludedEffect:this.excludedEffect,excludedLabelsVisible:this.excludedLabelsVisible})}};s([u({type:y,json:{write:{allowNull:!0,writer(l,e,t,d){const i=l==null?void 0:l.write({},d);i&&Object.keys(i).length!==0?c(t,i,e):c(t,null,e)}}}})],r.prototype,"filter",void 0),s([u({json:{write:!0,origins:{"web-map":a,"portal-item":a}}})],r.prototype,"includedEffect",void 0),s([u({json:{write:!0,origins:{"web-map":p,"portal-item":p}}})],r.prototype,"excludedEffect",void 0),s([u({type:Boolean,json:{write:!0,name:"showExcludedLabels",origins:{"web-map":w,"portal-item":w}}})],r.prototype,"excludedLabelsVisible",void 0),r=n=s([E("esri.layers.support.FeatureEffect")],r);const v=r;export{v as w}; +import{e as s,y as u,dx as y,dy as c,c as x,dz as h,dA as b,dr as E,r as f}from"./index-pCX-0tJH.js";var n;const a={read:{reader:h},write:{writer:b,overridePolicy(){return{allowNull:this.excludedEffect!=null,isRequired:this.excludedEffect==null}}}},p={read:{reader:h},write:{writer:b,overridePolicy(){return{allowNull:this.includedEffect!=null,isRequired:this.includedEffect==null}}}},w={name:"showExcludedLabels",default:!0};let r=n=class extends E{constructor(l){super(l),this.filter=null,this.includedEffect=null,this.excludedEffect=null,this.excludedLabelsVisible=!1}write(l,e){var d,i;const t=super.write(l,e);if(e!=null&&e.origin){if(t.filter){const o=Object.keys(t.filter);if(o.length>1||o[0]!=="where")return(d=e.messages)==null||d.push(new f("web-document-write:unsupported-feature-effect","Invalid feature effect 'filter'. A filter can only contain a 'where' property",{layer:e.layer,effect:this})),null}if("showExcludedLabels"in t)return(i=e.messages)==null||i.push(new f("web-document-write:unsupported-feature-effect","Invalid value for property 'excludedLabelsVisible' which should always be 'true'",{layer:e.layer,effect:this})),null}return t}clone(){return new n({filter:this.filter!=null?this.filter.clone():null,includedEffect:this.includedEffect,excludedEffect:this.excludedEffect,excludedLabelsVisible:this.excludedLabelsVisible})}};s([u({type:y,json:{write:{allowNull:!0,writer(l,e,t,d){const i=l==null?void 0:l.write({},d);i&&Object.keys(i).length!==0?c(t,i,e):c(t,null,e)}}}})],r.prototype,"filter",void 0),s([u({json:{write:!0,origins:{"web-map":a,"portal-item":a}}})],r.prototype,"includedEffect",void 0),s([u({json:{write:!0,origins:{"web-map":p,"portal-item":p}}})],r.prototype,"excludedEffect",void 0),s([u({type:Boolean,json:{write:!0,name:"showExcludedLabels",origins:{"web-map":w,"portal-item":w}}})],r.prototype,"excludedLabelsVisible",void 0),r=n=s([x("esri.layers.support.FeatureEffect")],r);const v=r;export{v as w}; diff --git a/dist/assets/FeatureEffectLayer-oBa8pIG5.js b/dist/assets/FeatureEffectLayer-OK0TB5f6.js similarity index 67% rename from dist/assets/FeatureEffectLayer-oBa8pIG5.js rename to dist/assets/FeatureEffectLayer-OK0TB5f6.js index 1f714d9..97d1447 100644 --- a/dist/assets/FeatureEffectLayer-oBa8pIG5.js +++ b/dist/assets/FeatureEffectLayer-OK0TB5f6.js @@ -1 +1 @@ -import{e as t,y as s,c as i}from"./index-J0iiHjMT.js";import{w as a}from"./FeatureEffect-5bEV-xG1.js";const r={write:{allowNull:!0}},p=o=>{let e=class extends o{constructor(){super(...arguments),this.featureEffect=null}};return t([s({type:a,json:{origins:{"web-map":r,"portal-item":r}}})],e.prototype,"featureEffect",void 0),e=t([i("esri.layers.mixins.FeatureEffectLayer")],e),e};export{p}; +import{e as t,y as s,c as i}from"./index-pCX-0tJH.js";import{w as a}from"./FeatureEffect-0Jn9Z0sQ.js";const r={write:{allowNull:!0}},p=o=>{let e=class extends o{constructor(){super(...arguments),this.featureEffect=null}};return t([s({type:a,json:{origins:{"web-map":r,"portal-item":r}}})],e.prototype,"featureEffect",void 0),e=t([i("esri.layers.mixins.FeatureEffectLayer")],e),e};export{p}; diff --git a/dist/assets/FeatureFilter-_YQPNaln.js b/dist/assets/FeatureFilter-_YQPNaln.js new file mode 100644 index 0000000..a8d7968 --- /dev/null +++ b/dist/assets/FeatureFilter-_YQPNaln.js @@ -0,0 +1 @@ +import{R as m,kD as u,r as p,cf as c,aL as _,eG as y}from"./index-pCX-0tJH.js";import{a as f,v as w,t as I}from"./QueryEngine-uvDs-vBe.js";import{I as b}from"./Pipeline-PlEwhMAg.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./StreamFeatureManager-Iguqr18K.js";import"./quickselect-0UUnLNDW.js";import"./labelPoint-1MOq4I_J.js";import"./ogcFeatureUtils-8dWL_GtH.js";import"./geojson-162a_hNo.js";import"./date-be_IQzZd.js";import"./clientSideDefaults-63pOkJ4Y.js";import"./createConnection-iXdhuUHv.js";import"./definitions-SVBNHUSH.js";import"./enums-uQoFEhYh.js";import"./number-sTjsTbdA.js";import"./geohashUtils-U0jvYCSY.js";const d=m.getLogger("esri.views.2d.layers.features.support.whereUtils"),g={getAttribute:(r,e)=>r.readAttribute(e)};async function T(r,e){try{const t=await u(r,e);if(!t.isStandardized){const i=new p("mapview - bad input","Unable to apply filter's definition expression, as expression is not standardized.",t);d.error(i)}return i=>{const s=i.readArcadeFeature();return t.testFeature(s,g)}}catch{return d.warn("mapview-bad-where-clause","Encountered an error when evaluating where clause",r),i=>!0}}const a=1,v=2;class D{constructor(e){this._geometryBounds=c(),this._idToVisibility=new Map,this._serviceInfo=e}get hash(){return this._hash}check(e){return this._applyFilter(e)}clear(){const e=this._resetAllHiddenIds();return this.update(),{show:e,hide:[]}}invalidate(){this._idToVisibility.forEach((e,t)=>{this._idToVisibility.set(t,0)})}setKnownIds(e){for(const t of e)this._idToVisibility.set(t,a)}setTrue(e){const t=[],i=[],s=new Set(e);return this._idToVisibility.forEach((h,o)=>{const l=!!(this._idToVisibility.get(o)&a),n=s.has(o);!l&&n?t.push(o):l&&!n&&i.push(o),this._idToVisibility.set(o,n?a|v:0)}),{show:t,hide:i}}createQuery(){const{geometry:e,spatialRel:t,where:i,timeExtent:s,objectIds:h}=this;return _.fromJSON({geometry:e,spatialRel:t,where:i,timeExtent:s,objectIds:h})}async update(e,t){this._hash=JSON.stringify(e);const i=await f(e,null,t);await Promise.all([this._setGeometryFilter(i),this._setIdFilter(i),this._setAttributeFilter(i),this._setTimeFilter(i)])}async _setAttributeFilter(e){if(!(e!=null&&e.where))return this._clause=null,void(this.where=null);this._clause=await T(e.where,this._serviceInfo.fieldsIndex),this.where=e.where}_setIdFilter(e){this._idsToShow=(e==null?void 0:e.objectIds)&&new Set(e.objectIds),this._idsToHide=(e==null?void 0:e.hiddenIds)&&new Set(e.hiddenIds),this.objectIds=e==null?void 0:e.objectIds}async _setGeometryFilter(e){if(!(e!=null&&e.geometry))return this._spatialQueryOperator=null,this.geometry=null,void(this.spatialRel=null);const t=e.geometry,i=e.spatialRel||"esriSpatialRelIntersects",s=await w(i,t,this._serviceInfo.geometryType,this._serviceInfo.hasZ,this._serviceInfo.hasM);y(this._geometryBounds,t),this._spatialQueryOperator=s,this.geometry=t,this.spatialRel=i}_setTimeFilter(e){if(this.timeExtent=this._timeOperator=null,e==null?void 0:e.timeExtent)if(this._serviceInfo.timeInfo)this.timeExtent=e.timeExtent,this._timeOperator=I(this._serviceInfo.timeInfo,e.timeExtent,b);else{const t=new p("feature-layer-view:time-filter-not-available","Unable to apply time filter, as layer doesn't have time metadata.",e.timeExtent);m.getLogger("esri.views.2d.layers.features.controllers.FeatureFilter").error(t)}}_applyFilter(e){return this._filterByGeometry(e)&&this._filterById(e)&&this._filterByTime(e)&&this._filterByExpression(e)}_filterByExpression(e){return!this.where||this._clause(e)}_filterById(e){var t,i;return(!((t=this._idsToHide)!=null&&t.size)||!this._idsToHide.has(e.getObjectId()))&&(!((i=this._idsToShow)!=null&&i.size)||this._idsToShow.has(e.getObjectId()))}_filterByGeometry(e){if(!this.geometry)return!0;const t=e.readHydratedGeometry();return!!t&&this._spatialQueryOperator(t)}_filterByTime(e){return this._timeOperator==null||this._timeOperator(e)}_resetAllHiddenIds(){const e=[];return this._idToVisibility.forEach((t,i)=>{t&a||(this._idToVisibility.set(i,a),e.push(i))}),e}}export{D as default}; diff --git a/dist/assets/FeatureFilter-w5_DYl72.js b/dist/assets/FeatureFilter-w5_DYl72.js deleted file mode 100644 index 5cba616..0000000 --- a/dist/assets/FeatureFilter-w5_DYl72.js +++ /dev/null @@ -1 +0,0 @@ -import{Z as m,kv as u,E as p,ae as c,ca as _,eL as y}from"./index-J0iiHjMT.js";import{a as f,v as w,t as I}from"./QueryEngine-8tLWlkSE.js";import{I as b}from"./Pipeline--6jAENf8.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./StreamFeatureManager-QrKJ84_c.js";import"./quickselect-UFB0jJTZ.js";import"./labelPoint-ysDT9nFH.js";import"./ogcFeatureUtils-dtzP0u64.js";import"./geojson-fSjaGZrp.js";import"./date-be_IQzZd.js";import"./clientSideDefaults-F-CNnR0g.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./createConnection-4ppGVnSc.js";import"./definitions-DqQMJYPH.js";import"./enums-uQoFEhYh.js";import"./number-sTjsTbdA.js";import"./geohashUtils-U0jvYCSY.js";const d=m.getLogger("esri.views.2d.layers.features.support.whereUtils"),g={getAttribute:(r,e)=>r.readAttribute(e)};async function T(r,e){try{const t=await u(r,e);if(!t.isStandardized){const i=new p("mapview - bad input","Unable to apply filter's definition expression, as expression is not standardized.",t);d.error(i)}return i=>{const s=i.readArcadeFeature();return t.testFeature(s,g)}}catch{return d.warn("mapview-bad-where-clause","Encountered an error when evaluating where clause",r),i=>!0}}const a=1,v=2;class C{constructor(e){this._geometryBounds=c(),this._idToVisibility=new Map,this._serviceInfo=e}get hash(){return this._hash}check(e){return this._applyFilter(e)}clear(){const e=this._resetAllHiddenIds();return this.update(),{show:e,hide:[]}}invalidate(){this._idToVisibility.forEach((e,t)=>{this._idToVisibility.set(t,0)})}setKnownIds(e){for(const t of e)this._idToVisibility.set(t,a)}setTrue(e){const t=[],i=[],s=new Set(e);return this._idToVisibility.forEach((h,o)=>{const l=!!(this._idToVisibility.get(o)&a),n=s.has(o);!l&&n?t.push(o):l&&!n&&i.push(o),this._idToVisibility.set(o,n?a|v:0)}),{show:t,hide:i}}createQuery(){const{geometry:e,spatialRel:t,where:i,timeExtent:s,objectIds:h}=this;return _.fromJSON({geometry:e,spatialRel:t,where:i,timeExtent:s,objectIds:h})}async update(e,t){this._hash=JSON.stringify(e);const i=await f(e,null,t);await Promise.all([this._setGeometryFilter(i),this._setIdFilter(i),this._setAttributeFilter(i),this._setTimeFilter(i)])}async _setAttributeFilter(e){if(!(e!=null&&e.where))return this._clause=null,void(this.where=null);this._clause=await T(e.where,this._serviceInfo.fieldsIndex),this.where=e.where}_setIdFilter(e){this._idsToShow=(e==null?void 0:e.objectIds)&&new Set(e.objectIds),this._idsToHide=(e==null?void 0:e.hiddenIds)&&new Set(e.hiddenIds),this.objectIds=e==null?void 0:e.objectIds}async _setGeometryFilter(e){if(!(e!=null&&e.geometry))return this._spatialQueryOperator=null,this.geometry=null,void(this.spatialRel=null);const t=e.geometry,i=e.spatialRel||"esriSpatialRelIntersects",s=await w(i,t,this._serviceInfo.geometryType,this._serviceInfo.hasZ,this._serviceInfo.hasM);y(this._geometryBounds,t),this._spatialQueryOperator=s,this.geometry=t,this.spatialRel=i}_setTimeFilter(e){if(this.timeExtent=this._timeOperator=null,e==null?void 0:e.timeExtent)if(this._serviceInfo.timeInfo)this.timeExtent=e.timeExtent,this._timeOperator=I(this._serviceInfo.timeInfo,e.timeExtent,b);else{const t=new p("feature-layer-view:time-filter-not-available","Unable to apply time filter, as layer doesn't have time metadata.",e.timeExtent);m.getLogger("esri.views.2d.layers.features.controllers.FeatureFilter").error(t)}}_applyFilter(e){return this._filterByGeometry(e)&&this._filterById(e)&&this._filterByTime(e)&&this._filterByExpression(e)}_filterByExpression(e){return!this.where||this._clause(e)}_filterById(e){var t,i;return(!((t=this._idsToHide)!=null&&t.size)||!this._idsToHide.has(e.getObjectId()))&&(!((i=this._idsToShow)!=null&&i.size)||this._idsToShow.has(e.getObjectId()))}_filterByGeometry(e){if(!this.geometry)return!0;const t=e.readHydratedGeometry();return!!t&&this._spatialQueryOperator(t)}_filterByTime(e){return this._timeOperator==null||this._timeOperator(e)}_resetAllHiddenIds(){const e=[];return this._idToVisibility.forEach((t,i)=>{t&a||(this._idToVisibility.set(i,a),e.push(i))}),e}}export{C as default}; diff --git a/dist/assets/FeatureLayer--S4epFk-.js b/dist/assets/FeatureLayer--S4epFk-.js deleted file mode 100644 index 254df4b..0000000 --- a/dist/assets/FeatureLayer--S4epFk-.js +++ /dev/null @@ -1,7 +0,0 @@ -import{ij as H,cZ as U,E as f,dT as B,l as K,g1 as Y,dJ as X,Z as T,j5 as L,e as a,mq as ee,S as x,iy as te,y as n,c as E,V as C,p as ie,jp as re,dK as se,el as ae,dO as oe,dL as ne,em as le,dM as ue,dN as de,dP as pe,en as ye,dq as ce,ar as he,ah as me,dQ as fe,jq as ge,jr as be,dD as I,mr as we,ms as ve,bV as _e,h6 as P,iF as R,ja as Fe,jb as Se,js as Te,df as Ie,mt as Ee,jt as je,ju as $e,jv as De,mu as Oe,il as qe,gG as Ce,de as G,jh as Me,ji as Le,jw as xe,jx as Pe,jy as Re,ca as Ge,jz as Ae,jA as Ne,jB as Je,jC as Ve,jD as ke,jc as _,bW as Qe,iG as We,dl as Ze,jE as ze,dt as y,mv as He,iY as Ue,du as j,mw as A,dU as Be,iI as Ke,iJ as Ye,iK as $,mx as N,bI as D,jH as Xe,dV as et,my as tt,iu as it,iv as rt,iM as st,it as at,iN as ot,f6 as nt,jF as lt,ix as ut,c7 as dt,mz as pt}from"./index-J0iiHjMT.js";import{D as yt,y as ct}from"./FeatureLayerBase-jpFp8gE3.js";import{i as ht}from"./editsZScale-Wgw9kbYG.js";import{t as J}from"./queryZScale-IaMm02_2.js";import{d as k}from"./FeatureSet-d4S1oKME.js";import{o as mt}from"./CustomParametersMixin-Y1bOcayO.js";import{p as ft}from"./FeatureEffectLayer-oBa8pIG5.js";import{c as gt}from"./FeatureReductionLayer-RlitE1N6.js";import{c as bt}from"./OrderedLayer-M7k5gLgx.js";import{p as Q}from"./FeatureTemplate-kUgbbA00.js";import{n as W}from"./FeatureType-MpRe7WJj.js";import{a as wt}from"./serviceCapabilitiesUtils-26KpT1VN.js";import{e as vt}from"./versionUtils-4v9zIDlv.js";import{S as F}from"./TopFeaturesQuery-E6D2tV-x.js";import"./FeatureEffect-5bEV-xG1.js";let _t=0,g=class extends H.LoadableMixin(U(C)){constructor(e){super(e),this._idToClientGraphic=null,this.type="memory"}load(e){const t=e!=null?e.signal:null;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){var e;(e=this._connection)==null||e.close(),this._connection=null}get _workerGeometryType(){var t;const e=(t=this.layer)==null?void 0:t.geometryType;return e?this._geometryTypeRequiresClientGraphicMapping(e)?"polygon":e:null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}async queryFeatures(e,t={}){await this.load(t);const i=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t);J(e,this.layer.spatialReference,i);const r=k.fromJSON(i);if(!this._requiresClientGraphicMapping())return r;const s=this.layer.objectIdField;for(const l of r.features){const u=l.attributes[s],c=this._idToClientGraphic.get(u);c&&(l.geometry=c.geometry)}return r.geometryType=this.layer.geometryType,r}async queryFeaturesJSON(e,t={}){if(this._requiresClientGraphicMapping())throw new f("query-features-json:unsupported","Cannot query in JSON format for client only geometry types (mesh and extent)");await this.load(t);const i=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t);return J(e,this.layer.spatialReference,i),i}queryFeatureCount(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t))}queryObjectIds(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryObjectIds",e?e.toJSON():null,t))}queryExtent(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryExtent",e?e.toJSON():null,t)).then(i=>({count:i.count,extent:B.fromJSON(i.extent)}))}querySnapping(e,t={}){return this.load(t).then(()=>this._connection.invoke("querySnapping",e,t))}async _applyEdits(e){if(!this._connection)throw new f("feature-layer-source:edit-failure","Memory source not loaded");const t=this.layer.objectIdField;let i=null;const r=[],s=[];await Promise.all([this._prepareClientMapping(e.addFeatures,null),this._prepareClientMapping(e.updateFeatures,null)]);const l=d=>"objectId"in d&&d.objectId!=null?d.objectId:"attributes"in d&&d.attributes[t]!=null?d.attributes[t]:null;if(e.addFeatures&&(i=this._prepareAddFeatures(e.addFeatures)),e.deleteFeatures)for(const d of e.deleteFeatures){const m=l(d);m!=null&&r.push(m)}const u=e.updateFeatures&&this._idToClientGraphic?new Map:null;if(e.updateFeatures){for(const d of e.updateFeatures)if(s.push(this._serializeFeature(d)),u){const m=l(d);m!=null&&u.set(m,d)}}ht(i?i.features:null,s,this.layer.spatialReference);const{fullExtent:c,featureEditResults:p}=await this._connection.invoke("applyEdits",{adds:i?i.features:[],updates:s,deletes:r});return this.fullExtent=c,i&&i.finish(p.uidToObjectId),this._updateClientGraphicIds(u,p),this._createEditsResult(p)}async _prepareClientMapping(e,t){if(this._layerOrSourceGeometryType!=="mesh"||e==null)return;const i=[];for(const{geometry:r}of e)r==null||r.type!=="mesh"||r.hasExtent||r.loaded||i.push(r.load({signal:t}));i.length&&await Promise.all(i)}_updateClientGraphicIds(e,t){if(this._idToClientGraphic){if(e)for(const i of t.updateResults){if(!i.success)continue;const r=e.get(i.objectId);r!=null&&this._addIdToClientGraphic(r)}for(const i of t.deleteResults)i.success&&this._idToClientGraphic.delete(i.objectId)}}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){const t=e.success===!0?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new f("feature-layer-source:edit-failure",t.description,{code:t.code}):null}}_prepareAddFeatures(e){const t=new Map,i=new Array(e.length);let r=null;for(let l=0;l{T.getLogger(this).error("Source modifications will not propagate after layer has been loaded. Please use .applyEdits() instead"),w.preventDefault()}));const m={features:d.features,fields:t==null?void 0:t.map(w=>w.toJSON()),geometryType:L.toJSON(this._workerGeometryType),hasM:this._layerOrSourceGeometryType!=="mesh"&&s,hasZ:this._layerOrSourceGeometryType==="mesh"||l,objectIdField:r,spatialReference:p?null:i&&i.toJSON(),timeInfo:(u==null?void 0:u.toJSON())??null,dateFieldsTimeZone:c},b=await this._connection.invoke("load",m,{signal:e});for(const w of b.warnings)T.getLogger(this.layer).warn("#load()",`${w.message} (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{warning:w});b.featureErrors.length&&T.getLogger(this.layer).warn("#load()",`Encountered ${b.featureErrors.length} validation errors while loading features. (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{errors:b.featureErrors});const M=b.layerDefinition;this._geometryTypeRequiresClientGraphicMapping(d.inferredGeometryType)&&(M.geometryType=L.toJSON(d.inferredGeometryType)),this.sourceJSON=M,this._requiresClientGraphicMapping()&&(this._idToClientGraphic=new Map),d.finish(b.assignedObjectIds)}};a([ee({Type:x,ensureType:te(x)})],g.prototype,"itemType",void 0),a([n()],g.prototype,"type",void 0),a([n({constructOnly:!0})],g.prototype,"layer",void 0),a([n({readOnly:!0})],g.prototype,"_workerGeometryType",null),a([n()],g.prototype,"sourceJSON",void 0),g=a([E("esri.layers.graphics.sources.MemorySource")],g);let v=class extends ie{constructor(){super(...arguments),this.updating=!1,this.status="unknown"}};a([n()],v.prototype,"updating",void 0),a([n()],v.prototype,"status",void 0),v=a([E("esri.layers.support.PublishingInfo")],v);const Ft=v,Z="esri.layers.mixins.PublishableLayer",St=Symbol(Z),Tt=e=>{var t;let i=class extends e{constructor(){super(...arguments),this[t]=!0}get publishingInfo(){if(this.destroyed)return null;const r=this._get("publishingInfo");if(r)return r;const s=new Ft;return this._checkPublishingStatus(s),s}_checkPublishingStatus(r){let u=0;const c=async d=>{let m;r.updating=!0;try{m=await this.fetchPublishingStatus()}catch{m="unavailable"}m!=="published"&&m!=="unavailable"||(r.status==="publishing"&&this.refresh(),p.remove()),r.status=m,r.updating=!1,p.removed||(u=setTimeout(c,d,d+125))},p={removed:!1,remove(){this.removed=!0,clearTimeout(u)}};this.when().catch(()=>p.remove()),c(250),this.addHandles(p)}};return t=St,a([n({readOnly:!0,clonable:!1})],i.prototype,"publishingInfo",null),i=a([E(Z)],i),i},h="FeatureLayer",z="esri.layers.FeatureLayer",It=T.getLogger(z);function S(e,t){return new f("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function V(e){return e&&e instanceof C}const O=ut();function q(e,t,i){const r=!!(i!=null&&i.writeLayerSchema);return{enabled:r,ignoreOrigin:r}}let o=class extends yt(gt(ft(Tt(re(se(bt(ae(oe(ne(le(ue(de(pe(mt(ye(ce(dt))))))))))))))))){constructor(...e){super(...e),this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=he.WGS84,this.subtypeCode=null,this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=me(async(t,i,r)=>{const{save:s,saveAs:l}=await G(()=>import("./featureLayerUtils-o55B7eEP.js"),__vite__mapDeps([0,1,2,3,4,5,6]));switch(t){case _.SAVE:return s(this,i);case _.SAVE_AS:return l(this,r,i)}})}destroy(){var e;(e=this.source)==null||e.destroy()}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}load(e){var r;const t=e!=null?e.signal:null;if((r=this.portalItem)!=null&&r.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then(s=>this.initLayerProperties(s))),Promise.resolve(this);const i=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(fe).then(async()=>{if(this.url&&this.layerId==null&&/FeatureServer|MapServer\/*$/i.test(this.url)){const s=await this._fetchFirstValidLayerId(t);s!=null&&(this.layerId=s)}if(!this.url&&!this._hasMemorySource())throw new f("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(t))}).then(()=>ge(this,"load",e));return this.addResolvingPromise(i),Promise.resolve(this)}readCapabilities(e,t){return t=t.layerDefinition||t,wt(t,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){var e;return!(this.loaded&&!((e=this.capabilities)!=null&&e.operations.supportsEditing))&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,i){return this._readEditingEnabled(t,!0,i)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,i,r){this._writeEditingEnabled(e,t,!0,r)}get effectiveEditingEnabled(){return be(this)}readIsTable(e,t){return(t=(t==null?void 0:t.layerDefinition)??t).type==="Table"||!t.geometryType}writeIsTable(e,t,i,r){r!=null&&r.writeLayerSchema&&I(i,e?"Table":"Feature Layer",t)}readGlobalIdField(e,t){return we(t.layerDefinition||t)}readObjectIdField(e,t){return ve(t.layerDefinition||t)}get parsedUrl(){const e=_e(this.url);return e!=null&&(this.dynamicDataSource!=null?e.path=P(e.path,"dynamicLayer"):this.layerId!=null&&(e.path=P(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){R(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,i){var s;t=t.layerDefinition||t;const r=(s=t.drawingInfo)==null?void 0:s.renderer;if(r){const l=Fe(r,t,i)??void 0;return l||It.error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:i}),l}return Se(t,i)}set source(e){const t=this._get("source");t!==e&&(V(t)&&this._resetMemorySource(t),V(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof C?new g({layer:this,items:e}):e:null}readSource(e,t){const i=k.fromJSON(t.featureSet);return new g({layer:this,items:(i==null?void 0:i.features)??[]})}readTemplates(e,t){const i=t.editFieldsInfo,r=i==null?void 0:i.creatorField,s=i==null?void 0:i.editorField;return e=e==null?void 0:e.map(l=>Q.fromJSON(l)),this._fixTemplates(e,r),this._fixTemplates(e,s),e}readTitle(e,t){var s,l,u;const i=((s=t.layerDefinition)==null?void 0:s.name)??t.name,r=t.title||((l=t.layerDefinition)==null?void 0:l.title);if(i){const c=(u=this.portalItem)==null?void 0:u.title;if(this.sublayerTitleMode==="item-title")return this.url?Te(this.url,i):i;let p=i;if(!p&&this.url){const d=Ie(this.url);d!=null&&(p=d.title)}return p?(this.sublayerTitleMode==="item-title-and-service-name"&&c&&c!==p&&(p=c+" - "+p),Ee(p)):void 0}if(this.sublayerTitleMode==="item-title"&&r)return r}readTitleFromWebMap(e,t){var i;return t.title||((i=t.layerDefinition)==null?void 0:i.name)}readTypeIdField(e,t){let i=(t=t.layerDefinition||t).typeIdField;if(i&&t.fields){i=i.toLowerCase();const r=t.fields.find(s=>s.name.toLowerCase()===i);r&&(i=r.name)}return i}readTypes(e,t){e=(t=t.layerDefinition||t).types;const i=t.editFieldsInfo,r=i==null?void 0:i.creatorField,s=i==null?void 0:i.editorField;return e==null?void 0:e.map(l=>(l=W.fromJSON(l),this._fixTemplates(l.templates,r),this._fixTemplates(l.templates,s),l))}readVisible(e,t){var i;return((i=t.layerDefinition)==null?void 0:i.defaultVisibility)!=null?!!t.layerDefinition.defaultVisibility:t.visibility!=null?!!t.visibility:void 0}async addAttachment(e,t){return je(this,e,t,h)}async updateAttachment(e,t,i){return $e(this,e,t,i,h)}async applyEdits(e,t){return De(this,e,t)}async uploadAssets(e,t){return Oe(this,e,t)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return qe(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:t}=await Ce(G(()=>import("./FeatureLayerSource-AZE5JEq3.js"),__vite__mapDeps([7,1,2,8,9,10,11,12,13,14,15,16,17,18,19,20,21])),e);return new t({layer:this}).load({signal:e})}createQuery(){const e=Me(this);e.dynamicDataSource=this.dynamicDataSource;const t=this.subtypeCode!=null?`${this.subtypeField} = ${this.subtypeCode}`:null,i=Le(this.definitionExpression,t);return e.where=i||"1=1",e}async deleteAttachments(e,t){return xe(this,e,t,h)}async fetchRecomputedExtents(e){return Pe(this,e,h)}getFeatureType(e){const{typeIdField:t,types:i}=this;if(!t||!e)return null;const r=e.attributes?e.attributes[t]:void 0;if(r==null)return null;let s=null;return i==null||i.some(l=>{const{id:u}=l;return u!=null&&(u.toString()===r.toString()&&(s=l),!!s)}),s}getFieldDomain(e,t){const i=t==null?void 0:t.feature,r=this.getFeatureType(i);if(r){const s=r.domains&&r.domains[e];if(s&&s.type!=="inherited")return s}return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}async queryAttachments(e,t){return Re(this,e,t,h)}async queryFeatures(e,t){const i=await this.load(),r=await i.source.queryFeatures(Ge.from(e)??i.createQuery(),t);if(r!=null&&r.features)for(const s of r.features)s.layer=s.sourceLayer=i;return r}async queryObjectIds(e,t){return Ae(this,e,t,h)}async queryFeatureCount(e,t){return Ne(this,e,t,h)}async queryExtent(e,t){return Je(this,e,t,h)}async queryRelatedFeatures(e,t){return Ve(this,e,t,h)}async queryRelatedFeaturesCount(e,t){return ke(this,e,t,h)}async queryTopFeatures(e,t){var l;const{source:i,capabilities:r}=await this.load();if(!i.queryTopFeatures||!((l=r==null?void 0:r.query)!=null&&l.supportsTopFeaturesQuery))throw new f(h,"Layer source does not support queryTopFeatures capability");const s=await i.queryTopFeatures(F.from(e),t);if(s!=null&&s.features)for(const u of s.features)u.layer=u.sourceLayer=this;return s}async queryTopObjectIds(e,t){const{source:i,capabilities:r}=await this.load();if(!i.queryTopObjectIds||!(r!=null&&r.query.supportsTopFeaturesQuery))throw new f(h,"Layer source does not support queryTopObjectIds capability");return i.queryTopObjectIds(F.from(e),t)}async queryTopFeaturesExtent(e,t){var s;const{source:i,capabilities:r}=await this.load();if(!i.queryTopExtents||!((s=r==null?void 0:r.query)!=null&&s.supportsTopFeaturesQuery))throw new f(h,"Layer source does not support queryTopExtents capability");return i.queryTopExtents(F.from(e),t)}async queryTopFeatureCount(e,t){var s;const{source:i,capabilities:r}=await this.load();if(!i.queryTopCount||!((s=r==null?void 0:r.query)!=null&&s.supportsTopFeaturesQuery))throw new f(h,"Layer source does not support queryFeatureCount capability");return i.queryTopCount(F.from(e),t)}read(e,t){const i=e.featureCollection;if(i){this.resourceInfo=e;const r=i.layers;r&&r.length===1&&(super.read(r[0],t),i.showLegend!=null&&super.read({showLegend:i.showLegend},t))}super.read(e,t),t&&t.origin==="service"&&(this.revert(["objectIdField","fields","timeInfo","dateFieldsTimeZone"],"service"),this.spatialReference||this.revert(["spatialReference"],"service"))}write(e,t){t={...t,origin:(t==null?void 0:t.origin)??void 0,writeLayerSchema:(t==null?void 0:t.writeLayerSchema)??this._hasMemorySource()};const{origin:i,layerContainerType:r,messages:s}=t;if(this.dynamicDataSource)return s==null||s.push(S(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if((i==="web-map"||i==="web-scene")&&r!=="tables")return s==null||s.push(S(this,`a table source can only be written to tables, not ${r}`)),null;if(this._hasMemorySource())return s==null||s.push(S(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&(i==="web-map"||i==="web-scene")&&r==="tables")return s==null||s.push(S(this,"using a non-table source cannot be written to tables in web maps or web scenes")),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new f(h,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){var t;return!!this.loaded&&(((t=this.source)==null?void 0:t.type)==="memory"||vt(this,e))}async save(e){return this._debouncedSaveOperations(_.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(_.SAVE_AS,t,e)}_readEditingEnabled(e,t,i){var s;let r=(s=e.layerDefinition)==null?void 0:s.capabilities;return r?this._hasEditingCapability(r):(r=e.capabilities,t&&(i==null?void 0:i.origin)==="web-map"&&!this._hasMemorySource()&&r?this._hasEditingCapability(r):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map(t=>t.trim()).includes("editing")}_writeEditingEnabled(e,t,i,r){var s,l;if(!e){const u=(l=(s=this.capabilities)==null?void 0:s.operations)!=null&&l.supportsSync?"Query,Sync":"Query";I("layerDefinition.capabilities",u,t),i&&!(r!=null&&r.writeLayerSchema)&&(t.capabilities=u)}}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}_fetchFirstValidLayerId(e){return Qe(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then(t=>{const i=t.data;if(i)return this.findFirstValidLayerId(i)})}async initLayerProperties(e){var t;return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:(t=this.portalItem)==null?void 0:t.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),R(this.renderer,this.fieldsIndex),We(this.timeInfo,this.fieldsIndex),Ze(this,{origin:"service"})}async hasDataChanged(){return ze(this)}async fetchPublishingStatus(){const e=this.source;return e!=null&&e.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){var t,i;const e=((t=this.parsedUrl)==null?void 0:t.path)??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||e.search(/\/FeatureServer\//i)!==-1||(i=this.fields)!=null&&i.some(r=>r.type==="geometry")||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach(i=>{var s;const r=(s=i.prototype)==null?void 0:s.attributes;r&&t&&delete r[t]})}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new f("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new f("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach(t=>{t.layer=this,t.sourceLayer=this}),this.addHandles([e.on("after-add",t=>{t.item.layer=this,t.item.sourceLayer=this}),e.on("after-remove",t=>{t.item.layer=null,t.item.sourceLayer=null})],"fl-source")}_resetMemorySource(e){e.forEach(t=>{t.layer=null,t.sourceLayer=null}),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){return Array.isArray(e.layers)&&e.layers.length>0?e.layers[0].id:Array.isArray(e.tables)&&e.tables.length>0?e.tables[0].id:void 0}};a([y("service","capabilities")],o.prototype,"readCapabilities",null),a([n({json:{origins:{"web-scene":{write:!1}},write:!0}})],o.prototype,"charts",void 0),a([n({readOnly:!0})],o.prototype,"createQueryVersion",null),a([n({json:{read:{source:"layerDefinition.copyrightText"}}})],o.prototype,"copyright",void 0),a([n({json:{read:{source:"layerDefinition.displayField"}}})],o.prototype,"displayField",void 0),a([n({types:He,readOnly:!0})],o.prototype,"defaultSymbol",void 0),a([n({type:Ue})],o.prototype,"dynamicDataSource",void 0),a([n({type:Boolean})],o.prototype,"editingEnabled",null),a([y(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],o.prototype,"readEditingEnabled",null),a([y("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],o.prototype,"readEditingEnabledFromWebMap",null),a([j(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],o.prototype,"writeEditingEnabled",null),a([j("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],o.prototype,"writeEditingEnabledToWebMap",null),a([n({readOnly:!0})],o.prototype,"effectiveEditingEnabled",null),a([n({...O.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:q}}}}})],o.prototype,"fields",void 0),a([n(O.fieldsIndex)],o.prototype,"fieldsIndex",void 0),a([n({type:ct,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],o.prototype,"formTemplate",void 0),a([n({json:{read:{source:"layerDefinition.extent"}}})],o.prototype,"fullExtent",void 0),a([n({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:q,writer(e,t,i){const r=e?A.toJSON(e):null;r&&I(i,r,t)}}}},read:{source:"layerDefinition.geometryType",reader:A.read}}})],o.prototype,"geometryType",void 0),a([n({json:{read:{source:"layerDefinition.hasM"}}})],o.prototype,"hasM",void 0),a([n({json:{read:{source:"layerDefinition.hasZ"}}})],o.prototype,"hasZ",void 0),a([n(Be)],o.prototype,"id",void 0),a([n({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],o.prototype,"infoFor3D",void 0),a([n({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],o.prototype,"isTable",void 0),a([y("service","isTable",["type","geometryType"]),y("isTable",["layerDefinition.type","layerDefinition.geometryType"])],o.prototype,"readIsTable",null),a([j("web-map","isTable")],o.prototype,"writeIsTable",null),a([n(Ke)],o.prototype,"labelsVisible",void 0),a([n({type:[Ye],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:$,write:!1},"web-scene":{name:"layerDefinition.drawingInfo.labelingInfo",read:$,write:{enabled:!0,layerContainerTypes:N}}},name:"layerDefinition.drawingInfo.labelingInfo",read:$,write:!0}})],o.prototype,"labelingInfo",void 0),a([n((()=>{const e=D(Xe);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(t,i,r){I(r,pt(t),i)}}},e})())],o.prototype,"opacity",void 0),a([n(et)],o.prototype,"legendEnabled",void 0),a([n({type:["show","hide"],json:(()=>{const e=D(tt.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],o.prototype,"listMode",void 0),a([y("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],o.prototype,"readGlobalIdField",null),a([n({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:q}}}}})],o.prototype,"objectIdField",void 0),a([y("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],o.prototype,"readObjectIdField",null),a([n({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],o.prototype,"operationalLayerType",void 0),a([n(O.outFields)],o.prototype,"outFields",void 0),a([n({readOnly:!0})],o.prototype,"parsedUrl",null),a([n({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],o.prototype,"path",void 0),a([n(it)],o.prototype,"popupEnabled",void 0),a([n({type:rt,json:{name:"popupInfo",write:!0}})],o.prototype,"popupTemplate",void 0),a([n({readOnly:!0})],o.prototype,"defaultPopupTemplate",null),a([n({types:st,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:at,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:N,overridePolicy:(e,t,i)=>({ignoreOrigin:i==null?void 0:i.writeLayerSchema})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,i)=>({ignoreOrigin:i==null?void 0:i.writeLayerSchema})}}})],o.prototype,"renderer",null),a([y("service","renderer",["drawingInfo.renderer","defaultSymbol"]),y("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],o.prototype,"readRenderer",null),a([n()],o.prototype,"resourceInfo",void 0),a([n((()=>{const e=D(ot);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],o.prototype,"screenSizePerspectiveEnabled",void 0),a([n({clonable:!1})],o.prototype,"source",null),a([nt("source")],o.prototype,"castSource",null),a([y("portal-item","source",["featureSet"]),y("web-map","source",["featureSet"])],o.prototype,"readSource",null),a([n({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],o.prototype,"spatialReference",void 0),a([n({type:Number})],o.prototype,"subtypeCode",void 0),a([n({type:[Q]})],o.prototype,"templates",void 0),a([y("templates",["editFieldsInfo","creatorField","editorField","templates"])],o.prototype,"readTemplates",null),a([n({type:lt})],o.prototype,"timeInfo",void 0),a([n()],o.prototype,"title",void 0),a([y("service","title",["name"]),y("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],o.prototype,"readTitle",null),a([y("web-map","title",["layerDefinition.name","title"])],o.prototype,"readTitleFromWebMap",null),a([n({type:String})],o.prototype,"sublayerTitleMode",void 0),a([n({json:{read:!1}})],o.prototype,"type",void 0),a([n({type:String})],o.prototype,"typeIdField",void 0),a([y("service","typeIdField"),y("typeIdField",["layerDefinition.typeIdField"])],o.prototype,"readTypeIdField",null),a([n({type:[W]})],o.prototype,"types",void 0),a([y("service","types",["types"]),y("types",["layerDefinition.types"])],o.prototype,"readTypes",null),a([n({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility"}}}}})],o.prototype,"visible",void 0),a([y("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],o.prototype,"readVisible",null),o=a([E(z)],o);const Jt=o;export{Jt as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/featureLayerUtils-o55B7eEP.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/utils-rBsg-VY8.js","assets/jsonContext-cWV_-jAj.js","assets/fetchService-wPWKuma6.js","assets/requestPresets-18nzHK5y.js","assets/FeatureLayerSource-AZE5JEq3.js","assets/External-GV0jSEES.js","assets/editingSupport-EiPa9PKq.js","assets/clientSideDefaults-F-CNnR0g.js","assets/QueryEngineCapabilities-PzVpW5yD.js","assets/QueryTask-91TvtrTt.js","assets/executeForIds-wXO8-pll.js","assets/query-rG0aX6cE.js","assets/pbfQueryUtils-pWizwTQZ.js","assets/pbf-o0zzptPp.js","assets/queryZScale-IaMm02_2.js","assets/executeQueryJSON-ACj9qY0y.js","assets/FeatureSet-d4S1oKME.js","assets/executeQueryPBF-vdaOUMid.js","assets/editsZScale-Wgw9kbYG.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/FeatureLayer-9tNCmEbA.js b/dist/assets/FeatureLayer-9tNCmEbA.js new file mode 100644 index 0000000..59854b2 --- /dev/null +++ b/dist/assets/FeatureLayer-9tNCmEbA.js @@ -0,0 +1,7 @@ +import{il as H,cQ as K,h7 as L,h6 as k,r as m,dO as B,j as U,f_ as X,dE as Y,R as T,jc as R,e as a,mz as ee,K as x,lh as te,y as n,c as E,V as M,g as ie,jw as re,dF as se,ee as ae,dJ as oe,dG as ne,ef as le,dH as ue,dI as de,dK as pe,eg as ye,dq as ce,d2 as he,bs as fe,dL as me,jx as ge,jy as be,dy as I,mA as we,mB as ve,au as _e,h8 as P,iG as G,jh as Fe,ji as Se,jz as Te,df as Ie,mC as Ee,jA as je,jB as $e,jC as De,mD as Oe,io as Ce,gD as Me,de as A,jo as qe,jp as Le,jD as Re,jE as xe,jF as Pe,aL as Ge,jG as Ae,jH as Je,jI as Ne,jJ as Ve,jK as ke,h5 as _,jj as F,av as Qe,iH as ze,dl as We,jL as Ze,dt as y,mE as He,j0 as Ke,du as j,mF as J,dP as Be,iJ as Ue,iK as Xe,iL as $,mG as N,ah as D,jO as Ye,dQ as et,mH as tt,iw as it,ix as rt,iN as st,iv as at,iO as ot,f1 as nt,jM as lt,iz as ut,aI as dt,mI as pt}from"./index-pCX-0tJH.js";import{D as yt,y as ct}from"./FeatureLayerBase-mvqC7cJs.js";import{i as ht}from"./editsZScale-4-dTv58d.js";import{o as ft}from"./CustomParametersMixin-7nmugR3Y.js";import{p as mt}from"./FeatureEffectLayer-OK0TB5f6.js";import{c as gt}from"./FeatureReductionLayer-2X2_PJv9.js";import{c as bt}from"./OrderedLayer-XNaJwl_G.js";import{p as Q}from"./FeatureTemplate-vSzbyslg.js";import{n as z}from"./FeatureType-0WPvBvpQ.js";import{a as wt}from"./serviceCapabilitiesUtils-f-iBP4uh.js";import{e as vt}from"./versionUtils-idhrDltC.js";import"./FeatureEffect-0Jn9Z0sQ.js";let _t=0,g=class extends H.LoadableMixin(K(M)){constructor(e){super(e),this._idToClientGraphic=null,this.type="memory"}load(e){const t=e!=null?e.signal:null;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){var e;(e=this._connection)==null||e.close(),this._connection=null}get _workerGeometryType(){var t;const e=(t=this.layer)==null?void 0:t.geometryType;return e?this._geometryTypeRequiresClientGraphicMapping(e)?"polygon":e:null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}async queryFeatures(e,t={}){await this.load(t);const i=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t);L(e,this.layer.spatialReference,i);const r=k.fromJSON(i);if(!this._requiresClientGraphicMapping())return r;const s=this.layer.objectIdField;for(const l of r.features){const u=l.attributes[s],c=this._idToClientGraphic.get(u);c&&(l.geometry=c.geometry)}return r.geometryType=this.layer.geometryType,r}async queryFeaturesJSON(e,t={}){if(this._requiresClientGraphicMapping())throw new m("query-features-json:unsupported","Cannot query in JSON format for client only geometry types (mesh and extent)");await this.load(t);const i=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t);return L(e,this.layer.spatialReference,i),i}queryFeatureCount(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t))}queryObjectIds(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryObjectIds",e?e.toJSON():null,t))}queryExtent(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryExtent",e?e.toJSON():null,t)).then(i=>({count:i.count,extent:B.fromJSON(i.extent)}))}querySnapping(e,t={}){return this.load(t).then(()=>this._connection.invoke("querySnapping",e,t))}async _applyEdits(e){if(!this._connection)throw new m("feature-layer-source:edit-failure","Memory source not loaded");const t=this.layer.objectIdField;let i=null;const r=[],s=[];await Promise.all([this._prepareClientMapping(e.addFeatures,null),this._prepareClientMapping(e.updateFeatures,null)]);const l=d=>"objectId"in d&&d.objectId!=null?d.objectId:"attributes"in d&&d.attributes[t]!=null?d.attributes[t]:null;if(e.addFeatures&&(i=this._prepareAddFeatures(e.addFeatures)),e.deleteFeatures)for(const d of e.deleteFeatures){const f=l(d);f!=null&&r.push(f)}const u=e.updateFeatures&&this._idToClientGraphic?new Map:null;if(e.updateFeatures){for(const d of e.updateFeatures)if(s.push(this._serializeFeature(d)),u){const f=l(d);f!=null&&u.set(f,d)}}ht(i?i.features:null,s,this.layer.spatialReference);const{fullExtent:c,featureEditResults:p}=await this._connection.invoke("applyEdits",{adds:i?i.features:[],updates:s,deletes:r});return this.fullExtent=c,i&&i.finish(p.uidToObjectId),this._updateClientGraphicIds(u,p),this._createEditsResult(p)}async _prepareClientMapping(e,t){if(this._layerOrSourceGeometryType!=="mesh"||e==null)return;const i=[];for(const{geometry:r}of e)r==null||r.type!=="mesh"||r.hasExtent||r.loaded||i.push(r.load({signal:t}));i.length&&await Promise.all(i)}_updateClientGraphicIds(e,t){if(this._idToClientGraphic){if(e)for(const i of t.updateResults){if(!i.success)continue;const r=e.get(i.objectId);r!=null&&this._addIdToClientGraphic(r)}for(const i of t.deleteResults)i.success&&this._idToClientGraphic.delete(i.objectId)}}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){const t=e.success===!0?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new m("feature-layer-source:edit-failure",t.description,{code:t.code}):null}}_prepareAddFeatures(e){const t=new Map,i=new Array(e.length);let r=null;for(let l=0;l{T.getLogger(this).error("Source modifications will not propagate after layer has been loaded. Please use .applyEdits() instead"),w.preventDefault()}));const f={features:d.features,fields:t==null?void 0:t.map(w=>w.toJSON()),geometryType:R.toJSON(this._workerGeometryType),hasM:this._layerOrSourceGeometryType!=="mesh"&&s,hasZ:this._layerOrSourceGeometryType==="mesh"||l,objectIdField:r,spatialReference:p?null:i&&i.toJSON(),timeInfo:(u==null?void 0:u.toJSON())??null,dateFieldsTimeZone:c},b=await this._connection.invoke("load",f,{signal:e});for(const w of b.warnings)T.getLogger(this.layer).warn("#load()",`${w.message} (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{warning:w});b.featureErrors.length&&T.getLogger(this.layer).warn("#load()",`Encountered ${b.featureErrors.length} validation errors while loading features. (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{errors:b.featureErrors});const q=b.layerDefinition;this._geometryTypeRequiresClientGraphicMapping(d.inferredGeometryType)&&(q.geometryType=R.toJSON(d.inferredGeometryType)),this.sourceJSON=q,this._requiresClientGraphicMapping()&&(this._idToClientGraphic=new Map),d.finish(b.assignedObjectIds)}};a([ee({Type:x,ensureType:te(x)})],g.prototype,"itemType",void 0),a([n()],g.prototype,"type",void 0),a([n({constructOnly:!0})],g.prototype,"layer",void 0),a([n({readOnly:!0})],g.prototype,"_workerGeometryType",null),a([n()],g.prototype,"sourceJSON",void 0),g=a([E("esri.layers.graphics.sources.MemorySource")],g);let v=class extends ie{constructor(){super(...arguments),this.updating=!1,this.status="unknown"}};a([n()],v.prototype,"updating",void 0),a([n()],v.prototype,"status",void 0),v=a([E("esri.layers.support.PublishingInfo")],v);const Ft=v,W="esri.layers.mixins.PublishableLayer",St=Symbol(W),Tt=e=>{var t;let i=class extends e{constructor(){super(...arguments),this[t]=!0}get publishingInfo(){if(this.destroyed)return null;const r=this._get("publishingInfo");if(r)return r;const s=new Ft;return this._checkPublishingStatus(s),s}_checkPublishingStatus(r){let u=0;const c=async d=>{let f;r.updating=!0;try{f=await this.fetchPublishingStatus()}catch{f="unavailable"}f!=="published"&&f!=="unavailable"||(r.status==="publishing"&&this.refresh(),p.remove()),r.status=f,r.updating=!1,p.removed||(u=setTimeout(c,d,d+125))},p={removed:!1,remove(){this.removed=!0,clearTimeout(u)}};this.when().catch(()=>p.remove()),c(250),this.addHandles(p)}};return t=St,a([n({readOnly:!0,clonable:!1})],i.prototype,"publishingInfo",null),i=a([E(W)],i),i},h="FeatureLayer",Z="esri.layers.FeatureLayer",It=T.getLogger(Z);function S(e,t){return new m("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}function V(e){return e&&e instanceof M}const O=ut();function C(e,t,i){const r=!!(i!=null&&i.writeLayerSchema);return{enabled:r,ignoreOrigin:r}}let o=class extends yt(gt(mt(Tt(re(se(bt(ae(oe(ne(le(ue(de(pe(ft(ye(ce(dt))))))))))))))))){constructor(...e){super(...e),this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=he.WGS84,this.subtypeCode=null,this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=fe(async(t,i,r)=>{const{save:s,saveAs:l}=await A(()=>import("./featureLayerUtils-m5wDrekx.js"),__vite__mapDeps([0,1,2,3,4,5,6]));switch(t){case F.SAVE:return s(this,i);case F.SAVE_AS:return l(this,r,i)}})}destroy(){var e;(e=this.source)==null||e.destroy()}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}load(e){var r;const t=e!=null?e.signal:null;if((r=this.portalItem)!=null&&r.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then(s=>this.initLayerProperties(s))),Promise.resolve(this);const i=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(me).then(async()=>{if(this.url&&this.layerId==null&&/FeatureServer|MapServer\/*$/i.test(this.url)){const s=await this._fetchFirstValidLayerId(t);s!=null&&(this.layerId=s)}if(!this.url&&!this._hasMemorySource())throw new m("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(t))}).then(()=>ge(this,"load",e));return this.addResolvingPromise(i),Promise.resolve(this)}readCapabilities(e,t){return t=t.layerDefinition||t,wt(t,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){var e;return!(this.loaded&&!((e=this.capabilities)!=null&&e.operations.supportsEditing))&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,i){return this._readEditingEnabled(t,!0,i)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,i,r){this._writeEditingEnabled(e,t,!0,r)}get effectiveEditingEnabled(){return be(this)}readIsTable(e,t){return(t=(t==null?void 0:t.layerDefinition)??t).type==="Table"||!t.geometryType}writeIsTable(e,t,i,r){r!=null&&r.writeLayerSchema&&I(i,e?"Table":"Feature Layer",t)}readGlobalIdField(e,t){return we(t.layerDefinition||t)}readObjectIdField(e,t){return ve(t.layerDefinition||t)}get parsedUrl(){const e=_e(this.url);return e!=null&&(this.dynamicDataSource!=null?e.path=P(e.path,"dynamicLayer"):this.layerId!=null&&(e.path=P(e.path,this.layerId.toString()))),e}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){G(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,i){var s;t=t.layerDefinition||t;const r=(s=t.drawingInfo)==null?void 0:s.renderer;if(r){const l=Fe(r,t,i)??void 0;return l||It.error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:i}),l}return Se(t,i)}set source(e){const t=this._get("source");t!==e&&(V(t)&&this._resetMemorySource(t),V(e)&&this._initMemorySource(e),this._set("source",e))}castSource(e){return e?Array.isArray(e)||e instanceof M?new g({layer:this,items:e}):e:null}readSource(e,t){const i=k.fromJSON(t.featureSet);return new g({layer:this,items:(i==null?void 0:i.features)??[]})}readTemplates(e,t){const i=t.editFieldsInfo,r=i==null?void 0:i.creatorField,s=i==null?void 0:i.editorField;return e=e==null?void 0:e.map(l=>Q.fromJSON(l)),this._fixTemplates(e,r),this._fixTemplates(e,s),e}readTitle(e,t){var s,l,u;const i=((s=t.layerDefinition)==null?void 0:s.name)??t.name,r=t.title||((l=t.layerDefinition)==null?void 0:l.title);if(i){const c=(u=this.portalItem)==null?void 0:u.title;if(this.sublayerTitleMode==="item-title")return this.url?Te(this.url,i):i;let p=i;if(!p&&this.url){const d=Ie(this.url);d!=null&&(p=d.title)}return p?(this.sublayerTitleMode==="item-title-and-service-name"&&c&&c!==p&&(p=c+" - "+p),Ee(p)):void 0}if(this.sublayerTitleMode==="item-title"&&r)return r}readTitleFromWebMap(e,t){var i;return t.title||((i=t.layerDefinition)==null?void 0:i.name)}readTypeIdField(e,t){let i=(t=t.layerDefinition||t).typeIdField;if(i&&t.fields){i=i.toLowerCase();const r=t.fields.find(s=>s.name.toLowerCase()===i);r&&(i=r.name)}return i}readTypes(e,t){e=(t=t.layerDefinition||t).types;const i=t.editFieldsInfo,r=i==null?void 0:i.creatorField,s=i==null?void 0:i.editorField;return e==null?void 0:e.map(l=>(l=z.fromJSON(l),this._fixTemplates(l.templates,r),this._fixTemplates(l.templates,s),l))}readVisible(e,t){var i;return((i=t.layerDefinition)==null?void 0:i.defaultVisibility)!=null?!!t.layerDefinition.defaultVisibility:t.visibility!=null?!!t.visibility:void 0}async addAttachment(e,t){return je(this,e,t,h)}async updateAttachment(e,t,i){return $e(this,e,t,i,h)}async applyEdits(e,t){return De(this,e,t)}async uploadAssets(e,t){return Oe(this,e,t)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return Ce(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:t}=await Me(A(()=>import("./FeatureLayerSource-hKAUR546.js"),__vite__mapDeps([7,1,2,8,9,10,11,12,13,14,15])),e);return new t({layer:this}).load({signal:e})}createQuery(){const e=qe(this);e.dynamicDataSource=this.dynamicDataSource;const t=this.subtypeCode!=null?`${this.subtypeField} = ${this.subtypeCode}`:null,i=Le(this.definitionExpression,t);return e.where=i||"1=1",e}async deleteAttachments(e,t){return Re(this,e,t,h)}async fetchRecomputedExtents(e){return xe(this,e,h)}getFeatureType(e){const{typeIdField:t,types:i}=this;if(!t||!e)return null;const r=e.attributes?e.attributes[t]:void 0;if(r==null)return null;let s=null;return i==null||i.some(l=>{const{id:u}=l;return u!=null&&(u.toString()===r.toString()&&(s=l),!!s)}),s}getFieldDomain(e,t){const i=t==null?void 0:t.feature,r=this.getFeatureType(i);if(r){const s=r.domains&&r.domains[e];if(s&&s.type!=="inherited")return s}return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}async queryAttachments(e,t){return Pe(this,e,t,h)}async queryFeatures(e,t){const i=await this.load(),r=await i.source.queryFeatures(Ge.from(e)??i.createQuery(),t);if(r!=null&&r.features)for(const s of r.features)s.layer=s.sourceLayer=i;return r}async queryObjectIds(e,t){return Ae(this,e,t,h)}async queryFeatureCount(e,t){return Je(this,e,t,h)}async queryExtent(e,t){return Ne(this,e,t,h)}async queryRelatedFeatures(e,t){return Ve(this,e,t,h)}async queryRelatedFeaturesCount(e,t){return ke(this,e,t,h)}async queryTopFeatures(e,t){var l;const{source:i,capabilities:r}=await this.load();if(!i.queryTopFeatures||!((l=r==null?void 0:r.query)!=null&&l.supportsTopFeaturesQuery))throw new m(h,"Layer source does not support queryTopFeatures capability");const s=await i.queryTopFeatures(_.from(e),t);if(s!=null&&s.features)for(const u of s.features)u.layer=u.sourceLayer=this;return s}async queryTopObjectIds(e,t){const{source:i,capabilities:r}=await this.load();if(!i.queryTopObjectIds||!(r!=null&&r.query.supportsTopFeaturesQuery))throw new m(h,"Layer source does not support queryTopObjectIds capability");return i.queryTopObjectIds(_.from(e),t)}async queryTopFeaturesExtent(e,t){var s;const{source:i,capabilities:r}=await this.load();if(!i.queryTopExtents||!((s=r==null?void 0:r.query)!=null&&s.supportsTopFeaturesQuery))throw new m(h,"Layer source does not support queryTopExtents capability");return i.queryTopExtents(_.from(e),t)}async queryTopFeatureCount(e,t){var s;const{source:i,capabilities:r}=await this.load();if(!i.queryTopCount||!((s=r==null?void 0:r.query)!=null&&s.supportsTopFeaturesQuery))throw new m(h,"Layer source does not support queryFeatureCount capability");return i.queryTopCount(_.from(e),t)}read(e,t){const i=e.featureCollection;if(i){this.resourceInfo=e;const r=i.layers;r&&r.length===1&&(super.read(r[0],t),i.showLegend!=null&&super.read({showLegend:i.showLegend},t))}super.read(e,t),t&&t.origin==="service"&&(this.revert(["objectIdField","fields","timeInfo","dateFieldsTimeZone"],"service"),this.spatialReference||this.revert(["spatialReference"],"service"))}write(e,t){t={...t,origin:(t==null?void 0:t.origin)??void 0,writeLayerSchema:(t==null?void 0:t.writeLayerSchema)??this._hasMemorySource()};const{origin:i,layerContainerType:r,messages:s}=t;if(this.dynamicDataSource)return s==null||s.push(S(this,"using a dynamic data source cannot be written to web scenes, web maps and feature service items")),null;if(this.isTable){if((i==="web-map"||i==="web-scene")&&r!=="tables")return s==null||s.push(S(this,`a table source can only be written to tables, not ${r}`)),null;if(this._hasMemorySource())return s==null||s.push(S(this,"using an in-memory table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&(i==="web-map"||i==="web-scene")&&r==="tables")return s==null||s.push(S(this,"using a non-table source cannot be written to tables in web maps or web scenes")),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new m(h,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){var t;return!!this.loaded&&(((t=this.source)==null?void 0:t.type)==="memory"||vt(this,e))}async save(e){return this._debouncedSaveOperations(F.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(F.SAVE_AS,t,e)}_readEditingEnabled(e,t,i){var s;let r=(s=e.layerDefinition)==null?void 0:s.capabilities;return r?this._hasEditingCapability(r):(r=e.capabilities,t&&(i==null?void 0:i.origin)==="web-map"&&!this._hasMemorySource()&&r?this._hasEditingCapability(r):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map(t=>t.trim()).includes("editing")}_writeEditingEnabled(e,t,i,r){var s,l;if(!e){const u=(l=(s=this.capabilities)==null?void 0:s.operations)!=null&&l.supportsSync?"Query,Sync":"Query";I("layerDefinition.capabilities",u,t),i&&!(r!=null&&r.writeLayerSchema)&&(t.capabilities=u)}}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}_fetchFirstValidLayerId(e){return Qe(this.url,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then(t=>{const i=t.data;if(i)return this.findFirstValidLayerId(i)})}async initLayerProperties(e){var t;return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:(t=this.portalItem)==null?void 0:t.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),G(this.renderer,this.fieldsIndex),ze(this.timeInfo,this.fieldsIndex),We(this,{origin:"service"})}async hasDataChanged(){return Ze(this)}async fetchPublishingStatus(){const e=this.source;return e!=null&&e.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){var t,i;const e=((t=this.parsedUrl)==null?void 0:t.path)??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||e.search(/\/FeatureServer\//i)!==-1||(i=this.fields)!=null&&i.some(r=>r.type==="geometry")||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach(i=>{var s;const r=(s=i.prototype)==null?void 0:s.attributes;r&&t&&delete r[t]})}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new m("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new m("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach(t=>{t.layer=this,t.sourceLayer=this}),this.addHandles([e.on("after-add",t=>{t.item.layer=this,t.item.sourceLayer=this}),e.on("after-remove",t=>{t.item.layer=null,t.item.sourceLayer=null})],"fl-source")}_resetMemorySource(e){e.forEach(t=>{t.layer=null,t.sourceLayer=null}),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){return Array.isArray(e.layers)&&e.layers.length>0?e.layers[0].id:Array.isArray(e.tables)&&e.tables.length>0?e.tables[0].id:void 0}};a([y("service","capabilities")],o.prototype,"readCapabilities",null),a([n({json:{origins:{"web-scene":{write:!1}},write:!0}})],o.prototype,"charts",void 0),a([n({readOnly:!0})],o.prototype,"createQueryVersion",null),a([n({json:{read:{source:"layerDefinition.copyrightText"}}})],o.prototype,"copyright",void 0),a([n({json:{read:{source:"layerDefinition.displayField"}}})],o.prototype,"displayField",void 0),a([n({types:He,readOnly:!0})],o.prototype,"defaultSymbol",void 0),a([n({type:Ke})],o.prototype,"dynamicDataSource",void 0),a([n({type:Boolean})],o.prototype,"editingEnabled",null),a([y(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],o.prototype,"readEditingEnabled",null),a([y("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],o.prototype,"readEditingEnabledFromWebMap",null),a([j(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],o.prototype,"writeEditingEnabled",null),a([j("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],o.prototype,"writeEditingEnabledToWebMap",null),a([n({readOnly:!0})],o.prototype,"effectiveEditingEnabled",null),a([n({...O.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:C}}}}})],o.prototype,"fields",void 0),a([n(O.fieldsIndex)],o.prototype,"fieldsIndex",void 0),a([n({type:ct,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],o.prototype,"formTemplate",void 0),a([n({json:{read:{source:"layerDefinition.extent"}}})],o.prototype,"fullExtent",void 0),a([n({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:C,writer(e,t,i){const r=e?J.toJSON(e):null;r&&I(i,r,t)}}}},read:{source:"layerDefinition.geometryType",reader:J.read}}})],o.prototype,"geometryType",void 0),a([n({json:{read:{source:"layerDefinition.hasM"}}})],o.prototype,"hasM",void 0),a([n({json:{read:{source:"layerDefinition.hasZ"}}})],o.prototype,"hasZ",void 0),a([n(Be)],o.prototype,"id",void 0),a([n({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],o.prototype,"infoFor3D",void 0),a([n({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],o.prototype,"isTable",void 0),a([y("service","isTable",["type","geometryType"]),y("isTable",["layerDefinition.type","layerDefinition.geometryType"])],o.prototype,"readIsTable",null),a([j("web-map","isTable")],o.prototype,"writeIsTable",null),a([n(Ue)],o.prototype,"labelsVisible",void 0),a([n({type:[Xe],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:$,write:!1},"web-scene":{name:"layerDefinition.drawingInfo.labelingInfo",read:$,write:{enabled:!0,layerContainerTypes:N}}},name:"layerDefinition.drawingInfo.labelingInfo",read:$,write:!0}})],o.prototype,"labelingInfo",void 0),a([n((()=>{const e=D(Ye);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(t,i,r){I(r,pt(t),i)}}},e})())],o.prototype,"opacity",void 0),a([n(et)],o.prototype,"legendEnabled",void 0),a([n({type:["show","hide"],json:(()=>{const e=D(tt.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],o.prototype,"listMode",void 0),a([y("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],o.prototype,"readGlobalIdField",null),a([n({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:C}}}}})],o.prototype,"objectIdField",void 0),a([y("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],o.prototype,"readObjectIdField",null),a([n({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],o.prototype,"operationalLayerType",void 0),a([n(O.outFields)],o.prototype,"outFields",void 0),a([n({readOnly:!0})],o.prototype,"parsedUrl",null),a([n({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],o.prototype,"path",void 0),a([n(it)],o.prototype,"popupEnabled",void 0),a([n({type:rt,json:{name:"popupInfo",write:!0}})],o.prototype,"popupTemplate",void 0),a([n({readOnly:!0})],o.prototype,"defaultPopupTemplate",null),a([n({types:st,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:at,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:N,overridePolicy:(e,t,i)=>({ignoreOrigin:i==null?void 0:i.writeLayerSchema})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,i)=>({ignoreOrigin:i==null?void 0:i.writeLayerSchema})}}})],o.prototype,"renderer",null),a([y("service","renderer",["drawingInfo.renderer","defaultSymbol"]),y("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],o.prototype,"readRenderer",null),a([n()],o.prototype,"resourceInfo",void 0),a([n((()=>{const e=D(ot);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],o.prototype,"screenSizePerspectiveEnabled",void 0),a([n({clonable:!1})],o.prototype,"source",null),a([nt("source")],o.prototype,"castSource",null),a([y("portal-item","source",["featureSet"]),y("web-map","source",["featureSet"])],o.prototype,"readSource",null),a([n({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],o.prototype,"spatialReference",void 0),a([n({type:Number})],o.prototype,"subtypeCode",void 0),a([n({type:[Q]})],o.prototype,"templates",void 0),a([y("templates",["editFieldsInfo","creatorField","editorField","templates"])],o.prototype,"readTemplates",null),a([n({type:lt})],o.prototype,"timeInfo",void 0),a([n()],o.prototype,"title",void 0),a([y("service","title",["name"]),y("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],o.prototype,"readTitle",null),a([y("web-map","title",["layerDefinition.name","title"])],o.prototype,"readTitleFromWebMap",null),a([n({type:String})],o.prototype,"sublayerTitleMode",void 0),a([n({json:{read:!1}})],o.prototype,"type",void 0),a([n({type:String})],o.prototype,"typeIdField",void 0),a([y("service","typeIdField"),y("typeIdField",["layerDefinition.typeIdField"])],o.prototype,"readTypeIdField",null),a([n({type:[z]})],o.prototype,"types",void 0),a([y("service","types",["types"]),y("types",["layerDefinition.types"])],o.prototype,"readTypes",null),a([n({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility"}}}}})],o.prototype,"visible",void 0),a([y("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],o.prototype,"readVisible",null),o=a([E(Z)],o);const Gt=o;export{Gt as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/featureLayerUtils-m5wDrekx.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/utils-YxtTVBu2.js","assets/jsonContext-EgdQULbU.js","assets/fetchService-cGWNcQnc.js","assets/requestPresets-f6ZAWLqV.js","assets/FeatureLayerSource-hKAUR546.js","assets/External-Pb5poJ0S.js","assets/editingSupport-HfkJiqt7.js","assets/clientSideDefaults-63pOkJ4Y.js","assets/QueryEngineCapabilities-PzVpW5yD.js","assets/QueryTask-Di0fqnMV.js","assets/executeForIds-PXSIkRGk.js","assets/executeQueryPBF-P21isUTI.js","assets/editsZScale-4-dTv58d.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/FeatureLayerBase-jpFp8gE3.js b/dist/assets/FeatureLayerBase-mvqC7cJs.js similarity index 84% rename from dist/assets/FeatureLayerBase-jpFp8gE3.js rename to dist/assets/FeatureLayerBase-mvqC7cJs.js index 352161f..90b03ef 100644 --- a/dist/assets/FeatureLayerBase-jpFp8gE3.js +++ b/dist/assets/FeatureLayerBase-mvqC7cJs.js @@ -1 +1 @@ -import{e,y as t,c as p,dr as g,dt as l,du as u,Z as Ee,u$ as Ne,ds as Fe,um as ce,v0 as Be,bI as V,v1 as Le,f6 as Te,dq as N,ex as q,uw as Ue,uv as Ae,dp as Oe,iH as Ce,lk as Ge,mx as We,dT as Qe,mw as Pe,v2 as Ze,V as me,jd as He,je as qe,ar as he,dW as Je,v3 as ze,mr as Ke,ms as _e,v4 as Xe,v5 as Ye,v6 as et}from"./index-J0iiHjMT.js";import{a as tt}from"./serviceCapabilitiesUtils-26KpT1VN.js";var J;let I=J=class extends g{constructor(i){super(i),this.expression=null,this.name=null,this.returnType="boolean",this.title=null}clone(){return new J({name:this.name,title:this.title,expression:this.expression,returnType:this.returnType})}};e([t({type:String,json:{write:!0}})],I.prototype,"expression",void 0),e([t({type:String,json:{write:!0}})],I.prototype,"name",void 0),e([t({type:["boolean","date","number","string"],json:{write:!0}})],I.prototype,"returnType",void 0),e([t({type:String,json:{write:!0}})],I.prototype,"title",void 0),I=J=e([p("esri.form.ExpressionInfo")],I);const it=I;let E=class extends g{constructor(o){super(o),this.description=null,this.label=null,this.type=null,this.visibilityExpression=null}};e([t({type:String,json:{write:!0}})],E.prototype,"description",void 0),e([t({type:String,json:{write:!0}})],E.prototype,"label",void 0),e([t()],E.prototype,"type",void 0),e([t({type:String,json:{write:!0}})],E.prototype,"visibilityExpression",void 0),E=e([p("esri.form.elements.Element")],E);const D=E;var z;let B=z=class extends g{constructor(i){super(i),this.type=null}clone(){return new z({type:this.type})}};e([t({type:["attachment","audio","document","image","signature","video"],json:{write:!0}})],B.prototype,"type",void 0),B=z=e([p("esri.form.elements.inputs.AttachmentInput")],B);const ot=B;var K;let F=K=class extends D{constructor(i){super(i),this.attachmentKeyword=null,this.editableExpression=null,this.input=null,this.type="attachment"}clone(){return new K({attachmentKeyword:this.attachmentKeyword,description:this.description,editableExpression:this.editableExpression,input:this.input,label:this.label,visibilityExpression:this.visibilityExpression})}};e([t({type:String,json:{write:!0}})],F.prototype,"attachmentKeyword",void 0),e([t({type:String,json:{write:!0}})],F.prototype,"editableExpression",void 0),e([t({type:ot,json:{read:{source:"inputType"},write:{target:"inputType"}}})],F.prototype,"input",void 0),e([t({type:["attachment"],json:{read:!1,write:!0}})],F.prototype,"type",void 0),F=K=e([p("esri.form.elements.AttachmentElement")],F);const ve=F;let L=class extends g{constructor(o){super(o),this.type=null}};e([t()],L.prototype,"type",void 0),L=e([p("esri.form.elements.inputs.Input")],L);const $=L;let k=class extends ${constructor(i){super(i),this.maxLength=null,this.minLength=0}};e([t({type:Number,json:{write:!0}})],k.prototype,"maxLength",void 0),e([t({type:Number,json:{write:!0}})],k.prototype,"minLength",void 0),k=e([p("esri.form.elements.inputs.TextInput")],k);const ue=k;var _;let U=_=class extends ue{constructor(i){super(i),this.type="barcode-scanner"}clone(){return new _({maxLength:this.maxLength,minLength:this.minLength})}};e([t({type:["barcode-scanner"],json:{read:!1,write:!0}})],U.prototype,"type",void 0),U=_=e([p("esri.form.elements.inputs.BarcodeScannerInput")],U);const rt=U;var X;let T=X=class extends ${constructor(i){super(i),this.noValueOptionLabel=null,this.showNoValueOption=!0,this.type="combo-box"}clone(){return new X({showNoValueOption:this.showNoValueOption,noValueOptionLabel:this.noValueOptionLabel})}};e([t({type:String,json:{write:!0}})],T.prototype,"noValueOptionLabel",void 0),e([t({type:Boolean,json:{write:!0}})],T.prototype,"showNoValueOption",void 0),e([t({type:["combo-box"],json:{read:!1,write:!0}})],T.prototype,"type",void 0),T=X=e([p("esri.form.elements.inputs.ComboBoxInput")],T);const st=T;var Y;function we(i){return i??null}function xe(i){return i??null}let w=Y=class extends ${constructor(i){super(i),this.max=null,this.min=null,this.type="date-picker"}readMax(i,o){return we(o.max)}writeMax(i,o){o.max=xe(i)}readMin(i,o){return we(o.min)}writeMin(i,o){o.min=xe(i)}clone(){return new Y({max:this.max,min:this.min})}};e([t({type:String,json:{type:String,write:!0}})],w.prototype,"max",void 0),e([l("max")],w.prototype,"readMax",null),e([u("max")],w.prototype,"writeMax",null),e([t({type:String,json:{type:String,write:!0}})],w.prototype,"min",void 0),e([l("min")],w.prototype,"readMin",null),e([u("min")],w.prototype,"writeMin",null),e([t({type:["date-picker"],json:{read:!1,write:!0}})],w.prototype,"type",void 0),w=Y=e([p("esri.form.elements.inputs.DatePickerInput")],w);const nt=w;var ee;function G(i){return i??null}function W(i){return i??null}let d=ee=class extends ${constructor(i){super(i),this.includeTimeOffset=!0,this.max=null,this.min=null,this.timeResolution="minutes",this.type="datetimeoffset-picker"}readMax(i,o){return G(o.max)}writeMax(i,o){o.max=W(i)}readMin(i,o){return G(o.min)}writeMin(i,o){o.min=W(i)}readTimeResolution(i,o){return G(o.timeResolution)}writeTimeResolution(i,o){o.timeResolution=W(i)}clone(){return new ee({includeTimeOffset:this.includeTimeOffset,max:this.max,min:this.min,timeResolution:this.timeResolution})}};e([t({type:Boolean,json:{write:!0}})],d.prototype,"includeTimeOffset",void 0),e([t({type:String,json:{type:String,write:!0}})],d.prototype,"max",void 0),e([l("max")],d.prototype,"readMax",null),e([u("max")],d.prototype,"writeMax",null),e([t({type:String,json:{type:String,write:!0}})],d.prototype,"min",void 0),e([l("min")],d.prototype,"readMin",null),e([u("min")],d.prototype,"writeMin",null),e([t({type:String,json:{type:String,write:!0}})],d.prototype,"timeResolution",void 0),e([l("timeResolution")],d.prototype,"readTimeResolution",null),e([u("timeResolution")],d.prototype,"writeTimeResolution",null),e([t({type:["datetimeoffset-picker"],json:{read:!1,write:!0}})],d.prototype,"type",void 0),d=ee=e([p("esri.form.elements.inputs.DateTimeOffsetPickerInput")],d);const pt=d;var te;function fe(i){return i!=null?new Date(i):null}function ge(i){return i?i.getTime():null}let h=te=class extends ${constructor(i){super(i),this.includeTime=!1,this.max=null,this.min=null,this.type="datetime-picker"}readMax(i,o){return fe(o.max)}writeMax(i,o){o.max=ge(i)}readMin(i,o){return fe(o.min)}writeMin(i,o){o.min=ge(i)}clone(){return new te({includeTime:this.includeTime,max:this.max,min:this.min})}};e([t({type:Boolean,json:{write:!0}})],h.prototype,"includeTime",void 0),e([t({type:Date,json:{type:Number,write:!0}})],h.prototype,"max",void 0),e([l("max")],h.prototype,"readMax",null),e([u("max")],h.prototype,"writeMax",null),e([t({type:Date,json:{type:Number,write:!0}})],h.prototype,"min",void 0),e([l("min")],h.prototype,"readMin",null),e([u("min")],h.prototype,"writeMin",null),e([t({type:["datetime-picker"],json:{read:!1,write:!0}})],h.prototype,"type",void 0),h=te=e([p("esri.form.elements.inputs.DateTimePickerInput")],h);const lt=h;var ie;let O=ie=class extends ${constructor(i){super(i),this.noValueOptionLabel=null,this.showNoValueOption=!0,this.type="radio-buttons"}clone(){return new ie({noValueOptionLabel:this.noValueOptionLabel,showNoValueOption:this.showNoValueOption})}};e([t({type:String,json:{write:!0}})],O.prototype,"noValueOptionLabel",void 0),e([t({type:Boolean,json:{write:!0}})],O.prototype,"showNoValueOption",void 0),e([t({type:["radio-buttons"],json:{read:!1,write:!0}})],O.prototype,"type",void 0),O=ie=e([p("esri.form.elements.inputs.RadioButtonsInput")],O);const at=O;var oe;let M=oe=class extends ${constructor(i){super(i),this.offValue=null,this.onValue=null,this.type="switch"}clone(){return new oe({offValue:this.offValue,onValue:this.onValue})}};e([t({type:[String,Number],json:{write:!0}})],M.prototype,"offValue",void 0),e([t({type:[String,Number],json:{write:!0}})],M.prototype,"onValue",void 0),e([t({type:["switch"],json:{read:!1,write:!0}})],M.prototype,"type",void 0),M=oe=e([p("esri.form.elements.inputs.SwitchInput")],M);const dt=M;var re;let A=re=class extends ue{constructor(i){super(i),this.type="text-area"}clone(){return new re({maxLength:this.maxLength,minLength:this.minLength})}};e([t({type:["text-area"],json:{read:!1,write:!0}})],A.prototype,"type",void 0),A=re=e([p("esri.form.elements.inputs.TextAreaInput")],A);const ut=A;var se;let C=se=class extends ue{constructor(i){super(i),this.type="text-box"}clone(){return new se({maxLength:this.maxLength,minLength:this.minLength})}};e([t({type:["text-box"],json:{read:!1,write:!0}})],C.prototype,"type",void 0),C=se=e([p("esri.form.elements.inputs.TextBoxInput")],C);const yt=C;var ne;function Q(i){return i??null}function P(i){return i??null}let y=ne=class extends ${constructor(i){super(i),this.max=null,this.min=null,this.timeResolution="minutes",this.type="time-picker"}readMax(i,o){return Q(o.max)}writeMax(i,o){o.max=P(i)}readMin(i,o){return Q(o.min)}writeMin(i,o){o.min=P(i)}readTimeResolution(i,o){return Q(o.timeResolution)}writeTimeResolution(i,o){o.timeResolution=P(i)}clone(){return new ne({max:this.max,min:this.min,timeResolution:this.timeResolution})}};e([t({type:String,json:{type:String,write:!0}})],y.prototype,"max",void 0),e([l("max")],y.prototype,"readMax",null),e([u("max")],y.prototype,"writeMax",null),e([t({type:String,json:{type:String,write:!0}})],y.prototype,"min",void 0),e([l("min")],y.prototype,"readMin",null),e([u("min")],y.prototype,"writeMin",null),e([t({type:String,json:{type:String,write:!0}})],y.prototype,"timeResolution",void 0),e([l("timeResolution")],y.prototype,"readTimeResolution",null),e([u("timeResolution")],y.prototype,"writeTimeResolution",null),e([t({type:["time-picker"],json:{read:!1,write:!0}})],y.prototype,"type",void 0),y=ne=e([p("esri.form.elements.inputs.TimePickerInput")],y);const ct=y,mt={base:$,key:"type",typeMap:{"barcode-scanner":rt,"combo-box":st,"date-picker":nt,"datetime-picker":lt,"datetimeoffset-picker":pt,"radio-buttons":at,switch:dt,"text-area":ut,"text-box":yt,"time-picker":ct}};var pe;const Me="esri.form.elements.FieldElement",be=Ee.getLogger(Me);let c=pe=class extends D{constructor(i){super(i),this.domain=null,this.editableExpression=null,this.fieldName=null,this.hint=null,this.input=null,this.requiredExpression=null,this.type="field",this.valueExpression=null}get editable(){return ce(be,"editable",{replacement:"editableExpression",version:"4.26",warnOnce:!0}),this._get("editable")??!0}set editable(i){ce(be,"editable",{replacement:"editableExpression",version:"4.26",warnOnce:!0}),this._set("editable",i)}clone(){return new pe({description:this.description,domain:this.domain,editable:this.editable,editableExpression:this.editableExpression,fieldName:this.fieldName,hint:this.hint,input:this.input,label:this.label,requiredExpression:this.requiredExpression,valueExpression:this.valueExpression,visibilityExpression:this.visibilityExpression})}};e([t({types:Ne,json:{read:{reader:Fe},write:!0}})],c.prototype,"domain",void 0),e([t({type:Boolean,json:{write:!0}})],c.prototype,"editable",null),e([t({type:String,json:{write:!0}})],c.prototype,"editableExpression",void 0),e([t({type:String,json:{write:!0}})],c.prototype,"fieldName",void 0),e([t({type:String,json:{write:!0}})],c.prototype,"hint",void 0),e([t({types:mt,json:{read:{source:"inputType"},write:{target:"inputType"}}})],c.prototype,"input",void 0),e([t({type:String,json:{write:!0}})],c.prototype,"requiredExpression",void 0),e([t({type:String,json:{read:!1,write:!0}})],c.prototype,"type",void 0),e([t({type:String,json:{write:!0}})],c.prototype,"valueExpression",void 0),c=pe=e([p(Me)],c);const je=c;var le;let b=le=class extends D{constructor(i){super(i),this.displayCount=null,this.displayType="list",this.editableExpression=null,this.orderByFields=null,this.relationshipId=null,this.type="relationship"}clone(){return new le({description:this.description,displayCount:this.displayCount,displayType:this.displayType,editableExpression:this.editableExpression,label:this.label,orderByFields:V(this.orderByFields),relationshipId:this.relationshipId,visibilityExpression:this.visibilityExpression})}};e([t({type:Number,json:{write:!0}})],b.prototype,"displayCount",void 0),e([t({type:["list"],json:{write:!0}})],b.prototype,"displayType",void 0),e([t({type:String,json:{write:!0}})],b.prototype,"editableExpression",void 0),e([t({type:[Be],json:{write:!0}})],b.prototype,"orderByFields",void 0),e([t({type:Number,json:{write:!0}})],b.prototype,"relationshipId",void 0),e([t({type:["relationship"],json:{read:!1,write:!0}})],b.prototype,"type",void 0),b=le=e([p("esri.form.elements.RelationshipElement")],b);const Se=b;function Re(i){return{typesWithGroup:{base:D,key:"type",typeMap:{attachment:ve,field:je,group:i,relationship:Se}},typesWithoutGroup:{base:D,key:"type",typeMap:{attachment:ve,field:je,relationship:Se}}}}function Ve(i,o,s=!0){if(!i)return null;const r=s?o.typesWithGroup.typeMap:o.typesWithoutGroup.typeMap;return i.filter(n=>r[n.type]).map(n=>r[n.type].fromJSON(n))}function De(i,o,s=!0){if(!i)return null;const r=s?o.typesWithGroup.typeMap:o.typesWithoutGroup.typeMap;return i.filter(n=>r[n.type]).map(n=>n.toJSON())}function ke(i,o,s=!0){return i?i.map(r=>Le(s?o.typesWithGroup:o.typesWithoutGroup,r)):null}var ae;let x=ae=class extends D{constructor(i){super(i),this.elements=null,this.initialState="expanded",this.type="group"}castElements(i){return ke(i,Z,!1)}readElements(i,o){return Ve(o.formElements,Z,!1)}writeElements(i,o){o.formElements=De(i,Z,!1)}clone(){return new ae({description:this.description,elements:V(this.elements),initialState:this.initialState,label:this.label,visibilityExpression:this.visibilityExpression})}};e([t({json:{write:!0}})],x.prototype,"elements",void 0),e([Te("elements")],x.prototype,"castElements",null),e([l("elements",["formElements"])],x.prototype,"readElements",null),e([u("elements")],x.prototype,"writeElements",null),e([t({type:["collapsed","expanded"],json:{write:!0}})],x.prototype,"initialState",void 0),e([t({type:String,json:{read:!1,write:!0}})],x.prototype,"type",void 0),x=ae=e([p("esri.form.elements.GroupElement")],x);const Z=Re(x),ht=x;var de;const H=Re(ht);let v=de=class extends g{constructor(i){super(i),this.description=null,this.elements=null,this.expressionInfos=null,this.preserveFieldValuesWhenHidden=!1,this.title=null}castElements(i){return ke(i,H)}readElements(i,o){return Ve(o.formElements,H)}writeElements(i,o){o.formElements=De(i,H)}clone(){return new de({description:this.description,expressionInfos:V(this.expressionInfos),elements:V(this.elements),title:this.title,preserveFieldValuesWhenHidden:this.preserveFieldValuesWhenHidden})}};e([t({type:String,json:{write:!0}})],v.prototype,"description",void 0),e([t({json:{write:!0}})],v.prototype,"elements",void 0),e([Te("elements")],v.prototype,"castElements",null),e([l("elements",["formElements"])],v.prototype,"readElements",null),e([u("elements")],v.prototype,"writeElements",null),e([t({type:[it],json:{write:!0}})],v.prototype,"expressionInfos",void 0),e([t({type:Boolean,json:{default:!1,write:!0}})],v.prototype,"preserveFieldValuesWhenHidden",void 0),e([t({type:String,json:{write:!0}})],v.prototype,"title",void 0),v=de=e([p("esri.form.FormTemplate")],v);const $t=v;let j=class extends N(g){constructor(o){super(o),this.creatorField=null,this.creationDateField=null,this.editorField=null,this.editDateField=null,this.realm=null,this.timeZone=null}};e([t()],j.prototype,"creatorField",void 0),e([t()],j.prototype,"creationDateField",void 0),e([t()],j.prototype,"editorField",void 0),e([t()],j.prototype,"editDateField",void 0),e([t()],j.prototype,"realm",void 0),e([t(q("dateFieldsTimeReference",!0))],j.prototype,"timeZone",void 0),j=e([p("esri.layers.support.EditFieldsInfo")],j);const vt=j;let f=class extends N(g){constructor(o){super(o)}};e([t({constructOnly:!0,json:{write:!0}})],f.prototype,"name",void 0),e([t({constructOnly:!0,json:{write:!0}})],f.prototype,"fields",void 0),e([t({constructOnly:!0,json:{write:!0}})],f.prototype,"isAscending",void 0),e([t({constructOnly:!0,json:{write:!0}})],f.prototype,"indexType",void 0),e([t({constructOnly:!0,json:{write:!0}})],f.prototype,"isUnique",void 0),e([t({constructOnly:!0,json:{write:!0}})],f.prototype,"description",void 0),f=e([p("esri.layers.support.FeatureIndex")],f);let R=class extends N(g){constructor(o){super(o),this.shapeAreaField=null,this.shapeLengthField=null,this.units=null}};e([t({type:String,json:{read:{source:"shapeAreaFieldName"}}})],R.prototype,"shapeAreaField",void 0),e([t({type:String,json:{read:{source:"shapeLengthFieldName"}}})],R.prototype,"shapeLengthField",void 0),e([t({type:String,json:{read:i=>Ue.read(i)||Ae.read(i)}})],R.prototype,"units",void 0),R=e([p("esri.layers.support.GeometryFieldsInfo")],R);const wt=R,$e=new Oe({esriRelCardinalityOneToOne:"one-to-one",esriRelCardinalityOneToMany:"one-to-many",esriRelCardinalityManyToMany:"many-to-many"}),Ie=new Oe({esriRelRoleOrigin:"origin",esriRelRoleDestination:"destination"});let m=class extends N(g){constructor(i){super(i),this.cardinality=null,this.composite=null,this.id=null,this.keyField=null,this.keyFieldInRelationshipTable=null,this.name=null,this.relatedTableId=null,this.relationshipTableId=null,this.role=null}};e([t({json:{read:$e.read,write:$e.write}})],m.prototype,"cardinality",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"composite",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"id",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"keyField",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"keyFieldInRelationshipTable",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"name",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"relatedTableId",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"relationshipTableId",void 0),e([t({json:{read:Ie.read,write:Ie.write}})],m.prototype,"role",void 0),m=e([p("esri.layers.support.Relationship")],m);const xt=m;let S=class extends N(g){constructor(i){super(i),this.code=null,this.defaultValues={},this.domains=null,this.name=null}readDomains(i){if(!i)return null;const o={};for(const s of Object.keys(i))o[s]=Fe(i[s]);return o}writeDomains(i,o){var r;if(!i)return;const s={};for(const n of Object.keys(i))i[n]&&(s[n]=(r=i[n])==null?void 0:r.toJSON());o.domains=s}};e([t({type:Number,json:{write:!0}})],S.prototype,"code",void 0),e([t({type:Object,json:{write:!0}})],S.prototype,"defaultValues",void 0),e([t({json:{write:!0}})],S.prototype,"domains",void 0),e([l("domains")],S.prototype,"readDomains",null),e([u("domains")],S.prototype,"writeDomains",null),e([t({type:String,json:{write:!0}})],S.prototype,"name",void 0),S=e([p("esri.layers.support.Subtype")],S);const ft=S,Tt=i=>{let o=class extends i{constructor(){super(...arguments),this.copyright=null,this.capabilities=null,this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.definitionExpression=null,this.displayField=null,this.editFieldsInfo=null,this.editingInfo=null,this.elevationInfo=null,this.floorInfo=null,this.fullExtent=null,this.gdbVersion=null,this.geometryFieldsInfo=null,this.geometryType=null,this.globalIdField=null,this.hasM=void 0,this.hasZ=void 0,this.heightModelInfo=null,this.historicMoment=null,this.indexes=new(me.ofType(f)),this.isTable=!1,this.layerId=void 0,this.maxScale=0,this.minScale=0,this.objectIdField=null,this.preferredTimeZone=null,this.relationships=null,this.returnM=void 0,this.returnZ=void 0,this.serviceDefinitionExpression=null,this.serviceItemId=null,this.sourceJSON=null,this.spatialReference=he.WGS84,this.subtypeField=null,this.subtypes=null,this.trackIdField=null,this.version=void 0}get authenticationTriggerEvent(){if(!this.url)return null;const{capabilities:s}=this;if(s){const{query:r,operations:n,editing:a}=s;if(!r.supportsQueryByOthers||!r.supportsQueryByAnonymous||n.supportsEditing&&!(a.supportsUpdateByOthers&&a.supportsUpdateByAnonymous&&a.supportsDeleteByOthers&&a.supportsDeleteByAnonymous))return"load"}return this.userHasUpdateItemPrivileges?ze(this)?"load":this.hasUpdateItemRestrictions?s.operations.supportsQuery?"editing":"load":null:this.userHasFullEditingPrivileges&&this.hasFullEditingRestrictions?"editing":null}readCapabilitiesFromService(s,r){return tt(r,this.url)}readEditingInfo(s,r){const{editingInfo:n}=r;return n?{lastEditDate:n.lastEditDate!=null?new Date(n.lastEditDate):null}:null}get effectiveCapabilities(){var ye;const s=this.capabilities;if(!s)return null;const r=V(s),{operations:n,editing:a}=r;return(ye=this.sourceJSON)!=null&&ye.isMultiServicesView?(this.userHasUpdateItemPrivileges&&(n.supportsQuery=!0),r):this.userHasUpdateItemPrivileges?(n.supportsAdd=n.supportsDelete=n.supportsEditing=n.supportsQuery=n.supportsUpdate=a.supportsDeleteByOthers=a.supportsGeometryUpdate=a.supportsUpdateByOthers=!0,r):(this.userHasFullEditingPrivileges&&n.supportsEditing&&(n.supportsAdd=n.supportsDelete=n.supportsUpdate=a.supportsGeometryUpdate=!0),r)}readGlobalIdFieldFromService(s,r){return Ke(r)}get hasFullEditingRestrictions(){var a;const s=this.capabilities;if(!s||(a=this.sourceJSON)!=null&&a.isMultiServicesView)return!1;const{operations:r,editing:n}=s;return r.supportsEditing&&!(r.supportsAdd&&r.supportsDelete&&r.supportsUpdate&&n.supportsGeometryUpdate)}get hasUpdateItemRestrictions(){var a;const s=this.capabilities;if(!s)return!1;const{operations:r,editing:n}=s;return(a=this.sourceJSON)!=null&&a.isMultiServicesView?!r.supportsQuery:!(r.supportsAdd&&r.supportsDelete&&r.supportsEditing&&r.supportsQuery&&r.supportsUpdate&&n.supportsDeleteByOthers&&n.supportsGeometryUpdate&&n.supportsUpdateByOthers)}readIsTableFromService(s,r){return r.type==="Table"}readMaxScale(s,r){return r.effectiveMaxScale||s||0}readMinScale(s,r){return r.effectiveMinScale||s||0}readObjectIdFieldFromService(s,r){return _e(r)}readServiceDefinitionExpression(s,r){return r.definitionQuery||r.definitionExpression}set url(s){const r=Xe({layer:this,url:s,nonStandardUrlAllowed:!0,logger:Ee.getLogger(this)});this._set("url",r.url),r.layerId!=null&&this._set("layerId",r.layerId)}writeUrl(s,r,n,a){Ye(this,s,null,r,a)}readVersion(s,r){return et(r)}};return e([t({readOnly:!0})],o.prototype,"authenticationTriggerEvent",null),e([t({type:String,json:{origins:{service:{read:{source:"copyrightText"}}}}})],o.prototype,"copyright",void 0),e([t({readOnly:!0,json:{read:!1,origins:{service:{read:{source:["advancedQueryCapabilities","allowGeometryUpdates","allowUpdateWithoutMValues","archivingInfo","capabilities","datesInUnknownTimezone","hasAttachments","hasM","hasZ","maxRecordCount","maxRecordCountFactor","ownershipBasedAccessControlForFeatures","standardMaxRecordCount","supportedQueryFormats","supportsAdvancedQueries","supportsApplyEditsWithGlobalIds","supportsAttachmentsByUploadId","supportsAttachmentsResizing","supportsCalculate","supportsCoordinatesQuantization","supportsExceedsLimitStatistics","supportsFieldDescriptionProperty","supportsQuantizationEditMode","supportsRollbackOnFailureParameter","supportsStatistics","supportsTruncate","supportsValidateSql","tileMaxRecordCount","useStandardizedQueries"]}}}}})],o.prototype,"capabilities",void 0),e([l("service","capabilities")],o.prototype,"readCapabilitiesFromService",null),e([t(q("dateFieldsTimeReference"))],o.prototype,"dateFieldsTimeZone",void 0),e([t({type:Boolean})],o.prototype,"datesInUnknownTimezone",void 0),e([t({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],o.prototype,"definitionExpression",void 0),e([t({type:String,json:{origins:{service:{read:{source:"displayField"}}}}})],o.prototype,"displayField",void 0),e([t({readOnly:!0,type:vt})],o.prototype,"editFieldsInfo",void 0),e([t({readOnly:!0})],o.prototype,"editingInfo",void 0),e([l("editingInfo")],o.prototype,"readEditingInfo",null),e([t({readOnly:!0})],o.prototype,"effectiveCapabilities",null),e([t((()=>{const s=V(Ce),r=s.json.origins;return r["web-map"]={read:!1,write:!1},r["portal-item"]={read:!1,write:!1},s})())],o.prototype,"elevationInfo",void 0),e([t({type:Ge,json:{name:"layerDefinition.floorInfo",write:!0,origins:{"web-scene":{name:"layerDefinition.floorInfo",write:{enabled:!0,layerContainerTypes:We}}}}})],o.prototype,"floorInfo",void 0),e([t({type:Qe,json:{origins:{service:{read:{source:"extent"}}}}})],o.prototype,"fullExtent",void 0),e([t()],o.prototype,"gdbVersion",void 0),e([t({readOnly:!0,type:wt,json:{read:{source:"geometryProperties"}}})],o.prototype,"geometryFieldsInfo",void 0),e([t({type:["point","polygon","polyline","multipoint","multipatch","mesh"],json:{origins:{service:{read:Pe.read}}}})],o.prototype,"geometryType",void 0),e([t({type:String})],o.prototype,"globalIdField",void 0),e([l("service","globalIdField",["globalIdField","fields"])],o.prototype,"readGlobalIdFieldFromService",null),e([t({readOnly:!0})],o.prototype,"hasFullEditingRestrictions",null),e([t({type:Boolean,json:{origins:{service:{read:!0}}}})],o.prototype,"hasM",void 0),e([t({readOnly:!0})],o.prototype,"hasUpdateItemRestrictions",null),e([t({type:Boolean,json:{origins:{service:{read:!0}}}})],o.prototype,"hasZ",void 0),e([t({readOnly:!0,type:Ze})],o.prototype,"heightModelInfo",void 0),e([t({type:Date})],o.prototype,"historicMoment",void 0),e([t({type:me.ofType(f),readOnly:!0})],o.prototype,"indexes",void 0),e([t({readOnly:!0})],o.prototype,"isTable",void 0),e([l("service","isTable",["type"])],o.prototype,"readIsTableFromService",null),e([t({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{read:!1,write:{target:"id"}}},read:!1}})],o.prototype,"layerId",void 0),e([t(He)],o.prototype,"maxScale",void 0),e([l("service","maxScale",["maxScale","effectiveMaxScale"])],o.prototype,"readMaxScale",null),e([t(qe)],o.prototype,"minScale",void 0),e([l("service","minScale",["minScale","effectiveMinScale"])],o.prototype,"readMinScale",null),e([t({type:String})],o.prototype,"objectIdField",void 0),e([l("service","objectIdField",["objectIdField","fields"])],o.prototype,"readObjectIdFieldFromService",null),e([t(q("preferredTimeReference"))],o.prototype,"preferredTimeZone",void 0),e([t({type:[xt],readOnly:!0})],o.prototype,"relationships",void 0),e([t({type:Boolean})],o.prototype,"returnM",void 0),e([t({type:Boolean})],o.prototype,"returnZ",void 0),e([t({readOnly:!0,json:{write:!1}})],o.prototype,"serverGens",void 0),e([t({readOnly:!0})],o.prototype,"serviceDefinitionExpression",void 0),e([l("service","serviceDefinitionExpression",["definitionQuery","definitionExpression"])],o.prototype,"readServiceDefinitionExpression",null),e([t({type:String,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],o.prototype,"serviceItemId",void 0),e([t()],o.prototype,"sourceJSON",void 0),e([t({type:he,json:{origins:{service:{read:{source:"extent.spatialReference"}}}}})],o.prototype,"spatialReference",void 0),e([t({type:String,readOnly:!0,json:{origins:{service:{read:!0}}}})],o.prototype,"subtypeField",void 0),e([t({type:[ft],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],o.prototype,"subtypes",void 0),e([t({type:String,json:{read:{source:"timeInfo.trackIdField"}}})],o.prototype,"trackIdField",void 0),e([t(Je)],o.prototype,"url",null),e([u("url")],o.prototype,"writeUrl",null),e([t({json:{origins:{service:{read:!0}},read:!1}})],o.prototype,"version",void 0),e([l("service","version",["currentVersion","capabilities","drawingInfo","hasAttachments","htmlPopupType","relationships","timeInfo","typeIdField","types"])],o.prototype,"readVersion",null),o=e([p("esri.layers.mixins.FeatureLayerBase")],o),o};export{Tt as D,$t as y}; +import{e,y as t,c as p,dr as g,dt as l,du as u,R as Ee,vd as Be,ds as Fe,uA as ce,ve as Ne,ah as V,vf as Le,f1 as Te,dq as B,eq as H,uK as Ue,uJ as Ae,dp as Oe,iI as Ce,ls as Ge,mG as Qe,dO as We,mF as Pe,vg as Ze,V as me,jk as qe,jl as He,d2 as he,dR as Je,vh as ze,mA as Ke,mB as _e,vi as Xe,vj as Ye,vk as et}from"./index-pCX-0tJH.js";import{a as tt}from"./serviceCapabilitiesUtils-f-iBP4uh.js";var J;let I=J=class extends g{constructor(i){super(i),this.expression=null,this.name=null,this.returnType="boolean",this.title=null}clone(){return new J({name:this.name,title:this.title,expression:this.expression,returnType:this.returnType})}};e([t({type:String,json:{write:!0}})],I.prototype,"expression",void 0),e([t({type:String,json:{write:!0}})],I.prototype,"name",void 0),e([t({type:["boolean","date","number","string"],json:{write:!0}})],I.prototype,"returnType",void 0),e([t({type:String,json:{write:!0}})],I.prototype,"title",void 0),I=J=e([p("esri.form.ExpressionInfo")],I);const it=I;let E=class extends g{constructor(o){super(o),this.description=null,this.label=null,this.type=null,this.visibilityExpression=null}};e([t({type:String,json:{write:!0}})],E.prototype,"description",void 0),e([t({type:String,json:{write:!0}})],E.prototype,"label",void 0),e([t()],E.prototype,"type",void 0),e([t({type:String,json:{write:!0}})],E.prototype,"visibilityExpression",void 0),E=e([p("esri.form.elements.Element")],E);const D=E;var z;let N=z=class extends g{constructor(i){super(i),this.type=null}clone(){return new z({type:this.type})}};e([t({type:["attachment","audio","document","image","signature","video"],json:{write:!0}})],N.prototype,"type",void 0),N=z=e([p("esri.form.elements.inputs.AttachmentInput")],N);const ot=N;var K;let F=K=class extends D{constructor(i){super(i),this.attachmentKeyword=null,this.editableExpression=null,this.input=null,this.type="attachment"}clone(){return new K({attachmentKeyword:this.attachmentKeyword,description:this.description,editableExpression:this.editableExpression,input:this.input,label:this.label,visibilityExpression:this.visibilityExpression})}};e([t({type:String,json:{write:!0}})],F.prototype,"attachmentKeyword",void 0),e([t({type:String,json:{write:!0}})],F.prototype,"editableExpression",void 0),e([t({type:ot,json:{read:{source:"inputType"},write:{target:"inputType"}}})],F.prototype,"input",void 0),e([t({type:["attachment"],json:{read:!1,write:!0}})],F.prototype,"type",void 0),F=K=e([p("esri.form.elements.AttachmentElement")],F);const ve=F;let L=class extends g{constructor(o){super(o),this.type=null}};e([t()],L.prototype,"type",void 0),L=e([p("esri.form.elements.inputs.Input")],L);const $=L;let k=class extends ${constructor(i){super(i),this.maxLength=null,this.minLength=0}};e([t({type:Number,json:{write:!0}})],k.prototype,"maxLength",void 0),e([t({type:Number,json:{write:!0}})],k.prototype,"minLength",void 0),k=e([p("esri.form.elements.inputs.TextInput")],k);const ue=k;var _;let U=_=class extends ue{constructor(i){super(i),this.type="barcode-scanner"}clone(){return new _({maxLength:this.maxLength,minLength:this.minLength})}};e([t({type:["barcode-scanner"],json:{read:!1,write:!0}})],U.prototype,"type",void 0),U=_=e([p("esri.form.elements.inputs.BarcodeScannerInput")],U);const rt=U;var X;let T=X=class extends ${constructor(i){super(i),this.noValueOptionLabel=null,this.showNoValueOption=!0,this.type="combo-box"}clone(){return new X({showNoValueOption:this.showNoValueOption,noValueOptionLabel:this.noValueOptionLabel})}};e([t({type:String,json:{write:!0}})],T.prototype,"noValueOptionLabel",void 0),e([t({type:Boolean,json:{write:!0}})],T.prototype,"showNoValueOption",void 0),e([t({type:["combo-box"],json:{read:!1,write:!0}})],T.prototype,"type",void 0),T=X=e([p("esri.form.elements.inputs.ComboBoxInput")],T);const st=T;var Y;function fe(i){return i??null}function we(i){return i??null}let f=Y=class extends ${constructor(i){super(i),this.max=null,this.min=null,this.type="date-picker"}readMax(i,o){return fe(o.max)}writeMax(i,o){o.max=we(i)}readMin(i,o){return fe(o.min)}writeMin(i,o){o.min=we(i)}clone(){return new Y({max:this.max,min:this.min})}};e([t({type:String,json:{type:String,write:!0}})],f.prototype,"max",void 0),e([l("max")],f.prototype,"readMax",null),e([u("max")],f.prototype,"writeMax",null),e([t({type:String,json:{type:String,write:!0}})],f.prototype,"min",void 0),e([l("min")],f.prototype,"readMin",null),e([u("min")],f.prototype,"writeMin",null),e([t({type:["date-picker"],json:{read:!1,write:!0}})],f.prototype,"type",void 0),f=Y=e([p("esri.form.elements.inputs.DatePickerInput")],f);const nt=f;var ee;function G(i){return i??null}function Q(i){return i??null}let d=ee=class extends ${constructor(i){super(i),this.includeTimeOffset=!0,this.max=null,this.min=null,this.timeResolution="minutes",this.type="datetimeoffset-picker"}readMax(i,o){return G(o.max)}writeMax(i,o){o.max=Q(i)}readMin(i,o){return G(o.min)}writeMin(i,o){o.min=Q(i)}readTimeResolution(i,o){return G(o.timeResolution)}writeTimeResolution(i,o){o.timeResolution=Q(i)}clone(){return new ee({includeTimeOffset:this.includeTimeOffset,max:this.max,min:this.min,timeResolution:this.timeResolution})}};e([t({type:Boolean,json:{write:!0}})],d.prototype,"includeTimeOffset",void 0),e([t({type:String,json:{type:String,write:!0}})],d.prototype,"max",void 0),e([l("max")],d.prototype,"readMax",null),e([u("max")],d.prototype,"writeMax",null),e([t({type:String,json:{type:String,write:!0}})],d.prototype,"min",void 0),e([l("min")],d.prototype,"readMin",null),e([u("min")],d.prototype,"writeMin",null),e([t({type:String,json:{type:String,write:!0}})],d.prototype,"timeResolution",void 0),e([l("timeResolution")],d.prototype,"readTimeResolution",null),e([u("timeResolution")],d.prototype,"writeTimeResolution",null),e([t({type:["datetimeoffset-picker"],json:{read:!1,write:!0}})],d.prototype,"type",void 0),d=ee=e([p("esri.form.elements.inputs.DateTimeOffsetPickerInput")],d);const pt=d;var te;function xe(i){return i!=null?new Date(i):null}function ge(i){return i?i.getTime():null}let h=te=class extends ${constructor(i){super(i),this.includeTime=!1,this.max=null,this.min=null,this.type="datetime-picker"}readMax(i,o){return xe(o.max)}writeMax(i,o){o.max=ge(i)}readMin(i,o){return xe(o.min)}writeMin(i,o){o.min=ge(i)}clone(){return new te({includeTime:this.includeTime,max:this.max,min:this.min})}};e([t({type:Boolean,json:{write:!0}})],h.prototype,"includeTime",void 0),e([t({type:Date,json:{type:Number,write:!0}})],h.prototype,"max",void 0),e([l("max")],h.prototype,"readMax",null),e([u("max")],h.prototype,"writeMax",null),e([t({type:Date,json:{type:Number,write:!0}})],h.prototype,"min",void 0),e([l("min")],h.prototype,"readMin",null),e([u("min")],h.prototype,"writeMin",null),e([t({type:["datetime-picker"],json:{read:!1,write:!0}})],h.prototype,"type",void 0),h=te=e([p("esri.form.elements.inputs.DateTimePickerInput")],h);const lt=h;var ie;let O=ie=class extends ${constructor(i){super(i),this.noValueOptionLabel=null,this.showNoValueOption=!0,this.type="radio-buttons"}clone(){return new ie({noValueOptionLabel:this.noValueOptionLabel,showNoValueOption:this.showNoValueOption})}};e([t({type:String,json:{write:!0}})],O.prototype,"noValueOptionLabel",void 0),e([t({type:Boolean,json:{write:!0}})],O.prototype,"showNoValueOption",void 0),e([t({type:["radio-buttons"],json:{read:!1,write:!0}})],O.prototype,"type",void 0),O=ie=e([p("esri.form.elements.inputs.RadioButtonsInput")],O);const at=O;var oe;let M=oe=class extends ${constructor(i){super(i),this.offValue=null,this.onValue=null,this.type="switch"}clone(){return new oe({offValue:this.offValue,onValue:this.onValue})}};e([t({type:[String,Number],json:{write:!0}})],M.prototype,"offValue",void 0),e([t({type:[String,Number],json:{write:!0}})],M.prototype,"onValue",void 0),e([t({type:["switch"],json:{read:!1,write:!0}})],M.prototype,"type",void 0),M=oe=e([p("esri.form.elements.inputs.SwitchInput")],M);const dt=M;var re;let A=re=class extends ue{constructor(i){super(i),this.type="text-area"}clone(){return new re({maxLength:this.maxLength,minLength:this.minLength})}};e([t({type:["text-area"],json:{read:!1,write:!0}})],A.prototype,"type",void 0),A=re=e([p("esri.form.elements.inputs.TextAreaInput")],A);const ut=A;var se;let C=se=class extends ue{constructor(i){super(i),this.type="text-box"}clone(){return new se({maxLength:this.maxLength,minLength:this.minLength})}};e([t({type:["text-box"],json:{read:!1,write:!0}})],C.prototype,"type",void 0),C=se=e([p("esri.form.elements.inputs.TextBoxInput")],C);const yt=C;var ne;function W(i){return i??null}function P(i){return i??null}let y=ne=class extends ${constructor(i){super(i),this.max=null,this.min=null,this.timeResolution="minutes",this.type="time-picker"}readMax(i,o){return W(o.max)}writeMax(i,o){o.max=P(i)}readMin(i,o){return W(o.min)}writeMin(i,o){o.min=P(i)}readTimeResolution(i,o){return W(o.timeResolution)}writeTimeResolution(i,o){o.timeResolution=P(i)}clone(){return new ne({max:this.max,min:this.min,timeResolution:this.timeResolution})}};e([t({type:String,json:{type:String,write:!0}})],y.prototype,"max",void 0),e([l("max")],y.prototype,"readMax",null),e([u("max")],y.prototype,"writeMax",null),e([t({type:String,json:{type:String,write:!0}})],y.prototype,"min",void 0),e([l("min")],y.prototype,"readMin",null),e([u("min")],y.prototype,"writeMin",null),e([t({type:String,json:{type:String,write:!0}})],y.prototype,"timeResolution",void 0),e([l("timeResolution")],y.prototype,"readTimeResolution",null),e([u("timeResolution")],y.prototype,"writeTimeResolution",null),e([t({type:["time-picker"],json:{read:!1,write:!0}})],y.prototype,"type",void 0),y=ne=e([p("esri.form.elements.inputs.TimePickerInput")],y);const ct=y,mt={base:$,key:"type",typeMap:{"barcode-scanner":rt,"combo-box":st,"date-picker":nt,"datetime-picker":lt,"datetimeoffset-picker":pt,"radio-buttons":at,switch:dt,"text-area":ut,"text-box":yt,"time-picker":ct}};var pe;const Me="esri.form.elements.FieldElement",be=Ee.getLogger(Me);let c=pe=class extends D{constructor(i){super(i),this.domain=null,this.editableExpression=null,this.fieldName=null,this.hint=null,this.input=null,this.requiredExpression=null,this.type="field",this.valueExpression=null}get editable(){return ce(be,"editable",{replacement:"editableExpression",version:"4.26",warnOnce:!0}),this._get("editable")??!0}set editable(i){ce(be,"editable",{replacement:"editableExpression",version:"4.26",warnOnce:!0}),this._set("editable",i)}clone(){return new pe({description:this.description,domain:this.domain,editable:this.editable,editableExpression:this.editableExpression,fieldName:this.fieldName,hint:this.hint,input:this.input,label:this.label,requiredExpression:this.requiredExpression,valueExpression:this.valueExpression,visibilityExpression:this.visibilityExpression})}};e([t({types:Be,json:{read:{reader:Fe},write:!0}})],c.prototype,"domain",void 0),e([t({type:Boolean,json:{write:!0}})],c.prototype,"editable",null),e([t({type:String,json:{write:!0}})],c.prototype,"editableExpression",void 0),e([t({type:String,json:{write:!0}})],c.prototype,"fieldName",void 0),e([t({type:String,json:{write:!0}})],c.prototype,"hint",void 0),e([t({types:mt,json:{read:{source:"inputType"},write:{target:"inputType"}}})],c.prototype,"input",void 0),e([t({type:String,json:{write:!0}})],c.prototype,"requiredExpression",void 0),e([t({type:String,json:{read:!1,write:!0}})],c.prototype,"type",void 0),e([t({type:String,json:{write:!0}})],c.prototype,"valueExpression",void 0),c=pe=e([p(Me)],c);const je=c;var le;let b=le=class extends D{constructor(i){super(i),this.displayCount=null,this.displayType="list",this.editableExpression=null,this.orderByFields=null,this.relationshipId=null,this.type="relationship"}clone(){return new le({description:this.description,displayCount:this.displayCount,displayType:this.displayType,editableExpression:this.editableExpression,label:this.label,orderByFields:V(this.orderByFields),relationshipId:this.relationshipId,visibilityExpression:this.visibilityExpression})}};e([t({type:Number,json:{write:!0}})],b.prototype,"displayCount",void 0),e([t({type:["list"],json:{write:!0}})],b.prototype,"displayType",void 0),e([t({type:String,json:{write:!0}})],b.prototype,"editableExpression",void 0),e([t({type:[Ne],json:{write:!0}})],b.prototype,"orderByFields",void 0),e([t({type:Number,json:{write:!0}})],b.prototype,"relationshipId",void 0),e([t({type:["relationship"],json:{read:!1,write:!0}})],b.prototype,"type",void 0),b=le=e([p("esri.form.elements.RelationshipElement")],b);const Se=b;function Re(i){return{typesWithGroup:{base:D,key:"type",typeMap:{attachment:ve,field:je,group:i,relationship:Se}},typesWithoutGroup:{base:D,key:"type",typeMap:{attachment:ve,field:je,relationship:Se}}}}function Ve(i,o,s=!0){if(!i)return null;const r=s?o.typesWithGroup.typeMap:o.typesWithoutGroup.typeMap;return i.filter(n=>r[n.type]).map(n=>r[n.type].fromJSON(n))}function De(i,o,s=!0){if(!i)return null;const r=s?o.typesWithGroup.typeMap:o.typesWithoutGroup.typeMap;return i.filter(n=>r[n.type]).map(n=>n.toJSON())}function ke(i,o,s=!0){return i?i.map(r=>Le(s?o.typesWithGroup:o.typesWithoutGroup,r)):null}var ae;let w=ae=class extends D{constructor(i){super(i),this.elements=null,this.initialState="expanded",this.type="group"}castElements(i){return ke(i,Z,!1)}readElements(i,o){return Ve(o.formElements,Z,!1)}writeElements(i,o){o.formElements=De(i,Z,!1)}clone(){return new ae({description:this.description,elements:V(this.elements),initialState:this.initialState,label:this.label,visibilityExpression:this.visibilityExpression})}};e([t({json:{write:!0}})],w.prototype,"elements",void 0),e([Te("elements")],w.prototype,"castElements",null),e([l("elements",["formElements"])],w.prototype,"readElements",null),e([u("elements")],w.prototype,"writeElements",null),e([t({type:["collapsed","expanded"],json:{write:!0}})],w.prototype,"initialState",void 0),e([t({type:String,json:{read:!1,write:!0}})],w.prototype,"type",void 0),w=ae=e([p("esri.form.elements.GroupElement")],w);const Z=Re(w),ht=w;var de;const q=Re(ht);let v=de=class extends g{constructor(i){super(i),this.description=null,this.elements=null,this.expressionInfos=null,this.preserveFieldValuesWhenHidden=!1,this.title=null}castElements(i){return ke(i,q)}readElements(i,o){return Ve(o.formElements,q)}writeElements(i,o){o.formElements=De(i,q)}clone(){return new de({description:this.description,expressionInfos:V(this.expressionInfos),elements:V(this.elements),title:this.title,preserveFieldValuesWhenHidden:this.preserveFieldValuesWhenHidden})}};e([t({type:String,json:{write:!0}})],v.prototype,"description",void 0),e([t({json:{write:!0}})],v.prototype,"elements",void 0),e([Te("elements")],v.prototype,"castElements",null),e([l("elements",["formElements"])],v.prototype,"readElements",null),e([u("elements")],v.prototype,"writeElements",null),e([t({type:[it],json:{write:!0}})],v.prototype,"expressionInfos",void 0),e([t({type:Boolean,json:{default:!1,write:!0}})],v.prototype,"preserveFieldValuesWhenHidden",void 0),e([t({type:String,json:{write:!0}})],v.prototype,"title",void 0),v=de=e([p("esri.form.FormTemplate")],v);const $t=v;let j=class extends B(g){constructor(o){super(o),this.creatorField=null,this.creationDateField=null,this.editorField=null,this.editDateField=null,this.realm=null,this.timeZone=null}};e([t()],j.prototype,"creatorField",void 0),e([t()],j.prototype,"creationDateField",void 0),e([t()],j.prototype,"editorField",void 0),e([t()],j.prototype,"editDateField",void 0),e([t()],j.prototype,"realm",void 0),e([t(H("dateFieldsTimeReference",!0))],j.prototype,"timeZone",void 0),j=e([p("esri.layers.support.EditFieldsInfo")],j);const vt=j;let x=class extends B(g){constructor(o){super(o)}};e([t({constructOnly:!0,json:{write:!0}})],x.prototype,"name",void 0),e([t({constructOnly:!0,json:{write:!0}})],x.prototype,"fields",void 0),e([t({constructOnly:!0,json:{write:!0}})],x.prototype,"isAscending",void 0),e([t({constructOnly:!0,json:{write:!0}})],x.prototype,"indexType",void 0),e([t({constructOnly:!0,json:{write:!0}})],x.prototype,"isUnique",void 0),e([t({constructOnly:!0,json:{write:!0}})],x.prototype,"description",void 0),x=e([p("esri.layers.support.FeatureIndex")],x);let R=class extends B(g){constructor(o){super(o),this.shapeAreaField=null,this.shapeLengthField=null,this.units=null}};e([t({type:String,json:{read:{source:"shapeAreaFieldName"}}})],R.prototype,"shapeAreaField",void 0),e([t({type:String,json:{read:{source:"shapeLengthFieldName"}}})],R.prototype,"shapeLengthField",void 0),e([t({type:String,json:{read:i=>Ue.read(i)||Ae.read(i)}})],R.prototype,"units",void 0),R=e([p("esri.layers.support.GeometryFieldsInfo")],R);const ft=R,$e=new Oe({esriRelCardinalityOneToOne:"one-to-one",esriRelCardinalityOneToMany:"one-to-many",esriRelCardinalityManyToMany:"many-to-many"}),Ie=new Oe({esriRelRoleOrigin:"origin",esriRelRoleDestination:"destination"});let m=class extends B(g){constructor(i){super(i),this.cardinality=null,this.composite=null,this.id=null,this.keyField=null,this.keyFieldInRelationshipTable=null,this.name=null,this.relatedTableId=null,this.relationshipTableId=null,this.role=null}};e([t({json:{read:$e.read,write:$e.write}})],m.prototype,"cardinality",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"composite",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"id",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"keyField",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"keyFieldInRelationshipTable",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"name",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"relatedTableId",void 0),e([t({json:{read:!0,write:!0}})],m.prototype,"relationshipTableId",void 0),e([t({json:{read:Ie.read,write:Ie.write}})],m.prototype,"role",void 0),m=e([p("esri.layers.support.Relationship")],m);const wt=m;let S=class extends B(g){constructor(i){super(i),this.code=null,this.defaultValues={},this.domains=null,this.name=null}readDomains(i){if(!i)return null;const o={};for(const s of Object.keys(i))o[s]=Fe(i[s]);return o}writeDomains(i,o){var r;if(!i)return;const s={};for(const n of Object.keys(i))i[n]&&(s[n]=(r=i[n])==null?void 0:r.toJSON());o.domains=s}};e([t({type:Number,json:{write:!0}})],S.prototype,"code",void 0),e([t({type:Object,json:{write:!0}})],S.prototype,"defaultValues",void 0),e([t({json:{write:!0}})],S.prototype,"domains",void 0),e([l("domains")],S.prototype,"readDomains",null),e([u("domains")],S.prototype,"writeDomains",null),e([t({type:String,json:{write:!0}})],S.prototype,"name",void 0),S=e([p("esri.layers.support.Subtype")],S);const xt=S,Tt=i=>{let o=class extends i{constructor(){super(...arguments),this.copyright=null,this.capabilities=null,this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.definitionExpression=null,this.displayField=null,this.editFieldsInfo=null,this.editingInfo=null,this.elevationInfo=null,this.floorInfo=null,this.fullExtent=null,this.gdbVersion=null,this.geometryFieldsInfo=null,this.geometryType=null,this.globalIdField=null,this.hasM=void 0,this.hasZ=void 0,this.heightModelInfo=null,this.historicMoment=null,this.indexes=new(me.ofType(x)),this.isTable=!1,this.layerId=void 0,this.maxScale=0,this.minScale=0,this.objectIdField=null,this.preferredTimeZone=null,this.relationships=null,this.returnM=void 0,this.returnZ=void 0,this.serviceDefinitionExpression=null,this.serviceItemId=null,this.sourceJSON=null,this.spatialReference=he.WGS84,this.subtypeField=null,this.subtypes=null,this.trackIdField=null,this.version=void 0}get authenticationTriggerEvent(){if(!this.url)return null;const{capabilities:s}=this;if(s){const{query:r,operations:n,editing:a}=s;if(!r.supportsQueryByOthers||!r.supportsQueryByAnonymous||n.supportsEditing&&!(a.supportsUpdateByOthers&&a.supportsUpdateByAnonymous&&a.supportsDeleteByOthers&&a.supportsDeleteByAnonymous))return"load"}return this.userHasUpdateItemPrivileges?ze(this)?"load":this.hasUpdateItemRestrictions?s.operations.supportsQuery?"editing":"load":null:this.userHasFullEditingPrivileges&&this.hasFullEditingRestrictions?"editing":null}readCapabilitiesFromService(s,r){return tt(r,this.url)}readEditingInfo(s,r){const{editingInfo:n}=r;return n?{lastEditDate:n.lastEditDate!=null?new Date(n.lastEditDate):null}:null}get effectiveCapabilities(){var ye;const s=this.capabilities;if(!s)return null;const r=V(s),{operations:n,editing:a}=r;return(ye=this.sourceJSON)!=null&&ye.isMultiServicesView?(this.userHasUpdateItemPrivileges&&(n.supportsQuery=!0),r):this.userHasUpdateItemPrivileges?(n.supportsAdd=n.supportsDelete=n.supportsEditing=n.supportsQuery=n.supportsUpdate=a.supportsDeleteByOthers=a.supportsGeometryUpdate=a.supportsUpdateByOthers=!0,r):(this.userHasFullEditingPrivileges&&n.supportsEditing&&(n.supportsAdd=n.supportsDelete=n.supportsUpdate=a.supportsGeometryUpdate=!0),r)}readGlobalIdFieldFromService(s,r){return Ke(r)}get hasFullEditingRestrictions(){var a;const s=this.capabilities;if(!s||(a=this.sourceJSON)!=null&&a.isMultiServicesView)return!1;const{operations:r,editing:n}=s;return r.supportsEditing&&!(r.supportsAdd&&r.supportsDelete&&r.supportsUpdate&&n.supportsGeometryUpdate)}get hasUpdateItemRestrictions(){var a;const s=this.capabilities;if(!s)return!1;const{operations:r,editing:n}=s;return(a=this.sourceJSON)!=null&&a.isMultiServicesView?!r.supportsQuery:!(r.supportsAdd&&r.supportsDelete&&r.supportsEditing&&r.supportsQuery&&r.supportsUpdate&&n.supportsDeleteByOthers&&n.supportsGeometryUpdate&&n.supportsUpdateByOthers)}readIsTableFromService(s,r){return r.type==="Table"}readMaxScale(s,r){return r.effectiveMaxScale||s||0}readMinScale(s,r){return r.effectiveMinScale||s||0}readObjectIdFieldFromService(s,r){return _e(r)}readServiceDefinitionExpression(s,r){return r.definitionQuery||r.definitionExpression}set url(s){const r=Xe({layer:this,url:s,nonStandardUrlAllowed:!0,logger:Ee.getLogger(this)});this._set("url",r.url),r.layerId!=null&&this._set("layerId",r.layerId)}writeUrl(s,r,n,a){Ye(this,s,null,r,a)}readVersion(s,r){return et(r)}};return e([t({readOnly:!0})],o.prototype,"authenticationTriggerEvent",null),e([t({type:String,json:{origins:{service:{read:{source:"copyrightText"}}}}})],o.prototype,"copyright",void 0),e([t({readOnly:!0,json:{read:!1,origins:{service:{read:{source:["advancedQueryCapabilities","allowGeometryUpdates","allowUpdateWithoutMValues","archivingInfo","capabilities","datesInUnknownTimezone","hasAttachments","hasM","hasZ","maxRecordCount","maxRecordCountFactor","ownershipBasedAccessControlForFeatures","standardMaxRecordCount","supportedQueryFormats","supportsAdvancedQueries","supportsApplyEditsWithGlobalIds","supportsAttachmentsByUploadId","supportsAttachmentsResizing","supportsCalculate","supportsCoordinatesQuantization","supportsExceedsLimitStatistics","supportsFieldDescriptionProperty","supportsQuantizationEditMode","supportsRollbackOnFailureParameter","supportsStatistics","supportsTruncate","supportsValidateSql","tileMaxRecordCount","useStandardizedQueries"]}}}}})],o.prototype,"capabilities",void 0),e([l("service","capabilities")],o.prototype,"readCapabilitiesFromService",null),e([t(H("dateFieldsTimeReference"))],o.prototype,"dateFieldsTimeZone",void 0),e([t({type:Boolean})],o.prototype,"datesInUnknownTimezone",void 0),e([t({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],o.prototype,"definitionExpression",void 0),e([t({type:String,json:{origins:{service:{read:{source:"displayField"}}}}})],o.prototype,"displayField",void 0),e([t({readOnly:!0,type:vt})],o.prototype,"editFieldsInfo",void 0),e([t({readOnly:!0})],o.prototype,"editingInfo",void 0),e([l("editingInfo")],o.prototype,"readEditingInfo",null),e([t({readOnly:!0})],o.prototype,"effectiveCapabilities",null),e([t((()=>{const s=V(Ce),r=s.json.origins;return r["web-map"]={read:!1,write:!1},r["portal-item"]={read:!1,write:!1},s})())],o.prototype,"elevationInfo",void 0),e([t({type:Ge,json:{name:"layerDefinition.floorInfo",write:!0,origins:{"web-scene":{name:"layerDefinition.floorInfo",write:{enabled:!0,layerContainerTypes:Qe}}}}})],o.prototype,"floorInfo",void 0),e([t({type:We,json:{origins:{service:{read:{source:"extent"}}}}})],o.prototype,"fullExtent",void 0),e([t()],o.prototype,"gdbVersion",void 0),e([t({readOnly:!0,type:ft,json:{read:{source:"geometryProperties"}}})],o.prototype,"geometryFieldsInfo",void 0),e([t({type:["point","polygon","polyline","multipoint","multipatch","mesh"],json:{origins:{service:{read:Pe.read}}}})],o.prototype,"geometryType",void 0),e([t({type:String})],o.prototype,"globalIdField",void 0),e([l("service","globalIdField",["globalIdField","fields"])],o.prototype,"readGlobalIdFieldFromService",null),e([t({readOnly:!0})],o.prototype,"hasFullEditingRestrictions",null),e([t({type:Boolean,json:{origins:{service:{read:!0}}}})],o.prototype,"hasM",void 0),e([t({readOnly:!0})],o.prototype,"hasUpdateItemRestrictions",null),e([t({type:Boolean,json:{origins:{service:{read:!0}}}})],o.prototype,"hasZ",void 0),e([t({readOnly:!0,type:Ze})],o.prototype,"heightModelInfo",void 0),e([t({type:Date})],o.prototype,"historicMoment",void 0),e([t({type:me.ofType(x),readOnly:!0})],o.prototype,"indexes",void 0),e([t({readOnly:!0})],o.prototype,"isTable",void 0),e([l("service","isTable",["type"])],o.prototype,"readIsTableFromService",null),e([t({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{read:!1,write:{target:"id"}}},read:!1}})],o.prototype,"layerId",void 0),e([t(qe)],o.prototype,"maxScale",void 0),e([l("service","maxScale",["maxScale","effectiveMaxScale"])],o.prototype,"readMaxScale",null),e([t(He)],o.prototype,"minScale",void 0),e([l("service","minScale",["minScale","effectiveMinScale"])],o.prototype,"readMinScale",null),e([t({type:String})],o.prototype,"objectIdField",void 0),e([l("service","objectIdField",["objectIdField","fields"])],o.prototype,"readObjectIdFieldFromService",null),e([t(H("preferredTimeReference"))],o.prototype,"preferredTimeZone",void 0),e([t({type:[wt],readOnly:!0})],o.prototype,"relationships",void 0),e([t({type:Boolean})],o.prototype,"returnM",void 0),e([t({type:Boolean})],o.prototype,"returnZ",void 0),e([t({readOnly:!0,json:{write:!1}})],o.prototype,"serverGens",void 0),e([t({readOnly:!0})],o.prototype,"serviceDefinitionExpression",void 0),e([l("service","serviceDefinitionExpression",["definitionQuery","definitionExpression"])],o.prototype,"readServiceDefinitionExpression",null),e([t({type:String,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],o.prototype,"serviceItemId",void 0),e([t()],o.prototype,"sourceJSON",void 0),e([t({type:he,json:{origins:{service:{read:{source:"extent.spatialReference"}}}}})],o.prototype,"spatialReference",void 0),e([t({type:String,readOnly:!0,json:{origins:{service:{read:!0}}}})],o.prototype,"subtypeField",void 0),e([t({type:[xt],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],o.prototype,"subtypes",void 0),e([t({type:String,json:{read:{source:"timeInfo.trackIdField"}}})],o.prototype,"trackIdField",void 0),e([t(Je)],o.prototype,"url",null),e([u("url")],o.prototype,"writeUrl",null),e([t({json:{origins:{service:{read:!0}},read:!1}})],o.prototype,"version",void 0),e([l("service","version",["currentVersion","capabilities","drawingInfo","hasAttachments","htmlPopupType","relationships","timeInfo","typeIdField","types"])],o.prototype,"readVersion",null),o=e([p("esri.layers.mixins.FeatureLayerBase")],o),o};export{Tt as D,$t as y}; diff --git a/dist/assets/FeatureLayerSource-AZE5JEq3.js b/dist/assets/FeatureLayerSource-AZE5JEq3.js deleted file mode 100644 index e76ffef..0000000 --- a/dist/assets/FeatureLayerSource-AZE5JEq3.js +++ /dev/null @@ -1,7 +0,0 @@ -import{bw as Q,ln as V,mi as G,bA as W,fd as H,e1 as Z,mj as j,mk as z,Z as $,E as F,S as X,dy as Y,dp as L,e as _,y as T,c as B,ij as K,ah as tt,dJ as C,jq as x,bW as y,e3 as M,ml as et,mm as at,mn as st,kt as rt,dT as nt,ev as it,dv as ot,h6 as U,de as ut,mo as lt,dD as dt,dQ as ct,bM as pt,ar as ht,mp as yt,ca as mt}from"./index-J0iiHjMT.js";import{v as ft}from"./External-GV0jSEES.js";import{isFeatureIdentifierArrayWithGlobalId as gt,isFeatureIdentifierArrayWithObjectId as bt}from"./editingSupport-EiPa9PKq.js";import{o as wt}from"./clientSideDefaults-F-CNnR0g.js";import{x as Rt}from"./QueryTask-91TvtrTt.js";import{s as St}from"./executeQueryJSON-ACj9qY0y.js";import{i as qt}from"./editsZScale-Wgw9kbYG.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./executeForIds-wXO8-pll.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./executeQueryPBF-vdaOUMid.js";import"./FeatureSet-d4S1oKME.js";function At(t){const{vertexSpace:e}=t;if(e.isRelative)return t.clone();const{anchor:a}=t,s=a.clone(),r=Q(It,[-s.x,-s.y,-s.z]),n=new V({origin:[s.x,s.y,s.z]}),i=t.cloneWithVertexSpace(n),{position:o}=i.vertexAttributes;return i.vertexAttributes.position=G(new Float64Array(o.length),o,r),i.vertexAttributesChanged(),i}const It=W();async function P(t,e,a){const{geometry:s}=e,r={...e.attributes};if(a!=null&&(s==null?void 0:s.type)==="mesh"){const{transformFieldRoles:n}=a,{origin:i,spatialReference:o,transform:u}=s,l=t.spatialReference;await H(o,l);const c=Z(i,l);if(r[n.originX]=c.x,r[n.originY]=c.y,r[n.originZ]=c.z??0,u!=null){const{translation:p,scale:h,rotation:m}=u,{vertexSpace:R}=s,d=R.isGeoreferenced?1:j(o)/j(l);r[n.translationX]=p[0]*d,r[n.translationY]=p[2]*d,r[n.translationZ]=-p[1]*d,r[n.scaleX]=h[0],r[n.scaleY]=h[2],r[n.scaleZ]=h[1],r[n.rotationX]=m[0],r[n.rotationY]=m[2],r[n.rotationZ]=-m[1],r[n.rotationDeg]=m[3]}return{attributes:r}}return s==null?{attributes:r}:s.type==="mesh"||s.type==="extent"?null:{geometry:s.toJSON(),attributes:r}}async function Ft(t,e){const a=await Promise.all((e.addAttachments??[]).map(n=>D(t,n))),s=await Promise.all((e.updateAttachments??[]).map(n=>D(t,n))),r=e.deleteAttachments??[];return a.length||s.length||r.length?{adds:a,updates:s,deletes:[...r]}:null}async function D(t,e){var c;const{feature:a,attachment:s}=e,{globalId:r,name:n,contentType:i,data:o,uploadId:u}=s,l={globalId:r};if(a&&("attributes"in a?l.parentGlobalId=(c=a.attributes)==null?void 0:c[t.globalIdField]:a.globalId&&(l.parentGlobalId=a.globalId)),u)l.uploadId=u;else if(o){const p=await z(o);p&&(l.contentType=p.mediaType,l.data=p.data),o instanceof File&&(l.name=o.name)}return n&&(l.name=n),i&&(l.contentType=i),l}function Ot(t,e,a){if(!e||e.length===0)return[];if(a&>(e))return e.map(r=>r.globalId);if(bt(e))return e.map(r=>r.objectId);const s=a?t.globalIdField:t.objectIdField;return s?e.map(r=>r.getAttribute(s)):[]}function Et(t){var r,n,i;const e=t==null?void 0:t.assetMaps;if(e){for(const o of e.addResults)o.success||$.getLogger("esri.layers.graphics.sources.support.sourceUtils").error(`Failed to map asset to feature with globalId ${o.globalId}.`);for(const o of e.updateResults)o.success||$.getLogger("esri.layers.graphics.sources.support.sourceUtils").error(`Failed to map asset to feature with globalId ${o.globalId}.`)}const a=t==null?void 0:t.attachments,s={addFeatureResults:((r=t==null?void 0:t.addResults)==null?void 0:r.map(w))??[],updateFeatureResults:((n=t==null?void 0:t.updateResults)==null?void 0:n.map(w))??[],deleteFeatureResults:((i=t==null?void 0:t.deleteResults)==null?void 0:i.map(w))??[],addAttachmentResults:a!=null&&a.addResults?a.addResults.map(w):[],updateAttachmentResults:a!=null&&a.updateResults?a.updateResults.map(w):[],deleteAttachmentResults:a!=null&&a.deleteResults?a.deleteResults.map(w):[]};return t!=null&&t.editMoment&&(s.editMoment=t.editMoment),s}function w(t){const e=t.success===!0?null:t.error||{code:void 0,description:void 0};return{objectId:t.objectId,globalId:t.globalId,error:e?new F("feature-layer-source:edit-failure",e.description,{code:e.code}):null}}function v(t,e){return new X({attributes:t.attributes,geometry:Y({...t.geometry,spatialReference:e})})}function _t(t,e){var a,s,r;return{adds:((a=t==null?void 0:t.adds)==null?void 0:a.map(n=>v(n,e)))||[],updates:((s=t==null?void 0:t.updates)==null?void 0:s.map(n=>({original:v(n[0],e),current:v(n[1],e)})))||[],deletes:((r=t==null?void 0:t.deletes)==null?void 0:r.map(n=>v(n,e)))||[],spatialReference:e}}function xt(t){const e=t.details.raw,a=+e.code,s=+e.extendedCode;return a===500&&(s===-2147217144||s===-2147467261)}const vt=new L({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),$t=new Set(["Feature Layer","Oriented Imagery Layer","Table"]),Tt=new L({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let A=class extends K{constructor(){super(...arguments),this.type="feature-layer",this.refresh=tt(async()=>{var a,s;await this.load();const t=(a=this.sourceJSON.editingInfo)==null?void 0:a.lastEditDate;if(t==null)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const e=t!==((s=this.sourceJSON.editingInfo)==null?void 0:s.lastEditDate);return{dataChanged:e,updates:e?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}}),this._ongoingAssetUploads=new Map}load(t){const e=this.layer.sourceJSON,a=this._fetchService(e,{...t}).then(()=>this.layer.setUserPrivileges(this.sourceJSON.serviceItemId,t)).then(()=>this._ensureLatestMetadata(t));return this.addResolvingPromise(a),Promise.resolve(this)}get queryTask(){var l;const{capabilities:t,parsedUrl:e,dynamicDataSource:a,infoFor3D:s,gdbVersion:r,spatialReference:n,fieldsIndex:i}=this.layer,o=C("featurelayer-pbf")&&(t==null?void 0:t.query.supportsFormatPBF)&&s==null,u=((l=t==null?void 0:t.operations)==null?void 0:l.supportsQueryAttachments)??!1;return new Rt({url:e.path,pbfSupported:o,fieldsIndex:i,infoFor3D:s,dynamicDataSource:a,gdbVersion:r,sourceSpatialReference:n,queryAttachmentsSupported:u})}async addAttachment(t,e){await this.load();const{layer:a}=this;await x(a,"editing");const s=t.attributes[a.objectIdField],r=a.parsedUrl.path+"/"+s+"/addAttachment",n=this._getLayerRequestOptions(),i=this._getFormDataForAttachment(e,n.query);try{const o=await y(r,{body:i});return w(o.data.addAttachmentResult)}catch(o){throw this._createAttachmentErrorResult(s,o)}}async updateAttachment(t,e,a){await this.load();const{layer:s}=this;await x(s,"editing");const r=t.attributes[s.objectIdField],n=s.parsedUrl.path+"/"+r+"/updateAttachment",i=this._getLayerRequestOptions({query:{attachmentId:e}}),o=this._getFormDataForAttachment(a,i.query);try{const u=await y(n,{body:o});return w(u.data.updateAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(r,u)}}async applyEdits(t,e){var g,q,E,N,J,k;await this.load();const{layer:a}=this;await x(a,"editing");const s=a.infoFor3D,r=s!=null,n=r||((e==null?void 0:e.globalIdUsed)??!1),i=r?await this._uploadMeshesAndGetAssetMapEditsJSON(t):null,o=((g=t.addFeatures)==null?void 0:g.map(b=>P(this.layer,b,s)))??[],u=(await Promise.all(o)).filter(M),l=((q=t.updateFeatures)==null?void 0:q.map(b=>P(this.layer,b,s)))??[],c=(await Promise.all(l)).filter(M),p=Ot(this.layer,t.deleteFeatures,n);qt(u,c,a.spatialReference);const h=await Ft(this.layer,t),m=a.capabilities.editing.supportsAsyncApplyEdits&&r,R=(e==null?void 0:e.gdbVersion)||a.gdbVersion,d={gdbVersion:R,rollbackOnFailure:e==null?void 0:e.rollbackOnFailureEnabled,useGlobalIds:n,returnEditMoment:e==null?void 0:e.returnEditMoment,usePreviousEditMoment:e==null?void 0:e.usePreviousEditMoment,async:m};await et(this.layer.url,R,!0);const O=at(this.layer.url,R||null);e!=null&&e.returnServiceEditsOption?(d.edits=JSON.stringify([{id:a.layerId,adds:u,updates:c,deletes:p,attachments:h,assetMaps:i}]),d.returnServiceEditsOption=vt.toJSON(e==null?void 0:e.returnServiceEditsOption),d.returnServiceEditsInSourceSR=e==null?void 0:e.returnServiceEditsInSourceSR):(d.adds=u.length?JSON.stringify(u):null,d.updates=c.length?JSON.stringify(c):null,d.deletes=p.length?n?JSON.stringify(p):p.join(","):null,d.attachments=h&&JSON.stringify(h),d.assetMaps=i!=null?JSON.stringify(i):void 0);const f=this._getLayerRequestOptions({method:"post",query:d});O&&(f.authMode="immediate",f.query.returnEditMoment=!0,f.query.sessionId=st);const S=e!=null&&e.returnServiceEditsOption?a.url:a.parsedUrl.path;let I;try{I=m?await this._asyncApplyEdits(S+"/applyEdits",f):await y(S+"/applyEdits",f)}catch(b){if(!xt(b))throw b;f.authMode="immediate",I=m?await this._asyncApplyEdits(S+"/applyEdits",f):await y(S+"/applyEdits",f)}if(!((E=a.capabilities.operations)!=null&&E.supportsEditing)&&((J=(N=a.effectiveCapabilities)==null?void 0:N.operations)!=null&&J.supportsEditing)){const b=(k=rt)==null?void 0:k.findCredential(a.url);await(b==null?void 0:b.refreshToken())}return this._createEditsResult(I)}async deleteAttachments(t,e){await this.load();const{layer:a}=this;await x(a,"editing");const s=t.attributes[a.objectIdField],r=a.parsedUrl.path+"/"+s+"/deleteAttachments";try{return(await y(r,this._getLayerRequestOptions({query:{attachmentIds:e.join(",")},method:"post"}))).data.deleteAttachmentResults.map(w)}catch(n){throw this._createAttachmentErrorResult(s,n)}}fetchRecomputedExtents(t={}){const e=t.signal;return this.load({signal:e}).then(async()=>{const a=this._getLayerRequestOptions({...t,query:{returnUpdates:!0}}),{layerId:s,url:r}=this.layer,{data:n}=await y(`${r}/${s}`,a),{id:i,extent:o,fullExtent:u,timeExtent:l}=n,c=o||u;return{id:i,fullExtent:c&&nt.fromJSON(c),timeExtent:l&&it.fromJSON({start:l[0],end:l[1]})}})}async queryAttachments(t,e={}){await this.load();const a=this._getLayerRequestOptions(e);return this.queryTask.executeAttachmentQuery(t,a)}async queryFeatures(t,e){var s;await this.load();const a=await this.queryTask.execute(t,{...e,query:this._createRequestQueryOptions(e)});return(s=t.outStatistics)!=null&&s.length&&a.features.length&&a.features.forEach(r=>{var i;const n=r.attributes;(i=t.outStatistics)==null||i.forEach(({outStatisticFieldName:o})=>{if(o){const u=o.toLowerCase();u&&u in n&&o!==u&&(n[o]=n[u],delete n[u])}})}),a}async queryFeaturesJSON(t,e){return await this.load(),this.queryTask.executeJSON(t,{...e,query:this._createRequestQueryOptions(e)})}async queryObjectIds(t,e){return await this.load(),this.queryTask.executeForIds(t,{...e,query:this._createRequestQueryOptions(e)})}async queryFeatureCount(t,e){return await this.load(),this.queryTask.executeForCount(t,{...e,query:this._createRequestQueryOptions(e)})}async queryExtent(t,e){return await this.load(),this.queryTask.executeForExtent(t,{...e,query:this._createRequestQueryOptions(e)})}async queryRelatedFeatures(t,e){return await this.load(),this.queryTask.executeRelationshipQuery(t,{...e,query:this._createRequestQueryOptions(e)})}async queryRelatedFeaturesCount(t,e){return await this.load(),this.queryTask.executeRelationshipQueryForCount(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopFeatures(t,e){return await this.load(),this.queryTask.executeTopFeaturesQuery(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopObjectIds(t,e){return await this.load(),this.queryTask.executeForTopIds(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopExtents(t,e){return await this.load(),this.queryTask.executeForTopExtents(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopCount(t,e){return await this.load(),this.queryTask.executeForTopCount(t,{...e,query:this._createRequestQueryOptions(e)})}async fetchPublishingStatus(){if(!ot(this.layer.url))return"unavailable";const t=U(this.layer.url,"status"),e=await y(t,{query:{f:"json"}});return Tt.fromJSON(e.data.status)}async uploadAssets(t,e){const{uploadAssets:a}=await ut(()=>import("./uploadAssets-aQgp-D__.js"),__vite__mapDeps([0,1,2,3]));return a(t,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},e)}async _asyncApplyEdits(t,e){const a=(await y(t,e)).data.statusUrl;for(;;){const s=(await y(a,{query:{f:"json"},responseType:"json"})).data;switch(s.status){case"Completed":return y(s.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new F("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new F("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await lt(Mt)}}_createRequestQueryOptions(t){const e={...this.layer.customParameters,token:this.layer.apiKey,...t==null?void 0:t.query};return this.layer.datesInUnknownTimezone&&(e.timeReferenceUnknownClient=!0),e}async _fetchService(t,e){if(!t){const s={};C("featurelayer-advanced-symbols")&&(s.returnAdvancedSymbols=!0),e!=null&&e.cacheBust&&(s._ts=Date.now());const{data:r}=await y(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:s,signal:e==null?void 0:e.signal}));t=r}this.sourceJSON=await this._patchServiceJSON(t,e==null?void 0:e.signal);const a=t.type;if(!$t.has(a))throw new F("feature-layer-source:unsupported-type",`Source type "${a}" is not supported`)}async _patchServiceJSON(t,e){var a;if(t.type!=="Table"&&t.geometryType&&!((a=t==null?void 0:t.drawingInfo)!=null&&a.renderer)&&!t.defaultSymbol){const s=wt(t.geometryType).renderer;dt("drawingInfo.renderer",s,t)}if(t.geometryType==="esriGeometryMultiPatch"&&t.infoFor3D&&(t.geometryType="mesh"),t.extent==null)try{const{data:s}=await y(this.layer.url,this._getLayerRequestOptions({signal:e}));s.spatialReference&&(t.extent={xmin:0,ymin:0,xmax:0,ymax:0,spatialReference:s.spatialReference})}catch(s){ct(s)}return t}async _ensureLatestMetadata(t){if(this.layer.userHasUpdateItemPrivileges&&this.sourceJSON.cacheMaxAge>0)return this._fetchService(null,{...t,cacheBust:!0})}async _uploadMeshesAndGetAssetMapEditsJSON(t){const{addAssetFeatures:e}=t;if(!(e!=null&&e.length))return null;const a=await this._filterRedundantAssetMaps(e);if(!(e!=null&&e.length))return null;const s=new Array,r=new Map;for(const n of a){const{geometry:i}=n,{vertexSpace:o}=i;if(o.isRelative)s.push(i);else{const u=At(i);r.set(u,i),n.geometry=u,s.push(u)}}await this.uploadAssets(s);for(const[n,i]of r)i.addExternalSources(n.metadata.externalSources.items);return{adds:this._getAssetMapEditsJSON(a),updates:[],deletes:[]}}_getAssetMapEditsJSON(t){const e=new Array,a=this.layer.globalIdField,s=this.layer.parsedUrl;for(const r of t){const n=r.geometry,{metadata:i}=n,o=i.getExternalSourcesOnService(s),u=r.getAttribute(a);if(o.length===0){$.getLogger(this).error(`Skipping feature ${u}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:l}=o.find(ft)??o[0],{vertexSpace:c}=n,p=c.isGeoreferenced?["PROJECT_VERTICES"]:[];for(const h of l)h.parts.length===1?e.push({globalId:pt(),parentGlobalId:u,assetName:h.assetName,assetHash:h.parts[0].partHash,flags:p}):$.getLogger(this).error(`Skipping asset ${h.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return e}_createEditsResult(t){const e=t.data,{layerId:a}=this.layer,s=[];let r=null;if(Array.isArray(e))for(const i of e)s.push({id:i.id,editedFeatures:i.editedFeatures}),i.id===a&&(r={addResults:i.addResults??[],updateResults:i.updateResults??[],deleteResults:i.deleteResults??[],attachments:i.attachments,editMoment:i.editMoment});else r=e;const n=Et(r);if(s.length>0){n.editedFeatureResults=[];for(const i of s){const{editedFeatures:o}=i,u=o!=null&&o.spatialReference?new ht(o.spatialReference):null;n.editedFeatureResults.push({layerId:i.id,editedFeatures:_t(o,u)})}}return n}_createAttachmentErrorResult(t,e){var r;const a=((r=e.details.messages)==null?void 0:r[0])||e.message,s=e.details.httpStatus||e.details.messageCode;return{objectId:t,globalId:null,error:new F("feature-layer-source:attachment-failure",a,{code:s})}}_getFormDataForAttachment(t,e){const a=t instanceof FormData?t:t&&t.elements?new FormData(t):null;if(a)for(const s in e){const r=e[s];r!=null&&(a.set?a.set(s,r):a.append(s,r))}return a}_getLayerRequestOptions(t={}){const{parsedUrl:e,gdbVersion:a,dynamicDataSource:s}=this.layer;return{...t,query:{gdbVersion:a,layer:s?JSON.stringify({source:s}):void 0,...e.query,f:"json",...this._createRequestQueryOptions(t)},responseType:"json"}}async _filterRedundantAssetMaps(t){const{layer:e}=this,{globalIdField:a,infoFor3D:s,parsedUrl:r}=e;if(s==null||a==null)return t;const n=yt(s);if(n==null)return t;const i=U(r.path,`../${n.id}`),o=new Array,u=new Array;for(const d of t)d.geometry.metadata.getExternalSourcesOnService(r).length>0?u.push(d):o.push(d);const l=u.map(d=>d.getAttribute(a)).filter(M);if(l.length===0)return t;const{assetMapFieldRoles:{parentGlobalId:c,assetHash:p}}=s,h=new mt;h.where=`${c} IN (${l.map(d=>`'${d}'`)})`,h.outFields=[p,c],h.returnGeometry=!1;const m=await St(i,h),{features:R}=m;return R.length===0?t:[...o,...u.filter(d=>{const O=d.getAttribute(a);if(!O)return!0;const{metadata:f}=d.geometry,S=R.filter(g=>g.getAttribute(c)===O);if(S.length===0)return!0;const I=S.map(g=>g.getAttribute(p));return f.getExternalSourcesOnService(r).flatMap(({source:g})=>g.flatMap(q=>q.parts.map(E=>E.partHash))).some(g=>I.every(q=>g!==q))})]}};_([T()],A.prototype,"type",void 0),_([T({constructOnly:!0})],A.prototype,"layer",void 0),_([T({readOnly:!0})],A.prototype,"queryTask",null),A=_([B("esri.layers.graphics.sources.FeatureLayerSource")],A);const Mt=1e3,zt=A;export{zt as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/uploadAssets-aQgp-D__.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/External-GV0jSEES.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/FeatureLayerSource-hKAUR546.js b/dist/assets/FeatureLayerSource-hKAUR546.js new file mode 100644 index 0000000..7aa36fb --- /dev/null +++ b/dist/assets/FeatureLayerSource-hKAUR546.js @@ -0,0 +1,7 @@ +import{bP as Q,lv as V,mq as G,bT as W,f8 as H,dW as Y,mr as C,ms as Z,R as $,r as F,K as z,fZ as B,dp as D,e as x,y as T,c as X,il as K,bs as tt,dE as L,jx as _,av as y,dY as M,mt as et,mu as at,mv as st,kB as rt,dO as nt,eo as it,dv as ot,h8 as P,de as ut,mw as lt,dy as dt,dL as ct,al as pt,d2 as ht,mx as yt,aL as mt,my as ft}from"./index-pCX-0tJH.js";import{v as gt}from"./External-Pb5poJ0S.js";import{isFeatureIdentifierArrayWithGlobalId as wt,isFeatureIdentifierArrayWithObjectId as bt}from"./editingSupport-HfkJiqt7.js";import{o as Rt}from"./clientSideDefaults-63pOkJ4Y.js";import{x as St}from"./QueryTask-Di0fqnMV.js";import{i as qt}from"./editsZScale-4-dTv58d.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./executeForIds-PXSIkRGk.js";import"./executeQueryPBF-P21isUTI.js";function At(t){const{vertexSpace:e}=t;if(e.isRelative)return t.clone();const{anchor:a}=t,s=a.clone(),r=Q(It,[-s.x,-s.y,-s.z]),n=new V({origin:[s.x,s.y,s.z]}),i=t.cloneWithVertexSpace(n),{position:o}=i.vertexAttributes;return i.vertexAttributes.position=G(new Float64Array(o.length),o,r),i.vertexAttributesChanged(),i}const It=W();async function U(t,e,a){const{geometry:s}=e,r={...e.attributes};if(a!=null&&(s==null?void 0:s.type)==="mesh"){const{transformFieldRoles:n}=a,{origin:i,spatialReference:o,transform:u}=s,l=t.spatialReference;await H(o,l);const c=Y(i,l);if(r[n.originX]=c.x,r[n.originY]=c.y,r[n.originZ]=c.z??0,u!=null){const{translation:p,scale:h,rotation:m}=u,{vertexSpace:R}=s,d=R.isGeoreferenced?1:C(o)/C(l);r[n.translationX]=p[0]*d,r[n.translationY]=p[2]*d,r[n.translationZ]=-p[1]*d,r[n.scaleX]=h[0],r[n.scaleY]=h[2],r[n.scaleZ]=h[1],r[n.rotationX]=m[0],r[n.rotationY]=m[2],r[n.rotationZ]=-m[1],r[n.rotationDeg]=m[3]}return{attributes:r}}return s==null?{attributes:r}:s.type==="mesh"||s.type==="extent"?null:{geometry:s.toJSON(),attributes:r}}async function Ft(t,e){const a=await Promise.all((e.addAttachments??[]).map(n=>j(t,n))),s=await Promise.all((e.updateAttachments??[]).map(n=>j(t,n))),r=e.deleteAttachments??[];return a.length||s.length||r.length?{adds:a,updates:s,deletes:[...r]}:null}async function j(t,e){var c;const{feature:a,attachment:s}=e,{globalId:r,name:n,contentType:i,data:o,uploadId:u}=s,l={globalId:r};if(a&&("attributes"in a?l.parentGlobalId=(c=a.attributes)==null?void 0:c[t.globalIdField]:a.globalId&&(l.parentGlobalId=a.globalId)),u)l.uploadId=u;else if(o){const p=await Z(o);p&&(l.contentType=p.mediaType,l.data=p.data),o instanceof File&&(l.name=o.name)}return n&&(l.name=n),i&&(l.contentType=i),l}function Ot(t,e,a){if(!e||e.length===0)return[];if(a&&wt(e))return e.map(r=>r.globalId);if(bt(e))return e.map(r=>r.objectId);const s=a?t.globalIdField:t.objectIdField;return s?e.map(r=>r.getAttribute(s)):[]}function Et(t){var r,n,i;const e=t==null?void 0:t.assetMaps;if(e){for(const o of e.addResults)o.success||$.getLogger("esri.layers.graphics.sources.support.sourceUtils").error(`Failed to map asset to feature with globalId ${o.globalId}.`);for(const o of e.updateResults)o.success||$.getLogger("esri.layers.graphics.sources.support.sourceUtils").error(`Failed to map asset to feature with globalId ${o.globalId}.`)}const a=t==null?void 0:t.attachments,s={addFeatureResults:((r=t==null?void 0:t.addResults)==null?void 0:r.map(b))??[],updateFeatureResults:((n=t==null?void 0:t.updateResults)==null?void 0:n.map(b))??[],deleteFeatureResults:((i=t==null?void 0:t.deleteResults)==null?void 0:i.map(b))??[],addAttachmentResults:a!=null&&a.addResults?a.addResults.map(b):[],updateAttachmentResults:a!=null&&a.updateResults?a.updateResults.map(b):[],deleteAttachmentResults:a!=null&&a.deleteResults?a.deleteResults.map(b):[]};return t!=null&&t.editMoment&&(s.editMoment=t.editMoment),s}function b(t){const e=t.success===!0?null:t.error||{code:void 0,description:void 0};return{objectId:t.objectId,globalId:t.globalId,error:e?new F("feature-layer-source:edit-failure",e.description,{code:e.code}):null}}function v(t,e){return new z({attributes:t.attributes,geometry:B({...t.geometry,spatialReference:e})})}function xt(t,e){var a,s,r;return{adds:((a=t==null?void 0:t.adds)==null?void 0:a.map(n=>v(n,e)))||[],updates:((s=t==null?void 0:t.updates)==null?void 0:s.map(n=>({original:v(n[0],e),current:v(n[1],e)})))||[],deletes:((r=t==null?void 0:t.deletes)==null?void 0:r.map(n=>v(n,e)))||[],spatialReference:e}}function _t(t){const e=t.details.raw,a=+e.code,s=+e.extendedCode;return a===500&&(s===-2147217144||s===-2147467261)}const vt=new D({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),$t=new Set(["Feature Layer","Oriented Imagery Layer","Table"]),Tt=new D({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let A=class extends K{constructor(){super(...arguments),this.type="feature-layer",this.refresh=tt(async()=>{var a,s;await this.load();const t=(a=this.sourceJSON.editingInfo)==null?void 0:a.lastEditDate;if(t==null)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const e=t!==((s=this.sourceJSON.editingInfo)==null?void 0:s.lastEditDate);return{dataChanged:e,updates:e?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}}),this._ongoingAssetUploads=new Map}load(t){const e=this.layer.sourceJSON,a=this._fetchService(e,{...t}).then(()=>this.layer.setUserPrivileges(this.sourceJSON.serviceItemId,t)).then(()=>this._ensureLatestMetadata(t));return this.addResolvingPromise(a),Promise.resolve(this)}get queryTask(){var l;const{capabilities:t,parsedUrl:e,dynamicDataSource:a,infoFor3D:s,gdbVersion:r,spatialReference:n,fieldsIndex:i}=this.layer,o=L("featurelayer-pbf")&&(t==null?void 0:t.query.supportsFormatPBF)&&s==null,u=((l=t==null?void 0:t.operations)==null?void 0:l.supportsQueryAttachments)??!1;return new St({url:e.path,pbfSupported:o,fieldsIndex:i,infoFor3D:s,dynamicDataSource:a,gdbVersion:r,sourceSpatialReference:n,queryAttachmentsSupported:u})}async addAttachment(t,e){await this.load();const{layer:a}=this;await _(a,"editing");const s=t.attributes[a.objectIdField],r=a.parsedUrl.path+"/"+s+"/addAttachment",n=this._getLayerRequestOptions(),i=this._getFormDataForAttachment(e,n.query);try{const o=await y(r,{body:i});return b(o.data.addAttachmentResult)}catch(o){throw this._createAttachmentErrorResult(s,o)}}async updateAttachment(t,e,a){await this.load();const{layer:s}=this;await _(s,"editing");const r=t.attributes[s.objectIdField],n=s.parsedUrl.path+"/"+r+"/updateAttachment",i=this._getLayerRequestOptions({query:{attachmentId:e}}),o=this._getFormDataForAttachment(a,i.query);try{const u=await y(n,{body:o});return b(u.data.updateAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(r,u)}}async applyEdits(t,e){var g,q,E,N,J,k;await this.load();const{layer:a}=this;await _(a,"editing");const s=a.infoFor3D,r=s!=null,n=r||((e==null?void 0:e.globalIdUsed)??!1),i=r?await this._uploadMeshesAndGetAssetMapEditsJSON(t):null,o=((g=t.addFeatures)==null?void 0:g.map(w=>U(this.layer,w,s)))??[],u=(await Promise.all(o)).filter(M),l=((q=t.updateFeatures)==null?void 0:q.map(w=>U(this.layer,w,s)))??[],c=(await Promise.all(l)).filter(M),p=Ot(this.layer,t.deleteFeatures,n);qt(u,c,a.spatialReference);const h=await Ft(this.layer,t),m=a.capabilities.editing.supportsAsyncApplyEdits&&r,R=(e==null?void 0:e.gdbVersion)||a.gdbVersion,d={gdbVersion:R,rollbackOnFailure:e==null?void 0:e.rollbackOnFailureEnabled,useGlobalIds:n,returnEditMoment:e==null?void 0:e.returnEditMoment,usePreviousEditMoment:e==null?void 0:e.usePreviousEditMoment,async:m};await et(this.layer.url,R,!0);const O=at(this.layer.url,R||null);e!=null&&e.returnServiceEditsOption?(d.edits=JSON.stringify([{id:a.layerId,adds:u,updates:c,deletes:p,attachments:h,assetMaps:i}]),d.returnServiceEditsOption=vt.toJSON(e==null?void 0:e.returnServiceEditsOption),d.returnServiceEditsInSourceSR=e==null?void 0:e.returnServiceEditsInSourceSR):(d.adds=u.length?JSON.stringify(u):null,d.updates=c.length?JSON.stringify(c):null,d.deletes=p.length?n?JSON.stringify(p):p.join(","):null,d.attachments=h&&JSON.stringify(h),d.assetMaps=i!=null?JSON.stringify(i):void 0);const f=this._getLayerRequestOptions({method:"post",query:d});O&&(f.authMode="immediate",f.query.returnEditMoment=!0,f.query.sessionId=st);const S=e!=null&&e.returnServiceEditsOption?a.url:a.parsedUrl.path;let I;try{I=m?await this._asyncApplyEdits(S+"/applyEdits",f):await y(S+"/applyEdits",f)}catch(w){if(!_t(w))throw w;f.authMode="immediate",I=m?await this._asyncApplyEdits(S+"/applyEdits",f):await y(S+"/applyEdits",f)}if(!((E=a.capabilities.operations)!=null&&E.supportsEditing)&&((J=(N=a.effectiveCapabilities)==null?void 0:N.operations)!=null&&J.supportsEditing)){const w=(k=rt)==null?void 0:k.findCredential(a.url);await(w==null?void 0:w.refreshToken())}return this._createEditsResult(I)}async deleteAttachments(t,e){await this.load();const{layer:a}=this;await _(a,"editing");const s=t.attributes[a.objectIdField],r=a.parsedUrl.path+"/"+s+"/deleteAttachments";try{return(await y(r,this._getLayerRequestOptions({query:{attachmentIds:e.join(",")},method:"post"}))).data.deleteAttachmentResults.map(b)}catch(n){throw this._createAttachmentErrorResult(s,n)}}fetchRecomputedExtents(t={}){const e=t.signal;return this.load({signal:e}).then(async()=>{const a=this._getLayerRequestOptions({...t,query:{returnUpdates:!0}}),{layerId:s,url:r}=this.layer,{data:n}=await y(`${r}/${s}`,a),{id:i,extent:o,fullExtent:u,timeExtent:l}=n,c=o||u;return{id:i,fullExtent:c&&nt.fromJSON(c),timeExtent:l&&it.fromJSON({start:l[0],end:l[1]})}})}async queryAttachments(t,e={}){await this.load();const a=this._getLayerRequestOptions(e);return this.queryTask.executeAttachmentQuery(t,a)}async queryFeatures(t,e){var s;await this.load();const a=await this.queryTask.execute(t,{...e,query:this._createRequestQueryOptions(e)});return(s=t.outStatistics)!=null&&s.length&&a.features.length&&a.features.forEach(r=>{var i;const n=r.attributes;(i=t.outStatistics)==null||i.forEach(({outStatisticFieldName:o})=>{if(o){const u=o.toLowerCase();u&&u in n&&o!==u&&(n[o]=n[u],delete n[u])}})}),a}async queryFeaturesJSON(t,e){return await this.load(),this.queryTask.executeJSON(t,{...e,query:this._createRequestQueryOptions(e)})}async queryObjectIds(t,e){return await this.load(),this.queryTask.executeForIds(t,{...e,query:this._createRequestQueryOptions(e)})}async queryFeatureCount(t,e){return await this.load(),this.queryTask.executeForCount(t,{...e,query:this._createRequestQueryOptions(e)})}async queryExtent(t,e){return await this.load(),this.queryTask.executeForExtent(t,{...e,query:this._createRequestQueryOptions(e)})}async queryRelatedFeatures(t,e){return await this.load(),this.queryTask.executeRelationshipQuery(t,{...e,query:this._createRequestQueryOptions(e)})}async queryRelatedFeaturesCount(t,e){return await this.load(),this.queryTask.executeRelationshipQueryForCount(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopFeatures(t,e){return await this.load(),this.queryTask.executeTopFeaturesQuery(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopObjectIds(t,e){return await this.load(),this.queryTask.executeForTopIds(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopExtents(t,e){return await this.load(),this.queryTask.executeForTopExtents(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopCount(t,e){return await this.load(),this.queryTask.executeForTopCount(t,{...e,query:this._createRequestQueryOptions(e)})}async fetchPublishingStatus(){if(!ot(this.layer.url))return"unavailable";const t=P(this.layer.url,"status"),e=await y(t,{query:{f:"json"}});return Tt.fromJSON(e.data.status)}async uploadAssets(t,e){const{uploadAssets:a}=await ut(()=>import("./uploadAssets-e680_sb_.js"),__vite__mapDeps([0,1,2,3]));return a(t,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},e)}async _asyncApplyEdits(t,e){const a=(await y(t,e)).data.statusUrl;for(;;){const s=(await y(a,{query:{f:"json"},responseType:"json"})).data;switch(s.status){case"Completed":return y(s.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new F("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new F("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await lt(Mt)}}_createRequestQueryOptions(t){const e={...this.layer.customParameters,token:this.layer.apiKey,...t==null?void 0:t.query};return this.layer.datesInUnknownTimezone&&(e.timeReferenceUnknownClient=!0),e}async _fetchService(t,e){if(!t){const s={};L("featurelayer-advanced-symbols")&&(s.returnAdvancedSymbols=!0),e!=null&&e.cacheBust&&(s._ts=Date.now());const{data:r}=await y(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:s,signal:e==null?void 0:e.signal}));t=r}this.sourceJSON=await this._patchServiceJSON(t,e==null?void 0:e.signal);const a=t.type;if(!$t.has(a))throw new F("feature-layer-source:unsupported-type",`Source type "${a}" is not supported`)}async _patchServiceJSON(t,e){var a;if(t.type!=="Table"&&t.geometryType&&!((a=t==null?void 0:t.drawingInfo)!=null&&a.renderer)&&!t.defaultSymbol){const s=Rt(t.geometryType).renderer;dt("drawingInfo.renderer",s,t)}if(t.geometryType==="esriGeometryMultiPatch"&&t.infoFor3D&&(t.geometryType="mesh"),t.extent==null)try{const{data:s}=await y(this.layer.url,this._getLayerRequestOptions({signal:e}));s.spatialReference&&(t.extent={xmin:0,ymin:0,xmax:0,ymax:0,spatialReference:s.spatialReference})}catch(s){ct(s)}return t}async _ensureLatestMetadata(t){if(this.layer.userHasUpdateItemPrivileges&&this.sourceJSON.cacheMaxAge>0)return this._fetchService(null,{...t,cacheBust:!0})}async _uploadMeshesAndGetAssetMapEditsJSON(t){const{addAssetFeatures:e}=t;if(!(e!=null&&e.length))return null;const a=await this._filterRedundantAssetMaps(e);if(!(e!=null&&e.length))return null;const s=new Array,r=new Map;for(const n of a){const{geometry:i}=n,{vertexSpace:o}=i;if(o.isRelative)s.push(i);else{const u=At(i);r.set(u,i),n.geometry=u,s.push(u)}}await this.uploadAssets(s);for(const[n,i]of r)i.addExternalSources(n.metadata.externalSources.items);return{adds:this._getAssetMapEditsJSON(a),updates:[],deletes:[]}}_getAssetMapEditsJSON(t){const e=new Array,a=this.layer.globalIdField,s=this.layer.parsedUrl;for(const r of t){const n=r.geometry,{metadata:i}=n,o=i.getExternalSourcesOnService(s),u=r.getAttribute(a);if(o.length===0){$.getLogger(this).error(`Skipping feature ${u}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:l}=o.find(gt)??o[0],{vertexSpace:c}=n,p=c.isGeoreferenced?["PROJECT_VERTICES"]:[];for(const h of l)h.parts.length===1?e.push({globalId:pt(),parentGlobalId:u,assetName:h.assetName,assetHash:h.parts[0].partHash,flags:p}):$.getLogger(this).error(`Skipping asset ${h.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return e}_createEditsResult(t){const e=t.data,{layerId:a}=this.layer,s=[];let r=null;if(Array.isArray(e))for(const i of e)s.push({id:i.id,editedFeatures:i.editedFeatures}),i.id===a&&(r={addResults:i.addResults??[],updateResults:i.updateResults??[],deleteResults:i.deleteResults??[],attachments:i.attachments,editMoment:i.editMoment});else r=e;const n=Et(r);if(s.length>0){n.editedFeatureResults=[];for(const i of s){const{editedFeatures:o}=i,u=o!=null&&o.spatialReference?new ht(o.spatialReference):null;n.editedFeatureResults.push({layerId:i.id,editedFeatures:xt(o,u)})}}return n}_createAttachmentErrorResult(t,e){var r;const a=((r=e.details.messages)==null?void 0:r[0])||e.message,s=e.details.httpStatus||e.details.messageCode;return{objectId:t,globalId:null,error:new F("feature-layer-source:attachment-failure",a,{code:s})}}_getFormDataForAttachment(t,e){const a=t instanceof FormData?t:t&&t.elements?new FormData(t):null;if(a)for(const s in e){const r=e[s];r!=null&&(a.set?a.set(s,r):a.append(s,r))}return a}_getLayerRequestOptions(t={}){const{parsedUrl:e,gdbVersion:a,dynamicDataSource:s}=this.layer;return{...t,query:{gdbVersion:a,layer:s?JSON.stringify({source:s}):void 0,...e.query,f:"json",...this._createRequestQueryOptions(t)},responseType:"json"}}async _filterRedundantAssetMaps(t){const{layer:e}=this,{globalIdField:a,infoFor3D:s,parsedUrl:r}=e;if(s==null||a==null)return t;const n=yt(s);if(n==null)return t;const i=P(r.path,`../${n.id}`),o=new Array,u=new Array;for(const d of t)d.geometry.metadata.getExternalSourcesOnService(r).length>0?u.push(d):o.push(d);const l=u.map(d=>d.getAttribute(a)).filter(M);if(l.length===0)return t;const{assetMapFieldRoles:{parentGlobalId:c,assetHash:p}}=s,h=new mt;h.where=`${c} IN (${l.map(d=>`'${d}'`)})`,h.outFields=[p,c],h.returnGeometry=!1;const m=await ft(i,h),{features:R}=m;return R.length===0?t:[...o,...u.filter(d=>{const O=d.getAttribute(a);if(!O)return!0;const{metadata:f}=d.geometry,S=R.filter(g=>g.getAttribute(c)===O);if(S.length===0)return!0;const I=S.map(g=>g.getAttribute(p));return f.getExternalSourcesOnService(r).flatMap(({source:g})=>g.flatMap(q=>q.parts.map(E=>E.partHash))).some(g=>I.every(q=>g!==q))})]}};x([T()],A.prototype,"type",void 0),x([T({constructOnly:!0})],A.prototype,"layer",void 0),x([T({readOnly:!0})],A.prototype,"queryTask",null),A=x([X("esri.layers.graphics.sources.FeatureLayerSource")],A);const Mt=1e3,Qt=A;export{Qt as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/uploadAssets-e680_sb_.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/External-Pb5poJ0S.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/FeatureLayerView3D-t6NDkLO0.js b/dist/assets/FeatureLayerView3D-t6NDkLO0.js deleted file mode 100644 index 82e27c5..0000000 --- a/dist/assets/FeatureLayerView3D-t6NDkLO0.js +++ /dev/null @@ -1 +0,0 @@ -import{e as i,y as a,c as s,fn as m,bK as l,E as o,ct as n}from"./index-J0iiHjMT.js";import{_ as y}from"./FeatureLayerViewBase3D-VurTj7t3.js";import"./HeatmapDensity.glsl-y7dUg--m.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./queryForSymbologySnapping-I1fFQTD_.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./QueryEngine-8tLWlkSE.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./FeatureSet-d4S1oKME.js";import"./FeatureStore-X-AIJLo2.js";import"./BoundsStore-wmwfHjhp.js";import"./projectExtentUtils-TwA6ooHn.js";import"./LayerView3D-iOx2MD1g.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./EventedSet-JGlFrfoR.js";import"./FeatureEffect-5bEV-xG1.js";import"./LayerView-efDufa6j.js";import"./RefreshableLayerView-Pd4dLcWr.js";let t=class extends y{constructor(){super(...arguments),this.type="feature-3d",this.direct3DObjectFeatureLayerDisplayEnabled=m()}initialize(){var p;const{layer:e,view:r}=this;(p=l(e))!=null&&p.operations.supportsQuery||this.addResolvingPromise(Promise.reject(new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e}))),e.infoFor3D!=null&&(this.direct3DObjectFeatureLayerDisplayEnabled?this._set("suspendResumeExtentMode","computed"):this.addResolvingPromise(Promise.reject(new o("featurelayerview3d:unsupported-geometry-type",`Unsupported geometry type ${e.geometryType}`)))),e.geometryType!=="mesh"||n(e.spatialReference,r.spatialReference)||this.addResolvingPromise(Promise.reject(new o("layerview:spatial-reference-incompatible","The spatial references of the feature layer is incompatible with the spatial reference of the view")))}get featureSpatialReference(){var e,r;return(r=(e=this.view.featureTiles)==null?void 0:e.tilingScheme)==null?void 0:r.spatialReference}};i([a({constructOnly:!0})],t.prototype,"direct3DObjectFeatureLayerDisplayEnabled",void 0),i([a()],t.prototype,"layer",void 0),t=i([s("esri.views.3d.layers.FeatureLayerView3D")],t);const A=t;export{A as default}; diff --git a/dist/assets/FeatureLayerView3D-vzwVkoh-.js b/dist/assets/FeatureLayerView3D-vzwVkoh-.js new file mode 100644 index 0000000..e9f6010 --- /dev/null +++ b/dist/assets/FeatureLayerView3D-vzwVkoh-.js @@ -0,0 +1 @@ +import{e as i,y as s,c as p,fi as m,aj as l,r as o,cj as n}from"./index-pCX-0tJH.js";import{_ as y}from"./FeatureLayerViewBase3D-W0Qwl4g_.js";import"./HeatmapDensity.glsl-de3m0xZZ.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./queryForSymbologySnapping-MXWRIdj-.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./QueryEngine-uvDs-vBe.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./FeatureStore-PXMUgn0j.js";import"./BoundsStore-_-dPK5c-.js";import"./projectExtentUtils-Q4rXasWA.js";import"./LayerView3D-57OghbRh.js";import"./EventedSet-TJfupI82.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./LayerView-ixwLVnzr.js";import"./RefreshableLayerView-DVYs7L04.js";let t=class extends y{constructor(){super(...arguments),this.type="feature-3d",this.direct3DObjectFeatureLayerDisplayEnabled=m()}initialize(){var a;const{layer:e,view:r}=this;(a=l(e))!=null&&a.operations.supportsQuery||this.addResolvingPromise(Promise.reject(new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e}))),e.infoFor3D!=null&&(this.direct3DObjectFeatureLayerDisplayEnabled?this._set("suspendResumeExtentMode","computed"):this.addResolvingPromise(Promise.reject(new o("featurelayerview3d:unsupported-geometry-type",`Unsupported geometry type ${e.geometryType}`)))),e.geometryType!=="mesh"||n(e.spatialReference,r.spatialReference)||this.addResolvingPromise(Promise.reject(new o("layerview:spatial-reference-incompatible","The spatial references of the feature layer is incompatible with the spatial reference of the view")))}get featureSpatialReference(){var e,r;return(r=(e=this.view.featureTiles)==null?void 0:e.tilingScheme)==null?void 0:r.spatialReference}};i([s({constructOnly:!0})],t.prototype,"direct3DObjectFeatureLayerDisplayEnabled",void 0),i([s()],t.prototype,"layer",void 0),t=i([p("esri.views.3d.layers.FeatureLayerView3D")],t);const Q=t;export{Q as default}; diff --git a/dist/assets/FeatureLayerViewBase3D-VurTj7t3.js b/dist/assets/FeatureLayerViewBase3D-VurTj7t3.js deleted file mode 100644 index a0c7b39..0000000 --- a/dist/assets/FeatureLayerViewBase3D-VurTj7t3.js +++ /dev/null @@ -1 +0,0 @@ -import{ar as S,ls as B,dw as U,S as k,nI as N,e as o,y as l,c as g,p as v,s as J,jP as z,nJ as L,n as M,Z as Y,dC as K,jW as W,d as P,A as C,fl as T,nK as D,fH as Q,ca as V,fS as j,d6 as X,nL as A,nM as ee,nN as Z,nO as te,nP as re,nH as q,nQ as O,E as b,fG as R,d1 as se,fI as ie,G as _,P as G,F as ae,nR as oe,fi as ne}from"./index-J0iiHjMT.js";import{I as le,E as ue,T as ce}from"./HeatmapDensity.glsl-y7dUg--m.js";import{n as de}from"./LayerView3D-iOx2MD1g.js";import{E as pe,c as he}from"./query-rG0aX6cE.js";import{r as ye}from"./EventedSet-JGlFrfoR.js";import{w as me}from"./FeatureEffect-5bEV-xG1.js";import{u as fe}from"./LayerView-efDufa6j.js";import{a as ge}from"./RefreshableLayerView-Pd4dLcWr.js";class Fe{constructor(r){this._controller=r,this._handle=new _e(e=>r.schedule(e))}destroy(){this._handle.destroy()}invoke(r,e){return r.buffer&&r.buffer.byteLength!==0?(r.options.sourceSpatialReference&&r.options.sourceSpatialReference instanceof S&&(r.options={...r.options,sourceSpatialReference:r.options.sourceSpatialReference.toJSON()}),this._handle.invoke(r,e).then(s=>{let i=0,a=0;const d=S.fromJSON(s.spatialReference);s.spatialReference=d;const n=async c=>{if(s.fields){for(;in(u))}for(;an(h))}return s};return this._controller.schedule(c=>n(c))})):Promise.resolve(null)}}function we(t){switch(t.type){case"polyline":t.paths.reduce((r,e)=>r+e.length,0)r.map(e=>[e[0],e[1],e[2]])):t.paths.map(r=>r.map(e=>[e[0],e[1]])));break;case"polygon":t.rings.reduce((r,e)=>r+e.length,0)r.map(e=>[e[0],e[1],e[2]])):t.rings.map(r=>r.map(e=>[e[0],e[1]])))}}let _e=class extends B{constructor(r){super("PBFDecoderWorker","_parseFeatureQuery",{_parseFeatureQuery:e=>[e.buffer]},r)}},f=class extends v{constructor(t){super(t)}get queryFeaturesDehydrated(){var i;const t=this.layer.capabilities,r=t&&t.query,e=r&&r.supportsFormatPBF,s=this.layer.parsedUrl;if(e){this._decoder==null&&(this._decoder=new Fe(this.controller));const a={sourceSpatialReference:((i=this.layer.spatialReference)==null?void 0:i.toJSON())??null,applyTransform:!0,maxStringAttributeLength:1024};return(d,n)=>pe(s,d,"pbf",this._createRequestOptions(n)).then(c=>(J(n),this._decoder!=null?this._decoder.invoke({buffer:c.data,options:a},n.signal):Promise.reject(z())))}return(a,d)=>he(s,a,this.layer.spatialReference,this._createRequestOptions(d)).then(n=>L(n.data))}queryFeatureCount(t,r){return this.layer.queryFeatureCount(t,r)}destroy(){this._decoder=M(this._decoder)}_createRequestOptions(t){return{...t,query:{...this.layer.customParameters,token:this.layer.apiKey,...t==null?void 0:t.query}}}};o([l({constructOnly:!0})],f.prototype,"layer",void 0),o([l({constructOnly:!0})],f.prototype,"controller",void 0),o([l({readOnly:!0})],f.prototype,"queryFeaturesDehydrated",null),f=o([g("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceQuery3D")],f);let F=class extends v{constructor(t){super(t)}queryFeaturesDehydrated(t,r){return this.layer.queryFeatures(t,r)}queryFeatureCount(t,r){return this.layer.queryFeatureCount(t,r)}};o([l({constructOnly:!0})],F.prototype,"layer",void 0),o([l({readOnly:!0})],F.prototype,"queryFeaturesDehydrated",null),F=o([g("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceMeshQuery3D")],F);let x=class extends v{constructor(t){super(t)}queryFeaturesDehydrated(t,r){return this.layer.queryFeatures(t,r)}};o([l({constructOnly:!0})],x.prototype,"layer",void 0),x=o([g("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceQuery3D")],x);let w=class extends v{constructor(t){super(t)}queryFeaturesDehydrated(t,r){return this.source.queryFeaturesJSON(t,r).then(L,e=>{if(e&&e.name==="query-features-json:unsupported")return this.layer.queryFeatures(t,r);throw e})}queryFeatureCount(t,r){return this.layer.queryFeatureCount(t,r)}};function be(t,r){return t.type==="feature"&&t.source.type==="feature-layer"?t.infoFor3D!=null?new F({layer:t}):new f({layer:t,controller:r}):t.type==="feature"&&t.source.type==="memory"||t.type==="csv"||t.type==="geojson"||t.type==="oriented-imagery"||t.type==="wfs"?new w({layer:t,source:t.source}):t.type==="ogc-feature"?new x({layer:t}):null}o([l({constructOnly:!0})],w.prototype,"layer",void 0),o([l({constructOnly:!0})],w.prototype,"source",void 0),w=o([g("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileClientQuery3D")],w);class xe{constructor(r){this._memoryCache=null,this._capabilities=null;const e=r.layerView.layer;this._layerView=r.layerView,this.objectIdField=e.objectIdField,this.globalIdField="globalIdField"in e?e.globalIdField:null,this._returnZ=r.returnZ,this._returnM=r.returnM;const s=this._layerView.view.resourceController;this.query=be(e,s.normal),s&&this._memoryCacheEnabled&&(this._memoryCache=s.memoryController.newCache(`fl-${e.uid}`))}get _memoryCacheEnabled(){switch(this._layerView.layer.source.type){case"feature-layer":case"ogc-feature":case"oriented-imagery":return!0;case"csv":case"geojson":case"memory":case"wfs":return!1}}destroy(){this._memoryCache=M(this._memoryCache),this.query.destroy()}createQuery(){const r=this._layerView.layer.createQuery();return r.outFields=this._layerView.availableFields,r.returnZ=this._returnZ,r.returnM=this._returnM,r.outSpatialReference=this.tilingScheme.spatialReference,r}get memoryCache(){return this._memoryCache}get viewingMode(){return this._layerView.view.state.viewingMode}get tilingScheme(){return this._layerView.view.featureTiles.tilingScheme}get scheduler(){const r=this._layerView.view.resourceController;return r?r.scheduler:null}get geometryType(){return this._layerView.layer.geometryType}get fullExtent(){return this._layerView.layer.fullExtent}get tileMaxRecordCount(){return this._layerView.layer.capabilities.query.tileMaxRecordCount}get maxRecordCount(){return this._layerView.layer.capabilities.query.maxRecordCount}get capabilities(){return this._capabilities!=null||(this._capabilities=le(this._layerView.layer)),this._capabilities}logFetchError(r,e){r.error("#fetchTile()",this._layerView.layer,(e==null?void 0:e.message)??e)}}const H="esri.views.layers.FeatureLayerView",E=Y.getLogger(H),ve=t=>{let r=class extends t{constructor(...e){super(...e),this._updatingRequiredFieldsPromise=null,this.dataUpdating=!1,this.filter=null,this.timeExtent=null,this.layer=null,this.requiredFields=[],this.view=null}initialize(){this.addHandles([P(()=>{var s;const e=this.layer;return[(s=e==null?void 0:e.elevationInfo)==null?void 0:s.featureExpressionInfo,e&&"displayField"in e?e.displayField:null,e&&"timeInfo"in e&&e.timeInfo,e&&"renderer"in e&&e.renderer,e&&"labelingInfo"in e&&e.labelingInfo,e&&"floorInfo"in e&&e.floorInfo,this.filter,this.featureEffect,this.timeExtent]},()=>this._handleRequiredFieldsChange(),C),T(()=>{var e;return(e=this.view)==null?void 0:e.floors},"change",()=>this._handleRequiredFieldsChange()),T(()=>{const e=this.layer;return e&&"sublayers"in e?e.sublayers:null},"change",()=>this._handleRequiredFieldsChange())])}get availableFields(){const{layer:e,layer:{fieldsIndex:s},requiredFields:i}=this;return"outFields"in e&&e.outFields?D(s,[...Q(s,e.outFields),...i]):D(s,i)}get featureEffect(){return this.layer&&"featureEffect"in this.layer?this.layer.featureEffect:null}set featureEffect(e){this._override("featureEffect",e)}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){E.error("#maximumNumberOfFeatures=","Setting maximum number of features is not supported")}get maximumNumberOfFeaturesExceeded(){return!1}highlight(e){throw new Error("missing implementation")}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference},s=this.filter!=null?this.filter.createQuery(e):new V(e);if(this.layer.type==="feature"){const i=j(this);i!=null&&(s.where=s.where?`(${s.where}) AND (${i})`:i)}return this.timeExtent!=null&&(s.timeExtent=s.timeExtent!=null?s.timeExtent.intersection(this.timeExtent):this.timeExtent.clone()),s}createAggregateQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return new V(e)}queryFeatures(e,s){throw new Error("missing implementation")}queryObjectIds(e,s){throw new Error("missing implementation")}queryFeatureCount(e,s){throw new Error("missing implementation")}queryExtent(e,s){throw new Error("missing implementation")}async fetchPopupFeatures(e,s){const i=this.validateFetchPopupFeatures(s);if(i)throw i;return this.fetchClientPopupFeatures(s)}_loadArcadeModules(e){var s;return(s=e.expressionInfos)!=null&&s.length||Array.isArray(e.content)&&e.content.some(i=>i.type==="expression")?X():Promise.resolve()}_handleRequiredFieldsChange(){const e=this._updateRequiredFields();this._set("_updatingRequiredFieldsPromise",e),e.then(()=>{this._updatingRequiredFieldsPromise===e&&this._set("_updatingRequiredFieldsPromise",null)})}async _updateRequiredFields(){if(!this.layer||!this.view)return;const e=this.view.type==="3d",{layer:s,layer:{fieldsIndex:i,objectIdField:a}}=this,d="renderer"in s&&s.renderer,n="orderBy"in s&&s.orderBy,c="featureReduction"in s?s.featureReduction:null,u=new Set,h=await Promise.allSettled([d?d.collectRequiredFields(u,i):null,A(u,s),e?ee(u,s):null,this.filter!=null?Z(u,s,this.filter):null,this.featureEffect!=null?Z(u,s,this.featureEffect.filter):null,c?te(u,s,c):null,n?re(u,s,n):null]);if("timeInfo"in s&&s.timeInfo&&this.timeExtent&&q(u,s.fieldsIndex,[s.timeInfo.startField,s.timeInfo.endField]),s.type==="feature"&&(s.floorInfo&&q(u,s.fieldsIndex,[s.floorInfo.floorField]),e&&s.infoFor3D!=null&&(s.globalIdField==null&&E.error("globalIdField missing on 3DObjectFeatureLayer"),q(u,s.fieldsIndex,[s.globalIdField]))),s.type==="subtype-group"){O(u,i,s.subtypeField);const y=s.sublayers.map(I=>{var $;return Promise.all([($=I.renderer)==null?void 0:$.collectRequiredFields(u,i),A(u,I)])});await Promise.allSettled(y)}for(const y of h)y.status==="rejected"&&E.error(y.reason);O(u,i,a),e&&"displayField"in s&&s.displayField&&O(u,i,s.displayField);const m=Array.from(u).sort();this._set("requiredFields",m)}validateFetchPopupFeatures(e){if(e==null)return null;for(const s of e.clientGraphics??[]){const i=s.layer;if("popupEnabled"in i&&!i.popupEnabled)return new b("featurelayerview:fetchPopupFeatures","Popups are disabled",{layer:i});if(s.isAggregate){const a="featureReduction"in i?i.featureReduction:null;if(!(a&&"popupTemplate"in a&&a.popupEnabled&&a.popupTemplate))return new b("featurelayerview:fetchPopupFeatures","Popups are disabled",{layer:i})}else if("popupTemplate"in i&&!R(i,e))return new b("featurelayerview:fetchPopupFeatures","Layer does not define a popup template",{layer:i})}}async fetchClientPopupFeatures(e){const s=e!=null?e.clientGraphics:null;if(!s||s.length===0)return[];const i=new Array(s.length),a=new Map,d=await this.createPopupQuery(e);for(let n=0;nn.layer):[this.layer];for(const n of d){if(!("popupEnabled"in n))continue;const c=R(n,e);if(c==null)continue;const u=await this._loadArcadeModules(c),h=u&&u.arcadeUtils.hasGeometryOperations(c);a=!(this.layer.geometryType!=="point"&&!h);const m=await ie(this.layer,c);for(const y of m)i.add(y)}if(s.returnGeometry=a,s.returnZ=a,s.returnM=a,s.outFields=Array.from(i),s.outSpatialReference=this.view.spatialReference,this.layer.type==="feature"){const n=j(this);n!=null&&(s.where=s.where?`(${s.where}) AND (${n})`:n)}return s}canResume(){return!!super.canResume()&&(this.timeExtent==null||!this.timeExtent.isEmpty)}};return o([l()],r.prototype,"_updatingRequiredFieldsPromise",void 0),o([l({readOnly:!0})],r.prototype,"availableFields",null),o([l({readOnly:!0})],r.prototype,"dataUpdating",void 0),o([l({type:me})],r.prototype,"featureEffect",null),o([l({type:K})],r.prototype,"filter",void 0),o([l(W)],r.prototype,"timeExtent",void 0),o([l()],r.prototype,"layer",void 0),o([l({type:Number})],r.prototype,"maximumNumberOfFeatures",null),o([l({readOnly:!0,type:Boolean})],r.prototype,"maximumNumberOfFeaturesExceeded",null),o([l({readOnly:!0})],r.prototype,"requiredFields",void 0),o([l()],r.prototype,"suspended",void 0),o([l()],r.prototype,"view",void 0),r=o([g(H)],r),r};let p=class extends ge(ue(ve(de(fe)))){constructor(t){super(t),this._controllerTotal=0,this._processorTotal=0,this.suspendResumeExtentMode="data"}initialize(){this.addHandles(P(()=>this._updatingRequiredFieldsPromise,t=>this._updatingHandles.addPromise(t),C))}destroy(){this._updatingHandles.removeAll(),this._fetcherContext=M(this._fetcherContext)}get maximumNumberOfFeatures(){var t;return((t=this.controller)==null?void 0:t.maximumNumberOfFeatures)??this._get("maximumNumberOfFeatures")}set maximumNumberOfFeatures(t){this._set("maximumNumberOfFeatures",t),this.controller&&(this.controller.maximumNumberOfFeatures=t)}get maximumNumberOfFeaturesExceeded(){return!!this.controller&&!(this.suspended||!this.controller.maximumNumberOfFeaturesExceeded)}get updatingProgressValue(){var e,s;let t=0;if((e=this.controller)!=null&&e.updating){const i=this.controller.updatingRemaining,a=Math.max(this.controller.updatingTotal,this._controllerTotal);a>0&&(t=(a-i)/a,this._controllerTotal=a)}let r=0;if((s=this.processor)!=null&&s.updating){const i=this.processor.updatingRemaining,a=Math.max(i,this._processorTotal);a>0&&(r=(a-i)/a,this._processorTotal=a)}return .5*(t+r)}get updatePolicy(){if(!this.controller)return _.ASYNC;switch(this.controller.mode){case"snapshot":{const t=qe.get(this.layer.geometryType);return t==null||this.controller.serviceDataCount>t?_.ASYNC:_.SYNC}case"tiles":return _.ASYNC}}get hasZ(){const t=this.layer,r=t.capabilities&&t.capabilities.data;return!(!r||!r.supportsZ)&&("returnZ"in t&&t.returnZ!=null?t.returnZ:r.supportsZ)}get hasM(){const t=this.layer,r=t.capabilities&&t.capabilities.data;return!(!r||!r.supportsM)&&"returnM"in t&&t.returnM!=null&&t.returnM}setVisibility(t,r){var e;(e=this.processor)==null||e.setObjectIdVisibility(t,r)}createQuery(){return super.createQuery()}queryFeatures(t,r){const e=()=>super.queryFeatures(t,r);return this.layer.geometryType==="mesh"?this._queryFeaturesMesh(this._ensureQuery(t),e):e()}beforeSetController(t){t.maximumNumberOfFeatures=this.maximumNumberOfFeatures}createController(){this._fetcherContext=new xe({layerView:this,returnZ:this.hasZ,returnM:this.hasM});const t=new ce({layerView:this,context:this._fetcherContext,graphics:new ye,extent:this.clippingExtent});return this._updatingHandles.add(()=>t.serviceDataExtent,r=>{this.processor&&(this.processor.dataExtent=r)},G),this.addHandles(P(()=>this.suspended,r=>{r?t.suspend():t.resume()},C)),this._updatingHandles.add(()=>{var r;return(r=this.processor)==null?void 0:r.displayFeatureLimit},r=>t.displayFeatureLimit=r,G),this.addHandles(ae(()=>!this.updating,()=>{this._controllerTotal=0,this._processorTotal=0})),t}async doRefresh(t){t&&!this.suspended&&this.controller&&this.controller.refetch(),this.processor.refreshFilter()}get usedMemory(){var t,r;return(((t=this.processor)==null?void 0:t.usedMemory)??0)+(((r=this.controller)==null?void 0:r.memoryForUnusedFeatures)??0)}get unloadedMemory(){var i,a,d,n;const t=((i=this.processor)==null?void 0:i.unprocessedMemoryEstimate)??0,r=((a=this.controller)==null?void 0:a.expectedFeatureDiff)??0,e=((d=this.processor)==null?void 0:d.loadedFeatures)??0,s=e+r>0?e/(e+r):1;return t+r*(((n=this.processor)==null?void 0:n.usedMemoryPerFeature)??0)*s}get ignoresMemoryFactor(){var t;return(t=this.controller)==null?void 0:t.hasMaximumNumberOfFeaturesOverride}async _queryFeaturesMesh(t,r){await this._validateQueryFeaturesMesh(t);const e=await r();if(t!=null&&t.outStatistics||this.graphics3DProcessor==null)return e;const s=this.layer.objectIdField,i=this.graphics3DProcessor.graphics3DGraphicsByObjectID,a=[];for(const d of e.features)if(d.geometry){const n=i.get(d.attributes[s]);n&&(d.geometry=oe(n.graphic.geometry),a.push(d))}else a.push(d);return e.features=a,e}async _validateQueryFeaturesMesh(t){if(!t)return;const r=s=>{throw new b("feature-layer-view:unsupported-query",`Queries on Mesh feature collection layers do not support '${s}'`)},e=["quantizationParameters","geometryPrecision","maxAllowableOffset"];for(const s of e)t[s]!=null&&r(s);"returnM"in t&&t.returnM&&r("returnM"),"returnCentroid"in t&&t.returnCentroid&&r("returnCentroid"),t.outSpatialReference==null||t.outSpatialReference.equals(this.view.spatialReference)||r("outSpatialReference")}get performanceInfo(){var s,i,a,d;const t=(s=this.controller)==null?void 0:s.displayFeatureLimit,r=t!=null?t.averageSymbolComplexity:void 0,e=r!=null?`f:${r.verticesPerFeature},v:${r.verticesPerCoordinate}`:"n/a";return{...this._getResourceInfo(),partial:this.maximumNumberOfFeaturesExceeded,mode:((i=this.controller)==null?void 0:i.mode)??"n/a",symbolComplexity:e,nodes:((a=this.controller)==null?void 0:a.tileDescriptors.length)??0,...((d=this.controller)==null?void 0:d.performanceInfo)??{storedFeatures:0,totalVertices:0}}}get test(){var t;return{updatePolicy:this.updatePolicy,controller:this.controller,loadedGraphics:(t=this.controller)==null?void 0:t.graphics}}};o([l()],p.prototype,"layer",void 0),o([l()],p.prototype,"controller",void 0),o([l()],p.prototype,"_controllerTotal",void 0),o([l()],p.prototype,"_processorTotal",void 0),o([l()],p.prototype,"maximumNumberOfFeatures",null),o([l()],p.prototype,"maximumNumberOfFeaturesExceeded",null),o([l(ne)],p.prototype,"updatingProgress",void 0),o([l({readOnly:!0})],p.prototype,"updatingProgressValue",null),o([l({readOnly:!0})],p.prototype,"updatePolicy",null),o([l({readOnly:!0})],p.prototype,"hasZ",null),o([l({readOnly:!0})],p.prototype,"hasM",null),o([l()],p.prototype,"suspendResumeExtentMode",void 0),p=o([g("esri.views.3d.layers.FeatureLayerViewBase3D")],p);const qe=new Map([["point",5e3],["polygon",500],["polyline",1e3]]),Ne=p;export{Ne as _}; diff --git a/dist/assets/FeatureLayerViewBase3D-W0Qwl4g_.js b/dist/assets/FeatureLayerViewBase3D-W0Qwl4g_.js new file mode 100644 index 0000000..bdf5e1c --- /dev/null +++ b/dist/assets/FeatureLayerViewBase3D-W0Qwl4g_.js @@ -0,0 +1 @@ +import{d2 as S,lA as U,es as k,K as H,nS as N,e as o,y as l,c as g,g as v,nT as J,ab as Y,jW as z,nU as W,nV as B,b as M,R as K,dx as X,k1 as ee,B as C,T as P,fg as T,nW as D,fC as V,aL as Q,fN as A,cZ as te,nX as j,nY as re,nZ as Z,n_ as se,n$ as ie,nR as q,o0 as R,r as b,fB as O,cU as ae,fD as oe,C as _,P as L,v as ne,o1 as le,fd as ue}from"./index-pCX-0tJH.js";import{I as ce,E as de,T as pe}from"./HeatmapDensity.glsl-de3m0xZZ.js";import{n as he}from"./LayerView3D-57OghbRh.js";import{r as ye}from"./EventedSet-TJfupI82.js";import{w as me}from"./FeatureEffect-0Jn9Z0sQ.js";import{u as fe}from"./LayerView-ixwLVnzr.js";import{a as ge}from"./RefreshableLayerView-DVYs7L04.js";class Fe{constructor(r){this._controller=r,this._handle=new _e(e=>r.schedule(e))}destroy(){this._handle.destroy()}invoke(r,e){return r.buffer&&r.buffer.byteLength!==0?(r.options.sourceSpatialReference&&r.options.sourceSpatialReference instanceof S&&(r.options={...r.options,sourceSpatialReference:r.options.sourceSpatialReference.toJSON()}),this._handle.invoke(r,e).then(s=>{let i=0,a=0;const d=S.fromJSON(s.spatialReference);s.spatialReference=d;const n=async c=>{if(s.fields){for(;in(u))}for(;an(h))}return s};return this._controller.schedule(c=>n(c))})):Promise.resolve(null)}}function we(t){switch(t.type){case"polyline":t.paths.reduce((r,e)=>r+e.length,0)r.map(e=>[e[0],e[1],e[2]])):t.paths.map(r=>r.map(e=>[e[0],e[1]])));break;case"polygon":t.rings.reduce((r,e)=>r+e.length,0)r.map(e=>[e[0],e[1],e[2]])):t.rings.map(r=>r.map(e=>[e[0],e[1]])))}}let _e=class extends U{constructor(r){super("PBFDecoderWorker","_parseFeatureQuery",{_parseFeatureQuery:e=>[e.buffer]},r)}},f=class extends v{constructor(t){super(t)}get queryFeaturesDehydrated(){var i;const t=this.layer.capabilities,r=t&&t.query,e=r&&r.supportsFormatPBF,s=this.layer.parsedUrl;if(e){this._decoder==null&&(this._decoder=new Fe(this.controller));const a={sourceSpatialReference:((i=this.layer.spatialReference)==null?void 0:i.toJSON())??null,applyTransform:!0,maxStringAttributeLength:1024};return(d,n)=>J(s,d,"pbf",this._createRequestOptions(n)).then(c=>(Y(n),this._decoder!=null?this._decoder.invoke({buffer:c.data,options:a},n.signal):Promise.reject(z())))}return(a,d)=>W(s,a,this.layer.spatialReference,this._createRequestOptions(d)).then(n=>B(n.data))}queryFeatureCount(t,r){return this.layer.queryFeatureCount(t,r)}destroy(){this._decoder=M(this._decoder)}_createRequestOptions(t){return{...t,query:{...this.layer.customParameters,token:this.layer.apiKey,...t==null?void 0:t.query}}}};o([l({constructOnly:!0})],f.prototype,"layer",void 0),o([l({constructOnly:!0})],f.prototype,"controller",void 0),o([l({readOnly:!0})],f.prototype,"queryFeaturesDehydrated",null),f=o([g("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceQuery3D")],f);let F=class extends v{constructor(t){super(t)}queryFeaturesDehydrated(t,r){return this.layer.queryFeatures(t,r)}queryFeatureCount(t,r){return this.layer.queryFeatureCount(t,r)}};o([l({constructOnly:!0})],F.prototype,"layer",void 0),o([l({readOnly:!0})],F.prototype,"queryFeaturesDehydrated",null),F=o([g("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceMeshQuery3D")],F);let x=class extends v{constructor(t){super(t)}queryFeaturesDehydrated(t,r){return this.layer.queryFeatures(t,r)}};o([l({constructOnly:!0})],x.prototype,"layer",void 0),x=o([g("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileServiceQuery3D")],x);let w=class extends v{constructor(t){super(t)}queryFeaturesDehydrated(t,r){return this.source.queryFeaturesJSON(t,r).then(B,e=>{if(e&&e.name==="query-features-json:unsupported")return this.layer.queryFeatures(t,r);throw e})}queryFeatureCount(t,r){return this.layer.queryFeatureCount(t,r)}};function be(t,r){return t.type==="feature"&&t.source.type==="feature-layer"?t.infoFor3D!=null?new F({layer:t}):new f({layer:t,controller:r}):t.type==="feature"&&t.source.type==="memory"||t.type==="csv"||t.type==="geojson"||t.type==="oriented-imagery"||t.type==="wfs"?new w({layer:t,source:t.source}):t.type==="ogc-feature"?new x({layer:t}):null}o([l({constructOnly:!0})],w.prototype,"layer",void 0),o([l({constructOnly:!0})],w.prototype,"source",void 0),w=o([g("esri.views.3d.layers.support.featureTileQuery3D.FeatureTileClientQuery3D")],w);class xe{constructor(r){this._memoryCache=null,this._capabilities=null;const e=r.layerView.layer;this._layerView=r.layerView,this.objectIdField=e.objectIdField,this.globalIdField="globalIdField"in e?e.globalIdField:null,this._returnZ=r.returnZ,this._returnM=r.returnM;const s=this._layerView.view.resourceController;this.query=be(e,s.normal),s&&this._memoryCacheEnabled&&(this._memoryCache=s.memoryController.newCache(`fl-${e.uid}`))}get _memoryCacheEnabled(){switch(this._layerView.layer.source.type){case"feature-layer":case"ogc-feature":case"oriented-imagery":return!0;case"csv":case"geojson":case"memory":case"wfs":return!1}}destroy(){this._memoryCache=M(this._memoryCache),this.query.destroy()}createQuery(){const r=this._layerView.layer.createQuery();return r.outFields=this._layerView.availableFields,r.returnZ=this._returnZ,r.returnM=this._returnM,r.outSpatialReference=this.tilingScheme.spatialReference,r}get memoryCache(){return this._memoryCache}get viewingMode(){return this._layerView.view.state.viewingMode}get tilingScheme(){return this._layerView.view.featureTiles.tilingScheme}get scheduler(){const r=this._layerView.view.resourceController;return r?r.scheduler:null}get geometryType(){return this._layerView.layer.geometryType}get fullExtent(){return this._layerView.layer.fullExtent}get tileMaxRecordCount(){return this._layerView.layer.capabilities.query.tileMaxRecordCount}get maxRecordCount(){return this._layerView.layer.capabilities.query.maxRecordCount}get capabilities(){return this._capabilities!=null||(this._capabilities=ce(this._layerView.layer)),this._capabilities}logFetchError(r,e){r.error("#fetchTile()",this._layerView.layer,(e==null?void 0:e.message)??e)}}const G="esri.views.layers.FeatureLayerView",E=K.getLogger(G),ve=t=>{let r=class extends t{constructor(...e){super(...e),this._updatingRequiredFieldsPromise=null,this.dataUpdating=!1,this.filter=null,this.timeExtent=null,this.layer=null,this.requiredFields=[],this.view=null}initialize(){this.addHandles([C(()=>{var s;const e=this.layer;return[(s=e==null?void 0:e.elevationInfo)==null?void 0:s.featureExpressionInfo,e&&"displayField"in e?e.displayField:null,e&&"timeInfo"in e&&e.timeInfo,e&&"renderer"in e&&e.renderer,e&&"labelingInfo"in e&&e.labelingInfo,e&&"floorInfo"in e&&e.floorInfo,this.filter,this.featureEffect,this.timeExtent]},()=>this._handleRequiredFieldsChange(),P),T(()=>{var e;return(e=this.view)==null?void 0:e.floors},"change",()=>this._handleRequiredFieldsChange()),T(()=>{const e=this.layer;return e&&"sublayers"in e?e.sublayers:null},"change",()=>this._handleRequiredFieldsChange())])}get availableFields(){const{layer:e,layer:{fieldsIndex:s},requiredFields:i}=this;return"outFields"in e&&e.outFields?D(s,[...V(s,e.outFields),...i]):D(s,i)}get featureEffect(){return this.layer&&"featureEffect"in this.layer?this.layer.featureEffect:null}set featureEffect(e){this._override("featureEffect",e)}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){E.error("#maximumNumberOfFeatures=","Setting maximum number of features is not supported")}get maximumNumberOfFeaturesExceeded(){return!1}highlight(e){throw new Error("missing implementation")}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference},s=this.filter!=null?this.filter.createQuery(e):new Q(e);if(this.layer.type==="feature"){const i=A(this);i!=null&&(s.where=s.where?`(${s.where}) AND (${i})`:i)}return this.timeExtent!=null&&(s.timeExtent=s.timeExtent!=null?s.timeExtent.intersection(this.timeExtent):this.timeExtent.clone()),s}createAggregateQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return new Q(e)}queryFeatures(e,s){throw new Error("missing implementation")}queryObjectIds(e,s){throw new Error("missing implementation")}queryFeatureCount(e,s){throw new Error("missing implementation")}queryExtent(e,s){throw new Error("missing implementation")}async fetchPopupFeatures(e,s){const i=this.validateFetchPopupFeatures(s);if(i)throw i;return this.fetchClientPopupFeatures(s)}_loadArcadeModules(e){var s;return(s=e.expressionInfos)!=null&&s.length||Array.isArray(e.content)&&e.content.some(i=>i.type==="expression")?te():Promise.resolve()}_handleRequiredFieldsChange(){const e=this._updateRequiredFields();this._set("_updatingRequiredFieldsPromise",e),e.then(()=>{this._updatingRequiredFieldsPromise===e&&this._set("_updatingRequiredFieldsPromise",null)})}async _updateRequiredFields(){if(!this.layer||!this.view)return;const e=this.view.type==="3d",{layer:s,layer:{fieldsIndex:i,objectIdField:a}}=this,d="renderer"in s&&s.renderer,n="orderBy"in s&&s.orderBy,c="featureReduction"in s?s.featureReduction:null,u=new Set,h=await Promise.allSettled([d?d.collectRequiredFields(u,i):null,j(u,s),e?re(u,s):null,this.filter!=null?Z(u,s,this.filter):null,this.featureEffect!=null?Z(u,s,this.featureEffect.filter):null,c?se(u,s,c):null,n?ie(u,s,n):null]);if("timeInfo"in s&&s.timeInfo&&this.timeExtent&&q(u,s.fieldsIndex,[s.timeInfo.startField,s.timeInfo.endField]),s.type==="feature"&&(s.floorInfo&&q(u,s.fieldsIndex,[s.floorInfo.floorField]),e&&s.infoFor3D!=null&&(s.globalIdField==null&&E.error("globalIdField missing on 3DObjectFeatureLayer"),q(u,s.fieldsIndex,[s.globalIdField]))),s.type==="subtype-group"){R(u,i,s.subtypeField);const y=s.sublayers.map(I=>{var $;return Promise.all([($=I.renderer)==null?void 0:$.collectRequiredFields(u,i),j(u,I)])});await Promise.allSettled(y)}for(const y of h)y.status==="rejected"&&E.error(y.reason);R(u,i,a),e&&"displayField"in s&&s.displayField&&R(u,i,s.displayField);const m=Array.from(u).sort();this._set("requiredFields",m)}validateFetchPopupFeatures(e){if(e==null)return null;for(const s of e.clientGraphics??[]){const i=s.layer;if("popupEnabled"in i&&!i.popupEnabled)return new b("featurelayerview:fetchPopupFeatures","Popups are disabled",{layer:i});if(s.isAggregate){const a="featureReduction"in i?i.featureReduction:null;if(!(a&&"popupTemplate"in a&&a.popupEnabled&&a.popupTemplate))return new b("featurelayerview:fetchPopupFeatures","Popups are disabled",{layer:i})}else if("popupTemplate"in i&&!O(i,e))return new b("featurelayerview:fetchPopupFeatures","Layer does not define a popup template",{layer:i})}}async fetchClientPopupFeatures(e){const s=e!=null?e.clientGraphics:null;if(!s||s.length===0)return[];const i=new Array(s.length),a=new Map,d=await this.createPopupQuery(e);for(let n=0;nn.layer):[this.layer];for(const n of d){if(!("popupEnabled"in n))continue;const c=O(n,e);if(c==null)continue;const u=await this._loadArcadeModules(c),h=u&&u.arcadeUtils.hasGeometryOperations(c);a=!(this.layer.geometryType!=="point"&&!h);const m=await oe(this.layer,c);for(const y of m)i.add(y)}if(s.returnGeometry=a,s.returnZ=a,s.returnM=a,s.outFields=Array.from(i),s.outSpatialReference=this.view.spatialReference,this.layer.type==="feature"){const n=A(this);n!=null&&(s.where=s.where?`(${s.where}) AND (${n})`:n)}return s}canResume(){return!!super.canResume()&&(this.timeExtent==null||!this.timeExtent.isEmpty)}};return o([l()],r.prototype,"_updatingRequiredFieldsPromise",void 0),o([l({readOnly:!0})],r.prototype,"availableFields",null),o([l({readOnly:!0})],r.prototype,"dataUpdating",void 0),o([l({type:me})],r.prototype,"featureEffect",null),o([l({type:X})],r.prototype,"filter",void 0),o([l(ee)],r.prototype,"timeExtent",void 0),o([l()],r.prototype,"layer",void 0),o([l({type:Number})],r.prototype,"maximumNumberOfFeatures",null),o([l({readOnly:!0,type:Boolean})],r.prototype,"maximumNumberOfFeaturesExceeded",null),o([l({readOnly:!0})],r.prototype,"requiredFields",void 0),o([l()],r.prototype,"suspended",void 0),o([l()],r.prototype,"view",void 0),r=o([g(G)],r),r};let p=class extends ge(de(ve(he(fe)))){constructor(t){super(t),this._controllerTotal=0,this._processorTotal=0,this.suspendResumeExtentMode="data"}initialize(){this.addHandles(C(()=>this._updatingRequiredFieldsPromise,t=>this._updatingHandles.addPromise(t),P))}destroy(){this._updatingHandles.removeAll(),this._fetcherContext=M(this._fetcherContext)}get maximumNumberOfFeatures(){var t;return((t=this.controller)==null?void 0:t.maximumNumberOfFeatures)??this._get("maximumNumberOfFeatures")}set maximumNumberOfFeatures(t){this._set("maximumNumberOfFeatures",t),this.controller&&(this.controller.maximumNumberOfFeatures=t)}get maximumNumberOfFeaturesExceeded(){return!!this.controller&&!(this.suspended||!this.controller.maximumNumberOfFeaturesExceeded)}get updatingProgressValue(){var e,s;let t=0;if((e=this.controller)!=null&&e.updating){const i=this.controller.updatingRemaining,a=Math.max(this.controller.updatingTotal,this._controllerTotal);a>0&&(t=(a-i)/a,this._controllerTotal=a)}let r=0;if((s=this.processor)!=null&&s.updating){const i=this.processor.updatingRemaining,a=Math.max(i,this._processorTotal);a>0&&(r=(a-i)/a,this._processorTotal=a)}return .5*(t+r)}get updatePolicy(){if(!this.controller)return _.ASYNC;switch(this.controller.mode){case"snapshot":{const t=qe.get(this.layer.geometryType);return t==null||this.controller.serviceDataCount>t?_.ASYNC:_.SYNC}case"tiles":return _.ASYNC}}get hasZ(){const t=this.layer,r=t.capabilities&&t.capabilities.data;return!(!r||!r.supportsZ)&&("returnZ"in t&&t.returnZ!=null?t.returnZ:r.supportsZ)}get hasM(){const t=this.layer,r=t.capabilities&&t.capabilities.data;return!(!r||!r.supportsM)&&"returnM"in t&&t.returnM!=null&&t.returnM}setVisibility(t,r){var e;(e=this.processor)==null||e.setObjectIdVisibility(t,r)}createQuery(){return super.createQuery()}queryFeatures(t,r){const e=()=>super.queryFeatures(t,r);return this.layer.geometryType==="mesh"?this._queryFeaturesMesh(this._ensureQuery(t),e):e()}beforeSetController(t){t.maximumNumberOfFeatures=this.maximumNumberOfFeatures}createController(){this._fetcherContext=new xe({layerView:this,returnZ:this.hasZ,returnM:this.hasM});const t=new pe({layerView:this,context:this._fetcherContext,graphics:new ye,extent:this.clippingExtent});return this._updatingHandles.add(()=>t.serviceDataExtent,r=>{this.processor&&(this.processor.dataExtent=r)},L),this.addHandles(C(()=>this.suspended,r=>{r?t.suspend():t.resume()},P)),this._updatingHandles.add(()=>{var r;return(r=this.processor)==null?void 0:r.displayFeatureLimit},r=>t.displayFeatureLimit=r,L),this.addHandles(ne(()=>!this.updating,()=>{this._controllerTotal=0,this._processorTotal=0})),t}async doRefresh(t){t&&!this.suspended&&this.controller&&this.controller.refetch(),this.processor.refreshFilter()}get usedMemory(){var t,r;return(((t=this.processor)==null?void 0:t.usedMemory)??0)+(((r=this.controller)==null?void 0:r.memoryForUnusedFeatures)??0)}get unloadedMemory(){var i,a,d,n;const t=((i=this.processor)==null?void 0:i.unprocessedMemoryEstimate)??0,r=((a=this.controller)==null?void 0:a.expectedFeatureDiff)??0,e=((d=this.processor)==null?void 0:d.loadedFeatures)??0,s=e+r>0?e/(e+r):1;return t+r*(((n=this.processor)==null?void 0:n.usedMemoryPerFeature)??0)*s}get ignoresMemoryFactor(){var t;return(t=this.controller)==null?void 0:t.hasMaximumNumberOfFeaturesOverride}async _queryFeaturesMesh(t,r){await this._validateQueryFeaturesMesh(t);const e=await r();if(t!=null&&t.outStatistics||this.graphics3DProcessor==null)return e;const s=this.layer.objectIdField,i=this.graphics3DProcessor.graphics3DGraphicsByObjectID,a=[];for(const d of e.features)if(d.geometry){const n=i.get(d.attributes[s]);n&&(d.geometry=le(n.graphic.geometry),a.push(d))}else a.push(d);return e.features=a,e}async _validateQueryFeaturesMesh(t){if(!t)return;const r=s=>{throw new b("feature-layer-view:unsupported-query",`Queries on Mesh feature collection layers do not support '${s}'`)},e=["quantizationParameters","geometryPrecision","maxAllowableOffset"];for(const s of e)t[s]!=null&&r(s);"returnM"in t&&t.returnM&&r("returnM"),"returnCentroid"in t&&t.returnCentroid&&r("returnCentroid"),t.outSpatialReference==null||t.outSpatialReference.equals(this.view.spatialReference)||r("outSpatialReference")}get performanceInfo(){var s,i,a,d;const t=(s=this.controller)==null?void 0:s.displayFeatureLimit,r=t!=null?t.averageSymbolComplexity:void 0,e=r!=null?`f:${r.verticesPerFeature},v:${r.verticesPerCoordinate}`:"n/a";return{...this._getResourceInfo(),partial:this.maximumNumberOfFeaturesExceeded,mode:((i=this.controller)==null?void 0:i.mode)??"n/a",symbolComplexity:e,nodes:((a=this.controller)==null?void 0:a.tileDescriptors.length)??0,...((d=this.controller)==null?void 0:d.performanceInfo)??{storedFeatures:0,totalVertices:0}}}get test(){var t;return{updatePolicy:this.updatePolicy,controller:this.controller,loadedGraphics:(t=this.controller)==null?void 0:t.graphics}}};o([l()],p.prototype,"layer",void 0),o([l()],p.prototype,"controller",void 0),o([l()],p.prototype,"_controllerTotal",void 0),o([l()],p.prototype,"_processorTotal",void 0),o([l()],p.prototype,"maximumNumberOfFeatures",null),o([l()],p.prototype,"maximumNumberOfFeaturesExceeded",null),o([l(ue)],p.prototype,"updatingProgress",void 0),o([l({readOnly:!0})],p.prototype,"updatingProgressValue",null),o([l({readOnly:!0})],p.prototype,"updatePolicy",null),o([l({readOnly:!0})],p.prototype,"hasZ",null),o([l({readOnly:!0})],p.prototype,"hasM",null),o([l()],p.prototype,"suspendResumeExtentMode",void 0),p=o([g("esri.views.3d.layers.FeatureLayerViewBase3D")],p);const qe=new Map([["point",5e3],["polygon",500],["polyline",1e3]]),Se=p;export{Se as _}; diff --git a/dist/assets/FeatureReductionLayer-2X2_PJv9.js b/dist/assets/FeatureReductionLayer-2X2_PJv9.js new file mode 100644 index 0000000..1f39a5d --- /dev/null +++ b/dist/assets/FeatureReductionLayer-2X2_PJv9.js @@ -0,0 +1 @@ +import{dq as W,e as r,y as l,c as g,dr as T,ah as c,iy as A,iK as N,iJ as L,iw as D,ix as O,du as E,iN as B,dt as $,oN as z,dy as U,jh as I,ji as q,l9 as b,oO as X,jn as Y,oP as G,mG as Z,oQ as J,oR as M,R as ee,dE as H,oS as te,oT as w,oU as K,r as ie,B as se,a9 as ne}from"./index-pCX-0tJH.js";let h=class extends W(T){constructor(t){super(t),this.expression=null,this.title=null,this.returnType=null}};r([l({type:String,json:{write:!0}})],h.prototype,"expression",void 0),r([l({type:String,json:{write:!0}})],h.prototype,"title",void 0),r([l({type:String,json:{write:!0}})],h.prototype,"returnType",void 0),h=r([g("esri.layers.support.ExpressionInfo")],h);const V=h;var _;let f=_=class extends T{constructor(e){super(e),this.isAutoGenerated=!1,this.name=null,this.alias=null,this.onStatisticField=null,this.onStatisticExpression=null,this.statisticType=null}clone(){return new _({name:this.name,alias:this.alias,isAutoGenerated:this.isAutoGenerated,onStatisticExpression:c(this.onStatisticExpression),onStatisticField:this.onStatisticField,statisticType:this.statisticType})}};r([l({type:Boolean,json:{write:!0}})],f.prototype,"isAutoGenerated",void 0),r([l({type:String,json:{write:!0}})],f.prototype,"name",void 0),r([l({type:String,json:{write:!0}})],f.prototype,"alias",void 0),r([l({type:String,json:{write:!0}})],f.prototype,"onStatisticField",void 0),r([l({type:V,json:{write:!0}})],f.prototype,"onStatisticExpression",void 0),r([l({type:String,json:{write:!0}})],f.prototype,"statisticType",void 0),f=_=r([g("esri.layers.support.AggregateField")],f);const m=f;var F;const re="esri.layers.support.FeatureReductionBinning";let d=F=class extends z{constructor(e){super(e),this.type="binning",this.binType="geohash",this.fixedBinLevel=3,this.labelingInfo=null,this.labelsVisible=!0,this.maxScale=0,this.popupEnabled=!0,this.popupTemplate=null,this.fields=[],this.renderer=null}writeFields(e,t,s){const n=e.filter(o=>o.statisticType!=="avg_angle").map(o=>o.toJSON());U(s,n,t)}readRenderer(e,t,s){var o;const n=(o=t.drawingInfo)==null?void 0:o.renderer;return n?I(n,t,s)??void 0:q(t,s)}clone(){return new F({fields:c(this.fields),fixedBinLevel:this.fixedBinLevel,labelingInfo:c(this.labelingInfo),labelsVisible:this.labelsVisible,maxScale:this.maxScale,popupEnabled:this.popupEnabled,popupTemplate:c(this.popupTemplate),renderer:c(this.renderer)})}};r([A({binning:"binning"})],d.prototype,"type",void 0),r([A({geohash:"geohash"})],d.prototype,"binType",void 0),r([l({type:Number,range:{min:1,max:9},json:{write:!0}})],d.prototype,"fixedBinLevel",void 0),r([l({type:[N],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],d.prototype,"labelingInfo",void 0),r([l(L)],d.prototype,"labelsVisible",void 0),r([l({type:Number,json:{default:0,name:"visibilityInfo.maxScale"}})],d.prototype,"maxScale",void 0),r([l(D)],d.prototype,"popupEnabled",void 0),r([l({type:O,json:{name:"popupInfo",write:!0}})],d.prototype,"popupTemplate",void 0),r([l({type:[m],json:{write:!0}})],d.prototype,"fields",void 0),r([E("fields")],d.prototype,"writeFields",null),r([l({types:B,json:{write:{target:"drawingInfo.renderer"}}})],d.prototype,"renderer",void 0),r([$("renderer",["drawingInfo.renderer"])],d.prototype,"readRenderer",null),d=F=r([g(re)],d);const P=d;var R;const oe="esri.layers.support.FeatureReductionCluster";function k(e){var t;return e.type==="simple"&&!((t=e.visualVariables)!=null&&t.length)}let p=R=class extends T{constructor(e){super(e),this.type="cluster",this.clusterRadius=b("80px"),this.clusterMinSize=b("12px"),this.clusterMaxSize=b("50px"),this.maxScale=0,this.popupEnabled=!0,this.popupTemplate=null,this.renderer=null,this.symbol=null,this.labelingInfo=null,this.labelsVisible=!0,this.fields=null}readRenderer(e,t,s){var o,i;const n=(o=t.drawingInfo)==null?void 0:o.renderer;return(i=n==null?void 0:n.authoringInfo)!=null&&i.isAutoGenerated?null:n?k(n)?null:I(n,t,s)??void 0:q(t,s)}readSymbol(e,t,s){var o,i;const n=(o=t.drawingInfo)==null?void 0:o.renderer;if((i=n==null?void 0:n.authoringInfo)!=null&&i.isAutoGenerated)return null;if(n&&k(n)){const a=I(n,t,s);return a==null?void 0:a.symbol}return null}writeSymbol(e,t,s,n){var i,a;const o=(a=(i=this.renderer)==null?void 0:i.authoringInfo)==null?void 0:a.isAutoGenerated;if(!this.renderer||o){const v=new Y({symbol:e});t.drawingInfo={renderer:v.write({},n)}}}writeFields(e,t,s){const n=e.filter(o=>o.statisticType!=="avg_angle").map(o=>o.toJSON());U(s,n,t)}readFields(e,t,s){return e.filter(n=>!n.isAutoGenerated).map(n=>m.fromJSON(n))}clone(){return new R({clusterRadius:this.clusterRadius,clusterMinSize:this.clusterMinSize,clusterMaxSize:this.clusterMaxSize,labelingInfo:c(this.labelingInfo),labelsVisible:this.labelsVisible,fields:c(this.fields),maxScale:this.maxScale,renderer:c(this.renderer),symbol:c(this.symbol),popupEnabled:this.popupEnabled,popupTemplate:c(this.popupTemplate)})}};r([l({type:["cluster"],readOnly:!0,json:{write:!0}})],p.prototype,"type",void 0),r([l({type:Number,cast:e=>e==="auto"?e:b(e),json:{write:!0}})],p.prototype,"clusterRadius",void 0),r([l({type:Number,cast:b,json:{write:!0}})],p.prototype,"clusterMinSize",void 0),r([l({type:Number,cast:b,json:{write:!0}})],p.prototype,"clusterMaxSize",void 0),r([l({type:Number,json:{default:0,name:"visibilityInfo.maxScale"}})],p.prototype,"maxScale",void 0),r([l(D)],p.prototype,"popupEnabled",void 0),r([l({type:O,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],p.prototype,"popupTemplate",void 0),r([l({types:B,json:{write:{target:"drawingInfo.renderer"}}})],p.prototype,"renderer",void 0),r([$("renderer",["drawingInfo.renderer"])],p.prototype,"readRenderer",null),r([l({types:X})],p.prototype,"symbol",void 0),r([$("symbol",["drawingInfo.renderer"])],p.prototype,"readSymbol",null),r([E("symbol")],p.prototype,"writeSymbol",null),r([l({type:[N],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],p.prototype,"labelingInfo",void 0),r([l(L)],p.prototype,"labelsVisible",void 0),r([l({type:[m],json:{write:!0}})],p.prototype,"fields",void 0),r([E("fields")],p.prototype,"writeFields",null),r([$("fields")],p.prototype,"readFields",null),p=R=r([g(oe)],p);const Q=p,C={key:"type",base:z,typeMap:{cluster:Q,binning:P}},le={types:{key:"type",base:z,typeMap:{selection:G,cluster:Q,binning:P}},json:{name:"layerDefinition.featureReduction",write:{allowNull:!0},origins:{"web-map":{types:C},"portal-item":{types:C},"web-scene":{types:{key:"type",base:z,typeMap:{selection:G}},name:"layerDefinition.featureReduction",write:{layerContainerTypes:Z}}}}};var j;let S=j=class extends J{writeLevels(e,t,s){for(const n in e){const o=this.levels[n];return void(t.stops=o)}}clone(){var e,t;return new j({axis:this.axis,field:this.field,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,maxDataValue:this.maxDataValue,maxSize:M(this.maxSize)?this.maxSize.clone():this.maxSize,minDataValue:this.minDataValue,minSize:M(this.minSize)?this.minSize.clone():this.minSize,normalizationField:this.normalizationField,stops:(e=this.stops)==null?void 0:e.map(s=>s.clone()),target:this.target,useSymbolValue:this.useSymbolValue,valueRepresentation:this.valueRepresentation,valueUnit:this.valueUnit,legendOptions:(t=this.legendOptions)==null?void 0:t.clone(),levels:c(this.levels)})}};r([l()],S.prototype,"levels",void 0),r([E("levels")],S.prototype,"writeLevels",null),S=j=r([g("esri.views.2d.engine.LevelDependentSizeVariable")],S);const ae=ee.getLogger("esri.views.2d.layers.support.clusterUtils");H.add("esri-cluster-arcade-enabled",!0);const ue=H("esri-cluster-arcade-enabled"),pe=(e,t,s,n,o)=>{const i=t.clone();if(!ye(i))return i;if(i.authoringInfo||(i.authoringInfo=new te),i.authoringInfo.isAutoGenerated=!0,"visualVariables"in i){const a=(i.visualVariables||[]).filter(u=>u.valueExpression!=="$view.scale"),v=de(a);a.forEach(u=>{u.type==="rotation"?u.field?u.field=y(e,u.field,"avg_angle","number"):u.valueExpression&&(u.field=x(e,u.valueExpression,"avg_angle","number"),u.valueExpression=null):u.normalizationField?(u.field=y(e,u.field,"avg_norm","number",u.normalizationField),u.normalizationField=null):u.field?u.field=y(e,u.field,"avg","number"):u.valueExpression&&(u.field=x(e,u.valueExpression,"avg","number"),u.valueExpression=null)}),v==null&&!ce(a)&&o&&(a.push(fe(s,n)),i.dynamicClusterSize=!0),i.visualVariables=a}switch(i.type){case"simple":break;case"pie-chart":for(const a of i.attributes)a.field?a.field=y(e,a.field,"sum","number"):a.valueExpression&&(a.field=x(e,a.valueExpression,"sum","number"),a.valueExpression=null);break;case"unique-value":i.field?i.field=y(e,i.field,"mode","string"):i.valueExpression&&(i.field=x(e,i.valueExpression,"mode","string"),i.valueExpression=null);break;case"class-breaks":i.normalizationField?(i.field=y(e,i.field,"avg_norm","number",i.normalizationField),i.normalizationField=null):i.field?i.field=y(e,i.field,"avg","number"):i.valueExpression&&(i.field=x(e,i.valueExpression,"avg","number"),i.valueExpression=null)}return i},de=e=>{for(const t of e)if(t.type==="size")return t;return null},ce=e=>{for(const t of e)if(t.field==="cluster_count")return!0;return!1},fe=(e,t)=>{const s=[new w({value:0,size:0}),new w({value:1})];if(t==null)return new J({field:"cluster_count",stops:[...s,new w({value:2,size:0})]});const n=Object.keys(t).reduce((o,i)=>({...o,[i]:[...s,new w({value:Math.max(2,t[i].minValue),size:e.clusterMinSize}),new w({value:Math.max(3,t[i].maxValue),size:e.clusterMaxSize})]}),{});return new S({field:"cluster_count",levels:n})},ye=e=>{const t=s=>ae.error(new ie("Unsupported-renderer",s,{renderer:e}));if(!e)return!1;switch(e.type){case"unique-value":if(e.field2||e.field3)return t("FeatureReductionCluster does not support multi-field UniqueValueRenderers"),!1;break;case"class-breaks":if(e.normalizationField){const s=e.normalizationType;if(s!=="field")return t(`FeatureReductionCluster does not support a normalizationType of ${s}`),!1}break;case"simple":case"pie-chart":break;default:return t(`FeatureReductionCluster does not support renderers of type ${e.type}`),!1}if(!ue){if("valueExpression"in e&&e.valueExpression)return t("FeatureReductionCluster does not currently support renderer.valueExpression. Support will be added in a future release"),!1;if(("visualVariables"in e&&e.visualVariables||[]).some(s=>!(!("valueExpression"in s)||!s.valueExpression)))return t("FeatureReductionCluster does not currently support visualVariables with a valueExpression. Support will be added in a future release"),!1}return!0};function me(e,t,s){switch(e){case"sum":return`cluster_sum_${t}`;case"avg":case"avg_angle":return`cluster_avg_${t}`;case"mode":return`cluster_type_${t}`;case"avg_norm":{const n=s,o="field",i=t.toLowerCase()+",norm:"+o+","+n.toLowerCase();return"cluster_avg_"+K(i)}}}function x(e,t,s,n){const o=K(t),i=s==="mode"?`cluster_type_${o}`:s==="sum"?`cluster_sum_${o}`:`cluster_avg_${o}`;return e.some(a=>a.name===i)||e.push(new m({name:i,isAutoGenerated:!0,onStatisticExpression:new V({expression:t,returnType:n}),statisticType:s})),i}function y(e,t,s,n,o){if(t==="cluster_count"||e.some(a=>a.name===t))return t;const i=me(s,t,o);return e.some(a=>a.name===i)||(s==="avg_norm"?e.push(new m({name:i,isAutoGenerated:!0,onStatisticExpression:new V({expression:`$feature.${t} / $feature.${o}`,returnType:n}),statisticType:"avg"})):e.push(new m({name:i,isAutoGenerated:!0,onStatisticField:t,statisticType:s}))),i}const be=e=>{let t=class extends e{constructor(...s){super(...s),this.addHandles(se(()=>this.renderer,()=>{if(this.featureReduction){const n=this._normalizeFeatureReduction(this.featureReduction);this._set("featureReduction",n)}},ne))}set featureReduction(s){const n=this._normalizeFeatureReduction(s);this._set("featureReduction",n)}set renderer(s){}_normalizeFeatureReduction(s){var v;if((s==null?void 0:s.type)!=="cluster")return s;const n=s.clone(),o=[new m({name:"cluster_count",isAutoGenerated:!0,statisticType:"count"})],i=(n.fields??[]).filter(u=>!u.isAutoGenerated);if(s.renderer&&!((v=s.renderer.authoringInfo)!=null&&v.isAutoGenerated))return n.fields=[...o,...i],n;if(s.symbol)return n.fields=[...o,...i],n.renderer=null,n;if(!this.renderer)return s;const a=pe(o,this.renderer,s,null,!1);return n.fields=[...o,...i],n.renderer=a,n}};return r([l(le)],t.prototype,"featureReduction",null),t=r([g("esri.layers.mixins.FeatureReductionLayer")],t),t};export{be as c}; diff --git a/dist/assets/FeatureReductionLayer-RlitE1N6.js b/dist/assets/FeatureReductionLayer-RlitE1N6.js deleted file mode 100644 index dc398b2..0000000 --- a/dist/assets/FeatureReductionLayer-RlitE1N6.js +++ /dev/null @@ -1 +0,0 @@ -import{dq as Q,e as r,y as l,c as g,dr as T,bI as c,iw as A,iJ as D,iI as L,iu as N,iv as B,du as E,iM as O,dt as $,oA as I,dD as J,ja as z,jb as U,l1 as b,oB as W,jg as X,oC as G,mx as Y,oD as q,oE as M,Z as ee,dJ as H,oF as te,oG as w,oH as Z,E as ie,d as se,C as ne}from"./index-J0iiHjMT.js";let h=class extends Q(T){constructor(t){super(t),this.expression=null,this.title=null,this.returnType=null}};r([l({type:String,json:{write:!0}})],h.prototype,"expression",void 0),r([l({type:String,json:{write:!0}})],h.prototype,"title",void 0),r([l({type:String,json:{write:!0}})],h.prototype,"returnType",void 0),h=r([g("esri.layers.support.ExpressionInfo")],h);const V=h;var F;let f=F=class extends T{constructor(e){super(e),this.isAutoGenerated=!1,this.name=null,this.alias=null,this.onStatisticField=null,this.onStatisticExpression=null,this.statisticType=null}clone(){return new F({name:this.name,alias:this.alias,isAutoGenerated:this.isAutoGenerated,onStatisticExpression:c(this.onStatisticExpression),onStatisticField:this.onStatisticField,statisticType:this.statisticType})}};r([l({type:Boolean,json:{write:!0}})],f.prototype,"isAutoGenerated",void 0),r([l({type:String,json:{write:!0}})],f.prototype,"name",void 0),r([l({type:String,json:{write:!0}})],f.prototype,"alias",void 0),r([l({type:String,json:{write:!0}})],f.prototype,"onStatisticField",void 0),r([l({type:V,json:{write:!0}})],f.prototype,"onStatisticExpression",void 0),r([l({type:String,json:{write:!0}})],f.prototype,"statisticType",void 0),f=F=r([g("esri.layers.support.AggregateField")],f);const m=f;var _;const re="esri.layers.support.FeatureReductionBinning";let d=_=class extends I{constructor(e){super(e),this.type="binning",this.binType="geohash",this.fixedBinLevel=3,this.labelingInfo=null,this.labelsVisible=!0,this.maxScale=0,this.popupEnabled=!0,this.popupTemplate=null,this.fields=[],this.renderer=null}writeFields(e,t,s){const n=e.filter(o=>o.statisticType!=="avg_angle").map(o=>o.toJSON());J(s,n,t)}readRenderer(e,t,s){var o;const n=(o=t.drawingInfo)==null?void 0:o.renderer;return n?z(n,t,s)??void 0:U(t,s)}clone(){return new _({fields:c(this.fields),fixedBinLevel:this.fixedBinLevel,labelingInfo:c(this.labelingInfo),labelsVisible:this.labelsVisible,maxScale:this.maxScale,popupEnabled:this.popupEnabled,popupTemplate:c(this.popupTemplate),renderer:c(this.renderer)})}};r([A({binning:"binning"})],d.prototype,"type",void 0),r([A({geohash:"geohash"})],d.prototype,"binType",void 0),r([l({type:Number,range:{min:1,max:9},json:{write:!0}})],d.prototype,"fixedBinLevel",void 0),r([l({type:[D],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],d.prototype,"labelingInfo",void 0),r([l(L)],d.prototype,"labelsVisible",void 0),r([l({type:Number,json:{default:0,name:"visibilityInfo.maxScale"}})],d.prototype,"maxScale",void 0),r([l(N)],d.prototype,"popupEnabled",void 0),r([l({type:B,json:{name:"popupInfo",write:!0}})],d.prototype,"popupTemplate",void 0),r([l({type:[m],json:{write:!0}})],d.prototype,"fields",void 0),r([E("fields")],d.prototype,"writeFields",null),r([l({types:O,json:{write:{target:"drawingInfo.renderer"}}})],d.prototype,"renderer",void 0),r([$("renderer",["drawingInfo.renderer"])],d.prototype,"readRenderer",null),d=_=r([g(re)],d);const K=d;var j;const oe="esri.layers.support.FeatureReductionCluster";function C(e){var t;return e.type==="simple"&&!((t=e.visualVariables)!=null&&t.length)}let p=j=class extends T{constructor(e){super(e),this.type="cluster",this.clusterRadius=b("80px"),this.clusterMinSize=b("12px"),this.clusterMaxSize=b("50px"),this.maxScale=0,this.popupEnabled=!0,this.popupTemplate=null,this.renderer=null,this.symbol=null,this.labelingInfo=null,this.labelsVisible=!0,this.fields=null}readRenderer(e,t,s){var o,i;const n=(o=t.drawingInfo)==null?void 0:o.renderer;return(i=n==null?void 0:n.authoringInfo)!=null&&i.isAutoGenerated?null:n?C(n)?null:z(n,t,s)??void 0:U(t,s)}readSymbol(e,t,s){var o,i;const n=(o=t.drawingInfo)==null?void 0:o.renderer;if((i=n==null?void 0:n.authoringInfo)!=null&&i.isAutoGenerated)return null;if(n&&C(n)){const a=z(n,t,s);return a==null?void 0:a.symbol}return null}writeSymbol(e,t,s,n){var i,a;const o=(a=(i=this.renderer)==null?void 0:i.authoringInfo)==null?void 0:a.isAutoGenerated;if(!this.renderer||o){const v=new X({symbol:e});t.drawingInfo={renderer:v.write({},n)}}}writeFields(e,t,s){const n=e.filter(o=>o.statisticType!=="avg_angle").map(o=>o.toJSON());J(s,n,t)}readFields(e,t,s){return e.filter(n=>!n.isAutoGenerated).map(n=>m.fromJSON(n))}clone(){return new j({clusterRadius:this.clusterRadius,clusterMinSize:this.clusterMinSize,clusterMaxSize:this.clusterMaxSize,labelingInfo:c(this.labelingInfo),labelsVisible:this.labelsVisible,fields:c(this.fields),maxScale:this.maxScale,renderer:c(this.renderer),symbol:c(this.symbol),popupEnabled:this.popupEnabled,popupTemplate:c(this.popupTemplate)})}};r([l({type:["cluster"],readOnly:!0,json:{write:!0}})],p.prototype,"type",void 0),r([l({type:Number,cast:e=>e==="auto"?e:b(e),json:{write:!0}})],p.prototype,"clusterRadius",void 0),r([l({type:Number,cast:b,json:{write:!0}})],p.prototype,"clusterMinSize",void 0),r([l({type:Number,cast:b,json:{write:!0}})],p.prototype,"clusterMaxSize",void 0),r([l({type:Number,json:{default:0,name:"visibilityInfo.maxScale"}})],p.prototype,"maxScale",void 0),r([l(N)],p.prototype,"popupEnabled",void 0),r([l({type:B,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],p.prototype,"popupTemplate",void 0),r([l({types:O,json:{write:{target:"drawingInfo.renderer"}}})],p.prototype,"renderer",void 0),r([$("renderer",["drawingInfo.renderer"])],p.prototype,"readRenderer",null),r([l({types:W})],p.prototype,"symbol",void 0),r([$("symbol",["drawingInfo.renderer"])],p.prototype,"readSymbol",null),r([E("symbol")],p.prototype,"writeSymbol",null),r([l({type:[D],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],p.prototype,"labelingInfo",void 0),r([l(L)],p.prototype,"labelsVisible",void 0),r([l({type:[m],json:{write:!0}})],p.prototype,"fields",void 0),r([E("fields")],p.prototype,"writeFields",null),r([$("fields")],p.prototype,"readFields",null),p=j=r([g(oe)],p);const P=p,k={key:"type",base:I,typeMap:{cluster:P,binning:K}},le={types:{key:"type",base:I,typeMap:{selection:G,cluster:P,binning:K}},json:{name:"layerDefinition.featureReduction",write:{allowNull:!0},origins:{"web-map":{types:k},"portal-item":{types:k},"web-scene":{types:{key:"type",base:I,typeMap:{selection:G}},name:"layerDefinition.featureReduction",write:{layerContainerTypes:Y}}}}};var R;let S=R=class extends q{writeLevels(e,t,s){for(const n in e){const o=this.levels[n];return void(t.stops=o)}}clone(){var e,t;return new R({axis:this.axis,field:this.field,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,maxDataValue:this.maxDataValue,maxSize:M(this.maxSize)?this.maxSize.clone():this.maxSize,minDataValue:this.minDataValue,minSize:M(this.minSize)?this.minSize.clone():this.minSize,normalizationField:this.normalizationField,stops:(e=this.stops)==null?void 0:e.map(s=>s.clone()),target:this.target,useSymbolValue:this.useSymbolValue,valueRepresentation:this.valueRepresentation,valueUnit:this.valueUnit,legendOptions:(t=this.legendOptions)==null?void 0:t.clone(),levels:c(this.levels)})}};r([l()],S.prototype,"levels",void 0),r([E("levels")],S.prototype,"writeLevels",null),S=R=r([g("esri.views.2d.engine.LevelDependentSizeVariable")],S);const ae=ee.getLogger("esri.views.2d.layers.support.clusterUtils");H.add("esri-cluster-arcade-enabled",!0);const ue=H("esri-cluster-arcade-enabled"),pe=(e,t,s,n,o)=>{const i=t.clone();if(!ye(i))return i;if(i.authoringInfo||(i.authoringInfo=new te),i.authoringInfo.isAutoGenerated=!0,"visualVariables"in i){const a=(i.visualVariables||[]).filter(u=>u.valueExpression!=="$view.scale"),v=de(a);a.forEach(u=>{u.type==="rotation"?u.field?u.field=y(e,u.field,"avg_angle","number"):u.valueExpression&&(u.field=x(e,u.valueExpression,"avg_angle","number"),u.valueExpression=null):u.normalizationField?(u.field=y(e,u.field,"avg_norm","number",u.normalizationField),u.normalizationField=null):u.field?u.field=y(e,u.field,"avg","number"):u.valueExpression&&(u.field=x(e,u.valueExpression,"avg","number"),u.valueExpression=null)}),v==null&&!ce(a)&&o&&(a.push(fe(s,n)),i.dynamicClusterSize=!0),i.visualVariables=a}switch(i.type){case"simple":break;case"pie-chart":for(const a of i.attributes)a.field?a.field=y(e,a.field,"sum","number"):a.valueExpression&&(a.field=x(e,a.valueExpression,"sum","number"),a.valueExpression=null);break;case"unique-value":i.field?i.field=y(e,i.field,"mode","string"):i.valueExpression&&(i.field=x(e,i.valueExpression,"mode","string"),i.valueExpression=null);break;case"class-breaks":i.normalizationField?(i.field=y(e,i.field,"avg_norm","number",i.normalizationField),i.normalizationField=null):i.field?i.field=y(e,i.field,"avg","number"):i.valueExpression&&(i.field=x(e,i.valueExpression,"avg","number"),i.valueExpression=null)}return i},de=e=>{for(const t of e)if(t.type==="size")return t;return null},ce=e=>{for(const t of e)if(t.field==="cluster_count")return!0;return!1},fe=(e,t)=>{const s=[new w({value:0,size:0}),new w({value:1})];if(t==null)return new q({field:"cluster_count",stops:[...s,new w({value:2,size:0})]});const n=Object.keys(t).reduce((o,i)=>({...o,[i]:[...s,new w({value:Math.max(2,t[i].minValue),size:e.clusterMinSize}),new w({value:Math.max(3,t[i].maxValue),size:e.clusterMaxSize})]}),{});return new S({field:"cluster_count",levels:n})},ye=e=>{const t=s=>ae.error(new ie("Unsupported-renderer",s,{renderer:e}));if(!e)return!1;switch(e.type){case"unique-value":if(e.field2||e.field3)return t("FeatureReductionCluster does not support multi-field UniqueValueRenderers"),!1;break;case"class-breaks":if(e.normalizationField){const s=e.normalizationType;if(s!=="field")return t(`FeatureReductionCluster does not support a normalizationType of ${s}`),!1}break;case"simple":case"pie-chart":break;default:return t(`FeatureReductionCluster does not support renderers of type ${e.type}`),!1}if(!ue){if("valueExpression"in e&&e.valueExpression)return t("FeatureReductionCluster does not currently support renderer.valueExpression. Support will be added in a future release"),!1;if(("visualVariables"in e&&e.visualVariables||[]).some(s=>!(!("valueExpression"in s)||!s.valueExpression)))return t("FeatureReductionCluster does not currently support visualVariables with a valueExpression. Support will be added in a future release"),!1}return!0};function me(e,t,s){switch(e){case"sum":return`cluster_sum_${t}`;case"avg":case"avg_angle":return`cluster_avg_${t}`;case"mode":return`cluster_type_${t}`;case"avg_norm":{const n=s,o="field",i=t.toLowerCase()+",norm:"+o+","+n.toLowerCase();return"cluster_avg_"+Z(i)}}}function x(e,t,s,n){const o=Z(t),i=s==="mode"?`cluster_type_${o}`:s==="sum"?`cluster_sum_${o}`:`cluster_avg_${o}`;return e.some(a=>a.name===i)||e.push(new m({name:i,isAutoGenerated:!0,onStatisticExpression:new V({expression:t,returnType:n}),statisticType:s})),i}function y(e,t,s,n,o){if(t==="cluster_count"||e.some(a=>a.name===t))return t;const i=me(s,t,o);return e.some(a=>a.name===i)||(s==="avg_norm"?e.push(new m({name:i,isAutoGenerated:!0,onStatisticExpression:new V({expression:`$feature.${t} / $feature.${o}`,returnType:n}),statisticType:"avg"})):e.push(new m({name:i,isAutoGenerated:!0,onStatisticField:t,statisticType:s}))),i}const be=e=>{let t=class extends e{constructor(...s){super(...s),this.addHandles(se(()=>this.renderer,()=>{if(this.featureReduction){const n=this._normalizeFeatureReduction(this.featureReduction);this._set("featureReduction",n)}},ne))}set featureReduction(s){const n=this._normalizeFeatureReduction(s);this._set("featureReduction",n)}set renderer(s){}_normalizeFeatureReduction(s){var v;if((s==null?void 0:s.type)!=="cluster")return s;const n=s.clone(),o=[new m({name:"cluster_count",isAutoGenerated:!0,statisticType:"count"})],i=(n.fields??[]).filter(u=>!u.isAutoGenerated);if(s.renderer&&!((v=s.renderer.authoringInfo)!=null&&v.isAutoGenerated))return n.fields=[...o,...i],n;if(s.symbol)return n.fields=[...o,...i],n.renderer=null,n;if(!this.renderer)return s;const a=pe(o,this.renderer,s,null,!1);return n.fields=[...o,...i],n.renderer=a,n}};return r([l(le)],t.prototype,"featureReduction",null),t=r([g("esri.layers.mixins.FeatureReductionLayer")],t),t};export{be as c}; diff --git a/dist/assets/FeatureServiceSnappingSource-El1DZ1LB.js b/dist/assets/FeatureServiceSnappingSource-LrGkMfSm.js similarity index 69% rename from dist/assets/FeatureServiceSnappingSource-El1DZ1LB.js rename to dist/assets/FeatureServiceSnappingSource-LrGkMfSm.js index d23fceb..1cfcb88 100644 --- a/dist/assets/FeatureServiceSnappingSource-El1DZ1LB.js +++ b/dist/assets/FeatureServiceSnappingSource-LrGkMfSm.js @@ -1,9 +1,9 @@ -import{nX as W,os as J,ot as G,as as Z,ou as q,e as s,y as a,c as I,p as O,ov as B,d as _,C as j,ig as F,P as m,ow as Q,a2 as X,l as K,eD as Y,k as L,ah as ee,a as te,bB as ie,gG as ne,e3 as N,fe as se,ls as re,mH as ae,e$ as oe,T as le,f0 as de,ox as ue,oy as pe,gD as he,s as V,gC as ce,ao as f,fl as ye,fw as A,A as fe,oz as ge,b as _e,de as ve}from"./index-J0iiHjMT.js";import{o as we,a as Se}from"./queryEngineUtils-0F1SWi13.js";import{d as me}from"./TileTreeDebugger-2DVbY5sQ.js";import"./VertexSnappingCandidate-sgrBHAMS.js";import"./PointSnappingHint-ULetRXiW.js";function b(e,t){return J(t.extent,U),G(U,Z(Ie,e.x,e.y,0))}const U=W(),Ie=q();let y=class extends O{get tiles(){const t=this.tilesCoveringView,n=this.pointOfInterest!=null?this.pointOfInterest:this.view.center;return t.sort((r,i)=>b(n,r)-b(n,i)),t}_scaleEnabled(){return B(this.view.scale,this.layer.minScale||0,this.layer.maxScale||0)}get tilesCoveringView(){if(!this.view.ready||!this.view.featuresTilingScheme||!this.view.state||this.tileInfo==null)return[];if(!this._scaleEnabled)return[];const{spans:t,lodInfo:n}=this.view.featuresTilingScheme.getTileCoverage(this.view.state,0),{level:r}=n,i=[];for(const{row:o,colFrom:l,colTo:v}of t)for(let d=l;d<=v;d++){const u=n.normalizeCol(d),S=new F(null,r,o,u);this.tileInfo.updateTileInfo(S),i.push(S)}return i}get tileInfo(){var t;return((t=this.view.featuresTilingScheme)==null?void 0:t.tileInfo)??null}get tileSize(){return this.tileInfo!=null?this.tileInfo.size[0]:256}constructor(t){super(t),this.pointOfInterest=null}initialize(){this.addHandles(_(()=>{var t,n;return(n=(t=this.view)==null?void 0:t.state)==null?void 0:n.viewpoint},()=>this.notifyChange("tilesCoveringView"),j))}};s([a({readOnly:!0})],y.prototype,"tiles",null),s([a({readOnly:!0})],y.prototype,"_scaleEnabled",null),s([a({readOnly:!0})],y.prototype,"tilesCoveringView",null),s([a({readOnly:!0})],y.prototype,"tileInfo",null),s([a({readOnly:!0})],y.prototype,"tileSize",null),s([a({constructOnly:!0})],y.prototype,"view",void 0),s([a({constructOnly:!0})],y.prototype,"layer",void 0),s([a()],y.prototype,"pointOfInterest",void 0),y=s([I("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles2D")],y);let g=class extends O{get tiles(){const e=this.tilesCoveringView,t=this._effectivePointOfInterest;if(t!=null){const n=e.map(r=>b(t,r));for(let r=1;rn[r])return e.sort((i,o)=>b(t,i)-b(t,o)),e.slice()}return e}get tilesCoveringView(){var e,t;return this._filterTiles((t=(e=this.view.featureTiles)==null?void 0:e.tiles)==null?void 0:t.toArray()).map(He)}get tileInfo(){var e;return((e=this.view.featureTiles)==null?void 0:e.tilingScheme.toTileInfo())??null}get tileSize(){var e;return((e=this.view.featureTiles)==null?void 0:e.tileSize)??256}get _effectivePointOfInterest(){var t;const e=this.pointOfInterest;return e??((t=this.view.pointsOfInterest)==null?void 0:t.focus.location)}constructor(e){super(e),this.pointOfInterest=null}initialize(){this.addHandles(_(()=>this.view.featureTiles,e=>{this.removeHandles(D),e&&this.addHandles(e.addClient(),D)},m))}_filterTiles(e){return e==null?[]:e.filter(t=>Math.abs(t.measures.screenRect[3]-t.measures.screenRect[1])>be&&t.measures.visibility===Q.VISIBLE_ON_SURFACE)}};function He({lij:[e,t,n],extent:r}){return new F(`${e}/${t}/${n}`,e,t,n,r)}s([a({readOnly:!0})],g.prototype,"tiles",null),s([a({readOnly:!0})],g.prototype,"tilesCoveringView",null),s([a({readOnly:!0})],g.prototype,"tileInfo",null),s([a({readOnly:!0})],g.prototype,"tileSize",null),s([a({constructOnly:!0})],g.prototype,"view",void 0),s([a()],g.prototype,"pointOfInterest",void 0),s([a()],g.prototype,"_effectivePointOfInterest",null),g=s([I("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles3D")],g);const be=50,D="feature-tiles";let k=class extends me{constructor(e){super(e)}initialize(){const e=setInterval(()=>this._fetchDebugInfo(),2e3);this.addHandles(X(()=>clearInterval(e)))}getTiles(){if(!this._debugInfo)return[];const e=new Map,t=new Map;this._debugInfo.storedTiles.forEach(i=>{e.set(i.data.id,i.featureCount)}),this._debugInfo.pendingTiles.forEach(i=>{e.set(i.data.id,i.featureCount),t.set(i.data.id,i.state)});const n=i=>{const o=t.get(i),l=e.get(i)??"?";return o?`${o}:${l} +import{o7 as D,oF as J,oG as G,bz as Z,oH as q,e as s,y as a,c as I,g as O,oI as B,B as _,a9 as W,ii as F,P as m,oJ as Q,a0 as K,j as X,ex as Y,h as j,bs as ee,I as te,bU as ie,gD as ne,dY as N,f9 as se,lA as re,mQ as ae,eW as oe,L as le,eX as de,oK as ue,oL as pe,gA as he,ab as V,gz as ce,br as f,fg as ye,fr as A,T as fe,oM as ge,N as _e,de as ve}from"./index-pCX-0tJH.js";import{o as we,a as Se}from"./queryEngineUtils-bbt-XRJJ.js";import{d as me}from"./TileTreeDebugger-MxH50s1q.js";import"./VertexSnappingCandidate-YEvkEqQJ.js";import"./PointSnappingHint-bwlQAyn6.js";function H(e,t){return J(t.extent,U),G(U,Z(Ie,e.x,e.y,0))}const U=D(),Ie=q();let y=class extends O{get tiles(){const t=this.tilesCoveringView,n=this.pointOfInterest!=null?this.pointOfInterest:this.view.center;return t.sort((r,i)=>H(n,r)-H(n,i)),t}_scaleEnabled(){return B(this.view.scale,this.layer.minScale||0,this.layer.maxScale||0)}get tilesCoveringView(){if(!this.view.ready||!this.view.featuresTilingScheme||!this.view.state||this.tileInfo==null)return[];if(!this._scaleEnabled)return[];const{spans:t,lodInfo:n}=this.view.featuresTilingScheme.getTileCoverage(this.view.state,0),{level:r}=n,i=[];for(const{row:o,colFrom:l,colTo:v}of t)for(let d=l;d<=v;d++){const u=n.normalizeCol(d),S=new F(null,r,o,u);this.tileInfo.updateTileInfo(S),i.push(S)}return i}get tileInfo(){var t;return((t=this.view.featuresTilingScheme)==null?void 0:t.tileInfo)??null}get tileSize(){return this.tileInfo!=null?this.tileInfo.size[0]:256}constructor(t){super(t),this.pointOfInterest=null}initialize(){this.addHandles(_(()=>{var t,n;return(n=(t=this.view)==null?void 0:t.state)==null?void 0:n.viewpoint},()=>this.notifyChange("tilesCoveringView"),W))}};s([a({readOnly:!0})],y.prototype,"tiles",null),s([a({readOnly:!0})],y.prototype,"_scaleEnabled",null),s([a({readOnly:!0})],y.prototype,"tilesCoveringView",null),s([a({readOnly:!0})],y.prototype,"tileInfo",null),s([a({readOnly:!0})],y.prototype,"tileSize",null),s([a({constructOnly:!0})],y.prototype,"view",void 0),s([a({constructOnly:!0})],y.prototype,"layer",void 0),s([a()],y.prototype,"pointOfInterest",void 0),y=s([I("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles2D")],y);let g=class extends O{get tiles(){const e=this.tilesCoveringView,t=this._effectivePointOfInterest;if(t!=null){const n=e.map(r=>H(t,r));for(let r=1;rn[r])return e.sort((i,o)=>H(t,i)-H(t,o)),e.slice()}return e}get tilesCoveringView(){var e,t;return this._filterTiles((t=(e=this.view.featureTiles)==null?void 0:e.tiles)==null?void 0:t.toArray()).map(be)}get tileInfo(){var e;return((e=this.view.featureTiles)==null?void 0:e.tilingScheme.toTileInfo())??null}get tileSize(){var e;return((e=this.view.featureTiles)==null?void 0:e.tileSize)??256}get _effectivePointOfInterest(){var t;const e=this.pointOfInterest;return e??((t=this.view.pointsOfInterest)==null?void 0:t.focus.location)}constructor(e){super(e),this.pointOfInterest=null}initialize(){this.addHandles(_(()=>this.view.featureTiles,e=>{this.removeHandles(L),e&&this.addHandles(e.addClient(),L)},m))}_filterTiles(e){return e==null?[]:e.filter(t=>Math.abs(t.measures.screenRect[3]-t.measures.screenRect[1])>He&&t.measures.visibility===Q.VISIBLE_ON_SURFACE)}};function be({lij:[e,t,n],extent:r}){return new F(`${e}/${t}/${n}`,e,t,n,r)}s([a({readOnly:!0})],g.prototype,"tiles",null),s([a({readOnly:!0})],g.prototype,"tilesCoveringView",null),s([a({readOnly:!0})],g.prototype,"tileInfo",null),s([a({readOnly:!0})],g.prototype,"tileSize",null),s([a({constructOnly:!0})],g.prototype,"view",void 0),s([a()],g.prototype,"pointOfInterest",void 0),s([a()],g.prototype,"_effectivePointOfInterest",null),g=s([I("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiles3D")],g);const He=50,L="feature-tiles";let k=class extends me{constructor(e){super(e)}initialize(){const e=setInterval(()=>this._fetchDebugInfo(),2e3);this.addHandles(K(()=>clearInterval(e)))}getTiles(){if(!this._debugInfo)return[];const e=new Map,t=new Map;this._debugInfo.storedTiles.forEach(i=>{e.set(i.data.id,i.featureCount)}),this._debugInfo.pendingTiles.forEach(i=>{e.set(i.data.id,i.featureCount),t.set(i.data.id,i.state)});const n=i=>{const o=t.get(i),l=e.get(i)??"?";return o?`${o}:${l} ${i}`:`store:${l} -${i}`},r=new Map;return this._debugInfo.storedTiles.forEach(i=>{r.set(i.data.id,i.data)}),this._debugInfo.pendingTiles.forEach(i=>{r.set(i.data.id,i.data)}),Array.from(r.values()).map(i=>({lij:[i.level,i.row,i.col],geometry:K.fromExtent(Y(i.extent,this.view.spatialReference)),label:n(i.id)}))}_fetchDebugInfo(){this.handle.getDebugInfo(null).then(e=>{this._debugInfo=e,this.update()})}};s([a({constructOnly:!0})],k.prototype,"handle",void 0),k=s([I("esri.views.interactive.snapping.featureSources.WorkerTileTreeDebugger")],k);let c=class extends O{get updating(){return this._updatingHandles.updating||this._workerHandleUpdating}constructor(e){super(e),this._updatingHandles=new L,this._suspendController=null,this.schedule=null,this.hasZ=!1,this.elevationAlignPointsInFeatures=async t=>{const n=[];for(const{points:r}of t.pointsInFeatures)for(const{z:i}of r)n.push(i);return{elevations:n,drapedObjectIds:new Set,failedObjectIds:new Set}},this.queryForSymbologySnapping=async()=>({candidates:[],sourceCandidateIndices:[]}),this.availability=0,this._workerHandleUpdating=!0,this._editId=0,this.updateOutFields=ee(async(t,n)=>{await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("updateOutFields",[...t],n)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},n))})}destroy(){this._suspendController=te(this._suspendController),this._workerHandle.destroy(),this._updatingHandles.destroy()}initialize(){this._workerHandle=new Oe(this.schedule,{alignElevation:async(e,{signal:t})=>({result:await this.elevationAlignPointsInFeatures(e.query,t)}),getSymbologyCandidates:async(e,{signal:t})=>({result:await this.queryForSymbologySnapping(e,t)})}),this.addHandles([this._workerHandle.on("notify-updating",({updating:e})=>this._workerHandleUpdating=e),this._workerHandle.on("notify-availability",({availability:e})=>this._set("availability",e))])}async setup(e,t){var i;const n=this._serviceInfoFromLayer(e.layer);if(n==null)return;const r={configuration:this._convertConfiguration(e.configuration),serviceInfo:n,spatialReference:e.spatialReference.toJSON(),hasZ:this.hasZ,elevationInfo:(i=e.layer.elevationInfo)==null?void 0:i.toJSON()};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("setup",r,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}async configure(e,t){const n=this._convertConfiguration(e);await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("configure",n,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}async refresh(e){await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("refresh",{},e)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},e))}async fetchCandidates(e,t){const{point:n,filter:r,coordinateHelper:i}=e,o={...e,point:ie(n[0],n[1],n[2],i.spatialReference.toJSON()),filter:r==null?void 0:r.toJSON()};return this._workerHandle.invoke(o,t)}async updateTiles(e,t){const n={tiles:e.tiles,tileInfo:e.tileInfo!=null?e.tileInfo.toJSON():null,tileSize:e.tileSize};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("updateTiles",n,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}async applyEdits(e,t){var l,v,d;const n=this._editId++,r={id:n};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("beginApplyEdits",r,t));const i=await this._updatingHandles.addPromise(ne(e.result,t)),o={id:n,edits:{addedFeatures:((l=i.addedFeatures)==null?void 0:l.map(({objectId:u})=>u).filter(N))??[],deletedFeatures:((v=i.deletedFeatures)==null?void 0:v.map(({objectId:u,globalId:S})=>({objectId:u,globalId:S})))??[],updatedFeatures:((d=i.updatedFeatures)==null?void 0:d.map(({objectId:u})=>u).filter(N))??[]}};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("endApplyEdits",o,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}getDebugInfo(e){return this._workerHandle.invokeMethod("getDebugInfo",{},e)}async notifyElevationSourceChange(){await this._workerHandle.invokeMethod("notifyElevationSourceChange",{})}async notifySymbologyChange(){await this._workerHandle.invokeMethod("notifySymbologyChange",{})}async setSymbologySnappingSupported(e){await this._workerHandle.invokeMethod("setSymbologySnappingSupported",e)}async setSuspended(e){var t;(t=this._suspendController)==null||t.abort(),this._suspendController=new AbortController,await this._workerHandle.invokeMethod("setSuspended",e,this._suspendController.signal)}_convertConfiguration(e){return{filter:e.filter!=null?e.filter.toJSON():null,customParameters:e.customParameters,viewType:e.viewType}}_serviceInfoFromLayer(e){var t,n;return e.geometryType==="multipatch"||e.geometryType==="mesh"?null:{url:((t=e.parsedUrl)==null?void 0:t.path)??"",fieldsIndex:e.fieldsIndex.toJSON(),geometryType:se.toJSON(e.geometryType),capabilities:e.capabilities,objectIdField:e.objectIdField,globalIdField:e.globalIdField,spatialReference:e.spatialReference.toJSON(),timeInfo:(n=e.timeInfo)==null?void 0:n.toJSON()}}};s([a({constructOnly:!0})],c.prototype,"schedule",void 0),s([a({constructOnly:!0})],c.prototype,"hasZ",void 0),s([a({constructOnly:!0})],c.prototype,"elevationAlignPointsInFeatures",void 0),s([a({constructOnly:!0})],c.prototype,"queryForSymbologySnapping",void 0),s([a({readOnly:!0})],c.prototype,"updating",null),s([a({readOnly:!0})],c.prototype,"availability",void 0),s([a()],c.prototype,"_workerHandleUpdating",void 0),c=s([I("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorkerHandle")],c);class Oe extends re{constructor(t,n){super("FeatureServiceSnappingSourceWorker","fetchCandidates",{},t,{strategy:"dedicated",client:n})}}let w=class extends O{get tiles(){return[new F("0/0/0",0,0,0,ae(-1e8,-1e8,1e8,1e8))]}get tileInfo(){return new oe({origin:new le({x:-1e8,y:1e8,spatialReference:this.layer.spatialReference}),size:[512,512],lods:[new de({level:0,scale:1,resolution:390625})],spatialReference:this.layer.spatialReference})}get tileSize(){return this.tileInfo.size[0]}constructor(e){super(e),this.pointOfInterest=null}};s([a({readOnly:!0})],w.prototype,"tiles",null),s([a({readOnly:!0})],w.prototype,"tileInfo",null),s([a({readOnly:!0})],w.prototype,"tileSize",null),s([a({constructOnly:!0})],w.prototype,"layer",void 0),s([a()],w.prototype,"pointOfInterest",void 0),w=s([I("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTilesSimple")],w);let p=class extends O{get _updateTilesParameters(){return{tiles:this._tilesOfInterest.tiles,tileInfo:this._tilesOfInterest.tileInfo,tileSize:this._tilesOfInterest.tileSize}}get _layerView(){var e;return(e=this.view)==null?void 0:e.allLayerViews.find(t=>t.layer===this._layer)}get _isSuspended(){var e;return ue(this._layer)&&!this._layer.sublayers.find(t=>t.visible)?!0:!!this.view&&(((e=this._layerView)==null?void 0:e.suspended)!==!1||!this.layerSource.enabled)}get updating(){var e;return((e=this._workerHandle)==null?void 0:e.updating)||this._updatingHandles.updating}get _outFields(){var S,T,C,$,P,E,M,x;const{view:e,_layerView:t,layerSource:n}=this,{layer:r}=n,{fieldsIndex:i,timeInfo:o,floorInfo:l,subtypeField:v}=r,d=t&&"filter"in t?t.filter:null,u=d!=null&&d.where&&d.where!=="1=1"?this._getOrLoadWhereFields(d.where,i):[];if(d!=null&&d.timeExtent&&o){const{startField:h,endField:H}=o,z=((S=i.get(h))==null?void 0:S.name)??h,R=((T=i.get(H))==null?void 0:T.name)??H;z&&u.push(z),R&&u.push(R)}if(e!=null&&e.map&&pe(e.map)&&((C=e.map.utilityNetworks)!=null&&C.find(h=>h.isUtilityLayer(r)))){const h=($=r.fieldsIndex.get("assetGroup"))==null?void 0:$.name,H=(P=r.fieldsIndex.get("assetType"))==null?void 0:P.name;h&&H&&(u.push(h),u.push(H))}if(r&&(l!=null&&l.floorField)&&((E=e==null?void 0:e.floors)!=null&&E.length)){const h=((M=i.get(l.floorField))==null?void 0:M.name)??l.floorField;h&&u.push(h)}if(v){const h=((x=i.get(v))==null?void 0:x.name)??v;h&&u.push(h)}return new Set(u)}get configuration(){const{view:e}=this,t=e!=null?e.type:"2d";return{filter:this._layer.createQuery(),customParameters:this._layer.customParameters,viewType:t}}get availability(){var e;return((e=this._workerHandle)==null?void 0:e.availability)??0}get _layer(){return this.layerSource.layer}constructor(e){super(e),this._updatingHandles=new L,this._workerHandle=null,this._debug=null,this._memoizedMakeGetGroundElevation=he(we)}initialize(){let e;const t=this.view;if(t!=null)switch(t.type){case"2d":this._tilesOfInterest=new y({view:t,layer:this._layer}),e=this._workerHandle=new c;break;case"3d":{const{resourceController:n}=t,r=this._layer;this._tilesOfInterest=new g({view:t}),e=this._workerHandle=new c({schedule:i=>n.immediate.schedule(i),hasZ:this._layer.hasZ&&(this._layer.returnZ??!0),elevationAlignPointsInFeatures:async(i,o)=>{const l=await t.whenLayerView(r);return V(o),l.elevationAlignPointsInFeatures(i,o)},queryForSymbologySnapping:async(i,o)=>{const l=await t.whenLayerView(r);return V(o),l.queryForSymbologySnapping(i,o)}}),this.addHandles([t.elevationProvider.on("elevation-change",({context:i})=>{const{elevationInfo:o}=r;ce(i,o)&&f(e.notifyElevationSourceChange())}),_(()=>r.elevationInfo,()=>f(e.notifyElevationSourceChange()),m),_(()=>{var i,o;return(o=(i=this._layerView)==null?void 0:i.processor)==null?void 0:o.renderer},()=>f(e.notifySymbologyChange()),m),_(()=>{var i;return((i=this._layerView)==null?void 0:i.symbologySnappingSupported)??!1},i=>f(e.setSymbologySnappingSupported(i)),m),ye(()=>{var i;return(i=this._layerView)==null?void 0:i.layer},["edits","apply-edits","graphic-update"],()=>e.notifySymbologyChange())]);break}}else this._tilesOfInterest=new w({layer:this._layer}),e=this._workerHandle=new c;this.addHandles([A(e)]),f(e.setup({layer:this._layer,spatialReference:this.spatialReference,configuration:this.configuration},null)),this._updatingHandles.add(()=>this._updateTilesParameters,()=>f(e.updateTiles(this._updateTilesParameters,null)),m),this.addHandles([_(()=>this.configuration,n=>f(e.configure(n,null)),j),_(()=>this._outFields,n=>f(e.updateOutFields(n)),m),_(()=>this._isSuspended,n=>f(e.setSuspended(n)),fe)]),t!=null&&this.addHandles(_(()=>ge.FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES,n=>{n&&!this._debug?(this._debug=new k({view:t,handle:e}),this.addHandles(A(this._debug),"debug")):!n&&this._debug&&this.removeHandles("debug")},m)),this.addHandles(this.layerSource.layer.on("apply-edits",n=>{f(e.applyEdits(n,null))}))}destroy(){this._updatingHandles.destroy()}refresh(){var e;(e=this._workerHandle)==null||e.refresh(null)}async fetchCandidates(e,t){const{coordinateHelper:n,point:r}=e;this._tilesOfInterest.pointOfInterest=n.arrayToPoint(r);const i=this._memoizedMakeGetGroundElevation(this.view,n.spatialReference);return(await this._workerHandle.fetchCandidates({...e},t)).candidates.map(o=>Se(o,i))}getDebugInfo(e){return this._workerHandle.getDebugInfo(e)}_getOrLoadWhereFields(e,t){const{_whereModule:n}=this;if(!this._loadWhereModuleTask&&!n){const r=_e(async()=>{const i=await ve(()=>import("./WhereClause-XAMIZ4-B.js").then(o=>o.W),__vite__mapDeps([0,1,2,3]));return this._whereModule=i.WhereClause,this._whereModule});return this._loadWhereModuleTask=r,this._updatingHandles.addPromise(r.promise),[]}if(!n)return[];try{return n.create(e,t).fieldNames}catch{return[]}}};s([a({constructOnly:!0})],p.prototype,"spatialReference",void 0),s([a({constructOnly:!0})],p.prototype,"layerSource",void 0),s([a({constructOnly:!0})],p.prototype,"view",void 0),s([a()],p.prototype,"_tilesOfInterest",void 0),s([a({readOnly:!0})],p.prototype,"_updateTilesParameters",null),s([a()],p.prototype,"_layerView",null),s([a()],p.prototype,"_isSuspended",null),s([a({readOnly:!0})],p.prototype,"updating",null),s([a()],p.prototype,"_outFields",null),s([a({readOnly:!0})],p.prototype,"configuration",null),s([a({readOnly:!0})],p.prototype,"availability",null),s([a()],p.prototype,"_loadWhereModuleTask",void 0),s([a()],p.prototype,"_whereModule",void 0),p=s([I("esri.views.interactive.snapping.featureSources.FeatureServiceSnappingSource")],p);export{p as FeatureServiceSnappingSource}; +${i}`},r=new Map;return this._debugInfo.storedTiles.forEach(i=>{r.set(i.data.id,i.data)}),this._debugInfo.pendingTiles.forEach(i=>{r.set(i.data.id,i.data)}),Array.from(r.values()).map(i=>({lij:[i.level,i.row,i.col],geometry:X.fromExtent(Y(i.extent,this.view.spatialReference)),label:n(i.id)}))}_fetchDebugInfo(){this.handle.getDebugInfo(null).then(e=>{this._debugInfo=e,this.update()})}};s([a({constructOnly:!0})],k.prototype,"handle",void 0),k=s([I("esri.views.interactive.snapping.featureSources.WorkerTileTreeDebugger")],k);let c=class extends O{get updating(){return this._updatingHandles.updating||this._workerHandleUpdating}constructor(e){super(e),this._updatingHandles=new j,this._suspendController=null,this.schedule=null,this.hasZ=!1,this.elevationAlignPointsInFeatures=async t=>{const n=[];for(const{points:r}of t.pointsInFeatures)for(const{z:i}of r)n.push(i);return{elevations:n,drapedObjectIds:new Set,failedObjectIds:new Set}},this.queryForSymbologySnapping=async()=>({candidates:[],sourceCandidateIndices:[]}),this.availability=0,this._workerHandleUpdating=!0,this._editId=0,this.updateOutFields=ee(async(t,n)=>{await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("updateOutFields",[...t],n)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},n))})}destroy(){this._suspendController=te(this._suspendController),this._workerHandle.destroy(),this._updatingHandles.destroy()}initialize(){this._workerHandle=new Oe(this.schedule,{alignElevation:async(e,{signal:t})=>({result:await this.elevationAlignPointsInFeatures(e.query,t)}),getSymbologyCandidates:async(e,{signal:t})=>({result:await this.queryForSymbologySnapping(e,t)})}),this.addHandles([this._workerHandle.on("notify-updating",({updating:e})=>this._workerHandleUpdating=e),this._workerHandle.on("notify-availability",({availability:e})=>this._set("availability",e))])}async setup(e,t){var i;const n=this._serviceInfoFromLayer(e.layer);if(n==null)return;const r={configuration:this._convertConfiguration(e.configuration),serviceInfo:n,spatialReference:e.spatialReference.toJSON(),hasZ:this.hasZ,elevationInfo:(i=e.layer.elevationInfo)==null?void 0:i.toJSON()};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("setup",r,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}async configure(e,t){const n=this._convertConfiguration(e);await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("configure",n,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}async refresh(e){await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("refresh",{},e)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},e))}async fetchCandidates(e,t){const{point:n,filter:r,coordinateHelper:i}=e,o={...e,point:ie(n[0],n[1],n[2],i.spatialReference.toJSON()),filter:r==null?void 0:r.toJSON()};return this._workerHandle.invoke(o,t)}async updateTiles(e,t){const n={tiles:e.tiles,tileInfo:e.tileInfo!=null?e.tileInfo.toJSON():null,tileSize:e.tileSize};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("updateTiles",n,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}async applyEdits(e,t){var l,v,d;const n=this._editId++,r={id:n};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("beginApplyEdits",r,t));const i=await this._updatingHandles.addPromise(ne(e.result,t)),o={id:n,edits:{addedFeatures:((l=i.addedFeatures)==null?void 0:l.map(({objectId:u})=>u).filter(N))??[],deletedFeatures:((v=i.deletedFeatures)==null?void 0:v.map(({objectId:u,globalId:S})=>({objectId:u,globalId:S})))??[],updatedFeatures:((d=i.updatedFeatures)==null?void 0:d.map(({objectId:u})=>u).filter(N))??[]}};await this._updatingHandles.addPromise(this._workerHandle.invokeMethod("endApplyEdits",o,t)),this._updatingHandles.addPromise(this._workerHandle.invokeMethod("whenNotUpdating",{},t))}getDebugInfo(e){return this._workerHandle.invokeMethod("getDebugInfo",{},e)}async notifyElevationSourceChange(){await this._workerHandle.invokeMethod("notifyElevationSourceChange",{})}async notifySymbologyChange(){await this._workerHandle.invokeMethod("notifySymbologyChange",{})}async setSymbologySnappingSupported(e){await this._workerHandle.invokeMethod("setSymbologySnappingSupported",e)}async setSuspended(e){var t;(t=this._suspendController)==null||t.abort(),this._suspendController=new AbortController,await this._workerHandle.invokeMethod("setSuspended",e,this._suspendController.signal)}_convertConfiguration(e){return{filter:e.filter!=null?e.filter.toJSON():null,customParameters:e.customParameters,viewType:e.viewType}}_serviceInfoFromLayer(e){var t,n;return e.geometryType==="multipatch"||e.geometryType==="mesh"?null:{url:((t=e.parsedUrl)==null?void 0:t.path)??"",fieldsIndex:e.fieldsIndex.toJSON(),geometryType:se.toJSON(e.geometryType),capabilities:e.capabilities,objectIdField:e.objectIdField,globalIdField:e.globalIdField,spatialReference:e.spatialReference.toJSON(),timeInfo:(n=e.timeInfo)==null?void 0:n.toJSON()}}};s([a({constructOnly:!0})],c.prototype,"schedule",void 0),s([a({constructOnly:!0})],c.prototype,"hasZ",void 0),s([a({constructOnly:!0})],c.prototype,"elevationAlignPointsInFeatures",void 0),s([a({constructOnly:!0})],c.prototype,"queryForSymbologySnapping",void 0),s([a({readOnly:!0})],c.prototype,"updating",null),s([a({readOnly:!0})],c.prototype,"availability",void 0),s([a()],c.prototype,"_workerHandleUpdating",void 0),c=s([I("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorkerHandle")],c);class Oe extends re{constructor(t,n){super("FeatureServiceSnappingSourceWorker","fetchCandidates",{},t,{strategy:"dedicated",client:n})}}let w=class extends O{get tiles(){return[new F("0/0/0",0,0,0,ae(-1e8,-1e8,1e8,1e8))]}get tileInfo(){return new oe({origin:new le({x:-1e8,y:1e8,spatialReference:this.layer.spatialReference}),size:[512,512],lods:[new de({level:0,scale:1,resolution:390625})],spatialReference:this.layer.spatialReference})}get tileSize(){return this.tileInfo.size[0]}constructor(e){super(e),this.pointOfInterest=null}};s([a({readOnly:!0})],w.prototype,"tiles",null),s([a({readOnly:!0})],w.prototype,"tileInfo",null),s([a({readOnly:!0})],w.prototype,"tileSize",null),s([a({constructOnly:!0})],w.prototype,"layer",void 0),s([a()],w.prototype,"pointOfInterest",void 0),w=s([I("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTilesSimple")],w);let p=class extends O{get _updateTilesParameters(){return{tiles:this._tilesOfInterest.tiles,tileInfo:this._tilesOfInterest.tileInfo,tileSize:this._tilesOfInterest.tileSize}}get _layerView(){var e;return(e=this.view)==null?void 0:e.allLayerViews.find(t=>t.layer===this._layer)}get _isSuspended(){var e;return ue(this._layer)&&!this._layer.sublayers.find(t=>t.visible)?!0:!!this.view&&(((e=this._layerView)==null?void 0:e.suspended)!==!1||!this.layerSource.enabled)}get updating(){var e;return((e=this._workerHandle)==null?void 0:e.updating)||this._updatingHandles.updating}get _outFields(){var S,T,C,$,P,E,M,z;const{view:e,_layerView:t,layerSource:n}=this,{layer:r}=n,{fieldsIndex:i,timeInfo:o,floorInfo:l,subtypeField:v}=r,d=t&&"filter"in t?t.filter:null,u=d!=null&&d.where&&d.where!=="1=1"?this._getOrLoadWhereFields(d.where,i):[];if(d!=null&&d.timeExtent&&o){const{startField:h,endField:b}=o,x=((S=i.get(h))==null?void 0:S.name)??h,R=((T=i.get(b))==null?void 0:T.name)??b;x&&u.push(x),R&&u.push(R)}if(e!=null&&e.map&&pe(e.map)&&((C=e.map.utilityNetworks)!=null&&C.find(h=>h.isUtilityLayer(r)))){const h=($=r.fieldsIndex.get("assetGroup"))==null?void 0:$.name,b=(P=r.fieldsIndex.get("assetType"))==null?void 0:P.name;h&&b&&(u.push(h),u.push(b))}if(r&&(l!=null&&l.floorField)&&((E=e==null?void 0:e.floors)!=null&&E.length)){const h=((M=i.get(l.floorField))==null?void 0:M.name)??l.floorField;h&&u.push(h)}if(v){const h=((z=i.get(v))==null?void 0:z.name)??v;h&&u.push(h)}return new Set(u)}get configuration(){const{view:e}=this,t=e!=null?e.type:"2d";return{filter:this._layer.createQuery(),customParameters:this._layer.customParameters,viewType:t}}get availability(){var e;return((e=this._workerHandle)==null?void 0:e.availability)??0}get _layer(){return this.layerSource.layer}constructor(e){super(e),this._updatingHandles=new j,this._workerHandle=null,this._debug=null,this._memoizedMakeGetGroundElevation=he(we)}initialize(){let e;const t=this.view;if(t!=null)switch(t.type){case"2d":this._tilesOfInterest=new y({view:t,layer:this._layer}),e=this._workerHandle=new c;break;case"3d":{const{resourceController:n}=t,r=this._layer;this._tilesOfInterest=new g({view:t}),e=this._workerHandle=new c({schedule:i=>n.immediate.schedule(i),hasZ:this._layer.hasZ&&(this._layer.returnZ??!0),elevationAlignPointsInFeatures:async(i,o)=>{const l=await t.whenLayerView(r);return V(o),l.elevationAlignPointsInFeatures(i,o)},queryForSymbologySnapping:async(i,o)=>{const l=await t.whenLayerView(r);return V(o),l.queryForSymbologySnapping(i,o)}}),this.addHandles([t.elevationProvider.on("elevation-change",({context:i})=>{const{elevationInfo:o}=r;ce(i,o)&&f(e.notifyElevationSourceChange())}),_(()=>r.elevationInfo,()=>f(e.notifyElevationSourceChange()),m),_(()=>{var i,o;return(o=(i=this._layerView)==null?void 0:i.processor)==null?void 0:o.renderer},()=>f(e.notifySymbologyChange()),m),_(()=>{var i;return((i=this._layerView)==null?void 0:i.symbologySnappingSupported)??!1},i=>f(e.setSymbologySnappingSupported(i)),m),ye(()=>{var i;return(i=this._layerView)==null?void 0:i.layer},["edits","apply-edits","graphic-update"],()=>e.notifySymbologyChange())]);break}}else this._tilesOfInterest=new w({layer:this._layer}),e=this._workerHandle=new c;this.addHandles([A(e)]),f(e.setup({layer:this._layer,spatialReference:this.spatialReference,configuration:this.configuration},null)),this._updatingHandles.add(()=>this._updateTilesParameters,()=>f(e.updateTiles(this._updateTilesParameters,null)),m),this.addHandles([_(()=>this.configuration,n=>f(e.configure(n,null)),W),_(()=>this._outFields,n=>f(e.updateOutFields(n)),m),_(()=>this._isSuspended,n=>f(e.setSuspended(n)),fe)]),t!=null&&this.addHandles(_(()=>ge.FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES,n=>{n&&!this._debug?(this._debug=new k({view:t,handle:e}),this.addHandles(A(this._debug),"debug")):!n&&this._debug&&this.removeHandles("debug")},m)),this.addHandles(this.layerSource.layer.on("apply-edits",n=>{f(e.applyEdits(n,null))}))}destroy(){this._updatingHandles.destroy()}refresh(){var e;(e=this._workerHandle)==null||e.refresh(null)}async fetchCandidates(e,t){const{coordinateHelper:n,point:r}=e;this._tilesOfInterest.pointOfInterest=n.arrayToPoint(r);const i=this._memoizedMakeGetGroundElevation(this.view,n.spatialReference);return(await this._workerHandle.fetchCandidates({...e},t)).candidates.map(o=>Se(o,i))}getDebugInfo(e){return this._workerHandle.getDebugInfo(e)}_getOrLoadWhereFields(e,t){const{_whereModule:n}=this;if(!this._loadWhereModuleTask&&!n){const r=_e(async()=>{const i=await ve(()=>import("./WhereClause-FOYoIAAW.js").then(o=>o.W),__vite__mapDeps([0,1,2,3]));return this._whereModule=i.WhereClause,this._whereModule});return this._loadWhereModuleTask=r,this._updatingHandles.addPromise(r.promise),[]}if(!n)return[];try{return n.create(e,t).fieldNames}catch{return[]}}};s([a({constructOnly:!0})],p.prototype,"spatialReference",void 0),s([a({constructOnly:!0})],p.prototype,"layerSource",void 0),s([a({constructOnly:!0})],p.prototype,"view",void 0),s([a()],p.prototype,"_tilesOfInterest",void 0),s([a({readOnly:!0})],p.prototype,"_updateTilesParameters",null),s([a()],p.prototype,"_layerView",null),s([a()],p.prototype,"_isSuspended",null),s([a({readOnly:!0})],p.prototype,"updating",null),s([a()],p.prototype,"_outFields",null),s([a({readOnly:!0})],p.prototype,"configuration",null),s([a({readOnly:!0})],p.prototype,"availability",null),s([a()],p.prototype,"_loadWhereModuleTask",void 0),s([a()],p.prototype,"_whereModule",void 0),p=s([I("esri.views.interactive.snapping.featureSources.FeatureServiceSnappingSource")],p);export{p as FeatureServiceSnappingSource}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/WhereClause-XAMIZ4-B.js","assets/TimeOnly-ljWtUK7N.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css"] + __vite__mapDeps.viteFileDeps = ["assets/WhereClause-FOYoIAAW.js","assets/TimeOnly-gkehHHJx.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/FeatureServiceSnappingSourceWorker-GdDLcUBl.js b/dist/assets/FeatureServiceSnappingSourceWorker-GdDLcUBl.js new file mode 100644 index 0000000..290c81d --- /dev/null +++ b/dist/assets/FeatureServiceSnappingSourceWorker-GdDLcUBl.js @@ -0,0 +1 @@ +import{e as l,y as u,c as v,g as x,cf as L,N as w,o2 as P,jb as R,jS as H,ot as D,ou as Z,ov as I,h as O,fj as Q,a9 as J,v as K,dv as X,aL as T,i$ as Y,dO as tt,dL as et,R as st,a0 as it,j5 as rt,ow as nt,ox as at,nU as ot,oy as lt,oz as ut,ex as ht,oA as dt,oB as N,ec as ct,iP as pt,eW as S,oC as _t,oD as $,oE as V,ii as ft,z as gt,ag as U,ab as f,d2 as E,hA as yt,B as M,aa as mt,fZ as Ft}from"./index-pCX-0tJH.js";import{m as Et}from"./FeatureStore-PXMUgn0j.js";import{W as Tt}from"./QueryEngine-uvDs-vBe.js";import{i as j,r as z,n as B}from"./symbologySnappingCandidates-d1xE3f-Q.js";import{o as Ct}from"./BoundsStore-_-dPK5c-.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";let C=class extends x{constructor(){super(...arguments),this.updating=!1,this._pending=[]}push(t,s){this._pending.push({promise:t,callback:s}),this._pending.length===1&&this._process()}_process(){if(!this._pending.length)return void(this.updating=!1);this.updating=!0;const t=this._pending[0];t.promise.then(s=>t.callback(s)).catch(()=>{}).then(()=>{this._pending.shift(),this._process()})}};l([u()],C.prototype,"updating",void 0),C=l([v("esri.core.AsyncSequence")],C);class St{constructor(t,s){this.data=t,this.resolution=s,this.state={type:a.CREATED},this.alive=!0}process(t){switch(this.state.type){case a.CREATED:return this.state=this._gotoFetchCount(this.state,t),this.state.task.promise.then(t.resume,t.resume);case a.FETCH_COUNT:break;case a.FETCHED_COUNT:return this.state=this._gotoFetchFeatures(this.state,t),this.state.task.promise.then(t.resume,t.resume);case a.FETCH_FEATURES:break;case a.FETCHED_FEATURES:this.state=this._goToDone(this.state,t);case a.DONE:}return null}get debugInfo(){return{data:this.data,featureCount:this._featureCount,state:this._stateToString}}get _featureCount(){switch(this.state.type){case a.CREATED:case a.FETCH_COUNT:return 0;case a.FETCHED_COUNT:return this.state.featureCount;case a.FETCH_FEATURES:return this.state.previous.featureCount;case a.FETCHED_FEATURES:return this.state.features.length;case a.DONE:return this.state.previous.features.length}}get _stateToString(){switch(this.state.type){case a.CREATED:return"created";case a.FETCH_COUNT:return"fetch-count";case a.FETCHED_COUNT:return"fetched-count";case a.FETCH_FEATURES:return"fetch-features";case a.FETCHED_FEATURES:return"fetched-features";case a.DONE:return"done"}}_gotoFetchCount(t,s){return{type:a.FETCH_COUNT,previous:t,task:w(async i=>{const r=await P(s.fetchCount(this,i));this.state.type===a.FETCH_COUNT&&(this.state=this._gotoFetchedCount(this.state,r.ok?r.value:1/0))})}}_gotoFetchedCount(t,s){return{type:a.FETCHED_COUNT,featureCount:s,previous:t}}_gotoFetchFeatures(t,s){return{type:a.FETCH_FEATURES,previous:t,task:w(async i=>{const r=await P(s.fetchFeatures(this,t.featureCount,i));this.state.type===a.FETCH_FEATURES&&(this.state=this._gotoFetchedFeatures(this.state,r.ok?r.value:[]))})}}_gotoFetchedFeatures(t,s){return{type:a.FETCHED_FEATURES,previous:t,features:s}}_goToDone(t,s){return s.finish(this,t.features),{type:a.DONE,previous:t}}reset(){const t=this.state;switch(this.state={type:a.CREATED},t.type){case a.CREATED:case a.FETCHED_COUNT:case a.FETCHED_FEATURES:case a.DONE:break;case a.FETCH_COUNT:case a.FETCH_FEATURES:t.task.abort()}}intersects(t){return t==null||!this.data.extent||(R(t,q),H(this.data.extent,q))}}var a;(function(e){e[e.CREATED=0]="CREATED",e[e.FETCH_COUNT=1]="FETCH_COUNT",e[e.FETCHED_COUNT=2]="FETCHED_COUNT",e[e.FETCH_FEATURES=3]="FETCH_FEATURES",e[e.FETCHED_FEATURES=4]="FETCHED_FEATURES",e[e.DONE=5]="DONE"})(a||(a={}));const q=L();let d=class extends x{get _minimumVerticesPerFeature(){var t;switch((t=this.store)==null?void 0:t.featureStore.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":return 1;case"esriGeometryPolygon":return 4;case"esriGeometryPolyline":return 2}}get _mandatoryOutFields(){const t=new Set;return this.objectIdField&&t.add(this.objectIdField),this.globalIdField&&t.add(this.globalIdField),t}set outFields(t){const s=this._get("outFields"),i=D(t,this._mandatoryOutFields);Z(i,s)||(this._set("outFields",i),I(i,s)||this.refresh())}get outFields(){return this._get("outFields")??this._mandatoryOutFields}set filter(t){const s=this._get("filter"),i=this._filterProperties(t);JSON.stringify(s)!==JSON.stringify(i)&&this._set("filter",i)}set customParameters(t){const s=this._get("customParameters");JSON.stringify(s)!==JSON.stringify(t)&&this._set("customParameters",t)}get _configuration(){return{filter:this.filter,customParameters:this.customParameters,tileInfo:this.tileInfo,tileSize:this.tileSize}}set tileInfo(t){const s=this._get("tileInfo");s!==t&&(t!=null&&s!=null&&JSON.stringify(t)===JSON.stringify(s)||(this._set("tileInfo",t),this.store.tileInfo=t))}set tileSize(t){this._get("tileSize")!==t&&this._set("tileSize",t)}get updating(){return this.updatingExcludingEdits||this._pendingEdits.updating}get updatingExcludingEdits(){return this._updatingHandles.updating}get hasZ(){return this.store.featureStore.hasZ}constructor(t){super(t),this.suspended=!0,this.tilesOfInterest=[],this.availability=0,this._pendingTiles=new Map,this._updatingHandles=new O,this._pendingEdits=new C,this._pendingEditsAbortController=new AbortController}initialize(){this._initializeFetchExtent(),this._updatingHandles.add(()=>this._configuration,()=>this.refresh()),this._updatingHandles.add(()=>this.tilesOfInterest,(t,s)=>{Q(t,s,({id:i},{id:r})=>i===r)||this._process()},J),this.addHandles(K(()=>!this.suspended,()=>this._process()))}destroy(){this._pendingTiles.forEach(t=>this._deletePendingTile(t)),this._pendingTiles.clear(),this.store.destroy(),this.tilesOfInterest.length=0,this._pendingEditsAbortController.abort(),this._pendingEditsAbortController=null,this._updatingHandles.destroy()}refresh(){this.store.refresh(),this._pendingTiles.forEach(t=>this._deletePendingTile(t)),this._process()}applyEdits(t){this._pendingEdits.push(t,async s=>{if(s.addedFeatures.length===0&&s.updatedFeatures.length===0&&s.deletedFeatures.length===0)return;for(const[,r]of this._pendingTiles)r.reset();const i={...s,deletedFeatures:s.deletedFeatures.map(({objectId:r,globalId:n})=>r&&r!==-1?r:this._lookupObjectIdByGlobalId(n))};await this._updatingHandles.addPromise(this.store.processEdits(i,(r,n)=>this._queryFeaturesById(r,n),this._pendingEditsAbortController.signal)),this._processPendingTiles()})}_initializeFetchExtent(){if(!this.capabilities.query.supportsExtent||!X(this.url))return;const t=w(async s=>{var i;try{const r=await Y(this.url,new T({where:"1=1",outSpatialReference:this.spatialReference,cacheHint:this.capabilities.query.supportsCacheHint??void 0}),{query:this._configuration.customParameters,signal:s});this.store.extent=tt.fromJSON((i=r.data)==null?void 0:i.extent)}catch(r){et(r),st.getLogger(this).warn("Failed to fetch data extent",r)}});this._updatingHandles.addPromise(t.promise.then(()=>this._process())),this.addHandles(it(()=>t.abort()))}get debugInfo(){return{numberOfFeatures:this.store.featureStore.numFeatures,tilesOfInterest:this.tilesOfInterest,pendingTiles:Array.from(this._pendingTiles.values()).map(t=>t.debugInfo),storedTiles:this.store.debugInfo}}_process(){this._markTilesNotAlive(),this._createPendingTiles(),this._deletePendingTiles(),this._processPendingTiles()}_markTilesNotAlive(){for(const[,t]of this._pendingTiles)t.alive=!1}_createPendingTiles(){if(this.suspended)return;const t=this._collectMissingTilesInfo();if(this._setAvailability(t==null?1:t.coveredArea/t.fullArea),t!=null)for(const{data:s,resolution:i}of t.missingTiles){const r=this._pendingTiles.get(s.id);r?(r.resolution=i,r.alive=!0):this._createPendingTile(s,i)}}_collectMissingTilesInfo(){let t=null;for(let s=this.tilesOfInterest.length-1;s>=0;s--){const i=this.tilesOfInterest[s],r=this.store.process(i,(n,o)=>this._verifyTileComplexity(n,o),this.outFields);t==null?t=r:t.prepend(r)}return t}_deletePendingTiles(){for(const[,t]of this._pendingTiles)t.alive||this._deletePendingTile(t)}_processPendingTiles(){const t={fetchCount:(s,i)=>this._fetchCount(s,i),fetchFeatures:(s,i,r)=>this._fetchFeatures(s,i,r),finish:(s,i)=>this._finishPendingTile(s,i),resume:()=>this._processPendingTiles()};if(this._ensureFetchAllCounts(t))for(const[,s]of this._pendingTiles)this._verifyTileComplexity(this.store.getFeatureCount(s.data),s.resolution)&&this._updatingHandles.addPromise(s.process(t))}_verifyTileComplexity(t,s){return this._verifyVertexComplexity(t)&&this._verifyFeatureDensity(t,s)}_verifyVertexComplexity(t){return t*this._minimumVerticesPerFeature{t===n.attributes[s]&&(r=n.objectId??n.attributes[i])}),r==null)throw new Error(`Expected to find a feature with globalId ${t}`);return r}_queryFeaturesById(t,s){const i=this._createFeaturesQuery();return i.objectIds=t,this._queryFeatures(i,s)}_queryFeatures(t,s){return this.capabilities.query.supportsFormatPBF?this._queryFeaturesPBF(t,s):this._queryFeaturesJSON(t,s)}async _queryFeaturesPBF(t,s){const{sourceSpatialReference:i}=this,{data:r}=await rt(this.url,t,new nt({sourceSpatialReference:i}),{query:this._configuration.customParameters,timeout:b,signal:s});return at(r)}async _queryFeaturesJSON(t,s){const{sourceSpatialReference:i}=this,{data:r}=await ot(this.url,t,i,{query:this._configuration.customParameters,timeout:b,signal:s});return lt(r,this.objectIdField)}_createCountQuery(t){const s=this._createBaseQuery(t);return this.capabilities.query.supportsCacheHint&&(s.cacheHint=!0),s}_createFeaturesQuery(t=null){var n;const s=this._createBaseQuery(t),i=(t==null?void 0:t.data)!=null?this.store.getAttributesForTile((n=t==null?void 0:t.data)==null?void 0:n.id):null,r=D(ut(this.outFields,i??new Set),this._mandatoryOutFields);return s.outFields=Array.from(r),s.returnGeometry=!0,t!=null&&(this.capabilities.query.supportsResultType?s.resultType="tile":this.capabilities.query.supportsCacheHint&&(s.cacheHint=!0)),s}_createBaseQuery(t){const s=new T({returnZ:this.hasZ,returnM:!1,geometry:this.tileInfo!=null&&t!=null?ht(t.data.extent,this.tileInfo.spatialReference):void 0}),i=this._configuration.filter;return i!=null&&(s.where=i.where,s.gdbVersion=i.gdbVersion,s.timeExtent=i.timeExtent),s.outSpatialReference=this.spatialReference,s}_setPagingParameters(t,s,i){if(!this.capabilities.query.supportsPagination)return!1;const{supportsMaxRecordCountFactor:r,supportsCacheHint:n,tileMaxRecordCount:o,maxRecordCount:h,supportsResultType:c}=this.capabilities.query,p=r?T.MAX_MAX_RECORD_COUNT_FACTOR:1,_=p*((c||n)&&o?o:h||vt);return t.start=s,r?(t.maxRecordCountFactor=Math.min(p,Math.ceil(i/_)),t.num=Math.min(i,t.maxRecordCountFactor*_)):t.num=Math.min(i,_),!0}};l([u({constructOnly:!0})],d.prototype,"url",void 0),l([u({constructOnly:!0})],d.prototype,"objectIdField",void 0),l([u({constructOnly:!0})],d.prototype,"globalIdField",void 0),l([u({constructOnly:!0})],d.prototype,"capabilities",void 0),l([u({constructOnly:!0})],d.prototype,"sourceSpatialReference",void 0),l([u({constructOnly:!0})],d.prototype,"spatialReference",void 0),l([u({constructOnly:!0})],d.prototype,"store",void 0),l([u({readOnly:!0})],d.prototype,"_minimumVerticesPerFeature",null),l([u()],d.prototype,"_mandatoryOutFields",null),l([u()],d.prototype,"outFields",null),l([u()],d.prototype,"suspended",void 0),l([u()],d.prototype,"filter",null),l([u()],d.prototype,"customParameters",null),l([u({readOnly:!0})],d.prototype,"_configuration",null),l([u()],d.prototype,"tileInfo",null),l([u()],d.prototype,"tileSize",null),l([u()],d.prototype,"tilesOfInterest",void 0),l([u({readOnly:!0})],d.prototype,"updating",null),l([u({readOnly:!0})],d.prototype,"updatingExcludingEdits",null),l([u({readOnly:!0})],d.prototype,"availability",void 0),l([u()],d.prototype,"hasZ",null),d=l([v("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiledFetcher")],d);const vt=2e3,b=6e5,bt=1e6,wt=25,It=1;class Ot{constructor(){this._store=new Map,this._byteSize=0}set(t,s){this.delete(t),this._store.set(t,s),this._byteSize+=s.byteSize}delete(t){const s=this._store.get(t);return!!this._store.delete(t)&&(s!=null&&(this._byteSize-=s.byteSize),!0)}get(t){return this._used(t),this._store.get(t)}has(t){return this._used(t),this._store.has(t)}clear(){this._store.clear()}applyByteSizeLimit(t,s){for(const[i,r]of this._store){if(this._byteSize<=t)break;this.delete(i),s(r)}}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}_used(t){const s=this._store.get(t);s&&(this._store.delete(t),this._store.set(t,s))}}let y=class extends x{constructor(e){super(e),this.tileInfo=null,this.extent=null,this.maximumByteSize=10*dt.MEGABYTES,this._tileBounds=new Ct,this._tiles=new Ot,this._refCounts=new Map,this._tileFeatureCounts=new Map,this._tmpBoundingRect=L()}add(e,t){var r;for(const n of t)this._referenceFeature(n.objectId);const s=this.featureStore.upsertMany(t),i=s.map(n=>new Set(Object.keys(n.attributes))).reduce((n,o)=>N(n,o),new Set(Object.keys(((r=s[0])==null?void 0:r.attributes)??[])));this._addTileStorage(e,new Set(s.map(n=>n.objectId)),At(s),i),this._tiles.applyByteSizeLimit(this.maximumByteSize,n=>this._removeTileStorage(n))}getAttributesForTile(e){var t;return e?(t=this._tiles.get(e))==null?void 0:t.attributeKeys:null}destroy(){this.clear(),this._tileFeatureCounts.clear()}clear(){this.featureStore.clear(),this._tileBounds.clear(),this._tiles.clear(),this._refCounts.clear()}refresh(){this.clear(),this._tileFeatureCounts.clear()}processEdits(e,t,s){return this._processEditsDelete(e.deletedFeatures.concat(e.updatedFeatures)),this._processEditsRefetch(e.addedFeatures.concat(e.updatedFeatures),t,s)}_addTileStorage(e,t,s,i){const r=e.id;this._tiles.set(r,new Ht(e,t,s,i)),this._tileBounds.set(r,e.extent),this._tileFeatureCounts.set(r,t.size)}_remove({id:e}){const t=this._tiles.get(e);t&&this._removeTileStorage(t)}_removeTileStorage(e){const t=[];for(const i of e.objectIds)this._unreferenceFeature(i)===m.REMOVED&&t.push(i);this.featureStore.removeManyById(t);const s=e.data.id;this._tiles.delete(s),this._tileBounds.delete(s)}_processEditsDelete(e){this.featureStore.removeManyById(e);for(const[,t]of this._tiles){for(const s of e)t.objectIds.delete(s);this._tileFeatureCounts.set(t.data.id,t.objectIds.size)}for(const t of e)this._refCounts.delete(t)}async _processEditsRefetch(e,t,s){const i=(await t(e,s)).features,{hasZ:r,hasM:n}=this.featureStore;for(const o of i){const h=ct(this._tmpBoundingRect,o.geometry,r,n);h!=null&&this._tileBounds.forEachInBounds(h,c=>{const p=this._tiles.get(c);this.featureStore.add(o);const _=o.objectId;p.objectIds.has(_)||(p.objectIds.add(_),this._referenceFeature(_),this._tileFeatureCounts.set(p.data.id,p.objectIds.size))})}}process(e,t=()=>!0,s){if(this.tileInfo==null||!e.extent||this.extent!=null&&!H(R(this.extent,this._tmpBoundingRect),e.extent))return new A(e);const i=this.getAttributesForTile(e.id);if(I(s,i))return new A(e);const r=this._createTileTree(e,this.tileInfo);return this._simplify(r,t,null,0,1),this._collectMissingTiles(e,r,this.tileInfo,s)}get debugInfo(){return Array.from(this._tiles.values()).map(({data:e})=>({data:e,featureCount:this._tileFeatureCounts.get(e.id)||0}))}getFeatureCount(e){return this._tileFeatureCounts.get(e.id)??0}async fetchCount(e,t,s,i){const r=this._tileFeatureCounts.get(e.id);if(r!=null)return r;const n=await pt(t,s,i);return this._tileFeatureCounts.set(e.id,n.data.count),n.data.count}_createTileTree(e,t){const s=new k(e.level,e.row,e.col);return t.updateTileInfo(s,S.ExtrapolateOptions.POWER_OF_TWO),this._tileBounds.forEachInBounds(e.extent,i=>{var n;const r=(n=this._tiles.get(i))==null?void 0:n.data;r&&this._tilesAreRelated(e,r)&&this._populateChildren(s,r,t,this._tileFeatureCounts.get(r.id)||0)}),s}_tilesAreRelated(e,t){if(!e||!t)return!1;if(e.level===t.level)return e.row===t.row&&e.col===t.col;const s=e.level>r,o=t.col>>r,h=e.row<<1,c=o-(e.col<<1)+(n-h<<1),p=e.children[c];if(p!=null)this._populateChildren(p,t,s,i);else{const _=new k(e.level+1,n,o);s.updateTileInfo(_,S.ExtrapolateOptions.POWER_OF_TWO),e.children[c]=_,this._populateChildren(_,t,s,i)}}_simplify(e,t,s,i,r){const n=r*r;if(e.isLeaf)return t(this.getFeatureCount(e),r)?0:(this._remove(e),s!=null&&(s.children[i]=null),n);const o=r/2,h=o*o;let c=0;for(let p=0;p{const n=this._tiles.get(r.id);if(n){s=s?N(s,n.attributeKeys):new Set(n.attributeKeys),i+=n.byteSize;for(const o of n.objectIds)t.has(o)||(t.add(o),this._referenceFeature(o));this._remove(r)}}),this._addTileStorage(e,t,i,s??new Set),e.isLeaf=!0,e.children[0]=e.children[1]=e.children[2]=e.children[3]=null,this._tileFeatureCounts.set(e.id,t.size)}_forEachLeaf(e,t){for(const s of e.children)s!=null&&(s.isLeaf?t(s):this._forEachLeaf(s,t))}_purge(e){if(e!=null)if(e.isLeaf)this._remove(e);else for(let t=0;t>1),(e.col<<1)+(1&h),o):this._collectMissingTilesRecurse(c,t,o,i)}}_referenceFeature(e){const t=(this._refCounts.get(e)||0)+1;return this._refCounts.set(e,t),t===1?m.ADDED:m.UNCHANGED}_unreferenceFeature(e){const t=(this._refCounts.get(e)||0)-1;return t===0?(this._refCounts.delete(e),m.REMOVED):(t>0&&this._refCounts.set(e,t),m.UNCHANGED)}get test(){return{tiles:Array.from(this._tiles.values()).map(e=>`${e.data.id}:[${Array.from(e.objectIds)}]`),featureReferences:Array.from(this._refCounts.keys()).map(e=>`${e}:${this._refCounts.get(e)}`)}}};function At(e){return e.reduce((t,s)=>t+xt(s),0)}function xt(e){return 32+Rt(e.geometry)+_t(e.attributes)}function Rt(e){if(e==null)return 0;const t=$(e.lengths,4);return 32+$(e.coords,8)+t}l([u({constructOnly:!0})],y.prototype,"featureStore",void 0),l([u()],y.prototype,"tileInfo",void 0),l([u()],y.prototype,"extent",void 0),l([u()],y.prototype,"maximumByteSize",void 0),y=l([v("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTileStore")],y);class Ht{constructor(t,s,i,r){this.data=t,this.objectIds=s,this.byteSize=i,this.attributeKeys=r}}let k=class{constructor(t,s,i){this.level=t,this.row=s,this.col=i,this.isLeaf=!1,this.extent=null,this.children=[null,null,null,null]}get hasChildren(){return!this.isLeaf&&(this.children[0]!=null||this.children[1]!=null||this.children[2]!=null||this.children[3]!=null)}};class A{constructor(t,s=[]){this.missingTiles=s,this.fullArea=0,this.coveredArea=0,this.fullArea=V(t.extent),this.coveredArea=this.fullArea}prepend(t){this.missingTiles=t.missingTiles.concat(this.missingTiles),this.coveredArea+=t.coveredArea,this.fullArea+=t.fullArea}}let Pt=class{constructor(t,s,i){this._tileInfo=t,this._extent=null,this.info=new A(s),i!=null&&(this._extent=R(i))}addMissing(t,s,i,r){const n=new ft(null,t,s,i);this._tileInfo.updateTileInfo(n,S.ExtrapolateOptions.POWER_OF_TWO),n.extent==null||this._extent!=null&&!H(this._extent,n.extent)||(this.info.missingTiles.push({data:n,resolution:r}),this.info.coveredArea-=V(n.extent))}};const Dt=.18751;var m;(function(e){e[e.ADDED=0]="ADDED",e[e.REMOVED=1]="REMOVED",e[e.UNCHANGED=2]="UNCHANGED"})(m||(m={}));let F=class extends gt.EventedAccessor{constructor(){super(...arguments),this._isInitializing=!0,this.remoteClient=null,this._whenSetup=U(),this._elevationAligner=j(),this._elevationFilter=z(),this._symbologyCandidatesFetcher=B(),this._updatingHandles=new O,this._editsUpdatingHandles=new O,this._pendingApplyEdits=new Map,this._alignPointsInFeatures=async(e,t)=>{const s={query:e},i=await this.remoteClient.invoke("alignElevation",s,{signal:t});return f(t),i},this._getSymbologyCandidates=async(e,t)=>{const s={candidates:e,spatialReference:this._spatialReference.toJSON()},i=await this.remoteClient.invoke("getSymbologyCandidates",s,{signal:t});return f(t),i}}get updating(){return this.updatingExcludingEdits||this._editsUpdatingHandles.updating||this._featureFetcher.updating}get updatingExcludingEdits(){return this._featureFetcher.updatingExcludingEdits||this._isInitializing||this._updatingHandles.updating}destroy(){var e,t,s;(e=this._featureFetcher)==null||e.destroy(),(t=this._queryEngine)==null||t.destroy(),(s=this._featureStore)==null||s.clear()}async setup(e){if(this.destroyed)return{result:{}};const{geometryType:t,objectIdField:s,timeInfo:i,fieldsIndex:r}=e.serviceInfo,{hasZ:n}=e,o=E.fromJSON(e.spatialReference);this._spatialReference=o,this._featureStore=new Et({...e.serviceInfo,hasZ:n,hasM:!1}),this._queryEngine=new Tt({spatialReference:e.spatialReference,featureStore:this._featureStore,geometryType:t,fieldsIndex:r,hasZ:n,hasM:!1,objectIdField:s,timeInfo:i}),this._featureFetcher=new d({store:new y({featureStore:this._featureStore}),url:e.serviceInfo.url,objectIdField:e.serviceInfo.objectIdField,globalIdField:e.serviceInfo.globalIdField,capabilities:e.serviceInfo.capabilities,spatialReference:o,sourceSpatialReference:E.fromJSON(e.serviceInfo.spatialReference)});const h=e.configuration.viewType==="3d";return this._elevationAligner=j(h,{elevationInfo:e.elevationInfo!=null?yt.fromJSON(e.elevationInfo):null,alignPointsInFeatures:this._alignPointsInFeatures}),this._elevationFilter=z(h),this.addHandles([M(()=>this._featureFetcher.availability,c=>this.emit("notify-availability",{availability:c}),J),M(()=>this.updating,()=>this._notifyUpdating())]),this._whenSetup.resolve(),this._isInitializing=!1,this.configure(e.configuration)}async configure(e){return await this._updatingHandles.addPromise(this._whenSetup.promise),this._updateFeatureFetcherConfiguration(e),g}async setSuspended(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),f(t),this._featureFetcher.suspended=e,g}async updateOutFields(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),f(t),this._featureFetcher.outFields=new Set(e??[]),g}async fetchCandidates(e,t){await this._whenSetup.promise,f(t);const s=Nt(e),i=t==null?void 0:t.signal,r=await this._queryEngine.executeQueryForSnapping(s,i);f(i);const n=await this._elevationAligner.alignCandidates(r.candidates,E.fromJSON(e.point.spatialReference)??E.WGS84,i);f(i);const o=await this._symbologyCandidatesFetcher.fetch(n,i);f(i);const h=o.length===0?n:n.concat(o);return{result:{candidates:this._elevationFilter.filter(s,h)}}}async updateTiles(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),f(t),this._featureFetcher.tileSize=e.tileSize,this._featureFetcher.tilesOfInterest=e.tiles,this._featureFetcher.tileInfo=e.tileInfo!=null?S.fromJSON(e.tileInfo):null,g}async refresh(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),f(t),this._featureFetcher.refresh(),g}async whenNotUpdating(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),f(t),await mt(()=>!this.updatingExcludingEdits,t),f(t),g}async getDebugInfo(e,t){return f(t),{result:this._featureFetcher.debugInfo}}async beginApplyEdits(e,t){this._updatingHandles.addPromise(this._whenSetup.promise),f(t);const s=U();return this._pendingApplyEdits.set(e.id,s),this._featureFetcher.applyEdits(s.promise),this._editsUpdatingHandles.addPromise(s.promise),g}async endApplyEdits(e,t){const s=this._pendingApplyEdits.get(e.id);return s&&s.resolve(e.edits),f(t),g}async notifyElevationSourceChange(e,t){return this._elevationAligner.notifyElevationSourceChange(),g}async notifySymbologyChange(e,t){return this._symbologyCandidatesFetcher.notifySymbologyChange(),g}async setSymbologySnappingSupported(e){return this._symbologyCandidatesFetcher=B(e,this._getSymbologyCandidates),g}_updateFeatureFetcherConfiguration(e){this._featureFetcher.filter=e.filter!=null?T.fromJSON(e.filter):null,this._featureFetcher.customParameters=e.customParameters}_notifyUpdating(){this.emit("notify-updating",{updating:this.updating})}};l([u({readOnly:!0})],F.prototype,"updating",null),l([u({readOnly:!0})],F.prototype,"updatingExcludingEdits",null),l([u()],F.prototype,"_isInitializing",void 0),F=l([v("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorker")],F);const te=F;function Nt(e){if(!e.filter)return{...e,query:{where:"1=1"}};const{distance:t,units:s,spatialRel:i,where:r,timeExtent:n,objectIds:o}=e.filter,h={geometry:e.filter.geometry?Ft(e.filter.geometry):void 0,distance:t,units:s,spatialRel:i,timeExtent:n,objectIds:o,where:r??"1=1"};return{...e,query:h}}const g={result:{}};export{te as default}; diff --git a/dist/assets/FeatureServiceSnappingSourceWorker-TBw9rhlL.js b/dist/assets/FeatureServiceSnappingSourceWorker-TBw9rhlL.js deleted file mode 100644 index d21eb2d..0000000 --- a/dist/assets/FeatureServiceSnappingSourceWorker-TBw9rhlL.js +++ /dev/null @@ -1 +0,0 @@ -import{e as l,y as u,c as v,p as x,ae as J,b as w,nS as P,j4 as R,jL as H,oh as D,oi as Z,oj as I,k as O,fo as W,C as L,F as K,dv as X,ca as T,dT as Y,dQ as tt,Z as et,a2 as st,ok as it,ol as rt,om as nt,eD as at,on as ot,oo as $,ej as lt,e$ as S,op as ut,oq as N,or as V,ig as ht,K as dt,bH as U,s as f,ar as E,hs as ct,d as M,w as pt,dy as _t}from"./index-J0iiHjMT.js";import{m as ft}from"./FeatureStore-X-AIJLo2.js";import{W as gt}from"./QueryEngine-8tLWlkSE.js";import{i as j,r as z,n as q}from"./symbologySnappingCandidates-Sz0MFOvR.js";import{a as yt}from"./pbfQueryUtils-pWizwTQZ.js";import{x as mt,f as Ft,c as Et,S as Tt}from"./query-rG0aX6cE.js";import{o as Ct}from"./BoundsStore-wmwfHjhp.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";let C=class extends x{constructor(){super(...arguments),this.updating=!1,this._pending=[]}push(t,s){this._pending.push({promise:t,callback:s}),this._pending.length===1&&this._process()}_process(){if(!this._pending.length)return void(this.updating=!1);this.updating=!0;const t=this._pending[0];t.promise.then(s=>t.callback(s)).catch(()=>{}).then(()=>{this._pending.shift(),this._process()})}};l([u()],C.prototype,"updating",void 0),C=l([v("esri.core.AsyncSequence")],C);class St{constructor(t,s){this.data=t,this.resolution=s,this.state={type:a.CREATED},this.alive=!0}process(t){switch(this.state.type){case a.CREATED:return this.state=this._gotoFetchCount(this.state,t),this.state.task.promise.then(t.resume,t.resume);case a.FETCH_COUNT:break;case a.FETCHED_COUNT:return this.state=this._gotoFetchFeatures(this.state,t),this.state.task.promise.then(t.resume,t.resume);case a.FETCH_FEATURES:break;case a.FETCHED_FEATURES:this.state=this._goToDone(this.state,t);case a.DONE:}return null}get debugInfo(){return{data:this.data,featureCount:this._featureCount,state:this._stateToString}}get _featureCount(){switch(this.state.type){case a.CREATED:case a.FETCH_COUNT:return 0;case a.FETCHED_COUNT:return this.state.featureCount;case a.FETCH_FEATURES:return this.state.previous.featureCount;case a.FETCHED_FEATURES:return this.state.features.length;case a.DONE:return this.state.previous.features.length}}get _stateToString(){switch(this.state.type){case a.CREATED:return"created";case a.FETCH_COUNT:return"fetch-count";case a.FETCHED_COUNT:return"fetched-count";case a.FETCH_FEATURES:return"fetch-features";case a.FETCHED_FEATURES:return"fetched-features";case a.DONE:return"done"}}_gotoFetchCount(t,s){return{type:a.FETCH_COUNT,previous:t,task:w(async i=>{const r=await P(s.fetchCount(this,i));this.state.type===a.FETCH_COUNT&&(this.state=this._gotoFetchedCount(this.state,r.ok?r.value:1/0))})}}_gotoFetchedCount(t,s){return{type:a.FETCHED_COUNT,featureCount:s,previous:t}}_gotoFetchFeatures(t,s){return{type:a.FETCH_FEATURES,previous:t,task:w(async i=>{const r=await P(s.fetchFeatures(this,t.featureCount,i));this.state.type===a.FETCH_FEATURES&&(this.state=this._gotoFetchedFeatures(this.state,r.ok?r.value:[]))})}}_gotoFetchedFeatures(t,s){return{type:a.FETCHED_FEATURES,previous:t,features:s}}_goToDone(t,s){return s.finish(this,t.features),{type:a.DONE,previous:t}}reset(){const t=this.state;switch(this.state={type:a.CREATED},t.type){case a.CREATED:case a.FETCHED_COUNT:case a.FETCHED_FEATURES:case a.DONE:break;case a.FETCH_COUNT:case a.FETCH_FEATURES:t.task.abort()}}intersects(t){return t==null||!this.data.extent||(R(t,B),H(this.data.extent,B))}}var a;(function(e){e[e.CREATED=0]="CREATED",e[e.FETCH_COUNT=1]="FETCH_COUNT",e[e.FETCHED_COUNT=2]="FETCHED_COUNT",e[e.FETCH_FEATURES=3]="FETCH_FEATURES",e[e.FETCHED_FEATURES=4]="FETCHED_FEATURES",e[e.DONE=5]="DONE"})(a||(a={}));const B=J();let d=class extends x{get _minimumVerticesPerFeature(){var t;switch((t=this.store)==null?void 0:t.featureStore.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":return 1;case"esriGeometryPolygon":return 4;case"esriGeometryPolyline":return 2}}get _mandatoryOutFields(){const t=new Set;return this.objectIdField&&t.add(this.objectIdField),this.globalIdField&&t.add(this.globalIdField),t}set outFields(t){const s=this._get("outFields"),i=D(t,this._mandatoryOutFields);Z(i,s)||(this._set("outFields",i),I(i,s)||this.refresh())}get outFields(){return this._get("outFields")??this._mandatoryOutFields}set filter(t){const s=this._get("filter"),i=this._filterProperties(t);JSON.stringify(s)!==JSON.stringify(i)&&this._set("filter",i)}set customParameters(t){const s=this._get("customParameters");JSON.stringify(s)!==JSON.stringify(t)&&this._set("customParameters",t)}get _configuration(){return{filter:this.filter,customParameters:this.customParameters,tileInfo:this.tileInfo,tileSize:this.tileSize}}set tileInfo(t){const s=this._get("tileInfo");s!==t&&(t!=null&&s!=null&&JSON.stringify(t)===JSON.stringify(s)||(this._set("tileInfo",t),this.store.tileInfo=t))}set tileSize(t){this._get("tileSize")!==t&&this._set("tileSize",t)}get updating(){return this.updatingExcludingEdits||this._pendingEdits.updating}get updatingExcludingEdits(){return this._updatingHandles.updating}get hasZ(){return this.store.featureStore.hasZ}constructor(t){super(t),this.suspended=!0,this.tilesOfInterest=[],this.availability=0,this._pendingTiles=new Map,this._updatingHandles=new O,this._pendingEdits=new C,this._pendingEditsAbortController=new AbortController}initialize(){this._initializeFetchExtent(),this._updatingHandles.add(()=>this._configuration,()=>this.refresh()),this._updatingHandles.add(()=>this.tilesOfInterest,(t,s)=>{W(t,s,({id:i},{id:r})=>i===r)||this._process()},L),this.addHandles(K(()=>!this.suspended,()=>this._process()))}destroy(){this._pendingTiles.forEach(t=>this._deletePendingTile(t)),this._pendingTiles.clear(),this.store.destroy(),this.tilesOfInterest.length=0,this._pendingEditsAbortController.abort(),this._pendingEditsAbortController=null,this._updatingHandles.destroy()}refresh(){this.store.refresh(),this._pendingTiles.forEach(t=>this._deletePendingTile(t)),this._process()}applyEdits(t){this._pendingEdits.push(t,async s=>{if(s.addedFeatures.length===0&&s.updatedFeatures.length===0&&s.deletedFeatures.length===0)return;for(const[,r]of this._pendingTiles)r.reset();const i={...s,deletedFeatures:s.deletedFeatures.map(({objectId:r,globalId:n})=>r&&r!==-1?r:this._lookupObjectIdByGlobalId(n))};await this._updatingHandles.addPromise(this.store.processEdits(i,(r,n)=>this._queryFeaturesById(r,n),this._pendingEditsAbortController.signal)),this._processPendingTiles()})}_initializeFetchExtent(){if(!this.capabilities.query.supportsExtent||!X(this.url))return;const t=w(async s=>{var i;try{const r=await mt(this.url,new T({where:"1=1",outSpatialReference:this.spatialReference,cacheHint:this.capabilities.query.supportsCacheHint??void 0}),{query:this._configuration.customParameters,signal:s});this.store.extent=Y.fromJSON((i=r.data)==null?void 0:i.extent)}catch(r){tt(r),et.getLogger(this).warn("Failed to fetch data extent",r)}});this._updatingHandles.addPromise(t.promise.then(()=>this._process())),this.addHandles(st(()=>t.abort()))}get debugInfo(){return{numberOfFeatures:this.store.featureStore.numFeatures,tilesOfInterest:this.tilesOfInterest,pendingTiles:Array.from(this._pendingTiles.values()).map(t=>t.debugInfo),storedTiles:this.store.debugInfo}}_process(){this._markTilesNotAlive(),this._createPendingTiles(),this._deletePendingTiles(),this._processPendingTiles()}_markTilesNotAlive(){for(const[,t]of this._pendingTiles)t.alive=!1}_createPendingTiles(){if(this.suspended)return;const t=this._collectMissingTilesInfo();if(this._setAvailability(t==null?1:t.coveredArea/t.fullArea),t!=null)for(const{data:s,resolution:i}of t.missingTiles){const r=this._pendingTiles.get(s.id);r?(r.resolution=i,r.alive=!0):this._createPendingTile(s,i)}}_collectMissingTilesInfo(){let t=null;for(let s=this.tilesOfInterest.length-1;s>=0;s--){const i=this.tilesOfInterest[s],r=this.store.process(i,(n,o)=>this._verifyTileComplexity(n,o),this.outFields);t==null?t=r:t.prepend(r)}return t}_deletePendingTiles(){for(const[,t]of this._pendingTiles)t.alive||this._deletePendingTile(t)}_processPendingTiles(){const t={fetchCount:(s,i)=>this._fetchCount(s,i),fetchFeatures:(s,i,r)=>this._fetchFeatures(s,i,r),finish:(s,i)=>this._finishPendingTile(s,i),resume:()=>this._processPendingTiles()};if(this._ensureFetchAllCounts(t))for(const[,s]of this._pendingTiles)this._verifyTileComplexity(this.store.getFeatureCount(s.data),s.resolution)&&this._updatingHandles.addPromise(s.process(t))}_verifyTileComplexity(t,s){return this._verifyVertexComplexity(t)&&this._verifyFeatureDensity(t,s)}_verifyVertexComplexity(t){return t*this._minimumVerticesPerFeature{t===n.attributes[s]&&(r=n.objectId??n.attributes[i])}),r==null)throw new Error(`Expected to find a feature with globalId ${t}`);return r}_queryFeaturesById(t,s){const i=this._createFeaturesQuery();return i.objectIds=t,this._queryFeatures(i,s)}_queryFeatures(t,s){return this.capabilities.query.supportsFormatPBF?this._queryFeaturesPBF(t,s):this._queryFeaturesJSON(t,s)}async _queryFeaturesPBF(t,s){const{sourceSpatialReference:i}=this,{data:r}=await Ft(this.url,t,new yt({sourceSpatialReference:i}),{query:this._configuration.customParameters,timeout:b,signal:s});return it(r)}async _queryFeaturesJSON(t,s){const{sourceSpatialReference:i}=this,{data:r}=await Et(this.url,t,i,{query:this._configuration.customParameters,timeout:b,signal:s});return rt(r,this.objectIdField)}_createCountQuery(t){const s=this._createBaseQuery(t);return this.capabilities.query.supportsCacheHint&&(s.cacheHint=!0),s}_createFeaturesQuery(t=null){var n;const s=this._createBaseQuery(t),i=(t==null?void 0:t.data)!=null?this.store.getAttributesForTile((n=t==null?void 0:t.data)==null?void 0:n.id):null,r=D(nt(this.outFields,i??new Set),this._mandatoryOutFields);return s.outFields=Array.from(r),s.returnGeometry=!0,t!=null&&(this.capabilities.query.supportsResultType?s.resultType="tile":this.capabilities.query.supportsCacheHint&&(s.cacheHint=!0)),s}_createBaseQuery(t){const s=new T({returnZ:this.hasZ,returnM:!1,geometry:this.tileInfo!=null&&t!=null?at(t.data.extent,this.tileInfo.spatialReference):void 0}),i=this._configuration.filter;return i!=null&&(s.where=i.where,s.gdbVersion=i.gdbVersion,s.timeExtent=i.timeExtent),s.outSpatialReference=this.spatialReference,s}_setPagingParameters(t,s,i){if(!this.capabilities.query.supportsPagination)return!1;const{supportsMaxRecordCountFactor:r,supportsCacheHint:n,tileMaxRecordCount:o,maxRecordCount:h,supportsResultType:c}=this.capabilities.query,p=r?T.MAX_MAX_RECORD_COUNT_FACTOR:1,_=p*((c||n)&&o?o:h||vt);return t.start=s,r?(t.maxRecordCountFactor=Math.min(p,Math.ceil(i/_)),t.num=Math.min(i,t.maxRecordCountFactor*_)):t.num=Math.min(i,_),!0}};l([u({constructOnly:!0})],d.prototype,"url",void 0),l([u({constructOnly:!0})],d.prototype,"objectIdField",void 0),l([u({constructOnly:!0})],d.prototype,"globalIdField",void 0),l([u({constructOnly:!0})],d.prototype,"capabilities",void 0),l([u({constructOnly:!0})],d.prototype,"sourceSpatialReference",void 0),l([u({constructOnly:!0})],d.prototype,"spatialReference",void 0),l([u({constructOnly:!0})],d.prototype,"store",void 0),l([u({readOnly:!0})],d.prototype,"_minimumVerticesPerFeature",null),l([u()],d.prototype,"_mandatoryOutFields",null),l([u()],d.prototype,"outFields",null),l([u()],d.prototype,"suspended",void 0),l([u()],d.prototype,"filter",null),l([u()],d.prototype,"customParameters",null),l([u({readOnly:!0})],d.prototype,"_configuration",null),l([u()],d.prototype,"tileInfo",null),l([u()],d.prototype,"tileSize",null),l([u()],d.prototype,"tilesOfInterest",void 0),l([u({readOnly:!0})],d.prototype,"updating",null),l([u({readOnly:!0})],d.prototype,"updatingExcludingEdits",null),l([u({readOnly:!0})],d.prototype,"availability",void 0),l([u()],d.prototype,"hasZ",null),d=l([v("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiledFetcher")],d);const vt=2e3,b=6e5,bt=1e6,wt=25,It=1;class Ot{constructor(){this._store=new Map,this._byteSize=0}set(t,s){this.delete(t),this._store.set(t,s),this._byteSize+=s.byteSize}delete(t){const s=this._store.get(t);return!!this._store.delete(t)&&(s!=null&&(this._byteSize-=s.byteSize),!0)}get(t){return this._used(t),this._store.get(t)}has(t){return this._used(t),this._store.has(t)}clear(){this._store.clear()}applyByteSizeLimit(t,s){for(const[i,r]of this._store){if(this._byteSize<=t)break;this.delete(i),s(r)}}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}_used(t){const s=this._store.get(t);s&&(this._store.delete(t),this._store.set(t,s))}}let y=class extends x{constructor(e){super(e),this.tileInfo=null,this.extent=null,this.maximumByteSize=10*ot.MEGABYTES,this._tileBounds=new Ct,this._tiles=new Ot,this._refCounts=new Map,this._tileFeatureCounts=new Map,this._tmpBoundingRect=J()}add(e,t){var r;for(const n of t)this._referenceFeature(n.objectId);const s=this.featureStore.upsertMany(t),i=s.map(n=>new Set(Object.keys(n.attributes))).reduce((n,o)=>$(n,o),new Set(Object.keys(((r=s[0])==null?void 0:r.attributes)??[])));this._addTileStorage(e,new Set(s.map(n=>n.objectId)),At(s),i),this._tiles.applyByteSizeLimit(this.maximumByteSize,n=>this._removeTileStorage(n))}getAttributesForTile(e){var t;return e?(t=this._tiles.get(e))==null?void 0:t.attributeKeys:null}destroy(){this.clear(),this._tileFeatureCounts.clear()}clear(){this.featureStore.clear(),this._tileBounds.clear(),this._tiles.clear(),this._refCounts.clear()}refresh(){this.clear(),this._tileFeatureCounts.clear()}processEdits(e,t,s){return this._processEditsDelete(e.deletedFeatures.concat(e.updatedFeatures)),this._processEditsRefetch(e.addedFeatures.concat(e.updatedFeatures),t,s)}_addTileStorage(e,t,s,i){const r=e.id;this._tiles.set(r,new Ht(e,t,s,i)),this._tileBounds.set(r,e.extent),this._tileFeatureCounts.set(r,t.size)}_remove({id:e}){const t=this._tiles.get(e);t&&this._removeTileStorage(t)}_removeTileStorage(e){const t=[];for(const i of e.objectIds)this._unreferenceFeature(i)===m.REMOVED&&t.push(i);this.featureStore.removeManyById(t);const s=e.data.id;this._tiles.delete(s),this._tileBounds.delete(s)}_processEditsDelete(e){this.featureStore.removeManyById(e);for(const[,t]of this._tiles){for(const s of e)t.objectIds.delete(s);this._tileFeatureCounts.set(t.data.id,t.objectIds.size)}for(const t of e)this._refCounts.delete(t)}async _processEditsRefetch(e,t,s){const i=(await t(e,s)).features,{hasZ:r,hasM:n}=this.featureStore;for(const o of i){const h=lt(this._tmpBoundingRect,o.geometry,r,n);h!=null&&this._tileBounds.forEachInBounds(h,c=>{const p=this._tiles.get(c);this.featureStore.add(o);const _=o.objectId;p.objectIds.has(_)||(p.objectIds.add(_),this._referenceFeature(_),this._tileFeatureCounts.set(p.data.id,p.objectIds.size))})}}process(e,t=()=>!0,s){if(this.tileInfo==null||!e.extent||this.extent!=null&&!H(R(this.extent,this._tmpBoundingRect),e.extent))return new A(e);const i=this.getAttributesForTile(e.id);if(I(s,i))return new A(e);const r=this._createTileTree(e,this.tileInfo);return this._simplify(r,t,null,0,1),this._collectMissingTiles(e,r,this.tileInfo,s)}get debugInfo(){return Array.from(this._tiles.values()).map(({data:e})=>({data:e,featureCount:this._tileFeatureCounts.get(e.id)||0}))}getFeatureCount(e){return this._tileFeatureCounts.get(e.id)??0}async fetchCount(e,t,s,i){const r=this._tileFeatureCounts.get(e.id);if(r!=null)return r;const n=await Tt(t,s,i);return this._tileFeatureCounts.set(e.id,n.data.count),n.data.count}_createTileTree(e,t){const s=new k(e.level,e.row,e.col);return t.updateTileInfo(s,S.ExtrapolateOptions.POWER_OF_TWO),this._tileBounds.forEachInBounds(e.extent,i=>{var n;const r=(n=this._tiles.get(i))==null?void 0:n.data;r&&this._tilesAreRelated(e,r)&&this._populateChildren(s,r,t,this._tileFeatureCounts.get(r.id)||0)}),s}_tilesAreRelated(e,t){if(!e||!t)return!1;if(e.level===t.level)return e.row===t.row&&e.col===t.col;const s=e.level>r,o=t.col>>r,h=e.row<<1,c=o-(e.col<<1)+(n-h<<1),p=e.children[c];if(p!=null)this._populateChildren(p,t,s,i);else{const _=new k(e.level+1,n,o);s.updateTileInfo(_,S.ExtrapolateOptions.POWER_OF_TWO),e.children[c]=_,this._populateChildren(_,t,s,i)}}_simplify(e,t,s,i,r){const n=r*r;if(e.isLeaf)return t(this.getFeatureCount(e),r)?0:(this._remove(e),s!=null&&(s.children[i]=null),n);const o=r/2,h=o*o;let c=0;for(let p=0;p{const n=this._tiles.get(r.id);if(n){s=s?$(s,n.attributeKeys):new Set(n.attributeKeys),i+=n.byteSize;for(const o of n.objectIds)t.has(o)||(t.add(o),this._referenceFeature(o));this._remove(r)}}),this._addTileStorage(e,t,i,s??new Set),e.isLeaf=!0,e.children[0]=e.children[1]=e.children[2]=e.children[3]=null,this._tileFeatureCounts.set(e.id,t.size)}_forEachLeaf(e,t){for(const s of e.children)s!=null&&(s.isLeaf?t(s):this._forEachLeaf(s,t))}_purge(e){if(e!=null)if(e.isLeaf)this._remove(e);else for(let t=0;t>1),(e.col<<1)+(1&h),o):this._collectMissingTilesRecurse(c,t,o,i)}}_referenceFeature(e){const t=(this._refCounts.get(e)||0)+1;return this._refCounts.set(e,t),t===1?m.ADDED:m.UNCHANGED}_unreferenceFeature(e){const t=(this._refCounts.get(e)||0)-1;return t===0?(this._refCounts.delete(e),m.REMOVED):(t>0&&this._refCounts.set(e,t),m.UNCHANGED)}get test(){return{tiles:Array.from(this._tiles.values()).map(e=>`${e.data.id}:[${Array.from(e.objectIds)}]`),featureReferences:Array.from(this._refCounts.keys()).map(e=>`${e}:${this._refCounts.get(e)}`)}}};function At(e){return e.reduce((t,s)=>t+xt(s),0)}function xt(e){return 32+Rt(e.geometry)+ut(e.attributes)}function Rt(e){if(e==null)return 0;const t=N(e.lengths,4);return 32+N(e.coords,8)+t}l([u({constructOnly:!0})],y.prototype,"featureStore",void 0),l([u()],y.prototype,"tileInfo",void 0),l([u()],y.prototype,"extent",void 0),l([u()],y.prototype,"maximumByteSize",void 0),y=l([v("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTileStore")],y);class Ht{constructor(t,s,i,r){this.data=t,this.objectIds=s,this.byteSize=i,this.attributeKeys=r}}let k=class{constructor(t,s,i){this.level=t,this.row=s,this.col=i,this.isLeaf=!1,this.extent=null,this.children=[null,null,null,null]}get hasChildren(){return!this.isLeaf&&(this.children[0]!=null||this.children[1]!=null||this.children[2]!=null||this.children[3]!=null)}};class A{constructor(t,s=[]){this.missingTiles=s,this.fullArea=0,this.coveredArea=0,this.fullArea=V(t.extent),this.coveredArea=this.fullArea}prepend(t){this.missingTiles=t.missingTiles.concat(this.missingTiles),this.coveredArea+=t.coveredArea,this.fullArea+=t.fullArea}}let Pt=class{constructor(t,s,i){this._tileInfo=t,this._extent=null,this.info=new A(s),i!=null&&(this._extent=R(i))}addMissing(t,s,i,r){const n=new ht(null,t,s,i);this._tileInfo.updateTileInfo(n,S.ExtrapolateOptions.POWER_OF_TWO),n.extent==null||this._extent!=null&&!H(this._extent,n.extent)||(this.info.missingTiles.push({data:n,resolution:r}),this.info.coveredArea-=V(n.extent))}};const Dt=.18751;var m;(function(e){e[e.ADDED=0]="ADDED",e[e.REMOVED=1]="REMOVED",e[e.UNCHANGED=2]="UNCHANGED"})(m||(m={}));let F=class extends dt.EventedAccessor{constructor(){super(...arguments),this._isInitializing=!0,this.remoteClient=null,this._whenSetup=U(),this._elevationAligner=j(),this._elevationFilter=z(),this._symbologyCandidatesFetcher=q(),this._updatingHandles=new O,this._editsUpdatingHandles=new O,this._pendingApplyEdits=new Map,this._alignPointsInFeatures=async(e,t)=>{const s={query:e},i=await this.remoteClient.invoke("alignElevation",s,{signal:t});return f(t),i},this._getSymbologyCandidates=async(e,t)=>{const s={candidates:e,spatialReference:this._spatialReference.toJSON()},i=await this.remoteClient.invoke("getSymbologyCandidates",s,{signal:t});return f(t),i}}get updating(){return this.updatingExcludingEdits||this._editsUpdatingHandles.updating||this._featureFetcher.updating}get updatingExcludingEdits(){return this._featureFetcher.updatingExcludingEdits||this._isInitializing||this._updatingHandles.updating}destroy(){var e,t,s;(e=this._featureFetcher)==null||e.destroy(),(t=this._queryEngine)==null||t.destroy(),(s=this._featureStore)==null||s.clear()}async setup(e){if(this.destroyed)return{result:{}};const{geometryType:t,objectIdField:s,timeInfo:i,fieldsIndex:r}=e.serviceInfo,{hasZ:n}=e,o=E.fromJSON(e.spatialReference);this._spatialReference=o,this._featureStore=new ft({...e.serviceInfo,hasZ:n,hasM:!1}),this._queryEngine=new gt({spatialReference:e.spatialReference,featureStore:this._featureStore,geometryType:t,fieldsIndex:r,hasZ:n,hasM:!1,objectIdField:s,timeInfo:i}),this._featureFetcher=new d({store:new y({featureStore:this._featureStore}),url:e.serviceInfo.url,objectIdField:e.serviceInfo.objectIdField,globalIdField:e.serviceInfo.globalIdField,capabilities:e.serviceInfo.capabilities,spatialReference:o,sourceSpatialReference:E.fromJSON(e.serviceInfo.spatialReference)});const h=e.configuration.viewType==="3d";return this._elevationAligner=j(h,{elevationInfo:e.elevationInfo!=null?ct.fromJSON(e.elevationInfo):null,alignPointsInFeatures:this._alignPointsInFeatures}),this._elevationFilter=z(h),this.addHandles([M(()=>this._featureFetcher.availability,c=>this.emit("notify-availability",{availability:c}),L),M(()=>this.updating,()=>this._notifyUpdating())]),this._whenSetup.resolve(),this._isInitializing=!1,this.configure(e.configuration)}async configure(e){return await this._updatingHandles.addPromise(this._whenSetup.promise),this._updateFeatureFetcherConfiguration(e),g}async setSuspended(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),f(t),this._featureFetcher.suspended=e,g}async updateOutFields(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),f(t),this._featureFetcher.outFields=new Set(e??[]),g}async fetchCandidates(e,t){await this._whenSetup.promise,f(t);const s=$t(e),i=t==null?void 0:t.signal,r=await this._queryEngine.executeQueryForSnapping(s,i);f(i);const n=await this._elevationAligner.alignCandidates(r.candidates,E.fromJSON(e.point.spatialReference)??E.WGS84,i);f(i);const o=await this._symbologyCandidatesFetcher.fetch(n,i);f(i);const h=o.length===0?n:n.concat(o);return{result:{candidates:this._elevationFilter.filter(s,h)}}}async updateTiles(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),f(t),this._featureFetcher.tileSize=e.tileSize,this._featureFetcher.tilesOfInterest=e.tiles,this._featureFetcher.tileInfo=e.tileInfo!=null?S.fromJSON(e.tileInfo):null,g}async refresh(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),f(t),this._featureFetcher.refresh(),g}async whenNotUpdating(e,t){return await this._updatingHandles.addPromise(this._whenSetup.promise),f(t),await pt(()=>!this.updatingExcludingEdits,t),f(t),g}async getDebugInfo(e,t){return f(t),{result:this._featureFetcher.debugInfo}}async beginApplyEdits(e,t){this._updatingHandles.addPromise(this._whenSetup.promise),f(t);const s=U();return this._pendingApplyEdits.set(e.id,s),this._featureFetcher.applyEdits(s.promise),this._editsUpdatingHandles.addPromise(s.promise),g}async endApplyEdits(e,t){const s=this._pendingApplyEdits.get(e.id);return s&&s.resolve(e.edits),f(t),g}async notifyElevationSourceChange(e,t){return this._elevationAligner.notifyElevationSourceChange(),g}async notifySymbologyChange(e,t){return this._symbologyCandidatesFetcher.notifySymbologyChange(),g}async setSymbologySnappingSupported(e){return this._symbologyCandidatesFetcher=q(e,this._getSymbologyCandidates),g}_updateFeatureFetcherConfiguration(e){this._featureFetcher.filter=e.filter!=null?T.fromJSON(e.filter):null,this._featureFetcher.customParameters=e.customParameters}_notifyUpdating(){this.emit("notify-updating",{updating:this.updating})}};l([u({readOnly:!0})],F.prototype,"updating",null),l([u({readOnly:!0})],F.prototype,"updatingExcludingEdits",null),l([u()],F.prototype,"_isInitializing",void 0),F=l([v("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorker")],F);const re=F;function $t(e){if(!e.filter)return{...e,query:{where:"1=1"}};const{distance:t,units:s,spatialRel:i,where:r,timeExtent:n,objectIds:o}=e.filter,h={geometry:e.filter.geometry?_t(e.filter.geometry):void 0,distance:t,units:s,spatialRel:i,timeExtent:n,objectIds:o,where:r??"1=1"};return{...e,query:h}}const g={result:{}};export{re as default}; diff --git a/dist/assets/FeatureSet-d4S1oKME.js b/dist/assets/FeatureSet-d4S1oKME.js deleted file mode 100644 index 09bd40b..0000000 --- a/dist/assets/FeatureSet-d4S1oKME.js +++ /dev/null @@ -1 +0,0 @@ -import{dp as F,e as h,y as g,S as N,dt as S,dw as P,du as T,dx as j,ar as w,c as q,dr as J,dy as O,bI as M,dz as v}from"./index-J0iiHjMT.js";var z;const G=new F({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let m=z=class extends J{constructor(r){super(r),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(r,a){var s;const o=w.fromJSON(a.spatialReference),e=[];for(let t=0;t0)for(let o=0;oMath.round((n-e)/a),l=n=>Math.round((s-n)/o),u=this.features,f=this._getQuantizationFunction(this.geometryType,t,l);for(let n=0,y=u.length;np*t+e,f=p=>s-p*l;let n=null,y=null;if(this.hasZ&&((c=o==null?void 0:o.scale)==null?void 0:c[2])!=null){const{translate:[,,p],scale:[,,R]}=o;n=x=>x*R+p}if(this.hasM&&((d=o==null?void 0:o.scale)==null?void 0:d[3])!=null){const{translate:[,,,p],scale:[,,,R]}=o;y=x=>x==null?x:x*R+p}const i=this._getHydrationFunction(r,u,f,n,y);for(const{geometry:p}of a)p!=null&&i&&i(p);return this.transform=null,this}_quantizePoints(r,a,o){let e,s;const t=[];for(let l=0,u=r.length;l0){const n=a(f[0]),y=o(f[1]);n===e&&y===s||(t.push([n-e,y-s]),e=n,s=y)}else e=a(f[0]),s=o(f[1]),t.push([e,s])}return t.length>0?t:null}_getQuantizationFunction(r,a,o){return r==="point"?e=>(e.x=a(e.x),e.y=o(e.y),e):r==="polyline"||r==="polygon"?e=>{const s=v(e)?e.rings:e.paths,t=[];for(let l=0,u=s.length;l0?(v(e)?e.rings=t:e.paths=t,e):null}:r==="multipoint"?e=>{const s=this._quantizePoints(e.points,a,o);return s&&s.length>0?(e.points=s,e):null}:r==="extent"?e=>e:null}_getHydrationFunction(r,a,o,e,s){return r==="point"?t=>{t.x=a(t.x),t.y=o(t.y),e&&(t.z=e(t.z))}:r==="polyline"||r==="polygon"?t=>{const l=v(t)?t.rings:t.paths;let u,f;for(let n=0,y=l.length;n0?(u+=p[0],f+=p[1]):(u=p[0],f=p[1]),p[0]=a(u),p[1]=o(f)}}if(e&&s)for(let n=0,y=l.length;n{t.xmin=a(t.xmin),t.ymin=o(t.ymin),t.xmax=a(t.xmax),t.ymax=o(t.ymax),e&&t.zmax!=null&&t.zmin!=null&&(t.zmax=e(t.zmax),t.zmin=e(t.zmin)),s&&t.mmax!=null&&t.mmin!=null&&(t.mmax=s(t.mmax),t.mmin=s(t.mmin))}:r==="multipoint"?t=>{const l=t.points;let u,f;for(let n=0,y=l.length;n0?(u+=i[0],f+=i[1]):(u=i[0],f=i[1]),i[0]=a(u),i[1]=o(f)}if(e&&s)for(let n=0,y=l.length;n({enabled:r})}}})],m.prototype,"exceededTransferLimit",void 0),h([g({type:[N],json:{write:!0}})],m.prototype,"features",void 0),h([S("features")],m.prototype,"readFeatures",null),h([g({type:[P],json:{write:!0}})],m.prototype,"fields",void 0),h([g({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:G.read}}})],m.prototype,"geometryType",void 0),h([T("geometryType")],m.prototype,"writeGeometryType",null),h([g({type:Boolean,json:{write:{overridePolicy:r=>({enabled:r})}}})],m.prototype,"hasM",void 0),h([g({type:Boolean,json:{write:{overridePolicy:r=>({enabled:r})}}})],m.prototype,"hasZ",void 0),h([g({types:j,json:{write:!0}})],m.prototype,"queryGeometry",void 0),h([S("queryGeometry")],m.prototype,"readQueryGeometry",null),h([g({type:w,json:{write:!0}})],m.prototype,"spatialReference",void 0),h([T("spatialReference")],m.prototype,"writeSpatialReference",null),h([g({json:{write:!0}})],m.prototype,"transform",void 0),m=z=h([q("esri.rest.support.FeatureSet")],m),m.prototype.toJSON.isDefaultToJSON=!0;const $=m;export{$ as d}; diff --git a/dist/assets/FeatureStore-X-AIJLo2.js b/dist/assets/FeatureStore-PXMUgn0j.js similarity index 88% rename from dist/assets/FeatureStore-X-AIJLo2.js rename to dist/assets/FeatureStore-PXMUgn0j.js index f4dcdd0..b4b3b96 100644 --- a/dist/assets/FeatureStore-X-AIJLo2.js +++ b/dist/assets/FeatureStore-PXMUgn0j.js @@ -1 +1 @@ -import{eh as u,K as f,e3 as l,ei as m,Z as a,E as n,ej as d,ae as h}from"./index-J0iiHjMT.js";import{o as g}from"./BoundsStore-wmwfHjhp.js";import{h as _}from"./QueryEngine-8tLWlkSE.js";import{o as y}from"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";const I=u();class S{constructor(e){this.geometryInfo=e,this._boundsStore=new g,this._featuresById=new Map,this._markedIds=new Set,this.events=new f,this.featureAdapter=y}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){let e=0;return this._featuresById.forEach(t=>{t.geometry!=null&&t.geometry.coords&&(e+=t.geometry.coords.length)}),{featureCount:this._featuresById.size,vertexCount:e/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}getFullExtent(e){if(this.fullBounds==null)return null;const[t,s,r,o]=this.fullBounds;return{xmin:t,ymin:s,xmax:r,ymax:o,spatialReference:_(e)}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}upsertMany(e){const t=e.map(s=>this._upsert(s));return this._emitChanged(),t.filter(l)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged()}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const s=this._featuresById.get(t);s&&this._remove(s)}this._emitChanged()}forEachBounds(e,t){for(const s of e){const r=this._boundsStore.get(s.objectId);r&&t(m(I,r))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach(t=>e(t))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,s=>{t(this._featuresById.get(s))})}startMarkingUsedFeatures(){this._boundsStore.invalidateIndex(),this._markedIds.clear()}sweep(){let e=!1;this._featuresById.forEach((t,s)=>{this._markedIds.has(s)||(e=!0,this._remove(t))}),this._markedIds.clear(),e&&this._emitChanged()}_emitChanged(){this.events.emit("changed",void 0)}_add(e){var o,i;if(!e)return;const t=e.objectId;if(t==null)return void a.getLogger("esri.layers.graphics.data.FeatureStore").error(new n("featurestore:invalid-feature","feature id is missing",{feature:e}));const s=this._featuresById.get(t);let r;if(this._markedIds.add(t),s?(e.displayId=s.displayId,r=this._boundsStore.get(t),this._boundsStore.delete(t)):this.onFeatureAdd!=null&&this.onFeatureAdd(e),!((i=(o=e.geometry)==null?void 0:o.coords)!=null&&i.length))return this._boundsStore.set(t,null),void this._featuresById.set(t,e);r=d(r??h(),e.geometry,this.geometryInfo.hasZ,this.geometryInfo.hasM),r!=null&&this._boundsStore.set(t,r),this._featuresById.set(t,e)}_upsert(e){const t=e==null?void 0:e.objectId;if(t==null)return a.getLogger("esri.layers.graphics.data.FeatureStore").error(new n("featurestore:invalid-feature","feature id is missing",{feature:e})),null;const s=this._featuresById.get(t);if(!s)return this._add(e),e;this._markedIds.add(t);const{geometry:r,attributes:o}=e;for(const i in o)s.attributes[i]=o[i];return r&&(s.geometry=r,this._boundsStore.set(t,d(h(),r,this.geometryInfo.hasZ,this.geometryInfo.hasM)??null)),s}_remove(e){this.onFeatureRemove!=null&&this.onFeatureRemove(e);const t=e.objectId;return this._markedIds.delete(t),this._boundsStore.delete(t),this._featuresById.delete(t),e}}export{S as m}; +import{ea as u,z as f,dY as l,eb as m,R as a,r as n,ec as d,cf as h}from"./index-pCX-0tJH.js";import{o as g}from"./BoundsStore-_-dPK5c-.js";import{h as _}from"./QueryEngine-uvDs-vBe.js";import{o as y}from"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";const c=u();class S{constructor(e){this.geometryInfo=e,this._boundsStore=new g,this._featuresById=new Map,this._markedIds=new Set,this.events=new f,this.featureAdapter=y}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){let e=0;return this._featuresById.forEach(t=>{t.geometry!=null&&t.geometry.coords&&(e+=t.geometry.coords.length)}),{featureCount:this._featuresById.size,vertexCount:e/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}getFullExtent(e){if(this.fullBounds==null)return null;const[t,s,r,o]=this.fullBounds;return{xmin:t,ymin:s,xmax:r,ymax:o,spatialReference:_(e)}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}upsertMany(e){const t=e.map(s=>this._upsert(s));return this._emitChanged(),t.filter(l)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged()}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const s=this._featuresById.get(t);s&&this._remove(s)}this._emitChanged()}forEachBounds(e,t){for(const s of e){const r=this._boundsStore.get(s.objectId);r&&t(m(c,r))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach(t=>e(t))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,s=>{t(this._featuresById.get(s))})}startMarkingUsedFeatures(){this._boundsStore.invalidateIndex(),this._markedIds.clear()}sweep(){let e=!1;this._featuresById.forEach((t,s)=>{this._markedIds.has(s)||(e=!0,this._remove(t))}),this._markedIds.clear(),e&&this._emitChanged()}_emitChanged(){this.events.emit("changed",void 0)}_add(e){var o,i;if(!e)return;const t=e.objectId;if(t==null)return void a.getLogger("esri.layers.graphics.data.FeatureStore").error(new n("featurestore:invalid-feature","feature id is missing",{feature:e}));const s=this._featuresById.get(t);let r;if(this._markedIds.add(t),s?(e.displayId=s.displayId,r=this._boundsStore.get(t),this._boundsStore.delete(t)):this.onFeatureAdd!=null&&this.onFeatureAdd(e),!((i=(o=e.geometry)==null?void 0:o.coords)!=null&&i.length))return this._boundsStore.set(t,null),void this._featuresById.set(t,e);r=d(r??h(),e.geometry,this.geometryInfo.hasZ,this.geometryInfo.hasM),r!=null&&this._boundsStore.set(t,r),this._featuresById.set(t,e)}_upsert(e){const t=e==null?void 0:e.objectId;if(t==null)return a.getLogger("esri.layers.graphics.data.FeatureStore").error(new n("featurestore:invalid-feature","feature id is missing",{feature:e})),null;const s=this._featuresById.get(t);if(!s)return this._add(e),e;this._markedIds.add(t);const{geometry:r,attributes:o}=e;for(const i in o)s.attributes[i]=o[i];return r&&(s.geometry=r,this._boundsStore.set(t,d(h(),r,this.geometryInfo.hasZ,this.geometryInfo.hasM)??null)),s}_remove(e){this.onFeatureRemove!=null&&this.onFeatureRemove(e);const t=e.objectId;return this._markedIds.delete(t),this._boundsStore.delete(t),this._featuresById.delete(t),e}}export{S as m}; diff --git a/dist/assets/FeatureTemplate-kUgbbA00.js b/dist/assets/FeatureTemplate-vSzbyslg.js similarity index 94% rename from dist/assets/FeatureTemplate-kUgbbA00.js rename to dist/assets/FeatureTemplate-vSzbyslg.js index fcf3797..1587bd0 100644 --- a/dist/assets/FeatureTemplate-kUgbbA00.js +++ b/dist/assets/FeatureTemplate-vSzbyslg.js @@ -1 +1 @@ -import{dp as l,dq as a,e as o,y as r,c as s,dr as n}from"./index-J0iiHjMT.js";const t=new l({esriFeatureEditToolAutoCompletePolygon:"auto-complete-polygon",esriFeatureEditToolCircle:"circle",esriFeatureEditToolEllipse:"ellipse",esriFeatureEditToolFreehand:"freehand",esriFeatureEditToolLine:"line",esriFeatureEditToolNone:"none",esriFeatureEditToolPoint:"point",esriFeatureEditToolPolygon:"polygon",esriFeatureEditToolRectangle:"rectangle",esriFeatureEditToolArrow:"arrow",esriFeatureEditToolTriangle:"triangle",esriFeatureEditToolLeftArrow:"left-arrow",esriFeatureEditToolRightArrow:"right-arrow",esriFeatureEditToolUpArrow:"up-arrow",esriFeatureEditToolDownArrow:"down-arrow"});let e=class extends a(n){constructor(i){super(i),this.name=null,this.description=null,this.drawingTool=null,this.prototype=null,this.thumbnail=null}};o([r({json:{write:!0}})],e.prototype,"name",void 0),o([r({json:{write:!0}})],e.prototype,"description",void 0),o([r({json:{read:t.read,write:t.write}})],e.prototype,"drawingTool",void 0),o([r({json:{write:!0}})],e.prototype,"prototype",void 0),o([r({json:{write:!0}})],e.prototype,"thumbnail",void 0),e=o([s("esri.layers.support.FeatureTemplate")],e);const p=e;export{p}; +import{dp as l,dq as a,e as o,y as r,c as s,dr as n}from"./index-pCX-0tJH.js";const t=new l({esriFeatureEditToolAutoCompletePolygon:"auto-complete-polygon",esriFeatureEditToolCircle:"circle",esriFeatureEditToolEllipse:"ellipse",esriFeatureEditToolFreehand:"freehand",esriFeatureEditToolLine:"line",esriFeatureEditToolNone:"none",esriFeatureEditToolPoint:"point",esriFeatureEditToolPolygon:"polygon",esriFeatureEditToolRectangle:"rectangle",esriFeatureEditToolArrow:"arrow",esriFeatureEditToolTriangle:"triangle",esriFeatureEditToolLeftArrow:"left-arrow",esriFeatureEditToolRightArrow:"right-arrow",esriFeatureEditToolUpArrow:"up-arrow",esriFeatureEditToolDownArrow:"down-arrow"});let e=class extends a(n){constructor(i){super(i),this.name=null,this.description=null,this.drawingTool=null,this.prototype=null,this.thumbnail=null}};o([r({json:{write:!0}})],e.prototype,"name",void 0),o([r({json:{write:!0}})],e.prototype,"description",void 0),o([r({json:{read:t.read,write:t.write}})],e.prototype,"drawingTool",void 0),o([r({json:{write:!0}})],e.prototype,"prototype",void 0),o([r({json:{write:!0}})],e.prototype,"thumbnail",void 0),e=o([s("esri.layers.support.FeatureTemplate")],e);const p=e;export{p}; diff --git a/dist/assets/FeatureTileTree3DDebugger-ZBfyCqfy.js b/dist/assets/FeatureTileTree3DDebugger-ZBfyCqfy.js deleted file mode 100644 index ad658e1..0000000 --- a/dist/assets/FeatureTileTree3DDebugger-ZBfyCqfy.js +++ /dev/null @@ -1 +0,0 @@ -import{k as d,P as g,e as r,y as s,l,c as p}from"./index-J0iiHjMT.js";import{d as c}from"./TileTreeDebugger-2DVbY5sQ.js";let i=class extends c{get updating(){var t;return((t=this._watchUpdatingTracking)==null?void 0:t.updating)??!1}constructor(t){super(t),this._watchUpdatingTracking=new d}initialize(){const{featureTiles:t}=this.view;this.addHandles(t.addClient()),this._watchUpdatingTracking.addOnCollectionChange(()=>t==null?void 0:t.tiles,()=>this.update(),g)}destroy(){this._watchUpdatingTracking.destroy()}getTiles(){const t=e=>{const[a,o,n]=e.lij;return l.fromExtent(this.view.featureTiles.tilingScheme.getExtentGeometry(a,o,n))};return this.view.featureTiles.tiles.toArray().sort((e,a)=>e.loadPriority-a.loadPriority).map(e=>({...e,geometry:t(e)}))}};r([s()],i.prototype,"_watchUpdatingTracking",void 0),r([s()],i.prototype,"updating",null),r([s()],i.prototype,"view",void 0),i=r([p("esri.views.3d.layers.support.FeatureTileTree3DDebugger")],i);export{i as FeatureTileTree3DDebugger}; diff --git a/dist/assets/FeatureTileTree3DDebugger-y_91jAgc.js b/dist/assets/FeatureTileTree3DDebugger-y_91jAgc.js new file mode 100644 index 0000000..37a77ce --- /dev/null +++ b/dist/assets/FeatureTileTree3DDebugger-y_91jAgc.js @@ -0,0 +1 @@ +import{h as d,P as g,e as r,y as s,j as p,c as l}from"./index-pCX-0tJH.js";import{d as c}from"./TileTreeDebugger-MxH50s1q.js";let i=class extends c{get updating(){var t;return((t=this._watchUpdatingTracking)==null?void 0:t.updating)??!1}constructor(t){super(t),this._watchUpdatingTracking=new d}initialize(){const{featureTiles:t}=this.view;this.addHandles(t.addClient()),this._watchUpdatingTracking.addOnCollectionChange(()=>t==null?void 0:t.tiles,()=>this.update(),g)}destroy(){this._watchUpdatingTracking.destroy()}getTiles(){const t=e=>{const[a,o,n]=e.lij;return p.fromExtent(this.view.featureTiles.tilingScheme.getExtentGeometry(a,o,n))};return this.view.featureTiles.tiles.toArray().sort((e,a)=>e.loadPriority-a.loadPriority).map(e=>({...e,geometry:t(e)}))}};r([s()],i.prototype,"_watchUpdatingTracking",void 0),r([s()],i.prototype,"updating",null),r([s()],i.prototype,"view",void 0),i=r([l("esri.views.3d.layers.support.FeatureTileTree3DDebugger")],i);export{i as FeatureTileTree3DDebugger}; diff --git a/dist/assets/FeatureType-MpRe7WJj.js b/dist/assets/FeatureType-0WPvBvpQ.js similarity index 84% rename from dist/assets/FeatureType-MpRe7WJj.js rename to dist/assets/FeatureType-0WPvBvpQ.js index fb751f7..ec9277c 100644 --- a/dist/assets/FeatureType-MpRe7WJj.js +++ b/dist/assets/FeatureType-0WPvBvpQ.js @@ -1 +1 @@ -import{dq as p,ds as d,e as s,y as i,dt as l,du as m,c,dr as u}from"./index-J0iiHjMT.js";import{p as y}from"./FeatureTemplate-kUgbbA00.js";let t=class extends p(u){constructor(o){super(o),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(o){const r={};for(const e of Object.keys(o))r[e]=d(o[e]);return r}writeDomains(o,r){var a;const e={};for(const n of Object.keys(o))o[n]&&(e[n]=(a=o[n])==null?void 0:a.toJSON());r.domains=e}};s([i({json:{write:!0}})],t.prototype,"id",void 0),s([i({json:{write:!0}})],t.prototype,"name",void 0),s([i({json:{write:!0}})],t.prototype,"domains",void 0),s([l("domains")],t.prototype,"readDomains",null),s([m("domains")],t.prototype,"writeDomains",null),s([i({type:[y],json:{write:!0}})],t.prototype,"templates",void 0),t=s([c("esri.layers.support.FeatureType")],t);const w=t;export{w as n}; +import{dq as p,ds as d,e as s,y as i,dt as l,du as m,c,dr as u}from"./index-pCX-0tJH.js";import{p as y}from"./FeatureTemplate-vSzbyslg.js";let t=class extends p(u){constructor(o){super(o),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(o){const r={};for(const e of Object.keys(o))r[e]=d(o[e]);return r}writeDomains(o,r){var a;const e={};for(const n of Object.keys(o))o[n]&&(e[n]=(a=o[n])==null?void 0:a.toJSON());r.domains=e}};s([i({json:{write:!0}})],t.prototype,"id",void 0),s([i({json:{write:!0}})],t.prototype,"name",void 0),s([i({json:{write:!0}})],t.prototype,"domains",void 0),s([l("domains")],t.prototype,"readDomains",null),s([m("domains")],t.prototype,"writeDomains",null),s([i({type:[y],json:{write:!0}})],t.prototype,"templates",void 0),t=s([c("esri.layers.support.FeatureType")],t);const w=t;export{w as n}; diff --git a/dist/assets/FloatingArrow-BghsONry.js b/dist/assets/FloatingArrow-FUeqM5kw.js similarity index 84% rename from dist/assets/FloatingArrow-BghsONry.js rename to dist/assets/FloatingArrow-FUeqM5kw.js index a35cb42..7e953ee 100644 --- a/dist/assets/FloatingArrow-BghsONry.js +++ b/dist/assets/FloatingArrow-FUeqM5kw.js @@ -1,5 +1,5 @@ -import{t as i}from"./index-J0iiHjMT.js";/*! +import{k as i}from"./index-pCX-0tJH.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const h={arrow:"calcite-floating-ui-arrow",arrowStroke:"calcite-floating-ui-arrow__stroke"},w={width:12,height:6,strokeWidth:1},$=({floatingLayout:n,key:c,ref:l})=>{const{width:t,height:o,strokeWidth:r}=w,e=t/2,a=n==="vertical",s=`M0,0 H${t} L${t-e},${o} Q${e},${o} ${e},${o} Z`;return i("svg",{"aria-hidden":"true",class:h.arrow,height:t,key:c,viewBox:`0 0 ${t} ${t+(a?0:r)}`,width:t+(a?r:0),ref:l},r>0&&i("path",{class:h.arrowStroke,d:s,fill:"none","stroke-width":r+1}),i("path",{d:s,stroke:"none"}))};export{$ as F}; + */const h={arrow:"calcite-floating-ui-arrow",arrowStroke:"calcite-floating-ui-arrow__stroke"},w={width:12,height:6,strokeWidth:1},k=({floatingLayout:n,key:c,ref:l})=>{const{width:t,height:o,strokeWidth:r}=w,e=t/2,a=n==="vertical",s=`M0,0 H${t} L${t-e},${o} Q${e},${o} ${e},${o} Z`;return i("svg",{"aria-hidden":"true",class:h.arrow,height:t,key:c,viewBox:`0 0 ${t} ${t+(a?0:r)}`,width:t+(a?r:0),ref:l},r>0&&i("path",{class:h.arrowStroke,d:s,fill:"none","stroke-width":r+1}),i("path",{d:s,stroke:"none"}))};export{k as F}; diff --git a/dist/assets/GeoJSONLayer--Go-c1Ql.js b/dist/assets/GeoJSONLayer--Go-c1Ql.js new file mode 100644 index 0000000..4a8f402 --- /dev/null +++ b/dist/assets/GeoJSONLayer--Go-c1Ql.js @@ -0,0 +1,7 @@ +import{e as i,y as s,c as b,il as x,bs as $,h6 as w,dO as I,r as m,j as J,f_ as j,dE as N,f9 as O,R as f,dF as R,ee as P,dJ as q,dG as T,dH as k,dI as D,dK as L,d2 as F,dL as G,iG as g,iH as Q,au as v,de as Z,io as z,aL as y,eq as C,iI as V,es as M,dP as A,iJ as B,iK as U,iL as W,dQ as H,iM as K,iw as X,ix as Y,iN as ee,iv as te,iO as ie,dR as re,iz as se,aI as oe}from"./index-pCX-0tJH.js";import{l as ne}from"./clientSideDefaults-63pOkJ4Y.js";import{o as ae}from"./CustomParametersMixin-7nmugR3Y.js";import{p as le}from"./FeatureEffectLayer-OK0TB5f6.js";import{c as de}from"./FeatureReductionLayer-2X2_PJv9.js";import{c as ue}from"./OrderedLayer-XNaJwl_G.js";import{p as pe}from"./FeatureTemplate-vSzbyslg.js";import{n as he}from"./FeatureType-0WPvBvpQ.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./FeatureEffect-0Jn9Z0sQ.js";let p=class extends x{constructor(){super(...arguments),this.type="geojson",this.refresh=$(async e=>{await this.load();const{extent:t,timeExtent:r}=await this._connection.invoke("refresh",e);return this.sourceJSON.extent=t,r&&(this.sourceJSON.timeInfo.timeExtent=[r.start,r.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){const t=e!=null?e.signal:null;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){var e;(e=this._connection)==null||e.close(),this._connection=null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}queryFeatures(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatures",e?e.toJSON():null,t)).then(r=>w.fromJSON(r))}queryFeaturesJSON(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatures",e?e.toJSON():null,t))}queryFeatureCount(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t))}queryObjectIds(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryObjectIds",e?e.toJSON():null,t))}queryExtent(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryExtent",e?e.toJSON():null,t)).then(r=>({count:r.count,extent:I.fromJSON(r.extent)}))}querySnapping(e,t={}){return this.load(t).then(()=>this._connection.invoke("querySnapping",e,t))}_applyEdits(e){if(!this._connection)throw new m("geojson-layer-source:edit-failure","Memory source not loaded");const t=this.layer.objectIdField,r=[],a=[],l=[];if(e.addFeatures)for(const n of e.addFeatures)r.push(this._serializeFeature(n));if(e.deleteFeatures)for(const n of e.deleteFeatures)"objectId"in n&&n.objectId!=null?a.push(n.objectId):"attributes"in n&&n.attributes[t]!=null&&a.push(n.attributes[t]);if(e.updateFeatures)for(const n of e.updateFeatures)l.push(this._serializeFeature(n));return this._connection.invoke("applyEdits",{adds:r,updates:l,deletes:a}).then(({extent:n,timeExtent:d,featureEditResults:u})=>(this.sourceJSON.extent=n,d&&(this.sourceJSON.timeInfo.timeExtent=[d.start,d.end]),this._createEditsResult(u)))}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){const t=e.success===!0?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new m("geojson-layer-source:edit-failure",t.description,{code:t.code}):null}}_serializeFeature(e){const{attributes:t}=e,r=this._geometryForSerialization(e);return r?{geometry:r.toJSON(),attributes:t}:{attributes:t}}_geometryForSerialization(e){const{geometry:t}=e;return t==null?null:t.type==="mesh"||t.type==="extent"?J.fromExtent(t.extent):t}async _startWorker(e){this._connection=await j("GeoJSONSourceWorker",{strategy:N("feature-layers-workers")?"dedicated":"local",signal:e,registryTarget:this});const{fields:t,spatialReference:r,hasZ:a,geometryType:l,objectIdField:n,url:d,timeInfo:u,customParameters:E}=this.layer,S=this.layer.originOf("spatialReference")==="defaults",_={url:d,customParameters:E,fields:t&&t.map(c=>c.toJSON()),geometryType:O.toJSON(l),hasZ:a,objectIdField:n,timeInfo:u?u.toJSON():null,spatialReference:S?null:r&&r.toJSON()},h=await this._connection.invoke("load",_,{signal:e});for(const c of h.warnings)f.getLogger(this.layer).warn("#load()",`$${c.message} (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{warning:c});h.featureErrors.length&&f.getLogger(this.layer).warn("#load()",`Encountered ${h.featureErrors.length} validation errors while loading features. (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{errors:h.featureErrors}),this.sourceJSON=h.layerDefinition,this.capabilities=ne(this.sourceJSON.hasZ,!0)}};i([s()],p.prototype,"capabilities",void 0),i([s()],p.prototype,"type",void 0),i([s({constructOnly:!0})],p.prototype,"layer",void 0),i([s()],p.prototype,"sourceJSON",void 0),p=i([b("esri.layers.graphics.sources.GeoJSONSource")],p);const ye=se();let o=class extends ue(ae(de(le(R(P(q(T(k(D(L(oe))))))))))){constructor(e){super(e),this.copyright=null,this.dateFieldsTimeZone=null,this.definitionExpression=null,this.displayField=null,this.editingEnabled=!1,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="GeoJSON",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new p({layer:this}),this.spatialReference=F.WGS84,this.templates=null,this.title="GeoJSON",this.type="geojson",this.typeIdField=null,this.types=null}destroy(){var e;(e=this.source)==null||e.destroy()}load(e){const t=this.loadFromPortal({supportedTypes:["GeoJson"],supportsData:!1},e).catch(G).then(()=>this.source.load(e)).then(()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo"],"service"),g(this.renderer,this.fieldsIndex),Q(this.timeInfo,this.fieldsIndex)});return this.addResolvingPromise(t),Promise.resolve(this)}get capabilities(){return this.source?this.source.capabilities:null}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&this.geometryType==null}get parsedUrl(){return this.url?v(this.url):null}set renderer(e){g(e,this.fieldsIndex),this._set("renderer",e)}set url(e){if(!e)return void this._set("url",e);const t=v(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async applyEdits(e,t){const{applyEdits:r}=await Z(()=>import("./editingSupport-HfkJiqt7.js"),__vite__mapDeps([0,1,2]));await this.load();const a=await r(this,this.source,e,t);return this.read({extent:this.source.sourceJSON.extent,timeInfo:this.source.sourceJSON.timeInfo},{origin:"service",ignoreDefaults:!0}),a}on(e,t){return super.on(e,t)}createPopupTemplate(e){return z(this,e)}createQuery(){var l;const e=new y,t=(l=this.capabilities)==null?void 0:l.data;e.returnGeometry=!0,t&&t.supportsZ&&(e.returnZ=!0),e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:r,timeExtent:a}=this;return e.timeExtent=r!=null&&a!=null?a.offset(-r.value,r.unit):a||null,e}getFieldDomain(e,t){let r,a=!1;const l=t==null?void 0:t.feature,n=l==null?void 0:l.attributes,d=this.typeIdField&&(n==null?void 0:n[this.typeIdField]);return d!=null&&this.types&&(a=this.types.some(u=>u.id==d&&(r=u.domains&&u.domains[e],r&&r.type==="inherited"&&(r=this._getLayerDomain(e)),!0))),a||r||(r=this._getLayerDomain(e)),r}getField(e){return this.fieldsIndex.get(e)}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(y.from(e)||this.createQuery(),t)).then(r=>{if(r!=null&&r.features)for(const a of r.features)a.layer=a.sourceLayer=this;return r})}queryObjectIds(e,t){return this.load().then(()=>this.source.queryObjectIds(y.from(e)||this.createQuery(),t))}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(y.from(e)||this.createQuery(),t))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(y.from(e)||this.createQuery(),t))}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return t!=null&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}_getLayerDomain(e){if(!this.fields)return null;let t=null;return this.fields.some(r=>(r.name===e&&(t=r.domain),!!t)),t}};i([s({readOnly:!0,json:{read:!1,write:!1}})],o.prototype,"capabilities",null),i([s({type:String})],o.prototype,"copyright",void 0),i([s({readOnly:!0})],o.prototype,"createQueryVersion",null),i([s(C("dateFieldsTimeReference"))],o.prototype,"dateFieldsTimeZone",void 0),i([s({readOnly:!0})],o.prototype,"defaultPopupTemplate",null),i([s({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],o.prototype,"definitionExpression",void 0),i([s({type:String})],o.prototype,"displayField",void 0),i([s({type:Boolean})],o.prototype,"editingEnabled",void 0),i([s(V)],o.prototype,"elevationInfo",void 0),i([s({type:[M],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],o.prototype,"fields",void 0),i([s(ye.fieldsIndex)],o.prototype,"fieldsIndex",void 0),i([s({type:I,json:{name:"extent"}})],o.prototype,"fullExtent",void 0),i([s({type:["point","polygon","polyline","multipoint"],json:{read:{reader:O.read}}})],o.prototype,"geometryType",void 0),i([s({type:Boolean})],o.prototype,"hasZ",void 0),i([s(A)],o.prototype,"id",void 0),i([s({type:Boolean,readOnly:!0})],o.prototype,"isTable",null),i([s(B)],o.prototype,"labelsVisible",void 0),i([s({type:[U],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:W},write:!0}})],o.prototype,"labelingInfo",void 0),i([s(H)],o.prototype,"legendEnabled",void 0),i([s({type:["show","hide"]})],o.prototype,"listMode",void 0),i([s({type:String,json:{name:"layerDefinition.objectIdField",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"objectIdField"}}}})],o.prototype,"objectIdField",void 0),i([s(K)],o.prototype,"opacity",void 0),i([s({type:["GeoJSON"]})],o.prototype,"operationalLayerType",void 0),i([s({readOnly:!0})],o.prototype,"parsedUrl",null),i([s(X)],o.prototype,"popupEnabled",void 0),i([s({type:Y,json:{name:"popupInfo",write:!0}})],o.prototype,"popupTemplate",void 0),i([s({types:ee,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:te}}}})],o.prototype,"renderer",null),i([s(ie)],o.prototype,"screenSizePerspectiveEnabled",void 0),i([s({readOnly:!0})],o.prototype,"source",void 0),i([s({type:F})],o.prototype,"spatialReference",void 0),i([s({type:[pe]})],o.prototype,"templates",void 0),i([s()],o.prototype,"title",void 0),i([s({json:{read:!1},readOnly:!0})],o.prototype,"type",void 0),i([s({type:String,readOnly:!0})],o.prototype,"typeIdField",void 0),i([s({type:[he]})],o.prototype,"types",void 0),i([s(re)],o.prototype,"url",null),o=i([b("esri.layers.GeoJSONLayer")],o);const Se=o;export{Se as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/editingSupport-HfkJiqt7.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/GeoJSONLayer-T9kwyVNs.js b/dist/assets/GeoJSONLayer-T9kwyVNs.js deleted file mode 100644 index 3d63421..0000000 --- a/dist/assets/GeoJSONLayer-T9kwyVNs.js +++ /dev/null @@ -1,7 +0,0 @@ -import{e as i,y as s,c as b,ij as _,ah as $,dT as I,E as m,l as j,g1 as w,dJ as J,fe as O,Z as f,dK as N,el as R,dO as P,dL as q,dM as T,dN as k,dP as D,ar as F,dQ as L,iF as g,iG as G,bV as v,de as Z,il as Q,ca as c,ex as C,iH as V,dw as z,dU as M,iI as U,iJ as W,iK as A,dV as B,iL as K,iu as H,iv as X,iM as Y,it as ee,iN as te,dW as ie,ix as re,c7 as se}from"./index-J0iiHjMT.js";import{l as oe}from"./clientSideDefaults-F-CNnR0g.js";import{d as ne}from"./FeatureSet-d4S1oKME.js";import{o as ae}from"./CustomParametersMixin-Y1bOcayO.js";import{p as le}from"./FeatureEffectLayer-oBa8pIG5.js";import{c as de}from"./FeatureReductionLayer-RlitE1N6.js";import{c as ue}from"./OrderedLayer-M7k5gLgx.js";import{p as pe}from"./FeatureTemplate-kUgbbA00.js";import{n as he}from"./FeatureType-MpRe7WJj.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./FeatureEffect-5bEV-xG1.js";let p=class extends _{constructor(){super(...arguments),this.type="geojson",this.refresh=$(async e=>{await this.load();const{extent:t,timeExtent:r}=await this._connection.invoke("refresh",e);return this.sourceJSON.extent=t,r&&(this.sourceJSON.timeInfo.timeExtent=[r.start,r.end]),{dataChanged:!0,updates:{extent:this.sourceJSON.extent,timeInfo:this.sourceJSON.timeInfo}}})}load(e){const t=e!=null?e.signal:null;return this.addResolvingPromise(this._startWorker(t)),Promise.resolve(this)}destroy(){var e;(e=this._connection)==null||e.close(),this._connection=null}applyEdits(e){return this.load().then(()=>this._applyEdits(e))}openPorts(){return this.load().then(()=>this._connection.openPorts())}queryFeatures(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatures",e?e.toJSON():null,t)).then(r=>ne.fromJSON(r))}queryFeaturesJSON(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatures",e?e.toJSON():null,t))}queryFeatureCount(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t))}queryObjectIds(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryObjectIds",e?e.toJSON():null,t))}queryExtent(e,t={}){return this.load(t).then(()=>this._connection.invoke("queryExtent",e?e.toJSON():null,t)).then(r=>({count:r.count,extent:I.fromJSON(r.extent)}))}querySnapping(e,t={}){return this.load(t).then(()=>this._connection.invoke("querySnapping",e,t))}_applyEdits(e){if(!this._connection)throw new m("geojson-layer-source:edit-failure","Memory source not loaded");const t=this.layer.objectIdField,r=[],a=[],l=[];if(e.addFeatures)for(const n of e.addFeatures)r.push(this._serializeFeature(n));if(e.deleteFeatures)for(const n of e.deleteFeatures)"objectId"in n&&n.objectId!=null?a.push(n.objectId):"attributes"in n&&n.attributes[t]!=null&&a.push(n.attributes[t]);if(e.updateFeatures)for(const n of e.updateFeatures)l.push(this._serializeFeature(n));return this._connection.invoke("applyEdits",{adds:r,updates:l,deletes:a}).then(({extent:n,timeExtent:d,featureEditResults:u})=>(this.sourceJSON.extent=n,d&&(this.sourceJSON.timeInfo.timeExtent=[d.start,d.end]),this._createEditsResult(u)))}_createEditsResult(e){return{addFeatureResults:e.addResults?e.addResults.map(this._createFeatureEditResult,this):[],updateFeatureResults:e.updateResults?e.updateResults.map(this._createFeatureEditResult,this):[],deleteFeatureResults:e.deleteResults?e.deleteResults.map(this._createFeatureEditResult,this):[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}_createFeatureEditResult(e){const t=e.success===!0?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new m("geojson-layer-source:edit-failure",t.description,{code:t.code}):null}}_serializeFeature(e){const{attributes:t}=e,r=this._geometryForSerialization(e);return r?{geometry:r.toJSON(),attributes:t}:{attributes:t}}_geometryForSerialization(e){const{geometry:t}=e;return t==null?null:t.type==="mesh"||t.type==="extent"?j.fromExtent(t.extent):t}async _startWorker(e){this._connection=await w("GeoJSONSourceWorker",{strategy:J("feature-layers-workers")?"dedicated":"local",signal:e,registryTarget:this});const{fields:t,spatialReference:r,hasZ:a,geometryType:l,objectIdField:n,url:d,timeInfo:u,customParameters:E}=this.layer,S=this.layer.originOf("spatialReference")==="defaults",x={url:d,customParameters:E,fields:t&&t.map(y=>y.toJSON()),geometryType:O.toJSON(l),hasZ:a,objectIdField:n,timeInfo:u?u.toJSON():null,spatialReference:S?null:r&&r.toJSON()},h=await this._connection.invoke("load",x,{signal:e});for(const y of h.warnings)f.getLogger(this.layer).warn("#load()",`$${y.message} (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{warning:y});h.featureErrors.length&&f.getLogger(this.layer).warn("#load()",`Encountered ${h.featureErrors.length} validation errors while loading features. (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{errors:h.featureErrors}),this.sourceJSON=h.layerDefinition,this.capabilities=oe(this.sourceJSON.hasZ,!0)}};i([s()],p.prototype,"capabilities",void 0),i([s()],p.prototype,"type",void 0),i([s({constructOnly:!0})],p.prototype,"layer",void 0),i([s()],p.prototype,"sourceJSON",void 0),p=i([b("esri.layers.graphics.sources.GeoJSONSource")],p);const ce=re();let o=class extends ue(ae(de(le(N(R(P(q(T(k(D(se))))))))))){constructor(e){super(e),this.copyright=null,this.dateFieldsTimeZone=null,this.definitionExpression=null,this.displayField=null,this.editingEnabled=!1,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="GeoJSON",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new p({layer:this}),this.spatialReference=F.WGS84,this.templates=null,this.title="GeoJSON",this.type="geojson",this.typeIdField=null,this.types=null}destroy(){var e;(e=this.source)==null||e.destroy()}load(e){const t=this.loadFromPortal({supportedTypes:["GeoJson"],supportsData:!1},e).catch(L).then(()=>this.source.load(e)).then(()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo"],"service"),g(this.renderer,this.fieldsIndex),G(this.timeInfo,this.fieldsIndex)});return this.addResolvingPromise(t),Promise.resolve(this)}get capabilities(){return this.source?this.source.capabilities:null}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}get isTable(){return this.loaded&&this.geometryType==null}get parsedUrl(){return this.url?v(this.url):null}set renderer(e){g(e,this.fieldsIndex),this._set("renderer",e)}set url(e){if(!e)return void this._set("url",e);const t=v(e);this._set("url",t.path),t.query&&(this.customParameters={...this.customParameters,...t.query})}async applyEdits(e,t){const{applyEdits:r}=await Z(()=>import("./editingSupport-EiPa9PKq.js"),__vite__mapDeps([0,1,2]));await this.load();const a=await r(this,this.source,e,t);return this.read({extent:this.source.sourceJSON.extent,timeInfo:this.source.sourceJSON.timeInfo},{origin:"service",ignoreDefaults:!0}),a}on(e,t){return super.on(e,t)}createPopupTemplate(e){return Q(this,e)}createQuery(){var l;const e=new c,t=(l=this.capabilities)==null?void 0:l.data;e.returnGeometry=!0,t&&t.supportsZ&&(e.returnZ=!0),e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:r,timeExtent:a}=this;return e.timeExtent=r!=null&&a!=null?a.offset(-r.value,r.unit):a||null,e}getFieldDomain(e,t){let r,a=!1;const l=t==null?void 0:t.feature,n=l==null?void 0:l.attributes,d=this.typeIdField&&(n==null?void 0:n[this.typeIdField]);return d!=null&&this.types&&(a=this.types.some(u=>u.id==d&&(r=u.domains&&u.domains[e],r&&r.type==="inherited"&&(r=this._getLayerDomain(e)),!0))),a||r||(r=this._getLayerDomain(e)),r}getField(e){return this.fieldsIndex.get(e)}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(c.from(e)||this.createQuery(),t)).then(r=>{if(r!=null&&r.features)for(const a of r.features)a.layer=a.sourceLayer=this;return r})}queryObjectIds(e,t){return this.load().then(()=>this.source.queryObjectIds(c.from(e)||this.createQuery(),t))}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(c.from(e)||this.createQuery(),t))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(c.from(e)||this.createQuery(),t))}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return t!=null&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}_getLayerDomain(e){if(!this.fields)return null;let t=null;return this.fields.some(r=>(r.name===e&&(t=r.domain),!!t)),t}};i([s({readOnly:!0,json:{read:!1,write:!1}})],o.prototype,"capabilities",null),i([s({type:String})],o.prototype,"copyright",void 0),i([s({readOnly:!0})],o.prototype,"createQueryVersion",null),i([s(C("dateFieldsTimeReference"))],o.prototype,"dateFieldsTimeZone",void 0),i([s({readOnly:!0})],o.prototype,"defaultPopupTemplate",null),i([s({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],o.prototype,"definitionExpression",void 0),i([s({type:String})],o.prototype,"displayField",void 0),i([s({type:Boolean})],o.prototype,"editingEnabled",void 0),i([s(V)],o.prototype,"elevationInfo",void 0),i([s({type:[z],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],o.prototype,"fields",void 0),i([s(ce.fieldsIndex)],o.prototype,"fieldsIndex",void 0),i([s({type:I,json:{name:"extent"}})],o.prototype,"fullExtent",void 0),i([s({type:["point","polygon","polyline","multipoint"],json:{read:{reader:O.read}}})],o.prototype,"geometryType",void 0),i([s({type:Boolean})],o.prototype,"hasZ",void 0),i([s(M)],o.prototype,"id",void 0),i([s({type:Boolean,readOnly:!0})],o.prototype,"isTable",null),i([s(U)],o.prototype,"labelsVisible",void 0),i([s({type:[W],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:A},write:!0}})],o.prototype,"labelingInfo",void 0),i([s(B)],o.prototype,"legendEnabled",void 0),i([s({type:["show","hide"]})],o.prototype,"listMode",void 0),i([s({type:String,json:{name:"layerDefinition.objectIdField",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"objectIdField"}}}})],o.prototype,"objectIdField",void 0),i([s(K)],o.prototype,"opacity",void 0),i([s({type:["GeoJSON"]})],o.prototype,"operationalLayerType",void 0),i([s({readOnly:!0})],o.prototype,"parsedUrl",null),i([s(H)],o.prototype,"popupEnabled",void 0),i([s({type:X,json:{name:"popupInfo",write:!0}})],o.prototype,"popupTemplate",void 0),i([s({types:Y,json:{name:"layerDefinition.drawingInfo.renderer",write:!0,origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:ee}}}})],o.prototype,"renderer",null),i([s(te)],o.prototype,"screenSizePerspectiveEnabled",void 0),i([s({readOnly:!0})],o.prototype,"source",void 0),i([s({type:F})],o.prototype,"spatialReference",void 0),i([s({type:[pe]})],o.prototype,"templates",void 0),i([s()],o.prototype,"title",void 0),i([s({json:{read:!1},readOnly:!0})],o.prototype,"type",void 0),i([s({type:String,readOnly:!0})],o.prototype,"typeIdField",void 0),i([s({type:[he]})],o.prototype,"types",void 0),i([s(ie)],o.prototype,"url",null),o=i([b("esri.layers.GeoJSONLayer")],o);const xe=o;export{xe as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/editingSupport-EiPa9PKq.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/GeoJSONLayerView3D-4MSCbPJp.js b/dist/assets/GeoJSONLayerView3D-4MSCbPJp.js deleted file mode 100644 index cc1d230..0000000 --- a/dist/assets/GeoJSONLayerView3D-4MSCbPJp.js +++ /dev/null @@ -1 +0,0 @@ -import{e as o,y as r,c as p}from"./index-J0iiHjMT.js";import{_ as i}from"./FeatureLayerViewBase3D-VurTj7t3.js";import"./HeatmapDensity.glsl-y7dUg--m.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./queryForSymbologySnapping-I1fFQTD_.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./QueryEngine-8tLWlkSE.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./FeatureSet-d4S1oKME.js";import"./FeatureStore-X-AIJLo2.js";import"./BoundsStore-wmwfHjhp.js";import"./projectExtentUtils-TwA6ooHn.js";import"./LayerView3D-iOx2MD1g.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./EventedSet-JGlFrfoR.js";import"./FeatureEffect-5bEV-xG1.js";import"./LayerView-efDufa6j.js";import"./RefreshableLayerView-Pd4dLcWr.js";let t=class extends i{constructor(){super(...arguments),this.type="geojson-3d"}};o([r()],t.prototype,"layer",void 0),t=o([p("esri.views.3d.layers.GeoJSONLayerView3D")],t);const A=t;export{A as default}; diff --git a/dist/assets/GeoJSONLayerView3D-lumzM4UY.js b/dist/assets/GeoJSONLayerView3D-lumzM4UY.js new file mode 100644 index 0000000..36bee93 --- /dev/null +++ b/dist/assets/GeoJSONLayerView3D-lumzM4UY.js @@ -0,0 +1 @@ +import{e as o,y as r,c as p}from"./index-pCX-0tJH.js";import{_ as i}from"./FeatureLayerViewBase3D-W0Qwl4g_.js";import"./HeatmapDensity.glsl-de3m0xZZ.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./queryForSymbologySnapping-MXWRIdj-.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./QueryEngine-uvDs-vBe.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./FeatureStore-PXMUgn0j.js";import"./BoundsStore-_-dPK5c-.js";import"./projectExtentUtils-Q4rXasWA.js";import"./LayerView3D-57OghbRh.js";import"./EventedSet-TJfupI82.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./LayerView-ixwLVnzr.js";import"./RefreshableLayerView-DVYs7L04.js";let t=class extends i{constructor(){super(...arguments),this.type="geojson-3d"}};o([r()],t.prototype,"layer",void 0),t=o([p("esri.views.3d.layers.GeoJSONLayerView3D")],t);const _=t;export{_ as default}; diff --git a/dist/assets/GeoJSONSourceWorker-KDFieIXt.js b/dist/assets/GeoJSONSourceWorker-KDFieIXt.js new file mode 100644 index 0000000..1289b33 --- /dev/null +++ b/dist/assets/GeoJSONSourceWorker-KDFieIXt.js @@ -0,0 +1 @@ +import{eQ as _,eL as R,r as I,eK as Q,g7 as C,fa as v,eM as P,N as Z,ac as A,R as N,bt as G,eP as M,eO as z,av as L,g8 as O,g9 as B,ga as J,gb as W}from"./index-pCX-0tJH.js";import{m as H}from"./FeatureStore-PXMUgn0j.js";import{W as K,x as E,j as b}from"./QueryEngine-uvDs-vBe.js";import{I as U,N as V,E as Y}from"./geojson-162a_hNo.js";import{o as X,a as ee,i as te}from"./clientSideDefaults-63pOkJ4Y.js";import{I as se,p as T,d as w,f as F,w as k}from"./sourceUtils-nEhsDpwC.js";import"./BoundsStore-_-dPK5c-.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./date-be_IQzZd.js";const ie={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!1,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};class be{constructor(){this._queryEngine=null,this._snapshotFeatures=async e=>{const t=await this._fetch(e);return this._createFeatures(t)}}destroy(){var e;(e=this._queryEngine)==null||e.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e,t={}){this._loadOptions={url:e.url,customParameters:e.customParameters};const n=[],[s]=await Promise.all([e.url?this._fetch(t==null?void 0:t.signal):null,this._checkProjection(e.spatialReference)]),i=U(s,{geometryType:e.geometryType}),o=e.fields||i.fields||[],d=e.hasZ!=null?e.hasZ:i.hasZ,p=i.geometryType;let y=e.objectIdField||i.objectIdFieldName||"__OBJECTID";const m=e.spatialReference||_;let r=e.timeInfo;o===i.fields&&i.unknownFields.length>0&&n.push({name:"geojson-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:i.unknownFields}});const l=new R(o);let u=l.get(y);u?(u.type!=="esriFieldTypeString"&&(u.type="esriFieldTypeOID"),u.editable=!1,u.nullable=!1,y=u.name):(u={alias:y,name:y,type:i.objectIdFieldType==="string"?"esriFieldTypeString":"esriFieldTypeOID",editable:!1,nullable:!1},o.unshift(u));const h={};for(const a of o){if(a.name==null&&(a.name=a.alias),a.alias==null&&(a.alias=a.name),!a.name)throw new I("geojson-layer:invalid-field-name","field name is missing",{field:a});if(!Q.jsonValues.includes(a.type))throw new I("geojson-layer:invalid-field-type",`invalid type for field "${a.name}"`,{field:a});if(a.name!==u.name){const g=C(a);g!==void 0&&(h[a.name]=g)}a.length==null&&(a.length=v(a))}if(r){if(r.startTimeField){const a=l.get(r.startTimeField);a?(r.startTimeField=a.name,a.type="esriFieldTypeDate"):r.startTimeField=null}if(r.endTimeField){const a=l.get(r.endTimeField);a?(r.endTimeField=a.name,a.type="esriFieldTypeDate"):r.endTimeField=null}if(r.trackIdField){const a=l.get(r.trackIdField);a?r.trackIdField=a.name:(r.trackIdField=null,n.push({name:"geojson-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:r}}))}r.startTimeField||r.endTimeField||(n.push({name:"geojson-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:r}}),r=null)}const c=p?X(p):void 0,j=l.dateFields.length?{timeZoneIANA:P}:null,f={warnings:n,featureErrors:[],layerDefinition:{...ie,drawingInfo:c??void 0,templates:ee(h),extent:void 0,geometryType:p,objectIdField:y,fields:o,hasZ:!!d,timeInfo:r,dateFieldsTimeReference:j}};this._queryEngine=new K({fieldsIndex:R.fromLayerJSON({fields:o,timeInfo:r,dateFieldsTimeReference:j}),geometryType:p,hasM:!1,hasZ:d,objectIdField:y,spatialReference:m,timeInfo:r,featureStore:new H({geometryType:p,hasM:!1,hasZ:d}),cacheSpatialQueries:!0});const q=this._queryEngine.fieldsIndex.requiredFields.indexOf(u);q>-1&&this._queryEngine.fieldsIndex.requiredFields.splice(q,1),this._createDefaultAttributes=te(h,y);const x=await this._createFeatures(s);this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,x);const $=this._normalizeFeatures(x,f.featureErrors);this._queryEngine.featureStore.addMany($);const{fullExtent:D,timeExtent:S}=await this._queryEngine.fetchRecomputedExtents();if(f.layerDefinition.extent=D,S){const{start:a,end:g}=S;f.layerDefinition.timeInfo.timeExtent=[a,g]}return f}async applyEdits(e){const{spatialReference:t,geometryType:n}=this._queryEngine;return await Promise.all([se(t,n),E(e.adds,t),E(e.updates,t)]),await this._waitSnapshotComplete(),this._applyEdits(e)}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(e){var s;this._loadOptions.customParameters=e,(s=this._snapshotTask)==null||s.abort(),this._snapshotTask=Z(this._snapshotFeatures),this._snapshotTask.promise.then(i=>{this._queryEngine.featureStore.clear(),this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,i);const o=this._normalizeFeatures(i);o&&this._queryEngine.featureStore.addMany(o)},i=>{this._queryEngine.featureStore.clear(),A(i)||N.getLogger("esri.layers.GeoJSONLayer").error(new I("geojson-layer:refresh","An error occurred during refresh",{error:i}))}),await this._waitSnapshotComplete();const{fullExtent:t,timeExtent:n}=await this._queryEngine.fetchRecomputedExtents();return{extent:t,timeExtent:n}}async _createFeatures(e){if(e==null)return[];const{geometryType:t,hasZ:n,objectIdField:s}=this._queryEngine,i=V(e,{geometryType:t,hasZ:n,objectIdField:s});if(!G(this._queryEngine.spatialReference,_))for(const o of i)o.geometry!=null&&(o.geometry=M(b(z(o.geometry,this._queryEngine.geometryType,this._queryEngine.hasZ,!1),_,this._queryEngine.spatialReference)));return i}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(e){const{url:t,customParameters:n}=this._loadOptions,s=(await L(t,{responseType:"json",query:{...n},signal:e})).data;return Y(s),s}_normalizeFeatures(e,t){const{objectIdField:n,fieldsIndex:s}=this._queryEngine,i=[];for(const o of e){const d=this._createDefaultAttributes(),p=T(s,d,o.attributes,!0);p?t==null||t.push(p):(this._assignObjectId(d,o.attributes,!0),o.attributes=d,o.objectId=d[n],i.push(o))}return i}async _applyEdits(e){const{adds:t,updates:n,deletes:s}=e,i={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t!=null&&t.length&&this._applyAddEdits(i,t),n!=null&&n.length&&this._applyUpdateEdits(i,n),s==null?void 0:s.length){for(const p of s)i.deleteResults.push(w(p));this._queryEngine.featureStore.removeManyById(s)}const{fullExtent:o,timeExtent:d}=await this._queryEngine.fetchRecomputedExtents();return{extent:o,timeExtent:d,featureEditResults:i}}_applyAddEdits(e,t){const{addResults:n}=e,{geometryType:s,hasM:i,hasZ:o,objectIdField:d,spatialReference:p,featureStore:y,fieldsIndex:m}=this._queryEngine,r=[];for(const l of t){if(l.geometry&&s!==O(l.geometry)){n.push(F("Incorrect geometry type."));continue}const u=this._createDefaultAttributes(),h=T(m,u,l.attributes);if(h)n.push(h);else{if(this._assignObjectId(u,l.attributes),l.attributes=u,l.uid!=null){const c=l.attributes[d];e.uidToObjectId[l.uid]=c}if(l.geometry!=null){const c=l.geometry.spatialReference??p;l.geometry=b(k(l.geometry,c),c,p)}r.push(l),n.push(w(l.attributes[d]))}}y.addMany(B([],r,s,o,i,d))}_applyUpdateEdits({updateResults:e},t){const{geometryType:n,hasM:s,hasZ:i,objectIdField:o,spatialReference:d,featureStore:p,fieldsIndex:y}=this._queryEngine;for(const m of t){const{attributes:r,geometry:l}=m,u=r==null?void 0:r[o];if(u==null){e.push(F(`Identifier field ${o} missing`));continue}if(!p.has(u)){e.push(F(`Feature with object id ${u} missing`));continue}const h=J(p.getFeature(u),n,i,s);if(l!=null){if(n!==O(l)){e.push(F("Incorrect geometry type."));continue}const c=l.spatialReference??d;h.geometry=b(k(l,c),c,d)}if(r){const c=T(y,h.attributes,r);if(c){e.push(c);continue}}p.add(W(h,n,i,s,o)),e.push(w(u))}}_createObjectIdGenerator(e,t){const n=e.fieldsIndex.get(e.objectIdField);if(n.type==="esriFieldTypeString")return()=>n.name+"-"+Date.now().toString(16);let s=Number.NEGATIVE_INFINITY;for(const i of t)i.objectId&&(s=Math.max(s,i.objectId));return s=Math.max(0,s)+1,()=>s++}_assignObjectId(e,t,n=!1){const s=this._queryEngine.objectIdField;e[s]=n&&s in t?t[s]:this._objectIdGenerator()}async _checkProjection(e){try{await E(_,e)}catch{throw new I("geojson-layer","Projection not supported")}}}export{be as default}; diff --git a/dist/assets/GeoJSONSourceWorker-Sd5A35h-.js b/dist/assets/GeoJSONSourceWorker-Sd5A35h-.js deleted file mode 100644 index a72a89a..0000000 --- a/dist/assets/GeoJSONSourceWorker-Sd5A35h-.js +++ /dev/null @@ -1 +0,0 @@ -import{eV as _,eQ as R,E as I,eP as Q,ga as C,ff as v,eR as Z,b as P,f as A,Z as G,al as N,eU as M,eT as z,bW as W,gb as O,gc as B,gd as J,ge as L}from"./index-J0iiHjMT.js";import{m as U}from"./FeatureStore-X-AIJLo2.js";import{W as V,x as E,j as b}from"./QueryEngine-8tLWlkSE.js";import{I as H,N as K,E as Y}from"./geojson-fSjaGZrp.js";import{o as X,a as ee,i as te}from"./clientSideDefaults-F-CNnR0g.js";import{I as se,p as T,d as w,f as F,w as k}from"./sourceUtils-zbywPEXK.js";import"./BoundsStore-wmwfHjhp.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./date-be_IQzZd.js";const ie={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!1,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};class be{constructor(){this._queryEngine=null,this._snapshotFeatures=async e=>{const t=await this._fetch(e);return this._createFeatures(t)}}destroy(){var e;(e=this._queryEngine)==null||e.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e,t={}){this._loadOptions={url:e.url,customParameters:e.customParameters};const n=[],[s]=await Promise.all([e.url?this._fetch(t==null?void 0:t.signal):null,this._checkProjection(e.spatialReference)]),i=H(s,{geometryType:e.geometryType}),o=e.fields||i.fields||[],d=e.hasZ!=null?e.hasZ:i.hasZ,p=i.geometryType;let y=e.objectIdField||i.objectIdFieldName||"__OBJECTID";const m=e.spatialReference||_;let r=e.timeInfo;o===i.fields&&i.unknownFields.length>0&&n.push({name:"geojson-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:i.unknownFields}});const l=new R(o);let u=l.get(y);u?(u.type!=="esriFieldTypeString"&&(u.type="esriFieldTypeOID"),u.editable=!1,u.nullable=!1,y=u.name):(u={alias:y,name:y,type:i.objectIdFieldType==="string"?"esriFieldTypeString":"esriFieldTypeOID",editable:!1,nullable:!1},o.unshift(u));const h={};for(const a of o){if(a.name==null&&(a.name=a.alias),a.alias==null&&(a.alias=a.name),!a.name)throw new I("geojson-layer:invalid-field-name","field name is missing",{field:a});if(!Q.jsonValues.includes(a.type))throw new I("geojson-layer:invalid-field-type",`invalid type for field "${a.name}"`,{field:a});if(a.name!==u.name){const g=C(a);g!==void 0&&(h[a.name]=g)}a.length==null&&(a.length=v(a))}if(r){if(r.startTimeField){const a=l.get(r.startTimeField);a?(r.startTimeField=a.name,a.type="esriFieldTypeDate"):r.startTimeField=null}if(r.endTimeField){const a=l.get(r.endTimeField);a?(r.endTimeField=a.name,a.type="esriFieldTypeDate"):r.endTimeField=null}if(r.trackIdField){const a=l.get(r.trackIdField);a?r.trackIdField=a.name:(r.trackIdField=null,n.push({name:"geojson-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:r}}))}r.startTimeField||r.endTimeField||(n.push({name:"geojson-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:r}}),r=null)}const c=p?X(p):void 0,j=l.dateFields.length?{timeZoneIANA:Z}:null,f={warnings:n,featureErrors:[],layerDefinition:{...ie,drawingInfo:c??void 0,templates:ee(h),extent:void 0,geometryType:p,objectIdField:y,fields:o,hasZ:!!d,timeInfo:r,dateFieldsTimeReference:j}};this._queryEngine=new V({fieldsIndex:R.fromLayerJSON({fields:o,timeInfo:r,dateFieldsTimeReference:j}),geometryType:p,hasM:!1,hasZ:d,objectIdField:y,spatialReference:m,timeInfo:r,featureStore:new U({geometryType:p,hasM:!1,hasZ:d}),cacheSpatialQueries:!0});const q=this._queryEngine.fieldsIndex.requiredFields.indexOf(u);q>-1&&this._queryEngine.fieldsIndex.requiredFields.splice(q,1),this._createDefaultAttributes=te(h,y);const x=await this._createFeatures(s);this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,x);const $=this._normalizeFeatures(x,f.featureErrors);this._queryEngine.featureStore.addMany($);const{fullExtent:D,timeExtent:S}=await this._queryEngine.fetchRecomputedExtents();if(f.layerDefinition.extent=D,S){const{start:a,end:g}=S;f.layerDefinition.timeInfo.timeExtent=[a,g]}return f}async applyEdits(e){const{spatialReference:t,geometryType:n}=this._queryEngine;return await Promise.all([se(t,n),E(e.adds,t),E(e.updates,t)]),await this._waitSnapshotComplete(),this._applyEdits(e)}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(e){var s;this._loadOptions.customParameters=e,(s=this._snapshotTask)==null||s.abort(),this._snapshotTask=P(this._snapshotFeatures),this._snapshotTask.promise.then(i=>{this._queryEngine.featureStore.clear(),this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,i);const o=this._normalizeFeatures(i);o&&this._queryEngine.featureStore.addMany(o)},i=>{this._queryEngine.featureStore.clear(),A(i)||G.getLogger("esri.layers.GeoJSONLayer").error(new I("geojson-layer:refresh","An error occurred during refresh",{error:i}))}),await this._waitSnapshotComplete();const{fullExtent:t,timeExtent:n}=await this._queryEngine.fetchRecomputedExtents();return{extent:t,timeExtent:n}}async _createFeatures(e){if(e==null)return[];const{geometryType:t,hasZ:n,objectIdField:s}=this._queryEngine,i=K(e,{geometryType:t,hasZ:n,objectIdField:s});if(!N(this._queryEngine.spatialReference,_))for(const o of i)o.geometry!=null&&(o.geometry=M(b(z(o.geometry,this._queryEngine.geometryType,this._queryEngine.hasZ,!1),_,this._queryEngine.spatialReference)));return i}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(e){const{url:t,customParameters:n}=this._loadOptions,s=(await W(t,{responseType:"json",query:{...n},signal:e})).data;return Y(s),s}_normalizeFeatures(e,t){const{objectIdField:n,fieldsIndex:s}=this._queryEngine,i=[];for(const o of e){const d=this._createDefaultAttributes(),p=T(s,d,o.attributes,!0);p?t==null||t.push(p):(this._assignObjectId(d,o.attributes,!0),o.attributes=d,o.objectId=d[n],i.push(o))}return i}async _applyEdits(e){const{adds:t,updates:n,deletes:s}=e,i={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t!=null&&t.length&&this._applyAddEdits(i,t),n!=null&&n.length&&this._applyUpdateEdits(i,n),s==null?void 0:s.length){for(const p of s)i.deleteResults.push(w(p));this._queryEngine.featureStore.removeManyById(s)}const{fullExtent:o,timeExtent:d}=await this._queryEngine.fetchRecomputedExtents();return{extent:o,timeExtent:d,featureEditResults:i}}_applyAddEdits(e,t){const{addResults:n}=e,{geometryType:s,hasM:i,hasZ:o,objectIdField:d,spatialReference:p,featureStore:y,fieldsIndex:m}=this._queryEngine,r=[];for(const l of t){if(l.geometry&&s!==O(l.geometry)){n.push(F("Incorrect geometry type."));continue}const u=this._createDefaultAttributes(),h=T(m,u,l.attributes);if(h)n.push(h);else{if(this._assignObjectId(u,l.attributes),l.attributes=u,l.uid!=null){const c=l.attributes[d];e.uidToObjectId[l.uid]=c}if(l.geometry!=null){const c=l.geometry.spatialReference??p;l.geometry=b(k(l.geometry,c),c,p)}r.push(l),n.push(w(l.attributes[d]))}}y.addMany(B([],r,s,o,i,d))}_applyUpdateEdits({updateResults:e},t){const{geometryType:n,hasM:s,hasZ:i,objectIdField:o,spatialReference:d,featureStore:p,fieldsIndex:y}=this._queryEngine;for(const m of t){const{attributes:r,geometry:l}=m,u=r==null?void 0:r[o];if(u==null){e.push(F(`Identifier field ${o} missing`));continue}if(!p.has(u)){e.push(F(`Feature with object id ${u} missing`));continue}const h=J(p.getFeature(u),n,i,s);if(l!=null){if(n!==O(l)){e.push(F("Incorrect geometry type."));continue}const c=l.spatialReference??d;h.geometry=b(k(l,c),c,d)}if(r){const c=T(y,h.attributes,r);if(c){e.push(c);continue}}p.add(L(h,n,i,s,o)),e.push(w(u))}}_createObjectIdGenerator(e,t){const n=e.fieldsIndex.get(e.objectIdField);if(n.type==="esriFieldTypeString")return()=>n.name+"-"+Date.now().toString(16);let s=Number.NEGATIVE_INFINITY;for(const i of t)i.objectId&&(s=Math.max(s,i.objectId));return s=Math.max(0,s)+1,()=>s++}_assignObjectId(e,t,n=!1){const s=this._queryEngine.objectIdField;e[s]=n&&s in t?t[s]:this._objectIdGenerator()}async _checkProjection(e){try{await E(_,e)}catch{throw new I("geojson-layer","Projection not supported")}}}export{be as default}; diff --git a/dist/assets/GeoRSSLayer-hfhcgYql.js b/dist/assets/GeoRSSLayer-mvh9EmL0.js similarity index 73% rename from dist/assets/GeoRSSLayer-hfhcgYql.js rename to dist/assets/GeoRSSLayer-mvh9EmL0.js index 92d5d30..293d6cc 100644 --- a/dist/assets/GeoRSSLayer-hfhcgYql.js +++ b/dist/assets/GeoRSSLayer-mvh9EmL0.js @@ -1 +1 @@ -import{dK as y,dL as p,dM as d,dN as u,dO as c,dP as h,dh as S,dQ as m,bW as g,dR as v,dS as f,e as o,y as s,dt as b,dT as C,dU as G,dV as $,dW as P,c as R,dX as n,a8 as _,dY as k,J as w,bX as x,c7 as j}from"./index-J0iiHjMT.js";const F=["atom","xml"],M={base:n,key:"type",typeMap:{"simple-line":_},errorContext:"symbol"},E={base:n,key:"type",typeMap:{"picture-marker":k,"simple-marker":w},errorContext:"symbol"},L={base:n,key:"type",typeMap:{"simple-fill":x},errorContext:"symbol"};let t=class extends y(p(d(u(c(h(j)))))){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.legendEnabled=!0,this.lineSymbol=null,this.pointSymbol=null,this.polygonSymbol=null,this.operationalLayerType="GeoRSS",this.url=null,this.type="geo-rss"}normalizeCtorArgs(e,r){return typeof e=="string"?{url:e,...r}:e}readFeatureCollections(e,r){return r.featureCollection.layers.forEach(i=>{var a;const l=i.layerDefinition.drawingInfo.renderer.symbol;l&&l.type==="esriSFS"&&((a=l.outline)!=null&&a.style.includes("esriSFS"))&&(l.outline.style="esriSLSSolid")}),r.featureCollection.layers}get hasPoints(){return this._hasGeometry("esriGeometryPoint")}get hasPolylines(){return this._hasGeometry("esriGeometryPolyline")}get hasPolygons(){return this._hasGeometry("esriGeometryPolygon")}get title(){const e=this._get("title");return e&&this.originOf("title")!=="defaults"?e:this.url?S(this.url,F)||"GeoRSS":e||""}set title(e){this._set("title",e)}load(e){const r=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service","Feature Service","Feature Collection","Scene Service"]},e).catch(m).then(()=>this._fetchService(r)).then(i=>{this.read(i,{origin:"service"})})),Promise.resolve(this)}async hasDataChanged(){const e=await this._fetchService();return this.read(e,{origin:"service",ignoreDefaults:!0}),!0}async _fetchService(e){const r=this.spatialReference,{data:i}=await g(f.geoRSSServiceUrl,{query:{url:this.url,refresh:!!this.loaded||void 0,outSR:v(r)?void 0:r.wkid??JSON.stringify(r)},signal:e});return i}_hasGeometry(e){var r;return((r=this.featureCollections)==null?void 0:r.some(i=>{var l,a;return((l=i.featureSet)==null?void 0:l.geometryType)===e&&((a=i.featureSet.features)==null?void 0:a.length)>0}))??!1}};o([s()],t.prototype,"description",void 0),o([s()],t.prototype,"featureCollections",void 0),o([b("service","featureCollections",["featureCollection.layers"])],t.prototype,"readFeatureCollections",null),o([s({type:C,json:{name:"lookAtExtent"}})],t.prototype,"fullExtent",void 0),o([s(G)],t.prototype,"id",void 0),o([s($)],t.prototype,"legendEnabled",void 0),o([s({types:M,json:{write:!0}})],t.prototype,"lineSymbol",void 0),o([s({type:["show","hide"]})],t.prototype,"listMode",void 0),o([s({types:E,json:{write:!0}})],t.prototype,"pointSymbol",void 0),o([s({types:L,json:{write:!0}})],t.prototype,"polygonSymbol",void 0),o([s({type:["GeoRSS"]})],t.prototype,"operationalLayerType",void 0),o([s(P)],t.prototype,"url",void 0),o([s({json:{origins:{service:{read:{source:"name",reader:e=>e||void 0}}}}})],t.prototype,"title",null),o([s({readOnly:!0,json:{read:!1},value:"geo-rss"})],t.prototype,"type",void 0),t=o([R("esri.layers.GeoRSSLayer")],t);const O=t;export{O as default}; +import{dF as y,dG as p,dH as d,dI as u,dJ as h,dK as c,dh as S,dL as m,av as v,dM as g,dN as f,e as o,y as s,dt as b,dO as C,dP as G,dQ as $,dR as w,c as x,dS as n,a6 as P,dT as R,x as _,aw as k,aI as j}from"./index-pCX-0tJH.js";const F=["atom","xml"],M={base:n,key:"type",typeMap:{"simple-line":P},errorContext:"symbol"},E={base:n,key:"type",typeMap:{"picture-marker":R,"simple-marker":_},errorContext:"symbol"},L={base:n,key:"type",typeMap:{"simple-fill":k},errorContext:"symbol"};let t=class extends y(p(d(u(h(c(j)))))){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.legendEnabled=!0,this.lineSymbol=null,this.pointSymbol=null,this.polygonSymbol=null,this.operationalLayerType="GeoRSS",this.url=null,this.type="geo-rss"}normalizeCtorArgs(e,r){return typeof e=="string"?{url:e,...r}:e}readFeatureCollections(e,r){return r.featureCollection.layers.forEach(i=>{var a;const l=i.layerDefinition.drawingInfo.renderer.symbol;l&&l.type==="esriSFS"&&((a=l.outline)!=null&&a.style.includes("esriSFS"))&&(l.outline.style="esriSLSSolid")}),r.featureCollection.layers}get hasPoints(){return this._hasGeometry("esriGeometryPoint")}get hasPolylines(){return this._hasGeometry("esriGeometryPolyline")}get hasPolygons(){return this._hasGeometry("esriGeometryPolygon")}get title(){const e=this._get("title");return e&&this.originOf("title")!=="defaults"?e:this.url?S(this.url,F)||"GeoRSS":e||""}set title(e){this._set("title",e)}load(e){const r=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service","Feature Service","Feature Collection","Scene Service"]},e).catch(m).then(()=>this._fetchService(r)).then(i=>{this.read(i,{origin:"service"})})),Promise.resolve(this)}async hasDataChanged(){const e=await this._fetchService();return this.read(e,{origin:"service",ignoreDefaults:!0}),!0}async _fetchService(e){const r=this.spatialReference,{data:i}=await v(f.geoRSSServiceUrl,{query:{url:this.url,refresh:!!this.loaded||void 0,outSR:g(r)?void 0:r.wkid??JSON.stringify(r)},signal:e});return i}_hasGeometry(e){var r;return((r=this.featureCollections)==null?void 0:r.some(i=>{var l,a;return((l=i.featureSet)==null?void 0:l.geometryType)===e&&((a=i.featureSet.features)==null?void 0:a.length)>0}))??!1}};o([s()],t.prototype,"description",void 0),o([s()],t.prototype,"featureCollections",void 0),o([b("service","featureCollections",["featureCollection.layers"])],t.prototype,"readFeatureCollections",null),o([s({type:C,json:{name:"lookAtExtent"}})],t.prototype,"fullExtent",void 0),o([s(G)],t.prototype,"id",void 0),o([s($)],t.prototype,"legendEnabled",void 0),o([s({types:M,json:{write:!0}})],t.prototype,"lineSymbol",void 0),o([s({type:["show","hide"]})],t.prototype,"listMode",void 0),o([s({types:E,json:{write:!0}})],t.prototype,"pointSymbol",void 0),o([s({types:L,json:{write:!0}})],t.prototype,"polygonSymbol",void 0),o([s({type:["GeoRSS"]})],t.prototype,"operationalLayerType",void 0),o([s(w)],t.prototype,"url",void 0),o([s({json:{origins:{service:{read:{source:"name",reader:e=>e||void 0}}}}})],t.prototype,"title",null),o([s({readOnly:!0,json:{read:!1},value:"geo-rss"})],t.prototype,"type",void 0),t=o([x("esri.layers.GeoRSSLayer")],t);const I=t;export{I as default}; diff --git a/dist/assets/GraphicManipulator-59Uc2I6c.js b/dist/assets/GraphicManipulator-59Uc2I6c.js new file mode 100644 index 0000000..90cf70a --- /dev/null +++ b/dist/assets/GraphicManipulator-59Uc2I6c.js @@ -0,0 +1 @@ +import{gL as u,e as n,g as x,hz as D,hA as w,z,B as G,a9 as M,hB as I,bY as f,hC as _,cj as H,dW as L,d5 as E,by as Y,y as a,c as k,a8 as O,c3 as R}from"./index-pCX-0tJH.js";import{i as X}from"./drapedUtils-F1ywqHD-.js";function j(e){let s=0,i=0,t=0;return e?(e.type==="cim"&&e.data.symbol&&"symbolLayers"in e.data.symbol&&e.data.symbol.symbolLayers&&e.data.symbol.symbolLayers.map(l=>{l.type==="CIMVectorMarker"&&l.anchorPoint&&(Math.abs(l.anchorPoint.x)>s&&(s=l.anchorPoint.x),Math.abs(l.anchorPoint.y)>i&&(i=l.anchorPoint.y),l.size!=null&&l.size>t&&(t=l.size))}),s=u(s),i=u(i),t=u(t),{offsetX:s,offsetY:i,size:t}):{offsetX:s,offsetY:i,size:t}}let o=class extends x{set graphic(e){this._circleCollisionCache=null,this._originalSymbol=e.symbol,this._set("graphic",e),this.attachSymbolChanged()}get elevationInfo(){const{layer:e}=this.graphic,s=e&&"elevationInfo"in e?e.elevationInfo:null,i=D(this.graphic),t=s?s.offset:0;return new w({mode:i,offset:t})}set focusedSymbol(e){e!==this._get("focusedSymbol")&&(this._set("focusedSymbol",e),this._updateGraphicSymbol(),this._circleCollisionCache=null)}grabbableForEvent(){return!0}set grabbing(e){e!==this._get("grabbing")&&(this._set("grabbing",e),this._updateGraphicSymbol())}set hovering(e){e!==this._get("hovering")&&(this._set("hovering",e),this._updateGraphicSymbol())}set selected(e){e!==this._get("selected")&&(this._set("selected",e),this._updateGraphicSymbol(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get _focused(){return this._get("hovering")||this._get("grabbing")}constructor(e){super(e),this.layer=null,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.dragging=!1,this.cursor=null,this.consumesClicks=!0,this.events=new z.EventEmitter,this._circleCollisionCache=null,this._graphicSymbolChangedHandle=null,this._originalSymbol=null}destroy(){this.detachSymbolChanged(),this._resetGraphicSymbol(),this._set("view",null)}intersectionDistance(e){const s=this.graphic;if(s.visible===!1)return null;const i=s.geometry;if(i==null)return null;const t=this._get("focusedSymbol"),l=t??s.symbol;return this.view.type==="2d"?this._intersectDistance2D(this.view,e,i,l):this._intersectDistance3D(this.view,e,s)}attach(){this.attachSymbolChanged(),this.layer!=null&&this.layer.add(this.graphic)}detach(){this.detachSymbolChanged(),this._resetGraphicSymbol(),this.layer!=null&&this.layer.remove(this.graphic)}attachSymbolChanged(){this.detachSymbolChanged(),this._graphicSymbolChangedHandle=G(()=>{var e;return(e=this.graphic)==null?void 0:e.symbol},e=>{e!=null&&e!==this.focusedSymbol&&e!==this._originalSymbol&&(this._originalSymbol=e,this._focused&&this.focusedSymbol!=null&&(this.graphic.symbol=this.focusedSymbol))},M)}detachSymbolChanged(){this._graphicSymbolChangedHandle!=null&&(this._graphicSymbolChangedHandle.remove(),this._graphicSymbolChangedHandle=null)}onElevationChange(){}onViewChange(){}_updateGraphicSymbol(){this.graphic.symbol=this._focused&&this.focusedSymbol!=null?this.focusedSymbol:this._originalSymbol}_resetGraphicSymbol(){this.graphic.symbol=this._originalSymbol}_intersectDistance2D(e,s,i,t){var g,d;if((t=t||I(i))==null)return null;const l=1;let h=this._circleCollisionCache;if(i.type==="point"&&t.type==="cim"&&((g=t.data.symbol)==null?void 0:g.type)==="CIMPointSymbol"&&t.data.symbol.symbolLayers){const{offsetX:c,offsetY:r,size:y}=j(t),p=f(s,v),b=y/2,m=e.toScreen(i),C=m.x+c,P=m.y+r;return _(p,[C,P]){l.type==="CIMVectorMarker"&&l.anchorPoint&&(Math.abs(l.anchorPoint.x)>s&&(s=l.anchorPoint.x),Math.abs(l.anchorPoint.y)>i&&(i=l.anchorPoint.y),l.size!=null&&l.size>t&&(t=l.size))}),s=u(s),i=u(i),t=u(t),{offsetX:s,offsetY:i,size:t}):{offsetX:s,offsetY:i,size:t}}let o=class extends x{set graphic(e){this._circleCollisionCache=null,this._originalSymbol=e.symbol,this._set("graphic",e),this.attachSymbolChanged()}get elevationInfo(){const{layer:e}=this.graphic,s=e&&"elevationInfo"in e?e.elevationInfo:null,i=D(this.graphic),t=s?s.offset:0;return new w({mode:i,offset:t})}set focusedSymbol(e){e!==this._get("focusedSymbol")&&(this._set("focusedSymbol",e),this._updateGraphicSymbol(),this._circleCollisionCache=null)}grabbableForEvent(){return!0}set grabbing(e){e!==this._get("grabbing")&&(this._set("grabbing",e),this._updateGraphicSymbol())}set hovering(e){e!==this._get("hovering")&&(this._set("hovering",e),this._updateGraphicSymbol())}set selected(e){e!==this._get("selected")&&(this._set("selected",e),this._updateGraphicSymbol(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get _focused(){return this._get("hovering")||this._get("grabbing")}constructor(e){super(e),this.layer=null,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.dragging=!1,this.cursor=null,this.consumesClicks=!0,this.events=new G.EventEmitter,this._circleCollisionCache=null,this._graphicSymbolChangedHandle=null,this._originalSymbol=null}destroy(){this.detachSymbolChanged(),this._resetGraphicSymbol(),this._set("view",null)}intersectionDistance(e){const s=this.graphic;if(s.visible===!1)return null;const i=s.geometry;if(i==null)return null;const t=this._get("focusedSymbol"),l=t??s.symbol;return this.view.type==="2d"?this._intersectDistance2D(this.view,e,i,l):this._intersectDistance3D(this.view,e,s)}attach(){this.attachSymbolChanged(),this.layer!=null&&this.layer.add(this.graphic)}detach(){this.detachSymbolChanged(),this._resetGraphicSymbol(),this.layer!=null&&this.layer.remove(this.graphic)}attachSymbolChanged(){this.detachSymbolChanged(),this._graphicSymbolChangedHandle=z(()=>{var e;return(e=this.graphic)==null?void 0:e.symbol},e=>{e!=null&&e!==this.focusedSymbol&&e!==this._originalSymbol&&(this._originalSymbol=e,this._focused&&this.focusedSymbol!=null&&(this.graphic.symbol=this.focusedSymbol))},M)}detachSymbolChanged(){this._graphicSymbolChangedHandle!=null&&(this._graphicSymbolChangedHandle.remove(),this._graphicSymbolChangedHandle=null)}onElevationChange(){}onViewChange(){}_updateGraphicSymbol(){this.graphic.symbol=this._focused&&this.focusedSymbol!=null?this.focusedSymbol:this._originalSymbol}_resetGraphicSymbol(){this.graphic.symbol=this._originalSymbol}_intersectDistance2D(e,s,i,t){var g,d;if((t=t||I(i))==null)return null;const l=1;let h=this._circleCollisionCache;if(i.type==="point"&&t.type==="cim"&&((g=t.data.symbol)==null?void 0:g.type)==="CIMPointSymbol"&&t.data.symbol.symbolLayers){const{offsetX:c,offsetY:r,size:y}=J(t),b=f(s,v),p=y/2,m=e.toScreen(i),C=m.x+c,P=m.y+r;return _(b,[C,P])this._highlight(s))}remove(i){const e=!i||Array.isArray(i)?i:[i];e!=null&&e.length&&e.forEach(s=>this._unhighlight(s))}removeAll(){this.removeAllHandles()}_highlight(i){const e=O(this.view,i.layer);M(e)&&this.addHandles(e.highlight(i),b(i))}_unhighlight(i){i&&this.removeHandles(b(i))}};l([p()],f.prototype,"view",void 0),f=l([E("esri.views.draw.support.HighlightHelper")],f);const L=f;class V{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-click"}}class C{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-double-click"}}class z{constructor(i,e,s,h,r,a,o,d,v,g){this.graphic=i,this.allGraphics=e,this.index=s,this.x=h,this.y=r,this.dx=a,this.dy=o,this.totalDx=d,this.totalDy=v,this.viewEvent=g,this.defaultPrevented=!1,this.type="graphic-move-start"}preventDefault(){this.defaultPrevented=!0}}class F{constructor(i,e,s,h,r,a,o,d,v,g){this.graphic=i,this.allGraphics=e,this.index=s,this.x=h,this.y=r,this.dx=a,this.dy=o,this.totalDx=d,this.totalDy=v,this.viewEvent=g,this.defaultPrevented=!1,this.type="graphic-move"}preventDefault(){this.defaultPrevented=!0}}class j{constructor(i,e,s,h,r,a,o,d,v,g){this.graphic=i,this.allGraphics=e,this.index=s,this.x=h,this.y=r,this.dx=a,this.dy=o,this.totalDx=d,this.totalDy=v,this.viewEvent=g,this.defaultPrevented=!1,this.type="graphic-move-stop"}preventDefault(){this.defaultPrevented=!0}}class q{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-pointer-over"}}class x{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-pointer-out"}}class X{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-pointer-down"}}class J{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-pointer-up"}}const k="indicator-symbols";let n=class extends P.EventedAccessor{constructor(t){super(t),this._activeGraphic=null,this._dragEvent=null,this._hoverGraphic=null,this._indicators=[],this._initialDragGeometry=null,this._manipulators=[],this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.indicatorsEnabled=!1,this.layer=new D({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.view=null}initialize(){U(this.view,this.layer),this._highlightHelper=new L({view:this.view}),this.refresh(),this.addHandles([m(()=>this.graphics.length,()=>this.refresh()),A(()=>{var t;return(t=this.view)==null?void 0:t.ready},()=>{this.addHandles([this.view.on("immediate-click",t=>this._clickHandler(t),y.TOOL),this.view.on("double-click",t=>this._doubleClickHandler(t),y.TOOL),this.view.on("pointer-down",t=>this._pointerDownHandler(t),y.TOOL),this.view.on("pointer-move",t=>this._pointerMoveHandler(t),y.TOOL),this.view.on("pointer-up",t=>this._pointerUpHandler(t),y.TOOL),this.view.on("drag",t=>this._dragHandler(t),y.TOOL),this.view.on("key-down",t=>this._keyDownHandler(t),y.TOOL)])},{once:!0,initial:!0}),m(()=>this.view,t=>{this._highlightHelper.removeAll(),this._highlightHelper.view=t})])}destroy(){var t;this._removeIndicators(),(t=this.view.map)==null||t.remove(this.layer),this.layer.destroy(),this.reset(),this._manipulators.forEach(i=>i.destroy()),this._manipulators=null}set highlightsEnabled(t){var i,e;(i=this._highlightHelper)==null||i.removeAll(),this._set("highlightsEnabled",t),t&&((e=this._highlightHelper)==null||e.add(this.graphics))}get state(){const t=this.view.ready,i=this.graphics.length>0,e=this._activeGraphic;return t&&i?e?"moving":"active":t?"ready":"disabled"}refresh(){this.reset(),this._setup()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null,this._highlightHelper.removeAll()}updateGeometry(t,i){const e=this.graphics[t];e&&(e.set("geometry",i),this._setUpIndicators())}_setup(){this._setUpHighlights(),this._setUpIndicators(),this._setUpManipulators(),this._syncLayerViews()}_clickHandler(t){const i=this._findTargetGraphic(_(t));if(i){const e=new V(i,this.graphics.indexOf(i),t.x,t.y,t);this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e)}}_doubleClickHandler(t){const i=this._findTargetGraphic(_(t));if(i){const e=new C(i,this.graphics.indexOf(i),t.x,t.y,t);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick&&this.callbacks.onGraphicDoubleClick(e)}}_pointerDownHandler(t){const i=this._findTargetGraphic(_(t));if(i){this._activeGraphic=i;const{x:e,y:s}=t,h=new X(i,this.graphics.indexOf(i),e,s,t);this.emit("graphic-pointer-down",h),this.callbacks.onGraphicPointerDown&&this.callbacks.onGraphicPointerDown(h)}else this._activeGraphic=null}_pointerUpHandler(t){if(this._activeGraphic){const{x:i,y:e}=t,s=this.graphics.indexOf(this._activeGraphic),h=new J(this._activeGraphic,s,i,e,t);this.emit("graphic-pointer-up",h),this.callbacks.onGraphicPointerUp&&this.callbacks.onGraphicPointerUp(h)}}_pointerMoveHandler(t){if(this._dragEvent)return;const i=this._findTargetGraphic(_(t));if(i){const{x:e,y:s}=t;if(this._hoverGraphic){if(this._hoverGraphic===i)return;const a=this.graphics.indexOf(this._hoverGraphic),o=new x(this.graphics[a],a,e,s,t);this._hoverGraphic=null,this.emit("graphic-pointer-out",o),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(o)}const h=this.graphics.indexOf(i),r=new q(i,h,e,s,t);return this._hoverGraphic=i,this.emit("graphic-pointer-over",r),void(this.callbacks.onGraphicPointerOver&&this.callbacks.onGraphicPointerOver(r))}if(this._hoverGraphic){const{x:e,y:s}=t,h=this.graphics.indexOf(this._hoverGraphic),r=new x(this.graphics[h],h,e,s,t);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(r)}}_dragHandler(t){var w;if(t.action!=="start"&&!this._dragEvent||!((w=this._activeGraphic)!=null&&w.geometry))return;t.action==="start"&&this._removeIndicators(),t.stopPropagation();const{action:i,x:e,y:s}=t,h=this.graphics.indexOf(this._activeGraphic),r=this._dragEvent?e-this._dragEvent.x:0,a=this._dragEvent?s-this._dragEvent.y:0,o=e-t.origin.x,d=s-t.origin.y,v=i==="start"?this._activeGraphic.geometry:this._initialDragGeometry,g=G(v,o,d,this.view);if(this._activeGraphic.geometry=g,this.enableMoveAllGraphics&&this.graphics.forEach(c=>{c!==this._activeGraphic&&(c.geometry=G(c.geometry,r,a,this.view))}),this._dragEvent=t,i==="start"){this._initialDragGeometry=$(v);const c=new z(this._activeGraphic,this.graphics,h,e,s,r,a,o,d,t);this.emit("graphic-move-start",c),this.callbacks.onGraphicMoveStart&&this.callbacks.onGraphicMoveStart(c),c.defaultPrevented&&this._activeGraphic.set("geometry",v)}else if(i==="update"){const c=new F(this._activeGraphic,this.graphics,h,e,s,r,a,o,d,t);this.emit("graphic-move",c),this.callbacks.onGraphicMove&&this.callbacks.onGraphicMove(c),c.defaultPrevented&&(this._activeGraphic.geometry=v)}else{const c=new j(this._activeGraphic,this.graphics,h,e,s,r,a,o,d,t);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",c),this.callbacks.onGraphicMoveStop&&this.callbacks.onGraphicMoveStop(c),c.defaultPrevented&&(this.graphics[h].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(t){t.key!=="a"&&t.key!=="d"&&t.key!=="n"||this.state!=="moving"||t.stopPropagation()}_findTargetGraphic(t){const i=this.view.toMap(t),e=this.graphics;let s=null,h=Number.MAX_VALUE;this._syncLayerViews();const r=this._layerViews.flatMap(a=>"graphicsViews"in a?Array.from(a.graphicsViews(),o=>o.hitTest(i)).flat():a.graphicsView.hitTest(i)).filter(a=>e.includes(a)).sort((a,o)=>e.indexOf(a)-e.indexOf(o));return r.length?r[0]:(this._manipulators.forEach(a=>{const o=a.intersectionDistance(t);o!=null&&oe.destroy()),this._manipulators=t.length?t.map(e=>new I({graphic:e,view:i})):[]}_setUpHighlights(){this.highlightsEnabled&&this._highlightHelper.add(this.graphics)}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const t of this.graphics){const i=t.clone();i.symbol=this._getSymbolForIndicator(t),this._indicators.push(i),this.addHandles(m(()=>t.symbol,()=>this._setUpIndicators()),k)}this.layer.addMany(this._indicators)}}_removeIndicators(){this.removeHandles(k),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach(t=>t.destroy()),this._indicators=[])}_getSymbolForIndicator(t){if(t.symbol==null)return null;switch(t.symbol.type){case"cim":return new u({style:"circle",size:12,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:e,yoffset:s,height:h,width:r}=t.symbol,a=h===r?r:Math.max(h,r);return new u({xoffset:e,yoffset:s,size:a,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:e,yoffset:s,size:h,style:r}=t.symbol;return new u({xoffset:e,yoffset:s,style:r==="circle"?"circle":"square",size:h+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new S({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new T({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=t.symbol;return new u({xoffset:e,yoffset:s,size:12,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}};l([p()],n.prototype,"_activeGraphic",void 0),l([p({readOnly:!0})],n.prototype,"type",void 0),l([p()],n.prototype,"callbacks",void 0),l([p()],n.prototype,"enableMoveAllGraphics",void 0),l([p()],n.prototype,"graphics",void 0),l([p({value:!1})],n.prototype,"highlightsEnabled",null),l([p()],n.prototype,"indicatorsEnabled",void 0),l([p()],n.prototype,"layer",void 0),l([p({readOnly:!0})],n.prototype,"state",null),l([p()],n.prototype,"view",void 0),n=l([E("esri.views.draw.support.GraphicMover")],n);const K=n,Y=Object.freeze(Object.defineProperty({__proto__:null,default:K},Symbol.toStringTag,{value:"Module"}));export{Y as G,K as U,L as l}; +import{e as l,y as p,c as E,g as H,kG as O,ku as M,z as P,G as D,S as U,B as w,v as A,kH as _,ah as T,x as u,a6 as $,aw as S,_ as y}from"./index-pCX-0tJH.js";import{i as G}from"./drawUtils-0wb2c6-q.js";import{F as b}from"./featureUtils-aSzMyCi0.js";import{S as I}from"./GraphicManipulator-59Uc2I6c.js";let f=class extends H{constructor(i){super(i),this.view=null}add(i){const e=!i||Array.isArray(i)?i:[i];e!=null&&e.length&&e.forEach(s=>this._highlight(s))}remove(i){const e=!i||Array.isArray(i)?i:[i];e!=null&&e.length&&e.forEach(s=>this._unhighlight(s))}removeAll(){this.removeAllHandles()}_highlight(i){const e=O(this.view,i.layer);M(e)&&this.addHandles(e.highlight(i),b(i))}_unhighlight(i){i&&this.removeHandles(b(i))}};l([p()],f.prototype,"view",void 0),f=l([E("esri.views.draw.support.HighlightHelper")],f);const L=f;class V{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-click"}}class z{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-double-click"}}class C{constructor(i,e,s,h,r,a,o,d,v,g){this.graphic=i,this.allGraphics=e,this.index=s,this.x=h,this.y=r,this.dx=a,this.dy=o,this.totalDx=d,this.totalDy=v,this.viewEvent=g,this.defaultPrevented=!1,this.type="graphic-move-start"}preventDefault(){this.defaultPrevented=!0}}class F{constructor(i,e,s,h,r,a,o,d,v,g){this.graphic=i,this.allGraphics=e,this.index=s,this.x=h,this.y=r,this.dx=a,this.dy=o,this.totalDx=d,this.totalDy=v,this.viewEvent=g,this.defaultPrevented=!1,this.type="graphic-move"}preventDefault(){this.defaultPrevented=!0}}class j{constructor(i,e,s,h,r,a,o,d,v,g){this.graphic=i,this.allGraphics=e,this.index=s,this.x=h,this.y=r,this.dx=a,this.dy=o,this.totalDx=d,this.totalDy=v,this.viewEvent=g,this.defaultPrevented=!1,this.type="graphic-move-stop"}preventDefault(){this.defaultPrevented=!0}}class q{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-pointer-over"}}class x{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-pointer-out"}}class B{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-pointer-down"}}class N{constructor(i,e,s,h,r){this.graphic=i,this.index=e,this.x=s,this.y=h,this.viewEvent=r,this.type="graphic-pointer-up"}}const k="indicator-symbols";let n=class extends P.EventedAccessor{constructor(t){super(t),this._activeGraphic=null,this._dragEvent=null,this._hoverGraphic=null,this._indicators=[],this._initialDragGeometry=null,this._manipulators=[],this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.indicatorsEnabled=!1,this.layer=new D({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.view=null}initialize(){U(this.view,this.layer),this._highlightHelper=new L({view:this.view}),this.refresh(),this.addHandles([w(()=>this.graphics.length,()=>this.refresh()),A(()=>{var t;return(t=this.view)==null?void 0:t.ready},()=>{this.addHandles([this.view.on("immediate-click",t=>this._clickHandler(t),y.TOOL),this.view.on("double-click",t=>this._doubleClickHandler(t),y.TOOL),this.view.on("pointer-down",t=>this._pointerDownHandler(t),y.TOOL),this.view.on("pointer-move",t=>this._pointerMoveHandler(t),y.TOOL),this.view.on("pointer-up",t=>this._pointerUpHandler(t),y.TOOL),this.view.on("drag",t=>this._dragHandler(t),y.TOOL),this.view.on("key-down",t=>this._keyDownHandler(t),y.TOOL)])},{once:!0,initial:!0}),w(()=>this.view,t=>{this._highlightHelper.removeAll(),this._highlightHelper.view=t})])}destroy(){var t;this._removeIndicators(),(t=this.view.map)==null||t.remove(this.layer),this.layer.destroy(),this.reset(),this._manipulators.forEach(i=>i.destroy()),this._manipulators=null}set highlightsEnabled(t){var i,e;(i=this._highlightHelper)==null||i.removeAll(),this._set("highlightsEnabled",t),t&&((e=this._highlightHelper)==null||e.add(this.graphics))}get state(){const t=this.view.ready,i=this.graphics.length>0,e=this._activeGraphic;return t&&i?e?"moving":"active":t?"ready":"disabled"}refresh(){this.reset(),this._setup()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null,this._highlightHelper.removeAll()}updateGeometry(t,i){const e=this.graphics[t];e&&(e.set("geometry",i),this._setUpIndicators())}_setup(){this._setUpHighlights(),this._setUpIndicators(),this._setUpManipulators(),this._syncLayerViews()}_clickHandler(t){const i=this._findTargetGraphic(_(t));if(i){const e=new V(i,this.graphics.indexOf(i),t.x,t.y,t);this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e)}}_doubleClickHandler(t){const i=this._findTargetGraphic(_(t));if(i){const e=new z(i,this.graphics.indexOf(i),t.x,t.y,t);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick&&this.callbacks.onGraphicDoubleClick(e)}}_pointerDownHandler(t){const i=this._findTargetGraphic(_(t));if(i){this._activeGraphic=i;const{x:e,y:s}=t,h=new B(i,this.graphics.indexOf(i),e,s,t);this.emit("graphic-pointer-down",h),this.callbacks.onGraphicPointerDown&&this.callbacks.onGraphicPointerDown(h)}else this._activeGraphic=null}_pointerUpHandler(t){if(this._activeGraphic){const{x:i,y:e}=t,s=this.graphics.indexOf(this._activeGraphic),h=new N(this._activeGraphic,s,i,e,t);this.emit("graphic-pointer-up",h),this.callbacks.onGraphicPointerUp&&this.callbacks.onGraphicPointerUp(h)}}_pointerMoveHandler(t){if(this._dragEvent)return;const i=this._findTargetGraphic(_(t));if(i){const{x:e,y:s}=t;if(this._hoverGraphic){if(this._hoverGraphic===i)return;const a=this.graphics.indexOf(this._hoverGraphic),o=new x(this.graphics[a],a,e,s,t);this._hoverGraphic=null,this.emit("graphic-pointer-out",o),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(o)}const h=this.graphics.indexOf(i),r=new q(i,h,e,s,t);return this._hoverGraphic=i,this.emit("graphic-pointer-over",r),void(this.callbacks.onGraphicPointerOver&&this.callbacks.onGraphicPointerOver(r))}if(this._hoverGraphic){const{x:e,y:s}=t,h=this.graphics.indexOf(this._hoverGraphic),r=new x(this.graphics[h],h,e,s,t);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(r)}}_dragHandler(t){var m;if(t.action!=="start"&&!this._dragEvent||!((m=this._activeGraphic)!=null&&m.geometry))return;t.action==="start"&&this._removeIndicators(),t.stopPropagation();const{action:i,x:e,y:s}=t,h=this.graphics.indexOf(this._activeGraphic),r=this._dragEvent?e-this._dragEvent.x:0,a=this._dragEvent?s-this._dragEvent.y:0,o=e-t.origin.x,d=s-t.origin.y,v=i==="start"?this._activeGraphic.geometry:this._initialDragGeometry,g=G(v,o,d,this.view);if(this._activeGraphic.geometry=g,this.enableMoveAllGraphics&&this.graphics.forEach(c=>{c!==this._activeGraphic&&(c.geometry=G(c.geometry,r,a,this.view))}),this._dragEvent=t,i==="start"){this._initialDragGeometry=T(v);const c=new C(this._activeGraphic,this.graphics,h,e,s,r,a,o,d,t);this.emit("graphic-move-start",c),this.callbacks.onGraphicMoveStart&&this.callbacks.onGraphicMoveStart(c),c.defaultPrevented&&this._activeGraphic.set("geometry",v)}else if(i==="update"){const c=new F(this._activeGraphic,this.graphics,h,e,s,r,a,o,d,t);this.emit("graphic-move",c),this.callbacks.onGraphicMove&&this.callbacks.onGraphicMove(c),c.defaultPrevented&&(this._activeGraphic.geometry=v)}else{const c=new j(this._activeGraphic,this.graphics,h,e,s,r,a,o,d,t);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",c),this.callbacks.onGraphicMoveStop&&this.callbacks.onGraphicMoveStop(c),c.defaultPrevented&&(this.graphics[h].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(t){t.key!=="a"&&t.key!=="d"&&t.key!=="n"||this.state!=="moving"||t.stopPropagation()}_findTargetGraphic(t){const i=this.view.toMap(t),e=this.graphics;let s=null,h=Number.MAX_VALUE;this._syncLayerViews();const r=this._layerViews.flatMap(a=>"graphicsViews"in a?Array.from(a.graphicsViews(),o=>o.hitTest(i)).flat():a.graphicsView.hitTest(i)).filter(a=>e.includes(a)).sort((a,o)=>e.indexOf(a)-e.indexOf(o));return r.length?r[0]:(this._manipulators.forEach(a=>{const o=a.intersectionDistance(t);o!=null&&oe.destroy()),this._manipulators=t.length?t.map(e=>new I({graphic:e,view:i})):[]}_setUpHighlights(){this.highlightsEnabled&&this._highlightHelper.add(this.graphics)}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const t of this.graphics){const i=t.clone();i.symbol=this._getSymbolForIndicator(t),this._indicators.push(i),this.addHandles(w(()=>t.symbol,()=>this._setUpIndicators()),k)}this.layer.addMany(this._indicators)}}_removeIndicators(){this.removeHandles(k),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach(t=>t.destroy()),this._indicators=[])}_getSymbolForIndicator(t){if(t.symbol==null)return null;switch(t.symbol.type){case"cim":return new u({style:"circle",size:12,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:e,yoffset:s,height:h,width:r}=t.symbol,a=h===r?r:Math.max(h,r);return new u({xoffset:e,yoffset:s,size:a,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:e,yoffset:s,size:h,style:r}=t.symbol;return new u({xoffset:e,yoffset:s,style:r==="circle"?"circle":"square",size:h+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new S({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new $({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=t.symbol;return new u({xoffset:e,yoffset:s,size:12,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}};l([p()],n.prototype,"_activeGraphic",void 0),l([p({readOnly:!0})],n.prototype,"type",void 0),l([p()],n.prototype,"callbacks",void 0),l([p()],n.prototype,"enableMoveAllGraphics",void 0),l([p()],n.prototype,"graphics",void 0),l([p({value:!1})],n.prototype,"highlightsEnabled",null),l([p()],n.prototype,"indicatorsEnabled",void 0),l([p()],n.prototype,"layer",void 0),l([p({readOnly:!0})],n.prototype,"state",null),l([p()],n.prototype,"view",void 0),n=l([E("esri.views.draw.support.GraphicMover")],n);const X=n,Y=Object.freeze(Object.defineProperty({__proto__:null,default:X},Symbol.toStringTag,{value:"Module"}));export{Y as G,X as U,L as l}; diff --git a/dist/assets/GraphicState-2UcU5UAX.js b/dist/assets/GraphicState-2UcU5UAX.js deleted file mode 100644 index 3bdb5d6..0000000 --- a/dist/assets/GraphicState-2UcU5UAX.js +++ /dev/null @@ -1 +0,0 @@ -import{e as l,p as E,kz as T,ab as n,y as a,c as D,b2 as o,kX as x,hS as _,kY as d,kZ as M,bB as F,K as S,b4 as O,b5 as v,as as j,at as I,au as k,b6 as b,k_ as B,b7 as H,i8 as R,bf as q,h$ as U,gn as L,bo as N,k$ as V,bq as Y,hs as K,l0 as X,aa as W}from"./index-J0iiHjMT.js";import{V as $}from"./ExtendedLineVisualElement-YbjiXiBG.js";import{r as A,t as Z}from"./vec4f32-NvfHy9q7.js";import{t as J}from"./EngineVisualElement-eZNKTKsI.js";import{c as Q}from"./Laserlines.glsl-nvjcCsAw.js";const f=.3;function g(s,e){e&&Object.assign(s,e)}class ee{constructor(e){this.height=90,this.coneHeight=40,this.coneWidth=23,this.width=3,this.renderOccluded=o.Opaque,this.color=e.accent}}class C{constructor({colors:e,...t}){this.size=11,this.outlineSize=1,this.collisionPadding=9,this.color=e.accent,this.outlineColor=e.outline,this.renderOccluded=o.Opaque,this.hoverOutlineColor=e.selectedOutline,g(this,t)}applyColor(e){this._apply(this.color,e)}applyOutline(e){this._apply(this.outlineColor,e)}applyHoverOutline(e){this._apply(this.hoverOutlineColor,e)}_apply(e,t){t.setParameters({color:d(e),renderOccluded:this.renderOccluded})}}let te=class{constructor({colors:e,...t}){this.size=40,this.height=.2,this.offset=.25,this.collisionPadding=2,this.renderOccluded=o.Transparent,this.minSquaredEdgeLength=900,this.color=_(e.accent,.5),this.hoverColor=e.accent,g(this,t)}applyColor(e){this._apply(this.color,e)}applyHover(e){this._apply(this.hoverColor,e)}_apply(e,t){t.setParameters({color:d(e),renderOccluded:this.renderOccluded})}};class re{constructor(e){this.vertex=new C({colors:e,color:e.accent,outlineColor:e.outline}),this.edge=new C({colors:e,color:x(_(e.accent,2/3),.5),outlineColor:_(e.outline,.5),size:8,collisionPadding:8}),this.selected=new C({colors:e,color:e.selected,outlineColor:e.outline}),this.edgeOffset=new te({colors:e})}}class w{constructor({colors:e,...t}){this.width=1.5,this.stipplePattern=M(3.3),this.falloff=0,this.innerWidth=1.5,this.renderOccluded=o.OccludeAndTransparent,this.color=e.selected,this.stippleOffColor=e.outline,this.innerColor=e.selected,g(this,t)}apply(e){e.color=d(this.color),e.width=this.width,e.stipplePattern=this.stipplePattern,e.stippleOffColor=d(this.stippleOffColor),e.falloff=this.falloff,e.innerWidth=this.innerWidth,e.innerColor=d(this.innerColor),e.renderOccluded=this.renderOccluded}}class se{constructor({colors:e,...t}){this.size=4,this.outlineSize=1,this.shape="square",this.color=e.selected,this.outlineColor=e.outline,g(this,t)}apply(e){e.color=d(this.color),e.size=this.size,e.outlineSize=this.outlineSize,e.outlineColor=d(this.outlineColor),e.primitive=this.shape}}class y{constructor({colors:e,...t}){this.innerWidth=1,this.glowWidth=8,this.glowFalloff=8,this.globalAlpha=f,this.globalAlphaContrastBoost=1.5,this.radius=3,this.innerColor=e.selected,this.glowColor=e.accent,this.heightFillColor=e.accent,g(this,t)}apply(e,t=1){const r={glowColor:n.toUnitRGB(this.glowColor),glowFalloff:this.glowFalloff,glowWidth:this.glowWidth,innerColor:n.toUnitRGB(this.innerColor),innerWidth:this.innerWidth,globalAlpha:this.globalAlpha*t*this.glowColor.a,globalAlphaContrastBoost:this.globalAlphaContrastBoost,intersectsLineRadius:this.radius};"style"in e?e.style=r:e.laserlineStyle=r}}class ie{constructor(e){this.outline=new w({colors:e,color:e.stippleOff,renderOccluded:o.OccludeAndTransparentStencil,stippleOffColor:e.stippleOn,innerWidth:0}),this.staged=new w({colors:e,color:e.stippleOn,renderOccluded:o.OccludeAndTransparentStencil,innerColor:e.stagedSolid,stippleOffColor:e.stippleOff}),this.shadowStyle=new y({colors:e,globalAlpha:f,glowColor:e.accent,glowFalloff:8,glowWidth:8,innerColor:e.selected,innerWidth:1})}}class le{constructor(e){this.outline=new se({colors:e,color:e.selected,outlineColor:e.outline,outlineSize:1,shape:"circle",size:4}),this.shadowStyle=new y({colors:e,globalAlpha:f,glowColor:e.accent,glowFalloff:1.5,glowWidth:6,innerColor:e.selected,innerWidth:1,radius:2})}}class oe extends w{constructor({colors:e,...t}){super({colors:e}),this.extensionType=$.GROUND_RAY,g(this,t)}}class ne{constructor(e){this.laserlineAlphaMultiplier=1.5,this.heightPlaneAngleCutoff=20,this.lineGraphics=new ie(e),this.pointGraphics=new le(e),this.heightPlane=new y({colors:e,globalAlpha:f,glowColor:e.accent,glowFalloff:8,glowWidth:8,innerColor:e.selected,innerWidth:1}),this.heightBox=new y({colors:e,globalAlpha:f,glowColor:e.accent,glowFalloff:8,glowWidth:8,innerColor:e.selected,innerWidth:0,heightFillColor:e.accent}),this.zVerticalLine=new oe({colors:e,color:_(e.accent,5*f/3),falloff:2,innerColor:_(e.selected,0),renderOccluded:o.OccludeAndTransparent,stipplePattern:null,width:5,extensionType:$.GROUND_RAY})}}let c=class extends E{constructor(e){super(e)}get colors(){const e=this.getTheme().accentColor,t=e.a;return{accent:e,contrast:T(e),selected:n.fromArray([255,255,255,t]),selectedOutline:n.fromArray([255,255,255,t]),staged:n.fromArray([12,207,255,t]),stagedSolid:n.fromArray([12,207,255,1]),outline:n.fromArray([0,0,0,.5*t]),stippleOn:n.fromArray([255,255,255,1]),stippleOff:n.fromArray([0,0,0,.5])}}get visualElements(){return new ne(this.colors)}get manipulators(){return new re(this.colors)}get zManipulator(){return new ee(this.colors)}};l([a()],c.prototype,"colors",null),l([a()],c.prototype,"visualElements",null),l([a()],c.prototype,"manipulators",null),l([a()],c.prototype,"zManipulator",null),l([a()],c.prototype,"getTheme",void 0),c=l([D("esri.views.3d.interactive.editingTools.settings.Settings")],c);class ge extends J{constructor(e){super(e),this._attachmentOrigin=F(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new S,this._geometry=null,this._width=1,this._color=A(1,0,1,1),this._innerWidth=0,this._innerColor=A(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=o.OccludeAndTransparentStencil,this._attachmentOrigin.spatialReference=e.view.spatialReference,this._laserline=new Q({view:e.view,isDecoration:e.isDecoration}),this.applyProperties(e),this.attached=e.attached??!0}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:t=>this._createObject3DResources(t),destroyResources:t=>this._destroyExternalResources(t),recreateGeometry:(t,r)=>{t.geometries.length=0,this._recreateGeometry(r,t.material,t.geometries)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:t=>this._destroyExternalResources(t),recreateGeometry:t=>{t.geometries=this._createRenderGeometriesDraped(t.material),this._attachmentOriginChanged()}}}get _laserlineAttached(){return this.attached&&this.visible&&this._laserlineStyle!=null&&!this.isDraped&&this.laserlineEnabled}onAttachedChange(e){this._laserline.attached=this._laserlineAttached,e&&this._attachmentOriginChanged()}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){O(e,this._color)||(v(this._color,e),this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){O(e,this._innerColor)||(v(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e&&this._stippleOffColor&&O(e,this._stippleOffColor)||(this._stippleOffColor=e?Z(e):null,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get attachmentOrigin(){var r;if(!this._attachmentOriginDirty)return this._attachmentOrigin;const e=(r=this.object3dResources.resources)==null?void 0:r.geometries;if(!e||e.length===0)return null;j(p,0,0,0);let t=0;for(const i of e)i.computeAttachmentOrigin(P)&&(I(p,p,P),t++);return t===0?null:(k(p,p,1/t),this.view.renderCoordsHelper.fromRenderCoords(p,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}_updateMaterial(){this.object3dResources.resources!=null&&this.object3dResources.resources.material.setParameters(this._materialParameters),this.drapedResources.resources!=null&&this.drapedResources.resources.material.setParameters(this._materialParameters)}get _isClosed(){return this.geometry!=null&&this.geometry.type==="polygon"}get _materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:!1,isClosed:this._isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:"round",hasPolygonOffset:!0,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration}}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===o.OccludeAndTransparentStencil?o.OccludeAndTransparent:this._renderOccluded}_recreateGeometry(e,t,r){this._createRenderGeometries(t,r);for(const i of r)e.addGeometry(i);this._attachmentOriginChanged()}_attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit("attachment-origin-changed")}_destroyExternalResources(e){e.geometries=[]}_createObject3DResources(e){const t=new b(this._materialParameters),r=new Array;return this._recreateGeometry(e,t,r),{material:t,geometries:r,forEach:i=>{i(t),r.forEach(i)}}}_createDrapedResources(){const e=new b(this._materialParameters);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){const{geometry:t,view:r}=this,i=r.basemapTerrain.spatialReference;return t==null||i==null?[]:B(t,i).lines.map(({position:h})=>{const m={overlayInfo:{spatialReference:i,renderCoordsHelper:r.renderCoordsHelper},attributeData:{position:h},removeDuplicateStartEnd:this._isClosed};return new H(R(e,m))})}calculateMapBounds(e){if(this.object3dResources.resources==null)return!1;const t=this.view.renderCoordsHelper;for(const r of this.object3dResources.resources.geometries){const i=r.attributes.get(q.POSITION),h=U(i.data.length);L(i.data,t.spatialReference,0,h,this.view.spatialReference,0,i.data.length/3),N(e,h)}return!0}_createRenderGeometries(e,t){const r=this.geometry;if(r==null)return;const i=V(r,this.view.elevationProvider,this.view.renderCoordsHelper,Y.fromElevationInfo(this.elevationInfo??new K({mode:X(r,null)}))),h=new Array;for(const{position:m,mapPositions:z}of i.lines){const G={mapPositions:z,attributeData:{position:m},removeDuplicateStartEnd:this._isClosed};t.push(R(e,G)),h.push(m)}this._laserline.pathVerticalPlane=h}}const P=W(),p=W();let u=class extends S.EventedAccessor{constructor(s){super(s),this.tracking=!1,this.displaying=!1,this.isDraped=!1}};l([a({constructOnly:!0})],u.prototype,"graphic",void 0),l([a()],u.prototype,"tracking",void 0),l([a()],u.prototype,"displaying",void 0),l([a()],u.prototype,"isDraped",void 0),u=l([D("esri.views.3d.layers.graphics.GraphicState")],u);export{u as e,ge as w,c as z}; diff --git a/dist/assets/GraphicState-JOHpeXmF.js b/dist/assets/GraphicState-JOHpeXmF.js new file mode 100644 index 0000000..13311ae --- /dev/null +++ b/dist/assets/GraphicState-JOHpeXmF.js @@ -0,0 +1 @@ +import{e as l,g as E,kL as T,W as n,y as a,c as D,b2 as o,k$ as x,hR as _,l0 as d,l1 as M,bU as F,z as W,b7 as O,b8 as v,bz as j,bO as I,ca as H,b9 as b,l2 as B,ba as U,i5 as R,bi as k,hV as q,gk as L,bF as V,l3 as N,bH as Y,hA as J,l4 as K,a8 as S}from"./index-pCX-0tJH.js";import{V as $}from"./ExtendedLineVisualElement-VJvEdv3K.js";import{r as A,t as Q}from"./vec4f32-NvfHy9q7.js";import{t as X}from"./EngineVisualElement-u0-BOxGn.js";import{c as Z}from"./Laserlines.glsl-U7nZFq0e.js";const f=.3;function g(s,e){e&&Object.assign(s,e)}class ee{constructor(e){this.height=90,this.coneHeight=40,this.coneWidth=23,this.width=3,this.renderOccluded=o.Opaque,this.color=e.accent}}class C{constructor({colors:e,...t}){this.size=11,this.outlineSize=1,this.collisionPadding=9,this.color=e.accent,this.outlineColor=e.outline,this.renderOccluded=o.Opaque,this.hoverOutlineColor=e.selectedOutline,g(this,t)}applyColor(e){this._apply(this.color,e)}applyOutline(e){this._apply(this.outlineColor,e)}applyHoverOutline(e){this._apply(this.hoverOutlineColor,e)}_apply(e,t){t.setParameters({color:d(e),renderOccluded:this.renderOccluded})}}let te=class{constructor({colors:e,...t}){this.size=40,this.height=.2,this.offset=.25,this.collisionPadding=2,this.renderOccluded=o.Transparent,this.minSquaredEdgeLength=900,this.color=_(e.accent,.5),this.hoverColor=e.accent,g(this,t)}applyColor(e){this._apply(this.color,e)}applyHover(e){this._apply(this.hoverColor,e)}_apply(e,t){t.setParameters({color:d(e),renderOccluded:this.renderOccluded})}};class re{constructor(e){this.vertex=new C({colors:e,color:e.accent,outlineColor:e.outline}),this.edge=new C({colors:e,color:x(_(e.accent,2/3),.5),outlineColor:_(e.outline,.5),size:8,collisionPadding:8}),this.selected=new C({colors:e,color:e.selected,outlineColor:e.outline}),this.edgeOffset=new te({colors:e})}}class w{constructor({colors:e,...t}){this.width=1.5,this.stipplePattern=M(3.3),this.falloff=0,this.innerWidth=1.5,this.renderOccluded=o.OccludeAndTransparent,this.color=e.selected,this.stippleOffColor=e.outline,this.innerColor=e.selected,g(this,t)}apply(e){e.color=d(this.color),e.width=this.width,e.stipplePattern=this.stipplePattern,e.stippleOffColor=d(this.stippleOffColor),e.falloff=this.falloff,e.innerWidth=this.innerWidth,e.innerColor=d(this.innerColor),e.renderOccluded=this.renderOccluded}}class se{constructor({colors:e,...t}){this.size=4,this.outlineSize=1,this.shape="square",this.color=e.selected,this.outlineColor=e.outline,g(this,t)}apply(e){e.color=d(this.color),e.size=this.size,e.outlineSize=this.outlineSize,e.outlineColor=d(this.outlineColor),e.primitive=this.shape}}class y{constructor({colors:e,...t}){this.innerWidth=1,this.glowWidth=8,this.glowFalloff=8,this.globalAlpha=f,this.globalAlphaContrastBoost=1.5,this.radius=3,this.innerColor=e.selected,this.glowColor=e.accent,this.heightFillColor=e.accent,g(this,t)}apply(e,t=1){const r={glowColor:n.toUnitRGB(this.glowColor),glowFalloff:this.glowFalloff,glowWidth:this.glowWidth,innerColor:n.toUnitRGB(this.innerColor),innerWidth:this.innerWidth,globalAlpha:this.globalAlpha*t*this.glowColor.a,globalAlphaContrastBoost:this.globalAlphaContrastBoost,intersectsLineRadius:this.radius};"style"in e?e.style=r:e.laserlineStyle=r}}class ie{constructor(e){this.outline=new w({colors:e,color:e.stippleOff,renderOccluded:o.OccludeAndTransparentStencil,stippleOffColor:e.stippleOn,innerWidth:0}),this.staged=new w({colors:e,color:e.stippleOn,renderOccluded:o.OccludeAndTransparentStencil,innerColor:e.stagedSolid,stippleOffColor:e.stippleOff}),this.shadowStyle=new y({colors:e,globalAlpha:f,glowColor:e.accent,glowFalloff:8,glowWidth:8,innerColor:e.selected,innerWidth:1})}}class le{constructor(e){this.outline=new se({colors:e,color:e.selected,outlineColor:e.outline,outlineSize:1,shape:"circle",size:4}),this.shadowStyle=new y({colors:e,globalAlpha:f,glowColor:e.accent,glowFalloff:1.5,glowWidth:6,innerColor:e.selected,innerWidth:1,radius:2})}}class oe extends w{constructor({colors:e,...t}){super({colors:e}),this.extensionType=$.GROUND_RAY,g(this,t)}}class ne{constructor(e){this.laserlineAlphaMultiplier=1.5,this.heightPlaneAngleCutoff=20,this.lineGraphics=new ie(e),this.pointGraphics=new le(e),this.heightPlane=new y({colors:e,globalAlpha:f,glowColor:e.accent,glowFalloff:8,glowWidth:8,innerColor:e.selected,innerWidth:1}),this.heightBox=new y({colors:e,globalAlpha:f,glowColor:e.accent,glowFalloff:8,glowWidth:8,innerColor:e.selected,innerWidth:0,heightFillColor:e.accent}),this.zVerticalLine=new oe({colors:e,color:_(e.accent,5*f/3),falloff:2,innerColor:_(e.selected,0),renderOccluded:o.OccludeAndTransparent,stipplePattern:null,width:5,extensionType:$.GROUND_RAY})}}let c=class extends E{constructor(e){super(e)}get colors(){const e=this.getTheme().accentColor,t=e.a;return{accent:e,contrast:T(e),selected:n.fromArray([255,255,255,t]),selectedOutline:n.fromArray([255,255,255,t]),staged:n.fromArray([12,207,255,t]),stagedSolid:n.fromArray([12,207,255,1]),outline:n.fromArray([0,0,0,.5*t]),stippleOn:n.fromArray([255,255,255,1]),stippleOff:n.fromArray([0,0,0,.5])}}get visualElements(){return new ne(this.colors)}get manipulators(){return new re(this.colors)}get zManipulator(){return new ee(this.colors)}};l([a()],c.prototype,"colors",null),l([a()],c.prototype,"visualElements",null),l([a()],c.prototype,"manipulators",null),l([a()],c.prototype,"zManipulator",null),l([a()],c.prototype,"getTheme",void 0),c=l([D("esri.views.3d.interactive.editingTools.settings.Settings")],c);class ge extends X{constructor(e){super(e),this._attachmentOrigin=F(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new W,this._geometry=null,this._width=1,this._color=A(1,0,1,1),this._innerWidth=0,this._innerColor=A(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=o.OccludeAndTransparentStencil,this._attachmentOrigin.spatialReference=e.view.spatialReference,this._laserline=new Z({view:e.view,isDecoration:e.isDecoration}),this.applyProperties(e),this.attached=e.attached??!0}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:t=>this._createObject3DResources(t),destroyResources:t=>this._destroyExternalResources(t),recreateGeometry:(t,r)=>{t.geometries.length=0,this._recreateGeometry(r,t.material,t.geometries)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:t=>this._destroyExternalResources(t),recreateGeometry:t=>{t.geometries=this._createRenderGeometriesDraped(t.material),this._attachmentOriginChanged()}}}get _laserlineAttached(){return this.attached&&this.visible&&this._laserlineStyle!=null&&!this.isDraped&&this.laserlineEnabled}onAttachedChange(e){this._laserline.attached=this._laserlineAttached,e&&this._attachmentOriginChanged()}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){O(e,this._color)||(v(this._color,e),this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){O(e,this._innerColor)||(v(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e&&this._stippleOffColor&&O(e,this._stippleOffColor)||(this._stippleOffColor=e?Q(e):null,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get attachmentOrigin(){var r;if(!this._attachmentOriginDirty)return this._attachmentOrigin;const e=(r=this.object3dResources.resources)==null?void 0:r.geometries;if(!e||e.length===0)return null;j(p,0,0,0);let t=0;for(const i of e)i.computeAttachmentOrigin(P)&&(I(p,p,P),t++);return t===0?null:(H(p,p,1/t),this.view.renderCoordsHelper.fromRenderCoords(p,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}_updateMaterial(){this.object3dResources.resources!=null&&this.object3dResources.resources.material.setParameters(this._materialParameters),this.drapedResources.resources!=null&&this.drapedResources.resources.material.setParameters(this._materialParameters)}get _isClosed(){return this.geometry!=null&&this.geometry.type==="polygon"}get _materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:!1,isClosed:this._isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:"round",hasPolygonOffset:!0,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration}}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===o.OccludeAndTransparentStencil?o.OccludeAndTransparent:this._renderOccluded}_recreateGeometry(e,t,r){this._createRenderGeometries(t,r);for(const i of r)e.addGeometry(i);this._attachmentOriginChanged()}_attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit("attachment-origin-changed")}_destroyExternalResources(e){e.geometries=[]}_createObject3DResources(e){const t=new b(this._materialParameters),r=new Array;return this._recreateGeometry(e,t,r),{material:t,geometries:r,forEach:i=>{i(t),r.forEach(i)}}}_createDrapedResources(){const e=new b(this._materialParameters);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){const{geometry:t,view:r}=this,i=r.basemapTerrain.spatialReference;return t==null||i==null?[]:B(t,i).lines.map(({position:h})=>{const m={overlayInfo:{spatialReference:i,renderCoordsHelper:r.renderCoordsHelper},attributeData:{position:h},removeDuplicateStartEnd:this._isClosed};return new U(R(e,m))})}calculateMapBounds(e){if(this.object3dResources.resources==null)return!1;const t=this.view.renderCoordsHelper;for(const r of this.object3dResources.resources.geometries){const i=r.attributes.get(k.POSITION),h=q(i.data.length);L(i.data,t.spatialReference,0,h,this.view.spatialReference,0,i.data.length/3),V(e,h)}return!0}_createRenderGeometries(e,t){const r=this.geometry;if(r==null)return;const i=N(r,this.view.elevationProvider,this.view.renderCoordsHelper,Y.fromElevationInfo(this.elevationInfo??new J({mode:K(r,null)}))),h=new Array;for(const{position:m,mapPositions:z}of i.lines){const G={mapPositions:z,attributeData:{position:m},removeDuplicateStartEnd:this._isClosed};t.push(R(e,G)),h.push(m)}this._laserline.pathVerticalPlane=h}}const P=S(),p=S();let u=class extends W.EventedAccessor{constructor(s){super(s),this.tracking=!1,this.displaying=!1,this.isDraped=!1}};l([a({constructOnly:!0})],u.prototype,"graphic",void 0),l([a()],u.prototype,"tracking",void 0),l([a()],u.prototype,"displaying",void 0),l([a()],u.prototype,"isDraped",void 0),u=l([D("esri.views.3d.layers.graphics.GraphicState")],u);export{u as e,ge as w,c as z}; diff --git a/dist/assets/Graphics3DObjectStates--mMi4sdi.js b/dist/assets/Graphics3DObjectStates--mMi4sdi.js deleted file mode 100644 index 8f4fa6f..0000000 --- a/dist/assets/Graphics3DObjectStates--mMi4sdi.js +++ /dev/null @@ -1 +0,0 @@ -import{bY as ze,jo as Me,rH as ke,jn as He,rI as Be,jm as Ne,rJ as We,V as qe,rK as Ye,rL as Ze,rM as Xe,rN as Je,eh as te,e as o,y as h,c as L,p as V,K as ie,p_ as F,aS as Qe,e_ as Ke,eZ as et,rO as Ue,rP as tt,jR as it,s as k,n as v,rQ as st,qM as rt,a2 as se,dJ as at,ei as je,aX as nt,aY as ot,rR as $e,dA as lt,lU as ht,Z as re,fN as J,mM as dt,aE as ne,fO as ct,ek as pt,aa as U,G as f,rS as yt,rT as oe,rU as ut,rV as gt,dT as mt,aj as le,cd as Q,rW as _t,rX as E,rY as R,rZ as bt,r_ as ft,i9 as he,ia as de,d as S,F as vt,fl as St,A as Ct,re as Fe,ai as B,ak as ce,E as T,bD as wt,lt as Gt,r$ as ae,s0 as xt,bH as It,s1 as Et,w as Rt,as as pe,bn as ye,at as ue,au as Dt,T as Ot,s2 as Pt,c4 as ge,s3 as At,s4 as Lt,al as Vt,s5 as me,s6 as _e,f as N,s7 as Ut,lx as jt,fR as $t,s8 as Ft,s9 as be,c1 as Tt,ct as zt,c8 as W,sa as Mt,sb as kt,sc as Ht,sd as Bt,d6 as Nt,c7 as Wt,e3 as fe,jk as ve,se as q,f7 as qt,ae as H,sf as Yt,l9 as Zt,sg as Xt,gn as Se,k as Jt,q5 as Ce,ov as we,jQ as Ge,or as Y,ez as Qt,sh as xe,si as Kt,sj as ei,C as ti,P as ii,mJ as Ie,c9 as Ee}from"./index-J0iiHjMT.js";import{o as j}from"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import{s as si}from"./PooledRBush-o8tLYBG5.js";const ri=ze.fromSimpleMarkerSymbol(Me),ai=ke.fromSimpleLineSymbol(He),ni=Be.fromSimpleFillSymbol(Ne),oi=new We({symbolLayers:new qe([new Ye({material:{color:Ze},edges:new Xe({size:"1px",color:Je})})])});function li(t){if(t==null)return null;switch(t.type){case"mesh":return oi;case"point":case"multipoint":return ri;case"polyline":return ai;case"polygon":case"extent":return ni}return null}let hi=class{constructor(e,i,s){this.maximumTotalNumberOfVertices=e,this.maximumNumberOfFeatures=i,this.averageSymbolComplexity=s}};const Re=te();let x=class extends V{constructor(e){super(e),this.events=new ie,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.featureAdapter={getAttribute:(i,s)=>"graphic"in i?i.graphic.attributes[s]:j.getAttribute(i,s),getAttributes:i=>"graphic"in i?i.graphic.attributes:j.getAttributes(i),getObjectId:i=>"graphic"in i?F(i.graphic,this.objectIdField)??void 0:j.getObjectId(i),getGeometry:i=>"graphic"in i?i.getAsOptimizedGeometry(this.hasZ,this.hasM):j.getGeometry(i),getCentroid:(i,s)=>{if("graphic"in i){let r=null;i.centroid!=null?r=i.centroid:i.graphic.geometry.type==="point"&&Qe(i.graphic.geometry,De,this.viewSpatialReference)&&(r=De);const a=new Array(2+(s.hasZ?1:0)+(s.hasM?1:0));return r==null?(a[0]=0,a[1]=0,a[2]=0,a[3]=0):(a[0]=r.x,a[1]=r.y,s.hasZ&&(a[2]=r.hasZ?r.z:0),s.hasM&&(a[s.hasZ?3:2]=r.hasM?r.m:0)),new Ke([],a)}return j.getCentroid(i,s)},cloneWithGeometry:(i,s)=>"graphic"in i?new et(s,this.featureAdapter.getAttributes(i),null,this.featureAdapter.getObjectId(i)):j.cloneWithGeometry(i,s)}}forEachInBounds(e,i){this.getSpatialIndex().forEachInBounds(e,i)}forEachBounds(e,i){const s=this.getSpatialIndex();for(const r of e){const a=this.featureAdapter.getObjectId(r);s.getBounds(a,Re)!=null&&i(Re)}}};o([h({constructOnly:!0})],x.prototype,"getSpatialIndex",void 0),o([h({constructOnly:!0})],x.prototype,"forEach",void 0),o([h({constructOnly:!0})],x.prototype,"hasZ",void 0),o([h({constructOnly:!0})],x.prototype,"hasM",void 0),o([h({constructOnly:!0})],x.prototype,"objectIdField",void 0),o([h({constructOnly:!0})],x.prototype,"viewSpatialReference",void 0),o([h({constructOnly:!0})],x.prototype,"featureSpatialReference",void 0),x=o([L("esri.views.3d.layers.graphics.Graphics3DFeatureStore")],x);const De={type:"point",x:0,y:0,hasZ:!1,hasM:!1,spatialReference:null};let di=class extends Ue{constructor(e,i,s){super(e,i,s),this._calloutSymbolLayer=null,this.symbol.hasVisibleCallout()&&(this._calloutSymbolLayer=tt(this.symbol,i))}async doLoad(e){var s;const i=this._calloutSymbolLayer?it(this._calloutSymbolLayer.load()):null;try{await super.doLoad(e),k(e)}catch(r){throw(s=this._calloutSymbolLayer)==null||s.abortLoad(),r}i&&await i}destroy(){super.destroy(),this._calloutSymbolLayer=v(this._calloutSymbolLayer)}createGraphics3DGraphic(e,i){const s=super.createGraphics3DGraphic(e,i);if(this._calloutSymbolLayer!=null&&s!=null){const r=this._createCalloutGraphic(e);r&&s.setCalloutGraphic(r)}return s}globalPropertyChanged(e,i){return!!super.globalPropertyChanged(e,i)&&(!this._calloutSymbolLayer||this._calloutSymbolLayer.globalPropertyChanged(e,i,s=>s.calloutLayer))}updateGeometry(e,i){const s=super.updateGeometry(e,i);if(s&&this._calloutSymbolLayer){const r=e.calloutLayer;if(r)return this._calloutSymbolLayer.updateGeometry(r,i)}return s}_createCalloutGraphic(e){const i=e.renderingInfo;return e.renderingInfo=new st(i.renderer,i.symbol),this._calloutSymbolLayer.createGraphics3DGraphic(e)}};function ci(t,e,i){return t.type==="point-3d"?new di(t,e,i):new Ue(t,e,i)}let pi=class{constructor(e){var s;this._graphicsCore=e,this._idToState=new Map,this._states=new Set;const i=(s=e.owner.layer)==null?void 0:s.objectIdField;i?(this._getGraphicId=r=>F(r,i),this._getGraphics3DGraphicById=r=>this._graphicsCore.getGraphics3DGraphicByObjectId(r)):(this._getGraphicId=r=>r.uid,this._getGraphics3DGraphicById=r=>this._graphicsCore.getGraphics3DGraphicById(r))}destroy(){this._idToState.clear(),this._states.forEach((e,i)=>this.remove(i))}add(e){const i=se(()=>this.remove(e));if(this._states.has(e))return i;const s=this._getGraphicId(e.graphic),r=this._getGraphics3DGraphicById(s);return this._states.has(e)||this._states.add(e),this._ensureStateList(s).push(e),e.displaying=r!=null&&r.isVisible(),e.isDraped=r!=null&&r.isDraped,e.tracking=!0,r!=null&&e.emit("changed"),i}remove(e){if(this._states.has(e)){if(this._idToState.size){const i=this._getGraphicId(e.graphic),s=this._idToState.get(i);s&&(rt(s,e),s.length===0&&this._idToState.delete(i))}this._states.delete(e),e.tracking=!1,e.displaying=!1}}addGraphic(e){this._forEachState(e,i=>{i.displaying=e.isVisible(),i.isDraped=e.isDraped,i.emit("changed")})}removeGraphic(e){this._forEachState(e,i=>{i.displaying=!1,i.isDraped=!1})}updateGraphicGeometry(e){this._forEachState(e,i=>i.emit("changed"))}updateGraphicVisibility(e){this._forEachState(e,i=>i.displaying=e.isVisible())}allGraphicsDeleted(){this._states.forEach(e=>{e.displaying=!1})}_ensureStateList(e){const i=this._idToState.get(e);if(i)return i;const s=new Array;return this._idToState.set(e,s),s}_forEachState(e,i){if(this._states.size===0||this._idToState.size===0)return;const s=this._getGraphicId(e.graphic),r=this._idToState.get(s);r!=null&&r.forEach(i)}},O=class extends V{constructor(t){super(t),this._index=new si(9,at("esri-csp-restrictions")?e=>({minX:e.extent[0],minY:e.extent[1],maxX:e.extent[2],maxY:e.extent[3]}):[".extent[0]",".extent[1]",".extent[2]",".extent[3]"]),this._missing=new Set,this._boundsByFeature=new Map,this.spatialReference=null,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.updating=!1}setup(t){this._addMany(t)}destroy(){this._missing.clear(),this._index=v(this._index),this._boundsByFeature.clear(),this._boundsByFeature=null}update(){this._missing.size>0&&(this._addMany(Array.from(this._missing.values())),this.updating=!1,this._missing.clear())}get updatingRemaining(){return this._missing.size}queryGraphicUIDsInExtent(t,e,i){e!=null&&e.equals(this.spatialReference)&&(w.minX=t[0],w.minY=t[1],w.maxX=t[2],w.maxY=t[3],this.update(),this._index.search(w,s=>i(s.graphic.uid)))}add(t){this._missing.add(t),this.updating=!0}remove(t){if(this._missing.delete(t))return void(this.updating=this._missing.size>0);this._index.remove(t);const e=F(t.graphic,this._get("objectIdField"));e!=null&&this._boundsByFeature.delete(e)}_addMany(t){if(t.length===0)return;const e=this._get("objectIdField");for(const i of t){i.computeExtent(this.spatialReference);const s=F(i.graphic,e);s!=null&&this._boundsByFeature.set(s,i.extent)}this._index.load(t)}clear(){this._index.clear(),this._missing.clear(),this._boundsByFeature.clear(),this.updating=!1}forEachInBounds(t,e){w.minX=t[0],w.minY=t[1],w.maxX=t[2],w.maxY=t[3],this.update(),this._index.search(w,i=>{e(i)})}getBounds(t,e){this.update();const i=this._boundsByFeature.get(t);return i?je(e,i):null}};o([h({constructOnly:!0})],O.prototype,"spatialReference",void 0),o([h({constructOnly:!0})],O.prototype,"hasZ",void 0),o([h({constructOnly:!0})],O.prototype,"hasM",void 0),o([h({constructOnly:!0})],O.prototype,"objectIdField",void 0),o([h()],O.prototype,"updating",void 0),o([h({readOnly:!0})],O.prototype,"updatingRemaining",null),O=o([L("esri.views.3d.layers.graphics.SpatialIndex2D")],O);const w={minX:0,minY:0,maxX:0,maxY:0},yi=1;let A=class extends ie.EventedMixin(V){get spatialReference(){var e;return(e=this.view)==null?void 0:e.spatialReference}constructor(e){super(e),this._elevationOffset=0,this._layerHandlesKey="layerHandles"}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersectLayers=[this.stageLayer],this._intersector=nt(this.view.state.viewingMode),this._intersector.options.store=ot.MIN;const e=this._computeLayerExtent(this.spatialReference,this.stageLayer);this._zmin=e[2],this._zmax=e[5];const i=this.stageLayer.events;this.addHandles([i.on("layerObjectAdded",({object:s})=>this._objectChanged(s)),i.on("layerObjectRemoved",({object:s})=>this._objectChanged(s)),i.on("geometryAdded",({object:s})=>this._objectChanged(s)),i.on("geometryRemoved",({object:s})=>this._objectChanged(s)),i.on("attributesChanged",({attribute:s,object:r})=>$e(s)&&this._objectChanged(r)),i.on("transformationChanged",s=>this._objectChanged(s))],this._layerHandlesKey)}dispose(){this.removeHandles(this._layerHandlesKey)}elevationInfoChanged(){const e=this.layer!=null?this.layer.elevationInfo:null;if(e!=null&&e.mode!=="on-the-ground"){const i=lt(this.layer.spatialReference),s=ht(e.unit??"meters");this._elevationOffset=(e.offset??0)*s/i}else this._elevationOffset=0}getElevation(e,i,s,r){if(_[0]=e,_[1]=i,_[2]=s,!this._renderCoordsHelper.toRenderCoords(_,r,_))return re.getLogger(this).error("could not project point for elevation alignment"),null;const a=this._elevationOffset,n=this._zmin+a,d=this._zmax+a;this._renderCoordsHelper.setAltitude(Oe,d,_),this._renderCoordsHelper.setAltitude(Pe,n,_);const l=c=>!!c.lastValidElevationBB;return this._intersector.reset(Oe,Pe,null),this._intersector.intersect(this._intersectLayers,null,yi,null,l),this._intersector.results.min.getIntersectionPoint(_)?this._renderCoordsHelper.getAltitude(_):null}_objectChanged(e){const i=this.spatialReference;if(!e.lastValidElevationBB||!i)return;J(D);const s=e.lastValidElevationBB;s.isEmpty()||this._expandExtent(i,s.min,s.max,D);const{min:r,max:a}=e.boundingVolumeWorldSpace;this._expandExtent(i,r,a,D),dt(D,K),this._zmin=Math.min(this._zmin,D[2]),this._zmax=Math.max(this._zmax,D[5]),Z.extent=K,Z.spatialReference=i,this.emit("elevation-change",Z),ne(s.min,r),ne(s.max,a)}_computeLayerExtent(e,i){return J(D),e!=null&&i.objects.forAll(s=>this._expandExtent(e,s.boundingVolumeWorldSpace.min,s.boundingVolumeWorldSpace.max,D)),D}_expandExtent(e,i,s,r){for(let a=0;a<8;++a)_[0]=1&a?i[0]:s[0],_[1]=2&a?i[1]:s[1],_[2]=4&a?i[2]:s[2],this._renderCoordsHelper.fromRenderCoords(_,_,e),ct(r,_);return r}};o([h({constructOnly:!0})],A.prototype,"layer",void 0),o([h({constructOnly:!0})],A.prototype,"stageLayer",void 0),o([h({constructOnly:!0})],A.prototype,"view",void 0),o([h()],A.prototype,"spatialReference",null),A=o([L("esri.views.3d.layers.support.StageLayerElevationProvider")],A);const D=J(),K=pt(),Z={spatialReference:null,extent:K,context:"scene"},_=U(),Oe=U(),Pe=U();var ee;const X=U(),ui=te(),Te="esri.views.3d.layers.graphics.Graphics3DCore",b=re.getLogger(Te);let p=ee=class extends V{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){var t;return this._spatialIndex||(this._spatialIndex=new O({objectIdField:(t=this.owner.layer)==null?void 0:t.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return this.currentRenderer!=null&&this.currentRenderer.type==="dictionary"?f.ASYNC:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){var t,e,i;return!!(this._graphicsWaitingForSymbol.size>0||this.running||(t=this._elevationAlignment)!=null&&t.updating||(e=this._scaleVisibility)!=null&&e.updating||(i=this._filterVisibility)!=null&&i.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._updatingPendingLoadedGraphicsChange||this._frameTask.updating||this._loadingSymbols>0)}get running(){var t;return this._pendingUpdates.size>0||!!((t=this._spatialIndex)!=null&&t.updating)}get suspendedOrOutsideOfView(){var t;return this.owner.suspended||!!((t=this.owner.suspendInfo)!=null&&t.outsideOfView)}get updatingRemaining(){var t,e;return this.updating?this._pendingUpdates.size+.1*(((t=this._spatialIndex)==null?void 0:t.updatingRemaining)||0)+.1*(((e=this._elevationAlignment)==null?void 0:e.updatingRemaining)||0):0}get displayFeatureLimit(){const t=this.owner&&this.owner.view&&this.owner.view.qualitySettings,e=(t==null?void 0:t.graphics3D.minTotalNumberOfFeatures)??0,i=(t==null?void 0:t.graphics3D.maxTotalNumberOfFeatures)??0,s=(t==null?void 0:t.graphics3D.maxNumberOfDrawCalls)??0,r=(t==null?void 0:t.graphics3D.maxTotalNumberOfVertices)??0,a=this.averageSymbolComplexity,n=Math.max(1,(a==null?void 0:a.verticesPerFeature)??1),d=a&&a.drawCallsPerFeature>0&&s>0?s/a.drawCallsPerFeature:i,l=Math.ceil(r/n),c=Math.max(e,Math.min(i,l,d)),y=this._get("displayFeatureLimit");return y&&y.maximumTotalNumberOfVertices===r&&y.averageSymbolComplexity===a&&y.maximumNumberOfFeatures===c?y:new hi(r,c,a)}get averageSymbolComplexity(){const t=yt(this._symbolComplexities),e=this._get("averageSymbolComplexity");return t.numComplexities===0||e!=null&&(t.estimated&&(e.verticesPerFeature>=t.verticesPerFeature||e.verticesPerCoordinate>=t.verticesPerCoordinate||e.drawCallsPerFeature>=t.drawCallsPerFeature)||e.verticesPerFeature===t.verticesPerFeature&&e.verticesPerCoordinate===t.verticesPerCoordinate&&e.drawCallsPerFeature===t.drawCallsPerFeature)?e:t}get usedMemory(){const t=this.averageSymbolComplexity!=null&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,e=this._getSymbolComplexitiesUsed().reduce((a,n)=>a+n.memory.resourceBytes,0),i=this.owner.view._stage.renderer,s=this.owner.view.basemapTerrain.overlayManager.renderer,r=Array.from(this._symbols.values()).reduce((a,n)=>a+((n==null?void 0:n.symbolLayers.reduce((d,l)=>d+((l==null?void 0:l.materials.reduce((c,y)=>c+i.getMemoryForMaterial(y)+s.getMemoryForMaterial(y),0))??0),0))??0),0);return this._usedMemory+t+e+r}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const t=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*t}if(this.averageSymbolComplexity!=null){const t=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+t}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(t){var r;if(t.type==="web-style")return t.clone();const e=this._symbolConversionCache.get(t.id);if(e!=null)return e;const i=oe(t,{geometryType:((r=this.layer)==null?void 0:r.geometryType)??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(t)}),s=i.symbol||null;return s==null&&i.error&&b.error(i.error.message),this._symbolConversionCache.set(t.id,s),s}_getSymbolComplexitiesUsedOrRenderer(t){if(t==null)return[];const e=t.getSymbols(),i="backgroundFillSymbol"in t?t.backgroundFillSymbol:null;if(!i&&!(e!=null&&e.length))return[];const s=[],r=this._getSymbolComplexityUsedOrRenderer(i);r!=null&&s.push(r);for(const a of e){const n=this._getSymbolComplexityUsedOrRenderer(a);n!=null&&s.push(n)}return s}_getSymbolComplexityUsedOrRenderer(t){if(t==null)return null;const e=this._symbols.get(t.id);if(e!=null)return e.complexity;const i=this._getConvertedSymbol(t);return i!=null?ut(i):null}_getSymbolComplexitiesUsed(){const t=[];return this._symbols.forEach(e=>{e!=null&&t.push(e.complexity)}),t}get _objectIdField(){return this.layer.objectIdField}constructor(t){super(t),this._propertiesPool=new gt({computedExtent:mt},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._frameTask=le,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._sharedSymbolResourcesOwnerHandle=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this._pendingUpdatesPool=new Q({allocator:e=>e||new gi,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new Q,this.preferredUpdatePolicy=f.SYNC,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this.symbolCreationContext=new _t(t.owner.view.resourceController.scheduler,(e,i)=>this._frameTask.schedule(e,i))}initialize(){var i;this._featureStore=new x({objectIdField:(i=this.owner.layer)==null?void 0:i.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:s=>this.graphics3DGraphics.forEach(s)});const t=(s,r,a)=>this.spatialIndex.queryGraphicUIDsInExtent(s,r,a),{componentFactories:e}=this;if(e.elevationAlignment!=null){const s=e.elevationAlignment(this,t);this._elevationAlignment=s}if(e.scaleVisibility!=null){const s=e.scaleVisibility(this,t);this._scaleVisibility=s}if(e.filterVisibility!=null){const s=e.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:r=>this.modifyGraphics3DGraphicVisibilities(a=>a.setVisibilityFlag(E.GRAPHIC,R.FILTER,r(F(a.graphic,this._objectIdField)))),setAllFeaturesVisibility:r=>this.modifyGraphics3DGraphicVisibilities(a=>a.setVisibilityFlag(E.GRAPHIC,R.FILTER,r)),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities(r=>r.setVisibilityFlag(E.GRAPHIC,R.FILTER,!0))});this._filterVisibility=s}if(e.deconflictor!=null){const s=e.deconflictor(this);this._deconflictor=s}if(e.labeler!=null&&this._scaleVisibility!=null){const s=e.labeler(this,this._scaleVisibility);this._labeler=s}if(e.objectStates!=null){const s=e.objectStates(this);this._objectStates=s}this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){var r,a,n,d;const t=(r=this._initializeAbortController)==null?void 0:r.signal,e=this.owner.view;this._viewElevationProvider=new bt(this._viewSpatialReference,e),this._initializeStage(e,this.layer.uid);const i=e.sharedSymbolResources;this.symbolCreationContext.sharedResources=i,this._sharedSymbolResourcesOwnerHandle=i.addGraphicsOwner(this.owner),this.currentRenderer!=null&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=i.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=e.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new ft(e.renderSpatialReference),this.symbolCreationContext.elevationProvider=e.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=l=>this.notifyGraphicGeometryChanged(l),this.symbolCreationContext.notifyGraphicVisibilityChanged=l=>this.notifyGraphicVisibilityChanged(l);const s=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await de(s,this._viewSpatialReference,t,b),k(t),this.symbolCreationContext.screenSizePerspectiveEnabled=e.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!((a=this.owner.view.qualitySettings)!=null&&a.physicallyBasedRenderingEnabled),this.symbolCreationContext.skipHighSymbolLods=!!((d=(n=this.owner.view.qualitySettings)==null?void 0:n.graphics3D)!=null&&d.skipHighSymbolLods),"drapeSourceType"in this.owner){const{owner:l}=this;this.symbolCreationContext.drapeSourceRenderer=e.basemapTerrain.overlayManager.registerGeometryDrapeSource(l),this.addHandles(se(()=>e.basemapTerrain.overlayManager.unregisterDrapeSource(l)))}this.addHandles([S(()=>this.suspendedOrOutsideOfView,()=>this._frameTask.reschedule(()=>this._updateLayerVisibility())),S(()=>{var l,c;return[(l=this.layer)==null?void 0:l.screenSizePerspectiveEnabled,(c=this.owner.view)==null?void 0:c.screenSizePerspectiveEnabled]},()=>{var c;const l=e.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;l!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=l,(c=this._labeler)==null||c.reset(),this.recreateAllGraphicsAndSymbols())}),S(()=>this.owner.slicePlaneEnabled,l=>this._slicePlaneEnabledChange(!!l)),S(()=>{var l;return(l=this.owner.view.state)==null?void 0:l.rasterPixelRatio},()=>this._pixelRatioChange()),S(()=>{var l;return!!((l=this.owner.view.qualitySettings)!=null&&l.physicallyBasedRenderingEnabled)},l=>this._physicalBasedRenderingChange(l)),S(()=>{var l,c;return!!((c=(l=this.owner.view.qualitySettings)==null?void 0:l.graphics3D)!=null&&c.skipHighSymbolLods)},l=>this._skipHighSymbolLoDsChange(l)),vt(()=>{var l;return(l=e.basemapTerrain)==null?void 0:l.tilingScheme},l=>{if(l.spatialReference.equals(this.symbolCreationContext.overlaySR)||e.basemapTerrain.spatialReference==null||(this.symbolCreationContext.overlaySR=e.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const c=()=>{var y;return(y=this.owner)==null?void 0:y.loadedGraphics};this.addHandles([St(c,"change",y=>{this._graphicsCollectionChanged(y),this._signalUpdatingDuringAsyncLoadedGraphicsChange()},{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}},{initial:!0}),S(()=>this.effectiveUpdatePolicy,l=>{this.stageLayer!=null&&(this.stageLayer.updatePolicy=l),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===f.ASYNC,l===f.SYNC&&this.runTask(Fe)},Ct)]),this._frameTask=e.resourceController.scheduler.registerTask(B.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(S(()=>this.layer.featureReduction,()=>this._deconflictor.featureReductionChange())),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch(()=>{}),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController&&(this._initializeAbortController.abort(),this._initializeAbortController=null)}destroy(){var t,e,i,s;this._abortInitialize(),this._abortRendererChange(),this._abortElevationInfoChange(),this._frameTask.remove(),this._frameTask=le,(e=(t=this.owner.view)==null?void 0:t.deconflictor)==null||e.removeGraphicsOwner(this),(s=(i=this.owner.view)==null?void 0:i.labeler)==null||s.removeGraphicsOwner(this),this._elevationAlignment=v(this._elevationAlignment),this._scaleVisibility=v(this._scaleVisibility),this._filterVisibility=v(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=v(this._objectStates),this.clear(),this._featureStore=v(this._featureStore),this._updatingPendingLoadedGraphicsChange=ce(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=v(this._graphicStateTracking),this.stage&&(this.stageLayer=v(this.stageLayer),this.stage=null),this._set("owner",null);for(const r in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[r].reject(new T("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._sharedSymbolResourcesOwnerHandle=ce(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=v(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=v(this._spatialIndex)}clear(){var t,e;(t=this._objectStates)==null||t.allGraphicsDeleted(),this._graphicStateTracking!=null&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach(i=>i.destroy()),(e=this._spatialIndex)==null||e.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(v),this._symbols.clear(),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingUpdatesPool.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("updating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed")}_initializeStage(t,e){this.stage=t._stage,this.stageLayer=new wt(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},e);const i=this.stageLayer.events;i.on("transformationChanged",s=>this.notifyGraphicGeometryChanged(s.graphicUid)),i.on("shaderTransformationChanged",s=>this.notifyGraphicGeometryChanged(s.graphicUid)),i.on("visibilityChanged",s=>this.notifyGraphicVisibilityChanged(s.graphicUid)),i.on("geometryAdded",s=>this.notifyGraphicGeometryChanged(s.object.graphicUid)),i.on("geometryRemoved",s=>this.notifyGraphicGeometryChanged(s.object.graphicUid)),i.on("attributesChanged",s=>$e(s.attribute)&&this.notifyGraphicGeometryChanged(s.object.graphicUid))}notifyGraphicGeometryChanged(t){if(this._graphicStateTracking==null||t==null)return;const e=this.graphics3DGraphics.get(t);e&&this._graphicStateTracking.updateGraphicGeometry(e)}notifyGraphicVisibilityChanged(t){if(this._graphicStateTracking==null||t==null)return;const e=this.graphics3DGraphics.get(t);e&&this._graphicStateTracking.updateGraphicVisibility(e)}_updateLayerVisibility(){const t=this.displayFeatureLimit.maximumNumberOfFeatures,e=this._numberOfGraphics>t*mi,i=!this.suspendedOrOutsideOfView&&!e;i!==this._visible&&(this._visible=i,i?(this.stageLayer.pickable=!0,this.updateAllGraphicsVisibility()):(this.stageLayer.pickable=!1,this._hideAllGraphics()),this._updateStageLayerVisibility())}_updateStageLayerVisibility(){this.stageLayer.visible=this._visible&&(this.layer.opacity==null||this.layer.opacity>0)}getGraphics3DGraphicById(t){return t!=null?this.graphics3DGraphics.get(t):void 0}getGraphics3DGraphicByObjectId(t){var e;return(e=this.owner.layer)!=null&&e.objectIdField?this._findGraphics3DGraphicByObjectId(t):null}_getGraphicObjectID(t,e=(i=>(i=this.owner.layer)==null?void 0:i.objectIdField)()){return F(t,e)}get graphics3DGraphicsByObjectID(){var i;const t=(i=this.owner.layer)==null?void 0:i.objectIdField;if(!t)return;const e=new Map;return this.graphics3DGraphics.forEach(s=>{if(!s)return;const r=s.graphic,a=this._getGraphicObjectID(r,t);a!=null&&e.set(a,s)}),e}get labelsEnabled(){return!(!this._labeler||!this._labeler.layerLabelsEnabled())}async updateLabelingInfo(t){const e=this._deconflictor&&this._deconflictor.labelingInfoChange(t),i=this._labeler&&this._labeler.labelingInfoChange(t);await Promise.allSettled([e,i])}updateVisibilityInfo(){this._deconflictor&&this._deconflictor.labelingInfoChange(),this._labeler&&this._labeler.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let t=0,e=0;return Gt(this._symbols,(i,s)=>{if(i!=null){const r=i.getFastUpdateStatus();if(r.loading>0)return!0;this._graphicsBySymbol.has(s)&&(e+=r.fast,t+=r.slow)}return!1})?"unknown":e>=0&&t===0?"fast":t>=0&&e===0?"slow":"mixed"}runTask(t){if(this._frameTask.processQueue(t),this._applyPendingUpdates(t),this.notifyChange("running"),this.running||this.notifyChange("updating"),this.notifyChange("updatingRemaining"),!t.hasProgressed)return ae.YIELD}setObjectIdVisibility(t,e){e?this._objectIdInvisibleSet.delete(t):this._objectIdInvisibleSet.add(t);const i=this._findGraphics3DGraphicByObjectId(t);i!=null&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(t){return xt(this.graphics3DGraphics,e=>this._getGraphicObjectID(e.graphic)===t)}_updateUserVisibility(t){if(t==null)return!1;const e=t.graphic,i=this._getGraphicObjectID(e),s=e.visible&&!this.owner.suspended&&(i==null||!this._objectIdInvisibleSet.has(i));return t.setVisibilityFlag(E.GRAPHIC,R.USER,s)}_whenGraphics3DGraphic(t){const e=this.graphics3DGraphics.get(t.uid);if(e)return Promise.resolve(e);const i=this._whenGraphics3DGraphicRequests[t.uid];if(i)return i.promise;const s=It();return this._whenGraphics3DGraphicRequests[t.uid]=s,s.promise}async _boundsForGraphics3DGraphic(t,e){const i=this._viewSpatialReference,s=this.owner.view.renderSpatialReference,r=this.owner.view.basemapTerrain.spatialReference,a=(y,u,m)=>Se(y,s,u,y,i,u,m),n=(y,u,m)=>Se(y,r,u,y,i,u,m),d=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:e!=null&&!!e.useViewElevation,minDemResolution:e!=null?e.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await t.getProjectedBoundingBox(a,n,d,e==null?void 0:e.signal);if(!l)return null;const c=l.boundingBox;if(l.requiresDrapedElevation){const y=this.symbolCreationContext.elevationProvider;if(y){Et(c,X);const u=y.getElevation(X[0],X[1],0,i,"ground")??0;c[2]=Math.min(c[2],u),c[5]=Math.max(c[5],u)}}return{boundingBox:c,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(t,e){var a;await Rt(()=>{var n;return(n=this.owner)==null?void 0:n.loadedGraphics});const i=(a=this.owner.layer)==null?void 0:a.objectIdField,s=this.owner.loadedGraphics.find(n=>n===t||i!=null&&n.attributes!=null&&t.attributes&&n.attributes[i]===t.attributes[i]);if(!s)throw new T("internal:graphic-not-part-of-view","Graphic is not part of this view");const r=await this._whenGraphics3DGraphic(s);return this._boundsForGraphics3DGraphic(r,e)}computeAttachmentOrigin(t,e){const i=this.graphics3DGraphics.get(t.uid);if(!i)return null;const s=i.computeAttachmentOrigin();if(s.render.num===0&&s.draped.num===0)return null;pe(G,0,0,0);let r=0;if(s.render.num>0){if(!ye(s.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,$,e))return null;ue(G,G,$),r++}if(s.draped.num>0){const[a,n]=s.draped.origin,d=this._viewElevationProvider.getElevation(a,n,"ground")??0;if(pe($,a,n,d),!ye($,this._viewElevationProvider.spatialReference,$,e))return null;ue(G,G,$),r++}return r>1&&Dt(G,G,1/r),new Ot({x:G[0],y:G[1],z:G[2],spatialReference:e})}getSymbolLayerSize(t,e){const i=this._symbols.get(t.id);if(i==null)throw new T("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=t.symbolLayers.indexOf(e);if(s===-1)throw new T("internal:missing-symbol-layer","Symbol layer is not in symbol");const r=i.getSymbolLayerSize(s);if(r==null)throw new T("internal:missing-size","Symbol layer has no valid size");return r}_graphicsCollectionChanged(t){this._startCreateGraphics&&(this.add(t.added),this.remove(t.removed))}graphicUpdateHandler(t){const e=t.graphic.uid,i=this.graphics3DGraphics.get(e);if(i!=null||this._graphicsWithoutSymbol.get(e)!=null)switch(t.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,t);break;case"symbol":this._graphicUpdateSymbolHandler(i,t);break;case"attributes":break;case"origin-transform":this._graphicUpdateTransformHandler(i,t)}}_graphicUpdateGeometryHandler(t,e){this._graphicUpdateGeometryOrTransformHandler(t,e,()=>e.newValue!=null&&t!=null&&t.graphics3DSymbol.updateGeometry(t,e.newValue));const i=e.graphic.geometry;i!=null&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(t,e){const i=e.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(t,e,()=>e.newValue!=null&&t!=null&&i!=null&&t.graphics3DSymbol.updateTransform(t,i.spatialReference,e.newValue,e.action))}_graphicUpdateGeometryOrTransformHandler(t,e,i){var s;if(e.graphic.geometry!=null)if(t!=null)i()||this._recreateGraphic(t.graphic);else{const r=(s=e.graphic.symbol)==null?void 0:s.id;if(r){const a=this._symbols.get(r);if(a!=null&&a.loadStatus===Pt.LOADING)return}this._recreateGraphic(e.graphic)}else this._recreateGraphic(e.graphic)}_graphicUpdateSymbolHandler(t,e){const i=e.graphic,s=t!=null?t.graphics3DSymbol:e.oldValue!=null?this._symbols.get(e.oldValue.id):null;if(s==null||e.newValue==null)return void this._recreateGraphic(i);const r=s.symbol,a=this._getConvertedSymbol(e.newValue);if(a!=null&&(a.type!==r.type||a.type==="web-style")||r.type==="web-style")return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(r.id);if(n&&n.size!==1)return void this._recreateGraphic(i);const d=ge(r,a);if(d==null)return void this._updateSymbolMapping(r.id,a);const l={diff:d,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(s.prepareSymbolPatch(l),!At(l.diff))return void this._recreateGraphic(i);const c=this._getRenderingInfo(i);if(c==null)return void this._recreateGraphic(i);const y=s.extentPadding;for(const u of l.symbolStatePatches)u();if(y!==s.extentPadding&&this._recomputeExtentPadding(),t!=null)for(const u of l.graphics3DGraphicPatches)u(t,c);this._updateSymbolMapping(r.id,a)}_graphicUpdateVisibleHandler(t){this._updateUserVisibility(t)&&(this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty())}recreateGraphics(t){this._suspendSymbolCleanup=!0,this.remove(t),this.add(t),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===f.SYNC&&this._cleanupSymbols()}_recreateGraphic(t){this.recreateGraphics([t])}_beginGraphicUpdate(t){const e=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(t.uid,e),this._graphicsWaitingForSymbol.size===1&&this.notifyChange("updating"),e}_endGraphicUpdate(t){t&&(this._graphicsWaitingForSymbol.delete(t.uid),this._graphicsWaitingForSymbol.size===0&&(this._cleanupSymbols(),this.notifyChange("updating")))}_recomputeExtentPadding(){let t=0;this._symbols.forEach(e=>{e!=null&&(t=Math.max(t,e.extentPadding))}),this._set("extentPadding",t)}_expandComputedExtent(t){const e=ui,i=t.spatialReference;Lt(t,e);const s=this._viewSpatialReference,r=ee.tmpVec;if(Vt(i,s)||me(e[0],e[1],0,i,r,s)&&(e[0]=r[0],e[1]=r[1],me(e[3],e[4],0,i,r,s),e[3]=r[0],e[4]=r[1]),!(isFinite(e[0])&&isFinite(e[3])&&isFinite(e[1])&&isFinite(e[4])))return;const a=this.computedExtent;let n=null;const d=isFinite(e[2])&&isFinite(e[5]),l=d&&((a==null?void 0:a.zmin)==null||e[2]a.zmax);a?(e[0]a.xmax||e[4]>a.ymax||l||c)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(e[0],a.xmin),n.ymin=Math.min(e[1],a.ymin),n.xmax=Math.max(e[3],a.xmax),n.ymax=Math.max(e[4],a.ymax),n.spatialReference=s):(n=this._propertiesPool.get("computedExtent"),n.xmin=e[0],n.ymin=e[1],n.xmax=e[3],n.ymax=e[4],n.spatialReference=s),n&&(l&&(n.zmin=e[2]),c&&(n.zmax=e[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){var i,s;this._abortElevationInfoChange();const t=new AbortController;this._elevationInfoChangeAbortController=t;const e=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await de(e,this._viewSpatialReference,t.signal,b),k(t.signal),this._elevationInfoChangeAbortController=null,(i=this._labeler)==null||i.elevationInfoChange(),this.forEachGraphics3DSymbol((r,a,n)=>{r.globalPropertyChanged("elevationInfo",a)?a.forEach(d=>{const l=d.graphic,c=d.labelLayers;for(const y of c)y.graphics3DSymbolLayer.updateGraphicElevationContext(l,y)}):this._recreateSymbol(n)}),this.updateStageLayerElevationProvider(),(s=this._elevationAlignment)==null||s.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo&&this.layer.elevationInfo.mode==="relative-to-scene"||this._numberOfGraphicsProvidingElevation===0)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=_e(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&this.layer.elevationInfo.mode!=="relative-to-scene")&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new A({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){var t,e,i,s;this.clear(),this._filterVisibility!=null&&this._filterVisibility.clear(),(t=this._labeler)==null||t.reset(),(e=this._deconflictor)==null||e.clear(),(i=this._elevationAlignment)==null||i.clear(),(s=this.stageLayer)==null||s.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=_e(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(t=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:e,view:i}=this.owner,s=i.basemapTerrain.tilingScheme&&(e!=null&&e.length)?e.toArray():null;!t&&s||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=this.owner.view.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),s&&(t?this.add(s):this.recreateGraphics(s))}_recreateSymbol(t){const e=this._graphicsBySymbol.get(t),i=[];e&&(e.forEach((r,a)=>{var d;const n=r.usedMemory;this._conditionalRemove(r,a),(d=this._spatialIndex)==null||d.remove(r),i.push(r.graphic),r.destroy(),this._removeGraphics3DGraphic(a,n),this._updateLayerVisibility(),this._featureStore.events.emit("changed")}),this._graphicsBySymbol.set(t,new Map));const s=this._symbols.get(t);v(s),this._symbols.delete(t),this.add(i)}_recreateGraphicsForSymbol(t){const e=this._graphicsBySymbol.get(t);if(e){const i=[];e.forEach(s=>i.push(s.graphic)),this.recreateGraphics(i)}}_conditionalRemove(t,e){var i,s,r;this._graphicsDrapedUids.delete(e),(i=this._objectStates)==null||i.removeGraphic(t),(s=this._labeler)==null||s.removeGraphic(t),(r=this._deconflictor)==null||r.removeGraphic(t),this._graphicStateTracking!=null&&this._graphicStateTracking.removeGraphic(t)}add(t){var e;t&&t.length!==0&&((e=this.owner.view.basemapTerrain)!=null&&e.tilingScheme?(this._updatePolicyForGraphics(t)===f.ASYNC?this._addDelayed(t):this._addImmediate(t),this.notifyChange("updating")):b.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(t){if(this.effectiveUpdatePolicy===f.SYNC&&(this.layer.geometryType==="mesh"||this.layer.geometryType==null)){for(const e of t)if(e.geometry!=null&&e.geometry.type==="mesh"&&!e.geometry.loaded)return f.ASYNC}return this.effectiveUpdatePolicy}_addImmediate(t){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const e of t)this._addGraphic(e,this._getRenderingInfo(e,b),f.SYNC);this._cleanupSymbols(),this._labeler&&(this.owner.view.labeler.setDirty(),this._cleanupSymbols()),this.owner.view.deconflictor.setDirty()}_addDelayed(t){var e;for(const i of t){const s=i.uid;let r=this._pendingUpdates.get(s);r?r.add?r.state!==g.NEW&&((e=r.abortController)==null||e.abort()):this._pendingAdds++:(r=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(s,r)),r.add=i}this.notifyChange("running"),this.notifyChange("updatingRemaining")}remove(t){this.effectiveUpdatePolicy===f.ASYNC?this._removeDelayed(t):this._removeImmediate(t),this.notifyChange("updating")}_removeImmediate(t){for(const e of t)this._removeGraphic(e);this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_removeDelayed(t){var e;for(const i of t){const s=i.uid,r=this._pendingUpdates.get(s);if(r)r.add&&(r.remove?r.add=null:this._pendingUpdates.delete(s),r.state===g.LOADING&&((e=r.abortController)==null||e.abort()),this._pendingAdds--);else{const a=this._pendingUpdatesPool.pushNew();a.remove=i,this._pendingUpdates.set(s,a),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}this._pendingUpdates.size===0&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&b.warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyPendingUpdates(t){var e;if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,this._pendingUpdates.size===0&&((e=this._spatialIndex)==null?void 0:e.updating))return this._spatialIndex.update(),void t.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[i,s]of this._pendingUpdates){if(t.done){this._applyPendingRemovesFirst=!0;break}if(s.remove&&!s.add&&(this._pendingRemoves--,t.madeProgress(),this._removeGraphic(s.remove),s.remove=null,this._pendingUpdates.delete(i),this._pendingRemoves===0))break}}for(const[i,s]of this._pendingUpdates){if(t.done)break;s.add&&s.state===g.NEW&&this._processPendingUpdateNew(s);let r=this.effectiveUpdatePolicy;if(!s.remove||s.add&&s.state!==g.READY||(this._pendingRemoves--,t.madeProgress(),this._removeGraphic(s.remove),s.remove=null,r=f.SYNC),s.add)switch(s.state){case g.READY:this._addGraphic(s.add,s.renderingInfo,r),s.add=null,this._pendingAdds--,t.madeProgress();break;case g.REJECTED:s.add=null,this._pendingAdds--;case g.LOADING:}s.remove==null&&s.add==null&&this._pendingUpdates.delete(i)}this._pendingUpdates.size===0&&(this._finishPendingUpdates(),this.notifyChange("running"))}_processPendingUpdateNew(t){if(!t.add)return void(t.state=g.READY);const e=t.add.geometry;e==null||e.type!=="mesh"||e.loaded?this._processPendingUpdateNewRenderingInfo(t):this._processPendingUpdateNewMesh(t,e)}async _processPendingUpdateNewMesh(t,e){t.state=g.LOADING,t.abortController=new AbortController;const i=t.abortController.signal;try{await e.load({signal:i})}catch(s){return this._processPendingUpdateNewError(t,s)}t.abortController=null,this._processPendingUpdateNewRenderingInfo(t)}_processPendingUpdateNewError(t,e){t.abortController=null,N(e)?t.state=g.NEW:t.state=g.REJECTED}async _processPendingUpdateNewRenderingInfo(t){if(this.layer.renderer==null||this.layer.renderer.type!=="dictionary")return t.renderingInfo=this._getRenderingInfo(t.add,b),void(t.state=g.READY);t.state=g.LOADING,t.abortController=new AbortController;let e=null;try{e=await this._getRenderingInfoAsync(t.add,{signal:t.abortController.signal})}catch(i){return t.abortController=null,void(N(i)?t.state=g.NEW:t.state=g.REJECTED)}(e==null?void 0:e.symbol)==null?(b&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,b.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),t.renderingInfo=null):t.renderingInfo=e,t.state=g.READY}_addGraphic(t,e,i){var u;if(this._graphicsWithoutSymbol.set(t.uid,t),(e==null?void 0:e.symbol)==null||!Ut(t))return;if(this.stage.renderView.objectAndLayerIdRenderHelper!=null&&this.setUidToIdOnAdd){const m=jt(this.owner.view.map,this.layer.uid);this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(t.objectId,t.uid,this.layer.id,this.layer.uid,!!this.layer.popupEnabled&&!m&&$t(this.layer,(u=this.owner.view.popup)==null?void 0:u.defaultPopupTemplateEnabled))}const s=e.symbol,r=this.getOrCreateGraphics3DSymbol(s,e.renderer);if(r==null)return;this._expandComputedExtent(t.geometry);const a=this._beginGraphicUpdate(t),n=new Ft(t,e,this.layer);let d=!1;const l=m=>{m===r.symbol.id&&(d=!0)};this._whenSymbolRemoved.push(l);const c=()=>{if(--this._loadingSymbols,!this.destroyed){if(this._whenSymbolRemoved.removeUnordered(l),this._graphicsWaitingForSymbol.get(t.uid)!==a||d||r.destroyed||this.graphicSymbolSupported&&t.symbol&&t.symbol.id!==r.symbol.id)--r.referenced,this._cleanupSymbols();else{const m=this._createGraphics3DGraphic(r,n);this._spatialIndex&&m!=null&&this._spatialIndex.add(m),--r.referenced,this._endGraphicUpdate(t)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()}},y=m=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),d||(N(m)?this.add([t]):r.destroyed||this._endGraphicUpdate(t)))};++this._loadingSymbols,i===f.ASYNC?r.load(()=>this._frameTask.schedule(c),m=>this._frameTask.schedule(()=>y(m))):r.load(c,y)}_removeGraphic(t){var s,r;const e=t.uid,i=this.graphics3DGraphics.get(e);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const a=i.usedMemory,n=i.isElevationSource;this._conditionalRemove(i,e),(s=this._spatialIndex)==null||s.remove(i);const d=i.graphics3DSymbol.symbol.id;(r=this._graphicsBySymbol.get(d))==null||r.delete(e),this._graphicsWithoutSymbol.delete(e),this._removeGraphics3DGraphic(e,a,n),i.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(e),this._graphicsWaitingForSymbol.delete(e),this._graphicsWaitingForSymbol.size===0&&(this._cleanupSymbols(),this.notifyChange("updating"))}_hasLabelingContext(t){if(t instanceof be||t instanceof Tt){const e=this.symbolCreationContext.layer;return!!e.labelingInfo&&e.labelingInfo.some(i=>i.symbol===t)}return!1}_hasValidSymbolCreationContext(t){return!(t instanceof be&&!this._hasLabelingContext(t))||(b.error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(t,e){const i=t.geometry;if(i==null)return e&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,e.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!zt(i.spatialReference,this._viewSpatialReference))return e&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,e.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&t.symbol!=null)return e&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,e.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const s=this.rendererHasGeometryOperations?W(t,this.layer):t;let r;return this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||this.currentRenderer!=null)?r=this.owner.getRenderingInfo(s,this.currentRenderer,this._arcadeOnDemand):r={symbol:s.symbol||li(s.geometry)},(r==null?void 0:r.symbol)==null?(e&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,e.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):r}_getRenderingInfoAsync(t,e){if(t.geometry==null)return b&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,b.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&t.symbol!=null)return b&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,b.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const i=this.rendererHasGeometryOperations?W(t,this.layer):t;return this.owner.getRenderingInfoAsync(i,this.currentRenderer,this._arcadeOnDemand,e)}_createGraphics3DSymbol(t,e){if(!this._hasValidSymbolCreationContext(t))return null;const i=this._getConvertedSymbol(t);if(!i)return null;let s;if(e!=null&&"backgroundFillSymbol"in e&&e.backgroundFillSymbol){const a=oe(e.backgroundFillSymbol,{ignoreDrivers:!0});a.symbol!=null&&a.symbol.type!=="web-style"&&a.symbol.type!=="cim"&&(s=a.symbol.symbolLayers)}const r=ci(i,this.symbolCreationContext,s);return r.load(()=>{const a=r.extentPadding;a>this.extentPadding&&this._set("extentPadding",a),this.notifyChange("averageSymbolComplexity")},()=>{}),r}getOrCreateGraphics3DSymbol(t,e){let i=this._symbols.get(t.id);return i===void 0&&(i=t instanceof Mt?new kt(t,s=>this._frameTask.schedule(s),s=>this._createGraphics3DSymbol(s,e)):this._createGraphics3DSymbol(t,e),this._symbols.set(t.id,i)),i!=null&&++i.referenced,i}trackGraphicState(t){return this._graphicStateTracking==null&&(this._graphicStateTracking=new pi(this)),this._graphicStateTracking.add(t)}_addGraphics3DGraphic(t){this._usedMemory+=t.usedMemory,this.graphics3DGraphics.set(t.graphic.uid,t),this._numberOfGraphics++,t.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(t,e,i=!1){this._usedMemory-=e,this.graphics3DGraphics.delete(t),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(t,e){var n,d,l;const i=e.graphic;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(t.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const s=t.createGraphics3DGraphic(e);if(s==null)return null;this._addGraphics3DGraphic(s);const r=t.symbol.id;if(this._graphicsBySymbol.has(r)||this._graphicsBySymbol.set(r,new Map),this._graphicsBySymbol.get(r).set(i.uid,s),s.isDraped&&this._graphicsDrapedUids.add(i.uid),s.centroid=null,i.geometry!=null&&i.geometry.type!=="point"&&(s.centroid=Ht(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(s),this._scaleVisibility!=null&&this._scaleVisibility.updateVisibility(s),this._filterVisibility!=null){const{defaultVisibility:c}=this._filterVisibility;s.setVisibilityFlag(E.GRAPHIC,R.FILTER,c),c||this._filterVisibility.reapply()}(n=this._deconflictor)==null||n.addGraphic(s),(d=this._labeler)==null||d.addGraphic(s),(l=this._objectStates)==null||l.addGraphic(s),this._deconflictor&&this.owner.view.deconflictor.setInitialIconVisibilityFlag(this,s),s.initialize(this.stageLayer,this.owner),this._graphicStateTracking!=null&&this._graphicStateTracking.addGraphic(s);const a=this._whenGraphics3DGraphicRequests[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.uid],a.resolve(s)),s}_abortRendererChange(){this._rendererChangeAbortController&&(this._rendererChangeAbortController.abort(),this._rendererChangeAbortController=null)}async rendererChange(t){if(this._abortRendererChange(),t!==this.currentRenderer)if(this._validateRenderer(t),t==null&&this._currentRendererChange(null,!1),Bt(t))if(t!=null&&t.arcadeRequired){const e=new AbortController;this._rendererChangeAbortController=e;const{arcadeUtils:i}=await this._ensureArcade();k(e);const s=i.hasGeometryOperations(t);s&&(await i.enableGeometryOperations(),k(e)),this.effectiveUpdatePolicy===f.ASYNC?await this._frameTask.schedule(()=>this._currentRendererChange(t,s),e.signal):this._currentRendererChange(t,s),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===f.ASYNC){const e=new AbortController;this._rendererChangeAbortController=e,await this._frameTask.schedule(()=>this._currentRendererChange(t,!1),e.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(t,!1);else this._currentRendererChange(t,!1)}async _ensureArcade(){return this._arcadeOnDemand==null?(this._arcadeOnDemand=await Nt(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(t,e){var r;this.currentRenderer=t,this.rendererHasGeometryOperations=e,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(t===i)return;if(this._symbolConversionCache.clear(),t==null)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const s=ge(i,t);this._updateUnchangedSymbolMappings(s,t,i),this.symbolCreationContext.renderer=t,s!=null&&(s.type==="complete"?this.recreateAllGraphicsAndSymbols():s.type==="partial"&&(this._applyRendererDiff(s,t,i)?(r=this._labeler)==null||r.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(t){for(const e in t.diff)switch(e){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete t.diff[e];break;default:return!0}return!1}_applySymbolSetDiff(t,e,i){t=t||[],e=e||[];const s=[];for(const r of e){const a=this._graphicsBySymbol.get(r.id);a&&a.forEach((n,d)=>{const l=n.graphic,c=this.layer instanceof Wt?this.layer:null,y=this._arcadeOnDemand;if(r===i.defaultSymbol&&i.getSymbol(W(l,c),{arcade:y})===i.defaultSymbol)return;const u=n.usedMemory;t.length||i.defaultSymbol?s.push(l):this._graphicsWithoutSymbol.set(d,l);const m=this.graphics3DGraphics.get(d);this._conditionalRemove(m,d),n.destroy(),a.delete(d),this._removeGraphics3DGraphic(d,u),this._updateLayerVisibility()}),this._whenSymbolRemoved.forAll(n=>n(r.id))}(t.length||s.length)&&(this._graphicsWithoutSymbol.forEach(r=>s.push(r)),this._graphicsWithoutSymbol.clear(),this.add(s)),this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_applyUniqueValueRendererDiff(t,e,i){const s=t.diff.defaultSymbol,r=t.diff.uniqueValueInfos;if(s||r){const a=r?r.added.map(d=>d.symbol).filter(fe):[],n=r?r.removed.map(d=>d.symbol).filter(fe):[];if(r)for(let d=0;dc!=null?c.id:null,r=t&&t.diff,a=r==null?void 0:r.defaultSymbol,n=r&&r.uniqueValueInfos;let d;if(n)d=n.unchanged.map(c=>({oldId:s(c.oldValue.symbol),newId:s(c.newValue.symbol)}));else{d=[];for(const c of i.uniqueValueInfos??[]){const y=s(c.symbol),u=(l=e.uniqueValueInfos)==null?void 0:l.find(m=>m.value===c.value);u&&y!==s(u.symbol)&&d.push({oldId:y,newId:s(u.symbol)})}}return!a&&i.defaultSymbol&&d.push({oldId:s(i.defaultSymbol),newId:s(e.defaultSymbol)}),d}_updateSymbolMapping(t,e){const i=e!=null&&e?typeof e=="string"?e:e.id:null;if(t==null||t===i)return;const s=this._graphicsBySymbol.get(t);this._graphicsBySymbol.delete(t),s!==void 0&&this._graphicsBySymbol.set(i,s);const r=this._symbols.get(t);if(r!==void 0&&(this._symbols.delete(t),this._symbols.set(i,r),r!=null)){const a=typeof e=="string"?null:e;a!=null?r.symbol=a:r.symbol.id=i}}_updateUnchangedSymbolMappings(t,e,i){const s=this._calculateUnchangedSymbolMapping(t,e,i);for(const{oldId:r,newId:a}of s)this._updateSymbolMapping(r,a)}_applyRendererDiff(t,e,i){if(this._diffHasSymbolChange(t))return!1;if(e instanceof ve&&i instanceof ve&&this._applyUniqueValueRendererDiff(t,e,i)&&Object.keys(t.diff).length===0)return!0;for(const[s]of this._graphicsBySymbol){const r=this._symbols.get(s);if(r!=null)switch(r.applyRendererDiff(t,e)){case q.RecreateSymbol:this._recreateSymbol(s);break;case q.RecreateGraphics:this._recreateGraphicsForSymbol(s);case q.FastUpdate:}}return!0}opacityChange(){this.forEachGraphics3DSymbol((t,e)=>t.globalPropertyChanged("opacity",e)),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(t){t!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=t,this.stageLayer.sliceable=t,this.forEachGraphics3DSymbol((e,i)=>e.globalPropertyChanged("slicePlaneEnabled",i)),this._deconflictor&&this._deconflictor.slicePlaneEnabledChange(),this._labeler&&this._labeler.slicePlaneEnabledChange())}_physicalBasedRenderingChange(t){this.symbolCreationContext.physicalBasedRenderingEnabled=t,this.forEachGraphics3DSymbol((e,i,s)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",i)||this._recreateSymbol(s)})}_skipHighSymbolLoDsChange(t){this.symbolCreationContext.skipHighSymbolLods=t,this.forEachGraphics3DSymbol((e,i,s)=>{e.globalPropertyChanged("skipHighSymbolLods",i)||this._recreateSymbol(s)})}_pixelRatioChange(){this.forEachGraphics3DSymbol((t,e,i)=>{t.globalPropertyChanged("pixelRatio",e)||this._recreateSymbol(i)})}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=qt(()=>{this._updatingPendingLoadedGraphicsChange=null})}setClippingExtent(t,e){const i=this.symbolCreationContext.clippingExtent,s=H();return Yt(t,s,e)?this.symbolCreationContext.clippingExtent=je(te(),s):this.symbolCreationContext.clippingExtent=null,!Zt(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(t){var i,s;if(this.destroyed)return;let e=!1;this.graphics3DGraphics.forEach(r=>{t(r)&&(e=!0)}),e&&((i=this.owner.view.labeler)==null||i.setDirty(),(s=this.owner.view.deconflictor)==null||s.setDirty())}forEachGraphics3DSymbol(t){for(const[e,i]of this._symbols){if(i==null)return;t(i,this._graphicsBySymbol.get(e)||_i,e)}}updateAllGraphicsVisibility(){this._filterVisibility!=null&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities(t=>{const e=this._updateUserVisibility(t),i=this._scaleVisibility!=null&&this._scaleVisibility.updateVisibility(t);return e||i})}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(E.GRAPHIC,R.USER,!1))}_validateRenderer(t){var i;const e=Xt(t,{geometryType:(i=this.layer)==null?void 0:i.geometryType});if(e){const s=`Renderer for layer '${this.layer.title?`${this.layer.title}, `:""}, id:${this.layer.id}' is not supported in a SceneView`;b.warn(s,e.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let t=!1;this._symbols.forEach((e,i)=>{if(e==null||e.referenced>0)return;const s=this._graphicsBySymbol.get(i);s&&s.size!==0||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),v(e),t=!0)}),t&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){return{snapshotInternals:()=>({graphics:[...this.graphics3DGraphics.keys()].sort(),symbols:[...this._symbols.keys()].sort(),graphicsBySymbol:[...this._graphicsBySymbol.keys()].sort().map(t=>({symbolId:t,graphics:[...this._graphicsBySymbol.get(t).keys()].sort()})),graphicsWithoutSymbol:[...this._graphicsWithoutSymbol.keys()].sort(),graphicsDrapedUids:[...this._graphicsDrapedUids].sort(),pendingUpdates:this._pendingUpdates}),symbols:this._symbols,filterVisibility:this._filterVisibility,numPending:this._pendingUpdates.size,forceUpdatePolicy:t=>{this._forcedUpdatePolicy=t}}}get performanceInfo(){return{visible:this.graphics3DGraphics.size,missing:this._graphicsWithoutSymbol.size,pending:this._pendingUpdates.size}}};var g;p.tmpVec=U(),o([h({readOnly:!0})],p.prototype,"computedExtent",void 0),o([h()],p.prototype,"currentRenderer",void 0),o([h()],p.prototype,"rendererHasGeometryOperations",void 0),o([h()],p.prototype,"_frameTask",void 0),o([h({readOnly:!0})],p.prototype,"_viewSpatialReference",null),o([h()],p.prototype,"_rendererChangeAbortController",void 0),o([h()],p.prototype,"_elevationInfoChangeAbortController",void 0),o([h()],p.prototype,"_initializeAbortController",void 0),o([h()],p.prototype,"_elevationAlignment",void 0),o([h()],p.prototype,"_scaleVisibility",void 0),o([h()],p.prototype,"_filterVisibility",void 0),o([h()],p.prototype,"_initializePromise",void 0),o([h()],p.prototype,"_spatialIndex",void 0),o([h({readOnly:!0})],p.prototype,"extentPadding",void 0),o([h()],p.prototype,"_updatingPendingLoadedGraphicsChange",void 0),o([h()],p.prototype,"_featureStore",void 0),o([h()],p.prototype,"_deconflictor",void 0),o([h()],p.prototype,"_labeler",void 0),o([h()],p.prototype,"_objectStates",void 0),o([h()],p.prototype,"_loadingSymbols",void 0),o([h()],p.prototype,"preferredUpdatePolicy",void 0),o([h()],p.prototype,"_forcedUpdatePolicy",void 0),o([h({readOnly:!0})],p.prototype,"effectiveUpdatePolicy",null),o([h({constructOnly:!0})],p.prototype,"elevationFeatureExpressionEnabled",void 0),o([h({constructOnly:!0})],p.prototype,"owner",void 0),o([h({constructOnly:!0})],p.prototype,"layer",void 0),o([h({constructOnly:!0})],p.prototype,"graphicSymbolSupported",void 0),o([h({constructOnly:!0})],p.prototype,"getRenderingInfoWithoutRenderer",void 0),o([h({constructOnly:!0})],p.prototype,"componentFactories",void 0),o([h({constructOnly:!0})],p.prototype,"setUidToIdOnAdd",void 0),o([h()],p.prototype,"featureStore",null),o([h()],p.prototype,"initializePromise",null),o([h()],p.prototype,"scaleVisibility",null),o([h()],p.prototype,"elevationAlignment",null),o([h()],p.prototype,"objectStates",null),o([h()],p.prototype,"filterVisibility",null),o([h({readOnly:!0})],p.prototype,"updating",null),o([h({readOnly:!0})],p.prototype,"running",null),o([h({readOnly:!0})],p.prototype,"suspendedOrOutsideOfView",null),o([h({readOnly:!0,dependsOn:[]})],p.prototype,"updatingRemaining",null),o([h({readOnly:!0})],p.prototype,"displayFeatureLimit",null),o([h({readOnly:!0,dependsOn:[]})],p.prototype,"averageSymbolComplexity",null),o([h({constructOnly:!0})],p.prototype,"hasZ",void 0),o([h({constructOnly:!0})],p.prototype,"hasM",void 0),o([h()],p.prototype,"_objectIdField",null),p=ee=o([L(Te)],p),function(t){t[t.NEW=0]="NEW",t[t.LOADING=1]="LOADING",t[t.READY=2]="READY",t[t.REJECTED=3]="REJECTED"}(g||(g={}));class gi{constructor(){this.add=null,this.renderingInfo=null,this.state=g.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=g.NEW,this.abortController=null,this.remove=null}}const mi=10,G=U(),$=U(),_i=new Map,Ae=re.getLogger("esri.views.3d.layers.graphics.Graphics3DScaleVisibility");let C=class extends V{constructor(t){super(t),this._scaleRangeActive=!1,this._layerScaleRangeVisibilityQuery=!1,this._extent=null,this._updatingHandles=new Jt,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this._dirty=!0}initialize(){this.updateScaleRangeActive();const t=this.graphicsCoreOwner.view.resourceController.scheduler;this.addHandles(t.registerTask(B.SCALE_VISIBILITY,this)),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this.layerMinMaxScaleChangeHandler())}destroy(){this._updatingHandles.destroy(),this.removeHandles(),this._dirty=!1,this._extent=null,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null}get updating(){return this._dirty||this._updatingHandles.updating}_setDirty(){this._dirty=!0}setExtent(t){const e=this.graphicsCoreOwner.view.spatialReference,i=this.graphicsCoreOwner.view.basemapTerrain.spatialReference;if(e===i)this._extent=t??null;else{const s=H();Ce(t,e,s,i)?this._extent=s:this._extent=null}this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){const t=this.layer,e=t.effectiveScaleRange;let i=this.layerScaleEnabled&&e!=null&&Le(e.minScale,e.maxScale);t.labelingInfo&&!i&&(i=t.labelingInfo.some(r=>r&&Le(r.minScale??0,r.maxScale??0)));const s=this._scaleRangeActive!==i;return this._scaleRangeActive=i,i&&!this.hasHandles(z)&&this.basemapTerrain?(this.addHandles(this.basemapTerrain.on("scale-change",r=>this._scaleUpdateHandler(r)),z),this.layerScaleEnabled&&this.addHandles(this.basemapTerrain.on("tiles-visibility-changed",()=>this._setDirty()),z)):!i&&this.hasHandles(z)&&this.removeHandles(z),s}get running(){return!(!this.graphicsCoreOwner.view.basemapTerrain||!this.updating)}runTask(t){const e=this.graphicsCoreOwner.view.basemapTerrain;if(this._extent&&e&&e.ready&&this._scaleRangeActive&&this.layerScaleEnabled){if(this._layerScaleRangeVisibilityQuery)return ae.YIELD;{this._layerScaleRangeVisibilityQuery=!0;const{minScale:i,maxScale:s}=this.layer.effectiveScaleRange;e.queryVisibleScaleRange(this._extent,i,s,r=>this._finishUpdate(r))}}else this._finishUpdate(!0);t.madeProgress()}_finishUpdate(t){this._layerScaleRangeVisibilityQuery=!1,this._set("suspended",!t),this._dirty=!1}_visibleAtLayerScale(t){const e=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||we(t,e.minScale||0,e.maxScale||0)}_visibleAtLabelScale(t,e){return we(t,e.minScale||0,e.maxScale||0)}_graphicScale(t){let e;return t.centroid!=null?e=t.centroid:t.graphic.geometry!=null&&t.graphic.geometry.type==="point"&&(e=t.graphic.geometry),e?this.graphicsCoreOwner.view.basemapTerrain?this.graphicsCoreOwner.view.basemapTerrain.getScale(e):1:null}_graphicVisible(t){if(!this.layerScaleEnabled)return!0;const e=this._graphicScale(t);return this._visibleAtLayerScale(e)}updateVisibility(t){if(this._scaleRangeActive){const e=this._graphicVisible(t);return t.setVisibilityFlag(E.GRAPHIC,R.SCALE_RANGE,e)}return!1}updateGraphicLabelScaleVisibility(t){if(!this._scaleRangeActive||!t.labelLayers||t.labelLayers.length===0)return!1;const e=this._graphicScale(t),i=this._updateLabelScaleVisibility(t,e);return i&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty()),i}_updateLabelScaleVisibility(t,e){if(!t.labelLayers||t.labelLayers.length===0)return!1;const i=t.labelLayers[0]._labelClass;if((i==null?void 0:i.minScale)!=null&&i.maxScale!=null){const s=this._visibleAtLabelScale(e,i);if(t.setVisibilityFlag(E.LABEL,R.SCALE_RANGE,s))return!0}return!1}_scaleUpdateHandler(t){if(this._setDirty(),!this.graphicsCore.visible)return;const e=t.extent,i=t.scale,s=this._visibleAtLayerScale(i);let r=!1;const a=this.graphicsCoreOwner.view.spatialReference,n=t.spatialReference;if(n==null)return void Ae.error("scaleUpdate: Internal error, no SpatialReference given for tiles");const d=!n.equals(a);if(d&&!Ce(e,n,Ve,a))return void Ae.error("scaleUpdate: Internal error, cannot project AABR from "+n+" to wkid "+a);const l=d?Ve:e;this.queryGraphicUIDsInExtent(l,a,c=>{const y=this.graphicsCore.getGraphics3DGraphicById(c);if(y==null)return;const u=y.centroid;u!=null&&(e[0]>u.x||e[1]>u.y||e[2]t.setVisibilityFlag(E.GRAPHIC,R.SCALE_RANGE,!0)):this._scaleRangeActive&&this.graphicsCore.updateAllGraphicsVisibility(),this._setDirty()}};function Le(t,e){return t>0||e>0}o([h()],C.prototype,"graphicsCoreOwner",void 0),o([h()],C.prototype,"layer",void 0),o([h()],C.prototype,"queryGraphicUIDsInExtent",void 0),o([h()],C.prototype,"graphicsCore",void 0),o([h()],C.prototype,"basemapTerrain",void 0),o([h({constructOnly:!0})],C.prototype,"layerScaleEnabled",void 0),o([h({readOnly:!0})],C.prototype,"suspended",void 0),o([h({readOnly:!0})],C.prototype,"updating",null),o([h()],C.prototype,"_dirty",void 0),C=o([L("esri.views.3d.layers.graphics.Graphics3DScaleVisibility")],C);const z="terrain-events",Ve=H(),bi=.05;class fi{constructor(){this._extents=new Q({allocator:e=>e||H()}),this._tmpExtent=H(),this._dirty=!1}get empty(){return this._extents.length===0}get size(){return this._extents.length}clear(){this._extents.clear()}add(e){this._contains(e)||(this._removeContained(e),Ge(this._extents.pushNew(),e),this._dirty=!0)}pop(){return this._dirty&&this._mergeTight(),this._extents.pop()}merge(e){return this._mergeTight(e),e.hasProgressed}_mergeTight(e=Fe){const i=this._extents,s=new Set;let r=0;for(;r!==i.length;){i.sort((a,n)=>a[0]-n[0]),r=i.length,s.clear();for(let a=0;a=n[2])break;s.add(l)}s.forEach(d=>{if(n===d)return;if(d[2]<=n[0])return void s.delete(d);const l=Y(n),c=Y(d),y=this._tmpExtent;Qt(n,d,y);const u=l+c;(Y(y)-u)/uxe(i,e))}_removeContained(e){this._extents.filterInPlace(i=>!xe(e,i))}get test(){const e=this;return{containsPoint:i=>e._extents.some(s=>Kt(s,i))}}}let P=class extends V{constructor(t){super(t),this._dirtyExtents=new fi,this._globalDirty=!1,this._averageExtentUpdateSize=0,this._dirtyGraphicsSet=new Set,this._updateElevation=!1,this.graphicsCoreOwner=null,this.graphicsCore=null,this.events=new ie}initialize(){const t=this.elevationProvider,e=this.graphicsCoreOwner.view.resourceController.scheduler;this.addHandles([t.on("elevation-change",i=>this._elevationChanged(i)),S(()=>this.graphicsCoreOwner.suspended,()=>this._suspendedChange()),e.registerTask(B.ELEVATION_ALIGNMENT,this)])}destroy(){this._dirtyGraphicsSet.clear(),this.graphicsCoreOwner=null,this.graphicsCore=null,this.queryGraphicUIDsInExtent=null,this.elevationProvider=null}clear(){this._dirtyGraphicsSet.clear(),this.notifyChange("updating")}_suspendedChange(){this.graphicsCoreOwner.suspended===!0?this._updateElevation=!1:this.graphicsCoreOwner.suspended===!1&&this._updateElevation&&(this._globalDirty=!0,this.notifyChange("updating"))}elevationInfoChange(){this._globalDirty=!0,this.notifyChange("updating")}get updating(){return this.running}get running(){return this._dirtyGraphicsSet.size>0||this._dirtyExtents&&!this._dirtyExtents.empty||this._globalDirty}get updatingRemaining(){return this._dirtyGraphicsSet.size+this._dirtyExtents.size*this._averageExtentUpdateSize}runTask(t){for(this._globalDirty&&(this._markAllGraphicsElevationDirty(),this._globalDirty=!1,t.madeProgress()),t.run(()=>this._dirtyExtents.merge(t));this.running&&!t.done;)this._updateDirtyGraphics(t),this._updateDirtyExtents(t);this.notifyChange("updating")}_updateDirtyGraphics(t){const e=this.graphicsCoreOwner.view.renderCoordsHelper,i=this.graphicsCore.effectiveUpdatePolicy===f.ASYNC;for(const s of this._dirtyGraphicsSet.keys()){const r=this.graphicsCore.getGraphics3DGraphicById(s);if(this._dirtyGraphicsSet.delete(s),r!=null&&(r.alignWithElevation(this.elevationProvider,e,i),this.graphicsCoreOwner.view.deconflictor.setDirty(),t.madeProgress()),t.done)return}}_updateDirtyExtents(t){for(;!this._dirtyExtents.empty&&!t.done;){const e=this._dirtyExtents.pop(),i=this.elevationProvider.spatialReference;this.events.emit("invalidate-elevation",{extent:e,spatialReference:i});const s=this._dirtyGraphicsSet.size;this.queryGraphicUIDsInExtent(e,i,r=>{const a=this.graphicsCore.getGraphics3DGraphicById(r);a!=null&&a.needsElevationUpdates()&&this._dirtyGraphicsSet.add(r)}),this._averageExtentUpdateSize=.1*(this._dirtyGraphicsSet.size-s)+.9*this._averageExtentUpdateSize,t.madeProgress()}}_markAllGraphicsElevationDirty(){this._dirtyExtents.clear(),this._dirtyGraphicsSet.clear(),this.graphicsCore.graphics3DGraphics.forEach((t,e)=>this._dirtyGraphicsSet.add(e))}_elevationChanged(t){if(t.context==="scene"&&(!this.graphicsCore.layer.elevationInfo||this.graphicsCore.layer.elevationInfo.mode!=="relative-to-scene"))return;const{extent:e,spatialReference:i}=t;if(this.graphicsCoreOwner.suspended){if(!this._updateElevation){const s=this.graphicsCore.computedExtent;s&&e[2]>s.xmin&&e[0]s.ymin&&e[1]this._viewChange()),S(()=>e.state.camera,()=>this._viewChange(),ti),s.registerTask(B.FRUSTUM_VISIBILITY,this),S(()=>i.visibleElevationBounds,()=>this._elevationBoundsChange())]),e.viewingMode==="local"?this._isVisibleBelowSurface=!0:this.addHandles([S(()=>{var r,a,n;return[i.baseOpacity,i.wireframe,(n=(a=(r=e.map)==null?void 0:r.ground)==null?void 0:a.navigationConstraint)==null?void 0:n.type]},()=>this._updateIsVisibleBelowSurface(),ii)])}destroy(){this._set("graphicsCoreOwner",null),this._extent=null,this._extentIntersection=null}_setDirty(){this.updating||this._set("updating",!0)}setExtent(t){this._extent=t,this._extentIntersectionDirty=!0,this._setDirty()}_viewChange(){this._setDirty()}_elevationBoundsChange(){this._setDirty(),this._extentIntersectionDirty=!0}set _isVisibleBelowSurface(t){this._isVisibleBelowSurfaceInternal=t,this._setDirty(),this._extentIntersectionDirty=!0}_updateIsVisibleBelowSurface(){var r,a;const t=this.graphicsCoreOwner.view,e=t.basemapTerrain,i=t.viewingMode==="local",s=((a=(r=t.map.ground)==null?void 0:r.navigationConstraint)==null?void 0:a.type)==="none";this._isVisibleBelowSurface=i||!e.opaque||s}_updateExtentIntersection(){if(!this._extentIntersectionDirty)return;this._extentIntersectionDirty=!1;const t=this.graphicsCoreOwner.view;let e;if(this._isVisibleBelowSurfaceInternal)e=-.3*Ie(t.spatialReference).radius;else{const{min:i,max:s}=t.basemapTerrain.visibleElevationBounds;e=i-Math.max(1,(s-i)*(vi-1))}this._extentIntersection.update(this._extent,t.spatialReference,e)}get running(){return this.updating}runTask(t){if(this._set("updating",!1),!this._extent)return this._set("suspended",!1),ae.YIELD;this._updateExtentIntersection();const e=this.graphicsCoreOwner.view.frustum,i=Ie(this.graphicsCoreOwner.view.spatialReference).radius;this._set("suspended",!this._extentIntersection.isVisibleInFrustum(e,i)),t.madeProgress()}};o([h({readOnly:!0})],M.prototype,"suspended",void 0),o([h({constructOnly:!0})],M.prototype,"graphicsCoreOwner",void 0),o([h({readOnly:!0})],M.prototype,"updating",void 0),M=o([L("esri.views.3d.layers.graphics.Graphics3DFrustumVisibility")],M);var I;(function(t){t[t.Object=0]="Object",t[t.RenderGeometry=1]="RenderGeometry",t[t.External=2]="External",t[t.COUNT=3]="COUNT"})(I||(I={}));class Si{constructor(){this._items=[]}addObject(e,i){this._items.push({type:I.Object,objectStateId:i,object:e})}addRenderGeometry(e,i,s){this._items.push({type:I.RenderGeometry,objectStateId:i,renderGeometry:e,owner:s})}addExternal(e,i){this._items.push({type:I.External,objectStateId:i,remove:e})}remove(e){for(let i=this._items.length-1;i>=0;--i){const s=this._items[i];s.objectStateId===e&&(this._removeObjectStateItem(s),this._items.splice(i,1))}}removeObject(e){for(let i=this._items.length-1;i>=0;--i){const s=this._items[i];s.type===I.Object&&s.object===e&&(this._removeObjectStateItem(s),this._items.splice(i,1))}}removeRenderGeometry(e){for(let i=this._items.length-1;i>=0;--i){const s=this._items[i];s.type===I.RenderGeometry&&s.renderGeometry===e&&(this._removeObjectStateItem(s),this._items.splice(i,1))}}removeAll(){this._items.forEach(e=>{this._removeObjectStateItem(e)}),this._items=[]}_removeObjectStateItem(e){switch(e.type){case I.Object:e.objectStateId.channel===Ee.Highlight?e.object.removeHighlight(e.objectStateId):e.objectStateId.channel===Ee.MaskOccludee&&e.object.removeOcclude(e.objectStateId);break;case I.RenderGeometry:e.owner.removeRenderGeometryObjectState(e.renderGeometry,e.objectStateId);break;case I.External:e.remove(e.objectStateId)}}}class Ci{constructor(e,i){this.stateType=e,this.objectIdField=i,this.objectStateSet=new Si,this.ids=new Set,this.paused=!1}hasGraphic(e){if(this.objectIdField){const i=e.graphic.attributes[this.objectIdField];return this.ids.has(i)}return this.ids.has(e.graphic.uid)}}class Pi{constructor(e){this._graphicsCore=e,this._stateSets=new Array}destroy(){this.reset(),this._stateSets=null}reset(){this._stateSets&&(this._stateSets.forEach(e=>e.objectStateSet.removeAll()),this._stateSets.length=0)}acquireSet(e,i){const s=new Ci(e,i);this._stateSets.push(s);const r=se(()=>this.releaseSet(s));return{set:s,handle:r}}releaseSet(e){e.objectStateSet.removeAll();const i=this._stateSets?this._stateSets.indexOf(e):-1;i!==-1&&this._stateSets.splice(i,1)}_addObjectStateSet(e,i){e.addObjectStateSet(i.stateType,i.objectStateSet)}_removeObjectStateSet(e,i){e.removeObjectState(i.objectStateSet)}setUid(e,i){e.ids.add(i);const s=this._graphicsCore.graphics3DGraphics.get(i);s&&this._addObjectStateSet(s,e)}setUids(e,i){i.forEach(s=>this.setUid(e,s))}setObjectIds(e,i){i.forEach(s=>e.ids.add(s)),this._initializeSet(e)}addGraphic(e){this._stateSets.forEach(i=>{!i.paused&&i.hasGraphic(e)&&this._addObjectStateSet(e,i)})}removeGraphic(e){this._stateSets.forEach(i=>{i.hasGraphic(e)&&this._removeObjectStateSet(e,i)})}allGraphicsDeleted(){this._stateSets&&this._stateSets.forEach(e=>e.objectStateSet.removeAll())}_initializeSet(e){const i=this._graphicsCore.graphics3DGraphics;e.objectIdField?i.forEach(s=>{s&&e.hasGraphic(s)&&this._addObjectStateSet(s,e)}):e.ids.forEach(s=>{const r=i.get(s);r&&this._addObjectStateSet(r,e)})}get test(){return{states:this._stateSets}}}export{p as F,hi as e,fi as l,P as p,Pi as s,M as u,C as y}; diff --git a/dist/assets/Graphics3DObjectStates-JUKhPt0b.js b/dist/assets/Graphics3DObjectStates-JUKhPt0b.js new file mode 100644 index 0000000..e2cd2e1 --- /dev/null +++ b/dist/assets/Graphics3DObjectStates-JUKhPt0b.js @@ -0,0 +1 @@ +import{ax as ze,jv as Me,rG as ke,ju as He,rH as Be,jt as We,rI as Ne,V as qe,rJ as Ye,rK as Ze,rL as Xe,rM as Je,ea as te,e as o,y as h,c as L,g as V,z as ie,qb as $,c4 as Qe,eV as Ke,eU as et,rN as Ue,rO as tt,jY as it,ab as k,b as v,rP as st,qZ as rt,a0 as se,dE as at,eb as je,cb as nt,cc as ot,rQ as Fe,dw as lt,m0 as ht,R as re,fI as J,mV as dt,b3 as ne,fJ as ct,ed as pt,a8 as U,C as f,rR as yt,rS as oe,rT as ut,rU as gt,dO as mt,bo as le,aO as Q,rV as _t,rW as E,rX as R,rY as bt,rZ as ft,i6 as he,i7 as de,B as S,v as vt,fg as St,T as Ct,rr as $e,bn as B,bq as ce,r as T,bW as wt,lB as Gt,r_ as ae,r$ as xt,ag as It,s0 as Et,aa as Rt,bz as pe,bx as ye,bO as ue,ca as Dt,L as Ot,s1 as Pt,aF as ge,s2 as At,s3 as Lt,bt as Vt,s4 as me,s5 as _e,ac as W,s6 as Ut,lF as jt,fM as Ft,s7 as $t,s8 as be,aC as Tt,cj as zt,aJ as N,s9 as Mt,sa as kt,sb as Ht,sc as Bt,cZ as Wt,aI as Nt,dY as fe,jr as ve,sd as q,f2 as qt,cf as H,se as Yt,lg as Zt,sf as Xt,gk as Se,h as Jt,qi as Ce,oI as we,jX as Ge,oE as Y,et as Qt,sg as xe,sh as Kt,si as ei,a9 as ti,P as ii,mS as Ie,aK as Ee}from"./index-pCX-0tJH.js";import{o as j}from"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import{s as si}from"./PooledRBush-rhLtoPG7.js";const ri=ze.fromSimpleMarkerSymbol(Me),ai=ke.fromSimpleLineSymbol(He),ni=Be.fromSimpleFillSymbol(We),oi=new Ne({symbolLayers:new qe([new Ye({material:{color:Ze},edges:new Xe({size:"1px",color:Je})})])});function li(t){if(t==null)return null;switch(t.type){case"mesh":return oi;case"point":case"multipoint":return ri;case"polyline":return ai;case"polygon":case"extent":return ni}return null}let hi=class{constructor(e,i,s){this.maximumTotalNumberOfVertices=e,this.maximumNumberOfFeatures=i,this.averageSymbolComplexity=s}};const Re=te();let x=class extends V{constructor(e){super(e),this.events=new ie,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.featureAdapter={getAttribute:(i,s)=>"graphic"in i?i.graphic.attributes[s]:j.getAttribute(i,s),getAttributes:i=>"graphic"in i?i.graphic.attributes:j.getAttributes(i),getObjectId:i=>"graphic"in i?$(i.graphic,this.objectIdField)??void 0:j.getObjectId(i),getGeometry:i=>"graphic"in i?i.getAsOptimizedGeometry(this.hasZ,this.hasM):j.getGeometry(i),getCentroid:(i,s)=>{if("graphic"in i){let r=null;i.centroid!=null?r=i.centroid:i.graphic.geometry.type==="point"&&Qe(i.graphic.geometry,De,this.viewSpatialReference)&&(r=De);const a=new Array(2+(s.hasZ?1:0)+(s.hasM?1:0));return r==null?(a[0]=0,a[1]=0,a[2]=0,a[3]=0):(a[0]=r.x,a[1]=r.y,s.hasZ&&(a[2]=r.hasZ?r.z:0),s.hasM&&(a[s.hasZ?3:2]=r.hasM?r.m:0)),new Ke([],a)}return j.getCentroid(i,s)},cloneWithGeometry:(i,s)=>"graphic"in i?new et(s,this.featureAdapter.getAttributes(i),null,this.featureAdapter.getObjectId(i)):j.cloneWithGeometry(i,s)}}forEachInBounds(e,i){this.getSpatialIndex().forEachInBounds(e,i)}forEachBounds(e,i){const s=this.getSpatialIndex();for(const r of e){const a=this.featureAdapter.getObjectId(r);s.getBounds(a,Re)!=null&&i(Re)}}};o([h({constructOnly:!0})],x.prototype,"getSpatialIndex",void 0),o([h({constructOnly:!0})],x.prototype,"forEach",void 0),o([h({constructOnly:!0})],x.prototype,"hasZ",void 0),o([h({constructOnly:!0})],x.prototype,"hasM",void 0),o([h({constructOnly:!0})],x.prototype,"objectIdField",void 0),o([h({constructOnly:!0})],x.prototype,"viewSpatialReference",void 0),o([h({constructOnly:!0})],x.prototype,"featureSpatialReference",void 0),x=o([L("esri.views.3d.layers.graphics.Graphics3DFeatureStore")],x);const De={type:"point",x:0,y:0,hasZ:!1,hasM:!1,spatialReference:null};let di=class extends Ue{constructor(e,i,s){super(e,i,s),this._calloutSymbolLayer=null,this.symbol.hasVisibleCallout()&&(this._calloutSymbolLayer=tt(this.symbol,i))}async doLoad(e){var s;const i=this._calloutSymbolLayer?it(this._calloutSymbolLayer.load()):null;try{await super.doLoad(e),k(e)}catch(r){throw(s=this._calloutSymbolLayer)==null||s.abortLoad(),r}i&&await i}destroy(){super.destroy(),this._calloutSymbolLayer=v(this._calloutSymbolLayer)}createGraphics3DGraphic(e,i){const s=super.createGraphics3DGraphic(e,i);if(this._calloutSymbolLayer!=null&&s!=null){const r=this._createCalloutGraphic(e);r&&s.setCalloutGraphic(r)}return s}globalPropertyChanged(e,i){return!!super.globalPropertyChanged(e,i)&&(!this._calloutSymbolLayer||this._calloutSymbolLayer.globalPropertyChanged(e,i,s=>s.calloutLayer))}updateGeometry(e,i){const s=super.updateGeometry(e,i);if(s&&this._calloutSymbolLayer){const r=e.calloutLayer;if(r)return this._calloutSymbolLayer.updateGeometry(r,i)}return s}_createCalloutGraphic(e){const i=e.renderingInfo;return e.renderingInfo=new st(i.renderer,i.symbol),this._calloutSymbolLayer.createGraphics3DGraphic(e)}};function ci(t,e,i){return t.type==="point-3d"?new di(t,e,i):new Ue(t,e,i)}let pi=class{constructor(e){var s;this._graphicsCore=e,this._idToState=new Map,this._states=new Set;const i=(s=e.owner.layer)==null?void 0:s.objectIdField;i?(this._getGraphicId=r=>$(r,i),this._getGraphics3DGraphicById=r=>this._graphicsCore.getGraphics3DGraphicByObjectId(r)):(this._getGraphicId=r=>r.uid,this._getGraphics3DGraphicById=r=>this._graphicsCore.getGraphics3DGraphicById(r))}destroy(){this._idToState.clear(),this._states.forEach((e,i)=>this.remove(i))}add(e){const i=se(()=>this.remove(e));if(this._states.has(e))return i;const s=this._getGraphicId(e.graphic),r=this._getGraphics3DGraphicById(s);return this._states.has(e)||this._states.add(e),this._ensureStateList(s).push(e),e.displaying=r!=null&&r.isVisible(),e.isDraped=r!=null&&r.isDraped,e.tracking=!0,r!=null&&e.emit("changed"),i}remove(e){if(this._states.has(e)){if(this._idToState.size){const i=this._getGraphicId(e.graphic),s=this._idToState.get(i);s&&(rt(s,e),s.length===0&&this._idToState.delete(i))}this._states.delete(e),e.tracking=!1,e.displaying=!1}}addGraphic(e){this._forEachState(e,i=>{i.displaying=e.isVisible(),i.isDraped=e.isDraped,i.emit("changed")})}removeGraphic(e){this._forEachState(e,i=>{i.displaying=!1,i.isDraped=!1})}updateGraphicGeometry(e){this._forEachState(e,i=>i.emit("changed"))}updateGraphicVisibility(e){this._forEachState(e,i=>i.displaying=e.isVisible())}allGraphicsDeleted(){this._states.forEach(e=>{e.displaying=!1})}_ensureStateList(e){const i=this._idToState.get(e);if(i)return i;const s=new Array;return this._idToState.set(e,s),s}_forEachState(e,i){if(this._states.size===0||this._idToState.size===0)return;const s=this._getGraphicId(e.graphic),r=this._idToState.get(s);r!=null&&r.forEach(i)}},O=class extends V{constructor(t){super(t),this._index=new si(9,at("esri-csp-restrictions")?e=>({minX:e.extent[0],minY:e.extent[1],maxX:e.extent[2],maxY:e.extent[3]}):[".extent[0]",".extent[1]",".extent[2]",".extent[3]"]),this._missing=new Set,this._boundsByFeature=new Map,this.spatialReference=null,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.updating=!1}setup(t){this._addMany(t)}destroy(){this._missing.clear(),this._index=v(this._index),this._boundsByFeature.clear(),this._boundsByFeature=null}update(){this._missing.size>0&&(this._addMany(Array.from(this._missing.values())),this.updating=!1,this._missing.clear())}get updatingRemaining(){return this._missing.size}queryGraphicUIDsInExtent(t,e,i){e!=null&&e.equals(this.spatialReference)&&(w.minX=t[0],w.minY=t[1],w.maxX=t[2],w.maxY=t[3],this.update(),this._index.search(w,s=>i(s.graphic.uid)))}add(t){this._missing.add(t),this.updating=!0}remove(t){if(this._missing.delete(t))return void(this.updating=this._missing.size>0);this._index.remove(t);const e=$(t.graphic,this._get("objectIdField"));e!=null&&this._boundsByFeature.delete(e)}_addMany(t){if(t.length===0)return;const e=this._get("objectIdField");for(const i of t){i.computeExtent(this.spatialReference);const s=$(i.graphic,e);s!=null&&this._boundsByFeature.set(s,i.extent)}this._index.load(t)}clear(){this._index.clear(),this._missing.clear(),this._boundsByFeature.clear(),this.updating=!1}forEachInBounds(t,e){w.minX=t[0],w.minY=t[1],w.maxX=t[2],w.maxY=t[3],this.update(),this._index.search(w,i=>{e(i)})}getBounds(t,e){this.update();const i=this._boundsByFeature.get(t);return i?je(e,i):null}};o([h({constructOnly:!0})],O.prototype,"spatialReference",void 0),o([h({constructOnly:!0})],O.prototype,"hasZ",void 0),o([h({constructOnly:!0})],O.prototype,"hasM",void 0),o([h({constructOnly:!0})],O.prototype,"objectIdField",void 0),o([h()],O.prototype,"updating",void 0),o([h({readOnly:!0})],O.prototype,"updatingRemaining",null),O=o([L("esri.views.3d.layers.graphics.SpatialIndex2D")],O);const w={minX:0,minY:0,maxX:0,maxY:0},yi=1;let A=class extends ie.EventedMixin(V){get spatialReference(){var e;return(e=this.view)==null?void 0:e.spatialReference}constructor(e){super(e),this._elevationOffset=0,this._layerHandlesKey="layerHandles"}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersectLayers=[this.stageLayer],this._intersector=nt(this.view.state.viewingMode),this._intersector.options.store=ot.MIN;const e=this._computeLayerExtent(this.spatialReference,this.stageLayer);this._zmin=e[2],this._zmax=e[5];const i=this.stageLayer.events;this.addHandles([i.on("layerObjectAdded",({object:s})=>this._objectChanged(s)),i.on("layerObjectRemoved",({object:s})=>this._objectChanged(s)),i.on("geometryAdded",({object:s})=>this._objectChanged(s)),i.on("geometryRemoved",({object:s})=>this._objectChanged(s)),i.on("attributesChanged",({attribute:s,object:r})=>Fe(s)&&this._objectChanged(r)),i.on("transformationChanged",s=>this._objectChanged(s))],this._layerHandlesKey)}dispose(){this.removeHandles(this._layerHandlesKey)}elevationInfoChanged(){const e=this.layer!=null?this.layer.elevationInfo:null;if(e!=null&&e.mode!=="on-the-ground"){const i=lt(this.layer.spatialReference),s=ht(e.unit??"meters");this._elevationOffset=(e.offset??0)*s/i}else this._elevationOffset=0}getElevation(e,i,s,r){if(_[0]=e,_[1]=i,_[2]=s,!this._renderCoordsHelper.toRenderCoords(_,r,_))return re.getLogger(this).error("could not project point for elevation alignment"),null;const a=this._elevationOffset,n=this._zmin+a,d=this._zmax+a;this._renderCoordsHelper.setAltitude(Oe,d,_),this._renderCoordsHelper.setAltitude(Pe,n,_);const l=c=>!!c.lastValidElevationBB;return this._intersector.reset(Oe,Pe,null),this._intersector.intersect(this._intersectLayers,null,yi,null,l),this._intersector.results.min.getIntersectionPoint(_)?this._renderCoordsHelper.getAltitude(_):null}_objectChanged(e){const i=this.spatialReference;if(!e.lastValidElevationBB||!i)return;J(D);const s=e.lastValidElevationBB;s.isEmpty()||this._expandExtent(i,s.min,s.max,D);const{min:r,max:a}=e.boundingVolumeWorldSpace;this._expandExtent(i,r,a,D),dt(D,K),this._zmin=Math.min(this._zmin,D[2]),this._zmax=Math.max(this._zmax,D[5]),Z.extent=K,Z.spatialReference=i,this.emit("elevation-change",Z),ne(s.min,r),ne(s.max,a)}_computeLayerExtent(e,i){return J(D),e!=null&&i.objects.forAll(s=>this._expandExtent(e,s.boundingVolumeWorldSpace.min,s.boundingVolumeWorldSpace.max,D)),D}_expandExtent(e,i,s,r){for(let a=0;a<8;++a)_[0]=1&a?i[0]:s[0],_[1]=2&a?i[1]:s[1],_[2]=4&a?i[2]:s[2],this._renderCoordsHelper.fromRenderCoords(_,_,e),ct(r,_);return r}};o([h({constructOnly:!0})],A.prototype,"layer",void 0),o([h({constructOnly:!0})],A.prototype,"stageLayer",void 0),o([h({constructOnly:!0})],A.prototype,"view",void 0),o([h()],A.prototype,"spatialReference",null),A=o([L("esri.views.3d.layers.support.StageLayerElevationProvider")],A);const D=J(),K=pt(),Z={spatialReference:null,extent:K,context:"scene"},_=U(),Oe=U(),Pe=U();var ee;const X=U(),ui=te(),Te="esri.views.3d.layers.graphics.Graphics3DCore",b=re.getLogger(Te);let p=ee=class extends V{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){var t;return this._spatialIndex||(this._spatialIndex=new O({objectIdField:(t=this.owner.layer)==null?void 0:t.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return this.currentRenderer!=null&&this.currentRenderer.type==="dictionary"?f.ASYNC:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){var t,e,i;return!!(this._graphicsWaitingForSymbol.size>0||this.running||(t=this._elevationAlignment)!=null&&t.updating||(e=this._scaleVisibility)!=null&&e.updating||(i=this._filterVisibility)!=null&&i.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._updatingPendingLoadedGraphicsChange||this._frameTask.updating||this._loadingSymbols>0)}get running(){var t;return this._pendingUpdates.size>0||!!((t=this._spatialIndex)!=null&&t.updating)}get suspendedOrOutsideOfView(){var t;return this.owner.suspended||!!((t=this.owner.suspendInfo)!=null&&t.outsideOfView)}get updatingRemaining(){var t,e;return this.updating?this._pendingUpdates.size+.1*(((t=this._spatialIndex)==null?void 0:t.updatingRemaining)||0)+.1*(((e=this._elevationAlignment)==null?void 0:e.updatingRemaining)||0):0}get displayFeatureLimit(){const t=this.owner&&this.owner.view&&this.owner.view.qualitySettings,e=(t==null?void 0:t.graphics3D.minTotalNumberOfFeatures)??0,i=(t==null?void 0:t.graphics3D.maxTotalNumberOfFeatures)??0,s=(t==null?void 0:t.graphics3D.maxNumberOfDrawCalls)??0,r=(t==null?void 0:t.graphics3D.maxTotalNumberOfVertices)??0,a=this.averageSymbolComplexity,n=Math.max(1,(a==null?void 0:a.verticesPerFeature)??1),d=a&&a.drawCallsPerFeature>0&&s>0?s/a.drawCallsPerFeature:i,l=Math.ceil(r/n),c=Math.max(e,Math.min(i,l,d)),y=this._get("displayFeatureLimit");return y&&y.maximumTotalNumberOfVertices===r&&y.averageSymbolComplexity===a&&y.maximumNumberOfFeatures===c?y:new hi(r,c,a)}get averageSymbolComplexity(){const t=yt(this._symbolComplexities),e=this._get("averageSymbolComplexity");return t.numComplexities===0||e!=null&&(t.estimated&&(e.verticesPerFeature>=t.verticesPerFeature||e.verticesPerCoordinate>=t.verticesPerCoordinate||e.drawCallsPerFeature>=t.drawCallsPerFeature)||e.verticesPerFeature===t.verticesPerFeature&&e.verticesPerCoordinate===t.verticesPerCoordinate&&e.drawCallsPerFeature===t.drawCallsPerFeature)?e:t}get usedMemory(){const t=this.averageSymbolComplexity!=null&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,e=this._getSymbolComplexitiesUsed().reduce((a,n)=>a+n.memory.resourceBytes,0),i=this.owner.view._stage.renderer,s=this.owner.view.basemapTerrain.overlayManager.renderer,r=Array.from(this._symbols.values()).reduce((a,n)=>a+((n==null?void 0:n.symbolLayers.reduce((d,l)=>d+((l==null?void 0:l.materials.reduce((c,y)=>c+i.getMemoryForMaterial(y)+s.getMemoryForMaterial(y),0))??0),0))??0),0);return this._usedMemory+t+e+r}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const t=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*t}if(this.averageSymbolComplexity!=null){const t=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+t}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(t){var r;if(t.type==="web-style")return t.clone();const e=this._symbolConversionCache.get(t.id);if(e!=null)return e;const i=oe(t,{geometryType:((r=this.layer)==null?void 0:r.geometryType)??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(t)}),s=i.symbol||null;return s==null&&i.error&&b.error(i.error.message),this._symbolConversionCache.set(t.id,s),s}_getSymbolComplexitiesUsedOrRenderer(t){if(t==null)return[];const e=t.getSymbols(),i="backgroundFillSymbol"in t?t.backgroundFillSymbol:null;if(!i&&!(e!=null&&e.length))return[];const s=[],r=this._getSymbolComplexityUsedOrRenderer(i);r!=null&&s.push(r);for(const a of e){const n=this._getSymbolComplexityUsedOrRenderer(a);n!=null&&s.push(n)}return s}_getSymbolComplexityUsedOrRenderer(t){if(t==null)return null;const e=this._symbols.get(t.id);if(e!=null)return e.complexity;const i=this._getConvertedSymbol(t);return i!=null?ut(i):null}_getSymbolComplexitiesUsed(){const t=[];return this._symbols.forEach(e=>{e!=null&&t.push(e.complexity)}),t}get _objectIdField(){return this.layer.objectIdField}constructor(t){super(t),this._propertiesPool=new gt({computedExtent:mt},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._frameTask=le,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._sharedSymbolResourcesOwnerHandle=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this._pendingUpdatesPool=new Q({allocator:e=>e||new gi,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new Q,this.preferredUpdatePolicy=f.SYNC,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this.symbolCreationContext=new _t(t.owner.view.resourceController.scheduler,(e,i)=>this._frameTask.schedule(e,i))}initialize(){var i;this._featureStore=new x({objectIdField:(i=this.owner.layer)==null?void 0:i.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:s=>this.graphics3DGraphics.forEach(s)});const t=(s,r,a)=>this.spatialIndex.queryGraphicUIDsInExtent(s,r,a),{componentFactories:e}=this;if(e.elevationAlignment!=null){const s=e.elevationAlignment(this,t);this._elevationAlignment=s}if(e.scaleVisibility!=null){const s=e.scaleVisibility(this,t);this._scaleVisibility=s}if(e.filterVisibility!=null){const s=e.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:r=>this.modifyGraphics3DGraphicVisibilities(a=>a.setVisibilityFlag(E.GRAPHIC,R.FILTER,r($(a.graphic,this._objectIdField)))),setAllFeaturesVisibility:r=>this.modifyGraphics3DGraphicVisibilities(a=>a.setVisibilityFlag(E.GRAPHIC,R.FILTER,r)),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities(r=>r.setVisibilityFlag(E.GRAPHIC,R.FILTER,!0))});this._filterVisibility=s}if(e.deconflictor!=null){const s=e.deconflictor(this);this._deconflictor=s}if(e.labeler!=null&&this._scaleVisibility!=null){const s=e.labeler(this,this._scaleVisibility);this._labeler=s}if(e.objectStates!=null){const s=e.objectStates(this);this._objectStates=s}this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){var r,a,n,d;const t=(r=this._initializeAbortController)==null?void 0:r.signal,e=this.owner.view;this._viewElevationProvider=new bt(this._viewSpatialReference,e),this._initializeStage(e,this.layer.uid);const i=e.sharedSymbolResources;this.symbolCreationContext.sharedResources=i,this._sharedSymbolResourcesOwnerHandle=i.addGraphicsOwner(this.owner),this.currentRenderer!=null&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=i.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=e.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new ft(e.renderSpatialReference),this.symbolCreationContext.elevationProvider=e.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=l=>this.notifyGraphicGeometryChanged(l),this.symbolCreationContext.notifyGraphicVisibilityChanged=l=>this.notifyGraphicVisibilityChanged(l);const s=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await de(s,this._viewSpatialReference,t,b),k(t),this.symbolCreationContext.screenSizePerspectiveEnabled=e.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!((a=this.owner.view.qualitySettings)!=null&&a.physicallyBasedRenderingEnabled),this.symbolCreationContext.skipHighSymbolLods=!!((d=(n=this.owner.view.qualitySettings)==null?void 0:n.graphics3D)!=null&&d.skipHighSymbolLods),"drapeSourceType"in this.owner){const{owner:l}=this;this.symbolCreationContext.drapeSourceRenderer=e.basemapTerrain.overlayManager.registerGeometryDrapeSource(l),this.addHandles(se(()=>e.basemapTerrain.overlayManager.unregisterDrapeSource(l)))}this.addHandles([S(()=>this.suspendedOrOutsideOfView,()=>this._frameTask.reschedule(()=>this._updateLayerVisibility())),S(()=>{var l,c;return[(l=this.layer)==null?void 0:l.screenSizePerspectiveEnabled,(c=this.owner.view)==null?void 0:c.screenSizePerspectiveEnabled]},()=>{var c;const l=e.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;l!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=l,(c=this._labeler)==null||c.reset(),this.recreateAllGraphicsAndSymbols())}),S(()=>this.owner.slicePlaneEnabled,l=>this._slicePlaneEnabledChange(!!l)),S(()=>{var l;return(l=this.owner.view.state)==null?void 0:l.rasterPixelRatio},()=>this._pixelRatioChange()),S(()=>{var l;return!!((l=this.owner.view.qualitySettings)!=null&&l.physicallyBasedRenderingEnabled)},l=>this._physicalBasedRenderingChange(l)),S(()=>{var l,c;return!!((c=(l=this.owner.view.qualitySettings)==null?void 0:l.graphics3D)!=null&&c.skipHighSymbolLods)},l=>this._skipHighSymbolLoDsChange(l)),vt(()=>{var l;return(l=e.basemapTerrain)==null?void 0:l.tilingScheme},l=>{if(l.spatialReference.equals(this.symbolCreationContext.overlaySR)||e.basemapTerrain.spatialReference==null||(this.symbolCreationContext.overlaySR=e.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const c=()=>{var y;return(y=this.owner)==null?void 0:y.loadedGraphics};this.addHandles([St(c,"change",y=>{this._graphicsCollectionChanged(y),this._signalUpdatingDuringAsyncLoadedGraphicsChange()},{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}},{initial:!0}),S(()=>this.effectiveUpdatePolicy,l=>{this.stageLayer!=null&&(this.stageLayer.updatePolicy=l),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===f.ASYNC,l===f.SYNC&&this.runTask($e)},Ct)]),this._frameTask=e.resourceController.scheduler.registerTask(B.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(S(()=>this.layer.featureReduction,()=>this._deconflictor.featureReductionChange())),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch(()=>{}),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController&&(this._initializeAbortController.abort(),this._initializeAbortController=null)}destroy(){var t,e,i,s;this._abortInitialize(),this._abortRendererChange(),this._abortElevationInfoChange(),this._frameTask.remove(),this._frameTask=le,(e=(t=this.owner.view)==null?void 0:t.deconflictor)==null||e.removeGraphicsOwner(this),(s=(i=this.owner.view)==null?void 0:i.labeler)==null||s.removeGraphicsOwner(this),this._elevationAlignment=v(this._elevationAlignment),this._scaleVisibility=v(this._scaleVisibility),this._filterVisibility=v(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=v(this._objectStates),this.clear(),this._featureStore=v(this._featureStore),this._updatingPendingLoadedGraphicsChange=ce(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=v(this._graphicStateTracking),this.stage&&(this.stageLayer=v(this.stageLayer),this.stage=null),this._set("owner",null);for(const r in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[r].reject(new T("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._sharedSymbolResourcesOwnerHandle=ce(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=v(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=v(this._spatialIndex)}clear(){var t,e;(t=this._objectStates)==null||t.allGraphicsDeleted(),this._graphicStateTracking!=null&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach(i=>i.destroy()),(e=this._spatialIndex)==null||e.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(v),this._symbols.clear(),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingUpdatesPool.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("updating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed")}_initializeStage(t,e){this.stage=t._stage,this.stageLayer=new wt(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},e);const i=this.stageLayer.events;i.on("transformationChanged",s=>this.notifyGraphicGeometryChanged(s.graphicUid)),i.on("shaderTransformationChanged",s=>this.notifyGraphicGeometryChanged(s.graphicUid)),i.on("visibilityChanged",s=>this.notifyGraphicVisibilityChanged(s.graphicUid)),i.on("geometryAdded",s=>this.notifyGraphicGeometryChanged(s.object.graphicUid)),i.on("geometryRemoved",s=>this.notifyGraphicGeometryChanged(s.object.graphicUid)),i.on("attributesChanged",s=>Fe(s.attribute)&&this.notifyGraphicGeometryChanged(s.object.graphicUid))}notifyGraphicGeometryChanged(t){if(this._graphicStateTracking==null||t==null)return;const e=this.graphics3DGraphics.get(t);e&&this._graphicStateTracking.updateGraphicGeometry(e)}notifyGraphicVisibilityChanged(t){if(this._graphicStateTracking==null||t==null)return;const e=this.graphics3DGraphics.get(t);e&&this._graphicStateTracking.updateGraphicVisibility(e)}_updateLayerVisibility(){const t=this.displayFeatureLimit.maximumNumberOfFeatures,e=this._numberOfGraphics>t*mi,i=!this.suspendedOrOutsideOfView&&!e;i!==this._visible&&(this._visible=i,i?(this.stageLayer.pickable=!0,this.updateAllGraphicsVisibility()):(this.stageLayer.pickable=!1,this._hideAllGraphics()),this._updateStageLayerVisibility())}_updateStageLayerVisibility(){this.stageLayer.visible=this._visible&&(this.layer.opacity==null||this.layer.opacity>0)}getGraphics3DGraphicById(t){return t!=null?this.graphics3DGraphics.get(t):void 0}getGraphics3DGraphicByObjectId(t){var e;return(e=this.owner.layer)!=null&&e.objectIdField?this._findGraphics3DGraphicByObjectId(t):null}_getGraphicObjectID(t,e=(i=>(i=this.owner.layer)==null?void 0:i.objectIdField)()){return $(t,e)}get graphics3DGraphicsByObjectID(){var i;const t=(i=this.owner.layer)==null?void 0:i.objectIdField;if(!t)return;const e=new Map;return this.graphics3DGraphics.forEach(s=>{if(!s)return;const r=s.graphic,a=this._getGraphicObjectID(r,t);a!=null&&e.set(a,s)}),e}get labelsEnabled(){return!(!this._labeler||!this._labeler.layerLabelsEnabled())}async updateLabelingInfo(t){const e=this._deconflictor&&this._deconflictor.labelingInfoChange(t),i=this._labeler&&this._labeler.labelingInfoChange(t);await Promise.allSettled([e,i])}updateVisibilityInfo(){this._deconflictor&&this._deconflictor.labelingInfoChange(),this._labeler&&this._labeler.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let t=0,e=0;return Gt(this._symbols,(i,s)=>{if(i!=null){const r=i.getFastUpdateStatus();if(r.loading>0)return!0;this._graphicsBySymbol.has(s)&&(e+=r.fast,t+=r.slow)}return!1})?"unknown":e>=0&&t===0?"fast":t>=0&&e===0?"slow":"mixed"}runTask(t){if(this._frameTask.processQueue(t),this._applyPendingUpdates(t),this.notifyChange("running"),this.running||this.notifyChange("updating"),this.notifyChange("updatingRemaining"),!t.hasProgressed)return ae.YIELD}setObjectIdVisibility(t,e){e?this._objectIdInvisibleSet.delete(t):this._objectIdInvisibleSet.add(t);const i=this._findGraphics3DGraphicByObjectId(t);i!=null&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(t){return xt(this.graphics3DGraphics,e=>this._getGraphicObjectID(e.graphic)===t)}_updateUserVisibility(t){if(t==null)return!1;const e=t.graphic,i=this._getGraphicObjectID(e),s=e.visible&&!this.owner.suspended&&(i==null||!this._objectIdInvisibleSet.has(i));return t.setVisibilityFlag(E.GRAPHIC,R.USER,s)}_whenGraphics3DGraphic(t){const e=this.graphics3DGraphics.get(t.uid);if(e)return Promise.resolve(e);const i=this._whenGraphics3DGraphicRequests[t.uid];if(i)return i.promise;const s=It();return this._whenGraphics3DGraphicRequests[t.uid]=s,s.promise}async _boundsForGraphics3DGraphic(t,e){const i=this._viewSpatialReference,s=this.owner.view.renderSpatialReference,r=this.owner.view.basemapTerrain.spatialReference,a=(y,u,m)=>Se(y,s,u,y,i,u,m),n=(y,u,m)=>Se(y,r,u,y,i,u,m),d=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:e!=null&&!!e.useViewElevation,minDemResolution:e!=null?e.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await t.getProjectedBoundingBox(a,n,d,e==null?void 0:e.signal);if(!l)return null;const c=l.boundingBox;if(l.requiresDrapedElevation){const y=this.symbolCreationContext.elevationProvider;if(y){Et(c,X);const u=y.getElevation(X[0],X[1],0,i,"ground")??0;c[2]=Math.min(c[2],u),c[5]=Math.max(c[5],u)}}return{boundingBox:c,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(t,e){var a;await Rt(()=>{var n;return(n=this.owner)==null?void 0:n.loadedGraphics});const i=(a=this.owner.layer)==null?void 0:a.objectIdField,s=this.owner.loadedGraphics.find(n=>n===t||i!=null&&n.attributes!=null&&t.attributes&&n.attributes[i]===t.attributes[i]);if(!s)throw new T("internal:graphic-not-part-of-view","Graphic is not part of this view");const r=await this._whenGraphics3DGraphic(s);return this._boundsForGraphics3DGraphic(r,e)}computeAttachmentOrigin(t,e){const i=this.graphics3DGraphics.get(t.uid);if(!i)return null;const s=i.computeAttachmentOrigin();if(s.render.num===0&&s.draped.num===0)return null;pe(G,0,0,0);let r=0;if(s.render.num>0){if(!ye(s.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,F,e))return null;ue(G,G,F),r++}if(s.draped.num>0){const[a,n]=s.draped.origin,d=this._viewElevationProvider.getElevation(a,n,"ground")??0;if(pe(F,a,n,d),!ye(F,this._viewElevationProvider.spatialReference,F,e))return null;ue(G,G,F),r++}return r>1&&Dt(G,G,1/r),new Ot({x:G[0],y:G[1],z:G[2],spatialReference:e})}getSymbolLayerSize(t,e){const i=this._symbols.get(t.id);if(i==null)throw new T("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=t.symbolLayers.indexOf(e);if(s===-1)throw new T("internal:missing-symbol-layer","Symbol layer is not in symbol");const r=i.getSymbolLayerSize(s);if(r==null)throw new T("internal:missing-size","Symbol layer has no valid size");return r}_graphicsCollectionChanged(t){this._startCreateGraphics&&(this.add(t.added),this.remove(t.removed))}graphicUpdateHandler(t){const e=t.graphic.uid,i=this.graphics3DGraphics.get(e);if(i!=null||this._graphicsWithoutSymbol.get(e)!=null)switch(t.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,t);break;case"symbol":this._graphicUpdateSymbolHandler(i,t);break;case"attributes":break;case"origin-transform":this._graphicUpdateTransformHandler(i,t)}}_graphicUpdateGeometryHandler(t,e){this._graphicUpdateGeometryOrTransformHandler(t,e,()=>e.newValue!=null&&t!=null&&t.graphics3DSymbol.updateGeometry(t,e.newValue));const i=e.graphic.geometry;i!=null&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(t,e){const i=e.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(t,e,()=>e.newValue!=null&&t!=null&&i!=null&&t.graphics3DSymbol.updateTransform(t,i.spatialReference,e.newValue,e.action))}_graphicUpdateGeometryOrTransformHandler(t,e,i){var s;if(e.graphic.geometry!=null)if(t!=null)i()||this._recreateGraphic(t.graphic);else{const r=(s=e.graphic.symbol)==null?void 0:s.id;if(r){const a=this._symbols.get(r);if(a!=null&&a.loadStatus===Pt.LOADING)return}this._recreateGraphic(e.graphic)}else this._recreateGraphic(e.graphic)}_graphicUpdateSymbolHandler(t,e){const i=e.graphic,s=t!=null?t.graphics3DSymbol:e.oldValue!=null?this._symbols.get(e.oldValue.id):null;if(s==null||e.newValue==null)return void this._recreateGraphic(i);const r=s.symbol,a=this._getConvertedSymbol(e.newValue);if(a!=null&&(a.type!==r.type||a.type==="web-style")||r.type==="web-style")return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(r.id);if(n&&n.size!==1)return void this._recreateGraphic(i);const d=ge(r,a);if(d==null)return void this._updateSymbolMapping(r.id,a);const l={diff:d,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(s.prepareSymbolPatch(l),!At(l.diff))return void this._recreateGraphic(i);const c=this._getRenderingInfo(i);if(c==null)return void this._recreateGraphic(i);const y=s.extentPadding;for(const u of l.symbolStatePatches)u();if(y!==s.extentPadding&&this._recomputeExtentPadding(),t!=null)for(const u of l.graphics3DGraphicPatches)u(t,c);this._updateSymbolMapping(r.id,a)}_graphicUpdateVisibleHandler(t){this._updateUserVisibility(t)&&(this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty())}recreateGraphics(t){this._suspendSymbolCleanup=!0,this.remove(t),this.add(t),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===f.SYNC&&this._cleanupSymbols()}_recreateGraphic(t){this.recreateGraphics([t])}_beginGraphicUpdate(t){const e=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(t.uid,e),this._graphicsWaitingForSymbol.size===1&&this.notifyChange("updating"),e}_endGraphicUpdate(t){t&&(this._graphicsWaitingForSymbol.delete(t.uid),this._graphicsWaitingForSymbol.size===0&&(this._cleanupSymbols(),this.notifyChange("updating")))}_recomputeExtentPadding(){let t=0;this._symbols.forEach(e=>{e!=null&&(t=Math.max(t,e.extentPadding))}),this._set("extentPadding",t)}_expandComputedExtent(t){const e=ui,i=t.spatialReference;Lt(t,e);const s=this._viewSpatialReference,r=ee.tmpVec;if(Vt(i,s)||me(e[0],e[1],0,i,r,s)&&(e[0]=r[0],e[1]=r[1],me(e[3],e[4],0,i,r,s),e[3]=r[0],e[4]=r[1]),!(isFinite(e[0])&&isFinite(e[3])&&isFinite(e[1])&&isFinite(e[4])))return;const a=this.computedExtent;let n=null;const d=isFinite(e[2])&&isFinite(e[5]),l=d&&((a==null?void 0:a.zmin)==null||e[2]a.zmax);a?(e[0]a.xmax||e[4]>a.ymax||l||c)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(e[0],a.xmin),n.ymin=Math.min(e[1],a.ymin),n.xmax=Math.max(e[3],a.xmax),n.ymax=Math.max(e[4],a.ymax),n.spatialReference=s):(n=this._propertiesPool.get("computedExtent"),n.xmin=e[0],n.ymin=e[1],n.xmax=e[3],n.ymax=e[4],n.spatialReference=s),n&&(l&&(n.zmin=e[2]),c&&(n.zmax=e[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){var i,s;this._abortElevationInfoChange();const t=new AbortController;this._elevationInfoChangeAbortController=t;const e=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await de(e,this._viewSpatialReference,t.signal,b),k(t.signal),this._elevationInfoChangeAbortController=null,(i=this._labeler)==null||i.elevationInfoChange(),this.forEachGraphics3DSymbol((r,a,n)=>{r.globalPropertyChanged("elevationInfo",a)?a.forEach(d=>{const l=d.graphic,c=d.labelLayers;for(const y of c)y.graphics3DSymbolLayer.updateGraphicElevationContext(l,y)}):this._recreateSymbol(n)}),this.updateStageLayerElevationProvider(),(s=this._elevationAlignment)==null||s.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo&&this.layer.elevationInfo.mode==="relative-to-scene"||this._numberOfGraphicsProvidingElevation===0)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=_e(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&this.layer.elevationInfo.mode!=="relative-to-scene")&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new A({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){var t,e,i,s;this.clear(),this._filterVisibility!=null&&this._filterVisibility.clear(),(t=this._labeler)==null||t.reset(),(e=this._deconflictor)==null||e.clear(),(i=this._elevationAlignment)==null||i.clear(),(s=this.stageLayer)==null||s.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=_e(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(t=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:e,view:i}=this.owner,s=i.basemapTerrain.tilingScheme&&(e!=null&&e.length)?e.toArray():null;!t&&s||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=this.owner.view.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),s&&(t?this.add(s):this.recreateGraphics(s))}_recreateSymbol(t){const e=this._graphicsBySymbol.get(t),i=[];e&&(e.forEach((r,a)=>{var d;const n=r.usedMemory;this._conditionalRemove(r,a),(d=this._spatialIndex)==null||d.remove(r),i.push(r.graphic),r.destroy(),this._removeGraphics3DGraphic(a,n),this._updateLayerVisibility(),this._featureStore.events.emit("changed")}),this._graphicsBySymbol.set(t,new Map));const s=this._symbols.get(t);v(s),this._symbols.delete(t),this.add(i)}_recreateGraphicsForSymbol(t){const e=this._graphicsBySymbol.get(t);if(e){const i=[];e.forEach(s=>i.push(s.graphic)),this.recreateGraphics(i)}}_conditionalRemove(t,e){var i,s,r;this._graphicsDrapedUids.delete(e),(i=this._objectStates)==null||i.removeGraphic(t),(s=this._labeler)==null||s.removeGraphic(t),(r=this._deconflictor)==null||r.removeGraphic(t),this._graphicStateTracking!=null&&this._graphicStateTracking.removeGraphic(t)}add(t){var e;t&&t.length!==0&&((e=this.owner.view.basemapTerrain)!=null&&e.tilingScheme?(this._updatePolicyForGraphics(t)===f.ASYNC?this._addDelayed(t):this._addImmediate(t),this.notifyChange("updating")):b.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(t){if(this.effectiveUpdatePolicy===f.SYNC&&(this.layer.geometryType==="mesh"||this.layer.geometryType==null)){for(const e of t)if(e.geometry!=null&&e.geometry.type==="mesh"&&!e.geometry.loaded)return f.ASYNC}return this.effectiveUpdatePolicy}_addImmediate(t){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const e of t)this._addGraphic(e,this._getRenderingInfo(e,b),f.SYNC);this._cleanupSymbols(),this._labeler&&(this.owner.view.labeler.setDirty(),this._cleanupSymbols()),this.owner.view.deconflictor.setDirty()}_addDelayed(t){var e;for(const i of t){const s=i.uid;let r=this._pendingUpdates.get(s);r?r.add?r.state!==g.NEW&&((e=r.abortController)==null||e.abort()):this._pendingAdds++:(r=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(s,r)),r.add=i}this.notifyChange("running"),this.notifyChange("updatingRemaining")}remove(t){this.effectiveUpdatePolicy===f.ASYNC?this._removeDelayed(t):this._removeImmediate(t),this.notifyChange("updating")}_removeImmediate(t){for(const e of t)this._removeGraphic(e);this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_removeDelayed(t){var e;for(const i of t){const s=i.uid,r=this._pendingUpdates.get(s);if(r)r.add&&(r.remove?r.add=null:this._pendingUpdates.delete(s),r.state===g.LOADING&&((e=r.abortController)==null||e.abort()),this._pendingAdds--);else{const a=this._pendingUpdatesPool.pushNew();a.remove=i,this._pendingUpdates.set(s,a),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}this._pendingUpdates.size===0&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&b.warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyPendingUpdates(t){var e;if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,this._pendingUpdates.size===0&&((e=this._spatialIndex)==null?void 0:e.updating))return this._spatialIndex.update(),void t.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[i,s]of this._pendingUpdates){if(t.done){this._applyPendingRemovesFirst=!0;break}if(s.remove&&!s.add&&(this._pendingRemoves--,t.madeProgress(),this._removeGraphic(s.remove),s.remove=null,this._pendingUpdates.delete(i),this._pendingRemoves===0))break}}for(const[i,s]of this._pendingUpdates){if(t.done)break;s.add&&s.state===g.NEW&&this._processPendingUpdateNew(s);let r=this.effectiveUpdatePolicy;if(!s.remove||s.add&&s.state!==g.READY||(this._pendingRemoves--,t.madeProgress(),this._removeGraphic(s.remove),s.remove=null,r=f.SYNC),s.add)switch(s.state){case g.READY:this._addGraphic(s.add,s.renderingInfo,r),s.add=null,this._pendingAdds--,t.madeProgress();break;case g.REJECTED:s.add=null,this._pendingAdds--;case g.LOADING:}s.remove==null&&s.add==null&&this._pendingUpdates.delete(i)}this._pendingUpdates.size===0&&(this._finishPendingUpdates(),this.notifyChange("running"))}_processPendingUpdateNew(t){if(!t.add)return void(t.state=g.READY);const e=t.add.geometry;e==null||e.type!=="mesh"||e.loaded?this._processPendingUpdateNewRenderingInfo(t):this._processPendingUpdateNewMesh(t,e)}async _processPendingUpdateNewMesh(t,e){t.state=g.LOADING,t.abortController=new AbortController;const i=t.abortController.signal;try{await e.load({signal:i})}catch(s){return this._processPendingUpdateNewError(t,s)}t.abortController=null,this._processPendingUpdateNewRenderingInfo(t)}_processPendingUpdateNewError(t,e){t.abortController=null,W(e)?t.state=g.NEW:t.state=g.REJECTED}async _processPendingUpdateNewRenderingInfo(t){if(this.layer.renderer==null||this.layer.renderer.type!=="dictionary")return t.renderingInfo=this._getRenderingInfo(t.add,b),void(t.state=g.READY);t.state=g.LOADING,t.abortController=new AbortController;let e=null;try{e=await this._getRenderingInfoAsync(t.add,{signal:t.abortController.signal})}catch(i){return t.abortController=null,void(W(i)?t.state=g.NEW:t.state=g.REJECTED)}(e==null?void 0:e.symbol)==null?(b&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,b.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),t.renderingInfo=null):t.renderingInfo=e,t.state=g.READY}_addGraphic(t,e,i){var u;if(this._graphicsWithoutSymbol.set(t.uid,t),(e==null?void 0:e.symbol)==null||!Ut(t))return;if(this.stage.renderView.objectAndLayerIdRenderHelper!=null&&this.setUidToIdOnAdd){const m=jt(this.owner.view.map,this.layer.uid);this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(t.objectId,t.uid,this.layer.id,this.layer.uid,!!this.layer.popupEnabled&&!m&&Ft(this.layer,(u=this.owner.view.popup)==null?void 0:u.defaultPopupTemplateEnabled))}const s=e.symbol,r=this.getOrCreateGraphics3DSymbol(s,e.renderer);if(r==null)return;this._expandComputedExtent(t.geometry);const a=this._beginGraphicUpdate(t),n=new $t(t,e,this.layer);let d=!1;const l=m=>{m===r.symbol.id&&(d=!0)};this._whenSymbolRemoved.push(l);const c=()=>{if(--this._loadingSymbols,!this.destroyed){if(this._whenSymbolRemoved.removeUnordered(l),this._graphicsWaitingForSymbol.get(t.uid)!==a||d||r.destroyed||this.graphicSymbolSupported&&t.symbol&&t.symbol.id!==r.symbol.id)--r.referenced,this._cleanupSymbols();else{const m=this._createGraphics3DGraphic(r,n);this._spatialIndex&&m!=null&&this._spatialIndex.add(m),--r.referenced,this._endGraphicUpdate(t)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()}},y=m=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),d||(W(m)?this.add([t]):r.destroyed||this._endGraphicUpdate(t)))};++this._loadingSymbols,i===f.ASYNC?r.load(()=>this._frameTask.schedule(c),m=>this._frameTask.schedule(()=>y(m))):r.load(c,y)}_removeGraphic(t){var s,r;const e=t.uid,i=this.graphics3DGraphics.get(e);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const a=i.usedMemory,n=i.isElevationSource;this._conditionalRemove(i,e),(s=this._spatialIndex)==null||s.remove(i);const d=i.graphics3DSymbol.symbol.id;(r=this._graphicsBySymbol.get(d))==null||r.delete(e),this._graphicsWithoutSymbol.delete(e),this._removeGraphics3DGraphic(e,a,n),i.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(e),this._graphicsWaitingForSymbol.delete(e),this._graphicsWaitingForSymbol.size===0&&(this._cleanupSymbols(),this.notifyChange("updating"))}_hasLabelingContext(t){if(t instanceof be||t instanceof Tt){const e=this.symbolCreationContext.layer;return!!e.labelingInfo&&e.labelingInfo.some(i=>i.symbol===t)}return!1}_hasValidSymbolCreationContext(t){return!(t instanceof be&&!this._hasLabelingContext(t))||(b.error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(t,e){const i=t.geometry;if(i==null)return e&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,e.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!zt(i.spatialReference,this._viewSpatialReference))return e&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,e.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&t.symbol!=null)return e&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,e.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const s=this.rendererHasGeometryOperations?N(t,this.layer):t;let r;return this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||this.currentRenderer!=null)?r=this.owner.getRenderingInfo(s,this.currentRenderer,this._arcadeOnDemand):r={symbol:s.symbol||li(s.geometry)},(r==null?void 0:r.symbol)==null?(e&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,e.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):r}_getRenderingInfoAsync(t,e){if(t.geometry==null)return b&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,b.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&t.symbol!=null)return b&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,b.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const i=this.rendererHasGeometryOperations?N(t,this.layer):t;return this.owner.getRenderingInfoAsync(i,this.currentRenderer,this._arcadeOnDemand,e)}_createGraphics3DSymbol(t,e){if(!this._hasValidSymbolCreationContext(t))return null;const i=this._getConvertedSymbol(t);if(!i)return null;let s;if(e!=null&&"backgroundFillSymbol"in e&&e.backgroundFillSymbol){const a=oe(e.backgroundFillSymbol,{ignoreDrivers:!0});a.symbol!=null&&a.symbol.type!=="web-style"&&a.symbol.type!=="cim"&&(s=a.symbol.symbolLayers)}const r=ci(i,this.symbolCreationContext,s);return r.load(()=>{const a=r.extentPadding;a>this.extentPadding&&this._set("extentPadding",a),this.notifyChange("averageSymbolComplexity")},()=>{}),r}getOrCreateGraphics3DSymbol(t,e){let i=this._symbols.get(t.id);return i===void 0&&(i=t instanceof Mt?new kt(t,s=>this._frameTask.schedule(s),s=>this._createGraphics3DSymbol(s,e)):this._createGraphics3DSymbol(t,e),this._symbols.set(t.id,i)),i!=null&&++i.referenced,i}trackGraphicState(t){return this._graphicStateTracking==null&&(this._graphicStateTracking=new pi(this)),this._graphicStateTracking.add(t)}_addGraphics3DGraphic(t){this._usedMemory+=t.usedMemory,this.graphics3DGraphics.set(t.graphic.uid,t),this._numberOfGraphics++,t.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(t,e,i=!1){this._usedMemory-=e,this.graphics3DGraphics.delete(t),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(t,e){var n,d,l;const i=e.graphic;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(t.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const s=t.createGraphics3DGraphic(e);if(s==null)return null;this._addGraphics3DGraphic(s);const r=t.symbol.id;if(this._graphicsBySymbol.has(r)||this._graphicsBySymbol.set(r,new Map),this._graphicsBySymbol.get(r).set(i.uid,s),s.isDraped&&this._graphicsDrapedUids.add(i.uid),s.centroid=null,i.geometry!=null&&i.geometry.type!=="point"&&(s.centroid=Ht(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(s),this._scaleVisibility!=null&&this._scaleVisibility.updateVisibility(s),this._filterVisibility!=null){const{defaultVisibility:c}=this._filterVisibility;s.setVisibilityFlag(E.GRAPHIC,R.FILTER,c),c||this._filterVisibility.reapply()}(n=this._deconflictor)==null||n.addGraphic(s),(d=this._labeler)==null||d.addGraphic(s),(l=this._objectStates)==null||l.addGraphic(s),this._deconflictor&&this.owner.view.deconflictor.setInitialIconVisibilityFlag(this,s),s.initialize(this.stageLayer,this.owner),this._graphicStateTracking!=null&&this._graphicStateTracking.addGraphic(s);const a=this._whenGraphics3DGraphicRequests[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.uid],a.resolve(s)),s}_abortRendererChange(){this._rendererChangeAbortController&&(this._rendererChangeAbortController.abort(),this._rendererChangeAbortController=null)}async rendererChange(t){if(this._abortRendererChange(),t!==this.currentRenderer)if(this._validateRenderer(t),t==null&&this._currentRendererChange(null,!1),Bt(t))if(t!=null&&t.arcadeRequired){const e=new AbortController;this._rendererChangeAbortController=e;const{arcadeUtils:i}=await this._ensureArcade();k(e);const s=i.hasGeometryOperations(t);s&&(await i.enableGeometryOperations(),k(e)),this.effectiveUpdatePolicy===f.ASYNC?await this._frameTask.schedule(()=>this._currentRendererChange(t,s),e.signal):this._currentRendererChange(t,s),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===f.ASYNC){const e=new AbortController;this._rendererChangeAbortController=e,await this._frameTask.schedule(()=>this._currentRendererChange(t,!1),e.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(t,!1);else this._currentRendererChange(t,!1)}async _ensureArcade(){return this._arcadeOnDemand==null?(this._arcadeOnDemand=await Wt(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(t,e){var r;this.currentRenderer=t,this.rendererHasGeometryOperations=e,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(t===i)return;if(this._symbolConversionCache.clear(),t==null)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const s=ge(i,t);this._updateUnchangedSymbolMappings(s,t,i),this.symbolCreationContext.renderer=t,s!=null&&(s.type==="complete"?this.recreateAllGraphicsAndSymbols():s.type==="partial"&&(this._applyRendererDiff(s,t,i)?(r=this._labeler)==null||r.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(t){for(const e in t.diff)switch(e){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete t.diff[e];break;default:return!0}return!1}_applySymbolSetDiff(t,e,i){t=t||[],e=e||[];const s=[];for(const r of e){const a=this._graphicsBySymbol.get(r.id);a&&a.forEach((n,d)=>{const l=n.graphic,c=this.layer instanceof Nt?this.layer:null,y=this._arcadeOnDemand;if(r===i.defaultSymbol&&i.getSymbol(N(l,c),{arcade:y})===i.defaultSymbol)return;const u=n.usedMemory;t.length||i.defaultSymbol?s.push(l):this._graphicsWithoutSymbol.set(d,l);const m=this.graphics3DGraphics.get(d);this._conditionalRemove(m,d),n.destroy(),a.delete(d),this._removeGraphics3DGraphic(d,u),this._updateLayerVisibility()}),this._whenSymbolRemoved.forAll(n=>n(r.id))}(t.length||s.length)&&(this._graphicsWithoutSymbol.forEach(r=>s.push(r)),this._graphicsWithoutSymbol.clear(),this.add(s)),this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_applyUniqueValueRendererDiff(t,e,i){const s=t.diff.defaultSymbol,r=t.diff.uniqueValueInfos;if(s||r){const a=r?r.added.map(d=>d.symbol).filter(fe):[],n=r?r.removed.map(d=>d.symbol).filter(fe):[];if(r)for(let d=0;dc!=null?c.id:null,r=t&&t.diff,a=r==null?void 0:r.defaultSymbol,n=r&&r.uniqueValueInfos;let d;if(n)d=n.unchanged.map(c=>({oldId:s(c.oldValue.symbol),newId:s(c.newValue.symbol)}));else{d=[];for(const c of i.uniqueValueInfos??[]){const y=s(c.symbol),u=(l=e.uniqueValueInfos)==null?void 0:l.find(m=>m.value===c.value);u&&y!==s(u.symbol)&&d.push({oldId:y,newId:s(u.symbol)})}}return!a&&i.defaultSymbol&&d.push({oldId:s(i.defaultSymbol),newId:s(e.defaultSymbol)}),d}_updateSymbolMapping(t,e){const i=e!=null&&e?typeof e=="string"?e:e.id:null;if(t==null||t===i)return;const s=this._graphicsBySymbol.get(t);this._graphicsBySymbol.delete(t),s!==void 0&&this._graphicsBySymbol.set(i,s);const r=this._symbols.get(t);if(r!==void 0&&(this._symbols.delete(t),this._symbols.set(i,r),r!=null)){const a=typeof e=="string"?null:e;a!=null?r.symbol=a:r.symbol.id=i}}_updateUnchangedSymbolMappings(t,e,i){const s=this._calculateUnchangedSymbolMapping(t,e,i);for(const{oldId:r,newId:a}of s)this._updateSymbolMapping(r,a)}_applyRendererDiff(t,e,i){if(this._diffHasSymbolChange(t))return!1;if(e instanceof ve&&i instanceof ve&&this._applyUniqueValueRendererDiff(t,e,i)&&Object.keys(t.diff).length===0)return!0;for(const[s]of this._graphicsBySymbol){const r=this._symbols.get(s);if(r!=null)switch(r.applyRendererDiff(t,e)){case q.RecreateSymbol:this._recreateSymbol(s);break;case q.RecreateGraphics:this._recreateGraphicsForSymbol(s);case q.FastUpdate:}}return!0}opacityChange(){this.forEachGraphics3DSymbol((t,e)=>t.globalPropertyChanged("opacity",e)),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(t){t!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=t,this.stageLayer.sliceable=t,this.forEachGraphics3DSymbol((e,i)=>e.globalPropertyChanged("slicePlaneEnabled",i)),this._deconflictor&&this._deconflictor.slicePlaneEnabledChange(),this._labeler&&this._labeler.slicePlaneEnabledChange())}_physicalBasedRenderingChange(t){this.symbolCreationContext.physicalBasedRenderingEnabled=t,this.forEachGraphics3DSymbol((e,i,s)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",i)||this._recreateSymbol(s)})}_skipHighSymbolLoDsChange(t){this.symbolCreationContext.skipHighSymbolLods=t,this.forEachGraphics3DSymbol((e,i,s)=>{e.globalPropertyChanged("skipHighSymbolLods",i)||this._recreateSymbol(s)})}_pixelRatioChange(){this.forEachGraphics3DSymbol((t,e,i)=>{t.globalPropertyChanged("pixelRatio",e)||this._recreateSymbol(i)})}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=qt(()=>{this._updatingPendingLoadedGraphicsChange=null})}setClippingExtent(t,e){const i=this.symbolCreationContext.clippingExtent,s=H();return Yt(t,s,e)?this.symbolCreationContext.clippingExtent=je(te(),s):this.symbolCreationContext.clippingExtent=null,!Zt(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(t){var i,s;if(this.destroyed)return;let e=!1;this.graphics3DGraphics.forEach(r=>{t(r)&&(e=!0)}),e&&((i=this.owner.view.labeler)==null||i.setDirty(),(s=this.owner.view.deconflictor)==null||s.setDirty())}forEachGraphics3DSymbol(t){for(const[e,i]of this._symbols){if(i==null)return;t(i,this._graphicsBySymbol.get(e)||_i,e)}}updateAllGraphicsVisibility(){this._filterVisibility!=null&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities(t=>{const e=this._updateUserVisibility(t),i=this._scaleVisibility!=null&&this._scaleVisibility.updateVisibility(t);return e||i})}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(E.GRAPHIC,R.USER,!1))}_validateRenderer(t){var i;const e=Xt(t,{geometryType:(i=this.layer)==null?void 0:i.geometryType});if(e){const s=`Renderer for layer '${this.layer.title?`${this.layer.title}, `:""}, id:${this.layer.id}' is not supported in a SceneView`;b.warn(s,e.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let t=!1;this._symbols.forEach((e,i)=>{if(e==null||e.referenced>0)return;const s=this._graphicsBySymbol.get(i);s&&s.size!==0||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),v(e),t=!0)}),t&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){return{snapshotInternals:()=>({graphics:[...this.graphics3DGraphics.keys()].sort(),symbols:[...this._symbols.keys()].sort(),graphicsBySymbol:[...this._graphicsBySymbol.keys()].sort().map(t=>({symbolId:t,graphics:[...this._graphicsBySymbol.get(t).keys()].sort()})),graphicsWithoutSymbol:[...this._graphicsWithoutSymbol.keys()].sort(),graphicsDrapedUids:[...this._graphicsDrapedUids].sort(),pendingUpdates:this._pendingUpdates}),symbols:this._symbols,filterVisibility:this._filterVisibility,numPending:this._pendingUpdates.size,forceUpdatePolicy:t=>{this._forcedUpdatePolicy=t}}}get performanceInfo(){return{visible:this.graphics3DGraphics.size,missing:this._graphicsWithoutSymbol.size,pending:this._pendingUpdates.size}}};var g;p.tmpVec=U(),o([h({readOnly:!0})],p.prototype,"computedExtent",void 0),o([h()],p.prototype,"currentRenderer",void 0),o([h()],p.prototype,"rendererHasGeometryOperations",void 0),o([h()],p.prototype,"_frameTask",void 0),o([h({readOnly:!0})],p.prototype,"_viewSpatialReference",null),o([h()],p.prototype,"_rendererChangeAbortController",void 0),o([h()],p.prototype,"_elevationInfoChangeAbortController",void 0),o([h()],p.prototype,"_initializeAbortController",void 0),o([h()],p.prototype,"_elevationAlignment",void 0),o([h()],p.prototype,"_scaleVisibility",void 0),o([h()],p.prototype,"_filterVisibility",void 0),o([h()],p.prototype,"_initializePromise",void 0),o([h()],p.prototype,"_spatialIndex",void 0),o([h({readOnly:!0})],p.prototype,"extentPadding",void 0),o([h()],p.prototype,"_updatingPendingLoadedGraphicsChange",void 0),o([h()],p.prototype,"_featureStore",void 0),o([h()],p.prototype,"_deconflictor",void 0),o([h()],p.prototype,"_labeler",void 0),o([h()],p.prototype,"_objectStates",void 0),o([h()],p.prototype,"_loadingSymbols",void 0),o([h()],p.prototype,"preferredUpdatePolicy",void 0),o([h()],p.prototype,"_forcedUpdatePolicy",void 0),o([h({readOnly:!0})],p.prototype,"effectiveUpdatePolicy",null),o([h({constructOnly:!0})],p.prototype,"elevationFeatureExpressionEnabled",void 0),o([h({constructOnly:!0})],p.prototype,"owner",void 0),o([h({constructOnly:!0})],p.prototype,"layer",void 0),o([h({constructOnly:!0})],p.prototype,"graphicSymbolSupported",void 0),o([h({constructOnly:!0})],p.prototype,"getRenderingInfoWithoutRenderer",void 0),o([h({constructOnly:!0})],p.prototype,"componentFactories",void 0),o([h({constructOnly:!0})],p.prototype,"setUidToIdOnAdd",void 0),o([h()],p.prototype,"featureStore",null),o([h()],p.prototype,"initializePromise",null),o([h()],p.prototype,"scaleVisibility",null),o([h()],p.prototype,"elevationAlignment",null),o([h()],p.prototype,"objectStates",null),o([h()],p.prototype,"filterVisibility",null),o([h({readOnly:!0})],p.prototype,"updating",null),o([h({readOnly:!0})],p.prototype,"running",null),o([h({readOnly:!0})],p.prototype,"suspendedOrOutsideOfView",null),o([h({readOnly:!0,dependsOn:[]})],p.prototype,"updatingRemaining",null),o([h({readOnly:!0})],p.prototype,"displayFeatureLimit",null),o([h({readOnly:!0,dependsOn:[]})],p.prototype,"averageSymbolComplexity",null),o([h({constructOnly:!0})],p.prototype,"hasZ",void 0),o([h({constructOnly:!0})],p.prototype,"hasM",void 0),o([h()],p.prototype,"_objectIdField",null),p=ee=o([L(Te)],p),function(t){t[t.NEW=0]="NEW",t[t.LOADING=1]="LOADING",t[t.READY=2]="READY",t[t.REJECTED=3]="REJECTED"}(g||(g={}));class gi{constructor(){this.add=null,this.renderingInfo=null,this.state=g.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=g.NEW,this.abortController=null,this.remove=null}}const mi=10,G=U(),F=U(),_i=new Map,Ae=re.getLogger("esri.views.3d.layers.graphics.Graphics3DScaleVisibility");let C=class extends V{constructor(t){super(t),this._scaleRangeActive=!1,this._layerScaleRangeVisibilityQuery=!1,this._extent=null,this._updatingHandles=new Jt,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null,this.layerScaleEnabled=!0,this.suspended=!1,this._dirty=!0}initialize(){this.updateScaleRangeActive();const t=this.graphicsCoreOwner.view.resourceController.scheduler;this.addHandles(t.registerTask(B.SCALE_VISIBILITY,this)),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this.layerMinMaxScaleChangeHandler())}destroy(){this._updatingHandles.destroy(),this.removeHandles(),this._dirty=!1,this._extent=null,this.graphicsCoreOwner=null,this.layer=null,this.queryGraphicUIDsInExtent=null,this.graphicsCore=null,this.basemapTerrain=null}get updating(){return this._dirty||this._updatingHandles.updating}_setDirty(){this._dirty=!0}setExtent(t){const e=this.graphicsCoreOwner.view.spatialReference,i=this.graphicsCoreOwner.view.basemapTerrain.spatialReference;if(e===i)this._extent=t??null;else{const s=H();Ce(t,e,s,i)?this._extent=s:this._extent=null}this._setDirty()}scaleRangeActive(){return this._scaleRangeActive}updateScaleRangeActive(){const t=this.layer,e=t.effectiveScaleRange;let i=this.layerScaleEnabled&&e!=null&&Le(e.minScale,e.maxScale);t.labelingInfo&&!i&&(i=t.labelingInfo.some(r=>r&&Le(r.minScale??0,r.maxScale??0)));const s=this._scaleRangeActive!==i;return this._scaleRangeActive=i,i&&!this.hasHandles(z)&&this.basemapTerrain?(this.addHandles(this.basemapTerrain.on("scale-change",r=>this._scaleUpdateHandler(r)),z),this.layerScaleEnabled&&this.addHandles(this.basemapTerrain.on("tiles-visibility-changed",()=>this._setDirty()),z)):!i&&this.hasHandles(z)&&this.removeHandles(z),s}get running(){return!(!this.graphicsCoreOwner.view.basemapTerrain||!this.updating)}runTask(t){const e=this.graphicsCoreOwner.view.basemapTerrain;if(this._extent&&e&&e.ready&&this._scaleRangeActive&&this.layerScaleEnabled){if(this._layerScaleRangeVisibilityQuery)return ae.YIELD;{this._layerScaleRangeVisibilityQuery=!0;const{minScale:i,maxScale:s}=this.layer.effectiveScaleRange;e.queryVisibleScaleRange(this._extent,i,s,r=>this._finishUpdate(r))}}else this._finishUpdate(!0);t.madeProgress()}_finishUpdate(t){this._layerScaleRangeVisibilityQuery=!1,this._set("suspended",!t),this._dirty=!1}_visibleAtLayerScale(t){const e=this.layer.effectiveScaleRange;return!this.layerScaleEnabled||we(t,e.minScale||0,e.maxScale||0)}_visibleAtLabelScale(t,e){return we(t,e.minScale||0,e.maxScale||0)}_graphicScale(t){let e;return t.centroid!=null?e=t.centroid:t.graphic.geometry!=null&&t.graphic.geometry.type==="point"&&(e=t.graphic.geometry),e?this.graphicsCoreOwner.view.basemapTerrain?this.graphicsCoreOwner.view.basemapTerrain.getScale(e):1:null}_graphicVisible(t){if(!this.layerScaleEnabled)return!0;const e=this._graphicScale(t);return this._visibleAtLayerScale(e)}updateVisibility(t){if(this._scaleRangeActive){const e=this._graphicVisible(t);return t.setVisibilityFlag(E.GRAPHIC,R.SCALE_RANGE,e)}return!1}updateGraphicLabelScaleVisibility(t){if(!this._scaleRangeActive||!t.labelLayers||t.labelLayers.length===0)return!1;const e=this._graphicScale(t),i=this._updateLabelScaleVisibility(t,e);return i&&(this.graphicsCoreOwner.view.deconflictor.setDirty(),this.graphicsCoreOwner.view.labeler.setDirty()),i}_updateLabelScaleVisibility(t,e){if(!t.labelLayers||t.labelLayers.length===0)return!1;const i=t.labelLayers[0]._labelClass;if((i==null?void 0:i.minScale)!=null&&i.maxScale!=null){const s=this._visibleAtLabelScale(e,i);if(t.setVisibilityFlag(E.LABEL,R.SCALE_RANGE,s))return!0}return!1}_scaleUpdateHandler(t){if(this._setDirty(),!this.graphicsCore.visible)return;const e=t.extent,i=t.scale,s=this._visibleAtLayerScale(i);let r=!1;const a=this.graphicsCoreOwner.view.spatialReference,n=t.spatialReference;if(n==null)return void Ae.error("scaleUpdate: Internal error, no SpatialReference given for tiles");const d=!n.equals(a);if(d&&!Ce(e,n,Ve,a))return void Ae.error("scaleUpdate: Internal error, cannot project AABR from "+n+" to wkid "+a);const l=d?Ve:e;this.queryGraphicUIDsInExtent(l,a,c=>{const y=this.graphicsCore.getGraphics3DGraphicById(c);if(y==null)return;const u=y.centroid;u!=null&&(e[0]>u.x||e[1]>u.y||e[2]t.setVisibilityFlag(E.GRAPHIC,R.SCALE_RANGE,!0)):this._scaleRangeActive&&this.graphicsCore.updateAllGraphicsVisibility(),this._setDirty()}};function Le(t,e){return t>0||e>0}o([h()],C.prototype,"graphicsCoreOwner",void 0),o([h()],C.prototype,"layer",void 0),o([h()],C.prototype,"queryGraphicUIDsInExtent",void 0),o([h()],C.prototype,"graphicsCore",void 0),o([h()],C.prototype,"basemapTerrain",void 0),o([h({constructOnly:!0})],C.prototype,"layerScaleEnabled",void 0),o([h({readOnly:!0})],C.prototype,"suspended",void 0),o([h({readOnly:!0})],C.prototype,"updating",null),o([h()],C.prototype,"_dirty",void 0),C=o([L("esri.views.3d.layers.graphics.Graphics3DScaleVisibility")],C);const z="terrain-events",Ve=H(),bi=.05;class fi{constructor(){this._extents=new Q({allocator:e=>e||H()}),this._tmpExtent=H(),this._dirty=!1}get empty(){return this._extents.length===0}get size(){return this._extents.length}clear(){this._extents.clear()}add(e){this._contains(e)||(this._removeContained(e),Ge(this._extents.pushNew(),e),this._dirty=!0)}pop(){return this._dirty&&this._mergeTight(),this._extents.pop()}merge(e){return this._mergeTight(e),e.hasProgressed}_mergeTight(e=$e){const i=this._extents,s=new Set;let r=0;for(;r!==i.length;){i.sort((a,n)=>a[0]-n[0]),r=i.length,s.clear();for(let a=0;a=n[2])break;s.add(l)}s.forEach(d=>{if(n===d)return;if(d[2]<=n[0])return void s.delete(d);const l=Y(n),c=Y(d),y=this._tmpExtent;Qt(n,d,y);const u=l+c;(Y(y)-u)/uxe(i,e))}_removeContained(e){this._extents.filterInPlace(i=>!xe(e,i))}get test(){const e=this;return{containsPoint:i=>e._extents.some(s=>Kt(s,i))}}}let P=class extends V{constructor(t){super(t),this._dirtyExtents=new fi,this._globalDirty=!1,this._averageExtentUpdateSize=0,this._dirtyGraphicsSet=new Set,this._updateElevation=!1,this.graphicsCoreOwner=null,this.graphicsCore=null,this.events=new ie}initialize(){const t=this.elevationProvider,e=this.graphicsCoreOwner.view.resourceController.scheduler;this.addHandles([t.on("elevation-change",i=>this._elevationChanged(i)),S(()=>this.graphicsCoreOwner.suspended,()=>this._suspendedChange()),e.registerTask(B.ELEVATION_ALIGNMENT,this)])}destroy(){this._dirtyGraphicsSet.clear(),this.graphicsCoreOwner=null,this.graphicsCore=null,this.queryGraphicUIDsInExtent=null,this.elevationProvider=null}clear(){this._dirtyGraphicsSet.clear(),this.notifyChange("updating")}_suspendedChange(){this.graphicsCoreOwner.suspended===!0?this._updateElevation=!1:this.graphicsCoreOwner.suspended===!1&&this._updateElevation&&(this._globalDirty=!0,this.notifyChange("updating"))}elevationInfoChange(){this._globalDirty=!0,this.notifyChange("updating")}get updating(){return this.running}get running(){return this._dirtyGraphicsSet.size>0||this._dirtyExtents&&!this._dirtyExtents.empty||this._globalDirty}get updatingRemaining(){return this._dirtyGraphicsSet.size+this._dirtyExtents.size*this._averageExtentUpdateSize}runTask(t){for(this._globalDirty&&(this._markAllGraphicsElevationDirty(),this._globalDirty=!1,t.madeProgress()),t.run(()=>this._dirtyExtents.merge(t));this.running&&!t.done;)this._updateDirtyGraphics(t),this._updateDirtyExtents(t);this.notifyChange("updating")}_updateDirtyGraphics(t){const e=this.graphicsCoreOwner.view.renderCoordsHelper,i=this.graphicsCore.effectiveUpdatePolicy===f.ASYNC;for(const s of this._dirtyGraphicsSet.keys()){const r=this.graphicsCore.getGraphics3DGraphicById(s);if(this._dirtyGraphicsSet.delete(s),r!=null&&(r.alignWithElevation(this.elevationProvider,e,i),this.graphicsCoreOwner.view.deconflictor.setDirty(),t.madeProgress()),t.done)return}}_updateDirtyExtents(t){for(;!this._dirtyExtents.empty&&!t.done;){const e=this._dirtyExtents.pop(),i=this.elevationProvider.spatialReference;this.events.emit("invalidate-elevation",{extent:e,spatialReference:i});const s=this._dirtyGraphicsSet.size;this.queryGraphicUIDsInExtent(e,i,r=>{const a=this.graphicsCore.getGraphics3DGraphicById(r);a!=null&&a.needsElevationUpdates()&&this._dirtyGraphicsSet.add(r)}),this._averageExtentUpdateSize=.1*(this._dirtyGraphicsSet.size-s)+.9*this._averageExtentUpdateSize,t.madeProgress()}}_markAllGraphicsElevationDirty(){this._dirtyExtents.clear(),this._dirtyGraphicsSet.clear(),this.graphicsCore.graphics3DGraphics.forEach((t,e)=>this._dirtyGraphicsSet.add(e))}_elevationChanged(t){if(t.context==="scene"&&(!this.graphicsCore.layer.elevationInfo||this.graphicsCore.layer.elevationInfo.mode!=="relative-to-scene"))return;const{extent:e,spatialReference:i}=t;if(this.graphicsCoreOwner.suspended){if(!this._updateElevation){const s=this.graphicsCore.computedExtent;s&&e[2]>s.xmin&&e[0]s.ymin&&e[1]this._viewChange()),S(()=>e.state.camera,()=>this._viewChange(),ti),s.registerTask(B.FRUSTUM_VISIBILITY,this),S(()=>i.visibleElevationBounds,()=>this._elevationBoundsChange())]),e.viewingMode==="local"?this._isVisibleBelowSurface=!0:this.addHandles([S(()=>{var r,a,n;return[i.baseOpacity,i.wireframe,(n=(a=(r=e.map)==null?void 0:r.ground)==null?void 0:a.navigationConstraint)==null?void 0:n.type]},()=>this._updateIsVisibleBelowSurface(),ii)])}destroy(){this._set("graphicsCoreOwner",null),this._extent=null,this._extentIntersection=null}_setDirty(){this.updating||this._set("updating",!0)}setExtent(t){this._extent=t,this._extentIntersectionDirty=!0,this._setDirty()}_viewChange(){this._setDirty()}_elevationBoundsChange(){this._setDirty(),this._extentIntersectionDirty=!0}set _isVisibleBelowSurface(t){this._isVisibleBelowSurfaceInternal=t,this._setDirty(),this._extentIntersectionDirty=!0}_updateIsVisibleBelowSurface(){var r,a;const t=this.graphicsCoreOwner.view,e=t.basemapTerrain,i=t.viewingMode==="local",s=((a=(r=t.map.ground)==null?void 0:r.navigationConstraint)==null?void 0:a.type)==="none";this._isVisibleBelowSurface=i||!e.opaque||s}_updateExtentIntersection(){if(!this._extentIntersectionDirty)return;this._extentIntersectionDirty=!1;const t=this.graphicsCoreOwner.view;let e;if(this._isVisibleBelowSurfaceInternal)e=-.3*Ie(t.spatialReference).radius;else{const{min:i,max:s}=t.basemapTerrain.visibleElevationBounds;e=i-Math.max(1,(s-i)*(vi-1))}this._extentIntersection.update(this._extent,t.spatialReference,e)}get running(){return this.updating}runTask(t){if(this._set("updating",!1),!this._extent)return this._set("suspended",!1),ae.YIELD;this._updateExtentIntersection();const e=this.graphicsCoreOwner.view.frustum,i=Ie(this.graphicsCoreOwner.view.spatialReference).radius;this._set("suspended",!this._extentIntersection.isVisibleInFrustum(e,i)),t.madeProgress()}};o([h({readOnly:!0})],M.prototype,"suspended",void 0),o([h({constructOnly:!0})],M.prototype,"graphicsCoreOwner",void 0),o([h({readOnly:!0})],M.prototype,"updating",void 0),M=o([L("esri.views.3d.layers.graphics.Graphics3DFrustumVisibility")],M);var I;(function(t){t[t.Object=0]="Object",t[t.RenderGeometry=1]="RenderGeometry",t[t.External=2]="External",t[t.COUNT=3]="COUNT"})(I||(I={}));class Si{constructor(){this._items=[]}addObject(e,i){this._items.push({type:I.Object,objectStateId:i,object:e})}addRenderGeometry(e,i,s){this._items.push({type:I.RenderGeometry,objectStateId:i,renderGeometry:e,owner:s})}addExternal(e,i){this._items.push({type:I.External,objectStateId:i,remove:e})}remove(e){for(let i=this._items.length-1;i>=0;--i){const s=this._items[i];s.objectStateId===e&&(this._removeObjectStateItem(s),this._items.splice(i,1))}}removeObject(e){for(let i=this._items.length-1;i>=0;--i){const s=this._items[i];s.type===I.Object&&s.object===e&&(this._removeObjectStateItem(s),this._items.splice(i,1))}}removeRenderGeometry(e){for(let i=this._items.length-1;i>=0;--i){const s=this._items[i];s.type===I.RenderGeometry&&s.renderGeometry===e&&(this._removeObjectStateItem(s),this._items.splice(i,1))}}removeAll(){this._items.forEach(e=>{this._removeObjectStateItem(e)}),this._items=[]}_removeObjectStateItem(e){switch(e.type){case I.Object:e.objectStateId.channel===Ee.Highlight?e.object.removeHighlight(e.objectStateId):e.objectStateId.channel===Ee.MaskOccludee&&e.object.removeOcclude(e.objectStateId);break;case I.RenderGeometry:e.owner.removeRenderGeometryObjectState(e.renderGeometry,e.objectStateId);break;case I.External:e.remove(e.objectStateId)}}}class Ci{constructor(e,i){this.stateType=e,this.objectIdField=i,this.objectStateSet=new Si,this.ids=new Set,this.paused=!1}hasGraphic(e){if(this.objectIdField){const i=e.graphic.attributes[this.objectIdField];return this.ids.has(i)}return this.ids.has(e.graphic.uid)}}class Pi{constructor(e){this._graphicsCore=e,this._stateSets=new Array}destroy(){this.reset(),this._stateSets=null}reset(){this._stateSets&&(this._stateSets.forEach(e=>e.objectStateSet.removeAll()),this._stateSets.length=0)}acquireSet(e,i){const s=new Ci(e,i);this._stateSets.push(s);const r=se(()=>this.releaseSet(s));return{set:s,handle:r}}releaseSet(e){e.objectStateSet.removeAll();const i=this._stateSets?this._stateSets.indexOf(e):-1;i!==-1&&this._stateSets.splice(i,1)}_addObjectStateSet(e,i){e.addObjectStateSet(i.stateType,i.objectStateSet)}_removeObjectStateSet(e,i){e.removeObjectState(i.objectStateSet)}setUid(e,i){e.ids.add(i);const s=this._graphicsCore.graphics3DGraphics.get(i);s&&this._addObjectStateSet(s,e)}setUids(e,i){i.forEach(s=>this.setUid(e,s))}setObjectIds(e,i){i.forEach(s=>e.ids.add(s)),this._initializeSet(e)}addGraphic(e){this._stateSets.forEach(i=>{!i.paused&&i.hasGraphic(e)&&this._addObjectStateSet(e,i)})}removeGraphic(e){this._stateSets.forEach(i=>{i.hasGraphic(e)&&this._removeObjectStateSet(e,i)})}allGraphicsDeleted(){this._stateSets&&this._stateSets.forEach(e=>e.objectStateSet.removeAll())}_initializeSet(e){const i=this._graphicsCore.graphics3DGraphics;e.objectIdField?i.forEach(s=>{s&&e.hasGraphic(s)&&this._addObjectStateSet(s,e)}):e.ids.forEach(s=>{const r=i.get(s);r&&this._addObjectStateSet(r,e)})}get test(){return{states:this._stateSets}}}export{p as F,hi as e,fi as l,P as p,Pi as s,M as u,C as y}; diff --git a/dist/assets/GraphicsLayerView3D-TqJxY2EU.js b/dist/assets/GraphicsLayerView3D-WVV0TMGR.js similarity index 84% rename from dist/assets/GraphicsLayerView3D-TqJxY2EU.js rename to dist/assets/GraphicsLayerView3D-WVV0TMGR.js index 1d9d836..4c7a0d9 100644 --- a/dist/assets/GraphicsLayerView3D-TqJxY2EU.js +++ b/dist/assets/GraphicsLayerView3D-WVV0TMGR.js @@ -1 +1 @@ -import{F as l,n as c,E as h,G as u,e as t,y as o,c as d}from"./index-J0iiHjMT.js";import{n as m}from"./LayerView3D-iOx2MD1g.js";import{c as g,r as y}from"./queryForSymbologySnapping-I1fFQTD_.js";import{O as f}from"./GraphicsProcessor-rh5nA4fc.js";import{l as b}from"./projectExtentUtils-TwA6ooHn.js";import{u as v}from"./LayerView-efDufa6j.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";let i=class extends m(v){constructor(){super(...arguments),this.type="graphics-3d",this.symbologySnappingSupported=!0,this._slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null,this.ignoresMemoryFactor=!0}initialize(){this._set("processor",new f({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this.addHandles(this.layer.on("graphic-update",e=>this.processor.graphicsCore.graphicUpdateHandler(e))),this.addResolvingPromise(b(this).then(e=>this.fullExtentInLocalViewSpatialReference=e)),this.layer.internal?this.notifyChange("updating"):this.addHandles(l(()=>{var e,s;return(s=(e=this.view)==null?void 0:e.basemapTerrain)==null?void 0:s.ready},()=>()=>this.notifyChange("updating"),{once:!0}))}destroy(){this._updatingHandles.removeAll(),this._set("processor",c(this.processor))}get loadedGraphics(){return this.layer.graphics}get legendEnabled(){var e;return this.canResume()&&!((e=this.processor)!=null&&e.frustumVisibilitySuspended)}get slicePlaneEnabled(){const e=this.layer.internal;return this._slicePlaneEnabled&&!e}set slicePlaneEnabled(e){this._slicePlaneEnabled=e}getSuspendInfo(){var s,r;const e=super.getSuspendInfo();return e.outsideScaleRange=((s=this.processor)==null?void 0:s.scaleVisibilitySuspended)??!1,e.outsideOfView=((r=this.processor)==null?void 0:r.frustumVisibilitySuspended)??!1,e}async fetchPopupFeatures(e,s){return(s==null?void 0:s.clientGraphics)??[]}getHit(e){return this.processor.getHit(e)}whenGraphicBounds(e,s){return this.processor.whenGraphicBounds(e,s)}computeAttachmentOrigin(e,s){var r;return(r=this.processor)==null?void 0:r.computeAttachmentOrigin(e,s)}getSymbolLayerSize(e,s){return this.processor.getSymbolLayerSize(e,s)}queryGraphics(){return Promise.resolve(this.loadedGraphics)}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e){return this.processor.highlight(e)}async elevationAlignPointsInFeatures(e,s){const{processor:r}=this;if((r==null?void 0:r.graphics3DGraphics)==null)throw new h("graphicslayerview3d:missing-processor","A Graphics3D processor is needed to resolve graphics elevation.");const{graphics3DGraphics:a}=r,p=n=>typeof n=="number"?a.get(n):void 0;return g(this.view,this.layer,p,e,s)}async queryForSymbologySnapping(e,s){return y(this.processor,e,s)}get updatePolicy(){var e;return((e=this.processor)==null?void 0:e.graphicsCore.effectiveUpdatePolicy)||u.SYNC}canResume(){var e;return super.canResume()&&!((e=this.processor)!=null&&e.scaleVisibilitySuspended)}isUpdating(){var e,s;return this.view&&this.layer&&!(!((e=this.processor)!=null&&e.updating)&&(this.layer.internal||(s=this.view.basemapTerrain)!=null&&s.ready))}get performanceInfo(){var e,s;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:-1,totalNumberOfFeatures:-1,nodes:0,core:null,updating:this.updating,elevationUpdating:((e=this.processor)==null?void 0:e.elevationAlignment.updating)??!1,visibilityFrustum:!((s=this.processor)!=null&&s.frustumVisibilitySuspended)}}get usedMemory(){var e,s;return((s=(e=this.processor)==null?void 0:e.graphicsCore)==null?void 0:s.usedMemory)??0}get unloadedMemory(){var e,s;return(s=(e=this.processor)==null?void 0:e.graphicsCore)==null?void 0:s.unprocessedMemoryEstimate}};t([o()],i.prototype,"loadedGraphics",null),t([o({readOnly:!0})],i.prototype,"legendEnabled",null),t([o()],i.prototype,"layer",void 0),t([o({readOnly:!0})],i.prototype,"processor",void 0),t([o()],i.prototype,"_slicePlaneEnabled",void 0),t([o({type:Boolean})],i.prototype,"slicePlaneEnabled",null),i=t([d("esri.views.3d.layers.GraphicsLayerView3D")],i);const _=i;export{_ as default}; +import{v as l,b as c,r as h,C as u,e as t,y as o,c as d}from"./index-pCX-0tJH.js";import{n as m}from"./LayerView3D-57OghbRh.js";import{c as g,r as y}from"./queryForSymbologySnapping-MXWRIdj-.js";import{O as b}from"./GraphicsProcessor-QBvSewdt.js";import{l as f}from"./projectExtentUtils-Q4rXasWA.js";import{u as v}from"./LayerView-ixwLVnzr.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";let i=class extends m(v){constructor(){super(...arguments),this.type="graphics-3d",this.symbologySnappingSupported=!0,this._slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null,this.ignoresMemoryFactor=!0}initialize(){this._set("processor",new b({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this.addHandles(this.layer.on("graphic-update",e=>this.processor.graphicsCore.graphicUpdateHandler(e))),this.addResolvingPromise(f(this).then(e=>this.fullExtentInLocalViewSpatialReference=e)),this.layer.internal?this.notifyChange("updating"):this.addHandles(l(()=>{var e,s;return(s=(e=this.view)==null?void 0:e.basemapTerrain)==null?void 0:s.ready},()=>()=>this.notifyChange("updating"),{once:!0}))}destroy(){this._updatingHandles.removeAll(),this._set("processor",c(this.processor))}get loadedGraphics(){return this.layer.graphics}get legendEnabled(){var e;return this.canResume()&&!((e=this.processor)!=null&&e.frustumVisibilitySuspended)}get slicePlaneEnabled(){const e=this.layer.internal;return this._slicePlaneEnabled&&!e}set slicePlaneEnabled(e){this._slicePlaneEnabled=e}getSuspendInfo(){var s,r;const e=super.getSuspendInfo();return e.outsideScaleRange=((s=this.processor)==null?void 0:s.scaleVisibilitySuspended)??!1,e.outsideOfView=((r=this.processor)==null?void 0:r.frustumVisibilitySuspended)??!1,e}async fetchPopupFeatures(e,s){return(s==null?void 0:s.clientGraphics)??[]}getHit(e){return this.processor.getHit(e)}whenGraphicBounds(e,s){return this.processor.whenGraphicBounds(e,s)}computeAttachmentOrigin(e,s){var r;return(r=this.processor)==null?void 0:r.computeAttachmentOrigin(e,s)}getSymbolLayerSize(e,s){return this.processor.getSymbolLayerSize(e,s)}queryGraphics(){return Promise.resolve(this.loadedGraphics)}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e){return this.processor.highlight(e)}async elevationAlignPointsInFeatures(e,s){const{processor:r}=this;if((r==null?void 0:r.graphics3DGraphics)==null)throw new h("graphicslayerview3d:missing-processor","A Graphics3D processor is needed to resolve graphics elevation.");const{graphics3DGraphics:a}=r,p=n=>typeof n=="number"?a.get(n):void 0;return g(this.view,this.layer,p,e,s)}async queryForSymbologySnapping(e,s){return y(this.processor,e,s)}get updatePolicy(){var e;return((e=this.processor)==null?void 0:e.graphicsCore.effectiveUpdatePolicy)||u.SYNC}canResume(){var e;return super.canResume()&&!((e=this.processor)!=null&&e.scaleVisibilitySuspended)}isUpdating(){var e,s;return this.view&&this.layer&&!(!((e=this.processor)!=null&&e.updating)&&(this.layer.internal||(s=this.view.basemapTerrain)!=null&&s.ready))}get performanceInfo(){var e,s;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:-1,totalNumberOfFeatures:-1,nodes:0,core:null,updating:this.updating,elevationUpdating:((e=this.processor)==null?void 0:e.elevationAlignment.updating)??!1,visibilityFrustum:!((s=this.processor)!=null&&s.frustumVisibilitySuspended)}}get usedMemory(){var e,s;return((s=(e=this.processor)==null?void 0:e.graphicsCore)==null?void 0:s.usedMemory)??0}get unloadedMemory(){var e,s;return(s=(e=this.processor)==null?void 0:e.graphicsCore)==null?void 0:s.unprocessedMemoryEstimate}};t([o()],i.prototype,"loadedGraphics",null),t([o({readOnly:!0})],i.prototype,"legendEnabled",null),t([o()],i.prototype,"layer",void 0),t([o({readOnly:!0})],i.prototype,"processor",void 0),t([o()],i.prototype,"_slicePlaneEnabled",void 0),t([o({type:Boolean})],i.prototype,"slicePlaneEnabled",null),i=t([d("esri.views.3d.layers.GraphicsLayerView3D")],i);const _=i;export{_ as default}; diff --git a/dist/assets/GraphicsProcessor-QBvSewdt.js b/dist/assets/GraphicsProcessor-QBvSewdt.js new file mode 100644 index 0000000..1765f98 --- /dev/null +++ b/dist/assets/GraphicsProcessor-QBvSewdt.js @@ -0,0 +1 @@ +import{e as n,g,aE as b,h as f,C as m,aF as C,ac as w,B as p,a9 as V,b as c,aG as v,aH as S,aI as E,aJ as _,aK as h,aL as x,K as u,V as G,T as O,y as a,c as P,a0 as A,aM as j,aN as H}from"./index-pCX-0tJH.js";import{F as I,p as R,y as z,s as D,u as q}from"./Graphics3DObjectStates-JUKhPt0b.js";let r=class extends g{constructor(e){super(e),this.type="graphics-3d",this.graphicsCore=null,this.drapeSourceType=b.Features,this.scaleVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this._suspendResumeExtent=null,this._updatingHandles=new f}initialize(){const{layer:e}=this,i="effectiveScaleRange"in e?e:null,l=this.scaleVisibilityEnabled&&i!=null,t=new I({owner:this,layer:this.owner.layer,preferredUpdatePolicy:m.SYNC,graphicSymbolSupported:!0,componentFactories:{elevationAlignment:(s,o)=>new R({graphicsCoreOwner:this,graphicsCore:s,queryGraphicUIDsInExtent:o,elevationProvider:this.view.elevationProvider}),scaleVisibility:l?(s,o)=>new z({graphicsCoreOwner:this,layer:i,queryGraphicUIDsInExtent:o,graphicsCore:s,basemapTerrain:this.owner.view.basemapTerrain}):null,objectStates:s=>new D(s)}});if(this._set("graphicsCore",t),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new q({graphicsCoreOwner:this})),"fullOpacity"in this.owner){const s=this.owner;this._updatingHandles.add(()=>s.fullOpacity,()=>this.graphicsCore.opacityChange())}if("elevationInfo"in e){const s=e;this._updatingHandles.add(()=>s.elevationInfo,(o,y)=>{C(o,y)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())})}this._set("initializePromise",this._initializeAsync()),this._updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){try{await this.graphicsCore.initializePromise}catch(e){if(w(e))return;throw e}this.destroyed||(this.addHandles(p(()=>this.view.clippingArea,()=>this._updateClippingExtent(),V)),this._updateClippingExtent(),this._setupSuspendResumeExtent(),this.graphicsCore.startCreateGraphics())}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",c(this.frustumVisibility)),this._set("graphicsCore",c(this.graphicsCore))}get layer(){return this.owner.layer}get view(){return this.owner.view}get scaleVisibility(){var e;return(e=this.graphicsCore)==null?void 0:e.scaleVisibility}get elevationAlignment(){var e;return(e=this.graphicsCore)==null?void 0:e.elevationAlignment}get objectStates(){var e;return(e=this.graphicsCore)==null?void 0:e.objectStates}get scaleVisibilitySuspended(){return!(this.scaleVisibility==null||!this.scaleVisibility.suspended)}get frustumVisibilitySuspended(){return this.frustumVisibility!=null&&this.frustumVisibility.suspended}get suspended(){return this.owner.suspended??!1}get updating(){var e;return!!((e=this.graphicsCore)!=null&&e.updating||this.scaleVisibility!=null&&this.scaleVisibility.updating||this.frustumVisibility!=null&&this.frustumVisibility.updating||this._updatingHandles.updating)}get graphics3DGraphics(){var e;return(e=this.graphicsCore)==null?void 0:e.graphics3DGraphics}get graphics3DGraphicsByObjectID(){var e;return(e=this.graphicsCore)==null?void 0:e.graphics3DGraphicsByObjectID}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner.fullOpacity??1}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}getRenderingInfo(e,i,l){const t=v(e,{renderer:i,arcade:l});if(t!=null&&t.color){const s=t.color;s[0]=s[0]/255,s[1]=s[1]/255,s[2]=s[2]/255}return t}getRenderingInfoAsync(e,i,l,t){return S(e,{renderer:i,arcade:l,...t})}getHit(e){if(this.owner.loadedGraphics){const i=this.owner.loadedGraphics.find(l=>l.uid===e);if(i){const l=this.layer instanceof E?this.layer:null,t=_(i,l);return{type:"graphic",graphic:t,layer:t.layer}}}return null}whenGraphicBounds(e,i){return this.graphicsCore?this.graphicsCore.whenGraphicBounds(e,i):Promise.reject()}computeAttachmentOrigin(e,i){return this.graphicsCore?this.graphicsCore.computeAttachmentOrigin(e,i):null}getSymbolLayerSize(e,i){return this.graphicsCore?this.graphicsCore.getSymbolLayerSize(e,i):null}maskOccludee(e){const{set:i,handle:l}=this.objectStates.acquireSet(h.MaskOccludee,null);return this.objectStates.setUid(i,e.uid),l}highlight(e){if(e instanceof x)return d;if(typeof e=="number")return this.highlight([e]);if(e instanceof u)return this.highlight([e]);if(e instanceof G&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof u){const i=e.map(s=>s.uid),{set:l,handle:t}=this.objectStates.acquireSet(h.Highlight,null);return this.objectStates.setUids(l,i),t}if(typeof e[0]=="number"){const i=e,{set:l,handle:t}=this.objectStates.acquireSet(h.Highlight,null);return this.objectStates.setObjectIds(l,i),t}}return d}_setupSuspendResumeExtent(){const{scaleVisibility:e,frustumVisibility:i}=this;if(e==null&&i==null)return;const l=({computedExtent:t,extentPadding:s})=>{this._suspendResumeExtent=j(t,this._suspendResumeExtent,H,s),e!=null&&e.setExtent(this._suspendResumeExtent),i!=null&&i.setExtent(this._suspendResumeExtent)};this.addHandles(p(()=>{var t,s;return{computedExtent:(t=this.graphicsCore)==null?void 0:t.computedExtent,extentPadding:(s=this.graphicsCore)==null?void 0:s.extentPadding}},t=>l(t),O))}_updateClippingExtent(){const e=this.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.view.spatialReference)&&this.graphicsCore.recreateAllGraphics()}};n([a()],r.prototype,"type",void 0),n([a({constructOnly:!0})],r.prototype,"owner",void 0),n([a()],r.prototype,"layer",null),n([a()],r.prototype,"view",null),n([a({constructOnly:!0})],r.prototype,"graphicsCore",void 0),n([a()],r.prototype,"scaleVisibility",null),n([a({constructOnly:!0})],r.prototype,"frustumVisibility",void 0),n([a()],r.prototype,"elevationAlignment",null),n([a()],r.prototype,"objectStates",null),n([a()],r.prototype,"scaleVisibilitySuspended",null),n([a({readOnly:!0})],r.prototype,"frustumVisibilitySuspended",null),n([a()],r.prototype,"suspended",null),n([a({readOnly:!0})],r.prototype,"updating",null),n([a()],r.prototype,"loadedGraphics",null),n([a()],r.prototype,"fullOpacity",null),n([a()],r.prototype,"slicePlaneEnabled",null),n([a()],r.prototype,"drapeSourceType",void 0),n([a()],r.prototype,"updatePolicy",null),n([a({constructOnly:!0})],r.prototype,"scaleVisibilityEnabled",void 0),n([a({constructOnly:!0})],r.prototype,"frustumVisibilityEnabled",void 0),n([a()],r.prototype,"initializePromise",void 0),r=n([P("esri.views.3d.layers.graphics.GraphicsProcessor")],r);const d=A();export{r as O}; diff --git a/dist/assets/GraphicsProcessor-rh5nA4fc.js b/dist/assets/GraphicsProcessor-rh5nA4fc.js deleted file mode 100644 index 92ad206..0000000 --- a/dist/assets/GraphicsProcessor-rh5nA4fc.js +++ /dev/null @@ -1 +0,0 @@ -import{e as n,p as g,c3 as b,k as f,G as m,c4 as C,f as w,d as p,C as V,n as c,c5 as S,c6 as v,c7 as E,c8 as _,c9 as h,ca as x,S as u,V as G,A as O,y as a,c as P,a2 as A,cb as j,cc as H}from"./index-J0iiHjMT.js";import{F as I,p as R,y as z,s as D,u as q}from"./Graphics3DObjectStates--mMi4sdi.js";let r=class extends g{constructor(e){super(e),this.type="graphics-3d",this.graphicsCore=null,this.drapeSourceType=b.Features,this.scaleVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this._suspendResumeExtent=null,this._updatingHandles=new f}initialize(){const{layer:e}=this,i="effectiveScaleRange"in e?e:null,l=this.scaleVisibilityEnabled&&i!=null,t=new I({owner:this,layer:this.owner.layer,preferredUpdatePolicy:m.SYNC,graphicSymbolSupported:!0,componentFactories:{elevationAlignment:(s,o)=>new R({graphicsCoreOwner:this,graphicsCore:s,queryGraphicUIDsInExtent:o,elevationProvider:this.view.elevationProvider}),scaleVisibility:l?(s,o)=>new z({graphicsCoreOwner:this,layer:i,queryGraphicUIDsInExtent:o,graphicsCore:s,basemapTerrain:this.owner.view.basemapTerrain}):null,objectStates:s=>new D(s)}});if(this._set("graphicsCore",t),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new q({graphicsCoreOwner:this})),"fullOpacity"in this.owner){const s=this.owner;this._updatingHandles.add(()=>s.fullOpacity,()=>this.graphicsCore.opacityChange())}if("elevationInfo"in e){const s=e;this._updatingHandles.add(()=>s.elevationInfo,(o,y)=>{C(o,y)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())})}this._set("initializePromise",this._initializeAsync()),this._updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){try{await this.graphicsCore.initializePromise}catch(e){if(w(e))return;throw e}this.destroyed||(this.addHandles(p(()=>this.view.clippingArea,()=>this._updateClippingExtent(),V)),this._updateClippingExtent(),this._setupSuspendResumeExtent(),this.graphicsCore.startCreateGraphics())}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",c(this.frustumVisibility)),this._set("graphicsCore",c(this.graphicsCore))}get layer(){return this.owner.layer}get view(){return this.owner.view}get scaleVisibility(){var e;return(e=this.graphicsCore)==null?void 0:e.scaleVisibility}get elevationAlignment(){var e;return(e=this.graphicsCore)==null?void 0:e.elevationAlignment}get objectStates(){var e;return(e=this.graphicsCore)==null?void 0:e.objectStates}get scaleVisibilitySuspended(){return!(this.scaleVisibility==null||!this.scaleVisibility.suspended)}get frustumVisibilitySuspended(){return this.frustumVisibility!=null&&this.frustumVisibility.suspended}get suspended(){return this.owner.suspended??!1}get updating(){var e;return!!((e=this.graphicsCore)!=null&&e.updating||this.scaleVisibility!=null&&this.scaleVisibility.updating||this.frustumVisibility!=null&&this.frustumVisibility.updating||this._updatingHandles.updating)}get graphics3DGraphics(){var e;return(e=this.graphicsCore)==null?void 0:e.graphics3DGraphics}get graphics3DGraphicsByObjectID(){var e;return(e=this.graphicsCore)==null?void 0:e.graphics3DGraphicsByObjectID}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner.fullOpacity??1}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}getRenderingInfo(e,i,l){const t=S(e,{renderer:i,arcade:l});if(t!=null&&t.color){const s=t.color;s[0]=s[0]/255,s[1]=s[1]/255,s[2]=s[2]/255}return t}getRenderingInfoAsync(e,i,l,t){return v(e,{renderer:i,arcade:l,...t})}getHit(e){if(this.owner.loadedGraphics){const i=this.owner.loadedGraphics.find(l=>l.uid===e);if(i){const l=this.layer instanceof E?this.layer:null,t=_(i,l);return{type:"graphic",graphic:t,layer:t.layer}}}return null}whenGraphicBounds(e,i){return this.graphicsCore?this.graphicsCore.whenGraphicBounds(e,i):Promise.reject()}computeAttachmentOrigin(e,i){return this.graphicsCore?this.graphicsCore.computeAttachmentOrigin(e,i):null}getSymbolLayerSize(e,i){return this.graphicsCore?this.graphicsCore.getSymbolLayerSize(e,i):null}maskOccludee(e){const{set:i,handle:l}=this.objectStates.acquireSet(h.MaskOccludee,null);return this.objectStates.setUid(i,e.uid),l}highlight(e){if(e instanceof x)return d;if(typeof e=="number")return this.highlight([e]);if(e instanceof u)return this.highlight([e]);if(e instanceof G&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof u){const i=e.map(s=>s.uid),{set:l,handle:t}=this.objectStates.acquireSet(h.Highlight,null);return this.objectStates.setUids(l,i),t}if(typeof e[0]=="number"){const i=e,{set:l,handle:t}=this.objectStates.acquireSet(h.Highlight,null);return this.objectStates.setObjectIds(l,i),t}}return d}_setupSuspendResumeExtent(){const{scaleVisibility:e,frustumVisibility:i}=this;if(e==null&&i==null)return;const l=({computedExtent:t,extentPadding:s})=>{this._suspendResumeExtent=j(t,this._suspendResumeExtent,H,s),e!=null&&e.setExtent(this._suspendResumeExtent),i!=null&&i.setExtent(this._suspendResumeExtent)};this.addHandles(p(()=>{var t,s;return{computedExtent:(t=this.graphicsCore)==null?void 0:t.computedExtent,extentPadding:(s=this.graphicsCore)==null?void 0:s.extentPadding}},t=>l(t),O))}_updateClippingExtent(){const e=this.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.view.spatialReference)&&this.graphicsCore.recreateAllGraphics()}};n([a()],r.prototype,"type",void 0),n([a({constructOnly:!0})],r.prototype,"owner",void 0),n([a()],r.prototype,"layer",null),n([a()],r.prototype,"view",null),n([a({constructOnly:!0})],r.prototype,"graphicsCore",void 0),n([a()],r.prototype,"scaleVisibility",null),n([a({constructOnly:!0})],r.prototype,"frustumVisibility",void 0),n([a()],r.prototype,"elevationAlignment",null),n([a()],r.prototype,"objectStates",null),n([a()],r.prototype,"scaleVisibilitySuspended",null),n([a({readOnly:!0})],r.prototype,"frustumVisibilitySuspended",null),n([a()],r.prototype,"suspended",null),n([a({readOnly:!0})],r.prototype,"updating",null),n([a()],r.prototype,"loadedGraphics",null),n([a()],r.prototype,"fullOpacity",null),n([a()],r.prototype,"slicePlaneEnabled",null),n([a()],r.prototype,"drapeSourceType",void 0),n([a()],r.prototype,"updatePolicy",null),n([a({constructOnly:!0})],r.prototype,"scaleVisibilityEnabled",void 0),n([a({constructOnly:!0})],r.prototype,"frustumVisibilityEnabled",void 0),n([a()],r.prototype,"initializePromise",void 0),r=n([P("esri.views.3d.layers.graphics.GraphicsProcessor")],r);const d=A();export{r as O}; diff --git a/dist/assets/GraphicsSnappingSource-0y5Y2-KL.js b/dist/assets/GraphicsSnappingSource-0y5Y2-KL.js new file mode 100644 index 0000000..d56df4c --- /dev/null +++ b/dist/assets/GraphicsSnappingSource-0y5Y2-KL.js @@ -0,0 +1 @@ +import{g as v,h as S,gA as w,P as y,gz as b,B as k,fg as E,gE as F,ab as c,gF as C,gC as P,N as A,f8 as G,j as H,gG as g,cj as I,dW as $,eP as R,eU as z,f9 as O,eL as x,bn as Z,e as r,y as p,c as L,gD as M,gH as W}from"./index-pCX-0tJH.js";import{a as j}from"./normalizeUtilsSync-GeARMwm8.js";import{m as N}from"./FeatureStore-PXMUgn0j.js";import{W as q}from"./QueryEngine-uvDs-vBe.js";import{o as D,a as J}from"./queryEngineUtils-bbt-XRJJ.js";import{i as m,r as T,n as _}from"./symbologySnappingCandidates-d1xE3f-Q.js";import"./BoundsStore-_-dPK5c-.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./VertexSnappingCandidate-YEvkEqQJ.js";import"./PointSnappingHint-bwlQAyn6.js";const f="graphics-collections";let a=class extends v{get updating(){return this._updatingHandles.updating}get _hasZ(){const e=this.view;return e!=null&&e.type==="3d"&&this.layerSource.layer.type!=="map-notes"}get _snappingElevationAligner(){const{view:e}=this,{layer:t}=this.layerSource,s=e!=null&&e.type==="3d";if(!s||t.type==="map-notes")return m();const i=async(n,o)=>(await M(e.whenLayerView(t),o)).elevationAlignPointsInFeatures(n,o);return m(s,{elevationInfo:t.elevationInfo,alignPointsInFeatures:i})}get _snappingElevationFilter(){const{view:e}=this,t=e!=null&&e.type==="3d"&&this.layerSource.layer.type!=="map-notes";return T(t)}get _symbologySnappingFetcher(){const{view:e}=this,{layer:t}=this.layerSource,s=e!=null&&e.type==="3d",i=this._extrudedPolygonSymbolsCount>0;return s&&t.type!=="map-notes"&&i?_(i,async(n,o)=>{const l=await e.whenLayerView(t);return c(o),l.queryForSymbologySnapping({candidates:n,spatialReference:e.spatialReference},o)}):_()}constructor(e){super(e),this.availability=1,this._sources={multipoint:null,point:null,polygon:null,polyline:null},this._loadedWkids=new Set,this._loadedWkts=new Set,this._pendingAdds=[],this._extrudedPolygonSymbolsCount=0,this._updatingHandles=new S,this._memoizedMakeGetGroundElevation=w(D)}destroy(){for(const e of this._pendingAdds)e.task.abort();this._pendingAdds.length=0,this._mapSources(e=>this._destroySource(e)),this._updatingHandles.destroy()}initialize(){this._updatingHandles.add(()=>this.getGraphicsLayers(),s=>{this._updatingHandles.removeHandles(f);for(const i of s)this._addMany(i.graphics.toArray()),this.addHandles([i.on("graphic-update",n=>this._onGraphicUpdate(n)),this._updatingHandles.addOnCollectionChange(()=>i.graphics,n=>this._onGraphicsChanged(n))],f)},y);const{view:e}=this,{layer:t}=this.layerSource;e!=null&&e.type==="3d"&&t.type!=="map-notes"&&this.addHandles([e.elevationProvider.on("elevation-change",({context:s})=>{b(s,t.elevationInfo)&&this._snappingElevationAligner.notifyElevationSourceChange()}),k(()=>t.elevationInfo,()=>this._snappingElevationAligner.notifyElevationSourceChange(),y),E(()=>t,["edits","apply-edits","graphic-update"],()=>this._symbologySnappingFetcher.notifySymbologyChange())])}async fetchCandidates(e,t){const{point:s,coordinateHelper:{spatialReference:i}}=e,n=await F(this._mapSources(d=>this._fetchCandidatesForSource(d,e,t)));c(t);const o=this._memoizedMakeGetGroundElevation(this.view,i),l=n.flat().map(d=>J(d,o));return C(s,l),l}async _fetchCandidatesForSource(e,t,s){var u;const i=P(t,((u=this.view)==null?void 0:u.type)??"2d"),n=await e.queryEngine.executeQueryForSnapping(i,s);c(s);const o=await this._snappingElevationAligner.alignCandidates(n.candidates,t.coordinateHelper.spatialReference,s);c(s);const l=await this._symbologySnappingFetcher.fetch(o,s);c(s);const d=l.length===0?o:[...o,...l];return this._snappingElevationFilter.filter(i,d)}refresh(){}_onGraphicUpdate(e){if(this.getGraphicsLayers().some(t=>t.graphics.includes(e.graphic)))switch(e.property){case"geometry":case"visible":this._remove(e.graphic),this._addMany([e.graphic])}}_onGraphicsChanged(e){for(const t of e.removed)this._remove(t);this._addMany(e.added)}_addMany(e){const t=[],s=new Map;for(const i of e)i.geometry!=null&&(this._needsInitializeProjection(i.geometry.spatialReference)?(t.push(i.geometry.spatialReference),s.set(i.uid,i)):this._add(i));this._createPendingAdd(t,s)}_createPendingAdd(e,t){if(!e.length)return;const s=A(async o=>{await G(e.map(l=>({source:l,dest:this.spatialReference})),{signal:o}),this._markLoadedSpatialReferences(e);for(const[,l]of t)this._add(l)});this._updatingHandles.addPromise(s.promise);const i={task:s,graphics:t},n=()=>W(this._pendingAdds,i);s.promise.then(n,n),this._pendingAdds.push(i)}_markLoadedSpatialReferences(e){for(const t of e){t.wkid!=null&&this._loadedWkids.add(t.wkid);const s=t.wkt2||t.wkt;s&&this._loadedWkts.add(s)}}_add(e){if(e.geometry==null||!e.visible)return;let t=e.geometry;if(t.type==="mesh")return;t.type==="extent"&&(t=H.fromExtent(t));const s=this._ensureSource(t.type);if(s==null)return;const i=this._createOptimizedFeature(e.uid,t);i!=null&&(s.featureStore.add(i),g(e.symbol)&&this._extrudedPolygonSymbolsCount++)}_needsInitializeProjection(e){if(e.wkid!=null&&this._loadedWkids.has(e.wkid))return!1;const t=e.wkt2||e.wkt;return(!t||!this._loadedWkts.has(t))&&!I(e,this.spatialReference)}_createOptimizedFeature(e,t){const s=$(j(t),this.spatialReference);if(!s)return null;const i=this._ensureGeometryHasZ(s),n=R(i,this._hasZ,!1);return new z(n,{[h]:e},null,e)}_ensureGeometryHasZ(e){if(!this._hasZ)return e;const t=i=>{for(;i.length<3;)i.push(0)},s=e.clone();switch(s.hasZ=!0,s.type){case"point":s.z=s.z??0;break;case"multipoint":s.points.forEach(t);break;case"polyline":s.paths.forEach(i=>i.forEach(t));break;case"polygon":s.rings.forEach(i=>i.forEach(t))}return s}_ensureSource(e){const t=this._sources[e];if(t!=null)return t;const s=this._createSource(e);return this._sources[e]=s,s}_createSource(e){const t=O.toJSON(e),s=this._hasZ,i=new N({geometryType:t,hasZ:s,hasM:!1});return{featureStore:i,queryEngine:new q({featureStore:i,fieldsIndex:x.fromLayerJSON({fields:[{name:h,type:"esriFieldTypeOID",alias:h}]}),geometryType:t,hasM:!1,hasZ:s,objectIdField:h,spatialReference:this.spatialReference,priority:Z.SNAPPING,scheduler:this.view!=null&&this.view.type==="3d"?this.view.resourceController.scheduler:null}),type:e}}_remove(e){this._mapSources(t=>this._removeFromSource(t,e));for(const t of this._pendingAdds)t.graphics.delete(e.uid),t.graphics.size===0&&t.task.abort()}_removeFromSource(e,t){const s=t.uid;e.featureStore.has(s)&&(e.featureStore.removeById(t.uid),g(t.symbol)&&this._extrudedPolygonSymbolsCount--)}_destroySource(e){e.queryEngine.destroy(),this._sources[e.type]=null}_mapSources(e){const{point:t,polygon:s,polyline:i,multipoint:n}=this._sources,o=[];return t!=null&&o.push(e(t)),s!=null&&o.push(e(s)),i!=null&&o.push(e(i)),n!=null&&o.push(e(n)),o}};r([p()],a.prototype,"getGraphicsLayers",void 0),r([p({constructOnly:!0})],a.prototype,"layerSource",void 0),r([p({constructOnly:!0})],a.prototype,"spatialReference",void 0),r([p({constructOnly:!0})],a.prototype,"view",void 0),r([p({readOnly:!0})],a.prototype,"updating",null),r([p({readOnly:!0})],a.prototype,"availability",void 0),r([p()],a.prototype,"_hasZ",null),r([p()],a.prototype,"_snappingElevationAligner",null),r([p()],a.prototype,"_snappingElevationFilter",null),r([p()],a.prototype,"_symbologySnappingFetcher",null),r([p()],a.prototype,"_extrudedPolygonSymbolsCount",void 0),a=r([L("esri.views.interactive.snapping.featureSources.GraphicsSnappingSource")],a);const h="OBJECTID";export{a as GraphicsSnappingSource}; diff --git a/dist/assets/GraphicsSnappingSource-FqTOI9A3.js b/dist/assets/GraphicsSnappingSource-FqTOI9A3.js deleted file mode 100644 index 0b6f7ae..0000000 --- a/dist/assets/GraphicsSnappingSource-FqTOI9A3.js +++ /dev/null @@ -1 +0,0 @@ -import{p as v,k as S,gD as w,P as y,gC as b,d as k,fl as E,gH as F,s as c,gI as C,gF as P,b as G,fd as A,l as I,gJ as g,ct as H,e1 as $,eU as R,eZ as O,fe as x,eQ as z,ai as Z,e as r,y as p,c as M,gG as L,gK as W}from"./index-J0iiHjMT.js";import{a as J}from"./normalizeUtilsSync-zfJiThlh.js";import{m as j}from"./FeatureStore-X-AIJLo2.js";import{W as q}from"./QueryEngine-8tLWlkSE.js";import{o as D,a as N}from"./queryEngineUtils-0F1SWi13.js";import{i as m,r as T,n as _}from"./symbologySnappingCandidates-Sz0MFOvR.js";import"./BoundsStore-wmwfHjhp.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./VertexSnappingCandidate-sgrBHAMS.js";import"./PointSnappingHint-ULetRXiW.js";const f="graphics-collections";let a=class extends v{get updating(){return this._updatingHandles.updating}get _hasZ(){const e=this.view;return e!=null&&e.type==="3d"&&this.layerSource.layer.type!=="map-notes"}get _snappingElevationAligner(){const{view:e}=this,{layer:t}=this.layerSource,s=e!=null&&e.type==="3d";if(!s||t.type==="map-notes")return m();const i=async(n,o)=>(await L(e.whenLayerView(t),o)).elevationAlignPointsInFeatures(n,o);return m(s,{elevationInfo:t.elevationInfo,alignPointsInFeatures:i})}get _snappingElevationFilter(){const{view:e}=this,t=e!=null&&e.type==="3d"&&this.layerSource.layer.type!=="map-notes";return T(t)}get _symbologySnappingFetcher(){const{view:e}=this,{layer:t}=this.layerSource,s=e!=null&&e.type==="3d",i=this._extrudedPolygonSymbolsCount>0;return s&&t.type!=="map-notes"&&i?_(i,async(n,o)=>{const l=await e.whenLayerView(t);return c(o),l.queryForSymbologySnapping({candidates:n,spatialReference:e.spatialReference},o)}):_()}constructor(e){super(e),this.availability=1,this._sources={multipoint:null,point:null,polygon:null,polyline:null},this._loadedWkids=new Set,this._loadedWkts=new Set,this._pendingAdds=[],this._extrudedPolygonSymbolsCount=0,this._updatingHandles=new S,this._memoizedMakeGetGroundElevation=w(D)}destroy(){for(const e of this._pendingAdds)e.task.abort();this._pendingAdds.length=0,this._mapSources(e=>this._destroySource(e)),this._updatingHandles.destroy()}initialize(){this._updatingHandles.add(()=>this.getGraphicsLayers(),s=>{this._updatingHandles.removeHandles(f);for(const i of s)this._addMany(i.graphics.toArray()),this.addHandles([i.on("graphic-update",n=>this._onGraphicUpdate(n)),this._updatingHandles.addOnCollectionChange(()=>i.graphics,n=>this._onGraphicsChanged(n))],f)},y);const{view:e}=this,{layer:t}=this.layerSource;e!=null&&e.type==="3d"&&t.type!=="map-notes"&&this.addHandles([e.elevationProvider.on("elevation-change",({context:s})=>{b(s,t.elevationInfo)&&this._snappingElevationAligner.notifyElevationSourceChange()}),k(()=>t.elevationInfo,()=>this._snappingElevationAligner.notifyElevationSourceChange(),y),E(()=>t,["edits","apply-edits","graphic-update"],()=>this._symbologySnappingFetcher.notifySymbologyChange())])}async fetchCandidates(e,t){const{point:s,coordinateHelper:{spatialReference:i}}=e,n=await F(this._mapSources(d=>this._fetchCandidatesForSource(d,e,t)));c(t);const o=this._memoizedMakeGetGroundElevation(this.view,i),l=n.flat().map(d=>N(d,o));return C(s,l),l}async _fetchCandidatesForSource(e,t,s){var u;const i=P(t,((u=this.view)==null?void 0:u.type)??"2d"),n=await e.queryEngine.executeQueryForSnapping(i,s);c(s);const o=await this._snappingElevationAligner.alignCandidates(n.candidates,t.coordinateHelper.spatialReference,s);c(s);const l=await this._symbologySnappingFetcher.fetch(o,s);c(s);const d=l.length===0?o:[...o,...l];return this._snappingElevationFilter.filter(i,d)}refresh(){}_onGraphicUpdate(e){if(this.getGraphicsLayers().some(t=>t.graphics.includes(e.graphic)))switch(e.property){case"geometry":case"visible":this._remove(e.graphic),this._addMany([e.graphic])}}_onGraphicsChanged(e){for(const t of e.removed)this._remove(t);this._addMany(e.added)}_addMany(e){const t=[],s=new Map;for(const i of e)i.geometry!=null&&(this._needsInitializeProjection(i.geometry.spatialReference)?(t.push(i.geometry.spatialReference),s.set(i.uid,i)):this._add(i));this._createPendingAdd(t,s)}_createPendingAdd(e,t){if(!e.length)return;const s=G(async o=>{await A(e.map(l=>({source:l,dest:this.spatialReference})),{signal:o}),this._markLoadedSpatialReferences(e);for(const[,l]of t)this._add(l)});this._updatingHandles.addPromise(s.promise);const i={task:s,graphics:t},n=()=>W(this._pendingAdds,i);s.promise.then(n,n),this._pendingAdds.push(i)}_markLoadedSpatialReferences(e){for(const t of e){t.wkid!=null&&this._loadedWkids.add(t.wkid);const s=t.wkt2||t.wkt;s&&this._loadedWkts.add(s)}}_add(e){if(e.geometry==null||!e.visible)return;let t=e.geometry;if(t.type==="mesh")return;t.type==="extent"&&(t=I.fromExtent(t));const s=this._ensureSource(t.type);if(s==null)return;const i=this._createOptimizedFeature(e.uid,t);i!=null&&(s.featureStore.add(i),g(e.symbol)&&this._extrudedPolygonSymbolsCount++)}_needsInitializeProjection(e){if(e.wkid!=null&&this._loadedWkids.has(e.wkid))return!1;const t=e.wkt2||e.wkt;return(!t||!this._loadedWkts.has(t))&&!H(e,this.spatialReference)}_createOptimizedFeature(e,t){const s=$(J(t),this.spatialReference);if(!s)return null;const i=this._ensureGeometryHasZ(s),n=R(i,this._hasZ,!1);return new O(n,{[h]:e},null,e)}_ensureGeometryHasZ(e){if(!this._hasZ)return e;const t=i=>{for(;i.length<3;)i.push(0)},s=e.clone();switch(s.hasZ=!0,s.type){case"point":s.z=s.z??0;break;case"multipoint":s.points.forEach(t);break;case"polyline":s.paths.forEach(i=>i.forEach(t));break;case"polygon":s.rings.forEach(i=>i.forEach(t))}return s}_ensureSource(e){const t=this._sources[e];if(t!=null)return t;const s=this._createSource(e);return this._sources[e]=s,s}_createSource(e){const t=x.toJSON(e),s=this._hasZ,i=new j({geometryType:t,hasZ:s,hasM:!1});return{featureStore:i,queryEngine:new q({featureStore:i,fieldsIndex:z.fromLayerJSON({fields:[{name:h,type:"esriFieldTypeOID",alias:h}]}),geometryType:t,hasM:!1,hasZ:s,objectIdField:h,spatialReference:this.spatialReference,priority:Z.SNAPPING,scheduler:this.view!=null&&this.view.type==="3d"?this.view.resourceController.scheduler:null}),type:e}}_remove(e){this._mapSources(t=>this._removeFromSource(t,e));for(const t of this._pendingAdds)t.graphics.delete(e.uid),t.graphics.size===0&&t.task.abort()}_removeFromSource(e,t){const s=t.uid;e.featureStore.has(s)&&(e.featureStore.removeById(t.uid),g(t.symbol)&&this._extrudedPolygonSymbolsCount--)}_destroySource(e){e.queryEngine.destroy(),this._sources[e.type]=null}_mapSources(e){const{point:t,polygon:s,polyline:i,multipoint:n}=this._sources,o=[];return t!=null&&o.push(e(t)),s!=null&&o.push(e(s)),i!=null&&o.push(e(i)),n!=null&&o.push(e(n)),o}};r([p()],a.prototype,"getGraphicsLayers",void 0),r([p({constructOnly:!0})],a.prototype,"layerSource",void 0),r([p({constructOnly:!0})],a.prototype,"spatialReference",void 0),r([p({constructOnly:!0})],a.prototype,"view",void 0),r([p({readOnly:!0})],a.prototype,"updating",null),r([p({readOnly:!0})],a.prototype,"availability",void 0),r([p()],a.prototype,"_hasZ",null),r([p()],a.prototype,"_snappingElevationAligner",null),r([p()],a.prototype,"_snappingElevationFilter",null),r([p()],a.prototype,"_symbologySnappingFetcher",null),r([p()],a.prototype,"_extrudedPolygonSymbolsCount",void 0),a=r([M("esri.views.interactive.snapping.featureSources.GraphicsSnappingSource")],a);const h="OBJECTID";export{a as GraphicsSnappingSource}; diff --git a/dist/assets/GraphicsView3D-6FUUKif_.js b/dist/assets/GraphicsView3D-o82vqKJR.js similarity index 81% rename from dist/assets/GraphicsView3D-6FUUKif_.js rename to dist/assets/GraphicsView3D-o82vqKJR.js index 134a541..4a71fe7 100644 --- a/dist/assets/GraphicsView3D-6FUUKif_.js +++ b/dist/assets/GraphicsView3D-o82vqKJR.js @@ -1 +1 @@ -import{m as i,n as p,e as s,y as t,o as a,c,p as h}from"./index-J0iiHjMT.js";import{O as n}from"./GraphicsProcessor-rh5nA4fc.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";let e=class extends i(h){constructor(r){super(r),this.processor=null,this.slicePlaneEnabled=!1,this.layer=new l}initialize(){this._set("processor",new n({owner:this}))}destroy(){this._set("processor",p(this.processor))}get graphics(){var r;return(r=this.view)==null?void 0:r.graphics}get loadedGraphics(){return this.graphics}get updating(){var r;return!!((r=this.processor)!=null&&r.updating)}get symbolUpdateType(){return this.processor.graphicsCore.symbolUpdateType}getHit(r){return this.processor.getHit(r)}whenGraphicBounds(r,o){return this.processor.whenGraphicBounds(r,o)}graphicChanged(r){this.processor.graphicsCore.graphicUpdateHandler(r)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}async queryGraphics(){return this.loadedGraphics}async fetchPopupFeatures(r,o){return(o==null?void 0:o.clientGraphics)??[]}highlight(r){return this.processor.highlight(r)}maskOccludee(r){return this.processor.maskOccludee(r)}};s([t({readOnly:!0})],e.prototype,"graphics",null),s([t()],e.prototype,"loadedGraphics",null),s([t({readOnly:!0})],e.prototype,"updating",null),s([t({constructOnly:!0})],e.prototype,"view",void 0),s([t()],e.prototype,"processor",void 0),s([t({type:Boolean})],e.prototype,"slicePlaneEnabled",void 0),s([t()],e.prototype,"layer",void 0),e=s([c("esri.views.3d.layers.GraphicsView3D")],e);class l extends a{constructor(){super(),this.type="graphics-view-3d-dummy",this.id=this.uid}}const v=e;export{v as default}; +import{a as i,b as p,e as s,y as t,o as a,c,g as h}from"./index-pCX-0tJH.js";import{O as n}from"./GraphicsProcessor-QBvSewdt.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";let e=class extends i(h){constructor(r){super(r),this.processor=null,this.slicePlaneEnabled=!1,this.layer=new l}initialize(){this._set("processor",new n({owner:this}))}destroy(){this._set("processor",p(this.processor))}get graphics(){var r;return(r=this.view)==null?void 0:r.graphics}get loadedGraphics(){return this.graphics}get updating(){var r;return!!((r=this.processor)!=null&&r.updating)}get symbolUpdateType(){return this.processor.graphicsCore.symbolUpdateType}getHit(r){return this.processor.getHit(r)}whenGraphicBounds(r,o){return this.processor.whenGraphicBounds(r,o)}graphicChanged(r){this.processor.graphicsCore.graphicUpdateHandler(r)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}async queryGraphics(){return this.loadedGraphics}async fetchPopupFeatures(r,o){return(o==null?void 0:o.clientGraphics)??[]}highlight(r){return this.processor.highlight(r)}maskOccludee(r){return this.processor.maskOccludee(r)}};s([t({readOnly:!0})],e.prototype,"graphics",null),s([t()],e.prototype,"loadedGraphics",null),s([t({readOnly:!0})],e.prototype,"updating",null),s([t({constructOnly:!0})],e.prototype,"view",void 0),s([t()],e.prototype,"processor",void 0),s([t({type:Boolean})],e.prototype,"slicePlaneEnabled",void 0),s([t()],e.prototype,"layer",void 0),e=s([c("esri.views.3d.layers.GraphicsView3D")],e);class l extends a{constructor(){super(),this.type="graphics-view-3d-dummy",this.id=this.uid}}const v=e;export{v as default}; diff --git a/dist/assets/GroupLayerView-Ck4zCvvf.js b/dist/assets/GroupLayerView-Ck4zCvvf.js new file mode 100644 index 0000000..5676079 --- /dev/null +++ b/dist/assets/GroupLayerView-Ck4zCvvf.js @@ -0,0 +1 @@ +import{e as t,y as a,fn as n,c as V,V as d,B as y,a9 as h,e8 as o}from"./index-pCX-0tJH.js";import{u as p}from"./LayerView-ixwLVnzr.js";let l=class extends p{constructor(i){super(i),this.type="group",this.layerViews=new d}destroy(){this.layerViews.length=0}_allLayerViewVisibility(i){this.layerViews.forEach(e=>{e.visible=i})}initialize(){this.addHandles([this.layerViews.on("change",i=>this._layerViewsChangeHandler(i)),y(()=>{var i;return(i=this.layer)==null?void 0:i.visibilityMode},()=>{this.layer&&this._applyVisibility(()=>this._allLayerViewVisibility(this.visible),()=>this._applyExclusiveVisibility(null))},h),y(()=>this.visible,i=>{this._applyVisibility(()=>this._allLayerViewVisibility(i),()=>{})},h)],"grouplayerview"),this._layerViewsChangeHandler({target:null,added:this.layerViews.toArray(),removed:[],moved:[]})}set layerViews(i){this._set("layerViews",o(i,this._get("layerViews")))}get updatingProgress(){return this.layerViews.length===0?1:this.layerViews.reduce((i,e)=>i+e.updatingProgress,0)/this.layerViews.length}isUpdating(){return this.layerViews.some(i=>i.updating)}_hasLayerViewVisibleOverrides(){return this.layerViews.some(i=>i._isOverridden("visible"))}_findLayerViewForLayer(i){return i&&this.layerViews.find(e=>e.layer===i)}_firstVisibleOnLayerOrder(){const i=this.layer.layers.find(e=>{const s=this._findLayerViewForLayer(e);return!!(s!=null&&s.visible)});return i&&this._findLayerViewForLayer(i)}_applyExclusiveVisibility(i){i==null&&(i=this._firstVisibleOnLayerOrder())==null&&this.layerViews.length>0&&(i=this._findLayerViewForLayer(this.layer.layers.at(0))),this.layerViews.forEach(e=>{e.visible=e===i})}_layerViewsChangeHandler(i){this.removeHandles("grouplayerview:visible"),this.addHandles(this.layerViews.map(s=>y(()=>s.visible,r=>this._applyVisibility(()=>{r!==this.visible&&(s.visible=this.visible)},()=>this._applyExclusiveVisibility(r?s:null)),h)).toArray(),"grouplayerview:visible");const e=i.added[i.added.length-1];this._applyVisibility(()=>this._allLayerViewVisibility(this.visible),()=>this._applyExclusiveVisibility(e!=null&&e.visible?e:null))}_applyVisibility(i,e){var s,r;this._hasLayerViewVisibleOverrides()&&(((s=this.layer)==null?void 0:s.visibilityMode)==="inherited"?i():((r=this.layer)==null?void 0:r.visibilityMode)==="exclusive"&&e())}};t([a({cast:n})],l.prototype,"layerViews",null),t([a({readOnly:!0})],l.prototype,"updatingProgress",null),t([a()],l.prototype,"view",void 0),l=t([V("esri.views.layers.GroupLayerView")],l);const v=l;export{v as default}; diff --git a/dist/assets/GroupLayerView-do80uFuS.js b/dist/assets/GroupLayerView-do80uFuS.js deleted file mode 100644 index e930671..0000000 --- a/dist/assets/GroupLayerView-do80uFuS.js +++ /dev/null @@ -1 +0,0 @@ -import{e as t,y as a,fs as n,c as d,V,d as y,C as h,ef as o}from"./index-J0iiHjMT.js";import{u as p}from"./LayerView-efDufa6j.js";let l=class extends p{constructor(i){super(i),this.type="group",this.layerViews=new V}destroy(){this.layerViews.length=0}_allLayerViewVisibility(i){this.layerViews.forEach(e=>{e.visible=i})}initialize(){this.addHandles([this.layerViews.on("change",i=>this._layerViewsChangeHandler(i)),y(()=>{var i;return(i=this.layer)==null?void 0:i.visibilityMode},()=>{this.layer&&this._applyVisibility(()=>this._allLayerViewVisibility(this.visible),()=>this._applyExclusiveVisibility(null))},h),y(()=>this.visible,i=>{this._applyVisibility(()=>this._allLayerViewVisibility(i),()=>{})},h)],"grouplayerview"),this._layerViewsChangeHandler({target:null,added:this.layerViews.toArray(),removed:[],moved:[]})}set layerViews(i){this._set("layerViews",o(i,this._get("layerViews")))}get updatingProgress(){return this.layerViews.length===0?1:this.layerViews.reduce((i,e)=>i+e.updatingProgress,0)/this.layerViews.length}isUpdating(){return this.layerViews.some(i=>i.updating)}_hasLayerViewVisibleOverrides(){return this.layerViews.some(i=>i._isOverridden("visible"))}_findLayerViewForLayer(i){return i&&this.layerViews.find(e=>e.layer===i)}_firstVisibleOnLayerOrder(){const i=this.layer.layers.find(e=>{const s=this._findLayerViewForLayer(e);return!!(s!=null&&s.visible)});return i&&this._findLayerViewForLayer(i)}_applyExclusiveVisibility(i){i==null&&(i=this._firstVisibleOnLayerOrder())==null&&this.layerViews.length>0&&(i=this._findLayerViewForLayer(this.layer.layers.at(0))),this.layerViews.forEach(e=>{e.visible=e===i})}_layerViewsChangeHandler(i){this.removeHandles("grouplayerview:visible"),this.addHandles(this.layerViews.map(s=>y(()=>s.visible,r=>this._applyVisibility(()=>{r!==this.visible&&(s.visible=this.visible)},()=>this._applyExclusiveVisibility(r?s:null)),h)).toArray(),"grouplayerview:visible");const e=i.added[i.added.length-1];this._applyVisibility(()=>this._allLayerViewVisibility(this.visible),()=>this._applyExclusiveVisibility(e!=null&&e.visible?e:null))}_applyVisibility(i,e){var s,r;this._hasLayerViewVisibleOverrides()&&(((s=this.layer)==null?void 0:s.visibilityMode)==="inherited"?i():((r=this.layer)==null?void 0:r.visibilityMode)==="exclusive"&&e())}};t([a({cast:n})],l.prototype,"layerViews",null),t([a({readOnly:!0})],l.prototype,"updatingProgress",null),t([a()],l.prototype,"view",void 0),l=t([d("esri.views.layers.GroupLayerView")],l);const v=l;export{v as default}; diff --git a/dist/assets/HeatmapDensity.glsl-de3m0xZZ.js b/dist/assets/HeatmapDensity.glsl-de3m0xZZ.js new file mode 100644 index 0000000..cfb6eb8 --- /dev/null +++ b/dist/assets/HeatmapDensity.glsl-de3m0xZZ.js @@ -0,0 +1,38 @@ +import{cf as ce,zA as _t,lK as _e,jb as fe,jS as ft,j$ as gt,jX as ge,zB as Ft,qb as D,zC as bt,R as H,e as n,y as o,c as M,g as q,bo as xt,fg as Et,bn as pe,ac as A,ev as vt,lB as wt,zD as Rt,zE as Tt,et as St,aL as U,ab as Fe,ex as Ct,F as ke,vL as Dt,zF as Ot,f2 as Vt,zG as It,rH as Q,V as L,rJ as k,j as Pt,K as z,ax as $t,ay as Mt,az as At,aB as Lt,cQ as Nt,h as ee,P as O,aj as Ht,r as P,b as $,bq as Be,I as le,aa as We,B as T,T as B,a9 as ue,jV as Gt,jW as qt,rt as zt,dv as Ut,ah as be,cP as jt,dE as xe,jY as Ee,dO as Qt,h6 as ve,f9 as kt,eL as Bt,dL as Wt,fN as Jt,dx as Zt,N as Xt,aE as Je,C as ye,aF as we,zH as Re,zI as Yt,aK as W,a0 as Y,aG as Kt,aH as ei,kb as ti,v as ii,r8 as si,cO as ri,aM as ai,aN as ni,xS as Ze,zu as oi,zJ as li,yD as Te,xQ as K,xR as N,y3 as Xe,de as Ye,y2 as he,y5 as Ke,y6 as et,yp as tt,y7 as it,y8 as ui,yd as st,v4 as hi,y4 as rt,yr as di,zK as ci,uP as Se,fv as Ce,zL as pi,zM as yi,vI as G,uR as mi,tG as _i,s5 as ie,zN as fi,zO as gi,xX as Fi,bi as v,yE as bi,zP as xi,va as De,yi as Ei,yj as vi,yf as wi,m3 as Ri,xT as Ti,hJ as Si,hC as Ci,yh as Di,ym as Oi,yN as Vi,a7 as Ii,v3 as J,uQ as I,zQ as Oe,oI as Pi,oC as $i,oD as Ve,gL as Mi,nQ as Ai,zR as Li,eT as Ni,j_ as Hi,eU as Gi,vJ as Ie,dY as qi,fp as Pe,d5 as zi,bj as Ui,zS as ji,bS as $e,ba as Qi,bR as ki,l8 as Bi,ft as Me,u9 as Wi,eV as Ae,a8 as Ji,gG as Zi,aJ as Xi}from"./index-pCX-0tJH.js";import{c as at}from"./dehydratedFeatureComparison-IJSogXWn.js";import{c as Yi,r as Ki}from"./queryForSymbologySnapping-MXWRIdj-.js";import{i as es}from"./hash-SS5GKVPY.js";import{F as ts,p as is,y as ss,s as rs,u as as,e as nt}from"./Graphics3DObjectStates-JUKhPt0b.js";import{W as ns}from"./QueryEngine-uvDs-vBe.js";import{m as os}from"./FeatureStore-PXMUgn0j.js";import{l as ls}from"./projectExtentUtils-Q4rXasWA.js";let us=class{get isReferenced(){return this.versions.length!==0}get isSingle(){return this.versions.length===1&&this.versions[0].refCount===1}constructor(e,t){this._highestResolutionVersion=null,this.versions=[],this.ref(e,t)}ref(e,t){const i=this.feature;x.oldVersion=i,this.feature&&Object.defineProperty(e,"uid",{value:this.feature.uid,configurable:!0});for(const a of this.versions)if(a.resolution===t){a.refCount++;const l=this._highestResolutionVersion===a&&!at(e,a.feature);return(l||this._highestResolutionVersion!==a)&&(a.feature=e),x.newVersion=l?e:i,x}const r={feature:e,resolution:t,refCount:1};return this.versions.push(r),!this._highestResolutionVersion||t0&&(this._refCount--,!this.isReferenced)?(x.newVersion=null,x):(x.newVersion=this._feature,x)}get feature(){return this._feature}};const x={oldVersion:null,newVersion:null},ds=16438,Le=new Set;let cs=class{get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(e){this._displayingFeatures=e,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){return!this.filtered&&(this.featuresMissing||this.features&&this.featureLimit!==this.features.length)}get features(){return this._features}get featureLimit(){return this._featureLimit}set featureLimit(e){this._featureLimit!==e&&(this._featureLimit=e,this._estimatedUnusedSizeDirty=!0)}get availableFields(){return this._availableFields}setFeatures(e,t,i){this._availableFields=i??Le,this._features=e,this._shuffled=!1,this._estimatedSize=-1,this._estimatedUnusedSizeDirty=!0,e&&e.length>0?(this._emptyFeatureRatio=t/(e.length+t),this._numVertices=e.reduce((r,a)=>r+_t(a.geometry),0)):(this._emptyFeatureRatio=0,this._numVertices=0)}get emptyFeatureRatio(){return this._emptyFeatureRatio}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures:this._features?this._features.length:0}set numFeatures(e){this._numFeatures=e}get hasPreciseFeatureCount(){return this._numFeatures>se}get needsFeatureCount(){return this._numFeatures===se}get numVertices(){return this._numVertices}constructor(e){this.descriptor=e,this.fetchStatus=f.FETCH_NEEDED,this._features=null,this._numVertices=0,this._featureLimit=0,this.featuresMissing=!0,this._shuffled=!1,this._numFeatures=se,this._emptyFeatureRatio=0,this._estimatedSize=-1,this._estimatedUnusedSize=0,this._estimatedUnusedSizeDirty=!1,this._availableFields=Le,this._displayingFeatures=null,this.alive=!0,this.filtered=!1}get id(){return this.descriptor.id}get estimatedSize(){return this.updateMemoryEstimates(),this._estimatedSize}get estimatedUnusedSize(){return this._estimatedUnusedSize}updateMemoryEstimates(){if(this._estimatedSize<0){if(this._estimatedSize=0,this._estimatedUnusedSize=0,this._features)for(let e=0;e=this.featureLimit&&(this._estimatedUnusedSize+=t)}return!0}if(this._estimatedUnusedSizeDirty){if(this._estimatedUnusedSize=0,this._estimatedUnusedSizeDirty=!1,this._features)for(let e=this.featureLimit;eD(t,e)-D(i,e)),bt(this._features,ds),this._shuffled=!0,this._estimatedUnusedSizeDirty=!0}reduceFeatures(e,t,i){if(e<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let r=!1;this.featureLimit=Math.ceil(this.numFeatures*e),this.featureLimit>this._features.length&&(this.featureLimit=this._features.length,this.fetchStatus===f.DONE&&this._features.length>0&&(this.fetchStatus=f.REFETCH_NEEDED,r=!0)),!this._shuffled&&e<1&&this._shuffle(i);const a=Math.max(this.featureLimit,Math.ceil(t*this.numFeatures));return this._features.length>a&&(this._features.length=a,this.featuresMissing=!0,this.fetchStatus===f.FULL&&(this.fetchStatus=f.DONE)),r}get cache(){return{availableFields:this._availableFields,features:this._features,numFeatures:this._numFeatures,emptyFeatureRatio:this._emptyFeatureRatio,fetchStatus:this.fetchStatus,featuresMissing:this.featuresMissing}}set cache(e){this.requestController=null,this._availableFields=e.availableFields,this._features=e.features,this._numFeatures=e.numFeatures,this._emptyFeatureRatio=e.emptyFeatureRatio,this.fetchStatus=e.fetchStatus,this.featuresMissing=e.featuresMissing,this._estimatedSize=-1,this._estimatedUnusedSizeDirty=!0}};const se=-1,ps=-2;var f;function ys(s,e,t){if(e==null||s==null||t!==e.length||t>s.length)return!1;for(let i=0;ie+=t.estimatedUnusedSize),e}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void Z.error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||t!=null&&e&&t.equals(e))return;const i=e!=null?e.clone():null;this._set("filterExtent",i),this._reclip(i,t)}constructor(e){super(e),this._useTileCount=!1,this.updating=!1,this.running=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._frameTask=xt,this._dirty=!1,this._featureTiles=new Map,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._suspended=!0,this._pendingEdits=null}initialize(){this.addHandles(Et(()=>this.tileDescriptors,"change",()=>this._setDirty(),{onListenerAdd:()=>this._setDirty()})),this._objectIdField=this.context.objectIdField,this.FeatureReferenceClass=this.context.capabilities.supportsMultipleResolutions?us:hs;const e=this.context.scheduler;e!=null&&(this._frameTask=e.registerTask(pe.FEATURE_TILE_FETCHER,this)),this._setDirty()}destroy(){var e;this._frameTask.remove(),this._featureTiles.forEach(t=>{this._cancelFetchTile(t),this._removeTile(t)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),(e=this._pendingEdits)==null||e.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||(this._setDirty(),this._updated())}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(i=>{t.availableFields.has(i)||e.delete(i)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this._pendingEdits;t.count++;const i=t.edits.then(()=>e.result.catch(r=>{if(A(r))throw r;return null}).then(r=>r&&(this._applyEditsDeleteFeatures(r.deletedFeatures),this._applyEditsAddUpdateFeatures(r.addedFeatures,r.updatedFeatures,t.controller.signal).then(()=>r))).then(r=>(--t.count==0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._unpause(),this._updated()),r)));return t.edits=i,this._updated(),i}_applyEditsDeleteFeatures(e){if(e.length===0)return;const t=this.context.globalIdField,i=t&&this.availableFields.has(t),r=new Set,a=this._objectIdField;e.forEach(({objectId:l,globalId:u})=>{(!l||l<0)&&t&&u&&(i||Z.errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),l=this._objectIdFromGlobalId(u,a,t)),l!=null&&l>=0&&r.add(l)}),this._featureTiles.forEach(l=>{if(!l.features)return;const u=l.features.filter(d=>!r.has(D(d,this._objectIdField)));u.length!==l.features.length&&(l.setFeatures(u,0,l.availableFields),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,i){if(e==null)return null;const r=this.features.find(a=>{var l;return((l=a.attributes)==null?void 0:l[i])===e});return r?D(r,t):null}async _applyEditsAddUpdateFeatures(e,t,i){const{objectIdField:r,globalIdField:a}=this.context,l=a&&this.availableFields.has(a),u=new Set,d=new Set;for(const y of e){const h=y.objectId;h!=null&&u.add(h)}for(const{objectId:y,globalId:h}of t){let _=y;(_==null||_<0)&&a&&(l||Z.errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),_=this._objectIdFromGlobalId(h,r,a)),_!=null&&_>=0&&(u.add(_),d.add(_))}if(u.size===0)return;const c=[];this._featureTiles.forEach(y=>{const h=this._applyEditsAddUpdateTile(y,u,d,i);h&&c.push(h)}),await Promise.allSettled(c)}async _applyEditsAddUpdateTile(e,t,i,r){if(!e.features)return;const a=this._createQuery(e);a.resultType=void 0,a.cacheHint=!1,a.objectIds=Array.from(t);const l=await this._queryFeatures(a,r);let u=null;if(i.size>0){const d=e.features.filter(c=>!i.has(D(c,this._objectIdField)));d.length!==e.features.length&&(u=d)}if(l.features.length>0){u||(u=e.features.slice());for(const d of l.features)u.push(d)}u&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,u.length)),e.setFeatures(u,0,He(e.availableFields,l.fields)),this._invalidateCounts())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:Fs})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){if(this._frameTask.processQueue(e),!this._dirty||!this.initialized)return;this._dirty=!1;const t=this._getListOfTiles();if(this._markTilesNotAlive(t),!e.run(()=>this._addTiles(t,e))||!e.run(()=>this._filterExtentTiles(t,e))||!e.run(()=>this._removeTiles(t,e))||e.done)return void this._setDirty();const i=this._sortTiles(t);e.run(()=>this._showTiles(i,e))&&e.run(()=>this._fetchTiles(i,e))&&e.run(()=>this._updateMemoryEstimates(i,e))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!(this._suspended||!this.tileDescriptors)&&(this.tileDescriptors.forEach(i=>{const r=this._featureTiles.get(i.id);r?r.alive=!0:t.done||(e.push(this._addTile(i)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(const i of e){if(t.done)break;i.alive&&(i.filtered=!i.intersects(this.filterExtent),i.filtered&&(this._clearTile(i),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let i=e.length-1;i>=0&&!t.done;i--){const r=e[i];r.alive||(this._removeTile(r),i!==e.length-1&&(e[i]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((t,i)=>(t.descriptor.loadPriority??0)-(i.descriptor.loadPriority??0)),e}_showTiles(e,t){const i=this._updateRatio(e),r=a=>{const l=this._fullRatio<1?i(a)*this._farRatio:1;return a.reduceFeatures(l,this.memoryFactor,this._objectIdField)&&this._setDirty(),this._showTile(a)};for(const a of e)if(!t.run(()=>r(a))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let i=!1;for(const r of e){if(!r.needsFetching)continue;const a=this.context.memoryCache!=null?this.context.memoryCache.pop(r.id):null;if(a==null){if(this._needsNumFeatures(r)){const l=new AbortController,u=this._fetchTileCount(r,l.signal);this._handleRequest(r,u,l,()=>r.numFeatures=ps),i=!0,t.madeProgress()}if(t.done)return!0}else r.cache=a,this._setDirty(),this._scheduleUpdated(),t.madeProgress()}if(i)return t.hasProgressed;for(const r of e)if(r.needsFetching){const a=new AbortController,l=this._fetchTile(r,a.signal);if(this._handleRequest(r,l,a,u=>{r.setFeatures([],0,null),this._invalidateCounts(),r.featuresMissing=!1,this.context.logFetchError(Z,u)}),t.madeProgress())return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(i=>!t.run(()=>i.updateMemoryEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;const i=new Array;this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,Ge),r.intersectionIncludingBorrowed(e,qe),vt(Ge,qe)||i.push(r))}),this._refreshDisplayingFeatures(i),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,i=this._changes.updates;for(const r of e)if(r.displayingFeatures!=null)for(const a of r.displayingFeatures){const l=D(a,this._objectIdField);if(t.has(l))continue;t.add(l);const u=this._displayingFeatureReferences.get(l).feature;i.removes.push(u),i.adds.push(u)}this._applyChanges()}_updated(){let e=0;this._paused||this._featureTiles.forEach(i=>i.isFetching?++e:0);const t=this._dirty||!!this._pendingEdits||e>0;if(this._set("running",this._dirty),this._set("updating",t),t){let i=0,r=0,a=0,l=0,u=0;const d=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(h=>{if(++r,h.isFetching&&h.hasPreciseFeatureCount){const _=this._maximumFeaturesForTile(h)*(1-h.emptyFeatureRatio),b=h.displayingFeatures!=null?h.displayingFeatures.length*d:0;u+=_-b}h.needsFetching?++l:h.numFeatures>0&&(++a,i+=h.numFeatures)}),l+=e;let c=0,y=0;i?(y=i,c=Math.min(l*i/a,i)):(y=r,c=l),u=Math.min(this.maximumNumberOfFeatures-this.features.length,u),this._set("updatingTotal",y),this._set("updatingRemaining",c),this._set("expectedFeatureDiff",u)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger&&this.debugger.update()}_updateMaximumNumberOfFeaturesExceeded(){const e=wt(this._featureTiles,t=>t.perTileMaximumNumberOfFeaturesExceeded);this._set("maximumNumberOfFeaturesExceeded",e)}_updateRatio(e){const t=ms(e),i=l=>1/(1<e&&this._featureTiles.forEach(i=>{if(!i.featuresMissing)return;const r=this._maximumFeaturesForTile(i);i.features&&(i.features.length>=r||i.fetchStatus===f.FULL)||(this._cancelFetchTile(i),this._resetFetchTile(i))}),this._setDirty())}_addTile(e){const t=new cs(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.descriptor.resolution;this._featureTiles.forEach(i=>{if(!(i.displayingFeatures==null||e===i||e.descriptor.lij&&i.descriptor.lij&&!Rt(e.descriptor.lij,i.descriptor.lij))){e.displayingFeatures==null&&(e.displayingFeatures=[]),e.descriptor.extent&&i.descriptor.extent&&(e.extentIncludingBorrowedFeatures==null&&(e.extentIncludingBorrowedFeatures=Tt(e.descriptor.extent)),St(e.extentIncludingBorrowedFeatures,i.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const r of i.displayingFeatures){e.displayingFeatures.push(r);const a=this._displayingFeatureReferences.get(D(r,this._objectIdField));a.ref(a.feature,t),this._numDisplayingFeatureReferences++}}}),e.featureLimit=e.displayingFeatures!=null?e.displayingFeatures.length:0}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetching&&(e.fetchStatus=f.DONE):e.fetchStatus=f.FETCH_NEEDED}_cancelFetchTile(e){const t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){return e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._getListOfTiles()),e.fetchStatus===f.REFETCHING?f.REFETCH_NEEDED:f.FETCH_NEEDED}async _fetchTile(e,t){const i=this._maximumFeaturesForTile(e);if(i<=0)return fs(e);const r=this._getMaxRecordCount(e),a=Math.ceil(i/r);if(re(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=i&&a>U.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const l=this._createQuery(e);if(l.maxRecordCountFactor=Math.ceil(i/r),e.isRefetching&&e.features&&e.features.length>0){const h=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);l.maxRecordCountFactor=Math.max(h+1,l.maxRecordCountFactor)}const{features:u,exceededTransferLimit:d,fields:c}=await this._queryFeatures(l,t),y=d?l.maxRecordCountFactor>=U.MAX_MAX_RECORD_COUNT_FACTOR?f.FULL:f.DONE:f.FULL;return await this._frameTask.schedule(()=>{e.featuresMissing=u.length{h&&(r+=y.num),l+=_.length,a+=this._removeEmptyFeatures(_),e.featuresMissing=r0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(i/r),e.num=Math.min(e.maxRecordCountFactor*r,i)):e.num=Math.min(r),!0)}_getEffectiveTileResolution(e){if(e.descriptor.resolution==null)return null;const t=this.context.viewingMode===ke.Global?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.descriptor.resolution,t)/this.lodFactor}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!=="point"}_setResolutionParams(e,t){if(!this._supportsResolution)return;const i=this._getEffectiveTileResolution(t);i!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new Dt({mode:"view",originPosition:"upper-left",tolerance:i,extent:this.context.fullExtent}):this.context.geometryType==="polyline"&&(e.maxAllowableOffset=i))}_removeEmptyFeatures(e){const t=e.length;for(let i=0;i0&&this.context.capabilities.supportsResultType?t:i!=null&&i>0?i:gs}_useTileQuery(e){return(!re(e)||!this.context.capabilities.supportsCacheHint)&&this.context.capabilities.supportsResultType}_handleRequest(e,t,i,r){e.fetchStatus=e.needsRefetching?f.REFETCHING:f.FETCHING,e.requestController=i;let a=!1;t.then(l=>{e.requestController=null,e.fetchStatus=l}).catch(l=>{e.requestController===i&&(e.requestController=null,e.fetchStatus=f.DONE),A(l)?a=!0:r(l)}).then(()=>{a||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles("scheduleUpdated")||this.addHandles(Vt(()=>{this.removeHandles("scheduleUpdated"),this._updated()}),"scheduleUpdated")}_showTile(e){if(e.displayingFeatures!=null&&!e.needsDisplayUpdate)return!1;const t=e.features;if(e.featureLimit===0||!t){const u=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],u}const i=e.descriptor.resolution,r=this._changes.updates,a=this._changes.adds,l=Math.min(e.featureLimit,t.length);e.featureLimit=l;for(let u=0;u0&&(this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this.features.addMany(e.adds),e.adds.length=0);const t=this._changes.adds,i=this._changes.removes,r=Math.min(t.length,i.length);let a=0;for(;ar&&this.features.addMany(a===0?t:t.slice(a)),i.length>r&&this.features.removeMany(a===0?i:i.slice(a)),t.length=0,i.length=0}_clearTile(e){if(this._hideTile(e),e.features&&this.context.memoryCache!=null){const t=16+e.estimatedSize;this.context.memoryCache.put(e.id,e.cache,t)}e.setFeatures(null,0,null),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}_getListOfTiles(){return Array.from(this._featureTiles.values())}get storedFeatures(){return this._getListOfTiles().reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return Array.from(this._featureTiles.values()).reduce((e,t)=>e+(t.needsFetching||t.isFetching?1:0),0)}_maximumFeaturesForTile(e){const t=e.hasPreciseFeatureCount?e.numFeatures:1/0,i=e.hasPreciseFeatureCount?t:this.maximumNumberOfFeatures,r=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(i*r/(1-e.emptyFeatureRatio)),t)}get test(){return{process:e=>this.runTask(e),getFeatureTileById:e=>this._featureTiles.get(e),forEachFeatureTile:e=>this._featureTiles.forEach(e)}}};function re(s){return s.id==="dummy-tile-full-extent"}function ms(s){let e=0;for(const t of s)t.features&&t.features.length>0&&t.alive&&(e=Math.max(e,t.descriptor.lij[0]));return e}function tr(s){const e=s.capabilities.query;return{supportsMultipleResolutions:_s(s),supportsPagination:!(!e||!e.supportsPagination),supportsResultType:!(!e||!e.supportsResultType),supportsCacheHint:!(!e||!e.supportsCacheHint),supportsQuantization:!(!e||!e.supportsQuantization),supportsQuantizationEditMode:!(!e||!e.supportsQuantizationEditMode),supportsMaxRecordCountFactor:!(!e||!e.supportsMaxRecordCountFactor),supportsFormatPBF:!(!e||!e.supportsFormatPBF)}}function _s(s){switch(s.geometryType){case"polyline":return!0;case"polygon":return s.capabilities&&s.capabilities.query&&s.capabilities.query.supportsQuantization;default:return!1}}function fs(s){return s.setFeatures([],0,null),s.featuresMissing=!1,f.DONE}function lt(s){return s==null?new Set:new Set(s.map(e=>e.name))}function He(s,e){if(s==null||e==null)return lt(e);const t=new Set;for(const{name:i}of e)s.has(i)&&t.add(i);return t}n([o({constructOnly:!0})],F.prototype,"features",void 0),n([o()],F.prototype,"tileDescriptors",void 0),n([o({value:1/0})],F.prototype,"maximumNumberOfFeatures",null),n([o({value:1})],F.prototype,"memoryFactor",null),n([o({value:1})],F.prototype,"lodFactor",null),n([o()],F.prototype,"useTileCount",null),n([o({readOnly:!0})],F.prototype,"updating",void 0),n([o({readOnly:!0})],F.prototype,"running",void 0),n([o({readOnly:!0})],F.prototype,"updatingTotal",void 0),n([o({readOnly:!0})],F.prototype,"updatingRemaining",void 0),n([o({readOnly:!0})],F.prototype,"expectedFeatureDiff",void 0),n([o({readOnly:!0})],F.prototype,"memoryForUnusedFeatures",null),n([o({readOnly:!0})],F.prototype,"maximumNumberOfFeaturesExceeded",void 0),n([o({readOnly:!0})],F.prototype,"totalVertices",null),n([o({readOnly:!0})],F.prototype,"totalFeatures",null),n([o()],F.prototype,"filterExtent",null),n([o({constructOnly:!0})],F.prototype,"context",void 0),F=n([M(ot)],F);const gs=2e3,Ge=ce(),qe=ce(),Fs=6e5,bs=200,xs=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];let Es=class{constructor(e,t,i){this._loadingGraphics=new Map,this._loadedGraphics=new Map,this._pendingGraphics=new Map,this._dataExtentGraphic=null,this._enabled=!0,this._tileFetcher=e,this._view=i,this._tilingScheme=new It(t),this._loadedSymbols=xs.map(r=>new Q({symbolLayers:new L([new k({material:{color:[r[0],r[1],r[2],.6]},outline:{color:"black",size:1}})])})),this._loadingSymbols=[new Q({symbolLayers:new L([new k({material:{color:[200,200,200,.4]},outline:{color:[30,30,30],size:1}})])})],this._pendingSymbols=[new Q({symbolLayers:new L([new k({material:{color:[100,100,100,.4]},outline:{color:[30,30,30],size:1}})])})],this._dataExtentSymbol=new Q({symbolLayers:new L([new k({material:{color:[0,0,0,0]},outline:{color:"green",size:4}})])})}destroy(){this.enabled=!1}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}update(){this._enabled?(this._synchronizeMaps(this._loadingGraphics,{filter:e=>e.isFetching,symbols:this._loadingSymbols}),this._synchronizeMaps(this._loadedGraphics,{filter:e=>!e.isFetching,symbols:this._loadedSymbols}),this._synchronizeMaps(this._pendingGraphics,{filter:e=>!e.isFetching,symbols:this._pendingSymbols}),this.showDataExtent(this._tileFetcher.filterExtent)):(this._loadingGraphics.forEach(e=>{this._view.graphics.removeMany(e)}),this._loadingGraphics.clear(),this._loadedGraphics.forEach(e=>{this._view.graphics.removeMany(e)}),this._loadedGraphics.clear(),this._pendingGraphics.forEach(e=>{this._view.graphics.removeMany(e)}),this._pendingGraphics.clear(),this._dataExtentGraphic&&(this._view.graphics.remove(this._dataExtentGraphic),this._dataExtentGraphic=null))}showDataExtent(e){if(this._dataExtentGraphic&&(this._view.graphics.remove(this._dataExtentGraphic),this._dataExtentGraphic=null),e==null)return;const t=Pt.fromExtent(e);this._dataExtentGraphic=new z({geometry:t,symbol:this._dataExtentSymbol}),this._view.graphics.add(this._dataExtentGraphic)}_synchronizeMaps(e,t){const i=[];e.forEach((r,a)=>{const l=this._tileFetcher.test.getFeatureTileById(a);l&&t.filter(l)||(this._view.graphics.removeMany(r),i.push(a))}),i.forEach(r=>e.delete(r)),this._tileFetcher.test.forEachFeatureTile(r=>{if(t.filter(r)&&!e.has(r.id)){const[a,l,u]=r.descriptor.lij;this._tilingScheme.ensureMaxLod(a);const d=this._tilingScheme.getExtentGeometry(a,l,u),c=[new z({geometry:d,symbol:t.symbols[a%t.symbols.length]}),new z({geometry:d.center,symbol:new $t({verticalOffset:new Mt({screenLength:40/.75}),callout:new At({color:"white",border:{color:"black"}}),symbolLayers:new L([new Lt({text:`${a}/${l}/${u}`,halo:{color:"white",size:1/.75},material:{color:"black"},size:16})])})})];e.set(r.id,c),this._view.graphics.addMany(c)}})}},g=class extends Nt(q){set extent(e){if(e!=null&&!e.spatialReference.equals(this.layerView.view.spatialReference))return void H.getLogger(this).error("#extent=","extent needs to be in the same spatial reference as the view");const t=this._get("extent");if(t===e||t!=null&&e&&t.equals(e))return;const i=e!=null?e.clone():null;this._set("extent",i)}get updating(){return!!(this._tileFetcher!=null&&this._tileFetcher.updating||this._fetchDataInfoPromise!=null||this.mode==="tiles"&&this.layerView.view.featureTiles&&this.layerView.view.featureTiles.updating||this._updatingHandles&&this._updatingHandles.updating)}get updatingTotal(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.expectedFeatureDiff:0}get memoryForUnusedFeatures(){return this._tileFetcher!=null?this._tileFetcher.memoryForUnusedFeatures:0}get maximumNumberOfFeaturesExceeded(){return!(this._tileFetcher==null||!this._tileFetcher.maximumNumberOfFeaturesExceeded)}get maximumNumberOfFeatures(){var e;return((e=this.displayFeatureLimit)==null?void 0:e.maximumNumberOfFeatures)??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome("maximumNumberOfFeatures",e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden("maximumNumberOfFeatures")}get mode(){var a,l;const e=this.layerView.layer;if(e.type==="feature"&&e.infoFor3D!=null)return"snapshot";if(this._forceTilesMode)return"tiles";const t=this.layerView.view;if(((l=(a=t.qualitySettings)==null?void 0:a.graphics3D)==null?void 0:l.snapshotAvailable)===!1||this.serviceDataCount===S.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return"tiles";const i=t&&t.featureTiles,r=i&&i.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&r){const u=this._approximateExtentSizeAtScale(e.minScale,r);if((this.serviceDataExtent.width/u+this.serviceDataExtent.height/u)/2>S.maxSnapshotMinScaleFactor)return"tiles"}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?"snapshot":"tiles"}get maxTotalSnapshotVertices(){var i;const e=this._get("maxTotalSnapshotVertices")||0,t=this.mode==="snapshot"&&((i=this._tileFetcher)==null?void 0:i.totalVertices)||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){const i=this.layerView.view,r=Math.ceil((i.width/t.pixelSize+i.height/t.pixelSize)/2),a=t.levels[0];return r*((a.tileSize[0]/(a.scale/e)+a.tileSize[1]/(a.scale/e))/2)}get tileDescriptors(){return this.mode==="snapshot"?new L([{id:"dummy-tile-full-extent",lij:[0,0,0]}]):this.layerView.view.featureTiles?this.layerView.view.featureTiles.tiles:new L}get test(){return{fetchDataInfoPromise:this._fetchDataInfoPromise,tileFetcher:this._tileFetcher}}constructor(e){super(e),this.type="feature-tile-3d",this._updatingHandles=new ee,this.serviceDataExtent=null,this.serviceDataCount=S.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add(()=>this.displayFeatureLimit,e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal))),this._updatingHandles.add(()=>this.mode,()=>this._modeChanged(),O),this._updatingHandles.add(()=>this.mode,(e,t)=>{e==="tiles"&&t==="snapshot"&&(this._forceTilesMode=!0)},O),this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){var t;const e=this.layerView.layer;if(e.type!=="ogc-feature"&&!((t=Ht(e))!=null&&t.operations.supportsQuery))throw new P("graphicscontroller:query-capability-required","Service requires query capabilities to be used as a feature layer",{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=$(this._tileFetcher),this._tilesHandle=Be(this._tilesHandle),this._lifeCycleAbortController=le(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set("_updatingHandles",null)}suspend(){this._suspended||(this._suspended=!0,this._tileFetcher!=null&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,this._tileFetcher!=null&&this._tileFetcher.resume())}restart(){const e=()=>{this._tileFetcher!=null&&this._tileFetcher.restart()};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}_refetch(e){const t=()=>{this._tileFetcher!=null&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){const e=this.layerView.view;if(!e)return;const t=We(()=>{var i;return(i=e.featureTiles)==null?void 0:i.tilingScheme},this._lifeCycleAbortController.signal);this._updatingHandles.addPromise(t),t.then(()=>{const{layerView:i,tileDescriptors:r}=this,a=i.layer,l=new F({context:this.context,filterExtent:this.extent,tileDescriptors:r,features:this.graphics});this._tileFetcher=l,this._suspended?this._tileFetcher.suspend():this._tileFetcher.resume();const u=this.layerView.view;u&&this.addHandles(T(()=>u.quality,h=>l.memoryFactor=h,B));const d=this.context.geometryType==="polygon"?"polygonLodFactor":this.context.geometryType==="polyline"?"polylineLodFactor":null;d&&this.addHandles(T(()=>{var h,_,b;return(b=(_=(h=this.layerView.view)==null?void 0:h.qualitySettings)==null?void 0:_.graphics3D)==null?void 0:b[d]},h=>l.lodFactor=h||1,O));const c=h=>{l.maximumNumberOfFeatures=h,l.useTileCount=this.serviceDataCount>h},y=h=>{l.useTileCount=h>this.maximumNumberOfFeatures};a.type!=="ogc-feature"&&this._updatingHandles.add(()=>a.createQueryVersion,()=>this._dataFilterChanged()),this._updatingHandles.add(()=>i.availableFields,(h,_)=>this._availableFieldsChanged(_,h)),this._updatingHandles.add(()=>i.requiredFields,(h,_)=>this._requiredFieldsChanged(_,h)),this.addHandles([a.on("apply-edits",h=>this._applyEdits(h)),T(()=>this.extent,h=>l.filterExtent=h,ue),T(()=>this.tileDescriptors,h=>l.tileDescriptors=h,ue),T(()=>this.maximumNumberOfFeatures,c,B),T(()=>this.serviceDataCount,y,B),T(()=>Gt.FEATURE_TILE_FETCH_SHOW_TILES,h=>{h&&l&&!l.debugger?(l.debugger=new Es(l,u.featureTiles.tilingScheme.toTileInfo(),u),l.debugger.update()):!h&&this._tileFetcher&&l.debugger&&(l.debugger.destroy(),l.debugger=null)},B)]),this._supportsExceedsLimitQuery||this._updatingHandles.add(()=>this.maxTotalSnapshotVertices,()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal)))}).catch(()=>{})}_modeChanged(){switch(this.mode){case"tiles":this._tilesHandle||(this._tilesHandle=this.layerView.view.featureTiles.addClient());break;default:H.getLogger(this).warn("Unhandled feature layer mode "+this.mode);case"snapshot":this._tilesHandle!=null&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set("maxTotalSnapshotVertices",0),this.notifyChange("maxTotalSnapshotVertices"),this._refetch({resetForceTilesMode:!0})}_applyEdits(e){this._tileFetcher!=null&&this._tileFetcher.applyEdits(e).then(t=>{if(t){if(!this._lifeCycleAbortController)throw qt();t.exceededTransferLimit?this.layerView.layer.refresh():(t.deletedFeatures.length||t.updatedFeatures.length||t.addedFeatures.length)&&this._updatingHandles.addPromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}}).catch(t=>{if(!A(t))throw t})}_availableFieldsChanged(e,t){this._tileFetcher!=null&&ze(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){this._tileFetcher!=null&&ze(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){var r;const t=this.layerView.layer,i=t.createQuery();return i.returnGeometry=!1,i.outStatistics=[new zt({statisticType:"exceedslimit",maxVertexCount:e,outStatisticFieldName:"exceedslimit",maxPointCount:1e8,maxRecordCount:1e8})],(r=t.capabilities)!=null&&r.query.supportsCacheHint&&(i.cacheHint=!0),i}_createDataInfoQuery(){var i;const e=this.layerView.layer,t=e.createQuery();return t.returnGeometry=!1,t.outSpatialReference=this.layerView.view.spatialReference,(i=e.capabilities)!=null&&i.query.supportsCacheHint&&(t.cacheHint=!0),t}_fullExtentIsAccurate(){const e=this.layerView.layer;if(e.definitionExpression)return!1;switch(e.type){case"feature":case"oriented-imagery":return Ut(e.url);case"csv":case"geojson":case"ogc-feature":case"wfs":return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(t){A(t)||this._set("serviceDataExtent",be(this.layerView.fullExtentInLocalViewSpatialReference))}}async _tryUpdateServiceDataExtent(e){var c;const t=this.layerView,i=t.layer,r=((c=i.capabilities)==null?void 0:c.query.supportsExtent)??!1,a=be(t.fullExtentInLocalViewSpatialReference),l=i.fullExtent,u=this._fullExtentIsAccurate(),d=this.serviceDataCount;if(r&&d<=S.maxFeatureCountForExtent&&(!a||!u)&&"queryExtent"in i){const y=this._createDataInfoQuery(),h=await i.queryExtent(y,{timeout:S.queryExtentTimeout,signal:e});this._set("serviceDataExtent",h.extent)}else if(a)this._set("serviceDataExtent",a);else if(l!=null){const y="portalItem"in i?i.portalItem:null,h=await jt(l,t.view.spatialReference,y,e);this._set("serviceDataExtent",h)}else this._set("serviceDataExtent",null)}async _updateServiceDataCount(e){const t=this.layerView.layer;if(!("queryFeatureCount"in t)||!xe("featurelayer-snapshot-enabled"))return void this._set("serviceDataCount",S.noServiceDataCount);const i=await Ee(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:S.queryStatisticsTimeout,signal:e}));if(i.ok===!0)this._set("serviceDataCount",i.value);else{if(A(i.error))throw i.error;this._set("serviceDataCount",S.noServiceDataCount)}}get _supportsExceedsLimitQuery(){const e=this.layerView.layer;return e.capabilities!=null&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case"point":case"multipoint":return 1;case"polygon":return 4;case"polyline":return 2;case"multipatch":case"mesh":return 3;default:return 0}}async _updateSnapshotLimit(e,t,i){if((e==null?void 0:e.averageSymbolComplexity)==null)return void(this._snapshotLimitExceeded=!1);const{maximumTotalNumberOfVertices:r,averageSymbolComplexity:a}=e,{verticesPerFeature:l,verticesPerCoordinate:u}=a,d=l<=0,c=this._minimumNumberOfVerticesForGeometry>1;if(!d&&!c)return void(this._snapshotLimitExceeded=!1);l!==0&&t!=null&&await t;const y=Math.min(r,ws),h=this.serviceDataCount,_=h!==S.noServiceDataCount;let b=Math.ceil(_?(y-h*l)/(u||1):y/(u||1));if(c&&(b=Math.min(b,Ss)),_&&this._minimumNumberOfVerticesForGeometry*h>b)return void(this._snapshotLimitExceeded=!0);if(!this._supportsExceedsLimitQuery||!xe("featurelayer-snapshot-enabled"))return void(this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>b);const w=await Ee(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(b),{timeout:S.queryStatisticsTimeout,signal:i}));if(w.ok===!1){if(A(w.error))throw w.error;return void(this._snapshotLimitExceeded=!1)}const C=w.value.features[0];this._snapshotLimitExceeded=!!(C!=null&&C.attributes)&&!!C.attributes.exceedslimit}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo();let e=new AbortController;const t=e.signal,i=this._updateServiceDataCount(t),r=Promise.allSettled([i,this._updateSnapshotLimit(this.displayFeatureLimit,i,t)]),a=r.then(()=>this._updateServiceDataExtent(t)).catch(l=>{A(l)||H.getLogger(this).error("#fetchServiceDataInfo()",l)}).then(()=>{a===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null});return e&&(this._fetchDataInfoPromise=a),this._fetchDataInfoAbortController=e,r.then(()=>{},()=>{})}_cancelFetchServiceDataInfo(){const e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){var e,t,i,r;return{storedFeatures:((e=this._tileFetcher)==null?void 0:e.storedFeatures)??0,totalFeatures:((t=this._tileFetcher)==null?void 0:t.totalFeatures)??0,totalVertices:((i=this._tileFetcher)==null?void 0:i.totalVertices)??0,missingTiles:((r=this._tileFetcher)==null?void 0:r.missingTiles)??0}}};n([o({readOnly:!0})],g.prototype,"type",void 0),n([o({constructOnly:!0})],g.prototype,"graphics",void 0),n([o({constructOnly:!0})],g.prototype,"layerView",void 0),n([o({constructOnly:!0})],g.prototype,"context",void 0),n([o()],g.prototype,"extent",null),n([o()],g.prototype,"updating",null),n([o({readOnly:!0})],g.prototype,"_updatingHandles",void 0),n([o()],g.prototype,"updatingTotal",null),n([o()],g.prototype,"updatingRemaining",null),n([o()],g.prototype,"expectedFeatureDiff",null),n([o()],g.prototype,"memoryForUnusedFeatures",null),n([o()],g.prototype,"maximumNumberOfFeaturesExceeded",null),n([o({readOnly:!0})],g.prototype,"serviceDataExtent",void 0),n([o({readOnly:!0})],g.prototype,"serviceDataCount",void 0),n([o()],g.prototype,"_snapshotLimitExceeded",void 0),n([o()],g.prototype,"displayFeatureLimit",void 0),n([o({type:Number})],g.prototype,"maximumNumberOfFeatures",null),n([o()],g.prototype,"_forceTilesMode",void 0),n([o({readOnly:!0})],g.prototype,"mode",null),n([o({readOnly:!0})],g.prototype,"maxTotalSnapshotVertices",null),n([o({readOnly:!0})],g.prototype,"tileDescriptors",null),n([o()],g.prototype,"_tileFetcher",void 0),n([o()],g.prototype,"_fetchDataInfoPromise",void 0),g=n([M("esri.layers.graphics.controllers.FeatureTileController3D")],g);const vs=1e4,ws=1e6,Rs=12e3,Ts=1e4,Ss=5e6;function ze(s,e){if(!e)return!1;for(const t of e)if(!s.has(t))return!0;return!1}var S;(function(s){function e(){s.maxFeatureCountForExtent=vs,s.queryStatisticsTimeout=Rs,s.queryExtentTimeout=Ts}s.noServiceDataCount=1/0,s.maxSnapshotMinScaleFactor=5,s.reset=e})(S||(S={})),S.reset();function Ue(s,e,t){if(!t||e==null)return null;if(!s)return Cs(e,t);const i=s.get(t);return i?e[i.name]:null}function Cs(s,e){const t=e.toLowerCase();for(const i in s)if(i.toLowerCase()===t)return s[i];return null}const Ds=ns;let V=class extends q{get layer(){return this.context.layer}get spatialReference(){return this.context.spatialReference}get _queryGeometryType(){switch(this.layer.geometryType){case"multipoint":case"point":case"polygon":case"polyline":return this.layer.geometryType;case"mesh":return"polygon";default:return}}get defaultQueryJSON(){return new U({outSpatialReference:this.spatialReference}).toJSON()}get _dataQueryEngine(){return this._ensureDataQueryEngine()}constructor(e){super(e),this._dataQueryEngineInstance=null}destroy(){this.clear()}clear(){return!!this._dataQueryEngineInstance&&(this._dataQueryEngineInstance.destroy(),this._dataQueryEngineInstance=null,!0)}async executeQueryForIdSet(e,t,i){return this._dataQueryEngine.executeQueryForIdSet(this._ensureQueryJSON(e,t),i)}async executeQueryForCount(e,t){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),t)}async executeQueryForExtent(e,t){const{count:i,extent:r}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:i,extent:Qt.fromJSON(r)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQueryForLatestObservations(e,t){const i=await this._dataQueryEngine.executeQueryForLatestObservations(this._ensureQueryJSON(e),t),r=ve.fromJSON(i);return r.features.forEach(a=>{a.layer=this.layer,a.sourceLayer=this.layer}),r}async executeQuery(e,t){const i=await this._dataQueryEngine.executeQuery(this._ensureQueryJSON(e),t),r=ve.fromJSON(i);return r.features.forEach(a=>{a.layer=this.layer,a.sourceLayer=this.layer}),r}_ensureQueryJSON(e,t){let i=this.defaultQueryJSON;if(e!=null&&("outSpatialReference"in e&&!e.outSpatialReference&&(e.outSpatialReference=this.spatialReference),i=e.toJSON()),t!=null){const r=t.geometries.map(a=>a.toJSON()).reduce((a,l)=>(a.rings=a.rings.concat(l.rings),a));i={...i,sceneFilter:{...t,geometry:r}}}return i}_ensureDataQueryEngine(){var h,_;if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e="timeInfo"in this.layer&&((h=this.layer.timeInfo)==null?void 0:h.toJSON())||null,t=this.layer.objectIdField,i=kt.toJSON(this._queryGeometryType),r=((_=this.layer.fieldsIndex)==null?void 0:_.toJSON())||new Bt([]),a=this.priority,l=this.spatialReference.toJSON(),{hasZ:u,hasM:d,featureStore:c,scheduler:y}=this.context;return this._dataQueryEngineInstance=new Ds({hasZ:u,hasM:d,geometryType:i,fieldsIndex:r,timeInfo:e,spatialReference:l,objectIdField:t,featureStore:c,scheduler:y,priority:a}),this._dataQueryEngineInstance}};n([o({constructOnly:!0})],V.prototype,"context",void 0),n([o({constructOnly:!0})],V.prototype,"priority",void 0),n([o()],V.prototype,"layer",null),n([o()],V.prototype,"spatialReference",null),n([o()],V.prototype,"_queryGeometryType",null),n([o()],V.prototype,"defaultQueryJSON",null),V=n([M("esri.views.3d.layers.graphics.QueryEngine")],V);let E=class extends q{constructor(s){super(s),this._updateTask=null,this._frameTask=null,this._queryEngine=null,this._updateRequested=!0,this._updatingHandles=new ee,this._updateVisibility=async e=>{if(this._compositedFeatureFilter==null&&this._sceneFilter==null||this.context.getFeatureCount()===0)return this._frameTask.schedule(()=>this.clear(),e);try{const t=await this._queryEngine.executeQueryForIdSet(this._compositedFeatureFilter,this._sceneFilter,e);return this._frameTask.schedule(()=>{this.context.updateFeatureVisibilities(i=>t.has(i))},e)}catch(t){return Wt(t),H.getLogger(this).warn(`FeatureFilter query failed: ${t}`,{error:t}),this._frameTask.schedule(()=>{this.context.setAllFeaturesVisibility(!0)},e)}}}initialize(){const s=pe.FILTER_VISIBILITY,{layer:e,view:t}=this._layerView,{featureStore:i}=this.context,r="hasZ"in this._layerView&&this._layerView.hasZ,a="hasM"in this._layerView&&this._layerView.hasM;this._queryEngine=new V({context:{spatialReference:t.spatialReference,layer:e,scheduler:t.resourceController.scheduler,featureStore:i,hasM:a,hasZ:r},priority:s}),this._frameTask=this._layerView.view.resourceController.scheduler.registerTask(s,this),this._updatingHandles.add(()=>[this._compositedFeatureFilter,this._sceneFilter],()=>this.reapply(),O)}destroy(){this._updateRequested=!1,this._updatingHandles.destroy(),this.clear(),this._updateTask=le(this._updateTask),this._frameTask=Be(this._frameTask),this._queryEngine=$(this._queryEngine),this._set("context",null)}get updating(){return this.running||this._updatingHandles.updating||this._updateTask!=null&&!this._updateTask.finished}get running(){return this._updateRequested||this._frameTask.updating}get defaultVisibility(){return this._compositedFeatureFilter==null&&this._sceneFilter==null}get _featureFilter(){return"filter"in this._layerView?this._layerView.filter:null}get _sceneFilter(){return"layerFilter"in this._layerView?this._layerView.layerFilter:null}get _floorFilter(){return Jt(this._layerView)}get _timeExtent(){return"timeExtent"in this._layerView?this._layerView.timeExtent:null}get _compositedFeatureFilter(){const{_featureFilter:s,_timeExtent:e,_floorFilter:t}=this;if(e==null&&t==null)return s;const i=s!=null?s.clone():new Zt;if(e!=null&&(i.timeExtent=i.timeExtent!=null?i.timeExtent.intersection(e):e),t!=null){const r=i.where==null||i.where==="";i.where=r?t:`(${i.where}) AND (${t})`}return i}get _layerView(){return this.context.layerView}reapply(){this._updateRequested=!0}clear(){this._queryEngine.clear(),this.context.clearFeaturesVisibility()}runTask(s){this._updateRequested&&(this._updateTask=le(this._updateTask),this._updateTask=Xt(this._updateVisibility),this._updateRequested=!1,s.madeProgress()),this._frameTask.processQueue(s)}};n([o({constructOnly:!0})],E.prototype,"context",void 0),n([o()],E.prototype,"updating",null),n([o()],E.prototype,"running",null),n([o()],E.prototype,"defaultVisibility",null),n([o()],E.prototype,"_featureFilter",null),n([o()],E.prototype,"_sceneFilter",null),n([o()],E.prototype,"_floorFilter",null),n([o()],E.prototype,"_timeExtent",null),n([o()],E.prototype,"_compositedFeatureFilter",null),n([o()],E.prototype,"_layerView",null),n([o()],E.prototype,"_updateTask",void 0),n([o()],E.prototype,"_updateRequested",void 0),E=n([M("esri.views.3d.layers.support.FeatureVisibilityFilter")],E);let m=class extends q{constructor(s){super(s),this.type="graphics-3d",this._randomRotationRenderers=null,this._updatingHandles=new ee,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=Je.Features,this.preferredUpdatePolicy=ye.ASYNC,this._suspendResumeExtent=null}initialize(){const s=this.owner,e=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&s.layer.geometryType!=="multipatch",t=new ts({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:s.hasZ,hasM:s.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:i=>s.view.deconflictor.addGraphicsOwner(i),labeler:(i,r)=>s.view.labeler.addGraphicsOwner(i,r),elevationAlignment:this.elevationAlignmentEnabled?(i,r)=>new is({graphicsCoreOwner:this,graphicsCore:i,queryGraphicUIDsInExtent:r,elevationProvider:s.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(i,r)=>new ss({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:r,graphicsCore:i,basemapTerrain:s.view.basemapTerrain}):null,filterVisibility:e?i=>new E({context:{layerView:s,...i}}):null,objectStates:i=>new rs(i)}});this._set("graphicsCore",t),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new as({graphicsCoreOwner:this})),this.elevationAlignment&&this._updatingHandles.add(()=>this.layer.elevationInfo,(i,r)=>{we(i,r)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())}),this._updatingHandles.add(()=>this.layer.labelsVisible,()=>this.graphicsCore.updateVisibilityInfo()),this._updatingHandles.add(()=>this.layer.labelingInfo,(i,r)=>{we(i,r)&&this.graphicsCore.updateLabelingInfo()}),this._updatingHandles.add(()=>this.preferredUpdatePolicy,i=>this.graphicsCore.preferredUpdatePolicy=i),this._set("initializePromise",this._initializeAsync()),this._updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){await Re(this.graphicsCore.initializePromise);const s=this.owner;this._updatingHandles.add(()=>this.renderer,e=>this._updatingHandles.addPromise(this.graphicsCore.rendererChange(e))),this._updatingHandles.add(()=>s.fullOpacity,()=>this.graphicsCore.opacityChange()),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this._updatingHandles.add(()=>s.view.clippingArea,()=>this._updateClippingExtent()),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await Re(this.graphicsCore.updateLabelingInfo())}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",$(this.frustumVisibility)),this._set("graphicsCore",$(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get renderer(){const{renderer:s,objectIdField:e}=this.layer;if(!s||!e||s.type==="heatmap"||!s.visualVariables)return s;const t=s.visualVariables.findIndex(r=>r.type==="rotation"&&r.valueExpression!=null&&Yt(r.valueExpression)===e&&(r.axis==null||r.axis==="heading")&&r.rotationType==="geographic");if(t<0)return s;const i=s.clone();return i.visualVariables.splice(t,1),this._randomRotationRenderers||(this._randomRotationRenderers=new WeakMap),this._randomRotationRenderers.set(i,e),i}get scaleVisibility(){var s;return(s=this.graphicsCore)==null?void 0:s.scaleVisibility}get filterVisibility(){var s;return(s=this.graphicsCore)==null?void 0:s.filterVisibility}get elevationAlignment(){var s;return(s=this.graphicsCore)==null?void 0:s.elevationAlignment}get objectStates(){var s;return(s=this.graphicsCore)==null?void 0:s.objectStates}get suspendResumeExtentMode(){return"suspendResumeExtentMode"in this.owner?this.owner.suspendResumeExtentMode:"computed"}get scaleVisibilitySuspended(){return this.scaleVisibility!=null&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return this.frustumVisibility==null||!this.frustumVisibility.suspended}get suspendInfo(){const s={};return this.scaleVisibilitySuspended&&(s.outsideScaleRange=!0),this.frustumVisibility!=null&&this.frustumVisibility.suspended&&(s.outsideOfView=!0),s}get updating(){var s,e;return!!((s=this.graphicsCore)!=null&&s.updating||(e=this.frustumVisibility)!=null&&e.updating||this._updatingHandles.updating)}get updatingRemaining(){var s;return((s=this.graphicsCore)==null?void 0:s.updatingRemaining)??0}get featureStore(){var s;return(s=this.graphicsCore)==null?void 0:s.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){var s;return(s=this.owner)==null?void 0:s.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){var s;return(s=this.graphicsCore)==null?void 0:s.graphics3DGraphics}get graphics3DGraphicsByObjectID(){var s;return(s=this.graphicsCore)==null?void 0:s.graphics3DGraphicsByObjectID}get symbolUpdateType(){var s;return(s=this.graphicsCore)==null?void 0:s.symbolUpdateType}get displayFeatureLimit(){var i;const s=this.view.quality,e=(i=this.graphicsCore)==null?void 0:i.displayFeatureLimit;if(s===1)return e;const t=Math.ceil(e.maximumNumberOfFeatures*s);return new nt(e.maximumTotalNumberOfVertices,t,e.averageSymbolComplexity)}get usedMemory(){var s;return((s=this.graphicsCore)==null?void 0:s.usedMemory)??0}get loadedFeatures(){var s;return((s=this.graphicsCore)==null?void 0:s.numberOfGraphics)??0}get usedMemoryPerFeature(){var s;return((s=this.graphicsCore)==null?void 0:s.usedMemoryPerGraphic)??0}get unprocessedMemoryEstimate(){var s;return((s=this.graphicsCore)==null?void 0:s.unprocessedMemoryEstimate)??0}get performanceInfo(){return{core:this.graphicsCore.performanceInfo,elevationUpdating:this.elevationAlignment.updating,visibilityFrustum:this.frustumVisibility==null||!this.frustumVisibility.suspended,visibilityScale:!this.scaleVisibilitySuspended}}maskOccludee(s){const{set:e,handle:t}=this.objectStates.acquireSet(W.MaskOccludee,null);return this.objectStates.setUid(e,s.uid),t}highlight(s,e){if(s instanceof U){const{set:t,handle:i}=this.objectStates.acquireSet(W.Highlight,e);return this.owner.queryObjectIds(s).then(r=>this.objectStates.setObjectIds(t,r)),i}if(typeof s=="number"||typeof s=="string")return this.highlight([s],e);if(s instanceof z)return this.highlight([s],e);if("toArray"in s&&(s=s.toArray()),Array.isArray(s)&&s.length>0){if(s[0]instanceof z){const t=s;if(Ue(this.layer.fieldsIndex,t[0].attributes,e)==null){const i=t.map(l=>l.uid),{set:r,handle:a}=this.objectStates.acquireSet(W.Highlight,null);return this.objectStates.setUids(r,i),a}s=t.map(i=>Ue(this.layer.fieldsIndex,i.attributes,e))}if(Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string")){const t=s,{set:i,handle:r}=this.objectStates.acquireSet(W.Highlight,e);return this.objectStates.setObjectIds(i,t),r}}return Y()}resetObjectStates(){this.objectStates.reset()}whenGraphicBounds(s,e){var t;return(t=this.graphicsCore)==null?void 0:t.whenGraphicBounds(s,e)}computeAttachmentOrigin(s,e){var t;return(t=this.graphicsCore)==null?void 0:t.computeAttachmentOrigin(s,e)}notifyGraphicGeometryChanged(s){this.graphicsCore.notifyGraphicGeometryChanged(s)}notifyGraphicVisibilityChanged(s){this.graphicsCore.notifyGraphicVisibilityChanged(s)}getRenderingInfo(s,e,t){var r;const i=Kt(s,{renderer:e,arcade:t});if(i!=null&&i.color){const a=i.color;a[0]=a[0]/255,a[1]=a[1]/255,a[2]=a[2]/255}if(i!=null&&e!=null&&((r=this._randomRotationRenderers)!=null&&r.has(e))){const a=this._randomRotationRenderers.get(e),l=s.attributes[a],u=new es(0);u.updateFloatArray([l]),u.updateUint8Array([173]),i.heading=8381e-11*u.digest()}return i}getRenderingInfoAsync(s,e,t,i){return ei(s,{renderer:e,arcade:t,...i})}getSymbolLayerSize(s,e){var t;return(t=this.graphicsCore)==null?void 0:t.getSymbolLayerSize(s,e)}setObjectIdVisibility(s,e){var t;(t=this.graphicsCore)==null||t.setObjectIdVisibility(s,e)}refreshFilter(){this.filterVisibility!=null&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(s){var e;return(e=this.graphicsCore)==null?void 0:e.getGraphics3DGraphicByObjectId(s)}_updateClippingExtent(){const s=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(s,this.owner.view.spatialReference)&&(this.updateClippingExtent(s)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.addHandles(T(()=>this.suspendResumeExtentMode,()=>{switch(this.removeHandles(ae),this.suspendResumeExtentMode){case"computed":this.addHandles([T(()=>this.graphicsCore.computedExtent,s=>this._updateSuspendResumeExtent(s),O),T(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent))],ae);break;case"data":this.addHandles([ii(()=>this.dataExtent,s=>this._updateSuspendResumeExtent(s),O),T(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.dataExtent))],ae);break;default:ti(this.suspendResumeExtentMode)}},O))}_updateSuspendResumeExtent(s){s?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(s,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(s,e){const t=this.owner.view.spatialReference;if(!s.spatialReference.equals(t)){if(!si(s,t))return;s=ri(s,t)}return ai(s,e,ni,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(s){this.frustumVisibility!=null&&this.frustumVisibility.setExtent(s),this.scaleVisibility!=null&&this.scaleVisibility.setExtent(s)}};n([o()],m.prototype,"type",void 0),n([o({constructOnly:!0})],m.prototype,"owner",void 0),n([o()],m.prototype,"layer",null),n([o()],m.prototype,"renderer",null),n([o({constructOnly:!0})],m.prototype,"updateClippingExtent",void 0),n([o({constructOnly:!0})],m.prototype,"elevationFeatureExpressionEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"graphicsCore",void 0),n([o({constructOnly:!0})],m.prototype,"scaleVisibilityEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"filterVisibilityEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"frustumVisibilityEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"elevationAlignmentEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"timeExtentEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"setUidToIdOnAdd",void 0),n([o()],m.prototype,"scaleVisibility",null),n([o()],m.prototype,"filterVisibility",null),n([o()],m.prototype,"elevationAlignment",null),n([o({constructOnly:!0})],m.prototype,"frustumVisibility",void 0),n([o()],m.prototype,"objectStates",null),n([o()],m.prototype,"initializePromise",void 0),n([o()],m.prototype,"suspendResumeExtentMode",null),n([o()],m.prototype,"dataExtent",void 0),n([o()],m.prototype,"scaleVisibilitySuspended",null),n([o()],m.prototype,"suspended",null),n([o()],m.prototype,"legendEnabled",null),n([o()],m.prototype,"suspendInfo",null),n([o()],m.prototype,"updating",null),n([o()],m.prototype,"updatingRemaining",null),n([o()],m.prototype,"featureStore",null),n([o()],m.prototype,"view",null),n([o()],m.prototype,"loadedGraphics",null),n([o()],m.prototype,"fullOpacity",null),n([o()],m.prototype,"filter",null),n([o()],m.prototype,"slicePlaneEnabled",null),n([o()],m.prototype,"drapeSourceType",void 0),n([o()],m.prototype,"updatePolicy",null),n([o()],m.prototype,"preferredUpdatePolicy",void 0),n([o({readOnly:!0})],m.prototype,"displayFeatureLimit",null),m=n([M("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],m);const ae="suspendResumeExtentMode";function ut(s){const e=new Ze;e.include(oi),e.include(li);const{usesHalfFloat:t}=s;return e.fragment.uniforms.add(new Te("densityMap",i=>i.densityMap),new Te("tex",i=>i.colorRamp),new K("densityNormalizer",i=>1/(i.maxDensity-i.minDensity)),new K("minDensity",i=>i.minDensity),new K("densityMultiplier",i=>3/(i.searchRadius*i.searchRadius*Math.PI))),t&&e.constants.add("compressionFactor","float",4),e.fragment.code.add(N` + void main() { + float density = texture(densityMap, uv).r * densityMultiplier${t?N` * compressionFactor`:""}; + float densityRatio = (density - minDensity) * densityNormalizer; + + vec4 color = texture(tex, vec2(clamp(densityRatio, 0.0, 1.0), 0.5)); + + discardOrAdjustAlpha(color); + fragColor = color; + } + `),e}const Os=Object.freeze(Object.defineProperty({__proto__:null,build:ut},Symbol.toStringTag,{value:"Module"}));let Vs=class extends di{constructor(){super(...arguments),this.colorRamp=null,this.densityMap=null,this.searchRadius=1,this.fieldTotal=0,this.minDensity=0,this.maxDensity=100}},ht=class dt extends Ke{constructor(e,t){super(e,t,()=>this.destroy())}initializeProgram(e){return new et(e.rctx,dt.shader.get().build(this.configuration),tt)}initializePipeline(){return it({blending:ui,colorWrite:st,depthTest:null,depthWrite:null})}get primitiveType(){return hi.TRIANGLE_STRIP}};ht.shader=new Xe(Os,()=>Ye(()=>Promise.resolve().then(()=>qs),void 0));let ct=class extends rt{constructor(){super(...arguments),this.usesHalfFloat=!1}};n([he()],ct.prototype,"usesHalfFloat",void 0);let R=class extends ci{constructor(s){super(s),this.pixelRatio=1,this._colorRampData=new Uint8ClampedArray(4),this.type="draped-heatmap",this._heatmapParameters=new Vs;const e=new Se;e.pixelFormat=s.pixelFormat,e.internalFormat=s.internalFormat,e.dataType=s.dataType,e.samplingMode=s.samplingMode,e.wrapMode=Ce.CLAMP_TO_EDGE;const t=s.rendererContext.rctx;this._densityMap=new pi(t,e),this._quad=yi(t);const i=new ct;i.usesHalfFloat=s.dataType!==G.FLOAT,this._technique=new ht({rctx:t,viewingMode:ke.Local},i)}initialize(){const s=this._colorRampData,e=new Se(s.length/4,1);e.wrapMode=Ce.CLAMP_TO_EDGE,this._colorRamp=new mi(this.rctx,e,s),this._heatmapParameters.densityMap=this._densityMap.colorTexture,this.addHandles(T(()=>[this.colorRampData,this.minDensity,this.maxDensity,this.fieldTotal,this.pixelRatio,this.searchRadius],()=>this.rendererContext.notifyContentChanged()))}destroy(){this._technique=_i(this._technique),this._densityMap=ie(this._densityMap),this._quad=ie(this._quad),this._colorRamp=ie(this._colorRamp)}get searchRadius(){return this._heatmapParameters.searchRadius}set searchRadius(s){s!==this._heatmapParameters.searchRadius&&(this._heatmapParameters.searchRadius=s,this.notifyChange("searchRadius"))}get minDensity(){return this._heatmapParameters.minDensity}set minDensity(s){s!==this._heatmapParameters.minDensity&&(this._heatmapParameters.minDensity=s,this.notifyChange("minDensity"))}get maxDensity(){return this._heatmapParameters.maxDensity}set maxDensity(s){s!==this._heatmapParameters.maxDensity&&(this._heatmapParameters.maxDensity=s,this.notifyChange("maxDensity"))}get fieldTotal(){return this._heatmapParameters.fieldTotal}set fieldTotal(s){this._heatmapParameters.fieldTotal=s,this.notifyChange("fieldTotal")}get colorRampData(){return this._colorRampData}set colorRampData(s){const{colorRamp:e}=this._heatmapParameters;if(e!=null&&s!==this._colorRampData){const t=e.descriptor.width,i=s.length/4;i!==t&&e.resize(i,1),e.setData(s)}this._colorRampData=s}get _colorRamp(){return this._heatmapParameters.colorRamp}set _colorRamp(s){this._heatmapParameters.colorRamp=s}get hasHighlights(){return!1}get hasWater(){return!1}get rendersOccluded(){return!1}render(s){const e=this._sortedMaterialRenderers;if(e.length===0)return;const t=this.rctx.getBoundFramebufferObject(),i=this.rctx.getViewport(),{pixelRatio:r}=this,a=Math.ceil(i.width*r),l=Math.ceil(i.height*r);this._densityMap.resize(a,l),this.rctx.bindFramebuffer(this._densityMap),this.rctx.setViewport(0,0,a,l),this.rctx.clear(fi.COLOR_BUFFER_BIT);let u=!1;e.forAll(d=>{const c=d.prepareTechnique(s);c!=null&&(d.renderNode(s,c),u=!0)}),this.rctx.bindFramebuffer(t),this.rctx.setViewport(i.x,i.y,i.width,i.height),u&&(this.rctx.bindVAO(this._quad),this.rctx.bindTechnique(this._technique,this._heatmapParameters,s.bindParameters),this.rctx.drawArrays(this._technique.primitiveType,0,gi(this._quad,"geometry")))}};n([o()],R.prototype,"searchRadius",null),n([o()],R.prototype,"minDensity",null),n([o()],R.prototype,"maxDensity",null),n([o()],R.prototype,"fieldTotal",null),n([o()],R.prototype,"pixelRatio",void 0),n([o()],R.prototype,"colorRampData",null),n([o({constructOnly:!0})],R.prototype,"dataType",void 0),n([o({constructOnly:!0})],R.prototype,"samplingMode",void 0),n([o({constructOnly:!0})],R.prototype,"pixelFormat",void 0),n([o({constructOnly:!0})],R.prototype,"internalFormat",void 0),n([o()],R.prototype,"_colorRampData",void 0),R=n([M("esri.views.3d.webgl-engine.lib.DrapedHeatmapRenderer")],R);function pt(s){const e=new Ze,{vertex:t,fragment:i,attributes:r,varyings:a}=e;Fi(t,s);const{isAttributeDriven:l,usesHalfFloat:u}=s;return r.add(v.POSITION,"vec3"),r.add(v.UV0,"vec2"),l&&(r.add(v.FEATUREATTRIBUTE,"float"),a.add("attributeValue","float")),u&&e.constants.add("compressionFactor","float",.25),a.add("unitCirclePos","vec2"),t.uniforms.add(new K("radius",({resolutionForScale:d,searchRadius:c},{camera:y,screenToWorldRatio:h,overlayStretch:_})=>2*c*(d===0?1:d/h)*y.pixelRatio/y.fullViewport[2]/_)),t.code.add(N` + void main() { + unitCirclePos = uv0; + + vec4 posProj = proj * (view * vec4(${v.POSITION}, 1.0)); + vec4 quadOffset = vec4(unitCirclePos * radius, 0.0, 0.0); + + ${l?N`attributeValue = ${v.FEATUREATTRIBUTE};`:""} + gl_Position = posProj + quadOffset; + } + `),i.code.add(N` + void main() { + float radiusRatioSquared = dot(unitCirclePos, unitCirclePos); + if (radiusRatioSquared > 1.0) { + discard; + } + + float oneMinusRadiusRatioSquared = 1.0 - radiusRatioSquared; + float density = oneMinusRadiusRatioSquared * oneMinusRadiusRatioSquared ${l?N` * attributeValue`:""} ${u?N` * compressionFactor`:""}; + fragColor = vec4(density); + } + `),e}const Is=Object.freeze(Object.defineProperty({__proto__:null,build:pt},Symbol.toStringTag,{value:"Module"}));let Ps=class extends Ei{constructor(){super(...arguments),this.searchRadius=128,this.resolutionForScale=0}};class te extends Ke{initializeProgram(e){return new et(e.rctx,te.shader.get().build(this.configuration),tt)}initializePipeline(){return it({blending:bi(De.ONE,De.ONE,xi.ADD),colorWrite:st,depthTest:null,depthWrite:null})}destroy(){super.destroy()}}te.shader=new Xe(Is,()=>Ye(()=>Promise.resolve().then(()=>zs),void 0));let de=class extends rt{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloat=!1}};n([he()],de.prototype,"isAttributeDriven",void 0),n([he()],de.prototype,"usesHalfFloat",void 0);const $s=2;class Ms extends Ps{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class je extends wi{constructor(e){super(e,new Ms),this._configuration=new de}produces(e,t){return e===Ri.DRAPED_MATERIAL&&t===Ti.Color}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}createGLMaterial(e){return new As(e)}intersect(){}intersectDraped(e,t,i,r,a,l){const u=e.attributes.get(v.POSITION),{parameters:d}=this,{searchRadius:c}=d,{screenToWorldRatio:y}=e,h=c*y+$s*y,_=h*h,b=u.data.length/u.size;for(let w=0;wthis._loadedPointGraphics.length,setAllFeaturesVisibility:a=>this._setAllFeaturesVisibility(a),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:a=>this._updateFeatureVisibilities(a)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,a=>this._onLoadedFeaturesChange(a),O),this._updatingHandles.addWhen(()=>this._materialParameters,a=>this._forEachMaterial(l=>l.setParameters(a)),O),this._updatingHandles.add(()=>this._rendererParameters,a=>this._drapeSourceRenderer.set(a)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},ue),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:a,numeric:l})=>{if(a!=null&&l){let u=0;this._featureStore.forEach(d=>u+=d.attributes[a]??0),this._fieldTotal=u}else this._fieldTotal=this._featureStore.numFeatures},O),this.addHandles([T(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:a,field:l})=>{a&&!l&&X.warn(`Heatmap renderer field '${a}' for layer '${this.layer.title??this.layer.id}' not found`)}),T(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:a,numeric:l})=>{a==null||l||X.warn(`Heatmap renderer field '${a.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),Y(()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){var i,r,a,l;const s=((r=(i=this.owner)==null?void 0:i.view)==null?void 0:r.quality)??1,e=(l=(a=this.owner)==null?void 0:a.view)==null?void 0:l.qualitySettings,t=e?Math.ceil(e.heatmap.maxTotalNumberOfFeatures*s):0;return new nt(t*6,t)}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:s,maxScale:e}=this.layer.effectiveScaleRange,{scale:t}=this.view;return!Pi(t,s??0,e??0)}get usedMemory(){var r,a;const s=this.usedMemoryPerFeature*this._featureStore.numFeatures,e=this._pixelFormat===I.RED?1:4,t=this._dataType===G.FLOAT?4:2,i=Math.ceil((((a=(r=this._overlayRenderer)==null?void 0:r.overlays[0])==null?void 0:a.resolution)??0)*this._densityMapPixelRatio)??0;return i*i*e*t+s}get usedMemoryPerFeature(){const s=this._loadedPointGraphics.find(()=>!0);if(s==null)return 0;const e=$i(s),t=Wi(),i=6;return i*Ve([0,0,0],t)+i*Ve([0,0],t)+(this._heatmapRendererFieldIsNumeric?i*t:0)+e}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return{core:{visible:this._visibleFeatures,missing:0,pending:0},elevationUpdating:!1,visibilityFrustum:!0,visibilityScale:!0}}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const s=this._heatmapRenderer;if(s==null)return null;const{minDensity:e,maxDensity:t}=s;return{minDensity:e,maxDensity:t,fieldTotal:this._fieldTotal}}get _radiusParameter(){const s=this._heatmapRenderer;return s?{searchRadius:Mi(this._clampSearchRadius(s.radius))}:null}get _resolutionForScaleParameter(){const s=this._heatmapRenderer;if(!s)return null;const{referenceScale:e}=s;return{resolutionForScale:e===0?0:Ai(e,this.view.spatialReference)}}get _colorRampParameter(){const s=this._heatmapRenderer;return s?{colorRampData:Li(s.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){var s,e;return((e=(s=this.owner)==null?void 0:s.view)==null?void 0:e.qualitySettings.heatmap.pixelRatio)??1}get _renderView(){return this.view._stage.renderView}get _featuresArePoints(){return this.layer.geometryType==="point"}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const s=this.layer.renderer;return(s==null?void 0:s.type)==="heatmap"?s:null}get _heatmapRendererFieldName(){var s;return(s=this._heatmapRenderer)==null?void 0:s.field}get _heatmapRendererField(){const s=this._heatmapRendererFieldName;return s!=null?this.layer.fieldsIndex.get(s):null}get _heatmapRendererFieldIsNumeric(){const s=this._heatmapRendererField;return s!=null&&Ni(s)}get _isScaleRangeActive(){const{layer:s}=this;if(!("effectiveScaleRange"in s))return!1;const{minScale:e,maxScale:t}=s.effectiveScaleRange;return Hi(e,t)}get _visibleFeatures(){let s=0;return this._renderGeometries.forEach(e=>{e.visible&&++s}),s}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return Y()}maskOccludee(){return Y()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(s){if(!this._featuresArePoints)return;const{objectIdField:e}=this.layer;this._featureStore.removeManyById(s.removed.map(l=>D(l,e))),this._featureStore.addMany(s.added.map(l=>{const{attributes:u,centroid:d,geometry:c}=l,y=new Gi(Ie(new Ae,c),u,d?Ie(new Ae,d):null,D(l,e));return y.displayId=l.uid,y}));const t=s.added,i=s.removed;this._fieldTotal+=this._computeFieldTotalChange(t,i);const r=i.map(({uid:l})=>{const u=this._renderGeometries.get(l);return this._renderGeometries.delete(l),u}).filter(qi),a=t.map(l=>{const u=this._pointGraphicToRenderGeometry(l);return this._renderGeometries.set(l.uid,u),u});r.length>0&&this._drapeSourceRenderer.removeGeometries(r,Pe.REMOVE),a.length>0&&this._drapeSourceRenderer.addGeometries(a,Pe.ADD),(a.length>0||r.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const s=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:s,removed:s})}_pointGraphicToRenderGeometry(s){const e=this._heatmapRendererFieldName,t=e!=null?this._materialWithField:this._material,i=Ji();zi(s.geometry,i,this._overlaySpatialReference),i[2]=Ui;const r=ji(1),a=[[v.POSITION,new $e(i,r,i.length)]],l=this._heatmapRendererFieldIsNumeric;e!=null&&a.push([v.FEATUREATTRIBUTE,new $e([l?s.attributes[e]??0:0],r,1)]);const u=new Qi(new ki(t,a,null,Bi.Point),{layerUid:this.layer.uid,graphicUid:s.uid});return u.visible=this.filterVisibility.defaultVisibility,u}_forEachMaterial(s){s(this._material),s(this._materialWithField)}_computeFieldTotalChange(s,e){if(this._heatmapRendererFieldName==null||!this._heatmapRendererFieldIsNumeric)return s.length-e.length;const t=this._heatmapRendererFieldName,i=(r,a)=>r+(a.attributes[t]??0);return s.reduce(i,0)-e.reduce(i,0)}_clampSearchRadius(s){return s>oe&&X.warnOnce(`SceneView supports a maximum radius of ${oe} pt for HeatmapRenderer.`),Math.min(s,oe)}_updateFeatureVisibilities(s){const e=[];this._featureStore.forEach(({objectId:t,displayId:i})=>{const r=s(t),a=this._renderGeometries.get(i);a&&a.visible!==r&&(e.push(a),a.visible=r)}),this._drapeSourceRenderer.modifyGeometries(e,Me.VISIBILITY)}_setAllFeaturesVisibility(s){const e=[];for(const t of this._renderGeometries.values())t.visible!==s&&(e.push(t),t.visible=s);this._drapeSourceRenderer.modifyGeometries(e,Me.VISIBILITY)}get test(){return{visibleFeatureCount:this._visibleFeatures}}};n([o()],p.prototype,"type",void 0),n([o({constructOnly:!0})],p.prototype,"owner",void 0),n([o()],p.prototype,"layer",null),n([o()],p.prototype,"featureStore",null),n([o()],p.prototype,"updating",null),n([o()],p.prototype,"updatingRemaining",null),n([o()],p.prototype,"suspendInfo",null),n([o()],p.prototype,"legendEnabled",null),n([o()],p.prototype,"filterVisibility",null),n([o()],p.prototype,"displayFeatureLimit",null),n([o()],p.prototype,"preferredUpdatePolicy",void 0),n([o()],p.prototype,"hasZ",null),n([o()],p.prototype,"hasM",null),n([o()],p.prototype,"dataExtent",void 0),n([o()],p.prototype,"view",null),n([o()],p.prototype,"fullOpacity",null),n([o()],p.prototype,"updatePolicy",null),n([o()],p.prototype,"drapeSourceType",void 0),n([o()],p.prototype,"scaleVisibilitySuspended",null),n([o()],p.prototype,"renderer",null),n([o()],p.prototype,"_featureStore",void 0),n([o()],p.prototype,"_filterVisibility",void 0),n([o()],p.prototype,"_overlayRenderer",null),n([o()],p.prototype,"_overlaySpatialReference",null),n([o()],p.prototype,"_rendererParameters",null),n([o()],p.prototype,"_materialParameters",null),n([o()],p.prototype,"_densityParameters",null),n([o()],p.prototype,"_radiusParameter",null),n([o()],p.prototype,"_resolutionForScaleParameter",null),n([o()],p.prototype,"_colorRampParameter",null),n([o()],p.prototype,"_pixelRatioParameter",null),n([o()],p.prototype,"_densityMapPixelRatio",null),n([o()],p.prototype,"_renderGeometries",void 0),n([o()],p.prototype,"_material",void 0),n([o()],p.prototype,"_materialWithField",void 0),n([o()],p.prototype,"_renderView",null),n([o()],p.prototype,"_featuresArePoints",null),n([o()],p.prototype,"_loadedPointGraphics",null),n([o()],p.prototype,"_heatmapRenderer",null),n([o()],p.prototype,"_heatmapRendererFieldName",null),n([o()],p.prototype,"_heatmapRendererField",null),n([o()],p.prototype,"_heatmapRendererFieldIsNumeric",null),n([o()],p.prototype,"_fieldTotal",void 0),n([o()],p.prototype,"_drapeSourceRenderer",void 0),n([o()],p.prototype,"_isScaleRangeActive",null),p=n([M(mt)],p);const ur=s=>{let e=class extends s{constructor(){super(...arguments),this.controller=null,this.updatePolicy=ye.SYNC,this.suspendResumeExtentMode="computed",this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null,this.suspendResumeExtent=null,this._controllerCreated=!1,this.supportsHeightUnitConversion=!0,this._pendingController=null,this.queryEngine=null}initialize(){const t=this.layer;if("isTable"in t&&t.isTable)return void this.addResolvingPromise(Promise.reject(new P("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:t})));this.addResolvingPromise(this._validateGeometryType()),this._updatingHandles.add(()=>this.layer.renderer,r=>this._recreateProcessor(r),O),this.addResolvingPromise((async()=>{const r=await ls(this);this.fullExtentInLocalViewSpatialReference=r,await this._initializeController()})()),this._updatingHandles.add(()=>this.updatePolicy,r=>this.processor.preferredUpdatePolicy=r);const i=()=>this.processor.featureStore;this.queryEngine=new V({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return i()},hasZ:this.hasZ,hasM:this.hasM},priority:pe.FEATURE_QUERY_ENGINE}),this.notifyChange("updating")}destroy(){this._destroyPendingController(),this.controller=$(this.controller),this._set("processor",$(this.processor)),this.queryEngine=$(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this._pendingController=$(this._pendingController)}get legendEnabled(){var t;return this.canResume()&&((t=this.processor)==null?void 0:t.legendEnabled)}get graphics3DProcessor(){var t;return((t=this.processor)==null?void 0:t.type)==="graphics-3d"?this.processor:null}get heatmapProcessor(){var t;return((t=this.processor)==null?void 0:t.type)==="heatmap"?this.processor:null}get symbologySnappingSupported(){var i,r;const t=(r=(i=this.layer)==null?void 0:i.renderer)==null?void 0:r.getSymbols();return(t==null?void 0:t.some(Zi))??!1}getHit(t){var r;let i;return(r=this.loadedGraphics)==null||r.forEach(a=>{a.uid===t&&(i=Xi(a,this.layer))}),i?{type:"graphic",graphic:i,layer:i.layer}:null}whenGraphicBounds(t,i){var r;return(r=this.processor)==null?void 0:r.whenGraphicBounds(t,i)}computeAttachmentOrigin(t,i){var r;return(r=this.processor)==null?void 0:r.computeAttachmentOrigin(t,i)}async elevationAlignPointsInFeatures(t,i){const r=this.graphics3DProcessor;if(r==null)throw new P("featurelayerview3d:missing-processor","A Graphics3D processor is needed to resolve graphics elevation.");return Yi(this.view,this.layer,a=>r.getGraphics3DGraphicByObjectId(a),t,i)}async queryForSymbologySnapping(t,i){return this.symbologySnappingSupported?Ki(this.graphics3DProcessor,t,i):{candidates:[],sourceCandidateIndices:[]}}queryFeatures(t,i){return this.queryEngine.executeQuery(this._ensureQuery(t),i==null?void 0:i.signal)}queryObjectIds(t,i){return this.queryEngine.executeQueryForIds(this._ensureQuery(t),i==null?void 0:i.signal)}queryFeatureCount(t,i){return this.queryEngine.executeQueryForCount(this._ensureQuery(t),i==null?void 0:i.signal)}queryExtent(t,i){return this.queryEngine.executeQueryForExtent(this._ensureQuery(t),i==null?void 0:i.signal)}_ensureQuery(t){return t==null?this.createQuery():U.from(t)}highlight(t){return this.processor.highlight(t,this.layer.objectIdField)}maskOccludee(t){return this.processor.maskOccludee(t)}canResume(){var t;return super.canResume()&&!((t=this.processor)!=null&&t.scaleVisibilitySuspended)}getSuspendInfo(){const t=super.getSuspendInfo();return this.processor?{...t,...this.processor.suspendInfo}:t}isUpdating(){var t,i,r;return!(!this.processor||this.processor.destroyed)&&!(this._controllerCreated&&!((t=this.controller)!=null&&t.updating)&&((r=(i=this.view)==null?void 0:i.basemapTerrain)!=null&&r.ready)&&!this.processor.updating)}async _initializeController(){const t=this.createController();this._pendingController=t,await t.when(),this._setControllerWhenInitialized(t)}async _setControllerWhenInitialized(t){try{await this.when()}catch{}this._controllerCreated=!0,this.notifyChange("updating"),this.isResolved()&&!this.destroyed?(await We(()=>{var i,r;return(r=(i=this.view)==null?void 0:i.basemapTerrain)==null?void 0:r.ready}),this.beforeSetController(t),this._pendingController=null,this.controller=t,this.loadedGraphics=t.graphics,this.notifyChange("updating")):this._destroyPendingController()}_updateClippingExtent(t){if(this.clippingExtent=t,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=t,!0}}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":throw new P("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}_recreateProcessor(t){var u,d;const i=(t==null?void 0:t.type)==="heatmap",r=((u=this.processor)==null?void 0:u.type)==="heatmap",a=this.processor;if(a&&i===r)return;const l=i?new p({owner:this}):new m({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:c=>this._updateClippingExtent(c)});this._set("processor",l),a==null||a.destroy(),(d=this.queryEngine)==null||d.clear(),this.addResolvingPromise(l.initializePromise)}_getResourceInfo(){var i;const t=this.controller instanceof g?this.controller:null;return{displayedNumberOfFeatures:(i=this.loadedGraphics)==null?void 0:i.length,maximumNumberOfFeatures:(t==null?void 0:t.maximumNumberOfFeatures)??-1,totalNumberOfFeatures:(t==null?void 0:t.serviceDataCount)??-1,nodes:0,...this.processor.performanceInfo}}get performanceInfo(){return this._getResourceInfo()}};return n([o()],e.prototype,"loadedGraphics",void 0),n([o()],e.prototype,"suspended",void 0),n([o({readOnly:!0})],e.prototype,"legendEnabled",null),n([o()],e.prototype,"updating",void 0),n([o()],e.prototype,"controller",void 0),n([o()],e.prototype,"processor",void 0),n([o({readOnly:!0})],e.prototype,"updatePolicy",void 0),n([o({readOnly:!0})],e.prototype,"suspendResumeExtentMode",void 0),n([o({type:Boolean})],e.prototype,"slicePlaneEnabled",void 0),n([o({readOnly:!0})],e.prototype,"suspendInfo",void 0),n([o()],e.prototype,"graphics3DProcessor",null),n([o()],e.prototype,"heatmapProcessor",null),n([o()],e.prototype,"symbologySnappingSupported",null),e=n([M("esri.views.3d.layers.FeatureLikeLayerView3D")],e),e},qs=Object.freeze(Object.defineProperty({__proto__:null,build:ut},Symbol.toStringTag,{value:"Module"})),zs=Object.freeze(Object.defineProperty({__proto__:null,build:pt},Symbol.toStringTag,{value:"Module"}));export{ur as E,tr as I,m as P,g as T,V as l,Ue as n}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = [] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/HeatmapDensity.glsl-y7dUg--m.js b/dist/assets/HeatmapDensity.glsl-y7dUg--m.js deleted file mode 100644 index ecb4e3e..0000000 --- a/dist/assets/HeatmapDensity.glsl-y7dUg--m.js +++ /dev/null @@ -1,38 +0,0 @@ -import{ae as ce,zh as _t,lC as _e,j4 as fe,jL as ft,jU as gt,jQ as ge,zi as Ft,p_ as D,zj as bt,Z as H,e as n,y as o,c as M,p as q,aj as xt,fl as Et,ai as pe,f as A,eB as vt,lt as wt,zk as Rt,zl as Tt,ez as St,ca as U,s as Fe,eD as Ct,O as ke,vt as Dt,zm as Ot,f7 as Vt,zn as It,rI as Q,V as L,rK as k,l as Pt,S as z,bY as $t,bZ as Mt,b_ as At,c0 as Lt,cZ as Nt,k as ee,P as O,bK as Ht,E as P,n as $,ak as Be,a as le,w as We,d as T,A as B,C as ue,jO as Gt,jP as qt,rg as zt,dv as Ut,bI as be,cY as jt,dJ as xe,jR as Ee,dT as Qt,fe as kt,eQ as Bt,dQ as Wt,fS as Jt,dC as Zt,b as Yt,c3 as Je,G as ye,c4 as ve,zo as we,zp as Xt,c9 as W,a2 as X,c5 as Kt,c6 as ei,k4 as ti,F as ii,qX as si,cX as ri,cb as ai,cc as ni,xz as Ze,zb as oi,zq as li,yk as Re,xx as K,xy as N,xM as Ye,de as Xe,xL as he,xO as Ke,xP as et,y6 as tt,xQ as it,xR as ui,xW as st,uS as hi,xN as rt,y8 as di,zr as ci,uB as Te,fA as Se,zs as pi,zt as yi,vq as G,uD as mi,tt as _i,s6 as ie,zu as fi,zv as gi,xE as Fi,bf as v,yl as bi,zw as xi,uY as Ce,x$ as Ei,y0 as vi,xY as wi,lX as Ri,xA as Ti,hL as Si,hu as Ci,x_ as Di,y3 as Oi,yu as Vi,a9 as Ii,uR as J,uC as I,zx as De,ov as Pi,op as $i,oq as Oe,gO as Mi,nG as Ai,zy as Li,eY as Ni,jT as Hi,eZ as Gi,vr as Ve,e3 as qi,fu as Ie,ay as zi,bg as Ui,zz as ji,bz as Pe,b7 as Qi,by as ki,kW as Bi,fy as $e,tY as Wi,e_ as Me,aa as Ji,gJ as Zi,c8 as Yi}from"./index-J0iiHjMT.js";import{c as at}from"./dehydratedFeatureComparison-hdPq-zad.js";import{c as Xi,r as Ki}from"./queryForSymbologySnapping-I1fFQTD_.js";import{i as es}from"./hash-SS5GKVPY.js";import{F as ts,p as is,y as ss,s as rs,u as as,e as nt}from"./Graphics3DObjectStates--mMi4sdi.js";import{W as ns}from"./QueryEngine-8tLWlkSE.js";import{d as Ae}from"./FeatureSet-d4S1oKME.js";import{m as os}from"./FeatureStore-X-AIJLo2.js";import{l as ls}from"./projectExtentUtils-TwA6ooHn.js";let us=class{get isReferenced(){return this.versions.length!==0}get isSingle(){return this.versions.length===1&&this.versions[0].refCount===1}constructor(e,t){this._highestResolutionVersion=null,this.versions=[],this.ref(e,t)}ref(e,t){const i=this.feature;x.oldVersion=i,this.feature&&Object.defineProperty(e,"uid",{value:this.feature.uid,configurable:!0});for(const a of this.versions)if(a.resolution===t){a.refCount++;const l=this._highestResolutionVersion===a&&!at(e,a.feature);return(l||this._highestResolutionVersion!==a)&&(a.feature=e),x.newVersion=l?e:i,x}const r={feature:e,resolution:t,refCount:1};return this.versions.push(r),!this._highestResolutionVersion||t0&&(this._refCount--,!this.isReferenced)?(x.newVersion=null,x):(x.newVersion=this._feature,x)}get feature(){return this._feature}};const x={oldVersion:null,newVersion:null},ds=16438,Le=new Set;let cs=class{get displayingFeatures(){return this._displayingFeatures}set displayingFeatures(e){this._displayingFeatures=e,this.extentIncludingBorrowedFeatures=null}get perTileMaximumNumberOfFeaturesExceeded(){return!this.filtered&&(this.featuresMissing||this.features&&this.featureLimit!==this.features.length)}get features(){return this._features}get featureLimit(){return this._featureLimit}set featureLimit(e){this._featureLimit!==e&&(this._featureLimit=e,this._estimatedUnusedSizeDirty=!0)}get availableFields(){return this._availableFields}setFeatures(e,t,i){this._availableFields=i??Le,this._features=e,this._shuffled=!1,this._estimatedSize=-1,this._estimatedUnusedSizeDirty=!0,e&&e.length>0?(this._emptyFeatureRatio=t/(e.length+t),this._numVertices=e.reduce((r,a)=>r+_t(a.geometry),0)):(this._emptyFeatureRatio=0,this._numVertices=0)}get emptyFeatureRatio(){return this._emptyFeatureRatio}get numFeatures(){return this.hasPreciseFeatureCount?this._numFeatures:this._features?this._features.length:0}set numFeatures(e){this._numFeatures=e}get hasPreciseFeatureCount(){return this._numFeatures>se}get needsFeatureCount(){return this._numFeatures===se}get numVertices(){return this._numVertices}constructor(e){this.descriptor=e,this.fetchStatus=f.FETCH_NEEDED,this._features=null,this._numVertices=0,this._featureLimit=0,this.featuresMissing=!0,this._shuffled=!1,this._numFeatures=se,this._emptyFeatureRatio=0,this._estimatedSize=-1,this._estimatedUnusedSize=0,this._estimatedUnusedSizeDirty=!1,this._availableFields=Le,this._displayingFeatures=null,this.alive=!0,this.filtered=!1}get id(){return this.descriptor.id}get estimatedSize(){return this.updateMemoryEstimates(),this._estimatedSize}get estimatedUnusedSize(){return this._estimatedUnusedSize}updateMemoryEstimates(){if(this._estimatedSize<0){if(this._estimatedSize=0,this._estimatedUnusedSize=0,this._features)for(let e=0;e=this.featureLimit&&(this._estimatedUnusedSize+=t)}return!0}if(this._estimatedUnusedSizeDirty){if(this._estimatedUnusedSize=0,this._estimatedUnusedSizeDirty=!1,this._features)for(let e=this.featureLimit;eD(t,e)-D(i,e)),bt(this._features,ds),this._shuffled=!0,this._estimatedUnusedSizeDirty=!0}reduceFeatures(e,t,i){if(e<=0)return!1;if(!this._features)return this.featureLimit=0,!1;let r=!1;this.featureLimit=Math.ceil(this.numFeatures*e),this.featureLimit>this._features.length&&(this.featureLimit=this._features.length,this.fetchStatus===f.DONE&&this._features.length>0&&(this.fetchStatus=f.REFETCH_NEEDED,r=!0)),!this._shuffled&&e<1&&this._shuffle(i);const a=Math.max(this.featureLimit,Math.ceil(t*this.numFeatures));return this._features.length>a&&(this._features.length=a,this.featuresMissing=!0,this.fetchStatus===f.FULL&&(this.fetchStatus=f.DONE)),r}get cache(){return{availableFields:this._availableFields,features:this._features,numFeatures:this._numFeatures,emptyFeatureRatio:this._emptyFeatureRatio,fetchStatus:this.fetchStatus,featuresMissing:this.featuresMissing}}set cache(e){this.requestController=null,this._availableFields=e.availableFields,this._features=e.features,this._numFeatures=e.numFeatures,this._emptyFeatureRatio=e.emptyFeatureRatio,this.fetchStatus=e.fetchStatus,this.featuresMissing=e.featuresMissing,this._estimatedSize=-1,this._estimatedUnusedSizeDirty=!0}};const se=-1,ps=-2;var f;function ys(s,e,t){if(e==null||s==null||t!==e.length||t>s.length)return!1;for(let i=0;ie+=t.estimatedUnusedSize),e}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}set filterExtent(e){if(e!=null&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void Z.error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||t!=null&&e&&t.equals(e))return;const i=e!=null?e.clone():null;this._set("filterExtent",i),this._reclip(i,t)}constructor(e){super(e),this._useTileCount=!1,this.updating=!1,this.running=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._frameTask=xt,this._dirty=!1,this._featureTiles=new Map,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._suspended=!0,this._pendingEdits=null}initialize(){this.addHandles(Et(()=>this.tileDescriptors,"change",()=>this._setDirty(),{onListenerAdd:()=>this._setDirty()})),this._objectIdField=this.context.objectIdField,this.FeatureReferenceClass=this.context.capabilities.supportsMultipleResolutions?us:hs;const e=this.context.scheduler;e!=null&&(this._frameTask=e.registerTask(pe.FEATURE_TILE_FETCHER,this)),this._setDirty()}destroy(){var e;this._frameTask.remove(),this._featureTiles.forEach(t=>{this._cancelFetchTile(t),this._removeTile(t)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),(e=this._pendingEdits)==null||e.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._setDirty()}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||(this._setDirty(),this._updated())}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{t.displayingFeatures!=null&&t.displayingFeatures.length!==0&&(e==null?e=new Set(t.availableFields):e.forEach(i=>{t.availableFields.has(i)||e.delete(i)}))}),e??new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this._pendingEdits;t.count++;const i=t.edits.then(()=>e.result.catch(r=>{if(A(r))throw r;return null}).then(r=>r&&(this._applyEditsDeleteFeatures(r.deletedFeatures),this._applyEditsAddUpdateFeatures(r.addedFeatures,r.updatedFeatures,t.controller.signal).then(()=>r))).then(r=>(--t.count==0&&(this._pendingEdits===t&&(this._pendingEdits=null),this.context.memoryCache!=null&&this.context.memoryCache.clear(),this._unpause(),this._updated()),r)));return t.edits=i,this._updated(),i}_applyEditsDeleteFeatures(e){if(e.length===0)return;const t=this.context.globalIdField,i=t&&this.availableFields.has(t),r=new Set,a=this._objectIdField;e.forEach(({objectId:l,globalId:u})=>{(!l||l<0)&&t&&u&&(i||Z.errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),l=this._objectIdFromGlobalId(u,a,t)),l!=null&&l>=0&&r.add(l)}),this._featureTiles.forEach(l=>{if(!l.features)return;const u=l.features.filter(d=>!r.has(D(d,this._objectIdField)));u.length!==l.features.length&&(l.setFeatures(u,0,l.availableFields),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,i){if(e==null)return null;const r=this.features.find(a=>{var l;return((l=a.attributes)==null?void 0:l[i])===e});return r?D(r,t):null}async _applyEditsAddUpdateFeatures(e,t,i){const{objectIdField:r,globalIdField:a}=this.context,l=a&&this.availableFields.has(a),u=new Set,d=new Set;for(const y of e){const h=y.objectId;h!=null&&u.add(h)}for(const{objectId:y,globalId:h}of t){let _=y;(_==null||_<0)&&a&&(l||Z.errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),_=this._objectIdFromGlobalId(h,r,a)),_!=null&&_>=0&&(u.add(_),d.add(_))}if(u.size===0)return;const c=[];this._featureTiles.forEach(y=>{const h=this._applyEditsAddUpdateTile(y,u,d,i);h&&c.push(h)}),await Promise.allSettled(c)}async _applyEditsAddUpdateTile(e,t,i,r){if(!e.features)return;const a=this._createQuery(e);a.resultType=void 0,a.cacheHint=!1,a.objectIds=Array.from(t);const l=await this._queryFeatures(a,r);let u=null;if(i.size>0){const d=e.features.filter(c=>!i.has(D(c,this._objectIdField)));d.length!==e.features.length&&(u=d)}if(l.features.length>0){u||(u=e.features.slice());for(const d of l.features)u.push(d)}u&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,u.length)),e.setFeatures(u,0,He(e.availableFields,l.fields)),this._invalidateCounts())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:Fs})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){if(this._frameTask.processQueue(e),!this._dirty||!this.initialized)return;this._dirty=!1;const t=this._getListOfTiles();if(this._markTilesNotAlive(t),!e.run(()=>this._addTiles(t,e))||!e.run(()=>this._filterExtentTiles(t,e))||!e.run(()=>this._removeTiles(t,e))||e.done)return void this._setDirty();const i=this._sortTiles(t);e.run(()=>this._showTiles(i,e))&&e.run(()=>this._fetchTiles(i,e))&&e.run(()=>this._updateMemoryEstimates(i,e))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!(this._suspended||!this.tileDescriptors)&&(this.tileDescriptors.forEach(i=>{const r=this._featureTiles.get(i.id);r?r.alive=!0:t.done||(e.push(this._addTile(i)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(const i of e){if(t.done)break;i.alive&&(i.filtered=!i.intersects(this.filterExtent),i.filtered&&(this._clearTile(i),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let i=e.length-1;i>=0&&!t.done;i--){const r=e[i];r.alive||(this._removeTile(r),i!==e.length-1&&(e[i]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((t,i)=>(t.descriptor.loadPriority??0)-(i.descriptor.loadPriority??0)),e}_showTiles(e,t){const i=this._updateRatio(e),r=a=>{const l=this._fullRatio<1?i(a)*this._farRatio:1;return a.reduceFeatures(l,this.memoryFactor,this._objectIdField)&&this._setDirty(),this._showTile(a)};for(const a of e)if(!t.run(()=>r(a))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let i=!1;for(const r of e){if(!r.needsFetching)continue;const a=this.context.memoryCache!=null?this.context.memoryCache.pop(r.id):null;if(a==null){if(this._needsNumFeatures(r)){const l=new AbortController,u=this._fetchTileCount(r,l.signal);this._handleRequest(r,u,l,()=>r.numFeatures=ps),i=!0,t.madeProgress()}if(t.done)return!0}else r.cache=a,this._setDirty(),this._scheduleUpdated(),t.madeProgress()}if(i)return t.hasProgressed;for(const r of e)if(r.needsFetching){const a=new AbortController,l=this._fetchTile(r,a.signal);if(this._handleRequest(r,l,a,u=>{r.setFeatures([],0,null),this._invalidateCounts(),r.featuresMissing=!1,this.context.logFetchError(Z,u)}),t.madeProgress())return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(i=>!t.run(()=>i.updateMemoryEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;const i=new Array;this._featureTiles.forEach(r=>{r.displayingFeatures!=null&&r.displayingFeatures.length!==0&&(r.intersectionIncludingBorrowed(t,Ge),r.intersectionIncludingBorrowed(e,qe),vt(Ge,qe)||i.push(r))}),this._refreshDisplayingFeatures(i),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,i=this._changes.updates;for(const r of e)if(r.displayingFeatures!=null)for(const a of r.displayingFeatures){const l=D(a,this._objectIdField);if(t.has(l))continue;t.add(l);const u=this._displayingFeatureReferences.get(l).feature;i.removes.push(u),i.adds.push(u)}this._applyChanges()}_updated(){let e=0;this._paused||this._featureTiles.forEach(i=>i.isFetching?++e:0);const t=this._dirty||!!this._pendingEdits||e>0;if(this._set("running",this._dirty),this._set("updating",t),t){let i=0,r=0,a=0,l=0,u=0;const d=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(h=>{if(++r,h.isFetching&&h.hasPreciseFeatureCount){const _=this._maximumFeaturesForTile(h)*(1-h.emptyFeatureRatio),b=h.displayingFeatures!=null?h.displayingFeatures.length*d:0;u+=_-b}h.needsFetching?++l:h.numFeatures>0&&(++a,i+=h.numFeatures)}),l+=e;let c=0,y=0;i?(y=i,c=Math.min(l*i/a,i)):(y=r,c=l),u=Math.min(this.maximumNumberOfFeatures-this.features.length,u),this._set("updatingTotal",y),this._set("updatingRemaining",c),this._set("expectedFeatureDiff",u)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger&&this.debugger.update()}_updateMaximumNumberOfFeaturesExceeded(){const e=wt(this._featureTiles,t=>t.perTileMaximumNumberOfFeaturesExceeded);this._set("maximumNumberOfFeaturesExceeded",e)}_updateRatio(e){const t=ms(e),i=l=>1/(1<e&&this._featureTiles.forEach(i=>{if(!i.featuresMissing)return;const r=this._maximumFeaturesForTile(i);i.features&&(i.features.length>=r||i.fetchStatus===f.FULL)||(this._cancelFetchTile(i),this._resetFetchTile(i))}),this._setDirty())}_addTile(e){const t=new cs(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.descriptor.resolution;this._featureTiles.forEach(i=>{if(!(i.displayingFeatures==null||e===i||e.descriptor.lij&&i.descriptor.lij&&!Rt(e.descriptor.lij,i.descriptor.lij))){e.displayingFeatures==null&&(e.displayingFeatures=[]),e.descriptor.extent&&i.descriptor.extent&&(e.extentIncludingBorrowedFeatures==null&&(e.extentIncludingBorrowedFeatures=Tt(e.descriptor.extent)),St(e.extentIncludingBorrowedFeatures,i.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const r of i.displayingFeatures){e.displayingFeatures.push(r);const a=this._displayingFeatureReferences.get(D(r,this._objectIdField));a.ref(a.feature,t),this._numDisplayingFeatureReferences++}}}),e.featureLimit=e.displayingFeatures!=null?e.displayingFeatures.length:0}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetching&&(e.fetchStatus=f.DONE):e.fetchStatus=f.FETCH_NEEDED}_cancelFetchTile(e){const t=e.requestController;t!=null&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){return e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._getListOfTiles()),e.fetchStatus===f.REFETCHING?f.REFETCH_NEEDED:f.FETCH_NEEDED}async _fetchTile(e,t){const i=this._maximumFeaturesForTile(e);if(i<=0)return fs(e);const r=this._getMaxRecordCount(e),a=Math.ceil(i/r);if(re(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=i&&a>U.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const l=this._createQuery(e);if(l.maxRecordCountFactor=Math.ceil(i/r),e.isRefetching&&e.features&&e.features.length>0){const h=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/r);l.maxRecordCountFactor=Math.max(h+1,l.maxRecordCountFactor)}const{features:u,exceededTransferLimit:d,fields:c}=await this._queryFeatures(l,t),y=d?l.maxRecordCountFactor>=U.MAX_MAX_RECORD_COUNT_FACTOR?f.FULL:f.DONE:f.FULL;return await this._frameTask.schedule(()=>{e.featuresMissing=u.length{h&&(r+=y.num),l+=_.length,a+=this._removeEmptyFeatures(_),e.featuresMissing=r0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(i/r),e.num=Math.min(e.maxRecordCountFactor*r,i)):e.num=Math.min(r),!0)}_getEffectiveTileResolution(e){if(e.descriptor.resolution==null)return null;const t=this.context.viewingMode===ke.Global?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.descriptor.resolution,t)/this.lodFactor}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&this.context.geometryType!=="point"}_setResolutionParams(e,t){if(!this._supportsResolution)return;const i=this._getEffectiveTileResolution(t);i!=null&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new Dt({mode:"view",originPosition:"upper-left",tolerance:i,extent:this.context.fullExtent}):this.context.geometryType==="polyline"&&(e.maxAllowableOffset=i))}_removeEmptyFeatures(e){const t=e.length;for(let i=0;i0&&this.context.capabilities.supportsResultType?t:i!=null&&i>0?i:gs}_useTileQuery(e){return(!re(e)||!this.context.capabilities.supportsCacheHint)&&this.context.capabilities.supportsResultType}_handleRequest(e,t,i,r){e.fetchStatus=e.needsRefetching?f.REFETCHING:f.FETCHING,e.requestController=i;let a=!1;t.then(l=>{e.requestController=null,e.fetchStatus=l}).catch(l=>{e.requestController===i&&(e.requestController=null,e.fetchStatus=f.DONE),A(l)?a=!0:r(l)}).then(()=>{a||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles("scheduleUpdated")||this.addHandles(Vt(()=>{this.removeHandles("scheduleUpdated"),this._updated()}),"scheduleUpdated")}_showTile(e){if(e.displayingFeatures!=null&&!e.needsDisplayUpdate)return!1;const t=e.features;if(e.featureLimit===0||!t){const u=e.displayingFeatures!=null&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],u}const i=e.descriptor.resolution,r=this._changes.updates,a=this._changes.adds,l=Math.min(e.featureLimit,t.length);e.featureLimit=l;for(let u=0;u0&&(this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this.features.addMany(e.adds),e.adds.length=0);const t=this._changes.adds,i=this._changes.removes,r=Math.min(t.length,i.length);let a=0;for(;ar&&this.features.addMany(a===0?t:t.slice(a)),i.length>r&&this.features.removeMany(a===0?i:i.slice(a)),t.length=0,i.length=0}_clearTile(e){if(this._hideTile(e),e.features&&this.context.memoryCache!=null){const t=16+e.estimatedSize;this.context.memoryCache.put(e.id,e.cache,t)}e.setFeatures(null,0,null),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}_getListOfTiles(){return Array.from(this._featureTiles.values())}get storedFeatures(){return this._getListOfTiles().reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return Array.from(this._featureTiles.values()).reduce((e,t)=>e+(t.needsFetching||t.isFetching?1:0),0)}_maximumFeaturesForTile(e){const t=e.hasPreciseFeatureCount?e.numFeatures:1/0,i=e.hasPreciseFeatureCount?t:this.maximumNumberOfFeatures,r=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(i*r/(1-e.emptyFeatureRatio)),t)}get test(){return{process:e=>this.runTask(e),getFeatureTileById:e=>this._featureTiles.get(e),forEachFeatureTile:e=>this._featureTiles.forEach(e)}}};function re(s){return s.id==="dummy-tile-full-extent"}function ms(s){let e=0;for(const t of s)t.features&&t.features.length>0&&t.alive&&(e=Math.max(e,t.descriptor.lij[0]));return e}function ir(s){const e=s.capabilities.query;return{supportsMultipleResolutions:_s(s),supportsPagination:!(!e||!e.supportsPagination),supportsResultType:!(!e||!e.supportsResultType),supportsCacheHint:!(!e||!e.supportsCacheHint),supportsQuantization:!(!e||!e.supportsQuantization),supportsQuantizationEditMode:!(!e||!e.supportsQuantizationEditMode),supportsMaxRecordCountFactor:!(!e||!e.supportsMaxRecordCountFactor),supportsFormatPBF:!(!e||!e.supportsFormatPBF)}}function _s(s){switch(s.geometryType){case"polyline":return!0;case"polygon":return s.capabilities&&s.capabilities.query&&s.capabilities.query.supportsQuantization;default:return!1}}function fs(s){return s.setFeatures([],0,null),s.featuresMissing=!1,f.DONE}function lt(s){return s==null?new Set:new Set(s.map(e=>e.name))}function He(s,e){if(s==null||e==null)return lt(e);const t=new Set;for(const{name:i}of e)s.has(i)&&t.add(i);return t}n([o({constructOnly:!0})],F.prototype,"features",void 0),n([o()],F.prototype,"tileDescriptors",void 0),n([o({value:1/0})],F.prototype,"maximumNumberOfFeatures",null),n([o({value:1})],F.prototype,"memoryFactor",null),n([o({value:1})],F.prototype,"lodFactor",null),n([o()],F.prototype,"useTileCount",null),n([o({readOnly:!0})],F.prototype,"updating",void 0),n([o({readOnly:!0})],F.prototype,"running",void 0),n([o({readOnly:!0})],F.prototype,"updatingTotal",void 0),n([o({readOnly:!0})],F.prototype,"updatingRemaining",void 0),n([o({readOnly:!0})],F.prototype,"expectedFeatureDiff",void 0),n([o({readOnly:!0})],F.prototype,"memoryForUnusedFeatures",null),n([o({readOnly:!0})],F.prototype,"maximumNumberOfFeaturesExceeded",void 0),n([o({readOnly:!0})],F.prototype,"totalVertices",null),n([o({readOnly:!0})],F.prototype,"totalFeatures",null),n([o()],F.prototype,"filterExtent",null),n([o({constructOnly:!0})],F.prototype,"context",void 0),F=n([M(ot)],F);const gs=2e3,Ge=ce(),qe=ce(),Fs=6e5,bs=200,xs=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];let Es=class{constructor(e,t,i){this._loadingGraphics=new Map,this._loadedGraphics=new Map,this._pendingGraphics=new Map,this._dataExtentGraphic=null,this._enabled=!0,this._tileFetcher=e,this._view=i,this._tilingScheme=new It(t),this._loadedSymbols=xs.map(r=>new Q({symbolLayers:new L([new k({material:{color:[r[0],r[1],r[2],.6]},outline:{color:"black",size:1}})])})),this._loadingSymbols=[new Q({symbolLayers:new L([new k({material:{color:[200,200,200,.4]},outline:{color:[30,30,30],size:1}})])})],this._pendingSymbols=[new Q({symbolLayers:new L([new k({material:{color:[100,100,100,.4]},outline:{color:[30,30,30],size:1}})])})],this._dataExtentSymbol=new Q({symbolLayers:new L([new k({material:{color:[0,0,0,0]},outline:{color:"green",size:4}})])})}destroy(){this.enabled=!1}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}update(){this._enabled?(this._synchronizeMaps(this._loadingGraphics,{filter:e=>e.isFetching,symbols:this._loadingSymbols}),this._synchronizeMaps(this._loadedGraphics,{filter:e=>!e.isFetching,symbols:this._loadedSymbols}),this._synchronizeMaps(this._pendingGraphics,{filter:e=>!e.isFetching,symbols:this._pendingSymbols}),this.showDataExtent(this._tileFetcher.filterExtent)):(this._loadingGraphics.forEach(e=>{this._view.graphics.removeMany(e)}),this._loadingGraphics.clear(),this._loadedGraphics.forEach(e=>{this._view.graphics.removeMany(e)}),this._loadedGraphics.clear(),this._pendingGraphics.forEach(e=>{this._view.graphics.removeMany(e)}),this._pendingGraphics.clear(),this._dataExtentGraphic&&(this._view.graphics.remove(this._dataExtentGraphic),this._dataExtentGraphic=null))}showDataExtent(e){if(this._dataExtentGraphic&&(this._view.graphics.remove(this._dataExtentGraphic),this._dataExtentGraphic=null),e==null)return;const t=Pt.fromExtent(e);this._dataExtentGraphic=new z({geometry:t,symbol:this._dataExtentSymbol}),this._view.graphics.add(this._dataExtentGraphic)}_synchronizeMaps(e,t){const i=[];e.forEach((r,a)=>{const l=this._tileFetcher.test.getFeatureTileById(a);l&&t.filter(l)||(this._view.graphics.removeMany(r),i.push(a))}),i.forEach(r=>e.delete(r)),this._tileFetcher.test.forEachFeatureTile(r=>{if(t.filter(r)&&!e.has(r.id)){const[a,l,u]=r.descriptor.lij;this._tilingScheme.ensureMaxLod(a);const d=this._tilingScheme.getExtentGeometry(a,l,u),c=[new z({geometry:d,symbol:t.symbols[a%t.symbols.length]}),new z({geometry:d.center,symbol:new $t({verticalOffset:new Mt({screenLength:40/.75}),callout:new At({color:"white",border:{color:"black"}}),symbolLayers:new L([new Lt({text:`${a}/${l}/${u}`,halo:{color:"white",size:1/.75},material:{color:"black"},size:16})])})})];e.set(r.id,c),this._view.graphics.addMany(c)}})}},g=class extends Nt(q){set extent(e){if(e!=null&&!e.spatialReference.equals(this.layerView.view.spatialReference))return void H.getLogger(this).error("#extent=","extent needs to be in the same spatial reference as the view");const t=this._get("extent");if(t===e||t!=null&&e&&t.equals(e))return;const i=e!=null?e.clone():null;this._set("extent",i)}get updating(){return!!(this._tileFetcher!=null&&this._tileFetcher.updating||this._fetchDataInfoPromise!=null||this.mode==="tiles"&&this.layerView.view.featureTiles&&this.layerView.view.featureTiles.updating||this._updatingHandles&&this._updatingHandles.updating)}get updatingTotal(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.expectedFeatureDiff:0}get memoryForUnusedFeatures(){return this._tileFetcher!=null?this._tileFetcher.memoryForUnusedFeatures:0}get maximumNumberOfFeaturesExceeded(){return!(this._tileFetcher==null||!this._tileFetcher.maximumNumberOfFeaturesExceeded)}get maximumNumberOfFeatures(){var e;return((e=this.displayFeatureLimit)==null?void 0:e.maximumNumberOfFeatures)??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome("maximumNumberOfFeatures",e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden("maximumNumberOfFeatures")}get mode(){var a,l;const e=this.layerView.layer;if(e.type==="feature"&&e.infoFor3D!=null)return"snapshot";if(this._forceTilesMode)return"tiles";const t=this.layerView.view;if(((l=(a=t.qualitySettings)==null?void 0:a.graphics3D)==null?void 0:l.snapshotAvailable)===!1||this.serviceDataCount===S.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return"tiles";const i=t&&t.featureTiles,r=i&&i.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&r){const u=this._approximateExtentSizeAtScale(e.minScale,r);if((this.serviceDataExtent.width/u+this.serviceDataExtent.height/u)/2>S.maxSnapshotMinScaleFactor)return"tiles"}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?"snapshot":"tiles"}get maxTotalSnapshotVertices(){var i;const e=this._get("maxTotalSnapshotVertices")||0,t=this.mode==="snapshot"&&((i=this._tileFetcher)==null?void 0:i.totalVertices)||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){const i=this.layerView.view,r=Math.ceil((i.width/t.pixelSize+i.height/t.pixelSize)/2),a=t.levels[0];return r*((a.tileSize[0]/(a.scale/e)+a.tileSize[1]/(a.scale/e))/2)}get tileDescriptors(){return this.mode==="snapshot"?new L([{id:"dummy-tile-full-extent",lij:[0,0,0]}]):this.layerView.view.featureTiles?this.layerView.view.featureTiles.tiles:new L}get test(){return{fetchDataInfoPromise:this._fetchDataInfoPromise,tileFetcher:this._tileFetcher}}constructor(e){super(e),this.type="feature-tile-3d",this._updatingHandles=new ee,this.serviceDataExtent=null,this.serviceDataCount=S.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add(()=>this.displayFeatureLimit,e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal))),this._updatingHandles.add(()=>this.mode,()=>this._modeChanged(),O),this._updatingHandles.add(()=>this.mode,(e,t)=>{e==="tiles"&&t==="snapshot"&&(this._forceTilesMode=!0)},O),this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){var t;const e=this.layerView.layer;if(e.type!=="ogc-feature"&&!((t=Ht(e))!=null&&t.operations.supportsQuery))throw new P("graphicscontroller:query-capability-required","Service requires query capabilities to be used as a feature layer",{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=$(this._tileFetcher),this._tilesHandle=Be(this._tilesHandle),this._lifeCycleAbortController=le(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set("_updatingHandles",null)}suspend(){this._suspended||(this._suspended=!0,this._tileFetcher!=null&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,this._tileFetcher!=null&&this._tileFetcher.resume())}restart(){const e=()=>{this._tileFetcher!=null&&this._tileFetcher.restart()};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}_refetch(e){const t=()=>{this._tileFetcher!=null&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){const e=this.layerView.view;if(!e)return;const t=We(()=>{var i;return(i=e.featureTiles)==null?void 0:i.tilingScheme},this._lifeCycleAbortController.signal);this._updatingHandles.addPromise(t),t.then(()=>{const{layerView:i,tileDescriptors:r}=this,a=i.layer,l=new F({context:this.context,filterExtent:this.extent,tileDescriptors:r,features:this.graphics});this._tileFetcher=l,this._suspended?this._tileFetcher.suspend():this._tileFetcher.resume();const u=this.layerView.view;u&&this.addHandles(T(()=>u.quality,h=>l.memoryFactor=h,B));const d=this.context.geometryType==="polygon"?"polygonLodFactor":this.context.geometryType==="polyline"?"polylineLodFactor":null;d&&this.addHandles(T(()=>{var h,_,b;return(b=(_=(h=this.layerView.view)==null?void 0:h.qualitySettings)==null?void 0:_.graphics3D)==null?void 0:b[d]},h=>l.lodFactor=h||1,O));const c=h=>{l.maximumNumberOfFeatures=h,l.useTileCount=this.serviceDataCount>h},y=h=>{l.useTileCount=h>this.maximumNumberOfFeatures};a.type!=="ogc-feature"&&this._updatingHandles.add(()=>a.createQueryVersion,()=>this._dataFilterChanged()),this._updatingHandles.add(()=>i.availableFields,(h,_)=>this._availableFieldsChanged(_,h)),this._updatingHandles.add(()=>i.requiredFields,(h,_)=>this._requiredFieldsChanged(_,h)),this.addHandles([a.on("apply-edits",h=>this._applyEdits(h)),T(()=>this.extent,h=>l.filterExtent=h,ue),T(()=>this.tileDescriptors,h=>l.tileDescriptors=h,ue),T(()=>this.maximumNumberOfFeatures,c,B),T(()=>this.serviceDataCount,y,B),T(()=>Gt.FEATURE_TILE_FETCH_SHOW_TILES,h=>{h&&l&&!l.debugger?(l.debugger=new Es(l,u.featureTiles.tilingScheme.toTileInfo(),u),l.debugger.update()):!h&&this._tileFetcher&&l.debugger&&(l.debugger.destroy(),l.debugger=null)},B)]),this._supportsExceedsLimitQuery||this._updatingHandles.add(()=>this.maxTotalSnapshotVertices,()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal)))}).catch(()=>{})}_modeChanged(){switch(this.mode){case"tiles":this._tilesHandle||(this._tilesHandle=this.layerView.view.featureTiles.addClient());break;default:H.getLogger(this).warn("Unhandled feature layer mode "+this.mode);case"snapshot":this._tilesHandle!=null&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set("maxTotalSnapshotVertices",0),this.notifyChange("maxTotalSnapshotVertices"),this._refetch({resetForceTilesMode:!0})}_applyEdits(e){this._tileFetcher!=null&&this._tileFetcher.applyEdits(e).then(t=>{if(t){if(!this._lifeCycleAbortController)throw qt();t.exceededTransferLimit?this.layerView.layer.refresh():(t.deletedFeatures.length||t.updatedFeatures.length||t.addedFeatures.length)&&this._updatingHandles.addPromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}}).catch(t=>{if(!A(t))throw t})}_availableFieldsChanged(e,t){this._tileFetcher!=null&&ze(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){this._tileFetcher!=null&&ze(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){var r;const t=this.layerView.layer,i=t.createQuery();return i.returnGeometry=!1,i.outStatistics=[new zt({statisticType:"exceedslimit",maxVertexCount:e,outStatisticFieldName:"exceedslimit",maxPointCount:1e8,maxRecordCount:1e8})],(r=t.capabilities)!=null&&r.query.supportsCacheHint&&(i.cacheHint=!0),i}_createDataInfoQuery(){var i;const e=this.layerView.layer,t=e.createQuery();return t.returnGeometry=!1,t.outSpatialReference=this.layerView.view.spatialReference,(i=e.capabilities)!=null&&i.query.supportsCacheHint&&(t.cacheHint=!0),t}_fullExtentIsAccurate(){const e=this.layerView.layer;if(e.definitionExpression)return!1;switch(e.type){case"feature":case"oriented-imagery":return Ut(e.url);case"csv":case"geojson":case"ogc-feature":case"wfs":return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(t){A(t)||this._set("serviceDataExtent",be(this.layerView.fullExtentInLocalViewSpatialReference))}}async _tryUpdateServiceDataExtent(e){var c;const t=this.layerView,i=t.layer,r=((c=i.capabilities)==null?void 0:c.query.supportsExtent)??!1,a=be(t.fullExtentInLocalViewSpatialReference),l=i.fullExtent,u=this._fullExtentIsAccurate(),d=this.serviceDataCount;if(r&&d<=S.maxFeatureCountForExtent&&(!a||!u)&&"queryExtent"in i){const y=this._createDataInfoQuery(),h=await i.queryExtent(y,{timeout:S.queryExtentTimeout,signal:e});this._set("serviceDataExtent",h.extent)}else if(a)this._set("serviceDataExtent",a);else if(l!=null){const y="portalItem"in i?i.portalItem:null,h=await jt(l,t.view.spatialReference,y,e);this._set("serviceDataExtent",h)}else this._set("serviceDataExtent",null)}async _updateServiceDataCount(e){const t=this.layerView.layer;if(!("queryFeatureCount"in t)||!xe("featurelayer-snapshot-enabled"))return void this._set("serviceDataCount",S.noServiceDataCount);const i=await Ee(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:S.queryStatisticsTimeout,signal:e}));if(i.ok===!0)this._set("serviceDataCount",i.value);else{if(A(i.error))throw i.error;this._set("serviceDataCount",S.noServiceDataCount)}}get _supportsExceedsLimitQuery(){const e=this.layerView.layer;return e.capabilities!=null&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case"point":case"multipoint":return 1;case"polygon":return 4;case"polyline":return 2;case"multipatch":case"mesh":return 3;default:return 0}}async _updateSnapshotLimit(e,t,i){if((e==null?void 0:e.averageSymbolComplexity)==null)return void(this._snapshotLimitExceeded=!1);const{maximumTotalNumberOfVertices:r,averageSymbolComplexity:a}=e,{verticesPerFeature:l,verticesPerCoordinate:u}=a,d=l<=0,c=this._minimumNumberOfVerticesForGeometry>1;if(!d&&!c)return void(this._snapshotLimitExceeded=!1);l!==0&&t!=null&&await t;const y=Math.min(r,ws),h=this.serviceDataCount,_=h!==S.noServiceDataCount;let b=Math.ceil(_?(y-h*l)/(u||1):y/(u||1));if(c&&(b=Math.min(b,Ss)),_&&this._minimumNumberOfVerticesForGeometry*h>b)return void(this._snapshotLimitExceeded=!0);if(!this._supportsExceedsLimitQuery||!xe("featurelayer-snapshot-enabled"))return void(this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>b);const w=await Ee(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(b),{timeout:S.queryStatisticsTimeout,signal:i}));if(w.ok===!1){if(A(w.error))throw w.error;return void(this._snapshotLimitExceeded=!1)}const C=w.value.features[0];this._snapshotLimitExceeded=!!(C!=null&&C.attributes)&&!!C.attributes.exceedslimit}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo();let e=new AbortController;const t=e.signal,i=this._updateServiceDataCount(t),r=Promise.allSettled([i,this._updateSnapshotLimit(this.displayFeatureLimit,i,t)]),a=r.then(()=>this._updateServiceDataExtent(t)).catch(l=>{A(l)||H.getLogger(this).error("#fetchServiceDataInfo()",l)}).then(()=>{a===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null});return e&&(this._fetchDataInfoPromise=a),this._fetchDataInfoAbortController=e,r.then(()=>{},()=>{})}_cancelFetchServiceDataInfo(){const e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){var e,t,i,r;return{storedFeatures:((e=this._tileFetcher)==null?void 0:e.storedFeatures)??0,totalFeatures:((t=this._tileFetcher)==null?void 0:t.totalFeatures)??0,totalVertices:((i=this._tileFetcher)==null?void 0:i.totalVertices)??0,missingTiles:((r=this._tileFetcher)==null?void 0:r.missingTiles)??0}}};n([o({readOnly:!0})],g.prototype,"type",void 0),n([o({constructOnly:!0})],g.prototype,"graphics",void 0),n([o({constructOnly:!0})],g.prototype,"layerView",void 0),n([o({constructOnly:!0})],g.prototype,"context",void 0),n([o()],g.prototype,"extent",null),n([o()],g.prototype,"updating",null),n([o({readOnly:!0})],g.prototype,"_updatingHandles",void 0),n([o()],g.prototype,"updatingTotal",null),n([o()],g.prototype,"updatingRemaining",null),n([o()],g.prototype,"expectedFeatureDiff",null),n([o()],g.prototype,"memoryForUnusedFeatures",null),n([o()],g.prototype,"maximumNumberOfFeaturesExceeded",null),n([o({readOnly:!0})],g.prototype,"serviceDataExtent",void 0),n([o({readOnly:!0})],g.prototype,"serviceDataCount",void 0),n([o()],g.prototype,"_snapshotLimitExceeded",void 0),n([o()],g.prototype,"displayFeatureLimit",void 0),n([o({type:Number})],g.prototype,"maximumNumberOfFeatures",null),n([o()],g.prototype,"_forceTilesMode",void 0),n([o({readOnly:!0})],g.prototype,"mode",null),n([o({readOnly:!0})],g.prototype,"maxTotalSnapshotVertices",null),n([o({readOnly:!0})],g.prototype,"tileDescriptors",null),n([o()],g.prototype,"_tileFetcher",void 0),n([o()],g.prototype,"_fetchDataInfoPromise",void 0),g=n([M("esri.layers.graphics.controllers.FeatureTileController3D")],g);const vs=1e4,ws=1e6,Rs=12e3,Ts=1e4,Ss=5e6;function ze(s,e){if(!e)return!1;for(const t of e)if(!s.has(t))return!0;return!1}var S;(function(s){function e(){s.maxFeatureCountForExtent=vs,s.queryStatisticsTimeout=Rs,s.queryExtentTimeout=Ts}s.noServiceDataCount=1/0,s.maxSnapshotMinScaleFactor=5,s.reset=e})(S||(S={})),S.reset();function Ue(s,e,t){if(!t||e==null)return null;if(!s)return Cs(e,t);const i=s.get(t);return i?e[i.name]:null}function Cs(s,e){const t=e.toLowerCase();for(const i in s)if(i.toLowerCase()===t)return s[i];return null}const Ds=ns;let V=class extends q{get layer(){return this.context.layer}get spatialReference(){return this.context.spatialReference}get _queryGeometryType(){switch(this.layer.geometryType){case"multipoint":case"point":case"polygon":case"polyline":return this.layer.geometryType;case"mesh":return"polygon";default:return}}get defaultQueryJSON(){return new U({outSpatialReference:this.spatialReference}).toJSON()}get _dataQueryEngine(){return this._ensureDataQueryEngine()}constructor(e){super(e),this._dataQueryEngineInstance=null}destroy(){this.clear()}clear(){return!!this._dataQueryEngineInstance&&(this._dataQueryEngineInstance.destroy(),this._dataQueryEngineInstance=null,!0)}async executeQueryForIdSet(e,t,i){return this._dataQueryEngine.executeQueryForIdSet(this._ensureQueryJSON(e,t),i)}async executeQueryForCount(e,t){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),t)}async executeQueryForExtent(e,t){const{count:i,extent:r}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:i,extent:Qt.fromJSON(r)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQueryForLatestObservations(e,t){const i=await this._dataQueryEngine.executeQueryForLatestObservations(this._ensureQueryJSON(e),t),r=Ae.fromJSON(i);return r.features.forEach(a=>{a.layer=this.layer,a.sourceLayer=this.layer}),r}async executeQuery(e,t){const i=await this._dataQueryEngine.executeQuery(this._ensureQueryJSON(e),t),r=Ae.fromJSON(i);return r.features.forEach(a=>{a.layer=this.layer,a.sourceLayer=this.layer}),r}_ensureQueryJSON(e,t){let i=this.defaultQueryJSON;if(e!=null&&("outSpatialReference"in e&&!e.outSpatialReference&&(e.outSpatialReference=this.spatialReference),i=e.toJSON()),t!=null){const r=t.geometries.map(a=>a.toJSON()).reduce((a,l)=>(a.rings=a.rings.concat(l.rings),a));i={...i,sceneFilter:{...t,geometry:r}}}return i}_ensureDataQueryEngine(){var h,_;if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e="timeInfo"in this.layer&&((h=this.layer.timeInfo)==null?void 0:h.toJSON())||null,t=this.layer.objectIdField,i=kt.toJSON(this._queryGeometryType),r=((_=this.layer.fieldsIndex)==null?void 0:_.toJSON())||new Bt([]),a=this.priority,l=this.spatialReference.toJSON(),{hasZ:u,hasM:d,featureStore:c,scheduler:y}=this.context;return this._dataQueryEngineInstance=new Ds({hasZ:u,hasM:d,geometryType:i,fieldsIndex:r,timeInfo:e,spatialReference:l,objectIdField:t,featureStore:c,scheduler:y,priority:a}),this._dataQueryEngineInstance}};n([o({constructOnly:!0})],V.prototype,"context",void 0),n([o({constructOnly:!0})],V.prototype,"priority",void 0),n([o()],V.prototype,"layer",null),n([o()],V.prototype,"spatialReference",null),n([o()],V.prototype,"_queryGeometryType",null),n([o()],V.prototype,"defaultQueryJSON",null),V=n([M("esri.views.3d.layers.graphics.QueryEngine")],V);let E=class extends q{constructor(s){super(s),this._updateTask=null,this._frameTask=null,this._queryEngine=null,this._updateRequested=!0,this._updatingHandles=new ee,this._updateVisibility=async e=>{if(this._compositedFeatureFilter==null&&this._sceneFilter==null||this.context.getFeatureCount()===0)return this._frameTask.schedule(()=>this.clear(),e);try{const t=await this._queryEngine.executeQueryForIdSet(this._compositedFeatureFilter,this._sceneFilter,e);return this._frameTask.schedule(()=>{this.context.updateFeatureVisibilities(i=>t.has(i))},e)}catch(t){return Wt(t),H.getLogger(this).warn(`FeatureFilter query failed: ${t}`,{error:t}),this._frameTask.schedule(()=>{this.context.setAllFeaturesVisibility(!0)},e)}}}initialize(){const s=pe.FILTER_VISIBILITY,{layer:e,view:t}=this._layerView,{featureStore:i}=this.context,r="hasZ"in this._layerView&&this._layerView.hasZ,a="hasM"in this._layerView&&this._layerView.hasM;this._queryEngine=new V({context:{spatialReference:t.spatialReference,layer:e,scheduler:t.resourceController.scheduler,featureStore:i,hasM:a,hasZ:r},priority:s}),this._frameTask=this._layerView.view.resourceController.scheduler.registerTask(s,this),this._updatingHandles.add(()=>[this._compositedFeatureFilter,this._sceneFilter],()=>this.reapply(),O)}destroy(){this._updateRequested=!1,this._updatingHandles.destroy(),this.clear(),this._updateTask=le(this._updateTask),this._frameTask=Be(this._frameTask),this._queryEngine=$(this._queryEngine),this._set("context",null)}get updating(){return this.running||this._updatingHandles.updating||this._updateTask!=null&&!this._updateTask.finished}get running(){return this._updateRequested||this._frameTask.updating}get defaultVisibility(){return this._compositedFeatureFilter==null&&this._sceneFilter==null}get _featureFilter(){return"filter"in this._layerView?this._layerView.filter:null}get _sceneFilter(){return"layerFilter"in this._layerView?this._layerView.layerFilter:null}get _floorFilter(){return Jt(this._layerView)}get _timeExtent(){return"timeExtent"in this._layerView?this._layerView.timeExtent:null}get _compositedFeatureFilter(){const{_featureFilter:s,_timeExtent:e,_floorFilter:t}=this;if(e==null&&t==null)return s;const i=s!=null?s.clone():new Zt;if(e!=null&&(i.timeExtent=i.timeExtent!=null?i.timeExtent.intersection(e):e),t!=null){const r=i.where==null||i.where==="";i.where=r?t:`(${i.where}) AND (${t})`}return i}get _layerView(){return this.context.layerView}reapply(){this._updateRequested=!0}clear(){this._queryEngine.clear(),this.context.clearFeaturesVisibility()}runTask(s){this._updateRequested&&(this._updateTask=le(this._updateTask),this._updateTask=Yt(this._updateVisibility),this._updateRequested=!1,s.madeProgress()),this._frameTask.processQueue(s)}};n([o({constructOnly:!0})],E.prototype,"context",void 0),n([o()],E.prototype,"updating",null),n([o()],E.prototype,"running",null),n([o()],E.prototype,"defaultVisibility",null),n([o()],E.prototype,"_featureFilter",null),n([o()],E.prototype,"_sceneFilter",null),n([o()],E.prototype,"_floorFilter",null),n([o()],E.prototype,"_timeExtent",null),n([o()],E.prototype,"_compositedFeatureFilter",null),n([o()],E.prototype,"_layerView",null),n([o()],E.prototype,"_updateTask",void 0),n([o()],E.prototype,"_updateRequested",void 0),E=n([M("esri.views.3d.layers.support.FeatureVisibilityFilter")],E);let m=class extends q{constructor(s){super(s),this.type="graphics-3d",this._randomRotationRenderers=null,this._updatingHandles=new ee,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=Je.Features,this.preferredUpdatePolicy=ye.ASYNC,this._suspendResumeExtent=null}initialize(){const s=this.owner,e=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&s.layer.geometryType!=="multipatch",t=new ts({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:s.hasZ,hasM:s.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:i=>s.view.deconflictor.addGraphicsOwner(i),labeler:(i,r)=>s.view.labeler.addGraphicsOwner(i,r),elevationAlignment:this.elevationAlignmentEnabled?(i,r)=>new is({graphicsCoreOwner:this,graphicsCore:i,queryGraphicUIDsInExtent:r,elevationProvider:s.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(i,r)=>new ss({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:r,graphicsCore:i,basemapTerrain:s.view.basemapTerrain}):null,filterVisibility:e?i=>new E({context:{layerView:s,...i}}):null,objectStates:i=>new rs(i)}});this._set("graphicsCore",t),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new as({graphicsCoreOwner:this})),this.elevationAlignment&&this._updatingHandles.add(()=>this.layer.elevationInfo,(i,r)=>{ve(i,r)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())}),this._updatingHandles.add(()=>this.layer.labelsVisible,()=>this.graphicsCore.updateVisibilityInfo()),this._updatingHandles.add(()=>this.layer.labelingInfo,(i,r)=>{ve(i,r)&&this.graphicsCore.updateLabelingInfo()}),this._updatingHandles.add(()=>this.preferredUpdatePolicy,i=>this.graphicsCore.preferredUpdatePolicy=i),this._set("initializePromise",this._initializeAsync()),this._updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){await we(this.graphicsCore.initializePromise);const s=this.owner;this._updatingHandles.add(()=>this.renderer,e=>this._updatingHandles.addPromise(this.graphicsCore.rendererChange(e))),this._updatingHandles.add(()=>s.fullOpacity,()=>this.graphicsCore.opacityChange()),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this._updatingHandles.add(()=>s.view.clippingArea,()=>this._updateClippingExtent()),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await we(this.graphicsCore.updateLabelingInfo())}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",$(this.frustumVisibility)),this._set("graphicsCore",$(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get renderer(){const{renderer:s,objectIdField:e}=this.layer;if(!s||!e||s.type==="heatmap"||!s.visualVariables)return s;const t=s.visualVariables.findIndex(r=>r.type==="rotation"&&r.valueExpression!=null&&Xt(r.valueExpression)===e&&(r.axis==null||r.axis==="heading")&&r.rotationType==="geographic");if(t<0)return s;const i=s.clone();return i.visualVariables.splice(t,1),this._randomRotationRenderers||(this._randomRotationRenderers=new WeakMap),this._randomRotationRenderers.set(i,e),i}get scaleVisibility(){var s;return(s=this.graphicsCore)==null?void 0:s.scaleVisibility}get filterVisibility(){var s;return(s=this.graphicsCore)==null?void 0:s.filterVisibility}get elevationAlignment(){var s;return(s=this.graphicsCore)==null?void 0:s.elevationAlignment}get objectStates(){var s;return(s=this.graphicsCore)==null?void 0:s.objectStates}get suspendResumeExtentMode(){return"suspendResumeExtentMode"in this.owner?this.owner.suspendResumeExtentMode:"computed"}get scaleVisibilitySuspended(){return this.scaleVisibility!=null&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return this.frustumVisibility==null||!this.frustumVisibility.suspended}get suspendInfo(){const s={};return this.scaleVisibilitySuspended&&(s.outsideScaleRange=!0),this.frustumVisibility!=null&&this.frustumVisibility.suspended&&(s.outsideOfView=!0),s}get updating(){var s,e;return!!((s=this.graphicsCore)!=null&&s.updating||(e=this.frustumVisibility)!=null&&e.updating||this._updatingHandles.updating)}get updatingRemaining(){var s;return((s=this.graphicsCore)==null?void 0:s.updatingRemaining)??0}get featureStore(){var s;return(s=this.graphicsCore)==null?void 0:s.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){var s;return(s=this.owner)==null?void 0:s.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){var s;return(s=this.graphicsCore)==null?void 0:s.graphics3DGraphics}get graphics3DGraphicsByObjectID(){var s;return(s=this.graphicsCore)==null?void 0:s.graphics3DGraphicsByObjectID}get symbolUpdateType(){var s;return(s=this.graphicsCore)==null?void 0:s.symbolUpdateType}get displayFeatureLimit(){var i;const s=this.view.quality,e=(i=this.graphicsCore)==null?void 0:i.displayFeatureLimit;if(s===1)return e;const t=Math.ceil(e.maximumNumberOfFeatures*s);return new nt(e.maximumTotalNumberOfVertices,t,e.averageSymbolComplexity)}get usedMemory(){var s;return((s=this.graphicsCore)==null?void 0:s.usedMemory)??0}get loadedFeatures(){var s;return((s=this.graphicsCore)==null?void 0:s.numberOfGraphics)??0}get usedMemoryPerFeature(){var s;return((s=this.graphicsCore)==null?void 0:s.usedMemoryPerGraphic)??0}get unprocessedMemoryEstimate(){var s;return((s=this.graphicsCore)==null?void 0:s.unprocessedMemoryEstimate)??0}get performanceInfo(){return{core:this.graphicsCore.performanceInfo,elevationUpdating:this.elevationAlignment.updating,visibilityFrustum:this.frustumVisibility==null||!this.frustumVisibility.suspended,visibilityScale:!this.scaleVisibilitySuspended}}maskOccludee(s){const{set:e,handle:t}=this.objectStates.acquireSet(W.MaskOccludee,null);return this.objectStates.setUid(e,s.uid),t}highlight(s,e){if(s instanceof U){const{set:t,handle:i}=this.objectStates.acquireSet(W.Highlight,e);return this.owner.queryObjectIds(s).then(r=>this.objectStates.setObjectIds(t,r)),i}if(typeof s=="number"||typeof s=="string")return this.highlight([s],e);if(s instanceof z)return this.highlight([s],e);if("toArray"in s&&(s=s.toArray()),Array.isArray(s)&&s.length>0){if(s[0]instanceof z){const t=s;if(Ue(this.layer.fieldsIndex,t[0].attributes,e)==null){const i=t.map(l=>l.uid),{set:r,handle:a}=this.objectStates.acquireSet(W.Highlight,null);return this.objectStates.setUids(r,i),a}s=t.map(i=>Ue(this.layer.fieldsIndex,i.attributes,e))}if(Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string")){const t=s,{set:i,handle:r}=this.objectStates.acquireSet(W.Highlight,e);return this.objectStates.setObjectIds(i,t),r}}return X()}resetObjectStates(){this.objectStates.reset()}whenGraphicBounds(s,e){var t;return(t=this.graphicsCore)==null?void 0:t.whenGraphicBounds(s,e)}computeAttachmentOrigin(s,e){var t;return(t=this.graphicsCore)==null?void 0:t.computeAttachmentOrigin(s,e)}notifyGraphicGeometryChanged(s){this.graphicsCore.notifyGraphicGeometryChanged(s)}notifyGraphicVisibilityChanged(s){this.graphicsCore.notifyGraphicVisibilityChanged(s)}getRenderingInfo(s,e,t){var r;const i=Kt(s,{renderer:e,arcade:t});if(i!=null&&i.color){const a=i.color;a[0]=a[0]/255,a[1]=a[1]/255,a[2]=a[2]/255}if(i!=null&&e!=null&&((r=this._randomRotationRenderers)!=null&&r.has(e))){const a=this._randomRotationRenderers.get(e),l=s.attributes[a],u=new es(0);u.updateFloatArray([l]),u.updateUint8Array([173]),i.heading=8381e-11*u.digest()}return i}getRenderingInfoAsync(s,e,t,i){return ei(s,{renderer:e,arcade:t,...i})}getSymbolLayerSize(s,e){var t;return(t=this.graphicsCore)==null?void 0:t.getSymbolLayerSize(s,e)}setObjectIdVisibility(s,e){var t;(t=this.graphicsCore)==null||t.setObjectIdVisibility(s,e)}refreshFilter(){this.filterVisibility!=null&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(s){var e;return(e=this.graphicsCore)==null?void 0:e.getGraphics3DGraphicByObjectId(s)}_updateClippingExtent(){const s=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(s,this.owner.view.spatialReference)&&(this.updateClippingExtent(s)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.addHandles(T(()=>this.suspendResumeExtentMode,()=>{switch(this.removeHandles(ae),this.suspendResumeExtentMode){case"computed":this.addHandles([T(()=>this.graphicsCore.computedExtent,s=>this._updateSuspendResumeExtent(s),O),T(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent))],ae);break;case"data":this.addHandles([ii(()=>this.dataExtent,s=>this._updateSuspendResumeExtent(s),O),T(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.dataExtent))],ae);break;default:ti(this.suspendResumeExtentMode)}},O))}_updateSuspendResumeExtent(s){s?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(s,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(s,e){const t=this.owner.view.spatialReference;if(!s.spatialReference.equals(t)){if(!si(s,t))return;s=ri(s,t)}return ai(s,e,ni,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(s){this.frustumVisibility!=null&&this.frustumVisibility.setExtent(s),this.scaleVisibility!=null&&this.scaleVisibility.setExtent(s)}};n([o()],m.prototype,"type",void 0),n([o({constructOnly:!0})],m.prototype,"owner",void 0),n([o()],m.prototype,"layer",null),n([o()],m.prototype,"renderer",null),n([o({constructOnly:!0})],m.prototype,"updateClippingExtent",void 0),n([o({constructOnly:!0})],m.prototype,"elevationFeatureExpressionEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"graphicsCore",void 0),n([o({constructOnly:!0})],m.prototype,"scaleVisibilityEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"filterVisibilityEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"frustumVisibilityEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"elevationAlignmentEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"timeExtentEnabled",void 0),n([o({constructOnly:!0})],m.prototype,"setUidToIdOnAdd",void 0),n([o()],m.prototype,"scaleVisibility",null),n([o()],m.prototype,"filterVisibility",null),n([o()],m.prototype,"elevationAlignment",null),n([o({constructOnly:!0})],m.prototype,"frustumVisibility",void 0),n([o()],m.prototype,"objectStates",null),n([o()],m.prototype,"initializePromise",void 0),n([o()],m.prototype,"suspendResumeExtentMode",null),n([o()],m.prototype,"dataExtent",void 0),n([o()],m.prototype,"scaleVisibilitySuspended",null),n([o()],m.prototype,"suspended",null),n([o()],m.prototype,"legendEnabled",null),n([o()],m.prototype,"suspendInfo",null),n([o()],m.prototype,"updating",null),n([o()],m.prototype,"updatingRemaining",null),n([o()],m.prototype,"featureStore",null),n([o()],m.prototype,"view",null),n([o()],m.prototype,"loadedGraphics",null),n([o()],m.prototype,"fullOpacity",null),n([o()],m.prototype,"filter",null),n([o()],m.prototype,"slicePlaneEnabled",null),n([o()],m.prototype,"drapeSourceType",void 0),n([o()],m.prototype,"updatePolicy",null),n([o()],m.prototype,"preferredUpdatePolicy",void 0),n([o({readOnly:!0})],m.prototype,"displayFeatureLimit",null),m=n([M("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],m);const ae="suspendResumeExtentMode";function ut(s){const e=new Ze;e.include(oi),e.include(li);const{usesHalfFloat:t}=s;return e.fragment.uniforms.add(new Re("densityMap",i=>i.densityMap),new Re("tex",i=>i.colorRamp),new K("densityNormalizer",i=>1/(i.maxDensity-i.minDensity)),new K("minDensity",i=>i.minDensity),new K("densityMultiplier",i=>3/(i.searchRadius*i.searchRadius*Math.PI))),t&&e.constants.add("compressionFactor","float",4),e.fragment.code.add(N` - void main() { - float density = texture(densityMap, uv).r * densityMultiplier${t?N` * compressionFactor`:""}; - float densityRatio = (density - minDensity) * densityNormalizer; - - vec4 color = texture(tex, vec2(clamp(densityRatio, 0.0, 1.0), 0.5)); - - discardOrAdjustAlpha(color); - fragColor = color; - } - `),e}const Os=Object.freeze(Object.defineProperty({__proto__:null,build:ut},Symbol.toStringTag,{value:"Module"}));let Vs=class extends di{constructor(){super(...arguments),this.colorRamp=null,this.densityMap=null,this.searchRadius=1,this.fieldTotal=0,this.minDensity=0,this.maxDensity=100}},ht=class dt extends Ke{constructor(e,t){super(e,t,()=>this.destroy())}initializeProgram(e){return new et(e.rctx,dt.shader.get().build(this.configuration),tt)}initializePipeline(){return it({blending:ui,colorWrite:st,depthTest:null,depthWrite:null})}get primitiveType(){return hi.TRIANGLE_STRIP}};ht.shader=new Ye(Os,()=>Xe(()=>Promise.resolve().then(()=>qs),void 0));let ct=class extends rt{constructor(){super(...arguments),this.usesHalfFloat=!1}};n([he()],ct.prototype,"usesHalfFloat",void 0);let R=class extends ci{constructor(s){super(s),this.pixelRatio=1,this._colorRampData=new Uint8ClampedArray(4),this.type="draped-heatmap",this._heatmapParameters=new Vs;const e=new Te;e.pixelFormat=s.pixelFormat,e.internalFormat=s.internalFormat,e.dataType=s.dataType,e.samplingMode=s.samplingMode,e.wrapMode=Se.CLAMP_TO_EDGE;const t=s.rendererContext.rctx;this._densityMap=new pi(t,e),this._quad=yi(t);const i=new ct;i.usesHalfFloat=s.dataType!==G.FLOAT,this._technique=new ht({rctx:t,viewingMode:ke.Local},i)}initialize(){const s=this._colorRampData,e=new Te(s.length/4,1);e.wrapMode=Se.CLAMP_TO_EDGE,this._colorRamp=new mi(this.rctx,e,s),this._heatmapParameters.densityMap=this._densityMap.colorTexture,this.addHandles(T(()=>[this.colorRampData,this.minDensity,this.maxDensity,this.fieldTotal,this.pixelRatio,this.searchRadius],()=>this.rendererContext.notifyContentChanged()))}destroy(){this._technique=_i(this._technique),this._densityMap=ie(this._densityMap),this._quad=ie(this._quad),this._colorRamp=ie(this._colorRamp)}get searchRadius(){return this._heatmapParameters.searchRadius}set searchRadius(s){s!==this._heatmapParameters.searchRadius&&(this._heatmapParameters.searchRadius=s,this.notifyChange("searchRadius"))}get minDensity(){return this._heatmapParameters.minDensity}set minDensity(s){s!==this._heatmapParameters.minDensity&&(this._heatmapParameters.minDensity=s,this.notifyChange("minDensity"))}get maxDensity(){return this._heatmapParameters.maxDensity}set maxDensity(s){s!==this._heatmapParameters.maxDensity&&(this._heatmapParameters.maxDensity=s,this.notifyChange("maxDensity"))}get fieldTotal(){return this._heatmapParameters.fieldTotal}set fieldTotal(s){this._heatmapParameters.fieldTotal=s,this.notifyChange("fieldTotal")}get colorRampData(){return this._colorRampData}set colorRampData(s){const{colorRamp:e}=this._heatmapParameters;if(e!=null&&s!==this._colorRampData){const t=e.descriptor.width,i=s.length/4;i!==t&&e.resize(i,1),e.setData(s)}this._colorRampData=s}get _colorRamp(){return this._heatmapParameters.colorRamp}set _colorRamp(s){this._heatmapParameters.colorRamp=s}get hasHighlights(){return!1}get hasWater(){return!1}get rendersOccluded(){return!1}render(s){const e=this._sortedMaterialRenderers;if(e.length===0)return;const t=this.rctx.getBoundFramebufferObject(),i=this.rctx.getViewport(),{pixelRatio:r}=this,a=Math.ceil(i.width*r),l=Math.ceil(i.height*r);this._densityMap.resize(a,l),this.rctx.bindFramebuffer(this._densityMap),this.rctx.setViewport(0,0,a,l),this.rctx.clear(fi.COLOR_BUFFER_BIT);let u=!1;e.forAll(d=>{const c=d.prepareTechnique(s);c!=null&&(d.renderNode(s,c),u=!0)}),this.rctx.bindFramebuffer(t),this.rctx.setViewport(i.x,i.y,i.width,i.height),u&&(this.rctx.bindVAO(this._quad),this.rctx.bindTechnique(this._technique,this._heatmapParameters,s.bindParameters),this.rctx.drawArrays(this._technique.primitiveType,0,gi(this._quad,"geometry")))}};n([o()],R.prototype,"searchRadius",null),n([o()],R.prototype,"minDensity",null),n([o()],R.prototype,"maxDensity",null),n([o()],R.prototype,"fieldTotal",null),n([o()],R.prototype,"pixelRatio",void 0),n([o()],R.prototype,"colorRampData",null),n([o({constructOnly:!0})],R.prototype,"dataType",void 0),n([o({constructOnly:!0})],R.prototype,"samplingMode",void 0),n([o({constructOnly:!0})],R.prototype,"pixelFormat",void 0),n([o({constructOnly:!0})],R.prototype,"internalFormat",void 0),n([o()],R.prototype,"_colorRampData",void 0),R=n([M("esri.views.3d.webgl-engine.lib.DrapedHeatmapRenderer")],R);function pt(s){const e=new Ze,{vertex:t,fragment:i,attributes:r,varyings:a}=e;Fi(t,s);const{isAttributeDriven:l,usesHalfFloat:u}=s;return r.add(v.POSITION,"vec3"),r.add(v.UV0,"vec2"),l&&(r.add(v.FEATUREATTRIBUTE,"float"),a.add("attributeValue","float")),u&&e.constants.add("compressionFactor","float",.25),a.add("unitCirclePos","vec2"),t.uniforms.add(new K("radius",({resolutionForScale:d,searchRadius:c},{camera:y,screenToWorldRatio:h,overlayStretch:_})=>2*c*(d===0?1:d/h)*y.pixelRatio/y.fullViewport[2]/_)),t.code.add(N` - void main() { - unitCirclePos = uv0; - - vec4 posProj = proj * (view * vec4(${v.POSITION}, 1.0)); - vec4 quadOffset = vec4(unitCirclePos * radius, 0.0, 0.0); - - ${l?N`attributeValue = ${v.FEATUREATTRIBUTE};`:""} - gl_Position = posProj + quadOffset; - } - `),i.code.add(N` - void main() { - float radiusRatioSquared = dot(unitCirclePos, unitCirclePos); - if (radiusRatioSquared > 1.0) { - discard; - } - - float oneMinusRadiusRatioSquared = 1.0 - radiusRatioSquared; - float density = oneMinusRadiusRatioSquared * oneMinusRadiusRatioSquared ${l?N` * attributeValue`:""} ${u?N` * compressionFactor`:""}; - fragColor = vec4(density); - } - `),e}const Is=Object.freeze(Object.defineProperty({__proto__:null,build:pt},Symbol.toStringTag,{value:"Module"}));let Ps=class extends Ei{constructor(){super(...arguments),this.searchRadius=128,this.resolutionForScale=0}};class te extends Ke{initializeProgram(e){return new et(e.rctx,te.shader.get().build(this.configuration),tt)}initializePipeline(){return it({blending:bi(Ce.ONE,Ce.ONE,xi.ADD),colorWrite:st,depthTest:null,depthWrite:null})}destroy(){super.destroy()}}te.shader=new Ye(Is,()=>Xe(()=>Promise.resolve().then(()=>zs),void 0));let de=class extends rt{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloat=!1}};n([he()],de.prototype,"isAttributeDriven",void 0),n([he()],de.prototype,"usesHalfFloat",void 0);const $s=2;class Ms extends Ps{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class je extends wi{constructor(e){super(e,new Ms),this._configuration=new de}produces(e,t){return e===Ri.DRAPED_MATERIAL&&t===Ti.Color}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}createGLMaterial(e){return new As(e)}intersect(){}intersectDraped(e,t,i,r,a,l){const u=e.attributes.get(v.POSITION),{parameters:d}=this,{searchRadius:c}=d,{screenToWorldRatio:y}=e,h=c*y+$s*y,_=h*h,b=u.data.length/u.size;for(let w=0;wthis._loadedPointGraphics.length,setAllFeaturesVisibility:a=>this._setAllFeaturesVisibility(a),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:a=>this._updateFeatureVisibilities(a)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,a=>this._onLoadedFeaturesChange(a),O),this._updatingHandles.addWhen(()=>this._materialParameters,a=>this._forEachMaterial(l=>l.setParameters(a)),O),this._updatingHandles.add(()=>this._rendererParameters,a=>this._drapeSourceRenderer.set(a)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},ue),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:a,numeric:l})=>{if(a!=null&&l){let u=0;this._featureStore.forEach(d=>u+=d.attributes[a]??0),this._fieldTotal=u}else this._fieldTotal=this._featureStore.numFeatures},O),this.addHandles([T(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:a,field:l})=>{a&&!l&&Y.warn(`Heatmap renderer field '${a}' for layer '${this.layer.title??this.layer.id}' not found`)}),T(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:a,numeric:l})=>{a==null||l||Y.warn(`Heatmap renderer field '${a.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),X(()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){var i,r,a,l;const s=((r=(i=this.owner)==null?void 0:i.view)==null?void 0:r.quality)??1,e=(l=(a=this.owner)==null?void 0:a.view)==null?void 0:l.qualitySettings,t=e?Math.ceil(e.heatmap.maxTotalNumberOfFeatures*s):0;return new nt(t*6,t)}get hasZ(){return"hasZ"in this.layer&&this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:s,maxScale:e}=this.layer.effectiveScaleRange,{scale:t}=this.view;return!Pi(t,s??0,e??0)}get usedMemory(){var r,a;const s=this.usedMemoryPerFeature*this._featureStore.numFeatures,e=this._pixelFormat===I.RED?1:4,t=this._dataType===G.FLOAT?4:2,i=Math.ceil((((a=(r=this._overlayRenderer)==null?void 0:r.overlays[0])==null?void 0:a.resolution)??0)*this._densityMapPixelRatio)??0;return i*i*e*t+s}get usedMemoryPerFeature(){const s=this._loadedPointGraphics.find(()=>!0);if(s==null)return 0;const e=$i(s),t=Wi(),i=6;return i*Oe([0,0,0],t)+i*Oe([0,0],t)+(this._heatmapRendererFieldIsNumeric?i*t:0)+e}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return{core:{visible:this._visibleFeatures,missing:0,pending:0},elevationUpdating:!1,visibilityFrustum:!0,visibilityScale:!0}}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const s=this._heatmapRenderer;if(s==null)return null;const{minDensity:e,maxDensity:t}=s;return{minDensity:e,maxDensity:t,fieldTotal:this._fieldTotal}}get _radiusParameter(){const s=this._heatmapRenderer;return s?{searchRadius:Mi(this._clampSearchRadius(s.radius))}:null}get _resolutionForScaleParameter(){const s=this._heatmapRenderer;if(!s)return null;const{referenceScale:e}=s;return{resolutionForScale:e===0?0:Ai(e,this.view.spatialReference)}}get _colorRampParameter(){const s=this._heatmapRenderer;return s?{colorRampData:Li(s.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){var s,e;return((e=(s=this.owner)==null?void 0:s.view)==null?void 0:e.qualitySettings.heatmap.pixelRatio)??1}get _renderView(){return this.view._stage.renderView}get _featuresArePoints(){return this.layer.geometryType==="point"}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const s=this.layer.renderer;return(s==null?void 0:s.type)==="heatmap"?s:null}get _heatmapRendererFieldName(){var s;return(s=this._heatmapRenderer)==null?void 0:s.field}get _heatmapRendererField(){const s=this._heatmapRendererFieldName;return s!=null?this.layer.fieldsIndex.get(s):null}get _heatmapRendererFieldIsNumeric(){const s=this._heatmapRendererField;return s!=null&&Ni(s)}get _isScaleRangeActive(){const{layer:s}=this;if(!("effectiveScaleRange"in s))return!1;const{minScale:e,maxScale:t}=s.effectiveScaleRange;return Hi(e,t)}get _visibleFeatures(){let s=0;return this._renderGeometries.forEach(e=>{e.visible&&++s}),s}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlight(){return X()}maskOccludee(){return X()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(s){if(!this._featuresArePoints)return;const{objectIdField:e}=this.layer;this._featureStore.removeManyById(s.removed.map(l=>D(l,e))),this._featureStore.addMany(s.added.map(l=>{const{attributes:u,centroid:d,geometry:c}=l,y=new Gi(Ve(new Me,c),u,d?Ve(new Me,d):null,D(l,e));return y.displayId=l.uid,y}));const t=s.added,i=s.removed;this._fieldTotal+=this._computeFieldTotalChange(t,i);const r=i.map(({uid:l})=>{const u=this._renderGeometries.get(l);return this._renderGeometries.delete(l),u}).filter(qi),a=t.map(l=>{const u=this._pointGraphicToRenderGeometry(l);return this._renderGeometries.set(l.uid,u),u});r.length>0&&this._drapeSourceRenderer.removeGeometries(r,Ie.REMOVE),a.length>0&&this._drapeSourceRenderer.addGeometries(a,Ie.ADD),(a.length>0||r.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const s=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:s,removed:s})}_pointGraphicToRenderGeometry(s){const e=this._heatmapRendererFieldName,t=e!=null?this._materialWithField:this._material,i=Ji();zi(s.geometry,i,this._overlaySpatialReference),i[2]=Ui;const r=ji(1),a=[[v.POSITION,new Pe(i,r,i.length)]],l=this._heatmapRendererFieldIsNumeric;e!=null&&a.push([v.FEATUREATTRIBUTE,new Pe([l?s.attributes[e]??0:0],r,1)]);const u=new Qi(new ki(t,a,null,Bi.Point),{layerUid:this.layer.uid,graphicUid:s.uid});return u.visible=this.filterVisibility.defaultVisibility,u}_forEachMaterial(s){s(this._material),s(this._materialWithField)}_computeFieldTotalChange(s,e){if(this._heatmapRendererFieldName==null||!this._heatmapRendererFieldIsNumeric)return s.length-e.length;const t=this._heatmapRendererFieldName,i=(r,a)=>r+(a.attributes[t]??0);return s.reduce(i,0)-e.reduce(i,0)}_clampSearchRadius(s){return s>oe&&Y.warnOnce(`SceneView supports a maximum radius of ${oe} pt for HeatmapRenderer.`),Math.min(s,oe)}_updateFeatureVisibilities(s){const e=[];this._featureStore.forEach(({objectId:t,displayId:i})=>{const r=s(t),a=this._renderGeometries.get(i);a&&a.visible!==r&&(e.push(a),a.visible=r)}),this._drapeSourceRenderer.modifyGeometries(e,$e.VISIBILITY)}_setAllFeaturesVisibility(s){const e=[];for(const t of this._renderGeometries.values())t.visible!==s&&(e.push(t),t.visible=s);this._drapeSourceRenderer.modifyGeometries(e,$e.VISIBILITY)}get test(){return{visibleFeatureCount:this._visibleFeatures}}};n([o()],p.prototype,"type",void 0),n([o({constructOnly:!0})],p.prototype,"owner",void 0),n([o()],p.prototype,"layer",null),n([o()],p.prototype,"featureStore",null),n([o()],p.prototype,"updating",null),n([o()],p.prototype,"updatingRemaining",null),n([o()],p.prototype,"suspendInfo",null),n([o()],p.prototype,"legendEnabled",null),n([o()],p.prototype,"filterVisibility",null),n([o()],p.prototype,"displayFeatureLimit",null),n([o()],p.prototype,"preferredUpdatePolicy",void 0),n([o()],p.prototype,"hasZ",null),n([o()],p.prototype,"hasM",null),n([o()],p.prototype,"dataExtent",void 0),n([o()],p.prototype,"view",null),n([o()],p.prototype,"fullOpacity",null),n([o()],p.prototype,"updatePolicy",null),n([o()],p.prototype,"drapeSourceType",void 0),n([o()],p.prototype,"scaleVisibilitySuspended",null),n([o()],p.prototype,"renderer",null),n([o()],p.prototype,"_featureStore",void 0),n([o()],p.prototype,"_filterVisibility",void 0),n([o()],p.prototype,"_overlayRenderer",null),n([o()],p.prototype,"_overlaySpatialReference",null),n([o()],p.prototype,"_rendererParameters",null),n([o()],p.prototype,"_materialParameters",null),n([o()],p.prototype,"_densityParameters",null),n([o()],p.prototype,"_radiusParameter",null),n([o()],p.prototype,"_resolutionForScaleParameter",null),n([o()],p.prototype,"_colorRampParameter",null),n([o()],p.prototype,"_pixelRatioParameter",null),n([o()],p.prototype,"_densityMapPixelRatio",null),n([o()],p.prototype,"_renderGeometries",void 0),n([o()],p.prototype,"_material",void 0),n([o()],p.prototype,"_materialWithField",void 0),n([o()],p.prototype,"_renderView",null),n([o()],p.prototype,"_featuresArePoints",null),n([o()],p.prototype,"_loadedPointGraphics",null),n([o()],p.prototype,"_heatmapRenderer",null),n([o()],p.prototype,"_heatmapRendererFieldName",null),n([o()],p.prototype,"_heatmapRendererField",null),n([o()],p.prototype,"_heatmapRendererFieldIsNumeric",null),n([o()],p.prototype,"_fieldTotal",void 0),n([o()],p.prototype,"_drapeSourceRenderer",void 0),n([o()],p.prototype,"_isScaleRangeActive",null),p=n([M(mt)],p);const hr=s=>{let e=class extends s{constructor(){super(...arguments),this.controller=null,this.updatePolicy=ye.SYNC,this.suspendResumeExtentMode="computed",this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null,this.suspendResumeExtent=null,this._controllerCreated=!1,this.supportsHeightUnitConversion=!0,this._pendingController=null,this.queryEngine=null}initialize(){const t=this.layer;if("isTable"in t&&t.isTable)return void this.addResolvingPromise(Promise.reject(new P("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:t})));this.addResolvingPromise(this._validateGeometryType()),this._updatingHandles.add(()=>this.layer.renderer,r=>this._recreateProcessor(r),O),this.addResolvingPromise((async()=>{const r=await ls(this);this.fullExtentInLocalViewSpatialReference=r,await this._initializeController()})()),this._updatingHandles.add(()=>this.updatePolicy,r=>this.processor.preferredUpdatePolicy=r);const i=()=>this.processor.featureStore;this.queryEngine=new V({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return i()},hasZ:this.hasZ,hasM:this.hasM},priority:pe.FEATURE_QUERY_ENGINE}),this.notifyChange("updating")}destroy(){this._destroyPendingController(),this.controller=$(this.controller),this._set("processor",$(this.processor)),this.queryEngine=$(this.queryEngine),this.loadedGraphics=null}_destroyPendingController(){this._pendingController=$(this._pendingController)}get legendEnabled(){var t;return this.canResume()&&((t=this.processor)==null?void 0:t.legendEnabled)}get graphics3DProcessor(){var t;return((t=this.processor)==null?void 0:t.type)==="graphics-3d"?this.processor:null}get heatmapProcessor(){var t;return((t=this.processor)==null?void 0:t.type)==="heatmap"?this.processor:null}get symbologySnappingSupported(){var i,r;const t=(r=(i=this.layer)==null?void 0:i.renderer)==null?void 0:r.getSymbols();return(t==null?void 0:t.some(Zi))??!1}getHit(t){var r;let i;return(r=this.loadedGraphics)==null||r.forEach(a=>{a.uid===t&&(i=Yi(a,this.layer))}),i?{type:"graphic",graphic:i,layer:i.layer}:null}whenGraphicBounds(t,i){var r;return(r=this.processor)==null?void 0:r.whenGraphicBounds(t,i)}computeAttachmentOrigin(t,i){var r;return(r=this.processor)==null?void 0:r.computeAttachmentOrigin(t,i)}async elevationAlignPointsInFeatures(t,i){const r=this.graphics3DProcessor;if(r==null)throw new P("featurelayerview3d:missing-processor","A Graphics3D processor is needed to resolve graphics elevation.");return Xi(this.view,this.layer,a=>r.getGraphics3DGraphicByObjectId(a),t,i)}async queryForSymbologySnapping(t,i){return this.symbologySnappingSupported?Ki(this.graphics3DProcessor,t,i):{candidates:[],sourceCandidateIndices:[]}}queryFeatures(t,i){return this.queryEngine.executeQuery(this._ensureQuery(t),i==null?void 0:i.signal)}queryObjectIds(t,i){return this.queryEngine.executeQueryForIds(this._ensureQuery(t),i==null?void 0:i.signal)}queryFeatureCount(t,i){return this.queryEngine.executeQueryForCount(this._ensureQuery(t),i==null?void 0:i.signal)}queryExtent(t,i){return this.queryEngine.executeQueryForExtent(this._ensureQuery(t),i==null?void 0:i.signal)}_ensureQuery(t){return t==null?this.createQuery():U.from(t)}highlight(t){return this.processor.highlight(t,this.layer.objectIdField)}maskOccludee(t){return this.processor.maskOccludee(t)}canResume(){var t;return super.canResume()&&!((t=this.processor)!=null&&t.scaleVisibilitySuspended)}getSuspendInfo(){const t=super.getSuspendInfo();return this.processor?{...t,...this.processor.suspendInfo}:t}isUpdating(){var t,i,r;return!(!this.processor||this.processor.destroyed)&&!(this._controllerCreated&&!((t=this.controller)!=null&&t.updating)&&((r=(i=this.view)==null?void 0:i.basemapTerrain)!=null&&r.ready)&&!this.processor.updating)}async _initializeController(){const t=this.createController();this._pendingController=t,await t.when(),this._setControllerWhenInitialized(t)}async _setControllerWhenInitialized(t){try{await this.when()}catch{}this._controllerCreated=!0,this.notifyChange("updating"),this.isResolved()&&!this.destroyed?(await We(()=>{var i,r;return(r=(i=this.view)==null?void 0:i.basemapTerrain)==null?void 0:r.ready}),this.beforeSetController(t),this._pendingController=null,this.controller=t,this.loadedGraphics=t.graphics,this.notifyChange("updating")):this._destroyPendingController()}_updateClippingExtent(t){if(this.clippingExtent=t,!this.controller)return!1;switch(this.controller.type){case"stream":return!1;case"feature-tile-3d":return this.controller.extent=t,!0}}async _validateGeometryType(){switch(this.layer.geometryType){case"multipatch":case"multipoint":throw new P("featurelayerview3d:unsupported-geometry-type","Unsupported geometry type ${geometryType}",{geometryType:this.layer.geometryType})}}_recreateProcessor(t){var u,d;const i=(t==null?void 0:t.type)==="heatmap",r=((u=this.processor)==null?void 0:u.type)==="heatmap",a=this.processor;if(a&&i===r)return;const l=i?new p({owner:this}):new m({owner:this,frustumVisibilityEnabled:!0,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!0,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!0,preferredUpdatePolicy:this.updatePolicy,updateClippingExtent:c=>this._updateClippingExtent(c)});this._set("processor",l),a==null||a.destroy(),(d=this.queryEngine)==null||d.clear(),this.addResolvingPromise(l.initializePromise)}_getResourceInfo(){var i;const t=this.controller instanceof g?this.controller:null;return{displayedNumberOfFeatures:(i=this.loadedGraphics)==null?void 0:i.length,maximumNumberOfFeatures:(t==null?void 0:t.maximumNumberOfFeatures)??-1,totalNumberOfFeatures:(t==null?void 0:t.serviceDataCount)??-1,nodes:0,...this.processor.performanceInfo}}get performanceInfo(){return this._getResourceInfo()}};return n([o()],e.prototype,"loadedGraphics",void 0),n([o()],e.prototype,"suspended",void 0),n([o({readOnly:!0})],e.prototype,"legendEnabled",null),n([o()],e.prototype,"updating",void 0),n([o()],e.prototype,"controller",void 0),n([o()],e.prototype,"processor",void 0),n([o({readOnly:!0})],e.prototype,"updatePolicy",void 0),n([o({readOnly:!0})],e.prototype,"suspendResumeExtentMode",void 0),n([o({type:Boolean})],e.prototype,"slicePlaneEnabled",void 0),n([o({readOnly:!0})],e.prototype,"suspendInfo",void 0),n([o()],e.prototype,"graphics3DProcessor",null),n([o()],e.prototype,"heatmapProcessor",null),n([o()],e.prototype,"symbologySnappingSupported",null),e=n([M("esri.views.3d.layers.FeatureLikeLayerView3D")],e),e},qs=Object.freeze(Object.defineProperty({__proto__:null,build:ut},Symbol.toStringTag,{value:"Module"})),zs=Object.freeze(Object.defineProperty({__proto__:null,build:pt},Symbol.toStringTag,{value:"Module"}));export{hr as E,ir as I,m as P,g as T,V as l,Ue as n}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = [] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/HeatmapProcessor-QI9jD0nx.js b/dist/assets/HeatmapProcessor-E3j18Ktz.js similarity index 91% rename from dist/assets/HeatmapProcessor-QI9jD0nx.js rename to dist/assets/HeatmapProcessor-E3j18Ktz.js index 3238376..fd59067 100644 --- a/dist/assets/HeatmapProcessor-QI9jD0nx.js +++ b/dist/assets/HeatmapProcessor-E3j18Ktz.js @@ -1 +1 @@ -import{e as k,c as K,c4 as _,hb as F}from"./index-J0iiHjMT.js";import{c as S}from"./definitions-DqQMJYPH.js";import{p as U,o}from"./BaseProcessor-nWGHAt7P.js";class n{constructor(t,i){this.offset=t,this.extent=i}}function v(s){const t=s.key,i=new Map,r=256,e=S,a=s.tileInfoView.tileInfo.isWrappable;return i.set(o(t,-1,-1,a).id,new n([-e,-e],[e-r,e-r,e,e])),i.set(o(t,0,-1,a).id,new n([0,-e],[0,e-r,e,e])),i.set(o(t,1,-1,a).id,new n([e,-e],[0,e-r,r,e])),i.set(o(t,-1,0,a).id,new n([-e,0],[e-r,0,e,e])),i.set(o(t,1,0,a).id,new n([e,0],[0,0,r,e])),i.set(o(t,-1,1,a).id,new n([-e,e],[e-r,0,e,r])),i.set(o(t,0,1,a).id,new n([0,e],[0,0,e,r])),i.set(o(t,1,1,a).id,new n([e,e],[0,0,r,r])),i}let h=class extends U{constructor(){super(...arguments),this.type="heatmap",this._tileKeyToFeatureSets=new Map}initialize(){this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this))])}async update(s,t){const i=t.schema.processors[0];i.type==="heatmap"&&_(this._schema,i)&&(s.mesh=!0,this._schema=i)}onTileUpdate(s){for(const t of s.removed)this._tileKeyToFeatureSets.delete(t.key.id)}onTileClear(s){const t={clear:!0};return this._tileKeyToFeatureSets.delete(s.key.id),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:s.id,data:t})}async onTileMessage(s,t,i){this._tileKeyToFeatureSets.has(s.key.id)||this._tileKeyToFeatureSets.set(s.key.id,new Map);const r=this._tileKeyToFeatureSets.get(s.key.id);if(r&&t.addOrUpdate!=null&&t.addOrUpdate.hasFeatures&&r.set(t.addOrUpdate.instance,t),t.end){const e=[],a=v(s);this._tileKeyToFeatureSets.forEach((p,l)=>{if(l===s.key.id)p.forEach(({addOrUpdate:d})=>{d&&e.push(d)});else if(a.has(l)){const d=a.get(l),[m,T]=d.offset;p.forEach(({addOrUpdate:f})=>{if(f){const w=f.transform(m,T,1,1);e.push(w)}})}});const c=F(e,this._schema.mesh,512,512),u={tileKey:s.key.id,intensityInfo:c},y=[c.matrix];return this.remoteClient.invoke("tileRenderer.onTileData",u,{...i,transferList:y})}}onTileError(s,t,i){return this.remoteClient.invoke("tileRenderer.onTileError",{tileKey:s.id,error:t},i)}};h=k([K("esri.views.2d.layers.features.processors.HeatmapProcessor")],h);const x=h;export{x as default}; +import{e as k,c as K,aF as _,hd as F}from"./index-pCX-0tJH.js";import{c as S}from"./definitions-SVBNHUSH.js";import{p as U,o}from"./BaseProcessor-yc_MfkjR.js";class n{constructor(t,i){this.offset=t,this.extent=i}}function v(s){const t=s.key,i=new Map,r=256,e=S,a=s.tileInfoView.tileInfo.isWrappable;return i.set(o(t,-1,-1,a).id,new n([-e,-e],[e-r,e-r,e,e])),i.set(o(t,0,-1,a).id,new n([0,-e],[0,e-r,e,e])),i.set(o(t,1,-1,a).id,new n([e,-e],[0,e-r,r,e])),i.set(o(t,-1,0,a).id,new n([-e,0],[e-r,0,e,e])),i.set(o(t,1,0,a).id,new n([e,0],[0,0,r,e])),i.set(o(t,-1,1,a).id,new n([-e,e],[e-r,0,e,r])),i.set(o(t,0,1,a).id,new n([0,e],[0,0,e,r])),i.set(o(t,1,1,a).id,new n([e,e],[0,0,r,r])),i}let h=class extends U{constructor(){super(...arguments),this.type="heatmap",this._tileKeyToFeatureSets=new Map}initialize(){this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this))])}async update(s,t){const i=t.schema.processors[0];i.type==="heatmap"&&_(this._schema,i)&&(s.mesh=!0,this._schema=i)}onTileUpdate(s){for(const t of s.removed)this._tileKeyToFeatureSets.delete(t.key.id)}onTileClear(s){const t={clear:!0};return this._tileKeyToFeatureSets.delete(s.key.id),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:s.id,data:t})}async onTileMessage(s,t,i){this._tileKeyToFeatureSets.has(s.key.id)||this._tileKeyToFeatureSets.set(s.key.id,new Map);const r=this._tileKeyToFeatureSets.get(s.key.id);if(r&&t.addOrUpdate!=null&&t.addOrUpdate.hasFeatures&&r.set(t.addOrUpdate.instance,t),t.end){const e=[],a=v(s);this._tileKeyToFeatureSets.forEach((p,l)=>{if(l===s.key.id)p.forEach(({addOrUpdate:d})=>{d&&e.push(d)});else if(a.has(l)){const d=a.get(l),[m,T]=d.offset;p.forEach(({addOrUpdate:f})=>{if(f){const w=f.transform(m,T,1,1);e.push(w)}})}});const c=F(e,this._schema.mesh,512,512),u={tileKey:s.key.id,intensityInfo:c},y=[c.matrix];return this.remoteClient.invoke("tileRenderer.onTileData",u,{...i,transferList:y})}}onTileError(s,t,i){return this.remoteClient.invoke("tileRenderer.onTileError",{tileKey:s.id,error:t},i)}};h=k([K("esri.views.2d.layers.features.processors.HeatmapProcessor")],h);const x=h;export{x as default}; diff --git a/dist/assets/HoveredPoints-BD2phuV6.js b/dist/assets/HoveredPoints-dZcdNiOr.js similarity index 89% rename from dist/assets/HoveredPoints-BD2phuV6.js rename to dist/assets/HoveredPoints-dZcdNiOr.js index 90cbeba..79a5ea0 100644 --- a/dist/assets/HoveredPoints-BD2phuV6.js +++ b/dist/assets/HoveredPoints-dZcdNiOr.js @@ -1 +1 @@ -import{e as c,y as l,c as p,p as v,V as m,d as P,A as y,gL as b}from"./index-J0iiHjMT.js";import{c as x}from"./AnchorElementViewModel-SDYg-P9c.js";let a=class extends v{constructor(e){super(e),this._hoveredPoints=new m}initialize(){this.addHandles(P(()=>this._hoveredPoints.toArray().map(({anchor:e,element:o})=>({screenLocation:e.screenLocation,element:o})),e=>{for(const{screenLocation:o,element:t}of e)o&&(t.style.transform=`translate(${o.x}px, ${o.y}px)`)},y))}destroy(){this._hoveredPoints.drain(e=>this._destroyHoveredPoint(e))}update(e){var s;const o=this.view,t=this._hoveredPoints,i=e.length;for(;this._hoveredPoints.length>i;)this._destroyHoveredPoint(this._hoveredPoints.pop());for(;this._hoveredPoints.lengththis._hoveredPoints.toArray().map(({anchor:e,element:o})=>({screenLocation:e.screenLocation,element:o})),e=>{for(const{screenLocation:o,element:t}of e)o&&(t.style.transform=`translate(${o.x}px, ${o.y}px)`)},y))}destroy(){this._hoveredPoints.drain(e=>this._destroyHoveredPoint(e))}update(e){var s;const o=this.view,t=this._hoveredPoints,i=e.length;for(;this._hoveredPoints.length>i;)this._destroyHoveredPoint(this._hoveredPoints.pop());for(;this._hoveredPoints.length{let i=s.meta.featureExtents;if(i==null){i=new Float64Array(6*s.meta.featureIds.length),s.meta.featureExtents=i;for(let o=0;o0){const r=this.toArray();this._map.clear(),this.emit("change",{added:[],removed:r})}}get length(){return this._map.size}get(r){return this._map.get(r)}addMany(r){if(r.length===0)return;const e=new Set;for(let s=0;s0?r.filter(s=>!e.has(s.objectId)):r;t.length>0&&this.emit("change",{added:t,removed:[]})}removeMany(r){const e=[];for(const t of r){const s=t.objectId,i=this._map.get(s);i!=null&&(!i.refCount||--i.refCount<=0)&&(this._map.delete(s),e.push(t))}e.length>0&&this.emit("change",{added:[],removed:e})}removeManyByObjectId(r){const e=[];for(const t of r){const s=this._map.get(t);s!=null&&(!s.refCount||--s.refCount<=0)&&(this._map.delete(t),e.push(s))}e.length>0&&this.emit("change",{added:[],removed:e})}toArray(){return[...this._map.values()]}find(r){let e;return be(this._map,t=>!!r(t)&&(e=t,!0)),e}forEach(r){this._map.forEach(e=>r(e))}}let Hi=class extends Ge{constructor(r){super(),this._limit=r,this._all=new Vi,this._active=new Gi(this),this._pending=new Map,this._handle=this._all.on("change",e=>this._handleChanges(e))}destroy(){this._handle.remove()}get length(){return this._active.length}toArray(){return this._active.toArray()}find(r){return this._active.find(r)}forEach(r){this._active.forEach(r)}addMany(r){this._all.addMany(r)}removeManyByObjectId(r){this._all.removeManyByObjectId(r)}_handleChanges(r){let e=r.removed;if(this._pending.size>0){e=new Array;for(const a of r.removed)this._pending.delete(a.objectId)||e.push(a)}let t=this._limit-this._active.length+e.length;t{W.sample()&&(e.push(a),this._pending.set(a.objectId,a))}),t=this._limit-this._active.length+e.length);let s=r.added;if(t0&&this._pending.size>0&&(W.reset(i/this._pending.size),this._pending.forEach(a=>{W.sample()&&(s.push(a),this._pending.delete(a.objectId))})),this._active.addAndRemove(s,e)}},$i=class{constructor(){this._percentage=1,this._last=-1,this._index=0}reset(r){this._percentage=r,this._last=-1}sample(){const r=Math.floor(this._index*this._percentage);return++this._index,r!==this._last&&(this._last=r,!0)}};const W=new $i;let Gi=class{constructor(r){this._parent=r,this._map=new Map}get length(){return this._map.size}forEach(r){this._map.forEach(e=>r(e))}find(r){let e;return be(this._map,t=>!!r(t)&&(e=t,!0)),e}toArray(){return[...this._map.values()]}addAndRemove(r,e){for(const t of r)this._map.set(t.objectId,t);for(const t of e)this._map.delete(t.objectId);(r.length>0||e.length>0)&&this._parent.emit("change",{added:r,removed:e})}removeMany(r){for(const e of r)this._map.delete(e.objectId);r.length>0&&this._parent.emit("change",{added:[],removed:r})}};class lt{constructor(r,e){this.meta=r,this.index=e}}class Li{constructor(r,e){this.graphic=r,this.geometry=e,this.components=[],this.overridesDirty=!1}}let F=class extends Le{get updating(){var n;return((n=this._graphicsCore)==null?void 0:n.updating)??!1}constructor(n){super(n),this.loadedGraphics=new Hi(5e4),this.slicePlaneEnabled=!1,this._renderingInfo={symbol:new ts},this._featuresMap=new Map}initialize(){const n=this.view.basemapTerrain;this._graphicsCore=new xi({owner:this,layer:this.layer,preferredUpdatePolicy:ss.ASYNC,elevationFeatureExpressionEnabled:!1,graphicSymbolSupported:!1,getRenderingInfoWithoutRenderer:!0,hasZ:!0,hasM:!1,componentFactories:{deconflictor:r=>this.view.deconflictor.addGraphicsOwner(r),labeler:(r,e)=>this.view.labeler.addGraphicsOwner(r,e,{emptySymbolLabelSupported:!0,elevationInfoOverride:{mode:"absolute-height",offset:0},disablePlacement:{logEntityDescription:"3D Object Scene Layer features"}}),scaleVisibility:(r,e)=>new wi({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:e,graphicsCore:r,basemapTerrain:n,layerScaleEnabled:!1})}}),this._graphicsCore.initializePromise.then(()=>this._graphicsCore.startCreateGraphics()).catch(()=>{}),this.addHandles(Pe(()=>this.layer.labelingInfo,(r,e)=>{is(r,e)&&this._graphicsCore.updateLabelingInfo()}))}destroy(){this._graphicsCore=A(this._graphicsCore),this.loadedGraphics=A(this.loadedGraphics),this.view=null}addNodeMeta(n,r){let e=0;const t=n.filteredIds,s=this.view.spatialReference,i=[];for(let a=0;a{const i=this._graphicsCore.getGraphics3DGraphicById(t.uid);i!=null&&this._updateLabelGeometry(n.featureIds[e])&&i.alignWithAbsoluteElevation(s.z??0,r,!1)})}setNodeMetaAttributes(n,r){const e=new Array;this._forEachGraphic(n,(t,s)=>{const i=r(t,n);as(s.attributes,i)||(s.attributes=i,e.push(s.uid))}),this._graphicsCore.updateLabelingInfo(e)}applyFilterChange(n){this._forEachFeature(n,(r,e,t)=>{if(!this._enabledForFeatureInNode(n,r)){const a=n.featureIds[r];switch(this._removeFeature(e,n,r)){case $.REMOVED:this.loadedGraphics.removeManyByObjectId([a]);break;case $.MODIFIED:this._updateLabelPosition(a)}return}const s=e.graphic,i=s.visible;i!==t&&(s.visible=t,te.graphic=s,te.property="visible",te.oldValue=i,te.newValue=t,this._graphicsCore.graphicUpdateHandler(te))})}removeNodeMeta(n){const r=[];this._forEachGraphic(n,e=>{const t=n.featureIds[e],s=this._featuresMap.get(t);if(s)switch(this._removeFeature(s,n,e)){case $.MODIFIED:this._updateLabelPosition(t);break;case $.REMOVED:r.push(t)}}),this.loadedGraphics.removeManyByObjectId(r)}_removeFeature(n,r,e){const t=n.components.length;return ns(n.components,s=>!(s.meta===r&&s.index===e)),n.components.length===0?(this._featuresMap.delete(r.featureIds[e]),$.REMOVED):t!==n.components.length?$.MODIFIED:$.UNMODIFIED}getRenderingInfo(){return this._renderingInfo}notifyGraphicGeometryChanged(){}notifyGraphicVisibilityChanged(){}_updateLabelPosition(n){const r=this._featuresMap.get(n);r&&this._updateLabelGeometry(n)&&(this.loadedGraphics.removeManyByObjectId([n]),this.loadedGraphics.addMany([r.graphic]))}_updateLabelGeometry(n){const r=this._featuresMap.get(n);if(!r)return!1;const e=r.geometry,t=this.view.spatialReference,s=this.view.renderCoordsHelper,i=e.x,a=e.y,o=e.z??0,h=r.components.length,d=ye(h*ot);let c=0;for(const{meta:l,index:u}of r.components)ke(u,this.collection,l.objectHandle,d,c),c+=ot;return He(d,s.spatialReference,0,d,t,0,d.length/3),De(k,It),$e(k,d),e.x=(k[0]+k[3])/2,e.y=(k[1]+k[4])/2,e.z=k[5],!Se(e.x,i)||!Se(e.y,a)||!Se(e.z,o)}_forEachGraphic(n,r){this._forEachFeature(n,(e,{graphic:t,geometry:s},i)=>{this._enabledForFeatureInNode(n,e)&&r(e,t,s,i)})}_forEachFeature(n,r){let e=0;for(let t=0;t[e.geometryBuffer],project:e=>[e.positions.buffer],transformNormals:e=>[e.normals.buffer]},r,{hasInitialize:!0})}setModifications(r,e,t,s){const i={context:r,modifications:Pt(e,t,s),isGeodetic:s.isGeographic};this.broadcast(i,"setModifications")}setLegacySchema(r,e){const t=JSON.stringify(e);return this.broadcast({context:r,jsonSchema:t},"setLegacySchema")}destroyContext(r){return this.broadcast(r,"destroyContext")}project(r,e){return this.invokeMethod("project",r,e)}transformNormals(r,e){return this.invokeMethod("transformNormals",r,e)}};const _=new Mt({deallocator:null}),Y=[0,0,0];function Pt(n,r,e){_.clear();let t=1/0,s=1/0,i=-1/0,a=-1/0,o=!1;for(const d of r){const c=d.type==="clip"?U.Inside:d.type==="mask"?U.Outside:U.Replace,l=d.geometry;let u=g=>g;if(l.spatialReference){if(!ds(l.spatialReference,e)){Ue.getLogger("esri.views.3d.layers.I3SMeshWorkerHandle").warn("Can't project modification polygon into layer spatial reference, ignoring modification");continue}u=g=>(pe(g,l.spatialReference,Y,e),Y)}else l.hasZ||(Y[2]=0,u=g=>(Y[0]=g[0],Y[1]=g[1],Y));o=o||c===U.Outside,_.push(c),_.push(l.rings.length);for(const g of l.rings){_.push(g.length);for(const f of g){const v=u(f);_.push(v[0]),_.push(v[1]),_.push(v[2]),t=Math.min(t,v[0]),s=Math.min(s,v[1]),i=Math.max(i,v[0]),a=Math.max(a,v[1])}}}n!=null&&(o?(_.push(U.Inside),_.push(2),_.push(4),_.push(t-1e-4),_.push(s-1e-4),_.push(0),_.push(i+1e-4),_.push(s-1e-4),_.push(0),_.push(i+1e-4),_.push(a+1e-4),_.push(0),_.push(t-1e-4),_.push(a+1e-4),_.push(0),_.push(4),_.push(n[0]),_.push(n[1]),_.push(0),_.push(n[2]),_.push(n[1]),_.push(0),_.push(n[2]),_.push(n[3]),_.push(0),_.push(n[0]),_.push(n[3]),_.push(0)):(_.push(U.Outside),_.push(1),_.push(4),_.push(n[0]),_.push(n[1]),_.push(0),_.push(n[2]),_.push(n[1]),_.push(0),_.push(n[2]),_.push(n[3]),_.push(0),_.push(n[0]),_.push(n[3]),_.push(0))),_.push(U.Finished);const h=new Float64Array(_.length);for(let d=0;d<_.length;++d)h[d]=_.at(d);return h}var q,x;(function(n){n[n.VISIBLE_ONLY=0]="VISIBLE_ONLY",n[n.ALL=1]="ALL",n[n.QUERYABLE=2]="QUERYABLE"})(q||(q={})),function(n){n[n.EXIT=0]="EXIT",n[n.CONTINUE=1]="CONTINUE",n[n.SKIP=2]="SKIP"}(x||(x={}));let Bi=class{constructor(){this.ids=new Set}};class zi{constructor({collection:r,forAllFeatures:e,forAllFeaturesOfNode:t}){this._highlights=[],this._collection=r,this._forAllFeatures=e,this._forAllFeaturesOfNode=t}destroy(){this._highlights.forEach(r=>this._releaseSet(r)),this._highlights=null}acquireSet(){const r=new Bi;this._highlights.push(r);const e=Et(()=>{this._highlights&&(this._releaseSet(r),Ot(this._highlights,r))});return{set:r,handle:e}}setFeatureIds(r,e){e.forEach(t=>r.ids.add(t)),this._initializeSet(r)}_initializeSet(r){this._forAllFeatures((e,t,s)=>(r.ids.has(e)&&this._collection.addComponentHighlight(s.objectHandle,t),x.CONTINUE))}_releaseSet(r){this._forAllFeatures((e,t,s)=>(r.ids.has(e)&&this._collection.removeComponentHighlight(s.objectHandle,t),x.CONTINUE))}objectCreated(r){this._highlights.forEach(e=>{this._forAllFeaturesOfNode(r,(t,s)=>(e.ids.has(t)&&this._collection.addComponentHighlight(r.objectHandle,s),x.CONTINUE))})}objectDeleted(r){this._collection.clearHighlights(r.objectHandle)}}let fe=class extends Le{constructor(r,e,t){super({}),this._updateExtent=e,this._updateNode=t,this.running=!1,this._extentSet=new Si,this._nodeSet=new Set,this.addHandles(r.registerTask(hs.ELEVATION_ALIGNMENT,this))}normalizeCtorArgs(){return{}}addExtent(r){this._extentSet.add(r),this.running=!0}schedule(r){this._nodeSet.add(r),this.running=!0}remove(r){this._nodeSet.delete(r),this._updateRunning()}runTask(r){const e=this._extentSet;for(r.run(()=>e.merge(r));!e.empty&&!r.done;){const s=this._updateExtent(e.pop());s!=null&&s.forAll(i=>this.schedule(i)),r.madeProgress()}if(r.done)return;const t=this._nodeSet;for(const s of t)if(t.delete(s),this._updateNode(s),r.madeProgress(),r.done)break;this._updateRunning()}_updateRunning(){this.running=this._nodeSet.size>0||this._extentSet.size>0}};p([m()],fe.prototype,"running",void 0),fe=p([Ce("esri.views.3d.layers.i3s.I3SAsyncElevationUpdater.ts")],fe);let qi=class{constructor(){this.lodCrossfadeSignedDuration=0}},Ki=class{constructor(r){this._view=r,this._preRenderFrameTaskHandle=null,this._currentFrameStartTime=null,this._numFadingNodes=0}destroy(){var r;(r=this._preRenderFrameTaskHandle)==null||r.remove(),this._preRenderFrameTaskHandle=null,this._view=null}get updating(){return this._numFadingNodes>0}stopNodeFading(r){r.lodCrossfadeProgress!=null&&(this._numFadingNodes--,r.lodCrossfadeProgress=null,this._numFadingNodes===0&&(this._preRenderFrameTaskHandle!=null&&(this._preRenderFrameTaskHandle=cs(this._preRenderFrameTaskHandle)),this._view.notifyLODUpdate(),this._view.notifyUpdate()))}_startNodeFading(r,e,t){this._numFadingNodes===0&&(this._preRenderFrameTaskHandle=us({preRender:s=>this._updateAllNodeFading(s)}),this._view.notifyLODUpdate()),r.lodCrossfadeProgress==null&&(this._numFadingNodes++,this._view.notifyUpdate()),r.lodCrossfadeSignedDuration=t,r.lodCrossfadeProgress=e}_updateAllNodeFading(r){const e=this._view.nodeCrossfadingEnabled;this._view.foreachCrossfadeNode((t,s)=>{if((s==null?void 0:s.lodCrossfadeProgress)!=null){const i=s.lodCrossfadeSignedDuration,a=i>0?this._view.fullOpacity:0,o=r.deltaTime/i,h=s.lodCrossfadeProgress+Math.abs(o),d=!e||h>=1||i===0,c=a-(d?0:i>0?1:-1)*(1-h);d?(this.stopNodeFading(s),i<0&&this._view.markNodeToRemove(t)):s.lodCrossfadeProgress=h,this._view.setNodeOpacityByIndex(t,c)}}),this._view.removeMarkedNodes()}stopAllNodeFading(){this._view.foreachCrossfadeNode((r,e)=>{if((e==null?void 0:e.lodCrossfadeProgress)!=null){this.stopNodeFading(e);const t=e.lodCrossfadeSignedDuration;t<0&&this._view.markNodeToRemove(r);const s=t>0?this._view.fullOpacity:0;this._view.setNodeOpacityByIndex(r,s)}}),this._view.removeMarkedNodes()}fadeNode(r,e,t,s){this._currentFrameStartTime==null&&(this._currentFrameStartTime=Date.now());const i=this._view,a=i.nodeCrossfadingEnabled,o=t===me.FadeIn?i.fullOpacity:0,h=a?s?t===me.FadeIn?i.lodCrossfadeinDuration:i.lodCrossfadeoutDuration:i.lodCrossfadeUncoveredDuration:0,d=this._view.getNodeOpacityByIndex(r);if(a&&d!==o&&h>0){const c=1-Math.abs(o-d);this._startNodeFading(e,c,Wi(t)*h)}else this.stopNodeFading(e),this._view.setNodeOpacityByIndex(r,o),t===me.FadeOut&&this._view.removeNode(r)}isNodeFullyFadedIn(r){const e=this._view.getNodeCrossfadeMetaData(r);return e==null||e.lodCrossfadeProgress==null&&this._view.getNodeOpacityByIndex(r)===this._view.fullOpacity}};function Wi(n){return n===me.FadeIn?1:-1}const B=je(),se=St(),dt=Nt(0,0,0,0),H=G(),Yi=G(),Qi=G();let z=class extends Ge.EventedMixin(Le){get spatialReference(){var n,r;return(r=(n=this.view)==null?void 0:n.elevationProvider)==null?void 0:r.spatialReference}constructor(n){super(n),this._tmpEvent={spatialReference:null,extent:B,context:"scene"}}initialize(){this.view=this.layerView.view,this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersector=_s(this.view.state.viewingMode),this._intersector.options.store=xt.MIN,this._tmpEvent.context=this.intersectionHandler.isGround?"ground":"scene"}getElevation(n,r,e,t){const s=H;s[0]=n,s[1]=r,s[2]=e;const i=this._renderCoordsHelper;if(!i.toRenderCoords(s,t,s))return Ue.getLogger(this).error("could not project point to compute elevation"),null;const{layerView:a,_intersector:o,intersectionHandler:h}=this,d=a.i3slayer.fullExtent,c=d!=null&&Number.isFinite(d.xmin)&&Number.isFinite(d.xmax)&&Number.isFinite(d.ymin)&&Number.isFinite(d.ymax)&&Number.isFinite(d.zmin)&&Number.isFinite(d.zmax)?{min:d.zmin,max:d.zmax}:a.elevationRange;if(c==null)return null;const l=a.elevationOffset,u=c.min+l,g=c.max+l,f=Yi,v=Qi;return i.setAltitude(f,g,s),i.setAltitude(v,u,s),o.reset(f,v,null),h.intersect(o,null,f,v),o.results.min.getIntersectionPoint(s)?i.getAltitude(s):null}getSphereElevationBounds(n,r){return Dt(n,r,dt,this._renderCoordsHelper.spatialReference),this.layerView.getElevationRange(dt)}getRootElevationBounds(){const n=this.layerView.i3slayer.fullExtent;return n!=null&&n.hasZ?{min:n.zmin,max:n.zmax}:null}layerChanged(){this.spatialReference&&(this._tmpEvent.extent=this._computeLayerExtent(),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}objectChanged(n){this.spatialReference&&(this._tmpEvent.extent=this._computeObjectExtent(n),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}_computeObjectExtent(n){return je(B),this._expandExtent(n,B),B}_computeLayerExtent(){je(B);for(const n of this.layerView.getVisibleNodes())this._expandExtent(n,B);return B}_expandExtent(n,r){const e=this.spatialReference;if(e==null)return;const t=this.layerView.getNodeComponentObb(n);if(t!=null){gs(se,t.quaternion),se[12]=t.center[0],se[13]=t.center[1],se[14]=t.center[2];for(let s=0;s<8;++s)H[0]=1&s?t.halfSize[0]:-t.halfSize[0],H[1]=2&s?t.halfSize[1]:-t.halfSize[1],H[2]=4&s?t.halfSize[2]:-t.halfSize[2],wt(H,H,se),this._renderCoordsHelper.fromRenderCoords(H,H,e),ps(r,H,r)}}};p([m({constructOnly:!0})],z.prototype,"layerView",void 0),p([m({constructOnly:!0})],z.prototype,"intersectionHandler",void 0),p([m()],z.prototype,"view",void 0),p([m()],z.prototype,"spatialReference",null),z=p([Ce("esri.views.3d.layers.i3s.I3SElevationProvider")],z);const Xi=z;class Ji{constructor(r){this.type=ms.I3S,this._needVerticalOffset=!1,this.layerUid=r.layerUid,this.sublayerUid=r.sublayerUid,this._collection=r.collection,this._traverseNodeHierarchy=r.traverseNodeHierarchy,this.slicePlaneEnabled=r.slicePlaneEnabled,this.isGround=r.isGround}updateElevationAlignState(r,e){this._needVerticalOffset=r&&e===fs.Global}intersect(r,e,t,s){const i=r.results,a=r.options.store===xt.ALL,o=r.ray.direction,h=r.tolerance;let d=u=>u,c=u=>u;const l=ys(r.verticalOffset!=null?r.verticalOffset:this._needVerticalOffset?0:null);r.verticalOffset!=null&&l!=null&&(d=u=>l.applyToMbs(u),c=u=>l.applyToObb(u)),this._traverseNodeHierarchy((u,g)=>{if(u.childrenLoaded===0)return!1;const f=u.serviceObbInRenderSR!=null&&bs(u.serviceObbInRenderSR)?u.serviceObbInRenderSR:null;return!(f!=null&&!Qe(c(f),t,o,h))&&(!g||f==null&&vs(u.renderMbs)&&!Zi(d(u.renderMbs),t,o,h)||u.geometryObb!=null&&!Qe(c(u.geometryObb),t,o,h)||this._collection.intersect(g,t,s,h,l,(v,M,w,S)=>{if(M>=0){if(e!=null&&!e(t,s,M))return;const y=I=>{const b=new Cs(this.layerUid,this.sublayerUid,u.index,v,S);I.set(this.type,b,M,w)};if(this.isGround&&(i.ground.dist==null||Mi.max.dist)&&y(i.max),a){const I=Is(r.ray);y(I),r.results.all.push(I)}}}),!0)})}}function Zi(n,r,e,t=0){const s=n[3]+t,i=r[0]-n[0],a=r[1]-n[1],o=r[2]-n[2],h=e[0],d=e[1],c=e[2],l=h*i+d*a+c*o;return l*l-(h*h+d*d+c*c)*(i*i+a*a+o*o-s*s)>=0}const er=14;class tr{constructor(r,e,t=er){this._version=t,this._db=null,this._quotaReductionPromise=null,this._gcCounter=0,this._hit=0,this._miss=0,this._destroyed=!1,this.gcFrequency=50,this.maxByteSize=Rt.GIGABYTES,this.quotaReductionFactor=.2,this._dbName=r,this._storeName=e}init(){return Promise.resolve().then(()=>{const r=indexedDB.open(this._dbName,this._version);return r.onupgradeneeded=e=>{const t=r.result,s=r.transaction,i=t.objectStoreNames.contains(this._storeName)?s.objectStore(this._storeName):t.createObjectStore(this._storeName),a=t.objectStoreNames.contains("last_access")?s.objectStore("last_access"):t.createObjectStore("last_access");a.indexNames.contains("date")||a.createIndex("date","date",{unique:!1}),a.indexNames.contains("byteSize")||a.createIndex("byteSize","byteSize",{unique:!1}),e.oldVersion{this._destroyed?r.close():this._db=r})}destroy(){this._db&&(this._db.close(),this._db=null),this._destroyed=!0}get initialized(){return this._db!=null}getHitRate(){return this._hit/(this._hit+this._miss)}put(r,e){return this._db==null?Promise.reject(new Ms("indexedb:not-initialized","IndexedDB Cache is not initialized")):(this._quotaReductionPromise!=null?this._quotaReductionPromise:Promise.resolve()).then(()=>this._put(r,e)).catch(t=>{if(t&&t.name==="QuotaExceededError")return this._quotaReductionPromise==null&&(this._quotaReductionPromise=this._getCacheSize().then(s=>this._removeLeastRecentlyAccessed(e.byteSize+Math.ceil(s*this.quotaReductionFactor))),this._quotaReductionPromise.then(()=>this._quotaReductionPromise=null,()=>this._quotaReductionPromise=null)),this._quotaReductionPromise.then(()=>this._put(r,e));throw t}).then(()=>{this._gcCounter--,this._gcCounter<0&&this._db!=null&&(this._gcCounter=this.gcFrequency,this._getCacheSize().then(t=>this._removeLeastRecentlyAccessed(t-this.maxByteSize)))})}get(r,e){const t=this._db;if(t==null)return Promise.resolve(void 0);let s=null;return Promise.resolve().then(()=>{const i=t.transaction(this._storeName,"readonly");return s=Es(e,()=>{i.abort()}),Q(i.objectStore(this._storeName).get(r))}).then(i=>(i==null?++this._miss:this._db&&(++this._hit,this._db.transaction("last_access","readwrite").objectStore("last_access").put({date:Date.now(),byteSize:i.byteSize},r)),s!=null&&s.remove(),i)).catch(()=>{++this._miss,Ve(e),s!=null&&s.remove()})}remove(r){const e=this._db;return e==null?Promise.resolve():Promise.resolve().then(async()=>{const t=e.transaction([this._storeName,"last_access"],"readwrite"),s=t.objectStore(this._storeName),i=t.objectStore("last_access"),a=s.delete(r),o=i.delete(r);await Promise.all([Q(a),Q(o),ge(t)])})}_put(r,e){const t=this._db;if(t==null)return Promise.resolve();const s=t.transaction([this._storeName,"last_access"],"readwrite"),i=s.objectStore(this._storeName),a=s.objectStore("last_access"),o=i.put(e,r),h=a.put({date:Date.now(),byteSize:e.byteSize},r);return Promise.all([Q(o),Q(h),ge(s)])}_removeLeastRecentlyAccessed(r){if(r<=0||!this._db)return Promise.resolve();const e=this._db.transaction([this._storeName,"last_access"],"readwrite"),t=e.objectStore(this._storeName),s=e.objectStore("last_access");let i=0;const a=s.index("date").openCursor(null,"next");return a.onsuccess=()=>{const o=a.result;o!=null&&(o.value.byteSize!=null&&(i+=o.value.byteSize),t.delete(o.primaryKey),s.delete(o.primaryKey),i{const a=i.result;if(!a)return;const o=a.key;o!=null&&(s+=o),a.continue()},ge(e).then(()=>s)}}function ge(n){return new Promise((r,e)=>{n.oncomplete=()=>r(),n.onerror=()=>e(n.error),n.onabort=()=>e(n.error)})}function Q(n){return new Promise((r,e)=>{n.readyState==="done"?n.error!=null?e(n.error):r(n.result):(n.onsuccess=()=>r(n.result),n.onerror=()=>e(n.error))})}const ht=new WeakMap;class sr{constructor(r,e){switch(this._miss=0,this._hit=0,this.initialized=!0,e){case"layer":this._data=new Map;break;case"view":{const t=ht.get(r);if(t){this._data=t;break}const s=new Map;this._data=s,ht.set(r,s)}}}init(){return Promise.resolve()}async get(r,e){if(this._data.has(r))return this._hit++,this._data.get(r)??void 0;this._miss++}destroy(){}put(r,e){return this._data.set(r,e),Promise.resolve()}remove(r){return this._data.delete(r),Promise.resolve()}getHitRate(){return this._hit/(this._hit+this._miss)}}const jt="esri.views.3d.layers.I3SMeshView3D",P=Ue.getLogger(jt),ct=[1,1,1,1];class ir extends qi{constructor(r,e,t,s,i,a,o,h,d){super(),this.node=r,this.featureIds=e,this.objectHandle=t,this.cachedRendererVersion=s,this.attributeInfo=i,this.material=a,this.textures=o,this.anchorIds=h,this.anchors=d,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0}}var K;(function(n){n[n.CastShadows=4]="CastShadows",n[n.Pickable=5]="Pickable"})(K||(K={}));const rr=23,ar=100*Rt.MEGABYTES,Nr=n=>{let r=class extends n{constructor(...e){super(e),this._updatingHandles=new ws,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._elevationTask=null,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new le(null,null,{}),this._crossfadeHelper=new Ki(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get contentVisible(){var e;return!this.suspended&&((e=this._controller)==null?void 0:e.rootNodeVisible)}get legendEnabled(){var e;return this.contentVisible&&((e=this.i3slayer)==null?void 0:e.legendEnabled)===!0}get updatingProgressValue(){var e;return((e=this._controller)==null?void 0:e.updatingProgress)??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ss(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?ee.AllTexturesPBR:ee.AllTextures:this._usePBR||this._hasLoadedPBRTextures?ee.GeometryTexturesPBR:ee.GeometryTextures}get elevationOffset(){const e=this.i3slayer!=null?this.i3slayer.elevationInfo:null;if(e!=null&&e.mode==="absolute-height"){const t=Xe(this.i3slayer.spatialReference),s=Je(e.unit);return(e.offset??0)*s/t}return 0}get elevationInfo(){const e=this.i3slayer!=null?this.i3slayer.elevationInfo:null;if(e==null)return{mode:R.Absolute,offset:0};const t=Xe(this.i3slayer.spatialReference),s=Je(e.unit),i=(e.offset??0)*s/t;switch(e.mode){case"absolute-height":return{mode:R.Absolute,offset:i};case"relative-to-ground":return{mode:R.RelativeToGround,offset:i};case"on-the-ground":return{mode:R.OnTheGround,offset:0};default:return{mode:R.Absolute,offset:0}}}get supportedTextureEncodings(){return yi(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var s;const e=(s=this.view)==null?void 0:s.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,t=(this.supportedTextureEncodings&_e.DDS_S3TC)==0;return e&&t}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta;let t=1/0,s=-1/0;for(const i of e.values()){if(i==null)continue;const{node:{mbs:a}}=i,[,o,h]=a;t=Math.min(t,o-h),s=Math.max(s,o+h)}return Number.isFinite(t)&&Number.isFinite(s)?{min:t,max:s}:null}initialize(){var c;const e=Ne("enable-feature:idb-mock-cache");this._idbCache=e?new sr(this.view,e):new tr("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,s=t.memoryController;this.i3sOverrides=new bi({view:this.view,layer:this.i3slayer,memoryController:s}),this._worker=new ki(ur(t)),this.addResolvingPromise(this._worker.promise);const i=this.i3slayer.store;this._worker.setLegacySchema(this.uid,i.defaultGeometrySchema),Ns(this.i3slayer),Rs(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new vi({layerView:this,worker:this._worker}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this.resetHighlights();const a=i.defaultGeometrySchema;if(this._isIntegratedMesh||!a)this._hasComponentData=!1;else{const l=a.featureAttributes;this._hasComponentData=!!(l&&l.faceRange&&l.id)}this._hasVertexColors=((a==null?void 0:a.vertexAttributes.color)??null)!=null&&!((c=this.i3slayer.cachedDrawingInfo)!=null&&c.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderer.ensureEdgeView());const o=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,l=>this._deleteComponentObject(l));this._memCache=o;const h=l=>{var u;return((u=this._controller.index)==null?void 0:u.rootNode)!=null?this._controller.index.traverse(this._controller.index.rootNode,g=>{const f=g.index,v=this._nodeId2Meta.get(f)||this._nodeId2MetaReloading.get(f);return l(g,v!=null?v.objectHandle:null)}):()=>{}};this._intersectionHandler=new Ji({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:h}),this._updatingHandles.add(()=>this.layerUid,l=>this._intersectionHandler.layerUid=l),this._updatingHandles.add(()=>this.sublayerUid,l=>this._intersectionHandler.sublayerUid=l),this._elevationProvider=new Xi({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),V),this._updatingHandles.add(()=>this.fullOpacity,l=>this._opacityChange(l)),this._updatingHandles.add(()=>this.slicePlaneEnabled,l=>this._slicePlaneEnabledChange(l)),this._updatingHandles.add(()=>this.elevationOffset,(l,u)=>{this._reloadAll(u),this._controller.invalidateVisibilityObbs()}),this._updatingHandles.add(()=>this.elevationInfo,(l,u)=>this._elevationInfoChanged(l,u),V),this._updatingHandles.add(()=>!this.suspended&&this.elevationInfo.mode!==R.Absolute,(l,u)=>{l?this.addHandles(this.view.basemapTerrain.on("elevation-change",({extent:g})=>this._ensureElevationTask().addExtent(g)),vt):u&&this.removeHandles(vt)},V),this._updatingHandles.add(()=>this._usePBR,l=>this._updatePBR(l));const d=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add(()=>this.rendererTextureUsage,d),this._updatingHandles.add(()=>this.uncompressedTextureDownsamplingEnabled,d),this._updatingHandles.add(()=>this.contentVisible,l=>this._contentVisibleChanged(l),V),this._updatingHandles.add(()=>this.i3slayer.labelsVisible,()=>this._labelingChanged(),V),this._updatingHandles.add(()=>this.i3slayer.labelingInfo,()=>this._labelingChanged(),V),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),V),this.addHandles([Pe(()=>J.I3S_TREE_SHOW_TILES,l=>{if(l&&!this._treeDebugger){const u=this._controller.crsIndex;As(()=>import("./I3STreeDebugger-tPVEJfH8.js"),__vite__mapDeps([0,1,2,3])).then(({I3STreeDebugger:g})=>{!this._treeDebugger&&J.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new g({lv:this,view:this.view,nodeSR:u}))})}else l||J.I3S_TREE_SHOW_TILES||(this._treeDebugger=A(this._treeDebugger))},V),Pe(()=>J.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),V)]),this._cacheKeySuffix=Fs(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch(l=>P.warn(`Failed to initialize IndexedDB cache: ${l}`))}destroy(){this._clearAddTasks(),this._elevationTask=A(this._elevationTask),this.i3sOverrides=A(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.uid).then(()=>e.destroy()),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=A(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=A(this._labeler),this._treeDebugger=A(this._treeDebugger),this._controller=A(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=A(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=A(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.memoryEstimate;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(e!=null){const t=e.memoryEstimate;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}get usedMemory(){let e=this._labeler!=null?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach(t=>e+=t!=null?t.node.memory:0),this._nodeId2MetaReloading.forEach(t=>e+=t!=null?t.node.memory:0),e}get unloadedMemory(){return(this._controller!=null?this._controller.unloadedMemoryEstimate:0)+(this._labeler!=null?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(Ts(this.i3slayer)&&this._supportsLabeling))return void(this._labeler!=null&&(this._labeler.destroy(),this._labeler=null));if(this._labeler!=null)return;const e=new Ui({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides});this._nodeId2Meta.forEach(t=>t!=null&&this._addMetaToLabeler(e,t)),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then(t=>(--this._asyncModuleLoading,t),t=>{throw--this._asyncModuleLoading,t})}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=Ni().then(()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()}),void this.notifyUpdate();if(this._i3sWasmLoaded!==!0)return;const e=this.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const s=Pt(this._layerClippingArea,this._modifications,t);Ri({context:e,modifications:s,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const i=this.hasModifications?new Mt:null;this._nodeId2Meta.forEach((a,o)=>{a==null?(this._nodeId2Meta.delete(o),this._controller.updateLoadStatus(o,!1)):a.node.hasModifications?(this._nodeId2Meta.delete(o),this._nodeId2MetaReloading.set(o,a)):i!=null&&i.push(a.node)}),this.notifyChange("elevationRange"),i!=null&&this._nodeId2MetaReloading.forEach(a=>i.push(a.node)),i!=null&&i.length>0&&(this.updateNodeModificationStatus(i),i.forAll(a=>{if(a.imModificationImpact!==nt.Culled){const o=this._nodeId2Meta.get(a.index);this._controller.invalidateGeometryVisibility(a.index),o!=null?(this._nodeId2Meta.delete(a.index),this._nodeId2MetaReloading.set(a.index,o),this.notifyChange("elevationRange")):this._nodeId2Meta.has(a.index)&&(this._nodeId2Meta.delete(a.index),this._controller.updateLoadStatus(a.index,!1))}})),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(this._modificationGraphics!=null&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!J.I3S_SHOW_MODIFICATIONS||this._modifications.length===0)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){const i=s.geometry;i.spatialReference=this.i3slayer.spatialReference;const a={...t,color:e[s.type]};this._modificationGraphics.push(new le({geometry:i,symbol:a}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,(s,i)=>this._createAttributes(s,i))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if((t==null?void 0:t.attributeInfo)!=null)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if((t==null?void 0:t.attributeInfo)!=null)return t.attributeInfo.attributeData}setAttributeData(e,t){const s=this._nodeId2Meta.get(e);(s==null?void 0:s.attributeInfo)!=null&&(s.attributeInfo.attributeData=t,this._attributeValuesChanged(s))}async updateAttributes(e,t,s){const i=this._nodeId2Meta.get(e);i!=null&&(await this.i3sOverrides.applyAttributeOverrides(i.featureIds,t,s,this._controller.requiredAttributes),i.attributeInfo=t,this._controller.reschedule(()=>this._attributeValuesChanged(i),s).catch(a=>{Ft(a)||P.warn("Error while updating attribute values. Layer might not display correctly.",a)}))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,this._labeler!=null&&this._labeler.setNodeMetaAttributes(e,(t,s)=>this._createAttributes(t,s)),this._updateEngineObject(e)}clearMemCache(){this._memCache!=null&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach(t=>t!=null&&e.push(t.node)),e}getNodeComponentObb(e){const t=this._nodeId2Meta.get(e.index)??this._nodeId2MetaReloading.get(e.index);return t!=null?this._collection.getComponentObb(t.objectHandle):null}getLoadedNodeIndices(e){this._nodeId2Meta.forEach((t,s)=>e.push(s)),this._nodeId2MetaReloading.forEach((t,s)=>e.push(s))}_preLoadBasis(){var e;!Ne("disable-feature:i3s-basis")&&this.supportedTextureEncodings&_e.Basis&&((e=this.i3slayer.textureSetDefinitions)!=null&&e.some(t=>t.formats.some(s=>s.format==="basis"||s.format==="ktx2")))&&Ze()}_getVertexBufferLayout(e,t){const s={hasTexture:pt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Ds(Ps(this._getGeometryParameters(s)))}_getObjectIdField(){return this.i3slayer.objectIdField||js}_getGlobalIdField(){var e;return(e=this.i3slayer.associatedLayer)==null?void 0:e.globalIdField}_findGraphicNodeAndIndex(e){const t=Te(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let s=null;return be(this._nodeId2Meta,i=>{if(i==null)return!1;const a=i.featureIds.indexOf(t);return a!==-1&&(s={node:i.node,index:a},!0)}),s}_getGraphicIndices(e,t){const s=this._nodeId2Meta.get(e.index);if(s==null)return[];const i=[],a=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const h of t){const d=Te(o,h.attributes,a),c=s.featureIds.indexOf(d);c!==-1&&i.push(c)}return i}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const s=this._getAABB(t.node.index,t.index);return s==null?Promise.reject():Promise.resolve({boundingBox:s,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return e.nodeIndex==null||e.componentIndex==null?null:this._getAABB(e.nodeIndex,e.componentIndex)}_getAABB(e,t){const s=this._nodeId2Meta.get(e);if((s==null?void 0:s.featureIds)==null||t>=s.featureIds.length)return null;const i=s.objectHandle,a=ke(t,this._collection,i,ye(24),0),o=this.view.renderSpatialReference,h=this.view.spatialReference;if(!He(a,o,0,a,h,0,8))return null;const d=Vs();return $e(d,a,0,8),d}whenGraphicAttributes(e,t){return Hs(this.i3slayer,e,this._getObjectIdField(),t,()=>[...this._nodeId2Meta.values()].filter($s))}getGraphicFromIntersectorTarget(e){if(e.nodeIndex==null||e.componentIndex==null)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return(t==null?void 0:t.featureIds)==null||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${rr}/${e}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&this.elevationOffset===0&&this._cacheKeySuffix!=null}loadCachedGPUData(e){return this._memCache!=null?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){e!=null&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(this._memCache==null)return void this._deleteComponentObject(e);const s=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,s)}loadMissingTextures(e,t,s,i){const a=(e==null?void 0:e.filter((o,h)=>{if(!(o.usage&this.rendererTextureUsage))return!1;if(t==null)return!0;const d=Ii(o.encodings,this.supportedTextureEncodings),c=t[h];return!!((c==null?void 0:c.data)==null||d&&c.encoding!==d.encoding)}))??[];return a.length===0?Promise.resolve(!1):s(a,i).then(o=>{let h=0;for(let d=0;di==null?null:i.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(this.elevationInfo.mode===R.Absolute&&(e.geometryObb=i.geometryObb),this.loadMissingTextures(i.requiredTextures,i.textureData,s,t).then(a=>(a&&this._idbCache.initialized&&i.textureData!=null&&(i.byteSize=ft(i.transformedGeometry,i.textureData),i.textureData.every(mt)&&yt(e,i)&&this._idbCache.put(this._getCacheKey(e.id),i).catch(o=>P.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${o}`))),Ve(t),i)))):Promise.resolve(null)}addNode(e,t,s){return dr(t)?t.geometryBuffer==null?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,()=>this._transformNode(e,t,s).then(i=>this._safeReschedule(()=>{if(i==null)return e.hasModifications=!1,this._addCachedNodeData(e,null,s);e.hasModifications=i.transformedGeometry.hasModifications;const{obb:a,componentOffsets:o,featureIds:h,anchorIds:d,anchors:c,transformedGeometry:l}=i,u=this._controller.crsIndex,g=this.view.renderSpatialReference,f=et(e.mbs,this.elevationOffset,u,g),v=At([a.center.x,a.center.y,a.center.z],[a.extents.x,a.extents.y,a.extents.z],Gs(a.orientation.x,a.orientation.y,a.orientation.z,a.orientation.w));wt(v.center,v.center,f),this.elevationInfo.mode===R.Absolute&&(e.geometryObb=v),t.geometryData.componentOffsets=o,h&&(t.geometryData.featureIds=Array.from(h)),t.geometryData.anchorIds=d,t.geometryData.anchors=c;const M={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:l,globalTrafo:f,geometryObb:v,byteSize:ft(l,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&yt(e,M)){const w=M.textureData!=null?M.textureData.map(S=>mt(S)?S:null):null;this._idbCache.put(this._getCacheKey(e.id),{...M,textureData:w}).catch(S=>P.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${S}`))}return this._addCachedNodeData(e,M,s)},s))):Promise.reject()}getElevationRange(e){let t=1/0,s=-1/0;const i=Ls(this.view.renderCoordsHelper.spatialReference);return this._nodeId2Meta.forEach(a=>{if((a==null?void 0:a.node.geometryObb)!=null){const o=a.node.geometryObb;if(Us(o,e)){const h=this._collection.getObjectTransform(a.objectHandle),d=this.view.renderCoordsHelper.getAltitude(h.position);for(let c=0;c0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,s){if(this.elevationInfo.mode===R.Absolute&&(e.geometryObb=zs(this._collection.getComponentObb(t.objectHandle))),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);this._labeler!=null&&this._addMetaToLabeler(this._labeler,t);const i=e.index;this._addNodeMeta(i,t),this.updateNodeState(i,s),this._collection.setObjectVisibility(t.objectHandle,Re.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this.elevationInfo.mode!==R.Absolute&&this._ensureElevationTask().schedule(i),this._updateEngineObject(t),this._highlights.objectCreated(t),this._treeDebugger!=null&&this._treeDebugger.update()}addCachedNodeData(e,t,s,i){return this._addData(e,s,()=>this._addCachedNodeData(e,t,i))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,s){var Ke;if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(t==null)return void this._addNodeMeta(e.index,null);const i=this._addTasks.get(e.index),{geometryData:a,transformedGeometry:o,globalTrafo:h}=t;await this.i3sOverrides.applyAttributeOverrides(a.featureIds,i.attributeInfo,s,this._controller.requiredAttributes);const d=t.textureData!=null?t.textureData.filter(O=>O!=null&&(O.usage&this.rendererTextureUsage)!=0):[];!Ne("disable-feature:i3s-basis")&&d.some(O=>O!=null&&(O.encoding===_e.Basis||O.encoding===_e.KTX2))&&await Ze(),e.memory=0;const{componentOffsets:c,geometries:l,featureIds:u,anchorIds:g,anchors:f}=a,v=this._collection,M=l[0],{layout:w,indices:S,interleavedVertexData:y,positionData:I,hasColors:b}=o,E=this._materialParameters(M,w),C=c||new Uint32Array([0,S?S.length:y.byteLength/w[0].stride]),Vt={vertices:{data:y,count:y.byteLength/w[0].stride,layoutParameters:E.geometryParams},positionData:{positions:qs(I.data),indices:Ks(I.indices)},indices:S,componentOffsets:C},ne=M.transformation?Ws(M.transformation):St();Ys(ne,h,ne);const Me=Qs(G(),ne),Ht=Xs(Js(),ne),Be=this.view.renderSpatialReference,ze=this.view.basemapTerrain.spatialReference,Ee=G(),Oe=[1,1,1];Di(Me,Be,Oe,ze)||P.errorOnce("Unsupported coordinate system for IM overlay"),pe(Me,Be,Ee,ze);const oe=v.createObject({toMapSpace:Zs(Ee[0],Ee[1],Oe[0],Oe[1]),geometry:Vt,obb:t.geometryObb,transform:{position:Me,rotationScale:Ht}}),$t=E.geometryParams.textureCoordinates===de.Atlas,{textures:qe,texturePromise:Gt}=this._initMaterialAndTextures(oe,E.material,d,$t);e.memory+=this._memEstimateGeometryAdded(oe),e.memory+=qe.reduce((O,xe)=>O+(xe!=null?this._memEstimateTextureAdded(xe):0),0);const Lt=!!E.material.hasParametersFromSource,Ut=E.material.alphaMode!=="blend"&&E.material.metallicRoughness.baseColorFactor[3]>=1,N=new ir(e,u,oe,this._getInvalidRendererVersion(),i.attributeInfo,{hasParametersFromSource:Lt,isOpaque:Ut},qe,g,f);i.meta=N,!this._hasTextures&&((Ke=t.requiredTextures)!=null&&Ke.some(({usage:O})=>(O&ee.ColorTextures)!=0))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||b,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const kt=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(N),Gt]).then(([O,xe])=>(O!=null&&O.updateObjectVisibility(N.objectHandle,!1).catch(X=>L(X,this.i3slayer.title)),this._safeReschedule(()=>{const X=this._addTasks.get(e.index);if(!X)return;if(this._addNodeMeta(e.index,N),X.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);v.setObjectVisibility(oe,Re.Visible),O!=null&&O.updateObjectVisibility(N.objectHandle,!0).catch(Wt=>L(Wt,this.i3slayer.title)),N.attributeInfo=X.attributeInfo;const Bt=N.cachedRendererVersion!==this._rendererVersion,zt=kt!==this.slicePlaneEnabled;this._updateElevationOffsets(N);const qt=N.elevationOffsets;this._updateComponentData(N);const Kt=this._applyFiltersToNode(N);(Bt||O!=null&&(zt||Kt||qt))&&this._addOrUpdateEdgeRendering(N),this._labeler!=null&&this._addMetaToLabeler(this._labeler,N),this._visibleGeometryChanged(N,T.ADD),this._highlights.objectCreated(N),this._updateMaterial(N),this._setNewNodeOpacity(N),this._treeDebugger!=null&&this._treeDebugger.update()},s))).catch(O=>{throw i.meta!=null&&(this._cacheGPUData(i.meta),i.meta=null),O})}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){P.error("Removing duplicated node");const s=this._nodeId2Meta.get(e);s!=null&&this._deleteComponentObject(s)}else this._controller.updateLoadStatus(e,!0);t!=null&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&re(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,s=this._controller.crsIndex,i=this.elevationInfo,a=this.view.basemapTerrain,o=a.spatialReference,h=i.mode;if(t==null||o==null||h===R.Absolute)return void(e.elevationOffsets=null);const d=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const c=cr,l=bt,u=h===R.OnTheGround,g=this.view.renderCoordsHelper,f=e.featureIds.length,v=(()=>{var I;if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const y=ye(3*f);e.cachedElevationAnchors=y;for(let b=0;b=0?(st(c,e.anchors[3*C],e.anchors[3*C+1],e.anchors[3*C+2]),ae(c,c,e.node.mbs),pe(c,s,c,o),y[E]=c[0],y[E+1]=c[1],y[E+2]=g.getAltitude(c)):(this._collection.getComponentAabb(e.objectHandle,b,l,!0),st(c,(l[0]+l[3])/2,(l[1]+l[4])/2,l[2]),Ct(c,c,d.rotationScale),ae(c,c,d.position),y[E+2]=g.getAltitude(c),pe(c,t,c,o),y[E]=c[0],y[E+1]=c[1])}return y})(),M=i.offset,w=e.elevationOffsets,S=(y,I)=>{const b=u?v[3*y+2]:0;w[y]=M+(I!=null?I-b:0)};a.getElevations(v,f,S)}_ensureElevationTask(){return this._elevationTask!=null||(this._elevationTask=new fe(this.view.resourceController.scheduler,e=>{const t=this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference);return t!=null?t.filterInPlace(s=>this._nodeId2Meta.get(s)!=null):null},e=>{const t=this._nodeId2Meta.get(e);this._nodeElevationAlignmentChanged(t)})),this._elevationTask}_elevationInfoChanged(e,t){const s=e.mode!==R.Absolute,i=!!t&&t!==e&&t.mode!==R.Absolute;this._intersectionHandler.updateElevationAlignState(s,this.view.state.viewingMode),s&&!i&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach(a=>this._nodeElevationAlignmentChanged(a))}_nodeElevationAlignmentChanged(e){e!=null&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),this._labeler!=null&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,T.UPDATE))}_safeReschedule(e,t){return Ve(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const s=e.params.material!=null?e.params.material:Ci(),i=t.some(h=>h.name==="uvRegion"),a=t.some(h=>h.name==="normalCompressed"),o=pt(s);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:a,hasRegions:i}),material:s}}_initMaterialAndTextures(e,t,s,i){const a=this._stage.renderView,o=s.map(d=>Mi(d,t,i,a));this._stage.addMany(o);let h=null;return this._collection.updateMaterial(e,d=>{h=Ei(d,t,o,s,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(d)}),{textures:o,texturePromise:h}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?de.Atlas:de.Default:de.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,s){let i=this._addTasks.get(e.index);return i?i.attributeInfo=t:(i={...ei(),attributeInfo:t,meta:null},this._addTasks.set(e.index,i),s().then(i.resolve,i.reject).then(()=>this._addTasks.delete(e.index)).catch(a=>{throw this._addTasks.delete(e.index),a})),i.promise}_clearAddTasks(){this._addTasks.forEach(e=>{e.meta!=null&&(this._cacheGPUData(e.meta),e.meta=null)}),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,s=ve();this._renderClippingArea=it(this.view.clippingArea,s,e)?s:null;const i=ve();this._layerClippingArea=it(this.view.clippingArea,i,t)?i:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e)}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach(t=>{t!=null&&this._applyFiltersToNode(t)&&(this._addOrUpdateEdgeRendering(t),this._visibleGeometryChanged(t,T.UPDATE))})}getFilters(){const e=[],t=this._renderClippingArea;return t!=null&&e.push((s,i)=>this._boundingRectFilter(s,i,t)),e}addSqlFilter(e,t,s){if(t!=null){const i=t.fieldNames;e.push((a,o)=>this._sqlFilter(a,o,t,i,s))}}_sqlFilter(e,t,s,i,a){var u;const o={},h=this._createLayerGraphic(o),d=this.i3slayer.objectIdField,c=t.featureIds,l=(u=t.attributeInfo)==null?void 0:u.attributeData;i.every(g=>g===d||(l==null?void 0:l[g])!=null)&&rt(e,c,g=>{o[d]=c[g];for(const f of i)f!==d&&(o[f]=l?Ae(l[f],g):null);try{return s.testFeature(h)}catch(f){return a(f),!1}})}_boundingRectNodeTest(e,t){return Dt(e.node.mbs,this._controller.crsIndex,gt,this.view.renderSpatialReference),ti(t,gt)}_boundingRectFeatureTest(e,t,s){return this._collection.getComponentAabb(e.objectHandle,t,ut),si(ut,_t),ii(s,_t)}_boundingRectFilter(e,t,s){const i=this._collection,a=this._boundingRectNodeTest(t,s);if(a===he.INSIDE)return;if(a===he.OUTSIDE)return void(e.length=0);const o=i.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const h=this._transformClippingArea(nr,s,t.objectHandle);rt(e,t.featureIds,d=>this._boundingRectFeatureTest(t,d,h))}_transformClippingArea(e,t,s){const i=this._collection.getObjectTransform(s),a=i.position,o=i.rotationScale;return e[0]=(t[0]-a[0])/o[0],e[1]=(t[1]-a[1])/o[4],e[2]=(t[2]-a[0])/o[0],e[3]=(t[3]-a[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const s=this._edgeView;if(s==null)return Promise.resolve(null);const i=e.objectHandle,a=s.hasObject(i),{hasEdges:o,perFeatureEdgeMaterials:h}=this._getFilteredEdgeMaterials(e),d={hasSlicePlane:this.slicePlaneEnabled};return o&&a?(this.nodeCrossfadingEnabled&&re(h,this.getNodeOpacity(e)),s.updateAllComponentMaterials(i,h,d,t).catch(c=>L(c,this.i3slayer.title)),s.updateObjectVisibility(i,!0).catch(c=>L(c,this.i3slayer.title)),s.updateAllVerticalOffsets(i,e.elevationOffsets).catch(c=>L(c,this.i3slayer.title)),Promise.resolve(s)):o&&!a?this._collection.addEdges(i,s,h,d).then(c=>(e.edgeMemoryUsage=c,e.node.memory+=c,s.updateAllVerticalOffsets(i,e.elevationOffsets).catch(l=>L(l,this.i3slayer.title)),s)):(!o&&a&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,s.removeObject(i)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(this._labeler!=null&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,s=t.getComponentCount(e.objectHandle),i=e.filteredIds!=null,a=s.invisible===0;if(t.setAllComponentVisibilities(e.objectHandle,"all"),this._filters.length===0)return e.filteredIds=null,!a;if(this._updateCachedFilteredIds(e),i&&e.filteredIds===e.featureIds)return!a;const o=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_updateCachedFilteredIds(e){e.filteredIds!=null&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const s of this._filters)if(s(t,e),t.length===0)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array,s=e.filteredIds;return s!=null&&e.featureIds.forEach((i,a)=>{s[t.length]===i&&t.push(a)}),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach((t,s)=>this._removeNodeStageData(s,e)),this._nodeId2MetaReloading.forEach((t,s)=>this._removeNodeStageData(s,e,this._nodeId2MetaReloading)),this._elevationTask=A(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),this._elevationTask!=null&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,s=this._nodeId2Meta){s.has(e)&&this._controller.updateLoadStatus(e,!1);const i=s.get(e);i!=null?(this._collection.setObjectVisibility(i.objectHandle,Re.Hidden),this._edgeView!=null&&this._edgeView.hasObject(i.objectHandle)&&this._edgeView.updateObjectVisibility(i.objectHandle,!1).catch(a=>L(a,this.i3slayer.title)),this._visibleGeometryChanged(i,T.REMOVE),this._labeler!=null&&this._labeler.removeNodeMeta(i),s.delete(e),this._highlights.objectDeleted(i),s===this._nodeId2Meta?(this._cacheGPUData(i,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(i)):this._deleteComponentObject(i),this._treeDebugger!=null&&this._treeDebugger.update()):s.delete(e)}_deleteComponentObject(e){if(this._edgeView!=null&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const s=this._nodeId2Meta.get(e);s!=null&&this._collection.updateMaterial(s.objectHandle,i=>i.polygonOffsetEnabled=t===Ti.Hole)}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const s=this._nodeId2MetaReloading.get(e);s&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,s))}_invalidateAllSymbols(){this._rendererVersion=Fe(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Fe(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Fe(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await ri()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)t.type==="color"?this._colorVariable=t:t.type==="opacity"?this._opacityVariable=t:P.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())t.type!=="mesh-3d"&&P.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(s,i)=>{var o;const a=5*s;if(ai(i.externalColor,t[a]/255,t[a+1]/255,t[a+2]/255,t[a+3]/255),this._stage.renderView.objectAndLayerIdRenderHelper!=null){const h=e.featureIds[s],d=ni(this.view.map,this.layerUid);this._stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(h,h,this.layerId,this.layerUid+"_"+this.sublayerId,this.layerPopupEnabledAndHasTemplate&&!d,e.node.resources.attributes,s,this.sublayerId),i.objectAndLayerIdColor=this._stage.renderView.getObjectAndLayerIdColor({graphicUid:h,layerUid:this.layerUid+"_"+this.sublayerId})}i.externalColorMixMode=t[a+4]&(1<0?this._rendererFields!=null&&this._rendererFields.length>0?di(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){var S;if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,s={};t.attributes=s;const i=this._currentRenderer,a=(S=e.attributeInfo)==null?void 0:S.attributeData,o=e.featureIds!=null?this.i3slayer.objectIdField:null,h=a!=null&&this._symbologyFields!=null&&this._symbologyFields.length>0;let d=null,c=null;if(h&&this._symbologyFields!=null){d=[],c=[];for(const y of this._symbologyFields){const I=a[y];I&&(d.push(y),c.push(I))}}e.cachedSymbology||(e.cachedSymbology=Pi(5*e.featureIds.length));const l={color:ie,castShadows:!0,pickable:!0,colorMixMode:ce.Multiply,edgeMaterial:null},u=this.fullOpacity,g=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let f=null,v=ue.OPAQUE,M=Z,w=0;for(let y=0;y=1&&(e.material.isOpaque||l.colorMixMode===ce.Replace)?ue.OPAQUE:ue.TRANSPARENT;l.edgeMaterial===f&&C===v||(M={...l.edgeMaterial,opacity:g,objectTransparency:C},f=l.edgeMaterial,v=C),e.cachedEdgeMaterials[y]=M}else e.cachedEdgeMaterials[y]=Z;e.cachedSymbology[w++]=Math.round(255*b[0]),e.cachedSymbology[w++]=Math.round(255*b[1]),e.cachedSymbology[w++]=Math.round(255*b[2]),e.cachedSymbology[w++]=Math.round(255*b[3]),e.cachedSymbology[w++]=l.colorMixMode|+l.castShadows<h!==Z),perFeatureEdgeMaterials:t};let i=0,a=!1;const o=t.map((h,d)=>e.featureIds[d]!==s[i]?Z:(a=a||h!==Z,i++,h));return{hasEdges:a,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,s=this._getComponentParameters(e);this._collection.setComponentData(t,s),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),this._controller!=null&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach(t=>{t!=null&&(this._collection.updateMaterial(t.objectHandle,s=>s.objectOpacity=e),re(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))})}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,t=>{t.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,t.usePBR=this._usePBR,this._updateMaterialOverlay(t)})}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,T.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this._labeler!=null&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach(t=>{t!=null&&(this._collection.updateMaterial(t.objectHandle,s=>s.commonMaterialParameters.hasSlicePlane=e),this._updateEdgeRendering(t,!1))})}_updatePBR(e){this._nodeId2Meta.forEach(t=>{t!=null&&this._collection.updateMaterial(t.objectHandle,s=>s.usePBR=e)}),this._hasLoadedPBRTextures=!0}get _usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){this._edgeView!=null&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,s,i)=>i.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?x.CONTINUE:e(t,s,i):e}_forAllFeatures(e,t,s){be(this._nodeId2Meta,i=>{if(i==null)return!1;if(t!=null)switch(t(i)){case x.EXIT:return!0;case x.SKIP:return!1}let a=x.CONTINUE;switch(s){case q.ALL:a=this._forAllFeaturesOfNode(i,e);break;case q.VISIBLE_ONLY:a=this._forAllVisibleFeaturesOfNode(i,e);break;case q.QUERYABLE:a=this._forAllQueryableFeaturesOfNode(i,e)}return a===x.EXIT})}_forAllFeaturesOfNode(e,t){let s=x.CONTINUE;const i=e.featureIds;for(let a=0;a(s=t(i[a],a,e),s===x.CONTINUE)),s}_forAllQueryableFeaturesOfNode(e,t){const s=this._ignoreClientNodeOverriddenFeatures(t);if(this._renderClippingArea==null)return this._forAllFeaturesOfNode(e,s);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===he.OUTSIDE)return x.CONTINUE;if(i===he.INSIDE)return this._forAllFeaturesOfNode(e,s);const a=x.CONTINUE,o=e.featureIds,h=e.objectHandle,d=ui(this._renderClippingArea,this._collection.getObjectTransform(h));for(let c=0;c0){if(e[0]instanceof le){const t=e,s=this.i3slayer.fieldsIndex,i=this._getObjectIdField(),a=t.map(d=>Te(s,d.attributes,i)),{set:o,handle:h}=this._highlights.acquireSet();return this._highlights.setFeatureIds(o,a),h}if(typeof e[0]=="number"){const t=e,{set:s,handle:i}=this._highlights.acquireSet();return this._highlights.setFeatureIds(s,t),i}}return Et()}resetHighlights(){A(this._highlights),this._highlights=new zi({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,q.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)})}_visibleGeometryChanged(e,t){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),this._visibleGeometryChangedSchedulerHandle==null&&(this._visibleGeometryChangedSchedulerHandle=gi(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})),this._updateSnappingSources(e,t))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this._gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this._geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this._texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.unloadedMemory/1048576).toFixed(1)+"MB"};return this._memCache!=null&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this,t=s=>{this._nodeColorOverride=s,this._invalidateAllSymbols()};return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const s=[];return e._forAllFeatures(i=>(s.push(i),x.CONTINUE),null,q.VISIBLE_ONLY),s.sort((i,a)=>i-a),s},get numNodes(){return e._nodeId2Meta.size},get loadedNodes(){return Array.from(e._nodeId2Meta.keys()).sort((s,i)=>s-i)},setNodeColorOverride:t,setNodeColoring:s=>{t(s==="client-nodes"?(i,a)=>{i.index<0?(a[0]=1,a[1]=0,a[2]=0):(a[0]=1,a[1]=1,a[2]=1)}:null)}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return e!=null?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach((t,s)=>e(s,t))}fadeNode(e,t,s){if(!this.nodeCrossfadingEnabled)return;const i=this._nodeId2Meta.get(e);i!=null&&this._crossfadeHelper.fadeNode(e,i,t,s)}setNodeOpacityByIndex(e,t){const s=this._nodeId2Meta.get(e);s!=null&&this._setNodeOpacity(s,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,s=>s.objectOpacity=t),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(this._edgeView==null||!e.cachedEdgeMaterials)return;re(e.cachedEdgeMaterials,t);const s=e.objectHandle;this._edgeView.hasObject(s)&&this._edgeView.updateAllComponentOpacities(s,t).catch(i=>L(i,this.i3slayer.title))}get hasModifications(){return this._isIntegratedMesh&&this._layerClippingArea!=null||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||this._i3sWasmLoaded!==!0)return;const s=this.uid,i=hr(e);if(i!=null){const a={context:s,buffer:i.buffer};Ai(a);const o=new Float64Array(i.buffer);e.forAll((h,d)=>{const c=o[d],l=Fi(c);h.imModificationImpact=l,l!==nt.Unmodified&&this._controller.invalidateGeometryVisibility(h.index)})}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){var e;return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||this._labeler!=null&&this._labeler.updating||((e=this._crossfadeHelper)==null?void 0:e.updating)||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||this._elevationTask!=null&&this._elevationTask.running}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(s,i,a)=>{const o=this._nodeId2Meta.get(s);if(o==null)throw new Error("invalid-node");const{origin:h,buffer:d}=await this._collection.extractEdgeInformation(o.objectHandle,i,a);return this._snappingLocationsApplyElevation(o,d,h),{type:"components",objectIds:o.featureIds,locations:d,origin:h}},remove:()=>{Ot(this._snappingSourcesTrackers,t)}};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach((s,i)=>{if(s==null)return;const a=this._controller.getRenderMbs(s.node);a!=null&&e.add(i,a)}),t}_snappingLocationsApplyElevation(e,t,s){if(!e.elevationOffsets||this.elevationInfo.mode===R.Absolute)return;const i=t.position0,a=t.position1,o=t.componentIndex,h=G(),d=G(),c=(l,u)=>{ae(l,l,s),this.view.renderCoordsHelper.worldUpAtPosition(l,d),ae(l,l,mi(d,d,u)),fi(l,l,s)};for(let l=0;l=0||r&&r.metallicRoughnessTextureId>=0||n.normalTextureId>=0||n.emissiveTextureId>=0||n.occlusionTextureId>=0}function dr(n){return"geometryData"in n}function mt(n){return n!=null&&Tt(n.data)}function ft(n,r){let e=1024+n.interleavedVertexData.byteLength+(n.indices?n.indices.byteLength:0)+n.positionData.data.byteLength+n.positionData.indices.byteLength;if(r!=null)for(const t of r)t!=null&&Tt(t.data)&&(e+=t.data.byteLength);return e}function yt(n,r){return r.byteSize>ar?(P.warn(`Node is too big to store in IndexedDB cache: ${n.id} (${r.byteSize} bytes)`),!1):r.byteSize>0}function hr(n){if(n.length===0)return null;const r=10*n.length,e=new Float64Array(r);return n.forAll((t,s)=>{let i=t.serviceObb;i==null&&(i=or,pi(i.center,t.mbs),i.halfSize[0]=i.halfSize[1]=i.halfSize[2]=t.mbs[3]);const a=10*s;e[a]=i.center[0],e[a+1]=i.center[1],e[a+2]=i.center[2],e[a+3]=i.halfSize[0],e[a+4]=i.halfSize[1],e[a+5]=i.halfSize[2],e[a+6]=i.quaternion[0],e[a+7]=i.quaternion[1],e[a+8]=i.quaternion[2],e[a+9]=i.quaternion[3]}),e}function re(n,r){n.forEach(e=>e.opacity=r)}var R;(function(n){n[n.Absolute=0]="Absolute",n[n.RelativeToGround=1]="RelativeToGround",n[n.OnTheGround=2]="OnTheGround"})(R||(R={}));const cr=G(),bt=Ie(),vt="elevation-change";function ur(n){return r=>{if(n.immediate)return n.immediate.schedule(r);throw console.error("Error no immediate schudler"),new Error("cant find immediate scheduler")}}export{Nr as E,x as I,q as a,vr as c}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/I3STreeDebugger-tPVEJfH8.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/TileTreeDebugger-2DVbY5sQ.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/I3SMeshView3D-frxYFPRW.js b/dist/assets/I3SMeshView3D-frxYFPRW.js new file mode 100644 index 0000000..eff2d87 --- /dev/null +++ b/dist/assets/I3SMeshView3D-frxYFPRW.js @@ -0,0 +1,7 @@ +import{sF as Ke,sG as Yt,sH as Qt,sI as j,bt as Xt,c2 as Zt,mU as Ye,sJ as we,nS as Jt,ea as Ie,hV as be,gk as He,rq as De,ld as It,bF as $e,sK as es,j6 as Ct,bO as ae,a8 as G,z as Ge,lB as ye,e as p,y as m,c as Ce,g as Ue,ax as ts,C as ss,B as Pe,aF as is,b as A,kd as rs,sL as as,sM as ns,sN as Se,bU as os,aO as Mt,lA as ls,cj as ds,R as Le,bx as pe,a0 as Et,gH as Ot,bn as hs,bq as cs,oh as us,ed as je,cb as _s,cc as xt,ha as gs,hb as wt,et as ps,bT as St,fh as Nt,ce as ms,F as fs,sO as bs,sP as ys,sQ as Qe,sR as vs,me as Is,sS as Cs,oA as Rt,r as Ms,fU as Es,ab as Ve,cf as ve,sT as At,W as Os,fd as xs,h as ws,K as le,sU as Ss,dw as Xe,m0 as Ze,dE as Ne,sV as Ns,sW as Rs,P as V,de as As,jV as Z,sX as Fs,sY as Ts,ac as Ft,sZ as Je,s_ as Ds,s$ as Ps,lM as js,fI as Vs,lE as Hs,dY as $s,t0 as et,t1 as Gs,mS as Us,t2 as Ls,t3 as ks,t4 as Bs,t5 as tt,t6 as zs,t7 as Re,t8 as qs,t9 as Ws,ta as Ks,oj as Ys,tb as Qs,qx as Xs,fw as Zs,bA as Js,tc as de,bz as st,ag as ei,se as it,mT as rt,lO as Ae,td as ti,mV as si,jS as ii,te as he,tf as Fe,cZ as ri,tg as ai,lF as ni,th as oi,ti as li,nW as di,oq as ce,tj as ue,tk as hi,tl as ci,tm as at,tn as J,to as ui,V as _i,f2 as gi,gj as Tt,b3 as pi,ca as mi,b4 as fi}from"./index-pCX-0tJH.js";import{b as me,a as Dt,s as ee,M as bi,c as _e,S as yi,e as vi,D as Ii,d as Ci,F as Mi,f as Ei}from"./I3SOverrides-XXafrk1K.js";import{f as Oi}from"./SceneModification-E4lNPbBQ.js";import{F as xi,y as wi,l as Si}from"./Graphics3DObjectStates-JUKhPt0b.js";import{e as L,I as Ni,E as Ri,L as Ai,A as Fi}from"./SceneLayerWorker-fjNBmTGi.js";import{n as nt,s as Ti}from"./I3SNode-A9aOJfXV.js";import{n as Te}from"./HeatmapDensity.glsl-de3m0xZZ.js";function Di(n,r,e,t){if(r==null||t==null)return!1;const s=Ke(r,Yt),i=Ke(t,Qt);if(s===i&&s!==j.UNKNOWN||Xt(r,t))return e[0]=1,e[1]=1,e[2]=1,!0;if(s===j.SPHERICAL_ECEF){const a=Zt(n),o=a/Math.sqrt(n[0]*n[0]+n[1]*n[1]),h=a/Ye.radius;if(i===j.WEB_MERCATOR)return e[0]=o*h,e[1]=o*h,e[2]=1,!0;if(i===j.WGS84||i===j.CGCS2000){const d=we;return e[0]=d*o*h,e[1]=d*h,e[2]=1,!0}}else if(s===j.PLATE_CARREE){if(i===j.WGS84||i===j.CGCS2000)return e[0]=we,e[1]=we,e[2]=1,!0;if(i===j.WEB_MERCATOR){const a=n[1]/Ye.radius;return e[0]=1,e[1]=1/Math.cos(a),e[2]=1,!0}}return!1}function Pi(n,r=!1){return n<=Jt?r?new Array(n).fill(0):new Array(n):new Uint8Array(n)}function vr(n,r,e){const t=be(24);return s=>{let i=s.meta.featureExtents;if(i==null){i=new Float64Array(6*s.meta.featureIds.length),s.meta.featureExtents=i;for(let o=0;o0){const r=this.toArray();this._map.clear(),this.emit("change",{added:[],removed:r})}}get length(){return this._map.size}get(r){return this._map.get(r)}addMany(r){if(r.length===0)return;const e=new Set;for(let s=0;s0?r.filter(s=>!e.has(s.objectId)):r;t.length>0&&this.emit("change",{added:t,removed:[]})}removeMany(r){const e=[];for(const t of r){const s=t.objectId,i=this._map.get(s);i!=null&&(!i.refCount||--i.refCount<=0)&&(this._map.delete(s),e.push(t))}e.length>0&&this.emit("change",{added:[],removed:e})}removeManyByObjectId(r){const e=[];for(const t of r){const s=this._map.get(t);s!=null&&(!s.refCount||--s.refCount<=0)&&(this._map.delete(t),e.push(s))}e.length>0&&this.emit("change",{added:[],removed:e})}toArray(){return[...this._map.values()]}find(r){let e;return ye(this._map,t=>!!r(t)&&(e=t,!0)),e}forEach(r){this._map.forEach(e=>r(e))}}let Hi=class extends Ge{constructor(r){super(),this._limit=r,this._all=new Vi,this._active=new Gi(this),this._pending=new Map,this._handle=this._all.on("change",e=>this._handleChanges(e))}destroy(){this._handle.remove()}get length(){return this._active.length}toArray(){return this._active.toArray()}find(r){return this._active.find(r)}forEach(r){this._active.forEach(r)}addMany(r){this._all.addMany(r)}removeManyByObjectId(r){this._all.removeManyByObjectId(r)}_handleChanges(r){let e=r.removed;if(this._pending.size>0){e=new Array;for(const a of r.removed)this._pending.delete(a.objectId)||e.push(a)}let t=this._limit-this._active.length+e.length;t{K.sample()&&(e.push(a),this._pending.set(a.objectId,a))}),t=this._limit-this._active.length+e.length);let s=r.added;if(t0&&this._pending.size>0&&(K.reset(i/this._pending.size),this._pending.forEach(a=>{K.sample()&&(s.push(a),this._pending.delete(a.objectId))})),this._active.addAndRemove(s,e)}},$i=class{constructor(){this._percentage=1,this._last=-1,this._index=0}reset(r){this._percentage=r,this._last=-1}sample(){const r=Math.floor(this._index*this._percentage);return++this._index,r!==this._last&&(this._last=r,!0)}};const K=new $i;let Gi=class{constructor(r){this._parent=r,this._map=new Map}get length(){return this._map.size}forEach(r){this._map.forEach(e=>r(e))}find(r){let e;return ye(this._map,t=>!!r(t)&&(e=t,!0)),e}toArray(){return[...this._map.values()]}addAndRemove(r,e){for(const t of r)this._map.set(t.objectId,t);for(const t of e)this._map.delete(t.objectId);(r.length>0||e.length>0)&&this._parent.emit("change",{added:r,removed:e})}removeMany(r){for(const e of r)this._map.delete(e.objectId);r.length>0&&this._parent.emit("change",{added:[],removed:r})}};class lt{constructor(r,e){this.meta=r,this.index=e}}class Ui{constructor(r,e){this.graphic=r,this.geometry=e,this.components=[],this.overridesDirty=!1}}let F=class extends Ue{get updating(){var n;return((n=this._graphicsCore)==null?void 0:n.updating)??!1}constructor(n){super(n),this.loadedGraphics=new Hi(5e4),this.slicePlaneEnabled=!1,this._renderingInfo={symbol:new ts},this._featuresMap=new Map}initialize(){const n=this.view.basemapTerrain;this._graphicsCore=new xi({owner:this,layer:this.layer,preferredUpdatePolicy:ss.ASYNC,elevationFeatureExpressionEnabled:!1,graphicSymbolSupported:!1,getRenderingInfoWithoutRenderer:!0,hasZ:!0,hasM:!1,componentFactories:{deconflictor:r=>this.view.deconflictor.addGraphicsOwner(r),labeler:(r,e)=>this.view.labeler.addGraphicsOwner(r,e,{emptySymbolLabelSupported:!0,elevationInfoOverride:{mode:"absolute-height",offset:0},disablePlacement:{logEntityDescription:"3D Object Scene Layer features"}}),scaleVisibility:(r,e)=>new wi({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:e,graphicsCore:r,basemapTerrain:n,layerScaleEnabled:!1})}}),this._graphicsCore.initializePromise.then(()=>this._graphicsCore.startCreateGraphics()).catch(()=>{}),this.addHandles(Pe(()=>this.layer.labelingInfo,(r,e)=>{is(r,e)&&this._graphicsCore.updateLabelingInfo()}))}destroy(){this._graphicsCore=A(this._graphicsCore),this.loadedGraphics=A(this.loadedGraphics),this.view=null}addNodeMeta(n,r){let e=0;const t=n.filteredIds,s=this.view.spatialReference,i=[];for(let a=0;a{const i=this._graphicsCore.getGraphics3DGraphicById(t.uid);i!=null&&this._updateLabelGeometry(n.featureIds[e])&&i.alignWithAbsoluteElevation(s.z??0,r,!1)})}setNodeMetaAttributes(n,r){const e=new Array;this._forEachGraphic(n,(t,s)=>{const i=r(t,n);as(s.attributes,i)||(s.attributes=i,e.push(s.uid))}),this._graphicsCore.updateLabelingInfo(e)}applyFilterChange(n){this._forEachFeature(n,(r,e,t)=>{if(!this._enabledForFeatureInNode(n,r)){const a=n.featureIds[r];switch(this._removeFeature(e,n,r)){case $.REMOVED:this.loadedGraphics.removeManyByObjectId([a]);break;case $.MODIFIED:this._updateLabelPosition(a)}return}const s=e.graphic,i=s.visible;i!==t&&(s.visible=t,te.graphic=s,te.property="visible",te.oldValue=i,te.newValue=t,this._graphicsCore.graphicUpdateHandler(te))})}removeNodeMeta(n){const r=[];this._forEachGraphic(n,e=>{const t=n.featureIds[e],s=this._featuresMap.get(t);if(s)switch(this._removeFeature(s,n,e)){case $.MODIFIED:this._updateLabelPosition(t);break;case $.REMOVED:r.push(t)}}),this.loadedGraphics.removeManyByObjectId(r)}_removeFeature(n,r,e){const t=n.components.length;return ns(n.components,s=>!(s.meta===r&&s.index===e)),n.components.length===0?(this._featuresMap.delete(r.featureIds[e]),$.REMOVED):t!==n.components.length?$.MODIFIED:$.UNMODIFIED}getRenderingInfo(){return this._renderingInfo}notifyGraphicGeometryChanged(){}notifyGraphicVisibilityChanged(){}_updateLabelPosition(n){const r=this._featuresMap.get(n);r&&this._updateLabelGeometry(n)&&(this.loadedGraphics.removeManyByObjectId([n]),this.loadedGraphics.addMany([r.graphic]))}_updateLabelGeometry(n){const r=this._featuresMap.get(n);if(!r)return!1;const e=r.geometry,t=this.view.spatialReference,s=this.view.renderCoordsHelper,i=e.x,a=e.y,o=e.z??0,h=r.components.length,d=be(h*ot);let c=0;for(const{meta:l,index:u}of r.components)ke(u,this.collection,l.objectHandle,d,c),c+=ot;return He(d,s.spatialReference,0,d,t,0,d.length/3),De(k,It),$e(k,d),e.x=(k[0]+k[3])/2,e.y=(k[1]+k[4])/2,e.z=k[5],!Se(e.x,i)||!Se(e.y,a)||!Se(e.z,o)}_forEachGraphic(n,r){this._forEachFeature(n,(e,{graphic:t,geometry:s},i)=>{this._enabledForFeatureInNode(n,e)&&r(e,t,s,i)})}_forEachFeature(n,r){let e=0;for(let t=0;t[e.geometryBuffer],project:e=>[e.positions.buffer],transformNormals:e=>[e.normals.buffer]},r,{hasInitialize:!0})}setModifications(r,e,t,s){const i={context:r,modifications:Pt(e,t,s),isGeodetic:s.isGeographic};this.broadcast(i,"setModifications")}setLegacySchema(r,e){const t=JSON.stringify(e);return this.broadcast({context:r,jsonSchema:t},"setLegacySchema")}destroyContext(r){return this.broadcast(r,"destroyContext")}project(r,e){return this.invokeMethod("project",r,e)}transformNormals(r,e){return this.invokeMethod("transformNormals",r,e)}};const _=new Mt({deallocator:null}),Y=[0,0,0];function Pt(n,r,e){_.clear();let t=1/0,s=1/0,i=-1/0,a=-1/0,o=!1;for(const d of r){const c=d.type==="clip"?L.Inside:d.type==="mask"?L.Outside:L.Replace,l=d.geometry;let u=g=>g;if(l.spatialReference){if(!ds(l.spatialReference,e)){Le.getLogger("esri.views.3d.layers.I3SMeshWorkerHandle").warn("Can't project modification polygon into layer spatial reference, ignoring modification");continue}u=g=>(pe(g,l.spatialReference,Y,e),Y)}else l.hasZ||(Y[2]=0,u=g=>(Y[0]=g[0],Y[1]=g[1],Y));o=o||c===L.Outside,_.push(c),_.push(l.rings.length);for(const g of l.rings){_.push(g.length);for(const f of g){const v=u(f);_.push(v[0]),_.push(v[1]),_.push(v[2]),t=Math.min(t,v[0]),s=Math.min(s,v[1]),i=Math.max(i,v[0]),a=Math.max(a,v[1])}}}n!=null&&(o?(_.push(L.Inside),_.push(2),_.push(4),_.push(t-1e-4),_.push(s-1e-4),_.push(0),_.push(i+1e-4),_.push(s-1e-4),_.push(0),_.push(i+1e-4),_.push(a+1e-4),_.push(0),_.push(t-1e-4),_.push(a+1e-4),_.push(0),_.push(4),_.push(n[0]),_.push(n[1]),_.push(0),_.push(n[2]),_.push(n[1]),_.push(0),_.push(n[2]),_.push(n[3]),_.push(0),_.push(n[0]),_.push(n[3]),_.push(0)):(_.push(L.Outside),_.push(1),_.push(4),_.push(n[0]),_.push(n[1]),_.push(0),_.push(n[2]),_.push(n[1]),_.push(0),_.push(n[2]),_.push(n[3]),_.push(0),_.push(n[0]),_.push(n[3]),_.push(0))),_.push(L.Finished);const h=new Float64Array(_.length);for(let d=0;d<_.length;++d)h[d]=_.at(d);return h}var q,x;(function(n){n[n.VISIBLE_ONLY=0]="VISIBLE_ONLY",n[n.ALL=1]="ALL",n[n.QUERYABLE=2]="QUERYABLE"})(q||(q={})),function(n){n[n.EXIT=0]="EXIT",n[n.CONTINUE=1]="CONTINUE",n[n.SKIP=2]="SKIP"}(x||(x={}));let Bi=class{constructor(){this.ids=new Set}};class zi{constructor({collection:r,forAllFeatures:e,forAllFeaturesOfNode:t}){this._highlights=[],this._collection=r,this._forAllFeatures=e,this._forAllFeaturesOfNode=t}destroy(){this._highlights.forEach(r=>this._releaseSet(r)),this._highlights=null}acquireSet(){const r=new Bi;this._highlights.push(r);const e=Et(()=>{this._highlights&&(this._releaseSet(r),Ot(this._highlights,r))});return{set:r,handle:e}}setFeatureIds(r,e){e.forEach(t=>r.ids.add(t)),this._initializeSet(r)}_initializeSet(r){this._forAllFeatures((e,t,s)=>(r.ids.has(e)&&this._collection.addComponentHighlight(s.objectHandle,t),x.CONTINUE))}_releaseSet(r){this._forAllFeatures((e,t,s)=>(r.ids.has(e)&&this._collection.removeComponentHighlight(s.objectHandle,t),x.CONTINUE))}objectCreated(r){this._highlights.forEach(e=>{this._forAllFeaturesOfNode(r,(t,s)=>(e.ids.has(t)&&this._collection.addComponentHighlight(r.objectHandle,s),x.CONTINUE))})}objectDeleted(r){this._collection.clearHighlights(r.objectHandle)}}let fe=class extends Ue{constructor(r,e,t){super({}),this._updateExtent=e,this._updateNode=t,this.running=!1,this._extentSet=new Si,this._nodeSet=new Set,this.addHandles(r.registerTask(hs.ELEVATION_ALIGNMENT,this))}normalizeCtorArgs(){return{}}addExtent(r){this._extentSet.add(r),this.running=!0}schedule(r){this._nodeSet.add(r),this.running=!0}remove(r){this._nodeSet.delete(r),this._updateRunning()}runTask(r){const e=this._extentSet;for(r.run(()=>e.merge(r));!e.empty&&!r.done;){const s=this._updateExtent(e.pop());s!=null&&s.forAll(i=>this.schedule(i)),r.madeProgress()}if(r.done)return;const t=this._nodeSet;for(const s of t)if(t.delete(s),this._updateNode(s),r.madeProgress(),r.done)break;this._updateRunning()}_updateRunning(){this.running=this._nodeSet.size>0||this._extentSet.size>0}};p([m()],fe.prototype,"running",void 0),fe=p([Ce("esri.views.3d.layers.i3s.I3SAsyncElevationUpdater.ts")],fe);let qi=class{constructor(){this.lodCrossfadeSignedDuration=0}},Wi=class{constructor(r){this._view=r,this._preRenderFrameTaskHandle=null,this._currentFrameStartTime=null,this._numFadingNodes=0}destroy(){var r;(r=this._preRenderFrameTaskHandle)==null||r.remove(),this._preRenderFrameTaskHandle=null,this._view=null}get updating(){return this._numFadingNodes>0}stopNodeFading(r){r.lodCrossfadeProgress!=null&&(this._numFadingNodes--,r.lodCrossfadeProgress=null,this._numFadingNodes===0&&(this._preRenderFrameTaskHandle!=null&&(this._preRenderFrameTaskHandle=cs(this._preRenderFrameTaskHandle)),this._view.notifyLODUpdate(),this._view.notifyUpdate()))}_startNodeFading(r,e,t){this._numFadingNodes===0&&(this._preRenderFrameTaskHandle=us({preRender:s=>this._updateAllNodeFading(s)}),this._view.notifyLODUpdate()),r.lodCrossfadeProgress==null&&(this._numFadingNodes++,this._view.notifyUpdate()),r.lodCrossfadeSignedDuration=t,r.lodCrossfadeProgress=e}_updateAllNodeFading(r){const e=this._view.nodeCrossfadingEnabled;this._view.foreachCrossfadeNode((t,s)=>{if((s==null?void 0:s.lodCrossfadeProgress)!=null){const i=s.lodCrossfadeSignedDuration,a=i>0?this._view.fullOpacity:0,o=r.deltaTime/i,h=s.lodCrossfadeProgress+Math.abs(o),d=!e||h>=1||i===0,c=a-(d?0:i>0?1:-1)*(1-h);d?(this.stopNodeFading(s),i<0&&this._view.markNodeToRemove(t)):s.lodCrossfadeProgress=h,this._view.setNodeOpacityByIndex(t,c)}}),this._view.removeMarkedNodes()}stopAllNodeFading(){this._view.foreachCrossfadeNode((r,e)=>{if((e==null?void 0:e.lodCrossfadeProgress)!=null){this.stopNodeFading(e);const t=e.lodCrossfadeSignedDuration;t<0&&this._view.markNodeToRemove(r);const s=t>0?this._view.fullOpacity:0;this._view.setNodeOpacityByIndex(r,s)}}),this._view.removeMarkedNodes()}fadeNode(r,e,t,s){this._currentFrameStartTime==null&&(this._currentFrameStartTime=Date.now());const i=this._view,a=i.nodeCrossfadingEnabled,o=t===me.FadeIn?i.fullOpacity:0,h=a?s?t===me.FadeIn?i.lodCrossfadeinDuration:i.lodCrossfadeoutDuration:i.lodCrossfadeUncoveredDuration:0,d=this._view.getNodeOpacityByIndex(r);if(a&&d!==o&&h>0){const c=1-Math.abs(o-d);this._startNodeFading(e,c,Ki(t)*h)}else this.stopNodeFading(e),this._view.setNodeOpacityByIndex(r,o),t===me.FadeOut&&this._view.removeNode(r)}isNodeFullyFadedIn(r){const e=this._view.getNodeCrossfadeMetaData(r);return e==null||e.lodCrossfadeProgress==null&&this._view.getNodeOpacityByIndex(r)===this._view.fullOpacity}};function Ki(n){return n===me.FadeIn?1:-1}const B=je(),se=St(),dt=Nt(0,0,0,0),H=G(),Yi=G(),Qi=G();let z=class extends Ge.EventedMixin(Ue){get spatialReference(){var n,r;return(r=(n=this.view)==null?void 0:n.elevationProvider)==null?void 0:r.spatialReference}constructor(n){super(n),this._tmpEvent={spatialReference:null,extent:B,context:"scene"}}initialize(){this.view=this.layerView.view,this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersector=_s(this.view.state.viewingMode),this._intersector.options.store=xt.MIN,this._tmpEvent.context=this.intersectionHandler.isGround?"ground":"scene"}getElevation(n,r,e,t){const s=H;s[0]=n,s[1]=r,s[2]=e;const i=this._renderCoordsHelper;if(!i.toRenderCoords(s,t,s))return Le.getLogger(this).error("could not project point to compute elevation"),null;const{layerView:a,_intersector:o,intersectionHandler:h}=this,d=a.i3slayer.fullExtent,c=d!=null&&Number.isFinite(d.xmin)&&Number.isFinite(d.xmax)&&Number.isFinite(d.ymin)&&Number.isFinite(d.ymax)&&Number.isFinite(d.zmin)&&Number.isFinite(d.zmax)?{min:d.zmin,max:d.zmax}:a.elevationRange;if(c==null)return null;const l=a.elevationOffset,u=c.min+l,g=c.max+l,f=Yi,v=Qi;return i.setAltitude(f,g,s),i.setAltitude(v,u,s),o.reset(f,v,null),h.intersect(o,null,f,v),o.results.min.getIntersectionPoint(s)?i.getAltitude(s):null}getSphereElevationBounds(n,r){return Dt(n,r,dt,this._renderCoordsHelper.spatialReference),this.layerView.getElevationRange(dt)}getRootElevationBounds(){const n=this.layerView.i3slayer.fullExtent;return n!=null&&n.hasZ?{min:n.zmin,max:n.zmax}:null}layerChanged(){this.spatialReference&&(this._tmpEvent.extent=this._computeLayerExtent(),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}objectChanged(n){this.spatialReference&&(this._tmpEvent.extent=this._computeObjectExtent(n),this._tmpEvent.spatialReference=this.spatialReference,this.emit("elevation-change",this._tmpEvent))}_computeObjectExtent(n){return je(B),this._expandExtent(n,B),B}_computeLayerExtent(){je(B);for(const n of this.layerView.getVisibleNodes())this._expandExtent(n,B);return B}_expandExtent(n,r){const e=this.spatialReference;if(e==null)return;const t=this.layerView.getNodeComponentObb(n);if(t!=null){gs(se,t.quaternion),se[12]=t.center[0],se[13]=t.center[1],se[14]=t.center[2];for(let s=0;s<8;++s)H[0]=1&s?t.halfSize[0]:-t.halfSize[0],H[1]=2&s?t.halfSize[1]:-t.halfSize[1],H[2]=4&s?t.halfSize[2]:-t.halfSize[2],wt(H,H,se),this._renderCoordsHelper.fromRenderCoords(H,H,e),ps(r,H,r)}}};p([m({constructOnly:!0})],z.prototype,"layerView",void 0),p([m({constructOnly:!0})],z.prototype,"intersectionHandler",void 0),p([m()],z.prototype,"view",void 0),p([m()],z.prototype,"spatialReference",null),z=p([Ce("esri.views.3d.layers.i3s.I3SElevationProvider")],z);const Xi=z;class Zi{constructor(r){this.type=ms.I3S,this._needVerticalOffset=!1,this.layerUid=r.layerUid,this.sublayerUid=r.sublayerUid,this._collection=r.collection,this._traverseNodeHierarchy=r.traverseNodeHierarchy,this.slicePlaneEnabled=r.slicePlaneEnabled,this.isGround=r.isGround}updateElevationAlignState(r,e){this._needVerticalOffset=r&&e===fs.Global}intersect(r,e,t,s){const i=r.results,a=r.options.store===xt.ALL,o=r.ray.direction,h=r.tolerance;let d=u=>u,c=u=>u;const l=bs(r.verticalOffset!=null?r.verticalOffset:this._needVerticalOffset?0:null);r.verticalOffset!=null&&l!=null&&(d=u=>l.applyToMbs(u),c=u=>l.applyToObb(u)),this._traverseNodeHierarchy((u,g)=>{if(u.childrenLoaded===0)return!1;const f=u.serviceObbInRenderSR!=null&&ys(u.serviceObbInRenderSR)?u.serviceObbInRenderSR:null;return!(f!=null&&!Qe(c(f),t,o,h))&&(!g||f==null&&vs(u.renderMbs)&&!Ji(d(u.renderMbs),t,o,h)||u.geometryObb!=null&&!Qe(c(u.geometryObb),t,o,h)||this._collection.intersect(g,t,s,h,l,(v,M,w,S)=>{if(M>=0){if(e!=null&&!e(t,s,M))return;const b=I=>{const y=new Cs(this.layerUid,this.sublayerUid,u.index,v,S);I.set(this.type,y,M,w)};if(this.isGround&&(i.ground.dist==null||Mi.max.dist)&&b(i.max),a){const I=Is(r.ray);b(I),r.results.all.push(I)}}}),!0)})}}function Ji(n,r,e,t=0){const s=n[3]+t,i=r[0]-n[0],a=r[1]-n[1],o=r[2]-n[2],h=e[0],d=e[1],c=e[2],l=h*i+d*a+c*o;return l*l-(h*h+d*d+c*c)*(i*i+a*a+o*o-s*s)>=0}const er=14;class tr{constructor(r,e,t=er){this._version=t,this._db=null,this._quotaReductionPromise=null,this._gcCounter=0,this._hit=0,this._miss=0,this._destroyed=!1,this.gcFrequency=50,this.maxByteSize=Rt.GIGABYTES,this.quotaReductionFactor=.2,this._dbName=r,this._storeName=e}init(){return Promise.resolve().then(()=>{const r=indexedDB.open(this._dbName,this._version);return r.onupgradeneeded=e=>{const t=r.result,s=r.transaction,i=t.objectStoreNames.contains(this._storeName)?s.objectStore(this._storeName):t.createObjectStore(this._storeName),a=t.objectStoreNames.contains("last_access")?s.objectStore("last_access"):t.createObjectStore("last_access");a.indexNames.contains("date")||a.createIndex("date","date",{unique:!1}),a.indexNames.contains("byteSize")||a.createIndex("byteSize","byteSize",{unique:!1}),e.oldVersion{this._destroyed?r.close():this._db=r})}destroy(){this._db&&(this._db.close(),this._db=null),this._destroyed=!0}get initialized(){return this._db!=null}getHitRate(){return this._hit/(this._hit+this._miss)}put(r,e){return this._db==null?Promise.reject(new Ms("indexedb:not-initialized","IndexedDB Cache is not initialized")):(this._quotaReductionPromise!=null?this._quotaReductionPromise:Promise.resolve()).then(()=>this._put(r,e)).catch(t=>{if(t&&t.name==="QuotaExceededError")return this._quotaReductionPromise==null&&(this._quotaReductionPromise=this._getCacheSize().then(s=>this._removeLeastRecentlyAccessed(e.byteSize+Math.ceil(s*this.quotaReductionFactor))),this._quotaReductionPromise.then(()=>this._quotaReductionPromise=null,()=>this._quotaReductionPromise=null)),this._quotaReductionPromise.then(()=>this._put(r,e));throw t}).then(()=>{this._gcCounter--,this._gcCounter<0&&this._db!=null&&(this._gcCounter=this.gcFrequency,this._getCacheSize().then(t=>this._removeLeastRecentlyAccessed(t-this.maxByteSize)))})}get(r,e){const t=this._db;if(t==null)return Promise.resolve(void 0);let s=null;return Promise.resolve().then(()=>{const i=t.transaction(this._storeName,"readonly");return s=Es(e,()=>{i.abort()}),Q(i.objectStore(this._storeName).get(r))}).then(i=>(i==null?++this._miss:this._db&&(++this._hit,this._db.transaction("last_access","readwrite").objectStore("last_access").put({date:Date.now(),byteSize:i.byteSize},r)),s!=null&&s.remove(),i)).catch(()=>{++this._miss,Ve(e),s!=null&&s.remove()})}remove(r){const e=this._db;return e==null?Promise.resolve():Promise.resolve().then(async()=>{const t=e.transaction([this._storeName,"last_access"],"readwrite"),s=t.objectStore(this._storeName),i=t.objectStore("last_access"),a=s.delete(r),o=i.delete(r);await Promise.all([Q(a),Q(o),ge(t)])})}_put(r,e){const t=this._db;if(t==null)return Promise.resolve();const s=t.transaction([this._storeName,"last_access"],"readwrite"),i=s.objectStore(this._storeName),a=s.objectStore("last_access"),o=i.put(e,r),h=a.put({date:Date.now(),byteSize:e.byteSize},r);return Promise.all([Q(o),Q(h),ge(s)])}_removeLeastRecentlyAccessed(r){if(r<=0||!this._db)return Promise.resolve();const e=this._db.transaction([this._storeName,"last_access"],"readwrite"),t=e.objectStore(this._storeName),s=e.objectStore("last_access");let i=0;const a=s.index("date").openCursor(null,"next");return a.onsuccess=()=>{const o=a.result;o!=null&&(o.value.byteSize!=null&&(i+=o.value.byteSize),t.delete(o.primaryKey),s.delete(o.primaryKey),i{const a=i.result;if(!a)return;const o=a.key;o!=null&&(s+=o),a.continue()},ge(e).then(()=>s)}}function ge(n){return new Promise((r,e)=>{n.oncomplete=()=>r(),n.onerror=()=>e(n.error),n.onabort=()=>e(n.error)})}function Q(n){return new Promise((r,e)=>{n.readyState==="done"?n.error!=null?e(n.error):r(n.result):(n.onsuccess=()=>r(n.result),n.onerror=()=>e(n.error))})}const ht=new WeakMap;class sr{constructor(r,e){switch(this._miss=0,this._hit=0,this.initialized=!0,e){case"layer":this._data=new Map;break;case"view":{const t=ht.get(r);if(t){this._data=t;break}const s=new Map;this._data=s,ht.set(r,s)}}}init(){return Promise.resolve()}async get(r,e){if(this._data.has(r))return this._hit++,this._data.get(r)??void 0;this._miss++}destroy(){}put(r,e){return this._data.set(r,e),Promise.resolve()}remove(r){return this._data.delete(r),Promise.resolve()}getHitRate(){return this._hit/(this._hit+this._miss)}}const jt="esri.views.3d.layers.I3SMeshView3D",P=Le.getLogger(jt),ct=[1,1,1,1];class ir extends qi{constructor(r,e,t,s,i,a,o,h,d){super(),this.node=r,this.featureIds=e,this.objectHandle=t,this.cachedRendererVersion=s,this.attributeInfo=i,this.material=a,this.textures=o,this.anchorIds=h,this.anchors=d,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0}}var W;(function(n){n[n.CastShadows=4]="CastShadows",n[n.Pickable=5]="Pickable"})(W||(W={}));const rr=23,ar=100*Rt.MEGABYTES,Nr=n=>{let r=class extends n{constructor(...e){super(e),this._updatingHandles=new ws,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._elevationTask=null,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new le(null,null,{}),this._crossfadeHelper=new Wi(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get contentVisible(){var e;return!this.suspended&&((e=this._controller)==null?void 0:e.rootNodeVisible)}get legendEnabled(){var e;return this.contentVisible&&((e=this.i3slayer)==null?void 0:e.legendEnabled)===!0}get updatingProgressValue(){var e;return((e=this._controller)==null?void 0:e.updatingProgress)??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ss(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?ee.AllTexturesPBR:ee.AllTextures:this._usePBR||this._hasLoadedPBRTextures?ee.GeometryTexturesPBR:ee.GeometryTextures}get elevationOffset(){const e=this.i3slayer!=null?this.i3slayer.elevationInfo:null;if(e!=null&&e.mode==="absolute-height"){const t=Xe(this.i3slayer.spatialReference),s=Ze(e.unit);return(e.offset??0)*s/t}return 0}get elevationInfo(){const e=this.i3slayer!=null?this.i3slayer.elevationInfo:null;if(e==null)return{mode:R.Absolute,offset:0};const t=Xe(this.i3slayer.spatialReference),s=Ze(e.unit),i=(e.offset??0)*s/t;switch(e.mode){case"absolute-height":return{mode:R.Absolute,offset:i};case"relative-to-ground":return{mode:R.RelativeToGround,offset:i};case"on-the-ground":return{mode:R.OnTheGround,offset:0};default:return{mode:R.Absolute,offset:0}}}get supportedTextureEncodings(){return bi(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){var s;const e=(s=this.view)==null?void 0:s.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,t=(this.supportedTextureEncodings&_e.DDS_S3TC)==0;return e&&t}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta;let t=1/0,s=-1/0;for(const i of e.values()){if(i==null)continue;const{node:{mbs:a}}=i,[,o,h]=a;t=Math.min(t,o-h),s=Math.max(s,o+h)}return Number.isFinite(t)&&Number.isFinite(s)?{min:t,max:s}:null}initialize(){var c;const e=Ne("enable-feature:idb-mock-cache");this._idbCache=e?new sr(this.view,e):new tr("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,s=t.memoryController;this.i3sOverrides=new yi({view:this.view,layer:this.i3slayer,memoryController:s}),this._worker=new ki(ur(t)),this.addResolvingPromise(this._worker.promise);const i=this.i3slayer.store;this._worker.setLegacySchema(this.uid,i.defaultGeometrySchema),Ns(this.i3slayer),Rs(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new vi({layerView:this,worker:this._worker}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this.resetHighlights();const a=i.defaultGeometrySchema;if(this._isIntegratedMesh||!a)this._hasComponentData=!1;else{const l=a.featureAttributes;this._hasComponentData=!!(l&&l.faceRange&&l.id)}this._hasVertexColors=((a==null?void 0:a.vertexAttributes.color)??null)!=null&&!((c=this.i3slayer.cachedDrawingInfo)!=null&&c.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderer.ensureEdgeView());const o=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,l=>this._deleteComponentObject(l));this._memCache=o;const h=l=>{var u;return((u=this._controller.index)==null?void 0:u.rootNode)!=null?this._controller.index.traverse(this._controller.index.rootNode,g=>{const f=g.index,v=this._nodeId2Meta.get(f)||this._nodeId2MetaReloading.get(f);return l(g,v!=null?v.objectHandle:null)}):()=>{}};this._intersectionHandler=new Zi({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:h}),this._updatingHandles.add(()=>this.layerUid,l=>this._intersectionHandler.layerUid=l),this._updatingHandles.add(()=>this.sublayerUid,l=>this._intersectionHandler.sublayerUid=l),this._elevationProvider=new Xi({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),V),this._updatingHandles.add(()=>this.fullOpacity,l=>this._opacityChange(l)),this._updatingHandles.add(()=>this.slicePlaneEnabled,l=>this._slicePlaneEnabledChange(l)),this._updatingHandles.add(()=>this.elevationOffset,(l,u)=>{this._reloadAll(u),this._controller.invalidateVisibilityObbs()}),this._updatingHandles.add(()=>this.elevationInfo,(l,u)=>this._elevationInfoChanged(l,u),V),this._updatingHandles.add(()=>!this.suspended&&this.elevationInfo.mode!==R.Absolute,(l,u)=>{l?this.addHandles(this.view.basemapTerrain.on("elevation-change",({extent:g})=>this._ensureElevationTask().addExtent(g)),vt):u&&this.removeHandles(vt)},V),this._updatingHandles.add(()=>this._usePBR,l=>this._updatePBR(l));const d=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add(()=>this.rendererTextureUsage,d),this._updatingHandles.add(()=>this.uncompressedTextureDownsamplingEnabled,d),this._updatingHandles.add(()=>this.contentVisible,l=>this._contentVisibleChanged(l),V),this._updatingHandles.add(()=>this.i3slayer.labelsVisible,()=>this._labelingChanged(),V),this._updatingHandles.add(()=>this.i3slayer.labelingInfo,()=>this._labelingChanged(),V),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),V),this.addHandles([Pe(()=>Z.I3S_TREE_SHOW_TILES,l=>{if(l&&!this._treeDebugger){const u=this._controller.crsIndex;As(()=>import("./I3STreeDebugger-kGP6iO8T.js"),__vite__mapDeps([0,1,2,3])).then(({I3STreeDebugger:g})=>{!this._treeDebugger&&Z.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new g({lv:this,view:this.view,nodeSR:u}))})}else l||Z.I3S_TREE_SHOW_TILES||(this._treeDebugger=A(this._treeDebugger))},V),Pe(()=>Z.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),V)]),this._cacheKeySuffix=Fs(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch(l=>P.warn(`Failed to initialize IndexedDB cache: ${l}`))}destroy(){this._clearAddTasks(),this._elevationTask=A(this._elevationTask),this.i3sOverrides=A(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.uid).then(()=>e.destroy()),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=A(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=A(this._labeler),this._treeDebugger=A(this._treeDebugger),this._controller=A(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=A(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=A(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.memoryEstimate;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(e!=null){const t=e.memoryEstimate;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}get usedMemory(){let e=this._labeler!=null?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach(t=>e+=t!=null?t.node.memory:0),this._nodeId2MetaReloading.forEach(t=>e+=t!=null?t.node.memory:0),e}get unloadedMemory(){return(this._controller!=null?this._controller.unloadedMemoryEstimate:0)+(this._labeler!=null?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(Ts(this.i3slayer)&&this._supportsLabeling))return void(this._labeler!=null&&(this._labeler.destroy(),this._labeler=null));if(this._labeler!=null)return;const e=new Li({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides});this._nodeId2Meta.forEach(t=>t!=null&&this._addMetaToLabeler(e,t)),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then(t=>(--this._asyncModuleLoading,t),t=>{throw--this._asyncModuleLoading,t})}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=Ni().then(()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()}),void this.notifyUpdate();if(this._i3sWasmLoaded!==!0)return;const e=this.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const s=Pt(this._layerClippingArea,this._modifications,t);Ri({context:e,modifications:s,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const i=this.hasModifications?new Mt:null;this._nodeId2Meta.forEach((a,o)=>{a==null?(this._nodeId2Meta.delete(o),this._controller.updateLoadStatus(o,!1)):a.node.hasModifications?(this._nodeId2Meta.delete(o),this._nodeId2MetaReloading.set(o,a)):i!=null&&i.push(a.node)}),this.notifyChange("elevationRange"),i!=null&&this._nodeId2MetaReloading.forEach(a=>i.push(a.node)),i!=null&&i.length>0&&(this.updateNodeModificationStatus(i),i.forAll(a=>{if(a.imModificationImpact!==nt.Culled){const o=this._nodeId2Meta.get(a.index);this._controller.invalidateGeometryVisibility(a.index),o!=null?(this._nodeId2Meta.delete(a.index),this._nodeId2MetaReloading.set(a.index,o),this.notifyChange("elevationRange")):this._nodeId2Meta.has(a.index)&&(this._nodeId2Meta.delete(a.index),this._controller.updateLoadStatus(a.index,!1))}})),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(this._modificationGraphics!=null&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!Z.I3S_SHOW_MODIFICATIONS||this._modifications.length===0)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){const i=s.geometry;i.spatialReference=this.i3slayer.spatialReference;const a={...t,color:e[s.type]};this._modificationGraphics.push(new le({geometry:i,symbol:a}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,(s,i)=>this._createAttributes(s,i))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if((t==null?void 0:t.attributeInfo)!=null)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if((t==null?void 0:t.attributeInfo)!=null)return t.attributeInfo.attributeData}setAttributeData(e,t){const s=this._nodeId2Meta.get(e);(s==null?void 0:s.attributeInfo)!=null&&(s.attributeInfo.attributeData=t,this._attributeValuesChanged(s))}async updateAttributes(e,t,s){const i=this._nodeId2Meta.get(e);i!=null&&(await this.i3sOverrides.applyAttributeOverrides(i.featureIds,t,s,this._controller.requiredAttributes),i.attributeInfo=t,this._controller.reschedule(()=>this._attributeValuesChanged(i),s).catch(a=>{Ft(a)||P.warn("Error while updating attribute values. Layer might not display correctly.",a)}))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,this._labeler!=null&&this._labeler.setNodeMetaAttributes(e,(t,s)=>this._createAttributes(t,s)),this._updateEngineObject(e)}clearMemCache(){this._memCache!=null&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach(t=>t!=null&&e.push(t.node)),e}getNodeComponentObb(e){const t=this._nodeId2Meta.get(e.index)??this._nodeId2MetaReloading.get(e.index);return t!=null?this._collection.getComponentObb(t.objectHandle):null}getLoadedNodeIndices(e){this._nodeId2Meta.forEach((t,s)=>e.push(s)),this._nodeId2MetaReloading.forEach((t,s)=>e.push(s))}_preLoadBasis(){var e;!Ne("disable-feature:i3s-basis")&&this.supportedTextureEncodings&_e.Basis&&((e=this.i3slayer.textureSetDefinitions)!=null&&e.some(t=>t.formats.some(s=>s.format==="basis"||s.format==="ktx2")))&&Je()}_getVertexBufferLayout(e,t){const s={hasTexture:pt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return Ds(Ps(this._getGeometryParameters(s)))}_getObjectIdField(){return this.i3slayer.objectIdField||js}_getGlobalIdField(){var e;return(e=this.i3slayer.associatedLayer)==null?void 0:e.globalIdField}_findGraphicNodeAndIndex(e){const t=Te(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let s=null;return ye(this._nodeId2Meta,i=>{if(i==null)return!1;const a=i.featureIds.indexOf(t);return a!==-1&&(s={node:i.node,index:a},!0)}),s}_getGraphicIndices(e,t){const s=this._nodeId2Meta.get(e.index);if(s==null)return[];const i=[],a=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const h of t){const d=Te(o,h.attributes,a),c=s.featureIds.indexOf(d);c!==-1&&i.push(c)}return i}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const s=this._getAABB(t.node.index,t.index);return s==null?Promise.reject():Promise.resolve({boundingBox:s,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return e.nodeIndex==null||e.componentIndex==null?null:this._getAABB(e.nodeIndex,e.componentIndex)}_getAABB(e,t){const s=this._nodeId2Meta.get(e);if((s==null?void 0:s.featureIds)==null||t>=s.featureIds.length)return null;const i=s.objectHandle,a=ke(t,this._collection,i,be(24),0),o=this.view.renderSpatialReference,h=this.view.spatialReference;if(!He(a,o,0,a,h,0,8))return null;const d=Vs();return $e(d,a,0,8),d}whenGraphicAttributes(e,t){return Hs(this.i3slayer,e,this._getObjectIdField(),t,()=>[...this._nodeId2Meta.values()].filter($s))}getGraphicFromIntersectorTarget(e){if(e.nodeIndex==null||e.componentIndex==null)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return(t==null?void 0:t.featureIds)==null||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${rr}/${e}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&this.elevationOffset===0&&this._cacheKeySuffix!=null}loadCachedGPUData(e){return this._memCache!=null?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){e!=null&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(this._memCache==null)return void this._deleteComponentObject(e);const s=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,s)}loadMissingTextures(e,t,s,i){const a=(e==null?void 0:e.filter((o,h)=>{if(!(o.usage&this.rendererTextureUsage))return!1;if(t==null)return!0;const d=Ii(o.encodings,this.supportedTextureEncodings),c=t[h];return!!((c==null?void 0:c.data)==null||d&&c.encoding!==d.encoding)}))??[];return a.length===0?Promise.resolve(!1):s(a,i).then(o=>{let h=0;for(let d=0;di==null?null:i.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(this.elevationInfo.mode===R.Absolute&&(e.geometryObb=i.geometryObb),this.loadMissingTextures(i.requiredTextures,i.textureData,s,t).then(a=>(a&&this._idbCache.initialized&&i.textureData!=null&&(i.byteSize=ft(i.transformedGeometry,i.textureData),i.textureData.every(mt)&&bt(e,i)&&this._idbCache.put(this._getCacheKey(e.id),i).catch(o=>P.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${o}`))),Ve(t),i)))):Promise.resolve(null)}addNode(e,t,s){return dr(t)?t.geometryBuffer==null?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,()=>this._transformNode(e,t,s).then(i=>this._safeReschedule(()=>{if(i==null)return e.hasModifications=!1,this._addCachedNodeData(e,null,s);e.hasModifications=i.transformedGeometry.hasModifications;const{obb:a,componentOffsets:o,featureIds:h,anchorIds:d,anchors:c,transformedGeometry:l}=i,u=this._controller.crsIndex,g=this.view.renderSpatialReference,f=et(e.mbs,this.elevationOffset,u,g),v=At([a.center.x,a.center.y,a.center.z],[a.extents.x,a.extents.y,a.extents.z],Gs(a.orientation.x,a.orientation.y,a.orientation.z,a.orientation.w));wt(v.center,v.center,f),this.elevationInfo.mode===R.Absolute&&(e.geometryObb=v),t.geometryData.componentOffsets=o,h&&(t.geometryData.featureIds=Array.from(h)),t.geometryData.anchorIds=d,t.geometryData.anchors=c;const M={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:l,globalTrafo:f,geometryObb:v,byteSize:ft(l,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&bt(e,M)){const w=M.textureData!=null?M.textureData.map(S=>mt(S)?S:null):null;this._idbCache.put(this._getCacheKey(e.id),{...M,textureData:w}).catch(S=>P.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${S}`))}return this._addCachedNodeData(e,M,s)},s))):Promise.reject()}getElevationRange(e){let t=1/0,s=-1/0;const i=Us(this.view.renderCoordsHelper.spatialReference);return this._nodeId2Meta.forEach(a=>{if((a==null?void 0:a.node.geometryObb)!=null){const o=a.node.geometryObb;if(Ls(o,e)){const h=this._collection.getObjectTransform(a.objectHandle),d=this.view.renderCoordsHelper.getAltitude(h.position);for(let c=0;c0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,s){if(this.elevationInfo.mode===R.Absolute&&(e.geometryObb=zs(this._collection.getComponentObb(t.objectHandle))),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);this._labeler!=null&&this._addMetaToLabeler(this._labeler,t);const i=e.index;this._addNodeMeta(i,t),this.updateNodeState(i,s),this._collection.setObjectVisibility(t.objectHandle,Re.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this.elevationInfo.mode!==R.Absolute&&this._ensureElevationTask().schedule(i),this._updateEngineObject(t),this._highlights.objectCreated(t),this._treeDebugger!=null&&this._treeDebugger.update()}addCachedNodeData(e,t,s,i){return this._addData(e,s,()=>this._addCachedNodeData(e,t,i))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,s){var We;if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(t==null)return void this._addNodeMeta(e.index,null);const i=this._addTasks.get(e.index),{geometryData:a,transformedGeometry:o,globalTrafo:h}=t;await this.i3sOverrides.applyAttributeOverrides(a.featureIds,i.attributeInfo,s,this._controller.requiredAttributes);const d=t.textureData!=null?t.textureData.filter(O=>O!=null&&(O.usage&this.rendererTextureUsage)!=0):[];!Ne("disable-feature:i3s-basis")&&d.some(O=>O!=null&&(O.encoding===_e.Basis||O.encoding===_e.KTX2))&&await Je(),e.memory=0;const{componentOffsets:c,geometries:l,featureIds:u,anchorIds:g,anchors:f}=a,v=this._collection,M=l[0],{layout:w,indices:S,interleavedVertexData:b,positionData:I,hasColors:y}=o,E=this._materialParameters(M,w),C=c||new Uint32Array([0,S?S.length:b.byteLength/w[0].stride]),Vt={vertices:{data:b,count:b.byteLength/w[0].stride,layoutParameters:E.geometryParams},positionData:{positions:qs(I.data),indices:Ws(I.indices)},indices:S,componentOffsets:C},ne=M.transformation?Ks(M.transformation):St();Ys(ne,h,ne);const Me=Qs(G(),ne),Ht=Xs(Zs(),ne),Be=this.view.renderSpatialReference,ze=this.view.basemapTerrain.spatialReference,Ee=G(),Oe=[1,1,1];Di(Me,Be,Oe,ze)||P.errorOnce("Unsupported coordinate system for IM overlay"),pe(Me,Be,Ee,ze);const oe=v.createObject({toMapSpace:Js(Ee[0],Ee[1],Oe[0],Oe[1]),geometry:Vt,obb:t.geometryObb,transform:{position:Me,rotationScale:Ht}}),$t=E.geometryParams.textureCoordinates===de.Atlas,{textures:qe,texturePromise:Gt}=this._initMaterialAndTextures(oe,E.material,d,$t);e.memory+=this._memEstimateGeometryAdded(oe),e.memory+=qe.reduce((O,xe)=>O+(xe!=null?this._memEstimateTextureAdded(xe):0),0);const Ut=!!E.material.hasParametersFromSource,Lt=E.material.alphaMode!=="blend"&&E.material.metallicRoughness.baseColorFactor[3]>=1,N=new ir(e,u,oe,this._getInvalidRendererVersion(),i.attributeInfo,{hasParametersFromSource:Ut,isOpaque:Lt},qe,g,f);i.meta=N,!this._hasTextures&&((We=t.requiredTextures)!=null&&We.some(({usage:O})=>(O&ee.ColorTextures)!=0))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||y,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const kt=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(N),Gt]).then(([O,xe])=>(O!=null&&O.updateObjectVisibility(N.objectHandle,!1).catch(X=>U(X,this.i3slayer.title)),this._safeReschedule(()=>{const X=this._addTasks.get(e.index);if(!X)return;if(this._addNodeMeta(e.index,N),X.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);v.setObjectVisibility(oe,Re.Visible),O!=null&&O.updateObjectVisibility(N.objectHandle,!0).catch(Kt=>U(Kt,this.i3slayer.title)),N.attributeInfo=X.attributeInfo;const Bt=N.cachedRendererVersion!==this._rendererVersion,zt=kt!==this.slicePlaneEnabled;this._updateElevationOffsets(N);const qt=N.elevationOffsets;this._updateComponentData(N);const Wt=this._applyFiltersToNode(N);(Bt||O!=null&&(zt||Wt||qt))&&this._addOrUpdateEdgeRendering(N),this._labeler!=null&&this._addMetaToLabeler(this._labeler,N),this._visibleGeometryChanged(N,T.ADD),this._highlights.objectCreated(N),this._updateMaterial(N),this._setNewNodeOpacity(N),this._treeDebugger!=null&&this._treeDebugger.update()},s))).catch(O=>{throw i.meta!=null&&(this._cacheGPUData(i.meta),i.meta=null),O})}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){P.error("Removing duplicated node");const s=this._nodeId2Meta.get(e);s!=null&&this._deleteComponentObject(s)}else this._controller.updateLoadStatus(e,!0);t!=null&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&re(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,s=this._controller.crsIndex,i=this.elevationInfo,a=this.view.basemapTerrain,o=a.spatialReference,h=i.mode;if(t==null||o==null||h===R.Absolute)return void(e.elevationOffsets=null);const d=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const c=cr,l=yt,u=h===R.OnTheGround,g=this.view.renderCoordsHelper,f=e.featureIds.length,v=(()=>{var I;if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const b=be(3*f);e.cachedElevationAnchors=b;for(let y=0;y=0?(st(c,e.anchors[3*C],e.anchors[3*C+1],e.anchors[3*C+2]),ae(c,c,e.node.mbs),pe(c,s,c,o),b[E]=c[0],b[E+1]=c[1],b[E+2]=g.getAltitude(c)):(this._collection.getComponentAabb(e.objectHandle,y,l,!0),st(c,(l[0]+l[3])/2,(l[1]+l[4])/2,l[2]),Ct(c,c,d.rotationScale),ae(c,c,d.position),b[E+2]=g.getAltitude(c),pe(c,t,c,o),b[E]=c[0],b[E+1]=c[1])}return b})(),M=i.offset,w=e.elevationOffsets,S=(b,I)=>{const y=u?v[3*b+2]:0;w[b]=M+(I!=null?I-y:0)};a.getElevations(v,f,S)}_ensureElevationTask(){return this._elevationTask!=null||(this._elevationTask=new fe(this.view.resourceController.scheduler,e=>{const t=this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference);return t!=null?t.filterInPlace(s=>this._nodeId2Meta.get(s)!=null):null},e=>{const t=this._nodeId2Meta.get(e);this._nodeElevationAlignmentChanged(t)})),this._elevationTask}_elevationInfoChanged(e,t){const s=e.mode!==R.Absolute,i=!!t&&t!==e&&t.mode!==R.Absolute;this._intersectionHandler.updateElevationAlignState(s,this.view.state.viewingMode),s&&!i&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach(a=>this._nodeElevationAlignmentChanged(a))}_nodeElevationAlignmentChanged(e){e!=null&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),this._labeler!=null&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,T.UPDATE))}_safeReschedule(e,t){return Ve(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const s=e.params.material!=null?e.params.material:Ci(),i=t.some(h=>h.name==="uvRegion"),a=t.some(h=>h.name==="normalCompressed"),o=pt(s);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:a,hasRegions:i}),material:s}}_initMaterialAndTextures(e,t,s,i){const a=this._stage.renderView,o=s.map(d=>Mi(d,t,i,a));this._stage.addMany(o);let h=null;return this._collection.updateMaterial(e,d=>{h=Ei(d,t,o,s,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(d)}),{textures:o,texturePromise:h}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?de.Atlas:de.Default:de.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,s){let i=this._addTasks.get(e.index);return i?i.attributeInfo=t:(i={...ei(),attributeInfo:t,meta:null},this._addTasks.set(e.index,i),s().then(i.resolve,i.reject).then(()=>this._addTasks.delete(e.index)).catch(a=>{throw this._addTasks.delete(e.index),a})),i.promise}_clearAddTasks(){this._addTasks.forEach(e=>{e.meta!=null&&(this._cacheGPUData(e.meta),e.meta=null)}),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,s=ve();this._renderClippingArea=it(this.view.clippingArea,s,e)?s:null;const i=ve();this._layerClippingArea=it(this.view.clippingArea,i,t)?i:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e)}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach(t=>{t!=null&&this._applyFiltersToNode(t)&&(this._addOrUpdateEdgeRendering(t),this._visibleGeometryChanged(t,T.UPDATE))})}getFilters(){const e=[],t=this._renderClippingArea;return t!=null&&e.push((s,i)=>this._boundingRectFilter(s,i,t)),e}addSqlFilter(e,t,s){if(t!=null){const i=t.fieldNames;e.push((a,o)=>this._sqlFilter(a,o,t,i,s))}}_sqlFilter(e,t,s,i,a){var u;const o={},h=this._createLayerGraphic(o),d=this.i3slayer.objectIdField,c=t.featureIds,l=(u=t.attributeInfo)==null?void 0:u.attributeData;i.every(g=>g===d||(l==null?void 0:l[g])!=null)&&rt(e,c,g=>{o[d]=c[g];for(const f of i)f!==d&&(o[f]=l?Ae(l[f],g):null);try{return s.testFeature(h)}catch(f){return a(f),!1}})}_boundingRectNodeTest(e,t){return Dt(e.node.mbs,this._controller.crsIndex,gt,this.view.renderSpatialReference),ti(t,gt)}_boundingRectFeatureTest(e,t,s){return this._collection.getComponentAabb(e.objectHandle,t,ut),si(ut,_t),ii(s,_t)}_boundingRectFilter(e,t,s){const i=this._collection,a=this._boundingRectNodeTest(t,s);if(a===he.INSIDE)return;if(a===he.OUTSIDE)return void(e.length=0);const o=i.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const h=this._transformClippingArea(nr,s,t.objectHandle);rt(e,t.featureIds,d=>this._boundingRectFeatureTest(t,d,h))}_transformClippingArea(e,t,s){const i=this._collection.getObjectTransform(s),a=i.position,o=i.rotationScale;return e[0]=(t[0]-a[0])/o[0],e[1]=(t[1]-a[1])/o[4],e[2]=(t[2]-a[0])/o[0],e[3]=(t[3]-a[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const s=this._edgeView;if(s==null)return Promise.resolve(null);const i=e.objectHandle,a=s.hasObject(i),{hasEdges:o,perFeatureEdgeMaterials:h}=this._getFilteredEdgeMaterials(e),d={hasSlicePlane:this.slicePlaneEnabled};return o&&a?(this.nodeCrossfadingEnabled&&re(h,this.getNodeOpacity(e)),s.updateAllComponentMaterials(i,h,d,t).catch(c=>U(c,this.i3slayer.title)),s.updateObjectVisibility(i,!0).catch(c=>U(c,this.i3slayer.title)),s.updateAllVerticalOffsets(i,e.elevationOffsets).catch(c=>U(c,this.i3slayer.title)),Promise.resolve(s)):o&&!a?this._collection.addEdges(i,s,h,d).then(c=>(e.edgeMemoryUsage=c,e.node.memory+=c,s.updateAllVerticalOffsets(i,e.elevationOffsets).catch(l=>U(l,this.i3slayer.title)),s)):(!o&&a&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,s.removeObject(i)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(this._labeler!=null&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,s=t.getComponentCount(e.objectHandle),i=e.filteredIds!=null,a=s.invisible===0;if(t.setAllComponentVisibilities(e.objectHandle,"all"),this._filters.length===0)return e.filteredIds=null,!a;if(this._updateCachedFilteredIds(e),i&&e.filteredIds===e.featureIds)return!a;const o=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_updateCachedFilteredIds(e){e.filteredIds!=null&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const s of this._filters)if(s(t,e),t.length===0)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array,s=e.filteredIds;return s!=null&&e.featureIds.forEach((i,a)=>{s[t.length]===i&&t.push(a)}),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach((t,s)=>this._removeNodeStageData(s,e)),this._nodeId2MetaReloading.forEach((t,s)=>this._removeNodeStageData(s,e,this._nodeId2MetaReloading)),this._elevationTask=A(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),this._elevationTask!=null&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,s=this._nodeId2Meta){s.has(e)&&this._controller.updateLoadStatus(e,!1);const i=s.get(e);i!=null?(this._collection.setObjectVisibility(i.objectHandle,Re.Hidden),this._edgeView!=null&&this._edgeView.hasObject(i.objectHandle)&&this._edgeView.updateObjectVisibility(i.objectHandle,!1).catch(a=>U(a,this.i3slayer.title)),this._visibleGeometryChanged(i,T.REMOVE),this._labeler!=null&&this._labeler.removeNodeMeta(i),s.delete(e),this._highlights.objectDeleted(i),s===this._nodeId2Meta?(this._cacheGPUData(i,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(i)):this._deleteComponentObject(i),this._treeDebugger!=null&&this._treeDebugger.update()):s.delete(e)}_deleteComponentObject(e){if(this._edgeView!=null&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const s=this._nodeId2Meta.get(e);s!=null&&this._collection.updateMaterial(s.objectHandle,i=>i.polygonOffsetEnabled=t===Ti.Hole)}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const s=this._nodeId2MetaReloading.get(e);s&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,s))}_invalidateAllSymbols(){this._rendererVersion=Fe(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return Fe(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=Fe(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await ri()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)t.type==="color"?this._colorVariable=t:t.type==="opacity"?this._opacityVariable=t:P.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())t.type!=="mesh-3d"&&P.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(s,i)=>{var o;const a=5*s;if(ai(i.externalColor,t[a]/255,t[a+1]/255,t[a+2]/255,t[a+3]/255),this._stage.renderView.objectAndLayerIdRenderHelper!=null){const h=e.featureIds[s],d=ni(this.view.map,this.layerUid);this._stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(h,h,this.layerId,this.layerUid+"_"+this.sublayerId,this.layerPopupEnabledAndHasTemplate&&!d,e.node.resources.attributes,s,this.sublayerId),i.objectAndLayerIdColor=this._stage.renderView.getObjectAndLayerIdColor({graphicUid:h,layerUid:this.layerUid+"_"+this.sublayerId})}i.externalColorMixMode=t[a+4]&(1<0?this._rendererFields!=null&&this._rendererFields.length>0?di(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){var S;if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,s={};t.attributes=s;const i=this._currentRenderer,a=(S=e.attributeInfo)==null?void 0:S.attributeData,o=e.featureIds!=null?this.i3slayer.objectIdField:null,h=a!=null&&this._symbologyFields!=null&&this._symbologyFields.length>0;let d=null,c=null;if(h&&this._symbologyFields!=null){d=[],c=[];for(const b of this._symbologyFields){const I=a[b];I&&(d.push(b),c.push(I))}}e.cachedSymbology||(e.cachedSymbology=Pi(5*e.featureIds.length));const l={color:ie,castShadows:!0,pickable:!0,colorMixMode:ce.Multiply,edgeMaterial:null},u=this.fullOpacity,g=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):u;let f=null,v=ue.OPAQUE,M=J,w=0;for(let b=0;b=1&&(e.material.isOpaque||l.colorMixMode===ce.Replace)?ue.OPAQUE:ue.TRANSPARENT;l.edgeMaterial===f&&C===v||(M={...l.edgeMaterial,opacity:g,objectTransparency:C},f=l.edgeMaterial,v=C),e.cachedEdgeMaterials[b]=M}else e.cachedEdgeMaterials[b]=J;e.cachedSymbology[w++]=Math.round(255*y[0]),e.cachedSymbology[w++]=Math.round(255*y[1]),e.cachedSymbology[w++]=Math.round(255*y[2]),e.cachedSymbology[w++]=Math.round(255*y[3]),e.cachedSymbology[w++]=l.colorMixMode|+l.castShadows<h!==J),perFeatureEdgeMaterials:t};let i=0,a=!1;const o=t.map((h,d)=>e.featureIds[d]!==s[i]?J:(a=a||h!==J,i++,h));return{hasEdges:a,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,s=this._getComponentParameters(e);this._collection.setComponentData(t,s),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),this._controller!=null&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach(t=>{t!=null&&(this._collection.updateMaterial(t.objectHandle,s=>s.objectOpacity=e),re(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))})}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,t=>{t.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,t.usePBR=this._usePBR,this._updateMaterialOverlay(t)})}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,T.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this._labeler!=null&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach(t=>{t!=null&&(this._collection.updateMaterial(t.objectHandle,s=>s.commonMaterialParameters.hasSlicePlane=e),this._updateEdgeRendering(t,!1))})}_updatePBR(e){this._nodeId2Meta.forEach(t=>{t!=null&&this._collection.updateMaterial(t.objectHandle,s=>s.usePBR=e)}),this._hasLoadedPBRTextures=!0}get _usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){this._edgeView!=null&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,s,i)=>i.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?x.CONTINUE:e(t,s,i):e}_forAllFeatures(e,t,s){ye(this._nodeId2Meta,i=>{if(i==null)return!1;if(t!=null)switch(t(i)){case x.EXIT:return!0;case x.SKIP:return!1}let a=x.CONTINUE;switch(s){case q.ALL:a=this._forAllFeaturesOfNode(i,e);break;case q.VISIBLE_ONLY:a=this._forAllVisibleFeaturesOfNode(i,e);break;case q.QUERYABLE:a=this._forAllQueryableFeaturesOfNode(i,e)}return a===x.EXIT})}_forAllFeaturesOfNode(e,t){let s=x.CONTINUE;const i=e.featureIds;for(let a=0;a(s=t(i[a],a,e),s===x.CONTINUE)),s}_forAllQueryableFeaturesOfNode(e,t){const s=this._ignoreClientNodeOverriddenFeatures(t);if(this._renderClippingArea==null)return this._forAllFeaturesOfNode(e,s);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===he.OUTSIDE)return x.CONTINUE;if(i===he.INSIDE)return this._forAllFeaturesOfNode(e,s);const a=x.CONTINUE,o=e.featureIds,h=e.objectHandle,d=ui(this._renderClippingArea,this._collection.getObjectTransform(h));for(let c=0;c0){if(e[0]instanceof le){const t=e,s=this.i3slayer.fieldsIndex,i=this._getObjectIdField(),a=t.map(d=>Te(s,d.attributes,i)),{set:o,handle:h}=this._highlights.acquireSet();return this._highlights.setFeatureIds(o,a),h}if(typeof e[0]=="number"){const t=e,{set:s,handle:i}=this._highlights.acquireSet();return this._highlights.setFeatureIds(s,t),i}}return Et()}resetHighlights(){A(this._highlights),this._highlights=new zi({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,q.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)})}_visibleGeometryChanged(e,t){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),this._visibleGeometryChangedSchedulerHandle==null&&(this._visibleGeometryChangedSchedulerHandle=gi(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})),this._updateSnappingSources(e,t))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this._gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this._geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this._texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.unloadedMemory/1048576).toFixed(1)+"MB"};return this._memCache!=null&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this,t=s=>{this._nodeColorOverride=s,this._invalidateAllSymbols()};return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const s=[];return e._forAllFeatures(i=>(s.push(i),x.CONTINUE),null,q.VISIBLE_ONLY),s.sort((i,a)=>i-a),s},get numNodes(){return e._nodeId2Meta.size},get loadedNodes(){return Array.from(e._nodeId2Meta.keys()).sort((s,i)=>s-i)},setNodeColorOverride:t,setNodeColoring:s=>{t(s==="client-nodes"?(i,a)=>{i.index<0?(a[0]=1,a[1]=0,a[2]=0):(a[0]=1,a[1]=1,a[2]=1)}:null)}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return e!=null?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach((t,s)=>e(s,t))}fadeNode(e,t,s){if(!this.nodeCrossfadingEnabled)return;const i=this._nodeId2Meta.get(e);i!=null&&this._crossfadeHelper.fadeNode(e,i,t,s)}setNodeOpacityByIndex(e,t){const s=this._nodeId2Meta.get(e);s!=null&&this._setNodeOpacity(s,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,s=>s.objectOpacity=t),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(this._edgeView==null||!e.cachedEdgeMaterials)return;re(e.cachedEdgeMaterials,t);const s=e.objectHandle;this._edgeView.hasObject(s)&&this._edgeView.updateAllComponentOpacities(s,t).catch(i=>U(i,this.i3slayer.title))}get hasModifications(){return this._isIntegratedMesh&&this._layerClippingArea!=null||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||this._i3sWasmLoaded!==!0)return;const s=this.uid,i=hr(e);if(i!=null){const a={context:s,buffer:i.buffer};Ai(a);const o=new Float64Array(i.buffer);e.forAll((h,d)=>{const c=o[d],l=Fi(c);h.imModificationImpact=l,l!==nt.Unmodified&&this._controller.invalidateGeometryVisibility(h.index)})}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){var e;return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||this._labeler!=null&&this._labeler.updating||((e=this._crossfadeHelper)==null?void 0:e.updating)||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||this._elevationTask!=null&&this._elevationTask.running}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(s,i,a)=>{const o=this._nodeId2Meta.get(s);if(o==null)throw new Error("invalid-node");const{origin:h,buffer:d}=await this._collection.extractEdgeInformation(o.objectHandle,i,a);return this._snappingLocationsApplyElevation(o,d,h),{type:"components",objectIds:o.featureIds,locations:d,origin:h}},remove:()=>{Ot(this._snappingSourcesTrackers,t)}};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach((s,i)=>{if(s==null)return;const a=this._controller.getRenderMbs(s.node);a!=null&&e.add(i,a)}),t}_snappingLocationsApplyElevation(e,t,s){if(!e.elevationOffsets||this.elevationInfo.mode===R.Absolute)return;const i=t.position0,a=t.position1,o=t.componentIndex,h=G(),d=G(),c=(l,u)=>{ae(l,l,s),this.view.renderCoordsHelper.worldUpAtPosition(l,d),ae(l,l,mi(d,d,u)),fi(l,l,s)};for(let l=0;l=0||r&&r.metallicRoughnessTextureId>=0||n.normalTextureId>=0||n.emissiveTextureId>=0||n.occlusionTextureId>=0}function dr(n){return"geometryData"in n}function mt(n){return n!=null&&Tt(n.data)}function ft(n,r){let e=1024+n.interleavedVertexData.byteLength+(n.indices?n.indices.byteLength:0)+n.positionData.data.byteLength+n.positionData.indices.byteLength;if(r!=null)for(const t of r)t!=null&&Tt(t.data)&&(e+=t.data.byteLength);return e}function bt(n,r){return r.byteSize>ar?(P.warn(`Node is too big to store in IndexedDB cache: ${n.id} (${r.byteSize} bytes)`),!1):r.byteSize>0}function hr(n){if(n.length===0)return null;const r=10*n.length,e=new Float64Array(r);return n.forAll((t,s)=>{let i=t.serviceObb;i==null&&(i=or,pi(i.center,t.mbs),i.halfSize[0]=i.halfSize[1]=i.halfSize[2]=t.mbs[3]);const a=10*s;e[a]=i.center[0],e[a+1]=i.center[1],e[a+2]=i.center[2],e[a+3]=i.halfSize[0],e[a+4]=i.halfSize[1],e[a+5]=i.halfSize[2],e[a+6]=i.quaternion[0],e[a+7]=i.quaternion[1],e[a+8]=i.quaternion[2],e[a+9]=i.quaternion[3]}),e}function re(n,r){n.forEach(e=>e.opacity=r)}var R;(function(n){n[n.Absolute=0]="Absolute",n[n.RelativeToGround=1]="RelativeToGround",n[n.OnTheGround=2]="OnTheGround"})(R||(R={}));const cr=G(),yt=Ie(),vt="elevation-change";function ur(n){return r=>{if(n.immediate)return n.immediate.schedule(r);throw console.error("Error no immediate schudler"),new Error("cant find immediate scheduler")}}export{Nr as E,x as I,q as a,vr as c}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/I3STreeDebugger-kGP6iO8T.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/TileTreeDebugger-MxH50s1q.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/I3SNode-5SPByfpU.js b/dist/assets/I3SNode-A9aOJfXV.js similarity index 86% rename from dist/assets/I3SNode-5SPByfpU.js rename to dist/assets/I3SNode-A9aOJfXV.js index 4e892f4..426e2f7 100644 --- a/dist/assets/I3SNode-5SPByfpU.js +++ b/dist/assets/I3SNode-A9aOJfXV.js @@ -1 +1 @@ -import{fm as v}from"./index-J0iiHjMT.js";class N{constructor(i,t){this.id=i,this.mbs=t,this.renderMbs=v(0,0,0,-1),this.elevationRangeMin=NaN,this.elevationRangeMax=NaN}invalidateElevationRange(){this.elevationRangeMin=NaN}}var d,a,s,h,c;(function(e){e[e.Unmodified=0]="Unmodified",e[e.Culled=1]="Culled",e[e.NotChecked=2]="NotChecked"})(d||(d={})),function(e){e[e.Unmodified=0]="Unmodified",e[e.PotentiallyModified=1]="PotentiallyModified",e[e.Culled=2]="Culled",e[e.Unknown=3]="Unknown",e[e.NotChecked=4]="NotChecked"}(a||(a={}));class U extends N{constructor(i,t,n,o,r,l,m,u,f,C){super(i,n),this.index=t,this.childCount=o,this.level=r,this.resources=l,this.version=m,this.lodMetric=u,this.maxError=f,this.numFeatures=C,this.failed=!1,this.cacheState=s.Unknown,this.vertexCount=0,this.memory=0,this.childrenLoaded=0,this.hasModifications=!1,this.imModificationImpact=a.NotChecked}}(function(e){e[e.Unknown=0]="Unknown",e[e.Uncached=1]="Uncached",e[e.Cached=2]="Cached"})(s||(s={})),function(e){e[e.None=0]="None",e[e.MaxScreenThreshold=1]="MaxScreenThreshold",e[e.ScreenSpaceRelative=2]="ScreenSpaceRelative",e[e.RemovedFeatureDiameter=3]="RemovedFeatureDiameter",e[e.DistanceRangeFromDefaultCamera=4]="DistanceRangeFromDefaultCamera"}(h||(h={})),function(e){e[e.Hole=0]="Hole",e[e.Leaf=1]="Leaf"}(c||(c={}));class k{constructor(i,t,n,o){this.nodeHasLOD=i,this.isChosen=t,this.lodLevel=n,this.version=o}}export{h as a,k as d,U as h,N as i,a as n,s as o,c as s,d as t}; +import{fh as v}from"./index-pCX-0tJH.js";class N{constructor(i,t){this.id=i,this.mbs=t,this.renderMbs=v(0,0,0,-1),this.elevationRangeMin=NaN,this.elevationRangeMax=NaN}invalidateElevationRange(){this.elevationRangeMin=NaN}}var d,a,s,h,c;(function(e){e[e.Unmodified=0]="Unmodified",e[e.Culled=1]="Culled",e[e.NotChecked=2]="NotChecked"})(d||(d={})),function(e){e[e.Unmodified=0]="Unmodified",e[e.PotentiallyModified=1]="PotentiallyModified",e[e.Culled=2]="Culled",e[e.Unknown=3]="Unknown",e[e.NotChecked=4]="NotChecked"}(a||(a={}));class U extends N{constructor(i,t,n,o,r,l,u,m,f,C){super(i,n),this.index=t,this.childCount=o,this.level=r,this.resources=l,this.version=u,this.lodMetric=m,this.maxError=f,this.numFeatures=C,this.failed=!1,this.cacheState=s.Unknown,this.vertexCount=0,this.memory=0,this.childrenLoaded=0,this.hasModifications=!1,this.imModificationImpact=a.NotChecked}}(function(e){e[e.Unknown=0]="Unknown",e[e.Uncached=1]="Uncached",e[e.Cached=2]="Cached"})(s||(s={})),function(e){e[e.None=0]="None",e[e.MaxScreenThreshold=1]="MaxScreenThreshold",e[e.ScreenSpaceRelative=2]="ScreenSpaceRelative",e[e.RemovedFeatureDiameter=3]="RemovedFeatureDiameter",e[e.DistanceRangeFromDefaultCamera=4]="DistanceRangeFromDefaultCamera"}(h||(h={})),function(e){e[e.Hole=0]="Hole",e[e.Leaf=1]="Leaf"}(c||(c={}));class k{constructor(i,t,n,o){this.nodeHasLOD=i,this.isChosen=t,this.lodLevel=n,this.version=o}}export{h as a,k as d,U as h,N as i,a as n,s as o,c as s,d as t}; diff --git a/dist/assets/I3SOverrides-5dCbMm3h.js b/dist/assets/I3SOverrides-5dCbMm3h.js deleted file mode 100644 index 4c45982..0000000 --- a/dist/assets/I3SOverrides-5dCbMm3h.js +++ /dev/null @@ -1 +0,0 @@ -import{tc as Gt,td as kt,te as Ut,sv as k,tf as Me,tg as jt,mL as et,aa as Y,pl as qt,th as Pt,ab as Oe,ti as fe,i2 as A,tj as tt,E as q,tk as Bt,tl as Ht,iZ as Mt,s as zt,tm as Qt,aq as Jt,qI as Kt,mY as Wt,p5 as Xt,tn as Zt,fB as Yt,e as x,y as v,c as Xe,p as Ze,gK as ei,ai as ti,a2 as Ot,cd as T,to as ee,f as ie,sV as it,fm as ii,aQ as te,tp as B,tq as se,tr as st,ts as si,kd as be,t2 as Lt,fx as ni,tt as nt,tu as ae,fA as Se,tv as ze,bm as Rt,tw as At,fz as ri,tx as Le,ty as ai,dJ as Ye,fF as oi,dQ as li,jR as Ie,tz as Re,tA as di,f5 as rt,bI as hi,tB as ui,tC as ci,tD as _i,sG as at,bB as Ft,tE as gi,mJ as mi,bq as fi,tF as pi,i9 as bi,tG as yi,sE as xi,b5 as vi,bp as ot,sC as lt,tH as dt,tI as Ni,tJ as ht,tK as Ci,tL as Ii,t0 as wi,t1 as Si,av as ut,az as le,au as de,ax as Ae,cP as Di,aU as Fe,at as Pi,cs as Mi,Z as Qe,cZ as Oi,tM as ct,tN as Li,fU as Ri,tO as Ai,d as R,P as Je,C as Fi,tP as Ei,ae as Et,sf as Ti,q5 as _t,tQ as $i,tR as Vi,tS as gt,tT as Gi,tU as mt,re as ki,ov as Ui,V as ft,fn as Ee,n as ji,a as qi,fT as Bi,gG as Hi,d8 as zi,tV as Qi,tW as Ji,nS as Ki,nT as Wi,tX as Xi,tY as Zi,bW as Yi,tZ as es,bH as ts}from"./index-J0iiHjMT.js";import{a as L,i as ye,h as pt,t as ge,n as he,d as is,s as ne,o as ue}from"./I3SNode-5SPByfpU.js";import{s as bt}from"./ReactiveSet-HLstcUcf.js";import{assetMapFromAssetMapsJSON as ss,extractMesh as ns}from"./meshFeatureSet-Mcou8mDC.js";import rs from"./FeatureLayerView3D-t6NDkLO0.js";function me(i,e,t,s){if(e==null||s==null)return!1;const n=kt(e,s,as);if(n.projector===Ut)return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],!0;if(n.projector==null)return!1;const{source:r,dest:a}=n;if(a.spatialReferenceId===k.WEB_MERCATOR){const o=Me[r.spatialReferenceId][k.WGS84];return o!=null&&(o(i,0,Te,0),jt(Te,0,t,0),t[3]=yt(Te[1],i[2],i[3],et.radius),!0)}if(r.spatialReferenceId!==k.WGS84&&r.spatialReferenceId!==k.CGCS2000||a.spatialReferenceId!==k.PLATE_CARREE){n.projector(i,0,t,0);const o=r.metersPerUnit??1,l=a.metersPerUnit??1;t[3]=i[3]*o/l}else{const o=Me[r.spatialReferenceId][k.SPHERICAL_ECEF],l=Me[k.SPHERICAL_ECEF][k.PLATE_CARREE];let d=i[3];o!=null&&l!=null&&(d=yt(i[1],i[2],i[3],et.radius)),n.projector(i,0,t,0),t[3]=d}return!0}function yt(i,e,t,s){const n=s+e;if(nn)return Number.MAX_VALUE;const r=Math.abs(os*i)+Math.asin(t/n);return r>=Math.PI/2?Number.MAX_VALUE:t/Math.cos(r)}const Te=Y(),as=Gt(),os=qt(1);var C,w;(function(i){i[i.KTX2=1]="KTX2",i[i.Basis=2]="Basis",i[i.DDS_S3TC=4]="DDS_S3TC",i[i.PNG=8]="PNG",i[i.JPG=16]="JPG",i[i.KTX_ETC2=32]="KTX_ETC2"})(C||(C={})),function(i){i[i.None=0]="None",i[i.Color=1]="Color",i[i.MetallicRoughness=2]="MetallicRoughness",i[i.Normal=4]="Normal",i[i.Occlusion=8]="Occlusion",i[i.Emissive=16]="Emissive",i[i.AlphaMask=32]="AlphaMask",i[i.ColorTextures=19]="ColorTextures",i[i.GeometryTextures=36]="GeometryTextures",i[i.GeometryTexturesPBR=44]="GeometryTexturesPBR",i[i.AllTextures=37]="AllTextures",i[i.AllTexturesPBR=63]="AllTexturesPBR"}(w||(w={}));async function ls(i){const e=[],t=[];if(i==null)return{material:{alphaMode:"opaque",alphaCutoff:.1,doubleSided:!0,cullFace:0,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[1,1,1,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6000000238418579},wrapTextures:!1,hasParametersFromSource:!0},requiredTextures:e,textureData:t};const s=ds(i);i.alphaMode==="auto"&&console.warn('alphaMode "auto" not supported by I3S PBRMaterial - defaulting to "blend".');const n=Pt({normalTexture:i.normalTexture,emissiveTexture:s?i.emissiveTexture:null,emissiveFactor:s?Oe.toUnitRGB(i.emissiveColor):null,occlusionTexture:s?i.occlusionTexture:null,metallicRoughnessTexture:s?i.metallicRoughnessTexture:null,metallicFactor:s?i.metallic:null,roughnessFactor:s?i.roughness:null}),r=n?fe[0]:s?i.metallic:0,a=n?fe[1]:s?i.roughness:0;return{material:{alphaMode:i.alphaMode==="auto"?"blend":i.alphaMode,alphaCutoff:i.alphaCutoff,doubleSided:i.doubleSided,cullFace:i.doubleSided?A.None:A.Back,normalTextureId:await ce(i.normalTexture,e,t,w.Normal),emissiveTextureId:s?await ce(i.emissiveTexture,e,t,w.Emissive):-1,occlusionTextureId:s?await ce(i.occlusionTexture,e,t,w.Occlusion):-1,emissiveFactor:s&&i.emissiveColor!=null?Oe.toUnitRGB(i.emissiveColor):[0,0,0],metallicRoughness:{baseColorFactor:i.color!=null?Oe.toUnitRGBA(i.color):[1,1,1,1],baseColorTextureId:await ce(i.colorTexture,e,t,w.Color),metallicRoughnessTextureId:s?await ce(i.metallicRoughnessTexture,e,t,w.MetallicRoughness):-1,metallicFactor:r,roughnessFactor:a},wrapTextures:!0,hasParametersFromSource:n},requiredTextures:e,textureData:t}}async function ce(i,e,t,s){if(i==null)return-1;const n=t.length,r=i.data,a=i.url;if(r!=null){if(r instanceof HTMLImageElement||r instanceof HTMLCanvasElement){const o=tt(r);return t.push({id:n,usage:s,data:o,encoding:C.PNG,downsampled:!1}),e.push({id:n,usage:s,encodings:[{name:void 0,encoding:C.PNG}]}),n}if(r instanceof HTMLVideoElement)return-1;if(r instanceof ImageData)throw new q("ImageData textures not supported yet for client side I3S nodes");if(r instanceof Bt)throw new q("EncodedMeshTexture textures not supported yet for client side I3S nodes")}else if(a!=null){const o=new Image;o.src=a;const l=await Ht(o,o.src,!1,void 0),d=tt(l);return t.push({id:n,usage:s,data:d,encoding:C.PNG,downsampled:!1}),e.push({id:n,usage:s,encodings:[{name:void 0,encoding:C.PNG}]}),n}return-1}function ds(i){return i.hasOwnProperty("metallicRoughnessTexture")}let hs=class{constructor(e,t,s,n){this._uid=e,this._worker=n,this._id2Meta=new Map,this._oid2Meta=new Map,this._indexSR=t.indexSR,this._vertexSR=t.vertexSR,this._renderSR=t.renderSR,this._localMode=t.localMode,this._memCache=s.newCache(`sl-client-mesh-data-${this._uid}`)}get uid(){return this._uid}get worker(){return this._worker}get indexSR(){return this._indexSR}get renderSR(){return this._renderSR}createMeshNodeInfo(e,t){const s=`mesh${t}`,n=e.extent,r=n.spatialReference,a=this._indexSR,o=us(n,e.origin);return me(o,r,o,a),{type:"mesh",id:s,version:gs(e),oid:t,mbs:o,componentNodeIds:[],unloadedMesh:e,nodeIndex:null,loadMeshPromise:null}}addMeshNode(e,t){if(this.getMeshNodeIndex(t.oid)!=null)throw new q(`I3SClientNodeLoader: client side mesh for feature oid=${t.oid} already exists`);t.nodeIndex=e,this._id2Meta.set(t.id,t),this._oid2Meta.set(t.oid,t)}getMeshNodeIndex(e){const t=this._oid2Meta.get(e);return t==null||t.type!=="mesh"?null:t.nodeIndex}removeNode(e){const t=this._id2Meta.get(e);t!=null&&(this._id2Meta.delete(e),t.type==="mesh"&&this._oid2Meta.delete(t.oid))}async loadNodeJSON(e){const t=this._id2Meta.get(e);if(t==null)throw new q(`I3SClientNodeLoader::loadNodeJSON unable to find node ${e}`);switch(t.type){case"mesh":return this._loadMeshNodeJSON(t);case"mesh-component":return this._loadMeshComponentNodeJSON(t);default:throw new q(`I3SClientNodeLoader::loadNodeJSON unable to handle node ${e}`)}}async _loadMeshNodeJSON(e){const t=e.id,s=(await this._getMeshData(e)).loadedMesh;if(s.components==null||s.components.length===0)return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null};const n=[],r=s.components;for(let a=0;a{const o=e.unloadedMesh.clone();try{await o.load()}catch(c){a(c)}const l=o.memoryUsage,d={loadedMesh:o,projectionPromise:null,normalsTransformPromise:null,usedMemoryInBytes:l};this._memCache.put(t,d,l,Zt),e.loadMeshPromise=null,r(d)};return e.loadMeshPromise=new Promise((r,a)=>n(r,a)),e.loadMeshPromise}return s}};function us(i,e){const{spatialReference:t}=i,s=[1,-1],n=[.5*i.width,.5*i.height,i.hasZ?.5*(i.zmax-i.zmin):0],r=t.isGeographic?t.metersPerUnit:1,a=i.center;let o=0;if(i.hasZ)for(let l=0;l<2;++l)for(let d=0;d<2;++d)for(let c=0;c<2;++c){const h=(a.x+s[l]*n[0]-e.x)*r,u=(a.y+s[d]*n[1]-e.y)*r,_=a.z+s[c]*n[2]-e.z;o=Math.max(h*h+u*u+_*_,o)}else for(let l=0;l<2;++l)for(let d=0;d<2;++d){const c=(a.x+s[l]*n[0]-e.x)*r,h=(a.y+s[d]*n[1]-e.y)*r;o=Math.max(c*c+h*h,o)}return Qt([e.x,e.y,e.z],Math.sqrt(o))}async function cs(i,e,t,s){const{transform:n,vertexAttributes:r}=e.loadedMesh,a=i.shading==="source"?r.normal:null;if(!(a!=null&&n!=null&&(n.rotationAngle!==0||!Jt(n.scale,Kt))))return{transformed:a,original:r.normal};if(!e.normalsTransformPromise){Mt(t,"SceneLayerWorker is needed to transform mesh normals");const o=Yt();Wt(o,n.localMatrix),e.normalsTransformPromise=t.transformNormals({normalMatrix:o,normals:a},s)}return e.normalsTransformPromise}function _s(i,e,t,s,n,r){const o=e.length/3,l=3*o;let d=0,c=0,h=!1,u=0,_=!1,m=0,g=!1,p=0,b=0,f=0;d+=K,d+=K,c=d,d+=3*l*$e,t!=null&&(h=!0,u=d,d+=3*l*$e),s!=null&&(_=!0,m=d,d+=2*l*$e),n!=null&&(g=!0,p=d,d+=4*l*ms),b=d,d+=1*fs,f=d,d+=2*1*K;const y=new ArrayBuffer(d),N=new Uint8Array(y);J(N,0,l),J(N,K,1);const S=new Float32Array(y,c),I=t!=null?new Float32Array(y,u):null,M=s!=null?new Float32Array(y,m):null,F=n!=null?new Uint8Array(y,p):null;for(let $=0;$>8,i[e+2]=255&t>>16,i[e+3]=255&t>>24}function gs(i){var n;const e=(n=i.metadata.displaySource)==null?void 0:n.source;if(e==null||!Array.isArray(e)||!e.length||e[0]instanceof File)return Xt();const t=e;let s="";for(const r of t)s+=r.makeHash();return s+JSON.stringify(i.transform!=null?i.transform.toJSON():"")+(i.vertexSpace.isRelative?JSON.stringify(i.vertexSpace.origin):"")}const K=4,$e=4,ms=1,fs=8;let we=class extends Ze{constructor(){super(),this.referenceCount=0,this.callbacks=new Array,this.runIndex=0}get running(){return this.callbacks.some(e=>e.running)}runTask(e){this._sort();const t=this.callbacks,s={numIndexLoading:0,numNodesLoading:0};for(let n=0;n0;s--){const n=e[s-1];let r=s;for(;r{t!=null&&(t.task.remove(e),t.task.callbacks.length>0||(Ve.delete(i),t.handle.remove(),t.task.destroy()),t=null)})}function oe(i,e,t){i&&(typeof e=="number"?(i.elevationRangeMin=Math.min(i.elevationRangeMin,e),i.elevationRangeMax=Math.max(i.elevationRangeMax,t)):(i.elevationRangeMin=Math.min(i.elevationRangeMin,e.elevationRangeMin),i.elevationRangeMax=Math.max(i.elevationRangeMax,e.elevationRangeMax)))}let Ge=class{constructor(e,t,s,n,r){this.childOffset=e,this.childCount=t,this.visibilityCache=s,this.ref=n,this.node=r,this.useAsHole=0,this.filterImpact=ge.NotChecked,this.traversalState=null,this.parent=-1}},ke=class{constructor(e=[],t=[]){this.nodes=e,this.children=t,this.lastTraversed=0,this.numNodesWithLoadedChildren=0}},ys=class{get _useNodePages(){return this._pageSize>0}constructor(e,t,s,n,r,a,o,l,d,c,h,u,_,m,g){var p,b;this._layer=e,this._streamDataController=s,this._clientNodeLoader=n,this._viewportQueries=r,this._logger=a,this.holeFilling=o,this._isLoaded=l,this._isReloading=d,this._isSelected=c,this._enable=h,this._needsUpdate=u,this._canRequest=_,this._computeVisibilityObb=m,this._computeNodeFiltering=g,this._dirty=!0,this._nodePages=new Map,this._clientNodePage=null,this._pageSize=0,this._rootIndex=0,this._lodMetric=L.None,this._lodConversion=f=>f,this._isEditable=!1,this._urlPrefix="",this._loadingNodes=new Set,this._loadingPages=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._version=W(0),this._visibilityCacheVersion=W(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missingPagesAndNodes=new T({deallocator:null}),this._prefetchNodes=new T({deallocator:null}),this._updates=new xs(this._missingPagesAndNodes),this._imModificationUncategorized=new T({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=new Array,this._newPages=new Array,this.needNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._frameNumber=0,this._isEditable=ee()&&((p=e.associatedLayer)==null?void 0:p.infoFor3D)!=null,(b=e.serviceUpdateTimeStamp)!=null&&b.lastUpdate&&(this._lastUpdate=`${e.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,this._init(t)}_init(e){if(e.type==="page"){const t=e.rootPage;switch(this._urlPrefix=e.urlPrefix,this._pageSize=e.pageSize,e.lodMetric){case"maxScreenThreshold":this._lodMetric=L.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this._lodMetric=L.MaxScreenThreshold,this._lodConversion=Cs}if(this._isEditable){this._rootIndex=-1;const s=E(e.rootIndex,e.pageSize),n=t.nodes[s],r={nodes:[{index:this._rootIndex,children:[e.rootIndex],mesh:void 0,obb:n.obb,lodThreshold:n.lodThreshold}]};this._addPage(X(this._rootIndex,this._pageSize),r),this.getNode(-1).serviceObb=void 0}else this._rootIndex=e.rootIndex;this._addPage(X(e.rootIndex,this._pageSize),t),this._updateParentsAndLevel()}else if(e.type==="node"){this._urlPrefix=e.urlPrefix;const t=new ke;if(this._nodePages.set(0,t),this._isEditable){this._clientNodePage=new ke;const n={id:"-1",version:null,mbs:e.rootNode.mbs,obb:e.rootNode.obb,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:[{id:"root",href:"../root",mbs:e.rootNode.mbs,obb:e.rootNode.obb}]};this._rootIndex=this._makeClientRefNode(new ye(n.id,null),-1);const r=this._validateNode(n.id,n);r&&this._addNode(r,this._rootIndex)}else this._rootIndex=this._makeRefNode(new ye(e.rootNode.id,null),-1);const s=this._validateNode(e.rootNode.id,e.rootNode);s&&this._addNode(s,0)}}addClientNodeToIndex(e,t){const n=new ye(e,t),r=this._makeClientRefNode(n,-1);return this._linkChildToParentNode(-1,r),this.requestUpdate(),r}removeClientNodeFromIndex(e,t,s){this._destroyClientRefNode(e,t,s),this.requestUpdate()}_loadPage(e){this._loadingPages.add(e);const t=this._urlPrefix+e;this._streamDataController.request(t,"json").then(s=>{this._pageQueue.push({pageIndex:e,page:s})}).catch(s=>{this._loadingPages.delete(e),ie(s)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._layer,`Error when loading page ${e}`,s))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:s}=this._pageQueue.shift();this._addPage(t,s),this._loadingPages.delete(t),e.madeProgress(),this.needNodeElevationRange&&this._newPages.push(t)}this._updateParentsAndLevel()}_invalidateElevationRangeForNewPages(e){if(this.needNodeElevationRange)for(;this._newPages.length>0&&!e.done;){const t=this._nodePages.get(this._newPages.shift());if(t==null)continue;const s=t.nodes;for(let n=0;n{var y,N,S;const d=s.length,c=o.children?o.children.length:0;n.push(this._rootIndex);for(let I=0;I{const a=this._getPage(s);if(a!=null){const o=E(s,this._pageSize),l=a.nodes[o];l.parent=n??-1;const d=l.node;d!=null&&(d.level=r,e.push(s))}};for(t(this._rootIndex,null,0);e.length;){const s=e.pop(),n=this.getNode(s);if(n!=null)for(let r=0;r=0)throw new Error("I3SIndex::client side nodes can not be made children of service side nodes.");const n=-(s.nodes.length+1),r=new Ge(0,0,xe(this._visibilityCacheVersion),e,null);return s.nodes.push(r),r.parent=t,B(e.renderMbs),se(e.serviceObbInRenderSR),n}_linkChildToParentNode(e,t){const s=this._clientNodePage;if(s==null||e>=0)return;const n=E(e,this._pageSize),r=E(t,this._pageSize),a=s.nodes[n],o=a.childOffset;s.children.splice(a.childOffset+a.childCount,0,t);const l=1;a.childCount+=l,a.node!=null&&(a.node.childCount+=l);for(const d of s.nodes)d.childOffset>o&&(d.childOffset+=l);s.nodes[r].parent=e,this._updateParentBoundingInformation(e)}_destroyClientRefNode(e,t,s){var m,g;const n=this._clientNodePage;if(n==null)return;const r=this.getParentIndex(e);if(r==null)return;const a=new Set,o=new Map,l=p=>{var N,S;const b=E(p,this._pageSize),f=n.nodes[b];if(f.childCount>0)for(let I=f.childOffset;I-1),u=[],_=[];for(let p=0;p=0)_.push(S);else{const I=E(S,this._pageSize),M=d[I];if(a.has(M))continue;const F=h[I];_.push(F),M.parent=b}}f.childOffset=y,f.childCount=_.length-y,f.node&&(f.node.childCount=f.childCount)}n.nodes=u,n.children=_,this._updateParentBoundingInformation(h[E(r,this._pageSize)])}_updateParentBoundingInformation(e){let t=e;do{let s=null;const n=this._clientNodeLoader.indexSR,r=this._clientNodeLoader.renderSR,a=this._getNodeInternal(t);if(a==null)return;for(let l=0;l0)if(s==null)s=st(h.mbs,Is);else{const u=ws,_=Ss,m=Ds;me(h.mbs,n,u,r),me(s,n,_,r),si(u,_,m),me(m,r,s,n)}}const o=a.ref||a.node;o!=null&&(s!=null?o.mbs=st(s,o.mbs!=null?o.mbs:be()):B(o.mbs),B(o.renderMbs),se(o.serviceObbInRenderSR),o.geometryObb=null),this.invalidateNodeVisibilityCacheInternal(a),t=this.getParentIndex(t)}while(t!=null)}populateChildren(e,t){const s=this._getNodeInternal(e),n=this._getPage(e);s.childOffset=n.children.length,s.childCount=t.length;for(let r=0;r{(s.node!=null&&s.node.id===e||s.ref!=null&&s.ref.id===e)&&(t=n)}),t}getNodeById(e){const t=this.getIndexById(e);return t!=null&&t>=0?this.getNode(t):null}getChildIndex(e,t){const s=this._getPage(e);if(s==null)return-1;const n=s.nodes[E(e,this._pageSize)];return s.children[n.childOffset+t]}getParentIndex(e){const t=this._getPage(e);return t!=null&&e!==this._rootIndex?t.nodes[E(e,this._pageSize)].parent:null}getParent(e){const t=this.getParentIndex(e);return t!=null?this.getNode(t):null}isLeaf(e){const t=this._getNodeInternal(e);return t!=null&&t.childCount===0}get rootNode(){return this.getNode(this._rootIndex)}get isEditable(){return this._isEditable}removeAllGeometryObbs(){this._forAllNodes(e=>{e.node!=null&&(e.node.geometryObb=null)})}invalidateVisibilityCache(){this._visibilityCacheVersion=W(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeInternal(e);t!=null&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=xe(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeInternal(e);t!=null&&(xt(t),this.invalidateNodeVisibilityCacheInternal(t))}updateElevationChanged(e){const t=this._getNodeInternal(e);if(t==null)return;if(!this.needNodeElevationRange)return void this.invalidateBoundingVolumeCache(e);const s=t.node!=null?t.node:t.ref;s!=null&&s.invalidateElevationRange()}invalidateGeometryVisibility(e){const t=this._getNodeInternal(e);(t==null?void 0:t.node)!=null&&(t.node.geometryObb=null,B(t.node.renderMbs),se(t.node.serviceObbInRenderSR))}invalidateVisibilityObbs(){this.rootNode!=null&&this.traverse(this.rootNode,e=>(e.visibilityObb=this._computeVisibilityObb(e),e.geometryObb=null,!0))}_updateElevationRange(e){this._updateElevationRangeInternal(e,null)}_updateElevationRangeInternal(e,t){var d;const s=this._getNodeInternal(e);if(!s)return!1;const n=(s==null?void 0:s.node)??(s==null?void 0:s.ref);if(!n)return!1;const r=n.elevationRangeMin;if(!Number.isNaN(r))return oe(t,n),!0;const a={elevationRangeMin:1/0,elevationRangeMax:-1/0};let o=!1;for(let c=0;c{t!=null&&(t.imModificationImpact=he.NotChecked,t.visibilityObb=this._computeVisibilityObb(t),t.hasModifications&&this.invalidateGeometryVisibility(t.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(t=>{if(t!=null){t.filterImpact=ge.NotChecked;const s=t.node;s!=null&&this.invalidateNodeVisibilityCache(s.index)}}),this.invalidateVisibilityCache()}update(e,t,s){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._invalidateElevationRangeForNewPages(t),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._updates.reset(e),O.clear();let n=!0;const r=new je,a=new je,o=this._imModificationUncategorized;o.clear();const l=new Set,d=(h,u,_)=>{const m=X(h,this._pageSize);if(l.add(m),u==null){let f=this._entryPriority(h);return f===1/0&&(f=this._entryPriority(_)),O.set(m,Math.max(f,O.get(m)||0)),this._loadingPages.has(m)||this._failedPages.has(m)||this._missingPagesAndNodes.push(m),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f))}const g=u.node;if(this._updateNodeFeatureEstimate(g,a),g==null){const f=this._entryPriority(h);return this._loadingNodes.has(h)||this._failedNodes.has(h)||(this._missingPagesAndNodes.push(h),O.set(h,f)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f))}const p=this._getPage(h);if(this._missingPagesAndNodes.length===0&&!this._useNodePages)for(let f=0;f0&&this._isSelected(g)&&(n=!1));if(this._isLoaded(h)){if(r.known+=g.memory,++r.knownNodes,this._isSelected(g)?u.childCount>0&&(n=!1):(r.unremoved+=g.memory,n=!1),this._needsUpdate(g)){const f=this._entryPriority(h);O.set(h,f),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f),this._updates.update.push(h)}return}if(g.memory&&(r.known+=g.memory,++r.knownNodes),!this._isSelected(g))return void(this._isReloading(h)&&this._updates.remove.push(h));if(u.childCount>0&&(n=!1),g.memory?(r.missing+=g.memory,r.known+=g.memory,++r.knownNodes):++r.missingNodes,e.includes(g.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(h)),void(this._updates.cancel=this._updates.cancel.filter(f=>f!==g.index));if(!t.done&&this._enable(g))return void t.madeProgress();const b=this._entryPriority(h);O.set(h,b),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,b),this._updates.add.push(h),this.layerHasModifications&&s&&g!=null&&g.imModificationImpact===he.NotChecked&&o.push(h)};this.traverseVisible(d),this._frameNumber++,this._missingPagesAndNodes.sort((h,u)=>h-u),this._missingPagesAndNodes.filterInPlace((h,u)=>u<1||this._missingPagesAndNodes.data[u-1]!==h),this._missingPagesAndNodes.sort((h,u)=>O.get(h)-O.get(u)),this._missingPagesAndNodes.length>0&&(this._maxUnloadedPrio=O.get(this._missingPagesAndNodes.back()),this._prefetchNodes.clear());const c=this._updates.add;c.length>0&&this.layerHasModifications&&(o.length>0&&(s==null||s(o)),c.filterInPlace(h=>{const u=this._getNodeInternal(h),_=(u==null?void 0:u.node)==null||u.node.imModificationImpact!==he.Culled;return _||this.invalidateNodeVisibilityCache(h),_})),this._unloadedMemoryEstimate=r.missing-r.unremoved,r.knownNodes>3&&r.missingNodes>0&&(this._unloadedMemoryEstimate+=r.known/r.knownNodes*r.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(a),this._featureEstimate.leavesReached=n,this._updates.add.filterInPlace(h=>O.get(h)>=this._maxUnloadedPrio).sort((h,u)=>O.get(h)-O.get(u)),this._updates.update.sort((h,u)=>O.get(h)-O.get(u)),this._indexMissing=this._loadingPages.size+this._loadingNodes.size+this._missingPagesAndNodes.length,this._dirty=this._indexMissing>0,O.clear()}checkFeatureTarget(e,t){const s=this._viewportQueries.updateScreenSpaceErrorBias(t);let n=t,r=t,a=s,o=10;for(;o--;){const l=new je;if(this._updateFeatureEstimate(n,l),this._computeFeatureEstimate(l)<=e){if(n>=t||l.missingNodes>0||o===0)break;a=n,n=.5*(n+r)}else r=n,n=.5*(n+a)}return this._version=W(this._version),this._viewportQueries.updateScreenSpaceErrorBias(s),Math.min(t,n)}_updateFeatureEstimate(e,t){this._version=W(this._version),this._viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((s,n)=>this._updateNodeFeatureEstimate(n!=null?n.node:void 0,t))}_updateNodeFeatureEstimate(e,t){e==null||e.failed||e.numFeatures==null||this._isSelected(e)&&(e.numFeatures!=null?(t.missing+=e.numFeatures,t.known+=e.numFeatures,++t.knownNodes):++t.missingNodes)}_computeFeatureEstimate(e){let t=e.known-e.unremoved;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.known/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missingPagesAndNodes)}prefetch(){return this._prefetchNodes.sort((e,t)=>O.get(e)-O.get(t)),this._load(this._prefetchNodes)}_load(e){if(e.length===0||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();){const t=e.pop();this._useNodePages&&t>=0?this._loadPage(t):this._loadNode(t)}return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetchNodes.length>0}get indexLoading(){return this._loadingPages.size+this._loadingNodes.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(e==null)return null;const t=e.index,s=this._getNodeInternal(t);if(!s)return null;let n=s==null?void 0:s.traversalState;if(n&&Ue(n.version,this._version))return n;const r=this._viewportQueries.getLodLevel(e),a=this._viewportQueries.hasLOD(e);let o=!0;if(a){const l=this.getParentIndex(t);if(l!=null){const d=this._getNodeInternal(l),c=d==null?void 0:d.traversalState;o=!!c&&r>c.lodLevel}else o=r>0}else o=e.childCount===0;return n?(n.lodLevel=r,n.isChosen=o,n.version=ve(!0,this._version),n):(n=new is(a,o,r,ve(!0,this._version)),s.traversalState=n,n)}async _loadNode(e){this._loadingNodes.add(e);const t=this._getNodeInternal(e).ref;if(t==null)return void this._failedNodes.add(e);const s=t.id,n=this._urlPrefix+s,r=()=>{this._loadingNodes.delete(e),this._missingPagesAndNodes.length===0&&this._loadingNodes.size===0&&this.requestUpdate()};let a=null;try{a=e>=0?await this._streamDataController.request(n,"json"):await this._clientNodeLoader.loadNodeJSON(s)}catch(d){return r(),void(ie(d)||(this._logger.error("#loadNode()",this._layer,"Error loading node: "+n),this._failedNodes.add(e)))}r();const o=this._validateNode(s,a);if(o==null)return;o.obb&&this.invalidateNodeVisibilityCache(e);const l=this._addNode(o,e);this.nodeTraversalState(l)}_validateNode(e,t){var u;if(t==null||typeof t!="object"||t.id!==e)return this._logger.error("#validateNode()",this._layer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._layer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&t.sharedResource.href!=="./shared"&&t.sharedResource.href!=="./shared/"&&this._logger.warn("#validateNode()",this._layer,`Invalid shared resource href on node "${e}"`);const s=t.geometryData;s==null||Array.isArray(s)&&s.length===0||Array.isArray(s)&&s.length===1&&s[0].href==="./geometries/0"||this._logger.warn("#validateNode()",this._layer,`Invalid geometry data on node "${e}"`);const n=t.attributeData,r=this._layer.attributeStorageInfo;n==null||Array.isArray(n)&&!n.some((_,m)=>{var g;return _.href!==`./attributes/${((g=r==null?void 0:r[m])==null?void 0:g.key)??`f_${m}`}/0`})||this._logger.warn("#validateNode()",this._layer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._layer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const a=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,o=t.featureData&&t.featureData.length===1&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:void 0,l=_=>{if(_==null)return null;const m=b=>this._logger.error("#validateNode()",this._layer,`Invalid node reference on node ${e}: ${b}`);if(typeof _.id=="number")m(`id ${_.id} is a number instead of a string.`);else if(typeof _.id!="string"||!Array.isArray(_.mbs))return m("Missing or invalid id."),null;if(!Array.isArray(_.mbs))return m(`Invalid bounding volume on reference ${_.id}.`),null;_.href&&_.href!=="../"+_.id&&this._logger.error("#validateNode()",this._layer,`Invalid node href on node "${e}"`);const g=_.hasOwnProperty("obb")&&!this.ignoreServiceObb?_.obb:null,p=new ye(`${_.id}`,_.mbs);return p.serviceObb=g,p.visibilityObb=this._computeVisibilityObb(p),p},d=Array.isArray(t.children)?t.children.map(l).filter(_=>_!=null):null,c=((u=t.featureData)==null?void 0:u.length)??!1,h=t.isEmpty===!0;return{id:e,mbs:t.mbs,obb:a,children:d,resources:{isEmpty:!c&&h,hasSharedResource:t.sharedResource!=null,attributes:t.attributeData?e:void 0,texture:t.textureData&&t.textureData.length>0?e:void 0,geometry:t.geometryData!=null?e:void 0},version:typeof t.version=="string"?t.version:null,lodSelection:Array.isArray(t.lodSelection)?t.lodSelection:null,numFeatures:o}}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{e.node!=null&&(e.node.failed=!1)})}_entryPriority(e){const t=this._getNodeInternal(e),s=this.getParentIndex(e);if(t==null||s==null&&t.node==null)return s==null?1/0:this._entryPriority(s);let n=0;if(t.node&&s!=null){const o=this._getNodeInternal(s).traversalState;o!=null&&(n=o.lodLevel)}let r=this.progressiveLoadPenalty;for(let o=e;o!=null;o=this.getParentIndex(o))if(this._isLoaded(o)){r=0;break}const a=t.ref!=null?this._viewportQueries.distToPOI(t.ref):t.node!=null?this._viewportQueries.distToPOI(t.node):0;return-a-n*(a+this.progressiveLoadPenalty)+r}traverseVisible(e){const t=this._getNodeInternal(this._rootIndex);t!=null?this._traverseVisible(this._rootIndex,null,t,e):e(this._rootIndex,null,null)}_traverseVisible(e,t,s,n){if(s.node&&s.childCount===0)return void(this.isGeometryVisible(e)&&n(e,s,t));if(!this.isNodeVisible(e)||(n(e,s,t),s.node==null))return;const r=this.nodeTraversalState(s.node);if(r!=null&&r.nodeHasLOD&&r.lodLevel===this._maxLodLevel)return;const a=this._getPage(e);for(let o=0;o{let n=this._isLoaded(s.index)||this._isReloading(s.index)?1:0;return this.traverseChildren(s,r=>(n+=t(r),!1)),s.childrenLoaded!==n&&e.push(s.index),n};return t(this.rootNode),e.length&&this._logger.error("childrenLoaded invariant broken at following nodes: "+e.join(",")),e.length>0}updateStats(e){var t;if(this._updates.add.length>0&&(e.nodes+=" + "+this._updates.add.length),e.index=this._nodePages.size*(this._pageSize||1)+(((t=this._clientNodePage)==null?void 0:t.nodes.length)??0),e.prio=this._maxProcessingPrio,(this._indexMissing||this._prefetchNodes.length>0)&&(e.index+=" + "+this._indexMissing||this._prefetchNodes.length),this._featureEstimate.estimate){const s=this._featureEstimate.estimate-e.features;s>0?e.features+=" + "+s:s<0&&(e.features+=" - "+-s)}}updateElevationInfo(e,t){this.needNodeElevationRange=t&&!!e&&(e.mode==="relative-to-ground"||e.mode==="on-the-ground"),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes(e=>{xt(e),e.node!=null&&e.node.invalidateElevationRange(),e.ref!=null&&e.ref.invalidateElevationRange()})}_forAllNodes(e){if(this._clientNodePage!=null){const t=this._clientNodePage;for(let s=0;st.add(X(s,this._pageSize)));for(const[s,n]of e)if(n.numNodesWithLoadedChildren!==0||t.has(s))for(const r of n.nodes)r.traversalState=null;else this._deleteNodePage(s)}}_deleteNodePage(e){this._nodePages.delete(e)}get test(){return{addNode:(e,t)=>this._addNode(e,t),getNodeInternal:e=>this._getNodeInternal(e),getPageIndex:e=>X(e,this._pageSize),getIndexWithinPage:e=>E(e,this._pageSize),getNodePage:e=>e<0?this._clientNodePage:this._nodePages.get(e),getChildIndices:e=>{const t=this._getNodeInternal(e),s=this._getPage(e);if(t==null||s==null)return[];const n=[];for(let r=t.childOffset;r0?i/e|0:0}function E(i,e){return i<0?-i-1:e===0?i:i%e}function Ne(i,e,t){return e===-1?-(i+1):t===0?i:e*t+i}const vs=[["maxScreenThreshold",L.MaxScreenThreshold],["screenSpaceRelative",L.ScreenSpaceRelative],["removedFeatureDiameter",L.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",L.DistanceRangeFromDefaultCamera]];function Ns(i){if(i){for(let e=0;e0&&this._removeChildrenRecursive(e),!0;const h=o.isNodeLoaded(r);if(n&&h&&d){const b=!s&&this.hasNoVisibleChildren(e);o.fadeNode(r,pe.FadeIn,!b)}const u=h&&(!o.isNodeFullyFadedIn||o.isNodeFullyFadedIn(r));if(h&&(o.updateNodeState(r,d?ne.Leaf:ne.Hole),d))return u&&this._removeChildrenRecursive(e),u;const _=e.childCount>0;let m=_;if(_)for(let b=0;b((this._layerView.isNodeLoaded(t.index)||this._layerView.isNodeReloading(t.index))&&G.push(t.index),t.childrenLoaded>0))}hasNoVisibleChildren(e){let t=!0;return this._index.traverseChildren(e,s=>!(!t||!this._index.isNodeVisible(s.index))&&(this._layerView.isNodeLoaded(s.index)?(t=!1,!1):s.childrenLoaded>0)),t}_childrenRequireLoading(e){let t=!1,s=!0;return this._index.traverseChildren(e,n=>{if(!s||!this._index.isNodeVisible(n.index))return!1;const r=this._index.nodeTraversalState(n);return this._isChosenMaxLOD(r)&&this._index.isGeometryVisible(n.index)&&(t=!0),this._layerView.isNodeLoaded(n.index)?(s=!1,!1):n.childrenLoaded>0}),s&&t}_isChosenMaxLOD(e){return e.isChosen&&(!e.nodeHasLOD||e.lodLevel===this._maxLodLevel)}};const G=new T({deallocator:null});class _e{constructor(e,t){this._textureRep=e,this.loadPromise=null,this._disposed=!1;const s=this._textureRep.acquire(t);ni(s)?(s.then(n=>{this._disposed?nt(n):this._textureRef=n}),this.loadPromise=s):this._textureRef=s}dispose(){this._textureRef=nt(this._textureRef),this._disposed=!0}get glTexture(){return this._textureRef!=null?this._textureRef.glTexture:null}}function Ms(i,e){const t=new Map,s=(m,g)=>{if(m==null)return-1;const p=t.get(m.id);if(p)return p.usage|=g,p.id;const b=t.size;return t.set(m.id,{id:b,usage:g}),b},n=e.pbrMetallicRoughness,r=n==null?void 0:n.baseColorFactor,a=e.emissiveFactor,o=Pt({normalTexture:e.normalTexture,emissiveTexture:e.emissiveTexture,emissiveFactor:e.emissiveFactor,occlusionTexture:e.occlusionTexture,metallicRoughnessTexture:n==null?void 0:n.metallicRoughnessTexture,metallicFactor:n==null?void 0:n.metallicFactor,roughnessFactor:n==null?void 0:n.roughnessFactor}),l=o?fe[0]:(n==null?void 0:n.metallicFactor)??ze[0],d=o?fe[1]:(n==null?void 0:n.roughnessFactor)??ze[1],c=e.alphaMode==="mask"?w.Color|w.AlphaMask:w.Color,h={baseColorFactor:r?[r[0],r[1],r[2],r[3]]:[1,1,1,1],baseColorTextureId:s(n==null?void 0:n.baseColorTexture,c),metallicRoughnessTextureId:s(n==null?void 0:n.metallicRoughnessTexture,w.MetallicRoughness),metallicFactor:l,roughnessFactor:d},u={alphaMode:e.alphaMode,alphaCutoff:e.alphaCutoff,doubleSided:e.doubleSided,cullFace:e.cullFace==="none"?A.None:e.cullFace==="back"?A.Back:e.cullFace==="front"?A.Front:A.None,normalTextureId:s(e.normalTexture,w.Normal),emissiveTextureId:s(e.emissiveTexture,w.Emissive),occlusionTextureId:s(e.occlusionTexture,w.Occlusion),emissiveFactor:a?[a[0],a[1],a[2]]:[0,0,0],metallicRoughness:h,wrapTextures:!1,hasParametersFromSource:o},_=[];return t.forEach(({usage:m},g)=>{const p=i!=null&&i[g]&&i[g].formats,b=p?Tt(p.map(({name:f,format:y})=>({name:f,encoding:Os[y]}))):[];_.push({id:g,usage:m,encodings:b})}),{material:u,textures:_}}function Tt(i){return i.sort((e,t)=>e.encoding-t.encoding)}const Os={ktx2:C.KTX2,basis:C.Basis,dds:C.DDS_S3TC,png:C.PNG,jpg:C.JPG,"ktx-etc2":C.KTX_ETC2},Nt={[ae.KTX2_ENCODING]:C.Basis,[ae.BASIS_ENCODING]:C.Basis,[ae.DDS_ENCODING]:C.DDS_S3TC,"image/png":C.PNG,"image/jpg":C.JPG,"image/jpeg":C.JPG,"image/ktx":C.KTX_ETC2};function Ls(i){var o,l;const e=i!=null&&i.materialDefinitions?Object.keys(i.materialDefinitions)[0]:null,t=i!=null&&i.textureDefinitions?Object.keys(i.textureDefinitions)[0]:null,s=e?(o=i.materialDefinitions)==null?void 0:o[e]:null,n=t?(l=i.textureDefinitions)==null?void 0:l[t]:null,r=Rs();if(s!=null){const d=s.params;d.diffuse&&(r.metallicRoughness.baseColorFactor=[d.diffuse[0],d.diffuse[1],d.diffuse[2],1]),d.doubleSided!=null&&(r.doubleSided=d.doubleSided,r.cullFace=d.doubleSided?A.None:A.Back),d.cullFace!=="none"&&d.cullFace!=="front"&&d.cullFace!=="back"||(r.cullFace=d.cullFace==="none"?A.None:d.cullFace==="back"?A.Back:A.Front),d.transparency&&(r.metallicRoughness.baseColorFactor[3]=Rt(1-d.transparency,0,1)),(d.useVertexColorAlpha||r.metallicRoughness.baseColorFactor[3]<1)&&(r.alphaMode="blend")}const a=[];if(n!=null){!n.wrap||n.wrap[0]!=="repeat"&&n.wrap[1]!=="repeat"||(r.wrapTextures=!0);let c=w.Color;n.channels==="rgba"&&(r.alphaMode="blend",c|=w.AlphaMask);const h=n.images.length-1,u=n.images[h],_=g=>g==null?void 0:g.split("/").pop(),m=Array.isArray(n.encoding)?Tt(n.encoding.map((g,p)=>({name:_(u.href[p]),encoding:Nt[g]||0}))):[{name:_(u.href),encoding:Nt[n.encoding]||0}];a.push({id:0,usage:c,encodings:m}),r.metallicRoughness.baseColorTextureId=0}return{material:r,textures:a}}const Rs=()=>({alphaMode:"opaque",alphaCutoff:At,doubleSided:!0,cullFace:A.None,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function cn(i,e,t,s){if((i==null?void 0:i.data)==null)return null;const n=i.data,r=s.renderingContext.parameters.maxMaxAnisotropy,a=r>1,o=t||!e.wrapTextures?As:Fs,l=$s(i.encoding),d=i.usage&w.Color?e.alphaMode==="opaque"?3:4:3;return new ri(n,{mipmap:a,maxAnisotropy:r,encoding:l,wrap:o,components:d,noUnpackFlip:!0})}const As={s:Se.CLAMP_TO_EDGE,t:Se.CLAMP_TO_EDGE},Fs={s:Se.REPEAT,t:Se.REPEAT};function _n(i,e,t,s,n,r){const a=r.rendererTextureUsage,o=p=>Ts(s,t,p&a),l=e.metallicRoughness.baseColorFactor,d=Rt(e.metallicRoughness.baseColorFactor[3],0,1);i.baseColor=[l[0],l[1],l[2],d],i.hasParametersFromSource=!!e.hasParametersFromSource,i.usePBR=r.usePBR,i.mrrFactors=[e.metallicRoughness.metallicFactor,e.metallicRoughness.roughnessFactor,e.hasParametersFromSource?fe[2]:ze[2]],i.emissiveFactor=e.emissiveFactor,i.isIntegratedMesh=r.isIntegratedMesh,i.textureAlphaCutoff=e.alphaMode==="mask"?e.alphaCutoff:At,i.alphaDiscardMode=e.alphaMode==="opaque"?Le.Opaque:e.alphaMode==="mask"?Le.Mask:Le.MaskBlend;const c=[],h=o(w.Color|w.AlphaMask);h!=null&&(i.baseColorTexture=new _e(n,h),c.push(i.baseColorTexture.loadPromise));const u=o(w.MetallicRoughness);u!=null&&(i.metallicRoughnessTexture=new _e(n,u),c.push(i.metallicRoughnessTexture.loadPromise));const _=o(w.Emissive);_!=null&&(i.emissionTexture=new _e(n,_),c.push(i.emissionTexture.loadPromise));const m=o(w.Occlusion);m!=null&&(i.occlusionTexture=new _e(n,m),c.push(i.occlusionTexture.loadPromise));const g=o(w.Normal);return g!=null&&(i.normalTexture=new _e(n,g),c.push(i.normalTexture.loadPromise)),i.commonMaterialParameters.hasSlicePlane=r.slicePlaneEnabled,i.commonMaterialParameters.doubleSided=e.doubleSided,i.commonMaterialParameters.cullFace=e.cullFace,i.ellipsoidMode=ai(r.viewSpatialReference),Promise.all(c)}function gn(i){const e=!!i.compressedTextureS3TC,t=!!i.compressedTextureETC,s=Ye("disable-feature:i3s-basis")?0:C.Basis|C.KTX2,n=C.JPG|C.PNG,r=s|C.DDS_S3TC;return n|(e?r:0)|(t?s:0)}function Es(i,e){if(e!=null)return i.find(t=>(t.encoding&e)!=0)}function Ts(i,e,t){if(i==null||t===w.None)return null;for(let s=0;sMs(o,l))}}_load(e,t,s){return this._streamDataController.request(e,t,s)}_loadAttribute(e,t,s){const n=`${this._layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(n,"binary",s).then(r=>oi(t,r))}async loadAttributes(e,t,s){const n=await Promise.allSettled(t.map(a=>this._loadAttribute(e,a.attributeStorageInfo,s))),r={};for(let a=0;a=0?this._materialAndTextures[d]:l!=null?Ls(l):null,h=c==null?void 0:c.material,u=(c==null?void 0:c.textures)??[],_=`${e.id}`,m=!a&&this._options.loadFeatureData,g=m?await this._loadFeatureData(_,t):null,p=m?Gs(g):Vs(h),b=p==null?ks(g):null,f=u.length>0?Ie(this.loadTextures(e,u,t)):null;let y=null,N=null;if(o){y=Re(await o);const F=Us(this._defaultGeometrySchema,l);N=di(n,F)}const S=f?Re(await f):null,I=s?Re(await s):{},M=I?{attributeData:I,loadedAttributes:this._requiredAttributes}:null;if(p!=null)return{geometryData:p,attributeDataInfo:M,geometryBuffer:y,geometryDescriptor:N,requiredTextures:u,textureData:S};if(b!=null)return{pointData:b,attributeDataInfo:M,geometryBuffer:y,geometryDescriptor:N,requiredTextures:u,textureData:S};throw new Error}static _addAbsoluteHrefTexture(e,t){const s=e.textureDefinitions;if(s!=null)for(const n of Object.keys(s))for(const r of s[n].images)Array.isArray(r.href)?r.hrefConcat=r.href.map(a=>rt(a,t)):r.hrefConcat=rt(r.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(t!=null)for(const s in t){const n=t[s];if(Array.isArray(n.encoding))for(let r=0;r(De._fixTextureEncodings(n),De._addAbsoluteHrefTexture(n,s),n))}_loadTexture(e,t,s,n,r,a){let o=!1;return r===C.DDS_S3TC||r===C.KTX2||r===C.Basis?this._load(e,"binary",a).then(l=>({id:t,usage:s,data:l,encoding:r,downsampled:o})):this._load(e,"image",a).then(l=>{let d=l;const c=4096,h=2;if(n&&l.width*l.height>=c){const u=Math.ceil(l.width/h),_=Math.ceil(l.height/h),m=document.createElement("canvas");m.width=u,m.height=_,m.getContext("2d").drawImage(l,0,0,u,_),d=m,o=!0}return{id:t,usage:s,data:d,encoding:r,downsampled:o}})}loadTextures(e,t,s){const n=!!this._options.uncompressedTextureDownsamplingEnabled,r=this._options.textureUsageMask;return Promise.all(t.map(a=>{if(!(a.usage&r))return null;const o=Es(a.encodings,this._options.textureEncodings);if(o==null)return this._logger.error("#loadTextures",this._logLayer,`No known encoding for texture found on node ${e.id}`),Promise.reject();const l=e.resources.texture||e.id,d=`${this._layerUrl}/nodes/${l}/textures/${o.name}`;return this._loadTexture(d,a.id,a.usage,n,o.encoding,s)}))}_loadFeatureData(e,t){const s=`${this._layerUrl}/nodes/${e}/features/0`;return this._load(s,"json",t)}_loadGeometry(e,t,s){const n=`${this._layerUrl}/nodes/${e}/geometries/${t}`;return this._load(n,"binary",s)}}function Vs(i){return{featureIds:[],geometries:[{type:"ArrayBufferView",params:{material:i}}],featureDataPosition:[0,0,0]}}function Gs(i){if(!i)return null;for(const e of i.featureData){const t=e.geometries;if(t!=null)for(const s of t)return{featureIds:[e.id],featureDataPosition:e.position,geometries:[s]}}return null}function ks(i){if(!i)return null;const e=new Array;for(const t of i.featureData)t.position!=null&&e.push({featureIds:[t.id],featureDataPosition:t.position,geometries:[]});return e}function Us(i,e){if(!i||!(e!=null&&e.materialDefinitions))return i;const t=Object.keys(e.materialDefinitions)[0];return!e.materialDefinitions[t].params.vertexRegions&&i.vertexAttributes.region&&delete(i=hi(i)).vertexAttributes.region,i}function js(i,e){const t={bufferDefinition:null,bufferIndex:0},s=e.resources.geometryDefinition;if(i==null||s==null||s<0)return t;const n=s>=0?i[s].geometryBuffers:null;if(n==null)return t;for(let r=0;rn.abort()),a={signal:n.signal,query:{token:this._apiKey}},o=this._requester.request(e,t,a),l={response:o,abortController:n,abortHandle:r};return this._activeRequests.add(l),ci(o,()=>{var d;l.abortController=null,(d=l.abortHandle)==null||d.remove(),l.abortHandle=null,this._activeRequests.delete(l)}),o}cancelAll(){this._activeRequests.forEach(e=>{var t,s;(t=e.abortController)==null||t.abort(),e.abortController=null,(s=e.abortHandle)==null||s.remove()}),this._activeRequests.clear()}}const It=1e5;class qs{constructor(e,t,s,n,r,a,o,l,d={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=r,this._elevationProvider=a,this._viewingMode=o,this._options=d,this._frustum=_i(),this._useFrustumCulling=!1,this._poi=Y(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=at(),this._tmp1=Y(),this._tmp2=Y(),this._tmp3=Y(),this._tmp0=Y(),this._screenspaceErrorBias=d.screenspaceErrorBias||1,this._progressiveLoadFactor=d.progressiveLoadFactor||1,this.updateCamera(s,n),this.engineSR=this._renderCoordsHelper.spatialReference,this.updateElevationInfo(l),this._tmpPoint=Ft(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(this.engineSR.isWebMercator||gi(this.engineSR)),this._indexSREllipsoidRadius=mi(this._indexSR).radius}updateElevationInfo(e){e!=null?(this._elevationContext=fi.fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(pi(bi(e,!1)))):this._elevationContext=null}updateCamera(e,t){this._useFrustumCulling=t,t&&yi(e.viewMatrix,e.projectionMatrix,this._frustum),this._screenSizeFactor=1/(e.perScreenPixelRatio/2),this._camPos=e.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,s){var h,u;if(this._elevationContext==null)return;const n=e.mbs;if(!n)return;if(this._elevationProvider.getSphereElevationBounds){const _=this._elevationProvider.getSphereElevationBounds(n,this._indexSR);return void(_&&oe(s,_.min,_.max))}const r=n[0],a=n[1],o=n[2],l=this._elevationContext.mode==="relative-to-scene"?"scene":"ground",d=this._elevationProvider.getElevation(r,a,o,this._indexSR,l);d&&oe(s,d,d);const c=t?null:(u=(h=this._elevationProvider).getRootElevationBounds)==null?void 0:u.call(h);c&&oe(s,c.min,c.max)}getRenderMbs(e){const t=e.renderMbs;if(xi(t))return t;e.mbs&&vi(t,e.mbs);const s=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(s)){let n=0,r=0;const a=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":n=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+s-t[2],r=a-s;break;case"on-the-ground":n=s-t[2],r=a-s}t[2]+=n+.5*r,t[3]+=.5*r}else this._elevationContext&&t[3]n>s)?null:(e.serviceObbInRenderSR=this._computeRenderObb(t,e.serviceObbInRenderSR,e.mbs[3],e.elevationRangeMin,e.elevationRangeMax),e.serviceObbInRenderSR)}_computeRenderObb(e,t,s,n,r){if(t==null)t=at();else if(lt(t))return t;let a=0,o=0;if(this._elevationContext&&!Number.isNaN(n)&&Number.isFinite(n))switch(this._elevationContext.mode){case"relative-to-ground":a=this._elevationContext.geometryZWithOffset(e.center[2],this._renderCoordsHelper)+n-e.center[2],o=r-n;break;case"on-the-ground":a=n-e.center[2],o=r-n}else this._elevationContext&&s0?(dt(e,this._indexSR,this._tmpObb,this.engineSR,a),Ni(this._tmpObb,0,o,this._viewingMode,t)):dt(e,this._indexSR,t,this.engineSR,a),t}isNodeVisible(e){const t=this.getRenderMbs(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const s=this._getVisibilityObb(e);return s?ht(s,this._frustum):Ci(this._frustum,Ii(t))}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObb;return t!=null?ht(t,this._frustum):this.isNodeVisible(e)}_isMBSinClippingArea(e){return this._clippingArea==null||wi(this._clippingArea,e)!==Si.OUTSIDE}_screenSpaceDiameterMbs(e,t){const s=this.getRenderMbs(e),n=Math.sqrt(ut(s,this._camPos)),r=n-s[3];return this._updateMinMaxDistance(n),r<0?.5*Number.MAX_VALUE:t/r*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getRenderMbs(e)[3]}calcCameraDistanceToCenter(e){const t=this.getRenderMbs(e),s=le(t,this._camPos);return this._updateMinMaxDistance(s),s}calcAngleDependentLoD(e){const t=this.getRenderMbs(e),s=t[3],n=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/te(t)+s)/le(t,this._camPos);return Math.min(1,n)}hasLOD(e){return e.lodMetric!==L.None}_getDistancePlanarMode(e,t){const s=e[0]-t[0],n=e[1]-t[1],r=e[2]-t[2],a=s*s+n*n,o=t[3];if(a<=o*o)return Math.abs(r);const l=Math.sqrt(a)-o;return Math.sqrt(r*r+l*l)}_getDistanceGlobeMode(e,t){const s=te(t),n=te(e)-s;de(this._tmp0,e,Ae(e,t)/Di(e));const r=ut(t,this._tmp0),a=t[3];if(r<=a*a)return Math.abs(n);{const o=de(this._tmp0,t,1/s),l=s,d=a*a/2/l,c=de(this._tmp1,o,l-d),h=e,u=Fe(this._tmp2,h,c),_=Fe(this._tmp2,u,de(this._tmp3,o,Ae(o,u))),m=Pi(this._tmp2,c,de(this._tmp2,_,a/te(_)));let g=le(h,m);if(n>=2e5){const p=Fe(this._tmp1,h,m);let b=Ae(p,o)/te(p);b<.08&&(b=1e-4),g/=b}return g}}_getDistance(e,t){return this.engineSR===Mi(this.engineSR)?this._getDistanceGlobeMode(e,t):this._getDistancePlanarMode(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===L.None)return 0;if(e.childCount===0)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,s=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,s)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case L.ScreenSpaceRelative:{const s=this.getRenderMbs(e),n=this._getDistance(this._camPos,s),r=2*n/this._screenSizeFactor,a=n+s[3];return this._updateMinMaxDistance(a),e.maxError*t<=r}case L.MaxScreenThreshold:{let s=this._screenSpaceDiameterMbs(e,e.mbs[3]*t);return this._options.angleDependentLoD&&(s*=this.calcAngleDependentLoD(e)),se.maxError*t}return!1}distToPOI(e){const t=this.getRenderMbs(e);return le(t,this._poi)-t[3]}distCameraToPOI(){return le(this._camPos,this._poi)}}const $t="esri.layers.graphics.controllers.I3SOnDemandController",Z=Qe.getLogger($t),Bs=100,wt=2,St=1e4,qe=1e-4,Hs=1.2,zs=500,Qs=1.5;let D=class extends Oi(Ze){get isMeshPyramid(){var i;return this.layer.profile==="mesh-pyramids"||((i=this.layer.store)==null?void 0:i.lodType)==="MeshPyramid"}get isGraphics3D(){return this.layer.profile==="points"}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(this.layer.priority==null||this.layer.priority==="High")}get indexStreamController(){const i=this.layerView.view.resourceController.createStreamDataRequester(ct.I3S_INDEX);return new Ct(i,this.layer.apiKey)}get dataStreamController(){const i=this.layerView.view.resourceController.createStreamDataRequester(ct.I3S_DATA);return new Ct(i,this.layer.apiKey)}get crsVertex(){return Li(this.layer)}get crsIndex(){return Ri(this.layer)}get layer(){return this.layerView.i3slayer}get running(){return this.updating}get rootNodeVisible(){if(this._index){const i=this._index.rootNode;if(i)return this._updateViewData(),this._index.isNodeVisible(i.index)}return!0}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(i){super(i),this.screenSizeFactor=0,this.featureTarget=5e4,this.fixedFeatureTarget=!1,this.updating=!0,this.updatingProgress=1,this.leavesReached=!1,this.scaleVisibilityEnabled=!0,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._idleStateCallbacks=null,this._newLoadingNodes=new T({deallocator:null}),this._loadedNodeScales=new Map,this._modificationsNodeFilteringArray=new T,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new Ai,this._elevationUpdateNodes=new T({deallocator:null}),this._errorCount=0}initialize(){const{layerView:i,layer:e}=this;this._disableMemCache=!i.loadCachedGPUData||!i.addCachedGPUData,this._lodHandling=new Ps(i),this._defaultGeometrySchema=e.store.defaultGeometrySchema,this.disableIDBCache=Ye("disable-feature:idb-cache"),"fields"in e&&(this._fields=e.fields,this._attributeStorageInfo=e.attributeStorageInfo),this.addResolvingPromise(Promise.all([e.indexInfo,e.when(),i.when()]).then(([t])=>{if(this.destroyed||!i||i.destroyed||!t)return;const{view:s,clientGeometry:n}=i,{resourceController:r}=s;if(this._setClippingArea(s.clippingArea),this.addHandles([R(()=>{var a,o;return(o=(a=s==null?void 0:s.pointsOfInterest)==null?void 0:a.focus)==null?void 0:o.renderLocation},a=>this._pointOfInterestChanged(a),Je),R(()=>s.quality,()=>this._setCameraDirty(),Fi),R(()=>i.contentVisible,a=>{const o=a?()=>this._updateIdleState(!0):()=>this._updateViewData(),l=a?()=>this._updateIdleState(!1):()=>{};a&&this._index!=null&&this._index.invalidateAllElevationRanges(),this._idleStateCallbacks?(a||this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=o,this._idleStateCallbacks.idleEnd=l):this._idleStateCallbacks=r.scheduler.registerIdleStateCallbacks(o,l)},Je),bs(i.view.resourceController.scheduler,this),R(()=>i.uncompressedTextureDownsamplingEnabled,()=>this.restartNodeLoading()),R(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),R(()=>{var a;return(a=s.state)==null?void 0:a.contentCamera},()=>this._setCameraDirty()),R(()=>e.elevationInfo,a=>this._elevationInfoChanged(a)),R(()=>e.effectiveScaleRange,()=>this._scaleBoundsChanged()),R(()=>i.lodFactor,()=>this._setCameraDirty()),R(()=>i.availableFields,()=>this._requiredFieldsChange()),R(()=>i.holeFilling,a=>this._index!=null&&(this._index.holeFilling=a))]),this._updateScaleHandles(),this._viewportQueries=new qs(this.crsIndex,s.renderCoordsHelper,s.state.contentCamera,!s.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?s.basemapTerrain:s.elevationProvider,Ei(s.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new hs(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:s.renderCoordsHelper.spatialReference,localMode:s.viewingMode==="local"},s.resourceController.memoryController,this.worker),this._index=new ys(e,t,this.indexStreamController,this._clientNodeLoader,this._viewportQueries,Z,i.holeFilling,a=>i.isNodeLoaded(a),a=>i.isNodeReloading(a),a=>this._shouldLoadNode(a),a=>this._enableFromGPUCache(a,ne.Leaf),a=>this._needsUpdate(a),()=>!this.indexStreamController.busy,a=>i.computeVisibilityObb?i.computeVisibilityObb(a):null,i!=null&&i.computeNodeFiltering?a=>i.computeNodeFiltering(a):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!i.hasModifications),this._index.layerFilterChanged(!!i.hasGeometryFilter),n!=null){for(const a of n)this._addMesh(a.mesh,a.oid);this.addHandles(n.on("change",a=>{for(const o of a.removed)this._removeMesh(o.oid);for(const o of a.added)this._addMesh(o.mesh,o.oid)}))}this._startNodeLoading()})),this._tmpPoint=Ft(0,0,0,this.crsIndex)}updateNodeModificationStatus(i){const e=this._index,t=this.layerView;e!=null&&(t!=null&&t.updateNodeModificationStatus)&&(this._modificationsNodeFilteringArray.clear(),i.forAll(s=>{const n=e.getNode(s);n!=null&&this._modificationsNodeFilteringArray.push(n)}),t.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._nodeLoader=null,V.prune(),Be!=null&&(Be.hide(),Be=null)}_getRequiredAttributes(){if(this._attributeStorageInfo==null||!this._fields||!this.layerView.availableFields)return[];const i=this._attributeStorageInfo,e=this._fields,t=this.layer.objectIdField;return this.layerView.availableFields.map(s=>{const n=Ke(i,s),r=Ke(e,s);return n>=0&&r>=0?{index:n,name:e[r].name,field:e[r],attributeStorageInfo:i[n]}:null}).filter(s=>s!=null&&s.name!==t)}_requiredFieldsChange(){const i=this._getRequiredAttributes();He(this._requiredAttributes,i)||(this._requiredAttributes=i,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(i){const e=Et();Ti(i,e,this.layerView.view.renderSpatialReference)?this._clippingArea=e:this._clippingArea=null}_pointOfInterestChanged(i){this._viewportQueries!=null&&(this._viewportQueries.setPointOfInterest(i),this._index!=null&&(this._index.progressiveLoadPenalty=Dt.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(i){this._setClippingArea(i),this._viewportQueries!=null&&this._index!=null&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}_addMesh(i,e){if(this._index==null)return;const t=this._clientNodeLoader.createMeshNodeInfo(i,e),s=this._index.addClientNodeToIndex(t.id,t.mbs);this._clientNodeLoader.addMeshNode(s,t),this._evaluateUpdating(),this.notifyChange("rootNodeVisible")}_removeMesh(i){const e=this._clientNodeLoader.getMeshNodeIndex(i);if(e!=null){if(this._index==null)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const t=(n,r)=>{var a,o,l,d;this.layerView.removeNode(r),this._loadedNodeScales.delete(r),this._clientNodeLoader.removeNode(n),this.layerView.deleteCachedNodeData&&n!=null&&this.layerView.deleteCachedNodeData(n),(d=(l=this.layerView).deleteCachedGPUData)==null||d.call(l,(o=(a=this.layerView).loadCachedGPUData)==null?void 0:o.call(a,r))},s=(n,r,a)=>{this._clientNodeLoader.updateNodeIndex(n,r,a),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(r,a)};this._index.removeClientNodeFromIndex(e,t,s),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(i,e){const t=this._index;if((t==null?void 0:t.rootNode)==null||e==null)return null;this.crsIndex.equals(e)||(_t(i,e,Ce,this.crsIndex),i=Ce);const s=this._elevationUpdateNodes;return s.clear(),$i(i,t.rootNode,t,n=>s.push(n.index)),s.length&&(s.forAll(n=>t.updateElevationChanged(n)),this._setCameraDirty()),s}removeAllGeometryObbs(){this._index!=null&&this._index.removeAllGeometryObbs()}getRenderMbs(i){return this._viewportQueries!=null?this._viewportQueries.getRenderMbs(i):null}_elevationInfoChanged(i){this._index!=null&&(this._index.updateElevationInfo(i,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}_updateScaleHandles(){const i="scale-bounds";this.removeHandles(i),this._areScaleBoundsActive&&this.addHandles(this.layerView.view.basemapTerrain.on("scale-change",e=>this._scaleUpdateHandler(e)),i)}_scaleBoundsChanged(){this._areScaleBoundsActive||this._loadedNodeScales.clear(),this._updateScaleHandles(),this._setCameraDirty()}_scaleUpdateHandler(i){this._updateScaleInBoundingRect(i.extent,i.spatialReference),this._setCameraDirty()}_updateScaleInBoundingRect(i,e){const t=this._index;t!=null&&t.rootNode!=null&&_t(i,e,Ce,this.crsIndex)&&this._loadedNodeScales.forEach((s,n)=>{const r=t.getNode(n);r!=null&&Vi(Ce,r.mbs)&&this._loadedNodeScales.set(n,this._computeScale(r))})}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(i,e){return this._idleQueue.push(i,e)}reschedule(i,e){return this._idleQueue.unshift(i,e)}get _isIntegratedMesh(){return this.layer.type==="integrated-mesh"}get _areScaleBoundsActive(){const{minScale:i,maxScale:e}=gt(this.layer);return this.scaleVisibilityEnabled&&(i>0||e>0)}get unloadedMemoryEstimate(){return this._index!=null&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(i,e){return i.index<0?this._clientNodeLoader.loadNodeData(i.id,e):this._nodeLoader.loadNodeData(i,e)}async _loadAttributes(i,e,t){return(i.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(i,e,t)}get indexDepth(){return this._index!=null?this._index.maxLevel:0}set disableMemCache(i){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData||(this._disableMemCache=!0),this._disableMemCache=i}runTask(i,e){return this.layerView.contentVisible?this.layerView.visible&&this._index!=null?(this._processWithErrorLogging(i,e),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateUpdating(),-1/0)}_processWithErrorLogging(i,e){try{this._process(i,e)}catch(t){this._errorCount<50?Z.error("Error during processing: "+t):this._errorCount===50&&Z.error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(i,e){this._restartNodeLoading&&this._startNodeLoading(),this._nodeLoader!=null&&this._index!=null&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(i)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(i.enabled=!1),i.run(()=>this._processIndex(i)),this._updateFeatureLOD(),i.run(()=>this._processCache(i)),this._isIntegratedMesh&&(i.enabled=!0),i.run(()=>this._processNodes(i,e)),this._idleQueue.runTask(i),i.run(()=>this._prefetchIndex()),e.numIndexLoading+=this._index.indexLoading,e.numNodesLoading+=this._downloadingCount,i.run(()=>this._lodHandling.lodGlobalHandling(i)),this._evaluateUpdating())}_processIndex(i){if(this._index==null)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),i,t=>this.updateNodeModificationStatus(t)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const e=this._index.featureEstimate.leavesReached;this._index.isLoading||e===this._get("leavesReached")||this._set("leavesReached",e)}return this._index.load()}_prefetchIndex(){return!(this._index==null||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||this._index==null||this._viewportQueries==null)return;const i=!this._index.isLoading,e=this.featureTarget*this._baseLOD,t=this._index.featureEstimate;if(t.estimate=t.estimate||e/2,this._index.indexMissing>zs){if(this._featureLOD<=qe)return;this._featureLOD/=Qs,this._stableFeatureLOD=!1}else if(i&&t.estimate=St||this._stableFeatureLOD)return;const s=Math.min(10,Math.max(e/t.estimate,1.001));this._featureLOD*=s;const n=this._lod,r=this._index.checkFeatureTarget(e,n);r!==n&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(t.estimate>e*Hs||i&&t.estimate>e)||this._featureLOD<=qe)return;this._featureLOD/=1+.25*(t.estimate/e-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(St,Math.max(qe,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(i){const e=this._index;if(e==null)return!1;for(;this._newLoadingNodes.length>0&&!i.done;){const t=this._newLoadingNodes.pop();for(let s=e.getParent(t);s!=null&&!this.layerView.isNodeLoaded(s.index)&&this._isNodeInScaleBounds(s);s=e.getParent(s.index))if(this._enableFromGPUCache(s,ne.Hole)){i.madeProgress();break}}return i.hasProgressed}_processNodes(i,e){if(this._index==null)return!1;let t=(this._isIdle?Bs:wt)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!i.done;)this.layerView.removeNode(s.remove.pop()),i.madeProgress();for(;s.update.length>0&&!i.done;){const n=this._index.getNode(s.update.pop());n!=null&&(this._updateLoadedNode(n),i.madeProgress())}for(;s.add.length>0&&!i.done&&t>0;){--t;const n=this._index.getNode(s.add.back());if(n==null||n.cacheState!==ue.Cached&&!this._hasNodeLoadToken(e))break;s.add.pop(),this._loadNode(n),i.madeProgress()}return i.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(i=>i.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(i=>i.abort()),this._updatingNodes.clear()}_cancelNode(i){const e=this._loadingNodes.get(i);e&&(e.abort(),this._loadingNodes.delete(i))}_hasNodeLoadToken(i){return!(!this._isIdle&&i.numNodesLoading+this._loadingNodes.size>=wt)&&this._downloadingCount0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.running||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||this._index!=null&&this._index.isPrefetching),t===0&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(t,this._progressMaxNumNodes),e=1-t/this._progressMaxNumNodes}else i=this._cameraDirty,e=i?0:1;this.updating=i,this.updatingProgress=e}}_updateViewData(){if(!this._cameraDirty||this._index==null||this._viewportQueries==null)return;const i=this.layerView.view,{contentCamera:e,fixedContentCamera:t}=i.state;this.screenSizeFactor=1/(e.perScreenPixelRatio/2),this._viewportQueries.updateCamera(e,!t||this.isGraphics3D),this._viewportQueries.setPointOfInterest(i.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=Dt.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const i=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(i>0?i:1)*this.layerView.view.quality}get _lodDropFactor(){return this.fixedFeatureTarget?1:(Math.min(this.layerView.view.quality,.5)-mt)/(.5-mt)}isGeometryVisible(i){var e;return!!((e=this._index)!=null&&e.isGeometryVisible(i.index))}updateVisibility(i){var e;(e=this._index)==null||e.invalidateNodeVisibilityCache(i)}invalidateGeometryVisibility(i){var e;(e=this._index)==null||e.invalidateGeometryVisibility(i)}invalidateVisibilityObbs(){var i;(i=this._index)==null||i.invalidateVisibilityObbs()}modificationsChanged(){var i;(i=this._index)==null||i.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(i){return!(!this._lodHandling.shouldLoadNode(i)||this._shouldDropNode(i))&&!(this._index==null||!this._index.isGeometryVisible(i.index))&&this._isNodeInScaleBounds(i)}_shouldDropNode(i){if(this._viewportQueries==null)return!1;const e=this._lodDropFactor;return e>=1||!this._lodHandling.hasNoVisibleChildren(i)?!1:Math.abs(this._viewportQueries.calcCameraDistanceToCenter(i))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*e}_startNodeLoading(){this._restartNodeLoading=!1;const i=this._index;if(this._updatesDisabled||i==null||this._viewportQueries==null)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const e={textureEncodings:this.layerView.supportedTextureEncodings,uncompressedTextureDownsamplingEnabled:this.layerView.uncompressedTextureDownsamplingEnabled,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new De(this.layer,this.dataStreamController,Z,this._defaultGeometrySchema,this._requiredAttributes,e),i.requestUpdate(),this._lodHandling.startNodeLoading(t=>this._isNodeInScaleBounds(t),(t,s)=>this._removeNodes(t,s,re.fadeout),i,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateUpdating()}isNodeLoading(){return this._nodeLoader!=null&&this._index!=null}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_removeInvisibleNodes(i){const e=this._index;if(e==null||this._viewportQueries==null)return!1;V.clear(),this.layerView.getLoadedNodeIndices(V);const t=this._viewportQueries.maxDistance===0,s=t?()=>!1:n=>this._shouldDropNode(n);return V.filterInPlace(n=>{const r=e.getNode(n);return r==null||!e.isGeometryVisible(n)||s(r)||!this._isNodeInScaleBounds(r)}),V.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(V,i,re.pop),!(t&&this._lodDropFactor<1)&&(V.length===0||(V.clear(),!1))}markNodeToRemove(i){V.push(i)}removeMarkedNodes(){this._removeNodes(V,ki,re.pop)}_removeNodes(i,e,t){const s=i.length;if(s!==0&&!e.done){for(this._index!=null&&this._index.requestUpdate();i.length>0&&!e.done;){const n=i.pop(),r=this._index;t===re.fadeout&&this.layerView.nodeFadeoutEnabled&&r!=null&&r.isGeometryVisible(n)?this.layerView.fadeNode(n,pe.FadeOut,!0):this.layerView.removeNode(n),e.madeProgress()}if(this._loadedNodeScales.size>0)for(let n=i.length;nthis.layerView.updateAttributes(i.index,{loadedAttributes:this._requiredAttributes,attributeData:s},e.signal),e.signal)}catch(t){if(!ie(t))return this.layerView.updateAttributes(i.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},e.signal)}this._updatingNodes.delete(i.index),this._evaluateUpdating()}_loadNode(i){if(this._loadingNodes.has(i.index))return void Z.error("already loading node "+i.index);const e=new AbortController;this._loadingNodes.set(i.index,e),this._evaluateUpdating(),this._loadAndAddNode(i,e.signal).then(t=>{t&&this._index!=null&&this._loadingNodes.get(i.index)===e&&(this._loadingNodes.delete(i.index),this._index.requestUpdate())}).catch(t=>{if(!ie(t))throw t}).finally(()=>{this._loadingNodes.get(i.index)===e&&this._loadingNodes.delete(i.index),this._evaluateUpdating()})}_loadAndAddNode(i,e){return i.cacheState===ue.Uncached?this._loadUncached(i,e).then(()=>!1):this._loadCached(i,e).then(t=>!t&&(i.cacheState=ue.Uncached,!0)).catch(t=>!ie(t)&&(i.cacheState=ue.Uncached,!0))}_enableFromGPUCache(i,e){if(this._disableMemCache||this._index==null)return!1;if(e===ne.Hole&&!this._index.useNodeAsHole(i.index))return!0;const t=this._loadCachedGPUData(i);return!!t&&(this.layerView.addCachedGPUData(i,t,e),this._nodeAdded(),!0)}_loadCachedGPUData(i){const e=this.layerView.loadCachedGPUData(i.index);return(e==null?void 0:e.attributeInfo)!=null&&He(e.attributeInfo.loadedAttributes,this._requiredAttributes)?e:(this.layerView.deleteCachedGPUData(e),null)}_nodeAdded(){this._index!=null&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}updateLoadStatus(i,e){const t=this._index;t!=null&&t.updateChildrenLoaded(i,e?1:-1)}async _loadCached(i,e){if(this._enableFromGPUCache(i,ne.Leaf))return!0;const t=this.layerView;if(this.disableIDBCache||!t.loadCachedNodeData||!t.addCachedNodeData)return!1;const s=(d,c)=>this._nodeLoader.loadTextures(i,d,c),n=(d,c)=>this._clientNodeLoader.loadTextures(i,d,c),r=i.index>=0?s:n,a=await this.schedule(()=>t.loadCachedNodeData(i,e,r),e);if(a==null)return!1;const o=this._requiredAttributes,l=await this.reschedule(()=>this._loadAttributes(i,o,e),e);return await this.reschedule(()=>t.addCachedNodeData(i,a,{loadedAttributes:o,attributeData:l},e),e),this._nodeAdded(),!0}_loadUncached(i,e){return this._downloadingCount++,this._loadNodeData(i,e).catch(t=>{throw this._downloadingCount--,t}).then(t=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(i,t,e),e))).then(()=>{this._nodeAdded(),i.cacheState=ue.Cached}).catch(t=>{if(!ie(t))throw Z.error("#loadNodeData()",this.layer,`Failed to load node '${i.id}'`,t),i.failed=!0,this._index!=null&&this._index.requestUpdate(),t})}_updateIdleState(i){i!==this._isIdle&&(this._isIdle=i,this._evaluateUpdating(),i&&this._index&&this._index!=null&&this._index.resetFailedNodes())}_getScale(i){if(this._loadedNodeScales.has(i.index))return this._loadedNodeScales.get(i.index);const e=this._computeScale(i);return this.layerView.isNodeLoaded(i.index)&&this._loadedNodeScales.set(i.index,e),e}_computeScale(i){this._tmpPoint.x=i.mbs[0],this._tmpPoint.y=i.mbs[1],this._tmpPoint.z=i.mbs[2];const e=i.mbs[3];return this.layerView.view.basemapTerrain.getSphereScale(this._tmpPoint,e)}_isNodeInScaleBounds(i){if(!this._areScaleBoundsActive)return!0;const e=this._getScale(i),{minScale:t,maxScale:s}=gt(this.layer);return Ui(e,t,s)}updateStats(i){var e;this.isGraphics3D&&(i.detail=this._featureLOD,i.target=this.featureTarget*this._baseLOD),(e=this._index)==null||e.updateStats(i)}get test(){const i=this;return{index:this._index,set disableUpdates(e){i._updatesDisabled=e,e?i.cancelNodeLoading():i.requestUpdate()},set disableIDBCache(e){i.disableIDBCache=e},set ignoreServiceObb(e){i._index!=null&&(i._index.ignoreServiceObb=e)},shouldLoadNode:e=>i._shouldLoadNode(e)}}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),this._index!=null&&this._index.requestUpdate()}geometryFilterChanged(i){const e=this._index;e!=null&&e.layerFilterChanged(i),this._setCameraDirty()}};x([v({readOnly:!0})],D.prototype,"isMeshPyramid",null),x([v({readOnly:!0})],D.prototype,"isGraphics3D",null),x([v({readOnly:!0})],D.prototype,"useMaximumNumberOfFeatures",null),x([v({readOnly:!0})],D.prototype,"indexStreamController",null),x([v({readOnly:!0})],D.prototype,"dataStreamController",null),x([v({readOnly:!0})],D.prototype,"crsVertex",null),x([v({readOnly:!0})],D.prototype,"crsIndex",null),x([v()],D.prototype,"screenSizeFactor",void 0),x([v()],D.prototype,"featureTarget",void 0),x([v()],D.prototype,"fixedFeatureTarget",void 0),x([v()],D.prototype,"layerView",void 0),x([v()],D.prototype,"layer",null),x([v()],D.prototype,"updating",void 0),x([v({readOnly:!0})],D.prototype,"running",null),x([v()],D.prototype,"updatingProgress",void 0),x([v({readOnly:!0})],D.prototype,"leavesReached",void 0),x([v({constructOnly:!0})],D.prototype,"scaleVisibilityEnabled",void 0),x([v({constructOnly:!0})],D.prototype,"worker",void 0),x([v({readOnly:!0,dependsOn:[]})],D.prototype,"rootNodeVisible",null),D=x([Xe($t)],D);const V=new T({deallocator:null});let Be;function He(i,e){return i!=null&&i.length===e.length&&i.every(t=>Ke(e,t.name)>=0)}function Ke(i,e){const t=e.toLowerCase();for(let s=0;s{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null}),this.is3DOFL&&this._associatedLayer!=null&&(Ee()?this._associatedLayer.load().then(e=>{this.destroyed||(this._original3DOFLDefinitionExpression=e.definitionExpression,this.addHandles(R(()=>this._definitionExpression,t=>e.definitionExpression=t,Je)),this._associatedLayerView=new rs({layer:this._associatedLayer,view:this.view}))}):ee())}destroy(){this.is3DOFL&&this._associatedLayer!=null&&(Ee()?this._associatedLayerView!=null&&(this._associatedLayer.definitionExpression=this._original3DOFLDefinitionExpression):ee()),this._set("layer",null),this._memCache=ji(this._memCache),this._pendingFetchAbortController=qi(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){var i;return Bi()&&((i=this._associatedLayer)==null?void 0:i.infoFor3D)!=null}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((i,e)=>i-e):[]}get _associatedLayer(){return this.layer==null?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get _definitionExpression(){const i=this.sortedGeometryChangedObjectIds;return i.length===0?"1 = 0":`OBJECTID IN (${i.join(",")})`}get updating(){return this.is3DOFL?this._pendingFetchChangedObjectIds?!0:Ee()?this._associatedLayerView==null||this._associatedLayerView!=null&&this._associatedLayerView.updating:!1:!1}get isEmpty(){return this._pendingFetchChangedObjectIds==null&&this._attributeChangedObjectIds.size===0&&this._geometryChangedObjectIds.size===0}featureHasGeometryChanges(i){return this._geometryChangedObjectIds.has(i)}featureHasAttributeChanges(i){return this._attributeChangedObjectIds.has(i)}createInteractiveEditSession(i){this._attributeChangedObjectIds.add(i);const e=this._interactiveEditingSessions,t=new Js(i,()=>{e.remove(t)});return e.unshift(t),t}async applyAttributeOverrides(i,e,t,s=[]){if(this._pendingFetchChangedObjectIds&&await Hi(this._pendingFetchChangedObjectIds,t),e==null)return;const{attributeData:n,loadedAttributes:r}=e;if(r==null||n==null||this._attributeChangedObjectIds.size===0)return;const a=new Set;for(const l of r)a.add(l.index);for(const l of s)a.has(l.index)||(r.push(l),n[l.name]=new Array(i.length));const o=await this._lockFeatureIds(i);try{const l={attributeData:n,loadedAttributes:r},d=this._getOverridesFromCache(i,l,this._attributeChangedObjectIds),{objectIds:c,fieldNames:h}=d;if(c.length===0||h.length===0)return;const u=await this._queryAttributeOverridesFromAssociatedLayer(c,h,t);if(u==null)return;this._processOverridesFromAssociatedLayer(i,u,h,l)}finally{o.remove()}}updateGeometry(i,e){this._geometryChangedObjectIds.add(i);const t=this._clientGeometryCache.get(i);if(t!=null&&(this.geometryOverrides.remove(t),this._clientGeometryCache.delete(i)),e!=null){const s={oid:i,mesh:e};this.geometryOverrides.add(s),this._clientGeometryCache.set(i,s)}}updateAttributeValue(i,e,t){this._attributeChangedObjectIds.add(i),this._cacheAttributeValue(i,e,t)}featureAdded(i){this.is3DOFL&&ee()&&this._geometryChangedObjectIds.add(i),this._attributeChangedObjectIds.add(i)}_cacheAttributeValue(i,e,t){this._memCache.put(this._getAttributeCacheKey(i,e),t,this._memCacheAttributeValueSize(t))}_getOverridesFromCache(i,{loadedAttributes:e,attributeData:t},s){const n=new Set,r=new Array;for(const o of e)r[o.index]=t[o.name];const a=new Set;for(let o=0;oa-o);const r=Ji(e,n).map(a=>{const o=t.clone();return o.objectIds=a,Ki(Wi(i,o,{signal:s}))});return Promise.all(r)}_processOverridesFromAssociatedLayer(i,e,t,{loadedAttributes:s,attributeData:n}){const r=this._associatedLayer;if(r==null)return;const a=r.objectIdField,o=t.map(h=>(h in n||(n[h]=new Array(i.length)),n[h])),l=new Map(s.map(h=>[h.name,h.index])),d=t.map(h=>l.get(h)),c=new Map(Array.from(i,(h,u)=>[h,u]));for(const h of e){const u=h.attributes[a];for(let _=0;_I-M);for(let I=0;I0){const I=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),i);if(I!=null)for(const M of I)M.geometry!=null&&this.updateGeometry(M.attributes[t.objectIdField],M.geometry)}}}_getFetchChangedObjectIdsServerGen(){var t,s;const i=this.layer;if(((t=i.serviceUpdateTimeStamp)==null?void 0:t.lastUpdate)!=null)return i.serviceUpdateTimeStamp.lastUpdate;const e=i.associatedLayer;return((s=e==null?void 0:e.serverGens)==null?void 0:s.minServerGen)!=null?e.serverGens.minServerGen:null}async _lockFeatureIds(i){const e=this._featureIdLocks;let t=!0;for(;t;){const r=new Array;for(const a of i){const o=e.get(a);o&&r.push(o)}r.length===0?t=!1:await Promise.all(r)}const s=ts(),n=s.promise;for(const r of i)e.set(r,n);return Ot(()=>{for(const r of i)e.delete(r);s.resolve()})}get test(){const i=Array.from(this._attributeChangedObjectIds),e=this._pendingFetchChangedObjectIds,t=this;return{changedObjectIds:i,pendingFetchChangedObjectIds:e,get maximumNumberOfEditOVerrides(){return t._maximumNumberOfEditOVerrides},set maximumNumberOfEditOVerrides(s){t._maximumNumberOfEditOVerrides=s}}}};x([v({constructOnly:!0})],P.prototype,"view",void 0),x([v({constructOnly:!0})],P.prototype,"layer",void 0),x([v({readOnly:!0})],P.prototype,"is3DOFL",null),x([v()],P.prototype,"_interactiveEditingSessions",void 0),x([v({readOnly:!0})],P.prototype,"sortedGeometryChangedObjectIds",null),x([v({readOnly:!0})],P.prototype,"geometryOverrides",void 0),x([v()],P.prototype,"_clientGeometryCache",void 0),x([v()],P.prototype,"_associatedLayer",null),x([v()],P.prototype,"_associatedLayerView",void 0),x([v({constructOnly:!0})],P.prototype,"memoryController",void 0),x([v()],P.prototype,"_attributeChangedObjectIds",void 0),x([v()],P.prototype,"_geometryChangedObjectIds",void 0),x([v()],P.prototype,"hasGeometryChanges",null),x([v()],P.prototype,"_pendingFetchChangedObjectIds",void 0),x([v()],P.prototype,"_pendingFetchAbortController",void 0),x([v()],P.prototype,"_definitionExpression",null),x([v()],P.prototype,"updating",null),x([v()],P.prototype,"isEmpty",null),P=x([Xe(We)],P);class Js{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}const Ks=1e4,Ws=5e4;export{Es as D,cn as F,gn as M,P as S,me as a,pe as b,C as c,Rs as d,mn as e,_n as f,w as s}; diff --git a/dist/assets/I3SOverrides-XXafrk1K.js b/dist/assets/I3SOverrides-XXafrk1K.js new file mode 100644 index 0000000..b625649 --- /dev/null +++ b/dist/assets/I3SOverrides-XXafrk1K.js @@ -0,0 +1 @@ +import{tp as Gt,tq as kt,tr as Ut,sI as k,ts as Me,tt as jt,mU as et,a8 as Z,py as qt,tu as Pt,W as Oe,tv as fe,hY as A,tw as tt,r as q,tx as Bt,ty as Ht,j3 as Mt,ab as zt,tz as Qt,b6 as Jt,qV as Kt,n5 as Wt,pi as Xt,tA as Yt,fw as Zt,e as x,y as v,c as Xe,g as Ye,gH as ei,bn as ti,a0 as Ot,aO as $,tB as ee,ac as ie,t6 as it,fh as ii,c2 as te,tC as B,tD as se,tE as st,tF as si,kl as be,tf as Lt,fs as ni,tG as nt,tH as ae,fv as Se,tI as ze,bE as Rt,tJ as At,fu as ri,tK as Le,tL as ai,dE as Ze,fA as oi,dL as li,jY as Ie,tM as Re,tN as di,f0 as rt,ah as hi,tO as ui,tP as ci,tQ as _i,sT as at,bU as Ft,tR as gi,mS as mi,bH as fi,tS as pi,i6 as bi,tT as yi,sR as xi,b8 as vi,bG as ot,sP as lt,tU as dt,tV as Ni,tW as ht,tX as Ci,tY as Ii,td as wi,te as Si,d3 as ut,by as le,ca as de,c9 as Ae,cG as Di,b4 as Fe,bO as Pi,ci as Mi,R as Qe,cQ as Oi,tZ as ct,t_ as Li,fP as Ri,t$ as Ai,B as R,P as Je,a9 as Fi,u0 as Ei,cf as Et,se as $i,qi as _t,u1 as Ti,u2 as Vi,u3 as gt,u4 as Gi,u5 as mt,rr as ki,oI as Ui,V as ft,fi as Ee,b as ji,I as qi,fO as Bi,gD as Hi,c$ as zi,u6 as Qi,u7 as Ji,o2 as Ki,o3 as Wi,u8 as Xi,u9 as Yi,av as Zi,ua as es,ag as ts}from"./index-pCX-0tJH.js";import{a as L,i as ye,h as pt,t as ge,n as he,d as is,s as ne,o as ue}from"./I3SNode-A9aOJfXV.js";import{s as bt}from"./ReactiveSet-_4-UpKXZ.js";import{assetMapFromAssetMapsJSON as ss,extractMesh as ns}from"./meshFeatureSet-42GYfSGc.js";import rs from"./FeatureLayerView3D-vzwVkoh-.js";function me(i,e,t,s){if(e==null||s==null)return!1;const n=kt(e,s,as);if(n.projector===Ut)return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],!0;if(n.projector==null)return!1;const{source:r,dest:a}=n;if(a.spatialReferenceId===k.WEB_MERCATOR){const o=Me[r.spatialReferenceId][k.WGS84];return o!=null&&(o(i,0,$e,0),jt($e,0,t,0),t[3]=yt($e[1],i[2],i[3],et.radius),!0)}if(r.spatialReferenceId!==k.WGS84&&r.spatialReferenceId!==k.CGCS2000||a.spatialReferenceId!==k.PLATE_CARREE){n.projector(i,0,t,0);const o=r.metersPerUnit??1,l=a.metersPerUnit??1;t[3]=i[3]*o/l}else{const o=Me[r.spatialReferenceId][k.SPHERICAL_ECEF],l=Me[k.SPHERICAL_ECEF][k.PLATE_CARREE];let d=i[3];o!=null&&l!=null&&(d=yt(i[1],i[2],i[3],et.radius)),n.projector(i,0,t,0),t[3]=d}return!0}function yt(i,e,t,s){const n=s+e;if(nn)return Number.MAX_VALUE;const r=Math.abs(os*i)+Math.asin(t/n);return r>=Math.PI/2?Number.MAX_VALUE:t/Math.cos(r)}const $e=Z(),as=Gt(),os=qt(1);var C,w;(function(i){i[i.KTX2=1]="KTX2",i[i.Basis=2]="Basis",i[i.DDS_S3TC=4]="DDS_S3TC",i[i.PNG=8]="PNG",i[i.JPG=16]="JPG",i[i.KTX_ETC2=32]="KTX_ETC2"})(C||(C={})),function(i){i[i.None=0]="None",i[i.Color=1]="Color",i[i.MetallicRoughness=2]="MetallicRoughness",i[i.Normal=4]="Normal",i[i.Occlusion=8]="Occlusion",i[i.Emissive=16]="Emissive",i[i.AlphaMask=32]="AlphaMask",i[i.ColorTextures=19]="ColorTextures",i[i.GeometryTextures=36]="GeometryTextures",i[i.GeometryTexturesPBR=44]="GeometryTexturesPBR",i[i.AllTextures=37]="AllTextures",i[i.AllTexturesPBR=63]="AllTexturesPBR"}(w||(w={}));async function ls(i){const e=[],t=[];if(i==null)return{material:{alphaMode:"opaque",alphaCutoff:.1,doubleSided:!0,cullFace:0,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[1,1,1,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6000000238418579},wrapTextures:!1,hasParametersFromSource:!0},requiredTextures:e,textureData:t};const s=ds(i);i.alphaMode==="auto"&&console.warn('alphaMode "auto" not supported by I3S PBRMaterial - defaulting to "blend".');const n=Pt({normalTexture:i.normalTexture,emissiveTexture:s?i.emissiveTexture:null,emissiveFactor:s?Oe.toUnitRGB(i.emissiveColor):null,occlusionTexture:s?i.occlusionTexture:null,metallicRoughnessTexture:s?i.metallicRoughnessTexture:null,metallicFactor:s?i.metallic:null,roughnessFactor:s?i.roughness:null}),r=n?fe[0]:s?i.metallic:0,a=n?fe[1]:s?i.roughness:0;return{material:{alphaMode:i.alphaMode==="auto"?"blend":i.alphaMode,alphaCutoff:i.alphaCutoff,doubleSided:i.doubleSided,cullFace:i.doubleSided?A.None:A.Back,normalTextureId:await ce(i.normalTexture,e,t,w.Normal),emissiveTextureId:s?await ce(i.emissiveTexture,e,t,w.Emissive):-1,occlusionTextureId:s?await ce(i.occlusionTexture,e,t,w.Occlusion):-1,emissiveFactor:s&&i.emissiveColor!=null?Oe.toUnitRGB(i.emissiveColor):[0,0,0],metallicRoughness:{baseColorFactor:i.color!=null?Oe.toUnitRGBA(i.color):[1,1,1,1],baseColorTextureId:await ce(i.colorTexture,e,t,w.Color),metallicRoughnessTextureId:s?await ce(i.metallicRoughnessTexture,e,t,w.MetallicRoughness):-1,metallicFactor:r,roughnessFactor:a},wrapTextures:!0,hasParametersFromSource:n},requiredTextures:e,textureData:t}}async function ce(i,e,t,s){if(i==null)return-1;const n=t.length,r=i.data,a=i.url;if(r!=null){if(r instanceof HTMLImageElement||r instanceof HTMLCanvasElement){const o=tt(r);return t.push({id:n,usage:s,data:o,encoding:C.PNG,downsampled:!1}),e.push({id:n,usage:s,encodings:[{name:void 0,encoding:C.PNG}]}),n}if(r instanceof HTMLVideoElement)return-1;if(r instanceof ImageData)throw new q("ImageData textures not supported yet for client side I3S nodes");if(r instanceof Bt)throw new q("EncodedMeshTexture textures not supported yet for client side I3S nodes")}else if(a!=null){const o=new Image;o.src=a;const l=await Ht(o,o.src,!1,void 0),d=tt(l);return t.push({id:n,usage:s,data:d,encoding:C.PNG,downsampled:!1}),e.push({id:n,usage:s,encodings:[{name:void 0,encoding:C.PNG}]}),n}return-1}function ds(i){return i.hasOwnProperty("metallicRoughnessTexture")}let hs=class{constructor(e,t,s,n){this._uid=e,this._worker=n,this._id2Meta=new Map,this._oid2Meta=new Map,this._indexSR=t.indexSR,this._vertexSR=t.vertexSR,this._renderSR=t.renderSR,this._localMode=t.localMode,this._memCache=s.newCache(`sl-client-mesh-data-${this._uid}`)}get uid(){return this._uid}get worker(){return this._worker}get indexSR(){return this._indexSR}get renderSR(){return this._renderSR}createMeshNodeInfo(e,t){const s=`mesh${t}`,n=e.extent,r=n.spatialReference,a=this._indexSR,o=us(n,e.origin);return me(o,r,o,a),{type:"mesh",id:s,version:gs(e),oid:t,mbs:o,componentNodeIds:[],unloadedMesh:e,nodeIndex:null,loadMeshPromise:null}}addMeshNode(e,t){if(this.getMeshNodeIndex(t.oid)!=null)throw new q(`I3SClientNodeLoader: client side mesh for feature oid=${t.oid} already exists`);t.nodeIndex=e,this._id2Meta.set(t.id,t),this._oid2Meta.set(t.oid,t)}getMeshNodeIndex(e){const t=this._oid2Meta.get(e);return t==null||t.type!=="mesh"?null:t.nodeIndex}removeNode(e){const t=this._id2Meta.get(e);t!=null&&(this._id2Meta.delete(e),t.type==="mesh"&&this._oid2Meta.delete(t.oid))}async loadNodeJSON(e){const t=this._id2Meta.get(e);if(t==null)throw new q(`I3SClientNodeLoader::loadNodeJSON unable to find node ${e}`);switch(t.type){case"mesh":return this._loadMeshNodeJSON(t);case"mesh-component":return this._loadMeshComponentNodeJSON(t);default:throw new q(`I3SClientNodeLoader::loadNodeJSON unable to handle node ${e}`)}}async _loadMeshNodeJSON(e){const t=e.id,s=(await this._getMeshData(e)).loadedMesh;if(s.components==null||s.components.length===0)return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null};const n=[],r=s.components;for(let a=0;a{const o=e.unloadedMesh.clone();try{await o.load()}catch(c){a(c)}const l=o.memoryUsage,d={loadedMesh:o,projectionPromise:null,normalsTransformPromise:null,usedMemoryInBytes:l};this._memCache.put(t,d,l,Yt),e.loadMeshPromise=null,r(d)};return e.loadMeshPromise=new Promise((r,a)=>n(r,a)),e.loadMeshPromise}return s}};function us(i,e){const{spatialReference:t}=i,s=[1,-1],n=[.5*i.width,.5*i.height,i.hasZ?.5*(i.zmax-i.zmin):0],r=t.isGeographic?t.metersPerUnit:1,a=i.center;let o=0;if(i.hasZ)for(let l=0;l<2;++l)for(let d=0;d<2;++d)for(let c=0;c<2;++c){const h=(a.x+s[l]*n[0]-e.x)*r,u=(a.y+s[d]*n[1]-e.y)*r,_=a.z+s[c]*n[2]-e.z;o=Math.max(h*h+u*u+_*_,o)}else for(let l=0;l<2;++l)for(let d=0;d<2;++d){const c=(a.x+s[l]*n[0]-e.x)*r,h=(a.y+s[d]*n[1]-e.y)*r;o=Math.max(c*c+h*h,o)}return Qt([e.x,e.y,e.z],Math.sqrt(o))}async function cs(i,e,t,s){const{transform:n,vertexAttributes:r}=e.loadedMesh,a=i.shading==="source"?r.normal:null;if(!(a!=null&&n!=null&&(n.rotationAngle!==0||!Jt(n.scale,Kt))))return{transformed:a,original:r.normal};if(!e.normalsTransformPromise){Mt(t,"SceneLayerWorker is needed to transform mesh normals");const o=Zt();Wt(o,n.localMatrix),e.normalsTransformPromise=t.transformNormals({normalMatrix:o,normals:a},s)}return e.normalsTransformPromise}function _s(i,e,t,s,n,r){const o=e.length/3,l=3*o;let d=0,c=0,h=!1,u=0,_=!1,m=0,g=!1,p=0,b=0,f=0;d+=K,d+=K,c=d,d+=3*l*Te,t!=null&&(h=!0,u=d,d+=3*l*Te),s!=null&&(_=!0,m=d,d+=2*l*Te),n!=null&&(g=!0,p=d,d+=4*l*ms),b=d,d+=1*fs,f=d,d+=2*1*K;const y=new ArrayBuffer(d),N=new Uint8Array(y);J(N,0,l),J(N,K,1);const S=new Float32Array(y,c),I=t!=null?new Float32Array(y,u):null,M=s!=null?new Float32Array(y,m):null,F=n!=null?new Uint8Array(y,p):null;for(let T=0;T>8,i[e+2]=255&t>>16,i[e+3]=255&t>>24}function gs(i){var n;const e=(n=i.metadata.displaySource)==null?void 0:n.source;if(e==null||!Array.isArray(e)||!e.length||e[0]instanceof File)return Xt();const t=e;let s="";for(const r of t)s+=r.makeHash();return s+JSON.stringify(i.transform!=null?i.transform.toJSON():"")+(i.vertexSpace.isRelative?JSON.stringify(i.vertexSpace.origin):"")}const K=4,Te=4,ms=1,fs=8;let we=class extends Ye{constructor(){super(),this.referenceCount=0,this.callbacks=new Array,this.runIndex=0}get running(){return this.callbacks.some(e=>e.running)}runTask(e){this._sort();const t=this.callbacks,s={numIndexLoading:0,numNodesLoading:0};for(let n=0;n0;s--){const n=e[s-1];let r=s;for(;r{t!=null&&(t.task.remove(e),t.task.callbacks.length>0||(Ve.delete(i),t.handle.remove(),t.task.destroy()),t=null)})}function oe(i,e,t){i&&(typeof e=="number"?(i.elevationRangeMin=Math.min(i.elevationRangeMin,e),i.elevationRangeMax=Math.max(i.elevationRangeMax,t)):(i.elevationRangeMin=Math.min(i.elevationRangeMin,e.elevationRangeMin),i.elevationRangeMax=Math.max(i.elevationRangeMax,e.elevationRangeMax)))}let Ge=class{constructor(e,t,s,n,r){this.childOffset=e,this.childCount=t,this.visibilityCache=s,this.ref=n,this.node=r,this.useAsHole=0,this.filterImpact=ge.NotChecked,this.traversalState=null,this.parent=-1}},ke=class{constructor(e=[],t=[]){this.nodes=e,this.children=t,this.lastTraversed=0,this.numNodesWithLoadedChildren=0}},ys=class{get _useNodePages(){return this._pageSize>0}constructor(e,t,s,n,r,a,o,l,d,c,h,u,_,m,g){var p,b;this._layer=e,this._streamDataController=s,this._clientNodeLoader=n,this._viewportQueries=r,this._logger=a,this.holeFilling=o,this._isLoaded=l,this._isReloading=d,this._isSelected=c,this._enable=h,this._needsUpdate=u,this._canRequest=_,this._computeVisibilityObb=m,this._computeNodeFiltering=g,this._dirty=!0,this._nodePages=new Map,this._clientNodePage=null,this._pageSize=0,this._rootIndex=0,this._lodMetric=L.None,this._lodConversion=f=>f,this._isEditable=!1,this._urlPrefix="",this._loadingNodes=new Set,this._loadingPages=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._version=W(0),this._visibilityCacheVersion=W(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missingPagesAndNodes=new $({deallocator:null}),this._prefetchNodes=new $({deallocator:null}),this._updates=new xs(this._missingPagesAndNodes),this._imModificationUncategorized=new $({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=new Array,this._newPages=new Array,this.needNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._frameNumber=0,this._isEditable=ee()&&((p=e.associatedLayer)==null?void 0:p.infoFor3D)!=null,(b=e.serviceUpdateTimeStamp)!=null&&b.lastUpdate&&(this._lastUpdate=`${e.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,this._init(t)}_init(e){if(e.type==="page"){const t=e.rootPage;switch(this._urlPrefix=e.urlPrefix,this._pageSize=e.pageSize,e.lodMetric){case"maxScreenThreshold":this._lodMetric=L.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this._lodMetric=L.MaxScreenThreshold,this._lodConversion=Cs}if(this._isEditable){this._rootIndex=-1;const s=E(e.rootIndex,e.pageSize),n=t.nodes[s],r={nodes:[{index:this._rootIndex,children:[e.rootIndex],mesh:void 0,obb:n.obb,lodThreshold:n.lodThreshold}]};this._addPage(X(this._rootIndex,this._pageSize),r),this.getNode(-1).serviceObb=void 0}else this._rootIndex=e.rootIndex;this._addPage(X(e.rootIndex,this._pageSize),t),this._updateParentsAndLevel()}else if(e.type==="node"){this._urlPrefix=e.urlPrefix;const t=new ke;if(this._nodePages.set(0,t),this._isEditable){this._clientNodePage=new ke;const n={id:"-1",version:null,mbs:e.rootNode.mbs,obb:e.rootNode.obb,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:[{id:"root",href:"../root",mbs:e.rootNode.mbs,obb:e.rootNode.obb}]};this._rootIndex=this._makeClientRefNode(new ye(n.id,null),-1);const r=this._validateNode(n.id,n);r&&this._addNode(r,this._rootIndex)}else this._rootIndex=this._makeRefNode(new ye(e.rootNode.id,null),-1);const s=this._validateNode(e.rootNode.id,e.rootNode);s&&this._addNode(s,0)}}addClientNodeToIndex(e,t){const n=new ye(e,t),r=this._makeClientRefNode(n,-1);return this._linkChildToParentNode(-1,r),this.requestUpdate(),r}removeClientNodeFromIndex(e,t,s){this._destroyClientRefNode(e,t,s),this.requestUpdate()}_loadPage(e){this._loadingPages.add(e);const t=this._urlPrefix+e;this._streamDataController.request(t,"json").then(s=>{this._pageQueue.push({pageIndex:e,page:s})}).catch(s=>{this._loadingPages.delete(e),ie(s)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._layer,`Error when loading page ${e}`,s))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:s}=this._pageQueue.shift();this._addPage(t,s),this._loadingPages.delete(t),e.madeProgress(),this.needNodeElevationRange&&this._newPages.push(t)}this._updateParentsAndLevel()}_invalidateElevationRangeForNewPages(e){if(this.needNodeElevationRange)for(;this._newPages.length>0&&!e.done;){const t=this._nodePages.get(this._newPages.shift());if(t==null)continue;const s=t.nodes;for(let n=0;n{var y,N,S;const d=s.length,c=o.children?o.children.length:0;n.push(this._rootIndex);for(let I=0;I{const a=this._getPage(s);if(a!=null){const o=E(s,this._pageSize),l=a.nodes[o];l.parent=n??-1;const d=l.node;d!=null&&(d.level=r,e.push(s))}};for(t(this._rootIndex,null,0);e.length;){const s=e.pop(),n=this.getNode(s);if(n!=null)for(let r=0;r=0)throw new Error("I3SIndex::client side nodes can not be made children of service side nodes.");const n=-(s.nodes.length+1),r=new Ge(0,0,xe(this._visibilityCacheVersion),e,null);return s.nodes.push(r),r.parent=t,B(e.renderMbs),se(e.serviceObbInRenderSR),n}_linkChildToParentNode(e,t){const s=this._clientNodePage;if(s==null||e>=0)return;const n=E(e,this._pageSize),r=E(t,this._pageSize),a=s.nodes[n],o=a.childOffset;s.children.splice(a.childOffset+a.childCount,0,t);const l=1;a.childCount+=l,a.node!=null&&(a.node.childCount+=l);for(const d of s.nodes)d.childOffset>o&&(d.childOffset+=l);s.nodes[r].parent=e,this._updateParentBoundingInformation(e)}_destroyClientRefNode(e,t,s){var m,g;const n=this._clientNodePage;if(n==null)return;const r=this.getParentIndex(e);if(r==null)return;const a=new Set,o=new Map,l=p=>{var N,S;const b=E(p,this._pageSize),f=n.nodes[b];if(f.childCount>0)for(let I=f.childOffset;I-1),u=[],_=[];for(let p=0;p=0)_.push(S);else{const I=E(S,this._pageSize),M=d[I];if(a.has(M))continue;const F=h[I];_.push(F),M.parent=b}}f.childOffset=y,f.childCount=_.length-y,f.node&&(f.node.childCount=f.childCount)}n.nodes=u,n.children=_,this._updateParentBoundingInformation(h[E(r,this._pageSize)])}_updateParentBoundingInformation(e){let t=e;do{let s=null;const n=this._clientNodeLoader.indexSR,r=this._clientNodeLoader.renderSR,a=this._getNodeInternal(t);if(a==null)return;for(let l=0;l0)if(s==null)s=st(h.mbs,Is);else{const u=ws,_=Ss,m=Ds;me(h.mbs,n,u,r),me(s,n,_,r),si(u,_,m),me(m,r,s,n)}}const o=a.ref||a.node;o!=null&&(s!=null?o.mbs=st(s,o.mbs!=null?o.mbs:be()):B(o.mbs),B(o.renderMbs),se(o.serviceObbInRenderSR),o.geometryObb=null),this.invalidateNodeVisibilityCacheInternal(a),t=this.getParentIndex(t)}while(t!=null)}populateChildren(e,t){const s=this._getNodeInternal(e),n=this._getPage(e);s.childOffset=n.children.length,s.childCount=t.length;for(let r=0;r{(s.node!=null&&s.node.id===e||s.ref!=null&&s.ref.id===e)&&(t=n)}),t}getNodeById(e){const t=this.getIndexById(e);return t!=null&&t>=0?this.getNode(t):null}getChildIndex(e,t){const s=this._getPage(e);if(s==null)return-1;const n=s.nodes[E(e,this._pageSize)];return s.children[n.childOffset+t]}getParentIndex(e){const t=this._getPage(e);return t!=null&&e!==this._rootIndex?t.nodes[E(e,this._pageSize)].parent:null}getParent(e){const t=this.getParentIndex(e);return t!=null?this.getNode(t):null}isLeaf(e){const t=this._getNodeInternal(e);return t!=null&&t.childCount===0}get rootNode(){return this.getNode(this._rootIndex)}get isEditable(){return this._isEditable}removeAllGeometryObbs(){this._forAllNodes(e=>{e.node!=null&&(e.node.geometryObb=null)})}invalidateVisibilityCache(){this._visibilityCacheVersion=W(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeInternal(e);t!=null&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=xe(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeInternal(e);t!=null&&(xt(t),this.invalidateNodeVisibilityCacheInternal(t))}updateElevationChanged(e){const t=this._getNodeInternal(e);if(t==null)return;if(!this.needNodeElevationRange)return void this.invalidateBoundingVolumeCache(e);const s=t.node!=null?t.node:t.ref;s!=null&&s.invalidateElevationRange()}invalidateGeometryVisibility(e){const t=this._getNodeInternal(e);(t==null?void 0:t.node)!=null&&(t.node.geometryObb=null,B(t.node.renderMbs),se(t.node.serviceObbInRenderSR))}invalidateVisibilityObbs(){this.rootNode!=null&&this.traverse(this.rootNode,e=>(e.visibilityObb=this._computeVisibilityObb(e),e.geometryObb=null,!0))}_updateElevationRange(e){this._updateElevationRangeInternal(e,null)}_updateElevationRangeInternal(e,t){var d;const s=this._getNodeInternal(e);if(!s)return!1;const n=(s==null?void 0:s.node)??(s==null?void 0:s.ref);if(!n)return!1;const r=n.elevationRangeMin;if(!Number.isNaN(r))return oe(t,n),!0;const a={elevationRangeMin:1/0,elevationRangeMax:-1/0};let o=!1;for(let c=0;c{t!=null&&(t.imModificationImpact=he.NotChecked,t.visibilityObb=this._computeVisibilityObb(t),t.hasModifications&&this.invalidateGeometryVisibility(t.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(t=>{if(t!=null){t.filterImpact=ge.NotChecked;const s=t.node;s!=null&&this.invalidateNodeVisibilityCache(s.index)}}),this.invalidateVisibilityCache()}update(e,t,s){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._invalidateElevationRangeForNewPages(t),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._updates.reset(e),O.clear();let n=!0;const r=new je,a=new je,o=this._imModificationUncategorized;o.clear();const l=new Set,d=(h,u,_)=>{const m=X(h,this._pageSize);if(l.add(m),u==null){let f=this._entryPriority(h);return f===1/0&&(f=this._entryPriority(_)),O.set(m,Math.max(f,O.get(m)||0)),this._loadingPages.has(m)||this._failedPages.has(m)||this._missingPagesAndNodes.push(m),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f))}const g=u.node;if(this._updateNodeFeatureEstimate(g,a),g==null){const f=this._entryPriority(h);return this._loadingNodes.has(h)||this._failedNodes.has(h)||(this._missingPagesAndNodes.push(h),O.set(h,f)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f))}const p=this._getPage(h);if(this._missingPagesAndNodes.length===0&&!this._useNodePages)for(let f=0;f0&&this._isSelected(g)&&(n=!1));if(this._isLoaded(h)){if(r.known+=g.memory,++r.knownNodes,this._isSelected(g)?u.childCount>0&&(n=!1):(r.unremoved+=g.memory,n=!1),this._needsUpdate(g)){const f=this._entryPriority(h);O.set(h,f),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f),this._updates.update.push(h)}return}if(g.memory&&(r.known+=g.memory,++r.knownNodes),!this._isSelected(g))return void(this._isReloading(h)&&this._updates.remove.push(h));if(u.childCount>0&&(n=!1),g.memory?(r.missing+=g.memory,r.known+=g.memory,++r.knownNodes):++r.missingNodes,e.includes(g.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(h)),void(this._updates.cancel=this._updates.cancel.filter(f=>f!==g.index));if(!t.done&&this._enable(g))return void t.madeProgress();const b=this._entryPriority(h);O.set(h,b),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,b),this._updates.add.push(h),this.layerHasModifications&&s&&g!=null&&g.imModificationImpact===he.NotChecked&&o.push(h)};this.traverseVisible(d),this._frameNumber++,this._missingPagesAndNodes.sort((h,u)=>h-u),this._missingPagesAndNodes.filterInPlace((h,u)=>u<1||this._missingPagesAndNodes.data[u-1]!==h),this._missingPagesAndNodes.sort((h,u)=>O.get(h)-O.get(u)),this._missingPagesAndNodes.length>0&&(this._maxUnloadedPrio=O.get(this._missingPagesAndNodes.back()),this._prefetchNodes.clear());const c=this._updates.add;c.length>0&&this.layerHasModifications&&(o.length>0&&(s==null||s(o)),c.filterInPlace(h=>{const u=this._getNodeInternal(h),_=(u==null?void 0:u.node)==null||u.node.imModificationImpact!==he.Culled;return _||this.invalidateNodeVisibilityCache(h),_})),this._unloadedMemoryEstimate=r.missing-r.unremoved,r.knownNodes>3&&r.missingNodes>0&&(this._unloadedMemoryEstimate+=r.known/r.knownNodes*r.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(a),this._featureEstimate.leavesReached=n,this._updates.add.filterInPlace(h=>O.get(h)>=this._maxUnloadedPrio).sort((h,u)=>O.get(h)-O.get(u)),this._updates.update.sort((h,u)=>O.get(h)-O.get(u)),this._indexMissing=this._loadingPages.size+this._loadingNodes.size+this._missingPagesAndNodes.length,this._dirty=this._indexMissing>0,O.clear()}checkFeatureTarget(e,t){const s=this._viewportQueries.updateScreenSpaceErrorBias(t);let n=t,r=t,a=s,o=10;for(;o--;){const l=new je;if(this._updateFeatureEstimate(n,l),this._computeFeatureEstimate(l)<=e){if(n>=t||l.missingNodes>0||o===0)break;a=n,n=.5*(n+r)}else r=n,n=.5*(n+a)}return this._version=W(this._version),this._viewportQueries.updateScreenSpaceErrorBias(s),Math.min(t,n)}_updateFeatureEstimate(e,t){this._version=W(this._version),this._viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((s,n)=>this._updateNodeFeatureEstimate(n!=null?n.node:void 0,t))}_updateNodeFeatureEstimate(e,t){e==null||e.failed||e.numFeatures==null||this._isSelected(e)&&(e.numFeatures!=null?(t.missing+=e.numFeatures,t.known+=e.numFeatures,++t.knownNodes):++t.missingNodes)}_computeFeatureEstimate(e){let t=e.known-e.unremoved;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.known/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missingPagesAndNodes)}prefetch(){return this._prefetchNodes.sort((e,t)=>O.get(e)-O.get(t)),this._load(this._prefetchNodes)}_load(e){if(e.length===0||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();){const t=e.pop();this._useNodePages&&t>=0?this._loadPage(t):this._loadNode(t)}return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetchNodes.length>0}get indexLoading(){return this._loadingPages.size+this._loadingNodes.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(e==null)return null;const t=e.index,s=this._getNodeInternal(t);if(!s)return null;let n=s==null?void 0:s.traversalState;if(n&&Ue(n.version,this._version))return n;const r=this._viewportQueries.getLodLevel(e),a=this._viewportQueries.hasLOD(e);let o=!0;if(a){const l=this.getParentIndex(t);if(l!=null){const d=this._getNodeInternal(l),c=d==null?void 0:d.traversalState;o=!!c&&r>c.lodLevel}else o=r>0}else o=e.childCount===0;return n?(n.lodLevel=r,n.isChosen=o,n.version=ve(!0,this._version),n):(n=new is(a,o,r,ve(!0,this._version)),s.traversalState=n,n)}async _loadNode(e){this._loadingNodes.add(e);const t=this._getNodeInternal(e).ref;if(t==null)return void this._failedNodes.add(e);const s=t.id,n=this._urlPrefix+s,r=()=>{this._loadingNodes.delete(e),this._missingPagesAndNodes.length===0&&this._loadingNodes.size===0&&this.requestUpdate()};let a=null;try{a=e>=0?await this._streamDataController.request(n,"json"):await this._clientNodeLoader.loadNodeJSON(s)}catch(d){return r(),void(ie(d)||(this._logger.error("#loadNode()",this._layer,"Error loading node: "+n),this._failedNodes.add(e)))}r();const o=this._validateNode(s,a);if(o==null)return;o.obb&&this.invalidateNodeVisibilityCache(e);const l=this._addNode(o,e);this.nodeTraversalState(l)}_validateNode(e,t){var u;if(t==null||typeof t!="object"||t.id!==e)return this._logger.error("#validateNode()",this._layer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._layer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&t.sharedResource.href!=="./shared"&&t.sharedResource.href!=="./shared/"&&this._logger.warn("#validateNode()",this._layer,`Invalid shared resource href on node "${e}"`);const s=t.geometryData;s==null||Array.isArray(s)&&s.length===0||Array.isArray(s)&&s.length===1&&s[0].href==="./geometries/0"||this._logger.warn("#validateNode()",this._layer,`Invalid geometry data on node "${e}"`);const n=t.attributeData,r=this._layer.attributeStorageInfo;n==null||Array.isArray(n)&&!n.some((_,m)=>{var g;return _.href!==`./attributes/${((g=r==null?void 0:r[m])==null?void 0:g.key)??`f_${m}`}/0`})||this._logger.warn("#validateNode()",this._layer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._layer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const a=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:null,o=t.featureData&&t.featureData.length===1&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:void 0,l=_=>{if(_==null)return null;const m=b=>this._logger.error("#validateNode()",this._layer,`Invalid node reference on node ${e}: ${b}`);if(typeof _.id=="number")m(`id ${_.id} is a number instead of a string.`);else if(typeof _.id!="string"||!Array.isArray(_.mbs))return m("Missing or invalid id."),null;if(!Array.isArray(_.mbs))return m(`Invalid bounding volume on reference ${_.id}.`),null;_.href&&_.href!=="../"+_.id&&this._logger.error("#validateNode()",this._layer,`Invalid node href on node "${e}"`);const g=_.hasOwnProperty("obb")&&!this.ignoreServiceObb?_.obb:null,p=new ye(`${_.id}`,_.mbs);return p.serviceObb=g,p.visibilityObb=this._computeVisibilityObb(p),p},d=Array.isArray(t.children)?t.children.map(l).filter(_=>_!=null):null,c=((u=t.featureData)==null?void 0:u.length)??!1,h=t.isEmpty===!0;return{id:e,mbs:t.mbs,obb:a,children:d,resources:{isEmpty:!c&&h,hasSharedResource:t.sharedResource!=null,attributes:t.attributeData?e:void 0,texture:t.textureData&&t.textureData.length>0?e:void 0,geometry:t.geometryData!=null?e:void 0},version:typeof t.version=="string"?t.version:null,lodSelection:Array.isArray(t.lodSelection)?t.lodSelection:null,numFeatures:o}}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{e.node!=null&&(e.node.failed=!1)})}_entryPriority(e){const t=this._getNodeInternal(e),s=this.getParentIndex(e);if(t==null||s==null&&t.node==null)return s==null?1/0:this._entryPriority(s);let n=0;if(t.node&&s!=null){const o=this._getNodeInternal(s).traversalState;o!=null&&(n=o.lodLevel)}let r=this.progressiveLoadPenalty;for(let o=e;o!=null;o=this.getParentIndex(o))if(this._isLoaded(o)){r=0;break}const a=t.ref!=null?this._viewportQueries.distToPOI(t.ref):t.node!=null?this._viewportQueries.distToPOI(t.node):0;return-a-n*(a+this.progressiveLoadPenalty)+r}traverseVisible(e){const t=this._getNodeInternal(this._rootIndex);t!=null?this._traverseVisible(this._rootIndex,null,t,e):e(this._rootIndex,null,null)}_traverseVisible(e,t,s,n){if(s.node&&s.childCount===0)return void(this.isGeometryVisible(e)&&n(e,s,t));if(!this.isNodeVisible(e)||(n(e,s,t),s.node==null))return;const r=this.nodeTraversalState(s.node);if(r!=null&&r.nodeHasLOD&&r.lodLevel===this._maxLodLevel)return;const a=this._getPage(e);for(let o=0;o{let n=this._isLoaded(s.index)||this._isReloading(s.index)?1:0;return this.traverseChildren(s,r=>(n+=t(r),!1)),s.childrenLoaded!==n&&e.push(s.index),n};return t(this.rootNode),e.length&&this._logger.error("childrenLoaded invariant broken at following nodes: "+e.join(",")),e.length>0}updateStats(e){var t;if(this._updates.add.length>0&&(e.nodes+=" + "+this._updates.add.length),e.index=this._nodePages.size*(this._pageSize||1)+(((t=this._clientNodePage)==null?void 0:t.nodes.length)??0),e.prio=this._maxProcessingPrio,(this._indexMissing||this._prefetchNodes.length>0)&&(e.index+=" + "+this._indexMissing||this._prefetchNodes.length),this._featureEstimate.estimate){const s=this._featureEstimate.estimate-e.features;s>0?e.features+=" + "+s:s<0&&(e.features+=" - "+-s)}}updateElevationInfo(e,t){this.needNodeElevationRange=t&&!!e&&(e.mode==="relative-to-ground"||e.mode==="on-the-ground"),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes(e=>{xt(e),e.node!=null&&e.node.invalidateElevationRange(),e.ref!=null&&e.ref.invalidateElevationRange()})}_forAllNodes(e){if(this._clientNodePage!=null){const t=this._clientNodePage;for(let s=0;st.add(X(s,this._pageSize)));for(const[s,n]of e)if(n.numNodesWithLoadedChildren!==0||t.has(s))for(const r of n.nodes)r.traversalState=null;else this._deleteNodePage(s)}}_deleteNodePage(e){this._nodePages.delete(e)}get test(){return{addNode:(e,t)=>this._addNode(e,t),getNodeInternal:e=>this._getNodeInternal(e),getPageIndex:e=>X(e,this._pageSize),getIndexWithinPage:e=>E(e,this._pageSize),getNodePage:e=>e<0?this._clientNodePage:this._nodePages.get(e),getChildIndices:e=>{const t=this._getNodeInternal(e),s=this._getPage(e);if(t==null||s==null)return[];const n=[];for(let r=t.childOffset;r0?i/e|0:0}function E(i,e){return i<0?-i-1:e===0?i:i%e}function Ne(i,e,t){return e===-1?-(i+1):t===0?i:e*t+i}const vs=[["maxScreenThreshold",L.MaxScreenThreshold],["screenSpaceRelative",L.ScreenSpaceRelative],["removedFeatureDiameter",L.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",L.DistanceRangeFromDefaultCamera]];function Ns(i){if(i){for(let e=0;e0&&this._removeChildrenRecursive(e),!0;const h=o.isNodeLoaded(r);if(n&&h&&d){const b=!s&&this.hasNoVisibleChildren(e);o.fadeNode(r,pe.FadeIn,!b)}const u=h&&(!o.isNodeFullyFadedIn||o.isNodeFullyFadedIn(r));if(h&&(o.updateNodeState(r,d?ne.Leaf:ne.Hole),d))return u&&this._removeChildrenRecursive(e),u;const _=e.childCount>0;let m=_;if(_)for(let b=0;b((this._layerView.isNodeLoaded(t.index)||this._layerView.isNodeReloading(t.index))&&G.push(t.index),t.childrenLoaded>0))}hasNoVisibleChildren(e){let t=!0;return this._index.traverseChildren(e,s=>!(!t||!this._index.isNodeVisible(s.index))&&(this._layerView.isNodeLoaded(s.index)?(t=!1,!1):s.childrenLoaded>0)),t}_childrenRequireLoading(e){let t=!1,s=!0;return this._index.traverseChildren(e,n=>{if(!s||!this._index.isNodeVisible(n.index))return!1;const r=this._index.nodeTraversalState(n);return this._isChosenMaxLOD(r)&&this._index.isGeometryVisible(n.index)&&(t=!0),this._layerView.isNodeLoaded(n.index)?(s=!1,!1):n.childrenLoaded>0}),s&&t}_isChosenMaxLOD(e){return e.isChosen&&(!e.nodeHasLOD||e.lodLevel===this._maxLodLevel)}};const G=new $({deallocator:null});class _e{constructor(e,t){this._textureRep=e,this.loadPromise=null,this._disposed=!1;const s=this._textureRep.acquire(t);ni(s)?(s.then(n=>{this._disposed?nt(n):this._textureRef=n}),this.loadPromise=s):this._textureRef=s}dispose(){this._textureRef=nt(this._textureRef),this._disposed=!0}get glTexture(){return this._textureRef!=null?this._textureRef.glTexture:null}}function Ms(i,e){const t=new Map,s=(m,g)=>{if(m==null)return-1;const p=t.get(m.id);if(p)return p.usage|=g,p.id;const b=t.size;return t.set(m.id,{id:b,usage:g}),b},n=e.pbrMetallicRoughness,r=n==null?void 0:n.baseColorFactor,a=e.emissiveFactor,o=Pt({normalTexture:e.normalTexture,emissiveTexture:e.emissiveTexture,emissiveFactor:e.emissiveFactor,occlusionTexture:e.occlusionTexture,metallicRoughnessTexture:n==null?void 0:n.metallicRoughnessTexture,metallicFactor:n==null?void 0:n.metallicFactor,roughnessFactor:n==null?void 0:n.roughnessFactor}),l=o?fe[0]:(n==null?void 0:n.metallicFactor)??ze[0],d=o?fe[1]:(n==null?void 0:n.roughnessFactor)??ze[1],c=e.alphaMode==="mask"?w.Color|w.AlphaMask:w.Color,h={baseColorFactor:r?[r[0],r[1],r[2],r[3]]:[1,1,1,1],baseColorTextureId:s(n==null?void 0:n.baseColorTexture,c),metallicRoughnessTextureId:s(n==null?void 0:n.metallicRoughnessTexture,w.MetallicRoughness),metallicFactor:l,roughnessFactor:d},u={alphaMode:e.alphaMode,alphaCutoff:e.alphaCutoff,doubleSided:e.doubleSided,cullFace:e.cullFace==="none"?A.None:e.cullFace==="back"?A.Back:e.cullFace==="front"?A.Front:A.None,normalTextureId:s(e.normalTexture,w.Normal),emissiveTextureId:s(e.emissiveTexture,w.Emissive),occlusionTextureId:s(e.occlusionTexture,w.Occlusion),emissiveFactor:a?[a[0],a[1],a[2]]:[0,0,0],metallicRoughness:h,wrapTextures:!1,hasParametersFromSource:o},_=[];return t.forEach(({usage:m},g)=>{const p=i!=null&&i[g]&&i[g].formats,b=p?$t(p.map(({name:f,format:y})=>({name:f,encoding:Os[y]}))):[];_.push({id:g,usage:m,encodings:b})}),{material:u,textures:_}}function $t(i){return i.sort((e,t)=>e.encoding-t.encoding)}const Os={ktx2:C.KTX2,basis:C.Basis,dds:C.DDS_S3TC,png:C.PNG,jpg:C.JPG,"ktx-etc2":C.KTX_ETC2},Nt={[ae.KTX2_ENCODING]:C.Basis,[ae.BASIS_ENCODING]:C.Basis,[ae.DDS_ENCODING]:C.DDS_S3TC,"image/png":C.PNG,"image/jpg":C.JPG,"image/jpeg":C.JPG,"image/ktx":C.KTX_ETC2};function Ls(i){var o,l;const e=i!=null&&i.materialDefinitions?Object.keys(i.materialDefinitions)[0]:null,t=i!=null&&i.textureDefinitions?Object.keys(i.textureDefinitions)[0]:null,s=e?(o=i.materialDefinitions)==null?void 0:o[e]:null,n=t?(l=i.textureDefinitions)==null?void 0:l[t]:null,r=Rs();if(s!=null){const d=s.params;d.diffuse&&(r.metallicRoughness.baseColorFactor=[d.diffuse[0],d.diffuse[1],d.diffuse[2],1]),d.doubleSided!=null&&(r.doubleSided=d.doubleSided,r.cullFace=d.doubleSided?A.None:A.Back),d.cullFace!=="none"&&d.cullFace!=="front"&&d.cullFace!=="back"||(r.cullFace=d.cullFace==="none"?A.None:d.cullFace==="back"?A.Back:A.Front),d.transparency&&(r.metallicRoughness.baseColorFactor[3]=Rt(1-d.transparency,0,1)),(d.useVertexColorAlpha||r.metallicRoughness.baseColorFactor[3]<1)&&(r.alphaMode="blend")}const a=[];if(n!=null){!n.wrap||n.wrap[0]!=="repeat"&&n.wrap[1]!=="repeat"||(r.wrapTextures=!0);let c=w.Color;n.channels==="rgba"&&(r.alphaMode="blend",c|=w.AlphaMask);const h=n.images.length-1,u=n.images[h],_=g=>g==null?void 0:g.split("/").pop(),m=Array.isArray(n.encoding)?$t(n.encoding.map((g,p)=>({name:_(u.href[p]),encoding:Nt[g]||0}))):[{name:_(u.href),encoding:Nt[n.encoding]||0}];a.push({id:0,usage:c,encodings:m}),r.metallicRoughness.baseColorTextureId=0}return{material:r,textures:a}}const Rs=()=>({alphaMode:"opaque",alphaCutoff:At,doubleSided:!0,cullFace:A.None,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function cn(i,e,t,s){if((i==null?void 0:i.data)==null)return null;const n=i.data,r=s.renderingContext.parameters.maxMaxAnisotropy,a=r>1,o=t||!e.wrapTextures?As:Fs,l=Ts(i.encoding),d=i.usage&w.Color?e.alphaMode==="opaque"?3:4:3;return new ri(n,{mipmap:a,maxAnisotropy:r,encoding:l,wrap:o,components:d,noUnpackFlip:!0})}const As={s:Se.CLAMP_TO_EDGE,t:Se.CLAMP_TO_EDGE},Fs={s:Se.REPEAT,t:Se.REPEAT};function _n(i,e,t,s,n,r){const a=r.rendererTextureUsage,o=p=>$s(s,t,p&a),l=e.metallicRoughness.baseColorFactor,d=Rt(e.metallicRoughness.baseColorFactor[3],0,1);i.baseColor=[l[0],l[1],l[2],d],i.hasParametersFromSource=!!e.hasParametersFromSource,i.usePBR=r.usePBR,i.mrrFactors=[e.metallicRoughness.metallicFactor,e.metallicRoughness.roughnessFactor,e.hasParametersFromSource?fe[2]:ze[2]],i.emissiveFactor=e.emissiveFactor,i.isIntegratedMesh=r.isIntegratedMesh,i.textureAlphaCutoff=e.alphaMode==="mask"?e.alphaCutoff:At,i.alphaDiscardMode=e.alphaMode==="opaque"?Le.Opaque:e.alphaMode==="mask"?Le.Mask:Le.MaskBlend;const c=[],h=o(w.Color|w.AlphaMask);h!=null&&(i.baseColorTexture=new _e(n,h),c.push(i.baseColorTexture.loadPromise));const u=o(w.MetallicRoughness);u!=null&&(i.metallicRoughnessTexture=new _e(n,u),c.push(i.metallicRoughnessTexture.loadPromise));const _=o(w.Emissive);_!=null&&(i.emissionTexture=new _e(n,_),c.push(i.emissionTexture.loadPromise));const m=o(w.Occlusion);m!=null&&(i.occlusionTexture=new _e(n,m),c.push(i.occlusionTexture.loadPromise));const g=o(w.Normal);return g!=null&&(i.normalTexture=new _e(n,g),c.push(i.normalTexture.loadPromise)),i.commonMaterialParameters.hasSlicePlane=r.slicePlaneEnabled,i.commonMaterialParameters.doubleSided=e.doubleSided,i.commonMaterialParameters.cullFace=e.cullFace,i.ellipsoidMode=ai(r.viewSpatialReference),Promise.all(c)}function gn(i){const e=!!i.compressedTextureS3TC,t=!!i.compressedTextureETC,s=Ze("disable-feature:i3s-basis")?0:C.Basis|C.KTX2,n=C.JPG|C.PNG,r=s|C.DDS_S3TC;return n|(e?r:0)|(t?s:0)}function Es(i,e){if(e!=null)return i.find(t=>(t.encoding&e)!=0)}function $s(i,e,t){if(i==null||t===w.None)return null;for(let s=0;sMs(o,l))}}_load(e,t,s){return this._streamDataController.request(e,t,s)}_loadAttribute(e,t,s){const n=`${this._layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(n,"binary",s).then(r=>oi(t,r))}async loadAttributes(e,t,s){const n=await Promise.allSettled(t.map(a=>this._loadAttribute(e,a.attributeStorageInfo,s))),r={};for(let a=0;a=0?this._materialAndTextures[d]:l!=null?Ls(l):null,h=c==null?void 0:c.material,u=(c==null?void 0:c.textures)??[],_=`${e.id}`,m=!a&&this._options.loadFeatureData,g=m?await this._loadFeatureData(_,t):null,p=m?Gs(g):Vs(h),b=p==null?ks(g):null,f=u.length>0?Ie(this.loadTextures(e,u,t)):null;let y=null,N=null;if(o){y=Re(await o);const F=Us(this._defaultGeometrySchema,l);N=di(n,F)}const S=f?Re(await f):null,I=s?Re(await s):{},M=I?{attributeData:I,loadedAttributes:this._requiredAttributes}:null;if(p!=null)return{geometryData:p,attributeDataInfo:M,geometryBuffer:y,geometryDescriptor:N,requiredTextures:u,textureData:S};if(b!=null)return{pointData:b,attributeDataInfo:M,geometryBuffer:y,geometryDescriptor:N,requiredTextures:u,textureData:S};throw new Error}static _addAbsoluteHrefTexture(e,t){const s=e.textureDefinitions;if(s!=null)for(const n of Object.keys(s))for(const r of s[n].images)Array.isArray(r.href)?r.hrefConcat=r.href.map(a=>rt(a,t)):r.hrefConcat=rt(r.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(t!=null)for(const s in t){const n=t[s];if(Array.isArray(n.encoding))for(let r=0;r(De._fixTextureEncodings(n),De._addAbsoluteHrefTexture(n,s),n))}_loadTexture(e,t,s,n,r,a){let o=!1;return r===C.DDS_S3TC||r===C.KTX2||r===C.Basis?this._load(e,"binary",a).then(l=>({id:t,usage:s,data:l,encoding:r,downsampled:o})):this._load(e,"image",a).then(l=>{let d=l;const c=4096,h=2;if(n&&l.width*l.height>=c){const u=Math.ceil(l.width/h),_=Math.ceil(l.height/h),m=document.createElement("canvas");m.width=u,m.height=_,m.getContext("2d").drawImage(l,0,0,u,_),d=m,o=!0}return{id:t,usage:s,data:d,encoding:r,downsampled:o}})}loadTextures(e,t,s){const n=!!this._options.uncompressedTextureDownsamplingEnabled,r=this._options.textureUsageMask;return Promise.all(t.map(a=>{if(!(a.usage&r))return null;const o=Es(a.encodings,this._options.textureEncodings);if(o==null)return this._logger.error("#loadTextures",this._logLayer,`No known encoding for texture found on node ${e.id}`),Promise.reject();const l=e.resources.texture||e.id,d=`${this._layerUrl}/nodes/${l}/textures/${o.name}`;return this._loadTexture(d,a.id,a.usage,n,o.encoding,s)}))}_loadFeatureData(e,t){const s=`${this._layerUrl}/nodes/${e}/features/0`;return this._load(s,"json",t)}_loadGeometry(e,t,s){const n=`${this._layerUrl}/nodes/${e}/geometries/${t}`;return this._load(n,"binary",s)}}function Vs(i){return{featureIds:[],geometries:[{type:"ArrayBufferView",params:{material:i}}],featureDataPosition:[0,0,0]}}function Gs(i){if(!i)return null;for(const e of i.featureData){const t=e.geometries;if(t!=null)for(const s of t)return{featureIds:[e.id],featureDataPosition:e.position,geometries:[s]}}return null}function ks(i){if(!i)return null;const e=new Array;for(const t of i.featureData)t.position!=null&&e.push({featureIds:[t.id],featureDataPosition:t.position,geometries:[]});return e}function Us(i,e){if(!i||!(e!=null&&e.materialDefinitions))return i;const t=Object.keys(e.materialDefinitions)[0];return!e.materialDefinitions[t].params.vertexRegions&&i.vertexAttributes.region&&delete(i=hi(i)).vertexAttributes.region,i}function js(i,e){const t={bufferDefinition:null,bufferIndex:0},s=e.resources.geometryDefinition;if(i==null||s==null||s<0)return t;const n=s>=0?i[s].geometryBuffers:null;if(n==null)return t;for(let r=0;rn.abort()),a={signal:n.signal,query:{token:this._apiKey}},o=this._requester.request(e,t,a),l={response:o,abortController:n,abortHandle:r};return this._activeRequests.add(l),ci(o,()=>{var d;l.abortController=null,(d=l.abortHandle)==null||d.remove(),l.abortHandle=null,this._activeRequests.delete(l)}),o}cancelAll(){this._activeRequests.forEach(e=>{var t,s;(t=e.abortController)==null||t.abort(),e.abortController=null,(s=e.abortHandle)==null||s.remove()}),this._activeRequests.clear()}}const It=1e5;class qs{constructor(e,t,s,n,r,a,o,l,d={}){this._indexSR=e,this._renderCoordsHelper=t,this._clippingArea=r,this._elevationProvider=a,this._viewingMode=o,this._options=d,this._frustum=_i(),this._useFrustumCulling=!1,this._poi=Z(),this._elevationContext=null,this.minDistance=1/0,this.maxDistance=0,this.maxLodLevel=2,this._tmpObb=at(),this._tmp1=Z(),this._tmp2=Z(),this._tmp3=Z(),this._tmp0=Z(),this._screenspaceErrorBias=d.screenspaceErrorBias||1,this._progressiveLoadFactor=d.progressiveLoadFactor||1,this.updateCamera(s,n),this.engineSR=this._renderCoordsHelper.spatialReference,this.updateElevationInfo(l),this._tmpPoint=Ft(0,0,0,e),this._isECEFOBBInLocalMode=this._indexSR.isWGS84&&(this.engineSR.isWebMercator||gi(this.engineSR)),this._indexSREllipsoidRadius=mi(this._indexSR).radius}updateElevationInfo(e){e!=null?(this._elevationContext=fi.fromElevationInfo(e),this._elevationContext.updateFeatureExpressionInfoContext(pi(bi(e,!1)))):this._elevationContext=null}updateCamera(e,t){this._useFrustumCulling=t,t&&yi(e.viewMatrix,e.projectionMatrix,this._frustum),this._screenSizeFactor=1/(e.perScreenPixelRatio/2),this._camPos=e.eye,this.minDistance=1/0,this.maxDistance=0}setPointOfInterest(e){this._poi=e}updateScreenSpaceErrorBias(e){const t=this._screenspaceErrorBias;return this._screenspaceErrorBias=e,t}updateClippingArea(e){this._clippingArea=e}expandElevationRange(e,t,s){var h,u;if(this._elevationContext==null)return;const n=e.mbs;if(!n)return;if(this._elevationProvider.getSphereElevationBounds){const _=this._elevationProvider.getSphereElevationBounds(n,this._indexSR);return void(_&&oe(s,_.min,_.max))}const r=n[0],a=n[1],o=n[2],l=this._elevationContext.mode==="relative-to-scene"?"scene":"ground",d=this._elevationProvider.getElevation(r,a,o,this._indexSR,l);d&&oe(s,d,d);const c=t?null:(u=(h=this._elevationProvider).getRootElevationBounds)==null?void 0:u.call(h);c&&oe(s,c.min,c.max)}getRenderMbs(e){const t=e.renderMbs;if(xi(t))return t;e.mbs&&vi(t,e.mbs);const s=e.elevationRangeMin;if(this._elevationContext&&Number.isFinite(s)){let n=0,r=0;const a=e.elevationRangeMax;switch(this._elevationContext.mode){case"relative-to-ground":n=this._elevationContext.geometryZWithOffset(t[2],this._renderCoordsHelper)+s-t[2],r=a-s;break;case"on-the-ground":n=s-t[2],r=a-s}t[2]+=n+.5*r,t[3]+=.5*r}else this._elevationContext&&t[3]n>s)?null:(e.serviceObbInRenderSR=this._computeRenderObb(t,e.serviceObbInRenderSR,e.mbs[3],e.elevationRangeMin,e.elevationRangeMax),e.serviceObbInRenderSR)}_computeRenderObb(e,t,s,n,r){if(t==null)t=at();else if(lt(t))return t;let a=0,o=0;if(this._elevationContext&&!Number.isNaN(n)&&Number.isFinite(n))switch(this._elevationContext.mode){case"relative-to-ground":a=this._elevationContext.geometryZWithOffset(e.center[2],this._renderCoordsHelper)+n-e.center[2],o=r-n;break;case"on-the-ground":a=n-e.center[2],o=r-n}else this._elevationContext&&s0?(dt(e,this._indexSR,this._tmpObb,this.engineSR,a),Ni(this._tmpObb,0,o,this._viewingMode,t)):dt(e,this._indexSR,t,this.engineSR,a),t}isNodeVisible(e){const t=this.getRenderMbs(e);if(!this._isMBSinClippingArea(t))return!1;if(!this._useFrustumCulling)return!0;const s=this._getVisibilityObb(e);return s?ht(s,this._frustum):Ci(this._frustum,Ii(t))}isGeometryVisible(e){if(!this._useFrustumCulling)return!0;const t=e.geometryObb;return t!=null?ht(t,this._frustum):this.isNodeVisible(e)}_isMBSinClippingArea(e){return this._clippingArea==null||wi(this._clippingArea,e)!==Si.OUTSIDE}_screenSpaceDiameterMbs(e,t){const s=this.getRenderMbs(e),n=Math.sqrt(ut(s,this._camPos)),r=n-s[3];return this._updateMinMaxDistance(n),r<0?.5*Number.MAX_VALUE:t/r*this._screenSizeFactor}calcCameraDistance(e){return this.calcCameraDistanceToCenter(e)-this.getRenderMbs(e)[3]}calcCameraDistanceToCenter(e){const t=this.getRenderMbs(e),s=le(t,this._camPos);return this._updateMinMaxDistance(s),s}calcAngleDependentLoD(e){const t=this.getRenderMbs(e),s=t[3],n=(Math.abs(t[0]*(t[0]-this._camPos[0])+t[1]*(t[1]-this._camPos[1])+t[2]*(t[2]-this._camPos[2]))/te(t)+s)/le(t,this._camPos);return Math.min(1,n)}hasLOD(e){return e.lodMetric!==L.None}_getDistancePlanarMode(e,t){const s=e[0]-t[0],n=e[1]-t[1],r=e[2]-t[2],a=s*s+n*n,o=t[3];if(a<=o*o)return Math.abs(r);const l=Math.sqrt(a)-o;return Math.sqrt(r*r+l*l)}_getDistanceGlobeMode(e,t){const s=te(t),n=te(e)-s;de(this._tmp0,e,Ae(e,t)/Di(e));const r=ut(t,this._tmp0),a=t[3];if(r<=a*a)return Math.abs(n);{const o=de(this._tmp0,t,1/s),l=s,d=a*a/2/l,c=de(this._tmp1,o,l-d),h=e,u=Fe(this._tmp2,h,c),_=Fe(this._tmp2,u,de(this._tmp3,o,Ae(o,u))),m=Pi(this._tmp2,c,de(this._tmp2,_,a/te(_)));let g=le(h,m);if(n>=2e5){const p=Fe(this._tmp1,h,m);let b=Ae(p,o)/te(p);b<.08&&(b=1e-4),g/=b}return g}}_getDistance(e,t){return this.engineSR===Mi(this.engineSR)?this._getDistanceGlobeMode(e,t):this._getDistancePlanarMode(e,t)}_updateMinMaxDistance(e){e>0?(this.minDistance=Math.min(this.minDistance,e),this.maxDistance=Math.max(this.maxDistance,e)):(this.minDistance=0,this.maxDistance=Math.max(this.maxDistance,-e))}getLodLevel(e){if(e.lodMetric===L.None)return 0;if(e.childCount===0)return this.maxLodLevel;if(this._useFrustumCulling&&this._progressiveLoadFactor<1){const t=this._progressiveLoadFactor*this._screenspaceErrorBias,s=this._screenspaceErrorBias;return this.evaluateLODmetric(e,t)?this.evaluateLODmetric(e,s)?2:1:0}return this.evaluateLODmetric(e,this._screenspaceErrorBias)?this.maxLodLevel:0}evaluateLODmetric(e,t){switch(e.lodMetric){case L.ScreenSpaceRelative:{const s=this.getRenderMbs(e),n=this._getDistance(this._camPos,s),r=2*n/this._screenSizeFactor,a=n+s[3];return this._updateMinMaxDistance(a),e.maxError*t<=r}case L.MaxScreenThreshold:{let s=this._screenSpaceDiameterMbs(e,e.mbs[3]*t);return this._options.angleDependentLoD&&(s*=this.calcAngleDependentLoD(e)),se.maxError*t}return!1}distToPOI(e){const t=this.getRenderMbs(e);return le(t,this._poi)-t[3]}distCameraToPOI(){return le(this._camPos,this._poi)}}const Tt="esri.layers.graphics.controllers.I3SOnDemandController",Y=Qe.getLogger(Tt),Bs=100,wt=2,St=1e4,qe=1e-4,Hs=1.2,zs=500,Qs=1.5;let D=class extends Oi(Ye){get isMeshPyramid(){var i;return this.layer.profile==="mesh-pyramids"||((i=this.layer.store)==null?void 0:i.lodType)==="MeshPyramid"}get isGraphics3D(){return this.layer.profile==="points"}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(this.layer.priority==null||this.layer.priority==="High")}get indexStreamController(){const i=this.layerView.view.resourceController.createStreamDataRequester(ct.I3S_INDEX);return new Ct(i,this.layer.apiKey)}get dataStreamController(){const i=this.layerView.view.resourceController.createStreamDataRequester(ct.I3S_DATA);return new Ct(i,this.layer.apiKey)}get crsVertex(){return Li(this.layer)}get crsIndex(){return Ri(this.layer)}get layer(){return this.layerView.i3slayer}get running(){return this.updating}get rootNodeVisible(){if(this._index){const i=this._index.rootNode;if(i)return this._updateViewData(),this._index.isNodeVisible(i.index)}return!0}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(i){super(i),this.screenSizeFactor=0,this.featureTarget=5e4,this.fixedFeatureTarget=!1,this.updating=!0,this.updatingProgress=1,this.leavesReached=!1,this.scaleVisibilityEnabled=!0,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._idleStateCallbacks=null,this._newLoadingNodes=new $({deallocator:null}),this._loadedNodeScales=new Map,this._modificationsNodeFilteringArray=new $,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new Ai,this._elevationUpdateNodes=new $({deallocator:null}),this._errorCount=0}initialize(){const{layerView:i,layer:e}=this;this._disableMemCache=!i.loadCachedGPUData||!i.addCachedGPUData,this._lodHandling=new Ps(i),this._defaultGeometrySchema=e.store.defaultGeometrySchema,this.disableIDBCache=Ze("disable-feature:idb-cache"),"fields"in e&&(this._fields=e.fields,this._attributeStorageInfo=e.attributeStorageInfo),this.addResolvingPromise(Promise.all([e.indexInfo,e.when(),i.when()]).then(([t])=>{if(this.destroyed||!i||i.destroyed||!t)return;const{view:s,clientGeometry:n}=i,{resourceController:r}=s;if(this._setClippingArea(s.clippingArea),this.addHandles([R(()=>{var a,o;return(o=(a=s==null?void 0:s.pointsOfInterest)==null?void 0:a.focus)==null?void 0:o.renderLocation},a=>this._pointOfInterestChanged(a),Je),R(()=>s.quality,()=>this._setCameraDirty(),Fi),R(()=>i.contentVisible,a=>{const o=a?()=>this._updateIdleState(!0):()=>this._updateViewData(),l=a?()=>this._updateIdleState(!1):()=>{};a&&this._index!=null&&this._index.invalidateAllElevationRanges(),this._idleStateCallbacks?(a||this.cancelNodeLoading(),this.restartNodeLoading(),this._idleStateCallbacks.idleBegin=o,this._idleStateCallbacks.idleEnd=l):this._idleStateCallbacks=r.scheduler.registerIdleStateCallbacks(o,l)},Je),bs(i.view.resourceController.scheduler,this),R(()=>i.uncompressedTextureDownsamplingEnabled,()=>this.restartNodeLoading()),R(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),R(()=>{var a;return(a=s.state)==null?void 0:a.contentCamera},()=>this._setCameraDirty()),R(()=>e.elevationInfo,a=>this._elevationInfoChanged(a)),R(()=>e.effectiveScaleRange,()=>this._scaleBoundsChanged()),R(()=>i.lodFactor,()=>this._setCameraDirty()),R(()=>i.availableFields,()=>this._requiredFieldsChange()),R(()=>i.holeFilling,a=>this._index!=null&&(this._index.holeFilling=a))]),this._updateScaleHandles(),this._viewportQueries=new qs(this.crsIndex,s.renderCoordsHelper,s.state.contentCamera,!s.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?s.basemapTerrain:s.elevationProvider,Ei(s.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new hs(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:s.renderCoordsHelper.spatialReference,localMode:s.viewingMode==="local"},s.resourceController.memoryController,this.worker),this._index=new ys(e,t,this.indexStreamController,this._clientNodeLoader,this._viewportQueries,Y,i.holeFilling,a=>i.isNodeLoaded(a),a=>i.isNodeReloading(a),a=>this._shouldLoadNode(a),a=>this._enableFromGPUCache(a,ne.Leaf),a=>this._needsUpdate(a),()=>!this.indexStreamController.busy,a=>i.computeVisibilityObb?i.computeVisibilityObb(a):null,i!=null&&i.computeNodeFiltering?a=>i.computeNodeFiltering(a):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!i.hasModifications),this._index.layerFilterChanged(!!i.hasGeometryFilter),n!=null){for(const a of n)this._addMesh(a.mesh,a.oid);this.addHandles(n.on("change",a=>{for(const o of a.removed)this._removeMesh(o.oid);for(const o of a.added)this._addMesh(o.mesh,o.oid)}))}this._startNodeLoading()})),this._tmpPoint=Ft(0,0,0,this.crsIndex)}updateNodeModificationStatus(i){const e=this._index,t=this.layerView;e!=null&&(t!=null&&t.updateNodeModificationStatus)&&(this._modificationsNodeFilteringArray.clear(),i.forAll(s=>{const n=e.getNode(s);n!=null&&this._modificationsNodeFilteringArray.push(n)}),t.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._idleStateCallbacks&&(this._isIdle=!1,this._idleStateCallbacks.remove(),this._idleStateCallbacks=null),this._nodeLoader=null,V.prune(),Be!=null&&(Be.hide(),Be=null)}_getRequiredAttributes(){if(this._attributeStorageInfo==null||!this._fields||!this.layerView.availableFields)return[];const i=this._attributeStorageInfo,e=this._fields,t=this.layer.objectIdField;return this.layerView.availableFields.map(s=>{const n=Ke(i,s),r=Ke(e,s);return n>=0&&r>=0?{index:n,name:e[r].name,field:e[r],attributeStorageInfo:i[n]}:null}).filter(s=>s!=null&&s.name!==t)}_requiredFieldsChange(){const i=this._getRequiredAttributes();He(this._requiredAttributes,i)||(this._requiredAttributes=i,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(i){const e=Et();$i(i,e,this.layerView.view.renderSpatialReference)?this._clippingArea=e:this._clippingArea=null}_pointOfInterestChanged(i){this._viewportQueries!=null&&(this._viewportQueries.setPointOfInterest(i),this._index!=null&&(this._index.progressiveLoadPenalty=Dt.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(i){this._setClippingArea(i),this._viewportQueries!=null&&this._index!=null&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}_addMesh(i,e){if(this._index==null)return;const t=this._clientNodeLoader.createMeshNodeInfo(i,e),s=this._index.addClientNodeToIndex(t.id,t.mbs);this._clientNodeLoader.addMeshNode(s,t),this._evaluateUpdating(),this.notifyChange("rootNodeVisible")}_removeMesh(i){const e=this._clientNodeLoader.getMeshNodeIndex(i);if(e!=null){if(this._index==null)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const t=(n,r)=>{var a,o,l,d;this.layerView.removeNode(r),this._loadedNodeScales.delete(r),this._clientNodeLoader.removeNode(n),this.layerView.deleteCachedNodeData&&n!=null&&this.layerView.deleteCachedNodeData(n),(d=(l=this.layerView).deleteCachedGPUData)==null||d.call(l,(o=(a=this.layerView).loadCachedGPUData)==null?void 0:o.call(a,r))},s=(n,r,a)=>{this._clientNodeLoader.updateNodeIndex(n,r,a),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(r,a)};this._index.removeClientNodeFromIndex(e,t,s),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(i,e){const t=this._index;if((t==null?void 0:t.rootNode)==null||e==null)return null;this.crsIndex.equals(e)||(_t(i,e,Ce,this.crsIndex),i=Ce);const s=this._elevationUpdateNodes;return s.clear(),Ti(i,t.rootNode,t,n=>s.push(n.index)),s.length&&(s.forAll(n=>t.updateElevationChanged(n)),this._setCameraDirty()),s}removeAllGeometryObbs(){this._index!=null&&this._index.removeAllGeometryObbs()}getRenderMbs(i){return this._viewportQueries!=null?this._viewportQueries.getRenderMbs(i):null}_elevationInfoChanged(i){this._index!=null&&(this._index.updateElevationInfo(i,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}_updateScaleHandles(){const i="scale-bounds";this.removeHandles(i),this._areScaleBoundsActive&&this.addHandles(this.layerView.view.basemapTerrain.on("scale-change",e=>this._scaleUpdateHandler(e)),i)}_scaleBoundsChanged(){this._areScaleBoundsActive||this._loadedNodeScales.clear(),this._updateScaleHandles(),this._setCameraDirty()}_scaleUpdateHandler(i){this._updateScaleInBoundingRect(i.extent,i.spatialReference),this._setCameraDirty()}_updateScaleInBoundingRect(i,e){const t=this._index;t!=null&&t.rootNode!=null&&_t(i,e,Ce,this.crsIndex)&&this._loadedNodeScales.forEach((s,n)=>{const r=t.getNode(n);r!=null&&Vi(Ce,r.mbs)&&this._loadedNodeScales.set(n,this._computeScale(r))})}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateUpdating()}schedule(i,e){return this._idleQueue.push(i,e)}reschedule(i,e){return this._idleQueue.unshift(i,e)}get _isIntegratedMesh(){return this.layer.type==="integrated-mesh"}get _areScaleBoundsActive(){const{minScale:i,maxScale:e}=gt(this.layer);return this.scaleVisibilityEnabled&&(i>0||e>0)}get unloadedMemoryEstimate(){return this._index!=null&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(i,e){return i.index<0?this._clientNodeLoader.loadNodeData(i.id,e):this._nodeLoader.loadNodeData(i,e)}async _loadAttributes(i,e,t){return(i.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(i,e,t)}get indexDepth(){return this._index!=null?this._index.maxLevel:0}set disableMemCache(i){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData||(this._disableMemCache=!0),this._disableMemCache=i}runTask(i,e){return this.layerView.contentVisible?this.layerView.visible&&this._index!=null?(this._processWithErrorLogging(i,e),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateUpdating(),-1/0)}_processWithErrorLogging(i,e){try{this._process(i,e)}catch(t){this._errorCount<50?Y.error("Error during processing: "+t):this._errorCount===50&&Y.error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(i,e){this._restartNodeLoading&&this._startNodeLoading(),this._nodeLoader!=null&&this._index!=null&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(i)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(i.enabled=!1),i.run(()=>this._processIndex(i)),this._updateFeatureLOD(),i.run(()=>this._processCache(i)),this._isIntegratedMesh&&(i.enabled=!0),i.run(()=>this._processNodes(i,e)),this._idleQueue.runTask(i),i.run(()=>this._prefetchIndex()),e.numIndexLoading+=this._index.indexLoading,e.numNodesLoading+=this._downloadingCount,i.run(()=>this._lodHandling.lodGlobalHandling(i)),this._evaluateUpdating())}_processIndex(i){if(this._index==null)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),i,t=>this.updateNodeModificationStatus(t)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const e=this._index.featureEstimate.leavesReached;this._index.isLoading||e===this._get("leavesReached")||this._set("leavesReached",e)}return this._index.load()}_prefetchIndex(){return!(this._index==null||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||this._index==null||this._viewportQueries==null)return;const i=!this._index.isLoading,e=this.featureTarget*this._baseLOD,t=this._index.featureEstimate;if(t.estimate=t.estimate||e/2,this._index.indexMissing>zs){if(this._featureLOD<=qe)return;this._featureLOD/=Qs,this._stableFeatureLOD=!1}else if(i&&t.estimate=St||this._stableFeatureLOD)return;const s=Math.min(10,Math.max(e/t.estimate,1.001));this._featureLOD*=s;const n=this._lod,r=this._index.checkFeatureTarget(e,n);r!==n&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(t.estimate>e*Hs||i&&t.estimate>e)||this._featureLOD<=qe)return;this._featureLOD/=1+.25*(t.estimate/e-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(St,Math.max(qe,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(i){const e=this._index;if(e==null)return!1;for(;this._newLoadingNodes.length>0&&!i.done;){const t=this._newLoadingNodes.pop();for(let s=e.getParent(t);s!=null&&!this.layerView.isNodeLoaded(s.index)&&this._isNodeInScaleBounds(s);s=e.getParent(s.index))if(this._enableFromGPUCache(s,ne.Hole)){i.madeProgress();break}}return i.hasProgressed}_processNodes(i,e){if(this._index==null)return!1;let t=(this._isIdle?Bs:wt)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!i.done;)this.layerView.removeNode(s.remove.pop()),i.madeProgress();for(;s.update.length>0&&!i.done;){const n=this._index.getNode(s.update.pop());n!=null&&(this._updateLoadedNode(n),i.madeProgress())}for(;s.add.length>0&&!i.done&&t>0;){--t;const n=this._index.getNode(s.add.back());if(n==null||n.cacheState!==ue.Cached&&!this._hasNodeLoadToken(e))break;s.add.pop(),this._loadNode(n),i.madeProgress()}return i.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(i=>i.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(i=>i.abort()),this._updatingNodes.clear()}_cancelNode(i){const e=this._loadingNodes.get(i);e&&(e.abort(),this._loadingNodes.delete(i))}_hasNodeLoadToken(i){return!(!this._isIdle&&i.numNodesLoading+this._loadingNodes.size>=wt)&&this._downloadingCount0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.running||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||this._index!=null&&this._index.isPrefetching),t===0&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(t,this._progressMaxNumNodes),e=1-t/this._progressMaxNumNodes}else i=this._cameraDirty,e=i?0:1;this.updating=i,this.updatingProgress=e}}_updateViewData(){if(!this._cameraDirty||this._index==null||this._viewportQueries==null)return;const i=this.layerView.view,{contentCamera:e,fixedContentCamera:t}=i.state;this.screenSizeFactor=1/(e.perScreenPixelRatio/2),this._viewportQueries.updateCamera(e,!t||this.isGraphics3D),this._viewportQueries.setPointOfInterest(i.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=Dt.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const i=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(i>0?i:1)*this.layerView.view.quality}get _lodDropFactor(){return this.fixedFeatureTarget?1:(Math.min(this.layerView.view.quality,.5)-mt)/(.5-mt)}isGeometryVisible(i){var e;return!!((e=this._index)!=null&&e.isGeometryVisible(i.index))}updateVisibility(i){var e;(e=this._index)==null||e.invalidateNodeVisibilityCache(i)}invalidateGeometryVisibility(i){var e;(e=this._index)==null||e.invalidateGeometryVisibility(i)}invalidateVisibilityObbs(){var i;(i=this._index)==null||i.invalidateVisibilityObbs()}modificationsChanged(){var i;(i=this._index)==null||i.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(i){return!(!this._lodHandling.shouldLoadNode(i)||this._shouldDropNode(i))&&!(this._index==null||!this._index.isGeometryVisible(i.index))&&this._isNodeInScaleBounds(i)}_shouldDropNode(i){if(this._viewportQueries==null)return!1;const e=this._lodDropFactor;return e>=1||!this._lodHandling.hasNoVisibleChildren(i)?!1:Math.abs(this._viewportQueries.calcCameraDistanceToCenter(i))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*e}_startNodeLoading(){this._restartNodeLoading=!1;const i=this._index;if(this._updatesDisabled||i==null||this._viewportQueries==null)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const e={textureEncodings:this.layerView.supportedTextureEncodings,uncompressedTextureDownsamplingEnabled:this.layerView.uncompressedTextureDownsamplingEnabled,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new De(this.layer,this.dataStreamController,Y,this._defaultGeometrySchema,this._requiredAttributes,e),i.requestUpdate(),this._lodHandling.startNodeLoading(t=>this._isNodeInScaleBounds(t),(t,s)=>this._removeNodes(t,s,re.fadeout),i,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateUpdating()}isNodeLoading(){return this._nodeLoader!=null&&this._index!=null}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateUpdating())}_removeInvisibleNodes(i){const e=this._index;if(e==null||this._viewportQueries==null)return!1;V.clear(),this.layerView.getLoadedNodeIndices(V);const t=this._viewportQueries.maxDistance===0,s=t?()=>!1:n=>this._shouldDropNode(n);return V.filterInPlace(n=>{const r=e.getNode(n);return r==null||!e.isGeometryVisible(n)||s(r)||!this._isNodeInScaleBounds(r)}),V.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(V,i,re.pop),!(t&&this._lodDropFactor<1)&&(V.length===0||(V.clear(),!1))}markNodeToRemove(i){V.push(i)}removeMarkedNodes(){this._removeNodes(V,ki,re.pop)}_removeNodes(i,e,t){const s=i.length;if(s!==0&&!e.done){for(this._index!=null&&this._index.requestUpdate();i.length>0&&!e.done;){const n=i.pop(),r=this._index;t===re.fadeout&&this.layerView.nodeFadeoutEnabled&&r!=null&&r.isGeometryVisible(n)?this.layerView.fadeNode(n,pe.FadeOut,!0):this.layerView.removeNode(n),e.madeProgress()}if(this._loadedNodeScales.size>0)for(let n=i.length;nthis.layerView.updateAttributes(i.index,{loadedAttributes:this._requiredAttributes,attributeData:s},e.signal),e.signal)}catch(t){if(!ie(t))return this.layerView.updateAttributes(i.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},e.signal)}this._updatingNodes.delete(i.index),this._evaluateUpdating()}_loadNode(i){if(this._loadingNodes.has(i.index))return void Y.error("already loading node "+i.index);const e=new AbortController;this._loadingNodes.set(i.index,e),this._evaluateUpdating(),this._loadAndAddNode(i,e.signal).then(t=>{t&&this._index!=null&&this._loadingNodes.get(i.index)===e&&(this._loadingNodes.delete(i.index),this._index.requestUpdate())}).catch(t=>{if(!ie(t))throw t}).finally(()=>{this._loadingNodes.get(i.index)===e&&this._loadingNodes.delete(i.index),this._evaluateUpdating()})}_loadAndAddNode(i,e){return i.cacheState===ue.Uncached?this._loadUncached(i,e).then(()=>!1):this._loadCached(i,e).then(t=>!t&&(i.cacheState=ue.Uncached,!0)).catch(t=>!ie(t)&&(i.cacheState=ue.Uncached,!0))}_enableFromGPUCache(i,e){if(this._disableMemCache||this._index==null)return!1;if(e===ne.Hole&&!this._index.useNodeAsHole(i.index))return!0;const t=this._loadCachedGPUData(i);return!!t&&(this.layerView.addCachedGPUData(i,t,e),this._nodeAdded(),!0)}_loadCachedGPUData(i){const e=this.layerView.loadCachedGPUData(i.index);return(e==null?void 0:e.attributeInfo)!=null&&He(e.attributeInfo.loadedAttributes,this._requiredAttributes)?e:(this.layerView.deleteCachedGPUData(e),null)}_nodeAdded(){this._index!=null&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating()}updateLoadStatus(i,e){const t=this._index;t!=null&&t.updateChildrenLoaded(i,e?1:-1)}async _loadCached(i,e){if(this._enableFromGPUCache(i,ne.Leaf))return!0;const t=this.layerView;if(this.disableIDBCache||!t.loadCachedNodeData||!t.addCachedNodeData)return!1;const s=(d,c)=>this._nodeLoader.loadTextures(i,d,c),n=(d,c)=>this._clientNodeLoader.loadTextures(i,d,c),r=i.index>=0?s:n,a=await this.schedule(()=>t.loadCachedNodeData(i,e,r),e);if(a==null)return!1;const o=this._requiredAttributes,l=await this.reschedule(()=>this._loadAttributes(i,o,e),e);return await this.reschedule(()=>t.addCachedNodeData(i,a,{loadedAttributes:o,attributeData:l},e),e),this._nodeAdded(),!0}_loadUncached(i,e){return this._downloadingCount++,this._loadNodeData(i,e).catch(t=>{throw this._downloadingCount--,t}).then(t=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(i,t,e),e))).then(()=>{this._nodeAdded(),i.cacheState=ue.Cached}).catch(t=>{if(!ie(t))throw Y.error("#loadNodeData()",this.layer,`Failed to load node '${i.id}'`,t),i.failed=!0,this._index!=null&&this._index.requestUpdate(),t})}_updateIdleState(i){i!==this._isIdle&&(this._isIdle=i,this._evaluateUpdating(),i&&this._index&&this._index!=null&&this._index.resetFailedNodes())}_getScale(i){if(this._loadedNodeScales.has(i.index))return this._loadedNodeScales.get(i.index);const e=this._computeScale(i);return this.layerView.isNodeLoaded(i.index)&&this._loadedNodeScales.set(i.index,e),e}_computeScale(i){this._tmpPoint.x=i.mbs[0],this._tmpPoint.y=i.mbs[1],this._tmpPoint.z=i.mbs[2];const e=i.mbs[3];return this.layerView.view.basemapTerrain.getSphereScale(this._tmpPoint,e)}_isNodeInScaleBounds(i){if(!this._areScaleBoundsActive)return!0;const e=this._getScale(i),{minScale:t,maxScale:s}=gt(this.layer);return Ui(e,t,s)}updateStats(i){var e;this.isGraphics3D&&(i.detail=this._featureLOD,i.target=this.featureTarget*this._baseLOD),(e=this._index)==null||e.updateStats(i)}get test(){const i=this;return{index:this._index,set disableUpdates(e){i._updatesDisabled=e,e?i.cancelNodeLoading():i.requestUpdate()},set disableIDBCache(e){i.disableIDBCache=e},set ignoreServiceObb(e){i._index!=null&&(i._index.ignoreServiceObb=e)},shouldLoadNode:e=>i._shouldLoadNode(e)}}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateUpdating(),this._index!=null&&this._index.requestUpdate()}geometryFilterChanged(i){const e=this._index;e!=null&&e.layerFilterChanged(i),this._setCameraDirty()}};x([v({readOnly:!0})],D.prototype,"isMeshPyramid",null),x([v({readOnly:!0})],D.prototype,"isGraphics3D",null),x([v({readOnly:!0})],D.prototype,"useMaximumNumberOfFeatures",null),x([v({readOnly:!0})],D.prototype,"indexStreamController",null),x([v({readOnly:!0})],D.prototype,"dataStreamController",null),x([v({readOnly:!0})],D.prototype,"crsVertex",null),x([v({readOnly:!0})],D.prototype,"crsIndex",null),x([v()],D.prototype,"screenSizeFactor",void 0),x([v()],D.prototype,"featureTarget",void 0),x([v()],D.prototype,"fixedFeatureTarget",void 0),x([v()],D.prototype,"layerView",void 0),x([v()],D.prototype,"layer",null),x([v()],D.prototype,"updating",void 0),x([v({readOnly:!0})],D.prototype,"running",null),x([v()],D.prototype,"updatingProgress",void 0),x([v({readOnly:!0})],D.prototype,"leavesReached",void 0),x([v({constructOnly:!0})],D.prototype,"scaleVisibilityEnabled",void 0),x([v({constructOnly:!0})],D.prototype,"worker",void 0),x([v({readOnly:!0,dependsOn:[]})],D.prototype,"rootNodeVisible",null),D=x([Xe(Tt)],D);const V=new $({deallocator:null});let Be;function He(i,e){return i!=null&&i.length===e.length&&i.every(t=>Ke(e,t.name)>=0)}function Ke(i,e){const t=e.toLowerCase();for(let s=0;s{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null}),this.is3DOFL&&this._associatedLayer!=null&&(Ee()?this._associatedLayer.load().then(e=>{this.destroyed||(this._original3DOFLDefinitionExpression=e.definitionExpression,this.addHandles(R(()=>this._definitionExpression,t=>e.definitionExpression=t,Je)),this._associatedLayerView=new rs({layer:this._associatedLayer,view:this.view}))}):ee())}destroy(){this.is3DOFL&&this._associatedLayer!=null&&(Ee()?this._associatedLayerView!=null&&(this._associatedLayer.definitionExpression=this._original3DOFLDefinitionExpression):ee()),this._set("layer",null),this._memCache=ji(this._memCache),this._pendingFetchAbortController=qi(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){var i;return Bi()&&((i=this._associatedLayer)==null?void 0:i.infoFor3D)!=null}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((i,e)=>i-e):[]}get _associatedLayer(){return this.layer==null?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get _definitionExpression(){const i=this.sortedGeometryChangedObjectIds;return i.length===0?"1 = 0":`OBJECTID IN (${i.join(",")})`}get updating(){return this.is3DOFL?this._pendingFetchChangedObjectIds?!0:Ee()?this._associatedLayerView==null||this._associatedLayerView!=null&&this._associatedLayerView.updating:!1:!1}get isEmpty(){return this._pendingFetchChangedObjectIds==null&&this._attributeChangedObjectIds.size===0&&this._geometryChangedObjectIds.size===0}featureHasGeometryChanges(i){return this._geometryChangedObjectIds.has(i)}featureHasAttributeChanges(i){return this._attributeChangedObjectIds.has(i)}createInteractiveEditSession(i){this._attributeChangedObjectIds.add(i);const e=this._interactiveEditingSessions,t=new Js(i,()=>{e.remove(t)});return e.unshift(t),t}async applyAttributeOverrides(i,e,t,s=[]){if(this._pendingFetchChangedObjectIds&&await Hi(this._pendingFetchChangedObjectIds,t),e==null)return;const{attributeData:n,loadedAttributes:r}=e;if(r==null||n==null||this._attributeChangedObjectIds.size===0)return;const a=new Set;for(const l of r)a.add(l.index);for(const l of s)a.has(l.index)||(r.push(l),n[l.name]=new Array(i.length));const o=await this._lockFeatureIds(i);try{const l={attributeData:n,loadedAttributes:r},d=this._getOverridesFromCache(i,l,this._attributeChangedObjectIds),{objectIds:c,fieldNames:h}=d;if(c.length===0||h.length===0)return;const u=await this._queryAttributeOverridesFromAssociatedLayer(c,h,t);if(u==null)return;this._processOverridesFromAssociatedLayer(i,u,h,l)}finally{o.remove()}}updateGeometry(i,e){this._geometryChangedObjectIds.add(i);const t=this._clientGeometryCache.get(i);if(t!=null&&(this.geometryOverrides.remove(t),this._clientGeometryCache.delete(i)),e!=null){const s={oid:i,mesh:e};this.geometryOverrides.add(s),this._clientGeometryCache.set(i,s)}}updateAttributeValue(i,e,t){this._attributeChangedObjectIds.add(i),this._cacheAttributeValue(i,e,t)}featureAdded(i){this.is3DOFL&&ee()&&this._geometryChangedObjectIds.add(i),this._attributeChangedObjectIds.add(i)}_cacheAttributeValue(i,e,t){this._memCache.put(this._getAttributeCacheKey(i,e),t,this._memCacheAttributeValueSize(t))}_getOverridesFromCache(i,{loadedAttributes:e,attributeData:t},s){const n=new Set,r=new Array;for(const o of e)r[o.index]=t[o.name];const a=new Set;for(let o=0;oa-o);const r=Ji(e,n).map(a=>{const o=t.clone();return o.objectIds=a,Ki(Wi(i,o,{signal:s}))});return Promise.all(r)}_processOverridesFromAssociatedLayer(i,e,t,{loadedAttributes:s,attributeData:n}){const r=this._associatedLayer;if(r==null)return;const a=r.objectIdField,o=t.map(h=>(h in n||(n[h]=new Array(i.length)),n[h])),l=new Map(s.map(h=>[h.name,h.index])),d=t.map(h=>l.get(h)),c=new Map(Array.from(i,(h,u)=>[h,u]));for(const h of e){const u=h.attributes[a];for(let _=0;_I-M);for(let I=0;I0){const I=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),i);if(I!=null)for(const M of I)M.geometry!=null&&this.updateGeometry(M.attributes[t.objectIdField],M.geometry)}}}_getFetchChangedObjectIdsServerGen(){var t,s;const i=this.layer;if(((t=i.serviceUpdateTimeStamp)==null?void 0:t.lastUpdate)!=null)return i.serviceUpdateTimeStamp.lastUpdate;const e=i.associatedLayer;return((s=e==null?void 0:e.serverGens)==null?void 0:s.minServerGen)!=null?e.serverGens.minServerGen:null}async _lockFeatureIds(i){const e=this._featureIdLocks;let t=!0;for(;t;){const r=new Array;for(const a of i){const o=e.get(a);o&&r.push(o)}r.length===0?t=!1:await Promise.all(r)}const s=ts(),n=s.promise;for(const r of i)e.set(r,n);return Ot(()=>{for(const r of i)e.delete(r);s.resolve()})}get test(){const i=Array.from(this._attributeChangedObjectIds),e=this._pendingFetchChangedObjectIds,t=this;return{changedObjectIds:i,pendingFetchChangedObjectIds:e,get maximumNumberOfEditOVerrides(){return t._maximumNumberOfEditOVerrides},set maximumNumberOfEditOVerrides(s){t._maximumNumberOfEditOVerrides=s}}}};x([v({constructOnly:!0})],P.prototype,"view",void 0),x([v({constructOnly:!0})],P.prototype,"layer",void 0),x([v({readOnly:!0})],P.prototype,"is3DOFL",null),x([v()],P.prototype,"_interactiveEditingSessions",void 0),x([v({readOnly:!0})],P.prototype,"sortedGeometryChangedObjectIds",null),x([v({readOnly:!0})],P.prototype,"geometryOverrides",void 0),x([v()],P.prototype,"_clientGeometryCache",void 0),x([v()],P.prototype,"_associatedLayer",null),x([v()],P.prototype,"_associatedLayerView",void 0),x([v({constructOnly:!0})],P.prototype,"memoryController",void 0),x([v()],P.prototype,"_attributeChangedObjectIds",void 0),x([v()],P.prototype,"_geometryChangedObjectIds",void 0),x([v()],P.prototype,"hasGeometryChanges",null),x([v()],P.prototype,"_pendingFetchChangedObjectIds",void 0),x([v()],P.prototype,"_pendingFetchAbortController",void 0),x([v()],P.prototype,"_definitionExpression",null),x([v()],P.prototype,"updating",null),x([v()],P.prototype,"isEmpty",null),P=x([Xe(We)],P);class Js{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}const Ks=1e4,Ws=5e4;export{Es as D,cn as F,gn as M,P as S,me as a,pe as b,C as c,Rs as d,mn as e,_n as f,w as s}; diff --git a/dist/assets/I3SQueryFeatureStore-CLo7XXT-.js b/dist/assets/I3SQueryFeatureStore-CLo7XXT-.js deleted file mode 100644 index 838c8ce..0000000 --- a/dist/assets/I3SQueryFeatureStore-CLo7XXT-.js +++ /dev/null @@ -1,7 +0,0 @@ -import{Z as pe,e as c,y as d,dC as ye,c as B,eh as A,p as q,w as he,de as ge,lz as fe,fV as me,mG as Ee,cX as Z,ar as z,e0 as we,e1 as U,mH as Se,mI as _e,ez as be,ce as Re,mJ as Fe,mK as Ie,fm as se,dR as ve,eF as xe,bm as Oe,mL as $e,cf as Qe,i$ as T,at as G,bn as N,as as L,ca as je,n as Me,dT as Ce,E as H,lE as Te,eQ as Ge,lG as X,e_ as K,ae as Ne,K as ke,jL as De,mM as Ae}from"./index-J0iiHjMT.js";import{a as j,n as Y,u as ee}from"./DefinitionExpressionSceneLayerView-oAOUEjm-.js";import{x as Je}from"./WhereClause-XAMIZ4-B.js";import{a as D}from"./I3SOverrides-5dCbMm3h.js";import{W as Pe}from"./QueryEngine-8tLWlkSE.js";import{d as Ve}from"./FeatureSet-d4S1oKME.js";import{n as Le}from"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import{I as C}from"./I3SMeshView3D-OXYwZo0p.js";const ie="esri.views.3d.layers.i3s.I3SMeshViewFilter",$=pe.getLogger(ie);let g=class extends q{constructor(t){super(t),this._projectionEngineLoaded=!1}initialize(){he(()=>{var t;return((t=this.viewFilter)==null?void 0:t.geometry)||this.layerFilter!=null}).then(()=>this.loadAsyncModule(ge(()=>import("./index-J0iiHjMT.js").then(t=>t.zJ),__vite__mapDeps([0,1])).then(t=>{this.destroyed||(this._geometryEngine=t)})))}get sortedObjectIds(){var e;if(((e=this.viewFilter)==null?void 0:e.objectIds)==null)return null;const t=fe(this.viewFilter.objectIds);return t.sort(),t}get parsedWhereClause(){const t=this.viewFilter!=null?this.viewFilter.where:null;if(t==null||!t)return null;try{return Je.create(t,this.layerFieldsIndex)}catch(e){$.error(`Failed to parse filter where clause: ${e}`)}return null}addFilters(t,e,r,s){const n=this.sortedObjectIds;n!=null&&t.push(l=>me(n,!0,l)),this.addSqlFilter(t,this.parsedWhereClause);const i=j(this._layerMaskGeometries),o=this._geometryEngine;if(i!=null&&this.layerFilter!=null&&o!=null){const l=this.layerFilter.spatialRelationship;t.push((u,h)=>re(o,u,h,s,e,r,i,l))}const a=j(this._viewMaskGeometries);if(a!=null&&this.viewFilter!=null&&o!=null){const l=this.viewFilter.spatialRelationship;t.push((u,h)=>re(o,u,h,s,e,r,a,l))}}isMBSGeometryVisible(t,e,r){const s=j(this._layerMaskGeometries),n=this._geometryEngine;if(s!=null&&this.layerFilter!=null&&n!=null){const o=this.layerFilter.spatialRelationship,a=s[0].spatialReference||e;return D(t,r,M,a)?te(n,M,s,a,o):($.warnOnce("SceneLayer.mask geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0)}const i=j(this._viewMaskGeometries);if(i!=null&&this.viewFilter!=null&&n!=null){const o=this.viewFilter.spatialRelationship,a=i[0].spatialReference||e;return D(t,r,M,a)?te(n,M,i,a,o):($.warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0)}return!0}get parsedGeometry(){const t=j(this._viewMaskGeometries),e=j(this._layerMaskGeometries);return t==null||e==null?t||e:e.concat(t)}get _layerMaskGeometries(){const t=this.layerFilter;return t==null?null:this._geometryEngine==null?Y:t.spatialRelationship==="disjoint"?t.geometries.map(e=>({type:"polygon",rings:e.rings,spatialReference:e.spatialReference,cache:{}})):[t.geometries.reduce((e,r)=>(e.rings=[...e.rings,...r.rings],e),{type:"polygon",rings:[],spatialReference:t.geometries[0].spatialReference,cache:{}})]}get _viewMaskGeometries(){if(this.viewFilter==null)return null;const{geometry:t}=this.viewFilter;if(t==null)return null;if(this.viewFilter==null||this._geometryEngine==null)return Y;const{distance:e,units:r}=this.viewFilter,s=this.viewFilter.spatialRelationship,n=t.type==="mesh"?t.extent:t;if(e==null||e===0)return k(this._geometryEngine,n,s);const i=r||Ee(n.spatialReference);if(n.spatialReference.isWGS84){const l=this._geometryEngine.geodesicBuffer(n,e,i);return k(this._geometryEngine,l,s)}const o=Z(n,z.WGS84);if(o!=null){const l=Z(this._geometryEngine.geodesicBuffer(o,e,i),n.spatialReference);return k(this._geometryEngine,l,s)}if(!this._projectionEngineLoaded&&(this.loadAsyncModule(we().then(()=>this._projectionEngineLoaded=!0)),!this._projectionEngineLoaded))return null;let a=null;try{a=U(n,z.WGS84)}catch{}if(a)try{a=U(this._geometryEngine.geodesicBuffer(a,e,i),n.spatialReference)}catch{a=null}return a||$.error(`Filter by geodesic buffer (distance) unsupported, failed to project input geometry (${n.spatialReference.wkid}) to WGS84.`),k(this._geometryEngine,a,s)}get updating(){return ee(this._layerMaskGeometries)||ee(this._viewMaskGeometries)}static checkSupport(t){return t!=null&&(t.timeExtent?($.warn("Filters with a timeExtent are not supported for mesh scene layers"),!1):!!Ke(t.spatialRelationship)||($.warn(`Filters with spatialRelationship other than ${oe.join(", ")} are not supported for mesh scene layers`),!1))}};c([d()],g.prototype,"layerFilter",void 0),c([d({type:ye})],g.prototype,"viewFilter",void 0),c([d()],g.prototype,"layerFieldsIndex",void 0),c([d()],g.prototype,"loadAsyncModule",void 0),c([d()],g.prototype,"addSqlFilter",void 0),c([d({readOnly:!0})],g.prototype,"sortedObjectIds",null),c([d({readOnly:!0})],g.prototype,"parsedWhereClause",null),c([d({readOnly:!0})],g.prototype,"parsedGeometry",null),c([d({readOnly:!0})],g.prototype,"_layerMaskGeometries",null),c([d({readOnly:!0})],g.prototype,"_viewMaskGeometries",null),c([d()],g.prototype,"updating",null),c([d()],g.prototype,"_projectionEngineLoaded",void 0),c([d()],g.prototype,"_geometryEngine",void 0),g=c([B(ie)],g);const oe=(t=>t)(["contains","intersects","disjoint"]);function Ke(t){return t!=null&&oe.includes(t)}var y;function k(t,e,r){if(e==null)return null;if(r==="disjoint"&&e.type==="polygon"){const s=e.rings.length,n=e.spatialReference,i=new Array(s);for(let l=0;ll.aabr[0]-u.aabr[0]);const o=new Set,a=new Qe;for(let l=0;l{if(h>=p.aabr[2])return void o.delete(p);if(u.aabr[1]>p.aabr[3]||u.aabr[3]=.5*(e[2]+Fe(s).radius))return!0;const i=ae(t,e,s);return r.every(o=>le(t,o,i,n)!==y.DISCARD)}function re(t,e,r,s,n,i,o,a){const l=o[0].spatialReference||n.spatialReference;if(!D(r.node.mbs,i,M,l))return void $.warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter");const u=ae(t,M,l),h=We(a,n,l,s,r.objectHandle);for(const p of o){if(e.length===0)return;switch(le(t,p,u,a)){case y.DISCARD:return void(e.length=0);case y.KEEP:continue}Ie(e,r.featureIds,m=>Be(t,p,m,h))}}(function(t){t[t.KEEP=0]="KEEP",t[t.DISCARD=1]="DISCARD",t[t.TEST=2]="TEST"})(y||(y={}));const M=se(0,0,0,0);function We(t,e,r,s,n){const i=e.renderSpatialReference,o=new Map,a={type:"polygon",rings:[[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]],spatialReference:r};a.rings[0][3]=a.rings[0][0];const l={indices:null,data:null,stride:0,startIndex:0,endIndex:0};let u,h;switch(t){case"intersects":u=(p,m,b)=>p.intersects(m,b)?y.KEEP:y.TEST,h=W;break;case"contains":u=(p,m,b)=>p.contains(m,b)?y.TEST:y.DISCARD,h=W;break;default:u=(p,m,b)=>p.disjoint(m,b)?y.TEST:y.DISCARD,h=ue}return{collection:s,object:n,type:t,maskSR:r,renderSR:i,aabbCache:o,triangle:a,positions:l,triangleTest:u,geometryTest:h}}function ae(t,e,r){const s={type:"point",x:e[0],y:e[1],hasZ:!1,hasM:!1,spatialReference:r},n=!ve(r)&&!xe(r),i=Number.isNaN(e[3])?0:Oe(e[3],0,2*$e.radius),o=n?t.buffer(s,i,1):t.geodesicBuffer(s,i,1);return o.type="polygon",o}function le(t,e,r,s){switch(s){case"intersects":case"contains":return W(t,e,r);case"disjoint":return ue(t,e,r)}}function W(t,e,r){return t.intersects(e,r)?t.contains(e,r)?y.KEEP:y.TEST:y.DISCARD}function ue(t,e,r){return t.intersects(e,r)?t.contains(e,r)?y.DISCARD:y.TEST:y.KEEP}function Be(t,e,r,s){const{collection:n,object:i,renderSR:o,maskSR:a,geometryTest:l,aabbCache:u}=s;let h=u.get(r);if(!h){const R=n.getObjectTransform(i);n.getComponentAabb(i,r,_);const E=[[_[0],_[1],0],[_[0],_[4],0],[_[3],_[4],0],[_[3],_[1],0]];for(let f=0;f<4;++f)T(E[f],E[f],R.rotationScale),G(E[f],E[f],R.position),N(E[f],o,E[f],a);h={type:"polygon",rings:[E],spatialReference:a,cache:{}},h.rings[0][4]=h.rings[0][0],u.set(r,h)}switch(l(t,e,h)){case y.DISCARD:return!1;case y.KEEP:return!0}const{triangle:p,triangleTest:m,positions:b}=s,I=p.rings[0][0],v=p.rings[0][1],x=p.rings[0][2],Q=n.getObjectTransform(i);n.getComponentPositions(i,r,b);const{indices:J,data:S,stride:P,startIndex:ce,endIndex:de}=b;for(let R=ce;Rthis.spatialIndex.events.emit("changed")))}destroy(){this._dataQueryEngineInstance=Me(this._dataQueryEngineInstance),this._set("layerView",null)}async executeQueryForCount(e,r){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),r)}async executeQueryForExtent(e,r){const{count:s,extent:n}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),r);return{count:s,extent:Ce.fromJSON(n)}}async executeQueryForIds(e,r){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),r)}async executeQuery(e,r){const s=this._ensureQueryJSON(e);if(s.returnGeometry)throw new H("unsupported-query","returnGeometry is not yet supported for mesh scene layer queries");if(s.returnCentroid)throw new H("unsupported-query","returnCentroid is not yet supported for mesh scene layer queries");const n=await this._dataQueryEngine.executeQuery(s,r),i=Ve.fromJSON(n);return i.features.forEach(o=>{o.geometry=null}),i}_ensureQueryJSON(e){return e==null?this.defaultQueryJSON:e.toJSON()}_ensureDataQueryEngine(){var l;if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e=this.layer.objectIdField||Te,r="esriGeometryPolygon",s=((l=this.layer.fieldsIndex)==null?void 0:l.toJSON())||new Ge([]),n=this.layerView.view.resourceController.scheduler,i=this.spatialReference.toJSON(),o=this.priority,a=this.spatialIndex;return this._dataQueryEngineInstance=new qe({hasZ:!0,hasM:!1,geometryType:r,fieldsIndex:s,timeInfo:null,spatialReference:i,objectIdField:e,featureStore:a,scheduler:n,priority:o}),this._dataQueryEngineInstance}};c([d({constructOnly:!0})],F.prototype,"layerView",void 0),c([d({constructOnly:!0})],F.prototype,"priority",void 0),c([d({constructOnly:!0})],F.prototype,"spatialIndex",void 0),c([d()],F.prototype,"spatialReference",null),c([d()],F.prototype,"layer",null),c([d()],F.prototype,"defaultQueryJSON",null),F=c([B("esri.views.3d.layers.i3s.I3SQueryEngine")],F);class ot{constructor(e){this._objectIdField=e.objectIdField,this._getFeatureExtent=e.getFeatureExtent}getObjectId(e){return e.id}getAttributes(e){var o;const{meta:r,index:s}=e,n={};this._objectIdField&&(n[this._objectIdField]=e.id);const i=(o=r.attributeInfo)==null?void 0:o.attributeData;if(i!=null)for(const a of Object.keys(i))n[a]=X(i[a],s);return n}getAttribute(e,r){var o;if(r===this._objectIdField)return e.id;const{meta:s,index:n}=e,i=(o=s.attributeInfo)==null?void 0:o.attributeData;return i!=null?X(i[r],n):null}getGeometry(e){if(e.geometry)return e.geometry;const[r,s,n,i,o]=this._getFeatureExtent(e,ne);return new K([5],[r,s,n,i,s,n,i,o,n,r,o,n,r,s,n])}getCentroid(e,r){if(e.geometry)return Le(new K,e.geometry,r.hasZ,r.hasM);const[s,n,i,o,a,l]=this._getFeatureExtent(e,ne);return new K([0],[(s+o)/2,(n+a)/2,(i+l)/2])}cloneWithGeometry(e,r){const{id:s,index:n,meta:i}=e;return{id:s,index:n,meta:i,geometry:r}}}const ne=A(),Ze=A();let O=class extends q{constructor(t){super(t),this.events=new ke}forEach(t){this.forAllFeatures(e=>(t(e),C.CONTINUE))}forEachBounds(t,e){const r=this.getFeatureExtent;for(const s of t)e(r(s,Ze))}forEachInBounds(t,e){this.forAllFeatures(r=>{const s=this.getFeatureExtent(r,ze);return De(t,Ae(s,Ue))&&e(r),C.CONTINUE},r=>{if(D(r.node.mbs,this.sourceSpatialReference,w,this.viewSpatialReference),w[0]>=t[0]&&w[2]<=t[2]&&w[1]>=t[1]&&w[3]<=t[3])return C.CONTINUE;const s=Math.max(t[0],Math.min(w[0],t[2])),n=Math.max(t[1],Math.min(w[1],t[3])),i=w[0]-s,o=w[1]-n;return i*i+o*o<=w[3]*w[3]?C.CONTINUE:C.SKIP})}};c([d({constructOnly:!0})],O.prototype,"featureAdapter",void 0),c([d({constructOnly:!0})],O.prototype,"forAllFeatures",void 0),c([d({constructOnly:!0})],O.prototype,"getFeatureExtent",void 0),c([d({constructOnly:!0})],O.prototype,"sourceSpatialReference",void 0),c([d({constructOnly:!0})],O.prototype,"viewSpatialReference",void 0),O=c([B("esri.views.3d.layers.i3s.I3SQueryFeatureStore")],O);const w=se(0,0,0,0),ze=A(),Ue=Ne();export{g as L,F as d,O as l,ot as o}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/I3SQueryFeatureStore-LSdoLFw0.js b/dist/assets/I3SQueryFeatureStore-LSdoLFw0.js new file mode 100644 index 0000000..60b6962 --- /dev/null +++ b/dist/assets/I3SQueryFeatureStore-LSdoLFw0.js @@ -0,0 +1,7 @@ +import{R as pe,e as c,y as d,dx as ye,c as K,ea as A,g as q,aa as he,de as ge,lH as fe,fQ as me,mP as Ee,cO as z,d2 as U,dV as Se,dW as Z,mQ as we,mR as _e,et as be,aP as Re,mS as Fe,mT as Ie,fh as se,dM as ve,ez as xe,bE as Oe,mU as $e,aQ as Qe,j6 as T,bO as N,bx as k,bz as L,aL as je,b as Me,dO as Ce,r as H,h6 as Te,lM as Ne,eL as ke,lO as X,eV as W,cf as De,z as Ge,jS as Ae,mV as Pe}from"./index-pCX-0tJH.js";import{a as j,n as Y,u as ee}from"./DefinitionExpressionSceneLayerView-Z1V4X6Kq.js";import{x as Ve}from"./WhereClause-FOYoIAAW.js";import{a as G}from"./I3SOverrides-XXafrk1K.js";import{W as Je}from"./QueryEngine-uvDs-vBe.js";import{n as Le}from"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import{I as C}from"./I3SMeshView3D-frxYFPRW.js";const ie="esri.views.3d.layers.i3s.I3SMeshViewFilter",$=pe.getLogger(ie);let g=class extends q{constructor(t){super(t),this._projectionEngineLoaded=!1}initialize(){he(()=>{var t;return((t=this.viewFilter)==null?void 0:t.geometry)||this.layerFilter!=null}).then(()=>this.loadAsyncModule(ge(()=>import("./index-pCX-0tJH.js").then(t=>t.A0),__vite__mapDeps([0,1])).then(t=>{this.destroyed||(this._geometryEngine=t)})))}get sortedObjectIds(){var e;if(((e=this.viewFilter)==null?void 0:e.objectIds)==null)return null;const t=fe(this.viewFilter.objectIds);return t.sort(),t}get parsedWhereClause(){const t=this.viewFilter!=null?this.viewFilter.where:null;if(t==null||!t)return null;try{return Ve.create(t,this.layerFieldsIndex)}catch(e){$.error(`Failed to parse filter where clause: ${e}`)}return null}addFilters(t,e,r,s){const n=this.sortedObjectIds;n!=null&&t.push(l=>me(n,!0,l)),this.addSqlFilter(t,this.parsedWhereClause);const i=j(this._layerMaskGeometries),o=this._geometryEngine;if(i!=null&&this.layerFilter!=null&&o!=null){const l=this.layerFilter.spatialRelationship;t.push((u,h)=>re(o,u,h,s,e,r,i,l))}const a=j(this._viewMaskGeometries);if(a!=null&&this.viewFilter!=null&&o!=null){const l=this.viewFilter.spatialRelationship;t.push((u,h)=>re(o,u,h,s,e,r,a,l))}}isMBSGeometryVisible(t,e,r){const s=j(this._layerMaskGeometries),n=this._geometryEngine;if(s!=null&&this.layerFilter!=null&&n!=null){const o=this.layerFilter.spatialRelationship,a=s[0].spatialReference||e;return G(t,r,M,a)?te(n,M,s,a,o):($.warnOnce("SceneLayer.mask geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0)}const i=j(this._viewMaskGeometries);if(i!=null&&this.viewFilter!=null&&n!=null){const o=this.viewFilter.spatialRelationship,a=i[0].spatialReference||e;return G(t,r,M,a)?te(n,M,i,a,o):($.warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter for MBS"),!0)}return!0}get parsedGeometry(){const t=j(this._viewMaskGeometries),e=j(this._layerMaskGeometries);return t==null||e==null?t||e:e.concat(t)}get _layerMaskGeometries(){const t=this.layerFilter;return t==null?null:this._geometryEngine==null?Y:t.spatialRelationship==="disjoint"?t.geometries.map(e=>({type:"polygon",rings:e.rings,spatialReference:e.spatialReference,cache:{}})):[t.geometries.reduce((e,r)=>(e.rings=[...e.rings,...r.rings],e),{type:"polygon",rings:[],spatialReference:t.geometries[0].spatialReference,cache:{}})]}get _viewMaskGeometries(){if(this.viewFilter==null)return null;const{geometry:t}=this.viewFilter;if(t==null)return null;if(this.viewFilter==null||this._geometryEngine==null)return Y;const{distance:e,units:r}=this.viewFilter,s=this.viewFilter.spatialRelationship,n=t.type==="mesh"?t.extent:t;if(e==null||e===0)return D(this._geometryEngine,n,s);const i=r||Ee(n.spatialReference);if(n.spatialReference.isWGS84){const l=this._geometryEngine.geodesicBuffer(n,e,i);return D(this._geometryEngine,l,s)}const o=z(n,U.WGS84);if(o!=null){const l=z(this._geometryEngine.geodesicBuffer(o,e,i),n.spatialReference);return D(this._geometryEngine,l,s)}if(!this._projectionEngineLoaded&&(this.loadAsyncModule(Se().then(()=>this._projectionEngineLoaded=!0)),!this._projectionEngineLoaded))return null;let a=null;try{a=Z(n,U.WGS84)}catch{}if(a)try{a=Z(this._geometryEngine.geodesicBuffer(a,e,i),n.spatialReference)}catch{a=null}return a||$.error(`Filter by geodesic buffer (distance) unsupported, failed to project input geometry (${n.spatialReference.wkid}) to WGS84.`),D(this._geometryEngine,a,s)}get updating(){return ee(this._layerMaskGeometries)||ee(this._viewMaskGeometries)}static checkSupport(t){return t!=null&&(t.timeExtent?($.warn("Filters with a timeExtent are not supported for mesh scene layers"),!1):!!We(t.spatialRelationship)||($.warn(`Filters with spatialRelationship other than ${oe.join(", ")} are not supported for mesh scene layers`),!1))}};c([d()],g.prototype,"layerFilter",void 0),c([d({type:ye})],g.prototype,"viewFilter",void 0),c([d()],g.prototype,"layerFieldsIndex",void 0),c([d()],g.prototype,"loadAsyncModule",void 0),c([d()],g.prototype,"addSqlFilter",void 0),c([d({readOnly:!0})],g.prototype,"sortedObjectIds",null),c([d({readOnly:!0})],g.prototype,"parsedWhereClause",null),c([d({readOnly:!0})],g.prototype,"parsedGeometry",null),c([d({readOnly:!0})],g.prototype,"_layerMaskGeometries",null),c([d({readOnly:!0})],g.prototype,"_viewMaskGeometries",null),c([d()],g.prototype,"updating",null),c([d()],g.prototype,"_projectionEngineLoaded",void 0),c([d()],g.prototype,"_geometryEngine",void 0),g=c([K(ie)],g);const oe=(t=>t)(["contains","intersects","disjoint"]);function We(t){return t!=null&&oe.includes(t)}var y;function D(t,e,r){if(e==null)return null;if(r==="disjoint"&&e.type==="polygon"){const s=e.rings.length,n=e.spatialReference,i=new Array(s);for(let l=0;ll.aabr[0]-u.aabr[0]);const o=new Set,a=new Qe;for(let l=0;l{if(h>=p.aabr[2])return void o.delete(p);if(u.aabr[1]>p.aabr[3]||u.aabr[3]=.5*(e[2]+Fe(s).radius))return!0;const i=ae(t,e,s);return r.every(o=>le(t,o,i,n)!==y.DISCARD)}function re(t,e,r,s,n,i,o,a){const l=o[0].spatialReference||n.spatialReference;if(!G(r.node.mbs,i,M,l))return void $.warnOnce("SceneLayerView.filter.geometry is using unsupported SpatialReference, skipping geometry filter");const u=ae(t,M,l),h=Be(a,n,l,s,r.objectHandle);for(const p of o){if(e.length===0)return;switch(le(t,p,u,a)){case y.DISCARD:return void(e.length=0);case y.KEEP:continue}Ie(e,r.featureIds,m=>Ke(t,p,m,h))}}(function(t){t[t.KEEP=0]="KEEP",t[t.DISCARD=1]="DISCARD",t[t.TEST=2]="TEST"})(y||(y={}));const M=se(0,0,0,0);function Be(t,e,r,s,n){const i=e.renderSpatialReference,o=new Map,a={type:"polygon",rings:[[[0,0,0],[0,0,0],[0,0,0],[0,0,0]]],spatialReference:r};a.rings[0][3]=a.rings[0][0];const l={indices:null,data:null,stride:0,startIndex:0,endIndex:0};let u,h;switch(t){case"intersects":u=(p,m,b)=>p.intersects(m,b)?y.KEEP:y.TEST,h=B;break;case"contains":u=(p,m,b)=>p.contains(m,b)?y.TEST:y.DISCARD,h=B;break;default:u=(p,m,b)=>p.disjoint(m,b)?y.TEST:y.DISCARD,h=ue}return{collection:s,object:n,type:t,maskSR:r,renderSR:i,aabbCache:o,triangle:a,positions:l,triangleTest:u,geometryTest:h}}function ae(t,e,r){const s={type:"point",x:e[0],y:e[1],hasZ:!1,hasM:!1,spatialReference:r},n=!ve(r)&&!xe(r),i=Number.isNaN(e[3])?0:Oe(e[3],0,2*$e.radius),o=n?t.buffer(s,i,1):t.geodesicBuffer(s,i,1);return o.type="polygon",o}function le(t,e,r,s){switch(s){case"intersects":case"contains":return B(t,e,r);case"disjoint":return ue(t,e,r)}}function B(t,e,r){return t.intersects(e,r)?t.contains(e,r)?y.KEEP:y.TEST:y.DISCARD}function ue(t,e,r){return t.intersects(e,r)?t.contains(e,r)?y.DISCARD:y.TEST:y.KEEP}function Ke(t,e,r,s){const{collection:n,object:i,renderSR:o,maskSR:a,geometryTest:l,aabbCache:u}=s;let h=u.get(r);if(!h){const R=n.getObjectTransform(i);n.getComponentAabb(i,r,_);const E=[[_[0],_[1],0],[_[0],_[4],0],[_[3],_[4],0],[_[3],_[1],0]];for(let f=0;f<4;++f)T(E[f],E[f],R.rotationScale),N(E[f],E[f],R.position),k(E[f],o,E[f],a);h={type:"polygon",rings:[E],spatialReference:a,cache:{}},h.rings[0][4]=h.rings[0][0],u.set(r,h)}switch(l(t,e,h)){case y.DISCARD:return!1;case y.KEEP:return!0}const{triangle:p,triangleTest:m,positions:b}=s,I=p.rings[0][0],v=p.rings[0][1],x=p.rings[0][2],Q=n.getObjectTransform(i);n.getComponentPositions(i,r,b);const{indices:P,data:w,stride:V,startIndex:ce,endIndex:de}=b;for(let R=ce;Rthis.spatialIndex.events.emit("changed")))}destroy(){this._dataQueryEngineInstance=Me(this._dataQueryEngineInstance),this._set("layerView",null)}async executeQueryForCount(e,r){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),r)}async executeQueryForExtent(e,r){const{count:s,extent:n}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),r);return{count:s,extent:Ce.fromJSON(n)}}async executeQueryForIds(e,r){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),r)}async executeQuery(e,r){const s=this._ensureQueryJSON(e);if(s.returnGeometry)throw new H("unsupported-query","returnGeometry is not yet supported for mesh scene layer queries");if(s.returnCentroid)throw new H("unsupported-query","returnCentroid is not yet supported for mesh scene layer queries");const n=await this._dataQueryEngine.executeQuery(s,r),i=Te.fromJSON(n);return i.features.forEach(o=>{o.geometry=null}),i}_ensureQueryJSON(e){return e==null?this.defaultQueryJSON:e.toJSON()}_ensureDataQueryEngine(){var l;if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e=this.layer.objectIdField||Ne,r="esriGeometryPolygon",s=((l=this.layer.fieldsIndex)==null?void 0:l.toJSON())||new ke([]),n=this.layerView.view.resourceController.scheduler,i=this.spatialReference.toJSON(),o=this.priority,a=this.spatialIndex;return this._dataQueryEngineInstance=new qe({hasZ:!0,hasM:!1,geometryType:r,fieldsIndex:s,timeInfo:null,spatialReference:i,objectIdField:e,featureStore:a,scheduler:n,priority:o}),this._dataQueryEngineInstance}};c([d({constructOnly:!0})],F.prototype,"layerView",void 0),c([d({constructOnly:!0})],F.prototype,"priority",void 0),c([d({constructOnly:!0})],F.prototype,"spatialIndex",void 0),c([d()],F.prototype,"spatialReference",null),c([d()],F.prototype,"layer",null),c([d()],F.prototype,"defaultQueryJSON",null),F=c([K("esri.views.3d.layers.i3s.I3SQueryEngine")],F);class it{constructor(e){this._objectIdField=e.objectIdField,this._getFeatureExtent=e.getFeatureExtent}getObjectId(e){return e.id}getAttributes(e){var o;const{meta:r,index:s}=e,n={};this._objectIdField&&(n[this._objectIdField]=e.id);const i=(o=r.attributeInfo)==null?void 0:o.attributeData;if(i!=null)for(const a of Object.keys(i))n[a]=X(i[a],s);return n}getAttribute(e,r){var o;if(r===this._objectIdField)return e.id;const{meta:s,index:n}=e,i=(o=s.attributeInfo)==null?void 0:o.attributeData;return i!=null?X(i[r],n):null}getGeometry(e){if(e.geometry)return e.geometry;const[r,s,n,i,o]=this._getFeatureExtent(e,ne);return new W([5],[r,s,n,i,s,n,i,o,n,r,o,n,r,s,n])}getCentroid(e,r){if(e.geometry)return Le(new W,e.geometry,r.hasZ,r.hasM);const[s,n,i,o,a,l]=this._getFeatureExtent(e,ne);return new W([0],[(s+o)/2,(n+a)/2,(i+l)/2])}cloneWithGeometry(e,r){const{id:s,index:n,meta:i}=e;return{id:s,index:n,meta:i,geometry:r}}}const ne=A(),ze=A();let O=class extends q{constructor(t){super(t),this.events=new Ge}forEach(t){this.forAllFeatures(e=>(t(e),C.CONTINUE))}forEachBounds(t,e){const r=this.getFeatureExtent;for(const s of t)e(r(s,ze))}forEachInBounds(t,e){this.forAllFeatures(r=>{const s=this.getFeatureExtent(r,Ue);return Ae(t,Pe(s,Ze))&&e(r),C.CONTINUE},r=>{if(G(r.node.mbs,this.sourceSpatialReference,S,this.viewSpatialReference),S[0]>=t[0]&&S[2]<=t[2]&&S[1]>=t[1]&&S[3]<=t[3])return C.CONTINUE;const s=Math.max(t[0],Math.min(S[0],t[2])),n=Math.max(t[1],Math.min(S[1],t[3])),i=S[0]-s,o=S[1]-n;return i*i+o*o<=S[3]*S[3]?C.CONTINUE:C.SKIP})}};c([d({constructOnly:!0})],O.prototype,"featureAdapter",void 0),c([d({constructOnly:!0})],O.prototype,"forAllFeatures",void 0),c([d({constructOnly:!0})],O.prototype,"getFeatureExtent",void 0),c([d({constructOnly:!0})],O.prototype,"sourceSpatialReference",void 0),c([d({constructOnly:!0})],O.prototype,"viewSpatialReference",void 0),O=c([K("esri.views.3d.layers.i3s.I3SQueryFeatureStore")],O);const S=se(0,0,0,0),Ue=A(),Ze=De();export{g as L,F as d,O as l,it as o}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/index-pCX-0tJH.js","assets/index-4b4radwv.css"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/I3STreeDebugger-kGP6iO8T.js b/dist/assets/I3STreeDebugger-kGP6iO8T.js new file mode 100644 index 0000000..083903d --- /dev/null +++ b/dist/assets/I3STreeDebugger-kGP6iO8T.js @@ -0,0 +1 @@ +import{dY as d,ha as S,b3 as a,gk as u,hb as r,j as b,e as p,y as c,c as g,bT as j,a8 as v}from"./index-pCX-0tJH.js";import{d as m}from"./TileTreeDebugger-MxH50s1q.js";let h=class extends m{constructor(o){super(o)}getTiles(){const o=this.lv.getVisibleNodes(),t=this.view.renderSpatialReference,i=this.nodeSR;return o.map(l=>y(l,t,i)).filter(d).sort((l,s)=>l.lij[0]===s.lij[0]?l.label>s.label?-1:1:l.lij[0]-s.lij[0])}};function y(o,t,i){const l=o.serviceObb;if(l==null||t==null)return null;S(n,l.quaternion),a(e,l.center),u(e,i,0,e,t,0,1),n[12]=e[0],n[13]=e[1],n[14]=e[2];const s=[[],[],[]];a(e,l.halfSize),r(e,e,n),u(e,t,0,e,i,0,1),s[0].push([e[0],e[1]]),a(e,l.halfSize),e[0]=-e[0],r(e,e,n),u(e,t,0,e,i,0,1),s[0].push([e[0],e[1]]),a(e,l.halfSize),e[0]=-e[0],e[1]=-e[1],r(e,e,n),u(e,t,0,e,i,0,1),s[0].push([e[0],e[1]]),a(e,l.halfSize),e[1]=-e[1],r(e,e,n),u(e,t,0,e,i,0,1),s[0].push([e[0],e[1]]),s[1].push(s[0][0]),s[1].push(s[0][1]),a(e,l.halfSize),e[0]=-e[0],e[2]=-e[2],r(e,e,n),u(e,t,0,e,i,0,1),s[1].push([e[0],e[1]]),a(e,l.halfSize),e[2]=-e[2],r(e,e,n),u(e,t,0,e,i,0,1),s[1].push([e[0],e[1]]),s[2].push(s[0][0]),s[2].push(s[0][3]),a(e,l.halfSize),e[1]=-e[1],e[2]=-e[2],r(e,e,n),u(e,t,0,e,i,0,1),s[2].push([e[0],e[1]]),s[2].push(s[1][3]);const f=new b({rings:s,spatialReference:i});return{lij:[o.level,o.childCount,0],label:o.id,geometry:f}}p([c({constructOnly:!0})],h.prototype,"lv",void 0),p([c({constructOnly:!0})],h.prototype,"nodeSR",void 0),h=p([g("esri.views.3d.layers.support.I3STreeDebugger")],h);const n=j(),e=v();export{h as I3STreeDebugger}; diff --git a/dist/assets/I3STreeDebugger-tPVEJfH8.js b/dist/assets/I3STreeDebugger-tPVEJfH8.js deleted file mode 100644 index 5d957f6..0000000 --- a/dist/assets/I3STreeDebugger-tPVEJfH8.js +++ /dev/null @@ -1 +0,0 @@ -import{e3 as S,h8 as d,aE as a,gn as u,h9 as r,l as b,e as p,y as c,c as g,bA as v,aa as j}from"./index-J0iiHjMT.js";import{d as m}from"./TileTreeDebugger-2DVbY5sQ.js";let h=class extends m{constructor(o){super(o)}getTiles(){const o=this.lv.getVisibleNodes(),t=this.view.renderSpatialReference,i=this.nodeSR;return o.map(s=>y(s,t,i)).filter(S).sort((s,l)=>s.lij[0]===l.lij[0]?s.label>l.label?-1:1:s.lij[0]-l.lij[0])}};function y(o,t,i){const s=o.serviceObb;if(s==null||t==null)return null;d(n,s.quaternion),a(e,s.center),u(e,i,0,e,t,0,1),n[12]=e[0],n[13]=e[1],n[14]=e[2];const l=[[],[],[]];a(e,s.halfSize),r(e,e,n),u(e,t,0,e,i,0,1),l[0].push([e[0],e[1]]),a(e,s.halfSize),e[0]=-e[0],r(e,e,n),u(e,t,0,e,i,0,1),l[0].push([e[0],e[1]]),a(e,s.halfSize),e[0]=-e[0],e[1]=-e[1],r(e,e,n),u(e,t,0,e,i,0,1),l[0].push([e[0],e[1]]),a(e,s.halfSize),e[1]=-e[1],r(e,e,n),u(e,t,0,e,i,0,1),l[0].push([e[0],e[1]]),l[1].push(l[0][0]),l[1].push(l[0][1]),a(e,s.halfSize),e[0]=-e[0],e[2]=-e[2],r(e,e,n),u(e,t,0,e,i,0,1),l[1].push([e[0],e[1]]),a(e,s.halfSize),e[2]=-e[2],r(e,e,n),u(e,t,0,e,i,0,1),l[1].push([e[0],e[1]]),l[2].push(l[0][0]),l[2].push(l[0][3]),a(e,s.halfSize),e[1]=-e[1],e[2]=-e[2],r(e,e,n),u(e,t,0,e,i,0,1),l[2].push([e[0],e[1]]),l[2].push(l[1][3]);const f=new b({rings:l,spatialReference:i});return{lij:[o.level,o.childCount,0],label:o.id,geometry:f}}p([c({constructOnly:!0})],h.prototype,"lv",void 0),p([c({constructOnly:!0})],h.prototype,"nodeSR",void 0),h=p([g("esri.views.3d.layers.support.I3STreeDebugger")],h);const n=v(),e=j();export{h as I3STreeDebugger}; diff --git a/dist/assets/IdentityManager-DTERQ1-w.js b/dist/assets/IdentityManager-YS7SZXzi.js similarity index 91% rename from dist/assets/IdentityManager-DTERQ1-w.js rename to dist/assets/IdentityManager-YS7SZXzi.js index 4b3c400..5358448 100644 --- a/dist/assets/IdentityManager-DTERQ1-w.js +++ b/dist/assets/IdentityManager-YS7SZXzi.js @@ -1,7 +1,7 @@ -import{e as m,y as _,kM as We,c as oe,hl as Ye,hn as C,hy as lt,oJ as je,d as Re,a2 as ct,oK as ut,dr as Xe,K as Qe,kt as R,oL as Ze,bV as ke,bH as le,fZ as se,E as N,g as ht,fa as G,j6 as Y,bW as M,oM as ce,oN as Ae,oO as Te,f3 as Le,oP as dt,dS as Ue,j9 as pt,oQ as ft,nC as ue,f5 as qe,l5 as vt,oR as gt}from"./index-J0iiHjMT.js";const he="esri-identity-form",L={base:he,group:`${he}__group`,label:`${he}__label`,footer:`${he}__footer`,esriInput:"esri-input",esriButton:"esri-button",esriButtonSecondary:"esri-button--secondary"},mt="ArcGIS Online";let z=class extends Ye{constructor(e,t){super(e,t),this._usernameInputNode=null,this._passwordInputNode=null,this.signingIn=!1,this.server=null,this.resource=null,this.error=null,this.oAuthPrompt=!1}render(){var c;const{error:e,server:t,resource:r,signingIn:i,oAuthPrompt:s,messages:n}=this,l=C("div",{class:L.group},lt(s?n.oAuthInfo:n.info,{server:t&&/\.arcgis\.com/i.test(t)?mt:t,resource:`(${r||n.lblItem})`})),d=s?null:C("div",{class:L.group,key:"username"},C("label",{class:L.label},n.lblUser,C("input",{afterCreate:je,autocomplete:"off",bind:this,class:L.esriInput,"data-node-ref":"_usernameInputNode",required:!0,spellcheck:!1,type:"text",value:""}))),a=s?null:C("div",{class:L.group,key:"password"},C("label",{class:L.label},n.lblPwd,C("input",{afterCreate:je,bind:this,class:L.esriInput,"data-node-ref":"_passwordInputNode",required:!0,type:"password",value:""}))),p=C("div",{class:this.classes(L.group,L.footer)},C("input",{class:L.esriButton,disabled:!!i,type:"submit",value:i?n.lblSigning:n.lblOk}),C("input",{bind:this,class:this.classes(L.esriButton,L.esriButtonSecondary),onclick:this._cancel,type:"button",value:n.lblCancel})),f=e?C("div",null,(c=e.details)!=null&&c.httpStatus?n.invalidUser:n.noAuthService):null;return C("form",{bind:this,class:L.base,onsubmit:this._submit},l,f,d,a,p)}_cancel(){this._set("signingIn",!1),this._usernameInputNode&&(this._usernameInputNode.value=""),this._passwordInputNode&&(this._passwordInputNode.value=""),this.emit("cancel")}_submit(e){e.preventDefault(),this._set("signingIn",!0);const t=this.oAuthPrompt?{}:{username:this._usernameInputNode&&this._usernameInputNode.value,password:this._passwordInputNode&&this._passwordInputNode.value};this.emit("submit",t)}};m([_(),We("esri/identity/t9n/identity")],z.prototype,"messages",void 0),m([_()],z.prototype,"signingIn",void 0),m([_()],z.prototype,"server",void 0),m([_()],z.prototype,"resource",void 0),m([_()],z.prototype,"error",void 0),m([_()],z.prototype,"oAuthPrompt",void 0),z=m([oe("esri.identity.IdentityForm")],z);const _t=z;/*! +import{e as m,y as _,kX as We,c as oe,hD as Ye,hF as C,hs as lt,oW as je,B as Re,a0 as ct,oX as ut,dr as Xe,z as Ze,kB as R,oY as Qe,au as ke,ag as le,fU as se,r as N,ad as ht,f5 as H,jd as Y,av as M,oZ as ce,o_ as Ae,o$ as Te,e_ as Le,p0 as dt,dN as Ue,jg as pt,p1 as ft,nL as ue,f0 as qe,lc as vt,p2 as gt}from"./index-pCX-0tJH.js";const he="esri-identity-form",L={base:he,group:`${he}__group`,label:`${he}__label`,footer:`${he}__footer`,esriInput:"esri-input",esriButton:"esri-button",esriButtonSecondary:"esri-button--secondary"},mt="ArcGIS Online";let z=class extends Ye{constructor(e,t){super(e,t),this._usernameInputNode=null,this._passwordInputNode=null,this.signingIn=!1,this.server=null,this.resource=null,this.error=null,this.oAuthPrompt=!1}render(){var c;const{error:e,server:t,resource:r,signingIn:i,oAuthPrompt:s,messages:n}=this,l=C("div",{class:L.group},lt(s?n.oAuthInfo:n.info,{server:t&&/\.arcgis\.com/i.test(t)?mt:t,resource:`(${r||n.lblItem})`})),d=s?null:C("div",{class:L.group,key:"username"},C("label",{class:L.label},n.lblUser,C("input",{afterCreate:je,autocomplete:"off",bind:this,class:L.esriInput,"data-node-ref":"_usernameInputNode",required:!0,spellcheck:!1,type:"text",value:""}))),a=s?null:C("div",{class:L.group,key:"password"},C("label",{class:L.label},n.lblPwd,C("input",{afterCreate:je,bind:this,class:L.esriInput,"data-node-ref":"_passwordInputNode",required:!0,type:"password",value:""}))),p=C("div",{class:this.classes(L.group,L.footer)},C("input",{class:L.esriButton,disabled:!!i,type:"submit",value:i?n.lblSigning:n.lblOk}),C("input",{bind:this,class:this.classes(L.esriButton,L.esriButtonSecondary),onclick:this._cancel,type:"button",value:n.lblCancel})),f=e?C("div",null,(c=e.details)!=null&&c.httpStatus?n.invalidUser:n.noAuthService):null;return C("form",{bind:this,class:L.base,onsubmit:this._submit},l,f,d,a,p)}_cancel(){this._set("signingIn",!1),this._usernameInputNode&&(this._usernameInputNode.value=""),this._passwordInputNode&&(this._passwordInputNode.value=""),this.emit("cancel")}_submit(e){e.preventDefault(),this._set("signingIn",!0);const t=this.oAuthPrompt?{}:{username:this._usernameInputNode&&this._usernameInputNode.value,password:this._passwordInputNode&&this._passwordInputNode.value};this.emit("submit",t)}};m([_(),We("esri/identity/t9n/identity")],z.prototype,"messages",void 0),m([_()],z.prototype,"signingIn",void 0),m([_()],z.prototype,"server",void 0),m([_()],z.prototype,"resource",void 0),m([_()],z.prototype,"error",void 0),m([_()],z.prototype,"oAuthPrompt",void 0),z=m([oe("esri.identity.IdentityForm")],z);const _t=z;/*! * tabbable 6.2.0 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE -*/var $e=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ge=$e.join(","),et=typeof Element>"u",Q=et?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,me=!et&&Element.prototype.getRootNode?function(o){var e;return o==null||(e=o.getRootNode)===null||e===void 0?void 0:e.call(o)}:function(o){return o==null?void 0:o.ownerDocument},_e=function o(e,t){var r;t===void 0&&(t=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=i===""||i==="true",n=s||t&&e&&o(e.parentNode);return n},bt=function(e){var t,r=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return r===""||r==="true"},tt=function(e,t,r){if(_e(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(ge));return t&&Q.call(e,ge)&&i.unshift(e),i=i.filter(r),i},rt=function o(e,t,r){for(var i=[],s=Array.from(e);s.length;){var n=s.shift();if(!_e(n,!1))if(n.tagName==="SLOT"){var l=n.assignedElements(),d=l.length?l:n.children,a=o(d,!0,r);r.flatten?i.push.apply(i,a):i.push({scopeParent:n,candidates:a})}else{var p=Q.call(n,ge);p&&r.filter(n)&&(t||!e.includes(n))&&i.push(n);var f=n.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(n),c=!_e(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(n));if(f&&c){var v=o(f===!0?n.children:f.children,!0,r);r.flatten?i.push.apply(i,v):i.push({scopeParent:n,candidates:v})}else s.unshift.apply(s,n.children)}}return i},st=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},X=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||bt(e))&&!st(e)?0:e.tabIndex},yt=function(e,t){var r=X(e);return r<0&&t&&!st(e)?0:r},wt=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},it=function(e){return e.tagName==="INPUT"},St=function(e){return it(e)&&e.type==="hidden"},It=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return t},kt=function(e,t){for(var r=0;rsummary:first-of-type"),n=s?e.parentElement:e;if(Q.call(n,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var l=e;e;){var d=e.parentElement,a=me(e);if(d&&!d.shadowRoot&&i(d)===!0)return Be(e);e.assignedSlot?e=e.assignedSlot:!d&&a!==e.ownerDocument?e=a.host:e=d}e=l}if(xt(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Be(e);return!1},Pt=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var r=0;r=0)},Nt=function o(e){var t=[],r=[];return e.forEach(function(i,s){var n=!!i.scopeParent,l=n?i.scopeParent:i,d=yt(l,n),a=n?o(i.candidates):l;d===0?n?t.push.apply(t,a):t.push(l):r.push({documentOrder:s,tabIndex:d,item:i,isScope:n,content:a})}),r.sort(wt).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(t)},Ct=function(e,t){t=t||{};var r;return t.getShadowRoot?r=rt([e],t.includeContainer,{filter:Ne.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Rt}):r=tt(e,t.includeContainer,Ne.bind(null,t)),Nt(r)},Dt=function(e,t){t=t||{};var r;return t.getShadowRoot?r=rt([e],t.includeContainer,{filter:be.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):r=tt(e,t.includeContainer,be.bind(null,t)),r},Z=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Q.call(e,ge)===!1?!1:Ne(t,e)},Et=$e.concat("iframe").join(","),xe=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Q.call(e,Et)===!1?!1:be(t,e)};/*! +*/var $e=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],ge=$e.join(","),et=typeof Element>"u",Z=et?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,me=!et&&Element.prototype.getRootNode?function(o){var e;return o==null||(e=o.getRootNode)===null||e===void 0?void 0:e.call(o)}:function(o){return o==null?void 0:o.ownerDocument},_e=function o(e,t){var r;t===void 0&&(t=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=i===""||i==="true",n=s||t&&e&&o(e.parentNode);return n},bt=function(e){var t,r=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return r===""||r==="true"},tt=function(e,t,r){if(_e(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(ge));return t&&Z.call(e,ge)&&i.unshift(e),i=i.filter(r),i},rt=function o(e,t,r){for(var i=[],s=Array.from(e);s.length;){var n=s.shift();if(!_e(n,!1))if(n.tagName==="SLOT"){var l=n.assignedElements(),d=l.length?l:n.children,a=o(d,!0,r);r.flatten?i.push.apply(i,a):i.push({scopeParent:n,candidates:a})}else{var p=Z.call(n,ge);p&&r.filter(n)&&(t||!e.includes(n))&&i.push(n);var f=n.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(n),c=!_e(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(n));if(f&&c){var v=o(f===!0?n.children:f.children,!0,r);r.flatten?i.push.apply(i,v):i.push({scopeParent:n,candidates:v})}else s.unshift.apply(s,n.children)}}return i},st=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},X=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||bt(e))&&!st(e)?0:e.tabIndex},yt=function(e,t){var r=X(e);return r<0&&t&&!st(e)?0:r},wt=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},it=function(e){return e.tagName==="INPUT"},St=function(e){return it(e)&&e.type==="hidden"},It=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return t},kt=function(e,t){for(var r=0;rsummary:first-of-type"),n=s?e.parentElement:e;if(Z.call(n,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var l=e;e;){var d=e.parentElement,a=me(e);if(d&&!d.shadowRoot&&i(d)===!0)return Be(e);e.assignedSlot?e=e.assignedSlot:!d&&a!==e.ownerDocument?e=a.host:e=d}e=l}if(xt(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Be(e);return!1},Pt=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var r=0;r=0)},Nt=function o(e){var t=[],r=[];return e.forEach(function(i,s){var n=!!i.scopeParent,l=n?i.scopeParent:i,d=yt(l,n),a=n?o(i.candidates):l;d===0?n?t.push.apply(t,a):t.push(l):r.push({documentOrder:s,tabIndex:d,item:i,isScope:n,content:a})}),r.sort(wt).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(t)},Ct=function(e,t){t=t||{};var r;return t.getShadowRoot?r=rt([e],t.includeContainer,{filter:Ne.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Rt}):r=tt(e,t.includeContainer,Ne.bind(null,t)),Nt(r)},Dt=function(e,t){t=t||{};var r;return t.getShadowRoot?r=rt([e],t.includeContainer,{filter:be.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):r=tt(e,t.includeContainer,be.bind(null,t)),r},Q=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Z.call(e,ge)===!1?!1:Ne(t,e)},Et=$e.concat("iframe").join(","),xe=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Z.call(e,Et)===!1?!1:be(t,e)};/*! * focus-trap 7.5.4 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE -*/function Ve(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable})),t.push.apply(t,r)}return t}function Me(o){for(var e=1;e0){var r=e[e.length-1];r!==t&&r.pause()}var i=e.indexOf(t);i===-1||e.splice(i,1),e.push(t)},deactivateTrap:function(e,t){var r=e.indexOf(t);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},qt=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Bt=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},ne=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},Vt=function(e){return ne(e)&&!e.shiftKey},Mt=function(e){return ne(e)&&e.shiftKey},Ke=function(e){return setTimeout(e,0)},Ge=function(e,t){var r=-1;return e.every(function(i,s){return t(i)?(r=s,!1):!0}),r},ie=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?g-1:0),U=1;U=0)h=r.activeElement;else{var u=n.tabbableGroups[0],g=u&&u.firstTabbableNode;h=g||p("fallbackFocus")}if(!h)throw new Error("Your focus-trap needs to have at least one focusable element");return h},c=function(){if(n.containerGroups=n.containers.map(function(h){var u=Ct(h,s.tabbableOptions),g=Dt(h,s.tabbableOptions),T=u.length>0?u[0]:void 0,U=u.length>0?u[u.length-1]:void 0,P=g.find(function(F){return Z(F)}),D=g.slice().reverse().find(function(F){return Z(F)}),j=!!u.find(function(F){return X(F)>0});return{container:h,tabbableNodes:u,focusableNodes:g,posTabIndexesFound:j,firstTabbableNode:T,lastTabbableNode:U,firstDomTabbableNode:P,lastDomTabbableNode:D,nextTabbableNode:function(J){var te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,K=u.indexOf(J);return K<0?te?g.slice(g.indexOf(J)+1).find(function(re){return Z(re)}):g.slice(0,g.indexOf(J)).reverse().find(function(re){return Z(re)}):u[K+(te?1:-1)]}}}),n.tabbableGroups=n.containerGroups.filter(function(h){return h.tabbableNodes.length>0}),n.tabbableGroups.length<=0&&!p("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(n.containerGroups.find(function(h){return h.posTabIndexesFound})&&n.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},v=function O(h){var u=h.activeElement;if(u)return u.shadowRoot&&u.shadowRoot.activeElement!==null?O(u.shadowRoot):u},b=function O(h){if(h!==!1&&h!==v(document)){if(!h||!h.focus){O(f());return}h.focus({preventScroll:!!s.preventScroll}),n.mostRecentlyFocusedNode=h,qt(h)&&h.select()}},y=function(h){var u=p("setReturnFocus",h);return u||(u===!1?!1:h)},I=function(h){var u=h.target,g=h.event,T=h.isBackward,U=T===void 0?!1:T;u=u||de(g),c();var P=null;if(n.tabbableGroups.length>0){var D=a(u,g),j=D>=0?n.containerGroups[D]:void 0;if(D<0)U?P=n.tabbableGroups[n.tabbableGroups.length-1].lastTabbableNode:P=n.tabbableGroups[0].firstTabbableNode;else if(U){var F=Ge(n.tabbableGroups,function(Se){var Ie=Se.firstTabbableNode;return u===Ie});if(F<0&&(j.container===u||xe(u,s.tabbableOptions)&&!Z(u,s.tabbableOptions)&&!j.nextTabbableNode(u,!1))&&(F=D),F>=0){var J=F===0?n.tabbableGroups.length-1:F-1,te=n.tabbableGroups[J];P=X(u)>=0?te.lastTabbableNode:te.lastDomTabbableNode}else ne(g)||(P=j.nextTabbableNode(u,!1))}else{var K=Ge(n.tabbableGroups,function(Se){var Ie=Se.lastTabbableNode;return u===Ie});if(K<0&&(j.container===u||xe(u,s.tabbableOptions)&&!Z(u,s.tabbableOptions)&&!j.nextTabbableNode(u))&&(K=D),K>=0){var re=K===n.tabbableGroups.length-1?0:K+1,Fe=n.tabbableGroups[re];P=X(u)>=0?Fe.firstTabbableNode:Fe.firstDomTabbableNode}else ne(g)||(P=j.nextTabbableNode(u))}}else P=p("fallbackFocus");return P},w=function(h){var u=de(h);if(!(a(u,h)>=0)){if(ie(s.clickOutsideDeactivates,h)){l.deactivate({returnFocus:s.returnFocusOnDeactivate});return}ie(s.allowOutsideClick,h)||h.preventDefault()}},B=function(h){var u=de(h),g=a(u,h)>=0;if(g||u instanceof Document)g&&(n.mostRecentlyFocusedNode=u);else{h.stopImmediatePropagation();var T,U=!0;if(n.mostRecentlyFocusedNode)if(X(n.mostRecentlyFocusedNode)>0){var P=a(n.mostRecentlyFocusedNode),D=n.containerGroups[P].tabbableNodes;if(D.length>0){var j=D.findIndex(function(F){return F===n.mostRecentlyFocusedNode});j>=0&&(s.isKeyForward(n.recentNavEvent)?j+1=0&&(T=D[j-1],U=!1))}}else n.containerGroups.some(function(F){return F.tabbableNodes.some(function(J){return X(J)>0})})||(U=!1);else U=!1;U&&(T=I({target:n.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(n.recentNavEvent)})),b(T||n.mostRecentlyFocusedNode||f())}n.recentNavEvent=void 0},ae=function(h){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n.recentNavEvent=h;var g=I({event:h,isBackward:u});g&&(ne(h)&&h.preventDefault(),b(g))},$=function(h){if(Bt(h)&&ie(s.escapeDeactivates,h)!==!1){h.preventDefault(),l.deactivate();return}(s.isKeyForward(h)||s.isKeyBackward(h))&&ae(h,s.isKeyBackward(h))},S=function(h){var u=de(h);a(u,h)>=0||ie(s.clickOutsideDeactivates,h)||ie(s.allowOutsideClick,h)||(h.preventDefault(),h.stopImmediatePropagation())},k=function(){if(n.active)return ze.activateTrap(i,l),n.delayInitialFocusTimer=s.delayInitialFocus?Ke(function(){b(f())}):b(f()),r.addEventListener("focusin",B,!0),r.addEventListener("mousedown",w,{capture:!0,passive:!1}),r.addEventListener("touchstart",w,{capture:!0,passive:!1}),r.addEventListener("click",S,{capture:!0,passive:!1}),r.addEventListener("keydown",$,{capture:!0,passive:!1}),l},A=function(){if(n.active)return r.removeEventListener("focusin",B,!0),r.removeEventListener("mousedown",w,!0),r.removeEventListener("touchstart",w,!0),r.removeEventListener("click",S,!0),r.removeEventListener("keydown",$,!0),l},ye=function(h){var u=h.some(function(g){var T=Array.from(g.removedNodes);return T.some(function(U){return U===n.mostRecentlyFocusedNode})});u&&b(f())},we=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(ye):void 0,ee=function(){we&&(we.disconnect(),n.active&&!n.paused&&n.containers.map(function(h){we.observe(h,{subtree:!0,childList:!0})}))};return l={get active(){return n.active},get paused(){return n.paused},activate:function(h){if(n.active)return this;var u=d(h,"onActivate"),g=d(h,"onPostActivate"),T=d(h,"checkCanFocusTrap");T||c(),n.active=!0,n.paused=!1,n.nodeFocusedBeforeActivation=r.activeElement,u==null||u();var U=function(){T&&c(),k(),ee(),g==null||g()};return T?(T(n.containers.concat()).then(U,U),this):(U(),this)},deactivate:function(h){if(!n.active)return this;var u=Me({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},h);clearTimeout(n.delayInitialFocusTimer),n.delayInitialFocusTimer=void 0,A(),n.active=!1,n.paused=!1,ee(),ze.deactivateTrap(i,l);var g=d(u,"onDeactivate"),T=d(u,"onPostDeactivate"),U=d(u,"checkCanReturnFocus"),P=d(u,"returnFocus","returnFocusOnDeactivate");g==null||g();var D=function(){Ke(function(){P&&b(y(n.nodeFocusedBeforeActivation)),T==null||T()})};return P&&U?(U(y(n.nodeFocusedBeforeActivation)).then(D,D),this):(D(),this)},pause:function(h){if(n.paused||!n.active)return this;var u=d(h,"onPause"),g=d(h,"onPostPause");return n.paused=!0,u==null||u(),A(),ee(),g==null||g(),this},unpause:function(h){if(!n.paused||!n.active)return this;var u=d(h,"onUnpause"),g=d(h,"onPostUnpause");return n.paused=!1,u==null||u(),c(),k(),ee(),g==null||g(),this},updateContainerElements:function(h){var u=[].concat(h).filter(Boolean);return n.containers=u.map(function(g){return typeof g=="string"?r.querySelector(g):g}),n.active&&c(),ee(),this}},l.updateContainerElements(e),l};const W="esri-identity-modal",V={base:W,open:`${W}--open`,closed:`${W}--closed`,title:`${W}__title`,dialog:`${W}__dialog`,content:`${W}__content`,closeButton:`${W}__close-button`,iconClose:"esri-icon-close"};let H=class extends Ye{constructor(o,e){super(o,e),this.container=document.createElement("div"),this.content=null,this.open=!1,this._focusTrap=null,this._close=()=>{this.open=!1},document.body.appendChild(this.container),this.addHandles(Re(()=>this.open,()=>this._toggleFocusTrap()))}destroy(){this._destroyFocusTrap()}get title(){var o;return(o=this.messages)==null?void 0:o.auth.signIn}render(){const o=this.id,{open:e,content:t,title:r,messages:i}=this,s=e&&!!t,n={[V.open]:s,[V.closed]:!s},l=C("button",{"aria-label":i.close,bind:this,class:V.closeButton,onclick:this._close,title:i.close,type:"button"},C("span",{"aria-hidden":"true",class:V.iconClose})),d=`${o}_title`,a=`${o}_content`,p=r?C("h1",{class:V.title,id:d},r):null,f=s?C("div",{afterCreate:this._createFocusTrap,"aria-describedby":a,"aria-labelledby":d,bind:this,class:V.dialog,role:"dialog"},l,p,this._renderContent(a)):null;return C("div",{class:this.classes(V.base,n),tabIndex:-1},f)}_destroyFocusTrap(){var o;(o=this._focusTrap)==null||o.deactivate({onDeactivate:()=>{}}),this._focusTrap=null}_toggleFocusTrap(){const{_focusTrap:o,open:e}=this;o&&(e?o.activate():o.deactivate())}_createFocusTrap(o){this._destroyFocusTrap();const e=requestAnimationFrame(()=>{this._focusTrap=Kt(o,{initialFocus:"input",onDeactivate:this._close}),this._toggleFocusTrap()});this.addHandles(ct(()=>cancelAnimationFrame(e)))}_renderContent(o){const e=this.content;return typeof e=="string"?C("div",{class:V.content,id:o,innerHTML:e}):ut(e)?C("div",{class:V.content,id:o},e.render()):e instanceof HTMLElement?C("div",{afterCreate:this._attachToNode,bind:e,class:V.content,id:o}):null}_attachToNode(o){const e=this;o.appendChild(e)}};m([_({readOnly:!0})],H.prototype,"container",void 0),m([_()],H.prototype,"content",void 0),m([_()],H.prototype,"open",void 0),m([_(),We("esri/t9n/common")],H.prototype,"messages",void 0),m([_()],H.prototype,"title",null),H=m([oe("esri.identity.IdentityModal")],H);const He=H,Oe="esriJSAPIOAuth";class Ce{constructor(e,t){this.oAuthInfo=null,this.storage=null,this.appId=null,this.codeVerifier=null,this.expires=null,this.refreshToken=null,this.ssl=null,this.stateUID=null,this.token=null,this.userId=null,this.oAuthInfo=e,this.storage=t,this._init()}isValid(){let e=!1;if(this.oAuthInfo&&this.userId&&(this.refreshToken||this.token)){if(this.expires==null&&this.refreshToken)e=!0;else if(this.expires){const t=Date.now();this.expires>t&&(this.expires-t)/1e3>60*this.oAuthInfo.minTimeUntilExpiration&&(e=!0)}}return e}save(){if(!this.storage)return!1;const e=this._load(),t=this.oAuthInfo;if(t&&t.authNamespace&&t.portalUrl){let r=e[t.authNamespace];r||(r=e[t.authNamespace]={}),this.appId||(this.appId=t.appId),r[t.portalUrl]={appId:this.appId,codeVerifier:this.codeVerifier,expires:this.expires,refreshToken:this.refreshToken,ssl:this.ssl,stateUID:this.stateUID,token:this.token,userId:this.userId};try{this.storage.setItem(Oe,JSON.stringify(e))}catch(i){return console.warn(i),!1}return!0}return!1}destroy(){const e=this._load(),t=this.oAuthInfo;if(t!=null&&t.appId&&(t!=null&&t.portalUrl)&&(this.expires==null||this.expires>Date.now())&&(this.refreshToken||this.token)){const r=t.portalUrl.replace(/^http:/i,"https:")+"/sharing/rest/oauth2/revokeToken",i=new FormData;if(i.append("f","json"),i.append("auth_token",this.refreshToken||this.token),i.append("client_id",t.appId),i.append("token_type_hint",this.refreshToken?"refresh_token":"access_token"),typeof navigator.sendBeacon=="function")navigator.sendBeacon(r,i);else{const s=new XMLHttpRequest;s.open("POST",r),s.send(i)}}if(t&&t.authNamespace&&t.portalUrl&&this.storage){const r=e[t.authNamespace];if(r){delete r[t.portalUrl];try{this.storage.setItem(Oe,JSON.stringify(e))}catch(i){console.log(i)}}}t&&(t._oAuthCred=null,this.oAuthInfo=null)}_init(){const e=this._load(),t=this.oAuthInfo;if(t&&t.authNamespace&&t.portalUrl){let r=e[t.authNamespace];r&&(r=r[t.portalUrl],r&&(this.appId=r.appId,this.codeVerifier=r.codeVerifier,this.expires=r.expires,this.refreshToken=r.refreshToken,this.ssl=r.ssl,this.stateUID=r.stateUID,this.token=r.token,this.userId=r.userId))}}_load(){let e={};if(this.storage){const t=this.storage.getItem(Oe);if(t)try{e=JSON.parse(t)}catch(r){console.warn(r)}}return e}}Ce.prototype.declaredClass="esri.identity.OAuthCredential";var De;let E=De=class extends Xe{constructor(o){super(o),this._oAuthCred=null,this.appId=null,this.authNamespace="/",this.expiration=20160,this.flowType="auto",this.forceLogin=!1,this.forceUserId=!1,this.locale=null,this.minTimeUntilExpiration=30,this.popup=!1,this.popupCallbackUrl="oauth-callback.html",this.popupWindowFeatures="height=490,width=800,resizable,scrollbars,status",this.portalUrl="https://www.arcgis.com",this.preserveUrlHash=!1,this.userId=null}clone(){return De.fromJSON(this.toJSON())}};m([_({json:{write:!0}})],E.prototype,"appId",void 0),m([_({json:{write:!0}})],E.prototype,"authNamespace",void 0),m([_({json:{write:!0}})],E.prototype,"expiration",void 0),m([_({json:{write:!0}})],E.prototype,"flowType",void 0),m([_({json:{write:!0}})],E.prototype,"forceLogin",void 0),m([_({json:{write:!0}})],E.prototype,"forceUserId",void 0),m([_({json:{write:!0}})],E.prototype,"locale",void 0),m([_({json:{write:!0}})],E.prototype,"minTimeUntilExpiration",void 0),m([_({json:{write:!0}})],E.prototype,"popup",void 0),m([_({json:{write:!0}})],E.prototype,"popupCallbackUrl",void 0),m([_({json:{write:!0}})],E.prototype,"popupWindowFeatures",void 0),m([_({json:{write:!0}})],E.prototype,"portalUrl",void 0),m([_({json:{write:!0}})],E.prototype,"preserveUrlHash",void 0),m([_({json:{write:!0}})],E.prototype,"userId",void 0),E=De=m([oe("esri.identity.OAuthInfo")],E);const Je=E;let q=class extends Xe{constructor(e){super(e),this.adminTokenServiceUrl=null,this.currentVersion=null,this.hasPortal=null,this.hasServer=null,this.owningSystemUrl=null,this.owningTenant=null,this.server=null,this.shortLivedTokenValidity=null,this.tokenServiceUrl=null,this.webTierAuth=null}};m([_({json:{write:!0}})],q.prototype,"adminTokenServiceUrl",void 0),m([_({json:{write:!0}})],q.prototype,"currentVersion",void 0),m([_({json:{write:!0}})],q.prototype,"hasPortal",void 0),m([_({json:{write:!0}})],q.prototype,"hasServer",void 0),m([_({json:{write:!0}})],q.prototype,"owningSystemUrl",void 0),m([_({json:{write:!0}})],q.prototype,"owningTenant",void 0),m([_({json:{write:!0}})],q.prototype,"server",void 0),m([_({json:{write:!0}})],q.prototype,"shortLivedTokenValidity",void 0),m([_({json:{write:!0}})],q.prototype,"tokenServiceUrl",void 0),m([_({json:{write:!0}})],q.prototype,"webTierAuth",void 0),q=m([oe("esri.identity.ServerInfo")],q);const Pe=q,pe={},nt=o=>{const e=new Y(o.owningSystemUrl).host,t=new Y(o.server).host,r=/.+\.arcgis\.com$/i;return r.test(e)&&r.test(t)},Ee=(o,e)=>!!(nt(o)&&e&&e.some(t=>t.test(o.server)));let fe=null,ve=null;try{fe=window.localStorage,ve=window.sessionStorage}catch{}class ot extends Qe{constructor(){super(),this._portalConfig=globalThis.esriGeowConfig,this.serverInfos=[],this.oAuthInfos=[],this.credentials=[],this._soReqs=[],this._xoReqs=[],this._portals=[],this._defaultOAuthInfo=null,this._defaultTokenValidity=60,this.dialog=null,this.formConstructor=_t,this.tokenValidity=null,this.normalizeWebTierAuth=!1,this._appOrigin=window.origin!=="null"?window.origin:window.location.origin,this._appUrlObj=ke(window.location.href),this._busy=null,this._rejectOnPersistedPageShow=!1,this._oAuthLocationParams=null,this._gwTokenUrl="/sharing/rest/generateToken",this._agsRest="/rest/services",this._agsPortal=/\/sharing(\/|$)/i,this._agsAdmin=/(https?:\/\/[^\/]+\/[^\/]+)\/admin\/?(\/.*)?$/i,this._adminSvcs=/\/rest\/admin\/services(\/|$)/i,this._gwDomains=[{regex:/^https?:\/\/www\.arcgis\.com/i,customBaseUrl:"maps.arcgis.com",tokenServiceUrl:"https://www.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:dev|[a-z\d-]+\.mapsdev)\.arcgis\.com/i,customBaseUrl:"mapsdev.arcgis.com",tokenServiceUrl:"https://dev.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:devext|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,customBaseUrl:"mapsdevext.arcgis.com",tokenServiceUrl:"https://devext.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:qaext|[a-z\d-]+\.mapsqa)\.arcgis\.com/i,customBaseUrl:"mapsqa.arcgis.com",tokenServiceUrl:"https://qaext.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/[a-z\d-]+\.maps\.arcgis\.com/i,customBaseUrl:"maps.arcgis.com",tokenServiceUrl:"https://www.arcgis.com/sharing/rest/generateToken"}],this._legacyFed=[],this._regexSDirUrl=/http.+\/rest\/services\/?/gi,this._regexServerType=/(\/(FeatureServer|GPServer|GeoDataServer|GeocodeServer|GeoenrichmentServer|GeometryServer|GlobeServer|ImageServer|KnowledgeGraphServer|MapServer|MissionServer|MobileServer|NAServer|NetworkDiagramServer|OGCFeatureServer|ParcelFabricServer|RelationalCatalogServer|SceneServer|StreamServer|UtilityNetworkServer|ValidationServer|VectorTileServer|VersionManagementServer|VideoServer)).*/gi,this._gwUser=/http.+\/users\/([^\/]+)\/?.*/i,this._gwItem=/http.+\/items\/([^\/]+)\/?.*/i,this._gwGroup=/http.+\/groups\/([^\/]+)\/?.*/i,this._rePortalTokenSvc=/\/sharing(\/rest)?\/generatetoken/i,this._createDefaultOAuthInfo=!0,this._hasTestedIfAppIsOnPortal=!1,this._getOAuthLocationParams(),window.addEventListener("pageshow",e=>{this._pageShowHandler(e)})}registerServers(e){const t=this.serverInfos;t?(e=e.filter(r=>!this.findServerInfo(r.server)),this.serverInfos=t.concat(e)):this.serverInfos=e,e.forEach(r=>{r.owningSystemUrl&&this._portals.push(r.owningSystemUrl),r.hasPortal&&this._portals.push(r.server)})}registerOAuthInfos(e){const t=this.oAuthInfos;if(t){for(const r of e){const i=this.findOAuthInfo(r.portalUrl);i&&t.splice(t.indexOf(i),1)}this.oAuthInfos=t.concat(e)}else this.oAuthInfos=e}registerToken(e){e={...e};const t=this._sanitizeUrl(e.server),r=this._isServerRsrc(t);let i,s=this.findServerInfo(t),n=!0;s||(s=new Pe,s.server=this._getServerInstanceRoot(t),r?s.hasServer=!0:(s.tokenServiceUrl=this._getTokenSvcUrl(t),s.hasPortal=!0),this.registerServers([s])),i=this._findCredential(t),i?(delete e.server,Object.assign(i,e),n=!1):(i=new x({userId:e.userId,server:s.server,token:e.token,expires:e.expires,ssl:e.ssl,scope:r?"server":"portal"}),i.resources=[t],this.credentials.push(i)),i.emitTokenChange(!1),n||i.refreshServerTokens()}toJSON(){return Ze({serverInfos:this.serverInfos.map(e=>e.toJSON()),oAuthInfos:this.oAuthInfos.map(e=>e.toJSON()),credentials:this.credentials.map(e=>e.toJSON())})}initialize(e){if(!e)return;typeof e=="string"&&(e=JSON.parse(e));const t=e.serverInfos,r=e.oAuthInfos,i=e.credentials;if(t){const s=[];t.forEach(n=>{n.server&&n.tokenServiceUrl&&s.push(n.declaredClass?n:new Pe(n))}),s.length&&this.registerServers(s)}if(r){const s=[];r.forEach(n=>{n.appId&&s.push(n.declaredClass?n:new Je(n))}),s.length&&this.registerOAuthInfos(s)}i&&i.forEach(s=>{s.server&&s.token&&s.expires&&s.expires>Date.now()&&((s=s.declaredClass?s:new x(s)).emitTokenChange(),this.credentials.push(s))})}findServerInfo(e){let t;e=this._sanitizeUrl(e);for(const r of this.serverInfos)if(this._hasSameServerInstance(r.server,e)){t=r;break}return t}findOAuthInfo(e){let t;e=this._sanitizeUrl(e);for(const r of this.oAuthInfos)if(this._hasSameServerInstance(r.portalUrl,e)){t=r;break}return t}findCredential(e,t){if(!e)return;let r;e=this._sanitizeUrl(e);const i=this._isServerRsrc(e)?"server":"portal";if(t){for(const s of this.credentials)if(this._hasSameServerInstance(s.server,e)&&t===s.userId&&s.scope===i){r=s;break}}else for(const s of this.credentials)if(this._hasSameServerInstance(s.server,e)&&this._getIdenticalSvcIdx(e,s)!==-1&&s.scope===i){r=s;break}return r}getCredential(e,t){let r,i,s=!0;t&&(r=!!t.token,i=t.error,s=t.prompt!==!1),t={...t},e=this._sanitizeUrl(e);const n=new AbortController,l=le();if(t.signal&&se(t.signal,()=>{n.abort()}),se(n,()=>{l.reject(new N("identity-manager:user-aborted","ABORTED"))}),ht(n))return l.promise;t.signal=n.signal;const d=this._isAdminResource(e),a=r?this.findCredential(e):null;let p;if(a&&i&&i.details&&i.details.httpStatus===498)a.destroy();else if(a)return p=new N("identity-manager:not-authorized","You are currently signed in as: '"+a.userId+"'. You do not have access to this resource: "+e,{error:i}),l.reject(p),l.promise;const f=this._findCredential(e,t);if(f)return l.resolve(f),l.promise;let c=this.findServerInfo(e);if(c)!c.hasPortal&&c.server&&c.owningSystemUrl&&this._hasSameServerInstance(c.server,c.owningSystemUrl)&&(c.hasPortal=!0),!c.hasServer&&this._isServerRsrc(e)&&(c._restInfoPms=this._getTokenSvcUrl(e),c.hasServer=!0);else{const v=this._getTokenSvcUrl(e);if(!v)return p=new N("identity-manager:unknown-resource","Unknown resource - could not find token service endpoint."),l.reject(p),l.promise;c=new Pe,c.server=this._getServerInstanceRoot(e),typeof v=="string"?(c.tokenServiceUrl=v,c.hasPortal=!0):(c._restInfoPms=v,c.hasServer=!0),this.registerServers([c])}return c.hasPortal&&c._selfReq===void 0&&(s||G(c.tokenServiceUrl,this._appOrigin)||this._gwDomains.some(v=>v.tokenServiceUrl===c.tokenServiceUrl))&&(c._selfReq={owningTenant:t==null?void 0:t.owningTenant,selfDfd:this._getPortalSelf(c.tokenServiceUrl.replace(this._rePortalTokenSvc,"/sharing/rest/portals/self"),e)}),this._enqueue(e,c,t,l,d)}getResourceName(e){return this._isRESTService(e)?e.replace(this._regexSDirUrl,"").replace(this._regexServerType,"")||"":this._gwUser.test(e)&&e.replace(this._gwUser,"$1")||this._gwItem.test(e)&&e.replace(this._gwItem,"$1")||this._gwGroup.test(e)&&e.replace(this._gwGroup,"$1")||""}generateToken(e,t,r){const i=this._rePortalTokenSvc.test(e.tokenServiceUrl),s=new Y(this._appOrigin),n=e.shortLivedTokenValidity;let l,d,a,p,f,c,v,b;t&&(b=this.tokenValidity||n||this._defaultTokenValidity,b>n&&n>0&&(b=n)),r&&(l=r.isAdmin,d=r.serverUrl,a=r.token,c=r.signal,v=r.ssl,e.customParameters=r.customParameters),l?p=e.adminTokenServiceUrl:(p=e.tokenServiceUrl,f=new Y(p.toLowerCase()),e.webTierAuth&&(r!=null&&r.serverUrl)&&!v&&s.scheme==="http"&&(G(s.uri,p,!0)||f.scheme==="https"&&s.host===f.host&&s.port==="7080"&&f.port==="7443")&&(p=p.replace(/^https:/i,"http:").replace(/:7443/i,":7080")));const y={query:{request:"getToken",username:t==null?void 0:t.username,password:t==null?void 0:t.password,serverUrl:d,token:a,expiration:b,referer:l||i?this._appOrigin:null,client:l?"referer":null,f:"json",...e.customParameters},method:"post",authMode:"anonymous",useProxy:this._useProxy(e,r),signal:c,...r==null?void 0:r.ioArgs};return i||(y.withCredentials=!1),M(p,y).then(I=>{const w=I.data;if(!(w!=null&&w.token))return new N("identity-manager:authentication-failed","Unable to generate token");const B=e.server;return pe[B]||(pe[B]={}),t&&(pe[B][t.username]=t.password),w.validity=b,w})}isBusy(){return!!this._busy}checkSignInStatus(e){return this.checkAppAccess(e,"").then(t=>t.credential)}checkAppAccess(e,t,r){let i=!1;return this.getCredential(e,{prompt:!1}).then(s=>{let n;const l={f:"json"};if(s.scope==="portal")if(t&&(this._doPortalSignIn(e)||r!=null&&r.force))n=s.server+"/sharing/rest/oauth2/validateAppAccess",l.client_id=t;else{if(!s.token)return{credential:s};n=s.server+"/sharing/rest"}else{if(!s.token)return{credential:s};n=s.server+"/rest/services"}return s.token&&(l.token=s.token),M(n,{query:l,authMode:"anonymous"}).then(d=>{if(d.data.valid===!1)throw new N("identity-manager:not-authorized",`You are currently signed in as: '${s.userId}'.`,d.data);return i=!!d.data.viewOnlyUserTypeApp,{credential:s}}).catch(d=>{var p;if(d.name==="identity-manager:not-authorized")throw d;const a=(p=d.details)==null?void 0:p.httpStatus;if(a===498)throw s.destroy(),new N("identity-manager:not-authenticated","User is not signed in.");if(a===400)throw new N("identity-manager:invalid-request");return{credential:s}})}).then(s=>({credential:s.credential,viewOnly:i}))}setOAuthResponseHash(e){e&&(e.charAt(0)==="#"&&(e=e.substring(1)),this._processOAuthPopupParams(ce(e)))}setOAuthRedirectionHandler(e){this._oAuthRedirectFunc=e}setProtocolErrorHandler(e){this._protocolFunc=e}signIn(e,t,r={}){const i=le(),s=()=>{var f;d==null||d.remove(),a==null||a.remove(),p==null||p.remove(),l==null||l.destroy(),(f=this.dialog)==null||f.destroy(),this.dialog=l=d=a=p=null},n=()=>{s(),this._oAuthDfd=null,i.reject(new N("identity-manager:user-aborted","ABORTED"))};r.signal&&se(r.signal,()=>{n()});let l=new this.formConstructor;l.resource=this.getResourceName(e),l.server=t.server,this.dialog=new He,this.dialog.content=l,this.dialog.open=!0,this.emit("dialog-create");let d=l.on("cancel",n),a=Re(()=>this.dialog.open,n),p=l.on("submit",f=>{this.generateToken(t,f,{isAdmin:r.isAdmin,signal:r.signal}).then(c=>{s();const v=new x({userId:f.username,server:t.server,token:c.token,expires:c.expires!=null?Number(c.expires):null,ssl:!!c.ssl,isAdmin:r.isAdmin,validity:c.validity});i.resolve(v)}).catch(c=>{l.error=c,l.signingIn=!1})});return i.promise}oAuthSignIn(e,t,r,i){this._oAuthDfd=le();const s=this._oAuthDfd;let n;i!=null&&i.signal&&se(i.signal,()=>{const b=this._oAuthDfd&&this._oAuthDfd.oAuthWin_;b&&!b.closed?b.close():this.dialog&&c()}),s.resUrl_=e,s.sinfo_=t,s.oinfo_=r;const l=r._oAuthCred;if(l.storage&&(r.flowType==="authorization-code"||r.flowType==="auto"&&t.currentVersion>=8.4)){let b=crypto.getRandomValues(new Uint8Array(32));n=Ae(b),l.codeVerifier=n,b=crypto.getRandomValues(new Uint8Array(32)),l.stateUID=Ae(b),l.save()||(l.codeVerifier=n=null)}else l.codeVerifier=null;let d,a,p,f;this._getCodeChallenge(n).then(b=>{const y=!i||i.oAuthPopupConfirmation!==!1;r.popup&&y?(d=new this.formConstructor,d.oAuthPrompt=!0,d.server=t.server,this.dialog=new He,this.dialog.content=d,this.dialog.open=!0,this.emit("dialog-create"),a=d.on("cancel",c),p=Re(()=>this.dialog.open,c),f=d.on("submit",()=>{v(),this._doOAuthSignIn(e,t,r,b)})):this._doOAuthSignIn(e,t,r,b)});const c=()=>{v(),this._oAuthDfd=null,s.reject(new N("identity-manager:user-aborted","ABORTED"))},v=()=>{var b;a==null||a.remove(),p==null||p.remove(),f==null||f.remove(),d==null||d.destroy(),(b=this.dialog)==null||b.destroy(),this.dialog=null};return s.promise}destroyCredentials(){this.credentials&&this.credentials.slice().forEach(e=>{e.destroy()}),this.emit("credentials-destroy")}enablePostMessageAuth(e="https://www.arcgis.com/sharing/rest"){this._postMessageAuthHandle&&this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=Te(window,"message",t=>{var r;if((t.origin===this._appOrigin||t.origin.endsWith(".arcgis.com"))&&((r=t.data)==null?void 0:r.type)==="arcgis:auth:requestCredential"){const i=t.source;this.getCredential(e).then(s=>{i.postMessage({type:"arcgis:auth:credential",credential:{expires:s.expires,server:s.server,ssl:s.ssl,token:s.token,userId:s.userId}},t.origin)}).catch(s=>{i.postMessage({type:"arcgis:auth:error",error:{name:s.name,message:s.message}},t.origin)})}})}disablePostMessageAuth(){this._postMessageAuthHandle&&(this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=null)}_getOAuthLocationParams(){var r,i;let e=window.location.hash;if(e){e.charAt(0)==="#"&&(e=e.substring(1));const s=ce(e);let n=!1;if(s.access_token&&s.expires_in&&s.state&&s.hasOwnProperty("username"))try{s.state=JSON.parse(s.state),s.state.portalUrl&&(this._oAuthLocationParams=s,n=!0)}catch{}else if(s.error&&s.error_description&&(console.log("IdentityManager OAuth Error: ",s.error," - ",s.error_description),s.error==="access_denied"&&(n=!0,s.state)))try{s.state=JSON.parse(s.state)}catch{}n&&(window.location.hash=((r=s.state)==null?void 0:r.hash)||"")}let t=window.location.search;if(t){t.charAt(0)==="?"&&(t=t.substring(1));const s=ce(t);let n=!1;if(s.code&&s.state)try{s.state=JSON.parse(s.state),s.state.portalUrl&&s.state.uid&&(this._oAuthLocationParams=s,n=!0)}catch{}else if(s.error&&s.error_description&&(console.log("IdentityManager OAuth Error: ",s.error," - ",s.error_description),s.error==="access_denied"&&(n=!0,s.state)))try{s.state=JSON.parse(s.state)}catch{}if(n){const l={...s};["code","error","error_description","message_code","persist","state"].forEach(p=>{delete l[p]});const d=Le(l),a=window.location.pathname+(d?`?${d}`:"")+(((i=s.state)==null?void 0:i.hash)||"");window.history.replaceState(window.history.state,"",a)}}}_getOAuthToken(e,t,r,i,s){return e=e.replace(/^http:/i,"https:"),M(`${e}/sharing/rest/oauth2/token`,{authMode:"anonymous",method:"post",query:i&&s?{grant_type:"authorization_code",code:t,redirect_uri:i,client_id:r,code_verifier:s}:{grant_type:"refresh_token",refresh_token:t,client_id:r}}).then(n=>n.data)}_getCodeChallenge(e){if(e&&globalThis.isSecureContext){const t=new TextEncoder().encode(e);return crypto.subtle.digest("SHA-256",t).then(r=>Ae(new Uint8Array(r)))}return Promise.resolve(null)}_pageShowHandler(e){if(e.persisted&&this.isBusy()&&this._rejectOnPersistedPageShow){const t=new N("identity-manager:user-aborted","ABORTED");this._errbackFunc(t)}}_findCredential(e,t){let r,i,s,n,l=-1;const d=t==null?void 0:t.token,a=t==null?void 0:t.resource,p=this._isServerRsrc(e)?"server":"portal",f=this.credentials.filter(c=>this._hasSameServerInstance(c.server,e)&&c.scope===p);if(e=a||e,f.length)if(f.length===1){if(r=f[0],s=this.findServerInfo(r.server),i=s==null?void 0:s.owningSystemUrl,n=i?this.findCredential(i,r.userId):void 0,l=this._getIdenticalSvcIdx(e,r),!d)return l===-1&&r.resources.push(e),this._addResource(e,n),r;l!==-1&&(r.resources.splice(l,1),this._removeResource(e,n))}else{let c,v;if(f.some(b=>(v=this._getIdenticalSvcIdx(e,b),v!==-1&&(c=b,s=this.findServerInfo(c.server),i=s==null?void 0:s.owningSystemUrl,n=i?this.findCredential(i,c.userId):void 0,l=v,!0))),d)c&&(c.resources.splice(l,1),this._removeResource(e,n));else if(c)return this._addResource(e,n),c}}_findOAuthInfo(e){let t=this.findOAuthInfo(e);if(!t){for(const r of this.oAuthInfos)if(this._isIdProvider(r.portalUrl,e)){t=r;break}}return t}_addResource(e,t){t&&this._getIdenticalSvcIdx(e,t)===-1&&t.resources.push(e)}_removeResource(e,t){let r=-1;t&&(r=this._getIdenticalSvcIdx(e,t),r>-1&&t.resources.splice(r,1))}_useProxy(e,t){return(t==null?void 0:t.isAdmin)&&!G(e.adminTokenServiceUrl,this._appOrigin)||!this._isPortalDomain(e.tokenServiceUrl)&&String(e.currentVersion)==="10.1"&&!G(e.tokenServiceUrl,this._appOrigin)}_getOrigin(e){const t=new Y(e);return t.scheme+"://"+t.host+(t.port!=null?":"+t.port:"")}_getServerInstanceRoot(e){const t=e.toLowerCase();let r=t.indexOf(this._agsRest);return r===-1&&this._isAdminResource(e)&&(r=this._agsAdmin.test(e)?e.replace(this._agsAdmin,"$1").length:e.search(this._adminSvcs)),r!==-1||dt(t)||(r=t.indexOf("/sharing")),r===-1&&t.substr(-1)==="/"&&(r=t.length-1),r>-1?e.substring(0,r):e}_hasSameServerInstance(e,t){return e.substr(-1)==="/"&&(e=e.slice(0,-1)),e=e.toLowerCase(),t=this._getServerInstanceRoot(t).toLowerCase(),e=this._normalizeAGOLorgDomain(e),t=this._normalizeAGOLorgDomain(t),(e=e.substr(e.indexOf(":")))===(t=t.substr(t.indexOf(":")))}_normalizeAGOLorgDomain(e){const t=/^https?:\/\/(?:cdn|[a-z\d-]+\.maps)\.arcgis\.com/i,r=/^https?:\/\/(?:cdndev|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,i=/^https?:\/\/(?:cdnqa|[a-z\d-]+\.mapsqa)\.arcgis\.com/i;return t.test(e)?e=e.replace(t,"https://www.arcgis.com"):r.test(e)?e=e.replace(r,"https://devext.arcgis.com"):i.test(e)&&(e=e.replace(i,"https://qaext.arcgis.com")),e}_sanitizeUrl(e){const t=(Ue.request.proxyUrl||"").toLowerCase(),r=t?e.toLowerCase().indexOf(t+"?"):-1;return r!==-1&&(e=e.substring(r+t.length+1)),e=pt(e),ke(e).path}_isRESTService(e){return e.includes(this._agsRest)}_isAdminResource(e){return this._agsAdmin.test(e)||this._adminSvcs.test(e)}_isServerRsrc(e){return this._isRESTService(e)||this._isAdminResource(e)}_isIdenticalService(e,t){let r=!1;if(this._isRESTService(e)&&this._isRESTService(t)){const i=this._getSuffix(e).toLowerCase(),s=this._getSuffix(t).toLowerCase();if(r=i===s,!r){const n=/(.*)\/(MapServer|FeatureServer|UtilityNetworkServer).*/gi;r=i.replaceAll(n,"$1")===s.replaceAll(n,"$1")}}else this._isAdminResource(e)&&this._isAdminResource(t)?r=!0:this._isServerRsrc(e)||this._isServerRsrc(t)||!this._isPortalDomain(e)||(r=!0);return r}_isPortalDomain(e){const t=new Y(e.toLowerCase()),r=this._portalConfig;let i=this._gwDomains.some(s=>s.regex.test(t.uri));return!i&&r&&(i=this._hasSameServerInstance(this._getServerInstanceRoot(r.restBaseUrl),t.uri)),i||Ue.portalUrl&&(i=G(t,Ue.portalUrl,!0)),i||(i=this._portals.some(s=>this._hasSameServerInstance(s,t.uri))),i=i||this._agsPortal.test(t.path),i}_isIdProvider(e,t){let r=-1,i=-1;this._gwDomains.forEach((n,l)=>{r===-1&&n.regex.test(e)&&(r=l),i===-1&&n.regex.test(t)&&(i=l)});let s=!1;if(r>-1&&i>-1&&(r===0||r===4?i!==0&&i!==4||(s=!0):r===1?i!==1&&i!==2||(s=!0):r===2?i===2&&(s=!0):r===3&&i===3&&(s=!0)),!s){const n=this.findServerInfo(t),l=n==null?void 0:n.owningSystemUrl;l&&nt(n)&&this._isPortalDomain(l)&&this._isIdProvider(e,l)&&(s=!0)}return s}_getIdenticalSvcIdx(e,t){let r=-1;for(let i=0;in.data),{adminUrl:t,promise:r}}if(this._isPortalDomain(e)){let s="";if(this._gwDomains.some(n=>(n.regex.test(e)&&(s=n.tokenServiceUrl),!!s)),s||this._portals.some(n=>(this._hasSameServerInstance(n,e)&&(s=n+this._gwTokenUrl),!!s)),s||(i=e.toLowerCase().indexOf("/sharing"),i!==-1&&(s=e.substring(0,i)+this._gwTokenUrl)),s||(s=this._getOrigin(e)+this._gwTokenUrl),s){const n=new Y(e).port;/^http:\/\//i.test(e)&&n==="7080"&&(s=s.replace(/:7080/i,":7443")),s=s.replace(/http:/i,"https:")}return s}if(e.toLowerCase().includes("premium.arcgisonline.com"))return"https://premium.arcgisonline.com/server/tokens"}_processOAuthResponseParams(e,t,r){const i=t._oAuthCred;if(e.code){const n=i.codeVerifier;return i.codeVerifier=null,i.stateUID=null,i.save(),this._getOAuthToken(r.server,e.code,t.appId,this._getRedirectURI(t,!0),n).then(l=>{const d=new x({userId:l.username,server:r.server,token:l.access_token,expires:Date.now()+1e3*l.expires_in,ssl:l.ssl,oAuthState:e.state,_oAuthCred:i});return t.userId=d.userId,i.storage=l.persist?fe:ve,i.refreshToken=l.refresh_token,i.token=null,i.expires=l.refresh_token_expires_in?Date.now()+1e3*l.refresh_token_expires_in:null,i.userId=d.userId,i.ssl=d.ssl,i.save(),d})}const s=new x({userId:e.username,server:r.server,token:e.access_token,expires:Date.now()+1e3*Number(e.expires_in),ssl:e.ssl==="true",oAuthState:e.state,_oAuthCred:i});return t.userId=s.userId,i.storage=e.persist?fe:ve,i.refreshToken=null,i.token=s.token,i.expires=s.expires,i.userId=s.userId,i.ssl=s.ssl,i.save(),Promise.resolve(s)}_processOAuthPopupParams(e){var r;const t=this._oAuthDfd;if(this._oAuthDfd=null,t)if(clearInterval(this._oAuthIntervalId),(r=this._oAuthOnPopupHandle)==null||r.remove(),e.error){const i=e.error==="access_denied",s=new N(i?"identity-manager:user-aborted":"identity-manager:authentication-failed",i?"ABORTED":"OAuth: "+e.error+" - "+e.error_description);t.reject(s)}else this._processOAuthResponseParams(e,t.oinfo_,t.sinfo_).then(i=>{t.resolve(i)}).catch(i=>{t.reject(i)})}_setOAuthResponseQueryString(e){e&&(e.charAt(0)==="?"&&(e=e.substring(1)),this._processOAuthPopupParams(ce(e)))}_exchangeToken(e,t,r){return M(`${e}/sharing/rest/oauth2/exchangeToken`,{authMode:"anonymous",method:"post",query:{f:"json",client_id:t,token:r}}).then(i=>i.data.token)}_getPlatformSelf(e,t){return e=e.replace(/^http:/i,"https:"),M(`${e}/sharing/rest/oauth2/platformSelf`,{authMode:"anonymous",headers:{"X-Esri-Auth-Client-Id":t,"X-Esri-Auth-Redirect-Uri":window.location.href.replace(/#.*$/,"")},method:"post",query:{f:"json",expiration:30},withCredentials:!0}).then(r=>r.data)}_getPortalSelf(e,t){let r;return this._gwDomains.some(i=>(i.regex.test(e)&&(r=i.customBaseUrl),!!r)),r?Promise.resolve({allSSL:!0,currentVersion:"8.4",customBaseUrl:r,portalMode:"multitenant",supportsOAuth:!0}):(this._appOrigin.startsWith("https:")?e=e.replace(/^http:/i,"https:").replace(/:7080/i,":7443"):/^http:/i.test(t)&&(e=e.replace(/^https:/i,"http:").replace(/:7443/i,":7080")),M(e,{query:{f:"json"},authMode:"anonymous",withCredentials:!0}).then(i=>i.data))}_doPortalSignIn(e){const t=this._portalConfig,r=window.location.href,i=this.findServerInfo(e);return!(!t&&!this._isPortalDomain(r)||!(i?i.hasPortal||i.owningSystemUrl&&this._isPortalDomain(i.owningSystemUrl):this._isPortalDomain(e))||!(this._isIdProvider(r,e)||t&&(this._hasSameServerInstance(this._getServerInstanceRoot(t.restBaseUrl),e)||this._isIdProvider(t.restBaseUrl,e))||G(r,e,!0)))}_checkProtocol(e,t,r,i){let s=!0;const n=i?t.adminTokenServiceUrl:t.tokenServiceUrl;return n.trim().toLowerCase().startsWith("https:")&&!this._appOrigin.startsWith("https:")&&ft(n)&&(s=!!this._protocolFunc&&!!this._protocolFunc({resourceUrl:e,serverInfo:t}),!s)&&r(new N("identity-manager:aborted","Aborted the Sign-In process to avoid sending password over insecure connection.")),s}_enqueue(e,t,r,i,s,n){return i||(i=le()),i.resUrl_=e,i.sinfo_=t,i.options_=r,i.admin_=s,i.refresh_=n,this._busy?this._hasSameServerInstance(this._getServerInstanceRoot(e),this._busy.resUrl_)?(this._oAuthDfd&&this._oAuthDfd.oAuthWin_&&this._oAuthDfd.oAuthWin_.focus(),this._soReqs.push(i)):this._xoReqs.push(i):this._doSignIn(i),i.promise}_doSignIn(e){this._busy=e,this._rejectOnPersistedPageShow=!1;const t=a=>{var I;const p=(I=e.options_)==null?void 0:I.resource,f=e.resUrl_,c=e.refresh_;let v=!1;this.credentials.includes(a)||(c&&this.credentials.includes(c)?(c.userId=a.userId,c.token=a.token,c.expires=a.expires,c.validity=a.validity,c.ssl=a.ssl,c.creationTime=a.creationTime,v=!0,a=c):this.credentials.push(a)),a.resources||(a.resources=[]),a.resources.includes(p||f)||a.resources.push(p||f),a.scope=this._isServerRsrc(f)?"server":"portal",a.emitTokenChange();const b=this._soReqs,y={};this._soReqs=[],b.forEach(w=>{if(!this._isIdenticalService(f,w.resUrl_)){const B=this._getSuffix(w.resUrl_);y[B]||(y[B]=!0,a.resources.push(w.resUrl_))}}),e.resolve(a),b.forEach(w=>{this._hasSameServerInstance(this._getServerInstanceRoot(f),w.resUrl_)?w.resolve(a):this._soReqs.push(w)}),this._busy=e.resUrl_=e.sinfo_=e.refresh_=null,v||this.emit("credential-create",{credential:a}),this._soReqs.length?this._doSignIn(this._soReqs.shift()):this._xoReqs.length&&this._doSignIn(this._xoReqs.shift())},r=a=>{e.reject(a),this._busy=e.resUrl_=e.sinfo_=e.refresh_=null,this._soReqs.length?this._doSignIn(this._soReqs.shift()):this._xoReqs.length&&this._doSignIn(this._xoReqs.shift())},i=(a,p,f,c)=>{var B,ae,$;const v=e.sinfo_,b=!e.options_||e.options_.prompt!==!1,y=v.hasPortal&&this._findOAuthInfo(e.resUrl_);let I,w;if(a)t(new x({userId:a,server:v.server,token:f||null,expires:c!=null?Number(c):null,ssl:!!p}));else if(window!==window.parent&&((B=this._appUrlObj.query)!=null&&B["arcgis-auth-origin"])&&((ae=this._appUrlObj.query)!=null&&ae["arcgis-auth-portal"])&&this._hasSameServerInstance(this._getServerInstanceRoot(this._appUrlObj.query["arcgis-auth-portal"]),e.resUrl_)){window.parent.postMessage({type:"arcgis:auth:requestCredential"},this._appUrlObj.query["arcgis-auth-origin"]);const S=Te(window,"message",k=>{k.source===window.parent&&k.data&&(k.data.type==="arcgis:auth:credential"?(S.remove(),k.data.credential.expires{S.remove()})}else if(y){let S=y._oAuthCred;if(!S){const k=new Ce(y,fe),A=new Ce(y,ve);k.isValid()&&A.isValid()?k.expires>A.expires?(S=k,A.destroy()):(S=A,k.destroy()):S=k.isValid()?k:A,y._oAuthCred=S}if(S.isValid()){I=new x({userId:S.userId,server:v.server,token:S.token,expires:S.expires,ssl:S.ssl,_oAuthCred:S});const k=y.appId!==S.appId&&this._doPortalSignIn(e.resUrl_);k||S.refreshToken?(e._pendingDfd=S.refreshToken?this._getOAuthToken(v.server,S.refreshToken,S.appId).then(A=>(I.expires=Date.now()+1e3*A.expires_in,I.token=A.access_token,I)):Promise.resolve(I),e._pendingDfd.then(A=>k?this._exchangeToken(A.server,y.appId,A.token).then(ye=>(A.token=ye,A)).catch(()=>A):A).then(A=>{t(A)}).catch(()=>{S==null||S.destroy(),i()})):t(I)}else if(this._oAuthLocationParams&&this._hasSameServerInstance(y.portalUrl,this._oAuthLocationParams.state.portalUrl)&&(this._oAuthLocationParams.access_token||this._oAuthLocationParams.code&&this._oAuthLocationParams.state.uid===S.stateUID&&S.codeVerifier)){const k=this._oAuthLocationParams;this._oAuthLocationParams=null,e._pendingDfd=this._processOAuthResponseParams(k,y,v).then(A=>{t(A)}).catch(r)}else{const k=()=>{b?e._pendingDfd=this.oAuthSignIn(e.resUrl_,v,y,e.options_).then(t,r):(w=new N("identity-manager:not-authenticated","User is not signed in."),r(w))};this._doPortalSignIn(e.resUrl_)?e._pendingDfd=this._getPlatformSelf(v.server,y.appId).then(A=>{G(A.portalUrl,this._appOrigin,!0)?(I=new x({userId:A.username,server:v.server,expires:Date.now()+1e3*A.expires_in,token:A.token}),t(I)):k()}).catch(k):k()}}else if(b){if(this._checkProtocol(e.resUrl_,v,r,e.admin_)){let S=e.options_;e.admin_&&(S=S||{},S.isAdmin=!0),e._pendingDfd=this.signIn(e.resUrl_,v,S).then(t,r)}}else w=new N("identity-manager:not-authenticated","User is not signed in."),r(w)},s=()=>{const a=e.sinfo_,p=a.owningSystemUrl,f=e.options_;let c,v,b,y;if(f&&(c=f.token,v=f.error,b=f.prompt),y=this._findCredential(p,{token:c,resource:e.resUrl_}),!y){for(const I of this.credentials)if(this._isIdProvider(p,I.server)){y=I;break}}if(y){const I=this.findCredential(e.resUrl_,y.userId);if(I)t(I);else if(Ee(a,this._legacyFed)){const w=y.toJSON();w.server=a.server,w.resources=null,t(new x(w))}else(e._pendingDfd=this.generateToken(this.findServerInfo(y.server),null,{serverUrl:e.resUrl_,token:y.token,signal:e.options_.signal,ssl:y.ssl})).then(w=>{t(new x({userId:y==null?void 0:y.userId,server:a.server,token:w.token,expires:w.expires!=null?Number(w.expires):null,ssl:!!w.ssl,isAdmin:e.admin_,validity:w.validity}))},r)}else this._busy=null,c&&(e.options_.token=null),(e._pendingDfd=this.getCredential(p.replace(/\/?$/,"/sharing"),{resource:e.resUrl_,owningTenant:a.owningTenant,signal:e.options_.signal,token:c,error:v,prompt:b})).then(()=>{this._enqueue(e.resUrl_,e.sinfo_,e.options_,e,e.admin_)},I=>{e.resUrl_=e.sinfo_=e.refresh_=null,e.reject(I)})};this._errbackFunc=r;const n=e.sinfo_.owningSystemUrl,l=this._isServerRsrc(e.resUrl_),d=e.sinfo_._restInfoPms;d?d.promise.then(a=>{const p=e.sinfo_;if(p._restInfoPms){p.adminTokenServiceUrl=p._restInfoPms.adminUrl,p._restInfoPms=null,p.tokenServiceUrl=(ue("authInfo.tokenServicesUrl",a)||ue("authInfo.tokenServiceUrl",a)||ue("tokenServiceUrl",a))??null,p.shortLivedTokenValidity=ue("authInfo.shortLivedTokenValidity",a)??null,p.currentVersion=a.currentVersion,p.owningTenant=a.owningTenant;const f=p.owningSystemUrl=a.owningSystemUrl;f&&this._portals.push(f)}l&&p.owningSystemUrl?s():i()},()=>{e.sinfo_._restInfoPms=null;const a=new N("identity-manager:server-identification-failed","Unknown resource - could not find token service endpoint.");r(a)}):l&&n?s():e.sinfo_._selfReq?e.sinfo_._selfReq.selfDfd.then(a=>{var y;const p={};let f,c,v,b;return a&&(f=(y=a.user)==null?void 0:y.username,p.username=f,p.allSSL=a.allSSL,c=a.supportsOAuth,b=parseFloat(a.currentVersion),a.portalMode==="multitenant"&&(v=a.customBaseUrl),e.sinfo_.currentVersion=b),e.sinfo_.webTierAuth=!!f,f&&this.normalizeWebTierAuth?this.generateToken(e.sinfo_,null,{ssl:p.allSSL}).catch(()=>null).then(I=>(p.portalToken=I&&I.token,p.tokenExpiration=I&&I.expires,p)):!f&&c&&b>=4.4&&!this._findOAuthInfo(e.resUrl_)?this._generateOAuthInfo({portalUrl:e.sinfo_.server,customBaseUrl:v,owningTenant:e.sinfo_._selfReq.owningTenant}).catch(()=>null).then(()=>p):p}).catch(()=>null).then(a=>{e.sinfo_._selfReq=null,a?i(a.username,a.allSSL,a.portalToken,a.tokenExpiration):i()}):i()}_generateOAuthInfo(e){let t,r=null,i=e.portalUrl;const s=e.customBaseUrl,n=e.owningTenant,l=!this._defaultOAuthInfo&&this._createDefaultOAuthInfo&&!this._hasTestedIfAppIsOnPortal;if(l){r=window.location.href;let d=r.indexOf("?");d>-1&&(r=r.slice(0,d)),d=r.search(/\/(apps|home)\//),r=d>-1?r.slice(0,d):null}return l&&r?(this._hasTestedIfAppIsOnPortal=!0,t=M(r+"/sharing/rest",{query:{f:"json"}}).then(()=>{this._defaultOAuthInfo=new Je({appId:"arcgisonline",popupCallbackUrl:r+"/home/oauth-callback.html"})})):t=Promise.resolve(),t.then(()=>{if(this._defaultOAuthInfo)return i=i.replace(/^http:/i,"https:"),M(i+"/sharing/rest/oauth2/validateRedirectUri",{query:{accountId:n,client_id:this._defaultOAuthInfo.appId,redirect_uri:qe(this._defaultOAuthInfo.popupCallbackUrl),f:"json"}}).then(d=>{if(d.data.valid){const a=this._defaultOAuthInfo.clone();d.data.urlKey&&s?a.portalUrl="https://"+d.data.urlKey.toLowerCase()+"."+s:a.portalUrl=i,a.popup=window!==window.top||!(G(i,this._appOrigin)||this._gwDomains.some(p=>p.regex.test(i)&&p.regex.test(this._appOrigin))),this.oAuthInfos.push(a)}})})}_doOAuthSignIn(e,t,r,i){const s=r._oAuthCred,n={portalUrl:r.portalUrl};!r.popup&&r.preserveUrlHash&&window.location.hash&&(n.hash=window.location.hash),s.stateUID&&(n.uid=s.stateUID);const l={client_id:r.appId,response_type:s.codeVerifier?"code":"token",state:JSON.stringify(n),expiration:r.expiration,locale:r.locale,redirect_uri:this._getRedirectURI(r,!!s.codeVerifier)};r.forceLogin&&(l.force_login=!0),r.forceUserId&&r.userId&&(l.prepopulatedusername=r.userId),!r.popup&&this._doPortalSignIn(e)&&(l.redirectToUserOrgUrl=!0),s.codeVerifier&&(l.code_challenge=i||s.codeVerifier,l.code_challenge_method=i?"S256":"plain");const d=r.portalUrl.replace(/^http:/i,"https:")+"/sharing/oauth2/authorize",a=d+"?"+Le(l);if(r.popup){const p=window.open(a,"esriJSAPIOAuth",r.popupWindowFeatures);if(p)p.focus(),this._oAuthDfd.oAuthWin_=p,this._oAuthIntervalId=setInterval(()=>{if(p.closed){clearInterval(this._oAuthIntervalId),this._oAuthOnPopupHandle.remove();const f=this._oAuthDfd;if(f){const c=new N("identity-manager:user-aborted","ABORTED");f.reject(c)}}},500),this._oAuthOnPopupHandle=Te(window,["arcgis:auth:hash","arcgis:auth:location:search"],f=>{f.type==="arcgis:auth:hash"?this.setOAuthResponseHash(f.detail):this._setOAuthResponseQueryString(f.detail)});else{const f=new N("identity-manager:popup-blocked","ABORTED");this._oAuthDfd.reject(f)}}else this._rejectOnPersistedPageShow=!0,this._oAuthRedirectFunc?this._oAuthRedirectFunc({authorizeParams:l,authorizeUrl:d,resourceUrl:e,serverInfo:t,oAuthInfo:r}):window.location.href=a}_getRedirectURI(e,t){const r=window.location.href.replace(/#.*$/,"");if(e.popup)return qe(e.popupCallbackUrl);if(t){const i=ke(r);return i.query&&["code","error","error_description","message_code","persist","state"].forEach(s=>{delete i.query[s]}),vt(i.path,i.query)}return r}}ot.prototype.declaredClass="esri.identity.IdentityManagerBase";let x=class extends Qe.EventedAccessor{constructor(o){super(o),this._oAuthCred=null,this.tokenRefreshBuffer=2,o!=null&&o._oAuthCred&&(this._oAuthCred=o._oAuthCred)}initialize(){this.resources=this.resources||[],this.creationTime==null&&(this.creationTime=Date.now())}refreshToken(){const o=R.findServerInfo(this.server),e=o==null?void 0:o.owningSystemUrl,t=!!e&&this.scope==="server",r=t&&Ee(o,R._legacyFed),i=o.webTierAuth,s=i&&R.normalizeWebTierAuth,n=pe[this.server],l=n==null?void 0:n[this.userId];let d,a=this.resources&&this.resources[0],p=t?R.findServerInfo(e):null,f={username:this.userId,password:l};if(i&&!s)return;t&&!p&&R.serverInfos.some(v=>(R._isIdProvider(e,v.server)&&(p=v),!!p));const c=p?R.findCredential(p.server,this.userId):null;if(!t||c){if(!r){if(t)d={serverUrl:a,token:c==null?void 0:c.token,ssl:c&&c.ssl};else if(s)f=null,d={ssl:this.ssl};else{if(!l){let v;return a&&(a=R._sanitizeUrl(a),this._enqueued=1,v=R._enqueue(a,o,null,null,this.isAdmin,this),v.then(()=>{this._enqueued=0,this.refreshServerTokens()}).catch(()=>{this._enqueued=0})),v}this.isAdmin&&(d={isAdmin:!0})}return R.generateToken(t?p:o,t?null:f,d).then(v=>{this.token=v.token,this.expires=v.expires!=null?Number(v.expires):null,this.creationTime=Date.now(),this.validity=v.validity,this.emitTokenChange(),this.refreshServerTokens()}).catch(()=>{})}c==null||c.refreshToken()}}refreshServerTokens(){this.scope==="portal"&&R.credentials.forEach(o=>{const e=R.findServerInfo(o.server),t=e==null?void 0:e.owningSystemUrl;o!==this&&o.userId===this.userId&&t&&o.scope==="server"&&(R._hasSameServerInstance(this.server,t)||R._isIdProvider(t,this.server))&&(Ee(e,R._legacyFed)?(o.token=this.token,o.expires=this.expires,o.creationTime=this.creationTime,o.validity=this.validity,o.emitTokenChange()):o.refreshToken())})}emitTokenChange(o){clearTimeout(this._refreshTimer);const e=this.server?R.findServerInfo(this.server):null,t=e==null?void 0:e.owningSystemUrl,r=t?R.findServerInfo(t):null;o===!1||t&&this.scope!=="portal"&&(!(r!=null&&r.webTierAuth)||R.normalizeWebTierAuth)||this.expires==null&&this.validity==null||this._startRefreshTimer(),this.emit("token-change")}destroy(){this.userId=this.server=this.token=this.expires=this.validity=this.resources=this.creationTime=null,this._oAuthCred&&(this._oAuthCred.destroy(),this._oAuthCred=null);const o=R.credentials.indexOf(this);o>-1&&R.credentials.splice(o,1),this.emitTokenChange(),this.emit("destroy")}toJSON(){const o=Ze({userId:this.userId,server:this.server,token:this.token,expires:this.expires,validity:this.validity,ssl:this.ssl,isAdmin:this.isAdmin,creationTime:this.creationTime,scope:this.scope}),e=this.resources;return e&&e.length>0&&(o.resources=e.slice()),o}_startRefreshTimer(){clearTimeout(this._refreshTimer);const o=6e4*this.tokenRefreshBuffer,e=2**31-1;let t=(this.validity?this.creationTime+6e4*this.validity:this.expires)-Date.now();t<0?t=0:t>e&&(t=e),this._refreshTimer=setTimeout(this.refreshToken.bind(this),t>o?t-o:t)}};m([_()],x.prototype,"creationTime",void 0),m([_()],x.prototype,"expires",void 0),m([_()],x.prototype,"isAdmin",void 0),m([_()],x.prototype,"oAuthState",void 0),m([_()],x.prototype,"resources",void 0),m([_()],x.prototype,"scope",void 0),m([_()],x.prototype,"server",void 0),m([_()],x.prototype,"ssl",void 0),m([_()],x.prototype,"token",void 0),m([_()],x.prototype,"tokenRefreshBuffer",void 0),m([_()],x.prototype,"userId",void 0),m([_()],x.prototype,"validity",void 0),x=m([oe("esri.identity.Credential")],x);class at extends ot{}at.prototype.declaredClass="esri.identity.IdentityManager";const Gt=new at;gt(Gt);export{Gt as default}; +*/function Ve(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable})),t.push.apply(t,r)}return t}function Me(o){for(var e=1;e0){var r=e[e.length-1];r!==t&&r.pause()}var i=e.indexOf(t);i===-1||e.splice(i,1),e.push(t)},deactivateTrap:function(e,t){var r=e.indexOf(t);r!==-1&&e.splice(r,1),e.length>0&&e[e.length-1].unpause()}},qt=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Bt=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},ne=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},Vt=function(e){return ne(e)&&!e.shiftKey},Mt=function(e){return ne(e)&&e.shiftKey},Ge=function(e){return setTimeout(e,0)},He=function(e,t){var r=-1;return e.every(function(i,s){return t(i)?(r=s,!1):!0}),r},ie=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i1?g-1:0),U=1;U=0)h=r.activeElement;else{var u=n.tabbableGroups[0],g=u&&u.firstTabbableNode;h=g||p("fallbackFocus")}if(!h)throw new Error("Your focus-trap needs to have at least one focusable element");return h},c=function(){if(n.containerGroups=n.containers.map(function(h){var u=Ct(h,s.tabbableOptions),g=Dt(h,s.tabbableOptions),T=u.length>0?u[0]:void 0,U=u.length>0?u[u.length-1]:void 0,P=g.find(function(F){return Q(F)}),D=g.slice().reverse().find(function(F){return Q(F)}),j=!!u.find(function(F){return X(F)>0});return{container:h,tabbableNodes:u,focusableNodes:g,posTabIndexesFound:j,firstTabbableNode:T,lastTabbableNode:U,firstDomTabbableNode:P,lastDomTabbableNode:D,nextTabbableNode:function(J){var te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,G=u.indexOf(J);return G<0?te?g.slice(g.indexOf(J)+1).find(function(re){return Q(re)}):g.slice(0,g.indexOf(J)).reverse().find(function(re){return Q(re)}):u[G+(te?1:-1)]}}}),n.tabbableGroups=n.containerGroups.filter(function(h){return h.tabbableNodes.length>0}),n.tabbableGroups.length<=0&&!p("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(n.containerGroups.find(function(h){return h.posTabIndexesFound})&&n.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},v=function O(h){var u=h.activeElement;if(u)return u.shadowRoot&&u.shadowRoot.activeElement!==null?O(u.shadowRoot):u},b=function O(h){if(h!==!1&&h!==v(document)){if(!h||!h.focus){O(f());return}h.focus({preventScroll:!!s.preventScroll}),n.mostRecentlyFocusedNode=h,qt(h)&&h.select()}},y=function(h){var u=p("setReturnFocus",h);return u||(u===!1?!1:h)},I=function(h){var u=h.target,g=h.event,T=h.isBackward,U=T===void 0?!1:T;u=u||de(g),c();var P=null;if(n.tabbableGroups.length>0){var D=a(u,g),j=D>=0?n.containerGroups[D]:void 0;if(D<0)U?P=n.tabbableGroups[n.tabbableGroups.length-1].lastTabbableNode:P=n.tabbableGroups[0].firstTabbableNode;else if(U){var F=He(n.tabbableGroups,function(Se){var Ie=Se.firstTabbableNode;return u===Ie});if(F<0&&(j.container===u||xe(u,s.tabbableOptions)&&!Q(u,s.tabbableOptions)&&!j.nextTabbableNode(u,!1))&&(F=D),F>=0){var J=F===0?n.tabbableGroups.length-1:F-1,te=n.tabbableGroups[J];P=X(u)>=0?te.lastTabbableNode:te.lastDomTabbableNode}else ne(g)||(P=j.nextTabbableNode(u,!1))}else{var G=He(n.tabbableGroups,function(Se){var Ie=Se.lastTabbableNode;return u===Ie});if(G<0&&(j.container===u||xe(u,s.tabbableOptions)&&!Q(u,s.tabbableOptions)&&!j.nextTabbableNode(u))&&(G=D),G>=0){var re=G===n.tabbableGroups.length-1?0:G+1,Fe=n.tabbableGroups[re];P=X(u)>=0?Fe.firstTabbableNode:Fe.firstDomTabbableNode}else ne(g)||(P=j.nextTabbableNode(u))}}else P=p("fallbackFocus");return P},w=function(h){var u=de(h);if(!(a(u,h)>=0)){if(ie(s.clickOutsideDeactivates,h)){l.deactivate({returnFocus:s.returnFocusOnDeactivate});return}ie(s.allowOutsideClick,h)||h.preventDefault()}},B=function(h){var u=de(h),g=a(u,h)>=0;if(g||u instanceof Document)g&&(n.mostRecentlyFocusedNode=u);else{h.stopImmediatePropagation();var T,U=!0;if(n.mostRecentlyFocusedNode)if(X(n.mostRecentlyFocusedNode)>0){var P=a(n.mostRecentlyFocusedNode),D=n.containerGroups[P].tabbableNodes;if(D.length>0){var j=D.findIndex(function(F){return F===n.mostRecentlyFocusedNode});j>=0&&(s.isKeyForward(n.recentNavEvent)?j+1=0&&(T=D[j-1],U=!1))}}else n.containerGroups.some(function(F){return F.tabbableNodes.some(function(J){return X(J)>0})})||(U=!1);else U=!1;U&&(T=I({target:n.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(n.recentNavEvent)})),b(T||n.mostRecentlyFocusedNode||f())}n.recentNavEvent=void 0},ae=function(h){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n.recentNavEvent=h;var g=I({event:h,isBackward:u});g&&(ne(h)&&h.preventDefault(),b(g))},$=function(h){if(Bt(h)&&ie(s.escapeDeactivates,h)!==!1){h.preventDefault(),l.deactivate();return}(s.isKeyForward(h)||s.isKeyBackward(h))&&ae(h,s.isKeyBackward(h))},S=function(h){var u=de(h);a(u,h)>=0||ie(s.clickOutsideDeactivates,h)||ie(s.allowOutsideClick,h)||(h.preventDefault(),h.stopImmediatePropagation())},k=function(){if(n.active)return ze.activateTrap(i,l),n.delayInitialFocusTimer=s.delayInitialFocus?Ge(function(){b(f())}):b(f()),r.addEventListener("focusin",B,!0),r.addEventListener("mousedown",w,{capture:!0,passive:!1}),r.addEventListener("touchstart",w,{capture:!0,passive:!1}),r.addEventListener("click",S,{capture:!0,passive:!1}),r.addEventListener("keydown",$,{capture:!0,passive:!1}),l},A=function(){if(n.active)return r.removeEventListener("focusin",B,!0),r.removeEventListener("mousedown",w,!0),r.removeEventListener("touchstart",w,!0),r.removeEventListener("click",S,!0),r.removeEventListener("keydown",$,!0),l},ye=function(h){var u=h.some(function(g){var T=Array.from(g.removedNodes);return T.some(function(U){return U===n.mostRecentlyFocusedNode})});u&&b(f())},we=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(ye):void 0,ee=function(){we&&(we.disconnect(),n.active&&!n.paused&&n.containers.map(function(h){we.observe(h,{subtree:!0,childList:!0})}))};return l={get active(){return n.active},get paused(){return n.paused},activate:function(h){if(n.active)return this;var u=d(h,"onActivate"),g=d(h,"onPostActivate"),T=d(h,"checkCanFocusTrap");T||c(),n.active=!0,n.paused=!1,n.nodeFocusedBeforeActivation=r.activeElement,u==null||u();var U=function(){T&&c(),k(),ee(),g==null||g()};return T?(T(n.containers.concat()).then(U,U),this):(U(),this)},deactivate:function(h){if(!n.active)return this;var u=Me({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},h);clearTimeout(n.delayInitialFocusTimer),n.delayInitialFocusTimer=void 0,A(),n.active=!1,n.paused=!1,ee(),ze.deactivateTrap(i,l);var g=d(u,"onDeactivate"),T=d(u,"onPostDeactivate"),U=d(u,"checkCanReturnFocus"),P=d(u,"returnFocus","returnFocusOnDeactivate");g==null||g();var D=function(){Ge(function(){P&&b(y(n.nodeFocusedBeforeActivation)),T==null||T()})};return P&&U?(U(y(n.nodeFocusedBeforeActivation)).then(D,D),this):(D(),this)},pause:function(h){if(n.paused||!n.active)return this;var u=d(h,"onPause"),g=d(h,"onPostPause");return n.paused=!0,u==null||u(),A(),ee(),g==null||g(),this},unpause:function(h){if(!n.paused||!n.active)return this;var u=d(h,"onUnpause"),g=d(h,"onPostUnpause");return n.paused=!1,u==null||u(),c(),k(),ee(),g==null||g(),this},updateContainerElements:function(h){var u=[].concat(h).filter(Boolean);return n.containers=u.map(function(g){return typeof g=="string"?r.querySelector(g):g}),n.active&&c(),ee(),this}},l.updateContainerElements(e),l};const W="esri-identity-modal",V={base:W,open:`${W}--open`,closed:`${W}--closed`,title:`${W}__title`,dialog:`${W}__dialog`,content:`${W}__content`,closeButton:`${W}__close-button`,iconClose:"esri-icon-close"};let K=class extends Ye{constructor(o,e){super(o,e),this.container=document.createElement("div"),this.content=null,this.open=!1,this._focusTrap=null,this._close=()=>{this.open=!1},document.body.appendChild(this.container),this.addHandles(Re(()=>this.open,()=>this._toggleFocusTrap()))}destroy(){this._destroyFocusTrap()}get title(){var o;return(o=this.messages)==null?void 0:o.auth.signIn}render(){const o=this.id,{open:e,content:t,title:r,messages:i}=this,s=e&&!!t,n={[V.open]:s,[V.closed]:!s},l=C("button",{"aria-label":i.close,bind:this,class:V.closeButton,onclick:this._close,title:i.close,type:"button"},C("span",{"aria-hidden":"true",class:V.iconClose})),d=`${o}_title`,a=`${o}_content`,p=r?C("h1",{class:V.title,id:d},r):null,f=s?C("div",{afterCreate:this._createFocusTrap,"aria-describedby":a,"aria-labelledby":d,bind:this,class:V.dialog,role:"dialog"},l,p,this._renderContent(a)):null;return C("div",{class:this.classes(V.base,n),tabIndex:-1},f)}_destroyFocusTrap(){var o;(o=this._focusTrap)==null||o.deactivate({onDeactivate:()=>{}}),this._focusTrap=null}_toggleFocusTrap(){const{_focusTrap:o,open:e}=this;o&&(e?o.activate():o.deactivate())}_createFocusTrap(o){this._destroyFocusTrap();const e=requestAnimationFrame(()=>{this._focusTrap=Gt(o,{initialFocus:"input",onDeactivate:this._close}),this._toggleFocusTrap()});this.addHandles(ct(()=>cancelAnimationFrame(e)))}_renderContent(o){const e=this.content;return typeof e=="string"?C("div",{class:V.content,id:o,innerHTML:e}):ut(e)?C("div",{class:V.content,id:o},e.render()):e instanceof HTMLElement?C("div",{afterCreate:this._attachToNode,bind:e,class:V.content,id:o}):null}_attachToNode(o){const e=this;o.appendChild(e)}};m([_({readOnly:!0})],K.prototype,"container",void 0),m([_()],K.prototype,"content",void 0),m([_()],K.prototype,"open",void 0),m([_(),We("esri/t9n/common")],K.prototype,"messages",void 0),m([_()],K.prototype,"title",null),K=m([oe("esri.identity.IdentityModal")],K);const Ke=K,Oe="esriJSAPIOAuth";class Ce{constructor(e,t){this.oAuthInfo=null,this.storage=null,this.appId=null,this.codeVerifier=null,this.expires=null,this.refreshToken=null,this.ssl=null,this.stateUID=null,this.token=null,this.userId=null,this.oAuthInfo=e,this.storage=t,this._init()}isValid(){let e=!1;if(this.oAuthInfo&&this.userId&&(this.refreshToken||this.token)){if(this.expires==null&&this.refreshToken)e=!0;else if(this.expires){const t=Date.now();this.expires>t&&(this.expires-t)/1e3>60*this.oAuthInfo.minTimeUntilExpiration&&(e=!0)}}return e}save(){if(!this.storage)return!1;const e=this._load(),t=this.oAuthInfo;if(t&&t.authNamespace&&t.portalUrl){let r=e[t.authNamespace];r||(r=e[t.authNamespace]={}),this.appId||(this.appId=t.appId),r[t.portalUrl]={appId:this.appId,codeVerifier:this.codeVerifier,expires:this.expires,refreshToken:this.refreshToken,ssl:this.ssl,stateUID:this.stateUID,token:this.token,userId:this.userId};try{this.storage.setItem(Oe,JSON.stringify(e))}catch(i){return console.warn(i),!1}return!0}return!1}destroy(){const e=this._load(),t=this.oAuthInfo;if(t!=null&&t.appId&&(t!=null&&t.portalUrl)&&(this.expires==null||this.expires>Date.now())&&(this.refreshToken||this.token)){const r=t.portalUrl.replace(/^http:/i,"https:")+"/sharing/rest/oauth2/revokeToken",i=new FormData;if(i.append("f","json"),i.append("auth_token",this.refreshToken||this.token),i.append("client_id",t.appId),i.append("token_type_hint",this.refreshToken?"refresh_token":"access_token"),typeof navigator.sendBeacon=="function")navigator.sendBeacon(r,i);else{const s=new XMLHttpRequest;s.open("POST",r),s.send(i)}}if(t&&t.authNamespace&&t.portalUrl&&this.storage){const r=e[t.authNamespace];if(r){delete r[t.portalUrl];try{this.storage.setItem(Oe,JSON.stringify(e))}catch(i){console.log(i)}}}t&&(t._oAuthCred=null,this.oAuthInfo=null)}_init(){const e=this._load(),t=this.oAuthInfo;if(t&&t.authNamespace&&t.portalUrl){let r=e[t.authNamespace];r&&(r=r[t.portalUrl],r&&(this.appId=r.appId,this.codeVerifier=r.codeVerifier,this.expires=r.expires,this.refreshToken=r.refreshToken,this.ssl=r.ssl,this.stateUID=r.stateUID,this.token=r.token,this.userId=r.userId))}}_load(){let e={};if(this.storage){const t=this.storage.getItem(Oe);if(t)try{e=JSON.parse(t)}catch(r){console.warn(r)}}return e}}Ce.prototype.declaredClass="esri.identity.OAuthCredential";var De;let E=De=class extends Xe{constructor(o){super(o),this._oAuthCred=null,this.appId=null,this.authNamespace="/",this.expiration=20160,this.flowType="auto",this.forceLogin=!1,this.forceUserId=!1,this.locale=null,this.minTimeUntilExpiration=30,this.popup=!1,this.popupCallbackUrl="oauth-callback.html",this.popupWindowFeatures="height=490,width=800,resizable,scrollbars,status",this.portalUrl="https://www.arcgis.com",this.preserveUrlHash=!1,this.userId=null}clone(){return De.fromJSON(this.toJSON())}};m([_({json:{write:!0}})],E.prototype,"appId",void 0),m([_({json:{write:!0}})],E.prototype,"authNamespace",void 0),m([_({json:{write:!0}})],E.prototype,"expiration",void 0),m([_({json:{write:!0}})],E.prototype,"flowType",void 0),m([_({json:{write:!0}})],E.prototype,"forceLogin",void 0),m([_({json:{write:!0}})],E.prototype,"forceUserId",void 0),m([_({json:{write:!0}})],E.prototype,"locale",void 0),m([_({json:{write:!0}})],E.prototype,"minTimeUntilExpiration",void 0),m([_({json:{write:!0}})],E.prototype,"popup",void 0),m([_({json:{write:!0}})],E.prototype,"popupCallbackUrl",void 0),m([_({json:{write:!0}})],E.prototype,"popupWindowFeatures",void 0),m([_({json:{write:!0}})],E.prototype,"portalUrl",void 0),m([_({json:{write:!0}})],E.prototype,"preserveUrlHash",void 0),m([_({json:{write:!0}})],E.prototype,"userId",void 0),E=De=m([oe("esri.identity.OAuthInfo")],E);const Je=E;let q=class extends Xe{constructor(e){super(e),this.adminTokenServiceUrl=null,this.currentVersion=null,this.hasPortal=null,this.hasServer=null,this.owningSystemUrl=null,this.owningTenant=null,this.server=null,this.shortLivedTokenValidity=null,this.tokenServiceUrl=null,this.webTierAuth=null}};m([_({json:{write:!0}})],q.prototype,"adminTokenServiceUrl",void 0),m([_({json:{write:!0}})],q.prototype,"currentVersion",void 0),m([_({json:{write:!0}})],q.prototype,"hasPortal",void 0),m([_({json:{write:!0}})],q.prototype,"hasServer",void 0),m([_({json:{write:!0}})],q.prototype,"owningSystemUrl",void 0),m([_({json:{write:!0}})],q.prototype,"owningTenant",void 0),m([_({json:{write:!0}})],q.prototype,"server",void 0),m([_({json:{write:!0}})],q.prototype,"shortLivedTokenValidity",void 0),m([_({json:{write:!0}})],q.prototype,"tokenServiceUrl",void 0),m([_({json:{write:!0}})],q.prototype,"webTierAuth",void 0),q=m([oe("esri.identity.ServerInfo")],q);const Pe=q,pe={},nt=o=>{const e=new Y(o.owningSystemUrl).host,t=new Y(o.server).host,r=/.+\.arcgis\.com$/i;return r.test(e)&&r.test(t)},Ee=(o,e)=>!!(nt(o)&&e&&e.some(t=>t.test(o.server)));let fe=null,ve=null;try{fe=window.localStorage,ve=window.sessionStorage}catch{}class ot extends Ze{constructor(){super(),this._portalConfig=globalThis.esriGeowConfig,this.serverInfos=[],this.oAuthInfos=[],this.credentials=[],this._soReqs=[],this._xoReqs=[],this._portals=[],this._defaultOAuthInfo=null,this._defaultTokenValidity=60,this.dialog=null,this.formConstructor=_t,this.tokenValidity=null,this.normalizeWebTierAuth=!1,this._appOrigin=window.origin!=="null"?window.origin:window.location.origin,this._appUrlObj=ke(window.location.href),this._busy=null,this._rejectOnPersistedPageShow=!1,this._oAuthLocationParams=null,this._gwTokenUrl="/sharing/rest/generateToken",this._agsRest="/rest/services",this._agsPortal=/\/sharing(\/|$)/i,this._agsAdmin=/(https?:\/\/[^\/]+\/[^\/]+)\/admin\/?(\/.*)?$/i,this._adminSvcs=/\/rest\/admin\/services(\/|$)/i,this._gwDomains=[{regex:/^https?:\/\/www\.arcgis\.com/i,customBaseUrl:"maps.arcgis.com",tokenServiceUrl:"https://www.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:dev|[a-z\d-]+\.mapsdev)\.arcgis\.com/i,customBaseUrl:"mapsdev.arcgis.com",tokenServiceUrl:"https://dev.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:devext|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,customBaseUrl:"mapsdevext.arcgis.com",tokenServiceUrl:"https://devext.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/(?:qaext|[a-z\d-]+\.mapsqa)\.arcgis\.com/i,customBaseUrl:"mapsqa.arcgis.com",tokenServiceUrl:"https://qaext.arcgis.com/sharing/rest/generateToken"},{regex:/^https?:\/\/[a-z\d-]+\.maps\.arcgis\.com/i,customBaseUrl:"maps.arcgis.com",tokenServiceUrl:"https://www.arcgis.com/sharing/rest/generateToken"}],this._legacyFed=[],this._regexSDirUrl=/http.+\/rest\/services\/?/gi,this._regexServerType=/(\/(FeatureServer|GPServer|GeoDataServer|GeocodeServer|GeoenrichmentServer|GeometryServer|GlobeServer|ImageServer|KnowledgeGraphServer|MapServer|MissionServer|MobileServer|NAServer|NetworkDiagramServer|OGCFeatureServer|ParcelFabricServer|RelationalCatalogServer|SceneServer|StreamServer|UtilityNetworkServer|ValidationServer|VectorTileServer|VersionManagementServer|VideoServer)).*/gi,this._gwUser=/http.+\/users\/([^\/]+)\/?.*/i,this._gwItem=/http.+\/items\/([^\/]+)\/?.*/i,this._gwGroup=/http.+\/groups\/([^\/]+)\/?.*/i,this._rePortalTokenSvc=/\/sharing(\/rest)?\/generatetoken/i,this._createDefaultOAuthInfo=!0,this._hasTestedIfAppIsOnPortal=!1,this._getOAuthLocationParams(),window.addEventListener("pageshow",e=>{this._pageShowHandler(e)})}registerServers(e){const t=this.serverInfos;t?(e=e.filter(r=>!this.findServerInfo(r.server)),this.serverInfos=t.concat(e)):this.serverInfos=e,e.forEach(r=>{r.owningSystemUrl&&this._portals.push(r.owningSystemUrl),r.hasPortal&&this._portals.push(r.server)})}registerOAuthInfos(e){const t=this.oAuthInfos;if(t){for(const r of e){const i=this.findOAuthInfo(r.portalUrl);i&&t.splice(t.indexOf(i),1)}this.oAuthInfos=t.concat(e)}else this.oAuthInfos=e}registerToken(e){e={...e};const t=this._sanitizeUrl(e.server),r=this._isServerRsrc(t);let i,s=this.findServerInfo(t),n=!0;s||(s=new Pe,s.server=this._getServerInstanceRoot(t),r?s.hasServer=!0:(s.tokenServiceUrl=this._getTokenSvcUrl(t),s.hasPortal=!0),this.registerServers([s])),i=this._findCredential(t),i?(delete e.server,Object.assign(i,e),n=!1):(i=new x({userId:e.userId,server:s.server,token:e.token,expires:e.expires,ssl:e.ssl,scope:r?"server":"portal"}),i.resources=[t],this.credentials.push(i)),i.emitTokenChange(!1),n||i.refreshServerTokens()}toJSON(){return Qe({serverInfos:this.serverInfos.map(e=>e.toJSON()),oAuthInfos:this.oAuthInfos.map(e=>e.toJSON()),credentials:this.credentials.map(e=>e.toJSON())})}initialize(e){if(!e)return;typeof e=="string"&&(e=JSON.parse(e));const t=e.serverInfos,r=e.oAuthInfos,i=e.credentials;if(t){const s=[];t.forEach(n=>{n.server&&n.tokenServiceUrl&&s.push(n.declaredClass?n:new Pe(n))}),s.length&&this.registerServers(s)}if(r){const s=[];r.forEach(n=>{n.appId&&s.push(n.declaredClass?n:new Je(n))}),s.length&&this.registerOAuthInfos(s)}i&&i.forEach(s=>{s.server&&s.token&&s.expires&&s.expires>Date.now()&&((s=s.declaredClass?s:new x(s)).emitTokenChange(),this.credentials.push(s))})}findServerInfo(e){let t;e=this._sanitizeUrl(e);for(const r of this.serverInfos)if(this._hasSameServerInstance(r.server,e)){t=r;break}return t}findOAuthInfo(e){let t;e=this._sanitizeUrl(e);for(const r of this.oAuthInfos)if(this._hasSameServerInstance(r.portalUrl,e)){t=r;break}return t}findCredential(e,t){if(!e)return;let r;e=this._sanitizeUrl(e);const i=this._isServerRsrc(e)?"server":"portal";if(t){for(const s of this.credentials)if(this._hasSameServerInstance(s.server,e)&&t===s.userId&&s.scope===i){r=s;break}}else for(const s of this.credentials)if(this._hasSameServerInstance(s.server,e)&&this._getIdenticalSvcIdx(e,s)!==-1&&s.scope===i){r=s;break}return r}getCredential(e,t){let r,i,s=!0;t&&(r=!!t.token,i=t.error,s=t.prompt!==!1),t={...t},e=this._sanitizeUrl(e);const n=new AbortController,l=le();if(t.signal&&se(t.signal,()=>{n.abort()}),se(n,()=>{l.reject(new N("identity-manager:user-aborted","ABORTED"))}),ht(n))return l.promise;t.signal=n.signal;const d=this._isAdminResource(e),a=r?this.findCredential(e):null;let p;if(a&&i&&i.details&&i.details.httpStatus===498)a.destroy();else if(a)return p=new N("identity-manager:not-authorized","You are currently signed in as: '"+a.userId+"'. You do not have access to this resource: "+e,{error:i}),l.reject(p),l.promise;const f=this._findCredential(e,t);if(f)return l.resolve(f),l.promise;let c=this.findServerInfo(e);if(c)!c.hasPortal&&c.server&&c.owningSystemUrl&&this._hasSameServerInstance(c.server,c.owningSystemUrl)&&(c.hasPortal=!0),!c.hasServer&&this._isServerRsrc(e)&&(c._restInfoPms=this._getTokenSvcUrl(e),c.hasServer=!0);else{const v=this._getTokenSvcUrl(e);if(!v)return p=new N("identity-manager:unknown-resource","Unknown resource - could not find token service endpoint."),l.reject(p),l.promise;c=new Pe,c.server=this._getServerInstanceRoot(e),typeof v=="string"?(c.tokenServiceUrl=v,c.hasPortal=!0):(c._restInfoPms=v,c.hasServer=!0),this.registerServers([c])}return c.hasPortal&&c._selfReq===void 0&&(s||H(c.tokenServiceUrl,this._appOrigin)||this._gwDomains.some(v=>v.tokenServiceUrl===c.tokenServiceUrl))&&(c._selfReq={owningTenant:t==null?void 0:t.owningTenant,selfDfd:this._getPortalSelf(c.tokenServiceUrl.replace(this._rePortalTokenSvc,"/sharing/rest/portals/self"),e)}),this._enqueue(e,c,t,l,d)}getResourceName(e){return this._isRESTService(e)?e.replace(this._regexSDirUrl,"").replace(this._regexServerType,"")||"":this._gwUser.test(e)&&e.replace(this._gwUser,"$1")||this._gwItem.test(e)&&e.replace(this._gwItem,"$1")||this._gwGroup.test(e)&&e.replace(this._gwGroup,"$1")||""}generateToken(e,t,r){const i=this._rePortalTokenSvc.test(e.tokenServiceUrl),s=new Y(this._appOrigin),n=e.shortLivedTokenValidity;let l,d,a,p,f,c,v,b;t&&(b=this.tokenValidity||n||this._defaultTokenValidity,b>n&&n>0&&(b=n)),r&&(l=r.isAdmin,d=r.serverUrl,a=r.token,c=r.signal,v=r.ssl,e.customParameters=r.customParameters),l?p=e.adminTokenServiceUrl:(p=e.tokenServiceUrl,f=new Y(p.toLowerCase()),e.webTierAuth&&(r!=null&&r.serverUrl)&&!v&&s.scheme==="http"&&(H(s.uri,p,!0)||f.scheme==="https"&&s.host===f.host&&s.port==="7080"&&f.port==="7443")&&(p=p.replace(/^https:/i,"http:").replace(/:7443/i,":7080")));const y={query:{request:"getToken",username:t==null?void 0:t.username,password:t==null?void 0:t.password,serverUrl:d,token:a,expiration:b,referer:l||i?this._appOrigin:null,client:l?"referer":null,f:"json",...e.customParameters},method:"post",authMode:"anonymous",useProxy:this._useProxy(e,r),signal:c,...r==null?void 0:r.ioArgs};return i||(y.withCredentials=!1),M(p,y).then(I=>{const w=I.data;if(!(w!=null&&w.token))return new N("identity-manager:authentication-failed","Unable to generate token");const B=e.server;return pe[B]||(pe[B]={}),t&&(pe[B][t.username]=t.password),w.validity=b,w})}isBusy(){return!!this._busy}checkSignInStatus(e){return this.checkAppAccess(e,"").then(t=>t.credential)}checkAppAccess(e,t,r){let i=!1;return this.getCredential(e,{prompt:!1}).then(s=>{let n;const l={f:"json"};if(s.scope==="portal")if(t&&(this._doPortalSignIn(e)||r!=null&&r.force))n=s.server+"/sharing/rest/oauth2/validateAppAccess",l.client_id=t;else{if(!s.token)return{credential:s};n=s.server+"/sharing/rest"}else{if(!s.token)return{credential:s};n=s.server+"/rest/services"}return s.token&&(l.token=s.token),M(n,{query:l,authMode:"anonymous"}).then(d=>{if(d.data.valid===!1)throw new N("identity-manager:not-authorized",`You are currently signed in as: '${s.userId}'.`,d.data);return i=!!d.data.viewOnlyUserTypeApp,{credential:s}}).catch(d=>{var p;if(d.name==="identity-manager:not-authorized")throw d;const a=(p=d.details)==null?void 0:p.httpStatus;if(a===498)throw s.destroy(),new N("identity-manager:not-authenticated","User is not signed in.");if(a===400)throw new N("identity-manager:invalid-request");return{credential:s}})}).then(s=>({credential:s.credential,viewOnly:i}))}setOAuthResponseHash(e){e&&(e.charAt(0)==="#"&&(e=e.substring(1)),this._processOAuthPopupParams(ce(e)))}setOAuthRedirectionHandler(e){this._oAuthRedirectFunc=e}setProtocolErrorHandler(e){this._protocolFunc=e}signIn(e,t,r={}){const i=le(),s=()=>{var f;d==null||d.remove(),a==null||a.remove(),p==null||p.remove(),l==null||l.destroy(),(f=this.dialog)==null||f.destroy(),this.dialog=l=d=a=p=null},n=()=>{s(),this._oAuthDfd=null,i.reject(new N("identity-manager:user-aborted","ABORTED"))};r.signal&&se(r.signal,()=>{n()});let l=new this.formConstructor;l.resource=this.getResourceName(e),l.server=t.server,this.dialog=new Ke,this.dialog.content=l,this.dialog.open=!0,this.emit("dialog-create");let d=l.on("cancel",n),a=Re(()=>this.dialog.open,n),p=l.on("submit",f=>{this.generateToken(t,f,{isAdmin:r.isAdmin,signal:r.signal}).then(c=>{s();const v=new x({userId:f.username,server:t.server,token:c.token,expires:c.expires!=null?Number(c.expires):null,ssl:!!c.ssl,isAdmin:r.isAdmin,validity:c.validity});i.resolve(v)}).catch(c=>{l.error=c,l.signingIn=!1})});return i.promise}oAuthSignIn(e,t,r,i){this._oAuthDfd=le();const s=this._oAuthDfd;let n;i!=null&&i.signal&&se(i.signal,()=>{const b=this._oAuthDfd&&this._oAuthDfd.oAuthWin_;b&&!b.closed?b.close():this.dialog&&c()}),s.resUrl_=e,s.sinfo_=t,s.oinfo_=r;const l=r._oAuthCred;if(l.storage&&(r.flowType==="authorization-code"||r.flowType==="auto"&&t.currentVersion>=8.4)){let b=crypto.getRandomValues(new Uint8Array(32));n=Ae(b),l.codeVerifier=n,b=crypto.getRandomValues(new Uint8Array(32)),l.stateUID=Ae(b),l.save()||(l.codeVerifier=n=null)}else l.codeVerifier=null;let d,a,p,f;this._getCodeChallenge(n).then(b=>{const y=!i||i.oAuthPopupConfirmation!==!1;r.popup&&y?(d=new this.formConstructor,d.oAuthPrompt=!0,d.server=t.server,this.dialog=new Ke,this.dialog.content=d,this.dialog.open=!0,this.emit("dialog-create"),a=d.on("cancel",c),p=Re(()=>this.dialog.open,c),f=d.on("submit",()=>{v(),this._doOAuthSignIn(e,t,r,b)})):this._doOAuthSignIn(e,t,r,b)});const c=()=>{v(),this._oAuthDfd=null,s.reject(new N("identity-manager:user-aborted","ABORTED"))},v=()=>{var b;a==null||a.remove(),p==null||p.remove(),f==null||f.remove(),d==null||d.destroy(),(b=this.dialog)==null||b.destroy(),this.dialog=null};return s.promise}destroyCredentials(){this.credentials&&this.credentials.slice().forEach(e=>{e.destroy()}),this.emit("credentials-destroy")}enablePostMessageAuth(e="https://www.arcgis.com/sharing/rest"){this._postMessageAuthHandle&&this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=Te(window,"message",t=>{var r;if((t.origin===this._appOrigin||t.origin.endsWith(".arcgis.com"))&&((r=t.data)==null?void 0:r.type)==="arcgis:auth:requestCredential"){const i=t.source;this.getCredential(e).then(s=>{i.postMessage({type:"arcgis:auth:credential",credential:{expires:s.expires,server:s.server,ssl:s.ssl,token:s.token,userId:s.userId}},t.origin)}).catch(s=>{i.postMessage({type:"arcgis:auth:error",error:{name:s.name,message:s.message}},t.origin)})}})}disablePostMessageAuth(){this._postMessageAuthHandle&&(this._postMessageAuthHandle.remove(),this._postMessageAuthHandle=null)}_getOAuthLocationParams(){var r,i;let e=window.location.hash;if(e){e.charAt(0)==="#"&&(e=e.substring(1));const s=ce(e);let n=!1;if(s.access_token&&s.expires_in&&s.state&&s.hasOwnProperty("username"))try{s.state=JSON.parse(s.state),s.state.portalUrl&&(this._oAuthLocationParams=s,n=!0)}catch{}else if(s.error&&s.error_description&&(console.log("IdentityManager OAuth Error: ",s.error," - ",s.error_description),s.error==="access_denied"&&(n=!0,s.state)))try{s.state=JSON.parse(s.state)}catch{}n&&(window.location.hash=((r=s.state)==null?void 0:r.hash)||"")}let t=window.location.search;if(t){t.charAt(0)==="?"&&(t=t.substring(1));const s=ce(t);let n=!1;if(s.code&&s.state)try{s.state=JSON.parse(s.state),s.state.portalUrl&&s.state.uid&&(this._oAuthLocationParams=s,n=!0)}catch{}else if(s.error&&s.error_description&&(console.log("IdentityManager OAuth Error: ",s.error," - ",s.error_description),s.error==="access_denied"&&(n=!0,s.state)))try{s.state=JSON.parse(s.state)}catch{}if(n){const l={...s};["code","error","error_description","message_code","persist","state"].forEach(p=>{delete l[p]});const d=Le(l),a=window.location.pathname+(d?`?${d}`:"")+(((i=s.state)==null?void 0:i.hash)||"");window.history.replaceState(window.history.state,"",a)}}}_getOAuthToken(e,t,r,i,s){return e=e.replace(/^http:/i,"https:"),M(`${e}/sharing/rest/oauth2/token`,{authMode:"anonymous",method:"post",query:i&&s?{grant_type:"authorization_code",code:t,redirect_uri:i,client_id:r,code_verifier:s}:{grant_type:"refresh_token",refresh_token:t,client_id:r}}).then(n=>n.data)}_getCodeChallenge(e){if(e&&globalThis.isSecureContext){const t=new TextEncoder().encode(e);return crypto.subtle.digest("SHA-256",t).then(r=>Ae(new Uint8Array(r)))}return Promise.resolve(null)}_pageShowHandler(e){if(e.persisted&&this.isBusy()&&this._rejectOnPersistedPageShow){const t=new N("identity-manager:user-aborted","ABORTED");this._errbackFunc(t)}}_findCredential(e,t){let r,i,s,n,l=-1;const d=t==null?void 0:t.token,a=t==null?void 0:t.resource,p=this._isServerRsrc(e)?"server":"portal",f=this.credentials.filter(c=>this._hasSameServerInstance(c.server,e)&&c.scope===p);if(e=a||e,f.length)if(f.length===1){if(r=f[0],s=this.findServerInfo(r.server),i=s==null?void 0:s.owningSystemUrl,n=i?this.findCredential(i,r.userId):void 0,l=this._getIdenticalSvcIdx(e,r),!d)return l===-1&&r.resources.push(e),this._addResource(e,n),r;l!==-1&&(r.resources.splice(l,1),this._removeResource(e,n))}else{let c,v;if(f.some(b=>(v=this._getIdenticalSvcIdx(e,b),v!==-1&&(c=b,s=this.findServerInfo(c.server),i=s==null?void 0:s.owningSystemUrl,n=i?this.findCredential(i,c.userId):void 0,l=v,!0))),d)c&&(c.resources.splice(l,1),this._removeResource(e,n));else if(c)return this._addResource(e,n),c}}_findOAuthInfo(e){let t=this.findOAuthInfo(e);if(!t){for(const r of this.oAuthInfos)if(this._isIdProvider(r.portalUrl,e)){t=r;break}}return t}_addResource(e,t){t&&this._getIdenticalSvcIdx(e,t)===-1&&t.resources.push(e)}_removeResource(e,t){let r=-1;t&&(r=this._getIdenticalSvcIdx(e,t),r>-1&&t.resources.splice(r,1))}_useProxy(e,t){return(t==null?void 0:t.isAdmin)&&!H(e.adminTokenServiceUrl,this._appOrigin)||!this._isPortalDomain(e.tokenServiceUrl)&&String(e.currentVersion)==="10.1"&&!H(e.tokenServiceUrl,this._appOrigin)}_getOrigin(e){const t=new Y(e);return t.scheme+"://"+t.host+(t.port!=null?":"+t.port:"")}_getServerInstanceRoot(e){const t=e.toLowerCase();let r=t.indexOf(this._agsRest);return r===-1&&this._isAdminResource(e)&&(r=this._agsAdmin.test(e)?e.replace(this._agsAdmin,"$1").length:e.search(this._adminSvcs)),r!==-1||dt(t)||(r=t.indexOf("/sharing")),r===-1&&t.substr(-1)==="/"&&(r=t.length-1),r>-1?e.substring(0,r):e}_hasSameServerInstance(e,t){return e.substr(-1)==="/"&&(e=e.slice(0,-1)),e=e.toLowerCase(),t=this._getServerInstanceRoot(t).toLowerCase(),e=this._normalizeAGOLorgDomain(e),t=this._normalizeAGOLorgDomain(t),(e=e.substr(e.indexOf(":")))===(t=t.substr(t.indexOf(":")))}_normalizeAGOLorgDomain(e){const t=/^https?:\/\/(?:cdn|[a-z\d-]+\.maps)\.arcgis\.com/i,r=/^https?:\/\/(?:cdndev|[a-z\d-]+\.mapsdevext)\.arcgis\.com/i,i=/^https?:\/\/(?:cdnqa|[a-z\d-]+\.mapsqa)\.arcgis\.com/i;return t.test(e)?e=e.replace(t,"https://www.arcgis.com"):r.test(e)?e=e.replace(r,"https://devext.arcgis.com"):i.test(e)&&(e=e.replace(i,"https://qaext.arcgis.com")),e}_sanitizeUrl(e){const t=(Ue.request.proxyUrl||"").toLowerCase(),r=t?e.toLowerCase().indexOf(t+"?"):-1;return r!==-1&&(e=e.substring(r+t.length+1)),e=pt(e),ke(e).path}_isRESTService(e){return e.includes(this._agsRest)}_isAdminResource(e){return this._agsAdmin.test(e)||this._adminSvcs.test(e)}_isServerRsrc(e){return this._isRESTService(e)||this._isAdminResource(e)}_isIdenticalService(e,t){let r=!1;if(this._isRESTService(e)&&this._isRESTService(t)){const i=this._getSuffix(e).toLowerCase(),s=this._getSuffix(t).toLowerCase();if(r=i===s,!r){const n=/(.*)\/(MapServer|FeatureServer|UtilityNetworkServer).*/gi;r=i.replaceAll(n,"$1")===s.replaceAll(n,"$1")}}else this._isAdminResource(e)&&this._isAdminResource(t)?r=!0:this._isServerRsrc(e)||this._isServerRsrc(t)||!this._isPortalDomain(e)||(r=!0);return r}_isPortalDomain(e){const t=new Y(e.toLowerCase()),r=this._portalConfig;let i=this._gwDomains.some(s=>s.regex.test(t.uri));return!i&&r&&(i=this._hasSameServerInstance(this._getServerInstanceRoot(r.restBaseUrl),t.uri)),i||Ue.portalUrl&&(i=H(t,Ue.portalUrl,!0)),i||(i=this._portals.some(s=>this._hasSameServerInstance(s,t.uri))),i=i||this._agsPortal.test(t.path),i}_isIdProvider(e,t){let r=-1,i=-1;this._gwDomains.forEach((n,l)=>{r===-1&&n.regex.test(e)&&(r=l),i===-1&&n.regex.test(t)&&(i=l)});let s=!1;if(r>-1&&i>-1&&(r===0||r===4?i!==0&&i!==4||(s=!0):r===1?i!==1&&i!==2||(s=!0):r===2?i===2&&(s=!0):r===3&&i===3&&(s=!0)),!s){const n=this.findServerInfo(t),l=n==null?void 0:n.owningSystemUrl;l&&nt(n)&&this._isPortalDomain(l)&&this._isIdProvider(e,l)&&(s=!0)}return s}_getIdenticalSvcIdx(e,t){let r=-1;for(let i=0;in.data),{adminUrl:t,promise:r}}if(this._isPortalDomain(e)){let s="";if(this._gwDomains.some(n=>(n.regex.test(e)&&(s=n.tokenServiceUrl),!!s)),s||this._portals.some(n=>(this._hasSameServerInstance(n,e)&&(s=n+this._gwTokenUrl),!!s)),s||(i=e.toLowerCase().indexOf("/sharing"),i!==-1&&(s=e.substring(0,i)+this._gwTokenUrl)),s||(s=this._getOrigin(e)+this._gwTokenUrl),s){const n=new Y(e).port;/^http:\/\//i.test(e)&&n==="7080"&&(s=s.replace(/:7080/i,":7443")),s=s.replace(/http:/i,"https:")}return s}if(e.toLowerCase().includes("premium.arcgisonline.com"))return"https://premium.arcgisonline.com/server/tokens"}_processOAuthResponseParams(e,t,r){const i=t._oAuthCred;if(e.code){const n=i.codeVerifier;return i.codeVerifier=null,i.stateUID=null,i.save(),this._getOAuthToken(r.server,e.code,t.appId,this._getRedirectURI(t,!0),n).then(l=>{const d=new x({userId:l.username,server:r.server,token:l.access_token,expires:Date.now()+1e3*l.expires_in,ssl:l.ssl,oAuthState:e.state,_oAuthCred:i});return t.userId=d.userId,i.storage=l.persist?fe:ve,i.refreshToken=l.refresh_token,i.token=null,i.expires=l.refresh_token_expires_in?Date.now()+1e3*l.refresh_token_expires_in:null,i.userId=d.userId,i.ssl=d.ssl,i.save(),d})}const s=new x({userId:e.username,server:r.server,token:e.access_token,expires:Date.now()+1e3*Number(e.expires_in),ssl:e.ssl==="true",oAuthState:e.state,_oAuthCred:i});return t.userId=s.userId,i.storage=e.persist?fe:ve,i.refreshToken=null,i.token=s.token,i.expires=s.expires,i.userId=s.userId,i.ssl=s.ssl,i.save(),Promise.resolve(s)}_processOAuthPopupParams(e){var r;const t=this._oAuthDfd;if(this._oAuthDfd=null,t)if(clearInterval(this._oAuthIntervalId),(r=this._oAuthOnPopupHandle)==null||r.remove(),e.error){const i=e.error==="access_denied",s=new N(i?"identity-manager:user-aborted":"identity-manager:authentication-failed",i?"ABORTED":"OAuth: "+e.error+" - "+e.error_description);t.reject(s)}else this._processOAuthResponseParams(e,t.oinfo_,t.sinfo_).then(i=>{t.resolve(i)}).catch(i=>{t.reject(i)})}_setOAuthResponseQueryString(e){e&&(e.charAt(0)==="?"&&(e=e.substring(1)),this._processOAuthPopupParams(ce(e)))}_exchangeToken(e,t,r){return M(`${e}/sharing/rest/oauth2/exchangeToken`,{authMode:"anonymous",method:"post",query:{f:"json",client_id:t,token:r}}).then(i=>i.data.token)}_getPlatformSelf(e,t){return e=e.replace(/^http:/i,"https:"),M(`${e}/sharing/rest/oauth2/platformSelf`,{authMode:"anonymous",headers:{"X-Esri-Auth-Client-Id":t,"X-Esri-Auth-Redirect-Uri":window.location.href.replace(/#.*$/,"")},method:"post",query:{f:"json",expiration:30},withCredentials:!0}).then(r=>r.data)}_getPortalSelf(e,t){let r;return this._gwDomains.some(i=>(i.regex.test(e)&&(r=i.customBaseUrl),!!r)),r?Promise.resolve({allSSL:!0,currentVersion:"8.4",customBaseUrl:r,portalMode:"multitenant",supportsOAuth:!0}):(this._appOrigin.startsWith("https:")?e=e.replace(/^http:/i,"https:").replace(/:7080/i,":7443"):/^http:/i.test(t)&&(e=e.replace(/^https:/i,"http:").replace(/:7443/i,":7080")),M(e,{query:{f:"json"},authMode:"anonymous",withCredentials:!0}).then(i=>i.data))}_doPortalSignIn(e){const t=this._portalConfig,r=window.location.href,i=this.findServerInfo(e);return!(!t&&!this._isPortalDomain(r)||!(i?i.hasPortal||i.owningSystemUrl&&this._isPortalDomain(i.owningSystemUrl):this._isPortalDomain(e))||!(this._isIdProvider(r,e)||t&&(this._hasSameServerInstance(this._getServerInstanceRoot(t.restBaseUrl),e)||this._isIdProvider(t.restBaseUrl,e))||H(r,e,!0)))}_checkProtocol(e,t,r,i){let s=!0;const n=i?t.adminTokenServiceUrl:t.tokenServiceUrl;return n.trim().toLowerCase().startsWith("https:")&&!this._appOrigin.startsWith("https:")&&ft(n)&&(s=!!this._protocolFunc&&!!this._protocolFunc({resourceUrl:e,serverInfo:t}),!s)&&r(new N("identity-manager:aborted","Aborted the Sign-In process to avoid sending password over insecure connection.")),s}_enqueue(e,t,r,i,s,n){return i||(i=le()),i.resUrl_=e,i.sinfo_=t,i.options_=r,i.admin_=s,i.refresh_=n,this._busy?this._hasSameServerInstance(this._getServerInstanceRoot(e),this._busy.resUrl_)?(this._oAuthDfd&&this._oAuthDfd.oAuthWin_&&this._oAuthDfd.oAuthWin_.focus(),this._soReqs.push(i)):this._xoReqs.push(i):this._doSignIn(i),i.promise}_doSignIn(e){this._busy=e,this._rejectOnPersistedPageShow=!1;const t=a=>{var I;const p=(I=e.options_)==null?void 0:I.resource,f=e.resUrl_,c=e.refresh_;let v=!1;this.credentials.includes(a)||(c&&this.credentials.includes(c)?(c.userId=a.userId,c.token=a.token,c.expires=a.expires,c.validity=a.validity,c.ssl=a.ssl,c.creationTime=a.creationTime,v=!0,a=c):this.credentials.push(a)),a.resources||(a.resources=[]),a.resources.includes(p||f)||a.resources.push(p||f),a.scope=this._isServerRsrc(f)?"server":"portal",a.emitTokenChange();const b=this._soReqs,y={};this._soReqs=[],b.forEach(w=>{if(!this._isIdenticalService(f,w.resUrl_)){const B=this._getSuffix(w.resUrl_);y[B]||(y[B]=!0,a.resources.push(w.resUrl_))}}),e.resolve(a),b.forEach(w=>{this._hasSameServerInstance(this._getServerInstanceRoot(f),w.resUrl_)?w.resolve(a):this._soReqs.push(w)}),this._busy=e.resUrl_=e.sinfo_=e.refresh_=null,v||this.emit("credential-create",{credential:a}),this._soReqs.length?this._doSignIn(this._soReqs.shift()):this._xoReqs.length&&this._doSignIn(this._xoReqs.shift())},r=a=>{e.reject(a),this._busy=e.resUrl_=e.sinfo_=e.refresh_=null,this._soReqs.length?this._doSignIn(this._soReqs.shift()):this._xoReqs.length&&this._doSignIn(this._xoReqs.shift())},i=(a,p,f,c)=>{var B,ae,$;const v=e.sinfo_,b=!e.options_||e.options_.prompt!==!1,y=v.hasPortal&&this._findOAuthInfo(e.resUrl_);let I,w;if(a)t(new x({userId:a,server:v.server,token:f||null,expires:c!=null?Number(c):null,ssl:!!p}));else if(window!==window.parent&&((B=this._appUrlObj.query)!=null&&B["arcgis-auth-origin"])&&((ae=this._appUrlObj.query)!=null&&ae["arcgis-auth-portal"])&&this._hasSameServerInstance(this._getServerInstanceRoot(this._appUrlObj.query["arcgis-auth-portal"]),e.resUrl_)){window.parent.postMessage({type:"arcgis:auth:requestCredential"},this._appUrlObj.query["arcgis-auth-origin"]);const S=Te(window,"message",k=>{k.source===window.parent&&k.data&&(k.data.type==="arcgis:auth:credential"?(S.remove(),k.data.credential.expires{S.remove()})}else if(y){let S=y._oAuthCred;if(!S){const k=new Ce(y,fe),A=new Ce(y,ve);k.isValid()&&A.isValid()?k.expires>A.expires?(S=k,A.destroy()):(S=A,k.destroy()):S=k.isValid()?k:A,y._oAuthCred=S}if(S.isValid()){I=new x({userId:S.userId,server:v.server,token:S.token,expires:S.expires,ssl:S.ssl,_oAuthCred:S});const k=y.appId!==S.appId&&this._doPortalSignIn(e.resUrl_);k||S.refreshToken?(e._pendingDfd=S.refreshToken?this._getOAuthToken(v.server,S.refreshToken,S.appId).then(A=>(I.expires=Date.now()+1e3*A.expires_in,I.token=A.access_token,I)):Promise.resolve(I),e._pendingDfd.then(A=>k?this._exchangeToken(A.server,y.appId,A.token).then(ye=>(A.token=ye,A)).catch(()=>A):A).then(A=>{t(A)}).catch(()=>{S==null||S.destroy(),i()})):t(I)}else if(this._oAuthLocationParams&&this._hasSameServerInstance(y.portalUrl,this._oAuthLocationParams.state.portalUrl)&&(this._oAuthLocationParams.access_token||this._oAuthLocationParams.code&&this._oAuthLocationParams.state.uid===S.stateUID&&S.codeVerifier)){const k=this._oAuthLocationParams;this._oAuthLocationParams=null,e._pendingDfd=this._processOAuthResponseParams(k,y,v).then(A=>{t(A)}).catch(r)}else{const k=()=>{b?e._pendingDfd=this.oAuthSignIn(e.resUrl_,v,y,e.options_).then(t,r):(w=new N("identity-manager:not-authenticated","User is not signed in."),r(w))};this._doPortalSignIn(e.resUrl_)?e._pendingDfd=this._getPlatformSelf(v.server,y.appId).then(A=>{H(A.portalUrl,this._appOrigin,!0)?(I=new x({userId:A.username,server:v.server,expires:Date.now()+1e3*A.expires_in,token:A.token}),t(I)):k()}).catch(k):k()}}else if(b){if(this._checkProtocol(e.resUrl_,v,r,e.admin_)){let S=e.options_;e.admin_&&(S=S||{},S.isAdmin=!0),e._pendingDfd=this.signIn(e.resUrl_,v,S).then(t,r)}}else w=new N("identity-manager:not-authenticated","User is not signed in."),r(w)},s=()=>{const a=e.sinfo_,p=a.owningSystemUrl,f=e.options_;let c,v,b,y;if(f&&(c=f.token,v=f.error,b=f.prompt),y=this._findCredential(p,{token:c,resource:e.resUrl_}),!y){for(const I of this.credentials)if(this._isIdProvider(p,I.server)){y=I;break}}if(y){const I=this.findCredential(e.resUrl_,y.userId);if(I)t(I);else if(Ee(a,this._legacyFed)){const w=y.toJSON();w.server=a.server,w.resources=null,t(new x(w))}else(e._pendingDfd=this.generateToken(this.findServerInfo(y.server),null,{serverUrl:e.resUrl_,token:y.token,signal:e.options_.signal,ssl:y.ssl})).then(w=>{t(new x({userId:y==null?void 0:y.userId,server:a.server,token:w.token,expires:w.expires!=null?Number(w.expires):null,ssl:!!w.ssl,isAdmin:e.admin_,validity:w.validity}))},r)}else this._busy=null,c&&(e.options_.token=null),(e._pendingDfd=this.getCredential(p.replace(/\/?$/,"/sharing"),{resource:e.resUrl_,owningTenant:a.owningTenant,signal:e.options_.signal,token:c,error:v,prompt:b})).then(()=>{this._enqueue(e.resUrl_,e.sinfo_,e.options_,e,e.admin_)},I=>{e.resUrl_=e.sinfo_=e.refresh_=null,e.reject(I)})};this._errbackFunc=r;const n=e.sinfo_.owningSystemUrl,l=this._isServerRsrc(e.resUrl_),d=e.sinfo_._restInfoPms;d?d.promise.then(a=>{const p=e.sinfo_;if(p._restInfoPms){p.adminTokenServiceUrl=p._restInfoPms.adminUrl,p._restInfoPms=null,p.tokenServiceUrl=(ue("authInfo.tokenServicesUrl",a)||ue("authInfo.tokenServiceUrl",a)||ue("tokenServiceUrl",a))??null,p.shortLivedTokenValidity=ue("authInfo.shortLivedTokenValidity",a)??null,p.currentVersion=a.currentVersion,p.owningTenant=a.owningTenant;const f=p.owningSystemUrl=a.owningSystemUrl;f&&this._portals.push(f)}l&&p.owningSystemUrl?s():i()},()=>{e.sinfo_._restInfoPms=null;const a=new N("identity-manager:server-identification-failed","Unknown resource - could not find token service endpoint.");r(a)}):l&&n?s():e.sinfo_._selfReq?e.sinfo_._selfReq.selfDfd.then(a=>{var y;const p={};let f,c,v,b;return a&&(f=(y=a.user)==null?void 0:y.username,p.username=f,p.allSSL=a.allSSL,c=a.supportsOAuth,b=parseFloat(a.currentVersion),a.portalMode==="multitenant"&&(v=a.customBaseUrl),e.sinfo_.currentVersion=b),e.sinfo_.webTierAuth=!!f,f&&this.normalizeWebTierAuth?this.generateToken(e.sinfo_,null,{ssl:p.allSSL}).catch(()=>null).then(I=>(p.portalToken=I&&I.token,p.tokenExpiration=I&&I.expires,p)):!f&&c&&b>=4.4&&!this._findOAuthInfo(e.resUrl_)?this._generateOAuthInfo({portalUrl:e.sinfo_.server,customBaseUrl:v,owningTenant:e.sinfo_._selfReq.owningTenant}).catch(()=>null).then(()=>p):p}).catch(()=>null).then(a=>{e.sinfo_._selfReq=null,a?i(a.username,a.allSSL,a.portalToken,a.tokenExpiration):i()}):i()}_generateOAuthInfo(e){let t,r=null,i=e.portalUrl;const s=e.customBaseUrl,n=e.owningTenant,l=!this._defaultOAuthInfo&&this._createDefaultOAuthInfo&&!this._hasTestedIfAppIsOnPortal;if(l){r=window.location.href;let d=r.indexOf("?");d>-1&&(r=r.slice(0,d)),d=r.search(/\/(apps|home)\//),r=d>-1?r.slice(0,d):null}return l&&r?(this._hasTestedIfAppIsOnPortal=!0,t=M(r+"/sharing/rest",{query:{f:"json"}}).then(()=>{this._defaultOAuthInfo=new Je({appId:"arcgisonline",popupCallbackUrl:r+"/home/oauth-callback.html"})})):t=Promise.resolve(),t.then(()=>{if(this._defaultOAuthInfo)return i=i.replace(/^http:/i,"https:"),M(i+"/sharing/rest/oauth2/validateRedirectUri",{query:{accountId:n,client_id:this._defaultOAuthInfo.appId,redirect_uri:qe(this._defaultOAuthInfo.popupCallbackUrl),f:"json"}}).then(d=>{if(d.data.valid){const a=this._defaultOAuthInfo.clone();d.data.urlKey&&s?a.portalUrl="https://"+d.data.urlKey.toLowerCase()+"."+s:a.portalUrl=i,a.popup=window!==window.top||!(H(i,this._appOrigin)||this._gwDomains.some(p=>p.regex.test(i)&&p.regex.test(this._appOrigin))),this.oAuthInfos.push(a)}})})}_doOAuthSignIn(e,t,r,i){const s=r._oAuthCred,n={portalUrl:r.portalUrl};!r.popup&&r.preserveUrlHash&&window.location.hash&&(n.hash=window.location.hash),s.stateUID&&(n.uid=s.stateUID);const l={client_id:r.appId,response_type:s.codeVerifier?"code":"token",state:JSON.stringify(n),expiration:r.expiration,locale:r.locale,redirect_uri:this._getRedirectURI(r,!!s.codeVerifier)};r.forceLogin&&(l.force_login=!0),r.forceUserId&&r.userId&&(l.prepopulatedusername=r.userId),!r.popup&&this._doPortalSignIn(e)&&(l.redirectToUserOrgUrl=!0),s.codeVerifier&&(l.code_challenge=i||s.codeVerifier,l.code_challenge_method=i?"S256":"plain");const d=r.portalUrl.replace(/^http:/i,"https:")+"/sharing/oauth2/authorize",a=d+"?"+Le(l);if(r.popup){const p=window.open(a,"esriJSAPIOAuth",r.popupWindowFeatures);if(p)p.focus(),this._oAuthDfd.oAuthWin_=p,this._oAuthIntervalId=setInterval(()=>{if(p.closed){clearInterval(this._oAuthIntervalId),this._oAuthOnPopupHandle.remove();const f=this._oAuthDfd;if(f){const c=new N("identity-manager:user-aborted","ABORTED");f.reject(c)}}},500),this._oAuthOnPopupHandle=Te(window,["arcgis:auth:hash","arcgis:auth:location:search"],f=>{f.type==="arcgis:auth:hash"?this.setOAuthResponseHash(f.detail):this._setOAuthResponseQueryString(f.detail)});else{const f=new N("identity-manager:popup-blocked","ABORTED");this._oAuthDfd.reject(f)}}else this._rejectOnPersistedPageShow=!0,this._oAuthRedirectFunc?this._oAuthRedirectFunc({authorizeParams:l,authorizeUrl:d,resourceUrl:e,serverInfo:t,oAuthInfo:r}):window.location.href=a}_getRedirectURI(e,t){const r=window.location.href.replace(/#.*$/,"");if(e.popup)return qe(e.popupCallbackUrl);if(t){const i=ke(r);return i.query&&["code","error","error_description","message_code","persist","state"].forEach(s=>{delete i.query[s]}),vt(i.path,i.query)}return r}}ot.prototype.declaredClass="esri.identity.IdentityManagerBase";let x=class extends Ze.EventedAccessor{constructor(o){super(o),this._oAuthCred=null,this.tokenRefreshBuffer=2,o!=null&&o._oAuthCred&&(this._oAuthCred=o._oAuthCred)}initialize(){this.resources=this.resources||[],this.creationTime==null&&(this.creationTime=Date.now())}refreshToken(){const o=R.findServerInfo(this.server),e=o==null?void 0:o.owningSystemUrl,t=!!e&&this.scope==="server",r=t&&Ee(o,R._legacyFed),i=o.webTierAuth,s=i&&R.normalizeWebTierAuth,n=pe[this.server],l=n==null?void 0:n[this.userId];let d,a=this.resources&&this.resources[0],p=t?R.findServerInfo(e):null,f={username:this.userId,password:l};if(i&&!s)return;t&&!p&&R.serverInfos.some(v=>(R._isIdProvider(e,v.server)&&(p=v),!!p));const c=p?R.findCredential(p.server,this.userId):null;if(!t||c){if(!r){if(t)d={serverUrl:a,token:c==null?void 0:c.token,ssl:c&&c.ssl};else if(s)f=null,d={ssl:this.ssl};else{if(!l){let v;return a&&(a=R._sanitizeUrl(a),this._enqueued=1,v=R._enqueue(a,o,null,null,this.isAdmin,this),v.then(()=>{this._enqueued=0,this.refreshServerTokens()}).catch(()=>{this._enqueued=0})),v}this.isAdmin&&(d={isAdmin:!0})}return R.generateToken(t?p:o,t?null:f,d).then(v=>{this.token=v.token,this.expires=v.expires!=null?Number(v.expires):null,this.creationTime=Date.now(),this.validity=v.validity,this.emitTokenChange(),this.refreshServerTokens()}).catch(()=>{})}c==null||c.refreshToken()}}refreshServerTokens(){this.scope==="portal"&&R.credentials.forEach(o=>{const e=R.findServerInfo(o.server),t=e==null?void 0:e.owningSystemUrl;o!==this&&o.userId===this.userId&&t&&o.scope==="server"&&(R._hasSameServerInstance(this.server,t)||R._isIdProvider(t,this.server))&&(Ee(e,R._legacyFed)?(o.token=this.token,o.expires=this.expires,o.creationTime=this.creationTime,o.validity=this.validity,o.emitTokenChange()):o.refreshToken())})}emitTokenChange(o){clearTimeout(this._refreshTimer);const e=this.server?R.findServerInfo(this.server):null,t=e==null?void 0:e.owningSystemUrl,r=t?R.findServerInfo(t):null;o===!1||t&&this.scope!=="portal"&&(!(r!=null&&r.webTierAuth)||R.normalizeWebTierAuth)||this.expires==null&&this.validity==null||this._startRefreshTimer(),this.emit("token-change")}destroy(){this.userId=this.server=this.token=this.expires=this.validity=this.resources=this.creationTime=null,this._oAuthCred&&(this._oAuthCred.destroy(),this._oAuthCred=null);const o=R.credentials.indexOf(this);o>-1&&R.credentials.splice(o,1),this.emitTokenChange(),this.emit("destroy")}toJSON(){const o=Qe({userId:this.userId,server:this.server,token:this.token,expires:this.expires,validity:this.validity,ssl:this.ssl,isAdmin:this.isAdmin,creationTime:this.creationTime,scope:this.scope}),e=this.resources;return e&&e.length>0&&(o.resources=e.slice()),o}_startRefreshTimer(){clearTimeout(this._refreshTimer);const o=6e4*this.tokenRefreshBuffer,e=2**31-1;let t=(this.validity?this.creationTime+6e4*this.validity:this.expires)-Date.now();t<0?t=0:t>e&&(t=e),this._refreshTimer=setTimeout(this.refreshToken.bind(this),t>o?t-o:t)}};m([_()],x.prototype,"creationTime",void 0),m([_()],x.prototype,"expires",void 0),m([_()],x.prototype,"isAdmin",void 0),m([_()],x.prototype,"oAuthState",void 0),m([_()],x.prototype,"resources",void 0),m([_()],x.prototype,"scope",void 0),m([_()],x.prototype,"server",void 0),m([_()],x.prototype,"ssl",void 0),m([_()],x.prototype,"token",void 0),m([_()],x.prototype,"tokenRefreshBuffer",void 0),m([_()],x.prototype,"userId",void 0),m([_()],x.prototype,"validity",void 0),x=m([oe("esri.identity.Credential")],x);class at extends ot{}at.prototype.declaredClass="esri.identity.IdentityManager";const Ht=new at;gt(Ht);export{Ht as default}; diff --git a/dist/assets/ImageHistogramParameters-qqqpsay3.js b/dist/assets/ImageHistogramParameters-qqqpsay3.js new file mode 100644 index 0000000..540e39e --- /dev/null +++ b/dist/assets/ImageHistogramParameters-qqqpsay3.js @@ -0,0 +1 @@ +import{dp as he,uq as gt,W as f,e as s,y as l,l9 as ve,iy as J,oS as yt,q3 as Vt,c as j,dr as N,er as E,ur as ht,dt as U,us as It,ah as A,du as Ie,oQ as wt,ut as ft,L as we,am as Gt,K as Ot,x as Wt,a6 as Ft,uu as Jt,uv as $t,uw as _t,ux as Kt,js as fe,dT as Se,uy as rt,jr as Ge,dm as Qt,uz as K,q2 as te,f1 as Xt,uA as Me,R as ge,fZ as At,hc as Yt,dO as Ce,j as qt,f_ as ei,r as C,dY as ti,uB as Dt,uC as ot,es as ii,fV as ni,fX as ai,fW as ri,av as W,d2 as oi,h6 as si,nP as li,eo as ci,g8 as ui}from"./index-pCX-0tJH.js";import{o as Le,p as de,q as di,t as H,v as pi,f as mi,w as Mi,u as P,x as gi,y as Oe,z as bt,A as vt,C as yi,E as hi,G as Ii,b as wi}from"./dataUtils-_QoSHbCE.js";import"./generateRendererUtils-3JJTfr19.js";var xe;const se=new he({flow_from:"flow-from",flow_to:"flow-to"});let b=xe=class extends gt(N){constructor(e){super(e),this.density=.8,this.color=new f([255,255,255,1]),this.maxPathLength=200,this.trailWidth=1.5,this.flowSpeed=10,this.trailLength=100,this.smoothing=0,this.flowRepresentation="flow-from",this.type="flow",this.authoringInfo=null,this.legendOptions=null,this.trailCap="butt",this.background="none"}clone(){var D,M;const{density:e,maxPathLength:t,trailWidth:i,flowSpeed:n,trailLength:a,smoothing:r,flowRepresentation:o,trailCap:u,background:d}=this,c=this.color.clone(),p=(this.visualVariables||[]).map(g=>g.clone()),m=(D=this.authoringInfo)==null?void 0:D.clone(),w=(M=this.legendOptions)==null?void 0:M.clone();return new xe({density:e,color:c,maxPathLength:t,trailWidth:i,flowSpeed:n,trailLength:a,trailCap:u,background:d,smoothing:r,flowRepresentation:o,visualVariables:p,authoringInfo:m,legendOptions:w})}getSymbol(e,t){}async getSymbolAsync(e,t){}getSymbols(){return[]}};s([l({type:Number,json:{write:!0}})],b.prototype,"density",void 0),s([l({type:f,json:{write:{allowNull:!0}}})],b.prototype,"color",void 0),s([l({type:Number,cast:ve,json:{write:!0}})],b.prototype,"maxPathLength",void 0),s([l({type:Number,cast:ve,json:{write:!0}})],b.prototype,"trailWidth",void 0),s([l({type:Number,json:{write:!0}})],b.prototype,"flowSpeed",void 0),s([l({type:Number,json:{write:!0}})],b.prototype,"trailLength",void 0),s([l({type:Number,cast:ve,json:{write:!1}})],b.prototype,"smoothing",void 0),s([l({type:se.apiValues,json:{type:se.jsonValues,read:{reader:se.read},write:{writer:se.write}}})],b.prototype,"flowRepresentation",void 0),s([J({flowRenderer:"flow"})],b.prototype,"type",void 0),s([l({type:yt,json:{write:!0}})],b.prototype,"authoringInfo",void 0),s([l({type:Vt,json:{write:!0}})],b.prototype,"legendOptions",void 0),s([l({type:String,json:{write:!0}})],b.prototype,"trailCap",void 0),s([l({type:String,json:{write:!0}})],b.prototype,"background",void 0),b=xe=s([j("esri.renderers.FlowRenderer")],b);const St=b;let F=class extends N{constructor(){super(...arguments),this.value=null,this.label=null,this.color=null}};s([l({type:Number,json:{write:!0}})],F.prototype,"value",void 0),s([l({type:String,json:{write:!0}})],F.prototype,"label",void 0),s([l({type:f,json:{type:[E],write:!0}})],F.prototype,"color",void 0),F=s([j("esri.renderers.support.ColormapInfo")],F);const jt=F;var Q;let X=Q=class extends N{constructor(e){super(e),this.colormapInfos=null,this.type="raster-colormap"}static createFromColormap(e,t){if(!e)return null;const i=e[0].length===5,n=[...e].sort((a,r)=>a[0]-r[0]).map(a=>jt.fromJSON({value:a[0],color:i?a.slice(1,5):a.slice(1,4).concat([255]),label:t?t[a[0]]??"":a[0]}));return new Q({colormapInfos:n})}static createFromColorramp(e){const t=Le(e);return Q.createFromColormap(t)}clone(){return new Q({colormapInfos:this.colormapInfos.map(e=>e.toJSON())})}extractColormap(){return this.colormapInfos.map(({value:e,color:t})=>[e,t.r,t.g,t.b,t.a>1?t.a:255*t.a&255]).sort((e,t)=>e[0]-t[0])}};s([l({type:[jt],json:{write:!0}})],X.prototype,"colormapInfos",void 0),s([J({rasterColormap:"raster-colormap"})],X.prototype,"type",void 0),X=Q=s([j("esri.renderers.RasterColormapRenderer")],X);const We=X;var Be;let L=Be=class extends N{constructor(e){super(e),this.altitude=45,this.azimuth=315,this.colorRamp=null,this.hillshadeType="traditional",this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.scalingType="none",this.type="raster-shaded-relief",this.zFactor=1}readColorRamp(e){return It(e)}clone(){return new Be({hillshadeType:this.hillshadeType,altitude:this.altitude,azimuth:this.azimuth,zFactor:this.zFactor,scalingType:this.scalingType,pixelSizeFactor:this.pixelSizeFactor,pixelSizePower:this.pixelSizePower,colorRamp:A(this.colorRamp)})}};s([l({type:Number,json:{write:!0}})],L.prototype,"altitude",void 0),s([l({type:Number,json:{write:!0}})],L.prototype,"azimuth",void 0),s([l({types:ht,json:{write:!0}})],L.prototype,"colorRamp",void 0),s([U("colorRamp")],L.prototype,"readColorRamp",null),s([l({type:["traditional","multi-directional"],json:{write:!0}})],L.prototype,"hillshadeType",void 0),s([l({type:Number,json:{write:!0}})],L.prototype,"pixelSizePower",void 0),s([l({type:Number,json:{write:!0}})],L.prototype,"pixelSizeFactor",void 0),s([l({type:["none","adjusted"],json:{write:!0}})],L.prototype,"scalingType",void 0),s([J({rasterShadedRelief:"raster-shaded-relief"})],L.prototype,"type",void 0),s([l({type:Number,json:{write:!0}})],L.prototype,"zFactor",void 0),L=Be=s([j("esri.renderers.RasterShadedReliefRenderer")],L);const Nt=L;var ze;let y=ze=class extends N{constructor(e){super(e),this.colorRamp=null,this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.maxPercent=null,this.minPercent=null,this.numberOfStandardDeviations=null,this.outputMax=null,this.outputMin=null,this.sigmoidStrengthLevel=null,this.statistics=[],this.histograms=null,this.useGamma=!1,this.stretchType="none",this.type="raster-stretch"}readColorRamp(e){if(e)return It(e)}writeStatistics(e,t,i){e!=null&&e.length&&(Array.isArray(e[0])||(e=e.map(n=>[n.min,n.max,n.avg,n.stddev])),t[i]=e)}readStretchType(e,t){let i=t.stretchType;return typeof i=="number"&&(i=di[i]),de.read(i)}clone(){return new ze({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:A(this.statistics),gamma:A(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,colorRamp:A(this.colorRamp),histograms:A(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment})}};s([l({types:ht,json:{write:!0}})],y.prototype,"colorRamp",void 0),s([U("colorRamp")],y.prototype,"readColorRamp",null),s([l({type:Boolean,json:{write:!0}})],y.prototype,"computeGamma",void 0),s([l({type:Boolean,json:{write:{target:"dra"},read:{source:"dra"}}})],y.prototype,"dynamicRangeAdjustment",void 0),s([l({type:[Number],json:{write:!0}})],y.prototype,"gamma",void 0),s([l({type:Number,json:{write:!0}})],y.prototype,"maxPercent",void 0),s([l({type:Number,json:{write:!0}})],y.prototype,"minPercent",void 0),s([l({type:Number,json:{write:!0}})],y.prototype,"numberOfStandardDeviations",void 0),s([l({type:Number,json:{read:{source:"max"},write:{target:"max"}}})],y.prototype,"outputMax",void 0),s([l({type:Number,json:{read:{source:"min"},write:{target:"min"}}})],y.prototype,"outputMin",void 0),s([l({type:Number,json:{write:!0}})],y.prototype,"sigmoidStrengthLevel",void 0),s([l({json:{type:[[Number]],write:!0}})],y.prototype,"statistics",void 0),s([l()],y.prototype,"histograms",void 0),s([Ie("statistics")],y.prototype,"writeStatistics",null),s([l({type:Boolean,json:{write:!0}})],y.prototype,"useGamma",void 0),s([l({type:de.apiValues,json:{type:de.jsonValues,write:de.write}})],y.prototype,"stretchType",void 0),s([U("stretchType",["stretchType"])],y.prototype,"readStretchType",null),s([J({rasterStretch:"raster-stretch"})],y.prototype,"type",void 0),y=ze=s([j("esri.renderers.RasterStretchRenderer")],y);const Fe=y;var Ue;const st=new Set(["esriMetersPerSecond","esriKilometersPerHour","esriKnots","esriFeetPerSecond","esriMilesPerHour"]),le=new he({beaufort_ft:"beaufort-ft",beaufort_km:"beaufort-km",beaufort_kn:"beaufort-kn",beaufort_m:"beaufort-m",beaufort_mi:"beaufort-mi",classified_arrow:"classified-arrow",ocean_current_kn:"ocean-current-kn",ocean_current_m:"ocean-current-m",simple_scalar:"simple-scalar",single_arrow:"single-arrow",wind_speed:"wind-barb"}),ce=new he({flow_from:"flow-from",flow_to:"flow-to"});let v=Ue=class extends gt(N){constructor(e){super(e),this.attributeField="Magnitude",this.flowRepresentation="flow-from",this.rotationType="arithmetic",this.style="single-arrow",this.symbolTileSize=50,this.type="vector-field"}readInputUnit(e,t){return st.has(e)?H.fromJSON(e):null}readOutputUnit(e,t){return st.has(e)?H.fromJSON(e):null}get styleRenderer(){const e=this.style,t=this.attributeField,i=this._createStyleRenderer(e);return i.field=t,i}get sizeVariables(){const e=[];if(this.visualVariables)for(const t of this.visualVariables)t.type==="size"&&e.push(t);if(e.length===0){const t=new wt({field:"Magnitude",minSize:.2*this.symbolTileSize,maxSize:.8*this.symbolTileSize});this.visualVariables?this.visualVariables.push(t):this._set("visualVariables",[t]),e.push(t)}return e}get rotationVariables(){const e=[];if(this.visualVariables)for(const t of this.visualVariables)t.type==="rotation"&&e.push(t);if(e.length===0){const t=new ft({field:"Direction",rotationType:this.rotationType});this.visualVariables?this.visualVariables.push(t):this._set("visualVariables",[t]),e.push(t)}return e}clone(){return new Ue({attributeField:this.attributeField,flowRepresentation:this.flowRepresentation,rotationType:this.rotationType,symbolTileSize:this.symbolTileSize,style:this.style,visualVariables:A(this.visualVariables),inputUnit:this.inputUnit,outputUnit:this.outputUnit})}async getGraphicsFromPixelData(e,t=!1,i=[]){var w;const n=new Array,a=pi(this.inputUnit,this.outputUnit),r=((w=this.rotationVariables[0])==null?void 0:w.rotationType)||this.rotationType,o=t?mi(e.pixelBlock,"vector-uv",r,a):Mi(e.pixelBlock,"vector-magdir",a);if(o==null)return n;const u=e.extent,d=o.mask!=null&&o.mask.length>0;let c=0;const p=(u.xmax-u.xmin)/o.width,m=(u.ymax-u.ymin)/o.height;for(let D=0;Dz.intersects(g));if((!d||o.mask[c])&&!x){const z={Magnitude:o.pixels[0][c],Direction:o.pixels[1][c]},R=new Ot({geometry:{type:"point",x:g.x,y:g.y,spatialReference:u.spatialReference},attributes:z});R.symbol=this._getVisualVariablesAppliedSymbol(R),n.push(R)}}return n}getSymbol(e,t){}async getSymbolAsync(e,t){}getSymbols(){return[]}getClassBreakInfos(){var e;return(e=this.styleRenderer)==null?void 0:e.classBreakInfos}getDefaultSymbol(){var e;return(e=this.styleRenderer)==null?void 0:e.defaultSymbol}_getDefaultSymbol(e){return new Wt({path:"M14,32 14,18 9,23 16,3 22,23 17,18 17,32 z",outline:new Ft({width:0}),size:20,color:e||new f([0,92,230])})}_getVisualVariablesAppliedSymbol(e){var a,r;if(!e)return;const t=(r=(a=this.styleRenderer)==null?void 0:a.getSymbol(e))==null?void 0:r.clone(),i=this.sizeVariables,n=this.rotationVariables;if(i&&i.length&&this.sizeVariables.forEach(o=>Jt(t,$t([o],e))),n&&n.length){const o=this.flowRepresentation==="flow-to"==(this.style==="ocean-current-kn"||this.style==="ocean-current-m")?0:180;e.attributes.Direction=e.attributes.Direction+o,this.rotationVariables.forEach(u=>_t(t,Kt(u,e),u.axis))}return t}_createStyleRenderer(e){let t={defaultSymbol:this._getDefaultSymbol(),classBreakInfos:[]};switch(e){case"single-arrow":t=this._createSingleArrowRenderer();break;case"beaufort-kn":t=this._createBeaufortKnotsRenderer();break;case"beaufort-m":t=this._createBeaufortMeterRenderer();break;case"beaufort-ft":t=this._createBeaufortFeetRenderer();break;case"beaufort-mi":t=this._createBeaufortMilesRenderer();break;case"beaufort-km":t=this._createBeaufortKilometersRenderer();break;case"ocean-current-m":t=this._createCurrentMeterRenderer();break;case"ocean-current-kn":t=this._createCurrentKnotsRenderer();break;case"simple-scalar":t=this._createSimpleScalarRenderer();break;case"wind-barb":t=this._createWindBarbsRenderer();break;case"classified-arrow":t=this._createClassifiedArrowRenderer()}return new fe(t)}_createSingleArrowRenderer(){return{defaultSymbol:this._getDefaultSymbol()}}_createBeaufortKnotsRenderer(){const e=[0,1,3,6,10,16,21,27,33,40,47,55,63],t=[[40,146,199],[89,162,186],[129,179,171],[160,194,155],[191,212,138],[218,230,119],[250,250,100],[252,213,83],[252,179,102],[250,141,52],[247,110,42],[240,71,29]];return{defaultSymbol:this._getDefaultSymbol(new f([214,47,39])),classBreakInfos:this._getClassBreaks(e,t)}}_createBeaufortMeterRenderer(){const e=[0,.2,1.8,3.3,5.4,8.5,11,14.1,17.2,20.8,24.4,28.6,32.7],t=[[69,117,181],[101,137,184],[132,158,186],[162,180,189],[192,204,190],[222,227,191],[255,255,191],[255,220,161],[250,185,132],[245,152,105],[237,117,81],[232,21,21]];return{defaultSymbol:this._getDefaultSymbol(new f([214,47,39])),classBreakInfos:this._getClassBreaks(e,t)}}_createBeaufortFeetRenderer(){const e=this._getDefaultSymbol(new f([214,47,39]));let t=[0,.2,1.8,3.3,5.4,8.5,11,14.1,17.2,20.8,24.4,28.6,32.7];const i=[[69,117,181],[101,137,184],[132,158,186],[162,180,189],[192,204,190],[222,227,191],[255,255,191],[255,220,161],[250,185,132],[245,152,105],[237,117,81],[232,21,21]],n=3.28084;return t=t.map(a=>a*n),{defaultSymbol:e,classBreakInfos:this._getClassBreaks(t,i)}}_createBeaufortMilesRenderer(){const e=this._getDefaultSymbol(new f([214,47,39]));let t=[0,.2,1.8,3.3,5.4,8.5,11,14.1,17.2,20.8,24.4,28.6,32.7];const i=[[69,117,181],[101,137,184],[132,158,186],[162,180,189],[192,204,190],[222,227,191],[255,255,191],[255,220,161],[250,185,132],[245,152,105],[237,117,81],[232,21,21]],n=2.23694;return t=t.map(a=>a*n),{defaultSymbol:e,classBreakInfos:this._getClassBreaks(t,i)}}_createBeaufortKilometersRenderer(){const e=this._getDefaultSymbol(new f([214,47,39]));let t=[0,.2,1.8,3.3,5.4,8.5,11,14.1,17.2,20.8,24.4,28.6,32.7];const i=[[69,117,181],[101,137,184],[132,158,186],[162,180,189],[192,204,190],[222,227,191],[255,255,191],[255,220,161],[250,185,132],[245,152,105],[237,117,81],[232,21,21]],n=3.6;return t=t.map(a=>a*n),{defaultSymbol:e,classBreakInfos:this._getClassBreaks(t,i)}}_createCurrentMeterRenderer(){const e=[0,.5,1,1.5,2],t=[[78,26,153],[179,27,26],[202,128,26],[177,177,177]];return{defaultSymbol:this._getDefaultSymbol(new f([177,177,177])),classBreakInfos:this._getClassBreaks(e,t)}}_createCurrentKnotsRenderer(){const e=[0,.25,.5,1,1.5,2,2.5,3,3.5,4],t=[[0,0,0],[0,37,100],[78,26,153],[151,0,100],[179,27,26],[177,78,26],[202,128,26],[177,179,52],[177,177,177]];return{defaultSymbol:this._getDefaultSymbol(new f([177,177,177])),classBreakInfos:this._getClassBreaks(e,t)}}_createClassifiedArrowRenderer(){var n;const e=this._getDefaultSymbol(new f([56,168,0]));let t=[0,1e-6,3.5,7,10.5,14];if((n=this.sizeVariables)!=null&&n.length){const a=this.sizeVariables[0].minDataValue,r=this.sizeVariables[0].maxDataValue;if(a&&r){const o=(r-a)/5;t=Array.from(Array(6).keys()).map(u=>a+o*u)}}const i=[[56,168,0],[139,309,0],[255,255,0],[255,128,0],[255,0,0]];return{defaultSymbol:e,classBreakInfos:this._getClassBreaks(t,i)}}_createSimpleScalarRenderer(){return{defaultSymbol:Se.fromJSON({imageData:"iVBORw0KGgoAAAANSUhEUgAAACsAAAArCAQAAABLVLlLAAAABGdBTUEAAYagMeiWXwAAAAJiS0dEAACqjSMyAAAACXBIWXMAAABIAAAASABGyWs+AAAC3ElEQVRIx9XXvW4cVRQH8N982btpsIREJECyiCXsxX4DKh6AliqGKCBBE2SlwlHgAbBD/AKmyEYUeQ1KahPZSZQvBCkQLTHZ7KGY8Xodz4w3a1NwbzVzz/znfJ//zbStVC5q3icKak9GAs2QIdDx3PtW/S011NW3p+M5Eomh11ipTIKe6+4LQzHaQ+G+63pIZNJJQXMpljwTwj1brpgx5w1zZlyx5Z4QnllEIm2xeeSUHBf0hV0bejo1Uh09G3aFvgXk7cCJFBc9EdaRVuHJJaOdKyTV2TVhYLMduNR0Q9gxL5GaaTDw8GzejrDRBpxWoGsySRW0dttKuattwNkIlFw2YXgzOdYq4Ox49PlM+JrKd5OusjTWhBuVxUfMX/KXXZ3WEmkuqa67wspR4BTbwtKr/5u4fFgStse/T7EifFPnnYl9zPq4vmUOPrRndgoHjDti1gOPqlyXoifcRNGQzUd31lDyfHmob1Gp35vSr+P6vilcQ5Egtyd8YF/ySg9NhPM+9M/IOaHwp5+PSZayXTvCogEUwlatC3J8LLwYtcWB8EuDXQVuCkV5/B4eNHb7wGBs87LBDS+xjdVSn09wq1G8dFM+9tSUhIGneLvUdniKxKpTYljCpu3j7rVWlHj/P23v4NPGUEyeCQnexe9lJjzEQqMjJs+EzNAX6B98dBZVRmroJx95x/A/6gln18EyfCUsl+qdXb/tjvfbw+mwforpUOBz4XLVoBwAn3aWnfeH246NyBXhrq7TTN5lNSP9RkU+puUJm3W2Tsdq0nZWM07srk7MwQrZSRysjjGWBLRJNsNbfj2JMR4AbxpU1XLAb9Mxfpsq5EjMuuiR8L0JiHOOBX3hiUvOmavN0nMueSzcceFk0BK4pMqLo7vDD1Z0qrtDx7Itt4Xwm9UqbMmk8S0Dtuzb2pvOU99Z1nLTOfleNmvfZfP2pYZmPfajwosKdDBNpacNpVGGsWX9CyDI8Xq/Sj6QAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE0LTExLTEwVDAzOjE3OjU4LTA1OjAwF+tHyQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNC0xMS0xMFQwMzoxNzo1OC0wNTowMGa2/3UAAAAASUVORK5CYII=",height:20,width:20,type:"esriPMS",angle:0})}}_createWindBarbsRenderer(){const e=Array.from(Array(31).keys()).map(a=>5*a),t=[{range:"0-5",path:"M20 20 M5 20 A15 15 0 1 0 35 20 A15 15 0 1 0 5 20 M20 20 M10 20 A10 10 0 1 0 30 20 A10 10 0 1 0 10 20",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTIwIDIwIE01IDIwIEExNSAxNSAwIDEgMCAzNSAyMCBBMTUgMTUgMCAxIDAgNSAyMCBNMjAgMjAgTTEwIDIwIEExMCAxMCAwIDEgMCAzMCAyMCBBMTAgMTAgMCAxIDAgMTAgMjAiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"5-10",path:"M25 0 L25 40 M25 35 L17.5 37.5",imageData:"PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjkgMCAyNyA0NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMjUgMCBMMjUgNDAgTTI1IDM1IEwxNy41IDM3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"10-15",path:"M25 0 L25 40 L10 45 L25 40",imageData:"PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjkgMCAyNyA0NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMjUgMCBMMjUgNDAgTDEwIDQ1IEwyNSA0MCIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"15-20",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L17.5 37.5",imageData:"PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjEyIDAgMTUgNDUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0NSBMMjUgNDAgTTI1IDM1IEwxNy41IDM3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"20-25",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40",imageData:"PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjkgMCAyNiA0NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMjUgMCBMMjUgNDAgTDEwIDQ1IEwyNSA0MCBNMjUgMzUgTDEwIDQwIiBzdHlsZT0ic3Ryb2tlOnJnYigwLDAsMCk7c3Ryb2tlLXdpZHRoOjEuNSIvPgogPC9zdmc+"},{range:"25-30",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40 L25 35 M25 30 L17.5 32.5",imageData:"PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjkgMCAyNiA0NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMjUgMCBMMjUgNDAgTDEwIDQ1IEwyNSA0MCBNMjUgMzUgTDEwIDQwIEwyNSAzNSBNMjUgMzAgTDE3LjUgMzIuNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"30-35",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40 L25 35 M25 30 L10 35",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0NiI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0NSBMMjUgNDAgTTI1IDM1IEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"35-40",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L17.5 27.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0NiI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0NSBMMjUgNDAgTTI1IDM1IEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxNy41IDI3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"40-45",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0NiI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0NSBMMjUgNDAgTTI1IDM1IEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"45-50",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L17.5 22.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0NiI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0NSBMMjUgNDAgTTI1IDM1IEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxNy41IDIyLjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"50-55",path:"M25 0 L25 40 L10 40 L25 35",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"55-60",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L17.5 32.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxNy41IDMyLjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"60-65",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"65-70",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L17.5 27.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxNy41IDI3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"70-75",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"75-80",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L17.5 22.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxNy41IDIyLjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"80-85",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L10 25",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxMCAyNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"85-90",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L10 25 L25 20 M25 15 L17.5 17.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxMCAyNSBMMjUgMjAgTTI1IDE1IEwxNy41IDE3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"90-95",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L10 25 L25 20 M25 15 L10 20",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxMCAyNSBMMjUgMjAgTTI1IDE1IEwxMCAyMCIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"95-100",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L10 25 L25 20 M25 15 L10 20 L25 15 M25 10 L17.5 12.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxMCAyNSBMMjUgMjAgTTI1IDE1IEwxMCAyMCBMMjUgMTUgTTI1IDEwIEwxNy41IDEyLjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"100-105",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"105-110",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L17.5 27.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDE3LjUgMjcuNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"110-115",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIiBzdHlsZT0ic3Ryb2tlOnJnYigwLDAsMCk7c3Ryb2tlLXdpZHRoOjEuNSIvPgogPC9zdmc+"},{range:"115-120",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L17.5 22.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDE3LjUgMjIuNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"120-125",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IiBzdHlsZT0ic3Ryb2tlOnJnYigwLDAsMCk7c3Ryb2tlLXdpZHRoOjEuNSIvPgogPC9zdmc+"},{range:"125-130",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25 M25 20 M25 15 L17.5 17.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IE0yNSAyMCBNMjUgMTUgTDE3LjUgMTcuNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"130-135",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25 M25 20 M25 15 L10 20",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IE0yNSAyMCBNMjUgMTUgTDEwIDIwIiBzdHlsZT0ic3Ryb2tlOnJnYigwLDAsMCk7c3Ryb2tlLXdpZHRoOjEuNSIvPgogPC9zdmc+"},{range:"135-140",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25 M25 20 M25 15 L10 20 M25 15 M25 10 L17.5 12.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IE0yNSAyMCBNMjUgMTUgTDEwIDIwIE0yNSAxNSBNMjUgMTAgTDE3LjUgMTIuNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"140-145",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25 M25 20 M25 15 L10 20 M25 15 M25 10 L17.5 12.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IE0yNSAyMCBNMjUgMTUgTDEwIDIwIE0yNSAxNSBNMjUgMTAgTDEwIDE1IiBzdHlsZT0ic3Ryb2tlOnJnYigwLDAsMCk7c3Ryb2tlLXdpZHRoOjEuNSIvPgogPC9zdmc+"},{range:"145-150",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25 M25 20 M25 15 L10 20 M25 15 M25 10 L17.5 12.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IE0yNSAyMCBNMjUgMTUgTDEwIDIwIE0yNSAxNSBNMjUgMTAgTDEwIDE1IE0yNSAxMCBNMjUgNSBMMTcuNSA3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="}],i=Se.fromJSON({imageData:"iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAQAAADtq6NDAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAJiS0dEAP+Hj8y/AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAEY0lEQVRIx5XXWWxWRRQH8N+d+31tUdGAVjGglYJABFEBY91jfDAg7piYaFTccA++uMQEFRcSXlATtxiXqMQt4G4iisYl0ai4sIQYtVFZ1KIFKdTS0l4f7vRCS5fPebozc+bM/2z/Mzcx0AgSiUxXnKfIdMn875FIhX53U2n/B/s+kKM4UINTjTBZImixxnrv+9a2iL6zEoUBXcoudrWj/OtHm3wt02lfU9Qao9OnHvIhgmww84MEl1qnxfNmGrqHxAizLdPpC6chGcAxKGGcL+30gOERf1BSpUqVslQSV8d5ReZFe8VQ9avufJn31cWwlJV7iafKStGOE/1qvfH9qUxxu8ydUdmuSKbGO8YUdT2inKLG69pM70tliktl5qIkCAJGmusDG7Vqsc0WjZa4UBlBiA5YZIcjYzB7qDtH5kaUJFLs7RGZTZ42W4PRRmtwvbdt1+wGiaS4drEtDttdZYIDNVuAclR3vA3+dI3qHqmVSy7U6Tv1MScCPvPR7nIpFlsdCy3FdTLPGhK92e2CUITjMJ9ocwKxnsZqc3O3JwMma3d6UVLnyVxB4aXemZqvPqLdpJhW3KVVbY4yYImPo6M5Urv50fj+0z/FG9YaEiENs8UtMfXUaTeTePNHlhXfA1UU+2lyD1Il3Gtt9+adfpNG7dNlpg2U/T3KYLZ2dUWFdTgp3/rQ4sK973qnInV5TIf40x3dhvrJPBiqyWUo4wAtLqhQYS71qK+QKOFRywmGK/kpikzV6WMKhh58vGWs4TIJNjiEYLIuP8Tt4/zmLyqk+AyrJSbF+Qq1DgqRUPMxyl+9q3IQhX/rMCJ6tEunriDs1oSyQZKlr9AkhT2ZIARbJfaJS1vtVbHB+Rgi0RK/y1q1BWsEEyLoz40xtGKcARPVWB1BTPO7f4LNtpkUl1aoMbViLyZo0GRjPD3BxnxjqXeLYlvhqYrzMMG3HoyJXa3JjfnGlbYYFlP7Jh3qKsKY4hQ7TY0nG+xwRL61n63mxHtqNHosigyMLmClNwvuecFnOZB88nNBDzNkzhxEZaKMBVoKapggMzvHHXBEpNSSFAvtcFRsVn0bW8LlMmcXs+c0Kne3gRR32+zg4uXwjC6zit6Wt4a8LXVfcp/MtQXHn2ynGbuCmb8GvvFeJLEE82ReU9/n6+dkq2x3buG9Wn94smcgAw631RPR7BTH+kbmHReZoEpOdEe7zWqZl40s0JWs9Hmv7hjBHqPDwsjGKVJnWWqjbdZp1KhJi0aPmxYZsIRhlttgeF+Jlke41QcOQKoqilSb6HJzSvNG3G/UoWnxwsmt+sVaYwd63dRbqdnMyCPVeyRPvpYgdavM22oGKoMUVRbJfOWMwidJ8Zzb1UvmWK/VVUXzHaTjjrVYh1897HT7xxYEVUaa5SWb/WO+YUWa9SrwvigzM8YlzlYv2GSdVCYxxlBtVnnFq5olwp5/BEk/OLsf5LUmG2+inRJdVvjZ97ZH9/zP34ug1O91pf4p+D+JYBpvrKxfbwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNC0xMS0xMFQwMzoxMjowOS0wNTowMB9ViV0AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTQtMTEtMTBUMDM6MTI6MDktMDU6MDBuCDHhAAAAAElFTkSuQmCC",height:20,width:20,type:"esriPMS",angle:0}),n=e.map((a,r)=>{let o;if(r!==e.length-1)if(r===0)o={minValue:a,maxValue:e[r+1],symbol:i};else{const u=Se.fromJSON({type:"esriPMS",imageData:t[r].imageData,contentType:"image/svg+xml",height:32,width:32,angle:0});o={minValue:a,maxValue:e[r+1],symbol:u}}return new rt(o)});return{defaultSymbol:i,classBreakInfos:n}}_getClassBreaks(e,t){return t.map((i,n)=>new rt({minValue:e[n],maxValue:e[n+1],symbol:this._getDefaultSymbol(new f(i))}))}};s([l({type:String,json:{write:!0}})],v.prototype,"attributeField",void 0),s([l({type:ce.apiValues,json:{type:ce.jsonValues,read:{reader:ce.read},write:{writer:ce.write}}})],v.prototype,"flowRepresentation",void 0),s([l({type:["geographic","arithmetic"],json:{write:!0}})],v.prototype,"rotationType",void 0),s([l({type:le.apiValues,json:{type:le.jsonValues,read:{reader:le.read},write:{writer:le.write}}})],v.prototype,"style",void 0),s([l({json:{write:!0}})],v.prototype,"symbolTileSize",void 0),s([l({type:H.apiValues,json:{type:H.jsonValues,write:{writer:H.write}}})],v.prototype,"inputUnit",void 0),s([U("inputUnit")],v.prototype,"readInputUnit",null),s([l({type:H.apiValues,json:{type:H.jsonValues,read:{reader:H.read},write:{writer:H.write}}})],v.prototype,"outputUnit",void 0),s([U("outputUnit")],v.prototype,"readOutputUnit",null),s([J({vectorField:"vector-field"})],v.prototype,"type",void 0),s([l({type:fe})],v.prototype,"styleRenderer",null),s([l({type:wt})],v.prototype,"sizeVariables",null),s([l({type:ft})],v.prototype,"rotationVariables",null),v=Ue=s([j("esri.renderers.VectorFieldRenderer")],v);const Je=v,lt={key:"type",base:null,typeMap:{"unique-value":Ge,"class-breaks":fe,"raster-colormap":We,"raster-stretch":Fe,"vector-field":Je,"raster-shaded-relief":Nt,flow:St}},ct={...lt,typeMap:{...lt.typeMap}};delete ct.typeMap["vector-field"],delete ct.typeMap.flow;const fi={uniqueValue:Ge,classBreaks:fe,rasterStretch:Fe,rasterColormap:We,vectorField:Je,rasterShadedRelief:Nt,flowRenderer:St};function Ai(e){return e&&fi[e.type]||null}function Xi(e,t){if(!e)return null;if(e.type==="classBreaks"&&e.classificationMethod){const n=e.authoringInfo||{classificationMethod:""};n.classificationMethod=e.classificationMethod,e.authoringInfo=n}e.type==="vectorField"&&e.visualVariables&&!Array.isArray(e.visualVariables)&&(e.visualVariables=[e.visualVariables]);const i=Ai(e);if(i){const n=new i;return n.read(e,t),n}return t!=null&&t.messages&&e&&t.messages.push(new Qt("renderer:unsupported","Renderers of type '"+(e.type||"unknown")+"' are not supported",{definition:e,context:t})),null}var Re;let V=Re=class extends N{constructor(e){super(e),this.variableName=null,this.dimensionName=null,this.values=[],this.isSlice=!1}clone(){return new Re({variableName:this.variableName,dimensionName:this.dimensionName,values:A(this.values),isSlice:this.isSlice})}};s([l({type:String,json:{write:!0}})],V.prototype,"variableName",void 0),s([l({type:String,json:{write:!0}})],V.prototype,"dimensionName",void 0),s([l({type:K.array(K.oneOf([K.native(Number),K.array(K.native(Number))])),json:{write:!0}})],V.prototype,"values",void 0),s([l({type:Boolean,json:{write:!0}})],V.prototype,"isSlice",void 0),V=Re=s([j("esri.layers.support.DimensionalDefinition")],V);const ee=V,Yi=te()({RSP_NearestNeighbor:"nearest",RSP_BilinearInterpolation:"bilinear",RSP_CubicConvolution:"cubic",RSP_Majority:"majority"}),qi=te()({esriNoDataMatchAny:"any",esriNoDataMatchAll:"all"}),je=te()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"});let Z=class extends N{constructor(){super(...arguments),this.pixelType="unknown"}};s([l({type:String,json:{write:!0}})],Z.prototype,"name",void 0),s([l({type:String,json:{write:!0}})],Z.prototype,"description",void 0),s([l({type:E,json:{type:E,write:!0,name:"_object_id"}})],Z.prototype,"id",void 0),s([l({type:String,json:{type:je.jsonValues,read:je.read,write:je.write}})],Z.prototype,"pixelType",void 0),s([l({type:String,json:{write:!0}})],Z.prototype,"type",void 0),Z=s([j("esri.layers.support.RasterFunctionInfo")],Z);const Di=Z;let k=class extends N{constructor(){super(...arguments),this.isDataset=!1,this.isPublic=!1,this.type="RasterFunctionVariable"}};s([l({type:String,json:{write:!0}})],k.prototype,"name",void 0),s([l({type:Number,json:{type:E,write:!0,name:"_object_id"}})],k.prototype,"id",void 0),s([l({type:Boolean,json:{write:!0}})],k.prototype,"isDataset",void 0),s([l({type:Boolean,json:{write:!0}})],k.prototype,"isPublic",void 0),s([l({json:{write:!0}})],k.prototype,"value",void 0),s([l({type:String,json:{write:!0}})],k.prototype,"type",void 0),k=s([j("esri.layers.support.RasterFunctionVariable")],k);const bi=k,ue={key:"type",base:null,typeMap:{RasterFunctionVariable:bi}};let G=class extends N{};s([l({types:ue,json:{types:ue,name:"MatchVariable"}})],G.prototype,"matchVariable",void 0),s([l({types:ue,json:{types:ue,name:"UnionDimension"}})],G.prototype,"unionDimension",void 0),s([l({type:Number,json:{type:E,write:!0,name:"_object_id"}})],G.prototype,"id",void 0),s([l({type:String,json:{write:!0}})],G.prototype,"type",void 0),G=s([j("esri.layers.support.RasterFunctionProperties")],G);const vi=G,Ne=new he({0:"mosaic",1:"item",2:"item-group"},{useNumericKeys:!0});let I=class extends N{constructor(){super(...arguments),this.functionType="mosaic",this.type="RasterFunctionTemplate"}};s([l({type:[String],json:{write:!0}})],I.prototype,"aliases",void 0),s([l({type:Object,json:{write:!0}})],I.prototype,"arguments",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"description",void 0),s([l({type:Di,json:{write:!0,name:"function"}})],I.prototype,"functionInfo",void 0),s([l({type:Ne.apiValues,json:{type:[0,1,2],read:Ne.read,write:Ne.write}})],I.prototype,"functionType",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"group",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"help",void 0),s([l({type:Number,json:{type:E,write:!0,name:"_object_id"}})],I.prototype,"id",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"name",void 0),s([l({type:String,json:{write:!0,name:"definition"}})],I.prototype,"queryDefinition",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"tag",void 0),s([l({type:vi,json:{write:!0}})],I.prototype,"properties",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"thumbnail",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"thumbnailEx",void 0),s([l({json:{type:["RasterFunctionTemplate"],write:!0}})],I.prototype,"type",void 0),I=s([j("esri.layers.support.RasterFunctionTemplate")],I);const Tt=I;var ke;const pe=new Set(["raster","raster2","dem","fillraster"]),me=new Set(["rasters"]),ut=e=>e!=null&&e.rasterFunction?S.fromJSON(e):e,Te=e=>e&&e instanceof S?e.toJSON():e,He=e=>(e==null?void 0:e.functionName)&&!e.declaredClass,dt=e=>He(e)?new S(e):e,Si=e=>{if(e==null)return null;e=A(e);const t={};for(const i of Object.keys(e))pe.has(i.toLowerCase())?t[i]=ut(e[i]):me.has(i.toLowerCase())&&Array.isArray(e[i])?t[i]=e[i].map(ut):t[i]=e[i];return t},ji={types:{key:"type",base:null,typeMap:{RasterFunctionTemplate:Tt}},json:{write:!0,name:"rasterFunctionDefinition"}};let S=ke=class extends N{constructor(e){super(e),this.functionName=null,this.outputPixelType="unknown",this.variableName=null,this.functionDefinition=null}set functionArguments(e){if(e){const t=Object.keys(e);if(t.some(i=>pe.has(i.toLowerCase())&&He(e[i]))||t.some(i=>me.has(i.toLowerCase())&&Array.isArray(e[i])&&e[i].some(n=>He(n)))){e=A(e);for(const i of t)pe.has(i.toLowerCase())?e[i]=dt(e[i]):me.has(i.toLowerCase())&&Array.isArray(e[i])&&(e[i]=e[i].map(n=>dt(n)))}}this._set("functionArguments",e)}readFunctionArguments(e){return Si(e)}writeFunctionArguments(e,t,i){const n={};for(const a of Object.keys(e))pe.has(a.toLowerCase())?n[a]=Te(e[a]):me.has(a.toLowerCase())&&Array.isArray(e[a])?n[a]=e[a].map(Te):n[a]=Te(e[a]);t[i]=n}readFunctionName(e,t){const i=t.rasterFunctionInfos;return t.name||(i!=null&&i.length&&i[0].name!=="None"?i[0].name:t.rasterFunctionDefinition?t.rasterFunctionDefinition.name:t.rasterFunction)}get rasterFunctionDefinition(){var e;return(e=this.functionDefinition)==null?void 0:e.toJSON()}set rasterFunctionDefinition(e){this.functionDefinition=e?Tt.fromJSON(e):null}clone(){return new ke({functionName:this.functionName,functionArguments:A(this.functionArguments),outputPixelType:this.outputPixelType,variableName:this.variableName,rasterFunctionDefinition:A(this.rasterFunctionDefinition)})}};s([l({json:{type:Object,name:"rasterFunctionArguments"}})],S.prototype,"functionArguments",null),s([U("functionArguments")],S.prototype,"readFunctionArguments",null),s([Ie("functionArguments")],S.prototype,"writeFunctionArguments",null),s([l({json:{type:String,write:{target:"rasterFunction"}}})],S.prototype,"functionName",void 0),s([U("functionName",["rasterFunction","rasterFunctionInfos","rasterFunctionDefinition"])],S.prototype,"readFunctionName",null),s([J({C128:"c128",C64:"c64",F32:"f32",F64:"f64",S16:"s16",S32:"s32",S8:"s8",U1:"u1",U16:"u16",U2:"u2",U32:"u32",U4:"u4",U8:"u8",UNKNOWN:"unknown"},{ignoreUnknown:!1}),l({json:{default:"unknown"}})],S.prototype,"outputPixelType",void 0),s([l({type:String,json:{read:!0,write:!0}})],S.prototype,"variableName",void 0),s([l()],S.prototype,"rasterFunctionDefinition",null),s([l(ji)],S.prototype,"functionDefinition",void 0),S=ke=s([j("esri.layers.support.RasterFunction")],S);const ye=S;var Ze;const Y=te()({MT_FIRST:"first",MT_LAST:"last",MT_MIN:"min",MT_MAX:"max",MT_MEAN:"mean",MT_BLEND:"blend",MT_SUM:"sum"}),Ee=te()({esriMosaicNone:"none",esriMosaicCenter:"center",esriMosaicNadir:"nadir",esriMosaicViewpoint:"viewpoint",esriMosaicAttribute:"attribute",esriMosaicLockRaster:"lock-raster",esriMosaicNorthwest:"northwest",esriMosaicSeamline:"seamline"});function Ni(e){let t;switch(e?e.toLowerCase().replace("esrimosaic",""):""){case"byattribute":case"attribute":t="esriMosaicAttribute";break;case"lockraster":t="esriMosaicLockRaster";break;case"center":t="esriMosaicCenter";break;case"northwest":t="esriMosaicNorthwest";break;case"nadir":t="esriMosaicNadir";break;case"viewpoint":t="esriMosaicViewpoint";break;case"seamline":t="esriMosaicSeamline";break;default:t="esriMosaicNone"}return Ee.fromJSON(t)}let h=Ze=class extends N{constructor(e){super(e),this.ascending=!0,this.itemRasterFunction=null,this.lockRasterIds=null,this.method=null,this.multidimensionalDefinition=null,this.objectIds=null,this.operation=null,this.sortField=null,this.sortValue=null,this.viewpoint=null,this.where=null}readAscending(e,t){return t.ascending!=null?t.ascending:t.sortAscending==null||t.sortAscending}get itemRenderingRule(){return Me(ge.getLogger(this),"itemRenderingRule",{replacement:"itemRasterFunction",version:"4.27",warnOnce:!0}),this._get("itemRasterFunction")}set itemRenderingRule(e){Me(ge.getLogger(this),"itemRenderingRule",{replacement:"itemRasterFunction",version:"4.27",warnOnce:!0}),this._set("itemRasterFunction",e)}readMethod(e,t){return Ni(t.mosaicMethod||t.defaultMosaicMethod)}writeMultidimensionalDefinition(e,t,i){e!=null&&(e=e.filter(({variableName:n,dimensionName:a})=>n&&n!=="*"||a)).length&&(t[i]=e.map(n=>n.toJSON()))}readOperation(e,t){var r;const i=t.mosaicOperation,n=(r=t.mosaicOperator)==null?void 0:r.toLowerCase(),a=i||(n?Y.toJSON(n):null);return Y.fromJSON(a)||"first"}castSortValue(e){return e==null||typeof e=="string"||typeof e=="number"?e:`${e}`}clone(){return new Ze({ascending:this.ascending,itemRasterFunction:A(this.itemRasterFunction),lockRasterIds:A(this.lockRasterIds),method:this.method,multidimensionalDefinition:A(this.multidimensionalDefinition),objectIds:A(this.objectIds),operation:this.operation,sortField:this.sortField,sortValue:this.sortValue,viewpoint:A(this.viewpoint),where:this.where})}};s([l({type:Boolean,json:{write:!0}})],h.prototype,"ascending",void 0),s([U("ascending",["ascending","sortAscending"])],h.prototype,"readAscending",null),s([l({type:ye,json:{name:"itemRenderingRule",write:!0}})],h.prototype,"itemRasterFunction",void 0),s([l({type:ye})],h.prototype,"itemRenderingRule",null),s([l({type:[E],json:{write:{overridePolicy(){return{enabled:this.method==="lock-raster"}}}}})],h.prototype,"lockRasterIds",void 0),s([l({type:String,json:{type:Ee.jsonValues,write:{target:"mosaicMethod",writer:Ee.write}}})],h.prototype,"method",void 0),s([U("method",["mosaicMethod","defaultMosaicMethod"])],h.prototype,"readMethod",null),s([l({type:[ee],json:{write:!0}})],h.prototype,"multidimensionalDefinition",void 0),s([Ie("multidimensionalDefinition")],h.prototype,"writeMultidimensionalDefinition",null),s([l({type:[E],json:{name:"fids",write:!0}})],h.prototype,"objectIds",void 0),s([l({json:{type:Y.jsonValues,read:{reader:Y.read},write:{target:"mosaicOperation",writer:Y.write}}})],h.prototype,"operation",void 0),s([U("operation",["mosaicOperation","mosaicOperator"])],h.prototype,"readOperation",null),s([l({type:String,json:{write:{overridePolicy(){return{enabled:this.method==="attribute"}}}}})],h.prototype,"sortField",void 0),s([l({type:[String,Number],json:{write:{allowNull:!0,overridePolicy(){return{enabled:this.method==="attribute",allowNull:!0}}}}})],h.prototype,"sortValue",void 0),s([Xt("sortValue")],h.prototype,"castSortValue",null),s([l({type:we,json:{write:!0}})],h.prototype,"viewpoint",void 0),s([l({type:String,json:{write:!0}})],h.prototype,"where",void 0),h=Ze=s([j("esri.layers.support.MosaicRule")],h);const Ti=h;var Pe;const Ci={base:Yt,key:"type",typeMap:{extent:Ce,polygon:qt}};let O=Pe=class extends N{constructor(e){super(e),this.areaOfInterest=null,this.subsetDefinitions=null}get dimensions(){const{subsetDefinitions:e}=this;if(e==null||e.length===0)return[];const t=new Map;e.forEach(n=>{if(!n.dimensionName)return;let a,r;if(Array.isArray(n.values[0])){const o=n.values;a=o[0][0],r=o[n.values.length-1][1]}else{const o=n.values;a=o[0],r=o[n.values.length-1]}if(t.has(n.dimensionName)){const o=t.get(n.dimensionName);o[0]=Math.min(a,o[0]),o[1]=Math.max(r,o[1])}else t.set(n.dimensionName,[a,r])});const i=[];for(const n of t)i.push({name:n[0],extent:n[1]});return i}get variables(){const{subsetDefinitions:e}=this;if(e==null||e.length===0)return[];const t=new Set;return e.forEach(i=>{i.variableName&&t.add(i.variableName)}),[...t]}clone(){var i;const e=(i=this.subsetDefinitions)==null?void 0:i.map(n=>n.clone()),t=this.areaOfInterest?this.areaOfInterest.clone():this.areaOfInterest;return new Pe({areaOfInterest:t,subsetDefinitions:e})}};s([l({types:Ci,json:{read:At,write:!0}})],O.prototype,"areaOfInterest",void 0),s([l({readOnly:!0})],O.prototype,"dimensions",null),s([l({readOnly:!0})],O.prototype,"variables",null),s([l({type:[ee],json:{write:!0}})],O.prototype,"subsetDefinitions",void 0),O=Pe=s([j("esri.layers.support.MultidimensionalSubset")],O);const rn=O;let on=class{constructor(){this._workerThread=null,this._destroyed=!1}async initialize(){const t=await ei("RasterWorker");this._destroyed?t.close():this._workerThread=t}destroy(){this._destroyed=!0,this._workerThread&&(this._workerThread.close(),this._workerThread=null)}async convertVectorFieldData(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("convertVectorFieldData",{pixelBlock:t.pixelBlock.toJSON(),type:t.dataType},i);return n?new P(n):null}computeStatisticsHistograms(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");return this._workerThread.invoke("computeStatisticsHistograms",{pixelBlock:t.pixelBlock.toJSON()},i)}async decode(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("decode",t,i);return n?new P(n):null}async symbolize(t,i){var r,o;if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n={extent:(r=t.extent)==null?void 0:r.toJSON(),pixelBlock:(o=t.pixelBlock)==null?void 0:o.toJSON(),simpleStretchParams:t.simpleStretchParams,bandIds:t.bandIds},a=await this._workerThread.invoke("symbolize",n,i);return a?new P(a):null}async updateSymbolizer(t,i){var a;if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n=(a=t==null?void 0:t.rendererJSON)==null?void 0:a.histograms;await Promise.all(this._workerThread.broadcast("updateSymbolizer",{symbolizerJSON:t.toJSON(),histograms:n},i))}async updateRasterFunction(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");await Promise.all(this._workerThread.broadcast("updateRasterFunction",{rasterFunctionJSON:t.toJSON()},i))}async process(t,i){var a,r;if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("process",{extent:(a=t.extent)==null?void 0:a.toJSON(),primaryPixelSizes:(r=t.primaryPixelSizes)==null?void 0:r.map(o=>o!=null?o.toJSON():null),primaryPixelBlocks:t.primaryPixelBlocks.map(o=>o!=null?o.toJSON():null),primaryRasterIds:t.primaryRasterIds},i);return n?new P(n):null}async stretch(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");if(!(t!=null&&t.pixelBlock))return null;const n={srcPixelBlock:t.pixelBlock.toJSON(),stretchParams:t.stretchParams},a=await this._workerThread.invoke("stretch",n,i);return a?new P(a):null}async split(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");if(!(t!=null&&t.pixelBlock))return null;const n={srcPixelBlock:t.pixelBlock.toJSON(),tileSize:t.tileSize,maximumPyramidLevel:t.maximumPyramidLevel},a=await this._workerThread.invoke("split",n,i);return a&&a.forEach((r,o)=>{a.set(o,r?P.fromJSON(r):null)}),a}async estimateStatisticsHistograms(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");if(!(t!=null&&t.pixelBlock))return null;const n={srcPixelBlock:t.pixelBlock.toJSON()};return await this._workerThread.invoke("estimateStatisticsHistograms",n,i)}async mosaicAndTransform(t,i){var r;if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");if(!((r=t==null?void 0:t.srcPixelBlocks)!=null&&r.length))return{pixelBlock:null};const n={...t,srcPixelBlocks:t.srcPixelBlocks.map(o=>o!=null?o.toJSON():null)},a=await this._workerThread.invoke("mosaicAndTransform",n,i);return{pixelBlock:a.pixelBlock?new P(a.pixelBlock):null,localNorthDirections:a.localNorthDirections}}async createFlowMesh(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n={buffer:t.flowData.data.buffer,maskBuffer:t.flowData.mask.buffer,width:t.flowData.width,height:t.flowData.height},{meshType:a,simulationSettings:r}=t,o=await this._workerThread.invoke("createFlowMesh",{meshType:a,flowData:n,simulationSettings:r},{...i,transferList:[n.buffer,n.maskBuffer]});return{vertexData:new Float32Array(o.vertexBuffer),indexData:new Uint32Array(o.indexBuffer)}}getProjectionOffsetGrid(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n=t.datumTransformation!=null?t.datumTransformation.steps.map(o=>({wkid:o.wkid,wkt:o.wkt,isInverse:o.isInverse})):null,a=t.rasterTransform!=null?t.rasterTransform.toJSON():null,r={projectedExtent:t.projectedExtent.toJSON(),srcBufferExtent:t.srcBufferExtent.toJSON(),pixelSize:t.pixelSize,hasWrapAround:t.hasWrapAround,spacing:t.spacing,datumTransformationSteps:n,rasterTransform:a,isAdaptive:t.isAdaptive,includeGCSGrid:t.includeGCSGrid};return this._workerThread.invoke("getProjectionOffsetGrid",r,i)}};function Ct(e,t,i){var r;const n=t.shift();if(i.length===0){const o=[];i.push({sliceId:-1,multidimensionalDefinition:o})}const a=i.length;for(let o=0;o{i.push({sliceId:-1,multidimensionalDefinition:[...u,{variableName:e,dimensionName:n.name,values:[d]}]})})}t.length&&Ct(e,t,i)}function ln(e,t){const i=[];let n=0;return(t?e.variables.filter(a=>a.name.toLowerCase()===t.toLowerCase()):[...e.variables].sort((a,r)=>a.name>r.name?1:-1)).forEach(a=>{const r=[],o=[...a.dimensions].sort((u,d)=>u.name>d.name?-1:1);Ct(a.name,o,r),r.forEach(u=>{i.push({...u,sliceId:n++})})}),i}function cn(e,t,i){let n=e;if(t&&(t=[...t].sort((a,r)=>a.dimensionName{r.length&&(n=n.filter(u=>{const d=u.multidimensionalDefinition.find(p=>p.dimensionName===a);if(d==null)return!1;const c=d.values[0];return typeof c=="number"?typeof r[0]=="number"?r.includes(c):r.some(p=>p[0]<=c&&p[1]>=c):typeof r[0]=="number"?r.some(p=>c[0]<=p&&c[1]>=p):o?r.some(p=>p[0]===c[0]&&p[0]===c[1]):r.some(p=>p[0]>=c[0]&&p[0]<=c[1]||p[1]>=c[0]&&p[1]<=c[1]||p[0]c[1])}))}),n.length&&(i==null?void 0:i.start)!=null&&i.end!=null){const a=i.start.getTime(),r=i.end.getTime(),o=n[0].multidimensionalDefinition.findIndex(u=>u.dimensionName==="StdTime");o>-1&&(n=n.filter(u=>{const d=u.multidimensionalDefinition[o].values[0];return a<=d&&r>=d}))}return n.map(a=>a.sliceId)}function Lt(e,t){return Array.isArray(e)?t[0]===t[1]?e[0]===t[0]||e[1]===t[0]:e[0]>=t[0]&&e[0]<=t[1]&&e[1]>=t[0]&&e[1]<=t[1]:e>=t[0]&&e<=t[1]}function Li(e,t){return e[0]<=t[0]&&e[1]>=t[0]||e[0]<=t[1]&&e[1]>=t[1]||e[0]>=t[0]&&e[1]<=t[1]}function xt(e){return e.length===1?[e[0],e[0]]:[e[0],e[e.length-1]]}function Bt(e,t,i){var o,u;if(!((o=t==null?void 0:t.subsetDefinitions)!=null&&o.length))return e;let n;if(i){const{variables:d}=t;if(d.length&&!d.includes(i))return null;const c=t.subsetDefinitions.find(p=>p.dimensionName===e.name&&p.variableName===i);if(!((u=c==null?void 0:c.values)!=null&&u.length))return e;n=xt(c.values)}else{const d=t.dimensions.find(({name:c})=>c===e.name);n=d==null?void 0:d.extent}const a=n;if(!(a!=null&&a.length))return e;const r=e.values.filter(d=>Lt(d,a));return{...e,extent:[...a],values:r}}function zt(e,t,i){var a;if(!((a=t==null?void 0:t.subsetDefinitions)!=null&&a.length))return!1;const{variables:n}=t;if(n.length&&e.some(({variableName:r})=>r&&!n.includes(r)))return!0;for(let r=0;r(o.variableName===""||d.variableName===o.variableName)&&d.dimensionName===o.dimensionName);if(u!=null&&u.values.length){const d=xt(u.values);if(!o.isSlice&&o.values.length===2&&!Array.isArray(o.values[0])&&o.values[0]!==o.values[1]&&i){if(!Li(o.values,d))return!0}else if(o.values.some(c=>!Lt(c,d)))return!0}}return!1}function un(e,t){if(e==null)return{isOutside:!1};const{geometry:i,timeExtent:n,multidimensionalDefinition:a}=t;let r=null;if(n!=null&&(r=xi(e,n),r==null))return{isOutside:!0};const{areaOfInterest:o}=e;if(o&&i){const u=i.type==="point"?i:i.type==="extent"?i.center:i.type==="polygon"?i.centroid:null;if(u&&!o.contains(u))return{isOutside:!0}}return a!=null&&a.length&&zt(a,e,!0)?{isOutside:!0}:{isOutside:!1,intersection:{geometry:i,timeExtent:r,multidimensionalDefinition:a}}}function xi(e,t){const i=e.dimensions.find(({name:o})=>o==="StdTime");if(i==null||t.start==null&&t.end==null)return t;t=t.clone();const{start:n,end:a}=t.toJSON(),r=n===a?[n]:n!=null&&a!=null?[n,a]:[n??a];return r.length===2&&(i!=null&&i.extent.length)&&(r[0]=Math.max(r[0],i.extent[0]),r[1]=Math.min(r[1],i.extent[1]??i.extent[0]),r[1]r.variables.includes(w))),d?c.find(({name:w})=>w===d)??c[0]:c[0]}function dn(e,t={}){const i=Bi(e,t);if(!i)return null;const n=[],{dimensions:a,name:r}=i;if(a.length===0)return[new ee({variableName:r,dimensionName:"",values:[],isSlice:!0})];for(let o=0;o{if(t.values==null)return!0;const i=t.values.length;return i===0||i>1||!t.isSlice&&Array.isArray(t.values[0])})}function mn(e,t){var n;if(t==null||e==null)return null;let i=t.variables.map(a=>({...a}));return(n=e==null?void 0:e.variables)!=null&&n.length&&(i=i.filter(({name:a})=>e.variables.includes(a)),i.forEach(a=>{a.dimensions=a.dimensions.map(r=>Bt(r,e,a.name)).filter(ti)})),i}function zi(e,t){var u;const{values:i}=t;if(i!=null&&i.length){const d=Array.isArray(i[0]),c=Array.isArray(e);return d!==c?-1:d&&c?i.findIndex(p=>p[0]===e[0]&&p[1]===e[1]):i.indexOf(e)}const{extent:n}=t;if(Array.isArray(e)||en[1])return-1;const a=t.interval||1;if(t.unit!=="ISO8601")return Math.round((e-n[0])/a);const r=n[0];let o=-1;switch(((u=t.intervalUnit)==null?void 0:u.toLowerCase())||"seconds"){case"seconds":o=Math.round((e-r)/1e3/a);break;case"minutes":o=Math.round((e-r)/6e4/a);break;case"hours":o=Math.round((e-r)/36e5/a);break;case"days":o=Math.round((e-r)/864e5/a);break;case"months":{const d=new Date(e).getUTCFullYear()-new Date(r).getUTCFullYear(),c=new Date(r).getUTCMonth(),p=new Date(e).getUTCMonth();o=d===0?p-c:p+11-c+12*(d-1)}break;case"years":o=Math.round((new Date(e).getUTCFullYear()-new Date(r).getUTCFullYear())/a);break;case"decades":o=Math.round((new Date(e).getUTCFullYear()-new Date(r).getUTCFullYear())/10/a)}return o}function pt(e){var o,u;let t=(o=e.values)==null?void 0:o.length;if(t)return t;const{extent:i,unit:n}=e,a=e.interval||1,r=i?i[1]-i[0]:0;if(n!=="ISO8601")return Math.round(r/a);switch(((u=e.intervalUnit)==null?void 0:u.toLowerCase())??"seconds"){case"seconds":t=Math.round(r/1e3/a);break;case"minutes":t=Math.round(r/6e4/a);break;case"hours":t=Math.round(r/36e5/a);break;case"days":t=Math.round(r/864e5/a);break;case"months":{const d=new Date(i[1]).getUTCFullYear()-new Date(i[0]).getUTCFullYear(),c=new Date(i[0]).getUTCMonth(),p=new Date(i[1]).getUTCMonth();t=d===0?p-c+1:p+11-c+12*(d-1)+1}break;case"years":t=Math.round((new Date(i[1]).getUTCFullYear()-new Date(i[0]).getUTCFullYear())/a);break;case"decades":t=Math.round((new Date(i[1]).getUTCFullYear()-new Date(i[0]).getUTCFullYear())/10/a);break;default:t=0}return t}function Mn(e,t){let i=0;const n=e[0].variableName,a=[...t.variables].sort((r,o)=>r.name>o.name?1:-1);for(let r=0;rp.name>m.name?-1:1);if(o.name!==n){i+=u.map(p=>pt(p)).reduce((p,m)=>p*m);continue}const d=u.map(p=>pt(p)),c=u.length;for(let p=0;pD.dimensionName===u[p].name);if(m==null)return null;const w=zi(m.values[0],u[p]);if(w===-1)return null;d.shift(),i+=p===c-1?w:w*d.reduce((D,M)=>D*M)}break}return i}const Ui=.25,Ri=Dt.fromJSON({type:"multipart",colorRamps:[{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]}),mt=Dt.fromJSON(gi[0]),Ut=new Set(["scientific","standard-time","vector-uv","vector-magdir","vector-u","vector-v","vector-magnitude","vector-direction"]);function gn(e,t){const{attributeTable:i,colormap:n}=e;if(Oe(e)){const a=Fi(e);if(a!=null)return a}if(n!=null){const a=Oi(e);if(a!=null)return a}if(i!=null){const a=Vi(e);if(a!=null)return a}return ki(e,t)}function yn(e,t=!1){const i=["raster-stretch"];return bt(e,t)&&i.push("raster-colormap"),vt(e)&&i.push("unique-value"),yi(e,t)&&i.push("class-breaks"),hi(e)&&i.push("raster-shaded-relief"),Oe(e)&&i.push("vector-field"),Ii(e)&&i.push("flow"),i}function hn(e,t,i){const n=["nearest","bilinear","cubic","majority"].find(a=>a===(i==null?void 0:i.toLowerCase()));return t==="Map"?n??"bilinear":e.dataType==="standard-time"?n??"nearest":e.dataType==="thematic"||e.attributeTable||e.colormap?n==="nearest"||n==="majority"?n:"nearest":n??"bilinear"}function ki(e,t){e=Hi(e,t==null?void 0:t.variableName);const{bandCount:i}=e;let{bandIds:n,stretchType:a}=t||{};n!=null&&n.some(m=>m>=i)&&(n=null);let r=e.statistics,o=e.histograms;i>1?(n=n!=null&&n.length?n:Zi(e),r=r==null?null:n==null?void 0:n.map(m=>r[m]),o=o==null?null:n==null?void 0:n.map(m=>o[m])):n=[0],a==null&&(a=Pi(e));let u=!1;switch(a){case"none":u=!1;break;case"percent-clip":u=!(o!=null&&o.length);break;default:u=!(r!=null&&r.length)}const{dataType:d}=e,c=(n==null?void 0:n.length)===1&&Ut.has(d)?Ri:null,p=new Fe({stretchType:a,dynamicRangeAdjustment:u,colorRamp:c,outputMin:0,outputMax:255,gamma:(n==null?void 0:n.length)===1?[1]:[1,1,1],useGamma:!1});return a==="percent-clip"?p.maxPercent=p.minPercent=Ui:a==="standard-deviation"&&(p.numberOfStandardDeviations=2),u||e.multidimensionalInfo==null&&!(t!=null&&t.includeStatisticsInStretch)||(a==="percent-clip"?p.histograms=o:a!=="min-max"&&a!=="standard-deviation"||(p.statistics=r)),p}function Hi(e,t){const{multidimensionalInfo:i}=e;if(!t||!i)return e;const n=i.variables.find(a=>a.name===t);if(!n)return e;if(e=e.clone(),n){const{statistics:a,histograms:r}=n;a!=null&&a.length&&(e.statistics=a.map(o=>({min:o.min,max:o.max,avg:o.avg,stddev:o.stddev}))),r!=null&&r.length&&(e.histograms=r)}return e}function Zi(e){const t=e.bandCount;if(t===1)return null;if(t===2)return[0];const{bandInfos:i}=e;let n;if(i.length===t){const{red:a,green:r,blue:o,nir:u}=Ei(i);a!=null&&r!=null&&o!=null?n=[a,r,o]:u!=null&&a!=null&&r!=null&&(n=[u,a,r])}return!n&&t>=3&&(n=[0,1,2]),n}function Ei(e){const t={};for(let i=0;i=410&&r<=480&&o>=480&&o<=540?t.blue=i:t.green==null&&r>=490&&r<=560&&o>=560&&o<=610?t.green=i:t.red==null&&r>=595&&r<=670&&o>=660&&o<=730?t.red=i:t.nir==null&&r>=700&&r<=860&&o>=800&&o<=950&&(t.nir=i)}}return t}function Pi(e){let t="percent-clip";const{pixelType:i,dataType:n,histograms:a,statistics:r,multidimensionalInfo:o}=e,u=Ut.has(n)||n==="generic"&&o!=null;return i!=="u8"||n!=="processed"&&a!=null&&r!=null?i==="u8"||n==="elevation"||u?t="min-max":a!=null?t="percent-clip":r!=null&&(t="min-max"):t="none",t}function Vi(e,t,i,n){if(!vt(e,t))return null;const{attributeTable:a,statistics:r}=e,o=Rt(a,t),u=q(a,"red"),d=q(a,"green"),c=q(a,"blue"),p=new yt,m=[],w=new Set,D=!!(u&&d&&c);if(a!=null)a.features.forEach(M=>{const g=M.attributes[o.name];if(!w.has(M.attributes[o.name])&&g!=null){w.add(g);const x=D&&(u.type==="single"||u.type==="double")&&(d.type==="single"||d.type==="double")&&(c.type==="single"||c.type==="double")&&!a.features.some(R=>R.attributes[u.name]>1||R.attributes[d.name]>1||R.attributes[c.name]>1),z=x?255:1;m.push(new ot({value:M.attributes[o.name],label:M.attributes[o.name]+"",symbol:{type:"simple-fill",style:"solid",outline:null,color:new f(D?[M.attributes[u.name]*z,M.attributes[d.name]*z,M.attributes[c.name]*z,1]:[0,0,0,0])}}))}});else if(r!=null&&r[0])for(let M=r[0].min;M<=r[0].max;M++)m.push(new ot({value:M,label:M.toString(),symbol:{type:"simple-fill",style:"solid",outline:null,color:new f([0,0,0,0])}}));if(m.sort((M,g)=>M.value&&typeof M.value.valueOf()=="string"?0:M.value>g.value?1:-1),!D){const M=Le(mt,{numColors:m.length});m.forEach((g,x)=>g.symbol.color=new f(M[x].slice(1,4))),p.colorRamp=mt}if(i||n){const M=i||Le(n,{numColors:m.length}).map(g=>g.slice(1));m.forEach((g,x)=>g.symbol.color=new f(M[x])),p.colorRamp=n}return new Ge({field:o.name,uniqueValueInfos:m,authoringInfo:p})}function Rt(e,t,i){let n;return e!=null?(n=t?e.fields.find(a=>t.toLowerCase()===a.name.toLowerCase()):Gi(e.fields),n||(i||(n=e.fields.find(a=>a.type==="string")),n||(n=q(e,"value")))):n=new ii({name:"value"}),n}function Gi(e){let t;for(let i=0;ii.name.toLowerCase()===t)}function Oi(e){if(!bt(e))return null;let t;const{attributeTable:i,colormap:n}=e;if(i!=null){const a=q(i,"value"),r=Rt(i,null,!0);r.type==="string"&&(t={},i.features.forEach(o=>{const u=o.attributes;t[u[a.name]]=r?u[r.name]:u[a.name]}))}return We.createFromColormap(n,t)}const Wi=new Map([["m/s","meter-per-second"],["km/h","kilometer-per-hour"],["knots","knots"],["ft/s","feet-per-second"],["mph","mile-per-hour"]]);function Fi(e){if(!Oe(e))return null;let t;if(e.statistics!=null&&e.statistics.length&&(e.dataType==="vector-magdir"||e.dataType==="vector-uv")){const{minMagnitude:a,maxMagnitude:r}=Ji(e.dataType,e.statistics);t=[{type:"size",field:"Magnitude",minSize:10,maxSize:40,minDataValue:a,maxDataValue:r}]}const i=e.multidimensionalInfo!=null?Wi.get(e.multidimensionalInfo.variables[0].unit):null,n=new Je({visualVariables:t,inputUnit:i,rotationType:"geographic"});return n.visualVariables=[...n.sizeVariables,...n.rotationVariables],n}function Mt(e){var t;return{color:(t=e.symbolLayers[0].material)==null?void 0:t.color,type:"esriSFS",style:"esriSFSSolid"}}function In(e){var t,i;if(e.type==="uniqueValue"){const n=e.uniqueValueInfos,a=n==null?void 0:n[0].symbol;return(t=a==null?void 0:a.symbolLayers)!=null&&t.length&&(e.uniqueValueInfos=n==null?void 0:n.map(r=>({value:r.value,label:r.label,symbol:r.symbol?Mt(r.symbol):null}))),e}if(e.type==="classBreaks"){const n=e.classBreakInfos,a=n[0].symbol;return(i=a==null?void 0:a.symbolLayers)!=null&&i.length&&(e.classBreakInfos=n.map(r=>({classMinValue:r.classMinValue,classMaxValue:r.classMaxValue,label:r.label,symbol:r.symbol?Mt(r.symbol):null}))),e}return e}function Ji(e,t){let i,n;if(e==="vector-magdir")i=t[0].min,n=t[0].max;else{const a=t[0].min,r=t[0].max,o=t[1].min,u=t[1].max;i=0,n=Math.max(Math.abs(a),Math.abs(o),Math.abs(r),Math.abs(u))}return{minMagnitude:i,maxMagnitude:n}}async function kt(e,t,i){var _e,Ke,Qe,Xe,Ye,qe,et,tt,it,nt;const n=ni(e),{rasterFunction:a,sourceJSON:r}=t||{},o=a?JSON.stringify(a.rasterFunctionDefinition||a):null,u=ai({...n.query,renderingRule:o,f:"json"}),d=ri(u,i);e=n.path;const c=r||await W(e,d).then(T=>T.data),p=c.hasRasterAttributeTable?W(`${e}/rasterAttributeTable`,d):null,m=c.hasColormap?W(`${e}/colormap`,d):null,w=c.hasHistograms?W(`${e}/histograms`,d):null,D=c.currentVersion>=10.3?W(`${e}/keyProperties`,d):null,M=c.hasMultidimensions?W(`${e}/multidimensionalInfo`,d):null,g=await Promise.allSettled([p,m,w,D,M]);let x=null;if(c.minValues&&c.minValues.length===c.bandCount){x=[];for(let T=0;T{var at;(at=T.statistics)!=null&&at.length&&T.statistics.forEach(oe=>{oe.avg=oe.mean,oe.stddev=oe.standardDeviation})});const{defaultVariable:De,serviceDataType:_}=c;De&&De!==$.DefaultVariable&&($.DefaultVariable=De),_!=null&&_.includes("esriImageServiceDataTypeVector")&&!_.includes($.DataType)&&($.DataType=_.replace("esriImageServiceDataType",""));let be=c.noDataValue;return(nt=c.noDataValues)!=null&&nt.length&&c.noDataValues.some(T=>T!==be)&&(be=c.noDataValues),new wi({width:R,height:Ht,bandCount:c.bandCount,extent:Ce.fromJSON(c.extent),spatialReference:$e,pixelSize:new we({x:c.pixelSizeX,y:c.pixelSizeY,spatialReference:$e}),pixelType:c.pixelType.toLowerCase(),statistics:x,attributeTable:Zt,colormap:Et,histograms:Pt,keyProperties:$,noDataValue:be,multidimensionalInfo:Ae})}function wn(e,t,i){return kt(e,{sourceJSON:t},i)}function fn(e,t,i){return kt(e,{rasterFunction:t},i)}function An(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}var Ve;let B=Ve=class extends N{constructor(){super(...arguments),this.geometry=null,this.mosaicRule=null,this.rasterFunction=null,this.pixelSize=null,this.raster=void 0,this.timeExtent=null}writeGeometry(e,t,i){e!=null&&(t.geometryType=ui(e),t[i]=e.toJSON())}get renderingRule(){return Me(ge.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._get("rasterFunction")}set renderingRule(e){Me(ge.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}clone(){return new Ve(A({geometry:this.geometry,mosaicRule:this.mosaicRule,rasterFunction:this.rasterFunction,pixelSize:this.pixelSize,raster:this.raster,timeExtent:this.timeExtent}))}};s([l({types:li,json:{read:At}})],B.prototype,"geometry",void 0),s([Ie("geometry")],B.prototype,"writeGeometry",null),s([l({type:Ti,json:{write:!0}})],B.prototype,"mosaicRule",void 0),s([l({type:ye})],B.prototype,"renderingRule",null),s([l({type:ye,json:{write:!0,name:"renderingRule"}})],B.prototype,"rasterFunction",void 0),s([l({type:we,json:{write:!0}})],B.prototype,"pixelSize",void 0),s([l({json:{write:!0}})],B.prototype,"raster",void 0),s([l({type:ci,json:{read:{source:"time"},write:{target:"time"}}})],B.prototype,"timeExtent",void 0),B=Ve=s([j("esri.rest.support.ImageHistogramParameters")],B);const Dn=B;export{Hi as B,Mn as D,Zi as E,In as K,ye as N,hn as S,gn as V,cn as a,Xi as b,rn as c,ct as d,Dn as e,dn as f,Bi as g,pn as h,ln as i,mn as j,An as k,lt as l,wn as m,Yi as n,zt as o,ee as p,qi as q,Ti as r,je as s,on as t,fn as u,un as v,yn as w}; diff --git a/dist/assets/ImageHistogramParameters-sFtZwJ9j.js b/dist/assets/ImageHistogramParameters-sFtZwJ9j.js deleted file mode 100644 index c031d1a..0000000 --- a/dist/assets/ImageHistogramParameters-sFtZwJ9j.js +++ /dev/null @@ -1 +0,0 @@ -import{dp as he,uc as Mt,ab as f,e as s,y as l,l1 as ve,iw as W,oF as yt,pS as Vt,c as j,dr as N,ey as E,ud as ht,dt as z,ue as It,bI as A,du as Ie,oD as wt,uf as ft,T as we,bN as Gt,S as Ot,J as Ft,a8 as Jt,ug as Wt,uh as $t,ui as _t,uj as Kt,jl as fe,dY as Se,uk as rt,jk as Ge,dm as Qt,ul as K,pR as te,f6 as Xt,um as ge,Z as Me,dy as At,ha as Yt,dT as Ce,l as qt,g1 as ei,E as C,e3 as ti,un as Dt,uo as ot,dw as ii,dZ as ni,f$ as ai,f_ as ri,bW as F,ar as oi,dx as si,ev as li,gb as ci}from"./index-J0iiHjMT.js";import{o as Le,p as de,q as ui,t as H,v as di,f as pi,w as mi,u as P,x as gi,y as Oe,z as bt,A as vt,C as Mi,E as yi,G as hi,b as Ii}from"./dataUtils-s_UKlouc.js";import"./generateRendererUtils-_1jVE02H.js";import{d as wi}from"./FeatureSet-d4S1oKME.js";var xe;const se=new he({flow_from:"flow-from",flow_to:"flow-to"});let b=xe=class extends Mt(N){constructor(e){super(e),this.density=.8,this.color=new f([255,255,255,1]),this.maxPathLength=200,this.trailWidth=1.5,this.flowSpeed=10,this.trailLength=100,this.smoothing=0,this.flowRepresentation="flow-from",this.type="flow",this.authoringInfo=null,this.legendOptions=null,this.trailCap="butt",this.background="none"}clone(){var D,g;const{density:e,maxPathLength:t,trailWidth:i,flowSpeed:n,trailLength:a,smoothing:r,flowRepresentation:o,trailCap:u,background:d}=this,c=this.color.clone(),p=(this.visualVariables||[]).map(M=>M.clone()),m=(D=this.authoringInfo)==null?void 0:D.clone(),w=(g=this.legendOptions)==null?void 0:g.clone();return new xe({density:e,color:c,maxPathLength:t,trailWidth:i,flowSpeed:n,trailLength:a,trailCap:u,background:d,smoothing:r,flowRepresentation:o,visualVariables:p,authoringInfo:m,legendOptions:w})}getSymbol(e,t){}async getSymbolAsync(e,t){}getSymbols(){return[]}};s([l({type:Number,json:{write:!0}})],b.prototype,"density",void 0),s([l({type:f,json:{write:{allowNull:!0}}})],b.prototype,"color",void 0),s([l({type:Number,cast:ve,json:{write:!0}})],b.prototype,"maxPathLength",void 0),s([l({type:Number,cast:ve,json:{write:!0}})],b.prototype,"trailWidth",void 0),s([l({type:Number,json:{write:!0}})],b.prototype,"flowSpeed",void 0),s([l({type:Number,json:{write:!0}})],b.prototype,"trailLength",void 0),s([l({type:Number,cast:ve,json:{write:!1}})],b.prototype,"smoothing",void 0),s([l({type:se.apiValues,json:{type:se.jsonValues,read:{reader:se.read},write:{writer:se.write}}})],b.prototype,"flowRepresentation",void 0),s([W({flowRenderer:"flow"})],b.prototype,"type",void 0),s([l({type:yt,json:{write:!0}})],b.prototype,"authoringInfo",void 0),s([l({type:Vt,json:{write:!0}})],b.prototype,"legendOptions",void 0),s([l({type:String,json:{write:!0}})],b.prototype,"trailCap",void 0),s([l({type:String,json:{write:!0}})],b.prototype,"background",void 0),b=xe=s([j("esri.renderers.FlowRenderer")],b);const St=b;let J=class extends N{constructor(){super(...arguments),this.value=null,this.label=null,this.color=null}};s([l({type:Number,json:{write:!0}})],J.prototype,"value",void 0),s([l({type:String,json:{write:!0}})],J.prototype,"label",void 0),s([l({type:f,json:{type:[E],write:!0}})],J.prototype,"color",void 0),J=s([j("esri.renderers.support.ColormapInfo")],J);const jt=J;var Q;let X=Q=class extends N{constructor(e){super(e),this.colormapInfos=null,this.type="raster-colormap"}static createFromColormap(e,t){if(!e)return null;const i=e[0].length===5,n=[...e].sort((a,r)=>a[0]-r[0]).map(a=>jt.fromJSON({value:a[0],color:i?a.slice(1,5):a.slice(1,4).concat([255]),label:t?t[a[0]]??"":a[0]}));return new Q({colormapInfos:n})}static createFromColorramp(e){const t=Le(e);return Q.createFromColormap(t)}clone(){return new Q({colormapInfos:this.colormapInfos.map(e=>e.toJSON())})}extractColormap(){return this.colormapInfos.map(({value:e,color:t})=>[e,t.r,t.g,t.b,t.a>1?t.a:255*t.a&255]).sort((e,t)=>e[0]-t[0])}};s([l({type:[jt],json:{write:!0}})],X.prototype,"colormapInfos",void 0),s([W({rasterColormap:"raster-colormap"})],X.prototype,"type",void 0),X=Q=s([j("esri.renderers.RasterColormapRenderer")],X);const Fe=X;var Be;let L=Be=class extends N{constructor(e){super(e),this.altitude=45,this.azimuth=315,this.colorRamp=null,this.hillshadeType="traditional",this.pixelSizePower=.664,this.pixelSizeFactor=.024,this.scalingType="none",this.type="raster-shaded-relief",this.zFactor=1}readColorRamp(e){return It(e)}clone(){return new Be({hillshadeType:this.hillshadeType,altitude:this.altitude,azimuth:this.azimuth,zFactor:this.zFactor,scalingType:this.scalingType,pixelSizeFactor:this.pixelSizeFactor,pixelSizePower:this.pixelSizePower,colorRamp:A(this.colorRamp)})}};s([l({type:Number,json:{write:!0}})],L.prototype,"altitude",void 0),s([l({type:Number,json:{write:!0}})],L.prototype,"azimuth",void 0),s([l({types:ht,json:{write:!0}})],L.prototype,"colorRamp",void 0),s([z("colorRamp")],L.prototype,"readColorRamp",null),s([l({type:["traditional","multi-directional"],json:{write:!0}})],L.prototype,"hillshadeType",void 0),s([l({type:Number,json:{write:!0}})],L.prototype,"pixelSizePower",void 0),s([l({type:Number,json:{write:!0}})],L.prototype,"pixelSizeFactor",void 0),s([l({type:["none","adjusted"],json:{write:!0}})],L.prototype,"scalingType",void 0),s([W({rasterShadedRelief:"raster-shaded-relief"})],L.prototype,"type",void 0),s([l({type:Number,json:{write:!0}})],L.prototype,"zFactor",void 0),L=Be=s([j("esri.renderers.RasterShadedReliefRenderer")],L);const Nt=L;var Ue;let y=Ue=class extends N{constructor(e){super(e),this.colorRamp=null,this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.maxPercent=null,this.minPercent=null,this.numberOfStandardDeviations=null,this.outputMax=null,this.outputMin=null,this.sigmoidStrengthLevel=null,this.statistics=[],this.histograms=null,this.useGamma=!1,this.stretchType="none",this.type="raster-stretch"}readColorRamp(e){if(e)return It(e)}writeStatistics(e,t,i){e!=null&&e.length&&(Array.isArray(e[0])||(e=e.map(n=>[n.min,n.max,n.avg,n.stddev])),t[i]=e)}readStretchType(e,t){let i=t.stretchType;return typeof i=="number"&&(i=ui[i]),de.read(i)}clone(){return new Ue({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:A(this.statistics),gamma:A(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,colorRamp:A(this.colorRamp),histograms:A(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment})}};s([l({types:ht,json:{write:!0}})],y.prototype,"colorRamp",void 0),s([z("colorRamp")],y.prototype,"readColorRamp",null),s([l({type:Boolean,json:{write:!0}})],y.prototype,"computeGamma",void 0),s([l({type:Boolean,json:{write:{target:"dra"},read:{source:"dra"}}})],y.prototype,"dynamicRangeAdjustment",void 0),s([l({type:[Number],json:{write:!0}})],y.prototype,"gamma",void 0),s([l({type:Number,json:{write:!0}})],y.prototype,"maxPercent",void 0),s([l({type:Number,json:{write:!0}})],y.prototype,"minPercent",void 0),s([l({type:Number,json:{write:!0}})],y.prototype,"numberOfStandardDeviations",void 0),s([l({type:Number,json:{read:{source:"max"},write:{target:"max"}}})],y.prototype,"outputMax",void 0),s([l({type:Number,json:{read:{source:"min"},write:{target:"min"}}})],y.prototype,"outputMin",void 0),s([l({type:Number,json:{write:!0}})],y.prototype,"sigmoidStrengthLevel",void 0),s([l({json:{type:[[Number]],write:!0}})],y.prototype,"statistics",void 0),s([l()],y.prototype,"histograms",void 0),s([Ie("statistics")],y.prototype,"writeStatistics",null),s([l({type:Boolean,json:{write:!0}})],y.prototype,"useGamma",void 0),s([l({type:de.apiValues,json:{type:de.jsonValues,write:de.write}})],y.prototype,"stretchType",void 0),s([z("stretchType",["stretchType"])],y.prototype,"readStretchType",null),s([W({rasterStretch:"raster-stretch"})],y.prototype,"type",void 0),y=Ue=s([j("esri.renderers.RasterStretchRenderer")],y);const Je=y;var ze;const st=new Set(["esriMetersPerSecond","esriKilometersPerHour","esriKnots","esriFeetPerSecond","esriMilesPerHour"]),le=new he({beaufort_ft:"beaufort-ft",beaufort_km:"beaufort-km",beaufort_kn:"beaufort-kn",beaufort_m:"beaufort-m",beaufort_mi:"beaufort-mi",classified_arrow:"classified-arrow",ocean_current_kn:"ocean-current-kn",ocean_current_m:"ocean-current-m",simple_scalar:"simple-scalar",single_arrow:"single-arrow",wind_speed:"wind-barb"}),ce=new he({flow_from:"flow-from",flow_to:"flow-to"});let v=ze=class extends Mt(N){constructor(e){super(e),this.attributeField="Magnitude",this.flowRepresentation="flow-from",this.rotationType="arithmetic",this.style="single-arrow",this.symbolTileSize=50,this.type="vector-field"}readInputUnit(e,t){return st.has(e)?H.fromJSON(e):null}readOutputUnit(e,t){return st.has(e)?H.fromJSON(e):null}get styleRenderer(){const e=this.style,t=this.attributeField,i=this._createStyleRenderer(e);return i.field=t,i}get sizeVariables(){const e=[];if(this.visualVariables)for(const t of this.visualVariables)t.type==="size"&&e.push(t);if(e.length===0){const t=new wt({field:"Magnitude",minSize:.2*this.symbolTileSize,maxSize:.8*this.symbolTileSize});this.visualVariables?this.visualVariables.push(t):this._set("visualVariables",[t]),e.push(t)}return e}get rotationVariables(){const e=[];if(this.visualVariables)for(const t of this.visualVariables)t.type==="rotation"&&e.push(t);if(e.length===0){const t=new ft({field:"Direction",rotationType:this.rotationType});this.visualVariables?this.visualVariables.push(t):this._set("visualVariables",[t]),e.push(t)}return e}clone(){return new ze({attributeField:this.attributeField,flowRepresentation:this.flowRepresentation,rotationType:this.rotationType,symbolTileSize:this.symbolTileSize,style:this.style,visualVariables:A(this.visualVariables),inputUnit:this.inputUnit,outputUnit:this.outputUnit})}async getGraphicsFromPixelData(e,t=!1,i=[]){var w;const n=new Array,a=di(this.inputUnit,this.outputUnit),r=((w=this.rotationVariables[0])==null?void 0:w.rotationType)||this.rotationType,o=t?pi(e.pixelBlock,"vector-uv",r,a):mi(e.pixelBlock,"vector-magdir",a);if(o==null)return n;const u=e.extent,d=o.mask!=null&&o.mask.length>0;let c=0;const p=(u.xmax-u.xmin)/o.width,m=(u.ymax-u.ymin)/o.height;for(let D=0;DU.intersects(M));if((!d||o.mask[c])&&!x){const U={Magnitude:o.pixels[0][c],Direction:o.pixels[1][c]},R=new Ot({geometry:{type:"point",x:M.x,y:M.y,spatialReference:u.spatialReference},attributes:U});R.symbol=this._getVisualVariablesAppliedSymbol(R),n.push(R)}}return n}getSymbol(e,t){}async getSymbolAsync(e,t){}getSymbols(){return[]}getClassBreakInfos(){var e;return(e=this.styleRenderer)==null?void 0:e.classBreakInfos}getDefaultSymbol(){var e;return(e=this.styleRenderer)==null?void 0:e.defaultSymbol}_getDefaultSymbol(e){return new Ft({path:"M14,32 14,18 9,23 16,3 22,23 17,18 17,32 z",outline:new Jt({width:0}),size:20,color:e||new f([0,92,230])})}_getVisualVariablesAppliedSymbol(e){var a,r;if(!e)return;const t=(r=(a=this.styleRenderer)==null?void 0:a.getSymbol(e))==null?void 0:r.clone(),i=this.sizeVariables,n=this.rotationVariables;if(i&&i.length&&this.sizeVariables.forEach(o=>Wt(t,$t([o],e))),n&&n.length){const o=this.flowRepresentation==="flow-to"==(this.style==="ocean-current-kn"||this.style==="ocean-current-m")?0:180;e.attributes.Direction=e.attributes.Direction+o,this.rotationVariables.forEach(u=>_t(t,Kt(u,e),u.axis))}return t}_createStyleRenderer(e){let t={defaultSymbol:this._getDefaultSymbol(),classBreakInfos:[]};switch(e){case"single-arrow":t=this._createSingleArrowRenderer();break;case"beaufort-kn":t=this._createBeaufortKnotsRenderer();break;case"beaufort-m":t=this._createBeaufortMeterRenderer();break;case"beaufort-ft":t=this._createBeaufortFeetRenderer();break;case"beaufort-mi":t=this._createBeaufortMilesRenderer();break;case"beaufort-km":t=this._createBeaufortKilometersRenderer();break;case"ocean-current-m":t=this._createCurrentMeterRenderer();break;case"ocean-current-kn":t=this._createCurrentKnotsRenderer();break;case"simple-scalar":t=this._createSimpleScalarRenderer();break;case"wind-barb":t=this._createWindBarbsRenderer();break;case"classified-arrow":t=this._createClassifiedArrowRenderer()}return new fe(t)}_createSingleArrowRenderer(){return{defaultSymbol:this._getDefaultSymbol()}}_createBeaufortKnotsRenderer(){const e=[0,1,3,6,10,16,21,27,33,40,47,55,63],t=[[40,146,199],[89,162,186],[129,179,171],[160,194,155],[191,212,138],[218,230,119],[250,250,100],[252,213,83],[252,179,102],[250,141,52],[247,110,42],[240,71,29]];return{defaultSymbol:this._getDefaultSymbol(new f([214,47,39])),classBreakInfos:this._getClassBreaks(e,t)}}_createBeaufortMeterRenderer(){const e=[0,.2,1.8,3.3,5.4,8.5,11,14.1,17.2,20.8,24.4,28.6,32.7],t=[[69,117,181],[101,137,184],[132,158,186],[162,180,189],[192,204,190],[222,227,191],[255,255,191],[255,220,161],[250,185,132],[245,152,105],[237,117,81],[232,21,21]];return{defaultSymbol:this._getDefaultSymbol(new f([214,47,39])),classBreakInfos:this._getClassBreaks(e,t)}}_createBeaufortFeetRenderer(){const e=this._getDefaultSymbol(new f([214,47,39]));let t=[0,.2,1.8,3.3,5.4,8.5,11,14.1,17.2,20.8,24.4,28.6,32.7];const i=[[69,117,181],[101,137,184],[132,158,186],[162,180,189],[192,204,190],[222,227,191],[255,255,191],[255,220,161],[250,185,132],[245,152,105],[237,117,81],[232,21,21]],n=3.28084;return t=t.map(a=>a*n),{defaultSymbol:e,classBreakInfos:this._getClassBreaks(t,i)}}_createBeaufortMilesRenderer(){const e=this._getDefaultSymbol(new f([214,47,39]));let t=[0,.2,1.8,3.3,5.4,8.5,11,14.1,17.2,20.8,24.4,28.6,32.7];const i=[[69,117,181],[101,137,184],[132,158,186],[162,180,189],[192,204,190],[222,227,191],[255,255,191],[255,220,161],[250,185,132],[245,152,105],[237,117,81],[232,21,21]],n=2.23694;return t=t.map(a=>a*n),{defaultSymbol:e,classBreakInfos:this._getClassBreaks(t,i)}}_createBeaufortKilometersRenderer(){const e=this._getDefaultSymbol(new f([214,47,39]));let t=[0,.2,1.8,3.3,5.4,8.5,11,14.1,17.2,20.8,24.4,28.6,32.7];const i=[[69,117,181],[101,137,184],[132,158,186],[162,180,189],[192,204,190],[222,227,191],[255,255,191],[255,220,161],[250,185,132],[245,152,105],[237,117,81],[232,21,21]],n=3.6;return t=t.map(a=>a*n),{defaultSymbol:e,classBreakInfos:this._getClassBreaks(t,i)}}_createCurrentMeterRenderer(){const e=[0,.5,1,1.5,2],t=[[78,26,153],[179,27,26],[202,128,26],[177,177,177]];return{defaultSymbol:this._getDefaultSymbol(new f([177,177,177])),classBreakInfos:this._getClassBreaks(e,t)}}_createCurrentKnotsRenderer(){const e=[0,.25,.5,1,1.5,2,2.5,3,3.5,4],t=[[0,0,0],[0,37,100],[78,26,153],[151,0,100],[179,27,26],[177,78,26],[202,128,26],[177,179,52],[177,177,177]];return{defaultSymbol:this._getDefaultSymbol(new f([177,177,177])),classBreakInfos:this._getClassBreaks(e,t)}}_createClassifiedArrowRenderer(){var n;const e=this._getDefaultSymbol(new f([56,168,0]));let t=[0,1e-6,3.5,7,10.5,14];if((n=this.sizeVariables)!=null&&n.length){const a=this.sizeVariables[0].minDataValue,r=this.sizeVariables[0].maxDataValue;if(a&&r){const o=(r-a)/5;t=Array.from(Array(6).keys()).map(u=>a+o*u)}}const i=[[56,168,0],[139,309,0],[255,255,0],[255,128,0],[255,0,0]];return{defaultSymbol:e,classBreakInfos:this._getClassBreaks(t,i)}}_createSimpleScalarRenderer(){return{defaultSymbol:Se.fromJSON({imageData:"iVBORw0KGgoAAAANSUhEUgAAACsAAAArCAQAAABLVLlLAAAABGdBTUEAAYagMeiWXwAAAAJiS0dEAACqjSMyAAAACXBIWXMAAABIAAAASABGyWs+AAAC3ElEQVRIx9XXvW4cVRQH8N982btpsIREJECyiCXsxX4DKh6AliqGKCBBE2SlwlHgAbBD/AKmyEYUeQ1KahPZSZQvBCkQLTHZ7KGY8Xodz4w3a1NwbzVzz/znfJ//zbStVC5q3icKak9GAs2QIdDx3PtW/S011NW3p+M5Eomh11ipTIKe6+4LQzHaQ+G+63pIZNJJQXMpljwTwj1brpgx5w1zZlyx5Z4QnllEIm2xeeSUHBf0hV0bejo1Uh09G3aFvgXk7cCJFBc9EdaRVuHJJaOdKyTV2TVhYLMduNR0Q9gxL5GaaTDw8GzejrDRBpxWoGsySRW0dttKuattwNkIlFw2YXgzOdYq4Ox49PlM+JrKd5OusjTWhBuVxUfMX/KXXZ3WEmkuqa67wspR4BTbwtKr/5u4fFgStse/T7EifFPnnYl9zPq4vmUOPrRndgoHjDti1gOPqlyXoifcRNGQzUd31lDyfHmob1Gp35vSr+P6vilcQ5Egtyd8YF/ySg9NhPM+9M/IOaHwp5+PSZayXTvCogEUwlatC3J8LLwYtcWB8EuDXQVuCkV5/B4eNHb7wGBs87LBDS+xjdVSn09wq1G8dFM+9tSUhIGneLvUdniKxKpTYljCpu3j7rVWlHj/P23v4NPGUEyeCQnexe9lJjzEQqMjJs+EzNAX6B98dBZVRmroJx95x/A/6gln18EyfCUsl+qdXb/tjvfbw+mwforpUOBz4XLVoBwAn3aWnfeH246NyBXhrq7TTN5lNSP9RkU+puUJm3W2Tsdq0nZWM07srk7MwQrZSRysjjGWBLRJNsNbfj2JMR4AbxpU1XLAb9Mxfpsq5EjMuuiR8L0JiHOOBX3hiUvOmavN0nMueSzcceFk0BK4pMqLo7vDD1Z0qrtDx7Itt4Xwm9UqbMmk8S0Dtuzb2pvOU99Z1nLTOfleNmvfZfP2pYZmPfajwosKdDBNpacNpVGGsWX9CyDI8Xq/Sj6QAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE0LTExLTEwVDAzOjE3OjU4LTA1OjAwF+tHyQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNC0xMS0xMFQwMzoxNzo1OC0wNTowMGa2/3UAAAAASUVORK5CYII=",height:20,width:20,type:"esriPMS",angle:0})}}_createWindBarbsRenderer(){const e=Array.from(Array(31).keys()).map(a=>5*a),t=[{range:"0-5",path:"M20 20 M5 20 A15 15 0 1 0 35 20 A15 15 0 1 0 5 20 M20 20 M10 20 A10 10 0 1 0 30 20 A10 10 0 1 0 10 20",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTIwIDIwIE01IDIwIEExNSAxNSAwIDEgMCAzNSAyMCBBMTUgMTUgMCAxIDAgNSAyMCBNMjAgMjAgTTEwIDIwIEExMCAxMCAwIDEgMCAzMCAyMCBBMTAgMTAgMCAxIDAgMTAgMjAiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"5-10",path:"M25 0 L25 40 M25 35 L17.5 37.5",imageData:"PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjkgMCAyNyA0NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMjUgMCBMMjUgNDAgTTI1IDM1IEwxNy41IDM3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"10-15",path:"M25 0 L25 40 L10 45 L25 40",imageData:"PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjkgMCAyNyA0NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMjUgMCBMMjUgNDAgTDEwIDQ1IEwyNSA0MCIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"15-20",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L17.5 37.5",imageData:"PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjEyIDAgMTUgNDUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0NSBMMjUgNDAgTTI1IDM1IEwxNy41IDM3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"20-25",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40",imageData:"PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjkgMCAyNiA0NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMjUgMCBMMjUgNDAgTDEwIDQ1IEwyNSA0MCBNMjUgMzUgTDEwIDQwIiBzdHlsZT0ic3Ryb2tlOnJnYigwLDAsMCk7c3Ryb2tlLXdpZHRoOjEuNSIvPgogPC9zdmc+"},{range:"25-30",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40 L25 35 M25 30 L17.5 32.5",imageData:"PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjkgMCAyNiA0NiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8cGF0aCBkPSJNMjUgMCBMMjUgNDAgTDEwIDQ1IEwyNSA0MCBNMjUgMzUgTDEwIDQwIEwyNSAzNSBNMjUgMzAgTDE3LjUgMzIuNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"30-35",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40 L25 35 M25 30 L10 35",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0NiI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0NSBMMjUgNDAgTTI1IDM1IEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"35-40",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L17.5 27.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0NiI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0NSBMMjUgNDAgTTI1IDM1IEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxNy41IDI3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"40-45",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0NiI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0NSBMMjUgNDAgTTI1IDM1IEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"45-50",path:"M25 0 L25 40 L10 45 L25 40 M25 35 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L17.5 22.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0NiI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0NSBMMjUgNDAgTTI1IDM1IEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxNy41IDIyLjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"50-55",path:"M25 0 L25 40 L10 40 L25 35",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"55-60",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L17.5 32.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjIwcHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxNy41IDMyLjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"60-65",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"65-70",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L17.5 27.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxNy41IDI3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"70-75",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"75-80",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L17.5 22.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxNy41IDIyLjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"80-85",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L10 25",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxMCAyNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"85-90",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L10 25 L25 20 M25 15 L17.5 17.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxMCAyNSBMMjUgMjAgTTI1IDE1IEwxNy41IDE3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"90-95",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L10 25 L25 20 M25 15 L10 20",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxMCAyNSBMMjUgMjAgTTI1IDE1IEwxMCAyMCIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"95-100",path:"M25 0 L25 40 L10 40 L25 35 M25 30 L10 35 L25 30 M25 25 L10 30 L25 25 M25 20 L10 25 L25 20 M25 15 L10 20 L25 15 M25 10 L17.5 12.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTTI1IDMwIEwxMCAzNSBMMjUgMzAgTTI1IDI1IEwxMCAzMCBMMjUgMjUgTTI1IDIwIEwxMCAyNSBMMjUgMjAgTTI1IDE1IEwxMCAyMCBMMjUgMTUgTTI1IDEwIEwxNy41IDEyLjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="},{range:"100-105",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMnB4IiBoZWlnaHQ9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"105-110",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L17.5 27.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDE3LjUgMjcuNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"110-115",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIiBzdHlsZT0ic3Ryb2tlOnJnYigwLDAsMCk7c3Ryb2tlLXdpZHRoOjEuNSIvPgogPC9zdmc+"},{range:"115-120",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L17.5 22.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDE3LjUgMjIuNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"120-125",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IiBzdHlsZT0ic3Ryb2tlOnJnYigwLDAsMCk7c3Ryb2tlLXdpZHRoOjEuNSIvPgogPC9zdmc+"},{range:"125-130",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25 M25 20 M25 15 L17.5 17.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IE0yNSAyMCBNMjUgMTUgTDE3LjUgMTcuNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"130-135",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25 M25 20 M25 15 L10 20",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IE0yNSAyMCBNMjUgMTUgTDEwIDIwIiBzdHlsZT0ic3Ryb2tlOnJnYigwLDAsMCk7c3Ryb2tlLXdpZHRoOjEuNSIvPgogPC9zdmc+"},{range:"135-140",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25 M25 20 M25 15 L10 20 M25 15 M25 10 L17.5 12.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IE0yNSAyMCBNMjUgMTUgTDEwIDIwIE0yNSAxNSBNMjUgMTAgTDE3LjUgMTIuNSIgc3R5bGU9InN0cm9rZTpyZ2IoMCwwLDApO3N0cm9rZS13aWR0aDoxLjUiLz4KIDwvc3ZnPg=="},{range:"140-145",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25 M25 20 M25 15 L10 20 M25 15 M25 10 L17.5 12.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IE0yNSAyMCBNMjUgMTUgTDEwIDIwIE0yNSAxNSBNMjUgMTAgTDEwIDE1IiBzdHlsZT0ic3Ryb2tlOnJnYigwLDAsMCk7c3Ryb2tlLXdpZHRoOjEuNSIvPgogPC9zdmc+"},{range:"145-150",path:"M25 0 L25 40 L10 40 L25 35 L10 35 L25 30 M25 25 L10 30 M25 25 M25 20 L10 25 M25 20 M25 15 L10 20 M25 15 M25 10 L17.5 12.5",imageData:"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMzJweCIgd2lkdGg9IjMycHgiIHZpZXdCb3g9IjkgMCAyNiA0MSI+CiAgPHBhdGggZD0iTTI1IDAgTDI1IDQwIEwxMCA0MCBMMjUgMzUgTDEwIDM1IEwyNSAzMCBNMjUgMjUgTDEwIDMwIE0yNSAyNSBNMjUgMjAgTDEwIDI1IE0yNSAyMCBNMjUgMTUgTDEwIDIwIE0yNSAxNSBNMjUgMTAgTDEwIDE1IE0yNSAxMCBNMjUgNSBMMTcuNSA3LjUiIHN0eWxlPSJzdHJva2U6cmdiKDAsMCwwKTtzdHJva2Utd2lkdGg6MS41Ii8+CiA8L3N2Zz4="}],i=Se.fromJSON({imageData:"iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAQAAADtq6NDAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAJiS0dEAP+Hj8y/AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAEY0lEQVRIx5XXWWxWRRQH8N+d+31tUdGAVjGglYJABFEBY91jfDAg7piYaFTccA++uMQEFRcSXlATtxiXqMQt4G4iisYl0ai4sIQYtVFZ1KIFKdTS0l4f7vRCS5fPebozc+bM/2z/Mzcx0AgSiUxXnKfIdMn875FIhX53U2n/B/s+kKM4UINTjTBZImixxnrv+9a2iL6zEoUBXcoudrWj/OtHm3wt02lfU9Qao9OnHvIhgmww84MEl1qnxfNmGrqHxAizLdPpC6chGcAxKGGcL+30gOERf1BSpUqVslQSV8d5ReZFe8VQ9avufJn31cWwlJV7iafKStGOE/1qvfH9qUxxu8ydUdmuSKbGO8YUdT2inKLG69pM70tliktl5qIkCAJGmusDG7Vqsc0WjZa4UBlBiA5YZIcjYzB7qDtH5kaUJFLs7RGZTZ42W4PRRmtwvbdt1+wGiaS4drEtDttdZYIDNVuAclR3vA3+dI3qHqmVSy7U6Tv1MScCPvPR7nIpFlsdCy3FdTLPGhK92e2CUITjMJ9ocwKxnsZqc3O3JwMma3d6UVLnyVxB4aXemZqvPqLdpJhW3KVVbY4yYImPo6M5Urv50fj+0z/FG9YaEiENs8UtMfXUaTeTePNHlhXfA1UU+2lyD1Il3Gtt9+adfpNG7dNlpg2U/T3KYLZ2dUWFdTgp3/rQ4sK973qnInV5TIf40x3dhvrJPBiqyWUo4wAtLqhQYS71qK+QKOFRywmGK/kpikzV6WMKhh58vGWs4TIJNjiEYLIuP8Tt4/zmLyqk+AyrJSbF+Qq1DgqRUPMxyl+9q3IQhX/rMCJ6tEunriDs1oSyQZKlr9AkhT2ZIARbJfaJS1vtVbHB+Rgi0RK/y1q1BWsEEyLoz40xtGKcARPVWB1BTPO7f4LNtpkUl1aoMbViLyZo0GRjPD3BxnxjqXeLYlvhqYrzMMG3HoyJXa3JjfnGlbYYFlP7Jh3qKsKY4hQ7TY0nG+xwRL61n63mxHtqNHosigyMLmClNwvuecFnOZB88nNBDzNkzhxEZaKMBVoKapggMzvHHXBEpNSSFAvtcFRsVn0bW8LlMmcXs+c0Kne3gRR32+zg4uXwjC6zit6Wt4a8LXVfcp/MtQXHn2ynGbuCmb8GvvFeJLEE82ReU9/n6+dkq2x3buG9Wn94smcgAw631RPR7BTH+kbmHReZoEpOdEe7zWqZl40s0JWs9Hmv7hjBHqPDwsjGKVJnWWqjbdZp1KhJi0aPmxYZsIRhlttgeF+Jlke41QcOQKoqilSb6HJzSvNG3G/UoWnxwsmt+sVaYwd63dRbqdnMyCPVeyRPvpYgdavM22oGKoMUVRbJfOWMwidJ8Zzb1UvmWK/VVUXzHaTjjrVYh1897HT7xxYEVUaa5SWb/WO+YUWa9SrwvigzM8YlzlYv2GSdVCYxxlBtVnnFq5olwp5/BEk/OLsf5LUmG2+inRJdVvjZ97ZH9/zP34ug1O91pf4p+D+JYBpvrKxfbwAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNC0xMS0xMFQwMzoxMjowOS0wNTowMB9ViV0AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTQtMTEtMTBUMDM6MTI6MDktMDU6MDBuCDHhAAAAAElFTkSuQmCC",height:20,width:20,type:"esriPMS",angle:0}),n=e.map((a,r)=>{let o;if(r!==e.length-1)if(r===0)o={minValue:a,maxValue:e[r+1],symbol:i};else{const u=Se.fromJSON({type:"esriPMS",imageData:t[r].imageData,contentType:"image/svg+xml",height:32,width:32,angle:0});o={minValue:a,maxValue:e[r+1],symbol:u}}return new rt(o)});return{defaultSymbol:i,classBreakInfos:n}}_getClassBreaks(e,t){return t.map((i,n)=>new rt({minValue:e[n],maxValue:e[n+1],symbol:this._getDefaultSymbol(new f(i))}))}};s([l({type:String,json:{write:!0}})],v.prototype,"attributeField",void 0),s([l({type:ce.apiValues,json:{type:ce.jsonValues,read:{reader:ce.read},write:{writer:ce.write}}})],v.prototype,"flowRepresentation",void 0),s([l({type:["geographic","arithmetic"],json:{write:!0}})],v.prototype,"rotationType",void 0),s([l({type:le.apiValues,json:{type:le.jsonValues,read:{reader:le.read},write:{writer:le.write}}})],v.prototype,"style",void 0),s([l({json:{write:!0}})],v.prototype,"symbolTileSize",void 0),s([l({type:H.apiValues,json:{type:H.jsonValues,write:{writer:H.write}}})],v.prototype,"inputUnit",void 0),s([z("inputUnit")],v.prototype,"readInputUnit",null),s([l({type:H.apiValues,json:{type:H.jsonValues,read:{reader:H.read},write:{writer:H.write}}})],v.prototype,"outputUnit",void 0),s([z("outputUnit")],v.prototype,"readOutputUnit",null),s([W({vectorField:"vector-field"})],v.prototype,"type",void 0),s([l({type:fe})],v.prototype,"styleRenderer",null),s([l({type:wt})],v.prototype,"sizeVariables",null),s([l({type:ft})],v.prototype,"rotationVariables",null),v=ze=s([j("esri.renderers.VectorFieldRenderer")],v);const We=v,lt={key:"type",base:null,typeMap:{"unique-value":Ge,"class-breaks":fe,"raster-colormap":Fe,"raster-stretch":Je,"vector-field":We,"raster-shaded-relief":Nt,flow:St}},ct={...lt,typeMap:{...lt.typeMap}};delete ct.typeMap["vector-field"],delete ct.typeMap.flow;const fi={uniqueValue:Ge,classBreaks:fe,rasterStretch:Je,rasterColormap:Fe,vectorField:We,rasterShadedRelief:Nt,flowRenderer:St};function Ai(e){return e&&fi[e.type]||null}function Yi(e,t){if(!e)return null;if(e.type==="classBreaks"&&e.classificationMethod){const n=e.authoringInfo||{classificationMethod:""};n.classificationMethod=e.classificationMethod,e.authoringInfo=n}e.type==="vectorField"&&e.visualVariables&&!Array.isArray(e.visualVariables)&&(e.visualVariables=[e.visualVariables]);const i=Ai(e);if(i){const n=new i;return n.read(e,t),n}return t!=null&&t.messages&&e&&t.messages.push(new Qt("renderer:unsupported","Renderers of type '"+(e.type||"unknown")+"' are not supported",{definition:e,context:t})),null}var Re;let V=Re=class extends N{constructor(e){super(e),this.variableName=null,this.dimensionName=null,this.values=[],this.isSlice=!1}clone(){return new Re({variableName:this.variableName,dimensionName:this.dimensionName,values:A(this.values),isSlice:this.isSlice})}};s([l({type:String,json:{write:!0}})],V.prototype,"variableName",void 0),s([l({type:String,json:{write:!0}})],V.prototype,"dimensionName",void 0),s([l({type:K.array(K.oneOf([K.native(Number),K.array(K.native(Number))])),json:{write:!0}})],V.prototype,"values",void 0),s([l({type:Boolean,json:{write:!0}})],V.prototype,"isSlice",void 0),V=Re=s([j("esri.layers.support.DimensionalDefinition")],V);const ee=V,qi=te()({RSP_NearestNeighbor:"nearest",RSP_BilinearInterpolation:"bilinear",RSP_CubicConvolution:"cubic",RSP_Majority:"majority"}),en=te()({esriNoDataMatchAny:"any",esriNoDataMatchAll:"all"}),je=te()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"});let Z=class extends N{constructor(){super(...arguments),this.pixelType="unknown"}};s([l({type:String,json:{write:!0}})],Z.prototype,"name",void 0),s([l({type:String,json:{write:!0}})],Z.prototype,"description",void 0),s([l({type:E,json:{type:E,write:!0,name:"_object_id"}})],Z.prototype,"id",void 0),s([l({type:String,json:{type:je.jsonValues,read:je.read,write:je.write}})],Z.prototype,"pixelType",void 0),s([l({type:String,json:{write:!0}})],Z.prototype,"type",void 0),Z=s([j("esri.layers.support.RasterFunctionInfo")],Z);const Di=Z;let k=class extends N{constructor(){super(...arguments),this.isDataset=!1,this.isPublic=!1,this.type="RasterFunctionVariable"}};s([l({type:String,json:{write:!0}})],k.prototype,"name",void 0),s([l({type:Number,json:{type:E,write:!0,name:"_object_id"}})],k.prototype,"id",void 0),s([l({type:Boolean,json:{write:!0}})],k.prototype,"isDataset",void 0),s([l({type:Boolean,json:{write:!0}})],k.prototype,"isPublic",void 0),s([l({json:{write:!0}})],k.prototype,"value",void 0),s([l({type:String,json:{write:!0}})],k.prototype,"type",void 0),k=s([j("esri.layers.support.RasterFunctionVariable")],k);const bi=k,ue={key:"type",base:null,typeMap:{RasterFunctionVariable:bi}};let G=class extends N{};s([l({types:ue,json:{types:ue,name:"MatchVariable"}})],G.prototype,"matchVariable",void 0),s([l({types:ue,json:{types:ue,name:"UnionDimension"}})],G.prototype,"unionDimension",void 0),s([l({type:Number,json:{type:E,write:!0,name:"_object_id"}})],G.prototype,"id",void 0),s([l({type:String,json:{write:!0}})],G.prototype,"type",void 0),G=s([j("esri.layers.support.RasterFunctionProperties")],G);const vi=G,Ne=new he({0:"mosaic",1:"item",2:"item-group"},{useNumericKeys:!0});let I=class extends N{constructor(){super(...arguments),this.functionType="mosaic",this.type="RasterFunctionTemplate"}};s([l({type:[String],json:{write:!0}})],I.prototype,"aliases",void 0),s([l({type:Object,json:{write:!0}})],I.prototype,"arguments",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"description",void 0),s([l({type:Di,json:{write:!0,name:"function"}})],I.prototype,"functionInfo",void 0),s([l({type:Ne.apiValues,json:{type:[0,1,2],read:Ne.read,write:Ne.write}})],I.prototype,"functionType",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"group",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"help",void 0),s([l({type:Number,json:{type:E,write:!0,name:"_object_id"}})],I.prototype,"id",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"name",void 0),s([l({type:String,json:{write:!0,name:"definition"}})],I.prototype,"queryDefinition",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"tag",void 0),s([l({type:vi,json:{write:!0}})],I.prototype,"properties",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"thumbnail",void 0),s([l({type:String,json:{write:!0}})],I.prototype,"thumbnailEx",void 0),s([l({json:{type:["RasterFunctionTemplate"],write:!0}})],I.prototype,"type",void 0),I=s([j("esri.layers.support.RasterFunctionTemplate")],I);const Tt=I;var ke;const pe=new Set(["raster","raster2","dem","fillraster"]),me=new Set(["rasters"]),ut=e=>e!=null&&e.rasterFunction?S.fromJSON(e):e,Te=e=>e&&e instanceof S?e.toJSON():e,He=e=>(e==null?void 0:e.functionName)&&!e.declaredClass,dt=e=>He(e)?new S(e):e,Si=e=>{if(e==null)return null;e=A(e);const t={};for(const i of Object.keys(e))pe.has(i.toLowerCase())?t[i]=ut(e[i]):me.has(i.toLowerCase())&&Array.isArray(e[i])?t[i]=e[i].map(ut):t[i]=e[i];return t},ji={types:{key:"type",base:null,typeMap:{RasterFunctionTemplate:Tt}},json:{write:!0,name:"rasterFunctionDefinition"}};let S=ke=class extends N{constructor(e){super(e),this.functionName=null,this.outputPixelType="unknown",this.variableName=null,this.functionDefinition=null}set functionArguments(e){if(e){const t=Object.keys(e);if(t.some(i=>pe.has(i.toLowerCase())&&He(e[i]))||t.some(i=>me.has(i.toLowerCase())&&Array.isArray(e[i])&&e[i].some(n=>He(n)))){e=A(e);for(const i of t)pe.has(i.toLowerCase())?e[i]=dt(e[i]):me.has(i.toLowerCase())&&Array.isArray(e[i])&&(e[i]=e[i].map(n=>dt(n)))}}this._set("functionArguments",e)}readFunctionArguments(e){return Si(e)}writeFunctionArguments(e,t,i){const n={};for(const a of Object.keys(e))pe.has(a.toLowerCase())?n[a]=Te(e[a]):me.has(a.toLowerCase())&&Array.isArray(e[a])?n[a]=e[a].map(Te):n[a]=Te(e[a]);t[i]=n}readFunctionName(e,t){const i=t.rasterFunctionInfos;return t.name||(i!=null&&i.length&&i[0].name!=="None"?i[0].name:t.rasterFunctionDefinition?t.rasterFunctionDefinition.name:t.rasterFunction)}get rasterFunctionDefinition(){var e;return(e=this.functionDefinition)==null?void 0:e.toJSON()}set rasterFunctionDefinition(e){this.functionDefinition=e?Tt.fromJSON(e):null}clone(){return new ke({functionName:this.functionName,functionArguments:A(this.functionArguments),outputPixelType:this.outputPixelType,variableName:this.variableName,rasterFunctionDefinition:A(this.rasterFunctionDefinition)})}};s([l({json:{type:Object,name:"rasterFunctionArguments"}})],S.prototype,"functionArguments",null),s([z("functionArguments")],S.prototype,"readFunctionArguments",null),s([Ie("functionArguments")],S.prototype,"writeFunctionArguments",null),s([l({json:{type:String,write:{target:"rasterFunction"}}})],S.prototype,"functionName",void 0),s([z("functionName",["rasterFunction","rasterFunctionInfos","rasterFunctionDefinition"])],S.prototype,"readFunctionName",null),s([W({C128:"c128",C64:"c64",F32:"f32",F64:"f64",S16:"s16",S32:"s32",S8:"s8",U1:"u1",U16:"u16",U2:"u2",U32:"u32",U4:"u4",U8:"u8",UNKNOWN:"unknown"},{ignoreUnknown:!1}),l({json:{default:"unknown"}})],S.prototype,"outputPixelType",void 0),s([l({type:String,json:{read:!0,write:!0}})],S.prototype,"variableName",void 0),s([l()],S.prototype,"rasterFunctionDefinition",null),s([l(ji)],S.prototype,"functionDefinition",void 0),S=ke=s([j("esri.layers.support.RasterFunction")],S);const ye=S;var Ze;const Y=te()({MT_FIRST:"first",MT_LAST:"last",MT_MIN:"min",MT_MAX:"max",MT_MEAN:"mean",MT_BLEND:"blend",MT_SUM:"sum"}),Ee=te()({esriMosaicNone:"none",esriMosaicCenter:"center",esriMosaicNadir:"nadir",esriMosaicViewpoint:"viewpoint",esriMosaicAttribute:"attribute",esriMosaicLockRaster:"lock-raster",esriMosaicNorthwest:"northwest",esriMosaicSeamline:"seamline"});function Ni(e){let t;switch(e?e.toLowerCase().replace("esrimosaic",""):""){case"byattribute":case"attribute":t="esriMosaicAttribute";break;case"lockraster":t="esriMosaicLockRaster";break;case"center":t="esriMosaicCenter";break;case"northwest":t="esriMosaicNorthwest";break;case"nadir":t="esriMosaicNadir";break;case"viewpoint":t="esriMosaicViewpoint";break;case"seamline":t="esriMosaicSeamline";break;default:t="esriMosaicNone"}return Ee.fromJSON(t)}let h=Ze=class extends N{constructor(e){super(e),this.ascending=!0,this.itemRasterFunction=null,this.lockRasterIds=null,this.method=null,this.multidimensionalDefinition=null,this.objectIds=null,this.operation=null,this.sortField=null,this.sortValue=null,this.viewpoint=null,this.where=null}readAscending(e,t){return t.ascending!=null?t.ascending:t.sortAscending==null||t.sortAscending}get itemRenderingRule(){return ge(Me.getLogger(this),"itemRenderingRule",{replacement:"itemRasterFunction",version:"4.27",warnOnce:!0}),this._get("itemRasterFunction")}set itemRenderingRule(e){ge(Me.getLogger(this),"itemRenderingRule",{replacement:"itemRasterFunction",version:"4.27",warnOnce:!0}),this._set("itemRasterFunction",e)}readMethod(e,t){return Ni(t.mosaicMethod||t.defaultMosaicMethod)}writeMultidimensionalDefinition(e,t,i){e!=null&&(e=e.filter(({variableName:n,dimensionName:a})=>n&&n!=="*"||a)).length&&(t[i]=e.map(n=>n.toJSON()))}readOperation(e,t){var r;const i=t.mosaicOperation,n=(r=t.mosaicOperator)==null?void 0:r.toLowerCase(),a=i||(n?Y.toJSON(n):null);return Y.fromJSON(a)||"first"}castSortValue(e){return e==null||typeof e=="string"||typeof e=="number"?e:`${e}`}clone(){return new Ze({ascending:this.ascending,itemRasterFunction:A(this.itemRasterFunction),lockRasterIds:A(this.lockRasterIds),method:this.method,multidimensionalDefinition:A(this.multidimensionalDefinition),objectIds:A(this.objectIds),operation:this.operation,sortField:this.sortField,sortValue:this.sortValue,viewpoint:A(this.viewpoint),where:this.where})}};s([l({type:Boolean,json:{write:!0}})],h.prototype,"ascending",void 0),s([z("ascending",["ascending","sortAscending"])],h.prototype,"readAscending",null),s([l({type:ye,json:{name:"itemRenderingRule",write:!0}})],h.prototype,"itemRasterFunction",void 0),s([l({type:ye})],h.prototype,"itemRenderingRule",null),s([l({type:[E],json:{write:{overridePolicy(){return{enabled:this.method==="lock-raster"}}}}})],h.prototype,"lockRasterIds",void 0),s([l({type:String,json:{type:Ee.jsonValues,write:{target:"mosaicMethod",writer:Ee.write}}})],h.prototype,"method",void 0),s([z("method",["mosaicMethod","defaultMosaicMethod"])],h.prototype,"readMethod",null),s([l({type:[ee],json:{write:!0}})],h.prototype,"multidimensionalDefinition",void 0),s([Ie("multidimensionalDefinition")],h.prototype,"writeMultidimensionalDefinition",null),s([l({type:[E],json:{name:"fids",write:!0}})],h.prototype,"objectIds",void 0),s([l({json:{type:Y.jsonValues,read:{reader:Y.read},write:{target:"mosaicOperation",writer:Y.write}}})],h.prototype,"operation",void 0),s([z("operation",["mosaicOperation","mosaicOperator"])],h.prototype,"readOperation",null),s([l({type:String,json:{write:{overridePolicy(){return{enabled:this.method==="attribute"}}}}})],h.prototype,"sortField",void 0),s([l({type:[String,Number],json:{write:{allowNull:!0,overridePolicy(){return{enabled:this.method==="attribute",allowNull:!0}}}}})],h.prototype,"sortValue",void 0),s([Xt("sortValue")],h.prototype,"castSortValue",null),s([l({type:we,json:{write:!0}})],h.prototype,"viewpoint",void 0),s([l({type:String,json:{write:!0}})],h.prototype,"where",void 0),h=Ze=s([j("esri.layers.support.MosaicRule")],h);const Ti=h;var Pe;const Ci={base:Yt,key:"type",typeMap:{extent:Ce,polygon:qt}};let O=Pe=class extends N{constructor(e){super(e),this.areaOfInterest=null,this.subsetDefinitions=null}get dimensions(){const{subsetDefinitions:e}=this;if(e==null||e.length===0)return[];const t=new Map;e.forEach(n=>{if(!n.dimensionName)return;let a,r;if(Array.isArray(n.values[0])){const o=n.values;a=o[0][0],r=o[n.values.length-1][1]}else{const o=n.values;a=o[0],r=o[n.values.length-1]}if(t.has(n.dimensionName)){const o=t.get(n.dimensionName);o[0]=Math.min(a,o[0]),o[1]=Math.max(r,o[1])}else t.set(n.dimensionName,[a,r])});const i=[];for(const n of t)i.push({name:n[0],extent:n[1]});return i}get variables(){const{subsetDefinitions:e}=this;if(e==null||e.length===0)return[];const t=new Set;return e.forEach(i=>{i.variableName&&t.add(i.variableName)}),[...t]}clone(){var i;const e=(i=this.subsetDefinitions)==null?void 0:i.map(n=>n.clone()),t=this.areaOfInterest?this.areaOfInterest.clone():this.areaOfInterest;return new Pe({areaOfInterest:t,subsetDefinitions:e})}};s([l({types:Ci,json:{read:At,write:!0}})],O.prototype,"areaOfInterest",void 0),s([l({readOnly:!0})],O.prototype,"dimensions",null),s([l({readOnly:!0})],O.prototype,"variables",null),s([l({type:[ee],json:{write:!0}})],O.prototype,"subsetDefinitions",void 0),O=Pe=s([j("esri.layers.support.MultidimensionalSubset")],O);const on=O;let sn=class{constructor(){this._workerThread=null,this._destroyed=!1}async initialize(){const t=await ei("RasterWorker");this._destroyed?t.close():this._workerThread=t}destroy(){this._destroyed=!0,this._workerThread&&(this._workerThread.close(),this._workerThread=null)}async convertVectorFieldData(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("convertVectorFieldData",{pixelBlock:t.pixelBlock.toJSON(),type:t.dataType},i);return n?new P(n):null}computeStatisticsHistograms(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");return this._workerThread.invoke("computeStatisticsHistograms",{pixelBlock:t.pixelBlock.toJSON()},i)}async decode(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("decode",t,i);return n?new P(n):null}async symbolize(t,i){var r,o;if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n={extent:(r=t.extent)==null?void 0:r.toJSON(),pixelBlock:(o=t.pixelBlock)==null?void 0:o.toJSON(),simpleStretchParams:t.simpleStretchParams,bandIds:t.bandIds},a=await this._workerThread.invoke("symbolize",n,i);return a?new P(a):null}async updateSymbolizer(t,i){var a;if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n=(a=t==null?void 0:t.rendererJSON)==null?void 0:a.histograms;await Promise.all(this._workerThread.broadcast("updateSymbolizer",{symbolizerJSON:t.toJSON(),histograms:n},i))}async updateRasterFunction(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");await Promise.all(this._workerThread.broadcast("updateRasterFunction",{rasterFunctionJSON:t.toJSON()},i))}async process(t,i){var a,r;if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("process",{extent:(a=t.extent)==null?void 0:a.toJSON(),primaryPixelSizes:(r=t.primaryPixelSizes)==null?void 0:r.map(o=>o!=null?o.toJSON():null),primaryPixelBlocks:t.primaryPixelBlocks.map(o=>o!=null?o.toJSON():null),primaryRasterIds:t.primaryRasterIds},i);return n?new P(n):null}async stretch(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");if(!(t!=null&&t.pixelBlock))return null;const n={srcPixelBlock:t.pixelBlock.toJSON(),stretchParams:t.stretchParams},a=await this._workerThread.invoke("stretch",n,i);return a?new P(a):null}async split(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");if(!(t!=null&&t.pixelBlock))return null;const n={srcPixelBlock:t.pixelBlock.toJSON(),tileSize:t.tileSize,maximumPyramidLevel:t.maximumPyramidLevel},a=await this._workerThread.invoke("split",n,i);return a&&a.forEach((r,o)=>{a.set(o,r?P.fromJSON(r):null)}),a}async estimateStatisticsHistograms(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");if(!(t!=null&&t.pixelBlock))return null;const n={srcPixelBlock:t.pixelBlock.toJSON()};return await this._workerThread.invoke("estimateStatisticsHistograms",n,i)}async mosaicAndTransform(t,i){var r;if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");if(!((r=t==null?void 0:t.srcPixelBlocks)!=null&&r.length))return{pixelBlock:null};const n={...t,srcPixelBlocks:t.srcPixelBlocks.map(o=>o!=null?o.toJSON():null)},a=await this._workerThread.invoke("mosaicAndTransform",n,i);return{pixelBlock:a.pixelBlock?new P(a.pixelBlock):null,localNorthDirections:a.localNorthDirections}}async createFlowMesh(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n={buffer:t.flowData.data.buffer,maskBuffer:t.flowData.mask.buffer,width:t.flowData.width,height:t.flowData.height},{meshType:a,simulationSettings:r}=t,o=await this._workerThread.invoke("createFlowMesh",{meshType:a,flowData:n,simulationSettings:r},{...i,transferList:[n.buffer,n.maskBuffer]});return{vertexData:new Float32Array(o.vertexBuffer),indexData:new Uint32Array(o.indexBuffer)}}getProjectionOffsetGrid(t,i){if(!this._workerThread)throw new C("raster-jobhandler:no-connection","no available worker connection");const n=t.datumTransformation!=null?t.datumTransformation.steps.map(o=>({wkid:o.wkid,wkt:o.wkt,isInverse:o.isInverse})):null,a=t.rasterTransform!=null?t.rasterTransform.toJSON():null,r={projectedExtent:t.projectedExtent.toJSON(),srcBufferExtent:t.srcBufferExtent.toJSON(),pixelSize:t.pixelSize,hasWrapAround:t.hasWrapAround,spacing:t.spacing,datumTransformationSteps:n,rasterTransform:a,isAdaptive:t.isAdaptive,includeGCSGrid:t.includeGCSGrid};return this._workerThread.invoke("getProjectionOffsetGrid",r,i)}};function Ct(e,t,i){var r;const n=t.shift();if(i.length===0){const o=[];i.push({sliceId:-1,multidimensionalDefinition:o})}const a=i.length;for(let o=0;o{i.push({sliceId:-1,multidimensionalDefinition:[...u,{variableName:e,dimensionName:n.name,values:[d]}]})})}t.length&&Ct(e,t,i)}function cn(e,t){const i=[];let n=0;return(t?e.variables.filter(a=>a.name.toLowerCase()===t.toLowerCase()):[...e.variables].sort((a,r)=>a.name>r.name?1:-1)).forEach(a=>{const r=[],o=[...a.dimensions].sort((u,d)=>u.name>d.name?-1:1);Ct(a.name,o,r),r.forEach(u=>{i.push({...u,sliceId:n++})})}),i}function un(e,t,i){let n=e;if(t&&(t=[...t].sort((a,r)=>a.dimensionName{r.length&&(n=n.filter(u=>{const d=u.multidimensionalDefinition.find(p=>p.dimensionName===a);if(d==null)return!1;const c=d.values[0];return typeof c=="number"?typeof r[0]=="number"?r.includes(c):r.some(p=>p[0]<=c&&p[1]>=c):typeof r[0]=="number"?r.some(p=>c[0]<=p&&c[1]>=p):o?r.some(p=>p[0]===c[0]&&p[0]===c[1]):r.some(p=>p[0]>=c[0]&&p[0]<=c[1]||p[1]>=c[0]&&p[1]<=c[1]||p[0]c[1])}))}),n.length&&(i==null?void 0:i.start)!=null&&i.end!=null){const a=i.start.getTime(),r=i.end.getTime(),o=n[0].multidimensionalDefinition.findIndex(u=>u.dimensionName==="StdTime");o>-1&&(n=n.filter(u=>{const d=u.multidimensionalDefinition[o].values[0];return a<=d&&r>=d}))}return n.map(a=>a.sliceId)}function Lt(e,t){return Array.isArray(e)?t[0]===t[1]?e[0]===t[0]||e[1]===t[0]:e[0]>=t[0]&&e[0]<=t[1]&&e[1]>=t[0]&&e[1]<=t[1]:e>=t[0]&&e<=t[1]}function Li(e,t){return e[0]<=t[0]&&e[1]>=t[0]||e[0]<=t[1]&&e[1]>=t[1]||e[0]>=t[0]&&e[1]<=t[1]}function xt(e){return e.length===1?[e[0],e[0]]:[e[0],e[e.length-1]]}function Bt(e,t,i){var o,u;if(!((o=t==null?void 0:t.subsetDefinitions)!=null&&o.length))return e;let n;if(i){const{variables:d}=t;if(d.length&&!d.includes(i))return null;const c=t.subsetDefinitions.find(p=>p.dimensionName===e.name&&p.variableName===i);if(!((u=c==null?void 0:c.values)!=null&&u.length))return e;n=xt(c.values)}else{const d=t.dimensions.find(({name:c})=>c===e.name);n=d==null?void 0:d.extent}const a=n;if(!(a!=null&&a.length))return e;const r=e.values.filter(d=>Lt(d,a));return{...e,extent:[...a],values:r}}function Ut(e,t,i){var a;if(!((a=t==null?void 0:t.subsetDefinitions)!=null&&a.length))return!1;const{variables:n}=t;if(n.length&&e.some(({variableName:r})=>r&&!n.includes(r)))return!0;for(let r=0;r(o.variableName===""||d.variableName===o.variableName)&&d.dimensionName===o.dimensionName);if(u!=null&&u.values.length){const d=xt(u.values);if(!o.isSlice&&o.values.length===2&&!Array.isArray(o.values[0])&&o.values[0]!==o.values[1]&&i){if(!Li(o.values,d))return!0}else if(o.values.some(c=>!Lt(c,d)))return!0}}return!1}function dn(e,t){if(e==null)return{isOutside:!1};const{geometry:i,timeExtent:n,multidimensionalDefinition:a}=t;let r=null;if(n!=null&&(r=xi(e,n),r==null))return{isOutside:!0};const{areaOfInterest:o}=e;if(o&&i){const u=i.type==="point"?i:i.type==="extent"?i.center:i.type==="polygon"?i.centroid:null;if(u&&!o.contains(u))return{isOutside:!0}}return a!=null&&a.length&&Ut(a,e,!0)?{isOutside:!0}:{isOutside:!1,intersection:{geometry:i,timeExtent:r,multidimensionalDefinition:a}}}function xi(e,t){const i=e.dimensions.find(({name:o})=>o==="StdTime");if(i==null||t.start==null&&t.end==null)return t;t=t.clone();const{start:n,end:a}=t.toJSON(),r=n===a?[n]:n!=null&&a!=null?[n,a]:[n??a];return r.length===2&&(i!=null&&i.extent.length)&&(r[0]=Math.max(r[0],i.extent[0]),r[1]=Math.min(r[1],i.extent[1]??i.extent[0]),r[1]r.variables.includes(w))),d?c.find(({name:w})=>w===d)??c[0]:c[0]}function pn(e,t={}){const i=Bi(e,t);if(!i)return null;const n=[],{dimensions:a,name:r}=i;if(a.length===0)return[new ee({variableName:r,dimensionName:"",values:[],isSlice:!0})];for(let o=0;o{if(t.values==null)return!0;const i=t.values.length;return i===0||i>1||!t.isSlice&&Array.isArray(t.values[0])})}function gn(e,t){var n;if(t==null||e==null)return null;let i=t.variables.map(a=>({...a}));return(n=e==null?void 0:e.variables)!=null&&n.length&&(i=i.filter(({name:a})=>e.variables.includes(a)),i.forEach(a=>{a.dimensions=a.dimensions.map(r=>Bt(r,e,a.name)).filter(ti)})),i}function Ui(e,t){var u;const{values:i}=t;if(i!=null&&i.length){const d=Array.isArray(i[0]),c=Array.isArray(e);return d!==c?-1:d&&c?i.findIndex(p=>p[0]===e[0]&&p[1]===e[1]):i.indexOf(e)}const{extent:n}=t;if(Array.isArray(e)||en[1])return-1;const a=t.interval||1;if(t.unit!=="ISO8601")return Math.round((e-n[0])/a);const r=n[0];let o=-1;switch(((u=t.intervalUnit)==null?void 0:u.toLowerCase())||"seconds"){case"seconds":o=Math.round((e-r)/1e3/a);break;case"minutes":o=Math.round((e-r)/6e4/a);break;case"hours":o=Math.round((e-r)/36e5/a);break;case"days":o=Math.round((e-r)/864e5/a);break;case"months":{const d=new Date(e).getUTCFullYear()-new Date(r).getUTCFullYear(),c=new Date(r).getUTCMonth(),p=new Date(e).getUTCMonth();o=d===0?p-c:p+11-c+12*(d-1)}break;case"years":o=Math.round((new Date(e).getUTCFullYear()-new Date(r).getUTCFullYear())/a);break;case"decades":o=Math.round((new Date(e).getUTCFullYear()-new Date(r).getUTCFullYear())/10/a)}return o}function pt(e){var o,u;let t=(o=e.values)==null?void 0:o.length;if(t)return t;const{extent:i,unit:n}=e,a=e.interval||1,r=i?i[1]-i[0]:0;if(n!=="ISO8601")return Math.round(r/a);switch(((u=e.intervalUnit)==null?void 0:u.toLowerCase())??"seconds"){case"seconds":t=Math.round(r/1e3/a);break;case"minutes":t=Math.round(r/6e4/a);break;case"hours":t=Math.round(r/36e5/a);break;case"days":t=Math.round(r/864e5/a);break;case"months":{const d=new Date(i[1]).getUTCFullYear()-new Date(i[0]).getUTCFullYear(),c=new Date(i[0]).getUTCMonth(),p=new Date(i[1]).getUTCMonth();t=d===0?p-c+1:p+11-c+12*(d-1)+1}break;case"years":t=Math.round((new Date(i[1]).getUTCFullYear()-new Date(i[0]).getUTCFullYear())/a);break;case"decades":t=Math.round((new Date(i[1]).getUTCFullYear()-new Date(i[0]).getUTCFullYear())/10/a);break;default:t=0}return t}function Mn(e,t){let i=0;const n=e[0].variableName,a=[...t.variables].sort((r,o)=>r.name>o.name?1:-1);for(let r=0;rp.name>m.name?-1:1);if(o.name!==n){i+=u.map(p=>pt(p)).reduce((p,m)=>p*m);continue}const d=u.map(p=>pt(p)),c=u.length;for(let p=0;pD.dimensionName===u[p].name);if(m==null)return null;const w=Ui(m.values[0],u[p]);if(w===-1)return null;d.shift(),i+=p===c-1?w:w*d.reduce((D,g)=>D*g)}break}return i}const zi=.25,Ri=Dt.fromJSON({type:"multipart",colorRamps:[{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]}),mt=Dt.fromJSON(gi[0]),zt=new Set(["scientific","standard-time","vector-uv","vector-magdir","vector-u","vector-v","vector-magnitude","vector-direction"]);function yn(e,t){const{attributeTable:i,colormap:n}=e;if(Oe(e)){const a=Ji(e);if(a!=null)return a}if(n!=null){const a=Oi(e);if(a!=null)return a}if(i!=null){const a=Vi(e);if(a!=null)return a}return ki(e,t)}function hn(e,t=!1){const i=["raster-stretch"];return bt(e,t)&&i.push("raster-colormap"),vt(e)&&i.push("unique-value"),Mi(e,t)&&i.push("class-breaks"),yi(e)&&i.push("raster-shaded-relief"),Oe(e)&&i.push("vector-field"),hi(e)&&i.push("flow"),i}function In(e,t,i){const n=["nearest","bilinear","cubic","majority"].find(a=>a===(i==null?void 0:i.toLowerCase()));return t==="Map"?n??"bilinear":e.dataType==="standard-time"?n??"nearest":e.dataType==="thematic"||e.attributeTable||e.colormap?n==="nearest"||n==="majority"?n:"nearest":n??"bilinear"}function ki(e,t){e=Hi(e,t==null?void 0:t.variableName);const{bandCount:i}=e;let{bandIds:n,stretchType:a}=t||{};n!=null&&n.some(m=>m>=i)&&(n=null);let r=e.statistics,o=e.histograms;i>1?(n=n!=null&&n.length?n:Zi(e),r=r==null?null:n==null?void 0:n.map(m=>r[m]),o=o==null?null:n==null?void 0:n.map(m=>o[m])):n=[0],a==null&&(a=Pi(e));let u=!1;switch(a){case"none":u=!1;break;case"percent-clip":u=!(o!=null&&o.length);break;default:u=!(r!=null&&r.length)}const{dataType:d}=e,c=(n==null?void 0:n.length)===1&&zt.has(d)?Ri:null,p=new Je({stretchType:a,dynamicRangeAdjustment:u,colorRamp:c,outputMin:0,outputMax:255,gamma:(n==null?void 0:n.length)===1?[1]:[1,1,1],useGamma:!1});return a==="percent-clip"?p.maxPercent=p.minPercent=zi:a==="standard-deviation"&&(p.numberOfStandardDeviations=2),u||e.multidimensionalInfo==null&&!(t!=null&&t.includeStatisticsInStretch)||(a==="percent-clip"?p.histograms=o:a!=="min-max"&&a!=="standard-deviation"||(p.statistics=r)),p}function Hi(e,t){const{multidimensionalInfo:i}=e;if(!t||!i)return e;const n=i.variables.find(a=>a.name===t);if(!n)return e;if(e=e.clone(),n){const{statistics:a,histograms:r}=n;a!=null&&a.length&&(e.statistics=a.map(o=>({min:o.min,max:o.max,avg:o.avg,stddev:o.stddev}))),r!=null&&r.length&&(e.histograms=r)}return e}function Zi(e){const t=e.bandCount;if(t===1)return null;if(t===2)return[0];const{bandInfos:i}=e;let n;if(i.length===t){const{red:a,green:r,blue:o,nir:u}=Ei(i);a!=null&&r!=null&&o!=null?n=[a,r,o]:u!=null&&a!=null&&r!=null&&(n=[u,a,r])}return!n&&t>=3&&(n=[0,1,2]),n}function Ei(e){const t={};for(let i=0;i=410&&r<=480&&o>=480&&o<=540?t.blue=i:t.green==null&&r>=490&&r<=560&&o>=560&&o<=610?t.green=i:t.red==null&&r>=595&&r<=670&&o>=660&&o<=730?t.red=i:t.nir==null&&r>=700&&r<=860&&o>=800&&o<=950&&(t.nir=i)}}return t}function Pi(e){let t="percent-clip";const{pixelType:i,dataType:n,histograms:a,statistics:r,multidimensionalInfo:o}=e,u=zt.has(n)||n==="generic"&&o!=null;return i!=="u8"||n!=="processed"&&a!=null&&r!=null?i==="u8"||n==="elevation"||u?t="min-max":a!=null?t="percent-clip":r!=null&&(t="min-max"):t="none",t}function Vi(e,t,i,n){if(!vt(e,t))return null;const{attributeTable:a,statistics:r}=e,o=Rt(a,t),u=q(a,"red"),d=q(a,"green"),c=q(a,"blue"),p=new yt,m=[],w=new Set,D=!!(u&&d&&c);if(a!=null)a.features.forEach(g=>{const M=g.attributes[o.name];if(!w.has(g.attributes[o.name])&&M!=null){w.add(M);const x=D&&(u.type==="single"||u.type==="double")&&(d.type==="single"||d.type==="double")&&(c.type==="single"||c.type==="double")&&!a.features.some(R=>R.attributes[u.name]>1||R.attributes[d.name]>1||R.attributes[c.name]>1),U=x?255:1;m.push(new ot({value:g.attributes[o.name],label:g.attributes[o.name]+"",symbol:{type:"simple-fill",style:"solid",outline:null,color:new f(D?[g.attributes[u.name]*U,g.attributes[d.name]*U,g.attributes[c.name]*U,1]:[0,0,0,0])}}))}});else if(r!=null&&r[0])for(let g=r[0].min;g<=r[0].max;g++)m.push(new ot({value:g,label:g.toString(),symbol:{type:"simple-fill",style:"solid",outline:null,color:new f([0,0,0,0])}}));if(m.sort((g,M)=>g.value&&typeof g.value.valueOf()=="string"?0:g.value>M.value?1:-1),!D){const g=Le(mt,{numColors:m.length});m.forEach((M,x)=>M.symbol.color=new f(g[x].slice(1,4))),p.colorRamp=mt}if(i||n){const g=i||Le(n,{numColors:m.length}).map(M=>M.slice(1));m.forEach((M,x)=>M.symbol.color=new f(g[x])),p.colorRamp=n}return new Ge({field:o.name,uniqueValueInfos:m,authoringInfo:p})}function Rt(e,t,i){let n;return e!=null?(n=t?e.fields.find(a=>t.toLowerCase()===a.name.toLowerCase()):Gi(e.fields),n||(i||(n=e.fields.find(a=>a.type==="string")),n||(n=q(e,"value")))):n=new ii({name:"value"}),n}function Gi(e){let t;for(let i=0;ii.name.toLowerCase()===t)}function Oi(e){if(!bt(e))return null;let t;const{attributeTable:i,colormap:n}=e;if(i!=null){const a=q(i,"value"),r=Rt(i,null,!0);r.type==="string"&&(t={},i.features.forEach(o=>{const u=o.attributes;t[u[a.name]]=r?u[r.name]:u[a.name]}))}return Fe.createFromColormap(n,t)}const Fi=new Map([["m/s","meter-per-second"],["km/h","kilometer-per-hour"],["knots","knots"],["ft/s","feet-per-second"],["mph","mile-per-hour"]]);function Ji(e){if(!Oe(e))return null;let t;if(e.statistics!=null&&e.statistics.length&&(e.dataType==="vector-magdir"||e.dataType==="vector-uv")){const{minMagnitude:a,maxMagnitude:r}=Wi(e.dataType,e.statistics);t=[{type:"size",field:"Magnitude",minSize:10,maxSize:40,minDataValue:a,maxDataValue:r}]}const i=e.multidimensionalInfo!=null?Fi.get(e.multidimensionalInfo.variables[0].unit):null,n=new We({visualVariables:t,inputUnit:i,rotationType:"geographic"});return n.visualVariables=[...n.sizeVariables,...n.rotationVariables],n}function gt(e){var t;return{color:(t=e.symbolLayers[0].material)==null?void 0:t.color,type:"esriSFS",style:"esriSFSSolid"}}function wn(e){var t,i;if(e.type==="uniqueValue"){const n=e.uniqueValueInfos,a=n==null?void 0:n[0].symbol;return(t=a==null?void 0:a.symbolLayers)!=null&&t.length&&(e.uniqueValueInfos=n==null?void 0:n.map(r=>({value:r.value,label:r.label,symbol:r.symbol?gt(r.symbol):null}))),e}if(e.type==="classBreaks"){const n=e.classBreakInfos,a=n[0].symbol;return(i=a==null?void 0:a.symbolLayers)!=null&&i.length&&(e.classBreakInfos=n.map(r=>({classMinValue:r.classMinValue,classMaxValue:r.classMaxValue,label:r.label,symbol:r.symbol?gt(r.symbol):null}))),e}return e}function Wi(e,t){let i,n;if(e==="vector-magdir")i=t[0].min,n=t[0].max;else{const a=t[0].min,r=t[0].max,o=t[1].min,u=t[1].max;i=0,n=Math.max(Math.abs(a),Math.abs(o),Math.abs(r),Math.abs(u))}return{minMagnitude:i,maxMagnitude:n}}async function kt(e,t,i){var _e,Ke,Qe,Xe,Ye,qe,et,tt,it,nt;const n=ni(e),{rasterFunction:a,sourceJSON:r}=t||{},o=a?JSON.stringify(a.rasterFunctionDefinition||a):null,u=ai({...n.query,renderingRule:o,f:"json"}),d=ri(u,i);e=n.path;const c=r||await F(e,d).then(T=>T.data),p=c.hasRasterAttributeTable?F(`${e}/rasterAttributeTable`,d):null,m=c.hasColormap?F(`${e}/colormap`,d):null,w=c.hasHistograms?F(`${e}/histograms`,d):null,D=c.currentVersion>=10.3?F(`${e}/keyProperties`,d):null,g=c.hasMultidimensions?F(`${e}/multidimensionalInfo`,d):null,M=await Promise.allSettled([p,m,w,D,g]);let x=null;if(c.minValues&&c.minValues.length===c.bandCount){x=[];for(let T=0;T{var at;(at=T.statistics)!=null&&at.length&&T.statistics.forEach(oe=>{oe.avg=oe.mean,oe.stddev=oe.standardDeviation})});const{defaultVariable:De,serviceDataType:_}=c;De&&De!==$.DefaultVariable&&($.DefaultVariable=De),_!=null&&_.includes("esriImageServiceDataTypeVector")&&!_.includes($.DataType)&&($.DataType=_.replace("esriImageServiceDataType",""));let be=c.noDataValue;return(nt=c.noDataValues)!=null&&nt.length&&c.noDataValues.some(T=>T!==be)&&(be=c.noDataValues),new Ii({width:R,height:Ht,bandCount:c.bandCount,extent:Ce.fromJSON(c.extent),spatialReference:$e,pixelSize:new we({x:c.pixelSizeX,y:c.pixelSizeY,spatialReference:$e}),pixelType:c.pixelType.toLowerCase(),statistics:x,attributeTable:Zt,colormap:Et,histograms:Pt,keyProperties:$,noDataValue:be,multidimensionalInfo:Ae})}function fn(e,t,i){return kt(e,{sourceJSON:t},i)}function An(e,t,i){return kt(e,{rasterFunction:t},i)}function Dn(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}var Ve;let B=Ve=class extends N{constructor(){super(...arguments),this.geometry=null,this.mosaicRule=null,this.rasterFunction=null,this.pixelSize=null,this.raster=void 0,this.timeExtent=null}writeGeometry(e,t,i){e!=null&&(t.geometryType=ci(e),t[i]=e.toJSON())}get renderingRule(){return ge(Me.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._get("rasterFunction")}set renderingRule(e){ge(Me.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}clone(){return new Ve(A({geometry:this.geometry,mosaicRule:this.mosaicRule,rasterFunction:this.rasterFunction,pixelSize:this.pixelSize,raster:this.raster,timeExtent:this.timeExtent}))}};s([l({types:si,json:{read:At}})],B.prototype,"geometry",void 0),s([Ie("geometry")],B.prototype,"writeGeometry",null),s([l({type:Ti,json:{write:!0}})],B.prototype,"mosaicRule",void 0),s([l({type:ye})],B.prototype,"renderingRule",null),s([l({type:ye,json:{write:!0,name:"renderingRule"}})],B.prototype,"rasterFunction",void 0),s([l({type:we,json:{write:!0}})],B.prototype,"pixelSize",void 0),s([l({json:{write:!0}})],B.prototype,"raster",void 0),s([l({type:li,json:{read:{source:"time"},write:{target:"time"}}})],B.prototype,"timeExtent",void 0),B=Ve=s([j("esri.rest.support.ImageHistogramParameters")],B);const bn=B;export{Hi as B,Mn as D,Zi as E,wn as K,ye as N,In as S,yn as V,un as a,Yi as b,on as c,ct as d,bn as e,pn as f,Bi as g,mn as h,cn as i,gn as j,Dn as k,lt as l,fn as m,qi as n,Ut as o,ee as p,en as q,Ti as r,je as s,sn as t,An as u,dn as v,hn as w}; diff --git a/dist/assets/ImageMaterial.glsl-TdPtjVc_.js b/dist/assets/ImageMaterial.glsl-PU0wbmEN.js similarity index 67% rename from dist/assets/ImageMaterial.glsl-TdPtjVc_.js rename to dist/assets/ImageMaterial.glsl-PU0wbmEN.js index 7505782..2c201a8 100644 --- a/dist/assets/ImageMaterial.glsl-TdPtjVc_.js +++ b/dist/assets/ImageMaterial.glsl-PU0wbmEN.js @@ -1,4 +1,4 @@ -import{xz as T,xE as $,xB as O,bf as p,xy as c,xC as A,xH as I,yk as b,xx as S,xA as n,tw as v,xD as C,xK as d,yl as D,uY as m,e as r,xL as o,i2 as _,xM as w,de as N,xN as R,xO as V,xP as L,xQ as M,xS as F,xT as U,ym as z,xU as B,xV as W,xW as j,yn as G,yo as H,yp as Q,yq as k,y9 as q,yr as K,lX as u,yc as X,ys as Y,yb as J,y2 as Z,yt as ee,yu as te,yv as se,x$ as ae}from"./index-J0iiHjMT.js";function x(t){const e=new T,{vertex:s,fragment:a}=e;return $(s,t),e.include(O,t),e.attributes.add(p.POSITION,"vec3"),e.attributes.add(p.UV0,"vec2"),t.perspectiveInterpolation&&e.attributes.add(p.PERSPECTIVEDIVIDE,"float"),e.varyings.add("vpos","vec3"),t.multipassEnabled&&e.varyings.add("depth","float"),s.code.add(c` +import{xS as I,xX as O,xU as $,bi as p,xR as c,xV as x,x_ as A,yD as b,xQ as S,xT as n,tJ as P,xW as C,y1 as d,yE as D,va as m,e as r,y2 as o,hY as g,y3 as w,de as N,y4 as R,y5 as V,y6 as L,y7 as M,y9 as F,ya as U,yF as z,yb as B,yc as G,yd as W,yG as j,yH as H,yI as Q,yJ as J,ys as k,yK as q,m3 as u,yv as K,yL as X,yu as Y,yl as Z,yM as ee,yN as te,yO as se,yi as ae}from"./index-pCX-0tJH.js";function E(t){const e=new I,{vertex:s,fragment:a}=e;return O(s,t),e.include($,t),e.attributes.add(p.POSITION,"vec3"),e.attributes.add(p.UV0,"vec2"),t.perspectiveInterpolation&&e.attributes.add(p.PERSPECTIVEDIVIDE,"float"),e.varyings.add("vpos","vec3"),t.multipassEnabled&&e.varyings.add("depth","float"),s.code.add(c` void main(void) { vpos = position; ${t.multipassEnabled?"depth = (view * vec4(vpos, 1.0)).z;":""} @@ -7,13 +7,13 @@ import{xz as T,xE as $,xB as O,bf as p,xy as c,xC as A,xH as I,yk as b,xx as S,x ${t.perspectiveInterpolation?"gl_Position *= perspectiveDivide;":""} } - `),e.include(A,t),e.include(I,t),a.uniforms.add(new b("tex",l=>l.texture),new S("opacity",l=>l.opacity)),e.varyings.add("vTexCoord","vec2"),t.output===n.Alpha?a.code.add(c` + `),e.include(x,t),e.include(A,t),a.uniforms.add(new b("tex",l=>l.texture),new S("opacity",l=>l.opacity)),e.varyings.add("vTexCoord","vec2"),t.output===n.Alpha?a.code.add(c` void main() { discardBySlice(vpos); ${t.multipassEnabled?"terrainDepthTest(depth);":""} float alpha = texture(tex, vTexCoord).a * opacity; - if (alpha < ${c.float(v)}) { + if (alpha < ${c.float(P)}) { discard; } @@ -25,14 +25,14 @@ import{xz as T,xE as $,xB as O,bf as p,xy as c,xC as A,xH as I,yk as b,xx as S,x ${t.multipassEnabled?"terrainDepthTest(depth);":""} fragColor = texture(tex, vTexCoord) * opacity; - if (fragColor.a < ${c.float(v)}) { + if (fragColor.a < ${c.float(P)}) { discard; } fragColor = highlightSlice(fragColor, vpos); ${t.transparencyPassType===d.Color?"fragColor = premultiplyAlpha(fragColor);":""} } - `)),e}const ie=Object.freeze(Object.defineProperty({__proto__:null,build:x},Symbol.toStringTag,{value:"Module"}));class g extends V{initializeProgram(e){return new L(e.rctx,g.shader.get().build(this.configuration),E)}_setPipelineState(e,s){const a=this.configuration,l=e===d.NONE,h=e===d.FrontFace;return M({blending:a.output!==n.Color&&a.output!==n.Alpha||!a.transparent?null:l?re:F(e),culling:U(a.cullFace),depthTest:{func:z(e)},depthWrite:l?a.writeDepth?B:null:W(e),colorWrite:j,stencilWrite:a.hasOccludees?G:null,stencilTest:a.hasOccludees?s?H:Q:null,polygonOffset:l||h?null:k(a.enableOffset)})}initializePipeline(){return this._occludeePipelineState=this._setPipelineState(this.configuration.transparencyPassType,!0),this._setPipelineState(this.configuration.transparencyPassType,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}g.shader=new w(ie,()=>N(()=>Promise.resolve().then(()=>pe),void 0));const re=D(m.ONE,m.ONE_MINUS_SRC_ALPHA);class i extends R{constructor(){super(...arguments),this.output=n.Color,this.cullFace=_.None,this.hasSlicePlane=!1,this.transparent=!1,this.enableOffset=!0,this.writeDepth=!0,this.hasOccludees=!1,this.transparencyPassType=d.NONE,this.multipassEnabled=!1,this.cullAboveGround=!1,this.perspectiveInterpolation=!0}}r([o({count:n.COUNT})],i.prototype,"output",void 0),r([o({count:_.COUNT})],i.prototype,"cullFace",void 0),r([o()],i.prototype,"hasSlicePlane",void 0),r([o()],i.prototype,"transparent",void 0),r([o()],i.prototype,"enableOffset",void 0),r([o()],i.prototype,"writeDepth",void 0),r([o()],i.prototype,"hasOccludees",void 0),r([o({count:d.COUNT})],i.prototype,"transparencyPassType",void 0),r([o()],i.prototype,"multipassEnabled",void 0),r([o()],i.prototype,"cullAboveGround",void 0),r([o()],i.prototype,"perspectiveInterpolation",void 0),r([o({constValue:!1})],i.prototype,"occlusionPass",void 0);const E=new Map([[p.POSITION,0],[p.UV0,2],[p.PERSPECTIVEDIVIDE,3]]);let ue=class extends q{constructor(e){super(e,new le),this.supportsEdges=!0,this._vertexAttributeLocations=E,this._configuration=new i}getConfiguration(e,s){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=s.transparencyPassType,this._configuration.enableOffset=s.camera.relativeElevationN(()=>Promise.resolve().then(()=>pe),void 0));const re=D(m.ONE,m.ONE_MINUS_SRC_ALPHA);class i extends R{constructor(){super(...arguments),this.output=n.Color,this.cullFace=g.None,this.hasSlicePlane=!1,this.transparent=!1,this.enableOffset=!0,this.writeDepth=!0,this.hasOccludees=!1,this.transparencyPassType=d.NONE,this.multipassEnabled=!1,this.cullAboveGround=!1,this.perspectiveInterpolation=!0}}r([o({count:n.COUNT})],i.prototype,"output",void 0),r([o({count:g.COUNT})],i.prototype,"cullFace",void 0),r([o()],i.prototype,"hasSlicePlane",void 0),r([o()],i.prototype,"transparent",void 0),r([o()],i.prototype,"enableOffset",void 0),r([o()],i.prototype,"writeDepth",void 0),r([o()],i.prototype,"hasOccludees",void 0),r([o({count:d.COUNT})],i.prototype,"transparencyPassType",void 0),r([o()],i.prototype,"multipassEnabled",void 0),r([o()],i.prototype,"cullAboveGround",void 0),r([o()],i.prototype,"perspectiveInterpolation",void 0),r([o({constValue:!1})],i.prototype,"occlusionPass",void 0);const T=new Map([[p.POSITION,0],[p.UV0,2],[p.PERSPECTIVEDIVIDE,3]]);let ue=class extends k{constructor(e){super(e,new le),this.supportsEdges=!0,this._vertexAttributeLocations=T,this._configuration=new i}getConfiguration(e,s){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=s.transparencyPassType,this._configuration.enableOffset=s.camera.relativeElevationf.toLowerCase());a=R.indexOf("magnitude"),u=R.indexOf("direction")}a!==-1&&a!==null||(a=0,u=1);const p=r.rotationType==="arithmetic"?1:2,m=r.flowRepresentation==="flow-from"?0:1,c=r.visualVariables?r.visualVariables.find(R=>R.field==="Magnitude"):new Dt,d={magnitudeBandID:a,directionBandID:u,isUVComponents:s,referenceSystem:p,massFlowAngleRepresentation:m,symbolTileSize:50,symbolTileSizeUnits:100,calculationMethod:"Vector Average",symbologyName:Oi[r.style.toLowerCase().replace("-","_")],minimumMagnitude:c.minDataValue,maximumMagnitude:c.maxDataValue,minimumSymbolSize:c.minSize,maximumSymbolSize:c.maxSize};o.functionArguments=d;const y=K(o);return i.convertToRFT?b.fromJSON({rasterFunctionDefinition:y}):o}function ji(r,i){const o=i.convertToRFT;if(i.dataType!=="elevation"&&(i.dataType!=="generic"||i.bandCount!==1||i.pixelType!=="s16"&&i.pixelType!=="s32"&&i.pixelType!=="f32"&&i.pixelType!=="f64"))return new b;const e=new b;e.functionName="Hillshade";const t=r.hillshadeType==="traditional"?0:1,s=r.scalingType==="none"?1:3,a={HillshadeType:t,SlopeType:s,ZFactor:r.zFactor};return t===0&&(a.Azimuth=r.azimuth,a.Altitude=r.altitude),s===3&&(a.PSPower=r.pixelSizePower,a.PSZFactor=r.pixelSizeFactor),e.functionArguments=a,e.variableName="Raster",r.colorRamp&&(e.functionName="ShadedRelief",o?a.ColorRamp=yt(r.colorRamp):a.Colormap=gt(r.colorRamp)),o?new b({rasterFunctionDefinition:K(e)}):e}function $i(r,i){var u;const o=i.convertToRFT,e=new b;e.functionName="Stretch";const t=xe[gi.toJSON(r.stretchType)],s="u8",a={StretchType:t,Statistics:Li(r.statistics??[]),DRA:r.dynamicRangeAdjustment,UseGamma:r.useGamma,Gamma:r.gamma,ComputeGamma:r.computeGamma};if(r.outputMin!=null&&(a.Min=r.outputMin),r.outputMax!=null&&(a.Max=r.outputMax),t===xe.standardDeviation?(a.NumberOfStandardDeviations=r.numberOfStandardDeviations,e.outputPixelType=s):t===xe.percentClip?(a.MinPercent=r.minPercent,a.MaxPercent=r.maxPercent,e.outputPixelType=s):t===xe.minMax?e.outputPixelType=s:t===xe.sigmoid&&(a.SigmoidStrengthLevel=r.sigmoidStrengthLevel),e.functionArguments=a,e.variableName="Raster",r.colorRamp){const p=r.colorRamp,m=new b;if(o)m.functionArguments={ColorRamp:yt(p)};else{const c=fi(p,!0);if(c)m.functionArguments={colorRampName:c};else if(!i.convertColorRampToColormap||p.type!=="algorithmic"&&p.type!=="multipart"){const d=r.colorRamp.toJSON();d.type==="algorithmic"?d.algorithm=d.algorithm||"esriCIELabAlgorithm":d.type==="multipart"&&((u=d.colorRamps)!=null&&u.length)&&d.colorRamps.forEach(y=>y.algorithm=y.algorithm||"esriCIELabAlgorithm"),m.functionArguments={colorRamp:d}}else m.functionArguments={Colormap:gt(p)}}return m.variableName="Raster",m.functionName="Colormap",m.functionArguments.Raster=e,o?new b({rasterFunctionDefinition:K(m)}):m}return o?new b({rasterFunctionDefinition:K(e)}):e}function Mi(r,i){const o=[],e=[],t=[],s=[],{pixelType:u,rasterAttributeTable:p}=i,m=p==null?null:p.features,c=St(p);if(c&&m&&Array.isArray(m)&&r.classBreakInfos){r.classBreakInfos.forEach((h,g)=>{var $;const w=($=h.symbol)==null?void 0:$.color;let T;w!=null&&w.a&&h.minValue!=null&&h.maxValue!=null&&m.forEach(V=>{h.minValue!=null&&h.maxValue!=null&&(T=V.attributes[r.field],(T>=h.minValue&&T=h.minValue)&&s.push([V.attributes[c],w.r,w.g,w.b]))})});const f=u?Je(s,u):s,v=new b;return v.functionName="Colormap",v.functionArguments={},v.functionArguments.Colormap=f,v.variableName="Raster",i.convertToRFT?new b({rasterFunctionDefinition:K(v)}):v}r.classBreakInfos.forEach((f,v)=>{if(f.minValue==null||f.maxValue==null)return;const h=f.symbol&&f.symbol.color;h!=null&&h.a?(v===0?o.push(f.minValue,f.maxValue+1e-4):o.push(f.minValue+1e-4,f.maxValue+1e-4),e.push(v),s.push([v,h.r,h.g,h.b])):t.push(f.minValue,f.maxValue)});const d=u?Je(s,u):s,y=new b;y.functionName="Remap",y.functionArguments={InputRanges:o,OutputValues:e,NoDataRanges:t},y.variableName="Raster";const R=new b;return R.functionName="Colormap",R.functionArguments={Colormap:d,Raster:y},i.convertToRFT?new b({rasterFunctionDefinition:K(R)}):R}function Je(r,i){const o=_i.has(i)?Tt(i):null;return o&&r.push([Math.floor(o[0]-1),0,0,0],[Math.ceil(o[1]+1),0,0,0]),r}function St(r){if(r==null)return;const{fields:i}=r,o=i==null?void 0:i.find(e=>(e==null?void 0:e.name)&&e.name.toLowerCase()==="value");return o==null?void 0:o.name}function Ei(r,i){var d,y,R;const o=[],{pixelType:e,rasterAttributeTable:t}=i,s=t==null?null:t.features,a=St(t),u=(y=(d=r.defaultSymbol)==null?void 0:d.color)==null?void 0:y.toRgb(),p=r.uniqueValueInfos;if(p)if(s){if(a){const f=new Map;p.forEach(h=>{var T;const g=h.value,w=(T=h.symbol)==null?void 0:T.color;g!=null&&(w!=null&&w.a)&&f.set(String(g),w.toRgb())});const v=r.field;s.forEach(({attributes:h})=>{const g=String(h[v]),w=h[a],T=f.get(g);T?o.push([w,...T]):u&&o.push([w,...u])})}}else for(let f=0;f{const e=o;if(Array.isArray(e))i.push(e);else{if(e.min==null||e.max==null)return;const t=[e.min,e.max,e.avg||0,e.stddev||0];i.push(t)}}),i}function qi(r){const i=[],o=[];return r.forEach(e=>{i.push(e[0]),o.push(Ri([...e.slice(1),255]))}),{type:"RasterColormap",values:i,colors:o}}let N=class extends z{constructor(){super(...arguments),this.layer=null,this.compression=void 0,this.pixelType=void 0,this.lercVersion=2}get adjustAspectRatio(){return this.layer.adjustAspectRatio}writeAdjustAspectRatio(i,o,e){this.layer.version<10.3||(o[e]=i)}get bandIds(){return this.layer.bandIds}get compressionQuality(){return this.layer.compressionQuality}writeCompressionQuality(i,o,e){this.format&&this.format.toLowerCase().includes("jpg")&&i!=null&&(o[e]=i)}get compressionTolerance(){return this.layer.compressionTolerance}writeCompressionTolerance(i,o,e){this.format==="lerc"&&i!=null&&(o[e]=i)}get format(){var i;return((i=this.layer.renderer)==null?void 0:i.type)==="vector-field"?"lerc":this.layer.format}get interpolation(){return this.layer.interpolation}get noData(){return this.layer.noData}get noDataInterpretation(){return this.layer.noDataInterpretation}writeLercVersion(i,o,e){this.format==="lerc"&&this.layer.version>=10.5&&(o[e]=i)}get version(){const i=this.layer;return i.commitProperty("bandIds"),i.commitProperty("format"),i.commitProperty("compressionQuality"),i.commitProperty("compressionTolerance"),i.commitProperty("interpolation"),i.commitProperty("noData"),i.commitProperty("noDataInterpretation"),i.commitProperty("mosaicRule"),i.commitProperty("rasterFunction"),i.commitProperty("adjustAspectRatio"),i.commitProperty("pixelFilter"),i.commitProperty("definitionExpression"),i.commitProperty("multidimensionalSubset"),(this._get("version")||0)+1}set version(i){this._set("version",i)}get mosaicRule(){const i=this.layer;let o=i.mosaicRule;const e=i.definitionExpression;return o?e&&e!==o.where&&(o=o.clone(),o.where=e):e&&(o=new H({where:e})),o}get rasterFunction(){var a,u;const i=this.layer;let{rasterFunction:o}=i;const e=i.pixelFilter,t=!i.format||i.format.includes("jpg")||i.format.includes("png");o=this._addResampleRasterFunction(o);const s=(a=i.multidimensionalSubset)==null?void 0:a.areaOfInterest;return s&&(o=this._addClipFunction(o,s)),t&&!e&&((u=i.renderer)==null?void 0:u.type)!=="vector-field"&&(o=this.combineRendererWithRenderingRule(o)),o}combineRendererWithRenderingRule(i){const o=this.layer,{rasterInfo:e,renderer:t}=o;return i=i||o.rasterFunction,!t||!vt(t)?i:We(Vi(t,{rasterAttributeTable:e.attributeTable,pixelType:e.pixelType,dataType:e.dataType,bandNames:e.bandInfos.map(({name:s})=>s),convertColorRampToColormap:o.version<10.6,convertToRFT:!!(i!=null&&i.rasterFunctionDefinition),bandCount:e.bandCount}),i)}_addResampleRasterFunction(i){var s;if(((s=this.layer.renderer)==null?void 0:s.type)!=="vector-field"||(i==null?void 0:i.functionName)==="Resample")return i;const o=this.layer.serviceDataType==="esriImageServiceDataTypeVector-UV"?7:10,e=this.layer.serviceRasterInfo.pixelSize;let t=new b({functionName:"Resample",functionArguments:{ResamplingType:o,InputCellSize:e}});return t=i!=null&&i.rasterFunctionDefinition?new b({rasterFunctionDefinition:K(t)}):t,We(t,i)}_addClipFunction(i,o){const e=new b({functionName:"Clip",functionArguments:{ClippingGeometry:o.toJSON(),ClippingType:1}});return We(e,i)}};n([l()],N.prototype,"layer",void 0),n([l({json:{write:!0}})],N.prototype,"adjustAspectRatio",null),n([P("adjustAspectRatio")],N.prototype,"writeAdjustAspectRatio",null),n([l({json:{write:!0}})],N.prototype,"bandIds",null),n([l({json:{write:!0}})],N.prototype,"compression",void 0),n([l({json:{write:!0}})],N.prototype,"compressionQuality",null),n([P("compressionQuality")],N.prototype,"writeCompressionQuality",null),n([l({json:{write:!0}})],N.prototype,"compressionTolerance",null),n([P("compressionTolerance")],N.prototype,"writeCompressionTolerance",null),n([l({json:{write:!0}})],N.prototype,"format",null),n([l({type:String,json:{read:{reader:oe.read},write:{writer:oe.write}}})],N.prototype,"interpolation",null),n([l({json:{write:!0}})],N.prototype,"noData",null),n([l({type:String,json:{read:{reader:Ie.read},write:{writer:Ie.write}}})],N.prototype,"noDataInterpretation",null),n([l({json:{write:!0}})],N.prototype,"pixelType",void 0),n([l({json:{write:!0}})],N.prototype,"lercVersion",void 0),n([P("lercVersion")],N.prototype,"writeLercVersion",null),n([l({type:Number})],N.prototype,"version",null),n([l({json:{write:!0}})],N.prototype,"mosaicRule",null),n([l({json:{write:!0,name:"renderingRule"}})],N.prototype,"rasterFunction",null),N=n([F("esri.layers.mixins.ExportImageServiceParameters")],N);let fe=class extends z{constructor(i){super(i),this.north=null,this.up=null,this.spatialReference=null}};n([l({type:Number,json:{write:!0}})],fe.prototype,"north",void 0),n([l({type:Number,json:{write:!0}})],fe.prototype,"up",void 0),n([l({type:he,json:{write:!0}})],fe.prototype,"spatialReference",void 0),fe=n([F("esri.rest.support.ImageAngleResult")],fe);const zi=fe;let se=class extends z{constructor(){super(...arguments),this.value=null,this.displayValue=null,this.uncertainty=null}};n([l({type:Number,json:{read:!0,write:!0}})],se.prototype,"value",void 0),n([l({type:String,json:{read:!0,write:!0}})],se.prototype,"displayValue",void 0),n([l({type:Number,json:{read:!0,write:!0}})],se.prototype,"uncertainty",void 0),se=n([F("esri.rest.support.ImageMeasureResultValue")],se);let be=class extends se{constructor(){super(...arguments),this.unit=null}};n([l({type:String,json:{read:le.read,write:le.write}})],be.prototype,"unit",void 0),be=n([F("esri.rest.support.ImageMeasureResultLengthValue")],be);let Oe=class extends se{constructor(){super(...arguments),this.unit=null}};n([l({type:String,json:{read:$e.read,write:$e.write}})],Oe.prototype,"unit",void 0),Oe=n([F("esri.rest.support.ImageMeasureResultAreaValue")],Oe);let De=class extends se{constructor(){super(...arguments),this.unit=null}};n([l({type:String,json:{read:Me.read,write:Me.write}})],De.prototype,"unit",void 0),De=n([F("esri.rest.support.ImageMeasureResultAngleValue")],De);let ae=class extends z{constructor(){super(...arguments),this.name=null,this.sensorName=null}};n([l({type:String,json:{read:!0,write:!0}})],ae.prototype,"name",void 0),n([l({type:String,json:{read:!0,write:!0}})],ae.prototype,"sensorName",void 0),ae=n([F("esri.rest.support.BaseImageMeasureResult")],ae);let Fe=class extends ae{constructor(){super(...arguments),this.area=null,this.perimeter=null}};n([l({type:Oe,json:{read:!0,write:!0}})],Fe.prototype,"area",void 0),n([l({type:be,json:{read:!0,write:!0}})],Fe.prototype,"perimeter",void 0),Fe=n([F("esri.rest.support.ImageAreaResult")],Fe);const Gi=Fe;let Re=class extends ae{constructor(){super(...arguments),this.distance=null,this.azimuthAngle=null,this.elevationAngle=null}};n([l({type:be,json:{read:!0,write:!0}})],Re.prototype,"distance",void 0),n([l({type:De,json:{read:!0,write:!0}})],Re.prototype,"azimuthAngle",void 0),n([l({type:De,json:{read:!0,write:!0}})],Re.prototype,"elevationAngle",void 0),Re=n([F("esri.rest.support.ImageDistanceResult")],Re);const Hi=Re;let Ce=class extends ae{constructor(){super(...arguments),this.height=null}};n([l({type:be,json:{read:!0,write:!0}})],Ce.prototype,"height",void 0),Ce=n([F("esri.rest.support.ImageHeightResult")],Ce);const Ui=Ce;let k=class extends z{constructor(){super(...arguments),this.catalogItemVisibilities=null,this.catalogItems=null,this.location=null,this.name=null,this.objectId=null,this.processedValues=null,this.properties=null,this.value=null}};n([l({json:{write:!0}})],k.prototype,"catalogItemVisibilities",void 0),n([l({type:Rt,json:{write:!0}})],k.prototype,"catalogItems",void 0),n([l({type:q,json:{write:!0}})],k.prototype,"location",void 0),n([l({json:{write:!0}})],k.prototype,"name",void 0),n([l({json:{write:!0}})],k.prototype,"objectId",void 0),n([l({json:{write:!0}})],k.prototype,"processedValues",void 0),n([l({json:{write:!0}})],k.prototype,"properties",void 0),n([l({json:{write:!0}})],k.prototype,"value",void 0),k=n([F("esri.rest.support.ImageIdentifyResult")],k);const Qi=k;let Ve=class extends z{constructor(){super(...arguments),this.geometries=null}};n([l({json:{write:!0}})],Ve.prototype,"geometries",void 0),Ve=n([F("esri.rest.support.ImagePixelLocationResult")],Ve);const Bi=Ve;let Ae=class extends ae{constructor(){super(...arguments),this.point=null}};n([l({type:q,json:{name:"point.value",read:!0,write:!0}})],Ae.prototype,"point",void 0),Ae=n([F("esri.rest.support.ImagePointResult")],Ae);const ki=Ae;let Y=class extends z{constructor(){super(...arguments),this.attributes=null,this.location=null,this.locationId=null,this.rasterId=null,this.resolution=null,this.pixelValue=null}};n([l({json:{write:!0}})],Y.prototype,"attributes",void 0),n([l({type:q,json:{write:!0}})],Y.prototype,"location",void 0),n([l({json:{write:!0}})],Y.prototype,"locationId",void 0),n([l({json:{write:!0}})],Y.prototype,"rasterId",void 0),n([l({json:{write:!0}})],Y.prototype,"resolution",void 0),n([l({json:{write:!0}})],Y.prototype,"pixelValue",void 0),Y=n([F("esri.rest.support.ImageSample")],Y);const Wi=Y;let je=class extends z{constructor(){super(...arguments),this.samples=null}};n([l({type:[Wi],json:{write:!0}})],je.prototype,"samples",void 0),je=n([F("esri.rest.support.ImageSampleResult")],je);const Zi=je;function xt(r){const i=r==null?void 0:r.time;if(i&&(i.start!=null||i.end!=null)){const o=[];i.start!=null&&o.push(i.start),i.end==null||o.includes(i.end)||o.push(i.end),r.time=o.join(",")}}async function Ft(r,i,o){const e=ie(r),t=i.geometry?[i.geometry]:[],s=await Le(t),a=i.toJSON();xt(a);const u=s==null?void 0:s[0];u!=null&&(a.geometry=u.toJSON());const p=ye({...e.query,f:"json",...a});return ge(p,o)}async function Ki(r,i,o){var p,m,c;const e=i.toJSON();e.angleName!=null&&(e.angleName=e.angleName.join(",")),(m=(p=i==null?void 0:i.point)==null?void 0:p.spatialReference)!=null&&m.imageCoordinateSystem&&(e.point.spatialReference=ze(i.point.spatialReference)),(c=i==null?void 0:i.spatialReference)!=null&&c.imageCoordinateSystem&&(e.spatialReference=It(i.spatialReference));const t=ie(r),s=ye({...t.query,f:"json",...e}),a=ge(s,o),{data:u}=await _(`${t.path}/computeAngles`,a);return u.spatialReference=u.spatialReference?u.spatialReference.geodataXform!=null?new he({wkid:0,imageCoordinateSystem:u.spatialReference}):he.fromJSON(u.spatialReference):null,u.north==="NaN"&&(u.north=null),u.up==="NaN"&&(u.up=null),new zi(u)}async function Xi(r,i,o){var m;const e=i.toJSON(),{geometries:t}=i;if(t)for(let c=0;c{u.avg=u.mean,u.stddev=u.standardDeviation}),{statistics:a,histograms:s.histograms}}async function er(r,i,o){const e=await Ft(r,i,o),t=ie(r),{data:s}=await _(`${t.path}/computeHistograms`,e);return{histograms:s.histograms}}async function tr(r,i,o){var d,y;const e=i.toJSON();xt(e),(d=e.outFields)!=null&&d.length&&(e.outFields=e.outFields.join(","));const t=await Le(i.geometry),s=t==null?void 0:t[0];s!=null&&(e.geometry=s.toJSON());const a=ie(r),u=ye({...a.query,f:"json",...e}),p=ge(u,o),{data:m}=await _(`${a.path}/getSamples`,p),c=(y=m==null?void 0:m.samples)==null?void 0:y.map(R=>{const f=R.value==="NaN"||R.value===""?null:R.value.split(" ").map(v=>Number(v));return{...R,pixelValue:f}});return Zi.fromJSON({samples:c})}async function pt(r,i,o){const e=ie(r),t=i.geometry?[i.geometry]:[];return Le(t).then(s=>{const a=i.toJSON(),u=s==null?void 0:s[0];u!=null&&(a.geometry=JSON.stringify(u.toJSON()));const p=ye({...e.query,f:"json",...a}),m=ge(p,o);return _(e.path+"/identify",m)}).then(s=>Qi.fromJSON(s.data))}async function ir(r,i,o){const e=await qe(r,i,[i.fromGeometry,i.toGeometry],o);return Ui.fromJSON(e)}async function rr(r,i,o){const e=await qe(r,i,[i.geometry],o);return Gi.fromJSON(e)}async function sr(r,i,o){const e=await qe(r,i,[i.geometry],o);return ki.fromJSON(e)}async function nr(r,i,o){const e=await qe(r,i,[i.fromGeometry,i.toGeometry],o);return Hi.fromJSON(e)}async function qe(r,i,o,e){const t=ie(r),s=await Le(o),a=i.toJSON();s[0]!=null&&(a.fromGeometry=JSON.stringify(ct(s[0]))),s[1]!=null&&(a.toGeometry=JSON.stringify(ct(s[1])));const u=ye({...t.query,f:"json",...a}),p=ge(u,e),{data:m}=await _(t.path+"/measure",p);return m}function ct(r){var o;const i=r.toJSON();return(o=r.spatialReference)!=null&&o.imageCoordinateSystem&&(i.spatialReference=ze(r.spatialReference)),i}function ze(r){const{imageCoordinateSystem:i}=r;if(i){const{id:o,referenceServiceName:e}=i;return o!=null?e?{icsid:o,icsns:e}:{icsid:o}:{ics:i}}return r.toJSON()}function It(r,i){if(!r.imageCoordinateSystem)return Ze(r);const o=ze(r),{icsid:e,icsns:t}=o;return e==null||t!=null&&!(i!=null&&i.toLowerCase().includes("/"+t.toLowerCase()+"/"))?JSON.stringify(o):`0:${e}`}async function ar(r,i,o){var $,V;const e=ie(r),t=ye({...e==null?void 0:e.query,f:"json"}),s=ge(t,o),a=`${e==null?void 0:e.path}/${i}/info`,u=_(`${a}`,s),p=_(`${a}/keyProperties`,s),m=await Promise.allSettled([u,p]),c=m[0].status==="fulfilled"?m[0].value.data:null,d=m[1].status==="fulfilled"?m[1].value.data:null;let y=null;($=c.statistics)!=null&&$.length&&(y=c.statistics.map(x=>({min:x[0],max:x[1],avg:x[2],stddev:x[3]})));const R=_e.fromJSON(c.extent),f=Math.ceil(R.width/c.pixelSizeX-.1),v=Math.ceil(R.height/c.pixelSizeY-.1),h=R.spatialReference,g=new q({x:c.pixelSizeX,y:c.pixelSizeY,spatialReference:h}),w=(V=c.histograms)!=null&&V.length?c.histograms:null,T=new vi({origin:c.origin,blockWidth:c.blockWidth,blockHeight:c.blockHeight,firstPyramidLevel:c.firstPyramidLevel,maximumPyramidLevel:c.maxPyramidLevel});return new ft({width:f,height:v,bandCount:c.bandCount,extent:R,spatialReference:h,pixelSize:g,pixelType:c.pixelType.toLowerCase(),statistics:y,histograms:w,keyProperties:d,storageInfo:T})}var Ke;let me=Ke=class extends z{constructor(r){super(r),this.angleNames=null,this.point=null,this.spatialReference=null,this.rasterId=null}clone(){return new Ke(Q({angleNames:this.angleNames,point:this.point,spatialReference:this.spatialReference,rasterId:this.rasterId}))}};n([l({type:[String],json:{name:"angleName",write:!0}})],me.prototype,"angleNames",void 0),n([l({type:q,json:{write:!0}})],me.prototype,"point",void 0),n([l({type:he,json:{write:!0}})],me.prototype,"spatialReference",void 0),n([l({type:Ee,json:{write:!0}})],me.prototype,"rasterId",void 0),me=Ke=n([F("esri.rest.support.ImageAngleParameters")],me);const or=me,U=new Pt({esriMensurationPoint:"point",esriMensurationCentroid:"centroid",esriMensurationDistanceAndAngle:"distance-and-angle",esriMensurationAreaAndPerimeter:"area-and-perimeter",esriMensurationHeightFromBaseAndTop:"base-and-top",esriMensurationHeightFromBaseAndTopShadow:"base-and-top-shadow",esriMensurationHeightFromTopAndTopShadow:"top-and-top-shadow",esriMensurationPoint3D:"point-3D",esriMensurationCentroid3D:"centroid-3D",esriMensurationDistanceAndAngle3D:"distance-and-angle-3D",esriMensurationAreaAndPerimeter3D:"area-and-perimeter-3D"});let W=class extends z{constructor(){super(...arguments),this.type=null,this.measureOperation=null,this.mosaicRule=null,this.pixelSize=null,this.raster=void 0}};n([l()],W.prototype,"type",void 0),n([l({type:U.apiValues,json:{read:U.read,write:U.write}})],W.prototype,"measureOperation",void 0),n([l({type:H,json:{write:!0}})],W.prototype,"mosaicRule",void 0),n([l({type:q,json:{write:!0}})],W.prototype,"pixelSize",void 0),n([l({json:{write:!0}})],W.prototype,"raster",void 0),W=n([F("esri.rest.support.BaseImageMeasureParameters")],W);var Xe;let ee=Xe=class extends W{constructor(){super(...arguments),this.type="area-perimeter",this.geometry=null,this.is3D=!1,this.linearUnit="meters",this.areaUnit="square-meters"}writeGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=r.toJSON())}get measureOperation(){return this.is3D?"area-and-perimeter-3D":"area-and-perimeter"}clone(){return new Xe(Q({geometry:this.geometry,is3D:this.is3D,linearUnit:this.linearUnit,areaUnit:this.areaUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};n([l({types:nt,json:{name:"fromGeometry",read:!0,write:!0}})],ee.prototype,"geometry",void 0),n([P("geometry")],ee.prototype,"writeGeometry",null),n([l({type:U.apiValues,json:{write:U.write}})],ee.prototype,"measureOperation",null),n([l({json:{read:!0}})],ee.prototype,"is3D",void 0),n([l({type:String,json:{read:le.read,write:le.write}})],ee.prototype,"linearUnit",void 0),n([l({type:String,json:{read:$e.read,write:$e.write}})],ee.prototype,"areaUnit",void 0),ee=Xe=n([F("esri.rest.support.ImageAreaParameters")],ee);const lr=ee;var Ye;let Z=Ye=class extends W{constructor(){super(...arguments),this.type="distance-angle",this.fromGeometry=null,this.toGeometry=null,this.is3D=!1,this.linearUnit="meters",this.angularUnit="degrees"}writeFromGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=r.toJSON())}get measureOperation(){return this.is3D?"distance-and-angle-3D":"distance-and-angle"}clone(){return new Ye(Q({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,is3D:this.is3D,linearUnit:this.linearUnit,angularUnit:this.angularUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};n([l({type:q,json:{read:!0,write:!0}})],Z.prototype,"fromGeometry",void 0),n([P("fromGeometry")],Z.prototype,"writeFromGeometry",null),n([l({type:q,json:{read:!0,write:!0}})],Z.prototype,"toGeometry",void 0),n([l({type:U.apiValues,json:{write:U.write}})],Z.prototype,"measureOperation",null),n([l({json:{read:!0}})],Z.prototype,"is3D",void 0),n([l({type:String,json:{read:le.read,write:le.write}})],Z.prototype,"linearUnit",void 0),n([l({type:String,json:{read:Me.read,write:Me.write}})],Z.prototype,"angularUnit",void 0),Z=Ye=n([F("esri.rest.support.ImageDistanceParameters")],Z);const ur=Z;var et;let te=et=class extends W{constructor(){super(...arguments),this.type="height",this.fromGeometry=null,this.toGeometry=null,this.operationType="base-and-top",this.linearUnit="meters"}writeFromGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=r.toJSON())}get measureOperation(){return this.operationType}clone(){return new et(Q({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,operationType:this.operationType,linearUnit:this.linearUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};n([l({type:q,json:{read:!0}})],te.prototype,"fromGeometry",void 0),n([P("fromGeometry")],te.prototype,"writeFromGeometry",null),n([l({type:q,json:{read:!0,write:!0}})],te.prototype,"toGeometry",void 0),n([l({type:U.apiValues,json:{write:U.write}})],te.prototype,"measureOperation",null),n([l({json:{read:!0}})],te.prototype,"operationType",void 0),n([l({type:String,json:{read:le.read,write:le.write}})],te.prototype,"linearUnit",void 0),te=et=n([F("esri.rest.support.ImageHeightParameters")],te);const pr=te;var tt;let D=tt=class extends z{constructor(){super(...arguments),this.geometry=null,this.rasterFunctions=null,this.pixelSize=null,this.returnGeometry=!0,this.returnCatalogItems=!0,this.returnPixelValues=!0,this.maxItemCount=null,this.timeExtent=null,this.raster=void 0,this.viewId=void 0,this.processAsMultidimensional=!1}writeGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=JSON.stringify(r.toJSON()))}set mosaicRule(r){let i=r;i!=null&&i.mosaicMethod&&(i=H.fromJSON({...i.toJSON(),mosaicMethod:i.mosaicMethod,mosaicOperation:i.mosaicOperation})),this._set("mosaicRule",i)}writeMosaicRule(r,i,o){r!=null&&(i[o]=JSON.stringify(r.toJSON()))}get renderingRule(){return we(ne.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._get("rasterFunction")}set renderingRule(r){we(ne.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",r)}get renderingRules(){return we(ne.getLogger(this),"renderingRules",{replacement:"rasterFunctions",version:"4.27",warnOnce:!0}),this._get("rasterFunctions")}set renderingRules(r){we(ne.getLogger(this),"renderingRules",{replacement:"rasterFunctions",version:"4.27",warnOnce:!0}),this._set("rasterFunctions",r)}set rasterFunction(r){let i=r;i!=null&&i.rasterFunction&&(i=b.fromJSON({...i.toJSON(),rasterFunction:i.rasterFunction,rasterFunctionArguments:i.rasterFunctionArguments})),this._set("rasterFunction",i)}writeRasterFunction(r,i,o){r!=null&&(i[o]=JSON.stringify(r.toJSON())),r.rasterFunctionDefinition&&(i[o]=JSON.stringify(r.rasterFunctionDefinition))}writeRasterFunctions(r,i,o){r!=null&&(i[o]=JSON.stringify(r.map(e=>e.rasterFunctionDefinition||e.toJSON())))}writePixelSize(r,i,o){r!=null&&(i[o]=JSON.stringify(r))}writeTimeExtent(r,i,o){if(r!=null){const e=r.start!=null?r.start.getTime():null,t=r.end!=null?r.end.getTime():null;i[o]=e!=null?t!=null?`${e},${t}`:`${e}`:null}}clone(){return new tt(Q({geometry:this.geometry,mosaicRule:this.mosaicRule,rasterFunction:this.rasterFunction,rasterFunctions:this.rasterFunctions,pixelSize:this.pixelSize,returnGeometry:this.returnGeometry,returnCatalogItems:this.returnCatalogItems,returnPixelValues:this.returnPixelValues,maxItemCount:this.maxItemCount,processAsMultidimensional:this.processAsMultidimensional,raster:this.raster,viewId:this.viewId,timeExtent:this.timeExtent}))}};n([l({json:{write:!0}})],D.prototype,"geometry",void 0),n([P("geometry")],D.prototype,"writeGeometry",null),n([l({type:H,json:{write:!0}})],D.prototype,"mosaicRule",null),n([P("mosaicRule")],D.prototype,"writeMosaicRule",null),n([l({type:b})],D.prototype,"renderingRule",null),n([l({type:[b]})],D.prototype,"renderingRules",null),n([l({type:b,json:{write:!0,name:"renderingRule"}})],D.prototype,"rasterFunction",null),n([P("rasterFunction")],D.prototype,"writeRasterFunction",null),n([l({type:[b],json:{write:!0,name:"renderingRules"}})],D.prototype,"rasterFunctions",void 0),n([P("rasterFunctions")],D.prototype,"writeRasterFunctions",null),n([l({type:q,json:{write:!0}})],D.prototype,"pixelSize",void 0),n([P("pixelSize")],D.prototype,"writePixelSize",null),n([l({type:Boolean,json:{write:!0}})],D.prototype,"returnGeometry",void 0),n([l({type:Boolean,json:{write:!0}})],D.prototype,"returnCatalogItems",void 0),n([l({type:Boolean,json:{write:!0}})],D.prototype,"returnPixelValues",void 0),n([l({type:Number,json:{write:!0}})],D.prototype,"maxItemCount",void 0),n([l({type:dt,json:{write:{target:"time"}}})],D.prototype,"timeExtent",void 0),n([P("timeExtent")],D.prototype,"writeTimeExtent",null),n([l({json:{write:!0}})],D.prototype,"raster",void 0),n([l({json:{write:!0}})],D.prototype,"viewId",void 0),n([l({type:Boolean,json:{write:!0}})],D.prototype,"processAsMultidimensional",void 0),D=tt=n([F("esri.rest.support.ImageIdentifyParameters")],D);const mt=D;var it;let ve=it=class extends z{constructor(){super(...arguments),this.geometries=null,this.rasterId=null}writeGeometry(r,i,o){i.geometries={geometryType:"esriGeometryPoint",geometries:r.map(e=>e.toJSON())}}clone(){var r;return new it({geometries:((r=this.geometries)==null?void 0:r.map(i=>i.clone()))??[],rasterId:this.rasterId})}};n([l({type:[q],json:{write:!0}})],ve.prototype,"geometries",void 0),n([P("geometries")],ve.prototype,"writeGeometry",null),n([l({type:Ee,json:{write:!0}})],ve.prototype,"rasterId",void 0),ve=it=n([F("esri.rest.support.ImagePixelLocationParameters")],ve);const cr=ve;var rt;let de=rt=class extends W{constructor(){super(...arguments),this.type="point",this.geometry=null,this.is3D=!1}writeGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=r.toJSON())}get measureOperation(){const{is3D:r,geometry:i}=this;return i.type==="point"?r?"point-3D":"point":r?"centroid-3D":"centroid"}clone(){return new rt(Q({geometry:this.geometry,is3D:this.is3D,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};n([l({types:nt,json:{name:"fromGeometry",read:ht}})],de.prototype,"geometry",void 0),n([P("geometry")],de.prototype,"writeGeometry",null),n([l({type:U.apiValues,json:{read:U.read,write:U.write}})],de.prototype,"measureOperation",null),n([l({json:{read:!0}})],de.prototype,"is3D",void 0),de=rt=n([F("esri.rest.support.ImagePointParameters")],de);const mr=de;var st;let j=st=class extends z{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=r.toJSON())}set locations(r){if(r!=null&&r.length){const i=new Nt({spatialReference:r[0].spatialReference});i.points=r.map(o=>[o.x,o.y]),this._set("locations",r),this.geometry=i}}clone(){return new st(Q({geometry:this.geometry,locations:this.locations,interpolation:this.interpolation,mosaicRule:this.mosaicRule,outFields:this.outFields,raster:this.raster,returnFirstValueOnly:this.returnFirstValueOnly,sampleDistance:this.sampleDistance,sampleCount:this.sampleCount,sliceId:this.sliceId,pixelSize:this.pixelSize,timeExtent:this.timeExtent}))}};n([l({types:nt,json:{read:ht}})],j.prototype,"geometry",void 0),n([P("geometry")],j.prototype,"writeGeometry",null),n([l()],j.prototype,"locations",null),n([l({type:String,json:{type:oe.jsonValues,read:oe.read,write:oe.write}})],j.prototype,"interpolation",void 0),n([l({type:H,json:{write:!0}})],j.prototype,"mosaicRule",void 0),n([l({type:[String],json:{write:!0}})],j.prototype,"outFields",void 0),n([l({type:q,json:{write:!0}})],j.prototype,"pixelSize",void 0),n([l({type:String,json:{write:!0}})],j.prototype,"raster",void 0),n([l({type:Boolean,json:{write:!0}})],j.prototype,"returnFirstValueOnly",void 0),n([l({type:Number,json:{write:!0}})],j.prototype,"sampleDistance",void 0),n([l({type:Number,json:{write:!0}})],j.prototype,"sampleCount",void 0),n([l({type:Number,json:{write:!0}})],j.prototype,"sliceId",void 0),n([l({type:dt,json:{read:{source:"time"},write:{target:"time"}}})],j.prototype,"timeExtent",void 0),j=st=n([F("esri.rest.support.ImageSampleParameters")],j);const dr=j,hr=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),yr=$t(Mt,{min:0,max:255});function gr(r){if(!r)return null;const i=JSON.stringify(r).match(/"rasterFunction":"(.*?")/gi),o=i==null?void 0:i.map(e=>e.replace('"rasterFunction":"',"").replace('"',""));return o?o.join("/"):null}const fr=r=>{let i=class extends r{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new N({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.length<1||this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.forEach(t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)}),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every(s=>typeof s=="number"))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,s){e!=null&&this.format!=="lerc"&&(t[s]=e)}writeCompressionTolerance(e,t,s){this.format==="lerc"&&e!=null&&(t[s]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?H.fromJSON(t):null}get fieldsIndex(){return this.fields?new Ct(this.fields):null}set format(e){e&&hr.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return t.serviceDataType==="esriImageServiceDataTypeVector-UV"||t.serviceDataType==="esriImageServiceDataTypeVector-MagDir"||this.pixelFilter!=null?"lerc":"jpgpng"}readMinScale(e,t){return t.minLOD!=null&&t.maxLOD!=null?e:0}readMaxScale(e,t){return t.minLOD!=null&&t.maxLOD!=null?e:0}set mosaicRule(e){let t=e;t!=null&&t.mosaicMethod&&(t=H.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const s=e||t.mosaicRule;return s?H.fromJSON(s):this._isMosaicRuleSupported(t)?H.fromJSON(t):null}writeMosaicRule(e,t,s){let a=this.mosaicRule;const u=this.definitionExpression;a?u&&u!==a.where&&(a=a.clone(),a.where=u):u&&(a=new H({where:u})),this._isValidCustomizedMosaicRule(a)&&(t[s]=a.toJSON())}writeNoData(e,t,s){e!=null&&typeof e=="number"&&(t[s]=yr(e))}readObjectIdField(e,t){if(!e){const s=t.fields.find(a=>a.type==="esriFieldTypeOID"||a.type==="oid");e=s==null?void 0:s.name}return e}get parsedUrl(){return Vt(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,s){var p,m;const a=(m=(p=t==null?void 0:t.layerDefinition)==null?void 0:p.drawingInfo)==null?void 0:m.renderer,u=si(a,s);return u==null?null:(u.type==="vector-field"&&t.symbolTileSize&&!a.symbolTileSize&&(u.symbolTileSize=t.symbolTileSize),vt(u)||ne.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),u)}writeRenderer(e,t,s){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),e.type==="vector-field"&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){var m;const e=this._rasterAttributeTableFieldPrefix,t=new ce({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),s=new ce({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),a=new ce({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let u=this.fields?Q(this.fields):[];u.push(s),(m=this.capabilities)!=null&&m.operations.supportsQuery&&this.fields&&this.fields.length>0&&u.push(t),this.version>=10.4&&this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.some(c=>c.name.toLowerCase()==="none")&&u.push(a),this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.filter(c=>c.name.toLowerCase()!=="none").forEach(c=>{u.push(new ce({name:"Raster.ServicePixelValue."+c.name,alias:c.name,domain:null,editable:!1,length:50,type:"string"}))}),this._isVectorDataSet()&&(u.push(new ce({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),u.push(new ce({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:p}=this.rasterInfo??{};if(p!=null){const c=p.fields.filter(d=>d.type!=="esriFieldTypeOID"&&d.name.toLowerCase()!=="value").map(d=>{const y=Q(d);return y.name=e+d.name,y});u=u.concat(c)}return u}get renderingRule(){return we(ne.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this.rasterFunction}set renderingRule(e){we(ne.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}set rasterFunction(e){let t=e;t!=null&&t.rasterFunction&&(t=b.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const s=t.rasterFunctionInfos;return t.renderingRule||s!=null&&s.length&&s[0].name!=="None"?this._isRFTJson(t.renderingRule)?b.fromJSON({rasterFunctionDefinition:t.renderingRule}):b.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const s=e||t.extent.spatialReference;return s?he.fromJSON(s):null}readPixelType(e){return Ue.fromJSON(e)||e}writePixelType(e,t,s){this.serviceRasterInfo!=null&&this.pixelType===this.serviceRasterInfo.pixelType||(t[s]=Ue.toJSON(e))}readVersion(e,t){let s=t.currentVersion;return s||(s=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),s}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let s=e;const{renderer:a,symbolizer:u,pixelFilter:p,bandIds:m}=this;if(!this._isPicture()&&a&&u&&!p){const c=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(a.toJSON()),d=this._rasterJobHandler.instance;if(d){c&&(u.bind(),await d.updateSymbolizer(u,t),this._cachedRendererJson=a.toJSON());const y=await d.symbolize({bandIds:m,...e},t);s={extent:e.extent,pixelBlock:y}}else s={extent:e.extent,pixelBlock:u.symbolize({bandIds:m,...e})}}return s}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputeAngles)throw new C("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=G(or,e).clone(),Ki(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputePixelLocation)throw new C("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=G(cr,e).clone(),Xi(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputeHistograms)throw new C("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=G(Qe,e).clone(),this._applyMosaicAndRenderingRules(e),er(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputeStatisticsHistograms)throw new C("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=G(Qe,e).clone(),this._applyMosaicAndRenderingRules(e),Yi(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const s=await this._fetchCapabilities(t==null?void 0:t.signal);if(!(e.operationType==="base-and-top"?s.mensuration.supportsHeightFromBaseAndTop:e.operationType==="base-and-top-shadow"?s.mensuration.supportsHeightFromBaseAndTopShadow:s.mensuration.supportsHeightFromTopAndTopShadow))throw new C("imagery-layer:measure-height","this operation is not supported on the input image service");return e=G(pr,e).clone(),this._applyMosaicAndRenderingRules(e),ir(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const s=await this._fetchCapabilities(t==null?void 0:t.signal);if(!(s.mensuration.supportsAreaAndPerimeter&&(!e.is3D||s.mensuration.supports3D)))throw new C("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=G(lr,e).clone(),this._applyMosaicAndRenderingRules(e),rr(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const s=await this._fetchCapabilities(t==null?void 0:t.signal);if(!(s.mensuration.supportsDistanceAndAngle&&(!e.is3D||s.mensuration.supports3D)))throw new C("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=G(ur,e).clone(),this._applyMosaicAndRenderingRules(e),nr(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const s=await this._fetchCapabilities(t==null?void 0:t.signal);if(!(s.mensuration.supportsPointOrCentroid&&(!e.is3D||s.mensuration.supports3D)))throw new C("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=G(mr,e).clone(),this._applyMosaicAndRenderingRules(e),sr(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return t!=null?t.get(e):void 0}getFieldDomain(e,t){const s=this.getField(e);return s?s.domain:null}async fetchImage(e,t,s,a={}){if(e==null||t==null||s==null)throw new C("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const d=await this._generateRasterInfo(this.rasterFunction,{signal:a.signal});d&&(this.rasterInfo=d)}const u=this.getExportImageServiceParameters(e,t,s,a.timeExtent);if(u==null){if(a.requestAsImageElement&&this._canRequestImageElement(this.format)){const g=document.createElement("canvas");return g.width=t,g.height=s,a.returnImageBitmap?{imageBitmap:await lt(g,`${o(this.parsedUrl)}/exportImage`,a.signal)}:{imageOrCanvasElement:g}}const{bandIds:d,rasterInfo:y}=this,R=((d==null?void 0:d.length)||y.bandCount)??0,f=t*s,v=y.pixelType,h=[];for(let g=0;g=10.3?e==null?void 0:e.rasterFunction:null})}).then(t=>t.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new C("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):_(o(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e==null?void 0:e.rasterFunction:null})}).then(t=>Rt.fromJSON(t.data))}getCatalogItemRasterInfo(e,t){const s={...t,query:this._getQueryParams()};return ar(o(this.parsedUrl),e,s)}async getCatalogItemICSInfo(e,t){var ue,pe,X,at,ot;const{data:s}=await _(o(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),a=s==null?void 0:s.ics;if(!a)return;let u=null;try{u=(await _(o(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!u||!u.spatialReference)return{ics:a,icsToPixelTransform:null,icsExtent:null,northDirection:null};const p=this.version>=10.7?_(o(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then(S=>S.data).catch(()=>({})):{},m=u.spatialReference,c={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[u]}),inSR:Ze(m),outSR:"0:"+e},d=_(o(this.parsedUrl)+"/project",{query:this._getQueryParams(c),...t}).then(S=>S.data).catch(()=>({})),y=5,R=(u.xmin+u.xmax)/2,f=(u.ymax-u.ymin)/(y+1),v=u.ymin+f,h=[];for(let S=0;SS.data).catch(()=>({})),T=await Promise.all([p,d,w]);let $=T[0].ipxf;if($==null){const S=(ue=a.geodataXform)==null?void 0:ue.xf_0;((pe=S==null?void 0:S.name)==null?void 0:pe.toLowerCase())==="topup"&&((X=S==null?void 0:S.coefficients)==null?void 0:X.length)===6&&($={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:S.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const V=_e.fromJSON((ot=(at=T[1])==null?void 0:at.geometries)==null?void 0:ot[0]);V&&(V.spatialReference=new he({wkid:0,imageCoordinateSystem:a}));const x=T[2].geometries?T[2].geometries.filter(S=>(S==null?void 0:S.x)!=null&&S.y!=null&&S.x!=="NaN"&&S.y!=="NaN"):[],J=x.length;if(J<3)return{ics:a,icsToPixelTransform:$,icsExtent:V,northDirection:null};let B=0,O=0,I=0,M=0;for(let S=0;Sx[0].x,Pe=x[y-1].y>x[0].y;return A===1/0?re=Pe?90:270:A===0?re=Te?0:180:A>0?re=Te?180*Math.atan(A)/Math.PI:180*Math.atan(A)/Math.PI+180:A<0&&(re=Pe?180+180*Math.atan(A)/Math.PI:360+180*Math.atan(A)/Math.PI),{ics:a,icsToPixelTransform:$,icsExtent:V,northDirection:re}}async generateRasterInfo(e,t){var p;if(e=G(b,e),this.serviceRasterInfo&&(!e||((p=e.functionName)==null?void 0:p.toLowerCase())==="none"||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const s=gr(e);if(!s)throw new C("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[s])return this._functionRasterInfos[s];const a={...t,query:this._getQueryParams()},u=ni(o(this.parsedUrl),e,a);this._functionRasterInfos[s]=u;try{return await u}catch(m){throw this._functionRasterInfos[s]=null,m}}getExportImageServiceParameters(e,t,s,a){var h;e=e.clone().shiftCentralMeridian();const u=It(e.spatialReference,o(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const p=this.exportImageServiceParameters.toJSON(),{bandIds:m,noData:c}=p;let{renderingRule:d}=p;const y=(h=this.rasterFunction)==null?void 0:h.rasterFunctionDefinition,R=!this.renderer||this.renderer.type==="raster-stretch";if(m!=null&&m.length&&this._hasRasterFunction(this.rasterFunction)&&!y&&R){const g={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:m}};if(d.rasterFunction==="Stretch")g.rasterFunctionArguments.Raster=d.rasterFunctionArguments.Raster,d.rasterFunctionArguments.Raster=g;else if(d.rasterFunction==="Colormap"){const w=d.rasterFunctionArguments.Raster;(w==null?void 0:w.rasterFunction)==="Stretch"?(g.rasterFunctionArguments.Raster=w.rasterFunctionArguments.Raster,w.rasterFunctionArguments.Raster=g):(g.rasterFunctionArguments.Raster=w,d.rasterFunctionArguments.Raster=g)}else g.rasterFunctionArguments.Raster=d,d=g;p.bandIds=void 0}else p.bandIds=m==null?void 0:m.join(",");c instanceof Array&&c.length>0&&(p.noData=c.join(","));const f=this._processMultidimensionalIntersection(null,a,this.exportImageServiceParameters.mosaicRule);if(f.isOutSide)return null;p.mosaicRule=f.mosaicRule!=null?JSON.stringify(f.mosaicRule):null,a=f.timeExtent,p.renderingRule=this._getRenderingRuleString(b.fromJSON(d));const v={};if(a!=null){const{start:g,end:w}=a.toJSON();g&&w&&g===w?v.time=""+g:g==null&&w==null||(v.time=`${g??"null"},${w??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:u,imageSR:u,size:t+","+s,...p,...v}}async getSamples(e,t){const s=await this._fetchCapabilities(t==null?void 0:t.signal);if(!(s!=null&&s.operations.supportsGetSamples))throw new C("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=G(dr,e).clone();const{raster:a}=this;return a&&e.raster==null&&(e.raster=a),tr(this.url,e,this._getRequestOptions(t))}async identify(e,t){var p;if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsIdentify)throw new C("imagery-layer:identify","identify operation is not supported on the input image service");e=G(mt,e).clone(),this.version<10.91&&((p=e.geometry)==null?void 0:p.type)==="extent"&&(e.geometry=Ge.fromExtent(e.geometry));const s=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(s.isOutSide)throw new C("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=s.timeExtent,e.mosaicRule=s.mosaicRule;const{raster:a,rasterFunction:u}=this;return u&&e.rasterFunction==null&&(e.rasterFunction=u),a&&e.raster==null&&(e.raster=a),pt(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new He;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),Fi(this.url,e,t)}async queryObjectIds(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),Ii(this.url,e,t)}async queryRasterCount(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),Di(this.url,e,t)}async queryVisibleRasters(e,t){var V,x,J,B;if(!e)throw new C("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:s,returnDomainValues:a,returnTopmostRaster:u,showNoDataRecords:p}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let m=!1,c=null,d=null;const y="raster.servicepixelvalue",R=this._rasterFunctionNamesIndex;if(e.outFields!=null&&(m=e.outFields.some(O=>!O.toLowerCase().includes(y)),this.version>=10.4)){const O=e.outFields.filter(M=>M.toLowerCase().includes(y)&&M.length>y.length).map(M=>{const A=M.slice(y.length+1);return[this._updateRenderingRulesFunctionName(A,R),A]});c=O.map(M=>new b({functionName:M[0]})),d=O.map(M=>M[1]);const{rasterFunction:I}=this;c.length===0?I!=null&&I.functionName?(c.push(I),d.push(I.functionName)):c=null:I!=null&&I.functionName&&!c.some(M=>M.functionName===I.functionName)&&(c.push(I),d.push(I.functionName))}const f=e.outSpatialReference==null||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:v}=this;let h=e.timeExtent||this.timeExtent;if(v){const{isOutside:O,intersection:I}=Be(v,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:(V=this.exportImageServiceParameters.mosaicRule)==null?void 0:V.multidimensionalDefinition});if(O)throw new C("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");(I==null?void 0:I.timeExtent)!=null&&(h=I.timeExtent)}const g=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h);let w=e.geometry;this.version<10.91&&(w==null?void 0:w.type)==="extent"&&(w=Ge.fromExtent(w));const T=this._getQueryParams({geometry:w,timeExtent:h,mosaicRule:g,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:c,pixelSize:s,returnCatalogItems:m,returnGeometry:f,raster:this.raster,maxItemCount:u?1:null});delete T.f;const $=new mt(T);try{await this._generateRasterInfo(this.rasterFunction);const O=await pt(this.url,$,{signal:t==null?void 0:t.signal,query:{...this.customParameters}}),I=e.outFields,M=O.value!=null&&O.value.toLowerCase().includes("nodata");if(!(m&&!f&&((x=O==null?void 0:O.catalogItems)!=null&&x.features.length)&&(p||!M)))return this._processVisibleRastersResponse(O,{returnDomainValues:a,templateRRFunctionNames:d,showNoDataRecords:p,templateFields:I});const A=this.objectIdField||"ObjectId",re=((J=O.catalogItems)==null?void 0:J.features)??[],Te=re.map(pe=>{var X;return(X=pe.attributes)==null?void 0:X[A]}),Pe=new He({objectIds:Te,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[A]}),ue=await this.queryRasters(Pe);return(B=ue==null?void 0:ue.features)!=null&&B.length&&ue.features.forEach(pe=>{re.forEach(X=>{X.attributes[A]===pe.attributes[A]&&(X.geometry=new Ge(pe.geometry),e.outSpatialReference!=null&&(X.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(O,{returnDomainValues:a,templateRRFunctionNames:d,showNoDataRecords:p,templateFields:I})}catch{throw new C("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const s=_(o(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then(p=>{var m;return(m=p.data)==null?void 0:m.statistics}),a=_(o(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then(p=>{var m;return(m=p.data)==null?void 0:m.histograms}),u=await Promise.all([s,a]);return u[0]&&u[0].forEach(p=>{p.avg=p.mean,p.stddev=p.standardDeviation}),{statistics:u[0]||null,histograms:u[1]||null}}async createFlowMesh(e,t){const s=this._rasterJobHandler.instance;return s?s.createFlowMesh(e,t):wi(e.meshType,e.simulationSettings,e.flowData,t.signal!=null?t.signal:new AbortController().signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return ai(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,s=this.serviceRasterInfo!=null?Promise.resolve(this.serviceRasterInfo):oi(o(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(p=>(this._set("serviceRasterInfo",p),this._set("multidimensionalInfo",p.multidimensionalInfo),li(p,t),p)),a=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,u=this._getRasterFunctionInfos();return Promise.all([s,a,u]).then(p=>{p[1]?this._set("rasterInfo",p[1]):this._set("rasterInfo",p[0]),p[2]&&this._set("rasterFunctionInfos",p[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),ne.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([At(()=>this.rasterFunction,c=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(c).then(d=>{d&&(this.rasterInfo=d)})})]);const{serviceRasterInfo:m}=this;m.multidimensionalInfo!=null&&this._updateMultidimensionalDefinition(m)})}_combineMosaicRuleWithTimeExtent(e,t){var v;const s=this.timeInfo,{multidimensionalInfo:a}=this.serviceRasterInfo;if(e==null||a==null||t==null||(s==null?void 0:s.startField)==null)return e;const{startField:u}=s,p=a.variables.some(h=>h.dimensions.some(g=>g.name===u))?u:"StdTime";if(e=e.clone(),this.sourceType==="mosaic-dataset")return e.multidimensionalDefinition=(v=e.multidimensionalDefinition)==null?void 0:v.filter(h=>h.dimensionName!==p),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const m=e.multidimensionalDefinition.filter(h=>h.dimensionName===p),c=t.start!=null?t.start.getTime():null,d=t.end!=null?t.end.getTime():null,y=c==null||d==null||c===d,R=y?[c||d]:[[c,d]],f=this.version>=10.8;if(m.length)m.forEach(h=>{h.dimensionName===p&&(f?(h.dimensionName=null,h.isSlice=!1,h.values=[]):(h.isSlice=y,h.values=R))});else if(!f){const h=e.multidimensionalDefinition.filter(g=>g.variableName!=null&&g.dimensionName==null);h.length?h.forEach(g=>{g.dimensionName=p,g.isSlice=y,g.values=R}):e.multidimensionalDefinition.push(new ui({variableName:"",dimensionName:p,isSlice:y,values:R}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return e==null?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(t=>!(!t.variableName&&!t.dimensionName)),e.multidimensionalDefinition.length===0&&(e.multidimensionalDefinition=null)),this.sourceType!=="mosaic-dataset"&&e.multidimensionalDefinition==null?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsQuery)throw new C("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=e!=null?G(He,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(this._rasterJobHandler.connectionPromise!=null)return this._rasterJobHandler.connectionPromise;const e=new yi;this._rasterJobHandler.connectionPromise=e.initialize().then(()=>{this._rasterJobHandler.instance=e},()=>{}),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:s}=this;return e.type==="unique-value"&&this._hasRasterFunction(s)&&(t==null?void 0:t.bandCount)===1&&["u8","s8"].includes(t.pixelType)||t!=null&&e!=null&&pi(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){var s;let t=this.sourceJSON;if(!t){const{data:a,ssl:u}=await _(o(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=a,this.sourceJSON=t,u&&(this.url=this.url.replace(/^http:/i,"https:"))}if(((s=t.capabilities)==null?void 0:s.toLowerCase().split(",").map(a=>a.trim()).indexOf("tilesonly"))>-1)throw new C("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){var t;return e.serviceSourceType?e.serviceSourceType==="esriImageServiceSourceTypeMosaicDataset":((t=e.fields)==null?void 0:t.length)>0}_isMosaicRuleSupported(e){var a;if(!e)return!1;const t=this._isMosaicDataset(e),s=e.currentVersion>=10.71&&e.hasMultidimensions&&!(((a=e.fields)==null?void 0:a.length)>1);return t||s}_isVectorFieldResampleFunction(e){if(e==null)return!1;const{functionName:t,functionArguments:s}=e,a=(t==null?void 0:t.toLowerCase())==="resample",u=(s==null?void 0:s.ResampleType)||(s==null?void 0:s.resampleType);return a&&(u===7||u===10)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){var a,u;const t=this._isPicture(),{rasterInfo:s}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&s.bandCount>=3){const m=ci(s);!m||s.bandCount===3&&m[0]===0&&m[1]===1&&m[2]===2||(this.bandIds=m)}e||(e=mi(s,{bandIds:this.bandIds,variableName:this.rasterFunction?null:(u=(a=this.mosaicRule)==null?void 0:a.multidimensionalDefinition)==null?void 0:u[0].variableName}));const p=di(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=p,this.symbolizer.rasterInfo=s):this.symbolizer=new bi({rendererJSON:p,rasterInfo:s}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return e==null?e:{extent:e.extent&&e.extent.clone(),pixelBlock:e.pixelBlock!=null?e.pixelBlock.clone():null}}_getQueryParams(e){(e==null?void 0:e.renderingRule)!=null&&typeof e.renderingRule!="string"&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:s}=this;return{raster:t,viewId:s,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e==null?void 0:e.query,...this.customParameters}}}_decodePixelBlock(e,t,s){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):ut(e,t,s)}async _getRasterFunctionInfos(e){var s;const t=this.sourceJSON.rasterFunctionInfos;return this.loaded?t:t&&this.version>=10.3?t.length===1&&t[0].name.toLowerCase()==="none"?t:(s=(await _(o(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data)==null?void 0:s.rasterFunctionInfos:null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:s,returnImageBitmap:a,signal:u}=e;if(s&&this._canRequestImageElement(t.format)){const v=`${o(this.parsedUrl)}/exportImage`,{data:h}=await _(v,{responseType:a?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:u});return h instanceof Blob?{imageBitmap:await lt(h,v,u),params:t}:{imageOrCanvasElement:h,params:t}}const p=this._initJobHandler(),m=_(o(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:u}),c=(await Promise.all([m,p]))[0].data,d=t.format||"jpgpng";let y=d;if(y!=="bsq"&&y!=="bip"&&(y=Si(c)),!y)throw new C("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(c)));const R={signal:u};return{pixelData:{pixelBlock:await(d==="gif"||d==="bmp"||d.includes("png")&&(y==="png"||y==="jpg")?ut(c,{useCanvas:!0,...t},R):this._decodePixelBlock(c,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:d},R)),extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch(()=>null)}_isValidCustomizedMosaicRule(e){var t;return e&&JSON.stringify(e.toJSON())!==JSON.stringify((t=this.defaultMosaicRule)==null?void 0:t.toJSON())}_updateMultidimensionalDefinition(e){var s;if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=hi(e,{multidimensionalSubset:this.multidimensionalSubset});if(t!=null&&t.length>0){this.mosaicRule=this.mosaicRule||new H;const a=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&((s=this.rasterFunction.functionName)==null?void 0:s.toLowerCase())!=="none"&&t.forEach(u=>u.variableName=""),t=t.filter(({variableName:u,dimensionName:p})=>u&&u!=="*"||p),!(a!=null&&a.length)&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,t){var T,$,V;t=t||{};const s=e.value,{templateRRFunctionNames:a,showNoDataRecords:u,returnDomainValues:p,templateFields:m}=t,c=e.processedValues;let d=(T=e.catalogItems)==null?void 0:T.features,y=((V=($=e.properties)==null?void 0:$.Values)==null?void 0:V.map(x=>x.replaceAll(/ /gi,", ")))||[];const R=this.objectIdField||"ObjectId",f=typeof s=="string"&&s.toLowerCase().includes("nodata"),v=[];if(s&&!d&&!f){const x={};x[R]=0,y=[s],d=[new jt(this.fullExtent,null,x)]}if(!d)return[];let h,g,w;this._updateResponseFieldNames(d,m),f&&!u&&(d=[]);for(let x=0;x0&&a&&a.length>0&&a.includes(this.rasterFunction.functionName)?c[a.indexOf(this.rasterFunction.functionName)]:s,g.toLowerCase()==="nodata"&&!u)continue;const J="Raster.ItemPixelValue",B="Raster.ServicePixelValue";h.attributes[J]=g,h.attributes[B]=w,this._updateFeatureWithMagDirValues(h,g);const O=this.fields&&this.fields.length>0;let I=this.rasterFunction&&this.serviceRasterInfo.attributeTable!=null?O?g:s:w;this.rasterFunction||(I=O?g:s),this._updateFeatureWithRasterAttributeTableValues(h,I)}if(h.sourceLayer=h.layer=this,p&&this._updateFeatureWithDomainValues(h),a&&c&&a.length===c.length)for(let J=0;Jc.name).find(c=>c.toLowerCase()==="value");if(!p)return;const m=a.filter(c=>c.attributes[p]===(t!=null?parseInt(t,10):null));m&&m[0]&&u.forEach(c=>{const d=this._rasterAttributeTableFieldPrefix+c.name;e.attributes[d]=m[0].attributes[c.name]})}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const s=t.split(/,\s*/).map(c=>parseFloat(c)),a=s.map(c=>[c]),u=s.map(c=>({minValue:c,maxValue:c,noDataValue:null})),p=new ke({height:1,width:1,pixelType:"f32",pixels:a,statistics:u});this.pixelFilter!=null&&this.pixelFilter({pixelBlock:p,extent:new _e(0,0,0,0,this.spatialReference)});const m=this.serviceDataType==="esriImageServiceDataTypeVector-MagDir"?[p.pixels[0][0],p.pixels[1][0]]:xi([p.pixels[0][0],p.pixels[1][0]]);e.attributes["Raster.Magnitude"]=m[0],e.attributes["Raster.Direction"]=m[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter(s=>s.domain&&s.domain.type==="coded-value");t!=null&&t.forEach(s=>{const a=e.attributes[s.name];if(a!=null){const u=s.domain.codedValues.find(p=>p.code===a);u&&(e.attributes[s.name]=u.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const s=this.fieldsIndex;s!=null&&e.forEach(a=>{var u;if(a!=null&&a.attributes)for(const p of t){const m=(u=s.get(p))==null?void 0:u.name;m&&m!==p&&(a.attributes[p]=a.attributes[m],delete a.attributes[m])}})}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return(e==null?void 0:e.functionName)!=null&&e.functionName.toLowerCase()!=="none"}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if(e==="Raw")return e.replace("Raw","None");const s=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(s)?t.get(s):e}_isRFTJson(e){return(e==null?void 0:e.name)&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return this.serviceDataType==="esriImageServiceDataTypeVector-UV"||this.serviceDataType==="esriImageServiceDataTypeVector-MagDir"}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:s,rasterFunction:a}=this;a&&e instanceof Qe&&e.rasterFunction==null&&(e.rasterFunction=a),s&&e.mosaicRule==null&&(e.mosaicRule=s),t&&e.raster==null&&(e.raster=t)}_readCapabilities(e){var v;const t=e.capabilities?e.capabilities.toLowerCase().split(",").map(h=>h.trim()):["image","catalog"],{currentVersion:s,advancedQueryCapabilities:a,maxRecordCount:u}=e,p=t.includes("image"),m=e.serviceDataType==="esriImageServiceDataTypeElevation",c=!(!e.spatialReference&&!((v=e.extent)!=null&&v.spatialReference)),d=t.includes("edit"),y=t.includes("mensuration")&&c,R=e.mensurationCapabilities==null?[]:e.mensurationCapabilities.toLowerCase().split(",").map(h=>h.trim()),f=y&&R.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:p,supportsExportImage:p,supportsIdentify:p,supportsMeasure:y,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:s>=10.2&&p,supportsProject:s>=10.3&&p,supportsComputeStatisticsHistograms:s>=10.4&&p,supportsQueryBoundary:s>=10.6&&p,supportsCalculateVolume:s>=10.7&&m,supportsComputePixelLocation:s>=10.7&&t.includes("catalog"),supportsComputeAngles:s>=10.91,supportsAdd:d,supportsDelete:d,supportsEditing:d,supportsUpdate:d,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:u,maxRecordCountFactor:void 0,supportsStatistics:!!(a!=null&&a.supportsStatistics),supportsOrderBy:!!(a!=null&&a.supportsOrderBy),supportsDistinct:!!(a!=null&&a.supportsDistinct),supportsPagination:!!(a!=null&&a.supportsPagination),supportsStandardizedQueriesOnly:!!(a!=null&&a.useStandardizedQueries),supportsPercentileStatistics:!!(a!=null&&a.supportsPercentileStatistics),supportsCentroid:!!(a!=null&&a.supportsReturningGeometryCentroid),supportsDistance:!!(a!=null&&a.supportsQueryWithDistance),supportsExtent:!!(a!=null&&a.supportsReturningQueryExtent),supportsGeometryProperties:!!(a!=null&&a.supportsReturningGeometryProperties),supportsHavingClause:!!(a!=null&&a.supportsHavingClause),supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!(a!=null&&a.supportsDefaultSR),supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:f,supportsAreaAndPerimeter:f,supportsPointOrCentroid:f,supportsHeightFromBaseAndTop:y&&R.includes("base-top height"),supportsHeightFromBaseAndTopShadow:y&&R.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:y&&R.includes("top-top shadow height"),supports3D:y&&R.includes("3d")}}}};function o(e){return(e==null?void 0:e.path)??""}return n([l({clonable:!1})],i.prototype,"_functionRasterInfos",void 0),n([l({clonable:!1})],i.prototype,"_rasterJobHandler",void 0),n([l({clonable:!1})],i.prototype,"_cachedRendererJson",void 0),n([l({readOnly:!0})],i.prototype,"_serviceSupportsMosaicRule",void 0),n([E("_serviceSupportsMosaicRule",["currentVersion","fields"])],i.prototype,"readServiceSupportsMosaicRule",null),n([l({readOnly:!0})],i.prototype,"_rasterAttributeTableFieldPrefix",void 0),n([l({readOnly:!0})],i.prototype,"_rasterFunctionNamesIndex",null),n([l()],i.prototype,"adjustAspectRatio",void 0),n([l({type:[Ee],json:{write:!0}})],i.prototype,"bandIds",void 0),n([E("bandIds")],i.prototype,"readBandIds",null),n([l({readOnly:!0,json:{read:!1}})],i.prototype,"capabilities",void 0),n([E("service","capabilities",["capabilities","currentVersion","serviceDataType"])],i.prototype,"readCapabilities",null),n([l({type:Number})],i.prototype,"compressionQuality",void 0),n([P("compressionQuality")],i.prototype,"writeCompressionQuality",null),n([l({type:Number})],i.prototype,"compressionTolerance",void 0),n([P("compressionTolerance")],i.prototype,"writeCompressionTolerance",null),n([l({json:{read:{source:"copyrightText"}}})],i.prototype,"copyright",void 0),n([l({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],i.prototype,"defaultMosaicRule",void 0),n([E("defaultMosaicRule",["defaultMosaicMethod"])],i.prototype,"readDefaultMosaicRule",null),n([l({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],i.prototype,"definitionExpression",void 0),n([l({readOnly:!0,constructOnly:!0})],i.prototype,"exportImageServiceParameters",void 0),n([l()],i.prototype,"rasterInfo",void 0),n([l({readOnly:!0,type:[ce]})],i.prototype,"fields",void 0),n([l({readOnly:!0})],i.prototype,"fieldsIndex",null),n([l({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],i.prototype,"format",null),n([E("service","format",["serviceDataType"])],i.prototype,"readFormat",null),n([l({type:_e})],i.prototype,"fullExtent",void 0),n([l({readOnly:!0})],i.prototype,"hasMultidimensions",void 0),n([l({json:{read:{source:"maxImageHeight"}}})],i.prototype,"imageMaxHeight",void 0),n([l({json:{read:{source:"maxImageWidth"}}})],i.prototype,"imageMaxWidth",void 0),n([l({type:String,json:{type:oe.jsonValues,read:oe.read,write:oe.write}})],i.prototype,"interpolation",void 0),n([l()],i.prototype,"minScale",void 0),n([E("service","minScale")],i.prototype,"readMinScale",null),n([l()],i.prototype,"maxScale",void 0),n([E("service","maxScale")],i.prototype,"readMaxScale",null),n([l({type:H})],i.prototype,"mosaicRule",null),n([E("mosaicRule",["mosaicRule","defaultMosaicMethod"])],i.prototype,"readMosaicRule",null),n([P("mosaicRule")],i.prototype,"writeMosaicRule",null),n([l()],i.prototype,"multidimensionalInfo",void 0),n([l({type:ti,json:{write:!0}})],i.prototype,"multidimensionalSubset",void 0),n([l({json:{type:Ee}})],i.prototype,"noData",void 0),n([P("noData")],i.prototype,"writeNoData",null),n([l({type:String,json:{type:Ie.jsonValues,read:Ie.read,write:Ie.write}})],i.prototype,"noDataInterpretation",void 0),n([l({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],i.prototype,"objectIdField",void 0),n([E("objectIdField")],i.prototype,"readObjectIdField",null),n([l({readOnly:!0})],i.prototype,"geometryType",void 0),n([l({})],i.prototype,"typeIdField",void 0),n([l({})],i.prototype,"types",void 0),n([l({readOnly:!0})],i.prototype,"parsedUrl",null),n([l({type:Function})],i.prototype,"pixelFilter",void 0),n([l()],i.prototype,"raster",void 0),n([l({readOnly:!0})],i.prototype,"sourceType",void 0),n([E("sourceType",["serviceSourceType","fields"])],i.prototype,"readSourceType",null),n([l()],i.prototype,"viewId",void 0),n([l({types:ii,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:ri,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&e.type!=="vector-field"&&e.type!=="flow"})}}}}})],i.prototype,"renderer",null),n([E("renderer")],i.prototype,"readRenderer",null),n([P("renderer")],i.prototype,"writeRenderer",null),n([l({clonable:!1})],i.prototype,"symbolizer",void 0),n([l(_t)],i.prototype,"opacity",void 0),n([l({readOnly:!0})],i.prototype,"rasterFields",null),n([l({constructOnly:!0})],i.prototype,"rasterFunctionInfos",void 0),n([l({type:b})],i.prototype,"renderingRule",null),n([l({type:b,json:{name:"renderingRule"}})],i.prototype,"rasterFunction",null),n([E("rasterFunction",["renderingRule","rasterFunctionInfos"])],i.prototype,"readRasterFunction",null),n([l({readOnly:!0})],i.prototype,"serviceDataType",void 0),n([l({readOnly:!0,type:he})],i.prototype,"spatialReference",void 0),n([E("spatialReference",["spatialReference","extent"])],i.prototype,"readSpatialReference",null),n([l({json:{type:Ue.jsonValues}})],i.prototype,"pixelType",void 0),n([E("pixelType")],i.prototype,"readPixelType",null),n([P("pixelType")],i.prototype,"writePixelType",null),n([l({constructOnly:!0,type:ft})],i.prototype,"serviceRasterInfo",void 0),n([l()],i.prototype,"sourceJSON",void 0),n([l(Ot)],i.prototype,"url",void 0),n([l({readOnly:!0})],i.prototype,"version",void 0),n([E("version",["currentVersion","fields","timeInfo"])],i.prototype,"readVersion",null),i=n([F("esri.layers.mixins.ArcGISImageService")],i),i};let L=class extends Et(Jt(Lt(qt(zt(fr(Gt(Ti(Ht(Ut(Qt(Yt))))))))))){constructor(...r){super(...r),this.isReference=null,this.operationalLayerType="ArcGISImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.type="imagery",this._debouncedSaveOperations=Bt(async(i,o,e)=>{const{save:t,saveAs:s}=await ei(()=>import("./imageryUtils-djrWgZtb.js"),__vite__mapDeps([0,1,2,3,4]));switch(i){case Ne.SAVE:return t(this,o);case Ne.SAVE_AS:return s(this,e,o)}})}normalizeCtorArgs(r,i){return typeof r=="string"?{url:r,...i}:r}load(r){const i=r!=null?r.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},r).catch(kt).then(()=>this._fetchService(i))),Promise.resolve(this)}get legendEnabled(){return!this._isPreviewLayer&&(this._get("legendEnabled")??!0)}set legendEnabled(r){this._set("legendEnabled",r)}get listMode(){return this._isPreviewLayer?"hide":this._get("listMode")}set listMode(r){this._set("listMode",r)}writeOperationalLayerType(r,i,o){var t;const e=((t=this.renderer)==null?void 0:t.type)==="vector-field";i[o]=e?"ArcGISImageServiceVectorLayer":"ArcGISImageServiceLayer"}get defaultPopupTemplate(){return this.createPopupTemplate()}get _isPreviewLayer(){var r;return!(!this.raster||!((r=this.url)!=null&&r.toLowerCase().includes("/rasterrendering/imageserver")))}createPopupTemplate(r){var p;const i=this.rasterFields,o=this.title,e=new Set;let t=!1,s=!1;this.capabilities&&(t=this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0,s=this.serviceDataType==="esriImageServiceDataTypeVector-UV"||this.serviceDataType==="esriImageServiceDataTypeVector-MagDir");const a=new Set;t&&a.add("raster.itempixelvalue");for(const m of i){const c=m.name.toLowerCase();a.has(c)||c.includes("raster.servicepixelvalue.")||e.add(m.name)}s&&e.add("raster.magnitude").add("raster.direction");const u=Wt({fields:i,title:o},{...r,visibleFieldNames:e});return u!=null&&u.fieldInfos&&((p=this.rasterInfo)!=null&&p.pixelType.startsWith("f"))&&u.fieldInfos.forEach(({format:m,fieldName:c})=>{m&&/^raster\.(item|service)pixelvalue/i.test(c)&&(m.places=2)}),u}queryFeatures(r,i){return this.queryRasters(r,i).then(o=>{if(o!=null&&o.features)for(const e of o.features)e.layer=e.sourceLayer=this;return o})}queryFeatureCount(r,i){return this.queryRasterCount(r,i)}redraw(){this.emit("redraw")}async save(r){return this._debouncedSaveOperations(Ne.SAVE,r)}async saveAs(r,i){return this._debouncedSaveOperations(Ne.SAVE_AS,i,r)}serviceSupportsSpatialReference(r){return Pi(this,r)}write(r,i){if(!this._isPreviewLayer)return super.write(r,i);if(i!=null&&i.messages){const o=`${i.origin}/${i.layerContainerType||"operational-layers"}`;i.messages.push(new C("layer:unsupported",`Imagery preview layer (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${o}'`,{layer:this}))}return null}};n([l(Zt)],L.prototype,"legendEnabled",null),n([l({type:["show","hide"]})],L.prototype,"listMode",null),n([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],L.prototype,"isReference",void 0),n([l({type:["ArcGISImageServiceLayer"],json:{origins:{"web-map":{type:["ArcGISImageServiceLayer","ArcGISImageServiceVectorLayer"],read:!1,write:{target:"layerType",ignoreOrigin:!0}}}}})],L.prototype,"operationalLayerType",void 0),n([P("web-map","operationalLayerType")],L.prototype,"writeOperationalLayerType",null),n([l(Kt)],L.prototype,"popupEnabled",void 0),n([l({type:Xt,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],L.prototype,"popupTemplate",void 0),n([l({readOnly:!0})],L.prototype,"defaultPopupTemplate",null),n([l({readOnly:!0,json:{read:!1}})],L.prototype,"type",void 0),n([l({readOnly:!0})],L.prototype,"_isPreviewLayer",null),L=n([F("esri.layers.ImageryLayer")],L);const Qr=L;export{Qr as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/imageryUtils-djrWgZtb.js","assets/utils-rBsg-VY8.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/jsonContext-cWV_-jAj.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/ImageryLayer-STU2SwYQ.js b/dist/assets/ImageryLayer-STU2SwYQ.js new file mode 100644 index 0000000..580ab96 --- /dev/null +++ b/dist/assets/ImageryLayer-STU2SwYQ.js @@ -0,0 +1,7 @@ +import{ah as B,oQ as Dt,uI as Tt,e as n,y as l,du as P,c as F,dr as z,d2 as he,uJ as le,uK as $e,uL as Me,h6 as dt,L as q,fV as ie,fX as ye,fW as ge,av as N,am as Le,em as Ke,dO as Ne,er as Ee,dp as Pt,nP as nt,g8 as Se,eo as ht,uA as we,R as ne,fZ as yt,ho as _t,dt as E,es as ce,iM as Nt,dR as Ot,eL as Ct,au as Vt,r as C,fY as G,en as lt,j as Ge,aL as He,my as At,B as jt,K as $t,uM as Mt,iE as Et,dF as Jt,ee as Lt,dJ as qt,dH as zt,dI as Gt,dG as Ht,ef as Ut,dK as Bt,dq as Qt,bs as kt,dL as Wt,io as Kt,jj as _e,dQ as Zt,iw as Xt,ix as Yt,aI as ei,de as ti}from"./index-pCX-0tJH.js";import{N as b,n as oe,q as Ie,r as H,c as ii,l as ri,d as si,s as Ue,b as ni,e as Be,u as ai,v as Qe,j as oi,m as li,k as ui,p as pi,w as ci,E as mi,V as di,K as hi,f as yi,t as gi}from"./ImageHistogramParameters-qqqpsay3.js";import{H as gt,o as ft,p as fi,J as Ri,K as vi,n as wi,b as Rt,u as ke,s as bi,L as Si,j as ut,P as xi,l as Fi}from"./dataUtils-_QoSHbCE.js";import{s as Ii,n as Di}from"./executeForIds-PXSIkRGk.js";import{o as Ti}from"./CustomParametersMixin-7nmugR3Y.js";import{e as Pi}from"./versionUtils-idhrDltC.js";import"./generateRendererUtils-3JJTfr19.js";const _i={StretchFunction:{arguments:{ComputeGamma:{isDataset:!1,isPublic:!1,name:"ComputeGamma",type:"RasterFunctionVariable",value:!1},DRA:{isDataset:!1,isPublic:!1,name:"DRA",type:"RasterFunctionVariable",value:!1},EstimateStatsHistogram:{isDataset:!1,isPublic:!1,name:"EstimateStatsHistogram",type:"RasterFunctionVariable",value:!1},Gamma:{displayName:"Gamma",isDataset:!1,isPublic:!1,name:"Gamma",type:"RasterFunctionVariable"},Histograms:{isDataset:!1,isPublic:!1,name:"Histograms",type:"RasterFunctionVariable"},Max:{isDataset:!1,isPublic:!1,name:"Max",type:"RasterFunctionVariable",value:255},MaxPercent:{isDataset:!1,isPublic:!1,name:"MaxPercent",type:"RasterFunctionVariable",value:.5},Min:{isDataset:!1,isPublic:!1,name:"Min",type:"RasterFunctionVariable",value:0},MinPercent:{isDataset:!1,isPublic:!1,name:"MinPercent",type:"RasterFunctionVariable",value:.25},NumberOfStandardDeviations:{isDataset:!1,isPublic:!1,name:"NumberOfStandardDeviation",type:"RasterFunctionVariable",value:2},Raster:{isDataset:!0,isPublic:!1,name:"Raster",type:"RasterFunctionVariable"},SigmoidStrengthLevel:{isDataset:!1,isPublic:!1,name:"SigmoidStrengthLevel",type:"RasterFunctionVariable",value:2},Statistics:{isDataset:!1,isPublic:!1,name:"Statistics",type:"RasterFunctionVariable"},StretchType:{isDataset:!1,isPublic:!1,name:"StretchType",type:"RasterFunctionVariable",value:0},type:"StretchFunctionArguments",UseGamma:{isDataset:!1,isPublic:!1,name:"UseGamma",type:"RasterFunctionVariable",value:!1}},description:"Enhances an image by adjusting the range of values displayed. This does not alter the underlying pixel values. If a pixel has a value outside of the specified range, it will appear as either the minimum or maximum value.",function:{description:"Enhances an image by adjusting the range of values displayed. This does not alter the underlying pixel values. If a pixel has a value outside of the specified range, it will appear as either the minimum or maximum value.",name:"Stretch",pixelType:"UNKNOWN",type:"StretchFunction"},functionType:0,name:"Stretch",thumbnail:""},RemapFunction:{name:"Remap",description:"Changes pixel values by assigning new values to ranges of pixel values or using an external table.",function:{type:"RemapFunction",pixelType:"UNKNOWN",name:"Remap",description:"Changes pixel values by assigning new values to ranges of pixel values or using an external table."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},UseTable:{name:"UseTable",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},InputRanges:{name:"InputRanges",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"Input Ranges"},OutputValues:{name:"OutputValues",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"Output Values"},NoDataRanges:{name:"NoDataRanges",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable",displayName:"NoData Ranges"},Table:{name:"Table",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},InputField:{name:"InputField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},OutputField:{name:"OutputField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},InputMaxField:{name:"InputMaxField",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},RemapTableType:{name:"RemapTableType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},AllowUnmatched:{name:"AllowUnmatched",isPublic:!1,isDataset:!1,value:!0,type:"RasterFunctionVariable"},type:"RemapFunctionArguments"},functionType:0,thumbnail:""},ColormapFunction:{name:"Colormap",description:"Changes pixel values to display the raster data as either a grayscale or a red, green, blue (RGB) image, based on a colormap or a color ramp.",function:{type:"ColormapFunction",pixelType:"UNKNOWN",name:"Colormap",description:"Changes pixel values to display the raster data as either a grayscale or a red, green, blue (RGB) image, based on a colormap or a color ramp."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ColorSchemeType:{name:"ColorSchemeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},Colormap:{name:"Colormap",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},ColormapName:{name:"ColormapName",isPublic:!1,isDataset:!1,value:"Gray",type:"RasterFunctionVariable"},ColorRamp:{name:"ColorRamp",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},type:"ColormapFunctionArguments"},functionType:0,thumbnail:""},ShadedReliefFunction:{name:"Shaded Relief",description:"Creates a multiband, color coded, 3D representation of the surface, with the sun's relative position taken into account for shading the image.",function:{type:"ShadedReliefFunction",pixelType:"UNKNOWN",name:"Shaded Relief",description:"Creates a multiband, color coded, 3D representation of the surface, with the sun's relative position taken into account for shading the image."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ColorSchemeType:{name:"ColorSchemeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ColorRamp:{name:"ColorRamp",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},HillshadeType:{name:"HillshadeType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},Colormap:{name:"Colormap",isPublic:!1,isDataset:!1,type:"RasterFunctionVariable"},Azimuth:{name:"Azimuth",isPublic:!1,isDataset:!1,value:315,type:"RasterFunctionVariable"},Altitude:{name:"Altitude",isPublic:!1,isDataset:!1,value:45,type:"RasterFunctionVariable"},SlopeType:{name:"SlopeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ZFactor:{name:"ZFactor",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},PSPower:{name:"PSPower",isPublic:!1,isDataset:!1,value:.664,type:"RasterFunctionVariable"},PSZFactor:{name:"PSZFactor",isPublic:!1,isDataset:!1,value:.024,type:"RasterFunctionVariable"},RemoveEdgeEffect:{name:"RemoveEdgeEffect",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},type:"ShadedReliefFunctionArguments"},functionType:0,thumbnail:""},HillshadeFunction:{name:"Hillshade",description:"Creates a 3D representation of the surface, with the sun's relative position taken into account for shading the image",function:{type:"HillshadeFunction",pixelType:"UNKNOWN",name:"Hillshade",description:"Creates a 3D representation of the surface, with the sun's relative position taken into account for shading the image"},arguments:{DEM:{name:"DEM",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},HillshadeType:{name:"HillshadeType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},Azimuth:{name:"Azimuth",isPublic:!1,isDataset:!1,value:315,type:"RasterFunctionVariable"},Altitude:{name:"Altitude",isPublic:!1,isDataset:!1,value:45,type:"RasterFunctionVariable"},SlopeType:{name:"SlopeType",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},ZFactor:{name:"ZFactor",isPublic:!1,isDataset:!1,value:1,type:"RasterFunctionVariable"},PSPower:{name:"PSPower",isPublic:!1,isDataset:!1,value:.664,type:"RasterFunctionVariable"},PSZFactor:{name:"PSZFactor",isPublic:!1,isDataset:!1,value:.024,type:"RasterFunctionVariable"},RemoveEdgeEffect:{name:"RemoveEdgeEffect",isPublic:!1,isDataset:!1,value:!1,type:"RasterFunctionVariable"},type:"HillshadeFunctionArguments"},functionType:0,thumbnail:""},ResampleFunction:{name:"Resample",description:"Changes the cell size of a raster.",function:{type:"ResampleFunction",pixelType:"UNKNOWN",name:"Resample",description:"Changes the cell size of a raster."},arguments:{Raster:{name:"Raster",isPublic:!1,isDataset:!0,type:"RasterFunctionVariable"},ResamplingType:{name:"ResamplingType",isPublic:!1,isDataset:!1,value:0,type:"RasterFunctionVariable"},InputCellSize:{name:"InputCellsize",isPublic:!1,isDataset:!1,value:{x:0,y:0},type:"RasterFunctionVariable"},OutputCellSize:{name:"OutputCellsize",isPublic:!1,isDataset:!1,value:{x:0,y:0},type:"RasterFunctionVariable"},type:"ResampleFunctionArguments"},functionType:0,thumbnail:""}},Ni=new Set(["u1","u2","u4","u8","s8","u16","s16"]),Oi={simple_scalar:"Simple Scalar",wind_barb:"Wind Barb",single_arrow:"Single Arrow",beaufort_kn:"Beaufort Wind (Knots)",beaufort_m:"Beaufort Wind (MetersPerSecond)",ocean_current_m:"Ocean Current (MetersPerSecond)",ocean_current_kn:"Ocean Current (Knots)"},Ci=new Set(["raster-stretch","unique-value","class-breaks","raster-shaded-relief","vector-field","raster-colormap"]);function vt(r){return Ci.has(r.type)}function We(r,i){var e;if(!r||!i)return B(r||i);const o=B(r);if(o.functionDefinition&&i.rasterFunctionDefinition){const t=i.rasterFunctionDefinition;(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=void 0),wt(o.functionDefinition.arguments,i),o.rasterFunctionDefinition=o.functionDefinition.toJSON()}else((e=i.functionName)==null?void 0:e.toLowerCase())!=="none"&&(bt(o.functionArguments).Raster=i);return o}function wt(r,i){for(const o in r)o.toLowerCase()==="raster"&&(r[o].type==="RasterFunctionVariable"?(r[o]=i.rasterFunctionDefinition,r[o].type="RasterFunctionTemplate"):r[o].type==="RasterFunctionTemplate"&&wt(r[o].arguments,i))}function Z(r){const i=B(_i[r.functionName+"Function"]),o=r.functionArguments;for(const e in o)e.toLowerCase()==="raster"?(i.arguments[e]=Z(o[e]),i.arguments[e].type="RasterFunctionTemplate"):e.toLowerCase()==="colormap"?(i.arguments[e].value=qi(o[e]),i.arguments.ColorSchemeType.value=0):i.arguments[e].value=o[e];return i}function Vi(r,i){switch(i=i||{},r.type){case"raster-stretch":return $i(r,i);case"class-breaks":return Mi(r,i);case"unique-value":return Ei(r,i);case"raster-colormap":return Ji(r,i);case"vector-field":return Ai(r,i);case"raster-shaded-relief":return ji(r,i);case"flow":throw new Error("Unsupported rendering rule.")}}function bt(r){const i=(r==null?void 0:r.Raster)??(r==null?void 0:r.raster);return i&&i.declaredClass==="esri.layers.support.RasterFunction"?bt(i.functionArguments):r}const xe={none:0,standardDeviation:3,histogramEqualization:4,minMax:5,percentClip:6,sigmoid:9};function Ai(r,i){const o=new b;o.functionName="VectorFieldRenderer";const{dataType:e,bandNames:t}=i,s=e==="vector-uv";let a,u;if(t&&t.length===2){const R=t.map(f=>f.toLowerCase());a=R.indexOf("magnitude"),u=R.indexOf("direction")}a!==-1&&a!==null||(a=0,u=1);const p=r.rotationType==="arithmetic"?1:2,m=r.flowRepresentation==="flow-from"?0:1,c=r.visualVariables?r.visualVariables.find(R=>R.field==="Magnitude"):new Dt,d={magnitudeBandID:a,directionBandID:u,isUVComponents:s,referenceSystem:p,massFlowAngleRepresentation:m,symbolTileSize:50,symbolTileSizeUnits:100,calculationMethod:"Vector Average",symbologyName:Oi[r.style.toLowerCase().replace("-","_")],minimumMagnitude:c.minDataValue,maximumMagnitude:c.maxDataValue,minimumSymbolSize:c.minSize,maximumSymbolSize:c.maxSize};o.functionArguments=d;const y=Z(o);return i.convertToRFT?b.fromJSON({rasterFunctionDefinition:y}):o}function ji(r,i){const o=i.convertToRFT;if(i.dataType!=="elevation"&&(i.dataType!=="generic"||i.bandCount!==1||i.pixelType!=="s16"&&i.pixelType!=="s32"&&i.pixelType!=="f32"&&i.pixelType!=="f64"))return new b;const e=new b;e.functionName="Hillshade";const t=r.hillshadeType==="traditional"?0:1,s=r.scalingType==="none"?1:3,a={HillshadeType:t,SlopeType:s,ZFactor:r.zFactor};return t===0&&(a.Azimuth=r.azimuth,a.Altitude=r.altitude),s===3&&(a.PSPower=r.pixelSizePower,a.PSZFactor=r.pixelSizeFactor),e.functionArguments=a,e.variableName="Raster",r.colorRamp&&(e.functionName="ShadedRelief",o?a.ColorRamp=gt(r.colorRamp):a.Colormap=ft(r.colorRamp)),o?new b({rasterFunctionDefinition:Z(e)}):e}function $i(r,i){var u;const o=i.convertToRFT,e=new b;e.functionName="Stretch";const t=xe[fi.toJSON(r.stretchType)],s="u8",a={StretchType:t,Statistics:Li(r.statistics??[]),DRA:r.dynamicRangeAdjustment,UseGamma:r.useGamma,Gamma:r.gamma,ComputeGamma:r.computeGamma};if(r.outputMin!=null&&(a.Min=r.outputMin),r.outputMax!=null&&(a.Max=r.outputMax),t===xe.standardDeviation?(a.NumberOfStandardDeviations=r.numberOfStandardDeviations,e.outputPixelType=s):t===xe.percentClip?(a.MinPercent=r.minPercent,a.MaxPercent=r.maxPercent,e.outputPixelType=s):t===xe.minMax?e.outputPixelType=s:t===xe.sigmoid&&(a.SigmoidStrengthLevel=r.sigmoidStrengthLevel),e.functionArguments=a,e.variableName="Raster",r.colorRamp){const p=r.colorRamp,m=new b;if(o)m.functionArguments={ColorRamp:gt(p)};else{const c=Ri(p,!0);if(c)m.functionArguments={colorRampName:c};else if(!i.convertColorRampToColormap||p.type!=="algorithmic"&&p.type!=="multipart"){const d=r.colorRamp.toJSON();d.type==="algorithmic"?d.algorithm=d.algorithm||"esriCIELabAlgorithm":d.type==="multipart"&&((u=d.colorRamps)!=null&&u.length)&&d.colorRamps.forEach(y=>y.algorithm=y.algorithm||"esriCIELabAlgorithm"),m.functionArguments={colorRamp:d}}else m.functionArguments={Colormap:ft(p)}}return m.variableName="Raster",m.functionName="Colormap",m.functionArguments.Raster=e,o?new b({rasterFunctionDefinition:Z(m)}):m}return o?new b({rasterFunctionDefinition:Z(e)}):e}function Mi(r,i){const o=[],e=[],t=[],s=[],{pixelType:u,rasterAttributeTable:p}=i,m=p==null?null:p.features,c=St(p);if(c&&m&&Array.isArray(m)&&r.classBreakInfos){r.classBreakInfos.forEach((h,g)=>{var $;const w=($=h.symbol)==null?void 0:$.color;let T;w!=null&&w.a&&h.minValue!=null&&h.maxValue!=null&&m.forEach(V=>{h.minValue!=null&&h.maxValue!=null&&(T=V.attributes[r.field],(T>=h.minValue&&T=h.minValue)&&s.push([V.attributes[c],w.r,w.g,w.b]))})});const f=u?Je(s,u):s,v=new b;return v.functionName="Colormap",v.functionArguments={},v.functionArguments.Colormap=f,v.variableName="Raster",i.convertToRFT?new b({rasterFunctionDefinition:Z(v)}):v}r.classBreakInfos.forEach((f,v)=>{if(f.minValue==null||f.maxValue==null)return;const h=f.symbol&&f.symbol.color;h!=null&&h.a?(v===0?o.push(f.minValue,f.maxValue+1e-4):o.push(f.minValue+1e-4,f.maxValue+1e-4),e.push(v),s.push([v,h.r,h.g,h.b])):t.push(f.minValue,f.maxValue)});const d=u?Je(s,u):s,y=new b;y.functionName="Remap",y.functionArguments={InputRanges:o,OutputValues:e,NoDataRanges:t},y.variableName="Raster";const R=new b;return R.functionName="Colormap",R.functionArguments={Colormap:d,Raster:y},i.convertToRFT?new b({rasterFunctionDefinition:Z(R)}):R}function Je(r,i){const o=Ni.has(i)?Tt(i):null;return o&&r.push([Math.floor(o[0]-1),0,0,0],[Math.ceil(o[1]+1),0,0,0]),r}function St(r){if(r==null)return;const{fields:i}=r,o=i==null?void 0:i.find(e=>(e==null?void 0:e.name)&&e.name.toLowerCase()==="value");return o==null?void 0:o.name}function Ei(r,i){var d,y,R;const o=[],{pixelType:e,rasterAttributeTable:t}=i,s=t==null?null:t.features,a=St(t),u=(y=(d=r.defaultSymbol)==null?void 0:d.color)==null?void 0:y.toRgb(),p=r.uniqueValueInfos;if(p)if(s){if(a){const f=new Map;p.forEach(h=>{var T;const g=h.value,w=(T=h.symbol)==null?void 0:T.color;g!=null&&(w!=null&&w.a)&&f.set(String(g),w.toRgb())});const v=r.field;s.forEach(({attributes:h})=>{const g=String(h[v]),w=h[a],T=f.get(g);T?o.push([w,...T]):u&&o.push([w,...u])})}}else for(let f=0;f{const e=o;if(Array.isArray(e))i.push(e);else{if(e.min==null||e.max==null)return;const t=[e.min,e.max,e.avg||0,e.stddev||0];i.push(t)}}),i}function qi(r){const i=[],o=[];return r.forEach(e=>{i.push(e[0]),o.push(vi([...e.slice(1),255]))}),{type:"RasterColormap",values:i,colors:o}}let _=class extends z{constructor(){super(...arguments),this.layer=null,this.compression=void 0,this.pixelType=void 0,this.lercVersion=2}get adjustAspectRatio(){return this.layer.adjustAspectRatio}writeAdjustAspectRatio(i,o,e){this.layer.version<10.3||(o[e]=i)}get bandIds(){return this.layer.bandIds}get compressionQuality(){return this.layer.compressionQuality}writeCompressionQuality(i,o,e){this.format&&this.format.toLowerCase().includes("jpg")&&i!=null&&(o[e]=i)}get compressionTolerance(){return this.layer.compressionTolerance}writeCompressionTolerance(i,o,e){this.format==="lerc"&&i!=null&&(o[e]=i)}get format(){var i;return((i=this.layer.renderer)==null?void 0:i.type)==="vector-field"?"lerc":this.layer.format}get interpolation(){return this.layer.interpolation}get noData(){return this.layer.noData}get noDataInterpretation(){return this.layer.noDataInterpretation}writeLercVersion(i,o,e){this.format==="lerc"&&this.layer.version>=10.5&&(o[e]=i)}get version(){const i=this.layer;return i.commitProperty("bandIds"),i.commitProperty("format"),i.commitProperty("compressionQuality"),i.commitProperty("compressionTolerance"),i.commitProperty("interpolation"),i.commitProperty("noData"),i.commitProperty("noDataInterpretation"),i.commitProperty("mosaicRule"),i.commitProperty("rasterFunction"),i.commitProperty("adjustAspectRatio"),i.commitProperty("pixelFilter"),i.commitProperty("definitionExpression"),i.commitProperty("multidimensionalSubset"),(this._get("version")||0)+1}set version(i){this._set("version",i)}get mosaicRule(){const i=this.layer;let o=i.mosaicRule;const e=i.definitionExpression;return o?e&&e!==o.where&&(o=o.clone(),o.where=e):e&&(o=new H({where:e})),o}get rasterFunction(){var a,u;const i=this.layer;let{rasterFunction:o}=i;const e=i.pixelFilter,t=!i.format||i.format.includes("jpg")||i.format.includes("png");o=this._addResampleRasterFunction(o);const s=(a=i.multidimensionalSubset)==null?void 0:a.areaOfInterest;return s&&(o=this._addClipFunction(o,s)),t&&!e&&((u=i.renderer)==null?void 0:u.type)!=="vector-field"&&(o=this.combineRendererWithRenderingRule(o)),o}combineRendererWithRenderingRule(i){const o=this.layer,{rasterInfo:e,renderer:t}=o;return i=i||o.rasterFunction,!t||!vt(t)?i:We(Vi(t,{rasterAttributeTable:e.attributeTable,pixelType:e.pixelType,dataType:e.dataType,bandNames:e.bandInfos.map(({name:s})=>s),convertColorRampToColormap:o.version<10.6,convertToRFT:!!(i!=null&&i.rasterFunctionDefinition),bandCount:e.bandCount}),i)}_addResampleRasterFunction(i){var s;if(((s=this.layer.renderer)==null?void 0:s.type)!=="vector-field"||(i==null?void 0:i.functionName)==="Resample")return i;const o=this.layer.serviceDataType==="esriImageServiceDataTypeVector-UV"?7:10,e=this.layer.serviceRasterInfo.pixelSize;let t=new b({functionName:"Resample",functionArguments:{ResamplingType:o,InputCellSize:e}});return t=i!=null&&i.rasterFunctionDefinition?new b({rasterFunctionDefinition:Z(t)}):t,We(t,i)}_addClipFunction(i,o){const e=new b({functionName:"Clip",functionArguments:{ClippingGeometry:o.toJSON(),ClippingType:1}});return We(e,i)}};n([l()],_.prototype,"layer",void 0),n([l({json:{write:!0}})],_.prototype,"adjustAspectRatio",null),n([P("adjustAspectRatio")],_.prototype,"writeAdjustAspectRatio",null),n([l({json:{write:!0}})],_.prototype,"bandIds",null),n([l({json:{write:!0}})],_.prototype,"compression",void 0),n([l({json:{write:!0}})],_.prototype,"compressionQuality",null),n([P("compressionQuality")],_.prototype,"writeCompressionQuality",null),n([l({json:{write:!0}})],_.prototype,"compressionTolerance",null),n([P("compressionTolerance")],_.prototype,"writeCompressionTolerance",null),n([l({json:{write:!0}})],_.prototype,"format",null),n([l({type:String,json:{read:{reader:oe.read},write:{writer:oe.write}}})],_.prototype,"interpolation",null),n([l({json:{write:!0}})],_.prototype,"noData",null),n([l({type:String,json:{read:{reader:Ie.read},write:{writer:Ie.write}}})],_.prototype,"noDataInterpretation",null),n([l({json:{write:!0}})],_.prototype,"pixelType",void 0),n([l({json:{write:!0}})],_.prototype,"lercVersion",void 0),n([P("lercVersion")],_.prototype,"writeLercVersion",null),n([l({type:Number})],_.prototype,"version",null),n([l({json:{write:!0}})],_.prototype,"mosaicRule",null),n([l({json:{write:!0,name:"renderingRule"}})],_.prototype,"rasterFunction",null),_=n([F("esri.layers.mixins.ExportImageServiceParameters")],_);let fe=class extends z{constructor(i){super(i),this.north=null,this.up=null,this.spatialReference=null}};n([l({type:Number,json:{write:!0}})],fe.prototype,"north",void 0),n([l({type:Number,json:{write:!0}})],fe.prototype,"up",void 0),n([l({type:he,json:{write:!0}})],fe.prototype,"spatialReference",void 0),fe=n([F("esri.rest.support.ImageAngleResult")],fe);const zi=fe;let se=class extends z{constructor(){super(...arguments),this.value=null,this.displayValue=null,this.uncertainty=null}};n([l({type:Number,json:{read:!0,write:!0}})],se.prototype,"value",void 0),n([l({type:String,json:{read:!0,write:!0}})],se.prototype,"displayValue",void 0),n([l({type:Number,json:{read:!0,write:!0}})],se.prototype,"uncertainty",void 0),se=n([F("esri.rest.support.ImageMeasureResultValue")],se);let be=class extends se{constructor(){super(...arguments),this.unit=null}};n([l({type:String,json:{read:le.read,write:le.write}})],be.prototype,"unit",void 0),be=n([F("esri.rest.support.ImageMeasureResultLengthValue")],be);let Oe=class extends se{constructor(){super(...arguments),this.unit=null}};n([l({type:String,json:{read:$e.read,write:$e.write}})],Oe.prototype,"unit",void 0),Oe=n([F("esri.rest.support.ImageMeasureResultAreaValue")],Oe);let De=class extends se{constructor(){super(...arguments),this.unit=null}};n([l({type:String,json:{read:Me.read,write:Me.write}})],De.prototype,"unit",void 0),De=n([F("esri.rest.support.ImageMeasureResultAngleValue")],De);let ae=class extends z{constructor(){super(...arguments),this.name=null,this.sensorName=null}};n([l({type:String,json:{read:!0,write:!0}})],ae.prototype,"name",void 0),n([l({type:String,json:{read:!0,write:!0}})],ae.prototype,"sensorName",void 0),ae=n([F("esri.rest.support.BaseImageMeasureResult")],ae);let Fe=class extends ae{constructor(){super(...arguments),this.area=null,this.perimeter=null}};n([l({type:Oe,json:{read:!0,write:!0}})],Fe.prototype,"area",void 0),n([l({type:be,json:{read:!0,write:!0}})],Fe.prototype,"perimeter",void 0),Fe=n([F("esri.rest.support.ImageAreaResult")],Fe);const Gi=Fe;let Re=class extends ae{constructor(){super(...arguments),this.distance=null,this.azimuthAngle=null,this.elevationAngle=null}};n([l({type:be,json:{read:!0,write:!0}})],Re.prototype,"distance",void 0),n([l({type:De,json:{read:!0,write:!0}})],Re.prototype,"azimuthAngle",void 0),n([l({type:De,json:{read:!0,write:!0}})],Re.prototype,"elevationAngle",void 0),Re=n([F("esri.rest.support.ImageDistanceResult")],Re);const Hi=Re;let Ce=class extends ae{constructor(){super(...arguments),this.height=null}};n([l({type:be,json:{read:!0,write:!0}})],Ce.prototype,"height",void 0),Ce=n([F("esri.rest.support.ImageHeightResult")],Ce);const Ui=Ce;let k=class extends z{constructor(){super(...arguments),this.catalogItemVisibilities=null,this.catalogItems=null,this.location=null,this.name=null,this.objectId=null,this.processedValues=null,this.properties=null,this.value=null}};n([l({json:{write:!0}})],k.prototype,"catalogItemVisibilities",void 0),n([l({type:dt,json:{write:!0}})],k.prototype,"catalogItems",void 0),n([l({type:q,json:{write:!0}})],k.prototype,"location",void 0),n([l({json:{write:!0}})],k.prototype,"name",void 0),n([l({json:{write:!0}})],k.prototype,"objectId",void 0),n([l({json:{write:!0}})],k.prototype,"processedValues",void 0),n([l({json:{write:!0}})],k.prototype,"properties",void 0),n([l({json:{write:!0}})],k.prototype,"value",void 0),k=n([F("esri.rest.support.ImageIdentifyResult")],k);const Bi=k;let Ve=class extends z{constructor(){super(...arguments),this.geometries=null}};n([l({json:{write:!0}})],Ve.prototype,"geometries",void 0),Ve=n([F("esri.rest.support.ImagePixelLocationResult")],Ve);const Qi=Ve;let Ae=class extends ae{constructor(){super(...arguments),this.point=null}};n([l({type:q,json:{name:"point.value",read:!0,write:!0}})],Ae.prototype,"point",void 0),Ae=n([F("esri.rest.support.ImagePointResult")],Ae);const ki=Ae;let Y=class extends z{constructor(){super(...arguments),this.attributes=null,this.location=null,this.locationId=null,this.rasterId=null,this.resolution=null,this.pixelValue=null}};n([l({json:{write:!0}})],Y.prototype,"attributes",void 0),n([l({type:q,json:{write:!0}})],Y.prototype,"location",void 0),n([l({json:{write:!0}})],Y.prototype,"locationId",void 0),n([l({json:{write:!0}})],Y.prototype,"rasterId",void 0),n([l({json:{write:!0}})],Y.prototype,"resolution",void 0),n([l({json:{write:!0}})],Y.prototype,"pixelValue",void 0),Y=n([F("esri.rest.support.ImageSample")],Y);const Wi=Y;let je=class extends z{constructor(){super(...arguments),this.samples=null}};n([l({type:[Wi],json:{write:!0}})],je.prototype,"samples",void 0),je=n([F("esri.rest.support.ImageSampleResult")],je);const Ki=je;function xt(r){const i=r==null?void 0:r.time;if(i&&(i.start!=null||i.end!=null)){const o=[];i.start!=null&&o.push(i.start),i.end==null||o.includes(i.end)||o.push(i.end),r.time=o.join(",")}}async function Ft(r,i,o){const e=ie(r),t=i.geometry?[i.geometry]:[],s=await Le(t),a=i.toJSON();xt(a);const u=s==null?void 0:s[0];u!=null&&(a.geometry=u.toJSON());const p=ye({...e.query,f:"json",...a});return ge(p,o)}async function Zi(r,i,o){var p,m,c;const e=i.toJSON();e.angleName!=null&&(e.angleName=e.angleName.join(",")),(m=(p=i==null?void 0:i.point)==null?void 0:p.spatialReference)!=null&&m.imageCoordinateSystem&&(e.point.spatialReference=ze(i.point.spatialReference)),(c=i==null?void 0:i.spatialReference)!=null&&c.imageCoordinateSystem&&(e.spatialReference=It(i.spatialReference));const t=ie(r),s=ye({...t.query,f:"json",...e}),a=ge(s,o),{data:u}=await N(`${t.path}/computeAngles`,a);return u.spatialReference=u.spatialReference?u.spatialReference.geodataXform!=null?new he({wkid:0,imageCoordinateSystem:u.spatialReference}):he.fromJSON(u.spatialReference):null,u.north==="NaN"&&(u.north=null),u.up==="NaN"&&(u.up=null),new zi(u)}async function Xi(r,i,o){var m;const e=i.toJSON(),{geometries:t}=i;if(t)for(let c=0;c{u.avg=u.mean,u.stddev=u.standardDeviation}),{statistics:a,histograms:s.histograms}}async function er(r,i,o){const e=await Ft(r,i,o),t=ie(r),{data:s}=await N(`${t.path}/computeHistograms`,e);return{histograms:s.histograms}}async function tr(r,i,o){var d,y;const e=i.toJSON();xt(e),(d=e.outFields)!=null&&d.length&&(e.outFields=e.outFields.join(","));const t=await Le(i.geometry),s=t==null?void 0:t[0];s!=null&&(e.geometry=s.toJSON());const a=ie(r),u=ye({...a.query,f:"json",...e}),p=ge(u,o),{data:m}=await N(`${a.path}/getSamples`,p),c=(y=m==null?void 0:m.samples)==null?void 0:y.map(R=>{const f=R.value==="NaN"||R.value===""?null:R.value.split(" ").map(v=>Number(v));return{...R,pixelValue:f}});return Ki.fromJSON({samples:c})}async function pt(r,i,o){const e=ie(r),t=i.geometry?[i.geometry]:[];return Le(t).then(s=>{const a=i.toJSON(),u=s==null?void 0:s[0];u!=null&&(a.geometry=JSON.stringify(u.toJSON()));const p=ye({...e.query,f:"json",...a}),m=ge(p,o);return N(e.path+"/identify",m)}).then(s=>Bi.fromJSON(s.data))}async function ir(r,i,o){const e=await qe(r,i,[i.fromGeometry,i.toGeometry],o);return Ui.fromJSON(e)}async function rr(r,i,o){const e=await qe(r,i,[i.geometry],o);return Gi.fromJSON(e)}async function sr(r,i,o){const e=await qe(r,i,[i.geometry],o);return ki.fromJSON(e)}async function nr(r,i,o){const e=await qe(r,i,[i.fromGeometry,i.toGeometry],o);return Hi.fromJSON(e)}async function qe(r,i,o,e){const t=ie(r),s=await Le(o),a=i.toJSON();s[0]!=null&&(a.fromGeometry=JSON.stringify(ct(s[0]))),s[1]!=null&&(a.toGeometry=JSON.stringify(ct(s[1])));const u=ye({...t.query,f:"json",...a}),p=ge(u,e),{data:m}=await N(t.path+"/measure",p);return m}function ct(r){var o;const i=r.toJSON();return(o=r.spatialReference)!=null&&o.imageCoordinateSystem&&(i.spatialReference=ze(r.spatialReference)),i}function ze(r){const{imageCoordinateSystem:i}=r;if(i){const{id:o,referenceServiceName:e}=i;return o!=null?e?{icsid:o,icsns:e}:{icsid:o}:{ics:i}}return r.toJSON()}function It(r,i){if(!r.imageCoordinateSystem)return Ke(r);const o=ze(r),{icsid:e,icsns:t}=o;return e==null||t!=null&&!(i!=null&&i.toLowerCase().includes("/"+t.toLowerCase()+"/"))?JSON.stringify(o):`0:${e}`}async function ar(r,i,o){var $,V;const e=ie(r),t=ye({...e==null?void 0:e.query,f:"json"}),s=ge(t,o),a=`${e==null?void 0:e.path}/${i}/info`,u=N(`${a}`,s),p=N(`${a}/keyProperties`,s),m=await Promise.allSettled([u,p]),c=m[0].status==="fulfilled"?m[0].value.data:null,d=m[1].status==="fulfilled"?m[1].value.data:null;let y=null;($=c.statistics)!=null&&$.length&&(y=c.statistics.map(x=>({min:x[0],max:x[1],avg:x[2],stddev:x[3]})));const R=Ne.fromJSON(c.extent),f=Math.ceil(R.width/c.pixelSizeX-.1),v=Math.ceil(R.height/c.pixelSizeY-.1),h=R.spatialReference,g=new q({x:c.pixelSizeX,y:c.pixelSizeY,spatialReference:h}),w=(V=c.histograms)!=null&&V.length?c.histograms:null,T=new wi({origin:c.origin,blockWidth:c.blockWidth,blockHeight:c.blockHeight,firstPyramidLevel:c.firstPyramidLevel,maximumPyramidLevel:c.maxPyramidLevel});return new Rt({width:f,height:v,bandCount:c.bandCount,extent:R,spatialReference:h,pixelSize:g,pixelType:c.pixelType.toLowerCase(),statistics:y,histograms:w,keyProperties:d,storageInfo:T})}var Ze;let me=Ze=class extends z{constructor(r){super(r),this.angleNames=null,this.point=null,this.spatialReference=null,this.rasterId=null}clone(){return new Ze(B({angleNames:this.angleNames,point:this.point,spatialReference:this.spatialReference,rasterId:this.rasterId}))}};n([l({type:[String],json:{name:"angleName",write:!0}})],me.prototype,"angleNames",void 0),n([l({type:q,json:{write:!0}})],me.prototype,"point",void 0),n([l({type:he,json:{write:!0}})],me.prototype,"spatialReference",void 0),n([l({type:Ee,json:{write:!0}})],me.prototype,"rasterId",void 0),me=Ze=n([F("esri.rest.support.ImageAngleParameters")],me);const or=me,U=new Pt({esriMensurationPoint:"point",esriMensurationCentroid:"centroid",esriMensurationDistanceAndAngle:"distance-and-angle",esriMensurationAreaAndPerimeter:"area-and-perimeter",esriMensurationHeightFromBaseAndTop:"base-and-top",esriMensurationHeightFromBaseAndTopShadow:"base-and-top-shadow",esriMensurationHeightFromTopAndTopShadow:"top-and-top-shadow",esriMensurationPoint3D:"point-3D",esriMensurationCentroid3D:"centroid-3D",esriMensurationDistanceAndAngle3D:"distance-and-angle-3D",esriMensurationAreaAndPerimeter3D:"area-and-perimeter-3D"});let W=class extends z{constructor(){super(...arguments),this.type=null,this.measureOperation=null,this.mosaicRule=null,this.pixelSize=null,this.raster=void 0}};n([l()],W.prototype,"type",void 0),n([l({type:U.apiValues,json:{read:U.read,write:U.write}})],W.prototype,"measureOperation",void 0),n([l({type:H,json:{write:!0}})],W.prototype,"mosaicRule",void 0),n([l({type:q,json:{write:!0}})],W.prototype,"pixelSize",void 0),n([l({json:{write:!0}})],W.prototype,"raster",void 0),W=n([F("esri.rest.support.BaseImageMeasureParameters")],W);var Xe;let ee=Xe=class extends W{constructor(){super(...arguments),this.type="area-perimeter",this.geometry=null,this.is3D=!1,this.linearUnit="meters",this.areaUnit="square-meters"}writeGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=r.toJSON())}get measureOperation(){return this.is3D?"area-and-perimeter-3D":"area-and-perimeter"}clone(){return new Xe(B({geometry:this.geometry,is3D:this.is3D,linearUnit:this.linearUnit,areaUnit:this.areaUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};n([l({types:nt,json:{name:"fromGeometry",read:!0,write:!0}})],ee.prototype,"geometry",void 0),n([P("geometry")],ee.prototype,"writeGeometry",null),n([l({type:U.apiValues,json:{write:U.write}})],ee.prototype,"measureOperation",null),n([l({json:{read:!0}})],ee.prototype,"is3D",void 0),n([l({type:String,json:{read:le.read,write:le.write}})],ee.prototype,"linearUnit",void 0),n([l({type:String,json:{read:$e.read,write:$e.write}})],ee.prototype,"areaUnit",void 0),ee=Xe=n([F("esri.rest.support.ImageAreaParameters")],ee);const lr=ee;var Ye;let K=Ye=class extends W{constructor(){super(...arguments),this.type="distance-angle",this.fromGeometry=null,this.toGeometry=null,this.is3D=!1,this.linearUnit="meters",this.angularUnit="degrees"}writeFromGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=r.toJSON())}get measureOperation(){return this.is3D?"distance-and-angle-3D":"distance-and-angle"}clone(){return new Ye(B({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,is3D:this.is3D,linearUnit:this.linearUnit,angularUnit:this.angularUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};n([l({type:q,json:{read:!0,write:!0}})],K.prototype,"fromGeometry",void 0),n([P("fromGeometry")],K.prototype,"writeFromGeometry",null),n([l({type:q,json:{read:!0,write:!0}})],K.prototype,"toGeometry",void 0),n([l({type:U.apiValues,json:{write:U.write}})],K.prototype,"measureOperation",null),n([l({json:{read:!0}})],K.prototype,"is3D",void 0),n([l({type:String,json:{read:le.read,write:le.write}})],K.prototype,"linearUnit",void 0),n([l({type:String,json:{read:Me.read,write:Me.write}})],K.prototype,"angularUnit",void 0),K=Ye=n([F("esri.rest.support.ImageDistanceParameters")],K);const ur=K;var et;let te=et=class extends W{constructor(){super(...arguments),this.type="height",this.fromGeometry=null,this.toGeometry=null,this.operationType="base-and-top",this.linearUnit="meters"}writeFromGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=r.toJSON())}get measureOperation(){return this.operationType}clone(){return new et(B({fromGeometry:this.fromGeometry,toGeometry:this.toGeometry,operationType:this.operationType,linearUnit:this.linearUnit,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};n([l({type:q,json:{read:!0}})],te.prototype,"fromGeometry",void 0),n([P("fromGeometry")],te.prototype,"writeFromGeometry",null),n([l({type:q,json:{read:!0,write:!0}})],te.prototype,"toGeometry",void 0),n([l({type:U.apiValues,json:{write:U.write}})],te.prototype,"measureOperation",null),n([l({json:{read:!0}})],te.prototype,"operationType",void 0),n([l({type:String,json:{read:le.read,write:le.write}})],te.prototype,"linearUnit",void 0),te=et=n([F("esri.rest.support.ImageHeightParameters")],te);const pr=te;var tt;let D=tt=class extends z{constructor(){super(...arguments),this.geometry=null,this.rasterFunctions=null,this.pixelSize=null,this.returnGeometry=!0,this.returnCatalogItems=!0,this.returnPixelValues=!0,this.maxItemCount=null,this.timeExtent=null,this.raster=void 0,this.viewId=void 0,this.processAsMultidimensional=!1}writeGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=JSON.stringify(r.toJSON()))}set mosaicRule(r){let i=r;i!=null&&i.mosaicMethod&&(i=H.fromJSON({...i.toJSON(),mosaicMethod:i.mosaicMethod,mosaicOperation:i.mosaicOperation})),this._set("mosaicRule",i)}writeMosaicRule(r,i,o){r!=null&&(i[o]=JSON.stringify(r.toJSON()))}get renderingRule(){return we(ne.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._get("rasterFunction")}set renderingRule(r){we(ne.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",r)}get renderingRules(){return we(ne.getLogger(this),"renderingRules",{replacement:"rasterFunctions",version:"4.27",warnOnce:!0}),this._get("rasterFunctions")}set renderingRules(r){we(ne.getLogger(this),"renderingRules",{replacement:"rasterFunctions",version:"4.27",warnOnce:!0}),this._set("rasterFunctions",r)}set rasterFunction(r){let i=r;i!=null&&i.rasterFunction&&(i=b.fromJSON({...i.toJSON(),rasterFunction:i.rasterFunction,rasterFunctionArguments:i.rasterFunctionArguments})),this._set("rasterFunction",i)}writeRasterFunction(r,i,o){r!=null&&(i[o]=JSON.stringify(r.toJSON())),r.rasterFunctionDefinition&&(i[o]=JSON.stringify(r.rasterFunctionDefinition))}writeRasterFunctions(r,i,o){r!=null&&(i[o]=JSON.stringify(r.map(e=>e.rasterFunctionDefinition||e.toJSON())))}writePixelSize(r,i,o){r!=null&&(i[o]=JSON.stringify(r))}writeTimeExtent(r,i,o){if(r!=null){const e=r.start!=null?r.start.getTime():null,t=r.end!=null?r.end.getTime():null;i[o]=e!=null?t!=null?`${e},${t}`:`${e}`:null}}clone(){return new tt(B({geometry:this.geometry,mosaicRule:this.mosaicRule,rasterFunction:this.rasterFunction,rasterFunctions:this.rasterFunctions,pixelSize:this.pixelSize,returnGeometry:this.returnGeometry,returnCatalogItems:this.returnCatalogItems,returnPixelValues:this.returnPixelValues,maxItemCount:this.maxItemCount,processAsMultidimensional:this.processAsMultidimensional,raster:this.raster,viewId:this.viewId,timeExtent:this.timeExtent}))}};n([l({json:{write:!0}})],D.prototype,"geometry",void 0),n([P("geometry")],D.prototype,"writeGeometry",null),n([l({type:H,json:{write:!0}})],D.prototype,"mosaicRule",null),n([P("mosaicRule")],D.prototype,"writeMosaicRule",null),n([l({type:b})],D.prototype,"renderingRule",null),n([l({type:[b]})],D.prototype,"renderingRules",null),n([l({type:b,json:{write:!0,name:"renderingRule"}})],D.prototype,"rasterFunction",null),n([P("rasterFunction")],D.prototype,"writeRasterFunction",null),n([l({type:[b],json:{write:!0,name:"renderingRules"}})],D.prototype,"rasterFunctions",void 0),n([P("rasterFunctions")],D.prototype,"writeRasterFunctions",null),n([l({type:q,json:{write:!0}})],D.prototype,"pixelSize",void 0),n([P("pixelSize")],D.prototype,"writePixelSize",null),n([l({type:Boolean,json:{write:!0}})],D.prototype,"returnGeometry",void 0),n([l({type:Boolean,json:{write:!0}})],D.prototype,"returnCatalogItems",void 0),n([l({type:Boolean,json:{write:!0}})],D.prototype,"returnPixelValues",void 0),n([l({type:Number,json:{write:!0}})],D.prototype,"maxItemCount",void 0),n([l({type:ht,json:{write:{target:"time"}}})],D.prototype,"timeExtent",void 0),n([P("timeExtent")],D.prototype,"writeTimeExtent",null),n([l({json:{write:!0}})],D.prototype,"raster",void 0),n([l({json:{write:!0}})],D.prototype,"viewId",void 0),n([l({type:Boolean,json:{write:!0}})],D.prototype,"processAsMultidimensional",void 0),D=tt=n([F("esri.rest.support.ImageIdentifyParameters")],D);const mt=D;var it;let ve=it=class extends z{constructor(){super(...arguments),this.geometries=null,this.rasterId=null}writeGeometry(r,i,o){i.geometries={geometryType:"esriGeometryPoint",geometries:r.map(e=>e.toJSON())}}clone(){var r;return new it({geometries:((r=this.geometries)==null?void 0:r.map(i=>i.clone()))??[],rasterId:this.rasterId})}};n([l({type:[q],json:{write:!0}})],ve.prototype,"geometries",void 0),n([P("geometries")],ve.prototype,"writeGeometry",null),n([l({type:Ee,json:{write:!0}})],ve.prototype,"rasterId",void 0),ve=it=n([F("esri.rest.support.ImagePixelLocationParameters")],ve);const cr=ve;var rt;let de=rt=class extends W{constructor(){super(...arguments),this.type="point",this.geometry=null,this.is3D=!1}writeGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=r.toJSON())}get measureOperation(){const{is3D:r,geometry:i}=this;return i.type==="point"?r?"point-3D":"point":r?"centroid-3D":"centroid"}clone(){return new rt(B({geometry:this.geometry,is3D:this.is3D,mosaicRule:this.mosaicRule,pixelSize:this.pixelSize,raster:this.raster}))}};n([l({types:nt,json:{name:"fromGeometry",read:yt}})],de.prototype,"geometry",void 0),n([P("geometry")],de.prototype,"writeGeometry",null),n([l({type:U.apiValues,json:{read:U.read,write:U.write}})],de.prototype,"measureOperation",null),n([l({json:{read:!0}})],de.prototype,"is3D",void 0),de=rt=n([F("esri.rest.support.ImagePointParameters")],de);const mr=de;var st;let j=st=class extends z{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(r,i,o){r!=null&&(i.geometryType=Se(r),i[o]=r.toJSON())}set locations(r){if(r!=null&&r.length){const i=new _t({spatialReference:r[0].spatialReference});i.points=r.map(o=>[o.x,o.y]),this._set("locations",r),this.geometry=i}}clone(){return new st(B({geometry:this.geometry,locations:this.locations,interpolation:this.interpolation,mosaicRule:this.mosaicRule,outFields:this.outFields,raster:this.raster,returnFirstValueOnly:this.returnFirstValueOnly,sampleDistance:this.sampleDistance,sampleCount:this.sampleCount,sliceId:this.sliceId,pixelSize:this.pixelSize,timeExtent:this.timeExtent}))}};n([l({types:nt,json:{read:yt}})],j.prototype,"geometry",void 0),n([P("geometry")],j.prototype,"writeGeometry",null),n([l()],j.prototype,"locations",null),n([l({type:String,json:{type:oe.jsonValues,read:oe.read,write:oe.write}})],j.prototype,"interpolation",void 0),n([l({type:H,json:{write:!0}})],j.prototype,"mosaicRule",void 0),n([l({type:[String],json:{write:!0}})],j.prototype,"outFields",void 0),n([l({type:q,json:{write:!0}})],j.prototype,"pixelSize",void 0),n([l({type:String,json:{write:!0}})],j.prototype,"raster",void 0),n([l({type:Boolean,json:{write:!0}})],j.prototype,"returnFirstValueOnly",void 0),n([l({type:Number,json:{write:!0}})],j.prototype,"sampleDistance",void 0),n([l({type:Number,json:{write:!0}})],j.prototype,"sampleCount",void 0),n([l({type:Number,json:{write:!0}})],j.prototype,"sliceId",void 0),n([l({type:ht,json:{read:{source:"time"},write:{target:"time"}}})],j.prototype,"timeExtent",void 0),j=st=n([F("esri.rest.support.ImageSampleParameters")],j);const dr=j,hr=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),yr=Mt(Et,{min:0,max:255});function gr(r){if(!r)return null;const i=JSON.stringify(r).match(/"rasterFunction":"(.*?")/gi),o=i==null?void 0:i.map(e=>e.replace('"rasterFunction":"',"").replace('"',""));return o?o.join("/"):null}const fr=r=>{let i=class extends r{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this._rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new _({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.length<1||this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.forEach(t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)}),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every(s=>typeof s=="number"))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,s){e!=null&&this.format!=="lerc"&&(t[s]=e)}writeCompressionTolerance(e,t,s){this.format==="lerc"&&e!=null&&(t[s]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?H.fromJSON(t):null}get fieldsIndex(){return this.fields?new Ct(this.fields):null}set format(e){e&&hr.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return t.serviceDataType==="esriImageServiceDataTypeVector-UV"||t.serviceDataType==="esriImageServiceDataTypeVector-MagDir"||this.pixelFilter!=null?"lerc":"jpgpng"}readMinScale(e,t){return t.minLOD!=null&&t.maxLOD!=null?e:0}readMaxScale(e,t){return t.minLOD!=null&&t.maxLOD!=null?e:0}set mosaicRule(e){let t=e;t!=null&&t.mosaicMethod&&(t=H.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const s=e||t.mosaicRule;return s?H.fromJSON(s):this._isMosaicRuleSupported(t)?H.fromJSON(t):null}writeMosaicRule(e,t,s){let a=this.mosaicRule;const u=this.definitionExpression;a?u&&u!==a.where&&(a=a.clone(),a.where=u):u&&(a=new H({where:u})),this._isValidCustomizedMosaicRule(a)&&(t[s]=a.toJSON())}writeNoData(e,t,s){e!=null&&typeof e=="number"&&(t[s]=yr(e))}readObjectIdField(e,t){if(!e){const s=t.fields.find(a=>a.type==="esriFieldTypeOID"||a.type==="oid");e=s==null?void 0:s.name}return e}get parsedUrl(){return Vt(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,s){var p,m;const a=(m=(p=t==null?void 0:t.layerDefinition)==null?void 0:p.drawingInfo)==null?void 0:m.renderer,u=ni(a,s);return u==null?null:(u.type==="vector-field"&&t.symbolTileSize&&!a.symbolTileSize&&(u.symbolTileSize=t.symbolTileSize),vt(u)||ne.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),u)}writeRenderer(e,t,s){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),e.type==="vector-field"&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){var m;const e=this._rasterAttributeTableFieldPrefix,t=new ce({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),s=new ce({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),a=new ce({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let u=this.fields?B(this.fields):[];u.push(s),(m=this.capabilities)!=null&&m.operations.supportsQuery&&this.fields&&this.fields.length>0&&u.push(t),this.version>=10.4&&this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.some(c=>c.name.toLowerCase()==="none")&&u.push(a),this.rasterFunctionInfos!=null&&this.rasterFunctionInfos.filter(c=>c.name.toLowerCase()!=="none").forEach(c=>{u.push(new ce({name:"Raster.ServicePixelValue."+c.name,alias:c.name,domain:null,editable:!1,length:50,type:"string"}))}),this._isVectorDataSet()&&(u.push(new ce({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),u.push(new ce({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const{attributeTable:p}=this.rasterInfo??{};if(p!=null){const c=p.fields.filter(d=>d.type!=="esriFieldTypeOID"&&d.name.toLowerCase()!=="value").map(d=>{const y=B(d);return y.name=e+d.name,y});u=u.concat(c)}return u}get renderingRule(){return we(ne.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this.rasterFunction}set renderingRule(e){we(ne.getLogger(this),"renderingRule",{replacement:"rasterFunction",version:"4.27",warnOnce:!0}),this._set("rasterFunction",e)}set rasterFunction(e){let t=e;t!=null&&t.rasterFunction&&(t=b.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const s=t.rasterFunctionInfos;return t.renderingRule||s!=null&&s.length&&s[0].name!=="None"?this._isRFTJson(t.renderingRule)?b.fromJSON({rasterFunctionDefinition:t.renderingRule}):b.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const s=e||t.extent.spatialReference;return s?he.fromJSON(s):null}readPixelType(e){return Ue.fromJSON(e)||e}writePixelType(e,t,s){this.serviceRasterInfo!=null&&this.pixelType===this.serviceRasterInfo.pixelType||(t[s]=Ue.toJSON(e))}readVersion(e,t){let s=t.currentVersion;return s||(s=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),s}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let s=e;const{renderer:a,symbolizer:u,pixelFilter:p,bandIds:m}=this;if(!this._isPicture()&&a&&u&&!p){const c=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(a.toJSON()),d=this._rasterJobHandler.instance;if(d){c&&(u.bind(),await d.updateSymbolizer(u,t),this._cachedRendererJson=a.toJSON());const y=await d.symbolize({bandIds:m,...e},t);s={extent:e.extent,pixelBlock:y}}else s={extent:e.extent,pixelBlock:u.symbolize({bandIds:m,...e})}}return s}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputeAngles)throw new C("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=G(or,e).clone(),Zi(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputePixelLocation)throw new C("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=G(cr,e).clone(),Xi(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputeHistograms)throw new C("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=G(Be,e).clone(),this._applyMosaicAndRenderingRules(e),er(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsComputeStatisticsHistograms)throw new C("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=G(Be,e).clone(),this._applyMosaicAndRenderingRules(e),Yi(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const s=await this._fetchCapabilities(t==null?void 0:t.signal);if(!(e.operationType==="base-and-top"?s.mensuration.supportsHeightFromBaseAndTop:e.operationType==="base-and-top-shadow"?s.mensuration.supportsHeightFromBaseAndTopShadow:s.mensuration.supportsHeightFromTopAndTopShadow))throw new C("imagery-layer:measure-height","this operation is not supported on the input image service");return e=G(pr,e).clone(),this._applyMosaicAndRenderingRules(e),ir(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const s=await this._fetchCapabilities(t==null?void 0:t.signal);if(!(s.mensuration.supportsAreaAndPerimeter&&(!e.is3D||s.mensuration.supports3D)))throw new C("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=G(lr,e).clone(),this._applyMosaicAndRenderingRules(e),rr(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const s=await this._fetchCapabilities(t==null?void 0:t.signal);if(!(s.mensuration.supportsDistanceAndAngle&&(!e.is3D||s.mensuration.supports3D)))throw new C("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=G(ur,e).clone(),this._applyMosaicAndRenderingRules(e),nr(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const s=await this._fetchCapabilities(t==null?void 0:t.signal);if(!(s.mensuration.supportsPointOrCentroid&&(!e.is3D||s.mensuration.supports3D)))throw new C("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=G(mr,e).clone(),this._applyMosaicAndRenderingRules(e),sr(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return t!=null?t.get(e):void 0}getFieldDomain(e,t){const s=this.getField(e);return s?s.domain:null}async fetchImage(e,t,s,a={}){if(e==null||t==null||s==null)throw new C("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const d=await this._generateRasterInfo(this.rasterFunction,{signal:a.signal});d&&(this.rasterInfo=d)}const u=this.getExportImageServiceParameters(e,t,s,a.timeExtent);if(u==null){if(a.requestAsImageElement&&this._canRequestImageElement(this.format)){const g=document.createElement("canvas");return g.width=t,g.height=s,a.returnImageBitmap?{imageBitmap:await lt(g,`${o(this.parsedUrl)}/exportImage`,a.signal)}:{imageOrCanvasElement:g}}const{bandIds:d,rasterInfo:y}=this,R=((d==null?void 0:d.length)||y.bandCount)??0,f=t*s,v=y.pixelType,h=[];for(let g=0;g=10.3?e==null?void 0:e.rasterFunction:null})}).then(t=>t.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new C("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):N(o(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e==null?void 0:e.rasterFunction:null})}).then(t=>dt.fromJSON(t.data))}getCatalogItemRasterInfo(e,t){const s={...t,query:this._getQueryParams()};return ar(o(this.parsedUrl),e,s)}async getCatalogItemICSInfo(e,t){var ue,pe,X,at,ot;const{data:s}=await N(o(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),a=s==null?void 0:s.ics;if(!a)return;let u=null;try{u=(await N(o(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!u||!u.spatialReference)return{ics:a,icsToPixelTransform:null,icsExtent:null,northDirection:null};const p=this.version>=10.7?N(o(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then(S=>S.data).catch(()=>({})):{},m=u.spatialReference,c={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[u]}),inSR:Ke(m),outSR:"0:"+e},d=N(o(this.parsedUrl)+"/project",{query:this._getQueryParams(c),...t}).then(S=>S.data).catch(()=>({})),y=5,R=(u.xmin+u.xmax)/2,f=(u.ymax-u.ymin)/(y+1),v=u.ymin+f,h=[];for(let S=0;SS.data).catch(()=>({})),T=await Promise.all([p,d,w]);let $=T[0].ipxf;if($==null){const S=(ue=a.geodataXform)==null?void 0:ue.xf_0;((pe=S==null?void 0:S.name)==null?void 0:pe.toLowerCase())==="topup"&&((X=S==null?void 0:S.coefficients)==null?void 0:X.length)===6&&($={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:S.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const V=Ne.fromJSON((ot=(at=T[1])==null?void 0:at.geometries)==null?void 0:ot[0]);V&&(V.spatialReference=new he({wkid:0,imageCoordinateSystem:a}));const x=T[2].geometries?T[2].geometries.filter(S=>(S==null?void 0:S.x)!=null&&S.y!=null&&S.x!=="NaN"&&S.y!=="NaN"):[],J=x.length;if(J<3)return{ics:a,icsToPixelTransform:$,icsExtent:V,northDirection:null};let Q=0,O=0,I=0,M=0;for(let S=0;Sx[0].x,Pe=x[y-1].y>x[0].y;return A===1/0?re=Pe?90:270:A===0?re=Te?0:180:A>0?re=Te?180*Math.atan(A)/Math.PI:180*Math.atan(A)/Math.PI+180:A<0&&(re=Pe?180+180*Math.atan(A)/Math.PI:360+180*Math.atan(A)/Math.PI),{ics:a,icsToPixelTransform:$,icsExtent:V,northDirection:re}}async generateRasterInfo(e,t){var p;if(e=G(b,e),this.serviceRasterInfo&&(!e||((p=e.functionName)==null?void 0:p.toLowerCase())==="none"||this._isVectorFieldResampleFunction(e)))return this.serviceRasterInfo;const s=gr(e);if(!s)throw new C("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[s])return this._functionRasterInfos[s];const a={...t,query:this._getQueryParams()},u=ai(o(this.parsedUrl),e,a);this._functionRasterInfos[s]=u;try{return await u}catch(m){throw this._functionRasterInfos[s]=null,m}}getExportImageServiceParameters(e,t,s,a){var h;e=e.clone().shiftCentralMeridian();const u=It(e.spatialReference,o(this.parsedUrl));this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const p=this.exportImageServiceParameters.toJSON(),{bandIds:m,noData:c}=p;let{renderingRule:d}=p;const y=(h=this.rasterFunction)==null?void 0:h.rasterFunctionDefinition,R=!this.renderer||this.renderer.type==="raster-stretch";if(m!=null&&m.length&&this._hasRasterFunction(this.rasterFunction)&&!y&&R){const g={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:m}};if(d.rasterFunction==="Stretch")g.rasterFunctionArguments.Raster=d.rasterFunctionArguments.Raster,d.rasterFunctionArguments.Raster=g;else if(d.rasterFunction==="Colormap"){const w=d.rasterFunctionArguments.Raster;(w==null?void 0:w.rasterFunction)==="Stretch"?(g.rasterFunctionArguments.Raster=w.rasterFunctionArguments.Raster,w.rasterFunctionArguments.Raster=g):(g.rasterFunctionArguments.Raster=w,d.rasterFunctionArguments.Raster=g)}else g.rasterFunctionArguments.Raster=d,d=g;p.bandIds=void 0}else p.bandIds=m==null?void 0:m.join(",");c instanceof Array&&c.length>0&&(p.noData=c.join(","));const f=this._processMultidimensionalIntersection(null,a,this.exportImageServiceParameters.mosaicRule);if(f.isOutSide)return null;p.mosaicRule=f.mosaicRule!=null?JSON.stringify(f.mosaicRule):null,a=f.timeExtent,p.renderingRule=this._getRenderingRuleString(b.fromJSON(d));const v={};if(a!=null){const{start:g,end:w}=a.toJSON();g&&w&&g===w?v.time=""+g:g==null&&w==null||(v.time=`${g??"null"},${w??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:u,imageSR:u,size:t+","+s,...p,...v}}async getSamples(e,t){const s=await this._fetchCapabilities(t==null?void 0:t.signal);if(!(s!=null&&s.operations.supportsGetSamples))throw new C("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=G(dr,e).clone();const{raster:a}=this;return a&&e.raster==null&&(e.raster=a),tr(this.url,e,this._getRequestOptions(t))}async identify(e,t){var p;if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsIdentify)throw new C("imagery-layer:identify","identify operation is not supported on the input image service");e=G(mt,e).clone(),this.version<10.91&&((p=e.geometry)==null?void 0:p.type)==="extent"&&(e.geometry=Ge.fromExtent(e.geometry));const s=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(s.isOutSide)throw new C("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=s.timeExtent,e.mosaicRule=s.mosaicRule;const{raster:a,rasterFunction:u}=this;return u&&e.rasterFunction==null&&(e.rasterFunction=u),a&&e.raster==null&&(e.raster=a),pt(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new He;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),At(this.url,e,t)}async queryObjectIds(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),Ii(this.url,e,t)}async queryRasterCount(e,t){return{query:e,requestOptions:t}=await this._prepareForQuery(e,t),Di(this.url,e,t)}async queryVisibleRasters(e,t){var V,x,J,Q;if(!e)throw new C("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:s,returnDomainValues:a,returnTopmostRaster:u,showNoDataRecords:p}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let m=!1,c=null,d=null;const y="raster.servicepixelvalue",R=this._rasterFunctionNamesIndex;if(e.outFields!=null&&(m=e.outFields.some(O=>!O.toLowerCase().includes(y)),this.version>=10.4)){const O=e.outFields.filter(M=>M.toLowerCase().includes(y)&&M.length>y.length).map(M=>{const A=M.slice(y.length+1);return[this._updateRenderingRulesFunctionName(A,R),A]});c=O.map(M=>new b({functionName:M[0]})),d=O.map(M=>M[1]);const{rasterFunction:I}=this;c.length===0?I!=null&&I.functionName?(c.push(I),d.push(I.functionName)):c=null:I!=null&&I.functionName&&!c.some(M=>M.functionName===I.functionName)&&(c.push(I),d.push(I.functionName))}const f=e.outSpatialReference==null||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:v}=this;let h=e.timeExtent||this.timeExtent;if(v){const{isOutside:O,intersection:I}=Qe(v,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:(V=this.exportImageServiceParameters.mosaicRule)==null?void 0:V.multidimensionalDefinition});if(O)throw new C("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");(I==null?void 0:I.timeExtent)!=null&&(h=I.timeExtent)}const g=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h);let w=e.geometry;this.version<10.91&&(w==null?void 0:w.type)==="extent"&&(w=Ge.fromExtent(w));const T=this._getQueryParams({geometry:w,timeExtent:h,mosaicRule:g,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:c,pixelSize:s,returnCatalogItems:m,returnGeometry:f,raster:this.raster,maxItemCount:u?1:null});delete T.f;const $=new mt(T);try{await this._generateRasterInfo(this.rasterFunction);const O=await pt(this.url,$,{signal:t==null?void 0:t.signal,query:{...this.customParameters}}),I=e.outFields,M=O.value!=null&&O.value.toLowerCase().includes("nodata");if(!(m&&!f&&((x=O==null?void 0:O.catalogItems)!=null&&x.features.length)&&(p||!M)))return this._processVisibleRastersResponse(O,{returnDomainValues:a,templateRRFunctionNames:d,showNoDataRecords:p,templateFields:I});const A=this.objectIdField||"ObjectId",re=((J=O.catalogItems)==null?void 0:J.features)??[],Te=re.map(pe=>{var X;return(X=pe.attributes)==null?void 0:X[A]}),Pe=new He({objectIds:Te,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[A]}),ue=await this.queryRasters(Pe);return(Q=ue==null?void 0:ue.features)!=null&&Q.length&&ue.features.forEach(pe=>{re.forEach(X=>{X.attributes[A]===pe.attributes[A]&&(X.geometry=new Ge(pe.geometry),e.outSpatialReference!=null&&(X.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(O,{returnDomainValues:a,templateRRFunctionNames:d,showNoDataRecords:p,templateFields:I})}catch{throw new C("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const s=N(o(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then(p=>{var m;return(m=p.data)==null?void 0:m.statistics}),a=N(o(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then(p=>{var m;return(m=p.data)==null?void 0:m.histograms}),u=await Promise.all([s,a]);return u[0]&&u[0].forEach(p=>{p.avg=p.mean,p.stddev=p.standardDeviation}),{statistics:u[0]||null,histograms:u[1]||null}}async createFlowMesh(e,t){const s=this._rasterJobHandler.instance;return s?s.createFlowMesh(e,t):bi(e.meshType,e.simulationSettings,e.flowData,t.signal!=null?t.signal:new AbortController().signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return oi(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,s=this.serviceRasterInfo!=null?Promise.resolve(this.serviceRasterInfo):li(o(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(p=>(this._set("serviceRasterInfo",p),this._set("multidimensionalInfo",p.multidimensionalInfo),ui(p,t),p)),a=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,u=this._getRasterFunctionInfos();return Promise.all([s,a,u]).then(p=>{p[1]?this._set("rasterInfo",p[1]):this._set("rasterInfo",p[0]),p[2]&&this._set("rasterFunctionInfos",p[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),ne.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.addHandles([jt(()=>this.rasterFunction,c=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(c).then(d=>{d&&(this.rasterInfo=d)})})]);const{serviceRasterInfo:m}=this;m.multidimensionalInfo!=null&&this._updateMultidimensionalDefinition(m)})}_combineMosaicRuleWithTimeExtent(e,t){var v;const s=this.timeInfo,{multidimensionalInfo:a}=this.serviceRasterInfo;if(e==null||a==null||t==null||(s==null?void 0:s.startField)==null)return e;const{startField:u}=s,p=a.variables.some(h=>h.dimensions.some(g=>g.name===u))?u:"StdTime";if(e=e.clone(),this.sourceType==="mosaic-dataset")return e.multidimensionalDefinition=(v=e.multidimensionalDefinition)==null?void 0:v.filter(h=>h.dimensionName!==p),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const m=e.multidimensionalDefinition.filter(h=>h.dimensionName===p),c=t.start!=null?t.start.getTime():null,d=t.end!=null?t.end.getTime():null,y=c==null||d==null||c===d,R=y?[c||d]:[[c,d]],f=this.version>=10.8;if(m.length)m.forEach(h=>{h.dimensionName===p&&(f?(h.dimensionName=null,h.isSlice=!1,h.values=[]):(h.isSlice=y,h.values=R))});else if(!f){const h=e.multidimensionalDefinition.filter(g=>g.variableName!=null&&g.dimensionName==null);h.length?h.forEach(g=>{g.dimensionName=p,g.isSlice=y,g.values=R}):e.multidimensionalDefinition.push(new pi({variableName:"",dimensionName:p,isSlice:y,values:R}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return e==null?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(t=>!(!t.variableName&&!t.dimensionName)),e.multidimensionalDefinition.length===0&&(e.multidimensionalDefinition=null)),this.sourceType!=="mosaic-dataset"&&e.multidimensionalDefinition==null?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t==null?void 0:t.signal)).operations.supportsQuery)throw new C("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=e!=null?G(He,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(this._rasterJobHandler.connectionPromise!=null)return this._rasterJobHandler.connectionPromise;const e=new gi;this._rasterJobHandler.connectionPromise=e.initialize().then(()=>{this._rasterJobHandler.instance=e},()=>{}),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:s}=this;return e.type==="unique-value"&&this._hasRasterFunction(s)&&(t==null?void 0:t.bandCount)===1&&["u8","s8"].includes(t.pixelType)||t!=null&&e!=null&&ci(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){var s;let t=this.sourceJSON;if(!t){const{data:a,ssl:u}=await N(o(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=a,this.sourceJSON=t,u&&(this.url=this.url.replace(/^http:/i,"https:"))}if(((s=t.capabilities)==null?void 0:s.toLowerCase().split(",").map(a=>a.trim()).indexOf("tilesonly"))>-1)throw new C("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){var t;return e.serviceSourceType?e.serviceSourceType==="esriImageServiceSourceTypeMosaicDataset":((t=e.fields)==null?void 0:t.length)>0}_isMosaicRuleSupported(e){var a;if(!e)return!1;const t=this._isMosaicDataset(e),s=e.currentVersion>=10.71&&e.hasMultidimensions&&!(((a=e.fields)==null?void 0:a.length)>1);return t||s}_isVectorFieldResampleFunction(e){if(e==null)return!1;const{functionName:t,functionArguments:s}=e,a=(t==null?void 0:t.toLowerCase())==="resample",u=(s==null?void 0:s.ResampleType)||(s==null?void 0:s.resampleType);return a&&(u===7||u===10)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){var a,u;const t=this._isPicture(),{rasterInfo:s}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){if(!this.bandIds&&s.bandCount>=3){const m=mi(s);!m||s.bandCount===3&&m[0]===0&&m[1]===1&&m[2]===2||(this.bandIds=m)}e||(e=di(s,{bandIds:this.bandIds,variableName:this.rasterFunction?null:(u=(a=this.mosaicRule)==null?void 0:a.multidimensionalDefinition)==null?void 0:u[0].variableName}));const p=hi(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=p,this.symbolizer.rasterInfo=s):this.symbolizer=new Si({rendererJSON:p,rasterInfo:s}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return e==null?e:{extent:e.extent&&e.extent.clone(),pixelBlock:e.pixelBlock!=null?e.pixelBlock.clone():null}}_getQueryParams(e){(e==null?void 0:e.renderingRule)!=null&&typeof e.renderingRule!="string"&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:s}=this;return{raster:t,viewId:s,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e==null?void 0:e.query,...this.customParameters}}}_decodePixelBlock(e,t,s){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):ut(e,t,s)}async _getRasterFunctionInfos(e){var s;const t=this.sourceJSON.rasterFunctionInfos;return this.loaded?t:t&&this.version>=10.3?t.length===1&&t[0].name.toLowerCase()==="none"?t:(s=(await N(o(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data)==null?void 0:s.rasterFunctionInfos:null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:s,returnImageBitmap:a,signal:u}=e;if(s&&this._canRequestImageElement(t.format)){const v=`${o(this.parsedUrl)}/exportImage`,{data:h}=await N(v,{responseType:a?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:u});return h instanceof Blob?{imageBitmap:await lt(h,v,u),params:t}:{imageOrCanvasElement:h,params:t}}const p=this._initJobHandler(),m=N(o(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:u}),c=(await Promise.all([m,p]))[0].data,d=t.format||"jpgpng";let y=d;if(y!=="bsq"&&y!=="bip"&&(y=xi(c)),!y)throw new C("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(c)));const R={signal:u};return{pixelData:{pixelBlock:await(d==="gif"||d==="bmp"||d.includes("png")&&(y==="png"||y==="jpg")?ut(c,{useCanvas:!0,...t},R):this._decodePixelBlock(c,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:d},R)),extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch(()=>null)}_isValidCustomizedMosaicRule(e){var t;return e&&JSON.stringify(e.toJSON())!==JSON.stringify((t=this.defaultMosaicRule)==null?void 0:t.toJSON())}_updateMultidimensionalDefinition(e){var s;if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=yi(e,{multidimensionalSubset:this.multidimensionalSubset});if(t!=null&&t.length>0){this.mosaicRule=this.mosaicRule||new H;const a=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&((s=this.rasterFunction.functionName)==null?void 0:s.toLowerCase())!=="none"&&t.forEach(u=>u.variableName=""),t=t.filter(({variableName:u,dimensionName:p})=>u&&u!=="*"||p),!(a!=null&&a.length)&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,t){var T,$,V;t=t||{};const s=e.value,{templateRRFunctionNames:a,showNoDataRecords:u,returnDomainValues:p,templateFields:m}=t,c=e.processedValues;let d=(T=e.catalogItems)==null?void 0:T.features,y=((V=($=e.properties)==null?void 0:$.Values)==null?void 0:V.map(x=>x.replaceAll(/ /gi,", ")))||[];const R=this.objectIdField||"ObjectId",f=typeof s=="string"&&s.toLowerCase().includes("nodata"),v=[];if(s&&!d&&!f){const x={};x[R]=0,y=[s],d=[new $t(this.fullExtent,null,x)]}if(!d)return[];let h,g,w;this._updateResponseFieldNames(d,m),f&&!u&&(d=[]);for(let x=0;x0&&a&&a.length>0&&a.includes(this.rasterFunction.functionName)?c[a.indexOf(this.rasterFunction.functionName)]:s,g.toLowerCase()==="nodata"&&!u)continue;const J="Raster.ItemPixelValue",Q="Raster.ServicePixelValue";h.attributes[J]=g,h.attributes[Q]=w,this._updateFeatureWithMagDirValues(h,g);const O=this.fields&&this.fields.length>0;let I=this.rasterFunction&&this.serviceRasterInfo.attributeTable!=null?O?g:s:w;this.rasterFunction||(I=O?g:s),this._updateFeatureWithRasterAttributeTableValues(h,I)}if(h.sourceLayer=h.layer=this,p&&this._updateFeatureWithDomainValues(h),a&&c&&a.length===c.length)for(let J=0;Jc.name).find(c=>c.toLowerCase()==="value");if(!p)return;const m=a.filter(c=>c.attributes[p]===(t!=null?parseInt(t,10):null));m&&m[0]&&u.forEach(c=>{const d=this._rasterAttributeTableFieldPrefix+c.name;e.attributes[d]=m[0].attributes[c.name]})}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const s=t.split(/,\s*/).map(c=>parseFloat(c)),a=s.map(c=>[c]),u=s.map(c=>({minValue:c,maxValue:c,noDataValue:null})),p=new ke({height:1,width:1,pixelType:"f32",pixels:a,statistics:u});this.pixelFilter!=null&&this.pixelFilter({pixelBlock:p,extent:new Ne(0,0,0,0,this.spatialReference)});const m=this.serviceDataType==="esriImageServiceDataTypeVector-MagDir"?[p.pixels[0][0],p.pixels[1][0]]:Fi([p.pixels[0][0],p.pixels[1][0]]);e.attributes["Raster.Magnitude"]=m[0],e.attributes["Raster.Direction"]=m[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter(s=>s.domain&&s.domain.type==="coded-value");t!=null&&t.forEach(s=>{const a=e.attributes[s.name];if(a!=null){const u=s.domain.codedValues.find(p=>p.code===a);u&&(e.attributes[s.name]=u.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const s=this.fieldsIndex;s!=null&&e.forEach(a=>{var u;if(a!=null&&a.attributes)for(const p of t){const m=(u=s.get(p))==null?void 0:u.name;m&&m!==p&&(a.attributes[p]=a.attributes[m],delete a.attributes[m])}})}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return(e==null?void 0:e.functionName)!=null&&e.functionName.toLowerCase()!=="none"}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if(e==="Raw")return e.replace("Raw","None");const s=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(s)?t.get(s):e}_isRFTJson(e){return(e==null?void 0:e.name)&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return this.serviceDataType==="esriImageServiceDataTypeVector-UV"||this.serviceDataType==="esriImageServiceDataTypeVector-MagDir"}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:s,rasterFunction:a}=this;a&&e instanceof Be&&e.rasterFunction==null&&(e.rasterFunction=a),s&&e.mosaicRule==null&&(e.mosaicRule=s),t&&e.raster==null&&(e.raster=t)}_readCapabilities(e){var v;const t=e.capabilities?e.capabilities.toLowerCase().split(",").map(h=>h.trim()):["image","catalog"],{currentVersion:s,advancedQueryCapabilities:a,maxRecordCount:u}=e,p=t.includes("image"),m=e.serviceDataType==="esriImageServiceDataTypeElevation",c=!(!e.spatialReference&&!((v=e.extent)!=null&&v.spatialReference)),d=t.includes("edit"),y=t.includes("mensuration")&&c,R=e.mensurationCapabilities==null?[]:e.mensurationCapabilities.toLowerCase().split(",").map(h=>h.trim()),f=y&&R.includes("basic");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:p,supportsExportImage:p,supportsIdentify:p,supportsMeasure:y,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:s>=10.2&&p,supportsProject:s>=10.3&&p,supportsComputeStatisticsHistograms:s>=10.4&&p,supportsQueryBoundary:s>=10.6&&p,supportsCalculateVolume:s>=10.7&&m,supportsComputePixelLocation:s>=10.7&&t.includes("catalog"),supportsComputeAngles:s>=10.91,supportsAdd:d,supportsDelete:d,supportsEditing:d,supportsUpdate:d,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:u,maxRecordCountFactor:void 0,supportsStatistics:!!(a!=null&&a.supportsStatistics),supportsOrderBy:!!(a!=null&&a.supportsOrderBy),supportsDistinct:!!(a!=null&&a.supportsDistinct),supportsPagination:!!(a!=null&&a.supportsPagination),supportsStandardizedQueriesOnly:!!(a!=null&&a.useStandardizedQueries),supportsPercentileStatistics:!!(a!=null&&a.supportsPercentileStatistics),supportsCentroid:!!(a!=null&&a.supportsReturningGeometryCentroid),supportsDistance:!!(a!=null&&a.supportsQueryWithDistance),supportsExtent:!!(a!=null&&a.supportsReturningQueryExtent),supportsGeometryProperties:!!(a!=null&&a.supportsReturningGeometryProperties),supportsHavingClause:!!(a!=null&&a.supportsHavingClause),supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!(a!=null&&a.supportsDefaultSR),supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0},mensuration:{supportsDistanceAndAngle:f,supportsAreaAndPerimeter:f,supportsPointOrCentroid:f,supportsHeightFromBaseAndTop:y&&R.includes("base-top height"),supportsHeightFromBaseAndTopShadow:y&&R.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:y&&R.includes("top-top shadow height"),supports3D:y&&R.includes("3d")}}}};function o(e){return(e==null?void 0:e.path)??""}return n([l({clonable:!1})],i.prototype,"_functionRasterInfos",void 0),n([l({clonable:!1})],i.prototype,"_rasterJobHandler",void 0),n([l({clonable:!1})],i.prototype,"_cachedRendererJson",void 0),n([l({readOnly:!0})],i.prototype,"_serviceSupportsMosaicRule",void 0),n([E("_serviceSupportsMosaicRule",["currentVersion","fields"])],i.prototype,"readServiceSupportsMosaicRule",null),n([l({readOnly:!0})],i.prototype,"_rasterAttributeTableFieldPrefix",void 0),n([l({readOnly:!0})],i.prototype,"_rasterFunctionNamesIndex",null),n([l()],i.prototype,"adjustAspectRatio",void 0),n([l({type:[Ee],json:{write:!0}})],i.prototype,"bandIds",void 0),n([E("bandIds")],i.prototype,"readBandIds",null),n([l({readOnly:!0,json:{read:!1}})],i.prototype,"capabilities",void 0),n([E("service","capabilities",["capabilities","currentVersion","serviceDataType"])],i.prototype,"readCapabilities",null),n([l({type:Number})],i.prototype,"compressionQuality",void 0),n([P("compressionQuality")],i.prototype,"writeCompressionQuality",null),n([l({type:Number})],i.prototype,"compressionTolerance",void 0),n([P("compressionTolerance")],i.prototype,"writeCompressionTolerance",null),n([l({json:{read:{source:"copyrightText"}}})],i.prototype,"copyright",void 0),n([l({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],i.prototype,"defaultMosaicRule",void 0),n([E("defaultMosaicRule",["defaultMosaicMethod"])],i.prototype,"readDefaultMosaicRule",null),n([l({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],i.prototype,"definitionExpression",void 0),n([l({readOnly:!0,constructOnly:!0})],i.prototype,"exportImageServiceParameters",void 0),n([l()],i.prototype,"rasterInfo",void 0),n([l({readOnly:!0,type:[ce]})],i.prototype,"fields",void 0),n([l({readOnly:!0})],i.prototype,"fieldsIndex",null),n([l({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],i.prototype,"format",null),n([E("service","format",["serviceDataType"])],i.prototype,"readFormat",null),n([l({type:Ne})],i.prototype,"fullExtent",void 0),n([l({readOnly:!0})],i.prototype,"hasMultidimensions",void 0),n([l({json:{read:{source:"maxImageHeight"}}})],i.prototype,"imageMaxHeight",void 0),n([l({json:{read:{source:"maxImageWidth"}}})],i.prototype,"imageMaxWidth",void 0),n([l({type:String,json:{type:oe.jsonValues,read:oe.read,write:oe.write}})],i.prototype,"interpolation",void 0),n([l()],i.prototype,"minScale",void 0),n([E("service","minScale")],i.prototype,"readMinScale",null),n([l()],i.prototype,"maxScale",void 0),n([E("service","maxScale")],i.prototype,"readMaxScale",null),n([l({type:H})],i.prototype,"mosaicRule",null),n([E("mosaicRule",["mosaicRule","defaultMosaicMethod"])],i.prototype,"readMosaicRule",null),n([P("mosaicRule")],i.prototype,"writeMosaicRule",null),n([l()],i.prototype,"multidimensionalInfo",void 0),n([l({type:ii,json:{write:!0}})],i.prototype,"multidimensionalSubset",void 0),n([l({json:{type:Ee}})],i.prototype,"noData",void 0),n([P("noData")],i.prototype,"writeNoData",null),n([l({type:String,json:{type:Ie.jsonValues,read:Ie.read,write:Ie.write}})],i.prototype,"noDataInterpretation",void 0),n([l({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],i.prototype,"objectIdField",void 0),n([E("objectIdField")],i.prototype,"readObjectIdField",null),n([l({readOnly:!0})],i.prototype,"geometryType",void 0),n([l({})],i.prototype,"typeIdField",void 0),n([l({})],i.prototype,"types",void 0),n([l({readOnly:!0})],i.prototype,"parsedUrl",null),n([l({type:Function})],i.prototype,"pixelFilter",void 0),n([l()],i.prototype,"raster",void 0),n([l({readOnly:!0})],i.prototype,"sourceType",void 0),n([E("sourceType",["serviceSourceType","fields"])],i.prototype,"readSourceType",null),n([l()],i.prototype,"viewId",void 0),n([l({types:ri,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:si,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&e.type!=="vector-field"&&e.type!=="flow"})}}}}})],i.prototype,"renderer",null),n([E("renderer")],i.prototype,"readRenderer",null),n([P("renderer")],i.prototype,"writeRenderer",null),n([l({clonable:!1})],i.prototype,"symbolizer",void 0),n([l(Nt)],i.prototype,"opacity",void 0),n([l({readOnly:!0})],i.prototype,"rasterFields",null),n([l({constructOnly:!0})],i.prototype,"rasterFunctionInfos",void 0),n([l({type:b})],i.prototype,"renderingRule",null),n([l({type:b,json:{name:"renderingRule"}})],i.prototype,"rasterFunction",null),n([E("rasterFunction",["renderingRule","rasterFunctionInfos"])],i.prototype,"readRasterFunction",null),n([l({readOnly:!0})],i.prototype,"serviceDataType",void 0),n([l({readOnly:!0,type:he})],i.prototype,"spatialReference",void 0),n([E("spatialReference",["spatialReference","extent"])],i.prototype,"readSpatialReference",null),n([l({json:{type:Ue.jsonValues}})],i.prototype,"pixelType",void 0),n([E("pixelType")],i.prototype,"readPixelType",null),n([P("pixelType")],i.prototype,"writePixelType",null),n([l({constructOnly:!0,type:Rt})],i.prototype,"serviceRasterInfo",void 0),n([l()],i.prototype,"sourceJSON",void 0),n([l(Ot)],i.prototype,"url",void 0),n([l({readOnly:!0})],i.prototype,"version",void 0),n([E("version",["currentVersion","fields","timeInfo"])],i.prototype,"readVersion",null),i=n([F("esri.layers.mixins.ArcGISImageService")],i),i};let L=class extends Jt(Lt(qt(zt(Gt(fr(Ht(Ti(Ut(Bt(Qt(ei))))))))))){constructor(...r){super(...r),this.isReference=null,this.operationalLayerType="ArcGISImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.type="imagery",this._debouncedSaveOperations=kt(async(i,o,e)=>{const{save:t,saveAs:s}=await ti(()=>import("./imageryUtils-UiAX5Jos.js"),__vite__mapDeps([0,1,2,3,4]));switch(i){case _e.SAVE:return t(this,o);case _e.SAVE_AS:return s(this,e,o)}})}normalizeCtorArgs(r,i){return typeof r=="string"?{url:r,...i}:r}load(r){const i=r!=null?r.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},r).catch(Wt).then(()=>this._fetchService(i))),Promise.resolve(this)}get legendEnabled(){return!this._isPreviewLayer&&(this._get("legendEnabled")??!0)}set legendEnabled(r){this._set("legendEnabled",r)}get listMode(){return this._isPreviewLayer?"hide":this._get("listMode")}set listMode(r){this._set("listMode",r)}writeOperationalLayerType(r,i,o){var t;const e=((t=this.renderer)==null?void 0:t.type)==="vector-field";i[o]=e?"ArcGISImageServiceVectorLayer":"ArcGISImageServiceLayer"}get defaultPopupTemplate(){return this.createPopupTemplate()}get _isPreviewLayer(){var r;return!(!this.raster||!((r=this.url)!=null&&r.toLowerCase().includes("/rasterrendering/imageserver")))}createPopupTemplate(r){var p;const i=this.rasterFields,o=this.title,e=new Set;let t=!1,s=!1;this.capabilities&&(t=this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0,s=this.serviceDataType==="esriImageServiceDataTypeVector-UV"||this.serviceDataType==="esriImageServiceDataTypeVector-MagDir");const a=new Set;t&&a.add("raster.itempixelvalue");for(const m of i){const c=m.name.toLowerCase();a.has(c)||c.includes("raster.servicepixelvalue.")||e.add(m.name)}s&&e.add("raster.magnitude").add("raster.direction");const u=Kt({fields:i,title:o},{...r,visibleFieldNames:e});return u!=null&&u.fieldInfos&&((p=this.rasterInfo)!=null&&p.pixelType.startsWith("f"))&&u.fieldInfos.forEach(({format:m,fieldName:c})=>{m&&/^raster\.(item|service)pixelvalue/i.test(c)&&(m.places=2)}),u}queryFeatures(r,i){return this.queryRasters(r,i).then(o=>{if(o!=null&&o.features)for(const e of o.features)e.layer=e.sourceLayer=this;return o})}queryFeatureCount(r,i){return this.queryRasterCount(r,i)}redraw(){this.emit("redraw")}async save(r){return this._debouncedSaveOperations(_e.SAVE,r)}async saveAs(r,i){return this._debouncedSaveOperations(_e.SAVE_AS,i,r)}serviceSupportsSpatialReference(r){return Pi(this,r)}write(r,i){if(!this._isPreviewLayer)return super.write(r,i);if(i!=null&&i.messages){const o=`${i.origin}/${i.layerContainerType||"operational-layers"}`;i.messages.push(new C("layer:unsupported",`Imagery preview layer (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${o}'`,{layer:this}))}return null}};n([l(Zt)],L.prototype,"legendEnabled",null),n([l({type:["show","hide"]})],L.prototype,"listMode",null),n([l({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],L.prototype,"isReference",void 0),n([l({type:["ArcGISImageServiceLayer"],json:{origins:{"web-map":{type:["ArcGISImageServiceLayer","ArcGISImageServiceVectorLayer"],read:!1,write:{target:"layerType",ignoreOrigin:!0}}}}})],L.prototype,"operationalLayerType",void 0),n([P("web-map","operationalLayerType")],L.prototype,"writeOperationalLayerType",null),n([l(Xt)],L.prototype,"popupEnabled",void 0),n([l({type:Yt,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],L.prototype,"popupTemplate",void 0),n([l({readOnly:!0})],L.prototype,"defaultPopupTemplate",null),n([l({readOnly:!0,json:{read:!1}})],L.prototype,"type",void 0),n([l({readOnly:!0})],L.prototype,"_isPreviewLayer",null),L=n([F("esri.layers.ImageryLayer")],L);const Er=L;export{Er as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/imageryUtils-UiAX5Jos.js","assets/utils-YxtTVBu2.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/jsonContext-EgdQULbU.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/ImageryLayerView3D-Ajt9-b41.js b/dist/assets/ImageryLayerView3D-BaVb1zzV.js similarity index 65% rename from dist/assets/ImageryLayerView3D-Ajt9-b41.js rename to dist/assets/ImageryLayerView3D-BaVb1zzV.js index 3b6dafa..b400eef 100644 --- a/dist/assets/ImageryLayerView3D-Ajt9-b41.js +++ b/dist/assets/ImageryLayerView3D-BaVb1zzV.js @@ -1 +1 @@ -import{e as o,y as d,jW as D,c as w,E as m,fG as E,ca as _,T as c,ah as b,F as H}from"./index-J0iiHjMT.js";import{N as I}from"./DynamicLayerView3D-4lztpXo0.js";import"./LayerView3D-iOx2MD1g.js";import"./projectExtentUtils-TwA6ooHn.js";import"./ImageMaterial.glsl-TdPtjVc_.js";import"./LayerView-efDufa6j.js";import"./RefreshableLayerView-Pd4dLcWr.js";const F=e=>{let t=class extends e{constructor(){super(...arguments),this.view=null}async fetchPopupFeatures(a,r){const{layer:n}=this;if(!a)throw new m("imagerylayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:n});const{popupEnabled:i}=n,s=E(n,r);if(!i||s==null)throw new m("imagerylayerview:fetchPopupFeatures","Missing required popupTemplate or popupEnabled",{popupEnabled:i,popupTemplate:s});const y=await s.getRequiredFields(),l=new _;l.timeExtent=this.timeExtent,l.geometry=a,l.outFields=y,l.outSpatialReference=a.spatialReference;const{resolution:p,spatialReference:h}=this.view,g=this.view.type==="2d"?new c(p,p,h):new c(.5*p,.5*p,h),{returnTopmostRaster:x,showNoDataRecords:f}=s.layerOptions||{returnTopmostRaster:!0,showNoDataRecords:!1},v={returnDomainValues:!0,returnTopmostRaster:x,pixelSize:g,showNoDataRecords:f,signal:r!=null?r.signal:null};return n.queryVisibleRasters(l,v).then(R=>R)}canResume(){var a;return!!super.canResume()&&!((a=this.timeExtent)!=null&&a.isEmpty)}};return o([d()],t.prototype,"layer",void 0),o([d()],t.prototype,"suspended",void 0),o([d(D)],t.prototype,"timeExtent",void 0),o([d()],t.prototype,"view",void 0),t=o([w("esri.views.layers.ImageryLayerView")],t),t};let u=class extends F(I){constructor(){super(...arguments),this.type="imagery-3d",this.redrawDebounced=b(async e=>{this.redraw((t,a)=>this._redrawImage(t,a),e)},2e3)}initialize(){this.addHandles([H(()=>this.view.basemapTerrain.ready,()=>this._initializeMaximumDataResolution(),{once:!0,initial:!0}),this.layer.on("redraw",()=>this._updatingHandles.addPromise(this.redrawDebounced()))]),this._updatingHandles.add(()=>{var e,t;return(t=(e=this.layer)==null?void 0:e.exportImageServiceParameters)==null?void 0:t.version},()=>{this._updatingHandles.addPromise(this.refreshDebounced())}),this._updatingHandles.add(()=>{var e;return(e=this.layer)==null?void 0:e.renderer},()=>{this._updatingHandles.addPromise(this.refreshDebounced())}),this._updatingHandles.add(()=>this.timeExtent,()=>this._updatingHandles.addPromise(this.refreshDebounced()))}_initializeMaximumDataResolution(){this.maximumDataResolution=this.layer.loaded?this.layer.serviceRasterInfo.pixelSize:null}getFetchOptions(){return{timeExtent:this.timeExtent}}async processResult(e,t,a){t.imageOrCanvasElement?e.image=t.imageOrCanvasElement:(e.image=document.createElement("canvas"),e.pixelData=t.pixelData,await this._redrawImage(e,a))}async _redrawImage(e,t){if(!(e.image instanceof HTMLCanvasElement)||e.pixelData==null)throw new Error;const a=e.image,r=a.getContext("2d"),n=await this.layer.applyRenderer(e.pixelData,{signal:t}),i=this.layer.applyFilter(n).pixelBlock;if(i==null)throw new Error;a.width=i.width,a.height=i.height;const s=r.createImageData(i.width,i.height);s.data.set(i.getAsRGBA()),r.putImageData(s,0,0)}};u=o([w("esri.views.3d.layers.ImageryLayerView3D")],u);const O=u;export{O as default}; +import{e as o,y as d,k1 as D,c as w,r as h,fB as E,aL as b,L as c,bs as _,v as H}from"./index-pCX-0tJH.js";import{N as I}from"./DynamicLayerView3D-XykdNh09.js";import"./LayerView3D-57OghbRh.js";import"./projectExtentUtils-Q4rXasWA.js";import"./ImageMaterial.glsl-PU0wbmEN.js";import"./LayerView-ixwLVnzr.js";import"./RefreshableLayerView-DVYs7L04.js";const P=e=>{let t=class extends e{constructor(){super(...arguments),this.view=null}async fetchPopupFeatures(a,r){const{layer:n}=this;if(!a)throw new h("imagerylayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:n});const{popupEnabled:i}=n,s=E(n,r);if(!i||s==null)throw new h("imagerylayerview:fetchPopupFeatures","Missing required popupTemplate or popupEnabled",{popupEnabled:i,popupTemplate:s});const y=await s.getRequiredFields(),l=new b;l.timeExtent=this.timeExtent,l.geometry=a,l.outFields=y,l.outSpatialReference=a.spatialReference;const{resolution:p,spatialReference:m}=this.view,g=this.view.type==="2d"?new c(p,p,m):new c(.5*p,.5*p,m),{returnTopmostRaster:x,showNoDataRecords:v}=s.layerOptions||{returnTopmostRaster:!0,showNoDataRecords:!1},f={returnDomainValues:!0,returnTopmostRaster:x,pixelSize:g,showNoDataRecords:v,signal:r!=null?r.signal:null};return n.queryVisibleRasters(l,f).then(R=>R)}canResume(){var a;return!!super.canResume()&&!((a=this.timeExtent)!=null&&a.isEmpty)}};return o([d()],t.prototype,"layer",void 0),o([d()],t.prototype,"suspended",void 0),o([d(D)],t.prototype,"timeExtent",void 0),o([d()],t.prototype,"view",void 0),t=o([w("esri.views.layers.ImageryLayerView")],t),t};let u=class extends P(I){constructor(){super(...arguments),this.type="imagery-3d",this.redrawDebounced=_(async e=>{this.redraw((t,a)=>this._redrawImage(t,a),e)},2e3)}initialize(){this.addHandles([H(()=>this.view.basemapTerrain.ready,()=>this._initializeMaximumDataResolution(),{once:!0,initial:!0}),this.layer.on("redraw",()=>this._updatingHandles.addPromise(this.redrawDebounced()))]),this._updatingHandles.add(()=>{var e,t;return(t=(e=this.layer)==null?void 0:e.exportImageServiceParameters)==null?void 0:t.version},()=>{this._updatingHandles.addPromise(this.refreshDebounced())}),this._updatingHandles.add(()=>{var e;return(e=this.layer)==null?void 0:e.renderer},()=>{this._updatingHandles.addPromise(this.refreshDebounced())}),this._updatingHandles.add(()=>this.timeExtent,()=>this._updatingHandles.addPromise(this.refreshDebounced()))}_initializeMaximumDataResolution(){this.maximumDataResolution=this.layer.loaded?this.layer.serviceRasterInfo.pixelSize:null}getFetchOptions(){return{timeExtent:this.timeExtent}}async processResult(e,t,a){t.imageOrCanvasElement?e.image=t.imageOrCanvasElement:(e.image=document.createElement("canvas"),e.pixelData=t.pixelData,await this._redrawImage(e,a))}async _redrawImage(e,t){if(!(e.image instanceof HTMLCanvasElement)||e.pixelData==null)throw new Error;const a=e.image,r=a.getContext("2d"),n=await this.layer.applyRenderer(e.pixelData,{signal:t}),i=this.layer.applyFilter(n).pixelBlock;if(i==null)throw new Error;a.width=i.width,a.height=i.height;const s=r.createImageData(i.width,i.height);s.data.set(i.getAsRGBA()),r.putImageData(s,0,0)}};u=o([w("esri.views.3d.layers.ImageryLayerView3D")],u);const M=u;export{M as default}; diff --git a/dist/assets/ImageryTileLayer-7zhL4pR_.js b/dist/assets/ImageryTileLayer-7zhL4pR_.js new file mode 100644 index 0000000..e9ece44 --- /dev/null +++ b/dist/assets/ImageryTileLayer-7zhL4pR_.js @@ -0,0 +1,8 @@ +import{cQ as xt,eW as te,ul as ot,R as _e,r as P,fY as Ne,L as H,dO as W,av as lt,eX as ct,fU as wt,um as It,e as b,y as R,dR as ut,c as Q,dr as bt,h6 as ze,de as ht,dX as qe,d2 as j,dt as St,dZ as Rt,jN as ft,un as vt,dY as De,dE as Tt,jW as _t,j3 as kt,au as Ft,po as Ct,dF as Mt,dJ as Pt,dH as Ot,dI as $t,ee as Dt,ef as Bt,dG as At,dK as Et,dq as Jt,bs as Nt,dL as zt,es as he,io as Ht,jj as we,B as Lt,er as Wt,iy as jt,dQ as qt,ix as Gt,aI as Ut}from"./index-pCX-0tJH.js";import{o as Vt}from"./CustomParametersMixin-7nmugR3Y.js";import{h as dt,D as Xt,i as Yt,a as Kt,p as mt,c as Zt,N as Be,l as Qt,d as ei,b as ti,e as ii,f as Ge,o as si,g as Ue,K as Ve,B as Xe,j as ri,S as ni,E as ai,V as Ye,t as oi,k as li,m as ci,n as ui}from"./ImageHistogramParameters-qqqpsay3.js";import{U as Ce,j as hi,n as ge,R as pt,I as fi,a as di,l as mi,u as ie,f as pi,m as yi,s as gi,L as xi,r as Ke,b as xe,W as wi,h as Ii,g as He,P as bi,T as Si,c as Ri,F as vi,d as Ti,N as _i,e as ki,i as Ie,B as Fi,k as Ci,D as Mi}from"./dataUtils-_QoSHbCE.js";import{T as Ae,D as be,j as Ze,r as Qe,o as Pi,V as Me,J as ve,e as Oi,Z as $i,C as Di,U as Bi}from"./rasterProjectionHelper-3sL58SxG.js";import{R as Ee,f as Ai,i as Ei,y as Le,n as Ji,C as Ni}from"./utils-7NyN8ES_.js";import"./generateRendererUtils-3JJTfr19.js";let zi=class{constructor(e=15e3,s=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=e,this._interval=Math.min(e,s)}decreaseRefCount(e,s){const t=e+"/"+s,i=this._cachedBlocks;if(i.has(t)){const r=i.get(t);return r.refCount--,r.refCount<=0&&(i.delete(t),r.controller&&r.controller.abort()),r.refCount}return 0}getBlock(e,s){const t=e+"/"+s,i=this._cachedBlocks;if(i.has(t)){const r=i.get(t);return r.ts=Date.now(),r.refCount++,i.delete(t),i.set(t,r),r.block}return null}putBlock(e,s,t,i){const r=this._cachedBlocks,n=e+"/"+s;if(r.has(n)){const l=r.get(n);l.ts=Date.now(),l.refCount++}else r.set(n,{block:t,ts:Date.now(),refCount:1,controller:i});this._trim(),this._updateTimer()}deleteBlock(e,s){const t=this._cachedBlocks,i=e+"/"+s;t.has(i)&&t.delete(i)}updateMaxSize(e){this._size=e,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(this._timer!=null)return;const e=this._cachedBlocks;this._timer=setInterval(()=>{const s=Array.from(e),t=Date.now();for(let i=0;i=e.size)return;const s=Array.from(e);for(let t=0;tn.isResolved=!0).catch(()=>n.isRejected=!0),(l=r[e])==null||l.cache.set(s,n)}function Li(a,e,s){var i;const t=ke.get(a);t?e!=null&&t[e]!=null?(i=t[e])==null||i.cache.delete(s):re.deleteBlock(a,s):e==null&&re.deleteBlock(a,s)}const st=8,Wi=256;let q=class extends xt(bt){constructor(){super(...arguments),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=Ae();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e!=null&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:te.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,s=be(e.spatialReference);return s!=null&&e.extent.width>=s/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return e==null||e.type==="gcs-shift"}set rasterJobHandler(e){var s,t;this._set("rasterJobHandler",e),this.datasetFormat==="Function"&&((t=(s=this.primaryRasters)==null?void 0:s.rasters)==null||t.forEach(i=>i.rasterJobHandler=e))}set url(e){this._set("url",ot(e,_e.getLogger(this)))}async open(e){throw new P("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,s,t,i={}){const r=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,s,t,r);return this.fetchPixels(n,r.size[0],r.size[1],i)}async identify(e,s={}){var O;e=Ne(H,e).clone().normalize();const{multidimensionalDefinition:t,timeExtent:i}=s,{rasterInfo:r}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:l}=r;let{transposedVariableName:o}=s;const c=l!=null&&n&&(i!=null||dt(t));c&&!o&&(o=t!=null&&t.length>0?t[0].variableName??void 0:l.variables[0].name,s={...s,transposedVariableName:o}),s=this._getRequestOptionsWithSliceId(s);const{spatialReference:u,extent:f}=r,{datumTransformation:p}=s;let h=Ze(e,u,p);if(!f.intersects(h))return{location:h,value:null};if(r.transform!=null){const D=r.transform.inverseTransform(h);if(!r.nativeExtent.intersects(D))return{location:D,value:null};h=D}let m=0;const y=o!=null&&l!=null&&r.hasMultidimensionalTranspose;if(this.datasetFormat==="Function"){const D=this.primaryRasters.rasters[0];if(y)return D.identify(h,s);const{pixelSize:J}=r,M=3,$=J.x*M/2,B=J.y*M/2,U=new W({xmin:h.x-$,xmax:h.x+$,ymin:h.y-B,ymax:h.y+B,spatialReference:u}),Y={interpolation:"nearest"},{pixelBlock:N}=await D.fetchPixels(U,M,M,Y),{pixelBlock:z}=await this.fetchPixels(U,M,M,Y);if(N==null)return{location:h,value:null};const L=Math.floor(M*M*.5),ee=!N.mask||N.mask[L]?N.pixels.map(V=>V[L]):null;let A;return z!=null&&(A=!z.mask||z.mask[L]?z.pixels.map(V=>V[L]):void 0),{location:h,value:ee,processedValue:A,pyramidLevel:0}}if(!y){if(s.srcResolution)m=Qe(s.srcResolution,r,this.ioConfig.sampling).pyramidLevel;else if(m=await this.computeBestPyramidLevelForLocation(e,s),m==null)return{location:h,value:null}}const d=this.identifyPixelLocation(h,m,null,y);if(d===null)return{location:h,value:null};const{row:x,col:g,rowOffset:w,colOffset:I,blockWidth:S}=d,v=o??s.sliceId,F=et(this.url,v),T=`${m}/${x}/${g}`;let k=tt(F,null,T);k==null&&(k=this.fetchRawTile(m,x,g,s),it(F,null,T,k));const _=await k;if(!((O=_==null?void 0:_.pixels)!=null&&O.length))return{location:h,value:null};const C=w*S+I;return this._processIdentifyResult(_,{srcLocation:h,position:C,pyramidLevel:m,useTransposedTile:!!y,requestSomeSlices:c,identifyOptions:s})}async fetchPixels(e,s,t,i={}){e=Pi(e),i=this._getRequestOptionsWithSliceId(i);const{_hasNoneOrGCSShiftTransform:r}=this;if(i.requestRawData&&r)return this._fetchPixels(e,s,t,i);const n=be(e.spatialReference),l=Me(e);if(n==null||l===0||l===1&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,s,t,i);if(l>=3)return{extent:e,pixelBlock:null};const o=[],{xmin:c,xmax:u}=e,f=Math.round(n/(u-c)*s),p=f-Math.round((n/2-c)/(u-c)*s);let h=0;const m=[];for(let g=0;g<=l;g++){const w=new W({xmin:g===0?c:-n/2,xmax:g===l?u-n*g:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),I=g===0?f-p:g===l?s-h:f;h+=I,m.push(I);const S=i.disableWrapAround&&g>0?null:this._fetchPixels(w,I,t,i);o.push(S)}const y=(await Promise.all(o)).map(g=>g==null?void 0:g.pixelBlock);let d=null;const x={width:s,height:t};return this.rasterJobHandler?d=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:y,srcMosaicSize:x,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:m},i)).pixelBlock:d=Ce(y,x,{blockWidths:m}),{extent:e,srcExtent:ve(e,this.rasterInfo.spatialReference,i.datumTransformation),pixelBlock:d}}async fetchRawPixels(e,s,t,i={}){s={x:Math.floor(s.x),y:Math.floor(s.y)};const r=await this._fetchRawTiles(e,s,t,i),{nativeExtent:n,nativePixelSize:l,storageInfo:o}=this.rasterInfo,c=2**e,u=l.x*c,f=l.y*c,p=new W({xmin:n.xmin+u*s.x,xmax:n.xmin+u*(s.x+t.width-1),ymin:n.ymax-f*(s.y+t.height-1),ymax:n.ymax-f*s.y,spatialReference:n.spatialReference});if(!r)return{extent:p,srcExtent:p,pixelBlock:null};const{pixelBlocks:h,mosaicSize:m}=r;if(h.length===1&&h[0]!=null&&h[0].width===t.width&&h[0].height===t.height)return{extent:p,srcExtent:p,pixelBlock:r.pixelBlocks[0]};const y=e>0?o.pyramidBlockWidth:o.blockWidth,d=e>0?o.pyramidBlockHeight:o.blockHeight,x={x:s.x%y,y:s.y%d};let g;return this.rasterJobHandler?g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:m,destDimension:t,clipOffset:x,clipSize:t,coefs:null,sampleSpacing:null,interpolation:i.interpolation,alignmentInfo:null,blockWidths:null},i)).pixelBlock:g=Ce(h,m,{clipOffset:x,clipSize:t}),{extent:p,srcExtent:p,pixelBlock:g}}fetchRawTile(e,s,t,i){throw new P("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return ve(this.rasterInfo.extent,e)}decodePixelBlock(e,s){return!this.rasterJobHandler||s.useCanvas?hi(e,s):this.rasterJobHandler.decode({data:e,options:s})}async request(e,s,t=0){const{customFetchParameters:i}=this.ioConfig,{range:r,query:n,headers:l}=s;t=t??s.retryCount??this.ioConfig.retryCount;const o=r?{Range:`bytes=${r.from}-${r.to}`}:null;try{return await lt(e,{...s,query:{...n,...i},headers:{...l,...o}})}catch(c){if(t>0)return t--,this.request(e,s,t);throw c}}getSliceIndex(e){const{multidimensionalInfo:s}=this.rasterInfo;return s==null||e==null||e.length===0?null:Xt(e,s)}getTileExtentFromTileInfo(e,s,t,i){const r=i.lodAt(e);return this.getTileExtent({x:r.resolution,y:r.resolution},s,t,i.origin,i.spatialReference,i.size)}updateTileInfo(){const{storageInfo:e,spatialReference:s,extent:t,pixelSize:i}=this.rasterInfo;if(!e.tileInfo){const r=[],n=e.maximumPyramidLevel||0;let l=Math.max(i.x,i.y),o=1/.0254*96*l;for(let u=0;u<=n;u++)r.unshift(new ct({level:n-u,resolution:l,scale:o})),l*=2,o*=2;const c=new H({x:t.xmin,y:t.ymax,spatialReference:s});e.tileInfo=new te({origin:c,size:[e.blockWidth,e.blockHeight],spatialReference:s,lods:r}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,s=512,t=512,i){const{width:r,height:n,nativeExtent:l,pixelSize:o,spatialReference:c}=e,u=new H({x:l.xmin,y:l.ymax,spatialReference:c});i==null&&(i=Math.max(0,Math.round(Math.log(Math.max(r,n))/Math.LN2-8)));const f=this.computeBlockBoundary(l,512,512,{x:l.xmin,y:l.ymax},[o],i);e.storageInfo=new ge({blockWidth:s,blockHeight:t,pyramidBlockWidth:s,pyramidBlockHeight:t,origin:u,firstPyramidLevel:1,maximumPyramidLevel:i,blockBoundary:f})}async computeBestPyramidLevelForLocation(e,s={}){return 0}computeBlockBoundary(e,s,t,i,r,n=0,l=2){if(r.length===1&&n>0){r=[...r];let{x:f,y:p}=r[0];for(let h=0;ho)return null;const m=this.getPyramidPixelSize(s),{x:y,y:d}=m,x=(c.y-h.y)/d/p,g=(h.x-c.x)/y/f,w=Math.min(p-1,Math.floor((x-Math.floor(x))*p)),I=Math.min(f-1,Math.floor((g-Math.floor(g))*f));return{pyramidLevel:s,row:Math.floor(x),col:Math.floor(g),rowOffset:w,colOffset:I,blockWidth:f,srcLocation:h}}getTileExtent(e,s,t,i,r,n){const[l,o]=n,c=i.x+t*l*e.x,u=c+l*e.x,f=i.y-s*o*e.y,p=f-o*e.y;return new W({xmin:c,xmax:u,ymin:p,ymax:f,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,s,t){const i=this.rasterInfo.storageInfo.blockBoundary[e];return!i||i.maxRows||i.minCol>t}async _fetchPixels(e,s,t,i={}){let r=Me(e);if(r>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,s,t,i),{pyramidLevel:l,srcResolution:o,srcExtent:c,srcWidth:u,srcHeight:f,ul:p}=n;if(u===0||f===0)return{extent:e,srcExtent:c,pixelBlock:null};const{rasterInfo:h}=this,m=h.transform,y=(m==null?void 0:m.type)==="gcs-shift",d=be(e.spatialReference)!=null;!y&&d||(r=Me(n.srcExtent,y));const x=await this._fetchRawTiles(l,p,{width:u,height:f,wrapCount:r},i);if(!x)return{extent:e,srcExtent:c,pixelBlock:null};const g=h.storageInfo,w=l>0?g.pyramidBlockWidth:g.blockWidth,I=l>0?g.pyramidBlockHeight:g.blockHeight;let{x:S,y:v}=h.pixelSize;if(l>0){const{pyramidResolutions:V,pyramidScalingFactor:gt}=g;if(V!=null&&V[l-1])({x:S,y:v}=V[l-1]);else{const je=gt**l;S*=je,v*=je}}const F=h.spatialReference,T=new H({x:S,y:v,spatialReference:F}),k=w===u&&I===f&&p.x%w==0&&p.y%I==0,_=new H({x:(e.xmax-e.xmin)/s,y:(e.ymax-e.ymin)/t,spatialReference:e.spatialReference}),C=!e.spatialReference.equals(F),O=F.isGeographic?1e-9:1e-4,{datumTransformation:D}=i;if(!C&&k&&x.pixelBlocks.length===1&&w===s&&I===t&&this._isSameResolution(o,_,O))return{extent:e,srcExtent:c,srcTilePixelSize:T,pixelBlock:x.pixelBlocks[0]};const J=d&&be(c.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,M=i.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");M&&!this.rasterJobHandler&&await Ae();const $=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:x.extent,pixelSize:_.toJSON(),datumTransformation:D,rasterTransform:m,hasWrapAround:r>0||J,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:M},i):Oi({projectedExtent:e,srcBufferExtent:x.extent,pixelSize:_,datumTransformation:D,rasterTransform:m,hasWrapAround:r>0||J,isAdaptive:!1,includeGCSGrid:M});let B;const U=!i.requestRawData,Y={rows:$.spacing[0],cols:$.spacing[1]},N=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(l,x.extent.xmin):void 0,{pixelBlocks:z,mosaicSize:L,isPartiallyFilled:ee}=x;let A=null;if(this.rasterJobHandler)({pixelBlock:B,localNorthDirections:A}=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:z,srcMosaicSize:L,destDimension:U?{width:s,height:t}:null,coefs:U?$.coefficients:null,sampleSpacing:U?Y:null,projectDirections:M,gcsGrid:M?$.gcsGrid:null,isUV:this.rasterInfo.dataType==="vector-uv",interpolation:i.interpolation,alignmentInfo:N,blockWidths:null},i));else{const V=Ce(z,L,{alignmentInfo:N});B=U?pt(V,{width:s,height:t},$.coefficients,Y,i.interpolation):V,M&&$.gcsGrid&&(A=fi({width:s,height:t},$.gcsGrid),B=di(B,this.rasterInfo.dataType,A))}return i.requestRawData||M?{extent:e,srcExtent:c,srcTilePixelSize:T,pixelBlock:B,transformGrid:$,localNorthDirections:A,isPartiallyFilled:ee}:{extent:e,srcExtent:c,srcTilePixelSize:T,pixelBlock:B}}async _fetchRawTiles(e,s,t,i){const{origin:r,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:l,blockHeight:o}=this.getBlockWidthHeight(e);let{x:c,y:u}=s,{width:f,height:p,wrapCount:h}=t;const m=this._getRasterTileAlignmentInfo(e,0);i.buffer&&(c-=i.buffer.cols,u-=i.buffer.rows,f+=2*i.buffer.cols,p+=2*i.buffer.rows);let y=0,d=0,x=0;h&&m!=null&&({worldColumnCountFromOrigin:d,originColumnOffset:x,rightPadding:y}=m,d*m.blockWidth-y>=c+f&&(y=0));const g=Math.floor(c/l),w=Math.floor(u/o),I=Math.floor((c+f+y-1)/l),S=Math.floor((u+p+y-1)/o),v=n[e];if(!v)return null;const{minRow:F,minCol:T,maxCol:k,maxRow:_}=v;if(h===0&&(S_||g>k))return null;const C=new Array;let O=!1;const D=this.ioConfig.allowPartialFill==null?i.allowPartialFill:this.ioConfig.allowPartialFill;for(let N=w;N<=S;N++)for(let z=g;z<=I;z++){let L=z;if(!i.disableWrapAround&&h&&m!=null&&d<=z&&(L=z-d-x),N>=F&&L>=T&&_>=N&&k>=L){const ee=this._fetchRawTile(e,N,L,i);D?C.push(new Promise(A=>{ee.then(V=>A(V)).catch(()=>{O=!0,A(null)})})):C.push(ee)}else C.push(Promise.resolve(null))}if(C.length===0)return null;const J=await Promise.all(C),M={height:(S-w+1)*o,width:(I-g+1)*l},{spatialReference:$}=this.rasterInfo,B=this.getPyramidPixelSize(e),{x:U,y:Y}=B;return{extent:new W({xmin:r.x+g*l*U,xmax:r.x+(I+1)*l*U,ymin:r.y-(S+1)*o*Y,ymax:r.y-w*o*Y,spatialReference:$}),pixelBlocks:J,mosaicSize:M,isPartiallyFilled:O}}_isSameResolution(e,s,t){return Math.abs(e.x-s.x)c||t>o)return Promise.resolve(null);const u=et(this.url,i.sliceId),f=`${e}/${s}/${t}`;let p=tt(u,i.registryId,f);if(p==null){const h=new AbortController;p=this.fetchRawTile(e,s,t,{...i,signal:h.signal}),it(u,i.registryId,f,p,h),p.catch(()=>Li(u,i.registryId,f))}return i.signal&&wt(i,()=>{Hi(u,i.registryId,f)}),p}_computeMagDirValues(e){var c;const{bandCount:s,dataType:t}=this.rasterInfo;if(!(s===2&&t==="vector-magdir"||t==="vector-uv")||(e==null?void 0:e.length)!==2||!((c=e[0])!=null&&c.length))return null;const i=e[0].length;if(t==="vector-magdir"){const u=e[1].map(f=>(f+360)%360);return[e[0],u]}const[r,n]=e,l=[],o=[];for(let u=0;u=16,h=c===n&&this._requireTooManySrcTiles(l,o,s,t);if(p||h||l===0||o===0){const m=new H({x:(e.xmax-e.xmin)/s,y:(e.ymax-e.ymin)/t,spatialReference:e.spatialReference});let y=Di(m,this.rasterInfo.spatialReference,e,r.datumTransformation);const d=!y||i.srcResolution&&y.x+y.y=x){const g=2**x;y={x:i.srcResolution.x*g,y:i.srcResolution.y*g}}}y&&(r.srcResolution=y,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,s,t)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,s,t,i){const{tileInfo:r}=this.rasterInfo.storageInfo;return Math.ceil(e/r.size[0])*Math.ceil(s/r.size[1])>=Wi||e/t>st||s/i>st}_updateSourceDataInfo(e,s){s.srcWidth=0,s.srcHeight=0;const{rasterInfo:t}=this,i=t.spatialReference,{srcResolution:r,datumTransformation:n}=s,{pyramidLevel:l,pyramidResolution:o,excessiveReading:c}=Qe(r,t,this.ioConfig.sampling);if(c)return;let u=s.srcExtent||ve(e,i,n);if(u==null)return;const f=t.transform;f&&(u=f.inverseTransform(u)),s.srcExtent=u;const{x:p,y:h}=t.storageInfo.origin,m=Math.floor((u.xmin-p)/o.x+.1),y=Math.floor((h-u.ymax)/o.y+.1),d=Math.floor((u.xmax-p)/o.x-.1),x=Math.floor((h-u.ymin)/o.y-.1),g=u.width<.1*o.x?0:d-m+1,w=u.height<.1*o.y?0:x-y+1;s.pyramidLevel=l,s.pyramidResolution=o,s.srcWidth=g,s.srcHeight=w,s.ul={x:m,y}}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,s){const{srcLocation:t,position:i,pyramidLevel:r,useTransposedTile:n}=s,l=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[i]))return{location:t,value:null};const{multidimensionalInfo:o}=this.rasterInfo;if(o==null||!n){const x=e.pixels.map(I=>I[i]),g={location:t,value:x,pyramidLevel:r},w=this._computeMagDirValues(x.map(I=>[I]));return w!=null&&w.length&&(g.magdirValue=w.map(I=>I[0])),g}let c=e.pixels.map(x=>x.slice(i*l,i*l+l)),u=this._computeMagDirValues(c);const{requestSomeSlices:f,identifyOptions:p}=s;let h=Yt(o,p.transposedVariableName);if(f){const x=Kt(h,p.multidimensionalDefinition,p.timeExtent);c=c.map(g=>x.map(w=>g[w])),u=u==null?void 0:u.map(g=>x.map(w=>g[w])),h=x.map(g=>h[g])}const m=e.noDataValues||this.rasterInfo.noDataValue,y={pixels:c,pixelType:e.pixelType};let d;return m!=null&&(It(y,m),d=y.mask),{location:t,value:null,dataSeries:h.map((x,g)=>{const w={value:(d==null?void 0:d[g])===0?null:c.map(I=>I[g]),multidimensionalDefinition:x.multidimensionalDefinition.map(I=>new mt({...I,isSlice:!0}))};return u!=null&&u.length&&(w.magdirValue=[u[0][g],u[1][g]]),w}),pyramidLevel:r}}};b([R()],q.prototype,"_rasterTileAlighmentInfo",void 0),b([R({readOnly:!0})],q.prototype,"_isGlobalWrappableSource",null),b([R({readOnly:!0})],q.prototype,"_hasNoneOrGCSShiftTransform",null),b([R()],q.prototype,"rasterJobHandler",null),b([R(ut)],q.prototype,"url",null),b([R({type:String,json:{write:!0}})],q.prototype,"datasetName",void 0),b([R({type:String,json:{write:!0}})],q.prototype,"datasetFormat",void 0),b([R()],q.prototype,"hasUniqueSourceStorageInfo",void 0),b([R()],q.prototype,"rasterInfo",void 0),b([R()],q.prototype,"ioConfig",void 0),b([R()],q.prototype,"sourceJSON",void 0),q=b([Q("esri.layers.support.rasterDatasets.BaseRaster")],q);const ce=q;let ne=class extends ce{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null}async open(e){var u,f,p,h;await this.init();const{rasterFunction:s}=this;(f=(u=this.primaryRasters)==null?void 0:u.rasters)!=null&&f.length?s.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=s.getPrimaryRasters(),this.rasterJobHandler&&((p=this.primaryRasters.rasters)==null||p.forEach(m=>m.rasterJobHandler=this.rasterJobHandler)));const{rasters:t,rasterIds:i}=this.primaryRasters,r=t.map(m=>m.rasterInfo?void 0:m.open(e));await Promise.all(r);const n=t.map(({rasterInfo:m})=>m),l=s.bind({rasterInfos:n,rasterIds:i});if(!l.success||n.length===0)throw new P("raster-function:open",`cannot bind the function: ${l.error??""}`);const o=s.functionName==="Table"?s:(h=s.functionArguments)==null?void 0:h.raster;(o==null?void 0:o.functionName)==="Table"&&(s.rasterInfo.attributeTable=ze.fromJSON(o.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const c=n[0];this.hasUniqueSourceStorageInfo=n.length===1||n.slice(1).every(m=>this._hasSameStorageInfo(m,c)),this.set("sourceJSON",t[0].sourceJSON),this.set("rasterInfo",s.rasterInfo)}async syncJobHandler(){var e;return(e=this.rasterJobHandler)==null?void 0:e.updateRasterFunction(this.rasterFunction)}async fetchPixels(e,s,t,i={}){var w,I;const{rasters:r,rasterIds:n}=this.primaryRasters;let l=!1;const{interpolation:o}=i,c=(w=this.rasterFunction.flatWebGLFunctionChain)==null?void 0:w.hasFocalFunction;!i.requestRawData&&o!=="bilinear"&&c&&(l=r.length===1&&!i.skipRasterFunction,i={...i,interpolation:"bilinear",requestRawData:l});const u=r.map(S=>S.fetchPixels(e,s,t,i)),f=await Promise.all(u),p=f.map(S=>S.pixelBlock),h=l||i.requestRawData?f.map(S=>S.srcTilePixelSize):null;if(i.skipRasterFunction||p.every(S=>S==null))return f[0];const m=((I=f.find(S=>S.pixelBlock!=null))==null?void 0:I.extent)??e,y=this.rasterJobHandler?await this.rasterJobHandler.process({extent:m,primaryPixelBlocks:p,primaryPixelSizes:h,primaryRasterIds:n}):this.rasterFunction.process({extent:m,primaryPixelBlocks:p,primaryPixelSizes:h,primaryRasterIds:n}),{transformGrid:d}=f[0];if(!l||y==null||d==null)return{...f[0],pixelBlock:y};const x={rows:d.spacing[0],cols:d.spacing[1]};let g;return this.rasterJobHandler?g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[y],srcMosaicSize:{width:y.width,height:y.height},destDimension:{width:s,height:t},coefs:d.coefficients,sampleSpacing:x,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:o,alignmentInfo:void 0,blockWidths:null},i)).pixelBlock:g=pt(y,{width:s,height:t},d.coefficients,x,o),{extent:e,srcExtent:f[0].srcExtent,pixelBlock:g}}_hasSameStorageInfo(e,s){const{storageInfo:t,pixelSize:i,spatialReference:r,extent:n}=e,{storageInfo:l,pixelSize:o,spatialReference:c,extent:u}=s;return i.x===o.x&&i.y===o.y&&r.equals(c)&&n.equals(u)&&t.blockHeight===l.blockHeight&&t.blockWidth===l.blockWidth&&t.maximumPyramidLevel===l.maximumPyramidLevel}};b([R({type:String,json:{write:!0}})],ne.prototype,"datasetFormat",void 0),b([R()],ne.prototype,"tileType",void 0),b([R()],ne.prototype,"rasterFunction",void 0),b([R()],ne.prototype,"primaryRasters",void 0),ne=b([Q("esri.layers.support.rasterDatasets.FunctionRaster")],ne);const Je=ne;function ji(a,e){if(a.spatialReference.equals(e))return a;const s=qe(a.spatialReference),t=qe(e);if(s===t)return a;const i=s/t;return{x:a.x*i,y:a.y*i}}async function qi(a,e,s){if(s.type==="extent")return Ui(a,e,s);const{width:t,height:i}=a,r=new Uint8Array(t*i),{contains:n,intersects:l}=await ht(()=>import("./index-pCX-0tJH.js").then(o=>o.A0),__vite__mapDeps([0,1]));return l(e,s)?s.type==="polyline"?Vi(a,e,s):n(s,e)?a:Gi(a,e,s):new ie({pixelType:a.pixelType,width:t,height:i,mask:r,maskIsAlpha:!1,pixels:[...a.pixels]})}function Gi(a,e,s){if(!a)return a;const{width:t,height:i}=a,r=e.width/t,n=e.height/i,{xmin:l,ymax:o}=e;let c;if(s.type==="extent"){const d=(s.xmin-l)/r,x=(s.xmax-l)/r,g=(o-s.ymax)/n,w=(o-s.ymin)/n;c=[[[d,g],[d,w],[x,w],[x,g],[d,g]]]}else c=s.rings.map(d=>d.map(([x,g])=>[(x-l)/r,(o-g)/n]));const u=document.createElement("canvas");u.width=t,u.height=i;const f=u.getContext("2d");f.fillStyle="#f00",c.forEach(d=>{f.beginPath(),f.moveTo(d[0][0],d[0][1]);for(let x=0;x127?255:0);return new ie({pixelType:a.pixelType,width:t,height:i,mask:y,maskIsAlpha:!1,pixels:[...a.pixels]})}function Ui(a,e,s){const{width:t,height:i}=a,r=new Uint8Array(t*i),n=e.width/t,l=e.height/i;if(s.width/n<.5||s.height/l<.5)return new ie({pixelType:a.pixelType,width:t,height:i,mask:r,pixels:[...a.pixels]});const{xmin:o,xmax:c,ymin:u,ymax:f}=e,{xmin:p,xmax:h,ymin:m,ymax:y}=s,d=Math.max(o,p),x=Math.min(c,h),g=Math.max(u,m),w=Math.min(f,y),I=.5*n,S=.5*l;if(x-dc-I||g>f-S||w.5&&F%1<.5||O===D&&T%1>.5&&k%1<.5)return new ie({pixelType:a.pixelType,width:t,height:i,mask:r,pixels:[...a.pixels]});if(_===0&&O===0&&C===t&&D===i)return a;const J=a.mask;for(let M=O;M<=D;M++)for(let $=_;$<=C;$++){const B=M*t+$;r[B]=J?J[B]:255}return new ie({pixelType:a.pixelType,width:t,height:i,mask:r,pixels:[...a.pixels]})}function Vi(a,e,s){const{width:t,height:i}=a,r=new Uint8Array(t*i),n=e.width/t,l=e.height/i,{xmin:o,ymax:c}=e,{paths:u}=s,f=a.mask;for(let p=0;py?r*Math.round((f-y)/r):0),h=d-(hy?r*Math.round((p-y)/r):0),m=d-(my?r*Math.floor((f-y)/r+.1):0),h=d-(h{let e=class extends a{constructor(...t){var i,r;super(...t),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster=((r=(i=t[0])==null?void 0:i.raster)==null?void 0:r.datasetFormat)==="Function"}get fullExtent(){var t;return(t=this.rasterInfo)==null?void 0:t.extent}set multidimensionalDefinition(t){this._set("multidimensionalDefinition",t),this.updateRenderer()}set rasterFunction(t){var i;((i=t==null?void 0:t.functionName)==null?void 0:i.toLowerCase())==="none"&&(t=void 0),this._set("rasterFunction",t),this.updateRasterFunction()}set url(t){this._set("url",ot(t,rt))}set renderer(t){t==null&&this.rasterFunction==null?this._configDefaultRenderer("override"):(this._set("renderer",t),this.updateRenderer())}readRenderer(t,i,r){var l,o;const n=(o=(l=i==null?void 0:i.layerDefinition)==null?void 0:l.drawingInfo)==null?void 0:o.renderer;return ti(n,r)||void 0}async convertVectorFieldData(t,i){if(t==null||!this.rasterInfo)return null;const r=this._rasterJobHandler.instance,n=this.rasterInfo.dataType;return r?r.convertVectorFieldData({pixelBlock:t,dataType:n},i):pi(t,n)}async computeStatisticsHistograms(t,i){t=Ne(ii,t).clone();const{rasterInfo:r}=this,{geometry:n}=t;if(n==null)throw new P("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let l=n;const{spatialReference:o}=r;n.spatialReference.equals(o)||(await Ae(),l=n.type==="extent"?ve(n,o):Bi(n,o));const c=t.pixelSize??new H({x:r.pixelSize.x,y:r.pixelSize.y,spatialReference:o}),{extent:u,width:f,height:p}=Xi(r,l,c),h=await this.fetchPixels(u,f,p,{...i,interpolation:"nearest"});if(h.pixelBlock==null)throw new P("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const m=await qi(h.pixelBlock,u,l),y=this._rasterJobHandler.instance;return y?y.computeStatisticsHistograms({pixelBlock:m},i):yi(m)}async createFlowMesh(t,i){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(t,i):gi(t.meshType,t.simulationSettings,t.flowData,i.signal!=null?i.signal:new AbortController().signal)}normalizeRasterFetchOptions(t){var l,o;const{multidimensionalInfo:i}=this.rasterInfo??{};if(i==null)return t;let r=t.multidimensionalDefinition||this.multidimensionalDefinition;r!=null&&r.length||(r=Ge(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const n=t.timeExtent||this.timeExtent;if(r!=null&&n!=null&&(n.start!=null||n.end!=null)){r=r.map(x=>x.clone());const c=(o=(l=i.variables.find(({name:x})=>x===r[0].variableName))==null?void 0:l.dimensions)==null?void 0:o.find(({name:x})=>x==="StdTime"),u=r.find(({dimensionName:x})=>x==="StdTime");if(!c||!u)return{...t,multidimensionalDefinition:null};const{start:f,end:p}=n,h=f==null?null:f.getTime(),m=p==null?null:p.getTime(),y=h??m,d=m??h;if(c.values!=null){const x=c.values.filter(g=>{if(Array.isArray(g)){if(y===d)return g[0]<=y&&g[1]>=y;const w=g[0]<=y&&g[1]>y||g[0]=d,I=g[0]>=y&&g[1]<=d||g[0]d;return w||I}return y===d?g===y:g>=y&&g<=d});if(x.length){const g=x.sort((w,I)=>{const S=Array.isArray(w)?w[0]:w,v=Array.isArray(w)?w[1]:w,F=Array.isArray(I)?I[0]:I,T=Array.isArray(I)?I[1]:I;return y===d?S-F:Math.abs(v-d)-Math.abs(T-d)})[0];u.values=[g]}else r=null}else if(c.hasRegularIntervals&&c.extent){const[x,g]=c.extent;y>g||d1&&t.forEach(d=>h[d.url]=d);const m=Ee(((f=n.functionDefinition)==null?void 0:f.toJSON())??n.toJSON(),h),y=new Je({rasterFunction:m});y.rasterJobHandler=this._rasterJobHandler.instance,await y.open(),this._cachedRasterFunctionJson=(p=this.rasterFunction)==null?void 0:p.toJSON(),this.raster=y}else this.raster=i,this._cachedRasterFunctionJson=null,await i.when();if(this._cachedRendererJson=null,!r&&!n)return;const{bandIds:l}=this,{bandCount:o}=this.raster.rasterInfo,c=l!=null&&l.length?l.some(h=>h>=o):o>=3;l&&(c||this.renderer&&this.renderer.type!=="raster-stretch")&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:t,symbolizer:i}=this;if(!t||!i||!this.renderer)return;const{rasterInfo:r}=this.raster,n=Ue(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),l=n==null?void 0:n.name,o=Ve({...this.renderer.toJSON(),variableName:l});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(o))return;const c=this._rasterJobHandler.instance;c&&(i.rasterInfo=Xe(r,l),i.rendererJSON=o,i.bind(),await c.updateSymbolizer(i),this._cachedRendererJson=o)}async applyRenderer(t,i){const r=t==null?void 0:t.pixelBlock;if(!(r!=null&&r.pixels&&r.pixels.length>0))return null;let n;await this.updateRenderer();const l=this._rasterJobHandler.instance,o=this.bandIds??[];return n=l?await l.symbolize({...t,simpleStretchParams:i,bandIds:o}):this.symbolizer.symbolize({...t,simpleStretchParams:i,bandIds:o}),n}getTileUrl(t,i,r){return this.raster.datasetFormat==="RasterTileServer"?`${this.url}/tile/${t}/${i}/${r}`:""}getCompatibleTileInfo(t,i,r=!1){if(!this.loaded||i==null)return null;if(r&&t.equals(this.spatialReference))return this.tileInfo;const n=Rt(t);return te.create({size:256,spatialReference:t,origin:n?{x:n.origin[0],y:n.origin[1]}:{x:i.xmin,y:i.ymax}})}getCompatibleFullExtent(t){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(t)||(this._compatibleFullExtent=this.raster.computeExtent(t)),this._compatibleFullExtent):null}async fetchTile(t,i,r,n={}){var o;if(s(this),n.requestAsImageElement){const c=this.getTileUrl(t,i,r);return lt(c,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:n.signal}).then(u=>u.data)}const{rasterInfo:l}=this;if(l.multidimensionalInfo!=null&&(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition==null){const c=n.tileInfo||l.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(t,i,r,c),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),((o=this.renderer)==null?void 0:o.type)==="raster-shaded-relief"&&(n={...n,buffer:{cols:1,rows:1}}),this.raster.fetchTile(t,i,r,n)}async fetchPixels(t,i,r,n={}){return this.rasterInfo.multidimensionalInfo!=null&&(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition==null?{extent:t,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),i=Math.round(i),r=Math.round(r),this.raster.fetchPixels(t,i,r,n))}async identify(t,i={}){var o;const{raster:r,rasterInfo:n}=this;if(n.multidimensionalInfo!=null&&!(n.hasMultidimensionalTranspose&&(dt(i.multidimensionalDefinition)||i.transposedVariableName||i.timeExtent))&&(i=this.normalizeRasterFetchOptions(i)).multidimensionalDefinition==null)return{location:t,value:null};const l=(o=this.multidimensionalSubset)==null?void 0:o.areaOfInterest;if(l&&!l.contains(t))throw new P("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return r.identify(t,i)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){var n,l,o;const t=(n=this.rasterInfo)==null?void 0:n.multidimensionalInfo;if(t==null||((l=this.rasterInfo)==null?void 0:l.dataType)!=="standard-time")return!1;const i=this.multidimensionalDefinition,r=(o=i==null?void 0:i[0])==null?void 0:o.variableName;return t.variables.some(c=>c.name===r&&(!(i!=null&&i[0].dimensionName)||c.dimensions.some(u=>u.name==="StdTime")))}getStandardTimeValue(t){return new Date(24*(t-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(t){var r;const i=t??((r=this.rasterInfo)==null?void 0:r.multidimensionalInfo);return ri(this.multidimensionalSubset,i)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=Ge(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&this.raster.datasetFormat==="Function"&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(this._rasterJobHandler.connectionPromise!=null)return this._rasterJobHandler.connectionPromise;const t=new oi;return this._rasterJobHandler.connectionPromise=t.initialize().then(async()=>{s(this),this._rasterJobHandler.instance=t,this.raster.rasterJobHandler=t,this.raster.datasetFormat==="Function"&&this.raster.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch(()=>{}),this.renderer&&this.updateRenderer()}).catch(()=>{}),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){var t;if(this.interpolation==null){s(this);const{raster:i}=this,r=ni(i.rasterInfo,i.tileType,(t=this.sourceJSON)==null?void 0:t.defaultResamplingMethod);this._set("interpolation",r)}}_configDefaultRenderer(t="no"){var u,f;s(this);const{rasterInfo:i}=this.raster;!this.bandIds&&i.bandCount>1&&(this.bandIds=ai(i));const r=Ue(i,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=r==null?void 0:r.name;if(!this.renderer||t==="override"){const p=Ye(i,{bandIds:this.bandIds,variableName:n}),h=i.statistics,m=h&&h.length>0?h[0]:null,y=(m==null?void 0:m.max)??0,d=(m==null?void 0:m.min)??0;this.raster.datasetFormat==="WCSServer"&&p.type==="raster-stretch"&&(y>1e24||d<-1e24)&&(p.dynamicRangeAdjustment=!0,p.statistics=null,p.stretchType==="none"&&(p.stretchType="min-max")),this.renderer=p}const l=Ve({...this.renderer.toJSON(),variableName:n}),o=Xe(i,n);this.symbolizer?(this.symbolizer.rendererJSON=l,this.symbolizer.rasterInfo=o):this.symbolizer=new xi({rendererJSON:l,rasterInfo:o});const c=this.symbolizer.bind();if(c.success){if(t==="auto"){const{colormap:p}=this.raster.rasterInfo,h=this.renderer;if(p!=null&&h.type==="raster-colormap"){const m=Ye(this.raster.rasterInfo);JSON.stringify(m)!==JSON.stringify(h)&&this._configDefaultRenderer("override")}else if(h.type==="raster-stretch"){const m=(u=this.bandIds)==null?void 0:u.length,y=(f=h.statistics)==null?void 0:f.length;!h.dynamicRangeAdjustment&&y&&m&&y!==m&&this._configDefaultRenderer("override")}}}else rt.warn("imagery-tile-mixin",c.error||"The given renderer is not supported by the layer."),t==="auto"&&this._configDefaultRenderer("override")}};function s(t){if(!t.raster||!t.rasterInfo)throw new P("imagery-tile","no raster")}return b([R({clonable:!1})],e.prototype,"_cachedRendererJson",void 0),b([R({clonable:!1})],e.prototype,"_cachedRasterFunctionJson",void 0),b([R({clonable:!1})],e.prototype,"_compatibleFullExtent",void 0),b([R({clonable:!1})],e.prototype,"_isConstructedFromFunctionRaster",void 0),b([R({clonable:!1})],e.prototype,"_rasterJobHandler",void 0),b([R()],e.prototype,"bandIds",void 0),b([R({json:{origins:{service:{read:{source:"copyrightText"}}}}})],e.prototype,"copyright",void 0),b([R({json:{read:!1}})],e.prototype,"fullExtent",null),b([R()],e.prototype,"interpolation",void 0),b([R()],e.prototype,"ioConfig",void 0),b([R({type:[mt],json:{write:!0}})],e.prototype,"multidimensionalDefinition",null),b([R({type:Zt,json:{write:!0}})],e.prototype,"multidimensionalSubset",void 0),b([R()],e.prototype,"raster",void 0),b([R({type:Be,json:{name:"renderingRule",write:!0}})],e.prototype,"rasterFunction",null),b([R()],e.prototype,"rasterInfo",void 0),b([R()],e.prototype,"sourceJSON",void 0),b([R({readOnly:!0,type:j,json:{read:!1}})],e.prototype,"spatialReference",void 0),b([R({type:te})],e.prototype,"tileInfo",void 0),b([R(ut)],e.prototype,"url",null),b([R({types:Qt,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){var i;const t=((i=this.renderer)==null?void 0:i.type)==="raster-stretch"&&this.renderer.stretchType==="none"&&!this.renderer.useGamma;return{enabled:!this.loaded||this.raster.tileType==="Raster"||!t}}},origins:{"web-scene":{types:ei,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:t=>({enabled:t&&t.type!=="vector-field"&&t.type!=="flow"})}}}}})],e.prototype,"renderer",null),b([St("renderer")],e.prototype,"readRenderer",null),b([R({clonable:!1})],e.prototype,"symbolizer",void 0),e=b([Q("esri.layers.ImageryTileMixin")],e),e};function Ki(a){const e=a.fields,s=a.records,t=e.some(c=>c.name.toLowerCase()==="oid")?"OBJECTID":"OID",i=[{name:t,type:"esriFieldTypeOID",alias:"OID"}].concat(e.map(c=>({name:c.name,type:"esriFieldType"+c.typeName,alias:c.name}))),r=i.map(c=>c.name),n=[];let l=0,o=0;return s.forEach(c=>{const u={};for(u[t]=l++,o=1;o0)for(;u.lengthn;){const p=[];s.getUint8(o)===32?(o+=1,c.forEach(h=>{if(h.type==="C")p.push(Ke(new Uint8Array(e,o,h.length)).trim());else if(h.type==="N")p.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,o,h.length)).trim(),10));else if(h.type==="F")p.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,o,h.length)).trim()));else if(h.type==="D"){const m=String.fromCharCode.apply(null,new Uint8Array(e,o,h.length)).trim();p.push(new Date(parseInt(m.substring(0,4),10),parseInt(m.substring(4,6),10)-1,parseInt(m.substring(6,8),10)))}o+=h.length}),u.push(p)):o+=n}}return{header:l,fields:c,records:u,recordSet:Ki({fields:c,records:u})}}}const ae=new Map;ae.set("int16","esriFieldTypeSmallInteger"),ae.set("int32","esriFieldTypeInteger"),ae.set("int64","esriFieldTypeInteger"),ae.set("float32","esriFieldTypeSingle"),ae.set("float64","esriFieldTypeDouble"),ae.set("text","esriFieldTypeString");const nt=8;let me=class extends ce{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:s}=await this.request(this.url+"/conf.json",{signal:e==null?void 0:e.signal});if(!this._validateHeader(s))throw new P("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:t,rasterInfo:i}=this._parseHeader(s);if(i.dataType==="thematic"){const r=await this._fetchAuxiliaryInformation();i.attributeTable=r}this._set("storageInfo",t),this._set("rasterInfo",i),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,s,t,i={}){const{transposeInfo:r}=this.rasterInfo.storageInfo,{transposedVariableName:n}=i,l=!(!r||!n),o=l?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(o<0)return null;const c=this._buildCacheFilePath(o,s,t,i.multidimensionalDefinition,n),u=this._getIndexRecordFromBundle(s,t,l),f=await this.request(c,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:i.signal});if(!f)return null;const p=new Uint8Array(f.data),h=this._getTileEndAndContentType(p,u);if(h.recordSize===0)return null;const m=await this.request(c,{range:{from:h.position,to:h.position+h.recordSize},responseType:"array-buffer",signal:i.signal});if(!m)return null;const[y,d]=this._getTileSize(l);return this.decodePixelBlock(m.data,{width:y,height:d,planes:null,pixelType:null,returnInterleaved:l})}_validateHeader(e){const s=["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"];return e&&e.type==="RasterInfo"&&!s.some(t=>!e[t])}_parseHeader(e){var Y,N,z,L,ee;const s=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:t,colormap:i,blockWidth:r,blockHeight:n,firstPyramidLevel:l,maximumPyramidLevel:o}=e,c=(Y=e.statistics)==null?void 0:Y.map(A=>({min:A.min,max:A.max,avg:A.mean,stddev:A.standardDeviation,median:A.median,mode:A.mode})),u=(L=(z=(N=e.histograms)==null?void 0:N[0])==null?void 0:z.counts)!=null&&L.length?e.histograms:null,f=e.extent.spatialReference,p=(ee=e.geodataXform)==null?void 0:ee.spatialReference,h=new j(f!=null&&f.wkid||f!=null&&f.wkt||f!=null&&f.wkt2?f:p);let m=new W({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:h});const y=new H({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:h}),d=Math.round((m.xmax-m.xmin)/y.x),x=Math.round((m.ymax-m.ymin)/y.y),g=this._parseTransform(e.geodataXform),w=g?m:null;g&&(m=g.forwardTransform(m),y.x=(m.xmax-m.xmin)/d,y.y=(m.ymax-m.ymin)/x);const I=e.properties??{},S=e.format.toLowerCase().replace("cache/",""),v=new H(e.origin.x,e.origin.y,h);let F,T,k,_;if(i!=null&&i.colors)for(F=[],T=0;T>>24,k<<8>>>24,k>>>24]);const C=e.LODInfos,O=[];for(T=0;T0)for(T=0;Tn.data).catch(()=>null),t=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then(n=>n.data).catch(()=>null),i=await Promise.all([s,t]);let r;if(i[0]){let n=i[0].fields;const l=i[0].values;if(n&&l){n=n.map(c=>({type:c.name==="OID"?"esriFieldTypeOID":ae.get(c.type),name:c.name,alias:c.alias||c.name}));const o=l.map(c=>({attributes:c}));n&&l&&(r={fields:n,features:o})}}return!r&&i[1]&&(r=yt.parse(i[1]).recordSet),ze.fromJSON(r)}_buildCacheFilePath(e,s,t,i,r){const n=this._getPackageSize(!!r),l=Math.floor(s/n)*n,o=Math.floor(t/n)*n,c="R"+this._toHexString4(l)+"C"+this._toHexString4(o);let u="L";u+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:f}=this.rasterInfo,p=i==null?void 0:i[0];if(f==null||!p)return`${this.url}/_alllayers/${u}/${c}.bundle`;let h="_yxs";if(!r){h=f.variables.find(d=>d.name===p.variableName).dimensions[0].values.indexOf(p.values[0]).toString(16);const y=4-h.length;for(let d=0;d0;)s="0"+s}return s}};b([R({readOnly:!0})],me.prototype,"storageInfo",void 0),b([R({type:String,json:{write:!0}})],me.prototype,"datasetFormat",void 0),me=b([Q("esri.layers.support.rasterDatasets.CloudRaster")],me);const Zi=me;let pe=class extends ce{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.data=null}async open(e){await this.init();const s=this.data,{pixelBlock:t,statistics:i,histograms:r,name:n,keyProperties:l,nativeExtent:o,transform:c}=this.data,{width:u,height:f,pixelType:p}=t,h=s.extent??new W({xmin:-.5,ymin:.5,xmax:u-.5,ymax:f-.5,spatialReference:new j({wkid:3857})}),m=s.isPseudoSpatialReference??!s.extent,y={x:h.width/u,y:h.height/f},d=new xe({width:u,height:f,pixelType:p,extent:h,nativeExtent:o,transform:c,pixelSize:y,spatialReference:h.spatialReference,bandCount:t.pixels.length,keyProperties:l||{},statistics:i,isPseudoSpatialReference:m,histograms:r});this.createRemoteDatasetStorageInfo(d,512,512),this._set("rasterInfo",d),this.updateTileInfo(),await this._buildInMemoryRaster(t,{width:512,height:512},e),this.datasetName=n,this.url="/InMemory/"+n}fetchRawTile(e,s,t,i={}){const r=this._pixelBlockTiles.get(`${e}/${s}/${t}`);return Promise.resolve(r)}async _buildInMemoryRaster(e,s,t){var u,f;const i=this.rasterInfo.storageInfo.maximumPyramidLevel,r=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:s,maximumPyramidLevel:i},t):Promise.resolve(wi(e,s,i)),n=this.rasterInfo.statistics!=null,l=this.rasterInfo.histograms!=null,o=n?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},t):Promise.resolve(Ii(e)),c=await ft([r,o]);if(!c[0].value&&c[1].value)throw new P("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=c[0].value,n||(this.rasterInfo.statistics=(u=c[1].value)==null?void 0:u.statistics),l||(this.rasterInfo.histograms=(f=c[1].value)==null?void 0:f.histograms)}};b([R({type:String,json:{write:!0}})],pe.prototype,"datasetFormat",void 0),b([R()],pe.prototype,"data",void 0),pe=b([Q("esri.layers.support.rasterDatasets.InMemoryRaster")],pe);const Qi=pe;function fe(a,e){if(!a||!e)return[];let s=e;e.includes("/")?(s=e.slice(0,e.indexOf("/")),e=e.slice(e.indexOf("/")+1)):e="";const t=[];if(e){const r=fe(a,s);for(let n=0;nt.push(l));return t}const i=a.getElementsByTagNameNS("*",s);if(!i||i.length===0)return[];for(let r=0;r0?e?X(t[0],e):t[0]:null}function Z(a,e=null){const s=e?X(a,e):a;let t;return s?(t=s.textContent||s.nodeValue,t?t.trim():null):null}function es(a,e){const s=fe(a,e),t=[];let i;for(let r=0;rNumber(s))}function le(a,e){const s=Z(a,e);return Number(s)}function Pe(a,e){var i;const s=(i=a==null?void 0:a.nodeName)==null?void 0:i.toLowerCase(),t=e.toLowerCase();return s.slice(s.lastIndexOf(":")+1)===t}function at(a,e){if(!a||!e)return null;const s=[];for(let t=0;tNumber(h));let l,o,c,u;fe(a,"Metadata/MDI").forEach(h=>{const m=Number(h.textContent??h.nodeValue);switch(h.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":l=m;break;case"STATISTICS_MAXIMUM":o=m;break;case"STATISTICS_MEAN":c=m;break;case"STATISTICS_STDDEV":u=m}});const f=le(a,"Metadata/SourceBandIndex");return{noDataValue:e,histogram:n!=null&&n.length&&t!=null&&i!=null?{min:t,max:i,size:r||n.length,counts:n}:null,sourceBandIndex:f,statistics:l!=null&&o!=null?{min:l,max:o,avg:c,stddev:u}:null}}function Fe(a){if(!a)return null;let e=Number(a);if(!isNaN(e)&&e!==0)return new j({wkid:e});if(a=String(a).trim(),vt(a))return new j({wkt2:a});const s=a.toUpperCase();if(s.startsWith("COMPD_CS")){if(!s.includes("VERTCS")||!s.includes("GEOGCS")&&!s.startsWith("PROJCS"))return null;const t=s.indexOf("VERTCS"),i=s.indexOf("PROJCS"),r=i>-1?i:s.indexOf("GEOGCS");if(r===-1)return null;const n=a.slice(r,a.lastIndexOf("]",t)+1).trim(),l=a.slice(t,a.lastIndexOf("]")).trim();e=Oe(n);const o=new j(e?{wkid:e}:{wkt:n}),c=Oe(l);return c&&(o.vcsWkid=c),o}return s.startsWith("GEOGCS")||s.startsWith("PROJCS")?(e=Oe(a),new j(e!==0?{wkid:e}:{wkt:a})):null}function Oe(a){var i;const e=a.replaceAll("]","[").replaceAll('"',"").split("[").map(r=>r.trim()).filter(r=>r!==""),s=e[e.length-1].split(","),t=(i=s[0])==null?void 0:i.toLowerCase();if((t==="epsg"||t==="esri")&&a.endsWith('"]]')){const r=Number(s[1]);if(!isNaN(r)&&r!==0)return r}return 0}function We(a){var t;if(((t=a==null?void 0:a.documentElement.tagName)==null?void 0:t.toLowerCase())!=="pamdataset")return{};const e={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};a.documentElement.childNodes.forEach(i=>{if(i.nodeType===1){if(Pe(i,"SRS")){if(!e.spatialReference){const r=Z(i);e.spatialReference=Fe(r)}}else if(Pe(i,"Metadata"))if(i.getAttribute("domain")==="xml:ESRI"){const{spatialReference:r,transform:n}=ts(i);e.transform=n,e.spatialReference||(e.spatialReference=r)}else fe(i,"MDI").forEach(r=>e.metadata[r.getAttribute("key")]=Z(r));else if(Pe(i,"PAMRasterBand")){const r=is(i);r.sourceBandIndex!=null&&e.rasterBands[r.sourceBandIndex]==null?e.rasterBands[r.sourceBandIndex]=r:e.rasterBands.push(r)}}});const s=e.rasterBands;if(s.length){const i=!!s[0].statistics;e.statistics=i?s.map(n=>n.statistics).filter(De):null;const r=!!s[0].histogram;e.histograms=r?s.map(n=>n.histogram).filter(De):null}return e}let Te=class extends ce{async open(a){await this.init();const e=await this._fetchData(a);let{spatialReference:s,statistics:t,histograms:i,transform:r}=await this._fetchAuxiliaryData(a);const n=!s;n&&(s=new j({wkid:3857})),i!=null&&i.length&&t==null&&(t=He(i));const{width:l,height:o}=e;let c=new W({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:s});const u=r?r.forwardTransform(c):c;let f=!0;if(r){const h=r.forwardCoefficients;f=h&&h[1]===0&&h[2]===0,f&&(r=null,c=u)}const p=new Qi({data:{extent:u,nativeExtent:c,transform:r,pixelBlock:e,statistics:t,histograms:i,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:n}});await p.open(),p.data=null,this._set("rasterInfo",p.rasterInfo),this._inMemoryRaster=p}fetchRawTile(a,e,s,t={}){return this._inMemoryRaster.fetchRawTile(a,e,s,t)}async _fetchData(a){const{data:e}=await this.request(this.url,{responseType:"array-buffer",signal:a==null?void 0:a.signal}),s=bi(e).toUpperCase();if(s!=="JPG"&&s!=="PNG"&&s!=="GIF"&&s!=="BMP")throw new P("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",s);const t=s.toLowerCase(),i=t==="gif"||t==="bmp"||!Tt("ios"),r=await this.decodePixelBlock(e,{format:t,useCanvas:i,hasNoZlibMask:!0});if(r==null)throw new P("image-aux-raster:open","the data cannot be decoded");return r}async _fetchAuxiliaryData(a){var c;const e=a==null?void 0:a.signal,s=this.ioConfig.skipExtensions??[],t=s.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:e}),i=this.datasetFormat,r=i==="JPG"?"jgw":i==="PNG"?"pgw":i==="BMP"?"bpw":null,n=r&&s.includes(r)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+r,{responseType:"text",signal:e}),l=await ft([t,n]);if(e!=null&&e.aborted)throw _t();const o=We((c=l[0].value)==null?void 0:c.data);if(!o.transform){const u=l[1].value?l[1].value.data.split(` +`).slice(0,6).map(f=>Number(f)):null;o.transform=(u==null?void 0:u.length)===6?new Le({forwardCoefficients:[u[4],u[5],u[0],-u[1],u[2],-u[3]]}):null}return o}};b([R({type:String,json:{write:!0}})],Te.prototype,"datasetFormat",void 0),Te=b([Q("esri.layers.support.rasterDatasets.ImageAuxRaster")],Te);const Re=Te;let ye=class extends ce{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(a){var F,T;await this.init();const e=a==null?void 0:a.signal,s=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:e});s.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const t=s.data;if(this.sourceJSON=t,!t)throw new P("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!t.tileInfo)throw new P("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const i=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=t.cacheType,this.tileType==null&&(i.includes(t.tileInfo.format.toLowerCase())?this.tileType="Map":t.tileInfo.format.toLowerCase()==="lerc"?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=((F=t.name)==null?void 0:F.slice(t.name.indexOf("/")+1))??"";const r=await this._fetchRasterInfo({signal:e});if(r==null)throw new P("image-server-raster:open","cannot initialize image service");li(r,t);const n=this.tileType==="Map"?ss(t.tileInfo,t):te.fromJSON(t.tileInfo);kt(n);const[l,o]=this._computeMinMaxLOD(r,n),{extent:c,pixelSize:u}=r,f=.5/r.width*u.x,p=Math.max(u.x,u.y),{lods:h}=n;(this.tileType!=="Map"&&t.maxScale!==0||Math.abs(u.x-u.y)>f||!h.some(k=>Math.abs(k.resolution-p){k.level>=o.level&&k.level<=l.level&&x.push({x:k.resolution,y:k.resolution}),_k.x-_.x);const w=this.computeBlockBoundary(c,y,d,n.origin,x,m),I=x.length>1?x.slice(1):null;let S;t.transposeInfo&&(S={tileSize:[t.transposeInfo.rows,t.transposeInfo.cols],packetSize:((T=r.keyProperties)==null?void 0:T._yxs.PacketSize)??0});const v=g.length<=1||g.length>=3&&g.slice(0,-1).every(k=>k===g[0])?g[0]??2:Math.round(10/(o.resolution/l.resolution)**(-1/m))/10;if(r.storageInfo=new ge({blockWidth:n.size[0],blockHeight:n.size[1],pyramidBlockWidth:n.size[0],pyramidBlockHeight:n.size[1],pyramidResolutions:I,pyramidScalingFactor:v,compression:n.format,origin:n.origin,firstPyramidLevel:1,maximumPyramidLevel:m,tileInfo:n,transposeInfo:S,blockBoundary:w}),this._fixGCSShift(r),this._set("rasterInfo",r),t.capabilities.toLowerCase().includes("tilemap")){const k={tileInfo:r.storageInfo.tileInfo,parsedUrl:Ft(this.url),url:this.url,tileServers:[]};this._tilemapCache=new Ct({layer:k})}}async fetchRawTile(a,e,s,t={}){const{storageInfo:i,extent:r}=this.rasterInfo,{transposeInfo:n}=i,l=n!=null&&!!t.transposedVariableName;if(this._slices&&!l&&t.sliceId==null)return null;const o=l?0:i.maximumPyramidLevel-a+this._levelOffset,c=`${this.url}/tile/${o}/${e}/${s}`,u=this._slices?l?{variable:t.transposedVariableName}:{sliceId:t.sliceId||0}:null,{data:f}=await this.request(c,{query:u,responseType:"array-buffer",signal:t.signal});if(!f)return null;const p=l?n.tileSize:i.tileInfo.size,h=await this.decodePixelBlock(f,{width:p[0],height:p[1],planes:null,pixelType:null,isPoint:this.tileType==="Elevation",returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue});if(h==null)return null;const m=i.blockBoundary[a];if(i.compression!=="jpg"||s>m.minCol&&sm.minRow&&e{const r=e.find(n=>i.variableName===n.variableName&&n.dimensionName===i.dimensionName);return r?(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])!==(Array.isArray(r.values[0])?`${r.values[0][0]}-${r.values[0][1]}`:r.values[0]):!0}))return s}return null}async fetchVariableStatisticsHistograms(a,e){var r,n,l;const s=this.request(this.url+"/statistics",{query:{variable:a,f:"json"},signal:e}).then(o=>{var c;return(c=o.data)==null?void 0:c.statistics}),t=this.request(this.url+"/histograms",{query:{variable:a,f:"json"},signal:e}).then(o=>{var c;return(c=o.data)==null?void 0:c.histograms}),i=await Promise.all([s,t]);return i[0]&&i[0].forEach(o=>{o.avg=o.mean,o.stddev=o.standardDeviation}),(l=(n=(r=i[1])==null?void 0:r[0])==null?void 0:n.counts)!=null&&l.length||(i[1]=null),{statistics:i[0]||null,histograms:i[1]||null}}async computeBestPyramidLevelForLocation(a,e={}){if(!this._tilemapCache)return 0;let s=this.identifyPixelLocation(a,0,e.datumTransformation);if(s===null)return null;let t=0;const{maximumPyramidLevel:i}=this.rasterInfo.storageInfo;let r=i-t+this._levelOffset;const n=s.srcLocation;for(;r>=0;){try{if(await this._tilemapCache.fetchAvailability(r,s.row,s.col,e)==="available")break}catch{}if(r--,t++,s=this.identifyPixelLocation(n,t,e.datumTransformation),s===null)return null}return r===-1||s==null?null:t}async _fetchRasterInfo(a){const e=this.sourceJSON;if(this.tileType==="Map"){const n=e.fullExtent||e.extent,l=Math.ceil((n.xmax-n.xmin)/e.pixelSizeX-.1),o=Math.ceil((n.ymax-n.ymin)/e.pixelSizeY-.1),c=j.fromJSON(e.spatialReference||n.spatialReference),u=new H({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:c});return new xe({width:l,height:o,bandCount:3,extent:W.fromJSON(n),spatialReference:c,pixelSize:u,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:s}=a,t=ci(this.url,this.sourceJSON,{signal:s,query:this.ioConfig.customFetchParameters}),i=e.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:s}).then(n=>{var l;return(l=n.data)==null?void 0:l.slices}).catch(()=>null):null,r=await Promise.all([t,i]);return this._slices=r[1],r[0]}_fixScaleInServiceInfo(){const{sourceJSON:a}=this;a.minScale&&a.minScale<0&&(a.minScale=0),a.maxScale&&a.maxScale<0&&(a.maxScale=0)}_fixGCSShift(a){const{extent:e,spatialReference:s}=a;e.xmin>-1&&e.xmax>181&&(s!=null&&s.wkid)&&s.isGeographic&&(a.nativeExtent=a.extent,a.transform=new Ji,a.extent=a.transform.forwardTransform(e))}_computeMinMaxLOD(a,e){const{pixelSize:s}=a,t=.5/a.width*s.x,{lods:i}=e,r=e.lodAt(Math.max.apply(null,i.map(p=>p.level))),n=e.lodAt(Math.min.apply(null,i.map(p=>p.level))),{tileType:l}=this;if(l==="Map")return this._levelOffset=i[0].level,[r,n];if(l==="Raster")return[i.find(p=>p.resolution===s.x)??r,n];const{minScale:o,maxScale:c}=this.sourceJSON;let u=r;c>0&&(u=i.find(p=>Math.abs(p.scale-c)p.scale>c).sort((p,h)=>p.scale>h.scale?1:-1)[0]??r));let f=n;return o>0&&(f=i.find(p=>Math.abs(p.scale-o)n!=null&&n>=i&&n<=r)});if(s!==0&&t!==0){const n=c=>Math.round(1e4*c)/1e4,l=s?n(s):1/0,o=t?n(t):-1/0;return te.fromJSON({...a,lods:a.lods.filter(c=>{const u=n(c.scale);return u<=l&&u>=o})})}return te.fromJSON(a)}b([R({type:String,json:{write:!0}})],ye.prototype,"datasetFormat",void 0),b([R()],ye.prototype,"tileType",void 0),ye=b([Q("esri.layers.support.rasterDatasets.ImageServerRaster")],ye);const rs=ye,K=new Map;K.set("Int8","s8"),K.set("UInt8","u8"),K.set("Int16","s16"),K.set("UInt16","u16"),K.set("Int32","s32"),K.set("UInt32","u32"),K.set("Float32","f32"),K.set("Float64","f32"),K.set("Double64","f32");const se=new Map;se.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),se.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),se.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),se.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let ue=class extends ce{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(a){var y;await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const e=a?a.signal:null,s=await this.request(this.url,{responseType:"xml",signal:e}),{rasterInfo:t,files:i}=this._parseHeader(s.data);if(((y=this.ioConfig.skipExtensions)==null?void 0:y.indexOf("aux.xml"))===-1){const d=await this._fetchAuxiliaryData(a);d!=null&&(t.statistics=d.statistics??t.statistics,t.histograms=d.histograms,d.histograms&&t.statistics==null&&(t.statistics=He(d.histograms)))}this._set("rasterInfo",t),this._files=i;const r=await this.request(i.index,{responseType:"array-buffer",signal:e});this._storageIndex=this._parseIndex(r.data);const{blockWidth:n,blockHeight:l}=this.rasterInfo.storageInfo,o=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:c,height:u}=this.rasterInfo,f=[],p=this._getBandSegmentCount();let h=0,m=-1;for(;h0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=m),this.updateTileInfo()}async fetchRawTile(a,e,s,t={}){const{blockWidth:i,blockHeight:r,blockBoundary:n}=this.rasterInfo.storageInfo,l=n[a];if(!l||l.maxRowe||l.minCol>s)return null;const{bandCount:o,pixelType:c}=this.rasterInfo,{ranges:u,actualTileWidth:f,actualTileHeight:p}=this._getTileLocation(a,e,s);if(!u||u.length===0)return null;if(u[0].from===0&&u[0].to===0){const _=new Uint8Array(i*r);return new ie({width:i,height:r,pixels:null,mask:_,validPixelCount:0})}const{bandIds:h}=this.ioConfig,m=this._getBandSegmentCount(),y=[];let d=0;for(d=0;d_.data.byteLength).reduce((_,C)=>_+C),w=new Uint8Array(g);let I=0;for(d=0;d1e24)for(d=0;d<_;d++)Math.abs((v.pixels[0][d]-F)/F)>1e-6&&(C[d]=1);else for(d=0;d<_;d++)v.pixels[0][d]!==F&&(C[d]=1);v.mask=C}let T=0,k=0;if(f!==i||p!==r){let _=v.mask;if(_)for(d=0;d0)throw new Error("invalid array buffer must be multiples of 16");let e,s,t,i,r,n;if(Ri){for(s=new Uint8Array(a),i=new ArrayBuffer(a.byteLength),t=new Uint8Array(i),r=0;rparseFloat(C)))),X(a,"MRF_META/CachedSource"))throw new P("mrf:open","currently does not support MRF referencing other data files");const y=X(a,"MRF_META/GeoTags"),d=X(y,"BoundingBox");let x,g=!1;if(d!=null){const C=parseFloat(d.getAttribute("minx")),O=parseFloat(d.getAttribute("miny")),D=parseFloat(d.getAttribute("maxx")),J=parseFloat(d.getAttribute("maxy")),M=Z(y,"Projection")||"";let $=j.WGS84;if(M!=="LOCAL_CS[]")if(M.toLowerCase().startsWith("epsg:")){const B=Number(M.slice(5));isNaN(B)||B===0||($=new j({wkid:B}))}else $=Fe(M)??j.WGS84;else g=!0,$=new j({wkid:3857});x=new W(C,O,D,J),x.spatialReference=$}else g=!0,x=new W({xmin:-.5,ymin:.5-i,xmax:t-.5,ymax:.5,spatialReference:new j({wkid:3857})});const w=X(a,"MRF_META/Rsets"),I=parseInt((w==null?void 0:w.getAttribute("scale"))||"2",10),S=x.spatialReference,v=new ge({origin:new H({x:x.xmin,y:x.ymax,spatialReference:S}),blockWidth:u,blockHeight:f,pyramidBlockWidth:u,pyramidBlockHeight:f,compression:n,pyramidScalingFactor:I}),F=new H({x:x.width/t,y:x.height/i,spatialReference:S}),T=new xe({width:t,height:i,extent:x,isPseudoSpatialReference:g,spatialReference:S,bandCount:r,pixelType:o,pixelSize:F,noDataValue:h,storageInfo:v}),k=Z(a,"datafile"),_=Z(a,"IndexFile");return{rasterInfo:T,files:{mrf:this.url,index:_||this.url.replace(".mrf",".idx"),data:k||this.url.replace(".mrf",se.get(n).blobExtension)}}}async _fetchAuxiliaryData(a){try{const{data:e}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:a==null?void 0:a.signal});return We(e)}catch{return null}}};b([R()],ue.prototype,"_files",void 0),b([R()],ue.prototype,"_storageIndex",void 0),b([R({type:String,json:{write:!0}})],ue.prototype,"datasetFormat",void 0),ue=b([Q("esri.layers.support.rasterIO.MRFRaster")],ue);const ns=ue,$e=(a,e)=>{var s;return(s=a.get(e))==null?void 0:s.values},de=(a,e)=>{var s,t;return(t=(s=a.get(e))==null?void 0:s.values)==null?void 0:t[0]};let oe=class extends ce{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(a){var m,y,d,x;await this.init();const e=a?a.signal:null,{data:s}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:e});if(!s)throw new P("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:t,firstIFDPos:i,isBigTiff:r}=vi(s),n=[];await this._readIFDs(n,s,t,i,0,r?8:4,e);const{imageInfo:l,rasterInfo:o}=this._parseIFDs(n),c=Ti(n),u=_i(n);if(this._headerInfo={littleEndian:t,isBigTiff:r,ifds:n,pyramidIFDs:c,maskIFDs:u,...l},this._set("rasterInfo",o),!l.isSupported)throw new P("tiffraster:open","this tiff is not supported: "+l.message);if(!l.tileWidth)throw new P("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");o.isPseudoSpatialReference&&_e.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");const f=(y=(m=n[0].get("PREDICTOR"))==null?void 0:m.values)==null?void 0:y[0];if(((x=(d=n[0].get("SAMPLEFORMAT"))==null?void 0:d.values)==null?void 0:x[0])===3&&f===2)throw new P("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floatting point data");const{skipExtensions:h=[]}=this.ioConfig;if(!h.includes("aux.xml")){const g=await this._fetchAuxiliaryMetaData(a);g!=null&&this._processPAMInfo(g,o)}h.includes("vat.dbf")||o.bandCount!==1||o.pixelType!=="u8"||(o.attributeTable=await this._fetchAuxiliaryTable(a),o.attributeTable!=null&&(o.keyProperties.DataType="thematic")),this.updateTileInfo()}async fetchRawTile(a,e,s,t={}){var r;if(!((r=this._headerInfo)!=null&&r.isSupported)||this.isBlockOutside(a,e,s))return null;const i=await this._fetchRawTiffTile(a,e,s,!1,t);if(i!=null&&this._headerInfo.hasMaskBand){const n=await this._fetchRawTiffTile(a,e,s,!0,t);n!=null&&n.pixels[0]instanceof Uint8Array&&(i.mask=n.pixels[0])}return i}_parseIFDs(a){var O,D;const e=ki(a),{width:s,height:t,tileWidth:i,tileHeight:r,planes:n,pixelType:l,compression:o,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidBlockWidth:f,pyramidBlockHeight:p,tileBoundary:h,affine:m,metadata:y}=e,d=((O=e.extent.spatialReference)==null?void 0:O.wkt)||((D=e.extent.spatialReference)==null?void 0:D.wkid);let x=Fe(d),g=!!e.isPseudoGeographic;x==null&&(g=!0,x=new j({wkid:3857}));const w=new W({...e.extent,spatialReference:x}),I=new H(w?{x:w.xmin,y:w.ymax,spatialReference:x}:{x:0,y:0}),S=new ge({blockWidth:i,blockHeight:r,pyramidBlockWidth:f,pyramidBlockHeight:p,compression:o,origin:I,firstPyramidLevel:c,maximumPyramidLevel:u,blockBoundary:h}),v=new H({x:(w.xmax-w.xmin)/s,y:(w.ymax-w.ymin)/t,spatialReference:x}),F=y?{BandProperties:y.bandProperties,DataType:y.dataType}:{};let T=null;const k=de(a[0],"PHOTOMETRICINTERPRETATION"),_=$e(a[0],"COLORMAP");if(k<=3&&(_==null?void 0:_.length)>3&&_.length%3==0){T=[];const J=_.length/3;for(let M=0;M>>8,_[M+J]>>>8,_[M+2*J]>>>8])}const C=new xe({width:s,height:t,bandCount:n,pixelType:l,pixelSize:v,storageInfo:S,spatialReference:x,isPseudoSpatialReference:g,keyProperties:F,extent:w,colormap:T,statistics:y?y.statistics:null});return m!=null&&m.length&&(C.nativeExtent=new W({xmin:-.5,ymin:.5-t,xmax:s-.5,ymax:.5,spatialReference:x}),C.transform=new Le({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),C.extent=C.transform.forwardTransform(C.nativeExtent),C.pixelSize=new H({x:(w.xmax-w.xmin)/s,y:(w.ymax-w.ymin)/t,spatialReference:x}),S.origin.x=-.5,S.origin.y=.5),{imageInfo:e,rasterInfo:C}}_processPAMInfo(a,e){if(e.statistics=a.statistics??e.statistics,e.histograms=a.histograms,a.histograms&&e.statistics==null&&(e.statistics=He(a.histograms)),a.transform&&e.transform==null){e.transform=a.transform,e.nativeExtent=e.extent;const s=e.transform.forwardTransform(e.nativeExtent);e.pixelSize=new H({x:(s.xmax-s.xmin)/e.width,y:(s.ymax-s.ymin)/e.height,spatialReference:e.spatialReference}),e.extent=s}e.isPseudoSpatialReference&&a.spatialReference&&(e.spatialReference=a.spatialReference,e.extent.spatialReference=e.nativeExtent.spatialReference=e.storageInfo.origin.spatialReference=e.spatialReference)}async _readIFDs(a,e,s,t,i,r=4,n){if(!t)return null;(t>=e.byteLength||t<0)&&(e=(await this.request(this.url,{range:{from:t+i,to:t+i+this._bufferSize},responseType:"array-buffer",signal:n})).data,i=t+i,t=0);const l=await this._readIFD(e,s,t,i,Ie.tiffTags,r,n);if(a.push(l.ifd),!l.nextIFD)return null;await this._readIFDs(a,e,s,l.nextIFD-i,i,r,n)}async _readIFD(a,e,s,t,i=Ie.tiffTags,r=4,n){var o,c;if(!a)return null;const l=Fi(a,e,s,t,i,r);if(l.success){const u=[];if((o=l.ifd)==null||o.forEach(f=>{f.values||u.push(f)}),u.length>0){const f=u.map(h=>h.offlineOffsetSize).filter(De),p=Math.min.apply(null,f.map(h=>h[0]));if(Math.min.apply(null,f.map(h=>h[0]+h[1]))-p<=this._bufferSize){const{data:h}=await this.request(this.url,{range:{from:p,to:p+this._bufferSize},responseType:"array-buffer",signal:n});a=h,t=p,u.forEach(m=>Ci(a,e,m,t))}}if((c=l.ifd)!=null&&c.has("GEOKEYDIRECTORY")){const f=l.ifd.get("GEOKEYDIRECTORY"),p=f==null?void 0:f.values;if(p&&p.length>4){const h=p[0]+"."+p[1]+"."+p[2],m=await this._readIFD(a,e,f.valueOffset+6-t,t,Ie.geoKeys,2,n);f.data=m.ifd,f.data&&f.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[h]})}}return l}if(l.requiredBufferSize&&l.requiredBufferSize!==a.byteLength)return(a=(await this.request(this.url,{range:{from:t,to:t+l.requiredBufferSize+4},responseType:"array-buffer",signal:n})).data).byteLengththis.request(this.url,{range:v,responseType:"array-buffer",signal:i.signal})),f=await Promise.all(u),p=f.map(v=>v.data.byteLength).reduce((v,F)=>v+F),h=f.length===1?f[0].data:new ArrayBuffer(p),m=[0],y=[0];if(f.length>1){const v=new Uint8Array(h);for(let F=0,T=0;Fm||s>y||ee.add(t)),e}static async open(e){const{url:s,ioConfig:t,sourceJSON:i}=e;let r=e.datasetFormat;r==null&&s.lastIndexOf(".")&&(r=s.slice(s.lastIndexOf(".")+1).toUpperCase()),r==="OVR"||r==="TIF"?r="TIFF":r!=="JPG"&&r!=="JPEG"&&r!=="JFIF"||(r="JPG"),s.toLowerCase().includes("/imageserver")&&!s.toLowerCase().includes("/wcsserver")&&(r="RasterTileServer");const n={url:s,sourceJSON:i,datasetFormat:r,ioConfig:t??{bandIds:null,sampling:null}};let l,o;if(r&&this.supportedFormats.has(r)){if(r==="CRF"&&!(t!=null&&t.enableCRF))throw new P("rasterfactory:open",`cannot open raster: ${s}`);return l=G.get(r).constructor,o=new l(n),await o.open({signal:e.signal}),o}if(r)throw new P("rasterfactory:open","not a supported format "+r);const c=Array.from(G.keys());let u=0;const f=()=>(r=c[u++],r&&(r!=="CRF"||t!=null&&t.enableCRF)?(l=G.get(r).constructor,o=new l(n),o.open({signal:e.signal}).then(()=>o).catch(()=>f())):null);return f()}static register(e,s,t){G.has(e.toUpperCase())||G.set(e.toUpperCase(),{desc:s,constructor:t})}}let E=class extends Mt(Pt(Ot($t(Vt(Yi(Dt(Bt(At(Et(Jt(Ut))))))))))){constructor(...a){super(...a),this._primaryRasters=[],this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this._debouncedSaveOperations=Nt(async(e,s,t)=>{const{save:i,saveAs:r}=await ht(()=>import("./imageryUtils-UiAX5Jos.js"),__vite__mapDeps([2,3,0,1,4]));switch(e){case we.SAVE:return i(this,s);case we.SAVE_AS:return r(this,t,s)}})}normalizeCtorArgs(a,e){return typeof a=="string"?{url:a,...e}:a}load(a){const e=a!=null?a.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},a).catch(zt).then(()=>this._openRaster(e))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){var l;const a=[new he({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new he({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],{rasterInfo:e}=this,s=e==null?void 0:e.attributeTable,t=s!=null?s.fields:null,i="Raster.";if(t){const o=t.filter(c=>c.type!=="oid"&&c.name.toLowerCase()!=="value").map(c=>{const u=c.clone();return u.name=i+c.name,u});a.push(...o)}const r=e==null?void 0:e.dataType,n=e==null?void 0:e.multidimensionalInfo;if((r==="vector-magdir"||r==="vector-uv")&&n!=null){const o=(l=n.variables[0].unit)==null?void 0:l.trim(),c="Magnitude"+(o?` (${o})`:"");a.push(new he({name:"Raster.Magnitude",alias:c,domain:null,editable:!1,type:"double"})),a.push(new he({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return a}createPopupTemplate(a){const{rasterFields:e}=this,s=new Set(e.map(({name:t})=>t).filter(t=>t.toLowerCase()!=="raster.servicepixelvalue.raw"));return Ht({fields:e,title:this.title},{...a,visibleFieldNames:s})}async generateRasterInfo(a,e){var s;if(!(a=Ne(Be,a)))return this.rasterInfo;try{const t={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(n=>t[n.url]=n);const i=Ee(((s=a.functionDefinition)==null?void 0:s.toJSON())??a.toJSON(),t),r=new Je({rasterFunction:i});return await r.open(e),r.rasterInfo}catch(t){throw t instanceof P?t:new P("imagery-tile-layer","the given raster function is not supported")}}async save(a){return this._debouncedSaveOperations(we.SAVE,a)}async saveAs(a,e){return this._debouncedSaveOperations(we.SAVE_AS,e,a)}write(a,e){const s=this._primaryRasters[0]??this.raster;if(this.loaded?s.datasetFormat==="RasterTileServer"&&(s.tileType==="Raster"||s.tileType==="Map"):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(a,e);if(e!=null&&e.messages){const t=`${e.origin}/${e.layerContainerType||"operational-layers"}`;e.messages.push(new P("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${t}'`,{layer:this}))}return null}async _openRaster(a){var t;let e=!1;if(this.raster)this.raster.rasterInfo||await this.raster.open(),this.raster.datasetFormat==="Function"?(e=!0,this._primaryRasters=this.raster.primaryRasters.rasters):this._primaryRasters=[this.raster],this.url=this.raster.url;else{const{rasterFunction:i}=this,r=[this.url];i&&Ni(i.toJSON(),r);const n=await Promise.all(r.map(o=>os.open({url:o,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:a}))),l=n.findIndex(o=>o==null);if(l>-1)throw new P("imagery-tile-layer:open",`cannot open raster: ${r[l]}`);if(this._primaryRasters=n,i){const o={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(f=>o[f.url]=f);const c=Ee(((t=i.functionDefinition)==null?void 0:t.toJSON())??i.toJSON(),o),u=new Je({rasterFunction:c});try{await u.open(),this.raster=u}catch(f){const p=_e.getLogger(this);f instanceof P&&p.error("imagery-tile-layer:open",f.message),p.warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=n[0]}}else this.raster=n[0]}const s=this.raster.rasterInfo;if(!s)throw new P("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("rasterInfo",e?s:this._primaryRasters[0].rasterInfo),this._set("spatialReference",s.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,this.sourceJSON!=null){const i=this.raster.tileType==="Map"&&this.sourceJSON.minLOD!=null&&this.sourceJSON.maxLOD!=null?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(i,{origin:"service"})}else this.read({tileInfo:this.rasterInfo.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),this.raster.tileType==="Map"&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(Lt(()=>this.customParameters,i=>{this.raster&&(this.raster.ioConfig.customFetchParameters=i)}))}};b([R({clonable:!1})],E.prototype,"_primaryRasters",void 0),b([R({type:[Wt],json:{write:{overridePolicy(){var a;return{enabled:!this.loaded||this.raster.tileType==="Raster"||((a=this.bandIds)==null?void 0:a.join(","))!=="0,1,2"}}}}})],E.prototype,"bandIds",void 0),b([R({json:{write:{overridePolicy(){return{enabled:!this.loaded||this.raster.tileType==="Raster"||this.interpolation!=="bilinear"}}}}}),jt(ui)],E.prototype,"interpolation",void 0),b([R(qt)],E.prototype,"legendEnabled",void 0),b([R({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],E.prototype,"isReference",void 0),b([R({type:["show","hide"]})],E.prototype,"listMode",void 0),b([R({json:{read:!0,write:!0}})],E.prototype,"blendMode",void 0),b([R()],E.prototype,"sourceJSON",void 0),b([R({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],E.prototype,"version",void 0),b([R({readOnly:!0,json:{read:!1}})],E.prototype,"type",void 0),b([R({type:["ArcGISTiledImageServiceLayer"]})],E.prototype,"operationalLayerType",void 0),b([R({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(a,e)=>!e.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||this.raster.tileType==="Raster"}},writer(a,e,s){e[s]=!a}}}})],E.prototype,"popupEnabled",void 0),b([R({type:Gt,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||this.raster.tileType==="Raster"}}}}})],E.prototype,"popupTemplate",void 0),b([R({readOnly:!0})],E.prototype,"defaultPopupTemplate",null),b([R({readOnly:!0,type:[he]})],E.prototype,"fields",void 0),b([R({readOnly:!0,type:[he]})],E.prototype,"rasterFields",null),E=b([Q("esri.layers.ImageryTileLayer")],E);const Is=E;export{Is as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/imageryUtils-UiAX5Jos.js","assets/utils-YxtTVBu2.js","assets/jsonContext-EgdQULbU.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/ImageryTileLayer-ce5u7kmi.js b/dist/assets/ImageryTileLayer-ce5u7kmi.js deleted file mode 100644 index bc2270c..0000000 --- a/dist/assets/ImageryTileLayer-ce5u7kmi.js +++ /dev/null @@ -1,8 +0,0 @@ -import{cZ as xt,e$ as te,u7 as ot,Z as _e,E as P,g0 as Ne,T as H,dT as W,bW as lt,f0 as ct,fZ as wt,u8 as It,e as b,y as R,dW as ut,c as Q,dr as bt,de as ht,e2 as qe,ar as j,dt as St,e4 as Rt,jG as ft,u9 as vt,e3 as De,dJ as Tt,jP as _t,iZ as kt,bV as Ft,pb as Mt,dK as Ct,dO as Pt,dM as Ot,dN as $t,el as Dt,em as Bt,dL as Jt,dP as zt,dq as Et,ah as Nt,dQ as At,dw as he,il as Ht,jc as we,d as Lt,ey as Wt,iw as jt,dV as qt,iv as Gt,c7 as Vt}from"./index-J0iiHjMT.js";import{o as Ut}from"./CustomParametersMixin-Y1bOcayO.js";import{h as dt,D as Xt,i as Yt,a as Kt,p as mt,c as Zt,N as Be,l as Qt,d as ei,b as ti,e as ii,f as Ge,o as si,g as Ve,K as Ue,B as Xe,j as ri,S as ni,E as ai,V as Ye,t as oi,k as li,m as ci,n as ui}from"./ImageHistogramParameters-sFtZwJ9j.js";import{U as Me,j as hi,n as ge,R as pt,I as fi,a as di,l as mi,u as ie,f as pi,m as yi,s as gi,L as xi,r as Ke,b as xe,W as wi,h as Ii,g as Ae,P as bi,T as Si,c as Ri,F as vi,d as Ti,N as _i,e as ki,i as Ie,B as Fi,k as Mi,D as Ci}from"./dataUtils-s_UKlouc.js";import{T as Je,D as be,j as Ze,r as Qe,o as Pi,V as Ce,J as ve,e as Oi,Z as $i,C as Di,U as Bi}from"./rasterProjectionHelper-KvYWHIT_.js";import{d as He}from"./FeatureSet-d4S1oKME.js";import{R as ze,f as Ji,i as zi,y as Le,n as Ei,C as Ni}from"./utils-4xKNo3Tf.js";import"./generateRendererUtils-_1jVE02H.js";let Ai=class{constructor(e=15e3,s=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=e,this._interval=Math.min(e,s)}decreaseRefCount(e,s){const t=e+"/"+s,i=this._cachedBlocks;if(i.has(t)){const r=i.get(t);return r.refCount--,r.refCount<=0&&(i.delete(t),r.controller&&r.controller.abort()),r.refCount}return 0}getBlock(e,s){const t=e+"/"+s,i=this._cachedBlocks;if(i.has(t)){const r=i.get(t);return r.ts=Date.now(),r.refCount++,i.delete(t),i.set(t,r),r.block}return null}putBlock(e,s,t,i){const r=this._cachedBlocks,n=e+"/"+s;if(r.has(n)){const l=r.get(n);l.ts=Date.now(),l.refCount++}else r.set(n,{block:t,ts:Date.now(),refCount:1,controller:i});this._trim(),this._updateTimer()}deleteBlock(e,s){const t=this._cachedBlocks,i=e+"/"+s;t.has(i)&&t.delete(i)}updateMaxSize(e){this._size=e,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(this._timer!=null)return;const e=this._cachedBlocks;this._timer=setInterval(()=>{const s=Array.from(e),t=Date.now();for(let i=0;i=e.size)return;const s=Array.from(e);for(let t=0;tn.isResolved=!0).catch(()=>n.isRejected=!0),(l=r[e])==null||l.cache.set(s,n)}function Li(a,e,s){var i;const t=ke.get(a);t?e!=null&&t[e]!=null?(i=t[e])==null||i.cache.delete(s):re.deleteBlock(a,s):e==null&&re.deleteBlock(a,s)}const st=8,Wi=256;let q=class extends xt(bt){constructor(){super(...arguments),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=Je();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e!=null&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:te.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,s=be(e.spatialReference);return s!=null&&e.extent.width>=s/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return e==null||e.type==="gcs-shift"}set rasterJobHandler(e){var s,t;this._set("rasterJobHandler",e),this.datasetFormat==="Function"&&((t=(s=this.primaryRasters)==null?void 0:s.rasters)==null||t.forEach(i=>i.rasterJobHandler=e))}set url(e){this._set("url",ot(e,_e.getLogger(this)))}async open(e){throw new P("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,s,t,i={}){const r=i.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,s,t,r);return this.fetchPixels(n,r.size[0],r.size[1],i)}async identify(e,s={}){var O;e=Ne(H,e).clone().normalize();const{multidimensionalDefinition:t,timeExtent:i}=s,{rasterInfo:r}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:l}=r;let{transposedVariableName:o}=s;const c=l!=null&&n&&(i!=null||dt(t));c&&!o&&(o=t!=null&&t.length>0?t[0].variableName??void 0:l.variables[0].name,s={...s,transposedVariableName:o}),s=this._getRequestOptionsWithSliceId(s);const{spatialReference:u,extent:f}=r,{datumTransformation:p}=s;let h=Ze(e,u,p);if(!f.intersects(h))return{location:h,value:null};if(r.transform!=null){const D=r.transform.inverseTransform(h);if(!r.nativeExtent.intersects(D))return{location:D,value:null};h=D}let m=0;const y=o!=null&&l!=null&&r.hasMultidimensionalTranspose;if(this.datasetFormat==="Function"){const D=this.primaryRasters.rasters[0];if(y)return D.identify(h,s);const{pixelSize:E}=r,C=3,$=E.x*C/2,B=E.y*C/2,V=new W({xmin:h.x-$,xmax:h.x+$,ymin:h.y-B,ymax:h.y+B,spatialReference:u}),Y={interpolation:"nearest"},{pixelBlock:N}=await D.fetchPixels(V,C,C,Y),{pixelBlock:A}=await this.fetchPixels(V,C,C,Y);if(N==null)return{location:h,value:null};const L=Math.floor(C*C*.5),ee=!N.mask||N.mask[L]?N.pixels.map(U=>U[L]):null;let J;return A!=null&&(J=!A.mask||A.mask[L]?A.pixels.map(U=>U[L]):void 0),{location:h,value:ee,processedValue:J,pyramidLevel:0}}if(!y){if(s.srcResolution)m=Qe(s.srcResolution,r,this.ioConfig.sampling).pyramidLevel;else if(m=await this.computeBestPyramidLevelForLocation(e,s),m==null)return{location:h,value:null}}const d=this.identifyPixelLocation(h,m,null,y);if(d===null)return{location:h,value:null};const{row:x,col:g,rowOffset:w,colOffset:I,blockWidth:S}=d,v=o??s.sliceId,F=et(this.url,v),T=`${m}/${x}/${g}`;let k=tt(F,null,T);k==null&&(k=this.fetchRawTile(m,x,g,s),it(F,null,T,k));const _=await k;if(!((O=_==null?void 0:_.pixels)!=null&&O.length))return{location:h,value:null};const M=w*S+I;return this._processIdentifyResult(_,{srcLocation:h,position:M,pyramidLevel:m,useTransposedTile:!!y,requestSomeSlices:c,identifyOptions:s})}async fetchPixels(e,s,t,i={}){e=Pi(e),i=this._getRequestOptionsWithSliceId(i);const{_hasNoneOrGCSShiftTransform:r}=this;if(i.requestRawData&&r)return this._fetchPixels(e,s,t,i);const n=be(e.spatialReference),l=Ce(e);if(n==null||l===0||l===1&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,s,t,i);if(l>=3)return{extent:e,pixelBlock:null};const o=[],{xmin:c,xmax:u}=e,f=Math.round(n/(u-c)*s),p=f-Math.round((n/2-c)/(u-c)*s);let h=0;const m=[];for(let g=0;g<=l;g++){const w=new W({xmin:g===0?c:-n/2,xmax:g===l?u-n*g:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),I=g===0?f-p:g===l?s-h:f;h+=I,m.push(I);const S=i.disableWrapAround&&g>0?null:this._fetchPixels(w,I,t,i);o.push(S)}const y=(await Promise.all(o)).map(g=>g==null?void 0:g.pixelBlock);let d=null;const x={width:s,height:t};return this.rasterJobHandler?d=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:y,srcMosaicSize:x,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:m},i)).pixelBlock:d=Me(y,x,{blockWidths:m}),{extent:e,srcExtent:ve(e,this.rasterInfo.spatialReference,i.datumTransformation),pixelBlock:d}}async fetchRawPixels(e,s,t,i={}){s={x:Math.floor(s.x),y:Math.floor(s.y)};const r=await this._fetchRawTiles(e,s,t,i),{nativeExtent:n,nativePixelSize:l,storageInfo:o}=this.rasterInfo,c=2**e,u=l.x*c,f=l.y*c,p=new W({xmin:n.xmin+u*s.x,xmax:n.xmin+u*(s.x+t.width-1),ymin:n.ymax-f*(s.y+t.height-1),ymax:n.ymax-f*s.y,spatialReference:n.spatialReference});if(!r)return{extent:p,srcExtent:p,pixelBlock:null};const{pixelBlocks:h,mosaicSize:m}=r;if(h.length===1&&h[0]!=null&&h[0].width===t.width&&h[0].height===t.height)return{extent:p,srcExtent:p,pixelBlock:r.pixelBlocks[0]};const y=e>0?o.pyramidBlockWidth:o.blockWidth,d=e>0?o.pyramidBlockHeight:o.blockHeight,x={x:s.x%y,y:s.y%d};let g;return this.rasterJobHandler?g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:h,srcMosaicSize:m,destDimension:t,clipOffset:x,clipSize:t,coefs:null,sampleSpacing:null,interpolation:i.interpolation,alignmentInfo:null,blockWidths:null},i)).pixelBlock:g=Me(h,m,{clipOffset:x,clipSize:t}),{extent:p,srcExtent:p,pixelBlock:g}}fetchRawTile(e,s,t,i){throw new P("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return ve(this.rasterInfo.extent,e)}decodePixelBlock(e,s){return!this.rasterJobHandler||s.useCanvas?hi(e,s):this.rasterJobHandler.decode({data:e,options:s})}async request(e,s,t=0){const{customFetchParameters:i}=this.ioConfig,{range:r,query:n,headers:l}=s;t=t??s.retryCount??this.ioConfig.retryCount;const o=r?{Range:`bytes=${r.from}-${r.to}`}:null;try{return await lt(e,{...s,query:{...n,...i},headers:{...l,...o}})}catch(c){if(t>0)return t--,this.request(e,s,t);throw c}}getSliceIndex(e){const{multidimensionalInfo:s}=this.rasterInfo;return s==null||e==null||e.length===0?null:Xt(e,s)}getTileExtentFromTileInfo(e,s,t,i){const r=i.lodAt(e);return this.getTileExtent({x:r.resolution,y:r.resolution},s,t,i.origin,i.spatialReference,i.size)}updateTileInfo(){const{storageInfo:e,spatialReference:s,extent:t,pixelSize:i}=this.rasterInfo;if(!e.tileInfo){const r=[],n=e.maximumPyramidLevel||0;let l=Math.max(i.x,i.y),o=1/.0254*96*l;for(let u=0;u<=n;u++)r.unshift(new ct({level:n-u,resolution:l,scale:o})),l*=2,o*=2;const c=new H({x:t.xmin,y:t.ymax,spatialReference:s});e.tileInfo=new te({origin:c,size:[e.blockWidth,e.blockHeight],spatialReference:s,lods:r}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,s=512,t=512,i){const{width:r,height:n,nativeExtent:l,pixelSize:o,spatialReference:c}=e,u=new H({x:l.xmin,y:l.ymax,spatialReference:c});i==null&&(i=Math.max(0,Math.round(Math.log(Math.max(r,n))/Math.LN2-8)));const f=this.computeBlockBoundary(l,512,512,{x:l.xmin,y:l.ymax},[o],i);e.storageInfo=new ge({blockWidth:s,blockHeight:t,pyramidBlockWidth:s,pyramidBlockHeight:t,origin:u,firstPyramidLevel:1,maximumPyramidLevel:i,blockBoundary:f})}async computeBestPyramidLevelForLocation(e,s={}){return 0}computeBlockBoundary(e,s,t,i,r,n=0,l=2){if(r.length===1&&n>0){r=[...r];let{x:f,y:p}=r[0];for(let h=0;ho)return null;const m=this.getPyramidPixelSize(s),{x:y,y:d}=m,x=(c.y-h.y)/d/p,g=(h.x-c.x)/y/f,w=Math.min(p-1,Math.floor((x-Math.floor(x))*p)),I=Math.min(f-1,Math.floor((g-Math.floor(g))*f));return{pyramidLevel:s,row:Math.floor(x),col:Math.floor(g),rowOffset:w,colOffset:I,blockWidth:f,srcLocation:h}}getTileExtent(e,s,t,i,r,n){const[l,o]=n,c=i.x+t*l*e.x,u=c+l*e.x,f=i.y-s*o*e.y,p=f-o*e.y;return new W({xmin:c,xmax:u,ymin:p,ymax:f,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,s,t){const i=this.rasterInfo.storageInfo.blockBoundary[e];return!i||i.maxRows||i.minCol>t}async _fetchPixels(e,s,t,i={}){let r=Ce(e);if(r>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,s,t,i),{pyramidLevel:l,srcResolution:o,srcExtent:c,srcWidth:u,srcHeight:f,ul:p}=n;if(u===0||f===0)return{extent:e,srcExtent:c,pixelBlock:null};const{rasterInfo:h}=this,m=h.transform,y=(m==null?void 0:m.type)==="gcs-shift",d=be(e.spatialReference)!=null;!y&&d||(r=Ce(n.srcExtent,y));const x=await this._fetchRawTiles(l,p,{width:u,height:f,wrapCount:r},i);if(!x)return{extent:e,srcExtent:c,pixelBlock:null};const g=h.storageInfo,w=l>0?g.pyramidBlockWidth:g.blockWidth,I=l>0?g.pyramidBlockHeight:g.blockHeight;let{x:S,y:v}=h.pixelSize;if(l>0){const{pyramidResolutions:U,pyramidScalingFactor:gt}=g;if(U!=null&&U[l-1])({x:S,y:v}=U[l-1]);else{const je=gt**l;S*=je,v*=je}}const F=h.spatialReference,T=new H({x:S,y:v,spatialReference:F}),k=w===u&&I===f&&p.x%w==0&&p.y%I==0,_=new H({x:(e.xmax-e.xmin)/s,y:(e.ymax-e.ymin)/t,spatialReference:e.spatialReference}),M=!e.spatialReference.equals(F),O=F.isGeographic?1e-9:1e-4,{datumTransformation:D}=i;if(!M&&k&&x.pixelBlocks.length===1&&w===s&&I===t&&this._isSameResolution(o,_,O))return{extent:e,srcExtent:c,srcTilePixelSize:T,pixelBlock:x.pixelBlocks[0]};const E=d&&be(c.spatialReference)!=null&&this._hasNoneOrGCSShiftTransform,C=i.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");C&&!this.rasterJobHandler&&await Je();const $=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:x.extent,pixelSize:_.toJSON(),datumTransformation:D,rasterTransform:m,hasWrapAround:r>0||E,isAdaptive:this.ioConfig.optimizeProjectionAccuracy!==!1,includeGCSGrid:C},i):Oi({projectedExtent:e,srcBufferExtent:x.extent,pixelSize:_,datumTransformation:D,rasterTransform:m,hasWrapAround:r>0||E,isAdaptive:!1,includeGCSGrid:C});let B;const V=!i.requestRawData,Y={rows:$.spacing[0],cols:$.spacing[1]},N=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(l,x.extent.xmin):void 0,{pixelBlocks:A,mosaicSize:L,isPartiallyFilled:ee}=x;let J=null;if(this.rasterJobHandler)({pixelBlock:B,localNorthDirections:J}=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:A,srcMosaicSize:L,destDimension:V?{width:s,height:t}:null,coefs:V?$.coefficients:null,sampleSpacing:V?Y:null,projectDirections:C,gcsGrid:C?$.gcsGrid:null,isUV:this.rasterInfo.dataType==="vector-uv",interpolation:i.interpolation,alignmentInfo:N,blockWidths:null},i));else{const U=Me(A,L,{alignmentInfo:N});B=V?pt(U,{width:s,height:t},$.coefficients,Y,i.interpolation):U,C&&$.gcsGrid&&(J=fi({width:s,height:t},$.gcsGrid),B=di(B,this.rasterInfo.dataType,J))}return i.requestRawData||C?{extent:e,srcExtent:c,srcTilePixelSize:T,pixelBlock:B,transformGrid:$,localNorthDirections:J,isPartiallyFilled:ee}:{extent:e,srcExtent:c,srcTilePixelSize:T,pixelBlock:B}}async _fetchRawTiles(e,s,t,i){const{origin:r,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:l,blockHeight:o}=this.getBlockWidthHeight(e);let{x:c,y:u}=s,{width:f,height:p,wrapCount:h}=t;const m=this._getRasterTileAlignmentInfo(e,0);i.buffer&&(c-=i.buffer.cols,u-=i.buffer.rows,f+=2*i.buffer.cols,p+=2*i.buffer.rows);let y=0,d=0,x=0;h&&m!=null&&({worldColumnCountFromOrigin:d,originColumnOffset:x,rightPadding:y}=m,d*m.blockWidth-y>=c+f&&(y=0));const g=Math.floor(c/l),w=Math.floor(u/o),I=Math.floor((c+f+y-1)/l),S=Math.floor((u+p+y-1)/o),v=n[e];if(!v)return null;const{minRow:F,minCol:T,maxCol:k,maxRow:_}=v;if(h===0&&(S_||g>k))return null;const M=new Array;let O=!1;const D=this.ioConfig.allowPartialFill==null?i.allowPartialFill:this.ioConfig.allowPartialFill;for(let N=w;N<=S;N++)for(let A=g;A<=I;A++){let L=A;if(!i.disableWrapAround&&h&&m!=null&&d<=A&&(L=A-d-x),N>=F&&L>=T&&_>=N&&k>=L){const ee=this._fetchRawTile(e,N,L,i);D?M.push(new Promise(J=>{ee.then(U=>J(U)).catch(()=>{O=!0,J(null)})})):M.push(ee)}else M.push(Promise.resolve(null))}if(M.length===0)return null;const E=await Promise.all(M),C={height:(S-w+1)*o,width:(I-g+1)*l},{spatialReference:$}=this.rasterInfo,B=this.getPyramidPixelSize(e),{x:V,y:Y}=B;return{extent:new W({xmin:r.x+g*l*V,xmax:r.x+(I+1)*l*V,ymin:r.y-(S+1)*o*Y,ymax:r.y-w*o*Y,spatialReference:$}),pixelBlocks:E,mosaicSize:C,isPartiallyFilled:O}}_isSameResolution(e,s,t){return Math.abs(e.x-s.x)c||t>o)return Promise.resolve(null);const u=et(this.url,i.sliceId),f=`${e}/${s}/${t}`;let p=tt(u,i.registryId,f);if(p==null){const h=new AbortController;p=this.fetchRawTile(e,s,t,{...i,signal:h.signal}),it(u,i.registryId,f,p,h),p.catch(()=>Li(u,i.registryId,f))}return i.signal&&wt(i,()=>{Hi(u,i.registryId,f)}),p}_computeMagDirValues(e){var c;const{bandCount:s,dataType:t}=this.rasterInfo;if(!(s===2&&t==="vector-magdir"||t==="vector-uv")||(e==null?void 0:e.length)!==2||!((c=e[0])!=null&&c.length))return null;const i=e[0].length;if(t==="vector-magdir"){const u=e[1].map(f=>(f+360)%360);return[e[0],u]}const[r,n]=e,l=[],o=[];for(let u=0;u=16,h=c===n&&this._requireTooManySrcTiles(l,o,s,t);if(p||h||l===0||o===0){const m=new H({x:(e.xmax-e.xmin)/s,y:(e.ymax-e.ymin)/t,spatialReference:e.spatialReference});let y=Di(m,this.rasterInfo.spatialReference,e,r.datumTransformation);const d=!y||i.srcResolution&&y.x+y.y=x){const g=2**x;y={x:i.srcResolution.x*g,y:i.srcResolution.y*g}}}y&&(r.srcResolution=y,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,s,t)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,s,t,i){const{tileInfo:r}=this.rasterInfo.storageInfo;return Math.ceil(e/r.size[0])*Math.ceil(s/r.size[1])>=Wi||e/t>st||s/i>st}_updateSourceDataInfo(e,s){s.srcWidth=0,s.srcHeight=0;const{rasterInfo:t}=this,i=t.spatialReference,{srcResolution:r,datumTransformation:n}=s,{pyramidLevel:l,pyramidResolution:o,excessiveReading:c}=Qe(r,t,this.ioConfig.sampling);if(c)return;let u=s.srcExtent||ve(e,i,n);if(u==null)return;const f=t.transform;f&&(u=f.inverseTransform(u)),s.srcExtent=u;const{x:p,y:h}=t.storageInfo.origin,m=Math.floor((u.xmin-p)/o.x+.1),y=Math.floor((h-u.ymax)/o.y+.1),d=Math.floor((u.xmax-p)/o.x-.1),x=Math.floor((h-u.ymin)/o.y-.1),g=u.width<.1*o.x?0:d-m+1,w=u.height<.1*o.y?0:x-y+1;s.pyramidLevel=l,s.pyramidResolution=o,s.srcWidth=g,s.srcHeight=w,s.ul={x:m,y}}_getRequestOptionsWithSliceId(e){return this.rasterInfo.multidimensionalInfo!=null&&e.sliceId==null&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,s){const{srcLocation:t,position:i,pyramidLevel:r,useTransposedTile:n}=s,l=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[i]))return{location:t,value:null};const{multidimensionalInfo:o}=this.rasterInfo;if(o==null||!n){const x=e.pixels.map(I=>I[i]),g={location:t,value:x,pyramidLevel:r},w=this._computeMagDirValues(x.map(I=>[I]));return w!=null&&w.length&&(g.magdirValue=w.map(I=>I[0])),g}let c=e.pixels.map(x=>x.slice(i*l,i*l+l)),u=this._computeMagDirValues(c);const{requestSomeSlices:f,identifyOptions:p}=s;let h=Yt(o,p.transposedVariableName);if(f){const x=Kt(h,p.multidimensionalDefinition,p.timeExtent);c=c.map(g=>x.map(w=>g[w])),u=u==null?void 0:u.map(g=>x.map(w=>g[w])),h=x.map(g=>h[g])}const m=e.noDataValues||this.rasterInfo.noDataValue,y={pixels:c,pixelType:e.pixelType};let d;return m!=null&&(It(y,m),d=y.mask),{location:t,value:null,dataSeries:h.map((x,g)=>{const w={value:(d==null?void 0:d[g])===0?null:c.map(I=>I[g]),multidimensionalDefinition:x.multidimensionalDefinition.map(I=>new mt({...I,isSlice:!0}))};return u!=null&&u.length&&(w.magdirValue=[u[0][g],u[1][g]]),w}),pyramidLevel:r}}};b([R()],q.prototype,"_rasterTileAlighmentInfo",void 0),b([R({readOnly:!0})],q.prototype,"_isGlobalWrappableSource",null),b([R({readOnly:!0})],q.prototype,"_hasNoneOrGCSShiftTransform",null),b([R()],q.prototype,"rasterJobHandler",null),b([R(ut)],q.prototype,"url",null),b([R({type:String,json:{write:!0}})],q.prototype,"datasetName",void 0),b([R({type:String,json:{write:!0}})],q.prototype,"datasetFormat",void 0),b([R()],q.prototype,"hasUniqueSourceStorageInfo",void 0),b([R()],q.prototype,"rasterInfo",void 0),b([R()],q.prototype,"ioConfig",void 0),b([R()],q.prototype,"sourceJSON",void 0),q=b([Q("esri.layers.support.rasterDatasets.BaseRaster")],q);const ce=q;let ne=class extends ce{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null}async open(e){var u,f,p,h;await this.init();const{rasterFunction:s}=this;(f=(u=this.primaryRasters)==null?void 0:u.rasters)!=null&&f.length?s.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=s.getPrimaryRasters(),this.rasterJobHandler&&((p=this.primaryRasters.rasters)==null||p.forEach(m=>m.rasterJobHandler=this.rasterJobHandler)));const{rasters:t,rasterIds:i}=this.primaryRasters,r=t.map(m=>m.rasterInfo?void 0:m.open(e));await Promise.all(r);const n=t.map(({rasterInfo:m})=>m),l=s.bind({rasterInfos:n,rasterIds:i});if(!l.success||n.length===0)throw new P("raster-function:open",`cannot bind the function: ${l.error??""}`);const o=s.functionName==="Table"?s:(h=s.functionArguments)==null?void 0:h.raster;(o==null?void 0:o.functionName)==="Table"&&(s.rasterInfo.attributeTable=He.fromJSON(o.functionArguments.attributeTableAsRecordSet)),await this.syncJobHandler();const c=n[0];this.hasUniqueSourceStorageInfo=n.length===1||n.slice(1).every(m=>this._hasSameStorageInfo(m,c)),this.set("sourceJSON",t[0].sourceJSON),this.set("rasterInfo",s.rasterInfo)}async syncJobHandler(){var e;return(e=this.rasterJobHandler)==null?void 0:e.updateRasterFunction(this.rasterFunction)}async fetchPixels(e,s,t,i={}){var w,I;const{rasters:r,rasterIds:n}=this.primaryRasters;let l=!1;const{interpolation:o}=i,c=(w=this.rasterFunction.flatWebGLFunctionChain)==null?void 0:w.hasFocalFunction;!i.requestRawData&&o!=="bilinear"&&c&&(l=r.length===1&&!i.skipRasterFunction,i={...i,interpolation:"bilinear",requestRawData:l});const u=r.map(S=>S.fetchPixels(e,s,t,i)),f=await Promise.all(u),p=f.map(S=>S.pixelBlock),h=l||i.requestRawData?f.map(S=>S.srcTilePixelSize):null;if(i.skipRasterFunction||p.every(S=>S==null))return f[0];const m=((I=f.find(S=>S.pixelBlock!=null))==null?void 0:I.extent)??e,y=this.rasterJobHandler?await this.rasterJobHandler.process({extent:m,primaryPixelBlocks:p,primaryPixelSizes:h,primaryRasterIds:n}):this.rasterFunction.process({extent:m,primaryPixelBlocks:p,primaryPixelSizes:h,primaryRasterIds:n}),{transformGrid:d}=f[0];if(!l||y==null||d==null)return{...f[0],pixelBlock:y};const x={rows:d.spacing[0],cols:d.spacing[1]};let g;return this.rasterJobHandler?g=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[y],srcMosaicSize:{width:y.width,height:y.height},destDimension:{width:s,height:t},coefs:d.coefficients,sampleSpacing:x,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:o,alignmentInfo:void 0,blockWidths:null},i)).pixelBlock:g=pt(y,{width:s,height:t},d.coefficients,x,o),{extent:e,srcExtent:f[0].srcExtent,pixelBlock:g}}_hasSameStorageInfo(e,s){const{storageInfo:t,pixelSize:i,spatialReference:r,extent:n}=e,{storageInfo:l,pixelSize:o,spatialReference:c,extent:u}=s;return i.x===o.x&&i.y===o.y&&r.equals(c)&&n.equals(u)&&t.blockHeight===l.blockHeight&&t.blockWidth===l.blockWidth&&t.maximumPyramidLevel===l.maximumPyramidLevel}};b([R({type:String,json:{write:!0}})],ne.prototype,"datasetFormat",void 0),b([R()],ne.prototype,"tileType",void 0),b([R()],ne.prototype,"rasterFunction",void 0),b([R()],ne.prototype,"primaryRasters",void 0),ne=b([Q("esri.layers.support.rasterDatasets.FunctionRaster")],ne);const Ee=ne;function ji(a,e){if(a.spatialReference.equals(e))return a;const s=qe(a.spatialReference),t=qe(e);if(s===t)return a;const i=s/t;return{x:a.x*i,y:a.y*i}}async function qi(a,e,s){if(s.type==="extent")return Vi(a,e,s);const{width:t,height:i}=a,r=new Uint8Array(t*i),{contains:n,intersects:l}=await ht(()=>import("./index-J0iiHjMT.js").then(o=>o.zJ),__vite__mapDeps([0,1]));return l(e,s)?s.type==="polyline"?Ui(a,e,s):n(s,e)?a:Gi(a,e,s):new ie({pixelType:a.pixelType,width:t,height:i,mask:r,maskIsAlpha:!1,pixels:[...a.pixels]})}function Gi(a,e,s){if(!a)return a;const{width:t,height:i}=a,r=e.width/t,n=e.height/i,{xmin:l,ymax:o}=e;let c;if(s.type==="extent"){const d=(s.xmin-l)/r,x=(s.xmax-l)/r,g=(o-s.ymax)/n,w=(o-s.ymin)/n;c=[[[d,g],[d,w],[x,w],[x,g],[d,g]]]}else c=s.rings.map(d=>d.map(([x,g])=>[(x-l)/r,(o-g)/n]));const u=document.createElement("canvas");u.width=t,u.height=i;const f=u.getContext("2d");f.fillStyle="#f00",c.forEach(d=>{f.beginPath(),f.moveTo(d[0][0],d[0][1]);for(let x=0;x127?255:0);return new ie({pixelType:a.pixelType,width:t,height:i,mask:y,maskIsAlpha:!1,pixels:[...a.pixels]})}function Vi(a,e,s){const{width:t,height:i}=a,r=new Uint8Array(t*i),n=e.width/t,l=e.height/i;if(s.width/n<.5||s.height/l<.5)return new ie({pixelType:a.pixelType,width:t,height:i,mask:r,pixels:[...a.pixels]});const{xmin:o,xmax:c,ymin:u,ymax:f}=e,{xmin:p,xmax:h,ymin:m,ymax:y}=s,d=Math.max(o,p),x=Math.min(c,h),g=Math.max(u,m),w=Math.min(f,y),I=.5*n,S=.5*l;if(x-dc-I||g>f-S||w.5&&F%1<.5||O===D&&T%1>.5&&k%1<.5)return new ie({pixelType:a.pixelType,width:t,height:i,mask:r,pixels:[...a.pixels]});if(_===0&&O===0&&M===t&&D===i)return a;const E=a.mask;for(let C=O;C<=D;C++)for(let $=_;$<=M;$++){const B=C*t+$;r[B]=E?E[B]:255}return new ie({pixelType:a.pixelType,width:t,height:i,mask:r,pixels:[...a.pixels]})}function Ui(a,e,s){const{width:t,height:i}=a,r=new Uint8Array(t*i),n=e.width/t,l=e.height/i,{xmin:o,ymax:c}=e,{paths:u}=s,f=a.mask;for(let p=0;py?r*Math.round((f-y)/r):0),h=d-(hy?r*Math.round((p-y)/r):0),m=d-(my?r*Math.floor((f-y)/r+.1):0),h=d-(h{let e=class extends a{constructor(...t){var i,r;super(...t),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster=((r=(i=t[0])==null?void 0:i.raster)==null?void 0:r.datasetFormat)==="Function"}get fullExtent(){var t;return(t=this.rasterInfo)==null?void 0:t.extent}set multidimensionalDefinition(t){this._set("multidimensionalDefinition",t),this.updateRenderer()}set rasterFunction(t){var i;((i=t==null?void 0:t.functionName)==null?void 0:i.toLowerCase())==="none"&&(t=void 0),this._set("rasterFunction",t),this.updateRasterFunction()}set url(t){this._set("url",ot(t,rt))}set renderer(t){t==null&&this.rasterFunction==null?this._configDefaultRenderer("override"):(this._set("renderer",t),this.updateRenderer())}readRenderer(t,i,r){var l,o;const n=(o=(l=i==null?void 0:i.layerDefinition)==null?void 0:l.drawingInfo)==null?void 0:o.renderer;return ti(n,r)||void 0}async convertVectorFieldData(t,i){if(t==null||!this.rasterInfo)return null;const r=this._rasterJobHandler.instance,n=this.rasterInfo.dataType;return r?r.convertVectorFieldData({pixelBlock:t,dataType:n},i):pi(t,n)}async computeStatisticsHistograms(t,i){t=Ne(ii,t).clone();const{rasterInfo:r}=this,{geometry:n}=t;if(n==null)throw new P("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let l=n;const{spatialReference:o}=r;n.spatialReference.equals(o)||(await Je(),l=n.type==="extent"?ve(n,o):Bi(n,o));const c=t.pixelSize??new H({x:r.pixelSize.x,y:r.pixelSize.y,spatialReference:o}),{extent:u,width:f,height:p}=Xi(r,l,c),h=await this.fetchPixels(u,f,p,{...i,interpolation:"nearest"});if(h.pixelBlock==null)throw new P("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const m=await qi(h.pixelBlock,u,l),y=this._rasterJobHandler.instance;return y?y.computeStatisticsHistograms({pixelBlock:m},i):yi(m)}async createFlowMesh(t,i){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(t,i):gi(t.meshType,t.simulationSettings,t.flowData,i.signal!=null?i.signal:new AbortController().signal)}normalizeRasterFetchOptions(t){var l,o;const{multidimensionalInfo:i}=this.rasterInfo??{};if(i==null)return t;let r=t.multidimensionalDefinition||this.multidimensionalDefinition;r!=null&&r.length||(r=Ge(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const n=t.timeExtent||this.timeExtent;if(r!=null&&n!=null&&(n.start!=null||n.end!=null)){r=r.map(x=>x.clone());const c=(o=(l=i.variables.find(({name:x})=>x===r[0].variableName))==null?void 0:l.dimensions)==null?void 0:o.find(({name:x})=>x==="StdTime"),u=r.find(({dimensionName:x})=>x==="StdTime");if(!c||!u)return{...t,multidimensionalDefinition:null};const{start:f,end:p}=n,h=f==null?null:f.getTime(),m=p==null?null:p.getTime(),y=h??m,d=m??h;if(c.values!=null){const x=c.values.filter(g=>{if(Array.isArray(g)){if(y===d)return g[0]<=y&&g[1]>=y;const w=g[0]<=y&&g[1]>y||g[0]=d,I=g[0]>=y&&g[1]<=d||g[0]d;return w||I}return y===d?g===y:g>=y&&g<=d});if(x.length){const g=x.sort((w,I)=>{const S=Array.isArray(w)?w[0]:w,v=Array.isArray(w)?w[1]:w,F=Array.isArray(I)?I[0]:I,T=Array.isArray(I)?I[1]:I;return y===d?S-F:Math.abs(v-d)-Math.abs(T-d)})[0];u.values=[g]}else r=null}else if(c.hasRegularIntervals&&c.extent){const[x,g]=c.extent;y>g||d1&&t.forEach(d=>h[d.url]=d);const m=ze(((f=n.functionDefinition)==null?void 0:f.toJSON())??n.toJSON(),h),y=new Ee({rasterFunction:m});y.rasterJobHandler=this._rasterJobHandler.instance,await y.open(),this._cachedRasterFunctionJson=(p=this.rasterFunction)==null?void 0:p.toJSON(),this.raster=y}else this.raster=i,this._cachedRasterFunctionJson=null,await i.when();if(this._cachedRendererJson=null,!r&&!n)return;const{bandIds:l}=this,{bandCount:o}=this.raster.rasterInfo,c=l!=null&&l.length?l.some(h=>h>=o):o>=3;l&&(c||this.renderer&&this.renderer.type!=="raster-stretch")&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:t,symbolizer:i}=this;if(!t||!i||!this.renderer)return;const{rasterInfo:r}=this.raster,n=Ve(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),l=n==null?void 0:n.name,o=Ue({...this.renderer.toJSON(),variableName:l});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(o))return;const c=this._rasterJobHandler.instance;c&&(i.rasterInfo=Xe(r,l),i.rendererJSON=o,i.bind(),await c.updateSymbolizer(i),this._cachedRendererJson=o)}async applyRenderer(t,i){const r=t==null?void 0:t.pixelBlock;if(!(r!=null&&r.pixels&&r.pixels.length>0))return null;let n;await this.updateRenderer();const l=this._rasterJobHandler.instance,o=this.bandIds??[];return n=l?await l.symbolize({...t,simpleStretchParams:i,bandIds:o}):this.symbolizer.symbolize({...t,simpleStretchParams:i,bandIds:o}),n}getTileUrl(t,i,r){return this.raster.datasetFormat==="RasterTileServer"?`${this.url}/tile/${t}/${i}/${r}`:""}getCompatibleTileInfo(t,i,r=!1){if(!this.loaded||i==null)return null;if(r&&t.equals(this.spatialReference))return this.tileInfo;const n=Rt(t);return te.create({size:256,spatialReference:t,origin:n?{x:n.origin[0],y:n.origin[1]}:{x:i.xmin,y:i.ymax}})}getCompatibleFullExtent(t){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(t)||(this._compatibleFullExtent=this.raster.computeExtent(t)),this._compatibleFullExtent):null}async fetchTile(t,i,r,n={}){var o;if(s(this),n.requestAsImageElement){const c=this.getTileUrl(t,i,r);return lt(c,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:n.signal}).then(u=>u.data)}const{rasterInfo:l}=this;if(l.multidimensionalInfo!=null&&(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition==null){const c=n.tileInfo||l.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(t,i,r,c),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),((o=this.renderer)==null?void 0:o.type)==="raster-shaded-relief"&&(n={...n,buffer:{cols:1,rows:1}}),this.raster.fetchTile(t,i,r,n)}async fetchPixels(t,i,r,n={}){return this.rasterInfo.multidimensionalInfo!=null&&(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition==null?{extent:t,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),i=Math.round(i),r=Math.round(r),this.raster.fetchPixels(t,i,r,n))}async identify(t,i={}){var o;const{raster:r,rasterInfo:n}=this;if(n.multidimensionalInfo!=null&&!(n.hasMultidimensionalTranspose&&(dt(i.multidimensionalDefinition)||i.transposedVariableName||i.timeExtent))&&(i=this.normalizeRasterFetchOptions(i)).multidimensionalDefinition==null)return{location:t,value:null};const l=(o=this.multidimensionalSubset)==null?void 0:o.areaOfInterest;if(l&&!l.contains(t))throw new P("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return r.identify(t,i)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){var n,l,o;const t=(n=this.rasterInfo)==null?void 0:n.multidimensionalInfo;if(t==null||((l=this.rasterInfo)==null?void 0:l.dataType)!=="standard-time")return!1;const i=this.multidimensionalDefinition,r=(o=i==null?void 0:i[0])==null?void 0:o.variableName;return t.variables.some(c=>c.name===r&&(!(i!=null&&i[0].dimensionName)||c.dimensions.some(u=>u.name==="StdTime")))}getStandardTimeValue(t){return new Date(24*(t-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(t){var r;const i=t??((r=this.rasterInfo)==null?void 0:r.multidimensionalInfo);return ri(this.multidimensionalSubset,i)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=Ge(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&this.raster.datasetFormat==="Function"&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(this._rasterJobHandler.connectionPromise!=null)return this._rasterJobHandler.connectionPromise;const t=new oi;return this._rasterJobHandler.connectionPromise=t.initialize().then(async()=>{s(this),this._rasterJobHandler.instance=t,this.raster.rasterJobHandler=t,this.raster.datasetFormat==="Function"&&this.raster.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch(()=>{}),this.renderer&&this.updateRenderer()}).catch(()=>{}),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){var t;if(this.interpolation==null){s(this);const{raster:i}=this,r=ni(i.rasterInfo,i.tileType,(t=this.sourceJSON)==null?void 0:t.defaultResamplingMethod);this._set("interpolation",r)}}_configDefaultRenderer(t="no"){var u,f;s(this);const{rasterInfo:i}=this.raster;!this.bandIds&&i.bandCount>1&&(this.bandIds=ai(i));const r=Ve(i,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),n=r==null?void 0:r.name;if(!this.renderer||t==="override"){const p=Ye(i,{bandIds:this.bandIds,variableName:n}),h=i.statistics,m=h&&h.length>0?h[0]:null,y=(m==null?void 0:m.max)??0,d=(m==null?void 0:m.min)??0;this.raster.datasetFormat==="WCSServer"&&p.type==="raster-stretch"&&(y>1e24||d<-1e24)&&(p.dynamicRangeAdjustment=!0,p.statistics=null,p.stretchType==="none"&&(p.stretchType="min-max")),this.renderer=p}const l=Ue({...this.renderer.toJSON(),variableName:n}),o=Xe(i,n);this.symbolizer?(this.symbolizer.rendererJSON=l,this.symbolizer.rasterInfo=o):this.symbolizer=new xi({rendererJSON:l,rasterInfo:o});const c=this.symbolizer.bind();if(c.success){if(t==="auto"){const{colormap:p}=this.raster.rasterInfo,h=this.renderer;if(p!=null&&h.type==="raster-colormap"){const m=Ye(this.raster.rasterInfo);JSON.stringify(m)!==JSON.stringify(h)&&this._configDefaultRenderer("override")}else if(h.type==="raster-stretch"){const m=(u=this.bandIds)==null?void 0:u.length,y=(f=h.statistics)==null?void 0:f.length;!h.dynamicRangeAdjustment&&y&&m&&y!==m&&this._configDefaultRenderer("override")}}}else rt.warn("imagery-tile-mixin",c.error||"The given renderer is not supported by the layer."),t==="auto"&&this._configDefaultRenderer("override")}};function s(t){if(!t.raster||!t.rasterInfo)throw new P("imagery-tile","no raster")}return b([R({clonable:!1})],e.prototype,"_cachedRendererJson",void 0),b([R({clonable:!1})],e.prototype,"_cachedRasterFunctionJson",void 0),b([R({clonable:!1})],e.prototype,"_compatibleFullExtent",void 0),b([R({clonable:!1})],e.prototype,"_isConstructedFromFunctionRaster",void 0),b([R({clonable:!1})],e.prototype,"_rasterJobHandler",void 0),b([R()],e.prototype,"bandIds",void 0),b([R({json:{origins:{service:{read:{source:"copyrightText"}}}}})],e.prototype,"copyright",void 0),b([R({json:{read:!1}})],e.prototype,"fullExtent",null),b([R()],e.prototype,"interpolation",void 0),b([R()],e.prototype,"ioConfig",void 0),b([R({type:[mt],json:{write:!0}})],e.prototype,"multidimensionalDefinition",null),b([R({type:Zt,json:{write:!0}})],e.prototype,"multidimensionalSubset",void 0),b([R()],e.prototype,"raster",void 0),b([R({type:Be,json:{name:"renderingRule",write:!0}})],e.prototype,"rasterFunction",null),b([R()],e.prototype,"rasterInfo",void 0),b([R()],e.prototype,"sourceJSON",void 0),b([R({readOnly:!0,type:j,json:{read:!1}})],e.prototype,"spatialReference",void 0),b([R({type:te})],e.prototype,"tileInfo",void 0),b([R(ut)],e.prototype,"url",null),b([R({types:Qt,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){var i;const t=((i=this.renderer)==null?void 0:i.type)==="raster-stretch"&&this.renderer.stretchType==="none"&&!this.renderer.useGamma;return{enabled:!this.loaded||this.raster.tileType==="Raster"||!t}}},origins:{"web-scene":{types:ei,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:t=>({enabled:t&&t.type!=="vector-field"&&t.type!=="flow"})}}}}})],e.prototype,"renderer",null),b([St("renderer")],e.prototype,"readRenderer",null),b([R({clonable:!1})],e.prototype,"symbolizer",void 0),e=b([Q("esri.layers.ImageryTileMixin")],e),e};function Ki(a){const e=a.fields,s=a.records,t=e.some(c=>c.name.toLowerCase()==="oid")?"OBJECTID":"OID",i=[{name:t,type:"esriFieldTypeOID",alias:"OID"}].concat(e.map(c=>({name:c.name,type:"esriFieldType"+c.typeName,alias:c.name}))),r=i.map(c=>c.name),n=[];let l=0,o=0;return s.forEach(c=>{const u={};for(u[t]=l++,o=1;o0)for(;u.lengthn;){const p=[];s.getUint8(o)===32?(o+=1,c.forEach(h=>{if(h.type==="C")p.push(Ke(new Uint8Array(e,o,h.length)).trim());else if(h.type==="N")p.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,o,h.length)).trim(),10));else if(h.type==="F")p.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,o,h.length)).trim()));else if(h.type==="D"){const m=String.fromCharCode.apply(null,new Uint8Array(e,o,h.length)).trim();p.push(new Date(parseInt(m.substring(0,4),10),parseInt(m.substring(4,6),10)-1,parseInt(m.substring(6,8),10)))}o+=h.length}),u.push(p)):o+=n}}return{header:l,fields:c,records:u,recordSet:Ki({fields:c,records:u})}}}const ae=new Map;ae.set("int16","esriFieldTypeSmallInteger"),ae.set("int32","esriFieldTypeInteger"),ae.set("int64","esriFieldTypeInteger"),ae.set("float32","esriFieldTypeSingle"),ae.set("float64","esriFieldTypeDouble"),ae.set("text","esriFieldTypeString");const nt=8;let me=class extends ce{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:s}=await this.request(this.url+"/conf.json",{signal:e==null?void 0:e.signal});if(!this._validateHeader(s))throw new P("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:t,rasterInfo:i}=this._parseHeader(s);if(i.dataType==="thematic"){const r=await this._fetchAuxiliaryInformation();i.attributeTable=r}this._set("storageInfo",t),this._set("rasterInfo",i),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,s,t,i={}){const{transposeInfo:r}=this.rasterInfo.storageInfo,{transposedVariableName:n}=i,l=!(!r||!n),o=l?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(o<0)return null;const c=this._buildCacheFilePath(o,s,t,i.multidimensionalDefinition,n),u=this._getIndexRecordFromBundle(s,t,l),f=await this.request(c,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:i.signal});if(!f)return null;const p=new Uint8Array(f.data),h=this._getTileEndAndContentType(p,u);if(h.recordSize===0)return null;const m=await this.request(c,{range:{from:h.position,to:h.position+h.recordSize},responseType:"array-buffer",signal:i.signal});if(!m)return null;const[y,d]=this._getTileSize(l);return this.decodePixelBlock(m.data,{width:y,height:d,planes:null,pixelType:null,returnInterleaved:l})}_validateHeader(e){const s=["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"];return e&&e.type==="RasterInfo"&&!s.some(t=>!e[t])}_parseHeader(e){var Y,N,A,L,ee;const s=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:t,colormap:i,blockWidth:r,blockHeight:n,firstPyramidLevel:l,maximumPyramidLevel:o}=e,c=(Y=e.statistics)==null?void 0:Y.map(J=>({min:J.min,max:J.max,avg:J.mean,stddev:J.standardDeviation,median:J.median,mode:J.mode})),u=(L=(A=(N=e.histograms)==null?void 0:N[0])==null?void 0:A.counts)!=null&&L.length?e.histograms:null,f=e.extent.spatialReference,p=(ee=e.geodataXform)==null?void 0:ee.spatialReference,h=new j(f!=null&&f.wkid||f!=null&&f.wkt||f!=null&&f.wkt2?f:p);let m=new W({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:h});const y=new H({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:h}),d=Math.round((m.xmax-m.xmin)/y.x),x=Math.round((m.ymax-m.ymin)/y.y),g=this._parseTransform(e.geodataXform),w=g?m:null;g&&(m=g.forwardTransform(m),y.x=(m.xmax-m.xmin)/d,y.y=(m.ymax-m.ymin)/x);const I=e.properties??{},S=e.format.toLowerCase().replace("cache/",""),v=new H(e.origin.x,e.origin.y,h);let F,T,k,_;if(i!=null&&i.colors)for(F=[],T=0;T>>24,k<<8>>>24,k>>>24]);const M=e.LODInfos,O=[];for(T=0;T0)for(T=0;Tn.data).catch(()=>null),t=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then(n=>n.data).catch(()=>null),i=await Promise.all([s,t]);let r;if(i[0]){let n=i[0].fields;const l=i[0].values;if(n&&l){n=n.map(c=>({type:c.name==="OID"?"esriFieldTypeOID":ae.get(c.type),name:c.name,alias:c.alias||c.name}));const o=l.map(c=>({attributes:c}));n&&l&&(r={fields:n,features:o})}}return!r&&i[1]&&(r=yt.parse(i[1]).recordSet),He.fromJSON(r)}_buildCacheFilePath(e,s,t,i,r){const n=this._getPackageSize(!!r),l=Math.floor(s/n)*n,o=Math.floor(t/n)*n,c="R"+this._toHexString4(l)+"C"+this._toHexString4(o);let u="L";u+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:f}=this.rasterInfo,p=i==null?void 0:i[0];if(f==null||!p)return`${this.url}/_alllayers/${u}/${c}.bundle`;let h="_yxs";if(!r){h=f.variables.find(d=>d.name===p.variableName).dimensions[0].values.indexOf(p.values[0]).toString(16);const y=4-h.length;for(let d=0;d0;)s="0"+s}return s}};b([R({readOnly:!0})],me.prototype,"storageInfo",void 0),b([R({type:String,json:{write:!0}})],me.prototype,"datasetFormat",void 0),me=b([Q("esri.layers.support.rasterDatasets.CloudRaster")],me);const Zi=me;let pe=class extends ce{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.data=null}async open(e){await this.init();const s=this.data,{pixelBlock:t,statistics:i,histograms:r,name:n,keyProperties:l,nativeExtent:o,transform:c}=this.data,{width:u,height:f,pixelType:p}=t,h=s.extent??new W({xmin:-.5,ymin:.5,xmax:u-.5,ymax:f-.5,spatialReference:new j({wkid:3857})}),m=s.isPseudoSpatialReference??!s.extent,y={x:h.width/u,y:h.height/f},d=new xe({width:u,height:f,pixelType:p,extent:h,nativeExtent:o,transform:c,pixelSize:y,spatialReference:h.spatialReference,bandCount:t.pixels.length,keyProperties:l||{},statistics:i,isPseudoSpatialReference:m,histograms:r});this.createRemoteDatasetStorageInfo(d,512,512),this._set("rasterInfo",d),this.updateTileInfo(),await this._buildInMemoryRaster(t,{width:512,height:512},e),this.datasetName=n,this.url="/InMemory/"+n}fetchRawTile(e,s,t,i={}){const r=this._pixelBlockTiles.get(`${e}/${s}/${t}`);return Promise.resolve(r)}async _buildInMemoryRaster(e,s,t){var u,f;const i=this.rasterInfo.storageInfo.maximumPyramidLevel,r=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:s,maximumPyramidLevel:i},t):Promise.resolve(wi(e,s,i)),n=this.rasterInfo.statistics!=null,l=this.rasterInfo.histograms!=null,o=n?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},t):Promise.resolve(Ii(e)),c=await ft([r,o]);if(!c[0].value&&c[1].value)throw new P("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=c[0].value,n||(this.rasterInfo.statistics=(u=c[1].value)==null?void 0:u.statistics),l||(this.rasterInfo.histograms=(f=c[1].value)==null?void 0:f.histograms)}};b([R({type:String,json:{write:!0}})],pe.prototype,"datasetFormat",void 0),b([R()],pe.prototype,"data",void 0),pe=b([Q("esri.layers.support.rasterDatasets.InMemoryRaster")],pe);const Qi=pe;function fe(a,e){if(!a||!e)return[];let s=e;e.includes("/")?(s=e.slice(0,e.indexOf("/")),e=e.slice(e.indexOf("/")+1)):e="";const t=[];if(e){const r=fe(a,s);for(let n=0;nt.push(l));return t}const i=a.getElementsByTagNameNS("*",s);if(!i||i.length===0)return[];for(let r=0;r0?e?X(t[0],e):t[0]:null}function Z(a,e=null){const s=e?X(a,e):a;let t;return s?(t=s.textContent||s.nodeValue,t?t.trim():null):null}function es(a,e){const s=fe(a,e),t=[];let i;for(let r=0;rNumber(s))}function le(a,e){const s=Z(a,e);return Number(s)}function Pe(a,e){var i;const s=(i=a==null?void 0:a.nodeName)==null?void 0:i.toLowerCase(),t=e.toLowerCase();return s.slice(s.lastIndexOf(":")+1)===t}function at(a,e){if(!a||!e)return null;const s=[];for(let t=0;tNumber(h));let l,o,c,u;fe(a,"Metadata/MDI").forEach(h=>{const m=Number(h.textContent??h.nodeValue);switch(h.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":l=m;break;case"STATISTICS_MAXIMUM":o=m;break;case"STATISTICS_MEAN":c=m;break;case"STATISTICS_STDDEV":u=m}});const f=le(a,"Metadata/SourceBandIndex");return{noDataValue:e,histogram:n!=null&&n.length&&t!=null&&i!=null?{min:t,max:i,size:r||n.length,counts:n}:null,sourceBandIndex:f,statistics:l!=null&&o!=null?{min:l,max:o,avg:c,stddev:u}:null}}function Fe(a){if(!a)return null;let e=Number(a);if(!isNaN(e)&&e!==0)return new j({wkid:e});if(a=String(a).trim(),vt(a))return new j({wkt2:a});const s=a.toUpperCase();if(s.startsWith("COMPD_CS")){if(!s.includes("VERTCS")||!s.includes("GEOGCS")&&!s.startsWith("PROJCS"))return null;const t=s.indexOf("VERTCS"),i=s.indexOf("PROJCS"),r=i>-1?i:s.indexOf("GEOGCS");if(r===-1)return null;const n=a.slice(r,a.lastIndexOf("]",t)+1).trim(),l=a.slice(t,a.lastIndexOf("]")).trim();e=Oe(n);const o=new j(e?{wkid:e}:{wkt:n}),c=Oe(l);return c&&(o.vcsWkid=c),o}return s.startsWith("GEOGCS")||s.startsWith("PROJCS")?(e=Oe(a),new j(e!==0?{wkid:e}:{wkt:a})):null}function Oe(a){var i;const e=a.replaceAll("]","[").replaceAll('"',"").split("[").map(r=>r.trim()).filter(r=>r!==""),s=e[e.length-1].split(","),t=(i=s[0])==null?void 0:i.toLowerCase();if((t==="epsg"||t==="esri")&&a.endsWith('"]]')){const r=Number(s[1]);if(!isNaN(r)&&r!==0)return r}return 0}function We(a){var t;if(((t=a==null?void 0:a.documentElement.tagName)==null?void 0:t.toLowerCase())!=="pamdataset")return{};const e={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};a.documentElement.childNodes.forEach(i=>{if(i.nodeType===1){if(Pe(i,"SRS")){if(!e.spatialReference){const r=Z(i);e.spatialReference=Fe(r)}}else if(Pe(i,"Metadata"))if(i.getAttribute("domain")==="xml:ESRI"){const{spatialReference:r,transform:n}=ts(i);e.transform=n,e.spatialReference||(e.spatialReference=r)}else fe(i,"MDI").forEach(r=>e.metadata[r.getAttribute("key")]=Z(r));else if(Pe(i,"PAMRasterBand")){const r=is(i);r.sourceBandIndex!=null&&e.rasterBands[r.sourceBandIndex]==null?e.rasterBands[r.sourceBandIndex]=r:e.rasterBands.push(r)}}});const s=e.rasterBands;if(s.length){const i=!!s[0].statistics;e.statistics=i?s.map(n=>n.statistics).filter(De):null;const r=!!s[0].histogram;e.histograms=r?s.map(n=>n.histogram).filter(De):null}return e}let Te=class extends ce{async open(a){await this.init();const e=await this._fetchData(a);let{spatialReference:s,statistics:t,histograms:i,transform:r}=await this._fetchAuxiliaryData(a);const n=!s;n&&(s=new j({wkid:3857})),i!=null&&i.length&&t==null&&(t=Ae(i));const{width:l,height:o}=e;let c=new W({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:s});const u=r?r.forwardTransform(c):c;let f=!0;if(r){const h=r.forwardCoefficients;f=h&&h[1]===0&&h[2]===0,f&&(r=null,c=u)}const p=new Qi({data:{extent:u,nativeExtent:c,transform:r,pixelBlock:e,statistics:t,histograms:i,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:n}});await p.open(),p.data=null,this._set("rasterInfo",p.rasterInfo),this._inMemoryRaster=p}fetchRawTile(a,e,s,t={}){return this._inMemoryRaster.fetchRawTile(a,e,s,t)}async _fetchData(a){const{data:e}=await this.request(this.url,{responseType:"array-buffer",signal:a==null?void 0:a.signal}),s=bi(e).toUpperCase();if(s!=="JPG"&&s!=="PNG"&&s!=="GIF"&&s!=="BMP")throw new P("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",s);const t=s.toLowerCase(),i=t==="gif"||t==="bmp"||!Tt("ios"),r=await this.decodePixelBlock(e,{format:t,useCanvas:i,hasNoZlibMask:!0});if(r==null)throw new P("image-aux-raster:open","the data cannot be decoded");return r}async _fetchAuxiliaryData(a){var c;const e=a==null?void 0:a.signal,s=this.ioConfig.skipExtensions??[],t=s.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:e}),i=this.datasetFormat,r=i==="JPG"?"jgw":i==="PNG"?"pgw":i==="BMP"?"bpw":null,n=r&&s.includes(r)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+r,{responseType:"text",signal:e}),l=await ft([t,n]);if(e!=null&&e.aborted)throw _t();const o=We((c=l[0].value)==null?void 0:c.data);if(!o.transform){const u=l[1].value?l[1].value.data.split(` -`).slice(0,6).map(f=>Number(f)):null;o.transform=(u==null?void 0:u.length)===6?new Le({forwardCoefficients:[u[4],u[5],u[0],-u[1],u[2],-u[3]]}):null}return o}};b([R({type:String,json:{write:!0}})],Te.prototype,"datasetFormat",void 0),Te=b([Q("esri.layers.support.rasterDatasets.ImageAuxRaster")],Te);const Re=Te;let ye=class extends ce{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(a){var F,T;await this.init();const e=a==null?void 0:a.signal,s=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:e});s.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const t=s.data;if(this.sourceJSON=t,!t)throw new P("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!t.tileInfo)throw new P("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const i=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=t.cacheType,this.tileType==null&&(i.includes(t.tileInfo.format.toLowerCase())?this.tileType="Map":t.tileInfo.format.toLowerCase()==="lerc"?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=((F=t.name)==null?void 0:F.slice(t.name.indexOf("/")+1))??"";const r=await this._fetchRasterInfo({signal:e});if(r==null)throw new P("image-server-raster:open","cannot initialize image service");li(r,t);const n=this.tileType==="Map"?ss(t.tileInfo,t):te.fromJSON(t.tileInfo);kt(n);const[l,o]=this._computeMinMaxLOD(r,n),{extent:c,pixelSize:u}=r,f=.5/r.width*u.x,p=Math.max(u.x,u.y),{lods:h}=n;(this.tileType!=="Map"&&t.maxScale!==0||Math.abs(u.x-u.y)>f||!h.some(k=>Math.abs(k.resolution-p){k.level>=o.level&&k.level<=l.level&&x.push({x:k.resolution,y:k.resolution}),_k.x-_.x);const w=this.computeBlockBoundary(c,y,d,n.origin,x,m),I=x.length>1?x.slice(1):null;let S;t.transposeInfo&&(S={tileSize:[t.transposeInfo.rows,t.transposeInfo.cols],packetSize:((T=r.keyProperties)==null?void 0:T._yxs.PacketSize)??0});const v=g.length<=1||g.length>=3&&g.slice(0,-1).every(k=>k===g[0])?g[0]??2:Math.round(10/(o.resolution/l.resolution)**(-1/m))/10;if(r.storageInfo=new ge({blockWidth:n.size[0],blockHeight:n.size[1],pyramidBlockWidth:n.size[0],pyramidBlockHeight:n.size[1],pyramidResolutions:I,pyramidScalingFactor:v,compression:n.format,origin:n.origin,firstPyramidLevel:1,maximumPyramidLevel:m,tileInfo:n,transposeInfo:S,blockBoundary:w}),this._fixGCSShift(r),this._set("rasterInfo",r),t.capabilities.toLowerCase().includes("tilemap")){const k={tileInfo:r.storageInfo.tileInfo,parsedUrl:Ft(this.url),url:this.url,tileServers:[]};this._tilemapCache=new Mt({layer:k})}}async fetchRawTile(a,e,s,t={}){const{storageInfo:i,extent:r}=this.rasterInfo,{transposeInfo:n}=i,l=n!=null&&!!t.transposedVariableName;if(this._slices&&!l&&t.sliceId==null)return null;const o=l?0:i.maximumPyramidLevel-a+this._levelOffset,c=`${this.url}/tile/${o}/${e}/${s}`,u=this._slices?l?{variable:t.transposedVariableName}:{sliceId:t.sliceId||0}:null,{data:f}=await this.request(c,{query:u,responseType:"array-buffer",signal:t.signal});if(!f)return null;const p=l?n.tileSize:i.tileInfo.size,h=await this.decodePixelBlock(f,{width:p[0],height:p[1],planes:null,pixelType:null,isPoint:this.tileType==="Elevation",returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue});if(h==null)return null;const m=i.blockBoundary[a];if(i.compression!=="jpg"||s>m.minCol&&sm.minRow&&e{const r=e.find(n=>i.variableName===n.variableName&&n.dimensionName===i.dimensionName);return r?(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])!==(Array.isArray(r.values[0])?`${r.values[0][0]}-${r.values[0][1]}`:r.values[0]):!0}))return s}return null}async fetchVariableStatisticsHistograms(a,e){var r,n,l;const s=this.request(this.url+"/statistics",{query:{variable:a,f:"json"},signal:e}).then(o=>{var c;return(c=o.data)==null?void 0:c.statistics}),t=this.request(this.url+"/histograms",{query:{variable:a,f:"json"},signal:e}).then(o=>{var c;return(c=o.data)==null?void 0:c.histograms}),i=await Promise.all([s,t]);return i[0]&&i[0].forEach(o=>{o.avg=o.mean,o.stddev=o.standardDeviation}),(l=(n=(r=i[1])==null?void 0:r[0])==null?void 0:n.counts)!=null&&l.length||(i[1]=null),{statistics:i[0]||null,histograms:i[1]||null}}async computeBestPyramidLevelForLocation(a,e={}){if(!this._tilemapCache)return 0;let s=this.identifyPixelLocation(a,0,e.datumTransformation);if(s===null)return null;let t=0;const{maximumPyramidLevel:i}=this.rasterInfo.storageInfo;let r=i-t+this._levelOffset;const n=s.srcLocation;for(;r>=0;){try{if(await this._tilemapCache.fetchAvailability(r,s.row,s.col,e)==="available")break}catch{}if(r--,t++,s=this.identifyPixelLocation(n,t,e.datumTransformation),s===null)return null}return r===-1||s==null?null:t}async _fetchRasterInfo(a){const e=this.sourceJSON;if(this.tileType==="Map"){const n=e.fullExtent||e.extent,l=Math.ceil((n.xmax-n.xmin)/e.pixelSizeX-.1),o=Math.ceil((n.ymax-n.ymin)/e.pixelSizeY-.1),c=j.fromJSON(e.spatialReference||n.spatialReference),u=new H({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:c});return new xe({width:l,height:o,bandCount:3,extent:W.fromJSON(n),spatialReference:c,pixelSize:u,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:s}=a,t=ci(this.url,this.sourceJSON,{signal:s,query:this.ioConfig.customFetchParameters}),i=e.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:s}).then(n=>{var l;return(l=n.data)==null?void 0:l.slices}).catch(()=>null):null,r=await Promise.all([t,i]);return this._slices=r[1],r[0]}_fixScaleInServiceInfo(){const{sourceJSON:a}=this;a.minScale&&a.minScale<0&&(a.minScale=0),a.maxScale&&a.maxScale<0&&(a.maxScale=0)}_fixGCSShift(a){const{extent:e,spatialReference:s}=a;e.xmin>-1&&e.xmax>181&&(s!=null&&s.wkid)&&s.isGeographic&&(a.nativeExtent=a.extent,a.transform=new Ei,a.extent=a.transform.forwardTransform(e))}_computeMinMaxLOD(a,e){const{pixelSize:s}=a,t=.5/a.width*s.x,{lods:i}=e,r=e.lodAt(Math.max.apply(null,i.map(p=>p.level))),n=e.lodAt(Math.min.apply(null,i.map(p=>p.level))),{tileType:l}=this;if(l==="Map")return this._levelOffset=i[0].level,[r,n];if(l==="Raster")return[i.find(p=>p.resolution===s.x)??r,n];const{minScale:o,maxScale:c}=this.sourceJSON;let u=r;c>0&&(u=i.find(p=>Math.abs(p.scale-c)p.scale>c).sort((p,h)=>p.scale>h.scale?1:-1)[0]??r));let f=n;return o>0&&(f=i.find(p=>Math.abs(p.scale-o)n!=null&&n>=i&&n<=r)});if(s!==0&&t!==0){const n=c=>Math.round(1e4*c)/1e4,l=s?n(s):1/0,o=t?n(t):-1/0;return te.fromJSON({...a,lods:a.lods.filter(c=>{const u=n(c.scale);return u<=l&&u>=o})})}return te.fromJSON(a)}b([R({type:String,json:{write:!0}})],ye.prototype,"datasetFormat",void 0),b([R()],ye.prototype,"tileType",void 0),ye=b([Q("esri.layers.support.rasterDatasets.ImageServerRaster")],ye);const rs=ye,K=new Map;K.set("Int8","s8"),K.set("UInt8","u8"),K.set("Int16","s16"),K.set("UInt16","u16"),K.set("Int32","s32"),K.set("UInt32","u32"),K.set("Float32","f32"),K.set("Float64","f32"),K.set("Double64","f32");const se=new Map;se.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),se.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),se.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),se.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let ue=class extends ce{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(a){var y;await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const e=a?a.signal:null,s=await this.request(this.url,{responseType:"xml",signal:e}),{rasterInfo:t,files:i}=this._parseHeader(s.data);if(((y=this.ioConfig.skipExtensions)==null?void 0:y.indexOf("aux.xml"))===-1){const d=await this._fetchAuxiliaryData(a);d!=null&&(t.statistics=d.statistics??t.statistics,t.histograms=d.histograms,d.histograms&&t.statistics==null&&(t.statistics=Ae(d.histograms)))}this._set("rasterInfo",t),this._files=i;const r=await this.request(i.index,{responseType:"array-buffer",signal:e});this._storageIndex=this._parseIndex(r.data);const{blockWidth:n,blockHeight:l}=this.rasterInfo.storageInfo,o=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:c,height:u}=this.rasterInfo,f=[],p=this._getBandSegmentCount();let h=0,m=-1;for(;h0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=m),this.updateTileInfo()}async fetchRawTile(a,e,s,t={}){const{blockWidth:i,blockHeight:r,blockBoundary:n}=this.rasterInfo.storageInfo,l=n[a];if(!l||l.maxRowe||l.minCol>s)return null;const{bandCount:o,pixelType:c}=this.rasterInfo,{ranges:u,actualTileWidth:f,actualTileHeight:p}=this._getTileLocation(a,e,s);if(!u||u.length===0)return null;if(u[0].from===0&&u[0].to===0){const _=new Uint8Array(i*r);return new ie({width:i,height:r,pixels:null,mask:_,validPixelCount:0})}const{bandIds:h}=this.ioConfig,m=this._getBandSegmentCount(),y=[];let d=0;for(d=0;d_.data.byteLength).reduce((_,M)=>_+M),w=new Uint8Array(g);let I=0;for(d=0;d1e24)for(d=0;d<_;d++)Math.abs((v.pixels[0][d]-F)/F)>1e-6&&(M[d]=1);else for(d=0;d<_;d++)v.pixels[0][d]!==F&&(M[d]=1);v.mask=M}let T=0,k=0;if(f!==i||p!==r){let _=v.mask;if(_)for(d=0;d0)throw new Error("invalid array buffer must be multiples of 16");let e,s,t,i,r,n;if(Ri){for(s=new Uint8Array(a),i=new ArrayBuffer(a.byteLength),t=new Uint8Array(i),r=0;rparseFloat(M)))),X(a,"MRF_META/CachedSource"))throw new P("mrf:open","currently does not support MRF referencing other data files");const y=X(a,"MRF_META/GeoTags"),d=X(y,"BoundingBox");let x,g=!1;if(d!=null){const M=parseFloat(d.getAttribute("minx")),O=parseFloat(d.getAttribute("miny")),D=parseFloat(d.getAttribute("maxx")),E=parseFloat(d.getAttribute("maxy")),C=Z(y,"Projection")||"";let $=j.WGS84;if(C!=="LOCAL_CS[]")if(C.toLowerCase().startsWith("epsg:")){const B=Number(C.slice(5));isNaN(B)||B===0||($=new j({wkid:B}))}else $=Fe(C)??j.WGS84;else g=!0,$=new j({wkid:3857});x=new W(M,O,D,E),x.spatialReference=$}else g=!0,x=new W({xmin:-.5,ymin:.5-i,xmax:t-.5,ymax:.5,spatialReference:new j({wkid:3857})});const w=X(a,"MRF_META/Rsets"),I=parseInt((w==null?void 0:w.getAttribute("scale"))||"2",10),S=x.spatialReference,v=new ge({origin:new H({x:x.xmin,y:x.ymax,spatialReference:S}),blockWidth:u,blockHeight:f,pyramidBlockWidth:u,pyramidBlockHeight:f,compression:n,pyramidScalingFactor:I}),F=new H({x:x.width/t,y:x.height/i,spatialReference:S}),T=new xe({width:t,height:i,extent:x,isPseudoSpatialReference:g,spatialReference:S,bandCount:r,pixelType:o,pixelSize:F,noDataValue:h,storageInfo:v}),k=Z(a,"datafile"),_=Z(a,"IndexFile");return{rasterInfo:T,files:{mrf:this.url,index:_||this.url.replace(".mrf",".idx"),data:k||this.url.replace(".mrf",se.get(n).blobExtension)}}}async _fetchAuxiliaryData(a){try{const{data:e}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:a==null?void 0:a.signal});return We(e)}catch{return null}}};b([R()],ue.prototype,"_files",void 0),b([R()],ue.prototype,"_storageIndex",void 0),b([R({type:String,json:{write:!0}})],ue.prototype,"datasetFormat",void 0),ue=b([Q("esri.layers.support.rasterIO.MRFRaster")],ue);const ns=ue,$e=(a,e)=>{var s;return(s=a.get(e))==null?void 0:s.values},de=(a,e)=>{var s,t;return(t=(s=a.get(e))==null?void 0:s.values)==null?void 0:t[0]};let oe=class extends ce{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(a){var m,y,d,x;await this.init();const e=a?a.signal:null,{data:s}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:e});if(!s)throw new P("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:t,firstIFDPos:i,isBigTiff:r}=vi(s),n=[];await this._readIFDs(n,s,t,i,0,r?8:4,e);const{imageInfo:l,rasterInfo:o}=this._parseIFDs(n),c=Ti(n),u=_i(n);if(this._headerInfo={littleEndian:t,isBigTiff:r,ifds:n,pyramidIFDs:c,maskIFDs:u,...l},this._set("rasterInfo",o),!l.isSupported)throw new P("tiffraster:open","this tiff is not supported: "+l.message);if(!l.tileWidth)throw new P("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");o.isPseudoSpatialReference&&_e.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");const f=(y=(m=n[0].get("PREDICTOR"))==null?void 0:m.values)==null?void 0:y[0];if(((x=(d=n[0].get("SAMPLEFORMAT"))==null?void 0:d.values)==null?void 0:x[0])===3&&f===2)throw new P("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floatting point data");const{skipExtensions:h=[]}=this.ioConfig;if(!h.includes("aux.xml")){const g=await this._fetchAuxiliaryMetaData(a);g!=null&&this._processPAMInfo(g,o)}h.includes("vat.dbf")||o.bandCount!==1||o.pixelType!=="u8"||(o.attributeTable=await this._fetchAuxiliaryTable(a),o.attributeTable!=null&&(o.keyProperties.DataType="thematic")),this.updateTileInfo()}async fetchRawTile(a,e,s,t={}){var r;if(!((r=this._headerInfo)!=null&&r.isSupported)||this.isBlockOutside(a,e,s))return null;const i=await this._fetchRawTiffTile(a,e,s,!1,t);if(i!=null&&this._headerInfo.hasMaskBand){const n=await this._fetchRawTiffTile(a,e,s,!0,t);n!=null&&n.pixels[0]instanceof Uint8Array&&(i.mask=n.pixels[0])}return i}_parseIFDs(a){var O,D;const e=ki(a),{width:s,height:t,tileWidth:i,tileHeight:r,planes:n,pixelType:l,compression:o,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidBlockWidth:f,pyramidBlockHeight:p,tileBoundary:h,affine:m,metadata:y}=e,d=((O=e.extent.spatialReference)==null?void 0:O.wkt)||((D=e.extent.spatialReference)==null?void 0:D.wkid);let x=Fe(d),g=!!e.isPseudoGeographic;x==null&&(g=!0,x=new j({wkid:3857}));const w=new W({...e.extent,spatialReference:x}),I=new H(w?{x:w.xmin,y:w.ymax,spatialReference:x}:{x:0,y:0}),S=new ge({blockWidth:i,blockHeight:r,pyramidBlockWidth:f,pyramidBlockHeight:p,compression:o,origin:I,firstPyramidLevel:c,maximumPyramidLevel:u,blockBoundary:h}),v=new H({x:(w.xmax-w.xmin)/s,y:(w.ymax-w.ymin)/t,spatialReference:x}),F=y?{BandProperties:y.bandProperties,DataType:y.dataType}:{};let T=null;const k=de(a[0],"PHOTOMETRICINTERPRETATION"),_=$e(a[0],"COLORMAP");if(k<=3&&(_==null?void 0:_.length)>3&&_.length%3==0){T=[];const E=_.length/3;for(let C=0;C>>8,_[C+E]>>>8,_[C+2*E]>>>8])}const M=new xe({width:s,height:t,bandCount:n,pixelType:l,pixelSize:v,storageInfo:S,spatialReference:x,isPseudoSpatialReference:g,keyProperties:F,extent:w,colormap:T,statistics:y?y.statistics:null});return m!=null&&m.length&&(M.nativeExtent=new W({xmin:-.5,ymin:.5-t,xmax:s-.5,ymax:.5,spatialReference:x}),M.transform=new Le({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),M.extent=M.transform.forwardTransform(M.nativeExtent),M.pixelSize=new H({x:(w.xmax-w.xmin)/s,y:(w.ymax-w.ymin)/t,spatialReference:x}),S.origin.x=-.5,S.origin.y=.5),{imageInfo:e,rasterInfo:M}}_processPAMInfo(a,e){if(e.statistics=a.statistics??e.statistics,e.histograms=a.histograms,a.histograms&&e.statistics==null&&(e.statistics=Ae(a.histograms)),a.transform&&e.transform==null){e.transform=a.transform,e.nativeExtent=e.extent;const s=e.transform.forwardTransform(e.nativeExtent);e.pixelSize=new H({x:(s.xmax-s.xmin)/e.width,y:(s.ymax-s.ymin)/e.height,spatialReference:e.spatialReference}),e.extent=s}e.isPseudoSpatialReference&&a.spatialReference&&(e.spatialReference=a.spatialReference,e.extent.spatialReference=e.nativeExtent.spatialReference=e.storageInfo.origin.spatialReference=e.spatialReference)}async _readIFDs(a,e,s,t,i,r=4,n){if(!t)return null;(t>=e.byteLength||t<0)&&(e=(await this.request(this.url,{range:{from:t+i,to:t+i+this._bufferSize},responseType:"array-buffer",signal:n})).data,i=t+i,t=0);const l=await this._readIFD(e,s,t,i,Ie.tiffTags,r,n);if(a.push(l.ifd),!l.nextIFD)return null;await this._readIFDs(a,e,s,l.nextIFD-i,i,r,n)}async _readIFD(a,e,s,t,i=Ie.tiffTags,r=4,n){var o,c;if(!a)return null;const l=Fi(a,e,s,t,i,r);if(l.success){const u=[];if((o=l.ifd)==null||o.forEach(f=>{f.values||u.push(f)}),u.length>0){const f=u.map(h=>h.offlineOffsetSize).filter(De),p=Math.min.apply(null,f.map(h=>h[0]));if(Math.min.apply(null,f.map(h=>h[0]+h[1]))-p<=this._bufferSize){const{data:h}=await this.request(this.url,{range:{from:p,to:p+this._bufferSize},responseType:"array-buffer",signal:n});a=h,t=p,u.forEach(m=>Mi(a,e,m,t))}}if((c=l.ifd)!=null&&c.has("GEOKEYDIRECTORY")){const f=l.ifd.get("GEOKEYDIRECTORY"),p=f==null?void 0:f.values;if(p&&p.length>4){const h=p[0]+"."+p[1]+"."+p[2],m=await this._readIFD(a,e,f.valueOffset+6-t,t,Ie.geoKeys,2,n);f.data=m.ifd,f.data&&f.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[h]})}}return l}if(l.requiredBufferSize&&l.requiredBufferSize!==a.byteLength)return(a=(await this.request(this.url,{range:{from:t,to:t+l.requiredBufferSize+4},responseType:"array-buffer",signal:n})).data).byteLengththis.request(this.url,{range:v,responseType:"array-buffer",signal:i.signal})),f=await Promise.all(u),p=f.map(v=>v.data.byteLength).reduce((v,F)=>v+F),h=f.length===1?f[0].data:new ArrayBuffer(p),m=[0],y=[0];if(f.length>1){const v=new Uint8Array(h);for(let F=0,T=0;Fm||s>y||ee.add(t)),e}static async open(e){const{url:s,ioConfig:t,sourceJSON:i}=e;let r=e.datasetFormat;r==null&&s.lastIndexOf(".")&&(r=s.slice(s.lastIndexOf(".")+1).toUpperCase()),r==="OVR"||r==="TIF"?r="TIFF":r!=="JPG"&&r!=="JPEG"&&r!=="JFIF"||(r="JPG"),s.toLowerCase().includes("/imageserver")&&!s.toLowerCase().includes("/wcsserver")&&(r="RasterTileServer");const n={url:s,sourceJSON:i,datasetFormat:r,ioConfig:t??{bandIds:null,sampling:null}};let l,o;if(r&&this.supportedFormats.has(r)){if(r==="CRF"&&!(t!=null&&t.enableCRF))throw new P("rasterfactory:open",`cannot open raster: ${s}`);return l=G.get(r).constructor,o=new l(n),await o.open({signal:e.signal}),o}if(r)throw new P("rasterfactory:open","not a supported format "+r);const c=Array.from(G.keys());let u=0;const f=()=>(r=c[u++],r&&(r!=="CRF"||t!=null&&t.enableCRF)?(l=G.get(r).constructor,o=new l(n),o.open({signal:e.signal}).then(()=>o).catch(()=>f())):null);return f()}static register(e,s,t){G.has(e.toUpperCase())||G.set(e.toUpperCase(),{desc:s,constructor:t})}}let z=class extends Ct(Pt(Ot($t(Ut(Yi(Dt(Bt(Jt(zt(Et(Vt))))))))))){constructor(...a){super(...a),this._primaryRasters=[],this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null,this._debouncedSaveOperations=Nt(async(e,s,t)=>{const{save:i,saveAs:r}=await ht(()=>import("./imageryUtils-djrWgZtb.js"),__vite__mapDeps([2,3,0,1,4]));switch(e){case we.SAVE:return i(this,s);case we.SAVE_AS:return r(this,t,s)}})}normalizeCtorArgs(a,e){return typeof a=="string"?{url:a,...e}:a}load(a){const e=a!=null?a.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},a).catch(At).then(()=>this._openRaster(e))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){var l;const a=[new he({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"}),new he({name:"Raster.ServicePixelValue.Raw",alias:"Raw Pixel Value",domain:null,editable:!1,length:50,type:"string"})],{rasterInfo:e}=this,s=e==null?void 0:e.attributeTable,t=s!=null?s.fields:null,i="Raster.";if(t){const o=t.filter(c=>c.type!=="oid"&&c.name.toLowerCase()!=="value").map(c=>{const u=c.clone();return u.name=i+c.name,u});a.push(...o)}const r=e==null?void 0:e.dataType,n=e==null?void 0:e.multidimensionalInfo;if((r==="vector-magdir"||r==="vector-uv")&&n!=null){const o=(l=n.variables[0].unit)==null?void 0:l.trim(),c="Magnitude"+(o?` (${o})`:"");a.push(new he({name:"Raster.Magnitude",alias:c,domain:null,editable:!1,type:"double"})),a.push(new he({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return a}createPopupTemplate(a){const{rasterFields:e}=this,s=new Set(e.map(({name:t})=>t).filter(t=>t.toLowerCase()!=="raster.servicepixelvalue.raw"));return Ht({fields:e,title:this.title},{...a,visibleFieldNames:s})}async generateRasterInfo(a,e){var s;if(!(a=Ne(Be,a)))return this.rasterInfo;try{const t={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(n=>t[n.url]=n);const i=ze(((s=a.functionDefinition)==null?void 0:s.toJSON())??a.toJSON(),t),r=new Ee({rasterFunction:i});return await r.open(e),r.rasterInfo}catch(t){throw t instanceof P?t:new P("imagery-tile-layer","the given raster function is not supported")}}async save(a){return this._debouncedSaveOperations(we.SAVE,a)}async saveAs(a,e){return this._debouncedSaveOperations(we.SAVE_AS,e,a)}write(a,e){const s=this._primaryRasters[0]??this.raster;if(this.loaded?s.datasetFormat==="RasterTileServer"&&(s.tileType==="Raster"||s.tileType==="Map"):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(a,e);if(e!=null&&e.messages){const t=`${e.origin}/${e.layerContainerType||"operational-layers"}`;e.messages.push(new P("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${t}'`,{layer:this}))}return null}async _openRaster(a){var t;let e=!1;if(this.raster)this.raster.rasterInfo||await this.raster.open(),this.raster.datasetFormat==="Function"?(e=!0,this._primaryRasters=this.raster.primaryRasters.rasters):this._primaryRasters=[this.raster],this.url=this.raster.url;else{const{rasterFunction:i}=this,r=[this.url];i&&Ni(i.toJSON(),r);const n=await Promise.all(r.map(o=>os.open({url:o,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:a}))),l=n.findIndex(o=>o==null);if(l>-1)throw new P("imagery-tile-layer:open",`cannot open raster: ${r[l]}`);if(this._primaryRasters=n,i){const o={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(f=>o[f.url]=f);const c=ze(((t=i.functionDefinition)==null?void 0:t.toJSON())??i.toJSON(),o),u=new Ee({rasterFunction:c});try{await u.open(),this.raster=u}catch(f){const p=_e.getLogger(this);f instanceof P&&p.error("imagery-tile-layer:open",f.message),p.warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=n[0]}}else this.raster=n[0]}const s=this.raster.rasterInfo;if(!s)throw new P("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("rasterInfo",e?s:this._primaryRasters[0].rasterInfo),this._set("spatialReference",s.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,this.sourceJSON!=null){const i=this.raster.tileType==="Map"&&this.sourceJSON.minLOD!=null&&this.sourceJSON.maxLOD!=null?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(i,{origin:"service"})}else this.read({tileInfo:this.rasterInfo.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||(this.title=this.raster.datasetName),this.raster.tileType==="Map"&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles(Lt(()=>this.customParameters,i=>{this.raster&&(this.raster.ioConfig.customFetchParameters=i)}))}};b([R({clonable:!1})],z.prototype,"_primaryRasters",void 0),b([R({type:[Wt],json:{write:{overridePolicy(){var a;return{enabled:!this.loaded||this.raster.tileType==="Raster"||((a=this.bandIds)==null?void 0:a.join(","))!=="0,1,2"}}}}})],z.prototype,"bandIds",void 0),b([R({json:{write:{overridePolicy(){return{enabled:!this.loaded||this.raster.tileType==="Raster"||this.interpolation!=="bilinear"}}}}}),jt(ui)],z.prototype,"interpolation",void 0),b([R(qt)],z.prototype,"legendEnabled",void 0),b([R({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],z.prototype,"isReference",void 0),b([R({type:["show","hide"]})],z.prototype,"listMode",void 0),b([R({json:{read:!0,write:!0}})],z.prototype,"blendMode",void 0),b([R()],z.prototype,"sourceJSON",void 0),b([R({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],z.prototype,"version",void 0),b([R({readOnly:!0,json:{read:!1}})],z.prototype,"type",void 0),b([R({type:["ArcGISTiledImageServiceLayer"]})],z.prototype,"operationalLayerType",void 0),b([R({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(a,e)=>!e.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||this.raster.tileType==="Raster"}},writer(a,e,s){e[s]=!a}}}})],z.prototype,"popupEnabled",void 0),b([R({type:Gt,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||this.raster.tileType==="Raster"}}}}})],z.prototype,"popupTemplate",void 0),b([R({readOnly:!0})],z.prototype,"defaultPopupTemplate",null),b([R({readOnly:!0,type:[he]})],z.prototype,"fields",void 0),b([R({readOnly:!0,type:[he]})],z.prototype,"rasterFields",null),z=b([Q("esri.layers.ImageryTileLayer")],z);const bs=z;export{bs as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/imageryUtils-djrWgZtb.js","assets/utils-rBsg-VY8.js","assets/jsonContext-cWV_-jAj.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/ImageryTileLayerView3D-OR6Vjdkd.js b/dist/assets/ImageryTileLayerView3D-OR6Vjdkd.js new file mode 100644 index 0000000..cfca681 --- /dev/null +++ b/dist/assets/ImageryTileLayerView3D-OR6Vjdkd.js @@ -0,0 +1 @@ +import{e as n,y as l,k1 as L,c as E,r as I,fB as O,K as P,aa as _,k2 as F,k3 as j}from"./index-pCX-0tJH.js";import{s as v,v as G}from"./rasterProjectionHelper-3sL58SxG.js";import{n as k}from"./LayerView3D-57OghbRh.js";import{o as A}from"./TiledLayerView3D-_U1Q993H.js";import{u as M}from"./LayerView-ixwLVnzr.js";import{a as V}from"./RefreshableLayerView-DVYs7L04.js";import{r as W}from"./drapedUtils-F1ywqHD-.js";const $=t=>{let e=class extends t{constructor(){super(...arguments),this._rasterFieldPrefix="Raster.",this.layer=null,this.view=null,this.tileInfo=null}get fullExtent(){return this._getfullExtent()}_getfullExtent(){return v(this.layer.rasterInfo,this.view.spatialReference)}get hasTilingEffects(){return!!(this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment)}get datumTransformation(){return G(this.layer.fullExtent,this.view.spatialReference,!0)}supportsSpatialReference(r){return!!v(this.layer.rasterInfo,r)}async fetchPopupFeatures(r,a){const{layer:i}=this;if(!r)throw new I("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:i});const{popupEnabled:h}=i,y=O(i,a);if(!h||y==null)throw new I("imageryTileLayerView:fetchPopupFeatures","Missing required popupTemplate or popupEnabled",{popupEnabled:h,popupTemplate:y});const o=[],{value:p,magdirValue:s,processedValue:b}=await i.identify(r,{timeExtent:this.timeExtent});let c="";if(p&&p.length){c=i.type==="imagery-tile"&&i.hasStandardTime()&&p[0]!=null?p.map(w=>i.getStandardTimeValue(w)).join(", "):p.join(", ");const d={ObjectId:0},T="Raster.ServicePixelValue";d[T]=(b==null?void 0:b.join(", "))??c,d[T+".Raw"]=c;const x=i.rasterInfo.attributeTable;if(x!=null){const{fields:w,features:z}=x,S=w.find(({name:u})=>u.toLowerCase()==="value"),g=S?z.find(u=>String(u.attributes[S.name])===c):null;if(g)for(const u in g.attributes)g.attributes.hasOwnProperty(u)&&(d[this._rasterFieldPrefix+u]=g.attributes[u])}const R=i.rasterInfo.dataType;R!=="vector-magdir"&&R!=="vector-uv"||(d["Raster.Magnitude"]=s==null?void 0:s[0],d["Raster.Direction"]=s==null?void 0:s[1]);const f=new P(this.fullExtent.clone(),null,d);f.layer=i,f.sourceLayer=f.layer,o.push(f)}return o}};return n([l()],e.prototype,"layer",void 0),n([l(L)],e.prototype,"timeExtent",void 0),n([l()],e.prototype,"view",void 0),n([l()],e.prototype,"fullExtent",null),n([l()],e.prototype,"tileInfo",void 0),n([l({readOnly:!0})],e.prototype,"hasTilingEffects",null),n([l()],e.prototype,"datumTransformation",null),e=n([E("esri.views.layers.ImageryTileLayerView")],e),e};let m=class extends $(V(A(k(M)))){constructor(){super(...arguments),this.type="imagery-tile-3d",this.isAlignedMapTile=!0}initialize(){this.layer.increaseRasterJobHandlerUsage(),this.fullExtent==null&&this.addResolvingPromise(Promise.reject(new I("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const t=_(()=>{var e,r;return(r=(e=this.view)==null?void 0:e.basemapTerrain)==null?void 0:r.tilingSchemeLocked}).then(()=>{const e=this.view.basemapTerrain.tilingScheme,r=this.layer.tileInfo,a=["png","png24","png32","jpg","mixed"].includes(r.format)&&e.compatibleWith(r);this.isAlignedMapTile=a;const i=a?r:e.toTileInfo();this.tileInfo=i,this._updatingHandles.add(()=>[this.layer.renderer,this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent],()=>this.refresh())});this.addResolvingPromise(t)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this.view=null}get _blankTile(){const t=document.createElement("canvas"),e=t.getContext("2d"),[r,a]=this.tileInfo.size;return t.width=r,t.height=a,e.clearRect(0,0,r,a),e.getImageData(0,0,r,a)}get imageFormatIsOpaque(){return this.layer.tileInfo.format==="jpg"}get hasMixedImageFormats(){return this.layer.tileInfo.format==="mixed"}get dataLevelRange(){var a,i;const t=this.layer.tileInfo,e=(a=this.tileInfo.lodAt(0))==null?void 0:a.scale,r=(i=this.layer.tileInfo.lodAt(t.lods.length-1))==null?void 0:i.scale;return this.levelRangeFromScaleRange(e,r)}_getfullExtent(){var t;return v(this.layer.rasterInfo,((t=this.view.basemapTerrain)==null?void 0:t.spatialReference)!=null?this.view.basemapTerrain.spatialReference:this.view.spatialReference)}async fetchTile(t,e,r,a){const i=this.tileInfo,h=this._canSymbolizeInWebGL(),y={tileInfo:i,requestRawData:h,signal:a.signal,timeExtent:this.timeExtent,requestAsImageElement:this.isAlignedMapTile},o=await this.layer.fetchTile(t,e,r,y);if(o instanceof HTMLImageElement)return o;let p=o==null?void 0:o.pixelBlock;if(p==null)return this._blankTile;if(!h&&(p=await this.layer.applyRenderer(o),p==null))return this._blankTile;const s=new F([t,e,r],p,i.size[0],i.size[1]);return h?(s.symbolizerRenderer=this.layer.symbolizer.rendererJSON,s.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(t)),s.transformGrid=o.transformGrid):s.isRendereredSource=!0,s.interpolation=this.layer.interpolation,s.bandIds=this.layer.bandIds,s}_getSymbolizerOptions(t){var r;const e=this.tileInfo.lodAt(t).resolution;return{pixelBlock:null,isGCS:((r=this.view.basemapTerrain)==null?void 0:r.spatialReference)!=null?this.view.basemapTerrain.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(t){this._canSymbolizeInWebGL()&&JSON.stringify(t.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(t.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(t.lij[0])))}createFetchPopupFeaturesQueryGeometry(t,e){return W(t,e,this.view)}refresh(){this.emit("data-changed")}async doRefresh(){this.suspended||this.emit("data-changed")}_canSymbolizeInWebGL(){var i,h;const t=j("3d"),{symbolizer:e}=this.layer,r=(h=(i=e.lookup)==null?void 0:i.colormapLut)==null?void 0:h.indexedColormap,a=r&&r.length>4*(t.maxTextureSize||4906);return t.supportsTextureFloat&&e.canRenderInWebGL&&!a}};n([l({readOnly:!0})],m.prototype,"_blankTile",null),n([l({readOnly:!0})],m.prototype,"imageFormatIsOpaque",null),n([l({readOnly:!0})],m.prototype,"hasMixedImageFormats",null),n([l({readOnly:!0})],m.prototype,"dataLevelRange",null),m=n([E("esri.views.3d.layers.ImageryTileLayerView3D")],m);const U=m;export{U as default}; diff --git a/dist/assets/ImageryTileLayerView3D-kyd0hRhY.js b/dist/assets/ImageryTileLayerView3D-kyd0hRhY.js deleted file mode 100644 index 55f3b21..0000000 --- a/dist/assets/ImageryTileLayerView3D-kyd0hRhY.js +++ /dev/null @@ -1 +0,0 @@ -import{e as n,y as l,jW as L,c as E,E as I,fG as O,S as P,w as _,jX as j,jY as F}from"./index-J0iiHjMT.js";import{s as v,v as G}from"./rasterProjectionHelper-KvYWHIT_.js";import{n as A}from"./LayerView3D-iOx2MD1g.js";import{o as k}from"./TiledLayerView3D-Av58zTxG.js";import{u as M}from"./LayerView-efDufa6j.js";import{a as V}from"./RefreshableLayerView-Pd4dLcWr.js";import{r as W}from"./drapedUtils-9db1OpTX.js";const $=t=>{let e=class extends t{constructor(){super(...arguments),this._rasterFieldPrefix="Raster.",this.layer=null,this.view=null,this.tileInfo=null}get fullExtent(){return this._getfullExtent()}_getfullExtent(){return v(this.layer.rasterInfo,this.view.spatialReference)}get hasTilingEffects(){return!!(this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment)}get datumTransformation(){return G(this.layer.fullExtent,this.view.spatialReference,!0)}supportsSpatialReference(r){return!!v(this.layer.rasterInfo,r)}async fetchPopupFeatures(r,a){const{layer:i}=this;if(!r)throw new I("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:i});const{popupEnabled:h}=i,y=O(i,a);if(!h||y==null)throw new I("imageryTileLayerView:fetchPopupFeatures","Missing required popupTemplate or popupEnabled",{popupEnabled:h,popupTemplate:y});const o=[],{value:p,magdirValue:s,processedValue:b}=await i.identify(r,{timeExtent:this.timeExtent});let c="";if(p&&p.length){c=i.type==="imagery-tile"&&i.hasStandardTime()&&p[0]!=null?p.map(w=>i.getStandardTimeValue(w)).join(", "):p.join(", ");const d={ObjectId:0},T="Raster.ServicePixelValue";d[T]=(b==null?void 0:b.join(", "))??c,d[T+".Raw"]=c;const x=i.rasterInfo.attributeTable;if(x!=null){const{fields:w,features:z}=x,S=w.find(({name:u})=>u.toLowerCase()==="value"),g=S?z.find(u=>String(u.attributes[S.name])===c):null;if(g)for(const u in g.attributes)g.attributes.hasOwnProperty(u)&&(d[this._rasterFieldPrefix+u]=g.attributes[u])}const R=i.rasterInfo.dataType;R!=="vector-magdir"&&R!=="vector-uv"||(d["Raster.Magnitude"]=s==null?void 0:s[0],d["Raster.Direction"]=s==null?void 0:s[1]);const f=new P(this.fullExtent.clone(),null,d);f.layer=i,f.sourceLayer=f.layer,o.push(f)}return o}};return n([l()],e.prototype,"layer",void 0),n([l(L)],e.prototype,"timeExtent",void 0),n([l()],e.prototype,"view",void 0),n([l()],e.prototype,"fullExtent",null),n([l()],e.prototype,"tileInfo",void 0),n([l({readOnly:!0})],e.prototype,"hasTilingEffects",null),n([l()],e.prototype,"datumTransformation",null),e=n([E("esri.views.layers.ImageryTileLayerView")],e),e};let m=class extends $(V(k(A(M)))){constructor(){super(...arguments),this.type="imagery-tile-3d",this.isAlignedMapTile=!0}initialize(){this.layer.increaseRasterJobHandlerUsage(),this.fullExtent==null&&this.addResolvingPromise(Promise.reject(new I("layerview:spatial-reference-incompatible","The layer extent cannot be projected to the view's spatial reference",{layer:this.layer})));const t=_(()=>{var e,r;return(r=(e=this.view)==null?void 0:e.basemapTerrain)==null?void 0:r.tilingSchemeLocked}).then(()=>{const e=this.view.basemapTerrain.tilingScheme,r=this.layer.tileInfo,a=["png","png24","png32","jpg","mixed"].includes(r.format)&&e.compatibleWith(r);this.isAlignedMapTile=a;const i=a?r:e.toTileInfo();this.tileInfo=i,this._updatingHandles.add(()=>[this.layer.renderer,this.layer.interpolation,this.layer.bandIds,this.layer.multidimensionalDefinition,this.layer.multidimensionalSubset,this.layer.rasterFunction,this.timeExtent],()=>this.refresh())});this.addResolvingPromise(t)}destroy(){this.layer.decreaseRasterJobHandlerUsage(),this.view=null}get _blankTile(){const t=document.createElement("canvas"),e=t.getContext("2d"),[r,a]=this.tileInfo.size;return t.width=r,t.height=a,e.clearRect(0,0,r,a),e.getImageData(0,0,r,a)}get imageFormatIsOpaque(){return this.layer.tileInfo.format==="jpg"}get hasMixedImageFormats(){return this.layer.tileInfo.format==="mixed"}get dataLevelRange(){var a,i;const t=this.layer.tileInfo,e=(a=this.tileInfo.lodAt(0))==null?void 0:a.scale,r=(i=this.layer.tileInfo.lodAt(t.lods.length-1))==null?void 0:i.scale;return this.levelRangeFromScaleRange(e,r)}_getfullExtent(){var t;return v(this.layer.rasterInfo,((t=this.view.basemapTerrain)==null?void 0:t.spatialReference)!=null?this.view.basemapTerrain.spatialReference:this.view.spatialReference)}async fetchTile(t,e,r,a){const i=this.tileInfo,h=this._canSymbolizeInWebGL(),y={tileInfo:i,requestRawData:h,signal:a.signal,timeExtent:this.timeExtent,requestAsImageElement:this.isAlignedMapTile},o=await this.layer.fetchTile(t,e,r,y);if(o instanceof HTMLImageElement)return o;let p=o==null?void 0:o.pixelBlock;if(p==null)return this._blankTile;if(!h&&(p=await this.layer.applyRenderer(o),p==null))return this._blankTile;const s=new j([t,e,r],p,i.size[0],i.size[1]);return h?(s.symbolizerRenderer=this.layer.symbolizer.rendererJSON,s.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(t)),s.transformGrid=o.transformGrid):s.isRendereredSource=!0,s.interpolation=this.layer.interpolation,s.bandIds=this.layer.bandIds,s}_getSymbolizerOptions(t){var r;const e=this.tileInfo.lodAt(t).resolution;return{pixelBlock:null,isGCS:((r=this.view.basemapTerrain)==null?void 0:r.spatialReference)!=null?this.view.basemapTerrain.spatialReference.isGeographic:this.view.spatialReference.isGeographic,resolution:{x:e,y:e},bandIds:this.layer.bandIds}}ensureSymbolizerParameters(t){this._canSymbolizeInWebGL()&&JSON.stringify(t.symbolizerRenderer)!==JSON.stringify(this.layer.symbolizer.rendererJSON)&&(t.symbolizerParameters=this.layer.symbolizer.generateWebGLParameters(this._getSymbolizerOptions(t.lij[0])))}createFetchPopupFeaturesQueryGeometry(t,e){return W(t,e,this.view)}refresh(){this.emit("data-changed")}async doRefresh(){this.suspended||this.emit("data-changed")}_canSymbolizeInWebGL(){var i,h;const t=F("3d"),{symbolizer:e}=this.layer,r=(h=(i=e.lookup)==null?void 0:i.colormapLut)==null?void 0:h.indexedColormap,a=r&&r.length>4*(t.maxTextureSize||4906);return t.supportsTextureFloat&&e.canRenderInWebGL&&!a}};n([l({readOnly:!0})],m.prototype,"_blankTile",null),n([l({readOnly:!0})],m.prototype,"imageFormatIsOpaque",null),n([l({readOnly:!0})],m.prototype,"hasMixedImageFormats",null),n([l({readOnly:!0})],m.prototype,"dataLevelRange",null),m=n([E("esri.views.3d.layers.ImageryTileLayerView3D")],m);const U=m;export{U as default}; diff --git a/dist/assets/IntegratedMeshLayer-T6vTIezB.js b/dist/assets/IntegratedMeshLayer-T6vTIezB.js deleted file mode 100644 index 737fa51..0000000 --- a/dist/assets/IntegratedMeshLayer-T6vTIezB.js +++ /dev/null @@ -1 +0,0 @@ -import{iB as w,V as T,bV as _,bW as O,e as s,y as r,c as f,iO as I,em as $,dM as L,dN as x,dO as b,dP as M,en as N,fl as j,C as A,hh as E,dQ as P,iP as h,E as d,iQ as m,iR as V,Z as u,iS as D,ip as J,iq as U,ir as K,is as R,eb as C,dt as z,iH as H,c7 as Q}from"./index-J0iiHjMT.js";import{f as l}from"./SceneModification-dyp2M_Yg.js";var a;let n=a=class extends w(T.ofType(l)){constructor(e){super(e),this.url=null}clone(){return new a({url:this.url,items:this.items.map(e=>e.clone())})}toJSON(e){return this.toArray().map(t=>t.toJSON(e)).filter(t=>!!t.geometry)}static fromJSON(e,t){const o=new a;for(const p of e)o.add(l.fromJSON(p,t));return o}static async fromUrl(e,t,o){const p={url:_(e),origin:"service"},g=await O(e,{responseType:"json",signal:o==null?void 0:o.signal}),S=t.toJSON(),y=[];for(const c of g.data)y.push(l.fromJSON({...c,geometry:{...c.geometry,spatialReference:S}},p));return new a({url:e,items:y})}};s([r({type:String})],n.prototype,"url",void 0),n=a=s([f("esri.layers.support.SceneModifications")],n);const v=n;let i=class extends I($(L(x(b(M(N(Q))))))){constructor(...e){super(...e),this.geometryType="mesh",this.operationalLayerType="IntegratedMeshLayer",this.type="integrated-mesh",this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.profile="mesh-pyramids",this.modifications=null,this._modificationsSource=null,this.path=null}initialize(){this.addHandles(j(()=>this.modifications,"after-changes",()=>this.modifications=this.modifications,A))}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}readModifications(e,t,o){this._modificationsSource={url:E(e,o),context:o}}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){const t=e==null?void 0:e.signal;try{await this.loadFromPortal({supportedTypes:["Scene Service"]},e)}catch(o){P(o)}if(await this._fetchService(t),this._modificationsSource!=null){const o=await v.fromUrl(this._modificationsSource.url,this.spatialReference,e);this.setAtOrigin("modifications",o,this._modificationsSource.context.origin),this._modificationsSource=null}await this._fetchIndexAndUpdateExtent(this.nodePages,t)}beforeSave(){if(this._modificationsSource!=null)return this.load().then(()=>{},()=>{})}async saveAs(e,t){return this._debouncedSaveOperations(h.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"};return this._debouncedSaveOperations(h.SAVE,e)}validateLayer(e){if(e.layerType&&e.layerType!=="IntegratedMesh")throw new d("integrated-mesh-layer:layer-type-not-supported","IntegratedMeshLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new d("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"});if(this.version.major>1)throw new d("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"})}_getTypeKeywords(){return["IntegratedMeshLayer"]}_validateElevationInfo(){const e=this.elevationInfo,t="Integrated mesh layers";m(u.getLogger(this),V(t,"absolute-height",e)),m(u.getLogger(this),D(t,e))}};s([r({type:String,readOnly:!0})],i.prototype,"geometryType",void 0),s([r({type:["show","hide"]})],i.prototype,"listMode",void 0),s([r({type:["IntegratedMeshLayer"]})],i.prototype,"operationalLayerType",void 0),s([r({json:{read:!1},readOnly:!0})],i.prototype,"type",void 0),s([r({type:J,readOnly:!0})],i.prototype,"nodePages",void 0),s([r({type:[U],readOnly:!0})],i.prototype,"materialDefinitions",void 0),s([r({type:[K],readOnly:!0})],i.prototype,"textureSetDefinitions",void 0),s([r({type:[R],readOnly:!0})],i.prototype,"geometryDefinitions",void 0),s([r({readOnly:!0})],i.prototype,"serviceUpdateTimeStamp",void 0),s([r({type:v}),C({origins:["web-scene","portal-item"],type:"resource",prefix:"modifications"})],i.prototype,"modifications",void 0),s([z(["web-scene","portal-item"],"modifications")],i.prototype,"readModifications",null),s([r(H)],i.prototype,"elevationInfo",null),s([r({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],i.prototype,"path",void 0),i=s([f("esri.layers.IntegratedMeshLayer")],i);const F=i;export{F as default}; diff --git a/dist/assets/IntegratedMeshLayer-cHWMTQWg.js b/dist/assets/IntegratedMeshLayer-cHWMTQWg.js new file mode 100644 index 0000000..cbc199c --- /dev/null +++ b/dist/assets/IntegratedMeshLayer-cHWMTQWg.js @@ -0,0 +1 @@ +import{iC as w,V as T,au as I,av as _,e as s,y as r,c as f,iR as O,ef as L,dH as $,dI as x,dJ as M,dK as N,eg as b,fg as j,a9 as A,hj as V,dL as E,iS as h,r as d,iT as m,iU as J,R as u,iV as U,ir as D,is as K,it as P,iu as R,e4 as C,dt as z,iI as H,aI as F}from"./index-pCX-0tJH.js";import{f as l}from"./SceneModification-E4lNPbBQ.js";var a;let n=a=class extends w(T.ofType(l)){constructor(e){super(e),this.url=null}clone(){return new a({url:this.url,items:this.items.map(e=>e.clone())})}toJSON(e){return this.toArray().map(t=>t.toJSON(e)).filter(t=>!!t.geometry)}static fromJSON(e,t){const o=new a;for(const p of e)o.add(l.fromJSON(p,t));return o}static async fromUrl(e,t,o){const p={url:I(e),origin:"service"},v=await _(e,{responseType:"json",signal:o==null?void 0:o.signal}),S=t.toJSON(),y=[];for(const c of v.data)y.push(l.fromJSON({...c,geometry:{...c.geometry,spatialReference:S}},p));return new a({url:e,items:y})}};s([r({type:String})],n.prototype,"url",void 0),n=a=s([f("esri.layers.support.SceneModifications")],n);const g=n;let i=class extends O(L($(x(M(N(b(F))))))){constructor(...e){super(...e),this.geometryType="mesh",this.operationalLayerType="IntegratedMeshLayer",this.type="integrated-mesh",this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.profile="mesh-pyramids",this.modifications=null,this._modificationsSource=null,this.path=null}initialize(){this.addHandles(j(()=>this.modifications,"after-changes",()=>this.modifications=this.modifications,A))}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}readModifications(e,t,o){this._modificationsSource={url:V(e,o),context:o}}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}async _doLoad(e){const t=e==null?void 0:e.signal;try{await this.loadFromPortal({supportedTypes:["Scene Service"]},e)}catch(o){E(o)}if(await this._fetchService(t),this._modificationsSource!=null){const o=await g.fromUrl(this._modificationsSource.url,this.spatialReference,e);this.setAtOrigin("modifications",o,this._modificationsSource.context.origin),this._modificationsSource=null}await this._fetchIndexAndUpdateExtent(this.nodePages,t)}beforeSave(){if(this._modificationsSource!=null)return this.load().then(()=>{},()=>{})}async saveAs(e,t){return this._debouncedSaveOperations(h.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"};return this._debouncedSaveOperations(h.SAVE,e)}validateLayer(e){if(e.layerType&&e.layerType!=="IntegratedMesh")throw new d("integrated-mesh-layer:layer-type-not-supported","IntegratedMeshLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new d("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"});if(this.version.major>1)throw new d("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"})}_getTypeKeywords(){return["IntegratedMeshLayer"]}_validateElevationInfo(){const e=this.elevationInfo,t="Integrated mesh layers";m(u.getLogger(this),J(t,"absolute-height",e)),m(u.getLogger(this),U(t,e))}};s([r({type:String,readOnly:!0})],i.prototype,"geometryType",void 0),s([r({type:["show","hide"]})],i.prototype,"listMode",void 0),s([r({type:["IntegratedMeshLayer"]})],i.prototype,"operationalLayerType",void 0),s([r({json:{read:!1},readOnly:!0})],i.prototype,"type",void 0),s([r({type:D,readOnly:!0})],i.prototype,"nodePages",void 0),s([r({type:[K],readOnly:!0})],i.prototype,"materialDefinitions",void 0),s([r({type:[P],readOnly:!0})],i.prototype,"textureSetDefinitions",void 0),s([r({type:[R],readOnly:!0})],i.prototype,"geometryDefinitions",void 0),s([r({readOnly:!0})],i.prototype,"serviceUpdateTimeStamp",void 0),s([r({type:g}),C({origins:["web-scene","portal-item"],type:"resource",prefix:"modifications"})],i.prototype,"modifications",void 0),s([z(["web-scene","portal-item"],"modifications")],i.prototype,"readModifications",null),s([r(H)],i.prototype,"elevationInfo",null),s([r({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],i.prototype,"path",void 0),i=s([f("esri.layers.IntegratedMeshLayer")],i);const B=i;export{B as default}; diff --git a/dist/assets/IntegratedMeshLayerView3D-3obO3XcM.js b/dist/assets/IntegratedMeshLayerView3D-3obO3XcM.js new file mode 100644 index 0000000..802788a --- /dev/null +++ b/dist/assets/IntegratedMeshLayerView3D-3obO3XcM.js @@ -0,0 +1 @@ +import{fo as n,P as p,K as l,e,y as i,fd as m,c as d}from"./index-pCX-0tJH.js";import{E as c}from"./I3SMeshView3D-frxYFPRW.js";import{n as u}from"./LayerView3D-57OghbRh.js";import{u as h}from"./LayerView-ixwLVnzr.js";import"./I3SOverrides-XXafrk1K.js";import"./I3SNode-A9aOJfXV.js";import"./ReactiveSet-_4-UpKXZ.js";import"./meshFeatureSet-42GYfSGc.js";import"./External-Pb5poJ0S.js";import"./FeatureLayerView3D-vzwVkoh-.js";import"./FeatureLayerViewBase3D-W0Qwl4g_.js";import"./HeatmapDensity.glsl-de3m0xZZ.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./queryForSymbologySnapping-MXWRIdj-.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./QueryEngine-uvDs-vBe.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./FeatureStore-PXMUgn0j.js";import"./BoundsStore-_-dPK5c-.js";import"./projectExtentUtils-Q4rXasWA.js";import"./EventedSet-TJfupI82.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./RefreshableLayerView-DVYs7L04.js";import"./SceneModification-E4lNPbBQ.js";import"./SceneLayerWorker-fjNBmTGi.js";const g=.2;let r=class extends c(u(h)){constructor(){super(...arguments),this.type="integrated-mesh-3d",this._elevationContext="im",this._isIntegratedMesh=!0,this._supportsLabeling=!1,this.drapeTargetType=n.WithoutRasterImage}get i3slayer(){return this.layer}get updatingProgressValue(){var t;return((t=this._controller)==null?void 0:t.updatingProgress)??0}get lodFactor(){var t,o,a,s;return((s=(a=(o=(t=this.view)==null?void 0:t.qualitySettings)==null?void 0:o.sceneService)==null?void 0:a.integratedMesh)==null?void 0:s.lodFactor)??1}get progressiveLoadFactor(){return this.lodFactor>=1?g:1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),p),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this)}destroy(){this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this)}_createLayerGraphic(){const t=new l;return t.layer=this.layer,t.sourceLayer=this.layer,t}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),this.layer.modifications==null)return void(this._modifications=[]);const t=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>t,()=>this._modifications=t.toArray(),p),"modifications")}};e([i()],r.prototype,"layer",void 0),e([i()],r.prototype,"i3slayer",null),e([i(m)],r.prototype,"updatingProgress",void 0),e([i()],r.prototype,"updatingProgressValue",null),e([i()],r.prototype,"lodFactor",null),e([i({readOnly:!0})],r.prototype,"progressiveLoadFactor",null),r=e([d("esri.views.3d.layers.SceneLayerView3D")],r);const U=r;export{U as default}; diff --git a/dist/assets/IntegratedMeshLayerView3D-EW3nzBgf.js b/dist/assets/IntegratedMeshLayerView3D-EW3nzBgf.js deleted file mode 100644 index 4530c3f..0000000 --- a/dist/assets/IntegratedMeshLayerView3D-EW3nzBgf.js +++ /dev/null @@ -1 +0,0 @@ -import{ft as n,P as p,S as m,e as i,y as e,fi as l,c as d}from"./index-J0iiHjMT.js";import{E as c}from"./I3SMeshView3D-OXYwZo0p.js";import{n as u}from"./LayerView3D-iOx2MD1g.js";import{u as h}from"./LayerView-efDufa6j.js";import"./I3SOverrides-5dCbMm3h.js";import"./I3SNode-5SPByfpU.js";import"./ReactiveSet-HLstcUcf.js";import"./meshFeatureSet-Mcou8mDC.js";import"./External-GV0jSEES.js";import"./FeatureSet-d4S1oKME.js";import"./FeatureLayerView3D-t6NDkLO0.js";import"./FeatureLayerViewBase3D-VurTj7t3.js";import"./HeatmapDensity.glsl-y7dUg--m.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./queryForSymbologySnapping-I1fFQTD_.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./QueryEngine-8tLWlkSE.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./FeatureStore-X-AIJLo2.js";import"./BoundsStore-wmwfHjhp.js";import"./projectExtentUtils-TwA6ooHn.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./EventedSet-JGlFrfoR.js";import"./FeatureEffect-5bEV-xG1.js";import"./RefreshableLayerView-Pd4dLcWr.js";import"./SceneModification-dyp2M_Yg.js";import"./SceneLayerWorker-o7OZRrjZ.js";const g=.2;let r=class extends c(u(h)){constructor(){super(...arguments),this.type="integrated-mesh-3d",this._elevationContext="im",this._isIntegratedMesh=!0,this._supportsLabeling=!1,this.drapeTargetType=n.WithoutRasterImage}get i3slayer(){return this.layer}get updatingProgressValue(){var t;return((t=this._controller)==null?void 0:t.updatingProgress)??0}get lodFactor(){var t,o,a,s;return((s=(a=(o=(t=this.view)==null?void 0:t.qualitySettings)==null?void 0:o.sceneService)==null?void 0:a.integratedMesh)==null?void 0:s.lodFactor)??1}get progressiveLoadFactor(){return this.lodFactor>=1?g:1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),p),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this)}destroy(){this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this)}_createLayerGraphic(){const t=new m;return t.layer=this.layer,t.sourceLayer=this.layer,t}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),this.layer.modifications==null)return void(this._modifications=[]);const t=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>t,()=>this._modifications=t.toArray(),p),"modifications")}};i([e()],r.prototype,"layer",void 0),i([e()],r.prototype,"i3slayer",null),i([e(l)],r.prototype,"updatingProgress",void 0),i([e()],r.prototype,"updatingProgressValue",null),i([e()],r.prototype,"lodFactor",null),i([e({readOnly:!0})],r.prototype,"progressiveLoadFactor",null),r=i([d("esri.views.3d.layers.SceneLayerView3D")],r);const rt=r;export{rt as default}; diff --git a/dist/assets/InteractiveAnalysisViewModel-RI-qFGDH.js b/dist/assets/InteractiveAnalysisViewModel-RI-qFGDH.js deleted file mode 100644 index 5e5700a..0000000 --- a/dist/assets/InteractiveAnalysisViewModel-RI-qFGDH.js +++ /dev/null @@ -1 +0,0 @@ -import{e as n,y as a,c as w,d as h,C as _,A as u,a as l,b as c,w as p,s as V,f as d,g as v}from"./index-J0iiHjMT.js";import{n as O}from"./MeasurementWidgetContent-d8uX7Gw_.js";var r;(function(s){s[s.PENDING=0]="PENDING",s[s.WAIT_FOR_VIEW_READY=1]="WAIT_FOR_VIEW_READY",s[s.RUNNING=2]="RUNNING"})(r||(r={}));let t=class extends O{constructor(s={}){super(s),this.analysisView=null,this._reconnectViewTask=null,this._parentChangeFromReconnect=!1,this._startUserOperation=null;const i=s==null?void 0:s.analysis;i!=null?this.analysis=i:(this._set("analysis",this.constructAnalysis()),this._set("isAnalysisOwner",!0))}normalizeCtorArgs(s){const{analysis:i,...e}=s;return e}initialize(){this.addHandles([h(()=>{var s;return(s=this.analysis)==null?void 0:s.parent},s=>{this._parentChangeFromReconnect||s===this.view||this._set("isAnalysisOwner",!1);const i=!this._parentChangeFromReconnect;this._parentChangeFromReconnect=!1,i&&this._scheduleViewReconnect()},_),h(()=>({view:this.view,ready:this.view!=null&&this.view.ready,supported:this.supported}),({view:s},i)=>{const e=i==null?void 0:i.view;s!==e&&(this._startUserOperation=l(this._startUserOperation),this._disconnectFromView(e)),this._scheduleViewReconnect()},u),h(()=>this.analysis.isEditable,(s,i)=>{this.analysisView!=null&&(s&&!i&&this.tool==null?this.createTool():s||!i||this.tool==null||this.tool.active||this.removeTool())})])}destroy(){this._reconnectViewTask=l(this._reconnectViewTask),this._startUserOperation=l(this._startUserOperation),this.analysisView!=null&&(this.analysisView.visible=void 0),this._disconnectFromView(this.view),this.analysis!=null&&this.isAnalysisOwner&&(this.analysis.destroy(),this._set("analysis",null))}set analysis(s){s!==this._get("analysis")&&(this._startUserOperation=l(this._startUserOperation),this._disconnectFromView(this.view),this._setExternalAnalysis(s),this._scheduleViewReconnect())}get ready(){return this.analysisView!=null&&!this.connectingToView}get connectingToView(){return this._reconnectViewTask!=null}get isAnalysisOwner(){return this._get("isAnalysisOwner")}set visible(s){this._set("visible",s),this.analysisView!=null&&(this.analysisView.visible=s)}async start(){this.clear();const s={task:null,abort:null,state:r.PENDING},i=c(async e=>{s.state=r.WAIT_FOR_VIEW_READY,await p(()=>this.ready,e),s.state=r.RUNNING,this.createTool({interactive:!0})});return s.task=i,s.abort=()=>i.abort(),this._startUserOperation=s,i.promise}clear(){this._startUserOperation=l(this._startUserOperation),this.removeTool(),this.analysis.clear()}onConnectToAnalysisView(s){}onDisconnectFromAnalysisView(){}_scheduleViewReconnect(){this._reconnectViewTask=l(this._reconnectViewTask);const s=c(async i=>{try{await this._reconnectView(i)}catch(e){if(V(i),!d(e))return void this.logger.warn("Failed to use analysis in view model",e);throw e}finally{s===this._reconnectViewTask&&(this._reconnectViewTask=null)}});this._reconnectViewTask=s}async _reconnectView(s){const{view:i}=this,e=i!=null&&i.ready&&this.supported,o=this.analysis;if(this._startUserOperation=y(this._startUserOperation),this._disconnectFromView(i),e&&i!=null&&o!=null){if(this.isAnalysisOwner){if(o.parent!=null)return void this.logError("expected owned analysis to have null parent when connecting to view");this._parentChangeFromReconnect=!0,i.analyses.add(o)}this.analysisView=await i.whenAnalysisView(o),v(s)?this._startUserOperation=y(this._startUserOperation):(this.analysisView.visible=this.visible,this.onConnectToAnalysisView(this.analysisView),this.createTool())}}_disconnectFromView(s){this.removeTool(),s!=null&&this.isAnalysisOwner&&(this._parentChangeFromReconnect=!0,s.analyses.remove(this.analysis),this.analysis.clear()),this.analysisView=null,this.onDisconnectFromAnalysisView()}_setExternalAnalysis(s){this.analysisView==null||this.isAnalysisOwner||(this.analysisView.visible=!0),this.analysisView=null,this._set("isAnalysisOwner",!1),this._set("analysis",s),this._parentChangeFromReconnect=!1}get testInfo(){return{analysisView:this.analysisView}}};function y(s){return s!=null&&s.state>=r.RUNNING?(s.abort(),null):s}n([a({nonNullable:!0})],t.prototype,"analysis",null),n([a()],t.prototype,"analysisView",void 0),n([a()],t.prototype,"ready",null),n([a()],t.prototype,"connectingToView",null),n([a({readOnly:!0})],t.prototype,"isAnalysisOwner",null),n([a({type:Boolean,value:!0})],t.prototype,"visible",null),n([a()],t.prototype,"_reconnectViewTask",void 0),t=n([w("esri.widgets.support.InteractiveAnalysisViewModel")],t);export{t as u}; diff --git a/dist/assets/InteractiveAnalysisViewModel-jrNLjGZR.js b/dist/assets/InteractiveAnalysisViewModel-jrNLjGZR.js new file mode 100644 index 0000000..49d7618 --- /dev/null +++ b/dist/assets/InteractiveAnalysisViewModel-jrNLjGZR.js @@ -0,0 +1 @@ +import{e as n,y as a,c as w,B as h,a9 as _,T as u,I as l,N as c,aa as p,ab as V,ac as d,ad as v}from"./index-pCX-0tJH.js";import{n as O}from"./MeasurementWidgetContent-PH9XFoV4.js";var r;(function(s){s[s.PENDING=0]="PENDING",s[s.WAIT_FOR_VIEW_READY=1]="WAIT_FOR_VIEW_READY",s[s.RUNNING=2]="RUNNING"})(r||(r={}));let t=class extends O{constructor(s={}){super(s),this.analysisView=null,this._reconnectViewTask=null,this._parentChangeFromReconnect=!1,this._startUserOperation=null;const i=s==null?void 0:s.analysis;i!=null?this.analysis=i:(this._set("analysis",this.constructAnalysis()),this._set("isAnalysisOwner",!0))}normalizeCtorArgs(s){const{analysis:i,...e}=s;return e}initialize(){this.addHandles([h(()=>{var s;return(s=this.analysis)==null?void 0:s.parent},s=>{this._parentChangeFromReconnect||s===this.view||this._set("isAnalysisOwner",!1);const i=!this._parentChangeFromReconnect;this._parentChangeFromReconnect=!1,i&&this._scheduleViewReconnect()},_),h(()=>({view:this.view,ready:this.view!=null&&this.view.ready,supported:this.supported}),({view:s},i)=>{const e=i==null?void 0:i.view;s!==e&&(this._startUserOperation=l(this._startUserOperation),this._disconnectFromView(e)),this._scheduleViewReconnect()},u),h(()=>this.analysis.isEditable,(s,i)=>{this.analysisView!=null&&(s&&!i&&this.tool==null?this.createTool():s||!i||this.tool==null||this.tool.active||this.removeTool())})])}destroy(){this._reconnectViewTask=l(this._reconnectViewTask),this._startUserOperation=l(this._startUserOperation),this.analysisView!=null&&(this.analysisView.visible=void 0),this._disconnectFromView(this.view),this.analysis!=null&&this.isAnalysisOwner&&(this.analysis.destroy(),this._set("analysis",null))}set analysis(s){s!==this._get("analysis")&&(this._startUserOperation=l(this._startUserOperation),this._disconnectFromView(this.view),this._setExternalAnalysis(s),this._scheduleViewReconnect())}get ready(){return this.analysisView!=null&&!this.connectingToView}get connectingToView(){return this._reconnectViewTask!=null}get isAnalysisOwner(){return this._get("isAnalysisOwner")}set visible(s){this._set("visible",s),this.analysisView!=null&&(this.analysisView.visible=s)}async start(){this.clear();const s={task:null,abort:null,state:r.PENDING},i=c(async e=>{s.state=r.WAIT_FOR_VIEW_READY,await p(()=>this.ready,e),s.state=r.RUNNING,this.createTool({interactive:!0})});return s.task=i,s.abort=()=>i.abort(),this._startUserOperation=s,i.promise}clear(){this._startUserOperation=l(this._startUserOperation),this.removeTool(),this.analysis.clear()}onConnectToAnalysisView(s){}onDisconnectFromAnalysisView(){}_scheduleViewReconnect(){this._reconnectViewTask=l(this._reconnectViewTask);const s=c(async i=>{try{await this._reconnectView(i)}catch(e){if(V(i),!d(e))return void this.logger.warn("Failed to use analysis in view model",e);throw e}finally{s===this._reconnectViewTask&&(this._reconnectViewTask=null)}});this._reconnectViewTask=s}async _reconnectView(s){const{view:i}=this,e=i!=null&&i.ready&&this.supported,o=this.analysis;if(this._startUserOperation=y(this._startUserOperation),this._disconnectFromView(i),e&&i!=null&&o!=null){if(this.isAnalysisOwner){if(o.parent!=null)return void this.logError("expected owned analysis to have null parent when connecting to view");this._parentChangeFromReconnect=!0,i.analyses.add(o)}this.analysisView=await i.whenAnalysisView(o),v(s)?this._startUserOperation=y(this._startUserOperation):(this.analysisView.visible=this.visible,this.onConnectToAnalysisView(this.analysisView),this.createTool())}}_disconnectFromView(s){this.removeTool(),s!=null&&this.isAnalysisOwner&&(this._parentChangeFromReconnect=!0,s.analyses.remove(this.analysis),this.analysis.clear()),this.analysisView=null,this.onDisconnectFromAnalysisView()}_setExternalAnalysis(s){this.analysisView==null||this.isAnalysisOwner||(this.analysisView.visible=!0),this.analysisView=null,this._set("isAnalysisOwner",!1),this._set("analysis",s),this._parentChangeFromReconnect=!1}get testInfo(){return{analysisView:this.analysisView}}};function y(s){return s!=null&&s.state>=r.RUNNING?(s.abort(),null):s}n([a({nonNullable:!0})],t.prototype,"analysis",null),n([a()],t.prototype,"analysisView",void 0),n([a()],t.prototype,"ready",null),n([a()],t.prototype,"connectingToView",null),n([a({readOnly:!0})],t.prototype,"isAnalysisOwner",null),n([a({type:Boolean,value:!0})],t.prototype,"visible",null),n([a()],t.prototype,"_reconnectViewTask",void 0),t=n([w("esri.widgets.support.InteractiveAnalysisViewModel")],t);export{t as u}; diff --git a/dist/assets/InteractiveToolBase-6mltmL27.js b/dist/assets/InteractiveToolBase-6mltmL27.js new file mode 100644 index 0000000..0c97c23 --- /dev/null +++ b/dist/assets/InteractiveToolBase-6mltmL27.js @@ -0,0 +1 @@ +import{dY as A,c1 as g,l5 as R,dW as E,L as C,F as T,l6 as F,kq as z,bE as _,bp as G,ah as O,Q as P,V as $,e as c,g as D,l7 as f,ag as I,R as W,y as h,c as q}from"./index-pCX-0tJH.js";import{r as x}from"./drawUtils-0wb2c6-q.js";function U(a,t){let e=null,n=null;return i=>{if(i.action==="cancel")return void(n!=null&&(n.execute({action:"cancel"}),e=null,n=null));const r={action:i.action,screenStart:i.start,screenEnd:i.screenPoint};i.action==="start"&&e==null&&(e=new y,n=new y,t(a,e,n,i.pointerType,r)),e!=null&&e.execute(r),i.action==="end"&&e!=null&&(e=null,n=null)}}function J(a,t){return a.events.on("drag",U(a,t))}function K(a,t){const e=[a.x,a.y,a.z??0],n=t,i=[Math.cos(n),Math.sin(n)],r=Math.sqrt(i[0]*i[0]+i[1]*i[1]);if(r===0)return null;i[0]/=r,i[1]/=r;const l=o=>{const u=(o.x-e[0])*i[0]+(o.y-e[1])*i[1];o.x=e[0]+u*i[0],o.y=e[1]+u*i[1]};return o=>(l(o.mapStart),l(o.mapEnd),{...o,axis:i})}function V(a,t){let e=null;return n=>{if(n.action==="start"&&(e=N(a,n.mapStart.spatialReference,t)),e==null)return null;const i=n.mapEnd.x-n.mapStart.x,r=n.mapEnd.y-n.mapStart.y,l=n.mapEnd.z-n.mapStart.z;return e.move(i,r,l,n.action),{...n,translationX:i,translationY:r,translationZ:l}}}function S(a,t){return a==null?null:a.spatialReference.equals(t)?a.clone():E(a,t)}function N(a,t,e){const n=a.geometry,i=R(t);if(n==null)return null;if(n.type==="mesh")return H(a,n,i,e);const r=S(n,i),l=n.spatialReference;return r==null?null:{move:(o,u,d)=>{const p=x(r.clone(),o,u,d);p.spatialReference.equals(l)?a.geometry=p:a.geometry=E(p,l)}}}function H(a,t,e,n){if(t.vertexSpace.isRelative)return X(a,t,t.vertexSpace,e);if(!t.spatialReference.equals(e))return null;let i=0,r=0,l=0;return{move:(o,u,d)=>{const p=o-i,m=u-r,b=d-l;if(p||m||b){const w=new C(t.origin.x+p,t.origin.y+m,(t.origin.z??0)+b,t.origin.spatialReference);t.centerAt(w,{geographic:t.vertexSpace.isRelative?void 0:n===T.Global}),a.notifyGeometryChanged(),i=o,r=u,l=d}}}}function X(a,t,e,n){const i=S(e.getOriginPoint(t.spatialReference),n),r=t.spatialReference;return i==null?null:{move:(l,o,u,d)=>{const p=x(i.clone(),l,o,u);if(p.spatialReference.equals(r))e.setOriginFromPoint(p);else{const m=E(p,r);m!=null&&e.setOriginFromPoint(m)}if(e.isGeoreferenced)a.notifyGeometryChanged();else{const m=d==="end";a.notifyMeshTransformChanged(m?{action:F.UpdateFastLocalOrigin}:{})}}}}function tt(a,t=null,e){var l;let n=null;const i=t==null||(l=a.spatialReference)!=null&&l.equals(t)?o=>o:o=>o!=null?E(o,t):o,r={exclude:[],...e};return o=>{if(o.action==="start"&&(n=i(a.toMap(o.screenStart,r))),n==null)return null;const u=i(a.toMap(o.screenEnd,r));return u!=null?{...o,mapStart:n,mapEnd:u}:null}}function et(a,t){const e=a.map(n=>V(n,t)).filter(A);return n=>{const i=n.mapEnd.x-n.mapStart.x,r=n.mapEnd.y-n.mapStart.y,l=n.mapEnd.z-n.mapStart.z;return e.forEach(o=>o(n)),{...n,translationX:i,translationY:r,translationZ:l}}}function Y(a,t){const e=new Map;for(const n of t)e.set(n,O(a[n]));return n=>(e.forEach((i,r)=>{a[r]=i}),n)}function k(a){return a.geometry!=null&&a.geometry.type==="mesh"?L(a,a.geometry):Y(a,["geometry"])}function L(a,t){var r;const{vertexSpace:e}=t;if(e.isGeoreferenced){const l=t.vertexAttributes.clonePositional();return o=>(t.vertexAttributes=l,a.notifyGeometryChanged(),o)}const n=z(e.origin),i=(r=t.transform)==null?void 0:r.clone();return l=>(t.transform=i,t.vertexSpace.origin=n,a.notifyMeshTransformChanged(),l)}function nt(a){const t=a.map(e=>k(e)).filter(e=>e!=null);return e=>(t.forEach(n=>n(e)),e)}function at(){let a=0,t=0,e=0;return n=>{n.action==="start"&&(a=n.mapStart.x,t=n.mapStart.y,e=n.mapStart.z);const i=n.mapEnd.x-a,r=n.mapEnd.y-t,l=n.mapEnd.z-e;return a=n.mapEnd.x,t=n.mapEnd.y,e=n.mapEnd.z,{...n,mapDeltaX:i,mapDeltaY:r,mapDeltaZ:l,mapDeltaSpatialReference:n.mapStart.spatialReference}}}function it(){let a=0,t=0;return e=>{e.action==="start"&&(a=e.screenStart.x,t=e.screenStart.y);const n=e.screenEnd.x-a,i=e.screenEnd.y-t;return a=e.screenEnd.x,t=e.screenEnd.y,{...e,screenDeltaX:n,screenDeltaY:i}}}function rt(a,t){let e=null,n=0,i=0;return r=>{var d;if(r.action==="start"&&(e=(d=a.toScreen)==null?void 0:d.call(a,t),e!=null&&(e.x<0||e.x>a.width||e.y<0||e.y>a.height?e=null:(n=r.screenStart.x-e.x,i=r.screenStart.y-e.y))),e==null)return null;const l=_(r.screenEnd.x-n,0,a.width),o=_(r.screenEnd.y-i,0,a.height),u=P(l,o);return r.screenStart=e,r.screenEnd=u,r}}const Z=()=>{};class y{constructor(){this.execute=Z}next(t,e=new y){return t!=null&&(this.execute=n=>{const i=t(n);i!=null&&e.execute(i)}),e}}function ot(a,t,e=[]){if(a.type==="2d")return i=>i;let n=null;return i=>{i.action==="start"&&(n=a.toMap(i.screenStart,{exclude:e}),n!=null&&(n.z=g(n,a,t)));const r=a.toMap(i.screenEnd,{exclude:e});r!=null&&(r.z=g(r,a,t));const l=n!=null&&r!=null?{sceneStart:n,sceneEnd:r}:null;return{...i,scenePoints:l}}}function M(a,t,e){const n=t.elevationProvider.getElevation(a.x,a.y,a.z??0,a.spatialReference,"scene")??0,i=G(a);return i.z=n,i.hasZ=!0,i.z=g(i,t,e),i}function lt(a,t){if(a.type==="2d")return n=>n;let e=null;return n=>{n.action==="start"&&(e=M(n.mapStart,a,t));const i=M(n.mapEnd,a,t),r=e!=null&&i!=null?{sceneStart:e,sceneEnd:i}:null;return{...n,scenePoints:r}}}var v;(function(a){a[a.WhenToolEditable=0]="WhenToolEditable",a[a.WhenToolNotEditable=1]="WhenToolNotEditable",a[a.Always=2]="Always"})(v||(v={}));class j{constructor(){this._isToolEditable=!0,this._manipulators=new $,this._resourceContexts={manipulator3D:{}},this._attached=!1}set isToolEditable(t){this._isToolEditable=t}get length(){return this._manipulators.length}add(t,e=v.WhenToolEditable){this.addMany([t],e)}addMany(t,e=v.WhenToolEditable){for(const n of t){const i={manipulator:n,visibilityPredicate:e,attached:!1};this._manipulators.add(i),this._attached&&this._updateManipulatorAttachment(i)}}remove(t){for(let e=0;e{this._detachManipulator(t)}),this._manipulators.removeAll()}attach(){this._manipulators.forEach(t=>{this._updateManipulatorAttachment(t)}),this._attached=!0}detach(){this._manipulators.forEach(t=>{this._detachManipulator(t)}),this._attached=!1}destroy(){this.detach(),this._manipulators.forEach(({manipulator:t})=>t.destroy()),this._manipulators.destroy(),this._resourceContexts=null}on(t,e){return this._manipulators.on(t,n=>{e(n)})}forEach(t){for(const e of this._manipulators.items)t(e)}some(t){return this._manipulators.items.some(t)}toArray(){const t=[];return this.forEach(e=>t.push(e.manipulator)),t}intersect(t,e){let n=null,i=Number.MAX_VALUE;return this._manipulators.forEach(({manipulator:r,attached:l})=>{if(!l||!r.interactive)return;const o=r.intersectionDistance(t,e);o!=null&&o{if(i.action==="cancel")return void(n!=null&&(n.execute({action:"cancel"}),e=null,n=null));const r={action:i.action,screenStart:i.start,screenEnd:i.screenPoint};i.action==="start"&&e==null&&(e=new y,n=new y,t(a,e,n,i.pointerType,r)),e!=null&&e.execute(r),i.action==="end"&&e!=null&&(e=null,n=null)}}function K(a,t){return a.events.on("drag",W(a,t))}function Q(a,t){const e=[a.x,a.y,a.z??0],n=t,i=[Math.cos(n),Math.sin(n)],r=Math.sqrt(i[0]*i[0]+i[1]*i[1]);if(r===0)return null;i[0]/=r,i[1]/=r;const l=o=>{const c=(o.x-e[0])*i[0]+(o.y-e[1])*i[1];o.x=e[0]+c*i[0],o.y=e[1]+c*i[1]};return o=>(l(o.mapStart),l(o.mapEnd),{...o,axis:i})}function k(a,t){let e=null;return n=>{if(n.action==="start"&&(e=q(a,n.mapStart.spatialReference,t)),e==null)return null;const i=n.mapEnd.x-n.mapStart.x,r=n.mapEnd.y-n.mapStart.y,l=n.mapEnd.z-n.mapStart.z;return e.move(i,r,l,n.action),{...n,translationX:i,translationY:r,translationZ:l}}}function S(a,t){return a==null?null:a.spatialReference.equals(t)?a.clone():E(a,t)}function q(a,t,e){const n=a.geometry,i=R(t);if(n==null)return null;if(n.type==="mesh")return H(a,n,i,e);const r=S(n,i),l=n.spatialReference;return r==null?null:{move:(o,c,d)=>{const p=x(r.clone(),o,c,d);p.spatialReference.equals(l)?a.geometry=p:a.geometry=E(p,l)}}}function H(a,t,e,n){if(t.vertexSpace.isRelative)return N(a,t,t.vertexSpace,e);if(!t.spatialReference.equals(e))return null;let i=0,r=0,l=0;return{move:(o,c,d)=>{const p=o-i,m=c-r,b=d-l;if(p||m||b){const w=new T(t.origin.x+p,t.origin.y+m,(t.origin.z??0)+b,t.origin.spatialReference);t.centerAt(w,{geographic:t.vertexSpace.isRelative?void 0:n===C.Global}),a.notifyGeometryChanged(),i=o,r=c,l=d}}}}function N(a,t,e,n){const i=S(e.getOriginPoint(t.spatialReference),n),r=t.spatialReference;return i==null?null:{move:(l,o,c,d)=>{const p=x(i.clone(),l,o,c);if(p.spatialReference.equals(r))e.setOriginFromPoint(p);else{const m=E(p,r);m!=null&&e.setOriginFromPoint(m)}if(e.isGeoreferenced)a.notifyGeometryChanged();else{const m=d==="end";a.notifyMeshTransformChanged(m?{action:F.UpdateFastLocalOrigin}:{})}}}}function tt(a,t=null,e){var l;let n=null;const i=t==null||(l=a.spatialReference)!=null&&l.equals(t)?o=>o:o=>o!=null?E(o,t):o,r={exclude:[],...e};return o=>{if(o.action==="start"&&(n=i(a.toMap(o.screenStart,r))),n==null)return null;const c=i(a.toMap(o.screenEnd,r));return c!=null?{...o,mapStart:n,mapEnd:c}:null}}function et(a,t){const e=a.map(n=>k(n,t)).filter(A);return n=>{const i=n.mapEnd.x-n.mapStart.x,r=n.mapEnd.y-n.mapStart.y,l=n.mapEnd.z-n.mapStart.z;return e.forEach(o=>o(n)),{...n,translationX:i,translationY:r,translationZ:l}}}function X(a,t){const e=new Map;for(const n of t)e.set(n,G(a[n]));return n=>(e.forEach((i,r)=>{a[r]=i}),n)}function Y(a){return a.geometry!=null&&a.geometry.type==="mesh"?Z(a,a.geometry):X(a,["geometry"])}function Z(a,t){var r;const{vertexSpace:e}=t;if(e.isGeoreferenced){const l=t.vertexAttributes.clonePositional();return o=>(t.vertexAttributes=l,a.notifyGeometryChanged(),o)}const n=z(e.origin),i=(r=t.transform)==null?void 0:r.clone();return l=>(t.transform=i,t.vertexSpace.origin=n,a.notifyMeshTransformChanged(),l)}function nt(a){const t=a.map(e=>Y(e)).filter(e=>e!=null);return e=>(t.forEach(n=>n(e)),e)}function at(){let a=0,t=0,e=0;return n=>{n.action==="start"&&(a=n.mapStart.x,t=n.mapStart.y,e=n.mapStart.z);const i=n.mapEnd.x-a,r=n.mapEnd.y-t,l=n.mapEnd.z-e;return a=n.mapEnd.x,t=n.mapEnd.y,e=n.mapEnd.z,{...n,mapDeltaX:i,mapDeltaY:r,mapDeltaZ:l,mapDeltaSpatialReference:n.mapStart.spatialReference}}}function it(){let a=0,t=0;return e=>{e.action==="start"&&(a=e.screenStart.x,t=e.screenStart.y);const n=e.screenEnd.x-a,i=e.screenEnd.y-t;return a=e.screenEnd.x,t=e.screenEnd.y,{...e,screenDeltaX:n,screenDeltaY:i}}}function rt(a,t){let e=null,n=0,i=0;return r=>{var d;if(r.action==="start"&&(e=(d=a.toScreen)==null?void 0:d.call(a,t),e!=null&&(e.x<0||e.x>a.width||e.y<0||e.y>a.height?e=null:(n=r.screenStart.x-e.x,i=r.screenStart.y-e.y))),e==null)return null;const l=_(r.screenEnd.x-n,0,a.width),o=_(r.screenEnd.y-i,0,a.height),c=P(l,o);return r.screenStart=e,r.screenEnd=c,r}}const L=()=>{};class y{constructor(){this.execute=L}next(t,e=new y){return t!=null&&(this.execute=n=>{const i=t(n);i!=null&&e.execute(i)}),e}}function ot(a,t,e=[]){if(a.type==="2d")return i=>i;let n=null;return i=>{i.action==="start"&&(n=a.toMap(i.screenStart,{exclude:e}),n!=null&&(n.z=g(n,a,t)));const r=a.toMap(i.screenEnd,{exclude:e});r!=null&&(r.z=g(r,a,t));const l=n!=null&&r!=null?{sceneStart:n,sceneEnd:r}:null;return{...i,scenePoints:l}}}function M(a,t,e){const n=t.elevationProvider.getElevation(a.x,a.y,a.z??0,a.spatialReference,"scene")??0,i=O(a);return i.z=n,i.hasZ=!0,i.z=g(i,t,e),i}function lt(a,t){if(a.type==="2d")return n=>n;let e=null;return n=>{n.action==="start"&&(e=M(n.mapStart,a,t));const i=M(n.mapEnd,a,t),r=e!=null&&i!=null?{sceneStart:e,sceneEnd:i}:null;return{...n,scenePoints:r}}}var v;(function(a){a[a.WhenToolEditable=0]="WhenToolEditable",a[a.WhenToolNotEditable=1]="WhenToolNotEditable",a[a.Always=2]="Always"})(v||(v={}));class j{constructor(){this._isToolEditable=!0,this._manipulators=new I,this._resourceContexts={manipulator3D:{}},this._attached=!1}set isToolEditable(t){this._isToolEditable=t}get length(){return this._manipulators.length}add(t,e=v.WhenToolEditable){this.addMany([t],e)}addMany(t,e=v.WhenToolEditable){for(const n of t){const i={manipulator:n,visibilityPredicate:e,attached:!1};this._manipulators.add(i),this._attached&&this._updateManipulatorAttachment(i)}}remove(t){for(let e=0;e{this._detachManipulator(t)}),this._manipulators.removeAll()}attach(){this._manipulators.forEach(t=>{this._updateManipulatorAttachment(t)}),this._attached=!0}detach(){this._manipulators.forEach(t=>{this._detachManipulator(t)}),this._attached=!1}destroy(){this.detach(),this._manipulators.forEach(({manipulator:t})=>t.destroy()),this._manipulators.destroy(),this._resourceContexts=null}on(t,e){return this._manipulators.on(t,n=>{e(n)})}forEach(t){for(const e of this._manipulators.items)t(e)}some(t){return this._manipulators.items.some(t)}toArray(){const t=[];return this.forEach(e=>t.push(e.manipulator)),t}intersect(t,e){let n=null,i=Number.MAX_VALUE;return this._manipulators.forEach(({manipulator:r,attached:l})=>{if(!l||!r.interactive)return;const o=r.intersectionDistance(t,e);o!=null&&o{const v=S(l);v.featureSet.features=[];const h=l.featureSet.geometryType;r.set(h,v);const m=l.layerDefinition.objectIdField;h==="esriGeometryPoint"?P(n,m,l.featureSet.features):h==="esriGeometryPolyline"?P(c,m,l.featureSet.features):h==="esriGeometryPolygon"&&P(p,m,l.featureSet.features)}),e.groundOverlays&&e.groundOverlays.forEach(l=>{b.set(l.id,l)}),t.forEach(l=>{l.networkLinkIds.forEach(v=>{const h=ye(v,l.id,e.networkLinks);h&&s.push(h)})}),s.forEach(l=>{var v;if(l.featureInfos){l.points=S(r.get("esriGeometryPoint")),l.polylines=S(r.get("esriGeometryPolyline")),l.polygons=S(r.get("esriGeometryPolygon")),l.mapImages=[];for(const h of l.featureInfos)switch(h.type){case"esriGeometryPoint":case"esriGeometryPolyline":case"esriGeometryPolygon":{const m=d[h.type].get(h.id);m&&((v=l[ae[h.type]])==null||v.featureSet.features.push(m));break}case"GroundOverlay":{const m=b.get(h.id);m&&l.mapImages.push(m);break}}l.fullExtent=L([l])}});const u=L(s);return{folders:t,sublayers:s,extent:u}}function K(e,t,s,r){var p;const n=(p=W)==null?void 0:p.findCredential(e);e=z(e,{token:n==null?void 0:n.token});const c=J.kmlServiceUrl;return A(c,{query:{url:e,model:"simple",folders:"",refresh:s!==0||void 0,outSR:JSON.stringify(t)},responseType:"json",signal:r})}function N(e,t,s=null,r=[]){const n=[],c={},p=t.sublayers,b=new Set(t.folders.map(d=>d.id));return p.forEach(d=>{var f;const u=new e;if(s?u.read(d,s):u.read(d),r.length&&b.has(u.id)&&(u.visible=r.includes(u.id)),c[d.id]=u,d.parentFolderId!=null&&d.parentFolderId!==-1){const l=c[d.parentFolderId];l.sublayers||(l.sublayers=[]),(f=l.sublayers)==null||f.unshift(u)}else n.unshift(u)}),n}function P(e,t,s){s.forEach(r=>{e.set(r.attributes[t],r)})}function ue(e,t){let s;return t.some(r=>r.id===e&&(s=r,!0)),s}function ye(e,t,s){const r=ue(e,s);return r&&(r.parentFolderId=t,r.networkLink=r),r}function L(e){var r,n,c,p,b,d;const t=M(E),s=M(E);for(const u of e){if((n=(r=u.polygons)==null?void 0:r.featureSet)!=null&&n.features)for(const f of u.polygons.featureSet.features)w(t,f.geometry),k(s,t);if((p=(c=u.polylines)==null?void 0:c.featureSet)!=null&&p.features)for(const f of u.polylines.featureSet.features)w(t,f.geometry),k(s,t);if((d=(b=u.points)==null?void 0:b.featureSet)!=null&&d.features)for(const f of u.points.featureSet.features)w(t,f.geometry),k(s,t);if(u.mapImages)for(const f of u.mapImages)w(t,f.extent),k(s,t)}return V(s,E)?void 0:{xmin:s[0],ymin:s[1],zmin:s[2],xmax:s[3],ymax:s[4],zmax:s[5],spatialReference:O.WGS84}}var x;let y=x=class extends B.EventedMixin(D(Q)){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.id=null,this.networkLink=null,this.parent=null,this.sublayers=null,this.title=null,this.sourceJSON=null,this.layer=null,this.addHandles([j(()=>this.sublayers,"after-add",({item:t})=>{t.parent=this,t.layer=this.layer},g),j(()=>this.sublayers,"after-remove",({item:t})=>{t.layer=t.parent=null},g),$(()=>this.sublayers,(t,s)=>{if(s)for(const r of s)r.layer=r.parent=null;if(t)for(const r of t)r.parent=this,r.layer=this.layer},g),$(()=>this.layer,t=>{if(this.sublayers)for(const s of this.sublayers)s.layer=t},g)])}initialize(){_(()=>this.networkLink).then(()=>_(()=>this.visible===!0)).then(()=>this.load())}load(e){var r;if(!this.networkLink||this.networkLink.viewFormat)return;const t=e!=null?e.signal:null,s=this._fetchService(((r=this._get("networkLink"))==null?void 0:r.href)??"",t).then(n=>{var b;const c=L(n.sublayers);this.fullExtent=F.fromJSON(c),this.sourceJSON=n;const p=H(G.ofType(x),N(x,n));this.sublayers?this.sublayers.addMany(p):this.sublayers=p,(b=this.layer)==null||b.emit("sublayer-update"),this.layer&&this.layer.notifyChange("visibleSublayers")});return this.addResolvingPromise(s),Promise.resolve(this)}get visible(){return this._get("visible")}set visible(e){this._get("visible")!==e&&(this._set("visible",e),this.layer&&this.layer.notifyChange("visibleSublayers"))}readVisible(e,t){return!!t.visibility}_fetchService(e,t){return K(e,this.layer.outSpatialReference,this.layer.refreshInterval,t).then(s=>T(s.data))}};i([o()],y.prototype,"description",void 0),i([o({type:F})],y.prototype,"fullExtent",void 0),i([o()],y.prototype,"id",void 0),i([o({readOnly:!0,value:null})],y.prototype,"networkLink",void 0),i([o({json:{write:{allowNull:!0}}})],y.prototype,"parent",void 0),i([o({type:G.ofType(y),json:{write:{allowNull:!0}}})],y.prototype,"sublayers",void 0),i([o({value:null,json:{read:{source:"name",reader:e=>q(e)}}})],y.prototype,"title",void 0),i([o({value:!0})],y.prototype,"visible",null),i([I("visible",["visibility"])],y.prototype,"readVisible",null),i([o()],y.prototype,"sourceJSON",void 0),i([o()],y.prototype,"layer",void 0),y=x=i([C("esri.layers.support.KMLSublayer")],y);const R=y,pe=["kml","xml"];let a=class extends U(X(Y(Z(ee(te(ne)))))){constructor(...e){super(...e),this._visibleFolders=[],this.allSublayers=new se({getCollections:()=>[this.sublayers],getChildrenFunction:t=>t.sublayers}),this.outSpatialReference=O.WGS84,this.path=null,this.legendEnabled=!1,this.operationalLayerType="KML",this.sublayers=null,this.type="kml",this.url=null}initialize(){this.addHandles([$(()=>this.sublayers,(e,t)=>{t&&t.forEach(s=>{s.parent=null,s.layer=null}),e&&e.forEach(s=>{s.parent=this,s.layer=this})},g),this.on("sublayer-update",()=>this.notifyChange("fullExtent"))])}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}readSublayersFromItemOrWebMap(e,t){this._visibleFolders=t.visibleFolders}readSublayers(e,t,s){return N(R,t,s,this._visibleFolders)}writeSublayers(e,t){const s=[],r=e.toArray();for(;r.length;){const n=r[0];n.networkLink||(n.visible&&s.push(n.id),n.sublayers&&r.push(...n.sublayers.toArray())),r.shift()}t.visibleFolders=s}get title(){const e=this._get("title");return e&&this.originOf("title")!=="defaults"?e:this.url?re(this.url,pe)||"KML":e||""}set title(e){this._set("title",e)}get visibleSublayers(){const e=this.sublayers,t=[],s=r=>{r.visible&&(t.push(r),r.sublayers&&r.sublayers.forEach(s))};return e&&e.forEach(s),t}get fullExtent(){return this._recomputeFullExtent()}load(e){const t=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["KML"],supportsData:!1},e).catch(ie).then(()=>this._fetchService(t))),Promise.resolve(this)}destroy(){super.destroy(),this.allSublayers.destroy()}async _fetchService(e){const t=await Promise.resolve().then(()=>this.resourceInfo?{ssl:!1,data:this.resourceInfo}:K(this.url??"",this.outSpatialReference,this.refreshInterval,e)),s=T(t.data);s&&this.read(s,{origin:"service"})}_recomputeFullExtent(){let e=null;this.extent!=null&&(e=this.extent.clone());const t=s=>{if(s.sublayers)for(const r of s.sublayers.items)t(r),r.visible&&r.fullExtent&&(e!=null?e.union(r.fullExtent):e=r.fullExtent.clone())};return t(this),e}};i([o({readOnly:!0})],a.prototype,"allSublayers",void 0),i([o({type:O})],a.prototype,"outSpatialReference",void 0),i([o({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],a.prototype,"path",void 0),i([o({readOnly:!0,json:{read:!1,write:!1}})],a.prototype,"legendEnabled",void 0),i([o({type:["show","hide","hide-children"]})],a.prototype,"listMode",void 0),i([o({type:["KML"]})],a.prototype,"operationalLayerType",void 0),i([o({})],a.prototype,"resourceInfo",void 0),i([o({type:G.ofType(R),json:{write:{ignoreOrigin:!0}}})],a.prototype,"sublayers",void 0),i([I(["web-map","portal-item"],"sublayers",["visibleFolders"])],a.prototype,"readSublayersFromItemOrWebMap",null),i([I("service","sublayers",["sublayers"])],a.prototype,"readSublayers",null),i([le("sublayers")],a.prototype,"writeSublayers",null),i([o({readOnly:!0,json:{read:!1}})],a.prototype,"type",void 0),i([o({json:{origins:{"web-map":{read:{source:"title"}}},write:{ignoreOrigin:!0}}})],a.prototype,"title",null),i([o(oe)],a.prototype,"url",void 0),i([o({readOnly:!0})],a.prototype,"visibleSublayers",null),i([o({type:F})],a.prototype,"extent",void 0),i([o()],a.prototype,"fullExtent",null),a=i([C("esri.layers.KMLLayer")],a);const he=a;export{he as default}; diff --git a/dist/assets/KMLLayer-pgkQk7d5.js b/dist/assets/KMLLayer-pgkQk7d5.js new file mode 100644 index 0000000..546efe4 --- /dev/null +++ b/dist/assets/KMLLayer-pgkQk7d5.js @@ -0,0 +1 @@ +import{ah as S,kB as z,lc as J,dN as W,av as A,ea as M,ld as E,le as w,lf as k,lg as B,d2 as G,z as H,iC as V,fg as _,a9 as g,B as I,aa as j,dO as L,lh as D,V as O,e as i,y as o,li as q,dt as $,c as C,il as U,dF as Q,dG as X,dJ as Y,dH as Z,dI as ee,dK as te,fK as se,dh as re,dL as ie,du as le,dR as oe,aI as ae}from"./index-pCX-0tJH.js";const ne={esriGeometryPoint:"points",esriGeometryPolyline:"polylines",esriGeometryPolygon:"polygons"};function R(e){var f;const t=e.folders||[],s=t.slice(),r=new Map,a=new Map,c=new Map,p=new Map,b=new Map,d={esriGeometryPoint:a,esriGeometryPolyline:c,esriGeometryPolygon:p};(((f=e.featureCollection)==null?void 0:f.layers)||[]).forEach(l=>{const m=S(l);m.featureSet.features=[];const h=l.featureSet.geometryType;r.set(h,m);const v=l.layerDefinition.objectIdField;h==="esriGeometryPoint"?P(a,v,l.featureSet.features):h==="esriGeometryPolyline"?P(c,v,l.featureSet.features):h==="esriGeometryPolygon"&&P(p,v,l.featureSet.features)}),e.groundOverlays&&e.groundOverlays.forEach(l=>{b.set(l.id,l)}),t.forEach(l=>{l.networkLinkIds.forEach(m=>{const h=ye(m,l.id,e.networkLinks);h&&s.push(h)})}),s.forEach(l=>{var m;if(l.featureInfos){l.points=S(r.get("esriGeometryPoint")),l.polylines=S(r.get("esriGeometryPolyline")),l.polygons=S(r.get("esriGeometryPolygon")),l.mapImages=[];for(const h of l.featureInfos)switch(h.type){case"esriGeometryPoint":case"esriGeometryPolyline":case"esriGeometryPolygon":{const v=d[h.type].get(h.id);v&&((m=l[ne[h.type]])==null||m.featureSet.features.push(v));break}case"GroundOverlay":{const v=b.get(h.id);v&&l.mapImages.push(v);break}}l.fullExtent=F([l])}});const u=F(s);return{folders:t,sublayers:s,extent:u}}function K(e,t,s,r){var p;const a=(p=z)==null?void 0:p.findCredential(e);e=J(e,{token:a==null?void 0:a.token});const c=W.kmlServiceUrl;return A(c,{query:{url:e,model:"simple",folders:"",refresh:s!==0||void 0,outSR:JSON.stringify(t)},responseType:"json",signal:r})}function N(e,t,s=null,r=[]){const a=[],c={},p=t.sublayers,b=new Set(t.folders.map(d=>d.id));return p.forEach(d=>{var f;const u=new e;if(s?u.read(d,s):u.read(d),r.length&&b.has(u.id)&&(u.visible=r.includes(u.id)),c[d.id]=u,d.parentFolderId!=null&&d.parentFolderId!==-1){const l=c[d.parentFolderId];l.sublayers||(l.sublayers=[]),(f=l.sublayers)==null||f.unshift(u)}else a.unshift(u)}),a}function P(e,t,s){s.forEach(r=>{e.set(r.attributes[t],r)})}function ue(e,t){let s;return t.some(r=>r.id===e&&(s=r,!0)),s}function ye(e,t,s){const r=ue(e,s);return r&&(r.parentFolderId=t,r.networkLink=r),r}function F(e){var r,a,c,p,b,d;const t=M(E),s=M(E);for(const u of e){if((a=(r=u.polygons)==null?void 0:r.featureSet)!=null&&a.features)for(const f of u.polygons.featureSet.features)w(t,f.geometry),k(s,t);if((p=(c=u.polylines)==null?void 0:c.featureSet)!=null&&p.features)for(const f of u.polylines.featureSet.features)w(t,f.geometry),k(s,t);if((d=(b=u.points)==null?void 0:b.featureSet)!=null&&d.features)for(const f of u.points.featureSet.features)w(t,f.geometry),k(s,t);if(u.mapImages)for(const f of u.mapImages)w(t,f.extent),k(s,t)}return B(s,E)?void 0:{xmin:s[0],ymin:s[1],zmin:s[2],xmax:s[3],ymax:s[4],zmax:s[5],spatialReference:G.WGS84}}var x;let y=x=class extends H.EventedMixin(V(U)){constructor(...e){super(...e),this.description=null,this.fullExtent=null,this.id=null,this.networkLink=null,this.parent=null,this.sublayers=null,this.title=null,this.sourceJSON=null,this.layer=null,this.addHandles([_(()=>this.sublayers,"after-add",({item:t})=>{t.parent=this,t.layer=this.layer},g),_(()=>this.sublayers,"after-remove",({item:t})=>{t.layer=t.parent=null},g),I(()=>this.sublayers,(t,s)=>{if(s)for(const r of s)r.layer=r.parent=null;if(t)for(const r of t)r.parent=this,r.layer=this.layer},g),I(()=>this.layer,t=>{if(this.sublayers)for(const s of this.sublayers)s.layer=t},g)])}initialize(){j(()=>this.networkLink).then(()=>j(()=>this.visible===!0)).then(()=>this.load())}load(e){var r;if(!this.networkLink||this.networkLink.viewFormat)return;const t=e!=null?e.signal:null,s=this._fetchService(((r=this._get("networkLink"))==null?void 0:r.href)??"",t).then(a=>{var b;const c=F(a.sublayers);this.fullExtent=L.fromJSON(c),this.sourceJSON=a;const p=D(O.ofType(x),N(x,a));this.sublayers?this.sublayers.addMany(p):this.sublayers=p,(b=this.layer)==null||b.emit("sublayer-update"),this.layer&&this.layer.notifyChange("visibleSublayers")});return this.addResolvingPromise(s),Promise.resolve(this)}get visible(){return this._get("visible")}set visible(e){this._get("visible")!==e&&(this._set("visible",e),this.layer&&this.layer.notifyChange("visibleSublayers"))}readVisible(e,t){return!!t.visibility}_fetchService(e,t){return K(e,this.layer.outSpatialReference,this.layer.refreshInterval,t).then(s=>R(s.data))}};i([o()],y.prototype,"description",void 0),i([o({type:L})],y.prototype,"fullExtent",void 0),i([o()],y.prototype,"id",void 0),i([o({readOnly:!0,value:null})],y.prototype,"networkLink",void 0),i([o({json:{write:{allowNull:!0}}})],y.prototype,"parent",void 0),i([o({type:O.ofType(y),json:{write:{allowNull:!0}}})],y.prototype,"sublayers",void 0),i([o({value:null,json:{read:{source:"name",reader:e=>q(e)}}})],y.prototype,"title",void 0),i([o({value:!0})],y.prototype,"visible",null),i([$("visible",["visibility"])],y.prototype,"readVisible",null),i([o()],y.prototype,"sourceJSON",void 0),i([o()],y.prototype,"layer",void 0),y=x=i([C("esri.layers.support.KMLSublayer")],y);const T=y,pe=["kml","xml"];let n=class extends Q(X(Y(Z(ee(te(ae)))))){constructor(...e){super(...e),this._visibleFolders=[],this.allSublayers=new se({getCollections:()=>[this.sublayers],getChildrenFunction:t=>t.sublayers}),this.outSpatialReference=G.WGS84,this.path=null,this.legendEnabled=!1,this.operationalLayerType="KML",this.sublayers=null,this.type="kml",this.url=null}initialize(){this.addHandles([I(()=>this.sublayers,(e,t)=>{t&&t.forEach(s=>{s.parent=null,s.layer=null}),e&&e.forEach(s=>{s.parent=this,s.layer=this})},g),this.on("sublayer-update",()=>this.notifyChange("fullExtent"))])}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}readSublayersFromItemOrWebMap(e,t){this._visibleFolders=t.visibleFolders}readSublayers(e,t,s){return N(T,t,s,this._visibleFolders)}writeSublayers(e,t){const s=[],r=e.toArray();for(;r.length;){const a=r[0];a.networkLink||(a.visible&&s.push(a.id),a.sublayers&&r.push(...a.sublayers.toArray())),r.shift()}t.visibleFolders=s}get title(){const e=this._get("title");return e&&this.originOf("title")!=="defaults"?e:this.url?re(this.url,pe)||"KML":e||""}set title(e){this._set("title",e)}get visibleSublayers(){const e=this.sublayers,t=[],s=r=>{r.visible&&(t.push(r),r.sublayers&&r.sublayers.forEach(s))};return e&&e.forEach(s),t}get fullExtent(){return this._recomputeFullExtent()}load(e){const t=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["KML"],supportsData:!1},e).catch(ie).then(()=>this._fetchService(t))),Promise.resolve(this)}destroy(){super.destroy(),this.allSublayers.destroy()}async _fetchService(e){const t=await Promise.resolve().then(()=>this.resourceInfo?{ssl:!1,data:this.resourceInfo}:K(this.url??"",this.outSpatialReference,this.refreshInterval,e)),s=R(t.data);s&&this.read(s,{origin:"service"})}_recomputeFullExtent(){let e=null;this.extent!=null&&(e=this.extent.clone());const t=s=>{if(s.sublayers)for(const r of s.sublayers.items)t(r),r.visible&&r.fullExtent&&(e!=null?e.union(r.fullExtent):e=r.fullExtent.clone())};return t(this),e}};i([o({readOnly:!0})],n.prototype,"allSublayers",void 0),i([o({type:G})],n.prototype,"outSpatialReference",void 0),i([o({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],n.prototype,"path",void 0),i([o({readOnly:!0,json:{read:!1,write:!1}})],n.prototype,"legendEnabled",void 0),i([o({type:["show","hide","hide-children"]})],n.prototype,"listMode",void 0),i([o({type:["KML"]})],n.prototype,"operationalLayerType",void 0),i([o({})],n.prototype,"resourceInfo",void 0),i([o({type:O.ofType(T),json:{write:{ignoreOrigin:!0}}})],n.prototype,"sublayers",void 0),i([$(["web-map","portal-item"],"sublayers",["visibleFolders"])],n.prototype,"readSublayersFromItemOrWebMap",null),i([$("service","sublayers",["sublayers"])],n.prototype,"readSublayers",null),i([le("sublayers")],n.prototype,"writeSublayers",null),i([o({readOnly:!0,json:{read:!1}})],n.prototype,"type",void 0),i([o({json:{origins:{"web-map":{read:{source:"title"}}},write:{ignoreOrigin:!0}}})],n.prototype,"title",null),i([o(oe)],n.prototype,"url",void 0),i([o({readOnly:!0})],n.prototype,"visibleSublayers",null),i([o({type:L})],n.prototype,"extent",void 0),i([o()],n.prototype,"fullExtent",null),n=i([C("esri.layers.KMLLayer")],n);const fe=n;export{fe as default}; diff --git a/dist/assets/Laserlines.glsl-nvjcCsAw.js b/dist/assets/Laserlines.glsl-U7nZFq0e.js similarity index 83% rename from dist/assets/Laserlines.glsl-nvjcCsAw.js rename to dist/assets/Laserlines.glsl-U7nZFq0e.js index 4866a69..eb5cf4d 100644 --- a/dist/assets/Laserlines.glsl-nvjcCsAw.js +++ b/dist/assets/Laserlines.glsl-U7nZFq0e.js @@ -1,4 +1,4 @@ -import{z9 as we,za as xe,xx as d,xI as P,yk as F,yH as y,xy as r,xz as ie,yF as B,w4 as Ve,hL as ne,bf as u,a9 as se,bA as Ee,xM as ae,de as re,xO as le,xP as oe,xQ as ce,yl as he,uY as R,xW as de,y0 as De,aa as c,h$ as ye,as as q,uS as Le,yS as Se,sN as Ce,uT as Me,uU as Re,aU as ue,e as f,xL as x,ya as Ae,aT as $e,pl as N,zb as Te,xF as C,aF as A,aQ as G,az as pe,h9 as m,aE as b,zc as ge,bh as Oe,aG as qe,at as _e,aV as ze,ou as Ie,kd as We,y8 as Ne,b1 as k,b0 as W,y6 as He,a$ as Ue,y as z,c as je,yN as Fe,O as X,lX as Q,zd as Be,ze as $,zf as Ge,tt as Y,s6 as ke,ba as Xe,wi as Qe,bc as Ye,bd as Je,be as Ke,zg as Ze,ki as J}from"./index-J0iiHjMT.js";import{t as et}from"./VisualElement-kjYXz27t.js";function fe(e,t){const n=e.fragment;n.include(we),e.include(xe),n.uniforms.add(new d("globalAlpha",i=>i.globalAlpha),new P("glowColor",i=>i.glowColor),new d("glowWidth",(i,s)=>i.glowWidth*s.camera.pixelRatio),new d("glowFalloff",i=>i.glowFalloff),new P("innerColor",i=>i.innerColor),new d("innerWidth",(i,s)=>i.innerWidth*s.camera.pixelRatio),new F("depthMap",(i,s)=>{var a;return(a=s.linearDepth)==null?void 0:a.colorTexture}),new y("nearFar",(i,s)=>s.camera.nearFar),new F("frameColor",(i,s)=>s.mainColor)),n.code.add(r`vec4 blendPremultiplied(vec4 source, vec4 dest) { +import{zs as we,zt as xe,xQ as d,x$ as P,yD as B,y_ as E,xR as r,xS as ie,yY as F,wm as Ve,hJ as ne,bi as p,a7 as se,bT as ye,y3 as ae,de as re,y5 as le,y6 as oe,y7 as ce,yE as he,va as R,yd as de,yj as De,a8 as c,hV as Ee,bz as z,v4 as Le,z9 as Se,s_ as Ce,v5 as Me,v6 as Re,b4 as pe,e as f,y2 as x,yt as Ae,c5 as $e,py as N,zu as Te,xY as C,bL as A,c2 as G,by as ue,hb as m,b3 as b,zv as ge,bk as Oe,c6 as ze,bO as _e,c7 as qe,oH as Ie,kl as We,yr as Ne,b1 as k,a$ as W,yp as He,a_ as je,y as q,c as Ue,z4 as Be,F as X,m3 as Y,zw as Fe,zx as $,zy as Ge,tG as J,s5 as ke,bd as Xe,wA as Ye,bf as Je,bg as Qe,bh as Ke,zz as Ze,kq as Q}from"./index-pCX-0tJH.js";import{t as et}from"./VisualElement--2Scr6Yq.js";function fe(e,t){const n=e.fragment;n.include(we),e.include(xe),n.uniforms.add(new d("globalAlpha",i=>i.globalAlpha),new P("glowColor",i=>i.glowColor),new d("glowWidth",(i,s)=>i.glowWidth*s.camera.pixelRatio),new d("glowFalloff",i=>i.glowFalloff),new P("innerColor",i=>i.innerColor),new d("innerWidth",(i,s)=>i.innerWidth*s.camera.pixelRatio),new B("depthMap",(i,s)=>{var a;return(a=s.linearDepth)==null?void 0:a.colorTexture}),new E("nearFar",(i,s)=>s.camera.nearFar),new B("frameColor",(i,s)=>s.mainColor)),n.code.add(r`vec4 blendPremultiplied(vec4 source, vec4 dest) { float oneMinusSourceAlpha = 1.0 - source.a; return vec4( source.rgb + dest.rgb * oneMinusSourceAlpha, @@ -35,7 +35,7 @@ float alpha = clamp(globalAlpha * max(backgroundLuminance * globalAlphaContrastB return color * alpha; }`)):n.code.add(r`vec4 laserlineOutput(vec4 color) { return color * globalAlpha; -}`)}function Pe(e){const t=new ie;t.include(fe,e);const{vertex:n,fragment:i}=t;return n.uniforms.add(new B("modelView",(s,a)=>Ve(it,a.camera.viewMatrix,s.origin)),new B("proj",(s,a)=>a.camera.projectionMatrix),new d("glowWidth",(s,a)=>s.glowWidth*a.camera.pixelRatio),new y("pixelToNDC",(s,a)=>ne(tt,2/a.camera.fullViewport[2],2/a.camera.fullViewport[3]))),t.attributes.add(u.START,"vec3"),t.attributes.add(u.END,"vec3"),t.attributes.add(u.UP,"vec3"),t.attributes.add(u.EXTRUDE,"vec2"),t.varyings.add("uv","vec2"),t.varyings.add("vViewStart","vec3"),t.varyings.add("vViewEnd","vec3"),t.varyings.add("vViewPlane","vec4"),n.code.add(r`void main() { +}`)}function Pe(e){const t=new ie;t.include(fe,e);const{vertex:n,fragment:i}=t;return n.uniforms.add(new F("modelView",(s,a)=>Ve(it,a.camera.viewMatrix,s.origin)),new F("proj",(s,a)=>a.camera.projectionMatrix),new d("glowWidth",(s,a)=>s.glowWidth*a.camera.pixelRatio),new E("pixelToNDC",(s,a)=>ne(tt,2/a.camera.fullViewport[2],2/a.camera.fullViewport[3]))),t.attributes.add(p.START,"vec3"),t.attributes.add(p.END,"vec3"),t.attributes.add(p.UP,"vec3"),t.attributes.add(p.EXTRUDE,"vec2"),t.varyings.add("uv","vec2"),t.varyings.add("vViewStart","vec3"),t.varyings.add("vViewEnd","vec3"),t.varyings.add("vViewPlane","vec4"),n.code.add(r`void main() { vec3 pos = mix(start, end, extrude.x); vec4 viewPos = modelView * vec4(pos, 1); vec4 projPos = proj * viewPos; @@ -83,12 +83,12 @@ float distance = planeDistancePixels(vViewPlane, pos, vViewStart, vViewEnd); vec4 color = laserlineProfile(distance); float alpha = 1.0 - smoothstep(0.995, 0.999, abs(dot(normal, vViewPlane.xyz))); fragColor = laserlineOutput(color * alpha * depthDiscontinuityAlpha); -}`),t}const tt=se(),it=Ee(),nt=Object.freeze(Object.defineProperty({__proto__:null,build:Pe},Symbol.toStringTag,{value:"Module"}));class T extends le{initializeProgram(t){return new oe(t.rctx,T.shader.get().build(this.configuration),me)}initializePipeline(){return ce({blending:he(R.ONE,R.ONE_MINUS_SRC_ALPHA),colorWrite:de})}}T.shader=new ae(nt,()=>re(()=>Promise.resolve().then(()=>_t),void 0));const me=new Map([[u.START,0],[u.END,1],[u.UP,2],[u.EXTRUDE,3]]);let K=class{constructor(t){this._renderCoordsHelper=t,this._buffers=null,this._origin=c(),this._dirty=!1,this._count=0,this._vao=null}set vertices(t){const n=ye(3*t.length);let i=0;for(const s of t)n[i++]=s[0],n[i++]=s[1],n[i++]=s[2];this.buffers=[n]}set buffers(t){if(this._buffers=t,this._buffers.length>0){const n=this._buffers[0],i=3*Math.floor(n.length/3/2);q(this._origin,n[i],n[i+1],n[i+2])}else q(this._origin,0,0,0);this._dirty=!0}get origin(){return this._origin}draw(t){const n=this._ensureVAO(t);n!=null&&(t.bindVAO(n),t.drawArrays(Le.TRIANGLES,0,this._count))}dispose(){this._vao!=null&&this._vao.dispose()}_ensureVAO(t){return this._buffers==null?null:(this._vao==null&&(this._vao=this._createVAO(t,this._buffers)),this._ensureVertexData(this._vao,this._buffers),this._vao)}_createVAO(t,n){const i=this._createDataBuffer(n);return this._dirty=!1,new Se(t,me,{data:Ce(ee)},{data:Me.createVertex(t,Re.STATIC_DRAW,i)})}_ensureVertexData(t,n){var s;if(!this._dirty)return;const i=this._createDataBuffer(n);(s=t.vertexBuffers.data)==null||s.setData(i),this._dirty=!1}_numberOfRenderVertices(t){return 3*(2*(t.length/3-1))}_createDataBuffer(t){const n=t.reduce((g,p)=>g+this._numberOfRenderVertices(p),0);this._count=n;const i=ee.createBuffer(n),s=this._origin;let a=0,l=0;for(const g of t){for(let p=0;p0){i.up.setVec(o-2,w),i.up.setVec(o-4,w),i.up.setVec(o-5,w);for(let v=-6;v<0;v++)i.end.setVec(o+v,j)}}a+=this._numberOfRenderVertices(g)}return i.buffer}};const st=c(),Z=c(),ee=De().vec3f(u.START).vec3f(u.END).vec3f(u.UP).vec2f(u.EXTRUDE);class H extends Ae{constructor(){super(...arguments),this.contrastControlEnabled=!1}}f([x()],H.prototype,"contrastControlEnabled",void 0);const U=N(6);function be(e){const t=new ie;t.include(Te),t.include(fe,e);const n=t.fragment;if(e.lineVerticalPlaneEnabled||e.heightManifoldEnabled)if(n.uniforms.add(new d("maxPixelDistance",(i,s)=>e.heightManifoldEnabled?2*s.camera.computeScreenPixelSizeAt(i.heightManifoldTarget):2*s.camera.computeScreenPixelSizeAt(i.lineVerticalPlaneSegment.origin))),n.code.add(r`float planeDistancePixels(vec4 plane, vec3 pos) { +}`),t}const tt=se(),it=ye(),nt=Object.freeze(Object.defineProperty({__proto__:null,build:Pe},Symbol.toStringTag,{value:"Module"}));class T extends le{initializeProgram(t){return new oe(t.rctx,T.shader.get().build(this.configuration),me)}initializePipeline(){return ce({blending:he(R.ONE,R.ONE_MINUS_SRC_ALPHA),colorWrite:de})}}T.shader=new ae(nt,()=>re(()=>Promise.resolve().then(()=>_t),void 0));const me=new Map([[p.START,0],[p.END,1],[p.UP,2],[p.EXTRUDE,3]]);let K=class{constructor(t){this._renderCoordsHelper=t,this._buffers=null,this._origin=c(),this._dirty=!1,this._count=0,this._vao=null}set vertices(t){const n=Ee(3*t.length);let i=0;for(const s of t)n[i++]=s[0],n[i++]=s[1],n[i++]=s[2];this.buffers=[n]}set buffers(t){if(this._buffers=t,this._buffers.length>0){const n=this._buffers[0],i=3*Math.floor(n.length/3/2);z(this._origin,n[i],n[i+1],n[i+2])}else z(this._origin,0,0,0);this._dirty=!0}get origin(){return this._origin}draw(t){const n=this._ensureVAO(t);n!=null&&(t.bindVAO(n),t.drawArrays(Le.TRIANGLES,0,this._count))}dispose(){this._vao!=null&&this._vao.dispose()}_ensureVAO(t){return this._buffers==null?null:(this._vao==null&&(this._vao=this._createVAO(t,this._buffers)),this._ensureVertexData(this._vao,this._buffers),this._vao)}_createVAO(t,n){const i=this._createDataBuffer(n);return this._dirty=!1,new Se(t,me,{data:Ce(ee)},{data:Me.createVertex(t,Re.STATIC_DRAW,i)})}_ensureVertexData(t,n){var s;if(!this._dirty)return;const i=this._createDataBuffer(n);(s=t.vertexBuffers.data)==null||s.setData(i),this._dirty=!1}_numberOfRenderVertices(t){return 3*(2*(t.length/3-1))}_createDataBuffer(t){const n=t.reduce((g,u)=>g+this._numberOfRenderVertices(u),0);this._count=n;const i=ee.createBuffer(n),s=this._origin;let a=0,l=0;for(const g of t){for(let u=0;u0){i.up.setVec(o-2,w),i.up.setVec(o-4,w),i.up.setVec(o-5,w);for(let v=-6;v<0;v++)i.end.setVec(o+v,U)}}a+=this._numberOfRenderVertices(g)}return i.buffer}};const st=c(),Z=c(),ee=De().vec3f(p.START).vec3f(p.END).vec3f(p.UP).vec2f(p.EXTRUDE);class H extends Ae{constructor(){super(...arguments),this.contrastControlEnabled=!1}}f([x()],H.prototype,"contrastControlEnabled",void 0);const j=N(6);function be(e){const t=new ie;t.include(Te),t.include(fe,e);const n=t.fragment;if(e.lineVerticalPlaneEnabled||e.heightManifoldEnabled)if(n.uniforms.add(new d("maxPixelDistance",(i,s)=>e.heightManifoldEnabled?2*s.camera.computeScreenPixelSizeAt(i.heightManifoldTarget):2*s.camera.computeScreenPixelSizeAt(i.lineVerticalPlaneSegment.origin))),n.code.add(r`float planeDistancePixels(vec4 plane, vec3 pos) { float dist = dot(plane.xyz, pos) + plane.w; float width = fwidth(dist); dist /= min(width, maxPixelDistance); return abs(dist); -}`),e.spherical){const i=(a,l,g)=>m(a,l.heightManifoldTarget,g.camera.viewMatrix),s=(a,l)=>m(a,[0,0,0],l.camera.viewMatrix);n.uniforms.add(new C("heightManifoldOrigin",(a,l)=>(i(_,a,l),s(V,l),ue(V,V,_),A(h,V),h[3]=G(V),h)),new P("globalOrigin",(a,l)=>s(_,l)),new d("cosSphericalAngleThreshold",(a,l)=>1-Math.max(2,pe(l.camera.eye,a.heightManifoldTarget)*l.camera.perRenderPixelRatio)/G(a.heightManifoldTarget))),n.code.add(r`float globeDistancePixels(float posInGlobalOriginLength) { +}`),e.spherical){const i=(a,l,g)=>m(a,l.heightManifoldTarget,g.camera.viewMatrix),s=(a,l)=>m(a,[0,0,0],l.camera.viewMatrix);n.uniforms.add(new C("heightManifoldOrigin",(a,l)=>(i(_,a,l),s(V,l),pe(V,V,_),A(h,V),h[3]=G(V),h)),new P("globalOrigin",(a,l)=>s(_,l)),new d("cosSphericalAngleThreshold",(a,l)=>1-Math.max(2,ue(l.camera.eye,a.heightManifoldTarget)*l.camera.perRenderPixelRatio)/G(a.heightManifoldTarget))),n.code.add(r`float globeDistancePixels(float posInGlobalOriginLength) { float dist = abs(posInGlobalOriginLength - heightManifoldOrigin.w); float width = fwidth(dist); dist /= min(width, maxPixelDistance); @@ -124,25 +124,25 @@ float depthDiscontinuityAlpha; if (!laserlineReconstructFromDepth(pos, normal, depthDiscontinuityAlpha)) { discard; } -vec4 color = vec4(0, 0, 0, 0);`),e.heightManifoldEnabled){n.uniforms.add(new y("angleCutoff",s=>M(s)),new C("heightPlane",(s,a)=>ve(s.heightManifoldTarget,s.renderCoordsHelper.worldUpAtPosition(s.heightManifoldTarget,_),a.camera.viewMatrix)));const i=e.spherical?r`normalize(globalOrigin - pos)`:r`heightPlane.xyz`;n.code.add(r` +vec4 color = vec4(0, 0, 0, 0);`),e.heightManifoldEnabled){n.uniforms.add(new E("angleCutoff",s=>M(s)),new C("heightPlane",(s,a)=>ve(s.heightManifoldTarget,s.renderCoordsHelper.worldUpAtPosition(s.heightManifoldTarget,_),a.camera.viewMatrix)));const i=e.spherical?r`normalize(globalOrigin - pos)`:r`heightPlane.xyz`;n.code.add(r` { float heightManifoldAlpha = 1.0 - smoothstep(angleCutoff.x, angleCutoff.y, abs(dot(normal, ${i}))); vec4 heightManifoldColor = laserlineProfile(heightManifoldDistancePixels(heightPlane, pos)); color = max(color, heightManifoldColor * heightManifoldAlpha); } - `)}return e.pointDistanceEnabled&&(n.uniforms.add(new y("angleCutoff",i=>M(i)),new C("pointDistanceSphere",(i,s)=>at(i,s))),n.code.add(r`{ + `)}return e.pointDistanceEnabled&&(n.uniforms.add(new E("angleCutoff",i=>M(i)),new C("pointDistanceSphere",(i,s)=>at(i,s))),n.code.add(r`{ float pointDistanceSphereDistance = sphereDistancePixels(pointDistanceSphere, pos); vec4 pointDistanceSphereColor = laserlineProfile(pointDistanceSphereDistance); float pointDistanceSphereAlpha = 1.0 - smoothstep(angleCutoff.x, angleCutoff.y, abs(dot(normal, normalize(pos - pointDistanceSphere.xyz)))); color = max(color, pointDistanceSphereColor * pointDistanceSphereAlpha); -}`)),e.lineVerticalPlaneEnabled&&(n.uniforms.add(new y("angleCutoff",i=>M(i)),new C("lineVerticalPlane",(i,s)=>rt(i,s)),new P("lineVerticalStart",(i,s)=>lt(i,s)),new P("lineVerticalEnd",(i,s)=>ot(i,s))),n.code.add(r`{ +}`)),e.lineVerticalPlaneEnabled&&(n.uniforms.add(new E("angleCutoff",i=>M(i)),new C("lineVerticalPlane",(i,s)=>rt(i,s)),new P("lineVerticalStart",(i,s)=>lt(i,s)),new P("lineVerticalEnd",(i,s)=>ot(i,s))),n.code.add(r`{ if (pointIsWithinLine(pos, lineVerticalStart, lineVerticalEnd)) { float lineVerticalDistance = planeDistancePixels(lineVerticalPlane, pos); vec4 lineVerticalColor = laserlineProfile(lineVerticalDistance); float lineVerticalAlpha = 1.0 - smoothstep(angleCutoff.x, angleCutoff.y, abs(dot(normal, lineVerticalPlane.xyz))); color = max(color, lineVerticalColor * lineVerticalAlpha); } -}`)),e.intersectsLineEnabled&&(n.uniforms.add(new y("angleCutoff",i=>M(i)),new P("intersectsLineStart",(i,s)=>m(_,i.lineStartWorld,s.camera.viewMatrix)),new P("intersectsLineEnd",(i,s)=>m(_,i.lineEndWorld,s.camera.viewMatrix)),new P("intersectsLineDirection",(i,s)=>(b(h,i.intersectsLineSegment.vector),h[3]=0,A(_,ge(h,h,s.camera.viewMatrix)))),new d("intersectsLineRadius",i=>i.intersectsLineRadius)),n.code.add(r`{ +}`)),e.intersectsLineEnabled&&(n.uniforms.add(new E("angleCutoff",i=>M(i)),new P("intersectsLineStart",(i,s)=>m(_,i.lineStartWorld,s.camera.viewMatrix)),new P("intersectsLineEnd",(i,s)=>m(_,i.lineEndWorld,s.camera.viewMatrix)),new P("intersectsLineDirection",(i,s)=>(b(h,i.intersectsLineSegment.vector),h[3]=0,A(_,ge(h,h,s.camera.viewMatrix)))),new d("intersectsLineRadius",i=>i.intersectsLineRadius)),n.code.add(r`{ if (pointIsWithinLine(pos, intersectsLineStart, intersectsLineEnd)) { float intersectsLineDistance = lineDistancePixels(intersectsLineStart, intersectsLineDirection, intersectsLineRadius, pos); vec4 intersectsLineColor = laserlineProfile(intersectsLineDistance); @@ -150,7 +150,7 @@ float intersectsLineAlpha = 1.0 - smoothstep(angleCutoff.x, angleCutoff.y, 1.0 - color = max(color, intersectsLineColor * intersectsLineAlpha); } }`)),n.code.add(r`fragColor = laserlineOutput(color * depthDiscontinuityAlpha); -}`),t}function M(e){return ne(ct,Math.cos(e.angleCutoff),Math.cos(Math.max(0,e.angleCutoff-N(2))))}function at(e,t){return m(I,e.pointDistanceOrigin,t.camera.viewMatrix),I[3]=pe(e.pointDistanceOrigin,e.pointDistanceTarget),I}function rt(e,t){const n=Oe(e.lineVerticalPlaneSegment,.5,_),i=e.renderCoordsHelper.worldUpAtPosition(n,ht),s=A(V,e.lineVerticalPlaneSegment.vector),a=qe(h,i,s);return A(a,a),ve(e.lineVerticalPlaneSegment.origin,a,t.camera.viewMatrix)}function lt(e,t){const n=b(_,e.lineVerticalPlaneSegment.origin);return e.renderCoordsHelper.setAltitude(n,0),m(n,n,t.camera.viewMatrix)}function ot(e,t){const n=_e(_,e.lineVerticalPlaneSegment.origin,e.lineVerticalPlaneSegment.vector);return e.renderCoordsHelper.setAltitude(n,0),m(n,n,t.camera.viewMatrix)}function ve(e,t,n){return m(te,e,n),b(h,t),h[3]=0,ge(h,h,n),ze(te,h,dt)}const ct=se(),_=c(),h=Ie(),ht=c(),V=c(),te=c(),dt=$e(),I=We(),ut=Object.freeze(Object.defineProperty({__proto__:null,build:be,defaultAngleCutoff:U},Symbol.toStringTag,{value:"Module"}));class pt extends Ne{constructor(){super(...arguments),this.innerColor=k(1,1,1),this.innerWidth=1,this.glowColor=k(1,.5,0),this.glowWidth=8,this.glowFalloff=8,this.globalAlpha=.75,this.globalAlphaContrastBoost=2,this.angleCutoff=N(6),this.pointDistanceOrigin=c(),this.pointDistanceTarget=c(),this.lineVerticalPlaneSegment=W(),this.intersectsLineSegment=W(),this.intersectsLineRadius=3,this.heightManifoldTarget=c(),this.lineStartWorld=c(),this.lineEndWorld=c()}}class O extends le{initializeProgram(t){return new oe(t.rctx,O.shader.get().build(this.configuration),He)}initializePipeline(){return ce({blending:he(R.ONE,R.ONE_MINUS_SRC_ALPHA),colorWrite:de})}}O.shader=new ae(ut,()=>re(()=>Promise.resolve().then(()=>ft),void 0));class E extends H{constructor(){super(...arguments),this.heightManifoldEnabled=!1,this.pointDistanceEnabled=!1,this.lineVerticalPlaneEnabled=!1,this.intersectsLineEnabled=!1,this.spherical=!1}}f([x()],E.prototype,"heightManifoldEnabled",void 0),f([x()],E.prototype,"pointDistanceEnabled",void 0),f([x()],E.prototype,"lineVerticalPlaneEnabled",void 0),f([x()],E.prototype,"intersectsLineEnabled",void 0),f([x()],E.prototype,"spherical",void 0);let D=class extends Fe{constructor(e){super(e),this._technique=null,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._viewingMode=X.Local,this._pathVerticalPlaneEnabled=!1,this._pathVerticalPlaneData=null,this._pathTechnique=null,this._passParameters=new pt,this.produces=new Map([[Q.LASERLINES,()=>!this.contrastControlEnabled],[Q.LASERLINES_CONTRAST_CONTROL,()=>this.contrastControlEnabled]])}initialize(){this._passParameters.renderCoordsHelper=this.renderCoordsHelper}consumes(){return Be}get isDecoration(){return this._isDecoration}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this._requestRender())}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){b(this._passParameters.heightManifoldTarget,e),this._requestRender()}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this._requestRender())}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){b(this._passParameters.pointDistanceTarget,e),this._requestRender()}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){b(this._passParameters.pointDistanceOrigin,e),this._requestRender()}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this._requestRender())}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){$(e,this._passParameters.lineVerticalPlaneSegment),this._requestRender()}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this._requestRender())}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){$(e,this._passParameters.intersectsLineSegment),this._requestRender()}get intersectsLineRadius(){return this._passParameters.intersectsLineRadius}set intersectsLineRadius(e){e!==this._passParameters.intersectsLineRadius&&(this._passParameters.intersectsLineRadius=e,this._requestRender())}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this._requestRender())}get viewingMode(){return this._viewingMode}set viewingMode(e){e!==this._viewingMode&&(this._viewingMode=e,this._requestRender())}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,this._pathVerticalPlaneData!=null&&this._requestRender())}set pathVerticalPlaneVertices(e){this._pathVerticalPlaneData==null&&(this._pathVerticalPlaneData=new K(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this._requestRender()}set pathVerticalPlaneBuffers(e){this._pathVerticalPlaneData==null&&(this._pathVerticalPlaneData=new K(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this._requestRender()}setParameters(e){Ge(this._passParameters,e)&&this._requestRender()}initializeRenderContext(e){this._context=e,this._techniqueRepository=e.techniqueRepository,this._techniqueConfig=new E;const t=new H;t.contrastControlEnabled=this.contrastControlEnabled,this._pathTechnique=this._techniqueRepository.acquire(T,t)}uninitializeRenderContext(){this._technique=Y(this._technique),this._pathVerticalPlaneData=ke(this._pathVerticalPlaneData),this._pathTechnique=Y(this._pathTechnique)}prepareTechnique(){return this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled?(this._techniqueConfig.heightManifoldEnabled=this.heightManifoldEnabled,this._techniqueConfig.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._techniqueConfig.pointDistanceEnabled=this.pointDistanceEnabled,this._techniqueConfig.intersectsLineEnabled=this.intersectsLineEnabled,this._techniqueConfig.contrastControlEnabled=this.contrastControlEnabled,this._techniqueConfig.spherical=this._viewingMode===X.Global,this._technique=this._techniqueRepository.releaseAndAcquire(O,this._techniqueConfig,this._technique),this._technique):this._pathTechnique}renderNode(e,t){(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(e,t),this.pathVerticalPlaneEnabled&&this._renderPath(e)}_renderUnified(e,t){const n=e.rctx;this._updatePassParameters(e),n.bindTechnique(t,this._passParameters,e.bindParameters),n.screen.draw()}_renderPath(e){if(this._pathVerticalPlaneData==null||this._pathTechnique==null)return;const t=e.rctx,n=this._pathTechnique;t.bindTechnique(n,{...this._passParameters,origin:this._pathVerticalPlaneData.origin},e.bindParameters),this._pathVerticalPlaneData.draw(e.rctx)}_updatePassParameters(e){if(!this._intersectsLineEnabled)return;const t=e.bindParameters.camera;if(this._intersectsLineInfinite){if(Xe(Qe(this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector),L),L.c0=-Number.MAX_VALUE,!Ye(t.frustum,L))return;Je(L,this._passParameters.lineStartWorld),Ke(L,this._passParameters.lineEndWorld)}else b(this._passParameters.lineStartWorld,this._passParameters.intersectsLineSegment.origin),_e(this._passParameters.lineEndWorld,this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector)}_requestRender(){this._context&&this._context.requestRender()}get test(){return{passParameters:this._passParameters}}};f([z({constructOnly:!0})],D.prototype,"contrastControlEnabled",void 0),f([z({constructOnly:!0})],D.prototype,"_isDecoration",void 0),f([z({constructOnly:!0})],D.prototype,"renderCoordsHelper",void 0),D=f([je("esri.views.3d.support.LaserLineRenderer")],D);const L=Ue();class vt extends et{constructor(t){super(t),this._angleCutoff=U,this._style={},this._heightManifoldTarget=c(),this._heightManifoldEnabled=!1,this._intersectsLine=W(),this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._lineVerticalPlaneSegment=null,this._pathVerticalPlaneBuffers=null,this._pointDistanceLine=null,this.applyProperties(t)}get testData(){return this._renderer}createResources(){this._ensureRenderer()}destroyResources(){this._disposeRenderer()}updateVisibility(){this._syncRenderer(),this._syncHeightManifold(),this._syncIntersectsLine(),this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance()}get angleCutoff(){return this._angleCutoff}set angleCutoff(t){this._angleCutoff!==t&&(this._angleCutoff=t,this._syncAngleCutoff())}get style(){return this._style}set style(t){this._style=t,this._syncStyle()}get heightManifoldTarget(){return this._heightManifoldEnabled?this._heightManifoldTarget:null}set heightManifoldTarget(t){t!=null?(b(this._heightManifoldTarget,t),this._heightManifoldEnabled=!0):this._heightManifoldEnabled=!1,this._syncRenderer(),this._syncHeightManifold()}set intersectsWorldUpAtLocation(t){if(t==null)return void(this.intersectsLine=null);const n=this.view.renderCoordsHelper.worldUpAtPosition(t,gt);this.intersectsLine=Ze(t,n),this.intersectsLineInfinite=!0}get intersectsLine(){return this._intersectsLineEnabled?this._intersectsLine:null}set intersectsLine(t){t!=null?($(t,this._intersectsLine),this._intersectsLineEnabled=!0):this._intersectsLineEnabled=!1,this._syncIntersectsLine(),this._syncRenderer()}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(t){this._intersectsLineInfinite=t,this._syncIntersectsLineInfinite()}get lineVerticalPlaneSegment(){return this._lineVerticalPlaneSegment}set lineVerticalPlaneSegment(t){this._lineVerticalPlaneSegment=t!=null?$(t):null,this._syncLineVerticalPlane(),this._syncRenderer()}get pathVerticalPlane(){return this._pathVerticalPlaneBuffers}set pathVerticalPlane(t){this._pathVerticalPlaneBuffers=t,this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance(),this._syncRenderer()}get pointDistanceLine(){return this._pointDistanceLine}set pointDistanceLine(t){this._pointDistanceLine=t!=null?{origin:J(t.origin),target:t.target?J(t.target):null}:null,this._syncPointDistance(),this._syncRenderer()}_syncRenderer(){this.attached&&this.visible&&(this._intersectsLineEnabled||this._heightManifoldEnabled||this._pointDistanceLine!=null||this._pathVerticalPlaneBuffers!=null)?this._ensureRenderer():this._disposeRenderer()}_ensureRenderer(){this._renderer==null&&(this._renderer=new D({renderCoordsHelper:this.view.renderCoordsHelper,contrastControlEnabled:!0,_isDecoration:this.isDecoration}),this._renderer.viewingMode=this.view.state.viewingMode,this._syncStyle(),this._syncHeightManifold(),this._syncIntersectsLine(),this._syncIntersectsLineInfinite(),this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance(),this._syncAngleCutoff(),this.view._stage&&this.view._stage.addRenderPlugin(this._renderer))}_syncStyle(){this._renderer!=null&&(this._renderer.setParameters(this._style),this._style.intersectsLineRadius!=null&&(this._renderer.intersectsLineRadius=this._style.intersectsLineRadius))}_syncAngleCutoff(){this._renderer!=null&&this._renderer.setParameters({angleCutoff:this._angleCutoff})}_syncHeightManifold(){this._renderer!=null&&(this._renderer.heightManifoldEnabled=this._heightManifoldEnabled&&this.visible,this._heightManifoldEnabled&&(this._renderer.heightManifoldTarget=this._heightManifoldTarget))}_syncIntersectsLine(){this._renderer!=null&&(this._renderer.intersectsLineEnabled=this._intersectsLineEnabled&&this.visible,this._intersectsLineEnabled&&(this._renderer.intersectsLineSegment=this._intersectsLine))}_syncIntersectsLineInfinite(){this._renderer!=null&&(this._renderer.intersectsLineInfinite=this._intersectsLineInfinite)}_syncPathVerticalPlane(){this._renderer!=null&&(this._renderer.pathVerticalPlaneEnabled=this._pathVerticalPlaneBuffers!=null&&this.visible,this._pathVerticalPlaneBuffers!=null&&(this._renderer.pathVerticalPlaneBuffers=this._pathVerticalPlaneBuffers))}_syncLineVerticalPlane(){this._renderer!=null&&(this._renderer.lineVerticalPlaneEnabled=this._lineVerticalPlaneSegment!=null&&this.visible,this._lineVerticalPlaneSegment!=null&&(this._renderer.lineVerticalPlaneSegment=this._lineVerticalPlaneSegment))}_syncPointDistance(){if(this._renderer==null)return;const t=this._pointDistanceLine,n=t!=null;this._renderer.pointDistanceEnabled=n&&t.target!=null&&this.visible,n&&(this._renderer.pointDistanceOrigin=t.origin,t.target!=null&&(this._renderer.pointDistanceTarget=t.target))}_disposeRenderer(){this._renderer!=null&&this.view._stage&&(this.view._stage.removeRenderPlugin(this._renderer),this._renderer=null)}}const gt=c(),_t=Object.freeze(Object.defineProperty({__proto__:null,build:Pe},Symbol.toStringTag,{value:"Module"})),ft=Object.freeze(Object.defineProperty({__proto__:null,build:be,defaultAngleCutoff:U},Symbol.toStringTag,{value:"Module"}));export{vt as c}; +}`),t}function M(e){return ne(ct,Math.cos(e.angleCutoff),Math.cos(Math.max(0,e.angleCutoff-N(2))))}function at(e,t){return m(I,e.pointDistanceOrigin,t.camera.viewMatrix),I[3]=ue(e.pointDistanceOrigin,e.pointDistanceTarget),I}function rt(e,t){const n=Oe(e.lineVerticalPlaneSegment,.5,_),i=e.renderCoordsHelper.worldUpAtPosition(n,ht),s=A(V,e.lineVerticalPlaneSegment.vector),a=ze(h,i,s);return A(a,a),ve(e.lineVerticalPlaneSegment.origin,a,t.camera.viewMatrix)}function lt(e,t){const n=b(_,e.lineVerticalPlaneSegment.origin);return e.renderCoordsHelper.setAltitude(n,0),m(n,n,t.camera.viewMatrix)}function ot(e,t){const n=_e(_,e.lineVerticalPlaneSegment.origin,e.lineVerticalPlaneSegment.vector);return e.renderCoordsHelper.setAltitude(n,0),m(n,n,t.camera.viewMatrix)}function ve(e,t,n){return m(te,e,n),b(h,t),h[3]=0,ge(h,h,n),qe(te,h,dt)}const ct=se(),_=c(),h=Ie(),ht=c(),V=c(),te=c(),dt=$e(),I=We(),pt=Object.freeze(Object.defineProperty({__proto__:null,build:be,defaultAngleCutoff:j},Symbol.toStringTag,{value:"Module"}));class ut extends Ne{constructor(){super(...arguments),this.innerColor=k(1,1,1),this.innerWidth=1,this.glowColor=k(1,.5,0),this.glowWidth=8,this.glowFalloff=8,this.globalAlpha=.75,this.globalAlphaContrastBoost=2,this.angleCutoff=N(6),this.pointDistanceOrigin=c(),this.pointDistanceTarget=c(),this.lineVerticalPlaneSegment=W(),this.intersectsLineSegment=W(),this.intersectsLineRadius=3,this.heightManifoldTarget=c(),this.lineStartWorld=c(),this.lineEndWorld=c()}}class O extends le{initializeProgram(t){return new oe(t.rctx,O.shader.get().build(this.configuration),He)}initializePipeline(){return ce({blending:he(R.ONE,R.ONE_MINUS_SRC_ALPHA),colorWrite:de})}}O.shader=new ae(pt,()=>re(()=>Promise.resolve().then(()=>ft),void 0));class y extends H{constructor(){super(...arguments),this.heightManifoldEnabled=!1,this.pointDistanceEnabled=!1,this.lineVerticalPlaneEnabled=!1,this.intersectsLineEnabled=!1,this.spherical=!1}}f([x()],y.prototype,"heightManifoldEnabled",void 0),f([x()],y.prototype,"pointDistanceEnabled",void 0),f([x()],y.prototype,"lineVerticalPlaneEnabled",void 0),f([x()],y.prototype,"intersectsLineEnabled",void 0),f([x()],y.prototype,"spherical",void 0);let D=class extends Be{constructor(e){super(e),this._technique=null,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._viewingMode=X.Local,this._pathVerticalPlaneEnabled=!1,this._pathVerticalPlaneData=null,this._pathTechnique=null,this._passParameters=new ut,this.produces=new Map([[Y.LASERLINES,()=>!this.contrastControlEnabled],[Y.LASERLINES_CONTRAST_CONTROL,()=>this.contrastControlEnabled]])}initialize(){this._passParameters.renderCoordsHelper=this.renderCoordsHelper}consumes(){return Fe}get isDecoration(){return this._isDecoration}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this._requestRender())}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){b(this._passParameters.heightManifoldTarget,e),this._requestRender()}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this._requestRender())}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){b(this._passParameters.pointDistanceTarget,e),this._requestRender()}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){b(this._passParameters.pointDistanceOrigin,e),this._requestRender()}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this._requestRender())}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){$(e,this._passParameters.lineVerticalPlaneSegment),this._requestRender()}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this._requestRender())}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){$(e,this._passParameters.intersectsLineSegment),this._requestRender()}get intersectsLineRadius(){return this._passParameters.intersectsLineRadius}set intersectsLineRadius(e){e!==this._passParameters.intersectsLineRadius&&(this._passParameters.intersectsLineRadius=e,this._requestRender())}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this._requestRender())}get viewingMode(){return this._viewingMode}set viewingMode(e){e!==this._viewingMode&&(this._viewingMode=e,this._requestRender())}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,this._pathVerticalPlaneData!=null&&this._requestRender())}set pathVerticalPlaneVertices(e){this._pathVerticalPlaneData==null&&(this._pathVerticalPlaneData=new K(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this._requestRender()}set pathVerticalPlaneBuffers(e){this._pathVerticalPlaneData==null&&(this._pathVerticalPlaneData=new K(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this._requestRender()}setParameters(e){Ge(this._passParameters,e)&&this._requestRender()}initializeRenderContext(e){this._context=e,this._techniqueRepository=e.techniqueRepository,this._techniqueConfig=new y;const t=new H;t.contrastControlEnabled=this.contrastControlEnabled,this._pathTechnique=this._techniqueRepository.acquire(T,t)}uninitializeRenderContext(){this._technique=J(this._technique),this._pathVerticalPlaneData=ke(this._pathVerticalPlaneData),this._pathTechnique=J(this._pathTechnique)}prepareTechnique(){return this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled?(this._techniqueConfig.heightManifoldEnabled=this.heightManifoldEnabled,this._techniqueConfig.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._techniqueConfig.pointDistanceEnabled=this.pointDistanceEnabled,this._techniqueConfig.intersectsLineEnabled=this.intersectsLineEnabled,this._techniqueConfig.contrastControlEnabled=this.contrastControlEnabled,this._techniqueConfig.spherical=this._viewingMode===X.Global,this._technique=this._techniqueRepository.releaseAndAcquire(O,this._techniqueConfig,this._technique),this._technique):this._pathTechnique}renderNode(e,t){(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(e,t),this.pathVerticalPlaneEnabled&&this._renderPath(e)}_renderUnified(e,t){const n=e.rctx;this._updatePassParameters(e),n.bindTechnique(t,this._passParameters,e.bindParameters),n.screen.draw()}_renderPath(e){if(this._pathVerticalPlaneData==null||this._pathTechnique==null)return;const t=e.rctx,n=this._pathTechnique;t.bindTechnique(n,{...this._passParameters,origin:this._pathVerticalPlaneData.origin},e.bindParameters),this._pathVerticalPlaneData.draw(e.rctx)}_updatePassParameters(e){if(!this._intersectsLineEnabled)return;const t=e.bindParameters.camera;if(this._intersectsLineInfinite){if(Xe(Ye(this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector),L),L.c0=-Number.MAX_VALUE,!Je(t.frustum,L))return;Qe(L,this._passParameters.lineStartWorld),Ke(L,this._passParameters.lineEndWorld)}else b(this._passParameters.lineStartWorld,this._passParameters.intersectsLineSegment.origin),_e(this._passParameters.lineEndWorld,this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector)}_requestRender(){this._context&&this._context.requestRender()}get test(){return{passParameters:this._passParameters}}};f([q({constructOnly:!0})],D.prototype,"contrastControlEnabled",void 0),f([q({constructOnly:!0})],D.prototype,"_isDecoration",void 0),f([q({constructOnly:!0})],D.prototype,"renderCoordsHelper",void 0),D=f([Ue("esri.views.3d.support.LaserLineRenderer")],D);const L=je();class vt extends et{constructor(t){super(t),this._angleCutoff=j,this._style={},this._heightManifoldTarget=c(),this._heightManifoldEnabled=!1,this._intersectsLine=W(),this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._lineVerticalPlaneSegment=null,this._pathVerticalPlaneBuffers=null,this._pointDistanceLine=null,this.applyProperties(t)}get testData(){return this._renderer}createResources(){this._ensureRenderer()}destroyResources(){this._disposeRenderer()}updateVisibility(){this._syncRenderer(),this._syncHeightManifold(),this._syncIntersectsLine(),this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance()}get angleCutoff(){return this._angleCutoff}set angleCutoff(t){this._angleCutoff!==t&&(this._angleCutoff=t,this._syncAngleCutoff())}get style(){return this._style}set style(t){this._style=t,this._syncStyle()}get heightManifoldTarget(){return this._heightManifoldEnabled?this._heightManifoldTarget:null}set heightManifoldTarget(t){t!=null?(b(this._heightManifoldTarget,t),this._heightManifoldEnabled=!0):this._heightManifoldEnabled=!1,this._syncRenderer(),this._syncHeightManifold()}set intersectsWorldUpAtLocation(t){if(t==null)return void(this.intersectsLine=null);const n=this.view.renderCoordsHelper.worldUpAtPosition(t,gt);this.intersectsLine=Ze(t,n),this.intersectsLineInfinite=!0}get intersectsLine(){return this._intersectsLineEnabled?this._intersectsLine:null}set intersectsLine(t){t!=null?($(t,this._intersectsLine),this._intersectsLineEnabled=!0):this._intersectsLineEnabled=!1,this._syncIntersectsLine(),this._syncRenderer()}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(t){this._intersectsLineInfinite=t,this._syncIntersectsLineInfinite()}get lineVerticalPlaneSegment(){return this._lineVerticalPlaneSegment}set lineVerticalPlaneSegment(t){this._lineVerticalPlaneSegment=t!=null?$(t):null,this._syncLineVerticalPlane(),this._syncRenderer()}get pathVerticalPlane(){return this._pathVerticalPlaneBuffers}set pathVerticalPlane(t){this._pathVerticalPlaneBuffers=t,this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance(),this._syncRenderer()}get pointDistanceLine(){return this._pointDistanceLine}set pointDistanceLine(t){this._pointDistanceLine=t!=null?{origin:Q(t.origin),target:t.target?Q(t.target):null}:null,this._syncPointDistance(),this._syncRenderer()}_syncRenderer(){this.attached&&this.visible&&(this._intersectsLineEnabled||this._heightManifoldEnabled||this._pointDistanceLine!=null||this._pathVerticalPlaneBuffers!=null)?this._ensureRenderer():this._disposeRenderer()}_ensureRenderer(){this._renderer==null&&(this._renderer=new D({renderCoordsHelper:this.view.renderCoordsHelper,contrastControlEnabled:!0,_isDecoration:this.isDecoration}),this._renderer.viewingMode=this.view.state.viewingMode,this._syncStyle(),this._syncHeightManifold(),this._syncIntersectsLine(),this._syncIntersectsLineInfinite(),this._syncPathVerticalPlane(),this._syncLineVerticalPlane(),this._syncPointDistance(),this._syncAngleCutoff(),this.view._stage&&this.view._stage.addRenderPlugin(this._renderer))}_syncStyle(){this._renderer!=null&&(this._renderer.setParameters(this._style),this._style.intersectsLineRadius!=null&&(this._renderer.intersectsLineRadius=this._style.intersectsLineRadius))}_syncAngleCutoff(){this._renderer!=null&&this._renderer.setParameters({angleCutoff:this._angleCutoff})}_syncHeightManifold(){this._renderer!=null&&(this._renderer.heightManifoldEnabled=this._heightManifoldEnabled&&this.visible,this._heightManifoldEnabled&&(this._renderer.heightManifoldTarget=this._heightManifoldTarget))}_syncIntersectsLine(){this._renderer!=null&&(this._renderer.intersectsLineEnabled=this._intersectsLineEnabled&&this.visible,this._intersectsLineEnabled&&(this._renderer.intersectsLineSegment=this._intersectsLine))}_syncIntersectsLineInfinite(){this._renderer!=null&&(this._renderer.intersectsLineInfinite=this._intersectsLineInfinite)}_syncPathVerticalPlane(){this._renderer!=null&&(this._renderer.pathVerticalPlaneEnabled=this._pathVerticalPlaneBuffers!=null&&this.visible,this._pathVerticalPlaneBuffers!=null&&(this._renderer.pathVerticalPlaneBuffers=this._pathVerticalPlaneBuffers))}_syncLineVerticalPlane(){this._renderer!=null&&(this._renderer.lineVerticalPlaneEnabled=this._lineVerticalPlaneSegment!=null&&this.visible,this._lineVerticalPlaneSegment!=null&&(this._renderer.lineVerticalPlaneSegment=this._lineVerticalPlaneSegment))}_syncPointDistance(){if(this._renderer==null)return;const t=this._pointDistanceLine,n=t!=null;this._renderer.pointDistanceEnabled=n&&t.target!=null&&this.visible,n&&(this._renderer.pointDistanceOrigin=t.origin,t.target!=null&&(this._renderer.pointDistanceTarget=t.target))}_disposeRenderer(){this._renderer!=null&&this.view._stage&&(this.view._stage.removeRenderPlugin(this._renderer),this._renderer=null)}}const gt=c(),_t=Object.freeze(Object.defineProperty({__proto__:null,build:Pe},Symbol.toStringTag,{value:"Module"})),ft=Object.freeze(Object.defineProperty({__proto__:null,build:be,defaultAngleCutoff:j},Symbol.toStringTag,{value:"Module"}));export{vt as c}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] diff --git a/dist/assets/LayerView-efDufa6j.js b/dist/assets/LayerView-ixwLVnzr.js similarity index 66% rename from dist/assets/LayerView-efDufa6j.js rename to dist/assets/LayerView-ixwLVnzr.js index b50cae3..d144a98 100644 --- a/dist/assets/LayerView-efDufa6j.js +++ b/dist/assets/LayerView-ixwLVnzr.js @@ -1 +1 @@ -import{m as a,cZ as d,K as o,p,k as u,Z as y,n as h,e as i,y as s,c as g}from"./index-J0iiHjMT.js";let t=class extends a(d(o.EventedMixin(p))){constructor(e){super(e),this._updatingHandles=new u,this.layer=null,this.parent=null}initialize(){this.when().catch(e=>{var n;if(e.name!=="layerview:create-error"){const r=this.layer&&this.layer.id||"no id",l=((n=this.layer)==null?void 0:n.title)||"no title";y.getLogger(this).error("#resolve()",`Failed to resolve layer view (layer title: '${l}', id: '${r}')`,e)}})}destroy(){this._updatingHandles=h(this._updatingHandles)}get fullOpacity(){var e,n;return(((e=this.layer)==null?void 0:e.opacity)??1)*(((n=this.parent)==null?void 0:n.fullOpacity)??1)}get suspended(){return!this.canResume()}get suspendInfo(){return this.getSuspendInfo()}get legendEnabled(){var e;return!this.suspended&&((e=this.layer)==null?void 0:e.legendEnabled)===!0}get updating(){var e;return!(!((e=this._updatingHandles)!=null&&e.updating)&&!this.isUpdating())}get updatingProgress(){return this.updating?0:1}get visible(){var e;return((e=this.layer)==null?void 0:e.visible)===!0}set visible(e){this._overrideIfSome("visible",e)}canResume(){var e,n,r;return this.visible&&((e=this.layer)==null?void 0:e.loaded)&&!((n=this.parent)!=null&&n.suspended)&&((r=this.view)==null?void 0:r.ready)||!1}getSuspendInfo(){var r,l;const e=(r=this.parent)!=null&&r.suspended?this.parent.suspendInfo:{};return(l=this.view)!=null&&l.ready||(e.viewNotReady=!0),this.layer&&this.layer.loaded||(e.layerNotLoaded=!0),this.visible||(e.layerInvisible=!0),e}isUpdating(){return!1}};i([s()],t.prototype,"fullOpacity",null),i([s()],t.prototype,"layer",void 0),i([s()],t.prototype,"parent",void 0),i([s({readOnly:!0})],t.prototype,"suspended",null),i([s({readOnly:!0})],t.prototype,"suspendInfo",null),i([s({readOnly:!0})],t.prototype,"legendEnabled",null),i([s({type:Boolean,readOnly:!0})],t.prototype,"updating",null),i([s({readOnly:!0})],t.prototype,"updatingProgress",null),i([s()],t.prototype,"visible",null),i([s()],t.prototype,"view",void 0),t=i([g("esri.views.layers.LayerView")],t);const c=t;export{c as u}; +import{a,cQ as d,z as o,g as p,h as u,R as y,b as h,e as i,y as s,c as g}from"./index-pCX-0tJH.js";let t=class extends a(d(o.EventedMixin(p))){constructor(e){super(e),this._updatingHandles=new u,this.layer=null,this.parent=null}initialize(){this.when().catch(e=>{var r;if(e.name!=="layerview:create-error"){const n=this.layer&&this.layer.id||"no id",l=((r=this.layer)==null?void 0:r.title)||"no title";y.getLogger(this).error("#resolve()",`Failed to resolve layer view (layer title: '${l}', id: '${n}')`,e)}})}destroy(){this._updatingHandles=h(this._updatingHandles)}get fullOpacity(){var e,r;return(((e=this.layer)==null?void 0:e.opacity)??1)*(((r=this.parent)==null?void 0:r.fullOpacity)??1)}get suspended(){return!this.canResume()}get suspendInfo(){return this.getSuspendInfo()}get legendEnabled(){var e;return!this.suspended&&((e=this.layer)==null?void 0:e.legendEnabled)===!0}get updating(){var e;return!(!((e=this._updatingHandles)!=null&&e.updating)&&!this.isUpdating())}get updatingProgress(){return this.updating?0:1}get visible(){var e;return((e=this.layer)==null?void 0:e.visible)===!0}set visible(e){this._overrideIfSome("visible",e)}canResume(){var e,r,n;return this.visible&&((e=this.layer)==null?void 0:e.loaded)&&!((r=this.parent)!=null&&r.suspended)&&((n=this.view)==null?void 0:n.ready)||!1}getSuspendInfo(){var n,l;const e=(n=this.parent)!=null&&n.suspended?this.parent.suspendInfo:{};return(l=this.view)!=null&&l.ready||(e.viewNotReady=!0),this.layer&&this.layer.loaded||(e.layerNotLoaded=!0),this.visible||(e.layerInvisible=!0),e}isUpdating(){return!1}};i([s()],t.prototype,"fullOpacity",null),i([s()],t.prototype,"layer",void 0),i([s()],t.prototype,"parent",void 0),i([s({readOnly:!0})],t.prototype,"suspended",null),i([s({readOnly:!0})],t.prototype,"suspendInfo",null),i([s({readOnly:!0})],t.prototype,"legendEnabled",null),i([s({type:Boolean,readOnly:!0})],t.prototype,"updating",null),i([s({readOnly:!0})],t.prototype,"updatingProgress",null),i([s()],t.prototype,"visible",null),i([s()],t.prototype,"view",void 0),t=i([g("esri.views.layers.LayerView")],t);const c=t;export{c as u}; diff --git a/dist/assets/LayerView3D-57OghbRh.js b/dist/assets/LayerView3D-57OghbRh.js new file mode 100644 index 0000000..3f820f8 --- /dev/null +++ b/dist/assets/LayerView3D-57OghbRh.js @@ -0,0 +1 @@ +import{e as s,y as l,c as r,cM as c,a0 as h,aa as d,ab as p,cN as u}from"./index-pCX-0tJH.js";const m=o=>{let t=class extends o{constructor(){super(...arguments),this.slicePlaneEnabled=!1,this.supportsHeightUnitConversion=!1}postscript(e){super.postscript(e),c(this.layer)&&this.addResolvingPromise(this._validateHeightModelInfo())}async _validateHeightModelInfo(){const e=new AbortController,a=e.signal;this.addHandles(h(()=>e.abort())),await d(()=>{var n;return(n=this.view.defaultsFromMap)==null?void 0:n.heightModelInfoReady},a),p(a);const i=u(this.layer,this.view.heightModelInfo,this.supportsHeightUnitConversion);if(i)throw i}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return super.canResume()&&(!(e!=null&&e.minScale)||!e.maxScale||e.minScale>=e.maxScale)}getSuspendInfo(){const e=super.getSuspendInfo(),a=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return a&&a.minScale&&a.maxScale&&a.minScale{let t=class extends o{constructor(){super(...arguments),this.slicePlaneEnabled=!1,this.supportsHeightUnitConversion=!1}postscript(e){super.postscript(e),c(this.layer)&&this.addResolvingPromise(this._validateHeightModelInfo())}async _validateHeightModelInfo(){const e=new AbortController,s=e.signal;this.addHandles(h(()=>e.abort())),await d(()=>{var n;return(n=this.view.defaultsFromMap)==null?void 0:n.heightModelInfoReady},s),p(s);const i=u(this.layer,this.view.heightModelInfo,this.supportsHeightUnitConversion);if(i)throw i}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return super.canResume()&&(!(e!=null&&e.minScale)||!e.maxScale||e.minScale>=e.maxScale)}getSuspendInfo(){const e=super.getSuspendInfo(),s=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return s&&s.minScale&&s.maxScale&&s.minScalel.normalize(p(e),0,!0))],t.prototype,"orientation",void 0),t=i([u("esri.analysis.LengthDimension")],t);const h=t;export{c as r,r as t,h as u}; +import{iC as n,e as i,y as o,L as s,f1 as a,iD as l,iE as p,c as u,iF as y}from"./index-pCX-0tJH.js";var r;(function(e){e.Horizontal="horizontal",e.Vertical="vertical",e.Direct="direct"})(r||(r={}));const c=[r.Horizontal,r.Vertical,r.Direct];let t=class extends n(y){constructor(e){super(e),this.type="length",this.startPoint=null,this.endPoint=null,this.measureType=r.Direct,this.offset=0,this.orientation=0}};i([o({type:["length"],json:{write:{isRequired:!0}}})],t.prototype,"type",void 0),i([o({type:s,json:{write:!0}})],t.prototype,"startPoint",void 0),i([o({type:s,json:{write:!0}})],t.prototype,"endPoint",void 0),i([o({type:c,nonNullable:!0,json:{write:{isRequired:!0}}})],t.prototype,"measureType",void 0),i([o({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}})],t.prototype,"offset",void 0),i([o({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),a(e=>l.normalize(p(e),0,!0))],t.prototype,"orientation",void 0),t=i([u("esri.analysis.LengthDimension")],t);const h=t;export{c as r,r as t,h as u}; diff --git a/dist/assets/LercWorker-e_UqPfL3.js b/dist/assets/LercWorker-p4NiAClL.js similarity index 98% rename from dist/assets/LercWorker-e_UqPfL3.js rename to dist/assets/LercWorker-p4NiAClL.js index be87499..5adc894 100644 --- a/dist/assets/LercWorker-e_UqPfL3.js +++ b/dist/assets/LercWorker-p4NiAClL.js @@ -1 +1 @@ -import{gl as Y}from"./index-J0iiHjMT.js";var A={};A.defaultNoDataValue=Y(-1/0),A.decode=function(i,t){var r=(t=t||{}).encodedMaskData||t.encodedMaskData===null,e=E(i,t.inputOffset||0,r),c=t.noDataValue!=null?Y(t.noDataValue):A.defaultNoDataValue,n=F(e,t.pixelType||Float32Array,t.encodedMaskData,c,t.returnMask),s={width:e.width,height:e.height,pixelData:n.resultPixels,minValue:e.pixels.minValue,maxValue:e.pixels.maxValue,noDataValue:c};return n.resultMask&&(s.maskData=n.resultMask),t.returnEncodedMask&&e.mask&&(s.encodedMaskData=e.mask.bitset?e.mask.bitset:null),t.returnFileInfo&&(s.fileInfo=b(e,c),t.computeUsedBitDepths&&(s.fileInfo.bitDepths=D(e))),s};var F=function(i,t,r,e,c){var n,s,d=0,m=i.pixels.numBlocksX,x=i.pixels.numBlocksY,y=Math.floor(i.width/m),v=Math.floor(i.height/x),p=2*i.maxZError;r=r||(i.mask?i.mask.bitset:null),n=new t(i.width*i.height),c&&r&&(s=new Uint8Array(i.width*i.height));for(var g,k,h=new Float32Array(y*v),M=0;M<=x;M++){var B=M!==x?v:i.height%x;if(B!==0)for(var I=0;I<=m;I++){var o=I!==m?y:i.width%m;if(o!==0){var P,a,f,w,l=M*i.width*v+I*y,U=i.width-o,u=i.pixels.blocks[d];if(u.encoding<2?(u.encoding===0?P=u.rawData:(S(u.stuffedData,u.bitsPerPixel,u.numValidPixels,u.offset,p,h,i.pixels.maxValue),P=h),a=0):f=u.encoding===2?0:u.offset,r)for(k=0;k>3],w<<=7&l),g=0;g>3]),128&w?(s&&(s[l]=1),n[l++]=u.encoding<2?P[a++]:f):(s&&(s[l]=0),n[l++]=e),w<<=1;l+=U}else if(u.encoding<2)for(k=0;k0){var s=new Uint8Array(Math.ceil(e.width*e.height/8)),d=(n=new DataView(i,t,e.mask.numBytes)).getInt16(0,!0),m=2,x=0;do{if(d>0)for(;d--;)s[x++]=n.getUint8(m++);else{var y=n.getUint8(m++);for(d=-d;d--;)s[x++]=y}d=n.getInt16(m,!0),m+=2}while(m0?1:0),k=p+(e.height%p>0?1:0);e.pixels.blocks=new Array(g*k);for(var h=1e9,M=0,B=0;B3)throw"Invalid block encoding ("+a.encoding+")";if(a.encoding!==2){if(f!==0&&f!==2){if(f>>=6,a.offsetType=f,f===2)a.offset=n.getInt8(1),o++;else if(f===1)a.offset=n.getInt16(1,!0),o+=2;else{if(f!==0)throw"Invalid block offset type";a.offset=n.getFloat32(1,!0),o+=4}if(h=Math.min(a.offset,h),a.encoding===1)if(f=n.getUint8(o),o++,a.bitsPerPixel=63&f,f>>=6,a.numValidPixelsType=f,f===2)a.numValidPixels=n.getUint8(o),o++;else if(f===1)a.numValidPixels=n.getUint16(o,!0),o+=2;else{if(f!==0)throw"Invalid valid pixel count type";a.numValidPixels=n.getUint32(o,!0),o+=4}}var w;if(t+=o,a.encoding!=3){if(a.encoding===0){var l=(e.pixels.numBytes-1)/4;if(l!==Math.floor(l))throw"uncompressed block has invalid length";w=new ArrayBuffer(4*l),new Uint8Array(w).set(new Uint8Array(i,t,4*l));for(var U=new Float32Array(w),u=0;u=t)m=x>>>p-t&y,p-=t;else{var h=t-p;m=(x&y)<>>(p=32-h)}n[d]=m>3],w<<=7&l),g=0;g>3]),128&w?(s&&(s[l]=1),n[l++]=u.encoding<2?P[a++]:f):(s&&(s[l]=0),n[l++]=e),w<<=1;l+=U}else if(u.encoding<2)for(k=0;k0){var s=new Uint8Array(Math.ceil(e.width*e.height/8)),d=(n=new DataView(i,t,e.mask.numBytes)).getInt16(0,!0),m=2,x=0;do{if(d>0)for(;d--;)s[x++]=n.getUint8(m++);else{var y=n.getUint8(m++);for(d=-d;d--;)s[x++]=y}d=n.getInt16(m,!0),m+=2}while(m0?1:0),k=p+(e.height%p>0?1:0);e.pixels.blocks=new Array(g*k);for(var h=1e9,M=0,B=0;B3)throw"Invalid block encoding ("+a.encoding+")";if(a.encoding!==2){if(f!==0&&f!==2){if(f>>=6,a.offsetType=f,f===2)a.offset=n.getInt8(1),o++;else if(f===1)a.offset=n.getInt16(1,!0),o+=2;else{if(f!==0)throw"Invalid block offset type";a.offset=n.getFloat32(1,!0),o+=4}if(h=Math.min(a.offset,h),a.encoding===1)if(f=n.getUint8(o),o++,a.bitsPerPixel=63&f,f>>=6,a.numValidPixelsType=f,f===2)a.numValidPixels=n.getUint8(o),o++;else if(f===1)a.numValidPixels=n.getUint16(o,!0),o+=2;else{if(f!==0)throw"Invalid valid pixel count type";a.numValidPixels=n.getUint32(o,!0),o+=4}}var w;if(t+=o,a.encoding!=3){if(a.encoding===0){var l=(e.pixels.numBytes-1)/4;if(l!==Math.floor(l))throw"uncompressed block has invalid length";w=new ArrayBuffer(4*l),new Uint8Array(w).set(new Uint8Array(i,t,4*l));for(var U=new Float32Array(w),u=0;u=t)m=x>>>p-t&y,p-=t;else{var h=t-p;m=(x&y)<>>(p=32-h)}n[d]=me.maxDistance**2)return null;const o=this.view.renderCoordsHelper.fromRenderCoords(s,this.view.spatialReference),l=ue(n.normal);if(Ye(n))return new P({type:j.OBJECT,id:`${n.target.layerUid}/${n.target.nodeIndex}/${n.target.componentIndex}`,mapPoint:o,renderPoint:s,normal:l,ray:ie(t),graphic:null});if(Qe(n))return new P({type:j.TERRAIN,id:n.target.lij.slice(),mapPoint:o,renderPoint:s,normal:l,ray:ie(t),graphic:null});const d=Q(n,this.view);if(d!=null){const h=d.layer,c=d.sourceLayer;let u;return c&&c.type==="scene"?u=et(d,c.objectIdField):u=d.uid,new P({type:j.OBJECT,id:`${h==null?void 0:h.uid}/${u}`,mapPoint:o,renderPoint:s,normal:l,ray:ie(t),graphic:d})}return null}updateFromGroundIntersection(t,e,i){const n=Tt,s=It,o=Pt,l=Le;T(s,t),this.view.renderCoordsHelper.worldUpAtPosition(s,o),de(o,o);const d=this.view.basemapTerrain.visibleElevationBounds,h=(e>=0?1:-1)*((d?Math.abs(d.max-d.min):100)+Math.abs(e));z(l,o,h),F(n,s,l),ce(n,s,re);const c=this._getRayIntersection(re,{include:this._terrainIntersectionOptionsLayerUids,maxDistance:h});if(c!=null){const u=Le;return z(u,o,e),F(i,c.renderPoint,u),ue(c.normal)}return T(i,t),null}};a([r()],G.prototype,"view",void 0),a([r()],G.prototype,"intersector",void 0),G=a([D("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],G);const Tt=_(),It=_(),Pt=_(),Le=_(),re=$e(),Ge="esri.views.3d.analysis.LineOfSight.LineOfSightController",Ve=he.getLogger(Ge);let y=class extends Ae.EventedMixin(k){constructor(t){super(t),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode="absolute-height",this._observerFeatureId=null,this._updatingHandles=new ge,this._frameTask=ve,this._computationHandles=new te,this._externalObserverUpdate=!0}initialize(){var e;const t=(e=this.view.resourceController)==null?void 0:e.scheduler;this._frameTask=t?t.registerTask(W.LINE_OF_SIGHT_TOOL):ve,this._intersector=new G({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(t){this._frameTask.priority=t}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(t){this.analysisViewData.observerEngineLocation=t}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(t){const e=t.computation,{inputPoints:i,computationResult:n}=e,{observerAdjusted:s,targetAdjusted:o}=i,{start:l,end:d}=n;T(l,s),T(d,o),this._canCompute(e)?this._computeIntersection(t):this._interpolateIntersection(t),e.notifyResultChanged(),this.emit("result-changed",{target:t.computation.target,result:e.result})}_updateAdjustedPointsFromFeatures(t){const e=this.view,{sceneIntersectionHelper:i}=e,{inputPoints:n}=t,{observerAdjusted:s,observerFeatureId:o,targetFeatureId:l,targetAdjusted:d}=n;if(o==null&&l==null)return;const h=tt(s,d),c=this._intersector.intersector,u=ce(n.observer,n.target,Se);c.options.store=ee.ALL,i.intersectToolIntersectorRay(u,c);let g=null,p=null,C=null,b=null;for(const w of c.results.all){const m=Q(w,this.view);if(m==null||w.distanceInRenderSpace==null)continue;const L=ne(m);L!=null&&(o!=null&&L===o&&(g==null&&(g=this._getFeatureDistanceThreshold(w,e,h)),w.distanceInRenderSpace=I*x(h,c)}const L=new st(w,i.spatialReference);{const{result:I,target:R}=t;I!=null?(I.target=R,I.intersectedGraphic=m?null:Q(C,i),I.intersectedLocation=m?null:L,I.visible=m):t.result=new A({target:R,elevationAlignedTargetLocation:t.elevationAlignedTargetLocation,intersectedGraphic:m?null:Q(C,i),intersectedLocation:m?null:L,visible:m})}l.isValid=d.isValid=!0,l.isTargetVisible=m}_interpolateIntersection({computation:t,interpolationInfo:e}){const{computationResult:i,inputPoints:n}=t,{start:s,end:o,intersection:l}=i,{originalIntersection:d,originalObserver:h,originalTarget:c}=e;if(T(l,d),n.isValid){const u=K,g=x(h,d)/x(h,c);_e(u,s,h),z(u,u,1-g),F(l,l,u),_e(u,o,c),z(u,u,g),F(l,l,u),i.isValid=!0}else t.result=null,i.isValid=!1,i.isTargetVisible=!1}_canCompute(t){const e=this.analysisViewData.elevationAlignedObserver,i=this.view.frustum;if(e==null||t.elevationAlignedTargetLocation==null||i==null)return!1;const{observerAdjusted:n,targetAdjusted:s}=t.inputPoints,o=i.intersectsPoint(n),l=i.intersectsPoint(s);return o&&l}_onObserverPositionChange(t,e,i,n,s){if(this._externalObserverUpdate=s,t==null)return this.analysisViewData.elevationAlignedObserver=null,void(this._observerFeatureId=null);if(e==null)return Te(this.analysis,t.spatialReference,Ve),void(this.analysisViewData.elevationAlignedObserver=null);const o=this._getEffectiveElevationInfo(e,i),{absoluteZ:l,elevation:d}=me(e.x,e.y,e.z,this.view.spatialReference,this.view,o),h=e.clone();h.z=l,this._effectiveObserverElevationMode=o.mode,this.analysisViewData.elevationAlignedObserver=h;const c=_();this.view.renderCoordsHelper.toRenderCoords(h,c),this._elevationAlignedObserverPositionRenderSpace=c,this._observerGroundOffsetRenderSpace=l-d,this._observerFeatureId=ne(n),this.priority=W.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(t,e,i,n,s){const{inputPoints:o}=t;switch(T(o.observer,e),o.observerFeatureId=s,o.observerSurfaceNormal=null,n){case"on-the-ground":case"relative-to-ground":{const l=this._intersector.updateFromGroundIntersection(o.observer,i,o.observer);o.observerFeatureId==null&&(o.observerSurfaceNormal=l)}}this._adjustStartEndPositions(t),t.notifyInputPointsChanged(),this.priority=W.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(t,e,i,n,s,o=!0){const l=t.inputPoints;if(o&&(l.isValid=!1),i==null)return e!=null&&Te(this.analysis,e.spatialReference,Ve),t.elevationAlignedTargetLocation=null,void t.notifyInputPointsChanged();const d=this._getEffectiveElevationInfo(i,n),{absoluteZ:h,elevation:c}=me(i.x,i.y,i.z,this.view.spatialReference,this.view,d),u=i.clone();switch(u.z=h,t.elevationAlignedTargetLocation=u,this.view.renderCoordsHelper.toRenderCoords(t.elevationAlignedTargetLocation,l.target),l.targetFeatureId=ne(s),l.targetSurfaceNormal=null,d.mode){case"on-the-ground":case"relative-to-ground":{const g=this._intersector.updateFromGroundIntersection(l.target,h-c,l.target);l.targetFeatureId==null&&(l.targetSurfaceNormal=g)}}this._adjustStartEndPositions(t),t.notifyInputPointsChanged(),this.priority=W.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(t){return J([this._updatingHandles.add(()=>({computation:t,targetPosition:t.target.position,targetElevationInfo:t.target.elevationInfo,targetFeatureInfo:t.target.feature,projectedTargetPosition:Z(t.target.position,this.view.spatialReference)}),({computation:e,targetPosition:i,targetElevationInfo:n,targetFeatureInfo:s,projectedTargetPosition:o})=>{o.pending==null?this._onTargetPositionChange(e,i,o.geometry,n,s):this._updatingHandles.addPromise(o.pending)},S)])}_connectComputationToObserver(t){return this._updatingHandles.add(()=>({computation:t,observer:this.analysisViewData.elevationAlignedObserver}),({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())},S)}_connectComputationToRenderSpaceObserver(t){return this._updatingHandles.add(()=>({computation:t,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId}),({computation:e,observer:i,observerGroundOffset:n,observerElevationMode:s,observerFeatureId:o})=>{this._onObserverRenderSpacePositionChangeForComputation(e,i,n,s,o)},S)}_connectComputationToCamera(t){return this._updatingHandles.add(()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty}),({isDirty:e})=>{!this.updateOnCameraChange||t.inputPoints.isValid&&!e||t.notifyInputPointsChanged()})}_connectComputationToSlicePlane(t){return this._updatingHandles.add(()=>this.view.slicePlane,()=>{t.inputPoints.isValid=!1,t.notifyInputPointsChanged()})}_connectComputationToElevation(t){const e=(i,n)=>{const s=this.analysis.observer,o=t.target;let l=null,d=null,h=null,c=null,u=null,g=null;if((s==null?void 0:s.position)!=null){const p=Z(s.position,this.view.spatialReference);if(p.pending!=null)return this._updatingHandles.addPromise(p.pending),void p.pending.finally(()=>e(i,n));l=p.geometry,d=s.elevationInfo,h=s.feature}if(o.position!=null){const p=Z(o.position,this.view.spatialReference);if(p.pending!=null)return this._updatingHandles.addPromise(p.pending),void p.pending.finally(()=>e(i,n));c=p.geometry,u=o.elevationInfo,g=o.feature}l==null&&c==null||(lt(i,n,X,this.view.spatialReference),l!=null&&be(X,l)&&this._onObserverPositionChange(s!=null?s.position:null,l,d,h,!1),c!=null&&be(X,c)&&this._onTargetPositionChange(t,o.position,c,u,g,!1),l!=null&&c!=null&&ut(X,l,c)&&t.notifyInputPointsChanged())};return this.view.elevationProvider.on("elevation-change",i=>e(i.extent,i.spatialReference))}_connectComputationToTask(t){let e=null;const i={computation:t,interpolationInfo:{originalIntersection:_(),originalObserver:_(),originalTarget:_()}};return J([this._updatingHandles.add(()=>t.inputPoints,()=>{e=ye(e),e=at(async n=>{await ot(this._frameTask.schedule(()=>this._computeResult(i),n))})},{initial:!0,equals:()=>!1}),He(()=>e=ye(e))])}_connectComputation(t){const e=this._computationHandles;e.has(t)||e.add([this._connectComputationToTarget(t),this._connectComputationToObserver(t),this._connectComputationToRenderSpaceObserver(t),this._connectComputationToCamera(t),this._connectComputationToSlicePlane(t),this._connectComputationToElevation(t),this._connectComputationToTask(t)],t)}_disconnectComputation(t){this._computationHandles.remove(t)}_onComputationCollectionChange({added:t,removed:e}){for(const i of e)this._disconnectComputation(i);for(const i of t)this._connectComputation(i)}_onTargetCollectionChange({added:t,removed:e}){for(const i of e)this._removeTarget(i);for(const i of t)this._addTarget(i)}_onCursorTargetChange(t,e){e!=null&&this._removeTarget(e),t!=null&&this._addTarget(t)}_addTarget(t){this._computations.some(e=>e.target===t)||this._computations.add(new H({target:t}))}_removeTarget(t){const e=this._computations.findIndex(i=>i.target===t);this._computations.removeAt(e)}_connectObserver(){return J([this._updatingHandles.add(()=>({observerPosition:this.analysis.observer!=null?this.analysis.observer.position:null,projectedObserverPosition:Z(this.analysis.observer!=null?this.analysis.observer.position:null,this.view.spatialReference),observerElevationInfo:this.analysis.observer!=null?this.analysis.observer.elevationInfo:null,observerFeatureInfo:this.analysis.observer!=null?this.analysis.observer.feature:null}),({observerPosition:t,projectedObserverPosition:e,observerElevationInfo:i,observerFeatureInfo:n})=>{e.pending==null?this._onObserverPositionChange(t,e.geometry,i,n,!0):this._updatingHandles.addPromise(e.pending)},S)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this._computations,t=>this._onComputationCollectionChange(t),{initial:!0,final:!0})}_connectTargets(){return J([this._updatingHandles.addOnCollectionChange(()=>this.analysis.targets,t=>this._onTargetCollectionChange(t),{initial:!0,final:!0}),this._updatingHandles.add(()=>this.analysisViewData.cursorTarget,(t,e)=>{this._onCursorTargetChange(t,e)})])}get _isCameraDirty(){const t=this.analysisViewData.elevationAlignedObserver,{view:e}=this,{renderCoordsHelper:i}=e;if(t==null||i==null)return!1;const n=K;i.toRenderCoords(t,n);const s=e.state.camera.computeScreenPixelSizeAt(n);return Math.abs((s-this._screenPixelSize)/this._screenPixelSize)>Lt}_getEffectiveElevationInfo(t,e){return t.hasZ?e??{mode:"absolute-height",offset:0}:{mode:"on-the-ground",offset:0}}};a([r({constructOnly:!0})],y.prototype,"analysis",void 0),a([r({constructOnly:!0})],y.prototype,"analysisViewData",void 0),a([r({constructOnly:!0})],y.prototype,"view",void 0),a([r()],y.prototype,"updating",null),a([r()],y.prototype,"priority",null),a([r()],y.prototype,"updateOnCameraChange",void 0),a([r()],y.prototype,"_computations",null),a([r()],y.prototype,"_elevationAlignedObserverPositionRenderSpace",null),a([r()],y.prototype,"_observerGroundOffsetRenderSpace",void 0),a([r()],y.prototype,"_effectiveObserverElevationMode",void 0),a([r()],y.prototype,"_observerFeatureId",void 0),a([r()],y.prototype,"_screenPixelSize",null),a([r({readOnly:!0})],y.prototype,"_updatingHandles",void 0),a([r()],y.prototype,"_frameTask",void 0),a([r()],y.prototype,"_isCameraDirty",null),y=a([D(Ge)],y);const Lt=.1,K=_(),Se=$e(),X=rt(),Vt=.05;let St=class{constructor(){this.glowWidth=8,this.innerWidth=.75}};const Rt=new St;function Et(t){const e=t.accentColor;return{glowColor:e,innerColor:dt(e),globalAlpha:.75*e.a}}class $t{constructor(){this.size=.5}}const At=new $t;function Re(t){return ct(t.accentColor,.75)}class Ht{constructor(){this.size=.5,this.visibleColor=new v([3,252,111,.75]),this.occludedColor=new v([252,3,69,.75]),this.undefinedColor=new v([127,127,127,.75])}}const Dt=new Ht;let Mt=class{constructor(){this.innerWidth=2,this.outerWidth=8,this.visibleInnerColor=new v([3,252,111,1]),this.visibleOuterColor=new v([3,252,111,.15]),this.occludedInnerColor=new v([252,3,69,1]),this.occludedOuterColor=new v([252,3,69,.1]),this.undefinedInnerColor=new v([255,255,255,1]),this.undefinedOuterColor=new v([127,127,127,.2])}};const Y=new Mt;class kt extends ke{constructor(e,i){const n=xe(Re(e.effectiveTheme)),s=De(n,At.size,32,32),o=new ze(s);super({view:e,renderObjects:[o],metadata:i,elevationInfo:{mode:"absolute-height",offset:0}}),Fe(this),this.themeHandle=Me(()=>({color:Re(e.effectiveTheme)}),l=>{n.setParameters(l)})}destroy(){this.themeHandle.remove(),super.destroy()}}let xt=class extends ke{constructor(e,i){const{size:n,visibleColor:s,occludedColor:o,undefinedColor:l}=Dt;super({view:e,renderObjects:[le(n,s,U.Custom1),le(n,o,U.Custom2),le(n,l,U.Custom3)],metadata:i,elevationInfo:{mode:"absolute-height",offset:0}}),Fe(this)}};function le(t,e,i){return new ze(De(xe(v.toUnitRGBA(e)),t,32,32),i)}var M;(function(t){t.Ready="ready",t.Creating="creating",t.Created="created"})(M||(M={}));let O=class extends Ct{constructor(e){super(e),this.removeIncompleteOnCancel=!1,this.analysisViewData=null,this._latestPointerMovePointerType=null,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new te,this._updatingHandles=new ge,this._manipulatorHandles=new te,this._targetTrackerManipulator=null}initialize(){this._intersector=new G({view:this.view}),this.addHandles(Me(()=>this.state,e=>{e===M.Created&&this.finishToolCreation()},pt)),this._observerManipulator=this._createObserverManipulator(),this._createLaserLine(),this.addHandles([this._updatingHandles.add(()=>{var e;return(e=this.analysisViewData)==null?void 0:e.elevationAlignedObserver},e=>this._onObserverLocationChange(e),S),this._updatingHandles.add(()=>Et(this.view.effectiveTheme),({glowColor:e,innerColor:i,globalAlpha:n})=>this._updateLaserLineStyle(e,i,n),S),this._updatingHandles.add(()=>this._laserLineRendererDependencies(),e=>this._updateLaserLineRenderer(e)),this._connectComputations(),this._updatingHandles.addWhen(()=>!this._shouldRenderTracker,()=>this._clearCursorTracker(),S)])}destroy(){this._updatingHandles=E(this._updatingHandles),this._manipulatorHandles=E(this._manipulatorHandles),this._analysisHandles=E(this._analysisHandles),this._observerManipulator=null,this._clearCursorTracker(),this._removeLaserLine(),this._intersector=null,this._set("analysis",null)}get state(){var e;return this.active?this.hasGrabbedManipulators?M.Created:M.Creating:((e=this.analysis.observer)==null?void 0:e.position)!=null?M.Created:M.Ready}get cursor(){return this.active&&this._showTracker?"crosshair":null}get updating(){return this.analysisViewData!=null&&this.analysisViewData.updating||this._updatingHandles.updating}get _showTracker(){return this.active&&this._latestPointerMovePointerType==="mouse"}get _shouldRenderTracker(){var e;return this._showTracker&&((e=this.analysis.observer)==null?void 0:e.position)!=null&&!this.hasGrabbedManipulators}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"key-down":this._keyDownHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){e.type==="immediate-click"&&this._clickHandler(e)}onShow(){}onHide(){}onDeactivate(){this._clearCursorTracker()}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,e=>this._onComputationsCollectionChange(e),{initial:!0,final:!0})}_onComputationsCollectionChange({added:e,removed:i}){for(const n of i)this._disconnectComputation(n);for(const n of e)this._connectComputation(n)}_connectComputation(e){if(this.destroyed)return void he.getLogger(this).warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const i=this._analysisHandles;if(i.has(e))return;const n=this._createTargetManipulator(e.target);this._targetTrackerManipulator==null&&n.metadata.target===this.analysisViewData.cursorTarget&&(this._targetTrackerManipulator=n,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),i.add([this._updatingHandles.add(()=>this._getLineOfSightManipulatorStateDependencies(e),()=>this._updateManipulatorState(n,e),S),this._updatingHandles.add(()=>e.elevationAlignedTargetLocation,s=>this._onTargetLocationChange(s,n),S)],e)}_disconnectComputation(e){if(this.destroyed)return void he.getLogger(this).warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const i=this._getTargetManipulator(e.target);i!=null&&(this.manipulators.remove(i),this._manipulatorHandles.remove(i),this._targetTrackerManipulator!=null&&this._targetTrackerManipulator===i&&(this._targetTrackerManipulator=null))}_clearCursorTracker(){this.analysisViewData.cursorTarget=E(this.analysisViewData.cursorTarget)}_createTargetManipulator(e){const i={target:e,type:"target"},n=new xt(this.view,i);return this._manipulatorHandles.add([this._createTargetManipulatorDragPipeline(n),n.events.on("grab-changed",s=>this._manipulatorGrabChanged(n,s)),n.events.on("immediate-click",s=>this._manipulatorClick(n,s))],n),this.manipulators.add(n),e.position!=null?n.elevationAlignedLocation=e.position:n.available=!1,n}_getTargetManipulator(e){let i=null;return this.manipulators.forEach(n=>{const s=n.manipulator;i==null&&s.metadata.type==="target"&&s.metadata.target===e&&(i=s)}),i}_createObserverManipulator(){const e=new kt(this.view,{type:"observer",intersection:null});return this._manipulatorHandles.add([this._createObserverManipulatorDragPipeline(e),e.events.on("grab-changed",i=>this._manipulatorGrabChanged(e,i)),e.events.on("immediate-click",i=>this._manipulatorClick(e,i))],e),this.manipulators.add(e),e}_screenToIntersection(){return e=>{const i=this._intersector.getScreenPointIntersection(e.screenEnd);return i==null?null:{...e,intersection:i}}}_createTargetManipulatorDragPipeline(e){return Ie(e,(i,n,s)=>{n.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next(()=>this._updateLaserLineRenderer()),s.next(this._cancelTargetDragStep(e.metadata.target)).next(()=>this._updateLaserLineRenderer())})}_createObserverManipulatorDragPipeline(e){return Ie(e,(i,n,s)=>{n.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next(()=>this._updateLaserLineRenderer()),s.next(this._cancelObserverDragStep()).next(()=>this._updateLaserLineRenderer())})}_updateObserverDragStep(){return e=>(e.intersection.mapPoint!=null?(this.analysis.observer==null&&(this.analysis.observer=new fe),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){var i;const e=((i=this.analysis.observer)==null?void 0:i.position)!=null?this.analysis.observer.clone():null;return n=>(this.analysis.observer=e,n)}_updateTargetDragStep(e){return i=>{this._updateFromIntersection(e.metadata.target,i.intersection);const n=i.intersection.mapPoint;return n!=null&&(e.elevationAlignedLocation=n),i}}_cancelTargetDragStep(e){var n;const i=(n=e.position)==null?void 0:n.clone();return s=>(e.position=i,s)}_manipulatorGrabChanged(e,i){switch(i.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}}_updateManipulatorState(e,i){const{isValid:n,isTargetVisible:s}=i.computationResult;e.state=n?s?U.Custom1:U.Custom2:U.Custom3}_getLineOfSightManipulatorStateDependencies(e){const{isValid:i,isTargetVisible:n}=e.computationResult;return{isValid:i,isTargetVisible:n}}_laserLineRendererDependencies(){return{laserlineVisualElement:this._laserlineVisualElement,grabbedManipulator:this._grabbedManipulator,shouldRenderTracker:this._shouldRenderTracker,observerPosition:this.analysis.observer!=null?this.analysis.observer.position:null,visible:this.visible}}_updateLaserLineRenderer(e=this._laserLineRendererDependencies()){const{laserlineVisualElement:i,grabbedManipulator:n,shouldRenderTracker:s,observerPosition:o,visible:l}=e;if(i==null)return;const d=n??(s&&o!=null?this._targetTrackerManipulator:null);d!=null&&l?(i.visible=!0,i.heightManifoldTarget=d.renderLocation,d!==this._observerManipulator?i.lineVerticalPlaneSegment=gt(this._observerManipulator.renderLocation,d.renderLocation,zt):i.lineVerticalPlaneSegment=null):(i.visible=!1,i.heightManifoldTarget=null,i.lineVerticalPlaneSegment=null)}_createLaserLine(){this._removeLaserLine();const{glowWidth:e,innerWidth:i}=Rt;this._laserlineVisualElement=new ft({view:this.view,attached:!0,visible:this.visible,style:{glowWidth:e,innerWidth:i},isDecoration:!0})}_removeLaserLine(){this._laserlineVisualElement!=null&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_updateLaserLineStyle(e,i,n){const s=this._laserlineVisualElement;if(s==null)return;const o=s.style;s.style={...o,glowColor:v.toUnitRGB(e),innerColor:v.toUnitRGB(i),globalAlpha:n}}_onObserverLocationChange(e){e!=null?(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e):this._observerManipulator.available=!1}_onTargetLocationChange(e,i){e!=null?(i.elevationAlignedLocation=e,i!==this._targetTrackerManipulator&&(i.available=!0)):i.available=!1}_addPointFromClickEvent(e){var n;const i=this._intersector.getScreenPointIntersection(e);if((i==null?void 0:i.mapPoint)!=null)if(((n=this.analysis.observer)==null?void 0:n.position)!=null){this._clearCursorTracker();const s=new Ce;this._updateFromIntersection(s,i),this.analysis.targets.add(s)}else{const s=new fe;this._updateFromIntersection(s,i),this.analysis.observer=s}}_clickHandler(e){this.active&&e.button!==se.Right&&(this._addPointFromClickEvent(we(e)),e.stopPropagation())}_doubleClickHandler(e){this.active&&e.button!==se.Right&&(this.stop(),e.stopPropagation())}_keyDownHandler(e){this.active&&e.key==="Escape"&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){var s;if(this.hasGrabbedManipulators||(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||((s=this.analysis.observer)==null?void 0:s.position)==null))return;const i=we(e),n=this._intersector.getScreenPointIntersection(i);(n==null?void 0:n.mapPoint)!=null&&(this.analysisViewData.cursorTarget==null&&(this.analysisViewData.cursorTarget=new Ce),this._updateFromIntersection(this.analysisViewData.cursorTarget,n),this._updateLaserLineRenderer())}_updateFromIntersection(e,i){if(i.mapPoint==null)return e.position=null,e.elevationInfo=null,void(e.feature=null);switch(i.type){case j.OBJECT:if(i.graphic!=null){const s=i.graphic,o=vt(s);o.mode==="on-the-ground"&&(o.mode="relative-to-ground",o.offset=0),e.elevationInfo=new Oe(o),e.feature=s}else e.elevationInfo=null,e.feature=null;break;case j.TERRAIN:case j.I3S:e.elevationInfo=new Oe({mode:"on-the-ground"}),e.feature=null;break;default:e.elevationInfo=null,e.feature=null}const n=i.mapPoint.clone();n.z=_t(this.view,n,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=n}_manipulatorClick(e,i){if(e.metadata.type==="observer"||e.grabbing||e.dragging||i.button!==se.Right||this.analysis.targets.length<=1)return;const{target:n}=e.metadata;this.analysis.targets.remove(n),i.stopPropagation()}get testInfo(){return{laserLineVisualElement:this._laserlineVisualElement,getTargetManipulator:e=>this._getTargetManipulator(e)}}};a([r({constructOnly:!0})],O.prototype,"view",void 0),a([r({constructOnly:!0})],O.prototype,"analysis",void 0),a([r({readOnly:!0})],O.prototype,"state",null),a([r({readOnly:!0})],O.prototype,"cursor",null),a([r()],O.prototype,"removeIncompleteOnCancel",void 0),a([r({readOnly:!0})],O.prototype,"updating",null),a([r({constructOnly:!0})],O.prototype,"analysisViewData",void 0),a([r({readOnly:!0})],O.prototype,"_showTracker",null),a([r()],O.prototype,"_latestPointerMovePointerType",void 0),a([r()],O.prototype,"_shouldRenderTracker",null),a([r()],O.prototype,"_laserlineVisualElement",void 0),a([r()],O.prototype,"_grabbedManipulator",void 0),O=a([D("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool")],O);const zt=ht();class Ft{constructor(e,i,n,s){this.visibleLineVisualElement=e,this.occludedLineVisualElement=i,this.undefinedLineVisualElement=n,this.targetVisualElement=s}destroy(){this.visibleLineVisualElement.destroy(),this.occludedLineVisualElement.destroy(),this.undefinedLineVisualElement.destroy(),this.targetVisualElement.destroy()}}let V=class extends k{constructor(t){super(t),this._lineOfSightVisualElements=new Array,this._computationHandles=new te,this._updatingHandles=new ge}initialize(){this.addHandles(this._connectComputations()),this._createObserverVisualization()}destroy(){this._updatingHandles=E(this._updatingHandles),this._computationHandles=E(this._computationHandles),this._observerVisualElement=E(this._observerVisualElement)}get visible(){return this.analysisViewData.visible}get updating(){return this._updatingHandles.updating}get interactiveAndEditable(){return this.analysisViewData.interactive&&this.analysisViewData.editable}get test(){return{disablePartialOcclusion:()=>{for(const t of this._lineOfSightVisualElements)t.visibleLineVisualElement.renderOccluded=ae.Occlude,t.occludedLineVisualElement.renderOccluded=ae.Occlude,t.undefinedLineVisualElement.renderOccluded=ae.Occlude},visualizations:this._lineOfSightVisualElements}}_createLineOfSightVisualization(){const t=Y,e=this.view,i=this.isDecoration,n={view:e,attached:!0,width:t.outerWidth,innerWidth:t.innerWidth,isDecoration:i},s=v.toUnitRGBA(t.visibleOuterColor),o=v.toUnitRGBA(t.visibleInnerColor),l=v.toUnitRGBA(t.occludedOuterColor),d=v.toUnitRGBA(t.occludedInnerColor),h=v.toUnitRGBA(t.undefinedOuterColor),c=v.toUnitRGBA(t.undefinedInnerColor),u=new oe({...n,color:s,innerColor:o}),g=new oe({...n,color:l,innerColor:d}),p=new oe({...n,color:h,innerColor:c}),C=new Pe({view:e,attached:!0,...Ee,size:8,isDecoration:i}),b=new Ft(u,g,p,C);return this._lineOfSightVisualElements.push(b),b}_destroyLineOfSightVisualization(t){t.destroy(),this._lineOfSightVisualElements.splice(this._lineOfSightVisualElements.indexOf(t),1)}_updateLineOfSightVisualization(t,e,i){const n=Y,{computationResult:s,inputPoints:o}=t,{start:l,end:d,intersection:h,isValid:c,isTargetVisible:u}=s,{observer:g}=o,p=Nt;p[12]=g[0],p[13]=g[1],p[14]=g[2];const C=B(Gt,l,g),b=B(jt,d,g),w=B(Ut,h,g),{visibleLineVisualElement:m,occludedLineVisualElement:L,undefinedLineVisualElement:I,targetVisualElement:R}=e,je=this.analysisViewData.elevationAlignedObserver==null||t.elevationAlignedTargetLocation==null,N=this.visible&&!je;m.visible=N,L.visible=N,I.visible=N,R.visible=N,R.attached=!i.interactiveAndEditable,N&&(m.geometry=null,L.geometry=null,I.geometry=null,R.geometry=t.elevationAlignedTargetLocation,c?u?(m.geometry=[[$(C),$(b)]],m.transform=p,m.color=v.toUnitRGBA(n.visibleOuterColor),R.color=v.toUnitRGBA(n.visibleInnerColor)):(m.geometry=[[$(C),$(w)]],m.transform=p,m.color=v.toUnitRGBA(n.occludedOuterColor),L.geometry=[[$(w),$(b)]],L.transform=p,R.color=v.toUnitRGBA(n.occludedInnerColor)):(I.geometry=[[$(C),$(b)]],I.transform=p,R.color=v.toUnitRGBA(n.undefinedInnerColor)))}_getLineOfSightVisualizationDependencies(t){const{computationResult:e}=t,{occludedOuterColor:i,visibleOuterColor:n}=Y;return{computationResult:e,occludedOuterColor:i,visibleOuterColor:n,visible:this.visible,interactiveAndEditable:this.interactiveAndEditable}}_connectComputation(t){const e=this._computationHandles;if(e.has(t))return;const i=this._createLineOfSightVisualization();e.add([this._updatingHandles.add(()=>this._getLineOfSightVisualizationDependencies(t),n=>this._updateLineOfSightVisualization(t,i,n),{initial:!0,equals:()=>!1}),He(()=>this._destroyLineOfSightVisualization(i))],t)}_disconnectComputation(t){this._computationHandles.remove(t)}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,t=>this._onComputationsCollectionChange(t),{initial:!0,final:!0})}_onComputationsCollectionChange({added:t,removed:e}){for(const i of e)this._disconnectComputation(i);for(const i of t)this._connectComputation(i)}_createObserverVisualization(){const t=v.toUnitRGBA(Y.visibleInnerColor),e=new Pe({view:this.view,color:t,...Ee,isDecoration:this.isDecoration});this._observerVisualElement=e,this.addHandles(this._updatingHandles.add(()=>({observer:this.analysisViewData.elevationAlignedObserver,interactiveAndEditable:this.interactiveAndEditable,visible:this.visible}),({observer:i,interactiveAndEditable:n,visible:s})=>{i!=null&&!n&&s?(e.geometry=i,this._observerVisualElement.attached=!0):e.attached=!1},S))}};a([r({constructOnly:!0})],V.prototype,"analysis",void 0),a([r({constructOnly:!0})],V.prototype,"analysisViewData",void 0),a([r({constructOnly:!0})],V.prototype,"view",void 0),a([r({readOnly:!0})],V.prototype,"visible",null),a([r({constructOnly:!0})],V.prototype,"isDecoration",void 0),a([r()],V.prototype,"updating",null),a([r()],V.prototype,"interactiveAndEditable",null),a([r()],V.prototype,"test",null),V=a([D("esri.views.3d.analysis.LineOfSight.LineOfSightVisualization")],V);const Ee={size:6,pixelSnappingEnabled:!1,primitive:"circle",elevationInfo:{mode:"absolute-height",offset:0},outlineSize:0},Gt=_(),jt=_(),Ut=_(),Nt=mt();let f=class extends bt(Ae.EventedMixin(k)){constructor(t){super(t),this.type="line-of-sight-view-3d",this.analysis=null,this.tool=null,this.computations=new yt,this.elevationAlignedObserver=null,this.observerEngineLocation=_(),this.cursorTarget=null,this.editable=!0}initialize(){const t=this.view,e=this.analysis;this._analysisController=new y({analysis:e,analysisViewData:this,view:t}),this._analysisVisualization=new V({analysis:e,analysisViewData:this,view:t,isDecoration:!this.parent}),this.addHandles([this._analysisController.on("result-changed",i=>{i.target!==this.cursorTarget&&this.emit("result-changed",i)}),wt(this,O)])}destroy(){Ot(this),this._analysisController=E(this._analysisController),this._analysisVisualization=E(this._analysisVisualization)}get results(){return this.computations.map(t=>t.result)}get priority(){return this._analysisController.priority}set priority(t){this._analysisController.priority=t}get updating(){return this._analysisController!=null&&this._analysisController.updating||this._analysisVisualization!=null&&this._analysisVisualization.updating}getResultForTarget(t){var e;return(e=this.computations.find(i=>i.target===t))==null?void 0:e.result}get testInfo(){return{visualization:this._analysisVisualization,controller:this._analysisController}}};a([r({readOnly:!0})],f.prototype,"type",void 0),a([r({constructOnly:!0,nonNullable:!0})],f.prototype,"analysis",void 0),a([r()],f.prototype,"tool",void 0),a([r({readOnly:!0})],f.prototype,"results",null),a([r()],f.prototype,"priority",null),a([r()],f.prototype,"computations",void 0),a([r()],f.prototype,"elevationAlignedObserver",void 0),a([r()],f.prototype,"observerEngineLocation",void 0),a([r()],f.prototype,"cursorTarget",void 0),a([r()],f.prototype,"updating",null),a([r()],f.prototype,"editable",void 0),a([r()],f.prototype,"_analysisController",void 0),a([r()],f.prototype,"_analysisVisualization",void 0),f=a([D("esri.views.3d.analysis.LineOfSightAnalysisView3D")],f);const di=f;export{di as default}; diff --git a/dist/assets/LineOfSightAnalysisView3D-oCrG9jF8.js b/dist/assets/LineOfSightAnalysisView3D-oCrG9jF8.js new file mode 100644 index 0000000..54b34e9 --- /dev/null +++ b/dist/assets/LineOfSightAnalysisView3D-oCrG9jF8.js @@ -0,0 +1 @@ +import{e as a,y as r,c as D,g as k,a8 as _,ah as B,kq as ue,nD as Ne,q5 as qe,fj as Ue,q6 as Be,b0 as $e,cb as We,cc as ee,bY as Je,b_ as Ze,b$ as Ke,d3 as Qe,q7 as Ye,ce as j,q8 as ie,q9 as Xe,qa as X,qb as et,b3 as T,bL as de,ca as F,bO as z,b5 as ce,R as he,z as Ae,h as ge,bo as ve,kv as te,bn as W,by as tt,qc as ne,qd as it,qe as nt,b4 as U,qf as x,L as st,qg as _e,qh as me,fq as J,eu as Z,P as S,I as ye,N as at,br as ot,a0 as He,ed as rt,qi as lt,qj as be,qk as ut,W as v,kL as dt,nF as ct,hZ as De,B as Me,ql as N,a$ as ht,T as pt,b as E,e9 as fe,bc as gt,e6 as Ce,qm as se,kH as we,hA as Oe,bl as vt,nE as _t,b2 as ae,qn as $,bT as mt,V as yt}from"./index-pCX-0tJH.js";import{s as bt}from"./AnalysisView3D-XCzG0Hzh.js";import{t as Te,u as oe}from"./LineVisualElement-iKo1s90I.js";import{$ as ke,w as xe,e as Fe}from"./ShadedColorMaterial.glsl-L0JVQzbX.js";import{t as ze}from"./manipulatorUtils-165rCtzd.js";import{c as ft}from"./Laserlines.glsl-U7nZFq0e.js";import{a as Ct}from"./AnalysisToolBase-olyQy6lh.js";import{d as Ie}from"./InteractiveToolBase-6mltmL27.js";import{x as Pe}from"./PointVisualElement-m9C0-AJh.js";import{a as wt,v as Ot}from"./analysisViewUtils-lJExoyyw.js";import"./Object3DVisualElement-8HoU366x.js";import"./VisualElement--2Scr6Yq.js";import"./drawUtils-0wb2c6-q.js";let A=class extends k{constructor(e){super(e),this.target=null,this.intersectedGraphic=null,this.intersectedLocation=null,this.elevationAlignedTargetLocation=null,this.visible=void 0}};a([r()],A.prototype,"target",void 0),a([r()],A.prototype,"intersectedGraphic",void 0),a([r()],A.prototype,"intersectedLocation",void 0),a([r()],A.prototype,"elevationAlignedTargetLocation",void 0),a([r({type:Boolean})],A.prototype,"visible",void 0),A=a([D("esri.views.3d.analysis.LineOfSightAnalysisResult")],A);let H=class extends k{constructor(e){super(e),this.elevationAlignedTargetLocation=null,this.inputPoints={isValid:!1,observer:_(),observerSurfaceNormal:null,observerFeatureId:null,target:_(),targetSurfaceNormal:null,targetFeatureId:null,observerAdjusted:_(),targetAdjusted:_()},this.computationResult={start:_(),end:_(),intersection:_(),isValid:!1,isTargetVisible:!1},this.result=null}notifyResultChanged(){this.notifyChange("computationResult")}notifyInputPointsChanged(){this.notifyChange("inputPoints")}};a([r()],H.prototype,"target",void 0),a([r()],H.prototype,"elevationAlignedTargetLocation",void 0),a([r()],H.prototype,"inputPoints",void 0),a([r()],H.prototype,"computationResult",void 0),a([r()],H.prototype,"result",void 0),H=a([D("esri.views.3d.analysis.LineOfSight.LineOfSightComputation")],H);var pe;let P=pe=class extends k{constructor(t){super(t)}clone(){return new pe({type:this.type,id:B(this.id),mapPoint:B(this.mapPoint),renderPoint:ue(this.renderPoint),normal:B(this.normal),ray:B(this.ray),graphic:this.graphic})}equals(t){return this.type===t.type&&this.id===t.id&&Ne(this.mapPoint,t.mapPoint)&&qe(this.renderPoint,t.renderPoint)&&Ue(this.normal,t.normal)&&Be(this.ray,t.ray)&&this.graphic===t.graphic}};a([r()],P.prototype,"type",void 0),a([r({constructOnly:!0})],P.prototype,"id",void 0),a([r({constructOnly:!0})],P.prototype,"mapPoint",void 0),a([r({constructOnly:!0})],P.prototype,"renderPoint",void 0),a([r({constructOnly:!0})],P.prototype,"normal",void 0),a([r({constructOnly:!0})],P.prototype,"graphic",void 0),a([r({constructOnly:!0})],P.prototype,"ray",void 0),P=pe=a([D("esri.views.3d.analysis.LineOfSight.LineOfSightIntersectionResult")],P);let G=class extends k{constructor(t){super(t),this._terrainIntersectionOptionsLayerUids=new Set(["terrain"])}initialize(){this.intersector=We(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=ee.MIN}getScreenPointIntersection(t){const e=Je(t,Ze.get()),i=Ke(this.view.state.camera,e,re);return this._getRayIntersection(i)}_getRayIntersection(t,e){if(t==null||this.view.sceneIntersectionHelper==null)return null;const{intersector:i}=this;i.options.store=ee.MIN,this.view.sceneIntersectionHelper.intersectToolIntersectorRay(t,i,e);const n=i.results.min,s=_();if(!n.getIntersectionPoint(s)||(e==null?void 0:e.maxDistance)!=null&&Qe(s,t.origin)>e.maxDistance**2)return null;const o=this.view.renderCoordsHelper.fromRenderCoords(s,this.view.spatialReference),l=ue(n.normal);if(Ye(n))return new P({type:j.OBJECT,id:`${n.target.layerUid}/${n.target.nodeIndex}/${n.target.componentIndex}`,mapPoint:o,renderPoint:s,normal:l,ray:ie(t),graphic:null});if(Xe(n))return new P({type:j.TERRAIN,id:n.target.lij.slice(),mapPoint:o,renderPoint:s,normal:l,ray:ie(t),graphic:null});const d=X(n,this.view);if(d!=null){const h=d.layer,c=d.sourceLayer;let u;return c&&c.type==="scene"?u=et(d,c.objectIdField):u=d.uid,new P({type:j.OBJECT,id:`${h==null?void 0:h.uid}/${u}`,mapPoint:o,renderPoint:s,normal:l,ray:ie(t),graphic:d})}return null}updateFromGroundIntersection(t,e,i){const n=Tt,s=It,o=Pt,l=Le;T(s,t),this.view.renderCoordsHelper.worldUpAtPosition(s,o),de(o,o);const d=this.view.basemapTerrain.visibleElevationBounds,h=(e>=0?1:-1)*((d?Math.abs(d.max-d.min):100)+Math.abs(e));F(l,o,h),z(n,s,l),ce(n,s,re);const c=this._getRayIntersection(re,{include:this._terrainIntersectionOptionsLayerUids,maxDistance:h});if(c!=null){const u=Le;return F(u,o,e),z(i,c.renderPoint,u),ue(c.normal)}return T(i,t),null}};a([r()],G.prototype,"view",void 0),a([r()],G.prototype,"intersector",void 0),G=a([D("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],G);const Tt=_(),It=_(),Pt=_(),Le=_(),re=$e(),Ge="esri.views.3d.analysis.LineOfSight.LineOfSightController",Ve=he.getLogger(Ge);let y=class extends Ae.EventedMixin(k){constructor(t){super(t),this.updateOnCameraChange=!0,this._observerGroundOffsetRenderSpace=0,this._effectiveObserverElevationMode="absolute-height",this._observerFeatureId=null,this._updatingHandles=new ge,this._frameTask=ve,this._computationHandles=new te,this._externalObserverUpdate=!0}initialize(){var e;const t=(e=this.view.resourceController)==null?void 0:e.scheduler;this._frameTask=t?t.registerTask(W.LINE_OF_SIGHT_TOOL):ve,this._intersector=new G({view:this.view}),this.addHandles([this._connectObserver(),this._connectComputations(),this._connectTargets()])}destroy(){this._computationHandles.destroy(),this._computations.removeAll(),this._updatingHandles.destroy()}get updating(){return this._frameTask.updating||this._updatingHandles.updating}get priority(){return this._frameTask.priority}set priority(t){this._frameTask.priority=t}get _computations(){return this.analysisViewData.computations}get _elevationAlignedObserverPositionRenderSpace(){return this.analysisViewData.observerEngineLocation}set _elevationAlignedObserverPositionRenderSpace(t){this.analysisViewData.observerEngineLocation=t}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._elevationAlignedObserverPositionRenderSpace)}_computeResult(t){const e=t.computation,{inputPoints:i,computationResult:n}=e,{observerAdjusted:s,targetAdjusted:o}=i,{start:l,end:d}=n;T(l,s),T(d,o),this._canCompute(e)?this._computeIntersection(t):this._interpolateIntersection(t),e.notifyResultChanged(),this.emit("result-changed",{target:t.computation.target,result:e.result})}_updateAdjustedPointsFromFeatures(t){const e=this.view,{sceneIntersectionHelper:i}=e,{inputPoints:n}=t,{observerAdjusted:s,observerFeatureId:o,targetFeatureId:l,targetAdjusted:d}=n;if(o==null&&l==null)return;const h=tt(s,d),c=this._intersector.intersector,u=ce(n.observer,n.target,Se);c.options.store=ee.ALL,i.intersectToolIntersectorRay(u,c);let g=null,p=null,C=null,b=null;for(const w of c.results.all){const m=X(w,this.view);if(m==null||w.distanceInRenderSpace==null)continue;const L=ne(m);L!=null&&(o!=null&&L===o&&(g==null&&(g=this._getFeatureDistanceThreshold(w,e,h)),w.distanceInRenderSpace=I*x(h,c)}const L=new st(w,i.spatialReference);{const{result:I,target:R}=t;I!=null?(I.target=R,I.intersectedGraphic=m?null:X(C,i),I.intersectedLocation=m?null:L,I.visible=m):t.result=new A({target:R,elevationAlignedTargetLocation:t.elevationAlignedTargetLocation,intersectedGraphic:m?null:X(C,i),intersectedLocation:m?null:L,visible:m})}l.isValid=d.isValid=!0,l.isTargetVisible=m}_interpolateIntersection({computation:t,interpolationInfo:e}){const{computationResult:i,inputPoints:n}=t,{start:s,end:o,intersection:l}=i,{originalIntersection:d,originalObserver:h,originalTarget:c}=e;if(T(l,d),n.isValid){const u=K,g=x(h,d)/x(h,c);_e(u,s,h),F(u,u,1-g),z(l,l,u),_e(u,o,c),F(u,u,g),z(l,l,u),i.isValid=!0}else t.result=null,i.isValid=!1,i.isTargetVisible=!1}_canCompute(t){const e=this.analysisViewData.elevationAlignedObserver,i=this.view.frustum;if(e==null||t.elevationAlignedTargetLocation==null||i==null)return!1;const{observerAdjusted:n,targetAdjusted:s}=t.inputPoints,o=i.intersectsPoint(n),l=i.intersectsPoint(s);return o&&l}_onObserverPositionChange(t,e,i,n,s){if(this._externalObserverUpdate=s,t==null)return this.analysisViewData.elevationAlignedObserver=null,void(this._observerFeatureId=null);if(e==null)return Te(this.analysis,t.spatialReference,Ve),void(this.analysisViewData.elevationAlignedObserver=null);const o=this._getEffectiveElevationInfo(e,i),{absoluteZ:l,elevation:d}=me(e.x,e.y,e.z,this.view.spatialReference,this.view,o),h=e.clone();h.z=l,this._effectiveObserverElevationMode=o.mode,this.analysisViewData.elevationAlignedObserver=h;const c=_();this.view.renderCoordsHelper.toRenderCoords(h,c),this._elevationAlignedObserverPositionRenderSpace=c,this._observerGroundOffsetRenderSpace=l-d,this._observerFeatureId=ne(n),this.priority=W.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onObserverRenderSpacePositionChangeForComputation(t,e,i,n,s){const{inputPoints:o}=t;switch(T(o.observer,e),o.observerFeatureId=s,o.observerSurfaceNormal=null,n){case"on-the-ground":case"relative-to-ground":{const l=this._intersector.updateFromGroundIntersection(o.observer,i,o.observer);o.observerFeatureId==null&&(o.observerSurfaceNormal=l)}}this._adjustStartEndPositions(t),t.notifyInputPointsChanged(),this.priority=W.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetPositionChange(t,e,i,n,s,o=!0){const l=t.inputPoints;if(o&&(l.isValid=!1),i==null)return e!=null&&Te(this.analysis,e.spatialReference,Ve),t.elevationAlignedTargetLocation=null,void t.notifyInputPointsChanged();const d=this._getEffectiveElevationInfo(i,n),{absoluteZ:h,elevation:c}=me(i.x,i.y,i.z,this.view.spatialReference,this.view,d),u=i.clone();switch(u.z=h,t.elevationAlignedTargetLocation=u,this.view.renderCoordsHelper.toRenderCoords(t.elevationAlignedTargetLocation,l.target),l.targetFeatureId=ne(s),l.targetSurfaceNormal=null,d.mode){case"on-the-ground":case"relative-to-ground":{const g=this._intersector.updateFromGroundIntersection(l.target,h-c,l.target);l.targetFeatureId==null&&(l.targetSurfaceNormal=g)}}this._adjustStartEndPositions(t),t.notifyInputPointsChanged(),this.priority=W.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectComputationToTarget(t){return J([this._updatingHandles.add(()=>({computation:t,targetPosition:t.target.position,targetElevationInfo:t.target.elevationInfo,targetFeatureInfo:t.target.feature,projectedTargetPosition:Z(t.target.position,this.view.spatialReference)}),({computation:e,targetPosition:i,targetElevationInfo:n,targetFeatureInfo:s,projectedTargetPosition:o})=>{o.pending==null?this._onTargetPositionChange(e,i,o.geometry,n,s):this._updatingHandles.addPromise(o.pending)},S)])}_connectComputationToObserver(t){return this._updatingHandles.add(()=>({computation:t,observer:this.analysisViewData.elevationAlignedObserver}),({computation:e})=>{this._externalObserverUpdate&&(e.inputPoints.isValid=!1,e.notifyInputPointsChanged())},S)}_connectComputationToRenderSpaceObserver(t){return this._updatingHandles.add(()=>({computation:t,observer:this._elevationAlignedObserverPositionRenderSpace,observerGroundOffset:this._observerGroundOffsetRenderSpace,observerElevationMode:this._effectiveObserverElevationMode,observerFeatureId:this._observerFeatureId}),({computation:e,observer:i,observerGroundOffset:n,observerElevationMode:s,observerFeatureId:o})=>{this._onObserverRenderSpacePositionChangeForComputation(e,i,n,s,o)},S)}_connectComputationToCamera(t){return this._updatingHandles.add(()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty}),({isDirty:e})=>{!this.updateOnCameraChange||t.inputPoints.isValid&&!e||t.notifyInputPointsChanged()})}_connectComputationToSlicePlane(t){return this._updatingHandles.add(()=>this.view.slicePlane,()=>{t.inputPoints.isValid=!1,t.notifyInputPointsChanged()})}_connectComputationToElevation(t){const e=(i,n)=>{const s=this.analysis.observer,o=t.target;let l=null,d=null,h=null,c=null,u=null,g=null;if((s==null?void 0:s.position)!=null){const p=Z(s.position,this.view.spatialReference);if(p.pending!=null)return this._updatingHandles.addPromise(p.pending),void p.pending.finally(()=>e(i,n));l=p.geometry,d=s.elevationInfo,h=s.feature}if(o.position!=null){const p=Z(o.position,this.view.spatialReference);if(p.pending!=null)return this._updatingHandles.addPromise(p.pending),void p.pending.finally(()=>e(i,n));c=p.geometry,u=o.elevationInfo,g=o.feature}l==null&&c==null||(lt(i,n,Q,this.view.spatialReference),l!=null&&be(Q,l)&&this._onObserverPositionChange(s!=null?s.position:null,l,d,h,!1),c!=null&&be(Q,c)&&this._onTargetPositionChange(t,o.position,c,u,g,!1),l!=null&&c!=null&&ut(Q,l,c)&&t.notifyInputPointsChanged())};return this.view.elevationProvider.on("elevation-change",i=>e(i.extent,i.spatialReference))}_connectComputationToTask(t){let e=null;const i={computation:t,interpolationInfo:{originalIntersection:_(),originalObserver:_(),originalTarget:_()}};return J([this._updatingHandles.add(()=>t.inputPoints,()=>{e=ye(e),e=at(async n=>{await ot(this._frameTask.schedule(()=>this._computeResult(i),n))})},{initial:!0,equals:()=>!1}),He(()=>e=ye(e))])}_connectComputation(t){const e=this._computationHandles;e.has(t)||e.add([this._connectComputationToTarget(t),this._connectComputationToObserver(t),this._connectComputationToRenderSpaceObserver(t),this._connectComputationToCamera(t),this._connectComputationToSlicePlane(t),this._connectComputationToElevation(t),this._connectComputationToTask(t)],t)}_disconnectComputation(t){this._computationHandles.remove(t)}_onComputationCollectionChange({added:t,removed:e}){for(const i of e)this._disconnectComputation(i);for(const i of t)this._connectComputation(i)}_onTargetCollectionChange({added:t,removed:e}){for(const i of e)this._removeTarget(i);for(const i of t)this._addTarget(i)}_onCursorTargetChange(t,e){e!=null&&this._removeTarget(e),t!=null&&this._addTarget(t)}_addTarget(t){this._computations.some(e=>e.target===t)||this._computations.add(new H({target:t}))}_removeTarget(t){const e=this._computations.findIndex(i=>i.target===t);this._computations.removeAt(e)}_connectObserver(){return J([this._updatingHandles.add(()=>({observerPosition:this.analysis.observer!=null?this.analysis.observer.position:null,projectedObserverPosition:Z(this.analysis.observer!=null?this.analysis.observer.position:null,this.view.spatialReference),observerElevationInfo:this.analysis.observer!=null?this.analysis.observer.elevationInfo:null,observerFeatureInfo:this.analysis.observer!=null?this.analysis.observer.feature:null}),({observerPosition:t,projectedObserverPosition:e,observerElevationInfo:i,observerFeatureInfo:n})=>{e.pending==null?this._onObserverPositionChange(t,e.geometry,i,n,!0):this._updatingHandles.addPromise(e.pending)},S)])}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this._computations,t=>this._onComputationCollectionChange(t),{initial:!0,final:!0})}_connectTargets(){return J([this._updatingHandles.addOnCollectionChange(()=>this.analysis.targets,t=>this._onTargetCollectionChange(t),{initial:!0,final:!0}),this._updatingHandles.add(()=>this.analysisViewData.cursorTarget,(t,e)=>{this._onCursorTargetChange(t,e)})])}get _isCameraDirty(){const t=this.analysisViewData.elevationAlignedObserver,{view:e}=this,{renderCoordsHelper:i}=e;if(t==null||i==null)return!1;const n=K;i.toRenderCoords(t,n);const s=e.state.camera.computeScreenPixelSizeAt(n);return Math.abs((s-this._screenPixelSize)/this._screenPixelSize)>Lt}_getEffectiveElevationInfo(t,e){return t.hasZ?e??{mode:"absolute-height",offset:0}:{mode:"on-the-ground",offset:0}}};a([r({constructOnly:!0})],y.prototype,"analysis",void 0),a([r({constructOnly:!0})],y.prototype,"analysisViewData",void 0),a([r({constructOnly:!0})],y.prototype,"view",void 0),a([r()],y.prototype,"updating",null),a([r()],y.prototype,"priority",null),a([r()],y.prototype,"updateOnCameraChange",void 0),a([r()],y.prototype,"_computations",null),a([r()],y.prototype,"_elevationAlignedObserverPositionRenderSpace",null),a([r()],y.prototype,"_observerGroundOffsetRenderSpace",void 0),a([r()],y.prototype,"_effectiveObserverElevationMode",void 0),a([r()],y.prototype,"_observerFeatureId",void 0),a([r()],y.prototype,"_screenPixelSize",null),a([r({readOnly:!0})],y.prototype,"_updatingHandles",void 0),a([r()],y.prototype,"_frameTask",void 0),a([r()],y.prototype,"_isCameraDirty",null),y=a([D(Ge)],y);const Lt=.1,K=_(),Se=$e(),Q=rt(),Vt=.05;let St=class{constructor(){this.glowWidth=8,this.innerWidth=.75}};const Rt=new St;function Et(t){const e=t.accentColor;return{glowColor:e,innerColor:dt(e),globalAlpha:.75*e.a}}class $t{constructor(){this.size=.5}}const At=new $t;function Re(t){return ct(t.accentColor,.75)}class Ht{constructor(){this.size=.5,this.visibleColor=new v([3,252,111,.75]),this.occludedColor=new v([252,3,69,.75]),this.undefinedColor=new v([127,127,127,.75])}}const Dt=new Ht;let Mt=class{constructor(){this.innerWidth=2,this.outerWidth=8,this.visibleInnerColor=new v([3,252,111,1]),this.visibleOuterColor=new v([3,252,111,.15]),this.occludedInnerColor=new v([252,3,69,1]),this.occludedOuterColor=new v([252,3,69,.1]),this.undefinedInnerColor=new v([255,255,255,1]),this.undefinedOuterColor=new v([127,127,127,.2])}};const Y=new Mt;class kt extends ke{constructor(e,i){const n=xe(Re(e.effectiveTheme)),s=De(n,At.size,32,32),o=new Fe(s);super({view:e,renderObjects:[o],metadata:i,elevationInfo:{mode:"absolute-height",offset:0}}),ze(this),this.themeHandle=Me(()=>({color:Re(e.effectiveTheme)}),l=>{n.setParameters(l)})}destroy(){this.themeHandle.remove(),super.destroy()}}let xt=class extends ke{constructor(e,i){const{size:n,visibleColor:s,occludedColor:o,undefinedColor:l}=Dt;super({view:e,renderObjects:[le(n,s,N.Custom1),le(n,o,N.Custom2),le(n,l,N.Custom3)],metadata:i,elevationInfo:{mode:"absolute-height",offset:0}}),ze(this)}};function le(t,e,i){return new Fe(De(xe(v.toUnitRGBA(e)),t,32,32),i)}var M;(function(t){t.Ready="ready",t.Creating="creating",t.Created="created"})(M||(M={}));let O=class extends Ct{constructor(e){super(e),this.removeIncompleteOnCancel=!1,this.analysisViewData=null,this._latestPointerMovePointerType=null,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new te,this._updatingHandles=new ge,this._manipulatorHandles=new te,this._targetTrackerManipulator=null}initialize(){this._intersector=new G({view:this.view}),this.addHandles(Me(()=>this.state,e=>{e===M.Created&&this.finishToolCreation()},pt)),this._observerManipulator=this._createObserverManipulator(),this._createLaserLine(),this.addHandles([this._updatingHandles.add(()=>{var e;return(e=this.analysisViewData)==null?void 0:e.elevationAlignedObserver},e=>this._onObserverLocationChange(e),S),this._updatingHandles.add(()=>Et(this.view.effectiveTheme),({glowColor:e,innerColor:i,globalAlpha:n})=>this._updateLaserLineStyle(e,i,n),S),this._updatingHandles.add(()=>this._laserLineRendererDependencies(),e=>this._updateLaserLineRenderer(e)),this._connectComputations(),this._updatingHandles.addWhen(()=>!this._shouldRenderTracker,()=>this._clearCursorTracker(),S)])}destroy(){this._updatingHandles=E(this._updatingHandles),this._manipulatorHandles=E(this._manipulatorHandles),this._analysisHandles=E(this._analysisHandles),this._observerManipulator=null,this._clearCursorTracker(),this._removeLaserLine(),this._intersector=null,this._set("analysis",null)}get state(){var e;return this.active?this.hasGrabbedManipulators?M.Created:M.Creating:((e=this.analysis.observer)==null?void 0:e.position)!=null?M.Created:M.Ready}get cursor(){return this.active&&this._showTracker?"crosshair":null}get updating(){return this.analysisViewData!=null&&this.analysisViewData.updating||this._updatingHandles.updating}get _showTracker(){return this.active&&this._latestPointerMovePointerType==="mouse"}get _shouldRenderTracker(){var e;return this._showTracker&&((e=this.analysis.observer)==null?void 0:e.position)!=null&&!this.hasGrabbedManipulators}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"key-down":this._keyDownHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){e.type==="immediate-click"&&this._clickHandler(e)}onShow(){}onHide(){}onDeactivate(){this._clearCursorTracker()}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,e=>this._onComputationsCollectionChange(e),{initial:!0,final:!0})}_onComputationsCollectionChange({added:e,removed:i}){for(const n of i)this._disconnectComputation(n);for(const n of e)this._connectComputation(n)}_connectComputation(e){if(this.destroyed)return void he.getLogger(this).warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const i=this._analysisHandles;if(i.has(e))return;const n=this._createTargetManipulator(e.target);this._targetTrackerManipulator==null&&n.metadata.target===this.analysisViewData.cursorTarget&&(this._targetTrackerManipulator=n,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),i.add([this._updatingHandles.add(()=>this._getLineOfSightManipulatorStateDependencies(e),()=>this._updateManipulatorState(n,e),S),this._updatingHandles.add(()=>e.elevationAlignedTargetLocation,s=>this._onTargetLocationChange(s,n),S)],e)}_disconnectComputation(e){if(this.destroyed)return void he.getLogger(this).warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const i=this._getTargetManipulator(e.target);i!=null&&(this.manipulators.remove(i),this._manipulatorHandles.remove(i),this._targetTrackerManipulator!=null&&this._targetTrackerManipulator===i&&(this._targetTrackerManipulator=null))}_clearCursorTracker(){this.analysisViewData.cursorTarget=E(this.analysisViewData.cursorTarget)}_createTargetManipulator(e){const i={target:e,type:"target"},n=new xt(this.view,i);return this._manipulatorHandles.add([this._createTargetManipulatorDragPipeline(n),n.events.on("grab-changed",s=>this._manipulatorGrabChanged(n,s)),n.events.on("immediate-click",s=>this._manipulatorClick(n,s))],n),this.manipulators.add(n),e.position!=null?n.elevationAlignedLocation=e.position:n.available=!1,n}_getTargetManipulator(e){let i=null;return this.manipulators.forEach(n=>{const s=n.manipulator;i==null&&s.metadata.type==="target"&&s.metadata.target===e&&(i=s)}),i}_createObserverManipulator(){const e=new kt(this.view,{type:"observer",intersection:null});return this._manipulatorHandles.add([this._createObserverManipulatorDragPipeline(e),e.events.on("grab-changed",i=>this._manipulatorGrabChanged(e,i)),e.events.on("immediate-click",i=>this._manipulatorClick(e,i))],e),this.manipulators.add(e),e}_screenToIntersection(){return e=>{const i=this._intersector.getScreenPointIntersection(e.screenEnd);return i==null?null:{...e,intersection:i}}}_createTargetManipulatorDragPipeline(e){return Ie(e,(i,n,s)=>{n.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next(()=>this._updateLaserLineRenderer()),s.next(this._cancelTargetDragStep(e.metadata.target)).next(()=>this._updateLaserLineRenderer())})}_createObserverManipulatorDragPipeline(e){return Ie(e,(i,n,s)=>{n.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next(()=>this._updateLaserLineRenderer()),s.next(this._cancelObserverDragStep()).next(()=>this._updateLaserLineRenderer())})}_updateObserverDragStep(){return e=>(e.intersection.mapPoint!=null?(this.analysis.observer==null&&(this.analysis.observer=new fe),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){var i;const e=((i=this.analysis.observer)==null?void 0:i.position)!=null?this.analysis.observer.clone():null;return n=>(this.analysis.observer=e,n)}_updateTargetDragStep(e){return i=>{this._updateFromIntersection(e.metadata.target,i.intersection);const n=i.intersection.mapPoint;return n!=null&&(e.elevationAlignedLocation=n),i}}_cancelTargetDragStep(e){var n;const i=(n=e.position)==null?void 0:n.clone();return s=>(e.position=i,s)}_manipulatorGrabChanged(e,i){switch(i.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}}_updateManipulatorState(e,i){const{isValid:n,isTargetVisible:s}=i.computationResult;e.state=n?s?N.Custom1:N.Custom2:N.Custom3}_getLineOfSightManipulatorStateDependencies(e){const{isValid:i,isTargetVisible:n}=e.computationResult;return{isValid:i,isTargetVisible:n}}_laserLineRendererDependencies(){return{laserlineVisualElement:this._laserlineVisualElement,grabbedManipulator:this._grabbedManipulator,shouldRenderTracker:this._shouldRenderTracker,observerPosition:this.analysis.observer!=null?this.analysis.observer.position:null,visible:this.visible}}_updateLaserLineRenderer(e=this._laserLineRendererDependencies()){const{laserlineVisualElement:i,grabbedManipulator:n,shouldRenderTracker:s,observerPosition:o,visible:l}=e;if(i==null)return;const d=n??(s&&o!=null?this._targetTrackerManipulator:null);d!=null&&l?(i.visible=!0,i.heightManifoldTarget=d.renderLocation,d!==this._observerManipulator?i.lineVerticalPlaneSegment=gt(this._observerManipulator.renderLocation,d.renderLocation,Ft):i.lineVerticalPlaneSegment=null):(i.visible=!1,i.heightManifoldTarget=null,i.lineVerticalPlaneSegment=null)}_createLaserLine(){this._removeLaserLine();const{glowWidth:e,innerWidth:i}=Rt;this._laserlineVisualElement=new ft({view:this.view,attached:!0,visible:this.visible,style:{glowWidth:e,innerWidth:i},isDecoration:!0})}_removeLaserLine(){this._laserlineVisualElement!=null&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_updateLaserLineStyle(e,i,n){const s=this._laserlineVisualElement;if(s==null)return;const o=s.style;s.style={...o,glowColor:v.toUnitRGB(e),innerColor:v.toUnitRGB(i),globalAlpha:n}}_onObserverLocationChange(e){e!=null?(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e):this._observerManipulator.available=!1}_onTargetLocationChange(e,i){e!=null?(i.elevationAlignedLocation=e,i!==this._targetTrackerManipulator&&(i.available=!0)):i.available=!1}_addPointFromClickEvent(e){var n;const i=this._intersector.getScreenPointIntersection(e);if((i==null?void 0:i.mapPoint)!=null)if(((n=this.analysis.observer)==null?void 0:n.position)!=null){this._clearCursorTracker();const s=new Ce;this._updateFromIntersection(s,i),this.analysis.targets.add(s)}else{const s=new fe;this._updateFromIntersection(s,i),this.analysis.observer=s}}_clickHandler(e){this.active&&e.button!==se.Right&&(this._addPointFromClickEvent(we(e)),e.stopPropagation())}_doubleClickHandler(e){this.active&&e.button!==se.Right&&(this.stop(),e.stopPropagation())}_keyDownHandler(e){this.active&&e.key==="Escape"&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){var s;if(this.hasGrabbedManipulators||(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||((s=this.analysis.observer)==null?void 0:s.position)==null))return;const i=we(e),n=this._intersector.getScreenPointIntersection(i);(n==null?void 0:n.mapPoint)!=null&&(this.analysisViewData.cursorTarget==null&&(this.analysisViewData.cursorTarget=new Ce),this._updateFromIntersection(this.analysisViewData.cursorTarget,n),this._updateLaserLineRenderer())}_updateFromIntersection(e,i){if(i.mapPoint==null)return e.position=null,e.elevationInfo=null,void(e.feature=null);switch(i.type){case j.OBJECT:if(i.graphic!=null){const s=i.graphic,o=vt(s);o.mode==="on-the-ground"&&(o.mode="relative-to-ground",o.offset=0),e.elevationInfo=new Oe(o),e.feature=s}else e.elevationInfo=null,e.feature=null;break;case j.TERRAIN:case j.I3S:e.elevationInfo=new Oe({mode:"on-the-ground"}),e.feature=null;break;default:e.elevationInfo=null,e.feature=null}const n=i.mapPoint.clone();n.z=_t(this.view,n,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=n}_manipulatorClick(e,i){if(e.metadata.type==="observer"||e.grabbing||e.dragging||i.button!==se.Right||this.analysis.targets.length<=1)return;const{target:n}=e.metadata;this.analysis.targets.remove(n),i.stopPropagation()}get testInfo(){return{laserLineVisualElement:this._laserlineVisualElement,getTargetManipulator:e=>this._getTargetManipulator(e)}}};a([r({constructOnly:!0})],O.prototype,"view",void 0),a([r({constructOnly:!0})],O.prototype,"analysis",void 0),a([r({readOnly:!0})],O.prototype,"state",null),a([r({readOnly:!0})],O.prototype,"cursor",null),a([r()],O.prototype,"removeIncompleteOnCancel",void 0),a([r({readOnly:!0})],O.prototype,"updating",null),a([r({constructOnly:!0})],O.prototype,"analysisViewData",void 0),a([r({readOnly:!0})],O.prototype,"_showTracker",null),a([r()],O.prototype,"_latestPointerMovePointerType",void 0),a([r()],O.prototype,"_shouldRenderTracker",null),a([r()],O.prototype,"_laserlineVisualElement",void 0),a([r()],O.prototype,"_grabbedManipulator",void 0),O=a([D("esri.views.3d.interactive.analysisTools.lineOfSight.LineOfSightTool")],O);const Ft=ht();class zt{constructor(e,i,n,s){this.visibleLineVisualElement=e,this.occludedLineVisualElement=i,this.undefinedLineVisualElement=n,this.targetVisualElement=s}destroy(){this.visibleLineVisualElement.destroy(),this.occludedLineVisualElement.destroy(),this.undefinedLineVisualElement.destroy(),this.targetVisualElement.destroy()}}let V=class extends k{constructor(t){super(t),this._lineOfSightVisualElements=new Array,this._computationHandles=new te,this._updatingHandles=new ge}initialize(){this.addHandles(this._connectComputations()),this._createObserverVisualization()}destroy(){this._updatingHandles=E(this._updatingHandles),this._computationHandles=E(this._computationHandles),this._observerVisualElement=E(this._observerVisualElement)}get visible(){return this.analysisViewData.visible}get updating(){return this._updatingHandles.updating}get interactiveAndEditable(){return this.analysisViewData.interactive&&this.analysisViewData.editable}get test(){return{disablePartialOcclusion:()=>{for(const t of this._lineOfSightVisualElements)t.visibleLineVisualElement.renderOccluded=ae.Occlude,t.occludedLineVisualElement.renderOccluded=ae.Occlude,t.undefinedLineVisualElement.renderOccluded=ae.Occlude},visualizations:this._lineOfSightVisualElements}}_createLineOfSightVisualization(){const t=Y,e=this.view,i=this.isDecoration,n={view:e,attached:!0,width:t.outerWidth,innerWidth:t.innerWidth,isDecoration:i},s=v.toUnitRGBA(t.visibleOuterColor),o=v.toUnitRGBA(t.visibleInnerColor),l=v.toUnitRGBA(t.occludedOuterColor),d=v.toUnitRGBA(t.occludedInnerColor),h=v.toUnitRGBA(t.undefinedOuterColor),c=v.toUnitRGBA(t.undefinedInnerColor),u=new oe({...n,color:s,innerColor:o}),g=new oe({...n,color:l,innerColor:d}),p=new oe({...n,color:h,innerColor:c}),C=new Pe({view:e,attached:!0,...Ee,size:8,isDecoration:i}),b=new zt(u,g,p,C);return this._lineOfSightVisualElements.push(b),b}_destroyLineOfSightVisualization(t){t.destroy(),this._lineOfSightVisualElements.splice(this._lineOfSightVisualElements.indexOf(t),1)}_updateLineOfSightVisualization(t,e,i){const n=Y,{computationResult:s,inputPoints:o}=t,{start:l,end:d,intersection:h,isValid:c,isTargetVisible:u}=s,{observer:g}=o,p=qt;p[12]=g[0],p[13]=g[1],p[14]=g[2];const C=U(Gt,l,g),b=U(jt,d,g),w=U(Nt,h,g),{visibleLineVisualElement:m,occludedLineVisualElement:L,undefinedLineVisualElement:I,targetVisualElement:R}=e,je=this.analysisViewData.elevationAlignedObserver==null||t.elevationAlignedTargetLocation==null,q=this.visible&&!je;m.visible=q,L.visible=q,I.visible=q,R.visible=q,R.attached=!i.interactiveAndEditable,q&&(m.geometry=null,L.geometry=null,I.geometry=null,R.geometry=t.elevationAlignedTargetLocation,c?u?(m.geometry=[[$(C),$(b)]],m.transform=p,m.color=v.toUnitRGBA(n.visibleOuterColor),R.color=v.toUnitRGBA(n.visibleInnerColor)):(m.geometry=[[$(C),$(w)]],m.transform=p,m.color=v.toUnitRGBA(n.occludedOuterColor),L.geometry=[[$(w),$(b)]],L.transform=p,R.color=v.toUnitRGBA(n.occludedInnerColor)):(I.geometry=[[$(C),$(b)]],I.transform=p,R.color=v.toUnitRGBA(n.undefinedInnerColor)))}_getLineOfSightVisualizationDependencies(t){const{computationResult:e}=t,{occludedOuterColor:i,visibleOuterColor:n}=Y;return{computationResult:e,occludedOuterColor:i,visibleOuterColor:n,visible:this.visible,interactiveAndEditable:this.interactiveAndEditable}}_connectComputation(t){const e=this._computationHandles;if(e.has(t))return;const i=this._createLineOfSightVisualization();e.add([this._updatingHandles.add(()=>this._getLineOfSightVisualizationDependencies(t),n=>this._updateLineOfSightVisualization(t,i,n),{initial:!0,equals:()=>!1}),He(()=>this._destroyLineOfSightVisualization(i))],t)}_disconnectComputation(t){this._computationHandles.remove(t)}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,t=>this._onComputationsCollectionChange(t),{initial:!0,final:!0})}_onComputationsCollectionChange({added:t,removed:e}){for(const i of e)this._disconnectComputation(i);for(const i of t)this._connectComputation(i)}_createObserverVisualization(){const t=v.toUnitRGBA(Y.visibleInnerColor),e=new Pe({view:this.view,color:t,...Ee,isDecoration:this.isDecoration});this._observerVisualElement=e,this.addHandles(this._updatingHandles.add(()=>({observer:this.analysisViewData.elevationAlignedObserver,interactiveAndEditable:this.interactiveAndEditable,visible:this.visible}),({observer:i,interactiveAndEditable:n,visible:s})=>{i!=null&&!n&&s?(e.geometry=i,this._observerVisualElement.attached=!0):e.attached=!1},S))}};a([r({constructOnly:!0})],V.prototype,"analysis",void 0),a([r({constructOnly:!0})],V.prototype,"analysisViewData",void 0),a([r({constructOnly:!0})],V.prototype,"view",void 0),a([r({readOnly:!0})],V.prototype,"visible",null),a([r({constructOnly:!0})],V.prototype,"isDecoration",void 0),a([r()],V.prototype,"updating",null),a([r()],V.prototype,"interactiveAndEditable",null),a([r()],V.prototype,"test",null),V=a([D("esri.views.3d.analysis.LineOfSight.LineOfSightVisualization")],V);const Ee={size:6,pixelSnappingEnabled:!1,primitive:"circle",elevationInfo:{mode:"absolute-height",offset:0},outlineSize:0},Gt=_(),jt=_(),Nt=_(),qt=mt();let f=class extends bt(Ae.EventedMixin(k)){constructor(t){super(t),this.type="line-of-sight-view-3d",this.analysis=null,this.tool=null,this.computations=new yt,this.elevationAlignedObserver=null,this.observerEngineLocation=_(),this.cursorTarget=null,this.editable=!0}initialize(){const t=this.view,e=this.analysis;this._analysisController=new y({analysis:e,analysisViewData:this,view:t}),this._analysisVisualization=new V({analysis:e,analysisViewData:this,view:t,isDecoration:!this.parent}),this.addHandles([this._analysisController.on("result-changed",i=>{i.target!==this.cursorTarget&&this.emit("result-changed",i)}),wt(this,O)])}destroy(){Ot(this),this._analysisController=E(this._analysisController),this._analysisVisualization=E(this._analysisVisualization)}get results(){return this.computations.map(t=>t.result)}get priority(){return this._analysisController.priority}set priority(t){this._analysisController.priority=t}get updating(){return this._analysisController!=null&&this._analysisController.updating||this._analysisVisualization!=null&&this._analysisVisualization.updating}getResultForTarget(t){var e;return(e=this.computations.find(i=>i.target===t))==null?void 0:e.result}get testInfo(){return{visualization:this._analysisVisualization,controller:this._analysisController}}};a([r({readOnly:!0})],f.prototype,"type",void 0),a([r({constructOnly:!0,nonNullable:!0})],f.prototype,"analysis",void 0),a([r()],f.prototype,"tool",void 0),a([r({readOnly:!0})],f.prototype,"results",null),a([r()],f.prototype,"priority",null),a([r()],f.prototype,"computations",void 0),a([r()],f.prototype,"elevationAlignedObserver",void 0),a([r()],f.prototype,"observerEngineLocation",void 0),a([r()],f.prototype,"cursorTarget",void 0),a([r()],f.prototype,"updating",null),a([r()],f.prototype,"editable",void 0),a([r()],f.prototype,"_analysisController",void 0),a([r()],f.prototype,"_analysisVisualization",void 0),f=a([D("esri.views.3d.analysis.LineOfSightAnalysisView3D")],f);const di=f;export{di as default}; diff --git a/dist/assets/LineOfSightLayer-JMoACZan.js b/dist/assets/LineOfSightLayer-5jg3FABh.js similarity index 93% rename from dist/assets/LineOfSightLayer-JMoACZan.js rename to dist/assets/LineOfSightLayer-5jg3FABh.js index 62033c8..51e91eb 100644 --- a/dist/assets/LineOfSightLayer-JMoACZan.js +++ b/dist/assets/LineOfSightLayer-5jg3FABh.js @@ -1 +1 @@ -import{V as n,ed as l,dM as o,dP as y,ee as r,d as p,A as d,ef as h,e as s,y as i,eg as u,c as g,c7 as c}from"./index-J0iiHjMT.js";const f=n.ofType(l);let t=class extends o(y(c)){constructor(e){super(e),this.type="line-of-sight",this.operationalLayerType="LineOfSightLayer",this.analysis=new r,this.opacity=1}initialize(){this.addHandles(p(()=>this.analysis,(e,a)=>{a!=null&&a.parent===this&&(a.parent=null),e!=null&&(e.parent=this)},d))}async load(){return this.analysis!=null&&this.addResolvingPromise(this.analysis.waitComputeExtent()),this}get observer(){var e;return(e=this.analysis)==null?void 0:e.observer}set observer(e){const{analysis:a}=this;a&&(a.observer=e)}get targets(){return this.analysis!=null?this.analysis.targets:new n}set targets(e){var a;h(e,(a=this.analysis)==null?void 0:a.targets)}get fullExtent(){return this.analysis!=null?this.analysis.extent:null}get spatialReference(){return this.analysis!=null?this.analysis.spatialReference:null}releaseAnalysis(e){this.analysis===e&&(this.analysis=new r)}};s([i({json:{read:!1},readOnly:!0})],t.prototype,"type",void 0),s([i({type:["LineOfSightLayer"]})],t.prototype,"operationalLayerType",void 0),s([i({type:u,json:{read:!0,write:{isRequired:!0,ignoreOrigin:!0}}})],t.prototype,"observer",null),s([i({type:f,json:{read:!0,write:{ignoreOrigin:!0}}})],t.prototype,"targets",null),s([i({nonNullable:!0,json:{read:!1,write:!1}})],t.prototype,"analysis",void 0),s([i({readOnly:!0})],t.prototype,"fullExtent",null),s([i({readOnly:!0})],t.prototype,"spatialReference",null),s([i({readOnly:!0,json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}}})],t.prototype,"opacity",void 0),s([i({type:["show","hide"]})],t.prototype,"listMode",void 0),t=s([g("esri.layers.LineOfSightLayer")],t);const w=t;export{w as default}; +import{V as n,e6 as l,dH as o,dK as y,e7 as r,B as p,T as d,e8 as h,e as s,y as i,e9 as u,c as g,aI as c}from"./index-pCX-0tJH.js";const f=n.ofType(l);let t=class extends o(y(c)){constructor(e){super(e),this.type="line-of-sight",this.operationalLayerType="LineOfSightLayer",this.analysis=new r,this.opacity=1}initialize(){this.addHandles(p(()=>this.analysis,(e,a)=>{a!=null&&a.parent===this&&(a.parent=null),e!=null&&(e.parent=this)},d))}async load(){return this.analysis!=null&&this.addResolvingPromise(this.analysis.waitComputeExtent()),this}get observer(){var e;return(e=this.analysis)==null?void 0:e.observer}set observer(e){const{analysis:a}=this;a&&(a.observer=e)}get targets(){return this.analysis!=null?this.analysis.targets:new n}set targets(e){var a;h(e,(a=this.analysis)==null?void 0:a.targets)}get fullExtent(){return this.analysis!=null?this.analysis.extent:null}get spatialReference(){return this.analysis!=null?this.analysis.spatialReference:null}releaseAnalysis(e){this.analysis===e&&(this.analysis=new r)}};s([i({json:{read:!1},readOnly:!0})],t.prototype,"type",void 0),s([i({type:["LineOfSightLayer"]})],t.prototype,"operationalLayerType",void 0),s([i({type:u,json:{read:!0,write:{isRequired:!0,ignoreOrigin:!0}}})],t.prototype,"observer",null),s([i({type:f,json:{read:!0,write:{ignoreOrigin:!0}}})],t.prototype,"targets",null),s([i({nonNullable:!0,json:{read:!1,write:!1}})],t.prototype,"analysis",void 0),s([i({readOnly:!0})],t.prototype,"fullExtent",null),s([i({readOnly:!0})],t.prototype,"spatialReference",null),s([i({readOnly:!0,json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}}})],t.prototype,"opacity",void 0),s([i({type:["show","hide"]})],t.prototype,"listMode",void 0),t=s([g("esri.layers.LineOfSightLayer")],t);const w=t;export{w as default}; diff --git a/dist/assets/LineOfSightLayerView3D-rUjgrEFl.js b/dist/assets/LineOfSightLayerView3D-rUjgrEFl.js deleted file mode 100644 index 8d3439b..0000000 --- a/dist/assets/LineOfSightLayerView3D-rUjgrEFl.js +++ /dev/null @@ -1,7 +0,0 @@ -import{d as h,A as w,E as r,b as d,n as c,a as V,g as _,de as u,e as a,y as n,c as p}from"./index-J0iiHjMT.js";import{n as A}from"./LayerView3D-iOx2MD1g.js";import{u as f}from"./LayerView-efDufa6j.js";const o="analysis-view-handles";let i=class extends A(f){constructor(s){super(s),this.type="line-of-sight-3d",this._analysisModule=null}initialize(){this.addHandles(h(()=>this.layer.analysis,s=>{this._destroyAnalysisView(),s!=null&&this._createAnalysisView(s)},w),o)}destroy(){this.removeHandles(o),this._destroyAnalysisView()}async whenAnalysisView(){if(this.analysisView!=null)return this.analysisView;if(this._createAnalysisViewTask!=null)return this._createAnalysisViewTask.promise;throw new r("layerview:no-analysisview-for-analysis","The analysis has not been set on the LineOfSightLayer of this layer view")}isUpdating(){return this._createAnalysisViewTask!=null||this.analysisView!=null&&this.analysisView.updating}_createAnalysisView(s){const t=d(async e=>(this.analysisView=await this._createAnalysisViewPromise(s,e),this._createAnalysisViewTask===t&&(this._createAnalysisViewTask=null),this.analysisView));this._createAnalysisViewTask=t}_destroyAnalysisView(){this.analysisView=c(this.analysisView),this._createAnalysisViewTask=V(this._createAnalysisViewTask)}async _createAnalysisViewPromise(s,t){let e=this._analysisModule;if(e==null){const y=await this._loadAnalysisModule();this._analysisModule=y,e=y}const l=new e.default({analysis:s,view:this.view,parent:this});if(await l.when(),_(t))throw l.destroy(),new r("layerview:no-analysisview-for-analysis","The analysis has not been added to the LineOfSightLayer of this layer view",{analysis:s});return l}_loadAnalysisModule(){return u(()=>import("./LineOfSightAnalysisView3D-lX-OBMBB.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))}};a([n()],i.prototype,"type",void 0),a([n()],i.prototype,"layer",void 0),a([n()],i.prototype,"analysisView",void 0),a([n()],i.prototype,"_createAnalysisViewTask",void 0),i=a([p("esri.views.3d.layers.LineOfSightLayerView3D")],i);const k=i;export{k as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/LineOfSightAnalysisView3D-lX-OBMBB.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/AnalysisView3D-jkk3JIRT.js","assets/LineVisualElement-4BP10o6v.js","assets/Object3DVisualElement-TMb7y_wl.js","assets/VisualElement-kjYXz27t.js","assets/ShadedColorMaterial.glsl-Fp4o6LjC.js","assets/manipulatorUtils-1y2yxq3d.js","assets/Laserlines.glsl-nvjcCsAw.js","assets/AnalysisToolBase-3A13PdgS.js","assets/InteractiveToolBase-WDic4GPF.js","assets/drawUtils-woTYaREB.js","assets/PointVisualElement-bX-_4FqS.js","assets/analysisViewUtils-AQaQeJpR.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/LineOfSightLayerView3D-uRdo1RJr.js b/dist/assets/LineOfSightLayerView3D-uRdo1RJr.js new file mode 100644 index 0000000..183a695 --- /dev/null +++ b/dist/assets/LineOfSightLayerView3D-uRdo1RJr.js @@ -0,0 +1,7 @@ +import{B as h,T as w,r as y,N as d,b as c,I as V,ad as _,de as u,e as a,y as n,c as p}from"./index-pCX-0tJH.js";import{n as A}from"./LayerView3D-57OghbRh.js";import{u as f}from"./LayerView-ixwLVnzr.js";const o="analysis-view-handles";let i=class extends A(f){constructor(s){super(s),this.type="line-of-sight-3d",this._analysisModule=null}initialize(){this.addHandles(h(()=>this.layer.analysis,s=>{this._destroyAnalysisView(),s!=null&&this._createAnalysisView(s)},w),o)}destroy(){this.removeHandles(o),this._destroyAnalysisView()}async whenAnalysisView(){if(this.analysisView!=null)return this.analysisView;if(this._createAnalysisViewTask!=null)return this._createAnalysisViewTask.promise;throw new y("layerview:no-analysisview-for-analysis","The analysis has not been set on the LineOfSightLayer of this layer view")}isUpdating(){return this._createAnalysisViewTask!=null||this.analysisView!=null&&this.analysisView.updating}_createAnalysisView(s){const t=d(async e=>(this.analysisView=await this._createAnalysisViewPromise(s,e),this._createAnalysisViewTask===t&&(this._createAnalysisViewTask=null),this.analysisView));this._createAnalysisViewTask=t}_destroyAnalysisView(){this.analysisView=c(this.analysisView),this._createAnalysisViewTask=V(this._createAnalysisViewTask)}async _createAnalysisViewPromise(s,t){let e=this._analysisModule;if(e==null){const r=await this._loadAnalysisModule();this._analysisModule=r,e=r}const l=new e.default({analysis:s,view:this.view,parent:this});if(await l.when(),_(t))throw l.destroy(),new y("layerview:no-analysisview-for-analysis","The analysis has not been added to the LineOfSightLayer of this layer view",{analysis:s});return l}_loadAnalysisModule(){return u(()=>import("./LineOfSightAnalysisView3D-oCrG9jF8.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))}};a([n()],i.prototype,"type",void 0),a([n()],i.prototype,"layer",void 0),a([n()],i.prototype,"analysisView",void 0),a([n()],i.prototype,"_createAnalysisViewTask",void 0),i=a([p("esri.views.3d.layers.LineOfSightLayerView3D")],i);const k=i;export{k as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/LineOfSightAnalysisView3D-oCrG9jF8.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/AnalysisView3D-XCzG0Hzh.js","assets/LineVisualElement-iKo1s90I.js","assets/Object3DVisualElement-8HoU366x.js","assets/VisualElement--2Scr6Yq.js","assets/ShadedColorMaterial.glsl-L0JVQzbX.js","assets/manipulatorUtils-165rCtzd.js","assets/Laserlines.glsl-U7nZFq0e.js","assets/AnalysisToolBase-olyQy6lh.js","assets/InteractiveToolBase-6mltmL27.js","assets/drawUtils-0wb2c6-q.js","assets/PointVisualElement-m9C0-AJh.js","assets/analysisViewUtils-lJExoyyw.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/LineSeries-VcEznTH7.js b/dist/assets/LineSeries-yr_9erUD.js similarity index 99% rename from dist/assets/LineSeries-VcEznTH7.js rename to dist/assets/LineSeries-yr_9erUD.js index dbca89f..c2c8d2c 100644 --- a/dist/assets/LineSeries-VcEznTH7.js +++ b/dist/assets/LineSeries-yr_9erUD.js @@ -1 +1 @@ -import{W as Y,Q as T,e as St,a as ft,Y as k,V as H,Z as $t,v as q,g as Kt,$ as et,q as J,m as P,w as vt,l as b,k as yt,b as S,r as wt,c as qt,d as X,f as Jt,F as Ot,y as Pt,h as kt,j as it,n as B,H as Qt,o as te,p as At,s as V,B as L,G as Xt,t as ee,i as ie,X as Dt,D as Tt,J as $,z as N,K as Mt,u as se}from"./Theme-QNc_77AM.js";import{s as Ct}from"./ColorSet-j9kKRPwP.js";import{l as M}from"./DefaultTheme-T7-VnRhA.js";import{U as Yt,D as Lt,_ as Ft,B as Rt,g as st,V as It,k as C,I as ae}from"./Tick-WQ_bPwW2.js";import{o as oe}from"./Button-1STHXt3M.js";import{da as K}from"./index-J0iiHjMT.js";function jt(y){return typeof y=="object"&&"length"in y?y:Array.from(y)}function Vt(y){this._context=y}function Et(y){return new Vt(y)}function Gt(y){return y[0]}function Nt(y){return y[1]}function zt(y,t){var e=C(!0),i=null,s=Et,a=null,r=It(n);function n(o){var h,c,l,d=(o=jt(o)).length,u=!1;for(i==null&&(a=s(l=r())),h=0;h<=d;++h)!(h=u;--g)n.point(_[g],f[g]);n.lineEnd(),n.areaEnd()}v&&(_[d]=+y(m,d,l),f[d]=+t(m,d,l),n.point(i?+i(m,d,l):_[d],e?+e(m,d,l):f[d]))}if(p)return n=null,p+""||null}function c(){return zt().defined(s).curve(r).context(a)}return y=typeof y=="function"?y:y===void 0?Gt:C(+y),t=typeof t=="function"?t:C(t===void 0?0:+t),e=typeof e=="function"?e:e===void 0?Nt:C(+e),h.x=function(l){return arguments.length?(y=typeof l=="function"?l:C(+l),i=null,h):y},h.x0=function(l){return arguments.length?(y=typeof l=="function"?l:C(+l),h):y},h.x1=function(l){return arguments.length?(i=l==null?null:typeof l=="function"?l:C(+l),h):i},h.y=function(l){return arguments.length?(t=typeof l=="function"?l:C(+l),e=null,h):t},h.y0=function(l){return arguments.length?(t=typeof l=="function"?l:C(+l),h):t},h.y1=function(l){return arguments.length?(e=l==null?null:typeof l=="function"?l:C(+l),h):e},h.lineX0=h.lineY0=function(){return c().x(y).y(t)},h.lineY1=function(){return c().x(y).y(e)},h.lineX1=function(){return c().x(i).y(t)},h.defined=function(l){return arguments.length?(s=typeof l=="function"?l:C(!!l),h):s},h.curve=function(l){return arguments.length?(r=l,a!=null&&(n=r(a)),h):r},h.context=function(l){return arguments.length?(l==null?a=n=null:n=r(a=l),h):a},h}Vt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(y,t){switch(y=+y,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(y,t):this._context.moveTo(y,t);break;case 1:this._point=2;default:this._context.lineTo(y,t)}}};class re extends ie{setupDefaultRules(){super.setupDefaultRules();const t=this._root.interfaceColors,e=this._root.language,i=this.rule.bind(this);i("XYChart").setAll({colors:Ct.new(this._root,{}),paddingLeft:20,paddingRight:20,paddingTop:16,paddingBottom:16,panX:!1,panY:!1,wheelStep:.25,arrangeTooltips:!0,pinchZoomX:!1,pinchZoomY:!1}),i("XYSeries").setAll({legendLabelText:"{name}"}),i("XYChart",["scrollbar","chart"]).setAll({paddingBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,colors:Ct.new(this._root,{saturation:0})});{const o=i("Graphics",["scrollbar","overlay"]);o.setAll({fillOpacity:.5}),M(o,"fill",t,"background")}i("RoundedRectangle",["xy","scrollbar","thumb"]).setAll({cornerRadiusTR:0,cornerRadiusTL:0,cornerRadiusBR:0,cornerRadiusBL:0,fillOpacity:0,focusable:!0}),i("RoundedRectangle",["xy","scrollbar","thumb"]).states.create("hover",{fillOpacity:.4}),i("RoundedRectangle",["xy","scrollbar","chart","background"]).setAll({cornerRadiusTL:0,cornerRadiusBL:0,cornerRadiusTR:0,cornerRadiusBR:0}),i("RoundedRectangle",["xy","scrollbar","chart","background","resize","button"]).setAll({cornerRadiusBL:40,cornerRadiusBR:40,cornerRadiusTL:40,cornerRadiusTR:40}),i("AxisRendererX",["xy","chart","scrollbar"]).setAll({strokeOpacity:0,inside:!0}),i("AxisRendererY",["xy","chart","scrollbar"]).setAll({strokeOpacity:0,inside:!0,minGridDistance:5}),i("AxisLabel",["xy","scrollbar","x"]).setAll({opacity:.5,centerY:k,minPosition:.01,maxPosition:.99,fontSize:"0.8em"}),i("AxisLabel",["category"]).setAll({text:"{category}",populateText:!0}),i("AxisLabel",["x"]).setAll({centerY:0}),i("AxisLabel",["x","inside"]).setAll({centerY:k}),i("AxisLabel",["x","inside","opposite"]).setAll({centerY:0}),i("AxisLabel",["x","opposite"]).setAll({centerY:k}),i("AxisLabel",["y"]).setAll({centerX:k}),i("AxisLabel",["y","inside"]).setAll({centerX:0}),i("AxisLabel",["y","inside","opposite"]).setAll({centerX:k}),i("AxisLabel",["y","opposite"]).setAll({centerX:0}),i("AxisLabel",["xy","scrollbar","y"]).setAll({visible:!1}),i("Grid",["xy","scrollbar","y"]).setAll({visible:!1}),i("Grid",["xy","scrollbar","x"]).setAll({opacity:.5}),i("XYCursor").setAll({behavior:"none",layer:30,exportable:!1,snapToSeriesBy:"xy",moveThreshold:1});{const o=i("Grid",["cursor","x"]);o.setAll({strokeOpacity:.8,strokeDasharray:[2,2],ariaLabel:e.translate("Use left and right arrows to move selection")}),M(o,"stroke",t,"alternativeBackground")}{const o=i("Grid",["cursor","y"]);o.setAll({strokeOpacity:.8,strokeDasharray:[2,2],ariaLabel:e.translate("Use up and down arrows to move selection")}),M(o,"stroke",t,"alternativeBackground")}{const o=i("Graphics",["cursor","selection"]);o.setAll({fillOpacity:.15}),M(o,"fill",t,"alternativeBackground")}i("Axis").setAll({start:0,end:1,minZoomCount:1,maxZoomCount:1/0,maxZoomFactor:1e3,maxDeviation:.1,snapTooltip:!0,tooltipLocation:.5,panX:!0,panY:!0,zoomX:!0,zoomY:!0,fixAxisSize:!0}),i("AxisLabel").setAll({location:.5,multiLocation:0,centerX:Dt,centerY:Dt,paddingTop:3,paddingBottom:3,paddingLeft:5,paddingRight:5}),i("Container",["axis","header"]).setAll({layer:30}),i("Rectangle",["axis","header","background"]).setAll({crisp:!0});{const o=i("AxisRenderer");o.setAll({crisp:!0,strokeOpacity:0}),M(o,"stroke",t,"grid")}i("AxisRendererX").setAll({minGridDistance:120,opposite:!1,inversed:!1,cellStartLocation:0,cellEndLocation:1,width:k}),i("AxisRendererY").setAll({minGridDistance:40,opposite:!1,inversed:!1,cellStartLocation:0,cellEndLocation:1,height:k});{const o=i("Rectangle",["axis","thumb"]);o.setAll({fillOpacity:0}),M(o,"fill",t,"alternativeBackground"),o.states.create("hover",{fillOpacity:.1})}i("Rectangle",["axis","thumb","x"]).setAll({cursorOverStyle:"ew-resize"}),i("Rectangle",["axis","thumb","y"]).setAll({cursorOverStyle:"ns-resize"});{const o=i("Grid");o.setAll({location:0,strokeOpacity:.15,crisp:!0}),M(o,"stroke",t,"grid")}i("Grid",["base"]).setAll({strokeOpacity:.3});{const o=i("Graphics",["axis","fill"]);o.setAll({visible:!1,isMeasured:!1,position:"absolute",fillOpacity:.05}),M(o,"fill",t,"alternativeBackground")}i("Graphics",["axis","fill","range"]).setAll({isMeasured:!0}),i("Graphics",["series","fill","range"]).setAll({visible:!1,isMeasured:!0}),i("Grid",["series","range"]).setAll({visible:!1}),i("AxisTick",["series","range"]).setAll({visible:!1}),i("AxisLabel",["series","range"]).setAll({visible:!1});{const o=i("AxisTick");o.setAll({location:.5,multiLocation:0,strokeOpacity:1,isMeasured:!1,position:"absolute",visible:!1}),M(o,"stroke",t,"grid")}i("CategoryAxis").setAll({startLocation:0,endLocation:1,fillRule:(o,h)=>{const c=o.get("axisFill");c&&(b(h)&&h%2!=0?c.setPrivate("visible",!1):c.setPrivate("visible",!0))}});const s=[{timeUnit:"millisecond",count:1},{timeUnit:"millisecond",count:5},{timeUnit:"millisecond",count:10},{timeUnit:"millisecond",count:50},{timeUnit:"millisecond",count:100},{timeUnit:"millisecond",count:500},{timeUnit:"second",count:1},{timeUnit:"second",count:5},{timeUnit:"second",count:10},{timeUnit:"second",count:30},{timeUnit:"minute",count:1},{timeUnit:"minute",count:5},{timeUnit:"minute",count:10},{timeUnit:"minute",count:15},{timeUnit:"minute",count:30},{timeUnit:"hour",count:1},{timeUnit:"hour",count:3},{timeUnit:"hour",count:6},{timeUnit:"hour",count:12},{timeUnit:"day",count:1},{timeUnit:"day",count:2},{timeUnit:"day",count:3},{timeUnit:"day",count:4},{timeUnit:"day",count:5},{timeUnit:"week",count:1},{timeUnit:"month",count:1},{timeUnit:"month",count:2},{timeUnit:"month",count:3},{timeUnit:"month",count:6},{timeUnit:"year",count:1},{timeUnit:"year",count:2},{timeUnit:"year",count:5},{timeUnit:"year",count:10},{timeUnit:"year",count:50},{timeUnit:"year",count:100},{timeUnit:"year",count:200},{timeUnit:"year",count:500},{timeUnit:"year",count:1e3},{timeUnit:"year",count:2e3},{timeUnit:"year",count:5e3},{timeUnit:"year",count:1e4},{timeUnit:"year",count:1e5}],a={millisecond:e.translate("_date_millisecond"),second:e.translate("_date_second"),minute:e.translate("_date_minute"),hour:e.translate("_date_hour"),day:e.translate("_date_day"),week:e.translate("_date_day"),month:e.translate("_date_month"),year:e.translate("_date_year")},r={millisecond:e.translate("_date_millisecond"),second:e.translate("_date_second"),minute:e.translate("_date_minute"),hour:e.translate("_date_day"),day:e.translate("_date_day"),week:e.translate("_date_day"),month:e.translate("_date_month")+" "+e.translate("_date_year"),year:e.translate("_date_year")},n={millisecond:e.translate("_date_millisecond_full"),second:e.translate("_date_second_full"),minute:e.translate("_date_minute_full"),hour:e.translate("_date_hour_full"),day:e.translate("_date_day_full"),week:e.translate("_date_week_full"),month:e.translate("_date_month_full"),year:e.translate("_date_year")};i("CategoryDateAxis").setAll({markUnitChange:!0,gridIntervals:Tt(s),dateFormats:$(a),periodChangeDateFormats:$(r)}),i("DateAxis").setAll({maxZoomFactor:null,strictMinMax:!0,startLocation:0,endLocation:1,markUnitChange:!0,groupData:!1,groupCount:500,gridIntervals:Tt(s),dateFormats:$(a),periodChangeDateFormats:$(r),tooltipDateFormats:n,groupIntervals:[{timeUnit:"millisecond",count:1},{timeUnit:"millisecond",count:10},{timeUnit:"millisecond",count:100},{timeUnit:"second",count:1},{timeUnit:"second",count:10},{timeUnit:"minute",count:1},{timeUnit:"minute",count:10},{timeUnit:"hour",count:1},{timeUnit:"day",count:1},{timeUnit:"week",count:1},{timeUnit:"month",count:1},{timeUnit:"year",count:1}],fillRule:o=>{const h=o.get("axisFill");if(h){const c=o.component,l=o.get("value"),d=o.get("endValue"),u=c.intervalDuration(),g=c.getPrivate("baseInterval"),m=c.getPrivate("gridInterval",g);let p=c.getPrivate("min",0);if(p=ae(new Date(p),m.timeUnit,m.count,this._root.locale.firstDayOfWeek,this._root.utc,void 0,this._root.timezone).getTime(),l!=null&&d!=null){const x=Math.round(Math.round((l-p)/u))/2;x==Math.round(x)?h.setPrivate("visible",!0):h.setPrivate("visible",!1)}}}}),i("GaplessDateAxis").setAll({fillRule:o=>{const h=o.get("axisFill");if(h){const c=o.get("index");let l=!1;b(c)&&c%2!=0||(l=!0),h.setPrivate("visible",l)}}}),i("ValueAxis").setAll({baseValue:0,logarithmic:!1,strictMinMax:!1,autoZoom:!0,fillRule:o=>{const h=o.get("axisFill");if(h){const c=o.component,l=o.get("value"),d=c.getPrivate("step");b(l)&&b(d)&&(X(l/d/2,5)==Math.round(l/d/2)?h.setPrivate("visible",!1):h.setPrivate("visible",!0))}}}),i("DurationAxis").setAll({baseUnit:"second"}),i("XYSeries").setAll({maskBullets:!0,stackToNegative:!0,locationX:.5,locationY:.5,snapTooltip:!1,openValueXGrouped:"open",openValueYGrouped:"open",valueXGrouped:"close",valueYGrouped:"close",seriesTooltipTarget:"series"}),i("BaseColumnSeries").setAll({adjustBulletPosition:!0}),i("ColumnSeries").setAll({clustered:!0}),i("RoundedRectangle",["series","column"]).setAll({position:"absolute",isMeasured:!1,width:N(70),height:N(70),strokeWidth:1,strokeOpacity:1,cornerRadiusBL:0,cornerRadiusTL:0,cornerRadiusBR:0,cornerRadiusTR:0,fillOpacity:1,role:"figure"}),i("LineSeries").setAll({connect:!0,autoGapCount:1.1,stackToNegative:!1}),i("Graphics",["series","stroke"]).setAll({position:"absolute",strokeWidth:1,strokeOpacity:1,isMeasured:!1}),i("Graphics",["series","fill"]).setAll({visible:!1,fillOpacity:0,position:"absolute",strokeWidth:0,strokeOpacity:0,isMeasured:!1}),i("Graphics",["line","series","legend","marker","stroke"]).setAll({draw:(o,h)=>{const c=h.parent;if(c){const l=c.height(),d=c.width();o.moveTo(0,l/2),o.lineTo(d,l/2)}}});{const o=i("Graphics",["line","series","legend","marker","stroke"]).states.create("disabled",{});M(o,"stroke",t,"disabled")}i("Graphics",["line","series","legend","marker","fill"]).setAll({draw:(o,h)=>{const c=h.parent;if(c){const l=c.height(),d=c.width();o.moveTo(0,0),o.lineTo(d,0),o.lineTo(d,l),o.lineTo(0,l),o.lineTo(0,0)}}});{const o=i("Graphics",["line","series","legend","marker","fill"]).states.create("disabled",{});M(o,"stroke",t,"disabled")}i("SmoothedXYLineSeries").setAll({tension:.5}),i("SmoothedXLineSeries").setAll({tension:.5}),i("SmoothedYLineSeries").setAll({tension:.5}),i("Candlestick").setAll({position:"absolute",isMeasured:!1,width:N(50),height:N(50),strokeWidth:1,strokeOpacity:1,cornerRadiusBL:0,cornerRadiusTL:0,cornerRadiusBR:0,cornerRadiusTR:0,fillOpacity:1,role:"figure"}),i("OHLC").setAll({width:N(80),height:N(80)}),i("CandlestickSeries").setAll({lowValueXGrouped:"low",lowValueYGrouped:"low",highValueXGrouped:"high",highValueYGrouped:"high",openValueXGrouped:"open",openValueYGrouped:"open",valueXGrouped:"close",valueYGrouped:"close"});{const o=i("Rectangle",["column","autocolor"]).states.create("riseFromOpen",{});M(o,"fill",t,"positive"),M(o,"stroke",t,"positive")}{const o=i("Rectangle",["column","autocolor"]).states.create("dropFromOpen",{});M(o,"fill",t,"negative"),M(o,"stroke",t,"negative")}i("Rectangle",["column","autocolor","pro"]).states.create("riseFromOpen",{fillOpacity:0}),i("Rectangle",["column","autocolor","pro"]).states.create("dropFromOpen",{fillOpacity:1});{const o=i("Rectangle",["column","autocolor","pro"]).states.create("riseFromPrevious",{});M(o,"fill",t,"positive"),M(o,"stroke",t,"positive")}{const o=i("Rectangle",["column","autocolor","pro"]).states.create("dropFromPrevious",{});M(o,"fill",t,"negative"),M(o,"stroke",t,"negative")}}}class nt extends Yt{constructor(){super(...arguments),Object.defineProperty(this,"xAxes",{enumerable:!0,configurable:!0,writable:!0,value:new ft}),Object.defineProperty(this,"yAxes",{enumerable:!0,configurable:!0,writable:!0,value:new ft}),Object.defineProperty(this,"topAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.chartContainer.children.push(T.new(this._root,{width:k,layout:this._root.verticalLayout}))}),Object.defineProperty(this,"yAxesAndPlotContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.chartContainer.children.push(T.new(this._root,{width:k,height:k,layout:this._root.horizontalLayout}))}),Object.defineProperty(this,"bottomAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.chartContainer.children.push(T.new(this._root,{width:k,layout:this._root.verticalLayout}))}),Object.defineProperty(this,"leftAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.yAxesAndPlotContainer.children.push(T.new(this._root,{height:k,layout:this._root.horizontalLayout}))}),Object.defineProperty(this,"plotsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.yAxesAndPlotContainer.children.push(T.new(this._root,{width:k,height:k,maskContent:!1}))}),Object.defineProperty(this,"plotContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotsContainer.children.push(T.new(this._root,{width:k,height:k}))}),Object.defineProperty(this,"topPlotContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotsContainer.children.push(T.new(this._root,{width:k,height:k}))}),Object.defineProperty(this,"gridContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotContainer.children.push(T.new(this._root,{width:k,height:k,isMeasured:!1}))}),Object.defineProperty(this,"topGridContainer",{enumerable:!0,configurable:!0,writable:!0,value:T.new(this._root,{width:k,height:k,isMeasured:!1})}),Object.defineProperty(this,"rightAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.yAxesAndPlotContainer.children.push(T.new(this._root,{height:k,layout:this._root.horizontalLayout}))}),Object.defineProperty(this,"axisHeadersContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotContainer.children.push(T.new(this._root,{}))}),Object.defineProperty(this,"zoomOutButton",{enumerable:!0,configurable:!0,writable:!0,value:this.topPlotContainer.children.push(oe.new(this._root,{themeTags:["zoom"],icon:Y.new(this._root,{themeTags:["button","icon"]})}))}),Object.defineProperty(this,"_movePoint",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),Object.defineProperty(this,"_wheelDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_otherCharts",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_movePoints",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_downStartX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_downEndX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_downStartY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_downEndY",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_afterNew(){this._defaultThemes.push(re.new(this._root)),super._afterNew(),this._disposers.push(this.xAxes),this._disposers.push(this.yAxes);const t=this._root;let e=this._root.verticalLayout;const i=this.zoomOutButton;i.events.on("click",()=>{this.zoomOut()}),i.hide(0),i.states.lookup("default").set("opacity",1),this.chartContainer.set("layout",e);const s=this.plotContainer;s.children.push(this.seriesContainer),this._disposers.push(this._processAxis(this.xAxes,this.bottomAxesContainer)),this._disposers.push(this._processAxis(this.yAxes,this.leftAxesContainer)),s.children.push(this.topGridContainer),s.children.push(this.bulletsContainer),s.set("interactive",!0),s.set("interactiveChildren",!1),s.set("background",H.new(t,{themeTags:["xy","background"],fill:$t.fromHex(0),fillOpacity:0})),this._disposers.push(s.events.on("pointerdown",a=>{this._handlePlotDown(a)})),this._disposers.push(s.events.on("globalpointerup",a=>{this._handlePlotUp(a)})),this._disposers.push(s.events.on("globalpointermove",a=>{this._handlePlotMove(a)})),this._maskGrid(),this._setUpTouch()}_beforeChanged(){super._beforeChanged(),(this.isDirty("pinchZoomX")||this.isDirty("pinchZoomY")||this.get("panX")||this.get("panY"))&&this._setUpTouch()}_setUpTouch(){this.plotContainer._display.cancelTouch||(this.plotContainer._display.cancelTouch=!!(this.get("pinchZoomX")||this.get("pinchZoomY")||this.get("panX")||this.get("panY")))}_maskGrid(){this.gridContainer.set("maskContent",!0),this.topGridContainer.set("maskContent",!0)}_removeSeries(t){t._unstack(),t._posXDp&&t._posXDp.dispose(),t._posYDp&&t._posYDp.dispose(),t.set("baseAxis",void 0);const e=t.get("xAxis");e&&(q(e.series,t),e.markDirtyExtremes());const i=t.get("yAxis");i&&(q(i.series,t),i.markDirtyExtremes());const s=this.get("cursor");if(s){const a=s.get("snapToSeries");a&&q(a,t)}super._removeSeries(t)}handleWheel(t){const e=this.get("wheelX"),i=this.get("wheelY"),s=this.plotContainer,a=t.originalEvent;if(!Kt(a,this))return;a.preventDefault();const r=s.toLocal(t.point),n=this.get("wheelStep",.2),o=a.deltaY/100,h=a.deltaX/100,c=this.get("wheelZoomPositionX"),l=this.get("wheelZoomPositionY");e!=="zoomX"&&e!=="zoomXY"||h==0||this.xAxes.each(d=>{if(d.get("zoomX")){let u=d.get("start"),g=d.get("end"),m=d.fixPosition(r.x/s.width());c!=null&&(m=c);let p=u-n*(g-u)*h*m,x=g+n*(g-u)*h*(1-m);1/(x-p){if(d.get("zoomX")){let u=d.get("start"),g=d.get("end"),m=d.fixPosition(r.x/s.width());c!=null&&(m=c);let p=u-n*(g-u)*o*m,x=g+n*(g-u)*o*(1-m);1/(x-p){if(d.get("zoomY")){let u=d.get("start"),g=d.get("end"),m=d.fixPosition(r.y/s.height());l!=null&&(m=l);let p=u-n*(g-u)*h*m,x=g+n*(g-u)*h*(1-m);1/(x-p){if(d.get("zoomY")){let u=d.get("start"),g=d.get("end"),m=d.fixPosition(r.y/s.height());l!=null&&(m=l);let p=u-n*(g-u)*o*m,x=g+n*(g-u)*o*(1-m);1/(x-p){if(d.get("panX")){let u=d.get("start"),g=d.get("end"),m=this._getWheelSign(d)*n*(g-u)*h,p=u+m,x=g+m,v=this._fixWheel(p,x);p=v[0],x=v[1],this._handleWheelAnimation(d.zoom(p,x))}}),i!=="panX"&&i!=="panXY"||o==0||this.xAxes.each(d=>{if(d.get("panX")){let u=d.get("start"),g=d.get("end"),m=this._getWheelSign(d)*n*(g-u)*o,p=u+m,x=g+m,v=this._fixWheel(p,x);p=v[0],x=v[1],this._handleWheelAnimation(d.zoom(p,x))}}),e!=="panY"&&e!=="panXY"||h==0||this.yAxes.each(d=>{if(d.get("panY")){let u=d.get("start"),g=d.get("end"),m=this._getWheelSign(d)*n*(g-u)*h,p=u+m,x=g+m,v=this._fixWheel(p,x);p=v[0],x=v[1],this._handleWheelAnimation(d.zoom(p,x))}}),i!=="panY"&&i!=="panXY"||o==0||this.yAxes.each(d=>{if(d.get("panY")){let u=d.get("start"),g=d.get("end"),m=this._getWheelSign(d)*n*(g-u)*o,p=u-m,x=g-m,v=this._fixWheel(p,x);p=v[0],x=v[1],this._handleWheelAnimation(d.zoom(p,x))}})}_handleSetWheel(){const t=this.get("wheelX"),e=this.get("wheelY"),i=this.plotContainer;t!=="none"||e!=="none"?(this._wheelDp=i.events.on("wheel",s=>{const a=s.originalEvent;(t!=="none"&&Math.abs(a.deltaX)!=0||e!=="none"&&Math.abs(a.deltaY)!=0)&&this.handleWheel(s)}),this._disposers.push(this._wheelDp)):this._wheelDp&&this._wheelDp.dispose()}_getWheelSign(t){let e=1;return t.get("renderer").get("inversed")&&(e=-1),e}_fixWheel(t,e){const i=e-t;return t<0&&(e=(t=0)+i),e>1&&(t=(e=1)-i),[t,e]}_handlePlotDown(t){const e=t.originalEvent;if(e.button==2)return;const i=this.plotContainer;let s=i.toLocal(t.point);if((this.get("pinchZoomX")||this.get("pinchZoomY"))&&e.pointerId&&et(i._downPoints).length>0){const a=this.xAxes.getIndex(0),r=this.yAxes.getIndex(0);a&&(this._downStartX=a.get("start",0),this._downEndX=a.get("end",1)),r&&(this._downStartY=r.get("start",0),this._downEndY=r.get("end",1))}if((this.get("panX")||this.get("panY"))&&s.x>=0&&s.y>=0&&s.x<=i.width()&&s.y<=this.height()){this._downPoint={x:e.clientX,y:e.clientY};const a=this.get("panX"),r=this.get("panY");a&&this.xAxes.each(o=>{o._panStart=o.get("start"),o._panEnd=o.get("end")}),r&&this.yAxes.each(o=>{o._panStart=o.get("start"),o._panEnd=o.get("end")});const n="panstarted";this.events.isEnabled(n)&&this.events.dispatch(n,{type:n,target:this,originalEvent:t.originalEvent})}}_handleWheelAnimation(t){t?t.events.on("stopped",()=>{this._dispatchWheelAnimation()}):this._dispatchWheelAnimation()}_dispatchWheelAnimation(){const t="wheelended";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this})}_handlePlotUp(t){const e=this._downPoint;if(e&&(this.get("panX")||this.get("panY"))){let i=this.plotContainer.toLocal(t.point);if(i.x==e.x&&i.y==e.y){const a="pancancelled";this.events.isEnabled(a)&&this.events.dispatch(a,{type:a,target:this,originalEvent:t.originalEvent})}const s="panended";this.events.isEnabled(s)&&this.events.dispatch(s,{type:s,target:this,originalEvent:t.originalEvent})}this._downPoint=void 0,this.xAxes.each(i=>{i._isPanning=!1}),this.yAxes.each(i=>{i._isPanning=!1})}_handlePlotMove(t){const e=this.plotContainer;if(this.get("pinchZoomX")||this.get("pinchZoomY")){const s=t.pointerId;if(s&&(this._movePoints[s]=t.point,et(e._downPoints).length>1))return void this._handlePinch()}let i=this._downPoint;if(i){i=e.toLocal(this._root.documentPointToRoot(i));let s=e.toLocal(t.point);const a=this.get("panX"),r=this.get("panY");if(a){let n=this.get("scrollbarX");n&&n.events.disableType("rangechanged"),this.xAxes.each(o=>{if(o.get("panX")){o._isPanning=!0;let h=o._panStart,c=o._panEnd,l=(c-h)*(i.x-s.x)/e.width();o.get("renderer").get("inversed")&&(l*=-1);let d=h+l,u=c+l;u-d<1+2*o.get("maxDeviation",1)&&(o.set("start",d),o.set("end",u))}}),n&&n.events.enableType("rangechanged")}if(r){let n=this.get("scrollbarY");n&&n.events.disableType("rangechanged"),this.yAxes.each(o=>{if(o.get("panY")){o._isPanning=!0;let h=o._panStart,c=o._panEnd,l=(c-h)*(i.y-s.y)/e.height();o.get("renderer").get("inversed")&&(l*=-1);let d=h-l,u=c-l;u-d<1+2*o.get("maxDeviation",1)&&(o.set("start",d),o.set("end",u))}}),n&&n.events.enableType("rangechanged")}}}_handlePinch(){const t=this.plotContainer;let e=0,i=[],s=[];if(J(t._downPoints,(a,r)=>{i[e]=r;let n=this._movePoints[a];n&&(s[e]=n),e++}),i.length>1&&s.length>1){const a=t.width(),r=t.height();let n=i[0],o=i[1],h=s[0],c=s[1];if(n&&o&&h&&c){if(h=t.toLocal(h),c=t.toLocal(c),n=t.toLocal(n),o=t.toLocal(o),this.get("pinchZoomX")){const l=this._downStartX,d=this._downEndX;if(l!=null&&d!=null){n.x>o.x&&([n,o]=[o,n],[h,c]=[c,h]);let u=l+n.x/a*(d-l),g=l+o.x/a*(d-l),m=l+h.x/a*(d-l),p=l+c.x/a*(d-l),x=Math.max(.001,g-u)/Math.max(.001,p-m),v=l*x+u-m*x,_=d*x+g-p*x;this.xAxes.each(f=>{let w=f.fixPosition(v),A=f.fixPosition(_);f.zoom(w,A,0)})}}if(this.get("pinchZoomY")){const l=this._downStartY,d=this._downEndY;if(l!=null&&d!=null){n.y{let w=f.fixPosition(v),A=f.fixPosition(_);f.zoom(w,A,0)})}}}}}_handleCursorPosition(){const t=this.get("cursor");if(t){const e=t.getPrivate("point");let i=t.get("snapToSeries");if(t._downPoint&&(i=void 0),i&&e){const s=t.get("snapToSeriesBy"),a=[];P(i,o=>{if(!o.isHidden()&&!o.isHiding())if(s!="x!"&&s!="y!"){const h=o.startIndex(),c=o.endIndex();for(let l=h;l{const h=o.get("point");if(h){let c=0;c=s=="x"||s=="x!"?Math.abs(e.x-h.x):s=="y"||s=="y!"?Math.abs(e.y-h.y):Math.hypot(e.x-h.x,e.y-h.y),c{const h=o.get("tooltip");h&&h._setDataItem(void 0)}),r){let o=r.component;o.showDataItemTooltip(r);const h=r.get("point");h&&t.handleMove(o.toGlobal({x:h.x-o.x(),y:h.y-o.y()}),!0)}}}}_updateCursor(){let t=this.get("cursor");t&&t.updateCursor()}_addCursor(t){this.plotContainer.children.push(t)}_prepareChildren(){if(super._prepareChildren(),this.series.each(t=>{this._colorize(t)}),(this.isDirty("wheelX")||this.isDirty("wheelY"))&&this._handleSetWheel(),this.isDirty("cursor")){const t=this._prevSettings.cursor,e=this.get("cursor");e!==t&&(this._disposeProperty("cursor"),t&&t.dispose(),e&&(e._setChart(this),this._addCursor(e),this._pushPropertyDisposer("cursor",e.events.on("selectended",()=>{this._handleCursorSelectEnd()}))),this._prevSettings.cursor=e)}if(this.isDirty("scrollbarX")){const t=this._prevSettings.scrollbarX,e=this.get("scrollbarX");e!==t&&(this._disposeProperty("scrollbarX"),t&&t.dispose(),e&&(e.parent||this.topAxesContainer.children.push(e),this._pushPropertyDisposer("scrollbarX",e.events.on("rangechanged",i=>{this._handleScrollbar(this.xAxes,i.start,i.end,i.grip)})),e.setPrivate("positionTextFunction",i=>{const s=this.xAxes.getIndex(0);return s&&s.getTooltipText(i,!1)||""})),this._prevSettings.scrollbarX=e)}if(this.isDirty("scrollbarY")){const t=this._prevSettings.scrollbarY,e=this.get("scrollbarY");e!==t&&(this._disposeProperty("scrollbarY"),t&&t.dispose(),e&&(e.parent||this.rightAxesContainer.children.push(e),this._pushPropertyDisposer("scrollbarY",e.events.on("rangechanged",i=>{this._handleScrollbar(this.yAxes,i.start,i.end,i.grip)})),e.setPrivate("positionTextFunction",i=>{const s=this.yAxes.getIndex(0);return s&&s.getTooltipText(i,!1)||""})),this._prevSettings.scrollbarY=e)}this._handleZoomOut()}_processSeries(t){super._processSeries(t);const e=t.get("xAxis"),i=t.get("yAxis");vt(e.series,t),vt(i.series,t),t._posXDp=t.addDisposer(e.events.on("positionchanged",()=>{t._fixPosition()})),t._posXDp=t.addDisposer(i.events.on("positionchanged",()=>{t._fixPosition()})),t.get("baseAxis")||(i.isType("CategoryAxis")||i.isType("DateAxis")?t.set("baseAxis",i):t.set("baseAxis",e)),t.get("stacked")&&(t._markDirtyKey("stacked"),P(t.dataItems,s=>{s.set("stackToItemY",void 0),s.set("stackToItemX",void 0)})),t._markDirtyAxes(),i.markDirtyExtremes(),e.markDirtyExtremes(),this._colorize(t)}_colorize(t){const e=this.get("colors");if(e&&t.get("fill")==null){const i=e.next();t._setSoft("stroke",i),t._setSoft("fill",i)}}_handleCursorSelectEnd(){const t=this.get("cursor"),e=t.get("behavior"),i=t.getPrivate("downPositionX",0),s=t.getPrivate("downPositionY",0),a=Math.min(1,Math.max(0,t.getPrivate("positionX",.5))),r=Math.min(1,Math.max(0,t.getPrivate("positionY",.5)));this.xAxes.each(n=>{if(e==="zoomX"||e==="zoomXY"){let o=n.toAxisPosition(i),h=n.toAxisPosition(a);n.zoom(o,h)}n.setPrivate("updateScrollbar",!0)}),this.yAxes.each(n=>{if(e==="zoomY"||e==="zoomXY"){let o=n.toAxisPosition(s),h=n.toAxisPosition(r);n.zoom(o,h)}n.setPrivate("updateScrollbar",!0)})}_handleScrollbar(t,e,i,s){t.each(a=>{let r=a.fixPosition(e),n=a.fixPosition(i),o=a.zoom(r,n,void 0,s);const h="updateScrollbar";a.setPrivateRaw(h,!1),o?o.events.on("stopped",()=>{a.setPrivateRaw(h,!0)}):a.setPrivateRaw(h,!0)})}_processAxis(t,e){return t.events.onAll(i=>{if(i.type==="clear")P(i.oldValues,s=>{this._removeAxis(s)});else if(i.type==="push")e.children.push(i.newValue),i.newValue.processChart(this);else if(i.type==="setIndex")e.children.setIndex(i.index,i.newValue),i.newValue.processChart(this);else if(i.type==="insertIndex")e.children.insertIndex(i.index,i.newValue),i.newValue.processChart(this);else if(i.type==="removeIndex")this._removeAxis(i.oldValue);else{if(i.type!=="moveIndex")throw new Error("Unknown IListEvent type");e.children.moveValue(i.value,i.newIndex),i.value.processChart(this)}})}_removeAxis(t){if(!t.isDisposed()){const e=t.parent;e&&e.children.removeValue(t);const i=t.gridContainer,s=i.parent;s&&s.children.removeValue(i);const a=t.topGridContainer,r=a.parent;r&&r.children.removeValue(a)}}_updateChartLayout(){const t=this.leftAxesContainer.width(),e=this.rightAxesContainer.width(),i=this.bottomAxesContainer;i.set("paddingLeft",t),i.set("paddingRight",e);const s=this.topAxesContainer;s.set("paddingLeft",t),s.set("paddingRight",e)}processAxis(t){this.get("cursor")&&(this.addDisposer(t.on("start",()=>{this._updateCursor()})),this.addDisposer(t.on("end",()=>{this._updateCursor()})))}_handleAxisSelection(t,e){let i=t.fixPosition(t.get("start",0)),s=t.fixPosition(t.get("end",1));if(i>s&&([i,s]=[s,i]),this.xAxes.indexOf(t)!=-1){if(e||t.getPrivate("updateScrollbar")){let a=this.get("scrollbarX");!a||a.getPrivate("isBusy")&&!e||(a.setRaw("start",i),a.setRaw("end",s),a.updateGrips())}}else if(this.yAxes.indexOf(t)!=-1&&(e||t.getPrivate("updateScrollbar"))){let a=this.get("scrollbarY");!a||a.getPrivate("isBusy")&&!e||(a.setRaw("start",i),a.setRaw("end",s),a.updateGrips())}this._handleZoomOut()}_handleZoomOut(){let t=this.zoomOutButton;if(t&&t.parent){let e=!1;this.xAxes.each(i=>{i.get("start")==0&&i.get("end")==1||(e=!0)}),this.yAxes.each(i=>{i.get("start")==0&&i.get("end")==1||(e=!0)}),e?t.isHidden()&&t.show():t.hide()}}inPlot(t){const e=this.plotContainer,i=this.getPrivate("otherCharts",this._otherCharts),s=e.toGlobal(t);if(t.x>=-.5&&t.y>=-.5&&t.x<=e.width()+.5&&t.y<=e.height()+.5)return!0;if(i)for(let a=i.length-1;a>=0;a--){const r=i[a];if(r!=this){const n=r.plotContainer,o=this._root.rootPointToDocument(s),h=r._root.documentPointToRoot(o),c=n.toLocal(h);if(c.x>=-.1&&c.y>=-.1&&c.x<=n.width()+.1&&c.y<=n.height()+.1)return!0}}return!1}arrangeTooltips(){const t=this.plotContainer,e=t.width(),i=t.height(),s=this.height();let a=t._display.toGlobal({x:0,y:0}),r=t._display.toGlobal({x:e,y:i});const n=[];let o,h,c=0,l=1/0,d=this._movePoint,u=this.get("maxTooltipDistance"),g=this.get("maxTooltipDistanceBy","xy");b(u)&&this.series.each(p=>{if(!p.isHidden()){const x=p.get("tooltip");if(x){let v=x.get("pointTo");if(v){let _=Math.hypot(d.x-v.x,d.y-v.y);g=="x"?_=Math.abs(d.x-v.x):g=="y"&&(_=Math.abs(d.y-v.y)),_{const x=p.get("tooltip");if(x){let v=!1,_=x.get("pointTo");if(_){if(u>=0){let f=x.get("pointTo");if(f&&p!=o){let w=Math.hypot(h.x-f.x,h.y-f.y);g=="x"?w=Math.abs(h.x-f.x):g=="y"&&(w=Math.abs(h.y-f.y)),w>u&&(v=!0)}}else u==-1&&p!=o&&(v=!0);this.inPlot(this._tooltipToLocal(_))&&x.dataItem?v||(c+=_.y):v=!0,v||p.isHidden()||p.isHiding()?x.hide(0):(x.show(),n.push(x),m.push(p))}}}),this.setPrivate("tooltipSeries",m),this.get("arrangeTooltips")){const p=this._root.tooltipContainer,x=n.length;if(c/x>i/2+a.y){n.sort((_,f)=>yt(f.get("pointTo").y,_.get("pointTo").y));let v=r.y;if(P(n,_=>{let f=_.height(),w=_.get("centerY");w instanceof Mt&&(f*=w.value),f+=_.get("marginBottom",0),_.set("bounds",{left:a.x,top:a.y,right:r.x,bottom:v}),_.setPrivate("customData",{left:a.x,top:a.y,right:r.x,bottom:v}),v=Math.min(v-f,_._fy-f),_.parent==p&&p.children.moveValue(_,0)}),v<0){n.reverse();let _=v;P(n,f=>{let w=f.get("bounds");if(w){let A=w.top-v,F=w.bottom-v;A<_&&(A=_,F=A+f.height()),f.set("bounds",{left:w.left,top:A,right:w.right,bottom:F}),_=w.bottom-v+f.get("marginBottom",0)}})}}else{n.reverse(),n.sort((_,f)=>yt(_.get("pointTo").y,f.get("pointTo").y));let v=0;if(P(n,_=>{let f=_.height(),w=_.get("centerY");w instanceof Mt&&(f*=w.value),f+=_.get("marginBottom",0),_.set("bounds",{left:a.x,top:v,right:r.x,bottom:Math.max(a.y+s,v+f)}),_.parent==p&&p.children.moveValue(_,0),v=Math.max(v+f,_._fy+f)}),v>s){n.reverse();let _=s;P(n,f=>{let w=f.get("bounds");if(w){let A=w.top-(s-v),F=w.bottom-(s-v);F>_&&(F=_,A=F-f.height()),f.set("bounds",{left:w.left,top:A,right:w.right,bottom:F}),_=F-f.height()-f.get("marginBottom",0)}})}}}}_tooltipToLocal(t){return this.plotContainer.toLocal(t)}zoomOut(){this.xAxes.each(t=>{t.setPrivate("updateScrollbar",!0),t.zoom(0,1)}),this.yAxes.each(t=>{t.setPrivate("updateScrollbar",!0),t.zoom(0,1)})}}Object.defineProperty(nt,"className",{enumerable:!0,configurable:!0,writable:!0,value:"XYChart"}),Object.defineProperty(nt,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Yt.classNames.concat([nt.className])});class z extends Y{_beforeChanged(){super._beforeChanged(),(this.isPrivateDirty("width")||this.isPrivateDirty("height"))&&(this._clear=!0)}}Object.defineProperty(z,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Grid"}),Object.defineProperty(z,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Y.classNames.concat([z.className])});class rt extends T{constructor(){super(...arguments),Object.defineProperty(this,"lineX",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(z.new(this._root,{themeTags:["x"]}))}),Object.defineProperty(this,"lineY",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(z.new(this._root,{themeTags:["y"]}))}),Object.defineProperty(this,"selection",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(Y.new(this._root,{themeTags:["selection","cursor"],layer:30}))}),Object.defineProperty(this,"_movePoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_lastPoint",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),Object.defineProperty(this,"_tooltipX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_tooltipY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"chart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_toX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_toY",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_afterNew(){this._settings.themeTags=S(this._settings.themeTags,["xy","cursor"]),super._afterNew(),this.setAll({width:k,height:k,isMeasured:!0,position:"absolute"}),this.states.create("hidden",{visible:!0,opacity:0}),this._drawLines(),this.setPrivateRaw("visible",!1),this._disposers.push(this.setTimeout(()=>{this.setPrivate("visible",!0)},500)),this._disposers.push(this.lineX.events.on("positionchanged",()=>{this._handleXLine()})),this._disposers.push(this.lineY.events.on("positionchanged",()=>{this._handleYLine()})),this._disposers.push(this.lineX.events.on("focus",t=>this._handleLineFocus(t.target))),this._disposers.push(this.lineX.events.on("blur",t=>this._handleLineBlur(t.target))),this._disposers.push(this.lineY.events.on("focus",t=>this._handleLineFocus(t.target))),this._disposers.push(this.lineY.events.on("blur",t=>this._handleLineBlur(t.target))),wt("keyboardevents")&&this._disposers.push(qt(document,"keydown",t=>{this._handleLineMove(t.keyCode)}))}_setUpTouch(){const t=this.chart;t&&(t.plotContainer._display.cancelTouch=this.get("behavior")!="none")}_handleXLine(){let t=this.lineX.x(),e=!0;(t<0||t>this.width())&&(e=!1),this.lineX.setPrivate("visible",e)}_handleYLine(){let t=this.lineY.y(),e=!0;(t<0||t>this.height())&&(e=!1),this.lineY.setPrivate("visible",e)}_handleLineMove(t){let e="",i=0,s=.1;const a=this.chart;this._root.focused(this.lineX)?(a&&a.xAxes.length&&(s=a.xAxes.getIndex(0).getCellWidthPosition()),i=this.getPrivate("positionX",0),e="positionX",t==37?i-=s:t==39&&(i+=s)):this._root.focused(this.lineY)&&(a&&a.yAxes.length&&(s=a.yAxes.getIndex(0).getCellWidthPosition()),i=this.getPrivate("positionY",0),e="positionY",t==38?i-=s:t==40&&(i+=s)),i<0?i=0:i>1&&(i=1),e!=""&&this.set(e,i)}_handleLineFocus(t){this.setAll({positionX:this.getPrivate("positionX"),positionY:this.getPrivate("positionY"),alwaysShow:!0})}_handleLineBlur(t){this.setAll({positionX:void 0,positionY:void 0,alwaysShow:!1})}_prepareChildren(){if(super._prepareChildren(),this.isDirty("xAxis")){this._tooltipX=!1;const t=this.get("xAxis");if(t){const e=t.get("tooltip");e&&(this._tooltipX=!0,this._disposers.push(e.on("pointTo",()=>{this._updateXLine(e)})))}}if(this.isDirty("yAxis")){this._tooltipY=!1;const t=this.get("yAxis");if(t){const e=t.get("tooltip");e&&(this._tooltipY=!0,this._disposers.push(e.on("pointTo",()=>{this._updateYLine(e)})))}}}_handleSyncWith(){const t=this.chart;if(t){const e=this.get("syncWith"),i=[];e&&P(e,s=>{const a=s.chart;a&&i.push(a)}),t._otherCharts=i}}_updateChildren(){if(super._updateChildren(),this._handleSyncWith(),this.isDirty("positionX")||this.isDirty("positionY")){const t=this.get("positionX"),e=this.get("positionY");t==null&&e==null?this.hide(0):(this._movePoint=this.toGlobal(this._getPoint(this.get("positionX",0),this.get("positionY",0))),this.handleMove())}}_updateXLine(t){let e=X(this._display.toLocal(t.get("pointTo",{x:0,y:0})).x,2);this._toX!=e&&(this.lineX.animate({key:"x",to:e,duration:t.get("animationDuration",0),easing:t.get("animationEasing")}),this._toX=e)}_updateYLine(t){let e=X(this._display.toLocal(t.get("pointTo",{x:0,y:0})).y,2);this._toY!=e&&(this.lineY.animate({key:"y",to:e,duration:t.get("animationDuration",0),easing:t.get("animationEasing")}),this._toY=e)}_drawLines(){this.lineX.set("draw",t=>{t.moveTo(0,0),t.lineTo(0,this.height())}),this.lineY.set("draw",t=>{t.moveTo(0,0),t.lineTo(this.width(),0)})}updateCursor(){this.get("alwaysShow")&&(this._movePoint=this.toGlobal(this._getPoint(this.get("positionX",0),this.get("positionY",0)))),this.handleMove()}_setChart(t){this.chart=t,this._handleSyncWith();const e=t.plotContainer;this.events.on("boundschanged",()=>{this._disposers.push(this.setTimeout(()=>{this.updateCursor()},50))}),wt("touchevents")&&(this._disposers.push(e.events.on("click",s=>{Jt(s.originalEvent)&&this._handleMove(s)})),this._setUpTouch()),this._disposers.push(e.events.on("pointerdown",s=>{this._handleCursorDown(s)})),this._disposers.push(e.events.on("globalpointerup",s=>{this._handleCursorUp(s),s.native||this.isHidden()||this._handleMove(s)})),this._disposers.push(e.events.on("globalpointermove",s=>{(this.get("syncWith")||et(e._downPoints).length!=0||s.native||!this.isHidden())&&this._handleMove(s)}));const i=this.parent;i&&i.children.moveValue(this.selection)}_inPlot(t){const e=this.chart;return!!e&&e.inPlot(t)}_handleCursorDown(t){if(t.originalEvent.button==2)return;const e=t.point;let i=this._display.toLocal(e);const s=this.chart;if(this.selection.set("draw",()=>{}),s&&this._inPlot(i)){if(this._downPoint=i,this.get("behavior")!="none"){this.selection.show();const n="selectstarted";this.events.isEnabled(n)&&this.events.dispatch(n,{type:n,target:this,originalEvent:t.originalEvent})}let a=this._getPosition(i).x,r=this._getPosition(i).y;this.setPrivate("downPositionX",a),this.setPrivate("downPositionY",r)}}_handleCursorUp(t){if(this._downPoint){const e=this.get("behavior","none");if(e!="none"){e.charAt(0)==="z"&&this.selection.hide();const i=t.point;let s=this._display.toLocal(i);const a=this._downPoint,r=this.get("moveThreshold",1);if(s&&a){let n=!1;if(e!=="zoomX"&&e!=="zoomXY"&&e!=="selectX"&&e!=="selectXY"||Math.abs(s.x-a.x)>r&&(n=!0),e!=="zoomY"&&e!=="zoomXY"&&e!=="selectY"&&e!=="selectXY"||Math.abs(s.y-a.y)>r&&(n=!0),n){const o="selectended";this.events.isEnabled(o)&&this.events.dispatch(o,{type:o,target:this,originalEvent:t.originalEvent})}else{const o="selectcancelled";this.events.isEnabled(o)&&this.events.dispatch(o,{type:o,target:this,originalEvent:t.originalEvent})}}}}this._downPoint=void 0}_handleMove(t){if(this.getPrivate("visible")){const e=this.chart;if(e&&et(e.plotContainer._downPoints).length>1)return void this.set("forceHidden",!0);this.set("forceHidden",!1);const i=t.point,s=this._lastPoint;if(Math.round(s.x)===Math.round(i.x)&&Math.round(s.y)===Math.round(i.y))return;this._lastPoint=i,this.setPrivate("lastPoint",i),this.handleMove({x:i.x,y:i.y},!1,t.originalEvent)}}_getPosition(t){return{x:t.x/this.width(),y:t.y/this.height()}}handleMove(t,e,i){t||(t=this._movePoint);const s=this.get("alwaysShow");if(!t)return void this.hide(0);this._movePoint=t;let a=this._display.toLocal(t),r=this.chart;if(r&&(this._inPlot(a)||this._downPoint)){r._movePoint=t,this.isHidden()&&(this.show(),this.get("behavior","").charAt(0)=="z"&&this.selection.set("draw",()=>{}));let n=a.x,o=a.y,h=this._getPosition(a);this.setPrivate("point",a);let c=this.get("snapToSeries");this._downPoint&&(c=void 0);let l=this.get("positionX"),d=h.x;b(l)&&(d=l);let u=this.get("positionY"),g=h.y;b(u)&&(g=u),this.setPrivate("positionX",d),this.setPrivate("positionY",g);const m=this._getPoint(d,g);if(n=m.x,o=m.y,r.xAxes.each(p=>{p._handleCursorPosition(d,c),s&&p.handleCursorShow()}),r.yAxes.each(p=>{p._handleCursorPosition(g,c),s&&p.handleCursorShow()}),!e){r._handleCursorPosition();const p="cursormoved";this.events.isEnabled(p)&&this.events.dispatch(p,{type:p,target:this,point:t,originalEvent:i})}this._updateLines(n,o),r.arrangeTooltips()}else if(!this._downPoint&&!s){this.hide(0);const n="cursorhidden";this.events.isEnabled(n)&&this.events.dispatch(n,{type:n,target:this})}this._downPoint&&this.get("behavior")!="none"&&this._updateSelection(a)}_getPoint(t,e){return{x:this.width()*t,y:this.height()*e}}_updateLines(t,e){this._tooltipX||this.lineX.set("x",t),this._tooltipY||this.lineY.set("y",e),this._drawLines()}_updateSelection(t){const e=this.selection,i=this.get("behavior"),s=this.width(),a=this.height();t.x<0&&(t.x=0),t.x>s&&(t.x=s),t.y<0&&(t.y=0),t.y>a&&(t.y=a),e.set("draw",r=>{const n=this._downPoint;n&&(i==="zoomXY"||i==="selectXY"?(r.moveTo(n.x,n.y),r.lineTo(n.x,t.y),r.lineTo(t.x,t.y),r.lineTo(t.x,n.y),r.lineTo(n.x,n.y)):i==="zoomX"||i==="selectX"?(r.moveTo(n.x,0),r.lineTo(n.x,a),r.lineTo(t.x,a),r.lineTo(t.x,0),r.lineTo(n.x,0)):i!=="zoomY"&&i!=="selectY"||(r.moveTo(0,n.y),r.lineTo(s,n.y),r.lineTo(s,t.y),r.lineTo(0,t.y),r.lineTo(0,n.y)))})}_onHide(){if(this.isHidden()){let t=this.chart;t&&(t.xAxes.each(e=>{e.handleCursorHide()}),t.yAxes.each(e=>{e.handleCursorHide()}),t.series.each(e=>{e.handleCursorHide()}))}super._onHide()}_onShow(){if(!this.isHidden()){let t=this.chart;t&&(t.xAxes.each(e=>{e.handleCursorShow()}),t.yAxes.each(e=>{e.handleCursorShow()}))}super._onShow()}_dispose(){super._dispose(),this.selection.dispose()}}function le(y,t){return y==null?t:t==null?y:ty?t:y}Object.defineProperty(rt,"className",{enumerable:!0,configurable:!0,writable:!0,value:"XYCursor"}),Object.defineProperty(rt,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:T.classNames.concat([rt.className])});class W extends Lt{constructor(){super(...arguments),Object.defineProperty(this,"_xField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_xOpenField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yOpenField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_xLowField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_xHighField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yLowField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yHighField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_axesDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_stackDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_selectionProcessed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataSets",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_mainContainerMask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_x",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_y",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"mainContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(T.new(this._root,{}))}),Object.defineProperty(this,"axisRanges",{enumerable:!0,configurable:!0,writable:!0,value:new Ot}),Object.defineProperty(this,"_skipped",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_couldStackTo",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_reallyStackedTo",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_stackedSeries",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_aLocationX0",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_aLocationX1",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_aLocationY0",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_aLocationY1",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_showBullets",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"valueXFields",{enumerable:!0,configurable:!0,writable:!0,value:["valueX","openValueX","lowValueX","highValueX"]}),Object.defineProperty(this,"valueYFields",{enumerable:!0,configurable:!0,writable:!0,value:["valueY","openValueY","lowValueY","highValueY"]}),Object.defineProperty(this,"_valueXFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valueYFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valueXShowFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valueYShowFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__valueXShowFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__valueYShowFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_emptyDataItem",{enumerable:!0,configurable:!0,writable:!0,value:new st(this,void 0,{})}),Object.defineProperty(this,"_dataSetId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipFieldX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipFieldY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_posXDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_posYDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_afterNew(){this.fields.push("categoryX","categoryY","openCategoryX","openCategoryY"),this.valueFields.push("valueX","valueY","openValueX","openValueY","lowValueX","lowValueY","highValueX","highValueY"),this._setRawDefault("vcx",1),this._setRawDefault("vcy",1),this._setRawDefault("valueXShow","valueXWorking"),this._setRawDefault("valueYShow","valueYWorking"),this._setRawDefault("openValueXShow","openValueXWorking"),this._setRawDefault("openValueYShow","openValueYWorking"),this._setRawDefault("lowValueXShow","lowValueXWorking"),this._setRawDefault("lowValueYShow","lowValueYWorking"),this._setRawDefault("highValueXShow","highValueXWorking"),this._setRawDefault("highValueYShow","highValueYWorking"),this._setRawDefault("lowValueXGrouped","low"),this._setRawDefault("lowValueYGrouped","low"),this._setRawDefault("highValueXGrouped","high"),this._setRawDefault("highValueYGrouped","high"),super._afterNew(),this.set("maskContent",!0),this._disposers.push(this.axisRanges.events.onAll(t=>{if(t.type==="clear")P(t.oldValues,e=>{this._removeAxisRange(e)});else if(t.type==="push")this._processAxisRange(t.newValue);else if(t.type==="setIndex")this._processAxisRange(t.newValue);else if(t.type==="insertIndex")this._processAxisRange(t.newValue);else if(t.type==="removeIndex")this._removeAxisRange(t.oldValue);else{if(t.type!=="moveIndex")throw new Error("Unknown IStreamEvent type");this._processAxisRange(t.value)}})),this.states.create("hidden",{opacity:1,visible:!1}),this._makeFieldNames()}_processAxisRange(t){const e=T.new(this._root,{});t.container=e,this.children.push(e),t.series=this;const i=t.axisDataItem;i.setRaw("isRange",!0);const s=i.component;if(s){s._processAxisRange(i,["range","series"]);const a=i.get("bullet");if(a){const n=a.get("sprite");n&&n.setPrivate("visible",!1)}const r=i.get("axisFill");r&&e.set("mask",r),s._seriesAxisRanges.push(i)}}_removeAxisRange(t){const e=t.axisDataItem,i=e.component;i.disposeDataItem(e),q(i._seriesAxisRanges,e);const s=t.container;s&&s.dispose()}_updateFields(){super._updateFields(),this._valueXFields=[],this._valueYFields=[],this._valueXShowFields=[],this._valueYShowFields=[],this.__valueXShowFields=[],this.__valueYShowFields=[],this.valueXFields&&P(this.valueXFields,t=>{if(this.get(t+"Field")){this._valueXFields.push(t);let e=this.get(t+"Show");this.__valueXShowFields.push(e),e.indexOf("Working")!=-1?this._valueXShowFields.push(e.split("Working")[0]):this._valueXShowFields.push(e)}}),this.valueYFields&&P(this.valueYFields,t=>{if(this.get(t+"Field")){this._valueYFields.push(t);let e=this.get(t+"Show");this.__valueYShowFields.push(e),e.indexOf("Working")!=-1?this._valueYShowFields.push(e.split("Working")[0]):this._valueYShowFields.push(e)}})}_dispose(){super._dispose();const t=this.chart;t&&t.series.removeValue(this),Pt(this.get("xAxis").series,this),Pt(this.get("yAxis").series,this)}_min(t,e){let i=le(this.getPrivate(t),e);this.setPrivate(t,i)}_max(t,e){let i=he(this.getPrivate(t),e);this.setPrivate(t,i)}_shouldMakeBullet(t){const e=this.get("xAxis"),i=this.get("yAxis"),s=this.get("baseAxis");if(!e.inited||!i.inited)return!1;const a=this.get("minBulletDistance",0);if(a>0){let r=this.startIndex(),n=this.endIndex()-r;if(e==s){if(e.get("renderer").axisLength()/n{P(this._valueXShowFields,o=>{let h=n.get(o);h!=null&&(r&&(h+=this.getStackedXValue(n,o)),this._min("minX",h),this._max("maxX",h))}),P(this._valueYShowFields,o=>{let h=n.get(o);h!=null&&(r&&(h+=this.getStackedYValue(n,o)),this._min("minY",h),this._max("maxY",h))}),t.processSeriesDataItem(n,this._valueXFields),e.processSeriesDataItem(n,this._valueYFields)}),t._seriesValuesDirty=!0,e._seriesValuesDirty=!0,this.get("ignoreMinMax")||((this.isPrivateDirty("minX")||this.isPrivateDirty("maxX"))&&t.markDirtyExtremes(),(this.isPrivateDirty("minY")||this.isPrivateDirty("maxY"))&&e.markDirtyExtremes()),this._markStakedDirtyStack(),this.get("tooltipDataItem")||this.updateLegendValue(void 0)),(this.isDirty("vcx")||this.isDirty("vcy"))&&this._markStakedDirtyStack(),this._dataGrouped||(t._groupSeriesData(this),e._groupSeriesData(this),this._dataGrouped=!0),this._valuesDirty||this.isPrivateDirty("startIndex")||this.isPrivateDirty("endIndex")||this.isDirty("vcx")||this.isDirty("vcy")||this._stackDirty){let n=this.startIndex(),o=this.endIndex(),h=this.get("minBulletDistance",0);if(h>0&&i&&(i.get("renderer").axisLength()/(o-n)>h?this._showBullets=!0:this._showBullets=!1),(this._psi!=n||this._pei!=o||this.isDirty("vcx")||this.isDirty("vcy")||this._stackDirty||this._valuesDirty)&&!this._selectionProcessed){this._selectionProcessed=!0;const c=this.get("vcx",1),l=this.get("vcy",1),d=this.get("stacked",!1),u=this.getPrivate("outOfSelection");if(i===t||!i)if(e._calculateTotals(),this.setPrivateRaw("selectionMinY",void 0),this.setPrivateRaw("selectionMaxY",void 0),u)e.markDirtySelectionExtremes();else for(let g=n;g0){let t=this._mainContainerMask;t==null&&(t=this.children.push(Y.new(this._root,{})),this._mainContainerMask=t,t.set("draw",(e,i)=>{const s=this.parent;if(s){const a=this._root.container.width(),r=this._root.container.height();e.moveTo(-a,-r),e.lineTo(-a,2*r),e.lineTo(2*a,2*r),e.lineTo(2*a,-r),e.lineTo(-a,-r),this.axisRanges.each(n=>{const o=n.axisDataItem.get("axisFill");if(s&&o){let h=o.get("draw");h&&h(e,i)}})}this.mainContainer._display.mask=t._display})),t.markDirty(),t._markDirtyKey("fill")}else this.mainContainer._display.mask=null}_updateChildren(){super._updateChildren(),this._x=this.x(),this._y=this.y(),this._makeRangeMask()}_stack(){const t=this.chart;if(t){const e=t.series.indexOf(this);if(this._couldStackTo=[],e>0){let i;for(let s=e-1;s>=0&&(i=t.series.getIndex(s),i.get("xAxis")!==this.get("xAxis")||i.get("yAxis")!==this.get("yAxis")||i.className!==this.className||(this._couldStackTo.push(i),i.get("stacked")));s--);}this._stackDataItems()}}_unstack(){J(this._reallyStackedTo,(t,e)=>{delete e._stackedSeries[this.uid]}),this._reallyStackedTo={},P(this.dataItems,t=>{t.setRaw("stackToItemY",void 0),t.setRaw("stackToItemX",void 0)})}_stackDataItems(){const t=this.get("baseAxis"),e=this.get("xAxis"),i=this.get("yAxis");let s,a;t===e?(s="valueY",a="stackToItemY"):t===i&&(s="valueX",a="stackToItemX");let r=this._couldStackTo.length,n=0;const o=this.get("stackToNegative");this._reallyStackedTo={},P(this.dataItems,h=>{for(let c=0;c=0&&g>=0){h.setRaw(a,d),this._reallyStackedTo[l.uid]=l,l._stackedSeries[this.uid]=this;break}if(u<0&&g<0){h.setRaw(a,d),this._reallyStackedTo[l.uid]=l,l._stackedSeries[this.uid]=this;break}}}else if(b(u)&&b(g)){h.setRaw(a,d),this._reallyStackedTo[l.uid]=l,l._stackedSeries[this.uid]=this;break}}}n++})}processXSelectionDataItem(t,e,i){P(this.__valueXShowFields,s=>{let a=t.get(s);a!=null&&(i&&(a+=this.getStackedXValueWorking(t,s)),this._min("selectionMinX",a),this._max("selectionMaxX",a*e))})}processYSelectionDataItem(t,e,i){P(this.__valueYShowFields,s=>{let a=t.get(s);a!=null&&(i&&(a+=this.getStackedYValueWorking(t,s)),this._min("selectionMinY",a),this._max("selectionMaxY",a*e))})}getStackedYValueWorking(t,e){const i=t.get("stackToItemY");if(i){const s=i.component;return i.get(e,0)*s.get("vcy",1)+this.getStackedYValueWorking(i,e)}return 0}getStackedXValueWorking(t,e){const i=t.get("stackToItemX");if(i){const s=i.component;return i.get(e,0)*s.get("vcx",1)+this.getStackedXValueWorking(i,e)}return 0}getStackedYValue(t,e){const i=t.get("stackToItemY");return i?i.get(e,0)+this.getStackedYValue(i,e):0}getStackedXValue(t,e){const i=t.get("stackToItemX");return i?i.get(e,0)+this.getStackedXValue(i,e):0}createLegendMarker(t){this.updateLegendMarker()}_markDirtyAxes(){this._axesDirty=!0,this.markDirty()}_markDataSetDirty(){this._afterDataChange(),this._valuesDirty=!0,this._dataProcessed=!1,this._aggregatesCalculated=!1,this.markDirty()}_clearDirty(){super._clearDirty(),this._axesDirty=!1,this._selectionProcessed=!1,this._stackDirty=!1,this._dataProcessed=!1}_positionBullet(t){let e=t.get("sprite");if(e){let i=e.dataItem,s=t.get("locationX",i.get("locationX",.5)),a=t.get("locationY",i.get("locationY",.5)),r=this.get("xAxis"),n=this.get("yAxis");const o=r.getDataItemPositionX(i,this._xField,s,this.get("vcx",1)),h=n.getDataItemPositionY(i,this._yField,a,this.get("vcy",1));let c=this.getPoint(o,h),l=i.get("left",c.x),d=i.get("right",c.x),u=i.get("top",c.y),g=i.get("bottom",c.y);if(this._shouldShowBullet(o,h)){t.getPrivate("hidden")?e.setPrivate("visible",!1):e.setPrivate("visible",!0);let m=d-l,p=g-u;e.isType("Label")&&(e.setPrivate("maxWidth",Math.abs(m)),e.setPrivate("maxHeight",Math.abs(p)));let x=l+m*s,v=g-p*a;e.set("x",x),e.set("y",v)}else e.setPrivate("visible",!1)}}_shouldShowBullet(t,e){return this._showBullets}setDataSet(t){if(this._dataSets[t]){this._handleDataSetChange(),this._dataItems=this._dataSets[t],this._markDataSetDirty(),this._dataSetId=t;const e="datasetchanged";this.events.isEnabled(e)&&this.events.dispatch(e,{type:e,target:this,id:t})}}resetGrouping(){J(this._dataSets,(t,e)=>{e!=this._mainDataItems&&P(e,i=>{this.disposeDataItem(i)})}),this._dataSets={},this._dataItems=this.mainDataItems}_handleDataSetChange(){this.bullets.length>0&&P(this._dataItems,t=>{let e=t.bullets;e&&P(e,i=>{if(i){let s=i.get("sprite");s&&s.setPrivate("visible",!1)}})}),this._selectionProcessed=!1}show(t){const e=Object.create(null,{show:{get:()=>super.show}});return K(this,void 0,void 0,function*(){this._fixVC();let i=[];i.push(e.show.call(this,t).then(()=>{this._isShowing=!1;let s=this.get("xAxis"),a=this.get("yAxis"),r=this.get("baseAxis");a!==r&&a.markDirtySelectionExtremes(),s!==r&&s.markDirtySelectionExtremes()})),i.push(this.bulletsContainer.show(t)),i.push(this._sequencedShowHide(!0,t)),yield Promise.all(i)})}hide(t){const e=Object.create(null,{hide:{get:()=>super.hide}});return K(this,void 0,void 0,function*(){this._fixVC();let i=[];i.push(e.hide.call(this,t).then(()=>{this._isHiding=!1})),i.push(this.bulletsContainer.hide(t)),i.push(this._sequencedShowHide(!1,t)),yield Promise.all(i)})}showDataItem(t,e){const i=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return K(this,void 0,void 0,function*(){const s=[i.showDataItem.call(this,t,e)];b(e)||(e=this.get("stateAnimationDuration",0));const a=this.get("stateAnimationEasing");P(this._valueFields,r=>{s.push(t.animate({key:r+"Working",to:t.get(r),duration:e,easing:a}).waitForStop())}),yield Promise.all(s)})}hideDataItem(t,e){const i=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return K(this,void 0,void 0,function*(){const s=[i.hideDataItem.call(this,t,e)],a=this.states.create("hidden",{});b(e)||(e=a.get("stateAnimationDuration",this.get("stateAnimationDuration",0)));const r=a.get("stateAnimationEasing",this.get("stateAnimationEasing")),n=this.get("xAxis"),o=this.get("yAxis"),h=this.get("baseAxis"),c=this.get("stacked");if(h!==n&&h||P(this._valueYFields,l=>{let d=o.getPrivate("min"),u=o.baseValue();b(d)&&d>u&&(u=d),c&&(u=0),t.get(l)!=null&&s.push(t.animate({key:l+"Working",to:u,duration:e,easing:r}).waitForStop())}),h===o||!h){let l=n.getPrivate("min"),d=n.baseValue();b(l)&&l>d&&(d=l),c&&(d=0),P(this._valueXFields,u=>{t.get(u)!=null&&s.push(t.animate({key:u+"Working",to:d,duration:e,easing:r}).waitForStop())})}yield Promise.all(s)})}_markDirtyStack(){this._stackDirty=!0,this.markDirty(),this._markStakedDirtyStack()}_markStakedDirtyStack(){const t=this._stackedSeries;t&&J(t,(e,i)=>{i._stackDirty||i._markDirtyStack()})}_afterChanged(){super._afterChanged(),this._skipped&&(this._markDirtyAxes(),this._skipped=!1)}showDataItemTooltip(t){this.updateLegendMarker(t),this.updateLegendValue(t);const e=this.get("tooltip");if(e){if(this.isHidden())this.hideTooltip();else if(e._setDataItem(t),t){let i=this.get("locationX",0),s=this.get("locationY",1),a=t.get("locationX",i),r=t.get("locationY",s);const n=this.get("xAxis"),o=this.get("yAxis"),h=this.get("vcx",1),c=this.get("vcy",1),l=n.getDataItemPositionX(t,this._tooltipFieldX,this._aLocationX0+(this._aLocationX1-this._aLocationX0)*a,h),d=o.getDataItemPositionY(t,this._tooltipFieldY,this._aLocationY0+(this._aLocationY1-this._aLocationY0)*r,c),u=this.getPoint(l,d);let g=!0;if(P(this._valueFields,m=>{t.get(m)==null&&(g=!1)}),g){const m=this.chart;m&&m.inPlot(u)?(e.label.text.markDirtyText(),e.set("tooltipTarget",this._getTooltipTarget(t)),e.set("pointTo",this._display.toGlobal({x:u.x,y:u.y}))):e._setDataItem(void 0)}else e._setDataItem(void 0)}}}hideTooltip(){const t=this.get("tooltip");return t&&t.set("tooltipTarget",this),super.hideTooltip()}_getTooltipTarget(t){if(this.get("seriesTooltipTarget")=="bullet"){const e=t.bullets;if(e&&e.length>0){const i=e[0].get("sprite");if(i)return i}}return this}updateLegendValue(t){const e=this.get("legendDataItem");if(e){const i=e.get("label");if(i){let a="";t?(i._setDataItem(t),a=this.get("legendLabelText",i.get("text",this.get("name","")))):(i._setDataItem(this._emptyDataItem),a=this.get("legendRangeLabelText",this.get("legendLabelText",i.get("text",this.get("name",""))))),i.set("text",a)}const s=e.get("valueLabel");if(s){let a="";t?(s._setDataItem(t),a=this.get("legendValueText",s.get("text",""))):(s._setDataItem(this._emptyDataItem),a=this.get("legendRangeValueText",s.get("text",""))),s.set("text",a)}}}_getItemReaderLabel(){let t="X: {"+this._xField;return this.get("xAxis").isType("DateAxis")&&(t+=".formatDate()"),t+="}; Y: {"+this._yField,this.get("yAxis").isType("DateAxis")&&(t+=".formatDate()"),t+="}",t}getPoint(t,e){let i=this.get("xAxis").get("renderer").positionToCoordinate(t),s=this.get("yAxis").get("renderer").positionToCoordinate(e),a=999999999;return s<-a&&(s=-a),s>a&&(s=a),i<-a&&(i=-a),i>a&&(i=a),{x:i,y:s}}_shouldInclude(t){return!0}handleCursorHide(){this.hideTooltip(),this.updateLegendValue(void 0),this.updateLegendMarker(void 0)}_afterDataChange(){super._afterDataChange(),this.get("xAxis")._markDirtyKey("start"),this.get("yAxis")._markDirtyKey("start"),this.resetExtremes()}resetExtremes(){this.setPrivate("selectionMinX",void 0),this.setPrivate("selectionMaxX",void 0),this.setPrivate("selectionMinY",void 0),this.setPrivate("selectionMaxY",void 0),this.setPrivate("minX",void 0),this.setPrivate("minY",void 0),this.setPrivate("maxX",void 0),this.setPrivate("maxY",void 0)}createAxisRange(t){return this.axisRanges.push({axisDataItem:t})}get mainDataItems(){return this._mainDataItems}}Object.defineProperty(W,"className",{enumerable:!0,configurable:!0,writable:!0,value:"XYSeries"}),Object.defineProperty(W,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Lt.classNames.concat([W.className])});class U extends Ft{constructor(){super(...arguments),Object.defineProperty(this,"_series",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_isPanning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"labelsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(T.new(this._root,{}))}),Object.defineProperty(this,"gridContainer",{enumerable:!0,configurable:!0,writable:!0,value:T.new(this._root,{width:k,height:k})}),Object.defineProperty(this,"topGridContainer",{enumerable:!0,configurable:!0,writable:!0,value:T.new(this._root,{width:k,height:k})}),Object.defineProperty(this,"bulletsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(T.new(this._root,{isMeasured:!1,width:k,height:k,position:"absolute"}))}),Object.defineProperty(this,"chart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rangesDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_panStart",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_panEnd",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_sAnimation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_eAnimation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_skipSync",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"axisRanges",{enumerable:!0,configurable:!0,writable:!0,value:new Ot}),Object.defineProperty(this,"_seriesAxisRanges",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"ghostLabel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_cursorPosition",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"_snapToSeries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_seriesValuesDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"axisHeader",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(T.new(this._root,{themeTags:["axis","header"],position:"absolute",background:H.new(this._root,{themeTags:["header","background"],fill:this._root.interfaceColors.get("background")})}))}),Object.defineProperty(this,"_bullets",{enumerable:!0,configurable:!0,writable:!0,value:{}})}_dispose(){this.gridContainer.dispose(),this.topGridContainer.dispose(),this.bulletsContainer.dispose(),this.labelsContainer.dispose(),this.axisHeader.dispose(),super._dispose()}_afterNew(){super._afterNew(),this.setPrivate("updateScrollbar",!0),this._disposers.push(this.axisRanges.events.onAll(e=>{if(e.type==="clear")P(e.oldValues,i=>{this.disposeDataItem(i)});else if(e.type==="push")this._processAxisRange(e.newValue,["range"]);else if(e.type==="setIndex")this._processAxisRange(e.newValue,["range"]);else if(e.type==="insertIndex")this._processAxisRange(e.newValue,["range"]);else if(e.type==="removeIndex")this.disposeDataItem(e.oldValue);else{if(e.type!=="moveIndex")throw new Error("Unknown IStreamEvent type");this._processAxisRange(e.value,["range"])}}));const t=this.get("renderer");t&&(t.axis=this,t.processAxis()),this.children.push(t),this.ghostLabel=t.makeLabel(new st(this,void 0,{}),[]),this.ghostLabel.adapters.disable("text"),this.ghostLabel.setAll({opacity:0,tooltipText:void 0,tooltipHTML:void 0,interactive:!1}),this.ghostLabel.events.disable()}_updateFinals(t,e){}zoom(t,e,i,s){if(this._updateFinals(t,e),this.get("start")!==t||this.get("end")!=e){let a=this._sAnimation,r=this._eAnimation,n=this.get("maxDeviation",.5)*Math.min(1,e-t);t<-n&&(t=-n),e>1+n&&(e=1+n),t>e&&([t,e]=[e,t]),b(i)||(i=this.get("interpolationDuration",0)),s||(s="end");let o=this.getPrivate("maxZoomFactor",this.get("maxZoomFactor",100)),h=o;e===1&&t!==0&&(s=tthis.get("end")?"end":"start");let c=this.get("minZoomCount"),l=this.get("maxZoomCount");b(c)&&(o=h/c);let d=1;if(b(l)&&(d=h/l),s==="start"?(l>0&&1/(e-t)o&&(e=t+1/o),e>1&&e-t<1/o&&(t=e-1/o)):(l>0&&1/(e-t)o&&(t=e-1/o),t<0&&e-t<1/o&&(e=t+1/o)),1/(e-t)>o&&(e=t+1/o),1/(e-t)>o&&(t=e-1/o),l!=null&&c!=null&&t==this.get("start")&&e==this.get("end")){const u=this.chart;u&&u._handleAxisSelection(this,!0)}if((a&&a.playing&&a.to==t||this.get("start")==t)&&(r&&r.playing&&r.to==e||this.get("end")==e))return;if(i>0){let u,g,m=this.get("interpolationEasing");if(this.get("start")!=t&&(u=this.animate({key:"start",to:t,duration:i,easing:m})),this.get("end")!=e&&(g=this.animate({key:"end",to:e,duration:i,easing:m})),this._sAnimation=u,this._eAnimation=g,u)return u;if(g)return g}else this.set("start",t),this.set("end",e),this._root.events.once("frameended",()=>{this._markDirtyKey("start"),this._root._markDirty()})}else this._sAnimation&&this._sAnimation.stop(),this._eAnimation&&this._eAnimation.stop()}get series(){return this._series}_processAxisRange(t,e){t.setRaw("isRange",!0),this._createAssets(t,e),this._rangesDirty=!0,this._prepareDataItem(t);const i=t.get("above"),s=this.topGridContainer,a=t.get("grid");i&&a&&s.children.moveValue(a);const r=t.get("axisFill");i&&r&&s.children.moveValue(r)}_prepareDataItem(t,e){}markDirtyExtremes(){}markDirtySelectionExtremes(){}_calculateTotals(){}_updateAxisRanges(){this._bullets={},this.axisRanges.each(t=>{this._prepareDataItem(t)}),P(this._seriesAxisRanges,t=>{this._prepareDataItem(t)})}_prepareChildren(){if(super._prepareChildren(),this.get("fixAxisSize")?this.ghostLabel.set("visible",!0):this.ghostLabel.set("visible",!1),this.isDirty("start")||this.isDirty("end")){this.chart._updateCursor();let e=this.get("start",0),i=this.get("end",1),s=this.get("maxDeviation",.5)*Math.min(1,i-e);if(e<-s){let a=e+s;e=-s,this.setRaw("start",e),this.isDirty("end")&&this.setRaw("end",i-a)}if(i>1+s){let a=i-1-s;i=1+s,this.setRaw("end",i),this.isDirty("start")&&this.setRaw("start",e-a)}}const t=this.get("renderer");if(t._start=this.get("start"),t._end=this.get("end"),t._inversed=t.get("inversed",!1),t._axisLength=t.axisLength()/(t._end-t._start),t._updateLC(),this.isDirty("tooltip")){const e=this.get("tooltip");if(e){const i=t.get("themeTags");e.addTag("axis"),e.addTag(this.className.toLowerCase()),e._applyThemes(),i&&(e.set("themeTags",S(e.get("themeTags"),i)),e.label._applyThemes())}}}_updateTooltipBounds(){const t=this.get("tooltip");t&&this.get("renderer").updateTooltipBounds(t)}_updateBounds(){super._updateBounds(),this._updateTooltipBounds()}processChart(t){this.chart=t,this.get("renderer").chart=t,t.gridContainer.children.push(this.gridContainer),t.topGridContainer.children.push(this.topGridContainer),t.axisHeadersContainer.children.push(this.axisHeader),this.on("start",()=>{t._handleAxisSelection(this)}),this.on("end",()=>{t._handleAxisSelection(this)}),t.plotContainer.onPrivate("width",()=>{this.markDirtySize()}),t.plotContainer.onPrivate("height",()=>{this.markDirtySize()}),t.processAxis(this)}hideDataItem(t){return this._toggleDataItem(t,!1),super.hideDataItem(t)}showDataItem(t){return this._toggleDataItem(t,!0),super.showDataItem(t)}_toggleDataItem(t,e){const i=t.get("label");i&&i.setPrivate("visible",e);const s=t.get("grid");s&&s.setPrivate("visible",e);const a=t.get("tick");a&&a.setPrivate("visible",e);const r=t.get("axisFill");r&&r.setPrivate("visible",e);const n=t.get("bullet");if(n){const o=n.get("sprite");o&&o.setPrivate("visible",e)}}_createAssets(t,e){const i=this.get("renderer");t.get("label")||i.makeLabel(t,e),t.get("grid")||i.makeGrid(t,e),t.get("tick")||i.makeTick(t,e),t.get("axisFill")||i.makeAxisFill(t,e),this._processBullet(t)}_processBullet(t){let e=t.get("bullet"),i=this.get("bullet");if(e||!i||t.get("isRange")||(e=i(this._root,this,t)),e){e.axis=this;const s=e.get("sprite");s&&(s._setDataItem(t),t.setRaw("bullet",e),s.parent||this.bulletsContainer.children.push(s))}}_afterChanged(){super._afterChanged();const t=this.chart;t&&(t._updateChartLayout(),t.axisHeadersContainer.markDirtySize()),this.get("renderer")._updatePositions()}disposeDataItem(t){super.disposeDataItem(t);const e=this.get("renderer"),i=t.get("label");i&&(e.labels.removeValue(i),i.dispose());const s=t.get("tick");s&&(e.ticks.removeValue(s),s.dispose());const a=t.get("grid");a&&(e.grid.removeValue(a),a.dispose());const r=t.get("axisFill");r&&(e.axisFills.removeValue(r),r.dispose());const n=t.get("bullet");n&&n.dispose()}_updateGhost(){this.setPrivate("cellWidth",this.getCellWidthPosition()*this.get("renderer").axisLength());const t=this.ghostLabel;if(!t.isHidden()){const s=t.localBounds(),a=s.right-s.left;let r=t.get("text");P(this.dataItems,n=>{const o=n.get("label");if(o&&!o.isHidden()){const h=o.localBounds();h.right-h.left>a&&(r=o.text._getText())}}),t.set("text",r)}let e=this.get("start",0),i=this.get("end",1);this.get("renderer").updateLabel(t,e+.5*(i-e))}_handleCursorPosition(t,e){t=this.get("renderer").toAxisPosition(t),this._cursorPosition=t,this._snapToSeries=e,this.updateTooltip()}updateTooltip(){const t=this._snapToSeries;let e=this._cursorPosition;const i=this.get("tooltip"),s=this.get("renderer");b(e)&&(P(this.series,a=>{if(a.get("baseAxis")===this){const r=this.getSeriesItem(a,e,this.get("tooltipLocation"));a.setRaw("tooltipDataItem",r),t&&t.indexOf(a)!=-1?(a.updateLegendMarker(r),a.updateLegendValue(r)):a.showDataItemTooltip(r)}}),i&&(s.updateTooltipBounds(i),this.get("snapTooltip")&&(e=this.roundAxisPosition(e,this.get("tooltipLocation",.5))),B(e)?i.hide(0):(this.setPrivateRaw("tooltipPosition",e),this._updateTooltipText(i,e),s.positionTooltip(i,e),ethis.get("end")?i.hide(0):i.show(0))))}_updateTooltipText(t,e){t.label.set("text",this.getTooltipText(e))}roundAxisPosition(t,e){return t}handleCursorShow(){let t=this.get("tooltip");t&&t.show()}handleCursorHide(){let t=this.get("tooltip");t&&t.hide()}processSeriesDataItem(t,e){}_clearDirty(){super._clearDirty(),this._sizeDirty=!1,this._rangesDirty=!1}coordinateToPosition(t){const e=this.get("renderer");return e.toAxisPosition(t/e.axisLength())}toAxisPosition(t){return this.get("renderer").toAxisPosition(t)}toGlobalPosition(t){return this.get("renderer").toGlobalPosition(t)}fixPosition(t){return this.get("renderer").fixPosition(t)}shouldGap(t,e,i,s){return!1}createAxisRange(t){return this.axisRanges.push(t)}_groupSeriesData(t){}getCellWidthPosition(){return .05}}Object.defineProperty(U,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Axis"}),Object.defineProperty(U,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Ft.classNames.concat([U.className])});class lt extends U{constructor(){super(...arguments),Object.defineProperty(this,"_dirtyExtremes",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dirtySelectionExtremes",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_deltaMinMax",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_minReal",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_maxReal",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_baseValue",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_syncDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_minLogAdjusted",{enumerable:!0,configurable:!0,writable:!0,value:1})}markDirtyExtremes(){this._dirtyExtremes=!0,this.markDirty()}markDirtySelectionExtremes(){this._dirtySelectionExtremes=!0,this.markDirty()}_afterNew(){this._settings.themeTags=S(this._settings.themeTags,["axis"]),this.setPrivateRaw("name","value"),this.addTag("value"),super._afterNew()}_prepareChildren(){if(super._prepareChildren(),this.isDirty("syncWithAxis")){this._prevSettings.syncWithAxis&&this._syncDp&&this._syncDp.dispose();let t=this.get("syncWithAxis");t&&(this._syncDp=new Qt([t.onPrivate("selectionMinFinal",()=>{this._dirtySelectionExtremes=!0}),t.onPrivate("selectionMaxFinal",()=>{this._dirtySelectionExtremes=!0})]))}(this._sizeDirty||this._dirtyExtremes||this._valuesDirty||this.isPrivateDirty("width")||this.isPrivateDirty("height")||this.isDirty("min")||this.isDirty("max")||this.isDirty("extraMin")||this.isDirty("extraMax")||this.isDirty("logarithmic")||this.isDirty("treatZeroAs")||this.isDirty("baseValue")||this.isDirty("strictMinMax")||this.isDirty("strictMinMaxSelection")||this.isDirty("maxPrecision")||this.isDirty("numberFormat"))&&(this._getMinMax(),this.ghostLabel.set("text",""),this._dirtyExtremes=!1),this._dirtySelectionExtremes&&!this._isPanning&&this.get("autoZoom",!0)&&(this._getSelectionMinMax(),this._dirtySelectionExtremes=!1),this._groupData(),(this._sizeDirty||this._valuesDirty||this.isDirty("start")||this.isDirty("end")||this.isPrivateDirty("min")||this.isPrivateDirty("selectionMax")||this.isPrivateDirty("selectionMin")||this.isPrivateDirty("max")||this.isPrivateDirty("step")||this.isPrivateDirty("width")||this.isPrivateDirty("height")||this.isDirty("logarithmic"))&&(this._handleRangeChange(),this._prepareAxisItems(),this._updateAxisRanges()),this._baseValue=this.baseValue()}_groupData(){}_formatText(t){const e=this.get("numberFormat"),i=this.getNumberFormatter();let s="";return s=e?i.format(t,e):i.format(t,void 0,this.getPrivate("stepDecimalPlaces")),s}_prepareAxisItems(){const t=this.getPrivate("min"),e=this.getPrivate("max");if(b(t)&&b(e)){const i=this.get("logarithmic"),s=this.getPrivate("step"),a=this.getPrivate("selectionMin"),r=this.getPrivate("selectionMax")+s;let n=a-s,o=0,h=1,c=t;if(i){if(n=this._minLogAdjusted,n2&&(n=Math.pow(10,Math.log(c)*Math.LOG10E-5))}let l=-1/0;for(;n2?n=Math.pow(10,Math.log(c)*Math.LOG10E+o-5):n+=s,l==n)break;let g=Math.pow(10,Math.floor(Math.log(Math.abs(s))*Math.LOG10E));if(g<1){let m=Math.round(Math.abs(Math.log(Math.abs(g))*Math.LOG10E))+2;n=X(n,m)}o++,l=n}for(let d=o;d{d.inited&&d._markDirtyAxes()}),this._updateGhost()}}_prepareDataItem(t,e){let i=this.get("renderer"),s=t.get("value"),a=t.get("endValue"),r=this.valueToPosition(s),n=r,o=this.valueToPosition(s+this.getPrivate("step"));b(a)&&(n=this.valueToPosition(a),o=n),t.get("isRange")&&a==null&&(o=r),i.updateLabel(t.get("label"),r,n,e);const h=t.get("grid");if(i.updateGrid(h,r,n),h&&(s==this.get("baseValue",0)?(h.addTag("base"),h._applyThemes()):h.hasTag("base")&&(h.removeTag("base"),h._applyThemes())),i.updateTick(t.get("tick"),r,n,e),i.updateFill(t.get("axisFill"),r,o),this._processBullet(t),i.updateBullet(t.get("bullet"),r,n),!t.get("isRange")){const c=this.get("fillRule");c&&c(t)}}_handleRangeChange(){let t=this.positionToValue(this.get("start",0)),e=this.positionToValue(this.get("end",1));const i=this.get("renderer").gridCount();let s=this._adjustMinMax(t,e,i,!0),a=te(s.step);this.setPrivateRaw("stepDecimalPlaces",a),t=X(t,a),e=X(e,a),s=this._adjustMinMax(t,e,i,!0);let r=s.step;t=s.min,e=s.max,this.getPrivate("selectionMin")===t&&this.getPrivate("selectionMax")===e&&this.getPrivate("step")===r||(this.setPrivateRaw("selectionMin",t),this.setPrivateRaw("selectionMax",e),this.setPrivateRaw("step",r))}positionToValue(t){const e=this.getPrivate("min"),i=this.getPrivate("max");return this.get("logarithmic")?Math.pow(Math.E,(t*(Math.log(i)*Math.LOG10E-Math.log(e)*Math.LOG10E)+Math.log(e)*Math.LOG10E)/Math.LOG10E):t*(i-e)+e}valueToPosition(t){const e=this.getPrivate("min"),i=this.getPrivate("max");if(this.get("logarithmic")){if(t<=0){let s=this.get("treatZeroAs");b(s)&&(t=s)}return(Math.log(t)*Math.LOG10E-Math.log(e)*Math.LOG10E)/(Math.log(i)*Math.LOG10E-Math.log(e)*Math.LOG10E)}return(t-e)/(i-e)}valueToFinalPosition(t){const e=this.getPrivate("minFinal"),i=this.getPrivate("maxFinal");if(this.get("logarithmic")){if(t<=0){let s=this.get("treatZeroAs");b(s)&&(t=s)}return(Math.log(t)*Math.LOG10E-Math.log(e)*Math.LOG10E)/(Math.log(i)*Math.LOG10E-Math.log(e)*Math.LOG10E)}return(t-e)/(i-e)}getX(t,e,i){t=i+(t-i)*e;const s=this.valueToPosition(t);return this._settings.renderer.positionToCoordinate(s)}getY(t,e,i){t=i+(t-i)*e;const s=this.valueToPosition(t);return this._settings.renderer.positionToCoordinate(s)}getDataItemCoordinateX(t,e,i,s){return this._settings.renderer.positionToCoordinate(this.getDataItemPositionX(t,e,i,s))}getDataItemPositionX(t,e,i,s){let a=t.get(e);return t.get("stackToItemX")?a=a*s+t.component.getStackedXValueWorking(t,e):a=this._baseValue+(a-this._baseValue)*s,this.valueToPosition(a)}getDataItemCoordinateY(t,e,i,s){return this._settings.renderer.positionToCoordinate(this.getDataItemPositionY(t,e,i,s))}getDataItemPositionY(t,e,i,s){let a=t.get(e);return t.get("stackToItemY")?a=a*s+t.component.getStackedYValueWorking(t,e):a=this._baseValue+(a-this._baseValue)*s,this.valueToPosition(a)}basePosition(){return this.valueToPosition(this.baseValue())}baseValue(){const t=Math.min(this.getPrivate("minFinal",-1/0),this.getPrivate("selectionMin",-1/0)),e=Math.max(this.getPrivate("maxFinal",1/0),this.getPrivate("selectionMax",1/0));let i=this.get("baseValue",0);return ie&&(i=e),i}cellEndValue(t){return t}fixSmallStep(t){return 1+t===1?(t*=2,this.fixSmallStep(t)):t}_fixMin(t){return t}_fixMax(t){return t}_calculateTotals(){if(this.get("calculateTotals")){let t=this.series[0];if(t){let e=t.startIndex();if(t.dataItems.length>0){e>0&&e--;let i,s,a=t.endIndex();a{if(!c.get("excludeFromTotal")){let l=c.dataItems[n];if(l){let d=l.get(r)*c.get(s);B(d)||(o+=d,h+=Math.abs(d))}}}),P(this.series,c=>{if(!c.get("excludeFromTotal")){let l=c.dataItems[n];if(l){let d=l.get(r)*c.get(s);B(d)||(l.set(i+"Total",h),l.set(i+"Sum",o),l.set(i+"TotalPercent",d/h*100))}}})}}}}}_getSelectionMinMax(){const t=this.getPrivate("minFinal"),e=this.getPrivate("maxFinal"),i=this.get("min"),s=this.get("max");let a=this.get("extraMin",0),r=this.get("extraMax",0);this.get("logarithmic")&&(this.get("extraMin")==null&&(a=.1),this.get("extraMax")==null&&(r=.2));const n=this.get("renderer").gridCount(),o=this.get("strictMinMaxSelection"),h=this.get("strictMinMax");if(b(t)&&b(e)){let c=e,l=t;if(P(this.series,_=>{if(!_.get("ignoreMinMax")){let f,w;const A=_.getPrivate("outOfSelection");_.get("xAxis")===this?A||(f=_.getPrivate("selectionMinX",_.getPrivate("minX")),w=_.getPrivate("selectionMaxX",_.getPrivate("maxX"))):_.get("yAxis")===this&&(A||(f=_.getPrivate("selectionMinY",_.getPrivate("minY")),w=_.getPrivate("selectionMaxY",_.getPrivate("maxY")))),_.isHidden()||_.isShowing()||(b(f)&&(c=Math.min(c,f)),b(w)&&(l=Math.max(l,w)))}}),this.axisRanges.each(_=>{if(_.get("affectsMinMax")){let f=_.get("value");f!=null&&(c=Math.min(c,f),l=Math.max(l,f)),f=_.get("endValue"),f!=null&&(c=Math.min(c,f),l=Math.max(l,f))}}),c>l&&([c,l]=[l,c]),b(i)?c=h?i:t:h&&b(this._minReal)&&(c=this._minReal),b(s)?l=h?s:e:h&&b(this._maxReal)&&(l=this._maxReal),c===l){c-=this._deltaMinMax,l+=this._deltaMinMax;let _=this._adjustMinMax(c,l,n,h);c=_.min,l=_.max}let d=c,u=l;c-=(l-c)*a,l+=(l-c)*r;let g=this._adjustMinMax(c,l,n);c=g.min,l=g.max,c=At(c,t,e),l=At(l,t,e),g=this._adjustMinMax(c,l,n,!0),h||(c=g.min,l=g.max);const m=this.get("syncWithAxis");m&&(g=this._syncAxes(c,l,g.step,m.getPrivate("selectionMinFinal",m.getPrivate("minFinal",0)),m.getPrivate("selectionMaxFinal",m.getPrivate("maxFinal",1)),m.getPrivate("selectionStepFinal",m.getPrivate("step",1))),c=g.min,l=g.max),h&&(b(i)&&(c=Math.max(c,i)),b(s)&&(l=Math.min(l,s))),o&&(c=d-(l-c)*a,l=u+(l-c)*r),this.get("logarithmic")&&(c<=0&&(c=d*(1-Math.min(a,.99))),ce&&(l=e));let p=Math.min(20,Math.ceil(Math.log(this.getPrivate("maxZoomFactor",100)+1)/Math.LN10)+2),x=X(this.valueToFinalPosition(c),p),v=X(this.valueToFinalPosition(l),p);this.setPrivateRaw("selectionMinFinal",c),this.setPrivateRaw("selectionMaxFinal",l),this.setPrivateRaw("selectionStepFinal",g.step),this.zoom(x,v)}}_getMinMax(){let t=this.get("min"),e=this.get("max"),i=1/0,s=-1/0,a=this.get("extraMin",0),r=this.get("extraMax",0);this.get("logarithmic")&&(this.get("extraMin")==null&&(a=.1),this.get("extraMax")==null&&(r=.2));let n=1/0;if(P(this.series,_=>{if(!_.get("ignoreMinMax")){let f,w;if(_.get("xAxis")===this?(f=_.getPrivate("minX"),w=_.getPrivate("maxX")):_.get("yAxis")===this&&(f=_.getPrivate("minY"),w=_.getPrivate("maxY")),b(f)&&b(w)){i=Math.min(i,f),s=Math.max(s,w);let A=w-f;A<=0&&(A=Math.abs(w/100)),A{if(_.get("affectsMinMax")){let f=_.get("value");f!=null&&(i=Math.min(i,f),s=Math.max(s,f)),f=_.get("endValue"),f!=null&&(i=Math.min(i,f),s=Math.max(s,f))}}),this.get("logarithmic")){let _=this.get("treatZeroAs");b(_)&&i<=0&&(i=_)}if(i===0&&s===0&&(s=.9,i=-.9),b(t)&&(i=t),b(e)&&(s=e),i===1/0||s===-1/0)return this.setPrivate("minFinal",void 0),void this.setPrivate("maxFinal",void 0);const o=i,h=s;let c=this.adapters.fold("min",i),l=this.adapters.fold("max",s);b(c)&&(i=c),b(l)&&(s=l),i=this._fixMin(i),s=this._fixMax(s),s-i<=1/Math.pow(10,15)&&(s-i!=0?this._deltaMinMax=(s-i)/2:this._getDelta(s),i-=this._deltaMinMax,s+=this._deltaMinMax),i-=(s-i)*a,s+=(s-i)*r,this.get("logarithmic")&&(i<0&&o>=0&&(i=0),s>0&&h<=0&&(s=0)),this._minReal=i,this._maxReal=s;let d=this.get("strictMinMax"),u=this.get("strictMinMaxSelection",!1);u&&(d=u);let g=d;b(e)&&(g=!0);let m=this.get("renderer").gridCount(),p=this._adjustMinMax(i,s,m,g);i=p.min,s=p.max,p=this._adjustMinMax(i,s,m,!0),i=p.min,s=p.max,d&&(i=b(t)?t:this._minReal,s=b(e)?e:this._maxReal,s-i<=1e-8&&(i-=this._deltaMinMax,s+=this._deltaMinMax),i-=(s-i)*a,s+=(s-i)*r),c=this.adapters.fold("min",i),l=this.adapters.fold("max",s),b(c)&&(i=c),b(l)&&(s=l),n==1/0&&(n=s-i);let x=Math.round(Math.abs(Math.log(Math.abs(s-i))*Math.LOG10E))+5;i=X(i,x),s=X(s,x);const v=this.get("syncWithAxis");if(v&&(p=this._syncAxes(i,s,p.step,v.getPrivate("minFinal",v.getPrivate("min",0)),v.getPrivate("maxFinal",v.getPrivate("max",1)),v.getPrivate("step",1)),i=p.min,s=p.max),this.setPrivateRaw("maxZoomFactor",Math.max(1,Math.ceil((s-i)/n*this.get("maxZoomFactor",100)))),this._fixZoomFactor(),this.get("logarithmic")&&(this._minLogAdjusted=i,i=this._minReal,s=this._maxReal,i<=0&&(i=o*(1-Math.min(a,.99)))),b(i)&&b(s)&&(this.getPrivate("minFinal")!==i||this.getPrivate("maxFinal")!==s)){this.setPrivate("minFinal",i),this.setPrivate("maxFinal",s),this._saveMinMax(i,s);const _=this.get("interpolationDuration",0),f=this.get("interpolationEasing");this.animatePrivate({key:"min",to:i,duration:_,easing:f}),this.animatePrivate({key:"max",to:s,duration:_,easing:f})}}_fixZoomFactor(){}_getDelta(t){let e=Math.log(Math.abs(t))*Math.LOG10E,i=Math.pow(10,Math.floor(e));i/=10,this._deltaMinMax=i}_saveMinMax(t,e){}_adjustMinMax(t,e,i,s){i<=1&&(i=1),i=Math.round(i);let a=t,r=e,n=e-t;n===0&&(n=Math.abs(e));let o=Math.log(Math.abs(n))*Math.LOG10E,h=Math.pow(10,Math.floor(o));h/=10;let c=h;s&&(c=0),s?(t=Math.floor(t/h)*h,e=Math.ceil(e/h)*h):(t=Math.ceil(t/h)*h-c,e=Math.floor(e/h)*h+c),t<0&&a>=0&&(t=0),e>0&&r<=0&&(e=0),o=Math.log(Math.abs(n))*Math.LOG10E,h=Math.pow(10,Math.floor(o)),h/=100;let l=Math.ceil(n/i/h)*h,d=Math.pow(10,Math.floor(Math.log(Math.abs(l))*Math.LOG10E)),u=Math.ceil(l/d);u>5?u=10:u<=5&&u>2&&(u=5),l=Math.ceil(l/(d*u))*d*u;let g=this.get("maxPrecision");if(b(g)){let v=se(l,g);ga&&(t-=l),l=this.fixSmallStep(l),{min:t,max:e,step:l}}getTooltipText(t,e){const i=this.get("tooltipNumberFormat",this.get("numberFormat")),s=this.getNumberFormatter(),a=this.get("extraTooltipPrecision",0),r=this.getPrivate("stepDecimalPlaces",0)+a,n=X(this.positionToValue(t),r);return i?s.format(n,i):s.format(n,void 0,r)}getSeriesItem(t,e){let i,s,a=this.getPrivate("name")+this.get("renderer").getPrivate("letter"),r=this.positionToValue(e);if(P(t.dataItems,(n,o)=>{const h=Math.abs(n.get(a)-r);(i===void 0||h500&&(c=!0),c)t=u,e=g,i=m;else{l/3==Math.round(l/3)?(u=t-d*l,t>=0&&u<0&&(u=0)):(g=e+d*l,g<=0&&g>0&&(g=0));let p=this._adjustMinMax(u,g,h,!0);u=p.min,g=p.max,m=p.step}}}return{min:t,max:e,step:i}}_checkSync(t,e,i,s){let a=(e-t)/i;for(let r=1;rtt._new(this._root,{themeTags:S(this.ticks.template.get("themeTags",[]),this.get("themeTags",[]))},[this.ticks.template]))}),Object.defineProperty(this,"grid",{enumerable:!0,configurable:!0,writable:!0,value:new V(L.new({}),()=>z._new(this._root,{themeTags:S(this.grid.template.get("themeTags",[]),this.get("themeTags",[]))},[this.grid.template]))}),Object.defineProperty(this,"axisFills",{enumerable:!0,configurable:!0,writable:!0,value:new V(L.new({}),()=>Y._new(this._root,{themeTags:S(this.axisFills.template.get("themeTags",["axis","fill"]),this.get("themeTags",[]))},[this.axisFills.template]))}),Object.defineProperty(this,"labels",{enumerable:!0,configurable:!0,writable:!0,value:new V(L.new({}),()=>Q._new(this._root,{themeTags:S(this.labels.template.get("themeTags",[]),this.get("themeTags",[]))},[this.labels.template]))}),Object.defineProperty(this,"axis",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"thumb",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}makeTick(t,e){const i=this.ticks.make();return i._setDataItem(t),t.setRaw("tick",i),i.set("themeTags",S(i.get("themeTags"),e)),this.axis.labelsContainer.children.push(i),this.ticks.push(i),i}makeGrid(t,e){const i=this.grid.make();return i._setDataItem(t),t.setRaw("grid",i),i.set("themeTags",S(i.get("themeTags"),e)),this.axis.gridContainer.children.push(i),this.grid.push(i),i}makeAxisFill(t,e){const i=this.axisFills.make();return i._setDataItem(t),i.set("themeTags",S(i.get("themeTags"),e)),this.axis.gridContainer.children.push(i),t.setRaw("axisFill",i),this.axisFills.push(i),i}makeLabel(t,e){const i=this.labels.make();return i.set("themeTags",S(i.get("themeTags"),e)),this.axis.labelsContainer.children.moveValue(i,0),i._setDataItem(t),t.setRaw("label",i),this.labels.push(i),i}axisLength(){return 0}gridCount(){return this.axisLength()/this.get("minGridDistance",50)}_updatePositions(){}_afterNew(){super._afterNew(),this.set("isMeasured",!1);const t=this.thumb;t&&(this._disposers.push(t.events.on("pointerdown",e=>{this._handleThumbDown(e)})),this._disposers.push(t.events.on("globalpointerup",e=>{this._handleThumbUp(e)})),this._disposers.push(t.events.on("globalpointermove",e=>{this._handleThumbMove(e)})))}_changed(){if(super._changed(),this.isDirty("pan")){const t=this.thumb;if(t){const e=this.axis.labelsContainer,i=this.get("pan");i=="zoom"?e.children.push(t):i=="none"&&e.children.removeValue(t)}}}_handleThumbDown(t){this._thumbDownPoint=this.toLocal(t.point);const e=this.axis;this._downStart=e.get("start"),this._downEnd=e.get("end")}_handleThumbUp(t){this._thumbDownPoint=void 0}_handleThumbMove(t){const e=this._thumbDownPoint;if(e){const i=this.toLocal(t.point),s=this._downStart,a=this._downEnd,r=this._getPan(i,e)*Math.min(1,a-s)/2;this.axis.zoom(s-r,a+r,0)}}_getPan(t,e){return 0}positionToCoordinate(t){return this._inversed?(this._end-t)*this._axisLength:(t-this._start)*this._axisLength}updateTooltipBounds(t){}_updateSize(){this.markDirty(),this._clear=!0}toAxisPosition(t){const e=this._start||0,i=this._end||1;return t*=i-e,t=this.get("inversed")?i-t:e+t}toGlobalPosition(t){const e=this._start||0,i=this._end||1;return this.get("inversed")?t=i-t:t-=e,t/=i-e}fixPosition(t){return this.get("inversed")?1-t:t}_updateLC(){}toggleVisibility(t,e,i,s){let a=this.axis;const r=a.get("start",0),n=a.get("end",1);er+(n-r)*(s+1e-4)?t.setPrivate("visible",!1):t.setPrivate("visible",!0)}_positionTooltip(t,e){const i=this.chart;i&&(i.inPlot(e)?t.set("pointTo",this._display.toGlobal(e)):t.hide())}processAxis(){}}Object.defineProperty(E,"className",{enumerable:!0,configurable:!0,writable:!0,value:"AxisRenderer"}),Object.defineProperty(E,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Y.classNames.concat([E.className])});class ht extends E{constructor(){super(...arguments),Object.defineProperty(this,"thumb",{enumerable:!0,configurable:!0,writable:!0,value:H.new(this._root,{width:k,isMeasured:!1,themeTags:["axis","x","thumb"]})})}_afterNew(){this._settings.themeTags=S(this._settings.themeTags,["renderer","x"]),super._afterNew(),this.setPrivateRaw("letter","X");const t=this.grid.template;t.set("height",k),t.set("width",0),t.set("draw",(e,i)=>{e.moveTo(0,0),e.lineTo(0,i.height())}),this.set("draw",(e,i)=>{e.moveTo(0,0),e.lineTo(i.width(),0)})}_changed(){super._changed();const t=this.axis;t.ghostLabel.setPrivate("visible",!this.get("inside")),t.ghostLabel.set("x",-1e3);const e="opposite",i="inside";if(this.isDirty(e)||this.isDirty(i)){const s=this.chart,a=t.children;if(this.get(i)?t.addTag(i):t.removeTag(i),s){if(this.get(e)){const r=s.topAxesContainer.children;r.indexOf(t)==-1&&r.insertIndex(0,t),t.addTag(e),a.moveValue(this)}else{const r=s.bottomAxesContainer.children;r.indexOf(t)==-1&&r.moveValue(t),t.removeTag(e),a.moveValue(this,0)}t.ghostLabel._applyThemes(),this.labels.each(r=>{r._applyThemes()}),this.root._markDirtyRedraw()}t.markDirtySize()}this.thumb.setPrivate("height",t.labelsContainer.height())}_getPan(t,e){return(e.x-t.x)/this.width()}toAxisPosition(t){const e=this._start||0,i=this._end||1;return t=(t-=this._ls)*(i-e)/this._lc,t=this.get("inversed")?i-t:e+t}toGlobalPosition(t){const e=this._start||0,i=this._end||1;return this.get("inversed")?t=i-t:t-=e,t=t/(i-e)*this._lc,t+=this._ls}_updateLC(){const t=this.axis,e=t.parent;if(e){const i=e.innerWidth();this._lc=this.axisLength()/i,this._ls=(t.x()-e.get("paddingLeft",0))/i}}_updatePositions(){const t=this.axis,e=t.x()-it(t.get("centerX",0),t.width())-t.parent.get("paddingLeft",0);t.gridContainer.set("x",e),t.topGridContainer.set("x",e),t.bulletsContainer.set("y",this.y());const i=t.chart;if(i){const s=i.plotContainer,a=t.axisHeader;let r=t.get("marginLeft",0),n=t.x()-r;const o=t.parent;o&&(n-=o.get("paddingLeft",0)),a.children.length>0?(r=t.axisHeader.width(),t.set("marginLeft",r+1)):a.set("width",r),a.setAll({x:n,y:-1,height:s.height()+2})}}processAxis(){super.processAxis();const t=this.axis;t.set("width",k);const e=this._root.verticalLayout;t.set("layout",e),t.labelsContainer.set("width",k),t.axisHeader.setAll({layout:e})}axisLength(){return this.axis.width()}positionToPoint(t){return{x:this.positionToCoordinate(t),y:0}}updateTick(t,e,i,s){if(t){b(e)||(e=0);let a=.5;a=b(s)&&s>1?t.get("multiLocation",a):t.get("location",a),b(i)&&i!=e&&(e+=(i-e)*a),t.set("x",this.positionToCoordinate(e));let r=t.get("length",0);const n=t.get("inside",this.get("inside",!1));this.get("opposite")?(t.set("y",k),n||(r*=-1)):(t.set("y",0),n&&(r*=-1)),t.set("draw",o=>{o.moveTo(0,0),o.lineTo(0,r)}),this.toggleVisibility(t,e,t.get("minPosition",0),t.get("maxPosition",1))}}updateLabel(t,e,i,s){if(t){let a=.5;a=b(s)&&s>1?t.get("multiLocation",a):t.get("location",a),b(e)||(e=0);const r=t.get("inside",this.get("inside",!1));this.get("opposite")?r?(t.set("position","absolute"),t.set("y",0)):(t.set("position","relative"),t.set("y",k)):r?(t.set("y",0),t.set("position","absolute")):(t.set("y",void 0),t.set("position","relative")),b(i)&&i!=e&&(e+=(i-e)*a),t.set("x",this.positionToCoordinate(e)),this.toggleVisibility(t,e,t.get("minPosition",0),t.get("maxPosition",1))}}updateGrid(t,e,i){if(t){b(e)||(e=0);let s=t.get("location",.5);b(i)&&i!=e&&(e+=(i-e)*s),t.set("x",this.positionToCoordinate(e)),this.toggleVisibility(t,e,0,1)}}updateBullet(t,e,i){if(t){const s=t.get("sprite");if(s){b(e)||(e=0);let a=t.get("location",.5);b(i)&&i!=e&&(e+=(i-e)*a);let r=this.axis.roundAxisPosition(e,a),n=this.axis._bullets[r],o=-1;if(this.get("opposite")&&(o=1),t.get("stacked"))if(n){let h=n.get("sprite");h&&s.set("y",h.y()+h.height()*o)}else s.set("y",0);this.axis._bullets[r]=t,s.set("x",this.positionToCoordinate(e)),this.toggleVisibility(s,e,0,1)}}}updateFill(t,e,i){if(t){b(e)||(e=0),b(i)||(i=1);let s=this.positionToCoordinate(e),a=this.positionToCoordinate(i);this.fillDrawMethod(t,s,a)}}fillDrawMethod(t,e,i){t.set("draw",s=>{const a=this.axis.gridContainer.height(),r=this.width();ir||i<0||(s.moveTo(e,0),s.lineTo(i,0),s.lineTo(i,a),s.lineTo(e,a),s.lineTo(e,0))})}positionTooltip(t,e){this._positionTooltip(t,{x:this.positionToCoordinate(e),y:0})}updateTooltipBounds(t){const e=this.get("inside"),i=1e5;let s=this._display.toGlobal({x:0,y:0}),a=s.x,r=0,n=this.axisLength(),o=i,h="up";this.get("opposite")?e?(h="up",r=s.y,o=i):(h="down",r=s.y-i,o=i):e?(h="down",r=s.y-i,o=i):(h="up",r=s.y,o=i);const c={left:a,right:a+n,top:r,bottom:r+o},l=t.get("bounds");Xt(c,l)||(t.set("bounds",c),t.set("pointerOrientation",h))}}Object.defineProperty(ht,"className",{enumerable:!0,configurable:!0,writable:!0,value:"AxisRendererX"}),Object.defineProperty(ht,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:E.classNames.concat([ht.className])});class dt extends E{constructor(){super(...arguments),Object.defineProperty(this,"_downY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"thumb",{enumerable:!0,configurable:!0,writable:!0,value:H.new(this._root,{height:k,isMeasured:!1,themeTags:["axis","y","thumb"]})})}_afterNew(){this._settings.themeTags=S(this._settings.themeTags,["renderer","y"]),this._settings.opposite&&this._settings.themeTags.push("opposite"),super._afterNew(),this.setPrivateRaw("letter","Y");const t=this.grid.template;t.set("width",k),t.set("height",0),t.set("draw",(e,i)=>{e.moveTo(0,0),e.lineTo(i.width(),0)}),this.set("draw",(e,i)=>{e.moveTo(0,0),e.lineTo(0,i.height())})}_getPan(t,e){return(t.y-e.y)/this.height()}_changed(){super._changed();const t=this.axis;t.ghostLabel.setPrivate("visible",!this.get("inside")),t.ghostLabel.set("y",-1e3);const e=this.thumb,i="opposite",s="inside",a=this.chart;if(this.isDirty(i)||this.isDirty(s)){const n=t.children;if(this.get(s)?t.addTag(s):t.removeTag(s),a){if(this.get(i)){const o=a.rightAxesContainer.children;o.indexOf(t)==-1&&o.moveValue(t,0),t.addTag(i),n.moveValue(this,0)}else{const o=a.leftAxesContainer.children;o.indexOf(t)==-1&&o.moveValue(t),t.removeTag(i),n.moveValue(this)}t.ghostLabel._applyThemes(),this.labels.each(o=>{o._applyThemes()}),this.root._markDirtyRedraw()}t.markDirtySize()}const r=t.labelsContainer.width();a&&(this.get(i)?e.set("centerX",0):e.set("centerX",r)),e.setPrivate("width",r)}processAxis(){super.processAxis();const t=this.axis;t.get("height")==null&&t.set("height",k);const e=this._root.horizontalLayout;t.set("layout",e),t.labelsContainer.set("height",k),t.axisHeader.set("layout",e)}_updatePositions(){const t=this.axis,e=t.y()-it(t.get("centerY",0),t.height());t.gridContainer.set("y",e),t.topGridContainer.set("y",e),t.bulletsContainer.set("x",this.x());const i=t.chart;if(i){const s=i.plotContainer,a=t.axisHeader;let r=t.get("marginTop",0);a.children.length>0?(r=t.axisHeader.height(),t.set("marginTop",r+1)):a.set("height",r),a.setAll({y:t.y()-r,x:-1,width:s.width()+2})}}axisLength(){return this.axis.innerHeight()}positionToPoint(t){return{x:0,y:this.positionToCoordinate(t)}}updateLabel(t,e,i,s){if(t){b(e)||(e=0);let a=.5;a=b(s)&&s>1?t.get("multiLocation",a):t.get("location",a);const r=this.get("opposite"),n=t.get("inside",this.get("inside",!1));r?(t.set("x",0),n?t.set("position","absolute"):t.set("position","relative")):n?(t.set("x",0),t.set("position","absolute")):(t.set("x",void 0),t.set("position","relative")),b(i)&&i!=e&&(e+=(i-e)*a),t.set("y",this.positionToCoordinate(e)),this.toggleVisibility(t,e,t.get("minPosition",0),t.get("maxPosition",1))}}updateGrid(t,e,i){if(t){b(e)||(e=0);let s=t.get("location",.5);b(i)&&i!=e&&(e+=(i-e)*s),t.set("y",this.positionToCoordinate(e)),this.toggleVisibility(t,e,0,1)}}updateTick(t,e,i,s){if(t){b(e)||(e=0);let a=.5;a=b(s)&&s>1?t.get("multiLocation",a):t.get("location",a),b(i)&&i!=e&&(e+=(i-e)*a),t.set("y",this.positionToCoordinate(e));let r=t.get("length",0);const n=t.get("inside",this.get("inside",!1));this.get("opposite")?(t.set("x",0),n&&(r*=-1)):n||(r*=-1),t.set("draw",o=>{o.moveTo(0,0),o.lineTo(r,0)}),this.toggleVisibility(t,e,t.get("minPosition",0),t.get("maxPosition",1))}}updateBullet(t,e,i){if(t){const s=t.get("sprite");if(s){b(e)||(e=0);let a=t.get("location",.5);b(i)&&i!=e&&(e+=(i-e)*a);let r=this.axis.roundAxisPosition(e,a),n=this.axis._bullets[r],o=1;if(this.get("opposite")&&(o=-1),t.get("stacked"))if(n){let h=n.get("sprite");h&&s.set("x",h.x()+h.width()*o)}else s.set("x",0);this.axis._bullets[r]=t,s.set("y",this.positionToCoordinate(e)),this.toggleVisibility(s,e,0,1)}}}updateFill(t,e,i){if(t){b(e)||(e=0),b(i)||(i=1);let s=this.positionToCoordinate(e),a=this.positionToCoordinate(i);this.fillDrawMethod(t,s,a)}}fillDrawMethod(t,e,i){t.set("draw",s=>{const a=this.axis.gridContainer.width(),r=this.height();ir||i<0||(s.moveTo(0,e),s.lineTo(a,e),s.lineTo(a,i),s.lineTo(0,i),s.lineTo(0,e))})}positionToCoordinate(t){return this._inversed?(t-this._start)*this._axisLength:(this._end-t)*this._axisLength}positionTooltip(t,e){this._positionTooltip(t,{x:0,y:this.positionToCoordinate(e)})}updateTooltipBounds(t){const e=this.get("inside"),i=1e5;let s=this._display.toGlobal({x:0,y:0}),a=s.y,r=0,n=this.axisLength(),o=i,h="right";this.get("opposite")?e?(h="right",r=s.x-i,o=i):(h="left",r=s.x,o=i):e?(h="left",r=s.x,o=i):(h="right",r=s.x-i,o=i);const c={left:r,right:r+o,top:a,bottom:a+n},l=t.get("bounds");Xt(c,l)||(t.set("bounds",c),t.set("pointerOrientation",h))}_updateLC(){const t=this.axis,e=t.parent;if(e){const i=e.innerHeight();this._lc=this.axisLength()/i,this._ls=t.y()/i}}toAxisPosition(t){const e=this._start||0,i=this._end||1;return t=(t-=this._ls)*(i-e)/this._lc,t=this.get("inversed")?e+t:i-t}toGlobalPosition(t){const e=this._start||0,i=this._end||1;return this.get("inversed")?t-=e:t=i-t,t=t/(i-e)*this._lc,t+=this._ls}fixPosition(t){return this.get("inversed")?t:1-t}}Object.defineProperty(dt,"className",{enumerable:!0,configurable:!0,writable:!0,value:"AxisRendererY"}),Object.defineProperty(dt,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:E.classNames.concat([dt.className])});class ct extends W{constructor(){super(...arguments),Object.defineProperty(this,"_endIndex",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_strokeGenerator",{enumerable:!0,configurable:!0,writable:!0,value:zt()}),Object.defineProperty(this,"_fillGenerator",{enumerable:!0,configurable:!0,writable:!0,value:ne()}),Object.defineProperty(this,"_legendStroke",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_legendFill",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"strokes",{enumerable:!0,configurable:!0,writable:!0,value:new V(L.new({}),()=>Y._new(this._root,{themeTags:S(this.strokes.template.get("themeTags",[]),["line","series","stroke"])},[this.strokes.template]))}),Object.defineProperty(this,"fills",{enumerable:!0,configurable:!0,writable:!0,value:new V(L.new({}),()=>Y._new(this._root,{themeTags:S(this.strokes.template.get("themeTags",[]),["line","series","fill"])},[this.fills.template]))}),Object.defineProperty(this,"_fillTemplate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_strokeTemplate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_previousPoint",{enumerable:!0,configurable:!0,writable:!0,value:[0,0,0,0]}),Object.defineProperty(this,"_dindex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_sindex",{enumerable:!0,configurable:!0,writable:!0,value:0})}_afterNew(){this._fillGenerator.y0(function(t){return t[3]}),this._fillGenerator.x0(function(t){return t[2]}),this._fillGenerator.y1(function(t){return t[1]}),this._fillGenerator.x1(function(t){return t[0]}),super._afterNew()}makeStroke(t){const e=this.mainContainer.children.push(t.make());return t.push(e),e}makeFill(t){const e=this.mainContainer.children.push(t.make());return t.push(e),e}_updateChildren(){this._strokeTemplate=void 0,this._fillTemplate=void 0;let t=this.get("xAxis"),e=this.get("yAxis");if(this.isDirty("stroke")){const i=this.get("stroke");this.strokes.template.set("stroke",i);const s=this._legendStroke;s&&s.states.lookup("default").set("stroke",i)}if(this.isDirty("fill")){const i=this.get("fill");this.fills.template.set("fill",i);const s=this._legendFill;s&&s.states.lookup("default").set("fill",i)}if(this.isDirty("curveFactory")){const i=this.get("curveFactory");i&&(this._strokeGenerator.curve(i),this._fillGenerator.curve(i))}if(t.inited&&e.inited){if(this._axesDirty||this._valuesDirty||this._stackDirty||this.isDirty("vcx")||this.isDirty("vcy")||this._sizeDirty||this.isDirty("connect")||this.isDirty("curveFactory")){this.fills.each(c=>{c.setPrivate("visible",!1)}),this.strokes.each(c=>{c.setPrivate("visible",!1)}),this.axisRanges.each(c=>{let l=c.fills;l&&l.each(u=>{u.setPrivate("visible",!1)});let d=c.strokes;d&&d.each(u=>{u.setPrivate("visible",!1)})});let i=this.startIndex(),s=this.strokes.template.get("templateField"),a=this.fills.template.get("templateField"),r=!0,n=!0;s&&(r=!1),a&&(n=!1);for(let c=i-1;c>=0;c--){let l=this.dataItems[c],d=!0,u=l.dataContext;if(s&&u[s]&&(r=!0),a&&u[a]&&(n=!0),P(this._valueFields,g=>{b(l.get(g))||(d=!1)}),d&&r&&n){i=c;break}}let o=this.dataItems.length,h=this.endIndex();if(h{b(l.get(u))||(d=!1)}),d){h=c+1;break}}}if(i>0&&i--,this._endIndex=h,this._clearGraphics(),this._sindex=0,this._dindex=i,this.dataItems.length==1)this._startSegment(0);else for(;this._dindex0&&(bt=!0);let xt=!1;(A||f||w)&&(xt=!0);const at={points:j,segments:I,stacked:A,getOpen:xt,basePosX:F,basePosY:Wt,fillVisible:bt,xField:p,yField:x,xOpenField:v,yOpenField:_,vcx:g,vcy:m,baseAxis:u,xAxis:l,yAxis:d,locationX:mt,locationY:_t,openLocationX:Ut,openLocationY:Bt,minDistance:Ht};for(O=t;Ot){i=O;break}h.template=D}}if(pt){let D=R.dataContext[pt];if(D){if(D instanceof L||(D=L.new(D)),this._fillTemplate=D,O>t){i=O;break}r.template=D}}if(!a){let D=this.dataItems[O+1];D&&u.shouldGap(R,D,s,ut)&&(j=[],I.push(j),at.points=j)}}r.setRaw("userData",[t,O]),h.setRaw("userData",[t,O]),O===e&&this._endLine(j,I[0][0]),h&&this._drawStroke(h,I),r&&this._drawFill(r,I),this.axisRanges.each(R=>{const G=R.container,ot=R.fills,D=this.makeFill(ot);G&&G.children.push(D),D.setPrivate("visible",!0),this._drawFill(D,I);const Zt=R.strokes,Z=this.makeStroke(Zt);G&&G.children.push(Z),Z.setPrivate("visible",!0),this._drawStroke(Z,I),D.setRaw("userData",[t,O]),Z.setRaw("userData",[t,O])})}_getPoints(t,e){let i=e.points,s=t.get("locationX",e.locationX),a=t.get("locationY",e.locationY),r=e.xAxis.getDataItemPositionX(t,e.xField,s,e.vcx),n=e.yAxis.getDataItemPositionY(t,e.yField,a,e.vcy);if(this._shouldInclude(r)){const o=this.getPoint(r,n),h=[o.x,o.y];if(o.x+=this._x,o.y+=this._y,t.set("point",o),e.fillVisible){let c=r,l=n;if(e.baseAxis===e.xAxis?l=e.basePosY:e.baseAxis===e.yAxis&&(c=e.basePosX),e.getOpen){let u=t.get(e.xOpenField),g=t.get(e.yOpenField);if(u!=null&&g!=null){let m=t.get("openLocationX",e.openLocationX),p=t.get("openLocationY",e.openLocationY);if(e.stacked){let x=t.get("stackToItemX"),v=t.get("stackToItemY");x?(c=e.xAxis.getDataItemPositionX(x,e.xField,m,x.component.get("vcx")),B(c)&&(c=e.basePosX)):c=e.yAxis===e.baseAxis?e.basePosX:e.xAxis.getDataItemPositionX(t,e.xOpenField,m,e.vcx),v?(l=e.yAxis.getDataItemPositionY(v,e.yField,p,v.component.get("vcy")),B(l)&&(l=e.basePosY)):l=e.xAxis===e.baseAxis?e.basePosY:e.yAxis.getDataItemPositionY(t,e.yOpenField,p,e.vcy)}else c=e.xAxis.getDataItemPositionX(t,e.xOpenField,m,e.vcx),l=e.yAxis.getDataItemPositionY(t,e.yOpenField,p,e.vcy)}}let d=this.getPoint(c,l);h[2]=d.x,h[3]=d.y}if(e.minDistance>0){const c=h[0],l=h[1],d=h[2],u=h[3],g=this._previousPoint,m=g[0],p=g[1],x=g[2],v=g[3];(Math.hypot(c-m,l-p)>e.minDistance||d&&u&&Math.hypot(d-x,u-v)>e.minDistance)&&(i.push(h),this._previousPoint=h)}else i.push(h)}}_endLine(t,e){}_drawStroke(t,e){t.get("visible")&&!t.get("forceHidden")&&t.set("draw",i=>{P(e,s=>{this._strokeGenerator.context(i),this._strokeGenerator(s)})})}_drawFill(t,e){t.get("visible")&&!t.get("forceHidden")&&t.set("draw",i=>{P(e,s=>{this._fillGenerator.context(i),this._fillGenerator(s)})})}_processAxisRange(t){super._processAxisRange(t),t.fills=new V(L.new({}),()=>Y._new(this._root,{themeTags:S(t.fills.template.get("themeTags",[]),["line","series","fill"])},[this.fills.template,t.fills.template])),t.strokes=new V(L.new({}),()=>Y._new(this._root,{themeTags:S(t.strokes.template.get("themeTags",[]),["line","series","stroke"])},[this.strokes.template,t.strokes.template]))}createLegendMarker(t){const e=this.get("legendDataItem");if(e){const i=e.get("marker"),s=e.get("markerRectangle");s&&s.setPrivate("visible",!1),i.set("background",H.new(i._root,{fillOpacity:0,fill:ee(0)}));const a=i.children.push(Y._new(i._root,{themeTags:["line","series","legend","marker","stroke"],interactive:!1},[this.strokes.template]));this._legendStroke=a;const r=i.children.push(Y._new(i._root,{themeTags:["line","series","legend","marker","fill"]},[this.fills.template]));this._legendFill=r;const n=this._root.interfaceColors.get("disabled");if(a.states.create("disabled",{fill:n,stroke:n}),r.states.create("disabled",{fill:n,stroke:n}),this.bullets.length>0){const o=this.bullets.getIndex(0);if(o){const h=o(i._root,this,new st(this,{legend:!0},{}));if(h){const c=h.get("sprite");c instanceof Y&&c.states.create("disabled",{fill:n,stroke:n}),c&&(c.set("tooltipText",void 0),c.set("tooltipHTML",void 0),i.children.push(c),c.setAll({x:i.width()/2,y:i.height()/2}))}}}}}}Object.defineProperty(ct,"className",{enumerable:!0,configurable:!0,writable:!0,value:"LineSeries"}),Object.defineProperty(ct,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:W.classNames.concat([ct.className])});export{ht as _,dt as b,U as c,W as d,nt as o,rt as r,lt as u,ct as x}; +import{W as Y,Q as T,e as St,a as ft,Y as k,V as H,Z as $t,v as q,g as Kt,$ as et,q as J,m as P,w as vt,l as b,k as yt,b as S,r as wt,c as qt,d as X,f as Jt,F as Ot,y as Pt,h as kt,j as it,n as B,H as Qt,o as te,p as At,s as V,B as L,G as Xt,t as ee,i as ie,X as Dt,D as Tt,J as $,z as N,K as Mt,u as se}from"./Theme-5CV7oVsW.js";import{s as Ct}from"./ColorSet-tH4rJdGx.js";import{l as M}from"./DefaultTheme-uOYPzulo.js";import{U as Yt,D as Lt,_ as Ft,B as Rt,g as st,V as It,k as C,I as ae}from"./Tick-bu1aEuYp.js";import{o as oe}from"./Button-HXGuX8_s.js";import{d1 as K}from"./index-pCX-0tJH.js";function jt(y){return typeof y=="object"&&"length"in y?y:Array.from(y)}function Vt(y){this._context=y}function Et(y){return new Vt(y)}function Gt(y){return y[0]}function Nt(y){return y[1]}function zt(y,t){var e=C(!0),i=null,s=Et,a=null,r=It(n);function n(o){var h,c,l,d=(o=jt(o)).length,u=!1;for(i==null&&(a=s(l=r())),h=0;h<=d;++h)!(h=u;--g)n.point(_[g],f[g]);n.lineEnd(),n.areaEnd()}v&&(_[d]=+y(m,d,l),f[d]=+t(m,d,l),n.point(i?+i(m,d,l):_[d],e?+e(m,d,l):f[d]))}if(p)return n=null,p+""||null}function c(){return zt().defined(s).curve(r).context(a)}return y=typeof y=="function"?y:y===void 0?Gt:C(+y),t=typeof t=="function"?t:C(t===void 0?0:+t),e=typeof e=="function"?e:e===void 0?Nt:C(+e),h.x=function(l){return arguments.length?(y=typeof l=="function"?l:C(+l),i=null,h):y},h.x0=function(l){return arguments.length?(y=typeof l=="function"?l:C(+l),h):y},h.x1=function(l){return arguments.length?(i=l==null?null:typeof l=="function"?l:C(+l),h):i},h.y=function(l){return arguments.length?(t=typeof l=="function"?l:C(+l),e=null,h):t},h.y0=function(l){return arguments.length?(t=typeof l=="function"?l:C(+l),h):t},h.y1=function(l){return arguments.length?(e=l==null?null:typeof l=="function"?l:C(+l),h):e},h.lineX0=h.lineY0=function(){return c().x(y).y(t)},h.lineY1=function(){return c().x(y).y(e)},h.lineX1=function(){return c().x(i).y(t)},h.defined=function(l){return arguments.length?(s=typeof l=="function"?l:C(!!l),h):s},h.curve=function(l){return arguments.length?(r=l,a!=null&&(n=r(a)),h):r},h.context=function(l){return arguments.length?(l==null?a=n=null:n=r(a=l),h):a},h}Vt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(y,t){switch(y=+y,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(y,t):this._context.moveTo(y,t);break;case 1:this._point=2;default:this._context.lineTo(y,t)}}};class re extends ie{setupDefaultRules(){super.setupDefaultRules();const t=this._root.interfaceColors,e=this._root.language,i=this.rule.bind(this);i("XYChart").setAll({colors:Ct.new(this._root,{}),paddingLeft:20,paddingRight:20,paddingTop:16,paddingBottom:16,panX:!1,panY:!1,wheelStep:.25,arrangeTooltips:!0,pinchZoomX:!1,pinchZoomY:!1}),i("XYSeries").setAll({legendLabelText:"{name}"}),i("XYChart",["scrollbar","chart"]).setAll({paddingBottom:0,paddingLeft:0,paddingTop:0,paddingRight:0,colors:Ct.new(this._root,{saturation:0})});{const o=i("Graphics",["scrollbar","overlay"]);o.setAll({fillOpacity:.5}),M(o,"fill",t,"background")}i("RoundedRectangle",["xy","scrollbar","thumb"]).setAll({cornerRadiusTR:0,cornerRadiusTL:0,cornerRadiusBR:0,cornerRadiusBL:0,fillOpacity:0,focusable:!0}),i("RoundedRectangle",["xy","scrollbar","thumb"]).states.create("hover",{fillOpacity:.4}),i("RoundedRectangle",["xy","scrollbar","chart","background"]).setAll({cornerRadiusTL:0,cornerRadiusBL:0,cornerRadiusTR:0,cornerRadiusBR:0}),i("RoundedRectangle",["xy","scrollbar","chart","background","resize","button"]).setAll({cornerRadiusBL:40,cornerRadiusBR:40,cornerRadiusTL:40,cornerRadiusTR:40}),i("AxisRendererX",["xy","chart","scrollbar"]).setAll({strokeOpacity:0,inside:!0}),i("AxisRendererY",["xy","chart","scrollbar"]).setAll({strokeOpacity:0,inside:!0,minGridDistance:5}),i("AxisLabel",["xy","scrollbar","x"]).setAll({opacity:.5,centerY:k,minPosition:.01,maxPosition:.99,fontSize:"0.8em"}),i("AxisLabel",["category"]).setAll({text:"{category}",populateText:!0}),i("AxisLabel",["x"]).setAll({centerY:0}),i("AxisLabel",["x","inside"]).setAll({centerY:k}),i("AxisLabel",["x","inside","opposite"]).setAll({centerY:0}),i("AxisLabel",["x","opposite"]).setAll({centerY:k}),i("AxisLabel",["y"]).setAll({centerX:k}),i("AxisLabel",["y","inside"]).setAll({centerX:0}),i("AxisLabel",["y","inside","opposite"]).setAll({centerX:k}),i("AxisLabel",["y","opposite"]).setAll({centerX:0}),i("AxisLabel",["xy","scrollbar","y"]).setAll({visible:!1}),i("Grid",["xy","scrollbar","y"]).setAll({visible:!1}),i("Grid",["xy","scrollbar","x"]).setAll({opacity:.5}),i("XYCursor").setAll({behavior:"none",layer:30,exportable:!1,snapToSeriesBy:"xy",moveThreshold:1});{const o=i("Grid",["cursor","x"]);o.setAll({strokeOpacity:.8,strokeDasharray:[2,2],ariaLabel:e.translate("Use left and right arrows to move selection")}),M(o,"stroke",t,"alternativeBackground")}{const o=i("Grid",["cursor","y"]);o.setAll({strokeOpacity:.8,strokeDasharray:[2,2],ariaLabel:e.translate("Use up and down arrows to move selection")}),M(o,"stroke",t,"alternativeBackground")}{const o=i("Graphics",["cursor","selection"]);o.setAll({fillOpacity:.15}),M(o,"fill",t,"alternativeBackground")}i("Axis").setAll({start:0,end:1,minZoomCount:1,maxZoomCount:1/0,maxZoomFactor:1e3,maxDeviation:.1,snapTooltip:!0,tooltipLocation:.5,panX:!0,panY:!0,zoomX:!0,zoomY:!0,fixAxisSize:!0}),i("AxisLabel").setAll({location:.5,multiLocation:0,centerX:Dt,centerY:Dt,paddingTop:3,paddingBottom:3,paddingLeft:5,paddingRight:5}),i("Container",["axis","header"]).setAll({layer:30}),i("Rectangle",["axis","header","background"]).setAll({crisp:!0});{const o=i("AxisRenderer");o.setAll({crisp:!0,strokeOpacity:0}),M(o,"stroke",t,"grid")}i("AxisRendererX").setAll({minGridDistance:120,opposite:!1,inversed:!1,cellStartLocation:0,cellEndLocation:1,width:k}),i("AxisRendererY").setAll({minGridDistance:40,opposite:!1,inversed:!1,cellStartLocation:0,cellEndLocation:1,height:k});{const o=i("Rectangle",["axis","thumb"]);o.setAll({fillOpacity:0}),M(o,"fill",t,"alternativeBackground"),o.states.create("hover",{fillOpacity:.1})}i("Rectangle",["axis","thumb","x"]).setAll({cursorOverStyle:"ew-resize"}),i("Rectangle",["axis","thumb","y"]).setAll({cursorOverStyle:"ns-resize"});{const o=i("Grid");o.setAll({location:0,strokeOpacity:.15,crisp:!0}),M(o,"stroke",t,"grid")}i("Grid",["base"]).setAll({strokeOpacity:.3});{const o=i("Graphics",["axis","fill"]);o.setAll({visible:!1,isMeasured:!1,position:"absolute",fillOpacity:.05}),M(o,"fill",t,"alternativeBackground")}i("Graphics",["axis","fill","range"]).setAll({isMeasured:!0}),i("Graphics",["series","fill","range"]).setAll({visible:!1,isMeasured:!0}),i("Grid",["series","range"]).setAll({visible:!1}),i("AxisTick",["series","range"]).setAll({visible:!1}),i("AxisLabel",["series","range"]).setAll({visible:!1});{const o=i("AxisTick");o.setAll({location:.5,multiLocation:0,strokeOpacity:1,isMeasured:!1,position:"absolute",visible:!1}),M(o,"stroke",t,"grid")}i("CategoryAxis").setAll({startLocation:0,endLocation:1,fillRule:(o,h)=>{const c=o.get("axisFill");c&&(b(h)&&h%2!=0?c.setPrivate("visible",!1):c.setPrivate("visible",!0))}});const s=[{timeUnit:"millisecond",count:1},{timeUnit:"millisecond",count:5},{timeUnit:"millisecond",count:10},{timeUnit:"millisecond",count:50},{timeUnit:"millisecond",count:100},{timeUnit:"millisecond",count:500},{timeUnit:"second",count:1},{timeUnit:"second",count:5},{timeUnit:"second",count:10},{timeUnit:"second",count:30},{timeUnit:"minute",count:1},{timeUnit:"minute",count:5},{timeUnit:"minute",count:10},{timeUnit:"minute",count:15},{timeUnit:"minute",count:30},{timeUnit:"hour",count:1},{timeUnit:"hour",count:3},{timeUnit:"hour",count:6},{timeUnit:"hour",count:12},{timeUnit:"day",count:1},{timeUnit:"day",count:2},{timeUnit:"day",count:3},{timeUnit:"day",count:4},{timeUnit:"day",count:5},{timeUnit:"week",count:1},{timeUnit:"month",count:1},{timeUnit:"month",count:2},{timeUnit:"month",count:3},{timeUnit:"month",count:6},{timeUnit:"year",count:1},{timeUnit:"year",count:2},{timeUnit:"year",count:5},{timeUnit:"year",count:10},{timeUnit:"year",count:50},{timeUnit:"year",count:100},{timeUnit:"year",count:200},{timeUnit:"year",count:500},{timeUnit:"year",count:1e3},{timeUnit:"year",count:2e3},{timeUnit:"year",count:5e3},{timeUnit:"year",count:1e4},{timeUnit:"year",count:1e5}],a={millisecond:e.translate("_date_millisecond"),second:e.translate("_date_second"),minute:e.translate("_date_minute"),hour:e.translate("_date_hour"),day:e.translate("_date_day"),week:e.translate("_date_day"),month:e.translate("_date_month"),year:e.translate("_date_year")},r={millisecond:e.translate("_date_millisecond"),second:e.translate("_date_second"),minute:e.translate("_date_minute"),hour:e.translate("_date_day"),day:e.translate("_date_day"),week:e.translate("_date_day"),month:e.translate("_date_month")+" "+e.translate("_date_year"),year:e.translate("_date_year")},n={millisecond:e.translate("_date_millisecond_full"),second:e.translate("_date_second_full"),minute:e.translate("_date_minute_full"),hour:e.translate("_date_hour_full"),day:e.translate("_date_day_full"),week:e.translate("_date_week_full"),month:e.translate("_date_month_full"),year:e.translate("_date_year")};i("CategoryDateAxis").setAll({markUnitChange:!0,gridIntervals:Tt(s),dateFormats:$(a),periodChangeDateFormats:$(r)}),i("DateAxis").setAll({maxZoomFactor:null,strictMinMax:!0,startLocation:0,endLocation:1,markUnitChange:!0,groupData:!1,groupCount:500,gridIntervals:Tt(s),dateFormats:$(a),periodChangeDateFormats:$(r),tooltipDateFormats:n,groupIntervals:[{timeUnit:"millisecond",count:1},{timeUnit:"millisecond",count:10},{timeUnit:"millisecond",count:100},{timeUnit:"second",count:1},{timeUnit:"second",count:10},{timeUnit:"minute",count:1},{timeUnit:"minute",count:10},{timeUnit:"hour",count:1},{timeUnit:"day",count:1},{timeUnit:"week",count:1},{timeUnit:"month",count:1},{timeUnit:"year",count:1}],fillRule:o=>{const h=o.get("axisFill");if(h){const c=o.component,l=o.get("value"),d=o.get("endValue"),u=c.intervalDuration(),g=c.getPrivate("baseInterval"),m=c.getPrivate("gridInterval",g);let p=c.getPrivate("min",0);if(p=ae(new Date(p),m.timeUnit,m.count,this._root.locale.firstDayOfWeek,this._root.utc,void 0,this._root.timezone).getTime(),l!=null&&d!=null){const x=Math.round(Math.round((l-p)/u))/2;x==Math.round(x)?h.setPrivate("visible",!0):h.setPrivate("visible",!1)}}}}),i("GaplessDateAxis").setAll({fillRule:o=>{const h=o.get("axisFill");if(h){const c=o.get("index");let l=!1;b(c)&&c%2!=0||(l=!0),h.setPrivate("visible",l)}}}),i("ValueAxis").setAll({baseValue:0,logarithmic:!1,strictMinMax:!1,autoZoom:!0,fillRule:o=>{const h=o.get("axisFill");if(h){const c=o.component,l=o.get("value"),d=c.getPrivate("step");b(l)&&b(d)&&(X(l/d/2,5)==Math.round(l/d/2)?h.setPrivate("visible",!1):h.setPrivate("visible",!0))}}}),i("DurationAxis").setAll({baseUnit:"second"}),i("XYSeries").setAll({maskBullets:!0,stackToNegative:!0,locationX:.5,locationY:.5,snapTooltip:!1,openValueXGrouped:"open",openValueYGrouped:"open",valueXGrouped:"close",valueYGrouped:"close",seriesTooltipTarget:"series"}),i("BaseColumnSeries").setAll({adjustBulletPosition:!0}),i("ColumnSeries").setAll({clustered:!0}),i("RoundedRectangle",["series","column"]).setAll({position:"absolute",isMeasured:!1,width:N(70),height:N(70),strokeWidth:1,strokeOpacity:1,cornerRadiusBL:0,cornerRadiusTL:0,cornerRadiusBR:0,cornerRadiusTR:0,fillOpacity:1,role:"figure"}),i("LineSeries").setAll({connect:!0,autoGapCount:1.1,stackToNegative:!1}),i("Graphics",["series","stroke"]).setAll({position:"absolute",strokeWidth:1,strokeOpacity:1,isMeasured:!1}),i("Graphics",["series","fill"]).setAll({visible:!1,fillOpacity:0,position:"absolute",strokeWidth:0,strokeOpacity:0,isMeasured:!1}),i("Graphics",["line","series","legend","marker","stroke"]).setAll({draw:(o,h)=>{const c=h.parent;if(c){const l=c.height(),d=c.width();o.moveTo(0,l/2),o.lineTo(d,l/2)}}});{const o=i("Graphics",["line","series","legend","marker","stroke"]).states.create("disabled",{});M(o,"stroke",t,"disabled")}i("Graphics",["line","series","legend","marker","fill"]).setAll({draw:(o,h)=>{const c=h.parent;if(c){const l=c.height(),d=c.width();o.moveTo(0,0),o.lineTo(d,0),o.lineTo(d,l),o.lineTo(0,l),o.lineTo(0,0)}}});{const o=i("Graphics",["line","series","legend","marker","fill"]).states.create("disabled",{});M(o,"stroke",t,"disabled")}i("SmoothedXYLineSeries").setAll({tension:.5}),i("SmoothedXLineSeries").setAll({tension:.5}),i("SmoothedYLineSeries").setAll({tension:.5}),i("Candlestick").setAll({position:"absolute",isMeasured:!1,width:N(50),height:N(50),strokeWidth:1,strokeOpacity:1,cornerRadiusBL:0,cornerRadiusTL:0,cornerRadiusBR:0,cornerRadiusTR:0,fillOpacity:1,role:"figure"}),i("OHLC").setAll({width:N(80),height:N(80)}),i("CandlestickSeries").setAll({lowValueXGrouped:"low",lowValueYGrouped:"low",highValueXGrouped:"high",highValueYGrouped:"high",openValueXGrouped:"open",openValueYGrouped:"open",valueXGrouped:"close",valueYGrouped:"close"});{const o=i("Rectangle",["column","autocolor"]).states.create("riseFromOpen",{});M(o,"fill",t,"positive"),M(o,"stroke",t,"positive")}{const o=i("Rectangle",["column","autocolor"]).states.create("dropFromOpen",{});M(o,"fill",t,"negative"),M(o,"stroke",t,"negative")}i("Rectangle",["column","autocolor","pro"]).states.create("riseFromOpen",{fillOpacity:0}),i("Rectangle",["column","autocolor","pro"]).states.create("dropFromOpen",{fillOpacity:1});{const o=i("Rectangle",["column","autocolor","pro"]).states.create("riseFromPrevious",{});M(o,"fill",t,"positive"),M(o,"stroke",t,"positive")}{const o=i("Rectangle",["column","autocolor","pro"]).states.create("dropFromPrevious",{});M(o,"fill",t,"negative"),M(o,"stroke",t,"negative")}}}class nt extends Yt{constructor(){super(...arguments),Object.defineProperty(this,"xAxes",{enumerable:!0,configurable:!0,writable:!0,value:new ft}),Object.defineProperty(this,"yAxes",{enumerable:!0,configurable:!0,writable:!0,value:new ft}),Object.defineProperty(this,"topAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.chartContainer.children.push(T.new(this._root,{width:k,layout:this._root.verticalLayout}))}),Object.defineProperty(this,"yAxesAndPlotContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.chartContainer.children.push(T.new(this._root,{width:k,height:k,layout:this._root.horizontalLayout}))}),Object.defineProperty(this,"bottomAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.chartContainer.children.push(T.new(this._root,{width:k,layout:this._root.verticalLayout}))}),Object.defineProperty(this,"leftAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.yAxesAndPlotContainer.children.push(T.new(this._root,{height:k,layout:this._root.horizontalLayout}))}),Object.defineProperty(this,"plotsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.yAxesAndPlotContainer.children.push(T.new(this._root,{width:k,height:k,maskContent:!1}))}),Object.defineProperty(this,"plotContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotsContainer.children.push(T.new(this._root,{width:k,height:k}))}),Object.defineProperty(this,"topPlotContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotsContainer.children.push(T.new(this._root,{width:k,height:k}))}),Object.defineProperty(this,"gridContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotContainer.children.push(T.new(this._root,{width:k,height:k,isMeasured:!1}))}),Object.defineProperty(this,"topGridContainer",{enumerable:!0,configurable:!0,writable:!0,value:T.new(this._root,{width:k,height:k,isMeasured:!1})}),Object.defineProperty(this,"rightAxesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.yAxesAndPlotContainer.children.push(T.new(this._root,{height:k,layout:this._root.horizontalLayout}))}),Object.defineProperty(this,"axisHeadersContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.plotContainer.children.push(T.new(this._root,{}))}),Object.defineProperty(this,"zoomOutButton",{enumerable:!0,configurable:!0,writable:!0,value:this.topPlotContainer.children.push(oe.new(this._root,{themeTags:["zoom"],icon:Y.new(this._root,{themeTags:["button","icon"]})}))}),Object.defineProperty(this,"_movePoint",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),Object.defineProperty(this,"_wheelDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_otherCharts",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_movePoints",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_downStartX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_downEndX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_downStartY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_downEndY",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_afterNew(){this._defaultThemes.push(re.new(this._root)),super._afterNew(),this._disposers.push(this.xAxes),this._disposers.push(this.yAxes);const t=this._root;let e=this._root.verticalLayout;const i=this.zoomOutButton;i.events.on("click",()=>{this.zoomOut()}),i.hide(0),i.states.lookup("default").set("opacity",1),this.chartContainer.set("layout",e);const s=this.plotContainer;s.children.push(this.seriesContainer),this._disposers.push(this._processAxis(this.xAxes,this.bottomAxesContainer)),this._disposers.push(this._processAxis(this.yAxes,this.leftAxesContainer)),s.children.push(this.topGridContainer),s.children.push(this.bulletsContainer),s.set("interactive",!0),s.set("interactiveChildren",!1),s.set("background",H.new(t,{themeTags:["xy","background"],fill:$t.fromHex(0),fillOpacity:0})),this._disposers.push(s.events.on("pointerdown",a=>{this._handlePlotDown(a)})),this._disposers.push(s.events.on("globalpointerup",a=>{this._handlePlotUp(a)})),this._disposers.push(s.events.on("globalpointermove",a=>{this._handlePlotMove(a)})),this._maskGrid(),this._setUpTouch()}_beforeChanged(){super._beforeChanged(),(this.isDirty("pinchZoomX")||this.isDirty("pinchZoomY")||this.get("panX")||this.get("panY"))&&this._setUpTouch()}_setUpTouch(){this.plotContainer._display.cancelTouch||(this.plotContainer._display.cancelTouch=!!(this.get("pinchZoomX")||this.get("pinchZoomY")||this.get("panX")||this.get("panY")))}_maskGrid(){this.gridContainer.set("maskContent",!0),this.topGridContainer.set("maskContent",!0)}_removeSeries(t){t._unstack(),t._posXDp&&t._posXDp.dispose(),t._posYDp&&t._posYDp.dispose(),t.set("baseAxis",void 0);const e=t.get("xAxis");e&&(q(e.series,t),e.markDirtyExtremes());const i=t.get("yAxis");i&&(q(i.series,t),i.markDirtyExtremes());const s=this.get("cursor");if(s){const a=s.get("snapToSeries");a&&q(a,t)}super._removeSeries(t)}handleWheel(t){const e=this.get("wheelX"),i=this.get("wheelY"),s=this.plotContainer,a=t.originalEvent;if(!Kt(a,this))return;a.preventDefault();const r=s.toLocal(t.point),n=this.get("wheelStep",.2),o=a.deltaY/100,h=a.deltaX/100,c=this.get("wheelZoomPositionX"),l=this.get("wheelZoomPositionY");e!=="zoomX"&&e!=="zoomXY"||h==0||this.xAxes.each(d=>{if(d.get("zoomX")){let u=d.get("start"),g=d.get("end"),m=d.fixPosition(r.x/s.width());c!=null&&(m=c);let p=u-n*(g-u)*h*m,x=g+n*(g-u)*h*(1-m);1/(x-p){if(d.get("zoomX")){let u=d.get("start"),g=d.get("end"),m=d.fixPosition(r.x/s.width());c!=null&&(m=c);let p=u-n*(g-u)*o*m,x=g+n*(g-u)*o*(1-m);1/(x-p){if(d.get("zoomY")){let u=d.get("start"),g=d.get("end"),m=d.fixPosition(r.y/s.height());l!=null&&(m=l);let p=u-n*(g-u)*h*m,x=g+n*(g-u)*h*(1-m);1/(x-p){if(d.get("zoomY")){let u=d.get("start"),g=d.get("end"),m=d.fixPosition(r.y/s.height());l!=null&&(m=l);let p=u-n*(g-u)*o*m,x=g+n*(g-u)*o*(1-m);1/(x-p){if(d.get("panX")){let u=d.get("start"),g=d.get("end"),m=this._getWheelSign(d)*n*(g-u)*h,p=u+m,x=g+m,v=this._fixWheel(p,x);p=v[0],x=v[1],this._handleWheelAnimation(d.zoom(p,x))}}),i!=="panX"&&i!=="panXY"||o==0||this.xAxes.each(d=>{if(d.get("panX")){let u=d.get("start"),g=d.get("end"),m=this._getWheelSign(d)*n*(g-u)*o,p=u+m,x=g+m,v=this._fixWheel(p,x);p=v[0],x=v[1],this._handleWheelAnimation(d.zoom(p,x))}}),e!=="panY"&&e!=="panXY"||h==0||this.yAxes.each(d=>{if(d.get("panY")){let u=d.get("start"),g=d.get("end"),m=this._getWheelSign(d)*n*(g-u)*h,p=u+m,x=g+m,v=this._fixWheel(p,x);p=v[0],x=v[1],this._handleWheelAnimation(d.zoom(p,x))}}),i!=="panY"&&i!=="panXY"||o==0||this.yAxes.each(d=>{if(d.get("panY")){let u=d.get("start"),g=d.get("end"),m=this._getWheelSign(d)*n*(g-u)*o,p=u-m,x=g-m,v=this._fixWheel(p,x);p=v[0],x=v[1],this._handleWheelAnimation(d.zoom(p,x))}})}_handleSetWheel(){const t=this.get("wheelX"),e=this.get("wheelY"),i=this.plotContainer;t!=="none"||e!=="none"?(this._wheelDp=i.events.on("wheel",s=>{const a=s.originalEvent;(t!=="none"&&Math.abs(a.deltaX)!=0||e!=="none"&&Math.abs(a.deltaY)!=0)&&this.handleWheel(s)}),this._disposers.push(this._wheelDp)):this._wheelDp&&this._wheelDp.dispose()}_getWheelSign(t){let e=1;return t.get("renderer").get("inversed")&&(e=-1),e}_fixWheel(t,e){const i=e-t;return t<0&&(e=(t=0)+i),e>1&&(t=(e=1)-i),[t,e]}_handlePlotDown(t){const e=t.originalEvent;if(e.button==2)return;const i=this.plotContainer;let s=i.toLocal(t.point);if((this.get("pinchZoomX")||this.get("pinchZoomY"))&&e.pointerId&&et(i._downPoints).length>0){const a=this.xAxes.getIndex(0),r=this.yAxes.getIndex(0);a&&(this._downStartX=a.get("start",0),this._downEndX=a.get("end",1)),r&&(this._downStartY=r.get("start",0),this._downEndY=r.get("end",1))}if((this.get("panX")||this.get("panY"))&&s.x>=0&&s.y>=0&&s.x<=i.width()&&s.y<=this.height()){this._downPoint={x:e.clientX,y:e.clientY};const a=this.get("panX"),r=this.get("panY");a&&this.xAxes.each(o=>{o._panStart=o.get("start"),o._panEnd=o.get("end")}),r&&this.yAxes.each(o=>{o._panStart=o.get("start"),o._panEnd=o.get("end")});const n="panstarted";this.events.isEnabled(n)&&this.events.dispatch(n,{type:n,target:this,originalEvent:t.originalEvent})}}_handleWheelAnimation(t){t?t.events.on("stopped",()=>{this._dispatchWheelAnimation()}):this._dispatchWheelAnimation()}_dispatchWheelAnimation(){const t="wheelended";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this})}_handlePlotUp(t){const e=this._downPoint;if(e&&(this.get("panX")||this.get("panY"))){let i=this.plotContainer.toLocal(t.point);if(i.x==e.x&&i.y==e.y){const a="pancancelled";this.events.isEnabled(a)&&this.events.dispatch(a,{type:a,target:this,originalEvent:t.originalEvent})}const s="panended";this.events.isEnabled(s)&&this.events.dispatch(s,{type:s,target:this,originalEvent:t.originalEvent})}this._downPoint=void 0,this.xAxes.each(i=>{i._isPanning=!1}),this.yAxes.each(i=>{i._isPanning=!1})}_handlePlotMove(t){const e=this.plotContainer;if(this.get("pinchZoomX")||this.get("pinchZoomY")){const s=t.pointerId;if(s&&(this._movePoints[s]=t.point,et(e._downPoints).length>1))return void this._handlePinch()}let i=this._downPoint;if(i){i=e.toLocal(this._root.documentPointToRoot(i));let s=e.toLocal(t.point);const a=this.get("panX"),r=this.get("panY");if(a){let n=this.get("scrollbarX");n&&n.events.disableType("rangechanged"),this.xAxes.each(o=>{if(o.get("panX")){o._isPanning=!0;let h=o._panStart,c=o._panEnd,l=(c-h)*(i.x-s.x)/e.width();o.get("renderer").get("inversed")&&(l*=-1);let d=h+l,u=c+l;u-d<1+2*o.get("maxDeviation",1)&&(o.set("start",d),o.set("end",u))}}),n&&n.events.enableType("rangechanged")}if(r){let n=this.get("scrollbarY");n&&n.events.disableType("rangechanged"),this.yAxes.each(o=>{if(o.get("panY")){o._isPanning=!0;let h=o._panStart,c=o._panEnd,l=(c-h)*(i.y-s.y)/e.height();o.get("renderer").get("inversed")&&(l*=-1);let d=h-l,u=c-l;u-d<1+2*o.get("maxDeviation",1)&&(o.set("start",d),o.set("end",u))}}),n&&n.events.enableType("rangechanged")}}}_handlePinch(){const t=this.plotContainer;let e=0,i=[],s=[];if(J(t._downPoints,(a,r)=>{i[e]=r;let n=this._movePoints[a];n&&(s[e]=n),e++}),i.length>1&&s.length>1){const a=t.width(),r=t.height();let n=i[0],o=i[1],h=s[0],c=s[1];if(n&&o&&h&&c){if(h=t.toLocal(h),c=t.toLocal(c),n=t.toLocal(n),o=t.toLocal(o),this.get("pinchZoomX")){const l=this._downStartX,d=this._downEndX;if(l!=null&&d!=null){n.x>o.x&&([n,o]=[o,n],[h,c]=[c,h]);let u=l+n.x/a*(d-l),g=l+o.x/a*(d-l),m=l+h.x/a*(d-l),p=l+c.x/a*(d-l),x=Math.max(.001,g-u)/Math.max(.001,p-m),v=l*x+u-m*x,_=d*x+g-p*x;this.xAxes.each(f=>{let w=f.fixPosition(v),A=f.fixPosition(_);f.zoom(w,A,0)})}}if(this.get("pinchZoomY")){const l=this._downStartY,d=this._downEndY;if(l!=null&&d!=null){n.y{let w=f.fixPosition(v),A=f.fixPosition(_);f.zoom(w,A,0)})}}}}}_handleCursorPosition(){const t=this.get("cursor");if(t){const e=t.getPrivate("point");let i=t.get("snapToSeries");if(t._downPoint&&(i=void 0),i&&e){const s=t.get("snapToSeriesBy"),a=[];P(i,o=>{if(!o.isHidden()&&!o.isHiding())if(s!="x!"&&s!="y!"){const h=o.startIndex(),c=o.endIndex();for(let l=h;l{const h=o.get("point");if(h){let c=0;c=s=="x"||s=="x!"?Math.abs(e.x-h.x):s=="y"||s=="y!"?Math.abs(e.y-h.y):Math.hypot(e.x-h.x,e.y-h.y),c{const h=o.get("tooltip");h&&h._setDataItem(void 0)}),r){let o=r.component;o.showDataItemTooltip(r);const h=r.get("point");h&&t.handleMove(o.toGlobal({x:h.x-o.x(),y:h.y-o.y()}),!0)}}}}_updateCursor(){let t=this.get("cursor");t&&t.updateCursor()}_addCursor(t){this.plotContainer.children.push(t)}_prepareChildren(){if(super._prepareChildren(),this.series.each(t=>{this._colorize(t)}),(this.isDirty("wheelX")||this.isDirty("wheelY"))&&this._handleSetWheel(),this.isDirty("cursor")){const t=this._prevSettings.cursor,e=this.get("cursor");e!==t&&(this._disposeProperty("cursor"),t&&t.dispose(),e&&(e._setChart(this),this._addCursor(e),this._pushPropertyDisposer("cursor",e.events.on("selectended",()=>{this._handleCursorSelectEnd()}))),this._prevSettings.cursor=e)}if(this.isDirty("scrollbarX")){const t=this._prevSettings.scrollbarX,e=this.get("scrollbarX");e!==t&&(this._disposeProperty("scrollbarX"),t&&t.dispose(),e&&(e.parent||this.topAxesContainer.children.push(e),this._pushPropertyDisposer("scrollbarX",e.events.on("rangechanged",i=>{this._handleScrollbar(this.xAxes,i.start,i.end,i.grip)})),e.setPrivate("positionTextFunction",i=>{const s=this.xAxes.getIndex(0);return s&&s.getTooltipText(i,!1)||""})),this._prevSettings.scrollbarX=e)}if(this.isDirty("scrollbarY")){const t=this._prevSettings.scrollbarY,e=this.get("scrollbarY");e!==t&&(this._disposeProperty("scrollbarY"),t&&t.dispose(),e&&(e.parent||this.rightAxesContainer.children.push(e),this._pushPropertyDisposer("scrollbarY",e.events.on("rangechanged",i=>{this._handleScrollbar(this.yAxes,i.start,i.end,i.grip)})),e.setPrivate("positionTextFunction",i=>{const s=this.yAxes.getIndex(0);return s&&s.getTooltipText(i,!1)||""})),this._prevSettings.scrollbarY=e)}this._handleZoomOut()}_processSeries(t){super._processSeries(t);const e=t.get("xAxis"),i=t.get("yAxis");vt(e.series,t),vt(i.series,t),t._posXDp=t.addDisposer(e.events.on("positionchanged",()=>{t._fixPosition()})),t._posXDp=t.addDisposer(i.events.on("positionchanged",()=>{t._fixPosition()})),t.get("baseAxis")||(i.isType("CategoryAxis")||i.isType("DateAxis")?t.set("baseAxis",i):t.set("baseAxis",e)),t.get("stacked")&&(t._markDirtyKey("stacked"),P(t.dataItems,s=>{s.set("stackToItemY",void 0),s.set("stackToItemX",void 0)})),t._markDirtyAxes(),i.markDirtyExtremes(),e.markDirtyExtremes(),this._colorize(t)}_colorize(t){const e=this.get("colors");if(e&&t.get("fill")==null){const i=e.next();t._setSoft("stroke",i),t._setSoft("fill",i)}}_handleCursorSelectEnd(){const t=this.get("cursor"),e=t.get("behavior"),i=t.getPrivate("downPositionX",0),s=t.getPrivate("downPositionY",0),a=Math.min(1,Math.max(0,t.getPrivate("positionX",.5))),r=Math.min(1,Math.max(0,t.getPrivate("positionY",.5)));this.xAxes.each(n=>{if(e==="zoomX"||e==="zoomXY"){let o=n.toAxisPosition(i),h=n.toAxisPosition(a);n.zoom(o,h)}n.setPrivate("updateScrollbar",!0)}),this.yAxes.each(n=>{if(e==="zoomY"||e==="zoomXY"){let o=n.toAxisPosition(s),h=n.toAxisPosition(r);n.zoom(o,h)}n.setPrivate("updateScrollbar",!0)})}_handleScrollbar(t,e,i,s){t.each(a=>{let r=a.fixPosition(e),n=a.fixPosition(i),o=a.zoom(r,n,void 0,s);const h="updateScrollbar";a.setPrivateRaw(h,!1),o?o.events.on("stopped",()=>{a.setPrivateRaw(h,!0)}):a.setPrivateRaw(h,!0)})}_processAxis(t,e){return t.events.onAll(i=>{if(i.type==="clear")P(i.oldValues,s=>{this._removeAxis(s)});else if(i.type==="push")e.children.push(i.newValue),i.newValue.processChart(this);else if(i.type==="setIndex")e.children.setIndex(i.index,i.newValue),i.newValue.processChart(this);else if(i.type==="insertIndex")e.children.insertIndex(i.index,i.newValue),i.newValue.processChart(this);else if(i.type==="removeIndex")this._removeAxis(i.oldValue);else{if(i.type!=="moveIndex")throw new Error("Unknown IListEvent type");e.children.moveValue(i.value,i.newIndex),i.value.processChart(this)}})}_removeAxis(t){if(!t.isDisposed()){const e=t.parent;e&&e.children.removeValue(t);const i=t.gridContainer,s=i.parent;s&&s.children.removeValue(i);const a=t.topGridContainer,r=a.parent;r&&r.children.removeValue(a)}}_updateChartLayout(){const t=this.leftAxesContainer.width(),e=this.rightAxesContainer.width(),i=this.bottomAxesContainer;i.set("paddingLeft",t),i.set("paddingRight",e);const s=this.topAxesContainer;s.set("paddingLeft",t),s.set("paddingRight",e)}processAxis(t){this.get("cursor")&&(this.addDisposer(t.on("start",()=>{this._updateCursor()})),this.addDisposer(t.on("end",()=>{this._updateCursor()})))}_handleAxisSelection(t,e){let i=t.fixPosition(t.get("start",0)),s=t.fixPosition(t.get("end",1));if(i>s&&([i,s]=[s,i]),this.xAxes.indexOf(t)!=-1){if(e||t.getPrivate("updateScrollbar")){let a=this.get("scrollbarX");!a||a.getPrivate("isBusy")&&!e||(a.setRaw("start",i),a.setRaw("end",s),a.updateGrips())}}else if(this.yAxes.indexOf(t)!=-1&&(e||t.getPrivate("updateScrollbar"))){let a=this.get("scrollbarY");!a||a.getPrivate("isBusy")&&!e||(a.setRaw("start",i),a.setRaw("end",s),a.updateGrips())}this._handleZoomOut()}_handleZoomOut(){let t=this.zoomOutButton;if(t&&t.parent){let e=!1;this.xAxes.each(i=>{i.get("start")==0&&i.get("end")==1||(e=!0)}),this.yAxes.each(i=>{i.get("start")==0&&i.get("end")==1||(e=!0)}),e?t.isHidden()&&t.show():t.hide()}}inPlot(t){const e=this.plotContainer,i=this.getPrivate("otherCharts",this._otherCharts),s=e.toGlobal(t);if(t.x>=-.5&&t.y>=-.5&&t.x<=e.width()+.5&&t.y<=e.height()+.5)return!0;if(i)for(let a=i.length-1;a>=0;a--){const r=i[a];if(r!=this){const n=r.plotContainer,o=this._root.rootPointToDocument(s),h=r._root.documentPointToRoot(o),c=n.toLocal(h);if(c.x>=-.1&&c.y>=-.1&&c.x<=n.width()+.1&&c.y<=n.height()+.1)return!0}}return!1}arrangeTooltips(){const t=this.plotContainer,e=t.width(),i=t.height(),s=this.height();let a=t._display.toGlobal({x:0,y:0}),r=t._display.toGlobal({x:e,y:i});const n=[];let o,h,c=0,l=1/0,d=this._movePoint,u=this.get("maxTooltipDistance"),g=this.get("maxTooltipDistanceBy","xy");b(u)&&this.series.each(p=>{if(!p.isHidden()){const x=p.get("tooltip");if(x){let v=x.get("pointTo");if(v){let _=Math.hypot(d.x-v.x,d.y-v.y);g=="x"?_=Math.abs(d.x-v.x):g=="y"&&(_=Math.abs(d.y-v.y)),_{const x=p.get("tooltip");if(x){let v=!1,_=x.get("pointTo");if(_){if(u>=0){let f=x.get("pointTo");if(f&&p!=o){let w=Math.hypot(h.x-f.x,h.y-f.y);g=="x"?w=Math.abs(h.x-f.x):g=="y"&&(w=Math.abs(h.y-f.y)),w>u&&(v=!0)}}else u==-1&&p!=o&&(v=!0);this.inPlot(this._tooltipToLocal(_))&&x.dataItem?v||(c+=_.y):v=!0,v||p.isHidden()||p.isHiding()?x.hide(0):(x.show(),n.push(x),m.push(p))}}}),this.setPrivate("tooltipSeries",m),this.get("arrangeTooltips")){const p=this._root.tooltipContainer,x=n.length;if(c/x>i/2+a.y){n.sort((_,f)=>yt(f.get("pointTo").y,_.get("pointTo").y));let v=r.y;if(P(n,_=>{let f=_.height(),w=_.get("centerY");w instanceof Mt&&(f*=w.value),f+=_.get("marginBottom",0),_.set("bounds",{left:a.x,top:a.y,right:r.x,bottom:v}),_.setPrivate("customData",{left:a.x,top:a.y,right:r.x,bottom:v}),v=Math.min(v-f,_._fy-f),_.parent==p&&p.children.moveValue(_,0)}),v<0){n.reverse();let _=v;P(n,f=>{let w=f.get("bounds");if(w){let A=w.top-v,F=w.bottom-v;A<_&&(A=_,F=A+f.height()),f.set("bounds",{left:w.left,top:A,right:w.right,bottom:F}),_=w.bottom-v+f.get("marginBottom",0)}})}}else{n.reverse(),n.sort((_,f)=>yt(_.get("pointTo").y,f.get("pointTo").y));let v=0;if(P(n,_=>{let f=_.height(),w=_.get("centerY");w instanceof Mt&&(f*=w.value),f+=_.get("marginBottom",0),_.set("bounds",{left:a.x,top:v,right:r.x,bottom:Math.max(a.y+s,v+f)}),_.parent==p&&p.children.moveValue(_,0),v=Math.max(v+f,_._fy+f)}),v>s){n.reverse();let _=s;P(n,f=>{let w=f.get("bounds");if(w){let A=w.top-(s-v),F=w.bottom-(s-v);F>_&&(F=_,A=F-f.height()),f.set("bounds",{left:w.left,top:A,right:w.right,bottom:F}),_=F-f.height()-f.get("marginBottom",0)}})}}}}_tooltipToLocal(t){return this.plotContainer.toLocal(t)}zoomOut(){this.xAxes.each(t=>{t.setPrivate("updateScrollbar",!0),t.zoom(0,1)}),this.yAxes.each(t=>{t.setPrivate("updateScrollbar",!0),t.zoom(0,1)})}}Object.defineProperty(nt,"className",{enumerable:!0,configurable:!0,writable:!0,value:"XYChart"}),Object.defineProperty(nt,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Yt.classNames.concat([nt.className])});class z extends Y{_beforeChanged(){super._beforeChanged(),(this.isPrivateDirty("width")||this.isPrivateDirty("height"))&&(this._clear=!0)}}Object.defineProperty(z,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Grid"}),Object.defineProperty(z,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Y.classNames.concat([z.className])});class rt extends T{constructor(){super(...arguments),Object.defineProperty(this,"lineX",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(z.new(this._root,{themeTags:["x"]}))}),Object.defineProperty(this,"lineY",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(z.new(this._root,{themeTags:["y"]}))}),Object.defineProperty(this,"selection",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(Y.new(this._root,{themeTags:["selection","cursor"],layer:30}))}),Object.defineProperty(this,"_movePoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_lastPoint",{enumerable:!0,configurable:!0,writable:!0,value:{x:0,y:0}}),Object.defineProperty(this,"_tooltipX",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_tooltipY",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"chart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_toX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_toY",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_afterNew(){this._settings.themeTags=S(this._settings.themeTags,["xy","cursor"]),super._afterNew(),this.setAll({width:k,height:k,isMeasured:!0,position:"absolute"}),this.states.create("hidden",{visible:!0,opacity:0}),this._drawLines(),this.setPrivateRaw("visible",!1),this._disposers.push(this.setTimeout(()=>{this.setPrivate("visible",!0)},500)),this._disposers.push(this.lineX.events.on("positionchanged",()=>{this._handleXLine()})),this._disposers.push(this.lineY.events.on("positionchanged",()=>{this._handleYLine()})),this._disposers.push(this.lineX.events.on("focus",t=>this._handleLineFocus(t.target))),this._disposers.push(this.lineX.events.on("blur",t=>this._handleLineBlur(t.target))),this._disposers.push(this.lineY.events.on("focus",t=>this._handleLineFocus(t.target))),this._disposers.push(this.lineY.events.on("blur",t=>this._handleLineBlur(t.target))),wt("keyboardevents")&&this._disposers.push(qt(document,"keydown",t=>{this._handleLineMove(t.keyCode)}))}_setUpTouch(){const t=this.chart;t&&(t.plotContainer._display.cancelTouch=this.get("behavior")!="none")}_handleXLine(){let t=this.lineX.x(),e=!0;(t<0||t>this.width())&&(e=!1),this.lineX.setPrivate("visible",e)}_handleYLine(){let t=this.lineY.y(),e=!0;(t<0||t>this.height())&&(e=!1),this.lineY.setPrivate("visible",e)}_handleLineMove(t){let e="",i=0,s=.1;const a=this.chart;this._root.focused(this.lineX)?(a&&a.xAxes.length&&(s=a.xAxes.getIndex(0).getCellWidthPosition()),i=this.getPrivate("positionX",0),e="positionX",t==37?i-=s:t==39&&(i+=s)):this._root.focused(this.lineY)&&(a&&a.yAxes.length&&(s=a.yAxes.getIndex(0).getCellWidthPosition()),i=this.getPrivate("positionY",0),e="positionY",t==38?i-=s:t==40&&(i+=s)),i<0?i=0:i>1&&(i=1),e!=""&&this.set(e,i)}_handleLineFocus(t){this.setAll({positionX:this.getPrivate("positionX"),positionY:this.getPrivate("positionY"),alwaysShow:!0})}_handleLineBlur(t){this.setAll({positionX:void 0,positionY:void 0,alwaysShow:!1})}_prepareChildren(){if(super._prepareChildren(),this.isDirty("xAxis")){this._tooltipX=!1;const t=this.get("xAxis");if(t){const e=t.get("tooltip");e&&(this._tooltipX=!0,this._disposers.push(e.on("pointTo",()=>{this._updateXLine(e)})))}}if(this.isDirty("yAxis")){this._tooltipY=!1;const t=this.get("yAxis");if(t){const e=t.get("tooltip");e&&(this._tooltipY=!0,this._disposers.push(e.on("pointTo",()=>{this._updateYLine(e)})))}}}_handleSyncWith(){const t=this.chart;if(t){const e=this.get("syncWith"),i=[];e&&P(e,s=>{const a=s.chart;a&&i.push(a)}),t._otherCharts=i}}_updateChildren(){if(super._updateChildren(),this._handleSyncWith(),this.isDirty("positionX")||this.isDirty("positionY")){const t=this.get("positionX"),e=this.get("positionY");t==null&&e==null?this.hide(0):(this._movePoint=this.toGlobal(this._getPoint(this.get("positionX",0),this.get("positionY",0))),this.handleMove())}}_updateXLine(t){let e=X(this._display.toLocal(t.get("pointTo",{x:0,y:0})).x,2);this._toX!=e&&(this.lineX.animate({key:"x",to:e,duration:t.get("animationDuration",0),easing:t.get("animationEasing")}),this._toX=e)}_updateYLine(t){let e=X(this._display.toLocal(t.get("pointTo",{x:0,y:0})).y,2);this._toY!=e&&(this.lineY.animate({key:"y",to:e,duration:t.get("animationDuration",0),easing:t.get("animationEasing")}),this._toY=e)}_drawLines(){this.lineX.set("draw",t=>{t.moveTo(0,0),t.lineTo(0,this.height())}),this.lineY.set("draw",t=>{t.moveTo(0,0),t.lineTo(this.width(),0)})}updateCursor(){this.get("alwaysShow")&&(this._movePoint=this.toGlobal(this._getPoint(this.get("positionX",0),this.get("positionY",0)))),this.handleMove()}_setChart(t){this.chart=t,this._handleSyncWith();const e=t.plotContainer;this.events.on("boundschanged",()=>{this._disposers.push(this.setTimeout(()=>{this.updateCursor()},50))}),wt("touchevents")&&(this._disposers.push(e.events.on("click",s=>{Jt(s.originalEvent)&&this._handleMove(s)})),this._setUpTouch()),this._disposers.push(e.events.on("pointerdown",s=>{this._handleCursorDown(s)})),this._disposers.push(e.events.on("globalpointerup",s=>{this._handleCursorUp(s),s.native||this.isHidden()||this._handleMove(s)})),this._disposers.push(e.events.on("globalpointermove",s=>{(this.get("syncWith")||et(e._downPoints).length!=0||s.native||!this.isHidden())&&this._handleMove(s)}));const i=this.parent;i&&i.children.moveValue(this.selection)}_inPlot(t){const e=this.chart;return!!e&&e.inPlot(t)}_handleCursorDown(t){if(t.originalEvent.button==2)return;const e=t.point;let i=this._display.toLocal(e);const s=this.chart;if(this.selection.set("draw",()=>{}),s&&this._inPlot(i)){if(this._downPoint=i,this.get("behavior")!="none"){this.selection.show();const n="selectstarted";this.events.isEnabled(n)&&this.events.dispatch(n,{type:n,target:this,originalEvent:t.originalEvent})}let a=this._getPosition(i).x,r=this._getPosition(i).y;this.setPrivate("downPositionX",a),this.setPrivate("downPositionY",r)}}_handleCursorUp(t){if(this._downPoint){const e=this.get("behavior","none");if(e!="none"){e.charAt(0)==="z"&&this.selection.hide();const i=t.point;let s=this._display.toLocal(i);const a=this._downPoint,r=this.get("moveThreshold",1);if(s&&a){let n=!1;if(e!=="zoomX"&&e!=="zoomXY"&&e!=="selectX"&&e!=="selectXY"||Math.abs(s.x-a.x)>r&&(n=!0),e!=="zoomY"&&e!=="zoomXY"&&e!=="selectY"&&e!=="selectXY"||Math.abs(s.y-a.y)>r&&(n=!0),n){const o="selectended";this.events.isEnabled(o)&&this.events.dispatch(o,{type:o,target:this,originalEvent:t.originalEvent})}else{const o="selectcancelled";this.events.isEnabled(o)&&this.events.dispatch(o,{type:o,target:this,originalEvent:t.originalEvent})}}}}this._downPoint=void 0}_handleMove(t){if(this.getPrivate("visible")){const e=this.chart;if(e&&et(e.plotContainer._downPoints).length>1)return void this.set("forceHidden",!0);this.set("forceHidden",!1);const i=t.point,s=this._lastPoint;if(Math.round(s.x)===Math.round(i.x)&&Math.round(s.y)===Math.round(i.y))return;this._lastPoint=i,this.setPrivate("lastPoint",i),this.handleMove({x:i.x,y:i.y},!1,t.originalEvent)}}_getPosition(t){return{x:t.x/this.width(),y:t.y/this.height()}}handleMove(t,e,i){t||(t=this._movePoint);const s=this.get("alwaysShow");if(!t)return void this.hide(0);this._movePoint=t;let a=this._display.toLocal(t),r=this.chart;if(r&&(this._inPlot(a)||this._downPoint)){r._movePoint=t,this.isHidden()&&(this.show(),this.get("behavior","").charAt(0)=="z"&&this.selection.set("draw",()=>{}));let n=a.x,o=a.y,h=this._getPosition(a);this.setPrivate("point",a);let c=this.get("snapToSeries");this._downPoint&&(c=void 0);let l=this.get("positionX"),d=h.x;b(l)&&(d=l);let u=this.get("positionY"),g=h.y;b(u)&&(g=u),this.setPrivate("positionX",d),this.setPrivate("positionY",g);const m=this._getPoint(d,g);if(n=m.x,o=m.y,r.xAxes.each(p=>{p._handleCursorPosition(d,c),s&&p.handleCursorShow()}),r.yAxes.each(p=>{p._handleCursorPosition(g,c),s&&p.handleCursorShow()}),!e){r._handleCursorPosition();const p="cursormoved";this.events.isEnabled(p)&&this.events.dispatch(p,{type:p,target:this,point:t,originalEvent:i})}this._updateLines(n,o),r.arrangeTooltips()}else if(!this._downPoint&&!s){this.hide(0);const n="cursorhidden";this.events.isEnabled(n)&&this.events.dispatch(n,{type:n,target:this})}this._downPoint&&this.get("behavior")!="none"&&this._updateSelection(a)}_getPoint(t,e){return{x:this.width()*t,y:this.height()*e}}_updateLines(t,e){this._tooltipX||this.lineX.set("x",t),this._tooltipY||this.lineY.set("y",e),this._drawLines()}_updateSelection(t){const e=this.selection,i=this.get("behavior"),s=this.width(),a=this.height();t.x<0&&(t.x=0),t.x>s&&(t.x=s),t.y<0&&(t.y=0),t.y>a&&(t.y=a),e.set("draw",r=>{const n=this._downPoint;n&&(i==="zoomXY"||i==="selectXY"?(r.moveTo(n.x,n.y),r.lineTo(n.x,t.y),r.lineTo(t.x,t.y),r.lineTo(t.x,n.y),r.lineTo(n.x,n.y)):i==="zoomX"||i==="selectX"?(r.moveTo(n.x,0),r.lineTo(n.x,a),r.lineTo(t.x,a),r.lineTo(t.x,0),r.lineTo(n.x,0)):i!=="zoomY"&&i!=="selectY"||(r.moveTo(0,n.y),r.lineTo(s,n.y),r.lineTo(s,t.y),r.lineTo(0,t.y),r.lineTo(0,n.y)))})}_onHide(){if(this.isHidden()){let t=this.chart;t&&(t.xAxes.each(e=>{e.handleCursorHide()}),t.yAxes.each(e=>{e.handleCursorHide()}),t.series.each(e=>{e.handleCursorHide()}))}super._onHide()}_onShow(){if(!this.isHidden()){let t=this.chart;t&&(t.xAxes.each(e=>{e.handleCursorShow()}),t.yAxes.each(e=>{e.handleCursorShow()}))}super._onShow()}_dispose(){super._dispose(),this.selection.dispose()}}function le(y,t){return y==null?t:t==null?y:ty?t:y}Object.defineProperty(rt,"className",{enumerable:!0,configurable:!0,writable:!0,value:"XYCursor"}),Object.defineProperty(rt,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:T.classNames.concat([rt.className])});class W extends Lt{constructor(){super(...arguments),Object.defineProperty(this,"_xField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_xOpenField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yOpenField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_xLowField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_xHighField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yLowField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_yHighField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_axesDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_stackDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_selectionProcessed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataSets",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_mainContainerMask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_x",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_y",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"mainContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(T.new(this._root,{}))}),Object.defineProperty(this,"axisRanges",{enumerable:!0,configurable:!0,writable:!0,value:new Ot}),Object.defineProperty(this,"_skipped",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_couldStackTo",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_reallyStackedTo",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_stackedSeries",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_aLocationX0",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_aLocationX1",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_aLocationY0",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_aLocationY1",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_showBullets",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"valueXFields",{enumerable:!0,configurable:!0,writable:!0,value:["valueX","openValueX","lowValueX","highValueX"]}),Object.defineProperty(this,"valueYFields",{enumerable:!0,configurable:!0,writable:!0,value:["valueY","openValueY","lowValueY","highValueY"]}),Object.defineProperty(this,"_valueXFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valueYFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valueXShowFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valueYShowFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__valueXShowFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"__valueYShowFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_emptyDataItem",{enumerable:!0,configurable:!0,writable:!0,value:new st(this,void 0,{})}),Object.defineProperty(this,"_dataSetId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipFieldX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipFieldY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_posXDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_posYDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_afterNew(){this.fields.push("categoryX","categoryY","openCategoryX","openCategoryY"),this.valueFields.push("valueX","valueY","openValueX","openValueY","lowValueX","lowValueY","highValueX","highValueY"),this._setRawDefault("vcx",1),this._setRawDefault("vcy",1),this._setRawDefault("valueXShow","valueXWorking"),this._setRawDefault("valueYShow","valueYWorking"),this._setRawDefault("openValueXShow","openValueXWorking"),this._setRawDefault("openValueYShow","openValueYWorking"),this._setRawDefault("lowValueXShow","lowValueXWorking"),this._setRawDefault("lowValueYShow","lowValueYWorking"),this._setRawDefault("highValueXShow","highValueXWorking"),this._setRawDefault("highValueYShow","highValueYWorking"),this._setRawDefault("lowValueXGrouped","low"),this._setRawDefault("lowValueYGrouped","low"),this._setRawDefault("highValueXGrouped","high"),this._setRawDefault("highValueYGrouped","high"),super._afterNew(),this.set("maskContent",!0),this._disposers.push(this.axisRanges.events.onAll(t=>{if(t.type==="clear")P(t.oldValues,e=>{this._removeAxisRange(e)});else if(t.type==="push")this._processAxisRange(t.newValue);else if(t.type==="setIndex")this._processAxisRange(t.newValue);else if(t.type==="insertIndex")this._processAxisRange(t.newValue);else if(t.type==="removeIndex")this._removeAxisRange(t.oldValue);else{if(t.type!=="moveIndex")throw new Error("Unknown IStreamEvent type");this._processAxisRange(t.value)}})),this.states.create("hidden",{opacity:1,visible:!1}),this._makeFieldNames()}_processAxisRange(t){const e=T.new(this._root,{});t.container=e,this.children.push(e),t.series=this;const i=t.axisDataItem;i.setRaw("isRange",!0);const s=i.component;if(s){s._processAxisRange(i,["range","series"]);const a=i.get("bullet");if(a){const n=a.get("sprite");n&&n.setPrivate("visible",!1)}const r=i.get("axisFill");r&&e.set("mask",r),s._seriesAxisRanges.push(i)}}_removeAxisRange(t){const e=t.axisDataItem,i=e.component;i.disposeDataItem(e),q(i._seriesAxisRanges,e);const s=t.container;s&&s.dispose()}_updateFields(){super._updateFields(),this._valueXFields=[],this._valueYFields=[],this._valueXShowFields=[],this._valueYShowFields=[],this.__valueXShowFields=[],this.__valueYShowFields=[],this.valueXFields&&P(this.valueXFields,t=>{if(this.get(t+"Field")){this._valueXFields.push(t);let e=this.get(t+"Show");this.__valueXShowFields.push(e),e.indexOf("Working")!=-1?this._valueXShowFields.push(e.split("Working")[0]):this._valueXShowFields.push(e)}}),this.valueYFields&&P(this.valueYFields,t=>{if(this.get(t+"Field")){this._valueYFields.push(t);let e=this.get(t+"Show");this.__valueYShowFields.push(e),e.indexOf("Working")!=-1?this._valueYShowFields.push(e.split("Working")[0]):this._valueYShowFields.push(e)}})}_dispose(){super._dispose();const t=this.chart;t&&t.series.removeValue(this),Pt(this.get("xAxis").series,this),Pt(this.get("yAxis").series,this)}_min(t,e){let i=le(this.getPrivate(t),e);this.setPrivate(t,i)}_max(t,e){let i=he(this.getPrivate(t),e);this.setPrivate(t,i)}_shouldMakeBullet(t){const e=this.get("xAxis"),i=this.get("yAxis"),s=this.get("baseAxis");if(!e.inited||!i.inited)return!1;const a=this.get("minBulletDistance",0);if(a>0){let r=this.startIndex(),n=this.endIndex()-r;if(e==s){if(e.get("renderer").axisLength()/n{P(this._valueXShowFields,o=>{let h=n.get(o);h!=null&&(r&&(h+=this.getStackedXValue(n,o)),this._min("minX",h),this._max("maxX",h))}),P(this._valueYShowFields,o=>{let h=n.get(o);h!=null&&(r&&(h+=this.getStackedYValue(n,o)),this._min("minY",h),this._max("maxY",h))}),t.processSeriesDataItem(n,this._valueXFields),e.processSeriesDataItem(n,this._valueYFields)}),t._seriesValuesDirty=!0,e._seriesValuesDirty=!0,this.get("ignoreMinMax")||((this.isPrivateDirty("minX")||this.isPrivateDirty("maxX"))&&t.markDirtyExtremes(),(this.isPrivateDirty("minY")||this.isPrivateDirty("maxY"))&&e.markDirtyExtremes()),this._markStakedDirtyStack(),this.get("tooltipDataItem")||this.updateLegendValue(void 0)),(this.isDirty("vcx")||this.isDirty("vcy"))&&this._markStakedDirtyStack(),this._dataGrouped||(t._groupSeriesData(this),e._groupSeriesData(this),this._dataGrouped=!0),this._valuesDirty||this.isPrivateDirty("startIndex")||this.isPrivateDirty("endIndex")||this.isDirty("vcx")||this.isDirty("vcy")||this._stackDirty){let n=this.startIndex(),o=this.endIndex(),h=this.get("minBulletDistance",0);if(h>0&&i&&(i.get("renderer").axisLength()/(o-n)>h?this._showBullets=!0:this._showBullets=!1),(this._psi!=n||this._pei!=o||this.isDirty("vcx")||this.isDirty("vcy")||this._stackDirty||this._valuesDirty)&&!this._selectionProcessed){this._selectionProcessed=!0;const c=this.get("vcx",1),l=this.get("vcy",1),d=this.get("stacked",!1),u=this.getPrivate("outOfSelection");if(i===t||!i)if(e._calculateTotals(),this.setPrivateRaw("selectionMinY",void 0),this.setPrivateRaw("selectionMaxY",void 0),u)e.markDirtySelectionExtremes();else for(let g=n;g0){let t=this._mainContainerMask;t==null&&(t=this.children.push(Y.new(this._root,{})),this._mainContainerMask=t,t.set("draw",(e,i)=>{const s=this.parent;if(s){const a=this._root.container.width(),r=this._root.container.height();e.moveTo(-a,-r),e.lineTo(-a,2*r),e.lineTo(2*a,2*r),e.lineTo(2*a,-r),e.lineTo(-a,-r),this.axisRanges.each(n=>{const o=n.axisDataItem.get("axisFill");if(s&&o){let h=o.get("draw");h&&h(e,i)}})}this.mainContainer._display.mask=t._display})),t.markDirty(),t._markDirtyKey("fill")}else this.mainContainer._display.mask=null}_updateChildren(){super._updateChildren(),this._x=this.x(),this._y=this.y(),this._makeRangeMask()}_stack(){const t=this.chart;if(t){const e=t.series.indexOf(this);if(this._couldStackTo=[],e>0){let i;for(let s=e-1;s>=0&&(i=t.series.getIndex(s),i.get("xAxis")!==this.get("xAxis")||i.get("yAxis")!==this.get("yAxis")||i.className!==this.className||(this._couldStackTo.push(i),i.get("stacked")));s--);}this._stackDataItems()}}_unstack(){J(this._reallyStackedTo,(t,e)=>{delete e._stackedSeries[this.uid]}),this._reallyStackedTo={},P(this.dataItems,t=>{t.setRaw("stackToItemY",void 0),t.setRaw("stackToItemX",void 0)})}_stackDataItems(){const t=this.get("baseAxis"),e=this.get("xAxis"),i=this.get("yAxis");let s,a;t===e?(s="valueY",a="stackToItemY"):t===i&&(s="valueX",a="stackToItemX");let r=this._couldStackTo.length,n=0;const o=this.get("stackToNegative");this._reallyStackedTo={},P(this.dataItems,h=>{for(let c=0;c=0&&g>=0){h.setRaw(a,d),this._reallyStackedTo[l.uid]=l,l._stackedSeries[this.uid]=this;break}if(u<0&&g<0){h.setRaw(a,d),this._reallyStackedTo[l.uid]=l,l._stackedSeries[this.uid]=this;break}}}else if(b(u)&&b(g)){h.setRaw(a,d),this._reallyStackedTo[l.uid]=l,l._stackedSeries[this.uid]=this;break}}}n++})}processXSelectionDataItem(t,e,i){P(this.__valueXShowFields,s=>{let a=t.get(s);a!=null&&(i&&(a+=this.getStackedXValueWorking(t,s)),this._min("selectionMinX",a),this._max("selectionMaxX",a*e))})}processYSelectionDataItem(t,e,i){P(this.__valueYShowFields,s=>{let a=t.get(s);a!=null&&(i&&(a+=this.getStackedYValueWorking(t,s)),this._min("selectionMinY",a),this._max("selectionMaxY",a*e))})}getStackedYValueWorking(t,e){const i=t.get("stackToItemY");if(i){const s=i.component;return i.get(e,0)*s.get("vcy",1)+this.getStackedYValueWorking(i,e)}return 0}getStackedXValueWorking(t,e){const i=t.get("stackToItemX");if(i){const s=i.component;return i.get(e,0)*s.get("vcx",1)+this.getStackedXValueWorking(i,e)}return 0}getStackedYValue(t,e){const i=t.get("stackToItemY");return i?i.get(e,0)+this.getStackedYValue(i,e):0}getStackedXValue(t,e){const i=t.get("stackToItemX");return i?i.get(e,0)+this.getStackedXValue(i,e):0}createLegendMarker(t){this.updateLegendMarker()}_markDirtyAxes(){this._axesDirty=!0,this.markDirty()}_markDataSetDirty(){this._afterDataChange(),this._valuesDirty=!0,this._dataProcessed=!1,this._aggregatesCalculated=!1,this.markDirty()}_clearDirty(){super._clearDirty(),this._axesDirty=!1,this._selectionProcessed=!1,this._stackDirty=!1,this._dataProcessed=!1}_positionBullet(t){let e=t.get("sprite");if(e){let i=e.dataItem,s=t.get("locationX",i.get("locationX",.5)),a=t.get("locationY",i.get("locationY",.5)),r=this.get("xAxis"),n=this.get("yAxis");const o=r.getDataItemPositionX(i,this._xField,s,this.get("vcx",1)),h=n.getDataItemPositionY(i,this._yField,a,this.get("vcy",1));let c=this.getPoint(o,h),l=i.get("left",c.x),d=i.get("right",c.x),u=i.get("top",c.y),g=i.get("bottom",c.y);if(this._shouldShowBullet(o,h)){t.getPrivate("hidden")?e.setPrivate("visible",!1):e.setPrivate("visible",!0);let m=d-l,p=g-u;e.isType("Label")&&(e.setPrivate("maxWidth",Math.abs(m)),e.setPrivate("maxHeight",Math.abs(p)));let x=l+m*s,v=g-p*a;e.set("x",x),e.set("y",v)}else e.setPrivate("visible",!1)}}_shouldShowBullet(t,e){return this._showBullets}setDataSet(t){if(this._dataSets[t]){this._handleDataSetChange(),this._dataItems=this._dataSets[t],this._markDataSetDirty(),this._dataSetId=t;const e="datasetchanged";this.events.isEnabled(e)&&this.events.dispatch(e,{type:e,target:this,id:t})}}resetGrouping(){J(this._dataSets,(t,e)=>{e!=this._mainDataItems&&P(e,i=>{this.disposeDataItem(i)})}),this._dataSets={},this._dataItems=this.mainDataItems}_handleDataSetChange(){this.bullets.length>0&&P(this._dataItems,t=>{let e=t.bullets;e&&P(e,i=>{if(i){let s=i.get("sprite");s&&s.setPrivate("visible",!1)}})}),this._selectionProcessed=!1}show(t){const e=Object.create(null,{show:{get:()=>super.show}});return K(this,void 0,void 0,function*(){this._fixVC();let i=[];i.push(e.show.call(this,t).then(()=>{this._isShowing=!1;let s=this.get("xAxis"),a=this.get("yAxis"),r=this.get("baseAxis");a!==r&&a.markDirtySelectionExtremes(),s!==r&&s.markDirtySelectionExtremes()})),i.push(this.bulletsContainer.show(t)),i.push(this._sequencedShowHide(!0,t)),yield Promise.all(i)})}hide(t){const e=Object.create(null,{hide:{get:()=>super.hide}});return K(this,void 0,void 0,function*(){this._fixVC();let i=[];i.push(e.hide.call(this,t).then(()=>{this._isHiding=!1})),i.push(this.bulletsContainer.hide(t)),i.push(this._sequencedShowHide(!1,t)),yield Promise.all(i)})}showDataItem(t,e){const i=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return K(this,void 0,void 0,function*(){const s=[i.showDataItem.call(this,t,e)];b(e)||(e=this.get("stateAnimationDuration",0));const a=this.get("stateAnimationEasing");P(this._valueFields,r=>{s.push(t.animate({key:r+"Working",to:t.get(r),duration:e,easing:a}).waitForStop())}),yield Promise.all(s)})}hideDataItem(t,e){const i=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return K(this,void 0,void 0,function*(){const s=[i.hideDataItem.call(this,t,e)],a=this.states.create("hidden",{});b(e)||(e=a.get("stateAnimationDuration",this.get("stateAnimationDuration",0)));const r=a.get("stateAnimationEasing",this.get("stateAnimationEasing")),n=this.get("xAxis"),o=this.get("yAxis"),h=this.get("baseAxis"),c=this.get("stacked");if(h!==n&&h||P(this._valueYFields,l=>{let d=o.getPrivate("min"),u=o.baseValue();b(d)&&d>u&&(u=d),c&&(u=0),t.get(l)!=null&&s.push(t.animate({key:l+"Working",to:u,duration:e,easing:r}).waitForStop())}),h===o||!h){let l=n.getPrivate("min"),d=n.baseValue();b(l)&&l>d&&(d=l),c&&(d=0),P(this._valueXFields,u=>{t.get(u)!=null&&s.push(t.animate({key:u+"Working",to:d,duration:e,easing:r}).waitForStop())})}yield Promise.all(s)})}_markDirtyStack(){this._stackDirty=!0,this.markDirty(),this._markStakedDirtyStack()}_markStakedDirtyStack(){const t=this._stackedSeries;t&&J(t,(e,i)=>{i._stackDirty||i._markDirtyStack()})}_afterChanged(){super._afterChanged(),this._skipped&&(this._markDirtyAxes(),this._skipped=!1)}showDataItemTooltip(t){this.updateLegendMarker(t),this.updateLegendValue(t);const e=this.get("tooltip");if(e){if(this.isHidden())this.hideTooltip();else if(e._setDataItem(t),t){let i=this.get("locationX",0),s=this.get("locationY",1),a=t.get("locationX",i),r=t.get("locationY",s);const n=this.get("xAxis"),o=this.get("yAxis"),h=this.get("vcx",1),c=this.get("vcy",1),l=n.getDataItemPositionX(t,this._tooltipFieldX,this._aLocationX0+(this._aLocationX1-this._aLocationX0)*a,h),d=o.getDataItemPositionY(t,this._tooltipFieldY,this._aLocationY0+(this._aLocationY1-this._aLocationY0)*r,c),u=this.getPoint(l,d);let g=!0;if(P(this._valueFields,m=>{t.get(m)==null&&(g=!1)}),g){const m=this.chart;m&&m.inPlot(u)?(e.label.text.markDirtyText(),e.set("tooltipTarget",this._getTooltipTarget(t)),e.set("pointTo",this._display.toGlobal({x:u.x,y:u.y}))):e._setDataItem(void 0)}else e._setDataItem(void 0)}}}hideTooltip(){const t=this.get("tooltip");return t&&t.set("tooltipTarget",this),super.hideTooltip()}_getTooltipTarget(t){if(this.get("seriesTooltipTarget")=="bullet"){const e=t.bullets;if(e&&e.length>0){const i=e[0].get("sprite");if(i)return i}}return this}updateLegendValue(t){const e=this.get("legendDataItem");if(e){const i=e.get("label");if(i){let a="";t?(i._setDataItem(t),a=this.get("legendLabelText",i.get("text",this.get("name","")))):(i._setDataItem(this._emptyDataItem),a=this.get("legendRangeLabelText",this.get("legendLabelText",i.get("text",this.get("name",""))))),i.set("text",a)}const s=e.get("valueLabel");if(s){let a="";t?(s._setDataItem(t),a=this.get("legendValueText",s.get("text",""))):(s._setDataItem(this._emptyDataItem),a=this.get("legendRangeValueText",s.get("text",""))),s.set("text",a)}}}_getItemReaderLabel(){let t="X: {"+this._xField;return this.get("xAxis").isType("DateAxis")&&(t+=".formatDate()"),t+="}; Y: {"+this._yField,this.get("yAxis").isType("DateAxis")&&(t+=".formatDate()"),t+="}",t}getPoint(t,e){let i=this.get("xAxis").get("renderer").positionToCoordinate(t),s=this.get("yAxis").get("renderer").positionToCoordinate(e),a=999999999;return s<-a&&(s=-a),s>a&&(s=a),i<-a&&(i=-a),i>a&&(i=a),{x:i,y:s}}_shouldInclude(t){return!0}handleCursorHide(){this.hideTooltip(),this.updateLegendValue(void 0),this.updateLegendMarker(void 0)}_afterDataChange(){super._afterDataChange(),this.get("xAxis")._markDirtyKey("start"),this.get("yAxis")._markDirtyKey("start"),this.resetExtremes()}resetExtremes(){this.setPrivate("selectionMinX",void 0),this.setPrivate("selectionMaxX",void 0),this.setPrivate("selectionMinY",void 0),this.setPrivate("selectionMaxY",void 0),this.setPrivate("minX",void 0),this.setPrivate("minY",void 0),this.setPrivate("maxX",void 0),this.setPrivate("maxY",void 0)}createAxisRange(t){return this.axisRanges.push({axisDataItem:t})}get mainDataItems(){return this._mainDataItems}}Object.defineProperty(W,"className",{enumerable:!0,configurable:!0,writable:!0,value:"XYSeries"}),Object.defineProperty(W,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Lt.classNames.concat([W.className])});class U extends Ft{constructor(){super(...arguments),Object.defineProperty(this,"_series",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_isPanning",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"labelsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(T.new(this._root,{}))}),Object.defineProperty(this,"gridContainer",{enumerable:!0,configurable:!0,writable:!0,value:T.new(this._root,{width:k,height:k})}),Object.defineProperty(this,"topGridContainer",{enumerable:!0,configurable:!0,writable:!0,value:T.new(this._root,{width:k,height:k})}),Object.defineProperty(this,"bulletsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(T.new(this._root,{isMeasured:!1,width:k,height:k,position:"absolute"}))}),Object.defineProperty(this,"chart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rangesDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_panStart",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_panEnd",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_sAnimation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_eAnimation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_skipSync",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"axisRanges",{enumerable:!0,configurable:!0,writable:!0,value:new Ot}),Object.defineProperty(this,"_seriesAxisRanges",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"ghostLabel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_cursorPosition",{enumerable:!0,configurable:!0,writable:!0,value:-1}),Object.defineProperty(this,"_snapToSeries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_seriesValuesDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"axisHeader",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(T.new(this._root,{themeTags:["axis","header"],position:"absolute",background:H.new(this._root,{themeTags:["header","background"],fill:this._root.interfaceColors.get("background")})}))}),Object.defineProperty(this,"_bullets",{enumerable:!0,configurable:!0,writable:!0,value:{}})}_dispose(){this.gridContainer.dispose(),this.topGridContainer.dispose(),this.bulletsContainer.dispose(),this.labelsContainer.dispose(),this.axisHeader.dispose(),super._dispose()}_afterNew(){super._afterNew(),this.setPrivate("updateScrollbar",!0),this._disposers.push(this.axisRanges.events.onAll(e=>{if(e.type==="clear")P(e.oldValues,i=>{this.disposeDataItem(i)});else if(e.type==="push")this._processAxisRange(e.newValue,["range"]);else if(e.type==="setIndex")this._processAxisRange(e.newValue,["range"]);else if(e.type==="insertIndex")this._processAxisRange(e.newValue,["range"]);else if(e.type==="removeIndex")this.disposeDataItem(e.oldValue);else{if(e.type!=="moveIndex")throw new Error("Unknown IStreamEvent type");this._processAxisRange(e.value,["range"])}}));const t=this.get("renderer");t&&(t.axis=this,t.processAxis()),this.children.push(t),this.ghostLabel=t.makeLabel(new st(this,void 0,{}),[]),this.ghostLabel.adapters.disable("text"),this.ghostLabel.setAll({opacity:0,tooltipText:void 0,tooltipHTML:void 0,interactive:!1}),this.ghostLabel.events.disable()}_updateFinals(t,e){}zoom(t,e,i,s){if(this._updateFinals(t,e),this.get("start")!==t||this.get("end")!=e){let a=this._sAnimation,r=this._eAnimation,n=this.get("maxDeviation",.5)*Math.min(1,e-t);t<-n&&(t=-n),e>1+n&&(e=1+n),t>e&&([t,e]=[e,t]),b(i)||(i=this.get("interpolationDuration",0)),s||(s="end");let o=this.getPrivate("maxZoomFactor",this.get("maxZoomFactor",100)),h=o;e===1&&t!==0&&(s=tthis.get("end")?"end":"start");let c=this.get("minZoomCount"),l=this.get("maxZoomCount");b(c)&&(o=h/c);let d=1;if(b(l)&&(d=h/l),s==="start"?(l>0&&1/(e-t)o&&(e=t+1/o),e>1&&e-t<1/o&&(t=e-1/o)):(l>0&&1/(e-t)o&&(t=e-1/o),t<0&&e-t<1/o&&(e=t+1/o)),1/(e-t)>o&&(e=t+1/o),1/(e-t)>o&&(t=e-1/o),l!=null&&c!=null&&t==this.get("start")&&e==this.get("end")){const u=this.chart;u&&u._handleAxisSelection(this,!0)}if((a&&a.playing&&a.to==t||this.get("start")==t)&&(r&&r.playing&&r.to==e||this.get("end")==e))return;if(i>0){let u,g,m=this.get("interpolationEasing");if(this.get("start")!=t&&(u=this.animate({key:"start",to:t,duration:i,easing:m})),this.get("end")!=e&&(g=this.animate({key:"end",to:e,duration:i,easing:m})),this._sAnimation=u,this._eAnimation=g,u)return u;if(g)return g}else this.set("start",t),this.set("end",e),this._root.events.once("frameended",()=>{this._markDirtyKey("start"),this._root._markDirty()})}else this._sAnimation&&this._sAnimation.stop(),this._eAnimation&&this._eAnimation.stop()}get series(){return this._series}_processAxisRange(t,e){t.setRaw("isRange",!0),this._createAssets(t,e),this._rangesDirty=!0,this._prepareDataItem(t);const i=t.get("above"),s=this.topGridContainer,a=t.get("grid");i&&a&&s.children.moveValue(a);const r=t.get("axisFill");i&&r&&s.children.moveValue(r)}_prepareDataItem(t,e){}markDirtyExtremes(){}markDirtySelectionExtremes(){}_calculateTotals(){}_updateAxisRanges(){this._bullets={},this.axisRanges.each(t=>{this._prepareDataItem(t)}),P(this._seriesAxisRanges,t=>{this._prepareDataItem(t)})}_prepareChildren(){if(super._prepareChildren(),this.get("fixAxisSize")?this.ghostLabel.set("visible",!0):this.ghostLabel.set("visible",!1),this.isDirty("start")||this.isDirty("end")){this.chart._updateCursor();let e=this.get("start",0),i=this.get("end",1),s=this.get("maxDeviation",.5)*Math.min(1,i-e);if(e<-s){let a=e+s;e=-s,this.setRaw("start",e),this.isDirty("end")&&this.setRaw("end",i-a)}if(i>1+s){let a=i-1-s;i=1+s,this.setRaw("end",i),this.isDirty("start")&&this.setRaw("start",e-a)}}const t=this.get("renderer");if(t._start=this.get("start"),t._end=this.get("end"),t._inversed=t.get("inversed",!1),t._axisLength=t.axisLength()/(t._end-t._start),t._updateLC(),this.isDirty("tooltip")){const e=this.get("tooltip");if(e){const i=t.get("themeTags");e.addTag("axis"),e.addTag(this.className.toLowerCase()),e._applyThemes(),i&&(e.set("themeTags",S(e.get("themeTags"),i)),e.label._applyThemes())}}}_updateTooltipBounds(){const t=this.get("tooltip");t&&this.get("renderer").updateTooltipBounds(t)}_updateBounds(){super._updateBounds(),this._updateTooltipBounds()}processChart(t){this.chart=t,this.get("renderer").chart=t,t.gridContainer.children.push(this.gridContainer),t.topGridContainer.children.push(this.topGridContainer),t.axisHeadersContainer.children.push(this.axisHeader),this.on("start",()=>{t._handleAxisSelection(this)}),this.on("end",()=>{t._handleAxisSelection(this)}),t.plotContainer.onPrivate("width",()=>{this.markDirtySize()}),t.plotContainer.onPrivate("height",()=>{this.markDirtySize()}),t.processAxis(this)}hideDataItem(t){return this._toggleDataItem(t,!1),super.hideDataItem(t)}showDataItem(t){return this._toggleDataItem(t,!0),super.showDataItem(t)}_toggleDataItem(t,e){const i=t.get("label");i&&i.setPrivate("visible",e);const s=t.get("grid");s&&s.setPrivate("visible",e);const a=t.get("tick");a&&a.setPrivate("visible",e);const r=t.get("axisFill");r&&r.setPrivate("visible",e);const n=t.get("bullet");if(n){const o=n.get("sprite");o&&o.setPrivate("visible",e)}}_createAssets(t,e){const i=this.get("renderer");t.get("label")||i.makeLabel(t,e),t.get("grid")||i.makeGrid(t,e),t.get("tick")||i.makeTick(t,e),t.get("axisFill")||i.makeAxisFill(t,e),this._processBullet(t)}_processBullet(t){let e=t.get("bullet"),i=this.get("bullet");if(e||!i||t.get("isRange")||(e=i(this._root,this,t)),e){e.axis=this;const s=e.get("sprite");s&&(s._setDataItem(t),t.setRaw("bullet",e),s.parent||this.bulletsContainer.children.push(s))}}_afterChanged(){super._afterChanged();const t=this.chart;t&&(t._updateChartLayout(),t.axisHeadersContainer.markDirtySize()),this.get("renderer")._updatePositions()}disposeDataItem(t){super.disposeDataItem(t);const e=this.get("renderer"),i=t.get("label");i&&(e.labels.removeValue(i),i.dispose());const s=t.get("tick");s&&(e.ticks.removeValue(s),s.dispose());const a=t.get("grid");a&&(e.grid.removeValue(a),a.dispose());const r=t.get("axisFill");r&&(e.axisFills.removeValue(r),r.dispose());const n=t.get("bullet");n&&n.dispose()}_updateGhost(){this.setPrivate("cellWidth",this.getCellWidthPosition()*this.get("renderer").axisLength());const t=this.ghostLabel;if(!t.isHidden()){const s=t.localBounds(),a=s.right-s.left;let r=t.get("text");P(this.dataItems,n=>{const o=n.get("label");if(o&&!o.isHidden()){const h=o.localBounds();h.right-h.left>a&&(r=o.text._getText())}}),t.set("text",r)}let e=this.get("start",0),i=this.get("end",1);this.get("renderer").updateLabel(t,e+.5*(i-e))}_handleCursorPosition(t,e){t=this.get("renderer").toAxisPosition(t),this._cursorPosition=t,this._snapToSeries=e,this.updateTooltip()}updateTooltip(){const t=this._snapToSeries;let e=this._cursorPosition;const i=this.get("tooltip"),s=this.get("renderer");b(e)&&(P(this.series,a=>{if(a.get("baseAxis")===this){const r=this.getSeriesItem(a,e,this.get("tooltipLocation"));a.setRaw("tooltipDataItem",r),t&&t.indexOf(a)!=-1?(a.updateLegendMarker(r),a.updateLegendValue(r)):a.showDataItemTooltip(r)}}),i&&(s.updateTooltipBounds(i),this.get("snapTooltip")&&(e=this.roundAxisPosition(e,this.get("tooltipLocation",.5))),B(e)?i.hide(0):(this.setPrivateRaw("tooltipPosition",e),this._updateTooltipText(i,e),s.positionTooltip(i,e),ethis.get("end")?i.hide(0):i.show(0))))}_updateTooltipText(t,e){t.label.set("text",this.getTooltipText(e))}roundAxisPosition(t,e){return t}handleCursorShow(){let t=this.get("tooltip");t&&t.show()}handleCursorHide(){let t=this.get("tooltip");t&&t.hide()}processSeriesDataItem(t,e){}_clearDirty(){super._clearDirty(),this._sizeDirty=!1,this._rangesDirty=!1}coordinateToPosition(t){const e=this.get("renderer");return e.toAxisPosition(t/e.axisLength())}toAxisPosition(t){return this.get("renderer").toAxisPosition(t)}toGlobalPosition(t){return this.get("renderer").toGlobalPosition(t)}fixPosition(t){return this.get("renderer").fixPosition(t)}shouldGap(t,e,i,s){return!1}createAxisRange(t){return this.axisRanges.push(t)}_groupSeriesData(t){}getCellWidthPosition(){return .05}}Object.defineProperty(U,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Axis"}),Object.defineProperty(U,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Ft.classNames.concat([U.className])});class lt extends U{constructor(){super(...arguments),Object.defineProperty(this,"_dirtyExtremes",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dirtySelectionExtremes",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_deltaMinMax",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_minReal",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_maxReal",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_baseValue",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_syncDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_minLogAdjusted",{enumerable:!0,configurable:!0,writable:!0,value:1})}markDirtyExtremes(){this._dirtyExtremes=!0,this.markDirty()}markDirtySelectionExtremes(){this._dirtySelectionExtremes=!0,this.markDirty()}_afterNew(){this._settings.themeTags=S(this._settings.themeTags,["axis"]),this.setPrivateRaw("name","value"),this.addTag("value"),super._afterNew()}_prepareChildren(){if(super._prepareChildren(),this.isDirty("syncWithAxis")){this._prevSettings.syncWithAxis&&this._syncDp&&this._syncDp.dispose();let t=this.get("syncWithAxis");t&&(this._syncDp=new Qt([t.onPrivate("selectionMinFinal",()=>{this._dirtySelectionExtremes=!0}),t.onPrivate("selectionMaxFinal",()=>{this._dirtySelectionExtremes=!0})]))}(this._sizeDirty||this._dirtyExtremes||this._valuesDirty||this.isPrivateDirty("width")||this.isPrivateDirty("height")||this.isDirty("min")||this.isDirty("max")||this.isDirty("extraMin")||this.isDirty("extraMax")||this.isDirty("logarithmic")||this.isDirty("treatZeroAs")||this.isDirty("baseValue")||this.isDirty("strictMinMax")||this.isDirty("strictMinMaxSelection")||this.isDirty("maxPrecision")||this.isDirty("numberFormat"))&&(this._getMinMax(),this.ghostLabel.set("text",""),this._dirtyExtremes=!1),this._dirtySelectionExtremes&&!this._isPanning&&this.get("autoZoom",!0)&&(this._getSelectionMinMax(),this._dirtySelectionExtremes=!1),this._groupData(),(this._sizeDirty||this._valuesDirty||this.isDirty("start")||this.isDirty("end")||this.isPrivateDirty("min")||this.isPrivateDirty("selectionMax")||this.isPrivateDirty("selectionMin")||this.isPrivateDirty("max")||this.isPrivateDirty("step")||this.isPrivateDirty("width")||this.isPrivateDirty("height")||this.isDirty("logarithmic"))&&(this._handleRangeChange(),this._prepareAxisItems(),this._updateAxisRanges()),this._baseValue=this.baseValue()}_groupData(){}_formatText(t){const e=this.get("numberFormat"),i=this.getNumberFormatter();let s="";return s=e?i.format(t,e):i.format(t,void 0,this.getPrivate("stepDecimalPlaces")),s}_prepareAxisItems(){const t=this.getPrivate("min"),e=this.getPrivate("max");if(b(t)&&b(e)){const i=this.get("logarithmic"),s=this.getPrivate("step"),a=this.getPrivate("selectionMin"),r=this.getPrivate("selectionMax")+s;let n=a-s,o=0,h=1,c=t;if(i){if(n=this._minLogAdjusted,n2&&(n=Math.pow(10,Math.log(c)*Math.LOG10E-5))}let l=-1/0;for(;n2?n=Math.pow(10,Math.log(c)*Math.LOG10E+o-5):n+=s,l==n)break;let g=Math.pow(10,Math.floor(Math.log(Math.abs(s))*Math.LOG10E));if(g<1){let m=Math.round(Math.abs(Math.log(Math.abs(g))*Math.LOG10E))+2;n=X(n,m)}o++,l=n}for(let d=o;d{d.inited&&d._markDirtyAxes()}),this._updateGhost()}}_prepareDataItem(t,e){let i=this.get("renderer"),s=t.get("value"),a=t.get("endValue"),r=this.valueToPosition(s),n=r,o=this.valueToPosition(s+this.getPrivate("step"));b(a)&&(n=this.valueToPosition(a),o=n),t.get("isRange")&&a==null&&(o=r),i.updateLabel(t.get("label"),r,n,e);const h=t.get("grid");if(i.updateGrid(h,r,n),h&&(s==this.get("baseValue",0)?(h.addTag("base"),h._applyThemes()):h.hasTag("base")&&(h.removeTag("base"),h._applyThemes())),i.updateTick(t.get("tick"),r,n,e),i.updateFill(t.get("axisFill"),r,o),this._processBullet(t),i.updateBullet(t.get("bullet"),r,n),!t.get("isRange")){const c=this.get("fillRule");c&&c(t)}}_handleRangeChange(){let t=this.positionToValue(this.get("start",0)),e=this.positionToValue(this.get("end",1));const i=this.get("renderer").gridCount();let s=this._adjustMinMax(t,e,i,!0),a=te(s.step);this.setPrivateRaw("stepDecimalPlaces",a),t=X(t,a),e=X(e,a),s=this._adjustMinMax(t,e,i,!0);let r=s.step;t=s.min,e=s.max,this.getPrivate("selectionMin")===t&&this.getPrivate("selectionMax")===e&&this.getPrivate("step")===r||(this.setPrivateRaw("selectionMin",t),this.setPrivateRaw("selectionMax",e),this.setPrivateRaw("step",r))}positionToValue(t){const e=this.getPrivate("min"),i=this.getPrivate("max");return this.get("logarithmic")?Math.pow(Math.E,(t*(Math.log(i)*Math.LOG10E-Math.log(e)*Math.LOG10E)+Math.log(e)*Math.LOG10E)/Math.LOG10E):t*(i-e)+e}valueToPosition(t){const e=this.getPrivate("min"),i=this.getPrivate("max");if(this.get("logarithmic")){if(t<=0){let s=this.get("treatZeroAs");b(s)&&(t=s)}return(Math.log(t)*Math.LOG10E-Math.log(e)*Math.LOG10E)/(Math.log(i)*Math.LOG10E-Math.log(e)*Math.LOG10E)}return(t-e)/(i-e)}valueToFinalPosition(t){const e=this.getPrivate("minFinal"),i=this.getPrivate("maxFinal");if(this.get("logarithmic")){if(t<=0){let s=this.get("treatZeroAs");b(s)&&(t=s)}return(Math.log(t)*Math.LOG10E-Math.log(e)*Math.LOG10E)/(Math.log(i)*Math.LOG10E-Math.log(e)*Math.LOG10E)}return(t-e)/(i-e)}getX(t,e,i){t=i+(t-i)*e;const s=this.valueToPosition(t);return this._settings.renderer.positionToCoordinate(s)}getY(t,e,i){t=i+(t-i)*e;const s=this.valueToPosition(t);return this._settings.renderer.positionToCoordinate(s)}getDataItemCoordinateX(t,e,i,s){return this._settings.renderer.positionToCoordinate(this.getDataItemPositionX(t,e,i,s))}getDataItemPositionX(t,e,i,s){let a=t.get(e);return t.get("stackToItemX")?a=a*s+t.component.getStackedXValueWorking(t,e):a=this._baseValue+(a-this._baseValue)*s,this.valueToPosition(a)}getDataItemCoordinateY(t,e,i,s){return this._settings.renderer.positionToCoordinate(this.getDataItemPositionY(t,e,i,s))}getDataItemPositionY(t,e,i,s){let a=t.get(e);return t.get("stackToItemY")?a=a*s+t.component.getStackedYValueWorking(t,e):a=this._baseValue+(a-this._baseValue)*s,this.valueToPosition(a)}basePosition(){return this.valueToPosition(this.baseValue())}baseValue(){const t=Math.min(this.getPrivate("minFinal",-1/0),this.getPrivate("selectionMin",-1/0)),e=Math.max(this.getPrivate("maxFinal",1/0),this.getPrivate("selectionMax",1/0));let i=this.get("baseValue",0);return ie&&(i=e),i}cellEndValue(t){return t}fixSmallStep(t){return 1+t===1?(t*=2,this.fixSmallStep(t)):t}_fixMin(t){return t}_fixMax(t){return t}_calculateTotals(){if(this.get("calculateTotals")){let t=this.series[0];if(t){let e=t.startIndex();if(t.dataItems.length>0){e>0&&e--;let i,s,a=t.endIndex();a{if(!c.get("excludeFromTotal")){let l=c.dataItems[n];if(l){let d=l.get(r)*c.get(s);B(d)||(o+=d,h+=Math.abs(d))}}}),P(this.series,c=>{if(!c.get("excludeFromTotal")){let l=c.dataItems[n];if(l){let d=l.get(r)*c.get(s);B(d)||(l.set(i+"Total",h),l.set(i+"Sum",o),l.set(i+"TotalPercent",d/h*100))}}})}}}}}_getSelectionMinMax(){const t=this.getPrivate("minFinal"),e=this.getPrivate("maxFinal"),i=this.get("min"),s=this.get("max");let a=this.get("extraMin",0),r=this.get("extraMax",0);this.get("logarithmic")&&(this.get("extraMin")==null&&(a=.1),this.get("extraMax")==null&&(r=.2));const n=this.get("renderer").gridCount(),o=this.get("strictMinMaxSelection"),h=this.get("strictMinMax");if(b(t)&&b(e)){let c=e,l=t;if(P(this.series,_=>{if(!_.get("ignoreMinMax")){let f,w;const A=_.getPrivate("outOfSelection");_.get("xAxis")===this?A||(f=_.getPrivate("selectionMinX",_.getPrivate("minX")),w=_.getPrivate("selectionMaxX",_.getPrivate("maxX"))):_.get("yAxis")===this&&(A||(f=_.getPrivate("selectionMinY",_.getPrivate("minY")),w=_.getPrivate("selectionMaxY",_.getPrivate("maxY")))),_.isHidden()||_.isShowing()||(b(f)&&(c=Math.min(c,f)),b(w)&&(l=Math.max(l,w)))}}),this.axisRanges.each(_=>{if(_.get("affectsMinMax")){let f=_.get("value");f!=null&&(c=Math.min(c,f),l=Math.max(l,f)),f=_.get("endValue"),f!=null&&(c=Math.min(c,f),l=Math.max(l,f))}}),c>l&&([c,l]=[l,c]),b(i)?c=h?i:t:h&&b(this._minReal)&&(c=this._minReal),b(s)?l=h?s:e:h&&b(this._maxReal)&&(l=this._maxReal),c===l){c-=this._deltaMinMax,l+=this._deltaMinMax;let _=this._adjustMinMax(c,l,n,h);c=_.min,l=_.max}let d=c,u=l;c-=(l-c)*a,l+=(l-c)*r;let g=this._adjustMinMax(c,l,n);c=g.min,l=g.max,c=At(c,t,e),l=At(l,t,e),g=this._adjustMinMax(c,l,n,!0),h||(c=g.min,l=g.max);const m=this.get("syncWithAxis");m&&(g=this._syncAxes(c,l,g.step,m.getPrivate("selectionMinFinal",m.getPrivate("minFinal",0)),m.getPrivate("selectionMaxFinal",m.getPrivate("maxFinal",1)),m.getPrivate("selectionStepFinal",m.getPrivate("step",1))),c=g.min,l=g.max),h&&(b(i)&&(c=Math.max(c,i)),b(s)&&(l=Math.min(l,s))),o&&(c=d-(l-c)*a,l=u+(l-c)*r),this.get("logarithmic")&&(c<=0&&(c=d*(1-Math.min(a,.99))),ce&&(l=e));let p=Math.min(20,Math.ceil(Math.log(this.getPrivate("maxZoomFactor",100)+1)/Math.LN10)+2),x=X(this.valueToFinalPosition(c),p),v=X(this.valueToFinalPosition(l),p);this.setPrivateRaw("selectionMinFinal",c),this.setPrivateRaw("selectionMaxFinal",l),this.setPrivateRaw("selectionStepFinal",g.step),this.zoom(x,v)}}_getMinMax(){let t=this.get("min"),e=this.get("max"),i=1/0,s=-1/0,a=this.get("extraMin",0),r=this.get("extraMax",0);this.get("logarithmic")&&(this.get("extraMin")==null&&(a=.1),this.get("extraMax")==null&&(r=.2));let n=1/0;if(P(this.series,_=>{if(!_.get("ignoreMinMax")){let f,w;if(_.get("xAxis")===this?(f=_.getPrivate("minX"),w=_.getPrivate("maxX")):_.get("yAxis")===this&&(f=_.getPrivate("minY"),w=_.getPrivate("maxY")),b(f)&&b(w)){i=Math.min(i,f),s=Math.max(s,w);let A=w-f;A<=0&&(A=Math.abs(w/100)),A{if(_.get("affectsMinMax")){let f=_.get("value");f!=null&&(i=Math.min(i,f),s=Math.max(s,f)),f=_.get("endValue"),f!=null&&(i=Math.min(i,f),s=Math.max(s,f))}}),this.get("logarithmic")){let _=this.get("treatZeroAs");b(_)&&i<=0&&(i=_)}if(i===0&&s===0&&(s=.9,i=-.9),b(t)&&(i=t),b(e)&&(s=e),i===1/0||s===-1/0)return this.setPrivate("minFinal",void 0),void this.setPrivate("maxFinal",void 0);const o=i,h=s;let c=this.adapters.fold("min",i),l=this.adapters.fold("max",s);b(c)&&(i=c),b(l)&&(s=l),i=this._fixMin(i),s=this._fixMax(s),s-i<=1/Math.pow(10,15)&&(s-i!=0?this._deltaMinMax=(s-i)/2:this._getDelta(s),i-=this._deltaMinMax,s+=this._deltaMinMax),i-=(s-i)*a,s+=(s-i)*r,this.get("logarithmic")&&(i<0&&o>=0&&(i=0),s>0&&h<=0&&(s=0)),this._minReal=i,this._maxReal=s;let d=this.get("strictMinMax"),u=this.get("strictMinMaxSelection",!1);u&&(d=u);let g=d;b(e)&&(g=!0);let m=this.get("renderer").gridCount(),p=this._adjustMinMax(i,s,m,g);i=p.min,s=p.max,p=this._adjustMinMax(i,s,m,!0),i=p.min,s=p.max,d&&(i=b(t)?t:this._minReal,s=b(e)?e:this._maxReal,s-i<=1e-8&&(i-=this._deltaMinMax,s+=this._deltaMinMax),i-=(s-i)*a,s+=(s-i)*r),c=this.adapters.fold("min",i),l=this.adapters.fold("max",s),b(c)&&(i=c),b(l)&&(s=l),n==1/0&&(n=s-i);let x=Math.round(Math.abs(Math.log(Math.abs(s-i))*Math.LOG10E))+5;i=X(i,x),s=X(s,x);const v=this.get("syncWithAxis");if(v&&(p=this._syncAxes(i,s,p.step,v.getPrivate("minFinal",v.getPrivate("min",0)),v.getPrivate("maxFinal",v.getPrivate("max",1)),v.getPrivate("step",1)),i=p.min,s=p.max),this.setPrivateRaw("maxZoomFactor",Math.max(1,Math.ceil((s-i)/n*this.get("maxZoomFactor",100)))),this._fixZoomFactor(),this.get("logarithmic")&&(this._minLogAdjusted=i,i=this._minReal,s=this._maxReal,i<=0&&(i=o*(1-Math.min(a,.99)))),b(i)&&b(s)&&(this.getPrivate("minFinal")!==i||this.getPrivate("maxFinal")!==s)){this.setPrivate("minFinal",i),this.setPrivate("maxFinal",s),this._saveMinMax(i,s);const _=this.get("interpolationDuration",0),f=this.get("interpolationEasing");this.animatePrivate({key:"min",to:i,duration:_,easing:f}),this.animatePrivate({key:"max",to:s,duration:_,easing:f})}}_fixZoomFactor(){}_getDelta(t){let e=Math.log(Math.abs(t))*Math.LOG10E,i=Math.pow(10,Math.floor(e));i/=10,this._deltaMinMax=i}_saveMinMax(t,e){}_adjustMinMax(t,e,i,s){i<=1&&(i=1),i=Math.round(i);let a=t,r=e,n=e-t;n===0&&(n=Math.abs(e));let o=Math.log(Math.abs(n))*Math.LOG10E,h=Math.pow(10,Math.floor(o));h/=10;let c=h;s&&(c=0),s?(t=Math.floor(t/h)*h,e=Math.ceil(e/h)*h):(t=Math.ceil(t/h)*h-c,e=Math.floor(e/h)*h+c),t<0&&a>=0&&(t=0),e>0&&r<=0&&(e=0),o=Math.log(Math.abs(n))*Math.LOG10E,h=Math.pow(10,Math.floor(o)),h/=100;let l=Math.ceil(n/i/h)*h,d=Math.pow(10,Math.floor(Math.log(Math.abs(l))*Math.LOG10E)),u=Math.ceil(l/d);u>5?u=10:u<=5&&u>2&&(u=5),l=Math.ceil(l/(d*u))*d*u;let g=this.get("maxPrecision");if(b(g)){let v=se(l,g);ga&&(t-=l),l=this.fixSmallStep(l),{min:t,max:e,step:l}}getTooltipText(t,e){const i=this.get("tooltipNumberFormat",this.get("numberFormat")),s=this.getNumberFormatter(),a=this.get("extraTooltipPrecision",0),r=this.getPrivate("stepDecimalPlaces",0)+a,n=X(this.positionToValue(t),r);return i?s.format(n,i):s.format(n,void 0,r)}getSeriesItem(t,e){let i,s,a=this.getPrivate("name")+this.get("renderer").getPrivate("letter"),r=this.positionToValue(e);if(P(t.dataItems,(n,o)=>{const h=Math.abs(n.get(a)-r);(i===void 0||h500&&(c=!0),c)t=u,e=g,i=m;else{l/3==Math.round(l/3)?(u=t-d*l,t>=0&&u<0&&(u=0)):(g=e+d*l,g<=0&&g>0&&(g=0));let p=this._adjustMinMax(u,g,h,!0);u=p.min,g=p.max,m=p.step}}}return{min:t,max:e,step:i}}_checkSync(t,e,i,s){let a=(e-t)/i;for(let r=1;rtt._new(this._root,{themeTags:S(this.ticks.template.get("themeTags",[]),this.get("themeTags",[]))},[this.ticks.template]))}),Object.defineProperty(this,"grid",{enumerable:!0,configurable:!0,writable:!0,value:new V(L.new({}),()=>z._new(this._root,{themeTags:S(this.grid.template.get("themeTags",[]),this.get("themeTags",[]))},[this.grid.template]))}),Object.defineProperty(this,"axisFills",{enumerable:!0,configurable:!0,writable:!0,value:new V(L.new({}),()=>Y._new(this._root,{themeTags:S(this.axisFills.template.get("themeTags",["axis","fill"]),this.get("themeTags",[]))},[this.axisFills.template]))}),Object.defineProperty(this,"labels",{enumerable:!0,configurable:!0,writable:!0,value:new V(L.new({}),()=>Q._new(this._root,{themeTags:S(this.labels.template.get("themeTags",[]),this.get("themeTags",[]))},[this.labels.template]))}),Object.defineProperty(this,"axis",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"thumb",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}makeTick(t,e){const i=this.ticks.make();return i._setDataItem(t),t.setRaw("tick",i),i.set("themeTags",S(i.get("themeTags"),e)),this.axis.labelsContainer.children.push(i),this.ticks.push(i),i}makeGrid(t,e){const i=this.grid.make();return i._setDataItem(t),t.setRaw("grid",i),i.set("themeTags",S(i.get("themeTags"),e)),this.axis.gridContainer.children.push(i),this.grid.push(i),i}makeAxisFill(t,e){const i=this.axisFills.make();return i._setDataItem(t),i.set("themeTags",S(i.get("themeTags"),e)),this.axis.gridContainer.children.push(i),t.setRaw("axisFill",i),this.axisFills.push(i),i}makeLabel(t,e){const i=this.labels.make();return i.set("themeTags",S(i.get("themeTags"),e)),this.axis.labelsContainer.children.moveValue(i,0),i._setDataItem(t),t.setRaw("label",i),this.labels.push(i),i}axisLength(){return 0}gridCount(){return this.axisLength()/this.get("minGridDistance",50)}_updatePositions(){}_afterNew(){super._afterNew(),this.set("isMeasured",!1);const t=this.thumb;t&&(this._disposers.push(t.events.on("pointerdown",e=>{this._handleThumbDown(e)})),this._disposers.push(t.events.on("globalpointerup",e=>{this._handleThumbUp(e)})),this._disposers.push(t.events.on("globalpointermove",e=>{this._handleThumbMove(e)})))}_changed(){if(super._changed(),this.isDirty("pan")){const t=this.thumb;if(t){const e=this.axis.labelsContainer,i=this.get("pan");i=="zoom"?e.children.push(t):i=="none"&&e.children.removeValue(t)}}}_handleThumbDown(t){this._thumbDownPoint=this.toLocal(t.point);const e=this.axis;this._downStart=e.get("start"),this._downEnd=e.get("end")}_handleThumbUp(t){this._thumbDownPoint=void 0}_handleThumbMove(t){const e=this._thumbDownPoint;if(e){const i=this.toLocal(t.point),s=this._downStart,a=this._downEnd,r=this._getPan(i,e)*Math.min(1,a-s)/2;this.axis.zoom(s-r,a+r,0)}}_getPan(t,e){return 0}positionToCoordinate(t){return this._inversed?(this._end-t)*this._axisLength:(t-this._start)*this._axisLength}updateTooltipBounds(t){}_updateSize(){this.markDirty(),this._clear=!0}toAxisPosition(t){const e=this._start||0,i=this._end||1;return t*=i-e,t=this.get("inversed")?i-t:e+t}toGlobalPosition(t){const e=this._start||0,i=this._end||1;return this.get("inversed")?t=i-t:t-=e,t/=i-e}fixPosition(t){return this.get("inversed")?1-t:t}_updateLC(){}toggleVisibility(t,e,i,s){let a=this.axis;const r=a.get("start",0),n=a.get("end",1);er+(n-r)*(s+1e-4)?t.setPrivate("visible",!1):t.setPrivate("visible",!0)}_positionTooltip(t,e){const i=this.chart;i&&(i.inPlot(e)?t.set("pointTo",this._display.toGlobal(e)):t.hide())}processAxis(){}}Object.defineProperty(E,"className",{enumerable:!0,configurable:!0,writable:!0,value:"AxisRenderer"}),Object.defineProperty(E,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Y.classNames.concat([E.className])});class ht extends E{constructor(){super(...arguments),Object.defineProperty(this,"thumb",{enumerable:!0,configurable:!0,writable:!0,value:H.new(this._root,{width:k,isMeasured:!1,themeTags:["axis","x","thumb"]})})}_afterNew(){this._settings.themeTags=S(this._settings.themeTags,["renderer","x"]),super._afterNew(),this.setPrivateRaw("letter","X");const t=this.grid.template;t.set("height",k),t.set("width",0),t.set("draw",(e,i)=>{e.moveTo(0,0),e.lineTo(0,i.height())}),this.set("draw",(e,i)=>{e.moveTo(0,0),e.lineTo(i.width(),0)})}_changed(){super._changed();const t=this.axis;t.ghostLabel.setPrivate("visible",!this.get("inside")),t.ghostLabel.set("x",-1e3);const e="opposite",i="inside";if(this.isDirty(e)||this.isDirty(i)){const s=this.chart,a=t.children;if(this.get(i)?t.addTag(i):t.removeTag(i),s){if(this.get(e)){const r=s.topAxesContainer.children;r.indexOf(t)==-1&&r.insertIndex(0,t),t.addTag(e),a.moveValue(this)}else{const r=s.bottomAxesContainer.children;r.indexOf(t)==-1&&r.moveValue(t),t.removeTag(e),a.moveValue(this,0)}t.ghostLabel._applyThemes(),this.labels.each(r=>{r._applyThemes()}),this.root._markDirtyRedraw()}t.markDirtySize()}this.thumb.setPrivate("height",t.labelsContainer.height())}_getPan(t,e){return(e.x-t.x)/this.width()}toAxisPosition(t){const e=this._start||0,i=this._end||1;return t=(t-=this._ls)*(i-e)/this._lc,t=this.get("inversed")?i-t:e+t}toGlobalPosition(t){const e=this._start||0,i=this._end||1;return this.get("inversed")?t=i-t:t-=e,t=t/(i-e)*this._lc,t+=this._ls}_updateLC(){const t=this.axis,e=t.parent;if(e){const i=e.innerWidth();this._lc=this.axisLength()/i,this._ls=(t.x()-e.get("paddingLeft",0))/i}}_updatePositions(){const t=this.axis,e=t.x()-it(t.get("centerX",0),t.width())-t.parent.get("paddingLeft",0);t.gridContainer.set("x",e),t.topGridContainer.set("x",e),t.bulletsContainer.set("y",this.y());const i=t.chart;if(i){const s=i.plotContainer,a=t.axisHeader;let r=t.get("marginLeft",0),n=t.x()-r;const o=t.parent;o&&(n-=o.get("paddingLeft",0)),a.children.length>0?(r=t.axisHeader.width(),t.set("marginLeft",r+1)):a.set("width",r),a.setAll({x:n,y:-1,height:s.height()+2})}}processAxis(){super.processAxis();const t=this.axis;t.set("width",k);const e=this._root.verticalLayout;t.set("layout",e),t.labelsContainer.set("width",k),t.axisHeader.setAll({layout:e})}axisLength(){return this.axis.width()}positionToPoint(t){return{x:this.positionToCoordinate(t),y:0}}updateTick(t,e,i,s){if(t){b(e)||(e=0);let a=.5;a=b(s)&&s>1?t.get("multiLocation",a):t.get("location",a),b(i)&&i!=e&&(e+=(i-e)*a),t.set("x",this.positionToCoordinate(e));let r=t.get("length",0);const n=t.get("inside",this.get("inside",!1));this.get("opposite")?(t.set("y",k),n||(r*=-1)):(t.set("y",0),n&&(r*=-1)),t.set("draw",o=>{o.moveTo(0,0),o.lineTo(0,r)}),this.toggleVisibility(t,e,t.get("minPosition",0),t.get("maxPosition",1))}}updateLabel(t,e,i,s){if(t){let a=.5;a=b(s)&&s>1?t.get("multiLocation",a):t.get("location",a),b(e)||(e=0);const r=t.get("inside",this.get("inside",!1));this.get("opposite")?r?(t.set("position","absolute"),t.set("y",0)):(t.set("position","relative"),t.set("y",k)):r?(t.set("y",0),t.set("position","absolute")):(t.set("y",void 0),t.set("position","relative")),b(i)&&i!=e&&(e+=(i-e)*a),t.set("x",this.positionToCoordinate(e)),this.toggleVisibility(t,e,t.get("minPosition",0),t.get("maxPosition",1))}}updateGrid(t,e,i){if(t){b(e)||(e=0);let s=t.get("location",.5);b(i)&&i!=e&&(e+=(i-e)*s),t.set("x",this.positionToCoordinate(e)),this.toggleVisibility(t,e,0,1)}}updateBullet(t,e,i){if(t){const s=t.get("sprite");if(s){b(e)||(e=0);let a=t.get("location",.5);b(i)&&i!=e&&(e+=(i-e)*a);let r=this.axis.roundAxisPosition(e,a),n=this.axis._bullets[r],o=-1;if(this.get("opposite")&&(o=1),t.get("stacked"))if(n){let h=n.get("sprite");h&&s.set("y",h.y()+h.height()*o)}else s.set("y",0);this.axis._bullets[r]=t,s.set("x",this.positionToCoordinate(e)),this.toggleVisibility(s,e,0,1)}}}updateFill(t,e,i){if(t){b(e)||(e=0),b(i)||(i=1);let s=this.positionToCoordinate(e),a=this.positionToCoordinate(i);this.fillDrawMethod(t,s,a)}}fillDrawMethod(t,e,i){t.set("draw",s=>{const a=this.axis.gridContainer.height(),r=this.width();ir||i<0||(s.moveTo(e,0),s.lineTo(i,0),s.lineTo(i,a),s.lineTo(e,a),s.lineTo(e,0))})}positionTooltip(t,e){this._positionTooltip(t,{x:this.positionToCoordinate(e),y:0})}updateTooltipBounds(t){const e=this.get("inside"),i=1e5;let s=this._display.toGlobal({x:0,y:0}),a=s.x,r=0,n=this.axisLength(),o=i,h="up";this.get("opposite")?e?(h="up",r=s.y,o=i):(h="down",r=s.y-i,o=i):e?(h="down",r=s.y-i,o=i):(h="up",r=s.y,o=i);const c={left:a,right:a+n,top:r,bottom:r+o},l=t.get("bounds");Xt(c,l)||(t.set("bounds",c),t.set("pointerOrientation",h))}}Object.defineProperty(ht,"className",{enumerable:!0,configurable:!0,writable:!0,value:"AxisRendererX"}),Object.defineProperty(ht,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:E.classNames.concat([ht.className])});class dt extends E{constructor(){super(...arguments),Object.defineProperty(this,"_downY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"thumb",{enumerable:!0,configurable:!0,writable:!0,value:H.new(this._root,{height:k,isMeasured:!1,themeTags:["axis","y","thumb"]})})}_afterNew(){this._settings.themeTags=S(this._settings.themeTags,["renderer","y"]),this._settings.opposite&&this._settings.themeTags.push("opposite"),super._afterNew(),this.setPrivateRaw("letter","Y");const t=this.grid.template;t.set("width",k),t.set("height",0),t.set("draw",(e,i)=>{e.moveTo(0,0),e.lineTo(i.width(),0)}),this.set("draw",(e,i)=>{e.moveTo(0,0),e.lineTo(0,i.height())})}_getPan(t,e){return(t.y-e.y)/this.height()}_changed(){super._changed();const t=this.axis;t.ghostLabel.setPrivate("visible",!this.get("inside")),t.ghostLabel.set("y",-1e3);const e=this.thumb,i="opposite",s="inside",a=this.chart;if(this.isDirty(i)||this.isDirty(s)){const n=t.children;if(this.get(s)?t.addTag(s):t.removeTag(s),a){if(this.get(i)){const o=a.rightAxesContainer.children;o.indexOf(t)==-1&&o.moveValue(t,0),t.addTag(i),n.moveValue(this,0)}else{const o=a.leftAxesContainer.children;o.indexOf(t)==-1&&o.moveValue(t),t.removeTag(i),n.moveValue(this)}t.ghostLabel._applyThemes(),this.labels.each(o=>{o._applyThemes()}),this.root._markDirtyRedraw()}t.markDirtySize()}const r=t.labelsContainer.width();a&&(this.get(i)?e.set("centerX",0):e.set("centerX",r)),e.setPrivate("width",r)}processAxis(){super.processAxis();const t=this.axis;t.get("height")==null&&t.set("height",k);const e=this._root.horizontalLayout;t.set("layout",e),t.labelsContainer.set("height",k),t.axisHeader.set("layout",e)}_updatePositions(){const t=this.axis,e=t.y()-it(t.get("centerY",0),t.height());t.gridContainer.set("y",e),t.topGridContainer.set("y",e),t.bulletsContainer.set("x",this.x());const i=t.chart;if(i){const s=i.plotContainer,a=t.axisHeader;let r=t.get("marginTop",0);a.children.length>0?(r=t.axisHeader.height(),t.set("marginTop",r+1)):a.set("height",r),a.setAll({y:t.y()-r,x:-1,width:s.width()+2})}}axisLength(){return this.axis.innerHeight()}positionToPoint(t){return{x:0,y:this.positionToCoordinate(t)}}updateLabel(t,e,i,s){if(t){b(e)||(e=0);let a=.5;a=b(s)&&s>1?t.get("multiLocation",a):t.get("location",a);const r=this.get("opposite"),n=t.get("inside",this.get("inside",!1));r?(t.set("x",0),n?t.set("position","absolute"):t.set("position","relative")):n?(t.set("x",0),t.set("position","absolute")):(t.set("x",void 0),t.set("position","relative")),b(i)&&i!=e&&(e+=(i-e)*a),t.set("y",this.positionToCoordinate(e)),this.toggleVisibility(t,e,t.get("minPosition",0),t.get("maxPosition",1))}}updateGrid(t,e,i){if(t){b(e)||(e=0);let s=t.get("location",.5);b(i)&&i!=e&&(e+=(i-e)*s),t.set("y",this.positionToCoordinate(e)),this.toggleVisibility(t,e,0,1)}}updateTick(t,e,i,s){if(t){b(e)||(e=0);let a=.5;a=b(s)&&s>1?t.get("multiLocation",a):t.get("location",a),b(i)&&i!=e&&(e+=(i-e)*a),t.set("y",this.positionToCoordinate(e));let r=t.get("length",0);const n=t.get("inside",this.get("inside",!1));this.get("opposite")?(t.set("x",0),n&&(r*=-1)):n||(r*=-1),t.set("draw",o=>{o.moveTo(0,0),o.lineTo(r,0)}),this.toggleVisibility(t,e,t.get("minPosition",0),t.get("maxPosition",1))}}updateBullet(t,e,i){if(t){const s=t.get("sprite");if(s){b(e)||(e=0);let a=t.get("location",.5);b(i)&&i!=e&&(e+=(i-e)*a);let r=this.axis.roundAxisPosition(e,a),n=this.axis._bullets[r],o=1;if(this.get("opposite")&&(o=-1),t.get("stacked"))if(n){let h=n.get("sprite");h&&s.set("x",h.x()+h.width()*o)}else s.set("x",0);this.axis._bullets[r]=t,s.set("y",this.positionToCoordinate(e)),this.toggleVisibility(s,e,0,1)}}}updateFill(t,e,i){if(t){b(e)||(e=0),b(i)||(i=1);let s=this.positionToCoordinate(e),a=this.positionToCoordinate(i);this.fillDrawMethod(t,s,a)}}fillDrawMethod(t,e,i){t.set("draw",s=>{const a=this.axis.gridContainer.width(),r=this.height();ir||i<0||(s.moveTo(0,e),s.lineTo(a,e),s.lineTo(a,i),s.lineTo(0,i),s.lineTo(0,e))})}positionToCoordinate(t){return this._inversed?(t-this._start)*this._axisLength:(this._end-t)*this._axisLength}positionTooltip(t,e){this._positionTooltip(t,{x:0,y:this.positionToCoordinate(e)})}updateTooltipBounds(t){const e=this.get("inside"),i=1e5;let s=this._display.toGlobal({x:0,y:0}),a=s.y,r=0,n=this.axisLength(),o=i,h="right";this.get("opposite")?e?(h="right",r=s.x-i,o=i):(h="left",r=s.x,o=i):e?(h="left",r=s.x,o=i):(h="right",r=s.x-i,o=i);const c={left:r,right:r+o,top:a,bottom:a+n},l=t.get("bounds");Xt(c,l)||(t.set("bounds",c),t.set("pointerOrientation",h))}_updateLC(){const t=this.axis,e=t.parent;if(e){const i=e.innerHeight();this._lc=this.axisLength()/i,this._ls=t.y()/i}}toAxisPosition(t){const e=this._start||0,i=this._end||1;return t=(t-=this._ls)*(i-e)/this._lc,t=this.get("inversed")?e+t:i-t}toGlobalPosition(t){const e=this._start||0,i=this._end||1;return this.get("inversed")?t-=e:t=i-t,t=t/(i-e)*this._lc,t+=this._ls}fixPosition(t){return this.get("inversed")?t:1-t}}Object.defineProperty(dt,"className",{enumerable:!0,configurable:!0,writable:!0,value:"AxisRendererY"}),Object.defineProperty(dt,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:E.classNames.concat([dt.className])});class ct extends W{constructor(){super(...arguments),Object.defineProperty(this,"_endIndex",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_strokeGenerator",{enumerable:!0,configurable:!0,writable:!0,value:zt()}),Object.defineProperty(this,"_fillGenerator",{enumerable:!0,configurable:!0,writable:!0,value:ne()}),Object.defineProperty(this,"_legendStroke",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_legendFill",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"strokes",{enumerable:!0,configurable:!0,writable:!0,value:new V(L.new({}),()=>Y._new(this._root,{themeTags:S(this.strokes.template.get("themeTags",[]),["line","series","stroke"])},[this.strokes.template]))}),Object.defineProperty(this,"fills",{enumerable:!0,configurable:!0,writable:!0,value:new V(L.new({}),()=>Y._new(this._root,{themeTags:S(this.strokes.template.get("themeTags",[]),["line","series","fill"])},[this.fills.template]))}),Object.defineProperty(this,"_fillTemplate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_strokeTemplate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_previousPoint",{enumerable:!0,configurable:!0,writable:!0,value:[0,0,0,0]}),Object.defineProperty(this,"_dindex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_sindex",{enumerable:!0,configurable:!0,writable:!0,value:0})}_afterNew(){this._fillGenerator.y0(function(t){return t[3]}),this._fillGenerator.x0(function(t){return t[2]}),this._fillGenerator.y1(function(t){return t[1]}),this._fillGenerator.x1(function(t){return t[0]}),super._afterNew()}makeStroke(t){const e=this.mainContainer.children.push(t.make());return t.push(e),e}makeFill(t){const e=this.mainContainer.children.push(t.make());return t.push(e),e}_updateChildren(){this._strokeTemplate=void 0,this._fillTemplate=void 0;let t=this.get("xAxis"),e=this.get("yAxis");if(this.isDirty("stroke")){const i=this.get("stroke");this.strokes.template.set("stroke",i);const s=this._legendStroke;s&&s.states.lookup("default").set("stroke",i)}if(this.isDirty("fill")){const i=this.get("fill");this.fills.template.set("fill",i);const s=this._legendFill;s&&s.states.lookup("default").set("fill",i)}if(this.isDirty("curveFactory")){const i=this.get("curveFactory");i&&(this._strokeGenerator.curve(i),this._fillGenerator.curve(i))}if(t.inited&&e.inited){if(this._axesDirty||this._valuesDirty||this._stackDirty||this.isDirty("vcx")||this.isDirty("vcy")||this._sizeDirty||this.isDirty("connect")||this.isDirty("curveFactory")){this.fills.each(c=>{c.setPrivate("visible",!1)}),this.strokes.each(c=>{c.setPrivate("visible",!1)}),this.axisRanges.each(c=>{let l=c.fills;l&&l.each(u=>{u.setPrivate("visible",!1)});let d=c.strokes;d&&d.each(u=>{u.setPrivate("visible",!1)})});let i=this.startIndex(),s=this.strokes.template.get("templateField"),a=this.fills.template.get("templateField"),r=!0,n=!0;s&&(r=!1),a&&(n=!1);for(let c=i-1;c>=0;c--){let l=this.dataItems[c],d=!0,u=l.dataContext;if(s&&u[s]&&(r=!0),a&&u[a]&&(n=!0),P(this._valueFields,g=>{b(l.get(g))||(d=!1)}),d&&r&&n){i=c;break}}let o=this.dataItems.length,h=this.endIndex();if(h{b(l.get(u))||(d=!1)}),d){h=c+1;break}}}if(i>0&&i--,this._endIndex=h,this._clearGraphics(),this._sindex=0,this._dindex=i,this.dataItems.length==1)this._startSegment(0);else for(;this._dindex0&&(bt=!0);let xt=!1;(A||f||w)&&(xt=!0);const at={points:j,segments:I,stacked:A,getOpen:xt,basePosX:F,basePosY:Wt,fillVisible:bt,xField:p,yField:x,xOpenField:v,yOpenField:_,vcx:g,vcy:m,baseAxis:u,xAxis:l,yAxis:d,locationX:mt,locationY:_t,openLocationX:Ut,openLocationY:Bt,minDistance:Ht};for(O=t;Ot){i=O;break}h.template=D}}if(pt){let D=R.dataContext[pt];if(D){if(D instanceof L||(D=L.new(D)),this._fillTemplate=D,O>t){i=O;break}r.template=D}}if(!a){let D=this.dataItems[O+1];D&&u.shouldGap(R,D,s,ut)&&(j=[],I.push(j),at.points=j)}}r.setRaw("userData",[t,O]),h.setRaw("userData",[t,O]),O===e&&this._endLine(j,I[0][0]),h&&this._drawStroke(h,I),r&&this._drawFill(r,I),this.axisRanges.each(R=>{const G=R.container,ot=R.fills,D=this.makeFill(ot);G&&G.children.push(D),D.setPrivate("visible",!0),this._drawFill(D,I);const Zt=R.strokes,Z=this.makeStroke(Zt);G&&G.children.push(Z),Z.setPrivate("visible",!0),this._drawStroke(Z,I),D.setRaw("userData",[t,O]),Z.setRaw("userData",[t,O])})}_getPoints(t,e){let i=e.points,s=t.get("locationX",e.locationX),a=t.get("locationY",e.locationY),r=e.xAxis.getDataItemPositionX(t,e.xField,s,e.vcx),n=e.yAxis.getDataItemPositionY(t,e.yField,a,e.vcy);if(this._shouldInclude(r)){const o=this.getPoint(r,n),h=[o.x,o.y];if(o.x+=this._x,o.y+=this._y,t.set("point",o),e.fillVisible){let c=r,l=n;if(e.baseAxis===e.xAxis?l=e.basePosY:e.baseAxis===e.yAxis&&(c=e.basePosX),e.getOpen){let u=t.get(e.xOpenField),g=t.get(e.yOpenField);if(u!=null&&g!=null){let m=t.get("openLocationX",e.openLocationX),p=t.get("openLocationY",e.openLocationY);if(e.stacked){let x=t.get("stackToItemX"),v=t.get("stackToItemY");x?(c=e.xAxis.getDataItemPositionX(x,e.xField,m,x.component.get("vcx")),B(c)&&(c=e.basePosX)):c=e.yAxis===e.baseAxis?e.basePosX:e.xAxis.getDataItemPositionX(t,e.xOpenField,m,e.vcx),v?(l=e.yAxis.getDataItemPositionY(v,e.yField,p,v.component.get("vcy")),B(l)&&(l=e.basePosY)):l=e.xAxis===e.baseAxis?e.basePosY:e.yAxis.getDataItemPositionY(t,e.yOpenField,p,e.vcy)}else c=e.xAxis.getDataItemPositionX(t,e.xOpenField,m,e.vcx),l=e.yAxis.getDataItemPositionY(t,e.yOpenField,p,e.vcy)}}let d=this.getPoint(c,l);h[2]=d.x,h[3]=d.y}if(e.minDistance>0){const c=h[0],l=h[1],d=h[2],u=h[3],g=this._previousPoint,m=g[0],p=g[1],x=g[2],v=g[3];(Math.hypot(c-m,l-p)>e.minDistance||d&&u&&Math.hypot(d-x,u-v)>e.minDistance)&&(i.push(h),this._previousPoint=h)}else i.push(h)}}_endLine(t,e){}_drawStroke(t,e){t.get("visible")&&!t.get("forceHidden")&&t.set("draw",i=>{P(e,s=>{this._strokeGenerator.context(i),this._strokeGenerator(s)})})}_drawFill(t,e){t.get("visible")&&!t.get("forceHidden")&&t.set("draw",i=>{P(e,s=>{this._fillGenerator.context(i),this._fillGenerator(s)})})}_processAxisRange(t){super._processAxisRange(t),t.fills=new V(L.new({}),()=>Y._new(this._root,{themeTags:S(t.fills.template.get("themeTags",[]),["line","series","fill"])},[this.fills.template,t.fills.template])),t.strokes=new V(L.new({}),()=>Y._new(this._root,{themeTags:S(t.strokes.template.get("themeTags",[]),["line","series","stroke"])},[this.strokes.template,t.strokes.template]))}createLegendMarker(t){const e=this.get("legendDataItem");if(e){const i=e.get("marker"),s=e.get("markerRectangle");s&&s.setPrivate("visible",!1),i.set("background",H.new(i._root,{fillOpacity:0,fill:ee(0)}));const a=i.children.push(Y._new(i._root,{themeTags:["line","series","legend","marker","stroke"],interactive:!1},[this.strokes.template]));this._legendStroke=a;const r=i.children.push(Y._new(i._root,{themeTags:["line","series","legend","marker","fill"]},[this.fills.template]));this._legendFill=r;const n=this._root.interfaceColors.get("disabled");if(a.states.create("disabled",{fill:n,stroke:n}),r.states.create("disabled",{fill:n,stroke:n}),this.bullets.length>0){const o=this.bullets.getIndex(0);if(o){const h=o(i._root,this,new st(this,{legend:!0},{}));if(h){const c=h.get("sprite");c instanceof Y&&c.states.create("disabled",{fill:n,stroke:n}),c&&(c.set("tooltipText",void 0),c.set("tooltipHTML",void 0),i.children.push(c),c.setAll({x:i.width()/2,y:i.height()/2}))}}}}}}Object.defineProperty(ct,"className",{enumerable:!0,configurable:!0,writable:!0,value:"LineSeries"}),Object.defineProperty(ct,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:W.classNames.concat([ct.className])});export{ht as _,dt as b,U as c,W as d,nt as o,rt as r,lt as u,ct as x}; diff --git a/dist/assets/LineVisualElement-4BP10o6v.js b/dist/assets/LineVisualElement-iKo1s90I.js similarity index 90% rename from dist/assets/LineVisualElement-4BP10o6v.js rename to dist/assets/LineVisualElement-iKo1s90I.js index e86f653..dba3e74 100644 --- a/dist/assets/LineVisualElement-4BP10o6v.js +++ b/dist/assets/LineVisualElement-iKo1s90I.js @@ -1 +1 @@ -import{i4 as g,i5 as y,b6 as _,bi as C,b2 as P,as as h,bw as f,bv as w,h9 as O,aa as n,i6 as u,i7 as R,i8 as $,bA as G}from"./index-J0iiHjMT.js";import{a as b}from"./Object3DVisualElement-TMb7y_wl.js";function E(d,e,t,s=!1){const r=g(d,e);return r==null?null:(r.hasZ&&!s||t==null||(r.z=y(t,r)??0),r)}function F(d,e,t){t.warnOnce(`Failed to project analysis geometry (id: '${d.id}'), projection from spatial reference (wkid: '${e.wkid}') to view spatial reference is not supported. Projection may be possible after calling projection.load().`)}class H extends b{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=t!=null,this._material=t??new _({width:1,color:C(1,0,1,1),stippleOffColor:null,stipplePattern:null,stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerColor:null,innerWidth:1,hasPolygonOffset:!1,renderOccluded:P.OccludeAndTransparent,isDecoration:!!e.isDecoration,writeDepth:!0}),this.applyProperties(e)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){const t=this.view.spatialReference,s=n(),r=n(),a=100,o=[];h(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),h(s,e[2],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),h(s,e[2],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),h(s,e[0],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),h(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),h(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),this.geometry=[o]}setGeometryFromFrustum(e){const t=[];e.lines.forEach(s=>{t.push([s.origin[0],s.origin[1],s.origin[2]]),t.push([s.endpoint[0],s.endpoint[1],s.endpoint[2]])}),this.geometry=[t]}setGeometryFromBoundedPlane(e){const t=[],s=e.origin,r=e.basis1,a=e.basis2,o=.5,i=n(),l=n(),m=n(),p=n();i[0]=s[0]-r[0]*o-a[0]*o,i[1]=s[1]-r[1]*o-a[1]*o,i[2]=s[2]-r[2]*o-a[2]*o,l[0]=s[0]-r[0]*o+a[0]*o,l[1]=s[1]-r[1]*o+a[1]*o,l[2]=s[2]-r[2]*o+a[2]*o,m[0]=s[0]+r[0]*o+a[0]*o,m[1]=s[1]+r[1]*o+a[1]*o,m[2]=s[2]+r[2]*o+a[2]*o,p[0]=s[0]+r[0]*o-a[0]*o,p[1]=s[1]+r[1]*o-a[1]*o,p[2]=s[2]+r[2]*o-a[2]*o,t.push([i[0],i[1],i[2]]),t.push([l[0],l[1],l[2]]),t.push([m[0],m[1],m[2]]),t.push([p[0],p[1],p[2]]),t.push([i[0],i[1],i[2]]),this.geometry=[t]}setGeometryFromSegment(e){const t=e.endRenderSpace;this.transform=f(c,t);const{points:s}=e.createRenderGeometry(t,this.view.renderCoordsHelper);this.geometry=[s]}setGeometryFromSegments(e,t=w){this.transform=f(c,t),this.geometry=e.map(s=>s.createRenderGeometry(t,this.view.renderCoordsHelper).points)}getTransformedGeometry(){return this._geometry==null?null:this._geometry.map(e=>e.map(t=>O(n(),t,this.transform)))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){const t=e[3]===1;this._material.setParameters({color:u(e),writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e!=null?u(e):null})}get stipplePattern(){return this._material.parameters.stipplePattern}set stipplePattern(e){this._material!=null&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e!=null?u(e):null})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.hasPolygonOffset}set polygonOffset(e){this._material.setParameters({hasPolygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(const t of R(this.geometry)){const s=$(this._material,t);e.addGeometry(s)}}forEachExternalMaterial(e){this._hasExternalMaterial||e(this._material)}}const c=G();export{E as r,F as t,H as u}; +import{i1 as g,i2 as y,b9 as _,bA as C,b2 as P,bz as h,bP as f,bN as w,hb as O,a8 as n,i3 as u,i4 as R,i5 as b,bT as $}from"./index-pCX-0tJH.js";import{a as G}from"./Object3DVisualElement-8HoU366x.js";function E(d,e,t,s=!1){const r=g(d,e);return r==null?null:(r.hasZ&&!s||t==null||(r.z=y(t,r)??0),r)}function F(d,e,t){t.warnOnce(`Failed to project analysis geometry (id: '${d.id}'), projection from spatial reference (wkid: '${e.wkid}') to view spatial reference is not supported. Projection may be possible after calling projection.load().`)}class H extends G{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=t!=null,this._material=t??new _({width:1,color:C(1,0,1,1),stippleOffColor:null,stipplePattern:null,stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerColor:null,innerWidth:1,hasPolygonOffset:!1,renderOccluded:P.OccludeAndTransparent,isDecoration:!!e.isDecoration,writeDepth:!0}),this.applyProperties(e)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){const t=this.view.spatialReference,s=n(),r=n(),a=100,o=[];h(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),h(s,e[2],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),h(s,e[2],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),h(s,e[0],e[3],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),h(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),h(s,e[0],e[1],a),this.view.renderCoordsHelper.toRenderCoords(s,t,r),o.push([r[0],r[1],r[2]]),this.geometry=[o]}setGeometryFromFrustum(e){const t=[];e.lines.forEach(s=>{t.push([s.origin[0],s.origin[1],s.origin[2]]),t.push([s.endpoint[0],s.endpoint[1],s.endpoint[2]])}),this.geometry=[t]}setGeometryFromBoundedPlane(e){const t=[],s=e.origin,r=e.basis1,a=e.basis2,o=.5,i=n(),l=n(),m=n(),p=n();i[0]=s[0]-r[0]*o-a[0]*o,i[1]=s[1]-r[1]*o-a[1]*o,i[2]=s[2]-r[2]*o-a[2]*o,l[0]=s[0]-r[0]*o+a[0]*o,l[1]=s[1]-r[1]*o+a[1]*o,l[2]=s[2]-r[2]*o+a[2]*o,m[0]=s[0]+r[0]*o+a[0]*o,m[1]=s[1]+r[1]*o+a[1]*o,m[2]=s[2]+r[2]*o+a[2]*o,p[0]=s[0]+r[0]*o-a[0]*o,p[1]=s[1]+r[1]*o-a[1]*o,p[2]=s[2]+r[2]*o-a[2]*o,t.push([i[0],i[1],i[2]]),t.push([l[0],l[1],l[2]]),t.push([m[0],m[1],m[2]]),t.push([p[0],p[1],p[2]]),t.push([i[0],i[1],i[2]]),this.geometry=[t]}setGeometryFromSegment(e){const t=e.endRenderSpace;this.transform=f(c,t);const{points:s}=e.createRenderGeometry(t,this.view.renderCoordsHelper);this.geometry=[s]}setGeometryFromSegments(e,t=w){this.transform=f(c,t),this.geometry=e.map(s=>s.createRenderGeometry(t,this.view.renderCoordsHelper).points)}getTransformedGeometry(){return this._geometry==null?null:this._geometry.map(e=>e.map(t=>O(n(),t,this.transform)))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){const t=e[3]===1;this._material.setParameters({color:u(e),writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e!=null?u(e):null})}get stipplePattern(){return this._material.parameters.stipplePattern}set stipplePattern(e){this._material!=null&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e!=null?u(e):null})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.hasPolygonOffset}set polygonOffset(e){this._material.setParameters({hasPolygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(const t of R(this.geometry)){const s=b(this._material,t);e.addGeometry(s)}}forEachExternalMaterial(e){this._hasExternalMaterial||e(this._material)}}const c=$();export{E as r,F as t,H as u}; diff --git a/dist/assets/LinkChartLayer-bx0B-Kgd.js b/dist/assets/LinkChartLayer-bx0B-Kgd.js new file mode 100644 index 0000000..da52fe3 --- /dev/null +++ b/dist/assets/LinkChartLayer-bx0B-Kgd.js @@ -0,0 +1,7 @@ +import{eP as le,fZ as fr,eU as Dt,e as l,y as p,c as R,g as ke,dr as se,d2 as Wt,dE as gr,de as at,kr as ot,r as _,hc as Tt,ho as Vt,L as Ge,E as ye,j as Se,R as Ee,av as ve,kB as wr,aL as ge,f8 as Kt,eQ as De,dW as st,dO as Re,kD as Gt,ll as Rt,iz as _r,dF as Zt,dJ as Xt,dG as br,wF as Tr,f9 as me,es as St,wG as We,iG as Er,io as kr,h6 as Mr,ix as xr,iN as Cr,aI as er,V as Nt,eV as $t,ab as Ir}from"./index-pCX-0tJH.js";import{p as ue}from"./geohashUtils-U0jvYCSY.js";import{m as Lr}from"./FeatureStore-PXMUgn0j.js";import{W as vr}from"./QueryEngine-uvDs-vBe.js";import{l as Dr,o as Ve}from"./clientSideDefaults-63pOkJ4Y.js";import{c as Gr}from"./FeatureReductionLayer-2X2_PJv9.js";import"./BoundsStore-_-dPK5c-.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";const Rr="ESRI__DESTINATION_ID",Sr="ESRI__ORIGIN_ID";let Ke=class pe{constructor(){this._featureLookup=new Map}static getInstance(){return pe.instance||(pe.instance=new pe),pe.instance}static resetInstance(){pe.instance&&(pe.instance=null)}deleteFromStore(t){t.forEach(r=>{this._featureLookup.delete(r)})}readFromStoreByList(t){const r=[];return t.forEach(i=>{const n=this.readFromStoreById(i);n&&r.push(n)}),r}readFromStoreById(t){return this._featureLookup.get(t)??null}writeToStore(t,r,i){const n=[];return t.forEach(a=>{if(!(a!=null&&a.id))return;a.properties||(a.properties=[]);let o,s=null;if(i&&a.properties[i]&&(s=le(a.properties[i])),"originId"in a&&"destinationId"in a&&(a.properties[Sr]=a.originId,a.properties[Rr]=a.destinationId),a.properties[r]=a.id,a.id&&this._featureLookup.has(a.id)&&this._featureLookup.get(a.id).attributes){const d=this._featureLookup.get(a.id),u=JSON.parse(JSON.stringify(Object.assign(d.attributes,a.properties)));i&&a.properties[i]&&(u[i]=fr(a.properties[i])),o=new Dt(s?JSON.parse(JSON.stringify(s)):d!=null&&d.geometry?JSON.parse(JSON.stringify(d.geometry)):null,u,null,a.properties[r])}else o=new Dt(s?JSON.parse(JSON.stringify(s)):null,a.properties,null,a.properties[r]);this._featureLookup.set(a.id,o),n.push(o)}),n}},Pe=class extends ke{constructor(t){super(t),this.resultRows=[]}};l([p()],Pe.prototype,"resultRows",void 0),Pe=l([R("esri.rest.knowledgeGraph.GraphQueryResult")],Pe);const Ft=Pe;let Oe=class extends ke{constructor(t){super(t),this.resultRowsStream=new ReadableStream}};l([p()],Oe.prototype,"resultRowsStream",void 0),Oe=l([R("esri.rest.knowledgeGraph.GraphQueryResult")],Oe);const Pt=Oe;let ae=class extends se{constructor(t){super(t),this.name=null,this.unique=null,this.ascending=null,this.description=null,this.fieldNames=null}};l([p({type:String,json:{write:!0}})],ae.prototype,"name",void 0),l([p({type:Boolean,json:{write:!0}})],ae.prototype,"unique",void 0),l([p({type:Boolean,json:{write:!0}})],ae.prototype,"ascending",void 0),l([p({type:String,json:{write:!0}})],ae.prototype,"description",void 0),l([p({type:[String],json:{write:!0}})],ae.prototype,"fieldNames",void 0),ae=l([R("esri.rest.knowledgeGraph.FieldIndex")],ae);const tr=ae;let q=class extends se{constructor(t){super(t),this.name=null,this.alias=null,this.fieldType=null,this.geometryType=null,this.hasM=null,this.hasZ=null,this.nullable=null,this.editable=null,this.required=null,this.defaultVisibility=null,this.systemMaintained=null,this.role=null,this.defaultValue=null}};l([p({type:String,json:{write:!0}})],q.prototype,"name",void 0),l([p({type:String,json:{write:!0}})],q.prototype,"alias",void 0),l([p({type:String,json:{write:!0}})],q.prototype,"fieldType",void 0),l([p({type:String,json:{write:!0}})],q.prototype,"geometryType",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"hasM",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"hasZ",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"nullable",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"editable",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"required",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"defaultVisibility",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"systemMaintained",void 0),l([p()],q.prototype,"role",void 0),l([p({type:Object,json:{type:String,write:{writer:(e,t)=>{t.defaultValue=e!=null?e.toString():null}}}})],q.prototype,"defaultValue",void 0),q=l([R("esri.rest.knowledgeGraph.GraphProperty")],q);const rr=q;let ne=class extends se{constructor(t){super(t),this.name=null,this.alias=null,this.role=null,this.strict=null,this.properties=null,this.fieldIndexes=null}};l([p({type:String,json:{write:!0}})],ne.prototype,"name",void 0),l([p({type:String,json:{write:!0}})],ne.prototype,"alias",void 0),l([p({type:String,json:{write:!0}})],ne.prototype,"role",void 0),l([p({type:Boolean,json:{write:!0}})],ne.prototype,"strict",void 0),l([p({type:[rr],json:{write:!0}})],ne.prototype,"properties",void 0),l([p({type:[tr],json:{write:!0}})],ne.prototype,"fieldIndexes",void 0),ne=l([R("esri.rest.knowledgeGraph.GraphObjectType")],ne);const ir=ne;let lt=class extends ir{constructor(t){super(t)}};lt=l([R("esri.rest.knowledgeGraph.EntityType")],lt);const Et=lt;let je=class extends ir{constructor(t){super(t),this.endPoints=[]}};l([p()],je.prototype,"endPoints",void 0),je=l([R("esri.rest.knowledgeGraph.RelationshipType")],je);const kt=je;let V=class extends se{constructor(t){super(t),this.timestamp=null,this.spatialReference=null,this.strict=null,this.objectIdField=null,this.globalIdField=null,this.arcgisManaged=null,this.identifierInfo=null,this.searchIndexes=null,this.entityTypes=null,this.relationshipTypes=null}};l([p({type:Date,json:{type:Number,write:{writer:(e,t)=>{t.timestamp=e==null?void 0:e.getTime()}}}})],V.prototype,"timestamp",void 0),l([p({type:Wt,json:{write:!0}})],V.prototype,"spatialReference",void 0),l([p({type:Boolean,json:{write:!0}})],V.prototype,"strict",void 0),l([p({type:String,json:{write:!0}})],V.prototype,"objectIdField",void 0),l([p({type:String,json:{write:!0}})],V.prototype,"globalIdField",void 0),l([p()],V.prototype,"arcgisManaged",void 0),l([p()],V.prototype,"identifierInfo",void 0),l([p()],V.prototype,"searchIndexes",void 0),l([p({type:[Et],json:{write:!0}})],V.prototype,"entityTypes",void 0),l([p({type:[kt],json:{write:!0}})],V.prototype,"relationshipTypes",void 0),V=l([R("esri.rest.knowledgeGraph.DataModel")],V);const nr=V;let P=class extends se{constructor(t){super(t),this.capabilities=[],this.supportsSearch=!1,this.supportedQueryFormats=[],this.allowGeometryUpdates=!1,this.searchMaxRecordCount=null,this.serviceCapabilities=null,this.maxRecordCount=null,this.description="",this.copyrightText="",this.units="",this.spatialReference=null,this.currentVersion=null,this.dateFieldsTimeReference=null,this.serviceItemId="",this.supportsDocuments=!1,this.dataEditingNotSupported=!1,this.schemaEditingNotSupported=!1}};l([p({type:[String],json:{write:!0}})],P.prototype,"capabilities",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"supportsSearch",void 0),l([p({type:[String],json:{write:!0}})],P.prototype,"supportedQueryFormats",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"allowGeometryUpdates",void 0),l([p({type:Number,json:{write:!0}})],P.prototype,"searchMaxRecordCount",void 0),l([p({type:Object,json:{write:!0}})],P.prototype,"serviceCapabilities",void 0),l([p({type:Number,json:{write:!0}})],P.prototype,"maxRecordCount",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"description",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"copyrightText",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"units",void 0),l([p({type:Object,json:{write:!0}})],P.prototype,"spatialReference",void 0),l([p({type:Number,json:{write:!0}})],P.prototype,"currentVersion",void 0),l([p({type:Object,json:{write:!0}})],P.prototype,"dateFieldsTimeReference",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"serviceItemId",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"supportsDocuments",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"dataEditingNotSupported",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"schemaEditingNotSupported",void 0),P=l([R("esri.rest.knowledgeGraph.ServiceDefinition")],P);const ar=P;let we=class extends se{constructor(t){super(t),this.dataModel=null,this.serviceDefinition=null}};l([p({type:String,json:{write:!0}})],we.prototype,"url",void 0),l([p({type:nr,json:{write:!0}})],we.prototype,"dataModel",void 0),l([p({type:ar,json:{write:!0}})],we.prototype,"serviceDefinition",void 0),we=l([R("esri.rest.knowledgeGraph.KnowledgeGraph")],we);const Nr=we,Ot="esri/rest/knowledgeGraph/wasmInterface/";let Ze;async function oe(){const e=Ze;if(e)return e;const t=gr("wasm-simd");return Ze=$r(t),Ze}async function $r(e){if(e){const{default:r}=await at(()=>import("./arcgis-knowledge-client-core-simd-VjZZ0mc4.js"),__vite__mapDeps([0,1,2])).then(i=>i.a);return r({locateFile:i=>ot(Ot+i)})}const{default:t}=await at(()=>import("./arcgis-knowledge-client-core-FOb54Y-y.js"),__vite__mapDeps([3,1,2])).then(r=>r.a);return t({locateFile:r=>ot(Ot+r)})}function or(e,t){const r=new t.ArrayValue;return r.deleteLater(),e.forEach(i=>{r.add_value(xt(i,t))}),r}function sr(e,t){const r=new t.ObjectValue;r.deleteLater();for(const[i,n]of Object.entries(e))r.set_key_value(i,xt(n,t));return r}function Mt(e,t){if(e instanceof Vt)return jr(e,t);if(e instanceof Ge)return Ar(e,t);if(e instanceof ye||e instanceof Se)return Or(e,t);throw new _("knowledge-graph:unsupported-geometry","Only Point, Multipoint, Polyline, and Polygon geometry are supported by ArcGIS Knowledge",{geometry:e})}function Fr(e,t){t.input_quantization_parameters={xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}function Pr(e,t,r){if(!e.extent)throw new _("knowledge-graph:illegal-output-quantization","The Output quantization provided to the encoder had an illegal value as part of its extent",e.extent);if(!e.quantizeMode)throw new _("knowledge-graph:illegal-output-quantization","The Output quantization contained an illegal mode setting",e.quantizeMode);if(!e.tolerance)throw new _("knowledge-graph:illegal-output-quantization","The Output quantization contained an illegal tolerance setting",e.quantizeMode);t.output_quantization_parameters={extent:{xmax:e.extent.xmax,ymax:e.extent.ymax,xmin:e.extent.xmin,ymin:e.extent.ymin},quantize_mode:r.esriQuantizeMode[e.quantizeMode],tolerance:e.tolerance}}function xt(e,t){if(e==null)return"";if(typeof e!="object"||e instanceof Date)return e;if(e instanceof Tt)return Mt(e,t);if(Array.isArray(e)){const r=new t.ArrayValue;return r.deleteLater(),e.forEach(i=>{r.add_value(xt(i,t))}),r}return sr(e,t)}function Or(e,t){const r=new t.GeometryValue;r.deleteLater(),r.has_z=e.hasZ,r.has_m=e.hasM;const i=[],n=[];let a=[];e instanceof ye?(r.geometry_type=t.esriGeometryType.esriGeometryPolyline,a=e.paths):e instanceof Se&&(r.geometry_type=t.esriGeometryType.esriGeometryPolygon,a=e.rings);let o=0,s=0;return a.forEach(d=>{let u=0;d.forEach(c=>{u++,c.forEach(m=>{i[s]=m,s++})}),n[o]=u,o++}),r.coords=new Float64Array(i),r.lengths=new Uint32Array(n),r}function jr(e,t){const r=new t.GeometryValue;r.deleteLater(),r.geometry_type=r.geometry_type=t.esriGeometryType.esriGeometryMultipoint,r.has_z=e.hasZ,r.has_m=e.hasM;const i=[],n=[];n[0]=e.points.length;let a=0;return e.points.forEach(o=>{o.forEach(s=>{i[a]=s,a++})}),r.coords=new Float64Array(i),r.lengths=new Uint32Array(n),r}function Ar(e,t){const r=new t.GeometryValue;r.deleteLater(),r.geometry_type=t.esriGeometryType.esriGeometryPoint,r.has_z=e.hasZ,r.has_m=e.hasM;const i=[],n=[];n[0]=1,i[0]=e.x,i[1]=e.y;let a=2;return e.hasZ&&(i[a]=e.z,a++),e.hasM&&(i[a]=e.m,a++),r.coords=new Float64Array(i),r.lengths=new Uint32Array(n),r}let Ae=class extends se{constructor(t){super(t),this.properties=null}};l([p({json:{write:!0}})],Ae.prototype,"properties",void 0),Ae=l([R("esri.rest.knowledgeGraph.GraphObject")],Ae);const Ct=Ae;let Ie=class extends Ct{constructor(t){super(t),this.typeName=null,this.id=null}};l([p({type:String,json:{write:!0}})],Ie.prototype,"typeName",void 0),l([p({type:String,json:{write:!0}})],Ie.prototype,"id",void 0),Ie=l([R("esri.rest.knowledgeGraph.GraphNamedObject")],Ie);const lr=Ie;let ze=class extends lr{constructor(t){super(t),this.layoutGeometry=null}};l([p({type:Ge,json:{write:!0}})],ze.prototype,"layoutGeometry",void 0),ze=l([R("esri.rest.knowledgeGraph.Entity")],ze);const pr=ze;let _e=class extends lr{constructor(t){super(t),this.originId=null,this.destinationId=null,this.layoutGeometry=null}};l([p({type:String,json:{write:!0}})],_e.prototype,"originId",void 0),l([p({type:String,json:{write:!0}})],_e.prototype,"destinationId",void 0),l([p({type:ye,json:{write:!0}})],_e.prototype,"layoutGeometry",void 0),_e=l([R("esri.rest.Relationship.Relationship")],_e);const dr=_e;function $e(e,t){if(!e.typeName)throw new _("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits");if(e instanceof pr){const r=new t.EntityValue;r.deleteLater(),r.type_name=e.typeName;for(const[i,n]of Object.entries(e.properties))r.set_key_value(i,jt(n,t));return e.id&&r.set_id(e.id),r}if(e instanceof dr){const r=new t.RelationshipValue;r.deleteLater(),r.type_name=e.typeName;for(const[i,n]of Object.entries(e.properties))r.set_key_value(i,jt(n,t));return e.id&&r.set_id(e.id),e.originId&&e.destinationId&&r.set_related_entity_ids(e.originId,e.destinationId),r}throw new _("knowledge-graph:applyEdits-encoding-failure","Could not determine the type of a named graph object passed to the encoder")}function zr(e){return{xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}function jt(e,t){return e==null?"":typeof e!="object"||e instanceof Date?e:e instanceof Tt?Mt(e,t):""}let de=class extends ke{constructor(t){super(t),this.name=null,this.supportedCategory=null,this.analyzers=[],this.searchProperties=new Map}};l([p()],de.prototype,"name",void 0),l([p()],de.prototype,"supportedCategory",void 0),l([p()],de.prototype,"analyzers",void 0),l([p()],de.prototype,"searchProperties",void 0),de=l([R("esri.rest.knowledgeGraph.SearchIndex")],de);const Qr=de;var Ye,Be,He,pt,dt,ut,ht;(function(e){e[e.Regular=0]="Regular",e[e.Provenance=1]="Provenance",e[e.Document=2]="Document"})(Ye||(Ye={})),function(e){e[e.esriFieldTypeSmallInteger=0]="esriFieldTypeSmallInteger",e[e.esriFieldTypeInteger=1]="esriFieldTypeInteger",e[e.esriFieldTypeSingle=2]="esriFieldTypeSingle",e[e.esriFieldTypeDouble=3]="esriFieldTypeDouble",e[e.esriFieldTypeString=4]="esriFieldTypeString",e[e.esriFieldTypeDate=5]="esriFieldTypeDate",e[e.esriFieldTypeOID=6]="esriFieldTypeOID",e[e.esriFieldTypeGeometry=7]="esriFieldTypeGeometry",e[e.esriFieldTypeBlob=8]="esriFieldTypeBlob",e[e.esriFieldTypeRaster=9]="esriFieldTypeRaster",e[e.esriFieldTypeGUID=10]="esriFieldTypeGUID",e[e.esriFieldTypeGlobalID=11]="esriFieldTypeGlobalID",e[e.esriFieldTypeXML=12]="esriFieldTypeXML",e[e.esriFieldTypeBigInteger=13]="esriFieldTypeBigInteger",e[e.esriFieldTypeDateOnly=14]="esriFieldTypeDateOnly",e[e.esriFieldTypeTimeOnly=15]="esriFieldTypeTimeOnly",e[e.esriFieldTypeTimestampOffset=16]="esriFieldTypeTimestampOffset"}(Be||(Be={})),function(e){e[e.esriGeometryNull=0]="esriGeometryNull",e[e.esriGeometryPoint=1]="esriGeometryPoint",e[e.esriGeometryMultipoint=2]="esriGeometryMultipoint",e[e.esriGeometryPolyline=3]="esriGeometryPolyline",e[e.esriGeometryPolygon=4]="esriGeometryPolygon",e[e.esriGeometryEnvelope=5]="esriGeometryEnvelope",e[e.esriGeometryAny=6]="esriGeometryAny",e[e.esriGeometryMultiPatch=7]="esriGeometryMultiPatch"}(He||(He={})),function(e){e[e.esriMethodHintUNSPECIFIED=0]="esriMethodHintUNSPECIFIED",e[e.esriUUIDESRI=1]="esriUUIDESRI",e[e.esriUUIDRFC4122=2]="esriUUIDRFC4122"}(pt||(pt={})),function(e){e[e.esriTypeUNSPECIFIED=0]="esriTypeUNSPECIFIED",e[e.esriTypeEntity=1]="esriTypeEntity",e[e.esriTypeRelationship=2]="esriTypeRelationship",e[e.esriTypeBoth=4]="esriTypeBoth"}(dt||(dt={})),function(e){e[e.esriGraphPropertyUNSPECIFIED=0]="esriGraphPropertyUNSPECIFIED",e[e.esriGraphPropertyRegular=1]="esriGraphPropertyRegular",e[e.esriGraphPropertyDocumentName=2]="esriGraphPropertyDocumentName",e[e.esriGraphPropertyDocumentTitle=3]="esriGraphPropertyDocumentTitle",e[e.esriGraphPropertyDocumentUrl=4]="esriGraphPropertyDocumentUrl",e[e.esriGraphPropertyDocumentText=5]="esriGraphPropertyDocumentText",e[e.esriGraphPropertyDocumentKeywords=6]="esriGraphPropertyDocumentKeywords",e[e.esriGraphPropertyDocumentContentType=7]="esriGraphPropertyDocumentContentType",e[e.esriGraphPropertyDocumentMetadata=8]="esriGraphPropertyDocumentMetadata",e[e.esriGraphPropertyDocumentFileExtension=9]="esriGraphPropertyDocumentFileExtension"}(ut||(ut={})),function(e){e[e.esriIdentifierInfoTypeUNSPECIFIED=0]="esriIdentifierInfoTypeUNSPECIFIED",e[e.esriIdentifierInfoTypeDatabaseNative=1]="esriIdentifierInfoTypeDatabaseNative",e[e.esriIdentifierInfoTypeUniformProperty=2]="esriIdentifierInfoTypeUniformProperty"}(ht||(ht={}));function Ur(e){var t,r,i,n,a,o,s,d,u,c,m;return e.deleteLater(),new nr({timestamp:e.timestamp,spatialReference:new Wt(e.spatial_reference),strict:e.strict,objectIdField:e.objectid_property,globalIdField:e.globalid_property,arcgisManaged:e.arcgis_managed,identifierInfo:{identifierMappingInfo:{identifierInfoType:ht[(i=(r=(t=e.identifier_info)==null?void 0:t.identifier_mapping_info)==null?void 0:r.identifier_info_type)==null?void 0:i.value],databaseNativeIdentifier:(a=(n=e.identifier_info)==null?void 0:n.identifier_mapping_info)==null?void 0:a.database_native_identifier,uniformPropertyIdentifier:{identifierPropertyName:(d=(s=(o=e.identifier_info)==null?void 0:o.identifier_mapping_info)==null?void 0:s.uniform_property_identifier)==null?void 0:d.identifier_property_name}},identifierGenerationInfo:{uuidMethodHint:pt[(m=(c=(u=e.identifier_info)==null?void 0:u.identifier_generation_info)==null?void 0:c.uuid_method_hint)==null?void 0:m.value]}},searchIndexes:Xr(e.search_indexes),entityTypes:Jr(e.entity_types),relationshipTypes:Zr(e.relationship_types)})}function qr(e){return e.deleteLater(),new Et(ur(e))}function Yr(e){return e.deleteLater(),new tr({name:e.name,unique:e.unique,ascending:e.ascending,description:e.description,fieldNames:Wr(e.fields)})}function ur(e){return{name:e.name,alias:e.alias,role:Ye[e.role.value]?Ye[e.role.value]:null,strict:e.strict,properties:Vr(e.properties),fieldIndexes:Kr(e.field_indexes)}}function Br(e){return e.deleteLater(),new rr({alias:e.alias,name:e.name,fieldType:Be[e.field_type.value]?Be[e.field_type.value]:null,geometryType:He[e.geometry_type.value]?He[e.geometry_type.value]:null,hasM:e.has_m,hasZ:e.has_z,nullable:e.nullable,editable:e.editable,required:e.required,defaultVisibility:e.default_visibility,systemMaintained:e.system_maintained,role:ut[e.role.value],defaultValue:e.default_value})}function Hr(e){e.deleteLater();const t=ur(e),r=[];for(let i=0;i{const d=[];for(let u=0;u{if(e==null)return null;if(typeof e!="object"||"getDate"in e)return e;if("geometry_type"in e)switch(e.geometry_type.value){case null:return null;case Z.ESRI_GEOMETRY_POINT:return ii(e);case Z.ESRI_GEOMETRY_MULTIPOINT:return ri(e);case Z.ESRI_GEOMETRY_POLYLINE:return ni(e);case Z.ESRI_GEOMETRY_POLYGON:return ai(e);case Z.ESRI_GEOMETRY_ENVELOPE:case Z.ESRI_GEOMETRY_MULTI_PATCH:return Fe.warnOnce("Envelope and Multipatch are not supported on knowledge entities, but one of those geometry types was detected. Result interpreted as null"),null;case Z.ESRI_GEOMETRY_NULL:case Z.ESRI_GEOMETRY_ANY:default:return Fe.warnOnce("Unknown or blank geometry type returned - Result interpreted as null"),null}else{if(!("object_value_type"in e))return Fe.warnOnce("A decoded value came back of a type that is not supported. Result interpreted as null"),null;switch(e.object_value_type.value){case he.OBJECT:return li(e,t);case he.ENTITY:return cr(e,t);case he.RELATIONSHIP:return yr(e,t);case he.PATH:return pi(e,t);case he.ARRAY:return si(e,t);default:return Fe.warnOnce("Unknown graph object type detected! Result interpreted as null"),null}}}};function si(e,t){const r=[],i=e.count();for(let n=0;n{const t=new Nr({url:e}),r=[];return r.push(Je(t)),r.push(ci(t)),await Promise.all(r),t},refreshDataModel:async e=>{e.dataModel=await mr(e)},refreshServiceDefinition:async e=>{var r,i;const t=(await ve(e.url,{query:{f:"json"}})).data;return t.capabilities=(r=t==null?void 0:t.capabilities)==null?void 0:r.split(","),t.supportedQueryFormats=(i=t==null?void 0:t.supportedQueryFormats)==null?void 0:i.split(","),e.serviceDefinition=new ar(t),e.serviceDefinition},executeQueryStreaming:async(e,t,r)=>{const i=`${e.url}/graph/query`;await et(e);const n=await tt(i,r);n.data.body=await fi(t,e);const a=await Xe(n.data.url,n.data);if(e.dataModel)return new Pt({resultRowsStream:await zt(a,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},executeApplyEdits:async(e,t,r)=>{var a;if((a=e.serviceDefinition)!=null&&a.dataEditingNotSupported)throw new _("knowledge-graph:data-editing-not-supported","The Knowledge Graph Service definition indicated that data editing is not supported");const i=`${e.url}/graph/applyEdits`;await et(e);const n=await tt(i,r);return n.data.body=await mi(t,e),wi(await Xe(n.data.url,n.data))},executeQuery:async(e,t,r)=>{var s;const i=`${e.url}/graph/query`,n=await ve(i,{responseType:"array-buffer",query:{f:"pbf",openCypherQuery:t.openCypherQuery,...r==null?void 0:r.query},signal:r==null?void 0:r.signal,timeout:r==null?void 0:r.timeout}),a=(s=n.getHeader)==null?void 0:s.call(n,"content-type"),o=n.data;if(a!=null&&a.includes("application/x-protobuf")){const d=new(await oe()).GraphQueryDecoder;if(d.deleteLater(),e.dataModel)return new Ft({resultRows:yt(d,o,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:a,data:n.data})},executeSearch:async(e,t,r)=>{var d;const i=t.typeCategoryFilter,n=`${e.url}/graph/search`,a=await ve(n,{responseType:"array-buffer",query:{f:"pbf",searchQuery:`"${t.searchQuery}"`,typeCategoryFilter:i,...r==null?void 0:r.query},signal:r==null?void 0:r.signal,timeout:r==null?void 0:r.timeout}),o=(d=a.getHeader)==null?void 0:d.call(a,"content-type"),s=a.data;if(o!=null&&o.includes("application/x-protobuf")){const u=new(await oe()).GraphQueryDecoder;if(u.deleteLater(),e.dataModel)return new Ft({resultRows:yt(u,s,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:o,data:a.data})},executeSearchStreaming:async(e,t,r)=>{const i=`${e.url}/graph/search`;await et(e);const n=await tt(i,r);n.data.body=await gi(t);const a=await Xe(n.data.url,n.data);if(e.dataModel)return new Pt({resultRowsStream:await zt(a,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},_fetchWrapper:async(e,t)=>fetch(e,t)};async function Ue(e,t,r){return Ne.executeQueryStreaming(e,t,r)}async function hi(e){return Ne.fetchKnowledgeGraph(e)}async function Je(e){return Ne.refreshDataModel(e)}async function ci(e){return Ne.refreshServiceDefinition(e)}async function Xe(e,t){return Ne._fetchWrapper(e,t)}async function et(e){var r;((r=wr)==null?void 0:r.findCredential(e.url))||(e.dataModel?await mr(e):await Je(e))}function xe(e,t,r){if(e.error_code!==0)throw new _(t,r,{errorCode:e.error_code,errorMessage:e.error_message})}function yi(e,t,r,i){t==null?r.set_param_key_value(e,""):typeof t!="object"||t instanceof Date?r.set_param_key_value(e,t):t instanceof Tt?r.set_param_key_value(e,Mt(t,i)):t instanceof Array?r.set_param_key_value(e,or(t,i)):r.set_param_key_value(e,sr(t,i))}async function mi(e,t){var o,s,d,u,c,m,g,h,E;if(t.dataModel||await Je(t),!t.dataModel)throw new _("knowledge-graph:data-model-undefined","Encoding could not proceed because a data model was not provided and it could not be determined from the service");const r=await oe(),i=!!((o=e.options)!=null&&o.cascadeDelete),n=new r.GraphApplyEditsEncoder(r.SpatialReferenceUtil.WGS84(),(s=e.options)!=null&&s.inputQuantizationParameters?zr((d=e.options)==null?void 0:d.inputQuantizationParameters):r.InputQuantizationUtil.WGS84_lossless());n.deleteLater(),n.cascade_delete=i;try{let w;(u=e.entityAdds)==null||u.forEach(y=>{w=n.add_entity($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),(c=e.relationshipAdds)==null||c.forEach(y=>{if(!y.originId||!y.destinationId)throw new _("knowledge-graph:relationship-origin-destination-missing","When adding a new relationship, you must provide both an origin and destination id on the appropriate class property");w=n.add_relationship($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),(m=e.entityUpdates)==null||m.forEach(y=>{if(!y.id)throw new _("knowledge-graph:entity-id-missing","When updating an entity or relationship, you must specify the id on the class level property");w=n.update_entity($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),(g=e.relationshipUpdates)==null||g.forEach(y=>{if(!y.id)throw new _("knowledge-graph:relationship-id-missing","When updating an entity or relationship, you must specify the id on the class level property");w=n.update_relationship($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),(h=e.entityDeletes)==null||h.forEach(y=>{var I;if(!y.typeName)throw new _("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const b=n.make_delete_helper(y.typeName,!0);b.deleteLater(),(I=y.ids)==null||I.forEach(Q=>{b.delete_by_id(Q)})}),(E=e.relationshipDeletes)==null||E.forEach(y=>{var I;if(!y.typeName)throw new _("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const b=n.make_delete_helper(y.typeName,!1);(I=y.ids)==null||I.forEach(Q=>{b.delete_by_id(Q)})}),n.encode()}catch(w){throw new _("knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed",{error:w})}const a=n.get_encoding_result();return xe(a.error,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed"),a.get_byte_buffer()}async function fi(e,t){var a,o;const r=await oe(),i=new r.GraphQueryRequestEncoder;if(i.deleteLater(),i.output_spatial_reference=r.SpatialReferenceUtil.WGS84(),i.open_cypher_query=e.openCypherQuery,e.bindParameters)for(const[s,d]of Object.entries(e.bindParameters))yi(s,d,i,r);if(e.bindGeometryQuantizationParameters)Fr(e.bindGeometryQuantizationParameters,i);else{if(t.dataModel||await Je(t),((o=(a=t.dataModel)==null?void 0:a.spatialReference)==null?void 0:o.wkid)!==4326)throw new _("knowledge-graph:SR-quantization-mismatch","If the DataModel indicates a coordinate system other than WGS84, inputQuantizationParameters must be provided to the query encoder");i.input_quantization_parameters=r.InputQuantizationUtil.WGS84_lossless()}e.outputQuantizationParameters&&Pr(e.outputQuantizationParameters,i,r);try{i.encode()}catch(s){throw new _("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{error:s})}const n=i.get_encoding_result();if(n.error.error_code!==0)throw new _("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{errorCode:n.error.error_code,errorMessage:n.error.error_message});return n.get_byte_buffer()}async function gi(e){var n;const t=await oe(),r=new t.GraphSearchRequestEncoder;if(r.deleteLater(),r.search_query=e.searchQuery,r.type_category_filter=t.esriNamedTypeCategory[e.typeCategoryFilter],e.returnSearchContext===!0&&(r.return_search_context=e.returnSearchContext),e.start!=null&&e.start>0&&(r.start_index=e.start),e.num!=null&&(r.max_num_results=e.num),e.idsFilter!=null&&Array.isArray(e.idsFilter)&&e.idsFilter.length>0)try{r.set_ids_filter(or(e.idsFilter,t))}catch(a){throw new _("knowledge-graph:ids-format-error","Attempting to set ids filter failed. This is usually caused by an incorrectly formatted UUID string",{error:a})}(n=e.namedTypesFilter)==null||n.forEach(a=>{r.add_named_type_filter(a)});try{r.encode()}catch(a){throw new _("knowledge-graph:search-encoding-failed","Attempting to encode the search failed",{error:a})}const i=r.get_encoding_result();if(i.error.error_code!==0)throw new _("knowledge-graph:search-encoding-failed","Attempting to get encoding result from the query failed",{errorCode:i.error.error_code,errorMessage:i.error.error_message});return i.get_byte_buffer()}async function tt(e,t){return ve(e,{responseType:"native-request-init",method:"post",query:{f:"pbf",...t==null?void 0:t.query},body:"x",headers:{"Content-Type":"application/octet-stream"},signal:t==null?void 0:t.signal,timeout:t==null?void 0:t.timeout})}async function wi(e){const t=e.headers.get("content-type");if(t!=null&&t.includes("application/x-protobuf")){const r=await e.arrayBuffer(),i=new(await oe()).GraphApplyEditsDecoder;return i.deleteLater(),i.decode(new Uint8Array(r)),ui(i)}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:t,data:e.text()})}function yt(e,t,r){e.push_buffer(new Uint8Array(t));const i=[];let n=0;for(;e.next_row();){n||(n=e.get_header_keys().size());const a=new Array(n);for(let o=0;o{if(d){let m;if(a.has_error()&&(m=new _("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded",{errorCode:a.error.error_code,errorMessage:a.error.error_message})),n.releaseLock(),m)throw o.error(m),m;return void o.close()}const c=yt(a,u,t);return c.length>0&&o.enqueue(c),s()})}}})}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:r,data:e.text()})}async function mr(e){var a;const t=`${e.url}/dataModel/queryDataModel`,r=await ve(t,{responseType:"array-buffer",query:{f:"pbf"}}),i=(a=r.getHeader)==null?void 0:a.call(r,"content-type"),n=r.data;if(i!=null&&i.includes("application/x-protobuf")){const o=(await oe()).decode_data_model_from_protocol_buffer(new Uint8Array(n));if(!o)throw new _("knowledge-graph:data-model-decode-failure","The server responded to the data model query, but the response failed to be decoded. This typically occurs when the Knowledge JS API (4.26 or later) is used with an unsupported backend (11.0 or earlier)");return Ur(o)}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:i,data:r.data})}let qe=class extends ke{constructor(t){super(t),this.openCypherQuery=""}};l([p()],qe.prototype,"openCypherQuery",void 0),qe=l([R("esri.rest.knowledgeGraph.GraphQuery")],qe);const _i=qe;let Te=class extends _i{constructor(t){super(t),this.bindParameters=null,this.bindGeometryQuantizationParameters=null,this.outputQuantizationParameters=null}};l([p()],Te.prototype,"bindParameters",void 0),l([p()],Te.prototype,"bindGeometryQuantizationParameters",void 0),l([p()],Te.prototype,"outputQuantizationParameters",void 0),Te=l([R("esri.rest.knowledgeGraph.GraphQueryStreaming")],Te);const Le=Te;function bi(e){if(!e.spatialReference.isWGS84)throw new _("knowledge-graph:layer-support-utils","The extentToInBoundsRings function only supports WGS84 spatial references.");let t;return t=e.xmax>180&&e.xmin<180?[[[e.xmin,e.ymin],[e.xmin,e.ymax],[180,e.ymax],[180,e.ymin],[e.xmin,e.ymin]],[[-180,e.ymin],[-180,e.ymax],[e.xmax-360,e.ymax],[e.xmax-360,e.ymin],[-180,e.ymin]]]:e.xmax>180&&e.xmin>180?[[[e.xmin-360,e.ymin],[e.xmin-360,e.ymax],[e.xmax-360,e.ymax],[e.xmax-360,e.ymin],[e.xmin-360,e.ymin]]]:e.xmax>-180&&e.xmin<-180?[[[e.xmin+360,e.ymin],[e.xmin+360,e.ymax],[180,e.ymax],[180,e.ymin],[e.xmin+360,e.ymin]],[[-180,e.ymin],[-180,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[-180,e.ymin]]]:e.xmax<-180&&e.xmin<-180?[[[e.xmin+360,e.ymin],[e.xmin+360,e.ymax],[e.xmax+360,e.ymax],[e.xmax+360,e.ymin],[e.xmin+360,e.ymin]]]:[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]],t}async function Ti(e,t){var a,o;const r=[],i=new Map,n=[];if((a=t.dataModel)!=null&&a.relationshipTypes)for(const s of t.dataModel.relationshipTypes)s.name&&i.set(s.name,[]);for(const s of e)i.has(s.typeName)&&((o=i.get(s.typeName))==null||o.push(s.id));for(const[s,d]of i){if(d.length<1)continue;const u=new Le({openCypherQuery:`MATCH (n)-[r:${s}]->(m) WHERE id(r) in $ids RETURN id(n), labels(n)[0], id(m), labels(m)[0]`,bindParameters:{ids:d}});n.push(Ue(t,u).then(async c=>{const m=c.resultRowsStream.getReader();for(;;){const{done:g,value:h}=await m.read();if(g)break;for(const E of h)r.push({id:E[0],typeName:E[1]}),r.push({id:E[2],typeName:E[3]})}}))}return await Promise.all(n),r}const D="ESRI__ID",Ce="ESRI__ORIGIN_ID",rt="ESRI__DESTINATION_ID",O="ESRI__LAYOUT_GEOMETRY",ce=12,Qt=Ee.getLogger("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager");let te=class extends ke{constructor(t){var i,n,a;super(t),this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.memberIdTypeLookup=new Map,this._processingCacheUpdatesLookup=new Map;const r=new Map;(i=t.knowledgeGraph.dataModel.entityTypes)==null||i.forEach(o=>{var s,d;o.name&&(r.set(o.name,"entity"),this._processingCacheUpdatesLookup.set(o.name,[]),t.inclusionModeDefinition&&!((s=t.inclusionModeDefinition)!=null&&s.generateAllSublayers)||this.entityTypeNames.add(o.name),(d=o.properties)==null||d.forEach(u=>{u.geometryType&&u.geometryType!=="esriGeometryNull"&&this.geographicLookup.set(o.name,{name:u.name??"",geometryType:u.geometryType})}))}),(n=t.knowledgeGraph.dataModel.relationshipTypes)==null||n.forEach(o=>{var s,d;o.name&&(r.set(o.name,"relationship"),this._processingCacheUpdatesLookup.set(o.name,[]),t.inclusionModeDefinition&&!((s=t.inclusionModeDefinition)!=null&&s.generateAllSublayers)||this.relationshipTypeNames.add(o.name),(d=o.properties)==null||d.forEach(u=>{u.geometryType&&u.geometryType!=="esriGeometryNull"&&this.geographicLookup.set(o.name,{name:u.name??"",geometryType:u.geometryType})}))}),(a=t.inclusionModeDefinition)==null||a.namedTypeDefinitions.forEach((o,s)=>{var u,c;if(r.get(s)==="entity")this.entityTypeNames.add(s);else{if(r.get(s)!=="relationship")return Qt.warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void((u=t.inclusionModeDefinition)==null?void 0:u.namedTypeDefinitions.delete(s));this.relationshipTypeNames.add(s)}const d=new Map;(c=o.members)==null||c.forEach(m=>{this.memberIdTypeLookup.set(m.id,s);const g=this.getById(m.id);g&&d.set(m.id,g)}),this.sublayerCaches.set(s,d)})}addToLayer(t){t.forEach(({typeName:r,id:i})=>{if(!this.inclusionModeDefinition)throw new _("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(r)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(r)){const n=this.inclusionModeDefinition.namedTypeDefinitions.get(r);n.members||(n.members=new Map),n.members.set(i,{id:i}),this.memberIdTypeLookup.set(i,r)}}else{const n=new Map;n.set(i,{id:i}),this.inclusionModeDefinition.namedTypeDefinitions.set(r,{useAllData:!1,members:n}),this.memberIdTypeLookup.set(i,r)}})}getById(t){return Ke.getInstance().readFromStoreById(t)}async getData(t,r,i){var a,o;if(r.objectType.name&&((a=this.inclusionModeDefinition)!=null&&a.namedTypeDefinitions)&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(r.objectType.name))return[];let n;if(n=t||new ge({where:"1=1",outFields:["*"]}),r.parentCompositeLayer.type==="link-chart"){const s=r.parentCompositeLayer,d=this._processingCacheUpdatesLookup.get(r.objectType.name??""),u=n.outFields,c=n.geometry;let m="",g="";c&&c.extent&&(m=ue(c.extent.ymin,c.extent.xmin,ce),g=ue(c.extent.ymax,c.extent.xmax,ce)),u&&u.length===1&&u[0]===D&&n.where==="1=1"||await Promise.all(d??[]);const h=this.sublayerCaches.has(r.objectType.name??"")?Array.from((o=this.sublayerCaches.get(r.objectType.name))==null?void 0:o.values()):[],E=[];return h.forEach(w=>{if(w.geometry=s.linkChartDiagramLookup.get(w.attributes[r.objectIdField]),w.attributes[O]=w.geometry,m&&g){const y=s.linkChartGeohashLookup.get(w.attributes[r.objectIdField]);y?y>=m&&y<=g&&E.push(w):E.push(w)}else E.push(w)}),E}return this.retrieveDataFromService(n,r,i)}async getConnectedRecordIds(t){const r=[],i=[],n=new Map;return t.forEach(a=>{var o;if(this.memberIdTypeLookup.has(a)){const s=this.memberIdTypeLookup.get(a);if(!this.entityTypeNames.has(s))return;n.has(s)?(o=n.get(s))==null||o.push(a):n.set(s,[a])}}),n.forEach((a,o)=>{const s=`MATCH (n:${o})-[r]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`,d=new Promise(u=>{(async()=>{const c=(await Ue(this.knowledgeGraph,new Le({openCypherQuery:s,bindParameters:{ids:a}}))).resultRowsStream.getReader();try{for(;;){const{done:m,value:g}=await c.read();if(m)break;for(let h=0;h{u()})});i.push(d)}),await Promise.all(i),r}async refreshCacheContent(t,r,i,n=!0){var u,c,m,g,h,E,w;const a=Ke.getInstance(),o=[],s=new Map,d=new Map;(u=this.knowledgeGraph.dataModel.entityTypes)==null||u.forEach(y=>{y.name&&d.set(y.name,y)}),(c=this.knowledgeGraph.dataModel.relationshipTypes)==null||c.forEach(y=>{y.name&&d.set(y.name,y)}),t||this.inclusionModeDefinition?t?t.forEach(y=>{var b;if(this.memberIdTypeLookup.has(y)){const I=this.memberIdTypeLookup.get(y);s.has(I)?(b=s.get(I))==null||b.push(y):s.set(I,[y])}}):(g=(m=this.inclusionModeDefinition)==null?void 0:m.namedTypeDefinitions)==null||g.forEach((y,b)=>{y.useAllData?s.set(b,null):y.members&&y.members.forEach(I=>{var Q;s.has(b)&&s.get(b)!==null?(Q=s.get(b))==null||Q.push(I.id):s.set(b,[I.id])})}):((h=this.knowledgeGraph.dataModel.entityTypes)==null||h.forEach(y=>{y.name&&s.set(y.name,null)}),(E=this.knowledgeGraph.dataModel.entityTypes)==null||E.forEach(y=>{y.name&&s.set(y.name,null)}));for(const[y,b]of s){const I=new Promise(Q=>{(async()=>{var K,M,S,B,Me,N,C;const J=new Set,X=[];let f,x="",L=!1;if(r||((M=(K=d.get(y))==null?void 0:K.properties)==null||M.forEach(G=>{G.name&&J.add(G.name)})),i&&this.geographicLookup.has(y)){const G=(S=this.geographicLookup.get(y))==null?void 0:S.name;G&&J.add(G)}if(this.entityTypeNames.has(y))x=`MATCH (n:${y}) ${b?"WHERE id(n) IN $ids ":""}return ID(n)`,J.forEach(G=>{x+=`, n.${G}`,X.push(G)});else{if(!this.relationshipTypeNames.has(y))throw new _("knowledge-graph:layer-data-manager",`The graph type of ${y} could not be determined. Was this type set in the KG data model and inclusion definition?`);L=!0,x=`MATCH ()-[n:${y}]->() ${b?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,J.forEach(G=>{x+=`, n.${G}`,X.push(G)})}f=new Le(b?{openCypherQuery:x,bindParameters:{ids:b}}:{openCypherQuery:x});const ee=(await Ue(this.knowledgeGraph,f)).resultRowsStream.getReader();for(;;){const{done:G,value:U}=await ee.read();if(G)break;const z=[];for(let v=0;vnew Set).add(ie.id),Rt(this.nodeConnectionsLookup,ie.destinationId,()=>new Set).add(ie.id));A{var T,A;j==null||j.set(v.attributes[D],v),n&&!((T=this.inclusionModeDefinition)!=null&&T.namedTypeDefinitions.get(y).members.has(v.attributes[D]))&&((A=this.inclusionModeDefinition)==null||A.namedTypeDefinitions.get(y).members.set(v.attributes[D],{id:v.attributes[D]}),this.memberIdTypeLookup.set(v.attributes[D],y))})}})().then(()=>{Q(null)})});o.push(I),(w=this._processingCacheUpdatesLookup.get(y))==null||w.push(I)}await Promise.all(o)}removeFromLayer(t){var n;const r=new Set,i=new Set(t.map(a=>a.id));for(const a of t)r.add(a.typeName),this.memberIdTypeLookup.delete(a.id),(n=this.inclusionModeDefinition)==null||n.namedTypeDefinitions.forEach(o=>{var s;(s=o.members)!=null&&s.has(a.id)&&o.members.delete(a.id)});r.forEach(a=>{var o;(o=this.sublayerCaches.get(a))==null||o.forEach((s,d)=>{var u;i.has(d)&&((u=this.sublayerCaches.get(a))==null||u.delete(d))})})}async retrieveDataFromService(t,r,i){var w,y,b,I,Q,k,J,X,f,x,L,ee,K,M,S,B,Me;const n=Ke.getInstance(),a=new Set,o=[];let s,d="",u=[];const c=r.graphType==="relationship",m=(b=(y=(w=this.inclusionModeDefinition)==null?void 0:w.namedTypeDefinitions)==null?void 0:y.get(r.objectType.name))==null?void 0:b.useAllData,g=r.parentCompositeLayer.sublayerIdsCache.get(r.objectType.name);let h=!m&&g?Array.from(g).sort():null;if((k=(Q=(I=this.inclusionModeDefinition)==null?void 0:I.namedTypeDefinitions)==null?void 0:Q.get(r.objectType.name))!=null&&k.useAllData)(f=(X=(J=this.inclusionModeDefinition)==null?void 0:J.namedTypeDefinitions)==null?void 0:X.get(r.objectType.name))!=null&&f.useAllData&&t.objectIds!=null&&(h=t.objectIds);else if(t.objectIds!=null&&h&&h.length>0){const N=t.objectIds;t.objectIds=h.filter(C=>N.includes(C))}else if(t.objectIds!=null)h=t.objectIds;else{if((x=this.inclusionModeDefinition)!=null&&x.namedTypeDefinitions.has(r.objectType.name)&&(!((L=this.inclusionModeDefinition.namedTypeDefinitions.get(r.objectType.name))!=null&&L.members)||((K=(ee=this.inclusionModeDefinition.namedTypeDefinitions.get(r.objectType.name))==null?void 0:ee.members)==null?void 0:K.size)<1))return t.objectIds=[],[];t.objectIds=h}if(t.outFields!=null){const N=t.outFields;N.includes("*")?r.fields.forEach(C=>{a.add(C.name)}):N.forEach(C=>{C!==D&&C!==r.geometryFieldName&&a.add(C)})}if(t.geometry!=null){const N=t.geometry;let C;const G=r.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,U=G==null?void 0:G.spatialReference,z=(M=G==null?void 0:G.serviceCapabilities)==null?void 0:M.geometryCapabilities;let F=z==null?void 0:z.geometryMaxBoundingRectangleSizeX,j=z==null?void 0:z.geometryMaxBoundingRectangleSizeY;if((S=N==null?void 0:N.extent)!=null&&S.spatialReference&&!((B=N.spatialReference)!=null&&B.isWGS84)?(await Kt(N.extent.spatialReference,De),C=st(N.extent,De)):C=N.extent,F&&j&&U){if(U.wkid!==4326){const v=new Re({spatialReference:U,xmax:F,ymax:j}),T=st(v,De);F=T.xmax,j=T.ymax}if(C.xmax-C.xmin>F)throw new _("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${F}° latitude, limit exceeded`);if(C.ymax-C.ymin>j)throw new _("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${j}° longitude, limit exceeded`)}if(t.where!=null&&t.where!=="1=1"){const v=await Gt(t.where.toUpperCase(),r.fieldsIndex);r.fields.forEach(T=>{v.fieldNames.includes(T.name)&&a.add(T.name)})}d=c?`Match ()-[n:${r.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${r.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${r.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${r.geometryFieldName}) return ID(n)`,r.geometryFieldName&&a.add(r.geometryFieldName),a.forEach(v=>{d+=`, n.${v}`,o.push(v)}),s=new Le({openCypherQuery:d,bindParameters:{param_filter_geom:new Se({rings:bi(C)})}})}else{let N="";if(t.where!=null&&t.where!=="1=1"){const U=await Gt(t.where,r.fieldsIndex);r.fields.forEach(T=>{U.fieldNames.includes(T.name)&&a.add(T.name)});const z=new Set(["column-reference","string","number","binary-expression"]),F=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let j=!1;const v=T=>{if(T.type==="column-reference")return`n.${T.column}`;if(T.type==="string")return`'${T.value}'`;if(T.type==="number")return`${T.value}`;if(T.type==="binary-expression"&&z.has(T.left.type)&&z.has(T.right.type)&&F.has(T.operator))return`${v(T.left)} ${T.operator} ${v(T.right)}`;if(T.type==="binary-expression"&&T.operator==="LIKE"){let A="";if(T.left.type==="function"&&T.left.args.value[0].type==="column-reference")A+=`lower(n.${T.left.args.value[0].column})`;else{if(T.left.type!=="column-reference")return j=!0,"";A+=`lower(n.${T.left.column})`}if(A+=" CONTAINS (",T.right.type!=="string")return j=!0,"";{let W=T.right.value;W.charAt(0)==="%"&&(W=W.slice(1)),W.charAt(W.length-1)==="%"&&(W=W.slice(0,-1)),A+=`'${W.toLowerCase()}')`}return A}return j=!0,""};N=v(U.parseTree),j&&(N="")}let C="";C=c?`Match ()-[n:${r.objectType.name}]->()`:`Match (n:${r.objectType.name})`;let G=!1;h&&(G=!0,C+=" WHERE ID(n) IN $ids"),N&&(C+=G?" AND":" WHERE",C+=` ${N}`),C+=" return ID(n)",c&&(C+=", id(startNode(n)), id(endNode(n))"),t.returnGeometry&&r.geometryFieldName&&a.add(r.geometryFieldName),a.forEach(U=>{C+=`, n.${U}`,o.push(U)}),s=new Le(h?{openCypherQuery:C,bindParameters:{ids:h}}:{openCypherQuery:C})}const E=(await Ue(r.parentCompositeLayer.dataManager.knowledgeGraph,s,i)).resultRowsStream.getReader();for(;;){const{done:N,value:C}=await E.read();if(N)break;const G=[];for(let U=0;U{let t=class extends e{constructor(){super(...arguments),this.fields=[],this.fieldsIndex=null}};return l([p(Ut.fields)],t.prototype,"fields",void 0),l([p(Ut.fieldsIndex)],t.prototype,"fieldsIndex",void 0),t=l([R("esri.layers.knowledgeGraphLayer.KnowledgeGraphSublayerBase")],t),t};let $=class extends Gr(Ei(Zt(Xt(br(er))))){constructor(e){var t,r,i,n,a;if(super(e),this.capabilities=Dr(!1,!1),this.definitionExpression="",this.displayField="",this.elevationInfo=null,this.geometryType=null,this.geometryFieldName=null,this.graphType=null,this.hasM=!1,this.hasZ=!1,this.labelsVisible=null,this.labelingInfo=null,this.objectIdField=D,this.objectType=null,this.parentCompositeLayer=null,this.popupTemplate=null,this.source={openPorts:()=>this.load().then(()=>{const o=new MessageChannel;return new Tr(o.port1,{channel:o,client:{queryFeatures:(s,d={})=>{const u=ge.fromJSON(s);return this.queryFeaturesJSON(u,d)}}}),[o.port2]})},this.type="knowledge-graph-sublayer",e.parentCompositeLayer.type==="link-chart")e.graphType==="relationship"?this.geometryType="polyline":this.geometryType="point",this.geometryFieldName=O;else if((t=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name))!=null&&t.geometryType&&((r=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name))==null?void 0:r.geometryType)!=="esriGeometryNull"){const o=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name);this.geometryFieldName=(o==null?void 0:o.name)??null,this.geometryType=o!=null&&o.geometryType?me.fromJSON(o.geometryType):null;const s=o==null?void 0:o.name,d=s?(i=e.objectType.properties)==null?void 0:i[s]:null;d?(this.hasM=d.hasM??!1,this.hasZ=d.hasZ??!1):(this.hasM=!1,this.hasZ=!1)}else this.geometryType=null;(n=e.objectType.properties)==null||n.forEach(o=>{let s=null,d=o.fieldType;d==="esriFieldTypeOID"&&(d="esriFieldTypeInteger"),this.fields.push(St.fromJSON({name:o.name,type:d,alias:o.alias,defaultValue:s,editable:o.editable,nullable:o.nullable}))}),this.fields.push(St.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1})),this._set("fields",[...this.fields]),(a=e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel)!=null&&a.spatialReference&&(this.spatialReference=e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel.spatialReference),e.parentCompositeLayer.type==="link-chart"?e.graphType==="relationship"?this.renderer=We(Ve(me.toJSON("polyline")).renderer):this.renderer=We(Ve(me.toJSON("point")).renderer):this.renderer=We(Ve(me.toJSON(this.geometryType)).renderer)}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Er(e,this.fieldsIndex),this._set("renderer",e)}createPopupTemplate(e){return kr(this,e)}createQuery(){return new ge({where:"1=1",outFields:["*"]})}getField(e){for(let t=0;t{a.sourceLayer=this}),n}async queryFeaturesJSON(e,t){const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return await i.executeQuery(r.toJSON(),t==null?void 0:t.signal)}async queryFeatureCount(e,t){const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return i.executeQueryForCount(r.toJSON(),t==null?void 0:t.signal)}async queryExtent(e={},t){var s,d,u,c;const r={...e,returnGeometry:!0},{resolvedQuery:i,queryEngine:n}=await this._setupQueryObjects(r),a=await n.executeQueryForExtent(i.toJSON(),t==null?void 0:t.signal);let o;return o=((s=a.extent)==null?void 0:s.xmin)!=null&&((d=a.extent)==null?void 0:d.xmax)!=null&&((u=a.extent)==null?void 0:u.ymin)!=null&&((c=a.extent)==null?void 0:c.ymax)!=null?new Re(a.extent):new Re,{count:a.count,extent:o}}async queryObjectIds(e,t){const r=ge.from(e);let i;if(this.parentCompositeLayer.type==="link-chart"&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const n=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(n)}return i.executeQueryForIds(r.toJSON(),t==null?void 0:t.signal)}loadQueryEngine(e){const t=new Lr({geometryType:me.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new vr({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:me.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:null,featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new ge({where:"1=1",outFields:[D]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}async _setupQueryObjects(e,t){var a;const r=ge.from(e),i=r.geometry;let n;if(i&&!((a=i.spatialReference)!=null&&a.isWGS84)&&(await Kt(i.spatialReference,De),r.geometry=st(i instanceof Se||i instanceof ye?i:i.extent,De)),this.parentCompositeLayer.type==="link-chart"&&this._cachedQueryEngine)n=this._cachedQueryEngine;else{const o=await this.parentCompositeLayer.dataManager.getData(r,this,t);n=this.loadQueryEngine(o)}return{resolvedQuery:r,queryEngine:n}}};l([p()],$.prototype,"capabilities",void 0),l([p({readOnly:!0})],$.prototype,"defaultPopupTemplate",null),l([p()],$.prototype,"definitionExpression",void 0),l([p()],$.prototype,"displayField",void 0),l([p()],$.prototype,"elevationInfo",void 0),l([p()],$.prototype,"geometryType",void 0),l([p()],$.prototype,"geometryFieldName",void 0),l([p()],$.prototype,"graphType",void 0),l([p()],$.prototype,"hasM",void 0),l([p()],$.prototype,"hasZ",void 0),l([p()],$.prototype,"labelsVisible",void 0),l([p()],$.prototype,"labelingInfo",void 0),l([p()],$.prototype,"objectIdField",void 0),l([p()],$.prototype,"objectType",void 0),l([p()],$.prototype,"parentCompositeLayer",void 0),l([p({type:xr,json:{name:"popupInfo",write:!0}})],$.prototype,"popupTemplate",void 0),l([p({types:Cr,json:{write:{target:"layerDefinition.drawingInfo.renderer"}}})],$.prototype,"renderer",null),l([p()],$.prototype,"source",void 0),l([p({json:{read:!1}})],$.prototype,"type",void 0),$=l([R("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],$);const it=$;let nt,H=null;function ki(){return nt||(nt=at(()=>import("./lclayout-28FIPR98.js"),__vite__mapDeps([4,1,2])).then(e=>e.l).then(({default:e})=>e({locateFile:t=>ot(`esri/libs/linkchartlayout/${t}`)})).then(e=>{Mi(e)}),nt)}function Mi(e){H=e}var re;function fe(e,t,r,i,n,a){const o=r.length,s=n.length,d=Float64Array.BYTES_PER_ELEMENT,u=Uint32Array.BYTES_PER_ELEMENT,c=Uint8Array.BYTES_PER_ELEMENT,m=16,g=m-1+o*(c+2*d)+s*(2*u),h=H._malloc(g);try{const E=h+m-h%m,w=E+o*d,y=w+o*d,b=y+s*u,I=b+s*u,Q=()=>[H.HEAPF64.subarray(E>>3,(E>>3)+o),H.HEAPF64.subarray(w>>3,(w>>3)+o),H.HEAPU32.subarray(y>>2,(y>>2)+s),H.HEAPU32.subarray(b>>2,(b>>2)+s),H.HEAPU8.subarray(I,I+o)],[k,J,X,f,x]=Q();k.set(r),J.set(i),X.set(n),f.set(a),x.set(t);const L=e(o,I,E,w,s,y,b),[ee,K,M,S,B]=Q();return r.set(ee),i.set(K),n.set(M),a.set(S),t.set(B),L}finally{H._free(h)}}(function(e){e[e.None=0]="None",e[e.IsMovable=1]="IsMovable",e[e.IsGeographic=2]="IsGeographic",e[e.IsRoot=4]="IsRoot"})(re||(re={}));const qt=2,Yt=1,Bt=-1;var mt,ft,gt,wt,_t,bt,Ht,Jt;(function(e){function t(){return H.getMinIdealEdgeLength()}function r(i,n,a,o,s,d=qt,u=Yt,c=Bt){return fe((m,g,h,E,w,y,b)=>H.applyForceDirectedLayout(m,g,h,E,w,y,b,d,u,c),i,n,a,o,s)}e.getMinIdealEdgeLength=t,e.apply=r})(mt||(mt={})),function(e){function t(r,i,n,a,o,s=qt,d=Yt,u=Bt){return fe((c,m,g,h,E,w,y)=>H.applyCommunityLayout(c,m,g,h,E,w,y,s,d,u),r,i,n,a,o)}e.apply=t}(ft||(ft={})),function(e){function t(r,i,n,a,o){return fe(H.applySimpleLayout,r,i,n,a,o)}e.apply=t}(gt||(gt={})),function(e){function t(r,i,n,a,o){return fe(H.applyHierarchicalLayout,r,i,n,a,o)}e.apply=t}(wt||(wt={})),function(e){function t(r,i,n,a,o){return fe(H.applyRadialTreeLayout,r,i,n,a,o)}e.apply=t}(_t||(_t={})),function(e){function t(r,i,n,a,o){return fe(H.applySmartTreeLayout,r,i,n,a,o)}e.apply=t}(bt||(bt={})),function(e){e[e.Undirected=0]="Undirected",e[e.Directed=1]="Directed",e[e.Reversed=2]="Reversed"}(Ht||(Ht={})),function(e){e[e.ByCC_Raw=0]="ByCC_Raw",e[e.ByCC_NormalizeGlobally=1]="ByCC_NormalizeGlobally",e[e.ByCC_NormalizeByCC=2]="ByCC_NormalizeByCC"}(Jt||(Jt={}));const xi=(e,t,r)=>(e.has(t)||e.set(t,r()),e.get(t));let Y=class extends Zt(Xt(er)){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE",xScaleFactor:1,yScaleFactor:1},this._graphTypeLookup=new Map,this.knowledgeGraph=null,this.layers=new Nt,this.linkChartDiagramLookup=new Map,this.linkChartExtent=new Re({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.linkChartGeohashLookup=new Map,this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new Nt,this.type="link-chart",this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new _("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){var a,o,s,d,u,c;if(!this.title&&this.url){const m=this.url.split("/");this.title=m[m.length-2]}const t=new Set;let r=[],i=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new _("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");(a=e.knowledgeGraph.dataModel.entityTypes)==null||a.forEach(m=>{m.name&&this._graphTypeLookup.set(m.name,m)}),(o=e.knowledgeGraph.dataModel.relationshipTypes)==null||o.forEach(m=>{m.name&&this._graphTypeLookup.set(m.name,m)}),(s=e.inclusionModeDefinition)!=null&&s.generateAllSublayers?(r=e.knowledgeGraph.dataModel.entityTypes??[],i=e.knowledgeGraph.dataModel.relationshipTypes??[]):(d=e.inclusionModeDefinition)!=null&&d.namedTypeDefinitions&&((u=e.inclusionModeDefinition)==null?void 0:u.namedTypeDefinitions.size)>0?(c=e.inclusionModeDefinition)==null||c.namedTypeDefinitions.forEach((m,g)=>{var h,E;if(!this._graphTypeLookup.get(g))return Ee.getLogger(this).warn(`A named type, ${g}, was in the inclusion list that wasn't in the data model and will be removed`),void((h=e.inclusionModeDefinition)==null?void 0:h.namedTypeDefinitions.delete(g));this._graphTypeLookup.get(g)instanceof kt||"strictOrigin"in this._graphTypeLookup.get(g)?t.has(g)||(t.add(g),i.push(this._graphTypeLookup.get(g))):this._graphTypeLookup.get(g)instanceof Et||"properties"in this._graphTypeLookup.get(g)?t.has(g)||(t.add(g),r.push(this._graphTypeLookup.get(g))):(Ee.getLogger(this).warn(`A named type, ${g}, was in the inclusion list that wasn't properly modeled and will be removed`),(E=e.inclusionModeDefinition)==null||E.namedTypeDefinitions.delete(g))}):(r=e.knowledgeGraph.dataModel.entityTypes??[],i=e.knowledgeGraph.dataModel.relationshipTypes??[]);const n=new te({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=r,this.memberRelationshipTypes=i,this.dataManager=n}load(e){return this.addResolvingPromise(new Promise(t=>{hi(this.url).then(r=>{var i,n,a,o,s,d;if(this._initializeLayerProperties({knowledgeGraph:r,inclusionModeDefinition:this._originalInclusionList}),(n=(i=this.dataManager.inclusionModeDefinition)==null?void 0:i.namedTypeDefinitions)!=null&&n.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},(a=this.dataManager.knowledgeGraph.dataModel.entityTypes)==null||a.forEach(u=>{var c;u.name&&((c=this.dataManager.inclusionModeDefinition)==null||c.namedTypeDefinitions.set(u.name,{useAllData:!0}))}),(o=this.dataManager.knowledgeGraph.dataModel.relationshipTypes)==null||o.forEach(u=>{var c;u.name&&((c=this.dataManager.inclusionModeDefinition)==null||c.namedTypeDefinitions.set(u.name,{useAllData:!0}))})),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),(s=this.dataManager.inclusionModeDefinition)==null||s.namedTypeDefinitions.forEach(u=>{var c;u.useAllData=!1,(c=u.members)==null||c.forEach(m=>{let g;g=m.linkChartLocation instanceof $t?m.linkChartLocation:m.linkChartLocation?le(m.linkChartLocation):null,this.linkChartDiagramLookup.set(m.id,g),g&&g.coords.length===2&&g.lengths.length===0?this.linkChartGeohashLookup.set(m.id,ue(g.coords[1],g.coords[0],ce)):this.linkChartGeohashLookup.set(m.id,"")}),this.addResolvingPromise(this._initializeDiagram().then(async()=>{this.layers.forEach(async m=>{await m.refreshCachedQueryEngine()}),this.tables.forEach(async m=>{await m.refreshCachedQueryEngine()})}))});else{const u=((d=this.defaultLinkChartConfig)==null?void 0:d.layoutMode)==="GEOGRAPHIC";this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,u,!0).then(async()=>{Ir(e);const c=[],m=[];this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach(g=>{g.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach(g=>{m.push(g.refreshCachedQueryEngine()),c.push(new Promise(h=>{g.on("layerview-create",()=>{h(null)})}))}),this.tables.forEach(g=>{m.push(g.refreshCachedQueryEngine())}),await Promise.all(m)}))}t(null)})})),Promise.resolve(this)}async addRecords(e,t){let r=[];t!=null&&t.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(r=await Ti(e,this.dataManager.knowledgeGraph));const i=e.concat(r).filter(n=>{var a;return!((a=this.sublayerIdsCache.get(n.typeName))!=null&&a.has(n.id))});await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:r=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){var a,o,s,d,u,c,m,g;let i=[];for(const h of e)((s=(o=(a=this.dataManager.inclusionModeDefinition)==null?void 0:a.namedTypeDefinitions)==null?void 0:o.get(h.typeName))==null?void 0:s.useAllData)===!1&&((m=(c=(u=(d=this.dataManager.inclusionModeDefinition)==null?void 0:d.namedTypeDefinitions)==null?void 0:u.get(h.typeName))==null?void 0:c.members)!=null&&m.has(h.id))&&i.push(h);if(t){const h=new Set,E=[];for(const w of i)if(this.dataManager.nodeConnectionsLookup.has(w.id))for(const y of this.dataManager.nodeConnectionsLookup.get(w.id))h.add(y);for(const w of h)this.dataManager.memberIdTypeLookup.has(w)&&E.push({id:w,typeName:this.dataManager.memberIdTypeLookup.get(w)});i=i.concat(E)}this.dataManager.removeFromLayer(i);for(const h of i)(g=this.sublayerIdsCache.get(h.typeName))==null||g.delete(h.id),this.linkChartDiagramLookup.delete(h.id);r&&await this.calculateLinkChartLayout(this._currentLinkChartConfig.layoutMode,{xScaleFactor:this._currentLinkChartConfig.xScaleFactor,yScaleFactor:this._currentLinkChartConfig.xScaleFactor});const n=[];return this.layers.forEach(h=>{n.push(h.refreshCachedQueryEngine())}),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e){const t=await this.dataManager.getConnectedRecordIds(e),r=t.filter(i=>{var n;return!((n=this.sublayerIdsCache.get(i.typeName))!=null&&n.has(i.id))});return await this._handleNewRecords(t),{records:r}}loadLayerAssumingLocalCache(){var e,t;this.memberRelationshipTypes.forEach(r=>{const i=new it({objectType:r,parentCompositeLayer:this,graphType:"relationship",title:r.name});i.geometryType?this.layers.push(i):this.tables.push(i),this.dataManager.sublayerCaches.has(r.name)||this.dataManager.sublayerCaches.set(r.name,new Map)}),this.memberEntityTypes.forEach(r=>{const i=new it({objectType:r,parentCompositeLayer:this,graphType:"entity",title:r.name});i.geometryType?this.layers.push(i):this.tables.push(i),this.dataManager.sublayerCaches.has(r.name)||this.dataManager.sublayerCaches.set(r.name,new Map)}),(e=this.dataManager.inclusionModeDefinition)!=null&&e.namedTypeDefinitions&&((t=this.dataManager.inclusionModeDefinition)==null||t.namedTypeDefinitions.forEach((r,i)=>{var a;const n=xi(this.sublayerIdsCache,i,()=>new Set);(a=r.members)==null||a.forEach(o=>{if(n.add(o.id),o.linkChartLocation)if(o.linkChartLocation instanceof $t)this.linkChartDiagramLookup.set(o.id,o.linkChartLocation),o.linkChartLocation.coords.length===2&&o.linkChartLocation.lengths.length===0?this.linkChartGeohashLookup.set(o.id,ue(o.linkChartLocation.coords[1],o.linkChartLocation.coords[0],ce)):this.linkChartGeohashLookup.set(o.id,"");else{const s=le(o.linkChartLocation);this.linkChartDiagramLookup.set(o.id,o.linkChartLocation?s:null),"x"in o.linkChartLocation&&"y"in o.linkChartLocation?this.linkChartGeohashLookup.set(o.id,ue(o.linkChartLocation.x,o.linkChartLocation.y,ce)):this.linkChartGeohashLookup.set(o.id,"")}})}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const r=[],i=[];this.dataManager.sublayerCaches.forEach((f,x)=>{this.dataManager.entityTypeNames.has(x)?f.forEach(L=>{r.push({typeName:x,feature:L})}):this.dataManager.relationshipTypeNames.has(x)&&f.forEach(L=>{i.push({typeName:x,feature:L})})}),this.linkChartDiagramLookup=new Map;const n=new Map,a=new Map,o=new Map,s=new Map,d=new Uint8Array(r.length),u=new Float64Array(r.length),c=new Float64Array(r.length),m=new Uint32Array(i.length),g=new Uint32Array(i.length),h=[],E="FORCE_DIRECTED",w=(t==null?void 0:t.xScaleFactor)??1,y=(t==null?void 0:t.yScaleFactor)??1,b=new Re({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let I,Q="FORCE_DIRECTED",k=0,J=0;switch(Q=e==="GEOGRAPHIC"?E:e,Q){case"FORCE_DIRECTED":I=mt.apply;break;case"COMMUNITY":I=ft.apply;break;case"HIERARCHICAL":I=wt.apply;break;case"RADIAL_TREE":I=_t.apply;break;case"SMART_TREE":I=bt.apply;break;default:I=gt.apply}r.forEach(({typeName:f,feature:x})=>{var L,ee,K;if((L=t==null?void 0:t.lockedNodeLocations)!=null&&L.has(x.attributes[D])){e==="GEOGRAPHIC"&&this.dataManager.geographicLookup.has(f)?d[k]=re.IsGeographic:d[k]=re.None;const M=t.lockedNodeLocations.get(x.attributes[D]);u[k]=M.x,c[k]=M.y}else if(e==="GEOGRAPHIC"&&this.dataManager.geographicLookup.has(f)){d[k]=re.IsGeographic;let M=null;const S=x.attributes[this.dataManager.geographicLookup.get(f).name];switch((ee=this.dataManager.geographicLookup.get(f))==null?void 0:ee.geometryType){case"esriGeometryPoint":u[k]=S==null?void 0:S.x,c[k]=S==null?void 0:S.y;break;case"esriGeometryPolygon":M=S==null?void 0:S.centroid,(M==null?void 0:M.x)!=null&&(M==null?void 0:M.y)!=null?(u[k]=M.x,c[k]=M.y):d[k]=re.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":M=(K=S==null?void 0:S.extent)==null?void 0:K.center,(M==null?void 0:M.x)!=null&&(M==null?void 0:M.y)!=null?(u[k]=M.x,c[k]=M.y):d[k]=re.IsMovable;break;default:d[k]=re.IsMovable}(u[k]==null||c[k]==null||Number.isNaN(u[k])||Number.isNaN(c[k]))&&(d[k]=re.IsMovable,u[k]=0,c[k]=0)}else d[k]=re.IsMovable,u[k]=0,c[k]=0;s.set(x.attributes[D],k),h[k]={feature:x,typeName:f},k++});let X=!1;if(i.forEach(f=>{const x=s.get(f.feature.attributes[Ce]),L=s.get(f.feature.attributes[rt]);x!==void 0&&L!==void 0?(m[J]=x,g[J]=L,J++):(X=!0,this.linkChartDiagramLookup.set(f.feature.attributes[Ce],null),this.linkChartGeohashLookup.set(f.feature.attributes[Ce],null))}),X&&Ee.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null"),await ki(),!I(d,u,c,m,g))throw new _("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let f=0;f84.9999&&(c[f]=84.9999),c[f]<-84.9999&&(c[f]=-84.9999),u[f]>179.9999&&(u[f]=179.9999),u[f]<-179.9999&&(u[f]=-179.9999),h[f].feature.attributes[O]=new Ge(u[f],c[f]),n.has(h[f].typeName)){const L=n.get(h[f].typeName);L==null||L.set(h[f].feature.attributes[D],h[f].feature)}else{const L=new Map;L.set(h[f].feature.attributes[D],h[f].feature),n.set(h[f].typeName,L)}o.set(h[f].feature.attributes[D],h[f].feature);const x=le(h[f].feature.attributes[O]);this.linkChartDiagramLookup.set(h[f].feature.attributes[D],h[f].feature.attributes[O]?x:null),this.linkChartGeohashLookup.set(h[f].feature.attributes[D],ue(h[f].feature.attributes[O].y,h[f].feature.attributes[O].x,ce)),h[f].feature.attributes[O].xb.xmax&&(b.xmax=h[f].feature.attributes[O].x),h[f].feature.attributes[O].yb.ymax&&(b.ymax=h[f].feature.attributes[O].y)}return this.linkChartExtent.xmin=b.xmin,this.linkChartExtent.xmax=b.xmax,this.linkChartExtent.ymin=b.ymin,this.linkChartExtent.ymax=b.ymax,i.forEach(f=>{var M,S;const x=(M=h[s.get(f.feature.attributes[Ce])])==null?void 0:M.feature.attributes[O],L=(S=h[s.get(f.feature.attributes[rt])])==null?void 0:S.feature.attributes[O];if(!x||!L)return;const ee=new ye({paths:[[x.x,x.y],[L.x,L.y]]});if(f.feature.attributes[O]=ee,a.has(f.typeName)){const B=a.get(f.typeName);B==null||B.set(f.feature.attributes[D],f.feature)}else{const B=new Map;B.set(f.feature.attributes[D],f.feature),a.set(f.typeName,B)}o.set(f.feature.attributes[D],f.feature);const K=le(f.feature.attributes[O]);this.linkChartDiagramLookup.set(f.feature.attributes[D],f.feature.attributes[O]?K:null),this.linkChartGeohashLookup.set(f.feature.attributes[D],"")}),this._currentLinkChartConfig={layoutMode:e,xScaleFactor:w,yScaleFactor:y},{nodes:n,links:a,idMap:o}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const r=[];await this.calculateLinkChartLayout(e,t),this.layers.forEach(i=>{r.push(i.refreshCachedQueryEngine())}),await Promise.all(r),this._refreshNamedTypes()}getCurrentNodeLocations(){var t,r;const e=new Map;return(r=(t=this.dataManager.inclusionModeDefinition)==null?void 0:t.namedTypeDefinitions)==null||r.forEach(i=>{var n;(n=i==null?void 0:i.members)==null||n.forEach(a=>{const o=a.linkChartLocation;let s;const d=a.id;o&&(s="x"in o?{x:o.x,y:o.y}:{x:o.coords[0],y:o.coords[1]},e.set(d,new Ge({x:s.x,y:s.y})))})}),e}async synchronizeInclusionListWithCache(){return new Promise(e=>{var t;(t=this.dataManager.inclusionModeDefinition)==null||t.namedTypeDefinitions.forEach((r,i)=>{if(r.useAllData=!1,r.members&&r.members.size>0){if(!this.dataManager.sublayerCaches.get(i))return;const n=new Set(Array.from(this.dataManager.sublayerCaches.get(i).keys()));Array.from(r.members.keys()).filter(a=>!n.has(a)).forEach(a=>{var o;(o=r.members)==null||o.delete(a)})}}),e()})}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach(r=>{t.push(r.refreshCachedQueryEngine())}),await Promise.all(t),this._refreshNamedTypes()}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const r of e)this.sublayerIdsCache.has(r.typeName)||(this.sublayerIdsCache.set(r.typeName,new Set),t.push(r.typeName)),this.sublayerIdsCache.get(r.typeName).add(r.id);for(const r of t)if(this._graphTypeLookup.has(r)){const i=this._graphTypeLookup.get(r),n="endPoints"in i?"relationship":"entity",a=new it({objectType:i,parentCompositeLayer:this,graphType:n,title:r});n==="entity"?this.dataManager.entityTypeNames.add(r):this.dataManager.relationshipTypeNames.add(r),a.geometryType?this.layers.push(a):this.tables.push(a),this.dataManager.sublayerCaches.set(r,new Map)}await this.dataManager.refreshCacheContent(e.map(r=>r.id)),await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,{xScaleFactor:this._currentLinkChartConfig.xScaleFactor,yScaleFactor:this._currentLinkChartConfig.xScaleFactor})}async _initializeDiagram(){var e,t;this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?((t=(e=this.dataManager.inclusionModeDefinition)==null?void 0:e.namedTypeDefinitions)==null||t.forEach(r=>{var i;(i=r==null?void 0:r.members)==null||i.forEach(n=>{const a=n.linkChartLocation;let o;const s=n.id;if(!a)return;o="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const d=le(o);this.linkChartDiagramLookup.set(s,d),this.linkChartGeohashLookup.set(s,ue(o.x,o.y,ce)),this.linkChartExtent.xmin>o.x&&(this.linkChartExtent.xmin=o.x),this.linkChartExtent.xmaxo.y&&(this.linkChartExtent.ymin=o.y),this.linkChartExtent.ymax{var i;r.name&&((i=this.dataManager.sublayerCaches.get(r.name))==null||i.forEach(n=>{const a=this.linkChartDiagramLookup.get(n.attributes[Ce]),o=this.linkChartDiagramLookup.get(n.attributes[rt]);if(a&&o){const s=le(new ye({paths:[[a.coords[0],a.coords[1]],[o.coords[0],o.coords[1]]]}));this.linkChartDiagramLookup.set(n.attributes[D],s)}else this.linkChartDiagramLookup.set(n.attributes[D],null);this.linkChartGeohashLookup.set(n.attributes[D],"")}))})):await this.calculateLinkChartLayout(this.defaultLinkChartConfig.layoutMode,{xScaleFactor:this.defaultLinkChartConfig.xScaleFactor,yScaleFactor:this.defaultLinkChartConfig.yScaleFactor,lockedNodeLocations:this.getCurrentNodeLocations()}):await this.calculateLinkChartLayout("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}};l([p()],Y.prototype,"dataPreloadedInLocalCache",void 0),l([p()],Y.prototype,"defaultLinkChartConfig",void 0),l([p()],Y.prototype,"dataManager",void 0),l([p()],Y.prototype,"knowledgeGraph",void 0),l([p()],Y.prototype,"layers",void 0),l([p()],Y.prototype,"linkChartDiagramLookup",void 0),l([p()],Y.prototype,"linkChartExtent",void 0),l([p()],Y.prototype,"linkChartGeohashLookup",void 0),l([p()],Y.prototype,"memberEntityTypes",void 0),l([p()],Y.prototype,"memberRelationshipTypes",void 0),l([p()],Y.prototype,"sublayerIdsCache",void 0),l([p()],Y.prototype,"tables",void 0),l([p({json:{read:!1}})],Y.prototype,"type",void 0),Y=l([R("esri.layers.LinkChartLayer")],Y);const dn=Y;export{dn as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/arcgis-knowledge-client-core-simd-VjZZ0mc4.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/arcgis-knowledge-client-core-FOb54Y-y.js","assets/lclayout-28FIPR98.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/LinkChartLayer-uIn6uT3L.js b/dist/assets/LinkChartLayer-uIn6uT3L.js deleted file mode 100644 index 974cf25..0000000 --- a/dist/assets/LinkChartLayer-uIn6uT3L.js +++ /dev/null @@ -1,7 +0,0 @@ -import{eU as le,dy as fr,eZ as Dt,e as l,y as p,c as R,p as ke,dr as se,ar as Wt,dJ as gr,de as at,kj as ot,E as _,ha as Tt,hq as Vt,T as Ge,N as ye,l as Se,Z as Ee,bW as ve,kt as wr,ca as ge,fd as Kt,eV as De,e1 as st,dT as Re,kv as Gt,ld as Rt,ix as _r,dK as Zt,dO as Xt,dL as br,wn as Tr,fe as me,dw as St,wo as We,iF as Er,il as kr,iv as Mr,iM as xr,c7 as er,V as Nt,e_ as $t,s as Cr}from"./index-J0iiHjMT.js";import{p as ue}from"./geohashUtils-U0jvYCSY.js";import{m as Ir}from"./FeatureStore-X-AIJLo2.js";import{W as Lr}from"./QueryEngine-8tLWlkSE.js";import{l as vr,o as Ve}from"./clientSideDefaults-F-CNnR0g.js";import{c as Dr}from"./FeatureReductionLayer-RlitE1N6.js";import{d as Gr}from"./FeatureSet-d4S1oKME.js";import"./BoundsStore-wmwfHjhp.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";const Rr="ESRI__DESTINATION_ID",Sr="ESRI__ORIGIN_ID";let Ke=class pe{constructor(){this._featureLookup=new Map}static getInstance(){return pe.instance||(pe.instance=new pe),pe.instance}static resetInstance(){pe.instance&&(pe.instance=null)}deleteFromStore(t){t.forEach(r=>{this._featureLookup.delete(r)})}readFromStoreByList(t){const r=[];return t.forEach(i=>{const n=this.readFromStoreById(i);n&&r.push(n)}),r}readFromStoreById(t){return this._featureLookup.get(t)??null}writeToStore(t,r,i){const n=[];return t.forEach(a=>{if(!(a!=null&&a.id))return;a.properties||(a.properties=[]);let o,s=null;if(i&&a.properties[i]&&(s=le(a.properties[i])),"originId"in a&&"destinationId"in a&&(a.properties[Sr]=a.originId,a.properties[Rr]=a.destinationId),a.properties[r]=a.id,a.id&&this._featureLookup.has(a.id)&&this._featureLookup.get(a.id).attributes){const d=this._featureLookup.get(a.id),u=JSON.parse(JSON.stringify(Object.assign(d.attributes,a.properties)));i&&a.properties[i]&&(u[i]=fr(a.properties[i])),o=new Dt(s?JSON.parse(JSON.stringify(s)):d!=null&&d.geometry?JSON.parse(JSON.stringify(d.geometry)):null,u,null,a.properties[r])}else o=new Dt(s?JSON.parse(JSON.stringify(s)):null,a.properties,null,a.properties[r]);this._featureLookup.set(a.id,o),n.push(o)}),n}},Pe=class extends ke{constructor(t){super(t),this.resultRows=[]}};l([p()],Pe.prototype,"resultRows",void 0),Pe=l([R("esri.rest.knowledgeGraph.GraphQueryResult")],Pe);const Ft=Pe;let Oe=class extends ke{constructor(t){super(t),this.resultRowsStream=new ReadableStream}};l([p()],Oe.prototype,"resultRowsStream",void 0),Oe=l([R("esri.rest.knowledgeGraph.GraphQueryResult")],Oe);const Pt=Oe;let ae=class extends se{constructor(t){super(t),this.name=null,this.unique=null,this.ascending=null,this.description=null,this.fieldNames=null}};l([p({type:String,json:{write:!0}})],ae.prototype,"name",void 0),l([p({type:Boolean,json:{write:!0}})],ae.prototype,"unique",void 0),l([p({type:Boolean,json:{write:!0}})],ae.prototype,"ascending",void 0),l([p({type:String,json:{write:!0}})],ae.prototype,"description",void 0),l([p({type:[String],json:{write:!0}})],ae.prototype,"fieldNames",void 0),ae=l([R("esri.rest.knowledgeGraph.FieldIndex")],ae);const tr=ae;let q=class extends se{constructor(t){super(t),this.name=null,this.alias=null,this.fieldType=null,this.geometryType=null,this.hasM=null,this.hasZ=null,this.nullable=null,this.editable=null,this.required=null,this.defaultVisibility=null,this.systemMaintained=null,this.role=null,this.defaultValue=null}};l([p({type:String,json:{write:!0}})],q.prototype,"name",void 0),l([p({type:String,json:{write:!0}})],q.prototype,"alias",void 0),l([p({type:String,json:{write:!0}})],q.prototype,"fieldType",void 0),l([p({type:String,json:{write:!0}})],q.prototype,"geometryType",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"hasM",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"hasZ",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"nullable",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"editable",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"required",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"defaultVisibility",void 0),l([p({type:Boolean,json:{write:!0}})],q.prototype,"systemMaintained",void 0),l([p()],q.prototype,"role",void 0),l([p({type:Object,json:{type:String,write:{writer:(e,t)=>{t.defaultValue=e!=null?e.toString():null}}}})],q.prototype,"defaultValue",void 0),q=l([R("esri.rest.knowledgeGraph.GraphProperty")],q);const rr=q;let ne=class extends se{constructor(t){super(t),this.name=null,this.alias=null,this.role=null,this.strict=null,this.properties=null,this.fieldIndexes=null}};l([p({type:String,json:{write:!0}})],ne.prototype,"name",void 0),l([p({type:String,json:{write:!0}})],ne.prototype,"alias",void 0),l([p({type:String,json:{write:!0}})],ne.prototype,"role",void 0),l([p({type:Boolean,json:{write:!0}})],ne.prototype,"strict",void 0),l([p({type:[rr],json:{write:!0}})],ne.prototype,"properties",void 0),l([p({type:[tr],json:{write:!0}})],ne.prototype,"fieldIndexes",void 0),ne=l([R("esri.rest.knowledgeGraph.GraphObjectType")],ne);const ir=ne;let lt=class extends ir{constructor(t){super(t)}};lt=l([R("esri.rest.knowledgeGraph.EntityType")],lt);const Et=lt;let je=class extends ir{constructor(t){super(t),this.endPoints=[]}};l([p()],je.prototype,"endPoints",void 0),je=l([R("esri.rest.knowledgeGraph.RelationshipType")],je);const kt=je;let V=class extends se{constructor(t){super(t),this.timestamp=null,this.spatialReference=null,this.strict=null,this.objectIdField=null,this.globalIdField=null,this.arcgisManaged=null,this.identifierInfo=null,this.searchIndexes=null,this.entityTypes=null,this.relationshipTypes=null}};l([p({type:Date,json:{type:Number,write:{writer:(e,t)=>{t.timestamp=e==null?void 0:e.getTime()}}}})],V.prototype,"timestamp",void 0),l([p({type:Wt,json:{write:!0}})],V.prototype,"spatialReference",void 0),l([p({type:Boolean,json:{write:!0}})],V.prototype,"strict",void 0),l([p({type:String,json:{write:!0}})],V.prototype,"objectIdField",void 0),l([p({type:String,json:{write:!0}})],V.prototype,"globalIdField",void 0),l([p()],V.prototype,"arcgisManaged",void 0),l([p()],V.prototype,"identifierInfo",void 0),l([p()],V.prototype,"searchIndexes",void 0),l([p({type:[Et],json:{write:!0}})],V.prototype,"entityTypes",void 0),l([p({type:[kt],json:{write:!0}})],V.prototype,"relationshipTypes",void 0),V=l([R("esri.rest.knowledgeGraph.DataModel")],V);const nr=V;let P=class extends se{constructor(t){super(t),this.capabilities=[],this.supportsSearch=!1,this.supportedQueryFormats=[],this.allowGeometryUpdates=!1,this.searchMaxRecordCount=null,this.serviceCapabilities=null,this.maxRecordCount=null,this.description="",this.copyrightText="",this.units="",this.spatialReference=null,this.currentVersion=null,this.dateFieldsTimeReference=null,this.serviceItemId="",this.supportsDocuments=!1,this.dataEditingNotSupported=!1,this.schemaEditingNotSupported=!1}};l([p({type:[String],json:{write:!0}})],P.prototype,"capabilities",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"supportsSearch",void 0),l([p({type:[String],json:{write:!0}})],P.prototype,"supportedQueryFormats",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"allowGeometryUpdates",void 0),l([p({type:Number,json:{write:!0}})],P.prototype,"searchMaxRecordCount",void 0),l([p({type:Object,json:{write:!0}})],P.prototype,"serviceCapabilities",void 0),l([p({type:Number,json:{write:!0}})],P.prototype,"maxRecordCount",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"description",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"copyrightText",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"units",void 0),l([p({type:Object,json:{write:!0}})],P.prototype,"spatialReference",void 0),l([p({type:Number,json:{write:!0}})],P.prototype,"currentVersion",void 0),l([p({type:Object,json:{write:!0}})],P.prototype,"dateFieldsTimeReference",void 0),l([p({type:String,json:{write:!0}})],P.prototype,"serviceItemId",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"supportsDocuments",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"dataEditingNotSupported",void 0),l([p({type:Boolean,json:{write:!0}})],P.prototype,"schemaEditingNotSupported",void 0),P=l([R("esri.rest.knowledgeGraph.ServiceDefinition")],P);const ar=P;let we=class extends se{constructor(t){super(t),this.dataModel=null,this.serviceDefinition=null}};l([p({type:String,json:{write:!0}})],we.prototype,"url",void 0),l([p({type:nr,json:{write:!0}})],we.prototype,"dataModel",void 0),l([p({type:ar,json:{write:!0}})],we.prototype,"serviceDefinition",void 0),we=l([R("esri.rest.knowledgeGraph.KnowledgeGraph")],we);const Nr=we,Ot="esri/rest/knowledgeGraph/wasmInterface/";let Ze;async function oe(){const e=Ze;if(e)return e;const t=gr("wasm-simd");return Ze=$r(t),Ze}async function $r(e){if(e){const{default:r}=await at(()=>import("./arcgis-knowledge-client-core-simd-wFoqgd0S.js"),__vite__mapDeps([0,1,2])).then(i=>i.a);return r({locateFile:i=>ot(Ot+i)})}const{default:t}=await at(()=>import("./arcgis-knowledge-client-core-k0_SaRI-.js"),__vite__mapDeps([3,1,2])).then(r=>r.a);return t({locateFile:r=>ot(Ot+r)})}function or(e,t){const r=new t.ArrayValue;return r.deleteLater(),e.forEach(i=>{r.add_value(xt(i,t))}),r}function sr(e,t){const r=new t.ObjectValue;r.deleteLater();for(const[i,n]of Object.entries(e))r.set_key_value(i,xt(n,t));return r}function Mt(e,t){if(e instanceof Vt)return jr(e,t);if(e instanceof Ge)return Ar(e,t);if(e instanceof ye||e instanceof Se)return Or(e,t);throw new _("knowledge-graph:unsupported-geometry","Only Point, Multipoint, Polyline, and Polygon geometry are supported by ArcGIS Knowledge",{geometry:e})}function Fr(e,t){t.input_quantization_parameters={xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}function Pr(e,t,r){if(!e.extent)throw new _("knowledge-graph:illegal-output-quantization","The Output quantization provided to the encoder had an illegal value as part of its extent",e.extent);if(!e.quantizeMode)throw new _("knowledge-graph:illegal-output-quantization","The Output quantization contained an illegal mode setting",e.quantizeMode);if(!e.tolerance)throw new _("knowledge-graph:illegal-output-quantization","The Output quantization contained an illegal tolerance setting",e.quantizeMode);t.output_quantization_parameters={extent:{xmax:e.extent.xmax,ymax:e.extent.ymax,xmin:e.extent.xmin,ymin:e.extent.ymin},quantize_mode:r.esriQuantizeMode[e.quantizeMode],tolerance:e.tolerance}}function xt(e,t){if(e==null)return"";if(typeof e!="object"||e instanceof Date)return e;if(e instanceof Tt)return Mt(e,t);if(Array.isArray(e)){const r=new t.ArrayValue;return r.deleteLater(),e.forEach(i=>{r.add_value(xt(i,t))}),r}return sr(e,t)}function Or(e,t){const r=new t.GeometryValue;r.deleteLater(),r.has_z=e.hasZ,r.has_m=e.hasM;const i=[],n=[];let a=[];e instanceof ye?(r.geometry_type=t.esriGeometryType.esriGeometryPolyline,a=e.paths):e instanceof Se&&(r.geometry_type=t.esriGeometryType.esriGeometryPolygon,a=e.rings);let o=0,s=0;return a.forEach(d=>{let u=0;d.forEach(c=>{u++,c.forEach(m=>{i[s]=m,s++})}),n[o]=u,o++}),r.coords=new Float64Array(i),r.lengths=new Uint32Array(n),r}function jr(e,t){const r=new t.GeometryValue;r.deleteLater(),r.geometry_type=r.geometry_type=t.esriGeometryType.esriGeometryMultipoint,r.has_z=e.hasZ,r.has_m=e.hasM;const i=[],n=[];n[0]=e.points.length;let a=0;return e.points.forEach(o=>{o.forEach(s=>{i[a]=s,a++})}),r.coords=new Float64Array(i),r.lengths=new Uint32Array(n),r}function Ar(e,t){const r=new t.GeometryValue;r.deleteLater(),r.geometry_type=t.esriGeometryType.esriGeometryPoint,r.has_z=e.hasZ,r.has_m=e.hasM;const i=[],n=[];n[0]=1,i[0]=e.x,i[1]=e.y;let a=2;return e.hasZ&&(i[a]=e.z,a++),e.hasM&&(i[a]=e.m,a++),r.coords=new Float64Array(i),r.lengths=new Uint32Array(n),r}let Ae=class extends se{constructor(t){super(t),this.properties=null}};l([p({json:{write:!0}})],Ae.prototype,"properties",void 0),Ae=l([R("esri.rest.knowledgeGraph.GraphObject")],Ae);const Ct=Ae;let Ie=class extends Ct{constructor(t){super(t),this.typeName=null,this.id=null}};l([p({type:String,json:{write:!0}})],Ie.prototype,"typeName",void 0),l([p({type:String,json:{write:!0}})],Ie.prototype,"id",void 0),Ie=l([R("esri.rest.knowledgeGraph.GraphNamedObject")],Ie);const lr=Ie;let ze=class extends lr{constructor(t){super(t),this.layoutGeometry=null}};l([p({type:Ge,json:{write:!0}})],ze.prototype,"layoutGeometry",void 0),ze=l([R("esri.rest.knowledgeGraph.Entity")],ze);const pr=ze;let _e=class extends lr{constructor(t){super(t),this.originId=null,this.destinationId=null,this.layoutGeometry=null}};l([p({type:String,json:{write:!0}})],_e.prototype,"originId",void 0),l([p({type:String,json:{write:!0}})],_e.prototype,"destinationId",void 0),l([p({type:ye,json:{write:!0}})],_e.prototype,"layoutGeometry",void 0),_e=l([R("esri.rest.Relationship.Relationship")],_e);const dr=_e;function $e(e,t){if(!e.typeName)throw new _("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits");if(e instanceof pr){const r=new t.EntityValue;r.deleteLater(),r.type_name=e.typeName;for(const[i,n]of Object.entries(e.properties))r.set_key_value(i,jt(n,t));return e.id&&r.set_id(e.id),r}if(e instanceof dr){const r=new t.RelationshipValue;r.deleteLater(),r.type_name=e.typeName;for(const[i,n]of Object.entries(e.properties))r.set_key_value(i,jt(n,t));return e.id&&r.set_id(e.id),e.originId&&e.destinationId&&r.set_related_entity_ids(e.originId,e.destinationId),r}throw new _("knowledge-graph:applyEdits-encoding-failure","Could not determine the type of a named graph object passed to the encoder")}function zr(e){return{xy_resolution:e.xyResolution,x_false_origin:e.xFalseOrigin,y_false_origin:e.yFalseOrigin,z_resolution:e.zResolution,z_false_origin:e.zFalseOrigin,m_resolution:e.mResolution,m_false_origin:e.mFalseOrigin}}function jt(e,t){return e==null?"":typeof e!="object"||e instanceof Date?e:e instanceof Tt?Mt(e,t):""}let de=class extends ke{constructor(t){super(t),this.name=null,this.supportedCategory=null,this.analyzers=[],this.searchProperties=new Map}};l([p()],de.prototype,"name",void 0),l([p()],de.prototype,"supportedCategory",void 0),l([p()],de.prototype,"analyzers",void 0),l([p()],de.prototype,"searchProperties",void 0),de=l([R("esri.rest.knowledgeGraph.SearchIndex")],de);const Qr=de;var Ye,Be,He,pt,dt,ut,ht;(function(e){e[e.Regular=0]="Regular",e[e.Provenance=1]="Provenance",e[e.Document=2]="Document"})(Ye||(Ye={})),function(e){e[e.esriFieldTypeSmallInteger=0]="esriFieldTypeSmallInteger",e[e.esriFieldTypeInteger=1]="esriFieldTypeInteger",e[e.esriFieldTypeSingle=2]="esriFieldTypeSingle",e[e.esriFieldTypeDouble=3]="esriFieldTypeDouble",e[e.esriFieldTypeString=4]="esriFieldTypeString",e[e.esriFieldTypeDate=5]="esriFieldTypeDate",e[e.esriFieldTypeOID=6]="esriFieldTypeOID",e[e.esriFieldTypeGeometry=7]="esriFieldTypeGeometry",e[e.esriFieldTypeBlob=8]="esriFieldTypeBlob",e[e.esriFieldTypeRaster=9]="esriFieldTypeRaster",e[e.esriFieldTypeGUID=10]="esriFieldTypeGUID",e[e.esriFieldTypeGlobalID=11]="esriFieldTypeGlobalID",e[e.esriFieldTypeXML=12]="esriFieldTypeXML",e[e.esriFieldTypeBigInteger=13]="esriFieldTypeBigInteger",e[e.esriFieldTypeDateOnly=14]="esriFieldTypeDateOnly",e[e.esriFieldTypeTimeOnly=15]="esriFieldTypeTimeOnly",e[e.esriFieldTypeTimestampOffset=16]="esriFieldTypeTimestampOffset"}(Be||(Be={})),function(e){e[e.esriGeometryNull=0]="esriGeometryNull",e[e.esriGeometryPoint=1]="esriGeometryPoint",e[e.esriGeometryMultipoint=2]="esriGeometryMultipoint",e[e.esriGeometryPolyline=3]="esriGeometryPolyline",e[e.esriGeometryPolygon=4]="esriGeometryPolygon",e[e.esriGeometryEnvelope=5]="esriGeometryEnvelope",e[e.esriGeometryAny=6]="esriGeometryAny",e[e.esriGeometryMultiPatch=7]="esriGeometryMultiPatch"}(He||(He={})),function(e){e[e.esriMethodHintUNSPECIFIED=0]="esriMethodHintUNSPECIFIED",e[e.esriUUIDESRI=1]="esriUUIDESRI",e[e.esriUUIDRFC4122=2]="esriUUIDRFC4122"}(pt||(pt={})),function(e){e[e.esriTypeUNSPECIFIED=0]="esriTypeUNSPECIFIED",e[e.esriTypeEntity=1]="esriTypeEntity",e[e.esriTypeRelationship=2]="esriTypeRelationship",e[e.esriTypeBoth=4]="esriTypeBoth"}(dt||(dt={})),function(e){e[e.esriGraphPropertyUNSPECIFIED=0]="esriGraphPropertyUNSPECIFIED",e[e.esriGraphPropertyRegular=1]="esriGraphPropertyRegular",e[e.esriGraphPropertyDocumentName=2]="esriGraphPropertyDocumentName",e[e.esriGraphPropertyDocumentTitle=3]="esriGraphPropertyDocumentTitle",e[e.esriGraphPropertyDocumentUrl=4]="esriGraphPropertyDocumentUrl",e[e.esriGraphPropertyDocumentText=5]="esriGraphPropertyDocumentText",e[e.esriGraphPropertyDocumentKeywords=6]="esriGraphPropertyDocumentKeywords",e[e.esriGraphPropertyDocumentContentType=7]="esriGraphPropertyDocumentContentType",e[e.esriGraphPropertyDocumentMetadata=8]="esriGraphPropertyDocumentMetadata",e[e.esriGraphPropertyDocumentFileExtension=9]="esriGraphPropertyDocumentFileExtension"}(ut||(ut={})),function(e){e[e.esriIdentifierInfoTypeUNSPECIFIED=0]="esriIdentifierInfoTypeUNSPECIFIED",e[e.esriIdentifierInfoTypeDatabaseNative=1]="esriIdentifierInfoTypeDatabaseNative",e[e.esriIdentifierInfoTypeUniformProperty=2]="esriIdentifierInfoTypeUniformProperty"}(ht||(ht={}));function Ur(e){var t,r,i,n,a,o,s,d,u,c,m;return e.deleteLater(),new nr({timestamp:e.timestamp,spatialReference:new Wt(e.spatial_reference),strict:e.strict,objectIdField:e.objectid_property,globalIdField:e.globalid_property,arcgisManaged:e.arcgis_managed,identifierInfo:{identifierMappingInfo:{identifierInfoType:ht[(i=(r=(t=e.identifier_info)==null?void 0:t.identifier_mapping_info)==null?void 0:r.identifier_info_type)==null?void 0:i.value],databaseNativeIdentifier:(a=(n=e.identifier_info)==null?void 0:n.identifier_mapping_info)==null?void 0:a.database_native_identifier,uniformPropertyIdentifier:{identifierPropertyName:(d=(s=(o=e.identifier_info)==null?void 0:o.identifier_mapping_info)==null?void 0:s.uniform_property_identifier)==null?void 0:d.identifier_property_name}},identifierGenerationInfo:{uuidMethodHint:pt[(m=(c=(u=e.identifier_info)==null?void 0:u.identifier_generation_info)==null?void 0:c.uuid_method_hint)==null?void 0:m.value]}},searchIndexes:Xr(e.search_indexes),entityTypes:Jr(e.entity_types),relationshipTypes:Zr(e.relationship_types)})}function qr(e){return e.deleteLater(),new Et(ur(e))}function Yr(e){return e.deleteLater(),new tr({name:e.name,unique:e.unique,ascending:e.ascending,description:e.description,fieldNames:Wr(e.fields)})}function ur(e){return{name:e.name,alias:e.alias,role:Ye[e.role.value]?Ye[e.role.value]:null,strict:e.strict,properties:Vr(e.properties),fieldIndexes:Kr(e.field_indexes)}}function Br(e){return e.deleteLater(),new rr({alias:e.alias,name:e.name,fieldType:Be[e.field_type.value]?Be[e.field_type.value]:null,geometryType:He[e.geometry_type.value]?He[e.geometry_type.value]:null,hasM:e.has_m,hasZ:e.has_z,nullable:e.nullable,editable:e.editable,required:e.required,defaultVisibility:e.default_visibility,systemMaintained:e.system_maintained,role:ut[e.role.value],defaultValue:e.default_value})}function Hr(e){e.deleteLater();const t=ur(e),r=[];for(let i=0;i{const d=[];for(let u=0;u{if(e==null)return null;if(typeof e!="object"||"getDate"in e)return e;if("geometry_type"in e)switch(e.geometry_type.value){case null:return null;case Z.ESRI_GEOMETRY_POINT:return ii(e);case Z.ESRI_GEOMETRY_MULTIPOINT:return ri(e);case Z.ESRI_GEOMETRY_POLYLINE:return ni(e);case Z.ESRI_GEOMETRY_POLYGON:return ai(e);case Z.ESRI_GEOMETRY_ENVELOPE:case Z.ESRI_GEOMETRY_MULTI_PATCH:return Fe.warnOnce("Envelope and Multipatch are not supported on knowledge entities, but one of those geometry types was detected. Result interpreted as null"),null;case Z.ESRI_GEOMETRY_NULL:case Z.ESRI_GEOMETRY_ANY:default:return Fe.warnOnce("Unknown or blank geometry type returned - Result interpreted as null"),null}else{if(!("object_value_type"in e))return Fe.warnOnce("A decoded value came back of a type that is not supported. Result interpreted as null"),null;switch(e.object_value_type.value){case he.OBJECT:return li(e,t);case he.ENTITY:return cr(e,t);case he.RELATIONSHIP:return yr(e,t);case he.PATH:return pi(e,t);case he.ARRAY:return si(e,t);default:return Fe.warnOnce("Unknown graph object type detected! Result interpreted as null"),null}}}};function si(e,t){const r=[],i=e.count();for(let n=0;n{const t=new Nr({url:e}),r=[];return r.push(Je(t)),r.push(ci(t)),await Promise.all(r),t},refreshDataModel:async e=>{e.dataModel=await mr(e)},refreshServiceDefinition:async e=>{var r,i;const t=(await ve(e.url,{query:{f:"json"}})).data;return t.capabilities=(r=t==null?void 0:t.capabilities)==null?void 0:r.split(","),t.supportedQueryFormats=(i=t==null?void 0:t.supportedQueryFormats)==null?void 0:i.split(","),e.serviceDefinition=new ar(t),e.serviceDefinition},executeQueryStreaming:async(e,t,r)=>{const i=`${e.url}/graph/query`;await et(e);const n=await tt(i,r);n.data.body=await fi(t,e);const a=await Xe(n.data.url,n.data);if(e.dataModel)return new Pt({resultRowsStream:await zt(a,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},executeApplyEdits:async(e,t,r)=>{var a;if((a=e.serviceDefinition)!=null&&a.dataEditingNotSupported)throw new _("knowledge-graph:data-editing-not-supported","The Knowledge Graph Service definition indicated that data editing is not supported");const i=`${e.url}/graph/applyEdits`;await et(e);const n=await tt(i,r);return n.data.body=await mi(t,e),wi(await Xe(n.data.url,n.data))},executeQuery:async(e,t,r)=>{var s;const i=`${e.url}/graph/query`,n=await ve(i,{responseType:"array-buffer",query:{f:"pbf",openCypherQuery:t.openCypherQuery,...r==null?void 0:r.query},signal:r==null?void 0:r.signal,timeout:r==null?void 0:r.timeout}),a=(s=n.getHeader)==null?void 0:s.call(n,"content-type"),o=n.data;if(a!=null&&a.includes("application/x-protobuf")){const d=new(await oe()).GraphQueryDecoder;if(d.deleteLater(),e.dataModel)return new Ft({resultRows:yt(d,o,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:a,data:n.data})},executeSearch:async(e,t,r)=>{var d;const i=t.typeCategoryFilter,n=`${e.url}/graph/search`,a=await ve(n,{responseType:"array-buffer",query:{f:"pbf",searchQuery:`"${t.searchQuery}"`,typeCategoryFilter:i,...r==null?void 0:r.query},signal:r==null?void 0:r.signal,timeout:r==null?void 0:r.timeout}),o=(d=a.getHeader)==null?void 0:d.call(a,"content-type"),s=a.data;if(o!=null&&o.includes("application/x-protobuf")){const u=new(await oe()).GraphQueryDecoder;if(u.deleteLater(),e.dataModel)return new Ft({resultRows:yt(u,s,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:o,data:a.data})},executeSearchStreaming:async(e,t,r)=>{const i=`${e.url}/graph/search`;await et(e);const n=await tt(i,r);n.data.body=await gi(t);const a=await Xe(n.data.url,n.data);if(e.dataModel)return new Pt({resultRowsStream:await zt(a,e.dataModel)});throw new _("knowledge-graph:undefined-data-model","The KnowledgeGraph supplied did not have a data model")},_fetchWrapper:async(e,t)=>fetch(e,t)};async function Ue(e,t,r){return Ne.executeQueryStreaming(e,t,r)}async function hi(e){return Ne.fetchKnowledgeGraph(e)}async function Je(e){return Ne.refreshDataModel(e)}async function ci(e){return Ne.refreshServiceDefinition(e)}async function Xe(e,t){return Ne._fetchWrapper(e,t)}async function et(e){var r;((r=wr)==null?void 0:r.findCredential(e.url))||(e.dataModel?await mr(e):await Je(e))}function xe(e,t,r){if(e.error_code!==0)throw new _(t,r,{errorCode:e.error_code,errorMessage:e.error_message})}function yi(e,t,r,i){t==null?r.set_param_key_value(e,""):typeof t!="object"||t instanceof Date?r.set_param_key_value(e,t):t instanceof Tt?r.set_param_key_value(e,Mt(t,i)):t instanceof Array?r.set_param_key_value(e,or(t,i)):r.set_param_key_value(e,sr(t,i))}async function mi(e,t){var o,s,d,u,c,m,g,h,E;if(t.dataModel||await Je(t),!t.dataModel)throw new _("knowledge-graph:data-model-undefined","Encoding could not proceed because a data model was not provided and it could not be determined from the service");const r=await oe(),i=!!((o=e.options)!=null&&o.cascadeDelete),n=new r.GraphApplyEditsEncoder(r.SpatialReferenceUtil.WGS84(),(s=e.options)!=null&&s.inputQuantizationParameters?zr((d=e.options)==null?void 0:d.inputQuantizationParameters):r.InputQuantizationUtil.WGS84_lossless());n.deleteLater(),n.cascade_delete=i;try{let w;(u=e.entityAdds)==null||u.forEach(y=>{w=n.add_entity($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),(c=e.relationshipAdds)==null||c.forEach(y=>{if(!y.originId||!y.destinationId)throw new _("knowledge-graph:relationship-origin-destination-missing","When adding a new relationship, you must provide both an origin and destination id on the appropriate class property");w=n.add_relationship($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),(m=e.entityUpdates)==null||m.forEach(y=>{if(!y.id)throw new _("knowledge-graph:entity-id-missing","When updating an entity or relationship, you must specify the id on the class level property");w=n.update_entity($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - an entity failed to be added to the encoder")}),(g=e.relationshipUpdates)==null||g.forEach(y=>{if(!y.id)throw new _("knowledge-graph:relationship-id-missing","When updating an entity or relationship, you must specify the id on the class level property");w=n.update_relationship($e(y,r)),xe(w,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits - a relationship failed to be added to the encoder")}),(h=e.entityDeletes)==null||h.forEach(y=>{var I;if(!y.typeName)throw new _("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const b=n.make_delete_helper(y.typeName,!0);b.deleteLater(),(I=y.ids)==null||I.forEach(Q=>{b.delete_by_id(Q)})}),(E=e.relationshipDeletes)==null||E.forEach(y=>{var I;if(!y.typeName)throw new _("knowledge-graph:no-type-name","You must indicate the entity/relationship named object type to apply edits - delete");const b=n.make_delete_helper(y.typeName,!1);(I=y.ids)==null||I.forEach(Q=>{b.delete_by_id(Q)})}),n.encode()}catch(w){throw new _("knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed",{error:w})}const a=n.get_encoding_result();return xe(a.error,"knowledge-graph:applyEdits-encoding-failed","Attempting to encode the applyEdits failed"),a.get_byte_buffer()}async function fi(e,t){var a,o;const r=await oe(),i=new r.GraphQueryRequestEncoder;if(i.deleteLater(),i.output_spatial_reference=r.SpatialReferenceUtil.WGS84(),i.open_cypher_query=e.openCypherQuery,e.bindParameters)for(const[s,d]of Object.entries(e.bindParameters))yi(s,d,i,r);if(e.bindGeometryQuantizationParameters)Fr(e.bindGeometryQuantizationParameters,i);else{if(t.dataModel||await Je(t),((o=(a=t.dataModel)==null?void 0:a.spatialReference)==null?void 0:o.wkid)!==4326)throw new _("knowledge-graph:SR-quantization-mismatch","If the DataModel indicates a coordinate system other than WGS84, inputQuantizationParameters must be provided to the query encoder");i.input_quantization_parameters=r.InputQuantizationUtil.WGS84_lossless()}e.outputQuantizationParameters&&Pr(e.outputQuantizationParameters,i,r);try{i.encode()}catch(s){throw new _("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{error:s})}const n=i.get_encoding_result();if(n.error.error_code!==0)throw new _("knowledge-graph:query-encoding-failed","Attempting to encode the query failed",{errorCode:n.error.error_code,errorMessage:n.error.error_message});return n.get_byte_buffer()}async function gi(e){var n;const t=await oe(),r=new t.GraphSearchRequestEncoder;if(r.deleteLater(),r.search_query=e.searchQuery,r.type_category_filter=t.esriNamedTypeCategory[e.typeCategoryFilter],e.returnSearchContext===!0&&(r.return_search_context=e.returnSearchContext),e.start!=null&&e.start>0&&(r.start_index=e.start),e.num!=null&&(r.max_num_results=e.num),e.idsFilter!=null&&Array.isArray(e.idsFilter)&&e.idsFilter.length>0)try{r.set_ids_filter(or(e.idsFilter,t))}catch(a){throw new _("knowledge-graph:ids-format-error","Attempting to set ids filter failed. This is usually caused by an incorrectly formatted UUID string",{error:a})}(n=e.namedTypesFilter)==null||n.forEach(a=>{r.add_named_type_filter(a)});try{r.encode()}catch(a){throw new _("knowledge-graph:search-encoding-failed","Attempting to encode the search failed",{error:a})}const i=r.get_encoding_result();if(i.error.error_code!==0)throw new _("knowledge-graph:search-encoding-failed","Attempting to get encoding result from the query failed",{errorCode:i.error.error_code,errorMessage:i.error.error_message});return i.get_byte_buffer()}async function tt(e,t){return ve(e,{responseType:"native-request-init",method:"post",query:{f:"pbf",...t==null?void 0:t.query},body:"x",headers:{"Content-Type":"application/octet-stream"},signal:t==null?void 0:t.signal,timeout:t==null?void 0:t.timeout})}async function wi(e){const t=e.headers.get("content-type");if(t!=null&&t.includes("application/x-protobuf")){const r=await e.arrayBuffer(),i=new(await oe()).GraphApplyEditsDecoder;return i.deleteLater(),i.decode(new Uint8Array(r)),ui(i)}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:t,data:e.text()})}function yt(e,t,r){e.push_buffer(new Uint8Array(t));const i=[];let n=0;for(;e.next_row();){n||(n=e.get_header_keys().size());const a=new Array(n);for(let o=0;o{if(d){let m;if(a.has_error()&&(m=new _("knowledge-graph:stream-decoding-error","One or more result rows were not successfully decoded",{errorCode:a.error.error_code,errorMessage:a.error.error_message})),n.releaseLock(),m)throw o.error(m),m;return void o.close()}const c=yt(a,u,t);return c.length>0&&o.enqueue(c),s()})}}})}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:r,data:e.text()})}async function mr(e){var a;const t=`${e.url}/dataModel/queryDataModel`,r=await ve(t,{responseType:"array-buffer",query:{f:"pbf"}}),i=(a=r.getHeader)==null?void 0:a.call(r,"content-type"),n=r.data;if(i!=null&&i.includes("application/x-protobuf")){const o=(await oe()).decode_data_model_from_protocol_buffer(new Uint8Array(n));if(!o)throw new _("knowledge-graph:data-model-decode-failure","The server responded to the data model query, but the response failed to be decoded. This typically occurs when the Knowledge JS API (4.26 or later) is used with an unsupported backend (11.0 or earlier)");return Ur(o)}throw new _("knowledge-graph:unexpected-server-response","server returned an unexpected response",{responseType:i,data:r.data})}let qe=class extends ke{constructor(t){super(t),this.openCypherQuery=""}};l([p()],qe.prototype,"openCypherQuery",void 0),qe=l([R("esri.rest.knowledgeGraph.GraphQuery")],qe);const _i=qe;let Te=class extends _i{constructor(t){super(t),this.bindParameters=null,this.bindGeometryQuantizationParameters=null,this.outputQuantizationParameters=null}};l([p()],Te.prototype,"bindParameters",void 0),l([p()],Te.prototype,"bindGeometryQuantizationParameters",void 0),l([p()],Te.prototype,"outputQuantizationParameters",void 0),Te=l([R("esri.rest.knowledgeGraph.GraphQueryStreaming")],Te);const Le=Te;function bi(e){if(!e.spatialReference.isWGS84)throw new _("knowledge-graph:layer-support-utils","The extentToInBoundsRings function only supports WGS84 spatial references.");let t;return t=e.xmax>180&&e.xmin<180?[[[e.xmin,e.ymin],[e.xmin,e.ymax],[180,e.ymax],[180,e.ymin],[e.xmin,e.ymin]],[[-180,e.ymin],[-180,e.ymax],[e.xmax-360,e.ymax],[e.xmax-360,e.ymin],[-180,e.ymin]]]:e.xmax>180&&e.xmin>180?[[[e.xmin-360,e.ymin],[e.xmin-360,e.ymax],[e.xmax-360,e.ymax],[e.xmax-360,e.ymin],[e.xmin-360,e.ymin]]]:e.xmax>-180&&e.xmin<-180?[[[e.xmin+360,e.ymin],[e.xmin+360,e.ymax],[180,e.ymax],[180,e.ymin],[e.xmin+360,e.ymin]],[[-180,e.ymin],[-180,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[-180,e.ymin]]]:e.xmax<-180&&e.xmin<-180?[[[e.xmin+360,e.ymin],[e.xmin+360,e.ymax],[e.xmax+360,e.ymax],[e.xmax+360,e.ymin],[e.xmin+360,e.ymin]]]:[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]],t}async function Ti(e,t){var a,o;const r=[],i=new Map,n=[];if((a=t.dataModel)!=null&&a.relationshipTypes)for(const s of t.dataModel.relationshipTypes)s.name&&i.set(s.name,[]);for(const s of e)i.has(s.typeName)&&((o=i.get(s.typeName))==null||o.push(s.id));for(const[s,d]of i){if(d.length<1)continue;const u=new Le({openCypherQuery:`MATCH (n)-[r:${s}]->(m) WHERE id(r) in $ids RETURN id(n), labels(n)[0], id(m), labels(m)[0]`,bindParameters:{ids:d}});n.push(Ue(t,u).then(async c=>{const m=c.resultRowsStream.getReader();for(;;){const{done:g,value:h}=await m.read();if(g)break;for(const E of h)r.push({id:E[0],typeName:E[1]}),r.push({id:E[2],typeName:E[3]})}}))}return await Promise.all(n),r}const D="ESRI__ID",Ce="ESRI__ORIGIN_ID",rt="ESRI__DESTINATION_ID",O="ESRI__LAYOUT_GEOMETRY",ce=12,Qt=Ee.getLogger("esri.rest.knowledgeGraph.knowledgeGraphLayer.KnowledgeGraphLayerDataManager");let te=class extends ke{constructor(t){var i,n,a;super(t),this.inclusionModeDefinition={generateAllSublayers:!0,namedTypeDefinitions:new Map},this.entityTypeNames=new Set,this.relationshipTypeNames=new Set,this.geographicLookup=new Map,this.sublayerCaches=new Map,this.nodeConnectionsLookup=new Map,this.memberIdTypeLookup=new Map,this._processingCacheUpdatesLookup=new Map;const r=new Map;(i=t.knowledgeGraph.dataModel.entityTypes)==null||i.forEach(o=>{var s,d;o.name&&(r.set(o.name,"entity"),this._processingCacheUpdatesLookup.set(o.name,[]),t.inclusionModeDefinition&&!((s=t.inclusionModeDefinition)!=null&&s.generateAllSublayers)||this.entityTypeNames.add(o.name),(d=o.properties)==null||d.forEach(u=>{u.geometryType&&u.geometryType!=="esriGeometryNull"&&this.geographicLookup.set(o.name,{name:u.name??"",geometryType:u.geometryType})}))}),(n=t.knowledgeGraph.dataModel.relationshipTypes)==null||n.forEach(o=>{var s,d;o.name&&(r.set(o.name,"relationship"),this._processingCacheUpdatesLookup.set(o.name,[]),t.inclusionModeDefinition&&!((s=t.inclusionModeDefinition)!=null&&s.generateAllSublayers)||this.relationshipTypeNames.add(o.name),(d=o.properties)==null||d.forEach(u=>{u.geometryType&&u.geometryType!=="esriGeometryNull"&&this.geographicLookup.set(o.name,{name:u.name??"",geometryType:u.geometryType})}))}),(a=t.inclusionModeDefinition)==null||a.namedTypeDefinitions.forEach((o,s)=>{var u,c;if(r.get(s)==="entity")this.entityTypeNames.add(s);else{if(r.get(s)!=="relationship")return Qt.warn(`A named type, ${s}, was in the inclusion list that wasn't in the data model and will be removed`),void((u=t.inclusionModeDefinition)==null?void 0:u.namedTypeDefinitions.delete(s));this.relationshipTypeNames.add(s)}const d=new Map;(c=o.members)==null||c.forEach(m=>{this.memberIdTypeLookup.set(m.id,s);const g=this.getById(m.id);g&&d.set(m.id,g)}),this.sublayerCaches.set(s,d)})}addToLayer(t){t.forEach(({typeName:r,id:i})=>{if(!this.inclusionModeDefinition)throw new _("knowledge-graph:layer-data-manager","You cannot add to a layer's exclusion list if it was not created with an exclusion list originally");if(this.inclusionModeDefinition.namedTypeDefinitions.has(r)){if(this.inclusionModeDefinition.namedTypeDefinitions.has(r)){const n=this.inclusionModeDefinition.namedTypeDefinitions.get(r);n.members||(n.members=new Map),n.members.set(i,{id:i}),this.memberIdTypeLookup.set(i,r)}}else{const n=new Map;n.set(i,{id:i}),this.inclusionModeDefinition.namedTypeDefinitions.set(r,{useAllData:!1,members:n}),this.memberIdTypeLookup.set(i,r)}})}getById(t){return Ke.getInstance().readFromStoreById(t)}async getData(t,r,i){var a,o;if(r.objectType.name&&((a=this.inclusionModeDefinition)!=null&&a.namedTypeDefinitions)&&this.inclusionModeDefinition.namedTypeDefinitions.size>0&&!this.inclusionModeDefinition.namedTypeDefinitions.has(r.objectType.name))return[];let n;if(n=t||new ge({where:"1=1",outFields:["*"]}),r.parentCompositeLayer.type==="link-chart"){const s=r.parentCompositeLayer,d=this._processingCacheUpdatesLookup.get(r.objectType.name??""),u=n.outFields,c=n.geometry;let m="",g="";c&&c.extent&&(m=ue(c.extent.ymin,c.extent.xmin,ce),g=ue(c.extent.ymax,c.extent.xmax,ce)),u&&u.length===1&&u[0]===D&&n.where==="1=1"||await Promise.all(d??[]);const h=this.sublayerCaches.has(r.objectType.name??"")?Array.from((o=this.sublayerCaches.get(r.objectType.name))==null?void 0:o.values()):[],E=[];return h.forEach(w=>{if(w.geometry=s.linkChartDiagramLookup.get(w.attributes[r.objectIdField]),w.attributes[O]=w.geometry,m&&g){const y=s.linkChartGeohashLookup.get(w.attributes[r.objectIdField]);y?y>=m&&y<=g&&E.push(w):E.push(w)}else E.push(w)}),E}return this.retrieveDataFromService(n,r,i)}async getConnectedRecordIds(t){const r=[],i=[],n=new Map;return t.forEach(a=>{var o;if(this.memberIdTypeLookup.has(a)){const s=this.memberIdTypeLookup.get(a);if(!this.entityTypeNames.has(s))return;n.has(s)?(o=n.get(s))==null||o.push(a):n.set(s,[a])}}),n.forEach((a,o)=>{const s=`MATCH (n:${o})-[r]-(m) WHERE id(n) IN $ids RETURN id(r), type(r), id(m), labels(m)[0]`,d=new Promise(u=>{(async()=>{const c=(await Ue(this.knowledgeGraph,new Le({openCypherQuery:s,bindParameters:{ids:a}}))).resultRowsStream.getReader();try{for(;;){const{done:m,value:g}=await c.read();if(m)break;for(let h=0;h{u()})});i.push(d)}),await Promise.all(i),r}async refreshCacheContent(t,r,i,n=!0){var u,c,m,g,h,E,w;const a=Ke.getInstance(),o=[],s=new Map,d=new Map;(u=this.knowledgeGraph.dataModel.entityTypes)==null||u.forEach(y=>{y.name&&d.set(y.name,y)}),(c=this.knowledgeGraph.dataModel.relationshipTypes)==null||c.forEach(y=>{y.name&&d.set(y.name,y)}),t||this.inclusionModeDefinition?t?t.forEach(y=>{var b;if(this.memberIdTypeLookup.has(y)){const I=this.memberIdTypeLookup.get(y);s.has(I)?(b=s.get(I))==null||b.push(y):s.set(I,[y])}}):(g=(m=this.inclusionModeDefinition)==null?void 0:m.namedTypeDefinitions)==null||g.forEach((y,b)=>{y.useAllData?s.set(b,null):y.members&&y.members.forEach(I=>{var Q;s.has(b)&&s.get(b)!==null?(Q=s.get(b))==null||Q.push(I.id):s.set(b,[I.id])})}):((h=this.knowledgeGraph.dataModel.entityTypes)==null||h.forEach(y=>{y.name&&s.set(y.name,null)}),(E=this.knowledgeGraph.dataModel.entityTypes)==null||E.forEach(y=>{y.name&&s.set(y.name,null)}));for(const[y,b]of s){const I=new Promise(Q=>{(async()=>{var K,M,S,B,Me,N,C;const J=new Set,X=[];let f,x="",L=!1;if(r||((M=(K=d.get(y))==null?void 0:K.properties)==null||M.forEach(G=>{G.name&&J.add(G.name)})),i&&this.geographicLookup.has(y)){const G=(S=this.geographicLookup.get(y))==null?void 0:S.name;G&&J.add(G)}if(this.entityTypeNames.has(y))x=`MATCH (n:${y}) ${b?"WHERE id(n) IN $ids ":""}return ID(n)`,J.forEach(G=>{x+=`, n.${G}`,X.push(G)});else{if(!this.relationshipTypeNames.has(y))throw new _("knowledge-graph:layer-data-manager",`The graph type of ${y} could not be determined. Was this type set in the KG data model and inclusion definition?`);L=!0,x=`MATCH ()-[n:${y}]->() ${b?"WHERE id(n) IN $ids ":""}return ID(n), id(startNode(n)), id(endNode(n))`,J.forEach(G=>{x+=`, n.${G}`,X.push(G)})}f=new Le(b?{openCypherQuery:x,bindParameters:{ids:b}}:{openCypherQuery:x});const ee=(await Ue(this.knowledgeGraph,f)).resultRowsStream.getReader();for(;;){const{done:G,value:U}=await ee.read();if(G)break;const z=[];for(let v=0;vnew Set).add(ie.id),Rt(this.nodeConnectionsLookup,ie.destinationId,()=>new Set).add(ie.id));A{var T,A;j==null||j.set(v.attributes[D],v),n&&!((T=this.inclusionModeDefinition)!=null&&T.namedTypeDefinitions.get(y).members.has(v.attributes[D]))&&((A=this.inclusionModeDefinition)==null||A.namedTypeDefinitions.get(y).members.set(v.attributes[D],{id:v.attributes[D]}),this.memberIdTypeLookup.set(v.attributes[D],y))})}})().then(()=>{Q(null)})});o.push(I),(w=this._processingCacheUpdatesLookup.get(y))==null||w.push(I)}await Promise.all(o)}removeFromLayer(t){var n;const r=new Set,i=new Set(t.map(a=>a.id));for(const a of t)r.add(a.typeName),this.memberIdTypeLookup.delete(a.id),(n=this.inclusionModeDefinition)==null||n.namedTypeDefinitions.forEach(o=>{var s;(s=o.members)!=null&&s.has(a.id)&&o.members.delete(a.id)});r.forEach(a=>{var o;(o=this.sublayerCaches.get(a))==null||o.forEach((s,d)=>{var u;i.has(d)&&((u=this.sublayerCaches.get(a))==null||u.delete(d))})})}async retrieveDataFromService(t,r,i){var w,y,b,I,Q,k,J,X,f,x,L,ee,K,M,S,B,Me;const n=Ke.getInstance(),a=new Set,o=[];let s,d="",u=[];const c=r.graphType==="relationship",m=(b=(y=(w=this.inclusionModeDefinition)==null?void 0:w.namedTypeDefinitions)==null?void 0:y.get(r.objectType.name))==null?void 0:b.useAllData,g=r.parentCompositeLayer.sublayerIdsCache.get(r.objectType.name);let h=!m&&g?Array.from(g).sort():null;if((k=(Q=(I=this.inclusionModeDefinition)==null?void 0:I.namedTypeDefinitions)==null?void 0:Q.get(r.objectType.name))!=null&&k.useAllData)(f=(X=(J=this.inclusionModeDefinition)==null?void 0:J.namedTypeDefinitions)==null?void 0:X.get(r.objectType.name))!=null&&f.useAllData&&t.objectIds!=null&&(h=t.objectIds);else if(t.objectIds!=null&&h&&h.length>0){const N=t.objectIds;t.objectIds=h.filter(C=>N.includes(C))}else if(t.objectIds!=null)h=t.objectIds;else{if((x=this.inclusionModeDefinition)!=null&&x.namedTypeDefinitions.has(r.objectType.name)&&(!((L=this.inclusionModeDefinition.namedTypeDefinitions.get(r.objectType.name))!=null&&L.members)||((K=(ee=this.inclusionModeDefinition.namedTypeDefinitions.get(r.objectType.name))==null?void 0:ee.members)==null?void 0:K.size)<1))return t.objectIds=[],[];t.objectIds=h}if(t.outFields!=null){const N=t.outFields;N.includes("*")?r.fields.forEach(C=>{a.add(C.name)}):N.forEach(C=>{C!==D&&C!==r.geometryFieldName&&a.add(C)})}if(t.geometry!=null){const N=t.geometry;let C;const G=r.parentCompositeLayer.dataManager.knowledgeGraph.serviceDefinition,U=G==null?void 0:G.spatialReference,z=(M=G==null?void 0:G.serviceCapabilities)==null?void 0:M.geometryCapabilities;let F=z==null?void 0:z.geometryMaxBoundingRectangleSizeX,j=z==null?void 0:z.geometryMaxBoundingRectangleSizeY;if((S=N==null?void 0:N.extent)!=null&&S.spatialReference&&!((B=N.spatialReference)!=null&&B.isWGS84)?(await Kt(N.extent.spatialReference,De),C=st(N.extent,De)):C=N.extent,F&&j&&U){if(U.wkid!==4326){const v=new Re({spatialReference:U,xmax:F,ymax:j}),T=st(v,De);F=T.xmax,j=T.ymax}if(C.xmax-C.xmin>F)throw new _("knowledge-graph:layer-data-manager",`Extent x bounds should be within ${F}° latitude, limit exceeded`);if(C.ymax-C.ymin>j)throw new _("knowledge-graph:layer-data-manager",`Extent y bounds should be within ${j}° longitude, limit exceeded`)}if(t.where!=null&&t.where!=="1=1"){const v=await Gt(t.where.toUpperCase(),r.fieldsIndex);r.fields.forEach(T=>{v.fieldNames.includes(T.name)&&a.add(T.name)})}d=c?`Match ()-[n:${r.objectType.name}]->() WHERE esri.graph.ST_Intersects($param_filter_geom, n.${r.geometryFieldName}) return ID(n), id(startNode(r)), id(endNode(r))`:`Match (n:${r.objectType.name}) WHERE esri.graph.ST_Intersects($param_filter_geom, n.${r.geometryFieldName}) return ID(n)`,r.geometryFieldName&&a.add(r.geometryFieldName),a.forEach(v=>{d+=`, n.${v}`,o.push(v)}),s=new Le({openCypherQuery:d,bindParameters:{param_filter_geom:new Se({rings:bi(C)})}})}else{let N="";if(t.where!=null&&t.where!=="1=1"){const U=await Gt(t.where,r.fieldsIndex);r.fields.forEach(T=>{U.fieldNames.includes(T.name)&&a.add(T.name)});const z=new Set(["column-reference","string","number","binary-expression"]),F=new Set(["=","<","<=","<>",">",">=","AND","OR","LIKE"]);let j=!1;const v=T=>{if(T.type==="column-reference")return`n.${T.column}`;if(T.type==="string")return`'${T.value}'`;if(T.type==="number")return`${T.value}`;if(T.type==="binary-expression"&&z.has(T.left.type)&&z.has(T.right.type)&&F.has(T.operator))return`${v(T.left)} ${T.operator} ${v(T.right)}`;if(T.type==="binary-expression"&&T.operator==="LIKE"){let A="";if(T.left.type==="function"&&T.left.args.value[0].type==="column-reference")A+=`lower(n.${T.left.args.value[0].column})`;else{if(T.left.type!=="column-reference")return j=!0,"";A+=`lower(n.${T.left.column})`}if(A+=" CONTAINS (",T.right.type!=="string")return j=!0,"";{let W=T.right.value;W.charAt(0)==="%"&&(W=W.slice(1)),W.charAt(W.length-1)==="%"&&(W=W.slice(0,-1)),A+=`'${W.toLowerCase()}')`}return A}return j=!0,""};N=v(U.parseTree),j&&(N="")}let C="";C=c?`Match ()-[n:${r.objectType.name}]->()`:`Match (n:${r.objectType.name})`;let G=!1;h&&(G=!0,C+=" WHERE ID(n) IN $ids"),N&&(C+=G?" AND":" WHERE",C+=` ${N}`),C+=" return ID(n)",c&&(C+=", id(startNode(n)), id(endNode(n))"),t.returnGeometry&&r.geometryFieldName&&a.add(r.geometryFieldName),a.forEach(U=>{C+=`, n.${U}`,o.push(U)}),s=new Le(h?{openCypherQuery:C,bindParameters:{ids:h}}:{openCypherQuery:C})}const E=(await Ue(r.parentCompositeLayer.dataManager.knowledgeGraph,s,i)).resultRowsStream.getReader();for(;;){const{done:N,value:C}=await E.read();if(N)break;const G=[];for(let U=0;U{let t=class extends e{constructor(){super(...arguments),this.fields=[],this.fieldsIndex=null}};return l([p(Ut.fields)],t.prototype,"fields",void 0),l([p(Ut.fieldsIndex)],t.prototype,"fieldsIndex",void 0),t=l([R("esri.layers.knowledgeGraphLayer.KnowledgeGraphSublayerBase")],t),t};let $=class extends Dr(Ei(Zt(Xt(br(er))))){constructor(e){var t,r,i,n,a;if(super(e),this.capabilities=vr(!1,!1),this.definitionExpression="",this.displayField="",this.elevationInfo=null,this.geometryType=null,this.geometryFieldName=null,this.graphType=null,this.hasM=!1,this.hasZ=!1,this.labelsVisible=null,this.labelingInfo=null,this.objectIdField=D,this.objectType=null,this.parentCompositeLayer=null,this.popupTemplate=null,this.source={openPorts:()=>this.load().then(()=>{const o=new MessageChannel;return new Tr(o.port1,{channel:o,client:{queryFeatures:(s,d={})=>{const u=ge.fromJSON(s);return this.queryFeaturesJSON(u,d)}}}),[o.port2]})},this.type="knowledge-graph-sublayer",e.parentCompositeLayer.type==="link-chart")e.graphType==="relationship"?this.geometryType="polyline":this.geometryType="point",this.geometryFieldName=O;else if((t=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name))!=null&&t.geometryType&&((r=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name))==null?void 0:r.geometryType)!=="esriGeometryNull"){const o=e.parentCompositeLayer.dataManager.geographicLookup.get(e.objectType.name);this.geometryFieldName=(o==null?void 0:o.name)??null,this.geometryType=o!=null&&o.geometryType?me.fromJSON(o.geometryType):null;const s=o==null?void 0:o.name,d=s?(i=e.objectType.properties)==null?void 0:i[s]:null;d?(this.hasM=d.hasM??!1,this.hasZ=d.hasZ??!1):(this.hasM=!1,this.hasZ=!1)}else this.geometryType=null;(n=e.objectType.properties)==null||n.forEach(o=>{let s=null,d=o.fieldType;d==="esriFieldTypeOID"&&(d="esriFieldTypeInteger"),this.fields.push(St.fromJSON({name:o.name,type:d,alias:o.alias,defaultValue:s,editable:o.editable,nullable:o.nullable}))}),this.fields.push(St.fromJSON({name:this.objectIdField,type:"esriFieldTypeString",alias:this.objectIdField,editable:!1})),this._set("fields",[...this.fields]),(a=e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel)!=null&&a.spatialReference&&(this.spatialReference=e.parentCompositeLayer.dataManager.knowledgeGraph.dataModel.spatialReference),e.parentCompositeLayer.type==="link-chart"?e.graphType==="relationship"?this.renderer=We(Ve(me.toJSON("polyline")).renderer):this.renderer=We(Ve(me.toJSON("point")).renderer):this.renderer=We(Ve(me.toJSON(this.geometryType)).renderer)}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Er(e,this.fieldsIndex),this._set("renderer",e)}createPopupTemplate(e){return kr(this,e)}createQuery(){return new ge({where:"1=1",outFields:["*"]})}getField(e){for(let t=0;t{a.sourceLayer=this}),n}async queryFeaturesJSON(e,t){const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return await i.executeQuery(r.toJSON(),t==null?void 0:t.signal)}async queryFeatureCount(e,t){const{resolvedQuery:r,queryEngine:i}=await this._setupQueryObjects(e);return i.executeQueryForCount(r.toJSON(),t==null?void 0:t.signal)}async queryExtent(e={},t){var s,d,u,c;const r={...e,returnGeometry:!0},{resolvedQuery:i,queryEngine:n}=await this._setupQueryObjects(r),a=await n.executeQueryForExtent(i.toJSON(),t==null?void 0:t.signal);let o;return o=((s=a.extent)==null?void 0:s.xmin)!=null&&((d=a.extent)==null?void 0:d.xmax)!=null&&((u=a.extent)==null?void 0:u.ymin)!=null&&((c=a.extent)==null?void 0:c.ymax)!=null?new Re(a.extent):new Re,{count:a.count,extent:o}}async queryObjectIds(e,t){const r=ge.from(e);let i;if(this.parentCompositeLayer.type==="link-chart"&&this._cachedQueryEngine)i=this._cachedQueryEngine;else{const n=await this.parentCompositeLayer.dataManager.getData(r,this,t);i=this.loadQueryEngine(n)}return i.executeQueryForIds(r.toJSON(),t==null?void 0:t.signal)}loadQueryEngine(e){const t=new Ir({geometryType:me.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ}),r=new Lr({fieldsIndex:this.fieldsIndex.toJSON(),geometryType:me.toJSON(this.geometryType),hasM:this.hasM,hasZ:this.hasZ,objectIdField:this.objectIdField,spatialReference:this.spatialReference.toJSON(),timeInfo:null,featureStore:t});return r.featureStore.addMany(e),r}async refreshCachedQueryEngine(){const e=await this.parentCompositeLayer.dataManager.getData(new ge({where:"1=1",outFields:[D]}),this);this._cachedQueryEngine=this.loadQueryEngine(e)}async _setupQueryObjects(e,t){var a;const r=ge.from(e),i=r.geometry;let n;if(i&&!((a=i.spatialReference)!=null&&a.isWGS84)&&(await Kt(i.spatialReference,De),r.geometry=st(i instanceof Se||i instanceof ye?i:i.extent,De)),this.parentCompositeLayer.type==="link-chart"&&this._cachedQueryEngine)n=this._cachedQueryEngine;else{const o=await this.parentCompositeLayer.dataManager.getData(r,this,t);n=this.loadQueryEngine(o)}return{resolvedQuery:r,queryEngine:n}}};l([p()],$.prototype,"capabilities",void 0),l([p({readOnly:!0})],$.prototype,"defaultPopupTemplate",null),l([p()],$.prototype,"definitionExpression",void 0),l([p()],$.prototype,"displayField",void 0),l([p()],$.prototype,"elevationInfo",void 0),l([p()],$.prototype,"geometryType",void 0),l([p()],$.prototype,"geometryFieldName",void 0),l([p()],$.prototype,"graphType",void 0),l([p()],$.prototype,"hasM",void 0),l([p()],$.prototype,"hasZ",void 0),l([p()],$.prototype,"labelsVisible",void 0),l([p()],$.prototype,"labelingInfo",void 0),l([p()],$.prototype,"objectIdField",void 0),l([p()],$.prototype,"objectType",void 0),l([p()],$.prototype,"parentCompositeLayer",void 0),l([p({type:Mr,json:{name:"popupInfo",write:!0}})],$.prototype,"popupTemplate",void 0),l([p({types:xr,json:{write:{target:"layerDefinition.drawingInfo.renderer"}}})],$.prototype,"renderer",null),l([p()],$.prototype,"source",void 0),l([p({json:{read:!1}})],$.prototype,"type",void 0),$=l([R("esri.layers.knowledgeGraph.KnowledgeGraphSublayer")],$);const it=$;let nt,H=null;function ki(){return nt||(nt=at(()=>import("./lclayout-osE6VX-O.js"),__vite__mapDeps([4,1,2])).then(e=>e.l).then(({default:e})=>e({locateFile:t=>ot(`esri/libs/linkchartlayout/${t}`)})).then(e=>{Mi(e)}),nt)}function Mi(e){H=e}var re;function fe(e,t,r,i,n,a){const o=r.length,s=n.length,d=Float64Array.BYTES_PER_ELEMENT,u=Uint32Array.BYTES_PER_ELEMENT,c=Uint8Array.BYTES_PER_ELEMENT,m=16,g=m-1+o*(c+2*d)+s*(2*u),h=H._malloc(g);try{const E=h+m-h%m,w=E+o*d,y=w+o*d,b=y+s*u,I=b+s*u,Q=()=>[H.HEAPF64.subarray(E>>3,(E>>3)+o),H.HEAPF64.subarray(w>>3,(w>>3)+o),H.HEAPU32.subarray(y>>2,(y>>2)+s),H.HEAPU32.subarray(b>>2,(b>>2)+s),H.HEAPU8.subarray(I,I+o)],[k,J,X,f,x]=Q();k.set(r),J.set(i),X.set(n),f.set(a),x.set(t);const L=e(o,I,E,w,s,y,b),[ee,K,M,S,B]=Q();return r.set(ee),i.set(K),n.set(M),a.set(S),t.set(B),L}finally{H._free(h)}}(function(e){e[e.None=0]="None",e[e.IsMovable=1]="IsMovable",e[e.IsGeographic=2]="IsGeographic",e[e.IsRoot=4]="IsRoot"})(re||(re={}));const qt=2,Yt=1,Bt=-1;var mt,ft,gt,wt,_t,bt,Ht,Jt;(function(e){function t(){return H.getMinIdealEdgeLength()}function r(i,n,a,o,s,d=qt,u=Yt,c=Bt){return fe((m,g,h,E,w,y,b)=>H.applyForceDirectedLayout(m,g,h,E,w,y,b,d,u,c),i,n,a,o,s)}e.getMinIdealEdgeLength=t,e.apply=r})(mt||(mt={})),function(e){function t(r,i,n,a,o,s=qt,d=Yt,u=Bt){return fe((c,m,g,h,E,w,y)=>H.applyCommunityLayout(c,m,g,h,E,w,y,s,d,u),r,i,n,a,o)}e.apply=t}(ft||(ft={})),function(e){function t(r,i,n,a,o){return fe(H.applySimpleLayout,r,i,n,a,o)}e.apply=t}(gt||(gt={})),function(e){function t(r,i,n,a,o){return fe(H.applyHierarchicalLayout,r,i,n,a,o)}e.apply=t}(wt||(wt={})),function(e){function t(r,i,n,a,o){return fe(H.applyRadialTreeLayout,r,i,n,a,o)}e.apply=t}(_t||(_t={})),function(e){function t(r,i,n,a,o){return fe(H.applySmartTreeLayout,r,i,n,a,o)}e.apply=t}(bt||(bt={})),function(e){e[e.Undirected=0]="Undirected",e[e.Directed=1]="Directed",e[e.Reversed=2]="Reversed"}(Ht||(Ht={})),function(e){e[e.ByCC_Raw=0]="ByCC_Raw",e[e.ByCC_NormalizeGlobally=1]="ByCC_NormalizeGlobally",e[e.ByCC_NormalizeByCC=2]="ByCC_NormalizeByCC"}(Jt||(Jt={}));const xi=(e,t,r)=>(e.has(t)||e.set(t,r()),e.get(t));let Y=class extends Zt(Xt(er)){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this._currentLinkChartConfig={layoutMode:"RADIAL_TREE",xScaleFactor:1,yScaleFactor:1},this._graphTypeLookup=new Map,this.knowledgeGraph=null,this.layers=new Nt,this.linkChartDiagramLookup=new Map,this.linkChartExtent=new Re({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.linkChartGeohashLookup=new Map,this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.sublayerIdsCache=new Map,this.tables=new Nt,this.type="link-chart",this._originalInclusionList=e.inclusionModeDefinition,e.dataPreloadedInLocalCache&&!e.inclusionModeDefinition)throw new _("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it")}normalizeCtorArgs(e){return{url:e.url,title:e.title,dataPreloadedInLocalCache:e.dataPreloadedInLocalCache,defaultLinkChartConfig:e.defaultLinkChartConfig}}_initializeLayerProperties(e){var a,o,s,d,u,c;if(!this.title&&this.url){const m=this.url.split("/");this.title=m[m.length-2]}const t=new Set;let r=[],i=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new _("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");(a=e.knowledgeGraph.dataModel.entityTypes)==null||a.forEach(m=>{m.name&&this._graphTypeLookup.set(m.name,m)}),(o=e.knowledgeGraph.dataModel.relationshipTypes)==null||o.forEach(m=>{m.name&&this._graphTypeLookup.set(m.name,m)}),(s=e.inclusionModeDefinition)!=null&&s.generateAllSublayers?(r=e.knowledgeGraph.dataModel.entityTypes??[],i=e.knowledgeGraph.dataModel.relationshipTypes??[]):(d=e.inclusionModeDefinition)!=null&&d.namedTypeDefinitions&&((u=e.inclusionModeDefinition)==null?void 0:u.namedTypeDefinitions.size)>0?(c=e.inclusionModeDefinition)==null||c.namedTypeDefinitions.forEach((m,g)=>{var h,E;if(!this._graphTypeLookup.get(g))return Ee.getLogger(this).warn(`A named type, ${g}, was in the inclusion list that wasn't in the data model and will be removed`),void((h=e.inclusionModeDefinition)==null?void 0:h.namedTypeDefinitions.delete(g));this._graphTypeLookup.get(g)instanceof kt||"strictOrigin"in this._graphTypeLookup.get(g)?t.has(g)||(t.add(g),i.push(this._graphTypeLookup.get(g))):this._graphTypeLookup.get(g)instanceof Et||"properties"in this._graphTypeLookup.get(g)?t.has(g)||(t.add(g),r.push(this._graphTypeLookup.get(g))):(Ee.getLogger(this).warn(`A named type, ${g}, was in the inclusion list that wasn't properly modeled and will be removed`),(E=e.inclusionModeDefinition)==null||E.namedTypeDefinitions.delete(g))}):(r=e.knowledgeGraph.dataModel.entityTypes??[],i=e.knowledgeGraph.dataModel.relationshipTypes??[]);const n=new te({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=r,this.memberRelationshipTypes=i,this.dataManager=n}load(e){return this.addResolvingPromise(new Promise(t=>{hi(this.url).then(r=>{var i,n,a,o,s,d;if(this._initializeLayerProperties({knowledgeGraph:r,inclusionModeDefinition:this._originalInclusionList}),(n=(i=this.dataManager.inclusionModeDefinition)==null?void 0:i.namedTypeDefinitions)!=null&&n.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},(a=this.dataManager.knowledgeGraph.dataModel.entityTypes)==null||a.forEach(u=>{var c;u.name&&((c=this.dataManager.inclusionModeDefinition)==null||c.namedTypeDefinitions.set(u.name,{useAllData:!0}))}),(o=this.dataManager.knowledgeGraph.dataModel.relationshipTypes)==null||o.forEach(u=>{var c;u.name&&((c=this.dataManager.inclusionModeDefinition)==null||c.namedTypeDefinitions.set(u.name,{useAllData:!0}))})),this.dataPreloadedInLocalCache)this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),(s=this.dataManager.inclusionModeDefinition)==null||s.namedTypeDefinitions.forEach(u=>{var c;u.useAllData=!1,(c=u.members)==null||c.forEach(m=>{let g;g=m.linkChartLocation instanceof $t?m.linkChartLocation:m.linkChartLocation?le(m.linkChartLocation):null,this.linkChartDiagramLookup.set(m.id,g),g&&g.coords.length===2&&g.lengths.length===0?this.linkChartGeohashLookup.set(m.id,ue(g.coords[1],g.coords[0],ce)):this.linkChartGeohashLookup.set(m.id,"")}),this.addResolvingPromise(this._initializeDiagram().then(async()=>{this.layers.forEach(async m=>{await m.refreshCachedQueryEngine()}),this.tables.forEach(async m=>{await m.refreshCachedQueryEngine()})}))});else{const u=((d=this.defaultLinkChartConfig)==null?void 0:d.layoutMode)==="GEOGRAPHIC";this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,u,!0).then(async()=>{Cr(e);const c=[],m=[];this.loadLayerAssumingLocalCache(),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1,this.dataManager.inclusionModeDefinition.namedTypeDefinitions.forEach(g=>{g.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach(g=>{m.push(g.refreshCachedQueryEngine()),c.push(new Promise(h=>{g.on("layerview-create",()=>{h(null)})}))}),this.tables.forEach(g=>{m.push(g.refreshCachedQueryEngine())}),await Promise.all(m)}))}t(null)})})),Promise.resolve(this)}async addRecords(e,t){let r=[];t!=null&&t.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(r=await Ti(e,this.dataManager.knowledgeGraph));const i=e.concat(r).filter(n=>{var a;return!((a=this.sublayerIdsCache.get(n.typeName))!=null&&a.has(n.id))});await this._handleNewRecords(i)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:r=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1}){var a,o,s,d,u,c,m,g;let i=[];for(const h of e)((s=(o=(a=this.dataManager.inclusionModeDefinition)==null?void 0:a.namedTypeDefinitions)==null?void 0:o.get(h.typeName))==null?void 0:s.useAllData)===!1&&((m=(c=(u=(d=this.dataManager.inclusionModeDefinition)==null?void 0:d.namedTypeDefinitions)==null?void 0:u.get(h.typeName))==null?void 0:c.members)!=null&&m.has(h.id))&&i.push(h);if(t){const h=new Set,E=[];for(const w of i)if(this.dataManager.nodeConnectionsLookup.has(w.id))for(const y of this.dataManager.nodeConnectionsLookup.get(w.id))h.add(y);for(const w of h)this.dataManager.memberIdTypeLookup.has(w)&&E.push({id:w,typeName:this.dataManager.memberIdTypeLookup.get(w)});i=i.concat(E)}this.dataManager.removeFromLayer(i);for(const h of i)(g=this.sublayerIdsCache.get(h.typeName))==null||g.delete(h.id),this.linkChartDiagramLookup.delete(h.id);r&&await this.calculateLinkChartLayout(this._currentLinkChartConfig.layoutMode,{xScaleFactor:this._currentLinkChartConfig.xScaleFactor,yScaleFactor:this._currentLinkChartConfig.xScaleFactor});const n=[];return this.layers.forEach(h=>{n.push(h.refreshCachedQueryEngine())}),await Promise.all(n),this._refreshNamedTypes(),i}async expand(e){const t=await this.dataManager.getConnectedRecordIds(e),r=t.filter(i=>{var n;return!((n=this.sublayerIdsCache.get(i.typeName))!=null&&n.has(i.id))});return await this._handleNewRecords(t),{records:r}}loadLayerAssumingLocalCache(){var e,t;this.memberRelationshipTypes.forEach(r=>{const i=new it({objectType:r,parentCompositeLayer:this,graphType:"relationship",title:r.name});i.geometryType?this.layers.push(i):this.tables.push(i),this.dataManager.sublayerCaches.has(r.name)||this.dataManager.sublayerCaches.set(r.name,new Map)}),this.memberEntityTypes.forEach(r=>{const i=new it({objectType:r,parentCompositeLayer:this,graphType:"entity",title:r.name});i.geometryType?this.layers.push(i):this.tables.push(i),this.dataManager.sublayerCaches.has(r.name)||this.dataManager.sublayerCaches.set(r.name,new Map)}),(e=this.dataManager.inclusionModeDefinition)!=null&&e.namedTypeDefinitions&&((t=this.dataManager.inclusionModeDefinition)==null||t.namedTypeDefinitions.forEach((r,i)=>{var a;const n=xi(this.sublayerIdsCache,i,()=>new Set);(a=r.members)==null||a.forEach(o=>{if(n.add(o.id),o.linkChartLocation)if(o.linkChartLocation instanceof $t)this.linkChartDiagramLookup.set(o.id,o.linkChartLocation),o.linkChartLocation.coords.length===2&&o.linkChartLocation.lengths.length===0?this.linkChartGeohashLookup.set(o.id,ue(o.linkChartLocation.coords[1],o.linkChartLocation.coords[0],ce)):this.linkChartGeohashLookup.set(o.id,"");else{const s=le(o.linkChartLocation);this.linkChartDiagramLookup.set(o.id,o.linkChartLocation?s:null),"x"in o.linkChartLocation&&"y"in o.linkChartLocation?this.linkChartGeohashLookup.set(o.id,ue(o.linkChartLocation.x,o.linkChartLocation.y,ce)):this.linkChartGeohashLookup.set(o.id,"")}})}))}async calculateLinkChartLayout(e="RADIAL_TREE",t){const r=[],i=[];this.dataManager.sublayerCaches.forEach((f,x)=>{this.dataManager.entityTypeNames.has(x)?f.forEach(L=>{r.push({typeName:x,feature:L})}):this.dataManager.relationshipTypeNames.has(x)&&f.forEach(L=>{i.push({typeName:x,feature:L})})}),this.linkChartDiagramLookup=new Map;const n=new Map,a=new Map,o=new Map,s=new Map,d=new Uint8Array(r.length),u=new Float64Array(r.length),c=new Float64Array(r.length),m=new Uint32Array(i.length),g=new Uint32Array(i.length),h=[],E="FORCE_DIRECTED",w=(t==null?void 0:t.xScaleFactor)??1,y=(t==null?void 0:t.yScaleFactor)??1,b=new Re({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let I,Q="FORCE_DIRECTED",k=0,J=0;switch(Q=e==="GEOGRAPHIC"?E:e,Q){case"FORCE_DIRECTED":I=mt.apply;break;case"COMMUNITY":I=ft.apply;break;case"HIERARCHICAL":I=wt.apply;break;case"RADIAL_TREE":I=_t.apply;break;case"SMART_TREE":I=bt.apply;break;default:I=gt.apply}r.forEach(({typeName:f,feature:x})=>{var L,ee,K;if((L=t==null?void 0:t.lockedNodeLocations)!=null&&L.has(x.attributes[D])){e==="GEOGRAPHIC"&&this.dataManager.geographicLookup.has(f)?d[k]=re.IsGeographic:d[k]=re.None;const M=t.lockedNodeLocations.get(x.attributes[D]);u[k]=M.x,c[k]=M.y}else if(e==="GEOGRAPHIC"&&this.dataManager.geographicLookup.has(f)){d[k]=re.IsGeographic;let M=null;const S=x.attributes[this.dataManager.geographicLookup.get(f).name];switch((ee=this.dataManager.geographicLookup.get(f))==null?void 0:ee.geometryType){case"esriGeometryPoint":u[k]=S==null?void 0:S.x,c[k]=S==null?void 0:S.y;break;case"esriGeometryPolygon":M=S==null?void 0:S.centroid,(M==null?void 0:M.x)!=null&&(M==null?void 0:M.y)!=null?(u[k]=M.x,c[k]=M.y):d[k]=re.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":M=(K=S==null?void 0:S.extent)==null?void 0:K.center,(M==null?void 0:M.x)!=null&&(M==null?void 0:M.y)!=null?(u[k]=M.x,c[k]=M.y):d[k]=re.IsMovable;break;default:d[k]=re.IsMovable}(u[k]==null||c[k]==null||Number.isNaN(u[k])||Number.isNaN(c[k]))&&(d[k]=re.IsMovable,u[k]=0,c[k]=0)}else d[k]=re.IsMovable,u[k]=0,c[k]=0;s.set(x.attributes[D],k),h[k]={feature:x,typeName:f},k++});let X=!1;if(i.forEach(f=>{const x=s.get(f.feature.attributes[Ce]),L=s.get(f.feature.attributes[rt]);x!==void 0&&L!==void 0?(m[J]=x,g[J]=L,J++):(X=!0,this.linkChartDiagramLookup.set(f.feature.attributes[Ce],null),this.linkChartGeohashLookup.set(f.feature.attributes[Ce],null))}),X&&Ee.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null"),await ki(),!I(d,u,c,m,g))throw new _("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");for(let f=0;f84.9999&&(c[f]=84.9999),c[f]<-84.9999&&(c[f]=-84.9999),u[f]>179.9999&&(u[f]=179.9999),u[f]<-179.9999&&(u[f]=-179.9999),h[f].feature.attributes[O]=new Ge(u[f],c[f]),n.has(h[f].typeName)){const L=n.get(h[f].typeName);L==null||L.set(h[f].feature.attributes[D],h[f].feature)}else{const L=new Map;L.set(h[f].feature.attributes[D],h[f].feature),n.set(h[f].typeName,L)}o.set(h[f].feature.attributes[D],h[f].feature);const x=le(h[f].feature.attributes[O]);this.linkChartDiagramLookup.set(h[f].feature.attributes[D],h[f].feature.attributes[O]?x:null),this.linkChartGeohashLookup.set(h[f].feature.attributes[D],ue(h[f].feature.attributes[O].y,h[f].feature.attributes[O].x,ce)),h[f].feature.attributes[O].xb.xmax&&(b.xmax=h[f].feature.attributes[O].x),h[f].feature.attributes[O].yb.ymax&&(b.ymax=h[f].feature.attributes[O].y)}return this.linkChartExtent.xmin=b.xmin,this.linkChartExtent.xmax=b.xmax,this.linkChartExtent.ymin=b.ymin,this.linkChartExtent.ymax=b.ymax,i.forEach(f=>{var M,S;const x=(M=h[s.get(f.feature.attributes[Ce])])==null?void 0:M.feature.attributes[O],L=(S=h[s.get(f.feature.attributes[rt])])==null?void 0:S.feature.attributes[O];if(!x||!L)return;const ee=new ye({paths:[[x.x,x.y],[L.x,L.y]]});if(f.feature.attributes[O]=ee,a.has(f.typeName)){const B=a.get(f.typeName);B==null||B.set(f.feature.attributes[D],f.feature)}else{const B=new Map;B.set(f.feature.attributes[D],f.feature),a.set(f.typeName,B)}o.set(f.feature.attributes[D],f.feature);const K=le(f.feature.attributes[O]);this.linkChartDiagramLookup.set(f.feature.attributes[D],f.feature.attributes[O]?K:null),this.linkChartGeohashLookup.set(f.feature.attributes[D],"")}),this._currentLinkChartConfig={layoutMode:e,xScaleFactor:w,yScaleFactor:y},{nodes:n,links:a,idMap:o}}async applyNewLinkChartLayout(e="RADIAL_TREE",t){const r=[];await this.calculateLinkChartLayout(e,t),this.layers.forEach(i=>{r.push(i.refreshCachedQueryEngine())}),await Promise.all(r),this._refreshNamedTypes()}getCurrentNodeLocations(){var t,r;const e=new Map;return(r=(t=this.dataManager.inclusionModeDefinition)==null?void 0:t.namedTypeDefinitions)==null||r.forEach(i=>{var n;(n=i==null?void 0:i.members)==null||n.forEach(a=>{const o=a.linkChartLocation;let s;const d=a.id;o&&(s="x"in o?{x:o.x,y:o.y}:{x:o.coords[0],y:o.coords[1]},e.set(d,new Ge({x:s.x,y:s.y})))})}),e}async synchronizeInclusionListWithCache(){return new Promise(e=>{var t;(t=this.dataManager.inclusionModeDefinition)==null||t.namedTypeDefinitions.forEach((r,i)=>{if(r.useAllData=!1,r.members&&r.members.size>0){if(!this.dataManager.sublayerCaches.get(i))return;const n=new Set(Array.from(this.dataManager.sublayerCaches.get(i).keys()));Array.from(r.members.keys()).filter(a=>!n.has(a)).forEach(a=>{var o;(o=r.members)==null||o.delete(a)})}}),e()})}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach(r=>{t.push(r.refreshCachedQueryEngine())}),await Promise.all(t),this._refreshNamedTypes()}async _handleNewRecords(e){const t=[];this.dataManager.addToLayer(e);for(const r of e)this.sublayerIdsCache.has(r.typeName)||(this.sublayerIdsCache.set(r.typeName,new Set),t.push(r.typeName)),this.sublayerIdsCache.get(r.typeName).add(r.id);for(const r of t)if(this._graphTypeLookup.has(r)){const i=this._graphTypeLookup.get(r),n="endPoints"in i?"relationship":"entity",a=new it({objectType:i,parentCompositeLayer:this,graphType:n,title:r});n==="entity"?this.dataManager.entityTypeNames.add(r):this.dataManager.relationshipTypeNames.add(r),a.geometryType?this.layers.push(a):this.tables.push(a),this.dataManager.sublayerCaches.set(r,new Map)}await this.dataManager.refreshCacheContent(e.map(r=>r.id)),await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,{xScaleFactor:this._currentLinkChartConfig.xScaleFactor,yScaleFactor:this._currentLinkChartConfig.xScaleFactor})}async _initializeDiagram(){var e,t;this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?((t=(e=this.dataManager.inclusionModeDefinition)==null?void 0:e.namedTypeDefinitions)==null||t.forEach(r=>{var i;(i=r==null?void 0:r.members)==null||i.forEach(n=>{const a=n.linkChartLocation;let o;const s=n.id;if(!a)return;o="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const d=le(o);this.linkChartDiagramLookup.set(s,d),this.linkChartGeohashLookup.set(s,ue(o.x,o.y,ce)),this.linkChartExtent.xmin>o.x&&(this.linkChartExtent.xmin=o.x),this.linkChartExtent.xmaxo.y&&(this.linkChartExtent.ymin=o.y),this.linkChartExtent.ymax{var i;r.name&&((i=this.dataManager.sublayerCaches.get(r.name))==null||i.forEach(n=>{const a=this.linkChartDiagramLookup.get(n.attributes[Ce]),o=this.linkChartDiagramLookup.get(n.attributes[rt]);if(a&&o){const s=le(new ye({paths:[[a.coords[0],a.coords[1]],[o.coords[0],o.coords[1]]]}));this.linkChartDiagramLookup.set(n.attributes[D],s)}else this.linkChartDiagramLookup.set(n.attributes[D],null);this.linkChartGeohashLookup.set(n.attributes[D],"")}))})):await this.calculateLinkChartLayout(this.defaultLinkChartConfig.layoutMode,{xScaleFactor:this.defaultLinkChartConfig.xScaleFactor,yScaleFactor:this.defaultLinkChartConfig.yScaleFactor,lockedNodeLocations:this.getCurrentNodeLocations()}):await this.calculateLinkChartLayout("RADIAL_TREE",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}};l([p()],Y.prototype,"dataPreloadedInLocalCache",void 0),l([p()],Y.prototype,"defaultLinkChartConfig",void 0),l([p()],Y.prototype,"dataManager",void 0),l([p()],Y.prototype,"knowledgeGraph",void 0),l([p()],Y.prototype,"layers",void 0),l([p()],Y.prototype,"linkChartDiagramLookup",void 0),l([p()],Y.prototype,"linkChartExtent",void 0),l([p()],Y.prototype,"linkChartGeohashLookup",void 0),l([p()],Y.prototype,"memberEntityTypes",void 0),l([p()],Y.prototype,"memberRelationshipTypes",void 0),l([p()],Y.prototype,"sublayerIdsCache",void 0),l([p()],Y.prototype,"tables",void 0),l([p({json:{read:!1}})],Y.prototype,"type",void 0),Y=l([R("esri.layers.LinkChartLayer")],Y);const un=Y;export{un as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/arcgis-knowledge-client-core-simd-wFoqgd0S.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/arcgis-knowledge-client-core-k0_SaRI-.js","assets/lclayout-osE6VX-O.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/MapImageLayer-oZq_Q4o2.js b/dist/assets/MapImageLayer-oZq_Q4o2.js new file mode 100644 index 0000000..5afdc70 --- /dev/null +++ b/dist/assets/MapImageLayer-oZq_Q4o2.js @@ -0,0 +1 @@ +import{dF as $,ee as I,dJ as w,ef as T,dH as O,dI as E,dK as M,dG as R,eg as F,dL as L,eh as v,ei as g,ej as b,ek as j,el as P,em as J,en as q,av as f,dO as N,eo as U,ep as A,r as x,ac as _,e as i,y as n,eq as S,dt as k,du as V,dR as z,c as G,er as H,aI as K}from"./index-pCX-0tJH.js";import{E as Z,f as B,X as C}from"./SublayersOwner-Hx1szNtg.js";import{o as D}from"./CustomParametersMixin-7nmugR3Y.js";import{e as W}from"./versionUtils-idhrDltC.js";import"./QueryTask-Di0fqnMV.js";import"./executeForIds-PXSIkRGk.js";import"./executeQueryPBF-P21isUTI.js";import"./FeatureType-0WPvBvpQ.js";import"./FeatureTemplate-vSzbyslg.js";import"./serviceCapabilitiesUtils-f-iBP4uh.js";let s=class extends $(I(w(Z(B(T(O(E(M(R(F(D(K)))))))))))){constructor(...e){super(...e),this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.dpi=96,this.gdbVersion=null,this.imageFormat="png24",this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.isReference=null,this.labelsVisible=!1,this.operationalLayerType="ArcGISMapServiceLayer",this.preferredTimeZone=null,this.sourceJSON=null,this.sublayers=null,this.type="map-image",this.url=null}normalizeCtorArgs(e,a){return typeof e=="string"?{url:e,...a}:e}load(e){const a=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service"]},e).catch(L).then(()=>this._fetchService(a))),Promise.resolve(this)}readImageFormat(e,a){const p=a.supportedImageFormatTypes;return p&&p.includes("PNG32")?"png32":"png24"}writeSublayers(e,a,p,t){var h;if(!this.loaded||!e)return;const o=e.slice().reverse().flatten(({sublayers:r})=>r&&r.toArray().reverse()).toArray();let l=!1;if(this.capabilities&&this.capabilities.operations.supportsExportMap&&((h=this.capabilities.exportMap)!=null&&h.supportsDynamicLayers)){const r=v(t.origin);if(r===g.PORTAL_ITEM){const m=this.createSublayersForOrigin("service").sublayers;l=b(o,m,g.SERVICE)}else if(r>g.PORTAL_ITEM){const m=this.createSublayersForOrigin("portal-item");l=b(o,m.sublayers,v(m.origin))}}const d=[],y={writeSublayerStructure:l,...t};let c=l;o.forEach(r=>{const m=r.write({},y);d.push(m),c=c||r.originOf("visible")==="user"}),d.some(r=>Object.keys(r).length>1)&&(a.layers=d),c&&(a.visibleLayers=o.filter(r=>r.visible).map(r=>r.id))}createExportImageParameters(e,a,p,t){const o=(t==null?void 0:t.pixelRatio)||1;e&&this.version>=10&&(e=e.clone().shiftCentralMeridian());const l=new j({layer:this,floors:t==null?void 0:t.floors,scale:P({extent:e,width:a})*o}),d=l.toJSON();l.destroy();const y=!(t!=null&&t.rotation)||this.version<10.3?{}:{rotation:-t.rotation},c=e==null?void 0:e.spatialReference,h=J(c);d.dpi*=o;const r={};if(t!=null&&t.timeExtent){const{start:m,end:u}=t.timeExtent.toJSON();r.time=m&&u&&m===u?""+m:`${m??"null"},${u??"null"}`}else this.timeInfo&&!this.timeInfo.hasLiveData&&(r.time="null,null");return{bbox:e&&e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:h,imageSR:h,size:a+","+p,...d,...y,...r}}async fetchImage(e,a,p,t){const{data:o}=await this._fetchImage("image",e,a,p,t);return o}async fetchImageBitmap(e,a,p,t){const{data:o,url:l}=await this._fetchImage("blob",e,a,p,t);return q(o,l,t==null?void 0:t.signal)}async fetchRecomputedExtents(e={}){const a={...e,query:{returnUpdates:!0,f:"json",...this.customParameters,token:this.apiKey}},{data:p}=await f(this.url,a),{extent:t,fullExtent:o,timeExtent:l}=p,d=t||o;return{fullExtent:d&&N.fromJSON(d),timeExtent:l&&U.fromJSON({start:l[0],end:l[1]})}}loadAll(){return A(this,e=>{e(this.allSublayers)})}serviceSupportsSpatialReference(e){return W(this,e)}async _fetchImage(e,a,p,t,o){var y,c,h;const l={responseType:e,signal:(o==null?void 0:o.signal)??null,query:{...this.parsedUrl.query,...this.createExportImageParameters(a,p,t,o),f:"image",...this.refreshParameters,...this.customParameters,token:this.apiKey}},d=this.parsedUrl.path+"/export";if(((y=l.query)==null?void 0:y.dynamicLayers)!=null&&!((h=(c=this.capabilities)==null?void 0:c.exportMap)!=null&&h.supportsDynamicLayers))throw new x("mapimagelayer:dynamiclayer-not-supported",`service ${this.url} doesn't support dynamic layers, which is required to be able to change the sublayer's order, rendering, labeling or source.`,{query:l.query});try{const{data:r}=await f(d,l);return{data:r,url:d}}catch(r){throw _(r)?r:new x("mapimagelayer:image-fetch-error",`Unable to load image: ${d}`,{error:r})}}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:a,ssl:p}=await f(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},signal:e});p&&(this.url=this.url.replace(/^http:/i,"https:")),this.sourceJSON=a,this.read(a,{origin:"service",url:this.parsedUrl})}};i([n(S("dateFieldsTimeReference"))],s.prototype,"dateFieldsTimeZone",void 0),i([n({type:Boolean})],s.prototype,"datesInUnknownTimezone",void 0),i([n()],s.prototype,"dpi",void 0),i([n()],s.prototype,"gdbVersion",void 0),i([n()],s.prototype,"imageFormat",void 0),i([k("imageFormat",["supportedImageFormatTypes"])],s.prototype,"readImageFormat",null),i([n({json:{origins:{service:{read:{source:"maxImageHeight"}}}}})],s.prototype,"imageMaxHeight",void 0),i([n({json:{origins:{service:{read:{source:"maxImageWidth"}}}}})],s.prototype,"imageMaxWidth",void 0),i([n()],s.prototype,"imageTransparency",void 0),i([n({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],s.prototype,"isReference",void 0),i([n({json:{read:!1,write:!1}})],s.prototype,"labelsVisible",void 0),i([n({type:["ArcGISMapServiceLayer"]})],s.prototype,"operationalLayerType",void 0),i([n({json:{read:!1,write:!1}})],s.prototype,"popupEnabled",void 0),i([n(S("preferredTimeReference"))],s.prototype,"preferredTimeZone",void 0),i([n()],s.prototype,"sourceJSON",void 0),i([n({json:{write:{ignoreOrigin:!0}}})],s.prototype,"sublayers",void 0),i([V("sublayers",{layers:{type:[C]},visibleLayers:{type:[H]}})],s.prototype,"writeSublayers",null),i([n({type:["show","hide","hide-children"]})],s.prototype,"listMode",void 0),i([n({json:{read:!1},readOnly:!0,value:"map-image"})],s.prototype,"type",void 0),i([n(z)],s.prototype,"url",void 0),s=i([G("esri.layers.MapImageLayer")],s);const ne=s;export{ne as default}; diff --git a/dist/assets/MapImageLayer-qMOOMfH7.js b/dist/assets/MapImageLayer-qMOOMfH7.js deleted file mode 100644 index 67220e4..0000000 --- a/dist/assets/MapImageLayer-qMOOMfH7.js +++ /dev/null @@ -1 +0,0 @@ -import{dK as $,el as w,dO as I,em as T,dM as E,dN as O,dP as M,dL as L,en as P,dQ as R,eo as v,ep as g,eq as b,er as F,es as j,et as N,eu as q,bW as f,dT as J,ev as U,ew as A,E as x,f as _,e as i,y as n,ex as S,dt as k,du as V,dW as W,c as z,ey as K,c7 as Z}from"./index-J0iiHjMT.js";import{E as B,f as C,X as D}from"./SublayersOwner-8xrm3MkT.js";import{o as G}from"./CustomParametersMixin-Y1bOcayO.js";import{e as H}from"./versionUtils-4v9zIDlv.js";import"./QueryTask-91TvtrTt.js";import"./executeForIds-wXO8-pll.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./executeQueryJSON-ACj9qY0y.js";import"./FeatureSet-d4S1oKME.js";import"./executeQueryPBF-vdaOUMid.js";import"./FeatureType-MpRe7WJj.js";import"./FeatureTemplate-kUgbbA00.js";import"./serviceCapabilitiesUtils-26KpT1VN.js";let s=class extends $(w(I(B(C(T(E(O(M(L(P(G(Z)))))))))))){constructor(...e){super(...e),this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.dpi=96,this.gdbVersion=null,this.imageFormat="png24",this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.isReference=null,this.labelsVisible=!1,this.operationalLayerType="ArcGISMapServiceLayer",this.preferredTimeZone=null,this.sourceJSON=null,this.sublayers=null,this.type="map-image",this.url=null}normalizeCtorArgs(e,a){return typeof e=="string"?{url:e,...a}:e}load(e){const a=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service"]},e).catch(R).then(()=>this._fetchService(a))),Promise.resolve(this)}readImageFormat(e,a){const l=a.supportedImageFormatTypes;return l&&l.includes("PNG32")?"png32":"png24"}writeSublayers(e,a,l,t){var h;if(!this.loaded||!e)return;const o=e.slice().reverse().flatten(({sublayers:r})=>r&&r.toArray().reverse()).toArray();let p=!1;if(this.capabilities&&this.capabilities.operations.supportsExportMap&&((h=this.capabilities.exportMap)!=null&&h.supportsDynamicLayers)){const r=v(t.origin);if(r===g.PORTAL_ITEM){const d=this.createSublayersForOrigin("service").sublayers;p=b(o,d,g.SERVICE)}else if(r>g.PORTAL_ITEM){const d=this.createSublayersForOrigin("portal-item");p=b(o,d.sublayers,v(d.origin))}}const m=[],y={writeSublayerStructure:p,...t};let c=p;o.forEach(r=>{const d=r.write({},y);m.push(d),c=c||r.originOf("visible")==="user"}),m.some(r=>Object.keys(r).length>1)&&(a.layers=m),c&&(a.visibleLayers=o.filter(r=>r.visible).map(r=>r.id))}createExportImageParameters(e,a,l,t){const o=(t==null?void 0:t.pixelRatio)||1;e&&this.version>=10&&(e=e.clone().shiftCentralMeridian());const p=new F({layer:this,floors:t==null?void 0:t.floors,scale:j({extent:e,width:a})*o}),m=p.toJSON();p.destroy();const y=!(t!=null&&t.rotation)||this.version<10.3?{}:{rotation:-t.rotation},c=e==null?void 0:e.spatialReference,h=N(c);m.dpi*=o;const r={};if(t!=null&&t.timeExtent){const{start:d,end:u}=t.timeExtent.toJSON();r.time=d&&u&&d===u?""+d:`${d??"null"},${u??"null"}`}else this.timeInfo&&!this.timeInfo.hasLiveData&&(r.time="null,null");return{bbox:e&&e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:h,imageSR:h,size:a+","+l,...m,...y,...r}}async fetchImage(e,a,l,t){const{data:o}=await this._fetchImage("image",e,a,l,t);return o}async fetchImageBitmap(e,a,l,t){const{data:o,url:p}=await this._fetchImage("blob",e,a,l,t);return q(o,p,t==null?void 0:t.signal)}async fetchRecomputedExtents(e={}){const a={...e,query:{returnUpdates:!0,f:"json",...this.customParameters,token:this.apiKey}},{data:l}=await f(this.url,a),{extent:t,fullExtent:o,timeExtent:p}=l,m=t||o;return{fullExtent:m&&J.fromJSON(m),timeExtent:p&&U.fromJSON({start:p[0],end:p[1]})}}loadAll(){return A(this,e=>{e(this.allSublayers)})}serviceSupportsSpatialReference(e){return H(this,e)}async _fetchImage(e,a,l,t,o){var y,c,h;const p={responseType:e,signal:(o==null?void 0:o.signal)??null,query:{...this.parsedUrl.query,...this.createExportImageParameters(a,l,t,o),f:"image",...this.refreshParameters,...this.customParameters,token:this.apiKey}},m=this.parsedUrl.path+"/export";if(((y=p.query)==null?void 0:y.dynamicLayers)!=null&&!((h=(c=this.capabilities)==null?void 0:c.exportMap)!=null&&h.supportsDynamicLayers))throw new x("mapimagelayer:dynamiclayer-not-supported",`service ${this.url} doesn't support dynamic layers, which is required to be able to change the sublayer's order, rendering, labeling or source.`,{query:p.query});try{const{data:r}=await f(m,p);return{data:r,url:m}}catch(r){throw _(r)?r:new x("mapimagelayer:image-fetch-error",`Unable to load image: ${m}`,{error:r})}}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:a,ssl:l}=await f(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},signal:e});l&&(this.url=this.url.replace(/^http:/i,"https:")),this.sourceJSON=a,this.read(a,{origin:"service",url:this.parsedUrl})}};i([n(S("dateFieldsTimeReference"))],s.prototype,"dateFieldsTimeZone",void 0),i([n({type:Boolean})],s.prototype,"datesInUnknownTimezone",void 0),i([n()],s.prototype,"dpi",void 0),i([n()],s.prototype,"gdbVersion",void 0),i([n()],s.prototype,"imageFormat",void 0),i([k("imageFormat",["supportedImageFormatTypes"])],s.prototype,"readImageFormat",null),i([n({json:{origins:{service:{read:{source:"maxImageHeight"}}}}})],s.prototype,"imageMaxHeight",void 0),i([n({json:{origins:{service:{read:{source:"maxImageWidth"}}}}})],s.prototype,"imageMaxWidth",void 0),i([n()],s.prototype,"imageTransparency",void 0),i([n({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],s.prototype,"isReference",void 0),i([n({json:{read:!1,write:!1}})],s.prototype,"labelsVisible",void 0),i([n({type:["ArcGISMapServiceLayer"]})],s.prototype,"operationalLayerType",void 0),i([n({json:{read:!1,write:!1}})],s.prototype,"popupEnabled",void 0),i([n(S("preferredTimeReference"))],s.prototype,"preferredTimeZone",void 0),i([n()],s.prototype,"sourceJSON",void 0),i([n({json:{write:{ignoreOrigin:!0}}})],s.prototype,"sublayers",void 0),i([V("sublayers",{layers:{type:[D]},visibleLayers:{type:[K]}})],s.prototype,"writeSublayers",null),i([n({type:["show","hide","hide-children"]})],s.prototype,"listMode",void 0),i([n({json:{read:!1},readOnly:!0,value:"map-image"})],s.prototype,"type",void 0),i([n(W)],s.prototype,"url",void 0),s=i([z("esri.layers.MapImageLayer")],s);const he=s;export{he as default}; diff --git a/dist/assets/MapImageLayerView3D-GIO-oWiM.js b/dist/assets/MapImageLayerView3D-XQURj3BI.js similarity index 77% rename from dist/assets/MapImageLayerView3D-GIO-oWiM.js rename to dist/assets/MapImageLayerView3D-XQURj3BI.js index 354d12b..20c8c4d 100644 --- a/dist/assets/MapImageLayerView3D-GIO-oWiM.js +++ b/dist/assets/MapImageLayerView3D-XQURj3BI.js @@ -1 +1 @@ -import{e as i,y as o,jW as a,c as p,er as m}from"./index-J0iiHjMT.js";import{N as n}from"./DynamicLayerView3D-4lztpXo0.js";import{G as l}from"./MapServiceLayerViewHelper-a8WMaeWS.js";import{r as h}from"./drapedUtils-9db1OpTX.js";import"./LayerView3D-iOx2MD1g.js";import"./projectExtentUtils-TwA6ooHn.js";import"./ImageMaterial.glsl-TdPtjVc_.js";import"./LayerView-efDufa6j.js";import"./RefreshableLayerView-Pd4dLcWr.js";const u=t=>{let e=class extends t{initialize(){this.exportImageParameters=new m({layer:this.layer})}destroy(){this.exportImageParameters.destroy(),this.exportImageParameters=null}get floors(){var r;return((r=this.view)==null?void 0:r.floors)??null}get exportImageVersion(){var r;return(r=this.exportImageParameters)==null||r.commitProperty("version"),this.commitProperty("timeExtent"),this.commitProperty("floors"),(this._get("exportImageVersion")||0)+1}canResume(){var r;return!!super.canResume()&&!((r=this.timeExtent)!=null&&r.isEmpty)}};return i([o()],e.prototype,"exportImageParameters",void 0),i([o({readOnly:!0})],e.prototype,"floors",null),i([o({readOnly:!0})],e.prototype,"exportImageVersion",null),i([o()],e.prototype,"layer",void 0),i([o()],e.prototype,"suspended",void 0),i([o(a)],e.prototype,"timeExtent",void 0),e=i([p("esri.views.layers.MapImageLayerView")],e),e};let s=class extends u(n){constructor(){super(...arguments),this.type="map-image-3d"}initialize(){this._updatingHandles.add(()=>this.exportImageVersion,()=>this._updatingHandles.addPromise(this.refreshDebounced())),this._popupHighlightHelper=new l({createFetchPopupFeaturesQueryGeometry:(t,e)=>h(t,e,this.view),layerView:this,updatingHandles:this._updatingHandles})}destroy(){var t;(t=this._popupHighlightHelper)==null||t.destroy()}fetchPopupFeatures(t,e){return this._popupHighlightHelper.fetchPopupFeatures(t,e)}getFetchOptions(){return{timeExtent:this.timeExtent}}};s=i([p("esri.views.3d.layers.MapImageLayerView3D")],s);const v=s;export{v as default}; +import{e as i,y as o,k1 as a,c as p,ek as m}from"./index-pCX-0tJH.js";import{N as n}from"./DynamicLayerView3D-XykdNh09.js";import{G as l}from"./MapServiceLayerViewHelper-45ApjWde.js";import{r as h}from"./drapedUtils-F1ywqHD-.js";import"./LayerView3D-57OghbRh.js";import"./projectExtentUtils-Q4rXasWA.js";import"./ImageMaterial.glsl-PU0wbmEN.js";import"./LayerView-ixwLVnzr.js";import"./RefreshableLayerView-DVYs7L04.js";const u=t=>{let e=class extends t{initialize(){this.exportImageParameters=new m({layer:this.layer})}destroy(){this.exportImageParameters.destroy(),this.exportImageParameters=null}get floors(){var r;return((r=this.view)==null?void 0:r.floors)??null}get exportImageVersion(){var r;return(r=this.exportImageParameters)==null||r.commitProperty("version"),this.commitProperty("timeExtent"),this.commitProperty("floors"),(this._get("exportImageVersion")||0)+1}canResume(){var r;return!!super.canResume()&&!((r=this.timeExtent)!=null&&r.isEmpty)}};return i([o()],e.prototype,"exportImageParameters",void 0),i([o({readOnly:!0})],e.prototype,"floors",null),i([o({readOnly:!0})],e.prototype,"exportImageVersion",null),i([o()],e.prototype,"layer",void 0),i([o()],e.prototype,"suspended",void 0),i([o(a)],e.prototype,"timeExtent",void 0),e=i([p("esri.views.layers.MapImageLayerView")],e),e};let s=class extends u(n){constructor(){super(...arguments),this.type="map-image-3d"}initialize(){this._updatingHandles.add(()=>this.exportImageVersion,()=>this._updatingHandles.addPromise(this.refreshDebounced())),this._popupHighlightHelper=new l({createFetchPopupFeaturesQueryGeometry:(t,e)=>h(t,e,this.view),layerView:this,updatingHandles:this._updatingHandles})}destroy(){var t;(t=this._popupHighlightHelper)==null||t.destroy()}fetchPopupFeatures(t,e){return this._popupHighlightHelper.fetchPopupFeatures(t,e)}getFetchOptions(){return{timeExtent:this.timeExtent}}};s=i([p("esri.views.3d.layers.MapImageLayerView3D")],s);const v=s;export{v as default}; diff --git a/dist/assets/MapNotesLayer-CdG3vHcH.js b/dist/assets/MapNotesLayer-CdG3vHcH.js deleted file mode 100644 index c8181ce..0000000 --- a/dist/assets/MapNotesLayer-CdG3vHcH.js +++ /dev/null @@ -1 +0,0 @@ -import{dw as x,e as i,y as s,c as M,bX as G,a8 as B,J as L,c1 as F,dK as k,dO as z,dM as A,dN as W,dP as K,ar as h,V as w,bI as N,ek as I,ez as J,eA as S,eB as $,eC as D,eD as E,S as U,E as q,dD as H,al as Q,ct as V,d$ as X,e0 as Z,e1 as Y,bN as ee,dm as T,dt as f,du as te,dT as re,Q as oe,c7 as ie}from"./index-J0iiHjMT.js";import le from"./FeatureLayer--S4epFk-.js";import{n as ae}from"./objectIdUtils-GktMsX8e.js";import"./FeatureLayerBase-jpFp8gE3.js";import"./serviceCapabilitiesUtils-26KpT1VN.js";import"./editsZScale-Wgw9kbYG.js";import"./queryZScale-IaMm02_2.js";import"./FeatureSet-d4S1oKME.js";import"./CustomParametersMixin-Y1bOcayO.js";import"./FeatureEffectLayer-oBa8pIG5.js";import"./FeatureEffect-5bEV-xG1.js";import"./FeatureReductionLayer-RlitE1N6.js";import"./OrderedLayer-M7k5gLgx.js";import"./FeatureTemplate-kUgbbA00.js";import"./FeatureType-MpRe7WJj.js";import"./versionUtils-4v9zIDlv.js";import"./TopFeaturesQuery-E6D2tV-x.js";function b(t){return t.featureCollectionType==="markup"||t.layers.some(e=>e.layerDefinition.visibilityField!=null||!R(e))}function R({layerDefinition:t,featureSet:e}){const r=t.geometryType??e.geometryType;return v.find(o=>{var l,n,y;return r===o.geometryTypeJSON&&((y=(n=(l=t.drawingInfo)==null?void 0:l.renderer)==null?void 0:n.symbol)==null?void 0:y.type)===o.identifyingSymbol.type})}function _(){return new re({xmin:-180,ymin:-90,xmax:180,ymax:90})}const C=new x({name:"OBJECTID",alias:"OBJECTID",type:"oid",nullable:!1,editable:!1}),ne=new x({name:"title",alias:"Title",type:"string",nullable:!0,editable:!0,length:255});let u=class extends oe{constructor(t){super(t),this.visibilityMode="inherited"}initialize(){for(const t of this.graphics)t.sourceLayer=this.layer;this.graphics.on("after-add",t=>{t.item.sourceLayer=this.layer}),this.graphics.on("after-remove",t=>{t.item.sourceLayer=null})}get fullExtent(){var r;const t=(r=this.layer)==null?void 0:r.spatialReference,e=this.fullBounds;return t?e==null?S(_(),t).geometry:E(e,t):null}get fullBounds(){var r;const t=(r=this.layer)==null?void 0:r.spatialReference;if(!t)return null;const e=I();return this.graphics.forEach(o=>{const l=o.geometry!=null?S(o.geometry,t).geometry:null;l!=null&&J(e,l.type==="point"?l:l.extent,e)}),$(e,D)?null:e}get sublayers(){return this.graphics}};i([s({readOnly:!0})],u.prototype,"fullExtent",null),i([s({readOnly:!0})],u.prototype,"fullBounds",null),i([s({readOnly:!0})],u.prototype,"sublayers",null),i([s()],u.prototype,"layer",void 0),i([s()],u.prototype,"layerId",void 0),i([s({readOnly:!0})],u.prototype,"visibilityMode",void 0),u=i([M("esri.layers.MapNotesLayer.MapNotesSublayer")],u);const v=[{geometryType:"polygon",geometryTypeJSON:"esriGeometryPolygon",id:"polygonLayer",layerId:0,title:"Polygons",identifyingSymbol:new G().toJSON()},{geometryType:"polyline",geometryTypeJSON:"esriGeometryPolyline",id:"polylineLayer",layerId:1,title:"Polylines",identifyingSymbol:new B().toJSON()},{geometryType:"multipoint",geometryTypeJSON:"esriGeometryMultipoint",id:"multipointLayer",layerId:2,title:"Multipoints",identifyingSymbol:new L().toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"pointLayer",layerId:3,title:"Points",identifyingSymbol:new L().toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"textLayer",layerId:4,title:"Text",identifyingSymbol:new F().toJSON()}];let a=class extends k(z(A(W(K(ie))))){constructor(t){super(t),this.capabilities={operations:{supportsMapNotesEditing:!0}},this.featureCollections=null,this.featureCollectionJSON=null,this.featureCollectionType="notes",this.legendEnabled=!1,this.listMode="hide-children",this.minScale=0,this.maxScale=0,this.spatialReference=h.WGS84,this.sublayers=new w(v.map(e=>new u({id:e.id,layerId:e.layerId,title:e.title,layer:this}))),this.title="Map Notes",this.type="map-notes",this.visibilityMode="inherited"}readCapabilities(t,e,r){return{operations:{supportsMapNotesEditing:!b(e)&&(r==null?void 0:r.origin)!=="portal-item"}}}readFeatureCollections(t,e,r){if(!b(e))return null;const o=e.layers.map(l=>{const n=new le;return n.read(l,r),n});return new w({items:o})}readLegacyfeatureCollectionJSON(t,e){return b(e)?N(e.featureCollection):null}get fullExtent(){var r;const t=this.spatialReference,e=I();return this.sublayers!=null?this.sublayers.forEach(({fullBounds:o})=>o!=null?J(e,o,e):e,e):(r=this.featureCollectionJSON)!=null&&r.layers.some(o=>o.layerDefinition.extent)&&this.featureCollectionJSON.layers.forEach(o=>{const l=S(o.layerDefinition.extent,t).geometry;l!=null&&J(e,l,e)}),$(e,D)?S(_(),t).geometry:E(e,t)}readMinScale(t,e){for(const r of e.layers)if(r.layerDefinition.minScale!=null)return r.layerDefinition.minScale;return 0}readMaxScale(t,e){for(const r of e.layers)if(r.layerDefinition.maxScale!=null)return r.layerDefinition.maxScale;return 0}get multipointLayer(){return this._findSublayer("multipointLayer")}get pointLayer(){return this._findSublayer("pointLayer")}get polygonLayer(){return this._findSublayer("polygonLayer")}get polylineLayer(){return this._findSublayer("polylineLayer")}readSpatialReference(t,e){return e.layers.length?h.fromJSON(e.layers[0].layerDefinition.spatialReference):h.WGS84}readSublayers(t,e,r){if(b(e))return null;const o=[];let l=e.layers.reduce((n,y)=>Math.max(n,y.layerDefinition.id??-1),-1)+1;for(const n of e.layers){const{layerDefinition:y,featureSet:p}=n,d=y.id??l++,m=R(n);if(m!=null){const c=new u({id:m.id,title:y.name,layerId:d,layer:this,graphics:p.features.map(({geometry:g,symbol:O,attributes:j,popupInfo:P})=>U.fromJSON({attributes:j,geometry:g,symbol:O,popupTemplate:P}))});o.push(c)}}return new w(o)}writeSublayers(t,e,r,o){var m;const{minScale:l,maxScale:n}=this;if(t==null)return;const y=t.some(c=>c.graphics.length>0);if(!this.capabilities.operations.supportsMapNotesEditing)return void(y&&((m=o==null?void 0:o.messages)==null?void 0:m.push(new q("map-notes-layer:editing-not-supported","New map notes cannot be added to this layer"))));const p=[];let d=this.spatialReference.toJSON();e:for(const c of t)for(const g of c.graphics)if(g.geometry!=null){d=g.geometry.spatialReference.toJSON();break e}for(const c of v){const g=t.find(O=>c.id===O.id);this._writeMapNoteSublayer(p,g,c,l,n,d,o)}H("featureCollection.layers",p,e)}get textLayer(){return this._findSublayer("textLayer")}load(t){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},t)),Promise.resolve(this)}read(t,e){"featureCollection"in t&&(t=N(t),Object.assign(t,t.featureCollection)),super.read(t,e)}async beforeSave(){if(this.sublayers==null)return;let t=null;const e=[];for(const o of this.sublayers)for(const l of o.graphics)if(l.geometry!=null){const n=l.geometry;t?Q(n.spatialReference,t)||(V(n.spatialReference,t)||X()||await Z(),l.geometry=Y(n,t)):t=n.spatialReference,e.push(l)}const r=await ee(e.map(o=>o.geometry));e.forEach((o,l)=>o.geometry=r[l])}_findSublayer(t){var e;return this.sublayers==null?null:((e=this.sublayers)==null?void 0:e.find(r=>r.id===t))??null}_writeMapNoteSublayer(t,e,r,o,l,n,y){const p=[];if(e!=null){for(const d of e.graphics)this._writeMapNote(p,d,r.geometryType,y);this._normalizeObjectIds(p,C),t.push({layerDefinition:{name:e.title,drawingInfo:{renderer:{type:"simple",symbol:N(r.identifyingSymbol)}},id:e.layerId,geometryType:r.geometryTypeJSON,minScale:o,maxScale:l,objectIdField:"OBJECTID",fields:[C.toJSON(),ne.toJSON()],spatialReference:n},featureSet:{features:p,geometryType:r.geometryTypeJSON}})}}_writeMapNote(t,e,r,o){var d,m;if(e==null)return;const{geometry:l,symbol:n,popupTemplate:y}=e;if(l==null)return;if(l.type!==r)return void((d=o==null?void 0:o.messages)==null?void 0:d.push(new T("map-notes-layer:invalid-geometry-type",`Geometry "${l.type}" cannot be saved in "${r}" layer`,{graphic:e})));if(n==null)return void((m=o==null?void 0:o.messages)==null?void 0:m.push(new T("map-notes-layer:no-symbol","Skipping map notes with no symbol",{graphic:e})));const p={attributes:{...e.attributes},geometry:l.toJSON(),symbol:n.toJSON()};y!=null&&(p.popupInfo=y.toJSON()),t.push(p)}_normalizeObjectIds(t,e){const r=e.name;let o=ae(r,t)+1;const l=new Set;for(const n of t){n.attributes||(n.attributes={});const{attributes:y}=n;(y[r]==null||l.has(y[r]))&&(y[r]=o++),l.add(y[r])}}};i([s({readOnly:!0})],a.prototype,"capabilities",void 0),i([f(["portal-item","web-map"],"capabilities",["layers"])],a.prototype,"readCapabilities",null),i([s({readOnly:!0})],a.prototype,"featureCollections",void 0),i([f(["web-map","portal-item"],"featureCollections",["layers"])],a.prototype,"readFeatureCollections",null),i([s({readOnly:!0,json:{origins:{"web-map":{write:{enabled:!0,target:"featureCollection"}}}}})],a.prototype,"featureCollectionJSON",void 0),i([f(["web-map","portal-item"],"featureCollectionJSON",["featureCollection"])],a.prototype,"readLegacyfeatureCollectionJSON",null),i([s({readOnly:!0,json:{read:!0,write:{enabled:!0,ignoreOrigin:!0}}})],a.prototype,"featureCollectionType",void 0),i([s({readOnly:!0})],a.prototype,"fullExtent",null),i([s({readOnly:!0,json:{origins:{"web-map":{write:{target:"featureCollection.showLegend",overridePolicy(){return{enabled:this.featureCollectionJSON!=null}}}}}}})],a.prototype,"legendEnabled",void 0),i([s({type:["show","hide","hide-children"]})],a.prototype,"listMode",void 0),i([s({type:Number,nonNullable:!0,json:{write:!1}})],a.prototype,"minScale",void 0),i([f(["web-map","portal-item"],"minScale",["layers"])],a.prototype,"readMinScale",null),i([s({type:Number,nonNullable:!0,json:{write:!1}})],a.prototype,"maxScale",void 0),i([f(["web-map","portal-item"],"maxScale",["layers"])],a.prototype,"readMaxScale",null),i([s({readOnly:!0})],a.prototype,"multipointLayer",null),i([s({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],a.prototype,"operationalLayerType",void 0),i([s({readOnly:!0})],a.prototype,"pointLayer",null),i([s({readOnly:!0})],a.prototype,"polygonLayer",null),i([s({readOnly:!0})],a.prototype,"polylineLayer",null),i([s({type:h})],a.prototype,"spatialReference",void 0),i([f(["web-map","portal-item"],"spatialReference",["layers"])],a.prototype,"readSpatialReference",null),i([s({readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],a.prototype,"sublayers",void 0),i([f("web-map","sublayers",["layers"])],a.prototype,"readSublayers",null),i([te("web-map","sublayers")],a.prototype,"writeSublayers",null),i([s({readOnly:!0})],a.prototype,"textLayer",null),i([s()],a.prototype,"title",void 0),i([s({readOnly:!0,json:{read:!1}})],a.prototype,"type",void 0),a=i([M("esri.layers.MapNotesLayer")],a);const Le=a;export{Le as default}; diff --git a/dist/assets/MapNotesLayer-ldLz1FWK.js b/dist/assets/MapNotesLayer-ldLz1FWK.js new file mode 100644 index 0000000..89ba45c --- /dev/null +++ b/dist/assets/MapNotesLayer-ldLz1FWK.js @@ -0,0 +1 @@ +import{es as T,e as i,y as s,c as I,aw as P,a6 as F,x,aC as B,dF as k,dJ as z,dH as W,dI as A,dK as K,d2 as h,V as w,ah as N,ed as M,et as J,eu as S,ev as $,ew as D,ex as E,K as U,r as H,dy as V,bt as q,cj as Z,dU as Q,dV as X,dW as Y,am as ee,dm as L,dt as f,du as te,dO as re,G as oe,aI as ie}from"./index-pCX-0tJH.js";import le from"./FeatureLayer-9tNCmEbA.js";import{n as ae}from"./objectIdUtils-GktMsX8e.js";import"./FeatureLayerBase-mvqC7cJs.js";import"./serviceCapabilitiesUtils-f-iBP4uh.js";import"./editsZScale-4-dTv58d.js";import"./CustomParametersMixin-7nmugR3Y.js";import"./FeatureEffectLayer-OK0TB5f6.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./FeatureReductionLayer-2X2_PJv9.js";import"./OrderedLayer-XNaJwl_G.js";import"./FeatureTemplate-vSzbyslg.js";import"./FeatureType-0WPvBvpQ.js";import"./versionUtils-idhrDltC.js";function b(t){return t.featureCollectionType==="markup"||t.layers.some(e=>e.layerDefinition.visibilityField!=null||!R(e))}function R({layerDefinition:t,featureSet:e}){const r=t.geometryType??e.geometryType;return v.find(o=>{var l,n,y;return r===o.geometryTypeJSON&&((y=(n=(l=t.drawingInfo)==null?void 0:l.renderer)==null?void 0:n.symbol)==null?void 0:y.type)===o.identifyingSymbol.type})}function j(){return new re({xmin:-180,ymin:-90,xmax:180,ymax:90})}const C=new T({name:"OBJECTID",alias:"OBJECTID",type:"oid",nullable:!1,editable:!1}),ne=new T({name:"title",alias:"Title",type:"string",nullable:!0,editable:!0,length:255});let u=class extends oe{constructor(t){super(t),this.visibilityMode="inherited"}initialize(){for(const t of this.graphics)t.sourceLayer=this.layer;this.graphics.on("after-add",t=>{t.item.sourceLayer=this.layer}),this.graphics.on("after-remove",t=>{t.item.sourceLayer=null})}get fullExtent(){var r;const t=(r=this.layer)==null?void 0:r.spatialReference,e=this.fullBounds;return t?e==null?S(j(),t).geometry:E(e,t):null}get fullBounds(){var r;const t=(r=this.layer)==null?void 0:r.spatialReference;if(!t)return null;const e=M();return this.graphics.forEach(o=>{const l=o.geometry!=null?S(o.geometry,t).geometry:null;l!=null&&J(e,l.type==="point"?l:l.extent,e)}),$(e,D)?null:e}get sublayers(){return this.graphics}};i([s({readOnly:!0})],u.prototype,"fullExtent",null),i([s({readOnly:!0})],u.prototype,"fullBounds",null),i([s({readOnly:!0})],u.prototype,"sublayers",null),i([s()],u.prototype,"layer",void 0),i([s()],u.prototype,"layerId",void 0),i([s({readOnly:!0})],u.prototype,"visibilityMode",void 0),u=i([I("esri.layers.MapNotesLayer.MapNotesSublayer")],u);const v=[{geometryType:"polygon",geometryTypeJSON:"esriGeometryPolygon",id:"polygonLayer",layerId:0,title:"Polygons",identifyingSymbol:new P().toJSON()},{geometryType:"polyline",geometryTypeJSON:"esriGeometryPolyline",id:"polylineLayer",layerId:1,title:"Polylines",identifyingSymbol:new F().toJSON()},{geometryType:"multipoint",geometryTypeJSON:"esriGeometryMultipoint",id:"multipointLayer",layerId:2,title:"Multipoints",identifyingSymbol:new x().toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"pointLayer",layerId:3,title:"Points",identifyingSymbol:new x().toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"textLayer",layerId:4,title:"Text",identifyingSymbol:new B().toJSON()}];let a=class extends k(z(W(A(K(ie))))){constructor(t){super(t),this.capabilities={operations:{supportsMapNotesEditing:!0}},this.featureCollections=null,this.featureCollectionJSON=null,this.featureCollectionType="notes",this.legendEnabled=!1,this.listMode="hide-children",this.minScale=0,this.maxScale=0,this.spatialReference=h.WGS84,this.sublayers=new w(v.map(e=>new u({id:e.id,layerId:e.layerId,title:e.title,layer:this}))),this.title="Map Notes",this.type="map-notes",this.visibilityMode="inherited"}readCapabilities(t,e,r){return{operations:{supportsMapNotesEditing:!b(e)&&(r==null?void 0:r.origin)!=="portal-item"}}}readFeatureCollections(t,e,r){if(!b(e))return null;const o=e.layers.map(l=>{const n=new le;return n.read(l,r),n});return new w({items:o})}readLegacyfeatureCollectionJSON(t,e){return b(e)?N(e.featureCollection):null}get fullExtent(){var r;const t=this.spatialReference,e=M();return this.sublayers!=null?this.sublayers.forEach(({fullBounds:o})=>o!=null?J(e,o,e):e,e):(r=this.featureCollectionJSON)!=null&&r.layers.some(o=>o.layerDefinition.extent)&&this.featureCollectionJSON.layers.forEach(o=>{const l=S(o.layerDefinition.extent,t).geometry;l!=null&&J(e,l,e)}),$(e,D)?S(j(),t).geometry:E(e,t)}readMinScale(t,e){for(const r of e.layers)if(r.layerDefinition.minScale!=null)return r.layerDefinition.minScale;return 0}readMaxScale(t,e){for(const r of e.layers)if(r.layerDefinition.maxScale!=null)return r.layerDefinition.maxScale;return 0}get multipointLayer(){return this._findSublayer("multipointLayer")}get pointLayer(){return this._findSublayer("pointLayer")}get polygonLayer(){return this._findSublayer("polygonLayer")}get polylineLayer(){return this._findSublayer("polylineLayer")}readSpatialReference(t,e){return e.layers.length?h.fromJSON(e.layers[0].layerDefinition.spatialReference):h.WGS84}readSublayers(t,e,r){if(b(e))return null;const o=[];let l=e.layers.reduce((n,y)=>Math.max(n,y.layerDefinition.id??-1),-1)+1;for(const n of e.layers){const{layerDefinition:y,featureSet:p}=n,d=y.id??l++,m=R(n);if(m!=null){const c=new u({id:m.id,title:y.name,layerId:d,layer:this,graphics:p.features.map(({geometry:g,symbol:O,attributes:_,popupInfo:G})=>U.fromJSON({attributes:_,geometry:g,symbol:O,popupTemplate:G}))});o.push(c)}}return new w(o)}writeSublayers(t,e,r,o){var m;const{minScale:l,maxScale:n}=this;if(t==null)return;const y=t.some(c=>c.graphics.length>0);if(!this.capabilities.operations.supportsMapNotesEditing)return void(y&&((m=o==null?void 0:o.messages)==null?void 0:m.push(new H("map-notes-layer:editing-not-supported","New map notes cannot be added to this layer"))));const p=[];let d=this.spatialReference.toJSON();e:for(const c of t)for(const g of c.graphics)if(g.geometry!=null){d=g.geometry.spatialReference.toJSON();break e}for(const c of v){const g=t.find(O=>c.id===O.id);this._writeMapNoteSublayer(p,g,c,l,n,d,o)}V("featureCollection.layers",p,e)}get textLayer(){return this._findSublayer("textLayer")}load(t){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},t)),Promise.resolve(this)}read(t,e){"featureCollection"in t&&(t=N(t),Object.assign(t,t.featureCollection)),super.read(t,e)}async beforeSave(){if(this.sublayers==null)return;let t=null;const e=[];for(const o of this.sublayers)for(const l of o.graphics)if(l.geometry!=null){const n=l.geometry;t?q(n.spatialReference,t)||(Z(n.spatialReference,t)||Q()||await X(),l.geometry=Y(n,t)):t=n.spatialReference,e.push(l)}const r=await ee(e.map(o=>o.geometry));e.forEach((o,l)=>o.geometry=r[l])}_findSublayer(t){var e;return this.sublayers==null?null:((e=this.sublayers)==null?void 0:e.find(r=>r.id===t))??null}_writeMapNoteSublayer(t,e,r,o,l,n,y){const p=[];if(e!=null){for(const d of e.graphics)this._writeMapNote(p,d,r.geometryType,y);this._normalizeObjectIds(p,C),t.push({layerDefinition:{name:e.title,drawingInfo:{renderer:{type:"simple",symbol:N(r.identifyingSymbol)}},id:e.layerId,geometryType:r.geometryTypeJSON,minScale:o,maxScale:l,objectIdField:"OBJECTID",fields:[C.toJSON(),ne.toJSON()],spatialReference:n},featureSet:{features:p,geometryType:r.geometryTypeJSON}})}}_writeMapNote(t,e,r,o){var d,m;if(e==null)return;const{geometry:l,symbol:n,popupTemplate:y}=e;if(l==null)return;if(l.type!==r)return void((d=o==null?void 0:o.messages)==null?void 0:d.push(new L("map-notes-layer:invalid-geometry-type",`Geometry "${l.type}" cannot be saved in "${r}" layer`,{graphic:e})));if(n==null)return void((m=o==null?void 0:o.messages)==null?void 0:m.push(new L("map-notes-layer:no-symbol","Skipping map notes with no symbol",{graphic:e})));const p={attributes:{...e.attributes},geometry:l.toJSON(),symbol:n.toJSON()};y!=null&&(p.popupInfo=y.toJSON()),t.push(p)}_normalizeObjectIds(t,e){const r=e.name;let o=ae(r,t)+1;const l=new Set;for(const n of t){n.attributes||(n.attributes={});const{attributes:y}=n;(y[r]==null||l.has(y[r]))&&(y[r]=o++),l.add(y[r])}}};i([s({readOnly:!0})],a.prototype,"capabilities",void 0),i([f(["portal-item","web-map"],"capabilities",["layers"])],a.prototype,"readCapabilities",null),i([s({readOnly:!0})],a.prototype,"featureCollections",void 0),i([f(["web-map","portal-item"],"featureCollections",["layers"])],a.prototype,"readFeatureCollections",null),i([s({readOnly:!0,json:{origins:{"web-map":{write:{enabled:!0,target:"featureCollection"}}}}})],a.prototype,"featureCollectionJSON",void 0),i([f(["web-map","portal-item"],"featureCollectionJSON",["featureCollection"])],a.prototype,"readLegacyfeatureCollectionJSON",null),i([s({readOnly:!0,json:{read:!0,write:{enabled:!0,ignoreOrigin:!0}}})],a.prototype,"featureCollectionType",void 0),i([s({readOnly:!0})],a.prototype,"fullExtent",null),i([s({readOnly:!0,json:{origins:{"web-map":{write:{target:"featureCollection.showLegend",overridePolicy(){return{enabled:this.featureCollectionJSON!=null}}}}}}})],a.prototype,"legendEnabled",void 0),i([s({type:["show","hide","hide-children"]})],a.prototype,"listMode",void 0),i([s({type:Number,nonNullable:!0,json:{write:!1}})],a.prototype,"minScale",void 0),i([f(["web-map","portal-item"],"minScale",["layers"])],a.prototype,"readMinScale",null),i([s({type:Number,nonNullable:!0,json:{write:!1}})],a.prototype,"maxScale",void 0),i([f(["web-map","portal-item"],"maxScale",["layers"])],a.prototype,"readMaxScale",null),i([s({readOnly:!0})],a.prototype,"multipointLayer",null),i([s({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],a.prototype,"operationalLayerType",void 0),i([s({readOnly:!0})],a.prototype,"pointLayer",null),i([s({readOnly:!0})],a.prototype,"polygonLayer",null),i([s({readOnly:!0})],a.prototype,"polylineLayer",null),i([s({type:h})],a.prototype,"spatialReference",void 0),i([f(["web-map","portal-item"],"spatialReference",["layers"])],a.prototype,"readSpatialReference",null),i([s({readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],a.prototype,"sublayers",void 0),i([f("web-map","sublayers",["layers"])],a.prototype,"readSublayers",null),i([te("web-map","sublayers")],a.prototype,"writeSublayers",null),i([s({readOnly:!0})],a.prototype,"textLayer",null),i([s()],a.prototype,"title",void 0),i([s({readOnly:!0,json:{read:!1}})],a.prototype,"type",void 0),a=i([I("esri.layers.MapNotesLayer")],a);const Ne=a;export{Ne as default}; diff --git a/dist/assets/MapServiceLayerViewHelper-a8WMaeWS.js b/dist/assets/MapServiceLayerViewHelper-45ApjWde.js similarity index 57% rename from dist/assets/MapServiceLayerViewHelper-a8WMaeWS.js rename to dist/assets/MapServiceLayerViewHelper-45ApjWde.js index 56e259e..a593e4a 100644 --- a/dist/assets/MapServiceLayerViewHelper-a8WMaeWS.js +++ b/dist/assets/MapServiceLayerViewHelper-45ApjWde.js @@ -1,7 +1,7 @@ -import{gb as D,et as Z,es as W,nE as C,nF as G,ji as K,e as l,y,dx as X,dy as Y,dT as H,ar as ee,ev as te,c as I,dr as J,g0 as re,S as V,dt as se,du as ie,j5 as ne,dZ as ae,bN as oe,f$ as le,f_ as ue,bW as pe,p as ye,ah as ce,fl as de,E as T,a2 as N,V as he,e3 as L,J as U,de as fe,ld as me,e2 as ge,dJ as we,nG as be,fI as ve,nH as xe,d6 as $e,fG as Se}from"./index-J0iiHjMT.js";import{o as M}from"./drapedUtils-9db1OpTX.js";function Fe(t,e){const{dpi:s,gdbVersion:i,geometry:r,geometryPrecision:n,height:a,layerOption:o,mapExtent:c,maxAllowableOffset:u,returnFieldName:p,returnGeometry:h,returnUnformattedValues:d,returnZ:F,spatialReference:$,timeExtent:x,tolerance:m,width:j}=t.toJSON(),{dynamicLayers:g,layerDefs:w,layerIds:v}=je(t),R=(e==null?void 0:e.geometry)!=null?e.geometry:null,b={geometryPrecision:n,maxAllowableOffset:u,returnFieldName:p,returnGeometry:h,returnUnformattedValues:d,returnZ:F,tolerance:m},E=R&&R.toJSON()||r;b.imageDisplay=`${j},${a},${s}`,i&&(b.gdbVersion=i),E&&(delete E.spatialReference,b.geometry=JSON.stringify(E),b.geometryType=D(E));const A=$??(E==null?void 0:E.spatialReference)??(c==null?void 0:c.spatialReference);if(A&&(b.sr=Z(A)),b.time=x?[x.start,x.end].join(","):null,c){const{xmin:z,ymin:k,xmax:q,ymax:B}=c;b.mapExtent=`${z},${k},${q},${B}`}return w&&(b.layerDefs=w),g&&!w&&(b.dynamicLayers=g),b.layers=o==="popup"?"visible":o,v&&!g&&(b.layers+=`:${v.join(",")}`),b}function je(t){var $,x;const{mapExtent:e,floors:s,width:i,sublayers:r,layerIds:n,layerOption:a,gdbVersion:o}=t,c=(x=($=r==null?void 0:r.find(m=>m.layer!=null))==null?void 0:$.layer)==null?void 0:x.serviceSublayers,u=a==="popup",p={},h=W({extent:e,width:i,spatialReference:e==null?void 0:e.spatialReference}),d=[],F=m=>{const j=h===0,g=m.minScale===0||h<=m.minScale,w=m.maxScale===0||h>=m.maxScale;if(m.visible&&(j||g&&w))if(m.sublayers)m.sublayers.forEach(F);else{if((n==null?void 0:n.includes(m.id))===!1||u&&(!m.popupTemplate||!m.popupEnabled))return;d.unshift(m)}};if(r==null||r.forEach(F),r&&!d.length)p.layerIds=[];else{const m=C(d,c,o),j=d.map(g=>{const w=G(s,g);return g.toExportImageJSON(w)});if(m)p.dynamicLayers=JSON.stringify(j);else{if(r){let w=d.map(({id:v})=>v);n&&(w=w.filter(v=>n.includes(v))),p.layerIds=w}else n!=null&&n.length&&(p.layerIds=n);const g=Ee(s,d);if(g!=null&&g.length){const w={};for(const v of g)v.definitionExpression&&(w[v.id]=v.definitionExpression);Object.keys(w).length&&(p.layerDefs=JSON.stringify(w))}}}return p}function Ee(t,e){const s=!!(t!=null&&t.length),i=e.filter(r=>r.definitionExpression!=null||s&&r.floorInfo!=null);return i.length?i.map(r=>{const n=G(t,r),a=K(n,r.definitionExpression);return{id:r.id,definitionExpression:a??void 0}}):null}var _;let f=_=class extends J{static from(t){return re(_,t)}constructor(t){super(t),this.dpi=96,this.floors=null,this.gdbVersion=null,this.geometry=null,this.geometryPrecision=null,this.height=400,this.layerIds=null,this.layerOption="top",this.mapExtent=null,this.maxAllowableOffset=null,this.returnFieldName=!0,this.returnGeometry=!1,this.returnM=!1,this.returnUnformattedValues=!0,this.returnZ=!1,this.spatialReference=null,this.sublayers=null,this.timeExtent=null,this.tolerance=null,this.width=400}};l([y({type:Number,json:{write:!0}})],f.prototype,"dpi",void 0),l([y()],f.prototype,"floors",void 0),l([y({type:String,json:{write:!0}})],f.prototype,"gdbVersion",void 0),l([y({types:X,json:{read:Y,write:!0}})],f.prototype,"geometry",void 0),l([y({type:Number,json:{write:!0}})],f.prototype,"geometryPrecision",void 0),l([y({type:Number,json:{write:!0}})],f.prototype,"height",void 0),l([y({type:[Number],json:{write:!0}})],f.prototype,"layerIds",void 0),l([y({type:["top","visible","all","popup"],json:{write:!0}})],f.prototype,"layerOption",void 0),l([y({type:H,json:{write:!0}})],f.prototype,"mapExtent",void 0),l([y({type:Number,json:{write:!0}})],f.prototype,"maxAllowableOffset",void 0),l([y({type:Boolean,json:{write:!0}})],f.prototype,"returnFieldName",void 0),l([y({type:Boolean,json:{write:!0}})],f.prototype,"returnGeometry",void 0),l([y({type:Boolean,json:{write:!0}})],f.prototype,"returnM",void 0),l([y({type:Boolean,json:{write:!0}})],f.prototype,"returnUnformattedValues",void 0),l([y({type:Boolean,json:{write:!0}})],f.prototype,"returnZ",void 0),l([y({type:ee,json:{write:!0}})],f.prototype,"spatialReference",void 0),l([y()],f.prototype,"sublayers",void 0),l([y({type:te,json:{write:!0}})],f.prototype,"timeExtent",void 0),l([y({type:Number,json:{write:!0}})],f.prototype,"tolerance",void 0),l([y({type:Number,json:{write:!0}})],f.prototype,"width",void 0),f=_=l([I("esri.rest.support.IdentifyParameters")],f);const Q=f;let S=class extends J{constructor(t){super(t),this.displayFieldName=null,this.feature=null,this.layerId=null,this.layerName=null}readFeature(t,e){return V.fromJSON({attributes:{...e.attributes},geometry:{...e.geometry}})}writeFeature(t,e){if(!t)return;const{attributes:s,geometry:i}=t;s&&(e.attributes={...s}),i!=null&&(e.geometry=i.toJSON(),e.geometryType=ne.toJSON(i.type))}};l([y({type:String,json:{write:!0}})],S.prototype,"displayFieldName",void 0),l([y({type:V})],S.prototype,"feature",void 0),l([se("feature",["attributes","geometry"])],S.prototype,"readFeature",null),l([ie("feature")],S.prototype,"writeFeature",null),l([y({type:Number,json:{write:!0}})],S.prototype,"layerId",void 0),l([y({type:String,json:{write:!0}})],S.prototype,"layerName",void 0),S=l([I("esri.rest.support.IdentifyResult")],S);const Oe=S;async function Re(t,e,s){const i=(e=Pe(e)).geometry?[e.geometry]:[],r=ae(t);return r.path+="/identify",oe(i).then(n=>{const a=Fe(e,{geometry:n==null?void 0:n[0]}),o=le({...r.query,f:"json",...a}),c=ue(o,s);return pe(r.path,c).then(Ne).then(u=>_e(u,e.sublayers))})}function Ne(t){const e=t.data;return e.results=e.results||[],e.exceededTransferLimit=!!e.exceededTransferLimit,e.results=e.results.map(s=>Oe.fromJSON(s)),e}function Pe(t){return t=Q.from(t)}function _e(t,e){if(!(e!=null&&e.length))return t;const s=new Map;function i(r){s.set(r.id,r),r.sublayers&&r.sublayers.forEach(i)}e.forEach(i);for(const r of t.results)r.feature.sourceLayer=s.get(r.layerId);return t}let P=null;function Ue(t,e){return e.type==="tile"||e.type==="map-image"}let O=class extends ye{constructor(t){super(t),this._featuresResolutions=new WeakMap,this.highlightGraphics=null,this.highlightGraphicUpdated=null,this.updateHighlightedFeatures=ce(async e=>{this.destroyed||this.updatingHandles.addPromise(this._updateHighlightedFeaturesGeometries(e).catch(()=>{}))})}initialize(){const t=e=>{this.updatingHandles.addPromise(this._updateHighlightedFeaturesSymbols(e).catch(()=>{})),this.updateHighlightedFeatures(this._highlightGeometriesResolution)};this.addHandles([de(()=>this.highlightGraphics,"change",e=>t(e.added),{onListenerAdd:e=>t(e)})])}async fetchPopupFeatures(t,e){var a,o;const{layerView:{layer:s,view:{scale:i}}}=this;if(!t)throw new T("fetchPopupFeatures:invalid-area","Nothing to fetch without area",{layer:s});const r=Ge(s.sublayers,i,e);if(!r.length)return[];const n=await Ve(s,r);if(!((((o=(a=s.capabilities)==null?void 0:a.operations)==null?void 0:o.supportsIdentify)??!0)&&s.version>=10.5)&&!n)throw new T("fetchPopupFeatures:not-supported","query operation is disabled for this service",{layer:s});return n?this._fetchPopupFeaturesUsingQueries(t,r,e):this._fetchPopupFeaturesUsingIdentify(t,r,e)}clearHighlights(){var t;(t=this.highlightGraphics)==null||t.removeAll()}highlight(t){const e=this.highlightGraphics;if(!e)return N();let s=null;if(t instanceof V?s=[t]:he.isCollection(t)&&t.length>0?s=t.toArray():Array.isArray(t)&&t.length>0&&(s=t),s=s==null?void 0:s.filter(L),!(s!=null&&s.length))return N();for(const i of s){const r=i.sourceLayer;r!=null&&"geometryType"in r&&r.geometryType==="point"&&(i.visible=!1)}return e.addMany(s),N(()=>e.removeMany(s??[]))}async _updateHighlightedFeaturesSymbols(t){const{layerView:{view:e},highlightGraphics:s,highlightGraphicUpdated:i}=this;if(s&&i)for(const r of t){const n=r.sourceLayer&&"renderer"in r.sourceLayer&&r.sourceLayer.renderer;r.sourceLayer&&"geometryType"in r.sourceLayer&&r.sourceLayer.geometryType==="point"&&n&&"getSymbolAsync"in n&&n.getSymbolAsync(r).then(async a=>{var u;a||(a=new U);let o=null;const c="visualVariables"in n?(u=n.visualVariables)==null?void 0:u.find(p=>p.type==="size"):void 0;c&&(P||(P=(await fe(()=>import("./index-J0iiHjMT.js").then(p=>p.zA),__vite__mapDeps([0,1]))).getSize),o=P(c,r,{view:e.type,scale:e.scale,shape:a.type==="simple-marker"?a.style:null})),o||(o="width"in a&&"height"in a&&a.width!=null&&a.height!=null?Math.max(a.width,a.height):"size"in a?a.size:16),s.includes(r)&&(r.symbol=new U({style:"square",size:o,xoffset:"xoffset"in a?a.xoffset:0,yoffset:"yoffset"in a?a.yoffset:0}),i(r,"symbol"),r.visible=!0)})}}async _updateHighlightedFeaturesGeometries(t){const{layerView:{layer:e,view:s},highlightGraphics:i,highlightGraphicUpdated:r}=this;if(this._highlightGeometriesResolution=t,!r||!(i!=null&&i.length)||!e.capabilities.operations.supportsQuery)return;const n=this._getTargetResolution(t),a=new Map;for(const u of i)if(!this._featuresResolutions.has(u)||this._featuresResolutions.get(u)>n){const p=u.sourceLayer;me(a,p,()=>new Map).set(u.getObjectId(),u)}const o=Array.from(a,([u,p])=>{const h=u.createQuery();return h.objectIds=[...p.keys()],h.outFields=[u.objectIdField],h.returnGeometry=!0,h.maxAllowableOffset=n,h.outSpatialReference=s.spatialReference,u.queryFeatures(h)}),c=await Promise.all(o);if(!this.destroyed)for(const{features:u}of c)for(const p of u){const h=p.sourceLayer,d=a.get(h).get(p.getObjectId());d&&i.includes(d)&&(d.geometry=p.geometry,r(d,"geometry"),this._featuresResolutions.set(d,n))}}_getTargetResolution(t){const e=t*ge(this.layerView.view.spatialReference),s=e/16;return s<=10?0:t/e*s}async _fetchPopupFeaturesUsingIdentify(t,e,s){const i=await this._createIdentifyParameters(t,e,s);if(i==null)return[];const{results:r}=await Re(this.layerView.layer.parsedUrl,i);return r.map(n=>n.feature)}async _createIdentifyParameters(t,e,s){const{floors:i,layer:r,timeExtent:n,view:{spatialReference:a,scale:o}}=this.layerView,c=s!=null?s.event:null;if(!e.length)return null;await Promise.all(e.map(({sublayer:$})=>$.load().catch(()=>{})));const u=Math.min(we("mapservice-popup-identify-max-tolerance"),r.allSublayers.reduce(($,x)=>x.renderer?M({renderer:x.renderer,event:c}):$,2)),p=this.createFetchPopupFeaturesQueryGeometry(t,u),h=be(o,a),d=Math.round(p.width/h),F=new H({xmin:p.center.x-h*d,ymin:p.center.y-h*d,xmax:p.center.x+h*d,ymax:p.center.y+h*d,spatialReference:p.spatialReference});return new Q({floors:i,gdbVersion:"gdbVersion"in r?r.gdbVersion:void 0,geometry:t,height:d,layerOption:"popup",mapExtent:F,returnGeometry:!0,spatialReference:a,sublayers:r.sublayers,timeExtent:n,tolerance:u,width:d})}async _fetchPopupFeaturesUsingQueries(t,e,s){const{layerView:{floors:i,timeExtent:r}}=this,n=s!=null?s.event:null,a=e.map(async({sublayer:o,popupTemplate:c})=>{var v;if(await o.load().catch(()=>{}),o.capabilities&&!o.capabilities.operations.supportsQuery)return[];const u=o.createQuery(),p=M({renderer:o.renderer,event:n}),h=this.createFetchPopupFeaturesQueryGeometry(t,p),d=new Set,[F]=await Promise.all([ve(o,c),(v=o.renderer)==null?void 0:v.collectRequiredFields(d,o.fieldsIndex)]);xe(d,o.fieldsIndex,F);const $=Array.from(d).sort();if(u.geometry=h,u.outFields=$,u.timeExtent=r,i){const R=i.clone(),b=G(R,o);b!=null&&(u.where=u.where?`(${u.where}) AND (${b})`:b)}const x=this._getTargetResolution(h.width/p),m=await Ie(c),j=o.geometryType==="point"||m&&m.arcadeUtils.hasGeometryOperations(c);j||(u.maxAllowableOffset=x);let{features:g}=await o.queryFeatures(u);const w=j?0:x;g=await Ae(o,g);for(const R of g)this._featuresResolutions.set(R,w);return g});return(await Promise.allSettled(a)).reduce((o,c)=>c.status==="fulfilled"?[...o,...c.value]:o,[]).filter(L)}};function Ge(t,e,s){const i=[];if(!t)return i;const r=n=>{const a=n.minScale===0||e<=n.minScale,o=n.maxScale===0||e>=n.maxScale;if(n.visible&&a&&o){if(n.sublayers)n.sublayers.forEach(r);else if(n.popupEnabled){const c=Se(n,{...s,defaultPopupTemplateEnabled:!1});c!=null&&i.unshift({sublayer:n,popupTemplate:c})}}};return t.map(r),i}function Ie(t){var e;return(e=t.expressionInfos)!=null&&e.length||Array.isArray(t.content)&&t.content.some(s=>s.type==="expression")?$e():Promise.resolve()}async function Ve(t,e){var s,i;if((i=(s=t.capabilities)==null?void 0:s.operations)!=null&&i.supportsQuery)return!0;try{return await Promise.any(e.map(({sublayer:r})=>r.load().then(()=>r.capabilities.operations.supportsQuery)))}catch{return!1}}async function Ae(t,e){const s=t.renderer;return s&&"defaultSymbol"in s&&!s.defaultSymbol&&(e=s.valueExpression?await Promise.all(e.map(i=>s.getSymbolAsync(i).then(r=>r?i:null))).then(i=>i.filter(r=>r!=null)):e.filter(i=>s.getSymbol(i)!=null)),e}l([y({constructOnly:!0})],O.prototype,"createFetchPopupFeaturesQueryGeometry",void 0),l([y({constructOnly:!0})],O.prototype,"layerView",void 0),l([y({constructOnly:!0})],O.prototype,"highlightGraphics",void 0),l([y({constructOnly:!0})],O.prototype,"highlightGraphicUpdated",void 0),l([y({constructOnly:!0})],O.prototype,"updatingHandles",void 0),O=l([I("esri.views.layers.support.MapService")],O);export{O as G,Ue as S}; +import{g8 as q,em as Z,el as W,nN as X,nO as G,jp as Y,e as l,y,nP as C,fZ as K,dO as Q,d2 as ee,eo as te,c as I,dr as H,fY as re,K as V,dt as se,du as ie,jc as ne,fV as oe,am as ae,fX as le,fW as ue,av as pe,g as ye,bs as ce,fg as de,r as T,a0 as P,V as he,dY as L,x as U,de as fe,ll as me,dX as ge,dE as we,nQ as be,fD as ve,nR as xe,cZ as $e,fB as Se}from"./index-pCX-0tJH.js";import{o as M}from"./drapedUtils-F1ywqHD-.js";function Fe(t,e){const{dpi:s,gdbVersion:i,geometry:r,geometryPrecision:n,height:o,layerOption:a,mapExtent:c,maxAllowableOffset:u,returnFieldName:p,returnGeometry:h,returnUnformattedValues:d,returnZ:F,spatialReference:$,timeExtent:x,tolerance:m,width:O}=t.toJSON(),{dynamicLayers:g,layerDefs:w,layerIds:v}=Oe(t),R=(e==null?void 0:e.geometry)!=null?e.geometry:null,b={geometryPrecision:n,maxAllowableOffset:u,returnFieldName:p,returnGeometry:h,returnUnformattedValues:d,returnZ:F,tolerance:m},j=R&&R.toJSON()||r;b.imageDisplay=`${O},${o},${s}`,i&&(b.gdbVersion=i),j&&(delete j.spatialReference,b.geometry=JSON.stringify(j),b.geometryType=q(j));const A=$??(j==null?void 0:j.spatialReference)??(c==null?void 0:c.spatialReference);if(A&&(b.sr=Z(A)),b.time=x?[x.start,x.end].join(","):null,c){const{xmin:z,ymin:B,xmax:D,ymax:k}=c;b.mapExtent=`${z},${B},${D},${k}`}return w&&(b.layerDefs=w),g&&!w&&(b.dynamicLayers=g),b.layers=a==="popup"?"visible":a,v&&!g&&(b.layers+=`:${v.join(",")}`),b}function Oe(t){var $,x;const{mapExtent:e,floors:s,width:i,sublayers:r,layerIds:n,layerOption:o,gdbVersion:a}=t,c=(x=($=r==null?void 0:r.find(m=>m.layer!=null))==null?void 0:$.layer)==null?void 0:x.serviceSublayers,u=o==="popup",p={},h=W({extent:e,width:i,spatialReference:e==null?void 0:e.spatialReference}),d=[],F=m=>{const O=h===0,g=m.minScale===0||h<=m.minScale,w=m.maxScale===0||h>=m.maxScale;if(m.visible&&(O||g&&w))if(m.sublayers)m.sublayers.forEach(F);else{if((n==null?void 0:n.includes(m.id))===!1||u&&(!m.popupTemplate||!m.popupEnabled))return;d.unshift(m)}};if(r==null||r.forEach(F),r&&!d.length)p.layerIds=[];else{const m=X(d,c,a),O=d.map(g=>{const w=G(s,g);return g.toExportImageJSON(w)});if(m)p.dynamicLayers=JSON.stringify(O);else{if(r){let w=d.map(({id:v})=>v);n&&(w=w.filter(v=>n.includes(v))),p.layerIds=w}else n!=null&&n.length&&(p.layerIds=n);const g=je(s,d);if(g!=null&&g.length){const w={};for(const v of g)v.definitionExpression&&(w[v.id]=v.definitionExpression);Object.keys(w).length&&(p.layerDefs=JSON.stringify(w))}}}return p}function je(t,e){const s=!!(t!=null&&t.length),i=e.filter(r=>r.definitionExpression!=null||s&&r.floorInfo!=null);return i.length?i.map(r=>{const n=G(t,r),o=Y(n,r.definitionExpression);return{id:r.id,definitionExpression:o??void 0}}):null}var _;let f=_=class extends H{static from(t){return re(_,t)}constructor(t){super(t),this.dpi=96,this.floors=null,this.gdbVersion=null,this.geometry=null,this.geometryPrecision=null,this.height=400,this.layerIds=null,this.layerOption="top",this.mapExtent=null,this.maxAllowableOffset=null,this.returnFieldName=!0,this.returnGeometry=!1,this.returnM=!1,this.returnUnformattedValues=!0,this.returnZ=!1,this.spatialReference=null,this.sublayers=null,this.timeExtent=null,this.tolerance=null,this.width=400}};l([y({type:Number,json:{write:!0}})],f.prototype,"dpi",void 0),l([y()],f.prototype,"floors",void 0),l([y({type:String,json:{write:!0}})],f.prototype,"gdbVersion",void 0),l([y({types:C,json:{read:K,write:!0}})],f.prototype,"geometry",void 0),l([y({type:Number,json:{write:!0}})],f.prototype,"geometryPrecision",void 0),l([y({type:Number,json:{write:!0}})],f.prototype,"height",void 0),l([y({type:[Number],json:{write:!0}})],f.prototype,"layerIds",void 0),l([y({type:["top","visible","all","popup"],json:{write:!0}})],f.prototype,"layerOption",void 0),l([y({type:Q,json:{write:!0}})],f.prototype,"mapExtent",void 0),l([y({type:Number,json:{write:!0}})],f.prototype,"maxAllowableOffset",void 0),l([y({type:Boolean,json:{write:!0}})],f.prototype,"returnFieldName",void 0),l([y({type:Boolean,json:{write:!0}})],f.prototype,"returnGeometry",void 0),l([y({type:Boolean,json:{write:!0}})],f.prototype,"returnM",void 0),l([y({type:Boolean,json:{write:!0}})],f.prototype,"returnUnformattedValues",void 0),l([y({type:Boolean,json:{write:!0}})],f.prototype,"returnZ",void 0),l([y({type:ee,json:{write:!0}})],f.prototype,"spatialReference",void 0),l([y()],f.prototype,"sublayers",void 0),l([y({type:te,json:{write:!0}})],f.prototype,"timeExtent",void 0),l([y({type:Number,json:{write:!0}})],f.prototype,"tolerance",void 0),l([y({type:Number,json:{write:!0}})],f.prototype,"width",void 0),f=_=l([I("esri.rest.support.IdentifyParameters")],f);const J=f;let S=class extends H{constructor(t){super(t),this.displayFieldName=null,this.feature=null,this.layerId=null,this.layerName=null}readFeature(t,e){return V.fromJSON({attributes:{...e.attributes},geometry:{...e.geometry}})}writeFeature(t,e){if(!t)return;const{attributes:s,geometry:i}=t;s&&(e.attributes={...s}),i!=null&&(e.geometry=i.toJSON(),e.geometryType=ne.toJSON(i.type))}};l([y({type:String,json:{write:!0}})],S.prototype,"displayFieldName",void 0),l([y({type:V})],S.prototype,"feature",void 0),l([se("feature",["attributes","geometry"])],S.prototype,"readFeature",null),l([ie("feature")],S.prototype,"writeFeature",null),l([y({type:Number,json:{write:!0}})],S.prototype,"layerId",void 0),l([y({type:String,json:{write:!0}})],S.prototype,"layerName",void 0),S=l([I("esri.rest.support.IdentifyResult")],S);const Ee=S;async function Re(t,e,s){const i=(e=Ne(e)).geometry?[e.geometry]:[],r=oe(t);return r.path+="/identify",ae(i).then(n=>{const o=Fe(e,{geometry:n==null?void 0:n[0]}),a=le({...r.query,f:"json",...o}),c=ue(a,s);return pe(r.path,c).then(Pe).then(u=>_e(u,e.sublayers))})}function Pe(t){const e=t.data;return e.results=e.results||[],e.exceededTransferLimit=!!e.exceededTransferLimit,e.results=e.results.map(s=>Ee.fromJSON(s)),e}function Ne(t){return t=J.from(t)}function _e(t,e){if(!(e!=null&&e.length))return t;const s=new Map;function i(r){s.set(r.id,r),r.sublayers&&r.sublayers.forEach(i)}e.forEach(i);for(const r of t.results)r.feature.sourceLayer=s.get(r.layerId);return t}let N=null;function Ue(t,e){return e.type==="tile"||e.type==="map-image"}let E=class extends ye{constructor(t){super(t),this._featuresResolutions=new WeakMap,this.highlightGraphics=null,this.highlightGraphicUpdated=null,this.updateHighlightedFeatures=ce(async e=>{this.destroyed||this.updatingHandles.addPromise(this._updateHighlightedFeaturesGeometries(e).catch(()=>{}))})}initialize(){const t=e=>{this.updatingHandles.addPromise(this._updateHighlightedFeaturesSymbols(e).catch(()=>{})),this.updateHighlightedFeatures(this._highlightGeometriesResolution)};this.addHandles([de(()=>this.highlightGraphics,"change",e=>t(e.added),{onListenerAdd:e=>t(e)})])}async fetchPopupFeatures(t,e){var o,a;const{layerView:{layer:s,view:{scale:i}}}=this;if(!t)throw new T("fetchPopupFeatures:invalid-area","Nothing to fetch without area",{layer:s});const r=Ge(s.sublayers,i,e);if(!r.length)return[];const n=await Ve(s,r);if(!((((a=(o=s.capabilities)==null?void 0:o.operations)==null?void 0:a.supportsIdentify)??!0)&&s.version>=10.5)&&!n)throw new T("fetchPopupFeatures:not-supported","query operation is disabled for this service",{layer:s});return n?this._fetchPopupFeaturesUsingQueries(t,r,e):this._fetchPopupFeaturesUsingIdentify(t,r,e)}clearHighlights(){var t;(t=this.highlightGraphics)==null||t.removeAll()}highlight(t){const e=this.highlightGraphics;if(!e)return P();let s=null;if(t instanceof V?s=[t]:he.isCollection(t)&&t.length>0?s=t.toArray():Array.isArray(t)&&t.length>0&&(s=t),s=s==null?void 0:s.filter(L),!(s!=null&&s.length))return P();for(const i of s){const r=i.sourceLayer;r!=null&&"geometryType"in r&&r.geometryType==="point"&&(i.visible=!1)}return e.addMany(s),P(()=>e.removeMany(s??[]))}async _updateHighlightedFeaturesSymbols(t){const{layerView:{view:e},highlightGraphics:s,highlightGraphicUpdated:i}=this;if(s&&i)for(const r of t){const n=r.sourceLayer&&"renderer"in r.sourceLayer&&r.sourceLayer.renderer;r.sourceLayer&&"geometryType"in r.sourceLayer&&r.sourceLayer.geometryType==="point"&&n&&"getSymbolAsync"in n&&n.getSymbolAsync(r).then(async o=>{var u;o||(o=new U);let a=null;const c="visualVariables"in n?(u=n.visualVariables)==null?void 0:u.find(p=>p.type==="size"):void 0;c&&(N||(N=(await fe(()=>import("./index-pCX-0tJH.js").then(p=>p.zT),__vite__mapDeps([0,1]))).getSize),a=N(c,r,{view:e.type,scale:e.scale,shape:o.type==="simple-marker"?o.style:null})),a||(a="width"in o&&"height"in o&&o.width!=null&&o.height!=null?Math.max(o.width,o.height):"size"in o?o.size:16),s.includes(r)&&(r.symbol=new U({style:"square",size:a,xoffset:"xoffset"in o?o.xoffset:0,yoffset:"yoffset"in o?o.yoffset:0}),i(r,"symbol"),r.visible=!0)})}}async _updateHighlightedFeaturesGeometries(t){const{layerView:{layer:e,view:s},highlightGraphics:i,highlightGraphicUpdated:r}=this;if(this._highlightGeometriesResolution=t,!r||!(i!=null&&i.length)||!e.capabilities.operations.supportsQuery)return;const n=this._getTargetResolution(t),o=new Map;for(const u of i)if(!this._featuresResolutions.has(u)||this._featuresResolutions.get(u)>n){const p=u.sourceLayer;me(o,p,()=>new Map).set(u.getObjectId(),u)}const a=Array.from(o,([u,p])=>{const h=u.createQuery();return h.objectIds=[...p.keys()],h.outFields=[u.objectIdField],h.returnGeometry=!0,h.maxAllowableOffset=n,h.outSpatialReference=s.spatialReference,u.queryFeatures(h)}),c=await Promise.all(a);if(!this.destroyed)for(const{features:u}of c)for(const p of u){const h=p.sourceLayer,d=o.get(h).get(p.getObjectId());d&&i.includes(d)&&(d.geometry=p.geometry,r(d,"geometry"),this._featuresResolutions.set(d,n))}}_getTargetResolution(t){const e=t*ge(this.layerView.view.spatialReference),s=e/16;return s<=10?0:t/e*s}async _fetchPopupFeaturesUsingIdentify(t,e,s){const i=await this._createIdentifyParameters(t,e,s);if(i==null)return[];const{results:r}=await Re(this.layerView.layer.parsedUrl,i);return r.map(n=>n.feature)}async _createIdentifyParameters(t,e,s){const{floors:i,layer:r,timeExtent:n,view:{spatialReference:o,scale:a}}=this.layerView,c=s!=null?s.event:null;if(!e.length)return null;await Promise.all(e.map(({sublayer:$})=>$.load().catch(()=>{})));const u=Math.min(we("mapservice-popup-identify-max-tolerance"),r.allSublayers.reduce(($,x)=>x.renderer?M({renderer:x.renderer,event:c}):$,2)),p=this.createFetchPopupFeaturesQueryGeometry(t,u),h=be(a,o),d=Math.round(p.width/h),F=new Q({xmin:p.center.x-h*d,ymin:p.center.y-h*d,xmax:p.center.x+h*d,ymax:p.center.y+h*d,spatialReference:p.spatialReference});return new J({floors:i,gdbVersion:"gdbVersion"in r?r.gdbVersion:void 0,geometry:t,height:d,layerOption:"popup",mapExtent:F,returnGeometry:!0,spatialReference:o,sublayers:r.sublayers,timeExtent:n,tolerance:u,width:d})}async _fetchPopupFeaturesUsingQueries(t,e,s){const{layerView:{floors:i,timeExtent:r}}=this,n=s!=null?s.event:null,o=e.map(async({sublayer:a,popupTemplate:c})=>{var v;if(await a.load().catch(()=>{}),a.capabilities&&!a.capabilities.operations.supportsQuery)return[];const u=a.createQuery(),p=M({renderer:a.renderer,event:n}),h=this.createFetchPopupFeaturesQueryGeometry(t,p),d=new Set,[F]=await Promise.all([ve(a,c),(v=a.renderer)==null?void 0:v.collectRequiredFields(d,a.fieldsIndex)]);xe(d,a.fieldsIndex,F);const $=Array.from(d).sort();if(u.geometry=h,u.outFields=$,u.timeExtent=r,i){const R=i.clone(),b=G(R,a);b!=null&&(u.where=u.where?`(${u.where}) AND (${b})`:b)}const x=this._getTargetResolution(h.width/p),m=await Ie(c),O=a.geometryType==="point"||m&&m.arcadeUtils.hasGeometryOperations(c);O||(u.maxAllowableOffset=x);let{features:g}=await a.queryFeatures(u);const w=O?0:x;g=await Ae(a,g);for(const R of g)this._featuresResolutions.set(R,w);return g});return(await Promise.allSettled(o)).reduce((a,c)=>c.status==="fulfilled"?[...a,...c.value]:a,[]).filter(L)}};function Ge(t,e,s){const i=[];if(!t)return i;const r=n=>{const o=n.minScale===0||e<=n.minScale,a=n.maxScale===0||e>=n.maxScale;if(n.visible&&o&&a){if(n.sublayers)n.sublayers.forEach(r);else if(n.popupEnabled){const c=Se(n,{...s,defaultPopupTemplateEnabled:!1});c!=null&&i.unshift({sublayer:n,popupTemplate:c})}}};return t.map(r),i}function Ie(t){var e;return(e=t.expressionInfos)!=null&&e.length||Array.isArray(t.content)&&t.content.some(s=>s.type==="expression")?$e():Promise.resolve()}async function Ve(t,e){var s,i;if((i=(s=t.capabilities)==null?void 0:s.operations)!=null&&i.supportsQuery)return!0;try{return await Promise.any(e.map(({sublayer:r})=>r.load().then(()=>r.capabilities.operations.supportsQuery)))}catch{return!1}}async function Ae(t,e){const s=t.renderer;return s&&"defaultSymbol"in s&&!s.defaultSymbol&&(e=s.valueExpression?await Promise.all(e.map(i=>s.getSymbolAsync(i).then(r=>r?i:null))).then(i=>i.filter(r=>r!=null)):e.filter(i=>s.getSymbol(i)!=null)),e}l([y({constructOnly:!0})],E.prototype,"createFetchPopupFeaturesQueryGeometry",void 0),l([y({constructOnly:!0})],E.prototype,"layerView",void 0),l([y({constructOnly:!0})],E.prototype,"highlightGraphics",void 0),l([y({constructOnly:!0})],E.prototype,"highlightGraphicUpdated",void 0),l([y({constructOnly:!0})],E.prototype,"updatingHandles",void 0),E=l([I("esri.views.layers.support.MapService")],E);export{E as G,Ue as S}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css"] + __vite__mapDeps.viteFileDeps = ["assets/index-pCX-0tJH.js","assets/index-4b4radwv.css"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/MeasurementWidgetContent-d8uX7Gw_.js b/dist/assets/MeasurementWidgetContent-PH9XFoV4.js similarity index 86% rename from dist/assets/MeasurementWidgetContent-d8uX7Gw_.js rename to dist/assets/MeasurementWidgetContent-PH9XFoV4.js index 236d56a..d75e254 100644 --- a/dist/assets/MeasurementWidgetContent-d8uX7Gw_.js +++ b/dist/assets/MeasurementWidgetContent-PH9XFoV4.js @@ -1,7 +1,7 @@ -import{e as s,y as i,c as d,p,Z as h,d as m,A as c,F as v,hl as _,hm as g,de as y,hn as r,ho as w}from"./index-J0iiHjMT.js";let u=class extends p{constructor(e){super(e),this.tool=null,this._loggedUnsupportedErrorOnce=!1,this.logger=h.getLogger(this),(e==null?void 0:e.visible)!=null&&(this.visible=e.visible)}initialize(){this.addHandles(m(()=>({ready:this.view!=null&&this.view.ready,supported:this.supported}),({ready:e,supported:t})=>{!e||t||this._loggedUnsupportedErrorOnce||(this.logError(this.unsupportedErrorMessage),this._loggedUnsupportedErrorOnce=!0)},c))}destroy(){this.removeTool(),this.view=null}get active(){return this.tool!=null&&this.tool.active}get disabled(){return this.view==null||!this.view.ready||!this.supported}get supported(){return this.view==null||this.view.type===this.supportedViewType}get view(){return this._get("view")}set view(e){if(e===this.view)return;this.removeTool(),this._set("view",e);const t="tools";this.removeHandles(t),e!=null&&this.addHandles(e.tools.on("after-remove",a=>{a.item===this.tool&&this._set("tool",null)}),t)}set visible(e){this._set("visible",e),this.tool!=null&&(this.tool.visible=e)}createTool(e={interactive:!1}){if(this.removeTool(),this.view==null||!this.view.ready||!this.supported)return;const t=this.constructTool();t.created?(this._set("tool",t),this.view.tools.add(t)):e.interactive?(this._set("tool",t),this.view.addAndActivateTool(t),v(()=>t.created,()=>{t.active&&this.view!=null&&(this.view.activeTool=null)},{initial:!0,once:!0})):t.destroy()}removeTool(){var a;const e=this.tool;if(e==null)return;const t=(a=this.view)==null?void 0:a.tools;t!=null?t.remove(e):e.destroy(),this._set("tool",null)}logError(...e){this.logger.error(...e)}};s([i({constructOnly:!0})],u.prototype,"tool",void 0),s([i()],u.prototype,"active",null),s([i()],u.prototype,"disabled",null),s([i()],u.prototype,"supported",null),s([i({value:null})],u.prototype,"view",null),s([i({type:Boolean,value:!0})],u.prototype,"visible",null),u=s([d("esri.widgets.support.InteractiveToolViewModel")],u);const o="esri-measurement-widget-content",l={base:o,actions:`${o}__actions`,error:`${o}__error`,hint:`${o}__hint`,hintText:`${o}__hint-text`,panelError:`${o}__panel--error`,settings:`${o}__settings`,measurement:`${o}__measurement`,measurementItem:`${o}__measurement-item`,measurementItemDisabled:`${o}__measurement-item--disabled`,measurementItemTitle:`${o}__measurement-item__title`,measurementItemValue:`${o}__measurement-item__value`};let n=class extends _{constructor(e,t){super(e,t)}loadDependencies(){return g({button:()=>y(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))})}render(){return r("div",{class:l.base},this._renderContent())}_renderContent(){const{supported:e,active:t,state:a}=this;switch(a){case"disabled":case"ready":return e?t?this._renderHint():this._renderActions():this._renderUnsupportedMessage();case"measuring":case"measured":return[this._renderSettings(),this._renderMeasurement(),this._renderActions()]}}_renderUnsupportedMessage(){return r("section",{class:l.error,key:"unsupported"},r("p",null,this.messages.unsupported))}_renderHint(){const{messages:e}=this;return r("section",{class:l.hint,key:"hint"},r("p",{class:l.hintText},e.hint))}_renderSettings(){return r("div",{class:l.settings,key:"settings"},r(w,{options:this.unitOptions,selectLabel:this.messages.unit,value:this.unit,onChange:this.onUnitChange}))}_renderMeasurement(){return r("section",{class:l.measurement,key:"measurement"},this.measurementItems.map(e=>this._renderMeasurementItem(e)))}_renderMeasurementItem({key:e,title:t,value:a}){return r("div",{class:this.classes(l.measurementItem,a==null&&l.measurementItemDisabled),key:e},r("span",{class:l.measurementItemTitle},t),r("span",{"aria-live":"polite",class:l.measurementItemValue},a??this.messages.notApplicable))}_renderActions(){const{messages:e}=this;return r("div",{class:l.actions},r("calcite-button",{class:this.newMeasurementButtonClass,disabled:this.state==="disabled",onclick:this.onNewMeasurementClick},e.newMeasurement))}};s([i()],n.prototype,"active",void 0),s([i()],n.prototype,"measurementItems",void 0),s([i()],n.prototype,"messages",void 0),s([i()],n.prototype,"newMeasurementButtonClass",void 0),s([i()],n.prototype,"onNewMeasurementClick",void 0),s([i()],n.prototype,"onUnitChange",void 0),s([i()],n.prototype,"state",void 0),s([i()],n.prototype,"supported",void 0),s([i()],n.prototype,"unit",void 0),s([i()],n.prototype,"unitOptions",void 0),n=s([d("esri.widgets.support.MeasurementWidgetContent")],n);export{u as n,n as u}; +import{e as s,y as i,c as d,g as p,R as h,B as m,T as c,v,hD as _,hE as g,de as y,hF as r,hG as w}from"./index-pCX-0tJH.js";let u=class extends p{constructor(e){super(e),this.tool=null,this._loggedUnsupportedErrorOnce=!1,this.logger=h.getLogger(this),(e==null?void 0:e.visible)!=null&&(this.visible=e.visible)}initialize(){this.addHandles(m(()=>({ready:this.view!=null&&this.view.ready,supported:this.supported}),({ready:e,supported:t})=>{!e||t||this._loggedUnsupportedErrorOnce||(this.logError(this.unsupportedErrorMessage),this._loggedUnsupportedErrorOnce=!0)},c))}destroy(){this.removeTool(),this.view=null}get active(){return this.tool!=null&&this.tool.active}get disabled(){return this.view==null||!this.view.ready||!this.supported}get supported(){return this.view==null||this.view.type===this.supportedViewType}get view(){return this._get("view")}set view(e){if(e===this.view)return;this.removeTool(),this._set("view",e);const t="tools";this.removeHandles(t),e!=null&&this.addHandles(e.tools.on("after-remove",a=>{a.item===this.tool&&this._set("tool",null)}),t)}set visible(e){this._set("visible",e),this.tool!=null&&(this.tool.visible=e)}createTool(e={interactive:!1}){if(this.removeTool(),this.view==null||!this.view.ready||!this.supported)return;const t=this.constructTool();t.created?(this._set("tool",t),this.view.tools.add(t)):e.interactive?(this._set("tool",t),this.view.addAndActivateTool(t),v(()=>t.created,()=>{t.active&&this.view!=null&&(this.view.activeTool=null)},{initial:!0,once:!0})):t.destroy()}removeTool(){var a;const e=this.tool;if(e==null)return;const t=(a=this.view)==null?void 0:a.tools;t!=null?t.remove(e):e.destroy(),this._set("tool",null)}logError(...e){this.logger.error(...e)}};s([i({constructOnly:!0})],u.prototype,"tool",void 0),s([i()],u.prototype,"active",null),s([i()],u.prototype,"disabled",null),s([i()],u.prototype,"supported",null),s([i({value:null})],u.prototype,"view",null),s([i({type:Boolean,value:!0})],u.prototype,"visible",null),u=s([d("esri.widgets.support.InteractiveToolViewModel")],u);const o="esri-measurement-widget-content",l={base:o,actions:`${o}__actions`,error:`${o}__error`,hint:`${o}__hint`,hintText:`${o}__hint-text`,panelError:`${o}__panel--error`,settings:`${o}__settings`,measurement:`${o}__measurement`,measurementItem:`${o}__measurement-item`,measurementItemDisabled:`${o}__measurement-item--disabled`,measurementItemTitle:`${o}__measurement-item__title`,measurementItemValue:`${o}__measurement-item__value`};let n=class extends _{constructor(e,t){super(e,t)}loadDependencies(){return g({button:()=>y(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))})}render(){return r("div",{class:l.base},this._renderContent())}_renderContent(){const{supported:e,active:t,state:a}=this;switch(a){case"disabled":case"ready":return e?t?this._renderHint():this._renderActions():this._renderUnsupportedMessage();case"measuring":case"measured":return[this._renderSettings(),this._renderMeasurement(),this._renderActions()]}}_renderUnsupportedMessage(){return r("section",{class:l.error,key:"unsupported"},r("p",null,this.messages.unsupported))}_renderHint(){const{messages:e}=this;return r("section",{class:l.hint,key:"hint"},r("p",{class:l.hintText},e.hint))}_renderSettings(){return r("div",{class:l.settings,key:"settings"},r(w,{options:this.unitOptions,selectLabel:this.messages.unit,value:this.unit,onChange:this.onUnitChange}))}_renderMeasurement(){return r("section",{class:l.measurement,key:"measurement"},this.measurementItems.map(e=>this._renderMeasurementItem(e)))}_renderMeasurementItem({key:e,title:t,value:a}){return r("div",{class:this.classes(l.measurementItem,a==null&&l.measurementItemDisabled),key:e},r("span",{class:l.measurementItemTitle},t),r("span",{"aria-live":"polite",class:l.measurementItemValue},a??this.messages.notApplicable))}_renderActions(){const{messages:e}=this;return r("div",{class:l.actions},r("calcite-button",{class:this.newMeasurementButtonClass,disabled:this.state==="disabled",onclick:this.onNewMeasurementClick},e.newMeasurement))}};s([i()],n.prototype,"active",void 0),s([i()],n.prototype,"measurementItems",void 0),s([i()],n.prototype,"messages",void 0),s([i()],n.prototype,"newMeasurementButtonClass",void 0),s([i()],n.prototype,"onNewMeasurementClick",void 0),s([i()],n.prototype,"onUnitChange",void 0),s([i()],n.prototype,"state",void 0),s([i()],n.prototype,"supported",void 0),s([i()],n.prototype,"unit",void 0),s([i()],n.prototype,"unitOptions",void 0),n=s([d("esri.widgets.support.MeasurementWidgetContent")],n);export{u as n,n as u}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/calcite-button-tOn16zeN.js","assets/button-dkwNndhL.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/form-2Iq0hI3D.js","assets/interactive-NKzPUNL4.js","assets/label2-d2vWQ7x7.js","assets/loadable-sxY2K1G3.js","assets/locale-pfkq1d6A.js","assets/key-qdHumIlA.js","assets/observers-JyBmMU24.js","assets/component-dtiBfYiX.js","assets/t9n-od6MEnI1.js","assets/icon-ZwpY5ksA.js","assets/loader-QqciGs1c.js","assets/guid-6vN-YNJI.js"] + __vite__mapDeps.viteFileDeps = ["assets/calcite-button-rIOy-85Y.js","assets/button-4hsayCiP.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/form-1U5Kiwxm.js","assets/interactive-9W9APeiw.js","assets/label2-JXqLMBYY.js","assets/loadable-uNbe2Ndt.js","assets/locale-tKMV0J87.js","assets/key-qdHumIlA.js","assets/observers-eNe735aq.js","assets/component-dtiBfYiX.js","assets/t9n-KLe7iM0R.js","assets/icon-BW6RCrUr.js","assets/loader-plQ4Tft5.js","assets/guid-6vN-YNJI.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/MediaElementView-ezYHddnZ.js b/dist/assets/MediaElementView-ezYHddnZ.js deleted file mode 100644 index 1244634..0000000 --- a/dist/assets/MediaElementView-ezYHddnZ.js +++ /dev/null @@ -1 +0,0 @@ -import{as as y,i$ as h,j0 as $,hL as d,j1 as g,j2 as j,j3 as p,aa as w,fB as u,e as l,y as a,c as A,p as E,j4 as c,eA as J,l as L}from"./index-J0iiHjMT.js";import{p as M}from"./normalizeUtilsSync-zfJiThlh.js";const o=w(),s=u(),i=u(),m=u();function U(e,t,r){return y(o,t[0],t[1],1),h(o,o,$(s,r)),o[2]===0?d(e,o[0],o[1]):d(e,o[0]/o[2],o[1]/o[2])}function V(e,t,r){return f(i,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]),f(m,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7]),g(e,j(i,i),m),e[8]!==0&&(e[0]/=e[8],e[1]/=e[8],e[2]/=e[8],e[3]/=e[8],e[4]/=e[8],e[5]/=e[8],e[6]/=e[8],e[7]/=e[8],e[8]/=e[8]),e}function f(e,t,r,x,z,C,b,B,v){p(e,t,x,C,r,z,b,1,1,1),y(o,B,v,1),j(s,e);const[R,S,k]=h(o,o,$(s,s));return p(s,R,0,0,0,S,0,0,0,k),g(e,s,e)}let n=class extends E{constructor(e){super(e)}get bounds(){const e=this.coords;return(e==null?void 0:e.extent)==null?null:c(e.extent)}get coords(){var t;const e=(t=this.element.georeference)==null?void 0:t.coords;return J(e,this.spatialReference).geometry}get normalizedCoords(){return L.fromJSON(M(this.coords))}get normalizedBounds(){const e=this.normalizedCoords!=null?this.normalizedCoords.extent:null;return e!=null?c(e):null}};l([a()],n.prototype,"spatialReference",void 0),l([a()],n.prototype,"element",void 0),l([a()],n.prototype,"bounds",null),l([a()],n.prototype,"coords",null),l([a()],n.prototype,"normalizedCoords",null),l([a()],n.prototype,"normalizedBounds",null),n=l([A("esri.layers.support.MediaElementView")],n);export{U as h,n as i,V as j}; diff --git a/dist/assets/MediaElementView-pYfW8oR4.js b/dist/assets/MediaElementView-pYfW8oR4.js new file mode 100644 index 0000000..6cc33eb --- /dev/null +++ b/dist/assets/MediaElementView-pYfW8oR4.js @@ -0,0 +1 @@ +import{bz as j,j6 as y,j7 as g,hJ as d,j8 as h,j9 as z,ja as p,a8 as S,fw as i,e as l,y as a,c as k,g as E,jb as c,eu as M,j as N}from"./index-pCX-0tJH.js";import{p as O}from"./normalizeUtilsSync-GeARMwm8.js";const o=S(),s=i(),u=i(),m=i();function q(e,t,r){return j(o,t[0],t[1],1),y(o,o,g(s,r)),o[2]===0?d(e,o[0],o[1]):d(e,o[0]/o[2],o[1]/o[2])}function A(e,t,r){return f(u,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]),f(m,r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7]),h(e,z(u,u),m),e[8]!==0&&(e[0]/=e[8],e[1]/=e[8],e[2]/=e[8],e[3]/=e[8],e[4]/=e[8],e[5]/=e[8],e[6]/=e[8],e[7]/=e[8],e[8]/=e[8]),e}function f(e,t,r,$,x,b,C,v,w){p(e,t,$,b,r,x,C,1,1,1),j(o,v,w,1),z(s,e);const[B,J,R]=y(o,o,g(s,s));return p(s,B,0,0,0,J,0,0,0,R),h(e,s,e)}let n=class extends E{constructor(e){super(e)}get bounds(){const e=this.coords;return(e==null?void 0:e.extent)==null?null:c(e.extent)}get coords(){var t;const e=(t=this.element.georeference)==null?void 0:t.coords;return M(e,this.spatialReference).geometry}get normalizedCoords(){return N.fromJSON(O(this.coords))}get normalizedBounds(){const e=this.normalizedCoords!=null?this.normalizedCoords.extent:null;return e!=null?c(e):null}};l([a()],n.prototype,"spatialReference",void 0),l([a()],n.prototype,"element",void 0),l([a()],n.prototype,"bounds",null),l([a()],n.prototype,"coords",null),l([a()],n.prototype,"normalizedCoords",null),l([a()],n.prototype,"normalizedBounds",null),n=l([k("esri.layers.support.MediaElementView")],n);export{q as h,n as i,A as j}; diff --git a/dist/assets/MediaLayer-39dmiD7K.js b/dist/assets/MediaLayer-39dmiD7K.js deleted file mode 100644 index ef3999a..0000000 --- a/dist/assets/MediaLayer-39dmiD7K.js +++ /dev/null @@ -1 +0,0 @@ -import{e as r,c as v,iE as $e,eA as F,Z as U,y as l,T as m,iB as me,ar as fe,oS as _e,hL as T,E as K,Y as H,oT as be,fB as D,dt as Y,du as ne,oU as A,oV as le,l as oe,a9 as R,p as Ie,oW as J,dT as se,ag as Me,oX as ae,oY as Se,oZ as Le,ij as ye,mb as Ee,hh as Oe,o_ as ce,o$ as ge,p0 as je,p1 as He,p2 as Te,p3 as Ce,p4 as We,bW as Ve,p5 as Ne,h6 as ze,p6 as Ae,p7 as Ue,V as q,cZ as Be,K as Ge,d as Fe,s as Ke,ef as Je,fd as Ze,al as ke,e1 as qe,j4 as De,p8 as Ye,dK as Qe,dO as Xe,dM as et,dP as tt,f6 as nt,c7 as ot}from"./index-J0iiHjMT.js";import{h as $,j as xe,i as st}from"./MediaElementView-ezYHddnZ.js";import{o as rt}from"./BoundsStore-wmwfHjhp.js";import"./normalizeUtilsSync-zfJiThlh.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";let te=class extends $e{projectOrWarn(e,t){if(e==null)return e;const{geometry:o,pending:n}=F(e,t);return n?null:n||o?o:(U.getLogger(this).warn("geometry could not be projected to the spatial reference",{georeference:this,geometry:e,sourceSpatialReference:e.spatialReference,targetSpatialReference:t}),null)}};te=r([v("esri.layers.support.GeoreferenceBase")],te);const Q=te,X=D(),p=R();let G=class extends Ie{constructor(){super(...arguments),this.sourcePoint=null,this.mapPoint=null}};r([l()],G.prototype,"sourcePoint",void 0),r([l({type:m})],G.prototype,"mapPoint",void 0),G=r([v("esri.layers.support.ControlPoint")],G);let x=class extends me(Q){constructor(e){super(e),this.controlPoints=null,this.height=0,this.type="control-points",this.width=0}readControlPoints(e,t){const o=fe.fromJSON(t.spatialReference),n=_e(...t.coefficients,1);return e.map(s=>(T(p,s.x,s.y),$(p,p,n),{sourcePoint:s,mapPoint:new m({x:p[0],y:p[1],spatialReference:o})}))}writeControlPoints(e,t,o,n){if(this.transform!=null)e!=null&&f(e[0])&&(t.controlPoints=e.map(s=>{const i=s.sourcePoint;return{x:i.x,y:i.y}}),t.spatialReference=e[0].mapPoint.spatialReference.toJSON(),t.coefficients=this.transform.slice(0,8));else{const s=new K("web-document-write:invalid-georeference","Invalid 'controlPoints', 'width', 'height' configuration.",{layer:n==null?void 0:n.layer,georeference:this});n!=null&&n.messages?n.messages.push(s):U.getLogger(this).error(s.name,s.message)}}get coords(){if(this.controlPoints==null)return null;const e=this._updateTransform(X);if(e==null||!f(this.controlPoints[0]))return null;const t=this.controlPoints[0].mapPoint.spatialReference;return ut(e,this.width,this.height,t)}set coords(e){if(this.controlPoints==null||!f(this.controlPoints[0]))return;const t=this.controlPoints[0].mapPoint.spatialReference;if((e=this.projectOrWarn(e,t))==null)return;const{width:o,height:n}=this,{rings:[[s,i,a,c]]}=e,u={sourcePoint:H(0,n),mapPoint:new m({x:s[0],y:s[1],spatialReference:t})},h={sourcePoint:H(0,0),mapPoint:new m({x:i[0],y:i[1],spatialReference:t})},d={sourcePoint:H(o,0),mapPoint:new m({x:a[0],y:a[1],spatialReference:t})},g={sourcePoint:H(o,n),mapPoint:new m({x:c[0],y:c[1],spatialReference:t})};f(u)&&f(h)&&f(d)&&f(g)&&(ue(X,u,h,d,g),this.controlPoints=this.controlPoints.map(({sourcePoint:w})=>(T(p,w.x,w.y),$(p,p,X),{sourcePoint:w,mapPoint:new m({x:p[0],y:p[1],spatialReference:t})})))}get inverseTransform(){return this.transform==null?null:be(D(),this.transform)}get transform(){return this._updateTransform()}toMap(e){if(e==null||this.transform==null||this.controlPoints==null||!f(this.controlPoints[0]))return null;T(p,e.x,e.y);const t=this.controlPoints[0].mapPoint.spatialReference;return $(p,p,this.transform),new m({x:p[0],y:p[1],spatialReference:t})}toSource(e){if(e==null||this.inverseTransform==null||this.controlPoints==null||!f(this.controlPoints[0]))return null;const t=this.controlPoints[0].mapPoint.spatialReference;return e=e.normalize(),(e=F(e,t).geometry)==null?null:(T(p,e.x,e.y),$(p,p,this.inverseTransform),H(p[0],p[1]))}toSourceNormalized(e){const t=this.toSource(e);return t!=null&&(t.x/=this.width,t.y/=this.height),t}_updateTransform(e){const{controlPoints:t,width:o,height:n}=this;if(!(t!=null&&o>0&&n>0))return null;const[s,i,a,c]=t;if(!f(s))return null;const u=s.mapPoint.spatialReference,h=this._projectControlPoint(i,u),d=this._projectControlPoint(a,u),g=this._projectControlPoint(c,u);if(!h.valid||!d.valid||!g.valid||!f(h.controlPoint))return null;e==null&&(e=D());let w=null;return w=f(d.controlPoint)&&f(g.controlPoint)?ue(e,s,h.controlPoint,d.controlPoint,g.controlPoint):f(d.controlPoint)?lt(e,s,h.controlPoint,d.controlPoint):it(e,s,h.controlPoint),w.every(we=>we===0)?null:w}_projectControlPoint(e,t){if(!f(e))return{valid:!0,controlPoint:e};const{sourcePoint:o,mapPoint:n}=e,{geometry:s,pending:i}=F(n,t);return i?{valid:!1,controlPoint:null}:i||s?{valid:!0,controlPoint:{sourcePoint:o,mapPoint:s}}:(U.getLogger(this).warn("map point could not be projected to the spatial reference",{georeference:this,controlPoint:e,sourceSpatialReference:n.spatialReference,targetSpatialReference:t}),{valid:!1,controlPoint:null})}};function f(e){return(e==null?void 0:e.sourcePoint)!=null&&e.mapPoint!=null}r([l({type:[G],json:{write:{allowNull:!1,isRequired:!0}}})],x.prototype,"controlPoints",void 0),r([Y("controlPoints")],x.prototype,"readControlPoints",null),r([ne("controlPoints")],x.prototype,"writeControlPoints",null),r([l()],x.prototype,"coords",null),r([l({json:{write:!0}})],x.prototype,"height",void 0),r([l({readOnly:!0})],x.prototype,"inverseTransform",null),r([l({readOnly:!0})],x.prototype,"transform",null),r([l({json:{write:!0}})],x.prototype,"width",void 0),x=r([v("esri.layers.support.ControlPointsGeoreference")],x);const _=R(),b=R(),C=R(),O=R(),I=R(),M=R(),W=R(),j=R(),Z=Math.PI/2;function S(e,t,o){T(e,o.sourcePoint.x,o.sourcePoint.y),T(t,o.mapPoint.x,o.mapPoint.y)}function it(e,t,o){return S(_,I,t),S(b,M,o),A(C,b,_,Z),A(O,_,b,Z),A(W,M,I,-Z),A(j,I,M,-Z),re(e,_,b,C,O,I,M,W,j)}function lt(e,t,o,n){return S(_,I,t),S(b,M,o),S(C,W,n),le(O,_,b,.5),A(O,C,O,Math.PI),le(j,I,M,.5),A(j,W,j,Math.PI),re(e,_,b,C,O,I,M,W,j)}function ue(e,t,o,n,s){return S(_,I,t),S(b,M,o),S(C,W,n),S(O,j,s),re(e,_,b,C,O,I,M,W,j)}const at=new Array(8).fill(0),ct=new Array(8).fill(0);function pe(e,t,o,n,s){return e[0]=t[0],e[1]=t[1],e[2]=o[0],e[3]=o[1],e[4]=n[0],e[5]=n[1],e[6]=s[0],e[7]=s[1],e}function re(e,t,o,n,s,i,a,c,u){return xe(e,pe(at,t,o,n,s),pe(ct,i,a,c,u))}function ut(e,t,o,n){const s=J(0,o),i=J(0,0),a=J(t,0),c=J(t,o);return $(s,s,e),$(i,i,e),$(a,a,e),$(c,c,e),new oe({rings:[[s,i,a,c,s]],spatialReference:n})}const Pe=x,B=R();let L=class extends Q{constructor(e){super(e),this.bottomLeft=null,this.bottomRight=null,this.topLeft=null,this.topRight=null,this.type="corners"}get coords(){let{topLeft:e,topRight:t,bottomLeft:o,bottomRight:n}=this;if(e==null||t==null||o==null||n==null)return null;const s=e.spatialReference;return t=this.projectOrWarn(t,s),o=this.projectOrWarn(o,s),n=this.projectOrWarn(n,s),t==null||o==null||n==null?null:new oe({rings:[[[o.x,o.y],[e.x,e.y],[t.x,t.y],[n.x,n.y],[o.x,o.y]]],spatialReference:s})}set coords(e){const{topLeft:t}=this;if(t==null)return;const o=t.spatialReference;if((e=this.projectOrWarn(e,o))==null)return;const{rings:[[n,s,i,a]]}=e;this.bottomLeft=new m({x:n[0],y:n[1],spatialReference:o}),this.topLeft=new m({x:s[0],y:s[1],spatialReference:o}),this.topRight=new m({x:i[0],y:i[1],spatialReference:o}),this.bottomRight=new m({x:a[0],y:a[1],spatialReference:o})}toSourceNormalized(e){const{topLeft:t,topRight:o,bottomRight:n,bottomLeft:s}=this;if(e==null||t==null||o==null||n==null||s==null)return null;const i=t.spatialReference;e=e.normalize();const a=F(e,i).geometry;if(a==null)return null;T(B,a.x,a.y);const c=xe(D(),[t.x,t.y,s.x,s.y,o.x,o.y,n.x,n.y],[0,0,0,1,1,0,1,1]);return $(B,B,c),H(B[0],B[1])}};r([l()],L.prototype,"coords",null),r([l({type:m})],L.prototype,"bottomLeft",void 0),r([l({type:m})],L.prototype,"bottomRight",void 0),r([l({type:m})],L.prototype,"topLeft",void 0),r([l({type:m})],L.prototype,"topRight",void 0),L=r([v("esri.layers.support.CornersGeoreference")],L);const pt=L;let V=class extends Q{constructor(e){super(e),this.extent=null,this.rotation=0,this.type="extent-and-rotation"}get coords(){if(this.extent==null)return null;const{xmin:e,ymin:t,xmax:o,ymax:n,spatialReference:s}=this.extent;let i;if(this.rotation){const{x:a,y:c}=this.extent.center,u=ee(a,c,this.rotation);i=[u(e,t),u(e,n),u(o,n),u(o,t)],i.push(i[0])}else i=[[e,t],[e,n],[o,n],[o,t],[e,t]];return new oe({rings:[i],spatialReference:s})}set coords(e){if(e==null||this.extent==null)return;const t=this.extent.spatialReference;if(e=this.projectOrWarn(e,t),(e==null?void 0:e.extent)==null)return;const{rings:[[o,n,s]],extent:{center:{x:i,y:a}}}=e,c=Me(Math.PI/2-Math.atan2(n[1]-o[1],n[0]-o[0])),u=ee(i,a,-c),[h,d]=u(o[0],o[1]),[g,w]=u(s[0],s[1]);this.extent=new se({xmin:h,ymin:d,xmax:g,ymax:w,spatialReference:t}),this.rotation=c}toSourceNormalized(e){const{extent:t,rotation:o}=this;if(e==null||t==null)return null;const{xmin:n,ymin:s,xmax:i,ymax:a,center:c,spatialReference:u}=t;e=e.normalize();const h=F(e,u).geometry;if(h==null)return null;let d=h.x,g=h.y;return o&&([d,g]=ee(c.x,c.y,-o)(d,g)),H(ae(d,n,i,0,1),ae(g,a,s,0,1))}};function ee(e,t,o){const n=Se(o),s=Math.cos(n),i=Math.sin(n);return(a,c)=>[s*(a-e)+i*(c-t)+e,s*(c-t)-i*(a-e)+t]}r([l()],V.prototype,"coords",null),r([l({type:se})],V.prototype,"extent",void 0),r([l({type:Number})],V.prototype,"rotation",void 0),V=r([v("esri.layers.support.ExtentAndRotationGeoreference")],V);const ht=V,dt={key:"type",base:Q,typeMap:{"control-points":Pe,corners:pt,"extent-and-rotation":ht}};let N=class extends Le(me(ye)){constructor(e){super(e),this.georeference=null,this.opacity=1}readGeoreference(e){return Pe.fromJSON(e)}get contentWidth(){return 0}get contentHeight(){return 0}toSource(e){const{georeference:t,contentWidth:o,contentHeight:n}=this;if(e==null||t==null||o===0||n===0)return null;const s=t.toSourceNormalized(e);return s==null?null:(s.x*=o,s.y*=n,s)}};r([l({types:dt,json:{write:!0}})],N.prototype,"georeference",void 0),r([Y("georeference")],N.prototype,"readGeoreference",null),r([l()],N.prototype,"opacity",void 0),N=r([v("esri.layers.support.MediaElementBase")],N);const ie=N;let P=class extends ie{constructor(t){super(t),this.animationOptions=null,this.content=null,this.image=null,this.type="image",this.image=null}load(){const t=this.image;if(typeof t=="string"){const o=Ee(t).then(n=>{this._set("content",n)});this.addResolvingPromise(o)}else if(t instanceof HTMLImageElement){const o=t.decode().then(()=>{this._set("content",t)});this.addResolvingPromise(o)}else t?this._set("content",t):this.addResolvingPromise(Promise.reject(new K("image-element:invalid-image-type","Invalid image type",{image:t})));return Promise.resolve(this)}get contentWidth(){return this.content==null?0:this.content instanceof HTMLImageElement?this.content.naturalWidth:this.content.width}get contentHeight(){return this.content==null?0:this.content instanceof HTMLImageElement?this.content.naturalHeight:this.content.height}readImage(t,o,n){return Oe(o.url,n)}writeImage(t,o,n,s){if(t==null)return;const i=s==null?void 0:s.portalItem,a=s==null?void 0:s.resources;if(!i||!a)return void(typeof t=="string"&&(o[n]=ce(t,s)));const c=typeof t!="string"||ge(t)||je(t)?null:t;if(c){if(He(c)==null)return void(o[n]=c);const u=ce(c,{...s,verifyItemRelativeUrls:s!=null&&s.verifyItemRelativeUrls?{writtenUrls:s.verifyItemRelativeUrls.writtenUrls,rootPath:void 0}:void 0},Te.NO);if(i&&u&&!Ce(u))return a.toKeep.push({resource:i.resourceFromPath(u),compress:!1}),void(o[n]=u)}o[n]="",a.pendingOperations.push(mt(t).then(u=>{const h=yt(u,i);o[n]=h.itemRelativeUrl,a.toAdd.push({resource:h,content:{type:"blob",blob:u},compress:!1,finish:d=>{this.image=d.url}})}))}};r([l()],P.prototype,"animationOptions",void 0),r([l({readOnly:!0})],P.prototype,"content",void 0),r([l({readOnly:!0})],P.prototype,"contentWidth",null),r([l({readOnly:!0})],P.prototype,"contentHeight",null),r([l({json:{name:"url",type:String}})],P.prototype,"image",void 0),r([Y("image",["url"])],P.prototype,"readImage",null),r([ne("image")],P.prototype,"writeImage",null),r([l({readOnly:!0,json:{name:"mediaType"}})],P.prototype,"type",void 0),P=r([v("esri.layers.support.ImageElement")],P);const ve=P;async function mt(e){return typeof e=="string"?ge(e)?We(e):(await Ve(e,{responseType:"blob"})).data:new Promise(t=>ft(e).toBlob(t))}function ft(e){if(e instanceof HTMLCanvasElement)return e;const t=e instanceof HTMLImageElement?e.naturalWidth:e.width,o=e instanceof HTMLImageElement?e.naturalHeight:e.height,n=document.createElement("canvas"),s=n.getContext("2d");return n.width=t,n.height=o,e instanceof HTMLImageElement?s.drawImage(e,0,0,e.width,e.height):e instanceof ImageData&&s.putImageData(e,0,0),n}function yt(e,t){const o=Ne(),n=`${ze("media",o)}.${Ae({type:"blob",blob:e})}`;return t.resourceFromPath(n)}let E=class extends ie{constructor(e){super(e),this.autoplay=!0,this.content=null,this.type="video"}load(){const e=this.video;if(typeof e=="string"){const t=document.createElement("video");t.src=e,t.crossOrigin="anonymous",t.autoplay=!0,t.muted=!0,t.loop=!0,this.addResolvingPromise(this._loadVideo(t).then(()=>{this._set("content",t)}))}else e instanceof HTMLVideoElement?this.addResolvingPromise(this._loadVideo(e).then(()=>{this._set("content",e)})):this.addResolvingPromise(Promise.reject(new K("video-element:invalid-video-type","Invalid video type",{video:e})));return Promise.resolve(this)}get contentWidth(){var e;return((e=this.content)==null?void 0:e.videoWidth)??0}get contentHeight(){var e;return((e=this.content)==null?void 0:e.videoHeight)??0}set video(e){this.loadStatus==="not-loaded"?this._set("video",e):U.getLogger(this).error("#video","video cannot be changed after the element is loaded.")}_loadVideo(e){return new Promise((t,o)=>{var s;const n=Ue(e,"canplay",()=>{this.removeHandles("canplay"),this.autoplay?e.play().then(t,o):t()});this.addHandles(n,"canplay"),e.crossOrigin!=="anonymous"&&(e.crossOrigin="anonymous",(s=e.src)!=null&&s.includes("blob:")||(e.src=e.src))})}};r([l()],E.prototype,"autoplay",void 0),r([l({readOnly:!0})],E.prototype,"content",void 0),r([l({readOnly:!0})],E.prototype,"contentWidth",null),r([l({readOnly:!0})],E.prototype,"contentHeight",null),r([l()],E.prototype,"video",null),E=r([v("esri.layers.support.VideoElement")],E);const Re=E,gt={key:"type",defaultKeyValue:"image",base:ie,typeMap:{image:ve,video:Re}},he=q.ofType(gt);let z=class extends ye.LoadableMixin(Be(Ge.EventedAccessor)){constructor(e){super(e),this._index=new rt,this._elementViewsMap=new Map,this._elementsIndexes=new Map,this._elementsChangedHandler=t=>{for(const n of t.removed){const s=this._elementViewsMap.get(n);this._elementViewsMap.delete(n),this._index.delete(s),this.removeHandles(s),s.destroy(),this.notifyChange("fullExtent")}const{spatialReference:o}=this;for(const n of t.added){if(this._elementViewsMap.get(n))continue;const s=new st({spatialReference:o,element:n});this._elementViewsMap.set(n,s);const i=Fe(()=>s.coords,()=>this._updateIndexForElement(s,!1));this._updateIndexForElement(s,!0),this.addHandles(i,s)}this._elementsIndexes.clear(),this.elements.forEach((n,s)=>this._elementsIndexes.set(n,s)),this.emit("refresh")},this.elements=new he}async load(e){if(Ke(e),!this.spatialReference){const t=this.elements.find(o=>{var n;return((n=o.georeference)==null?void 0:n.coords)!=null});this._set("spatialReference",t?t.georeference.coords.spatialReference:fe.WGS84)}return this._elementsChangedHandler({added:this.elements.items,removed:[]}),this.addHandles(this.elements.on("change",this._elementsChangedHandler)),this}destroy(){this._index.clear(),this._elementViewsMap.clear(),this._elementsIndexes.clear()}set elements(e){this._set("elements",Je(e,this._get("elements"),he))}get fullExtent(){if(this.loadStatus==="not-loaded")return null;const e=this._index.fullBounds;return e==null?null:new se({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:this.spatialReference})}set spatialReference(e){this.loadStatus==="not-loaded"?this._set("spatialReference",e):U.getLogger(this).error("#spatialReference","spatialReference cannot be changed after the source is loaded.")}async queryElements(e,t){await this.load(),await Ze(e.spatialReference,this.spatialReference,null,t);const o=ke(e.spatialReference,this.spatialReference)?e:qe(e,this.spatialReference);if(!o)return[];const n=o.normalize(),s=[];for(const i of n)this._index.forEachInBounds(De(i),({normalizedCoords:a,element:c})=>{a!=null&&Ye(i,a)&&s.push(c)});return s.sort((i,a)=>this._elementsIndexes.get(i)-this._elementsIndexes.get(a)),s}_updateIndexForElement(e,t){const o=e.normalizedBounds,n=this._index.has(e),s=o!=null;this._index.delete(e),s&&this._index.set(e,o),this.notifyChange("fullExtent"),t||(n!==s?this.emit("refresh"):this.emit("change",{element:e.element}))}};r([l()],z.prototype,"elements",null),r([l({readOnly:!0})],z.prototype,"fullExtent",null),r([l()],z.prototype,"spatialReference",null),z=r([v("esri.layers.support.LocalMediaElementSource")],z);const k=z;function de(e){return typeof e=="object"&&e!=null&&"type"in e}let y=class extends Qe(Xe(et(tt(ot)))){constructor(e){super(e),this.effectiveSource=null,this.copyright=null,this.operationalLayerType="MediaLayer",this.spatialReference=null,this.type="media",this.source=new k}load(e){const t=this.source;if(!t)return this.addResolvingPromise(Promise.reject(new K("media-layer:source-missing","Set 'MediaLayer.source' before loading the layer."))),Promise.resolve(this);const o=de(t)?new k({elements:new q([t])}):t;this._set("effectiveSource",o),this.spatialReference&&(o.spatialReference=this.spatialReference);const n=o.load(e).then(()=>{this.spatialReference=o.spatialReference});return this.addResolvingPromise(n),Promise.resolve(this)}destroy(){var e,t;(e=this.effectiveSource)==null||e.destroy(),(t=this.source)==null||t.destroy()}get fullExtent(){return this.loaded?this.effectiveSource.fullExtent:null}set source(e){this.loadStatus==="not-loaded"?this._set("source",e):U.getLogger(this).error("#source","source cannot be changed after the layer is loaded.")}castSource(e){return e?Array.isArray(e)?new k({elements:new q(e)}):e instanceof q?new k({elements:e}):e:null}readSource(e,t,o){const n=t.mediaType==="image"?new ve:t.mediaType==="video"?new Re:null;return n==null||n.read(t,o),n}writeSource(e,t,o,n){var s;e&&de(e)&&e.type==="image"?e.write(t,n):n!=null&&n.messages&&((s=n==null?void 0:n.messages)==null||s.push(new K("media-layer:unsupported-source","source must be an 'ImageElement'")))}};r([l({readOnly:!0})],y.prototype,"effectiveSource",void 0),r([l({type:String})],y.prototype,"copyright",void 0),r([l({readOnly:!0})],y.prototype,"fullExtent",null),r([l({type:["MediaLayer"]})],y.prototype,"operationalLayerType",void 0),r([l({type:["show","hide"]})],y.prototype,"listMode",void 0),r([l({nonNullable:!0,json:{write:{enabled:!0,allowNull:!1}}})],y.prototype,"source",null),r([nt("source")],y.prototype,"castSource",null),r([Y("source",["url"])],y.prototype,"readSource",null),r([ne("source")],y.prototype,"writeSource",null),r([l()],y.prototype,"spatialReference",void 0),r([l({readOnly:!0})],y.prototype,"type",void 0),y=r([v("esri.layers.MediaLayer")],y);const bt=y;export{bt as default}; diff --git a/dist/assets/MediaLayer-PKp6pKCX.js b/dist/assets/MediaLayer-PKp6pKCX.js new file mode 100644 index 0000000..86683f7 --- /dev/null +++ b/dist/assets/MediaLayer-PKp6pKCX.js @@ -0,0 +1 @@ +import{e as r,c as v,iF as $e,eu as G,R as F,y as l,L as m,iC as me,d2 as fe,p3 as _e,hJ as T,r as J,Q as H,p4 as be,fw as Q,dt as Y,du as ne,p5 as A,p6 as le,j as oe,a7 as R,g as Ie,p7 as k,dO as se,ch as Me,p8 as ae,p9 as Le,pa as Se,il as ye,mj as je,hj as Ee,pb as ce,pc as ge,pd as Oe,pe as He,pf as Te,pg as Ce,ph as We,av as Ve,pi as Ne,h8 as ze,pj as Ae,pk as Fe,V as D,cQ as Ue,z as Be,B as Ge,ab as Je,e8 as ke,f8 as Ke,bt as qe,dW as De,jb as Qe,pl as Ye,dF as Ze,dJ as Xe,dH as et,dK as tt,f1 as nt,aI as ot}from"./index-pCX-0tJH.js";import{h as $,j as xe,i as st}from"./MediaElementView-pYfW8oR4.js";import{o as rt}from"./BoundsStore-_-dPK5c-.js";import"./normalizeUtilsSync-GeARMwm8.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";let te=class extends $e{projectOrWarn(e,t){if(e==null)return e;const{geometry:o,pending:n}=G(e,t);return n?null:n||o?o:(F.getLogger(this).warn("geometry could not be projected to the spatial reference",{georeference:this,geometry:e,sourceSpatialReference:e.spatialReference,targetSpatialReference:t}),null)}};te=r([v("esri.layers.support.GeoreferenceBase")],te);const Z=te,X=Q(),p=R();let B=class extends Ie{constructor(){super(...arguments),this.sourcePoint=null,this.mapPoint=null}};r([l()],B.prototype,"sourcePoint",void 0),r([l({type:m})],B.prototype,"mapPoint",void 0),B=r([v("esri.layers.support.ControlPoint")],B);let x=class extends me(Z){constructor(e){super(e),this.controlPoints=null,this.height=0,this.type="control-points",this.width=0}readControlPoints(e,t){const o=fe.fromJSON(t.spatialReference),n=_e(...t.coefficients,1);return e.map(s=>(T(p,s.x,s.y),$(p,p,n),{sourcePoint:s,mapPoint:new m({x:p[0],y:p[1],spatialReference:o})}))}writeControlPoints(e,t,o,n){if(this.transform!=null)e!=null&&f(e[0])&&(t.controlPoints=e.map(s=>{const i=s.sourcePoint;return{x:i.x,y:i.y}}),t.spatialReference=e[0].mapPoint.spatialReference.toJSON(),t.coefficients=this.transform.slice(0,8));else{const s=new J("web-document-write:invalid-georeference","Invalid 'controlPoints', 'width', 'height' configuration.",{layer:n==null?void 0:n.layer,georeference:this});n!=null&&n.messages?n.messages.push(s):F.getLogger(this).error(s.name,s.message)}}get coords(){if(this.controlPoints==null)return null;const e=this._updateTransform(X);if(e==null||!f(this.controlPoints[0]))return null;const t=this.controlPoints[0].mapPoint.spatialReference;return ut(e,this.width,this.height,t)}set coords(e){if(this.controlPoints==null||!f(this.controlPoints[0]))return;const t=this.controlPoints[0].mapPoint.spatialReference;if((e=this.projectOrWarn(e,t))==null)return;const{width:o,height:n}=this,{rings:[[s,i,a,c]]}=e,u={sourcePoint:H(0,n),mapPoint:new m({x:s[0],y:s[1],spatialReference:t})},h={sourcePoint:H(0,0),mapPoint:new m({x:i[0],y:i[1],spatialReference:t})},d={sourcePoint:H(o,0),mapPoint:new m({x:a[0],y:a[1],spatialReference:t})},g={sourcePoint:H(o,n),mapPoint:new m({x:c[0],y:c[1],spatialReference:t})};f(u)&&f(h)&&f(d)&&f(g)&&(ue(X,u,h,d,g),this.controlPoints=this.controlPoints.map(({sourcePoint:w})=>(T(p,w.x,w.y),$(p,p,X),{sourcePoint:w,mapPoint:new m({x:p[0],y:p[1],spatialReference:t})})))}get inverseTransform(){return this.transform==null?null:be(Q(),this.transform)}get transform(){return this._updateTransform()}toMap(e){if(e==null||this.transform==null||this.controlPoints==null||!f(this.controlPoints[0]))return null;T(p,e.x,e.y);const t=this.controlPoints[0].mapPoint.spatialReference;return $(p,p,this.transform),new m({x:p[0],y:p[1],spatialReference:t})}toSource(e){if(e==null||this.inverseTransform==null||this.controlPoints==null||!f(this.controlPoints[0]))return null;const t=this.controlPoints[0].mapPoint.spatialReference;return e=e.normalize(),(e=G(e,t).geometry)==null?null:(T(p,e.x,e.y),$(p,p,this.inverseTransform),H(p[0],p[1]))}toSourceNormalized(e){const t=this.toSource(e);return t!=null&&(t.x/=this.width,t.y/=this.height),t}_updateTransform(e){const{controlPoints:t,width:o,height:n}=this;if(!(t!=null&&o>0&&n>0))return null;const[s,i,a,c]=t;if(!f(s))return null;const u=s.mapPoint.spatialReference,h=this._projectControlPoint(i,u),d=this._projectControlPoint(a,u),g=this._projectControlPoint(c,u);if(!h.valid||!d.valid||!g.valid||!f(h.controlPoint))return null;e==null&&(e=Q());let w=null;return w=f(d.controlPoint)&&f(g.controlPoint)?ue(e,s,h.controlPoint,d.controlPoint,g.controlPoint):f(d.controlPoint)?lt(e,s,h.controlPoint,d.controlPoint):it(e,s,h.controlPoint),w.every(we=>we===0)?null:w}_projectControlPoint(e,t){if(!f(e))return{valid:!0,controlPoint:e};const{sourcePoint:o,mapPoint:n}=e,{geometry:s,pending:i}=G(n,t);return i?{valid:!1,controlPoint:null}:i||s?{valid:!0,controlPoint:{sourcePoint:o,mapPoint:s}}:(F.getLogger(this).warn("map point could not be projected to the spatial reference",{georeference:this,controlPoint:e,sourceSpatialReference:n.spatialReference,targetSpatialReference:t}),{valid:!1,controlPoint:null})}};function f(e){return(e==null?void 0:e.sourcePoint)!=null&&e.mapPoint!=null}r([l({type:[B],json:{write:{allowNull:!1,isRequired:!0}}})],x.prototype,"controlPoints",void 0),r([Y("controlPoints")],x.prototype,"readControlPoints",null),r([ne("controlPoints")],x.prototype,"writeControlPoints",null),r([l()],x.prototype,"coords",null),r([l({json:{write:!0}})],x.prototype,"height",void 0),r([l({readOnly:!0})],x.prototype,"inverseTransform",null),r([l({readOnly:!0})],x.prototype,"transform",null),r([l({json:{write:!0}})],x.prototype,"width",void 0),x=r([v("esri.layers.support.ControlPointsGeoreference")],x);const _=R(),b=R(),C=R(),E=R(),I=R(),M=R(),W=R(),O=R(),K=Math.PI/2;function L(e,t,o){T(e,o.sourcePoint.x,o.sourcePoint.y),T(t,o.mapPoint.x,o.mapPoint.y)}function it(e,t,o){return L(_,I,t),L(b,M,o),A(C,b,_,K),A(E,_,b,K),A(W,M,I,-K),A(O,I,M,-K),re(e,_,b,C,E,I,M,W,O)}function lt(e,t,o,n){return L(_,I,t),L(b,M,o),L(C,W,n),le(E,_,b,.5),A(E,C,E,Math.PI),le(O,I,M,.5),A(O,W,O,Math.PI),re(e,_,b,C,E,I,M,W,O)}function ue(e,t,o,n,s){return L(_,I,t),L(b,M,o),L(C,W,n),L(E,O,s),re(e,_,b,C,E,I,M,W,O)}const at=new Array(8).fill(0),ct=new Array(8).fill(0);function pe(e,t,o,n,s){return e[0]=t[0],e[1]=t[1],e[2]=o[0],e[3]=o[1],e[4]=n[0],e[5]=n[1],e[6]=s[0],e[7]=s[1],e}function re(e,t,o,n,s,i,a,c,u){return xe(e,pe(at,t,o,n,s),pe(ct,i,a,c,u))}function ut(e,t,o,n){const s=k(0,o),i=k(0,0),a=k(t,0),c=k(t,o);return $(s,s,e),$(i,i,e),$(a,a,e),$(c,c,e),new oe({rings:[[s,i,a,c,s]],spatialReference:n})}const Pe=x,U=R();let S=class extends Z{constructor(e){super(e),this.bottomLeft=null,this.bottomRight=null,this.topLeft=null,this.topRight=null,this.type="corners"}get coords(){let{topLeft:e,topRight:t,bottomLeft:o,bottomRight:n}=this;if(e==null||t==null||o==null||n==null)return null;const s=e.spatialReference;return t=this.projectOrWarn(t,s),o=this.projectOrWarn(o,s),n=this.projectOrWarn(n,s),t==null||o==null||n==null?null:new oe({rings:[[[o.x,o.y],[e.x,e.y],[t.x,t.y],[n.x,n.y],[o.x,o.y]]],spatialReference:s})}set coords(e){const{topLeft:t}=this;if(t==null)return;const o=t.spatialReference;if((e=this.projectOrWarn(e,o))==null)return;const{rings:[[n,s,i,a]]}=e;this.bottomLeft=new m({x:n[0],y:n[1],spatialReference:o}),this.topLeft=new m({x:s[0],y:s[1],spatialReference:o}),this.topRight=new m({x:i[0],y:i[1],spatialReference:o}),this.bottomRight=new m({x:a[0],y:a[1],spatialReference:o})}toSourceNormalized(e){const{topLeft:t,topRight:o,bottomRight:n,bottomLeft:s}=this;if(e==null||t==null||o==null||n==null||s==null)return null;const i=t.spatialReference;e=e.normalize();const a=G(e,i).geometry;if(a==null)return null;T(U,a.x,a.y);const c=xe(Q(),[t.x,t.y,s.x,s.y,o.x,o.y,n.x,n.y],[0,0,0,1,1,0,1,1]);return $(U,U,c),H(U[0],U[1])}};r([l()],S.prototype,"coords",null),r([l({type:m})],S.prototype,"bottomLeft",void 0),r([l({type:m})],S.prototype,"bottomRight",void 0),r([l({type:m})],S.prototype,"topLeft",void 0),r([l({type:m})],S.prototype,"topRight",void 0),S=r([v("esri.layers.support.CornersGeoreference")],S);const pt=S;let V=class extends Z{constructor(e){super(e),this.extent=null,this.rotation=0,this.type="extent-and-rotation"}get coords(){if(this.extent==null)return null;const{xmin:e,ymin:t,xmax:o,ymax:n,spatialReference:s}=this.extent;let i;if(this.rotation){const{x:a,y:c}=this.extent.center,u=ee(a,c,this.rotation);i=[u(e,t),u(e,n),u(o,n),u(o,t)],i.push(i[0])}else i=[[e,t],[e,n],[o,n],[o,t],[e,t]];return new oe({rings:[i],spatialReference:s})}set coords(e){if(e==null||this.extent==null)return;const t=this.extent.spatialReference;if(e=this.projectOrWarn(e,t),(e==null?void 0:e.extent)==null)return;const{rings:[[o,n,s]],extent:{center:{x:i,y:a}}}=e,c=Me(Math.PI/2-Math.atan2(n[1]-o[1],n[0]-o[0])),u=ee(i,a,-c),[h,d]=u(o[0],o[1]),[g,w]=u(s[0],s[1]);this.extent=new se({xmin:h,ymin:d,xmax:g,ymax:w,spatialReference:t}),this.rotation=c}toSourceNormalized(e){const{extent:t,rotation:o}=this;if(e==null||t==null)return null;const{xmin:n,ymin:s,xmax:i,ymax:a,center:c,spatialReference:u}=t;e=e.normalize();const h=G(e,u).geometry;if(h==null)return null;let d=h.x,g=h.y;return o&&([d,g]=ee(c.x,c.y,-o)(d,g)),H(ae(d,n,i,0,1),ae(g,a,s,0,1))}};function ee(e,t,o){const n=Le(o),s=Math.cos(n),i=Math.sin(n);return(a,c)=>[s*(a-e)+i*(c-t)+e,s*(c-t)-i*(a-e)+t]}r([l()],V.prototype,"coords",null),r([l({type:se})],V.prototype,"extent",void 0),r([l({type:Number})],V.prototype,"rotation",void 0),V=r([v("esri.layers.support.ExtentAndRotationGeoreference")],V);const ht=V,dt={key:"type",base:Z,typeMap:{"control-points":Pe,corners:pt,"extent-and-rotation":ht}};let N=class extends Se(me(ye)){constructor(e){super(e),this.georeference=null,this.opacity=1}readGeoreference(e){return Pe.fromJSON(e)}get contentWidth(){return 0}get contentHeight(){return 0}toSource(e){const{georeference:t,contentWidth:o,contentHeight:n}=this;if(e==null||t==null||o===0||n===0)return null;const s=t.toSourceNormalized(e);return s==null?null:(s.x*=o,s.y*=n,s)}};r([l({types:dt,json:{write:!0}})],N.prototype,"georeference",void 0),r([Y("georeference")],N.prototype,"readGeoreference",null),r([l()],N.prototype,"opacity",void 0),N=r([v("esri.layers.support.MediaElementBase")],N);const ie=N;let P=class extends ie{constructor(t){super(t),this.animationOptions=null,this.content=null,this.image=null,this.type="image",this.image=null}load(){const t=this.image;if(typeof t=="string"){const o=je(t).then(n=>{this._set("content",n)});this.addResolvingPromise(o)}else if(t instanceof HTMLImageElement){const o=t.decode().then(()=>{this._set("content",t)});this.addResolvingPromise(o)}else t?this._set("content",t):this.addResolvingPromise(Promise.reject(new J("image-element:invalid-image-type","Invalid image type",{image:t})));return Promise.resolve(this)}get contentWidth(){return this.content==null?0:this.content instanceof HTMLImageElement?this.content.naturalWidth:this.content.width}get contentHeight(){return this.content==null?0:this.content instanceof HTMLImageElement?this.content.naturalHeight:this.content.height}readImage(t,o,n){return Ee(o.url,n)}writeImage(t,o,n,s){if(t==null)return;const i=s==null?void 0:s.portalItem,a=s==null?void 0:s.resources;if(!i||!a)return void(typeof t=="string"&&(o[n]=ce(t,s)));const c=typeof t!="string"||ge(t)||Oe(t)?null:t;if(c){if(He(c)==null)return void(o[n]=c);const u=ce(c,{...s,verifyItemRelativeUrls:s!=null&&s.verifyItemRelativeUrls?{writtenUrls:s.verifyItemRelativeUrls.writtenUrls,rootPath:void 0}:void 0},Te.NO);if(i&&u&&!Ce(u))return a.toKeep.push({resource:i.resourceFromPath(u),compress:!1}),void(o[n]=u)}o[n]="",a.pendingOperations.push(mt(t).then(u=>{const h=yt(u,i);o[n]=h.itemRelativeUrl,a.toAdd.push({resource:h,content:{type:"blob",blob:u},compress:!1,finish:d=>{this.image=d.url}})}))}};r([l()],P.prototype,"animationOptions",void 0),r([l({readOnly:!0})],P.prototype,"content",void 0),r([l({readOnly:!0})],P.prototype,"contentWidth",null),r([l({readOnly:!0})],P.prototype,"contentHeight",null),r([l({json:{name:"url",type:String}})],P.prototype,"image",void 0),r([Y("image",["url"])],P.prototype,"readImage",null),r([ne("image")],P.prototype,"writeImage",null),r([l({readOnly:!0,json:{name:"mediaType"}})],P.prototype,"type",void 0),P=r([v("esri.layers.support.ImageElement")],P);const ve=P;async function mt(e){return typeof e=="string"?ge(e)?We(e):(await Ve(e,{responseType:"blob"})).data:new Promise(t=>ft(e).toBlob(t))}function ft(e){if(e instanceof HTMLCanvasElement)return e;const t=e instanceof HTMLImageElement?e.naturalWidth:e.width,o=e instanceof HTMLImageElement?e.naturalHeight:e.height,n=document.createElement("canvas"),s=n.getContext("2d");return n.width=t,n.height=o,e instanceof HTMLImageElement?s.drawImage(e,0,0,e.width,e.height):e instanceof ImageData&&s.putImageData(e,0,0),n}function yt(e,t){const o=Ne(),n=`${ze("media",o)}.${Ae({type:"blob",blob:e})}`;return t.resourceFromPath(n)}let j=class extends ie{constructor(e){super(e),this.autoplay=!0,this.content=null,this.type="video"}load(){const e=this.video;if(typeof e=="string"){const t=document.createElement("video");t.src=e,t.crossOrigin="anonymous",t.autoplay=!0,t.muted=!0,t.loop=!0,this.addResolvingPromise(this._loadVideo(t).then(()=>{this._set("content",t)}))}else e instanceof HTMLVideoElement?this.addResolvingPromise(this._loadVideo(e).then(()=>{this._set("content",e)})):this.addResolvingPromise(Promise.reject(new J("video-element:invalid-video-type","Invalid video type",{video:e})));return Promise.resolve(this)}get contentWidth(){var e;return((e=this.content)==null?void 0:e.videoWidth)??0}get contentHeight(){var e;return((e=this.content)==null?void 0:e.videoHeight)??0}set video(e){this.loadStatus==="not-loaded"?this._set("video",e):F.getLogger(this).error("#video","video cannot be changed after the element is loaded.")}_loadVideo(e){return new Promise((t,o)=>{var s;const n=Fe(e,"canplay",()=>{this.removeHandles("canplay"),this.autoplay?e.play().then(t,o):t()});this.addHandles(n,"canplay"),e.crossOrigin!=="anonymous"&&(e.crossOrigin="anonymous",(s=e.src)!=null&&s.includes("blob:")||(e.src=e.src))})}};r([l()],j.prototype,"autoplay",void 0),r([l({readOnly:!0})],j.prototype,"content",void 0),r([l({readOnly:!0})],j.prototype,"contentWidth",null),r([l({readOnly:!0})],j.prototype,"contentHeight",null),r([l()],j.prototype,"video",null),j=r([v("esri.layers.support.VideoElement")],j);const Re=j,gt={key:"type",defaultKeyValue:"image",base:ie,typeMap:{image:ve,video:Re}},he=D.ofType(gt);let z=class extends ye.LoadableMixin(Ue(Be.EventedAccessor)){constructor(e){super(e),this._index=new rt,this._elementViewsMap=new Map,this._elementsIndexes=new Map,this._elementsChangedHandler=t=>{for(const n of t.removed){const s=this._elementViewsMap.get(n);this._elementViewsMap.delete(n),this._index.delete(s),this.removeHandles(s),s.destroy(),this.notifyChange("fullExtent")}const{spatialReference:o}=this;for(const n of t.added){if(this._elementViewsMap.get(n))continue;const s=new st({spatialReference:o,element:n});this._elementViewsMap.set(n,s);const i=Ge(()=>s.coords,()=>this._updateIndexForElement(s,!1));this._updateIndexForElement(s,!0),this.addHandles(i,s)}this._elementsIndexes.clear(),this.elements.forEach((n,s)=>this._elementsIndexes.set(n,s)),this.emit("refresh")},this.elements=new he}async load(e){if(Je(e),!this.spatialReference){const t=this.elements.find(o=>{var n;return((n=o.georeference)==null?void 0:n.coords)!=null});this._set("spatialReference",t?t.georeference.coords.spatialReference:fe.WGS84)}return this._elementsChangedHandler({added:this.elements.items,removed:[]}),this.addHandles(this.elements.on("change",this._elementsChangedHandler)),this}destroy(){this._index.clear(),this._elementViewsMap.clear(),this._elementsIndexes.clear()}set elements(e){this._set("elements",ke(e,this._get("elements"),he))}get fullExtent(){if(this.loadStatus==="not-loaded")return null;const e=this._index.fullBounds;return e==null?null:new se({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:this.spatialReference})}set spatialReference(e){this.loadStatus==="not-loaded"?this._set("spatialReference",e):F.getLogger(this).error("#spatialReference","spatialReference cannot be changed after the source is loaded.")}async queryElements(e,t){await this.load(),await Ke(e.spatialReference,this.spatialReference,null,t);const o=qe(e.spatialReference,this.spatialReference)?e:De(e,this.spatialReference);if(!o)return[];const n=o.normalize(),s=[];for(const i of n)this._index.forEachInBounds(Qe(i),({normalizedCoords:a,element:c})=>{a!=null&&Ye(i,a)&&s.push(c)});return s.sort((i,a)=>this._elementsIndexes.get(i)-this._elementsIndexes.get(a)),s}_updateIndexForElement(e,t){const o=e.normalizedBounds,n=this._index.has(e),s=o!=null;this._index.delete(e),s&&this._index.set(e,o),this.notifyChange("fullExtent"),t||(n!==s?this.emit("refresh"):this.emit("change",{element:e.element}))}};r([l()],z.prototype,"elements",null),r([l({readOnly:!0})],z.prototype,"fullExtent",null),r([l()],z.prototype,"spatialReference",null),z=r([v("esri.layers.support.LocalMediaElementSource")],z);const q=z;function de(e){return typeof e=="object"&&e!=null&&"type"in e}let y=class extends Ze(Xe(et(tt(ot)))){constructor(e){super(e),this.effectiveSource=null,this.copyright=null,this.operationalLayerType="MediaLayer",this.spatialReference=null,this.type="media",this.source=new q}load(e){const t=this.source;if(!t)return this.addResolvingPromise(Promise.reject(new J("media-layer:source-missing","Set 'MediaLayer.source' before loading the layer."))),Promise.resolve(this);const o=de(t)?new q({elements:new D([t])}):t;this._set("effectiveSource",o),this.spatialReference&&(o.spatialReference=this.spatialReference);const n=o.load(e).then(()=>{this.spatialReference=o.spatialReference});return this.addResolvingPromise(n),Promise.resolve(this)}destroy(){var e,t;(e=this.effectiveSource)==null||e.destroy(),(t=this.source)==null||t.destroy()}get fullExtent(){return this.loaded?this.effectiveSource.fullExtent:null}set source(e){this.loadStatus==="not-loaded"?this._set("source",e):F.getLogger(this).error("#source","source cannot be changed after the layer is loaded.")}castSource(e){return e?Array.isArray(e)?new q({elements:new D(e)}):e instanceof D?new q({elements:e}):e:null}readSource(e,t,o){const n=t.mediaType==="image"?new ve:t.mediaType==="video"?new Re:null;return n==null||n.read(t,o),n}writeSource(e,t,o,n){var s;e&&de(e)&&e.type==="image"?e.write(t,n):n!=null&&n.messages&&((s=n==null?void 0:n.messages)==null||s.push(new J("media-layer:unsupported-source","source must be an 'ImageElement'")))}};r([l({readOnly:!0})],y.prototype,"effectiveSource",void 0),r([l({type:String})],y.prototype,"copyright",void 0),r([l({readOnly:!0})],y.prototype,"fullExtent",null),r([l({type:["MediaLayer"]})],y.prototype,"operationalLayerType",void 0),r([l({type:["show","hide"]})],y.prototype,"listMode",void 0),r([l({nonNullable:!0,json:{write:{enabled:!0,allowNull:!1}}})],y.prototype,"source",null),r([nt("source")],y.prototype,"castSource",null),r([Y("source",["url"])],y.prototype,"readSource",null),r([ne("source")],y.prototype,"writeSource",null),r([l()],y.prototype,"spatialReference",void 0),r([l({readOnly:!0})],y.prototype,"type",void 0),y=r([v("esri.layers.MediaLayer")],y);const bt=y;export{bt as default}; diff --git a/dist/assets/MediaLayerView3D-CIdxGOiQ.js b/dist/assets/MediaLayerView3D-LfY78zh1.js similarity index 75% rename from dist/assets/MediaLayerView3D-CIdxGOiQ.js rename to dist/assets/MediaLayerView3D-LfY78zh1.js index ca72780..4257d20 100644 --- a/dist/assets/MediaLayerView3D-CIdxGOiQ.js +++ b/dist/assets/MediaLayerView3D-LfY78zh1.js @@ -1 +1 @@ -import{c3 as T,G as x,ah as P,a2 as b,fl as D,eD as G,fu as c,fv as I,fw as M,fx as z,by as S,bf as s,bz as m,b7 as H,fy as $,bg as h,E as O,fz as V,fA as f,e as p,y as v,c as C,fB as L}from"./index-J0iiHjMT.js";import{i as W,j as N}from"./MediaElementView-ezYHddnZ.js";import{n as U}from"./LayerView3D-iOx2MD1g.js";import{g as k}from"./ImageMaterial.glsl-TdPtjVc_.js";import{u as Y}from"./LayerView-efDufa6j.js";import"./normalizeUtilsSync-zfJiThlh.js";let o=class extends U(Y){constructor(){super(...arguments),this.type="media-3d",this.drapeSourceType=T.RasterImage,this.updatePolicy=x.ASYNC,this._uidToElement=new Map,this._renderedElements=new Map,this._lastDrapingExtent=null,this._update=P(async(e,t,r)=>{const n=await this._collectMediaElements(e,t,r);this._synchronizeRenderElements(n)},0)}initialize(){this._renderer=this.view.basemapTerrain.overlayManager.registerGeometryDrapeSource(this);const e=()=>this._updateWithLastDrapingExtent();this.addHandles([b(()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)),D(()=>this.layer.effectiveSource,"change",e),D(()=>this.layer.effectiveSource,"refresh",e)]),this._updatingHandles.add(()=>this.suspended,e)}setDrapingExtent(e,t){this._lastDrapingExtent={overlays:e,spatialReference:t},this._updateWithLastDrapingExtent()}getHit(e){const t=this._uidToElement.get(e);return t?{type:"media",element:t,layer:this.layer}:null}_updateWithLastDrapingExtent(){if(this._lastDrapingExtent==null||this.suspended)return void(this._renderer&&this._synchronizeRenderElements(new Set));const{overlays:e,spatialReference:t}=this._lastDrapingExtent;this._updatingHandles.addPromise(this._update(e,t).catch(()=>{}))}async _collectMediaElements(e,t,r){const n=this.layer.effectiveSource;return n==null?new Set:new Set((await Promise.all(e.map(a=>n.queryElements(G(a.extent,t),{signal:r})))).flat())}_synchronizeRenderElements(e){this._synchronizeRenderElementsRemove(e),this._synchronizeRenderElementsAdd(e)}_synchronizeRenderElementsRemove(e){const t=new Set,r=[];this._renderedElements.forEach((n,a)=>{e.has(a)||(t.add(a),n.renderData!=null&&r.push(n.renderData.renderGeometry),this._removeElement(a,n))}),this._renderer.removeGeometries(r,c.REMOVE)}_synchronizeRenderElementsAdd(e){for(const t of e)this._renderedElements.has(t)||this._createRenderElement(t)}_removeElement(e,{renderData:t,handle:r}){this._destroyRenderData(t),this._renderedElements.delete(e),this._uidToElement.delete(e.uid),r.remove()}async _createRenderElement(e){const t=new W({spatialReference:this.view.spatialReference,element:e}),r={renderData:null,handle:I([this._updatingHandles.add(()=>e.opacity,n=>{r.renderData!=null&&r.renderData.material.setParameters({opacity:n})}),this._updatingHandles.add(()=>t.coords,()=>{r.renderData!=null?this._updateGeometry(t,r,r.renderData):this._initializeRenderData(t,r)}),this._updatingHandles.add(()=>e.content,()=>this._initializeRenderData(t,r)),M(t)])};this._renderedElements.set(e,r),this._uidToElement.set(e.uid,e),this._updatingHandles.addPromise(e.load().catch(()=>{})),this._initializeRenderData(t,r)}_initializeRenderData(e,t){const{coords:r,element:n}=e,{contentWidth:a,contentHeight:l}=n;if(r==null||n.content==null)return void(t.renderData=this._destroyRenderData(t.renderData));if(t.renderData!=null)return;const i=this._createTexture(n.content),_=i.load(this.view._stage.renderView.renderingContext);this.view._stage.add(i),z(_)&&this._updatingHandles.addPromise(_);const y=new k({initTextureTransparent:!0,textureId:i.id,opacity:n.opacity,transparent:!0,perspectiveInterpolation:!0}),E=this._getPositionAttributeArray(r),w=[0,0,1,0,1,1,0,1],R=this._getPerspectiveDivideAttributeArray(E,a,l),u=[0,1,2,0,2,3],A=new S(y,[[s.POSITION,new m(E,u,3,!0)],[s.UV0,new m(w,u,2,!0)],[s.PERSPECTIVEDIVIDE,new m(R,u,1,!0)]]),g=new H(A,{layerUid:this.layer.uid,graphicUid:n.uid});this._renderer.addGeometries([g],c.ADD),t.renderData={renderGeometry:g,texture:i,material:y}}_updateGeometry(e,t,r){const{coords:n,element:a}=e;if(n==null||a.content==null)return void(t.renderData=this._destroyRenderData(t.renderData));const l=this._getPositionAttributeArray(n);r.renderGeometry.geometry.setAttributeData(s.POSITION,l);const i=this._getPerspectiveDivideAttributeArray(l,a.contentWidth,a.contentHeight);r.renderGeometry.geometry.setAttributeData(s.PERSPECTIVEDIVIDE,i),this._renderer.modifyGeometries([r.renderGeometry],$.GEOMETRY)}_getPositionAttributeArray(e){const[t,r,n,a]=e.rings[0];return[t[0],t[1],h,a[0],a[1],h,n[0],n[1],h,r[0],r[1],h]}_getPerspectiveDivideAttributeArray(e,t,r){N(d,[0,0,t,0,t,r,0,r],[e[0],e[1],e[3],e[4],e[6],e[7],e[9],e[10]]);const n=d[6]/d[8]*t,a=d[7]/d[8]*r;return[1,1+n,1+n+a,1+a]}_destroyRenderData(e){if(e==null)return null;const t=e.texture;return t.unload(),this.view._stage.remove(t),this._renderer.removeGeometries([e.renderGeometry],c.REMOVE),null}_createTexture(e){const t=e instanceof HTMLImageElement?e.naturalWidth:e.width,r=e instanceof HTMLImageElement?e.naturalHeight:e.height;if("getFrame"in e)throw new O("media-layer-view-3d","animation is not supported");return new V(e,{wrap:{s:f.CLAMP_TO_EDGE,t:f.CLAMP_TO_EDGE},preMultiplyAlpha:!0,width:t,height:r,mipmap:!0,updateCallback:()=>this.view.basemapTerrain.overlayManager.setDrawTexturesDirty()})}get test(){const e=this;return{get numberOfElements(){return e._renderedElements.size}}}};p([v({readOnly:!0})],o.prototype,"type",void 0),p([v()],o.prototype,"layer",void 0),o=p([C("esri.views.3d.layers.MediaLayerView3D")],o);const d=L(),Q=o;export{Q as default}; +import{aE as x,C as A,bs as P,a0 as b,fg as D,ex as I,fp as m,fq as M,fr as G,fs as S,bR as H,bi as s,bS as c,ba as z,ft as $,bj as h,r as O,fu as V,fv as f,e as p,y as v,c as C,fw as L}from"./index-pCX-0tJH.js";import{i as W,j as N}from"./MediaElementView-pYfW8oR4.js";import{n as U}from"./LayerView3D-57OghbRh.js";import{g as j}from"./ImageMaterial.glsl-PU0wbmEN.js";import{u as k}from"./LayerView-ixwLVnzr.js";import"./normalizeUtilsSync-GeARMwm8.js";let o=class extends U(k){constructor(){super(...arguments),this.type="media-3d",this.drapeSourceType=x.RasterImage,this.updatePolicy=A.ASYNC,this._uidToElement=new Map,this._renderedElements=new Map,this._lastDrapingExtent=null,this._update=P(async(e,t,r)=>{const n=await this._collectMediaElements(e,t,r);this._synchronizeRenderElements(n)},0)}initialize(){this._renderer=this.view.basemapTerrain.overlayManager.registerGeometryDrapeSource(this);const e=()=>this._updateWithLastDrapingExtent();this.addHandles([b(()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this)),D(()=>this.layer.effectiveSource,"change",e),D(()=>this.layer.effectiveSource,"refresh",e)]),this._updatingHandles.add(()=>this.suspended,e)}setDrapingExtent(e,t){this._lastDrapingExtent={overlays:e,spatialReference:t},this._updateWithLastDrapingExtent()}getHit(e){const t=this._uidToElement.get(e);return t?{type:"media",element:t,layer:this.layer}:null}_updateWithLastDrapingExtent(){if(this._lastDrapingExtent==null||this.suspended)return void(this._renderer&&this._synchronizeRenderElements(new Set));const{overlays:e,spatialReference:t}=this._lastDrapingExtent;this._updatingHandles.addPromise(this._update(e,t).catch(()=>{}))}async _collectMediaElements(e,t,r){const n=this.layer.effectiveSource;return n==null?new Set:new Set((await Promise.all(e.map(a=>n.queryElements(I(a.extent,t),{signal:r})))).flat())}_synchronizeRenderElements(e){this._synchronizeRenderElementsRemove(e),this._synchronizeRenderElementsAdd(e)}_synchronizeRenderElementsRemove(e){const t=new Set,r=[];this._renderedElements.forEach((n,a)=>{e.has(a)||(t.add(a),n.renderData!=null&&r.push(n.renderData.renderGeometry),this._removeElement(a,n))}),this._renderer.removeGeometries(r,m.REMOVE)}_synchronizeRenderElementsAdd(e){for(const t of e)this._renderedElements.has(t)||this._createRenderElement(t)}_removeElement(e,{renderData:t,handle:r}){this._destroyRenderData(t),this._renderedElements.delete(e),this._uidToElement.delete(e.uid),r.remove()}async _createRenderElement(e){const t=new W({spatialReference:this.view.spatialReference,element:e}),r={renderData:null,handle:M([this._updatingHandles.add(()=>e.opacity,n=>{r.renderData!=null&&r.renderData.material.setParameters({opacity:n})}),this._updatingHandles.add(()=>t.coords,()=>{r.renderData!=null?this._updateGeometry(t,r,r.renderData):this._initializeRenderData(t,r)}),this._updatingHandles.add(()=>e.content,()=>this._initializeRenderData(t,r)),G(t)])};this._renderedElements.set(e,r),this._uidToElement.set(e.uid,e),this._updatingHandles.addPromise(e.load().catch(()=>{})),this._initializeRenderData(t,r)}_initializeRenderData(e,t){const{coords:r,element:n}=e,{contentWidth:a,contentHeight:l}=n;if(r==null||n.content==null)return void(t.renderData=this._destroyRenderData(t.renderData));if(t.renderData!=null)return;const i=this._createTexture(n.content),_=i.load(this.view._stage.renderView.renderingContext);this.view._stage.add(i),S(_)&&this._updatingHandles.addPromise(_);const y=new j({initTextureTransparent:!0,textureId:i.id,opacity:n.opacity,transparent:!0,perspectiveInterpolation:!0}),E=this._getPositionAttributeArray(r),w=[0,0,1,0,1,1,0,1],R=this._getPerspectiveDivideAttributeArray(E,a,l),u=[0,1,2,0,2,3],T=new H(y,[[s.POSITION,new c(E,u,3,!0)],[s.UV0,new c(w,u,2,!0)],[s.PERSPECTIVEDIVIDE,new c(R,u,1,!0)]]),g=new z(T,{layerUid:this.layer.uid,graphicUid:n.uid});this._renderer.addGeometries([g],m.ADD),t.renderData={renderGeometry:g,texture:i,material:y}}_updateGeometry(e,t,r){const{coords:n,element:a}=e;if(n==null||a.content==null)return void(t.renderData=this._destroyRenderData(t.renderData));const l=this._getPositionAttributeArray(n);r.renderGeometry.geometry.setAttributeData(s.POSITION,l);const i=this._getPerspectiveDivideAttributeArray(l,a.contentWidth,a.contentHeight);r.renderGeometry.geometry.setAttributeData(s.PERSPECTIVEDIVIDE,i),this._renderer.modifyGeometries([r.renderGeometry],$.GEOMETRY)}_getPositionAttributeArray(e){const[t,r,n,a]=e.rings[0];return[t[0],t[1],h,a[0],a[1],h,n[0],n[1],h,r[0],r[1],h]}_getPerspectiveDivideAttributeArray(e,t,r){N(d,[0,0,t,0,t,r,0,r],[e[0],e[1],e[3],e[4],e[6],e[7],e[9],e[10]]);const n=d[6]/d[8]*t,a=d[7]/d[8]*r;return[1,1+n,1+n+a,1+a]}_destroyRenderData(e){if(e==null)return null;const t=e.texture;return t.unload(),this.view._stage.remove(t),this._renderer.removeGeometries([e.renderGeometry],m.REMOVE),null}_createTexture(e){const t=e instanceof HTMLImageElement?e.naturalWidth:e.width,r=e instanceof HTMLImageElement?e.naturalHeight:e.height;if("getFrame"in e)throw new O("media-layer-view-3d","animation is not supported");return new V(e,{wrap:{s:f.CLAMP_TO_EDGE,t:f.CLAMP_TO_EDGE},preMultiplyAlpha:!0,width:t,height:r,mipmap:!0,updateCallback:()=>this.view.basemapTerrain.overlayManager.setDrawTexturesDirty()})}get test(){const e=this;return{get numberOfElements(){return e._renderedElements.size}}}};p([v({readOnly:!0})],o.prototype,"type",void 0),p([v()],o.prototype,"layer",void 0),o=p([C("esri.views.3d.layers.MediaLayerView3D")],o);const d=L(),Q=o;export{Q as default}; diff --git a/dist/assets/MemorySourceWorker-K3WXTL5J.js b/dist/assets/MemorySourceWorker-6wu4D2bo.js similarity index 81% rename from dist/assets/MemorySourceWorker-K3WXTL5J.js rename to dist/assets/MemorySourceWorker-6wu4D2bo.js index 7bd169d..2650916 100644 --- a/dist/assets/MemorySourceWorker-K3WXTL5J.js +++ b/dist/assets/MemorySourceWorker-6wu4D2bo.js @@ -1 +1 @@ -import{eQ as w,E as I,eP as M,ff as Z,ga as A,eR as P,gb as b,gc as O,gd as k,ge as C,eV as S,eH as v}from"./index-J0iiHjMT.js";import{t as $,n as G}from"./objectIdUtils-GktMsX8e.js";import{m as L}from"./FeatureStore-X-AIJLo2.js";import{W,x as E,j as _}from"./QueryEngine-8tLWlkSE.js";import{i as z,o as H,a as N}from"./clientSideDefaults-F-CNnR0g.js";import{I as B,f as g,p as T,d as j,w as D}from"./sourceUtils-zbywPEXK.js";import"./BoundsStore-wmwfHjhp.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./date-be_IQzZd.js";const U=S,V={xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:S},J={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!1,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};function K(h){return v(h)?h.z!=null:!!h.hasZ}function X(h){return v(h)?h.m!=null:!!h.hasM}class he{constructor(){this._queryEngine=null,this._nextObjectId=null}destroy(){var e;(e=this._queryEngine)==null||e.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e){const i=[],{features:a}=e,n=this._inferLayerProperties(a,e.fields),o=e.fields||[],u=e.hasM!=null?e.hasM:!!n.hasM,y=e.hasZ!=null?e.hasZ:!!n.hasZ,p=!e.spatialReference&&!n.spatialReference,d=p?U:e.spatialReference||n.spatialReference,m=p?V:null,c=e.geometryType||n.geometryType,l=!c;let t=e.objectIdField||n.objectIdField,r=e.timeInfo;const f=new w(o);if(!l&&(p&&i.push({name:"feature-layer:spatial-reference-not-found",message:"Spatial reference not provided or found in features. Defaults to WGS84"}),!c))throw new I("feature-layer:missing-property","geometryType not set and couldn't be inferred from the provided features");if(!t)throw new I("feature-layer:missing-property","objectIdField not set and couldn't be found in the provided fields");if(n.objectIdField&&t!==n.objectIdField&&(i.push({name:"feature-layer:duplicated-oid-field",message:`Provided objectIdField "${t}" doesn't match the field name "${n.objectIdField}", found in the provided fields`}),t=n.objectIdField),t&&!n.objectIdField){const s=f.get(t);s?(t=s.name,s.type="esriFieldTypeOID",s.editable=!1,s.nullable=!1):o.unshift({alias:t,name:t,type:"esriFieldTypeOID",editable:!1,nullable:!1})}for(const s of o){if(s.name==null&&(s.name=s.alias),s.alias==null&&(s.alias=s.name),!s.name)throw new I("feature-layer:invalid-field-name","field name is missing",{field:s});if(s.name===t&&(s.type="esriFieldTypeOID"),!M.jsonValues.includes(s.type))throw new I("feature-layer:invalid-field-type",`invalid type for field "${s.name}"`,{field:s});s.length==null&&(s.length=Z(s))}const F={};for(const s of o)if(s.type!=="esriFieldTypeOID"&&s.type!=="esriFieldTypeGlobalID"){const q=A(s);q!==void 0&&(F[s.name]=q)}if(r){if(r.startTimeField){const s=f.get(r.startTimeField);s?(r.startTimeField=s.name,s.type="esriFieldTypeDate"):r.startTimeField=null}if(r.endTimeField){const s=f.get(r.endTimeField);s?(r.endTimeField=s.name,s.type="esriFieldTypeDate"):r.endTimeField=null}if(r.trackIdField){const s=f.get(r.trackIdField);s?r.trackIdField=s.name:(r.trackIdField=null,i.push({name:"feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:r}}))}r.startTimeField||r.endTimeField||(i.push({name:"feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing or invalid",details:{timeInfo:r}}),r=null)}const x=f.dateFields.length?{timeZoneIANA:e.dateFieldsTimeZone??P}:null;this._createDefaultAttributes=z(F,t);const R={warnings:i,featureErrors:[],layerDefinition:{...J,drawingInfo:H(c),templates:N(F),extent:m,geometryType:c,objectIdField:t,fields:o,hasZ:y,hasM:u,timeInfo:r,dateFieldsTimeReference:x},assignedObjectIds:{}};if(this._queryEngine=new W({fieldsIndex:w.fromLayerJSON({fields:o,timeInfo:r,dateFieldsTimeReference:x}),geometryType:c,hasM:u,hasZ:y,objectIdField:t,spatialReference:d,featureStore:new L({geometryType:c,hasM:u,hasZ:y}),timeInfo:r,cacheSpatialQueries:!0}),!(a!=null&&a.length))return this._nextObjectId=$,R;const Q=G(t,a);return this._nextObjectId=Q+1,await E(a,d),this._loadInitialFeatures(R,a)}async applyEdits(e){const{spatialReference:i,geometryType:a}=this._queryEngine;return await Promise.all([B(i,a),E(e.adds,i),E(e.updates,i)]),this._applyEdits(e)}queryFeatures(e,i={}){return this._queryEngine.executeQuery(e,i.signal)}queryFeatureCount(e,i={}){return this._queryEngine.executeQueryForCount(e,i.signal)}queryObjectIds(e,i={}){return this._queryEngine.executeQueryForIds(e,i.signal)}queryExtent(e,i={}){return this._queryEngine.executeQueryForExtent(e,i.signal)}querySnapping(e,i={}){return this._queryEngine.executeQueryForSnapping(e,i.signal)}_inferLayerProperties(e,i){let a,n,o=null,u=null,y=null;for(const p of e){const d=p.geometry;if(d!=null&&(o||(o=b(d)),u||(u=d.spatialReference),a==null&&(a=K(d)),n==null&&(n=X(d)),o&&u&&a!=null&&n!=null))break}if(i&&i.length){let p=null;i.some(d=>{const m=d.type==="esriFieldTypeOID",c=!d.type&&d.name&&d.name.toLowerCase()==="objectid";return p=d,m||c})&&(y=p.name)}return{geometryType:o,spatialReference:u,objectIdField:y,hasM:n,hasZ:a}}async _loadInitialFeatures(e,i){const{geometryType:a,hasM:n,hasZ:o,objectIdField:u,spatialReference:y,featureStore:p,fieldsIndex:d}=this._queryEngine,m=[];for(const t of i){if(t.uid!=null&&(e.assignedObjectIds[t.uid]=-1),t.geometry&&a!==b(t.geometry)){e.featureErrors.push(g("Incorrect geometry type."));continue}const r=this._createDefaultAttributes(),f=T(d,r,t.attributes,!0);f?e.featureErrors.push(f):(this._assignObjectId(r,t.attributes,!0),t.attributes=r,t.uid!=null&&(e.assignedObjectIds[t.uid]=t.attributes[u]),t.geometry!=null&&(t.geometry=_(t.geometry,t.geometry.spatialReference,y)),m.push(t))}p.addMany(O([],m,a,o,n,u));const{fullExtent:c,timeExtent:l}=await this._queryEngine.fetchRecomputedExtents();if(e.layerDefinition.extent=c,l){const{start:t,end:r}=l;e.layerDefinition.timeInfo.timeExtent=[t,r]}return e}async _applyEdits(e){const{adds:i,updates:a,deletes:n}=e,o={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(i!=null&&i.length&&this._applyAddEdits(o,i),a!=null&&a.length&&this._applyUpdateEdits(o,a),n==null?void 0:n.length){for(const p of n)o.deleteResults.push(j(p));this._queryEngine.featureStore.removeManyById(n)}const{fullExtent:u,timeExtent:y}=await this._queryEngine.fetchRecomputedExtents();return{extent:u,timeExtent:y,featureEditResults:o}}_applyAddEdits(e,i){const{addResults:a}=e,{geometryType:n,hasM:o,hasZ:u,objectIdField:y,spatialReference:p,featureStore:d,fieldsIndex:m}=this._queryEngine,c=[];for(const l of i){if(l.geometry&&n!==b(l.geometry)){a.push(g("Incorrect geometry type."));continue}const t=this._createDefaultAttributes(),r=T(m,t,l.attributes);if(r)a.push(r);else{if(this._assignObjectId(t,l.attributes),l.attributes=t,l.uid!=null){const f=l.attributes[y];e.uidToObjectId[l.uid]=f}if(l.geometry!=null){const f=l.geometry.spatialReference??p;l.geometry=_(D(l.geometry,f),f,p)}c.push(l),a.push(j(l.attributes[y]))}}d.addMany(O([],c,n,u,o,y))}_applyUpdateEdits({updateResults:e},i){const{geometryType:a,hasM:n,hasZ:o,objectIdField:u,spatialReference:y,featureStore:p,fieldsIndex:d}=this._queryEngine;for(const m of i){const{attributes:c,geometry:l}=m,t=c==null?void 0:c[u];if(t==null){e.push(g(`Identifier field ${u} missing`));continue}if(!p.has(t)){e.push(g(`Feature with object id ${t} missing`));continue}const r=k(p.getFeature(t),a,o,n);if(l!=null){if(a!==b(l)){e.push(g("Incorrect geometry type."));continue}const f=l.spatialReference??y;r.geometry=_(D(l,f),f,y)}if(c){const f=T(d,r.attributes,c);if(f){e.push(f);continue}}p.add(C(r,a,o,n,u)),e.push(j(t))}}_assignObjectId(e,i,a=!1){const n=this._queryEngine.objectIdField;a&&i&&isFinite(i[n])?e[n]=i[n]:e[n]=this._nextObjectId++}}export{he as default}; +import{eL as w,r as I,eK as Q,fa as Z,g7 as A,eM as k,g8 as b,g9 as O,ga as C,gb as P,eQ as S,eB as v}from"./index-pCX-0tJH.js";import{t as $,n as G}from"./objectIdUtils-GktMsX8e.js";import{m as L}from"./FeatureStore-PXMUgn0j.js";import{W,x as E,j as _}from"./QueryEngine-uvDs-vBe.js";import{i as z,o as B,a as N}from"./clientSideDefaults-63pOkJ4Y.js";import{I as H,f as g,p as T,d as j,w as D}from"./sourceUtils-nEhsDpwC.js";import"./BoundsStore-_-dPK5c-.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./date-be_IQzZd.js";const K=S,U={xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:S},J={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!1,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};function V(h){return v(h)?h.z!=null:!!h.hasZ}function X(h){return v(h)?h.m!=null:!!h.hasM}class he{constructor(){this._queryEngine=null,this._nextObjectId=null}destroy(){var e;(e=this._queryEngine)==null||e.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e){const i=[],{features:a}=e,n=this._inferLayerProperties(a,e.fields),o=e.fields||[],u=e.hasM!=null?e.hasM:!!n.hasM,y=e.hasZ!=null?e.hasZ:!!n.hasZ,p=!e.spatialReference&&!n.spatialReference,d=p?K:e.spatialReference||n.spatialReference,m=p?U:null,c=e.geometryType||n.geometryType,l=!c;let t=e.objectIdField||n.objectIdField,r=e.timeInfo;const f=new w(o);if(!l&&(p&&i.push({name:"feature-layer:spatial-reference-not-found",message:"Spatial reference not provided or found in features. Defaults to WGS84"}),!c))throw new I("feature-layer:missing-property","geometryType not set and couldn't be inferred from the provided features");if(!t)throw new I("feature-layer:missing-property","objectIdField not set and couldn't be found in the provided fields");if(n.objectIdField&&t!==n.objectIdField&&(i.push({name:"feature-layer:duplicated-oid-field",message:`Provided objectIdField "${t}" doesn't match the field name "${n.objectIdField}", found in the provided fields`}),t=n.objectIdField),t&&!n.objectIdField){const s=f.get(t);s?(t=s.name,s.type="esriFieldTypeOID",s.editable=!1,s.nullable=!1):o.unshift({alias:t,name:t,type:"esriFieldTypeOID",editable:!1,nullable:!1})}for(const s of o){if(s.name==null&&(s.name=s.alias),s.alias==null&&(s.alias=s.name),!s.name)throw new I("feature-layer:invalid-field-name","field name is missing",{field:s});if(s.name===t&&(s.type="esriFieldTypeOID"),!Q.jsonValues.includes(s.type))throw new I("feature-layer:invalid-field-type",`invalid type for field "${s.name}"`,{field:s});s.length==null&&(s.length=Z(s))}const F={};for(const s of o)if(s.type!=="esriFieldTypeOID"&&s.type!=="esriFieldTypeGlobalID"){const q=A(s);q!==void 0&&(F[s.name]=q)}if(r){if(r.startTimeField){const s=f.get(r.startTimeField);s?(r.startTimeField=s.name,s.type="esriFieldTypeDate"):r.startTimeField=null}if(r.endTimeField){const s=f.get(r.endTimeField);s?(r.endTimeField=s.name,s.type="esriFieldTypeDate"):r.endTimeField=null}if(r.trackIdField){const s=f.get(r.trackIdField);s?r.trackIdField=s.name:(r.trackIdField=null,i.push({name:"feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:r}}))}r.startTimeField||r.endTimeField||(i.push({name:"feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing or invalid",details:{timeInfo:r}}),r=null)}const x=f.dateFields.length?{timeZoneIANA:e.dateFieldsTimeZone??k}:null;this._createDefaultAttributes=z(F,t);const R={warnings:i,featureErrors:[],layerDefinition:{...J,drawingInfo:B(c),templates:N(F),extent:m,geometryType:c,objectIdField:t,fields:o,hasZ:y,hasM:u,timeInfo:r,dateFieldsTimeReference:x},assignedObjectIds:{}};if(this._queryEngine=new W({fieldsIndex:w.fromLayerJSON({fields:o,timeInfo:r,dateFieldsTimeReference:x}),geometryType:c,hasM:u,hasZ:y,objectIdField:t,spatialReference:d,featureStore:new L({geometryType:c,hasM:u,hasZ:y}),timeInfo:r,cacheSpatialQueries:!0}),!(a!=null&&a.length))return this._nextObjectId=$,R;const M=G(t,a);return this._nextObjectId=M+1,await E(a,d),this._loadInitialFeatures(R,a)}async applyEdits(e){const{spatialReference:i,geometryType:a}=this._queryEngine;return await Promise.all([H(i,a),E(e.adds,i),E(e.updates,i)]),this._applyEdits(e)}queryFeatures(e,i={}){return this._queryEngine.executeQuery(e,i.signal)}queryFeatureCount(e,i={}){return this._queryEngine.executeQueryForCount(e,i.signal)}queryObjectIds(e,i={}){return this._queryEngine.executeQueryForIds(e,i.signal)}queryExtent(e,i={}){return this._queryEngine.executeQueryForExtent(e,i.signal)}querySnapping(e,i={}){return this._queryEngine.executeQueryForSnapping(e,i.signal)}_inferLayerProperties(e,i){let a,n,o=null,u=null,y=null;for(const p of e){const d=p.geometry;if(d!=null&&(o||(o=b(d)),u||(u=d.spatialReference),a==null&&(a=V(d)),n==null&&(n=X(d)),o&&u&&a!=null&&n!=null))break}if(i&&i.length){let p=null;i.some(d=>{const m=d.type==="esriFieldTypeOID",c=!d.type&&d.name&&d.name.toLowerCase()==="objectid";return p=d,m||c})&&(y=p.name)}return{geometryType:o,spatialReference:u,objectIdField:y,hasM:n,hasZ:a}}async _loadInitialFeatures(e,i){const{geometryType:a,hasM:n,hasZ:o,objectIdField:u,spatialReference:y,featureStore:p,fieldsIndex:d}=this._queryEngine,m=[];for(const t of i){if(t.uid!=null&&(e.assignedObjectIds[t.uid]=-1),t.geometry&&a!==b(t.geometry)){e.featureErrors.push(g("Incorrect geometry type."));continue}const r=this._createDefaultAttributes(),f=T(d,r,t.attributes,!0);f?e.featureErrors.push(f):(this._assignObjectId(r,t.attributes,!0),t.attributes=r,t.uid!=null&&(e.assignedObjectIds[t.uid]=t.attributes[u]),t.geometry!=null&&(t.geometry=_(t.geometry,t.geometry.spatialReference,y)),m.push(t))}p.addMany(O([],m,a,o,n,u));const{fullExtent:c,timeExtent:l}=await this._queryEngine.fetchRecomputedExtents();if(e.layerDefinition.extent=c,l){const{start:t,end:r}=l;e.layerDefinition.timeInfo.timeExtent=[t,r]}return e}async _applyEdits(e){const{adds:i,updates:a,deletes:n}=e,o={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(i!=null&&i.length&&this._applyAddEdits(o,i),a!=null&&a.length&&this._applyUpdateEdits(o,a),n==null?void 0:n.length){for(const p of n)o.deleteResults.push(j(p));this._queryEngine.featureStore.removeManyById(n)}const{fullExtent:u,timeExtent:y}=await this._queryEngine.fetchRecomputedExtents();return{extent:u,timeExtent:y,featureEditResults:o}}_applyAddEdits(e,i){const{addResults:a}=e,{geometryType:n,hasM:o,hasZ:u,objectIdField:y,spatialReference:p,featureStore:d,fieldsIndex:m}=this._queryEngine,c=[];for(const l of i){if(l.geometry&&n!==b(l.geometry)){a.push(g("Incorrect geometry type."));continue}const t=this._createDefaultAttributes(),r=T(m,t,l.attributes);if(r)a.push(r);else{if(this._assignObjectId(t,l.attributes),l.attributes=t,l.uid!=null){const f=l.attributes[y];e.uidToObjectId[l.uid]=f}if(l.geometry!=null){const f=l.geometry.spatialReference??p;l.geometry=_(D(l.geometry,f),f,p)}c.push(l),a.push(j(l.attributes[y]))}}d.addMany(O([],c,n,u,o,y))}_applyUpdateEdits({updateResults:e},i){const{geometryType:a,hasM:n,hasZ:o,objectIdField:u,spatialReference:y,featureStore:p,fieldsIndex:d}=this._queryEngine;for(const m of i){const{attributes:c,geometry:l}=m,t=c==null?void 0:c[u];if(t==null){e.push(g(`Identifier field ${u} missing`));continue}if(!p.has(t)){e.push(g(`Feature with object id ${t} missing`));continue}const r=C(p.getFeature(t),a,o,n);if(l!=null){if(a!==b(l)){e.push(g("Incorrect geometry type."));continue}const f=l.spatialReference??y;r.geometry=_(D(l,f),f,y)}if(c){const f=T(d,r.attributes,c);if(f){e.push(f);continue}}p.add(P(r,a,o,n,u)),e.push(j(t))}}_assignObjectId(e,i,a=!1){const n=this._queryEngine.objectIdField;a&&i&&isFinite(i[n])?e[n]=i[n]:e[n]=this._nextObjectId++}}export{he as default}; diff --git a/dist/assets/OGCFeatureLayer--w0HTnNu.js b/dist/assets/OGCFeatureLayer--w0HTnNu.js deleted file mode 100644 index 6d5c99b..0000000 --- a/dist/assets/OGCFeatureLayer--w0HTnNu.js +++ /dev/null @@ -1 +0,0 @@ -import{e as r,y as s,c as D,ij as B,ar as x,j5 as L,E as b,en as N,dK as H,el as J,dO as z,dM as V,dN as Z,dL as k,dP as K,iF as F,il as U,ca as I,iG as W,iH as X,dw as Y,dT as ee,fe as $,iJ as te,iK as re,iI as oe,dV as se,iu as ie,iv as ne,iM as pe,it as ae,iN as le,dW as ue,ix as de,c7 as ce}from"./index-J0iiHjMT.js";import{S as ye,h as O,x as T,T as he,I as fe,F as me,k as ge,j as ve,b as Se}from"./ogcFeatureUtils-dtzP0u64.js";import{d as xe}from"./FeatureSet-d4S1oKME.js";import{o as we}from"./CustomParametersMixin-Y1bOcayO.js";import{p as Ce}from"./FeatureEffectLayer-oBa8pIG5.js";import{c as Re}from"./FeatureReductionLayer-RlitE1N6.js";import{c as be}from"./OrderedLayer-M7k5gLgx.js";import{n as Fe}from"./FeatureType-MpRe7WJj.js";import"./geojson-fSjaGZrp.js";import"./date-be_IQzZd.js";import"./clientSideDefaults-F-CNnR0g.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./FeatureEffect-5bEV-xG1.js";import"./FeatureTemplate-kUgbbA00.js";let d=class extends B{constructor(){super(...arguments),this.featureDefinition=null,this.type="ogc-feature"}load(e){return this.addResolvingPromise(this._loadOGCServices(this.layer,e)),this.when()}getSource(){const{featureDefinition:{collection:e,layerDefinition:t,spatialReference:i,supportedCrs:n},layer:{apiKey:p,customParameters:l,effectiveMaxRecordCount:a}}=this;return{type:"ogc-source",collection:e,layerDefinition:t,maxRecordCount:a,queryParameters:{apiKey:p,customParameters:l},spatialReference:i,supportedCrs:n}}queryExtent(e,t={}){return null}queryFeatureCount(e,t={}){return null}queryFeatures(e,t={}){return this.queryFeaturesJSON(e,t).then(i=>xe.fromJSON(i))}queryFeaturesJSON(e,t={}){const i=this.getSource();return this.load(t).then(()=>ye(i,e,t))}queryObjectIds(e,t={}){return null}serviceSupportsSpatialReference(e){return!(!e.isWGS84&&!e.isWebMercator)||!!this.featureDefinition.supportedCrs[e.wkid]}_conformsToType(e,t){const i=new RegExp(`^${t}$`,"i");return e.conformsTo.some(n=>i.test(n))??!1}_getCapabilities(e,t){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:t,maxRecordCountFactor:void 0,standardMaxRecordCount:void 0,supportsCacheHint:!1,supportsCentroid:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsStatistics:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,supportsSqlExpression:!1,tileMaxRecordCount:void 0},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}_getMaxRecordCount(e){var i,n,p,l,a;const t=(i=e==null?void 0:e.components)==null?void 0:i.parameters;return((p=(n=t==null?void 0:t.limit)==null?void 0:n.schema)==null?void 0:p.maximum)??((a=(l=t==null?void 0:t.limitFeatures)==null?void 0:l.schema)==null?void 0:a.maximum)}_getStorageSpatialReference(e){const t=e.storageCrs??O,i=T(t);return i==null?x.WGS84:new x({wkid:i})}_getSupportedSpatialReferences(e,t){const i="#/crs",n=e.crs??[O],p=n.includes(i)?n.filter(a=>a!==i).concat(t.crs??[]):n,l=/^http:\/\/www\.opengis.net\/def\/crs\/epsg\/.*\/3785$/i;return p.filter(a=>!l.test(a))}async _loadOGCServices(e,t){const i=t!=null?t.signal:null,{apiKey:n,collectionId:p,customParameters:l,fields:a,geometryType:h,hasZ:f,objectIdField:j,timeInfo:m,url:E}=e,P={fields:a==null?void 0:a.map(u=>u.toJSON()),geometryType:L.toJSON(h),hasZ:f??!1,objectIdField:j,timeInfo:m==null?void 0:m.toJSON()},c={apiKey:n,customParameters:l,signal:i},g=await he(E,c),[w,C]=await Promise.all([fe(g,c),me(g,c)]);if(!this._conformsToType(w,"http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson"))throw new b("ogc-feature-layer:no-geojson-support","Server does not support geojson");const y=C.collections.find(u=>u.id===p);if(!y)throw new b("ogc-feature-layer:collection-not-found","Server does not contain the named collection");const _=this._conformsToType(w,"http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/oas30")?await ge(g,c):null,R=await ve(y,P,c),q=this._getMaxRecordCount(_),M=this._getCapabilities(R.hasZ,q),A=this._getStorageSpatialReference(y).toJSON(),G=this._getSupportedSpatialReferences(y,C),Q=new RegExp(`^${Se}`,"i"),v={};for(const u of G){const S=T(u);S!=null&&(v[S]||(v[S]=u.replace(Q,"")))}this.featureDefinition={capabilities:M,collection:y,layerDefinition:R,spatialReference:A,supportedCrs:v}}};r([s()],d.prototype,"featureDefinition",void 0),r([s({constructOnly:!0})],d.prototype,"layer",void 0),r([s()],d.prototype,"type",void 0),d=r([D("esri.layers.graphics.sources.OGCFeatureSource")],d);const Ie=de();let o=class extends N(we(Re(Ce(H(be(J(z(V(Z(k(K(ce)))))))))))){constructor(e){super(e),this.capabilities=null,this.collectionId=null,this.copyright=null,this.definitionExpression=null,this.description=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelingInfo=null,this.labelsVisible=!0,this.legendEnabled=!0,this.maxRecordCount=null,this.objectIdField=null,this.operationalLayerType="OGCFeatureLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new d({layer:this}),this.spatialReference=null,this.title=null,this.type="ogc-feature",this.typeIdField=null,this.types=null,this.url=null}destroy(){var e;(e=this.source)==null||e.destroy()}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["OGCFeatureServer"]},e).then(()=>this._fetchService(e))),this.when()}get defaultPopupTemplate(){return this.createPopupTemplate()}get effectiveMaxRecordCount(){var e;return this.maxRecordCount??((e=this.capabilities)==null?void 0:e.query.maxRecordCount)??5e3}get isTable(){return this.loaded&&this.geometryType==null}set renderer(e){F(e,this.fieldsIndex),this._set("renderer",e)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return U(this,e)}createQuery(){return new I}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){var a;let i,n=!1;const p=(a=t==null?void 0:t.feature)==null?void 0:a.attributes,l=this.typeIdField&&(p==null?void 0:p[this.typeIdField]);return l!=null&&this.types&&(n=this.types.some(h=>{var f;return h.id==l&&(i=(f=h.domains)==null?void 0:f[e],(i==null?void 0:i.type)==="inherited"&&(i=this._getLayerDomain(e)),!0)})),n||i||(i=this._getLayerDomain(e)),i}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(I.from(e)||this.createQuery(),t)).then(i=>{var n;return(n=i==null?void 0:i.features)==null||n.forEach(p=>{p.layer=p.sourceLayer=this}),i})}serviceSupportsSpatialReference(e){var t;return((t=this.source)==null?void 0:t.serviceSupportsSpatialReference(e))??!1}async _fetchService(e){await this.source.load(e),this.read(this.source.featureDefinition,{origin:"service"}),F(this.renderer,this.fieldsIndex),W(this.timeInfo,this.fieldsIndex)}_getLayerDomain(e){if(!this.fields)return null;for(const t of this.fields)if(t.name===e&&t.domain)return t.domain;return null}};r([s({readOnly:!0,json:{origins:{service:{read:!0}}}})],o.prototype,"capabilities",void 0),r([s({type:String,json:{write:!0}})],o.prototype,"collectionId",void 0),r([s({type:String})],o.prototype,"copyright",void 0),r([s({readOnly:!0})],o.prototype,"defaultPopupTemplate",null),r([s({type:String})],o.prototype,"definitionExpression",void 0),r([s({readOnly:!0,type:String,json:{origins:{service:{name:"collection.description"}}}})],o.prototype,"description",void 0),r([s({type:String})],o.prototype,"displayField",void 0),r([s({type:Number})],o.prototype,"effectiveMaxRecordCount",null),r([s(X)],o.prototype,"elevationInfo",void 0),r([s({type:[Y],json:{origins:{service:{name:"layerDefinition.fields"}}}})],o.prototype,"fields",void 0),r([s(Ie.fieldsIndex)],o.prototype,"fieldsIndex",void 0),r([s({readOnly:!0,type:ee,json:{origins:{service:{name:"layerDefinition.extent"}}}})],o.prototype,"fullExtent",void 0),r([s({type:$.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:$.read}}}}})],o.prototype,"geometryType",void 0),r([s({type:Boolean,json:{origins:{service:{name:"layerDefinition.hasZ"}}}})],o.prototype,"hasZ",void 0),r([s({type:Boolean,readOnly:!0})],o.prototype,"isTable",null),r([s({type:[te],json:{origins:{"web-document":{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:re},write:!0}}}})],o.prototype,"labelingInfo",void 0),r([s(oe)],o.prototype,"labelsVisible",void 0),r([s(se)],o.prototype,"legendEnabled",void 0),r([s({type:Number})],o.prototype,"maxRecordCount",void 0),r([s({type:String,json:{origins:{service:{name:"layerDefinition.objectIdField"}}}})],o.prototype,"objectIdField",void 0),r([s({type:["OGCFeatureLayer"]})],o.prototype,"operationalLayerType",void 0),r([s(ie)],o.prototype,"popupEnabled",void 0),r([s({type:ne,json:{name:"popupInfo",write:!0}})],o.prototype,"popupTemplate",void 0),r([s({types:pe,json:{origins:{service:{name:"layerDefinition.drawingInfo.renderer",write:!1},"web-scene":{types:ae,name:"layerDefinition.drawingInfo.renderer",write:!0}},name:"layerDefinition.drawingInfo.renderer",write:!0}})],o.prototype,"renderer",null),r([s(le)],o.prototype,"screenSizePerspectiveEnabled",void 0),r([s({readOnly:!0})],o.prototype,"source",void 0),r([s({readOnly:!0,type:x,json:{origins:{service:{read:!0}}}})],o.prototype,"spatialReference",void 0),r([s({type:String,json:{write:{enabled:!0,ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"collection.title"}}}})],o.prototype,"title",void 0),r([s({readOnly:!0,json:{read:!1}})],o.prototype,"type",void 0),r([s({type:String,readOnly:!0})],o.prototype,"typeIdField",void 0),r([s({type:[Fe]})],o.prototype,"types",void 0),r([s(ue)],o.prototype,"url",void 0),o=r([D("esri.layers.OGCFeatureLayer")],o);const Le=o;export{Le as default}; diff --git a/dist/assets/OGCFeatureLayer-hko6jm86.js b/dist/assets/OGCFeatureLayer-hko6jm86.js new file mode 100644 index 0000000..a45afa2 --- /dev/null +++ b/dist/assets/OGCFeatureLayer-hko6jm86.js @@ -0,0 +1 @@ +import{e as r,y as s,c as D,il as B,h6 as L,d2 as x,jc as N,r as I,eg as H,dF as J,ee as z,dJ as Z,dH as k,dI as K,dG as U,dK as V,iG as b,io as W,aL as F,iH as X,iI as Y,es as ee,dO as te,f9 as O,iK as re,iL as oe,iJ as se,dQ as ie,iw as ne,ix as pe,iN as ae,iv as le,iO as ue,dR as de,iz as ce,aI as ye}from"./index-pCX-0tJH.js";import{S as he,h as $,x as T,T as fe,I as me,F as ge,k as ve,j as Se,b as xe}from"./ogcFeatureUtils-8dWL_GtH.js";import{o as we}from"./CustomParametersMixin-7nmugR3Y.js";import{p as Re}from"./FeatureEffectLayer-OK0TB5f6.js";import{c as Ce}from"./FeatureReductionLayer-2X2_PJv9.js";import{c as Ie}from"./OrderedLayer-XNaJwl_G.js";import{n as be}from"./FeatureType-0WPvBvpQ.js";import"./geojson-162a_hNo.js";import"./date-be_IQzZd.js";import"./clientSideDefaults-63pOkJ4Y.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./FeatureTemplate-vSzbyslg.js";let d=class extends B{constructor(){super(...arguments),this.featureDefinition=null,this.type="ogc-feature"}load(e){return this.addResolvingPromise(this._loadOGCServices(this.layer,e)),this.when()}getSource(){const{featureDefinition:{collection:e,layerDefinition:t,spatialReference:i,supportedCrs:n},layer:{apiKey:p,customParameters:l,effectiveMaxRecordCount:a}}=this;return{type:"ogc-source",collection:e,layerDefinition:t,maxRecordCount:a,queryParameters:{apiKey:p,customParameters:l},spatialReference:i,supportedCrs:n}}queryExtent(e,t={}){return null}queryFeatureCount(e,t={}){return null}queryFeatures(e,t={}){return this.queryFeaturesJSON(e,t).then(i=>L.fromJSON(i))}queryFeaturesJSON(e,t={}){const i=this.getSource();return this.load(t).then(()=>he(i,e,t))}queryObjectIds(e,t={}){return null}serviceSupportsSpatialReference(e){return!(!e.isWGS84&&!e.isWebMercator)||!!this.featureDefinition.supportedCrs[e.wkid]}_conformsToType(e,t){const i=new RegExp(`^${t}$`,"i");return e.conformsTo.some(n=>i.test(n))??!1}_getCapabilities(e,t){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:t,maxRecordCountFactor:void 0,standardMaxRecordCount:void 0,supportsCacheHint:!1,supportsCentroid:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsStatistics:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,supportsSqlExpression:!1,tileMaxRecordCount:void 0},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}_getMaxRecordCount(e){var i,n,p,l,a;const t=(i=e==null?void 0:e.components)==null?void 0:i.parameters;return((p=(n=t==null?void 0:t.limit)==null?void 0:n.schema)==null?void 0:p.maximum)??((a=(l=t==null?void 0:t.limitFeatures)==null?void 0:l.schema)==null?void 0:a.maximum)}_getStorageSpatialReference(e){const t=e.storageCrs??$,i=T(t);return i==null?x.WGS84:new x({wkid:i})}_getSupportedSpatialReferences(e,t){const i="#/crs",n=e.crs??[$],p=n.includes(i)?n.filter(a=>a!==i).concat(t.crs??[]):n,l=/^http:\/\/www\.opengis.net\/def\/crs\/epsg\/.*\/3785$/i;return p.filter(a=>!l.test(a))}async _loadOGCServices(e,t){const i=t!=null?t.signal:null,{apiKey:n,collectionId:p,customParameters:l,fields:a,geometryType:h,hasZ:f,objectIdField:j,timeInfo:m,url:E}=e,P={fields:a==null?void 0:a.map(u=>u.toJSON()),geometryType:N.toJSON(h),hasZ:f??!1,objectIdField:j,timeInfo:m==null?void 0:m.toJSON()},c={apiKey:n,customParameters:l,signal:i},g=await fe(E,c),[w,R]=await Promise.all([me(g,c),ge(g,c)]);if(!this._conformsToType(w,"http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson"))throw new I("ogc-feature-layer:no-geojson-support","Server does not support geojson");const y=R.collections.find(u=>u.id===p);if(!y)throw new I("ogc-feature-layer:collection-not-found","Server does not contain the named collection");const _=this._conformsToType(w,"http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/oas30")?await ve(g,c):null,C=await Se(y,P,c),q=this._getMaxRecordCount(_),G=this._getCapabilities(C.hasZ,q),A=this._getStorageSpatialReference(y).toJSON(),M=this._getSupportedSpatialReferences(y,R),Q=new RegExp(`^${xe}`,"i"),v={};for(const u of M){const S=T(u);S!=null&&(v[S]||(v[S]=u.replace(Q,"")))}this.featureDefinition={capabilities:G,collection:y,layerDefinition:C,spatialReference:A,supportedCrs:v}}};r([s()],d.prototype,"featureDefinition",void 0),r([s({constructOnly:!0})],d.prototype,"layer",void 0),r([s()],d.prototype,"type",void 0),d=r([D("esri.layers.graphics.sources.OGCFeatureSource")],d);const Fe=ce();let o=class extends H(we(Ce(Re(J(Ie(z(Z(k(K(U(V(ye)))))))))))){constructor(e){super(e),this.capabilities=null,this.collectionId=null,this.copyright=null,this.definitionExpression=null,this.description=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.hasZ=void 0,this.labelingInfo=null,this.labelsVisible=!0,this.legendEnabled=!0,this.maxRecordCount=null,this.objectIdField=null,this.operationalLayerType="OGCFeatureLayer",this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new d({layer:this}),this.spatialReference=null,this.title=null,this.type="ogc-feature",this.typeIdField=null,this.types=null,this.url=null}destroy(){var e;(e=this.source)==null||e.destroy()}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["OGCFeatureServer"]},e).then(()=>this._fetchService(e))),this.when()}get defaultPopupTemplate(){return this.createPopupTemplate()}get effectiveMaxRecordCount(){var e;return this.maxRecordCount??((e=this.capabilities)==null?void 0:e.query.maxRecordCount)??5e3}get isTable(){return this.loaded&&this.geometryType==null}set renderer(e){b(e,this.fieldsIndex),this._set("renderer",e)}on(e,t){return super.on(e,t)}createPopupTemplate(e){return W(this,e)}createQuery(){return new F}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){var a;let i,n=!1;const p=(a=t==null?void 0:t.feature)==null?void 0:a.attributes,l=this.typeIdField&&(p==null?void 0:p[this.typeIdField]);return l!=null&&this.types&&(n=this.types.some(h=>{var f;return h.id==l&&(i=(f=h.domains)==null?void 0:f[e],(i==null?void 0:i.type)==="inherited"&&(i=this._getLayerDomain(e)),!0)})),n||i||(i=this._getLayerDomain(e)),i}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(F.from(e)||this.createQuery(),t)).then(i=>{var n;return(n=i==null?void 0:i.features)==null||n.forEach(p=>{p.layer=p.sourceLayer=this}),i})}serviceSupportsSpatialReference(e){var t;return((t=this.source)==null?void 0:t.serviceSupportsSpatialReference(e))??!1}async _fetchService(e){await this.source.load(e),this.read(this.source.featureDefinition,{origin:"service"}),b(this.renderer,this.fieldsIndex),X(this.timeInfo,this.fieldsIndex)}_getLayerDomain(e){if(!this.fields)return null;for(const t of this.fields)if(t.name===e&&t.domain)return t.domain;return null}};r([s({readOnly:!0,json:{origins:{service:{read:!0}}}})],o.prototype,"capabilities",void 0),r([s({type:String,json:{write:!0}})],o.prototype,"collectionId",void 0),r([s({type:String})],o.prototype,"copyright",void 0),r([s({readOnly:!0})],o.prototype,"defaultPopupTemplate",null),r([s({type:String})],o.prototype,"definitionExpression",void 0),r([s({readOnly:!0,type:String,json:{origins:{service:{name:"collection.description"}}}})],o.prototype,"description",void 0),r([s({type:String})],o.prototype,"displayField",void 0),r([s({type:Number})],o.prototype,"effectiveMaxRecordCount",null),r([s(Y)],o.prototype,"elevationInfo",void 0),r([s({type:[ee],json:{origins:{service:{name:"layerDefinition.fields"}}}})],o.prototype,"fields",void 0),r([s(Fe.fieldsIndex)],o.prototype,"fieldsIndex",void 0),r([s({readOnly:!0,type:te,json:{origins:{service:{name:"layerDefinition.extent"}}}})],o.prototype,"fullExtent",void 0),r([s({type:O.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:O.read}}}}})],o.prototype,"geometryType",void 0),r([s({type:Boolean,json:{origins:{service:{name:"layerDefinition.hasZ"}}}})],o.prototype,"hasZ",void 0),r([s({type:Boolean,readOnly:!0})],o.prototype,"isTable",null),r([s({type:[re],json:{origins:{"web-document":{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:oe},write:!0}}}})],o.prototype,"labelingInfo",void 0),r([s(se)],o.prototype,"labelsVisible",void 0),r([s(ie)],o.prototype,"legendEnabled",void 0),r([s({type:Number})],o.prototype,"maxRecordCount",void 0),r([s({type:String,json:{origins:{service:{name:"layerDefinition.objectIdField"}}}})],o.prototype,"objectIdField",void 0),r([s({type:["OGCFeatureLayer"]})],o.prototype,"operationalLayerType",void 0),r([s(ne)],o.prototype,"popupEnabled",void 0),r([s({type:pe,json:{name:"popupInfo",write:!0}})],o.prototype,"popupTemplate",void 0),r([s({types:ae,json:{origins:{service:{name:"layerDefinition.drawingInfo.renderer",write:!1},"web-scene":{types:le,name:"layerDefinition.drawingInfo.renderer",write:!0}},name:"layerDefinition.drawingInfo.renderer",write:!0}})],o.prototype,"renderer",null),r([s(ue)],o.prototype,"screenSizePerspectiveEnabled",void 0),r([s({readOnly:!0})],o.prototype,"source",void 0),r([s({readOnly:!0,type:x,json:{origins:{service:{read:!0}}}})],o.prototype,"spatialReference",void 0),r([s({type:String,json:{write:{enabled:!0,ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"collection.title"}}}})],o.prototype,"title",void 0),r([s({readOnly:!0,json:{read:!1}})],o.prototype,"type",void 0),r([s({type:String,readOnly:!0})],o.prototype,"typeIdField",void 0),r([s({type:[be]})],o.prototype,"types",void 0),r([s(de)],o.prototype,"url",void 0),o=r([D("esri.layers.OGCFeatureLayer")],o);const Be=o;export{Be as default}; diff --git a/dist/assets/OGCFeatureLayerView3D-FLI41Ca4.js b/dist/assets/OGCFeatureLayerView3D-FLI41Ca4.js deleted file mode 100644 index 419cf3c..0000000 --- a/dist/assets/OGCFeatureLayerView3D-FLI41Ca4.js +++ /dev/null @@ -1 +0,0 @@ -import{e as r,y as i,c as o,E as s}from"./index-J0iiHjMT.js";import{_ as m}from"./FeatureLayerViewBase3D-VurTj7t3.js";import"./HeatmapDensity.glsl-y7dUg--m.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./queryForSymbologySnapping-I1fFQTD_.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./QueryEngine-8tLWlkSE.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./FeatureSet-d4S1oKME.js";import"./FeatureStore-X-AIJLo2.js";import"./BoundsStore-wmwfHjhp.js";import"./projectExtentUtils-TwA6ooHn.js";import"./LayerView3D-iOx2MD1g.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./EventedSet-JGlFrfoR.js";import"./FeatureEffect-5bEV-xG1.js";import"./LayerView-efDufa6j.js";import"./RefreshableLayerView-Pd4dLcWr.js";const l=p=>{let e=class extends p{get availableFields(){return this.layer.fieldsIndex.fields.map(a=>a.name)}};return r([i()],e.prototype,"layer",void 0),r([i({readOnly:!0})],e.prototype,"availableFields",null),e=r([o("esri.views.layers.OGCFeatureLayerView")],e),e};let t=class extends l(m){constructor(){super(...arguments),this.type="ogc-feature-3d"}initialize(){this.layer.serviceSupportsSpatialReference(this.view.spatialReference)||this.addResolvingPromise(Promise.reject(new s("layerview:spatial-reference-incompatible","The spatial references supported by this OGC layer are incompatible with the spatial reference of the view",{layer:this.layer})))}};r([i()],t.prototype,"layer",void 0),t=r([o("esri.views.3d.layers.OGCFeatureLayerView3D")],t);const q=t;export{q as default}; diff --git a/dist/assets/OGCFeatureLayerView3D-a9b4I66a.js b/dist/assets/OGCFeatureLayerView3D-a9b4I66a.js new file mode 100644 index 0000000..edfcab0 --- /dev/null +++ b/dist/assets/OGCFeatureLayerView3D-a9b4I66a.js @@ -0,0 +1 @@ +import{e as r,y as i,c as o,r as s}from"./index-pCX-0tJH.js";import{_ as l}from"./FeatureLayerViewBase3D-W0Qwl4g_.js";import"./HeatmapDensity.glsl-de3m0xZZ.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./queryForSymbologySnapping-MXWRIdj-.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./QueryEngine-uvDs-vBe.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./FeatureStore-PXMUgn0j.js";import"./BoundsStore-_-dPK5c-.js";import"./projectExtentUtils-Q4rXasWA.js";import"./LayerView3D-57OghbRh.js";import"./EventedSet-TJfupI82.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./LayerView-ixwLVnzr.js";import"./RefreshableLayerView-DVYs7L04.js";const m=p=>{let e=class extends p{get availableFields(){return this.layer.fieldsIndex.fields.map(a=>a.name)}};return r([i()],e.prototype,"layer",void 0),r([i({readOnly:!0})],e.prototype,"availableFields",null),e=r([o("esri.views.layers.OGCFeatureLayerView")],e),e};let t=class extends m(l){constructor(){super(...arguments),this.type="ogc-feature-3d"}initialize(){this.layer.serviceSupportsSpatialReference(this.view.spatialReference)||this.addResolvingPromise(Promise.reject(new s("layerview:spatial-reference-incompatible","The spatial references supported by this OGC layer are incompatible with the spatial reference of the view",{layer:this.layer})))}};r([i()],t.prototype,"layer",void 0),t=r([o("esri.views.3d.layers.OGCFeatureLayerView3D")],t);const T=t;export{T as default}; diff --git a/dist/assets/Object3DVisualElement-TMb7y_wl.js b/dist/assets/Object3DVisualElement-8HoU366x.js similarity index 91% rename from dist/assets/Object3DVisualElement-TMb7y_wl.js rename to dist/assets/Object3DVisualElement-8HoU366x.js index 40db74b..19904f4 100644 --- a/dist/assets/Object3DVisualElement-TMb7y_wl.js +++ b/dist/assets/Object3DVisualElement-8HoU366x.js @@ -1 +1 @@ -import{bA as o,bC as i,bD as a,G as c,bE as n}from"./index-J0iiHjMT.js";import{t as h}from"./VisualElement-kjYXz27t.js";class _ extends h{constructor(e){super(e),this._resources=null,this._transform=o()}get object(){return this._resources!=null?this._resources.object:null}get transform(){return this._transform}set transform(e){i(this._transform,e),this._resources!=null&&(this._resources.object.transformation=this._transform)}recreate(){this.attached&&this.createResources()}recreateGeometry(){if(this._resources==null)return;const e=this._resources.object,s=this.view._stage;s.removeMany(e.geometries),e.removeAllGeometries(),this.createGeometries(e),e.visible=this.visible,s.addMany(e.geometries)}createResources(){this.destroyResources();const e=this.view._stage;if(!e)return;const s=new a(e,{pickable:!1,updatePolicy:c.SYNC}),r=new n({castShadow:!1});r.transformation=this._transform,this.createExternalResources(),this.createGeometries(r),e.addMany(r.geometries),this.forEachExternalMaterial(t=>e.add(t)),e.add(r),s.add(r),r.visible=this.visible,this._resources={layer:s,object:r}}destroyResources(){const e=this.view._stage;this._resources!=null&&e&&(e.remove(this._resources.object),this._resources.layer.destroy(),this.forEachExternalMaterial(s=>{e.remove(s)}),e.removeMany(this._resources.object.geometries),this._resources.object.dispose(),this.destroyExternalResources(),this._resources=null)}updateVisibility(e){this._resources!=null&&(this._resources.object.visible=e)}}export{_ as a}; +import{bT as o,bV as i,bW as a,C as c,bX as n}from"./index-pCX-0tJH.js";import{t as h}from"./VisualElement--2Scr6Yq.js";class _ extends h{constructor(e){super(e),this._resources=null,this._transform=o()}get object(){return this._resources!=null?this._resources.object:null}get transform(){return this._transform}set transform(e){i(this._transform,e),this._resources!=null&&(this._resources.object.transformation=this._transform)}recreate(){this.attached&&this.createResources()}recreateGeometry(){if(this._resources==null)return;const e=this._resources.object,s=this.view._stage;s.removeMany(e.geometries),e.removeAllGeometries(),this.createGeometries(e),e.visible=this.visible,s.addMany(e.geometries)}createResources(){this.destroyResources();const e=this.view._stage;if(!e)return;const s=new a(e,{pickable:!1,updatePolicy:c.SYNC}),r=new n({castShadow:!1});r.transformation=this._transform,this.createExternalResources(),this.createGeometries(r),e.addMany(r.geometries),this.forEachExternalMaterial(t=>e.add(t)),e.add(r),s.add(r),r.visible=this.visible,this._resources={layer:s,object:r}}destroyResources(){const e=this.view._stage;this._resources!=null&&e&&(e.remove(this._resources.object),this._resources.layer.destroy(),this.forEachExternalMaterial(s=>{e.remove(s)}),e.removeMany(this._resources.object.geometries),this._resources.object.dispose(),this.destroyExternalResources(),this._resources=null)}updateVisibility(e){this._resources!=null&&(this._resources.object.visible=e)}}export{_ as a}; diff --git a/dist/assets/OpenStreetMapLayer-6XrQQ-kN.js b/dist/assets/OpenStreetMapLayer-qslplUAm.js similarity index 94% rename from dist/assets/OpenStreetMapLayer-6XrQQ-kN.js rename to dist/assets/OpenStreetMapLayer-qslplUAm.js index eb8061f..bdf07a9 100644 --- a/dist/assets/OpenStreetMapLayer-6XrQQ-kN.js +++ b/dist/assets/OpenStreetMapLayer-qslplUAm.js @@ -1 +1 @@ -import{e as t,y as l,bR as a,e$ as s,c as i,T as p,ar as r,f0 as e,dT as c}from"./index-J0iiHjMT.js";import{I as u}from"./WebTileLayer-JxqArsF7.js";let o=class extends u{constructor(...n){super(...n),this.portalItem=null,this.isReference=null,this.tileInfo=new s({size:[256,256],dpi:96,format:"png8",compressionQuality:0,origin:new p({x:-20037508342787e-6,y:20037508342787e-6,spatialReference:r.WebMercator}),spatialReference:r.WebMercator,lods:[new e({level:0,scale:591657527591555e-6,resolution:156543.033928}),new e({level:1,scale:295828763795777e-6,resolution:78271.5169639999}),new e({level:2,scale:147914381897889e-6,resolution:39135.7584820001}),new e({level:3,scale:73957190948944e-6,resolution:19567.8792409999}),new e({level:4,scale:36978595474472e-6,resolution:9783.93962049996}),new e({level:5,scale:18489297737236e-6,resolution:4891.96981024998}),new e({level:6,scale:9244648868618e-6,resolution:2445.98490512499}),new e({level:7,scale:4622324434309e-6,resolution:1222.99245256249}),new e({level:8,scale:2311162217155e-6,resolution:611.49622628138}),new e({level:9,scale:1155581108577e-6,resolution:305.748113140558}),new e({level:10,scale:577790.554289,resolution:152.874056570411}),new e({level:11,scale:288895.277144,resolution:76.4370282850732}),new e({level:12,scale:144447.638572,resolution:38.2185141425366}),new e({level:13,scale:72223.819286,resolution:19.1092570712683}),new e({level:14,scale:36111.909643,resolution:9.55462853563415}),new e({level:15,scale:18055.954822,resolution:4.77731426794937}),new e({level:16,scale:9027.977411,resolution:2.38865713397468}),new e({level:17,scale:4513.988705,resolution:1.19432856685505}),new e({level:18,scale:2256.994353,resolution:.597164283559817}),new e({level:19,scale:1128.497176,resolution:.298582141647617})]}),this.subDomains=["a","b","c"],this.fullExtent=new c(-20037508342787e-6,-2003750834278e-5,2003750834278e-5,20037508342787e-6,r.WebMercator),this.urlTemplate="https://{subDomain}.tile.openstreetmap.org/{level}/{col}/{row}.png",this.operationalLayerType="OpenStreetMap",this.type="open-street-map",this.copyright="Map data © OpenStreetMap contributors, CC-BY-SA"}get refreshInterval(){return 0}};t([l({type:a,json:{read:!1,write:!1,origins:{"web-document":{read:!1,write:!1}}}})],o.prototype,"portalItem",void 0),t([l({type:Boolean,json:{read:!1,write:!1}})],o.prototype,"isReference",void 0),t([l({type:Number,readOnly:!0,json:{read:!1,write:!1,origins:{"web-document":{read:!1,write:!1}}}})],o.prototype,"refreshInterval",null),t([l({type:s,json:{write:!1}})],o.prototype,"tileInfo",void 0),t([l({type:["show","hide"]})],o.prototype,"listMode",void 0),t([l({readOnly:!0,json:{read:!1,write:!1}})],o.prototype,"subDomains",void 0),t([l({readOnly:!0,json:{read:!1,write:!1},nonNullable:!0})],o.prototype,"fullExtent",void 0),t([l({readOnly:!0,json:{read:!1,write:!1}})],o.prototype,"urlTemplate",void 0),t([l({type:["OpenStreetMap"]})],o.prototype,"operationalLayerType",void 0),t([l({json:{read:!1}})],o.prototype,"type",void 0),t([l({json:{read:!1,write:!1}})],o.prototype,"copyright",void 0),t([l({json:{read:!1,write:!1}})],o.prototype,"wmtsInfo",void 0),o=t([i("esri.layers.OpenStreetMapLayer")],o);const y=o;export{y as default}; +import{e as t,y as l,aq as a,eW as s,c as i,L as p,d2 as r,eX as e,dO as c}from"./index-pCX-0tJH.js";import{I as u}from"./WebTileLayer-jfo0VJmw.js";let o=class extends u{constructor(...n){super(...n),this.portalItem=null,this.isReference=null,this.tileInfo=new s({size:[256,256],dpi:96,format:"png8",compressionQuality:0,origin:new p({x:-20037508342787e-6,y:20037508342787e-6,spatialReference:r.WebMercator}),spatialReference:r.WebMercator,lods:[new e({level:0,scale:591657527591555e-6,resolution:156543.033928}),new e({level:1,scale:295828763795777e-6,resolution:78271.5169639999}),new e({level:2,scale:147914381897889e-6,resolution:39135.7584820001}),new e({level:3,scale:73957190948944e-6,resolution:19567.8792409999}),new e({level:4,scale:36978595474472e-6,resolution:9783.93962049996}),new e({level:5,scale:18489297737236e-6,resolution:4891.96981024998}),new e({level:6,scale:9244648868618e-6,resolution:2445.98490512499}),new e({level:7,scale:4622324434309e-6,resolution:1222.99245256249}),new e({level:8,scale:2311162217155e-6,resolution:611.49622628138}),new e({level:9,scale:1155581108577e-6,resolution:305.748113140558}),new e({level:10,scale:577790.554289,resolution:152.874056570411}),new e({level:11,scale:288895.277144,resolution:76.4370282850732}),new e({level:12,scale:144447.638572,resolution:38.2185141425366}),new e({level:13,scale:72223.819286,resolution:19.1092570712683}),new e({level:14,scale:36111.909643,resolution:9.55462853563415}),new e({level:15,scale:18055.954822,resolution:4.77731426794937}),new e({level:16,scale:9027.977411,resolution:2.38865713397468}),new e({level:17,scale:4513.988705,resolution:1.19432856685505}),new e({level:18,scale:2256.994353,resolution:.597164283559817}),new e({level:19,scale:1128.497176,resolution:.298582141647617})]}),this.subDomains=["a","b","c"],this.fullExtent=new c(-20037508342787e-6,-2003750834278e-5,2003750834278e-5,20037508342787e-6,r.WebMercator),this.urlTemplate="https://{subDomain}.tile.openstreetmap.org/{level}/{col}/{row}.png",this.operationalLayerType="OpenStreetMap",this.type="open-street-map",this.copyright="Map data © OpenStreetMap contributors, CC-BY-SA"}get refreshInterval(){return 0}};t([l({type:a,json:{read:!1,write:!1,origins:{"web-document":{read:!1,write:!1}}}})],o.prototype,"portalItem",void 0),t([l({type:Boolean,json:{read:!1,write:!1}})],o.prototype,"isReference",void 0),t([l({type:Number,readOnly:!0,json:{read:!1,write:!1,origins:{"web-document":{read:!1,write:!1}}}})],o.prototype,"refreshInterval",null),t([l({type:s,json:{write:!1}})],o.prototype,"tileInfo",void 0),t([l({type:["show","hide"]})],o.prototype,"listMode",void 0),t([l({readOnly:!0,json:{read:!1,write:!1}})],o.prototype,"subDomains",void 0),t([l({readOnly:!0,json:{read:!1,write:!1},nonNullable:!0})],o.prototype,"fullExtent",void 0),t([l({readOnly:!0,json:{read:!1,write:!1}})],o.prototype,"urlTemplate",void 0),t([l({type:["OpenStreetMap"]})],o.prototype,"operationalLayerType",void 0),t([l({json:{read:!1}})],o.prototype,"type",void 0),t([l({json:{read:!1,write:!1}})],o.prototype,"copyright",void 0),t([l({json:{read:!1,write:!1}})],o.prototype,"wmtsInfo",void 0),o=t([i("esri.layers.OpenStreetMapLayer")],o);const y=o;export{y as default}; diff --git a/dist/assets/OrderedLayer-M7k5gLgx.js b/dist/assets/OrderedLayer-XNaJwl_G.js similarity index 89% rename from dist/assets/OrderedLayer-M7k5gLgx.js rename to dist/assets/OrderedLayer-XNaJwl_G.js index c91e88f..b313886 100644 --- a/dist/assets/OrderedLayer-M7k5gLgx.js +++ b/dist/assets/OrderedLayer-XNaJwl_G.js @@ -1 +1 @@ -import{dp as y,e as i,y as s,c as p,dr as f,dD as w}from"./index-J0iiHjMT.js";var c;const a=new y({asc:"ascending",desc:"descending"});let t=c=class extends f{constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new c({field:this.field,valueExpression:this.valueExpression,order:this.order})}};i([s({type:String,json:{write:!0}})],t.prototype,"field",void 0),i([s({type:String,json:{write:!0}})],t.prototype,"valueExpression",void 0),i([s({type:a.apiValues,json:{read:a.read,write:a.write}})],t.prototype,"order",void 0),t=c=i([p("esri.layers.support.OrderByInfo")],t);const u=t;function v(e,r,o){if(!e)return null;const d=e.find(l=>!!l.field);if(!d)return null;const n=new u;return n.read(d,o),[n]}function g(e,r,o,d){const n=e.find(l=>!!l.field);n&&w(o,[n.toJSON()],r)}const h=e=>{let r=class extends e{constructor(){super(...arguments),this.orderBy=null}};return i([s({type:[u],json:{origins:{"web-scene":{write:!1,read:!1}},read:{source:"layerDefinition.orderBy",reader:v},write:{target:"layerDefinition.orderBy",writer:g}}})],r.prototype,"orderBy",void 0),r=i([p("esri.layers.mixins.OrderedLayer")],r),r};export{h as c}; +import{dp as y,e as i,y as s,c as p,dr as f,dy as w}from"./index-pCX-0tJH.js";var c;const a=new y({asc:"ascending",desc:"descending"});let t=c=class extends f{constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new c({field:this.field,valueExpression:this.valueExpression,order:this.order})}};i([s({type:String,json:{write:!0}})],t.prototype,"field",void 0),i([s({type:String,json:{write:!0}})],t.prototype,"valueExpression",void 0),i([s({type:a.apiValues,json:{read:a.read,write:a.write}})],t.prototype,"order",void 0),t=c=i([p("esri.layers.support.OrderByInfo")],t);const u=t;function v(e,r,o){if(!e)return null;const d=e.find(l=>!!l.field);if(!d)return null;const n=new u;return n.read(d,o),[n]}function g(e,r,o,d){const n=e.find(l=>!!l.field);n&&w(o,[n.toJSON()],r)}const h=e=>{let r=class extends e{constructor(){super(...arguments),this.orderBy=null}};return i([s({type:[u],json:{origins:{"web-scene":{write:!1,read:!1}},read:{source:"layerDefinition.orderBy",reader:v},write:{target:"layerDefinition.orderBy",writer:g}}})],r.prototype,"orderBy",void 0),r=i([p("esri.layers.mixins.OrderedLayer")],r),r};export{h as c}; diff --git a/dist/assets/OrientedImageryLayer-F57-BGcl.js b/dist/assets/OrientedImageryLayer-F57-BGcl.js new file mode 100644 index 0000000..ca9a856 --- /dev/null +++ b/dist/assets/OrientedImageryLayer-F57-BGcl.js @@ -0,0 +1 @@ +import{e as t,y as e,c as x,g as q,dq as M,iC as A,dr as Y,dp as V,f1 as _,r as Z}from"./index-pCX-0tJH.js";import B from"./FeatureLayer-9tNCmEbA.js";import"./FeatureLayerBase-mvqC7cJs.js";import"./serviceCapabilitiesUtils-f-iBP4uh.js";import"./editsZScale-4-dTv58d.js";import"./CustomParametersMixin-7nmugR3Y.js";import"./FeatureEffectLayer-OK0TB5f6.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./FeatureReductionLayer-2X2_PJv9.js";import"./OrderedLayer-XNaJwl_G.js";import"./FeatureTemplate-vSzbyslg.js";import"./FeatureType-0WPvBvpQ.js";import"./versionUtils-idhrDltC.js";const G=[2155,2194,2204,2222,2223,2224,2225,2226,2227,2228,2229,2230,2231,2232,2233,2234,2235,2236,2237,2238,2239,2240,2241,2242,2243,2244,2245,2246,2247,2248,2249,2250,2251,2252,2253,2254,2255,2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266,2267,2268,2269,2270,2271,2272,2273,2274,2275,2276,2277,2278,2279,2280,2281,2282,2283,2284,2285,2286,2287,2288,2289,2314,2867,2868,2869,2870,2871,2872,2873,2874,2875,2876,2877,2878,2879,2880,2881,2882,2883,2884,2885,2886,2887,2888,2889,2890,2891,2892,2893,2894,2895,2896,2897,2898,2899,2900,2901,2902,2903,2904,2905,2906,2907,2908,2909,2910,2911,2912,2913,2914,2915,2916,2917,2918,2919,2920,2921,2922,2923,2924,2925,2926,2927,2928,2929,2930,2964,2965,2966,2967,2968,2992,2994,3080,3089,3091,3102,3359,3359,3361,3363,3365,3366,3404,3407,3417,3418,3419,3420,3421,3422,3423,3424,3425,3426,3427,3428,3429,3430,3431,3432,3433,3434,3435,3436,3437,3438,3441,3442,3443,3444,3445,3446,3451,3452,3453,3454,3455,3456,3457,3458,3459,3479,3481,3483,3485,3487,3490,3492,3494,3496,3498,3500,3502,3504,3506,3508,3510,3512,3515,3517,3519,3521,3523,3525,3527,3529,3531,3533,3535,3537,3539,3541,3543,3545,3547,3549,3551,3553,3560,3561,3562,3563,3564,3565,3566,3567,3568,3569,3570,3582,3584,3586,3588,3590,3593,3598,3600,3605,3608,3610,3612,3614,3616,3618,3620,3622,3624,3626,3628,3630,3632,3634,3636,3640,3642,3644,3646,3648,3650,3652,3654,3656,3658,3660,3662,3664,3668,3670,3672,3674,3676,3677,3679,3680,3682,3683,3686,3688,3690,3692,3696,3698,3700,3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738,3739,3753,3754,3755,3756,3757,3758,3759,3760,3991,3992,4217,4399,4400,4401,4402,4403,4404,4405,4406,4407,4408,4409,4410,4411,4412,4413,4418,4419,4420,4421,4422,4423,4424,4425,4426,4427,4428,4429,4430,4431,4432,4433,4438,4439,4455,4456,4457,5466,5588,5589,5623,5624,5625,5646,5654,5655,6128,6129,6141,6200,6201,6202,6391,6405,6407,6409,6411,6413,6416,6418,6420,6422,6424,6426,6428,6430,6432,6434,6436,6438,6441,6443,6445,6447,6449,6451,6453,6455,6457,6459,6461,6463,6465,6467,6469,6471,6473,6475,6477,6479,6484,6486,6488,6490,6492,6494,6496,6499,6501,6503,6505,6507,6510,6515,6517,6519,6521,6523,6525,6527,6529,6531,6533,6535,6537,6539,6541,6543,6545,6547,6549,6551,6553,6555,6557,6559,6561,6563,6565,6568,6570,6572,6574,6576,6578,6582,6584,6586,6588,6590,6593,6595,6597,6599,6601,6603,6605,6607,6609,6612,6614,6616,6618,6625,6626,6627,6633,6785,6787,6789,6791,6793,6795,6797,6799,6801,6803,6805,6807,6809,6811,6813,6815,6817,6819,6821,6823,6825,6827,6829,6831,6833,6835,6837,6839,6841,6843,6845,6847,6849,6851,6853,6855,6857,6859,6861,6863,6868,6880,6885,6887,6923,6925,6966,6997,7057,7058,7059,7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,7119,7120,7121,7122,7123,7124,7125,7126,7127,7128,7132,7258,7260,7262,7264,7266,7268,7270,7272,7274,7276,7278,7280,7282,7284,7286,7288,7290,7292,7294,7296,7298,7300,7302,7304,7306,7308,7310,7312,7314,7316,7318,7320,7322,7324,7326,7328,7330,7332,7334,7336,7338,7340,7342,7344,7346,7348,7350,7352,7354,7356,7358,7360,7362,7364,7366,7368,7370,7558,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598,7599,7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614,7615,7616,7617,7618,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628,7629,7630,7631,7632,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643,7644,7645,24100,26729,26730,26731,26732,26733,26734,26735,26736,26737,26738,26739,26740,26741,26742,26743,26744,26745,26746,26747,26748,26749,26750,26751,26752,26753,26754,26755,26756,26757,26758,26759,26760,26766,26767,26768,26769,26770,26771,26772,26773,26774,26775,26776,26777,26778,26779,26780,26781,26782,26783,26784,26785,26786,26787,26791,26792,26793,26794,26795,26796,26797,26798,26799,26801,26802,26803,26811,26812,26813,26814,26815,26819,26820,26821,26822,26825,26826,26830,26831,26832,26833,26836,26837,26841,26842,26843,26844,26847,26848,26849,26850,26851,26852,26853,26854,26855,26856,26857,26858,26859,26860,26861,26862,26863,26864,26865,26866,26867,26868,26869,26870,32001,32002,32003,32005,32006,32007,32008,32009,32010,32011,32012,32013,32014,32015,32016,32017,32018,32019,32020,32021,32022,32023,32024,32025,32026,32027,32028,32029,32030,32031,32033,32034,32035,32036,32037,32038,32039,32040,32041,32042,32043,32044,32045,32046,32047,32048,32049,32050,32051,32052,32053,32054,32055,32056,32057,32058,32064,32065,32066,32067,32074,32075,32076,32077,32099,32164,32165,32166,32167,32664,32665,32666,32667,65061,102120,102121,102629,102630,102631,102632,102633,102634,102635,102636,102637,102638,102639,102640,102641,102642,102643,102644,102645,102646,102648,102649,102650,102651,102652,102653,102654,102655,102656,102657,102658,102659,102660,102661,102662,102663,102664,102665,102666,102667,102668,102669,102670,102671,102672,102673,102674,102675,102676,102677,102678,102679,102680,102681,102682,102683,102684,102685,102686,102687,102688,102689,102690,102691,102692,102693,102694,102695,102696,102697,102698,102700,102704,102707,102708,102709,102710,102711,102712,102713,102714,102715,102716,102717,102718,102719,102720,102721,102722,102723,102724,102725,102726,102727,102728,102729,102730,102733,102734,102735,102736,102737,102738,102739,102740,102741,102742,102743,102744,102745,102746,102747,102748,102749,102750,102751,102752,102753,102754,102755,102756,102757,102758,102761,102766],J=[5614,5702,6130,6131,6132,6358,6359,6360],Q=[115700,4326];function k(o){return G.includes(o)?"feet":"meters"}function X(o,i){return typeof o=="number"?J.includes(o)?"feet":"meters":k(i)}function tt(o,i){return Q.includes(o)||i===4326?"ellipsoidal":"gravity-related-height"}let P=class extends q{get isAdvanced(){return!1}getInfo(){const{horizontalWKID:i,verticalWKID:a}=this;let n=i,p=a;const l=this;if(l.type===4){const{properties:j}=l;n=4326,p=j.verticalWKID}return{heightModel:tt(n,p),heightUnit:X(p,n),horizontalUnit:k(n)}}};t([e({json:{write:!0}})],P.prototype,"affineTransformations",void 0),t([e({json:{write:!0}})],P.prototype,"focalLength",void 0),t([e({json:{write:!0}})],P.prototype,"principalOffsetPoint",void 0),t([e({json:{write:!0}})],P.prototype,"radialDistortionCoefficients",void 0),t([e({json:{write:!0}})],P.prototype,"tangentialDistortionCoefficients",void 0),t([e({json:{write:!0}})],P.prototype,"horizontalWKID",void 0),t([e({json:{write:!0}})],P.prototype,"verticalWKID",void 0),t([e({json:{write:!0}})],P.prototype,"x",void 0),t([e({json:{write:!0}})],P.prototype,"y",void 0),t([e({json:{write:!0}})],P.prototype,"z",void 0),t([e({json:{write:!0}})],P.prototype,"type",void 0),P=t([x("esri.layers.orientedImagery.core.CameraOrientation")],P);const F=P;let h=class extends M(A(F)){constructor(){super(...arguments),this.type=1}get isAdvanced(){const{affineTransformations:i,focalLength:a,principalOffsetPoint:n,radialDistortionCoefficients:p,tangentialDistortionCoefficients:l}=this;return(i==null?void 0:i.length)>1||!Number.isNaN(a)||(n==null?void 0:n.length)>1||(p==null?void 0:p.length)>1||(l==null?void 0:l.length)>1}toString(){const{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,heading:N,pitch:w,roll:D,affineTransformations:u,focalLength:b,principalOffsetPoint:f,radialDistortionCoefficients:d,tangentialDistortionCoefficients:m}=this,y=[i,a,n,p,l,j,N,w,D];return this.isAdvanced&&(u==null||u.forEach(r=>y.push(r)),y.push(b),f==null||f.forEach(r=>y.push(r)),d==null||d.forEach(r=>y.push(r)),m==null||m.forEach(r=>y.push(r))),y.map(r=>Number.isNaN(r)?"":r).join("|")}};t([e({json:{write:!0}})],h.prototype,"type",void 0),t([e({type:[Number],json:{write:!0}})],h.prototype,"affineTransformations",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"focalLength",void 0),t([e({type:[Number],json:{write:!0}})],h.prototype,"principalOffsetPoint",void 0),t([e({type:[Number],json:{write:!0}})],h.prototype,"radialDistortionCoefficients",void 0),t([e({type:[Number],json:{write:!0}})],h.prototype,"tangentialDistortionCoefficients",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"heading",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"pitch",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"roll",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"horizontalWKID",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"verticalWKID",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"x",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"y",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"z",void 0),h=t([x("esri.layers.orientedImagery.core.CameraOrientationHPR")],h);const et=h;let v=class extends M(A(F)){constructor(){super(...arguments),this.type=2}get isAdvanced(){const{affineTransformations:i,focalLength:a,principalOffsetPoint:n,radialDistortionCoefficients:p,tangentialDistortionCoefficients:l}=this;return(i==null?void 0:i.length)>1||!Number.isNaN(a)||(n==null?void 0:n.length)>1||(p==null?void 0:p.length)>1||(l==null?void 0:l.length)>1}toString(){const{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,omega:N,phi:w,kappa:D,affineTransformations:u,focalLength:b,principalOffsetPoint:f,radialDistortionCoefficients:d,tangentialDistortionCoefficients:m}=this,y=[i,a,n,p,l,j,N,w,D];return this.isAdvanced&&(u==null||u.forEach(r=>y.push(r)),y.push(b),f==null||f.forEach(r=>y.push(r)),d==null||d.forEach(r=>y.push(r)),m==null||m.forEach(r=>y.push(r))),y.map(r=>isNaN(r)?"":r).join("|")}};t([e({json:{write:!0}})],v.prototype,"type",void 0),t([e({type:[Number],json:{write:!0}})],v.prototype,"affineTransformations",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"focalLength",void 0),t([e({type:[Number],json:{write:!0}})],v.prototype,"principalOffsetPoint",void 0),t([e({type:[Number],json:{write:!0}})],v.prototype,"radialDistortionCoefficients",void 0),t([e({type:[Number],json:{write:!0}})],v.prototype,"tangentialDistortionCoefficients",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"omega",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"phi",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"kappa",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"horizontalWKID",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"verticalWKID",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"x",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"y",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"z",void 0),v=t([x("esri.layers.orientedImagery.core.CameraOrientationOPK")],v);const ot=v;let g=class extends M(A(F)){constructor(){super(...arguments),this.type=3}get isAdvanced(){const{affineTransformations:i,focalLength:a,principalOffsetPoint:n,radialDistortionCoefficients:p,tangentialDistortionCoefficients:l}=this;return(i==null?void 0:i.length)>1||!Number.isNaN(a)||(n==null?void 0:n.length)>1||(p==null?void 0:p.length)>1||(l==null?void 0:l.length)>1}toString(){const{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,yaw:N,pitch:w,roll:D,affineTransformations:u,focalLength:b,principalOffsetPoint:f,radialDistortionCoefficients:d,tangentialDistortionCoefficients:m}=this,y=[i,a,n,p,l,j,N,w,D];return this.isAdvanced&&(u==null||u.forEach(r=>y.push(r)),y.push(b),f==null||f.forEach(r=>y.push(r)),f==null||f.forEach(r=>y.push(r)),d==null||d.forEach(r=>y.push(r)),m==null||m.forEach(r=>y.push(r))),y.map(r=>Number.isNaN(r)?"":r).join("|")}};t([e({json:{write:!0}})],g.prototype,"type",void 0),t([e({type:[Number],json:{write:!0}})],g.prototype,"affineTransformations",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"focalLength",void 0),t([e({type:[Number],json:{write:!0}})],g.prototype,"principalOffsetPoint",void 0),t([e({type:[Number],json:{write:!0}})],g.prototype,"radialDistortionCoefficients",void 0),t([e({type:[Number],json:{write:!0}})],g.prototype,"tangentialDistortionCoefficients",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"yaw",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"pitch",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"roll",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"horizontalWKID",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"verticalWKID",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"x",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"y",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"z",void 0),g=t([x("esri.layers.orientedImagery.core.CameraOrientationYPR")],g);const it=g;let O=class extends Y{constructor(){super(...arguments),this.url=null}};t([e({type:Number,json:{write:!0}})],O.prototype,"lod",void 0),t([e({type:String,json:{write:!0}})],O.prototype,"rasterFunction",void 0),t([e({type:String,json:{write:!0}})],O.prototype,"url",void 0),O=t([x("esri.layers.orientedImagery.core.ElevationSourceDefinitions.ElevationSource")],O);let E=class extends Y{};t([e({type:Number,json:{write:!0}})],E.prototype,"constantElevation",void 0),E=t([x("esri.layers.orientedImagery.cor.ElevationSourceDefinitions.ConstantElevation")],E);const rt=o=>"constantElevation"in o;var I;(function(o){o[o.HPR=1]="HPR",o[o.OPK=2]="OPK",o[o.YPR=3]="YPR",o[o.LTP=4]="LTP"})(I||(I={}));function nt(o,i,a){return i&&(o=`${i}${o}`),a&&(o+=`${a}`),o}function at(o,i,a){let{url:n}=o;return n?(n=nt(n,i,a),new O({...o,url:n})):null}function st(o,i,a){return o&&(rt(o)?new E(o):at(o,i,a))}const R=new V({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),H=new V({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique","":null}),U=new Map;U.set(`${I.OPK}`,{desc:"Using Omega Phi Kappa",constructor:ot}),U.set(`${I.HPR}`,{desc:"Using Heading, Pitch and Roll",constructor:et}),U.set(`${I.YPR}`,{desc:"Using Yaw, Pitch and Roll",constructor:it});const W=new Map;function pt(o){const[i,a,n,p,l,j,N,w,D,u,b,f,d,m,y,r,$,S,C,z,K,L,T]=o;return{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,omega:N,phi:w,kappa:D,affineTransformations:[u,b,f,d,m,y],focalLength:r,principalOffsetPoint:[$,S],radialDistortionCoefficients:[C,z,K],tangentialDistortionCoefficients:[L,T]}}function lt(o){const[i,a,n,p,l,j,N,w,D,u,b,f,d,m,y,r,$,S,C,z,K,L,T]=o;return{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,heading:N,pitch:w,roll:D,affineTransformations:[u,b,f,d,m,y],focalLength:r,principalOffsetPoint:[$,S],radialDistortionCoefficients:[C,z,K],tangentialDistortionCoefficients:[L,T]}}function yt(o){const[i,a,n,p,l,j,N,w,D,u,b,f,d,m,y,r,$,S,C,z,K,L,T]=o;return{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,yaw:N,pitch:w,roll:D,affineTransformations:[u,b,f,d,m,y],focalLength:r,principalOffsetPoint:[$,S],radialDistortionCoefficients:[C,z,K],tangentialDistortionCoefficients:[L,T]}}function ct(o){const[i,a,n,p,l,j,...N]=o,w=W.get(j);return w?{type:i,latitude:a,longitude:n,ellipsoidRadius:p,squaredEccentricity:l,properties:w([j,"",...N])}:null}W.set(`${I.HPR}`,lt),W.set(`${I.YPR}`,yt),W.set(`${I.OPK}`,pt),W.set(`${I.LTP}`,ct);function c(o,i,a){return{name:`orientedImageryProperties.${o}`,write:!i||{target:`orientedImageryProperties.${o}`,writer:i},origins:{service:{name:`orientedImageryInfo.orientedImageryProperties.${o}`,write:i,read:a}}}}let s=class extends B{constructor(){super(...arguments),this.cameraHeading=null,this.cameraHeight=null,this.cameraPitch=null,this.cameraRoll=null,this.coveragePercent=null,this.demPathPrefix=null,this.demPathSuffix=null,this.depthImagePathPrefix=null,this.depthImagePathSuffix=null,this.elevationSource=null,this.farDistance=null,this.geometryType="point",this.horizontalFieldOfView=null,this.horizontalMeasurementUnit=null,this.imagePathPrefix=null,this.imagePathSuffix=null,this.imageRotation=null,this.maximumDistance=null,this.nearDistance=null,this.operationalLayerType="OrientedImageryLayer",this.orientationAccuracy=null,this.orientedImageryType=null,this.type="oriented-imagery",this.timeIntervalUnit=null,this.verticalFieldOfView=null,this.verticalMeasurementUnit=null,this.videoPathPrefix=null,this.videoPathSuffix=null}get effectiveElevationSource(){const{elevationSource:o,demPathPrefix:i,demPathSuffix:a}=this;return st(o,i,a)}findFirstValidLayerId(o){var i,a;return(a=(i=o.layers)==null?void 0:i.find(n=>n.type==="Oriented Imagery Layer"))==null?void 0:a.id}_verifySource(){if(super._verifySource(),this.geometryType!=="point")throw new Z("oriented-imagery-layer:invalid-geometry-type","OrientedImageryLayer only supports point geometry type")}};t([e({type:Number,json:c("cameraHeading")})],s.prototype,"cameraHeading",void 0),t([e({type:Number,json:c("cameraHeight")})],s.prototype,"cameraHeight",void 0),t([e({type:Number,json:c("cameraPitch")})],s.prototype,"cameraPitch",void 0),t([e({type:Number,json:c("cameraRoll")})],s.prototype,"cameraRoll",void 0),t([e({type:Number,json:c("coveragePercent")})],s.prototype,"coveragePercent",void 0),t([e({type:String,json:c("demPathPrefix")})],s.prototype,"demPathPrefix",void 0),t([e({type:String,json:c("demPathSuffix")})],s.prototype,"demPathSuffix",void 0),t([e({type:String,json:c("depthImagePathPrefix")})],s.prototype,"depthImagePathPrefix",void 0),t([e({type:String,json:c("depthImagePathSuffix")})],s.prototype,"depthImagePathSuffix",void 0),t([e({type:Object,json:c("elevationSource")})],s.prototype,"elevationSource",void 0),t([e()],s.prototype,"effectiveElevationSource",null),t([e({type:Number,json:c("farDistance")})],s.prototype,"farDistance",void 0),t([e({json:{write:!0}})],s.prototype,"geometryType",void 0),t([e({type:Number,json:c("horizontalFieldOfView")})],s.prototype,"horizontalFieldOfView",void 0),t([e({type:String,json:c("horizontalMeasurementUnit")})],s.prototype,"horizontalMeasurementUnit",void 0),t([e({type:String,json:c("imagePathPrefix")})],s.prototype,"imagePathPrefix",void 0),t([e({type:String,json:c("imagePathSuffix")})],s.prototype,"imagePathSuffix",void 0),t([e({type:Number,json:c("imageRotation")})],s.prototype,"imageRotation",void 0),t([e({type:Number,json:c("maximumDistance")})],s.prototype,"maximumDistance",void 0),t([e({type:Number,json:c("nearDistance")})],s.prototype,"nearDistance",void 0),t([e({type:["OrientedImageryLayer"]})],s.prototype,"operationalLayerType",void 0),t([e({json:c("orientationAccuracy",(o,i)=>{o&&(i.orientationAccuracy=o.join(","))})}),_(o=>o?o.trim().split(",").map(Number):null)],s.prototype,"orientationAccuracy",void 0),t([e({json:{...c("orientedImageryType",H.write,H.read),type:H.apiValues}})],s.prototype,"orientedImageryType",void 0),t([e({json:{read:!1},value:"oriented-imagery",readOnly:!0})],s.prototype,"type",void 0),t([e({json:{...c("timeIntervalUnit",R.write,R.read),type:R.apiValues}})],s.prototype,"timeIntervalUnit",void 0),t([e({type:Number,json:c("verticalFieldOfView")})],s.prototype,"verticalFieldOfView",void 0),t([e({json:{...c("verticalMeasurementUnit"),type:new V({Feet:"feet",Meter:"meter"}).apiValues}})],s.prototype,"verticalMeasurementUnit",void 0),t([e({type:String,json:c("videoPathPrefix")})],s.prototype,"videoPathPrefix",void 0),t([e({type:String,json:c("videoPathSuffix")})],s.prototype,"videoPathSuffix",void 0),s=t([x("esri.layers.OrientedImageryLayer")],s);const Ct=s;export{Ct as default}; diff --git a/dist/assets/OrientedImageryLayer-LKoItije.js b/dist/assets/OrientedImageryLayer-LKoItije.js deleted file mode 100644 index af7598b..0000000 --- a/dist/assets/OrientedImageryLayer-LKoItije.js +++ /dev/null @@ -1 +0,0 @@ -import{e as t,y as e,c as x,p as q,dq as M,iB as A,dr as Y,dp as V,f6 as _,E as B}from"./index-J0iiHjMT.js";import Z from"./FeatureLayer--S4epFk-.js";import"./FeatureLayerBase-jpFp8gE3.js";import"./serviceCapabilitiesUtils-26KpT1VN.js";import"./editsZScale-Wgw9kbYG.js";import"./queryZScale-IaMm02_2.js";import"./FeatureSet-d4S1oKME.js";import"./CustomParametersMixin-Y1bOcayO.js";import"./FeatureEffectLayer-oBa8pIG5.js";import"./FeatureEffect-5bEV-xG1.js";import"./FeatureReductionLayer-RlitE1N6.js";import"./OrderedLayer-M7k5gLgx.js";import"./FeatureTemplate-kUgbbA00.js";import"./FeatureType-MpRe7WJj.js";import"./versionUtils-4v9zIDlv.js";import"./TopFeaturesQuery-E6D2tV-x.js";const G=[2155,2194,2204,2222,2223,2224,2225,2226,2227,2228,2229,2230,2231,2232,2233,2234,2235,2236,2237,2238,2239,2240,2241,2242,2243,2244,2245,2246,2247,2248,2249,2250,2251,2252,2253,2254,2255,2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266,2267,2268,2269,2270,2271,2272,2273,2274,2275,2276,2277,2278,2279,2280,2281,2282,2283,2284,2285,2286,2287,2288,2289,2314,2867,2868,2869,2870,2871,2872,2873,2874,2875,2876,2877,2878,2879,2880,2881,2882,2883,2884,2885,2886,2887,2888,2889,2890,2891,2892,2893,2894,2895,2896,2897,2898,2899,2900,2901,2902,2903,2904,2905,2906,2907,2908,2909,2910,2911,2912,2913,2914,2915,2916,2917,2918,2919,2920,2921,2922,2923,2924,2925,2926,2927,2928,2929,2930,2964,2965,2966,2967,2968,2992,2994,3080,3089,3091,3102,3359,3359,3361,3363,3365,3366,3404,3407,3417,3418,3419,3420,3421,3422,3423,3424,3425,3426,3427,3428,3429,3430,3431,3432,3433,3434,3435,3436,3437,3438,3441,3442,3443,3444,3445,3446,3451,3452,3453,3454,3455,3456,3457,3458,3459,3479,3481,3483,3485,3487,3490,3492,3494,3496,3498,3500,3502,3504,3506,3508,3510,3512,3515,3517,3519,3521,3523,3525,3527,3529,3531,3533,3535,3537,3539,3541,3543,3545,3547,3549,3551,3553,3560,3561,3562,3563,3564,3565,3566,3567,3568,3569,3570,3582,3584,3586,3588,3590,3593,3598,3600,3605,3608,3610,3612,3614,3616,3618,3620,3622,3624,3626,3628,3630,3632,3634,3636,3640,3642,3644,3646,3648,3650,3652,3654,3656,3658,3660,3662,3664,3668,3670,3672,3674,3676,3677,3679,3680,3682,3683,3686,3688,3690,3692,3696,3698,3700,3728,3729,3730,3731,3732,3733,3734,3735,3736,3737,3738,3739,3753,3754,3755,3756,3757,3758,3759,3760,3991,3992,4217,4399,4400,4401,4402,4403,4404,4405,4406,4407,4408,4409,4410,4411,4412,4413,4418,4419,4420,4421,4422,4423,4424,4425,4426,4427,4428,4429,4430,4431,4432,4433,4438,4439,4455,4456,4457,5466,5588,5589,5623,5624,5625,5646,5654,5655,6128,6129,6141,6200,6201,6202,6391,6405,6407,6409,6411,6413,6416,6418,6420,6422,6424,6426,6428,6430,6432,6434,6436,6438,6441,6443,6445,6447,6449,6451,6453,6455,6457,6459,6461,6463,6465,6467,6469,6471,6473,6475,6477,6479,6484,6486,6488,6490,6492,6494,6496,6499,6501,6503,6505,6507,6510,6515,6517,6519,6521,6523,6525,6527,6529,6531,6533,6535,6537,6539,6541,6543,6545,6547,6549,6551,6553,6555,6557,6559,6561,6563,6565,6568,6570,6572,6574,6576,6578,6582,6584,6586,6588,6590,6593,6595,6597,6599,6601,6603,6605,6607,6609,6612,6614,6616,6618,6625,6626,6627,6633,6785,6787,6789,6791,6793,6795,6797,6799,6801,6803,6805,6807,6809,6811,6813,6815,6817,6819,6821,6823,6825,6827,6829,6831,6833,6835,6837,6839,6841,6843,6845,6847,6849,6851,6853,6855,6857,6859,6861,6863,6868,6880,6885,6887,6923,6925,6966,6997,7057,7058,7059,7060,7061,7062,7063,7064,7065,7066,7067,7068,7069,7070,7119,7120,7121,7122,7123,7124,7125,7126,7127,7128,7132,7258,7260,7262,7264,7266,7268,7270,7272,7274,7276,7278,7280,7282,7284,7286,7288,7290,7292,7294,7296,7298,7300,7302,7304,7306,7308,7310,7312,7314,7316,7318,7320,7322,7324,7326,7328,7330,7332,7334,7336,7338,7340,7342,7344,7346,7348,7350,7352,7354,7356,7358,7360,7362,7364,7366,7368,7370,7558,7587,7588,7589,7590,7591,7592,7593,7594,7595,7596,7597,7598,7599,7600,7601,7602,7603,7604,7605,7606,7607,7608,7609,7610,7611,7612,7613,7614,7615,7616,7617,7618,7619,7620,7621,7622,7623,7624,7625,7626,7627,7628,7629,7630,7631,7632,7633,7634,7635,7636,7637,7638,7639,7640,7641,7642,7643,7644,7645,24100,26729,26730,26731,26732,26733,26734,26735,26736,26737,26738,26739,26740,26741,26742,26743,26744,26745,26746,26747,26748,26749,26750,26751,26752,26753,26754,26755,26756,26757,26758,26759,26760,26766,26767,26768,26769,26770,26771,26772,26773,26774,26775,26776,26777,26778,26779,26780,26781,26782,26783,26784,26785,26786,26787,26791,26792,26793,26794,26795,26796,26797,26798,26799,26801,26802,26803,26811,26812,26813,26814,26815,26819,26820,26821,26822,26825,26826,26830,26831,26832,26833,26836,26837,26841,26842,26843,26844,26847,26848,26849,26850,26851,26852,26853,26854,26855,26856,26857,26858,26859,26860,26861,26862,26863,26864,26865,26866,26867,26868,26869,26870,32001,32002,32003,32005,32006,32007,32008,32009,32010,32011,32012,32013,32014,32015,32016,32017,32018,32019,32020,32021,32022,32023,32024,32025,32026,32027,32028,32029,32030,32031,32033,32034,32035,32036,32037,32038,32039,32040,32041,32042,32043,32044,32045,32046,32047,32048,32049,32050,32051,32052,32053,32054,32055,32056,32057,32058,32064,32065,32066,32067,32074,32075,32076,32077,32099,32164,32165,32166,32167,32664,32665,32666,32667,65061,102120,102121,102629,102630,102631,102632,102633,102634,102635,102636,102637,102638,102639,102640,102641,102642,102643,102644,102645,102646,102648,102649,102650,102651,102652,102653,102654,102655,102656,102657,102658,102659,102660,102661,102662,102663,102664,102665,102666,102667,102668,102669,102670,102671,102672,102673,102674,102675,102676,102677,102678,102679,102680,102681,102682,102683,102684,102685,102686,102687,102688,102689,102690,102691,102692,102693,102694,102695,102696,102697,102698,102700,102704,102707,102708,102709,102710,102711,102712,102713,102714,102715,102716,102717,102718,102719,102720,102721,102722,102723,102724,102725,102726,102727,102728,102729,102730,102733,102734,102735,102736,102737,102738,102739,102740,102741,102742,102743,102744,102745,102746,102747,102748,102749,102750,102751,102752,102753,102754,102755,102756,102757,102758,102761,102766],J=[5614,5702,6130,6131,6132,6358,6359,6360],Q=[115700,4326];function k(o){return G.includes(o)?"feet":"meters"}function X(o,i){return typeof o=="number"?J.includes(o)?"feet":"meters":k(i)}function tt(o,i){return Q.includes(o)||i===4326?"ellipsoidal":"gravity-related-height"}let P=class extends q{get isAdvanced(){return!1}getInfo(){const{horizontalWKID:i,verticalWKID:a}=this;let n=i,p=a;const l=this;if(l.type===4){const{properties:j}=l;n=4326,p=j.verticalWKID}return{heightModel:tt(n,p),heightUnit:X(p,n),horizontalUnit:k(n)}}};t([e({json:{write:!0}})],P.prototype,"affineTransformations",void 0),t([e({json:{write:!0}})],P.prototype,"focalLength",void 0),t([e({json:{write:!0}})],P.prototype,"principalOffsetPoint",void 0),t([e({json:{write:!0}})],P.prototype,"radialDistortionCoefficients",void 0),t([e({json:{write:!0}})],P.prototype,"tangentialDistortionCoefficients",void 0),t([e({json:{write:!0}})],P.prototype,"horizontalWKID",void 0),t([e({json:{write:!0}})],P.prototype,"verticalWKID",void 0),t([e({json:{write:!0}})],P.prototype,"x",void 0),t([e({json:{write:!0}})],P.prototype,"y",void 0),t([e({json:{write:!0}})],P.prototype,"z",void 0),t([e({json:{write:!0}})],P.prototype,"type",void 0),P=t([x("esri.layers.orientedImagery.core.CameraOrientation")],P);const F=P;let h=class extends M(A(F)){constructor(){super(...arguments),this.type=1}get isAdvanced(){const{affineTransformations:i,focalLength:a,principalOffsetPoint:n,radialDistortionCoefficients:p,tangentialDistortionCoefficients:l}=this;return(i==null?void 0:i.length)>1||!Number.isNaN(a)||(n==null?void 0:n.length)>1||(p==null?void 0:p.length)>1||(l==null?void 0:l.length)>1}toString(){const{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,heading:N,pitch:w,roll:D,affineTransformations:u,focalLength:b,principalOffsetPoint:f,radialDistortionCoefficients:d,tangentialDistortionCoefficients:m}=this,y=[i,a,n,p,l,j,N,w,D];return this.isAdvanced&&(u==null||u.forEach(r=>y.push(r)),y.push(b),f==null||f.forEach(r=>y.push(r)),d==null||d.forEach(r=>y.push(r)),m==null||m.forEach(r=>y.push(r))),y.map(r=>Number.isNaN(r)?"":r).join("|")}};t([e({json:{write:!0}})],h.prototype,"type",void 0),t([e({type:[Number],json:{write:!0}})],h.prototype,"affineTransformations",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"focalLength",void 0),t([e({type:[Number],json:{write:!0}})],h.prototype,"principalOffsetPoint",void 0),t([e({type:[Number],json:{write:!0}})],h.prototype,"radialDistortionCoefficients",void 0),t([e({type:[Number],json:{write:!0}})],h.prototype,"tangentialDistortionCoefficients",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"heading",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"pitch",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"roll",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"horizontalWKID",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"verticalWKID",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"x",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"y",void 0),t([e({type:Number,json:{write:!0}})],h.prototype,"z",void 0),h=t([x("esri.layers.orientedImagery.core.CameraOrientationHPR")],h);const et=h;let v=class extends M(A(F)){constructor(){super(...arguments),this.type=2}get isAdvanced(){const{affineTransformations:i,focalLength:a,principalOffsetPoint:n,radialDistortionCoefficients:p,tangentialDistortionCoefficients:l}=this;return(i==null?void 0:i.length)>1||!Number.isNaN(a)||(n==null?void 0:n.length)>1||(p==null?void 0:p.length)>1||(l==null?void 0:l.length)>1}toString(){const{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,omega:N,phi:w,kappa:D,affineTransformations:u,focalLength:b,principalOffsetPoint:f,radialDistortionCoefficients:d,tangentialDistortionCoefficients:m}=this,y=[i,a,n,p,l,j,N,w,D];return this.isAdvanced&&(u==null||u.forEach(r=>y.push(r)),y.push(b),f==null||f.forEach(r=>y.push(r)),d==null||d.forEach(r=>y.push(r)),m==null||m.forEach(r=>y.push(r))),y.map(r=>isNaN(r)?"":r).join("|")}};t([e({json:{write:!0}})],v.prototype,"type",void 0),t([e({type:[Number],json:{write:!0}})],v.prototype,"affineTransformations",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"focalLength",void 0),t([e({type:[Number],json:{write:!0}})],v.prototype,"principalOffsetPoint",void 0),t([e({type:[Number],json:{write:!0}})],v.prototype,"radialDistortionCoefficients",void 0),t([e({type:[Number],json:{write:!0}})],v.prototype,"tangentialDistortionCoefficients",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"omega",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"phi",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"kappa",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"horizontalWKID",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"verticalWKID",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"x",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"y",void 0),t([e({type:Number,json:{write:!0}})],v.prototype,"z",void 0),v=t([x("esri.layers.orientedImagery.core.CameraOrientationOPK")],v);const ot=v;let g=class extends M(A(F)){constructor(){super(...arguments),this.type=3}get isAdvanced(){const{affineTransformations:i,focalLength:a,principalOffsetPoint:n,radialDistortionCoefficients:p,tangentialDistortionCoefficients:l}=this;return(i==null?void 0:i.length)>1||!Number.isNaN(a)||(n==null?void 0:n.length)>1||(p==null?void 0:p.length)>1||(l==null?void 0:l.length)>1}toString(){const{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,yaw:N,pitch:w,roll:D,affineTransformations:u,focalLength:b,principalOffsetPoint:f,radialDistortionCoefficients:d,tangentialDistortionCoefficients:m}=this,y=[i,a,n,p,l,j,N,w,D];return this.isAdvanced&&(u==null||u.forEach(r=>y.push(r)),y.push(b),f==null||f.forEach(r=>y.push(r)),f==null||f.forEach(r=>y.push(r)),d==null||d.forEach(r=>y.push(r)),m==null||m.forEach(r=>y.push(r))),y.map(r=>Number.isNaN(r)?"":r).join("|")}};t([e({json:{write:!0}})],g.prototype,"type",void 0),t([e({type:[Number],json:{write:!0}})],g.prototype,"affineTransformations",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"focalLength",void 0),t([e({type:[Number],json:{write:!0}})],g.prototype,"principalOffsetPoint",void 0),t([e({type:[Number],json:{write:!0}})],g.prototype,"radialDistortionCoefficients",void 0),t([e({type:[Number],json:{write:!0}})],g.prototype,"tangentialDistortionCoefficients",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"yaw",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"pitch",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"roll",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"horizontalWKID",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"verticalWKID",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"x",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"y",void 0),t([e({type:Number,json:{write:!0}})],g.prototype,"z",void 0),g=t([x("esri.layers.orientedImagery.core.CameraOrientationYPR")],g);const it=g;let O=class extends Y{constructor(){super(...arguments),this.url=null}};t([e({type:Number,json:{write:!0}})],O.prototype,"lod",void 0),t([e({type:String,json:{write:!0}})],O.prototype,"rasterFunction",void 0),t([e({type:String,json:{write:!0}})],O.prototype,"url",void 0),O=t([x("esri.layers.orientedImagery.core.ElevationSourceDefinitions.ElevationSource")],O);let E=class extends Y{};t([e({type:Number,json:{write:!0}})],E.prototype,"constantElevation",void 0),E=t([x("esri.layers.orientedImagery.cor.ElevationSourceDefinitions.ConstantElevation")],E);const rt=o=>"constantElevation"in o;var I;(function(o){o[o.HPR=1]="HPR",o[o.OPK=2]="OPK",o[o.YPR=3]="YPR",o[o.LTP=4]="LTP"})(I||(I={}));function nt(o,i,a){return i&&(o=`${i}${o}`),a&&(o+=`${a}`),o}function at(o,i,a){let{url:n}=o;return n?(n=nt(n,i,a),new O({...o,url:n})):null}function st(o,i,a){return o&&(rt(o)?new E(o):at(o,i,a))}const R=new V({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),H=new V({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique","":null}),U=new Map;U.set(`${I.OPK}`,{desc:"Using Omega Phi Kappa",constructor:ot}),U.set(`${I.HPR}`,{desc:"Using Heading, Pitch and Roll",constructor:et}),U.set(`${I.YPR}`,{desc:"Using Yaw, Pitch and Roll",constructor:it});const W=new Map;function pt(o){const[i,a,n,p,l,j,N,w,D,u,b,f,d,m,y,r,$,S,C,z,K,L,T]=o;return{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,omega:N,phi:w,kappa:D,affineTransformations:[u,b,f,d,m,y],focalLength:r,principalOffsetPoint:[$,S],radialDistortionCoefficients:[C,z,K],tangentialDistortionCoefficients:[L,T]}}function lt(o){const[i,a,n,p,l,j,N,w,D,u,b,f,d,m,y,r,$,S,C,z,K,L,T]=o;return{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,heading:N,pitch:w,roll:D,affineTransformations:[u,b,f,d,m,y],focalLength:r,principalOffsetPoint:[$,S],radialDistortionCoefficients:[C,z,K],tangentialDistortionCoefficients:[L,T]}}function yt(o){const[i,a,n,p,l,j,N,w,D,u,b,f,d,m,y,r,$,S,C,z,K,L,T]=o;return{type:i,horizontalWKID:a,verticalWKID:n,x:p,y:l,z:j,yaw:N,pitch:w,roll:D,affineTransformations:[u,b,f,d,m,y],focalLength:r,principalOffsetPoint:[$,S],radialDistortionCoefficients:[C,z,K],tangentialDistortionCoefficients:[L,T]}}function ct(o){const[i,a,n,p,l,j,...N]=o,w=W.get(j);return w?{type:i,latitude:a,longitude:n,ellipsoidRadius:p,squaredEccentricity:l,properties:w([j,"",...N])}:null}W.set(`${I.HPR}`,lt),W.set(`${I.YPR}`,yt),W.set(`${I.OPK}`,pt),W.set(`${I.LTP}`,ct);function c(o,i,a){return{name:`orientedImageryProperties.${o}`,write:!i||{target:`orientedImageryProperties.${o}`,writer:i},origins:{service:{name:`orientedImageryInfo.orientedImageryProperties.${o}`,write:i,read:a}}}}let s=class extends Z{constructor(){super(...arguments),this.cameraHeading=null,this.cameraHeight=null,this.cameraPitch=null,this.cameraRoll=null,this.coveragePercent=null,this.demPathPrefix=null,this.demPathSuffix=null,this.depthImagePathPrefix=null,this.depthImagePathSuffix=null,this.elevationSource=null,this.farDistance=null,this.geometryType="point",this.horizontalFieldOfView=null,this.horizontalMeasurementUnit=null,this.imagePathPrefix=null,this.imagePathSuffix=null,this.imageRotation=null,this.maximumDistance=null,this.nearDistance=null,this.operationalLayerType="OrientedImageryLayer",this.orientationAccuracy=null,this.orientedImageryType=null,this.type="oriented-imagery",this.timeIntervalUnit=null,this.verticalFieldOfView=null,this.verticalMeasurementUnit=null,this.videoPathPrefix=null,this.videoPathSuffix=null}get effectiveElevationSource(){const{elevationSource:o,demPathPrefix:i,demPathSuffix:a}=this;return st(o,i,a)}findFirstValidLayerId(o){var i,a;return(a=(i=o.layers)==null?void 0:i.find(n=>n.type==="Oriented Imagery Layer"))==null?void 0:a.id}_verifySource(){if(super._verifySource(),this.geometryType!=="point")throw new B("oriented-imagery-layer:invalid-geometry-type","OrientedImageryLayer only supports point geometry type")}};t([e({type:Number,json:c("cameraHeading")})],s.prototype,"cameraHeading",void 0),t([e({type:Number,json:c("cameraHeight")})],s.prototype,"cameraHeight",void 0),t([e({type:Number,json:c("cameraPitch")})],s.prototype,"cameraPitch",void 0),t([e({type:Number,json:c("cameraRoll")})],s.prototype,"cameraRoll",void 0),t([e({type:Number,json:c("coveragePercent")})],s.prototype,"coveragePercent",void 0),t([e({type:String,json:c("demPathPrefix")})],s.prototype,"demPathPrefix",void 0),t([e({type:String,json:c("demPathSuffix")})],s.prototype,"demPathSuffix",void 0),t([e({type:String,json:c("depthImagePathPrefix")})],s.prototype,"depthImagePathPrefix",void 0),t([e({type:String,json:c("depthImagePathSuffix")})],s.prototype,"depthImagePathSuffix",void 0),t([e({type:Object,json:c("elevationSource")})],s.prototype,"elevationSource",void 0),t([e()],s.prototype,"effectiveElevationSource",null),t([e({type:Number,json:c("farDistance")})],s.prototype,"farDistance",void 0),t([e({json:{write:!0}})],s.prototype,"geometryType",void 0),t([e({type:Number,json:c("horizontalFieldOfView")})],s.prototype,"horizontalFieldOfView",void 0),t([e({type:String,json:c("horizontalMeasurementUnit")})],s.prototype,"horizontalMeasurementUnit",void 0),t([e({type:String,json:c("imagePathPrefix")})],s.prototype,"imagePathPrefix",void 0),t([e({type:String,json:c("imagePathSuffix")})],s.prototype,"imagePathSuffix",void 0),t([e({type:Number,json:c("imageRotation")})],s.prototype,"imageRotation",void 0),t([e({type:Number,json:c("maximumDistance")})],s.prototype,"maximumDistance",void 0),t([e({type:Number,json:c("nearDistance")})],s.prototype,"nearDistance",void 0),t([e({type:["OrientedImageryLayer"]})],s.prototype,"operationalLayerType",void 0),t([e({json:c("orientationAccuracy",(o,i)=>{o&&(i.orientationAccuracy=o.join(","))})}),_(o=>o?o.trim().split(",").map(Number):null)],s.prototype,"orientationAccuracy",void 0),t([e({json:{...c("orientedImageryType",H.write,H.read),type:H.apiValues}})],s.prototype,"orientedImageryType",void 0),t([e({json:{read:!1},value:"oriented-imagery",readOnly:!0})],s.prototype,"type",void 0),t([e({json:{...c("timeIntervalUnit",R.write,R.read),type:R.apiValues}})],s.prototype,"timeIntervalUnit",void 0),t([e({type:Number,json:c("verticalFieldOfView")})],s.prototype,"verticalFieldOfView",void 0),t([e({json:{...c("verticalMeasurementUnit"),type:new V({Feet:"feet",Meter:"meter"}).apiValues}})],s.prototype,"verticalMeasurementUnit",void 0),t([e({type:String,json:c("videoPathPrefix")})],s.prototype,"videoPathPrefix",void 0),t([e({type:String,json:c("videoPathSuffix")})],s.prototype,"videoPathSuffix",void 0),s=t([x("esri.layers.OrientedImageryLayer")],s);const Lt=s;export{Lt as default}; diff --git a/dist/assets/PBFDecoderWorker--NqrOA1Y.js b/dist/assets/PBFDecoderWorker--NqrOA1Y.js deleted file mode 100644 index 2d86b0d..0000000 --- a/dist/assets/PBFDecoderWorker--NqrOA1Y.js +++ /dev/null @@ -1 +0,0 @@ -import{k3 as d,dB as c,ar as p,dw as f,i_ as y,eT as _,k4 as m,k5 as g,k6 as P}from"./index-J0iiHjMT.js";import{t as C}from"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";function b(o,e){return e}function l(o,e,t,r){switch(t){case 0:return h(o,e+r,0);case 1:return o.originPosition==="lowerLeft"?h(o,e+r,1):v(o,e+r,1)}}function u(o,e,t,r){return t===2?h(o,e,2):l(o,e,t,r)}function G(o,e,t,r){return t===2?h(o,e,3):l(o,e,t,r)}function k(o,e,t,r){return t===3?h(o,e,3):u(o,e,t,r)}function h({translate:o,scale:e},t,r){return o[r]+t*e[r]}function v({translate:o,scale:e},t,r){return o[r]-t*e[r]}class M{constructor(e){this._options=e,this.geometryTypes=["point","multipoint","polyline","polygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=b,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return new d}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const t=c(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(t!=null)for(const r of e.features)t(r.geometry)}createSpatialReference(){return new p}addField(e,t){e.fields.push(f.fromJSON(t));const r=e.fields.map(s=>s.name);this._attributesConstructor=function(){for(const s of r)this[s]=null}}addFeature(e,t){const r=this._options.maxStringAttributeLength??0;if(r>0)for(const s in t.attributes){const i=t.attributes[s];typeof i=="string"&&i.length>r&&(t.attributes[s]="")}e.features.push(t)}addQueryGeometry(e,t){const{queryGeometry:r,queryGeometryType:s}=t,i=y(r.clone(),r,!1,!1,this._transform),a=_(i,s,!1,!1);let n=null;switch(s){case"esriGeometryPoint":n="point";break;case"esriGeometryPolygon":n="polygon";break;case"esriGeometryPolyline":n="polyline";break;case"esriGeometryMultipoint":n="multipoint"}a.type=n,e.queryGeometryType=s,e.queryGeometry=a}prepareFeatures(e){switch(this._transform=e.transform??null,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++,e.geometryType){case"point":this.addCoordinate=(t,r,s)=>this.addCoordinatePoint(t,r,s),this.createGeometry=t=>this.createPointGeometry(t);break;case"polygon":this.addCoordinate=(t,r,s)=>this._addCoordinatePolygon(t,r,s),this.createGeometry=t=>this._createPolygonGeometry(t);break;case"polyline":this.addCoordinate=(t,r,s)=>this._addCoordinatePolyline(t,r,s),this.createGeometry=t=>this._createPolylineGeometry(t);break;case"multipoint":this.addCoordinate=(t,r,s)=>this._addCoordinateMultipoint(t,r,s),this.createGeometry=t=>this._createMultipointGeometry(t);break;case"mesh":case"extent":break;default:m(e.geometryType)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,new g(P(),null,new this._attributesConstructor)}allocateCoordinates(){const e=this._lengths.reduce((t,r)=>t+r,0);this._coordinateBuffer=new Float64Array(e*this._vertexDimension),this._coordinateBufferPtr=0}addLength(e,t){this._lengths.length===0&&(this._toAddInCurrentPath=t),this._lengths.push(t)}createPointGeometry(e){const t={type:"point",x:0,y:0,spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM};return t.hasZ&&(t.z=0),t.hasM&&(t.m=0),t}addCoordinatePoint(e,t,r){const s=this._transform?this._applyTransform(this._transform,t,r,0):t;if(s!=null)switch(r){case 0:e.x=s;break;case 1:e.y=s;break;case 2:e.hasZ?e.z=s:e.m=s;break;case 3:e.m=s}}_transformPathLikeValue(e,t){let r=0;return t<=1&&(r=this._previousCoordinate[t],this._previousCoordinate[t]+=e),this._transform?this._applyTransform(this._transform,e,t,r):e}_addCoordinatePolyline(e,t,r){this._dehydratedAddPointsCoordinate(e.paths,t,r)}_addCoordinatePolygon(e,t,r){this._dehydratedAddPointsCoordinate(e.rings,t,r)}_addCoordinateMultipoint(e,t,r){r===0&&e.points.push([]);const s=this._transformPathLikeValue(t,r);e.points[e.points.length-1].push(s)}_createPolygonGeometry(e){return{type:"polygon",rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{type:"polyline",paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{type:"multipoint",points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,r){r===0&&this._toAddInCurrentPath--==0&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(t,r),i=e[e.length-1],a=this._coordinateBuffer;if(a){if(r===0){const n=this._coordinateBufferPtr*Float64Array.BYTES_PER_ELEMENT;i.push(new Float64Array(a.buffer,n,this._vertexDimension))}a[this._coordinateBufferPtr++]=s}}_deriveApplyTransform(e){const{hasZ:t,hasM:r}=e;return t&&r?k:t?u:r?G:l}}class T{_parseFeatureQuery(e){var s;const t=C(e.buffer,new M(e.options)),r={...t,spatialReference:(s=t.spatialReference)==null?void 0:s.toJSON(),fields:t.fields?t.fields.map(i=>i.toJSON()):void 0};return Promise.resolve(r)}}function A(){return new T}export{A as default}; diff --git a/dist/assets/PBFDecoderWorker-mLYHZi4e.js b/dist/assets/PBFDecoderWorker-mLYHZi4e.js new file mode 100644 index 0000000..5e35a36 --- /dev/null +++ b/dist/assets/PBFDecoderWorker-mLYHZi4e.js @@ -0,0 +1 @@ +import{ka as d,j2 as c,d2 as p,es as f,j4 as y,eO as _,kb as m,kc as g,kd as P,ke as C}from"./index-pCX-0tJH.js";function b(o,e){return e}function l(o,e,t,r){switch(t){case 0:return h(o,e+r,0);case 1:return o.originPosition==="lowerLeft"?h(o,e+r,1):v(o,e+r,1)}}function u(o,e,t,r){return t===2?h(o,e,2):l(o,e,t,r)}function G(o,e,t,r){return t===2?h(o,e,3):l(o,e,t,r)}function k(o,e,t,r){return t===3?h(o,e,3):u(o,e,t,r)}function h({translate:o,scale:e},t,r){return o[r]+t*e[r]}function v({translate:o,scale:e},t,r){return o[r]-t*e[r]}class M{constructor(e){this._options=e,this.geometryTypes=["point","multipoint","polyline","polygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=b,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return new d}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const t=c(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(t!=null)for(const r of e.features)t(r.geometry)}createSpatialReference(){return new p}addField(e,t){e.fields.push(f.fromJSON(t));const r=e.fields.map(s=>s.name);this._attributesConstructor=function(){for(const s of r)this[s]=null}}addFeature(e,t){const r=this._options.maxStringAttributeLength??0;if(r>0)for(const s in t.attributes){const n=t.attributes[s];typeof n=="string"&&n.length>r&&(t.attributes[s]="")}e.features.push(t)}addQueryGeometry(e,t){const{queryGeometry:r,queryGeometryType:s}=t,n=y(r.clone(),r,!1,!1,this._transform),a=_(n,s,!1,!1);let i=null;switch(s){case"esriGeometryPoint":i="point";break;case"esriGeometryPolygon":i="polygon";break;case"esriGeometryPolyline":i="polyline";break;case"esriGeometryMultipoint":i="multipoint"}a.type=i,e.queryGeometryType=s,e.queryGeometry=a}prepareFeatures(e){switch(this._transform=e.transform??null,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++,e.geometryType){case"point":this.addCoordinate=(t,r,s)=>this.addCoordinatePoint(t,r,s),this.createGeometry=t=>this.createPointGeometry(t);break;case"polygon":this.addCoordinate=(t,r,s)=>this._addCoordinatePolygon(t,r,s),this.createGeometry=t=>this._createPolygonGeometry(t);break;case"polyline":this.addCoordinate=(t,r,s)=>this._addCoordinatePolyline(t,r,s),this.createGeometry=t=>this._createPolylineGeometry(t);break;case"multipoint":this.addCoordinate=(t,r,s)=>this._addCoordinateMultipoint(t,r,s),this.createGeometry=t=>this._createMultipointGeometry(t);break;case"mesh":case"extent":break;default:m(e.geometryType)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,new g(P(),null,new this._attributesConstructor)}allocateCoordinates(){const e=this._lengths.reduce((t,r)=>t+r,0);this._coordinateBuffer=new Float64Array(e*this._vertexDimension),this._coordinateBufferPtr=0}addLength(e,t){this._lengths.length===0&&(this._toAddInCurrentPath=t),this._lengths.push(t)}createPointGeometry(e){const t={type:"point",x:0,y:0,spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM};return t.hasZ&&(t.z=0),t.hasM&&(t.m=0),t}addCoordinatePoint(e,t,r){const s=this._transform?this._applyTransform(this._transform,t,r,0):t;if(s!=null)switch(r){case 0:e.x=s;break;case 1:e.y=s;break;case 2:e.hasZ?e.z=s:e.m=s;break;case 3:e.m=s}}_transformPathLikeValue(e,t){let r=0;return t<=1&&(r=this._previousCoordinate[t],this._previousCoordinate[t]+=e),this._transform?this._applyTransform(this._transform,e,t,r):e}_addCoordinatePolyline(e,t,r){this._dehydratedAddPointsCoordinate(e.paths,t,r)}_addCoordinatePolygon(e,t,r){this._dehydratedAddPointsCoordinate(e.rings,t,r)}_addCoordinateMultipoint(e,t,r){r===0&&e.points.push([]);const s=this._transformPathLikeValue(t,r);e.points[e.points.length-1].push(s)}_createPolygonGeometry(e){return{type:"polygon",rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{type:"polyline",paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{type:"multipoint",points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,r){r===0&&this._toAddInCurrentPath--==0&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(t,r),n=e[e.length-1],a=this._coordinateBuffer;if(a){if(r===0){const i=this._coordinateBufferPtr*Float64Array.BYTES_PER_ELEMENT;n.push(new Float64Array(a.buffer,i,this._vertexDimension))}a[this._coordinateBufferPtr++]=s}}_deriveApplyTransform(e){const{hasZ:t,hasM:r}=e;return t&&r?k:t?u:r?G:l}}class R{_parseFeatureQuery(e){var s;const t=C(e.buffer,new M(e.options)),r={...t,spatialReference:(s=t.spatialReference)==null?void 0:s.toJSON(),fields:t.fields?t.fields.map(n=>n.toJSON()):void 0};return Promise.resolve(r)}}function x(){return new R}export{x as default}; diff --git a/dist/assets/Pipeline--6jAENf8.js b/dist/assets/Pipeline--6jAENf8.js deleted file mode 100644 index 300e354..0000000 --- a/dist/assets/Pipeline--6jAENf8.js +++ /dev/null @@ -1,22 +0,0 @@ -import{de as Ye,Z as ae,c4 as ye,vd as Ee,dJ as b,ve as Ss,e_ as D,eT as $e,dy as ws,vf as Ts,vg as Fs,iZ as Xe,eh as _t,K as ke,vh as As,gc as Cs,ol as ss,eQ as H,gd as Ms,l4 as oe,vi as Es,i_ as rs,E as V,eZ as mt,r0 as is,vj as as,vk as $s,bH as yt,nW as He,e3 as ns,jP as ks,k as It,ao as Pe,dv as os,ev as Us,vl as Rs,ca as Ds,vm as Bs,vn as lt,s as P,f as Ie,bW as Os,e as k,c as Je,uA as qs,mo as hs,y as O,p as xt,fv as Ls,ge as zs,qQ as ct,vo as us,vp as ds,uU as Gs,vq as X,kk as Ue,kl as Re,bm as Ps,ar as ie,r8 as bt,vr as js,ej as ls,mL as re,l as cs,dT as vt,e4 as gs,vs as Ns,F as Qs,d as Ve,eR as Ys,w as De,pa as ps,ae as Xs,u1 as Hs,vt as Vs,vu as Zs,al as Js,uN as Ws,e$ as Ks}from"./index-J0iiHjMT.js";import{j as xe,x as fs,W as Dt}from"./QueryEngine-8tLWlkSE.js";import{t as St,o as er}from"./StreamFeatureManager-QrKJ84_c.js";import{f as tr}from"./quickselect-UFB0jJTZ.js";import{m as Be,n as Bt,b as Ot}from"./TimeOnly-ljWtUK7N.js";import{a as sr,l as rr}from"./labelPoint-ysDT9nFH.js";import{v as qt}from"./ogcFeatureUtils-dtzP0u64.js";import{d as ir,c as Lt}from"./query-rG0aX6cE.js";import{r as ar}from"./pbf-o0zzptPp.js";import{b as nr,h as or}from"./pbfQueryUtils-pWizwTQZ.js";import{createConnection as hr}from"./createConnection-4ppGVnSc.js";import{V as ur,W as dr,S as lr,a as zt,Q as cr,R as gr,c as j}from"./definitions-DqQMJYPH.js";import{E as Se,S as Oe}from"./enums-uQoFEhYh.js";import"./number-sTjsTbdA.js";import{X as pr,b as Ze,Y as je}from"./geohashUtils-U0jvYCSY.js";function fr(i){return i==="heatmap"?Ye(()=>import("./HeatmapProcessor-QI9jD0nx.js"),__vite__mapDeps([0,1,2,3,4])):Ye(()=>import("./SymbolProcessor-pXDjnfSh.js").then(e=>e.S),__vite__mapDeps([5,1,2,6,7,8,3,9,10,11,4,12,13,14]))}function be(i,e){if(!(this instanceof be))return new be(i,e);this._maxEntries=Math.max(4,i||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&(typeof e=="function"?this.toBBox=e:this._initFormat(e)),this.clear()}function _r(i,e,t){if(!t)return e.indexOf(i);for(var s=0;s=i.minX&&e.maxY>=i.minY}function ge(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function jt(i,e,t,s,r){for(var a,n=[e,t];n.length;)(t=n.pop())-(e=n.pop())<=s||(a=e+Math.ceil((t-e)/s/2)*s,tr(i,a,e,t,r),n.push(e,a,a,t))}be.prototype={all:function(){return this._all(this.data,[])},search:function(i){var e=this.data,t=[],s=this.toBBox;if(!Le(i,e))return t;for(var r,a,n,o,h=[];e;){for(r=0,a=e.children.length;r=0&&a[e].children.length>this._maxEntries;)this._split(a,e),e--;this._adjustParentBBoxes(r,a,e)},_split:function(i,e){var t=i[e],s=t.children.length,r=this._minEntries;this._chooseSplitAxis(t,r,s);var a=this._chooseSplitIndex(t,r,s),n=ge(t.children.splice(a,t.children.length-a));n.height=t.height,n.leaf=t.leaf,de(t,this.toBBox),de(n,this.toBBox),e?i[e-1].children.push(n):this._splitRoot(t,n)},_splitRoot:function(i,e){this.data=ge([i,e]),this.data.height=i.height+1,this.data.leaf=!1,de(this.data,this.toBBox)},_chooseSplitIndex:function(i,e,t){var s,r,a,n,o,h,u,d;for(h=u=1/0,s=e;s<=t-e;s++)n=yr(r=Ae(i,0,s,this.toBBox),a=Ae(i,s,t,this.toBBox)),o=et(r)+et(a),n=e;r--)a=i.children[r],Ce(h,i.leaf?n(a):a),u+=qe(h);return u},_adjustParentBBoxes:function(i,e,t){for(var s=t;s>=0;s--)Ce(e[s],i)},_condense:function(i){for(var e,t=i.length-1;t>=0;t--)i[t].children.length===0?t>0?(e=i[t-1].children).splice(e.indexOf(i[t]),1):this.clear():de(i[t],this.toBBox)},_initFormat:function(i){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(i[0])),this.compareMinY=new Function("a","b",e.join(i[1])),this.toBBox=new Function("a","return {minX: a"+i[0]+", minY: a"+i[1]+", maxX: a"+i[2]+", maxY: a"+i[3]+"};")}};function Ir(i,e,t){var r;if(i==null)return null;const s=e.readArcadeFeature();e.contextTimeZone=(r=t.$view)==null?void 0:r.timeZone;try{return i.evaluate({...t,$feature:s},i.services)}catch(a){return ae.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",a),null}}let wt=class{constructor(e,t){this._canCacheExpressionValue=!1,this._sourceInfo=e,this._storage=t,this._bitsets={computed:t.getBitset(t.createBitset())}}get storage(){return this._storage}invalidate(){this._bitsets.computed.clear()}async updateSchema(e,t){const s=ye(this._schema,t);if(this._schema=t,!t||s==null||!Ee(s,"attributes"))return;b("esri-2d-update-debug")&&console.debug("Applying Update - Store:",s),this._bitsets.computed.clear(),e.targets[t.name]=!0;const r=t.attributes,a=[],n=[];for(const o in r){const h=r[o];switch(h.type){case"field":break;case"expression":a.push(this._createArcadeComputedField(h));break;case"label-expression":a.push(this._createLabelArcadeComputedField(h));break;case"statistic":n.push(h)}}this._computedFields=await Promise.all(a),this._canCacheExpressionValue=!this._computedFields.some(o=>o.type==="expression"&&o.expression!=null&&o.expression.referencesScale()),this._statisticFields=n}setComputedAttributes(e,t,s,r,a){const n=this._bitsets.computed;if(!this._canCacheExpressionValue||!n.has(s)){n.set(s);for(const o of this._computedFields){const h=this._evaluateField(t,o,r,a);switch(o.resultType){case"numeric":e.setComputedNumericAtIndex(s,o.fieldIndex,h);break;case"string":e.setComputedStringAtIndex(s,o.fieldIndex,h)}}}}async _createArcadeComputedField(e){const t=this._sourceInfo.spatialReference,s=this._sourceInfo.fieldsIndex;return{...e,expression:await Ss(e.valueExpression,t,s)}}async _createLabelArcadeComputedField(e){const t=this._sourceInfo.spatialReference,s=this._sourceInfo.fieldsIndex,{createLabelFunction:r}=await Ye(()=>import("./index-J0iiHjMT.js").then(n=>n.zG),__vite__mapDeps([1,2])),a=await r(e.label,s,t);return{...e,builder:a}}_evaluateField(e,t,s,r){switch(t.type){case"label-expression":{const a=e.readArcadeFeature();return t.builder.evaluate(a,r)||""}case"expression":{const{expression:a}=t;return Ir(a,e,{$view:{scale:s,timeZone:r}})}}}},_s=class Ne{static fromBuffer(e,t){return new Ne(e,t)}static create(e,t=4294967295){const s=new Uint32Array(Math.ceil(e/32));return new Ne(s,t)}constructor(e,t){this._mask=0,this._buf=e,this._mask=t}_getIndex(e){return Math.floor(e/32)}has(e){const t=this._mask&e;return!!(this._buf[this._getIndex(t)]&1<>>=1,r++}}countSet(){let e=0;return this.forEachSet(t=>{e++}),e}},we=0;const We=b("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],xr=We[0],br=We[1],vr=We[2],Sr=We[3],Tt=b("featurelayer-simplify-payload-size-factors")??[1,2,4],wr=Tt[0],Tr=Tt[1],Fr=Tt[2],Ar=b("featurelayer-simplify-mobile-factor")??2,Cr=b("esri-mobile");let ve=class{constructor(e,t){this.type="FeatureSetReader",this.arcadeDeclaredClass="esri.arcade.Feature",this.seen=!1,this.instance=0,this._tx=0,this._ty=0,this._sx=1,this._sy=1,this._deleted=null,this._joined=[],this._objectIdToIndex=null,this._contextTimeZone=null,this._level=0,this.instance=e,this._layerSchema=t}static createInstance(){return we++,we=we>65535?0:we,we}get isEmpty(){return this._deleted!=null&&this._deleted.countSet()===this.getSize()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}set level(e){this._level=e}getAreaSimplificationThreshold(e,t){let s=1;const r=Cr?Ar:1;t>4e6?s=Fr*r:t>1e6?s=Tr*r:t>5e5?s=wr*r:t>1e5&&(s=r);let a=0;e>4e3?a=Sr*s:e>2e3?a=vr*s:e>100?a=br:e>15&&(a=xr);let n=8;return this._level<4?n=1:this._level<5?n=2:this._level<6&&(n=4),a*n}createQuantizedExtrudedGeometry(e,t){return this.geometryType==="esriGeometryPolyline"?this._createQuantizedExtrudedLine(e,t):this._createQuantizedExtrudedQuad(e,t)}_createQuantizedExtrudedQuad(e,t){return new D([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createQuantizedExtrudedLine(e,t){return new D([2],[e-1,t+1,1,-1])}parseTimestampOffset(e){return e}setArcadeSpatialReference(e){this._arcadeSpatialReference=e}attachStorage(e){this._storage=e}getQuantizationTransform(){throw new Error("Unable to find transform for featureSet")}getStorage(){return this._storage}getComputedNumeric(e){return this.getComputedNumericAtIndex(0)}setComputedNumeric(e,t){return this.setComputedNumericAtIndex(t,0)}getComputedString(e){return this.getComputedStringAtIndex(0)}setComputedString(e,t){return this.setComputedStringAtIndex(0,t)}getComputedNumericAtIndex(e){return this._storage.getComputedNumericAtIndex(this.getDisplayId(),e)}setComputedNumericAtIndex(e,t){this._storage.setComputedNumericAtIndex(this.getDisplayId(),e,t)}getComputedStringAtIndex(e){return this._storage.getComputedStringAtIndex(this.getDisplayId(),e)}setComputedStringAtIndex(e,t){return this._storage.setComputedStringAtIndex(this.getDisplayId(),e,t)}transform(e,t,s,r){const a=this.copy();return a._tx+=e,a._ty+=t,a._sx*=s,a._sy*=r,a}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return typeof t=="string"?new Date(t).getTime():typeof t=="number"||t==null?t:null}readAttribute(e,t=!1){const s=this._readAttribute(e,t);if(s!==void 0)return s;for(const r of this._joined){r.setIndex(this.getIndex());const a=r._readAttribute(e,t);if(a!==void 0)return a}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const s=t._readAttributes();for(const r of Object.keys(s))e[r]=s[r]}return e}joinAttributes(e){this._joined.push(e)}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)}geometry(){const e=this.readHydratedGeometry(),t=$e(e,this.geometryType,this.hasZ,this.hasM),s=ws(t);return s&&(s.spatialReference=this._arcadeSpatialReference),s}autocastArcadeDate(e,t){return t&&t instanceof Date?this.isUnknownDateTimeField(e)?Be.unknownDateJSToArcadeDate(t):Be.dateJSAndZoneToArcadeDate(t,this.contextTimeZone??Ts):t}isUnknownDateTimeField(e){return this._layerSchema.fieldsIndex.getTimeZone(e)===Fs}field(e){let t=this.fields.get(e);if(t)switch(t.type){case"date-only":case"esriFieldTypeDateOnly":return Ot.fromReader(this.readAttribute(e,!1));case"time-only":case"esriFieldTypeTimeOnly":return Bt.fromReader(this.readAttribute(e,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return Be.fromReaderAsTimeStampOffset(this.readAttribute(e,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(e,this.readAttribute(e,!0));default:return this.readAttribute(e,!1)}for(const s of this._joined)if(s.setIndex(this.getIndex()),t=s.fields.get(e),t)switch(t.type){case"date-only":case"esriFieldTypeDateOnly":return Ot.fromReader(s._readAttribute(e,!1));case"time-only":case"esriFieldTypeTimeOnly":return Bt.fromReader(s._readAttribute(e,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return Be.fromReaderAsTimeStampOffset(s._readAttribute(e,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(e,s._readAttribute(e,!0));default:return this.readAttribute(e,!1)}throw new Error(`Field ${e} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map(e=>e.name)}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeature());const t=this.readLegacyFeature();if(!t)return JSON.stringify(null);const s={geometry:t.geometry,attributes:{...t.attributes??{}}};for(const r in s.attributes){const a=s.attributes[r];a instanceof Date&&(s.attributes[r]=a.getTime())}return JSON.stringify(s)}gdbVersion(){return null}fullSchema(){return this._layerSchema}castAsJson(e=null){var t;return{attributes:this._readAttributes(),geometry:(e==null?void 0:e.keepGeometryType)===!0?this.geometry():((t=this.geometry())==null?void 0:t.toJSON())??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}removeIds(e){if(this._objectIdToIndex==null){const s=new Map,r=this.getCursor();for(;r.next();){const a=r.getObjectId();Xe(a),s.set(a,r.getIndex())}this._objectIdToIndex=s}const t=this._objectIdToIndex;for(const s of e)t.has(s)&&this.removeAtIndex(t.get(s))}removeAtIndex(e){this._deleted==null&&(this._deleted=_s.create(this.getSize())),this._deleted.set(e)}readGeometryForDisplay(){return this.readUnquantizedGeometry(!0)}readLegacyGeometryForDisplay(){return this.readLegacyGeometry(!0)}*features(){const e=this.getCursor();for(;e.next();)yield e.readOptimizedFeature()}_getExists(){return this._deleted==null||!this._deleted.has(this.getIndex())}_computeCentroid(){if(this.geometryType!=="esriGeometryPolygon")return null;const e=this.readUnquantizedGeometry();if(!e||e.hasIndeterminateRingOrder)return null;const t=sr.fromOptimized(e,this.geometryType);t.yFactor*=-1;const s=rr(t);return s?(s[1]*=-1,new D([],s)):null}copyInto(e){e.seen=this.seen,e._storage=this._storage,e._arcadeSpatialReference=this._arcadeSpatialReference,e._joined=this._joined,e._tx=this._tx,e._ty=this._ty,e._sx=this._sx,e._sy=this._sy,e._deleted=this._deleted,e._objectIdToIndex=this._objectIdToIndex,e.contextTimeZone=this.contextTimeZone}},ms=class gt extends ve{static from(e,t){return new gt(e.copy(),t)}constructor(e,t){super(ve.createInstance(),e.fullSchema()),this._currentIndex=-1,this._reader=e,this._indices=t}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1>>16}function Fe(i){return 65535&i}const Ft={getObjectId:i=>i.getObjectId(),getAttributes:i=>i.readAttributes(),getAttribute:(i,e)=>i.readAttribute(e),getAttributeAsTimestamp:(i,e)=>i.readAttributeAsTimestamp(e),cloneWithGeometry:(i,e)=>i,getGeometry:i=>i.readHydratedGeometry(),getCentroid:(i,e)=>i.readCentroid()};let Mr=class extends wt{constructor(e,t,s){super(e,t),this.featureAdapter=Ft,this.events=new ke,this._featureSetsByInstance=new Map,this._objectIdToDisplayId=new Map,this._spatialIndexInvalid=!0,this._indexSearchCache=new St(50),this._index=be(9,r=>({minX:this._storage.getXMin(r),minY:this._storage.getYMin(r),maxX:this._storage.getXMax(r),maxY:this._storage.getYMax(r)})),this.mode=s}get storeStatistics(){let e=0,t=0,s=0;return this.forEach(r=>{const a=r.readGeometry();a&&(t+=a.isPoint?1:a.lengths.reduce((n,o)=>n+o,0),s+=a.isPoint?1:a.lengths.length,e+=1)}),{featureCount:e,vertexCount:t,ringCount:s}}hasInstance(e){return this._featureSetsByInstance.has(e)}onTileData(e,t,s){if(t.addOrUpdate==null)return t;if(t.addOrUpdate.attachStorage(this._storage),this.mode==="snapshot"){const a=t.addOrUpdate.getCursor();for(;a.next();){const n=a.getDisplayId();this.setComputedAttributes(this._storage,a,n,e.scale,s)}return t}this._featureSetsByInstance.set(t.addOrUpdate.instance,t.addOrUpdate);const r=t.addOrUpdate.getCursor();for(;r.next();)this._insertFeature(r,e.scale,s);return this._spatialIndexInvalid=!0,this.events.emit("changed"),t}search(e){this._rebuildIndex();const t=e.id,s=this._indexSearchCache.find(o=>o.tileId===t);if(s!=null)return s.readers;const r=new Map,a=this._searchIndex(e.bounds),n=[];for(const o of a){const h=this._storage.getInstanceId(o),u=Te(h),d=Fe(h);r.has(u)||r.set(u,[]),r.get(u).push(d)}return r.forEach((o,h)=>{const u=this._featureSetsByInstance.get(h);n.push(ms.from(u,o))}),this._indexSearchCache.enqueue({tileId:t,readers:n}),n}insert(e){const t=e.getCursor(),s=this._storage;for(;t.next();){const r=Qt(t.instance,t.getIndex()),a=t.getObjectId(),n=this._objectIdToDisplayId.get(a)??this._storage.createDisplayId();t.setDisplayId(n),s.setInstanceId(n,r),this._objectIdToDisplayId.set(a,n)}this._featureSetsByInstance.set(e.instance,e),this._spatialIndexInvalid=!0}remove(e){const t=this._objectIdToDisplayId.get(e);if(!t)return;const s=this._storage.getInstanceId(t),r=Fe(s),a=Te(s),n=this._featureSetsByInstance.get(a);this._objectIdToDisplayId.delete(e),this._storage.releaseDisplayId(t),n.removeAtIndex(r),n.isEmpty&&this._featureSetsByInstance.delete(a),this._spatialIndexInvalid=!0}forEach(e){this._objectIdToDisplayId.forEach(t=>{const s=this._storage.getInstanceId(t),r=this._lookupFeature(s);e(r)})}forEachUnsafe(e){this._objectIdToDisplayId.forEach(t=>{const s=this._storage.getInstanceId(t),r=Te(s),a=Fe(s),n=this._getFeatureSet(r);n.setIndex(a),e(n)})}forEachInBounds(e,t){const s=this._searchIndex(e);for(const r of s)t(this.lookupFeatureByDisplayId(r,this._storage))}forEachBounds(e,t){this._rebuildIndex();for(const s of e){if(!s.readGeometry())continue;const r=s.getDisplayId();As(Nt,this._storage.getXMin(r),this._storage.getYMin(r),this._storage.getXMax(r),this._storage.getYMax(r)),t(Nt)}}sweepFeatures(e,t,s){this._spatialIndexInvalid=!0,this._objectIdToDisplayId.forEach((r,a)=>{e.has(r)||(t.releaseDisplayId(r),s&&s.unsetAttributeData(r),this._objectIdToDisplayId.delete(a))}),this.events.emit("changed")}sweepFeatureSets(e){this._spatialIndexInvalid=!0,this._featureSetsByInstance.forEach((t,s)=>{e.has(s)||this._featureSetsByInstance.delete(s)})}lookupObjectId(e,t){const s=this.lookupFeatureByDisplayId(e,t);return s==null?null:s.getObjectId()}lookupDisplayId(e){return this._objectIdToDisplayId.get(e)}lookupFeatureByDisplayId(e,t){const s=t.getInstanceId(e);return this._lookupFeature(s)}lookupByDisplayIdUnsafe(e){const t=this._storage.getInstanceId(e),s=Te(t),r=Fe(t),a=this._getFeatureSet(s);return a?(a.setIndex(r),a):null}_insertFeature(e,t,s){const r=this._storage,a=e.getObjectId(),n=Qt(e.instance,e.getIndex());r.getInstanceId(e.getDisplayId());let o=this._objectIdToDisplayId.get(a);o||(o=r.createDisplayId(),this._objectIdToDisplayId.set(a,o),this._spatialIndexInvalid=!0),e.setDisplayId(o),r.setInstanceId(o,n),this.setComputedAttributes(r,e,o,t,s)}_searchIndex(e){this._rebuildIndex();const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this._index.search(t)}_rebuildIndex(){if(!this._spatialIndexInvalid)return;const e=[];this.mode==="snapshot"?this._featureSetsByInstance.forEach(t=>{const s=t.getCursor();for(;s.next();){const r=s.getDisplayId();this._storage.setBounds(r,s)&&e.push(r)}}):this._objectIdToDisplayId.forEach(t=>{const s=this._storage.getInstanceId(t);this._storage.setBounds(t,this._lookupFeature(s))&&e.push(t)}),this._index.clear(),this._index.load(e),this._indexSearchCache.clear(),this._spatialIndexInvalid=!1}_lookupFeature(e){const t=Te(e),s=this._getFeatureSet(t);if(!s)return;const r=s.getCursor(),a=Fe(e);return r.setIndex(a),r}_getFeatureSet(e){return this._featureSetsByInstance.get(e)}};function Er({coords:i,lengths:e}){let t=0;for(const s of e){for(let r=1;r!(s.objectId!=null&&t.has(s.objectId)))}append(e){for(const t of e)this._features.push(t)}getSize(){return this._features.length}getCursor(){return this.copy()}getQuantizationTransform(){return this._transform}getAttributeHash(){let e="";for(const t in this._current.attributes)e+=this._current.attributes[t];return e}getIndex(){return this._featureIndex}setIndex(e){this._featureIndex=e}getObjectId(){var e;return(e=this._current)==null?void 0:e.objectId}getDisplayId(){return this._current.displayId}setDisplayId(e){this._current.displayId=e}getGroupId(){return this._current.groupId}setGroupId(e){this._current.groupId=e}copy(){const e=new pe(this.instance,this._features,this.fullSchema());return this.copyInto(e),e}next(){for(;++this._featureIndex0}let qr=class pt extends ve{static fromBuffer(e,t,s=!1){const r=t.geometryType,a=Rr(e),n=kr(a,r==="esriGeometryPoint",s),o=ve.createInstance();return new pt(o,a,n,t)}constructor(e,t,s,r){super(e,r),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0,centroid:void 0,legacyFeature:void 0,optFeature:void 0},this._geometryType=r.geometryType,this._reader=t,this._header=s,this._hasNext=s.hasFeatures,this._isPoints=r.geometryType==="esriGeometryPoint"}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get _size(){return this._header.featureCount}get hasZ(){return!1}get hasM(){return!1}get stride(){return 2+(this.hasZ?1:0)+(this.hasM?1:0)}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getSize(){return this._size}getQuantizationTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0,this._featureIndex=e}getAttributeHash(){let e="";for(const t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+".";return e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}getGroupId(){return this._header.groupIds[this._featureIndex]}setGroupId(e){this._header.groupIds[this._featureIndex]=e}readLegacyFeature(){if(this._cache.legacyFeature===void 0){const e=this.readCentroid(),t={attributes:this.readAttributes(),geometry:this._isPoints?this.readLegacyPointGeometry():this.readLegacyGeometry(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null};return this._cache.legacyFeature=t,t}return this._cache.legacyFeature}readOptimizedFeature(){if(this._cache.optFeature===void 0){const e=new mt(this.readGeometry(),this.readAttributes(),this.readCentroid());return e.objectId=this.getObjectId(),e.displayId=this.getDisplayId(),this._cache.optFeature=e,e}return this._cache.optFeature}getXHydrated(){const e=this._header.centroid[2*this._featureIndex],t=this.getQuantizationTransform();return t==null?e:e*t.scale[0]+t.translate[0]}getYHydrated(){const e=this._header.centroid[2*this._featureIndex+1],t=this.getQuantizationTransform();return t==null?e:t.translate[1]-e*t.scale[1]}getX(){return this._header.centroid[2*this._featureIndex]*this._sx+this._tx}getY(){return this._header.centroid[2*this._featureIndex+1]*this._sy+this._ty}readLegacyPointGeometry(){return{x:this.getX(),y:this.getY()}}readLegacyGeometry(e){const t=this.readUnquantizedGeometry(e);return $e(t,this.geometryType,!1,!1)}readLegacyCentroid(){const e=this.readCentroid();if(!e)return null;const[t,s]=e.coords;return{x:t,y:s}}readGeometryArea(){return this._cache.area||this.readGeometry(!0),this._cache.area}readUnquantizedGeometry(e=!1){if(this._cache.unquantGeometry===void 0){const t=this.readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;const s=Ht(t.coords.length).decoded,r=t.clone(s),a=r.coords;let n=0;for(const o of r.lengths){for(let h=1;hl.length)for(let f=0;f=f?(c+=-.5*(T-m)*(C+I),y>1&&it(l[d-2],l[d-1],v,w)?(l[d-2]+=v,l[d-1]+=w):(l[d++]=v,l[d++]=w,y++),m=T,I=C):(M+=v,F+=w),v=M,w=F,x++}y<3||S?d-=2*y:(c+=-.5*(m+v-m)*(I+w+I),it(l[d-2],l[d-1],v,w)?(l[d-2]+=v,l[d-1]+=w,h.push(y)):(l[d++]=v,l[d++]=w,h.push(++y)))}else{let f=0,x=r.getSInt32(),y=r.getSInt32();this.hasZ&&r.getSInt32(),this.hasM&&r.getSInt32(),l[d++]=x,l[d++]=y,f+=1;for(let S=1;S2&&it(l[d-2],l[d-1],m,I)?(l[d-2]+=m,l[d-1]+=I):(l[d++]=m,l[d++]=I,f+=1),x=v,y=w}h.push(f)}break}default:r.skip()}if(this._cache.area=c,!h.length)return null;if(this._tx||this._ty){let _=0;Xe(l);for(const p of h)l[2*_]+=this._tx,l[2*_+1]+=this._ty,_+=p}return new D(h,l)}},Ke=class{constructor(e){this.service=e,this._arcadeLayerSchema={...e,fieldsIndex:H.fromJSON(e.fieldsIndex)}}destroy(){}};function Lr(i){return Array.isArray(i.source)}function zr(i){return(i==null?void 0:i.type)==="ogc-source"}function Gr(i){const{capabilities:e}=i;return zr(i.source)?new Yr(i):Lr(i)?new jr(i):e.query.supportsFormatPBF&&b("featurelayer-pbf")?new Nr(i):new Qr(i)}async function Pr(i){const e=new $s;return await e.open(i,{}),e}let jr=class extends Ke{constructor(e){super(e),this._portsOpen=Pr(e.source).then(t=>this.client=t)}destroy(){this.client.close(),this.client=null}async executeQuery(e,t){await this._portsOpen;const s=await this.client.invoke("queryFeatures",e.toJSON(),t);return G.fromFeatureSet(s,this._arcadeLayerSchema)}},Nr=class extends Ke{async executeQuery(e,t){const{data:s}=await ir(this.service.source,e,t),r=!e.quantizationParameters;return qr.fromBuffer(s,this._arcadeLayerSchema,r)}},Qr=class extends Ke{async executeQuery(e,t){var u;const{source:s,capabilities:r,spatialReference:a,objectIdField:n,geometryType:o}=this.service;if(e.quantizationParameters!=null&&!r.query.supportsQuantization){const d=e.clone(),l=is(d.quantizationParameters);d.quantizationParameters=null;const{data:c}=await Lt(s,d,a,t),g=ss(c,n);return as(l,g),G.fromOptimizedFeatureSet(g,this._arcadeLayerSchema)}const{data:h}=await Lt(s,e,this.service.spatialReference,t);return o==="esriGeometryPoint"&&(h.features=(u=h.features)==null?void 0:u.filter(d=>{if(d.geometry!=null){const l=d.geometry;return Number.isFinite(l.x)&&Number.isFinite(l.y)}return!0})),G.fromFeatureSet(h,this._arcadeLayerSchema)}},Yr=class extends Ke{async executeQuery(e,t){const{capabilities:s}=this.service;if(e.quantizationParameters&&!s.query.supportsQuantization){const a=e.clone(),n=is(a.quantizationParameters);a.quantizationParameters=null;const o=await qt(this.service.source,e,t);return as(n,o),G.fromOptimizedFeatureSet(o,this._arcadeLayerSchema)}const r=await qt(this.service.source,e,t);return G.fromOptimizedFeatureSet(r,this._arcadeLayerSchema)}},z=class Qe{constructor(){this.version=0,this.source=!1,this.targets={feature:!1,aggregate:!1},this.storage={filters:!1,data:!1},this.mesh=!1,this.queryFilter=!1,this.why={mesh:[],source:[]}}static create(e){const t=new Qe;let s;for(s in e){const r=e[s];if(typeof r=="object")for(const a in r){const n=a,o=r[n];t[s][n]=o}t[s]=r}return t}static empty(){return Qe.create({})}static all(){return Qe.create({source:!0,targets:{feature:!0,aggregate:!0},storage:{filters:!0,data:!0},mesh:!0})}unset(e){this.version=e.version,e.source&&(this.source=!1),e.targets.feature&&(this.targets.feature=!1),e.targets.aggregate&&(this.targets.aggregate=!1),e.storage.filters&&(this.storage.filters=!1),e.storage.data&&(this.storage.data=!1),e.mesh&&(this.mesh=!1),e.queryFilter&&(this.queryFilter=!1)}any(){return this.source||this.mesh||this.storage.filters||this.storage.data||this.targets.feature||this.targets.aggregate||this.queryFilter}describe(){let e=0,t="";if(this.mesh){e+=20,t+=`-> (20) Mesh needs update -`;for(const r of this.why.mesh)t+=` + ${r} -`}if(this.source){e+=10,t+=`-> (10) The source needs update -`;for(const r of this.why.source)t+=` + ${r} -`}this.targets.feature&&(e+=5,t+=`-> (5) Feature target parameters changed -`),this.storage.filters&&(e+=5,t+=`-> (5) Feature filter parameters changed -`),this.targets.aggregate&&(e+=4,t+=`-> (4) Aggregate target parameters changed -`),this.storage.data&&(e+=1,t+="-> (1) Texture storage parameters changed");const s=e<5?"Fastest":e<10?"Fast":e<15?"Moderate":e<20?"Slow":"Very Slow";console.debug(`Applying ${s} update of cost ${e}/45 `),console.debug(t)}toJSON(){return{queryFilter:this.queryFilter,source:this.source,targets:this.targets,storage:this.storage,mesh:this.mesh}}},Xr=class{constructor(e,t){this.requests={done:new Array,stream:new St(10)},this._edits=null,this._abortController=new AbortController,this._version=0,this._isDone=!1,this.didSend=!1,this.tile=e,this._version=t,this._resolver=yt(),this._resolver.promise.catch(s=>He(s))}get signal(){return this._abortController.signal}get options(){return{signal:this._abortController.signal}}get empty(){return!this.requests.done.length&&this.edits==null}get edits(){return this._edits}get done(){return this._resolver.promise}get isDone(){return this._isDone}resolve(){this._isDone=!0,this._resolver.resolve()}clear(){this.requests.done=[]}applyUpdate(e){this.requests.done.forEach(t=>t.message.status.unset(e)),this._version=e.version,this._edits!=null&&this._edits.status.unset(e)}add(e){e.message.status=e.message.status??z.empty(),e.message.status.version=this._version,b("esri-2d-update-debug")&&console.debug(this.tile.id,"DataTileSubscription:add",this._version),e.message.end&&(this.requests.done.forEach(t=>{t.message!=null&&t.message.end&&(t.message.end=!1)}),this._resolver.resolve(),this._isDone=!0),this.requests.done.push(e)}edit(e,t){const s=e.getQuantizationTransform(),r=e.fullSchema(),a=Array.from(e.features()).filter(ns),n=[...t,...a.map(o=>o.objectId)];if(this.removeIds(n),this._invalidate(),this._edits==null)return void(this._edits={type:"append",addOrUpdate:G.fromOptimizedFeatures(a,r,s),id:this.tile.id,status:z.empty(),end:!0});this.requests.done.forEach(o=>o.message.end=!1),this._edits.addOrUpdate.append(e.features())}*readers(){var e;for(const{message:t}of this.requests.done)t.addOrUpdate!=null&&(yield t.addOrUpdate);((e=this._edits)==null?void 0:e.addOrUpdate)!=null&&(yield this._edits.addOrUpdate)}_invalidate(){for(const e of this.requests.done)e.message.status=z.empty();this._edits!=null&&(this._edits.status=z.empty())}removeIds(e){var t;this._invalidate();for(const{message:s}of this.requests.done){const r=s.addOrUpdate;r!=null&&(r.removeIds(e),r.isEmpty&&(b("esri-2d-update-debug")&&console.debug("Removing FeatureSetReader"),s.addOrUpdate=null))}((t=this._edits)==null?void 0:t.addOrUpdate)!=null&&this._edits.addOrUpdate.removeIds(e),this.requests.done=this.requests.done.filter(s=>s.message.addOrUpdate||s.message.end)}abort(){this._abortController.abort(),this._resolver.reject(ks())}};function Hr(i,e){const t=new Set;return i&&i.forEach(s=>t.add(s)),e&&e.forEach(s=>t.add(s)),t.has("*")?["*"]:Array.from(t)}let ys=class{constructor(e){this.updatingHandles=new It,this.events=new ke,this._resolver=yt(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage,this._arcadeLayerSchema=e.arcadeLayerSchema}destroy(){for(const e of this._subscriptions.values())e.abort();this.updatingHandles.destroy()}get subscriptions(){return this._subscriptions.values()}async _onMessage(e){const t=this._subscriptions.get(e.id);if(!t)return;const s={...e,remove:e.remove??[],status:e.status??z.empty()};return Pe(this._onTileUpdateMessage(s,t.options))}update(e,t){var u;const s=t.fields.length;t.outFields=Hr((u=this._schema)==null?void 0:u.outFields,t.outFields),t.outFields=t.outFields.length>=.75*s?["*"]:t.outFields,t.outFields.sort();const r=ye(this._schema,t);if(!r)return;b("esri-2d-update-debug")&&console.debug("Applying Update - Source:",r);const a="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",n=this._serviceInfo.source,o={returnCentroid:!(n!==null&&typeof n=="object"&&"path"in n&&os(n.path))&&this._serviceInfo.geometryType==="esriGeometryPolygon",returnGeometry:!0,timeReferenceUnknownClient:this._serviceInfo.type!=="stream"&&this._serviceInfo.timeReferenceUnknownClient,outFields:t.outFields,outSpatialReference:this._outSR,orderByFields:[a],where:t.definitionExpression||"1=1",gdbVersion:t.gdbVersion,historicMoment:t.historicMoment,timeExtent:t.timeExtent?Us.fromJSON(t.timeExtent):null},h=this._schema&&Ee(r,"outFields");this._schema&&Rs(r,["timeExtent","definitionExpression","gdbVersion","historicMoment","customParameters"])&&(e.why.mesh.push("Layer filter and/or custom parameters changed"),e.why.source.push("Layer filter and/or custom parameters changed"),e.mesh=!0,e.source=!0,e.queryFilter=!0),h&&(e.why.source.push("Layer required fields changed"),e.source=!0),ye(o,this._queryInfo)&&(this._queryInfo=o),this._schema=t,this._resolver.resolve()}whenInitialized(){return this._resolver.promise}async applyUpdate(e){if(e.queryFilter||e.source&&this._didEdit)return this.refresh(e.version),void(this._didEdit=!1);this._subscriptions.forEach(t=>t.applyUpdate(e)),await this.resend()}refresh(e,t){for(const s of this._tiles())this.unsubscribe(s),this.subscribe(s,e)}subscribe(e,t){const s=new Xr(e,t);return this._subscriptions.set(e.id,s),s}unsubscribe(e){const t=this.getSubscription(e.id);t!=null&&t.abort(),this._subscriptions.delete(e.id)}createQuery(e={}){const t=this._queryInfo.historicMoment?new Date(this._queryInfo.historicMoment):null;return new Ds({...this._queryInfo,historicMoment:t,...e})}getSubscription(e){return this._subscriptions.has(e)?this._subscriptions.get(e):null}async queryLastEditDate(){throw new Error("Service does not support query type")}async query(e,t){throw new Error("Service does not support query")}*_tiles(){const e=Array.from(this._subscriptions.values());for(const t of e)yield t.tile}async edit(e,t){return this.updatingHandles.addPromise(this._edit(e,t))}async _edit(e,t){const s=Array.from(this._subscriptions.values()),r=s.map(({tile:a})=>a);for(const a of s)a.removeIds(t);if(e.length){const a=r.map(o=>{const h=this.createTileQuery(o);return h.objectIds=e,{tile:o,query:h}}).map(async({tile:o,query:h})=>({tile:o,result:await this.query(h,{query:{tile:b("esri-tiles-debug")?o.id.replaceAll("/","."):void 0}}),query:h})),n=(await Bs(a)).map(async({tile:o,result:h})=>{if(!h.hasFeatures&&!t.length&&!e.length)return;const u=this._subscriptions.get(o.key.id);u&&u.edit(h,e)});await Promise.allSettled(n)}this._didEdit=!0}};const Vr=4;let At=class extends ys{constructor(e){super(e),this.type="feature",this.mode="on-demand",this._adapter=Gr(e.serviceInfo),this._queue=new lt({concurrency:8,process:async t=>{var s,r;if(P(t),t.tile!=null){const a=t.tile.key.id,{signal:n}=t,o=b("esri-tiles-debug")?{tile:a.replaceAll("/","."),depth:t.depth}:void 0,h=await this._adapter.executeQuery(t.query,{signal:n,query:{...o,...(s=this._schema)==null?void 0:s.customParameters}});return h.level=t.tile.key.level,h}return this._adapter.executeQuery(t.query,{...t,query:(r=this._schema)==null?void 0:r.customParameters})}}),this._patchQueue=new lt({concurrency:8,process:async t=>{var s,r;if(P(t),t.tile!=null){const a=t.tile.key.id,{signal:n}=t,o=b("esri-tiles-debug")?{tile:a.replaceAll("/","."),depth:t.depth}:void 0,h=await this._adapter.executeQuery(t.query,{signal:n,query:{...o,...(s=this._schema)==null?void 0:s.customParameters}});return h.level=t.tile.key.level,h}return this._adapter.executeQuery(t.query,{...t,query:(r=this._schema)==null?void 0:r.customParameters})}})}destroy(){super.destroy(),this._adapter.destroy(),this._queue.destroy(),this._patchQueue.destroy()}enqueueQuery(e,t){return this.updatingHandles.addPromise(this._queue.push(e,t))}enqueuePatchQuery(e,t){return this.updatingHandles.addPromise(this._patchQueue.push(e,t))}get maxRecordCountFactor(){const{query:e}=this._serviceInfo.capabilities;return e.supportsMaxRecordCountFactor?Vr:null}get maxPageSize(){const{query:e}=this._serviceInfo.capabilities;return(e.maxRecordCount??8e3)*(this.maxRecordCountFactor??1)}get pageSize(){return Math.min(8e3,this.maxPageSize)}enableEvent(e,t){}subscribe(e,t){const s=super.subscribe(e,t);return this._fetchDataTile(e).catch(r=>{Ie(r)||ae.getLogger("esri.views.2d.layers.features.sources.BaseFeatureSource").error(new V("mapview-query-error","Encountered error when fetching tile",{tile:e,error:r}))}),s}unsubscribe(e){super.unsubscribe(e)}readers(e){return this._subscriptions.get(e).readers()}async query(e,t={}){var r;const s=t.query??{};return this._adapter.executeQuery(e,{...t,query:{...s,...(r=this._schema)==null?void 0:r.customParameters}})}async queryLastEditDate(){const e=this._serviceInfo.source,t={...e.query,f:"json"};return(await Os(e.path,{query:t,responseType:"json"})).data.editingInfo.lastEditDate}createTileQuery(e,t={}){const s=this._serviceInfo.geometryType,r=this.createQuery(t);r.quantizationParameters=t.quantizationParameters??e.getQuantizationParameters(),r.resultType="tile",r.geometry=e.extent,this._serviceInfo.capabilities.query.supportsQuantization?s==="esriGeometryPolyline"&&(r.maxAllowableOffset=e.resolution*b("feature-polyline-generalization-factor")):s!=="esriGeometryPolyline"&&s!=="esriGeometryPolygon"||(r.maxAllowableOffset=e.resolution,s==="esriGeometryPolyline"&&(r.maxAllowableOffset*=b("feature-polyline-generalization-factor")));const a=this._serviceInfo.capabilities.query;return r.defaultSpatialReferenceEnabled=a.supportsDefaultSpatialReference,r.compactGeometryEnabled=a.supportsCompactGeometry,r}async _executePatchQuery(e,t,s,r){const a=t.clone();a.outFields=[this._serviceInfo.objectIdField,...s],a.returnCentroid=!1,a.returnGeometry=!1;const n=a.start!=null?a.start/8e3:0,o=r.signal;return await this.enqueuePatchQuery({tile:e,query:a,signal:o,depth:n})}async _resend(e,t){const{query:s,message:r}=e,a=s.outFields!=null?s.outFields:[],n=this._queryInfo.outFields,o=n.filter(h=>!a.includes(h));if(r.addOrUpdate!=null)if(o.length)try{const h=this._subscriptions.get(r.id).tile,u=await this._executePatchQuery(h,s,o,t);P(t),s.outFields=n,r.addOrUpdate.joinAttributes(u),this._onMessage({...r,end:r.end,type:"append"})}catch{}else this._onMessage({...r,type:"append"});else this._onMessage({...r,type:"append"})}async _resendSubscription(e){if(b("esri-2d-update-debug")&&console.debug(e.tile.id,"Resend Subscription"),e.empty)return this._onMessage({id:e.tile.id,addOrUpdate:null,end:!1,type:"append"});const t=e.signal;for(const s of e.requests.done)await this._resend(s,{signal:t});return e.edits!=null?this._onMessage(e.edits):void 0}async resend(){const e=Array.from(this._subscriptions.values());await Promise.all(e.map(t=>this._resendSubscription(t)))}};const Vt=b("esri-mobile"),Zt={maxDrillLevel:Vt?1:4,maxRecordCountFactor:Vt?1:3};class Zr extends At{constructor(e){super(e)}async _fetchDataTile(e){const t=this._serviceInfo.capabilities.query.supportsMaxRecordCountFactor,s=this._subscriptions.get(e.key.id),r=s.signal,a=e.getQuantizationParameters();let n=0;const o=async(h,u)=>{const d=this._queryInfo,l=this.createTileQuery(h,{maxRecordCountFactor:t?Zt.maxRecordCountFactor:void 0,returnExceededLimitFeatures:!1,quantizationParameters:a});n++;try{const c=await this.enqueueQuery({tile:e,query:l,signal:r,depth:u});if(n--,P(r),!c)return;if(d!==this._queryInfo)return void o(h,u);if(c.exceededTransferLimit&&u{o--,P(r);const g=e.id,_=l.reader,p=l.query;if(!_.exceededTransferLimit){if(a=!0,c!==0&&!_.hasFeatures){const y={id:g,addOrUpdate:_,end:o===0,type:"append"};return r.add({message:y,query:p}),void this._onMessage(y)}const x={id:g,addOrUpdate:_,end:o===0,type:"append"};return r.add({message:x,query:p}),void this._onMessage(x)}const f={id:g,addOrUpdate:_,end:a&&o===0,type:"append"};r.add({message:f,query:p}),this._onMessage(f)};let u=0,d=0;for(;!a&&d++<20;){let l;for(let c=0;c_&&h(_,g)).catch(_=>{if(a=!0,!Ie(_)){ae.getLogger("esri.views.2d.layers.features.sources.PagedFeatureSource").error(new V("mapview-query-error","Encountered error when fetching tile",{tile:e,error:_}));const p={id:e.id,addOrUpdate:null,end:a,type:"append"},f={start:this.pageSize*n,num:this.pageSize,returnExceededLimitFeatures:!0,quantizationParameters:e.getQuantizationParameters()};this.maxRecordCountFactor!=null&&(f.maxRecordCountFactor=this.maxRecordCountFactor);const x=this.createTileQuery(e,f);r.add({message:p,query:x}),this._onMessage(p)}})}await l,P(r),u=Math.min(u+2,6)}}async _fetchDataTilePage(e,t,s){P(s);const r=this._queryInfo,a={start:this.pageSize*t,num:this.pageSize,returnExceededLimitFeatures:!0,quantizationParameters:e.getQuantizationParameters()};this.maxRecordCountFactor!=null&&(a.maxRecordCountFactor=this.maxRecordCountFactor);const n=this.createTileQuery(e,a);try{const o=s.signal,h=await this.enqueueQuery({tile:e,query:n,signal:o,depth:t});return P(s),h?r!==this._queryInfo?this._fetchDataTilePage(e,t,s):{reader:h,query:n}:null}catch(o){return He(o),null}}};function Wr(i,e,t){const s=i.getXHydrated(),r=i.getYHydrated(),a=e.getColumnForX(s),n=Math.floor(e.normalizeCol(a));return`${t}/${Math.floor(e.getRowForY(r))}/${n}`}function at(i,e){if(i==null)return null;const t=e.transform,s=i.getQuantizationTransform();if(s==null){const[f,x]=t.scale,[y,S]=t.translate,m=-y/f,I=1/f,v=S/x,w=1/-x;return i.transform(m,v,I,w)}const[r,a]=s.scale,[n,o]=s.translate,[h,u]=t.scale,[d,l]=t.translate,c=r/h,g=(n-d)/h,_=a/u,p=(-o+l)/u;return i.transform(g,p,c,_)}let ft=class extends At{constructor(e){super(e),this.mode="snapshot",this._loading=!0,this._controller=new AbortController,this._downloadPromise=null,this._didSendEnd=!1,this._queries=new Array,this._invalidated=!1,this._hasAggregates=!1,this._random=new qs(1e3),this._store=e.store,this._markedIdsBufId=this._store.storage.createBitset()}destroy(){super.destroy(),this._controller.abort()}get loading(){return this._loading}get _signal(){return this._controller.signal}update(e,t){var s;super.update(e,t),this._featureCount??(this._featureCount=t.initialFeatureCount),t.changedFeatureCount!=null&&(this._featureCount=t.changedFeatureCount),this._hasAggregates=!!((s=e.targets)!=null&&s.aggregate)}async resend(e=!1){if(await this._downloadPromise,this._invalidated||e){const s=this._featureCount;return Xe(s,"Expected featureCount to be defined"),this._invalidated=!1,this._subscriptions.forEach(r=>r.clear()),this._downloadPromise=this._download(s),void await this._downloadPromise}const t=this._queries.map(({query:s,reader:r})=>this._sendPatchQuery(s,r));await Promise.all(t),this._subscriptions.forEach(s=>{s.requests.done.forEach(r=>this._onMessage(r.message))})}async refresh(e,t){t&&(this._featureCount=t.featureCount),await this.resend(!0)}async _sendPatchQuery(e,t){const s=e.outFields!=null?e.outFields:[],r=this._queryInfo.outFields,a=r.filter(u=>!s.includes(u));if(!a.length)return;const n=e.clone(),o=this._signal;n.returnGeometry=!1,n.returnCentroid=!1,n.outFields=a,e.outFields=r;const h=await this.enqueueQuery({query:n,depth:0,signal:o});P({signal:o}),t.joinAttributes(h)}async _fetchDataTile(e){this._downloadPromise??(this._downloadPromise=this._download(this._featureCount));const t=this._store.search(e),s=this._subscriptions.get(e.key.id),r=t.length-1;for(let h=0;h=0?t[r]:null,e),n=this._didSendEnd,o={type:"append",id:e.id,addOrUpdate:a,end:n,status:z.empty()};s.add({query:null,message:o}),this._onMessage(o)}async _download(e){try{await this.whenInitialized();const t=this._store.storage.getBitset(this._markedIdsBufId),s=new Set;t.clear();const r=Math.ceil(e/this.pageSize),a=Array.from({length:r},(n,o)=>o).sort((n,o)=>this._random.getInt()-this._random.getInt()).map(n=>this._downloadPage(n,t,s));await Promise.all(a),this._store.sweepFeatures(t,this._store.storage),this._store.sweepFeatureSets(s)}catch(t){ae.getLogger("esri.views.2d.layers.features.sources.SnapshotFeatureSource").error("mapview-snapshot-source","Encountered and error when downloading feature snapshot",t)}this._sendEnd(),this._loading=!1}async _downloadPage(e,t,s){const r=this.pageSize,a={start:e*r,num:r,cacheHint:!0};this.maxRecordCountFactor!=null&&(a.maxRecordCountFactor=this.maxRecordCountFactor);const n=this.createQuery(a),o=this._signal,h=await this.enqueueQuery({query:n,depth:e,signal:o});P({signal:o}),this._queries.push({query:n,reader:h}),this._store.insert(h),s.add(h.instance);const u=h.getCursor();for(;u.next();)t.set(u.getDisplayId());this._send(h)}_send(e){if(!this._subscriptions.size)return;let t=null;const s=new Map,r=new Set,a=new Map;this._subscriptions.forEach(n=>{const o=n.tile;s.set(o.key.id,null),t=o.tileInfoView,r.add(o.level);const{row:h,col:u}=o.key,d=`${o.level}/${h}/${u}`,l=a.get(d)??[];l.push(n),a.set(d,l)});for(const n of r){const o=t.getLODInfoAt(n),h=e.getCursor();for(;h.next();){const u=Wr(h,o,n),d=h.getIndex();if(a.has(u))for(const l of a.get(u)){const c=l.tile.id;let g=s.get(c);g==null&&(g=[],s.set(c,g)),g.push(d)}}}s.forEach((n,o)=>{if(n!=null){const h=this._subscriptions.get(o),u={type:"append",id:o,addOrUpdate:at(ms.from(e,n),h.tile),end:!1,status:z.empty()};h.add({query:null,message:u}),this._onMessage(u)}})}_sendEnd(){this._subscriptions.forEach(e=>{const t={type:"append",id:e.tile.id,addOrUpdate:null,end:!0,status:z.empty()};e.add({query:null,message:t}),this._onMessage(t)}),this._didSendEnd=!0}};ft=k([Je("esri.view.2d.layers.features.sources.SnapshotFeatureSource")],ft);let fe=class extends xt{constructor(e){super(e)}get connectionStatus(){var e;return(e=this.connection)==null?void 0:e.connectionStatus}get errorString(){var e;return(e=this.connection)==null?void 0:e.errorString}};k([O()],fe.prototype,"connection",void 0),k([O()],fe.prototype,"connectionStatus",null),k([O()],fe.prototype,"errorString",null),fe=k([Je("esri.views.2d.layers.features.sources.StreamConnectionState")],fe);const Kr=2500;function ei(i,e){const t=i.weakClone();if(i.geometry!=null){const s=us(e,i.geometry.coords[0]),r=ds(e,i.geometry.coords[1]);t.geometry=new D([],[s,r])}return t}function ti(i){return i==="esriGeometryPoint"?ei:(e,t)=>{const s=e.weakClone(),r=new D,a=!1,n=!1,o=ct(r,e.geometry,a,n,i,t,!1,!1);return s.geometry=o,s}}function si(i){return i==="esriGeometryPoint"?e=>e.geometry!=null?{minX:e.geometry.coords[0],minY:e.geometry.coords[1],maxX:e.geometry.coords[0],maxY:e.geometry.coords[1]}:{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}:e=>{let t=1/0,s=1/0,r=-1/0,a=-1/0;return e.geometry!=null&&e.geometry.forEachVertex((n,o)=>{t=Math.min(t,n),s=Math.min(s,o),r=Math.max(r,n),a=Math.max(a,o)}),{minX:t,minY:s,maxX:r,maxY:a}}}function ri(i,e){const t=be(9,si(e));return t.load(i),t}function ii(i,e){return i.search({minX:e.bounds[0],minY:e.bounds[1],maxX:e.bounds[2],maxY:e.bounds[3]})}class ai{constructor(e,t){this.onUpdate=e,this._geometryType=t,this._objectIdToFeature=new Map,this._index=null}get _features(){const e=[];return this._objectIdToFeature.forEach(t=>e.push(t)),e}add(e){this._objectIdToFeature.set(e.objectId,e),this._index=null}get(e){return this._objectIdToFeature.has(e)?this._objectIdToFeature.get(e):null}forEach(e){this._objectIdToFeature.forEach(e)}search(e){return this._index||(this._index=ri(this._features,this._geometryType)),ii(this._index,e)}clear(){this._index=null,this._objectIdToFeature.clear()}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),this._index=null,t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._objectIdToFeature.size}}let ni=class extends ys{constructor(e){super(e),this.type="stream",this._updateIntervalId=0,this._level=0,this._isPaused=!1,this._updateInfo={websocket:0,client:0},this._inUpdate=!1;const{outSR:t}=e,{geometryType:s,objectIdField:r,timeInfo:a,purgeOptions:n,source:o,spatialReference:h,serviceFilter:u,maxReconnectionAttempts:d,maxReconnectionInterval:l,updateInterval:c,customParameters:g,enabledEventTypes:_}=e.serviceInfo,p=new ai(this._onUpdate.bind(this),s),f=new er(p,r,a,n),x=hr(o,h,t,s,u,d,l,g??{});this._connectionState=new fe({connection:x}),this._store=p,this._manager=f,this._connection=x,this._quantize=ti(s),this._enabledEventTypes=new Set(_),this._handlesGroup=Ls([this._connection.on("data-received",y=>this._onFeature(y)),this._connection.on("message-received",y=>this._onWebSocketMessage(y))]),this._initUpdateInterval=()=>{let y=performance.now();this._updateIntervalId=setInterval(()=>{const S=performance.now(),m=S-y;if(m>Kr){y=S;const I=Math.round(this._updateInfo.client/(m/1e3)),v=Math.round(this._updateInfo.websocket/(m/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.events.emit("updateRate",{client:I,websocket:v})}e.canAcceptRequest()&&!this._inUpdate&&this._manager.checkForUpdates()},c)},this._isPaused=e.serviceInfo.isPaused,this._isPaused||this._initUpdateInterval()}destroy(){var e;super.destroy(),this._clearUpdateInterval(),this._connection.destroy(),(e=this._handlesGroup)==null||e.remove()}_fetchDataTile(){}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState.errorString}updateCustomParameters(e){this._connection.updateCustomParameters(e)}pauseStream(){this._isPaused||(this._isPaused=!0,this._clearUpdateInterval())}resumeStream(){this._isPaused&&(this._isPaused=!1,this._initUpdateInterval())}sendMessageToSocket(e){this._connection.sendMessageToSocket(e)}sendMessageToClient(e){this._isPaused&&"type"in e&&e.type==="clear"?(this._store.clear(),this._subscriptions.forEach((t,s)=>{t.didSend&&t.tile.level===this._level&&this._onMessage({type:"append",id:s,addOrUpdate:null,clear:!0,end:!0})})):this._connection.sendMessageToClient(e)}enableEvent(e,t){t?this._enabledEventTypes.add(e):this._enabledEventTypes.delete(e)}subscribe(e,t){const s=super.subscribe(e,t);this._level=e.level;const r=this._getTileFeatures(e);return this._onMessage({type:"append",id:e.key.id,addOrUpdate:r,end:!0}),s.didSend=!0,s}unsubscribe(e){super.unsubscribe(e)}*readers(e){const t=this._subscriptions.get(e),{tile:s}=t;yield this._getTileFeatures(s)}createTileQuery(e){throw new Error("Service does not support tile queries")}async resend(){this._subscriptions.forEach(e=>{const{tile:t}=e,s={type:"append",id:t.id,addOrUpdate:this._getTileFeatures(t),end:!0};this._onMessage(s)})}_getTileFeatures(e){const t=this._store.search(e).map(s=>this._quantize(s,e.transform));return G.fromOptimizedFeatures(t,this._arcadeLayerSchema,e.transform)}_onWebSocketMessage(e){if(this._enabledEventTypes.has("message-received")&&this.events.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this._store.forEach(t=>this._manager.removeById(t.objectId))}}_onFeature(e){this._updateInfo.websocket++;try{this._enabledEventTypes.has("data-received")&&this.events.emit("data-received",e);const t=zs(e,this._serviceInfo.geometryType,!1,!1,this._serviceInfo.objectIdField);this._manager.add(t)}catch{}}_clearUpdateInterval(){clearInterval(this._updateIntervalId),this._updateIntervalId=0}async _onUpdate(e,t){this._inUpdate=!0;try{e!=null&&(this._updateInfo.client+=e.length),this._subscriptions.forEach((r,a)=>{r.didSend&&r.tile.level===this._level&&this._onMessage({type:"append",id:a,addOrUpdate:null,clear:!0,end:!1})});const s=[];this._subscriptions.forEach((r,a)=>{if(!r.didSend||r.tile.level!==this._level)return;const n=r.tile,o={type:"append",id:a,addOrUpdate:this._getTileFeatures(n),remove:[],end:!1,status:z.empty()};r.requests.stream.enqueue(o),s.push(this._onMessage(o))}),await Promise.all(s),this._subscriptions.forEach((r,a)=>{r.didSend&&r.tile.level===this._level&&this._onMessage({type:"append",id:a,addOrUpdate:null,end:!0})})}catch{}this._inUpdate=!1}};function oi(i,e,t,s,r,a,n){const o=hi(i,e,t,s,r,a,n);switch(o.type){case"feature":switch(o.origin){case"hosted":case"local":return new Jr(o);case"snapshot":return new ft(o);default:return new Zr(o)}case"stream":return new ni(o)}}function hi(i,e,t,s,r,a,n){switch(i.type){case"snapshot":return{type:"feature",origin:"snapshot",featureCount:i.featureCount??0,serviceInfo:i,onMessage:r,outSR:t,tileInfoView:s,canAcceptRequest:a,store:n,arcadeLayerSchema:e};case"stream":return{type:"stream",serviceInfo:i,onMessage:r,outSR:t,canAcceptRequest:a,arcadeLayerSchema:e};case"memory":case"on-demand":return{type:"feature",serviceInfo:i,onMessage:r,outSR:t,origin:o(i.source),tileInfoView:s,canAcceptRequest:a,arcadeLayerSchema:e}}function o(h){return Array.isArray(h)?"local":"path"in h&&os(h.path)?"hosted":"unknown"}}const $=8388607,Is=8388608,ui=254,di=255,li=0,Ct=1,Mt=i=>(i&Is)>>>23,_e=i=>i&$,ci=i=>Mt(i)===Ct?ui:di;function Ma(i){return Mt(i)===Ct}function Et(i,e){return((e?Is:0)|i)>>>0}const $t=ae.getLogger("esri.views.2d.engine.webgl.Utils"),W="geometry",gi=[{name:W,strideInBytes:12}],pi=[{name:W,strideInBytes:36}],fi=[{name:W,strideInBytes:24}],_i=[{name:W,strideInBytes:12}],mi=[{name:W,strideInBytes:40}],yi=[{name:W,strideInBytes:36}],Ii=[{name:W,strideInBytes:36}];function ne(i){const e={};for(const t of i)e[t.name]=t.strideInBytes;return e}const xi=ne([{name:W,strideInBytes:36}]),bi=ne(gi),vi=ne(pi),Si=ne(fi),wi=ne(_i),Ti=ne(mi),Fi=ne(yi),Ai=ne(Ii);function Ea(i,e){switch(i){case Se.MARKER:return e===Oe.HEATMAP?bi:xi;case Se.FILL:switch(e){case Oe.DOT_DENSITY:return wi;case Oe.SIMPLE:case Oe.OUTLINE_FILL_SIMPLE:return Si;default:return vi}case Se.LINE:return Ti;case Se.TEXT:return Fi;case Se.LABEL:return Ai}}function $a(i){switch(i){case"butt":return Ue.BUTT;case"round":return Ue.ROUND;case"square":return Ue.SQUARE;default:return $t.error(new V("mapview-invalid-type",`Cap type ${i} is not a valid option. Defaulting to round`)),Ue.ROUND}}function ka(i){switch(i){case"miter":return Re.MITER;case"bevel":return Re.BEVEL;case"round":return Re.ROUND;default:return $t.error(new V("mapview-invalid-type",`Join type ${i} is not a valid option. Defaulting to round`)),Re.ROUND}}W+"",Gs.STATIC_DRAW;function Ci(i){switch(i){case X.UNSIGNED_BYTE:return Uint8Array;case X.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case X.FLOAT:return Float32Array;default:return void $t.error(new V("webgl-utils",`Unable to handle type ${i}`))}}const Mi=(i,e)=>i&&((...t)=>e.warn("DEBUG:",...t))||(()=>null),Ei=!1;function $i(i,e){if(!i||!e)return i;switch(e){case"radius":case"distance":return 2*i;case"diameter":case"width":return i;case"area":return Math.sqrt(i)}return i}const me=ae.getLogger("esri.views.layers.2d.features.support.AttributeStore"),ze=Mi(Ei,me),Me={sharedArrayBuffer:b("esri-shared-array-buffer"),atomics:b("esri-atomics")};function nt(i,e){return t=>e(i(t))}class ki{constructor(e,t,s,r){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:a,layout:n,textureOnly:o}=r;this.textureOnly=o||!1,this.pixelType=a,this._ctype=t,this.layout=n,this._resetRange(),this._shared=e,this.size=s,o||(this.data=this._initData(a,s,e,t))}get buffer(){var e;return(e=this.data)==null?void 0:e.buffer}unsetComponentAllTexels(e,t){const s=this.data;for(let r=0;rt)return null;this._resetRange();const r=!(this._shared||this._ctype==="local"),a=this.pixelType,n=this.layout,o=this.data;return{start:e,end:t,data:r&&o.slice(e*s,(t+1)*s)||null,pixelType:a,layout:n}}_initData(e,t,s,r){const a=s&&r!=="local"?SharedArrayBuffer:ArrayBuffer,n=Ci(e),o=new n(new a(t*t*4*n.BYTES_PER_ELEMENT));for(let h=0;hnull)}destroy(){this._abortController.abort(),this.updatingHandles.destroy()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}isUpdating(){const e=this.updatingHandles.updating||!!this._nextUpdate;return b("esri-2d-log-updating")&&console.log(`Updating AttributeStore: ${e} - -> updatingHandles ${this.updatingHandles.updating} (currUpdate: ${!!this._currUpdate}) - -> nextUpdate: ${!!this._nextUpdate} -`),e}update(e,t){this.config=t;const s=t.schema.processors[0].storage,r=ye(this._schema,s);if((e.targets.feature||e.targets.aggregate)&&(e.storage.data=!0),r&&(b("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",r),e.storage.data=!0,this._schema=s,this._attributeComputeInfo=null,s!=null)){switch(s.target){case"feature":this._targetType=li;break;case"aggregate":this._targetType=Ct}if(s.type==="subtype"){this._attributeComputeInfo={isSubtype:!0,subtypeField:s.subtypeField,map:new Map};for(const a in s.mapping){const n=s.mapping[a];if((n==null?void 0:n.vvMapping)!=null)for(const o of n.vvMapping)this._bindAttribute(o,parseInt(a,10))}}else{if(this._attributeComputeInfo={isSubtype:!1,map:new Map},s.vvMapping!=null)for(const a of s.vvMapping)this._bindAttribute(a);if(s.attributeMapping!=null)for(const a of s.attributeMapping)this._bindAttribute(a)}}}onTileData(e,t){if(t.addOrUpdate==null)return;const s=t.addOrUpdate.getCursor();for(;s.next();){const r=s.getDisplayId();this.setAttributeData(r,s)}}async setHighlight(e,t){const r=this._getBlock(0),a=t.map(n=>_e(n));r.lock(),r.unsetComponentAllTexels(0,1),r.setComponent(0,1,a),r.unlock(),this._idsToHighlight.clear();for(const n of e)this._idsToHighlight.add(n);await this.sendUpdates()}async updateFilters(e,t,s){b("esri-2d-update-debug")&&console.debug("AttributeStore::updateFilters");const{service:r,spatialReference:a}=s,{filters:n}=t,o=n.map((u,d)=>this._updateFilter(u,d,r,a)),h=(await Promise.all(o)).some(u=>u);b("esri-2d-update-debug")&&console.debug("AttributeStore::updateFilters - finsihed"),h&&(e.storage.filters=!0,b("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(e,t,s,r){const a=_e(e);this._ensureSizeForTexel(a),this._getBlock(t).setData(e,s,r)}getData(e,t,s){return this._getBlock(t).getData(e,s)}getHighlightFlag(e){return this._idsToHighlight.has(e)?dr:0}unsetAttributeData(e){const t=_e(e);this._getBlock(0).setData(t,0,0)}setAttributeData(e,t){const s=_e(e);if(this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(t)),this._targetType!==Mt(e))return;const r=this._attributeComputeInfo,a=this.config.supportsTextureFloat?1:2,n=4;let o=null;r&&(o=r.isSubtype?r.map.get(t.readAttribute(r.subtypeField)):r.map,o!=null&&o.size&&o.forEach((h,u)=>{const d=u*a%n,l=Math.floor(u*a/n),c=this._getBlock(l+lr),g=h(t);if(this.config.supportsTextureFloat)c.setData(s,d,g);else if(g===zt)c.setData(s,d,255),c.setData(s,d+1,255);else{const _=Ps(Math.round(g),-32767,32766)+32768,p=255&_,f=(65280&_)>>8;c.setData(s,d,p),c.setData(s,d+1,f)}}))}sendUpdates(){if(b("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate"),this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=yt(),this.updatingHandles.addPromise(this._nextUpdate.promise),this._nextUpdate.promise;const e={blocks:this._blocks.map(t=>t!=null?t.toMessage():null)};return this._currUpdate=this._createResources().then(()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const r=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then(()=>r.resolve())}else b("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate::No additional updates queued")};b("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate::client.update");const s=this.updatingHandles.addPromise(this._client.update(e,this._signal).then(t).catch(t));return this._client.render(this._signal),s}).catch(t=>{if(Ie(t))return this._createResourcesPromise=null,this._createResources();me.error(new V("mapview-attribute-store","Encountered an error during client update",t))}),this._currUpdate}_ensureSizeForTexel(e){for(;e>=this._size*this._size;)if(this._expand())return}_bindAttribute(e,t){function s(){const{normalizationField:u}=e;return u?d=>{const l=d.readAttribute(u);return l?d.readAttribute(e.field)/l:null}:d=>d.readAttribute(e.field)}function r(){return e.normalizationField&&me.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),u=>u.getComputedNumericAtIndex(e.fieldIndex)}let a;if(e.fieldIndex!=null)a=r();else{if(!e.field)return;a=s()}const{valueRepresentation:n}=e;n&&(a=nt(a,u=>$i(u,n)));const o=u=>u===null||isNaN(u)||u===1/0||u===-1/0?zt:u,h=this._attributeComputeInfo;if(h.isSubtype){const u=h.map.get(t)??new Map;u.set(e.binding,nt(a,o)),h.map.set(t,u)}else h.map.set(e.binding,nt(a,o))}_createResources(){if(this._createResourcesPromise!=null)return this._createResourcesPromise;this._getBlock(cr),this._getBlock(gr),ze("Initializing AttributeStore");const e={shared:Me.sharedArrayBuffer&&this._client.type!=="local",size:this._size,blocks:this._blocks.map(s=>s!=null?{textureOnly:s.textureOnly,buffer:s.buffer,pixelType:s.pixelType}:null)},t=this._client.initialize(e,this._signal).catch(s=>{Ie(s)?this._createResourcesPromise=null:me.error(new V("mapview-attribute-store","Encountered an error during client initialization",s))});return this._createResourcesPromise=t,t.then(()=>this._createResourcesPromise==null?this._createResources():void 0),t}_getBlock(e){const t=this._blocks[e];if(t!=null)return t;ze(`Initializing AttributeBlock at index ${e}`);const s=Me.sharedArrayBuffer,r=this._client.type,a=new ki(s,r,this._size,this._blockDescriptors[e]);return this._blocks[e]=a,this._createResourcesPromise=null,a}_expand(){if(this._sizeimport("./FeatureFilter-w5_DYl72.js"),__vite__mapDeps([15,1,2,16,17,18,19,20,21,22,23,24,7,25,26,27,28,29,30,31,32,33,3,11,9,34])),a=new r({geometryType:t.geometryType,hasM:!1,hasZ:!1,timeInfo:t.timeInfo,fieldsIndex:H.fromJSON(t.fieldsIndex)});return this._filters[e]=a,a}isVisible(e){return!!(2&this._getBlock(0).getData(e,0))}getFilterFlags(e){let t=0;const s=ci(e.getDisplayId());for(let a=0;a{},this._nodes=0,this._root=new ot(this,0,0,0),this._statisticFields=e,this._pool=s?new St(8096):null,this._serviceInfo=t}destroy(){this.clear()}_acquire(e,t,s){this._nodes++;let r=null;return this._pool!=null&&(r=this._pool.dequeue()),r!=null?r.realloc(e,t,s):r=new ot(this,e,t,s),r}_release(e){this.onRelease(e),this._nodes--,this._pool!=null&&this._pool.enqueue(e)}get count(){return this._root.count}get size(){return this._nodes}get poolSize(){var e;return((e=this._pool)==null?void 0:e.size)??0}get depth(){let e=0;return this.forEach(t=>e=Math.max(e,t.depth)),e}dropLevels(e){this.forEach(t=>{if(t.depth>=e)for(let s=0;s{if(t.depth>=e)for(let s=0;sthis._release(e)),this._root=new ot(this,0,0,0)}insert(e,t,s=0){const r=G.fromOptimizedFeatures([e],this._serviceInfo).getCursor();r.next();const a=r.readGeometry();if(!a)return;const[n,o]=a.coords,h=e.geohashX,u=e.geohashY;this.insertCursor(r,e.displayId,n,o,h,u,t,s)}insertCursor(e,t,s,r,a,n,o,h=0){let u=this._root,d=0,l=0,c=0;for(;u!==null;){if(u.depth>=h&&(u.count+=1,u.xTotal+=s,u.yTotal+=r,u.xGeohashTotal+=a,u.yGeohashTotal+=n,u.referenceId=t,this._updateStatisticsCursor(e,u,1)),d>=o)return void u.add(t);const g=Math.ceil((d+1)/2),_=Math.floor((d+1)/2),p=1-d%2,f=30-(3*g+2*_),x=30-(2*g+3*_),y=(a&7*p+3*(1-p)<>f,S=(n&3*p+7*(1-p)<>x,m=y+S*(8*p+4*(1-p));l=l<<3*p+2*(1-p)|y,c=c<<2*p+3*(1-p)|S,u.children[m]==null&&(u.children[m]=this._acquire(l,c,d+1)),d+=1,u=u.children[m]}}remove(e,t){const s=G.fromOptimizedFeatures([e],this._serviceInfo).getCursor();s.next();const r=s.readGeometry();if(!r)return;const[a,n]=r.coords,o=e.geohashX,h=e.geohashY;this.removeCursor(s,a,n,o,h,t)}removeCursor(e,t,s,r,a,n){let o=this._root,h=0;for(;o!==null;){if(o.count-=1,o.xTotal-=t,o.yTotal-=s,o.xGeohashTotal-=r,o.yGeohashTotal-=a,this._updateStatisticsCursor(e,o,-1),h>=n)return void o.remove(e.getDisplayId());const u=Math.ceil((h+1)/2),d=Math.floor((h+1)/2),l=1-h%2,c=30-(3*u+2*d),g=30-(2*u+3*d),_=((r&7*l+3*(1-l)<>c)+((a&3*l+7*(1-l)<>g)*(8*l+4*(1-l)),p=o.children[_];(p==null?void 0:p.count)===1&&(this._release(p),o.children[_]=null),h+=1,o=p}}forEach(e){let t=this._root;for(;t!==null;){const s=this._linkChildren(t)||t.next;e(t),t=s}}find(e,t,s){return this._root.find(e,t,s,0,0,0)}findIf(e){let t=null;return this.forEach(s=>{e(s)&&(t=s)}),t}findAllIf(e){const t=[];return this.forEach(s=>{e(s)&&t.push(s)}),t}findSingleOccupancyNode(e,t,s,r,a){let n=this._root;for(;n!==null;){const o=n.depth,h=n.xNode,u=n.yNode,d=1-o%2,l=n.xGeohashTotal/n.count,c=n.yGeohashTotal/n.count;if(n.count===1&&e=a){n=n.next;continue}const g=Math.ceil((o+1)/2),_=Math.floor((o+1)/2),p=30-(3*g+2*_),f=30-(2*g+3*_),x=~((1<>p,m=(t&y)>>f,I=(s&x)>>p,v=(r&y)>>f,w=h<<3*d+2*(1-d),M=u<<2*d+3*(1-d),F=w+8*d+4*(1-d),T=M+4*d+8*(1-d),C=Math.max(w,S),A=Math.max(M,m),E=Math.min(F,I),U=Math.min(T,v);let B=null,Z=null;for(let R=A;R<=U;R++)for(let Y=C;Y<=E;Y++){const Q=Y-w+(R-M)*(8*d+4*(1-d)),q=n.children[Q];q&&(B||(B=q,B.next=n.next),Z&&(Z.next=q),Z=q,q.next=n.next)}n=B||n.next}return null}getRegionDisplayIds(e){let t=this._root;const{bounds:s,geohashBounds:r,level:a}=e,[n,o,h,u]=s,d=[];for(;t!==null;){const l=t.depth,c=t.xNode,g=t.yNode;if(l>=a){const Q=t.xTotal/t.count,q=t.yTotal/t.count;Q>=n&&Q<=h&&q>=o&&q<=u&&t.displayIds.forEach(K=>d.push(K)),t=t.next;continue}const _=Math.ceil((l+1)/2),p=Math.floor((l+1)/2),f=1-l%2,x=30-(3*_+2*p),y=30-(2*_+3*p),S=~((1<>x,v=(r.yLL&m)>>y,w=(r.xTR&S)>>x,M=(r.yTR&m)>>y,F=c<<3*f+2*(1-f),T=g<<2*f+3*(1-f),C=F+8*f+4*(1-f),A=T+4*f+8*(1-f),E=Math.max(F,I),U=Math.max(T,v),B=Math.min(C,w),Z=Math.min(A,M);let R=null,Y=null;for(let Q=U;Q<=Z;Q++)for(let q=E;q<=B;q++){const K=q-F+(Q-T)*(8*f+4*(1-f)),J=t.children[K];J&&(R||(R=J,R.next=t.next),Y&&(Y.next=J),Y=J,J.next=t.next)}t=R||t.next}return d}getRegionStatistics(e){let t=this._root,s=0,r=0,a=0;const n={},{bounds:o,geohashBounds:h,level:u}=e,[d,l,c,g]=o;let _=0;for(;t!==null;){const p=t.depth,f=t.xNode,x=t.yNode;if(p>=u){const ee=t.xTotal/t.count,te=t.yTotal/t.count;ee>d&&ee<=c&&te>l&&te<=g&&(s+=t.count,r+=t.xTotal,a+=t.yTotal,t.count===1&&(_=t.referenceId),this._aggregateStatistics(n,t.statistics)),t=t.next;continue}const y=Math.ceil((p+1)/2),S=Math.floor((p+1)/2),m=1-p%2,I=30-(3*y+2*S),v=30-(2*y+3*S),w=~((1<>I,T=(h.yLL&M)>>v,C=(h.xTR&w)>>I,A=(h.yTR&M)>>v,E=f<<3*m+2*(1-m),U=x<<2*m+3*(1-m),B=E+8*m+4*(1-m),Z=U+4*m+8*(1-m),R=Math.max(E,F),Y=Math.max(U,T),Q=Math.min(B,C),q=Math.min(Z,A);let K=null,J=null;for(let ee=Y;ee<=q;ee++)for(let te=R;te<=Q;te++){const vs=te-E+(ee-U)*(8*m+4*(1-m)),L=t.children[vs];if(L){if(ee!==Y&&ee!==q&&te!==R&&te!==Q){const Ut=L.xTotal/L.count,Rt=L.yTotal/L.count;Ut>d&&Ut<=c&&Rt>l&&Rt<=g&&(s+=L.count,r+=L.xTotal,a+=L.yTotal,L.count===1&&(_=L.referenceId),this._aggregateStatistics(n,L.statistics));continue}K||(K=L,K.next=t.next),J&&(J.next=L),J=L,L.next=t.next}}t=K||t.next}return{count:s,attributes:this.normalizeStatistics(n,s),xTotal:r,yTotal:a,referenceId:_}}getBins(e){const t=[],{geohashBounds:s,level:r}=e;let a=this._root;for(;a!==null;){const n=a.depth,o=a.xNode,h=a.yNode;if(n>=r){t.push(a),a=a.next;continue}const u=Math.ceil((n+1)/2),d=Math.floor((n+1)/2),l=1-n%2,c=30-(3*u+2*d),g=30-(2*u+3*d),_=~((1<>c,x=(s.yLL&p)>>g,y=(s.xTR&_)>>c,S=(s.yTR&p)>>g,m=o<<3*l+2*(1-l),I=h<<2*l+3*(1-l),v=m+8*l+4*(1-l),w=I+4*l+8*(1-l),M=Math.max(m,f),F=Math.max(I,x),T=Math.min(v,y),C=Math.min(w,S);let A=null,E=null;for(let U=F;U<=C;U++)for(let B=M;B<=T;B++){const Z=B-m+(U-I)*(8*l+4*(1-l)),R=a.children[Z];R&&(A||(A=R,A.next=a.next),E&&(E.next=R),E=R,R.next=a.next)}a=A||a.next}return t}_linkChildren(e){let t=null,s=null;for(let r=0;r<=e.children.length;r++){const a=e.children[r];a&&(t||(t=a,t.next=e.next),s&&(s.next=a),s=a,a.next=e.next)}return t}_updateStatisticsCursor(e,t,s){for(const r of this._statisticFields){const a=r.name,n=r.inField?e.readAttribute(r.inField):e.getComputedNumericAtIndex(r.inFieldIndex);switch(r.statisticType){case"min":{if(isNaN(n))break;if(!t.statistics[a]){t.statistics[a]={value:n};break}const o=t.statistics[a].value;t.statistics[a].value=Math.min(o,n);break}case"max":{if(isNaN(n))break;if(!t.statistics[a]){t.statistics[a]={value:n};break}const o=t.statistics[a].value;t.statistics[a].value=Math.max(o,n);break}case"count":break;case"sum":case"avg":{t.statistics[a]||(t.statistics[a]={value:0,nanCount:0});const o=t.statistics[a].value,h=t.statistics[a].nanCount??0;n==null||isNaN(n)?t.statistics[a].nanCount=h+s:t.statistics[a].value=o+s*n;break}case"avg_angle":{t.statistics[a]||(t.statistics[a]={x:0,y:0,nanCount:0});const o=t.statistics[a].x,h=t.statistics[a].y,u=t.statistics[a].nanCount??0,d=Math.PI/180;n==null||isNaN(n)?t.statistics[a].nanCount=u+s:(t.statistics[a].x=o+s*Math.cos(n*d),t.statistics[a].y=h+s*Math.sin(n*d));break}case"mode":{t.statistics[a]||(t.statistics[a]={});const o=t.statistics[a][n]||0;t.statistics[a][n]=o+s;break}}}}_aggregateStatistics(e,t){for(const s of this._statisticFields){const r=s.name;switch(s.statisticType){case"min":{if(!e[r]){e[r]={value:t[r].value};break}const a=e[r].value;e[r].value=Math.min(a,t[r].value);break}case"max":{if(!e[r]){e[r]={value:t[r].value};break}const a=e[r].value;e[r].value=Math.max(a,t[r].value);break}case"count":break;case"sum":case"avg":case"avg_angle":case"mode":e[r]||(e[r]={});for(const a in t[r]){const n=e[r][a]||0;e[r][a]=n+t[r][a]}}}}normalizeStatistics(e,t){const s={};for(const r of this._statisticFields){const a=r.name;switch(r.statisticType){case"min":case"max":{const n=e[a];if(!t||!n)break;s[a]=n.value;break}case"count":if(!t)break;s[a]=t;break;case"sum":{if(!t)break;const{value:n,nanCount:o}=e[a];if(!(t-o))break;s[a]=n;break}case"avg":{if(!t)break;const{value:n,nanCount:o}=e[a];if(!(t-o))break;s[a]=n/(t-o);break}case"avg_angle":{if(!t)break;const{x:n,y:o,nanCount:h}=e[a];if(!(t-h))break;const u=n/(t-h),d=o/(t-h),l=180/Math.PI,c=Math.atan2(d,u)*l;s[a]=c;break}case"mode":{const n=e[a];let o=0,h=0,u=null;for(const d in n){const l=n[d];l===o?h+=1:l>o&&(o=l,h=1,u=d)}s[a]=u==="null"||h>1?null:u;break}}}return s}};class ot{constructor(e,t,s,r){this.count=0,this.xTotal=0,this.yTotal=0,this.statistics={},this.displayId=0,this.referenceId=0,this.displayIds=new Set,this.next=null,this.depth=0,this.xNode=0,this.yNode=0,this.xGeohashTotal=0,this.yGeohashTotal=0,this._tree=e,this.children=new Array(32);for(let a=0;a=s)return this;const o=1-r%2,h=3*o+2*(1-o),u=2*o+3*(1-o),d=30-a-h,l=30-n-u,c=((e&7*o+3*(1-o)<>d)+((t&3*o+7*(1-o)<>l)*(8*o+4*(1-o)),g=this.children[c];return g==null?null:g.find(e,t,s,r+1,a+h,n+u)}}const ht=ae.getLogger("esri.view.2d.layers.features.support.BinStore"),Jt=12,Ri=64,Di=_t(),Bi=5;function Wt(i){return 57.29577951308232*i}let Oi=class extends wt{constructor(e,t,s,r){super(e,s),this.type="bin",this.events=new ke,this.objectIdField="aggregateId",this.featureAdapter=Ft,this._geohashLevel=Bi,this._geohashBuf=[],this._serviceInfo=r,this.geometryInfo=e.geometryInfo,this._spatialReference=t,this._projectionSupportCheck=fs(t,ie.WGS84),this._bitsets.geohash=s.getBitset(s.createBitset()),this._bitsets.inserted=s.getBitset(s.createBitset())}destroy(){this._tree&&this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,t){const s=this._schema;try{await super.updateSchema(e,t),await this._projectionSupportCheck}catch{}this._fields=this._schema.params.fields,this._fieldsIndex=new H(this._fields);const r=ye(s,t);t&&(r!=null||e.source||e.storage.filters)?((Ee(r,"params.fields")||Ee(r,"params")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new xs(this._statisticFields,this._serviceInfo),this._tree.onRelease=a=>a.displayId&&this._storage.releaseDisplayId(a.displayId),this._geohashLevel=this._schema.params.fixedBinLevel,this._rebuildTree(),b("esri-2d-update-debug")&&ht.info("Aggregate mesh needs update due to tree changing")),b("esri-2d-update-debug")&&ht.info("Aggregate mesh needs update due to tree changing"),e.targets[t.name]=!0,e.mesh=!1):s&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet(s=>{if(!e.has(s)){const r=t.lookupByDisplayIdUnsafe(s);this._remove(r)}})}sweepAggregates(e,t,s){}onTileData(e,t,s,r,a,n=!0){if(!this._schema||t.addOrUpdate==null)return t;this.events.emit("changed");const o=this._getTransforms(e,this._spatialReference);{const u=t.addOrUpdate.getCursor();for(;u.next();)this._update(u,r)}if(t.status.mesh||!n)return t;const h=new Array;this._getBinsForTile(h,e,o,s),t.addOrUpdate=G.fromOptimizedFeatures(h,{fields:this.fields,fieldsIndex:this._fieldsIndex,geometryType:"esriGeometryPolygon",objectIdField:this.objectIdField}),t.addOrUpdate.attachStorage(s),t.end=!0,t.isRepush||(t.clear=!0);{const u=t.addOrUpdate.getCursor();for(;u.next();){const d=u.getDisplayId();this._bitsets.computed.unset(d),this.setComputedAttributes(s,u,d,e.scale,a)}}return t}forEachBin(e){this._tree.forEach(e)}forEach(e){this._tree.forEach(t=>{if(t.depth!==this._geohashLevel)return;const s=this._toFeatureJSON(t),r=G.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields,fieldsIndex:this._fieldsIndex}).getCursor();r.next(),e(r)})}forEachInBounds(e,t){}forEachBounds(e,t){const{hasM:s,hasZ:r}=this.geometryInfo;for(const a of e){const n=ls(Di,a.readGeometry(),r,s);n!=null&&t(n)}}onTileUpdate(e){}getAggregate(e){const t=Et(e,!0),s=this._tree.findIf(r=>r.displayId===t);return s?this._toFeatureJSON(s):null}getAggregates(){return this._tree.findAllIf(e=>e.depth===this._geohashLevel).map(this._toFeatureJSON.bind(this))}getDisplayId(e){var t;return(t=this._tree.findIf(s=>s.id===e))==null?void 0:t.displayId}getFeatureDisplayIdsForAggregate(e){const t=this._tree.findIf(s=>s.id===e);return t!=null?Array.from(t.displayIds):[]}getDisplayIdForReferenceId(e){var t;return(t=this._tree.findIf(s=>s.displayIds.size===1&&s.displayIds.has(e)))==null?void 0:t.displayId}_toFeatureJSON(e){const t=this._spatialReference;return{displayId:e.displayId,attributes:e.getAttributes(),geometry:$e(e.getGeometry(t),"esriGeometryPolygon",!1,!1),centroid:null}}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),a=this._geohashBuf[2*t],n=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,a,n,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,a=t.isVisible(s);if(a===r.has(s))return;if(!a)return void this._remove(e);const n=e.getXHydrated(),o=e.getYHydrated();if(!this._setGeohash(s,n,o))return;const h=this._geohashBuf[2*s],u=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,n,o,h,u,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const a=Wt(t/re.radius),n=a-360*Math.floor((a+180)/360),o=Wt(Math.PI/2-2*Math.atan(Math.exp(-s/re.radius)));Ze(r,e,o,n,Jt)}else{const a=xe({x:t,y:s},this._spatialReference,ie.WGS84);if(!a)return!1;Ze(r,e,a.y,a.x,Jt)}return this._bitsets.geohash.set(e),!0}_getBinsForTile(e,t,s,r){try{const a=this._getGeohashBounds(t),n=this._tree.getBins(a);for(const o of n){o.displayId||(o.displayId=r.createDisplayId(!0));let h=null;const u=o.getGeometry(this._spatialReference,s.tile);u||(h=o.getGeometryCentroid(this._spatialReference,s.tile));const d=new mt(u,o.getAttributes(),h);d.objectId=o.id,d.displayId=o.displayId,e.push(d)}}catch{return void ht.error("Unable to get bins for tile",t.key.id)}}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return je(r,t,e,s),r}_getGeohashBounds(e){const t=this._getGeohashLevel(e.key.level),s=[e.extent.xmin,e.extent.ymin,e.extent.xmax,e.extent.ymax],r=cs.fromExtent(vt.fromBounds(s,this._spatialReference)),a=xe(r,this._spatialReference,ie.WGS84,{densificationStep:e.resolution*Ri}),n=bt(new D,a,!1,!1),o=n.coords.filter((p,f)=>!(f%2)),h=n.coords.filter((p,f)=>f%2),u=Math.min(...o),d=Math.min(...h),l=Math.max(...o),c=Math.max(...h),g=this._getGeohash(u,d,t),_=this._getGeohash(l,c,t);return{bounds:s,geohashBounds:{xLL:g.geohashX,yLL:g.geohashY,xTR:_.geohashX,yTR:_.geohashY},level:t}}_getGeohashLevel(e){return this._schema.params.fixedBinLevel}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=gs(t);if(!r)return{tile:s,left:null,right:null};const[a,n]=r.valid;return{tile:s,left:{...s,translate:[n,e.bounds[3]]},right:{...s,translate:[a-n+e.bounds[0],e.bounds[3]]}}}};const ut=12,qi=64,Kt=1,Li=_t();class kt extends Ns{constructor(e,t,s,r,a){super(new D([],[t,s]),r,null,e),this.geohashBoundsInfo=a}get count(){return this.attributes.cluster_count}static create(e,t,s,r,a,n,o,h){const u=new kt(t,s,r,n,o);return u.displayId=e.createDisplayId(!0),u.referenceId=h,u.tileLevel=a,u}update(e,t,s,r,a,n){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=a,this.referenceId=null,this.referenceId=n,this}toJSON(){return{attributes:{...this.attributes,aggregateId:this.objectId,referenceId:this.attributes.cluster_count===1?this.referenceId:null},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function ce(i){return 57.29577951308232*i}class zi extends wt{constructor(e,t,s,r){super(e,s),this.type="cluster",this.events=new ke,this.objectIdField="aggregateId",this.featureAdapter=Ft,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this._serviceInfo=r,this.geometryInfo=e.geometryInfo,this._spatialReference=t,this._projectionSupportCheck=fs(t,ie.WGS84),this._bitsets.geohash=s.getBitset(s.createBitset()),this._bitsets.inserted=s.getBitset(s.createBitset())}destroy(){this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,t){const s=this._schema;try{await super.updateSchema(e,t),await this._projectionSupportCheck}catch{}this._fields=[...this._schema.params.fields,{name:"referenceId",alias:"referenceId",type:"esriFieldTypeInteger"}],this._fields.some(a=>a.name==="cluster_count")||this._fields.push({name:"cluster_count",alias:"cluster_count",type:"esriFieldTypeInteger"}),this._fieldsIndex=new H(this._fields);const r=ye(s,t);t&&(r!=null||e.source||e.storage.filters)?((Ee(r,"params.fields")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new xs(this._statisticFields,this._serviceInfo),this._rebuildTree(),b("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),b("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",r),e.targets[t.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):s&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet(s=>{if(!e.has(s)){const r=t.lookupByDisplayIdUnsafe(s);this._remove(r)}})}sweepAggregates(e,t,s){this._clusters.forEach((r,a)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(a))})}onTileData(e,t,s,r,a,n=!0){if(!this._schema||t.addOrUpdate==null)return t;this.events.emit("changed");const o=this._getTransforms(e,this._spatialReference);{const d=t.addOrUpdate.getCursor();for(;d.next();)this._update(d,r)}if(t.status.mesh||!n)return t;const h=new Array,u=this._schema.params.clusterRadius;this._getClustersForTile(h,e,u,s,o),t.addOrUpdate=G.fromOptimizedFeatures(h,{fields:this.fields,fieldsIndex:this._fieldsIndex,geometryType:"esriGeometryPoint",objectIdField:this.objectIdField}),t.addOrUpdate.attachStorage(s),t.clear=!0,t.end=!0;{const d=t.addOrUpdate.getCursor();for(;d.next();){const l=d.getDisplayId();this._bitsets.computed.unset(l),this.setComputedAttributes(s,d,l,e.scale,a)}}return this._aggregateValueRangesChanged&&t.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),t}onTileUpdate({added:e,removed:t}){if(e.length){const r=e[0].level;this._tileLevel=r,this._setGeohashLevel(r)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach(r=>{this._tiles.delete(r.key.id),this._markTileClustersForDeletion(r,s)})}getAggregate(e){for(const t of this._clusters.values())if(((t==null?void 0:t.displayId)&$)==(e&$))return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())(t==null?void 0:t.tileLevel)===this._tileLevel&&e.push(t.toJSON());return e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);return t?this._tree.getRegionDisplayIds(t.geohashBoundsInfo):[]}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if((t==null?void 0:t.referenceId)===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){this._clusters.forEach(t=>{if(!t)return;const s=t.toJSON(),r=G.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields,fieldsIndex:this._fieldsIndex}).getCursor();r.next(),e(r)})}forEachInBounds(e,t){}forEachBounds(e,t){const{hasM:s,hasZ:r}=this.geometryInfo;for(const a of e){const n=ls(Li,a.readGeometry(),r,s);n!=null&&t(n)}}size(){let e=0;return this.forEach(t=>e++),e}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),a=this._geohashBuf[2*t],n=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,a,n,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,a=t.isVisible(s);if(a===r.has(s))return;if(!a)return void this._remove(e);const n=e.getXHydrated(),o=e.getYHydrated();if(!this._setGeohash(s,n,o))return;const h=this._geohashBuf[2*s],u=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,n,o,h,u,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const a=ce(t/re.radius),n=a-360*Math.floor((a+180)/360),o=ce(Math.PI/2-2*Math.atan(Math.exp(-s/re.radius)));Ze(r,e,o,n,ut)}else{const a=xe({x:t,y:s},this._spatialReference,ie.WGS84);if(!a)return!1;Ze(r,e,a.y,a.x,ut)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,t,s,r,a,n=!0){const o=this._schema.params.clusterPixelBuffer,h=2*s,u=Math.ceil(2**t.key.level*j/h)+1,d=Math.ceil(o/h)+0,l=Math.ceil(j/h),{row:c,col:g}=t.key,_=g*j,p=c*j,f=Math.floor(_/h)-d,x=Math.floor(p/h)-d,y=f+l+2*d,S=x+l+2*d,m=t.tileInfoView.getLODInfoAt(t.key.level);for(let I=f;I<=y;I++)for(let v=x;v<=S;v++){let w=I;m.wrap&&(w=I<0?I+u:I%u);const M=m.wrap&&I<0,F=m.wrap&&I%u!==I,T=this._lookupCluster(r,m,t.key.level,w,v,t);if(T!=null){let C=null;if(a&&(C=M?a.left:F?a.right:a.tile),n&&C==null||!T.count)continue;if(C!=null&&n){const A=T.geometry.clone();let E=T.attributes;A.coords[0]=us(C,A.coords[0]),A.coords[1]=ds(C,A.coords[1]),T.count===1&&T.referenceId!=null&&(E={...T.attributes,referenceId:T.referenceId});const U=new mt(A,E);U.displayId=T.displayId,e.push(U)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),ut)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=(Math.floor(t/Kt)+1)*Kt-1;if(this._geohashLevel!==s)return this._geohashLevel=s,this._rebuildTree(),void this._bitsets.geohash.clear()}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=gs(t);if(!r)return{tile:s,left:null,right:null};const[a,n]=r.valid;return{tile:s,left:{...s,translate:[n,e.bounds[3]]},right:{...s,translate:[a-n+e.bounds[0],e.bounds[3]]}}}_getClusterId(e,t,s){return(15&e)<<28|(16383&t)<<14|16383&s}_markForDeletion(e,t,s){const r=this._getClusterId(e,t,s);this._clusters.delete(r)}_getClusterBounds(e,t,s){const r=this._schema.params.clusterRadius,a=2*r;let n=s%2?t*a:t*a-r;const o=s*a;let h=n+a;const u=o-a,d=2**e.level*j;e.wrap&&n<0&&(n=0),e.wrap&&h>d&&(h=d);const l=n/j,c=o/j,g=h/j,_=u/j;return[e.getXForColumn(l),e.getYForRow(c),e.getXForColumn(g),e.getYForRow(_)]}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return je(r,t,e,s),r}_getGeohashBounds(e,t){const s=this._getGeohashLevel(e.key.level);if(this._spatialReference.isWebMercator){const[p,f,x,y]=t,S={x:p,y:f},m={x,y};let I=0,v=0,w=0,M=0;{const C=ce(S.x/re.radius);I=C-360*Math.floor((C+180)/360),v=ce(Math.PI/2-2*Math.atan(Math.exp(-S.y/re.radius)))}{const C=ce(m.x/re.radius);w=C-360*Math.floor((C+180)/360),M=ce(Math.PI/2-2*Math.atan(Math.exp(-m.y/re.radius)))}const F={geohashX:0,geohashY:0},T={geohashX:0,geohashY:0};return je(F,v,I,s),je(T,M,w,s),{bounds:[p,f,x,y],geohashBounds:{xLL:F.geohashX,yLL:F.geohashY,xTR:T.geohashX,yTR:T.geohashY},level:s}}const r=cs.fromExtent(vt.fromBounds(t,this._spatialReference)),a=xe(r,this._spatialReference,ie.WGS84,{densificationStep:e.resolution*qi});if(!a)return null;const n=bt(new D,a,!1,!1),o=n.coords.filter((p,f)=>!(f%2)),h=n.coords.filter((p,f)=>f%2),u=Math.min(...o),d=Math.min(...h),l=Math.max(...o),c=Math.max(...h),g=this._getGeohash(u,d,s),_=this._getGeohash(l,c,s);return{bounds:t,geohashBounds:{xLL:g.geohashX,yLL:g.geohashY,xTR:_.geohashX,yTR:_.geohashY},level:s}}_lookupCluster(e,t,s,r,a,n){const o=this._getClusterId(s,r,a),h=this._clusters.get(o),u=this._getClusterBounds(t,r,a),d=this._getGeohashBounds(n,u);if(d==null)return null;const l=this._tree.getRegionStatistics(d),{count:c,xTotal:g,yTotal:_,referenceId:p}=l,f=c?g/c:0,x=c?_/c:0;if(c===0)return this._clusters.set(o,null),null;const y={cluster_count:c,...l.attributes},S=h!=null?h.update(f,x,s,y,d,p):kt.create(e,o,f,x,s,y,d,p);if(c===0){const[m,I,v,w]=u;S.geometry.coords[0]=(m+v)/2,S.geometry.coords[1]=(I+w)/2}return this._clusters.set(o,S),this._updateAggregateValueRangeForCluster(S,S.tileLevel),S}_updateAggregateValueRangeForCluster(e,t){const s=this._aggregateValueRanges[t]||{minValue:1/0,maxValue:0},r=s.minValue,a=s.maxValue;s.minValue=Math.min(r,e.count),s.maxValue=Math.max(a,e.count),this._aggregateValueRanges[t]=s,r===s.minValue&&a===s.maxValue||(this._aggregateValueRangesChanged=!0)}_markTileClustersForDeletion(e,t){const s=2*t,r=Math.ceil(j/s),{row:a,col:n}=e.key,o=n*j,h=a*j,u=Math.floor(o/s),d=Math.floor(h/s);for(let l=u;le))for(;i.length<=e;)i.push(t)}let Pi=class{constructor(){this._numerics=[],this._strings=[],this._idGenerator=new Gi,this._allocatedSize=256,this._bitsets=[],this._instanceIds=[],this._bounds=[]}createBitset(){const e=this._bitsets.length;return this._bitsets.push(_s.create(this._allocatedSize,$)),e+1}getBitset(e){return this._bitsets[e-1]}_expand(){this._allocatedSize<<=1;for(const e of this._bitsets)e.resize(this._allocatedSize)}_ensureNumeric(e,t){this._numerics[e]||(this._numerics[e]=[]),Ge(this._numerics[e],t,0)}_ensureInstanceId(e){Ge(this._instanceIds,e,0)}_ensureString(e,t){this._strings[e]||(this._strings[e]=[]),Ge(this._strings[e],t,null)}createDisplayId(e=!1){const t=this._idGenerator.createId();return t>this._allocatedSize&&this._expand(),Et(t,e)}releaseDisplayId(e){for(const t of this._bitsets)t.unset(e);return this._idGenerator.releaseId(e&$)}getComputedNumeric(e,t){return this.getComputedNumericAtIndex(e&$,0)}setComputedNumeric(e,t,s){return this.setComputedNumericAtIndex(e&$,s,0)}getComputedString(e,t){return this.getComputedStringAtIndex(e&$,0)}setComputedString(e,t,s){return this.setComputedStringAtIndex(e&$,0,s)}getComputedNumericAtIndex(e,t){const s=e&$;return this._ensureNumeric(t,s),this._numerics[t][s]}setComputedNumericAtIndex(e,t,s){const r=e&$;this._ensureNumeric(t,r),this._numerics[t][r]=s}getInstanceId(e){const t=e&$;return this._ensureInstanceId(t),this._instanceIds[t]}setInstanceId(e,t){const s=e&$;this._ensureInstanceId(s),this._instanceIds[s]=t}getComputedStringAtIndex(e,t){const s=e&$;return this._ensureString(t,s),this._strings[t][s]}setComputedStringAtIndex(e,t,s){const r=e&$;this._ensureString(t,r),this._strings[t][r]=s}getXMin(e){return this._bounds[4*(e&$)]}getYMin(e){return this._bounds[4*(e&$)+1]}getXMax(e){return this._bounds[4*(e&$)+2]}getYMax(e){return this._bounds[4*(e&$)+3]}setBounds(e,t){const s=t.readHydratedGeometry();if(!(s!=null&&s.coords.length))return!1;let r=1/0,a=1/0,n=-1/0,o=-1/0;s.forEachVertex((u,d)=>{r=Math.min(r,u),a=Math.min(a,d),n=Math.max(n,u),o=Math.max(o,d)});const h=e&$;return Ge(this._bounds,4*h+4,0),this._bounds[4*h]=r,this._bounds[4*h+1]=a,this._bounds[4*h+2]=n,this._bounds[4*h+3]=o,!0}};const ji=5e3,Ni="tileRenderer.featuresView.attributeView.initialize",Qi="tileRenderer.featuresView.attributeView.requestUpdate",Yi="tileRenderer.featuresView.requestRender";function Xi(i){return i.name==="worker:port-closed"}function se(i){if(!Ie(i)&&!Xi(i))throw i}function es(i){return i.type==="feature"&&i.mode==="snapshot"}let N=class extends xt{constructor(){super(...arguments),this._storage=new Pi,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this._updatingHandles=new It,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new lt({concurrency:this._source.type==="stream"?1:4,process:(i,e)=>this._onTileMessage(i,{signal:e})}),this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this)),Qs(()=>!this.updating,()=>this.onIdle())])}_initSource(){const i=this.tileStore.tileScheme,e=()=>this._updateQueue&&this._updateQueue.length<50,t=(s,r)=>(this._invalidated=!0,this._patchTile(s,r));this._source=oi(this.service,{...this.service,fieldsIndex:this.fieldsIndex},this.spatialReference,i,t,e,this.featureStore),this._proxyEvents()}_setStreamClientProperty(i,e){this.remoteClient.invoke("setProperty",{propertyName:i,value:e}).catch(se)}_proxyEvents(){if(this._source.type==="stream"){const i=this._source.events,e=this._source;this.addHandles([Ve(()=>e.connectionStatus,t=>this._setStreamClientProperty("pipelineConnectionStatus",t),{initial:!0}),Ve(()=>e.errorString,t=>this._setStreamClientProperty("pipelineErrorString",t),{initial:!0}),i.on("data-received",t=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:t.attributes,centroid:t.centroid,geometry:t.geometry}}).catch(se)),i.on("message-received",t=>this.remoteClient.invoke("emitEvent",{name:"message-received",event:t}).catch(se)),i.on("updateRate",t=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...t}}).catch(se))])}}_initAttributeStore(i){this.attributeStore||(this.attributeStore=new Ui({type:"remote",initialize:(e,t)=>Pe(this.remoteClient.invoke(Ni,e,{signal:t}).catch(se)),update:(e,t)=>Pe(this.remoteClient.invoke(Qi,e,{signal:t}).catch(se)),render:e=>Pe(this.remoteClient.invoke(Yi,void 0,{signal:e}).catch(se))},i))}_initStores(){const i=this.service.type==="snapshot"?"snapshot":"on-demand",e={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex};this.featureStore=new Mr(e,this._storage,i)}_initQueryEngine(i){var t;const e=this;(t=this.featureQueryEngine)==null||t.destroy(),this.featureQueryEngine=new Dt({availableFields:i.availableFields,definitionExpression:i.schema.source.definitionExpression??void 0,fieldsIndex:H.fromJSON(this.service.fieldsIndex),geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(s){return e.aggregateStore==null?[]:e.aggregateStore.getFeatureDisplayIdsForAggregate(s).map(r=>e.getObjectId(r))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(i,e){var s;if((s=this.aggregateQueryEngine)==null||s.destroy(),i==null)return;const t=e.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new Dt({definitionExpression:void 0,fieldsIndex:H.fromLayerJSON({fields:t,dateFieldsTimeReference:{timeZoneIANA:Ys}}),geometryType:i.geometryInfo.geometryType,objectIdField:i.objectIdField,hasM:i.geometryInfo.hasM,hasZ:i.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:i,aggregateAdapter:{getFeatureObjectIds:r=>[]}})}destroy(){var i,e,t;this._updateQueue.destroy(),this._source.destroy(),(i=this.featureQueryEngine)==null||i.destroy(),(e=this.aggregateQueryEngine)==null||e.destroy(),(t=this.attributeStore)==null||t.destroy();for(const s of this.tileStore.tiles)this._source.unsubscribe(s);clearInterval(this._checkUpdating),this._updatingHandles.destroy()}get fieldsIndex(){return H.fromJSON(this.service.fieldsIndex)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get dataUpdating(){return this._source.updatingHandles.updating}get updating(){return this.isUpdating()}isUpdating(){const i=this._source.updatingHandles.updating,e=!this.attributeStore||this.attributeStore.updatingHandles.updating,t=i||e||this._updatingHandles.updating;if(b("esri-2d-log-updating")){let s=`Updating FeatureController2D: ${t} -`;s+=` -> updatingSource ${i} -`;for(const r of this._source.subscriptions)s+=` ${r.tile.id} ${r.isDone} -`;s+=` -> updatingAttributeStore ${e} -`,s+=` -> updatingHandles ${this._updatingHandles.updating} (queue: ${this._updateQueue.length}) -`,console.log(s)}return t}updateCustomParameters(i){this._source.type==="stream"&&this._source.updateCustomParameters(i)}enableEvent(i){this._source.enableEvent(i.name,i.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){this._source.type==="stream"&&this._source.pauseStream()}resumeStream(){this._source.type==="stream"&&this._source.resumeStream()}sendMessageToSocket(i){this._source.type==="stream"&&this._source.sendMessageToSocket(i)}sendMessageToClient(i){this._source.type==="stream"&&this._source.sendMessageToClient(i)}_initAggregateStore(i){var t,s,r,a,n;const e=((s=(t=i.schema.targets)==null?void 0:t.aggregate)==null?void 0:s.type)??null;if((((n=(a=(r=this.config)==null?void 0:r.schema.targets)==null?void 0:a.aggregate)==null?void 0:n.type)??null)!==e&&(this.aggregateStore!=null&&(this.removeHandles("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),e)){switch(e){case"cluster":{const o={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new zi(o,this.spatialReference,this._storage,{...this.service,fieldsIndex:this.fieldsIndex}),this.addHandles(this.aggregateStore.events.on("valueRangesChanged",h=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:h.valueRanges}}).catch(se)}),"valueRangesChanged");break}case"bin":{const o={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new Oi(o,this.spatialReference,this._storage,{...this.service,fieldsIndex:this.fieldsIndex});break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(i,e){var t;this._updateVersion++,b("esri-2d-update-debug")&&console.debug(`FeatureController2D::update: Token version ${this._updateVersion}`),this._initQueryEngine(e),this._initAttributeStore(e),this.pause(),((t=this.config)==null?void 0:t.timeZone)!==e.timeZone&&(i.mesh=!0,i.storage.data=!0,i.storage.filters=!0,i.targets.aggregate=!0,i.targets.feature=!0,this.featureStore.invalidate()),await Promise.all([this._source.update(i,e.schema.source),this.featureStore.updateSchema(i,e.schema.targets.feature),this.attributeStore.update(i,e),this.attributeStore.updateFilters(i,e,this)]),this._initAggregateStore(e),this.aggregateStore!=null&&await this.aggregateStore.updateSchema(i,e.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,e.schema),b("esri-2d-update-debug")&&i.describe(),this._set("config",e)}async applyUpdate(i){i.version=this._updateVersion,b("esri-2d-update-debug")&&console.debug(`FeatureController2D::applyUpdate: Token version ${i.version}`),i.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(i),b("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for source update to finish"),this.notifyChange("updating"),await De(()=>!this.updating),b("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Source update finsihed"),this.aggregateStore!=null&&(await hs(10),b("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for aggregate idle call"),await De(()=>!this.updating),b("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Aggregate idle called")),b("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Update finished")}async onEdits({edits:i}){b("esri-2d-update-debug")&&console.debug("Applying Edit:",i),this._didEdit=!0;try{const e=i.removed.map(s=>s.objectId&&s.objectId!==-1?s.objectId:this._lookupObjectIdByGlobalId(s.globalId)),t=i.addOrModified.map(({objectId:s})=>s);this.featureStore.invalidate(),await this._source.edit(t,e),this.clearTiles(),this.notifyChange("updating"),this.aggregateStore!=null&&this.aggregateStore.clear(),await this._source.resend(),await De(()=>!this.updating)}catch{}}async refresh(i){if(!i.dataChanged){const e=z.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion,i),this._cleanupNeeded=!0,this.notifyChange("updating"),await De(()=>!this.updating)}clearTiles(){for(const i of this.tileStore.tiles)this.processor.onTileClear(i,!1)}onTileUpdate(i){this.aggregateStore!=null&&this.aggregateStore.onTileUpdate(i);for(const e of i.added){const t=this._source.subscribe(e,this._updateVersion);this._source.type!=="stream"&&this._updatingHandles.addPromise(t.done),this._level=e.level}for(const e of i.removed)this._source.unsubscribe(e),this._cleanupNeeded=!0,this._tileToResolver.has(e.id)&&(this._tileToResolver.get(e.id).resolve(),this._tileToResolver.delete(e.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,this.aggregateStore==null&&this.processor.type!=="heatmap"||await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:i,params:e}){return this.featureQueryEngine.executeQueryForSummaryStatistics(i,e)}async queryAggregateSummaryStatistics({query:i,params:e}){return this.aggregateQueryEngine.executeQueryForSummaryStatistics(this._normalizeAggregateQuery(i),e)}async queryUniqueValues({query:i,params:e}){return this.featureQueryEngine.executeQueryForUniqueValues(i,e)}async queryAggregateUniqueValues({query:i,params:e}){return this.aggregateQueryEngine.executeQueryForUniqueValues(this._normalizeAggregateQuery(i),e)}async queryClassBreaks({query:i,params:e}){return this.featureQueryEngine.executeQueryForClassBreaks(i,e)}async queryAggregateClassBreaks({query:i,params:e}){return this.aggregateQueryEngine.executeQueryForClassBreaks(this._normalizeAggregateQuery(i),e)}async queryHistogram({query:i,params:e}){return this.featureQueryEngine.executeQueryForHistogram(i,e)}async queryAggregateHistogram({query:i,params:e}){return this.aggregateQueryEngine.executeQueryForHistogram(this._normalizeAggregateQuery(i),e)}queryExtent(i){return this.featureQueryEngine.executeQueryForExtent(i)}queryAggregates(i){return this.aggregateQueryEngine.executeQuery(this._normalizeAggregateQuery(i))}queryAggregateCount(i){return this.aggregateQueryEngine.executeQueryForCount(this._normalizeAggregateQuery(i))}queryAggregateIds(i){return this.aggregateQueryEngine.executeQueryForIds(this._normalizeAggregateQuery(i))}queryFeatures(i){return this.featureQueryEngine.executeQuery(i)}async queryVisibleFeatures(i){const e=await this.featureQueryEngine.executeQuery(i),t=e.objectIdFieldName;return e.features=e.features.filter(s=>{const r=s.attributes[t],a=this.getDisplayId(r);return a!=null&&this.attributeStore.isVisible(a)}),e}queryFeatureCount(i){return this.featureQueryEngine.executeQueryForCount(i)}queryLatestObservations(i){return this.featureQueryEngine.executeQueryForLatestObservations(i)}queryObjectIds(i){return this.featureQueryEngine.executeQueryForIds(i)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(i){return this.featureStore.lookupObjectId(i,this._storage)}getDisplayId(i){if(this.aggregateStore!=null){const e=this.aggregateStore.getDisplayId(i);if(e==null){const t=this.featureStore.lookupDisplayId(i);return this.aggregateStore.getDisplayIdForReferenceId(t)}return e}return this.featureStore.lookupDisplayId(i)}getFeatures(i){const e=[],t=[];for(const s of i){const r=this.aggregateStore!=null?this.getAggregate(s):null;if(r!=null)if(r.attributes.referenceId!=null){const a=this.getFeature(r.attributes.referenceId);a!=null&&e.push(a)}else t.push(r);else{const a=this.getFeature(s);a!=null&&e.push(a)}}return{features:e,aggregates:t}}getFeature(i){const e=this.featureStore.lookupFeatureByDisplayId(i,this._storage);if(e==null)return null;const t=e.readHydratedGeometry(),s=$e(t,e.geometryType,e.hasZ,e.hasM);return{attributes:e.readAttributes(),geometry:s}}getAggregate(i){return this.aggregateStore==null?null:this.aggregateStore.getAggregate(i)}getAggregates(){return this.aggregateStore==null?[]:this.aggregateStore.getAggregates()}async setHighlight(i){const e=i.map(t=>this.getDisplayId(t)).filter(ns);return this.attributeStore.setHighlight(i,e)}_normalizeAggregateQuery(i){const e=i.objectIds??[];for(const t of i.aggregateIds??[])e.push(t);return i.objectIds=e,i.aggregateIds=[],i}_lookupObjectIdByGlobalId(i){const e=this.service.globalIdField;if(e==null)throw new Error("Expected globalIdField to be defined");let t=null;if(this.featureStore.forEach(s=>{i===s.readAttribute(e)&&(t=s.getObjectId())}),t==null)throw new Error(`Expected to find a feature with globalId ${i}`);return t}async _repushCurrentLevelTiles(){const i=this.tileStore.tiles.filter(t=>t.level===this._level);i.map(async t=>this._patchTile({type:"append",id:t.key.id,clear:!0,addOrUpdate:null,end:!1}));const e=i.map(async t=>this._patchTile({type:"append",id:t.key.id,addOrUpdate:G.fromOptimizedFeatures([],{...this.service,fieldsIndex:this.fieldsIndex}),remove:[],end:!0,isRepush:!0,status:z.empty()}));await Promise.all(e)}_maybeForceCleanup(){performance.now()-this._lastCleanup>ji&&this._markAndSweep()}_patchTile(i,e){const t=this._updateQueue.push(i,e).catch(s=>{});return this._updatingHandles.addPromise(t)}async _onTileMessage(i,e){var a,n,o;if(P(e),b("esri-2d-update-debug")){const h=(a=i.addOrUpdate)==null?void 0:a.hasFeatures;console.debug(i.id,`FeatureController:onTileMessage: [clear:${i.clear}, end:${i.end}, features: ${h}]`)}const t=this.tileStore.get(i.id);if(!t)return;if(i.clear)return this.processor.onTileClear(t,i.end);const s=i.status;this._cleanupNeeded=!0;const r=[];for(const h of i.remove??[]){const u=this.featureStore.lookupDisplayId(h);u&&r.push(u)}i.remove=r;try{if(i.addOrUpdate==null)return void this.processor.onTileMessage(t,{...i,addOrUpdate:null},this.aggregateStore!=null,e).catch(He);if(i.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(i.addOrUpdate.instance)&&s.targets.feature||(s.targets.feature=!0,this.featureStore.onTileData(t,i,(n=this.config)==null?void 0:n.timeZone)),(!s.storage.data||!s.storage.filters)&&(s.storage.data=!0,s.storage.filters=!0,this.attributeStore.onTileData(t,i),this._source.type==="stream"||this._didEdit?(await this.attributeStore.sendUpdates(),P(e)):this.attributeStore.sendUpdates()),this.aggregateStore!=null&&!s.targets.aggregate){s.targets.aggregate=!0;const h=es(this._source)&&this._source.loading,u=!es(this._source)||h||i.end;if(this.aggregateStore.onTileData(t,i,this._storage,this.attributeStore,(o=this.config)==null?void 0:o.timeZone,u),!u)return;s.mesh||(this.attributeStore.onTileData(t,i),await this.attributeStore.sendUpdates())}if(!s.mesh){s.mesh=!0;const h=this.aggregateStore!=null&&this.aggregateStore.type==="cluster";await this.processor.onTileMessage(t,i,h,e),P(e)}this._maybeForceCleanup()}catch(h){He(h)}}_mark(i,e,t){const s=(4294901760&this._storage.getInstanceId(i))>>>16;i&&(e.add(s),t.set(i))}_markAndSweep(){if(this._lastCleanup=performance.now(),!(!(this._source.type==="feature"&&this._source.mode==="snapshot")&&(this._source.type==="stream"||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const i=this._storage.getBitset(this._markedIdsBufId),e=new Set;i.clear();for(const t of this.tileStore.tiles)for(const s of this._source.readers(t.id)){const r=s.getCursor();for(;r.next();){let a=r.getDisplayId();if(!a){const n=r.getObjectId();a=this.featureStore.lookupDisplayId(n)}this._mark(a,e,i)}}this.processor.type==="symbol"&&this.processor.forEachBufferId(t=>{this._mark(t,e,i)}),this._updateQueue.forEach(t=>{for(const s of t.remove??[]){const r=this.featureStore.lookupDisplayId(s);this._mark(r,e,i)}}),this.aggregateStore!=null&&(this.aggregateStore.sweepFeatures(i,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(i,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(e)}};k([O({constructOnly:!0})],N.prototype,"tileStore",void 0),k([O()],N.prototype,"config",void 0),k([O({readOnly:!0})],N.prototype,"fieldsIndex",null),k([O()],N.prototype,"processor",void 0),k([O({constructOnly:!0})],N.prototype,"remoteClient",void 0),k([O({constructOnly:!0})],N.prototype,"service",void 0),k([O()],N.prototype,"spatialReference",null),k([O()],N.prototype,"dataUpdating",null),k([O()],N.prototype,"updating",null),N=k([Je("esri.views.2d.layers.features.controllers.FeatureController2D")],N);const Hi=N;let ts=class bs{constructor(e,t){this.key=new ps(0,0,0,0),this.bounds=Xs(),this.objectIds=new Set,this.key.set(t);const s=e.getLODInfoAt(this.key);this.tileInfoView=e,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.scale=s.scale,this.level=s.level}get id(){return this.key.id}get extent(){return vt.fromBounds(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}createChildTiles(){const e=this.key.getChildKeys(),t=Hs.acquire();for(let s=0;s({minX:t.bounds[0],minY:t.bounds[1],maxX:t.bounds[2],maxY:t.bounds[3]}):[".bounds[0]",".bounds[1]",".bounds[2]",".bounds[3]"]),this.tiles=[],this.tileScheme=e}destroy(){this.clear()}clear(){this.tiles.length=0,this._tiles.clear(),this._index.clear()}has(e){return this._tiles.has(e)}get(e){return this._tiles.get(e)}boundsIntersections(e){return this._index.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]})}updateTiles(e){const t={added:[],removed:[]};for(const s of e.added)if(!this.has(s)){const r=new ts(this.tileScheme,s);this._tiles.set(s,r),this._index.insert(r),t.added.push(r)}for(const s of e.removed)if(this.has(s)){const r=this.get(s);this._tiles.delete(s),this._index.remove(r),t.removed.push(r)}this.tiles.length=0,this._tiles.forEach(s=>this.tiles.push(s)),(t.added.length||t.removed.length)&&this.emit("update",t)}setViewState(e){const t=this.tileScheme.getTileCoverage(e,0);if(!t)return;const{spans:s,lodInfo:r}=t,{level:a}=r;if(s.length>0)for(const{row:n,colFrom:o,colTo:h}of s)for(let u=o;u<=h;u++){const d=Vi.set(a,n,r.normalizeCol(u),r.getWorldForColumn(u)).id;if(dt.add(d),!this.has(d)){const l=new ts(this.tileScheme,d);this._tiles.set(d,l),this._index.insert(l),this.tiles.push(l),he.added.push(l)}}for(let n=this.tiles.length-1;n>=0;n--){const o=this.tiles[n];dt.has(o.id)||(this._tiles.delete(o.id),this.tiles.splice(n,1),this._index.remove(o),he.removed.push(o))}(he.added.length||he.removed.length)&&this.emit("update",he),Zs.pool.release(t),dt.clear(),he.added.length=0,he.removed.length=0}},ue=class extends xt{constructor(){super(...arguments),this.controller=null,this.processor=null,this.remoteClient=null,this.tileStore=null,this.service=null,this.viewState=null,this._paused=!1,this._pendingTileUpdates=[]}initialize(){this.addHandles([Ve(()=>this.updating,i=>{this.remoteClient.invoke("setUpdating",i).catch(e=>{})})])}destroy(){var i,e;this.stop(),(i=this.controller)==null||i.destroy(),(e=this.processor)==null||e.destroy(),this.controller=this.processor=this.tileStore=this.remoteClient=null}get updating(){return!this.controller||this.controller.updating}stop(){var i,e,t;this._paused=!0,Array.isArray((i=this.service)==null?void 0:i.source)&&(this.service.source.forEach(s=>s.close()),this.service.source.length=0),(e=this.tileStore)==null||e.updateTiles({added:[],removed:this.tileStore.tiles.map(s=>s.id)}),(t=this.tileStore)==null||t.destroy(),this.tileStore=null,this._pendingTileUpdates.length=0}async startup({service:i,config:e,tileInfo:t,tiles:s}){var r,a,n;if(this._paused=!0,Array.isArray((r=this.service)==null?void 0:r.source)&&(this.service.source.forEach(o=>o.close()),this.service.source.length=0),this.service=i,!this.tileStore||!Js(this.tileStore.tileScheme.spatialReference,t.spatialReference)){const o=new Ws(Ks.fromJSON(t));s.added.length=s.removed.length=0,(a=this.tileStore)==null||a.updateTiles({added:[],removed:this.tileStore.tiles.map(h=>h.id)}),(n=this.tileStore)==null||n.destroy(),this.tileStore=new Zi(o),this._pendingTileUpdates.length=0}for(await this._createProcessorAndController(e),await this.update({config:e}),this.controller.resume(),this.tileStore.clear(),this.tileStore.updateTiles(s),this._paused=!1;this._pendingTileUpdates.length;)this.tileStore.updateTiles(this._pendingTileUpdates.pop())}async updateTiles(i){var e;this._paused?this._pendingTileUpdates.push(i):(e=this.tileStore)==null||e.updateTiles(i)}async update({config:i}){const e=z.empty();return await Promise.all([this.processor.update(e,i),this.controller.update(e,i)]),e.toJSON()}async applyUpdate(i){return this.controller.applyUpdate(z.create(i))}async _createProcessorAndController(i){await Promise.all([this._handleControllerConfig(i),this._handleProcessorConfig(i)]),this.controller.processor=this.processor}async _handleControllerConfig(i){return this._createController(this.service,i)}async _handleProcessorConfig(i){return this._createProcessor(this.service,i)}async _createController(i,e){this.controller&&(this.controller.destroy(),this.removeHandles("controller"));const{tileStore:t,remoteClient:s}=this,r=new Hi({service:i,tileStore:t,remoteClient:s}),a=Ve(()=>r.dataUpdating,n=>{this.remoteClient.invoke("setDataUpdating",n).catch(o=>{})});return this.addHandles(a,"controller"),this.controller=r,r}async _createProcessor(i,e){const t=e.schema.processors[0].type,s=(await fr(t)).default,{remoteClient:r,tileStore:a}=this,n=new s({service:i,config:e,tileStore:a,remoteClient:r});return this.processor&&this.processor.destroy(),this.processor=n,n}};k([O()],ue.prototype,"controller",void 0),k([O()],ue.prototype,"processor",void 0),k([O()],ue.prototype,"updating",null),k([O()],ue.prototype,"viewState",void 0),ue=k([Je("esri.views.2d.layers.features.Pipeline")],ue);const Ji=ue,La=Object.freeze(Object.defineProperty({__proto__:null,default:Ji},Symbol.toStringTag,{value:"Module"}));export{ka as G,Ft as I,La as P,Ea as R,_e as f,$a as k,Ma as p}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/HeatmapProcessor-QI9jD0nx.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/definitions-DqQMJYPH.js","assets/BaseProcessor-nWGHAt7P.js","assets/SymbolProcessor-pXDjnfSh.js","assets/cimAnalyzer-DtyBzAGI.js","assets/labelPoint-ysDT9nFH.js","assets/TileClipper-NSFZXMR1.js","assets/number-sTjsTbdA.js","assets/BidiEngine-8z8MVveq.js","assets/enums-uQoFEhYh.js","assets/TurboLine-SWK4qRwh.js","assets/Rect-bBBxMtVp.js","assets/GeometryUtils-K2DOc0l8.js","assets/FeatureFilter-w5_DYl72.js","assets/QueryEngine-8tLWlkSE.js","assets/WhereClause-XAMIZ4-B.js","assets/TimeOnly-ljWtUK7N.js","assets/json-v6EOeNTY.js","assets/QueryEngineCapabilities-PzVpW5yD.js","assets/utils-P5wTOmqv.js","assets/generateRendererUtils-_1jVE02H.js","assets/StreamFeatureManager-QrKJ84_c.js","assets/quickselect-UFB0jJTZ.js","assets/ogcFeatureUtils-dtzP0u64.js","assets/geojson-fSjaGZrp.js","assets/date-be_IQzZd.js","assets/clientSideDefaults-F-CNnR0g.js","assets/query-rG0aX6cE.js","assets/pbfQueryUtils-pWizwTQZ.js","assets/pbf-o0zzptPp.js","assets/queryZScale-IaMm02_2.js","assets/createConnection-4ppGVnSc.js","assets/geohashUtils-U0jvYCSY.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/Pipeline-PlEwhMAg.js b/dist/assets/Pipeline-PlEwhMAg.js new file mode 100644 index 0000000..59b814e --- /dev/null +++ b/dist/assets/Pipeline-PlEwhMAg.js @@ -0,0 +1,22 @@ +import{de as Ye,R as ae,aF as ye,vr as Ee,dE as b,vs as Ss,eV as D,eO as $e,fZ as ws,vt as Ts,vu as Fs,j3 as Xe,ea as _t,z as ke,vv as As,g9 as Cs,oy as ss,eL as H,ga as Ms,vw as oe,vx as Es,j4 as rs,vy as $s,vz as ks,r as V,eU as mt,uj as Us,vA as Rs,rd as is,nU as Dt,vB as as,vC as Ds,ag as yt,o6 as He,dY as ns,jW as Bs,h as It,br as Pe,dv as os,eo as Os,vD as Ls,aL as qs,vE as zs,vF as lt,ab as P,ac as Ie,av as Gs,e as k,c as Je,uO as Ps,mw as hs,y as O,g as xt,fq as js,gb as Ns,r1 as ct,vG as us,vH as ds,v6 as Qs,vI as X,ks as Ue,kt as Re,bE as Ys,d2 as ie,rl as bt,vJ as Xs,ec as ls,mU as re,j as cs,dO as vt,dZ as gs,vK as Hs,v as Vs,B as Ve,eM as Zs,aa as De,pn as ps,cf as Js,ue as Ws,vL as Ks,vM as er,bt as tr,u$ as sr,eW as rr}from"./index-pCX-0tJH.js";import{j as xe,x as fs,W as Bt}from"./QueryEngine-uvDs-vBe.js";import{t as St,o as ir}from"./StreamFeatureManager-Iguqr18K.js";import{f as ar}from"./quickselect-0UUnLNDW.js";import{m as Be,n as Ot,b as Lt}from"./TimeOnly-gkehHHJx.js";import{a as nr,l as or}from"./labelPoint-1MOq4I_J.js";import{v as qt}from"./ogcFeatureUtils-8dWL_GtH.js";import{createConnection as hr}from"./createConnection-iXdhuUHv.js";import{V as ur,W as dr,S as lr,a as zt,Q as cr,R as gr,c as j}from"./definitions-SVBNHUSH.js";import{E as Se,S as Oe}from"./enums-uQoFEhYh.js";import"./number-sTjsTbdA.js";import{X as pr,b as Ze,Y as je}from"./geohashUtils-U0jvYCSY.js";function fr(i){return i==="heatmap"?Ye(()=>import("./HeatmapProcessor-E3j18Ktz.js"),__vite__mapDeps([0,1,2,3,4])):Ye(()=>import("./SymbolProcessor-dUsJwb8f.js").then(e=>e.S),__vite__mapDeps([5,1,2,6,7,8,3,9,10,11,4,12,13,14]))}function be(i,e){if(!(this instanceof be))return new be(i,e);this._maxEntries=Math.max(4,i||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&(typeof e=="function"?this.toBBox=e:this._initFormat(e)),this.clear()}function _r(i,e,t){if(!t)return e.indexOf(i);for(var s=0;s=i.minX&&e.maxY>=i.minY}function ge(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function jt(i,e,t,s,r){for(var a,n=[e,t];n.length;)(t=n.pop())-(e=n.pop())<=s||(a=e+Math.ceil((t-e)/s/2)*s,ar(i,a,e,t,r),n.push(e,a,a,t))}be.prototype={all:function(){return this._all(this.data,[])},search:function(i){var e=this.data,t=[],s=this.toBBox;if(!qe(i,e))return t;for(var r,a,n,o,h=[];e;){for(r=0,a=e.children.length;r=0&&a[e].children.length>this._maxEntries;)this._split(a,e),e--;this._adjustParentBBoxes(r,a,e)},_split:function(i,e){var t=i[e],s=t.children.length,r=this._minEntries;this._chooseSplitAxis(t,r,s);var a=this._chooseSplitIndex(t,r,s),n=ge(t.children.splice(a,t.children.length-a));n.height=t.height,n.leaf=t.leaf,de(t,this.toBBox),de(n,this.toBBox),e?i[e-1].children.push(n):this._splitRoot(t,n)},_splitRoot:function(i,e){this.data=ge([i,e]),this.data.height=i.height+1,this.data.leaf=!1,de(this.data,this.toBBox)},_chooseSplitIndex:function(i,e,t){var s,r,a,n,o,h,u,d;for(h=u=1/0,s=e;s<=t-e;s++)n=yr(r=Ae(i,0,s,this.toBBox),a=Ae(i,s,t,this.toBBox)),o=et(r)+et(a),n=e;r--)a=i.children[r],Ce(h,i.leaf?n(a):a),u+=Le(h);return u},_adjustParentBBoxes:function(i,e,t){for(var s=t;s>=0;s--)Ce(e[s],i)},_condense:function(i){for(var e,t=i.length-1;t>=0;t--)i[t].children.length===0?t>0?(e=i[t-1].children).splice(e.indexOf(i[t]),1):this.clear():de(i[t],this.toBBox)},_initFormat:function(i){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(i[0])),this.compareMinY=new Function("a","b",e.join(i[1])),this.toBBox=new Function("a","return {minX: a"+i[0]+", minY: a"+i[1]+", maxX: a"+i[2]+", maxY: a"+i[3]+"};")}};function Ir(i,e,t){var r;if(i==null)return null;const s=e.readArcadeFeature();e.contextTimeZone=(r=t.$view)==null?void 0:r.timeZone;try{return i.evaluate({...t,$feature:s},i.services)}catch(a){return ae.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",a),null}}let wt=class{constructor(e,t){this._canCacheExpressionValue=!1,this._sourceInfo=e,this._storage=t,this._bitsets={computed:t.getBitset(t.createBitset())}}get storage(){return this._storage}invalidate(){this._bitsets.computed.clear()}async updateSchema(e,t){const s=ye(this._schema,t);if(this._schema=t,!t||s==null||!Ee(s,"attributes"))return;b("esri-2d-update-debug")&&console.debug("Applying Update - Store:",s),this._bitsets.computed.clear(),e.targets[t.name]=!0;const r=t.attributes,a=[],n=[];for(const o in r){const h=r[o];switch(h.type){case"field":break;case"expression":a.push(this._createArcadeComputedField(h));break;case"label-expression":a.push(this._createLabelArcadeComputedField(h));break;case"statistic":n.push(h)}}this._computedFields=await Promise.all(a),this._canCacheExpressionValue=!this._computedFields.some(o=>o.type==="expression"&&o.expression!=null&&o.expression.referencesScale()),this._statisticFields=n}setComputedAttributes(e,t,s,r,a){const n=this._bitsets.computed;if(!this._canCacheExpressionValue||!n.has(s)){n.set(s);for(const o of this._computedFields){const h=this._evaluateField(t,o,r,a);switch(o.resultType){case"numeric":e.setComputedNumericAtIndex(s,o.fieldIndex,h);break;case"string":e.setComputedStringAtIndex(s,o.fieldIndex,h)}}}}async _createArcadeComputedField(e){const t=this._sourceInfo.spatialReference,s=this._sourceInfo.fieldsIndex;return{...e,expression:await Ss(e.valueExpression,t,s)}}async _createLabelArcadeComputedField(e){const t=this._sourceInfo.spatialReference,s=this._sourceInfo.fieldsIndex,{createLabelFunction:r}=await Ye(()=>import("./index-pCX-0tJH.js").then(n=>n.zZ),__vite__mapDeps([1,2])),a=await r(e.label,s,t);return{...e,builder:a}}_evaluateField(e,t,s,r){switch(t.type){case"label-expression":{const a=e.readArcadeFeature();return t.builder.evaluate(a,r)||""}case"expression":{const{expression:a}=t;return Ir(a,e,{$view:{scale:s,timeZone:r}})}}}},_s=class Ne{static fromBuffer(e,t){return new Ne(e,t)}static create(e,t=4294967295){const s=new Uint32Array(Math.ceil(e/32));return new Ne(s,t)}constructor(e,t){this._mask=0,this._buf=e,this._mask=t}_getIndex(e){return Math.floor(e/32)}has(e){const t=this._mask&e;return!!(this._buf[this._getIndex(t)]&1<>>=1,r++}}countSet(){let e=0;return this.forEachSet(t=>{e++}),e}},we=0;const We=b("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],xr=We[0],br=We[1],vr=We[2],Sr=We[3],Tt=b("featurelayer-simplify-payload-size-factors")??[1,2,4],wr=Tt[0],Tr=Tt[1],Fr=Tt[2],Ar=b("featurelayer-simplify-mobile-factor")??2,Cr=b("esri-mobile");let ve=class{constructor(e,t){this.type="FeatureSetReader",this.arcadeDeclaredClass="esri.arcade.Feature",this.seen=!1,this.instance=0,this._tx=0,this._ty=0,this._sx=1,this._sy=1,this._deleted=null,this._joined=[],this._objectIdToIndex=null,this._contextTimeZone=null,this._level=0,this.instance=e,this._layerSchema=t}static createInstance(){return we++,we=we>65535?0:we,we}get isEmpty(){return this._deleted!=null&&this._deleted.countSet()===this.getSize()}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}set level(e){this._level=e}getAreaSimplificationThreshold(e,t){let s=1;const r=Cr?Ar:1;t>4e6?s=Fr*r:t>1e6?s=Tr*r:t>5e5?s=wr*r:t>1e5&&(s=r);let a=0;e>4e3?a=Sr*s:e>2e3?a=vr*s:e>100?a=br:e>15&&(a=xr);let n=8;return this._level<4?n=1:this._level<5?n=2:this._level<6&&(n=4),a*n}createQuantizedExtrudedGeometry(e,t){return this.geometryType==="esriGeometryPolyline"?this._createQuantizedExtrudedLine(e,t):this._createQuantizedExtrudedQuad(e,t)}_createQuantizedExtrudedQuad(e,t){return new D([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createQuantizedExtrudedLine(e,t){return new D([2],[e-1,t+1,1,-1])}parseTimestampOffset(e){return e}setArcadeSpatialReference(e){this._arcadeSpatialReference=e}attachStorage(e){this._storage=e}getQuantizationTransform(){throw new Error("Unable to find transform for featureSet")}getStorage(){return this._storage}getComputedNumeric(e){return this.getComputedNumericAtIndex(0)}setComputedNumeric(e,t){return this.setComputedNumericAtIndex(t,0)}getComputedString(e){return this.getComputedStringAtIndex(0)}setComputedString(e,t){return this.setComputedStringAtIndex(0,t)}getComputedNumericAtIndex(e){return this._storage.getComputedNumericAtIndex(this.getDisplayId(),e)}setComputedNumericAtIndex(e,t){this._storage.setComputedNumericAtIndex(this.getDisplayId(),e,t)}getComputedStringAtIndex(e){return this._storage.getComputedStringAtIndex(this.getDisplayId(),e)}setComputedStringAtIndex(e,t){return this._storage.setComputedStringAtIndex(this.getDisplayId(),e,t)}transform(e,t,s,r){const a=this.copy();return a._tx+=e,a._ty+=t,a._sx*=s,a._sy*=r,a}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return typeof t=="string"?new Date(t).getTime():typeof t=="number"||t==null?t:null}readAttribute(e,t=!1){const s=this._readAttribute(e,t);if(s!==void 0)return s;for(const r of this._joined){r.setIndex(this.getIndex());const a=r._readAttribute(e,t);if(a!==void 0)return a}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const s=t._readAttributes();for(const r of Object.keys(s))e[r]=s[r]}return e}joinAttributes(e){this._joined.push(e)}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)}geometry(){const e=this.readHydratedGeometry(),t=$e(e,this.geometryType,this.hasZ,this.hasM),s=ws(t);return s&&(s.spatialReference=this._arcadeSpatialReference),s}autocastArcadeDate(e,t){return t&&t instanceof Date?this.isUnknownDateTimeField(e)?Be.unknownDateJSToArcadeDate(t):Be.dateJSAndZoneToArcadeDate(t,this.contextTimeZone??Ts):t}isUnknownDateTimeField(e){return this._layerSchema.fieldsIndex.getTimeZone(e)===Fs}field(e){let t=this.fields.get(e);if(t)switch(t.type){case"date-only":case"esriFieldTypeDateOnly":return Lt.fromReader(this.readAttribute(e,!1));case"time-only":case"esriFieldTypeTimeOnly":return Ot.fromReader(this.readAttribute(e,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return Be.fromReaderAsTimeStampOffset(this.readAttribute(e,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(e,this.readAttribute(e,!0));default:return this.readAttribute(e,!1)}for(const s of this._joined)if(s.setIndex(this.getIndex()),t=s.fields.get(e),t)switch(t.type){case"date-only":case"esriFieldTypeDateOnly":return Lt.fromReader(s._readAttribute(e,!1));case"time-only":case"esriFieldTypeTimeOnly":return Ot.fromReader(s._readAttribute(e,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return Be.fromReaderAsTimeStampOffset(s._readAttribute(e,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(e,s._readAttribute(e,!0));default:return this.readAttribute(e,!1)}throw new Error(`Field ${e} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map(e=>e.name)}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeature());const t=this.readLegacyFeature();if(!t)return JSON.stringify(null);const s={geometry:t.geometry,attributes:{...t.attributes??{}}};for(const r in s.attributes){const a=s.attributes[r];a instanceof Date&&(s.attributes[r]=a.getTime())}return JSON.stringify(s)}gdbVersion(){return null}fullSchema(){return this._layerSchema}castAsJson(e=null){var t;return{attributes:this._readAttributes(),geometry:(e==null?void 0:e.keepGeometryType)===!0?this.geometry():((t=this.geometry())==null?void 0:t.toJSON())??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}removeIds(e){if(this._objectIdToIndex==null){const s=new Map,r=this.getCursor();for(;r.next();){const a=r.getObjectId();Xe(a),s.set(a,r.getIndex())}this._objectIdToIndex=s}const t=this._objectIdToIndex;for(const s of e)t.has(s)&&this.removeAtIndex(t.get(s))}removeAtIndex(e){this._deleted==null&&(this._deleted=_s.create(this.getSize())),this._deleted.set(e)}readGeometryForDisplay(){return this.readUnquantizedGeometry(!0)}readLegacyGeometryForDisplay(){return this.readLegacyGeometry(!0)}*features(){const e=this.getCursor();for(;e.next();)yield e.readOptimizedFeature()}_getExists(){return this._deleted==null||!this._deleted.has(this.getIndex())}_computeCentroid(){if(this.geometryType!=="esriGeometryPolygon")return null;const e=this.readUnquantizedGeometry();if(!e||e.hasIndeterminateRingOrder)return null;const t=nr.fromOptimized(e,this.geometryType);t.yFactor*=-1;const s=or(t);return s?(s[1]*=-1,new D([],s)):null}copyInto(e){e.seen=this.seen,e._storage=this._storage,e._arcadeSpatialReference=this._arcadeSpatialReference,e._joined=this._joined,e._tx=this._tx,e._ty=this._ty,e._sx=this._sx,e._sy=this._sy,e._deleted=this._deleted,e._objectIdToIndex=this._objectIdToIndex,e.contextTimeZone=this.contextTimeZone}},ms=class gt extends ve{static from(e,t){return new gt(e.copy(),t)}constructor(e,t){super(ve.createInstance(),e.fullSchema()),this._currentIndex=-1,this._reader=e,this._indices=t}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1>>16}function Fe(i){return 65535&i}const Ft={getObjectId:i=>i.getObjectId(),getAttributes:i=>i.readAttributes(),getAttribute:(i,e)=>i.readAttribute(e),getAttributeAsTimestamp:(i,e)=>i.readAttributeAsTimestamp(e),cloneWithGeometry:(i,e)=>i,getGeometry:i=>i.readHydratedGeometry(),getCentroid:(i,e)=>i.readCentroid()};let Mr=class extends wt{constructor(e,t,s){super(e,t),this.featureAdapter=Ft,this.events=new ke,this._featureSetsByInstance=new Map,this._objectIdToDisplayId=new Map,this._spatialIndexInvalid=!0,this._indexSearchCache=new St(50),this._index=be(9,r=>({minX:this._storage.getXMin(r),minY:this._storage.getYMin(r),maxX:this._storage.getXMax(r),maxY:this._storage.getYMax(r)})),this.mode=s}get storeStatistics(){let e=0,t=0,s=0;return this.forEach(r=>{const a=r.readGeometry();a&&(t+=a.isPoint?1:a.lengths.reduce((n,o)=>n+o,0),s+=a.isPoint?1:a.lengths.length,e+=1)}),{featureCount:e,vertexCount:t,ringCount:s}}hasInstance(e){return this._featureSetsByInstance.has(e)}onTileData(e,t,s){if(t.addOrUpdate==null)return t;if(t.addOrUpdate.attachStorage(this._storage),this.mode==="snapshot"){const a=t.addOrUpdate.getCursor();for(;a.next();){const n=a.getDisplayId();this.setComputedAttributes(this._storage,a,n,e.scale,s)}return t}this._featureSetsByInstance.set(t.addOrUpdate.instance,t.addOrUpdate);const r=t.addOrUpdate.getCursor();for(;r.next();)this._insertFeature(r,e.scale,s);return this._spatialIndexInvalid=!0,this.events.emit("changed"),t}search(e){this._rebuildIndex();const t=e.id,s=this._indexSearchCache.find(o=>o.tileId===t);if(s!=null)return s.readers;const r=new Map,a=this._searchIndex(e.bounds),n=[];for(const o of a){const h=this._storage.getInstanceId(o),u=Te(h),d=Fe(h);r.has(u)||r.set(u,[]),r.get(u).push(d)}return r.forEach((o,h)=>{const u=this._featureSetsByInstance.get(h);n.push(ms.from(u,o))}),this._indexSearchCache.enqueue({tileId:t,readers:n}),n}insert(e){const t=e.getCursor(),s=this._storage;for(;t.next();){const r=Qt(t.instance,t.getIndex()),a=t.getObjectId(),n=this._objectIdToDisplayId.get(a)??this._storage.createDisplayId();t.setDisplayId(n),s.setInstanceId(n,r),this._objectIdToDisplayId.set(a,n)}this._featureSetsByInstance.set(e.instance,e),this._spatialIndexInvalid=!0}remove(e){const t=this._objectIdToDisplayId.get(e);if(!t)return;const s=this._storage.getInstanceId(t),r=Fe(s),a=Te(s),n=this._featureSetsByInstance.get(a);this._objectIdToDisplayId.delete(e),this._storage.releaseDisplayId(t),n.removeAtIndex(r),n.isEmpty&&this._featureSetsByInstance.delete(a),this._spatialIndexInvalid=!0}forEach(e){this._objectIdToDisplayId.forEach(t=>{const s=this._storage.getInstanceId(t),r=this._lookupFeature(s);e(r)})}forEachUnsafe(e){this._objectIdToDisplayId.forEach(t=>{const s=this._storage.getInstanceId(t),r=Te(s),a=Fe(s),n=this._getFeatureSet(r);n.setIndex(a),e(n)})}forEachInBounds(e,t){const s=this._searchIndex(e);for(const r of s)t(this.lookupFeatureByDisplayId(r,this._storage))}forEachBounds(e,t){this._rebuildIndex();for(const s of e){if(!s.readGeometry())continue;const r=s.getDisplayId();As(Nt,this._storage.getXMin(r),this._storage.getYMin(r),this._storage.getXMax(r),this._storage.getYMax(r)),t(Nt)}}sweepFeatures(e,t,s){this._spatialIndexInvalid=!0,this._objectIdToDisplayId.forEach((r,a)=>{e.has(r)||(t.releaseDisplayId(r),s&&s.unsetAttributeData(r),this._objectIdToDisplayId.delete(a))}),this.events.emit("changed")}sweepFeatureSets(e){this._spatialIndexInvalid=!0,this._featureSetsByInstance.forEach((t,s)=>{e.has(s)||this._featureSetsByInstance.delete(s)})}lookupObjectId(e,t){const s=this.lookupFeatureByDisplayId(e,t);return s==null?null:s.getObjectId()}lookupDisplayId(e){return this._objectIdToDisplayId.get(e)}lookupFeatureByDisplayId(e,t){const s=t.getInstanceId(e);return this._lookupFeature(s)}lookupByDisplayIdUnsafe(e){const t=this._storage.getInstanceId(e),s=Te(t),r=Fe(t),a=this._getFeatureSet(s);return a?(a.setIndex(r),a):null}_insertFeature(e,t,s){const r=this._storage,a=e.getObjectId(),n=Qt(e.instance,e.getIndex());r.getInstanceId(e.getDisplayId());let o=this._objectIdToDisplayId.get(a);o||(o=r.createDisplayId(),this._objectIdToDisplayId.set(a,o),this._spatialIndexInvalid=!0),e.setDisplayId(o),r.setInstanceId(o,n),this.setComputedAttributes(r,e,o,t,s)}_searchIndex(e){this._rebuildIndex();const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this._index.search(t)}_rebuildIndex(){if(!this._spatialIndexInvalid)return;const e=[];this.mode==="snapshot"?this._featureSetsByInstance.forEach(t=>{const s=t.getCursor();for(;s.next();){const r=s.getDisplayId();this._storage.setBounds(r,s)&&e.push(r)}}):this._objectIdToDisplayId.forEach(t=>{const s=this._storage.getInstanceId(t);this._storage.setBounds(t,this._lookupFeature(s))&&e.push(t)}),this._index.clear(),this._index.load(e),this._indexSearchCache.clear(),this._spatialIndexInvalid=!1}_lookupFeature(e){const t=Te(e),s=this._getFeatureSet(t);if(!s)return;const r=s.getCursor(),a=Fe(e);return r.setIndex(a),r}_getFeatureSet(e){return this._featureSetsByInstance.get(e)}};function Er({coords:i,lengths:e}){let t=0;for(const s of e){for(let r=1;r!(s.objectId!=null&&t.has(s.objectId)))}append(e){for(const t of e)this._features.push(t)}getSize(){return this._features.length}getCursor(){return this.copy()}getQuantizationTransform(){return this._transform}getAttributeHash(){let e="";for(const t in this._current.attributes)e+=this._current.attributes[t];return e}getIndex(){return this._featureIndex}setIndex(e){this._featureIndex=e}getObjectId(){var e;return(e=this._current)==null?void 0:e.objectId}getDisplayId(){return this._current.displayId}setDisplayId(e){this._current.displayId=e}getGroupId(){return this._current.groupId}setGroupId(e){this._current.groupId=e}copy(){const e=new pe(this.instance,this._features,this.fullSchema());return this.copyInto(e),e}next(){for(;++this._featureIndex0}let Lr=class pt extends ve{static fromBuffer(e,t,s=!1){const r=t.geometryType,a=Rr(e),n=kr(a,r==="esriGeometryPoint",s),o=ve.createInstance();return new pt(o,a,n,t)}constructor(e,t,s,r){super(e,r),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0,centroid:void 0,legacyFeature:void 0,optFeature:void 0},this._geometryType=r.geometryType,this._reader=t,this._header=s,this._hasNext=s.hasFeatures,this._isPoints=r.geometryType==="esriGeometryPoint"}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get _size(){return this._header.featureCount}get hasZ(){return!1}get hasM(){return!1}get stride(){return 2+(this.hasZ?1:0)+(this.hasM?1:0)}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getSize(){return this._size}getQuantizationTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0,this._featureIndex=e}getAttributeHash(){let e="";for(const t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+".";return e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}getGroupId(){return this._header.groupIds[this._featureIndex]}setGroupId(e){this._header.groupIds[this._featureIndex]=e}readLegacyFeature(){if(this._cache.legacyFeature===void 0){const e=this.readCentroid(),t={attributes:this.readAttributes(),geometry:this._isPoints?this.readLegacyPointGeometry():this.readLegacyGeometry(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null};return this._cache.legacyFeature=t,t}return this._cache.legacyFeature}readOptimizedFeature(){if(this._cache.optFeature===void 0){const e=new mt(this.readGeometry(),this.readAttributes(),this.readCentroid());return e.objectId=this.getObjectId(),e.displayId=this.getDisplayId(),this._cache.optFeature=e,e}return this._cache.optFeature}getXHydrated(){const e=this._header.centroid[2*this._featureIndex],t=this.getQuantizationTransform();return t==null?e:e*t.scale[0]+t.translate[0]}getYHydrated(){const e=this._header.centroid[2*this._featureIndex+1],t=this.getQuantizationTransform();return t==null?e:t.translate[1]-e*t.scale[1]}getX(){return this._header.centroid[2*this._featureIndex]*this._sx+this._tx}getY(){return this._header.centroid[2*this._featureIndex+1]*this._sy+this._ty}readLegacyPointGeometry(){return{x:this.getX(),y:this.getY()}}readLegacyGeometry(e){const t=this.readUnquantizedGeometry(e);return $e(t,this.geometryType,!1,!1)}readLegacyCentroid(){const e=this.readCentroid();if(!e)return null;const[t,s]=e.coords;return{x:t,y:s}}readGeometryArea(){return this._cache.area||this.readGeometry(!0),this._cache.area}readUnquantizedGeometry(e=!1){if(this._cache.unquantGeometry===void 0){const t=this.readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;const s=Ht(t.coords.length).decoded,r=t.clone(s),a=r.coords;let n=0;for(const o of r.lengths){for(let h=1;hl.length)for(let f=0;f=f?(c+=-.5*(T-m)*(C+I),y>1&&it(l[d-2],l[d-1],v,w)?(l[d-2]+=v,l[d-1]+=w):(l[d++]=v,l[d++]=w,y++),m=T,I=C):(M+=v,F+=w),v=M,w=F,x++}y<3||S?d-=2*y:(c+=-.5*(m+v-m)*(I+w+I),it(l[d-2],l[d-1],v,w)?(l[d-2]+=v,l[d-1]+=w,h.push(y)):(l[d++]=v,l[d++]=w,h.push(++y)))}else{let f=0,x=r.getSInt32(),y=r.getSInt32();this.hasZ&&r.getSInt32(),this.hasM&&r.getSInt32(),l[d++]=x,l[d++]=y,f+=1;for(let S=1;S2&&it(l[d-2],l[d-1],m,I)?(l[d-2]+=m,l[d-1]+=I):(l[d++]=m,l[d++]=I,f+=1),x=v,y=w}h.push(f)}break}default:r.skip()}if(this._cache.area=c,!h.length)return null;if(this._tx||this._ty){let _=0;Xe(l);for(const p of h)l[2*_]+=this._tx,l[2*_+1]+=this._ty,_+=p}return new D(h,l)}},Ke=class{constructor(e){this.service=e,this._arcadeLayerSchema={...e,fieldsIndex:H.fromJSON(e.fieldsIndex)}}destroy(){}};function qr(i){return Array.isArray(i.source)}function zr(i){return(i==null?void 0:i.type)==="ogc-source"}function Gr(i){const{capabilities:e}=i;return zr(i.source)?new Yr(i):qr(i)?new jr(i):e.query.supportsFormatPBF&&b("featurelayer-pbf")?new Nr(i):new Qr(i)}async function Pr(i){const e=new Ds;return await e.open(i,{}),e}let jr=class extends Ke{constructor(e){super(e),this._portsOpen=Pr(e.source).then(t=>this.client=t)}destroy(){this.client.close(),this.client=null}async executeQuery(e,t){await this._portsOpen;const s=await this.client.invoke("queryFeatures",e.toJSON(),t);return G.fromFeatureSet(s,this._arcadeLayerSchema)}},Nr=class extends Ke{async executeQuery(e,t){const{data:s}=await Rs(this.service.source,e,t),r=!e.quantizationParameters;return Lr.fromBuffer(s,this._arcadeLayerSchema,r)}},Qr=class extends Ke{async executeQuery(e,t){var u;const{source:s,capabilities:r,spatialReference:a,objectIdField:n,geometryType:o}=this.service;if(e.quantizationParameters!=null&&!r.query.supportsQuantization){const d=e.clone(),l=is(d.quantizationParameters);d.quantizationParameters=null;const{data:c}=await Dt(s,d,a,t),g=ss(c,n);return as(l,g),G.fromOptimizedFeatureSet(g,this._arcadeLayerSchema)}const{data:h}=await Dt(s,e,this.service.spatialReference,t);return o==="esriGeometryPoint"&&(h.features=(u=h.features)==null?void 0:u.filter(d=>{if(d.geometry!=null){const l=d.geometry;return Number.isFinite(l.x)&&Number.isFinite(l.y)}return!0})),G.fromFeatureSet(h,this._arcadeLayerSchema)}},Yr=class extends Ke{async executeQuery(e,t){const{capabilities:s}=this.service;if(e.quantizationParameters&&!s.query.supportsQuantization){const a=e.clone(),n=is(a.quantizationParameters);a.quantizationParameters=null;const o=await qt(this.service.source,e,t);return as(n,o),G.fromOptimizedFeatureSet(o,this._arcadeLayerSchema)}const r=await qt(this.service.source,e,t);return G.fromOptimizedFeatureSet(r,this._arcadeLayerSchema)}},z=class Qe{constructor(){this.version=0,this.source=!1,this.targets={feature:!1,aggregate:!1},this.storage={filters:!1,data:!1},this.mesh=!1,this.queryFilter=!1,this.why={mesh:[],source:[]}}static create(e){const t=new Qe;let s;for(s in e){const r=e[s];if(typeof r=="object")for(const a in r){const n=a,o=r[n];t[s][n]=o}t[s]=r}return t}static empty(){return Qe.create({})}static all(){return Qe.create({source:!0,targets:{feature:!0,aggregate:!0},storage:{filters:!0,data:!0},mesh:!0})}unset(e){this.version=e.version,e.source&&(this.source=!1),e.targets.feature&&(this.targets.feature=!1),e.targets.aggregate&&(this.targets.aggregate=!1),e.storage.filters&&(this.storage.filters=!1),e.storage.data&&(this.storage.data=!1),e.mesh&&(this.mesh=!1),e.queryFilter&&(this.queryFilter=!1)}any(){return this.source||this.mesh||this.storage.filters||this.storage.data||this.targets.feature||this.targets.aggregate||this.queryFilter}describe(){let e=0,t="";if(this.mesh){e+=20,t+=`-> (20) Mesh needs update +`;for(const r of this.why.mesh)t+=` + ${r} +`}if(this.source){e+=10,t+=`-> (10) The source needs update +`;for(const r of this.why.source)t+=` + ${r} +`}this.targets.feature&&(e+=5,t+=`-> (5) Feature target parameters changed +`),this.storage.filters&&(e+=5,t+=`-> (5) Feature filter parameters changed +`),this.targets.aggregate&&(e+=4,t+=`-> (4) Aggregate target parameters changed +`),this.storage.data&&(e+=1,t+="-> (1) Texture storage parameters changed");const s=e<5?"Fastest":e<10?"Fast":e<15?"Moderate":e<20?"Slow":"Very Slow";console.debug(`Applying ${s} update of cost ${e}/45 `),console.debug(t)}toJSON(){return{queryFilter:this.queryFilter,source:this.source,targets:this.targets,storage:this.storage,mesh:this.mesh}}},Xr=class{constructor(e,t){this.requests={done:new Array,stream:new St(10)},this._edits=null,this._abortController=new AbortController,this._version=0,this._isDone=!1,this.didSend=!1,this.tile=e,this._version=t,this._resolver=yt(),this._resolver.promise.catch(s=>He(s))}get signal(){return this._abortController.signal}get options(){return{signal:this._abortController.signal}}get empty(){return!this.requests.done.length&&this.edits==null}get edits(){return this._edits}get done(){return this._resolver.promise}get isDone(){return this._isDone}resolve(){this._isDone=!0,this._resolver.resolve()}clear(){this.requests.done=[]}applyUpdate(e){this.requests.done.forEach(t=>t.message.status.unset(e)),this._version=e.version,this._edits!=null&&this._edits.status.unset(e)}add(e){e.message.status=e.message.status??z.empty(),e.message.status.version=this._version,b("esri-2d-update-debug")&&console.debug(this.tile.id,"DataTileSubscription:add",this._version),e.message.end&&(this.requests.done.forEach(t=>{t.message!=null&&t.message.end&&(t.message.end=!1)}),this._resolver.resolve(),this._isDone=!0),this.requests.done.push(e)}edit(e,t){const s=e.getQuantizationTransform(),r=e.fullSchema(),a=Array.from(e.features()).filter(ns),n=[...t,...a.map(o=>o.objectId)];if(this.removeIds(n),this._invalidate(),this._edits==null)return void(this._edits={type:"append",addOrUpdate:G.fromOptimizedFeatures(a,r,s),id:this.tile.id,status:z.empty(),end:!0});this.requests.done.forEach(o=>o.message.end=!1),this._edits.addOrUpdate.append(e.features())}*readers(){var e;for(const{message:t}of this.requests.done)t.addOrUpdate!=null&&(yield t.addOrUpdate);((e=this._edits)==null?void 0:e.addOrUpdate)!=null&&(yield this._edits.addOrUpdate)}_invalidate(){for(const e of this.requests.done)e.message.status=z.empty();this._edits!=null&&(this._edits.status=z.empty())}removeIds(e){var t;this._invalidate();for(const{message:s}of this.requests.done){const r=s.addOrUpdate;r!=null&&(r.removeIds(e),r.isEmpty&&(b("esri-2d-update-debug")&&console.debug("Removing FeatureSetReader"),s.addOrUpdate=null))}((t=this._edits)==null?void 0:t.addOrUpdate)!=null&&this._edits.addOrUpdate.removeIds(e),this.requests.done=this.requests.done.filter(s=>s.message.addOrUpdate||s.message.end)}abort(){this._abortController.abort(),this._resolver.reject(Bs())}};function Hr(i,e){const t=new Set;return i&&i.forEach(s=>t.add(s)),e&&e.forEach(s=>t.add(s)),t.has("*")?["*"]:Array.from(t)}let ys=class{constructor(e){this.updatingHandles=new It,this.events=new ke,this._resolver=yt(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage,this._arcadeLayerSchema=e.arcadeLayerSchema}destroy(){for(const e of this._subscriptions.values())e.abort();this.updatingHandles.destroy()}get subscriptions(){return this._subscriptions.values()}async _onMessage(e){const t=this._subscriptions.get(e.id);if(!t)return;const s={...e,remove:e.remove??[],status:e.status??z.empty()};return Pe(this._onTileUpdateMessage(s,t.options))}update(e,t){var u;const s=t.fields.length;t.outFields=Hr((u=this._schema)==null?void 0:u.outFields,t.outFields),t.outFields=t.outFields.length>=.75*s?["*"]:t.outFields,t.outFields.sort();const r=ye(this._schema,t);if(!r)return;b("esri-2d-update-debug")&&console.debug("Applying Update - Source:",r);const a="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",n=this._serviceInfo.source,o={returnCentroid:!(n!==null&&typeof n=="object"&&"path"in n&&os(n.path))&&this._serviceInfo.geometryType==="esriGeometryPolygon",returnGeometry:!0,timeReferenceUnknownClient:this._serviceInfo.type!=="stream"&&this._serviceInfo.timeReferenceUnknownClient,outFields:t.outFields,outSpatialReference:this._outSR,orderByFields:[a],where:t.definitionExpression||"1=1",gdbVersion:t.gdbVersion,historicMoment:t.historicMoment,timeExtent:t.timeExtent?Os.fromJSON(t.timeExtent):null},h=this._schema&&Ee(r,"outFields");this._schema&&Ls(r,["timeExtent","definitionExpression","gdbVersion","historicMoment","customParameters"])&&(e.why.mesh.push("Layer filter and/or custom parameters changed"),e.why.source.push("Layer filter and/or custom parameters changed"),e.mesh=!0,e.source=!0,e.queryFilter=!0),h&&(e.why.source.push("Layer required fields changed"),e.source=!0),ye(o,this._queryInfo)&&(this._queryInfo=o),this._schema=t,this._resolver.resolve()}whenInitialized(){return this._resolver.promise}async applyUpdate(e){if(e.queryFilter||e.source&&this._didEdit)return this.refresh(e.version),void(this._didEdit=!1);this._subscriptions.forEach(t=>t.applyUpdate(e)),await this.resend()}refresh(e,t){for(const s of this._tiles())this.unsubscribe(s),this.subscribe(s,e)}subscribe(e,t){const s=new Xr(e,t);return this._subscriptions.set(e.id,s),s}unsubscribe(e){const t=this.getSubscription(e.id);t!=null&&t.abort(),this._subscriptions.delete(e.id)}createQuery(e={}){const t=this._queryInfo.historicMoment?new Date(this._queryInfo.historicMoment):null;return new qs({...this._queryInfo,historicMoment:t,...e})}getSubscription(e){return this._subscriptions.has(e)?this._subscriptions.get(e):null}async queryLastEditDate(){throw new Error("Service does not support query type")}async query(e,t){throw new Error("Service does not support query")}*_tiles(){const e=Array.from(this._subscriptions.values());for(const t of e)yield t.tile}async edit(e,t){return this.updatingHandles.addPromise(this._edit(e,t))}async _edit(e,t){const s=Array.from(this._subscriptions.values()),r=s.map(({tile:a})=>a);for(const a of s)a.removeIds(t);if(e.length){const a=r.map(o=>{const h=this.createTileQuery(o);return h.objectIds=e,{tile:o,query:h}}).map(async({tile:o,query:h})=>({tile:o,result:await this.query(h,{query:{tile:b("esri-tiles-debug")?o.id.replaceAll("/","."):void 0}}),query:h})),n=(await zs(a)).map(async({tile:o,result:h})=>{if(!h.hasFeatures&&!t.length&&!e.length)return;const u=this._subscriptions.get(o.key.id);u&&u.edit(h,e)});await Promise.allSettled(n)}this._didEdit=!0}};const Vr=4;let At=class extends ys{constructor(e){super(e),this.type="feature",this.mode="on-demand",this._adapter=Gr(e.serviceInfo),this._queue=new lt({concurrency:8,process:async t=>{var s,r;if(P(t),t.tile!=null){const a=t.tile.key.id,{signal:n}=t,o=b("esri-tiles-debug")?{tile:a.replaceAll("/","."),depth:t.depth}:void 0,h=await this._adapter.executeQuery(t.query,{signal:n,query:{...o,...(s=this._schema)==null?void 0:s.customParameters}});return h.level=t.tile.key.level,h}return this._adapter.executeQuery(t.query,{...t,query:(r=this._schema)==null?void 0:r.customParameters})}}),this._patchQueue=new lt({concurrency:8,process:async t=>{var s,r;if(P(t),t.tile!=null){const a=t.tile.key.id,{signal:n}=t,o=b("esri-tiles-debug")?{tile:a.replaceAll("/","."),depth:t.depth}:void 0,h=await this._adapter.executeQuery(t.query,{signal:n,query:{...o,...(s=this._schema)==null?void 0:s.customParameters}});return h.level=t.tile.key.level,h}return this._adapter.executeQuery(t.query,{...t,query:(r=this._schema)==null?void 0:r.customParameters})}})}destroy(){super.destroy(),this._adapter.destroy(),this._queue.destroy(),this._patchQueue.destroy()}enqueueQuery(e,t){return this.updatingHandles.addPromise(this._queue.push(e,t))}enqueuePatchQuery(e,t){return this.updatingHandles.addPromise(this._patchQueue.push(e,t))}get maxRecordCountFactor(){const{query:e}=this._serviceInfo.capabilities;return e.supportsMaxRecordCountFactor?Vr:null}get maxPageSize(){const{query:e}=this._serviceInfo.capabilities;return(e.maxRecordCount??8e3)*(this.maxRecordCountFactor??1)}get pageSize(){return Math.min(8e3,this.maxPageSize)}enableEvent(e,t){}subscribe(e,t){const s=super.subscribe(e,t);return this._fetchDataTile(e).catch(r=>{Ie(r)||ae.getLogger("esri.views.2d.layers.features.sources.BaseFeatureSource").error(new V("mapview-query-error","Encountered error when fetching tile",{tile:e,error:r}))}),s}unsubscribe(e){super.unsubscribe(e)}readers(e){return this._subscriptions.get(e).readers()}async query(e,t={}){var r;const s=t.query??{};return this._adapter.executeQuery(e,{...t,query:{...s,...(r=this._schema)==null?void 0:r.customParameters}})}async queryLastEditDate(){const e=this._serviceInfo.source,t={...e.query,f:"json"};return(await Gs(e.path,{query:t,responseType:"json"})).data.editingInfo.lastEditDate}createTileQuery(e,t={}){const s=this._serviceInfo.geometryType,r=this.createQuery(t);r.quantizationParameters=t.quantizationParameters??e.getQuantizationParameters(),r.resultType="tile",r.geometry=e.extent,this._serviceInfo.capabilities.query.supportsQuantization?s==="esriGeometryPolyline"&&(r.maxAllowableOffset=e.resolution*b("feature-polyline-generalization-factor")):s!=="esriGeometryPolyline"&&s!=="esriGeometryPolygon"||(r.maxAllowableOffset=e.resolution,s==="esriGeometryPolyline"&&(r.maxAllowableOffset*=b("feature-polyline-generalization-factor")));const a=this._serviceInfo.capabilities.query;return r.defaultSpatialReferenceEnabled=a.supportsDefaultSpatialReference,r.compactGeometryEnabled=a.supportsCompactGeometry,r}async _executePatchQuery(e,t,s,r){const a=t.clone();a.outFields=[this._serviceInfo.objectIdField,...s],a.returnCentroid=!1,a.returnGeometry=!1;const n=a.start!=null?a.start/8e3:0,o=r.signal;return await this.enqueuePatchQuery({tile:e,query:a,signal:o,depth:n})}async _resend(e,t){const{query:s,message:r}=e,a=s.outFields!=null?s.outFields:[],n=this._queryInfo.outFields,o=n.filter(h=>!a.includes(h));if(r.addOrUpdate!=null)if(o.length)try{const h=this._subscriptions.get(r.id).tile,u=await this._executePatchQuery(h,s,o,t);P(t),s.outFields=n,r.addOrUpdate.joinAttributes(u),this._onMessage({...r,end:r.end,type:"append"})}catch{}else this._onMessage({...r,type:"append"});else this._onMessage({...r,type:"append"})}async _resendSubscription(e){if(b("esri-2d-update-debug")&&console.debug(e.tile.id,"Resend Subscription"),e.empty)return this._onMessage({id:e.tile.id,addOrUpdate:null,end:!1,type:"append"});const t=e.signal;for(const s of e.requests.done)await this._resend(s,{signal:t});return e.edits!=null?this._onMessage(e.edits):void 0}async resend(){const e=Array.from(this._subscriptions.values());await Promise.all(e.map(t=>this._resendSubscription(t)))}};const Vt=b("esri-mobile"),Zt={maxDrillLevel:Vt?1:4,maxRecordCountFactor:Vt?1:3};class Zr extends At{constructor(e){super(e)}async _fetchDataTile(e){const t=this._serviceInfo.capabilities.query.supportsMaxRecordCountFactor,s=this._subscriptions.get(e.key.id),r=s.signal,a=e.getQuantizationParameters();let n=0;const o=async(h,u)=>{const d=this._queryInfo,l=this.createTileQuery(h,{maxRecordCountFactor:t?Zt.maxRecordCountFactor:void 0,returnExceededLimitFeatures:!1,quantizationParameters:a});n++;try{const c=await this.enqueueQuery({tile:e,query:l,signal:r,depth:u});if(n--,P(r),!c)return;if(d!==this._queryInfo)return void o(h,u);if(c.exceededTransferLimit&&u{o--,P(r);const g=e.id,_=l.reader,p=l.query;if(!_.exceededTransferLimit){if(a=!0,c!==0&&!_.hasFeatures){const y={id:g,addOrUpdate:_,end:o===0,type:"append"};return r.add({message:y,query:p}),void this._onMessage(y)}const x={id:g,addOrUpdate:_,end:o===0,type:"append"};return r.add({message:x,query:p}),void this._onMessage(x)}const f={id:g,addOrUpdate:_,end:a&&o===0,type:"append"};r.add({message:f,query:p}),this._onMessage(f)};let u=0,d=0;for(;!a&&d++<20;){let l;for(let c=0;c_&&h(_,g)).catch(_=>{if(a=!0,!Ie(_)){ae.getLogger("esri.views.2d.layers.features.sources.PagedFeatureSource").error(new V("mapview-query-error","Encountered error when fetching tile",{tile:e,error:_}));const p={id:e.id,addOrUpdate:null,end:a,type:"append"},f={start:this.pageSize*n,num:this.pageSize,returnExceededLimitFeatures:!0,quantizationParameters:e.getQuantizationParameters()};this.maxRecordCountFactor!=null&&(f.maxRecordCountFactor=this.maxRecordCountFactor);const x=this.createTileQuery(e,f);r.add({message:p,query:x}),this._onMessage(p)}})}await l,P(r),u=Math.min(u+2,6)}}async _fetchDataTilePage(e,t,s){P(s);const r=this._queryInfo,a={start:this.pageSize*t,num:this.pageSize,returnExceededLimitFeatures:!0,quantizationParameters:e.getQuantizationParameters()};this.maxRecordCountFactor!=null&&(a.maxRecordCountFactor=this.maxRecordCountFactor);const n=this.createTileQuery(e,a);try{const o=s.signal,h=await this.enqueueQuery({tile:e,query:n,signal:o,depth:t});return P(s),h?r!==this._queryInfo?this._fetchDataTilePage(e,t,s):{reader:h,query:n}:null}catch(o){return He(o),null}}};function Wr(i,e,t){const s=i.getXHydrated(),r=i.getYHydrated(),a=e.getColumnForX(s),n=Math.floor(e.normalizeCol(a));return`${t}/${Math.floor(e.getRowForY(r))}/${n}`}function at(i,e){if(i==null)return null;const t=e.transform,s=i.getQuantizationTransform();if(s==null){const[f,x]=t.scale,[y,S]=t.translate,m=-y/f,I=1/f,v=S/x,w=1/-x;return i.transform(m,v,I,w)}const[r,a]=s.scale,[n,o]=s.translate,[h,u]=t.scale,[d,l]=t.translate,c=r/h,g=(n-d)/h,_=a/u,p=(-o+l)/u;return i.transform(g,p,c,_)}let ft=class extends At{constructor(e){super(e),this.mode="snapshot",this._loading=!0,this._controller=new AbortController,this._downloadPromise=null,this._didSendEnd=!1,this._queries=new Array,this._invalidated=!1,this._hasAggregates=!1,this._random=new Ps(1e3),this._store=e.store,this._markedIdsBufId=this._store.storage.createBitset()}destroy(){super.destroy(),this._controller.abort()}get loading(){return this._loading}get _signal(){return this._controller.signal}update(e,t){var s;super.update(e,t),this._featureCount??(this._featureCount=t.initialFeatureCount),t.changedFeatureCount!=null&&(this._featureCount=t.changedFeatureCount),this._hasAggregates=!!((s=e.targets)!=null&&s.aggregate)}async resend(e=!1){if(await this._downloadPromise,this._invalidated||e){const s=this._featureCount;return Xe(s,"Expected featureCount to be defined"),this._invalidated=!1,this._subscriptions.forEach(r=>r.clear()),this._downloadPromise=this._download(s),void await this._downloadPromise}const t=this._queries.map(({query:s,reader:r})=>this._sendPatchQuery(s,r));await Promise.all(t),this._subscriptions.forEach(s=>{s.requests.done.forEach(r=>this._onMessage(r.message))})}async refresh(e,t){t&&(this._featureCount=t.featureCount),await this.resend(!0)}async _sendPatchQuery(e,t){const s=e.outFields!=null?e.outFields:[],r=this._queryInfo.outFields,a=r.filter(u=>!s.includes(u));if(!a.length)return;const n=e.clone(),o=this._signal;n.returnGeometry=!1,n.returnCentroid=!1,n.outFields=a,e.outFields=r;const h=await this.enqueueQuery({query:n,depth:0,signal:o});P({signal:o}),t.joinAttributes(h)}async _fetchDataTile(e){this._downloadPromise??(this._downloadPromise=this._download(this._featureCount));const t=this._store.search(e),s=this._subscriptions.get(e.key.id),r=t.length-1;for(let h=0;h=0?t[r]:null,e),n=this._didSendEnd,o={type:"append",id:e.id,addOrUpdate:a,end:n,status:z.empty()};s.add({query:null,message:o}),this._onMessage(o)}async _download(e){try{await this.whenInitialized();const t=this._store.storage.getBitset(this._markedIdsBufId),s=new Set;t.clear();const r=Math.ceil(e/this.pageSize),a=Array.from({length:r},(n,o)=>o).sort((n,o)=>this._random.getInt()-this._random.getInt()).map(n=>this._downloadPage(n,t,s));await Promise.all(a),this._store.sweepFeatures(t,this._store.storage),this._store.sweepFeatureSets(s)}catch(t){ae.getLogger("esri.views.2d.layers.features.sources.SnapshotFeatureSource").error("mapview-snapshot-source","Encountered and error when downloading feature snapshot",t)}this._sendEnd(),this._loading=!1}async _downloadPage(e,t,s){const r=this.pageSize,a={start:e*r,num:r,cacheHint:!0};this.maxRecordCountFactor!=null&&(a.maxRecordCountFactor=this.maxRecordCountFactor);const n=this.createQuery(a),o=this._signal,h=await this.enqueueQuery({query:n,depth:e,signal:o});P({signal:o}),this._queries.push({query:n,reader:h}),this._store.insert(h),s.add(h.instance);const u=h.getCursor();for(;u.next();)t.set(u.getDisplayId());this._send(h)}_send(e){if(!this._subscriptions.size)return;let t=null;const s=new Map,r=new Set,a=new Map;this._subscriptions.forEach(n=>{const o=n.tile;s.set(o.key.id,null),t=o.tileInfoView,r.add(o.level);const{row:h,col:u}=o.key,d=`${o.level}/${h}/${u}`,l=a.get(d)??[];l.push(n),a.set(d,l)});for(const n of r){const o=t.getLODInfoAt(n),h=e.getCursor();for(;h.next();){const u=Wr(h,o,n),d=h.getIndex();if(a.has(u))for(const l of a.get(u)){const c=l.tile.id;let g=s.get(c);g==null&&(g=[],s.set(c,g)),g.push(d)}}}s.forEach((n,o)=>{if(n!=null){const h=this._subscriptions.get(o),u={type:"append",id:o,addOrUpdate:at(ms.from(e,n),h.tile),end:!1,status:z.empty()};h.add({query:null,message:u}),this._onMessage(u)}})}_sendEnd(){this._subscriptions.forEach(e=>{const t={type:"append",id:e.tile.id,addOrUpdate:null,end:!0,status:z.empty()};e.add({query:null,message:t}),this._onMessage(t)}),this._didSendEnd=!0}};ft=k([Je("esri.view.2d.layers.features.sources.SnapshotFeatureSource")],ft);let fe=class extends xt{constructor(e){super(e)}get connectionStatus(){var e;return(e=this.connection)==null?void 0:e.connectionStatus}get errorString(){var e;return(e=this.connection)==null?void 0:e.errorString}};k([O()],fe.prototype,"connection",void 0),k([O()],fe.prototype,"connectionStatus",null),k([O()],fe.prototype,"errorString",null),fe=k([Je("esri.views.2d.layers.features.sources.StreamConnectionState")],fe);const Kr=2500;function ei(i,e){const t=i.weakClone();if(i.geometry!=null){const s=us(e,i.geometry.coords[0]),r=ds(e,i.geometry.coords[1]);t.geometry=new D([],[s,r])}return t}function ti(i){return i==="esriGeometryPoint"?ei:(e,t)=>{const s=e.weakClone(),r=new D,a=!1,n=!1,o=ct(r,e.geometry,a,n,i,t,!1,!1);return s.geometry=o,s}}function si(i){return i==="esriGeometryPoint"?e=>e.geometry!=null?{minX:e.geometry.coords[0],minY:e.geometry.coords[1],maxX:e.geometry.coords[0],maxY:e.geometry.coords[1]}:{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}:e=>{let t=1/0,s=1/0,r=-1/0,a=-1/0;return e.geometry!=null&&e.geometry.forEachVertex((n,o)=>{t=Math.min(t,n),s=Math.min(s,o),r=Math.max(r,n),a=Math.max(a,o)}),{minX:t,minY:s,maxX:r,maxY:a}}}function ri(i,e){const t=be(9,si(e));return t.load(i),t}function ii(i,e){return i.search({minX:e.bounds[0],minY:e.bounds[1],maxX:e.bounds[2],maxY:e.bounds[3]})}class ai{constructor(e,t){this.onUpdate=e,this._geometryType=t,this._objectIdToFeature=new Map,this._index=null}get _features(){const e=[];return this._objectIdToFeature.forEach(t=>e.push(t)),e}add(e){this._objectIdToFeature.set(e.objectId,e),this._index=null}get(e){return this._objectIdToFeature.has(e)?this._objectIdToFeature.get(e):null}forEach(e){this._objectIdToFeature.forEach(e)}search(e){return this._index||(this._index=ri(this._features,this._geometryType)),ii(this._index,e)}clear(){this._index=null,this._objectIdToFeature.clear()}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),this._index=null,t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._objectIdToFeature.size}}let ni=class extends ys{constructor(e){super(e),this.type="stream",this._updateIntervalId=0,this._level=0,this._isPaused=!1,this._updateInfo={websocket:0,client:0},this._inUpdate=!1;const{outSR:t}=e,{geometryType:s,objectIdField:r,timeInfo:a,purgeOptions:n,source:o,spatialReference:h,serviceFilter:u,maxReconnectionAttempts:d,maxReconnectionInterval:l,updateInterval:c,customParameters:g,enabledEventTypes:_}=e.serviceInfo,p=new ai(this._onUpdate.bind(this),s),f=new ir(p,r,a,n),x=hr(o,h,t,s,u,d,l,g??{});this._connectionState=new fe({connection:x}),this._store=p,this._manager=f,this._connection=x,this._quantize=ti(s),this._enabledEventTypes=new Set(_),this._handlesGroup=js([this._connection.on("data-received",y=>this._onFeature(y)),this._connection.on("message-received",y=>this._onWebSocketMessage(y))]),this._initUpdateInterval=()=>{let y=performance.now();this._updateIntervalId=setInterval(()=>{const S=performance.now(),m=S-y;if(m>Kr){y=S;const I=Math.round(this._updateInfo.client/(m/1e3)),v=Math.round(this._updateInfo.websocket/(m/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.events.emit("updateRate",{client:I,websocket:v})}e.canAcceptRequest()&&!this._inUpdate&&this._manager.checkForUpdates()},c)},this._isPaused=e.serviceInfo.isPaused,this._isPaused||this._initUpdateInterval()}destroy(){var e;super.destroy(),this._clearUpdateInterval(),this._connection.destroy(),(e=this._handlesGroup)==null||e.remove()}_fetchDataTile(){}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState.errorString}updateCustomParameters(e){this._connection.updateCustomParameters(e)}pauseStream(){this._isPaused||(this._isPaused=!0,this._clearUpdateInterval())}resumeStream(){this._isPaused&&(this._isPaused=!1,this._initUpdateInterval())}sendMessageToSocket(e){this._connection.sendMessageToSocket(e)}sendMessageToClient(e){this._isPaused&&"type"in e&&e.type==="clear"?(this._store.clear(),this._subscriptions.forEach((t,s)=>{t.didSend&&t.tile.level===this._level&&this._onMessage({type:"append",id:s,addOrUpdate:null,clear:!0,end:!0})})):this._connection.sendMessageToClient(e)}enableEvent(e,t){t?this._enabledEventTypes.add(e):this._enabledEventTypes.delete(e)}subscribe(e,t){const s=super.subscribe(e,t);this._level=e.level;const r=this._getTileFeatures(e);return this._onMessage({type:"append",id:e.key.id,addOrUpdate:r,end:!0}),s.didSend=!0,s}unsubscribe(e){super.unsubscribe(e)}*readers(e){const t=this._subscriptions.get(e),{tile:s}=t;yield this._getTileFeatures(s)}createTileQuery(e){throw new Error("Service does not support tile queries")}async resend(){this._subscriptions.forEach(e=>{const{tile:t}=e,s={type:"append",id:t.id,addOrUpdate:this._getTileFeatures(t),end:!0};this._onMessage(s)})}_getTileFeatures(e){const t=this._store.search(e).map(s=>this._quantize(s,e.transform));return G.fromOptimizedFeatures(t,this._arcadeLayerSchema,e.transform)}_onWebSocketMessage(e){if(this._enabledEventTypes.has("message-received")&&this.events.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this._store.forEach(t=>this._manager.removeById(t.objectId))}}_onFeature(e){this._updateInfo.websocket++;try{this._enabledEventTypes.has("data-received")&&this.events.emit("data-received",e);const t=Ns(e,this._serviceInfo.geometryType,!1,!1,this._serviceInfo.objectIdField);this._manager.add(t)}catch{}}_clearUpdateInterval(){clearInterval(this._updateIntervalId),this._updateIntervalId=0}async _onUpdate(e,t){this._inUpdate=!0;try{e!=null&&(this._updateInfo.client+=e.length),this._subscriptions.forEach((r,a)=>{r.didSend&&r.tile.level===this._level&&this._onMessage({type:"append",id:a,addOrUpdate:null,clear:!0,end:!1})});const s=[];this._subscriptions.forEach((r,a)=>{if(!r.didSend||r.tile.level!==this._level)return;const n=r.tile,o={type:"append",id:a,addOrUpdate:this._getTileFeatures(n),remove:[],end:!1,status:z.empty()};r.requests.stream.enqueue(o),s.push(this._onMessage(o))}),await Promise.all(s),this._subscriptions.forEach((r,a)=>{r.didSend&&r.tile.level===this._level&&this._onMessage({type:"append",id:a,addOrUpdate:null,end:!0})})}catch{}this._inUpdate=!1}};function oi(i,e,t,s,r,a,n){const o=hi(i,e,t,s,r,a,n);switch(o.type){case"feature":switch(o.origin){case"hosted":case"local":return new Jr(o);case"snapshot":return new ft(o);default:return new Zr(o)}case"stream":return new ni(o)}}function hi(i,e,t,s,r,a,n){switch(i.type){case"snapshot":return{type:"feature",origin:"snapshot",featureCount:i.featureCount??0,serviceInfo:i,onMessage:r,outSR:t,tileInfoView:s,canAcceptRequest:a,store:n,arcadeLayerSchema:e};case"stream":return{type:"stream",serviceInfo:i,onMessage:r,outSR:t,canAcceptRequest:a,arcadeLayerSchema:e};case"memory":case"on-demand":return{type:"feature",serviceInfo:i,onMessage:r,outSR:t,origin:o(i.source),tileInfoView:s,canAcceptRequest:a,arcadeLayerSchema:e}}function o(h){return Array.isArray(h)?"local":"path"in h&&os(h.path)?"hosted":"unknown"}}const $=8388607,Is=8388608,ui=254,di=255,li=0,Ct=1,Mt=i=>(i&Is)>>>23,_e=i=>i&$,ci=i=>Mt(i)===Ct?ui:di;function Fa(i){return Mt(i)===Ct}function Et(i,e){return((e?Is:0)|i)>>>0}const $t=ae.getLogger("esri.views.2d.engine.webgl.Utils"),W="geometry",gi=[{name:W,strideInBytes:12}],pi=[{name:W,strideInBytes:36}],fi=[{name:W,strideInBytes:24}],_i=[{name:W,strideInBytes:12}],mi=[{name:W,strideInBytes:40}],yi=[{name:W,strideInBytes:36}],Ii=[{name:W,strideInBytes:36}];function ne(i){const e={};for(const t of i)e[t.name]=t.strideInBytes;return e}const xi=ne([{name:W,strideInBytes:36}]),bi=ne(gi),vi=ne(pi),Si=ne(fi),wi=ne(_i),Ti=ne(mi),Fi=ne(yi),Ai=ne(Ii);function Aa(i,e){switch(i){case Se.MARKER:return e===Oe.HEATMAP?bi:xi;case Se.FILL:switch(e){case Oe.DOT_DENSITY:return wi;case Oe.SIMPLE:case Oe.OUTLINE_FILL_SIMPLE:return Si;default:return vi}case Se.LINE:return Ti;case Se.TEXT:return Fi;case Se.LABEL:return Ai}}function Ca(i){switch(i){case"butt":return Ue.BUTT;case"round":return Ue.ROUND;case"square":return Ue.SQUARE;default:return $t.error(new V("mapview-invalid-type",`Cap type ${i} is not a valid option. Defaulting to round`)),Ue.ROUND}}function Ma(i){switch(i){case"miter":return Re.MITER;case"bevel":return Re.BEVEL;case"round":return Re.ROUND;default:return $t.error(new V("mapview-invalid-type",`Join type ${i} is not a valid option. Defaulting to round`)),Re.ROUND}}W+"",Qs.STATIC_DRAW;function Ci(i){switch(i){case X.UNSIGNED_BYTE:return Uint8Array;case X.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case X.FLOAT:return Float32Array;default:return void $t.error(new V("webgl-utils",`Unable to handle type ${i}`))}}const Mi=(i,e)=>i&&((...t)=>e.warn("DEBUG:",...t))||(()=>null),Ei=!1;function $i(i,e){if(!i||!e)return i;switch(e){case"radius":case"distance":return 2*i;case"diameter":case"width":return i;case"area":return Math.sqrt(i)}return i}const me=ae.getLogger("esri.views.layers.2d.features.support.AttributeStore"),ze=Mi(Ei,me),Me={sharedArrayBuffer:b("esri-shared-array-buffer"),atomics:b("esri-atomics")};function nt(i,e){return t=>e(i(t))}class ki{constructor(e,t,s,r){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:a,layout:n,textureOnly:o}=r;this.textureOnly=o||!1,this.pixelType=a,this._ctype=t,this.layout=n,this._resetRange(),this._shared=e,this.size=s,o||(this.data=this._initData(a,s,e,t))}get buffer(){var e;return(e=this.data)==null?void 0:e.buffer}unsetComponentAllTexels(e,t){const s=this.data;for(let r=0;rt)return null;this._resetRange();const r=!(this._shared||this._ctype==="local"),a=this.pixelType,n=this.layout,o=this.data;return{start:e,end:t,data:r&&o.slice(e*s,(t+1)*s)||null,pixelType:a,layout:n}}_initData(e,t,s,r){const a=s&&r!=="local"?SharedArrayBuffer:ArrayBuffer,n=Ci(e),o=new n(new a(t*t*4*n.BYTES_PER_ELEMENT));for(let h=0;hnull)}destroy(){this._abortController.abort(),this.updatingHandles.destroy()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}isUpdating(){const e=this.updatingHandles.updating||!!this._nextUpdate;return b("esri-2d-log-updating")&&console.log(`Updating AttributeStore: ${e} + -> updatingHandles ${this.updatingHandles.updating} (currUpdate: ${!!this._currUpdate}) + -> nextUpdate: ${!!this._nextUpdate} +`),e}update(e,t){this.config=t;const s=t.schema.processors[0].storage,r=ye(this._schema,s);if((e.targets.feature||e.targets.aggregate)&&(e.storage.data=!0),r&&(b("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",r),e.storage.data=!0,this._schema=s,this._attributeComputeInfo=null,s!=null)){switch(s.target){case"feature":this._targetType=li;break;case"aggregate":this._targetType=Ct}if(s.type==="subtype"){this._attributeComputeInfo={isSubtype:!0,subtypeField:s.subtypeField,map:new Map};for(const a in s.mapping){const n=s.mapping[a];if((n==null?void 0:n.vvMapping)!=null)for(const o of n.vvMapping)this._bindAttribute(o,parseInt(a,10))}}else{if(this._attributeComputeInfo={isSubtype:!1,map:new Map},s.vvMapping!=null)for(const a of s.vvMapping)this._bindAttribute(a);if(s.attributeMapping!=null)for(const a of s.attributeMapping)this._bindAttribute(a)}}}onTileData(e,t){if(t.addOrUpdate==null)return;const s=t.addOrUpdate.getCursor();for(;s.next();){const r=s.getDisplayId();this.setAttributeData(r,s)}}async setHighlight(e,t){const r=this._getBlock(0),a=t.map(n=>_e(n));r.lock(),r.unsetComponentAllTexels(0,1),r.setComponent(0,1,a),r.unlock(),this._idsToHighlight.clear();for(const n of e)this._idsToHighlight.add(n);await this.sendUpdates()}async updateFilters(e,t,s){b("esri-2d-update-debug")&&console.debug("AttributeStore::updateFilters");const{service:r,spatialReference:a}=s,{filters:n}=t,o=n.map((u,d)=>this._updateFilter(u,d,r,a)),h=(await Promise.all(o)).some(u=>u);b("esri-2d-update-debug")&&console.debug("AttributeStore::updateFilters - finsihed"),h&&(e.storage.filters=!0,b("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(e,t,s,r){const a=_e(e);this._ensureSizeForTexel(a),this._getBlock(t).setData(e,s,r)}getData(e,t,s){return this._getBlock(t).getData(e,s)}getHighlightFlag(e){return this._idsToHighlight.has(e)?dr:0}unsetAttributeData(e){const t=_e(e);this._getBlock(0).setData(t,0,0)}setAttributeData(e,t){const s=_e(e);if(this._ensureSizeForTexel(s),this._getBlock(0).setData(s,0,this.getFilterFlags(t)),this._targetType!==Mt(e))return;const r=this._attributeComputeInfo,a=this.config.supportsTextureFloat?1:2,n=4;let o=null;r&&(o=r.isSubtype?r.map.get(t.readAttribute(r.subtypeField)):r.map,o!=null&&o.size&&o.forEach((h,u)=>{const d=u*a%n,l=Math.floor(u*a/n),c=this._getBlock(l+lr),g=h(t);if(this.config.supportsTextureFloat)c.setData(s,d,g);else if(g===zt)c.setData(s,d,255),c.setData(s,d+1,255);else{const _=Ys(Math.round(g),-32767,32766)+32768,p=255&_,f=(65280&_)>>8;c.setData(s,d,p),c.setData(s,d+1,f)}}))}sendUpdates(){if(b("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate"),this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=yt(),this.updatingHandles.addPromise(this._nextUpdate.promise),this._nextUpdate.promise;const e={blocks:this._blocks.map(t=>t!=null?t.toMessage():null)};return this._currUpdate=this._createResources().then(()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const r=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then(()=>r.resolve())}else b("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate::No additional updates queued")};b("esri-2d-update-debug")&&console.debug("AttributeStore::sendUpdate::client.update");const s=this.updatingHandles.addPromise(this._client.update(e,this._signal).then(t).catch(t));return this._client.render(this._signal),s}).catch(t=>{if(Ie(t))return this._createResourcesPromise=null,this._createResources();me.error(new V("mapview-attribute-store","Encountered an error during client update",t))}),this._currUpdate}_ensureSizeForTexel(e){for(;e>=this._size*this._size;)if(this._expand())return}_bindAttribute(e,t){function s(){const{normalizationField:u}=e;return u?d=>{const l=d.readAttribute(u);return l?d.readAttribute(e.field)/l:null}:d=>d.readAttribute(e.field)}function r(){return e.normalizationField&&me.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),u=>u.getComputedNumericAtIndex(e.fieldIndex)}let a;if(e.fieldIndex!=null)a=r();else{if(!e.field)return;a=s()}const{valueRepresentation:n}=e;n&&(a=nt(a,u=>$i(u,n)));const o=u=>u===null||isNaN(u)||u===1/0||u===-1/0?zt:u,h=this._attributeComputeInfo;if(h.isSubtype){const u=h.map.get(t)??new Map;u.set(e.binding,nt(a,o)),h.map.set(t,u)}else h.map.set(e.binding,nt(a,o))}_createResources(){if(this._createResourcesPromise!=null)return this._createResourcesPromise;this._getBlock(cr),this._getBlock(gr),ze("Initializing AttributeStore");const e={shared:Me.sharedArrayBuffer&&this._client.type!=="local",size:this._size,blocks:this._blocks.map(s=>s!=null?{textureOnly:s.textureOnly,buffer:s.buffer,pixelType:s.pixelType}:null)},t=this._client.initialize(e,this._signal).catch(s=>{Ie(s)?this._createResourcesPromise=null:me.error(new V("mapview-attribute-store","Encountered an error during client initialization",s))});return this._createResourcesPromise=t,t.then(()=>this._createResourcesPromise==null?this._createResources():void 0),t}_getBlock(e){const t=this._blocks[e];if(t!=null)return t;ze(`Initializing AttributeBlock at index ${e}`);const s=Me.sharedArrayBuffer,r=this._client.type,a=new ki(s,r,this._size,this._blockDescriptors[e]);return this._blocks[e]=a,this._createResourcesPromise=null,a}_expand(){if(this._sizeimport("./FeatureFilter-_YQPNaln.js"),__vite__mapDeps([15,1,2,16,17,18,19,20,21,22,23,24,7,25,26,27,28,29,3,11,9,30])),a=new r({geometryType:t.geometryType,hasM:!1,hasZ:!1,timeInfo:t.timeInfo,fieldsIndex:H.fromJSON(t.fieldsIndex)});return this._filters[e]=a,a}isVisible(e){return!!(2&this._getBlock(0).getData(e,0))}getFilterFlags(e){let t=0;const s=ci(e.getDisplayId());for(let a=0;a{},this._nodes=0,this._root=new ot(this,0,0,0),this._statisticFields=e,this._pool=s?new St(8096):null,this._serviceInfo=t}destroy(){this.clear()}_acquire(e,t,s){this._nodes++;let r=null;return this._pool!=null&&(r=this._pool.dequeue()),r!=null?r.realloc(e,t,s):r=new ot(this,e,t,s),r}_release(e){this.onRelease(e),this._nodes--,this._pool!=null&&this._pool.enqueue(e)}get count(){return this._root.count}get size(){return this._nodes}get poolSize(){var e;return((e=this._pool)==null?void 0:e.size)??0}get depth(){let e=0;return this.forEach(t=>e=Math.max(e,t.depth)),e}dropLevels(e){this.forEach(t=>{if(t.depth>=e)for(let s=0;s{if(t.depth>=e)for(let s=0;sthis._release(e)),this._root=new ot(this,0,0,0)}insert(e,t,s=0){const r=G.fromOptimizedFeatures([e],this._serviceInfo).getCursor();r.next();const a=r.readGeometry();if(!a)return;const[n,o]=a.coords,h=e.geohashX,u=e.geohashY;this.insertCursor(r,e.displayId,n,o,h,u,t,s)}insertCursor(e,t,s,r,a,n,o,h=0){let u=this._root,d=0,l=0,c=0;for(;u!==null;){if(u.depth>=h&&(u.count+=1,u.xTotal+=s,u.yTotal+=r,u.xGeohashTotal+=a,u.yGeohashTotal+=n,u.referenceId=t,this._updateStatisticsCursor(e,u,1)),d>=o)return void u.add(t);const g=Math.ceil((d+1)/2),_=Math.floor((d+1)/2),p=1-d%2,f=30-(3*g+2*_),x=30-(2*g+3*_),y=(a&7*p+3*(1-p)<>f,S=(n&3*p+7*(1-p)<>x,m=y+S*(8*p+4*(1-p));l=l<<3*p+2*(1-p)|y,c=c<<2*p+3*(1-p)|S,u.children[m]==null&&(u.children[m]=this._acquire(l,c,d+1)),d+=1,u=u.children[m]}}remove(e,t){const s=G.fromOptimizedFeatures([e],this._serviceInfo).getCursor();s.next();const r=s.readGeometry();if(!r)return;const[a,n]=r.coords,o=e.geohashX,h=e.geohashY;this.removeCursor(s,a,n,o,h,t)}removeCursor(e,t,s,r,a,n){let o=this._root,h=0;for(;o!==null;){if(o.count-=1,o.xTotal-=t,o.yTotal-=s,o.xGeohashTotal-=r,o.yGeohashTotal-=a,this._updateStatisticsCursor(e,o,-1),h>=n)return void o.remove(e.getDisplayId());const u=Math.ceil((h+1)/2),d=Math.floor((h+1)/2),l=1-h%2,c=30-(3*u+2*d),g=30-(2*u+3*d),_=((r&7*l+3*(1-l)<>c)+((a&3*l+7*(1-l)<>g)*(8*l+4*(1-l)),p=o.children[_];(p==null?void 0:p.count)===1&&(this._release(p),o.children[_]=null),h+=1,o=p}}forEach(e){let t=this._root;for(;t!==null;){const s=this._linkChildren(t)||t.next;e(t),t=s}}find(e,t,s){return this._root.find(e,t,s,0,0,0)}findIf(e){let t=null;return this.forEach(s=>{e(s)&&(t=s)}),t}findAllIf(e){const t=[];return this.forEach(s=>{e(s)&&t.push(s)}),t}findSingleOccupancyNode(e,t,s,r,a){let n=this._root;for(;n!==null;){const o=n.depth,h=n.xNode,u=n.yNode,d=1-o%2,l=n.xGeohashTotal/n.count,c=n.yGeohashTotal/n.count;if(n.count===1&&e=a){n=n.next;continue}const g=Math.ceil((o+1)/2),_=Math.floor((o+1)/2),p=30-(3*g+2*_),f=30-(2*g+3*_),x=~((1<>p,m=(t&y)>>f,I=(s&x)>>p,v=(r&y)>>f,w=h<<3*d+2*(1-d),M=u<<2*d+3*(1-d),F=w+8*d+4*(1-d),T=M+4*d+8*(1-d),C=Math.max(w,S),A=Math.max(M,m),E=Math.min(F,I),U=Math.min(T,v);let B=null,Z=null;for(let R=A;R<=U;R++)for(let Y=C;Y<=E;Y++){const Q=Y-w+(R-M)*(8*d+4*(1-d)),L=n.children[Q];L&&(B||(B=L,B.next=n.next),Z&&(Z.next=L),Z=L,L.next=n.next)}n=B||n.next}return null}getRegionDisplayIds(e){let t=this._root;const{bounds:s,geohashBounds:r,level:a}=e,[n,o,h,u]=s,d=[];for(;t!==null;){const l=t.depth,c=t.xNode,g=t.yNode;if(l>=a){const Q=t.xTotal/t.count,L=t.yTotal/t.count;Q>=n&&Q<=h&&L>=o&&L<=u&&t.displayIds.forEach(K=>d.push(K)),t=t.next;continue}const _=Math.ceil((l+1)/2),p=Math.floor((l+1)/2),f=1-l%2,x=30-(3*_+2*p),y=30-(2*_+3*p),S=~((1<>x,v=(r.yLL&m)>>y,w=(r.xTR&S)>>x,M=(r.yTR&m)>>y,F=c<<3*f+2*(1-f),T=g<<2*f+3*(1-f),C=F+8*f+4*(1-f),A=T+4*f+8*(1-f),E=Math.max(F,I),U=Math.max(T,v),B=Math.min(C,w),Z=Math.min(A,M);let R=null,Y=null;for(let Q=U;Q<=Z;Q++)for(let L=E;L<=B;L++){const K=L-F+(Q-T)*(8*f+4*(1-f)),J=t.children[K];J&&(R||(R=J,R.next=t.next),Y&&(Y.next=J),Y=J,J.next=t.next)}t=R||t.next}return d}getRegionStatistics(e){let t=this._root,s=0,r=0,a=0;const n={},{bounds:o,geohashBounds:h,level:u}=e,[d,l,c,g]=o;let _=0;for(;t!==null;){const p=t.depth,f=t.xNode,x=t.yNode;if(p>=u){const ee=t.xTotal/t.count,te=t.yTotal/t.count;ee>d&&ee<=c&&te>l&&te<=g&&(s+=t.count,r+=t.xTotal,a+=t.yTotal,t.count===1&&(_=t.referenceId),this._aggregateStatistics(n,t.statistics)),t=t.next;continue}const y=Math.ceil((p+1)/2),S=Math.floor((p+1)/2),m=1-p%2,I=30-(3*y+2*S),v=30-(2*y+3*S),w=~((1<>I,T=(h.yLL&M)>>v,C=(h.xTR&w)>>I,A=(h.yTR&M)>>v,E=f<<3*m+2*(1-m),U=x<<2*m+3*(1-m),B=E+8*m+4*(1-m),Z=U+4*m+8*(1-m),R=Math.max(E,F),Y=Math.max(U,T),Q=Math.min(B,C),L=Math.min(Z,A);let K=null,J=null;for(let ee=Y;ee<=L;ee++)for(let te=R;te<=Q;te++){const vs=te-E+(ee-U)*(8*m+4*(1-m)),q=t.children[vs];if(q){if(ee!==Y&&ee!==L&&te!==R&&te!==Q){const Ut=q.xTotal/q.count,Rt=q.yTotal/q.count;Ut>d&&Ut<=c&&Rt>l&&Rt<=g&&(s+=q.count,r+=q.xTotal,a+=q.yTotal,q.count===1&&(_=q.referenceId),this._aggregateStatistics(n,q.statistics));continue}K||(K=q,K.next=t.next),J&&(J.next=q),J=q,q.next=t.next}}t=K||t.next}return{count:s,attributes:this.normalizeStatistics(n,s),xTotal:r,yTotal:a,referenceId:_}}getBins(e){const t=[],{geohashBounds:s,level:r}=e;let a=this._root;for(;a!==null;){const n=a.depth,o=a.xNode,h=a.yNode;if(n>=r){t.push(a),a=a.next;continue}const u=Math.ceil((n+1)/2),d=Math.floor((n+1)/2),l=1-n%2,c=30-(3*u+2*d),g=30-(2*u+3*d),_=~((1<>c,x=(s.yLL&p)>>g,y=(s.xTR&_)>>c,S=(s.yTR&p)>>g,m=o<<3*l+2*(1-l),I=h<<2*l+3*(1-l),v=m+8*l+4*(1-l),w=I+4*l+8*(1-l),M=Math.max(m,f),F=Math.max(I,x),T=Math.min(v,y),C=Math.min(w,S);let A=null,E=null;for(let U=F;U<=C;U++)for(let B=M;B<=T;B++){const Z=B-m+(U-I)*(8*l+4*(1-l)),R=a.children[Z];R&&(A||(A=R,A.next=a.next),E&&(E.next=R),E=R,R.next=a.next)}a=A||a.next}return t}_linkChildren(e){let t=null,s=null;for(let r=0;r<=e.children.length;r++){const a=e.children[r];a&&(t||(t=a,t.next=e.next),s&&(s.next=a),s=a,a.next=e.next)}return t}_updateStatisticsCursor(e,t,s){for(const r of this._statisticFields){const a=r.name,n=r.inField?e.readAttribute(r.inField):e.getComputedNumericAtIndex(r.inFieldIndex);switch(r.statisticType){case"min":{if(isNaN(n))break;if(!t.statistics[a]){t.statistics[a]={value:n};break}const o=t.statistics[a].value;t.statistics[a].value=Math.min(o,n);break}case"max":{if(isNaN(n))break;if(!t.statistics[a]){t.statistics[a]={value:n};break}const o=t.statistics[a].value;t.statistics[a].value=Math.max(o,n);break}case"count":break;case"sum":case"avg":{t.statistics[a]||(t.statistics[a]={value:0,nanCount:0});const o=t.statistics[a].value,h=t.statistics[a].nanCount??0;n==null||isNaN(n)?t.statistics[a].nanCount=h+s:t.statistics[a].value=o+s*n;break}case"avg_angle":{t.statistics[a]||(t.statistics[a]={x:0,y:0,nanCount:0});const o=t.statistics[a].x,h=t.statistics[a].y,u=t.statistics[a].nanCount??0,d=Math.PI/180;n==null||isNaN(n)?t.statistics[a].nanCount=u+s:(t.statistics[a].x=o+s*Math.cos(n*d),t.statistics[a].y=h+s*Math.sin(n*d));break}case"mode":{t.statistics[a]||(t.statistics[a]={});const o=t.statistics[a][n]||0;t.statistics[a][n]=o+s;break}}}}_aggregateStatistics(e,t){for(const s of this._statisticFields){const r=s.name;switch(s.statisticType){case"min":{if(!e[r]){e[r]={value:t[r].value};break}const a=e[r].value;e[r].value=Math.min(a,t[r].value);break}case"max":{if(!e[r]){e[r]={value:t[r].value};break}const a=e[r].value;e[r].value=Math.max(a,t[r].value);break}case"count":break;case"sum":case"avg":case"avg_angle":case"mode":e[r]||(e[r]={});for(const a in t[r]){const n=e[r][a]||0;e[r][a]=n+t[r][a]}}}}normalizeStatistics(e,t){const s={};for(const r of this._statisticFields){const a=r.name;switch(r.statisticType){case"min":case"max":{const n=e[a];if(!t||!n)break;s[a]=n.value;break}case"count":if(!t)break;s[a]=t;break;case"sum":{if(!t)break;const{value:n,nanCount:o}=e[a];if(!(t-o))break;s[a]=n;break}case"avg":{if(!t)break;const{value:n,nanCount:o}=e[a];if(!(t-o))break;s[a]=n/(t-o);break}case"avg_angle":{if(!t)break;const{x:n,y:o,nanCount:h}=e[a];if(!(t-h))break;const u=n/(t-h),d=o/(t-h),l=180/Math.PI,c=Math.atan2(d,u)*l;s[a]=c;break}case"mode":{const n=e[a];let o=0,h=0,u=null;for(const d in n){const l=n[d];l===o?h+=1:l>o&&(o=l,h=1,u=d)}s[a]=u==="null"||h>1?null:u;break}}}return s}};class ot{constructor(e,t,s,r){this.count=0,this.xTotal=0,this.yTotal=0,this.statistics={},this.displayId=0,this.referenceId=0,this.displayIds=new Set,this.next=null,this.depth=0,this.xNode=0,this.yNode=0,this.xGeohashTotal=0,this.yGeohashTotal=0,this._tree=e,this.children=new Array(32);for(let a=0;a=s)return this;const o=1-r%2,h=3*o+2*(1-o),u=2*o+3*(1-o),d=30-a-h,l=30-n-u,c=((e&7*o+3*(1-o)<>d)+((t&3*o+7*(1-o)<>l)*(8*o+4*(1-o)),g=this.children[c];return g==null?null:g.find(e,t,s,r+1,a+h,n+u)}}const ht=ae.getLogger("esri.view.2d.layers.features.support.BinStore"),Jt=12,Ri=64,Di=_t(),Bi=5;function Wt(i){return 57.29577951308232*i}let Oi=class extends wt{constructor(e,t,s,r){super(e,s),this.type="bin",this.events=new ke,this.objectIdField="aggregateId",this.featureAdapter=Ft,this._geohashLevel=Bi,this._geohashBuf=[],this._serviceInfo=r,this.geometryInfo=e.geometryInfo,this._spatialReference=t,this._projectionSupportCheck=fs(t,ie.WGS84),this._bitsets.geohash=s.getBitset(s.createBitset()),this._bitsets.inserted=s.getBitset(s.createBitset())}destroy(){this._tree&&this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,t){const s=this._schema;try{await super.updateSchema(e,t),await this._projectionSupportCheck}catch{}this._fields=this._schema.params.fields,this._fieldsIndex=new H(this._fields);const r=ye(s,t);t&&(r!=null||e.source||e.storage.filters)?((Ee(r,"params.fields")||Ee(r,"params")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new xs(this._statisticFields,this._serviceInfo),this._tree.onRelease=a=>a.displayId&&this._storage.releaseDisplayId(a.displayId),this._geohashLevel=this._schema.params.fixedBinLevel,this._rebuildTree(),b("esri-2d-update-debug")&&ht.info("Aggregate mesh needs update due to tree changing")),b("esri-2d-update-debug")&&ht.info("Aggregate mesh needs update due to tree changing"),e.targets[t.name]=!0,e.mesh=!1):s&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet(s=>{if(!e.has(s)){const r=t.lookupByDisplayIdUnsafe(s);this._remove(r)}})}sweepAggregates(e,t,s){}onTileData(e,t,s,r,a,n=!0){if(!this._schema||t.addOrUpdate==null)return t;this.events.emit("changed");const o=this._getTransforms(e,this._spatialReference);{const u=t.addOrUpdate.getCursor();for(;u.next();)this._update(u,r)}if(t.status.mesh||!n)return t;const h=new Array;this._getBinsForTile(h,e,o,s),t.addOrUpdate=G.fromOptimizedFeatures(h,{fields:this.fields,fieldsIndex:this._fieldsIndex,geometryType:"esriGeometryPolygon",objectIdField:this.objectIdField}),t.addOrUpdate.attachStorage(s),t.end=!0,t.isRepush||(t.clear=!0);{const u=t.addOrUpdate.getCursor();for(;u.next();){const d=u.getDisplayId();this._bitsets.computed.unset(d),this.setComputedAttributes(s,u,d,e.scale,a)}}return t}forEachBin(e){this._tree.forEach(e)}forEach(e){this._tree.forEach(t=>{if(t.depth!==this._geohashLevel)return;const s=this._toFeatureJSON(t),r=G.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields,fieldsIndex:this._fieldsIndex}).getCursor();r.next(),e(r)})}forEachInBounds(e,t){}forEachBounds(e,t){const{hasM:s,hasZ:r}=this.geometryInfo;for(const a of e){const n=ls(Di,a.readGeometry(),r,s);n!=null&&t(n)}}onTileUpdate(e){}getAggregate(e){const t=Et(e,!0),s=this._tree.findIf(r=>r.displayId===t);return s?this._toFeatureJSON(s):null}getAggregates(){return this._tree.findAllIf(e=>e.depth===this._geohashLevel).map(this._toFeatureJSON.bind(this))}getDisplayId(e){var t;return(t=this._tree.findIf(s=>s.id===e))==null?void 0:t.displayId}getFeatureDisplayIdsForAggregate(e){const t=this._tree.findIf(s=>s.id===e);return t!=null?Array.from(t.displayIds):[]}getDisplayIdForReferenceId(e){var t;return(t=this._tree.findIf(s=>s.displayIds.size===1&&s.displayIds.has(e)))==null?void 0:t.displayId}_toFeatureJSON(e){const t=this._spatialReference;return{displayId:e.displayId,attributes:e.getAttributes(),geometry:$e(e.getGeometry(t),"esriGeometryPolygon",!1,!1),centroid:null}}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),a=this._geohashBuf[2*t],n=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,a,n,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,a=t.isVisible(s);if(a===r.has(s))return;if(!a)return void this._remove(e);const n=e.getXHydrated(),o=e.getYHydrated();if(!this._setGeohash(s,n,o))return;const h=this._geohashBuf[2*s],u=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,n,o,h,u,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const a=Wt(t/re.radius),n=a-360*Math.floor((a+180)/360),o=Wt(Math.PI/2-2*Math.atan(Math.exp(-s/re.radius)));Ze(r,e,o,n,Jt)}else{const a=xe({x:t,y:s},this._spatialReference,ie.WGS84);if(!a)return!1;Ze(r,e,a.y,a.x,Jt)}return this._bitsets.geohash.set(e),!0}_getBinsForTile(e,t,s,r){try{const a=this._getGeohashBounds(t),n=this._tree.getBins(a);for(const o of n){o.displayId||(o.displayId=r.createDisplayId(!0));let h=null;const u=o.getGeometry(this._spatialReference,s.tile);u||(h=o.getGeometryCentroid(this._spatialReference,s.tile));const d=new mt(u,o.getAttributes(),h);d.objectId=o.id,d.displayId=o.displayId,e.push(d)}}catch{return void ht.error("Unable to get bins for tile",t.key.id)}}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return je(r,t,e,s),r}_getGeohashBounds(e){const t=this._getGeohashLevel(e.key.level),s=[e.extent.xmin,e.extent.ymin,e.extent.xmax,e.extent.ymax],r=cs.fromExtent(vt.fromBounds(s,this._spatialReference)),a=xe(r,this._spatialReference,ie.WGS84,{densificationStep:e.resolution*Ri}),n=bt(new D,a,!1,!1),o=n.coords.filter((p,f)=>!(f%2)),h=n.coords.filter((p,f)=>f%2),u=Math.min(...o),d=Math.min(...h),l=Math.max(...o),c=Math.max(...h),g=this._getGeohash(u,d,t),_=this._getGeohash(l,c,t);return{bounds:s,geohashBounds:{xLL:g.geohashX,yLL:g.geohashY,xTR:_.geohashX,yTR:_.geohashY},level:t}}_getGeohashLevel(e){return this._schema.params.fixedBinLevel}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=gs(t);if(!r)return{tile:s,left:null,right:null};const[a,n]=r.valid;return{tile:s,left:{...s,translate:[n,e.bounds[3]]},right:{...s,translate:[a-n+e.bounds[0],e.bounds[3]]}}}};const ut=12,Li=64,Kt=1,qi=_t();class kt extends Hs{constructor(e,t,s,r,a){super(new D([],[t,s]),r,null,e),this.geohashBoundsInfo=a}get count(){return this.attributes.cluster_count}static create(e,t,s,r,a,n,o,h){const u=new kt(t,s,r,n,o);return u.displayId=e.createDisplayId(!0),u.referenceId=h,u.tileLevel=a,u}update(e,t,s,r,a,n){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=a,this.referenceId=null,this.referenceId=n,this}toJSON(){return{attributes:{...this.attributes,aggregateId:this.objectId,referenceId:this.attributes.cluster_count===1?this.referenceId:null},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function ce(i){return 57.29577951308232*i}class zi extends wt{constructor(e,t,s,r){super(e,s),this.type="cluster",this.events=new ke,this.objectIdField="aggregateId",this.featureAdapter=Ft,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this._serviceInfo=r,this.geometryInfo=e.geometryInfo,this._spatialReference=t,this._projectionSupportCheck=fs(t,ie.WGS84),this._bitsets.geohash=s.getBitset(s.createBitset()),this._bitsets.inserted=s.getBitset(s.createBitset())}destroy(){this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,t){const s=this._schema;try{await super.updateSchema(e,t),await this._projectionSupportCheck}catch{}this._fields=[...this._schema.params.fields,{name:"referenceId",alias:"referenceId",type:"esriFieldTypeInteger"}],this._fields.some(a=>a.name==="cluster_count")||this._fields.push({name:"cluster_count",alias:"cluster_count",type:"esriFieldTypeInteger"}),this._fieldsIndex=new H(this._fields);const r=ye(s,t);t&&(r!=null||e.source||e.storage.filters)?((Ee(r,"params.fields")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new xs(this._statisticFields,this._serviceInfo),this._rebuildTree(),b("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),b("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",r),e.targets[t.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):s&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet(s=>{if(!e.has(s)){const r=t.lookupByDisplayIdUnsafe(s);this._remove(r)}})}sweepAggregates(e,t,s){this._clusters.forEach((r,a)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(a))})}onTileData(e,t,s,r,a,n=!0){if(!this._schema||t.addOrUpdate==null)return t;this.events.emit("changed");const o=this._getTransforms(e,this._spatialReference);{const d=t.addOrUpdate.getCursor();for(;d.next();)this._update(d,r)}if(t.status.mesh||!n)return t;const h=new Array,u=this._schema.params.clusterRadius;this._getClustersForTile(h,e,u,s,o),t.addOrUpdate=G.fromOptimizedFeatures(h,{fields:this.fields,fieldsIndex:this._fieldsIndex,geometryType:"esriGeometryPoint",objectIdField:this.objectIdField}),t.addOrUpdate.attachStorage(s),t.clear=!0,t.end=!0;{const d=t.addOrUpdate.getCursor();for(;d.next();){const l=d.getDisplayId();this._bitsets.computed.unset(l),this.setComputedAttributes(s,d,l,e.scale,a)}}return this._aggregateValueRangesChanged&&t.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),t}onTileUpdate({added:e,removed:t}){if(e.length){const r=e[0].level;this._tileLevel=r,this._setGeohashLevel(r)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach(r=>{this._tiles.delete(r.key.id),this._markTileClustersForDeletion(r,s)})}getAggregate(e){for(const t of this._clusters.values())if(((t==null?void 0:t.displayId)&$)==(e&$))return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())(t==null?void 0:t.tileLevel)===this._tileLevel&&e.push(t.toJSON());return e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);return t?this._tree.getRegionDisplayIds(t.geohashBoundsInfo):[]}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if((t==null?void 0:t.referenceId)===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){this._clusters.forEach(t=>{if(!t)return;const s=t.toJSON(),r=G.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields,fieldsIndex:this._fieldsIndex}).getCursor();r.next(),e(r)})}forEachInBounds(e,t){}forEachBounds(e,t){const{hasM:s,hasZ:r}=this.geometryInfo;for(const a of e){const n=ls(qi,a.readGeometry(),r,s);n!=null&&t(n)}}size(){let e=0;return this.forEach(t=>e++),e}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),a=this._geohashBuf[2*t],n=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,a,n,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,a=t.isVisible(s);if(a===r.has(s))return;if(!a)return void this._remove(e);const n=e.getXHydrated(),o=e.getYHydrated();if(!this._setGeohash(s,n,o))return;const h=this._geohashBuf[2*s],u=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,n,o,h,u,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const a=ce(t/re.radius),n=a-360*Math.floor((a+180)/360),o=ce(Math.PI/2-2*Math.atan(Math.exp(-s/re.radius)));Ze(r,e,o,n,ut)}else{const a=xe({x:t,y:s},this._spatialReference,ie.WGS84);if(!a)return!1;Ze(r,e,a.y,a.x,ut)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,t,s,r,a,n=!0){const o=this._schema.params.clusterPixelBuffer,h=2*s,u=Math.ceil(2**t.key.level*j/h)+1,d=Math.ceil(o/h)+0,l=Math.ceil(j/h),{row:c,col:g}=t.key,_=g*j,p=c*j,f=Math.floor(_/h)-d,x=Math.floor(p/h)-d,y=f+l+2*d,S=x+l+2*d,m=t.tileInfoView.getLODInfoAt(t.key.level);for(let I=f;I<=y;I++)for(let v=x;v<=S;v++){let w=I;m.wrap&&(w=I<0?I+u:I%u);const M=m.wrap&&I<0,F=m.wrap&&I%u!==I,T=this._lookupCluster(r,m,t.key.level,w,v,t);if(T!=null){let C=null;if(a&&(C=M?a.left:F?a.right:a.tile),n&&C==null||!T.count)continue;if(C!=null&&n){const A=T.geometry.clone();let E=T.attributes;A.coords[0]=us(C,A.coords[0]),A.coords[1]=ds(C,A.coords[1]),T.count===1&&T.referenceId!=null&&(E={...T.attributes,referenceId:T.referenceId});const U=new mt(A,E);U.displayId=T.displayId,e.push(U)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),ut)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=(Math.floor(t/Kt)+1)*Kt-1;if(this._geohashLevel!==s)return this._geohashLevel=s,this._rebuildTree(),void this._bitsets.geohash.clear()}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=gs(t);if(!r)return{tile:s,left:null,right:null};const[a,n]=r.valid;return{tile:s,left:{...s,translate:[n,e.bounds[3]]},right:{...s,translate:[a-n+e.bounds[0],e.bounds[3]]}}}_getClusterId(e,t,s){return(15&e)<<28|(16383&t)<<14|16383&s}_markForDeletion(e,t,s){const r=this._getClusterId(e,t,s);this._clusters.delete(r)}_getClusterBounds(e,t,s){const r=this._schema.params.clusterRadius,a=2*r;let n=s%2?t*a:t*a-r;const o=s*a;let h=n+a;const u=o-a,d=2**e.level*j;e.wrap&&n<0&&(n=0),e.wrap&&h>d&&(h=d);const l=n/j,c=o/j,g=h/j,_=u/j;return[e.getXForColumn(l),e.getYForRow(c),e.getXForColumn(g),e.getYForRow(_)]}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return je(r,t,e,s),r}_getGeohashBounds(e,t){const s=this._getGeohashLevel(e.key.level);if(this._spatialReference.isWebMercator){const[p,f,x,y]=t,S={x:p,y:f},m={x,y};let I=0,v=0,w=0,M=0;{const C=ce(S.x/re.radius);I=C-360*Math.floor((C+180)/360),v=ce(Math.PI/2-2*Math.atan(Math.exp(-S.y/re.radius)))}{const C=ce(m.x/re.radius);w=C-360*Math.floor((C+180)/360),M=ce(Math.PI/2-2*Math.atan(Math.exp(-m.y/re.radius)))}const F={geohashX:0,geohashY:0},T={geohashX:0,geohashY:0};return je(F,v,I,s),je(T,M,w,s),{bounds:[p,f,x,y],geohashBounds:{xLL:F.geohashX,yLL:F.geohashY,xTR:T.geohashX,yTR:T.geohashY},level:s}}const r=cs.fromExtent(vt.fromBounds(t,this._spatialReference)),a=xe(r,this._spatialReference,ie.WGS84,{densificationStep:e.resolution*Li});if(!a)return null;const n=bt(new D,a,!1,!1),o=n.coords.filter((p,f)=>!(f%2)),h=n.coords.filter((p,f)=>f%2),u=Math.min(...o),d=Math.min(...h),l=Math.max(...o),c=Math.max(...h),g=this._getGeohash(u,d,s),_=this._getGeohash(l,c,s);return{bounds:t,geohashBounds:{xLL:g.geohashX,yLL:g.geohashY,xTR:_.geohashX,yTR:_.geohashY},level:s}}_lookupCluster(e,t,s,r,a,n){const o=this._getClusterId(s,r,a),h=this._clusters.get(o),u=this._getClusterBounds(t,r,a),d=this._getGeohashBounds(n,u);if(d==null)return null;const l=this._tree.getRegionStatistics(d),{count:c,xTotal:g,yTotal:_,referenceId:p}=l,f=c?g/c:0,x=c?_/c:0;if(c===0)return this._clusters.set(o,null),null;const y={cluster_count:c,...l.attributes},S=h!=null?h.update(f,x,s,y,d,p):kt.create(e,o,f,x,s,y,d,p);if(c===0){const[m,I,v,w]=u;S.geometry.coords[0]=(m+v)/2,S.geometry.coords[1]=(I+w)/2}return this._clusters.set(o,S),this._updateAggregateValueRangeForCluster(S,S.tileLevel),S}_updateAggregateValueRangeForCluster(e,t){const s=this._aggregateValueRanges[t]||{minValue:1/0,maxValue:0},r=s.minValue,a=s.maxValue;s.minValue=Math.min(r,e.count),s.maxValue=Math.max(a,e.count),this._aggregateValueRanges[t]=s,r===s.minValue&&a===s.maxValue||(this._aggregateValueRangesChanged=!0)}_markTileClustersForDeletion(e,t){const s=2*t,r=Math.ceil(j/s),{row:a,col:n}=e.key,o=n*j,h=a*j,u=Math.floor(o/s),d=Math.floor(h/s);for(let l=u;le))for(;i.length<=e;)i.push(t)}let Pi=class{constructor(){this._numerics=[],this._strings=[],this._idGenerator=new Gi,this._allocatedSize=256,this._bitsets=[],this._instanceIds=[],this._bounds=[]}createBitset(){const e=this._bitsets.length;return this._bitsets.push(_s.create(this._allocatedSize,$)),e+1}getBitset(e){return this._bitsets[e-1]}_expand(){this._allocatedSize<<=1;for(const e of this._bitsets)e.resize(this._allocatedSize)}_ensureNumeric(e,t){this._numerics[e]||(this._numerics[e]=[]),Ge(this._numerics[e],t,0)}_ensureInstanceId(e){Ge(this._instanceIds,e,0)}_ensureString(e,t){this._strings[e]||(this._strings[e]=[]),Ge(this._strings[e],t,null)}createDisplayId(e=!1){const t=this._idGenerator.createId();return t>this._allocatedSize&&this._expand(),Et(t,e)}releaseDisplayId(e){for(const t of this._bitsets)t.unset(e);return this._idGenerator.releaseId(e&$)}getComputedNumeric(e,t){return this.getComputedNumericAtIndex(e&$,0)}setComputedNumeric(e,t,s){return this.setComputedNumericAtIndex(e&$,s,0)}getComputedString(e,t){return this.getComputedStringAtIndex(e&$,0)}setComputedString(e,t,s){return this.setComputedStringAtIndex(e&$,0,s)}getComputedNumericAtIndex(e,t){const s=e&$;return this._ensureNumeric(t,s),this._numerics[t][s]}setComputedNumericAtIndex(e,t,s){const r=e&$;this._ensureNumeric(t,r),this._numerics[t][r]=s}getInstanceId(e){const t=e&$;return this._ensureInstanceId(t),this._instanceIds[t]}setInstanceId(e,t){const s=e&$;this._ensureInstanceId(s),this._instanceIds[s]=t}getComputedStringAtIndex(e,t){const s=e&$;return this._ensureString(t,s),this._strings[t][s]}setComputedStringAtIndex(e,t,s){const r=e&$;this._ensureString(t,r),this._strings[t][r]=s}getXMin(e){return this._bounds[4*(e&$)]}getYMin(e){return this._bounds[4*(e&$)+1]}getXMax(e){return this._bounds[4*(e&$)+2]}getYMax(e){return this._bounds[4*(e&$)+3]}setBounds(e,t){const s=t.readHydratedGeometry();if(!(s!=null&&s.coords.length))return!1;let r=1/0,a=1/0,n=-1/0,o=-1/0;s.forEachVertex((u,d)=>{r=Math.min(r,u),a=Math.min(a,d),n=Math.max(n,u),o=Math.max(o,d)});const h=e&$;return Ge(this._bounds,4*h+4,0),this._bounds[4*h]=r,this._bounds[4*h+1]=a,this._bounds[4*h+2]=n,this._bounds[4*h+3]=o,!0}};const ji=5e3,Ni="tileRenderer.featuresView.attributeView.initialize",Qi="tileRenderer.featuresView.attributeView.requestUpdate",Yi="tileRenderer.featuresView.requestRender";function Xi(i){return i.name==="worker:port-closed"}function se(i){if(!Ie(i)&&!Xi(i))throw i}function es(i){return i.type==="feature"&&i.mode==="snapshot"}let N=class extends xt{constructor(){super(...arguments),this._storage=new Pi,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this._updatingHandles=new It,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new lt({concurrency:this._source.type==="stream"?1:4,process:(i,e)=>this._onTileMessage(i,{signal:e})}),this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this)),Vs(()=>!this.updating,()=>this.onIdle())])}_initSource(){const i=this.tileStore.tileScheme,e=()=>this._updateQueue&&this._updateQueue.length<50,t=(s,r)=>(this._invalidated=!0,this._patchTile(s,r));this._source=oi(this.service,{...this.service,fieldsIndex:this.fieldsIndex},this.spatialReference,i,t,e,this.featureStore),this._proxyEvents()}_setStreamClientProperty(i,e){this.remoteClient.invoke("setProperty",{propertyName:i,value:e}).catch(se)}_proxyEvents(){if(this._source.type==="stream"){const i=this._source.events,e=this._source;this.addHandles([Ve(()=>e.connectionStatus,t=>this._setStreamClientProperty("pipelineConnectionStatus",t),{initial:!0}),Ve(()=>e.errorString,t=>this._setStreamClientProperty("pipelineErrorString",t),{initial:!0}),i.on("data-received",t=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:t.attributes,centroid:t.centroid,geometry:t.geometry}}).catch(se)),i.on("message-received",t=>this.remoteClient.invoke("emitEvent",{name:"message-received",event:t}).catch(se)),i.on("updateRate",t=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...t}}).catch(se))])}}_initAttributeStore(i){this.attributeStore||(this.attributeStore=new Ui({type:"remote",initialize:(e,t)=>Pe(this.remoteClient.invoke(Ni,e,{signal:t}).catch(se)),update:(e,t)=>Pe(this.remoteClient.invoke(Qi,e,{signal:t}).catch(se)),render:e=>Pe(this.remoteClient.invoke(Yi,void 0,{signal:e}).catch(se))},i))}_initStores(){const i=this.service.type==="snapshot"?"snapshot":"on-demand",e={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex};this.featureStore=new Mr(e,this._storage,i)}_initQueryEngine(i){var t;const e=this;(t=this.featureQueryEngine)==null||t.destroy(),this.featureQueryEngine=new Bt({availableFields:i.availableFields,definitionExpression:i.schema.source.definitionExpression??void 0,fieldsIndex:H.fromJSON(this.service.fieldsIndex),geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(s){return e.aggregateStore==null?[]:e.aggregateStore.getFeatureDisplayIdsForAggregate(s).map(r=>e.getObjectId(r))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(i,e){var s;if((s=this.aggregateQueryEngine)==null||s.destroy(),i==null)return;const t=e.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new Bt({definitionExpression:void 0,fieldsIndex:H.fromLayerJSON({fields:t,dateFieldsTimeReference:{timeZoneIANA:Zs}}),geometryType:i.geometryInfo.geometryType,objectIdField:i.objectIdField,hasM:i.geometryInfo.hasM,hasZ:i.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:i,aggregateAdapter:{getFeatureObjectIds:r=>[]}})}destroy(){var i,e,t;this._updateQueue.destroy(),this._source.destroy(),(i=this.featureQueryEngine)==null||i.destroy(),(e=this.aggregateQueryEngine)==null||e.destroy(),(t=this.attributeStore)==null||t.destroy();for(const s of this.tileStore.tiles)this._source.unsubscribe(s);clearInterval(this._checkUpdating),this._updatingHandles.destroy()}get fieldsIndex(){return H.fromJSON(this.service.fieldsIndex)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get dataUpdating(){return this._source.updatingHandles.updating}get updating(){return this.isUpdating()}isUpdating(){const i=this._source.updatingHandles.updating,e=!this.attributeStore||this.attributeStore.updatingHandles.updating,t=i||e||this._updatingHandles.updating;if(b("esri-2d-log-updating")){let s=`Updating FeatureController2D: ${t} +`;s+=` -> updatingSource ${i} +`;for(const r of this._source.subscriptions)s+=` ${r.tile.id} ${r.isDone} +`;s+=` -> updatingAttributeStore ${e} +`,s+=` -> updatingHandles ${this._updatingHandles.updating} (queue: ${this._updateQueue.length}) +`,console.log(s)}return t}updateCustomParameters(i){this._source.type==="stream"&&this._source.updateCustomParameters(i)}enableEvent(i){this._source.enableEvent(i.name,i.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){this._source.type==="stream"&&this._source.pauseStream()}resumeStream(){this._source.type==="stream"&&this._source.resumeStream()}sendMessageToSocket(i){this._source.type==="stream"&&this._source.sendMessageToSocket(i)}sendMessageToClient(i){this._source.type==="stream"&&this._source.sendMessageToClient(i)}_initAggregateStore(i){var t,s,r,a,n;const e=((s=(t=i.schema.targets)==null?void 0:t.aggregate)==null?void 0:s.type)??null;if((((n=(a=(r=this.config)==null?void 0:r.schema.targets)==null?void 0:a.aggregate)==null?void 0:n.type)??null)!==e&&(this.aggregateStore!=null&&(this.removeHandles("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),e)){switch(e){case"cluster":{const o={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new zi(o,this.spatialReference,this._storage,{...this.service,fieldsIndex:this.fieldsIndex}),this.addHandles(this.aggregateStore.events.on("valueRangesChanged",h=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:h.valueRanges}}).catch(se)}),"valueRangesChanged");break}case"bin":{const o={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new Oi(o,this.spatialReference,this._storage,{...this.service,fieldsIndex:this.fieldsIndex});break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(i,e){var t;this._updateVersion++,b("esri-2d-update-debug")&&console.debug(`FeatureController2D::update: Token version ${this._updateVersion}`),this._initQueryEngine(e),this._initAttributeStore(e),this.pause(),((t=this.config)==null?void 0:t.timeZone)!==e.timeZone&&(i.mesh=!0,i.storage.data=!0,i.storage.filters=!0,i.targets.aggregate=!0,i.targets.feature=!0,this.featureStore.invalidate()),await Promise.all([this._source.update(i,e.schema.source),this.featureStore.updateSchema(i,e.schema.targets.feature),this.attributeStore.update(i,e),this.attributeStore.updateFilters(i,e,this)]),this._initAggregateStore(e),this.aggregateStore!=null&&await this.aggregateStore.updateSchema(i,e.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,e.schema),b("esri-2d-update-debug")&&i.describe(),this._set("config",e)}async applyUpdate(i){i.version=this._updateVersion,b("esri-2d-update-debug")&&console.debug(`FeatureController2D::applyUpdate: Token version ${i.version}`),i.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(i),b("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for source update to finish"),this.notifyChange("updating"),await De(()=>!this.updating),b("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Source update finsihed"),this.aggregateStore!=null&&(await hs(10),b("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for aggregate idle call"),await De(()=>!this.updating),b("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Aggregate idle called")),b("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Update finished")}async onEdits({edits:i}){b("esri-2d-update-debug")&&console.debug("Applying Edit:",i),this._didEdit=!0;try{const e=i.removed.map(s=>s.objectId&&s.objectId!==-1?s.objectId:this._lookupObjectIdByGlobalId(s.globalId)),t=i.addOrModified.map(({objectId:s})=>s);this.featureStore.invalidate(),await this._source.edit(t,e),this.clearTiles(),this.notifyChange("updating"),this.aggregateStore!=null&&this.aggregateStore.clear(),await this._source.resend(),await De(()=>!this.updating)}catch{}}async refresh(i){if(!i.dataChanged){const e=z.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion,i),this._cleanupNeeded=!0,this.notifyChange("updating"),await De(()=>!this.updating)}clearTiles(){for(const i of this.tileStore.tiles)this.processor.onTileClear(i,!1)}onTileUpdate(i){this.aggregateStore!=null&&this.aggregateStore.onTileUpdate(i);for(const e of i.added){const t=this._source.subscribe(e,this._updateVersion);this._source.type!=="stream"&&this._updatingHandles.addPromise(t.done),this._level=e.level}for(const e of i.removed)this._source.unsubscribe(e),this._cleanupNeeded=!0,this._tileToResolver.has(e.id)&&(this._tileToResolver.get(e.id).resolve(),this._tileToResolver.delete(e.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,this.aggregateStore==null&&this.processor.type!=="heatmap"||await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:i,params:e}){return this.featureQueryEngine.executeQueryForSummaryStatistics(i,e)}async queryAggregateSummaryStatistics({query:i,params:e}){return this.aggregateQueryEngine.executeQueryForSummaryStatistics(this._normalizeAggregateQuery(i),e)}async queryUniqueValues({query:i,params:e}){return this.featureQueryEngine.executeQueryForUniqueValues(i,e)}async queryAggregateUniqueValues({query:i,params:e}){return this.aggregateQueryEngine.executeQueryForUniqueValues(this._normalizeAggregateQuery(i),e)}async queryClassBreaks({query:i,params:e}){return this.featureQueryEngine.executeQueryForClassBreaks(i,e)}async queryAggregateClassBreaks({query:i,params:e}){return this.aggregateQueryEngine.executeQueryForClassBreaks(this._normalizeAggregateQuery(i),e)}async queryHistogram({query:i,params:e}){return this.featureQueryEngine.executeQueryForHistogram(i,e)}async queryAggregateHistogram({query:i,params:e}){return this.aggregateQueryEngine.executeQueryForHistogram(this._normalizeAggregateQuery(i),e)}queryExtent(i){return this.featureQueryEngine.executeQueryForExtent(i)}queryAggregates(i){return this.aggregateQueryEngine.executeQuery(this._normalizeAggregateQuery(i))}queryAggregateCount(i){return this.aggregateQueryEngine.executeQueryForCount(this._normalizeAggregateQuery(i))}queryAggregateIds(i){return this.aggregateQueryEngine.executeQueryForIds(this._normalizeAggregateQuery(i))}queryFeatures(i){return this.featureQueryEngine.executeQuery(i)}async queryVisibleFeatures(i){const e=await this.featureQueryEngine.executeQuery(i),t=e.objectIdFieldName;return e.features=e.features.filter(s=>{const r=s.attributes[t],a=this.getDisplayId(r);return a!=null&&this.attributeStore.isVisible(a)}),e}queryFeatureCount(i){return this.featureQueryEngine.executeQueryForCount(i)}queryLatestObservations(i){return this.featureQueryEngine.executeQueryForLatestObservations(i)}queryObjectIds(i){return this.featureQueryEngine.executeQueryForIds(i)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(i){return this.featureStore.lookupObjectId(i,this._storage)}getDisplayId(i){if(this.aggregateStore!=null){const e=this.aggregateStore.getDisplayId(i);if(e==null){const t=this.featureStore.lookupDisplayId(i);return this.aggregateStore.getDisplayIdForReferenceId(t)}return e}return this.featureStore.lookupDisplayId(i)}getFeatures(i){const e=[],t=[];for(const s of i){const r=this.aggregateStore!=null?this.getAggregate(s):null;if(r!=null)if(r.attributes.referenceId!=null){const a=this.getFeature(r.attributes.referenceId);a!=null&&e.push(a)}else t.push(r);else{const a=this.getFeature(s);a!=null&&e.push(a)}}return{features:e,aggregates:t}}getFeature(i){const e=this.featureStore.lookupFeatureByDisplayId(i,this._storage);if(e==null)return null;const t=e.readHydratedGeometry(),s=$e(t,e.geometryType,e.hasZ,e.hasM);return{attributes:e.readAttributes(),geometry:s}}getAggregate(i){return this.aggregateStore==null?null:this.aggregateStore.getAggregate(i)}getAggregates(){return this.aggregateStore==null?[]:this.aggregateStore.getAggregates()}async setHighlight(i){const e=i.map(t=>this.getDisplayId(t)).filter(ns);return this.attributeStore.setHighlight(i,e)}_normalizeAggregateQuery(i){const e=i.objectIds??[];for(const t of i.aggregateIds??[])e.push(t);return i.objectIds=e,i.aggregateIds=[],i}_lookupObjectIdByGlobalId(i){const e=this.service.globalIdField;if(e==null)throw new Error("Expected globalIdField to be defined");let t=null;if(this.featureStore.forEach(s=>{i===s.readAttribute(e)&&(t=s.getObjectId())}),t==null)throw new Error(`Expected to find a feature with globalId ${i}`);return t}async _repushCurrentLevelTiles(){const i=this.tileStore.tiles.filter(t=>t.level===this._level);i.map(async t=>this._patchTile({type:"append",id:t.key.id,clear:!0,addOrUpdate:null,end:!1}));const e=i.map(async t=>this._patchTile({type:"append",id:t.key.id,addOrUpdate:G.fromOptimizedFeatures([],{...this.service,fieldsIndex:this.fieldsIndex}),remove:[],end:!0,isRepush:!0,status:z.empty()}));await Promise.all(e)}_maybeForceCleanup(){performance.now()-this._lastCleanup>ji&&this._markAndSweep()}_patchTile(i,e){const t=this._updateQueue.push(i,e).catch(s=>{});return this._updatingHandles.addPromise(t)}async _onTileMessage(i,e){var a,n,o;if(P(e),b("esri-2d-update-debug")){const h=(a=i.addOrUpdate)==null?void 0:a.hasFeatures;console.debug(i.id,`FeatureController:onTileMessage: [clear:${i.clear}, end:${i.end}, features: ${h}]`)}const t=this.tileStore.get(i.id);if(!t)return;if(i.clear)return this.processor.onTileClear(t,i.end);const s=i.status;this._cleanupNeeded=!0;const r=[];for(const h of i.remove??[]){const u=this.featureStore.lookupDisplayId(h);u&&r.push(u)}i.remove=r;try{if(i.addOrUpdate==null)return void this.processor.onTileMessage(t,{...i,addOrUpdate:null},this.aggregateStore!=null,e).catch(He);if(i.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(i.addOrUpdate.instance)&&s.targets.feature||(s.targets.feature=!0,this.featureStore.onTileData(t,i,(n=this.config)==null?void 0:n.timeZone)),(!s.storage.data||!s.storage.filters)&&(s.storage.data=!0,s.storage.filters=!0,this.attributeStore.onTileData(t,i),this._source.type==="stream"||this._didEdit?(await this.attributeStore.sendUpdates(),P(e)):this.attributeStore.sendUpdates()),this.aggregateStore!=null&&!s.targets.aggregate){s.targets.aggregate=!0;const h=es(this._source)&&this._source.loading,u=!es(this._source)||h||i.end;if(this.aggregateStore.onTileData(t,i,this._storage,this.attributeStore,(o=this.config)==null?void 0:o.timeZone,u),!u)return;s.mesh||(this.attributeStore.onTileData(t,i),await this.attributeStore.sendUpdates())}if(!s.mesh){s.mesh=!0;const h=this.aggregateStore!=null&&this.aggregateStore.type==="cluster";await this.processor.onTileMessage(t,i,h,e),P(e)}this._maybeForceCleanup()}catch(h){He(h)}}_mark(i,e,t){const s=(4294901760&this._storage.getInstanceId(i))>>>16;i&&(e.add(s),t.set(i))}_markAndSweep(){if(this._lastCleanup=performance.now(),!(!(this._source.type==="feature"&&this._source.mode==="snapshot")&&(this._source.type==="stream"||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const i=this._storage.getBitset(this._markedIdsBufId),e=new Set;i.clear();for(const t of this.tileStore.tiles)for(const s of this._source.readers(t.id)){const r=s.getCursor();for(;r.next();){let a=r.getDisplayId();if(!a){const n=r.getObjectId();a=this.featureStore.lookupDisplayId(n)}this._mark(a,e,i)}}this.processor.type==="symbol"&&this.processor.forEachBufferId(t=>{this._mark(t,e,i)}),this._updateQueue.forEach(t=>{for(const s of t.remove??[]){const r=this.featureStore.lookupDisplayId(s);this._mark(r,e,i)}}),this.aggregateStore!=null&&(this.aggregateStore.sweepFeatures(i,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(i,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(e)}};k([O({constructOnly:!0})],N.prototype,"tileStore",void 0),k([O()],N.prototype,"config",void 0),k([O({readOnly:!0})],N.prototype,"fieldsIndex",null),k([O()],N.prototype,"processor",void 0),k([O({constructOnly:!0})],N.prototype,"remoteClient",void 0),k([O({constructOnly:!0})],N.prototype,"service",void 0),k([O()],N.prototype,"spatialReference",null),k([O()],N.prototype,"dataUpdating",null),k([O()],N.prototype,"updating",null),N=k([Je("esri.views.2d.layers.features.controllers.FeatureController2D")],N);const Hi=N;let ts=class bs{constructor(e,t){this.key=new ps(0,0,0,0),this.bounds=Js(),this.objectIds=new Set,this.key.set(t);const s=e.getLODInfoAt(this.key);this.tileInfoView=e,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.scale=s.scale,this.level=s.level}get id(){return this.key.id}get extent(){return vt.fromBounds(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}createChildTiles(){const e=this.key.getChildKeys(),t=Ws.acquire();for(let s=0;s({minX:t.bounds[0],minY:t.bounds[1],maxX:t.bounds[2],maxY:t.bounds[3]}):[".bounds[0]",".bounds[1]",".bounds[2]",".bounds[3]"]),this.tiles=[],this.tileScheme=e}destroy(){this.clear()}clear(){this.tiles.length=0,this._tiles.clear(),this._index.clear()}has(e){return this._tiles.has(e)}get(e){return this._tiles.get(e)}boundsIntersections(e){return this._index.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]})}updateTiles(e){const t={added:[],removed:[]};for(const s of e.added)if(!this.has(s)){const r=new ts(this.tileScheme,s);this._tiles.set(s,r),this._index.insert(r),t.added.push(r)}for(const s of e.removed)if(this.has(s)){const r=this.get(s);this._tiles.delete(s),this._index.remove(r),t.removed.push(r)}this.tiles.length=0,this._tiles.forEach(s=>this.tiles.push(s)),(t.added.length||t.removed.length)&&this.emit("update",t)}setViewState(e){const t=this.tileScheme.getTileCoverage(e,0);if(!t)return;const{spans:s,lodInfo:r}=t,{level:a}=r;if(s.length>0)for(const{row:n,colFrom:o,colTo:h}of s)for(let u=o;u<=h;u++){const d=Vi.set(a,n,r.normalizeCol(u),r.getWorldForColumn(u)).id;if(dt.add(d),!this.has(d)){const l=new ts(this.tileScheme,d);this._tiles.set(d,l),this._index.insert(l),this.tiles.push(l),he.added.push(l)}}for(let n=this.tiles.length-1;n>=0;n--){const o=this.tiles[n];dt.has(o.id)||(this._tiles.delete(o.id),this.tiles.splice(n,1),this._index.remove(o),he.removed.push(o))}(he.added.length||he.removed.length)&&this.emit("update",he),er.pool.release(t),dt.clear(),he.added.length=0,he.removed.length=0}},ue=class extends xt{constructor(){super(...arguments),this.controller=null,this.processor=null,this.remoteClient=null,this.tileStore=null,this.service=null,this.viewState=null,this._paused=!1,this._pendingTileUpdates=[]}initialize(){this.addHandles([Ve(()=>this.updating,i=>{this.remoteClient.invoke("setUpdating",i).catch(e=>{})})])}destroy(){var i,e;this.stop(),(i=this.controller)==null||i.destroy(),(e=this.processor)==null||e.destroy(),this.controller=this.processor=this.tileStore=this.remoteClient=null}get updating(){return!this.controller||this.controller.updating}stop(){var i,e,t;this._paused=!0,Array.isArray((i=this.service)==null?void 0:i.source)&&(this.service.source.forEach(s=>s.close()),this.service.source.length=0),(e=this.tileStore)==null||e.updateTiles({added:[],removed:this.tileStore.tiles.map(s=>s.id)}),(t=this.tileStore)==null||t.destroy(),this.tileStore=null,this._pendingTileUpdates.length=0}async startup({service:i,config:e,tileInfo:t,tiles:s}){var r,a,n;if(this._paused=!0,Array.isArray((r=this.service)==null?void 0:r.source)&&(this.service.source.forEach(o=>o.close()),this.service.source.length=0),this.service=i,!this.tileStore||!tr(this.tileStore.tileScheme.spatialReference,t.spatialReference)){const o=new sr(rr.fromJSON(t));s.added.length=s.removed.length=0,(a=this.tileStore)==null||a.updateTiles({added:[],removed:this.tileStore.tiles.map(h=>h.id)}),(n=this.tileStore)==null||n.destroy(),this.tileStore=new Zi(o),this._pendingTileUpdates.length=0}for(await this._createProcessorAndController(e),await this.update({config:e}),this.controller.resume(),this.tileStore.clear(),this.tileStore.updateTiles(s),this._paused=!1;this._pendingTileUpdates.length;)this.tileStore.updateTiles(this._pendingTileUpdates.pop())}async updateTiles(i){var e;this._paused?this._pendingTileUpdates.push(i):(e=this.tileStore)==null||e.updateTiles(i)}async update({config:i}){const e=z.empty();return await Promise.all([this.processor.update(e,i),this.controller.update(e,i)]),e.toJSON()}async applyUpdate(i){return this.controller.applyUpdate(z.create(i))}async _createProcessorAndController(i){await Promise.all([this._handleControllerConfig(i),this._handleProcessorConfig(i)]),this.controller.processor=this.processor}async _handleControllerConfig(i){return this._createController(this.service,i)}async _handleProcessorConfig(i){return this._createProcessor(this.service,i)}async _createController(i,e){this.controller&&(this.controller.destroy(),this.removeHandles("controller"));const{tileStore:t,remoteClient:s}=this,r=new Hi({service:i,tileStore:t,remoteClient:s}),a=Ve(()=>r.dataUpdating,n=>{this.remoteClient.invoke("setDataUpdating",n).catch(o=>{})});return this.addHandles(a,"controller"),this.controller=r,r}async _createProcessor(i,e){const t=e.schema.processors[0].type,s=(await fr(t)).default,{remoteClient:r,tileStore:a}=this,n=new s({service:i,config:e,tileStore:a,remoteClient:r});return this.processor&&this.processor.destroy(),this.processor=n,n}};k([O()],ue.prototype,"controller",void 0),k([O()],ue.prototype,"processor",void 0),k([O()],ue.prototype,"updating",null),k([O()],ue.prototype,"viewState",void 0),ue=k([Je("esri.views.2d.layers.features.Pipeline")],ue);const Ji=ue,Ba=Object.freeze(Object.defineProperty({__proto__:null,default:Ji},Symbol.toStringTag,{value:"Module"}));export{Ma as G,Ft as I,Ba as P,Aa as R,_e as f,Ca as k,Fa as p}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/HeatmapProcessor-E3j18Ktz.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/definitions-SVBNHUSH.js","assets/BaseProcessor-yc_MfkjR.js","assets/SymbolProcessor-dUsJwb8f.js","assets/cimAnalyzer-X6MTpVAO.js","assets/labelPoint-1MOq4I_J.js","assets/TileClipper-NSFZXMR1.js","assets/number-sTjsTbdA.js","assets/BidiEngine-8z8MVveq.js","assets/enums-uQoFEhYh.js","assets/TurboLine-cWldrV9L.js","assets/Rect-bBBxMtVp.js","assets/GeometryUtils-K2DOc0l8.js","assets/FeatureFilter-_YQPNaln.js","assets/QueryEngine-uvDs-vBe.js","assets/WhereClause-FOYoIAAW.js","assets/TimeOnly-gkehHHJx.js","assets/json-v6EOeNTY.js","assets/QueryEngineCapabilities-PzVpW5yD.js","assets/utils-jVYIoPxv.js","assets/generateRendererUtils-3JJTfr19.js","assets/StreamFeatureManager-Iguqr18K.js","assets/quickselect-0UUnLNDW.js","assets/ogcFeatureUtils-8dWL_GtH.js","assets/geojson-162a_hNo.js","assets/date-be_IQzZd.js","assets/clientSideDefaults-63pOkJ4Y.js","assets/createConnection-iXdhuUHv.js","assets/geohashUtils-U0jvYCSY.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/PointCloudLayer-qVzMPRjJ.js b/dist/assets/PointCloudLayer-EgPyZPkK.js similarity index 82% rename from dist/assets/PointCloudLayer-qVzMPRjJ.js rename to dist/assets/PointCloudLayer-EgPyZPkK.js index 80919de..87794ba 100644 --- a/dist/assets/PointCloudLayer-qVzMPRjJ.js +++ b/dist/assets/PointCloudLayer-EgPyZPkK.js @@ -1,4 +1,4 @@ -import{e as r,y as i,c as y,dr as B,ey as x,iw as g,bI as u,iO as V,em as E,dM as N,dN as _,dO as O,dP as L,en as A,dw as w,dD as D,dQ as k,il as K,oI as C,E as l,h6 as M,bW as G,iP as P,iQ as T,iR as Q,Z as F,iS as U,iu as z,iv as H,dt as W,iH as Z,dV as J,du as X,ix as Y,c7 as ee}from"./index-J0iiHjMT.js";import{c as q,d as te,b as re,a as ie}from"./PointCloudUniqueValueRenderer-RbbyNiwC.js";let f=class extends B{constructor(e){super(e),this.field=null,this.type=null}clone(){return console.warn(".clone() is not implemented for "+this.declaredClass),null}};r([i({type:String,json:{write:{enabled:!0,isRequired:!0}}})],f.prototype,"field",void 0),r([i({readOnly:!0,nonNullable:!0,json:{read:!1}})],f.prototype,"type",void 0),f=r([y("esri.layers.pointCloudFilters.PointCloudFilter")],f);const m=f;var b;let d=b=class extends m{constructor(e){super(e),this.requiredClearBits=null,this.requiredSetBits=null,this.type="bitfield"}clone(){return new b({field:this.field,requiredClearBits:u(this.requiredClearBits),requiredSetBits:u(this.requiredSetBits)})}};r([i({type:[x],json:{write:{enabled:!0,overridePolicy(){return{enabled:!0,isRequired:!this.requiredSetBits}}}}})],d.prototype,"requiredClearBits",void 0),r([i({type:[x],json:{write:{enabled:!0,overridePolicy(){return{enabled:!0,isRequired:!this.requiredClearBits}}}}})],d.prototype,"requiredSetBits",void 0),r([g({pointCloudBitfieldFilter:"bitfield"})],d.prototype,"type",void 0),d=b=r([y("esri.layers.pointCloudFilters.PointCloudBitfieldFilter")],d);const oe=d;var I;let h=I=class extends m{constructor(e){super(e),this.includedReturns=[],this.type="return"}clone(){return new I({field:this.field,includedReturns:u(this.includedReturns)})}};r([i({type:[["firstOfMany","last","lastOfMany","single"]],json:{write:{enabled:!0,isRequired:!0}}})],h.prototype,"includedReturns",void 0),r([g({pointCloudReturnFilter:"return"})],h.prototype,"type",void 0),h=I=r([y("esri.layers.pointCloudFilters.PointCloudReturnFilter")],h);const se=h;var $;let p=$=class extends m{constructor(e){super(e),this.mode="exclude",this.type="value",this.values=[]}clone(){return new $({field:this.field,mode:this.mode,values:u(this.values)})}};r([i({type:["exclude","include"],json:{write:{enabled:!0,isRequired:!0}}})],p.prototype,"mode",void 0),r([g({pointCloudValueFilter:"value"})],p.prototype,"type",void 0),r([i({type:[Number],json:{write:{enabled:!0,isRequired:!0}}})],p.prototype,"values",void 0),p=$=r([y("esri.layers.pointCloudFilters.PointCloudValueFilter")],p);const ne=p,ae={key:"type",base:m,typeMap:{value:ne,bitfield:oe,return:se}};var S;let v=S=class extends q{constructor(e){super(e),this.type="point-cloud-rgb",this.field=null}clone(){return new S({...this.cloneProperties(),field:u(this.field)})}};r([g({pointCloudRGBRenderer:"point-cloud-rgb"})],v.prototype,"type",void 0),r([i({type:String,json:{write:!0}})],v.prototype,"field",void 0),v=S=r([y("esri.renderers.PointCloudRGBRenderer")],v);const le=v,R={key:"type",base:q,typeMap:{"point-cloud-class-breaks":te,"point-cloud-rgb":le,"point-cloud-stretch":re,"point-cloud-unique-value":ie},errorContext:"renderer"},j=Y();let o=class extends V(E(N(_(O(L(A(ee))))))){constructor(...e){super(...e),this.operationalLayerType="PointCloudLayer",this.popupEnabled=!0,this.popupTemplate=null,this.opacity=1,this.filters=[],this.fields=null,this.fieldsIndex=null,this.outFields=null,this.path=null,this.legendEnabled=!0,this.renderer=null,this.type="point-cloud"}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}get defaultPopupTemplate(){return this.attributeStorageInfo?this.createPopupTemplate():null}getFieldDomain(e){const t=this.fieldsIndex.get(e);return t!=null&&t.domain?t.domain:null}readServiceFields(e,t,n){return Array.isArray(e)?e.map(s=>{const a=new w;return s.type==="FieldTypeInteger"&&((s=u(s)).type="esriFieldTypeInteger"),a.read(s,n),a}):Array.isArray(t.attributeStorageInfo)?t.attributeStorageInfo.map(s=>new w({name:s.name,type:s.name==="ELEVATION"?"double":"integer"})):null}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}writeRenderer(e,t,n,s){D("layerDefinition.drawingInfo.renderer",e.write({},s),t)}load(e){const t=e!=null?e.signal:null,n=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(k).then(()=>this._fetchService(t));return this.addResolvingPromise(n),Promise.resolve(this)}createPopupTemplate(e){const t=K(this,e);return t&&(this._formatPopupTemplateReturnsField(t),this._formatPopupTemplateRGBField(t)),t}_formatPopupTemplateReturnsField(e){var a;const t=this.fieldsIndex.get("RETURNS");if(!t)return;const n=(a=e.fieldInfos)==null?void 0:a.find(c=>c.fieldName===t.name);if(!n)return;const s=new C({name:"pcl-returns-decoded",title:t.alias||t.name,expression:` +import{e as r,y as i,c as y,dr as B,er as x,iy as g,ah as u,iR as V,ef as _,dH as E,dI as L,dJ as N,dK as O,eg as A,es as w,dy as K,dL as k,io as D,oV as C,r as l,h8 as G,av as M,iS as T,iT as R,iU as U,R as F,iV as z,iw as H,ix as J,dt as Q,iI as W,dQ as X,du as Y,iz as Z,aI as ee}from"./index-pCX-0tJH.js";import{c as q,d as te,b as re,a as ie}from"./PointCloudUniqueValueRenderer-mGlOSV4H.js";let f=class extends B{constructor(e){super(e),this.field=null,this.type=null}clone(){return console.warn(".clone() is not implemented for "+this.declaredClass),null}};r([i({type:String,json:{write:{enabled:!0,isRequired:!0}}})],f.prototype,"field",void 0),r([i({readOnly:!0,nonNullable:!0,json:{read:!1}})],f.prototype,"type",void 0),f=r([y("esri.layers.pointCloudFilters.PointCloudFilter")],f);const m=f;var b;let d=b=class extends m{constructor(e){super(e),this.requiredClearBits=null,this.requiredSetBits=null,this.type="bitfield"}clone(){return new b({field:this.field,requiredClearBits:u(this.requiredClearBits),requiredSetBits:u(this.requiredSetBits)})}};r([i({type:[x],json:{write:{enabled:!0,overridePolicy(){return{enabled:!0,isRequired:!this.requiredSetBits}}}}})],d.prototype,"requiredClearBits",void 0),r([i({type:[x],json:{write:{enabled:!0,overridePolicy(){return{enabled:!0,isRequired:!this.requiredClearBits}}}}})],d.prototype,"requiredSetBits",void 0),r([g({pointCloudBitfieldFilter:"bitfield"})],d.prototype,"type",void 0),d=b=r([y("esri.layers.pointCloudFilters.PointCloudBitfieldFilter")],d);const oe=d;var I;let h=I=class extends m{constructor(e){super(e),this.includedReturns=[],this.type="return"}clone(){return new I({field:this.field,includedReturns:u(this.includedReturns)})}};r([i({type:[["firstOfMany","last","lastOfMany","single"]],json:{write:{enabled:!0,isRequired:!0}}})],h.prototype,"includedReturns",void 0),r([g({pointCloudReturnFilter:"return"})],h.prototype,"type",void 0),h=I=r([y("esri.layers.pointCloudFilters.PointCloudReturnFilter")],h);const se=h;var $;let p=$=class extends m{constructor(e){super(e),this.mode="exclude",this.type="value",this.values=[]}clone(){return new $({field:this.field,mode:this.mode,values:u(this.values)})}};r([i({type:["exclude","include"],json:{write:{enabled:!0,isRequired:!0}}})],p.prototype,"mode",void 0),r([g({pointCloudValueFilter:"value"})],p.prototype,"type",void 0),r([i({type:[Number],json:{write:{enabled:!0,isRequired:!0}}})],p.prototype,"values",void 0),p=$=r([y("esri.layers.pointCloudFilters.PointCloudValueFilter")],p);const ne=p,ae={key:"type",base:m,typeMap:{value:ne,bitfield:oe,return:se}};var S;let v=S=class extends q{constructor(e){super(e),this.type="point-cloud-rgb",this.field=null}clone(){return new S({...this.cloneProperties(),field:u(this.field)})}};r([g({pointCloudRGBRenderer:"point-cloud-rgb"})],v.prototype,"type",void 0),r([i({type:String,json:{write:!0}})],v.prototype,"field",void 0),v=S=r([y("esri.renderers.PointCloudRGBRenderer")],v);const le=v,P={key:"type",base:q,typeMap:{"point-cloud-class-breaks":te,"point-cloud-rgb":le,"point-cloud-stretch":re,"point-cloud-unique-value":ie},errorContext:"renderer"},j=Z();let o=class extends V(_(E(L(N(O(A(ee))))))){constructor(...e){super(...e),this.operationalLayerType="PointCloudLayer",this.popupEnabled=!0,this.popupTemplate=null,this.opacity=1,this.filters=[],this.fields=null,this.fieldsIndex=null,this.outFields=null,this.path=null,this.legendEnabled=!0,this.renderer=null,this.type="point-cloud"}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}get defaultPopupTemplate(){return this.attributeStorageInfo?this.createPopupTemplate():null}getFieldDomain(e){const t=this.fieldsIndex.get(e);return t!=null&&t.domain?t.domain:null}readServiceFields(e,t,n){return Array.isArray(e)?e.map(s=>{const a=new w;return s.type==="FieldTypeInteger"&&((s=u(s)).type="esriFieldTypeInteger"),a.read(s,n),a}):Array.isArray(t.attributeStorageInfo)?t.attributeStorageInfo.map(s=>new w({name:s.name,type:s.name==="ELEVATION"?"double":"integer"})):null}set elevationInfo(e){this._set("elevationInfo",e),this._validateElevationInfo()}writeRenderer(e,t,n,s){K("layerDefinition.drawingInfo.renderer",e.write({},s),t)}load(e){const t=e!=null?e.signal:null,n=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(k).then(()=>this._fetchService(t));return this.addResolvingPromise(n),Promise.resolve(this)}createPopupTemplate(e){const t=D(this,e);return t&&(this._formatPopupTemplateReturnsField(t),this._formatPopupTemplateRGBField(t)),t}_formatPopupTemplateReturnsField(e){var a;const t=this.fieldsIndex.get("RETURNS");if(!t)return;const n=(a=e.fieldInfos)==null?void 0:a.find(c=>c.fieldName===t.name);if(!n)return;const s=new C({name:"pcl-returns-decoded",title:t.alias||t.name,expression:` var returnValue = $feature.${t.name}; return (returnValue % 16) + " / " + Floor(returnValue / 16); `});e.expressionInfos=[...e.expressionInfos||[],s],n.fieldName="expression/pcl-returns-decoded"}_formatPopupTemplateRGBField(e){var a;const t=this.fieldsIndex.get("RGB");if(!t)return;const n=(a=e.fieldInfos)==null?void 0:a.find(c=>c.fieldName===t.name);if(!n)return;const s=new C({name:"pcl-rgb-decoded",title:t.alias||t.name,expression:` @@ -8,4 +8,4 @@ import{e as r,y as i,c as y,dr as B,ey as x,iw as g,bI as u,iO as V,em as E,dM a var blue = rgb - (red * 65536) - (green * 256); return "rgb(" + red + "," + green + "," + blue + ")"; - `});e.expressionInfos=[...e.expressionInfos||[],s],n.fieldName="expression/pcl-rgb-decoded"}async queryCachedStatistics(e,t){if(await this.load(t),!this.attributeStorageInfo)throw new l("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const n=this.fieldsIndex.get(e);if(!n)throw new l("pointcloudlayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const s of this.attributeStorageInfo)if(s.name===n.name){const a=M(this.parsedUrl.path,`./statistics/${s.key}`);return G(a,{query:{f:"json",token:this.apiKey},responseType:"json",signal:t?t.signal:null}).then(c=>c.data)}throw new l("pointcloudlayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,t){return this._debouncedSaveOperations(P.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"point-cloud"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"point-cloud"};return this._debouncedSaveOperations(P.SAVE,e)}validateLayer(e){if(e.layerType&&e.layerType!=="PointCloud")throw new l("pointcloudlayer:layer-type-not-supported","PointCloudLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new l("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x-2.x"});if(this.version.major>2)throw new l("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x-2.x"})}hasCachedStatistics(e){return this.attributeStorageInfo!=null&&this.attributeStorageInfo.some(t=>t.name===e)}_getTypeKeywords(){return["PointCloud"]}_validateElevationInfo(){const e=this.elevationInfo;T(F.getLogger(this),Q("Point cloud layers","absolute-height",e)),T(F.getLogger(this),U("Point cloud layers",e))}};r([i({type:["PointCloudLayer"]})],o.prototype,"operationalLayerType",void 0),r([i(z)],o.prototype,"popupEnabled",void 0),r([i({type:H,json:{name:"popupInfo",write:!0}})],o.prototype,"popupTemplate",void 0),r([i({readOnly:!0,json:{read:!1}})],o.prototype,"defaultPopupTemplate",null),r([i({readOnly:!0,json:{write:!1,read:!1,origins:{"web-document":{write:!1,read:!1}}}})],o.prototype,"opacity",void 0),r([i({type:["show","hide"]})],o.prototype,"listMode",void 0),r([i({types:[ae],json:{origins:{service:{read:{source:"filters"}}},name:"layerDefinition.filters",write:!0}})],o.prototype,"filters",void 0),r([i({type:[w]})],o.prototype,"fields",void 0),r([i(j.fieldsIndex)],o.prototype,"fieldsIndex",void 0),r([W("service","fields",["fields","attributeStorageInfo"])],o.prototype,"readServiceFields",null),r([i(j.outFields)],o.prototype,"outFields",void 0),r([i({readOnly:!0})],o.prototype,"attributeStorageInfo",void 0),r([i(Z)],o.prototype,"elevationInfo",null),r([i({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],o.prototype,"path",void 0),r([i(J)],o.prototype,"legendEnabled",void 0),r([i({types:R,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:{target:{"layerDefinition.drawingInfo.renderer":{types:R},"layerDefinition.drawingInfo.transparency":{type:Number}}}}})],o.prototype,"renderer",void 0),r([X("renderer")],o.prototype,"writeRenderer",null),r([i({json:{read:!1},readOnly:!0})],o.prototype,"type",void 0),o=r([y("esri.layers.PointCloudLayer")],o);const ue=o;export{ue as default}; + `});e.expressionInfos=[...e.expressionInfos||[],s],n.fieldName="expression/pcl-rgb-decoded"}async queryCachedStatistics(e,t){if(await this.load(t),!this.attributeStorageInfo)throw new l("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const n=this.fieldsIndex.get(e);if(!n)throw new l("pointcloudlayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const s of this.attributeStorageInfo)if(s.name===n.name){const a=G(this.parsedUrl.path,`./statistics/${s.key}`);return M(a,{query:{f:"json",token:this.apiKey},responseType:"json",signal:t?t.signal:null}).then(c=>c.data)}throw new l("pointcloudlayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,t){return this._debouncedSaveOperations(T.SAVE_AS,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"point-cloud"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"point-cloud"};return this._debouncedSaveOperations(T.SAVE,e)}validateLayer(e){if(e.layerType&&e.layerType!=="PointCloud")throw new l("pointcloudlayer:layer-type-not-supported","PointCloudLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new l("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x-2.x"});if(this.version.major>2)throw new l("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x-2.x"})}hasCachedStatistics(e){return this.attributeStorageInfo!=null&&this.attributeStorageInfo.some(t=>t.name===e)}_getTypeKeywords(){return["PointCloud"]}_validateElevationInfo(){const e=this.elevationInfo;R(F.getLogger(this),U("Point cloud layers","absolute-height",e)),R(F.getLogger(this),z("Point cloud layers",e))}};r([i({type:["PointCloudLayer"]})],o.prototype,"operationalLayerType",void 0),r([i(H)],o.prototype,"popupEnabled",void 0),r([i({type:J,json:{name:"popupInfo",write:!0}})],o.prototype,"popupTemplate",void 0),r([i({readOnly:!0,json:{read:!1}})],o.prototype,"defaultPopupTemplate",null),r([i({readOnly:!0,json:{write:!1,read:!1,origins:{"web-document":{write:!1,read:!1}}}})],o.prototype,"opacity",void 0),r([i({type:["show","hide"]})],o.prototype,"listMode",void 0),r([i({types:[ae],json:{origins:{service:{read:{source:"filters"}}},name:"layerDefinition.filters",write:!0}})],o.prototype,"filters",void 0),r([i({type:[w]})],o.prototype,"fields",void 0),r([i(j.fieldsIndex)],o.prototype,"fieldsIndex",void 0),r([Q("service","fields",["fields","attributeStorageInfo"])],o.prototype,"readServiceFields",null),r([i(j.outFields)],o.prototype,"outFields",void 0),r([i({readOnly:!0})],o.prototype,"attributeStorageInfo",void 0),r([i(W)],o.prototype,"elevationInfo",null),r([i({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],o.prototype,"path",void 0),r([i(X)],o.prototype,"legendEnabled",void 0),r([i({types:P,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:{target:{"layerDefinition.drawingInfo.renderer":{types:P},"layerDefinition.drawingInfo.transparency":{type:Number}}}}})],o.prototype,"renderer",void 0),r([Y("renderer")],o.prototype,"writeRenderer",null),r([i({json:{read:!1},readOnly:!0})],o.prototype,"type",void 0),o=r([y("esri.layers.PointCloudLayer")],o);const ue=o;export{ue as default}; diff --git a/dist/assets/PointCloudLayerView3D-KHREaqUZ.js b/dist/assets/PointCloudLayerView3D-LHTTpHpk.js similarity index 63% rename from dist/assets/PointCloudLayerView3D-KHREaqUZ.js rename to dist/assets/PointCloudLayerView3D-LHTTpHpk.js index dc21d58..290b21c 100644 --- a/dist/assets/PointCloudLayerView3D-KHREaqUZ.js +++ b/dist/assets/PointCloudLayerView3D-LHTTpHpk.js @@ -1,4 +1,4 @@ -import{ls as tt,ax as A,yw as it,eh as Q,yx as Qe,yy as We,yz as st,yA as rt,tH as nt,e as p,y as b,c as ue,S as ot,a2 as Te,yB as at,c9 as lt,y8 as dt,yC as de,yD as ht,xz as ut,xA as w,xC as ct,bf as B,yE as pt,o7 as _t,bw as gt,yF as ft,yG as fe,hL as ee,yH as mt,yI as me,as as be,xn as L,yJ as bt,yK as yt,xy as C,yL as St,yM as xt,bA as Pt,aa as k,a9 as vt,xM as wt,de as Nt,xO as zt,xP as Ct,y6 as Ue,xQ as Rt,lZ as $t,xU as At,xW as It,yn as Ot,yp as Mt,xL as E,xN as Et,sk as ye,qE as Se,yN as Ft,a_ as Lt,lX as Be,cd as kt,aT as Ge,aU as xe,aQ as Vt,au as Dt,bb as qt,t3 as Ht,yO as Pe,yP as je,yQ as Qt,sD as Wt,yR as Tt,cP as Ut,aY as T,b3 as Bt,m6 as Gt,uS as te,rd as jt,l9 as Jt,s6 as ve,yS as Yt,uT as we,uU as Ne,yT as Kt,tO as Xt,fH as ze,yU as Zt,dA as ei,lU as ti,bB as ii,yV as si,yW as ri,tM as Ce,P as x,d as ni,C as oi,ai,n as Re,a as li,jT as di,q5 as hi,si as ui,jR as ci,yX as pi,yY as _i,e3 as $e,V as gi,sG as fi,yZ as mi,tS as bi,f as yi,Z as ie,gH as Si,s as Ae,aE as xi,y_ as Pi,lD as Ie,gm as vi,fi as wi,ae as Ni,gO as zi,jN as Ci,ov as Ri}from"./index-J0iiHjMT.js";import{n as $i}from"./LayerView3D-iOx2MD1g.js";import{c as Ai,u as Ii,a as Oi}from"./PointCloudWorkerUtil-q8ml4JQu.js";import{i as Mi}from"./PopupSceneLayerView-cRxapYqF.js";import{u as Ei}from"./LayerView-efDufa6j.js";import"./PointCloudUniqueValueRenderer-RbbyNiwC.js";let Fi=class extends tt{constructor(t){super("PointCloudWorker","transform",{transform:i=>this._getTransferList(i)},t)}_getTransferList(t){const i=[t.geometryBuffer];if(t.primaryAttributeData!=null&&t.primaryAttributeData.buffer&&i.push(t.primaryAttributeData.buffer),t.modulationAttributeData!=null&&t.modulationAttributeData.buffer&&i.push(t.modulationAttributeData.buffer),t.filterAttributesData!=null)for(const s of t.filterAttributesData)s!=null&&s.buffer&&i.push(s.buffer);for(const s of t.userAttributesData)s.buffer&&i.push(s.buffer);return i}};function Li(e,t,i){for(let r=0;r=0&&(re[r]=!0,R[n]!=null?R[n].push(t[r]):R[n]=[t[r]])}for(let r=0;r=0&&(se[r]=!0,$[n]!=null?$[n].push(e[r]):$[n]=[e[r]])}const s=[];for(let r=0;r1||$[r][0]!==t[r])&&s.push({load:[t[r]],remove:$[r]});for(let r=0;r1||R[r][0]!==e[r])&&s.push({load:R[r],remove:[e[r]]});return s}const se=[!1],R=[null],re=[!1],$=[null];function Oe(e,t,i){let s=e;for(;s>0;){const r=t.indexOf(s);if(r>=0)return r;s=i.getParentId(s)}return t.indexOf(s)}function ki(e,t,i){return e.sort((s,r)=>{if(s.load.length===0&&r.load.length===0)return 0;if(s.load.length===0)return-1;if(r.load.length===0)return 1;if(s.remove.length===0&&r.remove.length===0){const n=i.getRenderCenter(s.load[0]),a=i.getRenderCenter(r.load[0]);return A(n,t)-A(a,t)}if(s.remove.length===0)return-1;if(r.remove.length===0)return 1;if(s.load.length===1&&r.load.length===1){const n=i.getRenderCenter(s.load[0]),a=i.getRenderCenter(r.load[0]);return A(n,t)-A(a,t)}if(s.load.length===1)return-1;if(r.load.length===1)return 1;{const n=i.getRenderCenter(s.remove[0]),a=i.getRenderCenter(r.remove[0]);return A(n,t)-A(a,t)}})}function Vi(e,t,i){for(let s=0;st&&r.remove.length===1&&Di(e,r,i)}}function Di(e,t,i){const s=[t.remove[0]],r=[];for(;s.length===1;){const n=s.pop();r.length=0;for(let a=0;a1?e.push({remove:[s[n]],load:r[n]}):s[n]=r[n][0]}class qi{constructor(t,i,s){this._pages=[],this.pageSize=0,this._nodeSR=null,this._renderSR=null,this._nodeSR=t,this._renderSR=i,this.pageSize=s}addPage(t,i,s=0){for(;this._pages.lengthHi(t,i,s)}}function Hi(e,t,i){const s=e.index;if(!s.hasNodes(0,1))return;const r=e.queue;r.length=0,r.push(0);const n=e.masks;for(n.length=0,n.push(0);r.length>0;){const a=r.pop();let o=n.pop();const l=s.getNode(a),d=s.getRenderObb(a);let g=!0;if(t.clippingBox!=null){const _=1<0?g=!1:u<0&&(o|=c)}}if(i.predicate(a,l,g)){const _=l.firstChild,c=l.childCount;let u=!1;const y=v(_,s.pageSize),N=v(_+c-1,s.pageSize);for(let f=y;f<=N;f++)if(!s.hasPage(f)){i.pageMiss(a,f),u=!0;break}if(!u)for(let f=0;f({filterJSON:i.toJSON(),attributeInfo:W(e.attributeStorageInfo,i.field)})):[]}function Ti(e){const t=e==null?void 0:e.pointSizeAlgorithm;return t&&t.type==="splat"?t:null}function Fe(e){const t=e==null?void 0:e.pointSizeAlgorithm;return t&&t.type==="fixed-size"?t:null}function Ui(e){const t=e==null?void 0:e.pointSizeAlgorithm;return!!(t!=null&&t.type)&&t.type==="fixed-size"}function Le(e,t){for(const i of e??[])if(i.name===t&&i.attributeValues!=null&&i.attributeValues.valueType==="UInt8"&&i.attributeValues.valuesPerElement===3)return{name:t,storageInfo:i,useElevation:!1};return null}function W(e,t){for(const i of e??[])if(i.name===t){const s=i.encoding==="embedded-elevation";return s?{name:t,storageInfo:null,useElevation:s}:{name:t,storageInfo:i,useElevation:s}}return(t==null?void 0:t.toLowerCase())==="elevation"?{name:t,storageInfo:null,useElevation:!0}:null}let H=class extends ot{constructor(e){super(e),this.pointCloudMetadata=null}};p([b({constructOnly:!0,clonable:"reference"})],H.prototype,"pointCloudMetadata",void 0),H=p([ue("esri.views.3d.layers.i3s.PointGraphic")],H);class Bi{constructor(t){this._context=t,this._highlights=new Set}get empty(){return this._highlights.size===0}destroy(){this._highlights=null}add(t){const i=new Gi(t);return this._highlights.add(i),this._enableSet(i),Te(()=>this._removeSet(i))}_removeSet(t){this._disableSet(t),this._highlights.delete(t)}_enableSet(t){t.enabled||(t.enabled=!0,this._context.forEachNode(i=>this._enableSetForNode(t,i)))}_enableSetForNode(t,i){if(!t.enabled)return;const s=t.ids.get(i.id);s&&s.forEach(r=>this._context.addHighlight(i,r,t.id))}_disableSet(t){t.enabled&&(t.enabled=!1,this._context.forEachNode(i=>this._disableSetForNode(t,i)))}_disableSetForNode(t,i){t.enabled||this._context.removeHighlight(i,t.id)}nodeAdded(t){this._highlights.forEach(i=>this._enableSetForNode(i,t))}nodeRemoved(t){this._highlights.forEach(i=>this._disableSetForNode(i,t))}removeAll(){this._highlights.forEach(t=>this._disableSet(t))}}class Gi{constructor(t){this.id=new at(lt.Highlight),this.ids=new Map,this.enabled=!1;for(const i of t)i!=null&&this._add(i.nodeId,i.pointId)}_add(t,i){const s=this.ids.get(t);s?s.add(i):this.ids.set(t,new Set([i]))}}class ce extends dt{constructor(){super(...arguments),this.clipBox=Q(de),this.useFixedSizes=!1,this.useRealWorldSymbolSizes=!1,this.scaleFactor=1,this.minSizePx=0,this.size=0,this.sizePx=0}get fixedSize(){return this.drawScreenSpace?this.sizePx:this.size}get screenMinSize(){return this.useFixedSizes?0:this.minSizePx}get drawScreenSpace(){return this.useFixedSizes&&!this.useRealWorldSymbolSizes}}class pe extends ht{constructor(t,i,s){super(t),this.origin=t,this.isLeaf=i,this.splatSize=s}}function Je(e){const t=new ut,i=e.output===w.Color,s=e.output===w.Depth,r=e.output===w.Highlight,{vertex:n,fragment:a}=t;return t.include(ct,e),t.attributes.add(B.POSITION,"vec3"),t.attributes.add(B.COLOR,"vec3"),n.uniforms.add(new pt("modelView",(o,l)=>_t(ke,l.camera.viewMatrix,gt(ke,o.origin))),new ft("proj",(o,l)=>l.camera.projectionMatrix),new fe("screenMinMaxSize",(o,l,d)=>ee(ne,d.useFixedSizes?0:d.minSizePx*l.camera.pixelRatio,G(o.isLeaf)*l.camera.pixelRatio)),e.useFixedSizes?new mt("pointScale",(o,l)=>ee(ne,o.fixedSize*l.camera.pixelRatio,l.camera.fullHeight)):new fe("pointScale",(o,l,d)=>ee(ne,o.splatSize*d.scaleFactor*l.camera.pixelRatio,l.camera.fullHeight/l.camera.pixelRatio))),e.clippingEnabled?n.uniforms.add(new me("clipMin",(o,l,d)=>be(Ve,d.clipBox[0]-o.origin[0],d.clipBox[1]-o.origin[1],d.clipBox[2]-o.origin[2])),new me("clipMax",(o,l,d)=>be(Ve,d.clipBox[3]-o.origin[0],d.clipBox[4]-o.origin[1],d.clipBox[5]-o.origin[2]))):(n.constants.add("clipMin","vec3",[-L,-L,-L]),n.constants.add("clipMax","vec3",[L,L,L])),s?(bt(t),yt(t),t.varyings.add("depth","float")):e.output!==w.Highlight&&t.varyings.add("vColor","vec3"),n.code.add(C` +import{lA as tt,c9 as A,yP as it,ea as W,yQ as We,yR as Te,yS as st,yT as rt,tU as nt,e as p,y as b,c as ue,K as ot,a0 as He,yU as at,aK as lt,yr as dt,yV as de,yW as ht,xS as ut,xT as w,xV as ct,bi as B,yX as pt,oj as _t,bP as gt,yY as ft,yZ as fe,hJ as ee,y_ as mt,y$ as me,bz as be,xG as L,z0 as bt,z1 as yt,xR as R,z2 as St,z3 as Pt,bT as xt,a8 as V,a7 as vt,y3 as wt,de as zt,y5 as Nt,y6 as Rt,yp as Ue,y7 as $t,m5 as Ct,yb as At,yd as It,yG as Ot,yI as Mt,y2 as E,y4 as Et,sx as ye,qR as Se,z4 as Ft,ce as Lt,m3 as Be,aO as Vt,c5 as Ge,b4 as Pe,c2 as kt,ca as Dt,be as qt,tg as Qt,z5 as xe,z6 as je,z7 as Wt,sQ as Tt,z8 as Ht,cG as Ut,cc as H,b5 as Bt,me as Gt,v4 as te,rq as jt,lg as Jt,s5 as ve,z9 as Yt,v5 as we,v6 as ze,za as Kt,t$ as Xt,fC as Ne,zb as Zt,dw as ei,m0 as ti,bU as ii,zc as si,zd as ri,tZ as Re,P,B as ni,a9 as oi,bn as ai,b as $e,I as li,j_ as di,qi as hi,sh as ui,jY as ci,ze as pi,zf as _i,dY as Ce,V as gi,sT as fi,zg as mi,u3 as bi,ac as yi,R as ie,gE as Si,ab as Ae,b3 as Pi,zh as xi,lL as Ie,gj as vi,fd as wi,cf as zi,gL as Ni,jU as Ri,oI as $i}from"./index-pCX-0tJH.js";import{n as Ci}from"./LayerView3D-57OghbRh.js";import{c as Ai,u as Ii,a as Oi}from"./PointCloudWorkerUtil-uutRAft1.js";import{i as Mi}from"./PopupSceneLayerView-1BvuVn-Q.js";import{u as Ei}from"./LayerView-ixwLVnzr.js";import"./PointCloudUniqueValueRenderer-mGlOSV4H.js";let Fi=class extends tt{constructor(t){super("PointCloudWorker","transform",{transform:i=>this._getTransferList(i)},t)}_getTransferList(t){const i=[t.geometryBuffer];if(t.primaryAttributeData!=null&&t.primaryAttributeData.buffer&&i.push(t.primaryAttributeData.buffer),t.modulationAttributeData!=null&&t.modulationAttributeData.buffer&&i.push(t.modulationAttributeData.buffer),t.filterAttributesData!=null)for(const s of t.filterAttributesData)s!=null&&s.buffer&&i.push(s.buffer);for(const s of t.userAttributesData)s.buffer&&i.push(s.buffer);return i}};function Li(e,t,i){for(let r=0;r=0&&(re[r]=!0,$[n]!=null?$[n].push(t[r]):$[n]=[t[r]])}for(let r=0;r=0&&(se[r]=!0,C[n]!=null?C[n].push(e[r]):C[n]=[e[r]])}const s=[];for(let r=0;r1||C[r][0]!==t[r])&&s.push({load:[t[r]],remove:C[r]});for(let r=0;r1||$[r][0]!==e[r])&&s.push({load:$[r],remove:[e[r]]});return s}const se=[!1],$=[null],re=[!1],C=[null];function Oe(e,t,i){let s=e;for(;s>0;){const r=t.indexOf(s);if(r>=0)return r;s=i.getParentId(s)}return t.indexOf(s)}function Vi(e,t,i){return e.sort((s,r)=>{if(s.load.length===0&&r.load.length===0)return 0;if(s.load.length===0)return-1;if(r.load.length===0)return 1;if(s.remove.length===0&&r.remove.length===0){const n=i.getRenderCenter(s.load[0]),a=i.getRenderCenter(r.load[0]);return A(n,t)-A(a,t)}if(s.remove.length===0)return-1;if(r.remove.length===0)return 1;if(s.load.length===1&&r.load.length===1){const n=i.getRenderCenter(s.load[0]),a=i.getRenderCenter(r.load[0]);return A(n,t)-A(a,t)}if(s.load.length===1)return-1;if(r.load.length===1)return 1;{const n=i.getRenderCenter(s.remove[0]),a=i.getRenderCenter(r.remove[0]);return A(n,t)-A(a,t)}})}function ki(e,t,i){for(let s=0;st&&r.remove.length===1&&Di(e,r,i)}}function Di(e,t,i){const s=[t.remove[0]],r=[];for(;s.length===1;){const n=s.pop();r.length=0;for(let a=0;a1?e.push({remove:[s[n]],load:r[n]}):s[n]=r[n][0]}class qi{constructor(t,i,s){this._pages=[],this.pageSize=0,this._nodeSR=null,this._renderSR=null,this._nodeSR=t,this._renderSR=i,this.pageSize=s}addPage(t,i,s=0){for(;this._pages.lengthQi(t,i,s)}}function Qi(e,t,i){const s=e.index;if(!s.hasNodes(0,1))return;const r=e.queue;r.length=0,r.push(0);const n=e.masks;for(n.length=0,n.push(0);r.length>0;){const a=r.pop();let o=n.pop();const l=s.getNode(a),d=s.getRenderObb(a);let g=!0;if(t.clippingBox!=null){const _=1<0?g=!1:u<0&&(o|=c)}}if(i.predicate(a,l,g)){const _=l.firstChild,c=l.childCount;let u=!1;const y=v(_,s.pageSize),z=v(_+c-1,s.pageSize);for(let f=y;f<=z;f++)if(!s.hasPage(f)){i.pageMiss(a,f),u=!0;break}if(!u)for(let f=0;f({filterJSON:i.toJSON(),attributeInfo:T(e.attributeStorageInfo,i.field)})):[]}function Hi(e){const t=e==null?void 0:e.pointSizeAlgorithm;return t&&t.type==="splat"?t:null}function Fe(e){const t=e==null?void 0:e.pointSizeAlgorithm;return t&&t.type==="fixed-size"?t:null}function Ui(e){const t=e==null?void 0:e.pointSizeAlgorithm;return!!(t!=null&&t.type)&&t.type==="fixed-size"}function Le(e,t){for(const i of e??[])if(i.name===t&&i.attributeValues!=null&&i.attributeValues.valueType==="UInt8"&&i.attributeValues.valuesPerElement===3)return{name:t,storageInfo:i,useElevation:!1};return null}function T(e,t){for(const i of e??[])if(i.name===t){const s=i.encoding==="embedded-elevation";return s?{name:t,storageInfo:null,useElevation:s}:{name:t,storageInfo:i,useElevation:s}}return(t==null?void 0:t.toLowerCase())==="elevation"?{name:t,storageInfo:null,useElevation:!0}:null}let Q=class extends ot{constructor(e){super(e),this.pointCloudMetadata=null}};p([b({constructOnly:!0,clonable:"reference"})],Q.prototype,"pointCloudMetadata",void 0),Q=p([ue("esri.views.3d.layers.i3s.PointGraphic")],Q);class Bi{constructor(t){this._context=t,this._highlights=new Set}get empty(){return this._highlights.size===0}destroy(){this._highlights=null}add(t){const i=new Gi(t);return this._highlights.add(i),this._enableSet(i),He(()=>this._removeSet(i))}_removeSet(t){this._disableSet(t),this._highlights.delete(t)}_enableSet(t){t.enabled||(t.enabled=!0,this._context.forEachNode(i=>this._enableSetForNode(t,i)))}_enableSetForNode(t,i){if(!t.enabled)return;const s=t.ids.get(i.id);s&&s.forEach(r=>this._context.addHighlight(i,r,t.id))}_disableSet(t){t.enabled&&(t.enabled=!1,this._context.forEachNode(i=>this._disableSetForNode(t,i)))}_disableSetForNode(t,i){t.enabled||this._context.removeHighlight(i,t.id)}nodeAdded(t){this._highlights.forEach(i=>this._enableSetForNode(i,t))}nodeRemoved(t){this._highlights.forEach(i=>this._disableSetForNode(i,t))}removeAll(){this._highlights.forEach(t=>this._disableSet(t))}}class Gi{constructor(t){this.id=new at(lt.Highlight),this.ids=new Map,this.enabled=!1;for(const i of t)i!=null&&this._add(i.nodeId,i.pointId)}_add(t,i){const s=this.ids.get(t);s?s.add(i):this.ids.set(t,new Set([i]))}}class ce extends dt{constructor(){super(...arguments),this.clipBox=W(de),this.useFixedSizes=!1,this.useRealWorldSymbolSizes=!1,this.scaleFactor=1,this.minSizePx=0,this.size=0,this.sizePx=0}get fixedSize(){return this.drawScreenSpace?this.sizePx:this.size}get screenMinSize(){return this.useFixedSizes?0:this.minSizePx}get drawScreenSpace(){return this.useFixedSizes&&!this.useRealWorldSymbolSizes}}class pe extends ht{constructor(t,i,s){super(t),this.origin=t,this.isLeaf=i,this.splatSize=s}}function Je(e){const t=new ut,i=e.output===w.Color,s=e.output===w.Depth,r=e.output===w.Highlight,{vertex:n,fragment:a}=t;return t.include(ct,e),t.attributes.add(B.POSITION,"vec3"),t.attributes.add(B.COLOR,"vec3"),n.uniforms.add(new pt("modelView",(o,l)=>_t(Ve,l.camera.viewMatrix,gt(Ve,o.origin))),new ft("proj",(o,l)=>l.camera.projectionMatrix),new fe("screenMinMaxSize",(o,l,d)=>ee(ne,d.useFixedSizes?0:d.minSizePx*l.camera.pixelRatio,G(o.isLeaf)*l.camera.pixelRatio)),e.useFixedSizes?new mt("pointScale",(o,l)=>ee(ne,o.fixedSize*l.camera.pixelRatio,l.camera.fullHeight)):new fe("pointScale",(o,l,d)=>ee(ne,o.splatSize*d.scaleFactor*l.camera.pixelRatio,l.camera.fullHeight/l.camera.pixelRatio))),e.clippingEnabled?n.uniforms.add(new me("clipMin",(o,l,d)=>be(ke,d.clipBox[0]-o.origin[0],d.clipBox[1]-o.origin[1],d.clipBox[2]-o.origin[2])),new me("clipMax",(o,l,d)=>be(ke,d.clipBox[3]-o.origin[0],d.clipBox[4]-o.origin[1],d.clipBox[5]-o.origin[2]))):(n.constants.add("clipMin","vec3",[-L,-L,-L]),n.constants.add("clipMax","vec3",[L,L,L])),s?(bt(t),yt(t),t.varyings.add("depth","float")):e.output!==w.Highlight&&t.varyings.add("vColor","vec3"),n.code.add(R` void main(void) { // Move clipped points outside of clipspace if (position.x < clipMin.x || position.y < clipMin.y || position.z < clipMin.z || @@ -19,8 +19,8 @@ import{ls as tt,ax as A,yw as it,eh as Q,yx as Qe,yy as We,yz as st,yA as rt,tH float pointSize = pointScale.x; vec4 position = proj * camera; - ${e.drawScreenSize?C` - float clampedScreenSize = pointSize;`:C` + ${e.drawScreenSize?R` + float clampedScreenSize = pointSize;`:R` float pointRadius = 0.5 * pointSize; vec4 cameraOffset = camera + vec4(0.0, pointRadius, 0.0, 0.0); vec4 positionOffset = proj * cameraOffset; @@ -38,10 +38,10 @@ import{ls as tt,ax as A,yw as it,eh as Q,yx as Qe,yy as We,yz as st,yA as rt,tH gl_PointSize = clampedScreenSize; gl_Position = position; - ${s?C`depth = calculateLinearDepth(nearFar, camera.z);`:""} - ${i?C`vColor = color;`:""} + ${s?R`depth = calculateLinearDepth(nearFar, camera.z);`:""} + ${i?R`vColor = color;`:""} } - `),a.include(St,e),r&&t.include(xt,e),a.code.add(C` + `),a.include(St,e),r&&t.include(Pt,e),a.code.add(R` void main(void) { vec2 vOffset = gl_PointCoord - vec2(0.5, 0.5); float r2 = dot(vOffset, vOffset); @@ -49,11 +49,11 @@ import{ls as tt,ax as A,yw as it,eh as Q,yx as Qe,yy as We,yz as st,yA as rt,tH if (r2 > 0.25) { discard; } - ${s?C`fragColor = float2rgba(depth);`:""} - ${r?C`outputHighlight();`:""} - ${i?C`fragColor = vec4(vColor, 1.0);`:""} + ${s?R`fragColor = float2rgba(depth);`:""} + ${r?R`outputHighlight();`:""} + ${i?R`fragColor = vec4(vColor, 1.0);`:""} } - `),t}function G(e){return e?256:64}const ke=Pt(),Ve=k(),ne=vt(),ji=Object.freeze(Object.defineProperty({__proto__:null,PointRendererDrawParameters:pe,PointRendererPassParameters:ce,build:Je,getMaxPointSizeScreenspace:G},Symbol.toStringTag,{value:"Module"}));class j extends zt{constructor(t,i,s){super(t,i,s)}initializeProgram(t){return new Ct(t.rctx,j.shader.get().build(this.configuration),Ue)}initializePipeline(){return Rt({depthTest:{func:$t.LESS},depthWrite:At,colorWrite:It,stencilWrite:this.configuration.hasOccludees?Ot:null,stencilTest:this.configuration.hasOccludees?Mt:null})}}j.shader=new wt(ji,()=>Nt(()=>Promise.resolve().then(()=>ns),void 0));class O extends Et{constructor(){super(...arguments),this.output=w.Color,this.hasSlicePlane=!1,this.drawScreenSize=!1,this.useFixedSizes=!1,this.hasOccludees=!1,this.clippingEnabled=!1}}p([E({count:w.COUNT})],O.prototype,"output",void 0),p([E()],O.prototype,"hasSlicePlane",void 0),p([E()],O.prototype,"drawScreenSize",void 0),p([E()],O.prototype,"useFixedSizes",void 0),p([E()],O.prototype,"hasOccludees",void 0),p([E()],O.prototype,"clippingEnabled",void 0),p([E({constValue:!0})],O.prototype,"hasSliceInVertexProgram",void 0);const Ji={positions:[new ye(B.POSITION,3,Se.FLOAT,0,12)],colors:[new ye(B.COLOR,3,Se.UNSIGNED_BYTE,0,3,!0)]};let U=class extends Ft{constructor(e){super(e),this.type=Lt.PCL,this.isGround=!1,this._passParameters=new ce,this._highlights=new Bi({forEachNode:t=>this.forEachNode(t),addHighlight:(t,i,s)=>this._addHighlight(t,i,s),removeHighlight:(t,i)=>this._removeHighlight(t,i)}),this.produces=new Map([[Be.OPAQUE_MATERIAL,t=>t!==w.Highlight||!this._highlights.empty]]),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new O,this._nodes=new kt}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,i,s){const r=k(),n=k(),a=k(),o=k(),l=Ge(),d=e.camera.perScreenPixelRatio/2,g=e.camera.near;xe(n,s,i);const _=1/Vt(n);Dt(n,n,_),qt(a,n),Ht(l,n[0],n[1],n[2],-A(n,i));const c=new ae,u=new ae,y=new Array,N=Q(),f=Q(this._passParameters.clipBox);Pe(f,-i[0],-i[1],-i[2],f),this._nodes.forAll(h=>{const S=h.splatSize*this._passParameters.scaleFactor;let P=je(h.obb,l),I=Qt(h.obb,l);P-=oe(S,P+g,this._passParameters,d,h.isLeaf),I-=oe(S,I+g,this._passParameters,d,h.isLeaf);const Ye=I<0,Ke=c.dist!=null&&u.dist!=null&&c.distI*_;if(Ye||Ke)return;const Y=he(S,I+g,this._passParameters,d,h.isLeaf);if(!Wt(h.obb,i,n,Y))return;const Xe=Y*Y;Qe(h.obb,N),Pe(N,-i[0],-i[1],-i[2],N);const Ze=!We(f,N);xe(o,h.origin,i);const et=h.coordinates.length/3;for(let M=0;MXe)continue;let K=q+g;const X=oe(S,K,this._passParameters,d,h.isLeaf);if(q-X<0)continue;K-=X;const ge=he(S,K,this._passParameters,d,h.isLeaf);if(_e>ge*ge)continue;const F=(q-X)*_,Z=z=>(z.point=Xi(h,M,z.point),z.dist=F,z.normal=a,z.node=h,z.pointId=M,z.layerUid=this.layerUid,z);if((c.dist==null||Fu.dist)&&(t==null||t(i,s,F))&&Z(u),e.options.store===T.ALL&&(t==null||t(i,s,F))){const z=new ae;y.push(Z(z))}}});const J=h=>{const{layerUid:S,node:P,pointId:I}=h;return new Kt(h.point,S,I,()=>this.createGraphic(P,I,h.point))},D=(h,S)=>{const P=J(S);h.set(this.type,P,S.dist,S.normal)};if(qe(c)){const h=e.results.min;(h.dist==null||c.disth.dist)&&D(h,u)}if(e.options.store===T.ALL){const h=Bt(i,s);for(const S of y){const P=Gt(h);D(P,S),e.results.all.push(P)}}}prepareTechnique(e){return this._nodes.length===0||e.output!==w.Color&&e.output!==w.Depth&&e.output!==w.Highlight?null:(this._nodes.forAll(t=>{t.vao==null&&this._initNode(e,t)}),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output,this._context.techniqueRepository.releaseAndAcquire(j,this._techniqueConfig,this._technique))}renderNode(e,t){const i=e.rctx,s=i.bindTechnique(t,this._passParameters,e.bindParameters),r=e.output===w.Highlight;this._nodes.forAll(n=>{n.coordinates.length===0||r&&!n.highlights||(s.bindDraw(n,e.bindParameters,this._passParameters),i.bindVAO(n.vao),r?this._renderHighlightFragments(i,n):i.drawArrays(te.POINTS,0,n.coordinates.length/3))})}_renderHighlightFragments(e,t){const i=t.highlights;if(i==null)return;let s=i[0].component,r=s+1;for(let a=1;a0&&e.drawArrays(te.POINTS,s,l),s=o}r=o+1}const n=r-s;n>0&&e.drawArrays(te.POINTS,s,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){jt(this._passParameters.clipBox,e||de)}get _clippingEnabled(){return!Jt(this._passParameters.clipBox,de,(e,t)=>e===t)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let t=null;return this._nodes.filterInPlace(i=>i.id!==e||(t=i,i.vao=ve(i.vao),this._highlights.nodeRemoved(i),!1)),this._requestRender(),t}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll(e=>e.vao=ve(e.vao)),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,t,i){e.highlights=Zi(e.highlights,t,i),this._requestRender()}_removeHighlight(e,t){e.highlights=es(e.highlights,t),this._requestRender()}_initNode(e,t){const i=e.rctx;t.vao=new Yt(i,Ue,Ji,{positions:we.createVertex(i,Ne.STATIC_DRAW,t.coordinates),colors:we.createVertex(i,Ne.STATIC_DRAW,t.rgb)})}_requestRender(){this._context&&this._context.requestRender()}};p([b({constructOnly:!0})],U.prototype,"createGraphic",void 0),U=p([ue("esri.views.3d.layers.i3s.PointRenderer")],U);class Yi extends pe{constructor(t,i,s,r,n,a,o,l,d=null,g=null){super(s,n,i),this.id=t,this.obb=r,this.coordinates=a,this.rgb=o,this.attributes=l,this.pointIdFilterMap=d,this.highlights=g}}function Ki(e){return e.hasOwnProperty("splatSize")}function he(e,t,i,s,r){if(i.drawScreenSpace)return i.fixedSize*t*s;const n=G(r)*t*s;return i.useFixedSizes?Math.min(i.fixedSize/2,n):i.screenMinSize>0?Math.min(Math.max(i.screenMinSize*t*s,e/2),n):Math.min(e/2,n)}function oe(e,t,i,s,r){return i.drawScreenSpace?0:he(e,t,i,s,r)}function Xi(e,t,i){return i==null&&(i=k()),i[0]=e.origin[0]+e.coordinates[3*t],i[1]=e.origin[1]+e.coordinates[3*t+1],i[2]=e.origin[2]+e.coordinates[3*t+2],i}function De(e){return e.component!=null?e.component:-1}function Zi(e,t,i){e==null&&(e=[]);const s={component:t,id:i};e.push(s);const r=De(s);let n=e.length-1;for(;n>0&&rs.id!==t);return i.length===0?null:i}class ae{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function qe(e){return e.dist!=null&&e.point!=null&&e.pointId!=null&&e.node!=null}const ts=8,is=Ge();let m=class extends Mi($i(Ei)){constructor(){super(...arguments),this.type="point-cloud-3d",this.slots=[Be.OPAQUE_MATERIAL],this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._nodeScales=new Map,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new Xt,this._indexPagesLoading=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl.path}get pointScale(){var i;const e=Ti((i=this.layer)==null?void 0:i.renderer),t=1;return(e==null?void 0:e.scaleFactor)!=null?e.scaleFactor:t}get useRealWorldSymbolSizes(){var i;const e=Fe((i=this.layer)==null?void 0:i.renderer),t=!1;return(e==null?void 0:e.useRealWorldSymbolSizes)!=null?e.useRealWorldSymbolSizes:t}get pointSize(){var i;const e=Fe((i=this.layer)==null?void 0:i.renderer),t=0;return(e==null?void 0:e.size)!=null?e.size:t}get inverseDensity(){var t;return(t=this.layer)!=null&&t.renderer?1*96/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=Me(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=Ee(this.layer);if(i)for(const s of i)s.attributeInfo&&t.add(s.attributeInfo.name);if(this.layer.outFields)for(const s of ze(this.layer.fieldsIndex,this.layer.outFields))t.add(s);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=Q(),t=this.view.renderSpatialReference;return Zt(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;if(e&&e.mode==="absolute-height"){const t=ei(this.layer.spatialReference),i=ti(e.unit);return(e.offset??0)*i/t}return 0}initialize(){const e=this.view.resourceController,t=rs(e);this._worker=new Fi(t),this.addResolvingPromise(this._worker.promise),this._tmpPoint=ii(0,0,0,this.layer.spatialReference),si(this.layer),ri(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(Ce.I3S_INDEX),this._dataRequester=e.createStreamDataRequester(Ce.I3S_DATA),this._initRenderer();const i=this._initNodePages(),s=this.view.resourceController.memoryController;this._memCache=s.newCache(`pcl-${this.layer.uid}`),this._updatingHandles.add(()=>this._clippingBox,()=>this._setUpdateViewNeeded(),x),this._updatingHandles.add(()=>this._elevationOffset,()=>this._elevationOffsetChanged(),x),this._updatingHandles.add(()=>this.layer.renderer,()=>this._rendererChanged(),x),this._updatingHandles.add(()=>this.layer.filters,()=>this._reload(),x),this._updatingHandles.add(()=>this.layer.outFields,()=>this._reload(),x),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this._setUpdateViewNeeded()),this._updatingHandles.add(()=>this.view.state.contentCamera,()=>this._setUpdateViewNeeded()),this.addHandles([this.view.basemapTerrain.on("scale-change",r=>this._scaleUpdateHandler(r)),ni(()=>this.view.quality,()=>this._setUpdateViewNeeded(),oi)]),this.addResolvingPromise(i),this.when(()=>{this.addHandles([e.scheduler.registerTask(ai.POINT_CLOUD_LAYER,this),e.scheduler.registerIdleStateCallbacks(()=>this._idleBegin(),()=>this._idleEnd()),this._updatingHandles.add(()=>this.suspended,r=>{r?this._clearNodeState():this._setUpdateViewNeeded()},x)])},()=>{this._updatingHandles.removeAll(),this.removeAllHandles()})}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=Re(this._worker),this._destroyRenderer(),this._memCache=Re(this._memCache),this._codedDomainPopulationAbortController=li(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new U({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerUid=this.layer.uid,this._updatingHandles.add(()=>this._clippingBox,e=>this._renderer.clippingBox=e,x),this._updatingHandles.add(()=>this.suspended,e=>this._setPointsVisible(!e),x),this._updatingHandles.add(()=>this.pointScale,e=>this._renderer.scaleFactor=e,x),this._renderer.minSizePx=Math.sqrt(2),this._updatingHandles.add(()=>this.useRealWorldSymbolSizes,e=>this._renderer.useRealWorldSymbolSizes=e,x),this._updatingHandles.add(()=>this.pointSize,e=>{const t=zi(e);this._renderer.size=e,this._renderer.sizePx=t},x),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._renderer.slicePlaneEnabled=e,x),this._updatingHandles.add(()=>this.inverseDensity,()=>this._setUpdateViewNeeded(),x),this._updatingHandles.add(()=>this.maximumPointCount,()=>this._setUpdateViewNeeded(),x),this._updatingHandles.add(()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor,e=>{this._lodFactor=e,this._setUpdateViewNeeded()},x)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i){const s=e.pointIdFilterMap!=null?e.pointIdFilterMap[t]:t,r=this.view.computeMapPointFromVec3d(i),n=this._createGraphicAttributes(e,s);return new H({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:s,epoch:this._nodeLoadEpoch},geometry:r,attributes:n,layer:this.layer,sourceLayer:this.layer})}_createGraphicAttributes(e,t){const i={};for(const s of e.attributes)this._encodeGraphicAttribute(s.attributeInfo,s.values,t,i);return i}_encodeGraphicAttribute(e,t,i,s){var a;const r=(a=e.storageInfo)==null?void 0:a.attributeValues,n=(r==null?void 0:r.valuesPerElement)??1;if(n===1)s[e.name]=t[i];else if((r==null?void 0:r.valueType)==="UInt8"&&n<=4){let o=0;const l=i*n;for(let d=l;d{if(!this._renderedNodes.has(s))return void this._nodeScales.delete(s);const r=this._index.getNode(s);ui(He,r.obb.center)&&this._nodeScales.set(s,e.scale)}),this._setUpdateViewNeeded()):this._nodeScales.clear()}_displayNodes(e){this._workQueue=Li([...this._renderedNodes],e,this._index),ki(this._workQueue,this.view.state.contentCamera.viewForward,this._index),Vi(this._workQueue,ts,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){const e=new Array;this._loadingNodes.forEach(({abortController:t})=>e.push(t)),this._loadingNodes.clear();for(const t of e)t.abort();this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach(s=>s.load.forEach(r=>e.add(r)));const t=new Array,i=new Map;this._loadingNodes.forEach((s,r)=>{e.has(r)?i.set(r,s):t.push(s)}),this._loadingNodes=i;for(const{abortController:s}of t)s.abort();this._workQueue=this._workQueue.filter(s=>{for(const r of s.load)if(this._loadingNodes.has(r))return this._recalcWork=!0,!1;return!0}),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._indexPagesLoading.forEach(({abortController:e})=>e.abort()),this._indexPagesLoading.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach(e=>this._removeFromRenderer(e)),this._cancelNodeLoading()}_idleBegin(){this._setUpdateViewNeeded()}_idleEnd(){this._setUpdateViewNeeded()}get running(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.running}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const t=this._isRootNodeVisible();t!==this._layerIsVisible&&(this._layerIsVisible=t,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run(()=>this._updateWorkQueues());this._indexQueue.length>0&&e.run(()=>this._processIndexQueue()););this._processWorkQueue(e),this._idleQueue.runTask(e)}}_processIndexQueue(){const e=this._indexQueue.shift(),t=this._loadNodePage(e);return this._indexPagesLoading.set(e,t),t.promise.then(i=>{this._index.addPage(e,i,this._elevationOffset),this._setUpdateViewNeeded()}).then(()=>{this._indexPagesLoading.delete(e)},()=>{this._indexPagesLoading.delete(e)}),!0}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(t==null)return void e.madeProgress();this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const t=this._workQueue.shift();if(!t.remove.find(i=>!this._renderedNodes.has(i)))return t;this._workQueue.push(t)}return null}_processWorkEntry(e){if(e.load.length!==0)Promise.all(e.load.map(t=>{const i=new AbortController,s=this._memCache.pop(t.toString());return s!=null?this._loadingNodes.set(t,{abortController:i,promise:Promise.resolve(s)}):this._loadingNodes.has(t)||this._loadingNodes.set(t,{abortController:i,promise:this._loadNode(t,i.signal)}),this._loadingNodes.get(t).promise})).then(t=>{for(let i=0;i{}).then(()=>{for(const t of e.load)this._loadingNodes.delete(t);this._updateLoading(),this._recalcWork&&!this._idleQueue.running&&this._indexQueue.length===0&&this._loadingNodes.size===0&&(this._recalcWork=!1,this._setUpdateViewNeeded())}),this._updateLoading();else for(const t of e.remove)this._removeFromRenderer(t)}async _populateClassCodeCodedDomain(e,t){var a,o,l;const i="CLASS_CODE",s=this.layer.fieldsIndex.get(i);if(!s||s.domain||!e.includes(s.name))return;const r=await ci(this.layer.queryCachedStatistics(i,{signal:t}));if(r.ok===!1)return;const n=(l=(o=(a=r.value)==null?void 0:a.stats)==null?void 0:o.labels)==null?void 0:l.labels;n&&Array.isArray(n)&&(s.domain=new pi({name:"CLASS_CODE",codedValues:n.map(d=>new _i({code:d.value,name:d.label}))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then(()=>{this._codedDomainPopulationAbortController=null})),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const i=this._splitGraphicsPerNode(e),s=this.layer.attributeStorageInfo,r=t.map(o=>W(s,o)).filter($e),n=async(o,l)=>{const d=this._index.getNode(l);await Ci(r,async g=>{const _=g.useElevation?await this._loadElevationAttributeFromGeometry(d.resourceId):await this._loadAndParseAttribute(d,g);if(_){for(const c of o)if(this._isValidPointGraphic(c)){const u=c.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(g,_,u,c.attributes)}}})},a=[];return i.forEach((o,l)=>{a.push(n(o,l))}),await Promise.allSettled(a),e}_isValidPointGraphic(e){var t;return e instanceof H&&((t=e.pointCloudMetadata)==null?void 0:t.epoch)===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const s=i.pointCloudMetadata,r=t.get(s.nodeId);r?r.push(i):t.set(s.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return i!=null?Ai({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=Ii(t,await this._loadGeometry(e,null));return Oi(i,i.length/3)}highlight(e){if(!e)return Te();const t=gi.isCollection(e)?e.toArray():Array.isArray(e)?e:[e];return this._renderer.highlight(t.map(i=>this._graphicToPointDefinition(i)))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return t!=null&&i!=null?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._indexPagesLoading.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new qi(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=e.nodesPerPage!=null?1:e.nodePerIndexBlock,this._loadNodePage(0).promise.then(i=>{this._index.addPage(0,i,this._elevationOffset),this._loadingInitNodePage=!1,this._setUpdateViewNeeded()})}_loadNodePage(e){const t=new AbortController,i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return{promise:this._requestNodePage(i,t.signal).then(s=>s.nodes.map((r,n)=>({resourceId:r.resourceId!=null?r.resourceId:e*this._index.pageSize+n,obb:r.obb,obbInRenderSR:fi(),firstChild:r.firstChild,childCount:r.childCount,vertexCount:r.vertexCount??r.pointCount,lodThreshold:r.lodThreshold??r.effectiveArea}))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;const e=this.view.quality;let t=this.inverseDensity/this._lodFactor*e;const i=this.maximumPointCount*this._lodFactor*e;let s=this._computeNodesForMinimumDensity(t),r=this._computePointCount(s),n=Math.sqrt(r/(.75*i));for(;r>i;)t*=n,s=this._computeNodesForMinimumDensity(t),r=this._computePointCount(s),n=Math.sqrt(2);return this._displayNodes(s),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i(e=s,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,s=this._clippingBox,r=t.viewForward,n=A(r,t.eye),a=mi(r,-n,is),o=t.perScreenPixelRatio/2,l=e*e,d=this._nodeIdArray;d.length=0;const{minScale:g,maxScale:_}=bi(this.layer),c=g===0&&_===0?u=>d.push(u):u=>{const y=this._getScale(u);Ri(y,g,_)&&d.push(u)};return this._traverseVisible({frustum:i,clippingBox:s},{predicate:(u,y,N)=>{if(!N)return!1;if(y.childCount===0)return c(u),!1;const f=this._index.getRenderObb(u);return!(this._computeAveragePixelArea(f,y.lodThreshold,y.vertexCount,a,o)<=l)||(c(u),!1)},pageMiss:(u,y)=>{c(u),this._indexQueue.includes(y)||this._indexQueue.push(y)}}),d}_getScale(e){let t=this._nodeScales.get(e);if(t==null){const i=this._index.getNode(e).obb.center;this._tmpPoint.x=i[0],this._tmpPoint.y=i[1],this._tmpPoint.z=i[2],t=this.view.basemapTerrain.getScale(this._tmpPoint),this._nodeScales.set(e,t)}return t}_computeAveragePixelArea(e,t,i,s,r){const a=Math.max(1e-7,je(e,s));return t/(a*a)/(4*r*r)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw yi(i)||ie.getLogger(this).error(i),i}}async _loadAdditionalUserAttributes(e,t,i){const s=this.layer.outFields;if(!s)return[];const r=ze(this.layer.fieldsIndex,s),n=new Set(e.map(d=>d!=null?d.name:null)),a=this.layer.attributeStorageInfo,o=[];for(const d of r){if(n.has(d))continue;const g=W(a,d);g&&o.push(t(g))}const l=await Si(o);return Ae(i),l.filter($e)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),s=Me(this.layer),r=Ee(this.layer),n=i.resourceId,a=async o=>{if(!o)return null;if(o.useElevation)return{attributeInfo:o,buffer:null};const l=await this._loadAttribute(n,o,t);return l!=null?{attributeInfo:o,buffer:l}:null};return this._idleQueue.push(async()=>{const o=this._loadGeometry(n,t),{primaryAttribute:l,modulationAttribute:d}=s,g=a(l),_=a(d),c=r.map(P=>P.attributeInfo),u=c.map(P=>a(P)),y=this._loadAdditionalUserAttributes([l,d,...c],a,t),[N,f,J,D,h]=await Promise.all([o,g,_,Promise.all(u),y]);Ae(t);const S={geometryBuffer:N,primaryAttributeData:f,modulationAttributeData:J,filterAttributesData:D,userAttributesData:h,schema:this.layer.store.defaultGeometrySchema,rendererInfo:s,filterInfo:r,obb:this._index.getRenderObb(e),elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(S,t)},t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(!(t!=null&&t.storageInfo))return null;const s=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${s}`,i)}_requestNodePage(e,t){const i={f:"json",token:this.layer.apiKey};return this._indexRequester.request(e,"json",{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,"binary",{query:{token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._nodeScales.delete(e),this._memCache.put(t.id.toString(),t,ss(t))}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),s=Math.sqrt(i.lodThreshold/i.vertexCount),r=this._index.getRenderObb(e);if(Ki(t))return t.splatSize=s,t.obb=r,xi(t.origin,t.obb.center),t;const n=.01*Math.max(r.halfSize[0],r.halfSize[1],r.halfSize[2]);if(t.obb.halfSize[0]>r.halfSize[0]+n||t.obb.halfSize[1]>r.halfSize[1]+n||t.obb.halfSize[2]>r.halfSize[2]+n){if(this._maxLoggedBoxWarnings>0){const a=o=>`[${o.halfSize[0]}, ${o.halfSize[1]}, ${o.halfSize[2]}]`;ie.getLogger(this).warn(`Node ${e} reported bounding box too small. got ${a(r)} but points cover ${a(t.obb)}`),--this._maxLoggedBoxWarnings==0&&ie.getLogger(this).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,t.obb)}return new Yi(e,s,Pi(r.center),r,i.childCount===0,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode(t=>{e+=le,e+=Ie(t.coordinates);for(const i of t.attributes){const s=i.values;vi(s.buffer)&&(e+=Ie(s))}}),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce((s,r)=>s+this._index.getNode(r).vertexCount);let i=this._loadingNodes.size;for(let s=0;se+this._index.getNode(t).vertexCount,0),maximumNumberOfFeatures:this.maximumPointCount,totalNumberOfFeatures:-1,core:null,"Loading Nodes":this._loadingNodes.size,"Index Queue":this._indexQueue.length,"Work Queue":this._workQueue.length,"Idle Queue":this._idleQueue.length}}get test(){return{index:this._index,visibleNodes:this._renderedNodes}}};p([b()],m.prototype,"layer",void 0),p([b()],m.prototype,"baseUrl",null),p([b()],m.prototype,"pointScale",null),p([b()],m.prototype,"useRealWorldSymbolSizes",null),p([b()],m.prototype,"pointSize",null),p([b()],m.prototype,"inverseDensity",null),p([b()],m.prototype,"maximumPointCount",void 0),p([b({readOnly:!0})],m.prototype,"availableFields",null),p([b({readOnly:!0})],m.prototype,"_clippingBox",null),p([b({readOnly:!0})],m.prototype,"_elevationOffset",null),p([b({type:Boolean})],m.prototype,"slicePlaneEnabled",void 0),p([b()],m.prototype,"updating",void 0),p([b(wi)],m.prototype,"updatingProgress",void 0),p([b({readOnly:!0})],m.prototype,"updatingProgressValue",null),m=p([ue("esri.views.3d.layers.PointCloudLayerView3D")],m);const ps=m;function ss(e){return 5*e.coordinates.length+128}const He=Ni(),le=160;function rs(e){return t=>e.immediate.schedule(t)}const ns=Object.freeze(Object.defineProperty({__proto__:null,PointRendererDrawParameters:pe,PointRendererPassParameters:ce,build:Je,getMaxPointSizeScreenspace:G},Symbol.toStringTag,{value:"Module"}));export{ps as default}; + `),t}function G(e){return e?256:64}const Ve=xt(),ke=V(),ne=vt(),ji=Object.freeze(Object.defineProperty({__proto__:null,PointRendererDrawParameters:pe,PointRendererPassParameters:ce,build:Je,getMaxPointSizeScreenspace:G},Symbol.toStringTag,{value:"Module"}));class j extends Nt{constructor(t,i,s){super(t,i,s)}initializeProgram(t){return new Rt(t.rctx,j.shader.get().build(this.configuration),Ue)}initializePipeline(){return $t({depthTest:{func:Ct.LESS},depthWrite:At,colorWrite:It,stencilWrite:this.configuration.hasOccludees?Ot:null,stencilTest:this.configuration.hasOccludees?Mt:null})}}j.shader=new wt(ji,()=>zt(()=>Promise.resolve().then(()=>ns),void 0));class O extends Et{constructor(){super(...arguments),this.output=w.Color,this.hasSlicePlane=!1,this.drawScreenSize=!1,this.useFixedSizes=!1,this.hasOccludees=!1,this.clippingEnabled=!1}}p([E({count:w.COUNT})],O.prototype,"output",void 0),p([E()],O.prototype,"hasSlicePlane",void 0),p([E()],O.prototype,"drawScreenSize",void 0),p([E()],O.prototype,"useFixedSizes",void 0),p([E()],O.prototype,"hasOccludees",void 0),p([E()],O.prototype,"clippingEnabled",void 0),p([E({constValue:!0})],O.prototype,"hasSliceInVertexProgram",void 0);const Ji={positions:[new ye(B.POSITION,3,Se.FLOAT,0,12)],colors:[new ye(B.COLOR,3,Se.UNSIGNED_BYTE,0,3,!0)]};let U=class extends Ft{constructor(e){super(e),this.type=Lt.PCL,this.isGround=!1,this._passParameters=new ce,this._highlights=new Bi({forEachNode:t=>this.forEachNode(t),addHighlight:(t,i,s)=>this._addHighlight(t,i,s),removeHighlight:(t,i)=>this._removeHighlight(t,i)}),this.produces=new Map([[Be.OPAQUE_MATERIAL,t=>t!==w.Highlight||!this._highlights.empty]]),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new O,this._nodes=new Vt}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,i,s){const r=V(),n=V(),a=V(),o=V(),l=Ge(),d=e.camera.perScreenPixelRatio/2,g=e.camera.near;Pe(n,s,i);const _=1/kt(n);Dt(n,n,_),qt(a,n),Qt(l,n[0],n[1],n[2],-A(n,i));const c=new ae,u=new ae,y=new Array,z=W(),f=W(this._passParameters.clipBox);xe(f,-i[0],-i[1],-i[2],f),this._nodes.forAll(h=>{const S=h.splatSize*this._passParameters.scaleFactor;let x=je(h.obb,l),I=Wt(h.obb,l);x-=oe(S,x+g,this._passParameters,d,h.isLeaf),I-=oe(S,I+g,this._passParameters,d,h.isLeaf);const Ye=I<0,Ke=c.dist!=null&&u.dist!=null&&c.distI*_;if(Ye||Ke)return;const Y=he(S,I+g,this._passParameters,d,h.isLeaf);if(!Tt(h.obb,i,n,Y))return;const Xe=Y*Y;We(h.obb,z),xe(z,-i[0],-i[1],-i[2],z);const Ze=!Te(f,z);Pe(o,h.origin,i);const et=h.coordinates.length/3;for(let M=0;MXe)continue;let K=q+g;const X=oe(S,K,this._passParameters,d,h.isLeaf);if(q-X<0)continue;K-=X;const ge=he(S,K,this._passParameters,d,h.isLeaf);if(_e>ge*ge)continue;const F=(q-X)*_,Z=N=>(N.point=Xi(h,M,N.point),N.dist=F,N.normal=a,N.node=h,N.pointId=M,N.layerUid=this.layerUid,N);if((c.dist==null||Fu.dist)&&(t==null||t(i,s,F))&&Z(u),e.options.store===H.ALL&&(t==null||t(i,s,F))){const N=new ae;y.push(Z(N))}}});const J=h=>{const{layerUid:S,node:x,pointId:I}=h;return new Kt(h.point,S,I,()=>this.createGraphic(x,I,h.point))},D=(h,S)=>{const x=J(S);h.set(this.type,x,S.dist,S.normal)};if(qe(c)){const h=e.results.min;(h.dist==null||c.disth.dist)&&D(h,u)}if(e.options.store===H.ALL){const h=Bt(i,s);for(const S of y){const x=Gt(h);D(x,S),e.results.all.push(x)}}}prepareTechnique(e){return this._nodes.length===0||e.output!==w.Color&&e.output!==w.Depth&&e.output!==w.Highlight?null:(this._nodes.forAll(t=>{t.vao==null&&this._initNode(e,t)}),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output,this._context.techniqueRepository.releaseAndAcquire(j,this._techniqueConfig,this._technique))}renderNode(e,t){const i=e.rctx,s=i.bindTechnique(t,this._passParameters,e.bindParameters),r=e.output===w.Highlight;this._nodes.forAll(n=>{n.coordinates.length===0||r&&!n.highlights||(s.bindDraw(n,e.bindParameters,this._passParameters),i.bindVAO(n.vao),r?this._renderHighlightFragments(i,n):i.drawArrays(te.POINTS,0,n.coordinates.length/3))})}_renderHighlightFragments(e,t){const i=t.highlights;if(i==null)return;let s=i[0].component,r=s+1;for(let a=1;a0&&e.drawArrays(te.POINTS,s,l),s=o}r=o+1}const n=r-s;n>0&&e.drawArrays(te.POINTS,s,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){jt(this._passParameters.clipBox,e||de)}get _clippingEnabled(){return!Jt(this._passParameters.clipBox,de,(e,t)=>e===t)}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let t=null;return this._nodes.filterInPlace(i=>i.id!==e||(t=i,i.vao=ve(i.vao),this._highlights.nodeRemoved(i),!1)),this._requestRender(),t}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll(e=>e.vao=ve(e.vao)),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,t,i){e.highlights=Zi(e.highlights,t,i),this._requestRender()}_removeHighlight(e,t){e.highlights=es(e.highlights,t),this._requestRender()}_initNode(e,t){const i=e.rctx;t.vao=new Yt(i,Ue,Ji,{positions:we.createVertex(i,ze.STATIC_DRAW,t.coordinates),colors:we.createVertex(i,ze.STATIC_DRAW,t.rgb)})}_requestRender(){this._context&&this._context.requestRender()}};p([b({constructOnly:!0})],U.prototype,"createGraphic",void 0),U=p([ue("esri.views.3d.layers.i3s.PointRenderer")],U);class Yi extends pe{constructor(t,i,s,r,n,a,o,l,d=null,g=null){super(s,n,i),this.id=t,this.obb=r,this.coordinates=a,this.rgb=o,this.attributes=l,this.pointIdFilterMap=d,this.highlights=g}}function Ki(e){return e.hasOwnProperty("splatSize")}function he(e,t,i,s,r){if(i.drawScreenSpace)return i.fixedSize*t*s;const n=G(r)*t*s;return i.useFixedSizes?Math.min(i.fixedSize/2,n):i.screenMinSize>0?Math.min(Math.max(i.screenMinSize*t*s,e/2),n):Math.min(e/2,n)}function oe(e,t,i,s,r){return i.drawScreenSpace?0:he(e,t,i,s,r)}function Xi(e,t,i){return i==null&&(i=V()),i[0]=e.origin[0]+e.coordinates[3*t],i[1]=e.origin[1]+e.coordinates[3*t+1],i[2]=e.origin[2]+e.coordinates[3*t+2],i}function De(e){return e.component!=null?e.component:-1}function Zi(e,t,i){e==null&&(e=[]);const s={component:t,id:i};e.push(s);const r=De(s);let n=e.length-1;for(;n>0&&rs.id!==t);return i.length===0?null:i}class ae{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function qe(e){return e.dist!=null&&e.point!=null&&e.pointId!=null&&e.node!=null}const ts=8,is=Ge();let m=class extends Mi(Ci(Ei)){constructor(){super(...arguments),this.type="point-cloud-3d",this.slots=[Be.OPAQUE_MATERIAL],this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._nodeScales=new Map,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new Xt,this._indexPagesLoading=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl.path}get pointScale(){var i;const e=Hi((i=this.layer)==null?void 0:i.renderer),t=1;return(e==null?void 0:e.scaleFactor)!=null?e.scaleFactor:t}get useRealWorldSymbolSizes(){var i;const e=Fe((i=this.layer)==null?void 0:i.renderer),t=!1;return(e==null?void 0:e.useRealWorldSymbolSizes)!=null?e.useRealWorldSymbolSizes:t}get pointSize(){var i;const e=Fe((i=this.layer)==null?void 0:i.renderer),t=0;return(e==null?void 0:e.size)!=null?e.size:t}get inverseDensity(){var t;return(t=this.layer)!=null&&t.renderer?1*96/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=Me(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=Ee(this.layer);if(i)for(const s of i)s.attributeInfo&&t.add(s.attributeInfo.name);if(this.layer.outFields)for(const s of Ne(this.layer.fieldsIndex,this.layer.outFields))t.add(s);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=W(),t=this.view.renderSpatialReference;return Zt(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;if(e&&e.mode==="absolute-height"){const t=ei(this.layer.spatialReference),i=ti(e.unit);return(e.offset??0)*i/t}return 0}initialize(){const e=this.view.resourceController,t=rs(e);this._worker=new Fi(t),this.addResolvingPromise(this._worker.promise),this._tmpPoint=ii(0,0,0,this.layer.spatialReference),si(this.layer),ri(this.layer,this.view),this._indexRequester=e.createStreamDataRequester(Re.I3S_INDEX),this._dataRequester=e.createStreamDataRequester(Re.I3S_DATA),this._initRenderer();const i=this._initNodePages(),s=this.view.resourceController.memoryController;this._memCache=s.newCache(`pcl-${this.layer.uid}`),this._updatingHandles.add(()=>this._clippingBox,()=>this._setUpdateViewNeeded(),P),this._updatingHandles.add(()=>this._elevationOffset,()=>this._elevationOffsetChanged(),P),this._updatingHandles.add(()=>this.layer.renderer,()=>this._rendererChanged(),P),this._updatingHandles.add(()=>this.layer.filters,()=>this._reload(),P),this._updatingHandles.add(()=>this.layer.outFields,()=>this._reload(),P),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this._setUpdateViewNeeded()),this._updatingHandles.add(()=>this.view.state.contentCamera,()=>this._setUpdateViewNeeded()),this.addHandles([this.view.basemapTerrain.on("scale-change",r=>this._scaleUpdateHandler(r)),ni(()=>this.view.quality,()=>this._setUpdateViewNeeded(),oi)]),this.addResolvingPromise(i),this.when(()=>{this.addHandles([e.scheduler.registerTask(ai.POINT_CLOUD_LAYER,this),e.scheduler.registerIdleStateCallbacks(()=>this._idleBegin(),()=>this._idleEnd()),this._updatingHandles.add(()=>this.suspended,r=>{r?this._clearNodeState():this._setUpdateViewNeeded()},P)])},()=>{this._updatingHandles.removeAll(),this.removeAllHandles()})}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=$e(this._worker),this._destroyRenderer(),this._memCache=$e(this._memCache),this._codedDomainPopulationAbortController=li(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new U({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerUid=this.layer.uid,this._updatingHandles.add(()=>this._clippingBox,e=>this._renderer.clippingBox=e,P),this._updatingHandles.add(()=>this.suspended,e=>this._setPointsVisible(!e),P),this._updatingHandles.add(()=>this.pointScale,e=>this._renderer.scaleFactor=e,P),this._renderer.minSizePx=Math.sqrt(2),this._updatingHandles.add(()=>this.useRealWorldSymbolSizes,e=>this._renderer.useRealWorldSymbolSizes=e,P),this._updatingHandles.add(()=>this.pointSize,e=>{const t=Ni(e);this._renderer.size=e,this._renderer.sizePx=t},P),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._renderer.slicePlaneEnabled=e,P),this._updatingHandles.add(()=>this.inverseDensity,()=>this._setUpdateViewNeeded(),P),this._updatingHandles.add(()=>this.maximumPointCount,()=>this._setUpdateViewNeeded(),P),this._updatingHandles.add(()=>this.view.qualitySettings.sceneService.pointCloud.lodFactor,e=>{this._lodFactor=e,this._setUpdateViewNeeded()},P)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i){const s=e.pointIdFilterMap!=null?e.pointIdFilterMap[t]:t,r=this.view.computeMapPointFromVec3d(i),n=this._createGraphicAttributes(e,s);return new Q({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:s,epoch:this._nodeLoadEpoch},geometry:r,attributes:n,layer:this.layer,sourceLayer:this.layer})}_createGraphicAttributes(e,t){const i={};for(const s of e.attributes)this._encodeGraphicAttribute(s.attributeInfo,s.values,t,i);return i}_encodeGraphicAttribute(e,t,i,s){var a;const r=(a=e.storageInfo)==null?void 0:a.attributeValues,n=(r==null?void 0:r.valuesPerElement)??1;if(n===1)s[e.name]=t[i];else if((r==null?void 0:r.valueType)==="UInt8"&&n<=4){let o=0;const l=i*n;for(let d=l;d{if(!this._renderedNodes.has(s))return void this._nodeScales.delete(s);const r=this._index.getNode(s);ui(Qe,r.obb.center)&&this._nodeScales.set(s,e.scale)}),this._setUpdateViewNeeded()):this._nodeScales.clear()}_displayNodes(e){this._workQueue=Li([...this._renderedNodes],e,this._index),Vi(this._workQueue,this.view.state.contentCamera.viewForward,this._index),ki(this._workQueue,ts,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){const e=new Array;this._loadingNodes.forEach(({abortController:t})=>e.push(t)),this._loadingNodes.clear();for(const t of e)t.abort();this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach(s=>s.load.forEach(r=>e.add(r)));const t=new Array,i=new Map;this._loadingNodes.forEach((s,r)=>{e.has(r)?i.set(r,s):t.push(s)}),this._loadingNodes=i;for(const{abortController:s}of t)s.abort();this._workQueue=this._workQueue.filter(s=>{for(const r of s.load)if(this._loadingNodes.has(r))return this._recalcWork=!0,!1;return!0}),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._indexPagesLoading.forEach(({abortController:e})=>e.abort()),this._indexPagesLoading.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach(e=>this._removeFromRenderer(e)),this._cancelNodeLoading()}_idleBegin(){this._setUpdateViewNeeded()}_idleEnd(){this._setUpdateViewNeeded()}get running(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.running}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const t=this._isRootNodeVisible();t!==this._layerIsVisible&&(this._layerIsVisible=t,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run(()=>this._updateWorkQueues());this._indexQueue.length>0&&e.run(()=>this._processIndexQueue()););this._processWorkQueue(e),this._idleQueue.runTask(e)}}_processIndexQueue(){const e=this._indexQueue.shift(),t=this._loadNodePage(e);return this._indexPagesLoading.set(e,t),t.promise.then(i=>{this._index.addPage(e,i,this._elevationOffset),this._setUpdateViewNeeded()}).then(()=>{this._indexPagesLoading.delete(e)},()=>{this._indexPagesLoading.delete(e)}),!0}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(t==null)return void e.madeProgress();this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const t=this._workQueue.shift();if(!t.remove.find(i=>!this._renderedNodes.has(i)))return t;this._workQueue.push(t)}return null}_processWorkEntry(e){if(e.load.length!==0)Promise.all(e.load.map(t=>{const i=new AbortController,s=this._memCache.pop(t.toString());return s!=null?this._loadingNodes.set(t,{abortController:i,promise:Promise.resolve(s)}):this._loadingNodes.has(t)||this._loadingNodes.set(t,{abortController:i,promise:this._loadNode(t,i.signal)}),this._loadingNodes.get(t).promise})).then(t=>{for(let i=0;i{}).then(()=>{for(const t of e.load)this._loadingNodes.delete(t);this._updateLoading(),this._recalcWork&&!this._idleQueue.running&&this._indexQueue.length===0&&this._loadingNodes.size===0&&(this._recalcWork=!1,this._setUpdateViewNeeded())}),this._updateLoading();else for(const t of e.remove)this._removeFromRenderer(t)}async _populateClassCodeCodedDomain(e,t){var a,o,l;const i="CLASS_CODE",s=this.layer.fieldsIndex.get(i);if(!s||s.domain||!e.includes(s.name))return;const r=await ci(this.layer.queryCachedStatistics(i,{signal:t}));if(r.ok===!1)return;const n=(l=(o=(a=r.value)==null?void 0:a.stats)==null?void 0:o.labels)==null?void 0:l.labels;n&&Array.isArray(n)&&(s.domain=new pi({name:"CLASS_CODE",codedValues:n.map(d=>new _i({code:d.value,name:d.label}))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then(()=>{this._codedDomainPopulationAbortController=null})),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const i=this._splitGraphicsPerNode(e),s=this.layer.attributeStorageInfo,r=t.map(o=>T(s,o)).filter(Ce),n=async(o,l)=>{const d=this._index.getNode(l);await Ri(r,async g=>{const _=g.useElevation?await this._loadElevationAttributeFromGeometry(d.resourceId):await this._loadAndParseAttribute(d,g);if(_){for(const c of o)if(this._isValidPointGraphic(c)){const u=c.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(g,_,u,c.attributes)}}})},a=[];return i.forEach((o,l)=>{a.push(n(o,l))}),await Promise.allSettled(a),e}_isValidPointGraphic(e){var t;return e instanceof Q&&((t=e.pointCloudMetadata)==null?void 0:t.epoch)===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const s=i.pointCloudMetadata,r=t.get(s.nodeId);r?r.push(i):t.set(s.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return i!=null?Ai({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=Ii(t,await this._loadGeometry(e,null));return Oi(i,i.length/3)}highlight(e){if(!e)return He();const t=gi.isCollection(e)?e.toArray():Array.isArray(e)?e:[e];return this._renderer.highlight(t.map(i=>this._graphicToPointDefinition(i)))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return t!=null&&i!=null?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._indexPagesLoading.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}_initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;return this._index=new qi(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=e.nodesPerPage!=null?1:e.nodePerIndexBlock,this._loadNodePage(0).promise.then(i=>{this._index.addPage(0,i,this._elevationOffset),this._loadingInitNodePage=!1,this._setUpdateViewNeeded()})}_loadNodePage(e){const t=new AbortController,i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return{promise:this._requestNodePage(i,t.signal).then(s=>s.nodes.map((r,n)=>({resourceId:r.resourceId!=null?r.resourceId:e*this._index.pageSize+n,obb:r.obb,obbInRenderSR:fi(),firstChild:r.firstChild,childCount:r.childCount,vertexCount:r.vertexCount??r.pointCount,lodThreshold:r.lodThreshold??r.effectiveArea}))),abortController:t}}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;const e=this.view.quality;let t=this.inverseDensity/this._lodFactor*e;const i=this.maximumPointCount*this._lodFactor*e;let s=this._computeNodesForMinimumDensity(t),r=this._computePointCount(s),n=Math.sqrt(r/(.75*i));for(;r>i;)t*=n,s=this._computeNodesForMinimumDensity(t),r=this._computePointCount(s),n=Math.sqrt(2);return this._displayNodes(s),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i(e=s,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,s=this._clippingBox,r=t.viewForward,n=A(r,t.eye),a=mi(r,-n,is),o=t.perScreenPixelRatio/2,l=e*e,d=this._nodeIdArray;d.length=0;const{minScale:g,maxScale:_}=bi(this.layer),c=g===0&&_===0?u=>d.push(u):u=>{const y=this._getScale(u);$i(y,g,_)&&d.push(u)};return this._traverseVisible({frustum:i,clippingBox:s},{predicate:(u,y,z)=>{if(!z)return!1;if(y.childCount===0)return c(u),!1;const f=this._index.getRenderObb(u);return!(this._computeAveragePixelArea(f,y.lodThreshold,y.vertexCount,a,o)<=l)||(c(u),!1)},pageMiss:(u,y)=>{c(u),this._indexQueue.includes(y)||this._indexQueue.push(y)}}),d}_getScale(e){let t=this._nodeScales.get(e);if(t==null){const i=this._index.getNode(e).obb.center;this._tmpPoint.x=i[0],this._tmpPoint.y=i[1],this._tmpPoint.z=i[2],t=this.view.basemapTerrain.getScale(this._tmpPoint),this._nodeScales.set(e,t)}return t}_computeAveragePixelArea(e,t,i,s,r){const a=Math.max(1e-7,je(e,s));return t/(a*a)/(4*r*r)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw yi(i)||ie.getLogger(this).error(i),i}}async _loadAdditionalUserAttributes(e,t,i){const s=this.layer.outFields;if(!s)return[];const r=Ne(this.layer.fieldsIndex,s),n=new Set(e.map(d=>d!=null?d.name:null)),a=this.layer.attributeStorageInfo,o=[];for(const d of r){if(n.has(d))continue;const g=T(a,d);g&&o.push(t(g))}const l=await Si(o);return Ae(i),l.filter(Ce)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),s=Me(this.layer),r=Ee(this.layer),n=i.resourceId,a=async o=>{if(!o)return null;if(o.useElevation)return{attributeInfo:o,buffer:null};const l=await this._loadAttribute(n,o,t);return l!=null?{attributeInfo:o,buffer:l}:null};return this._idleQueue.push(async()=>{const o=this._loadGeometry(n,t),{primaryAttribute:l,modulationAttribute:d}=s,g=a(l),_=a(d),c=r.map(x=>x.attributeInfo),u=c.map(x=>a(x)),y=this._loadAdditionalUserAttributes([l,d,...c],a,t),[z,f,J,D,h]=await Promise.all([o,g,_,Promise.all(u),y]);Ae(t);const S={geometryBuffer:z,primaryAttributeData:f,modulationAttributeData:J,filterAttributesData:D,userAttributesData:h,schema:this.layer.store.defaultGeometrySchema,rendererInfo:s,filterInfo:r,obb:this._index.getRenderObb(e),elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(S,t)},t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(!(t!=null&&t.storageInfo))return null;const s=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${s}`,i)}_requestNodePage(e,t){const i={f:"json",token:this.layer.apiKey};return this._indexRequester.request(e,"json",{query:i,signal:t})}_requestData(e,t){return this._dataRequester.request(e,"binary",{query:{token:this.layer.apiKey},signal:t})}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._nodeScales.delete(e),this._memCache.put(t.id.toString(),t,ss(t))}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),s=Math.sqrt(i.lodThreshold/i.vertexCount),r=this._index.getRenderObb(e);if(Ki(t))return t.splatSize=s,t.obb=r,Pi(t.origin,t.obb.center),t;const n=.01*Math.max(r.halfSize[0],r.halfSize[1],r.halfSize[2]);if(t.obb.halfSize[0]>r.halfSize[0]+n||t.obb.halfSize[1]>r.halfSize[1]+n||t.obb.halfSize[2]>r.halfSize[2]+n){if(this._maxLoggedBoxWarnings>0){const a=o=>`[${o.halfSize[0]}, ${o.halfSize[1]}, ${o.halfSize[2]}]`;ie.getLogger(this).warn(`Node ${e} reported bounding box too small. got ${a(r)} but points cover ${a(t.obb)}`),--this._maxLoggedBoxWarnings==0&&ie.getLogger(this).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,t.obb)}return new Yi(e,s,xi(r.center),r,i.childCount===0,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode(t=>{e+=le,e+=Ie(t.coordinates);for(const i of t.attributes){const s=i.values;vi(s.buffer)&&(e+=Ie(s))}}),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce((s,r)=>s+this._index.getNode(r).vertexCount);let i=this._loadingNodes.size;for(let s=0;se+this._index.getNode(t).vertexCount,0),maximumNumberOfFeatures:this.maximumPointCount,totalNumberOfFeatures:-1,core:null,"Loading Nodes":this._loadingNodes.size,"Index Queue":this._indexQueue.length,"Work Queue":this._workQueue.length,"Idle Queue":this._idleQueue.length}}get test(){return{index:this._index,visibleNodes:this._renderedNodes}}};p([b()],m.prototype,"layer",void 0),p([b()],m.prototype,"baseUrl",null),p([b()],m.prototype,"pointScale",null),p([b()],m.prototype,"useRealWorldSymbolSizes",null),p([b()],m.prototype,"pointSize",null),p([b()],m.prototype,"inverseDensity",null),p([b()],m.prototype,"maximumPointCount",void 0),p([b({readOnly:!0})],m.prototype,"availableFields",null),p([b({readOnly:!0})],m.prototype,"_clippingBox",null),p([b({readOnly:!0})],m.prototype,"_elevationOffset",null),p([b({type:Boolean})],m.prototype,"slicePlaneEnabled",void 0),p([b()],m.prototype,"updating",void 0),p([b(wi)],m.prototype,"updatingProgress",void 0),p([b({readOnly:!0})],m.prototype,"updatingProgressValue",null),m=p([ue("esri.views.3d.layers.PointCloudLayerView3D")],m);const ps=m;function ss(e){return 5*e.coordinates.length+128}const Qe=zi(),le=160;function rs(e){return t=>e.immediate.schedule(t)}const ns=Object.freeze(Object.defineProperty({__proto__:null,PointRendererDrawParameters:pe,PointRendererPassParameters:ce,build:Je,getMaxPointSizeScreenspace:G},Symbol.toStringTag,{value:"Module"}));export{ps as default}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] diff --git a/dist/assets/PointCloudUniqueValueRenderer-RbbyNiwC.js b/dist/assets/PointCloudUniqueValueRenderer-RbbyNiwC.js deleted file mode 100644 index f425fb3..0000000 --- a/dist/assets/PointCloudUniqueValueRenderer-RbbyNiwC.js +++ /dev/null @@ -1 +0,0 @@ -import{e,y as t,c as r,dr as f,dp as I,iw as m,pR as D,bI as o,ab as P,ey as N,pS as z,pT as K}from"./index-J0iiHjMT.js";var w;let c=w=class extends f{constructor(){super(...arguments),this.field=null,this.minValue=0,this.maxValue=255}clone(){return new w({field:this.field,minValue:this.minValue,maxValue:this.maxValue})}};e([t({type:String,json:{write:!0}})],c.prototype,"field",void 0),e([t({type:Number,nonNullable:!0,json:{write:!0}})],c.prototype,"minValue",void 0),e([t({type:Number,nonNullable:!0,json:{write:!0}})],c.prototype,"maxValue",void 0),c=w=e([r("esri.renderers.support.pointCloud.ColorModulation")],c);const k=c,v=new I({pointCloudFixedSizeAlgorithm:"fixed-size",pointCloudSplatAlgorithm:"splat"});let b=class extends f{};e([t({type:v.apiValues,readOnly:!0,nonNullable:!0,json:{type:v.jsonValues,read:!1,write:v.write}})],b.prototype,"type",void 0),b=e([r("esri.renderers.support.pointCloud.PointSizeAlgorithm")],b);const R=b;var g;let y=g=class extends R{constructor(){super(...arguments),this.type="fixed-size",this.size=0,this.useRealWorldSymbolSizes=null}clone(){return new g({size:this.size,useRealWorldSymbolSizes:this.useRealWorldSymbolSizes})}};e([m({pointCloudFixedSizeAlgorithm:"fixed-size"})],y.prototype,"type",void 0),e([t({type:Number,nonNullable:!0,json:{write:!0}})],y.prototype,"size",void 0),e([t({type:Boolean,json:{write:!0}})],y.prototype,"useRealWorldSymbolSizes",void 0),y=g=e([r("esri.renderers.support.pointCloud.PointSizeFixedSizeAlgorithm")],y);const B=y;var V;let h=V=class extends R{constructor(){super(...arguments),this.type="splat",this.scaleFactor=1}clone(){return new V({scaleFactor:this.scaleFactor})}};e([m({pointCloudSplatAlgorithm:"splat"})],h.prototype,"type",void 0),e([t({type:Number,value:1,nonNullable:!0,json:{write:!0}})],h.prototype,"scaleFactor",void 0),h=V=e([r("esri.renderers.support.pointCloud.PointSizeSplatAlgorithm")],h);const q=h,A={key:"type",base:R,typeMap:{"fixed-size":B,splat:q}},T=D()({pointCloudClassBreaksRenderer:"point-cloud-class-breaks",pointCloudRGBRenderer:"point-cloud-rgb",pointCloudStretchRenderer:"point-cloud-stretch",pointCloudUniqueValueRenderer:"point-cloud-unique-value"});let l=class extends f{constructor(O){super(O),this.type=void 0,this.pointSizeAlgorithm=null,this.colorModulation=null,this.pointsPerInch=10}clone(){return console.warn(".clone() is not implemented for "+this.declaredClass),null}cloneProperties(){return{pointSizeAlgorithm:o(this.pointSizeAlgorithm),colorModulation:o(this.colorModulation),pointsPerInch:o(this.pointsPerInch)}}};e([t({type:T.apiValues,readOnly:!0,nonNullable:!0,json:{type:T.jsonValues,read:!1,write:T.write}})],l.prototype,"type",void 0),e([t({types:A,json:{write:!0}})],l.prototype,"pointSizeAlgorithm",void 0),e([t({type:k,json:{write:!0}})],l.prototype,"colorModulation",void 0),e([t({json:{write:!0},nonNullable:!0,type:Number})],l.prototype,"pointsPerInch",void 0),l=e([r("esri.renderers.PointCloudRenderer")],l),function(s){s.fieldTransformTypeKebabDict=new I({none:"none",lowFourBit:"low-four-bit",highFourBit:"high-four-bit",absoluteValue:"absolute-value",moduloTen:"modulo-ten"})}(l||(l={}));const i=l;var j;let n=j=class extends f{constructor(){super(...arguments),this.description=null,this.label=null,this.minValue=0,this.maxValue=0,this.color=null}clone(){return new j({description:this.description,label:this.label,minValue:this.minValue,maxValue:this.maxValue,color:o(this.color)})}};e([t({type:String,json:{write:!0}})],n.prototype,"description",void 0),e([t({type:String,json:{write:!0}})],n.prototype,"label",void 0),e([t({type:Number,json:{read:{source:"classMinValue"},write:{target:"classMinValue"}}})],n.prototype,"minValue",void 0),e([t({type:Number,json:{read:{source:"classMaxValue"},write:{target:"classMaxValue"}}})],n.prototype,"maxValue",void 0),e([t({type:P,json:{type:[N],write:!0}})],n.prototype,"color",void 0),n=j=e([r("esri.renderers.support.pointCloud.ColorClassBreakInfo")],n);const M=n;var S;let p=S=class extends i{constructor(s){super(s),this.type="point-cloud-class-breaks",this.field=null,this.legendOptions=null,this.fieldTransformType=null,this.colorClassBreakInfos=null}clone(){return new S({...this.cloneProperties(),field:this.field,fieldTransformType:this.fieldTransformType,colorClassBreakInfos:o(this.colorClassBreakInfos),legendOptions:o(this.legendOptions)})}};e([m({pointCloudClassBreaksRenderer:"point-cloud-class-breaks"})],p.prototype,"type",void 0),e([t({json:{write:!0},type:String})],p.prototype,"field",void 0),e([t({type:z,json:{write:!0}})],p.prototype,"legendOptions",void 0),e([t({type:i.fieldTransformTypeKebabDict.apiValues,json:{type:i.fieldTransformTypeKebabDict.jsonValues,read:i.fieldTransformTypeKebabDict.read,write:i.fieldTransformTypeKebabDict.write}})],p.prototype,"fieldTransformType",void 0),e([t({type:[M],json:{write:!0}})],p.prototype,"colorClassBreakInfos",void 0),p=S=e([r("esri.renderers.PointCloudClassBreaksRenderer")],p);const E=p;var C;let a=C=class extends i{constructor(s){super(s),this.type="point-cloud-stretch",this.field=null,this.legendOptions=null,this.fieldTransformType=null,this.stops=null}clone(){return new C({...this.cloneProperties(),field:o(this.field),fieldTransformType:o(this.fieldTransformType),stops:o(this.stops),legendOptions:o(this.legendOptions)})}};e([m({pointCloudStretchRenderer:"point-cloud-stretch"})],a.prototype,"type",void 0),e([t({json:{write:!0},type:String})],a.prototype,"field",void 0),e([t({type:z,json:{write:!0}})],a.prototype,"legendOptions",void 0),e([t({type:i.fieldTransformTypeKebabDict.apiValues,json:{type:i.fieldTransformTypeKebabDict.jsonValues,read:i.fieldTransformTypeKebabDict.read,write:i.fieldTransformTypeKebabDict.write}})],a.prototype,"fieldTransformType",void 0),e([t({type:[K],json:{write:!0}})],a.prototype,"stops",void 0),a=C=e([r("esri.renderers.PointCloudStretchRenderer")],a);const H=a;var $;let u=$=class extends f{constructor(){super(...arguments),this.description=null,this.label=null,this.values=null,this.color=null}clone(){return new $({description:this.description,label:this.label,values:o(this.values),color:o(this.color)})}};e([t({type:String,json:{write:!0}})],u.prototype,"description",void 0),e([t({type:String,json:{write:!0}})],u.prototype,"label",void 0),e([t({type:[String],json:{write:!0}})],u.prototype,"values",void 0),e([t({type:P,json:{type:[N],write:!0}})],u.prototype,"color",void 0),u=$=e([r("esri.renderers.support.pointCloud.ColorUniqueValueInfo")],u);const F=u;var x;let d=x=class extends i{constructor(s){super(s),this.type="point-cloud-unique-value",this.field=null,this.fieldTransformType=null,this.colorUniqueValueInfos=null,this.legendOptions=null}clone(){return new x({...this.cloneProperties(),field:o(this.field),fieldTransformType:o(this.fieldTransformType),colorUniqueValueInfos:o(this.colorUniqueValueInfos),legendOptions:o(this.legendOptions)})}};e([m({pointCloudUniqueValueRenderer:"point-cloud-unique-value"})],d.prototype,"type",void 0),e([t({json:{write:!0},type:String})],d.prototype,"field",void 0),e([t({type:i.fieldTransformTypeKebabDict.apiValues,json:{type:i.fieldTransformTypeKebabDict.jsonValues,read:i.fieldTransformTypeKebabDict.read,write:i.fieldTransformTypeKebabDict.write}})],d.prototype,"fieldTransformType",void 0),e([t({type:[F],json:{write:!0}})],d.prototype,"colorUniqueValueInfos",void 0),e([t({type:z,json:{write:!0}})],d.prototype,"legendOptions",void 0),d=x=e([r("esri.renderers.PointCloudUniqueValueRenderer")],d);const J=d;export{J as a,H as b,i as c,E as d}; diff --git a/dist/assets/PointCloudUniqueValueRenderer-mGlOSV4H.js b/dist/assets/PointCloudUniqueValueRenderer-mGlOSV4H.js new file mode 100644 index 0000000..fa8dfa7 --- /dev/null +++ b/dist/assets/PointCloudUniqueValueRenderer-mGlOSV4H.js @@ -0,0 +1 @@ +import{e,y as t,c as r,dr as f,dp as P,iy as m,q2 as O,ah as o,W as q,er as I,q3 as z,q4 as D}from"./index-pCX-0tJH.js";var w;let c=w=class extends f{constructor(){super(...arguments),this.field=null,this.minValue=0,this.maxValue=255}clone(){return new w({field:this.field,minValue:this.minValue,maxValue:this.maxValue})}};e([t({type:String,json:{write:!0}})],c.prototype,"field",void 0),e([t({type:Number,nonNullable:!0,json:{write:!0}})],c.prototype,"minValue",void 0),e([t({type:Number,nonNullable:!0,json:{write:!0}})],c.prototype,"maxValue",void 0),c=w=e([r("esri.renderers.support.pointCloud.ColorModulation")],c);const K=c,v=new P({pointCloudFixedSizeAlgorithm:"fixed-size",pointCloudSplatAlgorithm:"splat"});let b=class extends f{};e([t({type:v.apiValues,readOnly:!0,nonNullable:!0,json:{type:v.jsonValues,read:!1,write:v.write}})],b.prototype,"type",void 0),b=e([r("esri.renderers.support.pointCloud.PointSizeAlgorithm")],b);const R=b;var g;let y=g=class extends R{constructor(){super(...arguments),this.type="fixed-size",this.size=0,this.useRealWorldSymbolSizes=null}clone(){return new g({size:this.size,useRealWorldSymbolSizes:this.useRealWorldSymbolSizes})}};e([m({pointCloudFixedSizeAlgorithm:"fixed-size"})],y.prototype,"type",void 0),e([t({type:Number,nonNullable:!0,json:{write:!0}})],y.prototype,"size",void 0),e([t({type:Boolean,json:{write:!0}})],y.prototype,"useRealWorldSymbolSizes",void 0),y=g=e([r("esri.renderers.support.pointCloud.PointSizeFixedSizeAlgorithm")],y);const k=y;var V;let h=V=class extends R{constructor(){super(...arguments),this.type="splat",this.scaleFactor=1}clone(){return new V({scaleFactor:this.scaleFactor})}};e([m({pointCloudSplatAlgorithm:"splat"})],h.prototype,"type",void 0),e([t({type:Number,value:1,nonNullable:!0,json:{write:!0}})],h.prototype,"scaleFactor",void 0),h=V=e([r("esri.renderers.support.pointCloud.PointSizeSplatAlgorithm")],h);const B=h,A={key:"type",base:R,typeMap:{"fixed-size":k,splat:B}},T=O()({pointCloudClassBreaksRenderer:"point-cloud-class-breaks",pointCloudRGBRenderer:"point-cloud-rgb",pointCloudStretchRenderer:"point-cloud-stretch",pointCloudUniqueValueRenderer:"point-cloud-unique-value"});let l=class extends f{constructor(N){super(N),this.type=void 0,this.pointSizeAlgorithm=null,this.colorModulation=null,this.pointsPerInch=10}clone(){return console.warn(".clone() is not implemented for "+this.declaredClass),null}cloneProperties(){return{pointSizeAlgorithm:o(this.pointSizeAlgorithm),colorModulation:o(this.colorModulation),pointsPerInch:o(this.pointsPerInch)}}};e([t({type:T.apiValues,readOnly:!0,nonNullable:!0,json:{type:T.jsonValues,read:!1,write:T.write}})],l.prototype,"type",void 0),e([t({types:A,json:{write:!0}})],l.prototype,"pointSizeAlgorithm",void 0),e([t({type:K,json:{write:!0}})],l.prototype,"colorModulation",void 0),e([t({json:{write:!0},nonNullable:!0,type:Number})],l.prototype,"pointsPerInch",void 0),l=e([r("esri.renderers.PointCloudRenderer")],l),function(s){s.fieldTransformTypeKebabDict=new P({none:"none",lowFourBit:"low-four-bit",highFourBit:"high-four-bit",absoluteValue:"absolute-value",moduloTen:"modulo-ten"})}(l||(l={}));const i=l;var j;let n=j=class extends f{constructor(){super(...arguments),this.description=null,this.label=null,this.minValue=0,this.maxValue=0,this.color=null}clone(){return new j({description:this.description,label:this.label,minValue:this.minValue,maxValue:this.maxValue,color:o(this.color)})}};e([t({type:String,json:{write:!0}})],n.prototype,"description",void 0),e([t({type:String,json:{write:!0}})],n.prototype,"label",void 0),e([t({type:Number,json:{read:{source:"classMinValue"},write:{target:"classMinValue"}}})],n.prototype,"minValue",void 0),e([t({type:Number,json:{read:{source:"classMaxValue"},write:{target:"classMaxValue"}}})],n.prototype,"maxValue",void 0),e([t({type:q,json:{type:[I],write:!0}})],n.prototype,"color",void 0),n=j=e([r("esri.renderers.support.pointCloud.ColorClassBreakInfo")],n);const M=n;var C;let p=C=class extends i{constructor(s){super(s),this.type="point-cloud-class-breaks",this.field=null,this.legendOptions=null,this.fieldTransformType=null,this.colorClassBreakInfos=null}clone(){return new C({...this.cloneProperties(),field:this.field,fieldTransformType:this.fieldTransformType,colorClassBreakInfos:o(this.colorClassBreakInfos),legendOptions:o(this.legendOptions)})}};e([m({pointCloudClassBreaksRenderer:"point-cloud-class-breaks"})],p.prototype,"type",void 0),e([t({json:{write:!0},type:String})],p.prototype,"field",void 0),e([t({type:z,json:{write:!0}})],p.prototype,"legendOptions",void 0),e([t({type:i.fieldTransformTypeKebabDict.apiValues,json:{type:i.fieldTransformTypeKebabDict.jsonValues,read:i.fieldTransformTypeKebabDict.read,write:i.fieldTransformTypeKebabDict.write}})],p.prototype,"fieldTransformType",void 0),e([t({type:[M],json:{write:!0}})],p.prototype,"colorClassBreakInfos",void 0),p=C=e([r("esri.renderers.PointCloudClassBreaksRenderer")],p);const E=p;var S;let a=S=class extends i{constructor(s){super(s),this.type="point-cloud-stretch",this.field=null,this.legendOptions=null,this.fieldTransformType=null,this.stops=null}clone(){return new S({...this.cloneProperties(),field:o(this.field),fieldTransformType:o(this.fieldTransformType),stops:o(this.stops),legendOptions:o(this.legendOptions)})}};e([m({pointCloudStretchRenderer:"point-cloud-stretch"})],a.prototype,"type",void 0),e([t({json:{write:!0},type:String})],a.prototype,"field",void 0),e([t({type:z,json:{write:!0}})],a.prototype,"legendOptions",void 0),e([t({type:i.fieldTransformTypeKebabDict.apiValues,json:{type:i.fieldTransformTypeKebabDict.jsonValues,read:i.fieldTransformTypeKebabDict.read,write:i.fieldTransformTypeKebabDict.write}})],a.prototype,"fieldTransformType",void 0),e([t({type:[D],json:{write:!0}})],a.prototype,"stops",void 0),a=S=e([r("esri.renderers.PointCloudStretchRenderer")],a);const H=a;var $;let u=$=class extends f{constructor(){super(...arguments),this.description=null,this.label=null,this.values=null,this.color=null}clone(){return new $({description:this.description,label:this.label,values:o(this.values),color:o(this.color)})}};e([t({type:String,json:{write:!0}})],u.prototype,"description",void 0),e([t({type:String,json:{write:!0}})],u.prototype,"label",void 0),e([t({type:[String],json:{write:!0}})],u.prototype,"values",void 0),e([t({type:q,json:{type:[I],write:!0}})],u.prototype,"color",void 0),u=$=e([r("esri.renderers.support.pointCloud.ColorUniqueValueInfo")],u);const F=u;var x;let d=x=class extends i{constructor(s){super(s),this.type="point-cloud-unique-value",this.field=null,this.fieldTransformType=null,this.colorUniqueValueInfos=null,this.legendOptions=null}clone(){return new x({...this.cloneProperties(),field:o(this.field),fieldTransformType:o(this.fieldTransformType),colorUniqueValueInfos:o(this.colorUniqueValueInfos),legendOptions:o(this.legendOptions)})}};e([m({pointCloudUniqueValueRenderer:"point-cloud-unique-value"})],d.prototype,"type",void 0),e([t({json:{write:!0},type:String})],d.prototype,"field",void 0),e([t({type:i.fieldTransformTypeKebabDict.apiValues,json:{type:i.fieldTransformTypeKebabDict.jsonValues,read:i.fieldTransformTypeKebabDict.read,write:i.fieldTransformTypeKebabDict.write}})],d.prototype,"fieldTransformType",void 0),e([t({type:[F],json:{write:!0}})],d.prototype,"colorUniqueValueInfos",void 0),e([t({type:z,json:{write:!0}})],d.prototype,"legendOptions",void 0),d=x=e([r("esri.renderers.PointCloudUniqueValueRenderer")],d);const J=d;export{J as a,H as b,i as c,E as d}; diff --git a/dist/assets/PointCloudWorker-UgniuzRB.js b/dist/assets/PointCloudWorker-rfPDyXh6.js similarity index 82% rename from dist/assets/PointCloudWorker-UgniuzRB.js rename to dist/assets/PointCloudWorker-rfPDyXh6.js index 700be70..b42fbcb 100644 --- a/dist/assets/PointCloudWorker-UgniuzRB.js +++ b/dist/assets/PointCloudWorker-rfPDyXh6.js @@ -1 +1 @@ -import{gm as g,e3 as A,ar as c,gn as v,go as d,gp as y,gq as S,gr as D,gs as h}from"./index-J0iiHjMT.js";import{u as M,c as b,i as w,f as z}from"./PointCloudWorkerUtil-q8ml4JQu.js";import"./PointCloudUniqueValueRenderer-RbbyNiwC.js";class O{transform(t){const a=this._transform(t),e=[a.points.buffer,a.rgb.buffer];a.pointIdFilterMap!=null&&e.push(a.pointIdFilterMap.buffer);for(const r of a.attributes)"buffer"in r.values&&g(r.values.buffer)&&r.values.buffer!==a.rgb.buffer&&e.push(r.values.buffer);return Promise.resolve({result:a,transferList:e})}_transform(t){const a=M(t.schema,t.geometryBuffer);let e=a.length/3,r=null;const s=new Array,i=b(t.primaryAttributeData,a,e);t.primaryAttributeData!=null&&i&&s.push({attributeInfo:t.primaryAttributeData.attributeInfo,values:i});const o=b(t.modulationAttributeData,a,e);t.modulationAttributeData!=null&&o&&s.push({attributeInfo:t.modulationAttributeData.attributeInfo,values:o});let f=w(t.rendererInfo,i,o,e);if(t.filterInfo&&t.filterInfo.length>0&&t.filterAttributesData!=null){const n=t.filterAttributesData.filter(A).map(l=>{const I=b(l,a,e),p={attributeInfo:l.attributeInfo,values:I};return s.push(p),p});r=new Uint32Array(e),e=z(a,f,r,t.filterInfo,n)}for(const n of t.userAttributesData){const l=b(n,a,e);s.push({attributeInfo:n.attributeInfo,values:l})}3*e0&&t.filterAttributesData!=null){const n=t.filterAttributesData.filter(A).map(l=>{const I=b(l,a,e),p={attributeInfo:l.attributeInfo,values:I};return s.push(p),p});r=new Uint32Array(e),e=z(a,f,r,t.filterInfo,n)}for(const n of t.userAttributesData){const l=b(n,a,e);s.push({attributeInfo:n.attributeInfo,values:l})}3*e=o[l].value)t[3*r]=o[l].color.r,t[3*r+1]=o[l].color.g,t[3*r+2]=o[l].color.b;else for(let f=1;f=o[l].minValue&&c<=o[l].maxValue){t[3*r]=o[l].color.r,t[3*r+1]=o[l].color.g,t[3*r+2]=o[l].color.b;break}}}else t=new Uint8Array(3*u).fill(255);if(d&&(s!=null&&s.colorModulation)){const o=s.colorModulation.minValue,a=s.colorModulation.maxValue,r=.3;for(let c=0;c=a?1:l<=o?r:r+(1-r)*(l-o)/(a-o);t[3*c]=f*t[3*c],t[3*c+1]=f*t[3*c+1],t[3*c+2]=f*t[3*c+2]}}return t}function M(n,e){if(n.encoding==null||n.encoding===""){const d=C(e,n);if(d.vertexAttributes.position==null)return;const u=k(e,d.vertexAttributes.position),i=d.header.fields,p=[i.offsetX,i.offsetY,i.offsetZ],t=[i.scaleX,i.scaleY,i.scaleZ],s=u.length/3,o=new Float64Array(3*s);for(let a=0;a>>4&15,b=f>1,w=l===1,y=l===f;let h=!1;for(const g of r.includedReturns)if(g==="last"&&y||g==="firstOfMany"&&w&&b||g==="lastOfMany"&&y&&b||g==="single"&&!b){h=!0;break}h||(o=!1);break}}}o&&(d[t]=s,n[3*t]=n[3*s],n[3*t+1]=n[3*s+1],n[3*t+2]=n[3*s+2],e[3*t]=e[3*s],e[3*t+1]=e[3*s+1],e[3*t+2]=e[3*s+2],t++)}return t}function m(n){switch(n){default:case null:case"none":return e=>e;case"low-four-bit":return e=>15&e;case"high-four-bit":return e=>(240&e)>>4;case"absolute-value":return e=>Math.abs(e);case"modulo-ten":return e=>e%10}}function v(n){let e=0;for(const d of n||[])e|=1<=o[l].value)t[3*r]=o[l].color.r,t[3*r+1]=o[l].color.g,t[3*r+2]=o[l].color.b;else for(let f=1;f=o[l].minValue&&c<=o[l].maxValue){t[3*r]=o[l].color.r,t[3*r+1]=o[l].color.g,t[3*r+2]=o[l].color.b;break}}}else t=new Uint8Array(3*u).fill(255);if(d&&(s!=null&&s.colorModulation)){const o=s.colorModulation.minValue,a=s.colorModulation.maxValue,r=.3;for(let c=0;c=a?1:l<=o?r:r+(1-r)*(l-o)/(a-o);t[3*c]=f*t[3*c],t[3*c+1]=f*t[3*c+1],t[3*c+2]=f*t[3*c+2]}}return t}function T(n,e){if(n.encoding==null||n.encoding===""){const d=k(e,n);if(d.vertexAttributes.position==null)return;const u=A(e,d.vertexAttributes.position),i=d.header.fields,p=[i.offsetX,i.offsetY,i.offsetZ],t=[i.scaleX,i.scaleY,i.scaleZ],s=u.length/3,o=new Float64Array(3*s);for(let a=0;a>>4&15,b=f>1,w=l===1,m=l===f;let h=!1;for(const g of r.includedReturns)if(g==="last"&&m||g==="firstOfMany"&&w&&b||g==="lastOfMany"&&m&&b||g==="single"&&!b){h=!0;break}h||(o=!1);break}}}o&&(d[t]=s,n[3*t]=n[3*s],n[3*t+1]=n[3*s+1],n[3*t+2]=n[3*s+2],e[3*t]=e[3*s],e[3*t+1]=e[3*s+1],e[3*t+2]=e[3*s+2],t++)}return t}function y(n){switch(n){default:case null:case"none":return e=>e;case"low-four-bit":return e=>15&e;case"high-four-bit":return e=>(240&e)>>4;case"absolute-value":return e=>Math.abs(e);case"modulo-ten":return e=>e%10}}function v(n){let e=0;for(const d of n||[])e|=1<e,this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),n&&(typeof n=="function"?this._toBBox=n:this._initFormat(n)),this.clear()}destroy(){this.clear(),_.prune(),X.prune(),d.prune(),Y.prune()}all(t){this._all(this._data,t)}search(t,n){let e=this._data;const i=this._toBBox;if(M(t,e))for(_.clear();e;){for(let s=0,a=e.children.length;s0;){if(e||(e=d.pop(),i=d.data[d.length-1],s=Y.pop()??0,a=!0),e.leaf&&(n=v(e.children,t,e.children.length,e.indexHint),n!==-1))return e.children.splice(n,1),d.push(e),this._condense(d),this;a||e.leaf||!S(e,r)?i?(s++,e=i.children[s],a=!1):e=null:(d.push(e),Y.push(s),s=0,i=e,e=e.children[0])}return this}toJSON(){return this._data}fromJSON(t){return this._data=t,this}_all(t,n){let e=t;for(X.clear();e;){if(e.leaf===!0)for(const i of e.children)n(i);else X.pushArray(e.children);e=X.pop()??null}}_build(t,n,e,i){const s=e-n+1;let a=this._maxEntries;if(s<=a){const l=new B(t.slice(n,e+1));return x(l,this._toBBox),l}i||(i=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/a**(i-1)));const r=new E([]);r.height=i;const o=Math.ceil(s/a),c=o*Math.ceil(Math.sqrt(a));R(t,n,e,c,this._compareMinX);for(let l=n;l<=e;l+=c){const m=Math.min(l+c-1,e);R(t,l,m,o,this._compareMinY);for(let u=l;u<=m;u+=o){const A=Math.min(u+o-1,m);r.children.push(this._build(t,u,A,i-1))}}return x(r,this._toBBox),r}_chooseSubtree(t,n,e,i){for(;i.push(n),n.leaf!==!0&&i.length-1!==e;){let s,a=1/0,r=1/0;for(let o=0,c=n.children.length;o=0&&d.data[n].children.length>this._maxEntries;)this._split(d,n),n--;this._adjustParentBBoxes(s,d,n)}_split(t,n){const e=t.data[n],i=e.children.length,s=this._minEntries;this._chooseSplitAxis(e,s,i);const a=this._chooseSplitIndex(e,s,i);if(!a)return void console.log(" Error: assertion failed at PooledRBush._split: no valid split index");const r=e.children.splice(a,e.children.length-a),o=e.leaf?new B(r):new E(r);o.height=e.height,x(e,this._toBBox),x(o,this._toBBox),n?t.data[n-1].children.push(o):this._splitRoot(e,o)}_splitRoot(t,n){this._data=new E([t,n]),this._data.height=t.height+1,x(this._data,this._toBBox)}_chooseSplitIndex(t,n,e){let i,s,a;i=s=1/0;for(let r=n;r<=e-n;r++){const o=f(t,0,r,this._toBBox),c=f(t,r,e,this._toBBox),l=I(o,c),m=b(o)+b(c);l=n;c--){const l=t.children[c];p(r,t.leaf?s(l):l),o+=g(r)}return o}_adjustParentBBoxes(t,n,e){for(let i=e;i>=0;i--)p(n.data[i],t)}_condense(t){for(let n=t.length-1;n>=0;n--){const e=t.data[n];if(e.children.length===0)if(n>0){const i=t.data[n-1],s=i.children;s.splice(v(s,e,s.length,i.indexHint),1)}else this.clear();else x(e,this._toBBox)}}_initFormat(t){const n=["return a"," - b",";"];this._compareMinX=new Function("a","b",n.join(t[0])),this._compareMinY=new Function("a","b",n.join(t[1])),this._toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}function x(h,t){f(h,0,h.children.length,t,h)}function f(h,t,n,e,i){i||(i=new B([])),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let s,a=t;a=h.minX&&t.maxY>=h.minY}function R(h,t,n,e,i){const s=[t,n];for(;s.length;){const a=s.pop(),r=s.pop();if(a-r<=e)continue;const o=r+Math.ceil((a-r)/e/2)*e;H(h,o,r,a,i),s.push(r,o,o,a)}}const _=new w,X=new w,d=new w,Y=new w({deallocator:void 0});class J{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}}class y extends J{constructor(){super(...arguments),this.height=1,this.indexHint=new D}}class B extends y{constructor(t){super(),this.children=t,this.leaf=!0}}class E extends y{constructor(t){super(),this.children=t,this.leaf=!1}}export{$ as s}; +import{aO as w,aP as v,aQ as A}from"./index-pCX-0tJH.js";import{f as D}from"./quickselect-0UUnLNDW.js";class ${constructor(t=9,n){this._compareMinX=F,this._compareMinY=j,this._toBBox=e=>e,this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),n&&(typeof n=="function"?this._toBBox=n:this._initFormat(n)),this.clear()}destroy(){this.clear(),_.prune(),X.prune(),d.prune(),Y.prune()}all(t){this._all(this._data,t)}search(t,n){let e=this._data;const i=this._toBBox;if(M(t,e))for(_.clear();e;){for(let s=0,a=e.children.length;s0;){if(e||(e=d.pop(),i=d.data[d.length-1],s=Y.pop()??0,a=!0),e.leaf&&(n=v(e.children,t,e.children.length,e.indexHint),n!==-1))return e.children.splice(n,1),d.push(e),this._condense(d),this;a||e.leaf||!S(e,r)?i?(s++,e=i.children[s],a=!1):e=null:(d.push(e),Y.push(s),s=0,i=e,e=e.children[0])}return this}toJSON(){return this._data}fromJSON(t){return this._data=t,this}_all(t,n){let e=t;for(X.clear();e;){if(e.leaf===!0)for(const i of e.children)n(i);else X.pushArray(e.children);e=X.pop()??null}}_build(t,n,e,i){const s=e-n+1;let a=this._maxEntries;if(s<=a){const l=new B(t.slice(n,e+1));return x(l,this._toBBox),l}i||(i=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/a**(i-1)));const r=new E([]);r.height=i;const o=Math.ceil(s/a),c=o*Math.ceil(Math.sqrt(a));P(t,n,e,c,this._compareMinX);for(let l=n;l<=e;l+=c){const m=Math.min(l+c-1,e);P(t,l,m,o,this._compareMinY);for(let u=l;u<=m;u+=o){const y=Math.min(u+o-1,m);r.children.push(this._build(t,u,y,i-1))}}return x(r,this._toBBox),r}_chooseSubtree(t,n,e,i){for(;i.push(n),n.leaf!==!0&&i.length-1!==e;){let s,a=1/0,r=1/0;for(let o=0,c=n.children.length;o=0&&d.data[n].children.length>this._maxEntries;)this._split(d,n),n--;this._adjustParentBBoxes(s,d,n)}_split(t,n){const e=t.data[n],i=e.children.length,s=this._minEntries;this._chooseSplitAxis(e,s,i);const a=this._chooseSplitIndex(e,s,i);if(!a)return void console.log(" Error: assertion failed at PooledRBush._split: no valid split index");const r=e.children.splice(a,e.children.length-a),o=e.leaf?new B(r):new E(r);o.height=e.height,x(e,this._toBBox),x(o,this._toBBox),n?t.data[n-1].children.push(o):this._splitRoot(e,o)}_splitRoot(t,n){this._data=new E([t,n]),this._data.height=t.height+1,x(this._data,this._toBBox)}_chooseSplitIndex(t,n,e){let i,s,a;i=s=1/0;for(let r=n;r<=e-n;r++){const o=f(t,0,r,this._toBBox),c=f(t,r,e,this._toBBox),l=O(o,c),m=b(o)+b(c);l=n;c--){const l=t.children[c];p(r,t.leaf?s(l):l),o+=g(r)}return o}_adjustParentBBoxes(t,n,e){for(let i=e;i>=0;i--)p(n.data[i],t)}_condense(t){for(let n=t.length-1;n>=0;n--){const e=t.data[n];if(e.children.length===0)if(n>0){const i=t.data[n-1],s=i.children;s.splice(v(s,e,s.length,i.indexHint),1)}else this.clear();else x(e,this._toBBox)}}_initFormat(t){const n=["return a"," - b",";"];this._compareMinX=new Function("a","b",n.join(t[0])),this._compareMinY=new Function("a","b",n.join(t[1])),this._toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}function x(h,t){f(h,0,h.children.length,t,h)}function f(h,t,n,e,i){i||(i=new B([])),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let s,a=t;a=h.minX&&t.maxY>=h.minY}function P(h,t,n,e,i){const s=[t,n];for(;s.length;){const a=s.pop(),r=s.pop();if(a-r<=e)continue;const o=r+Math.ceil((a-r)/e/2)*e;D(h,o,r,a,i),s.push(r,o,o,a)}}const _=new w,X=new w,d=new w,Y=new w({deallocator:void 0});class I{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}}class R extends I{constructor(){super(...arguments),this.height=1,this.indexHint=new A}}class B extends R{constructor(t){super(),this.children=t,this.leaf=!0}}class E extends R{constructor(t){super(),this.children=t,this.leaf=!1}}export{$ as s}; diff --git a/dist/assets/Popup-aRK3Vd3w.js b/dist/assets/Popup-a4-j6aRT.js similarity index 65% rename from dist/assets/Popup-aRK3Vd3w.js rename to dist/assets/Popup-a4-j6aRT.js index 204f4a7..69ec7b4 100644 --- a/dist/assets/Popup-aRK3Vd3w.js +++ b/dist/assets/Popup-a4-j6aRT.js @@ -1,8 +1,8 @@ -import{V as De,e as o,y as l,f6 as Te,S as ke,c as R,p as ce,d as f,P as H,E as k,li as Pt,kj as Ni,kM as Y,hl as Z,fl as Fe,hm as Re,de as E,hn as u,kN as I,oJ as Lt,vv as Ot,vw as Si,hw as Ae,kO as pe,vx as It,oK as di,oI as Di,vy as ci,c_ as Vt,Z as ie,gG as Bi,jG as Ce,rg as Wi,ca as it,eY as qi,bW as Hi,kq as vt,vz as ui,e3 as Ke,vA as zi,hy as oe,vB as ji,hv as Ui,vC as hi,vD as Qi,ma as Qe,vE as Gi,vF as pi,vG as Xi,vH as Nt,dq as Yi,m as mi,ao as st,ah as nt,n as Ki,mo as gi,f as Ji,vf as Be,vI as O,vJ as Zi,vb as es,vK as ye,nW as ts,vL as xe,vM as me,vN as St,vO as is,vP as Ie,bX as ss,F as yt,C as ns,pf as rs,vQ as os,lE as as,c7 as Dt,km as Bt,T as ls,d8 as Wt,vR as fi,vS as ds,um as qt,w as cs}from"./index-J0iiHjMT.js";import{l as us}from"./AttachmentInfo-kbEMEIl0.js";import{E as _i,x as Ge,C as vi,q as yi,d as we,D as be,P as Ht,z as zt,R as hs,v as wt,M as wi,Y as ps,a as Ft,o as At,T as ms,r as gs,i as jt,s as fs,J as _s,n as vs,c as ys,u as rt,h as ws,b as bs}from"./featureUtils-itZGjo5c.js";import{s as ot}from"./executeQueryJSON-ACj9qY0y.js";import"./pbf-o0zzptPp.js";import"./FeatureSet-d4S1oKME.js";import"./TopFeaturesQuery-E6D2tV-x.js";import Ms from"./FeatureLayer--S4epFk-.js";import{c as bi}from"./AnchorElementViewModel-SDYg-P9c.js";import{s as Is}from"./ReactiveSet-HLstcUcf.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./queryZScale-IaMm02_2.js";import"./FeatureLayerBase-jpFp8gE3.js";import"./serviceCapabilitiesUtils-26KpT1VN.js";import"./editsZScale-Wgw9kbYG.js";import"./CustomParametersMixin-Y1bOcayO.js";import"./FeatureEffectLayer-oBa8pIG5.js";import"./FeatureEffect-5bEV-xG1.js";import"./FeatureReductionLayer-RlitE1N6.js";import"./OrderedLayer-M7k5gLgx.js";import"./FeatureTemplate-kUgbbA00.js";import"./FeatureType-MpRe7WJj.js";import"./versionUtils-4v9zIDlv.js";const Ut={editing:!1,operations:{add:!0,update:!0,delete:!0}},Mi=De.ofType(us);let X=class extends ce{constructor(e){super(e),this._getAttachmentsPromise=null,this._attachmentLayer=null,this.capabilities={...Ut},this.activeAttachmentInfo=null,this.activeFileInfo=null,this.attachmentInfos=new Mi,this.fileInfos=new De,this.graphic=null,this.mode="view",this.filesEnabled=!1,this.addHandles(f(()=>this.graphic,()=>this._graphicChanged(),H))}destroy(){this._attachmentLayer=null,this.graphic=null}castCapabilities(e){return{...Ut,...e}}get state(){return this._getAttachmentsPromise?"loading":this.graphic?"ready":"disabled"}get supportsResizeAttachments(){const{graphic:e}=this;if(!e)return!1;const t=e.layer||e.sourceLayer;return(t==null?void 0:t.loaded)&&"capabilities"in t&&t.capabilities&&"operations"in t.capabilities&&"supportsResizeAttachments"in t.capabilities.operations&&t.capabilities.operations.supportsResizeAttachments||!1}async getAttachments(){const{_attachmentLayer:e,attachmentInfos:t}=this;if(!e||typeof e.queryAttachments!="function")throw new k("invalid-layer","getAttachments(): A valid layer is required.");const s=this._getObjectId(),n=new Pt({objectIds:[s],returnMetadata:!0}),r=[],a=e.queryAttachments(n).then(c=>c[s]||r).catch(()=>r);this._getAttachmentsPromise=a,this.notifyChange("state");const d=await a;return t.removeAll(),d.length&&t.addMany(d),this._getAttachmentsPromise=null,this.notifyChange("state"),d}async addAttachment(e,t=this.graphic){var c;const{_attachmentLayer:s,attachmentInfos:n,capabilities:r}=this;if(!t)throw new k("invalid-graphic","addAttachment(): A valid graphic is required.",{graphic:t});if(!e)throw new k("invalid-attachment","addAttachment(): An attachment is required.",{attachment:e});if(!((c=r.operations)!=null&&c.add))throw new k("invalid-capabilities","addAttachment(): add capabilities are required.");if(!s||typeof s.addAttachment!="function")throw new k("invalid-layer","addAttachment(): A valid layer is required.");const a=s.addAttachment(t,e).then(h=>this._queryAttachment(h.objectId,t)),d=await a;return n.add(d),d}async deleteAttachment(e){var c;const{_attachmentLayer:t,attachmentInfos:s,graphic:n,capabilities:r}=this;if(!e)throw new k("invalid-attachment-info","deleteAttachment(): An attachmentInfo is required.",{attachmentInfo:e});if(!((c=r.operations)!=null&&c.delete))throw new k("invalid-capabilities","deleteAttachment(): delete capabilities are required.");if(!t||typeof t.deleteAttachments!="function")throw new k("invalid-layer","deleteAttachment(): A valid layer is required.");if(!n)throw new k("invalid-graphic","deleteAttachment(): A graphic is required.");const a=t.deleteAttachments(n,[e.id]).then(()=>e),d=await a;return s.remove(d),d}async updateAttachment(e,t=this.activeAttachmentInfo){var p;const{_attachmentLayer:s,attachmentInfos:n,graphic:r,capabilities:a}=this;if(!e)throw new k("invalid-attachment","updateAttachment(): An attachment is required.",{attachment:e});if(!t)throw new k("invalid-attachment-info","updateAttachment(): An attachmentInfo is required.",{attachmentInfo:t});if(!((p=a.operations)!=null&&p.update))throw new k("invalid-capabilities","updateAttachment(): Update capabilities are required.");const d=n.indexOf(t);if(!s||typeof s.updateAttachment!="function")throw new k("invalid-layer","updateAttachment(): A valid layer is required.");if(!r)throw new k("invalid-graphic","updateAttachment(): A graphic is required.");const c=s.updateAttachment(r,t.id,e).then(m=>this._queryAttachment(m.objectId)),h=await c;return n.splice(d,1,h),h}async commitFiles(){return await Promise.all(this.fileInfos.items.map(e=>this.addAttachment(e.form))),this.fileInfos.removeAll(),this.getAttachments()}addFile(e,t){if(!e||!t)return null;const s={file:e,form:t};return this.fileInfos.add(s),s}updateFile(e,t,s=this.activeFileInfo){if(!e||!t||!s)return null;const n=this.fileInfos.indexOf(s);return n>-1&&this.fileInfos.splice(n,1,{file:e,form:t}),this.fileInfos.items[n]}deleteFile(e){const t=this.fileInfos.find(s=>s.file===e);return t?(this.fileInfos.remove(t),t):null}async _queryAttachment(e,t){const{_attachmentLayer:s}=this;if(!e||!(s!=null&&s.queryAttachments))throw new k("invalid-attachment-id","Could not query attachment.");const n=this._getObjectId(t),r=new Pt({objectIds:[n],attachmentsWhere:`AttachmentId=${e}`,returnMetadata:!0});return s.queryAttachments(r).then(a=>a[n][0])}_getObjectId(e=this.graphic){return(e==null?void 0:e.getObjectId())??null}_graphicChanged(){this.graphic&&(this._setAttachmentLayer(),this.getAttachments().catch(()=>{}))}_setAttachmentLayer(){const{graphic:e}=this,t=_i(e);this._attachmentLayer=t?t.type==="scene"&&t.associatedLayer!=null?t.associatedLayer:t:null}};o([l()],X.prototype,"capabilities",void 0),o([Te("capabilities")],X.prototype,"castCapabilities",null),o([l()],X.prototype,"activeAttachmentInfo",void 0),o([l()],X.prototype,"activeFileInfo",void 0),o([l({readOnly:!0,type:Mi})],X.prototype,"attachmentInfos",void 0),o([l()],X.prototype,"fileInfos",void 0),o([l({type:ke})],X.prototype,"graphic",void 0),o([l()],X.prototype,"mode",void 0),o([l({readOnly:!0})],X.prototype,"state",null),o([l()],X.prototype,"filesEnabled",void 0),o([l({readOnly:!0})],X.prototype,"supportsResizeAttachments",null),X=o([R("esri.widgets.Attachments.AttachmentsViewModel")],X);const Ct=X;function Qt(i){const e=i.toLowerCase();return e==="image/bmp"||e==="image/emf"||e==="image/exif"||e==="image/gif"||e==="image/x-icon"||e==="image/jpeg"||e==="image/png"||e==="image/tiff"||e==="image/x-wmf"}function Fs(i){const e=Ni("esri/themes/base/images/files/");return i?i==="text/plain"?`${e}text-32.svg`:i==="application/pdf"?`${e}pdf-32.svg`:i==="text/csv"?`${e}csv-32.svg`:i==="application/gpx+xml"?`${e}gpx-32.svg`:i==="application/x-dwf"?`${e}cad-32.svg`:i==="application/postscript"||i==="application/json"||i==="text/xml"||i==="model/vrml"?`${e}code-32.svg`:i==="application/x-zip-compressed"||i==="application/x-7z-compressed"||i==="application/x-gzip"||i==="application/x-tar"||i==="application/x-gtar"||i==="application/x-bzip2"||i==="application/gzip"||i==="application/x-compress"||i==="application/x-apple-diskimage"||i==="application/x-rar-compressed"||i==="application/zip"?`${e}zip-32.svg`:i.includes("image/")?`${e}image-32.svg`:i.includes("audio/")?`${e}sound-32.svg`:i.includes("video/")?`${e}video-32.svg`:i.includes("msexcel")||i.includes("ms-excel")||i.includes("spreadsheetml")?`${e}excel-32.svg`:i.includes("msword")||i.includes("ms-word")||i.includes("wordprocessingml")?`${e}word-32.svg`:i.includes("powerpoint")||i.includes("presentationml")?`${e}report-32.svg`:`${e}generic-32.svg`:`${e}generic-32.svg`}const Gt={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},C="esri-attachments",y={base:C,loaderContainer:`${C}__loader-container`,loader:`${C}__loader`,fadeIn:`${C}--fade-in`,container:`${C}__container`,containerList:`${C}__container--list`,containerPreview:`${C}__container--preview`,actions:`${C}__actions`,deleteButton:`${C}__delete-button`,addAttachmentButton:`${C}__add-attachment-button`,errorMessage:`${C}__error-message`,items:`${C}__items`,item:`${C}__item`,itemButton:`${C}__item-button`,itemMask:`${C}__item-mask`,itemMaskIcon:`${C}__item-mask--icon`,itemImage:`${C}__image`,itemImageResizable:`${C}__image--resizable`,itemLabel:`${C}__label`,itemFilename:`${C}__filename`,itemChevronIcon:`${C}__item-chevron-icon`,itemLink:`${C}__item-link`,itemLinkOverlay:`${C}__item-link-overlay`,itemLinkOverlayIcon:`${C}__item-link-overlay-icon`,itemEditIcon:`${C}__item-edit-icon`,itemAddIcon:`${C}__item-add-icon`,itemAddButton:`${C}__item-add-button`,formNode:`${C}__form-node`,fileFieldset:`${C}__file-fieldset`,fileLabel:`${C}__file-label`,fileName:`${C}__file-name`,fileInput:`${C}__file-input`,metadata:`${C}__metadata`,metadataFieldset:`${C}__metadata-fieldset`,progressBar:`${C}__progress-bar`},at=window.CSS;let j=class extends Z{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...Gt},this._supportsImageOrientation=at&&at.supports&&at.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}normalizeCtorArgs(e){return e!=null&&e.viewModel||(e={viewModel:new Ct,...e}),e}initialize(){this.addHandles([Fe(()=>{var e;return(e=this.viewModel)==null?void 0:e.attachmentInfos},"change",()=>this.scheduleRender()),Fe(()=>{var e;return(e=this.viewModel)==null?void 0:e.fileInfos},"change",()=>this.scheduleRender()),f(()=>{var e;return(e=this.viewModel)==null?void 0:e.mode},()=>this._modeChanged(),H)])}loadDependencies(){return Re({icon:()=>E(()=>import("./calcite-icon-itD416se.js"),__vite__mapDeps([0,1,2,3,4]))})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&e!=="auto"?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...Gt,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:t}=this;return this._set("submitting",!0),this._set("error",null),t.addAttachment(e).then(s=>(this._set("submitting",!1),this._set("error",null),t.mode="view",s)).catch(s=>{throw this._set("submitting",!1),this._set("error",new k("attachments:add-attachment",this.messages.addErrorMessage,s)),s})}deleteAttachment(e){const{viewModel:t}=this;return this._set("submitting",!0),this._set("error",null),t.deleteAttachment(e).then(s=>(this._set("submitting",!1),this._set("error",null),t.mode="view",s)).catch(s=>{throw this._set("submitting",!1),this._set("error",new k("attachments:delete-attachment",this.messages.deleteErrorMessage,s)),s})}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:t}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(t).then(s=>(this._set("submitting",!1),this._set("error",null),e.mode="view",s)).catch(s=>{throw this._set("submitting",!1),this._set("error",new k("attachments:update-attachment",this.messages.updateErrorMessage,s)),s})}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){var s;const t=this.viewModel.deleteFile(e||((s=this.viewModel.activeFileInfo)==null?void 0:s.file));return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return u("div",{class:this.classes(y.base,I.widget)},e?this._renderProgressBar():null,s==="loading"?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?u("div",{class:y.errorMessage,key:"error-message"},e.message):null}_renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return t==="add"?this._renderAddForm():t==="edit"?this._renderDetailsForm(s||e):this._renderAttachmentContainer()}_renderLoading(){return u("div",{class:y.loaderContainer,key:"loader"},u("div",{class:y.loader}))}_renderProgressBar(){return this.visibleElements.progressBar?u("div",{class:y.progressBar,key:"progress-bar"}):null}_renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,n=this.visibleElements.cancelAddButton?u("button",{bind:this,class:this.classes(I.button,I.buttonTertiary,I.buttonSmall,I.buttonHalf,e&&I.buttonDisabled),disabled:e,onclick:this._cancelForm,type:"button"},this.messages.cancel):null,r=this.visibleElements.addSubmitButton?u("button",{class:this.classes(I.button,I.buttonSecondary,I.buttonSmall,I.buttonHalf,{[I.buttonDisabled]:s}),disabled:s,type:"submit"},this.messages.add):null,a=t?u("span",{class:y.fileName,key:"file-name"},t.name):null,d=u("form",{afterCreate:Lt,afterRemoved:Ot,bind:this,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},u("fieldset",{class:y.fileFieldset},a,u("label",{class:this.classes(y.fileLabel,I.button,I.buttonSecondary)},t?this.messages.changeFile:this.messages.selectFile,u("input",{bind:this,class:y.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))),r,n);return u("div",{class:y.formNode,key:"add-form-container"},d)}_renderDetailsForm(e){var V,se,K;const{visibleElements:t,viewModel:s,selectedFile:n,submitting:r}=this,{capabilities:a}=s,d=r||!n;let c,h,p,m;n?(c=n.type,h=n.name,p=n.size):e&&"file"in e?(c=e.file.type,h=e.file.name,p=e.file.size):e&&"contentType"in e&&(c=e.contentType,h=e.name,p=e.size,m=e.url);const g=a.editing&&((V=a.operations)!=null&&V.delete)&&t.deleteButton?u("button",{bind:this,class:this.classes(I.button,I.buttonSmall,I.buttonTertiary,y.deleteButton,{[I.buttonDisabled]:r}),disabled:r,key:"delete-button",onclick:ee=>this._submitDeleteAttachment(ee,e),type:"button"},this.messages.delete):void 0,_=a.editing&&((se=a.operations)!=null&&se.update)&&t.updateButton?u("button",{class:this.classes(I.button,I.buttonSmall,I.buttonThird,{[I.buttonDisabled]:d}),disabled:d,key:"update-button",type:"submit"},this.messages.update):void 0,v=this.visibleElements.cancelUpdateButton?u("button",{bind:this,class:this.classes(I.button,I.buttonSmall,I.buttonTertiary,I.buttonThird,{[I.buttonDisabled]:r}),disabled:r,key:"cancel-button",onclick:this._cancelForm,type:"button"},this.messages.cancel):void 0,w=a.editing&&((K=a.operations)!=null&&K.update)?u("fieldset",{class:y.fileFieldset,key:"file"},u("span",{class:y.fileName,key:"file-name"},h),u("label",{class:this.classes(y.fileLabel,I.button,I.buttonSecondary)},this.messages.changeFile,u("input",{bind:this,class:y.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))):void 0,A=u("fieldset",{class:y.metadataFieldset,key:"size"},u("label",null,Si(this.messagesUnits,p??0))),b=u("fieldset",{class:y.metadataFieldset,key:"content-type"},u("label",null,c)),T=m!=null?u("a",{class:y.itemLink,href:m,rel:"noreferrer",target:"_blank"},this._renderImageMask(e,400),u("div",{class:y.itemLinkOverlay},u("span",{class:y.itemLinkOverlayIcon},u("calcite-icon",{icon:"launch"})))):this._renderImageMask(e,400),L=u("form",{afterCreate:Lt,afterRemoved:Ot,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:ee=>this._submitUpdateAttachment(ee,e)},u("div",{class:y.metadata},A,b),w,u("div",{class:y.actions},g,v,_));return u("div",{class:y.formNode,key:"edit-form-container"},T,L)}_renderImageMask(e,t){return e?"file"in e?this._renderGenericImageMask(e.file.name,e.file.type):this._renderImageMaskForAttachment(e,t):null}_renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,n=Fs(t),r={[y.itemImageResizable]:s};return u("div",{class:this.classes(y.itemMaskIcon,y.itemMask),key:n},u("img",{alt:e,class:this.classes(r,y.itemImage),src:n,title:e}))}_renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:n,name:r,url:a}=e;if(!s||!Qt(n))return this._renderGenericImageMask(r,n);const d=this._getCSSTransform(e),c=d?{transform:d,"image-orientation":"none"}:{},h=`${a}${a!=null&&a.includes("?")?"&":"?"}w=${t}`,p={[y.itemImageResizable]:s};return u("div",{class:this.classes(y.itemMask),key:h},u("img",{alt:r,class:this.classes(p,y.itemImage),src:h,styles:c,title:r}))}_renderFile(e){const{file:t}=e;return u("li",{class:y.item,key:t},u("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:y.itemButton,key:"details-button",onclick:()=>this._startEditFile(e),title:this.messages.attachmentDetails,type:"button"},this._renderImageMask(e),u("label",{class:y.itemLabel},u("span",{class:y.itemFilename},t.name||this.messages.noTitle),u("span",{"aria-hidden":"true",class:this.classes(y.itemChevronIcon,Ae(this.container)?pe.left:pe.right)}))))}_renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:n}=this,{capabilities:r,supportsResizeAttachments:a}=s,{contentType:d,name:c,url:h}=e,p=this._renderImageMask(e,t==="list"?48:400),m=r.editing?u("span",{"aria-hidden":"true",class:this.classes(y.itemChevronIcon,Ae(this.container)?pe.left:pe.right)}):null,g=[p,n==="preview"&&a&&Qt(d)?null:u("label",{class:y.itemLabel},u("span",{class:y.itemFilename},c||this.messages.noTitle),m)],_=r.editing?u("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:y.itemButton,"data-attachment-info-id":e.id,key:"details-button",onclick:()=>this._startEditAttachment(e),title:this.messages.attachmentDetails,type:"button"},g):u("a",{class:y.itemButton,href:h??void 0,key:"details-link",target:"_blank"},g);return u("li",{class:y.item,key:e},_)}_renderAttachmentContainer(){var v;const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:n,capabilities:r,fileInfos:a}=t,d=!!(n!=null&&n.length),c=!!(a!=null&&a.length),h={[y.containerList]:e!=="preview",[y.containerPreview]:e==="preview"},p=r.editing&&((v=r.operations)!=null&&v.add)&&s.addButton?u("button",{bind:this,class:this.classes(I.button,I.buttonTertiary,y.addAttachmentButton),onclick:()=>this._startAddAttachment(),type:"button"},u("span",{"aria-hidden":"true",class:this.classes(y.itemAddIcon,pe.plus)}),this.messages.add):void 0,m=d?u("ul",{class:y.items,key:"attachments-list"},n.toArray().map(w=>this._renderAttachmentInfo({attachmentInfo:w,displayType:e}))):void 0,g=c?u("ul",{class:y.items,key:"file-list"},a.toArray().map(w=>this._renderFile(w))):void 0,_=c||d?void 0:u("div",{class:I.empty},this.messages.noAttachments);return u("div",{class:this.classes(y.container,h),key:"attachments-container"},m,g,_,p)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){var n;const t=e.target,s=(n=t.files)==null?void 0:n.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};o([l()],j.prototype,"capabilities",null),o([l()],j.prototype,"displayType",void 0),o([l({readOnly:!0})],j.prototype,"effectiveDisplayType",null),o([l()],j.prototype,"graphic",null),o([l()],j.prototype,"label",null),o([l(),Y("esri/widgets/Attachments/t9n/Attachments")],j.prototype,"messages",void 0),o([l(),Y("esri/core/t9n/Units")],j.prototype,"messagesUnits",void 0),o([l({readOnly:!0})],j.prototype,"selectedFile",void 0),o([l({readOnly:!0})],j.prototype,"submitting",void 0),o([l({readOnly:!0})],j.prototype,"error",void 0),o([l({type:Ct})],j.prototype,"viewModel",void 0),o([l()],j.prototype,"visibleElements",void 0),o([Te("visibleElements")],j.prototype,"castVisibleElements",null),j=o([R("esri.widgets.Attachments")],j);const As=j;let Oe=class extends Ct{constructor(e){super(e),this.description=null,this.title=null}};o([l()],Oe.prototype,"description",void 0),o([l()],Oe.prototype,"title",void 0),Oe=o([R("esri.widgets.Feature.FeatureAttachments.FeatureAttachmentsViewModel")],Oe);const Et=Oe,lt="esri-feature-element-info",dt={base:lt,title:`${lt}__title`,description:`${lt}__description`};let Ee=class extends Z{constructor(e,t){super(e,t),this.description=null,this.headingLevel=2,this.title=null}render(){return u("div",{class:dt.base},this._renderTitle(),this._renderDescription())}_renderTitle(){const{title:e}=this;return e?u(It,{class:dt.title,level:this.headingLevel},e):null}_renderDescription(){const{description:e}=this;return e?u("div",{class:dt.description,key:"description"},e):null}};o([l()],Ee.prototype,"description",void 0),o([l()],Ee.prototype,"headingLevel",void 0),o([l()],Ee.prototype,"title",void 0),Ee=o([R("esri.widgets.Feature.support.FeatureElementInfo")],Ee);const Je=Ee,Cs={base:"esri-feature-attachments"};let re=class extends Z{constructor(e,t){super(e,t),this._featureElementInfo=null,this.attachmentsWidget=new As,this.headingLevel=2,this.viewModel=new Et}initialize(){this._featureElementInfo=new Je,this.addHandles([f(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.description,(t=this.viewModel)==null?void 0:t.title,this.headingLevel]},()=>this._setupFeatureElementInfo(),H),f(()=>this.viewModel,e=>this.attachmentsWidget.viewModel=e,H)])}destroy(){var e;this.attachmentsWidget.viewModel=null,this.attachmentsWidget.destroy(),(e=this._featureElementInfo)==null||e.destroy()}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get displayType(){return this.attachmentsWidget.displayType}set displayType(e){this.attachmentsWidget.displayType=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){var t;const{attachmentsWidget:e}=this;return u("div",{class:Cs.base},(t=this._featureElementInfo)==null?void 0:t.render(),e==null?void 0:e.render())}_setupFeatureElementInfo(){var n;const{description:e,title:t,headingLevel:s}=this;(n=this._featureElementInfo)==null||n.set({description:e,title:t,headingLevel:s})}};o([l({readOnly:!0})],re.prototype,"attachmentsWidget",void 0),o([l()],re.prototype,"description",null),o([l()],re.prototype,"displayType",null),o([l()],re.prototype,"graphic",null),o([l()],re.prototype,"headingLevel",void 0),o([l()],re.prototype,"title",null),o([l({type:Et})],re.prototype,"viewModel",void 0),re=o([R("esri.widgets.Feature.FeatureAttachments")],re);const Es=re;let he=class extends ce{constructor(e){super(e),this._loadingPromise=null,this.created=null,this.creator=null,this.destroyer=null,this.graphic=null,this.addHandles(f(()=>this.creator,t=>{this._destroyContent(),this._createContent(t)},H))}destroy(){this._destroyContent()}get state(){return this._loadingPromise?"loading":"ready"}_destroyContent(){const{created:e,graphic:t,destroyer:s}=this;e&&t&&(Ge(s,{graphic:t}).catch(()=>null),this._set("created",null))}async _createContent(e){const t=this.graphic;if(!t||!e)return;const s=Ge(e,{graphic:t}).catch(()=>null);this._loadingPromise=s,this.notifyChange("state");const n=await s;s===this._loadingPromise&&(this._loadingPromise=null,this.notifyChange("state"),this._set("created",n))}};o([l({readOnly:!0})],he.prototype,"created",void 0),o([l()],he.prototype,"creator",void 0),o([l()],he.prototype,"destroyer",void 0),o([l({type:ke})],he.prototype,"graphic",void 0),o([l({readOnly:!0})],he.prototype,"state",null),he=o([R("esri.widgets.Feature.FeatureContent.FeatureContentViewModel")],he);const Xe=he,ct="esri-feature-content",ut={base:ct,loaderContainer:`${ct}__loader-container`,loader:`${ct}__loader`};let $e=class extends Z{constructor(e,t){super(e,t),this.viewModel=null,this._addTargetToAnchors=s=>{Array.from(s.querySelectorAll("a")).forEach(n=>{vi(n.href)&&!n.hasAttribute("target")&&n.setAttribute("target","_blank")})}}get creator(){var e;return(e=this.viewModel)==null?void 0:e.creator}set creator(e){this.viewModel&&(this.viewModel.creator=e)}get graphic(){var e;return(e=this.viewModel)==null?void 0:e.graphic}set graphic(e){this.viewModel&&(this.viewModel.graphic=e)}render(){var t;const e=(t=this.viewModel)==null?void 0:t.state;return u("div",{class:ut.base},e==="loading"?this._renderLoading():this._renderCreated())}_renderLoading(){return u("div",{class:ut.loaderContainer,key:"loader"},u("div",{class:ut.loader}))}_renderCreated(){var t;const e=(t=this.viewModel)==null?void 0:t.created;return e?e instanceof HTMLElement?u("div",{afterCreate:this._attachToNode,bind:e,key:e}):di(e)?u("div",{key:e},!e.destroyed&&e.render()):u("div",{afterCreate:this._addTargetToAnchors,innerHTML:e,key:e}):null}_attachToNode(e){const t=this;e.appendChild(t)}};o([l()],$e.prototype,"creator",null),o([l()],$e.prototype,"graphic",null),o([l({type:Xe})],$e.prototype,"viewModel",void 0),$e=o([R("esri.widgets.Feature.FeatureContent")],$e);const He=$e;let le=class extends ce{constructor(e){super(e),this.attributes=null,this.expressionInfos=null,this.description=null,this.fieldInfos=null,this.title=null}get formattedFieldInfos(){const{expressionInfos:e,fieldInfos:t}=this,s=[];return t==null||t.forEach(n=>{if(!(!n.hasOwnProperty("visible")||n.visible))return;const r=n.clone();r.label=yi(r,e),s.push(r)}),s}};o([l()],le.prototype,"attributes",void 0),o([l({type:[Di]})],le.prototype,"expressionInfos",void 0),o([l()],le.prototype,"description",void 0),o([l({type:[ci]})],le.prototype,"fieldInfos",void 0),o([l({readOnly:!0})],le.prototype,"formattedFieldInfos",null),o([l()],le.prototype,"title",void 0),le=o([R("esri.widgets.Feature.FeatureFields.FeatureFieldsViewModel")],le);const Ze=le,$s=[{pattern:/^\s*(https?:\/\/([^\s]+))\s*$/i,target:"_blank",label:"{messages.view}"},{pattern:/^\s*(tel:([^\s]+))\s*$/i,label:"{hierPart}"},{pattern:/^\s*(mailto:([^\s]+))\s*$/i,label:"{hierPart}"},{pattern:/^\s*(arcgis-appstudio-player:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"App Studio Player"},{pattern:/^\s*(arcgis-collector:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Collector"},{pattern:/^\s*(arcgis-explorer:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Explorer"},{pattern:/^\s*(arcgis-navigator:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Navigator"},{pattern:/^\s*(arcgis-survey123:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Survey123"},{pattern:/^\s*(arcgis-trek2there:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Trek2There"},{pattern:/^\s*(arcgis-workforce:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Workforce"},{pattern:/^\s*(iform:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"iForm"},{pattern:/^\s*(flow:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"FlowFinity"},{pattern:/^\s*(lfmobile:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Laserfische"},{pattern:/^\s*(mspbi:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Microsoft Power Bi"}];function xs(i){let e=null;return $s.some(t=>(t.pattern.test(i)&&(e=t),!!e)),e}function Ts(i,e){if(typeof e!="string"||!e)return e;const t=xs(e);if(!t)return e;const s=e.match(t.pattern),n=s&&s[2],r=Vt(Vt(t.label,{messages:i,hierPart:n}),{appName:t.appName}),a=t.target?` target="${t.target}"`:"",d=t.target==="_blank"?' rel="noreferrer"':"";return e.replace(t.pattern,`${r}`)}const We="esri-feature-fields",qe={base:We,fieldHeader:`${We}__field-header`,fieldData:`${We}__field-data`,fieldDataDate:`${We}__field-data--date`};let ne=class extends Z{constructor(e,t){super(e,t),this._featureElementInfo=null,this.viewModel=new Ze,this.messages=null,this.messagesURIUtils=null}initialize(){this._featureElementInfo=new Je,this.addHandles(f(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.description,(t=this.viewModel)==null?void 0:t.title]},()=>this._setupFeatureElementInfo(),H))}destroy(){var e;(e=this._featureElementInfo)==null||e.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get expressionInfos(){return this.viewModel.expressionInfos}set expressionInfos(e){this.viewModel.expressionInfos=e}get fieldInfos(){return this.viewModel.fieldInfos}set fieldInfos(e){this.viewModel.fieldInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){var e;return u("div",{class:qe.base},(e=this._featureElementInfo)==null?void 0:e.render(),this._renderFields())}_renderFieldInfo(e,t){const{attributes:s}=this.viewModel,n=e.fieldName,r=e.label||n,a=s?s[n]==null?"":s[n]:"",d=!(!e.format||!e.format.dateFormat),c=typeof a=="number"&&!d?this._forceLTR(a):Ts(this.messagesURIUtils,a),h={[qe.fieldDataDate]:d};return u("tr",{key:`fields-element-info-row-${n}-${t}`},u("th",{class:qe.fieldHeader,innerHTML:r,key:`fields-element-info-row-header-${n}-${t}`}),u("td",{class:this.classes(qe.fieldData,h),innerHTML:c,key:`fields-element-info-row-data-${n}-${t}`}))}_renderFields(){const{formattedFieldInfos:e}=this.viewModel;return e!=null&&e.length?u("table",{class:I.table,summary:this.messages.fieldsSummary},u("tbody",null,e.map((t,s)=>this._renderFieldInfo(t,s)))):null}_setupFeatureElementInfo(){var s;const{description:e,title:t}=this;(s=this._featureElementInfo)==null||s.set({description:e,title:t})}_forceLTR(e){return`‎${e}`}};o([l()],ne.prototype,"attributes",null),o([l()],ne.prototype,"description",null),o([l()],ne.prototype,"expressionInfos",null),o([l()],ne.prototype,"fieldInfos",null),o([l()],ne.prototype,"title",null),o([l({type:Ze,nonNullable:!0})],ne.prototype,"viewModel",void 0),o([l(),Y("esri/widgets/Feature/t9n/Feature")],ne.prototype,"messages",void 0),o([l(),Y("esri/widgets/support/t9n/uriUtils")],ne.prototype,"messagesURIUtils",void 0),ne=o([R("esri.widgets.Feature.FeatureFields")],ne);const Ii=ne,ks=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,Rs="esri.widgets.Feature.support.relatedFeatureUtils",Xt=ie.getLogger(Rs),Yt=new Map;function ze(i){if(!we(i))return null;const[e,t]=i.split("/").slice(1);return{layerId:e,fieldName:t}}function Ps(i,e){if(!e.relationships)return null;let t=null;const{relationships:s}=e;return s.some(n=>n.id===parseInt(i,10)&&(t=n,!0)),t}function Ls({originRelationship:i,relationships:e,layerId:t}){let s=null;return e&&e.some(n=>(`${n.relatedTableId}`===t&&n.id===(i==null?void 0:i.id)&&(s=n),!!s)),s}function Os(i,e){const t=e.toLowerCase();for(const s in i)if(s.toLowerCase()===t)return i[s];return null}function Vs(i,e){const t=Ps(i,e);if(t)return{url:`${e.url}/${t.relatedTableId}`,sourceSpatialReference:e.spatialReference,relation:t,relatedFields:[],outStatistics:[]}}function Ns(i,e){if(!e||!i)return;const{features:t,statsFeatures:s}=i,n=t==null?void 0:t.value;e.relatedFeatures=n?n.features:[];const r=s==null?void 0:s.value;e.relatedStatsFeatures=r?r.features:[]}function Ss(i,e,t,s){var r;const n=new vt;return n.outFields=["*"],n.relationshipId=typeof e.id=="number"?e.id:parseInt(e.id,10),n.objectIds=[i.attributes[t.objectIdField]],((r=t.queryRelatedFeatures)==null?void 0:r.call(t,n,s))??Promise.resolve({})}function Ds(i,e,t){let s=0;const n=[];for(;sJSON.stringify(e.toJSON())===JSON.stringify(t.toJSON())):void 0}async function qs(i,e,t,s){const n=t.layerId.toString(),{layerInfo:r,relation:a,relatedFields:d,outStatistics:c,url:h,sourceSpatialReference:p}=e,m=Bs(d),g=Ws(c);if(!r||!a)return null;const _=Ls({originRelationship:a,relationships:r.relationships,layerId:n});if(_!=null&&_.relationshipTableId&&_.keyFieldInRelationshipTable){const w=(await Ss(i,_,t,s))[i.attributes[t.objectIdField]];if(!w)return null;const A=w.features.map(b=>b.attributes[r.objectIdField]);if(g!=null&&g.length&&r.supportsStatistics){const b=new it;b.where=Ds(r.objectIdField,A,1e3),b.outFields=m,b.outStatistics=g,b.sourceSpatialReference=p;const T={features:Promise.resolve(w),statsFeatures:ot(h,b)};return Ce(T)}}const v=_==null?void 0:_.keyField;if(v){const w=qi(Qs(r.fields,v)),A=Os(i.attributes,a.keyField),b=w?`${v}=${A}`:`${v}='${A}'`,T=ot(h,new it({where:b,outFields:m,sourceSpatialReference:p}),s),L=g!=null&&g.length&&r.supportsStatistics?ot(h,new it({where:b,outFields:m,outStatistics:g,sourceSpatialReference:p}),s):null,V={features:T};return L&&(V.statsFeatures=L),Ce(V)}return null}function Hs(i,e){return Hi(i,{query:{f:"json"},signal:e==null?void 0:e.signal})}function zs({relatedInfos:i,layer:e},t){const s={};return i.forEach((n,r)=>{const{relation:a}=n;if(!a){const m=new k("relation-required","A relation is required on a layer to retrieve related records.");throw Xt.error(m),m}const{relatedTableId:d}=a;if(typeof d!="number"){const m=new k("A related table ID is required on a layer to retrieve related records.");throw Xt.error(m),m}const c=`${e.url}/${d}`,h=Yt.get(c),p=h??Hs(c);h||Yt.set(c,p),s[r]=p}),Bi(Ce(s),t)}function js({graphic:i,relatedInfos:e,layer:t},s){const n={};return e.forEach((r,a)=>{r.layerInfo&&(n[a]=qs(i,r,t,s))}),Ce(n)}function Us({relatedInfo:i,fieldName:e,fieldInfo:t}){var s,n;if((s=i.relatedFields)==null||s.push(e),t.statisticType){const r=new Wi({statisticType:t.statisticType,onStatisticField:e,outStatisticFieldName:e});(n=i.outStatistics)==null||n.push(r)}}function Qs(i,e){if(i!=null){e=e.toLowerCase();for(const t of i)if(t&&t.name.toLowerCase()===e)return t}return null}const Kt={chartAnimation:!0};let D=class extends ce{constructor(e){super(e),this.abilities={...Kt},this.activeMediaInfoIndex=0,this.attributes=null,this.description=null,this.fieldInfoMap=null,this.formattedAttributes=null,this.expressionAttributes=null,this.isAggregate=!1,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null}castAbilities(e){return{...Kt,...e}}get activeMediaInfo(){return this.formattedMediaInfos[this.activeMediaInfoIndex]||null}get formattedMediaInfos(){return this._formatMediaInfos()||[]}get formattedMediaInfoCount(){return this.formattedMediaInfos.length}setActiveMedia(e){this._setContentElementMedia(e)}next(){this._pageContentElementMedia(1)}previous(){this._pageContentElementMedia(-1)}_setContentElementMedia(e){const{formattedMediaInfoCount:t}=this,s=(e+t)%t;this.activeMediaInfoIndex=s}_pageContentElementMedia(e){const{activeMediaInfoIndex:t}=this,s=t+e;this._setContentElementMedia(s)}_formatMediaInfos(){const{mediaInfos:e,layer:t}=this,s=this.attributes??{},n=this.formattedAttributes??{},r=this.expressionAttributes??{},a=this.fieldInfoMap??new Map;return(e==null?void 0:e.map(d=>{const c=d==null?void 0:d.clone();if(!c)return null;if(c.title=be({attributes:s,fieldInfoMap:a,globalAttributes:n,expressionAttributes:r,layer:t,text:c.title}),c.caption=be({attributes:s,fieldInfoMap:a,globalAttributes:n,expressionAttributes:r,layer:t,text:c.caption}),c.altText=be({attributes:s,fieldInfoMap:a,globalAttributes:n,expressionAttributes:r,layer:t,text:c.altText}),c.type==="image"){const{value:h}=c;return this._setImageValue({value:h,formattedAttributes:n,layer:t}),c.value.sourceURL?c:void 0}if(c.type==="pie-chart"||c.type==="line-chart"||c.type==="column-chart"||c.type==="bar-chart"){const{value:h}=c;return this._setChartValue({value:h,chartType:c.type,attributes:s,formattedAttributes:n,layer:t,expressionAttributes:r}),c}return null}).filter(Ke))??[]}_setImageValue(e){const t=this.fieldInfoMap??new Map,{value:s,formattedAttributes:n,layer:r}=e,{linkURL:a,sourceURL:d}=s;if(d){const c=Ht(d,r);s.sourceURL=zt({formattedAttributes:n,template:c,fieldInfoMap:t})}if(a){const c=Ht(a,r);s.linkURL=zt({formattedAttributes:n,template:c,fieldInfoMap:t})}}_setChartValue(e){const{value:t,attributes:s,formattedAttributes:n,chartType:r,layer:a,expressionAttributes:d}=e,{popupTemplate:c,relatedInfos:h}=this,{fields:p,normalizeField:m}=t,g=a;if(t.fields=hs(p,g),m&&(t.normalizeField=wt(m,g)),!p.some(v=>!!(n[v]!=null||we(v)&&(h!=null&&h.size))))return;const _=(c==null?void 0:c.fieldInfos)??[];p.forEach((v,w)=>{var T;const A=(T=t.colors)==null?void 0:T[w];if(we(v))return void(t.series=[...t.series,...this._getRelatedChartInfos({fieldInfos:_,fieldName:v,formattedAttributes:n,chartType:r,value:t,color:A})]);const b=this._getChartOption({value:t,attributes:s,chartType:r,formattedAttributes:n,expressionAttributes:d,fieldName:v,fieldInfos:_,color:A});t.series.push(b)})}_getRelatedChartInfos(e){var v;const{fieldInfos:t,fieldName:s,formattedAttributes:n,chartType:r,value:a,color:d}=e,c=[],h=ze(s),p=h&&((v=this.relatedInfos)==null?void 0:v.get(h.layerId.toString()));if(!p)return c;const{relatedFeatures:m,relation:g}=p;if(!g||!m)return c;const{cardinality:_}=g;return m.forEach(w=>{const{attributes:A}=w;A&&Object.keys(A).forEach(b=>{b===h.fieldName&&c.push(this._getChartOption({value:a,attributes:A,formattedAttributes:n,fieldName:s,chartType:r,relatedFieldName:b,hasMultipleRelatedFeatures:(m==null?void 0:m.length)>1,fieldInfos:t,color:d}))})}),_==="one-to-many"||_==="many-to-many"?c:[c[0]]}_getTooltip({label:e,value:t,chartType:s}){return s==="pie-chart"?`${e}`:`${e}: ${t}`}_getChartOption(e){var ee;const{value:t,attributes:s,formattedAttributes:n,expressionAttributes:r,fieldName:a,relatedFieldName:d,fieldInfos:c,chartType:h,hasMultipleRelatedFeatures:p,color:m}=e,g=this.layer,_=this.fieldInfoMap??new Map,{normalizeField:v,tooltipField:w}=t,A=v?we(v)?s[ze(v).fieldName]:s[v]:null,b=wi(a)&&r&&r[a]!==void 0?r[a]:d&&s[d]!==void 0?s[d]:s[a]!==void 0?s[a]:n[a],T=new zi({fieldName:a,color:m,value:b===void 0?null:b&&A?b/A:b});if(we(a)){const q=_.get(a.toLowerCase()),et=w&&_.get(w.toLowerCase()),Li=(q==null?void 0:q.fieldName)??a,tt=p&&w?ze(w).fieldName:(et==null?void 0:et.fieldName)??w,Oi=p&&tt?s[tt]:n[tt]??(q==null?void 0:q.label)??(q==null?void 0:q.fieldName)??d,Vi=p&&d?s[d]:n[Li];return T.tooltip=this._getTooltip({label:Oi,value:Vi,chartType:h}),T}const L=ps(c,a),V=wt(a,g),se=w&&n[w]!==void 0?n[w]:yi(L||new ci({fieldName:V}),(ee=this.popupTemplate)==null?void 0:ee.expressionInfos),K=n[V];return T.tooltip=this._getTooltip({label:se,value:K,chartType:h}),T}};o([l()],D.prototype,"abilities",void 0),o([Te("abilities")],D.prototype,"castAbilities",null),o([l()],D.prototype,"activeMediaInfoIndex",void 0),o([l({readOnly:!0})],D.prototype,"activeMediaInfo",null),o([l()],D.prototype,"attributes",void 0),o([l()],D.prototype,"description",void 0),o([l()],D.prototype,"fieldInfoMap",void 0),o([l()],D.prototype,"formattedAttributes",void 0),o([l()],D.prototype,"expressionAttributes",void 0),o([l({readOnly:!0})],D.prototype,"formattedMediaInfos",null),o([l()],D.prototype,"isAggregate",void 0),o([l()],D.prototype,"layer",void 0),o([l({readOnly:!0})],D.prototype,"formattedMediaInfoCount",null),o([l()],D.prototype,"mediaInfos",void 0),o([l()],D.prototype,"popupTemplate",void 0),o([l()],D.prototype,"relatedInfos",void 0),o([l()],D.prototype,"title",void 0),D=o([R("esri.widgets.Feature.FeatureMedia.FeatureMediaViewModel")],D);const Me=D,N="esri-feature-media",U={base:N,mediaContainer:`${N}__container`,mediaItemContainer:`${N}__item-container`,mediaItem:`${N}__item`,mediaItemText:`${N}__item-text`,mediaItemTitle:`${N}__item-title`,mediaItemCaption:`${N}__item-caption`,mediaNavigation:`${N}__item-navigation`,mediaPagination:`${N}__pagination`,mediaPaginationText:`${N}__pagination-text`,mediaPrevious:`${N}__previous`,mediaPreviousIconLTR:`${N}__previous-icon`,mediaPreviousIconRTL:`${N}__previous-icon--rtl`,mediaNext:`${N}__next`,mediaNextIconLTR:`${N}__next-icon`,mediaNextIconRTL:`${N}__next-icon--rtl`,mediaChart:`${N}__chart`,mediaPaginationButton:`${N}__pagination-button`,mediaPaginationIcon:`${N}__pagination-icon`,mediaChartRendered:`${N}__chart--rendered`},ht=15,ue="category",Pe="value",Gs="rgba(50, 50, 50, 1)",Xs=250,Ys=500,Ks=200;let Q=class extends Z{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this._chartRootMap=new WeakMap,this.viewModel=new Me,this.messages=null,this._disposeChart=s=>{var n;(n=this._chartRootMap.get(s))==null||n.dispose(),this._chartRootMap.delete(s)},this._createChart=async s=>{const{destroyed:n,viewModel:r}=this;if(n||!r||!s)return;const{createRoot:a}=await E(()=>import("./chartUtilsAm5-QfmFJ3lc.js").then(c=>c.c),__vite__mapDeps([5,2,3,6,7,8])),d=await a(s);this._chartRootMap.set(s,d),this._renderChart({mediaInfo:r.activeMediaInfo,root:d})}}initialize(){this._featureElementInfo=new Je,this.addHandles([f(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.activeMediaInfo,(t=this.viewModel)==null?void 0:t.activeMediaInfoIndex]},()=>this._setupMediaRefreshTimer(),H),f(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.description,(t=this.viewModel)==null?void 0:t.title]},()=>this._setupFeatureElementInfo(),H)])}loadDependencies(){return Re({icon:()=>E(()=>import("./calcite-icon-itD416se.js"),__vite__mapDeps([0,1,2,3,4]))})}destroy(){var e;this._clearMediaRefreshTimer(),(e=this._featureElementInfo)==null||e.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get activeMediaInfoIndex(){return this.viewModel.activeMediaInfoIndex}set activeMediaInfoIndex(e){this.viewModel.activeMediaInfoIndex=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get fieldInfoMap(){return this.viewModel.fieldInfoMap}set fieldInfoMap(e){this.viewModel.fieldInfoMap=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get mediaInfos(){return this.viewModel.mediaInfos}set mediaInfos(e){this.viewModel.mediaInfos=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get relatedInfos(){return this.viewModel.relatedInfos}set relatedInfos(e){this.viewModel.relatedInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){var e;return u("div",{bind:this,class:U.base,onkeyup:this._handleMediaKeyup},(e=this._featureElementInfo)==null?void 0:e.render(),this._renderMedia())}_renderMedia(){const{formattedMediaInfoCount:e,activeMediaInfoIndex:t}=this.viewModel,s=this._renderMediaText();return e?u("div",{class:U.mediaContainer,key:"media-element-container"},this._renderMediaInfo(),u("div",{class:U.mediaNavigation},s,e>1?u("div",{class:U.mediaPagination},this._renderMediaPageButton("previous"),u("span",{class:U.mediaPaginationText},oe(this.messages.pageText,{index:t+1,total:e})),this._renderMediaPageButton("next")):null)):null}_renderMediaText(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e&&e.title?u("div",{class:U.mediaItemTitle,innerHTML:e.title,key:"media-title"}):null,s=e&&e.caption?u("div",{class:U.mediaItemCaption,innerHTML:e.caption,key:"media-caption"}):null;return t||s?u("div",{class:U.mediaItemText,key:"media-text"},t,s):null}_renderImageMediaInfo(e){const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:s,formattedMediaInfoCount:n}=this.viewModel,{value:r,refreshInterval:a,altText:d,title:c,type:h}=e,{sourceURL:p,linkURL:m}=r,g=vi(m??void 0)?"_blank":"_self",_=g==="_blank"?"noreferrer":"",v=a?t:null,w=v?v.timestamp:0,A=v?v.sourceURL:p,b=u("img",{alt:d||c,key:`media-${h}-${s}-${n}-${w}`,src:A??void 0});return(m?u("a",{href:m,rel:_,target:g,title:c},b):null)??b}_renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:s}=this.viewModel;return u("div",{afterCreate:this._createChart,afterRemoved:this._disposeChart,bind:this,class:U.mediaChart,key:`media-${e.type}-${t}-${s}`})}_renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?e.type==="image"?this._renderImageMediaInfo(e):e.type.includes("chart")?this._renderChartMediaInfo(e):null:null}_renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;return e?u("div",{class:U.mediaItemContainer,key:"media-container"},u("div",{class:U.mediaItem,key:"media-item-container"},this._renderMediaInfoType())):null}_renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t=e==="previous",s=t?this.messages.previous:this.messages.next,n=t?"chevron-left":"chevron-right",r=t?"media-previous":"media-next",a=t?this._previous:this._next;return u("button",{"aria-label":s,bind:this,class:U.mediaPaginationButton,key:r,onclick:a,tabIndex:0,title:s,type:"button"},u("calcite-icon",{class:U.mediaPaginationIcon,icon:n,scale:"s"}))}_setupFeatureElementInfo(){var s;const{description:e,title:t}=this;(s=this._featureElementInfo)==null||s.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_getRenderer(){if(!this.viewModel)return;const{isAggregate:e,layer:t}=this.viewModel;return e&&(t!=null&&t.featureReduction)&&"renderer"in t.featureReduction?t.featureReduction.renderer:t==null?void 0:t.renderer}async _getSeriesColors(e){const{colorAm5:t}=await E(()=>import("./chartCommon-ZPkVkRIK.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),s=new Map;return e.forEach(n=>{n.color&&s.set(n,t(n.color.toCss(!0)))}),s}async _getRendererColors(){const{colorAm5:e}=await E(()=>import("./chartCommon-ZPkVkRIK.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),t=new Map,s=this._getRenderer(),n="default";if(!s)return t;const r=await ji(s);return r.delete(n),Array.from(r.values()).every(a=>(a==null?void 0:a.length)===1)&&Array.from(r.keys()).forEach(a=>{var c,h;const d=(h=(c=r.get(a))==null?void 0:c[0])==null?void 0:h.toCss(!0);d&&t.set(a,e(d))}),t}_handleMediaKeyup(e){const t=hi(e);t==="ArrowLeft"&&(e.stopPropagation(),this.viewModel.previous()),t==="ArrowRight"&&(e.stopPropagation(),this.viewModel.next())}_canAnimateChart(){return!!this.viewModel&&!!this.viewModel.abilities.chartAnimation&&!ks()}_getChartAnimationMS(){return this._canAnimateChart()?Xs:0}_getChartSeriesAnimationMS(){return this._canAnimateChart()?Ys:0}async _renderChart(e){const{root:t,mediaInfo:s}=e,{value:n,type:r}=s,{ResponsiveThemeAm5:a,DarkThemeAm5:d,AnimatedThemeAm5:c,ColorSetAm5:h,ThemeAm5:p,esriChartColorSet:m}=await E(()=>import("./chartCommon-ZPkVkRIK.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),g=p.new(t);g.rule("ColorSet").set("colors",m),g.rule("ColorSet").set("reuse",!0);const _=[a.new(t),g];Ui()&&_.push(d.new(t)),this._canAnimateChart()&&_.push(c.new(t)),t.setThemes(_);const v=await this._getRendererColors(),w=await this._getSeriesColors(n.series),A=h.new(t,{}),b=w.get(n.series[0]),T=b?{lineSettings:{stroke:b}}:void 0,L=n.series.map((V,se)=>{const K=w.get(V)||v.get(V.fieldName)||A.getIndex(se);return{[ue]:V.tooltip,[Pe]:V.value,columnSettings:{fill:K,stroke:K},...T}}).filter(V=>r!=="pie-chart"||V.value!=null&&V.value>0);r==="pie-chart"?this._createPieChart(e,L):this._createXYChart(e,L)}_getDirection(){return Ae(this.container)?"rtl":"ltr"}_isInversed(){return!!Ae(this.container)}async _customizeChartTooltip(e,t="horizontal"){var n;const{colorAm5:s}=await E(()=>import("./chartCommon-ZPkVkRIK.js"),__vite__mapDeps([9,6,2,3,10,11,7,12]));e.setAll({pointerOrientation:t}),(n=e.get("background"))==null||n.setAll({stroke:s(Gs)}),e.label.setAll({direction:this._getDirection(),oversizedBehavior:"wrap",maxWidth:Ks})}async _createPieChart(e,t){const{TooltipAm5:s}=await E(()=>import("./chartCommon-ZPkVkRIK.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),{PieChartAm5:n,PieSeriesAm5:r}=await E(()=>import("./pieChart-w-OTuuJJ.js"),__vite__mapDeps([13,2,3,14,6,12,8])),{mediaInfo:a,root:d}=e,{title:c}=a,h=5,p=(a==null?void 0:a.altText)||(a==null?void 0:a.title)||"",m=d.container.children.push(n.new(d,{ariaLabel:p,focusable:!0,paddingBottom:h,paddingTop:h,paddingLeft:h,paddingRight:h})),g=`{category}: {valuePercentTotal.formatNumber('0.00')}% - ({value})`,_=s.new(d,{labelText:g}),v=m.series.push(r.new(d,{name:c,valueField:Pe,categoryField:ue,tooltip:_}));v.ticks.template.set("forceHidden",!0),v.labels.template.set("forceHidden",!0),v.slices.template.states.create("active",{shiftRadius:h}),this._customizeChartTooltip(_),v.slices.template.setAll({ariaLabel:g,focusable:!0,templateField:"columnSettings"}),v.data.setAll(t),v.appear(this._getChartSeriesAnimationMS()),m.appear(this._getChartAnimationMS()),m.root.dom.classList.toggle(U.mediaChartRendered,!0)}_getMinSeriesValue(e){let t=0;return e.forEach(s=>t=Math.min(s.value,t)),t}async _createColumnChart(e,t,s){const{TooltipAm5:n,ScrollbarAm5:r}=await E(()=>import("./chartCommon-ZPkVkRIK.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),{CategoryAxisAm5:a,AxisRendererXAm5:d,ValueAxisAm5:c,AxisRendererYAm5:h,ColumnSeriesAm5:p}=await E(()=>import("./xyChart-pkay2Qkc.js"),__vite__mapDeps([15,16,6,2,3,12,8,14,11])),{mediaInfo:m,root:g}=t,{value:_,title:v}=m;e.setAll({wheelX:"panX",wheelY:"zoomX"});const w=e.xAxes.push(a.new(g,{renderer:d.new(g,{inversed:this._isInversed()}),categoryField:ue}));w.get("renderer").labels.template.setAll({forceHidden:!0});const A=e.yAxes.push(c.new(g,{renderer:h.new(g,{inside:!1}),min:this._getMinSeriesValue(_.series)}));A.get("renderer").labels.template.setAll({direction:this._getDirection()});const b="{categoryX}",T=n.new(g,{labelText:b}),L=e.series.push(p.new(g,{name:v,xAxis:w,yAxis:A,valueYField:Pe,categoryXField:ue,tooltip:T}));this._customizeChartTooltip(T),L.columns.template.setAll({ariaLabel:b,focusable:!0,templateField:"columnSettings"}),_.series.length>ht&&e.set("scrollbarX",r.new(g,{orientation:"horizontal"})),w.data.setAll(s),L.data.setAll(s),L.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createBarChart(e,t,s){const{TooltipAm5:n,ScrollbarAm5:r}=await E(()=>import("./chartCommon-ZPkVkRIK.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),{CategoryAxisAm5:a,AxisRendererXAm5:d,ValueAxisAm5:c,AxisRendererYAm5:h,ColumnSeriesAm5:p}=await E(()=>import("./xyChart-pkay2Qkc.js"),__vite__mapDeps([15,16,6,2,3,12,8,14,11])),{mediaInfo:m,root:g}=t,{value:_,title:v}=m;e.setAll({wheelX:"panY",wheelY:"zoomY"});const w=e.yAxes.push(a.new(g,{renderer:h.new(g,{inversed:!0}),categoryField:ue}));w.get("renderer").labels.template.setAll({forceHidden:!0});const A=e.xAxes.push(c.new(g,{renderer:d.new(g,{inside:!1,inversed:this._isInversed()}),min:this._getMinSeriesValue(_.series)}));A.get("renderer").labels.template.setAll({direction:this._getDirection()});const b="{categoryY}",T=n.new(g,{labelText:b}),L=e.series.push(p.new(g,{name:v,xAxis:A,yAxis:w,valueXField:Pe,categoryYField:ue,tooltip:T}));this._customizeChartTooltip(T,"vertical"),L.columns.template.setAll({ariaLabel:b,focusable:!0,templateField:"columnSettings"}),_.series.length>ht&&e.set("scrollbarY",r.new(g,{orientation:"vertical"})),w.data.setAll(s),L.data.setAll(s),L.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createLineChart(e,t,s){var se,K,ee;const{TooltipAm5:n,ScrollbarAm5:r}=await E(()=>import("./chartCommon-ZPkVkRIK.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),{CategoryAxisAm5:a,AxisRendererXAm5:d,ValueAxisAm5:c,AxisRendererYAm5:h,LineSeriesAm5:p}=await E(()=>import("./xyChart-pkay2Qkc.js"),__vite__mapDeps([15,16,6,2,3,12,8,14,11])),{root:m,mediaInfo:g}=t,{value:_,title:v}=g;e.setAll({wheelX:"panX",wheelY:"zoomX"});const w=e.xAxes.push(a.new(m,{renderer:d.new(m,{inversed:this._isInversed()}),categoryField:ue}));w.get("renderer").labels.template.setAll({forceHidden:!0});const A=e.yAxes.push(c.new(m,{renderer:h.new(m,{inside:!1}),min:this._getMinSeriesValue(_.series)}));A.get("renderer").labels.template.setAll({direction:this._getDirection()});const b="{categoryX}",T=(K=(se=s[0])==null?void 0:se.lineSettings)==null?void 0:K.stroke,L=n.new(m,{getFillFromSprite:!T,labelText:b});T&&((ee=L.get("background"))==null||ee.setAll({fill:T}));const V=e.series.push(p.new(m,{name:v,xAxis:w,yAxis:A,valueYField:Pe,categoryXField:ue,tooltip:L}));V.strokes.template.setAll({templateField:"lineSettings"}),this._customizeChartTooltip(L,"vertical"),_.series.length>ht&&e.set("scrollbarX",r.new(m,{orientation:"horizontal"})),w.data.setAll(s),V.data.setAll(s),V.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createXYChart(e,t){const{XYChartAm5:s,XYCursorAm5:n}=await E(()=>import("./xyChart-pkay2Qkc.js"),__vite__mapDeps([15,16,6,2,3,12,8,14,11])),{root:r,mediaInfo:a}=e,{type:d}=a,c=(a==null?void 0:a.altText)||(a==null?void 0:a.title)||"",h=r.container.children.push(s.new(r,{ariaLabel:c,focusable:!0,panX:!0,panY:!0}));h.set("cursor",n.new(r,{})),d==="column-chart"&&await this._createColumnChart(h,e,t),d==="bar-chart"&&await this._createBarChart(h,e,t),d==="line-chart"&&await this._createLineChart(h,e,t),h.root.dom.classList.toggle(U.mediaChartRendered,!0)}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:e&&this._getImageSource(e,t)}}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;e&&e.type==="image"&&e.refreshInterval&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:s}=e;if(!t)return;const n=6e4*t;this._updateMediaInfoTimestamp(s.sourceURL);const r=setInterval(()=>{this._updateMediaInfoTimestamp(s.sourceURL)},n);this._refreshTimer=r}_getImageSource(e,t){const s=e.includes("?")?"&":"?",[n,r=""]=e.split("#");return`${n}${s}timestamp=${t}${r?"#":""}${r}`}};o([l()],Q.prototype,"_refreshIntervalInfo",void 0),o([l()],Q.prototype,"attributes",null),o([l()],Q.prototype,"activeMediaInfoIndex",null),o([l()],Q.prototype,"description",null),o([l()],Q.prototype,"fieldInfoMap",null),o([l()],Q.prototype,"layer",null),o([l()],Q.prototype,"mediaInfos",null),o([l()],Q.prototype,"popupTemplate",null),o([l()],Q.prototype,"relatedInfos",null),o([l()],Q.prototype,"title",null),o([l({type:Me})],Q.prototype,"viewModel",void 0),o([l(),Y("esri/widgets/Feature/t9n/Feature")],Q.prototype,"messages",void 0),Q=o([R("esri.widgets.Feature.FeatureMedia")],Q);const Fi=Q,Js=["$datastore","$map","$layer","$aggregatedfeatures"],Zs="esri.widgets.Feature.support.arcadeFeatureUtils",en=ie.getLogger(Zs);function tn(i){return typeof i=="string"?Ft(At(i)):Array.isArray(i)?sn(i):(i==null?void 0:i.declaredClass)==="esri.arcade.Dictionary"?nn(i):i}function sn(i){return`
    ${i.map(e=>`
  • ${typeof e=="string"?Ft(At(e)):e}
  • `).join("")}
`}function nn(i){return`${i.keys().map(e=>{const t=i.field(e);return``}).join("")}
${e}${typeof t=="string"?Ft(At(t)):t}
`}function rn({aggregatedFeatures:i,arcadeUtils:e,featureSetVars:t,context:s,viewInfo:n,map:r,graphic:a,interceptor:d}){t.forEach(c=>{const h=c.toLowerCase(),p=n.sr,m={map:r,spatialReference:p,interceptor:d};if(h==="$map"&&(s.vars[h]=e.convertMapToFeatureSetCollection(m)),h==="$layer"&&(s.vars[h]=e.convertFeatureLayerToFeatureSet({layer:a.sourceLayer,spatialReference:p,interceptor:d})),h==="$datastore"&&(s.vars[h]=e.convertServiceUrlToWorkspace({url:a.sourceLayer.url,spatialReference:p,interceptor:d})),h==="$aggregatedfeatures"){const g=a.layer,{fields:_,objectIdField:v,geometryType:w,spatialReference:A,displayField:b}=g,T=new Ms({fields:_,objectIdField:v,geometryType:w,spatialReference:A,displayField:b,...g.type==="feature"?{templates:g.templates,typeIdField:g.typeIdField,types:g.types}:null,source:i});s.vars[h]=e.convertFeatureLayerToFeatureSet({layer:T,spatialReference:A,interceptor:d})}})}function Ai(){return E(()=>import("./arcadeUtils-OUqwHs4P.js").then(i=>i.aD),__vite__mapDeps([17,2,3,18,19]))}function on(i){return"createQuery"in i&&"queryFeatures"in i}async function an({graphic:i,view:e}){const{isAggregate:t,layer:s}=i;if(!t||!s||(e==null?void 0:e.type)!=="2d")return[];const n=await e.whenLayerView(s);if(!on(n))return[];const r=n.createQuery(),a=i.getObjectId();r.aggregateIds=a!=null?[a]:[];const{features:d}=await n.queryFeatures(r);return d}async function Ci({expressionInfo:i,arcadeUtils:e,interceptor:t,spatialReference:s,map:n,graphic:r,view:a}){if(!(i!=null&&i.expression))return null;const d=e.createSyntaxTree(i.expression),c=Js.filter(_=>e.hasVariable(d,_)),[h]=await Promise.all([an({graphic:r,view:a}),e.loadScriptDependencies(d,!0,c)]),p=e.getViewInfo({spatialReference:s}),m=e.createExecContext(r,p,a==null?void 0:a.timeZone);m.interceptor=t,m.useAsync=!0,rn({aggregatedFeatures:h,arcadeUtils:e,featureSetVars:c,context:m,viewInfo:p,map:n,graphic:r,interceptor:t});const g=e.createFunction(d,m);return e.executeAsyncFunction(g,m).catch(_=>en.error("arcade-execution-error",{error:_,graphic:r,expressionInfo:i}))}async function ln({expressionInfos:i,spatialReference:e,graphic:t,interceptor:s,map:n,view:r}){if(!(i!=null&&i.length))return{};const a=await Ai(),d={};for(const p of i)d[`expression/${p.name}`]=Ci({expressionInfo:p,arcadeUtils:a,interceptor:s,spatialReference:e,map:n,graphic:t,view:r});const c=await Ce(d),h={};for(const p in c)h[p]=tn(c[p].value);return h}const dn=1;let J=class extends ce{constructor(e){super(e),this._abortController=null,this.expressionInfo=null,this.graphic=null,this.contentElement=null,this.contentElementViewModel=null,this.interceptor=null,this.view=null,this._cancelQuery=()=>{const{_abortController:t}=this;t&&t.abort(),this._abortController=null},this._createVM=()=>{var n,r;const t=(n=this.contentElement)==null?void 0:n.type;(r=this.contentElementViewModel)==null||r.destroy();const s=t==="fields"?new Ze:t==="media"?new Me:t==="text"?new Xe:null;this._set("contentElementViewModel",s)},this._compile=async()=>{this._cancelQuery();const t=new AbortController;this._abortController=t,await this._compileExpression(),this._abortController===t&&(this._abortController=null)},this._compileThrottled=Qe(this._compile,dn,this),this._compileExpression=async()=>{const{expressionInfo:t,graphic:s,interceptor:n,spatialReference:r,map:a,view:d,_abortController:c}=this;if(!(t&&s&&r&&a))return void this._set("contentElement",null);const h=await Ai();if(c!==this._abortController)return;const p=await Ci({arcadeUtils:h,expressionInfo:t,graphic:s,interceptor:n,map:a,spatialReference:r,view:d});if(!p||p.declaredClass!=="esri.arcade.Dictionary")return void this._set("contentElement",null);const m=await p.castAsJsonAsync(c==null?void 0:c.signal),g=m==null?void 0:m.type,_=g==="media"?Gi.fromJSON(m):g==="text"?pi.fromJSON(m):g==="fields"?Xi.fromJSON(m):null;this._set("contentElement",_)},this.addHandles([f(()=>[this.expressionInfo,this.graphic,this.map,this.spatialReference,this.view],()=>this._compileThrottled(),H),f(()=>[this.contentElement],()=>this._createVM(),H)])}initialize(){this.addHandles(this._compileThrottled)}destroy(){var e;this._cancelQuery(),(e=this.contentElementViewModel)==null||e.destroy(),this._set("contentElementViewModel",null),this._set("contentElement",null)}get spatialReference(){var e;return((e=this.view)==null?void 0:e.spatialReference)??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{_abortController:e,contentElement:t,contentElementViewModel:s}=this;return e?"loading":t||s?"ready":"disabled"}get map(){var e;return((e=this.view)==null?void 0:e.map)??null}set map(e){this._override("map",e)}};o([l()],J.prototype,"_abortController",void 0),o([l({type:Qi})],J.prototype,"expressionInfo",void 0),o([l({type:ke})],J.prototype,"graphic",void 0),o([l({readOnly:!0})],J.prototype,"contentElement",void 0),o([l({readOnly:!0})],J.prototype,"contentElementViewModel",void 0),o([l()],J.prototype,"interceptor",void 0),o([l()],J.prototype,"spatialReference",null),o([l({readOnly:!0})],J.prototype,"state",null),o([l()],J.prototype,"map",null),o([l()],J.prototype,"view",void 0),J=o([R("esri.widgets.Feature.FeatureExpression.FeatureExpressionViewModel")],J);const $t=J,pt="esri-feature",mt={base:`${pt}-expression`,loadingSpinnerContainer:`${pt}__loading-container`,spinner:`${pt}__loading-spinner`};let je=class extends Z{constructor(e,t){super(e,t),this._contentWidget=null,this.viewModel=new $t}initialize(){this.addHandles(f(()=>{var e;return(e=this.viewModel)==null?void 0:e.contentElementViewModel},()=>this._setupExpressionWidget(),H))}destroy(){this._destroyContentWidget()}render(){var t;const{state:e}=this.viewModel;return u("div",{class:mt.base},e==="loading"?this._renderLoading():e==="disabled"?null:(t=this._contentWidget)==null?void 0:t.render())}_renderLoading(){return u("div",{class:mt.loadingSpinnerContainer,key:"loading-container"},u("span",{class:this.classes(pe.loadingIndicator,I.rotating,mt.spinner)}))}_destroyContentWidget(){const{_contentWidget:e}=this;e&&(e.viewModel=null,e.destroy()),this._contentWidget=null}_setupExpressionWidget(){const{contentElementViewModel:e,contentElement:t}=this.viewModel,s=t==null?void 0:t.type;this._destroyContentWidget();const n=e?s==="fields"?new Ii({viewModel:e}):s==="media"?new Fi({viewModel:e}):s==="text"?new He({viewModel:e}):null:null;this._contentWidget=n,this.scheduleRender()}};o([l({type:$t})],je.prototype,"viewModel",void 0),je=o([R("esri.widgets.Feature.FeatureExpression")],je);const cn=je;var Jt;(function(i){i.TOO_SHORT="length-validation-error::too-short"})(Jt||(Jt={}));const un=i=>{var t;const e=[];if(i.formTemplate){const{description:s,title:n}=i.formTemplate;(t=i.fields)==null||t.forEach(r=>{const a=n&&Nt(n,r.name),d=s&&Nt(s,r.name);(a||d)&&e.push(r.name)})}return e},gt=100;let $=class extends Yi(mi(ce)){constructor(e){super(e),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{const{_queryAbortController:t}=this;t&&t.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:t}=this;t&&t.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:t}=this;t&&t.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const t=new AbortController;this._queryAbortController=t,await st(this._query()),this._queryAbortController===t&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();const t=new AbortController;this._queryFeatureCountAbortController=t,await st(this._queryFeatureCount()),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryPageController=async()=>{const t=new AbortController;this._queryPageAbortController=t,await st(this._queryPage()),this._queryPageAbortController===t&&(this._queryPageAbortController=null)},this._queryDebounced=nt(this._queryController,gt),this._queryFeatureCountDebounced=nt(this._queryFeatureCountController,gt),this._queryPageDebounced=nt(this._queryPageController,gt),this._query=async()=>{const{_queryAbortController:t,relatedFeatures:s}=this;this.featureCount&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,s.removeAll(),this.destroyed||s.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:t==null?void 0:t.signal}))))},this.addHandles([f(()=>{var t;return[this.displayCount,this.graphic,this.layer,(t=this.layer)==null?void 0:t.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount]},()=>this._queryDebounced(),H),f(()=>[this.featurePage,this.showAllEnabled],()=>this._queryPageDebounced()),f(()=>[this.layer,this.relationshipId,this.objectId,this.canQuery],()=>this._queryFeatureCountDebounced())])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.removeAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:s}=this,n=1,r=Math.ceil(s/t)||1;this._set("featurePage",Math.min(Math.max(e,n),r))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&(t!=null&&t.loaded)?e.map(s=>{const n=s.clone();return n.field=wt(s.field,t),n}):e??[]}get supportsCacheHint(){var e,t,s;return!!((s=(t=(e=this.layer)==null?void 0:e.capabilities)==null?void 0:t.queryRelated)!=null&&s.supportsCacheHint)}get canLoad(){return!!this.map&&typeof this.relationshipId=="number"&&typeof this.objectId=="number"}get canQuery(){var t,s;const e=(s=(t=this.layer)==null?void 0:t.capabilities)==null?void 0:s.queryRelated;return!!(this.relatedLayer&&this.relationship&&typeof this.relationshipId=="number"&&typeof this.objectId=="number"&&(e!=null&&e.supportsCount)&&(e!=null&&e.supportsPagination))}get itemDescriptionFieldName(){var e;return((e=this.orderByFieldsFixedCasing[0])==null?void 0:e.field)||null}set displayCount(e){this._set("displayCount",Math.min(Math.max(e,0),10))}get displayCount(){return this._get("displayCount")}get objectId(){var e,t;return(this.objectIdField&&((t=(e=this.graphic)==null?void 0:e.attributes)==null?void 0:t[this.objectIdField]))??null}get objectIdField(){var e;return((e=this.layer)==null?void 0:e.objectIdField)||null}get relatedFeatures(){return this._get("relatedFeatures")||new De}get relatedLayer(){const{layer:e,map:t,relationship:s}=this;return e!=null&&e.loaded&&t&&s?ms(t,e,s)??null:null}get relationship(){var s;const{relationshipId:e,layer:t}=this;return typeof e=="number"?((s=t==null?void 0:t.relationships)==null?void 0:s.find(({id:n})=>n===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new De}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:s,canQuery:n,_loaded:r,canLoad:a}=this;return t||a&&!r?"loading":e||s?"querying":n?"ready":"disabled"}getRelatedFeatureByObjectId(e){return this.relatedFeatures.find(t=>t.getObjectId()===e)}_destroyRelatedFeatureViewModels(){var e;(e=this.relatedFeatureViewModels)==null||e.forEach(t=>!t.destroyed&&t.destroy()),this.relatedFeatureViewModels.removeAll()}async _queryFeatureCount(){const{layer:e,relatedLayer:t,relationshipId:s,objectId:n,_queryFeatureCountAbortController:r,canQuery:a,supportsCacheHint:d}=this;if(await(e==null?void 0:e.load()),await(t==null?void 0:t.load()),!a||!e||!t)return void this._set("featureCount",0);const c=t.createQuery(),h=new vt({cacheHint:d,relationshipId:s,returnGeometry:!1,objectIds:[n],where:c.where??void 0}),p=await e.queryRelatedFeaturesCount(h,{signal:r==null?void 0:r.signal});this._set("featureCount",p[n]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:s}=this;return t?e:s?e.slice(0,s):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:s,_queryPageAbortController:n,featureCount:r}=this;!s||t<2||!r||e.addMany(await this._queryRelatedFeatures({signal:n==null?void 0:n.signal}))}async _queryRelatedFeatures(e){var ee;const{orderByFieldsFixedCasing:t,showAllEnabled:s,featuresPerPage:n,displayCount:r,layer:a,relationshipId:d,featurePage:c,featureCount:h,relatedLayer:p,supportsCacheHint:m}=this,{canQuery:g,objectId:_}=this;if(!g||!a||!p)return[];const v=s?((c-1)*n+h)%h:0,w=s?n:r,A=p.objectIdField,b=[...t.map(q=>q.field),...un(p),A].filter(Ke),T=t.map(q=>`${q.field} ${q.order}`),L=p.createQuery(),V=new vt({orderByFields:T,start:v,num:w,outFields:b,cacheHint:m,relationshipId:d,returnGeometry:!1,objectIds:[_],where:L.where??void 0}),se=await a.queryRelatedFeatures(V,{signal:e==null?void 0:e.signal}),K=((ee=se[_])==null?void 0:ee.features)||[];return K.forEach(q=>{q.sourceLayer=p,q.layer=p}),K}};o([l()],$.prototype,"_loaded",void 0),o([l()],$.prototype,"_queryAbortController",void 0),o([l()],$.prototype,"_queryPageAbortController",void 0),o([l()],$.prototype,"_queryFeatureCountAbortController",void 0),o([l({value:1})],$.prototype,"featurePage",null),o([l()],$.prototype,"featuresPerPage",void 0),o([l({readOnly:!0})],$.prototype,"orderByFieldsFixedCasing",null),o([l({readOnly:!0})],$.prototype,"supportsCacheHint",null),o([l({readOnly:!0})],$.prototype,"canLoad",null),o([l({readOnly:!0})],$.prototype,"canQuery",null),o([l()],$.prototype,"description",void 0),o([l({readOnly:!0})],$.prototype,"itemDescriptionFieldName",null),o([l({value:3})],$.prototype,"displayCount",null),o([l({type:ke})],$.prototype,"graphic",void 0),o([l()],$.prototype,"layer",void 0),o([l()],$.prototype,"map",void 0),o([l({readOnly:!0})],$.prototype,"objectId",null),o([l({readOnly:!0})],$.prototype,"objectIdField",null),o([l()],$.prototype,"orderByFields",void 0),o([l({readOnly:!0})],$.prototype,"relatedFeatures",null),o([l({readOnly:!0})],$.prototype,"relatedLayer",null),o([l({readOnly:!0})],$.prototype,"relationship",null),o([l()],$.prototype,"featureCount",void 0),o([l({readOnly:!0})],$.prototype,"relatedFeatureViewModels",null),o([l()],$.prototype,"relationshipId",void 0),o([l()],$.prototype,"showAllEnabled",void 0),o([l()],$.prototype,"state",null),o([l()],$.prototype,"title",void 0),o([l()],$.prototype,"getRelatedFeatureByObjectId",null),$=o([R("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],$);const xt=$,Ve="esri-feature",Le=`${Ve}-relationship`,ae={base:Le,listContainer:`${Le}__list`,listItem:`${Le}__list-item`,listItemHidden:`${Le}__list-item--hidden`,listContainerQuerying:`${Le}__list--querying`,featureObserver:`${Ve}__feature-observer`,stickySpinnerContainer:`${Ve}__sticky-loading-container`,loadingSpinnerContainer:`${Ve}__loading-container`,spinner:`${Ve}__loading-spinner`},Zt={title:!0,description:!0};let G=class extends Z{constructor(e,t){super(e,t),this._featureElementInfo=null,this._relatedFeatureIntersectionObserverNode=null,this._relatedFeatureIntersectionObserver=new IntersectionObserver(([s])=>{s!=null&&s.isIntersecting&&this._increaseFeaturePage()},{root:window.document}),this.headingLevel=2,this.viewModel=new xt,this.messages=null,this.messagesCommon=null,this.visibleElements={...Zt},this._increaseFeaturePage=()=>{const{state:s,showAllEnabled:n,relatedFeatures:r,featuresPerPage:a,featurePage:d}=this.viewModel;s==="ready"&&n&&r.length>=a*d&&this.viewModel.featurePage++}}initialize(){this._featureElementInfo=new Je,this.addHandles([f(()=>[this.viewModel.description,this.viewModel.title,this.headingLevel],()=>this._setupFeatureElementInfo(),H),f(()=>[this.viewModel.state,this.viewModel.showAllEnabled,this._relatedFeatureIntersectionObserverNode],()=>this._handleRelatedFeatureObserverChange()),Fe(()=>this.viewModel.relatedFeatureViewModels,"change",()=>this._setupRelatedFeatureViewModels())])}loadDependencies(){return Re({icon:()=>E(()=>import("./calcite-icon-itD416se.js"),__vite__mapDeps([0,1,2,3,4])),list:()=>E(()=>import("./calcite-list-LJfGqLbO.js"),__vite__mapDeps([20,2,3,21,4,22,23,24,25,26,27,1,28,29,30,31,32,33,34,35])),"list-item":()=>E(()=>import("./calcite-list-item-OtIyVNHT.js"),__vite__mapDeps([36,2,3,21,22,25,26,4,27,23,37,34,31,1,33])),notice:()=>E(()=>import("./calcite-notice-zH528nES.js"),__vite__mapDeps([38,2,3,39,4,23,25,26,27,40,31,1]))})}destroy(){this._unobserveRelatedFeatureObserver(),this._featureElementInfo=Ki(this._featureElementInfo)}get displayShowAllButton(){const{showAllEnabled:e,featureCount:t,displayCount:s,state:n}=this.viewModel;return!e&&!!t&&n==="ready"&&(t>s||s===0)}get displayListItems(){return this.displayShowAllButton||this.viewModel.relatedFeatureViewModels.length>0}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get featureCountDescription(){const{messages:e}=this,{featureCount:t}=this.viewModel;return oe(e==null?void 0:e.numberRecords,{number:t})}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}castVisibleElements(e){return{...Zt,...e}}render(){var t;const{state:e}=this.viewModel;return u("div",{class:this.classes(ae.base,I.widget)},(t=this._featureElementInfo)==null?void 0:t.render(),e==="loading"?this._renderLoading():e==="disabled"?this._renderRelationshipNotFound():this._renderRelatedFeatures())}_renderStickyLoading(){return this.viewModel.state==="querying"?u("div",{class:ae.stickySpinnerContainer,key:"sticky-loader"},this._renderLoadingIcon()):null}_renderLoadingIcon(){return u("span",{class:this.classes(pe.loadingIndicator,I.rotating,ae.spinner)})}_renderLoading(){return u("div",{class:ae.loadingSpinnerContainer,key:"loading-container"},this._renderLoadingIcon())}_renderShowAllIconNode(){return u("calcite-icon",{icon:"list",scale:"s",slot:"content-end"})}_renderChevronIconNode(){const e=Ae(this.container)?"chevron-left":"chevron-right";return u("calcite-icon",{icon:e,scale:"s",slot:"content-end"})}_renderRelatedFeature(e){var r;const{itemDescriptionFieldName:t}=this.viewModel,s=e.title;e.description=t&&((r=e.formattedAttributes)==null?void 0:r.global[t]);const n=e.state==="loading";return u("calcite-list-item",{class:this.classes(ae.listItem,{[ae.listItemHidden]:n}),description:e.description??"",key:e.uid,label:s,onCalciteListItemSelect:()=>this.emit("select-record",{featureViewModel:e})},this._renderChevronIconNode())}_renderShowAllListItem(){var e;return this.displayShowAllButton?u("calcite-list-item",{description:this.featureCountDescription,key:"show-all-item",label:(e=this.messages)==null?void 0:e.showAll,onCalciteListItemSelect:()=>this.emit("show-all-records")},this._renderShowAllIconNode()):null}_renderNoRelatedFeaturesMessage(){var e;return u("calcite-notice",{icon:"information",key:"no-related-features-message",kind:"brand",open:!0,scale:"s",width:"full"},u("div",{slot:"message"},(e=this.messages)==null?void 0:e.noRelatedFeatures))}_renderFeatureObserver(){return u("div",{afterCreate:this._relatedFeatureIntersectionObserverCreated,bind:this,class:ae.featureObserver,key:"feature-observer"})}_renderList(){const{relatedFeatureViewModels:e}=this.viewModel;return u("calcite-list",null,e.toArray().map(t=>this._renderRelatedFeature(t)),this._renderShowAllListItem())}_renderRelatedFeatures(){const{displayListItems:e}=this,{state:t}=this.viewModel;return u("div",{class:this.classes(ae.listContainer,{[ae.listContainerQuerying]:t==="querying"}),key:"list-container"},e?this._renderList():t==="ready"?this._renderNoRelatedFeaturesMessage():null,this._renderStickyLoading(),this._renderFeatureObserver())}_renderRelationshipNotFound(){var e;return u("calcite-notice",{icon:"exclamation-mark-triangle",key:"relationship-not-found",kind:"danger",open:!0,scale:"s",width:"full"},u("div",{slot:"message"},(e=this.messages)==null?void 0:e.relationshipNotFound))}_setupRelatedFeatureViewModels(){const{relatedFeatureViewModels:e}=this.viewModel,t="related-feature-viewmodels";this.removeHandles(t),e==null||e.forEach(s=>{this.addHandles(f(()=>[s.title,s.state],()=>this.scheduleRender(),H),t)}),this.scheduleRender()}_setupFeatureElementInfo(){var r;const{headingLevel:e,visibleElements:t}=this,s=t.description&&this.description,n=t.title&&this.title;(r=this._featureElementInfo)==null||r.set({description:s,title:n,headingLevel:e})}async _handleRelatedFeatureObserverChange(){this._unobserveRelatedFeatureObserver();const{state:e,showAllEnabled:t}=this.viewModel;await gi(0),this._relatedFeatureIntersectionObserverNode&&e==="ready"&&t&&this._relatedFeatureIntersectionObserver.observe(this._relatedFeatureIntersectionObserverNode)}_relatedFeatureIntersectionObserverCreated(e){this._relatedFeatureIntersectionObserverNode=e}_unobserveRelatedFeatureObserver(){this._relatedFeatureIntersectionObserverNode&&this._relatedFeatureIntersectionObserver.unobserve(this._relatedFeatureIntersectionObserverNode)}};o([l()],G.prototype,"_relatedFeatureIntersectionObserverNode",void 0),o([l({readOnly:!0})],G.prototype,"displayShowAllButton",null),o([l({readOnly:!0})],G.prototype,"displayListItems",null),o([l()],G.prototype,"description",null),o([l({readOnly:!0})],G.prototype,"featureCountDescription",null),o([l()],G.prototype,"headingLevel",void 0),o([l()],G.prototype,"title",null),o([l({type:xt})],G.prototype,"viewModel",void 0),o([l(),Y("esri/widgets/Feature/t9n/Feature")],G.prototype,"messages",void 0),o([l(),Y("esri/t9n/common")],G.prototype,"messagesCommon",void 0),o([l()],G.prototype,"visibleElements",void 0),o([Te("visibleElements")],G.prototype,"castVisibleElements",null),G=o([R("esri.widgets.Feature.FeatureRelationship")],G);const ei=G;let hn=class{constructor(e,t){this.preLayerQueryCallback=e,this.preRequestCallback=t,this.preLayerQueryCallback||(this.preLayerQueryCallback=s=>{}),this.preRequestCallback||(this.preLayerQueryCallback=s=>{})}};var Ne;const pn=1,ti="content-view-models",ii="relationship-view-models",si={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0};let P=Ne=class extends mi(ce){constructor(i){super(i),this._error=null,this._featureAbortController=null,this._graphicChangedThrottled=Qe(this._graphicChanged,pn,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...si},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return e.type==="attachments"&&!!t.attachmentsContent||e.type==="custom"&&!!t.customContent||e.type==="fields"&&!!t.fieldsContent||e.type==="media"&&!!t.mediaContent||e.type==="text"&&!!t.textContent||e.type==="expression"&&!!t.expressionContent||e.type==="relationship"&&!!t.relationshipContent},this.addHandles(f(()=>[this.graphic,this._effectivePopupTemplate,this.abilities],()=>this._graphicChangedThrottled(),H))}initialize(){this.addHandles(this._graphicChangedThrottled)}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return this.graphic!=null?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return gs(jt(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return _i(this.graphic)}castAbilities(i){return{...si,...i}}get isTable(){var i;return((i=this._sourceLayer)==null?void 0:i.isTable)||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(i){this._set("graphic",i?i.clone():null)}get spatialReference(){var i;return((i=this.view)==null?void 0:i.spatialReference)??null}set spatialReference(i){this._override("spatialReference",i)}get map(){var i;return((i=this.view)==null?void 0:i.map)||null}set map(i){this._override("map",i)}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(i,e){const t=this.contentViewModels[i];t instanceof Me&&t.setActiveMedia(e)}nextMedia(i){const e=this.contentViewModels[i];e instanceof Me&&e.next()}previousMedia(i){const e=this.contentViewModels[i];e instanceof Me&&e.previous()}async updateGeometry(){var a;const{graphic:i,spatialReference:e,_sourceLayer:t}=this;await(t==null?void 0:t.load());const s=t==null?void 0:t.objectIdField;if(!s||!i||!t)return;const n=(a=i==null?void 0:i.attributes)==null?void 0:a[s];if(n==null)return;const r=[n];if(!i.geometry){const d=await fs({layer:t,graphic:i,outFields:[],objectIds:r,returnGeometry:!0,spatialReference:e}),c=d==null?void 0:d.geometry;c&&(i.geometry=c)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:i}=this;if(!i)return;const e=new AbortController;this._featureAbortController=e;try{await this._queryFeature({signal:e.signal})}catch(t){Ji(t)||(this._error=t,ie.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:t,graphic:i,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===e&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:i}=this;i&&i.abort(),this._featureAbortController=null}_compileContentElement(i,e){return i.type==="attachments"?this._compileAttachments(i,e):i.type==="custom"?this._compileCustom(i,e):i.type==="fields"?this._compileFields(i,e):i.type==="media"?this._compileMedia(i,e):i.type==="text"?this._compileText(i,e):i.type==="expression"?this._compileExpression(i,e):i.type==="relationship"?this._compileRelationship(i,e):void 0}_compileContent(i){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(i)?i.filter(this._isAllowedContentType).map((e,t)=>this._compileContentElement(e,t)).filter(Ke):typeof i=="string"?this._compileText(new pi({text:i}),0).text:i}_destroyContentViewModels(){this.removeHandles(ii),this.removeHandles(ti),this.contentViewModels.forEach(i=>i&&!i.destroyed&&i.destroy()),this._set("contentViewModels",[])}_matchesFeature(i,e){var n;const t=(n=i==null?void 0:i.graphic)==null?void 0:n.getObjectId(),s=e==null?void 0:e.getObjectId();return t!=null&&s!=null&&t===s}_setRelatedFeaturesViewModels({relatedFeatureViewModels:i,relatedFeatures:e,map:t}){const{view:s,spatialReference:n}=this;e==null||e.filter(Boolean).forEach(r=>{i.find(a=>this._matchesFeature(a,r))||i.add(new Ne({abilities:{relationshipContent:!1},map:t,view:s,spatialReference:n,graphic:r}))}),i.forEach(r=>{(e==null?void 0:e.find(d=>this._matchesFeature(r,d)))||i.remove(r)})}_setExpressionContentVM(i,e){const t=this.formattedAttributes,{contentElement:s,contentElementViewModel:n}=i,r=s==null?void 0:s.type;n&&r&&(r==="fields"&&(this._createFieldsFormattedAttributes({contentElement:s,contentElementIndex:e,formattedAttributes:t}),n.set(this._createFieldsVMParams(s,e))),r==="media"&&(this._createMediaFormattedAttributes({contentElement:s,contentElementIndex:e,formattedAttributes:t}),n.set(this._createMediaVMParams(s,e))),r==="text"&&n.set(this._createTextVMParams(s)))}_compileRelationship(i,e){const{displayCount:t,orderByFields:s,relationshipId:n,title:r,description:a}=i,{_sourceLayer:d,graphic:c,map:h}=this;if(!_s(d))return;const p=new xt({displayCount:t,graphic:c,orderByFields:s,relationshipId:n,layer:d,map:h,...this._compileTitleAndDesc({title:r,description:a})});return this.contentViewModels[e]=p,this.addHandles(Fe(()=>p.relatedFeatures,"change",()=>this._setRelatedFeaturesViewModels(p)),ii),i}_compileExpression(i,e){const{expressionInfo:t}=i,{graphic:s,map:n,spatialReference:r,view:a}=this,d=new $t({expressionInfo:t,graphic:s,interceptor:Ne.interceptor,map:n,spatialReference:r,view:a});return this.contentViewModels[e]=d,this.addHandles(f(()=>d.contentElementViewModel,()=>this._setExpressionContentVM(d,e),H),ti),i}_compileAttachments(i,e){const{graphic:t}=this,{description:s,title:n}=i;return this.contentViewModels[e]=new Et({graphic:t,...this._compileTitleAndDesc({title:n,description:s})}),i}_compileCustom(i,e){const{graphic:t}=this,{creator:s,destroyer:n}=i;return this.contentViewModels[e]=new Xe({graphic:t,creator:s,destroyer:n}),i}_compileTitleAndDesc({title:i,description:e}){const{_fieldInfoMap:t,_sourceLayer:s,graphic:n,formattedAttributes:r}=this,a=n==null?void 0:n.attributes,d=this._expressionAttributes,c=r.global;return{title:be({attributes:a,fieldInfoMap:t,globalAttributes:c,expressionAttributes:d,layer:s,text:i}),description:be({attributes:a,fieldInfoMap:t,globalAttributes:c,expressionAttributes:d,layer:s,text:e})}}_createFieldsVMParams(i,e){const t=this._effectivePopupTemplate,s=this.formattedAttributes,n={...s==null?void 0:s.global,...s==null?void 0:s.content[e]},r=(i==null?void 0:i.fieldInfos)||(t==null?void 0:t.fieldInfos),a=r==null?void 0:r.filter(({fieldName:p})=>wi(p)||we(p)||n.hasOwnProperty(p)),d=t==null?void 0:t.expressionInfos,{description:c,title:h}=i;return{attributes:n,expressionInfos:d,fieldInfos:a,...this._compileTitleAndDesc({title:h,description:c})}}_compileFields(i,e){const t=i.clone(),s=new Ze(this._createFieldsVMParams(i,e));return this.contentViewModels[e]=s,t.fieldInfos=s.formattedFieldInfos.slice(0),t}_createMediaVMParams(i,e){const{abilities:t,graphic:s,_fieldInfoMap:n,_effectivePopupTemplate:r,relatedInfos:a,_sourceLayer:d,_expressionAttributes:c}=this,h=this.formattedAttributes,p=(s==null?void 0:s.attributes)??{},{description:m,mediaInfos:g,title:_}=i;return{abilities:{chartAnimation:t.chartAnimation},activeMediaInfoIndex:i.activeMediaInfoIndex||0,attributes:p,isAggregate:s==null?void 0:s.isAggregate,layer:d,fieldInfoMap:n,formattedAttributes:{...h==null?void 0:h.global,...h==null?void 0:h.content[e]},expressionAttributes:c,mediaInfos:g,popupTemplate:r,relatedInfos:a,...this._compileTitleAndDesc({title:_,description:m})}}_compileMedia(i,e){const t=i.clone(),s=new Me(this._createMediaVMParams(i,e));return t.mediaInfos=s.formattedMediaInfos.slice(0),this.contentViewModels[e]=s,t}_createTextVMParams(i){var r;const{graphic:e,_fieldInfoMap:t,_sourceLayer:s,_expressionAttributes:n}=this;if(i&&i.text){const a=(e==null?void 0:e.attributes)??{},d=((r=this.formattedAttributes)==null?void 0:r.global)??{};i.text=be({attributes:a,fieldInfoMap:t,globalAttributes:d,expressionAttributes:n,layer:s,text:i.text})}return{graphic:e,creator:i.text}}_compileText(i,e){const t=i.clone();return this.contentViewModels[e]=new Xe(this._createTextVMParams(t)),t}_compileLastEditInfo(){const{_effectivePopupTemplate:i,_sourceLayer:e,graphic:t,view:s}=this;if(!i)return;const{lastEditInfoEnabled:n}=i,r=e==null?void 0:e.editFieldsInfo;return n&&r?vs(r,t==null?void 0:t.attributes,(s==null?void 0:s.timeZone)??Be,e):void 0}_compileTitle(i){var d;const{_fieldInfoMap:e,_sourceLayer:t,graphic:s,_expressionAttributes:n}=this,r=(s==null?void 0:s.attributes)??{},a=((d=this.formattedAttributes)==null?void 0:d.global)??{};return be({attributes:r,fieldInfoMap:e,globalAttributes:a,expressionAttributes:n,layer:t,text:i})}async _getTitle(){const{_effectivePopupTemplate:i,graphic:e}=this;if(!e)return null;const t=i==null?void 0:i.title;return Ge(t,{graphic:e})}async _getContent(){const{_effectivePopupTemplate:i,graphic:e}=this;if(!e)return null;const t=i==null?void 0:i.content;return Ge(t,{graphic:e})}async _queryFeature(i){const{_featureAbortController:e,_sourceLayer:t,graphic:s,_effectivePopupTemplate:n}=this,r=this.map,a=this.view,d=this.spatialReference;if(e!==this._featureAbortController||!s)return;await ys({graphic:s,popupTemplate:n,layer:t,spatialReference:d},i);const{content:{value:c},title:{value:h}}=await Ce({content:this._getContent(),title:this._getTitle()}),{expressionAttributes:{value:p}}=await Ce({checkForRelatedFeatures:this._checkForRelatedFeatures(i),expressionAttributes:ln({expressionInfos:n==null?void 0:n.expressionInfos,spatialReference:d,graphic:s,map:r,interceptor:Ne.interceptor,view:a})});e===this._featureAbortController&&s&&(this._expressionAttributes=p,this._graphicExpressionAttributes={...s.attributes,...p},this._set("formattedAttributes",this._createFormattedAttributes(c)),this._set("title",this._compileTitle(h)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(c)||null))}_createMediaFormattedAttributes({contentElement:i,contentElementIndex:e,formattedAttributes:t}){var h;const{_effectivePopupTemplate:s,graphic:n,relatedInfos:r,_sourceLayer:a,_fieldInfoMap:d,_graphicExpressionAttributes:c}=this;t.content[e]=rt({fieldInfos:s==null?void 0:s.fieldInfos,graphic:n,attributes:{...c,...i.attributes},layer:a,fieldInfoMap:d,relatedInfos:r,timeZone:((h=this.view)==null?void 0:h.timeZone)??Be})}_createFieldsFormattedAttributes({contentElement:i,contentElementIndex:e,formattedAttributes:t}){var s;if(i.fieldInfos){const{graphic:n,relatedInfos:r,_sourceLayer:a,_fieldInfoMap:d,_graphicExpressionAttributes:c}=this;t.content[e]=rt({fieldInfos:i.fieldInfos,graphic:n,attributes:{...c,...i.attributes},layer:a,fieldInfoMap:d,relatedInfos:r,timeZone:((s=this.view)==null?void 0:s.timeZone)??Be})}}_createFormattedAttributes(i){var h;const{_effectivePopupTemplate:e,graphic:t,relatedInfos:s,_sourceLayer:n,_fieldInfoMap:r,_graphicExpressionAttributes:a}=this,d=e==null?void 0:e.fieldInfos,c={global:rt({fieldInfos:d,graphic:t,attributes:a,layer:n,fieldInfoMap:r,relatedInfos:s,timeZone:((h=this.view)==null?void 0:h.timeZone)??Be}),content:[]};return Array.isArray(i)&&i.forEach((p,m)=>{p.type==="fields"&&this._createFieldsFormattedAttributes({contentElement:p,contentElementIndex:m,formattedAttributes:c}),p.type==="media"&&this._createMediaFormattedAttributes({contentElement:p,contentElementIndex:m,formattedAttributes:c})}),c}_checkForRelatedFeatures(i){const{graphic:e,_effectivePopupTemplate:t}=this;return this._queryRelatedInfos(e,jt(t),i)}async _queryRelatedInfos(i,e,t){const{relatedInfos:s,_sourceLayer:n}=this;s.clear();const r=(n==null?void 0:n.associatedLayer)!=null?await(n==null?void 0:n.associatedLayer.load(t)):n;if(!r||!i)return;const a=e.filter(h=>h&&we(h.fieldName));if(!(a!=null&&a.length))return;e.forEach(h=>this._configureRelatedInfo(h,r));const d=await zs({relatedInfos:s,layer:r},t);Object.keys(d).forEach(h=>{var g;const p=s.get(h.toString()),m=(g=d[h])==null?void 0:g.value;p&&m&&(p.layerInfo=m.data)});const c=await js({graphic:i,relatedInfos:s,layer:r},t);Object.keys(c).forEach(h=>{var p;Ns((p=c[h])==null?void 0:p.value,s.get(h.toString()))})}_configureRelatedInfo(i,e){const{relatedInfos:t}=this,s=ze(i.fieldName);if(!s)return;const{layerId:n,fieldName:r}=s;if(!n)return;const a=t.get(n.toString())||Vs(n,e);a&&(Us({relatedInfo:a,fieldName:r,fieldInfo:i}),this.relatedInfos.set(n,a))}};P.interceptor=new hn(ws,bs),o([l()],P.prototype,"_error",void 0),o([l()],P.prototype,"_featureAbortController",void 0),o([l({readOnly:!0})],P.prototype,"_effectivePopupTemplate",null),o([l({readOnly:!0})],P.prototype,"_fieldInfoMap",null),o([l({readOnly:!0})],P.prototype,"_sourceLayer",null),o([l()],P.prototype,"abilities",void 0),o([Te("abilities")],P.prototype,"castAbilities",null),o([l({readOnly:!0})],P.prototype,"content",void 0),o([l({readOnly:!0})],P.prototype,"contentViewModels",void 0),o([l()],P.prototype,"description",void 0),o([l({type:Boolean})],P.prototype,"defaultPopupTemplateEnabled",void 0),o([l({readOnly:!0})],P.prototype,"isTable",null),o([l({readOnly:!0})],P.prototype,"state",null),o([l({readOnly:!0})],P.prototype,"formattedAttributes",void 0),o([l({type:ke,value:null})],P.prototype,"graphic",null),o([l({readOnly:!0})],P.prototype,"lastEditInfo",void 0),o([l({readOnly:!0})],P.prototype,"relatedInfos",void 0),o([l()],P.prototype,"spatialReference",null),o([l({readOnly:!0})],P.prototype,"title",void 0),o([l()],P.prototype,"map",null),o([l({readOnly:!0})],P.prototype,"waitingForContent",null),o([l()],P.prototype,"view",void 0),P=Ne=o([R("esri.widgets.FeatureViewModel")],P);const Tt=P,Ei=i=>{let e=class extends i{constructor(){super(...arguments),this.renderNodeContent=t=>di(t)&&!t.destroyed?u("div",{class:O.contentNode,key:t},t.render()):t instanceof HTMLElement?u("div",{afterCreate:this._attachToNode,bind:t,class:O.contentNode,key:t}):Zi(t)?u("div",{afterCreate:this._attachToNode,bind:t.domNode,class:O.contentNode,key:t}):null}_attachToNode(t){const s=this;t.appendChild(s)}};return e=o([R("esri.widgets.Feature.ContentMixin")],e),e};var bt;const ni={title:!0,content:!0,lastEditedInfo:!0},ri="relationship-handles";let B=bt=class extends Ei(Z){constructor(i,e){super(i,e),this._contentWidgets=[],this.flowItems=null,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.visibleElements={...ni},this.viewModel=new Tt}initialize(){this.addHandles(f(()=>{var i;return(i=this.viewModel)==null?void 0:i.contentViewModels},()=>this._setupContentWidgets(),H))}loadDependencies(){return Re({notice:()=>E(()=>import("./calcite-notice-zH528nES.js"),__vite__mapDeps([38,2,3,39,4,23,25,26,27,40,31,1]))})}destroy(){this._destroyContentWidgets()}get graphic(){return this.viewModel.graphic}set graphic(i){this.viewModel.graphic=i}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(i){this.viewModel.defaultPopupTemplateEnabled=i}get isTable(){return this.viewModel.isTable}get label(){var i;return((i=this.messages)==null?void 0:i.widgetLabel)??""}set label(i){this._overrideIfSome("label",i)}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(i){this.viewModel.spatialReference=i}get title(){return this.viewModel.title}castVisibleElements(i){return{...ni,...i}}get map(){return this.viewModel.map}set map(i){this.viewModel.map=i}get view(){return this.viewModel.view}set view(i){this.viewModel.view=i}setActiveMedia(i,e){return this.viewModel.setActiveMedia(i,e)}nextMedia(i){return this.viewModel.nextMedia(i)}previousMedia(i){return this.viewModel.previousMedia(i)}render(){const{state:i}=this.viewModel,e=u("div",{class:O.container,key:"container"},this._renderTitle(),i==="error"?this._renderError():i==="loading"?this._renderLoading():this._renderContentContainer());return u("div",{class:this.classes(O.base,I.widget)},e)}_renderError(){const{messagesCommon:i,messages:e,visibleElements:t}=this;return u("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0,scale:"s"},t.title?u("div",{key:"error-title",slot:"title"},i.errorMessage):null,u("div",{key:"error-message",slot:"message"},e.loadingError))}_renderLoading(){return u("div",{class:O.loadingSpinnerContainer,key:"loading-container"},u("span",{class:this.classes(pe.loadingIndicator,I.rotating,O.spinner)}))}_renderContentContainer(){const{visibleElements:i}=this;return i.content?u("div",{class:O.main},[this._renderContent(),this._renderLastEditInfo()]):null}_renderTitle(){const{visibleElements:i,title:e}=this;return i.title?u(It,{class:O.title,innerHTML:e,level:this.headingLevel}):null}_renderContent(){const i=this.viewModel.content,e="content";if(!i)return null;if(Array.isArray(i))return i.length?u("div",{class:O.contentNode,key:`${e}-content-elements`},i.map(this._renderContentElement,this)):null;if(typeof i=="string"){const t=this._contentWidgets[0];return!t||t.destroyed?null:u("div",{class:this.classes(O.contentNode,O.contentNodeText),key:`${e}-content`},t.render())}return this.renderNodeContent(i)}_renderContentElement(i,e){var s;const{visibleElements:t}=this;if(typeof t.content!="boolean"&&!((s=t.content)!=null&&s[i.type]))return null;switch(i.type){case"attachments":return this._renderAttachments(e);case"custom":return this._renderCustom(i,e);case"fields":return this._renderFields(e);case"media":return this._renderMedia(e);case"text":return this._renderText(i,e);case"expression":return this._renderExpression(e);case"relationship":return this._renderRelationship(e);default:return null}}_renderAttachments(i){const e=this._contentWidgets[i];if(!e||e.destroyed)return null;const{state:t,attachmentInfos:s}=e.viewModel;return t==="loading"||s.length>0?u("div",{class:this.classes(O.contentElement),key:this._buildKey("attachments-element",i)},e.render()):null}_renderRelationship(i){const e=this._contentWidgets[i];return e&&!e.destroyed&&this.flowItems?u("div",{class:O.contentElement,key:this._buildKey("relationship-element",i)},e.render()):null}_renderExpression(i){const e=this._contentWidgets[i];return!e||e.destroyed?null:u("div",{class:O.contentElement,key:this._buildKey("expression-element",i)},e.render())}_renderCustom(i,e){const{creator:t}=i,s=this._contentWidgets[e];return!s||s.destroyed?null:t?u("div",{class:O.contentElement,key:this._buildKey("custom-element",e)},s.render()):null}_renderFields(i){const e=this._contentWidgets[i];return!e||e.destroyed?null:u("div",{class:O.contentElement,key:this._buildKey("fields-element",i)},e.render())}_renderMedia(i){const e=this._contentWidgets[i];return!e||e.destroyed?null:u("div",{class:O.contentElement,key:this._buildKey("media-element",i)},e.render())}_renderLastEditInfo(){const{visibleElements:i,messages:e}=this,{lastEditInfo:t}=this.viewModel;if(!t||!i.lastEditedInfo)return null;const{date:s,user:n}=t,r=t.type==="edit"?n?e.lastEditedByUser:e.lastEdited:n?e.lastCreatedByUser:e.lastCreated,a=oe(r,{date:s,user:n});return u("div",{class:this.classes(O.lastEditedInfo,O.contentElement),key:"edit-info-element"},a)}_renderText(i,e){const t=i.text,s=this._contentWidgets[e];return!s||s.destroyed?null:t?u("div",{class:this.classes(O.contentElement,O.text),key:this._buildKey("text-element",e)},s.render()):null}_buildKey(i,...e){var t,s;return`${i}__${((s=(t=this.viewModel)==null?void 0:t.graphic)==null?void 0:s.uid)||"0"}-${e.join("-")}`}_destroyContentWidget(i){i&&(i.viewModel=null,!i.destroyed&&i.destroy())}_destroyContentWidgets(){this.removeHandles(ri),this._contentWidgets.forEach(i=>this._destroyContentWidget(i)),this._contentWidgets=[]}_addFeatureRelationshipHandles(i){const{flowItems:e,visibleElements:t}=this;this.addHandles([Fe(()=>i,"select-record",({featureViewModel:s})=>{e&&(s.abilities={relationshipContent:!0},e.push(new bt({flowItems:e,viewModel:s,visibleElements:t})))}),Fe(()=>i,"show-all-records",()=>{if(!e)return;const{viewModel:s}=i;s.showAllEnabled=!0;const n=new ei({visibleElements:{title:!1,description:!1},viewModel:s});this._addFeatureRelationshipHandles(n),e.push(n)})],ri)}_setupContentWidgets(){var n;this._destroyContentWidgets();const{headingLevel:i,visibleElements:e}=this,t=(n=this.viewModel)==null?void 0:n.content,{contentViewModels:s}=this.viewModel;if(Array.isArray(t))t.forEach((r,a)=>{if(r.type==="attachments"&&(this._contentWidgets[a]=new Es({displayType:r.displayType,headingLevel:e.title?i+1:i,viewModel:s[a]})),r.type==="fields"&&(this._contentWidgets[a]=new Ii({viewModel:s[a]})),r.type==="media"&&(this._contentWidgets[a]=new Fi({viewModel:s[a]})),r.type==="text"&&(this._contentWidgets[a]=new He({viewModel:s[a]})),r.type==="custom"&&(this._contentWidgets[a]=new He({viewModel:s[a]})),r.type==="expression"&&(this._contentWidgets[a]=new cn({viewModel:s[a]})),r.type==="relationship"){const d=new ei({viewModel:s[a]});this._addFeatureRelationshipHandles(d),this._contentWidgets[a]=d}},this);else{const r=s[0];r&&!r.destroyed&&(this._contentWidgets[0]=new He({viewModel:r}))}this.scheduleRender()}};o([l()],B.prototype,"graphic",null),o([l()],B.prototype,"defaultPopupTemplateEnabled",null),o([l()],B.prototype,"flowItems",void 0),o([l()],B.prototype,"headingLevel",void 0),o([l({readOnly:!0})],B.prototype,"isTable",null),o([l()],B.prototype,"label",null),o([l(),Y("esri/widgets/Feature/t9n/Feature")],B.prototype,"messages",void 0),o([l(),Y("esri/t9n/common")],B.prototype,"messagesCommon",void 0),o([l(),Y("esri/widgets/support/t9n/uriUtils")],B.prototype,"messagesURIUtils",void 0),o([l()],B.prototype,"spatialReference",null),o([l({readOnly:!0})],B.prototype,"title",null),o([l()],B.prototype,"visibleElements",void 0),o([Te("visibleElements")],B.prototype,"castVisibleElements",null),o([l()],B.prototype,"map",null),o([l()],B.prototype,"view",null),o([l({type:Tt})],B.prototype,"viewModel",void 0),B=bt=o([R("esri.widgets.Feature")],B);const mn=B,gn="esri.widgets.CompassViewModel";let Ue=class extends bi{constructor(e){super(e),this.visible=!1}};o([l()],Ue.prototype,"visible",void 0),Ue=o([R(gn)],Ue);const $i=Ue,ft="esri-spinner",_t={base:ft,spinnerStart:`${ft}--start`,spinnerFinish:`${ft}--finish`};let fe=class extends Z{constructor(e,t){super(e,t),this._animationDelay=500,this._animationPromise=null,this.viewModel=new $i}initialize(){this.addHandles(f(()=>this.visible,e=>this._visibleChange(e)))}destroy(){this._animationPromise=null}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}show(e){const{location:t,promise:s}=e??{};t&&(this.viewModel.location=t),this.visible=!0;const n=()=>this.hide();s&&s.catch(()=>{}).then(n)}hide(){this.visible=!1}render(){const{visible:e}=this,{screenLocation:t}=this.viewModel,s=!!t,n=e&&s,r=!e&&s,a={[_t.spinnerStart]:n,[_t.spinnerFinish]:r},d=this._getPositionStyles();return u("div",{class:this.classes(_t.base,a),styles:d})}_visibleChange(e){if(e)return void(this.viewModel.screenLocationEnabled=!0);const t=gi(this._animationDelay);this._animationPromise=t,t.catch(()=>{}).then(()=>{this._animationPromise===t&&(this.viewModel.screenLocationEnabled=!1,this._animationPromise=null)})}_getPositionStyles(){const{screenLocation:e,view:t}=this.viewModel;if(t==null||e==null)return{};const{padding:s}=t;return{left:e.x-s.left+"px",top:e.y-s.top+"px"}}};o([l()],fe.prototype,"location",null),o([l()],fe.prototype,"view",null),o([l({type:$i})],fe.prototype,"viewModel",void 0),o([l()],fe.prototype,"visible",null),fe=o([R("esri.widgets.Spinner")],fe);const fn=fe,z="esri-features",W={icon:`${z}__icon`,actionImage:`${z}__action-image`,base:z,container:`${z}__container`,contentContainer:`${z}__content-container`,contentFeature:`${z}__content-feature`,flowItemCollapsed:`${z}__flow-item--collapsed`,header:`${z}__header`,footer:`${z}__footer`,featureMenuObserver:`${z}__feature-menu-observer`,actionExit:`${z}__action--exit`,loader:`${z}__loader`,featuresHeading:`${z}__heading`,paginationActionBar:`${z}__pagination-action-bar`,paginationPrevious:`${z}__pagination-previous`,paginationNext:`${z}__pagination-next`};let _e=class extends Z{constructor(i,e){super(i,e),this.messages=null,this.closed=!1,this.closable=!0,this._handleOpenRelatedFeature=t=>{this.emit("open-related-feature",{feature:t})}}loadDependencies(){return Re({action:()=>E(()=>import("./calcite-action-mEzyoc-Z.js"),__vite__mapDeps([41,37,2,3,34,21,23,25,26,4,31,27,1,33])),"flow-item":()=>E(()=>import("./calcite-flow-item-mBjWFd-U.js"),__vite__mapDeps([42,2,3,21,23,25,26,4,27,43,34,37,31,1,33,44,45,24,40,46,35]))})}render(){const{flowItems:i}=this,e=i==null?void 0:i.toArray();return u(es,null,e==null?void 0:e.map(t=>this._renderRelatedRecordsFlowItem(t)))}_handleCloseClick(){this.emit("close")}_handleExitClick(){this.emit("exit")}_handleRelatedRecordsBackClick(){var e;const i=(e=this.flowItems)==null?void 0:e.pop();i&&("showAllEnabled"in i.viewModel&&(i.viewModel.showAllEnabled=!1),i&&(i.viewModel=null,i.destroy()))}_renderRelatedRecordsFlowItem(i){const{messages:e,closable:t,closed:s}=this,n="graphic"in i&&!i.isTable;return u("calcite-flow-item",{bind:this,closable:t,closed:s,description:this._getRelatedRecordsFlowItemDescription(i),heading:i.title??"",key:`flow-item-${i.viewModel.uid}`,onCalciteFlowItemBack:this._handleRelatedRecordsBackClick,onCalciteFlowItemClose:this._handleCloseClick},u("calcite-action",{appearance:"transparent",bind:this,class:W.actionExit,icon:"move-up",key:"exit-related-records-action",label:e.exitRelatedRecords,onclick:this._handleExitClick,scale:"m",slot:"header-actions-start",text:e.exitRelatedRecords,title:e.exitRelatedRecords}),n?u("calcite-action",{appearance:"transparent",bind:this,icon:"zoom-to-object",key:"open-related-feature-action",label:e.selectFeature,onclick:()=>this._handleOpenRelatedFeature(i),scale:"m",slot:"header-actions-end",text:e.selectFeature,title:e.selectFeature}):null,u("div",{class:W.container},i.render()))}_getRelatedRecordsFlowItemDescription(i){return"featureCountDescription"in i?i.featureCountDescription:i.viewModel.description??""}};o([l()],_e.prototype,"flowItems",void 0),o([l(),Y("esri/widgets/Features/t9n/Features")],_e.prototype,"messages",void 0),o([l()],_e.prototype,"closed",void 0),o([l()],_e.prototype,"closable",void 0),_e=o([R("esri.widgets.Features.FeaturesRelatedRecords")],_e);const _n=_e,vn="esri.widgets.Popup.PopupViewModel",Ye=ie.getLogger(vn),yn=i=>{const{event:e,view:t,viewModel:s}=i,{action:n}=e;if(!n)return Promise.reject(new k("trigger-action:missing-arguments","Event has no action"));const{disabled:r,id:a}=n;if(!a)return Promise.reject(new k("trigger-action:invalid-action","action.id is missing"));if(r)return Promise.reject(new k("trigger-action:invalid-action","Action is disabled"));if(a===ye.id)return bn(s).catch(ts);if(a===xe.id)return Mn(s);if(a===me.id)return s.browseClusterEnabled=!s.browseClusterEnabled,s.featureMenuOpen=s.browseClusterEnabled,Promise.resolve();if(a===St.id){s.visible=!1;const{selectedFeature:d}=s;if(!d)return Promise.reject(new k(`trigger-action:${St.id}`,"selectedFeature is required",{selectedFeature:d}));const{sourceLayer:c}=d;return c?c.remove(d):t==null||t.graphics.remove(d),Promise.resolve()}return Promise.resolve()};function xi(i){const{selectedFeature:e,location:t,view:s}=i;return s?e??t??null:null}function ve(i){var e,t;return!!i&&i.isAggregate&&((t=(e=i.sourceLayer)==null?void 0:e.featureReduction)==null?void 0:t.type)==="cluster"}async function wn(i,e){if((e==null?void 0:e.type)!=="3d"||!i||i.declaredClass!=="esri.Graphic")return!0;const t=e.getViewForGraphic(i);if(t&&"whenGraphicBounds"in t){let s=null;try{s=await t.whenGraphicBounds(i,{useViewElevation:!0})}catch{}return!s||!s.boundingBox||s.boundingBox[0]===s.boundingBox[3]&&s.boundingBox[1]===s.boundingBox[4]&&s.boundingBox[2]===s.boundingBox[5]}return!0}async function bn(i){var p;const{location:e,selectedFeature:t,view:s,zoomFactor:n}=i,r=xi(i);if(!s||!r){const m=new k("zoom-to:invalid-target-or-view","Cannot zoom to location without a target and view.",{target:r,view:s});throw Ye.error(m),m}const a=s.scale/n,d=(p=i.selectedFeature)==null?void 0:p.geometry,c=d??e,h=c!=null&&c.type==="point"&&await wn(t,s);ye.active=!0,ye.disabled=!0;try{await i.zoomTo({target:{target:r,scale:h?a:void 0}})}catch{const g=new k("zoom-to:invalid-graphic","Could not zoom to the location of the graphic.",{graphic:t});Ye.error(g)}finally{ye.active=!1,ye.disabled=!1,i.zoomToLocation=null,h&&(i.location=c)}}async function Mn(i){const{selectedFeature:e,view:t}=i;if((t==null?void 0:t.type)!=="2d"){const a=new k("zoomToCluster:invalid-view","View must be 2d MapView.",{view:t});throw Ye.error(a),a}if(!e||!ve(e)){const a=new k("zoomToCluster:invalid-selectedFeature","Selected feature must represent an aggregate/cluster graphic.",{selectedFeature:e});throw Ye.error(a),a}const[s,n]=await kt(t,e);xe.active=!0,xe.disabled=!0;const{extent:r}=await s.queryExtent(n);await i.zoomTo({target:r}),xe.active=!1,xe.disabled=!1}async function In(i){const{view:e,selectedFeature:t}=i;if(!e||!t)return;const[s,n]=await kt(e,t),{extent:r}=await s.queryExtent(n);i.selectedClusterBoundaryFeature.geometry=r,e.graphics.add(i.selectedClusterBoundaryFeature)}async function Fn(i){const{selectedFeature:e,view:t}=i;if(!t||!e)return;const[s,n]=await kt(t,e);me.active=!0,me.disabled=!0;const{features:r}=await s.queryFeatures(n);me.active=!1,me.disabled=!1,me.value=!0,i==null||i.open({features:[e].concat(r),featureMenuOpen:!0})}async function kt(i,e){const t=await i.whenLayerView(e.sourceLayer),s=t.createQuery(),n=e.getObjectId();return s.aggregateIds=n!=null?[n]:[],[t,s]}function An(i){me.value=!1;const e=i.features.filter(t=>ve(t));e.length&&(i.features=e)}function Ti(i){var e;if(i==null)return null;switch(i.type){case"point":return i;case"extent":return i.center;case"polygon":return i.centroid;case"multipoint":case"polyline":return(e=i.extent)==null?void 0:e.center;default:return null}}const Cn=()=>[ye.clone()],En=()=>[xe.clone(),me.clone()];let M=class extends is(bi){constructor(e){super(e),this._pendingPromises=new Is,this._fetchFeaturesController=null,this._highlightSelectedFeaturePromise=null,this._highlightActiveFeaturePromise=null,this._selectedClusterFeature=null,this.actions=new Ie,this.activeFeature=null,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new ke({symbol:new ss({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null}initialize(){this.addHandles([this.on("view-change",()=>this._autoClose()),f(()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view],()=>this._highlightSelectedFeature()),f(()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view],()=>this._highlightActiveFeature()),f(()=>{var e,t;return(t=(e=this.view)==null?void 0:e.animation)==null?void 0:t.state},e=>this._animationStateChange(e)),f(()=>this.location,e=>this._locationChange(e)),f(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),f(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),f(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels],()=>this._setGraphicOnFeatureViewModels()),f(()=>this.featureViewModels,()=>this._featureViewModelsChange()),this.on("trigger-action",e=>yn({event:e,viewModel:this,view:this.view})),yt(()=>!this.waitingForResult,()=>this._waitingForResultChange(),ns),f(()=>{var e,t;return[this.features,(e=this.view)==null?void 0:e.map,(t=this.view)==null?void 0:t.spatialReference]},()=>this._updateFeatureVMs()),f(()=>{var e;return(e=this.view)==null?void 0:e.scale},()=>this._viewScaleChange()),yt(()=>!this.visible,()=>this.browseClusterEnabled=!1),f(()=>this.browseClusterEnabled,e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing())])}destroy(){this._cancelFetchingFeatures(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new Ie;e.removeAll();const{actions:t,defaultActions:s,defaultPopupTemplateEnabled:n,includeDefaultActions:r,selectedFeature:a}=this,d=r?s.concat(t):t,c=a&&(typeof a.getEffectivePopupTemplate=="function"&&a.getEffectivePopupTemplate(n)||a.popupTemplate),h=c==null?void 0:c.actions,p=c!=null&&c.overwriteActions?h:(h==null?void 0:h.concat(d))??d;return p==null||p.filter(Boolean).forEach(m=>e.add(m)),e}get defaultActions(){const e=this._get("defaultActions")||new Ie;return e.removeAll(),e.addMany(ve(this.selectedFeature)?En():Cn()),e}get featureCount(){return this.features.length}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:s,promiseCount:n,selectedFeatureIndex:r}=this,a=n&&t.length;a&&s&&r===-1?this.selectedFeatureIndex=0:a&&r!==-1||(this.selectedFeatureIndex=t.length?0:-1)}set location(e){var r,a,d;let t=e;const s=(a=(r=this.view)==null?void 0:r.spatialReference)==null?void 0:a.isWebMercator;((d=e==null?void 0:e.spatialReference)==null?void 0:d.isWGS84)&&s&&(t=rs(e)),this._set("location",t)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice(0)).forEach(t=>{this._pendingPromises.add(t);const s=r=>{this._pendingPromises.has(t)&&this._updateFeatures(r),this._updatePendingPromises(t)},n=()=>this._updatePendingPromises(t);t.then(s,n)})):this._set("promises",[])}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;return t===-1?null:e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return typeof e=="number"?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){var e;return(e=this.view)!=null&&e.ready?"ready":"disabled"}get waitingForContents(){return this.featureViewModels.some(e=>e.waitingForContent)}get waitingForResult(){return!(!(this._fetchFeaturesController||this.pendingPromisesCount>0)||this.featureCount!==0)}centerAtLocation(){const{view:e}=this,t=xi(this);return t&&e?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new k("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:s}=this;if(!s||!e)throw new k("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:s});return s.fetchPopupFeatures(e,{event:t==null?void 0:t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t==null?void 0:t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:s}=t;delete t.fetchFeatures,s&&this._setFetchFeaturesPromises(t.location);const n=["actionsMenuOpen","collapsed"];for(const r of n)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex++,this}previous(){return this.selectedFeatureIndex--,this}disableClusterBrowsing(){An(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;(e==null?void 0:e.type)==="2d"?ve(t)?(await In(this),await Fn(this)):ie.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):ie.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}handleViewClick(e){this.autoOpenEnabled&&this._fetchFeaturesAndOpen(e)}_animationStateChange(e){this.zoomToLocation||(ye.disabled=e==="waiting-for-target")}_clearBrowsedClusterGraphics(){var t,s;const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(Ke);(s=(t=this.view)==null?void 0:t.graphics)==null||s.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(ve(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:s}=this;s&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:s,featuresPerPage:n,featureViewModels:r}=this;if(s===null)return;const a=((s-1)*n+t)%t,d=a+n;r.slice(a,d).forEach((c,h)=>{c&&(c.graphic??(c.graphic=e[a+h]))})}async _selectedFeatureChange(e){var r;const{location:t,updateLocationEnabled:s,view:n}=this;if(e&&n){if(this.browseClusterEnabled)return this._selectedClusterFeature&&(n.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),ve(e)?void 0:(e.symbol=await os(e),this._selectedClusterFeature=e,void n.graphics.add(this._selectedClusterFeature));if(!s&&t||!e.geometry){if(s&&!e.geometry){await this.centerAtLocation();const a=(r=n.center)==null?void 0:r.clone();a&&(this.location=a)}}else this.location=Ti(e.geometry)}}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{clientOnlyGraphics:t,promisesPerLayerView:s}=await this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)),n=Promise.resolve(t),r=s.map(a=>a.promise);this.promises=[n,...r]}_destroyFeatureVMs(){this.featureViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:s,view:n}=this;if(ve(e)||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!(t!=null&&t.length))return;const r=s.slice(0),a=[];t.forEach((d,c)=>{if(!d)return;let h=null;if(r.some((p,m)=>(p&&p.graphic===d&&(h=p,r.splice(m,1)),!!h)),h)a[c]=h;else{const p=new Tt({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:n==null?void 0:n.spatialReference,graphic:d===e?d:null,map:n==null?void 0:n.map,view:n});a[c]=p}}),r.forEach(d=>d&&!d.destroyed&&d.destroy()),this._set("featureViewModels",a)}_getScreenPoint(e){const{view:t}=this;return t&&e&&typeof t.toScreen=="function"?t.toScreen(e):null}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const s=new AbortController,{signal:n}=s;this._fetchFeaturesController=s;const r=this.fetchFeatures(e,{signal:n,event:t});return r.catch(()=>{}).then(()=>{this._fetchFeaturesController=null}),r}async _fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:s}=e,{view:n}=this,{clientOnlyGraphics:r,promisesPerLayerView:a,location:d}=await this._fetchFeaturesWithController(t,e),c=[Promise.resolve(r),...a.map(h=>h.promise)];n!=null&&n.popup&&"open"in n.popup&&n.popup.open({location:d||s,promises:c})}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&this._pendingPromises.delete(e)}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:s}=e;return s&&"layer"in s&&s.layer?s.layer:(s==null?void 0:s.type)==="map-notes"||(s==null?void 0:s.type)==="subtype-group"?s:t}_getHighlightTarget(e,t){const s=t.type==="imagery"?void 0:"objectIdField"in t?t.objectIdField||as:null,n=e.attributes;return n&&s&&n[s]||e}_mapIncludesLayer(e){var t,s,n;return!!((n=(s=(t=this.view)==null?void 0:t.map)==null?void 0:s.allLayers)!=null&&n.includes(e))}async _highlightActiveFeature(){const e="highlight-active-feature";this.removeHandles(e);const{highlightEnabled:t,view:s,activeFeature:n,visible:r}=this;if(!(n&&s&&t&&r))return;const a=this._getHighlightLayer(n);if(!(a&&a instanceof Dt&&this._mapIncludesLayer(a)))return;const d=this._getLayerView(s,a);this._highlightActiveFeaturePromise=d;const c=await d;if(!(c&&Bt(c)&&this._highlightActiveFeaturePromise===d&&this.activeFeature&&this.highlightEnabled))return;const h=c.highlight(this._getHighlightTarget(n,a));this.addHandles(h,e)}async _highlightSelectedFeature(){const e="highlight-selected-feature";this.removeHandles(e);const{selectedFeature:t,highlightEnabled:s,view:n,visible:r}=this;if(!(t&&n&&s&&r))return;const a=this._getHighlightLayer(t);if(!(a&&a instanceof Dt&&this._mapIncludesLayer(a)))return;const d=this._getLayerView(n,a);this._highlightSelectedFeaturePromise=d;const c=await d;if(!(c&&Bt(c)&&this._highlightSelectedFeaturePromise===d&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const h=c.highlight(this._getHighlightTarget(t,a));this.addHandles(h,e)}_updateFeatures(e){const{features:t}=this;if(!(e!=null&&e.length))return;if(!t.length)return void(this.features=e);const s=e.filter(n=>!t.includes(n));this.features=t.concat(s)}};o([l()],M.prototype,"_fetchFeaturesController",void 0),o([l({type:Ie})],M.prototype,"actions",void 0),o([l({readOnly:!0})],M.prototype,"active",null),o([l()],M.prototype,"activeFeature",void 0),o([l({readOnly:!0})],M.prototype,"allActions",null),o([l()],M.prototype,"autoCloseEnabled",void 0),o([l()],M.prototype,"autoOpenEnabled",void 0),o([l()],M.prototype,"browseClusterEnabled",void 0),o([l()],M.prototype,"content",void 0),o([l({type:Ie,readOnly:!0})],M.prototype,"defaultActions",null),o([l({type:Boolean})],M.prototype,"defaultPopupTemplateEnabled",void 0),o([l({readOnly:!0})],M.prototype,"featureCount",null),o([l()],M.prototype,"featurePage",void 0),o([l({value:[]})],M.prototype,"features",null),o([l()],M.prototype,"featuresPerPage",void 0),o([l()],M.prototype,"featureMenuOpen",void 0),o([l()],M.prototype,"featureViewModelAbilities",void 0),o([l({readOnly:!0})],M.prototype,"featureViewModels",void 0),o([l()],M.prototype,"highlightEnabled",void 0),o([l()],M.prototype,"includeDefaultActions",void 0),o([l({type:ls})],M.prototype,"location",null),o([l({readOnly:!0})],M.prototype,"pendingPromisesCount",null),o([l({readOnly:!0})],M.prototype,"promiseCount",null),o([l()],M.prototype,"promises",null),o([l({readOnly:!0})],M.prototype,"selectedClusterBoundaryFeature",void 0),o([l({value:null,readOnly:!0})],M.prototype,"selectedFeature",null),o([l({value:-1})],M.prototype,"selectedFeatureIndex",null),o([l({readOnly:!0})],M.prototype,"selectedFeatureViewModel",null),o([l({readOnly:!0})],M.prototype,"state",null),o([l()],M.prototype,"title",void 0),o([l()],M.prototype,"updateLocationEnabled",void 0),o([l()],M.prototype,"view",void 0),o([l()],M.prototype,"visible",void 0),o([l({readOnly:!0})],M.prototype,"waitingForContents",null),o([l({readOnly:!0})],M.prototype,"waitingForResult",null),o([l()],M.prototype,"zoomFactor",void 0),o([l()],M.prototype,"zoomToLocation",void 0),o([l()],M.prototype,"centerAtLocation",null),M=o([R("esri.widgets.Features.FeaturesViewModel")],M);const Rt=M;let de=class extends ce{constructor(){super(...arguments),this.actionBar=!0,this.closeButton=!0,this.collapseButton=!1,this.featureNavigation=!0,this.heading=!0,this.spinner=!0}};o([l({type:Boolean,nonNullable:!0})],de.prototype,"actionBar",void 0),o([l({type:Boolean,nonNullable:!0})],de.prototype,"closeButton",void 0),o([l({type:Boolean,nonNullable:!0})],de.prototype,"collapseButton",void 0),o([l({type:Boolean,nonNullable:!0})],de.prototype,"featureNavigation",void 0),o([l({type:Boolean,nonNullable:!0})],de.prototype,"heading",void 0),o([l({type:Boolean,nonNullable:!0})],de.prototype,"spinner",void 0),de=o([R("esri.widgets.Features.FeaturesVisibleElements")],de);const ki=de,oi="selected-index",$n=0,ai="features-spinner",xn=50;let x=class extends Ei(Z){constructor(i,e){super(i,e),this._featureMenuIntersectionObserverCallback=([t])=>{t!=null&&t.isIntersecting&&this.viewModel.featurePage!=null&&this.viewModel.featurePage++},this._featureMenuIntersectionObserver=new IntersectionObserver(this._featureMenuIntersectionObserverCallback,{root:window.document}),this._featureMenuIntersectionObserverNode=null,this._focusOn=null,this._spinner=null,this._feature=null,this._relatedRecordsFlowItems=new De,this._relatedRecordsWidget=new _n({flowItems:this._relatedRecordsFlowItems}),this._rootFlowItemNode=null,this._featureMenuViewportNode=null,this.collapsed=!1,this.icon=null,this.featureNavigationTop=!1,this.headerActions=new Ie,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.responsiveActionsEnabled=!1,this.viewModel=new Rt,this.visibleElements=new ki,this._renderAction=(t,s)=>{const n=this._getActionTitle(t),{type:r,active:a,uid:d,disabled:c,indicator:h}=t;return t.visible?u("calcite-action",{active:r==="toggle"&&t.value,appearance:"solid",bind:this,"data-action-uid":d,disabled:c,icon:this._getActionIcon(t),indicator:h,key:`action-${s}`,loading:a,onclick:this._triggerAction,scale:"s",text:n,title:this._hideActionText?n:void 0},this._getFallbackIcon(t)):null},this._openFeatureMenu=()=>{this.featureMenuOpen=!0},this._previousFeature=()=>{this.viewModel.selectedFeatureIndex--},this._nextFeature=()=>{this.viewModel.selectedFeatureIndex++},this._handleFeatureMenuBack=()=>{this.featureMenuOpen&&(this._focusOn="root-flow-item",this.featureMenuOpen=!1)},this._focusFlowItemNode=t=>{this._focusOn===t&&requestAnimationFrame(async()=>{var s,n;switch(t){case"menu-flow-item":await((s=this._featureMenuViewportNode)==null?void 0:s.setFocus());break;case"root-flow-item":await((n=this._rootFlowItemNode)==null?void 0:n.setFocus())}this._focusOn=null})},this._focusFlowItemNodeThrottled=Qe(this._focusFlowItemNode,xn),this._displaySpinnerThrottled=Qe(()=>this._displaySpinner(),$n),this._addSelectedFeatureIndexHandle(),this.addHandles([this._displaySpinnerThrottled,this._focusFlowItemNodeThrottled,f(()=>{var t;return(t=this.viewModel)==null?void 0:t.active},()=>this._toggleScreenLocationEnabled()),f(()=>{var t;return(t=this.viewModel)==null?void 0:t.active},t=>this._relatedRecordsWidget.closed=!t),f(()=>{var t;return(t=this.visibleElements)==null?void 0:t.closeButton},t=>this._relatedRecordsWidget.closable=t),f(()=>{var t;return(t=this.visibleElements)==null?void 0:t.spinner},t=>this._spinnerEnabledChange(t)),f(()=>{var t;return(t=this.viewModel)==null?void 0:t.view},(t,s)=>this._viewChange(t,s)),f(()=>{var t,s;return(s=(t=this.viewModel)==null?void 0:t.view)==null?void 0:s.ready},(t,s)=>this._viewReadyChange(t??!1,s??!1)),f(()=>{var t,s;return[(t=this.viewModel)==null?void 0:t.waitingForResult,(s=this.viewModel)==null?void 0:s.location]},()=>{this._hideSpinner(),this._displaySpinnerThrottled()}),f(()=>this.selectedFeatureWidget,()=>this._destroyRelatedRecordsFlowItemWidgets()),f(()=>{var s;const t=(s=this.selectedFeatureWidget)==null?void 0:s.viewModel;return[t==null?void 0:t.title,t==null?void 0:t.state]},()=>this._setTitleFromFeatureWidget()),f(()=>{var s;const t=(s=this.selectedFeatureWidget)==null?void 0:s.viewModel;return[t==null?void 0:t.content,t==null?void 0:t.state]},()=>this._setContentFromFeatureWidget()),f(()=>{var t;return(t=this.viewModel)==null?void 0:t.featureViewModels},()=>this._featureMenuViewportScrollTop()),this._relatedRecordsWidget.on("close",()=>this.close()),this._relatedRecordsWidget.on("exit",()=>this._destroyRelatedRecordsFlowItemWidgets()),this._relatedRecordsWidget.on("open-related-feature",({feature:t})=>this._openRelatedFeature(t))])}loadDependencies(){return Re({action:()=>E(()=>import("./calcite-action-mEzyoc-Z.js"),__vite__mapDeps([41,37,2,3,34,21,23,25,26,4,31,27,1,33])),"action-bar":()=>E(()=>import("./calcite-action-bar-yKX8eCZY.js"),__vite__mapDeps([47,2,3,39,4,23,25,26,27,48,43,34,37,21,31,1,33,44,45,24,40,46])),"action-group":()=>E(()=>import("./calcite-action-group-_Xoggrsa.js"),__vite__mapDeps([49,48,2,3,39,4,23,25,26,27,43,34,37,21,31,1,33,44,45,24,40,46])),button:()=>E(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([50,51,2,3,29,21,30,23,25,26,4,31,27,1,33,34])),flow:()=>E(()=>import("./calcite-flow-A39UdeqN.js"),__vite__mapDeps([52,2,3,4,23])),"flow-item":()=>E(()=>import("./calcite-flow-item-mBjWFd-U.js"),__vite__mapDeps([42,2,3,21,23,25,26,4,27,43,34,37,31,1,33,44,45,24,40,46,35])),list:()=>E(()=>import("./calcite-list-LJfGqLbO.js"),__vite__mapDeps([20,2,3,21,4,22,23,24,25,26,27,1,28,29,30,31,32,33,34,35])),"list-item":()=>E(()=>import("./calcite-list-item-OtIyVNHT.js"),__vite__mapDeps([36,2,3,21,22,25,26,4,27,23,37,34,31,1,33])),"list-item-group":()=>E(()=>import("./calcite-list-item-group-havhVECR.js"),__vite__mapDeps([53,2,3,21,22])),loader:()=>E(()=>import("./calcite-loader-Z65agR8e.js"),__vite__mapDeps([54,33,2,3,34]))})}destroy(){var i,e;this._destroyRelatedRecordsFlowItemWidgets(),this._destroySelectedFeatureWidget(),this._destroySpinner(),this._unobserveFeatureMenuObserver(),(i=this._featureMenuIntersectionObserver)==null||i.disconnect(),(e=this._relatedRecordsWidget)==null||e.destroy()}get _hideActionText(){var e;if(!this.responsiveActionsEnabled)return!1;const i=(e=this.view)==null?void 0:e.widthBreakpoint;return i==="xsmall"||i==="small"||i==="medium"}get _featureNavigationVisible(){return this.viewModel.active&&this.viewModel.featureCount>1&&this.visibleElements.featureNavigation}get _isCollapsed(){return this._collapseEnabled&&this.collapsed}get _collapseEnabled(){return this.visibleElements.collapseButton&&!!this.title&&!!this.content}get content(){return this.viewModel.content}set content(i){this.viewModel.content=i}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(i){this.viewModel.featureMenuOpen=i}get features(){return this.viewModel.features}set features(i){this.viewModel.features=i}get location(){return this.viewModel.location}set location(i){this.viewModel.location=i}get label(){var i;return((i=this.messages)==null?void 0:i.widgetLabel)??""}set label(i){this._overrideIfSome("label",i)}get promises(){return this.viewModel.promises}set promises(i){this.viewModel.promises=i}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(i){this.viewModel.selectedFeatureIndex=i}get selectedFeatureWidget(){const{_feature:i,headingLevel:e,_relatedRecordsFlowItems:t}=this,{selectedFeatureViewModel:s}=this.viewModel,n={title:!1};return s?(i?(i.viewModel=s,i.visibleElements=n):this._feature=new mn({flowItems:t,headingLevel:e+1,viewModel:s,visibleElements:n}),this._feature):null}get title(){return this.viewModel.title}set title(i){this.viewModel.title=i}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(i){this.viewModel.updateLocationEnabled=i}get view(){return this.viewModel.view}set view(i){this.viewModel.view=i}get visible(){return this.viewModel.visible}set visible(i){this.viewModel.visible=i}blur(){var e;const{active:i}=this.viewModel;i?(e=this._rootFlowItemNode)==null||e.blur():ie.getLogger(this).warn("Features can only be blurred when currently active.")}clear(){return this.viewModel.clear()}close(){this.viewModel.visible=!1}fetchFeatures(i,e){return this.viewModel.fetchFeatures(i,e)}focus(){const{active:i}=this.viewModel;i?this._setFocusOn():ie.getLogger(this).warn("Features can only be focused when currently active.")}next(){return this.viewModel.next()}open(i){this.removeHandles(oi);const e={collapsed:(i==null?void 0:i.collapsed)??!1};this.set(e),this.viewModel.open(i),this.addHandles(yt(()=>!this.viewModel.waitingForResult,()=>this._addSelectedFeatureIndexHandle(),{once:!0}))}previous(){return this.viewModel.previous()}triggerAction(i){return this.viewModel.triggerAction(i)}render(){return u("div",{bind:this,class:this.classes(W.base,I.widget,I.panel),onkeydown:this._onMainKeydown},this._renderHeader(),this._renderContentContainer())}_renderFeatureNavigation(){return[this._renderPagination(),this._renderFeatureMenuButton()]}_renderHeader(){return!this.featureMenuOpen&&this.featureNavigationTop&&this._featureNavigationVisible?u("div",{class:W.header,key:"header-actions"},this._renderFeatureNavigation()):null}_renderFooter(){return this.featureMenuOpen||this.featureNavigationTop||!this._featureNavigationVisible?null:u("div",{class:W.footer,key:"footer-actions",slot:"footer"},this._renderFeatureNavigation())}_renderFeatureMenuButton(){const{messages:i,viewModel:e}=this,{featureCount:t,selectedFeatureIndex:s,pendingPromisesCount:n}=e;return u("calcite-action",{appearance:"solid",bind:this,icon:"list",key:"feature-menu-button",label:i.selectFeature,loading:n>0,onclick:this._openFeatureMenu,scale:"s",text:oe(i.pageText,{index:Wt(s+1),total:Wt(t)}),textEnabled:!0,title:i.selectFeature})}_renderPagination(){const{previous:i,next:e}=this.messagesCommon.pagination;return u("calcite-action-bar",{class:W.paginationActionBar,expandDisabled:!0,key:"pagination-action-bar",layout:"horizontal",overflowActionsDisabled:!0,scale:"s"},u("calcite-action-group",{scale:"s"},u("calcite-action",{appearance:"solid",class:W.paginationPrevious,icon:"chevron-left",iconFlipRtl:!0,label:i,onclick:this._previousFeature,scale:"s",text:i,title:i}),u("calcite-action",{appearance:"solid",icon:"chevron-right",iconFlipRtl:!0,label:e,onclick:this._nextFeature,scale:"s",text:e,title:e})))}_renderFeatureMenuItem(i){const{selectedFeatureViewModel:e,featureViewModels:t}=this.viewModel,s=i===e,n=t.indexOf(i);return u("calcite-list-item",{bind:this,"data-feature-index":n,key:`feature-menu-item-${i.uid}`,onblur:this._removeActiveFeature,onfocus:this._setActiveFeature,onmouseleave:this._removeActiveFeature,onmouseover:this._setActiveFeature,selected:s,onCalciteListItemSelect:this._selectFeature},u("span",{innerHTML:i.title||this.messagesCommon.untitled,slot:"content"}))}_groupResultsByLayer(){const{featureViewModels:i}=this.viewModel,e=new Map;return i.forEach(t=>{const s=t==null?void 0:t.graphic;if(!s)return;const n=s.sourceLayer??s.layer,r=e.get(n)??[];e.set(n,[...r,t])}),e}_renderFeatureMenu(){const{featureViewModels:i}=this.viewModel,e=this._groupResultsByLayer();return i.length?u("calcite-list",{selectionAppearance:"icon",selectionMode:"single"},Array.from(e.keys()).map(t=>{var s;return u("calcite-list-item-group",{heading:(t==null?void 0:t.title)??this.messagesCommon.untitled,key:(t==null?void 0:t.uid)||"untitled"},(s=e.get(t))==null?void 0:s.map(n=>this._renderFeatureMenuItem(n)))})):null}_renderHeaderAction(i,e){return i.visible?u("calcite-action",{active:i.type==="toggle"&&i.value,appearance:"solid",bind:this,"data-action-uid":i.uid,disabled:i.disabled,icon:i.icon||"",indicator:i.indicator,key:`header-action-${e}`,loading:i.active,onclick:this._triggerHeaderAction,scale:"m",slot:"header-actions-end",text:i.title||"",title:i.title||""}):null}_renderHeaderActions(){return this.headerActions.map((i,e)=>this._renderHeaderAction(i,e)).toArray()}_renderContentFeature(){const{headingLevel:i,visibleElements:e,_isCollapsed:t,_collapseEnabled:s,featureNavigationTop:n}=this,{title:r,active:a}=this.viewModel,d=e.heading&&r?r:"";return u("calcite-flow-item",{afterCreate:this._storeRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,class:this.classes({[W.contentFeature]:!0,[W.flowItemCollapsed]:t}),closable:e.closeButton,closed:!a,collapsed:t,collapseDirection:n?"down":"up",collapsible:s,headingLevel:i,key:"root-flow-item",onCalciteFlowItemClose:this.close,onCalciteFlowItemToggle:this._handleCollapseToggle},d?u(It,{class:this.classes(W.featuresHeading,I.heading),innerHTML:d,key:"header-content",level:this.headingLevel,slot:"header-content"}):null,this._renderHeaderActions(),this._renderActionBar(),t?null:u("div",{class:this.classes(W.container,W.contentContainer)},this._renderContent()),this._renderFooter())}_renderFeatureMenuContainer(){const{viewModel:i,featureMenuOpen:e,messages:t,messagesCommon:s}=this,{active:n,featureViewModels:r,pendingPromisesCount:a}=i;return e?u("calcite-flow-item",{afterCreate:this._storeFeatureMenuFlowItemNode,afterUpdate:this._focusFeatureMenuFlowItemNode,bind:this,closable:!1,closed:!n,description:oe(t.total,{total:r.length}),heading:t.selectFeature,key:"feature-menu",loading:i.waitingForContents,onCalciteFlowItemBack:this._handleFeatureMenuBack},a>0?u("calcite-loader",{class:W.loader,inline:!0,key:"feature-menu-loader",label:s.loading,scale:"m",slot:"header-actions-end"}):null,u("div",{class:W.container},this._renderFeatureMenu()),u("div",{afterCreate:this._featureMenuIntersectionObserverCreated,bind:this,class:W.featureMenuObserver}),u("calcite-button",{appearance:"transparent",onclick:this._handleFeatureMenuBack,slot:"footer-actions",width:"full"},s.back)):null}_renderContentContainer(){return u("calcite-flow",{key:"content-container"},this._renderContentFeature(),this._renderFeatureMenuContainer(),this._relatedRecordsWidget.render())}_getIconStyles(i){return{"background-image":i?`url(${i})`:""}}_getActionImage(i){const{selectedFeature:e}=this,t=e==null?void 0:e.attributes,{image:s}=i;return s&&t?oe(s,t):s??""}_getFallbackIcon(i){const{className:e,icon:t}=i;if(t)return null;const s=this._getActionImage(i),n={[W.icon]:!!e,[W.actionImage]:!!s};return e&&(n[e]=!0),s||e?u("span",{"aria-hidden":"true",class:this.classes(W.icon,n),key:"icon",styles:s?this._getIconStyles(s):{}}):null}_renderActionBar(){var i;return!this._isCollapsed&&this.visibleElements.actionBar&&((i=this.viewModel.allActions)!=null&&i.length)?u("calcite-action-bar",{expandDisabled:!0,expanded:!this._hideActionText,key:"header-action-bar",scale:"s",slot:"action-bar"},u("calcite-action-group",{overlayPositioning:"fixed",scale:"s"},this._renderActions())):null}_renderActions(){return this.viewModel.allActions.toArray().map(this._renderAction)}_renderContent(){var e;const i=(e=this.viewModel)==null?void 0:e.content;return i?typeof i=="string"?u("div",{class:O.contentNode,innerHTML:i,key:i}):this.renderNodeContent(i):null}_setFocusOn(){this._focusOn=this.featureMenuOpen?"menu-flow-item":"root-flow-item",this.renderNow()}_handleCollapseToggle(){this.collapsed=!this.collapsed}async _openRelatedFeature(i){await i.viewModel.updateGeometry();const e=i.graphic,t=e==null?void 0:e.geometry;if(t==null||e==null)return;this._destroyRelatedRecordsFlowItemWidgets(),await this.viewModel.zoomTo({target:t});const s=Ti(t);this.open({features:[e],location:s??void 0})}_focusRootFlowItemNode(){this._focusFlowItemNodeThrottled("root-flow-item")}_focusFeatureMenuFlowItemNode(){this._focusFlowItemNodeThrottled("menu-flow-item")}_storeRootFlowItemNode(i){this._rootFlowItemNode=i,this._focusFlowItemNodeThrottled("root-flow-item")}_storeFeatureMenuFlowItemNode(i){this._featureMenuViewportNode=i,this._focusFlowItemNodeThrottled("menu-flow-item")}_setActiveFeature(i){var s;const{viewModel:e}=this,t=i.currentTarget["data-feature-index"];e.activeFeature=((s=e.features)==null?void 0:s[t])||null}_removeActiveFeature(){this.viewModel.activeFeature=null}_selectFeature(i){const e=i.currentTarget["data-feature-index"];isNaN(e)||(this.viewModel.selectedFeatureIndex=e),this._handleFeatureMenuBack()}_unobserveFeatureMenuObserver(){this._featureMenuIntersectionObserverNode&&this._featureMenuIntersectionObserver.unobserve(this._featureMenuIntersectionObserverNode)}_featureMenuIntersectionObserverCreated(i){this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver.observe(i),this._featureMenuIntersectionObserverNode=i}_getActionIcon(i){return i.icon?i.icon:i.image||i.className?void 0:"question"}_getActionTitle(i){const{messages:e,selectedFeature:t,messagesCommon:s}=this,{id:n}=i,r=t==null?void 0:t.attributes,a=i.title??"",d=n==="zoom-to-feature"?oe(a,{messages:e}):n==="remove-selected-feature"?oe(a,{messages:s}):n==="zoom-to-clustered-features"||n==="browse-clustered-features"?oe(a,{messages:e}):i.title;return d&&r?oe(d,r):d??""}_onMainKeydown(i){const e=hi(i);e==="ArrowLeft"&&(i.stopPropagation(),this._handleFeatureMenuBack(),this.previous()),e==="ArrowRight"&&(i.stopPropagation(),this._handleFeatureMenuBack(),this.next())}_featureMenuViewportScrollTop(){this._featureMenuViewportNode&&this._featureMenuViewportNode.scrollContentTo({top:0})}_setContentFromFeatureWidget(){const{selectedFeatureWidget:i}=this;i&&(this.viewModel.content=i)}_setTitleFromFeatureWidget(){const{selectedFeatureWidget:i,messagesCommon:e}=this,t=i==null?void 0:i.viewModel;i&&(this.viewModel.title=(t==null?void 0:t.state)==="error"?e==null?void 0:e.errorMessage:(t==null?void 0:t.title)||"")}_addSelectedFeatureIndexHandle(){const i=f(()=>{var e;return(e=this.viewModel)==null?void 0:e.selectedFeatureIndex},(e,t)=>this._selectedFeatureIndexUpdated(e,t));this.addHandles(i,oi)}_selectedFeatureIndexUpdated(i,e){const{featureCount:t}=this.viewModel;t&&i!==e&&i!==-1&&(this._destroyRelatedRecordsFlowItemWidgets(),this._rootFlowItemNode&&this._rootFlowItemNode.scrollContentTo({top:0}))}_triggerHeaderAction(i){const e=i.currentTarget;if(e.disabled)return;const t=e.dataset.actionUid,s=this.headerActions.find(({uid:n})=>n===t);s&&!s.disabled&&((s==null?void 0:s.type)==="toggle"&&(s.value=!s.value),this.emit("trigger-header-action",{action:s}))}_triggerAction(i){const e=i.currentTarget;if(e.disabled)return;const t=e.dataset.actionUid,{allActions:s}=this.viewModel,n=s.findIndex(a=>a.uid===t),r=s.at(n);r&&r.type==="toggle"&&(r.value=!r.value),this.viewModel.triggerAction(n)}_createSpinner(i){i&&(this._spinner=new fn({view:i}),i.ui.add(this._spinner,{key:ai,position:"manual",internal:!0}))}_wireUpView(i){var e;this._destroySpinner(),i&&((e=this.visibleElements)!=null&&e.spinner)&&this._createSpinner(i)}_hideSpinner(){const{_spinner:i}=this;i&&(i.location=null,i.hide())}_viewReadyChange(i,e){var t;i?this._wireUpView((t=this.viewModel)==null?void 0:t.view):e&&this.viewModel.clear()}_viewChange(i,e){i&&e&&this.viewModel.clear()}_destroySelectedFeatureWidget(){const{_feature:i}=this;i&&(i.viewModel=null,!i.destroyed&&i.destroy()),this._feature=null}_destroyRelatedRecordsFlowItemWidgets(){this._relatedRecordsFlowItems.removeAll().forEach(i=>{"showAllEnabled"in i.viewModel&&(i.viewModel.showAllEnabled=!1),i.viewModel=null,i.destroy()})}_toggleScreenLocationEnabled(){const{viewModel:i}=this;i&&(i.screenLocationEnabled=i.active)}_displaySpinner(){const{_spinner:i}=this;if(!i)return;const{location:e,waitingForResult:t}=this.viewModel;t&&e?i.show({location:e}):i.hide()}_destroySpinner(){var t;const{_spinner:i,view:e}=this;i&&((t=e==null?void 0:e.ui)==null||t.remove(i,ai),i.destroy(),this._spinner=null)}_spinnerEnabledChange(i){var e;this._destroySpinner(),i&&this._createSpinner((e=this.viewModel)==null?void 0:e.view)}};o([l()],x.prototype,"_focusOn",void 0),o([l()],x.prototype,"_relatedRecordsFlowItems",void 0),o([l()],x.prototype,"_hideActionText",null),o([l()],x.prototype,"_featureNavigationVisible",null),o([l()],x.prototype,"_isCollapsed",null),o([l()],x.prototype,"_collapseEnabled",null),o([l()],x.prototype,"collapsed",void 0),o([l()],x.prototype,"content",null),o([l()],x.prototype,"icon",void 0),o([l()],x.prototype,"featureMenuOpen",null),o([l()],x.prototype,"featureNavigationTop",void 0),o([l()],x.prototype,"features",null),o([l({type:Ie})],x.prototype,"headerActions",void 0),o([l()],x.prototype,"headingLevel",void 0),o([l()],x.prototype,"location",null),o([l()],x.prototype,"label",null),o([l(),Y("esri/widgets/Features/t9n/Features")],x.prototype,"messages",void 0),o([l(),Y("esri/t9n/common")],x.prototype,"messagesCommon",void 0),o([l()],x.prototype,"promises",null),o([l()],x.prototype,"responsiveActionsEnabled",void 0),o([l({readOnly:!0})],x.prototype,"selectedFeature",null),o([l()],x.prototype,"selectedFeatureIndex",null),o([l({readOnly:!0})],x.prototype,"selectedFeatureWidget",null),o([l()],x.prototype,"title",null),o([l()],x.prototype,"updateLocationEnabled",null),o([l()],x.prototype,"view",null),o([l({type:Rt}),fi(["triggerAction","trigger-action"])],x.prototype,"viewModel",void 0),o([l({type:ki,nonNullable:!0})],x.prototype,"visibleElements",void 0),o([l()],x.prototype,"visible",null),x=o([R("esri.widgets.Features")],x);const Tn=x,te="esri-popup",ge=`${te}--is-docked`,S={base:te,main:`${te}__main-container`,shadow:`${te}--shadow`,isDocked:ge,isDockedTopLeft:`${ge}-top-left`,isDockedTopCenter:`${ge}-top-center`,isDockedTopRight:`${ge}-top-right`,isDockedBottomLeft:`${ge}-bottom-left`,isDockedBottomCenter:`${ge}-bottom-center`,isDockedBottomRight:`${ge}-bottom-right`,alignTopCenter:`${te}--aligned-top-center`,alignBottomCenter:`${te}--aligned-bottom-center`,alignTopLeft:`${te}--aligned-top-left`,alignBottomLeft:`${te}--aligned-bottom-left`,alignTopRight:`${te}--aligned-top-right`,alignBottomRight:`${te}--aligned-bottom-right`,pointer:`${te}__pointer`,pointerDirection:`${te}__pointer-direction`};let Mt=class extends Rt{constructor(i){super(i)}};Mt=o([R("esri.widgets.Popup.PopupViewModel")],Mt);const Ri=Mt;let Se=class extends ce{constructor(){super(...arguments),this.closeButton=!0,this.featureNavigation=!0}};o([l({type:Boolean,nonNullable:!0})],Se.prototype,"closeButton",void 0),o([l({type:Boolean,nonNullable:!0})],Se.prototype,"featureNavigation",void 0),Se=o([R("esri.widgets.Features.PopupVisibleElements")],Se);const Pi=Se,li={buttonEnabled:!0,position:"auto",breakpoint:{width:544}};let F=class extends Z{constructor(i,e){super(i,e),this._dockAction=new ds({id:"popup-dock-action"}),this._featuresWidget=new Tn({responsiveActionsEnabled:!0}),this._containerNode=null,this._mainContainerNode=null,this._pointerOffsetInPx=16,this.alignment="auto",this.collapsed=!1,this.collapseEnabled=!0,this.dockEnabled=!1,this.headingLevel=2,this.maxInlineActions=3,this.messages=null,this.spinnerEnabled=!0,this.viewModel=new Ri,this.visibleElements=new Pi}initialize(){this.addHandles([f(()=>{var i,e;return[(e=(i=this.viewModel)==null?void 0:i.view)==null?void 0:e.widthBreakpoint,this.dockEnabled]},()=>this._handleDockIcon(),{initial:!0}),f(()=>{var i,e;return[this.dockEnabled,(i=this.messages)==null?void 0:i.undock,(e=this.messages)==null?void 0:e.dock]},()=>this._handleDockEnabled(),{initial:!0}),f(()=>this.dockOptions,i=>{const{_dockAction:e}=this,t=this._featuresWidget.headerActions;t.remove(e),i.buttonEnabled&&t.add(e)},{initial:!0}),f(()=>{var i;return(i=this.viewModel)==null?void 0:i.screenLocation},()=>this._positionContainer()),f(()=>{var i;return[(i=this.viewModel)==null?void 0:i.active,this.dockEnabled]},()=>this._toggleScreenLocationEnabled()),f(()=>{var i,e,t,s,n,r,a;return[(i=this.viewModel)==null?void 0:i.screenLocation,(t=(e=this.viewModel)==null?void 0:e.view)==null?void 0:t.padding,(n=(s=this.viewModel)==null?void 0:s.view)==null?void 0:n.size,(r=this.viewModel)==null?void 0:r.active,(a=this.viewModel)==null?void 0:a.location,this.alignment]},()=>this.reposition()),f(()=>{var i,e;return(e=(i=this.viewModel)==null?void 0:i.view)==null?void 0:e.size},(i,e)=>this._updateDockEnabledForViewSize(i,e)),f(()=>{var i;return(i=this.viewModel)==null?void 0:i.view},(i,e)=>this._viewChange(i,e)),f(()=>{var i,e;return(e=(i=this.viewModel)==null?void 0:i.view)==null?void 0:e.ready},(i,e)=>this._viewReadyChange(i??!1,e??!1)),f(()=>this.viewModel,()=>this._featuresWidget.viewModel=this.viewModel,{initial:!0}),f(()=>this._featureNavigationTop,i=>this._featuresWidget.featureNavigationTop=i,{initial:!0}),f(()=>this.headingLevel,i=>this._featuresWidget.headingLevel=i,{initial:!0}),f(()=>this.collapseEnabled,i=>this._featuresWidget.visibleElements.collapseButton=i,{initial:!0}),f(()=>this.collapsed,i=>this._featuresWidget.collapsed=i,{initial:!0}),f(()=>this.visibleElements.closeButton,i=>this._featuresWidget.visibleElements.closeButton=!!i,{initial:!0}),f(()=>this.spinnerEnabled,i=>this._featuresWidget.visibleElements.spinner=i,{initial:!0}),f(()=>this.visibleElements.featureNavigation,i=>this._featuresWidget.visibleElements.featureNavigation=!!i,{initial:!0}),Fe(()=>this._featuresWidget,"trigger-header-action",i=>{i.action===this._dockAction&&(this.dockEnabled=!this.dockEnabled)})])}destroy(){var i;this._dockAction.destroy(),(i=this._featuresWidget)==null||i.destroy()}get _featureNavigationTop(){const{currentAlignment:i,currentDockPosition:e}=this;return i==="bottom-left"||i==="bottom-center"||i==="bottom-right"||e==="top-left"||e==="top-center"||e==="top-right"}get actions(){return this.viewModel.actions}set actions(i){this.viewModel.actions=i}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(i){this.viewModel.autoCloseEnabled=i}get autoOpenEnabled(){return qt(ie.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled}set autoOpenEnabled(i){qt(ie.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled=i}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(i){this.viewModel.defaultPopupTemplateEnabled=i}get content(){return this.viewModel.content}set content(i){this.viewModel.content=i}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||li}set dockOptions(i){var d,c;const e={...li},t=(c=(d=this.viewModel)==null?void 0:d.view)==null?void 0:c.breakpoints,s={};t&&(s.width=t.xsmall,s.height=t.xsmall);const n={...e,...i},r={...e.breakpoint,...s},{breakpoint:a}=n;typeof a=="object"?n.breakpoint={...r,...a}:a&&(n.breakpoint=r),this._set("dockOptions",n),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(i){this.viewModel.featureMenuOpen=i}get features(){return this.viewModel.features}set features(i){this.viewModel.features=i}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(i){this.viewModel.goToOverride=i}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(i){this.viewModel.highlightEnabled=i}get location(){return this.viewModel.location}set location(i){this.viewModel.location=i}get label(){var i;return((i=this.messages)==null?void 0:i.widgetLabel)??""}set label(i){this._overrideIfSome("label",i)}get promises(){return this.viewModel.promises}set promises(i){this.viewModel.promises=i}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(i){this.viewModel.selectedFeatureIndex=i}get selectedFeatureWidget(){return this._featuresWidget.selectedFeatureWidget}get title(){return this.viewModel.title}set title(i){this.viewModel.title=i}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(i){this.viewModel.updateLocationEnabled=i}get view(){return this.viewModel.view}set view(i){this.viewModel.view=i}get visible(){return this.viewModel.visible}set visible(i){this.viewModel.visible=i}blur(){const{active:i}=this.viewModel;i||ie.getLogger(this).warn("Popup can only be blurred when currently active."),this._featuresWidget.blur()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(i,e){return this.viewModel.fetchFeatures(i,e)}focus(){const{active:i}=this.viewModel;i||ie.getLogger(this).warn("Popup can only be focused when currently active."),this.renderNow(),this._featuresWidget.focus()}next(){return this.viewModel.next()}open(i){const e=!!i&&!!i.featureMenuOpen,t={collapsed:!!i&&!!i.collapsed,featureMenuOpen:e};this.set(t),this.viewModel.open(i),this._shouldFocus(i)}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(i){return this.viewModel.triggerAction(i)}render(){var h,p,m,g;const{dockEnabled:i,currentAlignment:e,currentDockPosition:t}=this,{active:s}=this.viewModel,n=s&&i,r=s&&!i,a=(p=(h=this.selectedFeature)==null?void 0:h.layer)==null?void 0:p.title,d=(g=(m=this.selectedFeature)==null?void 0:m.layer)==null?void 0:g.id,c={[S.alignTopCenter]:e==="top-center",[S.alignBottomCenter]:e==="bottom-center",[S.alignTopLeft]:e==="top-left",[S.alignBottomLeft]:e==="bottom-left",[S.alignTopRight]:e==="top-right",[S.alignBottomRight]:e==="bottom-right",[S.isDocked]:n,[S.shadow]:r,[S.isDockedTopLeft]:t==="top-left",[S.isDockedTopCenter]:t==="top-center",[S.isDockedTopRight]:t==="top-right",[S.isDockedBottomLeft]:t==="bottom-left",[S.isDockedBottomCenter]:t==="bottom-center",[S.isDockedBottomRight]:t==="bottom-right"};return u("div",{afterCreate:this._positionContainer,afterUpdate:this._positionContainer,bind:this,class:this.classes(S.base,c),"data-layer-id":d,"data-layer-title":a,role:"presentation"},s?[this._renderMainContainer(),this._renderPointer()]:null)}_renderPointer(){return this.dockEnabled?null:u("div",{class:S.pointer,key:"popup-pointer",role:"presentation"},u("div",{class:this.classes(S.pointerDirection,S.shadow)}))}_renderMainContainer(){const{dockEnabled:i}=this,e={[S.shadow]:i};return u("div",{afterCreate:this._setMainContainerNode,afterUpdate:this._setMainContainerNode,bind:this,class:this.classes(S.main,I.widget,e)},this._featuresWidget.render())}async _shouldFocus(i){i!=null&&i.shouldFocus&&(await cs(()=>{var e;return((e=this.viewModel)==null?void 0:e.active)===!0}),this.focus())}_isOutsideView(i){const{popupHeight:e,popupWidth:t,screenLocation:s,side:n,view:r}=i;if(isNaN(t)||isNaN(e)||!r||!s)return!1;const a=r.padding;return n==="right"&&s.x+t/2>r.width-a.right||n==="left"&&s.x-t/2r.height-a.bottom}_calculateAutoAlignment(i){if(i!=="auto")return i;const{_pointerOffsetInPx:e,_containerNode:t,_mainContainerNode:s,viewModel:n}=this,{screenLocation:r,view:a}=n;if(r==null||!a||!t)return"top-center";function d(L){return parseInt(L.replaceAll(/[^-\d\.]/g,""),10)}const c=s?window.getComputedStyle(s,null):null,h=c?d(c.getPropertyValue("max-height")):0,p=c?d(c.getPropertyValue("height")):0,{height:m,width:g}=t.getBoundingClientRect(),_=g+e,v=Math.max(m,h,p)+e,w=this._isOutsideView({popupHeight:v,popupWidth:_,screenLocation:r,side:"right",view:a}),A=this._isOutsideView({popupHeight:v,popupWidth:_,screenLocation:r,side:"left",view:a}),b=this._isOutsideView({popupHeight:v,popupWidth:_,screenLocation:r,side:"top",view:a}),T=this._isOutsideView({popupHeight:v,popupWidth:_,screenLocation:r,side:"bottom",view:a});return A?b?"bottom-right":"top-right":w?b?"bottom-left":"top-left":b?T?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(i){return typeof i=="function"?i.call(this):i}_getCurrentAlignment(){const{alignment:i,dockEnabled:e}=this;return e||!this.viewModel.active?null:this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(i)))}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(i){const e=["left","right"];return Ae(this.container)&&e.reverse(),i==null?void 0:i.replace(/leading/gi,e[0]).replaceAll(/trailing/gi,e[1])}_callDockPosition(i){return typeof i=="function"?i.call(this):i}_getDockPosition(){var i;return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition((i=this.dockOptions)==null?void 0:i.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_calculateAutoDockPosition(i){var a;if(i!=="auto")return i;const e=(a=this.viewModel)==null?void 0:a.view,t=Ae(this.container)?"top-left":"top-right";if(!e)return t;const s=e.padding||{left:0,right:0,top:0,bottom:0},n=e.width-s.left-s.right,{breakpoints:r}=e;return r&&n<=r.xsmall?"bottom-center":t}_getDockIcon(){const i=this._getDockPosition();if(this.dockEnabled)return"minimize";switch(i){case"top-left":case"bottom-left":return"dock-left";case"top-center":return"maximize";case"bottom-center":return"dock-bottom";default:return"dock-right"}}_handleDockIcon(){this._dockAction.icon=this._getDockIcon()}_handleDockEnabled(){var i,e;this._dockAction.title=this.dockEnabled?(i=this.messages)==null?void 0:i.undock:(e=this.messages)==null?void 0:e.dock}_setMainContainerNode(i){this._mainContainerNode=i}_positionContainer(i=this._containerNode){if(i&&(this._containerNode=i),!this._containerNode)return;const{screenLocation:e}=this.viewModel,{width:t}=this._containerNode.getBoundingClientRect(),s=this._calculatePositionStyle(e,t);s&&Object.assign(this._containerNode.style,s)}_calculateFullWidth(i){const{currentAlignment:e,_pointerOffsetInPx:t}=this;return e==="top-left"||e==="bottom-left"||e==="top-right"||e==="bottom-right"?i+t:i}_calculateAlignmentPosition(i,e,t,s){const{currentAlignment:n,_pointerOffsetInPx:r}=this;if(!t)return;const{padding:a}=t,d=s/2,c=t.height-e,h=t.width-i;return n==="bottom-center"?{top:e+r-a.top,left:i-d-a.left}:n==="top-left"?{bottom:c+r-a.bottom,right:h+r-a.right}:n==="bottom-left"?{top:e+r-a.top,right:h+r-a.right}:n==="top-right"?{bottom:c+r-a.bottom,left:i+r-a.left}:n==="bottom-right"?{top:e+r-a.top,left:i+r-a.left}:n==="top-center"?{bottom:c+r-a.bottom,left:i-d-a.left}:void 0}_calculatePositionStyle(i,e){const{dockEnabled:t,view:s}=this;if(!s)return;if(t)return{left:"",top:"",right:"",bottom:""};if(i==null||!e)return;const n=this._calculateFullWidth(e),r=this._calculateAlignmentPosition(i.x,i.y,s,n);return r?{top:r.top!==void 0?`${r.top}px`:"auto",left:r.left!==void 0?`${r.left}px`:"auto",bottom:r.bottom!==void 0?`${r.bottom}px`:"auto",right:r.right!==void 0?`${r.right}px`:"auto"}:void 0}_viewChange(i,e){i&&e&&(this.close(),this.clear())}_viewReadyChange(i,e){i?this._wireUpView():e&&(this.close(),this.clear())}_wireUpView(){this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(i,e,t){const[s,n]=i,[r,a]=e,{width:d=0,height:c=0}=t??{};return s<=d&&r>d||s>d&&r<=d||n<=c&&a>c||n>c&&a<=c}_updateDockEnabledForViewSize(i,e){var h,p;if(!i||!e)return;const t=((p=(h=this.viewModel)==null?void 0:h.view)==null?void 0:p.padding)||{left:0,right:0,top:0,bottom:0},s=t.left+t.right,n=t.top+t.bottom,r=[],a=[];r[0]=i[0]-s,r[1]=i[1]-n,a[0]=e[0]-s,a[1]=e[1]-n;const{dockOptions:d}=this,c=d.breakpoint;this._dockingThresholdCrossed(r,a,c)&&this._setDockEnabledForViewSize(d),this._setCurrentDockPosition()}_toggleScreenLocationEnabled(){const{dockEnabled:i,viewModel:e}=this;if(!e)return;const t=e.active&&!i;e.screenLocationEnabled=t}_shouldDockAtCurrentViewSize(i){var d,c;const e=i.breakpoint,t=(c=(d=this.viewModel)==null?void 0:d.view)==null?void 0:c.ui;if(!t)return!1;const{width:s,height:n}=t;if(isNaN(s)||isNaN(n)||!e)return!1;const r=e.hasOwnProperty("width")&&s<=(e.width??0),a=e.hasOwnProperty("height")&&n<=(e.height??0);return r||a}_setDockEnabledForViewSize(i){i.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(i))}};o([l({readOnly:!0})],F.prototype,"_featureNavigationTop",null),o([l()],F.prototype,"actions",null),o([l()],F.prototype,"alignment",void 0),o([l()],F.prototype,"autoCloseEnabled",null),o([l()],F.prototype,"autoOpenEnabled",null),o([l()],F.prototype,"defaultPopupTemplateEnabled",null),o([l()],F.prototype,"content",null),o([l()],F.prototype,"collapsed",void 0),o([l()],F.prototype,"collapseEnabled",void 0),o([l({readOnly:!0})],F.prototype,"currentAlignment",null),o([l({readOnly:!0})],F.prototype,"currentDockPosition",null),o([l()],F.prototype,"dockOptions",null),o([l()],F.prototype,"dockEnabled",void 0),o([l({readOnly:!0})],F.prototype,"featureCount",null),o([l()],F.prototype,"featureMenuOpen",null),o([l()],F.prototype,"features",null),o([l()],F.prototype,"goToOverride",null),o([l()],F.prototype,"headingLevel",void 0),o([l()],F.prototype,"highlightEnabled",null),o([l()],F.prototype,"location",null),o([l()],F.prototype,"label",null),o([l()],F.prototype,"maxInlineActions",void 0),o([l(),Y("esri/widgets/Popup/t9n/Popup")],F.prototype,"messages",void 0),o([l()],F.prototype,"promises",null),o([l({readOnly:!0})],F.prototype,"selectedFeature",null),o([l()],F.prototype,"selectedFeatureIndex",null),o([l({readOnly:!0})],F.prototype,"selectedFeatureWidget",null),o([l()],F.prototype,"spinnerEnabled",void 0),o([l()],F.prototype,"title",null),o([l()],F.prototype,"updateLocationEnabled",null),o([l()],F.prototype,"view",null),o([l({type:Ri}),fi(["triggerAction","trigger-action"])],F.prototype,"viewModel",void 0),o([l()],F.prototype,"visible",null),o([l({type:Pi,nonNullable:!0})],F.prototype,"visibleElements",void 0),F=o([R("esri.widgets.Popup")],F);const wr=F;export{wr as default}; +import{V as De,h3 as Ni,e as o,y as l,f1 as Te,K as ke,c as R,g as ce,B as f,P as H,r as k,lq as Pt,kr as Si,kX as Y,hD as Z,fg as Fe,hE as Re,de as E,hF as u,kY as I,oW as Lt,vN as Ot,vO as Di,hq as Ae,kZ as pe,vP as It,oX as di,oV as Bi,vQ as ci,cR as Vt,R as ie,gD as Wi,jN as Ce,rt as qi,aL as it,my as st,eT as Hi,av as zi,ky as vt,vR as ui,dY as Ke,vS as ji,hs as oe,vT as Ui,hp as Qi,vU as hi,vV as Xi,mi as Qe,vW as Gi,vX as pi,vY as Yi,vZ as Nt,dq as Ki,a as mi,br as nt,bs as rt,b as Ji,mw as gi,ac as Zi,vt as Be,v_ as O,v$ as es,vp as ts,w0 as ye,o6 as is,w1 as xe,w2 as me,w3 as St,w4 as ss,w5 as Ie,aw as ns,v as yt,a9 as rs,ps as os,w6 as as,lM as ls,aI as Dt,ku as Bt,L as ds,c$ as Wt,w7 as fi,w8 as cs,uA as qt,aa as us}from"./index-pCX-0tJH.js";import{E as _i,x as Xe,C as vi,q as yi,d as we,D as be,P as Ht,z as zt,R as hs,v as wt,M as wi,Y as ps,a as Ft,o as At,T as ms,r as gs,i as jt,s as fs,J as _s,n as vs,c as ys,u as ot,h as ws,b as bs}from"./featureUtils-aSzMyCi0.js";import Ms from"./FeatureLayer-9tNCmEbA.js";import{c as bi}from"./AnchorElementViewModel-7brFN9z4.js";import{s as Is}from"./ReactiveSet-_4-UpKXZ.js";import"./FeatureLayerBase-mvqC7cJs.js";import"./serviceCapabilitiesUtils-f-iBP4uh.js";import"./editsZScale-4-dTv58d.js";import"./CustomParametersMixin-7nmugR3Y.js";import"./FeatureEffectLayer-OK0TB5f6.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./FeatureReductionLayer-2X2_PJv9.js";import"./OrderedLayer-XNaJwl_G.js";import"./FeatureTemplate-vSzbyslg.js";import"./FeatureType-0WPvBvpQ.js";import"./versionUtils-idhrDltC.js";const Ut={editing:!1,operations:{add:!0,update:!0,delete:!0}},Mi=De.ofType(Ni);let G=class extends ce{constructor(e){super(e),this._getAttachmentsPromise=null,this._attachmentLayer=null,this.capabilities={...Ut},this.activeAttachmentInfo=null,this.activeFileInfo=null,this.attachmentInfos=new Mi,this.fileInfos=new De,this.graphic=null,this.mode="view",this.filesEnabled=!1,this.addHandles(f(()=>this.graphic,()=>this._graphicChanged(),H))}destroy(){this._attachmentLayer=null,this.graphic=null}castCapabilities(e){return{...Ut,...e}}get state(){return this._getAttachmentsPromise?"loading":this.graphic?"ready":"disabled"}get supportsResizeAttachments(){const{graphic:e}=this;if(!e)return!1;const t=e.layer||e.sourceLayer;return(t==null?void 0:t.loaded)&&"capabilities"in t&&t.capabilities&&"operations"in t.capabilities&&"supportsResizeAttachments"in t.capabilities.operations&&t.capabilities.operations.supportsResizeAttachments||!1}async getAttachments(){const{_attachmentLayer:e,attachmentInfos:t}=this;if(!e||typeof e.queryAttachments!="function")throw new k("invalid-layer","getAttachments(): A valid layer is required.");const s=this._getObjectId(),n=new Pt({objectIds:[s],returnMetadata:!0}),r=[],a=e.queryAttachments(n).then(c=>c[s]||r).catch(()=>r);this._getAttachmentsPromise=a,this.notifyChange("state");const d=await a;return t.removeAll(),d.length&&t.addMany(d),this._getAttachmentsPromise=null,this.notifyChange("state"),d}async addAttachment(e,t=this.graphic){var c;const{_attachmentLayer:s,attachmentInfos:n,capabilities:r}=this;if(!t)throw new k("invalid-graphic","addAttachment(): A valid graphic is required.",{graphic:t});if(!e)throw new k("invalid-attachment","addAttachment(): An attachment is required.",{attachment:e});if(!((c=r.operations)!=null&&c.add))throw new k("invalid-capabilities","addAttachment(): add capabilities are required.");if(!s||typeof s.addAttachment!="function")throw new k("invalid-layer","addAttachment(): A valid layer is required.");const a=s.addAttachment(t,e).then(h=>this._queryAttachment(h.objectId,t)),d=await a;return n.add(d),d}async deleteAttachment(e){var c;const{_attachmentLayer:t,attachmentInfos:s,graphic:n,capabilities:r}=this;if(!e)throw new k("invalid-attachment-info","deleteAttachment(): An attachmentInfo is required.",{attachmentInfo:e});if(!((c=r.operations)!=null&&c.delete))throw new k("invalid-capabilities","deleteAttachment(): delete capabilities are required.");if(!t||typeof t.deleteAttachments!="function")throw new k("invalid-layer","deleteAttachment(): A valid layer is required.");if(!n)throw new k("invalid-graphic","deleteAttachment(): A graphic is required.");const a=t.deleteAttachments(n,[e.id]).then(()=>e),d=await a;return s.remove(d),d}async updateAttachment(e,t=this.activeAttachmentInfo){var p;const{_attachmentLayer:s,attachmentInfos:n,graphic:r,capabilities:a}=this;if(!e)throw new k("invalid-attachment","updateAttachment(): An attachment is required.",{attachment:e});if(!t)throw new k("invalid-attachment-info","updateAttachment(): An attachmentInfo is required.",{attachmentInfo:t});if(!((p=a.operations)!=null&&p.update))throw new k("invalid-capabilities","updateAttachment(): Update capabilities are required.");const d=n.indexOf(t);if(!s||typeof s.updateAttachment!="function")throw new k("invalid-layer","updateAttachment(): A valid layer is required.");if(!r)throw new k("invalid-graphic","updateAttachment(): A graphic is required.");const c=s.updateAttachment(r,t.id,e).then(m=>this._queryAttachment(m.objectId)),h=await c;return n.splice(d,1,h),h}async commitFiles(){return await Promise.all(this.fileInfos.items.map(e=>this.addAttachment(e.form))),this.fileInfos.removeAll(),this.getAttachments()}addFile(e,t){if(!e||!t)return null;const s={file:e,form:t};return this.fileInfos.add(s),s}updateFile(e,t,s=this.activeFileInfo){if(!e||!t||!s)return null;const n=this.fileInfos.indexOf(s);return n>-1&&this.fileInfos.splice(n,1,{file:e,form:t}),this.fileInfos.items[n]}deleteFile(e){const t=this.fileInfos.find(s=>s.file===e);return t?(this.fileInfos.remove(t),t):null}async _queryAttachment(e,t){const{_attachmentLayer:s}=this;if(!e||!(s!=null&&s.queryAttachments))throw new k("invalid-attachment-id","Could not query attachment.");const n=this._getObjectId(t),r=new Pt({objectIds:[n],attachmentsWhere:`AttachmentId=${e}`,returnMetadata:!0});return s.queryAttachments(r).then(a=>a[n][0])}_getObjectId(e=this.graphic){return(e==null?void 0:e.getObjectId())??null}_graphicChanged(){this.graphic&&(this._setAttachmentLayer(),this.getAttachments().catch(()=>{}))}_setAttachmentLayer(){const{graphic:e}=this,t=_i(e);this._attachmentLayer=t?t.type==="scene"&&t.associatedLayer!=null?t.associatedLayer:t:null}};o([l()],G.prototype,"capabilities",void 0),o([Te("capabilities")],G.prototype,"castCapabilities",null),o([l()],G.prototype,"activeAttachmentInfo",void 0),o([l()],G.prototype,"activeFileInfo",void 0),o([l({readOnly:!0,type:Mi})],G.prototype,"attachmentInfos",void 0),o([l()],G.prototype,"fileInfos",void 0),o([l({type:ke})],G.prototype,"graphic",void 0),o([l()],G.prototype,"mode",void 0),o([l({readOnly:!0})],G.prototype,"state",null),o([l()],G.prototype,"filesEnabled",void 0),o([l({readOnly:!0})],G.prototype,"supportsResizeAttachments",null),G=o([R("esri.widgets.Attachments.AttachmentsViewModel")],G);const Ct=G;function Qt(i){const e=i.toLowerCase();return e==="image/bmp"||e==="image/emf"||e==="image/exif"||e==="image/gif"||e==="image/x-icon"||e==="image/jpeg"||e==="image/png"||e==="image/tiff"||e==="image/x-wmf"}function Fs(i){const e=Si("esri/themes/base/images/files/");return i?i==="text/plain"?`${e}text-32.svg`:i==="application/pdf"?`${e}pdf-32.svg`:i==="text/csv"?`${e}csv-32.svg`:i==="application/gpx+xml"?`${e}gpx-32.svg`:i==="application/x-dwf"?`${e}cad-32.svg`:i==="application/postscript"||i==="application/json"||i==="text/xml"||i==="model/vrml"?`${e}code-32.svg`:i==="application/x-zip-compressed"||i==="application/x-7z-compressed"||i==="application/x-gzip"||i==="application/x-tar"||i==="application/x-gtar"||i==="application/x-bzip2"||i==="application/gzip"||i==="application/x-compress"||i==="application/x-apple-diskimage"||i==="application/x-rar-compressed"||i==="application/zip"?`${e}zip-32.svg`:i.includes("image/")?`${e}image-32.svg`:i.includes("audio/")?`${e}sound-32.svg`:i.includes("video/")?`${e}video-32.svg`:i.includes("msexcel")||i.includes("ms-excel")||i.includes("spreadsheetml")?`${e}excel-32.svg`:i.includes("msword")||i.includes("ms-word")||i.includes("wordprocessingml")?`${e}word-32.svg`:i.includes("powerpoint")||i.includes("presentationml")?`${e}report-32.svg`:`${e}generic-32.svg`:`${e}generic-32.svg`}const Xt={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},C="esri-attachments",y={base:C,loaderContainer:`${C}__loader-container`,loader:`${C}__loader`,fadeIn:`${C}--fade-in`,container:`${C}__container`,containerList:`${C}__container--list`,containerPreview:`${C}__container--preview`,actions:`${C}__actions`,deleteButton:`${C}__delete-button`,addAttachmentButton:`${C}__add-attachment-button`,errorMessage:`${C}__error-message`,items:`${C}__items`,item:`${C}__item`,itemButton:`${C}__item-button`,itemMask:`${C}__item-mask`,itemMaskIcon:`${C}__item-mask--icon`,itemImage:`${C}__image`,itemImageResizable:`${C}__image--resizable`,itemLabel:`${C}__label`,itemFilename:`${C}__filename`,itemChevronIcon:`${C}__item-chevron-icon`,itemLink:`${C}__item-link`,itemLinkOverlay:`${C}__item-link-overlay`,itemLinkOverlayIcon:`${C}__item-link-overlay-icon`,itemEditIcon:`${C}__item-edit-icon`,itemAddIcon:`${C}__item-add-icon`,itemAddButton:`${C}__item-add-button`,formNode:`${C}__form-node`,fileFieldset:`${C}__file-fieldset`,fileLabel:`${C}__file-label`,fileName:`${C}__file-name`,fileInput:`${C}__file-input`,metadata:`${C}__metadata`,metadataFieldset:`${C}__metadata-fieldset`,progressBar:`${C}__progress-bar`},at=window.CSS;let j=class extends Z{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...Xt},this._supportsImageOrientation=at&&at.supports&&at.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}normalizeCtorArgs(e){return e!=null&&e.viewModel||(e={viewModel:new Ct,...e}),e}initialize(){this.addHandles([Fe(()=>{var e;return(e=this.viewModel)==null?void 0:e.attachmentInfos},"change",()=>this.scheduleRender()),Fe(()=>{var e;return(e=this.viewModel)==null?void 0:e.fileInfos},"change",()=>this.scheduleRender()),f(()=>{var e;return(e=this.viewModel)==null?void 0:e.mode},()=>this._modeChanged(),H)])}loadDependencies(){return Re({icon:()=>E(()=>import("./calcite-icon-ZhRmLRGh.js"),__vite__mapDeps([0,1,2,3,4]))})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&e!=="auto"?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...Xt,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:t}=this;return this._set("submitting",!0),this._set("error",null),t.addAttachment(e).then(s=>(this._set("submitting",!1),this._set("error",null),t.mode="view",s)).catch(s=>{throw this._set("submitting",!1),this._set("error",new k("attachments:add-attachment",this.messages.addErrorMessage,s)),s})}deleteAttachment(e){const{viewModel:t}=this;return this._set("submitting",!0),this._set("error",null),t.deleteAttachment(e).then(s=>(this._set("submitting",!1),this._set("error",null),t.mode="view",s)).catch(s=>{throw this._set("submitting",!1),this._set("error",new k("attachments:delete-attachment",this.messages.deleteErrorMessage,s)),s})}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:t}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(t).then(s=>(this._set("submitting",!1),this._set("error",null),e.mode="view",s)).catch(s=>{throw this._set("submitting",!1),this._set("error",new k("attachments:update-attachment",this.messages.updateErrorMessage,s)),s})}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){var s;const t=this.viewModel.deleteFile(e||((s=this.viewModel.activeFileInfo)==null?void 0:s.file));return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return u("div",{class:this.classes(y.base,I.widget)},e?this._renderProgressBar():null,s==="loading"?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?u("div",{class:y.errorMessage,key:"error-message"},e.message):null}_renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return t==="add"?this._renderAddForm():t==="edit"?this._renderDetailsForm(s||e):this._renderAttachmentContainer()}_renderLoading(){return u("div",{class:y.loaderContainer,key:"loader"},u("div",{class:y.loader}))}_renderProgressBar(){return this.visibleElements.progressBar?u("div",{class:y.progressBar,key:"progress-bar"}):null}_renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,n=this.visibleElements.cancelAddButton?u("button",{bind:this,class:this.classes(I.button,I.buttonTertiary,I.buttonSmall,I.buttonHalf,e&&I.buttonDisabled),disabled:e,onclick:this._cancelForm,type:"button"},this.messages.cancel):null,r=this.visibleElements.addSubmitButton?u("button",{class:this.classes(I.button,I.buttonSecondary,I.buttonSmall,I.buttonHalf,{[I.buttonDisabled]:s}),disabled:s,type:"submit"},this.messages.add):null,a=t?u("span",{class:y.fileName,key:"file-name"},t.name):null,d=u("form",{afterCreate:Lt,afterRemoved:Ot,bind:this,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},u("fieldset",{class:y.fileFieldset},a,u("label",{class:this.classes(y.fileLabel,I.button,I.buttonSecondary)},t?this.messages.changeFile:this.messages.selectFile,u("input",{bind:this,class:y.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))),r,n);return u("div",{class:y.formNode,key:"add-form-container"},d)}_renderDetailsForm(e){var V,se,K;const{visibleElements:t,viewModel:s,selectedFile:n,submitting:r}=this,{capabilities:a}=s,d=r||!n;let c,h,p,m;n?(c=n.type,h=n.name,p=n.size):e&&"file"in e?(c=e.file.type,h=e.file.name,p=e.file.size):e&&"contentType"in e&&(c=e.contentType,h=e.name,p=e.size,m=e.url);const g=a.editing&&((V=a.operations)!=null&&V.delete)&&t.deleteButton?u("button",{bind:this,class:this.classes(I.button,I.buttonSmall,I.buttonTertiary,y.deleteButton,{[I.buttonDisabled]:r}),disabled:r,key:"delete-button",onclick:ee=>this._submitDeleteAttachment(ee,e),type:"button"},this.messages.delete):void 0,_=a.editing&&((se=a.operations)!=null&&se.update)&&t.updateButton?u("button",{class:this.classes(I.button,I.buttonSmall,I.buttonThird,{[I.buttonDisabled]:d}),disabled:d,key:"update-button",type:"submit"},this.messages.update):void 0,v=this.visibleElements.cancelUpdateButton?u("button",{bind:this,class:this.classes(I.button,I.buttonSmall,I.buttonTertiary,I.buttonThird,{[I.buttonDisabled]:r}),disabled:r,key:"cancel-button",onclick:this._cancelForm,type:"button"},this.messages.cancel):void 0,w=a.editing&&((K=a.operations)!=null&&K.update)?u("fieldset",{class:y.fileFieldset,key:"file"},u("span",{class:y.fileName,key:"file-name"},h),u("label",{class:this.classes(y.fileLabel,I.button,I.buttonSecondary)},this.messages.changeFile,u("input",{bind:this,class:y.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))):void 0,A=u("fieldset",{class:y.metadataFieldset,key:"size"},u("label",null,Di(this.messagesUnits,p??0))),b=u("fieldset",{class:y.metadataFieldset,key:"content-type"},u("label",null,c)),T=m!=null?u("a",{class:y.itemLink,href:m,rel:"noreferrer",target:"_blank"},this._renderImageMask(e,400),u("div",{class:y.itemLinkOverlay},u("span",{class:y.itemLinkOverlayIcon},u("calcite-icon",{icon:"launch"})))):this._renderImageMask(e,400),L=u("form",{afterCreate:Lt,afterRemoved:Ot,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:ee=>this._submitUpdateAttachment(ee,e)},u("div",{class:y.metadata},A,b),w,u("div",{class:y.actions},g,v,_));return u("div",{class:y.formNode,key:"edit-form-container"},T,L)}_renderImageMask(e,t){return e?"file"in e?this._renderGenericImageMask(e.file.name,e.file.type):this._renderImageMaskForAttachment(e,t):null}_renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,n=Fs(t),r={[y.itemImageResizable]:s};return u("div",{class:this.classes(y.itemMaskIcon,y.itemMask),key:n},u("img",{alt:e,class:this.classes(r,y.itemImage),src:n,title:e}))}_renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:n,name:r,url:a}=e;if(!s||!Qt(n))return this._renderGenericImageMask(r,n);const d=this._getCSSTransform(e),c=d?{transform:d,"image-orientation":"none"}:{},h=`${a}${a!=null&&a.includes("?")?"&":"?"}w=${t}`,p={[y.itemImageResizable]:s};return u("div",{class:this.classes(y.itemMask),key:h},u("img",{alt:r,class:this.classes(p,y.itemImage),src:h,styles:c,title:r}))}_renderFile(e){const{file:t}=e;return u("li",{class:y.item,key:t},u("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:y.itemButton,key:"details-button",onclick:()=>this._startEditFile(e),title:this.messages.attachmentDetails,type:"button"},this._renderImageMask(e),u("label",{class:y.itemLabel},u("span",{class:y.itemFilename},t.name||this.messages.noTitle),u("span",{"aria-hidden":"true",class:this.classes(y.itemChevronIcon,Ae(this.container)?pe.left:pe.right)}))))}_renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:n}=this,{capabilities:r,supportsResizeAttachments:a}=s,{contentType:d,name:c,url:h}=e,p=this._renderImageMask(e,t==="list"?48:400),m=r.editing?u("span",{"aria-hidden":"true",class:this.classes(y.itemChevronIcon,Ae(this.container)?pe.left:pe.right)}):null,g=[p,n==="preview"&&a&&Qt(d)?null:u("label",{class:y.itemLabel},u("span",{class:y.itemFilename},c||this.messages.noTitle),m)],_=r.editing?u("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:y.itemButton,"data-attachment-info-id":e.id,key:"details-button",onclick:()=>this._startEditAttachment(e),title:this.messages.attachmentDetails,type:"button"},g):u("a",{class:y.itemButton,href:h??void 0,key:"details-link",target:"_blank"},g);return u("li",{class:y.item,key:e},_)}_renderAttachmentContainer(){var v;const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:n,capabilities:r,fileInfos:a}=t,d=!!(n!=null&&n.length),c=!!(a!=null&&a.length),h={[y.containerList]:e!=="preview",[y.containerPreview]:e==="preview"},p=r.editing&&((v=r.operations)!=null&&v.add)&&s.addButton?u("button",{bind:this,class:this.classes(I.button,I.buttonTertiary,y.addAttachmentButton),onclick:()=>this._startAddAttachment(),type:"button"},u("span",{"aria-hidden":"true",class:this.classes(y.itemAddIcon,pe.plus)}),this.messages.add):void 0,m=d?u("ul",{class:y.items,key:"attachments-list"},n.toArray().map(w=>this._renderAttachmentInfo({attachmentInfo:w,displayType:e}))):void 0,g=c?u("ul",{class:y.items,key:"file-list"},a.toArray().map(w=>this._renderFile(w))):void 0,_=c||d?void 0:u("div",{class:I.empty},this.messages.noAttachments);return u("div",{class:this.classes(y.container,h),key:"attachments-container"},m,g,_,p)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){var n;const t=e.target,s=(n=t.files)==null?void 0:n.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};o([l()],j.prototype,"capabilities",null),o([l()],j.prototype,"displayType",void 0),o([l({readOnly:!0})],j.prototype,"effectiveDisplayType",null),o([l()],j.prototype,"graphic",null),o([l()],j.prototype,"label",null),o([l(),Y("esri/widgets/Attachments/t9n/Attachments")],j.prototype,"messages",void 0),o([l(),Y("esri/core/t9n/Units")],j.prototype,"messagesUnits",void 0),o([l({readOnly:!0})],j.prototype,"selectedFile",void 0),o([l({readOnly:!0})],j.prototype,"submitting",void 0),o([l({readOnly:!0})],j.prototype,"error",void 0),o([l({type:Ct})],j.prototype,"viewModel",void 0),o([l()],j.prototype,"visibleElements",void 0),o([Te("visibleElements")],j.prototype,"castVisibleElements",null),j=o([R("esri.widgets.Attachments")],j);const As=j;let Oe=class extends Ct{constructor(e){super(e),this.description=null,this.title=null}};o([l()],Oe.prototype,"description",void 0),o([l()],Oe.prototype,"title",void 0),Oe=o([R("esri.widgets.Feature.FeatureAttachments.FeatureAttachmentsViewModel")],Oe);const Et=Oe,lt="esri-feature-element-info",dt={base:lt,title:`${lt}__title`,description:`${lt}__description`};let Ee=class extends Z{constructor(e,t){super(e,t),this.description=null,this.headingLevel=2,this.title=null}render(){return u("div",{class:dt.base},this._renderTitle(),this._renderDescription())}_renderTitle(){const{title:e}=this;return e?u(It,{class:dt.title,level:this.headingLevel},e):null}_renderDescription(){const{description:e}=this;return e?u("div",{class:dt.description,key:"description"},e):null}};o([l()],Ee.prototype,"description",void 0),o([l()],Ee.prototype,"headingLevel",void 0),o([l()],Ee.prototype,"title",void 0),Ee=o([R("esri.widgets.Feature.support.FeatureElementInfo")],Ee);const Je=Ee,Cs={base:"esri-feature-attachments"};let re=class extends Z{constructor(e,t){super(e,t),this._featureElementInfo=null,this.attachmentsWidget=new As,this.headingLevel=2,this.viewModel=new Et}initialize(){this._featureElementInfo=new Je,this.addHandles([f(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.description,(t=this.viewModel)==null?void 0:t.title,this.headingLevel]},()=>this._setupFeatureElementInfo(),H),f(()=>this.viewModel,e=>this.attachmentsWidget.viewModel=e,H)])}destroy(){var e;this.attachmentsWidget.viewModel=null,this.attachmentsWidget.destroy(),(e=this._featureElementInfo)==null||e.destroy()}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get displayType(){return this.attachmentsWidget.displayType}set displayType(e){this.attachmentsWidget.displayType=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){var t;const{attachmentsWidget:e}=this;return u("div",{class:Cs.base},(t=this._featureElementInfo)==null?void 0:t.render(),e==null?void 0:e.render())}_setupFeatureElementInfo(){var n;const{description:e,title:t,headingLevel:s}=this;(n=this._featureElementInfo)==null||n.set({description:e,title:t,headingLevel:s})}};o([l({readOnly:!0})],re.prototype,"attachmentsWidget",void 0),o([l()],re.prototype,"description",null),o([l()],re.prototype,"displayType",null),o([l()],re.prototype,"graphic",null),o([l()],re.prototype,"headingLevel",void 0),o([l()],re.prototype,"title",null),o([l({type:Et})],re.prototype,"viewModel",void 0),re=o([R("esri.widgets.Feature.FeatureAttachments")],re);const Es=re;let he=class extends ce{constructor(e){super(e),this._loadingPromise=null,this.created=null,this.creator=null,this.destroyer=null,this.graphic=null,this.addHandles(f(()=>this.creator,t=>{this._destroyContent(),this._createContent(t)},H))}destroy(){this._destroyContent()}get state(){return this._loadingPromise?"loading":"ready"}_destroyContent(){const{created:e,graphic:t,destroyer:s}=this;e&&t&&(Xe(s,{graphic:t}).catch(()=>null),this._set("created",null))}async _createContent(e){const t=this.graphic;if(!t||!e)return;const s=Xe(e,{graphic:t}).catch(()=>null);this._loadingPromise=s,this.notifyChange("state");const n=await s;s===this._loadingPromise&&(this._loadingPromise=null,this.notifyChange("state"),this._set("created",n))}};o([l({readOnly:!0})],he.prototype,"created",void 0),o([l()],he.prototype,"creator",void 0),o([l()],he.prototype,"destroyer",void 0),o([l({type:ke})],he.prototype,"graphic",void 0),o([l({readOnly:!0})],he.prototype,"state",null),he=o([R("esri.widgets.Feature.FeatureContent.FeatureContentViewModel")],he);const Ge=he,ct="esri-feature-content",ut={base:ct,loaderContainer:`${ct}__loader-container`,loader:`${ct}__loader`};let $e=class extends Z{constructor(e,t){super(e,t),this.viewModel=null,this._addTargetToAnchors=s=>{Array.from(s.querySelectorAll("a")).forEach(n=>{vi(n.href)&&!n.hasAttribute("target")&&n.setAttribute("target","_blank")})}}get creator(){var e;return(e=this.viewModel)==null?void 0:e.creator}set creator(e){this.viewModel&&(this.viewModel.creator=e)}get graphic(){var e;return(e=this.viewModel)==null?void 0:e.graphic}set graphic(e){this.viewModel&&(this.viewModel.graphic=e)}render(){var t;const e=(t=this.viewModel)==null?void 0:t.state;return u("div",{class:ut.base},e==="loading"?this._renderLoading():this._renderCreated())}_renderLoading(){return u("div",{class:ut.loaderContainer,key:"loader"},u("div",{class:ut.loader}))}_renderCreated(){var t;const e=(t=this.viewModel)==null?void 0:t.created;return e?e instanceof HTMLElement?u("div",{afterCreate:this._attachToNode,bind:e,key:e}):di(e)?u("div",{key:e},!e.destroyed&&e.render()):u("div",{afterCreate:this._addTargetToAnchors,innerHTML:e,key:e}):null}_attachToNode(e){const t=this;e.appendChild(t)}};o([l()],$e.prototype,"creator",null),o([l()],$e.prototype,"graphic",null),o([l({type:Ge})],$e.prototype,"viewModel",void 0),$e=o([R("esri.widgets.Feature.FeatureContent")],$e);const He=$e;let le=class extends ce{constructor(e){super(e),this.attributes=null,this.expressionInfos=null,this.description=null,this.fieldInfos=null,this.title=null}get formattedFieldInfos(){const{expressionInfos:e,fieldInfos:t}=this,s=[];return t==null||t.forEach(n=>{if(!(!n.hasOwnProperty("visible")||n.visible))return;const r=n.clone();r.label=yi(r,e),s.push(r)}),s}};o([l()],le.prototype,"attributes",void 0),o([l({type:[Bi]})],le.prototype,"expressionInfos",void 0),o([l()],le.prototype,"description",void 0),o([l({type:[ci]})],le.prototype,"fieldInfos",void 0),o([l({readOnly:!0})],le.prototype,"formattedFieldInfos",null),o([l()],le.prototype,"title",void 0),le=o([R("esri.widgets.Feature.FeatureFields.FeatureFieldsViewModel")],le);const Ze=le,$s=[{pattern:/^\s*(https?:\/\/([^\s]+))\s*$/i,target:"_blank",label:"{messages.view}"},{pattern:/^\s*(tel:([^\s]+))\s*$/i,label:"{hierPart}"},{pattern:/^\s*(mailto:([^\s]+))\s*$/i,label:"{hierPart}"},{pattern:/^\s*(arcgis-appstudio-player:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"App Studio Player"},{pattern:/^\s*(arcgis-collector:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Collector"},{pattern:/^\s*(arcgis-explorer:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Explorer"},{pattern:/^\s*(arcgis-navigator:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Navigator"},{pattern:/^\s*(arcgis-survey123:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Survey123"},{pattern:/^\s*(arcgis-trek2there:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Trek2There"},{pattern:/^\s*(arcgis-workforce:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Workforce"},{pattern:/^\s*(iform:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"iForm"},{pattern:/^\s*(flow:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"FlowFinity"},{pattern:/^\s*(lfmobile:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Laserfische"},{pattern:/^\s*(mspbi:\/\/([^\s]+))\s*$/i,label:"{messages.openInApp}",appName:"Microsoft Power Bi"}];function xs(i){let e=null;return $s.some(t=>(t.pattern.test(i)&&(e=t),!!e)),e}function Ts(i,e){if(typeof e!="string"||!e)return e;const t=xs(e);if(!t)return e;const s=e.match(t.pattern),n=s&&s[2],r=Vt(Vt(t.label,{messages:i,hierPart:n}),{appName:t.appName}),a=t.target?` target="${t.target}"`:"",d=t.target==="_blank"?' rel="noreferrer"':"";return e.replace(t.pattern,`${r}`)}const We="esri-feature-fields",qe={base:We,fieldHeader:`${We}__field-header`,fieldData:`${We}__field-data`,fieldDataDate:`${We}__field-data--date`};let ne=class extends Z{constructor(e,t){super(e,t),this._featureElementInfo=null,this.viewModel=new Ze,this.messages=null,this.messagesURIUtils=null}initialize(){this._featureElementInfo=new Je,this.addHandles(f(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.description,(t=this.viewModel)==null?void 0:t.title]},()=>this._setupFeatureElementInfo(),H))}destroy(){var e;(e=this._featureElementInfo)==null||e.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get expressionInfos(){return this.viewModel.expressionInfos}set expressionInfos(e){this.viewModel.expressionInfos=e}get fieldInfos(){return this.viewModel.fieldInfos}set fieldInfos(e){this.viewModel.fieldInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){var e;return u("div",{class:qe.base},(e=this._featureElementInfo)==null?void 0:e.render(),this._renderFields())}_renderFieldInfo(e,t){const{attributes:s}=this.viewModel,n=e.fieldName,r=e.label||n,a=s?s[n]==null?"":s[n]:"",d=!(!e.format||!e.format.dateFormat),c=typeof a=="number"&&!d?this._forceLTR(a):Ts(this.messagesURIUtils,a),h={[qe.fieldDataDate]:d};return u("tr",{key:`fields-element-info-row-${n}-${t}`},u("th",{class:qe.fieldHeader,innerHTML:r,key:`fields-element-info-row-header-${n}-${t}`}),u("td",{class:this.classes(qe.fieldData,h),innerHTML:c,key:`fields-element-info-row-data-${n}-${t}`}))}_renderFields(){const{formattedFieldInfos:e}=this.viewModel;return e!=null&&e.length?u("table",{class:I.table,summary:this.messages.fieldsSummary},u("tbody",null,e.map((t,s)=>this._renderFieldInfo(t,s)))):null}_setupFeatureElementInfo(){var s;const{description:e,title:t}=this;(s=this._featureElementInfo)==null||s.set({description:e,title:t})}_forceLTR(e){return`‎${e}`}};o([l()],ne.prototype,"attributes",null),o([l()],ne.prototype,"description",null),o([l()],ne.prototype,"expressionInfos",null),o([l()],ne.prototype,"fieldInfos",null),o([l()],ne.prototype,"title",null),o([l({type:Ze,nonNullable:!0})],ne.prototype,"viewModel",void 0),o([l(),Y("esri/widgets/Feature/t9n/Feature")],ne.prototype,"messages",void 0),o([l(),Y("esri/widgets/support/t9n/uriUtils")],ne.prototype,"messagesURIUtils",void 0),ne=o([R("esri.widgets.Feature.FeatureFields")],ne);const Ii=ne,ks=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches,Rs="esri.widgets.Feature.support.relatedFeatureUtils",Gt=ie.getLogger(Rs),Yt=new Map;function ze(i){if(!we(i))return null;const[e,t]=i.split("/").slice(1);return{layerId:e,fieldName:t}}function Ps(i,e){if(!e.relationships)return null;let t=null;const{relationships:s}=e;return s.some(n=>n.id===parseInt(i,10)&&(t=n,!0)),t}function Ls({originRelationship:i,relationships:e,layerId:t}){let s=null;return e&&e.some(n=>(`${n.relatedTableId}`===t&&n.id===(i==null?void 0:i.id)&&(s=n),!!s)),s}function Os(i,e){const t=e.toLowerCase();for(const s in i)if(s.toLowerCase()===t)return i[s];return null}function Vs(i,e){const t=Ps(i,e);if(t)return{url:`${e.url}/${t.relatedTableId}`,sourceSpatialReference:e.spatialReference,relation:t,relatedFields:[],outStatistics:[]}}function Ns(i,e){if(!e||!i)return;const{features:t,statsFeatures:s}=i,n=t==null?void 0:t.value;e.relatedFeatures=n?n.features:[];const r=s==null?void 0:s.value;e.relatedStatsFeatures=r?r.features:[]}function Ss(i,e,t,s){var r;const n=new vt;return n.outFields=["*"],n.relationshipId=typeof e.id=="number"?e.id:parseInt(e.id,10),n.objectIds=[i.attributes[t.objectIdField]],((r=t.queryRelatedFeatures)==null?void 0:r.call(t,n,s))??Promise.resolve({})}function Ds(i,e,t){let s=0;const n=[];for(;sJSON.stringify(e.toJSON())===JSON.stringify(t.toJSON())):void 0}async function qs(i,e,t,s){const n=t.layerId.toString(),{layerInfo:r,relation:a,relatedFields:d,outStatistics:c,url:h,sourceSpatialReference:p}=e,m=Bs(d),g=Ws(c);if(!r||!a)return null;const _=Ls({originRelationship:a,relationships:r.relationships,layerId:n});if(_!=null&&_.relationshipTableId&&_.keyFieldInRelationshipTable){const w=(await Ss(i,_,t,s))[i.attributes[t.objectIdField]];if(!w)return null;const A=w.features.map(b=>b.attributes[r.objectIdField]);if(g!=null&&g.length&&r.supportsStatistics){const b=new it;b.where=Ds(r.objectIdField,A,1e3),b.outFields=m,b.outStatistics=g,b.sourceSpatialReference=p;const T={features:Promise.resolve(w),statsFeatures:st(h,b)};return Ce(T)}}const v=_==null?void 0:_.keyField;if(v){const w=Hi(Qs(r.fields,v)),A=Os(i.attributes,a.keyField),b=w?`${v}=${A}`:`${v}='${A}'`,T=st(h,new it({where:b,outFields:m,sourceSpatialReference:p}),s),L=g!=null&&g.length&&r.supportsStatistics?st(h,new it({where:b,outFields:m,outStatistics:g,sourceSpatialReference:p}),s):null,V={features:T};return L&&(V.statsFeatures=L),Ce(V)}return null}function Hs(i,e){return zi(i,{query:{f:"json"},signal:e==null?void 0:e.signal})}function zs({relatedInfos:i,layer:e},t){const s={};return i.forEach((n,r)=>{const{relation:a}=n;if(!a){const m=new k("relation-required","A relation is required on a layer to retrieve related records.");throw Gt.error(m),m}const{relatedTableId:d}=a;if(typeof d!="number"){const m=new k("A related table ID is required on a layer to retrieve related records.");throw Gt.error(m),m}const c=`${e.url}/${d}`,h=Yt.get(c),p=h??Hs(c);h||Yt.set(c,p),s[r]=p}),Wi(Ce(s),t)}function js({graphic:i,relatedInfos:e,layer:t},s){const n={};return e.forEach((r,a)=>{r.layerInfo&&(n[a]=qs(i,r,t,s))}),Ce(n)}function Us({relatedInfo:i,fieldName:e,fieldInfo:t}){var s,n;if((s=i.relatedFields)==null||s.push(e),t.statisticType){const r=new qi({statisticType:t.statisticType,onStatisticField:e,outStatisticFieldName:e});(n=i.outStatistics)==null||n.push(r)}}function Qs(i,e){if(i!=null){e=e.toLowerCase();for(const t of i)if(t&&t.name.toLowerCase()===e)return t}return null}const Kt={chartAnimation:!0};let D=class extends ce{constructor(e){super(e),this.abilities={...Kt},this.activeMediaInfoIndex=0,this.attributes=null,this.description=null,this.fieldInfoMap=null,this.formattedAttributes=null,this.expressionAttributes=null,this.isAggregate=!1,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null}castAbilities(e){return{...Kt,...e}}get activeMediaInfo(){return this.formattedMediaInfos[this.activeMediaInfoIndex]||null}get formattedMediaInfos(){return this._formatMediaInfos()||[]}get formattedMediaInfoCount(){return this.formattedMediaInfos.length}setActiveMedia(e){this._setContentElementMedia(e)}next(){this._pageContentElementMedia(1)}previous(){this._pageContentElementMedia(-1)}_setContentElementMedia(e){const{formattedMediaInfoCount:t}=this,s=(e+t)%t;this.activeMediaInfoIndex=s}_pageContentElementMedia(e){const{activeMediaInfoIndex:t}=this,s=t+e;this._setContentElementMedia(s)}_formatMediaInfos(){const{mediaInfos:e,layer:t}=this,s=this.attributes??{},n=this.formattedAttributes??{},r=this.expressionAttributes??{},a=this.fieldInfoMap??new Map;return(e==null?void 0:e.map(d=>{const c=d==null?void 0:d.clone();if(!c)return null;if(c.title=be({attributes:s,fieldInfoMap:a,globalAttributes:n,expressionAttributes:r,layer:t,text:c.title}),c.caption=be({attributes:s,fieldInfoMap:a,globalAttributes:n,expressionAttributes:r,layer:t,text:c.caption}),c.altText=be({attributes:s,fieldInfoMap:a,globalAttributes:n,expressionAttributes:r,layer:t,text:c.altText}),c.type==="image"){const{value:h}=c;return this._setImageValue({value:h,formattedAttributes:n,layer:t}),c.value.sourceURL?c:void 0}if(c.type==="pie-chart"||c.type==="line-chart"||c.type==="column-chart"||c.type==="bar-chart"){const{value:h}=c;return this._setChartValue({value:h,chartType:c.type,attributes:s,formattedAttributes:n,layer:t,expressionAttributes:r}),c}return null}).filter(Ke))??[]}_setImageValue(e){const t=this.fieldInfoMap??new Map,{value:s,formattedAttributes:n,layer:r}=e,{linkURL:a,sourceURL:d}=s;if(d){const c=Ht(d,r);s.sourceURL=zt({formattedAttributes:n,template:c,fieldInfoMap:t})}if(a){const c=Ht(a,r);s.linkURL=zt({formattedAttributes:n,template:c,fieldInfoMap:t})}}_setChartValue(e){const{value:t,attributes:s,formattedAttributes:n,chartType:r,layer:a,expressionAttributes:d}=e,{popupTemplate:c,relatedInfos:h}=this,{fields:p,normalizeField:m}=t,g=a;if(t.fields=hs(p,g),m&&(t.normalizeField=wt(m,g)),!p.some(v=>!!(n[v]!=null||we(v)&&(h!=null&&h.size))))return;const _=(c==null?void 0:c.fieldInfos)??[];p.forEach((v,w)=>{var T;const A=(T=t.colors)==null?void 0:T[w];if(we(v))return void(t.series=[...t.series,...this._getRelatedChartInfos({fieldInfos:_,fieldName:v,formattedAttributes:n,chartType:r,value:t,color:A})]);const b=this._getChartOption({value:t,attributes:s,chartType:r,formattedAttributes:n,expressionAttributes:d,fieldName:v,fieldInfos:_,color:A});t.series.push(b)})}_getRelatedChartInfos(e){var v;const{fieldInfos:t,fieldName:s,formattedAttributes:n,chartType:r,value:a,color:d}=e,c=[],h=ze(s),p=h&&((v=this.relatedInfos)==null?void 0:v.get(h.layerId.toString()));if(!p)return c;const{relatedFeatures:m,relation:g}=p;if(!g||!m)return c;const{cardinality:_}=g;return m.forEach(w=>{const{attributes:A}=w;A&&Object.keys(A).forEach(b=>{b===h.fieldName&&c.push(this._getChartOption({value:a,attributes:A,formattedAttributes:n,fieldName:s,chartType:r,relatedFieldName:b,hasMultipleRelatedFeatures:(m==null?void 0:m.length)>1,fieldInfos:t,color:d}))})}),_==="one-to-many"||_==="many-to-many"?c:[c[0]]}_getTooltip({label:e,value:t,chartType:s}){return s==="pie-chart"?`${e}`:`${e}: ${t}`}_getChartOption(e){var ee;const{value:t,attributes:s,formattedAttributes:n,expressionAttributes:r,fieldName:a,relatedFieldName:d,fieldInfos:c,chartType:h,hasMultipleRelatedFeatures:p,color:m}=e,g=this.layer,_=this.fieldInfoMap??new Map,{normalizeField:v,tooltipField:w}=t,A=v?we(v)?s[ze(v).fieldName]:s[v]:null,b=wi(a)&&r&&r[a]!==void 0?r[a]:d&&s[d]!==void 0?s[d]:s[a]!==void 0?s[a]:n[a],T=new ji({fieldName:a,color:m,value:b===void 0?null:b&&A?b/A:b});if(we(a)){const q=_.get(a.toLowerCase()),et=w&&_.get(w.toLowerCase()),Li=(q==null?void 0:q.fieldName)??a,tt=p&&w?ze(w).fieldName:(et==null?void 0:et.fieldName)??w,Oi=p&&tt?s[tt]:n[tt]??(q==null?void 0:q.label)??(q==null?void 0:q.fieldName)??d,Vi=p&&d?s[d]:n[Li];return T.tooltip=this._getTooltip({label:Oi,value:Vi,chartType:h}),T}const L=ps(c,a),V=wt(a,g),se=w&&n[w]!==void 0?n[w]:yi(L||new ci({fieldName:V}),(ee=this.popupTemplate)==null?void 0:ee.expressionInfos),K=n[V];return T.tooltip=this._getTooltip({label:se,value:K,chartType:h}),T}};o([l()],D.prototype,"abilities",void 0),o([Te("abilities")],D.prototype,"castAbilities",null),o([l()],D.prototype,"activeMediaInfoIndex",void 0),o([l({readOnly:!0})],D.prototype,"activeMediaInfo",null),o([l()],D.prototype,"attributes",void 0),o([l()],D.prototype,"description",void 0),o([l()],D.prototype,"fieldInfoMap",void 0),o([l()],D.prototype,"formattedAttributes",void 0),o([l()],D.prototype,"expressionAttributes",void 0),o([l({readOnly:!0})],D.prototype,"formattedMediaInfos",null),o([l()],D.prototype,"isAggregate",void 0),o([l()],D.prototype,"layer",void 0),o([l({readOnly:!0})],D.prototype,"formattedMediaInfoCount",null),o([l()],D.prototype,"mediaInfos",void 0),o([l()],D.prototype,"popupTemplate",void 0),o([l()],D.prototype,"relatedInfos",void 0),o([l()],D.prototype,"title",void 0),D=o([R("esri.widgets.Feature.FeatureMedia.FeatureMediaViewModel")],D);const Me=D,N="esri-feature-media",U={base:N,mediaContainer:`${N}__container`,mediaItemContainer:`${N}__item-container`,mediaItem:`${N}__item`,mediaItemText:`${N}__item-text`,mediaItemTitle:`${N}__item-title`,mediaItemCaption:`${N}__item-caption`,mediaNavigation:`${N}__item-navigation`,mediaPagination:`${N}__pagination`,mediaPaginationText:`${N}__pagination-text`,mediaPrevious:`${N}__previous`,mediaPreviousIconLTR:`${N}__previous-icon`,mediaPreviousIconRTL:`${N}__previous-icon--rtl`,mediaNext:`${N}__next`,mediaNextIconLTR:`${N}__next-icon`,mediaNextIconRTL:`${N}__next-icon--rtl`,mediaChart:`${N}__chart`,mediaPaginationButton:`${N}__pagination-button`,mediaPaginationIcon:`${N}__pagination-icon`,mediaChartRendered:`${N}__chart--rendered`},ht=15,ue="category",Pe="value",Xs="rgba(50, 50, 50, 1)",Gs=250,Ys=500,Ks=200;let Q=class extends Z{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this._chartRootMap=new WeakMap,this.viewModel=new Me,this.messages=null,this._disposeChart=s=>{var n;(n=this._chartRootMap.get(s))==null||n.dispose(),this._chartRootMap.delete(s)},this._createChart=async s=>{const{destroyed:n,viewModel:r}=this;if(n||!r||!s)return;const{createRoot:a}=await E(()=>import("./chartUtilsAm5-owLhGEU2.js").then(c=>c.c),__vite__mapDeps([5,2,3,6,7,8])),d=await a(s);this._chartRootMap.set(s,d),this._renderChart({mediaInfo:r.activeMediaInfo,root:d})}}initialize(){this._featureElementInfo=new Je,this.addHandles([f(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.activeMediaInfo,(t=this.viewModel)==null?void 0:t.activeMediaInfoIndex]},()=>this._setupMediaRefreshTimer(),H),f(()=>{var e,t;return[(e=this.viewModel)==null?void 0:e.description,(t=this.viewModel)==null?void 0:t.title]},()=>this._setupFeatureElementInfo(),H)])}loadDependencies(){return Re({icon:()=>E(()=>import("./calcite-icon-ZhRmLRGh.js"),__vite__mapDeps([0,1,2,3,4]))})}destroy(){var e;this._clearMediaRefreshTimer(),(e=this._featureElementInfo)==null||e.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get activeMediaInfoIndex(){return this.viewModel.activeMediaInfoIndex}set activeMediaInfoIndex(e){this.viewModel.activeMediaInfoIndex=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get fieldInfoMap(){return this.viewModel.fieldInfoMap}set fieldInfoMap(e){this.viewModel.fieldInfoMap=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get mediaInfos(){return this.viewModel.mediaInfos}set mediaInfos(e){this.viewModel.mediaInfos=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get relatedInfos(){return this.viewModel.relatedInfos}set relatedInfos(e){this.viewModel.relatedInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){var e;return u("div",{bind:this,class:U.base,onkeyup:this._handleMediaKeyup},(e=this._featureElementInfo)==null?void 0:e.render(),this._renderMedia())}_renderMedia(){const{formattedMediaInfoCount:e,activeMediaInfoIndex:t}=this.viewModel,s=this._renderMediaText();return e?u("div",{class:U.mediaContainer,key:"media-element-container"},this._renderMediaInfo(),u("div",{class:U.mediaNavigation},s,e>1?u("div",{class:U.mediaPagination},this._renderMediaPageButton("previous"),u("span",{class:U.mediaPaginationText},oe(this.messages.pageText,{index:t+1,total:e})),this._renderMediaPageButton("next")):null)):null}_renderMediaText(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e&&e.title?u("div",{class:U.mediaItemTitle,innerHTML:e.title,key:"media-title"}):null,s=e&&e.caption?u("div",{class:U.mediaItemCaption,innerHTML:e.caption,key:"media-caption"}):null;return t||s?u("div",{class:U.mediaItemText,key:"media-text"},t,s):null}_renderImageMediaInfo(e){const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:s,formattedMediaInfoCount:n}=this.viewModel,{value:r,refreshInterval:a,altText:d,title:c,type:h}=e,{sourceURL:p,linkURL:m}=r,g=vi(m??void 0)?"_blank":"_self",_=g==="_blank"?"noreferrer":"",v=a?t:null,w=v?v.timestamp:0,A=v?v.sourceURL:p,b=u("img",{alt:d||c,key:`media-${h}-${s}-${n}-${w}`,src:A??void 0});return(m?u("a",{href:m,rel:_,target:g,title:c},b):null)??b}_renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:s}=this.viewModel;return u("div",{afterCreate:this._createChart,afterRemoved:this._disposeChart,bind:this,class:U.mediaChart,key:`media-${e.type}-${t}-${s}`})}_renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?e.type==="image"?this._renderImageMediaInfo(e):e.type.includes("chart")?this._renderChartMediaInfo(e):null:null}_renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;return e?u("div",{class:U.mediaItemContainer,key:"media-container"},u("div",{class:U.mediaItem,key:"media-item-container"},this._renderMediaInfoType())):null}_renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t=e==="previous",s=t?this.messages.previous:this.messages.next,n=t?"chevron-left":"chevron-right",r=t?"media-previous":"media-next",a=t?this._previous:this._next;return u("button",{"aria-label":s,bind:this,class:U.mediaPaginationButton,key:r,onclick:a,tabIndex:0,title:s,type:"button"},u("calcite-icon",{class:U.mediaPaginationIcon,icon:n,scale:"s"}))}_setupFeatureElementInfo(){var s;const{description:e,title:t}=this;(s=this._featureElementInfo)==null||s.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_getRenderer(){if(!this.viewModel)return;const{isAggregate:e,layer:t}=this.viewModel;return e&&(t!=null&&t.featureReduction)&&"renderer"in t.featureReduction?t.featureReduction.renderer:t==null?void 0:t.renderer}async _getSeriesColors(e){const{colorAm5:t}=await E(()=>import("./chartCommon-OKgpftOz.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),s=new Map;return e.forEach(n=>{n.color&&s.set(n,t(n.color.toCss(!0)))}),s}async _getRendererColors(){const{colorAm5:e}=await E(()=>import("./chartCommon-OKgpftOz.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),t=new Map,s=this._getRenderer(),n="default";if(!s)return t;const r=await Ui(s);return r.delete(n),Array.from(r.values()).every(a=>(a==null?void 0:a.length)===1)&&Array.from(r.keys()).forEach(a=>{var c,h;const d=(h=(c=r.get(a))==null?void 0:c[0])==null?void 0:h.toCss(!0);d&&t.set(a,e(d))}),t}_handleMediaKeyup(e){const t=hi(e);t==="ArrowLeft"&&(e.stopPropagation(),this.viewModel.previous()),t==="ArrowRight"&&(e.stopPropagation(),this.viewModel.next())}_canAnimateChart(){return!!this.viewModel&&!!this.viewModel.abilities.chartAnimation&&!ks()}_getChartAnimationMS(){return this._canAnimateChart()?Gs:0}_getChartSeriesAnimationMS(){return this._canAnimateChart()?Ys:0}async _renderChart(e){const{root:t,mediaInfo:s}=e,{value:n,type:r}=s,{ResponsiveThemeAm5:a,DarkThemeAm5:d,AnimatedThemeAm5:c,ColorSetAm5:h,ThemeAm5:p,esriChartColorSet:m}=await E(()=>import("./chartCommon-OKgpftOz.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),g=p.new(t);g.rule("ColorSet").set("colors",m),g.rule("ColorSet").set("reuse",!0);const _=[a.new(t),g];Qi()&&_.push(d.new(t)),this._canAnimateChart()&&_.push(c.new(t)),t.setThemes(_);const v=await this._getRendererColors(),w=await this._getSeriesColors(n.series),A=h.new(t,{}),b=w.get(n.series[0]),T=b?{lineSettings:{stroke:b}}:void 0,L=n.series.map((V,se)=>{const K=w.get(V)||v.get(V.fieldName)||A.getIndex(se);return{[ue]:V.tooltip,[Pe]:V.value,columnSettings:{fill:K,stroke:K},...T}}).filter(V=>r!=="pie-chart"||V.value!=null&&V.value>0);r==="pie-chart"?this._createPieChart(e,L):this._createXYChart(e,L)}_getDirection(){return Ae(this.container)?"rtl":"ltr"}_isInversed(){return!!Ae(this.container)}async _customizeChartTooltip(e,t="horizontal"){var n;const{colorAm5:s}=await E(()=>import("./chartCommon-OKgpftOz.js"),__vite__mapDeps([9,6,2,3,10,11,7,12]));e.setAll({pointerOrientation:t}),(n=e.get("background"))==null||n.setAll({stroke:s(Xs)}),e.label.setAll({direction:this._getDirection(),oversizedBehavior:"wrap",maxWidth:Ks})}async _createPieChart(e,t){const{TooltipAm5:s}=await E(()=>import("./chartCommon-OKgpftOz.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),{PieChartAm5:n,PieSeriesAm5:r}=await E(()=>import("./pieChart-DJY-uQgy.js"),__vite__mapDeps([13,2,3,14,6,12,8])),{mediaInfo:a,root:d}=e,{title:c}=a,h=5,p=(a==null?void 0:a.altText)||(a==null?void 0:a.title)||"",m=d.container.children.push(n.new(d,{ariaLabel:p,focusable:!0,paddingBottom:h,paddingTop:h,paddingLeft:h,paddingRight:h})),g=`{category}: {valuePercentTotal.formatNumber('0.00')}% + ({value})`,_=s.new(d,{labelText:g}),v=m.series.push(r.new(d,{name:c,valueField:Pe,categoryField:ue,tooltip:_}));v.ticks.template.set("forceHidden",!0),v.labels.template.set("forceHidden",!0),v.slices.template.states.create("active",{shiftRadius:h}),this._customizeChartTooltip(_),v.slices.template.setAll({ariaLabel:g,focusable:!0,templateField:"columnSettings"}),v.data.setAll(t),v.appear(this._getChartSeriesAnimationMS()),m.appear(this._getChartAnimationMS()),m.root.dom.classList.toggle(U.mediaChartRendered,!0)}_getMinSeriesValue(e){let t=0;return e.forEach(s=>t=Math.min(s.value,t)),t}async _createColumnChart(e,t,s){const{TooltipAm5:n,ScrollbarAm5:r}=await E(()=>import("./chartCommon-OKgpftOz.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),{CategoryAxisAm5:a,AxisRendererXAm5:d,ValueAxisAm5:c,AxisRendererYAm5:h,ColumnSeriesAm5:p}=await E(()=>import("./xyChart-CbyBbMYg.js"),__vite__mapDeps([15,16,6,2,3,12,8,14,11])),{mediaInfo:m,root:g}=t,{value:_,title:v}=m;e.setAll({wheelX:"panX",wheelY:"zoomX"});const w=e.xAxes.push(a.new(g,{renderer:d.new(g,{inversed:this._isInversed()}),categoryField:ue}));w.get("renderer").labels.template.setAll({forceHidden:!0});const A=e.yAxes.push(c.new(g,{renderer:h.new(g,{inside:!1}),min:this._getMinSeriesValue(_.series)}));A.get("renderer").labels.template.setAll({direction:this._getDirection()});const b="{categoryX}",T=n.new(g,{labelText:b}),L=e.series.push(p.new(g,{name:v,xAxis:w,yAxis:A,valueYField:Pe,categoryXField:ue,tooltip:T}));this._customizeChartTooltip(T),L.columns.template.setAll({ariaLabel:b,focusable:!0,templateField:"columnSettings"}),_.series.length>ht&&e.set("scrollbarX",r.new(g,{orientation:"horizontal"})),w.data.setAll(s),L.data.setAll(s),L.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createBarChart(e,t,s){const{TooltipAm5:n,ScrollbarAm5:r}=await E(()=>import("./chartCommon-OKgpftOz.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),{CategoryAxisAm5:a,AxisRendererXAm5:d,ValueAxisAm5:c,AxisRendererYAm5:h,ColumnSeriesAm5:p}=await E(()=>import("./xyChart-CbyBbMYg.js"),__vite__mapDeps([15,16,6,2,3,12,8,14,11])),{mediaInfo:m,root:g}=t,{value:_,title:v}=m;e.setAll({wheelX:"panY",wheelY:"zoomY"});const w=e.yAxes.push(a.new(g,{renderer:h.new(g,{inversed:!0}),categoryField:ue}));w.get("renderer").labels.template.setAll({forceHidden:!0});const A=e.xAxes.push(c.new(g,{renderer:d.new(g,{inside:!1,inversed:this._isInversed()}),min:this._getMinSeriesValue(_.series)}));A.get("renderer").labels.template.setAll({direction:this._getDirection()});const b="{categoryY}",T=n.new(g,{labelText:b}),L=e.series.push(p.new(g,{name:v,xAxis:A,yAxis:w,valueXField:Pe,categoryYField:ue,tooltip:T}));this._customizeChartTooltip(T,"vertical"),L.columns.template.setAll({ariaLabel:b,focusable:!0,templateField:"columnSettings"}),_.series.length>ht&&e.set("scrollbarY",r.new(g,{orientation:"vertical"})),w.data.setAll(s),L.data.setAll(s),L.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createLineChart(e,t,s){var se,K,ee;const{TooltipAm5:n,ScrollbarAm5:r}=await E(()=>import("./chartCommon-OKgpftOz.js"),__vite__mapDeps([9,6,2,3,10,11,7,12])),{CategoryAxisAm5:a,AxisRendererXAm5:d,ValueAxisAm5:c,AxisRendererYAm5:h,LineSeriesAm5:p}=await E(()=>import("./xyChart-CbyBbMYg.js"),__vite__mapDeps([15,16,6,2,3,12,8,14,11])),{root:m,mediaInfo:g}=t,{value:_,title:v}=g;e.setAll({wheelX:"panX",wheelY:"zoomX"});const w=e.xAxes.push(a.new(m,{renderer:d.new(m,{inversed:this._isInversed()}),categoryField:ue}));w.get("renderer").labels.template.setAll({forceHidden:!0});const A=e.yAxes.push(c.new(m,{renderer:h.new(m,{inside:!1}),min:this._getMinSeriesValue(_.series)}));A.get("renderer").labels.template.setAll({direction:this._getDirection()});const b="{categoryX}",T=(K=(se=s[0])==null?void 0:se.lineSettings)==null?void 0:K.stroke,L=n.new(m,{getFillFromSprite:!T,labelText:b});T&&((ee=L.get("background"))==null||ee.setAll({fill:T}));const V=e.series.push(p.new(m,{name:v,xAxis:w,yAxis:A,valueYField:Pe,categoryXField:ue,tooltip:L}));V.strokes.template.setAll({templateField:"lineSettings"}),this._customizeChartTooltip(L,"vertical"),_.series.length>ht&&e.set("scrollbarX",r.new(m,{orientation:"horizontal"})),w.data.setAll(s),V.data.setAll(s),V.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createXYChart(e,t){const{XYChartAm5:s,XYCursorAm5:n}=await E(()=>import("./xyChart-CbyBbMYg.js"),__vite__mapDeps([15,16,6,2,3,12,8,14,11])),{root:r,mediaInfo:a}=e,{type:d}=a,c=(a==null?void 0:a.altText)||(a==null?void 0:a.title)||"",h=r.container.children.push(s.new(r,{ariaLabel:c,focusable:!0,panX:!0,panY:!0}));h.set("cursor",n.new(r,{})),d==="column-chart"&&await this._createColumnChart(h,e,t),d==="bar-chart"&&await this._createBarChart(h,e,t),d==="line-chart"&&await this._createLineChart(h,e,t),h.root.dom.classList.toggle(U.mediaChartRendered,!0)}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:e&&this._getImageSource(e,t)}}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;e&&e.type==="image"&&e.refreshInterval&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:s}=e;if(!t)return;const n=6e4*t;this._updateMediaInfoTimestamp(s.sourceURL);const r=setInterval(()=>{this._updateMediaInfoTimestamp(s.sourceURL)},n);this._refreshTimer=r}_getImageSource(e,t){const s=e.includes("?")?"&":"?",[n,r=""]=e.split("#");return`${n}${s}timestamp=${t}${r?"#":""}${r}`}};o([l()],Q.prototype,"_refreshIntervalInfo",void 0),o([l()],Q.prototype,"attributes",null),o([l()],Q.prototype,"activeMediaInfoIndex",null),o([l()],Q.prototype,"description",null),o([l()],Q.prototype,"fieldInfoMap",null),o([l()],Q.prototype,"layer",null),o([l()],Q.prototype,"mediaInfos",null),o([l()],Q.prototype,"popupTemplate",null),o([l()],Q.prototype,"relatedInfos",null),o([l()],Q.prototype,"title",null),o([l({type:Me})],Q.prototype,"viewModel",void 0),o([l(),Y("esri/widgets/Feature/t9n/Feature")],Q.prototype,"messages",void 0),Q=o([R("esri.widgets.Feature.FeatureMedia")],Q);const Fi=Q,Js=["$datastore","$map","$layer","$aggregatedfeatures"],Zs="esri.widgets.Feature.support.arcadeFeatureUtils",en=ie.getLogger(Zs);function tn(i){return typeof i=="string"?Ft(At(i)):Array.isArray(i)?sn(i):(i==null?void 0:i.declaredClass)==="esri.arcade.Dictionary"?nn(i):i}function sn(i){return`
    ${i.map(e=>`
  • ${typeof e=="string"?Ft(At(e)):e}
  • `).join("")}
`}function nn(i){return`${i.keys().map(e=>{const t=i.field(e);return``}).join("")}
${e}${typeof t=="string"?Ft(At(t)):t}
`}function rn({aggregatedFeatures:i,arcadeUtils:e,featureSetVars:t,context:s,viewInfo:n,map:r,graphic:a,interceptor:d}){t.forEach(c=>{const h=c.toLowerCase(),p=n.sr,m={map:r,spatialReference:p,interceptor:d};if(h==="$map"&&(s.vars[h]=e.convertMapToFeatureSetCollection(m)),h==="$layer"&&(s.vars[h]=e.convertFeatureLayerToFeatureSet({layer:a.sourceLayer,spatialReference:p,interceptor:d})),h==="$datastore"&&(s.vars[h]=e.convertServiceUrlToWorkspace({url:a.sourceLayer.url,spatialReference:p,interceptor:d})),h==="$aggregatedfeatures"){const g=a.layer,{fields:_,objectIdField:v,geometryType:w,spatialReference:A,displayField:b}=g,T=new Ms({fields:_,objectIdField:v,geometryType:w,spatialReference:A,displayField:b,...g.type==="feature"?{templates:g.templates,typeIdField:g.typeIdField,types:g.types}:null,source:i});s.vars[h]=e.convertFeatureLayerToFeatureSet({layer:T,spatialReference:A,interceptor:d})}})}function Ai(){return E(()=>import("./arcadeUtils-vGyJZHQt.js").then(i=>i.aD),__vite__mapDeps([17,2,3,18,19]))}function on(i){return"createQuery"in i&&"queryFeatures"in i}async function an({graphic:i,view:e}){const{isAggregate:t,layer:s}=i;if(!t||!s||(e==null?void 0:e.type)!=="2d")return[];const n=await e.whenLayerView(s);if(!on(n))return[];const r=n.createQuery(),a=i.getObjectId();r.aggregateIds=a!=null?[a]:[];const{features:d}=await n.queryFeatures(r);return d}async function Ci({expressionInfo:i,arcadeUtils:e,interceptor:t,spatialReference:s,map:n,graphic:r,view:a}){if(!(i!=null&&i.expression))return null;const d=e.createSyntaxTree(i.expression),c=Js.filter(_=>e.hasVariable(d,_)),[h]=await Promise.all([an({graphic:r,view:a}),e.loadScriptDependencies(d,!0,c)]),p=e.getViewInfo({spatialReference:s}),m=e.createExecContext(r,p,a==null?void 0:a.timeZone);m.interceptor=t,m.useAsync=!0,rn({aggregatedFeatures:h,arcadeUtils:e,featureSetVars:c,context:m,viewInfo:p,map:n,graphic:r,interceptor:t});const g=e.createFunction(d,m);return e.executeAsyncFunction(g,m).catch(_=>en.error("arcade-execution-error",{error:_,graphic:r,expressionInfo:i}))}async function ln({expressionInfos:i,spatialReference:e,graphic:t,interceptor:s,map:n,view:r}){if(!(i!=null&&i.length))return{};const a=await Ai(),d={};for(const p of i)d[`expression/${p.name}`]=Ci({expressionInfo:p,arcadeUtils:a,interceptor:s,spatialReference:e,map:n,graphic:t,view:r});const c=await Ce(d),h={};for(const p in c)h[p]=tn(c[p].value);return h}const dn=1;let J=class extends ce{constructor(e){super(e),this._abortController=null,this.expressionInfo=null,this.graphic=null,this.contentElement=null,this.contentElementViewModel=null,this.interceptor=null,this.view=null,this._cancelQuery=()=>{const{_abortController:t}=this;t&&t.abort(),this._abortController=null},this._createVM=()=>{var n,r;const t=(n=this.contentElement)==null?void 0:n.type;(r=this.contentElementViewModel)==null||r.destroy();const s=t==="fields"?new Ze:t==="media"?new Me:t==="text"?new Ge:null;this._set("contentElementViewModel",s)},this._compile=async()=>{this._cancelQuery();const t=new AbortController;this._abortController=t,await this._compileExpression(),this._abortController===t&&(this._abortController=null)},this._compileThrottled=Qe(this._compile,dn,this),this._compileExpression=async()=>{const{expressionInfo:t,graphic:s,interceptor:n,spatialReference:r,map:a,view:d,_abortController:c}=this;if(!(t&&s&&r&&a))return void this._set("contentElement",null);const h=await Ai();if(c!==this._abortController)return;const p=await Ci({arcadeUtils:h,expressionInfo:t,graphic:s,interceptor:n,map:a,spatialReference:r,view:d});if(!p||p.declaredClass!=="esri.arcade.Dictionary")return void this._set("contentElement",null);const m=await p.castAsJsonAsync(c==null?void 0:c.signal),g=m==null?void 0:m.type,_=g==="media"?Gi.fromJSON(m):g==="text"?pi.fromJSON(m):g==="fields"?Yi.fromJSON(m):null;this._set("contentElement",_)},this.addHandles([f(()=>[this.expressionInfo,this.graphic,this.map,this.spatialReference,this.view],()=>this._compileThrottled(),H),f(()=>[this.contentElement],()=>this._createVM(),H)])}initialize(){this.addHandles(this._compileThrottled)}destroy(){var e;this._cancelQuery(),(e=this.contentElementViewModel)==null||e.destroy(),this._set("contentElementViewModel",null),this._set("contentElement",null)}get spatialReference(){var e;return((e=this.view)==null?void 0:e.spatialReference)??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{_abortController:e,contentElement:t,contentElementViewModel:s}=this;return e?"loading":t||s?"ready":"disabled"}get map(){var e;return((e=this.view)==null?void 0:e.map)??null}set map(e){this._override("map",e)}};o([l()],J.prototype,"_abortController",void 0),o([l({type:Xi})],J.prototype,"expressionInfo",void 0),o([l({type:ke})],J.prototype,"graphic",void 0),o([l({readOnly:!0})],J.prototype,"contentElement",void 0),o([l({readOnly:!0})],J.prototype,"contentElementViewModel",void 0),o([l()],J.prototype,"interceptor",void 0),o([l()],J.prototype,"spatialReference",null),o([l({readOnly:!0})],J.prototype,"state",null),o([l()],J.prototype,"map",null),o([l()],J.prototype,"view",void 0),J=o([R("esri.widgets.Feature.FeatureExpression.FeatureExpressionViewModel")],J);const $t=J,pt="esri-feature",mt={base:`${pt}-expression`,loadingSpinnerContainer:`${pt}__loading-container`,spinner:`${pt}__loading-spinner`};let je=class extends Z{constructor(e,t){super(e,t),this._contentWidget=null,this.viewModel=new $t}initialize(){this.addHandles(f(()=>{var e;return(e=this.viewModel)==null?void 0:e.contentElementViewModel},()=>this._setupExpressionWidget(),H))}destroy(){this._destroyContentWidget()}render(){var t;const{state:e}=this.viewModel;return u("div",{class:mt.base},e==="loading"?this._renderLoading():e==="disabled"?null:(t=this._contentWidget)==null?void 0:t.render())}_renderLoading(){return u("div",{class:mt.loadingSpinnerContainer,key:"loading-container"},u("span",{class:this.classes(pe.loadingIndicator,I.rotating,mt.spinner)}))}_destroyContentWidget(){const{_contentWidget:e}=this;e&&(e.viewModel=null,e.destroy()),this._contentWidget=null}_setupExpressionWidget(){const{contentElementViewModel:e,contentElement:t}=this.viewModel,s=t==null?void 0:t.type;this._destroyContentWidget();const n=e?s==="fields"?new Ii({viewModel:e}):s==="media"?new Fi({viewModel:e}):s==="text"?new He({viewModel:e}):null:null;this._contentWidget=n,this.scheduleRender()}};o([l({type:$t})],je.prototype,"viewModel",void 0),je=o([R("esri.widgets.Feature.FeatureExpression")],je);const cn=je;var Jt;(function(i){i.TOO_SHORT="length-validation-error::too-short"})(Jt||(Jt={}));const un=i=>{var t;const e=[];if(i.formTemplate){const{description:s,title:n}=i.formTemplate;(t=i.fields)==null||t.forEach(r=>{const a=n&&Nt(n,r.name),d=s&&Nt(s,r.name);(a||d)&&e.push(r.name)})}return e},gt=100;let $=class extends Ki(mi(ce)){constructor(e){super(e),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{const{_queryAbortController:t}=this;t&&t.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:t}=this;t&&t.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:t}=this;t&&t.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const t=new AbortController;this._queryAbortController=t,await nt(this._query()),this._queryAbortController===t&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();const t=new AbortController;this._queryFeatureCountAbortController=t,await nt(this._queryFeatureCount()),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryPageController=async()=>{const t=new AbortController;this._queryPageAbortController=t,await nt(this._queryPage()),this._queryPageAbortController===t&&(this._queryPageAbortController=null)},this._queryDebounced=rt(this._queryController,gt),this._queryFeatureCountDebounced=rt(this._queryFeatureCountController,gt),this._queryPageDebounced=rt(this._queryPageController,gt),this._query=async()=>{const{_queryAbortController:t,relatedFeatures:s}=this;this.featureCount&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,s.removeAll(),this.destroyed||s.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:t==null?void 0:t.signal}))))},this.addHandles([f(()=>{var t;return[this.displayCount,this.graphic,this.layer,(t=this.layer)==null?void 0:t.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount]},()=>this._queryDebounced(),H),f(()=>[this.featurePage,this.showAllEnabled],()=>this._queryPageDebounced()),f(()=>[this.layer,this.relationshipId,this.objectId,this.canQuery],()=>this._queryFeatureCountDebounced())])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.removeAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:s}=this,n=1,r=Math.ceil(s/t)||1;this._set("featurePage",Math.min(Math.max(e,n),r))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&(t!=null&&t.loaded)?e.map(s=>{const n=s.clone();return n.field=wt(s.field,t),n}):e??[]}get supportsCacheHint(){var e,t,s;return!!((s=(t=(e=this.layer)==null?void 0:e.capabilities)==null?void 0:t.queryRelated)!=null&&s.supportsCacheHint)}get canLoad(){return!!this.map&&typeof this.relationshipId=="number"&&typeof this.objectId=="number"}get canQuery(){var t,s;const e=(s=(t=this.layer)==null?void 0:t.capabilities)==null?void 0:s.queryRelated;return!!(this.relatedLayer&&this.relationship&&typeof this.relationshipId=="number"&&typeof this.objectId=="number"&&(e!=null&&e.supportsCount)&&(e!=null&&e.supportsPagination))}get itemDescriptionFieldName(){var e;return((e=this.orderByFieldsFixedCasing[0])==null?void 0:e.field)||null}set displayCount(e){this._set("displayCount",Math.min(Math.max(e,0),10))}get displayCount(){return this._get("displayCount")}get objectId(){var e,t;return(this.objectIdField&&((t=(e=this.graphic)==null?void 0:e.attributes)==null?void 0:t[this.objectIdField]))??null}get objectIdField(){var e;return((e=this.layer)==null?void 0:e.objectIdField)||null}get relatedFeatures(){return this._get("relatedFeatures")||new De}get relatedLayer(){const{layer:e,map:t,relationship:s}=this;return e!=null&&e.loaded&&t&&s?ms(t,e,s)??null:null}get relationship(){var s;const{relationshipId:e,layer:t}=this;return typeof e=="number"?((s=t==null?void 0:t.relationships)==null?void 0:s.find(({id:n})=>n===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new De}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:s,canQuery:n,_loaded:r,canLoad:a}=this;return t||a&&!r?"loading":e||s?"querying":n?"ready":"disabled"}getRelatedFeatureByObjectId(e){return this.relatedFeatures.find(t=>t.getObjectId()===e)}_destroyRelatedFeatureViewModels(){var e;(e=this.relatedFeatureViewModels)==null||e.forEach(t=>!t.destroyed&&t.destroy()),this.relatedFeatureViewModels.removeAll()}async _queryFeatureCount(){const{layer:e,relatedLayer:t,relationshipId:s,objectId:n,_queryFeatureCountAbortController:r,canQuery:a,supportsCacheHint:d}=this;if(await(e==null?void 0:e.load()),await(t==null?void 0:t.load()),!a||!e||!t)return void this._set("featureCount",0);const c=t.createQuery(),h=new vt({cacheHint:d,relationshipId:s,returnGeometry:!1,objectIds:[n],where:c.where??void 0}),p=await e.queryRelatedFeaturesCount(h,{signal:r==null?void 0:r.signal});this._set("featureCount",p[n]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:s}=this;return t?e:s?e.slice(0,s):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:s,_queryPageAbortController:n,featureCount:r}=this;!s||t<2||!r||e.addMany(await this._queryRelatedFeatures({signal:n==null?void 0:n.signal}))}async _queryRelatedFeatures(e){var ee;const{orderByFieldsFixedCasing:t,showAllEnabled:s,featuresPerPage:n,displayCount:r,layer:a,relationshipId:d,featurePage:c,featureCount:h,relatedLayer:p,supportsCacheHint:m}=this,{canQuery:g,objectId:_}=this;if(!g||!a||!p)return[];const v=s?((c-1)*n+h)%h:0,w=s?n:r,A=p.objectIdField,b=[...t.map(q=>q.field),...un(p),A].filter(Ke),T=t.map(q=>`${q.field} ${q.order}`),L=p.createQuery(),V=new vt({orderByFields:T,start:v,num:w,outFields:b,cacheHint:m,relationshipId:d,returnGeometry:!1,objectIds:[_],where:L.where??void 0}),se=await a.queryRelatedFeatures(V,{signal:e==null?void 0:e.signal}),K=((ee=se[_])==null?void 0:ee.features)||[];return K.forEach(q=>{q.sourceLayer=p,q.layer=p}),K}};o([l()],$.prototype,"_loaded",void 0),o([l()],$.prototype,"_queryAbortController",void 0),o([l()],$.prototype,"_queryPageAbortController",void 0),o([l()],$.prototype,"_queryFeatureCountAbortController",void 0),o([l({value:1})],$.prototype,"featurePage",null),o([l()],$.prototype,"featuresPerPage",void 0),o([l({readOnly:!0})],$.prototype,"orderByFieldsFixedCasing",null),o([l({readOnly:!0})],$.prototype,"supportsCacheHint",null),o([l({readOnly:!0})],$.prototype,"canLoad",null),o([l({readOnly:!0})],$.prototype,"canQuery",null),o([l()],$.prototype,"description",void 0),o([l({readOnly:!0})],$.prototype,"itemDescriptionFieldName",null),o([l({value:3})],$.prototype,"displayCount",null),o([l({type:ke})],$.prototype,"graphic",void 0),o([l()],$.prototype,"layer",void 0),o([l()],$.prototype,"map",void 0),o([l({readOnly:!0})],$.prototype,"objectId",null),o([l({readOnly:!0})],$.prototype,"objectIdField",null),o([l()],$.prototype,"orderByFields",void 0),o([l({readOnly:!0})],$.prototype,"relatedFeatures",null),o([l({readOnly:!0})],$.prototype,"relatedLayer",null),o([l({readOnly:!0})],$.prototype,"relationship",null),o([l()],$.prototype,"featureCount",void 0),o([l({readOnly:!0})],$.prototype,"relatedFeatureViewModels",null),o([l()],$.prototype,"relationshipId",void 0),o([l()],$.prototype,"showAllEnabled",void 0),o([l()],$.prototype,"state",null),o([l()],$.prototype,"title",void 0),o([l()],$.prototype,"getRelatedFeatureByObjectId",null),$=o([R("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],$);const xt=$,Ve="esri-feature",Le=`${Ve}-relationship`,ae={base:Le,listContainer:`${Le}__list`,listItem:`${Le}__list-item`,listItemHidden:`${Le}__list-item--hidden`,listContainerQuerying:`${Le}__list--querying`,featureObserver:`${Ve}__feature-observer`,stickySpinnerContainer:`${Ve}__sticky-loading-container`,loadingSpinnerContainer:`${Ve}__loading-container`,spinner:`${Ve}__loading-spinner`},Zt={title:!0,description:!0};let X=class extends Z{constructor(e,t){super(e,t),this._featureElementInfo=null,this._relatedFeatureIntersectionObserverNode=null,this._relatedFeatureIntersectionObserver=new IntersectionObserver(([s])=>{s!=null&&s.isIntersecting&&this._increaseFeaturePage()},{root:window.document}),this.headingLevel=2,this.viewModel=new xt,this.messages=null,this.messagesCommon=null,this.visibleElements={...Zt},this._increaseFeaturePage=()=>{const{state:s,showAllEnabled:n,relatedFeatures:r,featuresPerPage:a,featurePage:d}=this.viewModel;s==="ready"&&n&&r.length>=a*d&&this.viewModel.featurePage++}}initialize(){this._featureElementInfo=new Je,this.addHandles([f(()=>[this.viewModel.description,this.viewModel.title,this.headingLevel],()=>this._setupFeatureElementInfo(),H),f(()=>[this.viewModel.state,this.viewModel.showAllEnabled,this._relatedFeatureIntersectionObserverNode],()=>this._handleRelatedFeatureObserverChange()),Fe(()=>this.viewModel.relatedFeatureViewModels,"change",()=>this._setupRelatedFeatureViewModels())])}loadDependencies(){return Re({icon:()=>E(()=>import("./calcite-icon-ZhRmLRGh.js"),__vite__mapDeps([0,1,2,3,4])),list:()=>E(()=>import("./calcite-list-KbTGTbJq.js"),__vite__mapDeps([20,2,3,21,4,22,23,24,25,26,27,1,28,29,30,31,32,33,34,35])),"list-item":()=>E(()=>import("./calcite-list-item-ewhQm-Oo.js"),__vite__mapDeps([36,2,3,21,22,25,26,4,27,23,37,34,31,1,33])),notice:()=>E(()=>import("./calcite-notice-6pbWdSt0.js"),__vite__mapDeps([38,2,3,39,4,23,25,26,27,40,31,1]))})}destroy(){this._unobserveRelatedFeatureObserver(),this._featureElementInfo=Ji(this._featureElementInfo)}get displayShowAllButton(){const{showAllEnabled:e,featureCount:t,displayCount:s,state:n}=this.viewModel;return!e&&!!t&&n==="ready"&&(t>s||s===0)}get displayListItems(){return this.displayShowAllButton||this.viewModel.relatedFeatureViewModels.length>0}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get featureCountDescription(){const{messages:e}=this,{featureCount:t}=this.viewModel;return oe(e==null?void 0:e.numberRecords,{number:t})}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}castVisibleElements(e){return{...Zt,...e}}render(){var t;const{state:e}=this.viewModel;return u("div",{class:this.classes(ae.base,I.widget)},(t=this._featureElementInfo)==null?void 0:t.render(),e==="loading"?this._renderLoading():e==="disabled"?this._renderRelationshipNotFound():this._renderRelatedFeatures())}_renderStickyLoading(){return this.viewModel.state==="querying"?u("div",{class:ae.stickySpinnerContainer,key:"sticky-loader"},this._renderLoadingIcon()):null}_renderLoadingIcon(){return u("span",{class:this.classes(pe.loadingIndicator,I.rotating,ae.spinner)})}_renderLoading(){return u("div",{class:ae.loadingSpinnerContainer,key:"loading-container"},this._renderLoadingIcon())}_renderShowAllIconNode(){return u("calcite-icon",{icon:"list",scale:"s",slot:"content-end"})}_renderChevronIconNode(){const e=Ae(this.container)?"chevron-left":"chevron-right";return u("calcite-icon",{icon:e,scale:"s",slot:"content-end"})}_renderRelatedFeature(e){var r;const{itemDescriptionFieldName:t}=this.viewModel,s=e.title;e.description=t&&((r=e.formattedAttributes)==null?void 0:r.global[t]);const n=e.state==="loading";return u("calcite-list-item",{class:this.classes(ae.listItem,{[ae.listItemHidden]:n}),description:e.description??"",key:e.uid,label:s,onCalciteListItemSelect:()=>this.emit("select-record",{featureViewModel:e})},this._renderChevronIconNode())}_renderShowAllListItem(){var e;return this.displayShowAllButton?u("calcite-list-item",{description:this.featureCountDescription,key:"show-all-item",label:(e=this.messages)==null?void 0:e.showAll,onCalciteListItemSelect:()=>this.emit("show-all-records")},this._renderShowAllIconNode()):null}_renderNoRelatedFeaturesMessage(){var e;return u("calcite-notice",{icon:"information",key:"no-related-features-message",kind:"brand",open:!0,scale:"s",width:"full"},u("div",{slot:"message"},(e=this.messages)==null?void 0:e.noRelatedFeatures))}_renderFeatureObserver(){return u("div",{afterCreate:this._relatedFeatureIntersectionObserverCreated,bind:this,class:ae.featureObserver,key:"feature-observer"})}_renderList(){const{relatedFeatureViewModels:e}=this.viewModel;return u("calcite-list",null,e.toArray().map(t=>this._renderRelatedFeature(t)),this._renderShowAllListItem())}_renderRelatedFeatures(){const{displayListItems:e}=this,{state:t}=this.viewModel;return u("div",{class:this.classes(ae.listContainer,{[ae.listContainerQuerying]:t==="querying"}),key:"list-container"},e?this._renderList():t==="ready"?this._renderNoRelatedFeaturesMessage():null,this._renderStickyLoading(),this._renderFeatureObserver())}_renderRelationshipNotFound(){var e;return u("calcite-notice",{icon:"exclamation-mark-triangle",key:"relationship-not-found",kind:"danger",open:!0,scale:"s",width:"full"},u("div",{slot:"message"},(e=this.messages)==null?void 0:e.relationshipNotFound))}_setupRelatedFeatureViewModels(){const{relatedFeatureViewModels:e}=this.viewModel,t="related-feature-viewmodels";this.removeHandles(t),e==null||e.forEach(s=>{this.addHandles(f(()=>[s.title,s.state],()=>this.scheduleRender(),H),t)}),this.scheduleRender()}_setupFeatureElementInfo(){var r;const{headingLevel:e,visibleElements:t}=this,s=t.description&&this.description,n=t.title&&this.title;(r=this._featureElementInfo)==null||r.set({description:s,title:n,headingLevel:e})}async _handleRelatedFeatureObserverChange(){this._unobserveRelatedFeatureObserver();const{state:e,showAllEnabled:t}=this.viewModel;await gi(0),this._relatedFeatureIntersectionObserverNode&&e==="ready"&&t&&this._relatedFeatureIntersectionObserver.observe(this._relatedFeatureIntersectionObserverNode)}_relatedFeatureIntersectionObserverCreated(e){this._relatedFeatureIntersectionObserverNode=e}_unobserveRelatedFeatureObserver(){this._relatedFeatureIntersectionObserverNode&&this._relatedFeatureIntersectionObserver.unobserve(this._relatedFeatureIntersectionObserverNode)}};o([l()],X.prototype,"_relatedFeatureIntersectionObserverNode",void 0),o([l({readOnly:!0})],X.prototype,"displayShowAllButton",null),o([l({readOnly:!0})],X.prototype,"displayListItems",null),o([l()],X.prototype,"description",null),o([l({readOnly:!0})],X.prototype,"featureCountDescription",null),o([l()],X.prototype,"headingLevel",void 0),o([l()],X.prototype,"title",null),o([l({type:xt})],X.prototype,"viewModel",void 0),o([l(),Y("esri/widgets/Feature/t9n/Feature")],X.prototype,"messages",void 0),o([l(),Y("esri/t9n/common")],X.prototype,"messagesCommon",void 0),o([l()],X.prototype,"visibleElements",void 0),o([Te("visibleElements")],X.prototype,"castVisibleElements",null),X=o([R("esri.widgets.Feature.FeatureRelationship")],X);const ei=X;let hn=class{constructor(e,t){this.preLayerQueryCallback=e,this.preRequestCallback=t,this.preLayerQueryCallback||(this.preLayerQueryCallback=s=>{}),this.preRequestCallback||(this.preLayerQueryCallback=s=>{})}};var Ne;const pn=1,ti="content-view-models",ii="relationship-view-models",si={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0};let P=Ne=class extends mi(ce){constructor(i){super(i),this._error=null,this._featureAbortController=null,this._graphicChangedThrottled=Qe(this._graphicChanged,pn,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...si},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return e.type==="attachments"&&!!t.attachmentsContent||e.type==="custom"&&!!t.customContent||e.type==="fields"&&!!t.fieldsContent||e.type==="media"&&!!t.mediaContent||e.type==="text"&&!!t.textContent||e.type==="expression"&&!!t.expressionContent||e.type==="relationship"&&!!t.relationshipContent},this.addHandles(f(()=>[this.graphic,this._effectivePopupTemplate,this.abilities],()=>this._graphicChangedThrottled(),H))}initialize(){this.addHandles(this._graphicChangedThrottled)}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return this.graphic!=null?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return gs(jt(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return _i(this.graphic)}castAbilities(i){return{...si,...i}}get isTable(){var i;return((i=this._sourceLayer)==null?void 0:i.isTable)||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(i){this._set("graphic",i?i.clone():null)}get spatialReference(){var i;return((i=this.view)==null?void 0:i.spatialReference)??null}set spatialReference(i){this._override("spatialReference",i)}get map(){var i;return((i=this.view)==null?void 0:i.map)||null}set map(i){this._override("map",i)}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(i,e){const t=this.contentViewModels[i];t instanceof Me&&t.setActiveMedia(e)}nextMedia(i){const e=this.contentViewModels[i];e instanceof Me&&e.next()}previousMedia(i){const e=this.contentViewModels[i];e instanceof Me&&e.previous()}async updateGeometry(){var a;const{graphic:i,spatialReference:e,_sourceLayer:t}=this;await(t==null?void 0:t.load());const s=t==null?void 0:t.objectIdField;if(!s||!i||!t)return;const n=(a=i==null?void 0:i.attributes)==null?void 0:a[s];if(n==null)return;const r=[n];if(!i.geometry){const d=await fs({layer:t,graphic:i,outFields:[],objectIds:r,returnGeometry:!0,spatialReference:e}),c=d==null?void 0:d.geometry;c&&(i.geometry=c)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:i}=this;if(!i)return;const e=new AbortController;this._featureAbortController=e;try{await this._queryFeature({signal:e.signal})}catch(t){Zi(t)||(this._error=t,ie.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:t,graphic:i,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===e&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:i}=this;i&&i.abort(),this._featureAbortController=null}_compileContentElement(i,e){return i.type==="attachments"?this._compileAttachments(i,e):i.type==="custom"?this._compileCustom(i,e):i.type==="fields"?this._compileFields(i,e):i.type==="media"?this._compileMedia(i,e):i.type==="text"?this._compileText(i,e):i.type==="expression"?this._compileExpression(i,e):i.type==="relationship"?this._compileRelationship(i,e):void 0}_compileContent(i){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(i)?i.filter(this._isAllowedContentType).map((e,t)=>this._compileContentElement(e,t)).filter(Ke):typeof i=="string"?this._compileText(new pi({text:i}),0).text:i}_destroyContentViewModels(){this.removeHandles(ii),this.removeHandles(ti),this.contentViewModels.forEach(i=>i&&!i.destroyed&&i.destroy()),this._set("contentViewModels",[])}_matchesFeature(i,e){var n;const t=(n=i==null?void 0:i.graphic)==null?void 0:n.getObjectId(),s=e==null?void 0:e.getObjectId();return t!=null&&s!=null&&t===s}_setRelatedFeaturesViewModels({relatedFeatureViewModels:i,relatedFeatures:e,map:t}){const{view:s,spatialReference:n}=this;e==null||e.filter(Boolean).forEach(r=>{i.find(a=>this._matchesFeature(a,r))||i.add(new Ne({abilities:{relationshipContent:!1},map:t,view:s,spatialReference:n,graphic:r}))}),i.forEach(r=>{(e==null?void 0:e.find(d=>this._matchesFeature(r,d)))||i.remove(r)})}_setExpressionContentVM(i,e){const t=this.formattedAttributes,{contentElement:s,contentElementViewModel:n}=i,r=s==null?void 0:s.type;n&&r&&(r==="fields"&&(this._createFieldsFormattedAttributes({contentElement:s,contentElementIndex:e,formattedAttributes:t}),n.set(this._createFieldsVMParams(s,e))),r==="media"&&(this._createMediaFormattedAttributes({contentElement:s,contentElementIndex:e,formattedAttributes:t}),n.set(this._createMediaVMParams(s,e))),r==="text"&&n.set(this._createTextVMParams(s)))}_compileRelationship(i,e){const{displayCount:t,orderByFields:s,relationshipId:n,title:r,description:a}=i,{_sourceLayer:d,graphic:c,map:h}=this;if(!_s(d))return;const p=new xt({displayCount:t,graphic:c,orderByFields:s,relationshipId:n,layer:d,map:h,...this._compileTitleAndDesc({title:r,description:a})});return this.contentViewModels[e]=p,this.addHandles(Fe(()=>p.relatedFeatures,"change",()=>this._setRelatedFeaturesViewModels(p)),ii),i}_compileExpression(i,e){const{expressionInfo:t}=i,{graphic:s,map:n,spatialReference:r,view:a}=this,d=new $t({expressionInfo:t,graphic:s,interceptor:Ne.interceptor,map:n,spatialReference:r,view:a});return this.contentViewModels[e]=d,this.addHandles(f(()=>d.contentElementViewModel,()=>this._setExpressionContentVM(d,e),H),ti),i}_compileAttachments(i,e){const{graphic:t}=this,{description:s,title:n}=i;return this.contentViewModels[e]=new Et({graphic:t,...this._compileTitleAndDesc({title:n,description:s})}),i}_compileCustom(i,e){const{graphic:t}=this,{creator:s,destroyer:n}=i;return this.contentViewModels[e]=new Ge({graphic:t,creator:s,destroyer:n}),i}_compileTitleAndDesc({title:i,description:e}){const{_fieldInfoMap:t,_sourceLayer:s,graphic:n,formattedAttributes:r}=this,a=n==null?void 0:n.attributes,d=this._expressionAttributes,c=r.global;return{title:be({attributes:a,fieldInfoMap:t,globalAttributes:c,expressionAttributes:d,layer:s,text:i}),description:be({attributes:a,fieldInfoMap:t,globalAttributes:c,expressionAttributes:d,layer:s,text:e})}}_createFieldsVMParams(i,e){const t=this._effectivePopupTemplate,s=this.formattedAttributes,n={...s==null?void 0:s.global,...s==null?void 0:s.content[e]},r=(i==null?void 0:i.fieldInfos)||(t==null?void 0:t.fieldInfos),a=r==null?void 0:r.filter(({fieldName:p})=>wi(p)||we(p)||n.hasOwnProperty(p)),d=t==null?void 0:t.expressionInfos,{description:c,title:h}=i;return{attributes:n,expressionInfos:d,fieldInfos:a,...this._compileTitleAndDesc({title:h,description:c})}}_compileFields(i,e){const t=i.clone(),s=new Ze(this._createFieldsVMParams(i,e));return this.contentViewModels[e]=s,t.fieldInfos=s.formattedFieldInfos.slice(0),t}_createMediaVMParams(i,e){const{abilities:t,graphic:s,_fieldInfoMap:n,_effectivePopupTemplate:r,relatedInfos:a,_sourceLayer:d,_expressionAttributes:c}=this,h=this.formattedAttributes,p=(s==null?void 0:s.attributes)??{},{description:m,mediaInfos:g,title:_}=i;return{abilities:{chartAnimation:t.chartAnimation},activeMediaInfoIndex:i.activeMediaInfoIndex||0,attributes:p,isAggregate:s==null?void 0:s.isAggregate,layer:d,fieldInfoMap:n,formattedAttributes:{...h==null?void 0:h.global,...h==null?void 0:h.content[e]},expressionAttributes:c,mediaInfos:g,popupTemplate:r,relatedInfos:a,...this._compileTitleAndDesc({title:_,description:m})}}_compileMedia(i,e){const t=i.clone(),s=new Me(this._createMediaVMParams(i,e));return t.mediaInfos=s.formattedMediaInfos.slice(0),this.contentViewModels[e]=s,t}_createTextVMParams(i){var r;const{graphic:e,_fieldInfoMap:t,_sourceLayer:s,_expressionAttributes:n}=this;if(i&&i.text){const a=(e==null?void 0:e.attributes)??{},d=((r=this.formattedAttributes)==null?void 0:r.global)??{};i.text=be({attributes:a,fieldInfoMap:t,globalAttributes:d,expressionAttributes:n,layer:s,text:i.text})}return{graphic:e,creator:i.text}}_compileText(i,e){const t=i.clone();return this.contentViewModels[e]=new Ge(this._createTextVMParams(t)),t}_compileLastEditInfo(){const{_effectivePopupTemplate:i,_sourceLayer:e,graphic:t,view:s}=this;if(!i)return;const{lastEditInfoEnabled:n}=i,r=e==null?void 0:e.editFieldsInfo;return n&&r?vs(r,t==null?void 0:t.attributes,(s==null?void 0:s.timeZone)??Be,e):void 0}_compileTitle(i){var d;const{_fieldInfoMap:e,_sourceLayer:t,graphic:s,_expressionAttributes:n}=this,r=(s==null?void 0:s.attributes)??{},a=((d=this.formattedAttributes)==null?void 0:d.global)??{};return be({attributes:r,fieldInfoMap:e,globalAttributes:a,expressionAttributes:n,layer:t,text:i})}async _getTitle(){const{_effectivePopupTemplate:i,graphic:e}=this;if(!e)return null;const t=i==null?void 0:i.title;return Xe(t,{graphic:e})}async _getContent(){const{_effectivePopupTemplate:i,graphic:e}=this;if(!e)return null;const t=i==null?void 0:i.content;return Xe(t,{graphic:e})}async _queryFeature(i){const{_featureAbortController:e,_sourceLayer:t,graphic:s,_effectivePopupTemplate:n}=this,r=this.map,a=this.view,d=this.spatialReference;if(e!==this._featureAbortController||!s)return;await ys({graphic:s,popupTemplate:n,layer:t,spatialReference:d},i);const{content:{value:c},title:{value:h}}=await Ce({content:this._getContent(),title:this._getTitle()}),{expressionAttributes:{value:p}}=await Ce({checkForRelatedFeatures:this._checkForRelatedFeatures(i),expressionAttributes:ln({expressionInfos:n==null?void 0:n.expressionInfos,spatialReference:d,graphic:s,map:r,interceptor:Ne.interceptor,view:a})});e===this._featureAbortController&&s&&(this._expressionAttributes=p,this._graphicExpressionAttributes={...s.attributes,...p},this._set("formattedAttributes",this._createFormattedAttributes(c)),this._set("title",this._compileTitle(h)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(c)||null))}_createMediaFormattedAttributes({contentElement:i,contentElementIndex:e,formattedAttributes:t}){var h;const{_effectivePopupTemplate:s,graphic:n,relatedInfos:r,_sourceLayer:a,_fieldInfoMap:d,_graphicExpressionAttributes:c}=this;t.content[e]=ot({fieldInfos:s==null?void 0:s.fieldInfos,graphic:n,attributes:{...c,...i.attributes},layer:a,fieldInfoMap:d,relatedInfos:r,timeZone:((h=this.view)==null?void 0:h.timeZone)??Be})}_createFieldsFormattedAttributes({contentElement:i,contentElementIndex:e,formattedAttributes:t}){var s;if(i.fieldInfos){const{graphic:n,relatedInfos:r,_sourceLayer:a,_fieldInfoMap:d,_graphicExpressionAttributes:c}=this;t.content[e]=ot({fieldInfos:i.fieldInfos,graphic:n,attributes:{...c,...i.attributes},layer:a,fieldInfoMap:d,relatedInfos:r,timeZone:((s=this.view)==null?void 0:s.timeZone)??Be})}}_createFormattedAttributes(i){var h;const{_effectivePopupTemplate:e,graphic:t,relatedInfos:s,_sourceLayer:n,_fieldInfoMap:r,_graphicExpressionAttributes:a}=this,d=e==null?void 0:e.fieldInfos,c={global:ot({fieldInfos:d,graphic:t,attributes:a,layer:n,fieldInfoMap:r,relatedInfos:s,timeZone:((h=this.view)==null?void 0:h.timeZone)??Be}),content:[]};return Array.isArray(i)&&i.forEach((p,m)=>{p.type==="fields"&&this._createFieldsFormattedAttributes({contentElement:p,contentElementIndex:m,formattedAttributes:c}),p.type==="media"&&this._createMediaFormattedAttributes({contentElement:p,contentElementIndex:m,formattedAttributes:c})}),c}_checkForRelatedFeatures(i){const{graphic:e,_effectivePopupTemplate:t}=this;return this._queryRelatedInfos(e,jt(t),i)}async _queryRelatedInfos(i,e,t){const{relatedInfos:s,_sourceLayer:n}=this;s.clear();const r=(n==null?void 0:n.associatedLayer)!=null?await(n==null?void 0:n.associatedLayer.load(t)):n;if(!r||!i)return;const a=e.filter(h=>h&&we(h.fieldName));if(!(a!=null&&a.length))return;e.forEach(h=>this._configureRelatedInfo(h,r));const d=await zs({relatedInfos:s,layer:r},t);Object.keys(d).forEach(h=>{var g;const p=s.get(h.toString()),m=(g=d[h])==null?void 0:g.value;p&&m&&(p.layerInfo=m.data)});const c=await js({graphic:i,relatedInfos:s,layer:r},t);Object.keys(c).forEach(h=>{var p;Ns((p=c[h])==null?void 0:p.value,s.get(h.toString()))})}_configureRelatedInfo(i,e){const{relatedInfos:t}=this,s=ze(i.fieldName);if(!s)return;const{layerId:n,fieldName:r}=s;if(!n)return;const a=t.get(n.toString())||Vs(n,e);a&&(Us({relatedInfo:a,fieldName:r,fieldInfo:i}),this.relatedInfos.set(n,a))}};P.interceptor=new hn(ws,bs),o([l()],P.prototype,"_error",void 0),o([l()],P.prototype,"_featureAbortController",void 0),o([l({readOnly:!0})],P.prototype,"_effectivePopupTemplate",null),o([l({readOnly:!0})],P.prototype,"_fieldInfoMap",null),o([l({readOnly:!0})],P.prototype,"_sourceLayer",null),o([l()],P.prototype,"abilities",void 0),o([Te("abilities")],P.prototype,"castAbilities",null),o([l({readOnly:!0})],P.prototype,"content",void 0),o([l({readOnly:!0})],P.prototype,"contentViewModels",void 0),o([l()],P.prototype,"description",void 0),o([l({type:Boolean})],P.prototype,"defaultPopupTemplateEnabled",void 0),o([l({readOnly:!0})],P.prototype,"isTable",null),o([l({readOnly:!0})],P.prototype,"state",null),o([l({readOnly:!0})],P.prototype,"formattedAttributes",void 0),o([l({type:ke,value:null})],P.prototype,"graphic",null),o([l({readOnly:!0})],P.prototype,"lastEditInfo",void 0),o([l({readOnly:!0})],P.prototype,"relatedInfos",void 0),o([l()],P.prototype,"spatialReference",null),o([l({readOnly:!0})],P.prototype,"title",void 0),o([l()],P.prototype,"map",null),o([l({readOnly:!0})],P.prototype,"waitingForContent",null),o([l()],P.prototype,"view",void 0),P=Ne=o([R("esri.widgets.FeatureViewModel")],P);const Tt=P,Ei=i=>{let e=class extends i{constructor(){super(...arguments),this.renderNodeContent=t=>di(t)&&!t.destroyed?u("div",{class:O.contentNode,key:t},t.render()):t instanceof HTMLElement?u("div",{afterCreate:this._attachToNode,bind:t,class:O.contentNode,key:t}):es(t)?u("div",{afterCreate:this._attachToNode,bind:t.domNode,class:O.contentNode,key:t}):null}_attachToNode(t){const s=this;t.appendChild(s)}};return e=o([R("esri.widgets.Feature.ContentMixin")],e),e};var bt;const ni={title:!0,content:!0,lastEditedInfo:!0},ri="relationship-handles";let B=bt=class extends Ei(Z){constructor(i,e){super(i,e),this._contentWidgets=[],this.flowItems=null,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.visibleElements={...ni},this.viewModel=new Tt}initialize(){this.addHandles(f(()=>{var i;return(i=this.viewModel)==null?void 0:i.contentViewModels},()=>this._setupContentWidgets(),H))}loadDependencies(){return Re({notice:()=>E(()=>import("./calcite-notice-6pbWdSt0.js"),__vite__mapDeps([38,2,3,39,4,23,25,26,27,40,31,1]))})}destroy(){this._destroyContentWidgets()}get graphic(){return this.viewModel.graphic}set graphic(i){this.viewModel.graphic=i}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(i){this.viewModel.defaultPopupTemplateEnabled=i}get isTable(){return this.viewModel.isTable}get label(){var i;return((i=this.messages)==null?void 0:i.widgetLabel)??""}set label(i){this._overrideIfSome("label",i)}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(i){this.viewModel.spatialReference=i}get title(){return this.viewModel.title}castVisibleElements(i){return{...ni,...i}}get map(){return this.viewModel.map}set map(i){this.viewModel.map=i}get view(){return this.viewModel.view}set view(i){this.viewModel.view=i}setActiveMedia(i,e){return this.viewModel.setActiveMedia(i,e)}nextMedia(i){return this.viewModel.nextMedia(i)}previousMedia(i){return this.viewModel.previousMedia(i)}render(){const{state:i}=this.viewModel,e=u("div",{class:O.container,key:"container"},this._renderTitle(),i==="error"?this._renderError():i==="loading"?this._renderLoading():this._renderContentContainer());return u("div",{class:this.classes(O.base,I.widget)},e)}_renderError(){const{messagesCommon:i,messages:e,visibleElements:t}=this;return u("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0,scale:"s"},t.title?u("div",{key:"error-title",slot:"title"},i.errorMessage):null,u("div",{key:"error-message",slot:"message"},e.loadingError))}_renderLoading(){return u("div",{class:O.loadingSpinnerContainer,key:"loading-container"},u("span",{class:this.classes(pe.loadingIndicator,I.rotating,O.spinner)}))}_renderContentContainer(){const{visibleElements:i}=this;return i.content?u("div",{class:O.main},[this._renderContent(),this._renderLastEditInfo()]):null}_renderTitle(){const{visibleElements:i,title:e}=this;return i.title?u(It,{class:O.title,innerHTML:e,level:this.headingLevel}):null}_renderContent(){const i=this.viewModel.content,e="content";if(!i)return null;if(Array.isArray(i))return i.length?u("div",{class:O.contentNode,key:`${e}-content-elements`},i.map(this._renderContentElement,this)):null;if(typeof i=="string"){const t=this._contentWidgets[0];return!t||t.destroyed?null:u("div",{class:this.classes(O.contentNode,O.contentNodeText),key:`${e}-content`},t.render())}return this.renderNodeContent(i)}_renderContentElement(i,e){var s;const{visibleElements:t}=this;if(typeof t.content!="boolean"&&!((s=t.content)!=null&&s[i.type]))return null;switch(i.type){case"attachments":return this._renderAttachments(e);case"custom":return this._renderCustom(i,e);case"fields":return this._renderFields(e);case"media":return this._renderMedia(e);case"text":return this._renderText(i,e);case"expression":return this._renderExpression(e);case"relationship":return this._renderRelationship(e);default:return null}}_renderAttachments(i){const e=this._contentWidgets[i];if(!e||e.destroyed)return null;const{state:t,attachmentInfos:s}=e.viewModel;return t==="loading"||s.length>0?u("div",{class:this.classes(O.contentElement),key:this._buildKey("attachments-element",i)},e.render()):null}_renderRelationship(i){const e=this._contentWidgets[i];return e&&!e.destroyed&&this.flowItems?u("div",{class:O.contentElement,key:this._buildKey("relationship-element",i)},e.render()):null}_renderExpression(i){const e=this._contentWidgets[i];return!e||e.destroyed?null:u("div",{class:O.contentElement,key:this._buildKey("expression-element",i)},e.render())}_renderCustom(i,e){const{creator:t}=i,s=this._contentWidgets[e];return!s||s.destroyed?null:t?u("div",{class:O.contentElement,key:this._buildKey("custom-element",e)},s.render()):null}_renderFields(i){const e=this._contentWidgets[i];return!e||e.destroyed?null:u("div",{class:O.contentElement,key:this._buildKey("fields-element",i)},e.render())}_renderMedia(i){const e=this._contentWidgets[i];return!e||e.destroyed?null:u("div",{class:O.contentElement,key:this._buildKey("media-element",i)},e.render())}_renderLastEditInfo(){const{visibleElements:i,messages:e}=this,{lastEditInfo:t}=this.viewModel;if(!t||!i.lastEditedInfo)return null;const{date:s,user:n}=t,r=t.type==="edit"?n?e.lastEditedByUser:e.lastEdited:n?e.lastCreatedByUser:e.lastCreated,a=oe(r,{date:s,user:n});return u("div",{class:this.classes(O.lastEditedInfo,O.contentElement),key:"edit-info-element"},a)}_renderText(i,e){const t=i.text,s=this._contentWidgets[e];return!s||s.destroyed?null:t?u("div",{class:this.classes(O.contentElement,O.text),key:this._buildKey("text-element",e)},s.render()):null}_buildKey(i,...e){var t,s;return`${i}__${((s=(t=this.viewModel)==null?void 0:t.graphic)==null?void 0:s.uid)||"0"}-${e.join("-")}`}_destroyContentWidget(i){i&&(i.viewModel=null,!i.destroyed&&i.destroy())}_destroyContentWidgets(){this.removeHandles(ri),this._contentWidgets.forEach(i=>this._destroyContentWidget(i)),this._contentWidgets=[]}_addFeatureRelationshipHandles(i){const{flowItems:e,visibleElements:t}=this;this.addHandles([Fe(()=>i,"select-record",({featureViewModel:s})=>{e&&(s.abilities={relationshipContent:!0},e.push(new bt({flowItems:e,viewModel:s,visibleElements:t})))}),Fe(()=>i,"show-all-records",()=>{if(!e)return;const{viewModel:s}=i;s.showAllEnabled=!0;const n=new ei({visibleElements:{title:!1,description:!1},viewModel:s});this._addFeatureRelationshipHandles(n),e.push(n)})],ri)}_setupContentWidgets(){var n;this._destroyContentWidgets();const{headingLevel:i,visibleElements:e}=this,t=(n=this.viewModel)==null?void 0:n.content,{contentViewModels:s}=this.viewModel;if(Array.isArray(t))t.forEach((r,a)=>{if(r.type==="attachments"&&(this._contentWidgets[a]=new Es({displayType:r.displayType,headingLevel:e.title?i+1:i,viewModel:s[a]})),r.type==="fields"&&(this._contentWidgets[a]=new Ii({viewModel:s[a]})),r.type==="media"&&(this._contentWidgets[a]=new Fi({viewModel:s[a]})),r.type==="text"&&(this._contentWidgets[a]=new He({viewModel:s[a]})),r.type==="custom"&&(this._contentWidgets[a]=new He({viewModel:s[a]})),r.type==="expression"&&(this._contentWidgets[a]=new cn({viewModel:s[a]})),r.type==="relationship"){const d=new ei({viewModel:s[a]});this._addFeatureRelationshipHandles(d),this._contentWidgets[a]=d}},this);else{const r=s[0];r&&!r.destroyed&&(this._contentWidgets[0]=new He({viewModel:r}))}this.scheduleRender()}};o([l()],B.prototype,"graphic",null),o([l()],B.prototype,"defaultPopupTemplateEnabled",null),o([l()],B.prototype,"flowItems",void 0),o([l()],B.prototype,"headingLevel",void 0),o([l({readOnly:!0})],B.prototype,"isTable",null),o([l()],B.prototype,"label",null),o([l(),Y("esri/widgets/Feature/t9n/Feature")],B.prototype,"messages",void 0),o([l(),Y("esri/t9n/common")],B.prototype,"messagesCommon",void 0),o([l(),Y("esri/widgets/support/t9n/uriUtils")],B.prototype,"messagesURIUtils",void 0),o([l()],B.prototype,"spatialReference",null),o([l({readOnly:!0})],B.prototype,"title",null),o([l()],B.prototype,"visibleElements",void 0),o([Te("visibleElements")],B.prototype,"castVisibleElements",null),o([l()],B.prototype,"map",null),o([l()],B.prototype,"view",null),o([l({type:Tt})],B.prototype,"viewModel",void 0),B=bt=o([R("esri.widgets.Feature")],B);const mn=B,gn="esri.widgets.CompassViewModel";let Ue=class extends bi{constructor(e){super(e),this.visible=!1}};o([l()],Ue.prototype,"visible",void 0),Ue=o([R(gn)],Ue);const $i=Ue,ft="esri-spinner",_t={base:ft,spinnerStart:`${ft}--start`,spinnerFinish:`${ft}--finish`};let fe=class extends Z{constructor(e,t){super(e,t),this._animationDelay=500,this._animationPromise=null,this.viewModel=new $i}initialize(){this.addHandles(f(()=>this.visible,e=>this._visibleChange(e)))}destroy(){this._animationPromise=null}get location(){return this.viewModel.location}set location(e){this.viewModel.location=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}show(e){const{location:t,promise:s}=e??{};t&&(this.viewModel.location=t),this.visible=!0;const n=()=>this.hide();s&&s.catch(()=>{}).then(n)}hide(){this.visible=!1}render(){const{visible:e}=this,{screenLocation:t}=this.viewModel,s=!!t,n=e&&s,r=!e&&s,a={[_t.spinnerStart]:n,[_t.spinnerFinish]:r},d=this._getPositionStyles();return u("div",{class:this.classes(_t.base,a),styles:d})}_visibleChange(e){if(e)return void(this.viewModel.screenLocationEnabled=!0);const t=gi(this._animationDelay);this._animationPromise=t,t.catch(()=>{}).then(()=>{this._animationPromise===t&&(this.viewModel.screenLocationEnabled=!1,this._animationPromise=null)})}_getPositionStyles(){const{screenLocation:e,view:t}=this.viewModel;if(t==null||e==null)return{};const{padding:s}=t;return{left:e.x-s.left+"px",top:e.y-s.top+"px"}}};o([l()],fe.prototype,"location",null),o([l()],fe.prototype,"view",null),o([l({type:$i})],fe.prototype,"viewModel",void 0),o([l()],fe.prototype,"visible",null),fe=o([R("esri.widgets.Spinner")],fe);const fn=fe,z="esri-features",W={icon:`${z}__icon`,actionImage:`${z}__action-image`,base:z,container:`${z}__container`,contentContainer:`${z}__content-container`,contentFeature:`${z}__content-feature`,flowItemCollapsed:`${z}__flow-item--collapsed`,header:`${z}__header`,footer:`${z}__footer`,featureMenuObserver:`${z}__feature-menu-observer`,actionExit:`${z}__action--exit`,loader:`${z}__loader`,featuresHeading:`${z}__heading`,paginationActionBar:`${z}__pagination-action-bar`,paginationPrevious:`${z}__pagination-previous`,paginationNext:`${z}__pagination-next`};let _e=class extends Z{constructor(i,e){super(i,e),this.messages=null,this.closed=!1,this.closable=!0,this._handleOpenRelatedFeature=t=>{this.emit("open-related-feature",{feature:t})}}loadDependencies(){return Re({action:()=>E(()=>import("./calcite-action-GYDrwtQs.js"),__vite__mapDeps([41,37,2,3,34,21,23,25,26,4,31,27,1,33])),"flow-item":()=>E(()=>import("./calcite-flow-item-cLwEh1ST.js"),__vite__mapDeps([42,2,3,21,23,25,26,4,27,43,34,37,31,1,33,44,45,24,40,46,35]))})}render(){const{flowItems:i}=this,e=i==null?void 0:i.toArray();return u(ts,null,e==null?void 0:e.map(t=>this._renderRelatedRecordsFlowItem(t)))}_handleCloseClick(){this.emit("close")}_handleExitClick(){this.emit("exit")}_handleRelatedRecordsBackClick(){var e;const i=(e=this.flowItems)==null?void 0:e.pop();i&&("showAllEnabled"in i.viewModel&&(i.viewModel.showAllEnabled=!1),i&&(i.viewModel=null,i.destroy()))}_renderRelatedRecordsFlowItem(i){const{messages:e,closable:t,closed:s}=this,n="graphic"in i&&!i.isTable;return u("calcite-flow-item",{bind:this,closable:t,closed:s,description:this._getRelatedRecordsFlowItemDescription(i),heading:i.title??"",key:`flow-item-${i.viewModel.uid}`,onCalciteFlowItemBack:this._handleRelatedRecordsBackClick,onCalciteFlowItemClose:this._handleCloseClick},u("calcite-action",{appearance:"transparent",bind:this,class:W.actionExit,icon:"move-up",key:"exit-related-records-action",label:e.exitRelatedRecords,onclick:this._handleExitClick,scale:"m",slot:"header-actions-start",text:e.exitRelatedRecords,title:e.exitRelatedRecords}),n?u("calcite-action",{appearance:"transparent",bind:this,icon:"zoom-to-object",key:"open-related-feature-action",label:e.selectFeature,onclick:()=>this._handleOpenRelatedFeature(i),scale:"m",slot:"header-actions-end",text:e.selectFeature,title:e.selectFeature}):null,u("div",{class:W.container},i.render()))}_getRelatedRecordsFlowItemDescription(i){return"featureCountDescription"in i?i.featureCountDescription:i.viewModel.description??""}};o([l()],_e.prototype,"flowItems",void 0),o([l(),Y("esri/widgets/Features/t9n/Features")],_e.prototype,"messages",void 0),o([l()],_e.prototype,"closed",void 0),o([l()],_e.prototype,"closable",void 0),_e=o([R("esri.widgets.Features.FeaturesRelatedRecords")],_e);const _n=_e,vn="esri.widgets.Popup.PopupViewModel",Ye=ie.getLogger(vn),yn=i=>{const{event:e,view:t,viewModel:s}=i,{action:n}=e;if(!n)return Promise.reject(new k("trigger-action:missing-arguments","Event has no action"));const{disabled:r,id:a}=n;if(!a)return Promise.reject(new k("trigger-action:invalid-action","action.id is missing"));if(r)return Promise.reject(new k("trigger-action:invalid-action","Action is disabled"));if(a===ye.id)return bn(s).catch(is);if(a===xe.id)return Mn(s);if(a===me.id)return s.browseClusterEnabled=!s.browseClusterEnabled,s.featureMenuOpen=s.browseClusterEnabled,Promise.resolve();if(a===St.id){s.visible=!1;const{selectedFeature:d}=s;if(!d)return Promise.reject(new k(`trigger-action:${St.id}`,"selectedFeature is required",{selectedFeature:d}));const{sourceLayer:c}=d;return c?c.remove(d):t==null||t.graphics.remove(d),Promise.resolve()}return Promise.resolve()};function xi(i){const{selectedFeature:e,location:t,view:s}=i;return s?e??t??null:null}function ve(i){var e,t;return!!i&&i.isAggregate&&((t=(e=i.sourceLayer)==null?void 0:e.featureReduction)==null?void 0:t.type)==="cluster"}async function wn(i,e){if((e==null?void 0:e.type)!=="3d"||!i||i.declaredClass!=="esri.Graphic")return!0;const t=e.getViewForGraphic(i);if(t&&"whenGraphicBounds"in t){let s=null;try{s=await t.whenGraphicBounds(i,{useViewElevation:!0})}catch{}return!s||!s.boundingBox||s.boundingBox[0]===s.boundingBox[3]&&s.boundingBox[1]===s.boundingBox[4]&&s.boundingBox[2]===s.boundingBox[5]}return!0}async function bn(i){var p;const{location:e,selectedFeature:t,view:s,zoomFactor:n}=i,r=xi(i);if(!s||!r){const m=new k("zoom-to:invalid-target-or-view","Cannot zoom to location without a target and view.",{target:r,view:s});throw Ye.error(m),m}const a=s.scale/n,d=(p=i.selectedFeature)==null?void 0:p.geometry,c=d??e,h=c!=null&&c.type==="point"&&await wn(t,s);ye.active=!0,ye.disabled=!0;try{await i.zoomTo({target:{target:r,scale:h?a:void 0}})}catch{const g=new k("zoom-to:invalid-graphic","Could not zoom to the location of the graphic.",{graphic:t});Ye.error(g)}finally{ye.active=!1,ye.disabled=!1,i.zoomToLocation=null,h&&(i.location=c)}}async function Mn(i){const{selectedFeature:e,view:t}=i;if((t==null?void 0:t.type)!=="2d"){const a=new k("zoomToCluster:invalid-view","View must be 2d MapView.",{view:t});throw Ye.error(a),a}if(!e||!ve(e)){const a=new k("zoomToCluster:invalid-selectedFeature","Selected feature must represent an aggregate/cluster graphic.",{selectedFeature:e});throw Ye.error(a),a}const[s,n]=await kt(t,e);xe.active=!0,xe.disabled=!0;const{extent:r}=await s.queryExtent(n);await i.zoomTo({target:r}),xe.active=!1,xe.disabled=!1}async function In(i){const{view:e,selectedFeature:t}=i;if(!e||!t)return;const[s,n]=await kt(e,t),{extent:r}=await s.queryExtent(n);i.selectedClusterBoundaryFeature.geometry=r,e.graphics.add(i.selectedClusterBoundaryFeature)}async function Fn(i){const{selectedFeature:e,view:t}=i;if(!t||!e)return;const[s,n]=await kt(t,e);me.active=!0,me.disabled=!0;const{features:r}=await s.queryFeatures(n);me.active=!1,me.disabled=!1,me.value=!0,i==null||i.open({features:[e].concat(r),featureMenuOpen:!0})}async function kt(i,e){const t=await i.whenLayerView(e.sourceLayer),s=t.createQuery(),n=e.getObjectId();return s.aggregateIds=n!=null?[n]:[],[t,s]}function An(i){me.value=!1;const e=i.features.filter(t=>ve(t));e.length&&(i.features=e)}function Ti(i){var e;if(i==null)return null;switch(i.type){case"point":return i;case"extent":return i.center;case"polygon":return i.centroid;case"multipoint":case"polyline":return(e=i.extent)==null?void 0:e.center;default:return null}}const Cn=()=>[ye.clone()],En=()=>[xe.clone(),me.clone()];let M=class extends ss(bi){constructor(e){super(e),this._pendingPromises=new Is,this._fetchFeaturesController=null,this._highlightSelectedFeaturePromise=null,this._highlightActiveFeaturePromise=null,this._selectedClusterFeature=null,this.actions=new Ie,this.activeFeature=null,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new ke({symbol:new ns({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null}initialize(){this.addHandles([this.on("view-change",()=>this._autoClose()),f(()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view],()=>this._highlightSelectedFeature()),f(()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view],()=>this._highlightActiveFeature()),f(()=>{var e,t;return(t=(e=this.view)==null?void 0:e.animation)==null?void 0:t.state},e=>this._animationStateChange(e)),f(()=>this.location,e=>this._locationChange(e)),f(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),f(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),f(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels],()=>this._setGraphicOnFeatureViewModels()),f(()=>this.featureViewModels,()=>this._featureViewModelsChange()),this.on("trigger-action",e=>yn({event:e,viewModel:this,view:this.view})),yt(()=>!this.waitingForResult,()=>this._waitingForResultChange(),rs),f(()=>{var e,t;return[this.features,(e=this.view)==null?void 0:e.map,(t=this.view)==null?void 0:t.spatialReference]},()=>this._updateFeatureVMs()),f(()=>{var e;return(e=this.view)==null?void 0:e.scale},()=>this._viewScaleChange()),yt(()=>!this.visible,()=>this.browseClusterEnabled=!1),f(()=>this.browseClusterEnabled,e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing())])}destroy(){this._cancelFetchingFeatures(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new Ie;e.removeAll();const{actions:t,defaultActions:s,defaultPopupTemplateEnabled:n,includeDefaultActions:r,selectedFeature:a}=this,d=r?s.concat(t):t,c=a&&(typeof a.getEffectivePopupTemplate=="function"&&a.getEffectivePopupTemplate(n)||a.popupTemplate),h=c==null?void 0:c.actions,p=c!=null&&c.overwriteActions?h:(h==null?void 0:h.concat(d))??d;return p==null||p.filter(Boolean).forEach(m=>e.add(m)),e}get defaultActions(){const e=this._get("defaultActions")||new Ie;return e.removeAll(),e.addMany(ve(this.selectedFeature)?En():Cn()),e}get featureCount(){return this.features.length}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:s,promiseCount:n,selectedFeatureIndex:r}=this,a=n&&t.length;a&&s&&r===-1?this.selectedFeatureIndex=0:a&&r!==-1||(this.selectedFeatureIndex=t.length?0:-1)}set location(e){var r,a,d;let t=e;const s=(a=(r=this.view)==null?void 0:r.spatialReference)==null?void 0:a.isWebMercator;((d=e==null?void 0:e.spatialReference)==null?void 0:d.isWGS84)&&s&&(t=os(e)),this._set("location",t)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice(0)).forEach(t=>{this._pendingPromises.add(t);const s=r=>{this._pendingPromises.has(t)&&this._updateFeatures(r),this._updatePendingPromises(t)},n=()=>this._updatePendingPromises(t);t.then(s,n)})):this._set("promises",[])}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;return t===-1?null:e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return typeof e=="number"?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){var e;return(e=this.view)!=null&&e.ready?"ready":"disabled"}get waitingForContents(){return this.featureViewModels.some(e=>e.waitingForContent)}get waitingForResult(){return!(!(this._fetchFeaturesController||this.pendingPromisesCount>0)||this.featureCount!==0)}centerAtLocation(){const{view:e}=this,t=xi(this);return t&&e?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new k("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:s}=this;if(!s||!e)throw new k("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:s});return s.fetchPopupFeatures(e,{event:t==null?void 0:t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t==null?void 0:t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:s}=t;delete t.fetchFeatures,s&&this._setFetchFeaturesPromises(t.location);const n=["actionsMenuOpen","collapsed"];for(const r of n)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex++,this}previous(){return this.selectedFeatureIndex--,this}disableClusterBrowsing(){An(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;(e==null?void 0:e.type)==="2d"?ve(t)?(await In(this),await Fn(this)):ie.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):ie.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}handleViewClick(e){this.autoOpenEnabled&&this._fetchFeaturesAndOpen(e)}_animationStateChange(e){this.zoomToLocation||(ye.disabled=e==="waiting-for-target")}_clearBrowsedClusterGraphics(){var t,s;const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(Ke);(s=(t=this.view)==null?void 0:t.graphics)==null||s.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(ve(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:s}=this;s&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:s,featuresPerPage:n,featureViewModels:r}=this;if(s===null)return;const a=((s-1)*n+t)%t,d=a+n;r.slice(a,d).forEach((c,h)=>{c&&(c.graphic??(c.graphic=e[a+h]))})}async _selectedFeatureChange(e){var r;const{location:t,updateLocationEnabled:s,view:n}=this;if(e&&n){if(this.browseClusterEnabled)return this._selectedClusterFeature&&(n.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),ve(e)?void 0:(e.symbol=await as(e),this._selectedClusterFeature=e,void n.graphics.add(this._selectedClusterFeature));if(!s&&t||!e.geometry){if(s&&!e.geometry){await this.centerAtLocation();const a=(r=n.center)==null?void 0:r.clone();a&&(this.location=a)}}else this.location=Ti(e.geometry)}}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{clientOnlyGraphics:t,promisesPerLayerView:s}=await this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)),n=Promise.resolve(t),r=s.map(a=>a.promise);this.promises=[n,...r]}_destroyFeatureVMs(){this.featureViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:s,view:n}=this;if(ve(e)||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!(t!=null&&t.length))return;const r=s.slice(0),a=[];t.forEach((d,c)=>{if(!d)return;let h=null;if(r.some((p,m)=>(p&&p.graphic===d&&(h=p,r.splice(m,1)),!!h)),h)a[c]=h;else{const p=new Tt({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:n==null?void 0:n.spatialReference,graphic:d===e?d:null,map:n==null?void 0:n.map,view:n});a[c]=p}}),r.forEach(d=>d&&!d.destroyed&&d.destroy()),this._set("featureViewModels",a)}_getScreenPoint(e){const{view:t}=this;return t&&e&&typeof t.toScreen=="function"?t.toScreen(e):null}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const s=new AbortController,{signal:n}=s;this._fetchFeaturesController=s;const r=this.fetchFeatures(e,{signal:n,event:t});return r.catch(()=>{}).then(()=>{this._fetchFeaturesController=null}),r}async _fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:s}=e,{view:n}=this,{clientOnlyGraphics:r,promisesPerLayerView:a,location:d}=await this._fetchFeaturesWithController(t,e),c=[Promise.resolve(r),...a.map(h=>h.promise)];n!=null&&n.popup&&"open"in n.popup&&n.popup.open({location:d||s,promises:c})}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&this._pendingPromises.delete(e)}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:s}=e;return s&&"layer"in s&&s.layer?s.layer:(s==null?void 0:s.type)==="map-notes"||(s==null?void 0:s.type)==="subtype-group"?s:t}_getHighlightTarget(e,t){const s=t.type==="imagery"?void 0:"objectIdField"in t?t.objectIdField||ls:null,n=e.attributes;return n&&s&&n[s]||e}_mapIncludesLayer(e){var t,s,n;return!!((n=(s=(t=this.view)==null?void 0:t.map)==null?void 0:s.allLayers)!=null&&n.includes(e))}async _highlightActiveFeature(){const e="highlight-active-feature";this.removeHandles(e);const{highlightEnabled:t,view:s,activeFeature:n,visible:r}=this;if(!(n&&s&&t&&r))return;const a=this._getHighlightLayer(n);if(!(a&&a instanceof Dt&&this._mapIncludesLayer(a)))return;const d=this._getLayerView(s,a);this._highlightActiveFeaturePromise=d;const c=await d;if(!(c&&Bt(c)&&this._highlightActiveFeaturePromise===d&&this.activeFeature&&this.highlightEnabled))return;const h=c.highlight(this._getHighlightTarget(n,a));this.addHandles(h,e)}async _highlightSelectedFeature(){const e="highlight-selected-feature";this.removeHandles(e);const{selectedFeature:t,highlightEnabled:s,view:n,visible:r}=this;if(!(t&&n&&s&&r))return;const a=this._getHighlightLayer(t);if(!(a&&a instanceof Dt&&this._mapIncludesLayer(a)))return;const d=this._getLayerView(n,a);this._highlightSelectedFeaturePromise=d;const c=await d;if(!(c&&Bt(c)&&this._highlightSelectedFeaturePromise===d&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const h=c.highlight(this._getHighlightTarget(t,a));this.addHandles(h,e)}_updateFeatures(e){const{features:t}=this;if(!(e!=null&&e.length))return;if(!t.length)return void(this.features=e);const s=e.filter(n=>!t.includes(n));this.features=t.concat(s)}};o([l()],M.prototype,"_fetchFeaturesController",void 0),o([l({type:Ie})],M.prototype,"actions",void 0),o([l({readOnly:!0})],M.prototype,"active",null),o([l()],M.prototype,"activeFeature",void 0),o([l({readOnly:!0})],M.prototype,"allActions",null),o([l()],M.prototype,"autoCloseEnabled",void 0),o([l()],M.prototype,"autoOpenEnabled",void 0),o([l()],M.prototype,"browseClusterEnabled",void 0),o([l()],M.prototype,"content",void 0),o([l({type:Ie,readOnly:!0})],M.prototype,"defaultActions",null),o([l({type:Boolean})],M.prototype,"defaultPopupTemplateEnabled",void 0),o([l({readOnly:!0})],M.prototype,"featureCount",null),o([l()],M.prototype,"featurePage",void 0),o([l({value:[]})],M.prototype,"features",null),o([l()],M.prototype,"featuresPerPage",void 0),o([l()],M.prototype,"featureMenuOpen",void 0),o([l()],M.prototype,"featureViewModelAbilities",void 0),o([l({readOnly:!0})],M.prototype,"featureViewModels",void 0),o([l()],M.prototype,"highlightEnabled",void 0),o([l()],M.prototype,"includeDefaultActions",void 0),o([l({type:ds})],M.prototype,"location",null),o([l({readOnly:!0})],M.prototype,"pendingPromisesCount",null),o([l({readOnly:!0})],M.prototype,"promiseCount",null),o([l()],M.prototype,"promises",null),o([l({readOnly:!0})],M.prototype,"selectedClusterBoundaryFeature",void 0),o([l({value:null,readOnly:!0})],M.prototype,"selectedFeature",null),o([l({value:-1})],M.prototype,"selectedFeatureIndex",null),o([l({readOnly:!0})],M.prototype,"selectedFeatureViewModel",null),o([l({readOnly:!0})],M.prototype,"state",null),o([l()],M.prototype,"title",void 0),o([l()],M.prototype,"updateLocationEnabled",void 0),o([l()],M.prototype,"view",void 0),o([l()],M.prototype,"visible",void 0),o([l({readOnly:!0})],M.prototype,"waitingForContents",null),o([l({readOnly:!0})],M.prototype,"waitingForResult",null),o([l()],M.prototype,"zoomFactor",void 0),o([l()],M.prototype,"zoomToLocation",void 0),o([l()],M.prototype,"centerAtLocation",null),M=o([R("esri.widgets.Features.FeaturesViewModel")],M);const Rt=M;let de=class extends ce{constructor(){super(...arguments),this.actionBar=!0,this.closeButton=!0,this.collapseButton=!1,this.featureNavigation=!0,this.heading=!0,this.spinner=!0}};o([l({type:Boolean,nonNullable:!0})],de.prototype,"actionBar",void 0),o([l({type:Boolean,nonNullable:!0})],de.prototype,"closeButton",void 0),o([l({type:Boolean,nonNullable:!0})],de.prototype,"collapseButton",void 0),o([l({type:Boolean,nonNullable:!0})],de.prototype,"featureNavigation",void 0),o([l({type:Boolean,nonNullable:!0})],de.prototype,"heading",void 0),o([l({type:Boolean,nonNullable:!0})],de.prototype,"spinner",void 0),de=o([R("esri.widgets.Features.FeaturesVisibleElements")],de);const ki=de,oi="selected-index",$n=0,ai="features-spinner",xn=50;let x=class extends Ei(Z){constructor(i,e){super(i,e),this._featureMenuIntersectionObserverCallback=([t])=>{t!=null&&t.isIntersecting&&this.viewModel.featurePage!=null&&this.viewModel.featurePage++},this._featureMenuIntersectionObserver=new IntersectionObserver(this._featureMenuIntersectionObserverCallback,{root:window.document}),this._featureMenuIntersectionObserverNode=null,this._focusOn=null,this._spinner=null,this._feature=null,this._relatedRecordsFlowItems=new De,this._relatedRecordsWidget=new _n({flowItems:this._relatedRecordsFlowItems}),this._rootFlowItemNode=null,this._featureMenuViewportNode=null,this.collapsed=!1,this.icon=null,this.featureNavigationTop=!1,this.headerActions=new Ie,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.responsiveActionsEnabled=!1,this.viewModel=new Rt,this.visibleElements=new ki,this._renderAction=(t,s)=>{const n=this._getActionTitle(t),{type:r,active:a,uid:d,disabled:c,indicator:h}=t;return t.visible?u("calcite-action",{active:r==="toggle"&&t.value,appearance:"solid",bind:this,"data-action-uid":d,disabled:c,icon:this._getActionIcon(t),indicator:h,key:`action-${s}`,loading:a,onclick:this._triggerAction,scale:"s",text:n,title:this._hideActionText?n:void 0},this._getFallbackIcon(t)):null},this._openFeatureMenu=()=>{this.featureMenuOpen=!0},this._previousFeature=()=>{this.viewModel.selectedFeatureIndex--},this._nextFeature=()=>{this.viewModel.selectedFeatureIndex++},this._handleFeatureMenuBack=()=>{this.featureMenuOpen&&(this._focusOn="root-flow-item",this.featureMenuOpen=!1)},this._focusFlowItemNode=t=>{this._focusOn===t&&requestAnimationFrame(async()=>{var s,n;switch(t){case"menu-flow-item":await((s=this._featureMenuViewportNode)==null?void 0:s.setFocus());break;case"root-flow-item":await((n=this._rootFlowItemNode)==null?void 0:n.setFocus())}this._focusOn=null})},this._focusFlowItemNodeThrottled=Qe(this._focusFlowItemNode,xn),this._displaySpinnerThrottled=Qe(()=>this._displaySpinner(),$n),this._addSelectedFeatureIndexHandle(),this.addHandles([this._displaySpinnerThrottled,this._focusFlowItemNodeThrottled,f(()=>{var t;return(t=this.viewModel)==null?void 0:t.active},()=>this._toggleScreenLocationEnabled()),f(()=>{var t;return(t=this.viewModel)==null?void 0:t.active},t=>this._relatedRecordsWidget.closed=!t),f(()=>{var t;return(t=this.visibleElements)==null?void 0:t.closeButton},t=>this._relatedRecordsWidget.closable=t),f(()=>{var t;return(t=this.visibleElements)==null?void 0:t.spinner},t=>this._spinnerEnabledChange(t)),f(()=>{var t;return(t=this.viewModel)==null?void 0:t.view},(t,s)=>this._viewChange(t,s)),f(()=>{var t,s;return(s=(t=this.viewModel)==null?void 0:t.view)==null?void 0:s.ready},(t,s)=>this._viewReadyChange(t??!1,s??!1)),f(()=>{var t,s;return[(t=this.viewModel)==null?void 0:t.waitingForResult,(s=this.viewModel)==null?void 0:s.location]},()=>{this._hideSpinner(),this._displaySpinnerThrottled()}),f(()=>this.selectedFeatureWidget,()=>this._destroyRelatedRecordsFlowItemWidgets()),f(()=>{var s;const t=(s=this.selectedFeatureWidget)==null?void 0:s.viewModel;return[t==null?void 0:t.title,t==null?void 0:t.state]},()=>this._setTitleFromFeatureWidget()),f(()=>{var s;const t=(s=this.selectedFeatureWidget)==null?void 0:s.viewModel;return[t==null?void 0:t.content,t==null?void 0:t.state]},()=>this._setContentFromFeatureWidget()),f(()=>{var t;return(t=this.viewModel)==null?void 0:t.featureViewModels},()=>this._featureMenuViewportScrollTop()),this._relatedRecordsWidget.on("close",()=>this.close()),this._relatedRecordsWidget.on("exit",()=>this._destroyRelatedRecordsFlowItemWidgets()),this._relatedRecordsWidget.on("open-related-feature",({feature:t})=>this._openRelatedFeature(t))])}loadDependencies(){return Re({action:()=>E(()=>import("./calcite-action-GYDrwtQs.js"),__vite__mapDeps([41,37,2,3,34,21,23,25,26,4,31,27,1,33])),"action-bar":()=>E(()=>import("./calcite-action-bar-1xecS7ni.js"),__vite__mapDeps([47,2,3,39,4,23,25,26,27,48,43,34,37,21,31,1,33,44,45,24,40,46])),"action-group":()=>E(()=>import("./calcite-action-group-ZfO11pHg.js"),__vite__mapDeps([49,48,2,3,39,4,23,25,26,27,43,34,37,21,31,1,33,44,45,24,40,46])),button:()=>E(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([50,51,2,3,29,21,30,23,25,26,4,31,27,1,33,34])),flow:()=>E(()=>import("./calcite-flow-Hhr0ymgr.js"),__vite__mapDeps([52,2,3,4,23])),"flow-item":()=>E(()=>import("./calcite-flow-item-cLwEh1ST.js"),__vite__mapDeps([42,2,3,21,23,25,26,4,27,43,34,37,31,1,33,44,45,24,40,46,35])),list:()=>E(()=>import("./calcite-list-KbTGTbJq.js"),__vite__mapDeps([20,2,3,21,4,22,23,24,25,26,27,1,28,29,30,31,32,33,34,35])),"list-item":()=>E(()=>import("./calcite-list-item-ewhQm-Oo.js"),__vite__mapDeps([36,2,3,21,22,25,26,4,27,23,37,34,31,1,33])),"list-item-group":()=>E(()=>import("./calcite-list-item-group-L6UN1q3l.js"),__vite__mapDeps([53,2,3,21,22])),loader:()=>E(()=>import("./calcite-loader-IfjW-6zZ.js"),__vite__mapDeps([54,33,2,3,34]))})}destroy(){var i,e;this._destroyRelatedRecordsFlowItemWidgets(),this._destroySelectedFeatureWidget(),this._destroySpinner(),this._unobserveFeatureMenuObserver(),(i=this._featureMenuIntersectionObserver)==null||i.disconnect(),(e=this._relatedRecordsWidget)==null||e.destroy()}get _hideActionText(){var e;if(!this.responsiveActionsEnabled)return!1;const i=(e=this.view)==null?void 0:e.widthBreakpoint;return i==="xsmall"||i==="small"||i==="medium"}get _featureNavigationVisible(){return this.viewModel.active&&this.viewModel.featureCount>1&&this.visibleElements.featureNavigation}get _isCollapsed(){return this._collapseEnabled&&this.collapsed}get _collapseEnabled(){return this.visibleElements.collapseButton&&!!this.title&&!!this.content}get content(){return this.viewModel.content}set content(i){this.viewModel.content=i}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(i){this.viewModel.featureMenuOpen=i}get features(){return this.viewModel.features}set features(i){this.viewModel.features=i}get location(){return this.viewModel.location}set location(i){this.viewModel.location=i}get label(){var i;return((i=this.messages)==null?void 0:i.widgetLabel)??""}set label(i){this._overrideIfSome("label",i)}get promises(){return this.viewModel.promises}set promises(i){this.viewModel.promises=i}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(i){this.viewModel.selectedFeatureIndex=i}get selectedFeatureWidget(){const{_feature:i,headingLevel:e,_relatedRecordsFlowItems:t}=this,{selectedFeatureViewModel:s}=this.viewModel,n={title:!1};return s?(i?(i.viewModel=s,i.visibleElements=n):this._feature=new mn({flowItems:t,headingLevel:e+1,viewModel:s,visibleElements:n}),this._feature):null}get title(){return this.viewModel.title}set title(i){this.viewModel.title=i}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(i){this.viewModel.updateLocationEnabled=i}get view(){return this.viewModel.view}set view(i){this.viewModel.view=i}get visible(){return this.viewModel.visible}set visible(i){this.viewModel.visible=i}blur(){var e;const{active:i}=this.viewModel;i?(e=this._rootFlowItemNode)==null||e.blur():ie.getLogger(this).warn("Features can only be blurred when currently active.")}clear(){return this.viewModel.clear()}close(){this.viewModel.visible=!1}fetchFeatures(i,e){return this.viewModel.fetchFeatures(i,e)}focus(){const{active:i}=this.viewModel;i?this._setFocusOn():ie.getLogger(this).warn("Features can only be focused when currently active.")}next(){return this.viewModel.next()}open(i){this.removeHandles(oi);const e={collapsed:(i==null?void 0:i.collapsed)??!1};this.set(e),this.viewModel.open(i),this.addHandles(yt(()=>!this.viewModel.waitingForResult,()=>this._addSelectedFeatureIndexHandle(),{once:!0}))}previous(){return this.viewModel.previous()}triggerAction(i){return this.viewModel.triggerAction(i)}render(){return u("div",{bind:this,class:this.classes(W.base,I.widget,I.panel),onkeydown:this._onMainKeydown},this._renderHeader(),this._renderContentContainer())}_renderFeatureNavigation(){return[this._renderPagination(),this._renderFeatureMenuButton()]}_renderHeader(){return!this.featureMenuOpen&&this.featureNavigationTop&&this._featureNavigationVisible?u("div",{class:W.header,key:"header-actions"},this._renderFeatureNavigation()):null}_renderFooter(){return this.featureMenuOpen||this.featureNavigationTop||!this._featureNavigationVisible?null:u("div",{class:W.footer,key:"footer-actions",slot:"footer"},this._renderFeatureNavigation())}_renderFeatureMenuButton(){const{messages:i,viewModel:e}=this,{featureCount:t,selectedFeatureIndex:s,pendingPromisesCount:n}=e;return u("calcite-action",{appearance:"solid",bind:this,icon:"list",key:"feature-menu-button",label:i.selectFeature,loading:n>0,onclick:this._openFeatureMenu,scale:"s",text:oe(i.pageText,{index:Wt(s+1),total:Wt(t)}),textEnabled:!0,title:i.selectFeature})}_renderPagination(){const{previous:i,next:e}=this.messagesCommon.pagination;return u("calcite-action-bar",{class:W.paginationActionBar,expandDisabled:!0,key:"pagination-action-bar",layout:"horizontal",overflowActionsDisabled:!0,scale:"s"},u("calcite-action-group",{scale:"s"},u("calcite-action",{appearance:"solid",class:W.paginationPrevious,icon:"chevron-left",iconFlipRtl:!0,label:i,onclick:this._previousFeature,scale:"s",text:i,title:i}),u("calcite-action",{appearance:"solid",icon:"chevron-right",iconFlipRtl:!0,label:e,onclick:this._nextFeature,scale:"s",text:e,title:e})))}_renderFeatureMenuItem(i){const{selectedFeatureViewModel:e,featureViewModels:t}=this.viewModel,s=i===e,n=t.indexOf(i);return u("calcite-list-item",{bind:this,"data-feature-index":n,key:`feature-menu-item-${i.uid}`,onblur:this._removeActiveFeature,onfocus:this._setActiveFeature,onmouseleave:this._removeActiveFeature,onmouseover:this._setActiveFeature,selected:s,onCalciteListItemSelect:this._selectFeature},u("span",{innerHTML:i.title||this.messagesCommon.untitled,slot:"content"}))}_groupResultsByLayer(){const{featureViewModels:i}=this.viewModel,e=new Map;return i.forEach(t=>{const s=t==null?void 0:t.graphic;if(!s)return;const n=s.sourceLayer??s.layer,r=e.get(n)??[];e.set(n,[...r,t])}),e}_renderFeatureMenu(){const{featureViewModels:i}=this.viewModel,e=this._groupResultsByLayer();return i.length?u("calcite-list",{selectionAppearance:"icon",selectionMode:"single"},Array.from(e.keys()).map(t=>{var s;return u("calcite-list-item-group",{heading:(t==null?void 0:t.title)??this.messagesCommon.untitled,key:(t==null?void 0:t.uid)||"untitled"},(s=e.get(t))==null?void 0:s.map(n=>this._renderFeatureMenuItem(n)))})):null}_renderHeaderAction(i,e){return i.visible?u("calcite-action",{active:i.type==="toggle"&&i.value,appearance:"solid",bind:this,"data-action-uid":i.uid,disabled:i.disabled,icon:i.icon||"",indicator:i.indicator,key:`header-action-${e}`,loading:i.active,onclick:this._triggerHeaderAction,scale:"m",slot:"header-actions-end",text:i.title||"",title:i.title||""}):null}_renderHeaderActions(){return this.headerActions.map((i,e)=>this._renderHeaderAction(i,e)).toArray()}_renderContentFeature(){const{headingLevel:i,visibleElements:e,_isCollapsed:t,_collapseEnabled:s,featureNavigationTop:n}=this,{title:r,active:a}=this.viewModel,d=e.heading&&r?r:"";return u("calcite-flow-item",{afterCreate:this._storeRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,class:this.classes({[W.contentFeature]:!0,[W.flowItemCollapsed]:t}),closable:e.closeButton,closed:!a,collapsed:t,collapseDirection:n?"down":"up",collapsible:s,headingLevel:i,key:"root-flow-item",onCalciteFlowItemClose:this.close,onCalciteFlowItemToggle:this._handleCollapseToggle},d?u(It,{class:this.classes(W.featuresHeading,I.heading),innerHTML:d,key:"header-content",level:this.headingLevel,slot:"header-content"}):null,this._renderHeaderActions(),this._renderActionBar(),t?null:u("div",{class:this.classes(W.container,W.contentContainer)},this._renderContent()),this._renderFooter())}_renderFeatureMenuContainer(){const{viewModel:i,featureMenuOpen:e,messages:t,messagesCommon:s}=this,{active:n,featureViewModels:r,pendingPromisesCount:a}=i;return e?u("calcite-flow-item",{afterCreate:this._storeFeatureMenuFlowItemNode,afterUpdate:this._focusFeatureMenuFlowItemNode,bind:this,closable:!1,closed:!n,description:oe(t.total,{total:r.length}),heading:t.selectFeature,key:"feature-menu",loading:i.waitingForContents,onCalciteFlowItemBack:this._handleFeatureMenuBack},a>0?u("calcite-loader",{class:W.loader,inline:!0,key:"feature-menu-loader",label:s.loading,scale:"m",slot:"header-actions-end"}):null,u("div",{class:W.container},this._renderFeatureMenu()),u("div",{afterCreate:this._featureMenuIntersectionObserverCreated,bind:this,class:W.featureMenuObserver}),u("calcite-button",{appearance:"transparent",onclick:this._handleFeatureMenuBack,slot:"footer-actions",width:"full"},s.back)):null}_renderContentContainer(){return u("calcite-flow",{key:"content-container"},this._renderContentFeature(),this._renderFeatureMenuContainer(),this._relatedRecordsWidget.render())}_getIconStyles(i){return{"background-image":i?`url(${i})`:""}}_getActionImage(i){const{selectedFeature:e}=this,t=e==null?void 0:e.attributes,{image:s}=i;return s&&t?oe(s,t):s??""}_getFallbackIcon(i){const{className:e,icon:t}=i;if(t)return null;const s=this._getActionImage(i),n={[W.icon]:!!e,[W.actionImage]:!!s};return e&&(n[e]=!0),s||e?u("span",{"aria-hidden":"true",class:this.classes(W.icon,n),key:"icon",styles:s?this._getIconStyles(s):{}}):null}_renderActionBar(){var i;return!this._isCollapsed&&this.visibleElements.actionBar&&((i=this.viewModel.allActions)!=null&&i.length)?u("calcite-action-bar",{expandDisabled:!0,expanded:!this._hideActionText,key:"header-action-bar",scale:"s",slot:"action-bar"},u("calcite-action-group",{overlayPositioning:"fixed",scale:"s"},this._renderActions())):null}_renderActions(){return this.viewModel.allActions.toArray().map(this._renderAction)}_renderContent(){var e;const i=(e=this.viewModel)==null?void 0:e.content;return i?typeof i=="string"?u("div",{class:O.contentNode,innerHTML:i,key:i}):this.renderNodeContent(i):null}_setFocusOn(){this._focusOn=this.featureMenuOpen?"menu-flow-item":"root-flow-item",this.renderNow()}_handleCollapseToggle(){this.collapsed=!this.collapsed}async _openRelatedFeature(i){await i.viewModel.updateGeometry();const e=i.graphic,t=e==null?void 0:e.geometry;if(t==null||e==null)return;this._destroyRelatedRecordsFlowItemWidgets(),await this.viewModel.zoomTo({target:t});const s=Ti(t);this.open({features:[e],location:s??void 0})}_focusRootFlowItemNode(){this._focusFlowItemNodeThrottled("root-flow-item")}_focusFeatureMenuFlowItemNode(){this._focusFlowItemNodeThrottled("menu-flow-item")}_storeRootFlowItemNode(i){this._rootFlowItemNode=i,this._focusFlowItemNodeThrottled("root-flow-item")}_storeFeatureMenuFlowItemNode(i){this._featureMenuViewportNode=i,this._focusFlowItemNodeThrottled("menu-flow-item")}_setActiveFeature(i){var s;const{viewModel:e}=this,t=i.currentTarget["data-feature-index"];e.activeFeature=((s=e.features)==null?void 0:s[t])||null}_removeActiveFeature(){this.viewModel.activeFeature=null}_selectFeature(i){const e=i.currentTarget["data-feature-index"];isNaN(e)||(this.viewModel.selectedFeatureIndex=e),this._handleFeatureMenuBack()}_unobserveFeatureMenuObserver(){this._featureMenuIntersectionObserverNode&&this._featureMenuIntersectionObserver.unobserve(this._featureMenuIntersectionObserverNode)}_featureMenuIntersectionObserverCreated(i){this._unobserveFeatureMenuObserver(),this._featureMenuIntersectionObserver.observe(i),this._featureMenuIntersectionObserverNode=i}_getActionIcon(i){return i.icon?i.icon:i.image||i.className?void 0:"question"}_getActionTitle(i){const{messages:e,selectedFeature:t,messagesCommon:s}=this,{id:n}=i,r=t==null?void 0:t.attributes,a=i.title??"",d=n==="zoom-to-feature"?oe(a,{messages:e}):n==="remove-selected-feature"?oe(a,{messages:s}):n==="zoom-to-clustered-features"||n==="browse-clustered-features"?oe(a,{messages:e}):i.title;return d&&r?oe(d,r):d??""}_onMainKeydown(i){const e=hi(i);e==="ArrowLeft"&&(i.stopPropagation(),this._handleFeatureMenuBack(),this.previous()),e==="ArrowRight"&&(i.stopPropagation(),this._handleFeatureMenuBack(),this.next())}_featureMenuViewportScrollTop(){this._featureMenuViewportNode&&this._featureMenuViewportNode.scrollContentTo({top:0})}_setContentFromFeatureWidget(){const{selectedFeatureWidget:i}=this;i&&(this.viewModel.content=i)}_setTitleFromFeatureWidget(){const{selectedFeatureWidget:i,messagesCommon:e}=this,t=i==null?void 0:i.viewModel;i&&(this.viewModel.title=(t==null?void 0:t.state)==="error"?e==null?void 0:e.errorMessage:(t==null?void 0:t.title)||"")}_addSelectedFeatureIndexHandle(){const i=f(()=>{var e;return(e=this.viewModel)==null?void 0:e.selectedFeatureIndex},(e,t)=>this._selectedFeatureIndexUpdated(e,t));this.addHandles(i,oi)}_selectedFeatureIndexUpdated(i,e){const{featureCount:t}=this.viewModel;t&&i!==e&&i!==-1&&(this._destroyRelatedRecordsFlowItemWidgets(),this._rootFlowItemNode&&this._rootFlowItemNode.scrollContentTo({top:0}))}_triggerHeaderAction(i){const e=i.currentTarget;if(e.disabled)return;const t=e.dataset.actionUid,s=this.headerActions.find(({uid:n})=>n===t);s&&!s.disabled&&((s==null?void 0:s.type)==="toggle"&&(s.value=!s.value),this.emit("trigger-header-action",{action:s}))}_triggerAction(i){const e=i.currentTarget;if(e.disabled)return;const t=e.dataset.actionUid,{allActions:s}=this.viewModel,n=s.findIndex(a=>a.uid===t),r=s.at(n);r&&r.type==="toggle"&&(r.value=!r.value),this.viewModel.triggerAction(n)}_createSpinner(i){i&&(this._spinner=new fn({view:i}),i.ui.add(this._spinner,{key:ai,position:"manual",internal:!0}))}_wireUpView(i){var e;this._destroySpinner(),i&&((e=this.visibleElements)!=null&&e.spinner)&&this._createSpinner(i)}_hideSpinner(){const{_spinner:i}=this;i&&(i.location=null,i.hide())}_viewReadyChange(i,e){var t;i?this._wireUpView((t=this.viewModel)==null?void 0:t.view):e&&this.viewModel.clear()}_viewChange(i,e){i&&e&&this.viewModel.clear()}_destroySelectedFeatureWidget(){const{_feature:i}=this;i&&(i.viewModel=null,!i.destroyed&&i.destroy()),this._feature=null}_destroyRelatedRecordsFlowItemWidgets(){this._relatedRecordsFlowItems.removeAll().forEach(i=>{"showAllEnabled"in i.viewModel&&(i.viewModel.showAllEnabled=!1),i.viewModel=null,i.destroy()})}_toggleScreenLocationEnabled(){const{viewModel:i}=this;i&&(i.screenLocationEnabled=i.active)}_displaySpinner(){const{_spinner:i}=this;if(!i)return;const{location:e,waitingForResult:t}=this.viewModel;t&&e?i.show({location:e}):i.hide()}_destroySpinner(){var t;const{_spinner:i,view:e}=this;i&&((t=e==null?void 0:e.ui)==null||t.remove(i,ai),i.destroy(),this._spinner=null)}_spinnerEnabledChange(i){var e;this._destroySpinner(),i&&this._createSpinner((e=this.viewModel)==null?void 0:e.view)}};o([l()],x.prototype,"_focusOn",void 0),o([l()],x.prototype,"_relatedRecordsFlowItems",void 0),o([l()],x.prototype,"_hideActionText",null),o([l()],x.prototype,"_featureNavigationVisible",null),o([l()],x.prototype,"_isCollapsed",null),o([l()],x.prototype,"_collapseEnabled",null),o([l()],x.prototype,"collapsed",void 0),o([l()],x.prototype,"content",null),o([l()],x.prototype,"icon",void 0),o([l()],x.prototype,"featureMenuOpen",null),o([l()],x.prototype,"featureNavigationTop",void 0),o([l()],x.prototype,"features",null),o([l({type:Ie})],x.prototype,"headerActions",void 0),o([l()],x.prototype,"headingLevel",void 0),o([l()],x.prototype,"location",null),o([l()],x.prototype,"label",null),o([l(),Y("esri/widgets/Features/t9n/Features")],x.prototype,"messages",void 0),o([l(),Y("esri/t9n/common")],x.prototype,"messagesCommon",void 0),o([l()],x.prototype,"promises",null),o([l()],x.prototype,"responsiveActionsEnabled",void 0),o([l({readOnly:!0})],x.prototype,"selectedFeature",null),o([l()],x.prototype,"selectedFeatureIndex",null),o([l({readOnly:!0})],x.prototype,"selectedFeatureWidget",null),o([l()],x.prototype,"title",null),o([l()],x.prototype,"updateLocationEnabled",null),o([l()],x.prototype,"view",null),o([l({type:Rt}),fi(["triggerAction","trigger-action"])],x.prototype,"viewModel",void 0),o([l({type:ki,nonNullable:!0})],x.prototype,"visibleElements",void 0),o([l()],x.prototype,"visible",null),x=o([R("esri.widgets.Features")],x);const Tn=x,te="esri-popup",ge=`${te}--is-docked`,S={base:te,main:`${te}__main-container`,shadow:`${te}--shadow`,isDocked:ge,isDockedTopLeft:`${ge}-top-left`,isDockedTopCenter:`${ge}-top-center`,isDockedTopRight:`${ge}-top-right`,isDockedBottomLeft:`${ge}-bottom-left`,isDockedBottomCenter:`${ge}-bottom-center`,isDockedBottomRight:`${ge}-bottom-right`,alignTopCenter:`${te}--aligned-top-center`,alignBottomCenter:`${te}--aligned-bottom-center`,alignTopLeft:`${te}--aligned-top-left`,alignBottomLeft:`${te}--aligned-bottom-left`,alignTopRight:`${te}--aligned-top-right`,alignBottomRight:`${te}--aligned-bottom-right`,pointer:`${te}__pointer`,pointerDirection:`${te}__pointer-direction`};let Mt=class extends Rt{constructor(i){super(i)}};Mt=o([R("esri.widgets.Popup.PopupViewModel")],Mt);const Ri=Mt;let Se=class extends ce{constructor(){super(...arguments),this.closeButton=!0,this.featureNavigation=!0}};o([l({type:Boolean,nonNullable:!0})],Se.prototype,"closeButton",void 0),o([l({type:Boolean,nonNullable:!0})],Se.prototype,"featureNavigation",void 0),Se=o([R("esri.widgets.Features.PopupVisibleElements")],Se);const Pi=Se,li={buttonEnabled:!0,position:"auto",breakpoint:{width:544}};let F=class extends Z{constructor(i,e){super(i,e),this._dockAction=new cs({id:"popup-dock-action"}),this._featuresWidget=new Tn({responsiveActionsEnabled:!0}),this._containerNode=null,this._mainContainerNode=null,this._pointerOffsetInPx=16,this.alignment="auto",this.collapsed=!1,this.collapseEnabled=!0,this.dockEnabled=!1,this.headingLevel=2,this.maxInlineActions=3,this.messages=null,this.spinnerEnabled=!0,this.viewModel=new Ri,this.visibleElements=new Pi}initialize(){this.addHandles([f(()=>{var i,e;return[(e=(i=this.viewModel)==null?void 0:i.view)==null?void 0:e.widthBreakpoint,this.dockEnabled]},()=>this._handleDockIcon(),{initial:!0}),f(()=>{var i,e;return[this.dockEnabled,(i=this.messages)==null?void 0:i.undock,(e=this.messages)==null?void 0:e.dock]},()=>this._handleDockEnabled(),{initial:!0}),f(()=>this.dockOptions,i=>{const{_dockAction:e}=this,t=this._featuresWidget.headerActions;t.remove(e),i.buttonEnabled&&t.add(e)},{initial:!0}),f(()=>{var i;return(i=this.viewModel)==null?void 0:i.screenLocation},()=>this._positionContainer()),f(()=>{var i;return[(i=this.viewModel)==null?void 0:i.active,this.dockEnabled]},()=>this._toggleScreenLocationEnabled()),f(()=>{var i,e,t,s,n,r,a;return[(i=this.viewModel)==null?void 0:i.screenLocation,(t=(e=this.viewModel)==null?void 0:e.view)==null?void 0:t.padding,(n=(s=this.viewModel)==null?void 0:s.view)==null?void 0:n.size,(r=this.viewModel)==null?void 0:r.active,(a=this.viewModel)==null?void 0:a.location,this.alignment]},()=>this.reposition()),f(()=>{var i,e;return(e=(i=this.viewModel)==null?void 0:i.view)==null?void 0:e.size},(i,e)=>this._updateDockEnabledForViewSize(i,e)),f(()=>{var i;return(i=this.viewModel)==null?void 0:i.view},(i,e)=>this._viewChange(i,e)),f(()=>{var i,e;return(e=(i=this.viewModel)==null?void 0:i.view)==null?void 0:e.ready},(i,e)=>this._viewReadyChange(i??!1,e??!1)),f(()=>this.viewModel,()=>this._featuresWidget.viewModel=this.viewModel,{initial:!0}),f(()=>this._featureNavigationTop,i=>this._featuresWidget.featureNavigationTop=i,{initial:!0}),f(()=>this.headingLevel,i=>this._featuresWidget.headingLevel=i,{initial:!0}),f(()=>this.collapseEnabled,i=>this._featuresWidget.visibleElements.collapseButton=i,{initial:!0}),f(()=>this.collapsed,i=>this._featuresWidget.collapsed=i,{initial:!0}),f(()=>this.visibleElements.closeButton,i=>this._featuresWidget.visibleElements.closeButton=!!i,{initial:!0}),f(()=>this.spinnerEnabled,i=>this._featuresWidget.visibleElements.spinner=i,{initial:!0}),f(()=>this.visibleElements.featureNavigation,i=>this._featuresWidget.visibleElements.featureNavigation=!!i,{initial:!0}),Fe(()=>this._featuresWidget,"trigger-header-action",i=>{i.action===this._dockAction&&(this.dockEnabled=!this.dockEnabled)})])}destroy(){var i;this._dockAction.destroy(),(i=this._featuresWidget)==null||i.destroy()}get _featureNavigationTop(){const{currentAlignment:i,currentDockPosition:e}=this;return i==="bottom-left"||i==="bottom-center"||i==="bottom-right"||e==="top-left"||e==="top-center"||e==="top-right"}get actions(){return this.viewModel.actions}set actions(i){this.viewModel.actions=i}get autoCloseEnabled(){return this.viewModel.autoCloseEnabled}set autoCloseEnabled(i){this.viewModel.autoCloseEnabled=i}get autoOpenEnabled(){return qt(ie.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled}set autoOpenEnabled(i){qt(ie.getLogger(this),"autoOpenEnabled",{replacement:"MapView/SceneView.popupEnabled",version:"4.27"}),this.viewModel.autoOpenEnabled=i}get defaultPopupTemplateEnabled(){return this.viewModel.defaultPopupTemplateEnabled}set defaultPopupTemplateEnabled(i){this.viewModel.defaultPopupTemplateEnabled=i}get content(){return this.viewModel.content}set content(i){this.viewModel.content=i}get currentAlignment(){return this._getCurrentAlignment()}get currentDockPosition(){return this._getCurrentDockPosition()}get dockOptions(){return this._get("dockOptions")||li}set dockOptions(i){var d,c;const e={...li},t=(c=(d=this.viewModel)==null?void 0:d.view)==null?void 0:c.breakpoints,s={};t&&(s.width=t.xsmall,s.height=t.xsmall);const n={...e,...i},r={...e.breakpoint,...s},{breakpoint:a}=n;typeof a=="object"?n.breakpoint={...r,...a}:a&&(n.breakpoint=r),this._set("dockOptions",n),this._setCurrentDockPosition(),this.reposition()}get featureCount(){return this.viewModel.featureCount}get featureMenuOpen(){return this.viewModel.featureMenuOpen}set featureMenuOpen(i){this.viewModel.featureMenuOpen=i}get features(){return this.viewModel.features}set features(i){this.viewModel.features=i}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(i){this.viewModel.goToOverride=i}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(i){this.viewModel.highlightEnabled=i}get location(){return this.viewModel.location}set location(i){this.viewModel.location=i}get label(){var i;return((i=this.messages)==null?void 0:i.widgetLabel)??""}set label(i){this._overrideIfSome("label",i)}get promises(){return this.viewModel.promises}set promises(i){this.viewModel.promises=i}get selectedFeature(){return this.viewModel.selectedFeature}get selectedFeatureIndex(){return this.viewModel.selectedFeatureIndex}set selectedFeatureIndex(i){this.viewModel.selectedFeatureIndex=i}get selectedFeatureWidget(){return this._featuresWidget.selectedFeatureWidget}get title(){return this.viewModel.title}set title(i){this.viewModel.title=i}get updateLocationEnabled(){return this.viewModel.updateLocationEnabled}set updateLocationEnabled(i){this.viewModel.updateLocationEnabled=i}get view(){return this.viewModel.view}set view(i){this.viewModel.view=i}get visible(){return this.viewModel.visible}set visible(i){this.viewModel.visible=i}blur(){const{active:i}=this.viewModel;i||ie.getLogger(this).warn("Popup can only be blurred when currently active."),this._featuresWidget.blur()}clear(){return this.viewModel.clear()}close(){this.visible=!1}fetchFeatures(i,e){return this.viewModel.fetchFeatures(i,e)}focus(){const{active:i}=this.viewModel;i||ie.getLogger(this).warn("Popup can only be focused when currently active."),this.renderNow(),this._featuresWidget.focus()}next(){return this.viewModel.next()}open(i){const e=!!i&&!!i.featureMenuOpen,t={collapsed:!!i&&!!i.collapsed,featureMenuOpen:e};this.set(t),this.viewModel.open(i),this._shouldFocus(i)}previous(){return this.viewModel.previous()}reposition(){this.renderNow(),this._positionContainer(),this._setCurrentAlignment()}triggerAction(i){return this.viewModel.triggerAction(i)}render(){var h,p,m,g;const{dockEnabled:i,currentAlignment:e,currentDockPosition:t}=this,{active:s}=this.viewModel,n=s&&i,r=s&&!i,a=(p=(h=this.selectedFeature)==null?void 0:h.layer)==null?void 0:p.title,d=(g=(m=this.selectedFeature)==null?void 0:m.layer)==null?void 0:g.id,c={[S.alignTopCenter]:e==="top-center",[S.alignBottomCenter]:e==="bottom-center",[S.alignTopLeft]:e==="top-left",[S.alignBottomLeft]:e==="bottom-left",[S.alignTopRight]:e==="top-right",[S.alignBottomRight]:e==="bottom-right",[S.isDocked]:n,[S.shadow]:r,[S.isDockedTopLeft]:t==="top-left",[S.isDockedTopCenter]:t==="top-center",[S.isDockedTopRight]:t==="top-right",[S.isDockedBottomLeft]:t==="bottom-left",[S.isDockedBottomCenter]:t==="bottom-center",[S.isDockedBottomRight]:t==="bottom-right"};return u("div",{afterCreate:this._positionContainer,afterUpdate:this._positionContainer,bind:this,class:this.classes(S.base,c),"data-layer-id":d,"data-layer-title":a,role:"presentation"},s?[this._renderMainContainer(),this._renderPointer()]:null)}_renderPointer(){return this.dockEnabled?null:u("div",{class:S.pointer,key:"popup-pointer",role:"presentation"},u("div",{class:this.classes(S.pointerDirection,S.shadow)}))}_renderMainContainer(){const{dockEnabled:i}=this,e={[S.shadow]:i};return u("div",{afterCreate:this._setMainContainerNode,afterUpdate:this._setMainContainerNode,bind:this,class:this.classes(S.main,I.widget,e)},this._featuresWidget.render())}async _shouldFocus(i){i!=null&&i.shouldFocus&&(await us(()=>{var e;return((e=this.viewModel)==null?void 0:e.active)===!0}),this.focus())}_isOutsideView(i){const{popupHeight:e,popupWidth:t,screenLocation:s,side:n,view:r}=i;if(isNaN(t)||isNaN(e)||!r||!s)return!1;const a=r.padding;return n==="right"&&s.x+t/2>r.width-a.right||n==="left"&&s.x-t/2r.height-a.bottom}_calculateAutoAlignment(i){if(i!=="auto")return i;const{_pointerOffsetInPx:e,_containerNode:t,_mainContainerNode:s,viewModel:n}=this,{screenLocation:r,view:a}=n;if(r==null||!a||!t)return"top-center";function d(L){return parseInt(L.replaceAll(/[^-\d\.]/g,""),10)}const c=s?window.getComputedStyle(s,null):null,h=c?d(c.getPropertyValue("max-height")):0,p=c?d(c.getPropertyValue("height")):0,{height:m,width:g}=t.getBoundingClientRect(),_=g+e,v=Math.max(m,h,p)+e,w=this._isOutsideView({popupHeight:v,popupWidth:_,screenLocation:r,side:"right",view:a}),A=this._isOutsideView({popupHeight:v,popupWidth:_,screenLocation:r,side:"left",view:a}),b=this._isOutsideView({popupHeight:v,popupWidth:_,screenLocation:r,side:"top",view:a}),T=this._isOutsideView({popupHeight:v,popupWidth:_,screenLocation:r,side:"bottom",view:a});return A?b?"bottom-right":"top-right":w?b?"bottom-left":"top-left":b?T?"top-center":"bottom-center":"top-center"}_callCurrentAlignment(i){return typeof i=="function"?i.call(this):i}_getCurrentAlignment(){const{alignment:i,dockEnabled:e}=this;return e||!this.viewModel.active?null:this._calculatePositionResult(this._calculateAutoAlignment(this._callCurrentAlignment(i)))}_setCurrentAlignment(){this._set("currentAlignment",this._getCurrentAlignment())}_setCurrentDockPosition(){this._set("currentDockPosition",this._getCurrentDockPosition())}_calculatePositionResult(i){const e=["left","right"];return Ae(this.container)&&e.reverse(),i==null?void 0:i.replace(/leading/gi,e[0]).replaceAll(/trailing/gi,e[1])}_callDockPosition(i){return typeof i=="function"?i.call(this):i}_getDockPosition(){var i;return this._calculatePositionResult(this._calculateAutoDockPosition(this._callDockPosition((i=this.dockOptions)==null?void 0:i.position)))}_getCurrentDockPosition(){return this.dockEnabled&&this.viewModel.active?this._getDockPosition():null}_calculateAutoDockPosition(i){var a;if(i!=="auto")return i;const e=(a=this.viewModel)==null?void 0:a.view,t=Ae(this.container)?"top-left":"top-right";if(!e)return t;const s=e.padding||{left:0,right:0,top:0,bottom:0},n=e.width-s.left-s.right,{breakpoints:r}=e;return r&&n<=r.xsmall?"bottom-center":t}_getDockIcon(){const i=this._getDockPosition();if(this.dockEnabled)return"minimize";switch(i){case"top-left":case"bottom-left":return"dock-left";case"top-center":return"maximize";case"bottom-center":return"dock-bottom";default:return"dock-right"}}_handleDockIcon(){this._dockAction.icon=this._getDockIcon()}_handleDockEnabled(){var i,e;this._dockAction.title=this.dockEnabled?(i=this.messages)==null?void 0:i.undock:(e=this.messages)==null?void 0:e.dock}_setMainContainerNode(i){this._mainContainerNode=i}_positionContainer(i=this._containerNode){if(i&&(this._containerNode=i),!this._containerNode)return;const{screenLocation:e}=this.viewModel,{width:t}=this._containerNode.getBoundingClientRect(),s=this._calculatePositionStyle(e,t);s&&Object.assign(this._containerNode.style,s)}_calculateFullWidth(i){const{currentAlignment:e,_pointerOffsetInPx:t}=this;return e==="top-left"||e==="bottom-left"||e==="top-right"||e==="bottom-right"?i+t:i}_calculateAlignmentPosition(i,e,t,s){const{currentAlignment:n,_pointerOffsetInPx:r}=this;if(!t)return;const{padding:a}=t,d=s/2,c=t.height-e,h=t.width-i;return n==="bottom-center"?{top:e+r-a.top,left:i-d-a.left}:n==="top-left"?{bottom:c+r-a.bottom,right:h+r-a.right}:n==="bottom-left"?{top:e+r-a.top,right:h+r-a.right}:n==="top-right"?{bottom:c+r-a.bottom,left:i+r-a.left}:n==="bottom-right"?{top:e+r-a.top,left:i+r-a.left}:n==="top-center"?{bottom:c+r-a.bottom,left:i-d-a.left}:void 0}_calculatePositionStyle(i,e){const{dockEnabled:t,view:s}=this;if(!s)return;if(t)return{left:"",top:"",right:"",bottom:""};if(i==null||!e)return;const n=this._calculateFullWidth(e),r=this._calculateAlignmentPosition(i.x,i.y,s,n);return r?{top:r.top!==void 0?`${r.top}px`:"auto",left:r.left!==void 0?`${r.left}px`:"auto",bottom:r.bottom!==void 0?`${r.bottom}px`:"auto",right:r.right!==void 0?`${r.right}px`:"auto"}:void 0}_viewChange(i,e){i&&e&&(this.close(),this.clear())}_viewReadyChange(i,e){i?this._wireUpView():e&&(this.close(),this.clear())}_wireUpView(){this._setDockEnabledForViewSize(this.dockOptions)}_dockingThresholdCrossed(i,e,t){const[s,n]=i,[r,a]=e,{width:d=0,height:c=0}=t??{};return s<=d&&r>d||s>d&&r<=d||n<=c&&a>c||n>c&&a<=c}_updateDockEnabledForViewSize(i,e){var h,p;if(!i||!e)return;const t=((p=(h=this.viewModel)==null?void 0:h.view)==null?void 0:p.padding)||{left:0,right:0,top:0,bottom:0},s=t.left+t.right,n=t.top+t.bottom,r=[],a=[];r[0]=i[0]-s,r[1]=i[1]-n,a[0]=e[0]-s,a[1]=e[1]-n;const{dockOptions:d}=this,c=d.breakpoint;this._dockingThresholdCrossed(r,a,c)&&this._setDockEnabledForViewSize(d),this._setCurrentDockPosition()}_toggleScreenLocationEnabled(){const{dockEnabled:i,viewModel:e}=this;if(!e)return;const t=e.active&&!i;e.screenLocationEnabled=t}_shouldDockAtCurrentViewSize(i){var d,c;const e=i.breakpoint,t=(c=(d=this.viewModel)==null?void 0:d.view)==null?void 0:c.ui;if(!t)return!1;const{width:s,height:n}=t;if(isNaN(s)||isNaN(n)||!e)return!1;const r=e.hasOwnProperty("width")&&s<=(e.width??0),a=e.hasOwnProperty("height")&&n<=(e.height??0);return r||a}_setDockEnabledForViewSize(i){i.breakpoint&&(this.dockEnabled=this._shouldDockAtCurrentViewSize(i))}};o([l({readOnly:!0})],F.prototype,"_featureNavigationTop",null),o([l()],F.prototype,"actions",null),o([l()],F.prototype,"alignment",void 0),o([l()],F.prototype,"autoCloseEnabled",null),o([l()],F.prototype,"autoOpenEnabled",null),o([l()],F.prototype,"defaultPopupTemplateEnabled",null),o([l()],F.prototype,"content",null),o([l()],F.prototype,"collapsed",void 0),o([l()],F.prototype,"collapseEnabled",void 0),o([l({readOnly:!0})],F.prototype,"currentAlignment",null),o([l({readOnly:!0})],F.prototype,"currentDockPosition",null),o([l()],F.prototype,"dockOptions",null),o([l()],F.prototype,"dockEnabled",void 0),o([l({readOnly:!0})],F.prototype,"featureCount",null),o([l()],F.prototype,"featureMenuOpen",null),o([l()],F.prototype,"features",null),o([l()],F.prototype,"goToOverride",null),o([l()],F.prototype,"headingLevel",void 0),o([l()],F.prototype,"highlightEnabled",null),o([l()],F.prototype,"location",null),o([l()],F.prototype,"label",null),o([l()],F.prototype,"maxInlineActions",void 0),o([l(),Y("esri/widgets/Popup/t9n/Popup")],F.prototype,"messages",void 0),o([l()],F.prototype,"promises",null),o([l({readOnly:!0})],F.prototype,"selectedFeature",null),o([l()],F.prototype,"selectedFeatureIndex",null),o([l({readOnly:!0})],F.prototype,"selectedFeatureWidget",null),o([l()],F.prototype,"spinnerEnabled",void 0),o([l()],F.prototype,"title",null),o([l()],F.prototype,"updateLocationEnabled",null),o([l()],F.prototype,"view",null),o([l({type:Ri}),fi(["triggerAction","trigger-action"])],F.prototype,"viewModel",void 0),o([l()],F.prototype,"visible",null),o([l({type:Pi,nonNullable:!0})],F.prototype,"visibleElements",void 0),F=o([R("esri.widgets.Popup")],F);const hr=F;export{hr as default}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/calcite-icon-itD416se.js","assets/icon-ZwpY5ksA.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/observers-JyBmMU24.js","assets/chartUtilsAm5-QfmFJ3lc.js","assets/Theme-QNc_77AM.js","assets/Tooltip-lrFZgXdG.js","assets/DefaultTheme-T7-VnRhA.js","assets/chartCommon-ZPkVkRIK.js","assets/Responsive-QKXcW_1q.js","assets/Button-1STHXt3M.js","assets/ColorSet-j9kKRPwP.js","assets/pieChart-w-OTuuJJ.js","assets/Tick-WQ_bPwW2.js","assets/xyChart-pkay2Qkc.js","assets/LineSeries-VcEznTH7.js","assets/arcadeUtils-OUqwHs4P.js","assets/TimeOnly-ljWtUK7N.js","assets/hash-SS5GKVPY.js","assets/calcite-list-LJfGqLbO.js","assets/interactive-NKzPUNL4.js","assets/utils3-_ao2jQXg.js","assets/loadable-sxY2K1G3.js","assets/debounce-HnHf1UOZ.js","assets/locale-pfkq1d6A.js","assets/key-qdHumIlA.js","assets/t9n-od6MEnI1.js","assets/input-9jE7tcJD.js","assets/form-2Iq0hI3D.js","assets/label2-d2vWQ7x7.js","assets/component-dtiBfYiX.js","assets/progress-puB9lhY4.js","assets/loader-QqciGs1c.js","assets/guid-6vN-YNJI.js","assets/scrim-OeyGkB0-.js","assets/calcite-list-item-OtIyVNHT.js","assets/action-W5zDPNjG.js","assets/calcite-notice-zH528nES.js","assets/conditionalSlot-e55zipTI.js","assets/openCloseComponent-yw47Oy2q.js","assets/calcite-action-mEzyoc-Z.js","assets/calcite-flow-item-mBjWFd-U.js","assets/action-menu-h_LAlWK7.js","assets/popover-Jm1QI0N1.js","assets/floating-ui-McpI0u1Z.js","assets/FloatingArrow-BghsONry.js","assets/calcite-action-bar-yKX8eCZY.js","assets/action-group-8XaPC2xM.js","assets/calcite-action-group-_Xoggrsa.js","assets/calcite-button-tOn16zeN.js","assets/button-dkwNndhL.js","assets/calcite-flow-A39UdeqN.js","assets/calcite-list-item-group-havhVECR.js","assets/calcite-loader-Z65agR8e.js"] + __vite__mapDeps.viteFileDeps = ["assets/calcite-icon-ZhRmLRGh.js","assets/icon-BW6RCrUr.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/observers-eNe735aq.js","assets/chartUtilsAm5-owLhGEU2.js","assets/Theme-5CV7oVsW.js","assets/Tooltip-4JsqFz5S.js","assets/DefaultTheme-uOYPzulo.js","assets/chartCommon-OKgpftOz.js","assets/Responsive-QlPOQ03r.js","assets/Button-HXGuX8_s.js","assets/ColorSet-tH4rJdGx.js","assets/pieChart-DJY-uQgy.js","assets/Tick-bu1aEuYp.js","assets/xyChart-CbyBbMYg.js","assets/LineSeries-yr_9erUD.js","assets/arcadeUtils-vGyJZHQt.js","assets/TimeOnly-gkehHHJx.js","assets/hash-SS5GKVPY.js","assets/calcite-list-KbTGTbJq.js","assets/interactive-9W9APeiw.js","assets/utils3--QEgMxFs.js","assets/loadable-uNbe2Ndt.js","assets/debounce-HnHf1UOZ.js","assets/locale-tKMV0J87.js","assets/key-qdHumIlA.js","assets/t9n-KLe7iM0R.js","assets/input-_z9XIoLu.js","assets/form-1U5Kiwxm.js","assets/label2-JXqLMBYY.js","assets/component-dtiBfYiX.js","assets/progress-TBzcAK5D.js","assets/loader-plQ4Tft5.js","assets/guid-6vN-YNJI.js","assets/scrim-yAG2Pcs1.js","assets/calcite-list-item-ewhQm-Oo.js","assets/action-bN6v5--b.js","assets/calcite-notice-6pbWdSt0.js","assets/conditionalSlot-OgY0Ln74.js","assets/openCloseComponent-lU2sdEaR.js","assets/calcite-action-GYDrwtQs.js","assets/calcite-flow-item-cLwEh1ST.js","assets/action-menu-FiGuYhhw.js","assets/popover-QEcoULsC.js","assets/floating-ui-C10Xvlxv.js","assets/FloatingArrow-FUeqM5kw.js","assets/calcite-action-bar-1xecS7ni.js","assets/action-group-6S1AUKwx.js","assets/calcite-action-group-ZfO11pHg.js","assets/calcite-button-rIOy-85Y.js","assets/button-4hsayCiP.js","assets/calcite-flow-Hhr0ymgr.js","assets/calcite-list-item-group-L6UN1q3l.js","assets/calcite-loader-IfjW-6zZ.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/PopupSceneLayerView-cRxapYqF.js b/dist/assets/PopupSceneLayerView-1BvuVn-Q.js similarity index 87% rename from dist/assets/PopupSceneLayerView-cRxapYqF.js rename to dist/assets/PopupSceneLayerView-1BvuVn-Q.js index 823d9d9..c74e993 100644 --- a/dist/assets/PopupSceneLayerView-cRxapYqF.js +++ b/dist/assets/PopupSceneLayerView-1BvuVn-Q.js @@ -1 +1 @@ -import{e as y,c as d,E as l,fG as o,fH as f,fI as w,fJ as F}from"./index-J0iiHjMT.js";const x=h=>{let r=class extends h{_validateFetchPopupFeatures(p){const{layer:e}=this,{popupEnabled:t}=e;if(!t)throw new l("scenelayerview3d:fetchPopupFeatures","Popups are disabled",{layer:e});if(!o(e,p))throw new l("scenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{layer:e})}async prepareFetchPopupFeatures(p){}async fetchPopupFeatures(p,e){this._validateFetchPopupFeatures(e);const t=e!=null?e.clientGraphics:null;if(!t||t.length===0)return[];const u=this.layer.type==="scene"&&this.layer.associatedLayer!=null?this.layer.associatedLayer:this.layer;let i=[];"fieldsIndex"in this.layer&&(i=f(this.layer.fieldsIndex,await w(u,o(this.layer,e)))),await this.prepareFetchPopupFeatures(i);const c=new Set,n=[],a=[];for(const s of t)F(i,s,c)?a.push(s):n.push(s);return a.length===0?n:this.whenGraphicAttributes(a,[...c]).catch(()=>a).then(s=>n.concat(s))}};return r=y([d("esri.views.3d.layers.support.PopupSceneLayerView")],r),r};export{x as i}; +import{e as y,c as d,r as l,fB as o,fC as f,fD as w,fE as F}from"./index-pCX-0tJH.js";const x=h=>{let r=class extends h{_validateFetchPopupFeatures(p){const{layer:e}=this,{popupEnabled:t}=e;if(!t)throw new l("scenelayerview3d:fetchPopupFeatures","Popups are disabled",{layer:e});if(!o(e,p))throw new l("scenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{layer:e})}async prepareFetchPopupFeatures(p){}async fetchPopupFeatures(p,e){this._validateFetchPopupFeatures(e);const t=e!=null?e.clientGraphics:null;if(!t||t.length===0)return[];const u=this.layer.type==="scene"&&this.layer.associatedLayer!=null?this.layer.associatedLayer:this.layer;let i=[];"fieldsIndex"in this.layer&&(i=f(this.layer.fieldsIndex,await w(u,o(this.layer,e)))),await this.prepareFetchPopupFeatures(i);const c=new Set,n=[],a=[];for(const s of t)F(i,s,c)?a.push(s):n.push(s);return a.length===0?n:this.whenGraphicAttributes(a,[...c]).catch(()=>a).then(s=>n.concat(s))}};return r=y([d("esri.views.3d.layers.support.PopupSceneLayerView")],r),r};export{x as i}; diff --git a/dist/assets/QueryEngine-8tLWlkSE.js b/dist/assets/QueryEngine-8tLWlkSE.js deleted file mode 100644 index 2e9dcf5..0000000 --- a/dist/assets/QueryEngine-8tLWlkSE.js +++ /dev/null @@ -1,7 +0,0 @@ -import{qP as mt,qQ as oe,qR as pt,e_ as L,qS as ue,qT as yt,qU as gt,qV as xt,gu as Re,E as T,eP as Ie,k1 as _t,qW as Ft,al as b,bH as St,qX as Be,eF as ye,k2 as Ue,e3 as wt,fd as Rt,gk as G,qY as ce,qZ as he,d4 as ke,d6 as Le,q_ as It,q$ as Te,gi as ve,gh as se,r0 as $e,de as ge,r1 as Tt,r2 as de,r3 as vt,r4 as $t,bI as ee,dp as bt,bN as fe,dy as me,eJ as Q,dz as H,eK as At,ct as Et,mG as Mt,r5 as qt,eV as be,r6 as Vt,r7 as Pt,r8 as Ae,r9 as Ct,ra as Nt,gb as zt,rb as Qt,rc as Gt,eE as Dt,eQ as Ot,ak as Ee,n as Zt,s as jt,rd as Bt,l6 as Ut,eh as kt,l8 as Lt,e2 as ae,re as Me,ce as Ht,ea as Jt,eU as Yt,mH as qe,eL as Wt,ae as Kt,cf as Xt}from"./index-J0iiHjMT.js";import{x as ei}from"./WhereClause-XAMIZ4-B.js";import{t as He}from"./json-v6EOeNTY.js";import{t as ti}from"./QueryEngineCapabilities-PzVpW5yD.js";import{c as re,w as ii,B as si,f as ai,d as Ve,p as Pe,C as ri,k as ni,$ as li,E as oi,P as ui,U as ci,T as hi,v as di}from"./utils-P5wTOmqv.js";const Ce=new L,fi=new L,pe=new L,E={esriGeometryPoint:ue,esriGeometryPolyline:yt,esriGeometryPolygon:gt,esriGeometryMultipoint:xt};function Ne(a,e,t,i=a.hasZ,s=a.hasM){if(e==null)return null;const r=a.hasZ&&i,n=a.hasM&&s;if(t){const l=oe(pe,e,a.hasZ,a.hasM,"esriGeometryPoint",t,i,s);return ue(l,r,n)}return ue(e,r,n)}function q(a,e,t,i,s,r,n=e,l=t){var h,d,m;const o=e&&n,u=t&&l,c=i!=null?"coords"in i?i:i.geometry:null;if(c==null)return null;if(s){let p=mt(fi,c,e,t,a,s,n,l);return r&&(p=oe(pe,p,o,u,a,r)),((h=E[a])==null?void 0:h.call(E,p,o,u))??null}if(r){const p=oe(pe,c,e,t,a,r,n,l);return((d=E[a])==null?void 0:d.call(E,p,o,u))??null}return pt(Ce,c,e,t,n,l),((m=E[a])==null?void 0:m.call(E,Ce,o,u))??null}function U(a){return a&&Je in a?JSON.parse(JSON.stringify(a,mi)):a}const Je="_geVersion",mi=(a,e)=>a!==Je?e:void 0;let pi=class{constructor(e,t){this._cache=new Re(e),this._invalidCache=new Re(t)}get(e,t){const i=`${t.uid}:${e}`,s=this._cache.get(i);if(s)return s;if(this._invalidCache.get(i)!=null)return null;try{const r=ei.create(e,t);return this._cache.put(i,r),r}catch(r){return this._invalidCache.put(i,r),null}}getError(e,t){const i=`${t.uid}:${e}`;return this._invalidCache.get(i)??null}};const Ye=new pi(50,500),k="unsupported-query",We=" as ",Ke=new Set(["esriFieldTypeOID","esriFieldTypeSmallInteger","esriFieldTypeBigInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong"]),Xe=new Set(["esriFieldTypeDate","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]),yi=new Set(["esriFieldTypeString","esriFieldTypeGUID","esriFieldTypeGlobalID",...Ke,...Xe]);function xe(a,e,t={}){const i=z(e,a);if(!i){const r=Ye.getError(e,a);throw new T(k,"invalid SQL expression",{expression:e,error:r})}const s=t.expressionName||"expression";if(t.validateStandardized&&!i.isStandardized)throw new T(k,`${s} is not standard`,{expression:e});if(t.validateAggregate&&!i.isAggregate)throw new T(k,`${s} does not contain a valid aggregate function`,{expression:e});return i.fieldNames}function gi(a,e,t,i){if(!t)return!0;const s="where clause";return N(a,e,xe(a,t,{validateStandardized:!0,expressionName:s}),{expressionName:s,query:i}),!0}function xi(a,e,t,i,s){if(!t)return!0;const r="having clause",n=xe(a,t,{validateAggregate:!0,expressionName:r});N(a,e,n,{expressionName:r,query:s});const l=z(t,a);if(!(l==null?void 0:l.getExpressions().every(u=>{var m;const{aggregateType:c,field:h}=u,d=(m=a.get(h))==null?void 0:m.name;return i.some(p=>{var w;const{onStatisticField:f,statisticType:F}=p;return((w=a.get(f))==null?void 0:w.name)===d&&F.toLowerCase().trim()===c})})))throw new T(k,"expressions in having clause should also exist in outStatistics",{having:t});return!0}function z(a,e){return a?Ye.get(a,e):null}function et(a){return/\((.*?)\)/.test(a)?a:a.split(We)[0]}function _i(a){return a.split(We)[1]}function N(a,e,t,i={}){const s=new Map;if(Fi(s,a,e,i.allowedFieldTypes??yi,t),s.size){const r=i.expressionName??"expression";throw new T(k,`${r} contains invalid or missing fields`,{errors:Array.from(s.values()),query:i.query})}}function Fi(a,e,t,i,s){for(const r of s)if(r!=="*")if(e.get(r))ze(a,e,t,i,r);else try{const n=xe(e,et(r),{validateStandardized:!0});for(const l of n)ze(a,e,t,i,l)}catch(n){a.set(r,{type:"expression-error",expression:r,error:n})}}function ze(a,e,t,i,s){if(s==="*")return;const r=e.get(s);r?t.has(r.name)?(i==null?void 0:i.has(r.type))===!1&&a.set(s,{type:"invalid-type",fieldName:r.name,fieldType:Ie.fromJSON(r.type),allowedFieldTypes:Array.from(i,n=>Ie.fromJSON(n))}):a.set(s,{type:"missing-field",fieldName:r.name}):a.set(s,{type:"invalid-field",fieldName:s})}const ne=[0,0];function tt(a,e){if(!e)return null;if("x"in e){const t={x:0,y:0};return[t.x,t.y]=a(e.x,e.y,ne),e.z!=null&&(t.z=e.z),e.m!=null&&(t.m=e.m),t}if("xmin"in e){const t={xmin:0,ymin:0,xmax:0,ymax:0};return[t.xmin,t.ymin]=a(e.xmin,e.ymin,ne),[t.xmax,t.ymax]=a(e.xmax,e.ymax,ne),e.hasZ&&(t.zmin=e.zmin,t.zmax=e.zmax,t.hasZ=!0),e.hasM&&(t.mmin=e.mmin,t.mmax=e.mmax,t.hasM=!0),t}return"rings"in e?{rings:Qe(e.rings,a),hasM:e.hasM,hasZ:e.hasZ}:"paths"in e?{paths:Qe(e.paths,a),hasM:e.hasM,hasZ:e.hasZ}:"points"in e?{points:it(e.points,a),hasM:e.hasM,hasZ:e.hasZ}:null}function Qe(a,e){const t=[];for(const i of a)t.push(it(i,e));return t}function it(a,e){const t=[];for(const i of a){const s=e(i[0],i[1],[0,0]);t.push(s),i.length>2&&s.push(i[2]),i.length>3&&s.push(i[3])}return t}async function Z(a,e){if(!a||!e)return;const t=Array.isArray(a)?a.map(i=>i.geometry!=null?i.geometry.spatialReference:null).filter(wt):[a];await Rt(t.map(i=>({source:i,dest:e})))}const st=tt.bind(null,_t),at=tt.bind(null,Ft);function M(a,e,t,i){if(!a||(t||(t=e,e=a.spatialReference),!G(e)||!G(t)||b(e,t)))return a;if(Be(e,t)){const s=ye(t)?st(a):at(a);return s.spatialReference=t,s}return Ue(He,[a],e,t,null,i)[0]}class Si{constructor(){this._jobs=[],this._timer=null,this._process=this._process.bind(this)}async push(e,t,i,s){if(!(e!=null&&e.length)||!t||!i||b(t,i))return e;const r={geometries:e,inSpatialReference:t,outSpatialReference:i,geographicTransformation:s,resolve:St()};return this._jobs.push(r),this._timer??(this._timer=setTimeout(this._process,10)),r.resolve.promise}_process(){this._timer=null;const e=this._jobs.shift();if(!e)return;const{geometries:t,inSpatialReference:i,outSpatialReference:s,resolve:r,geographicTransformation:n}=e;Be(i,s)?ye(s)?r(t.map(st)):r(t.map(at)):r(Ue(He,t,i,s,n,null)),this._jobs.length>0&&(this._timer=setTimeout(this._process,10))}}const wi=new Si;function Ri(a,e,t,i){return wi.push(a,e,t,i)}let X=class{constructor(e,t,i){this._fieldDataCache=new Map,this._returnDistinctMap=new Map,this.returnDistinctValues=e.returnDistinctValues??!1,this.fieldsIndex=i,this.featureAdapter=t;const s=e.outFields;if(s&&!s.includes("*")){this.outFields=s;let r=0;for(const n of s){const l=et(n),o=this.fieldsIndex.get(l),u=o?null:z(l,i),c=o?o.name:_i(n)||"FIELD_EXP_"+r++;this._fieldDataCache.set(n,{alias:c,clause:u})}}}countDistinctValues(e){return this.returnDistinctValues?(e.forEach(t=>this.getAttributes(t)),this._returnDistinctMap.size):e.length}getAttributes(e){const t=this._processAttributesForOutFields(e);return this._processAttributesForDistinctValues(t)}getFieldValue(e,t,i){var n;const s=i?i.name:t;let r=null;return this._fieldDataCache.has(s)?r=(n=this._fieldDataCache.get(s))==null?void 0:n.clause:i||(r=z(t,this.fieldsIndex),this._fieldDataCache.set(s,{alias:s,clause:r})),i?this.featureAdapter.getAttribute(e,s):r==null?void 0:r.calculateValue(e,this.featureAdapter)}getDataValues(e,t,i=!0){const s=t.normalizationType,r=t.normalizationTotal,n=this.fieldsIndex.get(t.field),l=ce(n)||he(n),o=ke(n);return e.map(u=>{let c=t.field&&this.getFieldValue(u,t.field,this.fieldsIndex.get(t.field));if(t.field2?(c=`${re(c)}${t.fieldDelimiter}${re(this.getFieldValue(u,t.field2,this.fieldsIndex.get(t.field2)))}`,t.field3&&(c=`${c}${t.fieldDelimiter}${re(this.getFieldValue(u,t.field3,this.fieldsIndex.get(t.field3)))}`)):typeof c=="string"&&i&&(l?c=c?new Date(c).getTime():null:o&&(c=c?ii(c):null)),s&&Number.isFinite(c)){const h=s==="field"&&t.normalizationField?this.getFieldValue(u,t.normalizationField,this.fieldsIndex.get(t.normalizationField)):null;c=si(c,s,h,r)}return c})}async getExpressionValues(e,t,i,s,r){const{arcadeUtils:n}=await Le(),l=n.hasGeometryOperations(t);l&&await n.enableGeometryOperations();const o=n.createFunction(t),u=n.getViewInfo(i),c={fields:this.fieldsIndex.fields};return e.map(h=>{const d={attributes:this.featureAdapter.getAttributes(h),layer:c,geometry:l?{...q(s.geometryType,s.hasZ,s.hasM,this.featureAdapter.getGeometry(h)),spatialReference:i==null?void 0:i.spatialReference}:null},m=n.createExecContext(d,u,r);return n.executeFunction(o,m)})}validateItem(e,t){var i,s;return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:z(t,this.fieldsIndex)}),((s=(i=this._fieldDataCache.get(t))==null?void 0:i.clause)==null?void 0:s.testFeature(e,this.featureAdapter))??!1}validateItems(e,t){var i,s;return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:z(t,this.fieldsIndex)}),((s=(i=this._fieldDataCache.get(t))==null?void 0:i.clause)==null?void 0:s.testSet(e,this.featureAdapter))??!1}_processAttributesForOutFields(e){const t=this.outFields;if(!(t!=null&&t.length))return this.featureAdapter.getAttributes(e);const i={};for(const s of t){const{alias:r,clause:n}=this._fieldDataCache.get(s);i[r]=n?n.calculateValue(e,this.featureAdapter):this.featureAdapter.getAttribute(e,r)}return i}_processAttributesForDistinctValues(e){if(e==null||!this.returnDistinctValues)return e;const t=this.outFields,i=[];if(t)for(const n of t){const{alias:l}=this._fieldDataCache.get(n);i.push(e[l])}else for(const n in e)i.push(e[n]);const s=`${(t||["*"]).join(",")}=${i.join(",")}`;let r=this._returnDistinctMap.get(s)||0;return this._returnDistinctMap.set(s,++r),r>1?null:e}};class v{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasM=i.hasM,this.hasZ=i.hasZ,this.fieldsIndex=i.fieldsIndex,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new X(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query;if(!(t==null?void 0:t.length))return 1;const n=new Map,l=new Map,o=new Set;for(const u of s){const{statisticType:c}=u,h=c!=="exceedslimit"?u.onStatisticField:void 0;if(!l.has(h)){const m=[];for(const p of t){const f=this._getAttributeValues(e,p,n);m.push(f)}l.set(h,this._calculateUniqueValues(m,e.returnDistinctValues))}const d=l.get(h);for(const m in d){const{data:p,items:f}=d[m],F=p.join(",");i&&!e.validateItems(f,i)||o.add(F)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics?e=this.query.outStatistics.some(t=>t.statisticType==="exceedslimit")?this._createExceedsLimitQueryResponse(this.query):await this._createStatisticsQueryResponse(this.query):e=this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){const t=this.query.geometry;G(this.query.outSR)&&!b(t.spatialReference,this.query.outSR)?e.queryGeometry=U({spatialReference:this.query.outSR,...M(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=U({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t){const i=this.featureAdapter,s=Ge(this.hasZ,this.hasM),{point:r,mode:n}=e,l=typeof e.distance=="number"?e.distance:e.distance.x,o=typeof e.distance=="number"?e.distance:e.distance.y,u={candidates:[]},c=this.geometryType==="esriGeometryPolygon",h=this._getPointCreator(n,this.spatialReference,t),d=new De(null,0),m=new De(null,0),p={x:0,y:0,z:0};for(const f of this.items){const F=i.getGeometry(f);if(F==null)continue;const{coords:_,lengths:w}=F;if(d.coords=_,m.coords=_,e.returnEdge){let I=0;for(let g=0;gf.distance-F.distance),u}_getPointCreator(e,t,i){const s=i==null||b(t,i)?l=>l:l=>M(l,t,i),{hasZ:r}=this,n=0;return e==="3d"?r?({x:l,y:o,z:u})=>s({x:l,y:o,z:u}):({x:l,y:o})=>s({x:l,y:o,z:n}):({x:l,y:o})=>s({x:l,y:o})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,minValue:l,maxValue:o,scale:u,timeZone:c}=e,h=this.fieldsIndex.get(t),d=ve(h)||ce(h)||he(h),m=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,scale:u,timeZone:c}),p=ai({normalizationType:r,normalizationField:s,minValue:l,maxValue:o}),f={value:.5,fieldType:h==null?void 0:h.type},F=se(h)?Ve({values:m,supportsNullCount:p,percentileParams:f}):Pe({values:m,minValue:l,maxValue:o,useSampleStdDev:!r,supportsNullCount:p,percentileParams:f});return ri(F,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:r,scale:n,timeZone:l}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:n,timeZone:l},!1),u=ni(o);return li(u,s,r,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,classificationMethod:l,standardDeviationInterval:o,minValue:u,maxValue:c,numClasses:h,scale:d,timeZone:m}=e,p=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,scale:d,timeZone:m}),f=oi(p,{field:t,normalizationField:s,normalizationType:r,normalizationTotal:n,classificationMethod:l,standardDeviationInterval:o,minValue:u,maxValue:c,numClasses:h});return ui(f,l)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,classificationMethod:l,standardDeviationInterval:o,minValue:u,maxValue:c,numBins:h,scale:d,timeZone:m}=e,p=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:r,normalizationTotal:n,scale:d,timeZone:m});return ci(p,{field:t,normalizationField:s,normalizationType:r,normalizationTotal:n,classificationMethod:l,standardDeviationInterval:o,minValue:u,maxValue:c,numBins:h})}_sortFeatures(e,t,i){if(e.length>1&&(t!=null&&t.length))for(const s of t.reverse()){const r=s.split(" "),n=r[0],l=this.fieldsIndex.get(n),o=!!r[1]&&r[1].toLowerCase()==="desc",u=hi(l==null?void 0:l.type,o);e.sort((c,h)=>{const d=i(c,n,l),m=i(h,n,l);return u(d,m)})}}_createFeatureQueryResponse(e){const t=this.items,{geometryType:i,hasM:s,hasZ:r,objectIdField:n,spatialReference:l}=this,{outFields:o,outSR:u,quantizationParameters:c,resultRecordCount:h,resultOffset:d,returnZ:m,returnM:p}=e,f=h!=null&&t.length>(d||0)+h,F=o&&(o.includes("*")?[...this.fieldsIndex.fields]:o.map(_=>this.fieldsIndex.get(_)));return{exceededTransferLimit:f,features:this._createFeatures(e,t),fields:F,geometryType:i,hasM:s&&p,hasZ:r&&m,objectIdFieldName:n,spatialReference:U(u||l),transform:c&&$e(c)||null}}_createFeatures(e,t){const i=new X(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:r}=this,{orderByFields:n,quantizationParameters:l,returnGeometry:o,returnCentroid:u,maxAllowableOffset:c,resultOffset:h,resultRecordCount:d,returnZ:m=!1,returnM:p=!1}=e,f=r&&m,F=s&&p;let _=[],w=0;const I=[...t];if(this._sortFeatures(I,n,(x,y,S)=>i.getFieldValue(x,y,S)),this.geometryType&&(o||u)){const x=$e(l)??void 0;if(o&&!u)for(const y of I)_[w++]={attributes:i.getAttributes(y),geometry:q(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(y),c,x,f,F)};else if(!o&&u)for(const y of I)_[w++]={attributes:i.getAttributes(y),centroid:Ne(this,this.featureAdapter.getCentroid(y,this),x)};else for(const y of I)_[w++]={attributes:i.getAttributes(y),centroid:Ne(this,this.featureAdapter.getCentroid(y,this),x),geometry:q(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(y),c,x,f,F)}}else for(const x of I){const y=i.getAttributes(x);y&&(_[w++]={attributes:y})}const g=h||0;if(d!=null){const x=g+d;_=_.slice(g,Math.min(_.length,x))}return _}_createExceedsLimitQueryResponse(e){let t=!1,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY;for(const n of e.outStatistics??[])if(n.statisticType==="exceedslimit"){i=n.maxPointCount!=null?n.maxPointCount:Number.POSITIVE_INFINITY,s=n.maxRecordCount!=null?n.maxRecordCount:Number.POSITIVE_INFINITY,r=n.maxVertexCount!=null?n.maxVertexCount:Number.POSITIVE_INFINITY;break}if(this.geometryType==="esriGeometryPoint")t=this.items.length>i;else if(this.items.length>s)t=!0;else{const n=Ge(this.hasZ,this.hasM),l=this.featureAdapter;t=this.items.reduce((o,u)=>{const c=l.getGeometry(u);return o+(c!=null&&c.coords.length||0)},0)/n>r}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(t)}}]}}async _createStatisticsQueryResponse(e){var I;const t={attributes:{}},i=[],s=new Map,r=new Map,n=new Map,l=new Map,o=new X(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:h,orderByFields:d,resultRecordCount:m}=e,p=c==null?void 0:c.length,f=!!p,F=f?c[0]:null,_=f&&!this.fieldsIndex.get(F);for(const g of u??[]){const{outStatisticFieldName:x,statisticType:y}=g,S=g,R=y!=="exceedslimit"?g.onStatisticField:void 0,$=y==="percentile_disc"||y==="percentile_cont",A=y==="EnvelopeAggregate"||y==="CentroidAggregate"||y==="ConvexHullAggregate",J=f&&p===1&&(R===F||_)&&y==="count";if(f){if(!n.has(R)){const W=[];for(const ie of c){const K=this._getAttributeValues(o,ie,s);W.push(K)}n.set(R,this._calculateUniqueValues(W,!A&&o.returnDistinctValues))}const V=n.get(R);if(!V)continue;const te=Object.keys(V);for(const W of te){const{count:ie,data:K,items:Fe,itemPositions:ht}=V[W],Se=K.join(",");if(!h||o.validateItems(Fe,h)){const D=l.get(Se)||{attributes:{}};if(A){D.aggregateGeometries||(D.aggregateGeometries={});const{aggregateGeometries:P,outStatisticFieldName:j}=await this._getAggregateGeometry(S,Fe);D.aggregateGeometries[j]=P}else{let P=null;if(J)P=ie;else{const j=this._getAttributeValues(o,R,s),we=ht.map(ft=>j[ft]);P=$&&"statisticParameters"in S?this._getPercentileValue(S,we):this._getStatisticValue(S,we,null,o.returnDistinctValues)}D.attributes[x]=P}let dt=0;c.forEach((P,j)=>D.attributes[this.fieldsIndex.get(P)?P:"EXPR_"+ ++dt]=K[j]),l.set(Se,D)}}}else if(A){t.aggregateGeometries||(t.aggregateGeometries={});const{aggregateGeometries:V,outStatisticFieldName:te}=await this._getAggregateGeometry(S,this.items);t.aggregateGeometries[te]=V}else{const V=this._getAttributeValues(o,R,s);t.attributes[x]=$&&"statisticParameters"in S?this._getPercentileValue(S,V):this._getStatisticValue(S,V,r,o.returnDistinctValues)}const Y=y!=="min"&&y!=="max"||!se(this.fieldsIndex.get(R))&&!this._isAnyDateField(R)?null:(I=this.fieldsIndex.get(R))==null?void 0:I.type;i.push({name:x,alias:x,type:Y||"esriFieldTypeDouble"})}const w=f?Array.from(l.values()):[t];return this._sortFeatures(w,d,(g,x)=>g.attributes[x]),m&&(w.length=Math.min(m,w.length)),{fields:i,features:w}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return ve(t)||ce(t)||he(t)||ke(t)}async _getAggregateGeometry(e,t){const{convexHull:i,union:s}=await ge(()=>import("./geometryEngineJSON-FxYgI0L3.js").then(f=>f.g),__vite__mapDeps([0,1,2,3])),{statisticType:r,outStatisticFieldName:n}=e,{featureAdapter:l,spatialReference:o,geometryType:u,hasZ:c,hasM:h}=this,d=t.map(f=>q(u,c,h,l.getGeometry(f))),m=i(o,d,!0)[0],p={aggregateGeometries:null,outStatisticFieldName:null};if(r==="EnvelopeAggregate"){const f=m?Tt(m):de(s(o,d));p.aggregateGeometries={...f,spatialReference:o},p.outStatisticFieldName=n||"extent"}else if(r==="CentroidAggregate"){const f=m?vt(m):$t(de(s(o,d)));p.aggregateGeometries={x:f[0],y:f[1],spatialReference:o},p.outStatisticFieldName=n||"centroid"}else r==="ConvexHullAggregate"&&(p.aggregateGeometries=m,p.outStatisticFieldName=n||"convexHull");return p}_getStatisticValue(e,t,i,s){const{onStatisticField:r,statisticType:n}=e;let l=null;return l=i!=null&&i.has(r)?i.get(r):se(this.fieldsIndex.get(r))||this._isAnyDateField(r)?Ve({values:t,returnDistinct:s}):Pe({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(r,l),l[n==="var"?"variance":n]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:r}=e,{value:n,orderBy:l}=s,o=this.fieldsIndex.get(i);return di(t,{value:n,orderBy:l,fieldType:o==null?void 0:o.type,isDiscrete:r==="percentile_disc"})}_getAttributeValues(e,t,i){if(i.has(t))return i.get(t);const s=this.fieldsIndex.get(t),r=this.items.map(n=>e.getFieldValue(n,t,s));return i.set(t,r),r}_calculateUniqueValues(e,t){const i={},s=this.items,r=s.length;for(let n=0;nM(i,be));return(await bi())(n.spatialReference,n,e,r)}async function bi(){return(await ge(()=>import("./geometryEngineJSON-FxYgI0L3.js").then(a=>a.g),__vite__mapDeps([0,1,2,3]))).geodesicBuffer}function Ai(a){return a==="mesh"?Vt:Pt(a)}function lt(a,e){return a?e?4:3:e?3:2}function Ei(a,e,t,i){return ot(a,e,t,i.coords[0],i.coords[1])}function Mi(a,e,t,i,s,r){const n=lt(s,r),{coords:l,lengths:o}=i;if(!o)return!1;for(let u=0,c=0;u=n||p=n)&&h+(n-d)/(p-d)*(m-h)import("./geometryEngineJSON-FxYgI0L3.js").then(a=>a.g),__vite__mapDeps([0,1,2,3]))}function B(a,e,t,i,s){if(H(e)&&t==="esriGeometryPoint"&&(a==="esriSpatialRelIntersects"||a==="esriSpatialRelContains")){const r=Ae(new L,e,!1,!1);return Promise.resolve(n=>Ei(r,!1,!1,n))}if(H(e)&&t==="esriGeometryMultipoint"){const r=Ae(new L,e,!1,!1);if(a==="esriSpatialRelContains")return Promise.resolve(n=>Mi(r,!1,!1,n,i,s))}if(Q(e)&&t==="esriGeometryPoint"&&(a==="esriSpatialRelIntersects"||a==="esriSpatialRelContains"))return Promise.resolve(r=>Ct(e,q(t,i,s,r)));if(Q(e)&&t==="esriGeometryMultipoint"&&a==="esriSpatialRelContains")return Promise.resolve(r=>Nt(e,q(t,i,s,r)));if(Q(e)&&a==="esriSpatialRelIntersects"){const r=Ai(t);return Promise.resolve(n=>r(e,q(t,i,s,n)))}return zi().then(r=>{const n=r[Vi[a]].bind(null,e.spatialReference,e);return l=>n(q(t,i,s,l))})}async function ut(a,e,t){var r;const{spatialRel:i,geometry:s}=a;if(s){if(!Pi(i))throw new T(le,"Unsupported query spatial relationship",{query:a});if(G(s.spatialReference)&&G(t)){if(!Ci(s))throw new T(le,"Unsupported query geometry type",{query:a});if(!Ni(e))throw new T(le,"Unsupported layer geometry type",{query:a});if(a.outSR)return Z((r=a.geometry)==null?void 0:r.spatialReference,a.outSR)}}}function Ze(a){if(Q(a))return!0;if(H(a)){for(const e of a.rings)if(e.length!==5||e[0][0]!==e[1][0]||e[0][0]!==e[4][0]||e[2][0]!==e[3][0]||e[0][1]!==e[3][1]||e[0][1]!==e[4][1]||e[1][1]!==e[2][1])return!1;return!0}return!1}const O="unsupported-query";async function je(a,{fieldsIndex:e,geometryType:t,spatialReference:i,availableFields:s}){if((a.distance??0)<0||a.geometryPrecision!=null||a.multipatchOption&&a.multipatchOption!=="xyFootprint"||a.pixelSize||a.relationParam||a.text)throw new T(O,"Unsupported query options",{query:a});return ct(e,s,a),Gi(e,s,a),Promise.all([ut(a,t,i),Z(i,a.outSR)]).then(()=>a)}function ct(a,e,t){const{outFields:i,orderByFields:s,returnDistinctValues:r,outStatistics:n}=t,l=n?n.map(o=>o.outStatisticFieldName&&o.outStatisticFieldName.toLowerCase()).filter(Boolean):[];if(s&&s.length>0){const o=" asc",u=" desc",c=s.map(h=>{const d=h.toLowerCase();return d.includes(o)?d.split(o)[0]:d.includes(u)?d.split(u)[0]:h}).filter(h=>!l.includes(h));N(a,e,c,{expressionName:"orderByFields",query:t})}if(i&&i.length>0)N(a,e,i,{expressionName:"outFields",query:t});else if(r)throw new T(O,"outFields should be specified for returnDistinctValues",{query:t});gi(a,e,t.where,t)}const Qi=new Set([...Ke,...Xe]);function Gi(a,e,t){const{outStatistics:i,groupByFieldsForStatistics:s,having:r}=t,n=s==null?void 0:s.length,l=i==null?void 0:i.length;if(r){if(!n||!l)throw new T(O,"outStatistics and groupByFieldsForStatistics should be specified with having",{query:t});xi(a,e,r,i,t)}if(l){if(!Zi(i))return;const o=i.map(u=>u.onStatisticField).filter(Boolean);N(a,e,o,{expressionName:"onStatisticFields",query:t}),n&&N(a,e,s,{expressionName:"groupByFieldsForStatistics",query:t});for(const u of i){const{onStatisticField:c,statisticType:h}=u;if((h==="percentile_disc"||h==="percentile_cont")&&"statisticParameters"in u){const{statisticParameters:d}=u;if(!d)throw new T(O,"statisticParameters should be set for percentile type",{definition:u,query:t})}else a.get(c)&&h!=="count"&&h!=="min"&&h!=="max"&&N(a,e,[c],{expressionName:`outStatistics with '${h}' statistic type`,allowedFieldTypes:Qi,query:t})}}}async function Di(a,e,{fieldsIndex:t,geometryType:i,spatialReference:s,availableFields:r}){if((a.distance??0)<0||a.geometryPrecision!=null||a.multipatchOption||a.pixelSize||a.relationParam||a.text||a.outStatistics||a.groupByFieldsForStatistics||a.having||a.orderByFields)throw new T(O,"Unsupported query options",{query:a});return ct(t,r,a),Promise.all([Oi(t,r,e,a),ut(a,i,s),Z(s,a.outSR)]).then(()=>a)}async function Oi(a,e,t,i){let s=[];if(t.valueExpression){const{arcadeUtils:r}=await Le();s=r.extractFieldNames(t.valueExpression)}if(t.field&&s.push(t.field),t.field2&&s.push(t.field2),t.field3&&s.push(t.field3),t.normalizationField&&s.push(t.normalizationField),!s.length&&!t.valueExpression)throw new T(O,"field or valueExpression is required",{params:t});N(a,e,s,{expressionName:"statistics",query:i})}function Zi(a){return a!=null&&a.every(e=>e.statisticType!=="exceedslimit")}async function ji(a,e){if(!a)return null;const t=e.featureAdapter,{startTimeField:i,endTimeField:s}=a;let r=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;if(i&&s)await e.forEach(l=>{const o=t.getAttribute(l,i),u=t.getAttribute(l,s);o==null||isNaN(o)||(r=Math.min(r,o)),u==null||isNaN(u)||(n=Math.max(n,u))});else{const l=i||s;await e.forEach(o=>{const u=t.getAttribute(o,l);u==null||isNaN(u)||(r=Math.min(r,u),n=Math.max(n,u))})}return{start:r,end:n}}function Bi(a,e,t){var o;if(!e||!a)return null;const{startTimeField:i,endTimeField:s}=a;if(!i&&!s)return null;const{start:r,end:n}=e;if(r===null&&n===null)return null;if(r===void 0&&n===void 0)return Li();const l=((o=t.getAttributeAsTimestamp)==null?void 0:o.bind(t))??t.getAttribute.bind(t);return i&&s?Ui(l,i,s,r,n):ki(l,i||s,r,n)}function Ui(a,e,t,i,s){return i!=null&&s!=null?r=>{const n=a(r,e),l=a(r,t);return(n==null||n<=s)&&(l==null||l>=i)}:i!=null?r=>{const n=a(r,t);return n==null||n>=i}:s!=null?r=>{const n=a(r,e);return n==null||n<=s}:void 0}function ki(a,e,t,i){return t!=null&&i!=null&&t===i?s=>a(s,e)===t:t!=null&&i!=null?s=>{const r=a(s,e);return r!=null&&r>=t&&r<=i}:t!=null?s=>{const r=a(s,e);return r!=null&&r>=t}:i!=null?s=>{const r=a(s,e);return r!=null&&r<=i}:void 0}function Li(){return()=>!1}const Hi="unsupported-query",Ji=new Qt(2e6);let Yi=0;class rs{constructor(e){this._geometryQueryCache=null,this._changeHandle=null,this.capabilities={query:ti},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.objectIdField=e.objectIdField,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._changeHandle=this.featureStore.events.on("changed",()=>this.clearCache()),this.timeInfo=e.timeInfo,e.cacheSpatialQueries&&(this._geometryQueryCache=new Gt(Yi+++"$$",Ji)),this.fieldsIndex=Dt(e.fieldsIndex)?e.fieldsIndex:Ot.fromJSON(e.fieldsIndex),this.availableFields=e.availableFields==null?new Set(this.fieldsIndex.fields.map(t=>t.name)):new Set(e.availableFields.map(t=>{var i;return(i=this.fieldsIndex.get(t))==null?void 0:i.name}).filter(t=>t!=null)),e.scheduler&&e.priority&&(this._frameTask=e.scheduler.registerTask(e.priority))}destroy(){this._frameTask=Ee(this._frameTask),this.clearCache(),Zt(this._geometryQueryCache),this._changeHandle=Ee(this._changeHandle)}get featureAdapter(){return this.featureStore.featureAdapter}clearCache(){var e;(e=this._geometryQueryCache)==null||e.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async executeQuery(e,t){try{return(await this._executeQuery(e,{},t)).createQueryResponse()}catch(i){if(i!==C)throw i;return new v([],e,this).createQueryResponse()}}async executeQueryForCount(e={},t){try{return(await this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null},t)).createQueryResponseForCount()}catch(i){if(i!==C)throw i;return 0}}async executeQueryForExtent(e,t){const i=e.outSR;try{const s=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},t),r=s.size;return r?{count:r,extent:await this._getBounds(s.items,s.spatialReference,i||this.spatialReference)}:{count:0,extent:null}}catch(s){if(s===C)return{count:0,extent:null};throw s}}async executeQueryForIds(e,t){return this.executeQueryForIdSet(e,t).then(i=>Array.from(i))}async executeQueryForIdSet(e,t){try{const i=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},t),s=i.items,r=new Set;return await this._reschedule(()=>{for(const n of s)r.add(i.featureAdapter.getObjectId(n))},t),r}catch(i){if(i===C)return new Set;throw i}}async executeQueryForSnapping(e,t){const{point:i,distance:s,returnEdge:r,vertexMode:n}=e;if(!r&&n==="none")return{candidates:[]};let l=ee(e.query);l=await this._schedule(()=>rt(l,this.definitionExpression,this.spatialReference),t),l=await this._reschedule(()=>je(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),t);const o=!b(i.spatialReference,this.spatialReference);o&&await Z(i.spatialReference,this.spatialReference);const u=typeof s=="number"?s:s.x,c=typeof s=="number"?s:s.y,h={xmin:i.x-u,xmax:i.x+u,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},d=o?M(h,this.spatialReference):h;if(!d)return{candidates:[]};const m=(await fe(me(i),null,{signal:t}))[0],p=(await fe(me(d),null,{signal:t}))[0];if(m==null||p==null)return{candidates:[]};const f=new v(await this._reschedule(()=>this._searchFeatures(this._getQueryBBoxes(p.toJSON())),t),l,this);await this._reschedule(()=>this._executeObjectIdsQuery(f),t),await this._reschedule(()=>this._executeTimeQuery(f),t),await this._reschedule(()=>this._executeAttributesQuery(f),t),await this._reschedule(()=>this._executeGeometryQueryForSnapping(f,t),t);const F=m.toJSON(),_=o?M(F,this.spatialReference):F,w=o?Math.max(d.xmax-d.xmin,d.ymax-d.ymin)/2:s;return f.createSnappingResponse({...e,point:_,distance:w},i.spatialReference)}async executeQueryForLatestObservations(e,t){var i;if(!((i=this.timeInfo)!=null&&i.trackIdField))throw new T(Hi,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});try{const s=await this._executeQuery(e,{},t);return await this._reschedule(()=>this._filterLatest(s),t),s.createQueryResponse()}catch(s){if(s!==C)throw s;return new v([],e,this).createQueryResponse()}}async executeQueryForSummaryStatistics(e={},t,i){const{field:s,normalizationField:r,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:s,normalizationField:r,valueExpression:n},i)).createSummaryStatisticsResponse(t)}async executeQueryForUniqueValues(e={},t,i){const{field:s,field2:r,field3:n,valueExpression:l}=t;return(await this._executeQueryForStatistics(e,{field:s,field2:r,field3:n,valueExpression:l},i)).createUniqueValuesResponse(t)}async executeQueryForClassBreaks(e={},t,i){const{field:s,normalizationField:r,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:s,normalizationField:r,valueExpression:n},i)).createClassBreaksResponse(t)}async executeQueryForHistogram(e={},t,i){const{field:s,normalizationField:r,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:s,normalizationField:r,valueExpression:n},i)).createHistogramResponse(t)}async fetchRecomputedExtents(e){this._timeExtentPromise||(this._timeExtentPromise=ji(this.timeInfo,this.featureStore));const[t,i]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return jt(e),{fullExtent:t,timeExtent:i}}async _getBounds(e,t,i){const s=Bt(kt(),Ut);await this.featureStore.forEachBounds(e,l=>Lt(s,l));const r={xmin:s[0],ymin:s[1],xmax:s[3],ymax:s[4],spatialReference:U(this.spatialReference)};this.hasZ&&isFinite(s[2])&&isFinite(s[5])&&(r.zmin=s[2],r.zmax=s[5]);const n=M(r,t,i);if(n.spatialReference=U(i),n.xmax-n.xmin==0){const l=ae(n.spatialReference);n.xmin-=l,n.xmax+=l}if(n.ymax-n.ymin==0){const l=ae(n.spatialReference);n.ymin-=l,n.ymax+=l}if(this.hasZ&&n.zmin!=null&&n.zmax!=null&&n.zmax-n.zmin==0){const l=ae(n.spatialReference);n.zmin-=l,n.zmax+=l}return n}_getFullExtent(){return this._fullExtentPromise||(this._fullExtentPromise="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference))),this._fullExtentPromise}async _schedule(e,t){return this._frameTask!=null?this._frameTask.schedule(e,t):e(Me)}async _reschedule(e,t){return this._frameTask!=null?this._frameTask.reschedule(e,t):e(Me)}async _getAllFeaturesQueryEngineResult(e){return new v(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(this._allFeaturesPromise==null){const i=[];this._allFeaturesPromise=(async()=>{await this.featureStore.forEach(s=>i.push(s))})().then(()=>i)}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async _executeQuery(e,t,i){e=ee(e),e=await this._schedule(()=>Oe(e,this.definitionExpression,this.spatialReference),i),e=await this._reschedule(()=>je(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),i),e={...e,...t};const s=await this._reschedule(()=>this._executeSceneFilterQuery(e,i),i),r=await this._reschedule(()=>this._executeGeometryQuery(e,s,i),i);return await this._reschedule(()=>this._executeAggregateIdsQuery(r),i),await this._reschedule(()=>this._executeObjectIdsQuery(r),i),await this._reschedule(()=>this._executeTimeQuery(r),i),await this._reschedule(()=>this._executeAttributesQuery(r),i),r}async _executeSceneFilterQuery(e,t){if(e.sceneFilter==null)return null;const{outSR:i,returnGeometry:s,returnCentroid:r}=e,n=this.featureStore.featureSpatialReference,l=e.sceneFilter.geometry,o=n==null||b(n,l.spatialReference)?l:M(l,n);if(!o)return null;const u=s||r,c=G(i)&&!b(this.spatialReference,i)&&u?async f=>this._project(f,i):f=>f,h=this.featureAdapter,d=await this._reschedule(()=>this._searchFeatures(this._getQueryBBoxes(o)),t);if(e.sceneFilter.spatialRelationship==="disjoint"){if(!d.length)return null;const f=new Set;for(const w of d)f.add(h.getObjectId(w));const F=await this._reschedule(()=>this._getAllFeatures(),t),_=await this._reschedule(async()=>{const w=await B("esriSpatialRelDisjoint",o,this.geometryType,this.hasZ,this.hasM),I=x=>!f.has(h.getObjectId(x))||w(h.getGeometry(x)),g=await this._runSpatialFilter(F,I,t);return new v(g,e,this)},t);return c(_)}if(!d.length)return new v([],e,this);if(this._canExecuteSinglePass(o,e))return c(new v(d,e,this));const m=await B("esriSpatialRelContains",o,this.geometryType,this.hasZ,this.hasM),p=await this._runSpatialFilter(d,f=>m(h.getGeometry(f)),t);return c(new v(p,e,this))}async _executeGeometryQuery(e,t,i){if(t!=null&&t.items.length===0)return t;e=t!=null?t.query:e;const{geometry:s,outSR:r,spatialRel:n,returnGeometry:l,returnCentroid:o}=e,u=this.featureStore.featureSpatialReference,c=!s||u==null||b(u,s.spatialReference)?s:M(s,u),h=l||o,d=G(r)&&!b(this.spatialReference,r),m=this._geometryQueryCache&&t==null?JSON.stringify(d&&h?{originalFilterGeometry:s,spatialRelationship:n,outSpatialReference:r}:{originalFilterGeometry:s,spatialRelationship:n}):null,p=m?this._geometryQueryCache.get(m):null;if(p!=null)return new v(p,e,this);const f=async g=>(d&&h&&await this._project(g,r),m&&this._geometryQueryCache.put(m,g.items,g.items.length+1),g);if(!c)return f(t??await this._getAllFeaturesQueryEngineResult(e));const F=this.featureAdapter;let _=await this._reschedule(()=>this._searchFeatures(this._getQueryBBoxes(s)),i);if(n==="esriSpatialRelDisjoint"){if(!_.length)return f(t??await this._getAllFeaturesQueryEngineResult(e));const g=new Set;for(const S of _)g.add(F.getObjectId(S));const x=t!=null?t.items:await this._reschedule(()=>this._getAllFeatures(),i),y=await this._reschedule(async()=>{const S=await B(n,c,this.geometryType,this.hasZ,this.hasM),R=A=>!g.has(F.getObjectId(A))||S(F.getGeometry(A)),$=await this._runSpatialFilter(x,R,i);return new v($,e,this)},i);return f(y)}if(t!=null){const g=new Xt;_=_.filter(x=>Ht(t.items,x,t.items.length,g)>=0)}if(!_.length){const g=new v([],e,this);return m&&this._geometryQueryCache.put(m,g.items,1),g}if(this._canExecuteSinglePass(c,e))return f(new v(_,e,this));const w=await B(n,c,this.geometryType,this.hasZ,this.hasM),I=await this._runSpatialFilter(_,g=>w(F.getGeometry(g)),i);return f(new v(I,e,this))}async _executeGeometryQueryForSnapping(e,t){var l;const{query:i}=e,{spatialRel:s}=i;if(!((l=e==null?void 0:e.items)!=null&&l.length)||!i.geometry||!s)return;const r=await B(s,i.geometry,this.geometryType,this.hasZ,this.hasM),n=await this._runSpatialFilter(e.items,o=>r(o.geometry),t);e.items=n}_executeAggregateIdsQuery(e){var s;if(e.items.length===0||!((s=e.query.aggregateIds)!=null&&s.length)||this.aggregateAdapter==null)return;const t=new Set;for(const r of e.query.aggregateIds)this.aggregateAdapter.getFeatureObjectIds(r).forEach(n=>t.add(n));const i=this.featureAdapter.getObjectId;e.items=e.items.filter(r=>t.has(i(r)))}_executeObjectIdsQuery(e){var s;if(e.items.length===0||!((s=e.query.objectIds)!=null&&s.length))return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(r=>t.has(i(r)))}_executeTimeQuery(e){if(e.items.length===0)return;const t=Bi(this.timeInfo,e.query.timeExtent,this.featureAdapter);t!=null&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(e.items.length===0)return;const t=z(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(i=>t.testFeature(i,this.featureAdapter))}}async _runSpatialFilter(e,t,i){if(!t)return e;if(this._frameTask==null)return e.filter(l=>t(l));let s=0;const r=new Array,n=async l=>{for(;sn(u),i)}};return this._reschedule(l=>n(l),i).then(()=>r)}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:s}=this.timeInfo,r=s||i,n=new Map,l=this.featureAdapter.getAttribute;for(const o of e.items){const u=l(o,t),c=l(o,r),h=n.get(u);(!h||c>l(h,r))&&n.set(u,o)}e.items=Array.from(n.values())}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return Ze(e)&&(i==="esriSpatialRelEnvelopeIntersects"||this.geometryType==="esriGeometryPoint"&&(i==="esriSpatialRelIntersects"||i==="esriSpatialRelContains"))}async _project(e,t){if(!t||b(this.spatialReference,t))return e;const i=this.featureAdapter;let s;try{const n=await this._getFullExtent();s=Jt(this.spatialReference,t,n)}catch{}const r=await Ri(e.items.map(n=>q(this.geometryType,this.hasZ,this.hasM,i.getGeometry(n))),this.spatialReference,t,s);return e.items=r.map((n,l)=>i.cloneWithGeometry(e.items[l],Yt(n,this.hasZ,this.hasM))),e}_getQueryBBoxes(e){if(Ze(e)){if(Q(e))return[qe(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(H(e))return e.rings.map(t=>qe(Math.min(t[0][0],t[2][0]),Math.min(t[0][1],t[2][1]),Math.max(t[0][0],t[2][0]),Math.max(t[0][1],t[2][1])))}return[Wt(Kt(),e)]}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(s=>this.featureStore.forEachInBounds(s,r=>t.add(r))));const i=Array.from(t.values());return t.clear(),i}async _executeQueryForStatistics(e,t,i){e=ee(e);try{e=await this._schedule(()=>Oe(e,this.definitionExpression,this.spatialReference),i),e=await this._reschedule(()=>Di(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),i);const s=await this._reschedule(()=>this._executeSceneFilterQuery(e,i),i),r=await this._reschedule(()=>this._executeGeometryQuery(e,s,i),i);return await this._reschedule(()=>this._executeAggregateIdsQuery(r),i),await this._reschedule(()=>this._executeObjectIdsQuery(r),i),await this._reschedule(()=>this._executeTimeQuery(r),i),await this._reschedule(()=>this._executeAttributesQuery(r),i),r}catch(s){if(s!==C)throw s;return new v([],e,this)}}}export{rs as W,rt as a,U as h,M as j,Bi as t,B as v,Z as x}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/geometryEngineJSON-FxYgI0L3.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/json-v6EOeNTY.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/QueryEngine-uvDs-vBe.js b/dist/assets/QueryEngine-uvDs-vBe.js new file mode 100644 index 0000000..f637c01 --- /dev/null +++ b/dist/assets/QueryEngine-uvDs-vBe.js @@ -0,0 +1,7 @@ +import{r0 as mt,r1 as oe,r2 as pt,eV as L,r3 as ue,r4 as yt,r5 as gt,r6 as xt,gr as Re,r as T,eK as Ie,k8 as _t,r7 as Ft,bt as b,ag as St,r8 as Be,ez as ye,k9 as Ue,dY as wt,f8 as Rt,gh as G,r9 as ce,ra as he,cX as ke,cZ as Le,rb as It,rc as Te,gf as ve,ge as se,rd as $e,de as ge,re as Tt,rf as de,rg as vt,rh as $t,ah as ee,dp as bt,am as fe,fZ as me,eD as q,eE as H,eF as At,cj as Et,mP as Mt,ri as Pt,eQ as be,rj as Vt,rk as Ct,rl as Ae,rm as Qt,rn as zt,g8 as Nt,ro as qt,rp as Gt,ey as Dt,eL as Ot,bq as Ee,b as Zt,ab as jt,rq as Bt,ld as Ut,ea as kt,lf as Lt,dX as re,rr as Me,aP as Ht,e3 as Jt,eP as Yt,mQ as Pe,eG as Wt,cf as Kt,aQ as Xt}from"./index-pCX-0tJH.js";import{x as ei}from"./WhereClause-FOYoIAAW.js";import{t as He}from"./json-v6EOeNTY.js";import{t as ti}from"./QueryEngineCapabilities-PzVpW5yD.js";import{c as ae,w as ii,B as si,f as ri,d as Ve,p as Ce,C as ai,k as ni,$ as li,E as oi,P as ui,U as ci,T as hi,v as di}from"./utils-jVYIoPxv.js";const Qe=new L,fi=new L,pe=new L,E={esriGeometryPoint:ue,esriGeometryPolyline:yt,esriGeometryPolygon:gt,esriGeometryMultipoint:xt};function ze(r,e,t,i=r.hasZ,s=r.hasM){if(e==null)return null;const a=r.hasZ&&i,n=r.hasM&&s;if(t){const l=oe(pe,e,r.hasZ,r.hasM,"esriGeometryPoint",t,i,s);return ue(l,a,n)}return ue(e,a,n)}function P(r,e,t,i,s,a,n=e,l=t){var h,d,m;const o=e&&n,u=t&&l,c=i!=null?"coords"in i?i:i.geometry:null;if(c==null)return null;if(s){let p=mt(fi,c,e,t,r,s,n,l);return a&&(p=oe(pe,p,o,u,r,a)),((h=E[r])==null?void 0:h.call(E,p,o,u))??null}if(a){const p=oe(pe,c,e,t,r,a,n,l);return((d=E[r])==null?void 0:d.call(E,p,o,u))??null}return pt(Qe,c,e,t,n,l),((m=E[r])==null?void 0:m.call(E,Qe,o,u))??null}function U(r){return r&&Je in r?JSON.parse(JSON.stringify(r,mi)):r}const Je="_geVersion",mi=(r,e)=>r!==Je?e:void 0;let pi=class{constructor(e,t){this._cache=new Re(e),this._invalidCache=new Re(t)}get(e,t){const i=`${t.uid}:${e}`,s=this._cache.get(i);if(s)return s;if(this._invalidCache.get(i)!=null)return null;try{const a=ei.create(e,t);return this._cache.put(i,a),a}catch(a){return this._invalidCache.put(i,a),null}}getError(e,t){const i=`${t.uid}:${e}`;return this._invalidCache.get(i)??null}};const Ye=new pi(50,500),k="unsupported-query",We=" as ",Ke=new Set(["esriFieldTypeOID","esriFieldTypeSmallInteger","esriFieldTypeBigInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong"]),Xe=new Set(["esriFieldTypeDate","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]),yi=new Set(["esriFieldTypeString","esriFieldTypeGUID","esriFieldTypeGlobalID",...Ke,...Xe]);function xe(r,e,t={}){const i=N(e,r);if(!i){const a=Ye.getError(e,r);throw new T(k,"invalid SQL expression",{expression:e,error:a})}const s=t.expressionName||"expression";if(t.validateStandardized&&!i.isStandardized)throw new T(k,`${s} is not standard`,{expression:e});if(t.validateAggregate&&!i.isAggregate)throw new T(k,`${s} does not contain a valid aggregate function`,{expression:e});return i.fieldNames}function gi(r,e,t,i){if(!t)return!0;const s="where clause";return z(r,e,xe(r,t,{validateStandardized:!0,expressionName:s}),{expressionName:s,query:i}),!0}function xi(r,e,t,i,s){if(!t)return!0;const a="having clause",n=xe(r,t,{validateAggregate:!0,expressionName:a});z(r,e,n,{expressionName:a,query:s});const l=N(t,r);if(!(l==null?void 0:l.getExpressions().every(u=>{var m;const{aggregateType:c,field:h}=u,d=(m=r.get(h))==null?void 0:m.name;return i.some(p=>{var w;const{onStatisticField:f,statisticType:F}=p;return((w=r.get(f))==null?void 0:w.name)===d&&F.toLowerCase().trim()===c})})))throw new T(k,"expressions in having clause should also exist in outStatistics",{having:t});return!0}function N(r,e){return r?Ye.get(r,e):null}function et(r){return/\((.*?)\)/.test(r)?r:r.split(We)[0]}function _i(r){return r.split(We)[1]}function z(r,e,t,i={}){const s=new Map;if(Fi(s,r,e,i.allowedFieldTypes??yi,t),s.size){const a=i.expressionName??"expression";throw new T(k,`${a} contains invalid or missing fields`,{errors:Array.from(s.values()),query:i.query})}}function Fi(r,e,t,i,s){for(const a of s)if(a!=="*")if(e.get(a))Ne(r,e,t,i,a);else try{const n=xe(e,et(a),{validateStandardized:!0});for(const l of n)Ne(r,e,t,i,l)}catch(n){r.set(a,{type:"expression-error",expression:a,error:n})}}function Ne(r,e,t,i,s){if(s==="*")return;const a=e.get(s);a?t.has(a.name)?(i==null?void 0:i.has(a.type))===!1&&r.set(s,{type:"invalid-type",fieldName:a.name,fieldType:Ie.fromJSON(a.type),allowedFieldTypes:Array.from(i,n=>Ie.fromJSON(n))}):r.set(s,{type:"missing-field",fieldName:a.name}):r.set(s,{type:"invalid-field",fieldName:s})}const ne=[0,0];function tt(r,e){if(!e)return null;if("x"in e){const t={x:0,y:0};return[t.x,t.y]=r(e.x,e.y,ne),e.z!=null&&(t.z=e.z),e.m!=null&&(t.m=e.m),t}if("xmin"in e){const t={xmin:0,ymin:0,xmax:0,ymax:0};return[t.xmin,t.ymin]=r(e.xmin,e.ymin,ne),[t.xmax,t.ymax]=r(e.xmax,e.ymax,ne),e.hasZ&&(t.zmin=e.zmin,t.zmax=e.zmax,t.hasZ=!0),e.hasM&&(t.mmin=e.mmin,t.mmax=e.mmax,t.hasM=!0),t}return"rings"in e?{rings:qe(e.rings,r),hasM:e.hasM,hasZ:e.hasZ}:"paths"in e?{paths:qe(e.paths,r),hasM:e.hasM,hasZ:e.hasZ}:"points"in e?{points:it(e.points,r),hasM:e.hasM,hasZ:e.hasZ}:null}function qe(r,e){const t=[];for(const i of r)t.push(it(i,e));return t}function it(r,e){const t=[];for(const i of r){const s=e(i[0],i[1],[0,0]);t.push(s),i.length>2&&s.push(i[2]),i.length>3&&s.push(i[3])}return t}async function Z(r,e){if(!r||!e)return;const t=Array.isArray(r)?r.map(i=>i.geometry!=null?i.geometry.spatialReference:null).filter(wt):[r];await Rt(t.map(i=>({source:i,dest:e})))}const st=tt.bind(null,_t),rt=tt.bind(null,Ft);function M(r,e,t,i){if(!r||(t||(t=e,e=r.spatialReference),!G(e)||!G(t)||b(e,t)))return r;if(Be(e,t)){const s=ye(t)?st(r):rt(r);return s.spatialReference=t,s}return Ue(He,[r],e,t,null,i)[0]}class Si{constructor(){this._jobs=[],this._timer=null,this._process=this._process.bind(this)}async push(e,t,i,s){if(!(e!=null&&e.length)||!t||!i||b(t,i))return e;const a={geometries:e,inSpatialReference:t,outSpatialReference:i,geographicTransformation:s,resolve:St()};return this._jobs.push(a),this._timer??(this._timer=setTimeout(this._process,10)),a.resolve.promise}_process(){this._timer=null;const e=this._jobs.shift();if(!e)return;const{geometries:t,inSpatialReference:i,outSpatialReference:s,resolve:a,geographicTransformation:n}=e;Be(i,s)?ye(s)?a(t.map(st)):a(t.map(rt)):a(Ue(He,t,i,s,n,null)),this._jobs.length>0&&(this._timer=setTimeout(this._process,10))}}const wi=new Si;function Ri(r,e,t,i){return wi.push(r,e,t,i)}let X=class{constructor(e,t,i){this._fieldDataCache=new Map,this._returnDistinctMap=new Map,this.returnDistinctValues=e.returnDistinctValues??!1,this.fieldsIndex=i,this.featureAdapter=t;const s=e.outFields;if(s&&!s.includes("*")){this.outFields=s;let a=0;for(const n of s){const l=et(n),o=this.fieldsIndex.get(l),u=o?null:N(l,i),c=o?o.name:_i(n)||"FIELD_EXP_"+a++;this._fieldDataCache.set(n,{alias:c,clause:u})}}}countDistinctValues(e){return this.returnDistinctValues?(e.forEach(t=>this.getAttributes(t)),this._returnDistinctMap.size):e.length}getAttributes(e){const t=this._processAttributesForOutFields(e);return this._processAttributesForDistinctValues(t)}getFieldValue(e,t,i){var n;const s=i?i.name:t;let a=null;return this._fieldDataCache.has(s)?a=(n=this._fieldDataCache.get(s))==null?void 0:n.clause:i||(a=N(t,this.fieldsIndex),this._fieldDataCache.set(s,{alias:s,clause:a})),i?this.featureAdapter.getAttribute(e,s):a==null?void 0:a.calculateValue(e,this.featureAdapter)}getDataValues(e,t,i=!0){const s=t.normalizationType,a=t.normalizationTotal,n=this.fieldsIndex.get(t.field),l=ce(n)||he(n),o=ke(n);return e.map(u=>{let c=t.field&&this.getFieldValue(u,t.field,this.fieldsIndex.get(t.field));if(t.field2?(c=`${ae(c)}${t.fieldDelimiter}${ae(this.getFieldValue(u,t.field2,this.fieldsIndex.get(t.field2)))}`,t.field3&&(c=`${c}${t.fieldDelimiter}${ae(this.getFieldValue(u,t.field3,this.fieldsIndex.get(t.field3)))}`)):typeof c=="string"&&i&&(l?c=c?new Date(c).getTime():null:o&&(c=c?ii(c):null)),s&&Number.isFinite(c)){const h=s==="field"&&t.normalizationField?this.getFieldValue(u,t.normalizationField,this.fieldsIndex.get(t.normalizationField)):null;c=si(c,s,h,a)}return c})}async getExpressionValues(e,t,i,s,a){const{arcadeUtils:n}=await Le(),l=n.hasGeometryOperations(t);l&&await n.enableGeometryOperations();const o=n.createFunction(t),u=n.getViewInfo(i),c={fields:this.fieldsIndex.fields};return e.map(h=>{const d={attributes:this.featureAdapter.getAttributes(h),layer:c,geometry:l?{...P(s.geometryType,s.hasZ,s.hasM,this.featureAdapter.getGeometry(h)),spatialReference:i==null?void 0:i.spatialReference}:null},m=n.createExecContext(d,u,a);return n.executeFunction(o,m)})}validateItem(e,t){var i,s;return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:N(t,this.fieldsIndex)}),((s=(i=this._fieldDataCache.get(t))==null?void 0:i.clause)==null?void 0:s.testFeature(e,this.featureAdapter))??!1}validateItems(e,t){var i,s;return this._fieldDataCache.has(t)||this._fieldDataCache.set(t,{alias:t,clause:N(t,this.fieldsIndex)}),((s=(i=this._fieldDataCache.get(t))==null?void 0:i.clause)==null?void 0:s.testSet(e,this.featureAdapter))??!1}_processAttributesForOutFields(e){const t=this.outFields;if(!(t!=null&&t.length))return this.featureAdapter.getAttributes(e);const i={};for(const s of t){const{alias:a,clause:n}=this._fieldDataCache.get(s);i[a]=n?n.calculateValue(e,this.featureAdapter):this.featureAdapter.getAttribute(e,a)}return i}_processAttributesForDistinctValues(e){if(e==null||!this.returnDistinctValues)return e;const t=this.outFields,i=[];if(t)for(const n of t){const{alias:l}=this._fieldDataCache.get(n);i.push(e[l])}else for(const n in e)i.push(e[n]);const s=`${(t||["*"]).join(",")}=${i.join(",")}`;let a=this._returnDistinctMap.get(s)||0;return this._returnDistinctMap.set(s,++a),a>1?null:e}};class v{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasM=i.hasM,this.hasZ=i.hasZ,this.fieldsIndex=i.fieldsIndex,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new X(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query;if(!(t==null?void 0:t.length))return 1;const n=new Map,l=new Map,o=new Set;for(const u of s){const{statisticType:c}=u,h=c!=="exceedslimit"?u.onStatisticField:void 0;if(!l.has(h)){const m=[];for(const p of t){const f=this._getAttributeValues(e,p,n);m.push(f)}l.set(h,this._calculateUniqueValues(m,e.returnDistinctValues))}const d=l.get(h);for(const m in d){const{data:p,items:f}=d[m],F=p.join(",");i&&!e.validateItems(f,i)||o.add(F)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics?e=this.query.outStatistics.some(t=>t.statisticType==="exceedslimit")?this._createExceedsLimitQueryResponse(this.query):await this._createStatisticsQueryResponse(this.query):e=this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){const t=this.query.geometry;G(this.query.outSR)&&!b(t.spatialReference,this.query.outSR)?e.queryGeometry=U({spatialReference:this.query.outSR,...M(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=U({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t){const i=this.featureAdapter,s=Ge(this.hasZ,this.hasM),{point:a,mode:n}=e,l=typeof e.distance=="number"?e.distance:e.distance.x,o=typeof e.distance=="number"?e.distance:e.distance.y,u={candidates:[]},c=this.geometryType==="esriGeometryPolygon",h=this._getPointCreator(n,this.spatialReference,t),d=new De(null,0),m=new De(null,0),p={x:0,y:0,z:0};for(const f of this.items){const F=i.getGeometry(f);if(F==null)continue;const{coords:_,lengths:w}=F;if(d.coords=_,m.coords=_,e.returnEdge){let I=0;for(let g=0;gf.distance-F.distance),u}_getPointCreator(e,t,i){const s=i==null||b(t,i)?l=>l:l=>M(l,t,i),{hasZ:a}=this,n=0;return e==="3d"?a?({x:l,y:o,z:u})=>s({x:l,y:o,z:u}):({x:l,y:o})=>s({x:l,y:o,z:n}):({x:l,y:o})=>s({x:l,y:o})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:n,minValue:l,maxValue:o,scale:u,timeZone:c}=e,h=this.fieldsIndex.get(t),d=ve(h)||ce(h)||he(h),m=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:n,scale:u,timeZone:c}),p=ri({normalizationType:a,normalizationField:s,minValue:l,maxValue:o}),f={value:.5,fieldType:h==null?void 0:h.type},F=se(h)?Ve({values:m,supportsNullCount:p,percentileParams:f}):Ce({values:m,minValue:l,maxValue:o,useSampleStdDev:!a,supportsNullCount:p,percentileParams:f});return ai(F,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:n,timeZone:l}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:n,timeZone:l},!1),u=ni(o);return li(u,s,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:n,classificationMethod:l,standardDeviationInterval:o,minValue:u,maxValue:c,numClasses:h,scale:d,timeZone:m}=e,p=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:n,scale:d,timeZone:m}),f=oi(p,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:n,classificationMethod:l,standardDeviationInterval:o,minValue:u,maxValue:c,numClasses:h});return ui(f,l)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:n,classificationMethod:l,standardDeviationInterval:o,minValue:u,maxValue:c,numBins:h,scale:d,timeZone:m}=e,p=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:n,scale:d,timeZone:m});return ci(p,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:n,classificationMethod:l,standardDeviationInterval:o,minValue:u,maxValue:c,numBins:h})}_sortFeatures(e,t,i){if(e.length>1&&(t!=null&&t.length))for(const s of t.reverse()){const a=s.split(" "),n=a[0],l=this.fieldsIndex.get(n),o=!!a[1]&&a[1].toLowerCase()==="desc",u=hi(l==null?void 0:l.type,o);e.sort((c,h)=>{const d=i(c,n,l),m=i(h,n,l);return u(d,m)})}}_createFeatureQueryResponse(e){const t=this.items,{geometryType:i,hasM:s,hasZ:a,objectIdField:n,spatialReference:l}=this,{outFields:o,outSR:u,quantizationParameters:c,resultRecordCount:h,resultOffset:d,returnZ:m,returnM:p}=e,f=h!=null&&t.length>(d||0)+h,F=o&&(o.includes("*")?[...this.fieldsIndex.fields]:o.map(_=>this.fieldsIndex.get(_)));return{exceededTransferLimit:f,features:this._createFeatures(e,t),fields:F,geometryType:i,hasM:s&&p,hasZ:a&&m,objectIdFieldName:n,spatialReference:U(u||l),transform:c&&$e(c)||null}}_createFeatures(e,t){const i=new X(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:n,quantizationParameters:l,returnGeometry:o,returnCentroid:u,maxAllowableOffset:c,resultOffset:h,resultRecordCount:d,returnZ:m=!1,returnM:p=!1}=e,f=a&&m,F=s&&p;let _=[],w=0;const I=[...t];if(this._sortFeatures(I,n,(x,y,S)=>i.getFieldValue(x,y,S)),this.geometryType&&(o||u)){const x=$e(l)??void 0;if(o&&!u)for(const y of I)_[w++]={attributes:i.getAttributes(y),geometry:P(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(y),c,x,f,F)};else if(!o&&u)for(const y of I)_[w++]={attributes:i.getAttributes(y),centroid:ze(this,this.featureAdapter.getCentroid(y,this),x)};else for(const y of I)_[w++]={attributes:i.getAttributes(y),centroid:ze(this,this.featureAdapter.getCentroid(y,this),x),geometry:P(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(y),c,x,f,F)}}else for(const x of I){const y=i.getAttributes(x);y&&(_[w++]={attributes:y})}const g=h||0;if(d!=null){const x=g+d;_=_.slice(g,Math.min(_.length,x))}return _}_createExceedsLimitQueryResponse(e){let t=!1,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY;for(const n of e.outStatistics??[])if(n.statisticType==="exceedslimit"){i=n.maxPointCount!=null?n.maxPointCount:Number.POSITIVE_INFINITY,s=n.maxRecordCount!=null?n.maxRecordCount:Number.POSITIVE_INFINITY,a=n.maxVertexCount!=null?n.maxVertexCount:Number.POSITIVE_INFINITY;break}if(this.geometryType==="esriGeometryPoint")t=this.items.length>i;else if(this.items.length>s)t=!0;else{const n=Ge(this.hasZ,this.hasM),l=this.featureAdapter;t=this.items.reduce((o,u)=>{const c=l.getGeometry(u);return o+(c!=null&&c.coords.length||0)},0)/n>a}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(t)}}]}}async _createStatisticsQueryResponse(e){var I;const t={attributes:{}},i=[],s=new Map,a=new Map,n=new Map,l=new Map,o=new X(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:h,orderByFields:d,resultRecordCount:m}=e,p=c==null?void 0:c.length,f=!!p,F=f?c[0]:null,_=f&&!this.fieldsIndex.get(F);for(const g of u??[]){const{outStatisticFieldName:x,statisticType:y}=g,S=g,R=y!=="exceedslimit"?g.onStatisticField:void 0,$=y==="percentile_disc"||y==="percentile_cont",A=y==="EnvelopeAggregate"||y==="CentroidAggregate"||y==="ConvexHullAggregate",J=f&&p===1&&(R===F||_)&&y==="count";if(f){if(!n.has(R)){const W=[];for(const ie of c){const K=this._getAttributeValues(o,ie,s);W.push(K)}n.set(R,this._calculateUniqueValues(W,!A&&o.returnDistinctValues))}const V=n.get(R);if(!V)continue;const te=Object.keys(V);for(const W of te){const{count:ie,data:K,items:Fe,itemPositions:ht}=V[W],Se=K.join(",");if(!h||o.validateItems(Fe,h)){const D=l.get(Se)||{attributes:{}};if(A){D.aggregateGeometries||(D.aggregateGeometries={});const{aggregateGeometries:C,outStatisticFieldName:j}=await this._getAggregateGeometry(S,Fe);D.aggregateGeometries[j]=C}else{let C=null;if(J)C=ie;else{const j=this._getAttributeValues(o,R,s),we=ht.map(ft=>j[ft]);C=$&&"statisticParameters"in S?this._getPercentileValue(S,we):this._getStatisticValue(S,we,null,o.returnDistinctValues)}D.attributes[x]=C}let dt=0;c.forEach((C,j)=>D.attributes[this.fieldsIndex.get(C)?C:"EXPR_"+ ++dt]=K[j]),l.set(Se,D)}}}else if(A){t.aggregateGeometries||(t.aggregateGeometries={});const{aggregateGeometries:V,outStatisticFieldName:te}=await this._getAggregateGeometry(S,this.items);t.aggregateGeometries[te]=V}else{const V=this._getAttributeValues(o,R,s);t.attributes[x]=$&&"statisticParameters"in S?this._getPercentileValue(S,V):this._getStatisticValue(S,V,a,o.returnDistinctValues)}const Y=y!=="min"&&y!=="max"||!se(this.fieldsIndex.get(R))&&!this._isAnyDateField(R)?null:(I=this.fieldsIndex.get(R))==null?void 0:I.type;i.push({name:x,alias:x,type:Y||"esriFieldTypeDouble"})}const w=f?Array.from(l.values()):[t];return this._sortFeatures(w,d,(g,x)=>g.attributes[x]),m&&(w.length=Math.min(m,w.length)),{fields:i,features:w}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return ve(t)||ce(t)||he(t)||ke(t)}async _getAggregateGeometry(e,t){const{convexHull:i,union:s}=await ge(()=>import("./geometryEngineJSON-0_tJeUzi.js").then(f=>f.g),__vite__mapDeps([0,1,2,3])),{statisticType:a,outStatisticFieldName:n}=e,{featureAdapter:l,spatialReference:o,geometryType:u,hasZ:c,hasM:h}=this,d=t.map(f=>P(u,c,h,l.getGeometry(f))),m=i(o,d,!0)[0],p={aggregateGeometries:null,outStatisticFieldName:null};if(a==="EnvelopeAggregate"){const f=m?Tt(m):de(s(o,d));p.aggregateGeometries={...f,spatialReference:o},p.outStatisticFieldName=n||"extent"}else if(a==="CentroidAggregate"){const f=m?vt(m):$t(de(s(o,d)));p.aggregateGeometries={x:f[0],y:f[1],spatialReference:o},p.outStatisticFieldName=n||"centroid"}else a==="ConvexHullAggregate"&&(p.aggregateGeometries=m,p.outStatisticFieldName=n||"convexHull");return p}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:n}=e;let l=null;return l=i!=null&&i.has(a)?i.get(a):se(this.fieldsIndex.get(a))||this._isAnyDateField(a)?Ve({values:t,returnDistinct:s}):Ce({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,l),l[n==="var"?"variance":n]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:n,orderBy:l}=s,o=this.fieldsIndex.get(i);return di(t,{value:n,orderBy:l,fieldType:o==null?void 0:o.type,isDiscrete:a==="percentile_disc"})}_getAttributeValues(e,t,i){if(i.has(t))return i.get(t);const s=this.fieldsIndex.get(t),a=this.items.map(n=>e.getFieldValue(n,t,s));return i.set(t,a),a}_calculateUniqueValues(e,t){const i={},s=this.items,a=s.length;for(let n=0;nM(i,be));return(await bi())(n.spatialReference,n,e,a)}async function bi(){return(await ge(()=>import("./geometryEngineJSON-0_tJeUzi.js").then(r=>r.g),__vite__mapDeps([0,1,2,3]))).geodesicBuffer}function Ai(r){return r==="mesh"?Vt:Ct(r)}function lt(r,e){return r?e?4:3:e?3:2}function Ei(r,e,t,i){return ot(r,e,t,i.coords[0],i.coords[1])}function Mi(r,e,t,i,s,a){const n=lt(s,a),{coords:l,lengths:o}=i;if(!o)return!1;for(let u=0,c=0;u=n||p=n)&&h+(n-d)/(p-d)*(m-h)import("./geometryEngineJSON-0_tJeUzi.js").then(r=>r.g),__vite__mapDeps([0,1,2,3]))}function B(r,e,t,i,s){if(H(e)&&t==="esriGeometryPoint"&&(r==="esriSpatialRelIntersects"||r==="esriSpatialRelContains")){const a=Ae(new L,e,!1,!1);return Promise.resolve(n=>Ei(a,!1,!1,n))}if(H(e)&&t==="esriGeometryMultipoint"){const a=Ae(new L,e,!1,!1);if(r==="esriSpatialRelContains")return Promise.resolve(n=>Mi(a,!1,!1,n,i,s))}if(q(e)&&t==="esriGeometryPoint"&&(r==="esriSpatialRelIntersects"||r==="esriSpatialRelContains"))return Promise.resolve(a=>Qt(e,P(t,i,s,a)));if(q(e)&&t==="esriGeometryMultipoint"&&r==="esriSpatialRelContains")return Promise.resolve(a=>zt(e,P(t,i,s,a)));if(q(e)&&r==="esriSpatialRelIntersects"){const a=Ai(t);return Promise.resolve(n=>a(e,P(t,i,s,n)))}return Ni().then(a=>{const n=a[Vi[r]].bind(null,e.spatialReference,e);return l=>n(P(t,i,s,l))})}async function ut(r,e,t){var a;const{spatialRel:i,geometry:s}=r;if(s){if(!Ci(i))throw new T(le,"Unsupported query spatial relationship",{query:r});if(G(s.spatialReference)&&G(t)){if(!Qi(s))throw new T(le,"Unsupported query geometry type",{query:r});if(!zi(e))throw new T(le,"Unsupported layer geometry type",{query:r});if(r.outSR)return Z((a=r.geometry)==null?void 0:a.spatialReference,r.outSR)}}}function Ze(r){if(q(r))return!0;if(H(r)){for(const e of r.rings)if(e.length!==5||e[0][0]!==e[1][0]||e[0][0]!==e[4][0]||e[2][0]!==e[3][0]||e[0][1]!==e[3][1]||e[0][1]!==e[4][1]||e[1][1]!==e[2][1])return!1;return!0}return!1}const O="unsupported-query";async function je(r,{fieldsIndex:e,geometryType:t,spatialReference:i,availableFields:s}){if((r.distance??0)<0||r.geometryPrecision!=null||r.multipatchOption&&r.multipatchOption!=="xyFootprint"||r.pixelSize||r.relationParam||r.text)throw new T(O,"Unsupported query options",{query:r});return ct(e,s,r),Gi(e,s,r),Promise.all([ut(r,t,i),Z(i,r.outSR)]).then(()=>r)}function ct(r,e,t){const{outFields:i,orderByFields:s,returnDistinctValues:a,outStatistics:n}=t,l=n?n.map(o=>o.outStatisticFieldName&&o.outStatisticFieldName.toLowerCase()).filter(Boolean):[];if(s&&s.length>0){const o=" asc",u=" desc",c=s.map(h=>{const d=h.toLowerCase();return d.includes(o)?d.split(o)[0]:d.includes(u)?d.split(u)[0]:h}).filter(h=>!l.includes(h));z(r,e,c,{expressionName:"orderByFields",query:t})}if(i&&i.length>0)z(r,e,i,{expressionName:"outFields",query:t});else if(a)throw new T(O,"outFields should be specified for returnDistinctValues",{query:t});gi(r,e,t.where,t)}const qi=new Set([...Ke,...Xe]);function Gi(r,e,t){const{outStatistics:i,groupByFieldsForStatistics:s,having:a}=t,n=s==null?void 0:s.length,l=i==null?void 0:i.length;if(a){if(!n||!l)throw new T(O,"outStatistics and groupByFieldsForStatistics should be specified with having",{query:t});xi(r,e,a,i,t)}if(l){if(!Zi(i))return;const o=i.map(u=>u.onStatisticField).filter(Boolean);z(r,e,o,{expressionName:"onStatisticFields",query:t}),n&&z(r,e,s,{expressionName:"groupByFieldsForStatistics",query:t});for(const u of i){const{onStatisticField:c,statisticType:h}=u;if((h==="percentile_disc"||h==="percentile_cont")&&"statisticParameters"in u){const{statisticParameters:d}=u;if(!d)throw new T(O,"statisticParameters should be set for percentile type",{definition:u,query:t})}else r.get(c)&&h!=="count"&&h!=="min"&&h!=="max"&&z(r,e,[c],{expressionName:`outStatistics with '${h}' statistic type`,allowedFieldTypes:qi,query:t})}}}async function Di(r,e,{fieldsIndex:t,geometryType:i,spatialReference:s,availableFields:a}){if((r.distance??0)<0||r.geometryPrecision!=null||r.multipatchOption||r.pixelSize||r.relationParam||r.text||r.outStatistics||r.groupByFieldsForStatistics||r.having||r.orderByFields)throw new T(O,"Unsupported query options",{query:r});return ct(t,a,r),Promise.all([Oi(t,a,e,r),ut(r,i,s),Z(s,r.outSR)]).then(()=>r)}async function Oi(r,e,t,i){let s=[];if(t.valueExpression){const{arcadeUtils:a}=await Le();s=a.extractFieldNames(t.valueExpression)}if(t.field&&s.push(t.field),t.field2&&s.push(t.field2),t.field3&&s.push(t.field3),t.normalizationField&&s.push(t.normalizationField),!s.length&&!t.valueExpression)throw new T(O,"field or valueExpression is required",{params:t});z(r,e,s,{expressionName:"statistics",query:i})}function Zi(r){return r!=null&&r.every(e=>e.statisticType!=="exceedslimit")}async function ji(r,e){if(!r)return null;const t=e.featureAdapter,{startTimeField:i,endTimeField:s}=r;let a=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;if(i&&s)await e.forEach(l=>{const o=t.getAttribute(l,i),u=t.getAttribute(l,s);o==null||isNaN(o)||(a=Math.min(a,o)),u==null||isNaN(u)||(n=Math.max(n,u))});else{const l=i||s;await e.forEach(o=>{const u=t.getAttribute(o,l);u==null||isNaN(u)||(a=Math.min(a,u),n=Math.max(n,u))})}return{start:a,end:n}}function Bi(r,e,t){var o;if(!e||!r)return null;const{startTimeField:i,endTimeField:s}=r;if(!i&&!s)return null;const{start:a,end:n}=e;if(a===null&&n===null)return null;if(a===void 0&&n===void 0)return Li();const l=((o=t.getAttributeAsTimestamp)==null?void 0:o.bind(t))??t.getAttribute.bind(t);return i&&s?Ui(l,i,s,a,n):ki(l,i||s,a,n)}function Ui(r,e,t,i,s){return i!=null&&s!=null?a=>{const n=r(a,e),l=r(a,t);return(n==null||n<=s)&&(l==null||l>=i)}:i!=null?a=>{const n=r(a,t);return n==null||n>=i}:s!=null?a=>{const n=r(a,e);return n==null||n<=s}:void 0}function ki(r,e,t,i){return t!=null&&i!=null&&t===i?s=>r(s,e)===t:t!=null&&i!=null?s=>{const a=r(s,e);return a!=null&&a>=t&&a<=i}:t!=null?s=>{const a=r(s,e);return a!=null&&a>=t}:i!=null?s=>{const a=r(s,e);return a!=null&&a<=i}:void 0}function Li(){return()=>!1}const Hi="unsupported-query",Ji=new qt(2e6);let Yi=0;class as{constructor(e){this._geometryQueryCache=null,this._changeHandle=null,this.capabilities={query:ti},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.objectIdField=e.objectIdField,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._changeHandle=this.featureStore.events.on("changed",()=>this.clearCache()),this.timeInfo=e.timeInfo,e.cacheSpatialQueries&&(this._geometryQueryCache=new Gt(Yi+++"$$",Ji)),this.fieldsIndex=Dt(e.fieldsIndex)?e.fieldsIndex:Ot.fromJSON(e.fieldsIndex),this.availableFields=e.availableFields==null?new Set(this.fieldsIndex.fields.map(t=>t.name)):new Set(e.availableFields.map(t=>{var i;return(i=this.fieldsIndex.get(t))==null?void 0:i.name}).filter(t=>t!=null)),e.scheduler&&e.priority&&(this._frameTask=e.scheduler.registerTask(e.priority))}destroy(){this._frameTask=Ee(this._frameTask),this.clearCache(),Zt(this._geometryQueryCache),this._changeHandle=Ee(this._changeHandle)}get featureAdapter(){return this.featureStore.featureAdapter}clearCache(){var e;(e=this._geometryQueryCache)==null||e.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async executeQuery(e,t){try{return(await this._executeQuery(e,{},t)).createQueryResponse()}catch(i){if(i!==Q)throw i;return new v([],e,this).createQueryResponse()}}async executeQueryForCount(e={},t){try{return(await this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null},t)).createQueryResponseForCount()}catch(i){if(i!==Q)throw i;return 0}}async executeQueryForExtent(e,t){const i=e.outSR;try{const s=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},t),a=s.size;return a?{count:a,extent:await this._getBounds(s.items,s.spatialReference,i||this.spatialReference)}:{count:0,extent:null}}catch(s){if(s===Q)return{count:0,extent:null};throw s}}async executeQueryForIds(e,t){return this.executeQueryForIdSet(e,t).then(i=>Array.from(i))}async executeQueryForIdSet(e,t){try{const i=await this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null},t),s=i.items,a=new Set;return await this._reschedule(()=>{for(const n of s)a.add(i.featureAdapter.getObjectId(n))},t),a}catch(i){if(i===Q)return new Set;throw i}}async executeQueryForSnapping(e,t){const{point:i,distance:s,returnEdge:a,vertexMode:n}=e;if(!a&&n==="none")return{candidates:[]};let l=ee(e.query);l=await this._schedule(()=>at(l,this.definitionExpression,this.spatialReference),t),l=await this._reschedule(()=>je(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),t);const o=!b(i.spatialReference,this.spatialReference);o&&await Z(i.spatialReference,this.spatialReference);const u=typeof s=="number"?s:s.x,c=typeof s=="number"?s:s.y,h={xmin:i.x-u,xmax:i.x+u,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},d=o?M(h,this.spatialReference):h;if(!d)return{candidates:[]};const m=(await fe(me(i),null,{signal:t}))[0],p=(await fe(me(d),null,{signal:t}))[0];if(m==null||p==null)return{candidates:[]};const f=new v(await this._reschedule(()=>this._searchFeatures(this._getQueryBBoxes(p.toJSON())),t),l,this);await this._reschedule(()=>this._executeObjectIdsQuery(f),t),await this._reschedule(()=>this._executeTimeQuery(f),t),await this._reschedule(()=>this._executeAttributesQuery(f),t),await this._reschedule(()=>this._executeGeometryQueryForSnapping(f,t),t);const F=m.toJSON(),_=o?M(F,this.spatialReference):F,w=o?Math.max(d.xmax-d.xmin,d.ymax-d.ymin)/2:s;return f.createSnappingResponse({...e,point:_,distance:w},i.spatialReference)}async executeQueryForLatestObservations(e,t){var i;if(!((i=this.timeInfo)!=null&&i.trackIdField))throw new T(Hi,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});try{const s=await this._executeQuery(e,{},t);return await this._reschedule(()=>this._filterLatest(s),t),s.createQueryResponse()}catch(s){if(s!==Q)throw s;return new v([],e,this).createQueryResponse()}}async executeQueryForSummaryStatistics(e={},t,i){const{field:s,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:s,normalizationField:a,valueExpression:n},i)).createSummaryStatisticsResponse(t)}async executeQueryForUniqueValues(e={},t,i){const{field:s,field2:a,field3:n,valueExpression:l}=t;return(await this._executeQueryForStatistics(e,{field:s,field2:a,field3:n,valueExpression:l},i)).createUniqueValuesResponse(t)}async executeQueryForClassBreaks(e={},t,i){const{field:s,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:s,normalizationField:a,valueExpression:n},i)).createClassBreaksResponse(t)}async executeQueryForHistogram(e={},t,i){const{field:s,normalizationField:a,valueExpression:n}=t;return(await this._executeQueryForStatistics(e,{field:s,normalizationField:a,valueExpression:n},i)).createHistogramResponse(t)}async fetchRecomputedExtents(e){this._timeExtentPromise||(this._timeExtentPromise=ji(this.timeInfo,this.featureStore));const[t,i]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return jt(e),{fullExtent:t,timeExtent:i}}async _getBounds(e,t,i){const s=Bt(kt(),Ut);await this.featureStore.forEachBounds(e,l=>Lt(s,l));const a={xmin:s[0],ymin:s[1],xmax:s[3],ymax:s[4],spatialReference:U(this.spatialReference)};this.hasZ&&isFinite(s[2])&&isFinite(s[5])&&(a.zmin=s[2],a.zmax=s[5]);const n=M(a,t,i);if(n.spatialReference=U(i),n.xmax-n.xmin==0){const l=re(n.spatialReference);n.xmin-=l,n.xmax+=l}if(n.ymax-n.ymin==0){const l=re(n.spatialReference);n.ymin-=l,n.ymax+=l}if(this.hasZ&&n.zmin!=null&&n.zmax!=null&&n.zmax-n.zmin==0){const l=re(n.spatialReference);n.zmin-=l,n.zmax+=l}return n}_getFullExtent(){return this._fullExtentPromise||(this._fullExtentPromise="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference))),this._fullExtentPromise}async _schedule(e,t){return this._frameTask!=null?this._frameTask.schedule(e,t):e(Me)}async _reschedule(e,t){return this._frameTask!=null?this._frameTask.reschedule(e,t):e(Me)}async _getAllFeaturesQueryEngineResult(e){return new v(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(this._allFeaturesPromise==null){const i=[];this._allFeaturesPromise=(async()=>{await this.featureStore.forEach(s=>i.push(s))})().then(()=>i)}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async _executeQuery(e,t,i){e=ee(e),e=await this._schedule(()=>Oe(e,this.definitionExpression,this.spatialReference),i),e=await this._reschedule(()=>je(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),i),e={...e,...t};const s=await this._reschedule(()=>this._executeSceneFilterQuery(e,i),i),a=await this._reschedule(()=>this._executeGeometryQuery(e,s,i),i);return await this._reschedule(()=>this._executeAggregateIdsQuery(a),i),await this._reschedule(()=>this._executeObjectIdsQuery(a),i),await this._reschedule(()=>this._executeTimeQuery(a),i),await this._reschedule(()=>this._executeAttributesQuery(a),i),a}async _executeSceneFilterQuery(e,t){if(e.sceneFilter==null)return null;const{outSR:i,returnGeometry:s,returnCentroid:a}=e,n=this.featureStore.featureSpatialReference,l=e.sceneFilter.geometry,o=n==null||b(n,l.spatialReference)?l:M(l,n);if(!o)return null;const u=s||a,c=G(i)&&!b(this.spatialReference,i)&&u?async f=>this._project(f,i):f=>f,h=this.featureAdapter,d=await this._reschedule(()=>this._searchFeatures(this._getQueryBBoxes(o)),t);if(e.sceneFilter.spatialRelationship==="disjoint"){if(!d.length)return null;const f=new Set;for(const w of d)f.add(h.getObjectId(w));const F=await this._reschedule(()=>this._getAllFeatures(),t),_=await this._reschedule(async()=>{const w=await B("esriSpatialRelDisjoint",o,this.geometryType,this.hasZ,this.hasM),I=x=>!f.has(h.getObjectId(x))||w(h.getGeometry(x)),g=await this._runSpatialFilter(F,I,t);return new v(g,e,this)},t);return c(_)}if(!d.length)return new v([],e,this);if(this._canExecuteSinglePass(o,e))return c(new v(d,e,this));const m=await B("esriSpatialRelContains",o,this.geometryType,this.hasZ,this.hasM),p=await this._runSpatialFilter(d,f=>m(h.getGeometry(f)),t);return c(new v(p,e,this))}async _executeGeometryQuery(e,t,i){if(t!=null&&t.items.length===0)return t;e=t!=null?t.query:e;const{geometry:s,outSR:a,spatialRel:n,returnGeometry:l,returnCentroid:o}=e,u=this.featureStore.featureSpatialReference,c=!s||u==null||b(u,s.spatialReference)?s:M(s,u),h=l||o,d=G(a)&&!b(this.spatialReference,a),m=this._geometryQueryCache&&t==null?JSON.stringify(d&&h?{originalFilterGeometry:s,spatialRelationship:n,outSpatialReference:a}:{originalFilterGeometry:s,spatialRelationship:n}):null,p=m?this._geometryQueryCache.get(m):null;if(p!=null)return new v(p,e,this);const f=async g=>(d&&h&&await this._project(g,a),m&&this._geometryQueryCache.put(m,g.items,g.items.length+1),g);if(!c)return f(t??await this._getAllFeaturesQueryEngineResult(e));const F=this.featureAdapter;let _=await this._reschedule(()=>this._searchFeatures(this._getQueryBBoxes(s)),i);if(n==="esriSpatialRelDisjoint"){if(!_.length)return f(t??await this._getAllFeaturesQueryEngineResult(e));const g=new Set;for(const S of _)g.add(F.getObjectId(S));const x=t!=null?t.items:await this._reschedule(()=>this._getAllFeatures(),i),y=await this._reschedule(async()=>{const S=await B(n,c,this.geometryType,this.hasZ,this.hasM),R=A=>!g.has(F.getObjectId(A))||S(F.getGeometry(A)),$=await this._runSpatialFilter(x,R,i);return new v($,e,this)},i);return f(y)}if(t!=null){const g=new Xt;_=_.filter(x=>Ht(t.items,x,t.items.length,g)>=0)}if(!_.length){const g=new v([],e,this);return m&&this._geometryQueryCache.put(m,g.items,1),g}if(this._canExecuteSinglePass(c,e))return f(new v(_,e,this));const w=await B(n,c,this.geometryType,this.hasZ,this.hasM),I=await this._runSpatialFilter(_,g=>w(F.getGeometry(g)),i);return f(new v(I,e,this))}async _executeGeometryQueryForSnapping(e,t){var l;const{query:i}=e,{spatialRel:s}=i;if(!((l=e==null?void 0:e.items)!=null&&l.length)||!i.geometry||!s)return;const a=await B(s,i.geometry,this.geometryType,this.hasZ,this.hasM),n=await this._runSpatialFilter(e.items,o=>a(o.geometry),t);e.items=n}_executeAggregateIdsQuery(e){var s;if(e.items.length===0||!((s=e.query.aggregateIds)!=null&&s.length)||this.aggregateAdapter==null)return;const t=new Set;for(const a of e.query.aggregateIds)this.aggregateAdapter.getFeatureObjectIds(a).forEach(n=>t.add(n));const i=this.featureAdapter.getObjectId;e.items=e.items.filter(a=>t.has(i(a)))}_executeObjectIdsQuery(e){var s;if(e.items.length===0||!((s=e.query.objectIds)!=null&&s.length))return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(a=>t.has(i(a)))}_executeTimeQuery(e){if(e.items.length===0)return;const t=Bi(this.timeInfo,e.query.timeExtent,this.featureAdapter);t!=null&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(e.items.length===0)return;const t=N(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(i=>t.testFeature(i,this.featureAdapter))}}async _runSpatialFilter(e,t,i){if(!t)return e;if(this._frameTask==null)return e.filter(l=>t(l));let s=0;const a=new Array,n=async l=>{for(;sn(u),i)}};return this._reschedule(l=>n(l),i).then(()=>a)}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:s}=this.timeInfo,a=s||i,n=new Map,l=this.featureAdapter.getAttribute;for(const o of e.items){const u=l(o,t),c=l(o,a),h=n.get(u);(!h||c>l(h,a))&&n.set(u,o)}e.items=Array.from(n.values())}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return Ze(e)&&(i==="esriSpatialRelEnvelopeIntersects"||this.geometryType==="esriGeometryPoint"&&(i==="esriSpatialRelIntersects"||i==="esriSpatialRelContains"))}async _project(e,t){if(!t||b(this.spatialReference,t))return e;const i=this.featureAdapter;let s;try{const n=await this._getFullExtent();s=Jt(this.spatialReference,t,n)}catch{}const a=await Ri(e.items.map(n=>P(this.geometryType,this.hasZ,this.hasM,i.getGeometry(n))),this.spatialReference,t,s);return e.items=a.map((n,l)=>i.cloneWithGeometry(e.items[l],Yt(n,this.hasZ,this.hasM))),e}_getQueryBBoxes(e){if(Ze(e)){if(q(e))return[Pe(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(H(e))return e.rings.map(t=>Pe(Math.min(t[0][0],t[2][0]),Math.min(t[0][1],t[2][1]),Math.max(t[0][0],t[2][0]),Math.max(t[0][1],t[2][1])))}return[Wt(Kt(),e)]}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(s=>this.featureStore.forEachInBounds(s,a=>t.add(a))));const i=Array.from(t.values());return t.clear(),i}async _executeQueryForStatistics(e,t,i){e=ee(e);try{e=await this._schedule(()=>Oe(e,this.definitionExpression,this.spatialReference),i),e=await this._reschedule(()=>Di(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),i);const s=await this._reschedule(()=>this._executeSceneFilterQuery(e,i),i),a=await this._reschedule(()=>this._executeGeometryQuery(e,s,i),i);return await this._reschedule(()=>this._executeAggregateIdsQuery(a),i),await this._reschedule(()=>this._executeObjectIdsQuery(a),i),await this._reschedule(()=>this._executeTimeQuery(a),i),await this._reschedule(()=>this._executeAttributesQuery(a),i),a}catch(s){if(s!==Q)throw s;return new v([],e,this)}}}export{as as W,at as a,U as h,M as j,Bi as t,B as v,Z as x}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/geometryEngineJSON-0_tJeUzi.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/json-v6EOeNTY.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/QueryTask-91TvtrTt.js b/dist/assets/QueryTask-91TvtrTt.js deleted file mode 100644 index 3f6ebca..0000000 --- a/dist/assets/QueryTask-91TvtrTt.js +++ /dev/null @@ -1,7 +0,0 @@ -import{dZ as y,ca as _,dT as v,e as a,y as c,iY as D,c as A,p as w,bV as Q,dJ as P,gG as d,de as n,bO as f,bP as h,E as j}from"./index-J0iiHjMT.js";import{n as q,s as L}from"./executeForIds-wXO8-pll.js";import{x as z}from"./query-rG0aX6cE.js";import{a as J}from"./executeQueryJSON-ACj9qY0y.js";import{n as $}from"./executeQueryPBF-vdaOUMid.js";import{d as N}from"./FeatureSet-d4S1oKME.js";async function C(e,t,r){const o=y(e);return z(o,_.from(t),{...r}).then(i=>({count:i.data.count,extent:v.fromJSON(i.data.extent)}))}let s=class extends w{constructor(e){super(e),this.dynamicDataSource=null,this.fieldsIndex=null,this.gdbVersion=null,this.infoFor3D=null,this.pbfSupported=!1,this.queryAttachmentsSupported=!1,this.sourceSpatialReference=null,this.url=null}get parsedUrl(){return Q(this.url)}async execute(e,t){const r=await this.executeJSON(e,t);return this.featureSetFromJSON(e,r,t)}async executeJSON(e,t){var u;const r=this._normalizeQuery(e),o=((u=e.outStatistics)==null?void 0:u[0])!=null,i=P("featurelayer-pbf-statistics"),l=!o||i;let p;if(this.pbfSupported&&l)try{p=await $(this.url,r,t)}catch(m){if(m.name!=="query:parsing-pbf")throw m;this.pbfSupported=!1}return this.pbfSupported&&l||(p=await J(this.url,r,t)),this._normalizeFields(p.fields),p}async featureSetFromJSON(e,t,r){if(!this._queryIs3DObjectFormat(e)||this.infoFor3D==null||!t.features)return N.fromJSON(t);const{meshFeatureSetFromJSON:o}=await d(n(()=>import("./meshFeatureSet-Mcou8mDC.js"),__vite__mapDeps([0,1,2,3,4])),r);return o(e,this.infoFor3D,t)}executeForCount(e,t){return q(this.url,this._normalizeQuery(e),t)}executeForExtent(e,t){return C(this.url,this._normalizeQuery(e),t)}executeForIds(e,t){return L(this.url,this._normalizeQuery(e),t)}async executeRelationshipQuery(e,t){const[{default:r},{executeRelationshipQuery:o}]=await d(Promise.all([n(()=>import("./index-J0iiHjMT.js").then(i=>i.zE),__vite__mapDeps([1,2])),n(()=>import("./executeRelationshipQuery-A9rcFpIX.js"),__vite__mapDeps([5,1,2,6,7,8,9,4]))]),t);return e=r.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeRelationshipQueryForCount(e,t){const[{default:r},{executeRelationshipQueryForCount:o}]=await d(Promise.all([n(()=>import("./index-J0iiHjMT.js").then(i=>i.zE),__vite__mapDeps([1,2])),n(()=>import("./executeRelationshipQuery-A9rcFpIX.js"),__vite__mapDeps([5,1,2,6,7,8,9,4]))]),t);return e=r.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeAttachmentQuery(e,t){const{executeAttachmentQuery:r,fetchAttachments:o,processAttachmentQueryResult:i}=await d(n(()=>import("./queryAttachments-2yka8D_T.js"),__vite__mapDeps([10,1,2,6,7,8,9,11])),t),l=y(this.url);return i(l,await(this.queryAttachmentsSupported?r(l,e,t):o(l,e,t)))}async executeTopFeaturesQuery(e,t){const{executeTopFeaturesQuery:r}=await d(n(()=>import("./executeTopFeaturesQuery-se6h6fh4.js"),__vite__mapDeps([12,1,2,13,6,7,8,9,4,14])),t);return r(this.parsedUrl,e,this.sourceSpatialReference,t)}async executeForTopIds(e,t){const{executeForTopIds:r}=await d(n(()=>import("./executeForTopIds-kKHpaQVu.js"),__vite__mapDeps([15,1,2,13,6,7,8,9,14])),t);return r(this.parsedUrl,e,t)}async executeForTopExtents(e,t){const{executeForTopExtents:r}=await d(n(()=>import("./executeForTopExtents--je_5dPa.js"),__vite__mapDeps([16,1,2,13,6,7,8,9,14])),t);return r(this.parsedUrl,e,t)}async executeForTopCount(e,t){const{executeForTopCount:r}=await d(n(()=>import("./executeForTopCount-bR-K9CPn.js"),__vite__mapDeps([17,1,2,13,6,7,8,9,14])),t);return r(this.parsedUrl,e,t)}_normalizeQuery(e){let t=_.from(e);t.sourceSpatialReference=t.sourceSpatialReference||this.sourceSpatialReference,(this.gdbVersion||this.dynamicDataSource)&&(t=t===e?t.clone():t,t.gdbVersion=e.gdbVersion||this.gdbVersion,t.dynamicDataSource=e.dynamicDataSource?D.from(e.dynamicDataSource):this.dynamicDataSource);const{infoFor3D:r}=this;if(r!=null&&this._queryIs3DObjectFormat(e)){t=t===e?t.clone():t,t.formatOf3DObjects=null;const{supportedFormats:o,queryFormats:i}=r,l=f("model/gltf-binary",o)??h("glb",o),p=f("model/gltf+json",o)??h("gtlf",o);for(const u of i){if(u===l){t.formatOf3DObjects=u;break}u!==p||t.formatOf3DObjects||(t.formatOf3DObjects=u)}if(!t.formatOf3DObjects)throw new j("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(t.outFields==null||!t.outFields.includes("*")){t=t===e?t.clone():t,t.outFields==null&&(t.outFields=[]);const{originX:u,originY:m,originZ:S,translationX:b,translationY:F,translationZ:O,scaleX:x,scaleY:g,scaleZ:E,rotationX:V,rotationY:R,rotationZ:I,rotationDeg:T}=r.transformFieldRoles;t.outFields.push(u,m,S,b,F,O,x,g,E,V,R,I,T)}}return t}_normalizeFields(e){if(this.fieldsIndex!=null&&e!=null)for(const t of e){const r=this.fieldsIndex.get(t.name);r&&Object.assign(t,r.toJSON())}}_queryIs3DObjectFormat(e){return this.infoFor3D!=null&&e.returnGeometry===!0&&e.multipatchOption!=="xyFootprint"&&!e.outStatistics}};a([c({type:D})],s.prototype,"dynamicDataSource",void 0),a([c()],s.prototype,"fieldsIndex",void 0),a([c()],s.prototype,"gdbVersion",void 0),a([c()],s.prototype,"infoFor3D",void 0),a([c({readOnly:!0})],s.prototype,"parsedUrl",null),a([c()],s.prototype,"pbfSupported",void 0),a([c()],s.prototype,"queryAttachmentsSupported",void 0),a([c()],s.prototype,"sourceSpatialReference",void 0),a([c({type:String})],s.prototype,"url",void 0),s=a([A("esri.tasks.QueryTask")],s);const K=s;export{K as x}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/meshFeatureSet-Mcou8mDC.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/External-GV0jSEES.js","assets/FeatureSet-d4S1oKME.js","assets/executeRelationshipQuery-A9rcFpIX.js","assets/query-rG0aX6cE.js","assets/pbfQueryUtils-pWizwTQZ.js","assets/pbf-o0zzptPp.js","assets/queryZScale-IaMm02_2.js","assets/queryAttachments-2yka8D_T.js","assets/AttachmentInfo-kbEMEIl0.js","assets/executeTopFeaturesQuery-se6h6fh4.js","assets/queryTopFeatures-L2nDK2pi.js","assets/TopFeaturesQuery-E6D2tV-x.js","assets/executeForTopIds-kKHpaQVu.js","assets/executeForTopExtents--je_5dPa.js","assets/executeForTopCount-bR-K9CPn.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/QueryTask-Di0fqnMV.js b/dist/assets/QueryTask-Di0fqnMV.js new file mode 100644 index 0000000..3f399bf --- /dev/null +++ b/dist/assets/QueryTask-Di0fqnMV.js @@ -0,0 +1,7 @@ +import{fV as y,i$ as T,aL as _,dO as A,e as a,y as c,j0 as D,c as w,g as Q,au as j,dE as P,j1 as q,h6 as L,gD as d,de as n,an as h,ao as f,r as $}from"./index-pCX-0tJH.js";import{n as z,s as J}from"./executeForIds-PXSIkRGk.js";import{n as N}from"./executeQueryPBF-P21isUTI.js";async function C(e,t,r){const o=y(e);return T(o,_.from(t),{...r}).then(s=>({count:s.data.count,extent:A.fromJSON(s.data.extent)}))}let i=class extends Q{constructor(e){super(e),this.dynamicDataSource=null,this.fieldsIndex=null,this.gdbVersion=null,this.infoFor3D=null,this.pbfSupported=!1,this.queryAttachmentsSupported=!1,this.sourceSpatialReference=null,this.url=null}get parsedUrl(){return j(this.url)}async execute(e,t){const r=await this.executeJSON(e,t);return this.featureSetFromJSON(e,r,t)}async executeJSON(e,t){var u;const r=this._normalizeQuery(e),o=((u=e.outStatistics)==null?void 0:u[0])!=null,s=P("featurelayer-pbf-statistics"),l=!o||s;let p;if(this.pbfSupported&&l)try{p=await N(this.url,r,t)}catch(m){if(m.name!=="query:parsing-pbf")throw m;this.pbfSupported=!1}return this.pbfSupported&&l||(p=await q(this.url,r,t)),this._normalizeFields(p.fields),p}async featureSetFromJSON(e,t,r){if(!this._queryIs3DObjectFormat(e)||this.infoFor3D==null||!t.features)return L.fromJSON(t);const{meshFeatureSetFromJSON:o}=await d(n(()=>import("./meshFeatureSet-42GYfSGc.js"),__vite__mapDeps([0,1,2,3])),r);return o(e,this.infoFor3D,t)}executeForCount(e,t){return z(this.url,this._normalizeQuery(e),t)}executeForExtent(e,t){return C(this.url,this._normalizeQuery(e),t)}executeForIds(e,t){return J(this.url,this._normalizeQuery(e),t)}async executeRelationshipQuery(e,t){const[{default:r},{executeRelationshipQuery:o}]=await d(Promise.all([n(()=>import("./index-pCX-0tJH.js").then(s=>s.zX),__vite__mapDeps([1,2])),n(()=>import("./executeRelationshipQuery-ZKqwTeNc.js"),__vite__mapDeps([4,1,2]))]),t);return e=r.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeRelationshipQueryForCount(e,t){const[{default:r},{executeRelationshipQueryForCount:o}]=await d(Promise.all([n(()=>import("./index-pCX-0tJH.js").then(s=>s.zX),__vite__mapDeps([1,2])),n(()=>import("./executeRelationshipQuery-ZKqwTeNc.js"),__vite__mapDeps([4,1,2]))]),t);return e=r.from(e),(this.gdbVersion||this.dynamicDataSource)&&((e=e.clone()).gdbVersion=e.gdbVersion||this.gdbVersion,e.dynamicDataSource=e.dynamicDataSource||this.dynamicDataSource),o(this.url,e,t)}async executeAttachmentQuery(e,t){const{executeAttachmentQuery:r,fetchAttachments:o,processAttachmentQueryResult:s}=await d(n(()=>import("./queryAttachments-cBLHPfAO.js"),__vite__mapDeps([5,1,2])),t),l=y(this.url);return s(l,await(this.queryAttachmentsSupported?r(l,e,t):o(l,e,t)))}async executeTopFeaturesQuery(e,t){const{executeTopFeaturesQuery:r}=await d(n(()=>import("./executeTopFeaturesQuery-pxkhoyar.js"),__vite__mapDeps([6,1,2,7])),t);return r(this.parsedUrl,e,this.sourceSpatialReference,t)}async executeForTopIds(e,t){const{executeForTopIds:r}=await d(n(()=>import("./executeForTopIds-JVLS00pE.js"),__vite__mapDeps([8,1,2,7])),t);return r(this.parsedUrl,e,t)}async executeForTopExtents(e,t){const{executeForTopExtents:r}=await d(n(()=>import("./executeForTopExtents-H5vst4yE.js"),__vite__mapDeps([9,1,2,7])),t);return r(this.parsedUrl,e,t)}async executeForTopCount(e,t){const{executeForTopCount:r}=await d(n(()=>import("./executeForTopCount-Cgs-qCAg.js"),__vite__mapDeps([10,1,2,7])),t);return r(this.parsedUrl,e,t)}_normalizeQuery(e){let t=_.from(e);t.sourceSpatialReference=t.sourceSpatialReference||this.sourceSpatialReference,(this.gdbVersion||this.dynamicDataSource)&&(t=t===e?t.clone():t,t.gdbVersion=e.gdbVersion||this.gdbVersion,t.dynamicDataSource=e.dynamicDataSource?D.from(e.dynamicDataSource):this.dynamicDataSource);const{infoFor3D:r}=this;if(r!=null&&this._queryIs3DObjectFormat(e)){t=t===e?t.clone():t,t.formatOf3DObjects=null;const{supportedFormats:o,queryFormats:s}=r,l=h("model/gltf-binary",o)??f("glb",o),p=h("model/gltf+json",o)??f("gtlf",o);for(const u of s){if(u===l){t.formatOf3DObjects=u;break}u!==p||t.formatOf3DObjects||(t.formatOf3DObjects=u)}if(!t.formatOf3DObjects)throw new $("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(t.outFields==null||!t.outFields.includes("*")){t=t===e?t.clone():t,t.outFields==null&&(t.outFields=[]);const{originX:u,originY:m,originZ:S,translationX:F,translationY:b,translationZ:O,scaleX:x,scaleY:g,scaleZ:V,rotationX:E,rotationY:R,rotationZ:I,rotationDeg:v}=r.transformFieldRoles;t.outFields.push(u,m,S,F,b,O,x,g,V,E,R,I,v)}}return t}_normalizeFields(e){if(this.fieldsIndex!=null&&e!=null)for(const t of e){const r=this.fieldsIndex.get(t.name);r&&Object.assign(t,r.toJSON())}}_queryIs3DObjectFormat(e){return this.infoFor3D!=null&&e.returnGeometry===!0&&e.multipatchOption!=="xyFootprint"&&!e.outStatistics}};a([c({type:D})],i.prototype,"dynamicDataSource",void 0),a([c()],i.prototype,"fieldsIndex",void 0),a([c()],i.prototype,"gdbVersion",void 0),a([c()],i.prototype,"infoFor3D",void 0),a([c({readOnly:!0})],i.prototype,"parsedUrl",null),a([c()],i.prototype,"pbfSupported",void 0),a([c()],i.prototype,"queryAttachmentsSupported",void 0),a([c()],i.prototype,"sourceSpatialReference",void 0),a([c({type:String})],i.prototype,"url",void 0),i=a([w("esri.tasks.QueryTask")],i);const Z=i;export{Z as x}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/meshFeatureSet-42GYfSGc.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/External-Pb5poJ0S.js","assets/executeRelationshipQuery-ZKqwTeNc.js","assets/queryAttachments-cBLHPfAO.js","assets/executeTopFeaturesQuery-pxkhoyar.js","assets/queryTopFeatures-WO1xu2NM.js","assets/executeForTopIds-JVLS00pE.js","assets/executeForTopExtents-H5vst4yE.js","assets/executeForTopCount-Cgs-qCAg.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/RasterWorker-0s4_fI9v.js b/dist/assets/RasterWorker-dDXhiR2p.js similarity index 89% rename from dist/assets/RasterWorker-0s4_fI9v.js rename to dist/assets/RasterWorker-dDXhiR2p.js index edb5409..4bcbf04 100644 --- a/dist/assets/RasterWorker-0s4_fI9v.js +++ b/dist/assets/RasterWorker-dDXhiR2p.js @@ -1 +1 @@ -import{dT as a,T as l,gt as c}from"./index-J0iiHjMT.js";import{u as i,f as m,m as f,j as u,L as p,h as S,W as d,U as x,R as y,I as h,a as O,s as N}from"./dataUtils-s_UKlouc.js";import{R as J,i as g}from"./utils-4xKNo3Tf.js";import{M as P,T as b,e as B}from"./rasterProjectionHelper-KvYWHIT_.js";class T{convertVectorFieldData(e){const t=i.fromJSON(e.pixelBlock),s=m(t,e.type);return Promise.resolve(s!=null?s.toJSON():null)}computeStatisticsHistograms(e){const t=i.fromJSON(e.pixelBlock),s=f(t);return Promise.resolve(s)}async decode(e){const t=await u(e.data,e.options);return t&&t.toJSON()}symbolize(e){e.pixelBlock=i.fromJSON(e.pixelBlock),e.extent=e.extent?a.fromJSON(e.extent):null;const t=this.symbolizer.symbolize(e);return Promise.resolve(t!=null?t.toJSON():null)}async updateSymbolizer(e){var t;this.symbolizer=p.fromJSON(e.symbolizerJSON),e.histograms&&((t=this.symbolizer)==null?void 0:t.rendererJSON.type)==="rasterStretch"&&(this.symbolizer.rendererJSON.histograms=e.histograms)}async updateRasterFunction(e){this.rasterFunction=J(e.rasterFunctionJSON)}async process(e){var s;const t=this.rasterFunction.process({extent:a.fromJSON(e.extent),primaryPixelBlocks:e.primaryPixelBlocks.map(o=>o!=null?i.fromJSON(o):null),primaryPixelSizes:(s=e.primaryPixelSizes)==null?void 0:s.map(o=>o!=null?l.fromJSON(o):null),primaryRasterIds:e.primaryRasterIds});return t!=null?t.toJSON():null}stretch(e){const t=this.symbolizer.simpleStretch(i.fromJSON(e.srcPixelBlock),e.stretchParams);return Promise.resolve(t==null?void 0:t.toJSON())}estimateStatisticsHistograms(e){const t=S(i.fromJSON(e.srcPixelBlock));return Promise.resolve(t)}split(e){const t=d(i.fromJSON(e.srcPixelBlock),e.tileSize,e.maximumPyramidLevel);return t&&t.forEach((s,o)=>{t.set(o,s==null?void 0:s.toJSON())}),Promise.resolve(t)}async mosaicAndTransform(e){const t=e.srcPixelBlocks.map(n=>n?new i(n):null),s=x(t,e.srcMosaicSize,{blockWidths:e.blockWidths,alignmentInfo:e.alignmentInfo,clipOffset:e.clipOffset,clipSize:e.clipSize});let o,r=s;return e.coefs&&(r=y(s,e.destDimension,e.coefs,e.sampleSpacing,e.interpolation)),e.projectDirections&&e.gcsGrid&&(o=h(e.destDimension,e.gcsGrid),r=O(r,e.isUV?"vector-uv":"vector-magdir",o)),{pixelBlock:r==null?void 0:r.toJSON(),localNorthDirections:o}}async createFlowMesh(e,t){const s={data:new Float32Array(e.flowData.buffer),mask:new Uint8Array(e.flowData.maskBuffer),width:e.flowData.width,height:e.flowData.height},{vertexData:o,indexData:r}=await N(e.meshType,e.simulationSettings,s,t.signal);return{result:{vertexBuffer:o.buffer,indexBuffer:r.buffer},transferList:[o.buffer,r.buffer]}}async getProjectionOffsetGrid(e){const t=a.fromJSON(e.projectedExtent),s=a.fromJSON(e.srcBufferExtent);let o=null;e.datumTransformationSteps&&(o=new c({steps:e.datumTransformationSteps})),(e.includeGCSGrid||P(t.spatialReference,s.spatialReference,o))&&await b();const r=e.rasterTransform?g(e.rasterTransform):null;return B({...e,projectedExtent:t,srcBufferExtent:s,datumTransformation:o,rasterTransform:r})}}export{T as default}; +import{dO as a,L as l,gq as c}from"./index-pCX-0tJH.js";import{u as i,f as m,m as f,j as u,L as p,h as S,W as d,U as x,R as y,I as O,a as h,s as N}from"./dataUtils-_QoSHbCE.js";import{R as J,i as g}from"./utils-7NyN8ES_.js";import{M as P,T as b,e as B}from"./rasterProjectionHelper-3sL58SxG.js";class T{convertVectorFieldData(e){const t=i.fromJSON(e.pixelBlock),s=m(t,e.type);return Promise.resolve(s!=null?s.toJSON():null)}computeStatisticsHistograms(e){const t=i.fromJSON(e.pixelBlock),s=f(t);return Promise.resolve(s)}async decode(e){const t=await u(e.data,e.options);return t&&t.toJSON()}symbolize(e){e.pixelBlock=i.fromJSON(e.pixelBlock),e.extent=e.extent?a.fromJSON(e.extent):null;const t=this.symbolizer.symbolize(e);return Promise.resolve(t!=null?t.toJSON():null)}async updateSymbolizer(e){var t;this.symbolizer=p.fromJSON(e.symbolizerJSON),e.histograms&&((t=this.symbolizer)==null?void 0:t.rendererJSON.type)==="rasterStretch"&&(this.symbolizer.rendererJSON.histograms=e.histograms)}async updateRasterFunction(e){this.rasterFunction=J(e.rasterFunctionJSON)}async process(e){var s;const t=this.rasterFunction.process({extent:a.fromJSON(e.extent),primaryPixelBlocks:e.primaryPixelBlocks.map(o=>o!=null?i.fromJSON(o):null),primaryPixelSizes:(s=e.primaryPixelSizes)==null?void 0:s.map(o=>o!=null?l.fromJSON(o):null),primaryRasterIds:e.primaryRasterIds});return t!=null?t.toJSON():null}stretch(e){const t=this.symbolizer.simpleStretch(i.fromJSON(e.srcPixelBlock),e.stretchParams);return Promise.resolve(t==null?void 0:t.toJSON())}estimateStatisticsHistograms(e){const t=S(i.fromJSON(e.srcPixelBlock));return Promise.resolve(t)}split(e){const t=d(i.fromJSON(e.srcPixelBlock),e.tileSize,e.maximumPyramidLevel);return t&&t.forEach((s,o)=>{t.set(o,s==null?void 0:s.toJSON())}),Promise.resolve(t)}async mosaicAndTransform(e){const t=e.srcPixelBlocks.map(n=>n?new i(n):null),s=x(t,e.srcMosaicSize,{blockWidths:e.blockWidths,alignmentInfo:e.alignmentInfo,clipOffset:e.clipOffset,clipSize:e.clipSize});let o,r=s;return e.coefs&&(r=y(s,e.destDimension,e.coefs,e.sampleSpacing,e.interpolation)),e.projectDirections&&e.gcsGrid&&(o=O(e.destDimension,e.gcsGrid),r=h(r,e.isUV?"vector-uv":"vector-magdir",o)),{pixelBlock:r==null?void 0:r.toJSON(),localNorthDirections:o}}async createFlowMesh(e,t){const s={data:new Float32Array(e.flowData.buffer),mask:new Uint8Array(e.flowData.maskBuffer),width:e.flowData.width,height:e.flowData.height},{vertexData:o,indexData:r}=await N(e.meshType,e.simulationSettings,s,t.signal);return{result:{vertexBuffer:o.buffer,indexBuffer:r.buffer},transferList:[o.buffer,r.buffer]}}async getProjectionOffsetGrid(e){const t=a.fromJSON(e.projectedExtent),s=a.fromJSON(e.srcBufferExtent);let o=null;e.datumTransformationSteps&&(o=new c({steps:e.datumTransformationSteps})),(e.includeGCSGrid||P(t.spatialReference,s.spatialReference,o))&&await b();const r=e.rasterTransform?g(e.rasterTransform):null;return B({...e,projectedExtent:t,srcBufferExtent:s,datumTransformation:o,rasterTransform:r})}}export{T as default}; diff --git a/dist/assets/ReactiveSet-HLstcUcf.js b/dist/assets/ReactiveSet-_4-UpKXZ.js similarity index 92% rename from dist/assets/ReactiveSet-HLstcUcf.js rename to dist/assets/ReactiveSet-_4-UpKXZ.js index 5b2a476..b2140c4 100644 --- a/dist/assets/ReactiveSet-HLstcUcf.js +++ b/dist/assets/ReactiveSet-_4-UpKXZ.js @@ -1 +1 @@ -import{fg as h,fh as t}from"./index-J0iiHjMT.js";class b{constructor(){this._set=new Set,this._observable=new h}get size(){return t(this._observable),this._set.size}add(e){const s=this._set.size;return this._set.add(e),this._set.size!==s&&this._observable.notify(),this}clear(){this._set.size>0&&(this._set.clear(),this._observable.notify())}delete(e){const s=this._set.delete(e);return s&&this._observable.notify(),s}entries(){return t(this._observable),this._set.entries()}forEach(e,s){t(this._observable),this._set.forEach((r,i)=>e.call(s,r,i,this),s)}has(e){return t(this._observable),this._set.has(e)}keys(){return t(this._observable),this._set.keys()}values(){return t(this._observable),this._set.values()}[Symbol.iterator](){return t(this._observable),this._set[Symbol.iterator]()}get[Symbol.toStringTag](){return this._set[Symbol.toStringTag]}}export{b as s}; +import{fb as h,fc as t}from"./index-pCX-0tJH.js";class b{constructor(){this._set=new Set,this._observable=new h}get size(){return t(this._observable),this._set.size}add(e){const s=this._set.size;return this._set.add(e),this._set.size!==s&&this._observable.notify(),this}clear(){this._set.size>0&&(this._set.clear(),this._observable.notify())}delete(e){const s=this._set.delete(e);return s&&this._observable.notify(),s}entries(){return t(this._observable),this._set.entries()}forEach(e,s){t(this._observable),this._set.forEach((r,i)=>e.call(s,r,i,this),s)}has(e){return t(this._observable),this._set.has(e)}keys(){return t(this._observable),this._set.keys()}values(){return t(this._observable),this._set.values()}[Symbol.iterator](){return t(this._observable),this._set[Symbol.iterator]()}get[Symbol.toStringTag](){return this._set[Symbol.toStringTag]}}export{b as s}; diff --git a/dist/assets/RefreshableLayerView-DVYs7L04.js b/dist/assets/RefreshableLayerView-DVYs7L04.js new file mode 100644 index 0000000..ac5f2f2 --- /dev/null +++ b/dist/assets/RefreshableLayerView-DVYs7L04.js @@ -0,0 +1 @@ +import{e as r,y as i,c as h,fg as o,ac as l,R as c}from"./index-pCX-0tJH.js";const y=s=>{let e=class extends s{initialize(){this.addHandles(o(()=>this.layer,"refresh",t=>{this.doRefresh(t.dataChanged).catch(a=>{l(a)||c.getLogger(this).error(a)})}),"RefreshableLayerView")}};return r([i()],e.prototype,"layer",void 0),e=r([h("esri.layers.mixins.RefreshableLayerView")],e),e};export{y as a}; diff --git a/dist/assets/RefreshableLayerView-Pd4dLcWr.js b/dist/assets/RefreshableLayerView-Pd4dLcWr.js deleted file mode 100644 index de2689d..0000000 --- a/dist/assets/RefreshableLayerView-Pd4dLcWr.js +++ /dev/null @@ -1 +0,0 @@ -import{e as s,y as i,c as h,fl as l,f as o,Z as d}from"./index-J0iiHjMT.js";const n=a=>{let e=class extends a{initialize(){this.addHandles(l(()=>this.layer,"refresh",t=>{this.doRefresh(t.dataChanged).catch(r=>{o(r)||d.getLogger(this).error(r)})}),"RefreshableLayerView")}};return s([i()],e.prototype,"layer",void 0),e=s([h("esri.layers.mixins.RefreshableLayerView")],e),e};export{n as a}; diff --git a/dist/assets/Reshape-J0NI6bzM.js b/dist/assets/Reshape-J0NI6bzM.js deleted file mode 100644 index ab32dd9..0000000 --- a/dist/assets/Reshape-J0NI6bzM.js +++ /dev/null @@ -1 +0,0 @@ -import{J as G,K as z,V as E,L as $,F as U,U as M,d as k,n as S,M as L,N as D,O as P,Q as K,a as I,R as b,S as f,T as x,W as O,b as N,X as J,Y as T,I as C,Z as Q,E as W,e as m,y,_ as X,$ as Y,A as Z,P as q,c as B}from"./index-J0iiHjMT.js";import{S as j}from"./SnappingVisualizer2D-NnEm1PvQ.js";import{i as tt}from"./drawUtils-woTYaREB.js";import{l as et,U as it}from"./GraphicMover-DhG5Ib7v.js";import{d as st}from"./settings-YeKUIkGh.js";import{V as ot}from"./EditGeometryOperations-TPE5Wzab.js";import{e as rt}from"./SnappingContext-6K6JmvvY.js";import{m as R,g as nt,u as at}from"./Tooltip-ON77BKb3.js";import{r as ht,p as pt}from"./TranslateTooltipInfos-J6BygtUO.js";import{u as ct}from"./automaticAreaMeasurementUtils-nVd6Y5mX.js";import"./featureUtils-itZGjo5c.js";import"./GraphicManipulator-ku6oRBpa.js";import"./drapedUtils-9db1OpTX.js";import"./PointSnappingHint-ULetRXiW.js";import"./euclideanLengthMeasurementUtils-VQw5qWk6.js";import"./measurementUtils-84-ZBArh.js";import"./quantityFormatUtils-NiAiojad.js";import"./euclideanAreaMeasurementUtils-zmzttSyV.js";class lt{constructor(e,i,s){this.graphic=e,this.mover=i,this.selected=s,this.type="reshape-start"}}class dt{constructor(e,i,s){this.graphic=e,this.mover=i,this.selected=s,this.type="reshape"}}class vt{constructor(e,i,s){this.graphic=e,this.mover=i,this.selected=s,this.type="reshape-stop"}}class mt{constructor(e,i,s){this.mover=e,this.dx=i,this.dy=s,this.type="move-start"}}class yt{constructor(e,i,s){this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class _t{constructor(e,i,s){this.mover=e,this.dx=i,this.dy=s,this.type="move-stop"}}class gt{constructor(e){this.added=e,this.type="vertex-select"}}class ut{constructor(e){this.removed=e,this.type="vertex-deselect"}}class xt{constructor(e,i,s,o){this.added=e,this.graphic=i,this.oldGraphic=s,this.vertices=o,this.type="vertex-add"}}class ft{constructor(e,i,s,o){this.removed=e,this.graphic=i,this.oldGraphic=s,this.vertices=o,this.type="vertex-remove"}}const g=st.reshapeGraphics,Gt={vertices:{default:new G({style:"circle",size:g.vertex.size,color:g.vertex.color,outline:{color:g.vertex.outlineColor,width:1}}),hover:new G({style:"circle",size:g.vertex.hoverSize,color:g.vertex.hoverColor,outline:{color:g.vertex.hoverOutlineColor,width:1}}),selected:new G({style:"circle",size:g.selected.size,color:g.selected.color,outline:{color:g.selected.outlineColor,width:1}})},midpoints:{default:new G({style:"circle",size:g.midpoint.size,color:g.midpoint.color,outline:{color:g.midpoint.outlineColor,width:1}}),hover:new G({style:"circle",size:g.midpoint.size,color:g.midpoint.color,outline:{color:g.midpoint.outlineColor,width:1}})}};let d=class extends z.EventedAccessor{constructor(t){super(t),this._activeOperationInfo=null,this._editGeometryOperations=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingContext=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._tooltip=null,this._translateGraphicTooltipInfo=null,this._translateVertexTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.layer=null,this.midpointGraphics=new E,this.midpointSymbol=new G({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.symbols=Gt,this.tooltipOptions=new $,this.type="reshape",this.vertexGraphics=new E,this.view=null}initialize(){const t=this.view;this._highlightHelper=new et({view:t}),this._setup(),this.addHandles([U(()=>t==null?void 0:t.ready,()=>{const{layer:e,view:i}=this;X(i,e),this.addHandles(i.on("key-down",s=>this._keyDownHandler(s),Y.TOOL))},{once:!0,initial:!0}),M(()=>this.graphic,()=>this.refresh()),M(()=>this.layer,(e,i)=>{i&&(this._clearSelection(),this._resetGraphics(i)),this.refresh()}),M(()=>this.enableMidpoints,()=>this.refresh()),k(()=>this.tooltipOptions.enabled,e=>{this._tooltip=e?new at({view:this.view}):S(this._tooltip)},Z),k(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),q)])}destroy(){var t;this._reset(),(t=this._mover)==null||t.destroy(),this._mover=null,this._tooltip=S(this._tooltip)}set highlightsEnabled(t){var e;(e=this._highlightHelper)==null||e.removeAll(),this._set("highlightsEnabled",t),this._setUpHighlights()}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){const e=[];return this.graphic&&e.push(this.graphic),e.concat(this.vertexGraphics.items,this.midpointGraphics.items),e.length>0&&e.includes(t)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:t,layer:e}=this;if(!e||(t==null?void 0:t.geometry)==null)return;const i=t.geometry;i.type!=="mesh"&&i.type!=="extent"?(i.type==="polygon"&&L(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){var t;this.highlightsEnabled&&this.graphic&&((t=this._highlightHelper)==null||t.add(this.graphic))}_setUpGeometryHelper(){const t=this.graphic.geometry;if(t==null||t.type==="mesh"||t.type==="extent")return void this._logGeometryTypeError();const e=t.type==="multipoint"?new D({paths:t.points,spatialReference:t.spatialReference}):t;this._editGeometryOperations=ot.fromGeometry(e,P.Local)}_saveSnappingContextForHandle(t,e){var i;this._snappingGraphicsLayer=new K({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new rt({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:((i=e.viewEvent)==null?void 0:i.pointerType)||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new j(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){var t;this._clearSelection(),(t=this._highlightHelper)==null||t.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){var t;this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._snappingGraphicsLayer!=null&&((t=this.view)!=null&&t.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=S(this._editGeometryOperations),this._snappingTask=I(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._set("selectedVertices",[])}_removeMidpointGraphics(t){const e=t||this.layer;e&&e.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach(i=>i.destroy()),this.midpointGraphics.removeAll()}_removeVertexGraphics(t){const e=t||this.layer;e&&e.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach(i=>i.destroy()),this.vertexGraphics.removeAll()}_getCoordinatesForUI(t){const e=b(t.clone());if(t.type==="polygon")for(const i of e){const s=i[i.length-1];i[0][0]===s[0]&&i[0][1]===s[1]&&i.length>2&&i.pop()}return e}_setupGraphics(){const t=this.graphic.geometry;if(t!=null&&(t.type==="polyline"||t.type==="polygon")){const e=this._getCoordinatesForUI(t);this.enableMidpoints&&this._setUpMidpointGraphics(e),this.enableVertices&&this._setUpVertexGraphics(e)}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=this._createMidpointGraphics(t);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){this._removeVertexGraphics();const e=this._createVertexGraphics(t);this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}_createVertexGraphics(t){const{_graphicAttributes:e,symbols:i,view:{spatialReference:s}}=this,o=[];return t==null||t.forEach((n,r)=>{n.forEach((h,p)=>{var v;const[a,c,l]=h;o.push(new f({geometry:new x({x:a,y:c,z:l,spatialReference:s}),symbol:(v=i==null?void 0:i.vertices)==null?void 0:v.default,attributes:{...e,pathIndex:r,pointIndex:p}}))})}),o}_createMidpointGraphics(t){const{_graphicAttributes:e,symbols:i,view:{spatialReference:s}}=this,o=[];return t==null||t.forEach((n,r)=>{n.forEach((h,p)=>{var _;const[a,c,l]=h,v=n[p+1]?p+1:0;if(((_=this.graphic.geometry)==null?void 0:_.type)==="polygon"||v!==0){const[u,V,w]=n[v],[H,A,F]=O([a,c,l],[u,V,w]);o.push(new f({geometry:new x({x:H,y:A,z:F,spatialReference:s}),symbol:i.midpoints.default,attributes:{...e,pathIndex:r,pointIndexStart:p,pointIndexEnd:v}}))}})}),o}_updateSymbolsForTheme(){var e;const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:(e=this.symbols.vertices.hover)==null?void 0:e.clone().set("color",t)},midpoints:{...this.symbols.midpoints}};for(const i of this.vertexGraphics)this._isSelected(i)?i.symbol=this.symbols.vertices.selected:this._hoverGraphic===i?i.symbol=this.symbols.vertices.hover:i.symbol=this.symbols.vertices.default}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:i})=>({x:i.x,y:i.y}));for(let i=0;ithis._onGraphicClickCallback(r),onGraphicMoveStart:r=>this._onGraphicMoveStartCallback(r),onGraphicMove:r=>this._onGraphicMoveCallback(r),onGraphicMoveStop:r=>this._onGraphicMoveStopCallback(r),onGraphicPointerOver:r=>this._onGraphicPointerOverCallback(r),onGraphicPointerOut:r=>this._onGraphicPointerOutCallback(r)}})}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic;if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t);else if(this._isMidpoint(e)){if(t.viewEvent.button===2)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(e);this.refresh(),this._emitVertexAddEvent([e],i,s)}else this._isVertex(e)&&(t.viewEvent.stopPropagation(),t.viewEvent.button===2?this._removeVertices(e):(t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)))}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t;if(s===this.graphic){const{geometry:o}=s;return this._setUpOperation(t),this._emitMoveStartEvent(e,i),void(o!=null&&o.type==="point"&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}if(!this.selectedVertices.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const o=this.graphic.clone(),n=this._createVertexFromMidpoint(s);this._emitVertexAddEvent([s],o,n)}this._addToSelection(s)}this._setUpOperation(t),this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:n}=e,{geometry:r}=o;if(r!=null){if(n!=="move")this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else if(r.type==="point")this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if(r.type==="polyline"||r.type==="polygon"){const h=this._getCoordinatesForUI(r);this._updateVertexGraphicLocations(h),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t,{operationType:n}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>n==="move"?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(t){const e=this.view.spatialReference;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes,[n,r,h]=t[s][o];i.geometry=new x({x:n,y:r,z:h,spatialReference:e})}this._updateMidpointGraphicLocations(t)}_updateMidpointGraphicLocations(t){for(const e of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:o}=e.attributes,[n,r,h]=t[i][s],[p,a,c]=t[i][o],[l,v,_]=O([n,r,h],[p,a,c]);e.geometry=new x({x:l,y:v,z:_,spatialReference:this.view.spatialReference})}}_getIndicesForVertexGraphic({attributes:t}){return[(t==null?void 0:t.pathIndex)||0,(t==null?void 0:t.pointIndex)||0]}_getVertexFromEditGeometry(t){const[e,i]=this._getIndicesForVertexGraphic(t);return this._editGeometryOperations.data.components[e].vertices[i]}_onHandleMove(t,e,i,s,o){I(this._snappingTask);const n=this._snappingContext;if(!n)return;const r=t.geometry,h=s.type==="graphic-move-stop";if(this.snappingManager!=null&&this.selectedVertices.length<2&&!h){const p=this.snappingManager;this._stagedVertex=p.update({point:r,context:n}),this._syncGeometryAfterVertexMove(t,new x(this._stagedVertex),e,i,h),o(),this._snappingTask=N(async a=>{const c=await p.snap({point:r,context:n,signal:a});c.valid&&(this._stagedVertex=c.apply(),this._syncGeometryAfterVertexMove(t,new x(this._stagedVertex),e,i,h),o())})}else{const p=this._stagedVertex!=null?new x(this._stagedVertex):r;this._syncGeometryAfterVertexMove(t,p,e,i,h),o()}}async _syncGeometryAfterVertexMove(t,e,i,s,o=!1){const n=this._editGeometryOperations.data.geometry;if(n.type==="point")t.geometry=e;else if(n.type==="mesh")t.geometry=n.centerAt(e),t.notifyGeometryChanged();else{const{x:r,y:h,z:p}=e,[a,c]=this._getIndicesForVertexGraphic(t);let l=b(n);const v=l[a].length-1,_=p!=null?[r,h,p]:[r,h];l[a][c]=_,n.type==="polygon"&&(c===0?l[a][v]=_:c===v&&(l[a][0]=_)),this._isVertex(t)&&(l=this._moveRelatedCoordinates(l,t,_),l=this._moveSelectedHandleCoordinates(l,t,i,s,n.type==="polygon"),this._updateMidpointGraphicLocations(l)),this.graphic.geometry=n.clone();const u=this._getVertexFromEditGeometry(t),V=r-u.pos[0],w=h-u.pos[1];this._editGeometryOperations.moveVertices([u],V,w,0),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_moveRelatedCoordinates(t,e,i){const{relatedGraphicIndices:s}=e.attributes;for(const o of s){const n=this.vertexGraphics.at(o),{pathIndex:r,pointIndex:h}=n.attributes;t[r][h]=i,n.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){for(const n of this.selectedVertices)if(n!==e){const{pathIndex:r,pointIndex:h,relatedGraphicIndices:p}=n.attributes,a=tt(n.geometry,i,s,this.view),c=t[r].length-1;t[r][h]=[a.x,a.y],n.geometry=a,o&&(h===0?t[r][c]=[a.x,a.y]:h===c&&(t[r][0]=[a.x,a.y]));for(const l of p){const v=this.vertexGraphics.at(l),{pathIndex:_,pointIndex:u}=v.attributes;t[_][u]=[a.x,a.y],v.geometry=a}}return t}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this.view.cursor="default",this._updateTooltip()}_createVertexFromMidpoint(t){const{_graphicAttributes:e,graphic:i}=this,s=i.geometry;if(s==null||s.type!=="polygon"&&s.type!=="polyline")return[];const o=s.clone(),n=[],{pathIndex:r,pointIndexStart:h,pointIndexEnd:p}=t.attributes,{x:a,y:c,z:l}=t.geometry,v=p===0?h+1:p,_=b(o);return _[r].splice(v,0,l!=null?[a,c,l]:[a,c]),t.attributes={...e,pathIndex:r,pointIndex:v,relatedGraphicIndices:[]},n.push({coordinates:_[r][v],componentIndex:r,vertexIndex:v}),this.graphic.geometry=o,n}_addToSelection(t){t instanceof f&&(t=[t]);for(const e of t)e.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(t)),this._emitSelectEvent(t)}_removeFromSelection(t,e){const{vertices:i}=this.symbols,s=e?i.hover:i.default;t instanceof f&&(t=[t]);for(const o of t)this.selectedVertices.splice(this.selectedVertices.indexOf(o),1),this._set("selectedVertices",this.selectedVertices),o.set("symbol",s);this._emitDeselectEvent(t)}_clearSelection(){if(this.selectedVertices.length){const t=this.selectedVertices;for(const e of this.selectedVertices)e.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(t)}}_keyDownHandler(t){J.delete.includes(t.key)&&!t.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(t){const e=this.graphic.geometry;if(e==null||e.type!=="polygon"&&e.type!=="polyline"||e.type==="polygon"&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;t instanceof f&&(t=[t]);const i=this.graphic.clone(),s=e.clone();let o=b(s);const n=[];t instanceof f&&(t=[t]);for(const r of t){const{x:h,y:p}=r.geometry;for(let a=0;a{if(r.length<2)return!1;const[h,p]=r[0],[a,c]=r[r.length-1];return(r.length!==2||h!==a||p!==c)&&(h===a&&p===c||r.push(r[0]),!0)}),s.rings=o;else{for(const r of o)r.length===1&&o.splice(o.indexOf(r),1);s.paths=o}this.graphic.geometry=s,this.refresh(),this._emitVertexRemoveEvent(t,i,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isSelected(t){return this._isVertex(t)&&this.selectedVertices.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){this.view.cursor=this._isMidpoint(t)?"copy":"move"}_updateTooltip(t,e){this._tooltip!=null&&(t?t===this.graphic?this._updateMoveGraphicTooltip(e):this._updateMoveVertexTooltip(e):this._tooltip.clear())}_updateMoveGraphicTooltip(t){const{_tooltip:e,tooltipOptions:i,view:s}=this;if(e==null)return;const o=this._translateGraphicTooltipInfo??(this._translateGraphicTooltipInfo=new ht({tooltipOptions:i}));if(o.clear(),o.tooltipOptions=i,t){const{x:n,y:r}=t.origin,h=s.toMap(t),p=s.toMap(T(n,r)),a=R(p,h);o.distance=a??C}e.info=o}_updateMoveVertexTooltip(t){const{_tooltip:e,graphic:{geometry:i},tooltipOptions:s,view:o}=this;if(e==null)return;const n=this._translateVertexTooltipInfo??(this._translateVertexTooltipInfo=new pt({tooltipOptions:s}));if(n.clear(),n.tooltipOptions=s,(i==null?void 0:i.type)==="polygon"?n.area=ct(i):(i==null?void 0:i.type)==="polyline"&&(n.totalLength=nt(i)),t){const{x:r,y:h}=t.origin,p=o.toMap(t),a=o.toMap(T(r,h)),c=R(a,p);n.distance=c??C}e.info=n}_emitMoveStartEvent(t,e){const i=new mt(this.graphic,t,e);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(t,e){const i=new yt(this.graphic,t,e);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const t=this._activeOperationInfo;if(!t)return;const{totalDx:e,totalDy:i}=t,s=new _t(this.graphic,e,i);this.emit("move-stop",s),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(s)}_emitReshapeStartEvent(t){const e=new lt(this.graphic,t,this.selectedVertices);this.emit("reshape-start",e),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(e)}_emitReshapeEvent(t){const e=new dt(this.graphic,t,this.selectedVertices);this.emit("reshape",e),this.callbacks.onReshape&&this.callbacks.onReshape(e)}_emitReshapeStopEvent(t){const e=new vt(this.graphic,t,this.selectedVertices);this.emit("reshape-stop",e),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(e)}_emitSelectEvent(t){const e=new gt(t);this.emit("select",e),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(e)}_emitDeselectEvent(t){const e=new ut(t);this.emit("deselect",e),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(e)}_emitVertexAddEvent(t,e,i){const s=new xt(t,this.graphic,e,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(t,e,i){const s=new ft(t,this.graphic,e,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){Q.getLogger(this).error(new W("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};m([y()],d.prototype,"_tooltip",void 0),m([y()],d.prototype,"_translateGraphicTooltipInfo",void 0),m([y()],d.prototype,"_translateVertexTooltipInfo",void 0),m([y()],d.prototype,"callbacks",void 0),m([y()],d.prototype,"enableMidpoints",void 0),m([y()],d.prototype,"enableMovement",void 0),m([y()],d.prototype,"enableVertices",void 0),m([y()],d.prototype,"graphic",void 0),m([y({value:!0})],d.prototype,"highlightsEnabled",null),m([y()],d.prototype,"layer",void 0),m([y({readOnly:!0})],d.prototype,"midpointGraphics",void 0),m([y()],d.prototype,"midpointSymbol",void 0),m([y({readOnly:!0})],d.prototype,"selectedVertices",void 0),m([y()],d.prototype,"snappingManager",void 0),m([y({readOnly:!0})],d.prototype,"state",null),m([y()],d.prototype,"symbols",void 0),m([y({type:$})],d.prototype,"tooltipOptions",void 0),m([y({readOnly:!0})],d.prototype,"type",void 0),m([y({readOnly:!0})],d.prototype,"vertexGraphics",void 0),m([y()],d.prototype,"view",void 0),d=m([B("esri.views.draw.support.Reshape")],d);const Lt=d;export{Lt as default}; diff --git a/dist/assets/Reshape-c3RtsBQr.js b/dist/assets/Reshape-c3RtsBQr.js new file mode 100644 index 0000000..e23c2e7 --- /dev/null +++ b/dist/assets/Reshape-c3RtsBQr.js @@ -0,0 +1 @@ +import{x as G,z as F,V as E,A as $,v as U,U as M,B as k,b as S,D,E as L,F as P,G as K,I,J as b,K as f,L as x,M as O,N,O as B,Q as T,w as C,R as J,r as Q,e as m,y,S as q,_ as W,T as X,P as Y,c as Z}from"./index-pCX-0tJH.js";import{S as j}from"./SnappingVisualizer2D-JqQy3X5x.js";import{i as tt}from"./drawUtils-0wb2c6-q.js";import{l as et,U as it}from"./GraphicMover-kaBR5sTE.js";import{d as st}from"./settings-QjT8PN4S.js";import{V as ot}from"./EditGeometryOperations-vpHcsZOg.js";import{e as rt}from"./SnappingContext-ax0tf6c6.js";import{m as R,g as nt,u as at}from"./Tooltip-a9KqLK1p.js";import{r as ht,p as pt}from"./TranslateTooltipInfos-DywsDtXz.js";import{u as ct}from"./automaticAreaMeasurementUtils-kRuWnHc-.js";import"./featureUtils-aSzMyCi0.js";import"./GraphicManipulator-59Uc2I6c.js";import"./drapedUtils-F1ywqHD-.js";import"./PointSnappingHint-bwlQAyn6.js";import"./euclideanLengthMeasurementUtils-Kj2RYqri.js";import"./measurementUtils-69EiqRp6.js";import"./quantityFormatUtils-oYgdvR_2.js";import"./euclideanAreaMeasurementUtils-jpli3_gk.js";class lt{constructor(e,i,s){this.graphic=e,this.mover=i,this.selected=s,this.type="reshape-start"}}class dt{constructor(e,i,s){this.graphic=e,this.mover=i,this.selected=s,this.type="reshape"}}class vt{constructor(e,i,s){this.graphic=e,this.mover=i,this.selected=s,this.type="reshape-stop"}}class mt{constructor(e,i,s){this.mover=e,this.dx=i,this.dy=s,this.type="move-start"}}class yt{constructor(e,i,s){this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class _t{constructor(e,i,s){this.mover=e,this.dx=i,this.dy=s,this.type="move-stop"}}class gt{constructor(e){this.added=e,this.type="vertex-select"}}class ut{constructor(e){this.removed=e,this.type="vertex-deselect"}}class xt{constructor(e,i,s,o){this.added=e,this.graphic=i,this.oldGraphic=s,this.vertices=o,this.type="vertex-add"}}class ft{constructor(e,i,s,o){this.removed=e,this.graphic=i,this.oldGraphic=s,this.vertices=o,this.type="vertex-remove"}}const g=st.reshapeGraphics,Gt={vertices:{default:new G({style:"circle",size:g.vertex.size,color:g.vertex.color,outline:{color:g.vertex.outlineColor,width:1}}),hover:new G({style:"circle",size:g.vertex.hoverSize,color:g.vertex.hoverColor,outline:{color:g.vertex.hoverOutlineColor,width:1}}),selected:new G({style:"circle",size:g.selected.size,color:g.selected.color,outline:{color:g.selected.outlineColor,width:1}})},midpoints:{default:new G({style:"circle",size:g.midpoint.size,color:g.midpoint.color,outline:{color:g.midpoint.outlineColor,width:1}}),hover:new G({style:"circle",size:g.midpoint.size,color:g.midpoint.color,outline:{color:g.midpoint.outlineColor,width:1}})}};let d=class extends F.EventedAccessor{constructor(t){super(t),this._activeOperationInfo=null,this._editGeometryOperations=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingContext=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this._tooltip=null,this._translateGraphicTooltipInfo=null,this._translateVertexTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.layer=null,this.midpointGraphics=new E,this.midpointSymbol=new G({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.symbols=Gt,this.tooltipOptions=new $,this.type="reshape",this.vertexGraphics=new E,this.view=null}initialize(){const t=this.view;this._highlightHelper=new et({view:t}),this._setup(),this.addHandles([U(()=>t==null?void 0:t.ready,()=>{const{layer:e,view:i}=this;q(i,e),this.addHandles(i.on("key-down",s=>this._keyDownHandler(s),W.TOOL))},{once:!0,initial:!0}),M(()=>this.graphic,()=>this.refresh()),M(()=>this.layer,(e,i)=>{i&&(this._clearSelection(),this._resetGraphics(i)),this.refresh()}),M(()=>this.enableMidpoints,()=>this.refresh()),k(()=>this.tooltipOptions.enabled,e=>{this._tooltip=e?new at({view:this.view}):S(this._tooltip)},X),k(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),Y)])}destroy(){var t;this._reset(),(t=this._mover)==null||t.destroy(),this._mover=null,this._tooltip=S(this._tooltip)}set highlightsEnabled(t){var e;(e=this._highlightHelper)==null||e.removeAll(),this._set("highlightsEnabled",t),this._setUpHighlights()}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){const e=[];return this.graphic&&e.push(this.graphic),e.concat(this.vertexGraphics.items,this.midpointGraphics.items),e.length>0&&e.includes(t)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:t,layer:e}=this;if(!e||(t==null?void 0:t.geometry)==null)return;const i=t.geometry;i.type!=="mesh"&&i.type!=="extent"?(i.type==="polygon"&&D(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){var t;this.highlightsEnabled&&this.graphic&&((t=this._highlightHelper)==null||t.add(this.graphic))}_setUpGeometryHelper(){const t=this.graphic.geometry;if(t==null||t.type==="mesh"||t.type==="extent")return void this._logGeometryTypeError();const e=t.type==="multipoint"?new L({paths:t.points,spatialReference:t.spatialReference}):t;this._editGeometryOperations=ot.fromGeometry(e,P.Local)}_saveSnappingContextForHandle(t,e){var i;this._snappingGraphicsLayer=new K({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new rt({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:((i=e.viewEvent)==null?void 0:i.pointerType)||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new j(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){var t;this._clearSelection(),(t=this._highlightHelper)==null||t.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){var t;this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._snappingGraphicsLayer!=null&&((t=this.view)!=null&&t.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=S(this._editGeometryOperations),this._snappingTask=I(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._set("selectedVertices",[])}_removeMidpointGraphics(t){const e=t||this.layer;e&&e.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach(i=>i.destroy()),this.midpointGraphics.removeAll()}_removeVertexGraphics(t){const e=t||this.layer;e&&e.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach(i=>i.destroy()),this.vertexGraphics.removeAll()}_getCoordinatesForUI(t){const e=b(t.clone());if(t.type==="polygon")for(const i of e){const s=i[i.length-1];i[0][0]===s[0]&&i[0][1]===s[1]&&i.length>2&&i.pop()}return e}_setupGraphics(){const t=this.graphic.geometry;if(t!=null&&(t.type==="polyline"||t.type==="polygon")){const e=this._getCoordinatesForUI(t);this.enableMidpoints&&this._setUpMidpointGraphics(e),this.enableVertices&&this._setUpVertexGraphics(e)}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=this._createMidpointGraphics(t);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){this._removeVertexGraphics();const e=this._createVertexGraphics(t);this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}_createVertexGraphics(t){const{_graphicAttributes:e,symbols:i,view:{spatialReference:s}}=this,o=[];return t==null||t.forEach((n,r)=>{n.forEach((h,p)=>{var v;const[a,c,l]=h;o.push(new f({geometry:new x({x:a,y:c,z:l,spatialReference:s}),symbol:(v=i==null?void 0:i.vertices)==null?void 0:v.default,attributes:{...e,pathIndex:r,pointIndex:p}}))})}),o}_createMidpointGraphics(t){const{_graphicAttributes:e,symbols:i,view:{spatialReference:s}}=this,o=[];return t==null||t.forEach((n,r)=>{n.forEach((h,p)=>{var _;const[a,c,l]=h,v=n[p+1]?p+1:0;if(((_=this.graphic.geometry)==null?void 0:_.type)==="polygon"||v!==0){const[u,V,w]=n[v],[H,A,z]=O([a,c,l],[u,V,w]);o.push(new f({geometry:new x({x:H,y:A,z,spatialReference:s}),symbol:i.midpoints.default,attributes:{...e,pathIndex:r,pointIndexStart:p,pointIndexEnd:v}}))}})}),o}_updateSymbolsForTheme(){var e;const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:(e=this.symbols.vertices.hover)==null?void 0:e.clone().set("color",t)},midpoints:{...this.symbols.midpoints}};for(const i of this.vertexGraphics)this._isSelected(i)?i.symbol=this.symbols.vertices.selected:this._hoverGraphic===i?i.symbol=this.symbols.vertices.hover:i.symbol=this.symbols.vertices.default}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:i})=>({x:i.x,y:i.y}));for(let i=0;ithis._onGraphicClickCallback(r),onGraphicMoveStart:r=>this._onGraphicMoveStartCallback(r),onGraphicMove:r=>this._onGraphicMoveCallback(r),onGraphicMoveStop:r=>this._onGraphicMoveStopCallback(r),onGraphicPointerOver:r=>this._onGraphicPointerOverCallback(r),onGraphicPointerOut:r=>this._onGraphicPointerOutCallback(r)}})}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic;if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t);else if(this._isMidpoint(e)){if(t.viewEvent.button===2)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(e);this.refresh(),this._emitVertexAddEvent([e],i,s)}else this._isVertex(e)&&(t.viewEvent.stopPropagation(),t.viewEvent.button===2?this._removeVertices(e):(t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)))}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t;if(s===this.graphic){const{geometry:o}=s;return this._setUpOperation(t),this._emitMoveStartEvent(e,i),void(o!=null&&o.type==="point"&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}if(!this.selectedVertices.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const o=this.graphic.clone(),n=this._createVertexFromMidpoint(s);this._emitVertexAddEvent([s],o,n)}this._addToSelection(s)}this._setUpOperation(t),this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:n}=e,{geometry:r}=o;if(r!=null){if(n!=="move")this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else if(r.type==="point")this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if(r.type==="polyline"||r.type==="polygon"){const h=this._getCoordinatesForUI(r);this._updateVertexGraphicLocations(h),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t,{operationType:n}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>n==="move"?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(t){const e=this.view.spatialReference;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes,[n,r,h]=t[s][o];i.geometry=new x({x:n,y:r,z:h,spatialReference:e})}this._updateMidpointGraphicLocations(t)}_updateMidpointGraphicLocations(t){for(const e of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:o}=e.attributes,[n,r,h]=t[i][s],[p,a,c]=t[i][o],[l,v,_]=O([n,r,h],[p,a,c]);e.geometry=new x({x:l,y:v,z:_,spatialReference:this.view.spatialReference})}}_getIndicesForVertexGraphic({attributes:t}){return[(t==null?void 0:t.pathIndex)||0,(t==null?void 0:t.pointIndex)||0]}_getVertexFromEditGeometry(t){const[e,i]=this._getIndicesForVertexGraphic(t);return this._editGeometryOperations.data.components[e].vertices[i]}_onHandleMove(t,e,i,s,o){I(this._snappingTask);const n=this._snappingContext;if(!n)return;const r=t.geometry,h=s.type==="graphic-move-stop";if(this.snappingManager!=null&&this.selectedVertices.length<2&&!h){const p=this.snappingManager;this._stagedVertex=p.update({point:r,context:n}),this._syncGeometryAfterVertexMove(t,new x(this._stagedVertex),e,i,h),o(),this._snappingTask=N(async a=>{const c=await p.snap({point:r,context:n,signal:a});c.valid&&(this._stagedVertex=c.apply(),this._syncGeometryAfterVertexMove(t,new x(this._stagedVertex),e,i,h),o())})}else{const p=this._stagedVertex!=null?new x(this._stagedVertex):r;this._syncGeometryAfterVertexMove(t,p,e,i,h),o()}}async _syncGeometryAfterVertexMove(t,e,i,s,o=!1){const n=this._editGeometryOperations.data.geometry;if(n.type==="point")t.geometry=e;else if(n.type==="mesh")t.geometry=n.centerAt(e),t.notifyGeometryChanged();else{const{x:r,y:h,z:p}=e,[a,c]=this._getIndicesForVertexGraphic(t);let l=b(n);const v=l[a].length-1,_=p!=null?[r,h,p]:[r,h];l[a][c]=_,n.type==="polygon"&&(c===0?l[a][v]=_:c===v&&(l[a][0]=_)),this._isVertex(t)&&(l=this._moveRelatedCoordinates(l,t,_),l=this._moveSelectedHandleCoordinates(l,t,i,s,n.type==="polygon"),this._updateMidpointGraphicLocations(l)),this.graphic.geometry=n.clone();const u=this._getVertexFromEditGeometry(t),V=r-u.pos[0],w=h-u.pos[1];this._editGeometryOperations.moveVertices([u],V,w,0),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_moveRelatedCoordinates(t,e,i){const{relatedGraphicIndices:s}=e.attributes;for(const o of s){const n=this.vertexGraphics.at(o),{pathIndex:r,pointIndex:h}=n.attributes;t[r][h]=i,n.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){for(const n of this.selectedVertices)if(n!==e){const{pathIndex:r,pointIndex:h,relatedGraphicIndices:p}=n.attributes,a=tt(n.geometry,i,s,this.view),c=t[r].length-1;t[r][h]=[a.x,a.y],n.geometry=a,o&&(h===0?t[r][c]=[a.x,a.y]:h===c&&(t[r][0]=[a.x,a.y]));for(const l of p){const v=this.vertexGraphics.at(l),{pathIndex:_,pointIndex:u}=v.attributes;t[_][u]=[a.x,a.y],v.geometry=a}}return t}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this.view.cursor="default",this._updateTooltip()}_createVertexFromMidpoint(t){const{_graphicAttributes:e,graphic:i}=this,s=i.geometry;if(s==null||s.type!=="polygon"&&s.type!=="polyline")return[];const o=s.clone(),n=[],{pathIndex:r,pointIndexStart:h,pointIndexEnd:p}=t.attributes,{x:a,y:c,z:l}=t.geometry,v=p===0?h+1:p,_=b(o);return _[r].splice(v,0,l!=null?[a,c,l]:[a,c]),t.attributes={...e,pathIndex:r,pointIndex:v,relatedGraphicIndices:[]},n.push({coordinates:_[r][v],componentIndex:r,vertexIndex:v}),this.graphic.geometry=o,n}_addToSelection(t){t instanceof f&&(t=[t]);for(const e of t)e.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(t)),this._emitSelectEvent(t)}_removeFromSelection(t,e){const{vertices:i}=this.symbols,s=e?i.hover:i.default;t instanceof f&&(t=[t]);for(const o of t)this.selectedVertices.splice(this.selectedVertices.indexOf(o),1),this._set("selectedVertices",this.selectedVertices),o.set("symbol",s);this._emitDeselectEvent(t)}_clearSelection(){if(this.selectedVertices.length){const t=this.selectedVertices;for(const e of this.selectedVertices)e.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(t)}}_keyDownHandler(t){B.delete.includes(t.key)&&!t.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(t){const e=this.graphic.geometry;if(e==null||e.type!=="polygon"&&e.type!=="polyline"||e.type==="polygon"&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;t instanceof f&&(t=[t]);const i=this.graphic.clone(),s=e.clone();let o=b(s);const n=[];t instanceof f&&(t=[t]);for(const r of t){const{x:h,y:p}=r.geometry;for(let a=0;a{if(r.length<2)return!1;const[h,p]=r[0],[a,c]=r[r.length-1];return(r.length!==2||h!==a||p!==c)&&(h===a&&p===c||r.push(r[0]),!0)}),s.rings=o;else{for(const r of o)r.length===1&&o.splice(o.indexOf(r),1);s.paths=o}this.graphic.geometry=s,this.refresh(),this._emitVertexRemoveEvent(t,i,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isSelected(t){return this._isVertex(t)&&this.selectedVertices.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){this.view.cursor=this._isMidpoint(t)?"copy":"move"}_updateTooltip(t,e){this._tooltip!=null&&(t?t===this.graphic?this._updateMoveGraphicTooltip(e):this._updateMoveVertexTooltip(e):this._tooltip.clear())}_updateMoveGraphicTooltip(t){const{_tooltip:e,tooltipOptions:i,view:s}=this;if(e==null)return;const o=this._translateGraphicTooltipInfo??(this._translateGraphicTooltipInfo=new ht({tooltipOptions:i}));if(o.clear(),o.tooltipOptions=i,t){const{x:n,y:r}=t.origin,h=s.toMap(t),p=s.toMap(T(n,r)),a=R(p,h);o.distance=a??C}e.info=o}_updateMoveVertexTooltip(t){const{_tooltip:e,graphic:{geometry:i},tooltipOptions:s,view:o}=this;if(e==null)return;const n=this._translateVertexTooltipInfo??(this._translateVertexTooltipInfo=new pt({tooltipOptions:s}));if(n.clear(),n.tooltipOptions=s,(i==null?void 0:i.type)==="polygon"?n.area=ct(i):(i==null?void 0:i.type)==="polyline"&&(n.totalLength=nt(i)),t){const{x:r,y:h}=t.origin,p=o.toMap(t),a=o.toMap(T(r,h)),c=R(a,p);n.distance=c??C}e.info=n}_emitMoveStartEvent(t,e){const i=new mt(this.graphic,t,e);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(t,e){const i=new yt(this.graphic,t,e);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const t=this._activeOperationInfo;if(!t)return;const{totalDx:e,totalDy:i}=t,s=new _t(this.graphic,e,i);this.emit("move-stop",s),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(s)}_emitReshapeStartEvent(t){const e=new lt(this.graphic,t,this.selectedVertices);this.emit("reshape-start",e),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(e)}_emitReshapeEvent(t){const e=new dt(this.graphic,t,this.selectedVertices);this.emit("reshape",e),this.callbacks.onReshape&&this.callbacks.onReshape(e)}_emitReshapeStopEvent(t){const e=new vt(this.graphic,t,this.selectedVertices);this.emit("reshape-stop",e),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(e)}_emitSelectEvent(t){const e=new gt(t);this.emit("select",e),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(e)}_emitDeselectEvent(t){const e=new ut(t);this.emit("deselect",e),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(e)}_emitVertexAddEvent(t,e,i){const s=new xt(t,this.graphic,e,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(t,e,i){const s=new ft(t,this.graphic,e,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){J.getLogger(this).error(new Q("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};m([y()],d.prototype,"_tooltip",void 0),m([y()],d.prototype,"_translateGraphicTooltipInfo",void 0),m([y()],d.prototype,"_translateVertexTooltipInfo",void 0),m([y()],d.prototype,"callbacks",void 0),m([y()],d.prototype,"enableMidpoints",void 0),m([y()],d.prototype,"enableMovement",void 0),m([y()],d.prototype,"enableVertices",void 0),m([y()],d.prototype,"graphic",void 0),m([y({value:!0})],d.prototype,"highlightsEnabled",null),m([y()],d.prototype,"layer",void 0),m([y({readOnly:!0})],d.prototype,"midpointGraphics",void 0),m([y()],d.prototype,"midpointSymbol",void 0),m([y({readOnly:!0})],d.prototype,"selectedVertices",void 0),m([y()],d.prototype,"snappingManager",void 0),m([y({readOnly:!0})],d.prototype,"state",null),m([y()],d.prototype,"symbols",void 0),m([y({type:$})],d.prototype,"tooltipOptions",void 0),m([y({readOnly:!0})],d.prototype,"type",void 0),m([y({readOnly:!0})],d.prototype,"vertexGraphics",void 0),m([y()],d.prototype,"view",void 0),d=m([Z("esri.views.draw.support.Reshape")],d);const Dt=d;export{Dt as default}; diff --git a/dist/assets/Responsive-QKXcW_1q.js b/dist/assets/Responsive-QlPOQ03r.js similarity index 98% rename from dist/assets/Responsive-QKXcW_1q.js rename to dist/assets/Responsive-QlPOQ03r.js index ab0df23..e8c5299 100644 --- a/dist/assets/Responsive-QKXcW_1q.js +++ b/dist/assets/Responsive-QlPOQ03r.js @@ -1 +1 @@ -import{i as s,Z as a,H as g,v as m,Y as c,z as n}from"./Theme-QNc_77AM.js";class h extends s{setupDefaultRules(){super.setupDefaultRules(),this.rule("InterfaceColors").setAll({stroke:a.fromHex(0),fill:a.fromHex(2829099),primaryButton:a.lighten(a.fromHex(6788316),-.2),primaryButtonHover:a.lighten(a.fromHex(6779356),-.2),primaryButtonDown:a.lighten(a.fromHex(6872181),-.2),primaryButtonActive:a.lighten(a.fromHex(6872182),-.2),primaryButtonText:a.fromHex(16777215),primaryButtonStroke:a.lighten(a.fromHex(6788316),-.2),secondaryButton:a.fromHex(3881787),secondaryButtonHover:a.lighten(a.fromHex(3881787),.1),secondaryButtonDown:a.lighten(a.fromHex(3881787),.15),secondaryButtonActive:a.lighten(a.fromHex(3881787),.2),secondaryButtonText:a.fromHex(12303291),secondaryButtonStroke:a.lighten(a.fromHex(3881787),-.2),grid:a.fromHex(12303291),background:a.fromHex(0),alternativeBackground:a.fromHex(16777215),text:a.fromHex(16777215),alternativeText:a.fromHex(0),disabled:a.fromHex(11382189),positive:a.fromHex(5288704),negative:a.fromHex(11730944)})}}const o=h;class t extends s{constructor(){super(...arguments),Object.defineProperty(this,"responsiveRules",{enumerable:!0,configurable:!0,writable:!0,value:[]})}static widthXXS(e,i){return e<=t.XXS}static widthXS(e,i){return e<=t.XS}static widthS(e,i){return e<=t.S}static widthM(e,i){return e<=t.M}static widthL(e,i){return e<=t.L}static widthXL(e,i){return e<=t.XL}static widthXXL(e,i){return e<=t.XXL}static heightXXS(e,i){return i<=t.XXS}static heightXS(e,i){return i<=t.XS}static heightS(e,i){return i<=t.S}static heightM(e,i){return i<=t.M}static heightL(e,i){return i<=t.L}static heightXL(e,i){return i<=t.XL}static heightXXL(e,i){return i<=t.XXL}static isXXS(e,i){return e<=t.XXS&&i<=t.XXS}static isXS(e,i){return e<=t.XS&&i<=t.XS}static isS(e,i){return e<=t.S&&i<=t.S}static isM(e,i){return e<=t.M&&i<=t.M}static isL(e,i){return e<=t.L&&i<=t.L}static isXL(e,i){return e<=t.XL&&i<=t.XL}static isXXL(e,i){return e<=t.XXL&&i<=t.XXL}static maybeXXS(e,i){return e<=t.XXS||i<=t.XXS}static maybeXS(e,i){return e<=t.XS||i<=t.XS}static maybeS(e,i){return e<=t.S||i<=t.S}static maybeM(e,i){return e<=t.M||i<=t.M}static maybeL(e,i){return e<=t.L||i<=t.L}static maybeXL(e,i){return e<=t.XL||i<=t.XL}static maybeXXL(e,i){return e<=t.XXL||i<=t.XXL}static newEmpty(e){return new this(e,!0)}addRule(e){return e.name&&!e.template&&(e.template=this.rule(e.name,e.tags)),e._dp=new g([this._root._rootContainer.onPrivate("width",i=>{this._isUsed()&&this._applyRule(e)}),this._root._rootContainer.onPrivate("height",i=>{this._isUsed()&&this._applyRule(e)})]),this.responsiveRules.push(e),this._applyRule(e),e}removeRule(e){m(this.responsiveRules,e),e._dp&&e._dp.dispose()}_isUsed(){return this._root._rootContainer.get("themes").indexOf(this)!==-1}_applyRule(e){const i=this._root._rootContainer.getPrivate("width"),l=this._root._rootContainer.getPrivate("height"),d=e.relevant.call(e,i,l),r=e.applied;d?r||(e.applied=!0,e.template&&e.settings&&e.template.setAll(e.settings),e.applying&&e.applying.call(e)):r&&(e.applied=!1,e.template&&e.template.removeAll(),e.removing&&e.removing.call(e))}setupDefaultRules(){super.setupDefaultRules();const e=i=>this.addRule(i);e({name:"Chart",relevant:t.widthXXS,settings:{paddingLeft:0,paddingRight:0}}),e({name:"Chart",relevant:t.heightXXS,settings:{paddingTop:0,paddingBottom:0}}),e({name:"Bullet",relevant:t.isXS,settings:{forceHidden:!0}}),e({name:"Legend",relevant:t.isXS,settings:{forceHidden:!0}}),e({name:"HeatLegend",tags:["vertical"],relevant:t.widthXS,settings:{forceHidden:!0}}),e({name:"HeatLegend",tags:["horizontal"],relevant:t.heightXS,settings:{forceHidden:!0}}),e({name:"Label",tags:["heatlegend","start"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"Label",tags:["heatlegend","end"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"Button",tags:["resize"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"AxisRendererX",relevant:t.heightXS,settings:{inside:!0}}),e({name:"AxisRendererY",relevant:t.widthXS,settings:{inside:!0}}),e({name:"AxisRendererXLabel",relevant:t.heightXS,settings:{minPosition:.1,maxPosition:.9}}),e({name:"AxisLabel",tags:["y"],relevant:t.widthXS,settings:{centerY:c,maxPosition:.9}}),e({name:"AxisLabel",tags:["x"],relevant:t.heightXXS,settings:{forceHidden:!0}}),e({name:"AxisLabel",tags:["y"],relevant:t.widthXXS,settings:{forceHidden:!0}}),e({name:"AxisTick",tags:["x"],relevant:t.heightXS,settings:{inside:!0,minPosition:.1,maxPosition:.9}}),e({name:"AxisTick",tags:["y"],relevant:t.widthXXS,settings:{inside:!0,minPosition:.1,maxPosition:.9}}),e({name:"Grid",relevant:t.maybeXXS,settings:{forceHidden:!0}}),e({name:"RadialLabel",tags:["radial"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"RadialLabel",tags:["circular"],relevant:t.maybeS,settings:{inside:!0}}),e({name:"AxisTick",relevant:t.maybeS,settings:{inside:!0}}),e({name:"RadialLabel",tags:["circular"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"AxisTick",tags:["circular"],relevant:t.maybeXS,settings:{inside:!0}}),e({name:"PieChart",relevant:t.maybeXS,settings:{radius:n(99)}}),e({name:"PieChart",relevant:t.widthM,settings:{radius:n(99)}}),e({name:"RadialLabel",tags:["pie"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"RadialLabel",tags:["pie"],relevant:t.widthM,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pie"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pie"],relevant:t.widthM,settings:{forceHidden:!0}}),e({name:"FunnelSeries",relevant:t.widthM,settings:{alignLabels:!1}}),e({name:"Label",tags:["funnel","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Tick",tags:["funnel","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Label",tags:["funnel","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"Tick",tags:["funnel","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"PyramidSeries",relevant:t.widthM,settings:{alignLabels:!1}}),e({name:"Label",tags:["pyramid","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pyramid","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Label",tags:["pyramid","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pyramid","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"PictorialStackedSeries",relevant:t.widthM,settings:{alignLabels:!1}}),e({name:"Label",tags:["pictorial","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pictorial","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Label",tags:["pictorial","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pictorial","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"Label",tags:["flow","horizontal"],relevant:t.widthS,settings:{forceHidden:!0}}),e({name:"Label",tags:["flow","vertical"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"Chord",relevant:t.maybeXS,settings:{radius:n(99)}}),e({name:"Label",tags:["hierarchy","node"],relevant:t.maybeXS,settings:{forceHidden:!0}})}}Object.defineProperty(t,"XXS",{enumerable:!0,configurable:!0,writable:!0,value:100}),Object.defineProperty(t,"XS",{enumerable:!0,configurable:!0,writable:!0,value:200}),Object.defineProperty(t,"S",{enumerable:!0,configurable:!0,writable:!0,value:300}),Object.defineProperty(t,"M",{enumerable:!0,configurable:!0,writable:!0,value:400}),Object.defineProperty(t,"L",{enumerable:!0,configurable:!0,writable:!0,value:600}),Object.defineProperty(t,"XL",{enumerable:!0,configurable:!0,writable:!0,value:800}),Object.defineProperty(t,"XXL",{enumerable:!0,configurable:!0,writable:!0,value:1e3});const v=t;export{v as d,o as l}; +import{i as s,Z as a,H as g,v as m,Y as c,z as n}from"./Theme-5CV7oVsW.js";class h extends s{setupDefaultRules(){super.setupDefaultRules(),this.rule("InterfaceColors").setAll({stroke:a.fromHex(0),fill:a.fromHex(2829099),primaryButton:a.lighten(a.fromHex(6788316),-.2),primaryButtonHover:a.lighten(a.fromHex(6779356),-.2),primaryButtonDown:a.lighten(a.fromHex(6872181),-.2),primaryButtonActive:a.lighten(a.fromHex(6872182),-.2),primaryButtonText:a.fromHex(16777215),primaryButtonStroke:a.lighten(a.fromHex(6788316),-.2),secondaryButton:a.fromHex(3881787),secondaryButtonHover:a.lighten(a.fromHex(3881787),.1),secondaryButtonDown:a.lighten(a.fromHex(3881787),.15),secondaryButtonActive:a.lighten(a.fromHex(3881787),.2),secondaryButtonText:a.fromHex(12303291),secondaryButtonStroke:a.lighten(a.fromHex(3881787),-.2),grid:a.fromHex(12303291),background:a.fromHex(0),alternativeBackground:a.fromHex(16777215),text:a.fromHex(16777215),alternativeText:a.fromHex(0),disabled:a.fromHex(11382189),positive:a.fromHex(5288704),negative:a.fromHex(11730944)})}}const o=h;class t extends s{constructor(){super(...arguments),Object.defineProperty(this,"responsiveRules",{enumerable:!0,configurable:!0,writable:!0,value:[]})}static widthXXS(e,i){return e<=t.XXS}static widthXS(e,i){return e<=t.XS}static widthS(e,i){return e<=t.S}static widthM(e,i){return e<=t.M}static widthL(e,i){return e<=t.L}static widthXL(e,i){return e<=t.XL}static widthXXL(e,i){return e<=t.XXL}static heightXXS(e,i){return i<=t.XXS}static heightXS(e,i){return i<=t.XS}static heightS(e,i){return i<=t.S}static heightM(e,i){return i<=t.M}static heightL(e,i){return i<=t.L}static heightXL(e,i){return i<=t.XL}static heightXXL(e,i){return i<=t.XXL}static isXXS(e,i){return e<=t.XXS&&i<=t.XXS}static isXS(e,i){return e<=t.XS&&i<=t.XS}static isS(e,i){return e<=t.S&&i<=t.S}static isM(e,i){return e<=t.M&&i<=t.M}static isL(e,i){return e<=t.L&&i<=t.L}static isXL(e,i){return e<=t.XL&&i<=t.XL}static isXXL(e,i){return e<=t.XXL&&i<=t.XXL}static maybeXXS(e,i){return e<=t.XXS||i<=t.XXS}static maybeXS(e,i){return e<=t.XS||i<=t.XS}static maybeS(e,i){return e<=t.S||i<=t.S}static maybeM(e,i){return e<=t.M||i<=t.M}static maybeL(e,i){return e<=t.L||i<=t.L}static maybeXL(e,i){return e<=t.XL||i<=t.XL}static maybeXXL(e,i){return e<=t.XXL||i<=t.XXL}static newEmpty(e){return new this(e,!0)}addRule(e){return e.name&&!e.template&&(e.template=this.rule(e.name,e.tags)),e._dp=new g([this._root._rootContainer.onPrivate("width",i=>{this._isUsed()&&this._applyRule(e)}),this._root._rootContainer.onPrivate("height",i=>{this._isUsed()&&this._applyRule(e)})]),this.responsiveRules.push(e),this._applyRule(e),e}removeRule(e){m(this.responsiveRules,e),e._dp&&e._dp.dispose()}_isUsed(){return this._root._rootContainer.get("themes").indexOf(this)!==-1}_applyRule(e){const i=this._root._rootContainer.getPrivate("width"),l=this._root._rootContainer.getPrivate("height"),d=e.relevant.call(e,i,l),r=e.applied;d?r||(e.applied=!0,e.template&&e.settings&&e.template.setAll(e.settings),e.applying&&e.applying.call(e)):r&&(e.applied=!1,e.template&&e.template.removeAll(),e.removing&&e.removing.call(e))}setupDefaultRules(){super.setupDefaultRules();const e=i=>this.addRule(i);e({name:"Chart",relevant:t.widthXXS,settings:{paddingLeft:0,paddingRight:0}}),e({name:"Chart",relevant:t.heightXXS,settings:{paddingTop:0,paddingBottom:0}}),e({name:"Bullet",relevant:t.isXS,settings:{forceHidden:!0}}),e({name:"Legend",relevant:t.isXS,settings:{forceHidden:!0}}),e({name:"HeatLegend",tags:["vertical"],relevant:t.widthXS,settings:{forceHidden:!0}}),e({name:"HeatLegend",tags:["horizontal"],relevant:t.heightXS,settings:{forceHidden:!0}}),e({name:"Label",tags:["heatlegend","start"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"Label",tags:["heatlegend","end"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"Button",tags:["resize"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"AxisRendererX",relevant:t.heightXS,settings:{inside:!0}}),e({name:"AxisRendererY",relevant:t.widthXS,settings:{inside:!0}}),e({name:"AxisRendererXLabel",relevant:t.heightXS,settings:{minPosition:.1,maxPosition:.9}}),e({name:"AxisLabel",tags:["y"],relevant:t.widthXS,settings:{centerY:c,maxPosition:.9}}),e({name:"AxisLabel",tags:["x"],relevant:t.heightXXS,settings:{forceHidden:!0}}),e({name:"AxisLabel",tags:["y"],relevant:t.widthXXS,settings:{forceHidden:!0}}),e({name:"AxisTick",tags:["x"],relevant:t.heightXS,settings:{inside:!0,minPosition:.1,maxPosition:.9}}),e({name:"AxisTick",tags:["y"],relevant:t.widthXXS,settings:{inside:!0,minPosition:.1,maxPosition:.9}}),e({name:"Grid",relevant:t.maybeXXS,settings:{forceHidden:!0}}),e({name:"RadialLabel",tags:["radial"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"RadialLabel",tags:["circular"],relevant:t.maybeS,settings:{inside:!0}}),e({name:"AxisTick",relevant:t.maybeS,settings:{inside:!0}}),e({name:"RadialLabel",tags:["circular"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"AxisTick",tags:["circular"],relevant:t.maybeXS,settings:{inside:!0}}),e({name:"PieChart",relevant:t.maybeXS,settings:{radius:n(99)}}),e({name:"PieChart",relevant:t.widthM,settings:{radius:n(99)}}),e({name:"RadialLabel",tags:["pie"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"RadialLabel",tags:["pie"],relevant:t.widthM,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pie"],relevant:t.maybeXS,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pie"],relevant:t.widthM,settings:{forceHidden:!0}}),e({name:"FunnelSeries",relevant:t.widthM,settings:{alignLabels:!1}}),e({name:"Label",tags:["funnel","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Tick",tags:["funnel","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Label",tags:["funnel","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"Tick",tags:["funnel","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"PyramidSeries",relevant:t.widthM,settings:{alignLabels:!1}}),e({name:"Label",tags:["pyramid","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pyramid","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Label",tags:["pyramid","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pyramid","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"PictorialStackedSeries",relevant:t.widthM,settings:{alignLabels:!1}}),e({name:"Label",tags:["pictorial","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pictorial","vertical"],relevant:t.widthL,settings:{forceHidden:!0}}),e({name:"Label",tags:["pictorial","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"Tick",tags:["pictorial","horizontal"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"Label",tags:["flow","horizontal"],relevant:t.widthS,settings:{forceHidden:!0}}),e({name:"Label",tags:["flow","vertical"],relevant:t.heightS,settings:{forceHidden:!0}}),e({name:"Chord",relevant:t.maybeXS,settings:{radius:n(99)}}),e({name:"Label",tags:["hierarchy","node"],relevant:t.maybeXS,settings:{forceHidden:!0}})}}Object.defineProperty(t,"XXS",{enumerable:!0,configurable:!0,writable:!0,value:100}),Object.defineProperty(t,"XS",{enumerable:!0,configurable:!0,writable:!0,value:200}),Object.defineProperty(t,"S",{enumerable:!0,configurable:!0,writable:!0,value:300}),Object.defineProperty(t,"M",{enumerable:!0,configurable:!0,writable:!0,value:400}),Object.defineProperty(t,"L",{enumerable:!0,configurable:!0,writable:!0,value:600}),Object.defineProperty(t,"XL",{enumerable:!0,configurable:!0,writable:!0,value:800}),Object.defineProperty(t,"XXL",{enumerable:!0,configurable:!0,writable:!0,value:1e3});const v=t;export{v as d,o as l}; diff --git a/dist/assets/RightAngleQuadVisualElement-y_W8r903.js b/dist/assets/RightAngleQuadVisualElement-Jj11oqLR.js similarity index 73% rename from dist/assets/RightAngleQuadVisualElement-y_W8r903.js rename to dist/assets/RightAngleQuadVisualElement-Jj11oqLR.js index aef0a3b..7a3b58b 100644 --- a/dist/assets/RightAngleQuadVisualElement-y_W8r903.js +++ b/dist/assets/RightAngleQuadVisualElement-Jj11oqLR.js @@ -1 +1 @@ -import{aa as d,b2 as h,bi as _,b5 as p,az as m,aF as O,aU as b,aE as u,bu as f,b6 as M,aq as R,bv as g,b7 as x,d as S,b8 as w,at as v,br as c,bw as z,bx as D,bg as $,by as q,bf as j,bz as G,bA as T,bB as C}from"./index-J0iiHjMT.js";import{t as F}from"./EngineVisualElement-eZNKTKsI.js";class H extends F{constructor(e){super(e),this._maxSize=0,this._position=d(),this._up=d(),this._right=d(),this._renderOccluded=h.OccludeAndTransparent,this._color=_(1,0,0,1),this._outlineColor=_(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=h.Opaque,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:t=>this._createObject3DResources(t),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:t=>this._destroyDrapedResources(t)}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get color(){return this._color}set color(e){p(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){p(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=this._outlineSize===0!=(e===0);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:r}){this._maxSize=Math.min(m(t,e),m(t,r))/3,O(this._up,b(this._up,e,t)),O(this._right,b(this._right,r,t)),u(this._position,t),this.recreateGeometry()}_createObject3DResources(e){const t=new f(this._quadMaterialParameters),r=this._outlineSize===0?void 0:new M(this._outlineMaterialParameters);return this._createObject3DGeometries(e,t,r),{quadMaterial:t,outlineMaterial:r,forEach:s=>{s(t),r&&s(r)}}}_createObject3DGeometries(e,t,r){if(R(this._up,g)&&R(this._right,g))return;const s=this._createGeometries(t,r);for(const o of s)e.addGeometry(o);this._updateTransformObject3D(e)}_createDrapedResources(){const e=new f(this._quadMaterialParameters),t=this._outlineSize===0?void 0:new M(this._outlineMaterialParameters),r=this._createGeometries(e,t).map(s=>new x(s));return this._setTransformDraped(r),{quadMaterial:e,outlineMaterial:t,geometries:r,pixelRatioHandle:S(()=>this.view.state.contentPixelRatio,()=>{this.drapedResources.recreateGeometry()})}}_destroyDrapedResources(e){e.pixelRatioHandle.remove(),e.geometries=[]}_createGeometries(e,t){const{up:r,right:s,corner:o}=this._getVertices(),a=this._quadGeometryData(r,s,o,e);return t?[a,w(t,[r,o,s])]:[a]}_getVertices(){let e=this._up,t=this._right;const r=v(c.get(),e,t);return this.isDraped&&(e=u(c.get(),e),t=u(c.get(),t),e[2]=0,t[2]=0,r[2]=0),{up:e,right:t,corner:r}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;const t=this.view.state.camera,r=this._size*t.computeScreenPixelSizeAt(this._position),s=Math.min(this._maxSize,r);z(i,this._position),D(i,i,[s,s,s]),e.transformation=i}_setTransformDraped(e){if(e.length===0)return;const{view:{basemapTerrain:{overlayManager:t},state:{contentPixelRatio:r}}}=this,{_position:s,_size:o}=this,a=u(c.get(),s);a[2]=$;const n=I;n.spatialReference=t.renderer.spatialReference,n.x=a[0],n.y=a[1];const P=o*(this.view.overlayPixelSizeInMapUnits(n)*r),l=Math.min(this._maxSize,P);z(i,a),D(i,i,[l,l,1]);for(const y of e)y.transformation=i}_quadGeometryData(e,t,r,s){return new q(s,[[j.POSITION,new G([0,0,0,...t,...e,...r],[0,1,2,1,2,3],3,!0)]])}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateQuadMaterial(){var e,t;(e=this.object3dResources.resources)==null||e.quadMaterial.setParameters(this._quadMaterialParameters),(t=this.drapedResources.resources)==null||t.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,isDecoration:this.isDecoration}}_updateOutlineMaterial(){var e,t,r,s;(t=(e=this.object3dResources.resources)==null?void 0:e.outlineMaterial)==null||t.setParameters(this._outlineMaterialParameters),(s=(r=this.drapedResources.resources)==null?void 0:r.outlineMaterial)==null||s.setParameters(this._outlineMaterialParameters)}}const i=T(),I=C(0,0,void 0,null);export{H as z}; +import{a8 as d,b2 as h,bA as _,b8 as p,by as m,bL as b,b4 as O,b3 as u,bM as M,b9 as R,b6 as f,bN as g,ba as S,B as x,bb as w,bO as $,bI as c,bP as z,bQ as D,bj as j,bR as v,bi as q,bS as T,bT as G,bU as C}from"./index-pCX-0tJH.js";import{t as I}from"./EngineVisualElement-u0-BOxGn.js";class N extends I{constructor(e){super(e),this._maxSize=0,this._position=d(),this._up=d(),this._right=d(),this._renderOccluded=h.OccludeAndTransparent,this._color=_(1,0,0,1),this._outlineColor=_(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=h.Opaque,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:t=>this._createObject3DResources(t),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:t=>this._destroyDrapedResources(t)}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get color(){return this._color}set color(e){p(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){p(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=this._outlineSize===0!=(e===0);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:r}){this._maxSize=Math.min(m(t,e),m(t,r))/3,b(this._up,O(this._up,e,t)),b(this._right,O(this._right,r,t)),u(this._position,t),this.recreateGeometry()}_createObject3DResources(e){const t=new M(this._quadMaterialParameters),r=this._outlineSize===0?void 0:new R(this._outlineMaterialParameters);return this._createObject3DGeometries(e,t,r),{quadMaterial:t,outlineMaterial:r,forEach:s=>{s(t),r&&s(r)}}}_createObject3DGeometries(e,t,r){if(f(this._up,g)&&f(this._right,g))return;const s=this._createGeometries(t,r);for(const o of s)e.addGeometry(o);this._updateTransformObject3D(e)}_createDrapedResources(){const e=new M(this._quadMaterialParameters),t=this._outlineSize===0?void 0:new R(this._outlineMaterialParameters),r=this._createGeometries(e,t).map(s=>new S(s));return this._setTransformDraped(r),{quadMaterial:e,outlineMaterial:t,geometries:r,pixelRatioHandle:x(()=>this.view.state.contentPixelRatio,()=>{this.drapedResources.recreateGeometry()})}}_destroyDrapedResources(e){e.pixelRatioHandle.remove(),e.geometries=[]}_createGeometries(e,t){const{up:r,right:s,corner:o}=this._getVertices(),a=this._quadGeometryData(r,s,o,e);return t?[a,w(t,[r,o,s])]:[a]}_getVertices(){let e=this._up,t=this._right;const r=$(c.get(),e,t);return this.isDraped&&(e=u(c.get(),e),t=u(c.get(),t),e[2]=0,t[2]=0,r[2]=0),{up:e,right:t,corner:r}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;const t=this.view.state.camera,r=this._size*t.computeScreenPixelSizeAt(this._position),s=Math.min(this._maxSize,r);z(i,this._position),D(i,i,[s,s,s]),e.transformation=i}_setTransformDraped(e){if(e.length===0)return;const{view:{basemapTerrain:{overlayManager:t},state:{contentPixelRatio:r}}}=this,{_position:s,_size:o}=this,a=u(c.get(),s);a[2]=j;const n=Q;n.spatialReference=t.renderer.spatialReference,n.x=a[0],n.y=a[1];const P=o*(this.view.overlayPixelSizeInMapUnits(n)*r),l=Math.min(this._maxSize,P);z(i,a),D(i,i,[l,l,1]);for(const y of e)y.transformation=i}_quadGeometryData(e,t,r,s){return new v(s,[[q.POSITION,new T([0,0,0,...t,...e,...r],[0,1,2,1,2,3],3,!0)]])}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateQuadMaterial(){var e,t;(e=this.object3dResources.resources)==null||e.quadMaterial.setParameters(this._quadMaterialParameters),(t=this.drapedResources.resources)==null||t.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,isDecoration:this.isDecoration}}_updateOutlineMaterial(){var e,t,r,s;(t=(e=this.object3dResources.resources)==null?void 0:e.outlineMaterial)==null||t.setParameters(this._outlineMaterialParameters),(s=(r=this.drapedResources.resources)==null?void 0:r.outlineMaterial)==null||s.setParameters(this._outlineMaterialParameters)}}const i=G(),Q=C(0,0,void 0,null);export{N as z}; diff --git a/dist/assets/RouteLayer-GamYzZdr.js b/dist/assets/RouteLayer-HsRHI0PF.js similarity index 78% rename from dist/assets/RouteLayer-GamYzZdr.js rename to dist/assets/RouteLayer-HsRHI0PF.js index 8d0943b..7f2b33e 100644 --- a/dist/assets/RouteLayer-GamYzZdr.js +++ b/dist/assets/RouteLayer-HsRHI0PF.js @@ -1,2 +1,2 @@ -import{e as r,y as s,mv as C,c as A,dr as L,J as V,a8 as he,bX as nt,iw as I,dt as P,du as q,Z as Ze,E as M,f_ as fe,bW as re,pc as Se,nC as at,dZ as Ve,dp as ze,T as Ke,S as K,N as be,dT as He,ar as W,e3 as Qe,bN as lt,ua as ut,dq as Pe,dx as pt,dy as ct,g0 as yt,ub as dt,V as O,dK as mt,dO as ft,dM as ht,dN as vt,dP as wt,fl as gt,dD as St,hq as bt,eV as Ce,dS as Je,u7 as Tt,bV as Bt,bR as Nt,bS as Pt,h as Rt,bT as $t,f as It,ja as At,iv as Ot,fd as jt,e1 as Lt,hx as Dt,c7 as Mt}from"./index-J0iiHjMT.js";import{U as H,y as Re,s as Ct,R as Jt,r as Xe,a as $e,b as _t,n as kt,o as xt,w as Ft,d as Et,D as _e,e as Gt,k as Ut,i as qt,f as Wt,l as Zt,m as oe,c as se,C as X,T as Y,j as ee,O as te,S as le,g as Vt}from"./Stop-W76EJiT2.js";import{d as E}from"./FeatureSet-d4S1oKME.js";let G=class extends L{constructor(t){super(t),this.break=new V({color:[255,255,255],size:12,outline:{color:[0,122,194],width:3}}),this.first=new V({color:[0,255,0],size:20,outline:{color:[255,255,255],width:4}}),this.unlocated=new V({color:[255,0,0],size:12,outline:{color:[255,255,255],width:3}}),this.last=new V({color:[255,0,0],size:20,outline:{color:[255,255,255],width:4}}),this.middle=new V({color:[51,51,51],size:12,outline:{color:[0,122,194],width:3}}),this.waypoint=new V({color:[255,255,255],size:12,outline:{color:[0,122,194],width:3}})}};r([s({types:C})],G.prototype,"break",void 0),r([s({types:C})],G.prototype,"first",void 0),r([s({types:C})],G.prototype,"unlocated",void 0),r([s({types:C})],G.prototype,"last",void 0),r([s({types:C})],G.prototype,"middle",void 0),r([s({types:C})],G.prototype,"waypoint",void 0),G=r([A("esri.layers.support.RouteStopSymbols")],G);const Ye=G;let x=class extends L{constructor(t){super(t),this.directionLines=new he({color:[0,122,194],width:6}),this.directionPoints=new V({color:[255,255,255],size:6,outline:{color:[0,122,194],width:2}}),this.pointBarriers=new V({style:"x",size:10,outline:{color:[255,0,0],width:3}}),this.polygonBarriers=new nt({color:[255,170,0,.6],outline:{width:7.5,color:[255,0,0,.6]}}),this.polylineBarriers=new he({width:7.5,color:[255,85,0,.7]}),this.routeInfo=new he({width:8,color:[20,89,127]}),this.stops=new Ye}};r([s({types:C})],x.prototype,"directionLines",void 0),r([s({types:C})],x.prototype,"directionPoints",void 0),r([s({types:C})],x.prototype,"pointBarriers",void 0),r([s({types:C})],x.prototype,"polygonBarriers",void 0),r([s({types:C})],x.prototype,"polylineBarriers",void 0),r([s({types:C})],x.prototype,"routeInfo",void 0),r([s({type:Ye})],x.prototype,"stops",void 0),x=r([A("esri.layers.support.RouteSymbols")],x);const et=x;let _=class extends L{constructor(t){super(t),this.dataType=null,this.name=null,this.parameterNames=null,this.restrictionUsageParameterName=null,this.timeNeutralAttributeName=null,this.trafficSupport=null,this.units=null,this.usageType=null}};r([s({type:String})],_.prototype,"dataType",void 0),r([I(H,{ignoreUnknown:!1})],_.prototype,"name",void 0),r([s({type:[String]})],_.prototype,"parameterNames",void 0),r([s({type:String})],_.prototype,"restrictionUsageParameterName",void 0),r([I(Re,{ignoreUnknown:!1})],_.prototype,"timeNeutralAttributeName",void 0),r([s({type:String})],_.prototype,"trafficSupport",void 0),r([I(Ct)],_.prototype,"units",void 0),r([I(Jt)],_.prototype,"usageType",void 0),_=r([A("esri.rest.support.NetworkAttribute")],_);const zt=_;let Z=class extends L{constructor(t){super(t),this.buildTime=null,this.name=null,this.networkAttributes=null,this.networkSources=null,this.state=null}};r([s({type:Number})],Z.prototype,"buildTime",void 0),r([s({type:String})],Z.prototype,"name",void 0),r([s({type:[zt]})],Z.prototype,"networkAttributes",void 0),r([s()],Z.prototype,"networkSources",void 0),r([s({type:String})],Z.prototype,"state",void 0),Z=r([A("esri.rest.support.NetworkDataset")],Z);const Kt=Z;let $=class extends L{constructor(t){super(t),this.accumulateAttributeNames=null,this.attributeParameterValues=null,this.currentVersion=null,this.defaultTravelMode=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsSupportedLanguages=null,this.directionsTimeAttribute=null,this.hasZ=null,this.impedance=null,this.networkDataset=null,this.supportedTravelModes=null}readAccumulateAttributes(t){return t==null?null:t.map(o=>H.fromJSON(o))}writeAccumulateAttributes(t,o,i){t!=null&&t.length&&(o[i]=t.map(n=>H.toJSON(n)))}readDefaultTravelMode(t,o){var n,p;const i=((n=o.supportedTravelModes)==null?void 0:n.find(({id:l})=>l===o.defaultTravelMode))??((p=o.supportedTravelModes)==null?void 0:p.find(({itemId:l})=>l===o.defaultTravelMode));return i?$e.fromJSON(i):null}};r([s()],$.prototype,"accumulateAttributeNames",void 0),r([P("accumulateAttributeNames")],$.prototype,"readAccumulateAttributes",null),r([q("accumulateAttributeNames")],$.prototype,"writeAccumulateAttributes",null),r([s()],$.prototype,"attributeParameterValues",void 0),r([s()],$.prototype,"currentVersion",void 0),r([s()],$.prototype,"defaultTravelMode",void 0),r([P("defaultTravelMode",["defaultTravelMode","supportedTravelModes"])],$.prototype,"readDefaultTravelMode",null),r([s()],$.prototype,"directionsLanguage",void 0),r([I(Xe)],$.prototype,"directionsLengthUnits",void 0),r([s()],$.prototype,"directionsSupportedLanguages",void 0),r([I(Re,{ignoreUnknown:!1})],$.prototype,"directionsTimeAttribute",void 0),r([s()],$.prototype,"hasZ",void 0),r([I(H,{ignoreUnknown:!1})],$.prototype,"impedance",void 0),r([s({type:Kt})],$.prototype,"networkDataset",void 0),r([s({type:[$e]})],$.prototype,"supportedTravelModes",void 0),$=r([A("esri.rest.support.NetworkServiceDescription")],$);const Ht=$,Qt=Ze.getLogger("esri.rest.networkService");function ue(e,t,o,i){i[o]=[t.length,t.length+e.length],e.forEach(n=>{t.push(n.geometry)})}function Xt(e,t){for(let o=0;o=10.4?tr(e,t,o):er(e,o),{defaultTravelMode:l,supportedTravelModes:c}=await p;return n.defaultTravelMode=l,n.supportedTravelModes=c,Ht.fromJSON(n)}async function er(e,t){var w,d,a;const o=fe({f:"json"},t),{data:i}=await re(e.replace(/\/rest\/.*$/i,"/info"),o);if(!(i!=null&&i.owningSystemUrl))return{supportedTravelModes:[],defaultTravelMode:null};const{owningSystemUrl:n}=i,p=Se(n)+"/sharing/rest/portals/self",{data:l}=await re(p,o),c=at("helperServices.routingUtilities.url",l);if(!c)return{supportedTravelModes:[],defaultTravelMode:null};const v=Ve(n),S=/\/solve$/i.test(v.path)?"Route":/\/solveclosestfacility$/i.test(v.path)?"ClosestFacility":"ServiceAreas",u=fe({f:"json",serviceName:S},t),b=Se(c)+"/GetTravelModes/execute",N=await re(b,u),B=[];let h=null;if((d=(w=N==null?void 0:N.data)==null?void 0:w.results)!=null&&d.length){const T=N.data.results;for(const f of T)if(f.paramName==="supportedTravelModes"){if((a=f.value)!=null&&a.features){for(const{attributes:R}of f.value.features)if(R){const J=JSON.parse(R.TravelMode);B.push(J)}}}else f.paramName==="defaultTravelMode"&&(h=f.value)}return{supportedTravelModes:B,defaultTravelMode:h}}async function tr(e,t,o){try{const i=fe({f:"json",token:t},o),n=Se(e)+"/retrieveTravelModes",{data:{supportedTravelModes:p,defaultTravelMode:l}}=await re(n,i);return{supportedTravelModes:p,defaultTravelMode:l}}catch(i){throw new M("network-service:retrieveTravelModes","Could not get to the NAServer's retrieveTravelModes.",{error:i})}}const ke=new ze({esriJobMessageTypeInformative:"informative",esriJobMessageTypeProcessDefinition:"process-definition",esriJobMessageTypeProcessStart:"process-start",esriJobMessageTypeProcessStop:"process-stop",esriJobMessageTypeWarning:"warning",esriJobMessageTypeError:"error",esriJobMessageTypeEmpty:"empty",esriJobMessageTypeAbort:"abort"});let ie=class extends L{constructor(t){super(t),this.description=null,this.type=null}};r([s({type:String,json:{write:!0}})],ie.prototype,"description",void 0),r([s({type:String,json:{read:ke.read,write:ke.write}})],ie.prototype,"type",void 0),ie=r([A("esri.rest.support.GPMessage")],ie);const rr=ie,xe=new ze({0:"informative",1:"process-definition",2:"process-start",3:"process-stop",50:"warning",100:"error",101:"empty",200:"abort"});let de=class extends rr{constructor(t){super(t),this.type=null}};r([s({type:String,json:{read:xe.read,write:xe.write}})],de.prototype,"type",void 0),de=r([A("esri.rest.support.NAMessage")],de);const or=de;let ne=class extends L{constructor(t){super(t)}};r([s({json:{read:{source:"string"}}})],ne.prototype,"text",void 0),r([I(_t,{name:"stringType"})],ne.prototype,"type",void 0),ne=r([A("esri.rest.support.DirectionsString")],ne);const rt=ne;let U=class extends L{constructor(t){super(t),this.arriveTime=null,this.arriveTimeOffset=null,this.geometry=null,this.strings=null}readArriveTimeOffset(t,o){return kt(o.ETA,o.arriveTimeUTC)}readGeometry(t,o){return Ke.fromJSON(o.point)}};r([s({type:Date,json:{read:{source:"arriveTimeUTC"}}})],U.prototype,"arriveTime",void 0),r([s()],U.prototype,"arriveTimeOffset",void 0),r([P("arriveTimeOffset",["arriveTimeUTC","ETA"])],U.prototype,"readArriveTimeOffset",null),r([s({type:Ke})],U.prototype,"geometry",void 0),r([P("geometry",["point"])],U.prototype,"readGeometry",null),r([s({type:[rt]})],U.prototype,"strings",void 0),U=r([A("esri.rest.support.DirectionsEvent")],U);const sr=U;function ir(e){if(e==null||e==="")return null;let t=0,o=0,i=0,n=0;const p=[];let l,c,v,S,u,b,N,B,h=0,w=0,d=0;if(u=e.match(/((\+|\-)[^\+\-\|]+|\|)/g),u||(u=[]),parseInt(u[h],32)===0){h=2;const a=parseInt(u[h],32);h++,b=parseInt(u[h],32),h++,1&a&&(w=u.indexOf("|")+1,N=parseInt(u[w],32),w++),2&a&&(d=u.indexOf("|",w)+1,B=parseInt(u[d],32),d++)}else b=parseInt(u[h],32),h++;for(;h0,hasM:d>0}}let Q=class extends K{constructor(e){super(e),this.events=null,this.strings=null}readGeometry(e,t){const o=ir(t.compressedGeometry);return o!=null?be.fromJSON(o):null}};r([s({type:[sr]})],Q.prototype,"events",void 0),r([P("geometry",["compressedGeometry"])],Q.prototype,"readGeometry",null),r([s({type:[rt]})],Q.prototype,"strings",void 0),Q=r([A("esri.rest.support.DirectionsFeature")],Q);const nr=Q;function ar(e,t){if(e.length===0)return new be({spatialReference:t});const o=[];for(const l of e)for(const c of l.paths)o.push(...c);const i=[];o.forEach((l,c)=>{c!==0&&l[0]===o[c-1][0]&&l[1]===o[c-1][1]||i.push(l)});const{hasM:n,hasZ:p}=e[0];return new be({hasM:n,hasZ:p,paths:[i],spatialReference:t})}let j=class extends E{constructor(t){super(t),this.extent=null,this.features=[],this.geometryType="polyline",this.routeId=null,this.routeName=null,this.totalDriveTime=null,this.totalLength=null,this.totalTime=null}readFeatures(t,o){if(!t)return[];const i=o.summary.envelope.spatialReference??o.spatialReference,n=i&&W.fromJSON(i);return t.map(p=>{const l=nr.fromJSON(p);if(l.geometry!=null&&(l.geometry.spatialReference=n),l.events!=null)for(const c of l.events)c.geometry!=null&&(c.geometry.spatialReference=n);return l})}get mergedGeometry(){return this.features?ar(this.features.map(({geometry:t})=>t),this.extent.spatialReference):null}get strings(){return this.features.flatMap(({strings:t})=>t).filter(Qe)}};r([s({type:He,json:{read:{source:"summary.envelope"}}})],j.prototype,"extent",void 0),r([s({nonNullable:!0})],j.prototype,"features",void 0),r([P("features")],j.prototype,"readFeatures",null),r([s()],j.prototype,"geometryType",void 0),r([s({readOnly:!0})],j.prototype,"mergedGeometry",null),r([s()],j.prototype,"routeId",void 0),r([s()],j.prototype,"routeName",void 0),r([s({value:null,readOnly:!0})],j.prototype,"strings",null),r([s({json:{read:{source:"summary.totalDriveTime"}}})],j.prototype,"totalDriveTime",void 0),r([s({json:{read:{source:"summary.totalLength"}}})],j.prototype,"totalLength",void 0),r([s({json:{read:{source:"summary.totalTime"}}})],j.prototype,"totalTime",void 0),j=r([A("esri.rest.support.DirectionsFeatureSet")],j);const lr=j;let D=class extends L{constructor(t){super(t),this.directionLines=null,this.directionPoints=null,this.directions=null,this.route=null,this.routeName=null,this.stops=null,this.traversedEdges=null,this.traversedJunctions=null,this.traversedTurns=null}};r([s({type:E,json:{write:!0}})],D.prototype,"directionLines",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"directionPoints",void 0),r([s({type:lr,json:{write:!0}})],D.prototype,"directions",void 0),r([s({type:K,json:{write:!0}})],D.prototype,"route",void 0),r([s({type:String,json:{write:!0}})],D.prototype,"routeName",void 0),r([s({type:[K],json:{write:!0}})],D.prototype,"stops",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"traversedEdges",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"traversedJunctions",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"traversedTurns",void 0),D=r([A("esri.rest.support.RouteResult")],D);const ur=D;function ve(e){return e?E.fromJSON(e).features.filter(Qe):[]}let k=class extends L{constructor(t){super(t),this.messages=null,this.pointBarriers=null,this.polylineBarriers=null,this.polygonBarriers=null,this.routeResults=null}readPointBarriers(t,o){return ve(o.barriers)}readPolylineBarriers(t){return ve(t)}readPolygonBarriers(t){return ve(t)}};r([s({type:[or]})],k.prototype,"messages",void 0),r([s({type:[K]})],k.prototype,"pointBarriers",void 0),r([P("pointBarriers",["barriers"])],k.prototype,"readPointBarriers",null),r([s({type:[K]})],k.prototype,"polylineBarriers",void 0),r([P("polylineBarriers")],k.prototype,"readPolylineBarriers",null),r([s({type:[K]})],k.prototype,"polygonBarriers",void 0),r([P("polygonBarriers")],k.prototype,"readPolygonBarriers",null),r([s({type:[ur]})],k.prototype,"routeResults",void 0),k=r([A("esri.rest.support.RouteSolveResult")],k);const pr=k;function pe(e){return e instanceof E}async function cr(e,t,o){const i=[],n=[],p={},l={},c=Ve(e),{path:v}=c;pe(t.stops)&&ue(t.stops.features,n,"stops.features",p),pe(t.pointBarriers)&&ue(t.pointBarriers.features,n,"pointBarriers.features",p),pe(t.polylineBarriers)&&ue(t.polylineBarriers.features,n,"polylineBarriers.features",p),pe(t.polygonBarriers)&&ue(t.polygonBarriers.features,n,"polygonBarriers.features",p);const S=await lt(n);for(const B in p){const h=p[B];i.push(B),l[B]=S.slice(h[0],h[1])}if(Yt(l,i)){let B=null;try{B=await tt(v,t.apiKey,o)}catch{}B&&!B.hasZ&&Xt(l,i)}for(const B in l)l[B].forEach((h,w)=>{ut(t,B)[w].geometry=h});const u={...o,query:{...c.query,...xt(t),f:"json"}},b=v.endsWith("/solve")?v:`${v}/solve`,{data:N}=await re(b,u);return yr(N)}function yr(e){const{barriers:t,directionLines:o,directionPoints:i,directions:n,messages:p,polygonBarriers:l,polylineBarriers:c,routes:v,stops:S,traversedEdges:u,traversedJunctions:b,traversedTurns:N}=e,B=a=>{const T=w.find(R=>R.routeName===a);if(T!=null)return T;const f={routeId:w.length+1,routeName:a};return w.push(f),f},h=a=>{const T=w.find(R=>R.routeId===a);if(T!=null)return T;const f={routeId:a,routeName:null};return w.push(f),f},w=[];v==null||v.features.forEach((a,T)=>{a.geometry.spatialReference=v.spatialReference??void 0;const f=a.attributes.Name,R=T+1;w.push({routeId:R,routeName:f,route:a})}),n==null||n.forEach(a=>{const{routeName:T}=a;B(T).directions=a});const d=((S==null?void 0:S.features.every(a=>a.attributes.RouteName==null))??!1)&&w.length>0?w[0].routeName:null;return S==null||S.features.forEach(a=>{var R;a.geometry&&((R=a.geometry).spatialReference??(R.spatialReference=S.spatialReference??void 0));const T=d??a.attributes.RouteName,f=B(T);f.stops??(f.stops=[]),f.stops.push(a)}),o==null||o.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:R,spatialReference:J}=o;f.directionLines??(f.directionLines={features:[],geometryType:R,spatialReference:J}),f.directionLines.features.push(a)}),i==null||i.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:R,spatialReference:J}=i;f.directionPoints??(f.directionPoints={features:[],geometryType:R,spatialReference:J}),f.directionPoints.features.push(a)}),u==null||u.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:R,spatialReference:J}=u;f.traversedEdges??(f.traversedEdges={features:[],geometryType:R,spatialReference:J}),f.traversedEdges.features.push(a)}),b==null||b.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:R,spatialReference:J}=b;f.traversedJunctions??(f.traversedJunctions={features:[],geometryType:R,spatialReference:J}),f.traversedJunctions.features.push(a)}),N==null||N.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T);f.traversedTurns??(f.traversedTurns={features:[]}),f.traversedTurns.features.push(a)}),pr.fromJSON({routeResults:w,barriers:t,polygonBarriers:l,polylineBarriers:c,messages:p})}let F=class extends Pe(L){constructor(e){super(e),this.doNotLocateOnRestrictedElements=null,this.geometry=null,this.geometryType=null,this.name=null,this.spatialRelationship=null,this.type="layer",this.where=null}};r([s({type:Boolean,json:{write:!0}})],F.prototype,"doNotLocateOnRestrictedElements",void 0),r([s({types:pt,json:{read:ct,write:!0}})],F.prototype,"geometry",void 0),r([I(Ft)],F.prototype,"geometryType",void 0),r([s({type:String,json:{name:"layerName",write:!0}})],F.prototype,"name",void 0),r([I(Et,{name:"spatialRel"})],F.prototype,"spatialRelationship",void 0),r([s({type:String,json:{write:!0}})],F.prototype,"type",void 0),r([s({type:String,json:{write:!0}})],F.prototype,"where",void 0),F=r([A("esri.rest.support.DataLayer")],F);const dr=F;var Te;let me=Te=class extends E{constructor(e){super(e),this.doNotLocateOnRestrictedElements=null}clone(){return new Te({doNotLocateOnRestrictedElements:this.doNotLocateOnRestrictedElements,...this.cloneProperties()})}};r([s({type:Boolean,json:{write:!0}})],me.prototype,"doNotLocateOnRestrictedElements",void 0),me=Te=r([A("esri.rest.support.NetworkFeatureSet")],me);const mr=me;let ae=class extends Pe(L){constructor(e){super(e),this.doNotLocateOnRestrictedElements=null,this.url=null}};r([s({type:Boolean,json:{write:!0}})],ae.prototype,"doNotLocateOnRestrictedElements",void 0),r([s({type:String,json:{write:!0}})],ae.prototype,"url",void 0),ae=r([A("esri.rest.support.NetworkUrl")],ae);const fr=ae;var Be;let y=Be=class extends Pe(L){constructor(e){super(e),this.accumulateAttributes=null,this.apiKey=null,this.attributeParameterValues=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsOutputType=null,this.directionsStyleName=null,this.directionsTimeAttribute=null,this.findBestSequence=null,this.geometryPrecision=null,this.geometryPrecisionM=null,this.geometryPrecisionZ=null,this.ignoreInvalidLocations=null,this.impedanceAttribute=null,this.outputGeometryPrecision=null,this.outputGeometryPrecisionUnits=null,this.outputLines="true-shape",this.outSpatialReference=null,this.overrides=null,this.pointBarriers=null,this.polygonBarriers=null,this.polylineBarriers=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.preserveObjectID=null,this.restrictionAttributes=null,this.restrictUTurns=null,this.returnBarriers=!1,this.returnDirections=!1,this.returnPolygonBarriers=!1,this.returnPolylineBarriers=!1,this.returnRoutes=!0,this.returnStops=!1,this.returnTraversedEdges=null,this.returnTraversedJunctions=null,this.returnTraversedTurns=null,this.returnZ=!0,this.startTime=null,this.startTimeIsUTC=!0,this.stops=null,this.timeWindowsAreUTC=null,this.travelMode=null,this.useHierarchy=null,this.useTimeWindows=null}static from(e){return yt(Be,e)}readAccumulateAttributes(e){return e==null?null:e.map(t=>H.fromJSON(t))}writeAccumulateAttributes(e,t,o){e!=null&&e.length&&(t[o]=e.map(i=>H.toJSON(i)))}writePointBarriers(e,t,o){ce(e,t,o)}writePolygonBarrier(e,t,o){ce(e,t,o)}writePolylineBarrier(e,t,o){ce(e,t,o)}readRestrictionAttributes(e){return e==null?null:e.map(t=>_e.fromJSON(t))}writeRestrictionAttributes(e,t,o){e!=null&&e.length&&(t[o]=e.map(i=>_e.toJSON(i)))}readStartTime(e,t){const{startTime:o}=t;return o==null?null:o==="now"?"now":new Date(o)}writeStartTime(e,t){e!=null&&(t.startTime=e==="now"?"now":e.getTime())}readStops(e,t){return Sr(t.stops)}writeStops(e,t,o){ce(e,t,o)}};r([s({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],y.prototype,"accumulateAttributes",void 0),r([P("accumulateAttributes")],y.prototype,"readAccumulateAttributes",null),r([q("accumulateAttributes")],y.prototype,"writeAccumulateAttributes",null),r([s(dt)],y.prototype,"apiKey",void 0),r([s({json:{write:!0}})],y.prototype,"attributeParameterValues",void 0),r([s({type:String,json:{write:!0}})],y.prototype,"directionsLanguage",void 0),r([I(Xe)],y.prototype,"directionsLengthUnits",void 0),r([I(Gt)],y.prototype,"directionsOutputType",void 0),r([I(Ut)],y.prototype,"directionsStyleName",void 0),r([I(Re,{name:"directionsTimeAttributeName",ignoreUnknown:!1})],y.prototype,"directionsTimeAttribute",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"findBestSequence",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"geometryPrecision",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"geometryPrecisionM",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"geometryPrecisionZ",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"ignoreInvalidLocations",void 0),r([I(H,{name:"impedanceAttributeName",ignoreUnknown:!1})],y.prototype,"impedanceAttribute",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"outputGeometryPrecision",void 0),r([I(qt)],y.prototype,"outputGeometryPrecisionUnits",void 0),r([I(Wt)],y.prototype,"outputLines",void 0),r([s({type:W,json:{name:"outSR",write:!0}})],y.prototype,"outSpatialReference",void 0),r([s({json:{write:!0}})],y.prototype,"overrides",void 0),r([s({json:{name:"barriers",write:!0}})],y.prototype,"pointBarriers",void 0),r([q("pointBarriers")],y.prototype,"writePointBarriers",null),r([s({json:{write:!0}})],y.prototype,"polygonBarriers",void 0),r([q("polygonBarriers")],y.prototype,"writePolygonBarrier",null),r([s({json:{write:!0}})],y.prototype,"polylineBarriers",void 0),r([q("polylineBarriers")],y.prototype,"writePolylineBarrier",null),r([s({type:Boolean,json:{write:!0}})],y.prototype,"preserveFirstStop",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"preserveLastStop",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"preserveObjectID",void 0),r([s({type:[String],json:{name:"restrictionAttributeNames",write:!0}})],y.prototype,"restrictionAttributes",void 0),r([P("restrictionAttributes")],y.prototype,"readRestrictionAttributes",null),r([q("restrictionAttributes")],y.prototype,"writeRestrictionAttributes",null),r([I(Zt)],y.prototype,"restrictUTurns",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnBarriers",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnDirections",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnPolygonBarriers",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnPolylineBarriers",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnRoutes",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnStops",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnTraversedEdges",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnTraversedJunctions",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnTraversedTurns",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnZ",void 0),r([s({type:Date,json:{type:Number,write:!0}})],y.prototype,"startTime",void 0),r([P("startTime")],y.prototype,"readStartTime",null),r([q("startTime")],y.prototype,"writeStartTime",null),r([s({type:Boolean,json:{write:!0}})],y.prototype,"startTimeIsUTC",void 0),r([s({json:{write:!0}})],y.prototype,"stops",void 0),r([P("stops")],y.prototype,"readStops",null),r([q("stops")],y.prototype,"writeStops",null),r([s({type:Boolean,json:{write:!0}})],y.prototype,"timeWindowsAreUTC",void 0),r([s({type:$e,json:{write:!0}})],y.prototype,"travelMode",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"useHierarchy",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"useTimeWindows",void 0),y=Be=r([A("esri.rest.support.RouteParameters")],y);const Fe=y;function hr(e){return e&&"type"in e}function vr(e){return e&&"features"in e&&"doNotLocateOnRestrictedElements"in e}function wr(e){return e&&"url"in e}function gr(e){return e&&"features"in e}function Sr(e){return hr(e)?dr.fromJSON(e):wr(e)?fr.fromJSON(e):vr(e)?mr.fromJSON(e):gr(e)?E.fromJSON(e):null}function ce(e,t,o){e!=null&&(t[o]=O.isCollection(e)?{features:e.toArray().map(i=>i.toJSON())}:e.toJSON())}function we(e){return e.length?e:null}function Ne(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:Ne("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:Ne("esriGeometryPolyline")}}}function ye(e){return"layers"in e}function br(e){return e.declaredClass==="esri.rest.support.FeatureSet"}function Tr(e){return e.declaredClass==="esri.rest.support.NetworkFeatureSet"}function Br(e,t,o){var Ie,Ae,Oe,je,Le,De;const i=(Ie=t.networkDataset)==null?void 0:Ie.networkAttributes,n=(i==null?void 0:i.filter(({usageType:m})=>m==="cost"))??[],p=o.travelMode??t.defaultTravelMode;if(p==null)return void st.warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:l,distanceAttributeName:c}=p,v=n.find(({name:m})=>m===l),S=n.find(({name:m})=>m===c),u=((Ae=o.travelMode)==null?void 0:Ae.impedanceAttributeName)??o.impedanceAttribute??t.impedance,b=v==null?void 0:v.units,N=S==null?void 0:S.units;if(!b||!N)throw new M("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const B=o.directionsLanguage??t.directionsLanguage,h=o.accumulateAttributes??t.accumulateAttributeNames??[],w=new Set(n.filter(({name:m})=>m===l||m===c||m===u||m!=null&&h.includes(m)).map(({name:m})=>m)),d=m=>{for(const Me in m)w.has(Me)||delete m[Me]};for(const m of e.pointBarriers)m.costs!=null&&(m.addedCost=m.costs[u]??0,d(m.costs));for(const m of e.polygonBarriers)m.costs!=null&&(m.scaleFactor=m.costs[u]??1,d(m.costs));for(const m of e.polylineBarriers)m.costs!=null&&(m.scaleFactor=m.costs[u]??1,d(m.costs));const{routeInfo:a}=e,{findBestSequence:T,preserveFirstStop:f,preserveLastStop:R,startTimeIsUTC:J,timeWindowsAreUTC:it}=o;a.analysisSettings=new Vt({accumulateAttributes:h,directionsLanguage:B,findBestSequence:T,preserveFirstStop:f,preserveLastStop:R,startTimeIsUTC:J,timeWindowsAreUTC:it,travelMode:p}),a.totalDuration=z(((Oe=a.totalCosts)==null?void 0:Oe[l])??0,b),a.totalDistance=ge(((je=a.totalCosts)==null?void 0:je[c])??0,N),a.totalLateDuration=z(((Le=a.totalViolations)==null?void 0:Le[l])??0,b),a.totalWaitDuration=z(((De=a.totalWait)==null?void 0:De[l])??0,b),a.totalCosts!=null&&d(a.totalCosts),a.totalViolations!=null&&d(a.totalViolations),a.totalWait!=null&&d(a.totalWait);for(const m of e.stops)m.serviceCosts!=null&&(m.serviceDuration=z(m.serviceCosts[l]??0,b),m.serviceDistance=ge(m.serviceCosts[c]??0,N),d(m.serviceCosts)),m.cumulativeCosts!=null&&(m.cumulativeDuration=z(m.cumulativeCosts[l]??0,b),m.cumulativeDistance=ge(m.cumulativeCosts[c]??0,N),d(m.cumulativeCosts)),m.violations!=null&&(m.lateDuration=z(m.violations[l]??0,b),d(m.violations)),m.wait!=null&&(m.waitDuration=z(m.wait[l]??0,b),d(m.wait))}async function Ee(e){const t=W.WGS84;return await jt(e.spatialReference,t),Lt(e,t)}function z(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ge(e,t){return t==="decimal-degrees"||t==="points"||t==="unknown"?e:Dt(e,t,"meters")}function Nr(e){const{attributes:t,geometry:o,popupTemplate:i,symbol:n}=e.toGraphic().toJSON();return{attributes:t,geometry:o,popupInfo:i,symbol:n}}const Pr=O.ofType(oe),Rr=O.ofType(se),Ge=O.ofType(X),Ue=O.ofType(Y),qe=O.ofType(ee),We=O.ofType(te),ot="esri.layers.RouteLayer",st=Ze.getLogger(ot);let g=class extends mt(ft(ht(vt(wt(Mt))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.defaultSymbols=new et,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new Ge,this.polygonBarriers=new Ue,this.polylineBarriers=new qe,this.routeInfo=null,this.spatialReference=W.WGS84,this.stops=new We,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(gt(()=>this.stops,"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,o,i){const n=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter(c=>!!c),p=n.map((c,v)=>v),l=i.origin==="web-map"?"featureCollection.layers":"layers";St(l,n,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=p}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",o=>oe.fromGraphic(o))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",o=>se.fromGraphic(o))}get fullExtent(){var n;const e=new He({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:W.WGS84});if(((n=this.routeInfo)==null?void 0:n.geometry)!=null)return this.routeInfo.geometry.extent??e;if(this.stops==null)return e;const t=this.stops.filter(p=>p.geometry!=null);if(t.length<2)return e;const{spatialReference:o}=t.at(0).geometry;if(o==null)return e;const i=t.toArray().map(p=>{const l=p.geometry;return[l.x,l.y]});return new bt({points:i,spatialReference:o}).extent}readMaxScale(e,t){var n;const o=ye(t)?t.layers:(n=t.featureCollection)==null?void 0:n.layers,i=o==null?void 0:o.find(p=>p.layerDefinition.maxScale!=null);return(i==null?void 0:i.layerDefinition.maxScale)??0}readMinScale(e,t){var n;const o=ye(t)?t.layers:(n=t.featureCollection)==null?void 0:n.layers,i=o==null?void 0:o.find(p=>p.layerDefinition.minScale!=null);return(i==null?void 0:i.layerDefinition.minScale)??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",o=>X.fromGraphic(o))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",o=>Y.fromGraphic(o))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",o=>ee.fromGraphic(o))}readRouteInfo(e,t){const o=this._getNetworkFeatures(t,"RouteInfo",i=>le.fromGraphic(i));return o.length>0?o.at(0):null}readSpatialReference(e,t){var c,v;const o=ye(t)?t.layers:(c=t.featureCollection)==null?void 0:c.layers;if(!(o!=null&&o.length))return W.WGS84;const{layerDefinition:i,featureSet:n}=o[0],p=n.features[0],l=((v=p==null?void 0:p.geometry)==null?void 0:v.spatialReference)??n.spatialReference??i.spatialReference??i.extent.spatialReference??Ce;return W.fromJSON(l)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",o=>te.fromGraphic(o),o=>this._setStopSymbol(o))}get title(){var e;return((e=this.routeInfo)==null?void 0:e.name)!=null?this.routeInfo.name:"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return Je.routeServiceUrl}set url(e){e!=null?this._set("url",Tt(e,st)):this._set("url",Je.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){this.directionLines!=null&&(this.directionLines.removeAll(),this._set("directionLines",null)),this.directionPoints!=null&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),this.routeInfo!=null&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new M("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new M("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if(t.type!=="Feature Collection")throw new M("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(this.routeInfo==null)throw new M("routelayer:route-unsolved","save() requires a solved route");const{portal:o}=t;await o.signIn(),o.user||await t.reload();const{itemUrl:i,itemControl:n}=t;if(n!=="admin"&&n!=="update")throw new M("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const p={messages:[],origin:"portal-item",portal:o,url:i?Bt(i):void 0,writtenProperties:[]},l=this.write(void 0,p);return t.extent=await Ee(e),t.title=this.title,await t.update({data:l}),t}async saveAs(e,t={}){var c;if(await this.load(),this.routeInfo==null)throw new M("routelayer:route-unsolved","saveAs() requires a solved route");const o=Nt.from(e).clone();o.extent??(o.extent=await Ee(this.fullExtent)),o.id=null,o.portal??(o.portal=Pt.getDefault()),o.title??(o.title=this.title),o.type="Feature Collection",o.typeKeywords=["Data","Feature Collection",Rt.MULTI_LAYER,"Route Layer"];const{portal:i}=o,n={messages:[],origin:"portal-item",portal:i,url:null,writtenProperties:[]};await i.signIn();const p=t==null?void 0:t.folder,l=this.write(void 0,n);return await((c=i.user)==null?void 0:c.addItem({item:o,folder:p,data:l})),this.portalItem=o,$t(n),n.portalItem=o,o}async solve(e,t){const o=(e==null?void 0:e.stops)??this.stops,i=(e==null?void 0:e.pointBarriers)??we(this.pointBarriers),n=(e==null?void 0:e.polylineBarriers)??we(this.polylineBarriers),p=(e==null?void 0:e.polygonBarriers)??we(this.polygonBarriers);if(o==null)throw new M("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((br(o)||Tr(o))&&o.features.length<2||O.isCollection(o)&&o.length<2)throw new M("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(O.isCollection(o))for(const d of o)d.routeName=null;const l=e==null?void 0:e.apiKey,c=this.url,v=await this._getServiceDescription(c,l,t),S=(e==null?void 0:e.travelMode)??v.defaultTravelMode,u=(e==null?void 0:e.accumulateAttributes)??[];S!=null&&(u.push(S.distanceAttributeName),S.timeAttributeName&&u.push(S.timeAttributeName));const b={startTime:new Date},N={accumulateAttributes:u,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:i,polylineBarriers:n,polygonBarriers:p,preserveFirstStop:!0,preserveLastStop:!0,returnBarriers:!!i,returnDirections:!0,returnPolygonBarriers:!!p,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:o},B=e?Fe.from(e):new Fe;for(const d in b)B[d]==null&&(B[d]=b[d]);let h;B.set(N);try{h=await cr(c,B,t)}catch(d){throw It(d)?d:new M("routelayer:failed-route-request","the routing request failed",{error:d})}const w=this._toRouteLayerSolution(h);return this._isOverridden("title")||(this.title=w.routeInfo.name??"Route"),Br(w,v,B),w}update(e){const{stops:t,directionLines:o,directionPoints:i,pointBarriers:n,polylineBarriers:p,polygonBarriers:l,routeInfo:c}=e;this.set({stops:t,pointBarriers:n,polylineBarriers:p,polygonBarriers:l}),this._set("directionLines",o),this._set("directionPoints",i),this._set("routeInfo",c),c.geometry!=null&&(this.spatialReference=c.geometry.spatialReference)}_getNetworkFeatures(e,t,o,i){var w;const n=ye(e)?e.layers:(w=e.featureCollection)==null?void 0:w.layers,p=n==null?void 0:n.find(d=>d.layerDefinition.name===t);if(p==null)return new O;const{layerDefinition:l,popupInfo:c,featureSet:v}=p,S=l.drawingInfo.renderer,{features:u}=v,b=v.spatialReference??l.spatialReference??l.extent.spatialReference??Ce,N=S&&At(S),B=W.fromJSON(b),h=u.map(d=>{const a=K.fromJSON(d);a.geometry!=null&&d.geometry!=null&&d.geometry.spatialReference==null&&(a.geometry.spatialReference=B);const T=o(a);return T.symbol??(T.symbol=(N==null?void 0:N.getSymbol(a))??this._getNetworkSymbol(t)),T.popupTemplate??(T.popupTemplate=c&&Ot.fromJSON(c)),T});return i&&h.some(d=>!d.symbol)&&i(h),new O(h)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,o){if(this._cachedServiceDescription!=null&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const i=await tt(e,t,o);return this._cachedServiceDescription={serviceDescription:i,url:e},i}_setStopSymbol(e){if(!e||e.length===0||this.defaultSymbols.stops==null||e.every(({symbol:u})=>u!=null))return;const{first:t,last:o,middle:i,unlocated:n,waypoint:p,break:l}=this.defaultSymbols.stops;if(this.routeInfo==null||e.length===1)return void e.forEach((u,b)=>{switch(b){case 0:u.symbol=t;break;case e.length-1:u.symbol=o;break;default:u.symbol=i}});const c=e.map(({sequence:u})=>u).filter(u=>u!=null),v=Math.min(...c),S=Math.max(...c);for(const u of e)u.sequence!==v?u.sequence!==S?u.status==="ok"||u.status==="not-located-on-closest"?u.locationType!=="waypoint"?u.locationType!=="break"?u.symbol=i:u.symbol=l:u.symbol=p:u.symbol=n:u.symbol=o:u.symbol=t}_toRouteLayerSolution(e){var S,u,b,N,B,h,w;const t=(S=e.routeResults[0].stops)==null?void 0:S.map(d=>te.fromJSON(d.toJSON()));this._setStopSymbol(t);const o=new We(t),i=new Ue((u=e.polygonBarriers)==null?void 0:u.map(d=>{const a=Y.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.polygonBarriers,a})),n=new qe((b=e.polylineBarriers)==null?void 0:b.map(d=>{const a=ee.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.polylineBarriers,a})),p=new Ge((N=e.pointBarriers)==null?void 0:N.map(d=>{const a=X.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.pointBarriers,a})),l=(B=e.routeResults[0].route)==null?void 0:B.toJSON(),c=le.fromJSON(l);c.symbol=this.defaultSymbols.routeInfo;const v=new Rr((h=e.routeResults[0].directionPoints)==null?void 0:h.features.map(d=>{const a=se.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.directionPoints,a}));return{directionLines:new Pr((w=e.routeResults[0].directionLines)==null?void 0:w.features.map(d=>{const a=oe.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.directionLines,a})),directionPoints:v,pointBarriers:p,polygonBarriers:i,polylineBarriers:n,routeInfo:c,stops:o}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",oe.fields,oe.popupInfo,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",se.fields,se.popupInfo,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,o,i,n,p,l){if(!(e!=null&&e.length))return null;const c=this.spatialReference.toJSON(),{fullExtent:v,maxScale:S,minScale:u}=this;return{featureSet:{features:e.toArray().map(b=>Nr(b)),geometryType:o,spatialReference:c},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:t!=null?t.toJSON():Ne(o)}},extent:v.toJSON(),fields:i,geometryType:o,hasM:!1,hasZ:!1,maxScale:S,minScale:u,name:p,objectIdField:"ObjectID",spatialReference:c,title:l,type:"Feature Layer",typeIdField:""},popupInfo:n}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",X.fields,X.popupInfo,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",Y.fields,Y.popupInfo,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",ee.fields,ee.popupInfo,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(this.routeInfo!=null?new O([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",le.fields,le.popupInfo,"RouteInfo","Route Details")}_writeStops(){var p,l,c;const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",te.fields,te.popupInfo,"Stops","Stops");if(e==null)return null;const{stops:t}=this.defaultSymbols,o=(p=t==null?void 0:t.first)==null?void 0:p.toJSON(),i=(l=t==null?void 0:t.middle)==null?void 0:l.toJSON(),n=(c=t==null?void 0:t.last)==null?void 0:c.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:i,uniqueValueInfos:[{value:"1",symbol:o,label:"First Stop"},{value:`${this.stops.length}`,symbol:n,label:"Last Stop"}]},e}};r([s({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:this.portalItem==null}}}}}}})],g.prototype,"_featureCollection",void 0),r([q(["web-map","portal-item"],"_featureCollection")],g.prototype,"writeFeatureCollectionWebmap",null),r([s({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:this.portalItem!=null}}}}}}})],g.prototype,"_type",void 0),r([s({nonNullable:!0,type:et})],g.prototype,"defaultSymbols",void 0),r([s({readOnly:!0})],g.prototype,"directionLines",void 0),r([P(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],g.prototype,"readDirectionLines",null),r([s({readOnly:!0})],g.prototype,"directionPoints",void 0),r([P(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],g.prototype,"readDirectionPoints",null),r([s({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],g.prototype,"featureCollectionType",void 0),r([s({readOnly:!0})],g.prototype,"fullExtent",null),r([s({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],g.prototype,"legendEnabled",void 0),r([s({type:["show","hide"]})],g.prototype,"listMode",void 0),r([s({type:Number,nonNullable:!0,json:{write:!1}})],g.prototype,"maxScale",void 0),r([P(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],g.prototype,"readMaxScale",null),r([s({type:Number,nonNullable:!0,json:{write:!1}})],g.prototype,"minScale",void 0),r([P(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],g.prototype,"readMinScale",null),r([s({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],g.prototype,"operationalLayerType",void 0),r([s({nonNullable:!0,type:O.ofType(X)})],g.prototype,"pointBarriers",void 0),r([P(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],g.prototype,"readPointBarriers",null),r([s({nonNullable:!0,type:O.ofType(Y)})],g.prototype,"polygonBarriers",void 0),r([P(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],g.prototype,"readPolygonBarriers",null),r([s({nonNullable:!0,type:O.ofType(ee)})],g.prototype,"polylineBarriers",void 0),r([P(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],g.prototype,"readPolylineBarriers",null),r([s({readOnly:!0})],g.prototype,"routeInfo",void 0),r([P(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],g.prototype,"readRouteInfo",null),r([s({type:W})],g.prototype,"spatialReference",void 0),r([P(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],g.prototype,"readSpatialReference",null),r([s({nonNullable:!0,type:O.ofType(te)})],g.prototype,"stops",void 0),r([P(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],g.prototype,"readStops",null),r([s()],g.prototype,"title",null),r([s({readOnly:!0,json:{read:!1}})],g.prototype,"type",void 0),r([s()],g.prototype,"url",null),g=r([A(ot)],g);const Gr=g;export{Gr as default}; +import{e as r,y as s,mE as C,c as A,dr as j,x as V,a6 as he,aw as nt,iy as I,dt as P,du as q,R as Ze,r as M,fW as fe,av as re,pp as Se,nL as at,fV as Ve,dp as ze,L as Ke,K,E as be,dO as He,h6 as E,d2 as W,dY as Ye,am as lt,uo as ut,dq as Pe,nP as pt,fZ as ct,fY as yt,up as dt,V as L,dF as mt,dJ as ft,dH as ht,dI as vt,dK as wt,fg as gt,dy as St,ho as bt,eQ as Ce,dN as Je,ul as Tt,au as Bt,aq as Nt,ar as Pt,f as Rt,as as $t,ac as It,jh as At,ix as Lt,f8 as Ot,dW as jt,hr as Dt,aI as Mt}from"./index-pCX-0tJH.js";import{U as H,y as Re,s as Ct,R as Jt,r as Qe,a as $e,b as _t,n as kt,o as xt,w as Ft,d as Et,D as _e,e as Gt,k as Ut,i as qt,f as Wt,l as Zt,m as oe,c as se,C as Q,T as X,j as ee,O as te,S as le,g as Vt}from"./Stop-d3MLMjE8.js";let G=class extends j{constructor(t){super(t),this.break=new V({color:[255,255,255],size:12,outline:{color:[0,122,194],width:3}}),this.first=new V({color:[0,255,0],size:20,outline:{color:[255,255,255],width:4}}),this.unlocated=new V({color:[255,0,0],size:12,outline:{color:[255,255,255],width:3}}),this.last=new V({color:[255,0,0],size:20,outline:{color:[255,255,255],width:4}}),this.middle=new V({color:[51,51,51],size:12,outline:{color:[0,122,194],width:3}}),this.waypoint=new V({color:[255,255,255],size:12,outline:{color:[0,122,194],width:3}})}};r([s({types:C})],G.prototype,"break",void 0),r([s({types:C})],G.prototype,"first",void 0),r([s({types:C})],G.prototype,"unlocated",void 0),r([s({types:C})],G.prototype,"last",void 0),r([s({types:C})],G.prototype,"middle",void 0),r([s({types:C})],G.prototype,"waypoint",void 0),G=r([A("esri.layers.support.RouteStopSymbols")],G);const Xe=G;let x=class extends j{constructor(t){super(t),this.directionLines=new he({color:[0,122,194],width:6}),this.directionPoints=new V({color:[255,255,255],size:6,outline:{color:[0,122,194],width:2}}),this.pointBarriers=new V({style:"x",size:10,outline:{color:[255,0,0],width:3}}),this.polygonBarriers=new nt({color:[255,170,0,.6],outline:{width:7.5,color:[255,0,0,.6]}}),this.polylineBarriers=new he({width:7.5,color:[255,85,0,.7]}),this.routeInfo=new he({width:8,color:[20,89,127]}),this.stops=new Xe}};r([s({types:C})],x.prototype,"directionLines",void 0),r([s({types:C})],x.prototype,"directionPoints",void 0),r([s({types:C})],x.prototype,"pointBarriers",void 0),r([s({types:C})],x.prototype,"polygonBarriers",void 0),r([s({types:C})],x.prototype,"polylineBarriers",void 0),r([s({types:C})],x.prototype,"routeInfo",void 0),r([s({type:Xe})],x.prototype,"stops",void 0),x=r([A("esri.layers.support.RouteSymbols")],x);const et=x;let _=class extends j{constructor(t){super(t),this.dataType=null,this.name=null,this.parameterNames=null,this.restrictionUsageParameterName=null,this.timeNeutralAttributeName=null,this.trafficSupport=null,this.units=null,this.usageType=null}};r([s({type:String})],_.prototype,"dataType",void 0),r([I(H,{ignoreUnknown:!1})],_.prototype,"name",void 0),r([s({type:[String]})],_.prototype,"parameterNames",void 0),r([s({type:String})],_.prototype,"restrictionUsageParameterName",void 0),r([I(Re,{ignoreUnknown:!1})],_.prototype,"timeNeutralAttributeName",void 0),r([s({type:String})],_.prototype,"trafficSupport",void 0),r([I(Ct)],_.prototype,"units",void 0),r([I(Jt)],_.prototype,"usageType",void 0),_=r([A("esri.rest.support.NetworkAttribute")],_);const zt=_;let Z=class extends j{constructor(t){super(t),this.buildTime=null,this.name=null,this.networkAttributes=null,this.networkSources=null,this.state=null}};r([s({type:Number})],Z.prototype,"buildTime",void 0),r([s({type:String})],Z.prototype,"name",void 0),r([s({type:[zt]})],Z.prototype,"networkAttributes",void 0),r([s()],Z.prototype,"networkSources",void 0),r([s({type:String})],Z.prototype,"state",void 0),Z=r([A("esri.rest.support.NetworkDataset")],Z);const Kt=Z;let $=class extends j{constructor(t){super(t),this.accumulateAttributeNames=null,this.attributeParameterValues=null,this.currentVersion=null,this.defaultTravelMode=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsSupportedLanguages=null,this.directionsTimeAttribute=null,this.hasZ=null,this.impedance=null,this.networkDataset=null,this.supportedTravelModes=null}readAccumulateAttributes(t){return t==null?null:t.map(o=>H.fromJSON(o))}writeAccumulateAttributes(t,o,i){t!=null&&t.length&&(o[i]=t.map(n=>H.toJSON(n)))}readDefaultTravelMode(t,o){var n,p;const i=((n=o.supportedTravelModes)==null?void 0:n.find(({id:l})=>l===o.defaultTravelMode))??((p=o.supportedTravelModes)==null?void 0:p.find(({itemId:l})=>l===o.defaultTravelMode));return i?$e.fromJSON(i):null}};r([s()],$.prototype,"accumulateAttributeNames",void 0),r([P("accumulateAttributeNames")],$.prototype,"readAccumulateAttributes",null),r([q("accumulateAttributeNames")],$.prototype,"writeAccumulateAttributes",null),r([s()],$.prototype,"attributeParameterValues",void 0),r([s()],$.prototype,"currentVersion",void 0),r([s()],$.prototype,"defaultTravelMode",void 0),r([P("defaultTravelMode",["defaultTravelMode","supportedTravelModes"])],$.prototype,"readDefaultTravelMode",null),r([s()],$.prototype,"directionsLanguage",void 0),r([I(Qe)],$.prototype,"directionsLengthUnits",void 0),r([s()],$.prototype,"directionsSupportedLanguages",void 0),r([I(Re,{ignoreUnknown:!1})],$.prototype,"directionsTimeAttribute",void 0),r([s()],$.prototype,"hasZ",void 0),r([I(H,{ignoreUnknown:!1})],$.prototype,"impedance",void 0),r([s({type:Kt})],$.prototype,"networkDataset",void 0),r([s({type:[$e]})],$.prototype,"supportedTravelModes",void 0),$=r([A("esri.rest.support.NetworkServiceDescription")],$);const Ht=$,Yt=Ze.getLogger("esri.rest.networkService");function ue(e,t,o,i){i[o]=[t.length,t.length+e.length],e.forEach(n=>{t.push(n.geometry)})}function Qt(e,t){for(let o=0;o=10.4?tr(e,t,o):er(e,o),{defaultTravelMode:l,supportedTravelModes:c}=await p;return n.defaultTravelMode=l,n.supportedTravelModes=c,Ht.fromJSON(n)}async function er(e,t){var w,d,a;const o=fe({f:"json"},t),{data:i}=await re(e.replace(/\/rest\/.*$/i,"/info"),o);if(!(i!=null&&i.owningSystemUrl))return{supportedTravelModes:[],defaultTravelMode:null};const{owningSystemUrl:n}=i,p=Se(n)+"/sharing/rest/portals/self",{data:l}=await re(p,o),c=at("helperServices.routingUtilities.url",l);if(!c)return{supportedTravelModes:[],defaultTravelMode:null};const v=Ve(n),S=/\/solve$/i.test(v.path)?"Route":/\/solveclosestfacility$/i.test(v.path)?"ClosestFacility":"ServiceAreas",u=fe({f:"json",serviceName:S},t),b=Se(c)+"/GetTravelModes/execute",N=await re(b,u),B=[];let h=null;if((d=(w=N==null?void 0:N.data)==null?void 0:w.results)!=null&&d.length){const T=N.data.results;for(const f of T)if(f.paramName==="supportedTravelModes"){if((a=f.value)!=null&&a.features){for(const{attributes:R}of f.value.features)if(R){const J=JSON.parse(R.TravelMode);B.push(J)}}}else f.paramName==="defaultTravelMode"&&(h=f.value)}return{supportedTravelModes:B,defaultTravelMode:h}}async function tr(e,t,o){try{const i=fe({f:"json",token:t},o),n=Se(e)+"/retrieveTravelModes",{data:{supportedTravelModes:p,defaultTravelMode:l}}=await re(n,i);return{supportedTravelModes:p,defaultTravelMode:l}}catch(i){throw new M("network-service:retrieveTravelModes","Could not get to the NAServer's retrieveTravelModes.",{error:i})}}const ke=new ze({esriJobMessageTypeInformative:"informative",esriJobMessageTypeProcessDefinition:"process-definition",esriJobMessageTypeProcessStart:"process-start",esriJobMessageTypeProcessStop:"process-stop",esriJobMessageTypeWarning:"warning",esriJobMessageTypeError:"error",esriJobMessageTypeEmpty:"empty",esriJobMessageTypeAbort:"abort"});let ie=class extends j{constructor(t){super(t),this.description=null,this.type=null}};r([s({type:String,json:{write:!0}})],ie.prototype,"description",void 0),r([s({type:String,json:{read:ke.read,write:ke.write}})],ie.prototype,"type",void 0),ie=r([A("esri.rest.support.GPMessage")],ie);const rr=ie,xe=new ze({0:"informative",1:"process-definition",2:"process-start",3:"process-stop",50:"warning",100:"error",101:"empty",200:"abort"});let de=class extends rr{constructor(t){super(t),this.type=null}};r([s({type:String,json:{read:xe.read,write:xe.write}})],de.prototype,"type",void 0),de=r([A("esri.rest.support.NAMessage")],de);const or=de;let ne=class extends j{constructor(t){super(t)}};r([s({json:{read:{source:"string"}}})],ne.prototype,"text",void 0),r([I(_t,{name:"stringType"})],ne.prototype,"type",void 0),ne=r([A("esri.rest.support.DirectionsString")],ne);const rt=ne;let U=class extends j{constructor(t){super(t),this.arriveTime=null,this.arriveTimeOffset=null,this.geometry=null,this.strings=null}readArriveTimeOffset(t,o){return kt(o.ETA,o.arriveTimeUTC)}readGeometry(t,o){return Ke.fromJSON(o.point)}};r([s({type:Date,json:{read:{source:"arriveTimeUTC"}}})],U.prototype,"arriveTime",void 0),r([s()],U.prototype,"arriveTimeOffset",void 0),r([P("arriveTimeOffset",["arriveTimeUTC","ETA"])],U.prototype,"readArriveTimeOffset",null),r([s({type:Ke})],U.prototype,"geometry",void 0),r([P("geometry",["point"])],U.prototype,"readGeometry",null),r([s({type:[rt]})],U.prototype,"strings",void 0),U=r([A("esri.rest.support.DirectionsEvent")],U);const sr=U;function ir(e){if(e==null||e==="")return null;let t=0,o=0,i=0,n=0;const p=[];let l,c,v,S,u,b,N,B,h=0,w=0,d=0;if(u=e.match(/((\+|\-)[^\+\-\|]+|\|)/g),u||(u=[]),parseInt(u[h],32)===0){h=2;const a=parseInt(u[h],32);h++,b=parseInt(u[h],32),h++,1&a&&(w=u.indexOf("|")+1,N=parseInt(u[w],32),w++),2&a&&(d=u.indexOf("|",w)+1,B=parseInt(u[d],32),d++)}else b=parseInt(u[h],32),h++;for(;h0,hasM:d>0}}let Y=class extends K{constructor(e){super(e),this.events=null,this.strings=null}readGeometry(e,t){const o=ir(t.compressedGeometry);return o!=null?be.fromJSON(o):null}};r([s({type:[sr]})],Y.prototype,"events",void 0),r([P("geometry",["compressedGeometry"])],Y.prototype,"readGeometry",null),r([s({type:[rt]})],Y.prototype,"strings",void 0),Y=r([A("esri.rest.support.DirectionsFeature")],Y);const nr=Y;function ar(e,t){if(e.length===0)return new be({spatialReference:t});const o=[];for(const l of e)for(const c of l.paths)o.push(...c);const i=[];o.forEach((l,c)=>{c!==0&&l[0]===o[c-1][0]&&l[1]===o[c-1][1]||i.push(l)});const{hasM:n,hasZ:p}=e[0];return new be({hasM:n,hasZ:p,paths:[i],spatialReference:t})}let O=class extends E{constructor(t){super(t),this.extent=null,this.features=[],this.geometryType="polyline",this.routeId=null,this.routeName=null,this.totalDriveTime=null,this.totalLength=null,this.totalTime=null}readFeatures(t,o){if(!t)return[];const i=o.summary.envelope.spatialReference??o.spatialReference,n=i&&W.fromJSON(i);return t.map(p=>{const l=nr.fromJSON(p);if(l.geometry!=null&&(l.geometry.spatialReference=n),l.events!=null)for(const c of l.events)c.geometry!=null&&(c.geometry.spatialReference=n);return l})}get mergedGeometry(){return this.features?ar(this.features.map(({geometry:t})=>t),this.extent.spatialReference):null}get strings(){return this.features.flatMap(({strings:t})=>t).filter(Ye)}};r([s({type:He,json:{read:{source:"summary.envelope"}}})],O.prototype,"extent",void 0),r([s({nonNullable:!0})],O.prototype,"features",void 0),r([P("features")],O.prototype,"readFeatures",null),r([s()],O.prototype,"geometryType",void 0),r([s({readOnly:!0})],O.prototype,"mergedGeometry",null),r([s()],O.prototype,"routeId",void 0),r([s()],O.prototype,"routeName",void 0),r([s({value:null,readOnly:!0})],O.prototype,"strings",null),r([s({json:{read:{source:"summary.totalDriveTime"}}})],O.prototype,"totalDriveTime",void 0),r([s({json:{read:{source:"summary.totalLength"}}})],O.prototype,"totalLength",void 0),r([s({json:{read:{source:"summary.totalTime"}}})],O.prototype,"totalTime",void 0),O=r([A("esri.rest.support.DirectionsFeatureSet")],O);const lr=O;let D=class extends j{constructor(t){super(t),this.directionLines=null,this.directionPoints=null,this.directions=null,this.route=null,this.routeName=null,this.stops=null,this.traversedEdges=null,this.traversedJunctions=null,this.traversedTurns=null}};r([s({type:E,json:{write:!0}})],D.prototype,"directionLines",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"directionPoints",void 0),r([s({type:lr,json:{write:!0}})],D.prototype,"directions",void 0),r([s({type:K,json:{write:!0}})],D.prototype,"route",void 0),r([s({type:String,json:{write:!0}})],D.prototype,"routeName",void 0),r([s({type:[K],json:{write:!0}})],D.prototype,"stops",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"traversedEdges",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"traversedJunctions",void 0),r([s({type:E,json:{write:!0}})],D.prototype,"traversedTurns",void 0),D=r([A("esri.rest.support.RouteResult")],D);const ur=D;function ve(e){return e?E.fromJSON(e).features.filter(Ye):[]}let k=class extends j{constructor(t){super(t),this.messages=null,this.pointBarriers=null,this.polylineBarriers=null,this.polygonBarriers=null,this.routeResults=null}readPointBarriers(t,o){return ve(o.barriers)}readPolylineBarriers(t){return ve(t)}readPolygonBarriers(t){return ve(t)}};r([s({type:[or]})],k.prototype,"messages",void 0),r([s({type:[K]})],k.prototype,"pointBarriers",void 0),r([P("pointBarriers",["barriers"])],k.prototype,"readPointBarriers",null),r([s({type:[K]})],k.prototype,"polylineBarriers",void 0),r([P("polylineBarriers")],k.prototype,"readPolylineBarriers",null),r([s({type:[K]})],k.prototype,"polygonBarriers",void 0),r([P("polygonBarriers")],k.prototype,"readPolygonBarriers",null),r([s({type:[ur]})],k.prototype,"routeResults",void 0),k=r([A("esri.rest.support.RouteSolveResult")],k);const pr=k;function pe(e){return e instanceof E}async function cr(e,t,o){const i=[],n=[],p={},l={},c=Ve(e),{path:v}=c;pe(t.stops)&&ue(t.stops.features,n,"stops.features",p),pe(t.pointBarriers)&&ue(t.pointBarriers.features,n,"pointBarriers.features",p),pe(t.polylineBarriers)&&ue(t.polylineBarriers.features,n,"polylineBarriers.features",p),pe(t.polygonBarriers)&&ue(t.polygonBarriers.features,n,"polygonBarriers.features",p);const S=await lt(n);for(const B in p){const h=p[B];i.push(B),l[B]=S.slice(h[0],h[1])}if(Xt(l,i)){let B=null;try{B=await tt(v,t.apiKey,o)}catch{}B&&!B.hasZ&&Qt(l,i)}for(const B in l)l[B].forEach((h,w)=>{ut(t,B)[w].geometry=h});const u={...o,query:{...c.query,...xt(t),f:"json"}},b=v.endsWith("/solve")?v:`${v}/solve`,{data:N}=await re(b,u);return yr(N)}function yr(e){const{barriers:t,directionLines:o,directionPoints:i,directions:n,messages:p,polygonBarriers:l,polylineBarriers:c,routes:v,stops:S,traversedEdges:u,traversedJunctions:b,traversedTurns:N}=e,B=a=>{const T=w.find(R=>R.routeName===a);if(T!=null)return T;const f={routeId:w.length+1,routeName:a};return w.push(f),f},h=a=>{const T=w.find(R=>R.routeId===a);if(T!=null)return T;const f={routeId:a,routeName:null};return w.push(f),f},w=[];v==null||v.features.forEach((a,T)=>{a.geometry.spatialReference=v.spatialReference??void 0;const f=a.attributes.Name,R=T+1;w.push({routeId:R,routeName:f,route:a})}),n==null||n.forEach(a=>{const{routeName:T}=a;B(T).directions=a});const d=((S==null?void 0:S.features.every(a=>a.attributes.RouteName==null))??!1)&&w.length>0?w[0].routeName:null;return S==null||S.features.forEach(a=>{var R;a.geometry&&((R=a.geometry).spatialReference??(R.spatialReference=S.spatialReference??void 0));const T=d??a.attributes.RouteName,f=B(T);f.stops??(f.stops=[]),f.stops.push(a)}),o==null||o.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:R,spatialReference:J}=o;f.directionLines??(f.directionLines={features:[],geometryType:R,spatialReference:J}),f.directionLines.features.push(a)}),i==null||i.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:R,spatialReference:J}=i;f.directionPoints??(f.directionPoints={features:[],geometryType:R,spatialReference:J}),f.directionPoints.features.push(a)}),u==null||u.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:R,spatialReference:J}=u;f.traversedEdges??(f.traversedEdges={features:[],geometryType:R,spatialReference:J}),f.traversedEdges.features.push(a)}),b==null||b.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T),{geometryType:R,spatialReference:J}=b;f.traversedJunctions??(f.traversedJunctions={features:[],geometryType:R,spatialReference:J}),f.traversedJunctions.features.push(a)}),N==null||N.features.forEach(a=>{const T=a.attributes.RouteID,f=h(T);f.traversedTurns??(f.traversedTurns={features:[]}),f.traversedTurns.features.push(a)}),pr.fromJSON({routeResults:w,barriers:t,polygonBarriers:l,polylineBarriers:c,messages:p})}let F=class extends Pe(j){constructor(e){super(e),this.doNotLocateOnRestrictedElements=null,this.geometry=null,this.geometryType=null,this.name=null,this.spatialRelationship=null,this.type="layer",this.where=null}};r([s({type:Boolean,json:{write:!0}})],F.prototype,"doNotLocateOnRestrictedElements",void 0),r([s({types:pt,json:{read:ct,write:!0}})],F.prototype,"geometry",void 0),r([I(Ft)],F.prototype,"geometryType",void 0),r([s({type:String,json:{name:"layerName",write:!0}})],F.prototype,"name",void 0),r([I(Et,{name:"spatialRel"})],F.prototype,"spatialRelationship",void 0),r([s({type:String,json:{write:!0}})],F.prototype,"type",void 0),r([s({type:String,json:{write:!0}})],F.prototype,"where",void 0),F=r([A("esri.rest.support.DataLayer")],F);const dr=F;var Te;let me=Te=class extends E{constructor(e){super(e),this.doNotLocateOnRestrictedElements=null}clone(){return new Te({doNotLocateOnRestrictedElements:this.doNotLocateOnRestrictedElements,...this.cloneProperties()})}};r([s({type:Boolean,json:{write:!0}})],me.prototype,"doNotLocateOnRestrictedElements",void 0),me=Te=r([A("esri.rest.support.NetworkFeatureSet")],me);const mr=me;let ae=class extends Pe(j){constructor(e){super(e),this.doNotLocateOnRestrictedElements=null,this.url=null}};r([s({type:Boolean,json:{write:!0}})],ae.prototype,"doNotLocateOnRestrictedElements",void 0),r([s({type:String,json:{write:!0}})],ae.prototype,"url",void 0),ae=r([A("esri.rest.support.NetworkUrl")],ae);const fr=ae;var Be;let y=Be=class extends Pe(j){constructor(e){super(e),this.accumulateAttributes=null,this.apiKey=null,this.attributeParameterValues=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsOutputType=null,this.directionsStyleName=null,this.directionsTimeAttribute=null,this.findBestSequence=null,this.geometryPrecision=null,this.geometryPrecisionM=null,this.geometryPrecisionZ=null,this.ignoreInvalidLocations=null,this.impedanceAttribute=null,this.outputGeometryPrecision=null,this.outputGeometryPrecisionUnits=null,this.outputLines="true-shape",this.outSpatialReference=null,this.overrides=null,this.pointBarriers=null,this.polygonBarriers=null,this.polylineBarriers=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.preserveObjectID=null,this.restrictionAttributes=null,this.restrictUTurns=null,this.returnBarriers=!1,this.returnDirections=!1,this.returnPolygonBarriers=!1,this.returnPolylineBarriers=!1,this.returnRoutes=!0,this.returnStops=!1,this.returnTraversedEdges=null,this.returnTraversedJunctions=null,this.returnTraversedTurns=null,this.returnZ=!0,this.startTime=null,this.startTimeIsUTC=!0,this.stops=null,this.timeWindowsAreUTC=null,this.travelMode=null,this.useHierarchy=null,this.useTimeWindows=null}static from(e){return yt(Be,e)}readAccumulateAttributes(e){return e==null?null:e.map(t=>H.fromJSON(t))}writeAccumulateAttributes(e,t,o){e!=null&&e.length&&(t[o]=e.map(i=>H.toJSON(i)))}writePointBarriers(e,t,o){ce(e,t,o)}writePolygonBarrier(e,t,o){ce(e,t,o)}writePolylineBarrier(e,t,o){ce(e,t,o)}readRestrictionAttributes(e){return e==null?null:e.map(t=>_e.fromJSON(t))}writeRestrictionAttributes(e,t,o){e!=null&&e.length&&(t[o]=e.map(i=>_e.toJSON(i)))}readStartTime(e,t){const{startTime:o}=t;return o==null?null:o==="now"?"now":new Date(o)}writeStartTime(e,t){e!=null&&(t.startTime=e==="now"?"now":e.getTime())}readStops(e,t){return Sr(t.stops)}writeStops(e,t,o){ce(e,t,o)}};r([s({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],y.prototype,"accumulateAttributes",void 0),r([P("accumulateAttributes")],y.prototype,"readAccumulateAttributes",null),r([q("accumulateAttributes")],y.prototype,"writeAccumulateAttributes",null),r([s(dt)],y.prototype,"apiKey",void 0),r([s({json:{write:!0}})],y.prototype,"attributeParameterValues",void 0),r([s({type:String,json:{write:!0}})],y.prototype,"directionsLanguage",void 0),r([I(Qe)],y.prototype,"directionsLengthUnits",void 0),r([I(Gt)],y.prototype,"directionsOutputType",void 0),r([I(Ut)],y.prototype,"directionsStyleName",void 0),r([I(Re,{name:"directionsTimeAttributeName",ignoreUnknown:!1})],y.prototype,"directionsTimeAttribute",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"findBestSequence",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"geometryPrecision",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"geometryPrecisionM",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"geometryPrecisionZ",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"ignoreInvalidLocations",void 0),r([I(H,{name:"impedanceAttributeName",ignoreUnknown:!1})],y.prototype,"impedanceAttribute",void 0),r([s({type:Number,json:{write:!0}})],y.prototype,"outputGeometryPrecision",void 0),r([I(qt)],y.prototype,"outputGeometryPrecisionUnits",void 0),r([I(Wt)],y.prototype,"outputLines",void 0),r([s({type:W,json:{name:"outSR",write:!0}})],y.prototype,"outSpatialReference",void 0),r([s({json:{write:!0}})],y.prototype,"overrides",void 0),r([s({json:{name:"barriers",write:!0}})],y.prototype,"pointBarriers",void 0),r([q("pointBarriers")],y.prototype,"writePointBarriers",null),r([s({json:{write:!0}})],y.prototype,"polygonBarriers",void 0),r([q("polygonBarriers")],y.prototype,"writePolygonBarrier",null),r([s({json:{write:!0}})],y.prototype,"polylineBarriers",void 0),r([q("polylineBarriers")],y.prototype,"writePolylineBarrier",null),r([s({type:Boolean,json:{write:!0}})],y.prototype,"preserveFirstStop",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"preserveLastStop",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"preserveObjectID",void 0),r([s({type:[String],json:{name:"restrictionAttributeNames",write:!0}})],y.prototype,"restrictionAttributes",void 0),r([P("restrictionAttributes")],y.prototype,"readRestrictionAttributes",null),r([q("restrictionAttributes")],y.prototype,"writeRestrictionAttributes",null),r([I(Zt)],y.prototype,"restrictUTurns",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnBarriers",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnDirections",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnPolygonBarriers",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnPolylineBarriers",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnRoutes",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnStops",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnTraversedEdges",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnTraversedJunctions",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnTraversedTurns",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"returnZ",void 0),r([s({type:Date,json:{type:Number,write:!0}})],y.prototype,"startTime",void 0),r([P("startTime")],y.prototype,"readStartTime",null),r([q("startTime")],y.prototype,"writeStartTime",null),r([s({type:Boolean,json:{write:!0}})],y.prototype,"startTimeIsUTC",void 0),r([s({json:{write:!0}})],y.prototype,"stops",void 0),r([P("stops")],y.prototype,"readStops",null),r([q("stops")],y.prototype,"writeStops",null),r([s({type:Boolean,json:{write:!0}})],y.prototype,"timeWindowsAreUTC",void 0),r([s({type:$e,json:{write:!0}})],y.prototype,"travelMode",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"useHierarchy",void 0),r([s({type:Boolean,json:{write:!0}})],y.prototype,"useTimeWindows",void 0),y=Be=r([A("esri.rest.support.RouteParameters")],y);const Fe=y;function hr(e){return e&&"type"in e}function vr(e){return e&&"features"in e&&"doNotLocateOnRestrictedElements"in e}function wr(e){return e&&"url"in e}function gr(e){return e&&"features"in e}function Sr(e){return hr(e)?dr.fromJSON(e):wr(e)?fr.fromJSON(e):vr(e)?mr.fromJSON(e):gr(e)?E.fromJSON(e):null}function ce(e,t,o){e!=null&&(t[o]=L.isCollection(e)?{features:e.toArray().map(i=>i.toJSON())}:e.toJSON())}function we(e){return e.length?e:null}function Ne(e){switch(e){case"esriGeometryPoint":return{type:"esriSMS",style:"esriSMSCircle",size:12,color:[0,0,0,0],outline:Ne("esriGeometryPolyline")};case"esriGeometryPolyline":return{type:"esriSLS",style:"esriSLSSolid",width:1,color:[0,0,0,0]};case"esriGeometryPolygon":return{type:"esriSFS",style:"esriSFSNull",outline:Ne("esriGeometryPolyline")}}}function ye(e){return"layers"in e}function br(e){return e.declaredClass==="esri.rest.support.FeatureSet"}function Tr(e){return e.declaredClass==="esri.rest.support.NetworkFeatureSet"}function Br(e,t,o){var Ie,Ae,Le,Oe,je,De;const i=(Ie=t.networkDataset)==null?void 0:Ie.networkAttributes,n=(i==null?void 0:i.filter(({usageType:m})=>m==="cost"))??[],p=o.travelMode??t.defaultTravelMode;if(p==null)return void st.warn("route-layer:missing-travel-mode","The routing service must have a default travel mode or one must be specified in the route parameter.");const{timeAttributeName:l,distanceAttributeName:c}=p,v=n.find(({name:m})=>m===l),S=n.find(({name:m})=>m===c),u=((Ae=o.travelMode)==null?void 0:Ae.impedanceAttributeName)??o.impedanceAttribute??t.impedance,b=v==null?void 0:v.units,N=S==null?void 0:S.units;if(!b||!N)throw new M("routelayer:unknown-impedance-units","the units of either the distance or time impedance are unknown");const B=o.directionsLanguage??t.directionsLanguage,h=o.accumulateAttributes??t.accumulateAttributeNames??[],w=new Set(n.filter(({name:m})=>m===l||m===c||m===u||m!=null&&h.includes(m)).map(({name:m})=>m)),d=m=>{for(const Me in m)w.has(Me)||delete m[Me]};for(const m of e.pointBarriers)m.costs!=null&&(m.addedCost=m.costs[u]??0,d(m.costs));for(const m of e.polygonBarriers)m.costs!=null&&(m.scaleFactor=m.costs[u]??1,d(m.costs));for(const m of e.polylineBarriers)m.costs!=null&&(m.scaleFactor=m.costs[u]??1,d(m.costs));const{routeInfo:a}=e,{findBestSequence:T,preserveFirstStop:f,preserveLastStop:R,startTimeIsUTC:J,timeWindowsAreUTC:it}=o;a.analysisSettings=new Vt({accumulateAttributes:h,directionsLanguage:B,findBestSequence:T,preserveFirstStop:f,preserveLastStop:R,startTimeIsUTC:J,timeWindowsAreUTC:it,travelMode:p}),a.totalDuration=z(((Le=a.totalCosts)==null?void 0:Le[l])??0,b),a.totalDistance=ge(((Oe=a.totalCosts)==null?void 0:Oe[c])??0,N),a.totalLateDuration=z(((je=a.totalViolations)==null?void 0:je[l])??0,b),a.totalWaitDuration=z(((De=a.totalWait)==null?void 0:De[l])??0,b),a.totalCosts!=null&&d(a.totalCosts),a.totalViolations!=null&&d(a.totalViolations),a.totalWait!=null&&d(a.totalWait);for(const m of e.stops)m.serviceCosts!=null&&(m.serviceDuration=z(m.serviceCosts[l]??0,b),m.serviceDistance=ge(m.serviceCosts[c]??0,N),d(m.serviceCosts)),m.cumulativeCosts!=null&&(m.cumulativeDuration=z(m.cumulativeCosts[l]??0,b),m.cumulativeDistance=ge(m.cumulativeCosts[c]??0,N),d(m.cumulativeCosts)),m.violations!=null&&(m.lateDuration=z(m.violations[l]??0,b),d(m.violations)),m.wait!=null&&(m.waitDuration=z(m.wait[l]??0,b),d(m.wait))}async function Ee(e){const t=W.WGS84;return await Ot(e.spatialReference,t),jt(e,t)}function z(e,t){switch(t){case"seconds":return e/60;case"hours":return 60*e;case"days":return 60*e*24;default:return e}}function ge(e,t){return t==="decimal-degrees"||t==="points"||t==="unknown"?e:Dt(e,t,"meters")}function Nr(e){const{attributes:t,geometry:o,popupTemplate:i,symbol:n}=e.toGraphic().toJSON();return{attributes:t,geometry:o,popupInfo:i,symbol:n}}const Pr=L.ofType(oe),Rr=L.ofType(se),Ge=L.ofType(Q),Ue=L.ofType(X),qe=L.ofType(ee),We=L.ofType(te),ot="esri.layers.RouteLayer",st=Ze.getLogger(ot);let g=class extends mt(ft(ht(vt(wt(Mt))))){constructor(e){super(e),this._cachedServiceDescription=null,this._featureCollection=null,this._type="Feature Collection",this.defaultSymbols=new et,this.directionLines=null,this.directionPoints=null,this.featureCollectionType="route",this.legendEnabled=!1,this.maxScale=0,this.minScale=0,this.pointBarriers=new Ge,this.polygonBarriers=new Ue,this.polylineBarriers=new qe,this.routeInfo=null,this.spatialReference=W.WGS84,this.stops=new We,this.type="route";const t=()=>{this._setStopSymbol(this.stops)};this.addHandles(gt(()=>this.stops,"change",t,{sync:!0,onListenerAdd:t}))}writeFeatureCollectionWebmap(e,t,o,i){const n=[this._writePolygonBarriers(),this._writePolylineBarriers(),this._writePointBarriers(),this._writeRouteInfo(),this._writeDirectionLines(),this._writeDirectionPoints(),this._writeStops()].filter(c=>!!c),p=n.map((c,v)=>v),l=i.origin==="web-map"?"featureCollection.layers":"layers";St(l,n,t),t.opacity=this.opacity,t.visibility=this.visible,t.visibleLayers=p}readDirectionLines(e,t){return this._getNetworkFeatures(t,"DirectionLines",o=>oe.fromGraphic(o))}readDirectionPoints(e,t){return this._getNetworkFeatures(t,"DirectionPoints",o=>se.fromGraphic(o))}get fullExtent(){var n;const e=new He({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:W.WGS84});if(((n=this.routeInfo)==null?void 0:n.geometry)!=null)return this.routeInfo.geometry.extent??e;if(this.stops==null)return e;const t=this.stops.filter(p=>p.geometry!=null);if(t.length<2)return e;const{spatialReference:o}=t.at(0).geometry;if(o==null)return e;const i=t.toArray().map(p=>{const l=p.geometry;return[l.x,l.y]});return new bt({points:i,spatialReference:o}).extent}readMaxScale(e,t){var n;const o=ye(t)?t.layers:(n=t.featureCollection)==null?void 0:n.layers,i=o==null?void 0:o.find(p=>p.layerDefinition.maxScale!=null);return(i==null?void 0:i.layerDefinition.maxScale)??0}readMinScale(e,t){var n;const o=ye(t)?t.layers:(n=t.featureCollection)==null?void 0:n.layers,i=o==null?void 0:o.find(p=>p.layerDefinition.minScale!=null);return(i==null?void 0:i.layerDefinition.minScale)??0}readPointBarriers(e,t){return this._getNetworkFeatures(t,"Barriers",o=>Q.fromGraphic(o))}readPolygonBarriers(e,t){return this._getNetworkFeatures(t,"PolygonBarriers",o=>X.fromGraphic(o))}readPolylineBarriers(e,t){return this._getNetworkFeatures(t,"PolylineBarriers",o=>ee.fromGraphic(o))}readRouteInfo(e,t){const o=this._getNetworkFeatures(t,"RouteInfo",i=>le.fromGraphic(i));return o.length>0?o.at(0):null}readSpatialReference(e,t){var c,v;const o=ye(t)?t.layers:(c=t.featureCollection)==null?void 0:c.layers;if(!(o!=null&&o.length))return W.WGS84;const{layerDefinition:i,featureSet:n}=o[0],p=n.features[0],l=((v=p==null?void 0:p.geometry)==null?void 0:v.spatialReference)??n.spatialReference??i.spatialReference??i.extent.spatialReference??Ce;return W.fromJSON(l)}readStops(e,t){return this._getNetworkFeatures(t,"Stops",o=>te.fromGraphic(o),o=>this._setStopSymbol(o))}get title(){var e;return((e=this.routeInfo)==null?void 0:e.name)!=null?this.routeInfo.name:"Route"}set title(e){this._overrideIfSome("title",e)}get url(){return Je.routeServiceUrl}set url(e){e!=null?this._set("url",Tt(e,st)):this._set("url",Je.routeServiceUrl)}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}removeAll(){this.removeResult(),this.pointBarriers.removeAll(),this.polygonBarriers.removeAll(),this.polylineBarriers.removeAll(),this.stops.removeAll()}removeResult(){this.directionLines!=null&&(this.directionLines.removeAll(),this._set("directionLines",null)),this.directionPoints!=null&&(this.directionPoints.removeAll(),this._set("directionPoints",null)),this.routeInfo!=null&&this._set("routeInfo",null)}async save(){await this.load();const{fullExtent:e,portalItem:t}=this;if(!t)throw new M("routelayer:portal-item-not-set","save() requires to the layer to have a portal item");if(!t.id)throw new M("routelayer:portal-item-not-saved","Please use saveAs() first to save the routelayer");if(t.type!=="Feature Collection")throw new M("routelayer:portal-item-wrong-type",'Portal item needs to have type "Feature Collection"');if(this.routeInfo==null)throw new M("routelayer:route-unsolved","save() requires a solved route");const{portal:o}=t;await o.signIn(),o.user||await t.reload();const{itemUrl:i,itemControl:n}=t;if(n!=="admin"&&n!=="update")throw new M("routelayer:insufficient-permissions","To save this layer, you need to be the owner or an administrator of your organization");const p={messages:[],origin:"portal-item",portal:o,url:i?Bt(i):void 0,writtenProperties:[]},l=this.write(void 0,p);return t.extent=await Ee(e),t.title=this.title,await t.update({data:l}),t}async saveAs(e,t={}){var c;if(await this.load(),this.routeInfo==null)throw new M("routelayer:route-unsolved","saveAs() requires a solved route");const o=Nt.from(e).clone();o.extent??(o.extent=await Ee(this.fullExtent)),o.id=null,o.portal??(o.portal=Pt.getDefault()),o.title??(o.title=this.title),o.type="Feature Collection",o.typeKeywords=["Data","Feature Collection",Rt.MULTI_LAYER,"Route Layer"];const{portal:i}=o,n={messages:[],origin:"portal-item",portal:i,url:null,writtenProperties:[]};await i.signIn();const p=t==null?void 0:t.folder,l=this.write(void 0,n);return await((c=i.user)==null?void 0:c.addItem({item:o,folder:p,data:l})),this.portalItem=o,$t(n),n.portalItem=o,o}async solve(e,t){const o=(e==null?void 0:e.stops)??this.stops,i=(e==null?void 0:e.pointBarriers)??we(this.pointBarriers),n=(e==null?void 0:e.polylineBarriers)??we(this.polylineBarriers),p=(e==null?void 0:e.polygonBarriers)??we(this.polygonBarriers);if(o==null)throw new M("routelayer:undefined-stops","the route layer must have stops defined in the route parameters.");if((br(o)||Tr(o))&&o.features.length<2||L.isCollection(o)&&o.length<2)throw new M("routelayer:insufficent-stops","the route layer must have two or more stops to solve a route.");if(L.isCollection(o))for(const d of o)d.routeName=null;const l=e==null?void 0:e.apiKey,c=this.url,v=await this._getServiceDescription(c,l,t),S=(e==null?void 0:e.travelMode)??v.defaultTravelMode,u=(e==null?void 0:e.accumulateAttributes)??[];S!=null&&(u.push(S.distanceAttributeName),S.timeAttributeName&&u.push(S.timeAttributeName));const b={startTime:new Date},N={accumulateAttributes:u,directionsOutputType:"featuresets",ignoreInvalidLocations:!0,pointBarriers:i,polylineBarriers:n,polygonBarriers:p,preserveFirstStop:!0,preserveLastStop:!0,returnBarriers:!!i,returnDirections:!0,returnPolygonBarriers:!!p,returnPolylineBarriers:!!n,returnRoutes:!0,returnStops:!0,stops:o},B=e?Fe.from(e):new Fe;for(const d in b)B[d]==null&&(B[d]=b[d]);let h;B.set(N);try{h=await cr(c,B,t)}catch(d){throw It(d)?d:new M("routelayer:failed-route-request","the routing request failed",{error:d})}const w=this._toRouteLayerSolution(h);return this._isOverridden("title")||(this.title=w.routeInfo.name??"Route"),Br(w,v,B),w}update(e){const{stops:t,directionLines:o,directionPoints:i,pointBarriers:n,polylineBarriers:p,polygonBarriers:l,routeInfo:c}=e;this.set({stops:t,pointBarriers:n,polylineBarriers:p,polygonBarriers:l}),this._set("directionLines",o),this._set("directionPoints",i),this._set("routeInfo",c),c.geometry!=null&&(this.spatialReference=c.geometry.spatialReference)}_getNetworkFeatures(e,t,o,i){var w;const n=ye(e)?e.layers:(w=e.featureCollection)==null?void 0:w.layers,p=n==null?void 0:n.find(d=>d.layerDefinition.name===t);if(p==null)return new L;const{layerDefinition:l,popupInfo:c,featureSet:v}=p,S=l.drawingInfo.renderer,{features:u}=v,b=v.spatialReference??l.spatialReference??l.extent.spatialReference??Ce,N=S&&At(S),B=W.fromJSON(b),h=u.map(d=>{const a=K.fromJSON(d);a.geometry!=null&&d.geometry!=null&&d.geometry.spatialReference==null&&(a.geometry.spatialReference=B);const T=o(a);return T.symbol??(T.symbol=(N==null?void 0:N.getSymbol(a))??this._getNetworkSymbol(t)),T.popupTemplate??(T.popupTemplate=c&&Lt.fromJSON(c)),T});return i&&h.some(d=>!d.symbol)&&i(h),new L(h)}_getNetworkSymbol(e){switch(e){case"Barriers":return this.defaultSymbols.pointBarriers;case"DirectionPoints":return this.defaultSymbols.directionPoints;case"DirectionLines":return this.defaultSymbols.directionLines;case"PolylineBarriers":return this.defaultSymbols.polylineBarriers;case"PolygonBarriers":return this.defaultSymbols.polygonBarriers;case"RouteInfo":return this.defaultSymbols.routeInfo;case"Stops":return null}}async _getServiceDescription(e,t,o){if(this._cachedServiceDescription!=null&&this._cachedServiceDescription.url===e)return this._cachedServiceDescription.serviceDescription;const i=await tt(e,t,o);return this._cachedServiceDescription={serviceDescription:i,url:e},i}_setStopSymbol(e){if(!e||e.length===0||this.defaultSymbols.stops==null||e.every(({symbol:u})=>u!=null))return;const{first:t,last:o,middle:i,unlocated:n,waypoint:p,break:l}=this.defaultSymbols.stops;if(this.routeInfo==null||e.length===1)return void e.forEach((u,b)=>{switch(b){case 0:u.symbol=t;break;case e.length-1:u.symbol=o;break;default:u.symbol=i}});const c=e.map(({sequence:u})=>u).filter(u=>u!=null),v=Math.min(...c),S=Math.max(...c);for(const u of e)u.sequence!==v?u.sequence!==S?u.status==="ok"||u.status==="not-located-on-closest"?u.locationType!=="waypoint"?u.locationType!=="break"?u.symbol=i:u.symbol=l:u.symbol=p:u.symbol=n:u.symbol=o:u.symbol=t}_toRouteLayerSolution(e){var S,u,b,N,B,h,w;const t=(S=e.routeResults[0].stops)==null?void 0:S.map(d=>te.fromJSON(d.toJSON()));this._setStopSymbol(t);const o=new We(t),i=new Ue((u=e.polygonBarriers)==null?void 0:u.map(d=>{const a=X.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.polygonBarriers,a})),n=new qe((b=e.polylineBarriers)==null?void 0:b.map(d=>{const a=ee.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.polylineBarriers,a})),p=new Ge((N=e.pointBarriers)==null?void 0:N.map(d=>{const a=Q.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.pointBarriers,a})),l=(B=e.routeResults[0].route)==null?void 0:B.toJSON(),c=le.fromJSON(l);c.symbol=this.defaultSymbols.routeInfo;const v=new Rr((h=e.routeResults[0].directionPoints)==null?void 0:h.features.map(d=>{const a=se.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.directionPoints,a}));return{directionLines:new Pr((w=e.routeResults[0].directionLines)==null?void 0:w.features.map(d=>{const a=oe.fromJSON(d.toJSON());return a.symbol=this.defaultSymbols.directionLines,a})),directionPoints:v,pointBarriers:p,polygonBarriers:i,polylineBarriers:n,routeInfo:c,stops:o}}_writeDirectionLines(){return this._writeNetworkFeatures(this.directionLines,this.defaultSymbols.directionLines,"esriGeometryPolyline",oe.fields,oe.popupInfo,"DirectionLines","Direction Lines")}_writeDirectionPoints(){return this._writeNetworkFeatures(this.directionPoints,this.defaultSymbols.directionPoints,"esriGeometryPoint",se.fields,se.popupInfo,"DirectionPoints","Direction Points")}_writeNetworkFeatures(e,t,o,i,n,p,l){if(!(e!=null&&e.length))return null;const c=this.spatialReference.toJSON(),{fullExtent:v,maxScale:S,minScale:u}=this;return{featureSet:{features:e.toArray().map(b=>Nr(b)),geometryType:o,spatialReference:c},layerDefinition:{capabilities:"Query,Update,Editing",drawingInfo:{renderer:{type:"simple",symbol:t!=null?t.toJSON():Ne(o)}},extent:v.toJSON(),fields:i,geometryType:o,hasM:!1,hasZ:!1,maxScale:S,minScale:u,name:p,objectIdField:"ObjectID",spatialReference:c,title:l,type:"Feature Layer",typeIdField:""},popupInfo:n}}_writePointBarriers(){return this._writeNetworkFeatures(this.pointBarriers,this.defaultSymbols.pointBarriers,"esriGeometryPoint",Q.fields,Q.popupInfo,"Barriers","Point Barriers")}_writePolygonBarriers(){return this._writeNetworkFeatures(this.polygonBarriers,this.defaultSymbols.polygonBarriers,"esriGeometryPolygon",X.fields,X.popupInfo,"PolygonBarriers","Polygon Barriers")}_writePolylineBarriers(){return this._writeNetworkFeatures(this.polylineBarriers,this.defaultSymbols.polylineBarriers,"esriGeometryPolyline",ee.fields,ee.popupInfo,"PolylineBarriers","Line Barriers")}_writeRouteInfo(){return this._writeNetworkFeatures(this.routeInfo!=null?new L([this.routeInfo]):null,this.defaultSymbols.routeInfo,"esriGeometryPolyline",le.fields,le.popupInfo,"RouteInfo","Route Details")}_writeStops(){var p,l,c;const e=this._writeNetworkFeatures(this.stops,null,"esriGeometryPoint",te.fields,te.popupInfo,"Stops","Stops");if(e==null)return null;const{stops:t}=this.defaultSymbols,o=(p=t==null?void 0:t.first)==null?void 0:p.toJSON(),i=(l=t==null?void 0:t.middle)==null?void 0:l.toJSON(),n=(c=t==null?void 0:t.last)==null?void 0:c.toJSON();return e.layerDefinition.drawingInfo.renderer={type:"uniqueValue",field1:"Sequence",defaultSymbol:i,uniqueValueInfos:[{value:"1",symbol:o,label:"First Stop"},{value:`${this.stops.length}`,symbol:n,label:"Last Stop"}]},e}};r([s({readOnly:!0,json:{read:!1,origins:{"portal-item":{write:{allowNull:!0,ignoreOrigin:!0}},"web-map":{write:{overridePolicy(){return{allowNull:!0,ignoreOrigin:this.portalItem==null}}}}}}})],g.prototype,"_featureCollection",void 0),r([q(["web-map","portal-item"],"_featureCollection")],g.prototype,"writeFeatureCollectionWebmap",null),r([s({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{target:"type",overridePolicy(){return{ignoreOrigin:this.portalItem!=null}}}}}}})],g.prototype,"_type",void 0),r([s({nonNullable:!0,type:et})],g.prototype,"defaultSymbols",void 0),r([s({readOnly:!0})],g.prototype,"directionLines",void 0),r([P(["web-map","portal-item"],"directionLines",["layers","featureCollection.layers"])],g.prototype,"readDirectionLines",null),r([s({readOnly:!0})],g.prototype,"directionPoints",void 0),r([P(["web-map","portal-item"],"directionPoints",["layers","featureCollection.layers"])],g.prototype,"readDirectionPoints",null),r([s({readOnly:!0,json:{read:!1,origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],g.prototype,"featureCollectionType",void 0),r([s({readOnly:!0})],g.prototype,"fullExtent",null),r([s({json:{origins:{"web-map":{name:"featureCollection.showLegend"}},write:!0}})],g.prototype,"legendEnabled",void 0),r([s({type:["show","hide"]})],g.prototype,"listMode",void 0),r([s({type:Number,nonNullable:!0,json:{write:!1}})],g.prototype,"maxScale",void 0),r([P(["web-map","portal-item"],"maxScale",["layers","featureCollection.layers"])],g.prototype,"readMaxScale",null),r([s({type:Number,nonNullable:!0,json:{write:!1}})],g.prototype,"minScale",void 0),r([P(["web-map","portal-item"],"minScale",["layers","featureCollection.layers"])],g.prototype,"readMinScale",null),r([s({type:["ArcGISFeatureLayer"],value:"ArcGISFeatureLayer"})],g.prototype,"operationalLayerType",void 0),r([s({nonNullable:!0,type:L.ofType(Q)})],g.prototype,"pointBarriers",void 0),r([P(["web-map","portal-item"],"pointBarriers",["layers","featureCollection.layers"])],g.prototype,"readPointBarriers",null),r([s({nonNullable:!0,type:L.ofType(X)})],g.prototype,"polygonBarriers",void 0),r([P(["web-map","portal-item"],"polygonBarriers",["layers","featureCollection.layers"])],g.prototype,"readPolygonBarriers",null),r([s({nonNullable:!0,type:L.ofType(ee)})],g.prototype,"polylineBarriers",void 0),r([P(["web-map","portal-item"],"polylineBarriers",["layers","featureCollection.layers"])],g.prototype,"readPolylineBarriers",null),r([s({readOnly:!0})],g.prototype,"routeInfo",void 0),r([P(["web-map","portal-item"],"routeInfo",["layers","featureCollection.layers"])],g.prototype,"readRouteInfo",null),r([s({type:W})],g.prototype,"spatialReference",void 0),r([P(["web-map","portal-item"],"spatialReference",["layers","featureCollection.layers"])],g.prototype,"readSpatialReference",null),r([s({nonNullable:!0,type:L.ofType(te)})],g.prototype,"stops",void 0),r([P(["web-map","portal-item"],"stops",["layers","featureCollection.layers"])],g.prototype,"readStops",null),r([s()],g.prototype,"title",null),r([s({readOnly:!0,json:{read:!1}})],g.prototype,"type",void 0),r([s()],g.prototype,"url",null),g=r([A(ot)],g);const Er=g;export{Er as default}; diff --git a/dist/assets/RouteLayerView3D-tOy-WtTD.js b/dist/assets/RouteLayerView3D-EnI30QTX.js similarity index 84% rename from dist/assets/RouteLayerView3D-tOy-WtTD.js rename to dist/assets/RouteLayerView3D-EnI30QTX.js index aa7a755..94d5aa5 100644 --- a/dist/assets/RouteLayerView3D-tOy-WtTD.js +++ b/dist/assets/RouteLayerView3D-EnI30QTX.js @@ -1 +1 @@ -import{P as c,F as h,n as m,fP as y,V as d,d as u,G as g,e as i,y as o,c as f}from"./index-J0iiHjMT.js";import{m as b,c as O,C as _,T as I,j as v,S as w,O as S}from"./Stop-W76EJiT2.js";import{n as V}from"./LayerView3D-iOx2MD1g.js";import{O as G}from"./GraphicsProcessor-rh5nA4fc.js";import{l as C}from"./projectExtentUtils-TwA6ooHn.js";import{r as P}from"./EventedSet-JGlFrfoR.js";import{u as R}from"./LayerView-efDufa6j.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";function $(e){return e instanceof b||e instanceof O||e instanceof _||e instanceof I||e instanceof v||e instanceof w||e instanceof S}let r=class extends V(R){constructor(){super(...arguments),this.type="route-3d",this.loadedGraphics=new P,this._byObjectID=new Map,this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null}initialize(){this._set("processor",new G({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this._updatingHandles.addOnCollectionChange(()=>this._routeItems,e=>this._routeItemsChanged(e),c),this.addResolvingPromise(C(this).then(e=>this.fullExtentInLocalViewSpatialReference=e)),this.addHandles(h(()=>{var e,t;return(t=(e=this.view)==null?void 0:e.basemapTerrain)==null?void 0:t.ready},()=>()=>this.notifyChange("updating"),{once:!0}))}destroy(){var e;this._updatingHandles.removeAll(),this._set("processor",m(this.processor)),(e=this._get("_routeItems"))==null||e.destroy()}get _routeItems(){return new y({getCollections:()=>[this.layer.pointBarriers,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.stops,this.layer.directionLines,this.layer.directionPoints,this.layer.routeInfo!=null?new d([this.layer.routeInfo]):null]})}_routeItemsChanged(e){if(e.removed.length){this.loadedGraphics.removeMany(e.removed.map(t=>{const s=this._byObjectID.get(t);return this._byObjectID.delete(t),s}));for(const t of e.removed)this.removeHandles(t)}if(e.added.length){this.loadedGraphics.addMany(e.added.map(t=>{const s=t.toGraphic();return this._byObjectID.set(t,s),s}));for(const t of e.added)this.addHandles([u(()=>t.geometry,(s,n)=>{this._updateGraphic(t,"geometry",s,n)}),u(()=>t.symbol,(s,n)=>{this._updateGraphic(t,"symbol",s,n)})],t)}}get legendEnabled(){var e;return this.canResume()&&!((e=this.processor)!=null&&e.frustumVisibilitySuspended)}getSuspendInfo(){var t,s;const e=super.getSuspendInfo();return e.outsideScaleRange=((t=this.processor)==null?void 0:t.scaleVisibilitySuspended)??!1,e.outsideOfView=((s=this.processor)==null?void 0:s.frustumVisibilitySuspended)??!1,e}async fetchPopupFeatures(e,t){return(t==null?void 0:t.clientGraphics)??[]}getHit(e){return this.processor.getHit(e)}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){var s;return(s=this.processor)==null?void 0:s.computeAttachmentOrigin(e,t)}getSymbolLayerSize(e,t){return this.processor.getSymbolLayerSize(e,t)}async queryGraphics(){return new d(this.loadedGraphics.toArray())}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e){return $(e)&&(e=this._byObjectID.get(e)),this.processor.highlight(e)}get updatePolicy(){var e;return((e=this.processor)==null?void 0:e.graphicsCore.effectiveUpdatePolicy)||g.SYNC}canResume(){var e;return super.canResume()&&!((e=this.processor)!=null&&e.scaleVisibilitySuspended)}isUpdating(){var e,t,s;return!(!((e=this.processor)!=null&&e.updating)&&((s=(t=this.view)==null?void 0:t.basemapTerrain)!=null&&s.ready))}get performanceInfo(){var e,t;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:-1,totalNumberOfFeatures:-1,nodes:0,core:null,updating:this.updating,elevationUpdating:((e=this.processor)==null?void 0:e.elevationAlignment.updating)??!1,visibilityFrustum:!((t=this.processor)!=null&&t.frustumVisibilitySuspended)}}_updateGraphic(e,t,s,n){var p;const l=this._byObjectID.get(e);l[t]=s,a.graphic=l,a.property=t,a.oldValue=n,a.newValue=s,(p=this.processor)==null||p.graphicsCore.graphicUpdateHandler(a)}};i([o()],r.prototype,"_routeItems",null),i([o()],r.prototype,"loadedGraphics",void 0),i([o({readOnly:!0})],r.prototype,"legendEnabled",null),i([o()],r.prototype,"layer",void 0),i([o({readOnly:!0})],r.prototype,"processor",void 0),i([o({type:Boolean})],r.prototype,"slicePlaneEnabled",void 0),r=i([f("esri.views.3d.layers.RouteLayerView3D")],r);const a={graphic:null,property:null,oldValue:null,newValue:null},U=r;export{U as default}; +import{P as c,v as h,b as m,fK as y,V as d,B as u,C as g,e as i,y as o,c as f}from"./index-pCX-0tJH.js";import{m as b,c as O,C as _,T as v,j as I,S as w,O as S}from"./Stop-d3MLMjE8.js";import{n as V}from"./LayerView3D-57OghbRh.js";import{O as G}from"./GraphicsProcessor-QBvSewdt.js";import{l as C}from"./projectExtentUtils-Q4rXasWA.js";import{r as P}from"./EventedSet-TJfupI82.js";import{u as R}from"./LayerView-ixwLVnzr.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";function $(e){return e instanceof b||e instanceof O||e instanceof _||e instanceof v||e instanceof I||e instanceof w||e instanceof S}let r=class extends V(R){constructor(){super(...arguments),this.type="route-3d",this.loadedGraphics=new P,this._byObjectID=new Map,this.slicePlaneEnabled=!1,this.fullExtentInLocalViewSpatialReference=null}initialize(){this._set("processor",new G({owner:this,scaleVisibilityEnabled:!0,frustumVisibilityEnabled:!0})),this.addResolvingPromise(this.processor.initializePromise),this._updatingHandles.addOnCollectionChange(()=>this._routeItems,e=>this._routeItemsChanged(e),c),this.addResolvingPromise(C(this).then(e=>this.fullExtentInLocalViewSpatialReference=e)),this.addHandles(h(()=>{var e,t;return(t=(e=this.view)==null?void 0:e.basemapTerrain)==null?void 0:t.ready},()=>()=>this.notifyChange("updating"),{once:!0}))}destroy(){var e;this._updatingHandles.removeAll(),this._set("processor",m(this.processor)),(e=this._get("_routeItems"))==null||e.destroy()}get _routeItems(){return new y({getCollections:()=>[this.layer.pointBarriers,this.layer.polygonBarriers,this.layer.polylineBarriers,this.layer.stops,this.layer.directionLines,this.layer.directionPoints,this.layer.routeInfo!=null?new d([this.layer.routeInfo]):null]})}_routeItemsChanged(e){if(e.removed.length){this.loadedGraphics.removeMany(e.removed.map(t=>{const s=this._byObjectID.get(t);return this._byObjectID.delete(t),s}));for(const t of e.removed)this.removeHandles(t)}if(e.added.length){this.loadedGraphics.addMany(e.added.map(t=>{const s=t.toGraphic();return this._byObjectID.set(t,s),s}));for(const t of e.added)this.addHandles([u(()=>t.geometry,(s,n)=>{this._updateGraphic(t,"geometry",s,n)}),u(()=>t.symbol,(s,n)=>{this._updateGraphic(t,"symbol",s,n)})],t)}}get legendEnabled(){var e;return this.canResume()&&!((e=this.processor)!=null&&e.frustumVisibilitySuspended)}getSuspendInfo(){var t,s;const e=super.getSuspendInfo();return e.outsideScaleRange=((t=this.processor)==null?void 0:t.scaleVisibilitySuspended)??!1,e.outsideOfView=((s=this.processor)==null?void 0:s.frustumVisibilitySuspended)??!1,e}async fetchPopupFeatures(e,t){return(t==null?void 0:t.clientGraphics)??[]}getHit(e){return this.processor.getHit(e)}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){var s;return(s=this.processor)==null?void 0:s.computeAttachmentOrigin(e,t)}getSymbolLayerSize(e,t){return this.processor.getSymbolLayerSize(e,t)}async queryGraphics(){return new d(this.loadedGraphics.toArray())}maskOccludee(e){return this.processor.maskOccludee(e)}highlight(e){return $(e)&&(e=this._byObjectID.get(e)),this.processor.highlight(e)}get updatePolicy(){var e;return((e=this.processor)==null?void 0:e.graphicsCore.effectiveUpdatePolicy)||g.SYNC}canResume(){var e;return super.canResume()&&!((e=this.processor)!=null&&e.scaleVisibilitySuspended)}isUpdating(){var e,t,s;return!(!((e=this.processor)!=null&&e.updating)&&((s=(t=this.view)==null?void 0:t.basemapTerrain)!=null&&s.ready))}get performanceInfo(){var e,t;return{displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:-1,totalNumberOfFeatures:-1,nodes:0,core:null,updating:this.updating,elevationUpdating:((e=this.processor)==null?void 0:e.elevationAlignment.updating)??!1,visibilityFrustum:!((t=this.processor)!=null&&t.frustumVisibilitySuspended)}}_updateGraphic(e,t,s,n){var p;const l=this._byObjectID.get(e);l[t]=s,a.graphic=l,a.property=t,a.oldValue=n,a.newValue=s,(p=this.processor)==null||p.graphicsCore.graphicUpdateHandler(a)}};i([o()],r.prototype,"_routeItems",null),i([o()],r.prototype,"loadedGraphics",void 0),i([o({readOnly:!0})],r.prototype,"legendEnabled",null),i([o()],r.prototype,"layer",void 0),i([o({readOnly:!0})],r.prototype,"processor",void 0),i([o({type:Boolean})],r.prototype,"slicePlaneEnabled",void 0),r=i([f("esri.views.3d.layers.RouteLayerView3D")],r);const a={graphic:null,property:null,oldValue:null,newValue:null},U=r;export{U as default}; diff --git a/dist/assets/SceneLayerGraphicsView3D-Abn6jwJk.js b/dist/assets/SceneLayerGraphicsView3D-Abn6jwJk.js deleted file mode 100644 index 78655c4..0000000 --- a/dist/assets/SceneLayerGraphicsView3D-Abn6jwJk.js +++ /dev/null @@ -1,7 +0,0 @@ -import{ls as V,K as R,lt as H,fQ as q,n as y,lu as Q,P as N,d as U,de as z,jO as C,G as T,dB as B,lv as k,lw as W,c8 as Z,Z as w,gn as D,lx as K,fR as Y,ly as X,bn as J,h$ as F,lz as ee,as as te,lA as re,lB as ie,S as G,bB as se,lC as oe,lD as ae,lE as ne,lF as de,ca as S,ai as le,e as p,y as g,dC as he,fi as ue,c as ce,lG as L,aa as pe,lH as ge}from"./index-J0iiHjMT.js";import{S as A,e as me}from"./I3SOverrides-5dCbMm3h.js";import{n as _e}from"./LayerView3D-iOx2MD1g.js";import{P as fe,l as ye}from"./HeatmapDensity.glsl-y7dUg--m.js";import{c as be,i as ve,u as xe,f as Ee,a as Ie,j as we}from"./SceneLayerView-MZstNOoI.js";import{t as Ne}from"./DefinitionExpressionSceneLayerView-oAOUEjm-.js";import{i as Ce}from"./PopupSceneLayerView-cRxapYqF.js";import"./I3SNode-5SPByfpU.js";import"./ReactiveSet-HLstcUcf.js";import"./meshFeatureSet-Mcou8mDC.js";import"./External-GV0jSEES.js";import"./FeatureSet-d4S1oKME.js";import"./FeatureLayerView3D-t6NDkLO0.js";import"./FeatureLayerViewBase3D-VurTj7t3.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./EventedSet-JGlFrfoR.js";import"./FeatureEffect-5bEV-xG1.js";import"./LayerView-efDufa6j.js";import"./RefreshableLayerView-Pd4dLcWr.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./queryForSymbologySnapping-I1fFQTD_.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./QueryEngine-8tLWlkSE.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./FeatureStore-X-AIJLo2.js";import"./BoundsStore-wmwfHjhp.js";import"./projectExtentUtils-TwA6ooHn.js";class P extends V{constructor(t){super("SceneLayerWorker","dracoDecompressPointCloudData",{dracoDecompressPointCloudData:i=>[i.geometryBuffer]},t,{hasInitialize:!0})}}class Oe extends R{constructor(t,i){super(),this._updateAndCompare=t,this._notifyUpdated=i,this._nodes=new Map,this._graphics=new Map,this._duplicates=new Map}clear(){if(this._graphics.size>0){const t=this.toArray();this._graphics.clear(),this.emit("change",{added:[],removed:t})}this._nodes.clear()}get length(){return this._graphics.size}get(t){return this._graphics.get(t)}getNode(t){return this._nodes.get(t)}hasNode(t){return this._nodes.has(t)}nodes(){return this._nodes.values()}addNode(t,i){this._nodes.set(t,i);const r=i.graphics;if(r.length===0)return;const s=new Set;for(let a=0;a0?r.filter(a=>!s.has(a.objectId)):r;o.length>0&&this.emit("change",{added:o,removed:[]})}removeNode(t){const i=this._nodes.get(t);if(!i)return void console.error("Removing unknown node");this._nodes.delete(t);const r=new Set,s=[];for(const o of i.graphics){const a=o.objectId,n=this._graphics.get(a);if(!n)continue;const d=this._duplicates.get(a);if(d){const h=d.indexOf(t);if(h===-1){console.error("error: removing graphic from node that should not reference it.");continue}if(d.splice(h,1),n.nodeIndex===t){let u=this.getNode(d[0]);for(let l=1;lu.node.level)&&(u=m)}u!=null&&r.add(u)}d.length===1&&this._duplicates.delete(a)}else this._graphics.delete(a),s.push(o)}s.length>0&&this.emit("change",{added:[],removed:s}),r.forEach(o=>this._updateForeignGraphics(o))}_updateForeignGraphics(t){const i=[],r=t.node.index,s=t.node.level;let o=0;for(;os)o+=n;else{for(let h=o;h!!t(r)&&(i=r,!0)),i}forEach(t){this._graphics.forEach(i=>t(i))}forEachNode(t){this._nodes.forEach((i,r)=>t(i,r))}get nodeCount(){return this._nodes.size}_checkInvariants(){const t=new Map;this._nodes.forEach((r,s)=>{s!==r.node.index&&console.error("Mismatched node index"),r.graphics.forEach(o=>{t.set(o.objectId,1+(t.get(o.objectId)??0));const a=this._duplicates.get(o.objectId);a&&!a.includes(s)&&console.error("Node not listed in duplicate list"),a||o.nodeIndex===s||console.error("Unique graphic does not reference owning node index")})}),this._graphics.size!==t.size&&console.error("Mismatch between actual and expected number of graphics");let i=0;t.forEach((r,s)=>{i+=r>1?1:0;const o=this._graphics.get(s);if(!o)return void console.error("Missing graphic entry");const a=this._nodes.get(o.nodeIndex);if(!a)return void console.error("Graphic references unkown node");const n=this._duplicates.get(s);n?(n.length!==r&&console.error("Wrong number of entries in duplicate list"),n.forEach(d=>{const h=this._nodes.get(d);h?h.node.level>a.node.level&&console.error("Duplicated graphic does not reference highest level node"):console.error("Unknown node in duplicate list")})):r>1&&console.error("Missing duplicates entry")}),this._duplicates.size!==i&&console.error("Mismatch between expected and actual number of duplicate entries")}}const M=Ie();class De{constructor(t,i,r,s){this.graphics=t,this.featureIds=i,this.attributeInfo=r,this.node=s}}let c=class extends Ne(Ce(_e(we))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this._pendingEditsQueue=Promise.resolve(),this.loadedGraphics=new Oe((e,t,i)=>Ge(e,t,i),e=>this.processor.graphicsCore.recreateGraphics(e)),this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url===this.layer.url&&this._i3sOverrides.isEmpty?e.load(t).then(()=>{var r;q(this.layer,e,this._i3sOverrides),this.layer=e,this._i3sOverrides.destroy();const i=(r=this.view.resourceController)==null?void 0:r.memoryController;this._i3sOverrides=new A({view:this.view,layer:e,memoryController:i}),y(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()}):null}initialize(){var t,i;this.addResolvingPromise(this.layer.indexInfo);const e=(t=this.view.resourceController)==null?void 0:t.memoryController;this._i3sOverrides=new A({view:this.view,layer:this.layer,memoryController:e}),Q(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new be({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,r=>this._rangeInfosChanged(r),N),this._updatingHandles.add(()=>this.layer.renderer,(r,s)=>this._rendererChange(r,s)),this._updatingHandles.add(()=>[this.parsedDefinitionExpression,this._excludeObjectIdsSorted],()=>this._filterChange()),this.addHandles(U(()=>C.I3S_TREE_SHOW_TILES,r=>{if(r&&!this._treeDebugger){const s=this._controller.crsIndex;z(()=>import("./I3STreeDebugger-tPVEJfH8.js"),__vite__mapDeps([0,1,2,3])).then(({I3STreeDebugger:o})=>{!this._treeDebugger&&C.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new o({lv:this,view:this.view,nodeSR:s}))})}else r||!this._treeDebugger||C.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)},N)),this._set("processor",new fe({owner:this,preferredUpdatePolicy:T.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:r=>this._updateClippingExtent(r)})),(i=this.processor.elevationAlignment)==null||i.events.on("invalidate-elevation",r=>this._controller.updateElevationChanged(r.extent,r.spatialReference)),this.supportsHeightUnitConversion&&(this._verticalScale=B("point",this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.initializePromise),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new me({layerView:this,scaleVisibilityEnabled:!1}),k(this.layer.geometryDefinitions)&&(this._worker=new P(r=>this.view.resourceController.immediate.schedule(r))),this.addHandles(this.layer.on("apply-edits",r=>this._updatingHandles.addPromise(r.result))),this.addHandles(this.layer.on("edits",r=>{const s=this._pendingEditsQueue.then(()=>this._handleEdits(r)).then();this._pendingEditsQueue=s,this._updatingHandles.addPromise(s)})),this.when(()=>{this._setupQueryEngine(),this._updatingHandles.add(()=>this.maximumNumberOfFeatures,r=>this._controller.featureTarget=r,N),this._updatingHandles.add(()=>this.suspended,r=>{r&&this._removeAllNodeData()})})}destroy(){this._treeDebugger=y(this._treeDebugger),this._i3sOverrides=y(this._i3sOverrides),this._set("processor",y(this.processor)),this._controller=y(this._controller),this._queryEngine=y(this._queryEngine),this._worker=y(this._worker),this._memCache=y(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=y(this._fieldsHelper)}get i3slayer(){return this.layer}get updatingProgressValue(){var e;return((e=this._controller)==null?void 0:e.updatingProgress)??1}get requiredFields(){var e;return((e=this._fieldsHelper)==null?void 0:e.requiredFields)??[]}get maximumNumberOfFeatures(){var t,i;const e=(i=(t=this.processor)==null?void 0:t.graphicsCore)==null?void 0:i.displayFeatureLimit;return(e==null?void 0:e.maximumNumberOfFeatures)??0}set maximumNumberOfFeatures(e){e!=null?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){var e;return!this.suspended&&!!((e=this._controller)!=null&&e.useMaximumNumberOfFeatures)&&!this._controller.leavesReached}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort((t,i)=>t-i):null}get lodFactor(){return this.layer.semantic==="Labels"?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){var e;return!this.suspended&&!!((e=this._controller)!=null&&e.rootNodeVisible)}get legendEnabled(){var e;return this.contentVisible&&((e=this.i3slayer)==null?void 0:e.legendEnabled)===!0}async whenGraphicAttributes(e,t){return W(this.layer,e,this._getObjectIdField(),t,()=>[...this.loadedGraphics.nodes()])}getHit(e){var r;if(!this.loadedGraphics)return null;const t=Z(this.loadedGraphics.find(s=>s.uid===e),this.layer),i=this._getObjectIdField();return(r=t==null?void 0:t.attributes)!=null&&r[i]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){var e,t,i;return!!((e=this._controller)!=null&&e.updating||(t=this.processor)!=null&&t.updating||(i=this._fieldsHelper)!=null&&i.updating||this.layerFilterUpdating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return ve(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const i={geometryBuffer:e.geometryBuffer};this._worker==null&&(this._worker=new P(s=>this.view.resourceController.immediate.schedule(s)));const r=await this._worker.invoke(i,t);if(r==null)throw new Error("Failed to decompress Draco point data");return{positionData:r.positions,featureIds:r.featureIds}}async addNode(e,t,i){var f;if(!O(t)&&!Fe(t))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void w.getLogger(this).error("I3S node "+e.id+" already added");const r=this.layer.fullExtent!=null?Se(this.layer.fullExtent.clone(),.5):null,s=[],{featureIds:o,pointPositions:a}=O(t)?await this._extractBinaryPointPositions(e,t,i):this._extractLegacyPointPositions(t);this._validatePositions(e,o,a,r,s);const n=this._controller.crsVertex,d=this.view.spatialReference;D(a,n,0,a,d,0,o.length);const h=O(t)?e.level:0,u=this._createGraphics(o,a,e.index,h),l=new De(u,o,t.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(l.featureIds,t.attributeDataInfo,i),e.numFeatures=l.graphics.length,this._updateNodeMemory(e),$(l),s.length>0&&(this._computeObb(e,s,n),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(l);if(this._verticalScale!=null)for(const b of l.graphics)this._verticalScale(b.geometry);const m=this.view._stage.renderView.objectAndLayerIdRenderHelper;if(m!=null){const b=K(this.view.map,this.layer.uid);for(let x=0;x3)continue;const m=((o=u.params.vertexAttributes)==null?void 0:o.position)??[0,0,0],f=3*r.length;i[f]=d[0]+m[0],i[f+1]=d[1]+m[1],i[f+2]=h===3?d[2]+m[2]:NaN,r.push(l)}return{featureIds:r,pointPositions:i}}_validatePositions(e,t,i,r,s){if(r==null&&e.serviceObb)return;const o=t.length,a=3;for(let n=0;noe(r)+i,ae(e.featureIds)+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode((e,t)=>{if(e){const i=e.node;this._updateNodeMemory(i),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)}),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return t==null?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){var t;return(t=this._memCache)==null?void 0:t.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,i,r){this.loadedGraphics.hasNode(e.index)?w.getLogger(this).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.applyAttributeOverrides(t.featureIds,i,r),this.loadedGraphics.addNode(e.index,t),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),t.attributeInfo=i,this._attributeValuesChanged(t),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node.id)),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode(t=>e.push(t.node)),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode((t,i)=>e.push(i))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if((t==null?void 0:t.attributeInfo)!=null)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if((t==null?void 0:t.attributeInfo)!=null)return t.attributeInfo.attributeData}_setAttributeData(e,t){const i=this.loadedGraphics.getNode(e);(i==null?void 0:i.attributeInfo)!=null&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const r=this.loadedGraphics.getNode(e);r!=null&&(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,t,i),r.attributeInfo=t,this._attributeValuesChanged(r))}_attributeValuesChanged(e){if($(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map(i=>i.uid);this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||ne}_getGlobalIdField(){var e;return(e=this.layer.associatedLayer)==null?void 0:e.globalIdField}async _rendererChange(e,t){const{layer:{fieldsIndex:i}}=this,r=new Set;let s,o;e?(await e.collectRequiredFields(r,i),s=Array.from(r).sort()):s=[],r.clear(),t?(await t.collectRequiredFields(r,i),o=Array.from(r).sort()):o=[],s.length===o.length&&s.every((a,n)=>s[n]===o[n])||this._reloadAllNodes()}_rangeInfosChanged(e){e!=null&&e.length>0&&w.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this.loadedGraphics.forEachNode(e=>this._filterNode(e))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,i=this._excludeObjectIdsSorted,r=this._getObjectIdField();for(const s of e.graphics){const o=s.visible,a=!t||this._evaluateClause(t,s),n=i==null||de(i,s.attributes[r])<0;s.visible=a&&n,o!==s.visible&&(_.graphic=s,_.property="visible",_.oldValue=o,_.newValue=s.visible,this.processor.graphicsCore.graphicUpdateHandler(_))}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter!=null?this.filter.createQuery(e):new S(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t==null?void 0:t.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t==null?void 0:t.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t==null?void 0:t.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t==null?void 0:t.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():S.from(e))}_setupQueryEngine(){const e=()=>this.processor.featureStore;this._queryEngine=new ye({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return e()},hasZ:this.hasZ,hasM:this.hasM},priority:le.FEATURE_QUERY_ENGINE})}get usedMemory(){var e,t;return((t=(e=this.processor)==null?void 0:e.graphicsCore)==null?void 0:t.usedMemory)??0}get unloadedMemory(){var e,t,i;return .8*((((e=this._controller)==null?void 0:e.unloadedMemoryEstimate)??0)+(((i=(t=this.processor)==null?void 0:t.graphicsCore)==null?void 0:i.unprocessedMemoryEstimate)??0))}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){const t=this._attributeEditingContext,i=await xe(t,e);Ee(t,i)}get _attributeEditingContext(){const e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:i=>this.loadedGraphics.forEachNode(r=>i(r.node,r.featureIds)),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:i=>this.getAttributeData(i),setAttributeData:(i,r,s)=>{this._setAttributeData(i,r);const o=this.loadedGraphics.getNode(i);if(s!=null){const a=this.loadedGraphics.get(s.attributes[e]);a!=null&&this.processor.graphicsCore.recreateGraphics([a])}else o!=null&&this.processor.graphicsCore.recreateGraphics(o.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this.loadedGraphics.nodeCount,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this.loadedGraphics.nodeCount,loadedGraphics:this.loadedGraphics}}};p([g()],c.prototype,"processor",void 0),p([g({type:he})],c.prototype,"filter",void 0),p([g()],c.prototype,"loadedGraphics",void 0),p([g()],c.prototype,"i3slayer",null),p([g()],c.prototype,"_controller",void 0),p([g()],c.prototype,"updating",void 0),p([g()],c.prototype,"suspended",void 0),p([g()],c.prototype,"holeFilling",void 0),p([g(ue)],c.prototype,"updatingProgress",void 0),p([g()],c.prototype,"updatingProgressValue",null),p([g(M.requiredFields)],c.prototype,"requiredFields",null),p([g(M.availableFields)],c.prototype,"availableFields",void 0),p([g()],c.prototype,"_fieldsHelper",void 0),p([g({type:Number})],c.prototype,"maximumNumberOfFeatures",null),p([g({readOnly:!0})],c.prototype,"maximumNumberOfFeaturesExceeded",null),p([g()],c.prototype,"_excludeObjectIdsSorted",null),p([g({readOnly:!0})],c.prototype,"lodFactor",null),p([g({readOnly:!0})],c.prototype,"hasM",null),p([g({readOnly:!0})],c.prototype,"hasZ",null),p([g()],c.prototype,"contentVisible",null),p([g({readOnly:!0})],c.prototype,"legendEnabled",null),c=p([ce("esri.views.3d.layers.SceneLayerGraphicsView3D")],c);const yt=c;function Fe(e){return"pointData"in e}function O(e){return"geometryBuffer"in e&&e.geometryBuffer!==null}function Ge(e,t,i){const r=t.attributeInfo;if((r==null?void 0:r.loadedAttributes)==null||r.attributeData==null)return!1;let s=!1;for(const{name:o}of r.loadedAttributes)if(r.attributeData[o]){const a=L(r.attributeData[o],i);a!==e.attributes[o]&&(e.attributes[o]=a,s=!0)}return s}function $(e){const t=e.attributeInfo,i=e.node.index;if((t==null?void 0:t.loadedAttributes)!=null&&t.attributeData!=null)for(let r=0;r __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/SceneLayerGraphicsView3D-KM9RpQwS.js b/dist/assets/SceneLayerGraphicsView3D-KM9RpQwS.js new file mode 100644 index 0000000..300e741 --- /dev/null +++ b/dist/assets/SceneLayerGraphicsView3D-KM9RpQwS.js @@ -0,0 +1,7 @@ +import{lA as j,z as R,lB as H,fL as q,b as y,lC as Q,P as N,B as U,de as z,jV as C,C as T,j2 as k,lD as B,lE as W,aJ as K,R as w,gk as D,lF as Z,fM as J,lG as Y,bx as X,hV as F,lH as ee,bz as te,lI as re,lJ as ie,K as G,bU as se,lK as oe,lL as ae,lM as ne,lN as de,aL as A,bn as le,e as p,y as g,dx as he,fd as ue,c as ce,lO as $,a8 as pe,lP as ge}from"./index-pCX-0tJH.js";import{S,e as _e}from"./I3SOverrides-XXafrk1K.js";import{n as me}from"./LayerView3D-57OghbRh.js";import{P as fe,l as ye}from"./HeatmapDensity.glsl-de3m0xZZ.js";import{c as be,i as ve,u as xe,f as Ee,a as Ie,j as we}from"./SceneLayerView-Z2vMKB9z.js";import{t as Ne}from"./DefinitionExpressionSceneLayerView-Z1V4X6Kq.js";import{i as Ce}from"./PopupSceneLayerView-1BvuVn-Q.js";import"./I3SNode-A9aOJfXV.js";import"./ReactiveSet-_4-UpKXZ.js";import"./meshFeatureSet-42GYfSGc.js";import"./External-Pb5poJ0S.js";import"./FeatureLayerView3D-vzwVkoh-.js";import"./FeatureLayerViewBase3D-W0Qwl4g_.js";import"./EventedSet-TJfupI82.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./LayerView-ixwLVnzr.js";import"./RefreshableLayerView-DVYs7L04.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./queryForSymbologySnapping-MXWRIdj-.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./QueryEngine-uvDs-vBe.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./FeatureStore-PXMUgn0j.js";import"./BoundsStore-_-dPK5c-.js";import"./projectExtentUtils-Q4rXasWA.js";class P extends j{constructor(t){super("SceneLayerWorker","dracoDecompressPointCloudData",{dracoDecompressPointCloudData:i=>[i.geometryBuffer]},t,{hasInitialize:!0})}}class Oe extends R{constructor(t,i){super(),this._updateAndCompare=t,this._notifyUpdated=i,this._nodes=new Map,this._graphics=new Map,this._duplicates=new Map}clear(){if(this._graphics.size>0){const t=this.toArray();this._graphics.clear(),this.emit("change",{added:[],removed:t})}this._nodes.clear()}get length(){return this._graphics.size}get(t){return this._graphics.get(t)}getNode(t){return this._nodes.get(t)}hasNode(t){return this._nodes.has(t)}nodes(){return this._nodes.values()}addNode(t,i){this._nodes.set(t,i);const r=i.graphics;if(r.length===0)return;const s=new Set;for(let a=0;a0?r.filter(a=>!s.has(a.objectId)):r;o.length>0&&this.emit("change",{added:o,removed:[]})}removeNode(t){const i=this._nodes.get(t);if(!i)return void console.error("Removing unknown node");this._nodes.delete(t);const r=new Set,s=[];for(const o of i.graphics){const a=o.objectId,n=this._graphics.get(a);if(!n)continue;const d=this._duplicates.get(a);if(d){const h=d.indexOf(t);if(h===-1){console.error("error: removing graphic from node that should not reference it.");continue}if(d.splice(h,1),n.nodeIndex===t){let u=this.getNode(d[0]);for(let l=1;lu.node.level)&&(u=_)}u!=null&&r.add(u)}d.length===1&&this._duplicates.delete(a)}else this._graphics.delete(a),s.push(o)}s.length>0&&this.emit("change",{added:[],removed:s}),r.forEach(o=>this._updateForeignGraphics(o))}_updateForeignGraphics(t){const i=[],r=t.node.index,s=t.node.level;let o=0;for(;os)o+=n;else{for(let h=o;h!!t(r)&&(i=r,!0)),i}forEach(t){this._graphics.forEach(i=>t(i))}forEachNode(t){this._nodes.forEach((i,r)=>t(i,r))}get nodeCount(){return this._nodes.size}_checkInvariants(){const t=new Map;this._nodes.forEach((r,s)=>{s!==r.node.index&&console.error("Mismatched node index"),r.graphics.forEach(o=>{t.set(o.objectId,1+(t.get(o.objectId)??0));const a=this._duplicates.get(o.objectId);a&&!a.includes(s)&&console.error("Node not listed in duplicate list"),a||o.nodeIndex===s||console.error("Unique graphic does not reference owning node index")})}),this._graphics.size!==t.size&&console.error("Mismatch between actual and expected number of graphics");let i=0;t.forEach((r,s)=>{i+=r>1?1:0;const o=this._graphics.get(s);if(!o)return void console.error("Missing graphic entry");const a=this._nodes.get(o.nodeIndex);if(!a)return void console.error("Graphic references unkown node");const n=this._duplicates.get(s);n?(n.length!==r&&console.error("Wrong number of entries in duplicate list"),n.forEach(d=>{const h=this._nodes.get(d);h?h.node.level>a.node.level&&console.error("Duplicated graphic does not reference highest level node"):console.error("Unknown node in duplicate list")})):r>1&&console.error("Missing duplicates entry")}),this._duplicates.size!==i&&console.error("Mismatch between expected and actual number of duplicate entries")}}const M=Ie();class De{constructor(t,i,r,s){this.graphics=t,this.featureIds=i,this.attributeInfo=r,this.node=s}}let c=class extends Ne(Ce(me(we))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this._pendingEditsQueue=Promise.resolve(),this.loadedGraphics=new Oe((e,t,i)=>Ge(e,t,i),e=>this.processor.graphicsCore.recreateGraphics(e)),this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url===this.layer.url&&this._i3sOverrides.isEmpty?e.load(t).then(()=>{var r;q(this.layer,e,this._i3sOverrides),this.layer=e,this._i3sOverrides.destroy();const i=(r=this.view.resourceController)==null?void 0:r.memoryController;this._i3sOverrides=new S({view:this.view,layer:e,memoryController:i}),y(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()}):null}initialize(){var t,i;this.addResolvingPromise(this.layer.indexInfo);const e=(t=this.view.resourceController)==null?void 0:t.memoryController;this._i3sOverrides=new S({view:this.view,layer:this.layer,memoryController:e}),Q(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new be({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,r=>this._rangeInfosChanged(r),N),this._updatingHandles.add(()=>this.layer.renderer,(r,s)=>this._rendererChange(r,s)),this._updatingHandles.add(()=>[this.parsedDefinitionExpression,this._excludeObjectIdsSorted],()=>this._filterChange()),this.addHandles(U(()=>C.I3S_TREE_SHOW_TILES,r=>{if(r&&!this._treeDebugger){const s=this._controller.crsIndex;z(()=>import("./I3STreeDebugger-kGP6iO8T.js"),__vite__mapDeps([0,1,2,3])).then(({I3STreeDebugger:o})=>{!this._treeDebugger&&C.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new o({lv:this,view:this.view,nodeSR:s}))})}else r||!this._treeDebugger||C.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)},N)),this._set("processor",new fe({owner:this,preferredUpdatePolicy:T.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:r=>this._updateClippingExtent(r)})),(i=this.processor.elevationAlignment)==null||i.events.on("invalidate-elevation",r=>this._controller.updateElevationChanged(r.extent,r.spatialReference)),this.supportsHeightUnitConversion&&(this._verticalScale=k("point",this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.initializePromise),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new _e({layerView:this,scaleVisibilityEnabled:!1}),B(this.layer.geometryDefinitions)&&(this._worker=new P(r=>this.view.resourceController.immediate.schedule(r))),this.addHandles(this.layer.on("apply-edits",r=>this._updatingHandles.addPromise(r.result))),this.addHandles(this.layer.on("edits",r=>{const s=this._pendingEditsQueue.then(()=>this._handleEdits(r)).then();this._pendingEditsQueue=s,this._updatingHandles.addPromise(s)})),this.when(()=>{this._setupQueryEngine(),this._updatingHandles.add(()=>this.maximumNumberOfFeatures,r=>this._controller.featureTarget=r,N),this._updatingHandles.add(()=>this.suspended,r=>{r&&this._removeAllNodeData()})})}destroy(){this._treeDebugger=y(this._treeDebugger),this._i3sOverrides=y(this._i3sOverrides),this._set("processor",y(this.processor)),this._controller=y(this._controller),this._queryEngine=y(this._queryEngine),this._worker=y(this._worker),this._memCache=y(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=y(this._fieldsHelper)}get i3slayer(){return this.layer}get updatingProgressValue(){var e;return((e=this._controller)==null?void 0:e.updatingProgress)??1}get requiredFields(){var e;return((e=this._fieldsHelper)==null?void 0:e.requiredFields)??[]}get maximumNumberOfFeatures(){var t,i;const e=(i=(t=this.processor)==null?void 0:t.graphicsCore)==null?void 0:i.displayFeatureLimit;return(e==null?void 0:e.maximumNumberOfFeatures)??0}set maximumNumberOfFeatures(e){e!=null?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){var e;return!this.suspended&&!!((e=this._controller)!=null&&e.useMaximumNumberOfFeatures)&&!this._controller.leavesReached}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort((t,i)=>t-i):null}get lodFactor(){return this.layer.semantic==="Labels"?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){var e;return!this.suspended&&!!((e=this._controller)!=null&&e.rootNodeVisible)}get legendEnabled(){var e;return this.contentVisible&&((e=this.i3slayer)==null?void 0:e.legendEnabled)===!0}async whenGraphicAttributes(e,t){return W(this.layer,e,this._getObjectIdField(),t,()=>[...this.loadedGraphics.nodes()])}getHit(e){var r;if(!this.loadedGraphics)return null;const t=K(this.loadedGraphics.find(s=>s.uid===e),this.layer),i=this._getObjectIdField();return(r=t==null?void 0:t.attributes)!=null&&r[i]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){var e,t,i;return!!((e=this._controller)!=null&&e.updating||(t=this.processor)!=null&&t.updating||(i=this._fieldsHelper)!=null&&i.updating||this.layerFilterUpdating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return ve(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const i={geometryBuffer:e.geometryBuffer};this._worker==null&&(this._worker=new P(s=>this.view.resourceController.immediate.schedule(s)));const r=await this._worker.invoke(i,t);if(r==null)throw new Error("Failed to decompress Draco point data");return{positionData:r.positions,featureIds:r.featureIds}}async addNode(e,t,i){var f;if(!O(t)&&!Fe(t))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void w.getLogger(this).error("I3S node "+e.id+" already added");const r=this.layer.fullExtent!=null?Ae(this.layer.fullExtent.clone(),.5):null,s=[],{featureIds:o,pointPositions:a}=O(t)?await this._extractBinaryPointPositions(e,t,i):this._extractLegacyPointPositions(t);this._validatePositions(e,o,a,r,s);const n=this._controller.crsVertex,d=this.view.spatialReference;D(a,n,0,a,d,0,o.length);const h=O(t)?e.level:0,u=this._createGraphics(o,a,e.index,h),l=new De(u,o,t.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(l.featureIds,t.attributeDataInfo,i),e.numFeatures=l.graphics.length,this._updateNodeMemory(e),L(l),s.length>0&&(this._computeObb(e,s,n),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(l);if(this._verticalScale!=null)for(const b of l.graphics)this._verticalScale(b.geometry);const _=this.view._stage.renderView.objectAndLayerIdRenderHelper;if(_!=null){const b=Z(this.view.map,this.layer.uid);for(let x=0;x3)continue;const _=((o=u.params.vertexAttributes)==null?void 0:o.position)??[0,0,0],f=3*r.length;i[f]=d[0]+_[0],i[f+1]=d[1]+_[1],i[f+2]=h===3?d[2]+_[2]:NaN,r.push(l)}return{featureIds:r,pointPositions:i}}_validatePositions(e,t,i,r,s){if(r==null&&e.serviceObb)return;const o=t.length,a=3;for(let n=0;noe(r)+i,ae(e.featureIds)+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode((e,t)=>{if(e){const i=e.node;this._updateNodeMemory(i),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)}),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return t==null?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){var t;return(t=this._memCache)==null?void 0:t.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,i,r){this.loadedGraphics.hasNode(e.index)?w.getLogger(this).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.applyAttributeOverrides(t.featureIds,i,r),this.loadedGraphics.addNode(e.index,t),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),t.attributeInfo=i,this._attributeValuesChanged(t),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node.id)),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode(t=>e.push(t.node)),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode((t,i)=>e.push(i))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if((t==null?void 0:t.attributeInfo)!=null)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if((t==null?void 0:t.attributeInfo)!=null)return t.attributeInfo.attributeData}_setAttributeData(e,t){const i=this.loadedGraphics.getNode(e);(i==null?void 0:i.attributeInfo)!=null&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const r=this.loadedGraphics.getNode(e);r!=null&&(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,t,i),r.attributeInfo=t,this._attributeValuesChanged(r))}_attributeValuesChanged(e){if(L(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map(i=>i.uid);this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||ne}_getGlobalIdField(){var e;return(e=this.layer.associatedLayer)==null?void 0:e.globalIdField}async _rendererChange(e,t){const{layer:{fieldsIndex:i}}=this,r=new Set;let s,o;e?(await e.collectRequiredFields(r,i),s=Array.from(r).sort()):s=[],r.clear(),t?(await t.collectRequiredFields(r,i),o=Array.from(r).sort()):o=[],s.length===o.length&&s.every((a,n)=>s[n]===o[n])||this._reloadAllNodes()}_rangeInfosChanged(e){e!=null&&e.length>0&&w.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this.loadedGraphics.forEachNode(e=>this._filterNode(e))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,i=this._excludeObjectIdsSorted,r=this._getObjectIdField();for(const s of e.graphics){const o=s.visible,a=!t||this._evaluateClause(t,s),n=i==null||de(i,s.attributes[r])<0;s.visible=a&&n,o!==s.visible&&(m.graphic=s,m.property="visible",m.oldValue=o,m.newValue=s.visible,this.processor.graphicsCore.graphicUpdateHandler(m))}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter!=null?this.filter.createQuery(e):new A(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t==null?void 0:t.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t==null?void 0:t.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t==null?void 0:t.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t==null?void 0:t.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():A.from(e))}_setupQueryEngine(){const e=()=>this.processor.featureStore;this._queryEngine=new ye({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return e()},hasZ:this.hasZ,hasM:this.hasM},priority:le.FEATURE_QUERY_ENGINE})}get usedMemory(){var e,t;return((t=(e=this.processor)==null?void 0:e.graphicsCore)==null?void 0:t.usedMemory)??0}get unloadedMemory(){var e,t,i;return .8*((((e=this._controller)==null?void 0:e.unloadedMemoryEstimate)??0)+(((i=(t=this.processor)==null?void 0:t.graphicsCore)==null?void 0:i.unprocessedMemoryEstimate)??0))}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){const t=this._attributeEditingContext,i=await xe(t,e);Ee(t,i)}get _attributeEditingContext(){const e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:i=>this.loadedGraphics.forEachNode(r=>i(r.node,r.featureIds)),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:i=>this.getAttributeData(i),setAttributeData:(i,r,s)=>{this._setAttributeData(i,r);const o=this.loadedGraphics.getNode(i);if(s!=null){const a=this.loadedGraphics.get(s.attributes[e]);a!=null&&this.processor.graphicsCore.recreateGraphics([a])}else o!=null&&this.processor.graphicsCore.recreateGraphics(o.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this.loadedGraphics.nodeCount,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this.loadedGraphics.nodeCount,loadedGraphics:this.loadedGraphics}}};p([g()],c.prototype,"processor",void 0),p([g({type:he})],c.prototype,"filter",void 0),p([g()],c.prototype,"loadedGraphics",void 0),p([g()],c.prototype,"i3slayer",null),p([g()],c.prototype,"_controller",void 0),p([g()],c.prototype,"updating",void 0),p([g()],c.prototype,"suspended",void 0),p([g()],c.prototype,"holeFilling",void 0),p([g(ue)],c.prototype,"updatingProgress",void 0),p([g()],c.prototype,"updatingProgressValue",null),p([g(M.requiredFields)],c.prototype,"requiredFields",null),p([g(M.availableFields)],c.prototype,"availableFields",void 0),p([g()],c.prototype,"_fieldsHelper",void 0),p([g({type:Number})],c.prototype,"maximumNumberOfFeatures",null),p([g({readOnly:!0})],c.prototype,"maximumNumberOfFeaturesExceeded",null),p([g()],c.prototype,"_excludeObjectIdsSorted",null),p([g({readOnly:!0})],c.prototype,"lodFactor",null),p([g({readOnly:!0})],c.prototype,"hasM",null),p([g({readOnly:!0})],c.prototype,"hasZ",null),p([g()],c.prototype,"contentVisible",null),p([g({readOnly:!0})],c.prototype,"legendEnabled",null),c=p([ce("esri.views.3d.layers.SceneLayerGraphicsView3D")],c);const pt=c;function Fe(e){return"pointData"in e}function O(e){return"geometryBuffer"in e&&e.geometryBuffer!==null}function Ge(e,t,i){const r=t.attributeInfo;if((r==null?void 0:r.loadedAttributes)==null||r.attributeData==null)return!1;let s=!1;for(const{name:o}of r.loadedAttributes)if(r.attributeData[o]){const a=$(r.attributeData[o],i);a!==e.attributes[o]&&(e.attributes[o]=a,s=!0)}return s}function L(e){const t=e.attributeInfo,i=e.node.index;if((t==null?void 0:t.loadedAttributes)!=null&&t.attributeData!=null)for(let r=0;r __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/SceneLayerSnappingSource-u6yw_bMd.js b/dist/assets/SceneLayerSnappingSource-u6yw_bMd.js deleted file mode 100644 index a21e8d0..0000000 --- a/dist/assets/SceneLayerSnappingSource-u6yw_bMd.js +++ /dev/null @@ -1 +0,0 @@ -import{e as s,y as n,c as g,p as w,fm as k,gy as m,m8 as C,ls as b,aa as S,k as H,ak as L,a as $,m9 as E,fw as _,g as O,s as I,e3 as V}from"./index-J0iiHjMT.js";import{r as R}from"./VertexSnappingCandidate-sgrBHAMS.js";import"./PointSnappingHint-ULetRXiW.js";let d=class extends w{constructor(e){super(e),this.availability=0,this._ids=new Set}destroy(){this._workerHandle.destroy(),this._workerHandle=null}initialize(){this._workerHandle=new x(this.schedule,{fetchAllEdgeLocations:(e,t)=>this._fetchAllEdgeLocations(e,t)})}async fetchCandidates(e,t){const i=e.coordinateHelper,{point:c}=e,a=P;this.renderCoordsHelper.toRenderCoords(c,i.spatialReference,a);const u=e.distance,l=typeof u=="number"?u:u.distance,p=await this._workerHandle.invoke({bounds:k(a[0],a[1],a[2],l),returnEdge:e.returnEdge,returnVertex:e.vertexMode!=="none"},t);return p.candidates.sort((y,f)=>y.distance-f.distance),p.candidates.map(y=>this._convertCandidate(i,y))}async add(e,t){this._ids.add(e.id),await this._workerHandle.invokeMethod("add",e,t)}async remove(e,t){this._ids.delete(e.id),await this._workerHandle.invokeMethod("remove",e,t)}_convertCandidate(e,t){switch(t.type){case"edge":return new m({objectId:t.objectId,targetPoint:this._convertRenderCoordinate(e,t.target),edgeStart:this._convertRenderCoordinate(e,t.start),edgeEnd:this._convertRenderCoordinate(e,t.end),isDraped:!1});case"vertex":return new R({objectId:t.objectId,targetPoint:this._convertRenderCoordinate(e,t.target),isDraped:!1})}}_convertRenderCoordinate({spatialReference:e},t){const i=S();return this.renderCoordsHelper.fromRenderCoords(t,i,e),C(i)}async _fetchAllEdgeLocations(e,t){const i=[],c=[];for(const{id:a,uid:u}of e.components)this._ids.has(a)&&i.push((async()=>{const l=await this.fetchEdgeLocations(a,t.signal),p=l.locations.buffer;return c.push(p),{id:a,uid:u,objectIds:l.objectIds,locations:p,origin:l.origin,type:l.type}})());return{result:{components:(await Promise.all(i)).filter(({id:a})=>this._ids.has(a))},transferList:c}}};s([n({constructOnly:!0})],d.prototype,"renderCoordsHelper",void 0),s([n({constructOnly:!0})],d.prototype,"fetchEdgeLocations",void 0),s([n({constructOnly:!0})],d.prototype,"schedule",void 0),s([n({readOnly:!0})],d.prototype,"availability",void 0),d=s([g("esri.views.interactive.snapping.featureSources.sceneLayerSource.SceneLayerSnappingSourceWorker")],d);class x extends b{constructor(e,t){super("SceneLayerSnappingSourceWorker","fetchCandidates",{},e,{strategy:"dedicated",client:t})}}const P=S();let o=class extends w{get updating(){return this._updatingHandles.updating}constructor(r){super(r),this.availability=1,this._updatingHandles=new H,this._abortController=new AbortController}destroy(){this._tracker=L(this._tracker),this._abortController=$(this._abortController),this._updatingHandles.destroy()}initialize(){const{view:r}=this,e=r.resourceController;this._edgeWorker=new E(v(e)),this._workerHandle=new d({renderCoordsHelper:this.view.renderCoordsHelper,schedule:v(e),fetchEdgeLocations:async(t,i)=>{if(this._tracker==null)throw new Error("tracker-not-initialized");return this._tracker.fetchEdgeLocations(t,this._edgeWorker,i)}}),this._updatingHandles.addPromise(this._setupLayerView()),this.addHandles([_(this._workerHandle),_(this._edgeWorker)])}async fetchCandidates(r,e){return this._workerHandle.fetchCandidates(r,e)}refresh(){}async _setupLayerView(){var t;if(this.destroyed)return;const r=(t=this._abortController)==null?void 0:t.signal,e=await this.getLayerView();e==null||O(r)||(this._tracker=e.trackSnappingSources({add:(i,c)=>{this._updatingHandles.addPromise(this._workerHandle.add({id:i,bounds:c},r))},remove:i=>{this._updatingHandles.addPromise(this._workerHandle.remove({id:i},r))}}))}};function v(r){return e=>r.immediate.schedule(e)}s([n({constructOnly:!0})],o.prototype,"getLayerView",void 0),s([n({constructOnly:!0})],o.prototype,"view",void 0),s([n({readOnly:!0})],o.prototype,"updating",null),s([n({readOnly:!0})],o.prototype,"availability",void 0),o=s([g("esri.views.interactive.snapping.featureSources.I3SSnappingSource")],o);let h=class extends w{get updating(){return this._i3sSources.some(r=>r.updating)}constructor(r){super(r),this.availability=1,this._i3sSources=[]}destroy(){this._i3sSources.forEach(r=>r.destroy()),this._i3sSources.length=0}initialize(){const{view:r}=this,e=this.layerSource.layer;this._i3sSources=e.type==="building-scene"?this._getBuildingSceneI3SSources(r,e):[this._getSceneLayerI3SSource(r,e)]}async fetchCandidates(r,e){const t=await Promise.all(this._i3sSources.map(i=>i.fetchCandidates(r,e)));return I(e),t.flat()}refresh(){this._i3sSources.forEach(r=>r.refresh())}_getBuildingSceneI3SSources(r,e){return e.allSublayers.toArray().map(t=>t.type==="building-component"?new o({getLayerView:async()=>(await r.whenLayerView(e)).whenSublayerView(t),view:r}):null).filter(V)}_getSceneLayerI3SSource(r,e){return new o({getLayerView:async()=>{const t=await r.whenLayerView(e);return t.type==="scene-layer-graphics-3d"?void 0:t},view:r})}};s([n({constructOnly:!0})],h.prototype,"layerSource",void 0),s([n({constructOnly:!0})],h.prototype,"view",void 0),s([n({readOnly:!0})],h.prototype,"updating",null),s([n({readOnly:!0})],h.prototype,"availability",void 0),h=s([g("esri.views.interactive.snapping.featureSources.SceneLayerSnappingSource")],h);export{h as SceneLayerSnappingSource}; diff --git a/dist/assets/SceneLayerSnappingSource-wfFr0F0T.js b/dist/assets/SceneLayerSnappingSource-wfFr0F0T.js new file mode 100644 index 0000000..4bf4158 --- /dev/null +++ b/dist/assets/SceneLayerSnappingSource-wfFr0F0T.js @@ -0,0 +1 @@ +import{e as s,y as n,c as g,g as _,fh as b,gv as k,mg as m,lA as C,a8 as S,h as H,bq as L,I as $,mh as E,fr as w,ad as I,ab as O,dY as V}from"./index-pCX-0tJH.js";import{r as R}from"./VertexSnappingCandidate-YEvkEqQJ.js";import"./PointSnappingHint-bwlQAyn6.js";let d=class extends _{constructor(e){super(e),this.availability=0,this._ids=new Set}destroy(){this._workerHandle.destroy(),this._workerHandle=null}initialize(){this._workerHandle=new x(this.schedule,{fetchAllEdgeLocations:(e,t)=>this._fetchAllEdgeLocations(e,t)})}async fetchCandidates(e,t){const i=e.coordinateHelper,{point:c}=e,a=P;this.renderCoordsHelper.toRenderCoords(c,i.spatialReference,a);const u=e.distance,l=typeof u=="number"?u:u.distance,p=await this._workerHandle.invoke({bounds:b(a[0],a[1],a[2],l),returnEdge:e.returnEdge,returnVertex:e.vertexMode!=="none"},t);return p.candidates.sort((y,f)=>y.distance-f.distance),p.candidates.map(y=>this._convertCandidate(i,y))}async add(e,t){this._ids.add(e.id),await this._workerHandle.invokeMethod("add",e,t)}async remove(e,t){this._ids.delete(e.id),await this._workerHandle.invokeMethod("remove",e,t)}_convertCandidate(e,t){switch(t.type){case"edge":return new k({objectId:t.objectId,targetPoint:this._convertRenderCoordinate(e,t.target),edgeStart:this._convertRenderCoordinate(e,t.start),edgeEnd:this._convertRenderCoordinate(e,t.end),isDraped:!1});case"vertex":return new R({objectId:t.objectId,targetPoint:this._convertRenderCoordinate(e,t.target),isDraped:!1})}}_convertRenderCoordinate({spatialReference:e},t){const i=S();return this.renderCoordsHelper.fromRenderCoords(t,i,e),m(i)}async _fetchAllEdgeLocations(e,t){const i=[],c=[];for(const{id:a,uid:u}of e.components)this._ids.has(a)&&i.push((async()=>{const l=await this.fetchEdgeLocations(a,t.signal),p=l.locations.buffer;return c.push(p),{id:a,uid:u,objectIds:l.objectIds,locations:p,origin:l.origin,type:l.type}})());return{result:{components:(await Promise.all(i)).filter(({id:a})=>this._ids.has(a))},transferList:c}}};s([n({constructOnly:!0})],d.prototype,"renderCoordsHelper",void 0),s([n({constructOnly:!0})],d.prototype,"fetchEdgeLocations",void 0),s([n({constructOnly:!0})],d.prototype,"schedule",void 0),s([n({readOnly:!0})],d.prototype,"availability",void 0),d=s([g("esri.views.interactive.snapping.featureSources.sceneLayerSource.SceneLayerSnappingSourceWorker")],d);class x extends C{constructor(e,t){super("SceneLayerSnappingSourceWorker","fetchCandidates",{},e,{strategy:"dedicated",client:t})}}const P=S();let o=class extends _{get updating(){return this._updatingHandles.updating}constructor(r){super(r),this.availability=1,this._updatingHandles=new H,this._abortController=new AbortController}destroy(){this._tracker=L(this._tracker),this._abortController=$(this._abortController),this._updatingHandles.destroy()}initialize(){const{view:r}=this,e=r.resourceController;this._edgeWorker=new E(v(e)),this._workerHandle=new d({renderCoordsHelper:this.view.renderCoordsHelper,schedule:v(e),fetchEdgeLocations:async(t,i)=>{if(this._tracker==null)throw new Error("tracker-not-initialized");return this._tracker.fetchEdgeLocations(t,this._edgeWorker,i)}}),this._updatingHandles.addPromise(this._setupLayerView()),this.addHandles([w(this._workerHandle),w(this._edgeWorker)])}async fetchCandidates(r,e){return this._workerHandle.fetchCandidates(r,e)}refresh(){}async _setupLayerView(){var t;if(this.destroyed)return;const r=(t=this._abortController)==null?void 0:t.signal,e=await this.getLayerView();e==null||I(r)||(this._tracker=e.trackSnappingSources({add:(i,c)=>{this._updatingHandles.addPromise(this._workerHandle.add({id:i,bounds:c},r))},remove:i=>{this._updatingHandles.addPromise(this._workerHandle.remove({id:i},r))}}))}};function v(r){return e=>r.immediate.schedule(e)}s([n({constructOnly:!0})],o.prototype,"getLayerView",void 0),s([n({constructOnly:!0})],o.prototype,"view",void 0),s([n({readOnly:!0})],o.prototype,"updating",null),s([n({readOnly:!0})],o.prototype,"availability",void 0),o=s([g("esri.views.interactive.snapping.featureSources.I3SSnappingSource")],o);let h=class extends _{get updating(){return this._i3sSources.some(r=>r.updating)}constructor(r){super(r),this.availability=1,this._i3sSources=[]}destroy(){this._i3sSources.forEach(r=>r.destroy()),this._i3sSources.length=0}initialize(){const{view:r}=this,e=this.layerSource.layer;this._i3sSources=e.type==="building-scene"?this._getBuildingSceneI3SSources(r,e):[this._getSceneLayerI3SSource(r,e)]}async fetchCandidates(r,e){const t=await Promise.all(this._i3sSources.map(i=>i.fetchCandidates(r,e)));return O(e),t.flat()}refresh(){this._i3sSources.forEach(r=>r.refresh())}_getBuildingSceneI3SSources(r,e){return e.allSublayers.toArray().map(t=>t.type==="building-component"?new o({getLayerView:async()=>(await r.whenLayerView(e)).whenSublayerView(t),view:r}):null).filter(V)}_getSceneLayerI3SSource(r,e){return new o({getLayerView:async()=>{const t=await r.whenLayerView(e);return t.type==="scene-layer-graphics-3d"?void 0:t},view:r})}};s([n({constructOnly:!0})],h.prototype,"layerSource",void 0),s([n({constructOnly:!0})],h.prototype,"view",void 0),s([n({readOnly:!0})],h.prototype,"updating",null),s([n({readOnly:!0})],h.prototype,"availability",void 0),h=s([g("esri.views.interactive.snapping.featureSources.SceneLayerSnappingSource")],h);export{h as SceneLayerSnappingSource}; diff --git a/dist/assets/SceneLayerSnappingSourceWorker-Ty-SvQ0f.js b/dist/assets/SceneLayerSnappingSourceWorker-Ty-SvQ0f.js new file mode 100644 index 0000000..673acba --- /dev/null +++ b/dist/assets/SceneLayerSnappingSourceWorker-Ty-SvQ0f.js @@ -0,0 +1 @@ +import{cD as b,by as g,bO as m,kl as E,km as _,e as w,c as y,kn as f,a$ as v,a8 as u,ab as L,g5 as V,bc as k,ko as P,kp as C,kq as h}from"./index-pCX-0tJH.js";const S=1e3;function j(t,e,n){const s=E(),o=_(s);return b(o,o,t,.5),b(o,o,e,.5),s[3]=g(o,t),m(o,o,n),s}let l=class{constructor(){this._idToComponent=new Map,this._components=new f(t=>t.bounds),this._edges=new f(t=>t.bounds),this._tmpLineSegment=v(),this._tmpP1=u(),this._tmpP2=u(),this._tmpP3=u(),this.remoteClient=null}async fetchCandidates(t,e){await Promise.resolve(),L(e),await this._ensureEdgeLocations(t,e);const n=[];return this._edges.forEachNeighbor(s=>(this._addCandidates(t,s,n),n.length{if(i.info==null){const{id:c,uid:d}=i;n.push({id:c,uid:d})}return!0},t.bounds),!n.length)return;const s={components:n},o=await this.remoteClient.invoke("fetchAllEdgeLocations",s,e??{});for(const i of o.components)this._setFetchEdgeLocations(i)}async add(t){const e=new p(t.id,t.bounds);return this._idToComponent.set(e.id,e),this._components.add([e]),{result:{}}}async remove(t){const e=this._idToComponent.get(t.id);if(e){const n=[];this._edges.forEachNeighbor(s=>(s.component===e&&n.push(s),!0),e.bounds),this._edges.remove(n),this._components.remove([e]),this._idToComponent.delete(e.id)}return{result:{}}}_setFetchEdgeLocations(t){const e=this._idToComponent.get(t.id);if(e==null||t.uid!==e.uid)return;const n=V.createView(t.locations),s=new Array(n.count),o=u(),i=u();for(let a=0;at.bounds),this._edges=new b(t=>t.bounds),this._tmpLineSegment=y(),this._tmpP1=h(),this._tmpP2=h(),this._tmpP3=h(),this.remoteClient=null}async fetchCandidates(t,e){await Promise.resolve(),L(e),await this._ensureEdgeLocations(t,e);const n=[];return this._edges.forEachNeighbor(s=>(this._addCandidates(t,s,n),n.length{if(i.info==null){const{id:c,uid:d}=i;n.push({id:c,uid:d})}return!0},t.bounds),!n.length)return;const s={components:n},o=await this.remoteClient.invoke("fetchAllEdgeLocations",s,e??{});for(const i of o.components)this._setFetchEdgeLocations(i)}async add(t){const e=new p(t.id,t.bounds);return this._idToComponent.set(e.id,e),this._components.add([e]),{result:{}}}async remove(t){const e=this._idToComponent.get(t.id);if(e){const n=[];this._edges.forEachNeighbor(s=>(s.component===e&&n.push(s),!0),e.bounds),this._edges.remove(n),this._components.remove([e]),this._idToComponent.delete(e.id)}return{result:{}}}_setFetchEdgeLocations(t){const e=this._idToComponent.get(t.id);if(e==null||t.uid!==e.uid)return;const n=V.createView(t.locations),s=new Array(n.count),o=h(),i=h();for(let a=0;a{const p=u.get(c);if(p==null){const m=f.indexOf(t);return u.set(c,m),m}return p};let l=E.EDITING;const o={setAttribute(c,f){if(l!==E.EDITING)return;const p=e.fieldsIndex.get(c);if(!p)return;const m=e.attributeStorageInfo.findIndex(F=>F.name===p.name);if(m<0)return;if(!(c in a))throw new Error(`Attribute "${c}" is not an attribute of the edited feature.`);d.setAttribute(m,f);const w=e.attributeStorageInfo[m];let b=!1;s.add(c),e.forEachNode((F,x)=>{const v=i(F,x);if(v===-1)return;const A=e.getAttributeData(F.index);if(A){const O=A[w.name];O&&(O[v]=f,e.setAttributeData(F.index,A,n),b=!0)}}),b&&e.clearMemCache()},rollback(){if(l===E.EDITING){for(const c of s)this.setAttribute(c,a[c]);d.remove(),l=E.ROLLED_BACK,e.sessions.delete(t)}},commit(){l===E.EDITING&&(d.remove(),l=E.COMMITTED,e.sessions.delete(t))}};return e.sessions.set(t,o),o}function ce(e,n,t){const{gidToFeatureInfo:r,oidToFeatureInfo:a,fieldsIndex:s,objectIdField:d,globalIdField:u,featureOrIdentifierList:i}=t;if(!t.featuresResolved&&i!=null){for(const l of i){const o={feature:null,oid:-1,gid:null};if("attributes"in l){o.feature=l;const c=l.attributes;if(c!=null)for(const f in c){if(o.oid!==-1&&o.gid!=null)break;const p=s.normalizeFieldName(f);p===d&&(o.oid=c[f]??-1),p===u&&(o.gid=c[f])}}else o.oid=l.objectId??-1,o.gid=l.globalId;o.gid!=null&&r.set(o.gid,o),o.oid!==-1&&a.set(o.oid,o)}t.featuresResolved=!0}return(e!==-1?a.get(e):null)??(n!=null?r.get(n):null)}function $(e,n,t,r,a=null,s=!0){const d=[],u={gidToFeatureInfo:new Map,oidToFeatureInfo:new Map,featuresResolved:t==null,fieldsIndex:e.fieldsIndex,objectIdField:e.objectIdField,globalIdField:e.globalIdField,featureOrIdentifierList:t};for(const i of n){if(i.error!=null)continue;const l=i.objectId??-1,o=i.globalId,c=(l===-1||s?ce(l,o,u):null)??{feature:null,oid:l,gid:o},f={oid:l===-1?c.oid:l,gid:o??c.gid,feature:c.feature,result:i};if(d.push(f),f.oid===-1&&f.gid!=null&&a!=null&&(f.oid=a.get(f.gid)??-1),f.oid===-1&&f.gid!=null){let p=r.get(f.gid);p==null&&(p=[],r.set(f.gid,p)),p.push(f)}}return d}async function Ee(e,n){var d,u,i;const t=new Map,r=$(e,n.addedFeatures,(d=n.edits)==null?void 0:d.addFeatures,t),a=$(e,n.updatedFeatures,(u=n.edits)==null?void 0:u.updateFeatures,t),s=$(e,n.deletedFeatures,(i=n.edits)==null?void 0:i.deleteFeatures,t,n.globalIdToObjectId,!1);return t.size>0&&await fe(e,t),{adds:r.filter(l=>l.oid!==-1),updates:a.filter(l=>l.oid!==-1),deletes:s.filter(l=>l.oid!==-1)}}async function fe(e,n){const t=e.i3sOverrides.layer.associatedLayer;if((t==null?void 0:t.globalIdField)==null)return;const r=t.createQuery(),{objectIdField:a,globalIdField:s}=t;r.where=Array.from(n.keys()).map(i=>`${s}='${i}'`).join(" OR "),r.returnGeometry=!1,r.outFields=[a,s],r.cacheHint=!1;const d=await B(H(t,r));if(!d.ok)return;const u=d.value.features;for(const i of u){const l=i.attributes[s],o=i.attributes[a];if(l==null||o==null||o===-1)continue;const c=n.get(l);if(c!=null)for(const f of c)f.oid=o}}function xe(e,n){var d,u;const t=new Map,r=n.adds,a=n.updates,s=n.deletes;if(r.length>0)for(const i of r){const l=i.oid,o=i.feature;((d=o==null?void 0:o.geometry)==null?void 0:d.type)==="mesh"&&t.set(l,o.geometry)}if(a.length>0)for(const i of a){const l=i.oid,o=i.feature;((u=o==null?void 0:o.geometry)==null?void 0:u.type)==="mesh"&&t.set(l,o.geometry)}if(s.length>0)for(const i of s)t.set(i.oid,null);for(const[i,l]of t)e.i3sOverrides.updateGeometry(i,l)}function ve(e,n){var f;const t=ge(e,n),r=pe(e,n);if(t.size===0&&r.size===0)return;const a=new Map;for(let p=0;p{const w=e.getAttributeData(m);let b=!1;p.forEach((F,x)=>{const v=w!=null?w[x]:null,A=a.get(x);for(const{featureIndex:O,value:T,featureId:G}of F)v&&(v[O]=T,b=!0,s=!0),e.i3sOverrides.updateAttributeValue(G,A,T)}),b&&e.setAttributeData(m,w,null)}),s&&e.clearMemCache();const{fieldsIndex:d,i3sOverrides:u,objectIdField:i,globalIdField:l}=e,o=(f=u.layer.associatedLayer)==null?void 0:f.infoFor3D,c=new Set(o?[...Object.values(o.assetMapFieldRoles),...Object.values(o.transformFieldRoles)]:[]);for(const[p,m]of r){u.featureAdded(p);const{attributes:w}=m;for(const b in w){if(b!==i&&b!==l&&c.has(b))continue;const F=d.normalizeFieldName(b),x=F!=null?a.get(F):null;if(x==null)continue;const v=w[b];u.updateAttributeValue(p,x,v)}}}function pe(e,n){var a;const t=new Map,r=n.adds;if(!r||r.length===0||e.globalIdField==null)return t;for(const s of r){const d=s.oid,u=s.feature;((a=u==null?void 0:u.geometry)==null?void 0:a.type)==="mesh"&&t.set(d,u)}return t}function ge(e,n){const t=n.updates;if(!t||t.length===0)return new C;const r=new C,a=new Map;for(let s=0;s{for(const u of t){if(u.feature==null)continue;const i=u.feature,l=u.oid,o=d.indexOf(l);for(const c in i.attributes){const f=e.fieldsIndex.normalizeFieldName(c),p=ye(r,s.index,f),m=i.attributes[c];p.push({featureIndex:o,featureId:l,value:m})}}}),r}function ye(e,n,t){const r=he(e,n),a=t!=null&&r.get(t);if(a)return a;const s=new Array;return r.set(t,s),s}function he(e,n){const t=e.get(n);if(t)return t;const r=new me;return e.set(n,r),r}(function(e){e[e.EDITING=0]="EDITING",e[e.ROLLED_BACK=1]="ROLLED_BACK",e[e.COMMITTED=2]="COMMITTED"})(E||(E={}));const me=Map,C=Map;function Ae(){return{requiredFields:{type:[String],readOnly:!0},availableFields:{type:[String],readOnly:!0,get:function(){const{layer:e,layer:{fieldsIndex:n},requiredFields:t}=this;return e.outFields?S(n,[...Q(n,e.outFields),...t]):S(n,t)}}}}const P=e=>{let n=class extends e{constructor(){super(...arguments),this._numUpdating=0,this._asyncUpdateState=new Map}get updating(){return this._numUpdating>0}autoUpdateAsync(t,r){return be(a=>this._updateAsync(t,a),r)}async _updateAsync(t,r){if(!this._startAsyncUpdate(t)){try{const a=await r();this._set(t,a)}catch{L.getLogger(this).warn(`Async update of "${String(t)}" failed. Async update functions should not throw exceptions.`)}this._endAsyncUpdate(t)&&this._updateAsync(t,r)}}_startAsyncUpdate(t){const r=this._asyncUpdateState.get(t)??I.None;return r&I.Updating?(this._asyncUpdateState.set(t,r|I.Invalidated),!0):(++this._numUpdating,this._asyncUpdateState.set(t,r|I.Updating),!1)}_endAsyncUpdate(t){--this._numUpdating;const r=(this._asyncUpdateState.get(t)??I.None)&~I.Updating;return r&I.Invalidated?(this._asyncUpdateState.set(t,r&~I.Invalidated),!0):(this._asyncUpdateState.set(t,r),!1)}};return g([y({readOnly:!0})],n.prototype,"updating",null),g([y()],n.prototype,"_numUpdating",void 0),n=g([N("esri.core.AsyncUpdate")],n),n};var I;function be(e,n){const t=()=>{s&&!d&&e(r)},r=()=>{if(!s||d)return n();s.clear(),d=!0;const u=W(s,n);return d=!1,u},a=()=>{s&&(s.destroy(),s=null)};let s=new J(t),d=!1;return e(r),{remove:a}}(function(e){e[e.None=0]="None",e[e.Updating=1]="Updating",e[e.Invalidated=2]="Invalidated"})(I||(I={}));let k=class extends P(q){};k=g([N("esri.core.AsyncUpdate")],k);const V="esri.views.3d.layers.support.SceneLayerViewRequiredFields";let _=class extends P(q){get layer(){return this.layerView.layer}get requiredFields(){const{layerView:{layer:{fieldsIndex:e},definitionExpressionFields:n},rendererFields:t,labelingFields:r,viewFilterFields:a}=this;return S(e,[...n??[],...t??[],...r??[],...a??[]])}constructor(e){super(e)}initialize(){this.addHandles([this.autoUpdateAsync("rendererFields",async()=>{const{fieldsIndex:e,renderer:n}=this.layer;return n?U(t=>n.collectRequiredFields(t,e)):null}),this.autoUpdateAsync("labelingFields",async()=>{const{layer:e}=this;return e.labelsVisible?U(n=>Z(n,e)):null}),this.autoUpdateAsync("viewFilterFields",()=>{const{layer:e,filter:n}=this.layerView;return U(t=>X(t,e,n))})])}};async function U(e){const n=new Set;try{return await e(n),Array.from(n).sort()}catch(t){return L.getLogger(V).error(t),null}}g([y()],_.prototype,"layerView",void 0),g([y()],_.prototype,"layer",null),g([y()],_.prototype,"requiredFields",null),g([y()],_.prototype,"rendererFields",void 0),g([y()],_.prototype,"labelingFields",void 0),g([y()],_.prototype,"viewFilterFields",void 0),_=g([N(V)],_);const z="esri.views.layers.SceneLayerView",j=L.getLogger(z);let h=class extends de{constructor(){super(...arguments),this.layer=null,this.filter=null,this._geometryEngine=null,this._projectionEngineLoaded=!1,this._abortController=new AbortController}get availableFields(){return[]}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){throw new Error("Not implemented")}get maximumNumberOfFeaturesExceeded(){return!1}get layerFilter(){return se(this._layerFilter)}get _layerFilter(){var u;const e=(u=this.layer)==null?void 0:u.filter;if(e==null||e.geometries.length<1)return null;const n=this._geometryEngine;if(n==null||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine)return ae;const t=e.geometries.at(0).spatialReference,r=e.geometries.toArray().map(i=>{try{i=n.simplify(i)}catch{return j.warnOncePerTick("Failed to simplify scene filter mask polygon. Polygon will be ignored."),null}if(i==null)return null;if(i.spatialReference.equals(t))return i;try{return Y(i,t)}catch{return j.warnOncePerTick("Failed to project scene filter mask polygon. Polygon will be ignored."),null}}).filter(ee).sort((i,l)=>i.extent.xmin-l.extent.xmin),a=new Set,s=new Array,d=new Array;for(let i of r){const l=i.extent.xmin;if(s.length=0,a.forEach(o=>{if(l>=o.extent.xmax)return d.push(o),void a.delete(o);i.extent.ymin<=o.extent.ymax&&i.extent.ymax>=o.extent.ymin&&n.intersects(i,o)&&s.push(o)}),s.length>0){s.push(i);try{i=n.union(s)}catch{j.warnOncePerTick("Failed to unify filter mask polygons. Polygon will be ignored.");continue}s.pop(),s.forEach(o=>a.delete(o))}a.add(i)}return a.forEach(i=>d.push(i)),d.length>0?{spatialRelationship:e.spatialRelationship,geometries:d}:null}get _filterNeedsProjectionEngine(){const e=this.layer.filter;if(e==null||e.geometries.length<=1)return!1;const n=e.geometries.at(0).spatialReference;return e.geometries.some(({spatialReference:t})=>!t.equals(n)&&!te(t,n))}get layerFilterUpdating(){return le(this._layerFilter)}initialize(){const{signal:e}=this._abortController;M(()=>{var n,t,r;return this.destroyed||!this._geometryEngine&&((r=(t=(n=this.layer)==null?void 0:n.filter)==null?void 0:t.geometries)==null?void 0:r.length)},e).then(async()=>{D(e),this._geometryEngine=await ne(()=>import("./index-J0iiHjMT.js").then(n=>n.zJ),__vite__mapDeps([0,1]))}).catch(R),this._projectionEngineLoaded=re(),M(()=>this.destroyed||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine,e).then(async()=>{D(e),await ie(),this._projectionEngineLoaded=!0}).catch(R)}destroy(){this._abortController=oe(this._abortController)}highlight(e){throw new Error("Not implemented")}queryFeatures(e,n){throw new Error("Not implemented")}queryObjectIds(e,n){throw new Error("Not implemented")}queryFeatureCount(e,n){throw new Error("Not implemented")}createQuery(){throw new Error("Not implemented")}queryExtent(e,n){throw new Error("Not implemented")}};g([y()],h.prototype,"layer",void 0),g([y()],h.prototype,"availableFields",null),g([y()],h.prototype,"maximumNumberOfFeatures",null),g([y({readOnly:!0})],h.prototype,"maximumNumberOfFeaturesExceeded",null),g([y()],h.prototype,"filter",void 0),g([y({readOnly:!0})],h.prototype,"layerFilter",null),g([y({readOnly:!0})],h.prototype,"_layerFilter",null),g([y()],h.prototype,"_geometryEngine",void 0),g([y()],h.prototype,"_projectionEngineLoaded",void 0),g([y()],h.prototype,"_filterNeedsProjectionEngine",null),g([y()],h.prototype,"layerFilterUpdating",null),h=g([N(z)],h);const Ne=h;export{Ae as a,_ as c,xe as d,ve as f,_e as i,Ne as j,Ee as u}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/SceneLayerView-Z2vMKB9z.js b/dist/assets/SceneLayerView-Z2vMKB9z.js new file mode 100644 index 0000000..5d77df9 --- /dev/null +++ b/dist/assets/SceneLayerView-Z2vMKB9z.js @@ -0,0 +1,7 @@ +import{ah as B,o2 as K,o3 as H,nW as L,fC as Q,e as p,c as N,y,R as S,o4 as W,g as q,o5 as J,nX as X,nZ as Y,dW as Z,dY as ee,cj as te,aa as T,dL as D,de as ne,o6 as R,dU as re,dV as ie,I as oe}from"./index-pCX-0tJH.js";import{a as se,n as ae,u as le}from"./DefinitionExpressionSceneLayerView-Z1V4X6Kq.js";import{u as de}from"./LayerView-ixwLVnzr.js";const ue={setAttribute(){},rollback(){},commit(){}};var E;function _e(e,n){const t=n.attributes[e.objectIdField];if(t==null)return ue;const r=e.sessions.get(t);if(r)return r;const a=B(n.attributes),s=new Set,d=e.i3sOverrides.createInteractiveEditSession(t),u=new Map,i=(c,f)=>{const g=u.get(c);if(g==null){const m=f.indexOf(t);return u.set(c,m),m}return g};let l=E.EDITING;const o={setAttribute(c,f){if(l!==E.EDITING)return;const g=e.fieldsIndex.get(c);if(!g)return;const m=e.attributeStorageInfo.findIndex(F=>F.name===g.name);if(m<0)return;if(!(c in a))throw new Error(`Attribute "${c}" is not an attribute of the edited feature.`);d.setAttribute(m,f);const w=e.attributeStorageInfo[m];let b=!1;s.add(c),e.forEachNode((F,x)=>{const v=i(F,x);if(v===-1)return;const A=e.getAttributeData(F.index);if(A){const O=A[w.name];O&&(O[v]=f,e.setAttributeData(F.index,A,n),b=!0)}}),b&&e.clearMemCache()},rollback(){if(l===E.EDITING){for(const c of s)this.setAttribute(c,a[c]);d.remove(),l=E.ROLLED_BACK,e.sessions.delete(t)}},commit(){l===E.EDITING&&(d.remove(),l=E.COMMITTED,e.sessions.delete(t))}};return e.sessions.set(t,o),o}function ce(e,n,t){const{gidToFeatureInfo:r,oidToFeatureInfo:a,fieldsIndex:s,objectIdField:d,globalIdField:u,featureOrIdentifierList:i}=t;if(!t.featuresResolved&&i!=null){for(const l of i){const o={feature:null,oid:-1,gid:null};if("attributes"in l){o.feature=l;const c=l.attributes;if(c!=null)for(const f in c){if(o.oid!==-1&&o.gid!=null)break;const g=s.normalizeFieldName(f);g===d&&(o.oid=c[f]??-1),g===u&&(o.gid=c[f])}}else o.oid=l.objectId??-1,o.gid=l.globalId;o.gid!=null&&r.set(o.gid,o),o.oid!==-1&&a.set(o.oid,o)}t.featuresResolved=!0}return(e!==-1?a.get(e):null)??(n!=null?r.get(n):null)}function U(e,n,t,r,a=null,s=!0){const d=[],u={gidToFeatureInfo:new Map,oidToFeatureInfo:new Map,featuresResolved:t==null,fieldsIndex:e.fieldsIndex,objectIdField:e.objectIdField,globalIdField:e.globalIdField,featureOrIdentifierList:t};for(const i of n){if(i.error!=null)continue;const l=i.objectId??-1,o=i.globalId,c=(l===-1||s?ce(l,o,u):null)??{feature:null,oid:l,gid:o},f={oid:l===-1?c.oid:l,gid:o??c.gid,feature:c.feature,result:i};if(d.push(f),f.oid===-1&&f.gid!=null&&a!=null&&(f.oid=a.get(f.gid)??-1),f.oid===-1&&f.gid!=null){let g=r.get(f.gid);g==null&&(g=[],r.set(f.gid,g)),g.push(f)}}return d}async function Ee(e,n){var d,u,i;const t=new Map,r=U(e,n.addedFeatures,(d=n.edits)==null?void 0:d.addFeatures,t),a=U(e,n.updatedFeatures,(u=n.edits)==null?void 0:u.updateFeatures,t),s=U(e,n.deletedFeatures,(i=n.edits)==null?void 0:i.deleteFeatures,t,n.globalIdToObjectId,!1);return t.size>0&&await fe(e,t),{adds:r.filter(l=>l.oid!==-1),updates:a.filter(l=>l.oid!==-1),deletes:s.filter(l=>l.oid!==-1)}}async function fe(e,n){const t=e.i3sOverrides.layer.associatedLayer;if((t==null?void 0:t.globalIdField)==null)return;const r=t.createQuery(),{objectIdField:a,globalIdField:s}=t;r.where=Array.from(n.keys()).map(i=>`${s}='${i}'`).join(" OR "),r.returnGeometry=!1,r.outFields=[a,s],r.cacheHint=!1;const d=await K(H(t,r));if(!d.ok)return;const u=d.value.features;for(const i of u){const l=i.attributes[s],o=i.attributes[a];if(l==null||o==null||o===-1)continue;const c=n.get(l);if(c!=null)for(const f of c)f.oid=o}}function xe(e,n){var d,u;const t=new Map,r=n.adds,a=n.updates,s=n.deletes;if(r.length>0)for(const i of r){const l=i.oid,o=i.feature;((d=o==null?void 0:o.geometry)==null?void 0:d.type)==="mesh"&&t.set(l,o.geometry)}if(a.length>0)for(const i of a){const l=i.oid,o=i.feature;((u=o==null?void 0:o.geometry)==null?void 0:u.type)==="mesh"&&t.set(l,o.geometry)}if(s.length>0)for(const i of s)t.set(i.oid,null);for(const[i,l]of t)e.i3sOverrides.updateGeometry(i,l)}function ve(e,n){var f;const t=pe(e,n),r=ge(e,n);if(t.size===0&&r.size===0)return;const a=new Map;for(let g=0;g{const w=e.getAttributeData(m);let b=!1;g.forEach((F,x)=>{const v=w!=null?w[x]:null,A=a.get(x);for(const{featureIndex:O,value:M,featureId:G}of F)v&&(v[O]=M,b=!0,s=!0),e.i3sOverrides.updateAttributeValue(G,A,M)}),b&&e.setAttributeData(m,w,null)}),s&&e.clearMemCache();const{fieldsIndex:d,i3sOverrides:u,objectIdField:i,globalIdField:l}=e,o=(f=u.layer.associatedLayer)==null?void 0:f.infoFor3D,c=new Set(o?[...Object.values(o.assetMapFieldRoles),...Object.values(o.transformFieldRoles)]:[]);for(const[g,m]of r){u.featureAdded(g);const{attributes:w}=m;for(const b in w){if(b!==i&&b!==l&&c.has(b))continue;const F=d.normalizeFieldName(b),x=F!=null?a.get(F):null;if(x==null)continue;const v=w[b];u.updateAttributeValue(g,x,v)}}}function ge(e,n){var a;const t=new Map,r=n.adds;if(!r||r.length===0||e.globalIdField==null)return t;for(const s of r){const d=s.oid,u=s.feature;((a=u==null?void 0:u.geometry)==null?void 0:a.type)==="mesh"&&t.set(d,u)}return t}function pe(e,n){const t=n.updates;if(!t||t.length===0)return new C;const r=new C,a=new Map;for(let s=0;s{for(const u of t){if(u.feature==null)continue;const i=u.feature,l=u.oid,o=d.indexOf(l);for(const c in i.attributes){const f=e.fieldsIndex.normalizeFieldName(c),g=ye(r,s.index,f),m=i.attributes[c];g.push({featureIndex:o,featureId:l,value:m})}}}),r}function ye(e,n,t){const r=he(e,n),a=t!=null&&r.get(t);if(a)return a;const s=new Array;return r.set(t,s),s}function he(e,n){const t=e.get(n);if(t)return t;const r=new me;return e.set(n,r),r}(function(e){e[e.EDITING=0]="EDITING",e[e.ROLLED_BACK=1]="ROLLED_BACK",e[e.COMMITTED=2]="COMMITTED"})(E||(E={}));const me=Map,C=Map;function Ae(){return{requiredFields:{type:[String],readOnly:!0},availableFields:{type:[String],readOnly:!0,get:function(){const{layer:e,layer:{fieldsIndex:n},requiredFields:t}=this;return e.outFields?L(n,[...Q(n,e.outFields),...t]):L(n,t)}}}}const P=e=>{let n=class extends e{constructor(){super(...arguments),this._numUpdating=0,this._asyncUpdateState=new Map}get updating(){return this._numUpdating>0}autoUpdateAsync(t,r){return be(a=>this._updateAsync(t,a),r)}async _updateAsync(t,r){if(!this._startAsyncUpdate(t)){try{const a=await r();this._set(t,a)}catch{S.getLogger(this).warn(`Async update of "${String(t)}" failed. Async update functions should not throw exceptions.`)}this._endAsyncUpdate(t)&&this._updateAsync(t,r)}}_startAsyncUpdate(t){const r=this._asyncUpdateState.get(t)??I.None;return r&I.Updating?(this._asyncUpdateState.set(t,r|I.Invalidated),!0):(++this._numUpdating,this._asyncUpdateState.set(t,r|I.Updating),!1)}_endAsyncUpdate(t){--this._numUpdating;const r=(this._asyncUpdateState.get(t)??I.None)&~I.Updating;return r&I.Invalidated?(this._asyncUpdateState.set(t,r&~I.Invalidated),!0):(this._asyncUpdateState.set(t,r),!1)}};return p([y({readOnly:!0})],n.prototype,"updating",null),p([y()],n.prototype,"_numUpdating",void 0),n=p([N("esri.core.AsyncUpdate")],n),n};var I;function be(e,n){const t=()=>{s&&!d&&e(r)},r=()=>{if(!s||d)return n();s.clear(),d=!0;const u=J(s,n);return d=!1,u},a=()=>{s&&(s.destroy(),s=null)};let s=new W(t),d=!1;return e(r),{remove:a}}(function(e){e[e.None=0]="None",e[e.Updating=1]="Updating",e[e.Invalidated=2]="Invalidated"})(I||(I={}));let k=class extends P(q){};k=p([N("esri.core.AsyncUpdate")],k);const V="esri.views.3d.layers.support.SceneLayerViewRequiredFields";let _=class extends P(q){get layer(){return this.layerView.layer}get requiredFields(){const{layerView:{layer:{fieldsIndex:e},definitionExpressionFields:n},rendererFields:t,labelingFields:r,viewFilterFields:a}=this;return L(e,[...n??[],...t??[],...r??[],...a??[]])}constructor(e){super(e)}initialize(){this.addHandles([this.autoUpdateAsync("rendererFields",async()=>{const{fieldsIndex:e,renderer:n}=this.layer;return n?$(t=>n.collectRequiredFields(t,e)):null}),this.autoUpdateAsync("labelingFields",async()=>{const{layer:e}=this;return e.labelsVisible?$(n=>X(n,e)):null}),this.autoUpdateAsync("viewFilterFields",()=>{const{layer:e,filter:n}=this.layerView;return $(t=>Y(t,e,n))})])}};async function $(e){const n=new Set;try{return await e(n),Array.from(n).sort()}catch(t){return S.getLogger(V).error(t),null}}p([y()],_.prototype,"layerView",void 0),p([y()],_.prototype,"layer",null),p([y()],_.prototype,"requiredFields",null),p([y()],_.prototype,"rendererFields",void 0),p([y()],_.prototype,"labelingFields",void 0),p([y()],_.prototype,"viewFilterFields",void 0),_=p([N(V)],_);const z="esri.views.layers.SceneLayerView",j=S.getLogger(z);let h=class extends de{constructor(){super(...arguments),this.layer=null,this.filter=null,this._geometryEngine=null,this._projectionEngineLoaded=!1,this._abortController=new AbortController}get availableFields(){return[]}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){throw new Error("Not implemented")}get maximumNumberOfFeaturesExceeded(){return!1}get layerFilter(){return se(this._layerFilter)}get _layerFilter(){var u;const e=(u=this.layer)==null?void 0:u.filter;if(e==null||e.geometries.length<1)return null;const n=this._geometryEngine;if(n==null||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine)return ae;const t=e.geometries.at(0).spatialReference,r=e.geometries.toArray().map(i=>{try{i=n.simplify(i)}catch{return j.warnOncePerTick("Failed to simplify scene filter mask polygon. Polygon will be ignored."),null}if(i==null)return null;if(i.spatialReference.equals(t))return i;try{return Z(i,t)}catch{return j.warnOncePerTick("Failed to project scene filter mask polygon. Polygon will be ignored."),null}}).filter(ee).sort((i,l)=>i.extent.xmin-l.extent.xmin),a=new Set,s=new Array,d=new Array;for(let i of r){const l=i.extent.xmin;if(s.length=0,a.forEach(o=>{if(l>=o.extent.xmax)return d.push(o),void a.delete(o);i.extent.ymin<=o.extent.ymax&&i.extent.ymax>=o.extent.ymin&&n.intersects(i,o)&&s.push(o)}),s.length>0){s.push(i);try{i=n.union(s)}catch{j.warnOncePerTick("Failed to unify filter mask polygons. Polygon will be ignored.");continue}s.pop(),s.forEach(o=>a.delete(o))}a.add(i)}return a.forEach(i=>d.push(i)),d.length>0?{spatialRelationship:e.spatialRelationship,geometries:d}:null}get _filterNeedsProjectionEngine(){const e=this.layer.filter;if(e==null||e.geometries.length<=1)return!1;const n=e.geometries.at(0).spatialReference;return e.geometries.some(({spatialReference:t})=>!t.equals(n)&&!te(t,n))}get layerFilterUpdating(){return le(this._layerFilter)}initialize(){const{signal:e}=this._abortController;T(()=>{var n,t,r;return this.destroyed||!this._geometryEngine&&((r=(t=(n=this.layer)==null?void 0:n.filter)==null?void 0:t.geometries)==null?void 0:r.length)},e).then(async()=>{D(e),this._geometryEngine=await ne(()=>import("./index-pCX-0tJH.js").then(n=>n.A0),__vite__mapDeps([0,1]))}).catch(R),this._projectionEngineLoaded=re(),T(()=>this.destroyed||!this._projectionEngineLoaded&&this._filterNeedsProjectionEngine,e).then(async()=>{D(e),await ie(),this._projectionEngineLoaded=!0}).catch(R)}destroy(){this._abortController=oe(this._abortController)}highlight(e){throw new Error("Not implemented")}queryFeatures(e,n){throw new Error("Not implemented")}queryObjectIds(e,n){throw new Error("Not implemented")}queryFeatureCount(e,n){throw new Error("Not implemented")}createQuery(){throw new Error("Not implemented")}queryExtent(e,n){throw new Error("Not implemented")}};p([y()],h.prototype,"layer",void 0),p([y()],h.prototype,"availableFields",null),p([y()],h.prototype,"maximumNumberOfFeatures",null),p([y({readOnly:!0})],h.prototype,"maximumNumberOfFeaturesExceeded",null),p([y()],h.prototype,"filter",void 0),p([y({readOnly:!0})],h.prototype,"layerFilter",null),p([y({readOnly:!0})],h.prototype,"_layerFilter",null),p([y()],h.prototype,"_geometryEngine",void 0),p([y()],h.prototype,"_projectionEngineLoaded",void 0),p([y()],h.prototype,"_filterNeedsProjectionEngine",null),p([y()],h.prototype,"layerFilterUpdating",null),h=p([N(z)],h);const Ne=h;export{Ae as a,_ as c,xe as d,ve as f,_e as i,Ne as j,Ee as u}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/index-pCX-0tJH.js","assets/index-4b4radwv.css"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/SceneLayerView3D-7NpyxR5M.js b/dist/assets/SceneLayerView3D-7NpyxR5M.js deleted file mode 100644 index f2e80ed..0000000 --- a/dist/assets/SceneLayerView3D-7NpyxR5M.js +++ /dev/null @@ -1 +0,0 @@ -import{fQ as _,fR as f,fS as m,P as h,fT as o,n as F,Z as b,ca as d,ai as v,fU as I,S as w,fV as u,e as l,y as n,fi as E,dC as O,c as S}from"./index-J0iiHjMT.js";import{s as x}from"./ReactiveSet-HLstcUcf.js";import{x as j}from"./WhereClause-XAMIZ4-B.js";import{E as C,c as H,a as Q}from"./I3SMeshView3D-OXYwZo0p.js";import{n as q}from"./LayerView3D-iOx2MD1g.js";import{c as V,i as D,u as R,d as $,f as A,a as P,j as G}from"./SceneLayerView-MZstNOoI.js";import{L as p,d as U,l as L,o as M}from"./I3SQueryFeatureStore-CLo7XXT-.js";import{t as c}from"./I3SNode-5SPByfpU.js";import{S as N}from"./I3SOverrides-5dCbMm3h.js";import{t as T}from"./DefinitionExpressionSceneLayerView-oAOUEjm-.js";import{i as z}from"./PopupSceneLayerView-cRxapYqF.js";import"./TimeOnly-ljWtUK7N.js";import"./SceneModification-dyp2M_Yg.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./SceneLayerWorker-o7OZRrjZ.js";import"./HeatmapDensity.glsl-y7dUg--m.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./queryForSymbologySnapping-I1fFQTD_.js";import"./hash-SS5GKVPY.js";import"./QueryEngine-8tLWlkSE.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./FeatureSet-d4S1oKME.js";import"./FeatureStore-X-AIJLo2.js";import"./BoundsStore-wmwfHjhp.js";import"./projectExtentUtils-TwA6ooHn.js";import"./LayerView-efDufa6j.js";import"./meshFeatureSet-Mcou8mDC.js";import"./External-GV0jSEES.js";import"./FeatureLayerView3D-t6NDkLO0.js";import"./FeatureLayerViewBase3D-VurTj7t3.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./EventedSet-JGlFrfoR.js";import"./FeatureEffect-5bEV-xG1.js";import"./RefreshableLayerView-Pd4dLcWr.js";const y=P();let s=class extends C(T(z(q(G)))){constructor(){super(...arguments),this.type="scene-layer-3d",this._setVisibilityHiddenObjectIds=new x,this.progressiveLoadFactor=1,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!0,this._pendingEditsQueue=Promise.resolve(),this._interactiveEditingSessions=new Map,this._queryEngine=null}get i3slayer(){return this.layer}tryRecycleWith(e,t){return e.url===this.layer.url&&this.i3sOverrides.isEmpty?e.load(t).then(()=>{var r;_(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();const i=(r=this.view.resourceController)==null?void 0:r.memoryController;this.i3sOverrides=new N({view:this.view,layer:e,memoryController:i}),this.resetHighlights()}):null}get layerPopupEnabledAndHasTemplate(){var e;return this.layer.popupEnabled&&f(this.layer,(e=this.view.popup)==null?void 0:e.defaultPopupTemplateEnabled)}get filter(){return this._get("filter")}set filter(e){this._set("filter",p.checkSupport(e)?e:null)}get viewFilter(){const e=this.filter,t=this.layerFilter;if(e==null&&t==null)return null;const i=this._get("viewFilter");return i==null?new p({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:r=>this._loadAsyncModule(r),addSqlFilter:(r,a)=>this.addSqlFilter(r,a,this.logError)}):(i.viewFilter=e,i.layerFilter=t,i)}get requiredFields(){var e;return((e=this._fieldsHelper)==null?void 0:e.requiredFields)??[]}get _floorFilterClause(){const e=m(this);return e!=null?j.create(e,this.layer.fieldsIndex):null}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds.toArray();return e.length?e.sort((t,i)=>t-i):null}get _setVisibilityHiddenObjectIdsSorted(){return this._setVisibilityHiddenObjectIds.size?Array.from(this._setVisibilityHiddenObjectIds).sort((e,t)=>e-t):null}get _objectQualitySettings(){var e,t,i;return(i=(t=(e=this.view)==null?void 0:e.qualitySettings)==null?void 0:t.sceneService)==null?void 0:i.object}get lodFactor(){var e;return((e=this._objectQualitySettings)==null?void 0:e.lodFactor)??1}get lodCrossfadeinDuration(){return this._objectQualitySettings.lodCrossfadeinDuration??0}get lodCrossfadeoutDuration(){return this._objectQualitySettings.lodCrossfadeoutDuration??0}get lodCrossfadeUncoveredDuration(){return this._objectQualitySettings.lodCrossfadeUncoveredDuration??0}get updatingProgressValue(){var e;return((e=this._controller)==null?void 0:e.updatingProgress)??0}initialize(){this._fieldsHelper=new V({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,t=>this._rangeInfosChanged(t),h),this._updatingHandles.add(()=>this.layer.renderer,t=>this._updatingHandles.addPromise(this._rendererChange(t)),h);const e=()=>this._filterChange();this._updatingHandles.add(()=>this.parsedDefinitionExpression,e),this._updatingHandles.add(()=>this.filter,e),this._updatingHandles.add(()=>this._floorFilterClause,e),this._updatingHandles.add(()=>this._excludeObjectIdsSorted,e),this._updatingHandles.add(()=>this._setVisibilityHiddenObjectIdsSorted,e),this._updatingHandles.add(()=>this.viewFilter!=null?this.viewFilter.sortedObjectIds:null,e),this._updatingHandles.add(()=>this.viewFilter!=null?this.viewFilter.parsedWhereClause:null,e),this._updatingHandles.add(()=>[this.viewFilter!=null?this.viewFilter.parsedGeometry:null,this.filter!=null?this.filter.spatialRelationship:null,this.layer.filter!=null?this.layer.filter.spatialRelationship:null],()=>this._geometryFilterChange()),o()&&this.i3sOverrides.is3DOFL&&this._updatingHandles.add(()=>this.i3sOverrides.sortedGeometryChangedObjectIds,e),this.addHandles(this.layer.on("apply-edits",t=>this._updatingHandles.addPromise(t.result))),this.addHandles(this.layer.on("edits",t=>{const i=this._pendingEditsQueue.then(()=>this._handleEdits(t)).then();this._pendingEditsQueue=i,this._updatingHandles.addPromise(i)}))}destroy(){this._fieldsHelper=F(this._fieldsHelper)}_rangeInfosChanged(e){e!=null&&e.length>0&&b.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return this.filter!=null?this.filter.createQuery(e):new d(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t==null?void 0:t.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t==null?void 0:t.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t==null?void 0:t.signal).then(i=>{if(!(i!=null&&i.features))return i;const r=this.layer;for(const a of i.features)a.layer=r,a.sourceLayer=r;return i})}queryObjectIds(e,t){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t==null?void 0:t.signal)}_ensureQueryEngine(){return this._queryEngine||(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=H(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new U({layerView:this,priority:v.FEATURE_QUERY_ENGINE,spatialIndex:new L({featureAdapter:new M({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(t,i)=>this._forAllFeatures((r,a,g)=>t({id:r,index:a,meta:g}),i,Q.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:I(this.layer),viewSpatialReference:this.view.spatialReference})})}highlight(e){const t=this._highlights;if(e instanceof d){const{set:i,handle:r}=t.acquireSet();return this.queryObjectIds(e).then(a=>t.setFeatureIds(i,a)),r}return super.highlight(e)}createInteractiveEditSession(e){return D(this._attributeEditingContext,e)}_createLayerGraphic(e){const t=new w(null,null,e);return t.layer=this.layer,t.sourceLayer=this.layer,t}getFilters(){const e=super.getFilters();o()&&this.i3sOverrides.is3DOFL&&this.i3sOverrides.sortedGeometryChangedObjectIds.length>0&&e.push((r,a)=>{a.node.index>=0&&u(this.i3sOverrides.sortedGeometryChangedObjectIds,!1,r)});const t=this._setVisibilityHiddenObjectIdsSorted;t!=null&&e.push(r=>u(t,!1,r));const i=this._excludeObjectIdsSorted;return i!=null&&e.push(r=>u(i,!1,r)),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this.viewFilter!=null&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}setVisibility(e,t){t?this._setVisibilityHiddenObjectIds.delete(e):this._setVisibilityHiddenObjectIds.add(e)}isUpdating(){return super.isUpdating()||this.layerFilterUpdating||this.viewFilter!=null&&this.viewFilter.updating||this.i3sOverrides!=null&&this.i3sOverrides.updating}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():d.from(e))}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),globalIdField:this._getGlobalIdField(),forEachNode:e=>this._forAllNodes(t=>t!=null?e(t.node,t.featureIds):null),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}async _handleEdits(e){const t=o(),i=this._attributeEditingContext,r=await R(i,e);t&&$(i,r),A(i,r)}get hasGeometryFilter(){const e=this.viewFilter;return(e==null?void 0:e.parsedGeometry)!=null}computeNodeFiltering(e){const t=this.viewFilter;return t==null||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?c.Unmodified:c.Culled}};l([n()],s.prototype,"i3slayer",null),l([n(E)],s.prototype,"updatingProgress",void 0),l([n({type:O})],s.prototype,"filter",null),l([n({readOnly:!0})],s.prototype,"viewFilter",null),l([n(y.requiredFields)],s.prototype,"requiredFields",null),l([n(y.availableFields)],s.prototype,"availableFields",void 0),l([n()],s.prototype,"_fieldsHelper",void 0),l([n()],s.prototype,"_floorFilterClause",null),l([n()],s.prototype,"_excludeObjectIdsSorted",null),l([n()],s.prototype,"_setVisibilityHiddenObjectIds",void 0),l([n()],s.prototype,"_setVisibilityHiddenObjectIdsSorted",null),l([n()],s.prototype,"_objectQualitySettings",null),l([n()],s.prototype,"lodFactor",null),l([n()],s.prototype,"updatingProgressValue",null),s=l([S("esri.views.3d.layers.SceneLayerView3D")],s);const Re=s;export{Re as default}; diff --git a/dist/assets/SceneLayerView3D-wSIS3UPq.js b/dist/assets/SceneLayerView3D-wSIS3UPq.js new file mode 100644 index 0000000..31f8d07 --- /dev/null +++ b/dist/assets/SceneLayerView3D-wSIS3UPq.js @@ -0,0 +1 @@ +import{fL as _,fM as f,fN as m,P as h,fO as o,b,R as F,aL as d,bn as v,fP as I,K as w,fQ as u,e as l,y as n,fd as E,dx as O,c as S}from"./index-pCX-0tJH.js";import{s as x}from"./ReactiveSet-_4-UpKXZ.js";import{x as j}from"./WhereClause-FOYoIAAW.js";import{E as H,c as C,a as Q}from"./I3SMeshView3D-frxYFPRW.js";import{n as q}from"./LayerView3D-57OghbRh.js";import{c as V,i as D,u as R,d as $,f as A,a as P,j as L}from"./SceneLayerView-Z2vMKB9z.js";import{L as p,d as G,l as U,o as M}from"./I3SQueryFeatureStore-LSdoLFw0.js";import{t as c}from"./I3SNode-A9aOJfXV.js";import{S as N}from"./I3SOverrides-XXafrk1K.js";import{t as T}from"./DefinitionExpressionSceneLayerView-Z1V4X6Kq.js";import{i as z}from"./PopupSceneLayerView-1BvuVn-Q.js";import"./TimeOnly-gkehHHJx.js";import"./SceneModification-E4lNPbBQ.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./SceneLayerWorker-fjNBmTGi.js";import"./HeatmapDensity.glsl-de3m0xZZ.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./queryForSymbologySnapping-MXWRIdj-.js";import"./hash-SS5GKVPY.js";import"./QueryEngine-uvDs-vBe.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./FeatureStore-PXMUgn0j.js";import"./BoundsStore-_-dPK5c-.js";import"./projectExtentUtils-Q4rXasWA.js";import"./LayerView-ixwLVnzr.js";import"./meshFeatureSet-42GYfSGc.js";import"./External-Pb5poJ0S.js";import"./FeatureLayerView3D-vzwVkoh-.js";import"./FeatureLayerViewBase3D-W0Qwl4g_.js";import"./EventedSet-TJfupI82.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./RefreshableLayerView-DVYs7L04.js";const y=P();let s=class extends H(T(z(q(L)))){constructor(){super(...arguments),this.type="scene-layer-3d",this._setVisibilityHiddenObjectIds=new x,this.progressiveLoadFactor=1,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!0,this._pendingEditsQueue=Promise.resolve(),this._interactiveEditingSessions=new Map,this._queryEngine=null}get i3slayer(){return this.layer}tryRecycleWith(e,t){return e.url===this.layer.url&&this.i3sOverrides.isEmpty?e.load(t).then(()=>{var r;_(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();const i=(r=this.view.resourceController)==null?void 0:r.memoryController;this.i3sOverrides=new N({view:this.view,layer:e,memoryController:i}),this.resetHighlights()}):null}get layerPopupEnabledAndHasTemplate(){var e;return this.layer.popupEnabled&&f(this.layer,(e=this.view.popup)==null?void 0:e.defaultPopupTemplateEnabled)}get filter(){return this._get("filter")}set filter(e){this._set("filter",p.checkSupport(e)?e:null)}get viewFilter(){const e=this.filter,t=this.layerFilter;if(e==null&&t==null)return null;const i=this._get("viewFilter");return i==null?new p({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:r=>this._loadAsyncModule(r),addSqlFilter:(r,a)=>this.addSqlFilter(r,a,this.logError)}):(i.viewFilter=e,i.layerFilter=t,i)}get requiredFields(){var e;return((e=this._fieldsHelper)==null?void 0:e.requiredFields)??[]}get _floorFilterClause(){const e=m(this);return e!=null?j.create(e,this.layer.fieldsIndex):null}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds.toArray();return e.length?e.sort((t,i)=>t-i):null}get _setVisibilityHiddenObjectIdsSorted(){return this._setVisibilityHiddenObjectIds.size?Array.from(this._setVisibilityHiddenObjectIds).sort((e,t)=>e-t):null}get _objectQualitySettings(){var e,t,i;return(i=(t=(e=this.view)==null?void 0:e.qualitySettings)==null?void 0:t.sceneService)==null?void 0:i.object}get lodFactor(){var e;return((e=this._objectQualitySettings)==null?void 0:e.lodFactor)??1}get lodCrossfadeinDuration(){return this._objectQualitySettings.lodCrossfadeinDuration??0}get lodCrossfadeoutDuration(){return this._objectQualitySettings.lodCrossfadeoutDuration??0}get lodCrossfadeUncoveredDuration(){return this._objectQualitySettings.lodCrossfadeUncoveredDuration??0}get updatingProgressValue(){var e;return((e=this._controller)==null?void 0:e.updatingProgress)??0}initialize(){this._fieldsHelper=new V({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,t=>this._rangeInfosChanged(t),h),this._updatingHandles.add(()=>this.layer.renderer,t=>this._updatingHandles.addPromise(this._rendererChange(t)),h);const e=()=>this._filterChange();this._updatingHandles.add(()=>this.parsedDefinitionExpression,e),this._updatingHandles.add(()=>this.filter,e),this._updatingHandles.add(()=>this._floorFilterClause,e),this._updatingHandles.add(()=>this._excludeObjectIdsSorted,e),this._updatingHandles.add(()=>this._setVisibilityHiddenObjectIdsSorted,e),this._updatingHandles.add(()=>this.viewFilter!=null?this.viewFilter.sortedObjectIds:null,e),this._updatingHandles.add(()=>this.viewFilter!=null?this.viewFilter.parsedWhereClause:null,e),this._updatingHandles.add(()=>[this.viewFilter!=null?this.viewFilter.parsedGeometry:null,this.filter!=null?this.filter.spatialRelationship:null,this.layer.filter!=null?this.layer.filter.spatialRelationship:null],()=>this._geometryFilterChange()),o()&&this.i3sOverrides.is3DOFL&&this._updatingHandles.add(()=>this.i3sOverrides.sortedGeometryChangedObjectIds,e),this.addHandles(this.layer.on("apply-edits",t=>this._updatingHandles.addPromise(t.result))),this.addHandles(this.layer.on("edits",t=>{const i=this._pendingEditsQueue.then(()=>this._handleEdits(t)).then();this._pendingEditsQueue=i,this._updatingHandles.addPromise(i)}))}destroy(){this._fieldsHelper=b(this._fieldsHelper)}_rangeInfosChanged(e){e!=null&&e.length>0&&F.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return this.filter!=null?this.filter.createQuery(e):new d(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t==null?void 0:t.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t==null?void 0:t.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t==null?void 0:t.signal).then(i=>{if(!(i!=null&&i.features))return i;const r=this.layer;for(const a of i.features)a.layer=r,a.sourceLayer=r;return i})}queryObjectIds(e,t){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t==null?void 0:t.signal)}_ensureQueryEngine(){return this._queryEngine||(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=C(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new G({layerView:this,priority:v.FEATURE_QUERY_ENGINE,spatialIndex:new U({featureAdapter:new M({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(t,i)=>this._forAllFeatures((r,a,g)=>t({id:r,index:a,meta:g}),i,Q.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:I(this.layer),viewSpatialReference:this.view.spatialReference})})}highlight(e){const t=this._highlights;if(e instanceof d){const{set:i,handle:r}=t.acquireSet();return this.queryObjectIds(e).then(a=>t.setFeatureIds(i,a)),r}return super.highlight(e)}createInteractiveEditSession(e){return D(this._attributeEditingContext,e)}_createLayerGraphic(e){const t=new w(null,null,e);return t.layer=this.layer,t.sourceLayer=this.layer,t}getFilters(){const e=super.getFilters();o()&&this.i3sOverrides.is3DOFL&&this.i3sOverrides.sortedGeometryChangedObjectIds.length>0&&e.push((r,a)=>{a.node.index>=0&&u(this.i3sOverrides.sortedGeometryChangedObjectIds,!1,r)});const t=this._setVisibilityHiddenObjectIdsSorted;t!=null&&e.push(r=>u(t,!1,r));const i=this._excludeObjectIdsSorted;return i!=null&&e.push(r=>u(i,!1,r)),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),this.viewFilter!=null&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}setVisibility(e,t){t?this._setVisibilityHiddenObjectIds.delete(e):this._setVisibilityHiddenObjectIds.add(e)}isUpdating(){return super.isUpdating()||this.layerFilterUpdating||this.viewFilter!=null&&this.viewFilter.updating||this.i3sOverrides!=null&&this.i3sOverrides.updating}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():d.from(e))}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),globalIdField:this._getGlobalIdField(),forEachNode:e=>this._forAllNodes(t=>t!=null?e(t.node,t.featureIds):null),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}async _handleEdits(e){const t=o(),i=this._attributeEditingContext,r=await R(i,e);t&&$(i,r),A(i,r)}get hasGeometryFilter(){const e=this.viewFilter;return(e==null?void 0:e.parsedGeometry)!=null}computeNodeFiltering(e){const t=this.viewFilter;return t==null||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?c.Unmodified:c.Culled}};l([n()],s.prototype,"i3slayer",null),l([n(E)],s.prototype,"updatingProgress",void 0),l([n({type:O})],s.prototype,"filter",null),l([n({readOnly:!0})],s.prototype,"viewFilter",null),l([n(y.requiredFields)],s.prototype,"requiredFields",null),l([n(y.availableFields)],s.prototype,"availableFields",void 0),l([n()],s.prototype,"_fieldsHelper",void 0),l([n()],s.prototype,"_floorFilterClause",null),l([n()],s.prototype,"_excludeObjectIdsSorted",null),l([n()],s.prototype,"_setVisibilityHiddenObjectIds",void 0),l([n()],s.prototype,"_setVisibilityHiddenObjectIdsSorted",null),l([n()],s.prototype,"_objectQualitySettings",null),l([n()],s.prototype,"lodFactor",null),l([n()],s.prototype,"updatingProgressValue",null),s=l([S("esri.views.3d.layers.SceneLayerView3D")],s);const Ce=s;export{Ce as default}; diff --git a/dist/assets/SceneLayerWorker-o7OZRrjZ.js b/dist/assets/SceneLayerWorker-fjNBmTGi.js similarity index 75% rename from dist/assets/SceneLayerWorker-o7OZRrjZ.js rename to dist/assets/SceneLayerWorker-fjNBmTGi.js index 61580e7..8c7ee52 100644 --- a/dist/assets/SceneLayerWorker-o7OZRrjZ.js +++ b/dist/assets/SceneLayerWorker-fjNBmTGi.js @@ -1,7 +1,7 @@ -import{de as L,kj as G,ar as j,ln as W,lo as K,lp as Q,lq as X,lr as Z}from"./index-J0iiHjMT.js";import{n as A}from"./I3SNode-5SPByfpU.js";var S,$;(function(e){e[e.None=0]="None",e[e.Int16=1]="Int16",e[e.Int32=2]="Int32"})(S||(S={})),function(e){e[e.Replace=0]="Replace",e[e.Outside=1]="Outside",e[e.Inside=2]="Inside",e[e.Finished=3]="Finished"}($||($={}));function ee(){return v||(v=new Promise(e=>L(()=>import("./i3s-038C_b0B.js"),__vite__mapDeps([0,1,2])).then(t=>t.i).then(({default:t})=>{const n=t({locateFile:te,onRuntimeInitialized:()=>e(n)});delete n.then})).catch(e=>{throw e})),v}function te(e){return G(`esri/libs/i3s/${e}`)}let v;async function ne(e){o=await w();const t=[e.geometryBuffer];return{result:C(o,e,t),transferList:t}}async function re(e){var h;o=await w();const t=[e.geometryBuffer],{geometryBuffer:n}=e,s=n.byteLength,i=o._malloc(s),d=new Uint8Array(o.HEAPU8.buffer,i,s);d.set(new Uint8Array(n));const f=o.dracoDecompressPointCloudData(i,d.byteLength);if(o._free(i),f.error.length>0)throw new Error(`i3s.wasm: ${f.error}`);const c=((h=f.featureIds)==null?void 0:h.length)>0?f.featureIds.slice():null,a=f.positions.slice();return c&&t.push(c.buffer),t.push(a.buffer),{result:{positions:a,featureIds:c},transferList:t}}async function oe(e){await w(),V(e);const t={buffer:e.buffer};return{result:t,transferList:[t.buffer]}}async function ie(e){await w(),z(e)}async function se(e){o=await w(),o.setLegacySchema(e.context,e.jsonSchema)}async function ae(e){const{localMatrix:t,origin:n,positions:s,vertexSpace:i,localMode:d}=e,f=j.fromJSON(e.inSpatialReference),c=j.fromJSON(e.outSpatialReference);let a;if(i.type==="georeferenced"){const[{projectBuffer:l},{initializeProjection:_}]=await Promise.all([L(()=>import("./index-J0iiHjMT.js").then(y=>y.zC),__vite__mapDeps([1,2])),L(()=>import("./index-J0iiHjMT.js").then(y=>y.zD),__vite__mapDeps([1,2]))]);await _(f,c),a=new Float64Array(s.length),l(s,f,0,a,c,0,a.length/3)}else{const l=i.type==="georeferencedRelative"?W.fromJSON(i):K.fromJSON(i),{project:_}=await L(()=>import("./index-J0iiHjMT.js").then(y=>y.zH),__vite__mapDeps([1,2]));a=Q(_({positions:s,transform:t?{localMatrix:t}:void 0,vertexSpace:l,inSpatialReference:f,outSpatialReference:c,localMode:d}))}const h=a.length,[P,O,R]=n;for(let l=0;lp.some(E=>E.name==="color")),normal:t.needNormals&&t.layouts.some(p=>p.some(E=>E.name==="normalCompressed")),uv0:t.layouts.some(p=>p.some(E=>E.name==="uv0")),uvRegion:t.layouts.some(p=>p.some(E=>E.name==="uvRegion")),featureIndex:x.featureIndex},r=e.process(s,!!t.obb,l,F.byteLength,x,H,y,a,O,R,t.normalReferenceFrame);if(e._free(y),e._free(l),r.error.length>0)throw new Error(`i3s.wasm: ${r.error}`);if(r.discarded)return null;const T=r.componentOffsets.length>0?r.componentOffsets.slice():null,M=r.featureIds.length>0?r.featureIds.slice():null,J=r.anchorIds.length>0?Array.from(r.anchorIds):null,k=r.anchors.length>0?Array.from(r.anchors):null,U=r.interleavedVertedData.slice().buffer,N=r.indicesType===S.Int16?new Uint16Array(r.indices.buffer,r.indices.byteOffset,r.indices.byteLength/2).slice():new Uint32Array(r.indices.buffer,r.indices.byteOffset,r.indices.byteLength/4).slice(),B=r.positions.slice(),D=r.positionIndicesType===S.Int16?new Uint16Array(r.positionIndices.buffer,r.positionIndices.byteOffset,r.positionIndices.byteLength/2).slice():new Uint32Array(r.positionIndices.buffer,r.positionIndices.byteOffset,r.positionIndices.byteLength/4).slice(),q={layout:t.layouts[0],interleavedVertexData:U,indices:N,hasColors:r.hasColors,hasModifications:r.hasModifications,positionData:{data:B,indices:D}};return M&&n.push(M.buffer),T&&n.push(T.buffer),n.push(U),n.push(N.buffer),n.push(B.buffer),n.push(D.buffer),{componentOffsets:T,featureIds:M,anchorIds:J,anchors:k,transformedGeometry:q,obb:r.obb}}function ce(e){return e===0?A.Unmodified:e===1?A.PotentiallyModified:e===2?A.Culled:A.Unknown}function V(e){if(!o)return;const{context:t,buffer:n}=e,s=o._malloc(n.byteLength),i=n.byteLength/Float64Array.BYTES_PER_ELEMENT,d=new Float64Array(o.HEAPU8.buffer,s,i),f=new Float64Array(n);d.set(f),o.filterOBBs(t,s,i),f.set(d),o._free(s)}function Y(e){o&&o.destroy(e)===0&&(o=null)}function g(e,t){for(let n=0;n(o=e,I=null,o))),I)}const de={transform:(e,t)=>o&&C(o,e,t),destroy:Y},be=Object.freeze(Object.defineProperty({__proto__:null,destroyContext:le,dracoDecompressPointCloudData:re,filterObbsForModifications:oe,filterObbsForModificationsSync:V,initialize:ue,interpretObbModificationResults:ce,process:ne,project:ae,setLegacySchema:se,setModifications:ie,setModificationsSync:z,test:de,transformNormals:fe},Symbol.toStringTag,{value:"Module"}));export{ce as A,z as E,ue as I,V as L,be as S,$ as e}; +import{de as L,kr as W,d2 as j,lv as q,lw as K,lx as Q,ly as X,lz as Z}from"./index-pCX-0tJH.js";import{n as A}from"./I3SNode-A9aOJfXV.js";var S,$;(function(e){e[e.None=0]="None",e[e.Int16=1]="Int16",e[e.Int32=2]="Int32"})(S||(S={})),function(e){e[e.Replace=0]="Replace",e[e.Outside=1]="Outside",e[e.Inside=2]="Inside",e[e.Finished=3]="Finished"}($||($={}));function ee(){return v||(v=new Promise(e=>L(()=>import("./i3s-Sea9P9GD.js"),__vite__mapDeps([0,1,2])).then(t=>t.i).then(({default:t})=>{const n=t({locateFile:te,onRuntimeInitialized:()=>e(n)});delete n.then})).catch(e=>{throw e})),v}function te(e){return W(`esri/libs/i3s/${e}`)}let v;async function ne(e){o=await w();const t=[e.geometryBuffer];return{result:V(o,e,t),transferList:t}}async function re(e){var h;o=await w();const t=[e.geometryBuffer],{geometryBuffer:n}=e,s=n.byteLength,i=o._malloc(s),d=new Uint8Array(o.HEAPU8.buffer,i,s);d.set(new Uint8Array(n));const f=o.dracoDecompressPointCloudData(i,d.byteLength);if(o._free(i),f.error.length>0)throw new Error(`i3s.wasm: ${f.error}`);const c=((h=f.featureIds)==null?void 0:h.length)>0?f.featureIds.slice():null,a=f.positions.slice();return c&&t.push(c.buffer),t.push(a.buffer),{result:{positions:a,featureIds:c},transferList:t}}async function oe(e){await w(),C(e);const t={buffer:e.buffer};return{result:t,transferList:[t.buffer]}}async function ie(e){await w(),z(e)}async function se(e){o=await w(),o.setLegacySchema(e.context,e.jsonSchema)}async function ae(e){const{localMatrix:t,origin:n,positions:s,vertexSpace:i,localMode:d}=e,f=j.fromJSON(e.inSpatialReference),c=j.fromJSON(e.outSpatialReference);let a;if(i.type==="georeferenced"){const[{projectBuffer:l},{initializeProjection:_}]=await Promise.all([L(()=>import("./index-pCX-0tJH.js").then(y=>y.zV),__vite__mapDeps([1,2])),L(()=>import("./index-pCX-0tJH.js").then(y=>y.zW),__vite__mapDeps([1,2]))]);await _(f,c),a=new Float64Array(s.length),l(s,f,0,a,c,0,a.length/3)}else{const l=i.type==="georeferencedRelative"?q.fromJSON(i):K.fromJSON(i),{project:_}=await L(()=>import("./index-pCX-0tJH.js").then(y=>y.z_),__vite__mapDeps([1,2]));a=Q(_({positions:s,transform:t?{localMatrix:t}:void 0,vertexSpace:l,inSpatialReference:f,outSpatialReference:c,localMode:d}))}const h=a.length,[P,O,R]=n;for(let l=0;lp.some(E=>E.name==="color")),normal:t.needNormals&&t.layouts.some(p=>p.some(E=>E.name==="normalCompressed")),uv0:t.layouts.some(p=>p.some(E=>E.name==="uv0")),uvRegion:t.layouts.some(p=>p.some(E=>E.name==="uvRegion")),featureIndex:F.featureIndex},r=e.process(s,!!t.obb,l,x.byteLength,F,H,y,a,O,R,t.normalReferenceFrame);if(e._free(y),e._free(l),r.error.length>0)throw new Error(`i3s.wasm: ${r.error}`);if(r.discarded)return null;const T=r.componentOffsets.length>0?r.componentOffsets.slice():null,M=r.featureIds.length>0?r.featureIds.slice():null,J=r.anchorIds.length>0?Array.from(r.anchorIds):null,k=r.anchors.length>0?Array.from(r.anchors):null,U=r.interleavedVertedData.slice().buffer,N=r.indicesType===S.Int16?new Uint16Array(r.indices.buffer,r.indices.byteOffset,r.indices.byteLength/2).slice():new Uint32Array(r.indices.buffer,r.indices.byteOffset,r.indices.byteLength/4).slice(),B=r.positions.slice(),D=r.positionIndicesType===S.Int16?new Uint16Array(r.positionIndices.buffer,r.positionIndices.byteOffset,r.positionIndices.byteLength/2).slice():new Uint32Array(r.positionIndices.buffer,r.positionIndices.byteOffset,r.positionIndices.byteLength/4).slice(),G={layout:t.layouts[0],interleavedVertexData:U,indices:N,hasColors:r.hasColors,hasModifications:r.hasModifications,positionData:{data:B,indices:D}};return M&&n.push(M.buffer),T&&n.push(T.buffer),n.push(U),n.push(N.buffer),n.push(B.buffer),n.push(D.buffer),{componentOffsets:T,featureIds:M,anchorIds:J,anchors:k,transformedGeometry:G,obb:r.obb}}function ce(e){return e===0?A.Unmodified:e===1?A.PotentiallyModified:e===2?A.Culled:A.Unknown}function C(e){if(!o)return;const{context:t,buffer:n}=e,s=o._malloc(n.byteLength),i=n.byteLength/Float64Array.BYTES_PER_ELEMENT,d=new Float64Array(o.HEAPU8.buffer,s,i),f=new Float64Array(n);d.set(f),o.filterOBBs(t,s,i),f.set(d),o._free(s)}function Y(e){o&&o.destroy(e)===0&&(o=null)}function g(e,t){for(let n=0;n(o=e,I=null,o))),I)}const de={transform:(e,t)=>o&&V(o,e,t),destroy:Y},be=Object.freeze(Object.defineProperty({__proto__:null,destroyContext:le,dracoDecompressPointCloudData:re,filterObbsForModifications:oe,filterObbsForModificationsSync:C,initialize:ue,interpretObbModificationResults:ce,process:ne,project:ae,setLegacySchema:se,setModifications:ie,setModificationsSync:z,test:de,transformNormals:fe},Symbol.toStringTag,{value:"Module"}));export{ce as A,z as E,ue as I,C as L,be as S,$ as e}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/i3s-038C_b0B.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css"] + __vite__mapDeps.viteFileDeps = ["assets/i3s-Sea9P9GD.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/SceneModification-E4lNPbBQ.js b/dist/assets/SceneModification-E4lNPbBQ.js new file mode 100644 index 0000000..09e24c1 --- /dev/null +++ b/dist/assets/SceneModification-E4lNPbBQ.js @@ -0,0 +1 @@ +import{e as r,y as l,j as y,e4 as c,du as f,c as m,dr as d,cj as u,dm as h,e5 as R,ah as g}from"./index-pCX-0tJH.js";var n;let t=n=class extends d{constructor(a){super(a),this.geometry=null,this.type="clip"}writeGeometry(a,i,o,e){var p;if((p=e.layer)!=null&&p.spatialReference&&!e.layer.spatialReference.equals(this.geometry.spatialReference)){if(!u(a.spatialReference,e.layer.spatialReference))return void((e==null?void 0:e.messages)&&e.messages.push(new h("scenemodification:unsupported","Scene modifications with incompatible spatial references are not supported",{modification:this,spatialReference:e.layer.spatialReference,context:e})));const s=new y;R(a,s,e.layer.spatialReference),i[o]=s.toJSON(e)}else i[o]=a.toJSON(e);delete i[o].spatialReference}clone(){return new n({geometry:g(this.geometry),type:this.type})}};r([l({type:y}),c()],t.prototype,"geometry",void 0),r([f(["web-scene","portal-item"],"geometry")],t.prototype,"writeGeometry",null),r([l({type:["clip","mask","replace"],nonNullable:!0}),c()],t.prototype,"type",void 0),t=n=r([m("esri.layers.support.SceneModification")],t);const v=t;export{v as f}; diff --git a/dist/assets/SceneModification-dyp2M_Yg.js b/dist/assets/SceneModification-dyp2M_Yg.js deleted file mode 100644 index 5d9a872..0000000 --- a/dist/assets/SceneModification-dyp2M_Yg.js +++ /dev/null @@ -1 +0,0 @@ -import{e as r,y as l,l as y,eb as c,du as f,c as m,dr as d,ct as u,dm as R,ec as g,bI as h}from"./index-J0iiHjMT.js";var s;let t=s=class extends d{constructor(a){super(a),this.geometry=null,this.type="clip"}writeGeometry(a,i,o,e){var n;if((n=e.layer)!=null&&n.spatialReference&&!e.layer.spatialReference.equals(this.geometry.spatialReference)){if(!u(a.spatialReference,e.layer.spatialReference))return void((e==null?void 0:e.messages)&&e.messages.push(new R("scenemodification:unsupported","Scene modifications with incompatible spatial references are not supported",{modification:this,spatialReference:e.layer.spatialReference,context:e})));const p=new y;g(a,p,e.layer.spatialReference),i[o]=p.toJSON(e)}else i[o]=a.toJSON(e);delete i[o].spatialReference}clone(){return new s({geometry:h(this.geometry),type:this.type})}};r([l({type:y}),c()],t.prototype,"geometry",void 0),r([f(["web-scene","portal-item"],"geometry")],t.prototype,"writeGeometry",null),r([l({type:["clip","mask","replace"],nonNullable:!0}),c()],t.prototype,"type",void 0),t=s=r([m("esri.layers.support.SceneModification")],t);const b=t;export{b as f}; diff --git a/dist/assets/SceneSnappingManagerPool-OpebO9Di.js b/dist/assets/SceneSnappingManagerPool-OpebO9Di.js deleted file mode 100644 index c36bc3c..0000000 --- a/dist/assets/SceneSnappingManagerPool-OpebO9Di.js +++ /dev/null @@ -1 +0,0 @@ -import{hW as s,a5 as r,d as c,P as p,V as u,hX as l,hY as f,hZ as d,a2 as g,h_ as h}from"./index-J0iiHjMT.js";function v(n,e){const i=new s({enabled:!0,selfEnabled:!1,featureEnabled:!0,distance:(e==null?void 0:e.distance)??r.distance,touchSensitivityMultiplier:(e==null?void 0:e.touchSensitivityMultiplier)??r.touchSensitivityMultiplier});return{...c(()=>{var t,a;return((a=(t=n.map)==null?void 0:t.allLayers)==null?void 0:a.toArray())??[]},t=>{i.featureSources=new u(t.map(a=>new l({layer:a,enabled:!0})))},p),options:i}}const o=new Map;function M(n){if(!o.has(n)){const t=v(n,{distance:10}),a=y(n,t.options);o.set(n,{referenceCount:0,snappingManager:a,remove:()=>{t.remove(),a.destroy()}})}const e=o.get(n);e.referenceCount++;const i=g(()=>w(n,e));return{snappingManager:e.snappingManager,...i}}function w(n,e){e.referenceCount--,e.referenceCount>0||h(()=>{e.referenceCount===0&&(e.remove(),o.delete(n))})}function y(n,e){return new f({view:n,options:e,snappingEnginesFactory:(i,t)=>[new d({view:n,spatialReference:n.spatialReference,options:t})]})}export{M as a}; diff --git a/dist/assets/SceneSnappingManagerPool-V-V1M2q0.js b/dist/assets/SceneSnappingManagerPool-V-V1M2q0.js new file mode 100644 index 0000000..1243bb6 --- /dev/null +++ b/dist/assets/SceneSnappingManagerPool-V-V1M2q0.js @@ -0,0 +1 @@ +import{ic as s,a3 as r,B as c,P as p,V as u,id as l,ie as f,ig as d,a0 as g,ih as v}from"./index-pCX-0tJH.js";function w(n,e){const i=new s({enabled:!0,selfEnabled:!1,featureEnabled:!0,distance:(e==null?void 0:e.distance)??r.distance,touchSensitivityMultiplier:(e==null?void 0:e.touchSensitivityMultiplier)??r.touchSensitivityMultiplier});return{...c(()=>{var t,a;return((a=(t=n.map)==null?void 0:t.allLayers)==null?void 0:a.toArray())??[]},t=>{i.featureSources=new u(t.map(a=>new l({layer:a,enabled:!0})))},p),options:i}}const o=new Map;function $(n){if(!o.has(n)){const t=w(n,{distance:10}),a=m(n,t.options);o.set(n,{referenceCount:0,snappingManager:a,remove:()=>{t.remove(),a.destroy()}})}const e=o.get(n);e.referenceCount++;const i=g(()=>y(n,e));return{snappingManager:e.snappingManager,...i}}function y(n,e){e.referenceCount--,e.referenceCount>0||v(()=>{e.referenceCount===0&&(e.remove(),o.delete(n))})}function m(n,e){return new f({view:n,options:e,snappingEnginesFactory:(i,t)=>[new d({view:n,spatialReference:n.spatialReference,options:t})]})}export{$ as a}; diff --git a/dist/assets/Segment-TQS1M_Ix.js b/dist/assets/Segment-TQS1M_Ix.js new file mode 100644 index 0000000..b6295ad --- /dev/null +++ b/dist/assets/Segment-TQS1M_Ix.js @@ -0,0 +1 @@ +import{e as _,y as p,c as K,g as Q,kv as Z,W as C,hK as v,hJ as Y,hI as I,lQ as $,hH as q,lR as E,lS as N,B as tt,bO as L,Z as et,a8 as u,lT as j,k5 as D,c3 as G,hO as W,b4 as w,bL as R,bI as st,ca as it,kq as M,bx as S,b3 as ot,ci as rt,cj as at,lU as ht,lV as nt}from"./index-pCX-0tJH.js";import{t as ct}from"./VisualElement--2Scr6Yq.js";import{t as k,x as lt}from"./TextOverlayItem-YHZxWGyg.js";let l=class extends Q{get startPosition(){return[this.startX,this.startY]}set startPosition(i){this._set("startX",i[0]),this._set("startY",i[1])}get endPosition(){return[this.endX,this.endY]}set endPosition(i){this._set("endX",i[0]),this._set("endY",i[1])}constructor(i){super(i),this.startX=0,this.startY=0,this.endX=0,this.endY=0,this.width=1,this.color=[0,0,0,.5],this.visible=!0,this.isDecoration=!0}get _strokeStyle(){const i=this.color;return`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${i[3]})`}get _lineCap(){return"round"}render(){const{height:i,left:t,top:e,width:s,x1:a,x2:r,y1:m,y2:c}=this._calculateCoordinates(z),n=`stroke: ${this._strokeStyle}; stroke-width: ${this.width}; stroke-linecap: ${this._lineCap};`;return k("div",{classes:{"esri-line-overlay-item":!0},styles:{left:t+"px",top:e+"px",width:s+"px",height:i+"px",visibility:this.visible?"visible":"hidden"}},[k("svg",{width:s,height:i},[k("line",{x1:a,y1:m,x2:r,y2:c,style:n})])])}renderCanvas(i){if(!this.visible)return;i.strokeStyle=this._strokeStyle,i.lineWidth=this.width,i.lineCap=this._lineCap;const t=this._calculateCoordinates(z);i.beginPath(),i.moveTo(t.left+t.x1,t.top+t.y1),i.lineTo(t.left+t.x2,t.top+t.y2),i.stroke()}_calculateCoordinates(i){const t=Math.min(this.startX,this.endX),e=Math.max(this.startX,this.endX),s=Math.min(this.startY,this.endY),a=Math.max(this.startY,this.endY),r=this.width;return i.left=t-r,i.top=s-r,i.width=e-t+2*r,i.height=Math.max(20,a-s+2*r),i.x1=this.startX-t+r,i.y1=this.startY-s+r,i.x2=this.endX-t+r,i.y2=this.endY-s+r,i}};_([p()],l.prototype,"startX",void 0),_([p()],l.prototype,"startY",void 0),_([p()],l.prototype,"endX",void 0),_([p()],l.prototype,"endY",void 0),_([p()],l.prototype,"startPosition",null),_([p()],l.prototype,"endPosition",null),_([p()],l.prototype,"width",void 0),_([p()],l.prototype,"color",void 0),_([p()],l.prototype,"visible",void 0),_([p()],l.prototype,"isDecoration",void 0),_([p({readOnly:!0})],l.prototype,"_strokeStyle",null),l=_([K("esri.views.overlay.LineOverlayItem")],l);const z={left:0,top:0,width:0,height:0,x1:0,y1:0,x2:0,y2:0},dt=l;class gt extends ct{constructor(t){super(t),this._handles=new Z,this._textItem=null,this._calloutItem=null,this._showCallout=!0,this._showText=!0,this._geometry=null,this._text="-",this._fontSize=14,this._backgroundColor=new C([0,0,0,.6]),this._calloutColor=new C([0,0,0,.5]),this._textColor=new C([255,255,255]),this._distance=25,this._anchor="right",this.updatePositionOnCameraMove=!0,this.applyProperties(t)}get geometry(){return this._geometry}set geometry(t){this._geometry=t,this.updateLabelPosition()}get isDecoration(){return this._isDecoration}set isDecoration(t){this._isDecoration=t,this._textItem&&(this._textItem.isDecoration=t),this._calloutItem&&(this._calloutItem.isDecoration=t)}get textItem(){return this._textItem}get text(){return this._text}set text(t){this._text=t,this.attached&&(this._textItem.text=this._text)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t,this.attached&&(this._textItem.fontSize=this._fontSize)}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t,this.attached&&(this._textItem.backgroundColor=this._backgroundColor)}get calloutColor(){return this._calloutColor}set calloutColor(t){this._calloutColor=t,this.attached&&(this._calloutItem.color=this._calloutColor.toRgba())}get textColor(){return this._textColor}set textColor(t){this._textColor=t,this.attached&&(this._textItem.textColor=this._textColor)}get distance(){return this._distance}set distance(t){this._distance!==t&&(this._distance=t,this.updateLabelPosition())}get anchor(){return this._anchor}set anchor(t){this._anchor!==t&&(this._anchor=t,this.updateLabelPosition())}get _camera(){return this.view.state.cssCamera}overlaps(t){var e;return!!this.attached&&this.textItem.visible&&t.textItem.visible&&!!((e=this.view.overlay)!=null&&e.overlaps(this._textItem,t.textItem))}updateLabelPosition(){if(!this.attached)return;this._showText=!1,this._showCallout=!1;const{geometry:t,view:e,visible:s}=this;if(t!=null&&e._stage)switch(t.type){case"point":if(!this._computeLabelPositionFromPoint(t.point,x))break;if(t.callout){const a=this._camera,r=t.callout.distance;v(h,h,[0,t.callout.offset]),a.renderToScreen(h,x),Y(o,0,1),I(o,o,r),v(o,o,h),a.renderToScreen(o,g),this._showCallout=this._updatePosition(x,g)}else this._textItem.position=[x[0],x[1]],this._textItem.anchor="center";this._showText=!0;break;case"corner":if(!this._computeLabelPositionFromCorner(t,this._distance,x,g))break;this._showCallout=this._updatePosition(x,g),this._showText=!0;break;case"segment":{if(!this._computeLabelPositionFromSegment(t,this._distance,this._anchor,x,g))break;this._showText=!0;const a=this._updatePosition(x,g);this._showCallout=t.callout!==!1&&a,this._showCallout||(this._textItem.anchor="center")}}this.updateVisibility(s)}_computeLabelPositionFromPoint(t,e){const s=this._camera;return s.projectToRenderScreen(t,h),!(h[2]<0||h[2]>1)&&(s.renderToScreen(h,e),!0)}_computeLabelPositionFromCorner(t,e,s,a){if(!t)return!1;const r=this._camera;return F(t.left,1,r,b),$(b,b),F(t.right,0,r,V),v(o,b,V),$(o,o),q(o,o),r.projectToRenderScreen(t.left.endRenderSpace,h),!(h[2]<0||h[2]>1)&&(r.renderToScreen(h,s),I(o,o,e),v(o,o,h),r.renderToScreen(o,a),!0)}_computeLabelPositionFromSegment(t,e,s,a,r){if(!t)return!1;const m=t.segment,c=this._camera;E(m.startRenderSpace,m.endRenderSpace,c,b),Y(o,-b[1],b[0]);let n=!1;switch(s){case"top":n=o[1]<0;break;case"bottom":n=o[1]>0;break;case"left":n=o[0]>0;break;case"right":n=o[0]<0}if(n&&$(o,o),N(o)===0)switch(s){case"top":o[1]=1;break;case"bottom":o[1]=-1;break;case"left":o[0]=-1;break;case"right":o[0]=1}return m.eval(ut[t.sampleLocation],U),c.projectToRenderScreen(U,h),!(h[2]<0||h[2]>1)&&(c.renderToScreen(h,a),I(o,o,e),v(o,o,h),c.renderToScreen(o,r),!0)}_updatePosition(t,e){if(e){const s=e[0]-t[0],a=e[1]-t[1];return this._textItem.position=[e[0],e[1]],this._textItem.anchor=Math.abs(s)>Math.abs(a)?s>0?"left":"right":a>0?"top":"bottom",this._calloutItem.startPosition=[t[0],t[1]],this._calloutItem.endPosition=[e[0],e[1]],!0}return this._textItem.position=[t[0],t[1]],this._textItem.anchor="center",!1}createResources(){var t;this._textItem=new lt({visible:!0,text:this._text,fontSize:this._fontSize,backgroundColor:this._backgroundColor,textColor:this._textColor,isDecoration:this._isDecoration}),this._calloutItem=new dt({color:this._calloutColor.toRgba(),visible:!0,width:2,isDecoration:this._isDecoration}),this.updateLabelPosition(),(t=this.view.overlay)==null||t.items.addMany([this._textItem,this._calloutItem]),this.updatePositionOnCameraMove&&this._handles.add(tt(()=>this.view.state.camera,()=>this.updateLabelPosition()))}destroyResources(){this.view.overlay&&!this.view.overlay.destroyed&&this.view.overlay.items.removeMany([this._textItem,this._calloutItem]),this._handles.removeAll()}updateVisibility(t){this._textItem.visible=this._showText&&t,this._calloutItem.visible=this._showCallout&&t}}function F(i,t,e,s){i.eval(t,P,A),L(O,P,A),e.projectToRenderScreen(P,B),e.projectToRenderScreen(O,H),et(s,pt,_t),q(s,s)}function yt(i){switch(i){case"top":return"bottom";case"right":return"left";case"bottom":return"top";case"left":return"right"}}const P=u(),O=u(),A=u(),b=j(),V=j(),o=j(),U=u(),h=D(),x=G(),g=G(),B=D(),_t=B,H=D(),pt=H,ut={start:0,center:.5,end:1};class J{constructor(t=u(),e=u()){this.startRenderSpace=t,this.endRenderSpace=e,this.type="euclidean"}eval(t,e,s){return W(e,this.startRenderSpace,this.endRenderSpace,t),s&&(w(s,this.endRenderSpace,this.startRenderSpace),R(s,s)),e}createRenderGeometry(t,e){const s=[],a=[],r=(c,n)=>{const d=T;w(d,c,t),s.push([d[0],d[1],d[2]]),a.push([n[0],n[1],n[2]])},m=e.worldUpAtPosition(this.eval(.5,y),st.get());return r(this.startRenderSpace,m),r(this.endRenderSpace,m),{points:s,normals:a}}static fromPositionAndVector(t,e,s=1){return it(y,e,s),L(y,t,y),new J(M(t),M(y))}}class vt{_projectIn(t,e){this._project?S(t,this.renderSpatialReference,e,this._pcpf):ot(e,t)}constructor(t,e,s){this.startRenderSpace=t,this.endRenderSpace=e,this.renderSpatialReference=s,this.type="geodesic",this._start=u(),this._end=u(),this._pcpf=rt(s),this._project=at(s,this._pcpf),this._projectIn(t,this._start),this._projectIn(e,this._end)}eval(t,e,s){if(this._project)if(s){const a=T;ht(this._start,this._end,t,e,a),L(f,e,a),S(e,this._pcpf,e,this.renderSpatialReference),S(f,this._pcpf,f,this.renderSpatialReference),w(s,f,e),R(s,s)}else nt(this._start,this._end,t,e),S(e,this._pcpf,e,this.renderSpatialReference);else W(e,this._start,this._end,t),s&&(w(s,this._end,this._start),R(s,s));return e}createRenderGeometry(t,e){const s=[],a=[],r=(c,n)=>{const d=f;w(d,c,t),s.push([d[0],d[1],d[2]]),a.push([n[0],n[1],n[2]])};for(let c=0;c<128;++c){const n=c/127,d=y,X=T;this.eval(n,d),e.worldUpAtPosition(d,X),r(d,X)}return{points:s,normals:a}}}const y=u(),T=u(),f=u();export{yt as C,vt as _,gt as g,J as m}; diff --git a/dist/assets/Segment-hN2uWAPW.js b/dist/assets/Segment-hN2uWAPW.js deleted file mode 100644 index e231b4e..0000000 --- a/dist/assets/Segment-hN2uWAPW.js +++ /dev/null @@ -1 +0,0 @@ -import{e as _,y as p,c as W,p as B,kn as H,ab as C,hM as v,hL as X,hK as I,lI as $,hJ as G,lJ as Q,lK as Z,d as tt,at as L,a0 as et,aa as u,lL as j,j_ as D,aR as J,hP as K,aU as w,aF as R,br as st,au as it,ki as Y,bn as S,aE as ot,cs as rt,ct as at,lM as ht,lN as nt}from"./index-J0iiHjMT.js";import{t as lt}from"./VisualElement-kjYXz27t.js";import{t as P,x as ct}from"./TextOverlayItem-eCjvS6IO.js";let c=class extends B{get startPosition(){return[this.startX,this.startY]}set startPosition(i){this._set("startX",i[0]),this._set("startY",i[1])}get endPosition(){return[this.endX,this.endY]}set endPosition(i){this._set("endX",i[0]),this._set("endY",i[1])}constructor(i){super(i),this.startX=0,this.startY=0,this.endX=0,this.endY=0,this.width=1,this.color=[0,0,0,.5],this.visible=!0,this.isDecoration=!0}get _strokeStyle(){const i=this.color;return`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${i[3]})`}get _lineCap(){return"round"}render(){const{height:i,left:t,top:e,width:s,x1:a,x2:r,y1:m,y2:l}=this._calculateCoordinates(z),n=`stroke: ${this._strokeStyle}; stroke-width: ${this.width}; stroke-linecap: ${this._lineCap};`;return P("div",{classes:{"esri-line-overlay-item":!0},styles:{left:t+"px",top:e+"px",width:s+"px",height:i+"px",visibility:this.visible?"visible":"hidden"}},[P("svg",{width:s,height:i},[P("line",{x1:a,y1:m,x2:r,y2:l,style:n})])])}renderCanvas(i){if(!this.visible)return;i.strokeStyle=this._strokeStyle,i.lineWidth=this.width,i.lineCap=this._lineCap;const t=this._calculateCoordinates(z);i.beginPath(),i.moveTo(t.left+t.x1,t.top+t.y1),i.lineTo(t.left+t.x2,t.top+t.y2),i.stroke()}_calculateCoordinates(i){const t=Math.min(this.startX,this.endX),e=Math.max(this.startX,this.endX),s=Math.min(this.startY,this.endY),a=Math.max(this.startY,this.endY),r=this.width;return i.left=t-r,i.top=s-r,i.width=e-t+2*r,i.height=Math.max(20,a-s+2*r),i.x1=this.startX-t+r,i.y1=this.startY-s+r,i.x2=this.endX-t+r,i.y2=this.endY-s+r,i}};_([p()],c.prototype,"startX",void 0),_([p()],c.prototype,"startY",void 0),_([p()],c.prototype,"endX",void 0),_([p()],c.prototype,"endY",void 0),_([p()],c.prototype,"startPosition",null),_([p()],c.prototype,"endPosition",null),_([p()],c.prototype,"width",void 0),_([p()],c.prototype,"color",void 0),_([p()],c.prototype,"visible",void 0),_([p()],c.prototype,"isDecoration",void 0),_([p({readOnly:!0})],c.prototype,"_strokeStyle",null),c=_([W("esri.views.overlay.LineOverlayItem")],c);const z={left:0,top:0,width:0,height:0,x1:0,y1:0,x2:0,y2:0},dt=c;class gt extends lt{constructor(t){super(t),this._handles=new H,this._textItem=null,this._calloutItem=null,this._showCallout=!0,this._showText=!0,this._geometry=null,this._text="-",this._fontSize=14,this._backgroundColor=new C([0,0,0,.6]),this._calloutColor=new C([0,0,0,.5]),this._textColor=new C([255,255,255]),this._distance=25,this._anchor="right",this.updatePositionOnCameraMove=!0,this.applyProperties(t)}get geometry(){return this._geometry}set geometry(t){this._geometry=t,this.updateLabelPosition()}get isDecoration(){return this._isDecoration}set isDecoration(t){this._isDecoration=t,this._textItem&&(this._textItem.isDecoration=t),this._calloutItem&&(this._calloutItem.isDecoration=t)}get textItem(){return this._textItem}get text(){return this._text}set text(t){this._text=t,this.attached&&(this._textItem.text=this._text)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t,this.attached&&(this._textItem.fontSize=this._fontSize)}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t,this.attached&&(this._textItem.backgroundColor=this._backgroundColor)}get calloutColor(){return this._calloutColor}set calloutColor(t){this._calloutColor=t,this.attached&&(this._calloutItem.color=this._calloutColor.toRgba())}get textColor(){return this._textColor}set textColor(t){this._textColor=t,this.attached&&(this._textItem.textColor=this._textColor)}get distance(){return this._distance}set distance(t){this._distance!==t&&(this._distance=t,this.updateLabelPosition())}get anchor(){return this._anchor}set anchor(t){this._anchor!==t&&(this._anchor=t,this.updateLabelPosition())}get _camera(){return this.view.state.cssCamera}overlaps(t){var e;return!!this.attached&&this.textItem.visible&&t.textItem.visible&&!!((e=this.view.overlay)!=null&&e.overlaps(this._textItem,t.textItem))}updateLabelPosition(){if(!this.attached)return;this._showText=!1,this._showCallout=!1;const{geometry:t,view:e,visible:s}=this;if(t!=null&&e._stage)switch(t.type){case"point":if(!this._computeLabelPositionFromPoint(t.point,x))break;if(t.callout){const a=this._camera,r=t.callout.distance;v(h,h,[0,t.callout.offset]),a.renderToScreen(h,x),X(o,0,1),I(o,o,r),v(o,o,h),a.renderToScreen(o,g),this._showCallout=this._updatePosition(x,g)}else this._textItem.position=[x[0],x[1]],this._textItem.anchor="center";this._showText=!0;break;case"corner":if(!this._computeLabelPositionFromCorner(t,this._distance,x,g))break;this._showCallout=this._updatePosition(x,g),this._showText=!0;break;case"segment":{if(!this._computeLabelPositionFromSegment(t,this._distance,this._anchor,x,g))break;this._showText=!0;const a=this._updatePosition(x,g);this._showCallout=t.callout!==!1&&a,this._showCallout||(this._textItem.anchor="center")}}this.updateVisibility(s)}_computeLabelPositionFromPoint(t,e){const s=this._camera;return s.projectToRenderScreen(t,h),!(h[2]<0||h[2]>1)&&(s.renderToScreen(h,e),!0)}_computeLabelPositionFromCorner(t,e,s,a){if(!t)return!1;const r=this._camera;return F(t.left,1,r,b),$(b,b),F(t.right,0,r,U),v(o,b,U),$(o,o),G(o,o),r.projectToRenderScreen(t.left.endRenderSpace,h),!(h[2]<0||h[2]>1)&&(r.renderToScreen(h,s),I(o,o,e),v(o,o,h),r.renderToScreen(o,a),!0)}_computeLabelPositionFromSegment(t,e,s,a,r){if(!t)return!1;const m=t.segment,l=this._camera;Q(m.startRenderSpace,m.endRenderSpace,l,b),X(o,-b[1],b[0]);let n=!1;switch(s){case"top":n=o[1]<0;break;case"bottom":n=o[1]>0;break;case"left":n=o[0]>0;break;case"right":n=o[0]<0}if(n&&$(o,o),Z(o)===0)switch(s){case"top":o[1]=1;break;case"bottom":o[1]=-1;break;case"left":o[0]=-1;break;case"right":o[0]=1}return m.eval(ut[t.sampleLocation],V),l.projectToRenderScreen(V,h),!(h[2]<0||h[2]>1)&&(l.renderToScreen(h,a),I(o,o,e),v(o,o,h),l.renderToScreen(o,r),!0)}_updatePosition(t,e){if(e){const s=e[0]-t[0],a=e[1]-t[1];return this._textItem.position=[e[0],e[1]],this._textItem.anchor=Math.abs(s)>Math.abs(a)?s>0?"left":"right":a>0?"top":"bottom",this._calloutItem.startPosition=[t[0],t[1]],this._calloutItem.endPosition=[e[0],e[1]],!0}return this._textItem.position=[t[0],t[1]],this._textItem.anchor="center",!1}createResources(){var t;this._textItem=new ct({visible:!0,text:this._text,fontSize:this._fontSize,backgroundColor:this._backgroundColor,textColor:this._textColor,isDecoration:this._isDecoration}),this._calloutItem=new dt({color:this._calloutColor.toRgba(),visible:!0,width:2,isDecoration:this._isDecoration}),this.updateLabelPosition(),(t=this.view.overlay)==null||t.items.addMany([this._textItem,this._calloutItem]),this.updatePositionOnCameraMove&&this._handles.add(tt(()=>this.view.state.camera,()=>this.updateLabelPosition()))}destroyResources(){this.view.overlay&&!this.view.overlay.destroyed&&this.view.overlay.items.removeMany([this._textItem,this._calloutItem]),this._handles.removeAll()}updateVisibility(t){this._textItem.visible=this._showText&&t,this._calloutItem.visible=this._showCallout&&t}}function F(i,t,e,s){i.eval(t,k,O),L(A,k,O),e.projectToRenderScreen(k,q),e.projectToRenderScreen(A,E),et(s,pt,_t),G(s,s)}function yt(i){switch(i){case"top":return"bottom";case"right":return"left";case"bottom":return"top";case"left":return"right"}}const k=u(),A=u(),O=u(),b=j(),U=j(),o=j(),V=u(),h=D(),x=J(),g=J(),q=D(),_t=q,E=D(),pt=E,ut={start:0,center:.5,end:1};class N{constructor(t=u(),e=u()){this.startRenderSpace=t,this.endRenderSpace=e,this.type="euclidean"}eval(t,e,s){return K(e,this.startRenderSpace,this.endRenderSpace,t),s&&(w(s,this.endRenderSpace,this.startRenderSpace),R(s,s)),e}createRenderGeometry(t,e){const s=[],a=[],r=(l,n)=>{const d=T;w(d,l,t),s.push([d[0],d[1],d[2]]),a.push([n[0],n[1],n[2]])},m=e.worldUpAtPosition(this.eval(.5,y),st.get());return r(this.startRenderSpace,m),r(this.endRenderSpace,m),{points:s,normals:a}}static fromPositionAndVector(t,e,s=1){return it(y,e,s),L(y,t,y),new N(Y(t),Y(y))}}class vt{_projectIn(t,e){this._project?S(t,this.renderSpatialReference,e,this._pcpf):ot(e,t)}constructor(t,e,s){this.startRenderSpace=t,this.endRenderSpace=e,this.renderSpatialReference=s,this.type="geodesic",this._start=u(),this._end=u(),this._pcpf=rt(s),this._project=at(s,this._pcpf),this._projectIn(t,this._start),this._projectIn(e,this._end)}eval(t,e,s){if(this._project)if(s){const a=T;ht(this._start,this._end,t,e,a),L(f,e,a),S(e,this._pcpf,e,this.renderSpatialReference),S(f,this._pcpf,f,this.renderSpatialReference),w(s,f,e),R(s,s)}else nt(this._start,this._end,t,e),S(e,this._pcpf,e,this.renderSpatialReference);else K(e,this._start,this._end,t),s&&(w(s,this._end,this._start),R(s,s));return e}createRenderGeometry(t,e){const s=[],a=[],r=(l,n)=>{const d=f;w(d,l,t),s.push([d[0],d[1],d[2]]),a.push([n[0],n[1],n[2]])};for(let l=0;l<128;++l){const n=l/127,d=y,M=T;this.eval(n,d),e.worldUpAtPosition(d,M),r(d,M)}return{points:s,normals:a}}}const y=u(),T=u(),f=u();export{yt as C,vt as _,gt as g,N as m}; diff --git a/dist/assets/ShadedColorMaterial.glsl-Fp4o6LjC.js b/dist/assets/ShadedColorMaterial.glsl-L0JVQzbX.js similarity index 69% rename from dist/assets/ShadedColorMaterial.glsl-Fp4o6LjC.js rename to dist/assets/ShadedColorMaterial.glsl-L0JVQzbX.js index 8ee7ea4..c66fcf4 100644 --- a/dist/assets/ShadedColorMaterial.glsl-Fp4o6LjC.js +++ b/dist/assets/ShadedColorMaterial.glsl-L0JVQzbX.js @@ -1,34 +1,34 @@ -import{b0 as Re,aI as xe,aT as je,T as C,xp as Pe,bA as I,aa as $,q8 as D,K as De,aR as ye,j_ as Fe,a2 as ze,bC as Ce,an as Y,kT as Me,at as M,aJ as Ie,k4 as Ne,aM as V,qk as Z,i$ as ee,aV as te,aN as ie,h9 as A,xq as ke,b9 as se,br as y,au as H,xr as ne,aE as ae,bv as We,av as Be,xs as Ve,hu as Ue,bD as Ge,G as qe,ct as He,n as Qe,aS as Je,q6 as Ke,i5 as U,rm as T,bE as Xe,as as Q,aU as $e,xt as Ye,o7 as re,mJ as Ze,xu as et,xv as tt,pl as oe,ro as it,fB as st,xw as nt,xx as ce,xy as v,xz as at,xA as g,xB as rt,xC as ot,xD as ct,xE as lt,xF as le,bf as h,xG as ht,xH as dt,xI as ut,xJ as _t,xK as P,ou as gt,e as m,xL as S,i2 as R,xM as pt,de as ft,xN as vt,xO as bt,xP as mt,xQ as St,xR as yt,xS as $t,xT as wt,lZ as G,xU as Ot,xV as Tt,xW as Et,xX as Lt,xY as At,xZ as he,lX as x,x_ as Rt,x$ as xt,bi as de,aF as J,y0 as jt,y1 as Pt,y2 as Dt,nc as Ft,y3 as zt,s1 as Ct,y4 as Mt,nm as we,bu as Oe,b2 as Te,sc as It,nR as Nt,o4 as kt,aG as Ee,y5 as Wt}from"./index-J0iiHjMT.js";class ri{constructor(e){var i;this.metadata=void 0,this._camera=new Pe,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=I(),this._worldFrame=null,this._renderLocation=$(),this._renderLocationDirty=!0,this._location=new C({x:0,y:0,z:0}),this._elevationAlignedLocation=new C,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=D.None,this._focused=!1,this.events=new De.EventEmitter,this._screenLocation={screenPointArray:ye(),renderScreenPointArray:Fe(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=e.view.spatialReference,Object.assign(this,e);const t=(i=this.view.state)==null?void 0:i.camera;t&&this._camera.copyFrom(t)}destroy(){this._applyObjectTransform=qt,this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this._camera=null}get _stage(){var e;return(e=this.view)==null?void 0:e._stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,this._noDisplayCount===1&&this._updateEngineObject(),ze(()=>{this._noDisplayCount--,this._noDisplayCount===0&&this._updateEngineObject()})}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){ue(e)&&(this._screenLocationDirty=!0),Ce(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=I()),Bt(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){Y(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){Y(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=this._elevation.override!=null?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=Me(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:e===!0?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this._camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if(ue(this._modelTransform)){const t=this._calculateModelTransformOffset(Gt);e=M(t,t,this.renderLocation)}else e=this.renderLocation;this._camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this._camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(e,t){if(!this.available)return null;const i=Ie(e,Vt),n=this._getCollisionRadius(t),a=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(Ue(this.screenLocation.screenPointArray,i)0;for(const{stateMask:r,objects:o}of i){if(a){for(const c of o)c.visible=!1;continue}const p=(r&T.All)!==T.None,l=(r&D.All)!==D.None,d=!p||(n&r)==(r&T.All),u=!l||(this.state&r)==(r&D.All);if(d&&u)for(const c of o)c.visible=!0,c.transformation=t;else for(const c of o)c.visible=!1}}_ensureEngineResources(){if(this._engineResources==null){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach(({geometry:{material:r}})=>{i.has(r)||(t.push(r),i.add(r))});const n=new Map;this._renderObjects.forEach(r=>{const o=new Xe({castShadow:!1,geometries:[r.geometry]}),p=n.get(r.stateMask)||[];p.push(o),n.set(r.stateMask,p)});const a=[];n.forEach((r,o)=>a.push({stateMask:o,objects:r})),this._engineResources={objectsByState:a,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||this._engineResources==null||!e)return;const{objectsByState:t,layer:i,materials:n}=this._engineResources;n.forEach(a=>{const r=this._materialIdReferences,o=r.get(a.id)||0;o===0&&e.add(a),r.set(a.id,o+1)}),t.forEach(({objects:a})=>{i.addMany(a),e.addMany(a)}),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||this._engineResources==null||!e)return;const{objectsByState:t,layer:i,materials:n}=this._engineResources;t.forEach(({objects:a})=>{i.removeMany(a),e.removeMany(a)}),n.forEach(a=>{const r=this._materialIdReferences,o=r.get(a.id);o===1?(e.remove(a),r.delete(a.id)):r.set(a.id,o-1)}),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*(e==="touch"?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,Ut);return Q(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return $e(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return Ye(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&re(t,t,this._worldFrame),re(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,this._applyObjectTransform!=null&&this._applyObjectTransform(t),t}get test(){let e=!1;if(this._engineResources!=null)for(const t of this._engineResources.objectsByState){for(const i of t.objects)if(i.visible){e=!0;break}if(e)break}return{areAnyResourcesVisible:e}}}function ue(s){return s[12]!==0||s[13]!==0||s[14]!==0}function Bt(s,e,t){switch(s.viewingMode){case"local":return it(t),!0;case"global":{const i=Ze(s.renderCoordsHelper.spatialReference);return et(e,0,j,0,i.radius),tt(oe(j[0]),oe(j[1]),t),!0}}}const Vt=ye(),_e=Re(),q=xe(),ge=st(),Ut=I(),F=I(),z=je(),j=$(),pe=$(),fe=$(),ve=$(),be=$(),Gt=$(),me=new C({x:0,y:0,z:0,spatialReference:null}),qt=()=>{};class oi{constructor(e,t=T.None){this.geometry=e,this.stateMask=t}}function Ht(s,e){if(!e.screenSizeEnabled)return;const t=s.vertex;nt(t,e),t.uniforms.add(new ce("perScreenPixelRatio",(i,n)=>n.camera.perScreenPixelRatio),new ce("screenSizeScale",i=>i.screenSizeScale)),t.code.add(v`float computeRenderPixelSizeAt( vec3 pWorld ){ +import{a$ as Re,b0 as je,c5 as Pe,L as C,xI as ze,bT as I,a8 as $,ql as D,z as De,c3 as Se,k5 as Fe,a0 as xe,bV as Ce,bp as K,l5 as Me,bO as M,bY as Ie,kb as Ne,b$ as V,qx as Z,j6 as ee,c7 as te,c0 as ie,hb as A,xJ as ke,bc as se,bI as S,ca as G,xK as ne,b3 as ae,bN as We,d3 as Be,xL as Ve,hC as Ue,bW as He,C as qe,cj as Ge,b as Qe,c4 as Ye,qj as Xe,i2 as U,rz as L,bX as Je,bz as Q,b4 as $e,xM as Ke,oj as re,mS as Ze,xN as et,xO as tt,py as oe,rB as it,fw as st,xP as nt,xQ as ce,xR as b,xS as at,xT as g,xU as rt,xV as ot,xW as ct,xX as lt,xY as le,bi as h,xZ as ht,x_ as dt,x$ as ut,y0 as _t,y1 as z,oH as gt,e as m,y2 as y,hY as R,y3 as pt,de as ft,y4 as bt,y5 as vt,y6 as mt,y7 as yt,y8 as St,y9 as $t,ya as wt,m5 as H,yb as Ot,yc as Lt,yd as Tt,ye as Et,yf as At,yg as he,m3 as j,yh as Rt,yi as jt,bA as de,bL as Y,yj as Pt,yk as zt,yl as Dt,nl as Ft,ym as xt,s0 as Ct,yn as Mt,nH as we,bM as Oe,b2 as Le,sb as It,o1 as Nt,og as kt,c6 as Te,yo as Wt}from"./index-pCX-0tJH.js";class ri{constructor(e){var i;this.metadata=void 0,this._camera=new ze,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=I(),this._worldFrame=null,this._renderLocation=$(),this._renderLocationDirty=!0,this._location=new C({x:0,y:0,z:0}),this._elevationAlignedLocation=new C,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=D.None,this._focused=!1,this.events=new De.EventEmitter,this._screenLocation={screenPointArray:Se(),renderScreenPointArray:Fe(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=e.view.spatialReference,Object.assign(this,e);const t=(i=this.view.state)==null?void 0:i.camera;t&&this._camera.copyFrom(t)}destroy(){this._applyObjectTransform=qt,this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this._camera=null}get _stage(){var e;return(e=this.view)==null?void 0:e._stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,this._noDisplayCount===1&&this._updateEngineObject(),xe(()=>{this._noDisplayCount--,this._noDisplayCount===0&&this._updateEngineObject()})}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){ue(e)&&(this._screenLocationDirty=!0),Ce(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=I()),Bt(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){K(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){K(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=this._elevation.override!=null?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=Me(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:e===!0?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this._camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if(ue(this._modelTransform)){const t=this._calculateModelTransformOffset(Ht);e=M(t,t,this.renderLocation)}else e=this.renderLocation;this._camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this._camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(e,t){if(!this.available)return null;const i=Ie(e,Vt),n=this._getCollisionRadius(t),a=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(Ue(this.screenLocation.screenPointArray,i)0;for(const{stateMask:r,objects:o}of i){if(a){for(const c of o)c.visible=!1;continue}const p=(r&L.All)!==L.None,l=(r&D.All)!==D.None,d=!p||(n&r)==(r&L.All),u=!l||(this.state&r)==(r&D.All);if(d&&u)for(const c of o)c.visible=!0,c.transformation=t;else for(const c of o)c.visible=!1}}_ensureEngineResources(){if(this._engineResources==null){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach(({geometry:{material:r}})=>{i.has(r)||(t.push(r),i.add(r))});const n=new Map;this._renderObjects.forEach(r=>{const o=new Je({castShadow:!1,geometries:[r.geometry]}),p=n.get(r.stateMask)||[];p.push(o),n.set(r.stateMask,p)});const a=[];n.forEach((r,o)=>a.push({stateMask:o,objects:r})),this._engineResources={objectsByState:a,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||this._engineResources==null||!e)return;const{objectsByState:t,layer:i,materials:n}=this._engineResources;n.forEach(a=>{const r=this._materialIdReferences,o=r.get(a.id)||0;o===0&&e.add(a),r.set(a.id,o+1)}),t.forEach(({objects:a})=>{i.addMany(a),e.addMany(a)}),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||this._engineResources==null||!e)return;const{objectsByState:t,layer:i,materials:n}=this._engineResources;t.forEach(({objects:a})=>{i.removeMany(a),e.removeMany(a)}),n.forEach(a=>{const r=this._materialIdReferences,o=r.get(a.id);o===1?(e.remove(a),r.delete(a.id)):r.set(a.id,o-1)}),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*(e==="touch"?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,Ut);return Q(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return $e(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return Ke(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&re(t,t,this._worldFrame),re(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,this._applyObjectTransform!=null&&this._applyObjectTransform(t),t}get test(){let e=!1;if(this._engineResources!=null)for(const t of this._engineResources.objectsByState){for(const i of t.objects)if(i.visible){e=!0;break}if(e)break}return{areAnyResourcesVisible:e}}}function ue(s){return s[12]!==0||s[13]!==0||s[14]!==0}function Bt(s,e,t){switch(s.viewingMode){case"local":return it(t),!0;case"global":{const i=Ze(s.renderCoordsHelper.spatialReference);return et(e,0,P,0,i.radius),tt(oe(P[0]),oe(P[1]),t),!0}}}const Vt=Se(),_e=Re(),q=je(),ge=st(),Ut=I(),F=I(),x=Pe(),P=$(),pe=$(),fe=$(),be=$(),ve=$(),Ht=$(),me=new C({x:0,y:0,z:0,spatialReference:null}),qt=()=>{};class oi{constructor(e,t=L.None){this.geometry=e,this.stateMask=t}}function Gt(s,e){if(!e.screenSizeEnabled)return;const t=s.vertex;nt(t,e),t.uniforms.add(new ce("perScreenPixelRatio",(i,n)=>n.camera.perScreenPixelRatio),new ce("screenSizeScale",i=>i.screenSizeScale)),t.code.add(b`float computeRenderPixelSizeAt( vec3 pWorld ){ vec3 viewForward = - vec3(view[0][2], view[1][2], view[2][2]); float viewDirectionDistance = abs(dot(viewForward, pWorld - cameraPosition)); return viewDirectionDistance * perScreenPixelRatio; } vec3 screenSizeScaling(vec3 position, vec3 anchor){ return position * screenSizeScale * computeRenderPixelSizeAt(anchor) + anchor; -}`)}function Le(s){const e=new at,t=s.multipassEnabled&&(s.output===g.Color||s.output===g.Alpha);e.include(rt,s),e.include(Ht,s),e.include(ot,s);const{vertex:i,fragment:n}=e;return n.include(ct),lt(i,s),n.uniforms.add(new le("uColor",a=>a.color)),e.attributes.add(h.POSITION,"vec3"),e.varyings.add("vWorldPosition","vec3"),t&&e.varyings.add("depth","float"),s.screenSizeEnabled&&e.attributes.add(h.OFFSET,"vec3"),s.shadingEnabled&&(ht(i),e.attributes.add(h.NORMAL,"vec3"),e.varyings.add("vViewNormal","vec3")),i.code.add(v` +}`)}function Ee(s){const e=new at,t=s.multipassEnabled&&(s.output===g.Color||s.output===g.Alpha);e.include(rt,s),e.include(Gt,s),e.include(ot,s);const{vertex:i,fragment:n}=e;return n.include(ct),lt(i,s),n.uniforms.add(new le("uColor",a=>a.color)),e.attributes.add(h.POSITION,"vec3"),e.varyings.add("vWorldPosition","vec3"),t&&e.varyings.add("depth","float"),s.screenSizeEnabled&&e.attributes.add(h.OFFSET,"vec3"),s.shadingEnabled&&(ht(i),e.attributes.add(h.NORMAL,"vec3"),e.varyings.add("vViewNormal","vec3")),i.code.add(b` void main(void) { vWorldPosition = ${s.screenSizeEnabled?"screenSizeScaling(offset, position)":"position"}; - `),s.shadingEnabled&&i.code.add(v`vec3 worldNormal = normal; -vViewNormal = (viewNormal * vec4(worldNormal, 1)).xyz;`),i.code.add(v` + `),s.shadingEnabled&&i.code.add(b`vec3 worldNormal = normal; +vViewNormal = (viewNormal * vec4(worldNormal, 1)).xyz;`),i.code.add(b` ${t?"depth = (view * vec4(vWorldPosition, 1.0)).z;":""} gl_Position = transformPosition(proj, view, vWorldPosition); } - `),t&&e.include(dt,s),n.code.add(v` + `),t&&e.include(dt,s),n.code.add(b` void main() { discardBySlice(vWorldPosition); ${t?"terrainDepthTest(depth);":""} - `),s.shadingEnabled?(n.uniforms.add(new ut("shadingDirection",a=>a.shadingDirection)),n.uniforms.add(new le("shadedColor",a=>Qt(a.shadingTint,a.color))),n.code.add(v`vec3 viewNormalNorm = normalize(vViewNormal); + `),s.shadingEnabled?(n.uniforms.add(new ut("shadingDirection",a=>a.shadingDirection)),n.uniforms.add(new le("shadedColor",a=>Qt(a.shadingTint,a.color))),n.code.add(b`vec3 viewNormalNorm = normalize(vViewNormal); float shadingFactor = 1.0 - clamp(-dot(viewNormalNorm, shadingDirection), 0.0, 1.0); -vec4 finalColor = mix(uColor, shadedColor, shadingFactor);`)):n.code.add(v`vec4 finalColor = uColor;`),n.code.add(v` - ${s.output===g.ObjectAndLayerIdColor?v`finalColor.a = 1.0;`:""} - if (finalColor.a < ${v.float(_t)}) { +vec4 finalColor = mix(uColor, shadedColor, shadingFactor);`)):n.code.add(b`vec4 finalColor = uColor;`),n.code.add(b` + ${s.output===g.ObjectAndLayerIdColor?b`finalColor.a = 1.0;`:""} + if (finalColor.a < ${b.float(_t)}) { discard; } - ${s.output===g.Alpha?v`fragColor = vec4(finalColor.a);`:""} + ${s.output===g.Alpha?b`fragColor = vec4(finalColor.a);`:""} - ${s.output===g.Color?v`fragColor = highlightSlice(finalColor, vWorldPosition); ${s.transparencyPassType===P.Color?"fragColor = premultiplyAlpha(fragColor);":""}`:""} + ${s.output===g.Color?b`fragColor = highlightSlice(finalColor, vWorldPosition); ${s.transparencyPassType===z.Color?"fragColor = premultiplyAlpha(fragColor);":""}`:""} } - `),e}function Qt(s,e){const t=1-s[3],i=s[3]+e[3]*t;return i===0?(E[3]=i,E):(E[0]=(s[0]*s[3]+e[0]*e[3]*t)/i,E[1]=(s[1]*s[3]+e[1]*e[3]*t)/i,E[2]=(s[2]*s[3]+e[2]*e[3]*t)/i,E[3]=e[3],E)}const E=gt(),Jt=Object.freeze(Object.defineProperty({__proto__:null,build:Le},Symbol.toStringTag,{value:"Module"}));class N extends bt{initializeProgram(e){return new mt(e.rctx,N.shader.get().build(this.configuration),Ae)}_setPipelineState(e){const t=this.configuration,i=e===P.NONE,n=e===P.FrontFace;return St({blending:t.output!==g.Color&&t.output!==g.Alpha||!t.transparent?null:i?yt:$t(e),culling:wt(t.cullFace),depthTest:{func:n?G.LESS:t.shadingEnabled?G.LEQUAL:G.LESS},depthWrite:i?t.writeDepth?Ot:null:Tt(e),colorWrite:Et,polygonOffset:i||n?null:Lt})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}}N.shader=new pt(Jt,()=>ft(()=>Promise.resolve().then(()=>ni),void 0));let b=class extends vt{constructor(){super(...arguments),this.output=g.Color,this.cullFace=R.None,this.transparencyPassType=P.NONE,this.hasSlicePlane=!1,this.transparent=!1,this.writeDepth=!0,this.screenSizeEnabled=!0,this.shadingEnabled=!0,this.multipassEnabled=!1,this.cullAboveGround=!1}};m([S({count:g.COUNT})],b.prototype,"output",void 0),m([S({count:R.COUNT})],b.prototype,"cullFace",void 0),m([S({count:P.COUNT})],b.prototype,"transparencyPassType",void 0),m([S()],b.prototype,"hasSlicePlane",void 0),m([S()],b.prototype,"transparent",void 0),m([S()],b.prototype,"writeDepth",void 0),m([S()],b.prototype,"screenSizeEnabled",void 0),m([S()],b.prototype,"shadingEnabled",void 0),m([S()],b.prototype,"multipassEnabled",void 0),m([S()],b.prototype,"cullAboveGround",void 0),m([S({constValue:!1})],b.prototype,"occlusionPass",void 0);const Ae=new Map([[h.POSITION,0],[h.NORMAL,1],[h.OFFSET,2]]);class Kt extends At{constructor(e){super(e,new Yt),this.supportsEdges=!0,this._configuration=new b,this._vertexAttributeLocations=Ae}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._isTransparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,t,i,n,a,r){if(this.parameters.screenSizeEnabled){const o=e.attributes.get(h.OFFSET);he(e,i,n,a,{applyToVertex:(l,d,u,c)=>{const f=Q(Se,o.data[3*c],o.data[3*c+1],o.data[3*c+2]),_=Q(ei,l,d,u);return H(f,f,this.parameters.screenSizeScale*i.camera.computeScreenPixelSizeAt(f)),M(_,_,f),[_[0],_[1],_[2]]},applyToAabb:l=>{const d=Ct(l,Se);return Mt(l,this.parameters.screenSizeScale*i.camera.computeScreenPixelSizeAt(d))}},r)}else he(e,i,n,a,void 0,r)}produces(e,t){if(t===g.Highlight)return e===x.OPAQUE_MATERIAL;if(t===g.Color||t===g.Alpha||t===g.ObjectAndLayerIdColor){let i=x.OPAQUE_MATERIAL;return this._isTransparent&&(i=this.parameters.writeDepth?x.TRANSPARENT_MATERIAL:x.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===i||e===x.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new Xt(e)}createBufferWriter(){return new Zt(this.parameters.screenSizeEnabled)}get _isTransparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}}let Xt=class extends Rt{beginSlot(e){return this.ensureTechnique(N,e)}},Yt=class extends xt{constructor(){super(...arguments),this.color=de(1,1,1,1),this.shadingTint=de(0,0,0,.25),this.shadingDirection=J($(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=R.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}},Zt=class{constructor(e){this.screenSizeEnabled=e;const t=jt().vec3f(h.POSITION).vec3f(h.NORMAL);this.screenSizeEnabled&&t.vec3f(h.OFFSET),this.vertexBufferLayout=t}elementCount(e){return e.attributes.get(h.POSITION).indices.length}write(e,t,i,n,a){if(Pt(i,this.vertexBufferLayout,e,t,n,a),this.screenSizeEnabled){if(!i.attributes.has(h.OFFSET))throw new Error(`${h.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const r=i.attributes.get(h.OFFSET);Dt(r.size===3);const o=n.getField(h.OFFSET,Ft);if(!o)throw new Error("unable to acquire view for "+h.OFFSET);zt(r,t,o,a)}}}};const Se=$(),ei=$();function ui(s,e=Te.OccludeAndTransparent,t=!0){const i=we(s),n=!(s[3]<1);return t?new Kt({color:i,writeDepth:n,cullFace:R.Back,renderOccluded:e,isDecoration:!0}):new Oe({color:i,writeDepth:n,cullFace:R.Back,renderOccluded:e,isDecoration:!0})}function _i(s,e=Te.OccludeAndTransparent){const t=we(s);return new Oe({color:t,writeDepth:!0,cullFace:R.Front,renderOccluded:e,isDecoration:!0})}const gi=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1}),pi=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function fi(s,e,t,i){const n=$e(y.get(),s,t),a=ti(n,Ee(y.get(),i,n),t,kt.get());Wt(a,a);const r=A(y.get(),e,a);return Math.atan2(r[1],r[0])}function ti(s,e,t,i){const n=J(y.get(),s),a=J(y.get(),e),r=Ee(y.get(),n,a);return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=0,i[4]=a[0],i[5]=a[1],i[6]=a[2],i[7]=0,i[8]=r[0],i[9]=r[1],i[10]=r[2],i[11]=0,i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=1,i}function ii(s,e){const t=s.getViewForGraphic(e);return t!=null&&"computeAttachmentOrigin"in t?t.computeAttachmentOrigin(e,s.spatialReference):null}function vi(s,e,t){const i=ii(s,t);i==null?si(e,t.geometry):e.elevationAlignedLocation=i}function si(s,e){if(e==null)return;const t=e.type==="mesh"?e.anchor:It(e);t!=null&&(s.location=Nt(t))}const ni=Object.freeze(Object.defineProperty({__proto__:null,build:Le},Symbol.toStringTag,{value:"Module"}));export{ri as $,pi as D,fi as F,ti as M,gi as O,_i as b,oi as e,Kt as j,ii as k,vi as v,ui as w}; + `),e}function Qt(s,e){const t=1-s[3],i=s[3]+e[3]*t;return i===0?(T[3]=i,T):(T[0]=(s[0]*s[3]+e[0]*e[3]*t)/i,T[1]=(s[1]*s[3]+e[1]*e[3]*t)/i,T[2]=(s[2]*s[3]+e[2]*e[3]*t)/i,T[3]=e[3],T)}const T=gt(),Yt=Object.freeze(Object.defineProperty({__proto__:null,build:Ee},Symbol.toStringTag,{value:"Module"}));class N extends vt{initializeProgram(e){return new mt(e.rctx,N.shader.get().build(this.configuration),Ae)}_setPipelineState(e){const t=this.configuration,i=e===z.NONE,n=e===z.FrontFace;return yt({blending:t.output!==g.Color&&t.output!==g.Alpha||!t.transparent?null:i?St:$t(e),culling:wt(t.cullFace),depthTest:{func:n?H.LESS:t.shadingEnabled?H.LEQUAL:H.LESS},depthWrite:i?t.writeDepth?Ot:null:Lt(e),colorWrite:Tt,polygonOffset:i||n?null:Et})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}}N.shader=new pt(Yt,()=>ft(()=>Promise.resolve().then(()=>ni),void 0));let v=class extends bt{constructor(){super(...arguments),this.output=g.Color,this.cullFace=R.None,this.transparencyPassType=z.NONE,this.hasSlicePlane=!1,this.transparent=!1,this.writeDepth=!0,this.screenSizeEnabled=!0,this.shadingEnabled=!0,this.multipassEnabled=!1,this.cullAboveGround=!1}};m([y({count:g.COUNT})],v.prototype,"output",void 0),m([y({count:R.COUNT})],v.prototype,"cullFace",void 0),m([y({count:z.COUNT})],v.prototype,"transparencyPassType",void 0),m([y()],v.prototype,"hasSlicePlane",void 0),m([y()],v.prototype,"transparent",void 0),m([y()],v.prototype,"writeDepth",void 0),m([y()],v.prototype,"screenSizeEnabled",void 0),m([y()],v.prototype,"shadingEnabled",void 0),m([y()],v.prototype,"multipassEnabled",void 0),m([y()],v.prototype,"cullAboveGround",void 0),m([y({constValue:!1})],v.prototype,"occlusionPass",void 0);const Ae=new Map([[h.POSITION,0],[h.NORMAL,1],[h.OFFSET,2]]);class Xt extends At{constructor(e){super(e,new Kt),this.supportsEdges=!0,this._configuration=new v,this._vertexAttributeLocations=Ae}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._isTransparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,t,i,n,a,r){if(this.parameters.screenSizeEnabled){const o=e.attributes.get(h.OFFSET);he(e,i,n,a,{applyToVertex:(l,d,u,c)=>{const f=Q(ye,o.data[3*c],o.data[3*c+1],o.data[3*c+2]),_=Q(ei,l,d,u);return G(f,f,this.parameters.screenSizeScale*i.camera.computeScreenPixelSizeAt(f)),M(_,_,f),[_[0],_[1],_[2]]},applyToAabb:l=>{const d=Ct(l,ye);return Mt(l,this.parameters.screenSizeScale*i.camera.computeScreenPixelSizeAt(d))}},r)}else he(e,i,n,a,void 0,r)}produces(e,t){if(t===g.Highlight)return e===j.OPAQUE_MATERIAL;if(t===g.Color||t===g.Alpha||t===g.ObjectAndLayerIdColor){let i=j.OPAQUE_MATERIAL;return this._isTransparent&&(i=this.parameters.writeDepth?j.TRANSPARENT_MATERIAL:j.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===i||e===j.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new Jt(e)}createBufferWriter(){return new Zt(this.parameters.screenSizeEnabled)}get _isTransparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}}let Jt=class extends Rt{beginSlot(e){return this.ensureTechnique(N,e)}},Kt=class extends jt{constructor(){super(...arguments),this.color=de(1,1,1,1),this.shadingTint=de(0,0,0,.25),this.shadingDirection=Y($(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=R.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}},Zt=class{constructor(e){this.screenSizeEnabled=e;const t=Pt().vec3f(h.POSITION).vec3f(h.NORMAL);this.screenSizeEnabled&&t.vec3f(h.OFFSET),this.vertexBufferLayout=t}elementCount(e){return e.attributes.get(h.POSITION).indices.length}write(e,t,i,n,a){if(zt(i,this.vertexBufferLayout,e,t,n,a),this.screenSizeEnabled){if(!i.attributes.has(h.OFFSET))throw new Error(`${h.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const r=i.attributes.get(h.OFFSET);Dt(r.size===3);const o=n.getField(h.OFFSET,Ft);if(!o)throw new Error("unable to acquire view for "+h.OFFSET);xt(r,t,o,a)}}}};const ye=$(),ei=$();function ui(s,e=Le.OccludeAndTransparent,t=!0){const i=we(s),n=!(s[3]<1);return t?new Xt({color:i,writeDepth:n,cullFace:R.Back,renderOccluded:e,isDecoration:!0}):new Oe({color:i,writeDepth:n,cullFace:R.Back,renderOccluded:e,isDecoration:!0})}function _i(s,e=Le.OccludeAndTransparent){const t=we(s);return new Oe({color:t,writeDepth:!0,cullFace:R.Front,renderOccluded:e,isDecoration:!0})}const gi=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1}),pi=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function fi(s,e,t,i){const n=$e(S.get(),s,t),a=ti(n,Te(S.get(),i,n),t,kt.get());Wt(a,a);const r=A(S.get(),e,a);return Math.atan2(r[1],r[0])}function ti(s,e,t,i){const n=Y(S.get(),s),a=Y(S.get(),e),r=Te(S.get(),n,a);return i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=0,i[4]=a[0],i[5]=a[1],i[6]=a[2],i[7]=0,i[8]=r[0],i[9]=r[1],i[10]=r[2],i[11]=0,i[12]=t[0],i[13]=t[1],i[14]=t[2],i[15]=1,i}function ii(s,e){const t=s.getViewForGraphic(e);return t!=null&&"computeAttachmentOrigin"in t?t.computeAttachmentOrigin(e,s.spatialReference):null}function bi(s,e,t){const i=ii(s,t);i==null?si(e,t.geometry):e.elevationAlignedLocation=i}function si(s,e){if(e==null)return;const t=e.type==="mesh"?e.anchor:It(e);t!=null&&(s.location=Nt(t))}const ni=Object.freeze(Object.defineProperty({__proto__:null,build:Ee},Symbol.toStringTag,{value:"Module"}));export{ri as $,pi as D,fi as F,ti as M,gi as O,_i as b,oi as e,Xt as j,ii as k,bi as v,ui as w}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] diff --git a/dist/assets/SliceAnalysisView3D--IcVdus9.js b/dist/assets/SliceAnalysisView3D--IcVdus9.js deleted file mode 100644 index e209d9c..0000000 --- a/dist/assets/SliceAnalysisView3D--IcVdus9.js +++ /dev/null @@ -1 +0,0 @@ -import{k4 as fe,Z as Ve,e as l,y as r,c as L,p as N,c7 as Z,d as v,nX as d,nY as ne,aI as be,nZ as Me,Y as De,aX as Ee,aY as Ce,C as Te,A as B,n as V,kS as M,n_ as p,n$ as D,ax as S,o0 as F,aQ as C,o1 as q,aE as Y,br as c,au as z,at as Q,o2 as W,aT as U,aN as H,cQ as Se,o3 as xe,o4 as T,h9 as X,ki as $e,aF as J,o5 as ke,ak as ee,aJ as He,aL as Le,as as le,o6 as re,o7 as oe,i6 as ze,o8 as he,aa as K,kZ as Oe}from"./index-J0iiHjMT.js";import{s as Ge}from"./AnalysisView3D-jkk3JIRT.js";import{C as Re}from"./BuildingComponentSublayer-j8wian8V.js";import{U as Ie,P as Ae,v as Be,j as ue,m as Fe,I as Ue,H as Ke,g as te,a as je,A as pe,E as ce,M as de,r as O,t as G,c as ie,C as ae,o as Ne,p as Ze,s as qe,_ as x,b as Ye,V as f,d as ye,l as Qe,e as We,f as Xe,h as Je,n as ve,i as we,k as et,q as tt,u as it,w as at,x as st}from"./SlicePlaneMaterial.glsl-RxywoUhm.js";import{t as nt}from"./LineVisualElement-4BP10o6v.js";import{l as lt,n as rt}from"./Factory-m-O4WAoG.js";import{F as ot}from"./ShadedColorMaterial.glsl-Fp4o6LjC.js";import{H as $}from"./dragEventPipeline3D-4CqrlxD2.js";import{a as ht}from"./AnalysisToolBase-3A13PdgS.js";import{d as k}from"./InteractiveToolBase-WDic4GPF.js";import{a as ut,v as pt}from"./analysisViewUtils-AQaQeJpR.js";import"./FeatureLayer--S4epFk-.js";import"./FeatureLayerBase-jpFp8gE3.js";import"./serviceCapabilitiesUtils-26KpT1VN.js";import"./editsZScale-Wgw9kbYG.js";import"./queryZScale-IaMm02_2.js";import"./FeatureSet-d4S1oKME.js";import"./CustomParametersMixin-Y1bOcayO.js";import"./FeatureEffectLayer-oBa8pIG5.js";import"./FeatureEffect-5bEV-xG1.js";import"./FeatureReductionLayer-RlitE1N6.js";import"./OrderedLayer-M7k5gLgx.js";import"./FeatureTemplate-kUgbbA00.js";import"./FeatureType-MpRe7WJj.js";import"./versionUtils-4v9zIDlv.js";import"./TopFeaturesQuery-E6D2tV-x.js";import"./ImageMaterial.glsl-TdPtjVc_.js";import"./Object3DVisualElement-TMb7y_wl.js";import"./VisualElement-kjYXz27t.js";import"./drawUtils-woTYaREB.js";function ct(e){switch(e.type){case"building-scene":case"csv":case"dimension":case"feature":case"geo-rss":case"geojson":case"graphics":case"group":case"integrated-mesh":case"kml":case"knowledge-graph":case"link-chart":case"knowledge-graph-sublayer":case"line-of-sight":case"map-notes":case"ogc-feature":case"oriented-imagery":case"point-cloud":case"route":case"scene":case"stream":case"voxel":case"subtype-group":case"unknown":case"unsupported":case"wfs":case null:return!1;case"base-dynamic":case"base-elevation":case"base-tile":case"bing-maps":case"elevation":case"imagery":case"imagery-tile":case"map-image":case"media":case"open-street-map":case"tile":case"vector-tile":case"video":case"wcs":case"web-tile":case"wms":case"wmts":return!0;default:return fe(e.type),!1}}const _e="esri.views.3d.analysis.Slice.SliceController",R=Ve.getLogger(_e);let P=class extends N{constructor(e){super(e),this._internalChange=!1,this._currentSlicePlane=null}initialize(){this.addHandles(this.analysis.excludedLayers.on("before-add",e=>{const t=e.item;t!=null&&(t instanceof Z||t instanceof Re)?t instanceof Z&&ct(t)?(R.error("excludedLayers",`Layer '${t.title}, id:${t.id}' of type '${t.type}' can not be individually excluded from slicing. Use 'excludeGroundSurface' instead.`),e.preventDefault()):this.analysis.excludedLayers.includes(t)&&e.preventDefault():(R.error("excludedLayers","Invalid layer type, layer must derive from Layer or BuildingComponentSublayer"),e.preventDefault())})),yt(this.view,this),this.addHandles([v(()=>this.analysisViewData.plane,()=>{this._internalChange||this._updateSlicePlaneFromBoundedPlane(),this._updateLayerViews()},{sync:!0}),v(()=>this.analysis.excludeGroundSurface,()=>this._updateLayerViews(),{sync:!0}),this.analysis.excludedLayers.on("change",()=>this._updateLayerViews()),v(()=>[this.analysisViewData.active,this.analysisViewData.visible],()=>{this._updateActiveController(),this._updateViewSlicePlane()},{sync:!0}),v(()=>this._allLayerAndSubLayerViews,()=>this._updateLayerViews())]),this.addHandles([v(()=>this.analysis.shape,()=>{this._internalChange||(this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane())},{sync:!0})],"analysis"),this._updateActiveController(),this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane()}destroy(){this.analysisViewData.active&&(this.analysisViewData.active=!1,this.view.slicePlane=null,this._updateActiveController(),this._updateViewSlicePlane()),vt(this.view,this),this.set("view",null)}get _allLayerAndSubLayerViews(){const e=this.view.allLayerViews.items;return e.concat(e.filter(Ie).flatMap(({sublayerViews:t})=>t.items))}_updateBoundedPlaneFromSlicePlane(){const e=this.analysis.shape,t=this._currentSlicePlane;if(t==null&&e==null||t!=null&&e!=null&&e.equals(t))return;let i=null,a=null;if((e==null?void 0:e.position)!=null){const s=e.position.spatialReference,n=Ae(e,this.view);n==null&&nt(this.analysis,s,R),i=Be(n,this.view,{tiltEnabled:this.analysis.tiltEnabled},d()),i!=null&&(a={heading:e.heading,tilt:e.tilt,position:e.position,width:e.width,height:e.height})}this._currentSlicePlane=a,this._internalChange=!0,this.analysisViewData.plane=i,this._internalChange=!1}_updateSlicePlaneFromBoundedPlane(){const e=this.analysisViewData.plane,t=ue(e,this.view,this.view.spatialReference,new ne);let i=null;t!=null&&(i={heading:t.heading,tilt:t.tilt,position:t.position,width:t.width,height:t.height}),this._currentSlicePlane=i,this._internalChange=!0,this.analysis.shape=t,this._internalChange=!1,this._updateViewSlicePlane()}_updateActiveController(){if(I)return;const e=Pe(this.view);if(e)if(this.analysisViewData.active)e.activeController!=null&&e.activeController!==this?(I=!0,e.activeController.analysisViewData.active=!1,I=!1):e.activeController!=null&&e.activeController,this._updateLayerViews(),e.activeController=this;else{if(e.activeController!=null&&e.activeController!==this)return;e.activeController!=null&&e.activeController===this&&(e.activeController=null,this._updateLayerViews())}}_updateViewSlicePlane(){dt(this.view)}_updateLayerViews(){const e=this.analysisViewData.plane!=null&&this.analysisViewData.visible&&this.analysisViewData.active,t=[],i=a=>{"layers"in a?a.layers.forEach(i):t.push(a)};this.analysis.excludedLayers.forEach(i),this.view.allLayerViews.forEach(a=>{a.destroyed||("slicePlaneEnabled"in a&&(a.slicePlaneEnabled=e&&!t.includes(a.layer)),"sublayerViews"in a&&a.sublayerViews.forEach(s=>{s.slicePlaneEnabled=e&&!t.includes(s.sublayer)}))}),this.view.basemapTerrain!=null&&(this.view.basemapTerrain.slicePlaneEnabled=e&&!this.analysis.excludeGroundSurface)}};l([r()],P.prototype,"view",void 0),l([r()],P.prototype,"analysis",void 0),l([r()],P.prototype,"analysisViewData",void 0),l([r()],P.prototype,"_allLayerAndSubLayerViews",null),P=l([L(_e)],P);const g=new Map;let I=!1;function dt(e){const t=Pe(e),i=t==null?void 0:t.activeController;(i==null?void 0:i.analysisViewData.plane)!=null&&i.analysisViewData.visible?e.slicePlane=i.analysisViewData.plane:e.slicePlane=null}function yt(e,t){var i;g.has(e)||g.set(e,{all:[],activeController:null}),(i=g.get(e))==null||i.all.push(t)}function Pe(e){return g.get(e)}function vt(e,t){if(!g.has(e))throw new Error("view expected in global slice register");const i=g.get(e),a=(i==null?void 0:i.all.lastIndexOf(t))??-1;if(!i||a===-1)throw new Error("controller expected in global slice register");i.all.splice(a,1),i.all.length===0&&g.delete(e)}var j;let u=j=class extends ht{constructor(e){super(e),this._clock=Me,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=Fe,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=d(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=De(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Ee(e.view.state.viewingMode),this._intersector.options.store=Ce.MIN}initialize(){var h;if(this.analysis==null)throw new Error("SliceTool requires valid analysis, but null was provided.");const e=o=>{this._updateManipulatorsInteractive(o),o.grabbing||(this.analysisViewData.plane!=null&&p(this.analysisViewData.plane,this._startPlane),this.inputState=null)},t=new Ue(this.view,Ke.CENTER_ON_ARROW);this.shiftManipulator=t,this.manipulators.add(t),this.addHandles([this._createShiftDragPipeline(t),t.events.on("grab-changed",o=>{this._onShiftGrab(o),e(t)})]);const i=!((h=this.view._stage)!=null&&h.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result),a=new te(this.view,(o,w)=>lt(this.view.textures,{accentColor:o,contrastColor:w,preMultiplyAlpha:i}));this.rotateHeadingManipulator=a,this.manipulators.add(a),this.addHandles([this._createRotateHeadingDragPipeline(a),a.events.on("grab-changed",o=>{this._onRotateHeadingGrab(o),e(a)})]);const s=new te(this.view,(o,w)=>rt(this.view.textures,{accentColor:o,contrastColor:w,preMultiplyAlpha:i}));this.rotateTiltManipulator=s,this.manipulators.add(s),this.addHandles([this._createRotateTiltDragPipeline(s),s.events.on("grab-changed",o=>{this._onRotateTiltGrab(o),e(s)})]),this.resizeManipulators=this._resizeHandles.map((o,w)=>{const m=new je(this.view,o);return this.addHandles([this._createResizeDragPipeline(m),m.events.on("grab-changed",b=>{this._onResizeGrab(b,w),e(m)})]),m}),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=pe(this.view),this._previewPlaneOutlineVisualElement=ce(this.view),this._previewPlaneOutlineVisualElement.width=de,this.addHandles(v(()=>[this.analysisViewData.plane,this.analysis.tiltEnabled],()=>this._updateManipulators(),Te));const n=v(()=>this.state,o=>{o==="sliced"&&this.finishToolCreation()},B);this.addHandles([n,v(()=>this.view.state.camera,()=>this._onCameraChange())])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=V(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=V(this._previewPlaneGridVisualElement)}get state(){const e=!!this.analysisViewData.plane,t=!!this.inputState;return e?e&&t?"slicing":e&&!t?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||this.layersMode==="exclude"?"crosshair":this._creatingPointerId!=null?"grabbing":null}set analysis(e){if(e==null)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",e)}get inputState(){return this._get("inputState")}set inputState(e){this._set("inputState",e),this.analysisViewData.showGrid=e!=null&&e.type==="resize",this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return this.inputState!=null&&this.inputState.type==="shift"?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){this.analysisViewData.plane!=null&&(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){this.analysisViewData.plane!=null&&(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(e){this._updateManipulators(),e||this._clearPointerMoveTimeout()}onInputEvent(e){switch(e.type){case"pointer-drag":if(!A(e))return;this._isPlacingSlicePlane?this._onClickPlacePlane(e)&&e.stopPropagation():this._onPointerDrag(e)&&e.stopPropagation();break;case"pointer-move":this._onPointerMove(e);break;case"pointer-up":this._onPointerUp(e)&&e.stopPropagation();break;case"immediate-click":if(!A(e))return;this._onClickPlacePlane(e)&&e.stopPropagation();break;case"click":if(!A(e))return;this._onClickExcludeLayer(e)&&e.stopPropagation();break;case"drag":this.inputState&&e.stopPropagation();break;case"key-down":this._onKeyDown(e)&&e.stopPropagation();break;case"key-up":this._onKeyUp(e)&&e.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(e){const t=this.inputState;if(e.pointerId===this._creatingPointerId&&t!=null&&t.type==="shift"){const i=M(e);return this.shiftManipulator.events.emit("drag",{action:t.hasBeenDragged?"update":"start",pointerType:e.pointerType,start:i,screenPoint:i}),t.hasBeenDragged=!0,!0}return!1}_onPointerMove(e){this._lastCursorPosition.x=e.x,this._lastCursorPosition.y=e.y,this._resetPointerMoveTimeout(),e.pointerType!=="touch"&&this._updatePreviewPlane(M(e),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(e){if(e.pointerId===this._creatingPointerId&&this.analysisViewData.plane!=null){const t=M(e);return this.shiftManipulator.events.emit("drag",{action:"end",start:t,screenPoint:t}),p(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(e){if(this.layersMode==="exclude")return!1;if(this._isPlacingSlicePlane){const t=M(e),i=d();if(this._pickPlane(t,!1,this._activeKeyModifiers,i)){if(e.type==="pointer-drag"){const a=D(this.view.state.camera,t,E);this.inputState=se(a,e.pointerId,i.origin,i)}return p(i,this._startPlane),this.analysis.shape=ue(i,this.view,this.view.spatialReference,new ne),!0}}return!1}_onClickExcludeLayer(e){return!(this.layersMode!=="exclude"||!this.created)&&(this.view.hitTest(M(e)).then(t=>{if(t.results.length){const i=t.results[0],a=(i==null?void 0:i.type)==="graphic"&&i.graphic;if(a){const s=a.sourceLayer||a.layer;s&&this.analysis.excludedLayers.push(s)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0}),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(e){return(e.key===O||e.key===G)&&(this._activeKeyModifiers[e.key]=!0,this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(e){return!(e.key!==O&&e.key!==G||!this._activeKeyModifiers[e.key])&&(delete this._activeKeyModifiers[e.key],this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(e){if(e.action!=="start"||this.analysisViewData.plane==null||!e.screenPoint)return;const t=D(this.view.state.camera,e.screenPoint,E);p(this.analysisViewData.plane,this._startPlane),this.inputState=se(t,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(e){return k(e,(t,i,a)=>{const s=this.inputState;if(s==null||s.type!=="shift")return;const n=this.analysisViewData.plane!=null?p(this.analysisViewData.plane,d()):null;i.next($(this.view,s.shiftPlane)).next(this._shiftDragAdjustSensitivity(s)).next(this._shiftDragUpdatePlane(s)),a.next(()=>{n!=null&&this._updateBoundedPlane(n)})})}_shiftDragAdjustSensitivity(e){return t=>{if(this.analysisViewData.plane==null)return null;const i=.001,a=Math.min((1-Math.abs(S(F(this.analysisViewData.plane),t.ray.direction)/C(t.ray.direction)))/i,1),s=-q(this._startPlane.plane,t.renderEnd),n=-q(this._startPlane.plane,e.startPoint);return e.depth=e.depth*(1-a)+s*a-n,t}}_shiftDragUpdatePlane(e){return()=>{if(this.analysisViewData.plane==null)return;const t=Y(c.get(),this._startPlane.origin),i=Y(c.get(),F(this._startPlane));z(i,i,-e.depth),Q(i,i,t);const a=W(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,d());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(e){if(e.action!=="start"||this.analysisViewData.plane==null||!e.screenPoint)return;const t=ie(this.analysisViewData.plane,this.view.renderCoordsHelper,ae.HEADING,U()),i=D(this.view.state.camera,e.screenPoint,E),a=K();H(t,i,a)&&(p(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:t,startPoint:a})}_createRotateHeadingDragPipeline(e){return k(e,(t,i,a)=>{const s=this.inputState;if(s==null||s.type!=="rotate")return;const n=this.analysisViewData.plane!=null?p(this.analysisViewData.plane,d()):null;i.next($(this.view,s.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(s)).next(this._rotateDragUpdatePlaneFromRotate()),a.next(()=>{n!=null&&this._updateBoundedPlane(n)})})}_onRotateTiltGrab(e){if(e.action!=="start"||this.analysisViewData.plane==null||!e.screenPoint)return;const t=ie(this.analysisViewData.plane,this.view.renderCoordsHelper,ae.TILT,U()),i=D(this.view.state.camera,e.screenPoint,E),a=K();H(t,i,a)&&(p(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:t,startPoint:a})}_createRotateTiltDragPipeline(e){return k(e,(t,i,a)=>{const s=this.inputState;if(s==null||s.type!=="rotate")return;const n=this.analysisViewData.plane!=null?p(this.analysisViewData.plane,d()):null;i.next($(this.view,s.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(s)).next(this._rotateDragUpdatePlaneFromRotate()),a.next(()=>{n!=null&&this._updateBoundedPlane(n)})})}_rotateDragRenderPlaneToRotate(e){return t=>{if(this.analysisViewData.plane==null)return null;const i=Se(e.rotatePlane),a=ot(e.startPoint,t.renderEnd,this.analysisViewData.plane.origin,i);return{...t,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return e=>{if(this.analysisViewData.plane==null)return;const t=xe(T.get(),e.rotateAngle,e.rotateAxis);if(t==null)return;const i=X(c.get(),this._startPlane.basis1,t),a=X(c.get(),this._startPlane.basis2,t),s=W(this.analysisViewData.plane.origin,i,a,d());this._updateBoundedPlane(s)}}_onResizeGrab(e,t){if(e.action!=="start"||this.analysisViewData.plane==null||!e.screenPoint)return;const i=D(this.view.state.camera,e.screenPoint,E),a=c.get();H(this.analysisViewData.plane.plane,i,a)&&(p(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:t,startPoint:$e(a)})}_createResizeDragPipeline(e){return k(e,(t,i,a)=>{const s=this.inputState;if(s==null||s.type!=="resize"||this.analysisViewData.plane==null)return;const n=p(this.analysisViewData.plane,d());i.next($(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(s)),a.next(()=>{this._updateBoundedPlane(n)})})}_resizeDragUpdatePlane(e){return t=>{if(this.analysisViewData.plane==null)return;const i=this._resizeHandles[e.activeHandleIdx],a=Ne(i,e.startPoint,t.renderEnd,this.view.state.camera,this._startPlane,p(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(e){const t=this.analysisViewData;if(t==null)throw new Error("valid internal object expected");t.plane=e}_updatePreviewPlane(e,t={}){let i=this._previewPlane;if(this._previewPlane=null,e==null)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=i??d();if(i=i!=null?p(i,wt):null,this._pickPlane(e,!0,t,a)){const s=tt;let n=!1;i!=null&&(n=S(i.plane,a.plane){this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+a/(1e3*Ze),1),this._updateManipulators(),this._previewPlaneOpacity===1&&this._removeFrameTask()}}):this._previewPlane==null&&this._frameTask!=null?this._removeFrameTask():this._previewPlane!=null&&this._updateManipulators()}_removeFrameTask(){this._frameTask=ee(this._frameTask)}_pickMinResult(e){const t=He(e,Le.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector),this._intersector.results.min}_pickPlane(e,t,i,a){const s=this._pickMinResult(e),n=c.get();if(!s.getIntersectionPoint(n))return!1;const h=s.getTransformedNormal(c.get()),o=this.view.state.camera;S(h,o.viewForward)>0&&z(h,h,-1);const w=qe(n,o),m=(t?1:-1)*w*it,b=z(c.get(),h,m);Q(b,b,n);const ge=this.analysis.tiltEnabled?x.TILTED:x.HORIZONTAL_OR_VERTICAL,me=i[O]?x.VERTICAL:i[G]?x.HORIZONTAL:ge;return Ye(b,h,w,w,o,me,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=ee(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=f,this.rotateHeadingManipulator.state|=f,this.rotateTiltManipulator.state|=f,this._prevPointerMoveTimeout=this._clock.setTimeout(()=>{this.shiftManipulator.state&=~f,this.rotateHeadingManipulator.state&=~f,this.rotateTiltManipulator.state&=~f},this._pointerMoveTimerMs)}_updateManipulators(){if(j.disableEngineLayers)return;let e,t=!1;if(this.analysisViewData.plane!=null)e=this.analysisViewData.plane,t=!1;else{if(this._previewPlane==null)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach(h=>h.available=!1),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);e=this._previewPlane,t=!0}const i=ye(e,T.get());t?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach(h=>h.available=!1),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach(h=>h.available=!0),Qe(this.shiftManipulator,i,e,this.view.state.camera),We(this.rotateHeadingManipulator,i,e,this.view.renderCoordsHelper),Xe(this.rotateTiltManipulator,i,e),this.resizeManipulators.forEach((h,o)=>Je(h,this._resizeHandles[o],i,e)),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=le(c.get(),C(e.basis1),C(e.basis2),1),s=re(T.get(),a),n=oe(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const e=ve(this.view.effectiveTheme);e[3]*=this._previewPlaneOpacity;const t=ze(we);t[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=e,this._previewPlaneGridVisualElement.backgroundColor=t,this._previewPlaneGridVisualElement.gridColor=he}_updateManipulatorsInteractive(e){if(!e.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach(t=>{t.interactive=!0});this.shiftManipulator.interactive=this.shiftManipulator===e,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===e,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===e,this.resizeManipulators.forEach(t=>{t.interactive=t===e})}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:e=>{this._pointerMoveTimerMs=e}}}};function se(e,t,i,a){const s=et(i,F(a),e.direction,U()),n=K();return H(s,e,n)?{type:"shift",creatingPointerId:t,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function A(e){return e.pointerType!=="mouse"||e.button===0}u.disableEngineLayers=!1,l([r()],u.prototype,"_clock",void 0),l([r({constructOnly:!0})],u.prototype,"view",void 0),l([r()],u.prototype,"analysisViewData",void 0),l([r({readOnly:!0})],u.prototype,"state",null),l([r({readOnly:!0})],u.prototype,"cursor",null),l([r()],u.prototype,"analysis",null),l([r()],u.prototype,"removeIncompleteOnCancel",void 0),l([r({readOnly:!0})],u.prototype,"layersMode",void 0),l([r({value:null})],u.prototype,"inputState",null),l([r()],u.prototype,"_isPlacingSlicePlane",null),l([r()],u.prototype,"_creatingPointerId",null),u=j=l([L("esri.views.3d.analysis.Slice.SliceTool")],u);const wt=d(),E=be(),_t=u;let _=class extends N{constructor(e){super(e),this._gridVisualElement=null,this._outlineVisualElement=null,this.showGrid=!1,this.preview=!0}initialize(){const e=this.analysisViewData;if(e==null)throw new Error("expected internal object to be valid");this._gridVisualElement=pe(this.view),this._outlineVisualElement=ce(this.view),this.addHandles([v(()=>{const t=e.plane!=null&&this.analysisViewData.visible,{active:i}=this.analysisViewData,{preview:a,showGrid:s,view:n}=this,{effectiveTheme:h}=n;return{visible:t,active:i,preview:a,showGrid:s,gridColor:at(h),outlineColor:ve(h)}},t=>this._updateMaterials(t),B),v(()=>e.plane,t=>this._updatePlane(t),B)],"internal")}destroy(){this._gridVisualElement=V(this._gridVisualElement),this._outlineVisualElement=V(this._outlineVisualElement),this.set("view",null)}_updatePlane(e){if(e==null)return;this._gridVisualElement.attached=!0,this._outlineVisualElement.attached=!0;const t=le(c.get(),C(e.basis1),C(e.basis2),1),i=re(T.get(),t),a=ye(e,T.get()),s=oe(i,a,i);this._outlineVisualElement.transform=s,this._gridVisualElement.transform=s}_updateMaterials({visible:e,active:t,preview:i,showGrid:a,gridColor:s,outlineColor:n}){this._outlineVisualElement.color=n,this._outlineVisualElement.width=i?de:st,this._outlineVisualElement.stipplePattern=t?null:Oe(5),this._gridVisualElement.backgroundColor=we,this._gridVisualElement.gridColor=a?s:he,this._gridVisualElement.visible=e,this._outlineVisualElement.visible=e}};l([r()],_.prototype,"view",void 0),l([r()],_.prototype,"analysis",void 0),l([r()],_.prototype,"analysisViewData",void 0),l([r()],_.prototype,"showGrid",void 0),l([r()],_.prototype,"preview",void 0),_=l([L("esri.views.3d.analysis.Slice.SliceVisualization")],_);let y=class extends Ge(N){constructor(e){super(e),this.type="slice-view-3d",this.analysis=null,this.tool=null,this.analysisVisualization=null,this.analysisController=null,this.plane=null,this.active=!0}initialize(){this.analysisVisualization=new _({view:this.view,analysis:this.analysis,analysisViewData:this}),this.analysisController=new P({view:this.view,analysis:this.analysis,analysisViewData:this}),this.addHandles(ut(this,_t))}destroy(){pt(this),this.analysisVisualization=V(this.analysisVisualization),this.analysisController=V(this.analysisController)}get showGrid(){var e;return((e=this.analysisVisualization)==null?void 0:e.showGrid)??!1}set showGrid(e){this.analysisVisualization&&(this.analysisVisualization.showGrid=e)}get editable(){return!this.analysisVisualization.preview}set editable(e){this.analysisVisualization.preview=!e}get testData(){return{visualization:this.analysisVisualization,controller:this.analysisController,tool:this.tool}}};l([r({readOnly:!0})],y.prototype,"type",void 0),l([r({constructOnly:!0,nonNullable:!0})],y.prototype,"analysis",void 0),l([r()],y.prototype,"tool",void 0),l([r()],y.prototype,"plane",void 0),l([r()],y.prototype,"active",void 0),l([r()],y.prototype,"showGrid",null),l([r()],y.prototype,"editable",null),y=l([L("esri.views.3d.analysis.SliceAnalysisView3D")],y);const qt=y;export{qt as default}; diff --git a/dist/assets/SliceAnalysisView3D--Kqu5Yhm.js b/dist/assets/SliceAnalysisView3D--Kqu5Yhm.js new file mode 100644 index 0000000..a6b10f9 --- /dev/null +++ b/dist/assets/SliceAnalysisView3D--Kqu5Yhm.js @@ -0,0 +1 @@ +import{kb as fe,R as Ve,e as l,y as r,c as L,g as N,aI as q,B as v,o7 as d,o8 as ne,b0 as be,o9 as Me,Q as De,cb as Ee,cc as Te,a9 as Ce,T as B,b as V,kH as M,oa as p,ob as D,c9 as S,oc as F,c2 as T,od as Z,b3 as W,bI as c,ca as z,bO as Q,oe as Y,c5 as U,c0 as H,cH as Se,of as xe,og as C,hb as J,kq as $e,bL as X,oh as ke,bq as ee,bY as He,b_ as Le,bz as le,oi as re,oj as oe,i3 as ze,ok as he,a8 as K,l1 as Oe}from"./index-pCX-0tJH.js";import{s as Ge}from"./AnalysisView3D-XCzG0Hzh.js";import{C as Re}from"./BuildingComponentSublayer-0DIX8n0s.js";import{U as Ie,P as Ae,v as Be,j as ue,m as Fe,I as Ue,H as Ke,g as te,a as je,A as pe,E as ce,M as de,r as O,t as G,c as ie,C as ae,o as Ne,p as qe,s as Ze,_ as x,b as We,V as f,d as ye,l as Qe,e as Ye,f as Je,h as Xe,n as ve,i as we,k as et,q as tt,u as it,w as at,x as st}from"./SlicePlaneMaterial.glsl-xVEc2mct.js";import{t as nt}from"./LineVisualElement-iKo1s90I.js";import{l as lt,n as rt}from"./Factory-EVPOwZPk.js";import{F as ot}from"./ShadedColorMaterial.glsl-L0JVQzbX.js";import{H as $}from"./dragEventPipeline3D-H_IlIVP7.js";import{a as ht}from"./AnalysisToolBase-olyQy6lh.js";import{d as k}from"./InteractiveToolBase-6mltmL27.js";import{a as ut,v as pt}from"./analysisViewUtils-lJExoyyw.js";import"./FeatureLayer-9tNCmEbA.js";import"./FeatureLayerBase-mvqC7cJs.js";import"./serviceCapabilitiesUtils-f-iBP4uh.js";import"./editsZScale-4-dTv58d.js";import"./CustomParametersMixin-7nmugR3Y.js";import"./FeatureEffectLayer-OK0TB5f6.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./FeatureReductionLayer-2X2_PJv9.js";import"./OrderedLayer-XNaJwl_G.js";import"./FeatureTemplate-vSzbyslg.js";import"./FeatureType-0WPvBvpQ.js";import"./versionUtils-idhrDltC.js";import"./ImageMaterial.glsl-PU0wbmEN.js";import"./Object3DVisualElement-8HoU366x.js";import"./VisualElement--2Scr6Yq.js";import"./drawUtils-0wb2c6-q.js";function ct(e){switch(e.type){case"building-scene":case"csv":case"dimension":case"feature":case"geo-rss":case"geojson":case"graphics":case"group":case"integrated-mesh":case"kml":case"knowledge-graph":case"link-chart":case"knowledge-graph-sublayer":case"line-of-sight":case"map-notes":case"ogc-feature":case"oriented-imagery":case"point-cloud":case"route":case"scene":case"stream":case"voxel":case"subtype-group":case"unknown":case"unsupported":case"wfs":case null:return!1;case"base-dynamic":case"base-elevation":case"base-tile":case"bing-maps":case"elevation":case"imagery":case"imagery-tile":case"map-image":case"media":case"open-street-map":case"tile":case"vector-tile":case"video":case"wcs":case"web-tile":case"wms":case"wmts":return!0;default:return fe(e.type),!1}}const _e="esri.views.3d.analysis.Slice.SliceController",R=Ve.getLogger(_e);let P=class extends N{constructor(e){super(e),this._internalChange=!1,this._currentSlicePlane=null}initialize(){this.addHandles(this.analysis.excludedLayers.on("before-add",e=>{const t=e.item;t!=null&&(t instanceof q||t instanceof Re)?t instanceof q&&ct(t)?(R.error("excludedLayers",`Layer '${t.title}, id:${t.id}' of type '${t.type}' can not be individually excluded from slicing. Use 'excludeGroundSurface' instead.`),e.preventDefault()):this.analysis.excludedLayers.includes(t)&&e.preventDefault():(R.error("excludedLayers","Invalid layer type, layer must derive from Layer or BuildingComponentSublayer"),e.preventDefault())})),yt(this.view,this),this.addHandles([v(()=>this.analysisViewData.plane,()=>{this._internalChange||this._updateSlicePlaneFromBoundedPlane(),this._updateLayerViews()},{sync:!0}),v(()=>this.analysis.excludeGroundSurface,()=>this._updateLayerViews(),{sync:!0}),this.analysis.excludedLayers.on("change",()=>this._updateLayerViews()),v(()=>[this.analysisViewData.active,this.analysisViewData.visible],()=>{this._updateActiveController(),this._updateViewSlicePlane()},{sync:!0}),v(()=>this._allLayerAndSubLayerViews,()=>this._updateLayerViews())]),this.addHandles([v(()=>this.analysis.shape,()=>{this._internalChange||(this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane())},{sync:!0})],"analysis"),this._updateActiveController(),this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane()}destroy(){this.analysisViewData.active&&(this.analysisViewData.active=!1,this.view.slicePlane=null,this._updateActiveController(),this._updateViewSlicePlane()),vt(this.view,this),this.set("view",null)}get _allLayerAndSubLayerViews(){const e=this.view.allLayerViews.items;return e.concat(e.filter(Ie).flatMap(({sublayerViews:t})=>t.items))}_updateBoundedPlaneFromSlicePlane(){const e=this.analysis.shape,t=this._currentSlicePlane;if(t==null&&e==null||t!=null&&e!=null&&e.equals(t))return;let i=null,a=null;if((e==null?void 0:e.position)!=null){const s=e.position.spatialReference,n=Ae(e,this.view);n==null&&nt(this.analysis,s,R),i=Be(n,this.view,{tiltEnabled:this.analysis.tiltEnabled},d()),i!=null&&(a={heading:e.heading,tilt:e.tilt,position:e.position,width:e.width,height:e.height})}this._currentSlicePlane=a,this._internalChange=!0,this.analysisViewData.plane=i,this._internalChange=!1}_updateSlicePlaneFromBoundedPlane(){const e=this.analysisViewData.plane,t=ue(e,this.view,this.view.spatialReference,new ne);let i=null;t!=null&&(i={heading:t.heading,tilt:t.tilt,position:t.position,width:t.width,height:t.height}),this._currentSlicePlane=i,this._internalChange=!0,this.analysis.shape=t,this._internalChange=!1,this._updateViewSlicePlane()}_updateActiveController(){if(I)return;const e=Pe(this.view);if(e)if(this.analysisViewData.active)e.activeController!=null&&e.activeController!==this?(I=!0,e.activeController.analysisViewData.active=!1,I=!1):e.activeController!=null&&e.activeController,this._updateLayerViews(),e.activeController=this;else{if(e.activeController!=null&&e.activeController!==this)return;e.activeController!=null&&e.activeController===this&&(e.activeController=null,this._updateLayerViews())}}_updateViewSlicePlane(){dt(this.view)}_updateLayerViews(){const e=this.analysisViewData.plane!=null&&this.analysisViewData.visible&&this.analysisViewData.active,t=[],i=a=>{"layers"in a?a.layers.forEach(i):t.push(a)};this.analysis.excludedLayers.forEach(i),this.view.allLayerViews.forEach(a=>{a.destroyed||("slicePlaneEnabled"in a&&(a.slicePlaneEnabled=e&&!t.includes(a.layer)),"sublayerViews"in a&&a.sublayerViews.forEach(s=>{s.slicePlaneEnabled=e&&!t.includes(s.sublayer)}))}),this.view.basemapTerrain!=null&&(this.view.basemapTerrain.slicePlaneEnabled=e&&!this.analysis.excludeGroundSurface)}};l([r()],P.prototype,"view",void 0),l([r()],P.prototype,"analysis",void 0),l([r()],P.prototype,"analysisViewData",void 0),l([r()],P.prototype,"_allLayerAndSubLayerViews",null),P=l([L(_e)],P);const g=new Map;let I=!1;function dt(e){const t=Pe(e),i=t==null?void 0:t.activeController;(i==null?void 0:i.analysisViewData.plane)!=null&&i.analysisViewData.visible?e.slicePlane=i.analysisViewData.plane:e.slicePlane=null}function yt(e,t){var i;g.has(e)||g.set(e,{all:[],activeController:null}),(i=g.get(e))==null||i.all.push(t)}function Pe(e){return g.get(e)}function vt(e,t){if(!g.has(e))throw new Error("view expected in global slice register");const i=g.get(e),a=(i==null?void 0:i.all.lastIndexOf(t))??-1;if(!i||a===-1)throw new Error("controller expected in global slice register");i.all.splice(a,1),i.all.length===0&&g.delete(e)}var j;let u=j=class extends ht{constructor(e){super(e),this._clock=Me,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=Fe,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=d(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=De(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=Ee(e.view.state.viewingMode),this._intersector.options.store=Te.MIN}initialize(){var h;if(this.analysis==null)throw new Error("SliceTool requires valid analysis, but null was provided.");const e=o=>{this._updateManipulatorsInteractive(o),o.grabbing||(this.analysisViewData.plane!=null&&p(this.analysisViewData.plane,this._startPlane),this.inputState=null)},t=new Ue(this.view,Ke.CENTER_ON_ARROW);this.shiftManipulator=t,this.manipulators.add(t),this.addHandles([this._createShiftDragPipeline(t),t.events.on("grab-changed",o=>{this._onShiftGrab(o),e(t)})]);const i=!((h=this.view._stage)!=null&&h.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result),a=new te(this.view,(o,w)=>lt(this.view.textures,{accentColor:o,contrastColor:w,preMultiplyAlpha:i}));this.rotateHeadingManipulator=a,this.manipulators.add(a),this.addHandles([this._createRotateHeadingDragPipeline(a),a.events.on("grab-changed",o=>{this._onRotateHeadingGrab(o),e(a)})]);const s=new te(this.view,(o,w)=>rt(this.view.textures,{accentColor:o,contrastColor:w,preMultiplyAlpha:i}));this.rotateTiltManipulator=s,this.manipulators.add(s),this.addHandles([this._createRotateTiltDragPipeline(s),s.events.on("grab-changed",o=>{this._onRotateTiltGrab(o),e(s)})]),this.resizeManipulators=this._resizeHandles.map((o,w)=>{const m=new je(this.view,o);return this.addHandles([this._createResizeDragPipeline(m),m.events.on("grab-changed",b=>{this._onResizeGrab(b,w),e(m)})]),m}),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=pe(this.view),this._previewPlaneOutlineVisualElement=ce(this.view),this._previewPlaneOutlineVisualElement.width=de,this.addHandles(v(()=>[this.analysisViewData.plane,this.analysis.tiltEnabled],()=>this._updateManipulators(),Ce));const n=v(()=>this.state,o=>{o==="sliced"&&this.finishToolCreation()},B);this.addHandles([n,v(()=>this.view.state.camera,()=>this._onCameraChange())])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=V(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=V(this._previewPlaneGridVisualElement)}get state(){const e=!!this.analysisViewData.plane,t=!!this.inputState;return e?e&&t?"slicing":e&&!t?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||this.layersMode==="exclude"?"crosshair":this._creatingPointerId!=null?"grabbing":null}set analysis(e){if(e==null)throw new Error("SliceTool requires valid analysis, but null was provided.");this.removeHandles("analysis"),this._set("analysis",e)}get inputState(){return this._get("inputState")}set inputState(e){this._set("inputState",e),this.analysisViewData.showGrid=e!=null&&e.type==="resize",this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return this.inputState!=null&&this.inputState.type==="shift"?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){this.analysisViewData.plane!=null&&(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){this.analysisViewData.plane!=null&&(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(e){this._updateManipulators(),e||this._clearPointerMoveTimeout()}onInputEvent(e){switch(e.type){case"pointer-drag":if(!A(e))return;this._isPlacingSlicePlane?this._onClickPlacePlane(e)&&e.stopPropagation():this._onPointerDrag(e)&&e.stopPropagation();break;case"pointer-move":this._onPointerMove(e);break;case"pointer-up":this._onPointerUp(e)&&e.stopPropagation();break;case"immediate-click":if(!A(e))return;this._onClickPlacePlane(e)&&e.stopPropagation();break;case"click":if(!A(e))return;this._onClickExcludeLayer(e)&&e.stopPropagation();break;case"drag":this.inputState&&e.stopPropagation();break;case"key-down":this._onKeyDown(e)&&e.stopPropagation();break;case"key-up":this._onKeyUp(e)&&e.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(e){const t=this.inputState;if(e.pointerId===this._creatingPointerId&&t!=null&&t.type==="shift"){const i=M(e);return this.shiftManipulator.events.emit("drag",{action:t.hasBeenDragged?"update":"start",pointerType:e.pointerType,start:i,screenPoint:i}),t.hasBeenDragged=!0,!0}return!1}_onPointerMove(e){this._lastCursorPosition.x=e.x,this._lastCursorPosition.y=e.y,this._resetPointerMoveTimeout(),e.pointerType!=="touch"&&this._updatePreviewPlane(M(e),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(e){if(e.pointerId===this._creatingPointerId&&this.analysisViewData.plane!=null){const t=M(e);return this.shiftManipulator.events.emit("drag",{action:"end",start:t,screenPoint:t}),p(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(e){if(this.layersMode==="exclude")return!1;if(this._isPlacingSlicePlane){const t=M(e),i=d();if(this._pickPlane(t,!1,this._activeKeyModifiers,i)){if(e.type==="pointer-drag"){const a=D(this.view.state.camera,t,E);this.inputState=se(a,e.pointerId,i.origin,i)}return p(i,this._startPlane),this.analysis.shape=ue(i,this.view,this.view.spatialReference,new ne),!0}}return!1}_onClickExcludeLayer(e){return!(this.layersMode!=="exclude"||!this.created)&&(this.view.hitTest(M(e)).then(t=>{if(t.results.length){const i=t.results[0],a=(i==null?void 0:i.type)==="graphic"&&i.graphic;if(a){const s=a.sourceLayer||a.layer;s&&this.analysis.excludedLayers.push(s)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0}),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(e){return(e.key===O||e.key===G)&&(this._activeKeyModifiers[e.key]=!0,this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(e){return!(e.key!==O&&e.key!==G||!this._activeKeyModifiers[e.key])&&(delete this._activeKeyModifiers[e.key],this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(e){if(e.action!=="start"||this.analysisViewData.plane==null||!e.screenPoint)return;const t=D(this.view.state.camera,e.screenPoint,E);p(this.analysisViewData.plane,this._startPlane),this.inputState=se(t,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(e){return k(e,(t,i,a)=>{const s=this.inputState;if(s==null||s.type!=="shift")return;const n=this.analysisViewData.plane!=null?p(this.analysisViewData.plane,d()):null;i.next($(this.view,s.shiftPlane)).next(this._shiftDragAdjustSensitivity(s)).next(this._shiftDragUpdatePlane(s)),a.next(()=>{n!=null&&this._updateBoundedPlane(n)})})}_shiftDragAdjustSensitivity(e){return t=>{if(this.analysisViewData.plane==null)return null;const i=.001,a=Math.min((1-Math.abs(S(F(this.analysisViewData.plane),t.ray.direction)/T(t.ray.direction)))/i,1),s=-Z(this._startPlane.plane,t.renderEnd),n=-Z(this._startPlane.plane,e.startPoint);return e.depth=e.depth*(1-a)+s*a-n,t}}_shiftDragUpdatePlane(e){return()=>{if(this.analysisViewData.plane==null)return;const t=W(c.get(),this._startPlane.origin),i=W(c.get(),F(this._startPlane));z(i,i,-e.depth),Q(i,i,t);const a=Y(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,d());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(e){if(e.action!=="start"||this.analysisViewData.plane==null||!e.screenPoint)return;const t=ie(this.analysisViewData.plane,this.view.renderCoordsHelper,ae.HEADING,U()),i=D(this.view.state.camera,e.screenPoint,E),a=K();H(t,i,a)&&(p(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:t,startPoint:a})}_createRotateHeadingDragPipeline(e){return k(e,(t,i,a)=>{const s=this.inputState;if(s==null||s.type!=="rotate")return;const n=this.analysisViewData.plane!=null?p(this.analysisViewData.plane,d()):null;i.next($(this.view,s.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(s)).next(this._rotateDragUpdatePlaneFromRotate()),a.next(()=>{n!=null&&this._updateBoundedPlane(n)})})}_onRotateTiltGrab(e){if(e.action!=="start"||this.analysisViewData.plane==null||!e.screenPoint)return;const t=ie(this.analysisViewData.plane,this.view.renderCoordsHelper,ae.TILT,U()),i=D(this.view.state.camera,e.screenPoint,E),a=K();H(t,i,a)&&(p(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:t,startPoint:a})}_createRotateTiltDragPipeline(e){return k(e,(t,i,a)=>{const s=this.inputState;if(s==null||s.type!=="rotate")return;const n=this.analysisViewData.plane!=null?p(this.analysisViewData.plane,d()):null;i.next($(this.view,s.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(s)).next(this._rotateDragUpdatePlaneFromRotate()),a.next(()=>{n!=null&&this._updateBoundedPlane(n)})})}_rotateDragRenderPlaneToRotate(e){return t=>{if(this.analysisViewData.plane==null)return null;const i=Se(e.rotatePlane),a=ot(e.startPoint,t.renderEnd,this.analysisViewData.plane.origin,i);return{...t,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return e=>{if(this.analysisViewData.plane==null)return;const t=xe(C.get(),e.rotateAngle,e.rotateAxis);if(t==null)return;const i=J(c.get(),this._startPlane.basis1,t),a=J(c.get(),this._startPlane.basis2,t),s=Y(this.analysisViewData.plane.origin,i,a,d());this._updateBoundedPlane(s)}}_onResizeGrab(e,t){if(e.action!=="start"||this.analysisViewData.plane==null||!e.screenPoint)return;const i=D(this.view.state.camera,e.screenPoint,E),a=c.get();H(this.analysisViewData.plane.plane,i,a)&&(p(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:t,startPoint:$e(a)})}_createResizeDragPipeline(e){return k(e,(t,i,a)=>{const s=this.inputState;if(s==null||s.type!=="resize"||this.analysisViewData.plane==null)return;const n=p(this.analysisViewData.plane,d());i.next($(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(s)),a.next(()=>{this._updateBoundedPlane(n)})})}_resizeDragUpdatePlane(e){return t=>{if(this.analysisViewData.plane==null)return;const i=this._resizeHandles[e.activeHandleIdx],a=Ne(i,e.startPoint,t.renderEnd,this.view.state.camera,this._startPlane,p(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(e){const t=this.analysisViewData;if(t==null)throw new Error("valid internal object expected");t.plane=e}_updatePreviewPlane(e,t={}){let i=this._previewPlane;if(this._previewPlane=null,e==null)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=i??d();if(i=i!=null?p(i,wt):null,this._pickPlane(e,!0,t,a)){const s=tt;let n=!1;i!=null&&(n=S(i.plane,a.plane){this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+a/(1e3*qe),1),this._updateManipulators(),this._previewPlaneOpacity===1&&this._removeFrameTask()}}):this._previewPlane==null&&this._frameTask!=null?this._removeFrameTask():this._previewPlane!=null&&this._updateManipulators()}_removeFrameTask(){this._frameTask=ee(this._frameTask)}_pickMinResult(e){const t=He(e,Le.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector),this._intersector.results.min}_pickPlane(e,t,i,a){const s=this._pickMinResult(e),n=c.get();if(!s.getIntersectionPoint(n))return!1;const h=s.getTransformedNormal(c.get()),o=this.view.state.camera;S(h,o.viewForward)>0&&z(h,h,-1);const w=Ze(n,o),m=(t?1:-1)*w*it,b=z(c.get(),h,m);Q(b,b,n);const ge=this.analysis.tiltEnabled?x.TILTED:x.HORIZONTAL_OR_VERTICAL,me=i[O]?x.VERTICAL:i[G]?x.HORIZONTAL:ge;return We(b,h,w,w,o,me,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=ee(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=f,this.rotateHeadingManipulator.state|=f,this.rotateTiltManipulator.state|=f,this._prevPointerMoveTimeout=this._clock.setTimeout(()=>{this.shiftManipulator.state&=~f,this.rotateHeadingManipulator.state&=~f,this.rotateTiltManipulator.state&=~f},this._pointerMoveTimerMs)}_updateManipulators(){if(j.disableEngineLayers)return;let e,t=!1;if(this.analysisViewData.plane!=null)e=this.analysisViewData.plane,t=!1;else{if(this._previewPlane==null)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach(h=>h.available=!1),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);e=this._previewPlane,t=!0}const i=ye(e,C.get());t?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach(h=>h.available=!1),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach(h=>h.available=!0),Qe(this.shiftManipulator,i,e,this.view.state.camera),Ye(this.rotateHeadingManipulator,i,e,this.view.renderCoordsHelper),Je(this.rotateTiltManipulator,i,e),this.resizeManipulators.forEach((h,o)=>Xe(h,this._resizeHandles[o],i,e)),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=le(c.get(),T(e.basis1),T(e.basis2),1),s=re(C.get(),a),n=oe(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const e=ve(this.view.effectiveTheme);e[3]*=this._previewPlaneOpacity;const t=ze(we);t[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=e,this._previewPlaneGridVisualElement.backgroundColor=t,this._previewPlaneGridVisualElement.gridColor=he}_updateManipulatorsInteractive(e){if(!e.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach(t=>{t.interactive=!0});this.shiftManipulator.interactive=this.shiftManipulator===e,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===e,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===e,this.resizeManipulators.forEach(t=>{t.interactive=t===e})}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:e=>{this._pointerMoveTimerMs=e}}}};function se(e,t,i,a){const s=et(i,F(a),e.direction,U()),n=K();return H(s,e,n)?{type:"shift",creatingPointerId:t,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function A(e){return e.pointerType!=="mouse"||e.button===0}u.disableEngineLayers=!1,l([r()],u.prototype,"_clock",void 0),l([r({constructOnly:!0})],u.prototype,"view",void 0),l([r()],u.prototype,"analysisViewData",void 0),l([r({readOnly:!0})],u.prototype,"state",null),l([r({readOnly:!0})],u.prototype,"cursor",null),l([r()],u.prototype,"analysis",null),l([r()],u.prototype,"removeIncompleteOnCancel",void 0),l([r({readOnly:!0})],u.prototype,"layersMode",void 0),l([r({value:null})],u.prototype,"inputState",null),l([r()],u.prototype,"_isPlacingSlicePlane",null),l([r()],u.prototype,"_creatingPointerId",null),u=j=l([L("esri.views.3d.analysis.Slice.SliceTool")],u);const wt=d(),E=be(),_t=u;let _=class extends N{constructor(e){super(e),this._gridVisualElement=null,this._outlineVisualElement=null,this.showGrid=!1,this.preview=!0}initialize(){const e=this.analysisViewData;if(e==null)throw new Error("expected internal object to be valid");this._gridVisualElement=pe(this.view),this._outlineVisualElement=ce(this.view),this.addHandles([v(()=>{const t=e.plane!=null&&this.analysisViewData.visible,{active:i}=this.analysisViewData,{preview:a,showGrid:s,view:n}=this,{effectiveTheme:h}=n;return{visible:t,active:i,preview:a,showGrid:s,gridColor:at(h),outlineColor:ve(h)}},t=>this._updateMaterials(t),B),v(()=>e.plane,t=>this._updatePlane(t),B)],"internal")}destroy(){this._gridVisualElement=V(this._gridVisualElement),this._outlineVisualElement=V(this._outlineVisualElement),this.set("view",null)}_updatePlane(e){if(e==null)return;this._gridVisualElement.attached=!0,this._outlineVisualElement.attached=!0;const t=le(c.get(),T(e.basis1),T(e.basis2),1),i=re(C.get(),t),a=ye(e,C.get()),s=oe(i,a,i);this._outlineVisualElement.transform=s,this._gridVisualElement.transform=s}_updateMaterials({visible:e,active:t,preview:i,showGrid:a,gridColor:s,outlineColor:n}){this._outlineVisualElement.color=n,this._outlineVisualElement.width=i?de:st,this._outlineVisualElement.stipplePattern=t?null:Oe(5),this._gridVisualElement.backgroundColor=we,this._gridVisualElement.gridColor=a?s:he,this._gridVisualElement.visible=e,this._outlineVisualElement.visible=e}};l([r()],_.prototype,"view",void 0),l([r()],_.prototype,"analysis",void 0),l([r()],_.prototype,"analysisViewData",void 0),l([r()],_.prototype,"showGrid",void 0),l([r()],_.prototype,"preview",void 0),_=l([L("esri.views.3d.analysis.Slice.SliceVisualization")],_);let y=class extends Ge(N){constructor(e){super(e),this.type="slice-view-3d",this.analysis=null,this.tool=null,this.analysisVisualization=null,this.analysisController=null,this.plane=null,this.active=!0}initialize(){this.analysisVisualization=new _({view:this.view,analysis:this.analysis,analysisViewData:this}),this.analysisController=new P({view:this.view,analysis:this.analysis,analysisViewData:this}),this.addHandles(ut(this,_t))}destroy(){pt(this),this.analysisVisualization=V(this.analysisVisualization),this.analysisController=V(this.analysisController)}get showGrid(){var e;return((e=this.analysisVisualization)==null?void 0:e.showGrid)??!1}set showGrid(e){this.analysisVisualization&&(this.analysisVisualization.showGrid=e)}get editable(){return!this.analysisVisualization.preview}set editable(e){this.analysisVisualization.preview=!e}get testData(){return{visualization:this.analysisVisualization,controller:this.analysisController,tool:this.tool}}};l([r({readOnly:!0})],y.prototype,"type",void 0),l([r({constructOnly:!0,nonNullable:!0})],y.prototype,"analysis",void 0),l([r()],y.prototype,"tool",void 0),l([r()],y.prototype,"plane",void 0),l([r()],y.prototype,"active",void 0),l([r()],y.prototype,"showGrid",null),l([r()],y.prototype,"editable",null),y=l([L("esri.views.3d.analysis.SliceAnalysisView3D")],y);const jt=y;export{jt as default}; diff --git a/dist/assets/SlicePlaneMaterial.glsl-RxywoUhm.js b/dist/assets/SlicePlaneMaterial.glsl-RxywoUhm.js deleted file mode 100644 index 06b74f5..0000000 --- a/dist/assets/SlicePlaneMaterial.glsl-RxywoUhm.js +++ /dev/null @@ -1,22 +0,0 @@ -import{bi as j,nk as ke,dJ as Je,pl as Q,xz as Qe,xE as Ke,bf as K,xy as we,xF as Ie,xx as et,xM as tt,de as rt,xO as st,xP as nt,y6 as it,xQ as at,y7 as ot,uY as q,lZ as ct,xW as dt,y8 as lt,y9 as ut,ya as gt,yb as ht,yc as pt,xA as ft,lX as bt,x_ as mt,b2 as $,b5 as Ae,jK as _t,q8 as ne,aI as $t,br as l,aE as M,aV as De,aQ as R,as as ee,at as b,au as p,v$ as fe,o4 as F,bx as We,o7 as G,yd as je,ax as V,aG as E,aF as S,aU as w,o2 as Tt,wl as Ot,ye as le,yf as wt,yg as It,ki as At,w5 as Ge,cP as Et,i4 as Ct,m2 as Fe,ag as Pt,nY as vt,yh as Mt,nX as Be,yi as ue,nw as Ee,o0 as Rt,pI as St,Z as xt,b6 as W,d as be,P as me,ab as C,b8 as L,rm as _,b1 as v,hS as yt,kz as ze,by as Lt,bz as Ce,bu as X,i2 as Y,aa as te,ro as Pe,w4 as ve,bA as ce,h8 as Me,nx as Re,yj as Se,w2 as xe,wh as Nt}from"./index-J0iiHjMT.js";import{M as Ut,$ as _e,D as Vt,e as m,O as qe}from"./ShadedColorMaterial.glsl-Fp4o6LjC.js";import{g as Ht}from"./ImageMaterial.glsl-TdPtjVc_.js";import{u as kt,r as Dt}from"./LineVisualElement-4BP10o6v.js";import{a as Wt}from"./Object3DVisualElement-TMb7y_wl.js";const jt=j(0,0,0,.04);function Gt({accentColor:e}){return ke(e,.5)}function Ft({accentColor:e}){return ke(e,.7)}const Er=Je("mac")?"Meta":"Control",Cr="Shift",Bt=2,zt=1.15,qt=1.15,Pr=2500,vr=.02,Xt=Math.cos(Q(45)),ye=Math.cos(Q(5)),Mr=.95,Rr=.3,Sr=2,Yt=1,Zt=3,Xe=11,ge=22.5,J=40,Le=48,Jt=2.25,Qt=4,Ne=1,Kt=.3,er=6,tr=4,Ue=1600,rr=.4;function Ye(e){const t=new Qe,{vertex:a,fragment:s,attributes:n,varyings:i}=t;return Ke(a,e),n.add(K.POSITION,"vec3"),n.add(K.UV0,"vec2"),i.add("vUV","vec2"),a.code.add(we`void main(void) { -vUV = uv0; -gl_Position = proj * view * vec4(position, 1.0); -}`),s.uniforms.add(new Ie("backgroundColor",r=>r.backgroundColor),new Ie("gridColor",r=>r.gridColor),new et("gridWidth",r=>r.gridWidth)),s.code.add(we`void main() { -const float LINE_WIDTH = 1.0; -vec2 uvScaled = vUV * gridWidth; -vec2 gridUV = (fract(uvScaled + 0.5) - 0.5) / (LINE_WIDTH * fwidth(uvScaled)); -vec2 grid = (1.0 - step(0.5, gridUV)) * step(-0.5, gridUV); -grid.x *= step(0.5, uvScaled.x) * step(uvScaled.x, gridWidth - 0.5); -grid.y *= step(0.5, uvScaled.y) * step(uvScaled.y, gridWidth - 0.5); -float gridFade = max(grid.x, grid.y); -float gridAlpha = gridColor.a * gridFade; -fragColor = -vec4(backgroundColor.rgb * backgroundColor.a, backgroundColor.a) * (1.0 - gridAlpha) + -vec4(gridColor.rgb, 1.0) * gridAlpha; -}`),t}const sr=Object.freeze(Object.defineProperty({__proto__:null,build:Ye},Symbol.toStringTag,{value:"Module"}));class nr extends lt{constructor(){super(...arguments),this.backgroundColor=j(1,0,0,.5),this.gridColor=j(0,1,0,.5),this.gridWidth=4}}class ie extends st{initializeProgram(t){return new nt(t.rctx,ie.shader.get().build(this.configuration),it)}initializePipeline(){return at({blending:ot(q.ONE,q.ONE,q.ONE_MINUS_SRC_ALPHA,q.ONE_MINUS_SRC_ALPHA),depthTest:{func:ct.LESS},colorWrite:dt})}}ie.shader=new tt(sr,()=>rt(()=>Promise.resolve().then(()=>$r),void 0));let ir=class extends ut{constructor(t){super(t,new or),this._configuration=new gt}createBufferWriter(){return new ht(pt)}produces(t,a){return a===ft.Color&&t===bt.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL}createGLMaterial(t){return new ar(t)}getConfiguration(){return this._configuration}};class ar extends mt{constructor(t){super(t),this.ensureTechnique(ie,null)}beginSlot(){return this.technique}}class or extends nr{constructor(){super(...arguments),this.renderOccluded=$.Occlude,this.isDecoration=!1}}class cr extends Wt{constructor(t){super(t),this._material=null,this._renderOccluded=$.OccludeAndTransparent,this._gridWidth=1,this._gridColor=j(1,0,0,1),this._backgroundColor=j(1,0,0,1),this.applyProperties(t)}get renderOccluded(){return this._renderOccluded}set renderOccluded(t){t!==this._renderOccluded&&(this._renderOccluded=t,this._updateMaterial())}get gridWidth(){return this._gridWidth}set gridWidth(t){this._gridWidth!==t&&(this._gridWidth=t,this._updateMaterial())}get gridColor(){return this._gridColor}set gridColor(t){Ae(this._gridColor,t),this._updateMaterial()}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){Ae(this._backgroundColor,t),this._updateMaterial()}createExternalResources(){this._material=new ir(this._materialParameters)}destroyExternalResources(){this._material=null}forEachExternalMaterial(t){this._material!=null&&t(this._material)}createGeometries(t){if(this._material!=null){const a=_t(this._material);t.addGeometry(a)}}get _materialParameters(){return{backgroundColor:this._backgroundColor,gridWidth:this._gridWidth,gridColor:this._gridColor,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateMaterial(){this._material!=null&&this._material.setParameters(this._materialParameters)}}function yr(e,t,a,s,n,i,r,o){return dr(t,r.worldUpAtPosition(e,l.get()),n,i,o.basis1,o.basis2),p(o.basis1,o.basis1,a),p(o.basis2,o.basis2,s),M(o.origin,e),je(o.basis2,o.basis1,o.origin,o.plane),o}function dr(e,t,a,s,n,i){const r=V(e,t),o=l.get(),u=l.get();switch(s===P.HORIZONTAL_OR_VERTICAL?Math.abs(r)>Xt?P.HORIZONTAL:P.VERTICAL:s){case P.VERTICAL:{const c=Math.abs(r)<=ye?e:a.viewUp;E(o,c,t),M(u,t);break}case P.HORIZONTAL:E(o,a.viewUp,t),E(u,t,o);break;case P.TILTED:{const c=Math.abs(r)<=ye?t:a.viewUp;E(o,c,e),E(u,e,o);break}}const d=E(l.get(),o,u);V(d,a.viewForward)>0&&p(u,u,-1),S(n,o),S(i,u)}function lr(e,t,a){const s=t.worldUpAtPosition(e.origin,l.get()),n=e.basis1,i=Oe(e,s),r=Math.round(i/H)*H;return ue(e,r-i,n,a)}function Lr(e,t,a,s,n,i){const r=M(l.get(),n.origin);b(r,r,p(l.get(),n.basis1,e.direction[0]<0?1:-1)),b(r,r,p(l.get(),n.basis2,e.direction[1]<0?1:-1));const o=R(n.basis1),u=R(n.basis2),d=w(l.get(),a,r),c=w(l.get(),t,r);let g=0,h=0;if(Te(e)){const ae=he(n),k=he(i);g=o-.5*e.direction[0]*V(n.basis1,c)/o,h=u-.5*e.direction[1]*V(n.basis2,c)/u;const B=k/ae;g*=B,h*=B}const f=g+.5*e.direction[0]*V(n.basis1,d)/o,O=h+.5*e.direction[1]*V(n.basis2,d)/u,N=p(l.get(),n.basis1,f/o),x=p(l.get(),n.basis2,O/u);(f<=0||Ve(i.origin,N,s)<=Ue)&&M(N,i.basis1),(O<=0||Ve(i.origin,x,s)<=Ue)&&M(x,i.basis2);const T=M(l.get(),r);return b(T,T,p(l.get(),N,e.direction[0]<0?-1:1)),b(T,T,p(l.get(),x,e.direction[1]<0?-1:1)),Tt(T,N,x,i)}function Nr(e,t){return rr*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(e)}function Ur(e,t,a,s){const n=E(l.get(),t,a);return E(n,n,t),De(e,n,s)}function Vr(e,t){return Ut(e.basis1,e.basis2,e.origin,t)}function Hr(e,t,a,s){const n=t.worldUpAtPosition(e.origin,l.get()),i=l.get();switch(a){case re.HEADING:M(i,n);break;case re.TILT:M(i,e.basis1)}return De(e.origin,i,s)}function kr(e,t,a,s){const n=$e(a,I.NEGATIVE_X),i=F.get();Ot(i,t,n.edge*Math.PI/2);const r=S(l.get(),n.basis);let o=p(l.get(),r,n.direction*s.computeScreenPixelSizeAt(n.position)*J);b(o,o,n.position);const u=s.projectToRenderScreen(o,le(l.get())),d=ur(s,u);wt(s,u,Z),S(Z.direction,Z.direction);const c=l.get();!d&&It(a,Z,c)&&(o=c),i[12]=0,i[13]=0,i[14]=0,e.modelTransform=i,e.renderLocation=At(o),d?e.state|=se:e.state&=~se}function ur(e,t){const[a,s,n,i]=e.viewport,r=Math.min(n,i)/16;let o=!0;return t[0]a+n-r&&(t[0]=a+n-r,o=!1),t[1]s+i-r&&(t[1]=s+i-r,o=!1),o}function Dr(e,t,a,s){const n=R(s.basis1),i=R(s.basis2),r=Ze(s),o=he(s),u=ee(l.get(),0,0,0);b(u,p(l.get(),s.basis1,t.direction[0]),p(l.get(),s.basis2,t.direction[1])),b(u,s.origin,u);let d=0,c=1;if(Te(t))t.direction[0]===1&&t.direction[1]===-1?d=H:t.direction[0]===1&&t.direction[1]===1?d=Math.PI:t.direction[0]===-1&&t.direction[1]===1&&(d=3*Math.PI/2),c=o;else{const h=t.direction[0]!==0?1:2;d=h===1?H:0,c=(h===1?i:n)-r}const g=fe(F.get(),d);We(g,g,ee(l.get(),c,c,c)),G(g,a,g),g[12]=0,g[13]=0,g[14]=0,e.modelTransform=g,e.renderLocation=u}function Wr(e,t,a,s){const n=s.worldUpAtPosition(a.origin,l.get()),i=$e(a,I.POSITIVE_X),r=fe(F.get(),i.edge*Math.PI/2);Ge(r,r,-Oe(a,n)),G(r,t,r),r[12]=0,r[13]=0,r[14]=0,e.modelTransform=r,e.renderLocation=i.position}function jr(e,t,a){const s=$e(a,I.POSITIVE_Y),n=fe(F.get(),s.edge*Math.PI/2);Ge(n,n,H),G(n,t,n),n[12]=0,n[13]=0,n[14]=0,e.modelTransform=n,e.renderLocation=s.position}var I;function $e(e,t){switch(t){case I.POSITIVE_X:return{basis:e.basis1,direction:1,position:b(l.get(),e.origin,e.basis1),edge:t};case I.POSITIVE_Y:return{basis:e.basis2,direction:1,position:b(l.get(),e.origin,e.basis2),edge:t};case I.NEGATIVE_X:return{basis:e.basis1,direction:-1,position:w(l.get(),e.origin,e.basis1),edge:t};case I.NEGATIVE_Y:return{basis:e.basis2,direction:-1,position:w(l.get(),e.origin,e.basis2),edge:t}}}function Ve(e,t,a){const s=a.projectToRenderScreen(b(l.get(),e,t),le(l.get())),n=a.projectToRenderScreen(w(l.get(),e,t),le(l.get()));return Et(w(s,s,n))}function Ze(e){const t=R(e.basis1),a=R(e.basis2);return Kt*Math.min(t,a)}function he(e){return Ze(e)}function Te(e){return e.direction[0]!==0&&e.direction[1]!==0}function Gr(e){const t=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new kt({view:e,attached:!1,color:Ft(e.effectiveTheme),width:Yt,renderOccluded:$.OccludeAndTransparent,geometry:[t],isDecoration:!0})}function Fr(e){return new cr({view:e,attached:!1,backgroundColor:jt,gridColor:Gt(e.effectiveTheme),gridWidth:4,renderOccluded:$.OccludeAndTransparent,isDecoration:!0})}function Br(e,t,a,s=new vt){if(e==null)return null;const{renderCoordsHelper:n}=t,i=n.fromRenderCoords(e.origin,t.spatialReference);if(i==null)return null;const r=Ct(i,a);if(r==null)return null;s.position=r;const o=2*R(e.basis1),u=2*R(e.basis2),d=Fe.renderUnitScaleFactor(t.spatialReference,a);s.width=o*d,s.height=u*d;const c=n.worldUpAtPosition(e.origin,l.get());return s.tilt=Pt(Oe(e,c)),s.heading=n.headingAtPosition(e.origin,e.basis1)-90,s}function Oe(e,t){return Mt(t,e.basis2,e.basis1)+H}function gr(e,t,a,s,n,i,r=Be()){return i.toRenderCoords(e,r.origin)?(i.worldBasisAtPosition(r.origin,Ee.X,r.basis1),i.worldBasisAtPosition(r.origin,Ee.Y,r.basis2),je(r.basis2,r.basis1,r.origin,r.plane),ue(r,-Q(t),Rt(r),r),ue(r,Q(a),r.basis1,r),p(r.basis1,r.basis1,s/2),p(r.basis2,r.basis2,n/2),St(r),r):(xt.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${e.spatialReference.wkid} is not supported`),null)}function zr(e,t){if((e==null?void 0:e.position)==null)return null;const a=Dt(e.position,t.spatialReference,t.elevationProvider);if(a==null)return null;const s=Fe.renderUnitScaleFactor(e.position.spatialReference,t.spatialReference),n=e.width*s,i=e.height*s;return{position:a,heading:e.heading,tilt:e.tilt,renderWidth:n,renderHeight:i}}function qr(e,t,a,s=Be()){if(e==null)return null;const n=gr(e.position,e.heading,e.tilt,e.renderWidth,e.renderHeight,t.renderCoordsHelper,s);return a.tiltEnabled||n==null||lr(n,t.renderCoordsHelper,n),n}(function(e){e[e.POSITIVE_X=0]="POSITIVE_X",e[e.POSITIVE_Y=1]="POSITIVE_Y",e[e.NEGATIVE_X=2]="NEGATIVE_X",e[e.NEGATIVE_Y=3]="NEGATIVE_Y"})(I||(I={}));const A=ne.Custom1;var re,P;(function(e){e[e.HEADING=1]="HEADING",e[e.TILT=2]="TILT"})(re||(re={})),function(e){e[e.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",e[e.HORIZONTAL=1]="HORIZONTAL",e[e.VERTICAL=2]="VERTICAL",e[e.TILTED=3]="TILTED"}(P||(P={}));const se=ne.Custom2,Z=$t(),H=Math.PI/2,de=ne.Custom1,hr=ne.Custom2;function Xr(e){return(e.type==="building-scene-3d"?e:null)!=null}class Yr extends _e{constructor(t,a){const s=Te(a),n=s?Qt:Ne,i=n*Bt,r=Ne,o={renderOccluded:$.OccludeAndTransparent,isDecoration:!0},u=new W({...o,width:n}),d=new W({...o,width:i}),c=new W({...o,width:r});super({view:t,...Vt,...pr({isCorner:s,unfocusedMaterial:u,focusedMaterial:d,outlineMaterial:c})}),this._themeHandle=be(()=>t.effectiveTheme.accentColor,g=>{const h=C.toUnitRGBA(g);u.setParameters({color:h}),d.setParameters({color:h}),c.setParameters({color:h})},me)}destroy(){this._themeHandle.remove(),super.destroy()}}function pr({isCorner:e,unfocusedMaterial:t,focusedMaterial:a,outlineMaterial:s}){const n=e?[v(1,0,0),v(0,0,0),v(0,1,0)]:[v(1,0,0),v(-1,0,0)];return{renderObjects:[new m(L(t,n),_.Unfocused|de),new m(L(a,n),_.Focused|de),new m(L(s,n),hr)],collisionType:{type:"line",paths:[n]},radius:e?er:tr,state:de}}class Zr extends _e{constructor(t,a){const s=new Ht({transparent:!0,writeDepth:!1,renderOccluded:$.Opaque,isDecoration:!0}),n=qe.calloutWidth,i=new W({width:n,renderOccluded:$.OccludeAndTransparent,isDecoration:!0});super({view:t,...fr({imageMaterial:s,calloutMaterial:i})}),this._currentTexture=null,this._themeHandle=be(()=>t.effectiveTheme.accentColor,r=>{const o=yt(r,.5),u=ze(r),d=this._currentTexture,c=a(o,u);s.setParameters({textureId:c.texture.id}),i.setParameters({color:C.toUnitRGBA(r)}),this._currentTexture=c,d==null||d.release()},me)}destroy(){var t;this._themeHandle.remove(),(t=this._currentTexture)==null||t.release(),super.destroy()}}function fr({imageMaterial:e,calloutMaterial:t}){const{focusMultiplier:a,calloutLength:s,discRadius:n}=qe,i=n*a,r=(c,g)=>{const h=[0,1,2,2,3,0];return new Lt(g,[[K.POSITION,new Ce([s-c,-c,0,s+c,-c,0,s+c,c,0,s-c,c,0],h,3,!0)],[K.UV0,new Ce([0,0,1,0,1,1,0,1],h,2,!0)]])},o=L(t,[[0,0,0],[s-n,0,0]]),u=L(t,[[0,0,0],[s-i,0,0]]),d=A;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:"disc",direction:[0,0,1],offset:[s,0,0]},focusMultiplier:a,radius:n,renderObjects:[new m(r(n,e),_.Unfocused|d),new m(o,_.Unfocused|d),new m(r(i,e),_.Focused|d),new m(u,_.Focused|d)],state:d}}var pe;(function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"})(pe||(pe={}));class Jr extends _e{constructor(t,a){const s=new W({width:1,renderOccluded:$.OccludeAndTransparent,isDecoration:!0}),n=new X({cullFace:Y.Back,renderOccluded:$.Opaque,isDecoration:!0}),i=new X({cullFace:Y.Back,renderOccluded:$.Opaque,isDecoration:!0}),r=new X({cullFace:Y.Back,renderOccluded:$.Opaque,isDecoration:!0}),o=new X({writeDepth:!1,cullFace:Y.Front,renderOccluded:$.Transparent,isDecoration:!0});super({view:t,...br({offsetMode:a,tubeMaterial:n,tipMaterial:i,capMaterial:r,outlineMaterial:o,calloutMaterial:s})}),this._themeHandle=be(()=>t.effectiveTheme.accentColor,u=>{const d=ze(u),c=C.toUnitRGBA(u),g=C.toUnitRGBA(d),h=C.toUnitRGBA(C.blendColors(d,u,.4)),f=C.toUnitRGBA(C.blendColors(d,u,.14));s.setParameters({color:c}),n.setParameters({color:f}),i.setParameters({color:g}),r.setParameters({color:h}),o.setParameters({color:c})},me)}destroy(){this._themeHandle.remove(),super.destroy()}}function br({offsetMode:e,tubeMaterial:t,tipMaterial:a,capMaterial:s,outlineMaterial:n,calloutMaterial:i}){const r=e===pe.CENTER_ON_CALLOUT?J:0,o=[v(r,0,-Le/2),v(r,0,Le/2)],u=_r(o,!0),d=He({vertices:o,padding:0,materials:{tube:t,tip:a,cap:s}}),c=He({vertices:o,padding:Jt,materials:{tube:n,tip:n,cap:n}}),g=L(i,[[r,0,0],[r-J,0,0]]),h=L(i,[[r,0,0],[r-J,0,0]]);return{renderObjects:[...d.normal.map(f=>new m(f,_.Unfocused|A)),...c.normal.map(f=>new m(f,_.Unfocused|A)),new m(g,_.Unfocused|A|se),...d.focused.map(f=>new m(f,_.Focused|A)),...c.focused.map(f=>new m(f,_.Focused|A)),new m(h,_.Focused|A|se)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[u]},collisionPriority:1,radius:Xe,state:A}}function He({vertices:e,padding:t,materials:a}){const s=n=>{const i=e.slice(0),r=w(l.get(),i[0],i[1]);S(r,r);const o=w(l.get(),i[i.length-1],i[i.length-2]);if(S(o,o),t>0){const D=p(te(),o,-t);i[i.length-1]=b(D,D,i[i.length-1]);const U=p(te(),r,-t);i[0]=b(U,U,i[0])}const u=n?qt:1,d=ge*u,c=Xe*u,g=Pe(F.get());if(t>0){const D=d/4,U=ee(l.get(),0,D,0),z=1+t/D;ve(g,g,U),We(g,g,ee(l.get(),z,z,z)),ve(g,g,p(U,U,-1/z))}const h=Pe(ce()),f=v(0,1,0),O=Me(ce(),Re(Se.get(),f,o));O[12]=i[i.length-1][0],O[13]=i[i.length-1][1],O[14]=i[i.length-1][2],G(O,O,g);const N=a.tube,x=mr(Zt*(n?zt:1)+t,i,N);x.transformation=h;const T=[x],ae=a.tip,k=xe(ae,d,c,24,!1,!1,!0);k.transformation=O,T.push(k);const B=a.cap,oe=xe(B,d,c,24,!1,!0,!1);oe.transformation=O,T.push(oe);const y=Me(ce(),Re(Se.get(),f,r));return y[12]=i[0][0],y[13]=i[0][1],y[14]=i[0][2],G(y,y,g),T.push(k.instantiate({transformation:y})),T.push(oe.instantiate({transformation:y})),T};return{normal:s(!1),focused:s(!0)}}function mr(e,t,a){const s=[];for(let i=0;i<12;i++){const r=i/12*2*Math.PI;s.push([Math.cos(r)*e,Math.sin(r)*e])}return Nt(a,s,t,[],[],!1)}function _r(e,t){const a=w(te(),e[e.length-1],e[e.length-2]);if(S(a,a),p(a,a,ge),b(a,a,e[e.length-1]),t){const s=w(te(),e[0],e[1]);return S(s,s),p(s,s,ge),b(s,s,e[0]),[s,...e,a]}return[...e,a]}const $r=Object.freeze(Object.defineProperty({__proto__:null,build:Ye},Symbol.toStringTag,{value:"Module"}));export{Fr as A,he as B,re as C,hr as D,Gr as E,pe as H,Jr as I,Sr as M,de as N,zr as P,Xr as U,A as V,P as _,Yr as a,yr as b,Hr as c,Vr as d,Wr as e,jr as f,Zr as g,Dr as h,jt as i,Br as j,Ur as k,kr as l,Pr as m,Ft as n,Lr as o,Rr as p,Mr as q,Cr as r,Nr as s,Er as t,vr as u,qr as v,Gt as w,Yt as x,se as y,Te as z}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = [] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/SlicePlaneMaterial.glsl-xVEc2mct.js b/dist/assets/SlicePlaneMaterial.glsl-xVEc2mct.js new file mode 100644 index 0000000..eb98990 --- /dev/null +++ b/dist/assets/SlicePlaneMaterial.glsl-xVEc2mct.js @@ -0,0 +1,22 @@ +import{bA as j,nF as He,dE as Qe,py as J,xS as Je,xX as Ke,bi as K,xR as we,xY as Ie,xQ as et,y3 as tt,de as rt,y5 as st,y6 as nt,yp as it,y7 as at,yq as ot,va as z,m5 as ct,yd as dt,yr as lt,ys as ut,yt as gt,yu as ht,yv as pt,xT as ft,m3 as bt,yh as mt,b2 as T,b8 as Ae,jR as _t,ql as ne,b0 as Tt,bI as l,b3 as R,c7 as ke,c2 as P,bz as ee,bO as b,ca as p,wh as fe,og as F,bQ as We,oj as G,yw as je,c9 as V,c6 as C,bL as y,b4 as w,oe as $t,wD as Ot,yx as le,yy as wt,yz as It,kq as At,wn as Ge,cG as Ct,i1 as Et,ma as Fe,ch as vt,o8 as Mt,yA as Rt,o7 as Be,yB as ue,nw as Ce,oc as Pt,pV as yt,R as St,b9 as W,B as be,P as me,W as E,bb as N,rz as _,b1 as M,hR as Lt,kL as qe,bR as Nt,bS as Ee,bM as X,hY as Y,a8 as te,rB as ve,wm as Me,bT as ce,ha as Re,nx as Pe,yC as ye,wk as Se,wz as xt}from"./index-pCX-0tJH.js";import{M as Ut,$ as _e,D as Vt,e as m,O as ze}from"./ShadedColorMaterial.glsl-L0JVQzbX.js";import{g as Dt}from"./ImageMaterial.glsl-PU0wbmEN.js";import{u as Ht,r as kt}from"./LineVisualElement-iKo1s90I.js";import{a as Wt}from"./Object3DVisualElement-8HoU366x.js";const jt=j(0,0,0,.04);function Gt({accentColor:e}){return He(e,.5)}function Ft({accentColor:e}){return He(e,.7)}const Cr=Qe("mac")?"Meta":"Control",Er="Shift",Bt=2,qt=1.15,zt=1.15,vr=2500,Mr=.02,Xt=Math.cos(J(45)),Le=Math.cos(J(5)),Rr=.95,Pr=.3,yr=2,Yt=1,Zt=3,Xe=11,ge=22.5,Q=40,Ne=48,Qt=2.25,Jt=4,xe=1,Kt=.3,er=6,tr=4,Ue=1600,rr=.4;function Ye(e){const t=new Je,{vertex:a,fragment:s,attributes:n,varyings:i}=t;return Ke(a,e),n.add(K.POSITION,"vec3"),n.add(K.UV0,"vec2"),i.add("vUV","vec2"),a.code.add(we`void main(void) { +vUV = uv0; +gl_Position = proj * view * vec4(position, 1.0); +}`),s.uniforms.add(new Ie("backgroundColor",r=>r.backgroundColor),new Ie("gridColor",r=>r.gridColor),new et("gridWidth",r=>r.gridWidth)),s.code.add(we`void main() { +const float LINE_WIDTH = 1.0; +vec2 uvScaled = vUV * gridWidth; +vec2 gridUV = (fract(uvScaled + 0.5) - 0.5) / (LINE_WIDTH * fwidth(uvScaled)); +vec2 grid = (1.0 - step(0.5, gridUV)) * step(-0.5, gridUV); +grid.x *= step(0.5, uvScaled.x) * step(uvScaled.x, gridWidth - 0.5); +grid.y *= step(0.5, uvScaled.y) * step(uvScaled.y, gridWidth - 0.5); +float gridFade = max(grid.x, grid.y); +float gridAlpha = gridColor.a * gridFade; +fragColor = +vec4(backgroundColor.rgb * backgroundColor.a, backgroundColor.a) * (1.0 - gridAlpha) + +vec4(gridColor.rgb, 1.0) * gridAlpha; +}`),t}const sr=Object.freeze(Object.defineProperty({__proto__:null,build:Ye},Symbol.toStringTag,{value:"Module"}));class nr extends lt{constructor(){super(...arguments),this.backgroundColor=j(1,0,0,.5),this.gridColor=j(0,1,0,.5),this.gridWidth=4}}class ie extends st{initializeProgram(t){return new nt(t.rctx,ie.shader.get().build(this.configuration),it)}initializePipeline(){return at({blending:ot(z.ONE,z.ONE,z.ONE_MINUS_SRC_ALPHA,z.ONE_MINUS_SRC_ALPHA),depthTest:{func:ct.LESS},colorWrite:dt})}}ie.shader=new tt(sr,()=>rt(()=>Promise.resolve().then(()=>Tr),void 0));let ir=class extends ut{constructor(t){super(t,new or),this._configuration=new gt}createBufferWriter(){return new ht(pt)}produces(t,a){return a===ft.Color&&t===bt.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL}createGLMaterial(t){return new ar(t)}getConfiguration(){return this._configuration}};class ar extends mt{constructor(t){super(t),this.ensureTechnique(ie,null)}beginSlot(){return this.technique}}class or extends nr{constructor(){super(...arguments),this.renderOccluded=T.Occlude,this.isDecoration=!1}}class cr extends Wt{constructor(t){super(t),this._material=null,this._renderOccluded=T.OccludeAndTransparent,this._gridWidth=1,this._gridColor=j(1,0,0,1),this._backgroundColor=j(1,0,0,1),this.applyProperties(t)}get renderOccluded(){return this._renderOccluded}set renderOccluded(t){t!==this._renderOccluded&&(this._renderOccluded=t,this._updateMaterial())}get gridWidth(){return this._gridWidth}set gridWidth(t){this._gridWidth!==t&&(this._gridWidth=t,this._updateMaterial())}get gridColor(){return this._gridColor}set gridColor(t){Ae(this._gridColor,t),this._updateMaterial()}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){Ae(this._backgroundColor,t),this._updateMaterial()}createExternalResources(){this._material=new ir(this._materialParameters)}destroyExternalResources(){this._material=null}forEachExternalMaterial(t){this._material!=null&&t(this._material)}createGeometries(t){if(this._material!=null){const a=_t(this._material);t.addGeometry(a)}}get _materialParameters(){return{backgroundColor:this._backgroundColor,gridWidth:this._gridWidth,gridColor:this._gridColor,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateMaterial(){this._material!=null&&this._material.setParameters(this._materialParameters)}}function Lr(e,t,a,s,n,i,r,o){return dr(t,r.worldUpAtPosition(e,l.get()),n,i,o.basis1,o.basis2),p(o.basis1,o.basis1,a),p(o.basis2,o.basis2,s),R(o.origin,e),je(o.basis2,o.basis1,o.origin,o.plane),o}function dr(e,t,a,s,n,i){const r=V(e,t),o=l.get(),u=l.get();switch(s===v.HORIZONTAL_OR_VERTICAL?Math.abs(r)>Xt?v.HORIZONTAL:v.VERTICAL:s){case v.VERTICAL:{const c=Math.abs(r)<=Le?e:a.viewUp;C(o,c,t),R(u,t);break}case v.HORIZONTAL:C(o,a.viewUp,t),C(u,t,o);break;case v.TILTED:{const c=Math.abs(r)<=Le?t:a.viewUp;C(o,c,e),C(u,e,o);break}}const d=C(l.get(),o,u);V(d,a.viewForward)>0&&p(u,u,-1),y(n,o),y(i,u)}function lr(e,t,a){const s=t.worldUpAtPosition(e.origin,l.get()),n=e.basis1,i=Oe(e,s),r=Math.round(i/D)*D;return ue(e,r-i,n,a)}function Nr(e,t,a,s,n,i){const r=R(l.get(),n.origin);b(r,r,p(l.get(),n.basis1,e.direction[0]<0?1:-1)),b(r,r,p(l.get(),n.basis2,e.direction[1]<0?1:-1));const o=P(n.basis1),u=P(n.basis2),d=w(l.get(),a,r),c=w(l.get(),t,r);let g=0,h=0;if($e(e)){const ae=he(n),H=he(i);g=o-.5*e.direction[0]*V(n.basis1,c)/o,h=u-.5*e.direction[1]*V(n.basis2,c)/u;const B=H/ae;g*=B,h*=B}const f=g+.5*e.direction[0]*V(n.basis1,d)/o,O=h+.5*e.direction[1]*V(n.basis2,d)/u,x=p(l.get(),n.basis1,f/o),S=p(l.get(),n.basis2,O/u);(f<=0||Ve(i.origin,x,s)<=Ue)&&R(x,i.basis1),(O<=0||Ve(i.origin,S,s)<=Ue)&&R(S,i.basis2);const $=R(l.get(),r);return b($,$,p(l.get(),x,e.direction[0]<0?-1:1)),b($,$,p(l.get(),S,e.direction[1]<0?-1:1)),$t($,x,S,i)}function xr(e,t){return rr*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(e)}function Ur(e,t,a,s){const n=C(l.get(),t,a);return C(n,n,t),ke(e,n,s)}function Vr(e,t){return Ut(e.basis1,e.basis2,e.origin,t)}function Dr(e,t,a,s){const n=t.worldUpAtPosition(e.origin,l.get()),i=l.get();switch(a){case re.HEADING:R(i,n);break;case re.TILT:R(i,e.basis1)}return ke(e.origin,i,s)}function Hr(e,t,a,s){const n=Te(a,I.NEGATIVE_X),i=F.get();Ot(i,t,n.edge*Math.PI/2);const r=y(l.get(),n.basis);let o=p(l.get(),r,n.direction*s.computeScreenPixelSizeAt(n.position)*Q);b(o,o,n.position);const u=s.projectToRenderScreen(o,le(l.get())),d=ur(s,u);wt(s,u,Z),y(Z.direction,Z.direction);const c=l.get();!d&&It(a,Z,c)&&(o=c),i[12]=0,i[13]=0,i[14]=0,e.modelTransform=i,e.renderLocation=At(o),d?e.state|=se:e.state&=~se}function ur(e,t){const[a,s,n,i]=e.viewport,r=Math.min(n,i)/16;let o=!0;return t[0]a+n-r&&(t[0]=a+n-r,o=!1),t[1]s+i-r&&(t[1]=s+i-r,o=!1),o}function kr(e,t,a,s){const n=P(s.basis1),i=P(s.basis2),r=Ze(s),o=he(s),u=ee(l.get(),0,0,0);b(u,p(l.get(),s.basis1,t.direction[0]),p(l.get(),s.basis2,t.direction[1])),b(u,s.origin,u);let d=0,c=1;if($e(t))t.direction[0]===1&&t.direction[1]===-1?d=D:t.direction[0]===1&&t.direction[1]===1?d=Math.PI:t.direction[0]===-1&&t.direction[1]===1&&(d=3*Math.PI/2),c=o;else{const h=t.direction[0]!==0?1:2;d=h===1?D:0,c=(h===1?i:n)-r}const g=fe(F.get(),d);We(g,g,ee(l.get(),c,c,c)),G(g,a,g),g[12]=0,g[13]=0,g[14]=0,e.modelTransform=g,e.renderLocation=u}function Wr(e,t,a,s){const n=s.worldUpAtPosition(a.origin,l.get()),i=Te(a,I.POSITIVE_X),r=fe(F.get(),i.edge*Math.PI/2);Ge(r,r,-Oe(a,n)),G(r,t,r),r[12]=0,r[13]=0,r[14]=0,e.modelTransform=r,e.renderLocation=i.position}function jr(e,t,a){const s=Te(a,I.POSITIVE_Y),n=fe(F.get(),s.edge*Math.PI/2);Ge(n,n,D),G(n,t,n),n[12]=0,n[13]=0,n[14]=0,e.modelTransform=n,e.renderLocation=s.position}var I;function Te(e,t){switch(t){case I.POSITIVE_X:return{basis:e.basis1,direction:1,position:b(l.get(),e.origin,e.basis1),edge:t};case I.POSITIVE_Y:return{basis:e.basis2,direction:1,position:b(l.get(),e.origin,e.basis2),edge:t};case I.NEGATIVE_X:return{basis:e.basis1,direction:-1,position:w(l.get(),e.origin,e.basis1),edge:t};case I.NEGATIVE_Y:return{basis:e.basis2,direction:-1,position:w(l.get(),e.origin,e.basis2),edge:t}}}function Ve(e,t,a){const s=a.projectToRenderScreen(b(l.get(),e,t),le(l.get())),n=a.projectToRenderScreen(w(l.get(),e,t),le(l.get()));return Ct(w(s,s,n))}function Ze(e){const t=P(e.basis1),a=P(e.basis2);return Kt*Math.min(t,a)}function he(e){return Ze(e)}function $e(e){return e.direction[0]!==0&&e.direction[1]!==0}function Gr(e){const t=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new Ht({view:e,attached:!1,color:Ft(e.effectiveTheme),width:Yt,renderOccluded:T.OccludeAndTransparent,geometry:[t],isDecoration:!0})}function Fr(e){return new cr({view:e,attached:!1,backgroundColor:jt,gridColor:Gt(e.effectiveTheme),gridWidth:4,renderOccluded:T.OccludeAndTransparent,isDecoration:!0})}function Br(e,t,a,s=new Mt){if(e==null)return null;const{renderCoordsHelper:n}=t,i=n.fromRenderCoords(e.origin,t.spatialReference);if(i==null)return null;const r=Et(i,a);if(r==null)return null;s.position=r;const o=2*P(e.basis1),u=2*P(e.basis2),d=Fe.renderUnitScaleFactor(t.spatialReference,a);s.width=o*d,s.height=u*d;const c=n.worldUpAtPosition(e.origin,l.get());return s.tilt=vt(Oe(e,c)),s.heading=n.headingAtPosition(e.origin,e.basis1)-90,s}function Oe(e,t){return Rt(t,e.basis2,e.basis1)+D}function gr(e,t,a,s,n,i,r=Be()){return i.toRenderCoords(e,r.origin)?(i.worldBasisAtPosition(r.origin,Ce.X,r.basis1),i.worldBasisAtPosition(r.origin,Ce.Y,r.basis2),je(r.basis2,r.basis1,r.origin,r.plane),ue(r,-J(t),Pt(r),r),ue(r,J(a),r.basis1,r),p(r.basis1,r.basis1,s/2),p(r.basis2,r.basis2,n/2),yt(r),r):(St.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${e.spatialReference.wkid} is not supported`),null)}function qr(e,t){if((e==null?void 0:e.position)==null)return null;const a=kt(e.position,t.spatialReference,t.elevationProvider);if(a==null)return null;const s=Fe.renderUnitScaleFactor(e.position.spatialReference,t.spatialReference),n=e.width*s,i=e.height*s;return{position:a,heading:e.heading,tilt:e.tilt,renderWidth:n,renderHeight:i}}function zr(e,t,a,s=Be()){if(e==null)return null;const n=gr(e.position,e.heading,e.tilt,e.renderWidth,e.renderHeight,t.renderCoordsHelper,s);return a.tiltEnabled||n==null||lr(n,t.renderCoordsHelper,n),n}(function(e){e[e.POSITIVE_X=0]="POSITIVE_X",e[e.POSITIVE_Y=1]="POSITIVE_Y",e[e.NEGATIVE_X=2]="NEGATIVE_X",e[e.NEGATIVE_Y=3]="NEGATIVE_Y"})(I||(I={}));const A=ne.Custom1;var re,v;(function(e){e[e.HEADING=1]="HEADING",e[e.TILT=2]="TILT"})(re||(re={})),function(e){e[e.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",e[e.HORIZONTAL=1]="HORIZONTAL",e[e.VERTICAL=2]="VERTICAL",e[e.TILTED=3]="TILTED"}(v||(v={}));const se=ne.Custom2,Z=Tt(),D=Math.PI/2,de=ne.Custom1,hr=ne.Custom2;function Xr(e){return(e.type==="building-scene-3d"?e:null)!=null}class Yr extends _e{constructor(t,a){const s=$e(a),n=s?Jt:xe,i=n*Bt,r=xe,o={renderOccluded:T.OccludeAndTransparent,isDecoration:!0},u=new W({...o,width:n}),d=new W({...o,width:i}),c=new W({...o,width:r});super({view:t,...Vt,...pr({isCorner:s,unfocusedMaterial:u,focusedMaterial:d,outlineMaterial:c})}),this._themeHandle=be(()=>t.effectiveTheme.accentColor,g=>{const h=E.toUnitRGBA(g);u.setParameters({color:h}),d.setParameters({color:h}),c.setParameters({color:h})},me)}destroy(){this._themeHandle.remove(),super.destroy()}}function pr({isCorner:e,unfocusedMaterial:t,focusedMaterial:a,outlineMaterial:s}){const n=e?[M(1,0,0),M(0,0,0),M(0,1,0)]:[M(1,0,0),M(-1,0,0)];return{renderObjects:[new m(N(t,n),_.Unfocused|de),new m(N(a,n),_.Focused|de),new m(N(s,n),hr)],collisionType:{type:"line",paths:[n]},radius:e?er:tr,state:de}}class Zr extends _e{constructor(t,a){const s=new Dt({transparent:!0,writeDepth:!1,renderOccluded:T.Opaque,isDecoration:!0}),n=ze.calloutWidth,i=new W({width:n,renderOccluded:T.OccludeAndTransparent,isDecoration:!0});super({view:t,...fr({imageMaterial:s,calloutMaterial:i})}),this._currentTexture=null,this._themeHandle=be(()=>t.effectiveTheme.accentColor,r=>{const o=Lt(r,.5),u=qe(r),d=this._currentTexture,c=a(o,u);s.setParameters({textureId:c.texture.id}),i.setParameters({color:E.toUnitRGBA(r)}),this._currentTexture=c,d==null||d.release()},me)}destroy(){var t;this._themeHandle.remove(),(t=this._currentTexture)==null||t.release(),super.destroy()}}function fr({imageMaterial:e,calloutMaterial:t}){const{focusMultiplier:a,calloutLength:s,discRadius:n}=ze,i=n*a,r=(c,g)=>{const h=[0,1,2,2,3,0];return new Nt(g,[[K.POSITION,new Ee([s-c,-c,0,s+c,-c,0,s+c,c,0,s-c,c,0],h,3,!0)],[K.UV0,new Ee([0,0,1,0,1,1,0,1],h,2,!0)]])},o=N(t,[[0,0,0],[s-n,0,0]]),u=N(t,[[0,0,0],[s-i,0,0]]),d=A;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:"disc",direction:[0,0,1],offset:[s,0,0]},focusMultiplier:a,radius:n,renderObjects:[new m(r(n,e),_.Unfocused|d),new m(o,_.Unfocused|d),new m(r(i,e),_.Focused|d),new m(u,_.Focused|d)],state:d}}var pe;(function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"})(pe||(pe={}));class Qr extends _e{constructor(t,a){const s=new W({width:1,renderOccluded:T.OccludeAndTransparent,isDecoration:!0}),n=new X({cullFace:Y.Back,renderOccluded:T.Opaque,isDecoration:!0}),i=new X({cullFace:Y.Back,renderOccluded:T.Opaque,isDecoration:!0}),r=new X({cullFace:Y.Back,renderOccluded:T.Opaque,isDecoration:!0}),o=new X({writeDepth:!1,cullFace:Y.Front,renderOccluded:T.Transparent,isDecoration:!0});super({view:t,...br({offsetMode:a,tubeMaterial:n,tipMaterial:i,capMaterial:r,outlineMaterial:o,calloutMaterial:s})}),this._themeHandle=be(()=>t.effectiveTheme.accentColor,u=>{const d=qe(u),c=E.toUnitRGBA(u),g=E.toUnitRGBA(d),h=E.toUnitRGBA(E.blendColors(d,u,.4)),f=E.toUnitRGBA(E.blendColors(d,u,.14));s.setParameters({color:c}),n.setParameters({color:f}),i.setParameters({color:g}),r.setParameters({color:h}),o.setParameters({color:c})},me)}destroy(){this._themeHandle.remove(),super.destroy()}}function br({offsetMode:e,tubeMaterial:t,tipMaterial:a,capMaterial:s,outlineMaterial:n,calloutMaterial:i}){const r=e===pe.CENTER_ON_CALLOUT?Q:0,o=[M(r,0,-Ne/2),M(r,0,Ne/2)],u=_r(o,!0),d=De({vertices:o,padding:0,materials:{tube:t,tip:a,cap:s}}),c=De({vertices:o,padding:Qt,materials:{tube:n,tip:n,cap:n}}),g=N(i,[[r,0,0],[r-Q,0,0]]),h=N(i,[[r,0,0],[r-Q,0,0]]);return{renderObjects:[...d.normal.map(f=>new m(f,_.Unfocused|A)),...c.normal.map(f=>new m(f,_.Unfocused|A)),new m(g,_.Unfocused|A|se),...d.focused.map(f=>new m(f,_.Focused|A)),...c.focused.map(f=>new m(f,_.Focused|A)),new m(h,_.Focused|A|se)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[u]},collisionPriority:1,radius:Xe,state:A}}function De({vertices:e,padding:t,materials:a}){const s=n=>{const i=e.slice(0),r=w(l.get(),i[0],i[1]);y(r,r);const o=w(l.get(),i[i.length-1],i[i.length-2]);if(y(o,o),t>0){const k=p(te(),o,-t);i[i.length-1]=b(k,k,i[i.length-1]);const U=p(te(),r,-t);i[0]=b(U,U,i[0])}const u=n?zt:1,d=ge*u,c=Xe*u,g=ve(F.get());if(t>0){const k=d/4,U=ee(l.get(),0,k,0),q=1+t/k;Me(g,g,U),We(g,g,ee(l.get(),q,q,q)),Me(g,g,p(U,U,-1/q))}const h=ve(ce()),f=M(0,1,0),O=Re(ce(),Pe(ye.get(),f,o));O[12]=i[i.length-1][0],O[13]=i[i.length-1][1],O[14]=i[i.length-1][2],G(O,O,g);const x=a.tube,S=mr(Zt*(n?qt:1)+t,i,x);S.transformation=h;const $=[S],ae=a.tip,H=Se(ae,d,c,24,!1,!1,!0);H.transformation=O,$.push(H);const B=a.cap,oe=Se(B,d,c,24,!1,!0,!1);oe.transformation=O,$.push(oe);const L=Re(ce(),Pe(ye.get(),f,r));return L[12]=i[0][0],L[13]=i[0][1],L[14]=i[0][2],G(L,L,g),$.push(H.instantiate({transformation:L})),$.push(oe.instantiate({transformation:L})),$};return{normal:s(!1),focused:s(!0)}}function mr(e,t,a){const s=[];for(let i=0;i<12;i++){const r=i/12*2*Math.PI;s.push([Math.cos(r)*e,Math.sin(r)*e])}return xt(a,s,t,[],[],!1)}function _r(e,t){const a=w(te(),e[e.length-1],e[e.length-2]);if(y(a,a),p(a,a,ge),b(a,a,e[e.length-1]),t){const s=w(te(),e[0],e[1]);return y(s,s),p(s,s,ge),b(s,s,e[0]),[s,...e,a]}return[...e,a]}const Tr=Object.freeze(Object.defineProperty({__proto__:null,build:Ye},Symbol.toStringTag,{value:"Module"}));export{Fr as A,he as B,re as C,hr as D,Gr as E,pe as H,Qr as I,yr as M,de as N,qr as P,Xr as U,A as V,v as _,Yr as a,Lr as b,Dr as c,Vr as d,Wr as e,jr as f,Zr as g,kr as h,jt as i,Br as j,Ur as k,Hr as l,vr as m,Ft as n,Nr as o,Pr as p,Rr as q,Er as r,xr as s,Cr as t,Mr as u,zr as v,Gt as w,Yt as x,se as y,$e as z}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = [] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/SnappingContext-6K6JmvvY.js b/dist/assets/SnappingContext-ax0tf6c6.js similarity index 78% rename from dist/assets/SnappingContext-6K6JmvvY.js rename to dist/assets/SnappingContext-ax0tf6c6.js index 15a28bb..1301408 100644 --- a/dist/assets/SnappingContext-6K6JmvvY.js +++ b/dist/assets/SnappingContext-ax0tf6c6.js @@ -1 +1 @@ -import{hF as o,hG as l,hH as u,hI as h,fv as p}from"./index-J0iiHjMT.js";import{n as f}from"./PointSnappingHint-ULetRXiW.js";class v{draw(e,i){const n=this._getUniqueHints(e),r=this.sortUniqueHints(n),s=[];for(const t of r)t instanceof o&&s.push(this.visualizeIntersectionPoint(t,i)),t instanceof l&&s.push(this.visualizeLine(t,i)),t instanceof u&&s.push(this.visualizeParallelSign(t,i)),t instanceof h&&s.push(this.visualizeRightAngleQuad(t,i)),t instanceof f&&s.push(this.visualizePoint(t,i));return p(s)}sortUniqueHints(e){return e}_getUniqueHints(e){const i=[];for(const n of e){let r=!0;for(const s of i)if(n.equals(s)){r=!1;break}r&&i.push(n)}return i}}class H{constructor(e){this.vertexHandle=null,this.excludeFeature=null,this.visualizer=null,this.selfSnappingZ=null,this.editGeometryOperations=e.editGeometryOperations,this.elevationInfo=e.elevationInfo,this.pointer=e.pointer,this.vertexHandle=e.vertexHandle,this.excludeFeature=e.excludeFeature,this.feature=e.feature,this.visualizer=e.visualizer,this.selfSnappingZ=e.selfSnappingZ}get coordinateHelper(){return this.editGeometryOperations.data.coordinateHelper}get spatialReference(){return this.coordinateHelper.spatialReference}}export{H as e,v as r}; +import{h_ as o,hL as l,h$ as u,i0 as h,fq as p}from"./index-pCX-0tJH.js";import{n as f}from"./PointSnappingHint-bwlQAyn6.js";class v{draw(e,i){const n=this._getUniqueHints(e),r=this.sortUniqueHints(n),s=[];for(const t of r)t instanceof o&&s.push(this.visualizeIntersectionPoint(t,i)),t instanceof l&&s.push(this.visualizeLine(t,i)),t instanceof u&&s.push(this.visualizeParallelSign(t,i)),t instanceof h&&s.push(this.visualizeRightAngleQuad(t,i)),t instanceof f&&s.push(this.visualizePoint(t,i));return p(s)}sortUniqueHints(e){return e}_getUniqueHints(e){const i=[];for(const n of e){let r=!0;for(const s of i)if(n.equals(s)){r=!1;break}r&&i.push(n)}return i}}class g{constructor(e){this.vertexHandle=null,this.excludeFeature=null,this.visualizer=null,this.selfSnappingZ=null,this.editGeometryOperations=e.editGeometryOperations,this.elevationInfo=e.elevationInfo,this.pointer=e.pointer,this.vertexHandle=e.vertexHandle,this.excludeFeature=e.excludeFeature,this.feature=e.feature,this.visualizer=e.visualizer,this.selfSnappingZ=e.selfSnappingZ}get coordinateHelper(){return this.editGeometryOperations.data.coordinateHelper}get spatialReference(){return this.coordinateHelper.spatialReference}}export{g as e,v as r}; diff --git a/dist/assets/SnappingDragPipelineStep-HDAWWRgo.js b/dist/assets/SnappingDragPipelineStep-HDAWWRgo.js new file mode 100644 index 0000000..795dcf0 --- /dev/null +++ b/dist/assets/SnappingDragPipelineStep-HDAWWRgo.js @@ -0,0 +1 @@ +import{bm as G,B as A,bn as L,bo as M,bp as N,I as q,bq as B,br as D,bs as J}from"./index-pCX-0tJH.js";import{r as K}from"./dehydratedFeatureComparison-IJSogXWn.js";import{U as Q}from"./InteractiveToolBase-6mltmL27.js";import{e as R}from"./SnappingContext-ax0tf6c6.js";function tn({predicate:n=()=>!0,snappingManager:e,snappingContext:o,updatingHandles:a,useZ:t=!0}){const i=new Q;if(e==null)return{snappingStep:[w,i],cancelSnapping:w};let p,u=null,l=null,c=null;const f=()=>{u=q(u),e.doneSnapping(),l==null||l.frameTask.remove(),l=null,p=B(p),c=null},m=V(e,t,i);let d=null,s=null,Z=null;return{snappingStep:[r=>{if(!n(r))return r;const{action:P}=r;if(P==="start"){const{info:x}=r,S=W(e.view);if(l=X(o,r,S),l.context.selfSnappingZ=null,!t&&x!=null){const g=_(o.coordinateHelper,x.handle.component);g!=null&&(l.context.selfSnappingZ={value:g,elevationInfo:o.elevationInfo??G})}}if(l!=null){const{context:x,originalScenePos:S,originalPos:g}=l,{mapEnd:b,mapStart:T,scenePoints:C}=r,v=z(g,y(b,T)),k=y(T,g),E={...r,action:"update"},H=l.context,h=Y(S,C),I=e.update({point:v,scenePoint:h,context:x});if(Z=I,U(b,I,k,t),d=v,s=h,P!=="end"){const{frameTask:O}=l;u==null&&(u=new AbortController),c=F=>{a.addPromise(D(m({frameTask:O,event:E,context:H,point:v,scenePoint:h,delta:k,getLastState:()=>({point:d,scenePoint:s,updatePoint:F.forceUpdate?null:Z})},u.signal)))},c({forceUpdate:!1}),p==null&&(p=A(()=>e.options.effectiveEnabled,()=>c==null?void 0:c({forceUpdate:!0})))}}return P==="end"&&f(),r},i],cancelSnapping:r=>(f(),r)}}function V(n,e,o){return J(async({frameTask:a,point:t,scenePoint:i,context:p,event:u,delta:l,getLastState:c},f)=>{const m=await a.schedule(()=>n.snap({point:t,scenePoint:i,context:p,signal:f}),f);if(m.valid){let d=await a.schedule(()=>m.apply(),f);const s=c();s.point!=null&&t!==s.point&&(d=n.update({point:s.point,scenePoint:s.scenePoint,context:p})),s.updatePoint!=null&&K(d,s.updatePoint)||(U(u.mapEnd,d,l,e),o.execute(u))}})}function W(n){return n.type==="3d"?n.resourceController.scheduler.registerTask(L.SNAPPING):M}function X(n,e,o){return{context:new R({editGeometryOperations:n.editGeometryOperations,elevationInfo:n.elevationInfo,pointer:n.pointer,vertexHandle:e.info!=null?e.info.handle:null,excludeFeature:n.excludeFeature,feature:n.feature,visualizer:n.visualizer}),originalPos:e.snapOrigin!=null?n.coordinateHelper.vectorToDehydratedPoint(e.snapOrigin):e.mapStart,originalScenePos:e.scenePoints!=null?e.scenePoints.sceneStart:null,frameTask:o}}function z(n,[e,o,a]){const t=N(n);return t.x+=e,t.y+=o,t.hasZ&&(t.z+=a),t}function Y(n,e){return n==null||e==null?null:z(n,y(e.sceneEnd,e.sceneStart))}function y(n,e){const o=n.hasZ&&e.hasZ?n.z-e.z:0;return[n.x-e.x,n.y-e.y,o]}function U(n,e,[o,a,t],i){n.x=e.x+o,n.y=e.y+a,i&&n.hasZ&&e.hasZ&&(n.z=e.z+t)}function _(n,e){if(!n.hasZ())return null;const o=e.vertices;let a=null;for(const t of o){const i=n.getZ(t.pos);if(a!=null&&i!=null&&Math.abs(i-a)>1e-6)return null;a==null&&(a=i)}return a}function w(n){return n}export{tn as f}; diff --git a/dist/assets/SnappingDragPipelineStep-THHIXt-p.js b/dist/assets/SnappingDragPipelineStep-THHIXt-p.js deleted file mode 100644 index 9eba3d5..0000000 --- a/dist/assets/SnappingDragPipelineStep-THHIXt-p.js +++ /dev/null @@ -1 +0,0 @@ -import{am as G,d as A,ai as L,aj as M,an as N,a as D,ak as j,ao as q,ah as B}from"./index-J0iiHjMT.js";import{r as J}from"./dehydratedFeatureComparison-hdPq-zad.js";import{U as K}from"./InteractiveToolBase-WDic4GPF.js";import{e as Q}from"./SnappingContext-6K6JmvvY.js";function tn({predicate:n=()=>!0,snappingManager:e,snappingContext:o,updatingHandles:a,useZ:t=!0}){const i=new K;if(e==null)return{snappingStep:[z,i],cancelSnapping:z};let p,u=null,l=null,c=null;const f=()=>{u=D(u),e.doneSnapping(),l==null||l.frameTask.remove(),l=null,p=j(p),c=null},m=R(e,t,i);let d=null,s=null,Z=null;return{snappingStep:[r=>{if(!n(r))return r;const{action:P}=r;if(P==="start"){const{info:x}=r,S=V(e.view);if(l=W(o,r,S),l.context.selfSnappingZ=null,!t&&x!=null){const g=Y(o.coordinateHelper,x.handle.component);g!=null&&(l.context.selfSnappingZ={value:g,elevationInfo:o.elevationInfo??G})}}if(l!=null){const{context:x,originalScenePos:S,originalPos:g}=l,{mapEnd:k,mapStart:T,scenePoints:E}=r,v=U(g,y(k,T)),w=y(T,g),H={...r,action:"update"},O=l.context,h=X(S,E),I=e.update({point:v,scenePoint:h,context:x});if(Z=I,C(k,I,w,t),d=v,s=h,P!=="end"){const{frameTask:b}=l;u==null&&(u=new AbortController),c=F=>{a.addPromise(q(m({frameTask:b,event:H,context:O,point:v,scenePoint:h,delta:w,getLastState:()=>({point:d,scenePoint:s,updatePoint:F.forceUpdate?null:Z})},u.signal)))},c({forceUpdate:!1}),p==null&&(p=A(()=>e.options.effectiveEnabled,()=>c==null?void 0:c({forceUpdate:!0})))}}return P==="end"&&f(),r},i],cancelSnapping:r=>(f(),r)}}function R(n,e,o){return B(async({frameTask:a,point:t,scenePoint:i,context:p,event:u,delta:l,getLastState:c},f)=>{const m=await a.schedule(()=>n.snap({point:t,scenePoint:i,context:p,signal:f}),f);if(m.valid){let d=await a.schedule(()=>m.apply(),f);const s=c();s.point!=null&&t!==s.point&&(d=n.update({point:s.point,scenePoint:s.scenePoint,context:p})),s.updatePoint!=null&&J(d,s.updatePoint)||(C(u.mapEnd,d,l,e),o.execute(u))}})}function V(n){return n.type==="3d"?n.resourceController.scheduler.registerTask(L.SNAPPING):M}function W(n,e,o){return{context:new Q({editGeometryOperations:n.editGeometryOperations,elevationInfo:n.elevationInfo,pointer:n.pointer,vertexHandle:e.info!=null?e.info.handle:null,excludeFeature:n.excludeFeature,feature:n.feature,visualizer:n.visualizer}),originalPos:e.snapOrigin!=null?n.coordinateHelper.vectorToDehydratedPoint(e.snapOrigin):e.mapStart,originalScenePos:e.scenePoints!=null?e.scenePoints.sceneStart:null,frameTask:o}}function U(n,[e,o,a]){const t=N(n);return t.x+=e,t.y+=o,t.hasZ&&(t.z+=a),t}function X(n,e){return n==null||e==null?null:U(n,y(e.sceneEnd,e.sceneStart))}function y(n,e){const o=n.hasZ&&e.hasZ?n.z-e.z:0;return[n.x-e.x,n.y-e.y,o]}function C(n,e,[o,a,t],i){n.x=e.x+o,n.y=e.y+a,i&&n.hasZ&&e.hasZ&&(n.z=e.z+t)}function Y(n,e){if(!n.hasZ())return null;const o=e.vertices;let a=null;for(const t of o){const i=n.getZ(t.pos);if(a!=null&&i!=null&&Math.abs(i-a)>1e-6)return null;a==null&&(a=i)}return a}function z(n){return n}export{tn as f}; diff --git a/dist/assets/SnappingOperation-2U48wt1k.js b/dist/assets/SnappingOperation-hED0OM8D.js similarity index 92% rename from dist/assets/SnappingOperation-2U48wt1k.js rename to dist/assets/SnappingOperation-hED0OM8D.js index 1b6c23f..e380d23 100644 --- a/dist/assets/SnappingOperation-2U48wt1k.js +++ b/dist/assets/SnappingOperation-hED0OM8D.js @@ -1 +1 @@ -import{e as r,p as c,ah as u,ai as _,aj as P,a as h,ak as d,y as l,c as g}from"./index-J0iiHjMT.js";let a=class extends c{constructor(t){super(t),this.constrainResult=s=>s,this._snapPoints=null,this._frameTask=null,this._abortController=null,this._stagedPoint=null,this._snap=u(async(s,n,o,i)=>{const e=this._frameTask;if(e==null)return;const p=await e.schedule(()=>n.snap({...s,context:o,signal:i}),i);p.valid&&await e.schedule(()=>{this.stagedPoint=p.apply(),s!==this._snapPoints&&this._snapPoints!=null&&(this.stagedPoint=n.update({...this._snapPoints,context:o}))},i)})}get stagedPoint(){return this._stagedPoint}set stagedPoint(t){this._stagedPoint=this.constrainResult(t)}initialize(){var s,n;const t=this.view.type==="3d"?(n=(s=this.view)==null?void 0:s.resourceController)==null?void 0:n.scheduler:null;this._frameTask=t!=null?t.registerTask(_.SNAPPING):P}destroy(){this._abortController=h(this._abortController),this._frameTask=d(this._frameTask)}update(t,s,n){this._snapPoints=t;const{point:o,scenePoint:i}=t,e=s.update({point:o,scenePoint:i,context:n});return this.stagedPoint=e,e}async snap(t,s,n){const{point:o,scenePoint:i}=t;return this.stagedPoint=s.update({point:o,scenePoint:i,context:n}),this._snapPoints=t,this._abortController==null&&(this._abortController=new AbortController),this._snap(t,s,n,this._abortController.signal)}async resnap(t,s){this._snapPoints!=null&&await this.snap(this._snapPoints,t,s)}abort(){this._abortController=h(this._abortController),this._snapPoints=null}};r([l({constructOnly:!0})],a.prototype,"view",void 0),r([l()],a.prototype,"stagedPoint",null),r([l()],a.prototype,"constrainResult",void 0),r([l()],a.prototype,"_stagedPoint",void 0),a=r([g("esri.views.interactive.snapping.SnappingOperation")],a);export{a as p}; +import{e as r,g as c,bs as u,bn as _,bo as P,I as h,bq as d,y as l,c as g}from"./index-pCX-0tJH.js";let a=class extends c{constructor(t){super(t),this.constrainResult=s=>s,this._snapPoints=null,this._frameTask=null,this._abortController=null,this._stagedPoint=null,this._snap=u(async(s,n,o,i)=>{const e=this._frameTask;if(e==null)return;const p=await e.schedule(()=>n.snap({...s,context:o,signal:i}),i);p.valid&&await e.schedule(()=>{this.stagedPoint=p.apply(),s!==this._snapPoints&&this._snapPoints!=null&&(this.stagedPoint=n.update({...this._snapPoints,context:o}))},i)})}get stagedPoint(){return this._stagedPoint}set stagedPoint(t){this._stagedPoint=this.constrainResult(t)}initialize(){var s,n;const t=this.view.type==="3d"?(n=(s=this.view)==null?void 0:s.resourceController)==null?void 0:n.scheduler:null;this._frameTask=t!=null?t.registerTask(_.SNAPPING):P}destroy(){this._abortController=h(this._abortController),this._frameTask=d(this._frameTask)}update(t,s,n){this._snapPoints=t;const{point:o,scenePoint:i}=t,e=s.update({point:o,scenePoint:i,context:n});return this.stagedPoint=e,e}async snap(t,s,n){const{point:o,scenePoint:i}=t;return this.stagedPoint=s.update({point:o,scenePoint:i,context:n}),this._snapPoints=t,this._abortController==null&&(this._abortController=new AbortController),this._snap(t,s,n,this._abortController.signal)}async resnap(t,s){this._snapPoints!=null&&await this.snap(this._snapPoints,t,s)}abort(){this._abortController=h(this._abortController),this._snapPoints=null}};r([l({constructOnly:!0})],a.prototype,"view",void 0),r([l()],a.prototype,"stagedPoint",null),r([l()],a.prototype,"constrainResult",void 0),r([l()],a.prototype,"_stagedPoint",void 0),a=r([g("esri.views.interactive.snapping.SnappingOperation")],a);export{a as p}; diff --git a/dist/assets/SnappingVisualizer2D-JqQy3X5x.js b/dist/assets/SnappingVisualizer2D-JqQy3X5x.js new file mode 100644 index 0000000..c661c40 --- /dev/null +++ b/dist/assets/SnappingVisualizer2D-JqQy3X5x.js @@ -0,0 +1 @@ +import{L as y,E as n,Z as p,$ as b,K as S,a0 as u,a1 as o,a2 as l,a3 as s,a4 as d,a5 as M,x as m,a6 as C,a7 as h,a8 as P}from"./index-pCX-0tJH.js";import{r as v}from"./SnappingContext-ax0tf6c6.js";class w extends v{constructor(e){super(),this._graphicsLayer=e,this._symbolPairingsByType=new Map}visualizeIntersectionPoint(e,t){return this._visualizeSnappingIndicator(new y({x:e.intersectionPoint[0],y:e.intersectionPoint[1],spatialReference:t.spatialReference}),this._getOrCreateSymbol("intersectionPoint",t.view.effectiveTheme.accentColor))}visualizePoint(e,t){return this._visualizeSnappingIndicator(new y({x:e.point[0],y:e.point[1],spatialReference:t.spatialReference}),this._getOrCreateSymbol("point",t.view.effectiveTheme.accentColor))}visualizeLine(e,t){return this._visualizeSnappingIndicator(new n({paths:[[e.lineStart,e.lineEnd]],spatialReference:t.spatialReference}),this._getOrCreateSymbol("line",t.view.effectiveTheme.accentColor))}visualizeParallelSign(e,t){return this._visualizeSnappingIndicator(new n({paths:[[e.lineStart,e.lineEnd]],spatialReference:t.spatialReference}),this._getOrCreateSymbol("parallelSign",t.view.effectiveTheme.accentColor))}visualizeRightAngleQuad(e,t){const r=h(),a=h(),c=P();p(r,e.centerVertex,e.previousVertex),p(a,e.nextVertex,e.previousVertex),b(c,r,a);const g=`rightAngleQuad${c[2]<0?45:225}`;return this._visualizeSnappingIndicator(new n({paths:[[e.previousVertex,e.centerVertex,e.nextVertex]],spatialReference:t.spatialReference}),this._getOrCreateSymbol(g,t.view.effectiveTheme.accentColor))}_visualizeSnappingIndicator(e,t){const r=new S({geometry:e,symbol:t});return this._graphicsLayer.add(r),u(()=>{this._graphicsLayer.remove(r)})}_getOrCreateSymbol(e,t){var a;const r=this._symbolPairingsByType;return((a=r.get(e))==null?void 0:a.color)!==t&&r.set(e,{color:t,symbol:x(e,t)}),r.get(e).symbol}}function x(i,e){const t=[...e.toRgb(),255*e.a];switch(i){case"point":return new m({outline:{width:.5,color:[0,0,0,1]},size:10,color:e});case"intersectionPoint":return new m({outline:new C({width:1.5,color:e}),size:15,color:[0,0,0,0]});case"line":return new o({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:d.Butt,joinStyle:M.Round,miterLimit:10,width:l(s.lineHintWidthTarget),color:t}]}}});case"parallelSign":return new o({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:-1,z:0},anchorPointUnits:"Relative",size:5,markerPlacement:{type:"CIMMarkerPlacementOnLine",placePerPart:!0,angleToLine:!0,relativeTo:"LineMiddle"},frame:{xmin:-5,ymin:-1.5,xmax:5,ymax:1.5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[7,0],[-7,0],[-7,1.5],[7,1.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t}]}}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:1,z:0},anchorPointUnits:"Relative",size:5,markerPlacement:{type:"CIMMarkerPlacementOnLine",placePerPart:!0,angleToLine:!0,relativeTo:"LineMiddle"},frame:{xmin:-5,ymin:-1.5,xmax:5,ymax:1.5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[7,0],[-7,0],[-7,-1.5],[7,-1.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t}]}}],scaleSymbolsProportionally:!0,respectFrame:!0}]}}});case"rightAngleQuad45":case"rightAngleQuad225":{const r=i==="rightAngleQuad45"?45:225;return new o({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:.5,y:.5,z:0},anchorPointUnits:"Relative",size:l(s.rightAngleHintSize),rotation:r,markerPlacement:{type:"CIMMarkerPlacementOnVertices",placePerPart:!0,angleToLine:!0,placeOnEndPoints:!1},frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[5,-5],[-5,-5],[-5,5],[5,5],[5,-5]]]},symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:l(s.rightAngleHintOutlineSize),color:t},{type:"CIMSolidFill",enable:!0,color:[...e.toRgb(),255*e.a*.4]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0}]}}})}}}export{w as S}; diff --git a/dist/assets/SnappingVisualizer2D-NnEm1PvQ.js b/dist/assets/SnappingVisualizer2D-NnEm1PvQ.js deleted file mode 100644 index a4077bd..0000000 --- a/dist/assets/SnappingVisualizer2D-NnEm1PvQ.js +++ /dev/null @@ -1 +0,0 @@ -import{T as y,N as n,a0 as p,a1 as b,S,a2 as u,a3 as o,a4 as l,a5 as s,a6 as d,a7 as M,J as m,a8 as C,a9 as h,aa as P}from"./index-J0iiHjMT.js";import{r as v}from"./SnappingContext-6K6JmvvY.js";class w extends v{constructor(e){super(),this._graphicsLayer=e,this._symbolPairingsByType=new Map}visualizeIntersectionPoint(e,t){return this._visualizeSnappingIndicator(new y({x:e.intersectionPoint[0],y:e.intersectionPoint[1],spatialReference:t.spatialReference}),this._getOrCreateSymbol("intersectionPoint",t.view.effectiveTheme.accentColor))}visualizePoint(e,t){return this._visualizeSnappingIndicator(new y({x:e.point[0],y:e.point[1],spatialReference:t.spatialReference}),this._getOrCreateSymbol("point",t.view.effectiveTheme.accentColor))}visualizeLine(e,t){return this._visualizeSnappingIndicator(new n({paths:[[e.lineStart,e.lineEnd]],spatialReference:t.spatialReference}),this._getOrCreateSymbol("line",t.view.effectiveTheme.accentColor))}visualizeParallelSign(e,t){return this._visualizeSnappingIndicator(new n({paths:[[e.lineStart,e.lineEnd]],spatialReference:t.spatialReference}),this._getOrCreateSymbol("parallelSign",t.view.effectiveTheme.accentColor))}visualizeRightAngleQuad(e,t){const a=h(),r=h(),c=P();p(a,e.centerVertex,e.previousVertex),p(r,e.nextVertex,e.previousVertex),b(c,a,r);const g=`rightAngleQuad${c[2]<0?45:225}`;return this._visualizeSnappingIndicator(new n({paths:[[e.previousVertex,e.centerVertex,e.nextVertex]],spatialReference:t.spatialReference}),this._getOrCreateSymbol(g,t.view.effectiveTheme.accentColor))}_visualizeSnappingIndicator(e,t){const a=new S({geometry:e,symbol:t});return this._graphicsLayer.add(a),u(()=>{this._graphicsLayer.remove(a)})}_getOrCreateSymbol(e,t){var r;const a=this._symbolPairingsByType;return((r=a.get(e))==null?void 0:r.color)!==t&&a.set(e,{color:t,symbol:I(e,t)}),a.get(e).symbol}}function I(i,e){const t=[...e.toRgb(),255*e.a];switch(i){case"point":return new m({outline:{width:.5,color:[0,0,0,1]},size:10,color:e});case"intersectionPoint":return new m({outline:new C({width:1.5,color:e}),size:15,color:[0,0,0,0]});case"line":return new o({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:d.Butt,joinStyle:M.Round,miterLimit:10,width:l(s.lineHintWidthTarget),color:t}]}}});case"parallelSign":return new o({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:-1,z:0},anchorPointUnits:"Relative",size:5,markerPlacement:{type:"CIMMarkerPlacementOnLine",placePerPart:!0,angleToLine:!0,relativeTo:"LineMiddle"},frame:{xmin:-5,ymin:-1.5,xmax:5,ymax:1.5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[7,0],[-7,0],[-7,1.5],[7,1.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t}]}}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:1,z:0},anchorPointUnits:"Relative",size:5,markerPlacement:{type:"CIMMarkerPlacementOnLine",placePerPart:!0,angleToLine:!0,relativeTo:"LineMiddle"},frame:{xmin:-5,ymin:-1.5,xmax:5,ymax:1.5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[7,0],[-7,0],[-7,-1.5],[7,-1.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t}]}}],scaleSymbolsProportionally:!0,respectFrame:!0}]}}});case"rightAngleQuad45":case"rightAngleQuad225":{const a=i==="rightAngleQuad45"?45:225;return new o({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:.5,y:.5,z:0},anchorPointUnits:"Relative",size:l(s.rightAngleHintSize),rotation:a,markerPlacement:{type:"CIMMarkerPlacementOnVertices",placePerPart:!0,angleToLine:!0,placeOnEndPoints:!1},frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[5,-5],[-5,-5],[-5,5],[5,5],[5,-5]]]},symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:l(s.rightAngleHintOutlineSize),color:t},{type:"CIMSolidFill",enable:!0,color:[...e.toRgb(),255*e.a*.4]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0}]}}})}}}export{w as S}; diff --git a/dist/assets/SnappingVisualizer3D-KWlqByBu.js b/dist/assets/SnappingVisualizer3D-KWlqByBu.js deleted file mode 100644 index 7e34a14..0000000 --- a/dist/assets/SnappingVisualizer3D-KWlqByBu.js +++ /dev/null @@ -1 +0,0 @@ -import{aa as O,b1 as k,b2 as g,aq as P,aE as j,aF as K,aU as Q,b4 as J,b5 as X,b6 as H,d as Y,b7 as ee,b8 as T,at as te,hJ as re,a0 as ie,bf as S,aK as V,bg as z,hK as E,hL as ae,hM as v,a9 as C,aR as q,bB as se,hG as F,fw as R,hN as I,hO as B,am as W,hP as oe,a5 as p,hQ as A,hR as $,ab as M,hS as ne,hT as ce,hU as de,bn as le,hV as he}from"./index-J0iiHjMT.js";import{G as ue,V as pe}from"./ExtendedLineVisualElement-YbjiXiBG.js";import{r as me}from"./vec4f32-NvfHy9q7.js";import{t as _e}from"./EngineVisualElement-eZNKTKsI.js";import{x as L}from"./PointVisualElement-bX-_4FqS.js";import{z as ge}from"./RightAngleQuadVisualElement-y_W8r903.js";import{r as fe}from"./SnappingContext-6K6JmvvY.js";let De=class extends _e{constructor(e){super(e),this._location=O(),this._direction=k(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=me(1,0,1,1),this._renderOccluded=g.OccludeAndTransparent,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:t=>this._createObject3DResources(t),destroyResources:t=>this._destroyObject3DResources(t),recreateGeometry:(t,r)=>this._recreateObject3DGeometry(t,r),cameraChanged:()=>this._updateGeometry()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:t=>this._destroyDrapedResources(t),recreateGeometry:t=>this._recreateDrapedGeometry(t)}}get location(){return this._location}set location(e){P(this._location,e)||(j(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){P(this._direction,e)||(j(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){K(this._direction,Q(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){J(e,this._color)||(X(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}_createObject3DResources(e){const t=new H(this.materialParameters),r=new Array;return this._createObject3DGeometry(t,e,r),{material:t,geometries:r,forEach:a=>{a(t),r.forEach(a)}}}_destroyObject3DResources(e){e.geometries.length=0}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,r){const[a,s]=this._createGeometries(e);t.addGeometry(a),t.addGeometry(s),r.push(a),r.push(s),this._updateVerticesObject3D(t)}_createDrapedResources(){const e=new H(this.materialParameters),t=Y(()=>this.view.state.contentPixelRatio,()=>{this.drapedResources.recreateGeometry()});return{material:e,geometries:this._createDrapedGeometry(e),pixelRatioHandle:t}}_destroyDrapedResources(e){e.pixelRatioHandle.remove(),e.geometries=[]}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){const t=this._createGeometries(e);return this._updateVerticesDraped(t),t.map(r=>new ee(r))}_createGeometries(e){return[T(e,[O(),O()]),T(e,[O(),O()])]}_updateMaterial(){var t,r;const{materialParameters:e}=this;(t=this.object3dResources.resources)==null||t.material.setParameters(e),(r=this.drapedResources.resources)==null||r.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this.view.state.camera;t.projectToScreen(this.location,x),te(m,this.location,this.direction),t.projectToScreen(m,b),re(b,ie(b,b,x)),this._updateVertexAttributesObject3D(t,e,0,x,b,1),this._updateVertexAttributesObject3D(t,e,1,x,b,-1)}_updateVertexAttributesObject3D(e,t,r,a,s,i){var d;const n=t.geometries[r],o=(d=n.getMutableAttribute(S.POSITION))==null?void 0:d.data;if(!o)return;const{start:l,end:h}=this._computeStartEnd(s,a,i,this.offset,this.width,this.length);e.unprojectFromScreen(V(l),m),o[0]=m[0],o[1]=m[1],o[2]=m[2],e.unprojectFromScreen(V(h),m),o[3]=m[0],o[4]=m[1],o[5]=m[2],t.geometryVertexAttributeUpdated(n,S.POSITION)}_updateVerticesDraped(e){const{view:{basemapTerrain:{overlayManager:t},state:{contentPixelRatio:r}}}=this,{location:a,width:s,length:i,offset:n}=this,o=Oe;o.spatialReference=t.renderer.spatialReference,o.x=a[0],o.y=a[1];const l=this.view.overlayPixelSizeInMapUnits(o)*r,h=s*l,d=i*l,_=n*l;this._updateVertexAttributesDraped(e[0],h,d,_,-1),this._updateVertexAttributesDraped(e[1],h,d,_,1)}_updateVertexAttributesDraped(e,t,r,a,s){var d;const i=(d=e.getMutableAttribute(S.POSITION))==null?void 0:d.data;if(!i)return;const{location:n,direction:o}=this,{start:l,end:h}=this._computeStartEnd(o,n,s,a,t,r);i[0]=l[0],i[1]=l[1],i[2]=z,i[3]=h[0],i[4]=h[1],i[5]=z,e.invalidateBoundingInfo()}_computeStartEnd(e,t,r,a,s,i){const n=E(N,ae(N,e[1]*r,e[0]*-r),a+s/2),o=v(w,v(w,v(w,t,E(w,e,i/2)),n),n);return{start:o,end:v(U,o,E(U,e,-i))}}};const m=O(),N=C(),w=C(),U=C(),x=q(),b=q(),Oe=se(0,0,void 0,null);class Ee extends fe{sortUniqueHints(e){return e.sort((t,r)=>(r instanceof F?r.length:0)-(t instanceof F?t.length:0))}visualizeIntersectionPoint(e,t){const{spatialReference:r,view:a}=t,s=y(t);return R(new L({view:a,primitive:"circle",geometry:I(e.intersectionPoint,r),elevationInfo:e.isDraped?B:W,size:20,outlineSize:2,color:s.intersectionPointColor,outlineColor:s.intersectionPointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizePoint(e,t){const{view:r,spatialReference:a}=t,s=y(t),i=f(e.point,e.domain,t);return R(new L({view:r,primitive:"circle",geometry:I(i,a),elevationInfo:G(e,t),size:20,outlineSize:2,color:s.pointColor,outlineColor:s.pointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizeLine(e,t){const{view:r,spatialReference:a}=t,s=y(t),i=f(e.lineStart,e.domain,t),n=f(e.lineEnd,e.domain,t);return R(this._createLineSegmentHint(e.type,i,n,a,G(e,t),r,s,e.isDraped,e.fadeLeft,e.fadeRight))}visualizeParallelSign(e,t){const{view:r,spatialReference:a}=t,s=y(t),{isDraped:i}=e,n=G(e,t),o=f(e.lineStart,e.domain,t),l=f(e.lineEnd,e.domain,t),h=D(o,a,n,r,i),d=D(l,a,n,r,i),_=oe(d,h,d,.5),u=new De({view:r,attached:!1,offset:p.parallelLineHintOffset,length:p.parallelLineHintLength,width:p.parallelLineHintWidth,color:s.parallelSignColor,location:_,renderOccluded:i?g.OccludeAndTransparent:g.Opaque,isDraped:i,renderGroup:A.SnappingHint,isDecoration:!0});return u.setDirectionFromPoints(h,_),u.attached=!0,R(u)}visualizeRightAngleQuad(e,t){const{view:r,spatialReference:a}=t,s=y(t),i=G(e,t),{isDraped:n}=e,o=f(e.previousVertex,e.domain,t),l=f(e.centerVertex,e.domain,t),h=f(e.nextVertex,e.domain,t),d=D(o,a,i,r,n),_=D(l,a,i,r,n),u=D(h,a,i,r,n);return R(new ge({view:r,attached:!0,color:n?s.rightAngleColorDraped:s.rightAngleColor,renderOccluded:n?g.OccludeAndTransparent:g.Transparent,outlineRenderOccluded:n?g.OccludeAndTransparent:g.Opaque,outlineColor:s.rightAngleOutlineColor,outlineSize:p.rightAngleHintOutlineSize,size:p.rightAngleHintSize,isDraped:n,geometry:{previous:d,center:_,next:u},renderGroup:A.SnappingHint,isDecoration:!0}))}_createLineSegmentHint(e,t,r,a,s,i,n,o=!1,l=!0,h=!0){const d=D(t,a,s,i,o),_=D(r,a,s,i,o),u=new ue({view:i,extensionType:pe.FADED,start:d,end:_,isDraped:o,color:n.lineColor,renderOccluded:o?g.OccludeAndTransparent:g.Opaque,renderGroup:A.SnappingHint,isDecoration:!0});switch(e){case $.TARGET:u.width=p.lineHintWidthTarget,u.fadedExtensions={start:0,end:p.lineHintFadedExtensions};break;case $.REFERENCE_EXTENSION:u.width=p.lineHintWidthReference,u.fadedExtensions={start:0,end:0};break;case $.REFERENCE:u.width=p.lineHintWidthReference,u.fadedExtensions={start:l?p.lineHintFadedExtensions:0,end:h?p.lineHintFadedExtensions:0}}return u.attached=!0,u}}function y(c){const{effectiveTheme:e}=c.view,t=M.toUnitRGBA(e.accentColor),r=[0,0,0,0];return{intersectionPointColor:r,intersectionPointOutlineColor:t,pointColor:r,pointOutlineColor:t,lineColor:t,lineOutlineColor:void 0,parallelSignColor:t,rightAngleColor:t,rightAngleColorDraped:M.toUnitRGBA(ne(e.accentColor,.5)),rightAngleOutlineColor:t}}function f(c,e,t){const r=Z(e,t);return r==null?c:ce(c[0],c[1],r)}function G(c,e){return Z(c.domain,e)!=null?e.selfSnappingZ.elevationInfo:c.isDraped?B:W}function Z(c,{selfSnappingZ:e}){return c===de.SELF&&e!=null?e.value:null}function D(c,e,t,r,a,s=O()){if(a){const i=r.basemapTerrain.overlayManager.renderer.spatialReference;le(c,e,s,i)}else he(c,e,t,r,s);return s}export{Ee as O}; diff --git a/dist/assets/SnappingVisualizer3D-PUGfSdbO.js b/dist/assets/SnappingVisualizer3D-PUGfSdbO.js new file mode 100644 index 0000000..a9675ee --- /dev/null +++ b/dist/assets/SnappingVisualizer3D-PUGfSdbO.js @@ -0,0 +1 @@ +import{a8 as D,b1 as k,b2 as g,b6 as P,b3 as j,bL as Q,b4 as J,b7 as K,b8 as X,b9 as H,B as Y,ba as ee,bb as T,bO as te,hH as re,Z as ie,bi as G,bZ as V,bj as z,hI as A,hJ as se,hK as v,a7 as C,c3 as W,bU as ae,hL as I,fr as R,hM as F,hN as Z,bm as q,hO as oe,a3 as p,hP as E,hQ as $,W as L,hR as ne,hS as ce,hT as de,bx as le,hU as he}from"./index-pCX-0tJH.js";import{G as ue,V as pe}from"./ExtendedLineVisualElement-VJvEdv3K.js";import{r as me}from"./vec4f32-NvfHy9q7.js";import{t as _e}from"./EngineVisualElement-u0-BOxGn.js";import{x as M}from"./PointVisualElement-m9C0-AJh.js";import{z as ge}from"./RightAngleQuadVisualElement-Jj11oqLR.js";import{r as fe}from"./SnappingContext-ax0tf6c6.js";let be=class extends _e{constructor(e){super(e),this._location=D(),this._direction=k(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=me(1,0,1,1),this._renderOccluded=g.OccludeAndTransparent,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:t=>this._createObject3DResources(t),destroyResources:t=>this._destroyObject3DResources(t),recreateGeometry:(t,r)=>this._recreateObject3DGeometry(t,r),cameraChanged:()=>this._updateGeometry()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:t=>this._destroyDrapedResources(t),recreateGeometry:t=>this._recreateDrapedGeometry(t)}}get location(){return this._location}set location(e){P(this._location,e)||(j(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){P(this._direction,e)||(j(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){Q(this._direction,J(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){K(e,this._color)||(X(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}_createObject3DResources(e){const t=new H(this.materialParameters),r=new Array;return this._createObject3DGeometry(t,e,r),{material:t,geometries:r,forEach:s=>{s(t),r.forEach(s)}}}_destroyObject3DResources(e){e.geometries.length=0}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,r){const[s,a]=this._createGeometries(e);t.addGeometry(s),t.addGeometry(a),r.push(s),r.push(a),this._updateVerticesObject3D(t)}_createDrapedResources(){const e=new H(this.materialParameters),t=Y(()=>this.view.state.contentPixelRatio,()=>{this.drapedResources.recreateGeometry()});return{material:e,geometries:this._createDrapedGeometry(e),pixelRatioHandle:t}}_destroyDrapedResources(e){e.pixelRatioHandle.remove(),e.geometries=[]}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){const t=this._createGeometries(e);return this._updateVerticesDraped(t),t.map(r=>new ee(r))}_createGeometries(e){return[T(e,[D(),D()]),T(e,[D(),D()])]}_updateMaterial(){var t,r;const{materialParameters:e}=this;(t=this.object3dResources.resources)==null||t.material.setParameters(e),(r=this.drapedResources.resources)==null||r.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{const e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){const t=this.view.state.camera;t.projectToScreen(this.location,x),te(m,this.location,this.direction),t.projectToScreen(m,O),re(O,ie(O,O,x)),this._updateVertexAttributesObject3D(t,e,0,x,O,1),this._updateVertexAttributesObject3D(t,e,1,x,O,-1)}_updateVertexAttributesObject3D(e,t,r,s,a,i){var d;const n=t.geometries[r],o=(d=n.getMutableAttribute(G.POSITION))==null?void 0:d.data;if(!o)return;const{start:l,end:h}=this._computeStartEnd(a,s,i,this.offset,this.width,this.length);e.unprojectFromScreen(V(l),m),o[0]=m[0],o[1]=m[1],o[2]=m[2],e.unprojectFromScreen(V(h),m),o[3]=m[0],o[4]=m[1],o[5]=m[2],t.geometryVertexAttributeUpdated(n,G.POSITION)}_updateVerticesDraped(e){const{view:{basemapTerrain:{overlayManager:t},state:{contentPixelRatio:r}}}=this,{location:s,width:a,length:i,offset:n}=this,o=De;o.spatialReference=t.renderer.spatialReference,o.x=s[0],o.y=s[1];const l=this.view.overlayPixelSizeInMapUnits(o)*r,h=a*l,d=i*l,_=n*l;this._updateVertexAttributesDraped(e[0],h,d,_,-1),this._updateVertexAttributesDraped(e[1],h,d,_,1)}_updateVertexAttributesDraped(e,t,r,s,a){var d;const i=(d=e.getMutableAttribute(G.POSITION))==null?void 0:d.data;if(!i)return;const{location:n,direction:o}=this,{start:l,end:h}=this._computeStartEnd(o,n,a,s,t,r);i[0]=l[0],i[1]=l[1],i[2]=z,i[3]=h[0],i[4]=h[1],i[5]=z,e.invalidateBoundingInfo()}_computeStartEnd(e,t,r,s,a,i){const n=A(N,se(N,e[1]*r,e[0]*-r),s+a/2),o=v(w,v(w,v(w,t,A(w,e,i/2)),n),n);return{start:o,end:v(U,o,A(U,e,-i))}}};const m=D(),N=C(),w=C(),U=C(),x=W(),O=W(),De=ae(0,0,void 0,null);class Ae extends fe{sortUniqueHints(e){return e.sort((t,r)=>(r instanceof I?r.length:0)-(t instanceof I?t.length:0))}visualizeIntersectionPoint(e,t){const{spatialReference:r,view:s}=t,a=y(t);return R(new M({view:s,primitive:"circle",geometry:F(e.intersectionPoint,r),elevationInfo:e.isDraped?Z:q,size:20,outlineSize:2,color:a.intersectionPointColor,outlineColor:a.intersectionPointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizePoint(e,t){const{view:r,spatialReference:s}=t,a=y(t),i=f(e.point,e.domain,t);return R(new M({view:r,primitive:"circle",geometry:F(i,s),elevationInfo:S(e,t),size:20,outlineSize:2,color:a.pointColor,outlineColor:a.pointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizeLine(e,t){const{view:r,spatialReference:s}=t,a=y(t),i=f(e.lineStart,e.domain,t),n=f(e.lineEnd,e.domain,t);return R(this._createLineSegmentHint(e.type,i,n,s,S(e,t),r,a,e.isDraped,e.fadeLeft,e.fadeRight))}visualizeParallelSign(e,t){const{view:r,spatialReference:s}=t,a=y(t),{isDraped:i}=e,n=S(e,t),o=f(e.lineStart,e.domain,t),l=f(e.lineEnd,e.domain,t),h=b(o,s,n,r,i),d=b(l,s,n,r,i),_=oe(d,h,d,.5),u=new be({view:r,attached:!1,offset:p.parallelLineHintOffset,length:p.parallelLineHintLength,width:p.parallelLineHintWidth,color:a.parallelSignColor,location:_,renderOccluded:i?g.OccludeAndTransparent:g.Opaque,isDraped:i,renderGroup:E.SnappingHint,isDecoration:!0});return u.setDirectionFromPoints(h,_),u.attached=!0,R(u)}visualizeRightAngleQuad(e,t){const{view:r,spatialReference:s}=t,a=y(t),i=S(e,t),{isDraped:n}=e,o=f(e.previousVertex,e.domain,t),l=f(e.centerVertex,e.domain,t),h=f(e.nextVertex,e.domain,t),d=b(o,s,i,r,n),_=b(l,s,i,r,n),u=b(h,s,i,r,n);return R(new ge({view:r,attached:!0,color:n?a.rightAngleColorDraped:a.rightAngleColor,renderOccluded:n?g.OccludeAndTransparent:g.Transparent,outlineRenderOccluded:n?g.OccludeAndTransparent:g.Opaque,outlineColor:a.rightAngleOutlineColor,outlineSize:p.rightAngleHintOutlineSize,size:p.rightAngleHintSize,isDraped:n,geometry:{previous:d,center:_,next:u},renderGroup:E.SnappingHint,isDecoration:!0}))}_createLineSegmentHint(e,t,r,s,a,i,n,o=!1,l=!0,h=!0){const d=b(t,s,a,i,o),_=b(r,s,a,i,o),u=new ue({view:i,extensionType:pe.FADED,start:d,end:_,isDraped:o,color:n.lineColor,renderOccluded:o?g.OccludeAndTransparent:g.Opaque,renderGroup:E.SnappingHint,isDecoration:!0});switch(e){case $.TARGET:u.width=p.lineHintWidthTarget,u.fadedExtensions={start:0,end:p.lineHintFadedExtensions};break;case $.REFERENCE_EXTENSION:u.width=p.lineHintWidthReference,u.fadedExtensions={start:0,end:0};break;case $.REFERENCE:u.width=p.lineHintWidthReference,u.fadedExtensions={start:l?p.lineHintFadedExtensions:0,end:h?p.lineHintFadedExtensions:0}}return u.attached=!0,u}}function y(c){const{effectiveTheme:e}=c.view,t=L.toUnitRGBA(e.accentColor),r=[0,0,0,0];return{intersectionPointColor:r,intersectionPointOutlineColor:t,pointColor:r,pointOutlineColor:t,lineColor:t,lineOutlineColor:void 0,parallelSignColor:t,rightAngleColor:t,rightAngleColorDraped:L.toUnitRGBA(ne(e.accentColor,.5)),rightAngleOutlineColor:t}}function f(c,e,t){const r=B(e,t);return r==null?c:ce(c[0],c[1],r)}function S(c,e){return B(c.domain,e)!=null?e.selfSnappingZ.elevationInfo:c.isDraped?Z:q}function B(c,{selfSnappingZ:e}){return c===de.SELF&&e!=null?e.value:null}function b(c,e,t,r,s,a=D()){if(s){const i=r.basemapTerrain.overlayManager.renderer.spatialReference;le(c,e,a,i)}else he(c,e,t,r,a);return a}export{Ae as O}; diff --git a/dist/assets/SpatialFilter-CXhA7RaJ.js b/dist/assets/SpatialFilter-h73GoH-a.js similarity index 96% rename from dist/assets/SpatialFilter-CXhA7RaJ.js rename to dist/assets/SpatialFilter-h73GoH-a.js index c150101..7fad739 100644 --- a/dist/assets/SpatialFilter-CXhA7RaJ.js +++ b/dist/assets/SpatialFilter-h73GoH-a.js @@ -1 +1 @@ -import{x as T,n as f,t as g,s as m,a as y,r as J}from"./WhereClause-XAMIZ4-B.js";import{D as X,ag as h,ah as P,ai as k,aj as L,ak as x,al as O,am as ee,an as te,ao as ne,ap as ae,aq as F,ar as re,as as se,at as G,au as B,av as H}from"./arcadeUtils-OUqwHs4P.js";import{n as M,m as ie,b as W}from"./TimeOnly-ljWtUK7N.js";import{mA as le,ar as oe,eQ as ue,fx as Z}from"./index-J0iiHjMT.js";import{union as ce,geodesicArea as he,planarArea as de,geodesicLength as pe,planarLength as _e,relate as fe,crosses as ge,touches as me,within as ye,overlaps as Se,contains as we,intersects as Q}from"./geometryEngineAsync-QjQc0riy.js";class E{constructor(){this._databaseTypeMetaData={},this._layerInfo={}}clearDatabaseType(e){this._databaseTypeMetaData[e]===void 0&&delete this._databaseTypeMetaData[e]}getDatabaseType(e){return e==="MUSTBESET"||this._databaseTypeMetaData[e]===void 0?null:this._databaseTypeMetaData[e]}setDatabaseType(e,t){this._databaseTypeMetaData[e]=t}getLayerInfo(e){return this._layerInfo[e]===void 0?null:this._layerInfo[e]}setLayerInfo(e,t){this._layerInfo[e]=t}clearLayerInfo(e){this._layerInfo[e]!==void 0&&delete this._layerInfo[e]}}E.applicationCache=null;class Te{constructor(e,t){this._lastId=-1,this._progress=t,this._parent=e}reset(){this._lastId=-1}async nextBatchAsArcadeFeatures(e,t){const n=await this.nextBatch(e);return n===null?n:n.map(a=>X.createFromGraphicLikeObject(a.geometry,a.attributes,this._parent,t))}nextBatch(e){if(this._parent._mainSetInUse!==null)return this._parent._mainSetInUse.then(a=>this.nextBatch(e),a=>this.nextBatch(e));const t={returnpromise:null,hasset:!1},n=[];return t.returnpromise=new Promise((a,s)=>{this._parent._getSet(this._progress).then(i=>{const l=i._known;let o=l.length-1;if(l[l.length-1]==="GETPAGES"&&(o-=1),this._lastId+e>o&&l.length>0&&l[l.length-1]==="GETPAGES")return void this._parent._expandPagedSet(i,this._parent._maxQueryRate(),0,0,this._progress).then(c=>{t.hasset=!0,this._parent._mainSetInUse=null,this.nextBatch(e).then(a,s)},c=>{t.hasset=!0,this._parent._mainSetInUse=null,s(c)});const u=i._candidates;if(o>=this._lastId+e||u.length===0){for(let c=0;c=l.length)break;n[c]=l[p]}return this._lastId+=n.length,n.length===0&&(t.hasset=!0,this._parent._mainSetInUse=null,a([])),void this._parent._getFeatureBatch(n,this._progress).then(c=>{t.hasset=!0,this._parent._mainSetInUse=null,a(c)},c=>{t.hasset=!0,this._parent._mainSetInUse=null,s(c)})}this._parent._refineSetBlock(i,this._parent._maxProcessingRate(),this._progress).then(()=>{t.hasset=!0,this._parent._mainSetInUse=null,this.nextBatch(e).then(a,s)},c=>{t.hasset=!0,this._parent._mainSetInUse=null,s(c)})},i=>{t.hasset=!0,this._parent._mainSetInUse=null,s(i)})}),t.hasset===!1&&(this._parent._mainSetInUse=t.returnpromise,t.hasset=!0),t.returnpromise}next(){if(this._parent._mainSetInUse!==null)return this._parent._mainSetInUse.then(t=>this.next(),t=>this.next());const e={returnpromise:null,hasset:!1};return e.returnpromise=new Promise((t,n)=>{this._parent._getSet(this._progress).then(a=>{const s=a._known;this._lastId(e.hasset=!0,this._parent._mainSetInUse=null,this.next())).then(t,n):(this._lastId+=1,this._parent._getFeature(a,s[this._lastId],this._progress).then(i=>{e.hasset=!0,this._parent._mainSetInUse=null,t(i)},i=>{e.hasset=!0,this._parent._mainSetInUse=null,n(i)})):a._candidates.length>0?this._parent._refineSetBlock(a,this._parent._maxProcessingRate(),this._progress).then(()=>{e.hasset=!0,this._parent._mainSetInUse=null,this.next().then(t,n)},i=>{e.hasset=!0,this._parent._mainSetInUse=null,n(i)}):(e.hasset=!0,this._parent._mainSetInUse=null,t(null))},a=>{e.hasset=!0,this._parent._mainSetInUse=null,n(a)})}),e.hasset===!1&&(this._parent._mainSetInUse=e.returnpromise,e.hasset=!0),e.returnpromise}async count(){if(this._parent._totalCount!==-1)return this._parent._totalCount;const e=await this._parent._getSet(this._progress),t=await this._refineAllSets(e);return this._parent._totalCount=t._known.length,this._parent._totalCount}async _refineAllSets(e){if(e._known.length>0&&e._known[e._known.length-1]==="GETPAGES")return await this._parent._expandPagedSet(e,this._parent._maxQueryRate(),0,1,this._progress),this._refineAllSets(e);if(e._candidates.length>0){if(e._known[e._candidates.length-1]==="GETPAGES")return await this._parent._expandPagedSet(e,this._parent._maxQueryRate(),0,2,this._progress),this._refineAllSets(e);const t=await this._parent._refineSetBlock(e,this._parent._maxProcessingRate(),this._progress);return t._candidates.length>0?this._refineAllSets(t):t}return e}}class D{constructor(e,t,n,a){this._lastFetchedIndex=0,this._ordered=!1,this.pagesDefinition=null,this._candidates=e,this._known=t,this._ordered=n,this.pagesDefinition=a}}function Y(r,e){return d(r==null?void 0:r.parseTree,e,r==null?void 0:r.parameters)}function Ze(r,e,t){return d(r,e,t)}function Qe(r,e,t,n){return T.create(d(r.parseTree,h.Standardised,r.parameters,e,t),n,r.timeZone)}function Ye(r,e,t="AND"){return T.create("(("+Y(r,h.Standardised)+")"+t+"("+Y(e,h.Standardised)+"))",r.fieldsIndex,r.timeZone)}function d(r,e,t,n=null,a=null){let s,i,l,o;switch(r.type){case"interval":return Ee(d(r.value,e,t,n,a),r.qualifier,r.op);case"case-expression":{let u=" CASE ";r.format==="simple"&&(u+=d(r.operand,e,t,n,a));for(let c=0;c":case"<":case">":case">=":case"<=":case"=":case"*":case"-":case"+":case"/":return" ("+d(r.left,e,t,n,a)+" "+r.operator+" "+d(r.right,e,t,n,a)+") ";case"||":return" ("+d(r.left,e,t,n,a)+" "+(e===h.SqlServer?"+":r.operator)+" "+d(r.right,e,t,n,a)+") "}throw new f(g.UnsupportedOperator,{operator:r.operator});case"null":return"null";case"boolean":return r.value===!0?"1":"0";case"string":return"'"+r.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${r.value}'`;case"date":return`date '${r.value}'`;case"time":return`time '${r.value}'`;case"number":return r.value.toString();case"current-time":return Fe(r.mode==="date",e);case"column-reference":return n?n.toLowerCase()===r.column.toLowerCase()?"("+a+")":r.delimited===!0?`"${r.column.split('"').join('""')}"`:r.column:r.column;case"data-type":return r.value;case"function":{const u=d(r.args,e,t,n,a);return Ie(r.name,u,e)}}throw new f(g.UnsupportedSyntax,{node:r.type})}function Ie(r,e,t){switch(r.toLowerCase().trim()){case"cos":case"sin":case"tan":case"cosh":case"tanh":case"sinh":case"acos":case"asin":case"atan":case"floor":case"log10":case"log":case"abs":if(e.length!==1)throw new f(g.InvalidFunctionParameters,{function:r.toLowerCase().trim()});return`${r.toUpperCase().trim()}(${e[0]})`;case"ceiling":case"ceil":if(e.length!==1)throw new f(g.InvalidFunctionParameters,{function:"ceiling"});switch(t){case h.Standardised:case h.StandardisedNoInterval:}return"CEILING("+e[0]+")";case"mod":case"power":case"nullif":if(e.length!==2)throw new f(g.InvalidFunctionParameters,{function:r.toLowerCase().trim()});return`${r.toUpperCase().trim()}(${e[0]},${e[1]})`;case"round":if(e.length===2)return"ROUND("+e[0]+","+e[1]+")";if(e.length===1)return"ROUND("+e[0]+")";throw new f(g.InvalidFunctionParameters,{function:"round"});case"truncate":if(e.length<1||e.length>2)throw new f(g.InvalidFunctionParameters,{function:"truncate"});return t===h.SqlServer?"ROUND("+e[0]+(e.length===1?"0":","+e[1])+",1)":"TRUNCATE("+e[0]+(e.length===1?")":","+e[1]+")");case"char_length":case"len":if(e.length!==1)throw new f(g.InvalidFunctionParameters,{function:"char_length"});switch(t){case h.SqlServer:return"LEN("+e[0]+")";case h.Oracle:return"LENGTH("+e[0]+")";default:return"CHAR_LENGTH("+e[0]+")"}case"coalesce":case"concat":{if(e.length<1)throw new f(g.InvalidFunctionParameters,{function:r.toLowerCase()});let n=r.toUpperCase().trim()+"(";for(let a=0;a":case"<":case">":case">=":case"<=":case"=":return"boolean";case"IS":case"ISNOT":if(e.right.type!=="null")throw new f(g.UnsupportedIsRhs);return"boolean";case"*":case"-":case"+":case"/":return C([S(r,e.left,t,n),S(r,e.right,t,n)]);case"||":return"string";default:throw new f(g.UnsupportedOperator,{operator:e.operator})}case"null":return"";case"boolean":return"boolean";case"string":return"string";case"number":return e.value===null?"":e.value%1==0?"integer":"double";case"date":return"date";case"timestamp":return e.withtimezone?"timestamp-offset":"date";case"time":return"time-only";case"current-time":return"date";case"column-reference":{const c=r[e.column.toLowerCase()];return c===void 0?"":c}case"function":switch(e.name.toLowerCase()){case"cast":switch(((i=(s=e.args)==null?void 0:s.value[1])==null?void 0:i.value.type)??""){case"integer":case"smallint":return"integer";case"real":case"float":return"double";case"date":case"timestamp":return((u=(o=(l=e.args)==null?void 0:l.value[1])==null?void 0:o.value)==null?void 0:u.withtimezone)===!0?"timestamp-offset":"date";case"time":return"time-only";case"varchar":return"string";default:return""}case"position":case"extract":case"char_length":case"mod":return"integer";case"round":if(a=S(r,e.args,t,n),a instanceof Array){if(a.length<=0)return"double";a=a[0]}return a;case"sign":return"integer";case"ceiling":case"floor":case"abs":return a=S(r,e.args,t,n),a instanceof Array&&(a=C(a)),a==="integer"||a==="double"?a:"double";case"area":case"length":case"log":case"log10":case"sin":case"cos":case"tan":case"asin":case"acos":case"atan":case"cosh":case"sinh":case"tanh":case"power":return"double";case"substring":case"trim":case"concat":case"lower":case"upper":return"string";case"truncate":return"double";case"nullif":case"coalesce":return a=S(r,e.args,t,n),a instanceof Array?a.length>0?a[0]:"":a}return""}throw new f(g.UnsupportedSyntax,{node:e.type})}const V={boolean:1,string:2,integer:3,double:4,date:5};function C(r){if(r){let e="";for(const t of r)t!==""&&(e=e===""||V[e]=e&&e!==-1)return t}return t}function qe(r){switch(r.toLowerCase()){case"distinct":return"distinct";case"avg":case"mean":return"avg";case"min":return"min";case"sum":return"sum";case"max":return"max";case"stdev":case"stddev":return"stddev";case"var":case"variance":return"var";case"count":return"count"}return""}function Ve(r,e,t=1e3){switch(r.toLowerCase()){case"distinct":return Ae(e,t);case"avg":case"mean":return A(e);case"min":return Math.min.apply(Math,e);case"sum":return $(e);case"max":return Math.max.apply(Math,e);case"stdev":case"stddev":return Math.sqrt(j(e));case"var":case"variance":return j(e);case"count":return e.length}return 0}async function Re(r,e,t){const n=await v(r,e,t,!0);return n.length===0?null:Math.min.apply(Math,n)}async function Ce(r,e,t){const n=await v(r,e,t,!0);return n.length===0?null:Math.max.apply(Math,n)}async function Ne(r,e,t){let n="";e&&!De(e)&&(n=be(e,r.fields));const a=await v(r,e,t,!0);if(a.length===0)return null;const s=A(a);return s===null?s:n==="integer"?ve(s):s}async function Pe(r,e,t){const n=await v(r,e,t,!0);return n.length===0?null:z(n)}async function ke(r,e,t){const n=await v(r,e,t,!0);return n.length===0?null:Math.sqrt(z(n))}async function Le(r,e,t){const n=await v(r,e,t,!0);return n.length===0?null:$(n)}async function xe(r,e){return r.iterator(e).count()}async function v(r,e,t,n=!1){const a=r.iterator(t),s=[],i={ticker:0};let l=await a.next();for(;l!==null;){if(i.ticker++,t.aborted)throw new m(y.Cancelled);i.ticker%100==0&&(i.ticker=0,await new Promise(u=>{setTimeout(u,0)}));const o=e==null?void 0:e.calculateValue(l);o===null?n===!1&&(s[s.length]=o):s[s.length]=o instanceof W||o instanceof M?o.toNumber():o instanceof J?o.toMilliseconds():o,l=await a.next()}return s}async function Oe(r,e,t=1e3,n=null){const a=r.iterator(n),s=[],i={},l={ticker:0};let o=await a.next();for(;o!==null;){if(l.ticker++,n&&n.aborted)throw new m(y.Cancelled);l.ticker%100==0&&(l.ticker=0,await new Promise(p=>{setTimeout(p,0)}));const u=e==null?void 0:e.calculateValue(o);let c=u;if(u instanceof W?c="!!DATEONLY!!-"+u.toString():u instanceof J?c="!!TSOFFSETONLY!!-"+u.toString():u instanceof M?c="!!TIMEONLY!!-"+u.toString():u instanceof Date&&(c="!!DATE!!-"+u.toString()),u!=null&&i[c]===void 0&&(s.push(u),i[c]=1),s.length>=t&&t!==-1)return s;o=await a.next()}return s}class _{constructor(e){this.recentlyUsedQueries=null,this.featureSetQueryInterceptor=null,this._idstates=[],this._parent=null,this._wset=null,this._mainSetInUse=null,this._maxProcessing=200,this._maxQuery=500,this._totalCount=-1,this._databaseType=h.NotEvaluated,this._databaseTypeProbed=null,this.declaredRootClass="esri.arcade.featureset.support.FeatureSet",this._featureCache=[],this.typeIdField=null,this.types=null,this.fields=null,this.geometryType="",this.objectIdField="",this.globalIdField="",this.spatialReference=null,this.hasM=!1,this.hasZ=!1,this._transparent=!1,this.loaded=!1,this._loadPromise=null,this._fieldsIndex=null,this.fsetInfo=null,e!=null&&e.lrucache&&(this.recentlyUsedQueries=e.lrucache),e!=null&&e.interceptor&&(this.featureSetQueryInterceptor=e.interceptor)}optimisePagingFeatureQueries(e){this._parent&&this._parent.optimisePagingFeatureQueries(e)}_hasMemorySource(){return!0}prop(e,t){return t===void 0?this[e]:(this[e]!==void 0&&(this[e]=t),this)}end(){return this._parent!==null&&this._parent._transparent===!0?this._parent.end():this._parent}_ensureLoaded(){return this.load()}load(){return this._loadPromise===null&&(this._loadPromise=this.loadImpl()),this._loadPromise}async loadImpl(){var e,t;return((e=this._parent)==null?void 0:e.loaded)===!0?(this._initialiseFeatureSet(),this):(await((t=this._parent)==null?void 0:t.load()),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){this._parent!==null?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.fields=[],this.typeIdField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new oe({wkid:4326}),this.geometryType=ae.point)}getField(e,t){let n;return(t=t||this.fields)&&(e=e.toLowerCase(),t.some(a=>(a&&a.name.toLowerCase()===e&&(n=a),!!n))),n}getFieldsIndex(){return this._fieldsIndex===null&&(this._fieldsIndex=ue.fromLayer({timeInfo:this.timeInfo,editFieldsInfo:this.editFieldsInfo,dateFieldsTimeZone:this.dateFieldsTimeZone,datesInUnknownTimezone:this.datesInUnknownTimezone,fields:this.fields})),this._fieldsIndex}_maxProcessingRate(){return this._parent!==null?Math.min(this._maxProcessing,this._parent._maxProcessingRate()):Math.min(this._maxProcessing,this._maxQueryRate())}_maxQueryRate(){return this._parent!==null?Math.max(this._maxQuery,this._parent._maxQueryRate()):this._maxQuery}_checkCancelled(e){if(e!=null&&e.aborted)throw new m(y.Cancelled)}nativeCapabilities(){return this._parent.nativeCapabilities()}async _canDoAggregates(e,t,n,a,s){return this._parent!==null&&this._parent._canDoAggregates(e,t,n,a,s)}async _getAggregatePagesDataSourceDefinition(e,t,n,a,s,i,l){if(this._parent===null)throw new m(y.NeverReach);return this._parent._getAggregatePagesDataSourceDefinition(e,t,n,a,s,i,l)}async _getAgregagtePhysicalPage(e,t,n){if(this._parent===null)throw new m(y.NeverReach);return this._parent._getAgregagtePhysicalPage(e,t,n)}async databaseType(){if(this._databaseType===h.NotEvaluated){if(E.applicationCache!==null){const e=E.applicationCache.getDatabaseType(this._cacheableFeatureSetSourceKey());if(e!==null)return e}if(this._databaseTypeProbed!==null)return this._databaseTypeProbed;try{this._databaseTypeProbed=this._getDatabaseTypeImpl(),E.applicationCache!==null&&E.applicationCache.setDatabaseType(this._cacheableFeatureSetSourceKey(),this._databaseTypeProbed)}catch(e){throw E.applicationCache!==null&&E.applicationCache.clearDatabaseType(this._cacheableFeatureSetSourceKey()),e}return this._databaseTypeProbed}return this._databaseType}async _getDatabaseTypeImpl(){const e=[{thetype:h.SqlServer,testwhere:"(CAST( '2015-01-01' as DATETIME) = CAST( '2015-01-01' as DATETIME)) AND OBJECTID<0"},{thetype:h.Oracle,testwhere:"(TO_DATE('2003-11-18','YYYY-MM-DD') = TO_DATE('2003-11-18','YYYY-MM-DD')) AND OBJECTID<0"},{thetype:h.StandardisedNoInterval,testwhere:"(date '2015-01-01 10:10:10' = date '2015-01-01 10:10:10') AND OBJECTID<0"}];for(const t of e)if(await this._runDatabaseProbe(t.testwhere)===!0)return t.thetype;return h.StandardisedNoInterval}_cacheableFeatureSetSourceKey(){return"MUSTBESET"}async _runDatabaseProbe(e){if(this._parent!==null)return this._parent._runDatabaseProbe(e);throw new m(y.NotImplemented)}isTable(){var e;return((e=this._parent)==null?void 0:e.isTable())??!1}_featureFromCache(e){if(this._featureCache[e]!==void 0)return this._featureCache[e]}_isInFeatureSet(e){return F.Unknown}_getSet(e){throw new m(y.NotImplemented)}async _getFeature(e,t,n){if(this._checkCancelled(n),this._featureFromCache(t)!==void 0)return this._featureFromCache(t);if(await this._getFeatures(e,t,this._maxProcessingRate(),n),this._checkCancelled(n),this._featureFromCache(t)!==void 0)return this._featureFromCache(t);throw new m(y.MissingFeatures)}async _getFeatureBatch(e,t){this._checkCancelled(t);const n=new D([],e,!1,null),a=[];await this._getFeatures(n,-1,e.length,t),this._checkCancelled(t);for(const s of e)this._featureFromCache(s)!==void 0&&a.push(this._featureFromCache(s));return a}async _getFeatures(e,t,n,a){return"success"}_getFilteredSet(e,t,n,a,s){throw new m(y.NotImplemented)}async _refineSetBlock(e,t,n){if(this._checkIfNeedToExpandCandidatePage(e,this._maxQueryRate())===!0)return await this._expandPagedSet(e,this._maxQueryRate(),0,0,n),this._refineSetBlock(e,t,n);this._checkCancelled(n);const a=e._candidates.length;this._refineKnowns(e,t);let s=a-e._candidates.length;if(e._candidates.length===0||s>=t)return e;if(await this._refineIfParentKnown(e,t-s,n),this._checkCancelled(n),this._refineKnowns(e,t-s),s=a-e._candidates.length,s0){const i=t-s,l=this._prepareFetchAndRefineSet(e._candidates);return await this._fetchAndRefineFeatures(l,l.length>i?i:e._candidates.length,n),this._checkCancelled(n),this._refineKnowns(e,t-s),e}return e}_fetchAndRefineFeatures(e,t,n){return null}_prepareFetchAndRefineSet(e){const t=[];for(let n=0;n=t)break}a!==null&&s.push(a);for(let i=s.length-1;i>=0;i--)e._candidates.splice(s[i].start,s[i].end-s[i].start+1)}_refineIfParentKnown(e,t,n){const a=new D([],[],e._ordered,null);return a._candidates=e._candidates.slice(0),this._parent._refineSetBlock(a,t,n)}_candidateIdTransform(e){return this._parent._candidateIdTransform(e)}_checkIfNeedToExpandKnownPage(e,t){if(e.pagesDefinition===null)return!1;let n=0;for(let a=e._lastFetchedIndex;a=t))break}return!1}_checkIfNeedToExpandCandidatePage(e,t){if(e.pagesDefinition===null)return!1;let n=0;for(let a=0;a=t)break}return!1}async _expandPagedSet(e,t,n,a,s){if(this._parent===null)throw new m(y.NotImplemented);return this._parent._expandPagedSet(e,t,n,a,s)}async _expandPagedSetFeatureSet(e,t,n,a,s){if(e._known.length>0&&e._known[e._known.length-1]==="GETPAGES"&&(a=1),a===0&&e._candidates.length>0&&e._candidates[e._candidates.length-1]==="GETPAGES"&&(a=2),a===0)return"finished";const i=await this._getPage(e,a,s);return n+ie.pagesDefinition.resultOffset||e.pagesDefinition.internal.fullyResolved===!0){a.length=a.length-1;let s=0;for(let l=0;l=e.pagesDefinition.internal.set.length);l++)a[a.length]=e.pagesDefinition.internal.set[e.pagesDefinition.resultOffset+l],s++;e.pagesDefinition.resultOffset+=s;let i=!1;return e.pagesDefinition.internal.fullyResolved===!0&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset&&(i=!0),i===!1&&a.push("GETPAGES"),s}return await this._getPhysicalPage(e,t,n),this._getPage(e,t,n)}_getPhysicalPage(e,t,n){return null}_clonePageDefinition(e){return this._parent===null?null:this._parent._clonePageDefinition(e)}_first(e){return this.iterator(e).next()}first(e){return this._first(e)}async calculateStatistic(e,t,n,a){await this._ensureLoaded();let s=await this._stat(e,t,"",null,null,n,a);return s.calculated===!1&&(s=await this._manualStat(e,t,n,a)),s.result}async _manualStat(e,t,n,a){let s=null;switch(e.toLowerCase()){case"count":return s=await xe(this,a),{calculated:!0,result:s};case"distinct":return s=await Oe(this,t,n,a),{calculated:!0,result:s};case"avg":case"mean":return s=await Ne(this,t,a),{calculated:!0,result:s};case"stdev":return s=await ke(this,t,a),{calculated:!0,result:s};case"variance":return s=await Pe(this,t,a),{calculated:!0,result:s};case"sum":return s=await Le(this,t,a),{calculated:!0,result:s};case"min":return s=await Re(this,t,a),{calculated:!0,result:s};case"max":return s=await Ce(this,t,a),{calculated:!0,result:s};default:return{calculated:!0,result:0}}}async _stat(e,t,n,a,s,i,l){const o=await this._parent._stat(e,t,n,a,s,i,l);return o.calculated===!1?s===null&&n===""&&a===null?this._manualStat(e,t,i,l):{calculated:!1}:o}_unionAllGeomSelf(e){const t=this.iterator(this._defaultTracker(e)),n=[];return new Promise((a,s)=>{this._unionShapeInBatches(n,t,a,s)})}_unionAllGeom(e){return new Promise((t,n)=>{const a=this.iterator(this._defaultTracker(e)),s=[];this._unionShapeInBatches(s,a,t,n)})}_unionShapeInBatches(e,t,n,a){t.next().then(s=>{try{s!==null&&s.geometry!==null&&e.push(s.geometry),e.length>30||s===null&&e.length>1?ce(e).then(i=>{try{s===null?n(i):(e=[i],this._unionShapeInBatches(e,t,n,a))}catch(l){a(l)}},a):s===null?e.length===1?n(e[0]):n(null):this._unionShapeInBatches(e,t,n,a)}catch(i){a(i)}},a)}iterator(e){return new Te(this,e)}intersection(e,t=!1){return _._featuresetFunctions.intersection.bind(this)(e,t)}difference(e,t=!1,n=!0){return _._featuresetFunctions.difference.bind(this)(e,t,n)}symmetricDifference(e,t=!1,n=!0){return _._featuresetFunctions.symmetricDifference.bind(this)(e,t,n)}morphShape(e,t,n="unknown",a=null){return _._featuresetFunctions.morphShape.bind(this)(e,t,n,a)}morphShapeAndAttributes(e,t,n="unknown"){return _._featuresetFunctions.morphShapeAndAttributes.bind(this)(e,t,n)}union(e,t=!1){return _._featuresetFunctions.union.bind(this)(e,t)}intersects(e){return _._featuresetFunctions.intersects.bind(this)(e)}envelopeIntersects(e){return _._featuresetFunctions.envelopeIntersects.bind(this)(e)}contains(e){return _._featuresetFunctions.contains.bind(this)(e)}overlaps(e){return _._featuresetFunctions.overlaps.bind(this)(e)}relate(e,t){return _._featuresetFunctions.relate.bind(this)(e,t)}within(e){return _._featuresetFunctions.within.bind(this)(e)}touches(e){return _._featuresetFunctions.touches.bind(this)(e)}top(e){return _._featuresetFunctions.top.bind(this)(e)}crosses(e){return _._featuresetFunctions.crosses.bind(this)(e)}buffer(e,t,n,a=!0){return _._featuresetFunctions.buffer.bind(this)(e,t,n,a)}filter(e,t=null){return _._featuresetFunctions.filter.bind(this)(e,t)}orderBy(e){return _._featuresetFunctions.orderBy.bind(this)(e)}dissolve(e,t){return _._featuresetFunctions.dissolve.bind(this)(e,t)}groupby(e,t){return _._featuresetFunctions.groupby.bind(this)(e,t)}reduce(e,t=null,n){return new Promise((a,s)=>{this._reduceImpl(this.iterator(this._defaultTracker(n)),e,t,0,a,s,0)})}_reduceImpl(e,t,n,a,s,i,l){try{if(++l>1e3)return void setTimeout(()=>{l=0,this._reduceImpl(e,t,n,a,s,i,l)});e.next().then(o=>{try{if(o===null)s(n);else{const u=t(n,o,a,this);Z(u)?u.then(c=>{this._reduceImpl(e,t,c,a+1,s,i,l)},i):this._reduceImpl(e,t,u,a+1,s,i,l)}}catch(u){i(u)}},i)}catch(o){i(o)}}removeField(e){return _._featuresetFunctions.removeField.bind(this)(e)}addField(e,t,n=null){return _._featuresetFunctions.addField.bind(this)(e,t,n)}sumArea(e,t=!1,n){const a=re(e);return this.reduce((s,i)=>i.geometry===null?0:t?he(i.geometry,a).then(l=>s+l):de(i.geometry,a).then(l=>s+l),0,n)}sumLength(e,t=!1,n){const a=se(e);return this.reduce((s,i)=>i.geometry===null?0:t?pe(i.geometry,a).then(l=>s+l):_e(i.geometry,a).then(l=>s+l),0,n)}_substituteVars(e,t){if(t!==null){const n={};for(const a in t)n[a.toLowerCase()]=t[a];e.parameters=n}}async distinct(e,t=1e3,n=null,a){await this.load();const s=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(s,n),this.calculateStatistic("distinct",s,t,this._defaultTracker(a))}async min(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("min",a,-1,this._defaultTracker(n))}async max(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("max",a,-1,this._defaultTracker(n))}async avg(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("avg",a,-1,this._defaultTracker(n))}async sum(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("sum",a,-1,this._defaultTracker(n))}async stdev(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("stdev",a,-1,this._defaultTracker(n))}async variance(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("variance",a,-1,this._defaultTracker(n))}async count(e){return await this.load(),this.calculateStatistic("count",T.create("1",this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC),-1,this._defaultTracker(e))}_defaultTracker(e){return e??{aborted:!1}}forEach(e,t){return new Promise((n,a)=>{this._forEachImpl(this.iterator(this._defaultTracker(t)),e,this,n,a,0)})}_forEachImpl(e,t,n,a,s,i){try{if(++i>1e3)return void setTimeout(()=>{i=0,this._forEachImpl(e,t,n,a,s,i)},0);e.next().then(l=>{try{if(l===null)a(n);else{const o=t(l);o==null?this._forEachImpl(e,t,n,a,s,i):Z(o)?o.then(()=>{try{this._forEachImpl(e,t,n,a,s,i)}catch(u){s(u)}},s):this._forEachImpl(e,t,n,a,s,i)}}catch(o){s(o)}},s)}catch(l){s(l)}}convertToJSON(e){const t={layerDefinition:{geometryType:this.geometryType,fields:[]},featureSet:{features:[],geometryType:this.geometryType}};for(let n=0;n{var i;const s={geometry:(i=a.geometry)==null?void 0:i.toJSON(),attributes:{}};for(const l in a.attributes)s.attributes[l]=a.attributes[l];return t.featureSet.features.push(s),1},0,e).then(()=>t)}castToText(e=!1){return"object, FeatureSet"}queryAttachments(e,t,n,a,s){return this._parent.queryAttachments(e,t,n,a,s)}serviceUrl(){return this._parent.serviceUrl()}subtypes(){return this.typeIdField?{subtypeField:this.typeIdField,subtypes:this.types?this.types.map(e=>({name:e.name,code:e.id})):[]}:null}relationshipMetaData(){return this._parent.relationshipMetaData()}get gdbVersion(){return this._parent?this._parent.gdbVersion:""}schema(){const e=[];for(const t of this.fields)e.push(G(t));return{objectIdField:this.objectIdField,globalIdField:this.globalIdField,geometryType:B[this.geometryType]===void 0?"esriGeometryNull":B[this.geometryType],fields:e}}async convertToText(e,t){if(e==="schema")return await this._ensureLoaded(),JSON.stringify(this.schema());if(e==="featureset"){await this._ensureLoaded();const n=[];await this.reduce((s,i)=>{const l={geometry:i.geometry?i.geometry.toJSON():null,attributes:i.attributes};return l.geometry!==null&&l.geometry.spatialReference&&delete l.geometry.spatialReference,n.push(l),1},0,t);const a=this.schema();return a.features=n,a.spatialReference=this.spatialReference.toJSON(),JSON.stringify(a)}return this.castToText()}getFeatureByObjectId(e,t){return this._parent.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._parent.getOwningSystemUrl()}getIdentityUser(){return this._parent.getIdentityUser()}getRootFeatureSet(){return this._parent!==null?this._parent.getRootFeatureSet():this}getDataSourceFeatureSet(){return this._parent!==null?this._parent.getDataSourceFeatureSet():this}castAsJson(e=null){return(e==null?void 0:e.featureset)==="keeptype"?this:(e==null?void 0:e.featureset)==="none"?null:{type:"FeatureSet"}}async castAsJsonAsync(e=null,t=null){var s;if((t==null?void 0:t.featureset)==="keeptype")return this;if((t==null?void 0:t.featureset)==="schema")return await this._ensureLoaded(),JSON.parse(JSON.stringify(this.schema()));if((t==null?void 0:t.featureset)==="none")return null;await this._ensureLoaded();const n=[];await this.reduce((i,l)=>{const o={geometry:l.geometry?(t==null?void 0:t.keepGeometryType)===!0?l.geometry:l.geometry.toJSON():null,attributes:l.attributes};return o.geometry!==null&&o.geometry.spatialReference&&(t==null?void 0:t.keepGeometryType)!==!0&&delete o.geometry.spatialReference,n.push(o),1},0,e);const a=this.schema();return a.features=n,a.spatialReference=(t==null?void 0:t.keepGeometryType)===!0?this.spatialReference:(s=this.spatialReference)==null?void 0:s.toJSON(),a}fieldTimeZone(e){return this.getFieldsIndex().getTimeZone(e)}get preferredTimeZone(){var e;return((e=this._parent)==null?void 0:e.preferredTimeZone)??null}get dateFieldsTimeZone(){var e;return((e=this._parent)==null?void 0:e.dateFieldsTimeZone)??null}get dateFieldsTimeZoneDefaultUTC(){if(this.datesInUnknownTimezone)return"unknown";const e=this.dateFieldsTimeZone??"UTC";return e===""?"UTC":e}get datesInUnknownTimezone(){return this._parent.datesInUnknownTimezone}get editFieldsInfo(){var e;return((e=this._parent)==null?void 0:e.editFieldsInfo)??null}get timeInfo(){var e;return((e=this._parent)==null?void 0:e.timeInfo)??null}set featureSetInfo(e){this.fsetInfo=e}async getFeatureSetInfo(){var e;return this.fsetInfo??await((e=this._parent)==null?void 0:e.getFeatureSetInfo())??null}}_._featuresetFunctions={};class b extends _{constructor(e){super(e),this.declaredClass="esri.layers.featureset.sources.Empty",this._maxProcessing=1e3,this._wset=new D([],[],!1,null),this._parent=e.parentfeatureset,this._databaseType=h.Standardised}async _getSet(){return this._wset}optimisePagingFeatureQueries(){}_isInFeatureSet(){return F.NotInFeatureSet}async _getFeature(){throw new m(y.NeverReach)}async queryAttachments(){return[]}async _getFeatures(){return"success"}_featureFromCache(){return null}async _fetchAndRefineFeatures(){throw new m(y.NeverReach)}async _getFilteredSet(){return new D([],[],!1,null)}_stat(e,t,n,a,s,i,l){return this._manualStat(e,t,i,l)}async _canDoAggregates(){return!1}}class I extends _{constructor(e){super(e),this._relation="",this._relationGeom=null,this._relationString="",this.declaredClass="esri.arcade.featureset.actions.SpatialFilter",this._relationString=e.relationString,this._parent=e.parentfeatureset,this._maxProcessing=40,this._relation=e.relation,this._relationGeom=e.relationGeom}async _getSet(e){if(this._wset===null){await this._ensureLoaded();const t=await this._parent._getFilteredSet(this._relation!=="esriSpatialRelRelation"?this._relation:this._relation+":"+this._relationString,this._relationGeom,null,null,e);return this._checkCancelled(e),this._wset=new D(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){let t=this._parent._isInFeatureSet(e);return t===F.NotInFeatureSet?t:(t=this._idstates[e],t===void 0?F.Unknown:t)}_getFeature(e,t,n){return this._parent._getFeature(e,t,n)}_getFeatures(e,t,n,a){return this._parent._getFeatures(e,t,n,a)}_featureFromCache(e){return this._parent._featureFromCache(e)}async executeSpatialRelationTest(e){if(e.geometry===null)return!1;switch(this._relation){case"esriSpatialRelEnvelopeIntersects":return Q(H(this._relationGeom),H(e.geometry));case"esriSpatialRelIntersects":return Q(this._relationGeom,e.geometry);case"esriSpatialRelContains":return we(this._relationGeom,e.geometry);case"esriSpatialRelOverlaps":return Se(this._relationGeom,e.geometry);case"esriSpatialRelWithin":return ye(this._relationGeom,e.geometry);case"esriSpatialRelTouches":return me(this._relationGeom,e.geometry);case"esriSpatialRelCrosses":return ge(this._relationGeom,e.geometry);case"esriSpatialRelRelation":return fe(this._relationGeom,e.geometry,this._relationString??"")}}async _fetchAndRefineFeatures(e,t,n){var l;const a=new D([],e,!1,null),s=Math.min(t,e.length);await((l=this._parent)==null?void 0:l._getFeatures(a,-1,s,n)),this._checkCancelled(n);const i=[];for(let o=0;oX.createFromGraphicLikeObject(a.geometry,a.attributes,this._parent,t))}nextBatch(e){if(this._parent._mainSetInUse!==null)return this._parent._mainSetInUse.then(a=>this.nextBatch(e),a=>this.nextBatch(e));const t={returnpromise:null,hasset:!1},n=[];return t.returnpromise=new Promise((a,s)=>{this._parent._getSet(this._progress).then(i=>{const l=i._known;let o=l.length-1;if(l[l.length-1]==="GETPAGES"&&(o-=1),this._lastId+e>o&&l.length>0&&l[l.length-1]==="GETPAGES")return void this._parent._expandPagedSet(i,this._parent._maxQueryRate(),0,0,this._progress).then(c=>{t.hasset=!0,this._parent._mainSetInUse=null,this.nextBatch(e).then(a,s)},c=>{t.hasset=!0,this._parent._mainSetInUse=null,s(c)});const u=i._candidates;if(o>=this._lastId+e||u.length===0){for(let c=0;c=l.length)break;n[c]=l[p]}return this._lastId+=n.length,n.length===0&&(t.hasset=!0,this._parent._mainSetInUse=null,a([])),void this._parent._getFeatureBatch(n,this._progress).then(c=>{t.hasset=!0,this._parent._mainSetInUse=null,a(c)},c=>{t.hasset=!0,this._parent._mainSetInUse=null,s(c)})}this._parent._refineSetBlock(i,this._parent._maxProcessingRate(),this._progress).then(()=>{t.hasset=!0,this._parent._mainSetInUse=null,this.nextBatch(e).then(a,s)},c=>{t.hasset=!0,this._parent._mainSetInUse=null,s(c)})},i=>{t.hasset=!0,this._parent._mainSetInUse=null,s(i)})}),t.hasset===!1&&(this._parent._mainSetInUse=t.returnpromise,t.hasset=!0),t.returnpromise}next(){if(this._parent._mainSetInUse!==null)return this._parent._mainSetInUse.then(t=>this.next(),t=>this.next());const e={returnpromise:null,hasset:!1};return e.returnpromise=new Promise((t,n)=>{this._parent._getSet(this._progress).then(a=>{const s=a._known;this._lastId(e.hasset=!0,this._parent._mainSetInUse=null,this.next())).then(t,n):(this._lastId+=1,this._parent._getFeature(a,s[this._lastId],this._progress).then(i=>{e.hasset=!0,this._parent._mainSetInUse=null,t(i)},i=>{e.hasset=!0,this._parent._mainSetInUse=null,n(i)})):a._candidates.length>0?this._parent._refineSetBlock(a,this._parent._maxProcessingRate(),this._progress).then(()=>{e.hasset=!0,this._parent._mainSetInUse=null,this.next().then(t,n)},i=>{e.hasset=!0,this._parent._mainSetInUse=null,n(i)}):(e.hasset=!0,this._parent._mainSetInUse=null,t(null))},a=>{e.hasset=!0,this._parent._mainSetInUse=null,n(a)})}),e.hasset===!1&&(this._parent._mainSetInUse=e.returnpromise,e.hasset=!0),e.returnpromise}async count(){if(this._parent._totalCount!==-1)return this._parent._totalCount;const e=await this._parent._getSet(this._progress),t=await this._refineAllSets(e);return this._parent._totalCount=t._known.length,this._parent._totalCount}async _refineAllSets(e){if(e._known.length>0&&e._known[e._known.length-1]==="GETPAGES")return await this._parent._expandPagedSet(e,this._parent._maxQueryRate(),0,1,this._progress),this._refineAllSets(e);if(e._candidates.length>0){if(e._known[e._candidates.length-1]==="GETPAGES")return await this._parent._expandPagedSet(e,this._parent._maxQueryRate(),0,2,this._progress),this._refineAllSets(e);const t=await this._parent._refineSetBlock(e,this._parent._maxProcessingRate(),this._progress);return t._candidates.length>0?this._refineAllSets(t):t}return e}}class D{constructor(e,t,n,a){this._lastFetchedIndex=0,this._ordered=!1,this.pagesDefinition=null,this._candidates=e,this._known=t,this._ordered=n,this.pagesDefinition=a}}function K(r,e){return d(r==null?void 0:r.parseTree,e,r==null?void 0:r.parameters)}function Ze(r,e,t){return d(r,e,t)}function Ye(r,e,t,n){return T.create(d(r.parseTree,h.Standardised,r.parameters,e,t),n,r.timeZone)}function Ke(r,e,t="AND"){return T.create("(("+K(r,h.Standardised)+")"+t+"("+K(e,h.Standardised)+"))",r.fieldsIndex,r.timeZone)}function d(r,e,t,n=null,a=null){let s,i,l,o;switch(r.type){case"interval":return Ee(d(r.value,e,t,n,a),r.qualifier,r.op);case"case-expression":{let u=" CASE ";r.format==="simple"&&(u+=d(r.operand,e,t,n,a));for(let c=0;c":case"<":case">":case">=":case"<=":case"=":case"*":case"-":case"+":case"/":return" ("+d(r.left,e,t,n,a)+" "+r.operator+" "+d(r.right,e,t,n,a)+") ";case"||":return" ("+d(r.left,e,t,n,a)+" "+(e===h.SqlServer?"+":r.operator)+" "+d(r.right,e,t,n,a)+") "}throw new f(g.UnsupportedOperator,{operator:r.operator});case"null":return"null";case"boolean":return r.value===!0?"1":"0";case"string":return"'"+r.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${r.value}'`;case"date":return`date '${r.value}'`;case"time":return`time '${r.value}'`;case"number":return r.value.toString();case"current-time":return Fe(r.mode==="date",e);case"column-reference":return n?n.toLowerCase()===r.column.toLowerCase()?"("+a+")":r.delimited===!0?`"${r.column.split('"').join('""')}"`:r.column:r.column;case"data-type":return r.value;case"function":{const u=d(r.args,e,t,n,a);return Ie(r.name,u,e)}}throw new f(g.UnsupportedSyntax,{node:r.type})}function Ie(r,e,t){switch(r.toLowerCase().trim()){case"cos":case"sin":case"tan":case"cosh":case"tanh":case"sinh":case"acos":case"asin":case"atan":case"floor":case"log10":case"log":case"abs":if(e.length!==1)throw new f(g.InvalidFunctionParameters,{function:r.toLowerCase().trim()});return`${r.toUpperCase().trim()}(${e[0]})`;case"ceiling":case"ceil":if(e.length!==1)throw new f(g.InvalidFunctionParameters,{function:"ceiling"});switch(t){case h.Standardised:case h.StandardisedNoInterval:}return"CEILING("+e[0]+")";case"mod":case"power":case"nullif":if(e.length!==2)throw new f(g.InvalidFunctionParameters,{function:r.toLowerCase().trim()});return`${r.toUpperCase().trim()}(${e[0]},${e[1]})`;case"round":if(e.length===2)return"ROUND("+e[0]+","+e[1]+")";if(e.length===1)return"ROUND("+e[0]+")";throw new f(g.InvalidFunctionParameters,{function:"round"});case"truncate":if(e.length<1||e.length>2)throw new f(g.InvalidFunctionParameters,{function:"truncate"});return t===h.SqlServer?"ROUND("+e[0]+(e.length===1?"0":","+e[1])+",1)":"TRUNCATE("+e[0]+(e.length===1?")":","+e[1]+")");case"char_length":case"len":if(e.length!==1)throw new f(g.InvalidFunctionParameters,{function:"char_length"});switch(t){case h.SqlServer:return"LEN("+e[0]+")";case h.Oracle:return"LENGTH("+e[0]+")";default:return"CHAR_LENGTH("+e[0]+")"}case"coalesce":case"concat":{if(e.length<1)throw new f(g.InvalidFunctionParameters,{function:r.toLowerCase()});let n=r.toUpperCase().trim()+"(";for(let a=0;a":case"<":case">":case">=":case"<=":case"=":return"boolean";case"IS":case"ISNOT":if(e.right.type!=="null")throw new f(g.UnsupportedIsRhs);return"boolean";case"*":case"-":case"+":case"/":return C([S(r,e.left,t,n),S(r,e.right,t,n)]);case"||":return"string";default:throw new f(g.UnsupportedOperator,{operator:e.operator})}case"null":return"";case"boolean":return"boolean";case"string":return"string";case"number":return e.value===null?"":e.value%1==0?"integer":"double";case"date":return"date";case"timestamp":return e.withtimezone?"timestamp-offset":"date";case"time":return"time-only";case"current-time":return"date";case"column-reference":{const c=r[e.column.toLowerCase()];return c===void 0?"":c}case"function":switch(e.name.toLowerCase()){case"cast":switch(((i=(s=e.args)==null?void 0:s.value[1])==null?void 0:i.value.type)??""){case"integer":case"smallint":return"integer";case"real":case"float":return"double";case"date":case"timestamp":return((u=(o=(l=e.args)==null?void 0:l.value[1])==null?void 0:o.value)==null?void 0:u.withtimezone)===!0?"timestamp-offset":"date";case"time":return"time-only";case"varchar":return"string";default:return""}case"position":case"extract":case"char_length":case"mod":return"integer";case"round":if(a=S(r,e.args,t,n),a instanceof Array){if(a.length<=0)return"double";a=a[0]}return a;case"sign":return"integer";case"ceiling":case"floor":case"abs":return a=S(r,e.args,t,n),a instanceof Array&&(a=C(a)),a==="integer"||a==="double"?a:"double";case"area":case"length":case"log":case"log10":case"sin":case"cos":case"tan":case"asin":case"acos":case"atan":case"cosh":case"sinh":case"tanh":case"power":return"double";case"substring":case"trim":case"concat":case"lower":case"upper":return"string";case"truncate":return"double";case"nullif":case"coalesce":return a=S(r,e.args,t,n),a instanceof Array?a.length>0?a[0]:"":a}return""}throw new f(g.UnsupportedSyntax,{node:e.type})}const J={boolean:1,string:2,integer:3,double:4,date:5};function C(r){if(r){let e="";for(const t of r)t!==""&&(e=e===""||J[e]=e&&e!==-1)return t}return t}function qe(r){switch(r.toLowerCase()){case"distinct":return"distinct";case"avg":case"mean":return"avg";case"min":return"min";case"sum":return"sum";case"max":return"max";case"stdev":case"stddev":return"stddev";case"var":case"variance":return"var";case"count":return"count"}return""}function Je(r,e,t=1e3){switch(r.toLowerCase()){case"distinct":return Ae(e,t);case"avg":case"mean":return A(e);case"min":return Math.min.apply(Math,e);case"sum":return $(e);case"max":return Math.max.apply(Math,e);case"stdev":case"stddev":return Math.sqrt(V(e));case"var":case"variance":return V(e);case"count":return e.length}return 0}async function Re(r,e,t){const n=await v(r,e,t,!0);return n.length===0?null:Math.min.apply(Math,n)}async function Ce(r,e,t){const n=await v(r,e,t,!0);return n.length===0?null:Math.max.apply(Math,n)}async function Ne(r,e,t){let n="";e&&!De(e)&&(n=be(e,r.fields));const a=await v(r,e,t,!0);if(a.length===0)return null;const s=A(a);return s===null?s:n==="integer"?ve(s):s}async function Pe(r,e,t){const n=await v(r,e,t,!0);return n.length===0?null:z(n)}async function ke(r,e,t){const n=await v(r,e,t,!0);return n.length===0?null:Math.sqrt(z(n))}async function Le(r,e,t){const n=await v(r,e,t,!0);return n.length===0?null:$(n)}async function xe(r,e){return r.iterator(e).count()}async function v(r,e,t,n=!1){const a=r.iterator(t),s=[],i={ticker:0};let l=await a.next();for(;l!==null;){if(i.ticker++,t.aborted)throw new m(y.Cancelled);i.ticker%100==0&&(i.ticker=0,await new Promise(u=>{setTimeout(u,0)}));const o=e==null?void 0:e.calculateValue(l);o===null?n===!1&&(s[s.length]=o):s[s.length]=o instanceof W||o instanceof M?o.toNumber():o instanceof j?o.toMilliseconds():o,l=await a.next()}return s}async function Oe(r,e,t=1e3,n=null){const a=r.iterator(n),s=[],i={},l={ticker:0};let o=await a.next();for(;o!==null;){if(l.ticker++,n&&n.aborted)throw new m(y.Cancelled);l.ticker%100==0&&(l.ticker=0,await new Promise(p=>{setTimeout(p,0)}));const u=e==null?void 0:e.calculateValue(o);let c=u;if(u instanceof W?c="!!DATEONLY!!-"+u.toString():u instanceof j?c="!!TSOFFSETONLY!!-"+u.toString():u instanceof M?c="!!TIMEONLY!!-"+u.toString():u instanceof Date&&(c="!!DATE!!-"+u.toString()),u!=null&&i[c]===void 0&&(s.push(u),i[c]=1),s.length>=t&&t!==-1)return s;o=await a.next()}return s}class _{constructor(e){this.recentlyUsedQueries=null,this.featureSetQueryInterceptor=null,this._idstates=[],this._parent=null,this._wset=null,this._mainSetInUse=null,this._maxProcessing=200,this._maxQuery=500,this._totalCount=-1,this._databaseType=h.NotEvaluated,this._databaseTypeProbed=null,this.declaredRootClass="esri.arcade.featureset.support.FeatureSet",this._featureCache=[],this.typeIdField=null,this.types=null,this.fields=null,this.geometryType="",this.objectIdField="",this.globalIdField="",this.spatialReference=null,this.hasM=!1,this.hasZ=!1,this._transparent=!1,this.loaded=!1,this._loadPromise=null,this._fieldsIndex=null,this.fsetInfo=null,e!=null&&e.lrucache&&(this.recentlyUsedQueries=e.lrucache),e!=null&&e.interceptor&&(this.featureSetQueryInterceptor=e.interceptor)}optimisePagingFeatureQueries(e){this._parent&&this._parent.optimisePagingFeatureQueries(e)}_hasMemorySource(){return!0}prop(e,t){return t===void 0?this[e]:(this[e]!==void 0&&(this[e]=t),this)}end(){return this._parent!==null&&this._parent._transparent===!0?this._parent.end():this._parent}_ensureLoaded(){return this.load()}load(){return this._loadPromise===null&&(this._loadPromise=this.loadImpl()),this._loadPromise}async loadImpl(){var e,t;return((e=this._parent)==null?void 0:e.loaded)===!0?(this._initialiseFeatureSet(),this):(await((t=this._parent)==null?void 0:t.load()),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){this._parent!==null?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.fields=[],this.typeIdField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new oe({wkid:4326}),this.geometryType=ae.point)}getField(e,t){let n;return(t=t||this.fields)&&(e=e.toLowerCase(),t.some(a=>(a&&a.name.toLowerCase()===e&&(n=a),!!n))),n}getFieldsIndex(){return this._fieldsIndex===null&&(this._fieldsIndex=ue.fromLayer({timeInfo:this.timeInfo,editFieldsInfo:this.editFieldsInfo,dateFieldsTimeZone:this.dateFieldsTimeZone,datesInUnknownTimezone:this.datesInUnknownTimezone,fields:this.fields})),this._fieldsIndex}_maxProcessingRate(){return this._parent!==null?Math.min(this._maxProcessing,this._parent._maxProcessingRate()):Math.min(this._maxProcessing,this._maxQueryRate())}_maxQueryRate(){return this._parent!==null?Math.max(this._maxQuery,this._parent._maxQueryRate()):this._maxQuery}_checkCancelled(e){if(e!=null&&e.aborted)throw new m(y.Cancelled)}nativeCapabilities(){return this._parent.nativeCapabilities()}async _canDoAggregates(e,t,n,a,s){return this._parent!==null&&this._parent._canDoAggregates(e,t,n,a,s)}async _getAggregatePagesDataSourceDefinition(e,t,n,a,s,i,l){if(this._parent===null)throw new m(y.NeverReach);return this._parent._getAggregatePagesDataSourceDefinition(e,t,n,a,s,i,l)}async _getAgregagtePhysicalPage(e,t,n){if(this._parent===null)throw new m(y.NeverReach);return this._parent._getAgregagtePhysicalPage(e,t,n)}async databaseType(){if(this._databaseType===h.NotEvaluated){if(E.applicationCache!==null){const e=E.applicationCache.getDatabaseType(this._cacheableFeatureSetSourceKey());if(e!==null)return e}if(this._databaseTypeProbed!==null)return this._databaseTypeProbed;try{this._databaseTypeProbed=this._getDatabaseTypeImpl(),E.applicationCache!==null&&E.applicationCache.setDatabaseType(this._cacheableFeatureSetSourceKey(),this._databaseTypeProbed)}catch(e){throw E.applicationCache!==null&&E.applicationCache.clearDatabaseType(this._cacheableFeatureSetSourceKey()),e}return this._databaseTypeProbed}return this._databaseType}async _getDatabaseTypeImpl(){const e=[{thetype:h.SqlServer,testwhere:"(CAST( '2015-01-01' as DATETIME) = CAST( '2015-01-01' as DATETIME)) AND OBJECTID<0"},{thetype:h.Oracle,testwhere:"(TO_DATE('2003-11-18','YYYY-MM-DD') = TO_DATE('2003-11-18','YYYY-MM-DD')) AND OBJECTID<0"},{thetype:h.StandardisedNoInterval,testwhere:"(date '2015-01-01 10:10:10' = date '2015-01-01 10:10:10') AND OBJECTID<0"}];for(const t of e)if(await this._runDatabaseProbe(t.testwhere)===!0)return t.thetype;return h.StandardisedNoInterval}_cacheableFeatureSetSourceKey(){return"MUSTBESET"}async _runDatabaseProbe(e){if(this._parent!==null)return this._parent._runDatabaseProbe(e);throw new m(y.NotImplemented)}isTable(){var e;return((e=this._parent)==null?void 0:e.isTable())??!1}_featureFromCache(e){if(this._featureCache[e]!==void 0)return this._featureCache[e]}_isInFeatureSet(e){return F.Unknown}_getSet(e){throw new m(y.NotImplemented)}async _getFeature(e,t,n){if(this._checkCancelled(n),this._featureFromCache(t)!==void 0)return this._featureFromCache(t);if(await this._getFeatures(e,t,this._maxProcessingRate(),n),this._checkCancelled(n),this._featureFromCache(t)!==void 0)return this._featureFromCache(t);throw new m(y.MissingFeatures)}async _getFeatureBatch(e,t){this._checkCancelled(t);const n=new D([],e,!1,null),a=[];await this._getFeatures(n,-1,e.length,t),this._checkCancelled(t);for(const s of e)this._featureFromCache(s)!==void 0&&a.push(this._featureFromCache(s));return a}async _getFeatures(e,t,n,a){return"success"}_getFilteredSet(e,t,n,a,s){throw new m(y.NotImplemented)}async _refineSetBlock(e,t,n){if(this._checkIfNeedToExpandCandidatePage(e,this._maxQueryRate())===!0)return await this._expandPagedSet(e,this._maxQueryRate(),0,0,n),this._refineSetBlock(e,t,n);this._checkCancelled(n);const a=e._candidates.length;this._refineKnowns(e,t);let s=a-e._candidates.length;if(e._candidates.length===0||s>=t)return e;if(await this._refineIfParentKnown(e,t-s,n),this._checkCancelled(n),this._refineKnowns(e,t-s),s=a-e._candidates.length,s0){const i=t-s,l=this._prepareFetchAndRefineSet(e._candidates);return await this._fetchAndRefineFeatures(l,l.length>i?i:e._candidates.length,n),this._checkCancelled(n),this._refineKnowns(e,t-s),e}return e}_fetchAndRefineFeatures(e,t,n){return null}_prepareFetchAndRefineSet(e){const t=[];for(let n=0;n=t)break}a!==null&&s.push(a);for(let i=s.length-1;i>=0;i--)e._candidates.splice(s[i].start,s[i].end-s[i].start+1)}_refineIfParentKnown(e,t,n){const a=new D([],[],e._ordered,null);return a._candidates=e._candidates.slice(0),this._parent._refineSetBlock(a,t,n)}_candidateIdTransform(e){return this._parent._candidateIdTransform(e)}_checkIfNeedToExpandKnownPage(e,t){if(e.pagesDefinition===null)return!1;let n=0;for(let a=e._lastFetchedIndex;a=t))break}return!1}_checkIfNeedToExpandCandidatePage(e,t){if(e.pagesDefinition===null)return!1;let n=0;for(let a=0;a=t)break}return!1}async _expandPagedSet(e,t,n,a,s){if(this._parent===null)throw new m(y.NotImplemented);return this._parent._expandPagedSet(e,t,n,a,s)}async _expandPagedSetFeatureSet(e,t,n,a,s){if(e._known.length>0&&e._known[e._known.length-1]==="GETPAGES"&&(a=1),a===0&&e._candidates.length>0&&e._candidates[e._candidates.length-1]==="GETPAGES"&&(a=2),a===0)return"finished";const i=await this._getPage(e,a,s);return n+ie.pagesDefinition.resultOffset||e.pagesDefinition.internal.fullyResolved===!0){a.length=a.length-1;let s=0;for(let l=0;l=e.pagesDefinition.internal.set.length);l++)a[a.length]=e.pagesDefinition.internal.set[e.pagesDefinition.resultOffset+l],s++;e.pagesDefinition.resultOffset+=s;let i=!1;return e.pagesDefinition.internal.fullyResolved===!0&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset&&(i=!0),i===!1&&a.push("GETPAGES"),s}return await this._getPhysicalPage(e,t,n),this._getPage(e,t,n)}_getPhysicalPage(e,t,n){return null}_clonePageDefinition(e){return this._parent===null?null:this._parent._clonePageDefinition(e)}_first(e){return this.iterator(e).next()}first(e){return this._first(e)}async calculateStatistic(e,t,n,a){await this._ensureLoaded();let s=await this._stat(e,t,"",null,null,n,a);return s.calculated===!1&&(s=await this._manualStat(e,t,n,a)),s.result}async _manualStat(e,t,n,a){let s=null;switch(e.toLowerCase()){case"count":return s=await xe(this,a),{calculated:!0,result:s};case"distinct":return s=await Oe(this,t,n,a),{calculated:!0,result:s};case"avg":case"mean":return s=await Ne(this,t,a),{calculated:!0,result:s};case"stdev":return s=await ke(this,t,a),{calculated:!0,result:s};case"variance":return s=await Pe(this,t,a),{calculated:!0,result:s};case"sum":return s=await Le(this,t,a),{calculated:!0,result:s};case"min":return s=await Re(this,t,a),{calculated:!0,result:s};case"max":return s=await Ce(this,t,a),{calculated:!0,result:s};default:return{calculated:!0,result:0}}}async _stat(e,t,n,a,s,i,l){const o=await this._parent._stat(e,t,n,a,s,i,l);return o.calculated===!1?s===null&&n===""&&a===null?this._manualStat(e,t,i,l):{calculated:!1}:o}_unionAllGeomSelf(e){const t=this.iterator(this._defaultTracker(e)),n=[];return new Promise((a,s)=>{this._unionShapeInBatches(n,t,a,s)})}_unionAllGeom(e){return new Promise((t,n)=>{const a=this.iterator(this._defaultTracker(e)),s=[];this._unionShapeInBatches(s,a,t,n)})}_unionShapeInBatches(e,t,n,a){t.next().then(s=>{try{s!==null&&s.geometry!==null&&e.push(s.geometry),e.length>30||s===null&&e.length>1?ce(e).then(i=>{try{s===null?n(i):(e=[i],this._unionShapeInBatches(e,t,n,a))}catch(l){a(l)}},a):s===null?e.length===1?n(e[0]):n(null):this._unionShapeInBatches(e,t,n,a)}catch(i){a(i)}},a)}iterator(e){return new Te(this,e)}intersection(e,t=!1){return _._featuresetFunctions.intersection.bind(this)(e,t)}difference(e,t=!1,n=!0){return _._featuresetFunctions.difference.bind(this)(e,t,n)}symmetricDifference(e,t=!1,n=!0){return _._featuresetFunctions.symmetricDifference.bind(this)(e,t,n)}morphShape(e,t,n="unknown",a=null){return _._featuresetFunctions.morphShape.bind(this)(e,t,n,a)}morphShapeAndAttributes(e,t,n="unknown"){return _._featuresetFunctions.morphShapeAndAttributes.bind(this)(e,t,n)}union(e,t=!1){return _._featuresetFunctions.union.bind(this)(e,t)}intersects(e){return _._featuresetFunctions.intersects.bind(this)(e)}envelopeIntersects(e){return _._featuresetFunctions.envelopeIntersects.bind(this)(e)}contains(e){return _._featuresetFunctions.contains.bind(this)(e)}overlaps(e){return _._featuresetFunctions.overlaps.bind(this)(e)}relate(e,t){return _._featuresetFunctions.relate.bind(this)(e,t)}within(e){return _._featuresetFunctions.within.bind(this)(e)}touches(e){return _._featuresetFunctions.touches.bind(this)(e)}top(e){return _._featuresetFunctions.top.bind(this)(e)}crosses(e){return _._featuresetFunctions.crosses.bind(this)(e)}buffer(e,t,n,a=!0){return _._featuresetFunctions.buffer.bind(this)(e,t,n,a)}filter(e,t=null){return _._featuresetFunctions.filter.bind(this)(e,t)}orderBy(e){return _._featuresetFunctions.orderBy.bind(this)(e)}dissolve(e,t){return _._featuresetFunctions.dissolve.bind(this)(e,t)}groupby(e,t){return _._featuresetFunctions.groupby.bind(this)(e,t)}reduce(e,t=null,n){return new Promise((a,s)=>{this._reduceImpl(this.iterator(this._defaultTracker(n)),e,t,0,a,s,0)})}_reduceImpl(e,t,n,a,s,i,l){try{if(++l>1e3)return void setTimeout(()=>{l=0,this._reduceImpl(e,t,n,a,s,i,l)});e.next().then(o=>{try{if(o===null)s(n);else{const u=t(n,o,a,this);Z(u)?u.then(c=>{this._reduceImpl(e,t,c,a+1,s,i,l)},i):this._reduceImpl(e,t,u,a+1,s,i,l)}}catch(u){i(u)}},i)}catch(o){i(o)}}removeField(e){return _._featuresetFunctions.removeField.bind(this)(e)}addField(e,t,n=null){return _._featuresetFunctions.addField.bind(this)(e,t,n)}sumArea(e,t=!1,n){const a=re(e);return this.reduce((s,i)=>i.geometry===null?0:t?he(i.geometry,a).then(l=>s+l):de(i.geometry,a).then(l=>s+l),0,n)}sumLength(e,t=!1,n){const a=se(e);return this.reduce((s,i)=>i.geometry===null?0:t?pe(i.geometry,a).then(l=>s+l):_e(i.geometry,a).then(l=>s+l),0,n)}_substituteVars(e,t){if(t!==null){const n={};for(const a in t)n[a.toLowerCase()]=t[a];e.parameters=n}}async distinct(e,t=1e3,n=null,a){await this.load();const s=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(s,n),this.calculateStatistic("distinct",s,t,this._defaultTracker(a))}async min(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("min",a,-1,this._defaultTracker(n))}async max(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("max",a,-1,this._defaultTracker(n))}async avg(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("avg",a,-1,this._defaultTracker(n))}async sum(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("sum",a,-1,this._defaultTracker(n))}async stdev(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("stdev",a,-1,this._defaultTracker(n))}async variance(e,t=null,n){await this.load();const a=T.create(e,this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC);return this._substituteVars(a,t),this.calculateStatistic("variance",a,-1,this._defaultTracker(n))}async count(e){return await this.load(),this.calculateStatistic("count",T.create("1",this.getFieldsIndex(),this.dateFieldsTimeZoneDefaultUTC),-1,this._defaultTracker(e))}_defaultTracker(e){return e??{aborted:!1}}forEach(e,t){return new Promise((n,a)=>{this._forEachImpl(this.iterator(this._defaultTracker(t)),e,this,n,a,0)})}_forEachImpl(e,t,n,a,s,i){try{if(++i>1e3)return void setTimeout(()=>{i=0,this._forEachImpl(e,t,n,a,s,i)},0);e.next().then(l=>{try{if(l===null)a(n);else{const o=t(l);o==null?this._forEachImpl(e,t,n,a,s,i):Z(o)?o.then(()=>{try{this._forEachImpl(e,t,n,a,s,i)}catch(u){s(u)}},s):this._forEachImpl(e,t,n,a,s,i)}}catch(o){s(o)}},s)}catch(l){s(l)}}convertToJSON(e){const t={layerDefinition:{geometryType:this.geometryType,fields:[]},featureSet:{features:[],geometryType:this.geometryType}};for(let n=0;n{var i;const s={geometry:(i=a.geometry)==null?void 0:i.toJSON(),attributes:{}};for(const l in a.attributes)s.attributes[l]=a.attributes[l];return t.featureSet.features.push(s),1},0,e).then(()=>t)}castToText(e=!1){return"object, FeatureSet"}queryAttachments(e,t,n,a,s){return this._parent.queryAttachments(e,t,n,a,s)}serviceUrl(){return this._parent.serviceUrl()}subtypes(){return this.typeIdField?{subtypeField:this.typeIdField,subtypes:this.types?this.types.map(e=>({name:e.name,code:e.id})):[]}:null}relationshipMetaData(){return this._parent.relationshipMetaData()}get gdbVersion(){return this._parent?this._parent.gdbVersion:""}schema(){const e=[];for(const t of this.fields)e.push(G(t));return{objectIdField:this.objectIdField,globalIdField:this.globalIdField,geometryType:B[this.geometryType]===void 0?"esriGeometryNull":B[this.geometryType],fields:e}}async convertToText(e,t){if(e==="schema")return await this._ensureLoaded(),JSON.stringify(this.schema());if(e==="featureset"){await this._ensureLoaded();const n=[];await this.reduce((s,i)=>{const l={geometry:i.geometry?i.geometry.toJSON():null,attributes:i.attributes};return l.geometry!==null&&l.geometry.spatialReference&&delete l.geometry.spatialReference,n.push(l),1},0,t);const a=this.schema();return a.features=n,a.spatialReference=this.spatialReference.toJSON(),JSON.stringify(a)}return this.castToText()}getFeatureByObjectId(e,t){return this._parent.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._parent.getOwningSystemUrl()}getIdentityUser(){return this._parent.getIdentityUser()}getRootFeatureSet(){return this._parent!==null?this._parent.getRootFeatureSet():this}getDataSourceFeatureSet(){return this._parent!==null?this._parent.getDataSourceFeatureSet():this}castAsJson(e=null){return(e==null?void 0:e.featureset)==="keeptype"?this:(e==null?void 0:e.featureset)==="none"?null:{type:"FeatureSet"}}async castAsJsonAsync(e=null,t=null){var s;if((t==null?void 0:t.featureset)==="keeptype")return this;if((t==null?void 0:t.featureset)==="schema")return await this._ensureLoaded(),JSON.parse(JSON.stringify(this.schema()));if((t==null?void 0:t.featureset)==="none")return null;await this._ensureLoaded();const n=[];await this.reduce((i,l)=>{const o={geometry:l.geometry?(t==null?void 0:t.keepGeometryType)===!0?l.geometry:l.geometry.toJSON():null,attributes:l.attributes};return o.geometry!==null&&o.geometry.spatialReference&&(t==null?void 0:t.keepGeometryType)!==!0&&delete o.geometry.spatialReference,n.push(o),1},0,e);const a=this.schema();return a.features=n,a.spatialReference=(t==null?void 0:t.keepGeometryType)===!0?this.spatialReference:(s=this.spatialReference)==null?void 0:s.toJSON(),a}fieldTimeZone(e){return this.getFieldsIndex().getTimeZone(e)}get preferredTimeZone(){var e;return((e=this._parent)==null?void 0:e.preferredTimeZone)??null}get dateFieldsTimeZone(){var e;return((e=this._parent)==null?void 0:e.dateFieldsTimeZone)??null}get dateFieldsTimeZoneDefaultUTC(){if(this.datesInUnknownTimezone)return"unknown";const e=this.dateFieldsTimeZone??"UTC";return e===""?"UTC":e}get datesInUnknownTimezone(){return this._parent.datesInUnknownTimezone}get editFieldsInfo(){var e;return((e=this._parent)==null?void 0:e.editFieldsInfo)??null}get timeInfo(){var e;return((e=this._parent)==null?void 0:e.timeInfo)??null}set featureSetInfo(e){this.fsetInfo=e}async getFeatureSetInfo(){var e;return this.fsetInfo??await((e=this._parent)==null?void 0:e.getFeatureSetInfo())??null}}_._featuresetFunctions={};class b extends _{constructor(e){super(e),this.declaredClass="esri.layers.featureset.sources.Empty",this._maxProcessing=1e3,this._wset=new D([],[],!1,null),this._parent=e.parentfeatureset,this._databaseType=h.Standardised}async _getSet(){return this._wset}optimisePagingFeatureQueries(){}_isInFeatureSet(){return F.NotInFeatureSet}async _getFeature(){throw new m(y.NeverReach)}async queryAttachments(){return[]}async _getFeatures(){return"success"}_featureFromCache(){return null}async _fetchAndRefineFeatures(){throw new m(y.NeverReach)}async _getFilteredSet(){return new D([],[],!1,null)}_stat(e,t,n,a,s,i,l){return this._manualStat(e,t,i,l)}async _canDoAggregates(){return!1}}class I extends _{constructor(e){super(e),this._relation="",this._relationGeom=null,this._relationString="",this.declaredClass="esri.arcade.featureset.actions.SpatialFilter",this._relationString=e.relationString,this._parent=e.parentfeatureset,this._maxProcessing=40,this._relation=e.relation,this._relationGeom=e.relationGeom}async _getSet(e){if(this._wset===null){await this._ensureLoaded();const t=await this._parent._getFilteredSet(this._relation!=="esriSpatialRelRelation"?this._relation:this._relation+":"+this._relationString,this._relationGeom,null,null,e);return this._checkCancelled(e),this._wset=new D(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){let t=this._parent._isInFeatureSet(e);return t===F.NotInFeatureSet?t:(t=this._idstates[e],t===void 0?F.Unknown:t)}_getFeature(e,t,n){return this._parent._getFeature(e,t,n)}_getFeatures(e,t,n,a){return this._parent._getFeatures(e,t,n,a)}_featureFromCache(e){return this._parent._featureFromCache(e)}async executeSpatialRelationTest(e){if(e.geometry===null)return!1;switch(this._relation){case"esriSpatialRelEnvelopeIntersects":return Y(H(this._relationGeom),H(e.geometry));case"esriSpatialRelIntersects":return Y(this._relationGeom,e.geometry);case"esriSpatialRelContains":return we(this._relationGeom,e.geometry);case"esriSpatialRelOverlaps":return Se(this._relationGeom,e.geometry);case"esriSpatialRelWithin":return ye(this._relationGeom,e.geometry);case"esriSpatialRelTouches":return me(this._relationGeom,e.geometry);case"esriSpatialRelCrosses":return ge(this._relationGeom,e.geometry);case"esriSpatialRelRelation":return fe(this._relationGeom,e.geometry,this._relationString??"")}}async _fetchAndRefineFeatures(e,t,n){var l;const a=new D([],e,!1,null),s=Math.min(t,e.length);await((l=this._parent)==null?void 0:l._getFeatures(a,-1,s,n)),this._checkCancelled(n);const i=[];for(let o=0;oX.fromJSON(m))}writeRestrictionAttributes(e,a,s){e!=null&&(a[s]=e.map(m=>X.toJSON(m)))}};t([i({type:[Object],json:{write:!0}})],d.prototype,"attributeParameterValues",void 0),t([i({type:String,json:{write:!0}})],d.prototype,"description",void 0),t([x(te,{ignoreUnknown:!1})],d.prototype,"distanceAttributeName",void 0),t([i({type:String,json:{write:!0}})],d.prototype,"id",void 0),t([p("id",["id","itemId"])],d.prototype,"readId",null),t([x(C,{ignoreUnknown:!1})],d.prototype,"impedanceAttributeName",void 0),t([i({type:String,json:{write:!0}})],d.prototype,"name",void 0),t([i({type:[String],json:{write:!0}})],d.prototype,"restrictionAttributeNames",void 0),t([p("restrictionAttributeNames")],d.prototype,"readRestrictionAttributes",null),t([D("restrictionAttributeNames")],d.prototype,"writeRestrictionAttributes",null),t([i({type:Number,json:{write:{allowNull:!0}}})],d.prototype,"simplificationTolerance",void 0),t([x(Q)],d.prototype,"simplificationToleranceUnits",void 0),t([x(ie,{ignoreUnknown:!1})],d.prototype,"timeAttributeName",void 0),t([x(ee)],d.prototype,"type",void 0),t([i({type:Boolean,json:{write:!0}})],d.prototype,"useHierarchy",void 0),t([x($)],d.prototype,"uturnAtJunctions",void 0),d=t([g("esri.rest.support.TravelMode")],d);const ae=d;function f(e,a){if(e==null)return null;const s={},m=new RegExp(`^${a}`,"i");for(const N of Object.keys(e))if(m.test(N)){const k=N.substring(a.length);s[C.fromJSON(k)]=e[N]}return s}function Y(e,a,s){if(e!=null){a.attributes||(a.attributes={});for(const m in e){const N=C.toJSON(m);a.attributes[`${s}${N}`]=e[m]}}}function E(e){const a={};for(const s of Object.keys(e)){const m=s;a[C.fromJSON(m)]=e[s]}return a}function j(e){const a={};for(const s of Object.keys(e)){const m=s;a[C.toJSON(m)]=e[s]}return a}function B(e,a){return e==null||a==null?null:Math.round((e-a)/6e4)}function ye(e){var m,N,k;const a=e.toJSON(),s=a;return s.accumulateAttributeNames&&(s.accumulateAttributeNames=(m=a.accumulateAttributeNames)==null?void 0:m.join()),s.attributeParameterValues&&(s.attributeParameterValues=JSON.stringify(a.attributeParameterValues)),s.barriers&&(s.barriers=JSON.stringify(a.barriers)),s.outSR&&(s.outSR=(N=a.outSR)==null?void 0:N.wkid),s.overrides&&(s.overrides=JSON.stringify(a.overrides)),s.polygonBarriers&&(s.polygonBarriers=JSON.stringify(a.polygonBarriers)),s.polylineBarriers&&(s.polylineBarriers=JSON.stringify(a.polylineBarriers)),s.restrictionAttributeNames&&(s.restrictionAttributeNames=(k=a.restrictionAttributeNames)==null?void 0:k.join()),s.stops&&(s.stops=JSON.stringify(a.stops)),s.travelMode&&(s.travelMode=JSON.stringify(a.travelMode)),s}var J;let c=J=class extends A(S){constructor(e){super(e),this.directionLineType=null,this.directionPointId=null,this.distance=null,this.duration=null,this.fromLevel=null,this.geometry=null,this.objectId=null,this.popupTemplate=null,this.symbol=null,this.toLevel=null,this.type="direction-line"}static fromGraphic(e){return new J({directionLineType:V.fromJSON(e.attributes.DirectionLineType),directionPointId:e.attributes.DirectionPointID,distance:e.attributes.Meters,duration:e.attributes.Minutes,fromLevel:e.attributes.FromLevel??null,geometry:e.geometry,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,symbol:e.symbol,toLevel:e.attributes.ToLevel??null})}toGraphic(){const e={ObjectID:this.objectId,DirectionLineType:this.directionLineType!=null?V.toJSON(this.directionLineType):null,DirectionPointID:this.directionPointId,Meters:this.distance,Minutes:this.duration};return this.fromLevel!=null&&(e.FromLevel=this.fromLevel),this.toLevel!=null&&(e.ToLevel=this.toLevel),new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};c.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"DirectionLineType",alias:"Line Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriDirectionsLineType",codedValues:[{name:"Unknown",code:0},{name:"Segment",code:1},{name:"Maneuver Segment",code:2},{name:"Restriction violation",code:3},{name:"Scale cost barrier crossing",code:4},{name:"Heavy Traffic",code:5},{name:"Slow Traffic",code:6},{name:"Moderate Traffic",code:7}]}},{name:"DirectionPointID",alias:"Direction Point ID",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1},{name:"FromLevel",alias:"Start from 3D Level",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1},{name:"Meters",alias:"Length in Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"Minutes",alias:"Duration in Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"ToLevel",alias:"End at 3D Level",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1}],c.popupInfo={title:"Direction Lines",fieldInfos:[{fieldName:"DirectionLineType",label:"Line Type",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"Meters",label:"Length in Meters",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Minutes",label:"Duration in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"DirectionPointID",label:"Direction Point ID",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"FromLevel",label:"Start from 3D Level",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ToLevel",label:"End at 3D Level",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i({type:V.apiValues,json:{read:{source:"attributes.DirectionLineType",reader:V.read}}})],c.prototype,"directionLineType",void 0),t([i({json:{read:{source:"attributes.DirectionPointID"}}})],c.prototype,"directionPointId",void 0),t([i({json:{read:{source:"attributes.Meters"}}})],c.prototype,"distance",void 0),t([i({json:{read:{source:"attributes.Minutes"}}})],c.prototype,"duration",void 0),t([i({json:{read:{source:"attributes.FromLevel"}}})],c.prototype,"fromLevel",void 0),t([i({type:z})],c.prototype,"geometry",void 0),t([i({json:{read:{source:"attributes.ObjectID"}}})],c.prototype,"objectId",void 0),t([i({type:F})],c.prototype,"popupTemplate",void 0),t([i({types:I})],c.prototype,"symbol",void 0),t([i({json:{read:{source:"attributes.ToLevel"}}})],c.prototype,"toLevel",void 0),t([i({readOnly:!0,json:{read:!1}})],c.prototype,"type",void 0),c=J=t([g("esri.rest.support.DirectionLine")],c);const Te=c;var R;let n=R=class extends A(S){constructor(e){super(e),this.alternateName=null,this.arrivalTime=null,this.arrivalTimeOffset=null,this.azimuth=null,this.branchName=null,this.directionPointType=null,this.displayText=null,this.exitName=null,this.geometry=null,this.intersectingName=null,this.level=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.sequence=null,this.shortVoiceInstruction=null,this.stopId=null,this.symbol=null,this.towardName=null,this.type="direction-point",this.voiceInstruction=null}readArrivalTime(e,a){return a.attributes.ArrivalTime!=null?new Date(a.attributes.ArrivalTime):null}static fromGraphic(e){return new R({alternateName:e.attributes.AlternateName??null,arrivalTime:e.attributes.ArrivalTime!=null?new Date(e.attributes.ArrivalTime):null,arrivalTimeOffset:e.attributes.ArrivalUTCOffset??null,azimuth:e.attributes.Azimuth??null,branchName:e.attributes.BranchName??null,directionPointType:W.fromJSON(e.attributes.DirectionPointType),displayText:e.attributes.DisplayText??null,exitName:e.attributes.ExitName??null,geometry:e.geometry,intersectingName:e.attributes.IntersectingName??null,level:e.attributes.Level??null,name:e.attributes.Name??null,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,sequence:e.attributes.Sequence,shortVoiceInstruction:e.attributes.ShortVoiceInstruction??null,stopId:e.attributes.StopID??null,symbol:e.symbol,towardName:e.attributes.TowardName??null,voiceInstruction:e.attributes.VoiceInstruction??null})}toGraphic(){const e={ObjectID:this.objectId,DirectionPointType:this.directionPointType!=null?W.toJSON(this.directionPointType):null,Sequence:this.sequence,StopID:this.stopId};return this.alternateName!=null&&(e.AlternateName=this.alternateName),this.arrivalTime!=null&&(e.ArrivalTime=this.arrivalTime.getTime()),this.arrivalTimeOffset!=null&&(e.ArrivalUTCOffset=this.arrivalTimeOffset),this.azimuth!=null&&(e.Azimuth=this.azimuth),this.branchName!=null&&(e.BranchName=this.branchName),this.displayText!=null&&(e.DisplayText=this.displayText),this.exitName!=null&&(e.ExitName=this.exitName),this.intersectingName!=null&&(e.IntersectingName=this.intersectingName),this.level!=null&&(e.Level=this.level),this.name!=null&&(e.Name=this.name),this.shortVoiceInstruction!=null&&(e.ShortVoiceInstruction=this.shortVoiceInstruction),this.towardName!=null&&(e.TowardName=this.towardName),this.voiceInstruction!=null&&(e.VoiceInstruction=this.voiceInstruction),new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};n.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"AlternateName",alias:"Alternative Feature Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"ArrivalTime",alias:"Maneuver Starts at",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"ArrivalUTCOffset",alias:"Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"Azimuth",alias:"Azimuth",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"BranchName",alias:"Signpost Branch Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"DirectionPointType",alias:"Directions Item Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriDirectionPointType",codedValues:[{name:"Unknown",code:0},{name:"",code:1},{name:"Arrive at stop",code:50},{name:"Depart at stop",code:51},{name:"Go straight",code:52},{name:"Take ferry",code:100},{name:"Take off ferry",code:101},{name:"Keep center at fork",code:102},{name:"Take roundabout",code:103},{name:"Make U-Turn",code:104},{name:"Pass the door",code:150},{name:"Take stairs",code:151},{name:"",code:152},{name:"Take escalator",code:153},{name:"Take pedestrian ramp",code:154},{name:"Keep left at fork",code:200},{name:"Ramp left",code:201},{name:"Take left-handed roundabout",code:202},{name:"Make left-handed U-Turn",code:203},{name:"Bear left",code:204},{name:"Turn left",code:205},{name:"Make sharp left",code:206},{name:"Turn left, followed by turn left",code:207},{name:"Turn left, followed by turn right",code:208},{name:"Keep right at fork",code:300},{name:"Ramp right",code:301},{name:"Take right-handed roundabout",code:302},{name:"Make right-handed U-Turn",code:303},{name:"Bear right",code:304},{name:"Turn right",code:305},{name:"Make sharp right",code:306},{name:"Turn right, followed by turn left",code:307},{name:"Turn right, followed by turn right",code:308},{name:"Indicates up direction of elevator",code:400},{name:"Indicates up direction of escalator",code:401},{name:"Take up-stairs",code:402},{name:"Indicates down direction of elevator",code:500},{name:"Indicates down direction of escalator",code:501},{name:"Take down-stairs",code:502},{name:"General event",code:1e3},{name:"Landmark",code:1001},{name:"Time zone change",code:1002},{name:"Heavy traffic segment",code:1003},{name:"Scale cost barrier crossing",code:1004},{name:"Administrative Border crossing",code:1005},{name:"Restriction violation",code:1006}]}},{name:"DisplayText",alias:"Text to Display",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"ExitName",alias:"Highway Exit Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"IntersectingName",alias:"Intersecting Feature Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"Level",alias:"3D Logical Level",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"Name",alias:"Primary Feature Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"Sequence",alias:"Sequence",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"ShortVoiceInstruction",alias:"Voice Instruction",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"StopID",alias:"Stop ID",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"TowardName",alias:"Signpost Toward Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"VoiceInstruction",alias:"Voice Full Instruction",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null}],n.popupInfo={title:"{DisplayText}",fieldInfos:[{fieldName:"DirectionPointType",label:"Directions Item Type",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"DisplayText",label:"Text to Display",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"Sequence",label:"Sequence",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"StopID",label:"Stop ID",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ArrivalTime",label:"Maneuver Starts at",isEditable:!0,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"ArrivalUTCOffset",label:"Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Azimuth",label:"Azimuth",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Name",label:"Primary Feature Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"AlternateName",label:"Alternative Feature Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"ExitName",label:"Highway Exit Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"IntersectingName",label:"Intersecting Feature Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"BranchName",label:"Signpost Branch Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"TowardName",label:"Signpost Toward Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"ShortVoiceInstruction",label:"Voice Instruction",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"VoiceInstruction",label:"Voice Full Instruction",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i()],n.prototype,"alternateName",void 0),t([i()],n.prototype,"arrivalTime",void 0),t([p("arrivalTime",["attributes.ArrivalTime"])],n.prototype,"readArrivalTime",null),t([i({json:{read:{source:"attributes.ArrivalUTCOffset"}}})],n.prototype,"arrivalTimeOffset",void 0),t([i({json:{read:{source:"attributes.Azimuth"}}})],n.prototype,"azimuth",void 0),t([i({json:{read:{source:"attributes.BranchName"}}})],n.prototype,"branchName",void 0),t([i({type:W.apiValues,json:{read:{source:"attributes.DirectionPointType",reader:W.read}}})],n.prototype,"directionPointType",void 0),t([i({json:{read:{source:"attributes.DisplayText"}}})],n.prototype,"displayText",void 0),t([i({json:{read:{source:"attributes.ExitName"}}})],n.prototype,"exitName",void 0),t([i({type:H})],n.prototype,"geometry",void 0),t([i()],n.prototype,"intersectingName",void 0),t([i()],n.prototype,"level",void 0),t([i({json:{read:{source:"attributes.Name"}}})],n.prototype,"name",void 0),t([i({json:{read:{source:"attributes.ObjectID"}}})],n.prototype,"objectId",void 0),t([i({type:F})],n.prototype,"popupTemplate",void 0),t([i({json:{read:{source:"attributes.Sequence"}}})],n.prototype,"sequence",void 0),t([i()],n.prototype,"shortVoiceInstruction",void 0),t([i({json:{read:{source:"attributes.StopID"}}})],n.prototype,"stopId",void 0),t([i({types:I})],n.prototype,"symbol",void 0),t([i({json:{read:{source:"attributes.TowardName"}}})],n.prototype,"towardName",void 0),t([i({readOnly:!0,json:{read:!1}})],n.prototype,"type",void 0),t([i()],n.prototype,"voiceInstruction",void 0),n=R=t([g("esri.rest.support.DirectionPoint")],n);const ve=n;var P;let u=P=class extends A(S){constructor(e){super(e),this.addedCost=null,this.barrierType=null,this.costs=null,this.curbApproach=null,this.fullEdge=null,this.geometry=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.sideOfEdge=null,this.sourceId=null,this.sourceOid=null,this.status=null,this.symbol=null,this.type="point-barrier"}readCosts(e,a){return f(a.attributes,"Attr_")}writeCosts(e,a){Y(e,a,"Attr_")}static fromGraphic(e){return new P({addedCost:e.attributes.AddedCost??null,barrierType:e.attributes.BarrierType!=null?v.fromJSON(e.attributes.BarrierType):null,costs:e.attributes.Costs!=null?E(JSON.parse(e.attributes.Costs)):null,curbApproach:e.attributes.CurbApproach!=null?b.fromJSON(e.attributes.CurbApproach):null,fullEdge:e.attributes.FullEdge!=null?U.fromJSON(e.attributes.FullEdge):null,geometry:e.geometry,name:e.attributes.Name??null,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,status:e.attributes.Status!=null?O.fromJSON(e.attributes.Status):null,symbol:e.symbol})}toGraphic(){const e={ObjectID:this.objectId,AddedCost:this.addedCost,BarrierType:this.barrierType!=null?v.toJSON(this.barrierType):null,Costs:this.costs!=null?JSON.stringify(j(this.costs)):null,CurbApproach:this.curbApproach!=null?b.toJSON(this.curbApproach):null,FullEdge:this.fullEdge!=null?U.toJSON(this.fullEdge):null,Name:this.name,Status:this.status!=null?O.toJSON(this.status):null};return new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};u.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"AddedCost",alias:"Added Cost",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0,domain:null},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNABarrierType",codedValues:[{name:"Restriction",code:0},{name:"Scaled Cost",code:1},{name:"Added Cost",code:2}]}},{name:"Costs",alias:"Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"CurbApproach",alias:"Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1,domain:{type:"codedValue",name:"esriNACurbApproachType",codedValues:[{name:"Either side",code:0},{name:"From the right",code:1},{name:"From the left",code:2},{name:"Depart in the same direction",code:3}]}},{name:"FullEdge",alias:"Full Edge",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNAIntYesNo",codedValues:[{name:"No",code:0},{name:"Yes",code:1}]}},{name:"Name",alias:"Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"Status",alias:"Status",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNAObjectStatus",codedValues:[{name:"OK",code:0},{name:"Not Located on Network",code:1},{name:"Network Unbuilt",code:2},{name:"Prohibited Street",code:3},{name:"Invalid Field Values",code:4},{name:"Cannot Reach",code:5},{name:"Time Window Violation",code:6}]}}],u.popupInfo={title:"Point Barriers",fieldInfos:[{fieldName:"Name",label:"Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"BarrierType",label:"Barrier Type",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"AddedCost",label:"Added Cost",isEditable:!0,tooltip:"",visible:!0,format:{places:3,digitSeparator:!0},stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i()],u.prototype,"addedCost",void 0),t([i({type:v.apiValues,json:{name:"attributes.BarrierType",read:{reader:v.read},write:{writer:v.write}}})],u.prototype,"barrierType",void 0),t([i()],u.prototype,"costs",void 0),t([p("costs",["attributes"])],u.prototype,"readCosts",null),t([D("costs")],u.prototype,"writeCosts",null),t([i({constructOnly:!0,type:b.apiValues,json:{read:{source:"attributes.CurbApproach",reader:b.read}}})],u.prototype,"curbApproach",void 0),t([i({type:U.apiValues,json:{name:"attributes.FullEdge",read:{reader:U.read},write:{writer:U.write}}})],u.prototype,"fullEdge",void 0),t([i({type:H,json:{write:!0}})],u.prototype,"geometry",void 0),t([i({json:{name:"attributes.Name"}})],u.prototype,"name",void 0),t([i({json:{name:"attributes.ObjectID"}})],u.prototype,"objectId",void 0),t([i({type:F})],u.prototype,"popupTemplate",void 0),t([i({type:L.apiValues,json:{read:{source:"attributes.SideOfEdge",reader:L.read}}})],u.prototype,"sideOfEdge",void 0),t([i({json:{read:{source:"attributes.SourceID"}}})],u.prototype,"sourceId",void 0),t([i({json:{read:{source:"attributes.SourceOID"}}})],u.prototype,"sourceOid",void 0),t([i({type:O.apiValues,json:{read:{source:"attributes.Status",reader:O.read}}})],u.prototype,"status",void 0),t([i({types:I})],u.prototype,"symbol",void 0),t([i({readOnly:!0,json:{read:!1}})],u.prototype,"type",void 0),u=P=t([g("esri.rest.support.PointBarrier")],u);const he=u;var _;let y=_=class extends A(S){constructor(e){super(e),this.barrierType=null,this.costs=null,this.geometry=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.scaleFactor=null,this.symbol=null,this.type="polygon-barrier"}readCosts(e,a){return f(a.attributes,"Attr_")}writeCosts(e,a){Y(e,a,"Attr_")}static fromGraphic(e){return new _({barrierType:e.attributes.BarrierType!=null?v.fromJSON(e.attributes.BarrierType):null,costs:e.attributes.Costs!=null?E(JSON.parse(e.attributes.Costs)):null,geometry:e.geometry,name:e.attributes.Name??null,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,scaleFactor:e.attributes.ScaleFactor??null,symbol:e.symbol})}toGraphic(){const e={ObjectID:this.objectId,BarrierType:this.barrierType!=null?v.toJSON(this.barrierType):null,Costs:this.costs!=null?JSON.stringify(j(this.costs)):null,Name:this.name??null,ScaleFactor:this.scaleFactor??null};return new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};y.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNABarrierType",codedValues:[{name:"Restriction",code:0},{name:"Scaled Cost",code:1},{name:"Added Cost",code:2}]}},{name:"Costs",alias:"Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"Name",alias:"Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"ScaleFactor",alias:"Scale Factor",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0}],y.popupInfo={title:"Polygon Barriers",fieldInfos:[{fieldName:"Name",label:"Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"BarrierType",label:"Barrier Type",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"ScaleFactor",isEditable:!0,tooltip:"",visible:!0,format:{places:3,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Costs",label:"Costs",isEditable:!0,tooltip:"",visible:!1,stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i({type:v.apiValues,json:{name:"attributes.BarrierType",read:{reader:v.read},write:{writer:v.write}}})],y.prototype,"barrierType",void 0),t([i()],y.prototype,"costs",void 0),t([p("costs",["attributes"])],y.prototype,"readCosts",null),t([D("costs")],y.prototype,"writeCosts",null),t([i({type:Z,json:{write:!0}})],y.prototype,"geometry",void 0),t([i({json:{name:"attributes.Name"}})],y.prototype,"name",void 0),t([i({json:{name:"attributes.ObjectID"}})],y.prototype,"objectId",void 0),t([i({type:F})],y.prototype,"popupTemplate",void 0),t([i()],y.prototype,"scaleFactor",void 0),t([i({types:I})],y.prototype,"symbol",void 0),t([i({readOnly:!0,json:{read:!1}})],y.prototype,"type",void 0),y=_=t([g("esri.rest.support.PolygonBarrier")],y);const fe=y;var q;let T=q=class extends A(S){constructor(e){super(e),this.barrierType=null,this.costs=null,this.geometry=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.scaleFactor=null,this.symbol=null,this.type="polyline-barrier"}readCosts(e,a){return f(a.attributes,"Attr_")}static fromGraphic(e){return new q({barrierType:e.attributes.BarrierType!=null?v.fromJSON(e.attributes.BarrierType):null,costs:e.attributes.Costs!=null?E(JSON.parse(e.attributes.Costs)):null,geometry:e.geometry,name:e.attributes.Name??null,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,scaleFactor:e.attributes.ScaleFactor??null,symbol:e.symbol})}toGraphic(){const e={ObjectID:this.objectId,BarrierType:this.barrierType!=null?v.toJSON(this.barrierType):null,Costs:this.costs!=null?JSON.stringify(j(this.costs)):null,Name:this.name,ScaleFactor:this.scaleFactor};return new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};T.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNABarrierType",codedValues:[{name:"Restriction",code:0},{name:"Scaled Cost",code:1},{name:"Added Cost",code:2}]}},{name:"Costs",alias:"Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"Name",alias:"Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"ScaleFactor",alias:"Scale Factor",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0}],T.popupInfo={title:"Line Barriers",fieldInfos:[{fieldName:"Name",label:"Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"BarrierType",label:"Barrier Type",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"ScaleFactor",isEditable:!0,tooltip:"",visible:!0,format:{places:3,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Costs",label:"Costs",isEditable:!0,tooltip:"",visible:!1,stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i({type:v.apiValues,json:{read:{source:"attributes.BarrierType",reader:v.read}}})],T.prototype,"barrierType",void 0),t([i()],T.prototype,"costs",void 0),t([p("costs",["attributes"])],T.prototype,"readCosts",null),t([i({type:z,json:{write:!0}})],T.prototype,"geometry",void 0),t([i({json:{name:"attributes.Name"}})],T.prototype,"name",void 0),t([i({json:{name:"attributes.ObjectID"}})],T.prototype,"objectId",void 0),t([i({type:F})],T.prototype,"popupTemplate",void 0),t([i()],T.prototype,"scaleFactor",void 0),t([i({types:I})],T.prototype,"symbol",void 0),t([i({readOnly:!0,json:{read:!1}})],T.prototype,"type",void 0),T=q=t([g("esri.rest.support.PolylineBarrier")],T);const ge=T;let h=class extends S{constructor(e){super(e),this.accumulateAttributes=null,this.directionsLanguage=null,this.findBestSequence=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.startTimeIsUTC=null,this.timeWindowsAreUTC=null,this.travelMode=null}readAccumulateAttributes(e){return e==null?null:e.map(a=>C.fromJSON(a))}writeAccumulateAttributes(e,a,s){e!=null&&e.length&&(a[s]=e.map(m=>C.toJSON(m)))}};t([i({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],h.prototype,"accumulateAttributes",void 0),t([p("accumulateAttributes")],h.prototype,"readAccumulateAttributes",null),t([D("accumulateAttributes")],h.prototype,"writeAccumulateAttributes",null),t([i({type:String,json:{write:!0}})],h.prototype,"directionsLanguage",void 0),t([i({type:Boolean,json:{write:!0}})],h.prototype,"findBestSequence",void 0),t([i({type:Boolean,json:{write:!0}})],h.prototype,"preserveFirstStop",void 0),t([i({type:Boolean,json:{write:!0}})],h.prototype,"preserveLastStop",void 0),t([i({type:Boolean,json:{write:!0}})],h.prototype,"startTimeIsUTC",void 0),t([i({type:Boolean,json:{write:!0}})],h.prototype,"timeWindowsAreUTC",void 0),t([i({type:ae,json:{write:!0}})],h.prototype,"travelMode",void 0),h=t([g("esri.layers.support.RouteSettings")],h);const re=h;var K;let l=K=class extends A(S){constructor(e){super(e),this.analysisSettings=null,this.endTime=null,this.endTimeOffset=null,this.firstStopId=null,this.geometry=null,this.lastStopId=null,this.messages=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.startTime=null,this.startTimeOffset=null,this.stopCount=null,this.symbol=null,this.totalCosts=null,this.totalDistance=null,this.totalDuration=null,this.totalLateDuration=null,this.totalViolations=null,this.totalWait=null,this.totalWaitDuration=null,this.type="route-info",this.version="1.0.0"}readEndTime(e,a){return a.attributes.EndTimeUTC!=null?new Date(a.attributes.EndTimeUTC):null}readEndTimeOffset(e,a){return B(a.attributes.EndTime,a.attributes.EndTimeUTC)}readStartTime(e,a){return a.attributes.StartTimeUTC!=null?new Date(a.attributes.StartTimeUTC):null}readStartTimeOffset(e,a){return B(a.attributes.StartTime,a.attributes.StartTimeUTC)}readTotalCosts(e,a){return f(a.attributes,"Total_")}readTotalViolations(e,a){return f(a.attributes,"TotalViolation_")}readTotalWait(e,a){return f(a.attributes,"TotalWait_")}static fromGraphic(e){return new K({analysisSettings:e.attributes.AnalysisSettings!=null?re.fromJSON(JSON.parse(e.attributes.AnalysisSettings)):null,endTime:e.attributes.EndTime!=null?new Date(e.attributes.EndTime):null,endTimeOffset:e.attributes.EndUTCOffset??null,geometry:e.geometry,messages:e.attributes.Messages!=null?JSON.parse(e.attributes.Messages):null,name:e.attributes.RouteName,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,startTime:e.attributes.StartTime!=null?new Date(e.attributes.StartTime):null,startTimeOffset:e.attributes.StartUTCOffset??null,symbol:e.symbol,totalCosts:e.attributes.TotalCosts!=null?E(JSON.parse(e.attributes.TotalCosts)):null,totalDistance:e.attributes.TotalMeters??null,totalDuration:e.attributes.TotalMinutes??null,totalLateDuration:e.attributes.TotalLateMinutes??null,totalWaitDuration:e.attributes.TotalWaitMinutes??null,version:e.attributes.Version})}toGraphic(){const e={ObjectID:this.objectId,AnalysisSettings:this.analysisSettings!=null?JSON.stringify(this.analysisSettings.toJSON()):null,EndTime:this.endTime!=null?this.endTime.getTime():null,EndUTCOffset:this.endTimeOffset,Messages:this.messages!=null?JSON.stringify(this.messages):null,RouteName:this.name,StartTime:this.startTime!=null?this.startTime.getTime():null,StartUTCOffset:this.startTimeOffset,TotalCosts:this.totalCosts!=null?JSON.stringify(j(this.totalCosts)):null,TotalLateMinutes:this.totalLateDuration,TotalMeters:this.totalDistance,TotalMinutes:this.totalDuration,TotalWaitMinutes:this.totalWaitDuration,Version:this.version};return new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};l.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"AnalysisSettings",alias:"Analysis Settings",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"EndTime",alias:"End Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"EndUTCOffset",alias:"End Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"Messages",alias:"Analysis Messages",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"RouteName",alias:"Route Name",type:"esriFieldTypeString",length:1024,editable:!0,nullable:!0,visible:!0,domain:null},{name:"StartTime",alias:"Start Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"StartUTCOffset",alias:"Start Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"TotalCosts",alias:"Total Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"TotalLateMinutes",alias:"Total Late Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"TotalMeters",alias:"Total Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"TotalMinutes",alias:"Total Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"TotalWaitMinutes",alias:"Total Wait Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"Version",alias:"Version",type:"esriFieldTypeString",length:16,editable:!0,nullable:!0,visible:!0,domain:null}],l.popupInfo={title:"Route Details",fieldInfos:[{fieldName:"RouteName",label:"Route Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"TotalMinutes",label:"Total Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalMeters",label:"Total Meters",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalLateMinutes",label:"Total Late Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalWaitMinutes",label:"Total Wait Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalCosts",label:"Total Costs",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"StartTime",label:"Start Time",isEditable:!1,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"StartUTCOffset",label:"Start Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"EndTime",label:"End Time",isEditable:!1,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"EndUTCOffset",label:"End Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Messages",label:"Analysis Messages",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"AnalysisSettings",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"Version",label:"Version",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i()],l.prototype,"analysisSettings",void 0),t([i()],l.prototype,"endTime",void 0),t([p("endTime",["attributes.EndTimeUTC"])],l.prototype,"readEndTime",null),t([i()],l.prototype,"endTimeOffset",void 0),t([p("endTimeOffset",["attributes.EndTime","attributes.EndTimeUTC"])],l.prototype,"readEndTimeOffset",null),t([i({json:{read:{source:"attributes.FirstStopID"}}})],l.prototype,"firstStopId",void 0),t([i({type:z})],l.prototype,"geometry",void 0),t([i({json:{read:{source:"attributes.LastStopID"}}})],l.prototype,"lastStopId",void 0),t([i()],l.prototype,"messages",void 0),t([i({json:{read:{source:"attributes.Name"}}})],l.prototype,"name",void 0),t([i({json:{read:{source:"attributes.ObjectID"}}})],l.prototype,"objectId",void 0),t([i({type:F})],l.prototype,"popupTemplate",void 0),t([i()],l.prototype,"startTime",void 0),t([p("startTime",["attributes.StartTimeUTC"])],l.prototype,"readStartTime",null),t([i()],l.prototype,"startTimeOffset",void 0),t([p("startTimeOffset",["attributes.StartTime","attributes.StartTimeUTC"])],l.prototype,"readStartTimeOffset",null),t([i({json:{read:{source:"attributes.StopCount"}}})],l.prototype,"stopCount",void 0),t([i({types:I})],l.prototype,"symbol",void 0),t([i()],l.prototype,"totalCosts",void 0),t([p("totalCosts",["attributes"])],l.prototype,"readTotalCosts",null),t([i()],l.prototype,"totalDistance",void 0),t([i()],l.prototype,"totalDuration",void 0),t([i()],l.prototype,"totalLateDuration",void 0),t([i()],l.prototype,"totalViolations",void 0),t([p("totalViolations",["attributes"])],l.prototype,"readTotalViolations",null),t([i()],l.prototype,"totalWait",void 0),t([p("totalWait",["attributes"])],l.prototype,"readTotalWait",null),t([i()],l.prototype,"totalWaitDuration",void 0),t([i({readOnly:!0,json:{read:!1}})],l.prototype,"type",void 0),t([i()],l.prototype,"version",void 0),l=K=t([g("esri.rest.support.RouteInfo")],l);const Se=l;var G;let r=G=class extends A(S){constructor(e){super(e),this.arriveCurbApproach=null,this.arriveTime=null,this.arriveTimeOffset=null,this.bearing=null,this.bearingTol=null,this.cumulativeCosts=null,this.cumulativeDistance=null,this.cumulativeDuration=null,this.curbApproach=null,this.departCurbApproach=null,this.departTime=null,this.departTimeOffset=null,this.distanceToNetworkInMeters=null,this.geometry=null,this.lateDuration=null,this.locationType=null,this.name=null,this.navLatency=null,this.objectId=null,this.popupTemplate=null,this.posAlong=null,this.routeName=null,this.serviceCosts=null,this.serviceDistance=null,this.serviceDuration=null,this.sequence=null,this.sideOfEdge=null,this.snapX=null,this.snapY=null,this.snapZ=null,this.sourceId=null,this.sourceOid=null,this.status=null,this.symbol=null,this.timeWindowEnd=null,this.timeWindowEndOffset=null,this.timeWindowStart=null,this.timeWindowStartOffset=null,this.type="stop",this.violations=null,this.waitDuration=null,this.wait=null}readArriveTimeOffset(e,a){return B(a.attributes.ArriveTime,a.attributes.ArriveTimeUTC)}readCumulativeCosts(e,a){return f(a.attributes,"Cumul_")}readDepartTimeOffset(e,a){return B(a.attributes.DepartTime,a.attributes.DepartTimeUTC)}readServiceCosts(e,a){return f(a.attributes,"Attr_")}writeServiceCosts(e,a){Y(e,a,"Attr_")}writeTimeWindowEnd(e,a){e!=null&&(a.attributes||(a.attributes={}),a.attributes.TimeWindowEnd=e.getTime())}writeTimeWindowStart(e,a){e!=null&&(a.attributes||(a.attributes={}),a.attributes.TimeWindowStart=e.getTime())}readViolations(e,a){return f(a.attributes,"Violation_")}readWait(e,a){return f(a.attributes,"Wait_")}static fromGraphic(e){return new G({arriveCurbApproach:e.attributes.ArrivalCurbApproach!=null?b.fromJSON(e.attributes.ArrivalCurbApproach):null,arriveTime:e.attributes.ArrivalTime!=null?new Date(e.attributes.ArrivalTime):null,arriveTimeOffset:e.attributes.ArrivalUTCOffset,cumulativeCosts:e.attributes.CumulativeCosts!=null?E(JSON.parse(e.attributes.CumulativeCosts)):null,cumulativeDistance:e.attributes.CumulativeMeters??null,cumulativeDuration:e.attributes.CumulativeMinutes??null,curbApproach:e.attributes.CurbApproach!=null?b.fromJSON(e.attributes.CurbApproach):null,departCurbApproach:e.attributes.DepartureCurbApproach!=null?b.fromJSON(e.attributes.DepartureCurbApproach):null,departTime:e.attributes.DepartureTime!=null?new Date(e.attributes.DepartureTime):null,departTimeOffset:e.attributes.DepartureUTCOffset??null,geometry:e.geometry,lateDuration:e.attributes.LateMinutes??null,locationType:e.attributes.LocationType!=null?M.fromJSON(e.attributes.LocationType):null,name:e.attributes.Name,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,routeName:e.attributes.RouteName,sequence:e.attributes.Sequence??null,serviceCosts:e.attributes.ServiceCosts!=null?E(JSON.parse(e.attributes.ServiceCosts)):null,serviceDistance:e.attributes.ServiceMeters??null,serviceDuration:e.attributes.ServiceMinutes??null,status:e.attributes.Status!=null?O.fromJSON(e.attributes.Status):null,symbol:e.symbol,timeWindowEnd:e.attributes.TimeWindowEnd!=null?new Date(e.attributes.TimeWindowEnd):null,timeWindowEndOffset:e.attributes.TimeWindowEndUTCOffset??null,timeWindowStart:e.attributes.TimeWindowStart!=null?new Date(e.attributes.TimeWindowStart):null,timeWindowStartOffset:e.attributes.TimeWindowStartUTCOffset??null,waitDuration:e.attributes.WaitMinutes??null})}toGraphic(){const e={ObjectID:this.objectId,ArrivalCurbApproach:this.arriveCurbApproach!=null?b.toJSON(this.arriveCurbApproach):null,ArrivalTime:this.arriveTime!=null?this.arriveTime.getTime():null,ArrivalUTCOffset:this.arriveTimeOffset,CumulativeCosts:this.cumulativeCosts!=null?JSON.stringify(j(this.cumulativeCosts)):null,CumulativeMeters:this.cumulativeDistance,CumulativeMinutes:this.cumulativeDuration,CurbApproach:this.curbApproach!=null?b.toJSON(this.curbApproach):null,DepartureCurbApproach:this.departCurbApproach!=null?b.toJSON(this.departCurbApproach):null,DepartureTime:this.departTime!=null?this.departTime.getTime():null,DepartureUTCOffset:this.departTimeOffset,LateMinutes:this.lateDuration,LocationType:this.locationType!=null?M.toJSON(this.locationType):null,Name:this.name,RouteName:this.routeName,Sequence:this.sequence,ServiceCosts:this.serviceCosts!=null?JSON.stringify(j(this.serviceCosts)):null,ServiceMeters:this.serviceDistance,ServiceMinutes:this.serviceDuration,Status:this.status!=null?O.toJSON(this.status):null,TimeWindowEnd:this.timeWindowEnd!=null?this.timeWindowEnd.getTime():null,TimeWindowEndUTCOffset:this.timeWindowEndOffset??this.arriveTimeOffset,TimeWindowStart:this.timeWindowStart!=null?this.timeWindowStart.getTime():null,TimeWindowStartUTCOffset:this.timeWindowStartOffset??this.arriveTimeOffset,WaitMinutes:this.waitDuration};return new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};r.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"ArrivalCurbApproach",alias:"Arrival Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNACurbApproachType",codedValues:[{name:"Either side",code:0},{name:"From the right",code:1},{name:"From the left",code:2},{name:"Depart in the same direction",code:3}]}},{name:"ArrivalTime",alias:"Arrival Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"ArrivalUTCOffset",alias:"Arrival Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"CumulativeCosts",alias:"Cumulative Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"CumulativeMeters",alias:"Cumulative Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"CumulativeMinutes",alias:"Cumulative Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"CurbApproach",alias:"Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1,domain:{type:"codedValue",name:"esriNACurbApproachType",codedValues:[{name:"Either side",code:0},{name:"From the right",code:1},{name:"From the left",code:2},{name:"Depart in the same direction",code:3}]}},{name:"DepartureCurbApproach",alias:"Departure Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNACurbApproachType",codedValues:[{name:"Either side",code:0},{name:"From the right",code:1},{name:"From the left",code:2},{name:"Depart in the same direction",code:3}]}},{name:"DepartureTime",alias:"Departure Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"DepartureUTCOffset",alias:"Departure Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"LateMinutes",alias:"Minutes Late",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"LocationType",alias:"Location Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNALocationType",codedValues:[{name:"Stop",code:0},{name:"Waypoint",code:1}]}},{name:"Name",alias:"Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"RouteName",alias:"Route Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"Sequence",alias:"Sequence",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"ServiceCosts",alias:"Service Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"ServiceMeters",alias:"Service Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"ServiceMinutes",alias:"Service Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"Status",alias:"Status",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNAObjectStatus",codedValues:[{name:"OK",code:0},{name:"Not Located on Network",code:1},{name:"Network Unbuilt",code:2},{name:"Prohibited Street",code:3},{name:"Invalid Field Values",code:4},{name:"Cannot Reach",code:5},{name:"Time Window Violation",code:6}]}},{name:"TimeWindowEnd",alias:"Time Window End",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!1},{name:"TimeWindowEndUTCOffset",alias:"Time Window End: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"TimeWindowStart",alias:"Time Window Start",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!1},{name:"TimeWindowStartUTCOffset",alias:"Time Window Start: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"WaitMinutes",alias:"Minutes Early",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1}],r.popupInfo={title:"{Name}",fieldInfos:[{fieldName:"Name",label:"Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"RouteName",label:"Route Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"Sequence",label:"Sequence",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ArrivalTime",label:"Arrival Time",isEditable:!0,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"ArrivalUTCOffset",label:"Arrival Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"DepartureTime",label:"Departure Time",isEditable:!0,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"DepartureUTCOffset",label:"Departure Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"CurbApproach",label:"Curb Approach",isEditable:!0,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ArrivalCurbApproach",label:"Arrival Curb Approach",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"DepartureCurbApproach",label:"Departure Curb Approach",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Status",label:"Status",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"LocationType",label:"Location Type",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TimeWindowStart",label:"Time Window Start",isEditable:!0,tooltip:"",visible:!1,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"TimeWindowStartUTCOffset",label:"Time Window Start: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TimeWindowEnd",label:"Time Window End",isEditable:!0,tooltip:"",visible:!1,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"TimeWindowEndUTCOffset",label:"Time Window End: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ServiceMinutes",label:"Service Minutes",isEditable:!0,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ServiceMeters",label:"Service Meters",isEditable:!0,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ServiceCosts",label:"Service Costs",isEditable:!0,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"CumulativeMinutes",label:"Cumulative Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"CumulativeMeters",label:"Cumulative Meters",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"CumulativeCosts",label:"Cumulative Costs",isEditable:!0,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"LateMinutes",label:"Minutes Late",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"WaitMinutes",label:"Minutes Early",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i({type:b.apiValues,json:{read:{source:"attributes.ArrivalCurbApproach",reader:b.read}}})],r.prototype,"arriveCurbApproach",void 0),t([i({type:Date,json:{read:{source:"attributes.ArriveTimeUTC"}}})],r.prototype,"arriveTime",void 0),t([i()],r.prototype,"arriveTimeOffset",void 0),t([p("arriveTimeOffset",["attributes.ArriveTime","attributes.ArriveTimeUTC"])],r.prototype,"readArriveTimeOffset",null),t([i({json:{name:"attributes.Bearing",read:!1,write:!0}})],r.prototype,"bearing",void 0),t([i({json:{name:"attributes.BearingTol",read:!1,write:!0}})],r.prototype,"bearingTol",void 0),t([i()],r.prototype,"cumulativeCosts",void 0),t([p("cumulativeCosts",["attributes"])],r.prototype,"readCumulativeCosts",null),t([i()],r.prototype,"cumulativeDistance",void 0),t([i()],r.prototype,"cumulativeDuration",void 0),t([i({type:b.apiValues,json:{name:"attributes.CurbApproach",read:{reader:b.read},write:{writer:b.write}}})],r.prototype,"curbApproach",void 0),t([i({type:b.apiValues,json:{read:{source:"attributes.DepartCurbApproach",reader:b.read}}})],r.prototype,"departCurbApproach",void 0),t([i({type:Date,json:{read:{source:"attributes.DepartTimeUTC"}}})],r.prototype,"departTime",void 0),t([i()],r.prototype,"departTimeOffset",void 0),t([p("departTimeOffset",["attributes.DepartTime","attributes.DepartTimeUTC"])],r.prototype,"readDepartTimeOffset",null),t([i({json:{read:{source:"attributes.DistanceToNetworkInMeters"}}})],r.prototype,"distanceToNetworkInMeters",void 0),t([i({type:H,json:{write:!0}})],r.prototype,"geometry",void 0),t([i()],r.prototype,"lateDuration",void 0),t([i({type:M.apiValues,json:{name:"attributes.LocationType",read:{reader:M.read},write:{writer:M.write}}})],r.prototype,"locationType",void 0),t([i({json:{name:"attributes.Name"}})],r.prototype,"name",void 0),t([i({json:{name:"attributes.NavLatency",read:!1,write:!0}})],r.prototype,"navLatency",void 0),t([i({json:{name:"attributes.ObjectID"}})],r.prototype,"objectId",void 0),t([i({type:F})],r.prototype,"popupTemplate",void 0),t([i({json:{read:{source:"attributes.PosAlong"}}})],r.prototype,"posAlong",void 0),t([i({json:{name:"attributes.RouteName"}})],r.prototype,"routeName",void 0),t([i()],r.prototype,"serviceCosts",void 0),t([p("serviceCosts",["attributes"])],r.prototype,"readServiceCosts",null),t([D("serviceCosts")],r.prototype,"writeServiceCosts",null),t([i()],r.prototype,"serviceDistance",void 0),t([i()],r.prototype,"serviceDuration",void 0),t([i({json:{name:"attributes.Sequence"}})],r.prototype,"sequence",void 0),t([i({type:L.apiValues,json:{read:{source:"attributes.SideOfEdge",reader:L.read}}})],r.prototype,"sideOfEdge",void 0),t([i({json:{read:{source:"attributes.SnapX"}}})],r.prototype,"snapX",void 0),t([i({json:{read:{source:"attributes.SnapY"}}})],r.prototype,"snapY",void 0),t([i({json:{read:{source:"attributes.SnapZ"}}})],r.prototype,"snapZ",void 0),t([i({json:{read:{source:"attributes.SourceID"}}})],r.prototype,"sourceId",void 0),t([i({json:{read:{source:"attributes.SourceOID"}}})],r.prototype,"sourceOid",void 0),t([i({type:O.apiValues,json:{read:{source:"attributes.Status",reader:O.read}}})],r.prototype,"status",void 0),t([i({types:I})],r.prototype,"symbol",void 0),t([i({type:Date,json:{name:"attributes.TimeWindowEnd"}})],r.prototype,"timeWindowEnd",void 0),t([D("timeWindowEnd")],r.prototype,"writeTimeWindowEnd",null),t([i()],r.prototype,"timeWindowEndOffset",void 0),t([i({type:Date,json:{name:"attributes.TimeWindowStart"}})],r.prototype,"timeWindowStart",void 0),t([D("timeWindowStart")],r.prototype,"writeTimeWindowStart",null),t([i()],r.prototype,"timeWindowStartOffset",void 0),t([i({readOnly:!0,json:{read:!1}})],r.prototype,"type",void 0),t([i()],r.prototype,"violations",void 0),t([p("violations",["attributes"])],r.prototype,"readViolations",null),t([i()],r.prototype,"waitDuration",void 0),t([i()],r.prototype,"wait",void 0),t([p("wait",["attributes"])],r.prototype,"readWait",null),r=G=t([g("esri.rest.support.Stop")],r);const Ne=r;export{he as C,X as D,Ne as O,be as R,Se as S,fe as T,C as U,ae as a,ce as b,ve as c,de as d,ne as e,ue as f,re as g,Q as i,ge as j,pe as k,$ as l,Te as m,B as n,ye as o,le as r,oe as s,me as w,ie as y}; +import{q2 as o,dq as A,e as t,y as i,iy as x,dt as p,du as D,c as g,dr as S,K as w,E as z,ix as F,mE as I,L as H,j as Z}from"./index-pCX-0tJH.js";const Q=o()({esriCentimeters:"centimeters",esriDecimalDegrees:"decimal-degrees",esriDecimeters:"decimeters",esriFeet:"feet",esriInches:"inches",esriKilometers:"kilometers",esriMeters:"meters",esriMiles:"miles",esriMillimeters:"millimeters",esriNauticalMiles:"nautical-miles",esriPoints:"points",esriUnknownUnits:"unknown",esriYards:"yards"}),le=o()({esriNAUCentimeters:"centimeters",esriNAUDecimalDegrees:"decimal-degrees",esriNAUDecimeters:"decimeters",esriNAUFeet:"feet",esriNAUInches:"inches",esriNAUKilometers:"kilometers",esriNAUMeters:"meters",esriNAUMiles:"miles",esriNAUMillimeters:"millimeters",esriNAUNauticalMiles:"nautical-miles",esriNAUPoints:"points",esriNAUYards:"yards"});o()({esriNAUDays:"days",esriNAUHours:"hours",esriNAUMinutes:"minutes",esriNAUSeconds:"seconds"});const oe=o()({esriNAUCentimeters:"centimeters",esriNAUDecimalDegrees:"decimal-degrees",esriNAUDecimeters:"decimeters",esriNAUFeet:"feet",esriNAUInches:"inches",esriNAUKilometers:"kilometers",esriNAUMeters:"meters",esriNAUMiles:"miles",esriNAUMillimeters:"millimeters",esriNAUNauticalMiles:"nautical-miles",esriNAUPoints:"points",esriNAUYards:"yards",esriNAUDays:"days",esriNAUHours:"hours",esriNAUMinutes:"minutes",esriNAUSeconds:"seconds",esriNAUKilometersPerHour:"kilometers-per-hour",esriNAUMilesPerHour:"miles-per-hour",esriNAUUnknown:"unknown"}),ne=o()({esriDOTComplete:"complete",esriDOTCompleteNoEvents:"complete-no-events",esriDOTFeatureSets:"featuresets",esriDOTInstructionsOnly:"instructions-only",esriDOTStandard:"standard",esriDOTSummaryOnly:"summary-only"}),ue=o()({esriNAOutputLineNone:"none",esriNAOutputLineStraight:"straight",esriNAOutputLineTrueShape:"true-shape",esriNAOutputLineTrueShapeWithMeasure:"true-shape-with-measure"});o()({esriNAOutputPolygonNone:"none",esriNAOutputPolygonSimplified:"simplified",esriNAOutputPolygonDetailed:"detailed"});const $=o()({esriNFSBAllowBacktrack:"allow-backtrack",esriNFSBAtDeadEndsOnly:"at-dead-ends-only",esriNFSBNoBacktrack:"no-backtrack",esriNFSBAtDeadEndsAndIntersections:"at-dead-ends-and-intersections"});o()({esriNATravelDirectionFromFacility:"from-facility",esriNATravelDirectionToFacility:"to-facility"});o()({esriNATimeOfDayNotUsed:"not-used",esriNATimeOfDayUseAsStartTime:"start",esriNATimeOfDayUseAsEndTime:"end"});const ee=o()({AUTOMOBILE:"automobile",TRUCK:"truck",WALK:"walk",OTHER:"other"}),b=o()({0:"either-side-of-vehicle",1:"right-side-of-vehicle",2:"left-side-of-vehicle",3:"no-u-turn"},{useNumericKeys:!0}),M=o()({0:"stop",1:"waypoint",2:"break"},{useNumericKeys:!0}),O=o()({0:"ok",1:"not-located",2:"network-element-not-located",3:"element-not-traversable",4:"invalid-field-values",5:"not-reached",6:"time-window-violation",7:"not-located-on-closest"},{useNumericKeys:!0}),L=o()({1:"right",2:"left"},{useNumericKeys:!0}),v=o()({0:"restriction",1:"scaled-cost",2:"added-cost"},{useNumericKeys:!0}),U=o()({0:"permit",1:"restrict"},{useNumericKeys:!0}),W=o()({1:"header",50:"arrive",51:"depart",52:"straight",100:"on-ferry",101:"off-ferry",102:"central-fork",103:"roundabout",104:"u-turn",150:"door",151:"stairs",152:"elevator",153:"escalator",154:"pedestrian-ramp",200:"left-fork",201:"left-ramp",202:"clockwise-roundabout",203:"left-handed-u-turn",204:"bear-left",205:"left-turn",206:"sharp-left",207:"left-turn-and-immediate-left-turn",208:"left-turn-and-immediate-right-turn",300:"right-fork",301:"right-ramp",302:"counter-clockwise-roundabout",303:"right-handed-u-turn",304:"bear-right",305:"right-turn",306:"sharp-right",307:"right-turn-and-immediate-left-turn",308:"right-turn-and-immediate-right-turn",400:"up-elevator",401:"up-escalator",402:"up-stairs",500:"down-elevator",501:"down-escalator",502:"down-stairs",1e3:"general-event",1001:"landmark",1002:"time-zone-change",1003:"traffic-event",1004:"scaled-cost-barrier-event",1005:"boundary-crossing",1006:"restriction-violation"},{useNumericKeys:!0}),V=o()({0:"unknown",1:"segment",2:"maneuver-segment",3:"restriction-violation",4:"scaled-cost-barrier",5:"heavy-traffic",6:"slow-traffic",7:"moderate-traffic"},{useNumericKeys:!0}),pe=o()({"NA Campus":"campus","NA Desktop":"desktop","NA Navigation":"navigation"}),te=o()({Kilometers:"kilometers",Miles:"miles",Meters:"meters"},{ignoreUnknown:!1}),ie=o()({Minutes:"minutes",TimeAt1KPH:"time-at-1-kph",TravelTime:"travel-time",TruckMinutes:"truck-minutes",TruckTravelTime:"truck-travel-time",WalkTime:"walk-time"},{ignoreUnknown:!1}),C=o()({Kilometers:"kilometers",Miles:"miles",Meters:"meters",Minutes:"minutes",TimeAt1KPH:"time-at-1-kph",TravelTime:"travel-time",TruckMinutes:"truck-minutes",TruckTravelTime:"truck-travel-time",WalkTime:"walk-time"},{ignoreUnknown:!1}),X=o()({"Any Hazmat Prohibited":"any-hazmat-prohibited","Avoid Carpool Roads":"avoid-carpool-roads","Avoid Express Lanes":"avoid-express-lanes","Avoid Ferries":"avoid-ferries","Avoid Gates":"avoid-gates","Avoid Limited Access Roads":"avoid-limited-access-roads","Avoid Private Roads":"avoid-private-roads","Avoid Roads Unsuitable for Pedestrians":"avoid-roads-unsuitable-for-pedestrians","Avoid Stairways":"avoid-stairways","Avoid Toll Roads":"avoid-toll-roads","Avoid Toll Roads for Trucks":"avoid-toll-roads-for-trucks","Avoid Truck Restricted Roads":"avoid-truck-restricted-roads","Avoid Unpaved Roads":"avoid-unpaved-roads","Axle Count Restriction":"axle-count-restriction","Driving a Bus":"driving-a-bus","Driving a Taxi":"driving-a-taxi","Driving a Truck":"driving-a-truck","Driving an Automobile":"driving-an-automobile","Driving an Emergency Vehicle":"driving-an-emergency-vehicle","Height Restriction":"height-restriction","Kingpin to Rear Axle Length Restriction":"kingpin-to-rear-axle-length-restriction","Length Restriction":"length-restriction","Preferred for Pedestrians":"preferred-for-pedestrians","Riding a Motorcycle":"riding-a-motorcycle","Roads Under Construction Prohibited":"roads-under-construction-prohibited","Semi or Tractor with One or More Trailers Prohibited":"semi-or-tractor-with-one-or-more-trailers-prohibited","Single Axle Vehicles Prohibited":"single-axle-vehicles-prohibited","Tandem Axle Vehicles Prohibited":"tandem-axle-vehicles-prohibited","Through Traffic Prohibited":"through-traffic-prohibited","Truck with Trailers Restriction":"truck-with-trailers-restriction","Use Preferred Hazmat Routes":"use-preferred-hazmat-routes","Use Preferred Truck Routes":"use-preferred-truck-routes",Walking:"walking","Weight Restriction":"weight-restriction"},{ignoreUnknown:!1}),de=o()({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),me=o()({esriGeometryPoint:"point",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"envelope",esriGeometryMultipoint:"multipoint"}),be=o()({esriNAUTCost:"cost",esriNAUTDescriptor:"descriptor",esriNAUTRestriction:"restriction",esriNAUTHierarchy:"hierarchy"}),ce=o()({esriDSTAltName:"alt-name",esriDSTArrive:"arrive",esriDSTBranch:"branch",esriDSTCrossStreet:"cross-street",esriDSTCumulativeLength:"cumulative-length",esriDSTDepart:"depart",esriDSTEstimatedArrivalTime:"estimated-arrival-time",esriDSTExit:"exit",esriDSTGeneral:"general",esriDSTLength:"length",esriDSTServiceTime:"service-time",esriDSTStreetName:"street-name",esriDSTSummary:"summary",esriDSTTime:"time",esriDSTTimeWindow:"time-window",esriDSTToward:"toward",esriDSTViolationTime:"violation-time",esriDSTWaitTime:"wait-time"});let d=class extends A(S){constructor(e){super(e),this.attributeParameterValues=null,this.description=null,this.distanceAttributeName=null,this.id=null,this.impedanceAttributeName=null,this.name=null,this.restrictionAttributeNames=null,this.simplificationTolerance=null,this.simplificationToleranceUnits=null,this.timeAttributeName=null,this.type=null,this.useHierarchy=null,this.uturnAtJunctions=null}readId(e,a){return a.id??a.itemId??null}readRestrictionAttributes(e,a){const{restrictionAttributeNames:s}=a;return s==null?null:s.map(m=>X.fromJSON(m))}writeRestrictionAttributes(e,a,s){e!=null&&(a[s]=e.map(m=>X.toJSON(m)))}};t([i({type:[Object],json:{write:!0}})],d.prototype,"attributeParameterValues",void 0),t([i({type:String,json:{write:!0}})],d.prototype,"description",void 0),t([x(te,{ignoreUnknown:!1})],d.prototype,"distanceAttributeName",void 0),t([i({type:String,json:{write:!0}})],d.prototype,"id",void 0),t([p("id",["id","itemId"])],d.prototype,"readId",null),t([x(C,{ignoreUnknown:!1})],d.prototype,"impedanceAttributeName",void 0),t([i({type:String,json:{write:!0}})],d.prototype,"name",void 0),t([i({type:[String],json:{write:!0}})],d.prototype,"restrictionAttributeNames",void 0),t([p("restrictionAttributeNames")],d.prototype,"readRestrictionAttributes",null),t([D("restrictionAttributeNames")],d.prototype,"writeRestrictionAttributes",null),t([i({type:Number,json:{write:{allowNull:!0}}})],d.prototype,"simplificationTolerance",void 0),t([x(Q)],d.prototype,"simplificationToleranceUnits",void 0),t([x(ie,{ignoreUnknown:!1})],d.prototype,"timeAttributeName",void 0),t([x(ee)],d.prototype,"type",void 0),t([i({type:Boolean,json:{write:!0}})],d.prototype,"useHierarchy",void 0),t([x($)],d.prototype,"uturnAtJunctions",void 0),d=t([g("esri.rest.support.TravelMode")],d);const ae=d;function f(e,a){if(e==null)return null;const s={},m=new RegExp(`^${a}`,"i");for(const N of Object.keys(e))if(m.test(N)){const k=N.substring(a.length);s[C.fromJSON(k)]=e[N]}return s}function Y(e,a,s){if(e!=null){a.attributes||(a.attributes={});for(const m in e){const N=C.toJSON(m);a.attributes[`${s}${N}`]=e[m]}}}function E(e){const a={};for(const s of Object.keys(e)){const m=s;a[C.fromJSON(m)]=e[s]}return a}function j(e){const a={};for(const s of Object.keys(e)){const m=s;a[C.toJSON(m)]=e[s]}return a}function B(e,a){return e==null||a==null?null:Math.round((e-a)/6e4)}function ye(e){var m,N,k;const a=e.toJSON(),s=a;return s.accumulateAttributeNames&&(s.accumulateAttributeNames=(m=a.accumulateAttributeNames)==null?void 0:m.join()),s.attributeParameterValues&&(s.attributeParameterValues=JSON.stringify(a.attributeParameterValues)),s.barriers&&(s.barriers=JSON.stringify(a.barriers)),s.outSR&&(s.outSR=(N=a.outSR)==null?void 0:N.wkid),s.overrides&&(s.overrides=JSON.stringify(a.overrides)),s.polygonBarriers&&(s.polygonBarriers=JSON.stringify(a.polygonBarriers)),s.polylineBarriers&&(s.polylineBarriers=JSON.stringify(a.polylineBarriers)),s.restrictionAttributeNames&&(s.restrictionAttributeNames=(k=a.restrictionAttributeNames)==null?void 0:k.join()),s.stops&&(s.stops=JSON.stringify(a.stops)),s.travelMode&&(s.travelMode=JSON.stringify(a.travelMode)),s}var J;let c=J=class extends A(S){constructor(e){super(e),this.directionLineType=null,this.directionPointId=null,this.distance=null,this.duration=null,this.fromLevel=null,this.geometry=null,this.objectId=null,this.popupTemplate=null,this.symbol=null,this.toLevel=null,this.type="direction-line"}static fromGraphic(e){return new J({directionLineType:V.fromJSON(e.attributes.DirectionLineType),directionPointId:e.attributes.DirectionPointID,distance:e.attributes.Meters,duration:e.attributes.Minutes,fromLevel:e.attributes.FromLevel??null,geometry:e.geometry,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,symbol:e.symbol,toLevel:e.attributes.ToLevel??null})}toGraphic(){const e={ObjectID:this.objectId,DirectionLineType:this.directionLineType!=null?V.toJSON(this.directionLineType):null,DirectionPointID:this.directionPointId,Meters:this.distance,Minutes:this.duration};return this.fromLevel!=null&&(e.FromLevel=this.fromLevel),this.toLevel!=null&&(e.ToLevel=this.toLevel),new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};c.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"DirectionLineType",alias:"Line Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriDirectionsLineType",codedValues:[{name:"Unknown",code:0},{name:"Segment",code:1},{name:"Maneuver Segment",code:2},{name:"Restriction violation",code:3},{name:"Scale cost barrier crossing",code:4},{name:"Heavy Traffic",code:5},{name:"Slow Traffic",code:6},{name:"Moderate Traffic",code:7}]}},{name:"DirectionPointID",alias:"Direction Point ID",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1},{name:"FromLevel",alias:"Start from 3D Level",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1},{name:"Meters",alias:"Length in Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"Minutes",alias:"Duration in Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"ToLevel",alias:"End at 3D Level",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1}],c.popupInfo={title:"Direction Lines",fieldInfos:[{fieldName:"DirectionLineType",label:"Line Type",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"Meters",label:"Length in Meters",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Minutes",label:"Duration in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"DirectionPointID",label:"Direction Point ID",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"FromLevel",label:"Start from 3D Level",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ToLevel",label:"End at 3D Level",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i({type:V.apiValues,json:{read:{source:"attributes.DirectionLineType",reader:V.read}}})],c.prototype,"directionLineType",void 0),t([i({json:{read:{source:"attributes.DirectionPointID"}}})],c.prototype,"directionPointId",void 0),t([i({json:{read:{source:"attributes.Meters"}}})],c.prototype,"distance",void 0),t([i({json:{read:{source:"attributes.Minutes"}}})],c.prototype,"duration",void 0),t([i({json:{read:{source:"attributes.FromLevel"}}})],c.prototype,"fromLevel",void 0),t([i({type:z})],c.prototype,"geometry",void 0),t([i({json:{read:{source:"attributes.ObjectID"}}})],c.prototype,"objectId",void 0),t([i({type:F})],c.prototype,"popupTemplate",void 0),t([i({types:I})],c.prototype,"symbol",void 0),t([i({json:{read:{source:"attributes.ToLevel"}}})],c.prototype,"toLevel",void 0),t([i({readOnly:!0,json:{read:!1}})],c.prototype,"type",void 0),c=J=t([g("esri.rest.support.DirectionLine")],c);const Te=c;var R;let n=R=class extends A(S){constructor(e){super(e),this.alternateName=null,this.arrivalTime=null,this.arrivalTimeOffset=null,this.azimuth=null,this.branchName=null,this.directionPointType=null,this.displayText=null,this.exitName=null,this.geometry=null,this.intersectingName=null,this.level=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.sequence=null,this.shortVoiceInstruction=null,this.stopId=null,this.symbol=null,this.towardName=null,this.type="direction-point",this.voiceInstruction=null}readArrivalTime(e,a){return a.attributes.ArrivalTime!=null?new Date(a.attributes.ArrivalTime):null}static fromGraphic(e){return new R({alternateName:e.attributes.AlternateName??null,arrivalTime:e.attributes.ArrivalTime!=null?new Date(e.attributes.ArrivalTime):null,arrivalTimeOffset:e.attributes.ArrivalUTCOffset??null,azimuth:e.attributes.Azimuth??null,branchName:e.attributes.BranchName??null,directionPointType:W.fromJSON(e.attributes.DirectionPointType),displayText:e.attributes.DisplayText??null,exitName:e.attributes.ExitName??null,geometry:e.geometry,intersectingName:e.attributes.IntersectingName??null,level:e.attributes.Level??null,name:e.attributes.Name??null,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,sequence:e.attributes.Sequence,shortVoiceInstruction:e.attributes.ShortVoiceInstruction??null,stopId:e.attributes.StopID??null,symbol:e.symbol,towardName:e.attributes.TowardName??null,voiceInstruction:e.attributes.VoiceInstruction??null})}toGraphic(){const e={ObjectID:this.objectId,DirectionPointType:this.directionPointType!=null?W.toJSON(this.directionPointType):null,Sequence:this.sequence,StopID:this.stopId};return this.alternateName!=null&&(e.AlternateName=this.alternateName),this.arrivalTime!=null&&(e.ArrivalTime=this.arrivalTime.getTime()),this.arrivalTimeOffset!=null&&(e.ArrivalUTCOffset=this.arrivalTimeOffset),this.azimuth!=null&&(e.Azimuth=this.azimuth),this.branchName!=null&&(e.BranchName=this.branchName),this.displayText!=null&&(e.DisplayText=this.displayText),this.exitName!=null&&(e.ExitName=this.exitName),this.intersectingName!=null&&(e.IntersectingName=this.intersectingName),this.level!=null&&(e.Level=this.level),this.name!=null&&(e.Name=this.name),this.shortVoiceInstruction!=null&&(e.ShortVoiceInstruction=this.shortVoiceInstruction),this.towardName!=null&&(e.TowardName=this.towardName),this.voiceInstruction!=null&&(e.VoiceInstruction=this.voiceInstruction),new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};n.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"AlternateName",alias:"Alternative Feature Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"ArrivalTime",alias:"Maneuver Starts at",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"ArrivalUTCOffset",alias:"Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"Azimuth",alias:"Azimuth",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"BranchName",alias:"Signpost Branch Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"DirectionPointType",alias:"Directions Item Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriDirectionPointType",codedValues:[{name:"Unknown",code:0},{name:"",code:1},{name:"Arrive at stop",code:50},{name:"Depart at stop",code:51},{name:"Go straight",code:52},{name:"Take ferry",code:100},{name:"Take off ferry",code:101},{name:"Keep center at fork",code:102},{name:"Take roundabout",code:103},{name:"Make U-Turn",code:104},{name:"Pass the door",code:150},{name:"Take stairs",code:151},{name:"",code:152},{name:"Take escalator",code:153},{name:"Take pedestrian ramp",code:154},{name:"Keep left at fork",code:200},{name:"Ramp left",code:201},{name:"Take left-handed roundabout",code:202},{name:"Make left-handed U-Turn",code:203},{name:"Bear left",code:204},{name:"Turn left",code:205},{name:"Make sharp left",code:206},{name:"Turn left, followed by turn left",code:207},{name:"Turn left, followed by turn right",code:208},{name:"Keep right at fork",code:300},{name:"Ramp right",code:301},{name:"Take right-handed roundabout",code:302},{name:"Make right-handed U-Turn",code:303},{name:"Bear right",code:304},{name:"Turn right",code:305},{name:"Make sharp right",code:306},{name:"Turn right, followed by turn left",code:307},{name:"Turn right, followed by turn right",code:308},{name:"Indicates up direction of elevator",code:400},{name:"Indicates up direction of escalator",code:401},{name:"Take up-stairs",code:402},{name:"Indicates down direction of elevator",code:500},{name:"Indicates down direction of escalator",code:501},{name:"Take down-stairs",code:502},{name:"General event",code:1e3},{name:"Landmark",code:1001},{name:"Time zone change",code:1002},{name:"Heavy traffic segment",code:1003},{name:"Scale cost barrier crossing",code:1004},{name:"Administrative Border crossing",code:1005},{name:"Restriction violation",code:1006}]}},{name:"DisplayText",alias:"Text to Display",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"ExitName",alias:"Highway Exit Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"IntersectingName",alias:"Intersecting Feature Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"Level",alias:"3D Logical Level",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"Name",alias:"Primary Feature Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"Sequence",alias:"Sequence",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"ShortVoiceInstruction",alias:"Voice Instruction",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"StopID",alias:"Stop ID",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"TowardName",alias:"Signpost Toward Name",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null},{name:"VoiceInstruction",alias:"Voice Full Instruction",type:"esriFieldTypeString",length:2048,editable:!0,nullable:!0,visible:!0,domain:null}],n.popupInfo={title:"{DisplayText}",fieldInfos:[{fieldName:"DirectionPointType",label:"Directions Item Type",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"DisplayText",label:"Text to Display",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"Sequence",label:"Sequence",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"StopID",label:"Stop ID",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ArrivalTime",label:"Maneuver Starts at",isEditable:!0,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"ArrivalUTCOffset",label:"Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Azimuth",label:"Azimuth",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Name",label:"Primary Feature Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"AlternateName",label:"Alternative Feature Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"ExitName",label:"Highway Exit Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"IntersectingName",label:"Intersecting Feature Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"BranchName",label:"Signpost Branch Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"TowardName",label:"Signpost Toward Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"ShortVoiceInstruction",label:"Voice Instruction",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"VoiceInstruction",label:"Voice Full Instruction",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i()],n.prototype,"alternateName",void 0),t([i()],n.prototype,"arrivalTime",void 0),t([p("arrivalTime",["attributes.ArrivalTime"])],n.prototype,"readArrivalTime",null),t([i({json:{read:{source:"attributes.ArrivalUTCOffset"}}})],n.prototype,"arrivalTimeOffset",void 0),t([i({json:{read:{source:"attributes.Azimuth"}}})],n.prototype,"azimuth",void 0),t([i({json:{read:{source:"attributes.BranchName"}}})],n.prototype,"branchName",void 0),t([i({type:W.apiValues,json:{read:{source:"attributes.DirectionPointType",reader:W.read}}})],n.prototype,"directionPointType",void 0),t([i({json:{read:{source:"attributes.DisplayText"}}})],n.prototype,"displayText",void 0),t([i({json:{read:{source:"attributes.ExitName"}}})],n.prototype,"exitName",void 0),t([i({type:H})],n.prototype,"geometry",void 0),t([i()],n.prototype,"intersectingName",void 0),t([i()],n.prototype,"level",void 0),t([i({json:{read:{source:"attributes.Name"}}})],n.prototype,"name",void 0),t([i({json:{read:{source:"attributes.ObjectID"}}})],n.prototype,"objectId",void 0),t([i({type:F})],n.prototype,"popupTemplate",void 0),t([i({json:{read:{source:"attributes.Sequence"}}})],n.prototype,"sequence",void 0),t([i()],n.prototype,"shortVoiceInstruction",void 0),t([i({json:{read:{source:"attributes.StopID"}}})],n.prototype,"stopId",void 0),t([i({types:I})],n.prototype,"symbol",void 0),t([i({json:{read:{source:"attributes.TowardName"}}})],n.prototype,"towardName",void 0),t([i({readOnly:!0,json:{read:!1}})],n.prototype,"type",void 0),t([i()],n.prototype,"voiceInstruction",void 0),n=R=t([g("esri.rest.support.DirectionPoint")],n);const ve=n;var P;let u=P=class extends A(S){constructor(e){super(e),this.addedCost=null,this.barrierType=null,this.costs=null,this.curbApproach=null,this.fullEdge=null,this.geometry=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.sideOfEdge=null,this.sourceId=null,this.sourceOid=null,this.status=null,this.symbol=null,this.type="point-barrier"}readCosts(e,a){return f(a.attributes,"Attr_")}writeCosts(e,a){Y(e,a,"Attr_")}static fromGraphic(e){return new P({addedCost:e.attributes.AddedCost??null,barrierType:e.attributes.BarrierType!=null?v.fromJSON(e.attributes.BarrierType):null,costs:e.attributes.Costs!=null?E(JSON.parse(e.attributes.Costs)):null,curbApproach:e.attributes.CurbApproach!=null?b.fromJSON(e.attributes.CurbApproach):null,fullEdge:e.attributes.FullEdge!=null?U.fromJSON(e.attributes.FullEdge):null,geometry:e.geometry,name:e.attributes.Name??null,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,status:e.attributes.Status!=null?O.fromJSON(e.attributes.Status):null,symbol:e.symbol})}toGraphic(){const e={ObjectID:this.objectId,AddedCost:this.addedCost,BarrierType:this.barrierType!=null?v.toJSON(this.barrierType):null,Costs:this.costs!=null?JSON.stringify(j(this.costs)):null,CurbApproach:this.curbApproach!=null?b.toJSON(this.curbApproach):null,FullEdge:this.fullEdge!=null?U.toJSON(this.fullEdge):null,Name:this.name,Status:this.status!=null?O.toJSON(this.status):null};return new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};u.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"AddedCost",alias:"Added Cost",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0,domain:null},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNABarrierType",codedValues:[{name:"Restriction",code:0},{name:"Scaled Cost",code:1},{name:"Added Cost",code:2}]}},{name:"Costs",alias:"Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"CurbApproach",alias:"Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1,domain:{type:"codedValue",name:"esriNACurbApproachType",codedValues:[{name:"Either side",code:0},{name:"From the right",code:1},{name:"From the left",code:2},{name:"Depart in the same direction",code:3}]}},{name:"FullEdge",alias:"Full Edge",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNAIntYesNo",codedValues:[{name:"No",code:0},{name:"Yes",code:1}]}},{name:"Name",alias:"Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"Status",alias:"Status",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNAObjectStatus",codedValues:[{name:"OK",code:0},{name:"Not Located on Network",code:1},{name:"Network Unbuilt",code:2},{name:"Prohibited Street",code:3},{name:"Invalid Field Values",code:4},{name:"Cannot Reach",code:5},{name:"Time Window Violation",code:6}]}}],u.popupInfo={title:"Point Barriers",fieldInfos:[{fieldName:"Name",label:"Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"BarrierType",label:"Barrier Type",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"AddedCost",label:"Added Cost",isEditable:!0,tooltip:"",visible:!0,format:{places:3,digitSeparator:!0},stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i()],u.prototype,"addedCost",void 0),t([i({type:v.apiValues,json:{name:"attributes.BarrierType",read:{reader:v.read},write:{writer:v.write}}})],u.prototype,"barrierType",void 0),t([i()],u.prototype,"costs",void 0),t([p("costs",["attributes"])],u.prototype,"readCosts",null),t([D("costs")],u.prototype,"writeCosts",null),t([i({constructOnly:!0,type:b.apiValues,json:{read:{source:"attributes.CurbApproach",reader:b.read}}})],u.prototype,"curbApproach",void 0),t([i({type:U.apiValues,json:{name:"attributes.FullEdge",read:{reader:U.read},write:{writer:U.write}}})],u.prototype,"fullEdge",void 0),t([i({type:H,json:{write:!0}})],u.prototype,"geometry",void 0),t([i({json:{name:"attributes.Name"}})],u.prototype,"name",void 0),t([i({json:{name:"attributes.ObjectID"}})],u.prototype,"objectId",void 0),t([i({type:F})],u.prototype,"popupTemplate",void 0),t([i({type:L.apiValues,json:{read:{source:"attributes.SideOfEdge",reader:L.read}}})],u.prototype,"sideOfEdge",void 0),t([i({json:{read:{source:"attributes.SourceID"}}})],u.prototype,"sourceId",void 0),t([i({json:{read:{source:"attributes.SourceOID"}}})],u.prototype,"sourceOid",void 0),t([i({type:O.apiValues,json:{read:{source:"attributes.Status",reader:O.read}}})],u.prototype,"status",void 0),t([i({types:I})],u.prototype,"symbol",void 0),t([i({readOnly:!0,json:{read:!1}})],u.prototype,"type",void 0),u=P=t([g("esri.rest.support.PointBarrier")],u);const he=u;var _;let y=_=class extends A(S){constructor(e){super(e),this.barrierType=null,this.costs=null,this.geometry=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.scaleFactor=null,this.symbol=null,this.type="polygon-barrier"}readCosts(e,a){return f(a.attributes,"Attr_")}writeCosts(e,a){Y(e,a,"Attr_")}static fromGraphic(e){return new _({barrierType:e.attributes.BarrierType!=null?v.fromJSON(e.attributes.BarrierType):null,costs:e.attributes.Costs!=null?E(JSON.parse(e.attributes.Costs)):null,geometry:e.geometry,name:e.attributes.Name??null,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,scaleFactor:e.attributes.ScaleFactor??null,symbol:e.symbol})}toGraphic(){const e={ObjectID:this.objectId,BarrierType:this.barrierType!=null?v.toJSON(this.barrierType):null,Costs:this.costs!=null?JSON.stringify(j(this.costs)):null,Name:this.name??null,ScaleFactor:this.scaleFactor??null};return new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};y.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNABarrierType",codedValues:[{name:"Restriction",code:0},{name:"Scaled Cost",code:1},{name:"Added Cost",code:2}]}},{name:"Costs",alias:"Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"Name",alias:"Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"ScaleFactor",alias:"Scale Factor",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0}],y.popupInfo={title:"Polygon Barriers",fieldInfos:[{fieldName:"Name",label:"Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"BarrierType",label:"Barrier Type",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"ScaleFactor",isEditable:!0,tooltip:"",visible:!0,format:{places:3,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Costs",label:"Costs",isEditable:!0,tooltip:"",visible:!1,stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i({type:v.apiValues,json:{name:"attributes.BarrierType",read:{reader:v.read},write:{writer:v.write}}})],y.prototype,"barrierType",void 0),t([i()],y.prototype,"costs",void 0),t([p("costs",["attributes"])],y.prototype,"readCosts",null),t([D("costs")],y.prototype,"writeCosts",null),t([i({type:Z,json:{write:!0}})],y.prototype,"geometry",void 0),t([i({json:{name:"attributes.Name"}})],y.prototype,"name",void 0),t([i({json:{name:"attributes.ObjectID"}})],y.prototype,"objectId",void 0),t([i({type:F})],y.prototype,"popupTemplate",void 0),t([i()],y.prototype,"scaleFactor",void 0),t([i({types:I})],y.prototype,"symbol",void 0),t([i({readOnly:!0,json:{read:!1}})],y.prototype,"type",void 0),y=_=t([g("esri.rest.support.PolygonBarrier")],y);const fe=y;var q;let T=q=class extends A(S){constructor(e){super(e),this.barrierType=null,this.costs=null,this.geometry=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.scaleFactor=null,this.symbol=null,this.type="polyline-barrier"}readCosts(e,a){return f(a.attributes,"Attr_")}static fromGraphic(e){return new q({barrierType:e.attributes.BarrierType!=null?v.fromJSON(e.attributes.BarrierType):null,costs:e.attributes.Costs!=null?E(JSON.parse(e.attributes.Costs)):null,geometry:e.geometry,name:e.attributes.Name??null,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,scaleFactor:e.attributes.ScaleFactor??null,symbol:e.symbol})}toGraphic(){const e={ObjectID:this.objectId,BarrierType:this.barrierType!=null?v.toJSON(this.barrierType):null,Costs:this.costs!=null?JSON.stringify(j(this.costs)):null,Name:this.name,ScaleFactor:this.scaleFactor};return new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};T.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"BarrierType",alias:"Barrier Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNABarrierType",codedValues:[{name:"Restriction",code:0},{name:"Scaled Cost",code:1},{name:"Added Cost",code:2}]}},{name:"Costs",alias:"Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"Name",alias:"Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"ScaleFactor",alias:"Scale Factor",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0}],T.popupInfo={title:"Line Barriers",fieldInfos:[{fieldName:"Name",label:"Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"BarrierType",label:"Barrier Type",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"ScaleFactor",isEditable:!0,tooltip:"",visible:!0,format:{places:3,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Costs",label:"Costs",isEditable:!0,tooltip:"",visible:!1,stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i({type:v.apiValues,json:{read:{source:"attributes.BarrierType",reader:v.read}}})],T.prototype,"barrierType",void 0),t([i()],T.prototype,"costs",void 0),t([p("costs",["attributes"])],T.prototype,"readCosts",null),t([i({type:z,json:{write:!0}})],T.prototype,"geometry",void 0),t([i({json:{name:"attributes.Name"}})],T.prototype,"name",void 0),t([i({json:{name:"attributes.ObjectID"}})],T.prototype,"objectId",void 0),t([i({type:F})],T.prototype,"popupTemplate",void 0),t([i()],T.prototype,"scaleFactor",void 0),t([i({types:I})],T.prototype,"symbol",void 0),t([i({readOnly:!0,json:{read:!1}})],T.prototype,"type",void 0),T=q=t([g("esri.rest.support.PolylineBarrier")],T);const ge=T;let h=class extends S{constructor(e){super(e),this.accumulateAttributes=null,this.directionsLanguage=null,this.findBestSequence=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.startTimeIsUTC=null,this.timeWindowsAreUTC=null,this.travelMode=null}readAccumulateAttributes(e){return e==null?null:e.map(a=>C.fromJSON(a))}writeAccumulateAttributes(e,a,s){e!=null&&e.length&&(a[s]=e.map(m=>C.toJSON(m)))}};t([i({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],h.prototype,"accumulateAttributes",void 0),t([p("accumulateAttributes")],h.prototype,"readAccumulateAttributes",null),t([D("accumulateAttributes")],h.prototype,"writeAccumulateAttributes",null),t([i({type:String,json:{write:!0}})],h.prototype,"directionsLanguage",void 0),t([i({type:Boolean,json:{write:!0}})],h.prototype,"findBestSequence",void 0),t([i({type:Boolean,json:{write:!0}})],h.prototype,"preserveFirstStop",void 0),t([i({type:Boolean,json:{write:!0}})],h.prototype,"preserveLastStop",void 0),t([i({type:Boolean,json:{write:!0}})],h.prototype,"startTimeIsUTC",void 0),t([i({type:Boolean,json:{write:!0}})],h.prototype,"timeWindowsAreUTC",void 0),t([i({type:ae,json:{write:!0}})],h.prototype,"travelMode",void 0),h=t([g("esri.layers.support.RouteSettings")],h);const re=h;var K;let l=K=class extends A(S){constructor(e){super(e),this.analysisSettings=null,this.endTime=null,this.endTimeOffset=null,this.firstStopId=null,this.geometry=null,this.lastStopId=null,this.messages=null,this.name=null,this.objectId=null,this.popupTemplate=null,this.startTime=null,this.startTimeOffset=null,this.stopCount=null,this.symbol=null,this.totalCosts=null,this.totalDistance=null,this.totalDuration=null,this.totalLateDuration=null,this.totalViolations=null,this.totalWait=null,this.totalWaitDuration=null,this.type="route-info",this.version="1.0.0"}readEndTime(e,a){return a.attributes.EndTimeUTC!=null?new Date(a.attributes.EndTimeUTC):null}readEndTimeOffset(e,a){return B(a.attributes.EndTime,a.attributes.EndTimeUTC)}readStartTime(e,a){return a.attributes.StartTimeUTC!=null?new Date(a.attributes.StartTimeUTC):null}readStartTimeOffset(e,a){return B(a.attributes.StartTime,a.attributes.StartTimeUTC)}readTotalCosts(e,a){return f(a.attributes,"Total_")}readTotalViolations(e,a){return f(a.attributes,"TotalViolation_")}readTotalWait(e,a){return f(a.attributes,"TotalWait_")}static fromGraphic(e){return new K({analysisSettings:e.attributes.AnalysisSettings!=null?re.fromJSON(JSON.parse(e.attributes.AnalysisSettings)):null,endTime:e.attributes.EndTime!=null?new Date(e.attributes.EndTime):null,endTimeOffset:e.attributes.EndUTCOffset??null,geometry:e.geometry,messages:e.attributes.Messages!=null?JSON.parse(e.attributes.Messages):null,name:e.attributes.RouteName,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,startTime:e.attributes.StartTime!=null?new Date(e.attributes.StartTime):null,startTimeOffset:e.attributes.StartUTCOffset??null,symbol:e.symbol,totalCosts:e.attributes.TotalCosts!=null?E(JSON.parse(e.attributes.TotalCosts)):null,totalDistance:e.attributes.TotalMeters??null,totalDuration:e.attributes.TotalMinutes??null,totalLateDuration:e.attributes.TotalLateMinutes??null,totalWaitDuration:e.attributes.TotalWaitMinutes??null,version:e.attributes.Version})}toGraphic(){const e={ObjectID:this.objectId,AnalysisSettings:this.analysisSettings!=null?JSON.stringify(this.analysisSettings.toJSON()):null,EndTime:this.endTime!=null?this.endTime.getTime():null,EndUTCOffset:this.endTimeOffset,Messages:this.messages!=null?JSON.stringify(this.messages):null,RouteName:this.name,StartTime:this.startTime!=null?this.startTime.getTime():null,StartUTCOffset:this.startTimeOffset,TotalCosts:this.totalCosts!=null?JSON.stringify(j(this.totalCosts)):null,TotalLateMinutes:this.totalLateDuration,TotalMeters:this.totalDistance,TotalMinutes:this.totalDuration,TotalWaitMinutes:this.totalWaitDuration,Version:this.version};return new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};l.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"AnalysisSettings",alias:"Analysis Settings",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"EndTime",alias:"End Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"EndUTCOffset",alias:"End Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"Messages",alias:"Analysis Messages",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"RouteName",alias:"Route Name",type:"esriFieldTypeString",length:1024,editable:!0,nullable:!0,visible:!0,domain:null},{name:"StartTime",alias:"Start Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"StartUTCOffset",alias:"Start Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"TotalCosts",alias:"Total Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"TotalLateMinutes",alias:"Total Late Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"TotalMeters",alias:"Total Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"TotalMinutes",alias:"Total Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"TotalWaitMinutes",alias:"Total Wait Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"Version",alias:"Version",type:"esriFieldTypeString",length:16,editable:!0,nullable:!0,visible:!0,domain:null}],l.popupInfo={title:"Route Details",fieldInfos:[{fieldName:"RouteName",label:"Route Name",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"TotalMinutes",label:"Total Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalMeters",label:"Total Meters",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalLateMinutes",label:"Total Late Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalWaitMinutes",label:"Total Wait Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TotalCosts",label:"Total Costs",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"StartTime",label:"Start Time",isEditable:!1,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"StartUTCOffset",label:"Start Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"EndTime",label:"End Time",isEditable:!1,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"EndUTCOffset",label:"End Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Messages",label:"Analysis Messages",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"AnalysisSettings",isEditable:!1,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"Version",label:"Version",isEditable:!1,tooltip:"",visible:!0,stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i()],l.prototype,"analysisSettings",void 0),t([i()],l.prototype,"endTime",void 0),t([p("endTime",["attributes.EndTimeUTC"])],l.prototype,"readEndTime",null),t([i()],l.prototype,"endTimeOffset",void 0),t([p("endTimeOffset",["attributes.EndTime","attributes.EndTimeUTC"])],l.prototype,"readEndTimeOffset",null),t([i({json:{read:{source:"attributes.FirstStopID"}}})],l.prototype,"firstStopId",void 0),t([i({type:z})],l.prototype,"geometry",void 0),t([i({json:{read:{source:"attributes.LastStopID"}}})],l.prototype,"lastStopId",void 0),t([i()],l.prototype,"messages",void 0),t([i({json:{read:{source:"attributes.Name"}}})],l.prototype,"name",void 0),t([i({json:{read:{source:"attributes.ObjectID"}}})],l.prototype,"objectId",void 0),t([i({type:F})],l.prototype,"popupTemplate",void 0),t([i()],l.prototype,"startTime",void 0),t([p("startTime",["attributes.StartTimeUTC"])],l.prototype,"readStartTime",null),t([i()],l.prototype,"startTimeOffset",void 0),t([p("startTimeOffset",["attributes.StartTime","attributes.StartTimeUTC"])],l.prototype,"readStartTimeOffset",null),t([i({json:{read:{source:"attributes.StopCount"}}})],l.prototype,"stopCount",void 0),t([i({types:I})],l.prototype,"symbol",void 0),t([i()],l.prototype,"totalCosts",void 0),t([p("totalCosts",["attributes"])],l.prototype,"readTotalCosts",null),t([i()],l.prototype,"totalDistance",void 0),t([i()],l.prototype,"totalDuration",void 0),t([i()],l.prototype,"totalLateDuration",void 0),t([i()],l.prototype,"totalViolations",void 0),t([p("totalViolations",["attributes"])],l.prototype,"readTotalViolations",null),t([i()],l.prototype,"totalWait",void 0),t([p("totalWait",["attributes"])],l.prototype,"readTotalWait",null),t([i()],l.prototype,"totalWaitDuration",void 0),t([i({readOnly:!0,json:{read:!1}})],l.prototype,"type",void 0),t([i()],l.prototype,"version",void 0),l=K=t([g("esri.rest.support.RouteInfo")],l);const Se=l;var G;let r=G=class extends A(S){constructor(e){super(e),this.arriveCurbApproach=null,this.arriveTime=null,this.arriveTimeOffset=null,this.bearing=null,this.bearingTol=null,this.cumulativeCosts=null,this.cumulativeDistance=null,this.cumulativeDuration=null,this.curbApproach=null,this.departCurbApproach=null,this.departTime=null,this.departTimeOffset=null,this.distanceToNetworkInMeters=null,this.geometry=null,this.lateDuration=null,this.locationType=null,this.name=null,this.navLatency=null,this.objectId=null,this.popupTemplate=null,this.posAlong=null,this.routeName=null,this.serviceCosts=null,this.serviceDistance=null,this.serviceDuration=null,this.sequence=null,this.sideOfEdge=null,this.snapX=null,this.snapY=null,this.snapZ=null,this.sourceId=null,this.sourceOid=null,this.status=null,this.symbol=null,this.timeWindowEnd=null,this.timeWindowEndOffset=null,this.timeWindowStart=null,this.timeWindowStartOffset=null,this.type="stop",this.violations=null,this.waitDuration=null,this.wait=null}readArriveTimeOffset(e,a){return B(a.attributes.ArriveTime,a.attributes.ArriveTimeUTC)}readCumulativeCosts(e,a){return f(a.attributes,"Cumul_")}readDepartTimeOffset(e,a){return B(a.attributes.DepartTime,a.attributes.DepartTimeUTC)}readServiceCosts(e,a){return f(a.attributes,"Attr_")}writeServiceCosts(e,a){Y(e,a,"Attr_")}writeTimeWindowEnd(e,a){e!=null&&(a.attributes||(a.attributes={}),a.attributes.TimeWindowEnd=e.getTime())}writeTimeWindowStart(e,a){e!=null&&(a.attributes||(a.attributes={}),a.attributes.TimeWindowStart=e.getTime())}readViolations(e,a){return f(a.attributes,"Violation_")}readWait(e,a){return f(a.attributes,"Wait_")}static fromGraphic(e){return new G({arriveCurbApproach:e.attributes.ArrivalCurbApproach!=null?b.fromJSON(e.attributes.ArrivalCurbApproach):null,arriveTime:e.attributes.ArrivalTime!=null?new Date(e.attributes.ArrivalTime):null,arriveTimeOffset:e.attributes.ArrivalUTCOffset,cumulativeCosts:e.attributes.CumulativeCosts!=null?E(JSON.parse(e.attributes.CumulativeCosts)):null,cumulativeDistance:e.attributes.CumulativeMeters??null,cumulativeDuration:e.attributes.CumulativeMinutes??null,curbApproach:e.attributes.CurbApproach!=null?b.fromJSON(e.attributes.CurbApproach):null,departCurbApproach:e.attributes.DepartureCurbApproach!=null?b.fromJSON(e.attributes.DepartureCurbApproach):null,departTime:e.attributes.DepartureTime!=null?new Date(e.attributes.DepartureTime):null,departTimeOffset:e.attributes.DepartureUTCOffset??null,geometry:e.geometry,lateDuration:e.attributes.LateMinutes??null,locationType:e.attributes.LocationType!=null?M.fromJSON(e.attributes.LocationType):null,name:e.attributes.Name,objectId:e.attributes.ObjectID??e.attributes.__OBJECTID,popupTemplate:e.popupTemplate,routeName:e.attributes.RouteName,sequence:e.attributes.Sequence??null,serviceCosts:e.attributes.ServiceCosts!=null?E(JSON.parse(e.attributes.ServiceCosts)):null,serviceDistance:e.attributes.ServiceMeters??null,serviceDuration:e.attributes.ServiceMinutes??null,status:e.attributes.Status!=null?O.fromJSON(e.attributes.Status):null,symbol:e.symbol,timeWindowEnd:e.attributes.TimeWindowEnd!=null?new Date(e.attributes.TimeWindowEnd):null,timeWindowEndOffset:e.attributes.TimeWindowEndUTCOffset??null,timeWindowStart:e.attributes.TimeWindowStart!=null?new Date(e.attributes.TimeWindowStart):null,timeWindowStartOffset:e.attributes.TimeWindowStartUTCOffset??null,waitDuration:e.attributes.WaitMinutes??null})}toGraphic(){const e={ObjectID:this.objectId,ArrivalCurbApproach:this.arriveCurbApproach!=null?b.toJSON(this.arriveCurbApproach):null,ArrivalTime:this.arriveTime!=null?this.arriveTime.getTime():null,ArrivalUTCOffset:this.arriveTimeOffset,CumulativeCosts:this.cumulativeCosts!=null?JSON.stringify(j(this.cumulativeCosts)):null,CumulativeMeters:this.cumulativeDistance,CumulativeMinutes:this.cumulativeDuration,CurbApproach:this.curbApproach!=null?b.toJSON(this.curbApproach):null,DepartureCurbApproach:this.departCurbApproach!=null?b.toJSON(this.departCurbApproach):null,DepartureTime:this.departTime!=null?this.departTime.getTime():null,DepartureUTCOffset:this.departTimeOffset,LateMinutes:this.lateDuration,LocationType:this.locationType!=null?M.toJSON(this.locationType):null,Name:this.name,RouteName:this.routeName,Sequence:this.sequence,ServiceCosts:this.serviceCosts!=null?JSON.stringify(j(this.serviceCosts)):null,ServiceMeters:this.serviceDistance,ServiceMinutes:this.serviceDuration,Status:this.status!=null?O.toJSON(this.status):null,TimeWindowEnd:this.timeWindowEnd!=null?this.timeWindowEnd.getTime():null,TimeWindowEndUTCOffset:this.timeWindowEndOffset??this.arriveTimeOffset,TimeWindowStart:this.timeWindowStart!=null?this.timeWindowStart.getTime():null,TimeWindowStartUTCOffset:this.timeWindowStartOffset??this.arriveTimeOffset,WaitMinutes:this.waitDuration};return new w({geometry:this.geometry,attributes:e,symbol:this.symbol,popupTemplate:this.popupTemplate})}};r.fields=[{name:"ObjectID",alias:"ObjectID",type:"esriFieldTypeOID",editable:!1,nullable:!1,domain:null},{name:"ArrivalCurbApproach",alias:"Arrival Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNACurbApproachType",codedValues:[{name:"Either side",code:0},{name:"From the right",code:1},{name:"From the left",code:2},{name:"Depart in the same direction",code:3}]}},{name:"ArrivalTime",alias:"Arrival Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"ArrivalUTCOffset",alias:"Arrival Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"CumulativeCosts",alias:"Cumulative Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"CumulativeMeters",alias:"Cumulative Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"CumulativeMinutes",alias:"Cumulative Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!0},{name:"CurbApproach",alias:"Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!1,domain:{type:"codedValue",name:"esriNACurbApproachType",codedValues:[{name:"Either side",code:0},{name:"From the right",code:1},{name:"From the left",code:2},{name:"Depart in the same direction",code:3}]}},{name:"DepartureCurbApproach",alias:"Departure Curb Approach",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNACurbApproachType",codedValues:[{name:"Either side",code:0},{name:"From the right",code:1},{name:"From the left",code:2},{name:"Depart in the same direction",code:3}]}},{name:"DepartureTime",alias:"Departure Time",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!0},{name:"DepartureUTCOffset",alias:"Departure Time: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"LateMinutes",alias:"Minutes Late",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"LocationType",alias:"Location Type",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNALocationType",codedValues:[{name:"Stop",code:0},{name:"Waypoint",code:1}]}},{name:"Name",alias:"Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"RouteName",alias:"Route Name",type:"esriFieldTypeString",length:255,editable:!0,nullable:!0,visible:!0},{name:"Sequence",alias:"Sequence",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"ServiceCosts",alias:"Service Costs",type:"esriFieldTypeString",length:1048576,editable:!0,nullable:!0,visible:!1,domain:null},{name:"ServiceMeters",alias:"Service Meters",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"ServiceMinutes",alias:"Service Minutes",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1},{name:"Status",alias:"Status",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0,domain:{type:"codedValue",name:"esriNAObjectStatus",codedValues:[{name:"OK",code:0},{name:"Not Located on Network",code:1},{name:"Network Unbuilt",code:2},{name:"Prohibited Street",code:3},{name:"Invalid Field Values",code:4},{name:"Cannot Reach",code:5},{name:"Time Window Violation",code:6}]}},{name:"TimeWindowEnd",alias:"Time Window End",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!1},{name:"TimeWindowEndUTCOffset",alias:"Time Window End: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"TimeWindowStart",alias:"Time Window Start",type:"esriFieldTypeDate",length:36,editable:!0,nullable:!0,visible:!1},{name:"TimeWindowStartUTCOffset",alias:"Time Window Start: Offset from UTC in Minutes",type:"esriFieldTypeInteger",editable:!0,nullable:!0,visible:!0},{name:"WaitMinutes",alias:"Minutes Early",type:"esriFieldTypeDouble",editable:!0,nullable:!0,visible:!1}],r.popupInfo={title:"{Name}",fieldInfos:[{fieldName:"Name",label:"Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"RouteName",label:"Route Name",isEditable:!0,tooltip:"",visible:!0,stringFieldOption:"textbox"},{fieldName:"Sequence",label:"Sequence",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ArrivalTime",label:"Arrival Time",isEditable:!0,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"ArrivalUTCOffset",label:"Arrival Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"DepartureTime",label:"Departure Time",isEditable:!0,tooltip:"",visible:!0,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"DepartureUTCOffset",label:"Departure Time: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"CurbApproach",label:"Curb Approach",isEditable:!0,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ArrivalCurbApproach",label:"Arrival Curb Approach",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"DepartureCurbApproach",label:"Departure Curb Approach",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"Status",label:"Status",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"LocationType",label:"Location Type",isEditable:!1,tooltip:"",visible:!0,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TimeWindowStart",label:"Time Window Start",isEditable:!0,tooltip:"",visible:!1,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"TimeWindowStartUTCOffset",label:"Time Window Start: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"TimeWindowEnd",label:"Time Window End",isEditable:!0,tooltip:"",visible:!1,format:{dateFormat:"shortDateShortTime24"},stringFieldOption:"textbox"},{fieldName:"TimeWindowEndUTCOffset",label:"Time Window End: Offset from UTC in Minutes",isEditable:!1,tooltip:"",visible:!1,format:{places:0,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ServiceMinutes",label:"Service Minutes",isEditable:!0,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ServiceMeters",label:"Service Meters",isEditable:!0,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"ServiceCosts",label:"Service Costs",isEditable:!0,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"CumulativeMinutes",label:"Cumulative Minutes",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"CumulativeMeters",label:"Cumulative Meters",isEditable:!1,tooltip:"",visible:!0,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"CumulativeCosts",label:"Cumulative Costs",isEditable:!0,tooltip:"",visible:!1,stringFieldOption:"textbox"},{fieldName:"LateMinutes",label:"Minutes Late",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"},{fieldName:"WaitMinutes",label:"Minutes Early",isEditable:!1,tooltip:"",visible:!1,format:{places:2,digitSeparator:!0},stringFieldOption:"textbox"}],description:null,showAttachments:!1,mediaInfos:[]},t([i({type:b.apiValues,json:{read:{source:"attributes.ArrivalCurbApproach",reader:b.read}}})],r.prototype,"arriveCurbApproach",void 0),t([i({type:Date,json:{read:{source:"attributes.ArriveTimeUTC"}}})],r.prototype,"arriveTime",void 0),t([i()],r.prototype,"arriveTimeOffset",void 0),t([p("arriveTimeOffset",["attributes.ArriveTime","attributes.ArriveTimeUTC"])],r.prototype,"readArriveTimeOffset",null),t([i({json:{name:"attributes.Bearing",read:!1,write:!0}})],r.prototype,"bearing",void 0),t([i({json:{name:"attributes.BearingTol",read:!1,write:!0}})],r.prototype,"bearingTol",void 0),t([i()],r.prototype,"cumulativeCosts",void 0),t([p("cumulativeCosts",["attributes"])],r.prototype,"readCumulativeCosts",null),t([i()],r.prototype,"cumulativeDistance",void 0),t([i()],r.prototype,"cumulativeDuration",void 0),t([i({type:b.apiValues,json:{name:"attributes.CurbApproach",read:{reader:b.read},write:{writer:b.write}}})],r.prototype,"curbApproach",void 0),t([i({type:b.apiValues,json:{read:{source:"attributes.DepartCurbApproach",reader:b.read}}})],r.prototype,"departCurbApproach",void 0),t([i({type:Date,json:{read:{source:"attributes.DepartTimeUTC"}}})],r.prototype,"departTime",void 0),t([i()],r.prototype,"departTimeOffset",void 0),t([p("departTimeOffset",["attributes.DepartTime","attributes.DepartTimeUTC"])],r.prototype,"readDepartTimeOffset",null),t([i({json:{read:{source:"attributes.DistanceToNetworkInMeters"}}})],r.prototype,"distanceToNetworkInMeters",void 0),t([i({type:H,json:{write:!0}})],r.prototype,"geometry",void 0),t([i()],r.prototype,"lateDuration",void 0),t([i({type:M.apiValues,json:{name:"attributes.LocationType",read:{reader:M.read},write:{writer:M.write}}})],r.prototype,"locationType",void 0),t([i({json:{name:"attributes.Name"}})],r.prototype,"name",void 0),t([i({json:{name:"attributes.NavLatency",read:!1,write:!0}})],r.prototype,"navLatency",void 0),t([i({json:{name:"attributes.ObjectID"}})],r.prototype,"objectId",void 0),t([i({type:F})],r.prototype,"popupTemplate",void 0),t([i({json:{read:{source:"attributes.PosAlong"}}})],r.prototype,"posAlong",void 0),t([i({json:{name:"attributes.RouteName"}})],r.prototype,"routeName",void 0),t([i()],r.prototype,"serviceCosts",void 0),t([p("serviceCosts",["attributes"])],r.prototype,"readServiceCosts",null),t([D("serviceCosts")],r.prototype,"writeServiceCosts",null),t([i()],r.prototype,"serviceDistance",void 0),t([i()],r.prototype,"serviceDuration",void 0),t([i({json:{name:"attributes.Sequence"}})],r.prototype,"sequence",void 0),t([i({type:L.apiValues,json:{read:{source:"attributes.SideOfEdge",reader:L.read}}})],r.prototype,"sideOfEdge",void 0),t([i({json:{read:{source:"attributes.SnapX"}}})],r.prototype,"snapX",void 0),t([i({json:{read:{source:"attributes.SnapY"}}})],r.prototype,"snapY",void 0),t([i({json:{read:{source:"attributes.SnapZ"}}})],r.prototype,"snapZ",void 0),t([i({json:{read:{source:"attributes.SourceID"}}})],r.prototype,"sourceId",void 0),t([i({json:{read:{source:"attributes.SourceOID"}}})],r.prototype,"sourceOid",void 0),t([i({type:O.apiValues,json:{read:{source:"attributes.Status",reader:O.read}}})],r.prototype,"status",void 0),t([i({types:I})],r.prototype,"symbol",void 0),t([i({type:Date,json:{name:"attributes.TimeWindowEnd"}})],r.prototype,"timeWindowEnd",void 0),t([D("timeWindowEnd")],r.prototype,"writeTimeWindowEnd",null),t([i()],r.prototype,"timeWindowEndOffset",void 0),t([i({type:Date,json:{name:"attributes.TimeWindowStart"}})],r.prototype,"timeWindowStart",void 0),t([D("timeWindowStart")],r.prototype,"writeTimeWindowStart",null),t([i()],r.prototype,"timeWindowStartOffset",void 0),t([i({readOnly:!0,json:{read:!1}})],r.prototype,"type",void 0),t([i()],r.prototype,"violations",void 0),t([p("violations",["attributes"])],r.prototype,"readViolations",null),t([i()],r.prototype,"waitDuration",void 0),t([i()],r.prototype,"wait",void 0),t([p("wait",["attributes"])],r.prototype,"readWait",null),r=G=t([g("esri.rest.support.Stop")],r);const Ne=r;export{he as C,X as D,Ne as O,be as R,Se as S,fe as T,C as U,ae as a,ce as b,ve as c,de as d,ne as e,ue as f,re as g,Q as i,ge as j,pe as k,$ as l,Te as m,B as n,ye as o,le as r,oe as s,me as w,ie as y}; diff --git a/dist/assets/StreamFeatureManager-QrKJ84_c.js b/dist/assets/StreamFeatureManager-Iguqr18K.js similarity index 98% rename from dist/assets/StreamFeatureManager-QrKJ84_c.js rename to dist/assets/StreamFeatureManager-Iguqr18K.js index e8e969d..6d0f9f6 100644 --- a/dist/assets/StreamFeatureManager-QrKJ84_c.js +++ b/dist/assets/StreamFeatureManager-Iguqr18K.js @@ -1 +1 @@ -import{bm as c}from"./index-J0iiHjMT.js";class n{constructor(t){this.size=0,this._start=0,this.maxSize=t,this._buffer=new Array(t)}get entries(){return this._buffer}enqueue(t){if(this.size===this.maxSize){const e=this._buffer[this._start];return this._buffer[this._start]=t,this._start=(this._start+1)%this.maxSize,e}return this._buffer[(this._start+this.size++)%this.maxSize]=t,null}dequeue(){if(this.size===0)return null;const t=this._buffer[this._start];return this._buffer[this._start]=null,this.size--,this._start=(this._start+1)%this.maxSize,t}peek(){return this.size===0?null:this._buffer[this._start]}find(t){if(this.size===0)return null;for(const e of this._buffer)if(e!=null&&t(e))return e;return null}clear(t){let e=this.dequeue();for(;e!=null;)t&&t(e),e=this.dequeue()}}const l="__esri_stream_id__",a="__esri_timestamp__",d=1e3;class p{constructor(t,e,s,i,r=128){this._trackIdToObservations=new Map,this._idCounter=0,this._lastPurge=performance.now(),this._addOrUpdated=new Map,this._removed=[],this._maxAge=0,this._timeInfo=s,this._purgeOptions=i,this.store=t,this.objectIdField=e,this.purgeInterval=r,this._useGeneratedIds=this.objectIdField===l}removeById(t){this._removed.push(t)}removeByTrackId(t){const e=this._trackIdToObservations.get(t);if(e)for(const s of e.entries)this._removed.push(s)}add(t){var h;if(this._useGeneratedIds){const o=this._nextId();t.attributes[this.objectIdField]=o,t.objectId=o}else t.objectId=t.attributes[this.objectIdField];const e=t.objectId;if(this._addOrUpdated.set(e,t),this._maxAge=Math.max(this._maxAge,t.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return this._trackIdLessObservations==null&&(this._trackIdLessObservations=new n(1e5)),void this._trackIdLessObservations.enqueue(e);const s=t.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(s)){const o=((h=this._purgeOptions)==null?void 0:h.maxObservations)!=null?this._purgeOptions.maxObservations:d,_=c(o,0,d);this._trackIdToObservations.set(s,new n(_))}const i=this._trackIdToObservations.get(s),r=i==null?void 0:i.enqueue(e);r!=null&&(this._addOrUpdated.has(r)?this._addOrUpdated.delete(r):this._removed.push(r))}checkForUpdates(){const t=this._getToAdd(),e=this._getToRemove(),s=performance.now();s-this._lastPurge>=this.purgeInterval&&(this._purge(s),this._lastPurge=s);const i=[];if(e!=null)for(const h of e){const o=this.store.removeById(h);o!=null&&i.push(o)}const r=[];if(t!=null){const h=new Set(e??[]);for(const o of t)h.has(o.objectId)||(o.attributes[a]=s,this.store.add(o),r.push(o))}(r.length||i!=null&&i.length)&&this.store.update(r,i)}_getToAdd(){if(!this._addOrUpdated.size)return null;const t=new Array(this._addOrUpdated.size);let e=0;return this._addOrUpdated.forEach(s=>t[e++]=s),this._addOrUpdated.clear(),t}_getToRemove(){const t=this._removed;return this._removed.length?(this._removed=[],t):null}_nextId(){const t=this._idCounter;return this._idCounter=(this._idCounter+1)%4294967294+1,t}_purge(t){const e=this._purgeOptions;e!=null&&(this._purgeSomeByDisplayCount(e),this._purgeByAge(e),this._purgeByAgeReceived(t,e),this._purgeTracks())}_purgeSomeByDisplayCount(t){if(!t.displayCount)return;let e=this.store.size;if(e>t.displayCount){if(this._timeInfo.trackIdField){for(const s of this._trackIdToObservations.values())if(e>t.displayCount&&s.size){const i=s.dequeue();this._removed.push(i),e--}}if(this._trackIdLessObservations!=null){let s=e-t.displayCount;for(;s-- >0;){const i=this._trackIdLessObservations.dequeue();i!=null&&this._removed.push(i)}}}}_purgeByAge(t){var r;const e=(r=this._timeInfo)==null?void 0:r.startTimeField;if(!t.age||!e)return;const s=60*t.age*1e3,i=this._maxAge-s;this.store.forEach(h=>{h.attributes[e]{i.attributes[a]{t.size===0&&this._trackIdToObservations.delete(e)})}}export{p as o,n as t}; +import{bE as c}from"./index-pCX-0tJH.js";class n{constructor(t){this.size=0,this._start=0,this.maxSize=t,this._buffer=new Array(t)}get entries(){return this._buffer}enqueue(t){if(this.size===this.maxSize){const e=this._buffer[this._start];return this._buffer[this._start]=t,this._start=(this._start+1)%this.maxSize,e}return this._buffer[(this._start+this.size++)%this.maxSize]=t,null}dequeue(){if(this.size===0)return null;const t=this._buffer[this._start];return this._buffer[this._start]=null,this.size--,this._start=(this._start+1)%this.maxSize,t}peek(){return this.size===0?null:this._buffer[this._start]}find(t){if(this.size===0)return null;for(const e of this._buffer)if(e!=null&&t(e))return e;return null}clear(t){let e=this.dequeue();for(;e!=null;)t&&t(e),e=this.dequeue()}}const l="__esri_stream_id__",a="__esri_timestamp__",d=1e3;class p{constructor(t,e,s,i,r=128){this._trackIdToObservations=new Map,this._idCounter=0,this._lastPurge=performance.now(),this._addOrUpdated=new Map,this._removed=[],this._maxAge=0,this._timeInfo=s,this._purgeOptions=i,this.store=t,this.objectIdField=e,this.purgeInterval=r,this._useGeneratedIds=this.objectIdField===l}removeById(t){this._removed.push(t)}removeByTrackId(t){const e=this._trackIdToObservations.get(t);if(e)for(const s of e.entries)this._removed.push(s)}add(t){var h;if(this._useGeneratedIds){const o=this._nextId();t.attributes[this.objectIdField]=o,t.objectId=o}else t.objectId=t.attributes[this.objectIdField];const e=t.objectId;if(this._addOrUpdated.set(e,t),this._maxAge=Math.max(this._maxAge,t.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return this._trackIdLessObservations==null&&(this._trackIdLessObservations=new n(1e5)),void this._trackIdLessObservations.enqueue(e);const s=t.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(s)){const o=((h=this._purgeOptions)==null?void 0:h.maxObservations)!=null?this._purgeOptions.maxObservations:d,_=c(o,0,d);this._trackIdToObservations.set(s,new n(_))}const i=this._trackIdToObservations.get(s),r=i==null?void 0:i.enqueue(e);r!=null&&(this._addOrUpdated.has(r)?this._addOrUpdated.delete(r):this._removed.push(r))}checkForUpdates(){const t=this._getToAdd(),e=this._getToRemove(),s=performance.now();s-this._lastPurge>=this.purgeInterval&&(this._purge(s),this._lastPurge=s);const i=[];if(e!=null)for(const h of e){const o=this.store.removeById(h);o!=null&&i.push(o)}const r=[];if(t!=null){const h=new Set(e??[]);for(const o of t)h.has(o.objectId)||(o.attributes[a]=s,this.store.add(o),r.push(o))}(r.length||i!=null&&i.length)&&this.store.update(r,i)}_getToAdd(){if(!this._addOrUpdated.size)return null;const t=new Array(this._addOrUpdated.size);let e=0;return this._addOrUpdated.forEach(s=>t[e++]=s),this._addOrUpdated.clear(),t}_getToRemove(){const t=this._removed;return this._removed.length?(this._removed=[],t):null}_nextId(){const t=this._idCounter;return this._idCounter=(this._idCounter+1)%4294967294+1,t}_purge(t){const e=this._purgeOptions;e!=null&&(this._purgeSomeByDisplayCount(e),this._purgeByAge(e),this._purgeByAgeReceived(t,e),this._purgeTracks())}_purgeSomeByDisplayCount(t){if(!t.displayCount)return;let e=this.store.size;if(e>t.displayCount){if(this._timeInfo.trackIdField){for(const s of this._trackIdToObservations.values())if(e>t.displayCount&&s.size){const i=s.dequeue();this._removed.push(i),e--}}if(this._trackIdLessObservations!=null){let s=e-t.displayCount;for(;s-- >0;){const i=this._trackIdLessObservations.dequeue();i!=null&&this._removed.push(i)}}}}_purgeByAge(t){var r;const e=(r=this._timeInfo)==null?void 0:r.startTimeField;if(!t.age||!e)return;const s=60*t.age*1e3,i=this._maxAge-s;this.store.forEach(h=>{h.attributes[e]{i.attributes[a]{t.size===0&&this._trackIdToObservations.delete(e)})}}export{p as o,n as t}; diff --git a/dist/assets/StreamLayer-FMdUAhtW.js b/dist/assets/StreamLayer-FMdUAhtW.js new file mode 100644 index 0000000..fb1be88 --- /dev/null +++ b/dist/assets/StreamLayer-FMdUAhtW.js @@ -0,0 +1,7 @@ +import{e as t,y as s,c as S,dr as F,dF as P,ee as O,dJ as A,dG as E,ef as k,dH as D,dI as L,dK as N,dq as C,d2 as j,bs as U,r as p,dL as V,iG as f,jh as G,R as J,ji as M,de as v,f9 as h,fq as z,io as q,aL as W,jj as m,av as H,es as K,iH as Q,dl as Y,hA as Z,dO as B,iJ as X,iK as ee,iL as te,dQ as ie,er as g,jk as se,jl as re,iw as oe,ix as ne,iN as ae,iv as le,dt as w,ah as de,iO as pe,dR as ce,iz as me,aI as ue}from"./index-pCX-0tJH.js";import{o as he}from"./CustomParametersMixin-7nmugR3Y.js";import{p as ye}from"./FeatureEffectLayer-OK0TB5f6.js";import{c as fe}from"./FeatureReductionLayer-2X2_PJv9.js";import"./FeatureEffect-0Jn9Z0sQ.js";var y;let d=y=class extends F{constructor(){super(...arguments),this.age=null,this.ageReceived=null,this.displayCount=null,this.maxObservations=1}clone(){return new y({age:this.age,ageReceived:this.ageReceived,displayCount:this.displayCount,maxObservations:this.maxObservations})}};t([s({type:Number,json:{write:!0}})],d.prototype,"age",void 0),t([s({type:Number,json:{write:!0}})],d.prototype,"ageReceived",void 0),t([s({type:Number,json:{write:!0}})],d.prototype,"displayCount",void 0),t([s({type:Number,json:{write:!0}})],d.prototype,"maxObservations",void 0),d=y=t([S("esri.layers.support.PurgeOptions")],d);const x=d,b=me();function I(e,r){return new p("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${r}`,{layer:e})}let i=class extends fe(ye(P(O(A(E(k(D(L(N(he(C(ue)))))))))))){constructor(...e){super(...e),this.copyright=null,this.definitionExpression=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.geometryDefinition=null,this.geometryType=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.maxReconnectionAttempts=0,this.maxReconnectionInterval=20,this.maxScale=0,this.minScale=0,this.objectIdField=null,this.operationalLayerType="ArcGISStreamLayer",this.outFields=["*"],this.popupEnabled=!0,this.popupTemplate=null,this.purgeOptions=new x,this.refreshInterval=0,this.screenSizePerspectiveEnabled=!0,this.sourceJSON=null,this.spatialReference=j.WGS84,this.type="stream",this.url=null,this.updateInterval=300,this.useViewTime=!0,this.webSocketUrl=null,this._debouncedSaveOperations=U(async(r,o,a)=>{const{save:n,saveAs:l}=await v(()=>import("./streamLayerUtils-NpNI_H_p.js"),__vite__mapDeps([0,1,2,3,4]));switch(r){case m.SAVE:return n(this,o);case m.SAVE_AS:return l(this,a,o)}})}normalizeCtorArgs(e,r){return typeof e=="string"?{url:e,...r}:e}load(e){if(!("WebSocket"in globalThis))return this.addResolvingPromise(Promise.reject(new p("stream-layer:websocket-unsupported","WebSocket is not supported in this browser. StreamLayer will not have real-time connection with the stream service."))),Promise.resolve(this);const r=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Stream Service","Feed"]},e).catch(V).then(()=>this._fetchService(r))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const r=this._normalizeFeatureReduction(e);this._set("featureReduction",r)}set renderer(e){f(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,r,o){var n;r=r.layerDefinition||r;const a=(n=r.drawingInfo)==null?void 0:n.renderer;if(a){const l=G(a,r,o)||void 0;return l||J.getLogger(this).error("Failed to create renderer",{rendererDefinition:r.drawingInfo.renderer,layer:this,context:o}),l}return M(r,o)}async connect(e){const[{createConnection:r}]=await Promise.all([v(()=>import("./createConnection-iXdhuUHv.js"),__vite__mapDeps([5,2,3])),this.load()]),o=this.geometryType?h.toJSON(this.geometryType):null,{customParameters:a=null,definitionExpression:n=null,geometryDefinition:l=null,maxReconnectionAttempts:R=0,maxReconnectionInterval:$=20,spatialReference:T=this.spatialReference}=e||this.createConnectionParameters(),c=r(this.parsedUrl,this.spatialReference,T,o,{geometry:l,where:n},R,$,a??void 0),_=z([this.on("send-message-to-socket",u=>c.sendMessageToSocket(u)),this.on("send-message-to-client",u=>c.sendMessageToClient(u))]);return c.once("destroy",_.remove),c}createConnectionParameters(){return{spatialReference:this.spatialReference,customParameters:this.customParameters,definitionExpression:this.definitionExpression,geometryDefinition:this.geometryDefinition,maxReconnectionAttempts:this.maxReconnectionAttempts,maxReconnectionInterval:this.maxReconnectionInterval}}createPopupTemplate(e){return q(this,e)}createQuery(){const e=new W;return e.returnGeometry=!0,e.outFields=["*"],e.where=this.definitionExpression||"1=1",e}getFieldDomain(e,r){if(!this.fields)return null;let o=null;return this.fields.some(a=>(a.name===e&&(o=a.domain),!!o)),o}getField(e){return this.fieldsIndex.get(e)}serviceSupportsSpatialReference(e){return!0}sendMessageToSocket(e){this.emit("send-message-to-socket",e)}sendMessageToClient(e){this.emit("send-message-to-client",e)}async save(e){return this._debouncedSaveOperations(m.SAVE,e)}async saveAs(e,r){return this._debouncedSaveOperations(m.SAVE_AS,r,e)}write(e,r){const o=r==null?void 0:r.messages;return this.webSocketUrl?(o==null||o.push(I(this,"using a custom websocket connection cannot be written to web scenes and web maps")),null):this.parsedUrl?super.write(e,r):(o==null||o.push(I(this,"using a client-side only connection without a url cannot be written to web scenes and web maps")),null)}async _fetchService(e){var r,o,a;if(!this.webSocketUrl&&this.parsedUrl){if(!this.sourceJSON){const{data:n}=await H(this.parsedUrl.path,{query:{f:"json",...this.customParameters,...this.parsedUrl.query},responseType:"json",signal:e});this.sourceJSON=n}}else{if(!((r=this.timeInfo)!=null&&r.trackIdField))throw new p("stream-layer:missing-metadata","The stream layer trackIdField must be specified.");if(!this.objectIdField){const n=(o=this.fields.find(l=>l.type==="oid"))==null?void 0:o.name;if(!n)throw new p("stream-layer:missing-metadata","The stream layer objectIdField must be specified.");this.objectIdField=n}if(!this.fields)throw new p("stream-layer:missing-metadata","The stream layer fields must be specified.");if(this.fields.some(n=>n.name===this.objectIdField)||this.fields.push(new K({name:this.objectIdField,alias:this.objectIdField,type:"oid"})),!this.geometryType)throw new p("stream-layer:missing-metadata","The stream layer geometryType must be specified.");this.webSocketUrl&&(this.url=this.webSocketUrl)}return this.read(this.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:(a=this.portalItem)==null?void 0:a.portal,url:this.parsedUrl}),f(this.renderer,this.fieldsIndex),Q(this.timeInfo,this.fieldsIndex),this.objectIdField||(this.objectIdField="__esri_stream_id__"),Y(this,{origin:"service"})}};t([s({type:String})],i.prototype,"copyright",void 0),t([s({readOnly:!0})],i.prototype,"defaultPopupTemplate",null),t([s({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],i.prototype,"definitionExpression",void 0),t([s({type:String})],i.prototype,"displayField",void 0),t([s({type:Z})],i.prototype,"elevationInfo",void 0),t([s({json:{origins:{"web-map":{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-scene":{read:!1,write:!1}}}})],i.prototype,"featureReduction",null),t([s(b.fields)],i.prototype,"fields",void 0),t([s(b.fieldsIndex)],i.prototype,"fieldsIndex",void 0),t([s({type:B,json:{name:"layerDefinition.definitionGeometry",write:!0}})],i.prototype,"geometryDefinition",void 0),t([s({type:h.apiValues,json:{read:{reader:h.read}}})],i.prototype,"geometryType",void 0),t([s(X)],i.prototype,"labelsVisible",void 0),t([s({type:[ee],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:te},write:!0}})],i.prototype,"labelingInfo",void 0),t([s(ie)],i.prototype,"legendEnabled",void 0),t([s({type:["show","hide"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],i.prototype,"listMode",void 0),t([s({type:g})],i.prototype,"maxReconnectionAttempts",void 0),t([s({type:g})],i.prototype,"maxReconnectionInterval",void 0),t([s(se)],i.prototype,"maxScale",void 0),t([s(re)],i.prototype,"minScale",void 0),t([s({type:String})],i.prototype,"objectIdField",void 0),t([s({value:"ArcGISStreamLayer",type:["ArcGISStreamLayer"]})],i.prototype,"operationalLayerType",void 0),t([s({readOnly:!0})],i.prototype,"outFields",void 0),t([s(oe)],i.prototype,"popupEnabled",void 0),t([s({type:ne,json:{name:"popupInfo",write:!0}})],i.prototype,"popupTemplate",void 0),t([s({type:x})],i.prototype,"purgeOptions",void 0),t([s({json:{read:!1,write:!1}})],i.prototype,"refreshInterval",void 0),t([s({types:ae,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{name:"layerDefinition.drawingInfo.renderer",types:le,write:!0}},write:{target:"layerDefinition.drawingInfo.renderer"}}})],i.prototype,"renderer",null),t([w("service","renderer",["drawingInfo.renderer","defaultSymbol"]),w("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],i.prototype,"readRenderer",null),t([s((()=>{const e=de(pe);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],i.prototype,"screenSizePerspectiveEnabled",void 0),t([s()],i.prototype,"sourceJSON",void 0),t([s({type:j,json:{origins:{service:{read:{source:"spatialReference"}}}}})],i.prototype,"spatialReference",void 0),t([s({json:{read:!1}})],i.prototype,"type",void 0),t([s(ce)],i.prototype,"url",void 0),t([s({type:Number})],i.prototype,"updateInterval",void 0),t([s({json:{read:!1,write:!1}})],i.prototype,"useViewTime",void 0),t([s({type:String})],i.prototype,"webSocketUrl",void 0),i=t([S("esri.layers.StreamLayer")],i);const Se=i;export{Se as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/streamLayerUtils-NpNI_H_p.js","assets/utils-YxtTVBu2.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/jsonContext-EgdQULbU.js","assets/createConnection-iXdhuUHv.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/StreamLayer-KHxHoWyI.js b/dist/assets/StreamLayer-KHxHoWyI.js deleted file mode 100644 index 33ec857..0000000 --- a/dist/assets/StreamLayer-KHxHoWyI.js +++ /dev/null @@ -1,7 +0,0 @@ -import{e as t,y as s,c as S,dr as F,dK as P,el as E,dO as O,dL as A,em as k,dM as D,dN as N,dP as C,dq as L,ar as j,ah as U,E as p,dQ as V,iF as f,ja as M,Z as G,jb as J,de as v,fe as h,fv as W,il as z,ca as q,jc as m,bW as K,dw as Q,iG as Z,dl as Y,hs as B,dT as H,iI as X,iJ as ee,iK as te,dV as ie,ey as g,jd as se,je as re,iu as oe,iv as ne,iM as ae,it as le,dt as w,bI as de,iN as pe,dW as ce,ix as me,c7 as ue}from"./index-J0iiHjMT.js";import{o as he}from"./CustomParametersMixin-Y1bOcayO.js";import{p as ye}from"./FeatureEffectLayer-oBa8pIG5.js";import{c as fe}from"./FeatureReductionLayer-RlitE1N6.js";import"./FeatureEffect-5bEV-xG1.js";var y;let d=y=class extends F{constructor(){super(...arguments),this.age=null,this.ageReceived=null,this.displayCount=null,this.maxObservations=1}clone(){return new y({age:this.age,ageReceived:this.ageReceived,displayCount:this.displayCount,maxObservations:this.maxObservations})}};t([s({type:Number,json:{write:!0}})],d.prototype,"age",void 0),t([s({type:Number,json:{write:!0}})],d.prototype,"ageReceived",void 0),t([s({type:Number,json:{write:!0}})],d.prototype,"displayCount",void 0),t([s({type:Number,json:{write:!0}})],d.prototype,"maxObservations",void 0),d=y=t([S("esri.layers.support.PurgeOptions")],d);const x=d,b=me();function I(e,r){return new p("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${r}`,{layer:e})}let i=class extends fe(ye(P(E(O(A(k(D(N(C(he(L(ue)))))))))))){constructor(...e){super(...e),this.copyright=null,this.definitionExpression=null,this.displayField=null,this.elevationInfo=null,this.fields=null,this.fieldsIndex=null,this.geometryDefinition=null,this.geometryType=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.maxReconnectionAttempts=0,this.maxReconnectionInterval=20,this.maxScale=0,this.minScale=0,this.objectIdField=null,this.operationalLayerType="ArcGISStreamLayer",this.outFields=["*"],this.popupEnabled=!0,this.popupTemplate=null,this.purgeOptions=new x,this.refreshInterval=0,this.screenSizePerspectiveEnabled=!0,this.sourceJSON=null,this.spatialReference=j.WGS84,this.type="stream",this.url=null,this.updateInterval=300,this.useViewTime=!0,this.webSocketUrl=null,this._debouncedSaveOperations=U(async(r,o,a)=>{const{save:n,saveAs:l}=await v(()=>import("./streamLayerUtils-j16jl5bN.js"),__vite__mapDeps([0,1,2,3,4]));switch(r){case m.SAVE:return n(this,o);case m.SAVE_AS:return l(this,a,o)}})}normalizeCtorArgs(e,r){return typeof e=="string"?{url:e,...r}:e}load(e){if(!("WebSocket"in globalThis))return this.addResolvingPromise(Promise.reject(new p("stream-layer:websocket-unsupported","WebSocket is not supported in this browser. StreamLayer will not have real-time connection with the stream service."))),Promise.resolve(this);const r=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Stream Service","Feed"]},e).catch(V).then(()=>this._fetchService(r))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}set featureReduction(e){const r=this._normalizeFeatureReduction(e);this._set("featureReduction",r)}set renderer(e){f(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,r,o){var n;r=r.layerDefinition||r;const a=(n=r.drawingInfo)==null?void 0:n.renderer;if(a){const l=M(a,r,o)||void 0;return l||G.getLogger(this).error("Failed to create renderer",{rendererDefinition:r.drawingInfo.renderer,layer:this,context:o}),l}return J(r,o)}async connect(e){const[{createConnection:r}]=await Promise.all([v(()=>import("./createConnection-4ppGVnSc.js"),__vite__mapDeps([5,2,3,6,7,8,9])),this.load()]),o=this.geometryType?h.toJSON(this.geometryType):null,{customParameters:a=null,definitionExpression:n=null,geometryDefinition:l=null,maxReconnectionAttempts:$=0,maxReconnectionInterval:R=20,spatialReference:T=this.spatialReference}=e||this.createConnectionParameters(),c=r(this.parsedUrl,this.spatialReference,T,o,{geometry:l,where:n},$,R,a??void 0),_=W([this.on("send-message-to-socket",u=>c.sendMessageToSocket(u)),this.on("send-message-to-client",u=>c.sendMessageToClient(u))]);return c.once("destroy",_.remove),c}createConnectionParameters(){return{spatialReference:this.spatialReference,customParameters:this.customParameters,definitionExpression:this.definitionExpression,geometryDefinition:this.geometryDefinition,maxReconnectionAttempts:this.maxReconnectionAttempts,maxReconnectionInterval:this.maxReconnectionInterval}}createPopupTemplate(e){return z(this,e)}createQuery(){const e=new q;return e.returnGeometry=!0,e.outFields=["*"],e.where=this.definitionExpression||"1=1",e}getFieldDomain(e,r){if(!this.fields)return null;let o=null;return this.fields.some(a=>(a.name===e&&(o=a.domain),!!o)),o}getField(e){return this.fieldsIndex.get(e)}serviceSupportsSpatialReference(e){return!0}sendMessageToSocket(e){this.emit("send-message-to-socket",e)}sendMessageToClient(e){this.emit("send-message-to-client",e)}async save(e){return this._debouncedSaveOperations(m.SAVE,e)}async saveAs(e,r){return this._debouncedSaveOperations(m.SAVE_AS,r,e)}write(e,r){const o=r==null?void 0:r.messages;return this.webSocketUrl?(o==null||o.push(I(this,"using a custom websocket connection cannot be written to web scenes and web maps")),null):this.parsedUrl?super.write(e,r):(o==null||o.push(I(this,"using a client-side only connection without a url cannot be written to web scenes and web maps")),null)}async _fetchService(e){var r,o,a;if(!this.webSocketUrl&&this.parsedUrl){if(!this.sourceJSON){const{data:n}=await K(this.parsedUrl.path,{query:{f:"json",...this.customParameters,...this.parsedUrl.query},responseType:"json",signal:e});this.sourceJSON=n}}else{if(!((r=this.timeInfo)!=null&&r.trackIdField))throw new p("stream-layer:missing-metadata","The stream layer trackIdField must be specified.");if(!this.objectIdField){const n=(o=this.fields.find(l=>l.type==="oid"))==null?void 0:o.name;if(!n)throw new p("stream-layer:missing-metadata","The stream layer objectIdField must be specified.");this.objectIdField=n}if(!this.fields)throw new p("stream-layer:missing-metadata","The stream layer fields must be specified.");if(this.fields.some(n=>n.name===this.objectIdField)||this.fields.push(new Q({name:this.objectIdField,alias:this.objectIdField,type:"oid"})),!this.geometryType)throw new p("stream-layer:missing-metadata","The stream layer geometryType must be specified.");this.webSocketUrl&&(this.url=this.webSocketUrl)}return this.read(this.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:(a=this.portalItem)==null?void 0:a.portal,url:this.parsedUrl}),f(this.renderer,this.fieldsIndex),Z(this.timeInfo,this.fieldsIndex),this.objectIdField||(this.objectIdField="__esri_stream_id__"),Y(this,{origin:"service"})}};t([s({type:String})],i.prototype,"copyright",void 0),t([s({readOnly:!0})],i.prototype,"defaultPopupTemplate",null),t([s({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],i.prototype,"definitionExpression",void 0),t([s({type:String})],i.prototype,"displayField",void 0),t([s({type:B})],i.prototype,"elevationInfo",void 0),t([s({json:{origins:{"web-map":{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-scene":{read:!1,write:!1}}}})],i.prototype,"featureReduction",null),t([s(b.fields)],i.prototype,"fields",void 0),t([s(b.fieldsIndex)],i.prototype,"fieldsIndex",void 0),t([s({type:H,json:{name:"layerDefinition.definitionGeometry",write:!0}})],i.prototype,"geometryDefinition",void 0),t([s({type:h.apiValues,json:{read:{reader:h.read}}})],i.prototype,"geometryType",void 0),t([s(X)],i.prototype,"labelsVisible",void 0),t([s({type:[ee],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:te},write:!0}})],i.prototype,"labelingInfo",void 0),t([s(ie)],i.prototype,"legendEnabled",void 0),t([s({type:["show","hide"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],i.prototype,"listMode",void 0),t([s({type:g})],i.prototype,"maxReconnectionAttempts",void 0),t([s({type:g})],i.prototype,"maxReconnectionInterval",void 0),t([s(se)],i.prototype,"maxScale",void 0),t([s(re)],i.prototype,"minScale",void 0),t([s({type:String})],i.prototype,"objectIdField",void 0),t([s({value:"ArcGISStreamLayer",type:["ArcGISStreamLayer"]})],i.prototype,"operationalLayerType",void 0),t([s({readOnly:!0})],i.prototype,"outFields",void 0),t([s(oe)],i.prototype,"popupEnabled",void 0),t([s({type:ne,json:{name:"popupInfo",write:!0}})],i.prototype,"popupTemplate",void 0),t([s({type:x})],i.prototype,"purgeOptions",void 0),t([s({json:{read:!1,write:!1}})],i.prototype,"refreshInterval",void 0),t([s({types:ae,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{name:"layerDefinition.drawingInfo.renderer",types:le,write:!0}},write:{target:"layerDefinition.drawingInfo.renderer"}}})],i.prototype,"renderer",null),t([w("service","renderer",["drawingInfo.renderer","defaultSymbol"]),w("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],i.prototype,"readRenderer",null),t([s((()=>{const e=de(pe);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],i.prototype,"screenSizePerspectiveEnabled",void 0),t([s()],i.prototype,"sourceJSON",void 0),t([s({type:j,json:{origins:{service:{read:{source:"spatialReference"}}}}})],i.prototype,"spatialReference",void 0),t([s({json:{read:!1}})],i.prototype,"type",void 0),t([s(ce)],i.prototype,"url",void 0),t([s({type:Number})],i.prototype,"updateInterval",void 0),t([s({json:{read:!1,write:!1}})],i.prototype,"useViewTime",void 0),t([s({type:String})],i.prototype,"webSocketUrl",void 0),i=t([S("esri.layers.StreamLayer")],i);const Se=i;export{Se as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/streamLayerUtils-j16jl5bN.js","assets/utils-rBsg-VY8.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/jsonContext-cWV_-jAj.js","assets/createConnection-4ppGVnSc.js","assets/query-rG0aX6cE.js","assets/pbfQueryUtils-pWizwTQZ.js","assets/pbf-o0zzptPp.js","assets/queryZScale-IaMm02_2.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/StreamLayerView3D-kATjjzFd.js b/dist/assets/StreamLayerView3D-kATjjzFd.js new file mode 100644 index 0000000..61d77ac --- /dev/null +++ b/dist/assets/StreamLayerView3D-kATjjzFd.js @@ -0,0 +1 @@ +import{e as r,y as i,c as h,cQ as M,g as R,b as _,f9 as U,B as g,K as k,dx as T,C as $,r as x,aL as C}from"./index-pCX-0tJH.js";import{o as E}from"./StreamFeatureManager-Iguqr18K.js";import{createConnection as G}from"./createConnection-iXdhuUHv.js";import{r as j}from"./EventedSet-TJfupI82.js";import{E as V}from"./HeatmapDensity.glsl-de3m0xZZ.js";import{n as L}from"./LayerView3D-57OghbRh.js";import{u as F}from"./LayerView-ixwLVnzr.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./queryForSymbologySnapping-MXWRIdj-.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./QueryEngine-uvDs-vBe.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./FeatureStore-PXMUgn0j.js";import"./BoundsStore-_-dPK5c-.js";import"./projectExtentUtils-Q4rXasWA.js";const N=2500;let d=class extends k{getObjectId(){return this.objectId}};r([i({type:Number,json:{read:!0}})],d.prototype,"objectId",void 0),d=r([h("esri.layers.graphics.controllers.StreamGraphic")],d);let B=class{constructor(e){this.onUpdate=e,this._idToGraphic=new Map}destroy(){this._idToGraphic.clear()}add(e){this._idToGraphic.set(e.objectId,e)}get(e){return this._idToGraphic.get(e)}forEach(e){this._idToGraphic.forEach(e)}removeById(e){const t=this._idToGraphic.get(e);return t?(t.sourceLayer=t.layer=null,this._idToGraphic.delete(e),t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._idToGraphic.size}},n=class extends M(R){constructor(){super(...arguments),this.isPaused=!1,this.graphics=new j,this._updateInfo={websocket:0,client:0},this._updateIntervalId=null,this._outSpatialReference=null}initialize(){this.addResolvingPromise(this.layer.when(()=>this._startup()))}destroy(){this.clear()}_clearInterval(){this._updateIntervalId!==null&&(clearInterval(this._updateIntervalId),this._updateIntervalId=null)}clear(){this._clearInterval(),this.connection=_(this.connection),this.store=_(this.store),this.graphics.clear(),this.removeAllHandles()}get updating(){return!this.connection||this.connection.connectionStatus==="connected"}_startup(){const{layer:e,layerView:t}=this,{spatialReference:l,definitionExpression:c,geometryDefinition:p,objectIdField:u,timeInfo:f,purgeOptions:v,maxReconnectionAttempts:I,maxReconnectionInterval:S,customParameters:w}=e,b=e.geometryType?U.toJSON(e.geometryType):null,O=l,m=t.view.spatialReference,P={geometry:p,where:c};this.clear(),this._set("connection",G(e.parsedUrl,O,m,b,P,I,S,w??void 0)),this._outSpatialReference=m.toJSON(),this.store=new B(this._onUpdate.bind(this)),this.featuresManager=new E(this.store,u,f.toJSON(),v);const y="startup-watches";this.removeHandles(y),this.addHandles([e.on("send-message-to-socket",a=>this.connection.sendMessageToSocket(a)),e.on("send-message-to-client",a=>this.connection.sendMessageToClient(a)),this.connection.on("data-received",a=>this._onFeature(a)),this.connection.on("message-received",a=>this._onWebSocketMessage(a)),g(()=>[e.definitionExpression,e.geometryDefinition,e.purgeOptions],()=>this._startup())],y),this.isPaused||this._initUpdateInterval()}_onWebSocketMessage(e){if(this.layerView.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this.featuresManager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this.featuresManager.removeByTrackId(t);break;case"clear":this.store.forEach(t=>this.featuresManager.removeById(t.objectId))}}_onFeature(e){this._updateInfo.websocket++,this.layerView.hasEventListener("data-received")&&this.layerView.emit("data-received",{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry});try{e.geometry==null||e.geometry.spatialReference||(e.geometry.spatialReference=this._outSpatialReference);const t=d.fromJSON(e);t.sourceLayer=t.layer=this.layer,this.featuresManager.add(t)}catch{}}_onUpdate(e,t){t!=null&&this.graphics.removeMany(t),e!=null&&(this._updateInfo.client+=e.length,this.graphics.addMany(e))}_initUpdateInterval(){this._clearInterval();const{updateInterval:e}=this.layer;let t=performance.now();this._updateIntervalId=setInterval(()=>{const l=performance.now(),c=l-t;if(c>N){t=l;const p=Math.round(this._updateInfo.client/(c/1e3)),u=Math.round(this._updateInfo.websocket/(c/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.layerView.emit("update-rate",{client:p,websocket:u})}this.featuresManager.checkForUpdates()},e)}pauseStream(){this.isPaused=!0,this._clearInterval()}resumeStream(){this.isPaused=!1,this._initUpdateInterval()}};r([i()],n.prototype,"isPaused",void 0),r([i({constructOnly:!0})],n.prototype,"layer",void 0),r([i({constructOnly:!0})],n.prototype,"layerView",void 0),r([i()],n.prototype,"connection",void 0),r([i({readOnly:!0})],n.prototype,"updating",null),n=r([h("esri.layers.graphics.controllers.StreamController")],n);const z=s=>{let e=class extends s{resume(){this._isUserPaused=!1,this.suspended||this._doResume()}pause(){this._isUserPaused=!0,this.suspended||this._doPause()}constructor(...t){super(...t),this._isUserPaused=!1,this.filter=null}get connectionStatus(){return this._isUserPaused?"paused":this._streamConnectionStatus}_onSuspendedChange(t){t?this._doPause():this._isUserPaused||this._doResume()}};return r([i()],e.prototype,"_isUserPaused",void 0),r([i({readOnly:!0})],e.prototype,"connectionStatus",null),r([i({type:T})],e.prototype,"filter",void 0),e=r([h("esri.layers.mixins.StreamLayerView")],e),e};let o=class extends z(V(L(F))){constructor(){super(...arguments),this.type="stream-3d",this.updatePolicy=$.ASYNC,this.hasZ=!0,this.hasM=!1}initialize(){this.addHandles(g(()=>this.suspended,s=>{this.controller&&this._onSuspendedChange(s)}))}get connectionError(){var e,t;const s=(t=(e=this.controller)==null?void 0:e.connection)==null?void 0:t.errorString;return s?new x("stream-controller",s):null}createQuery(){return new C({outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference})}queryLatestObservations(s,e){return this.queryEngine.executeQueryForLatestObservations(this._ensureQuery(s),e==null?void 0:e.signal)}get _streamConnectionStatus(){var s,e;return((e=(s=this.controller)==null?void 0:s.connection)==null?void 0:e.connectionStatus)??"disconnected"}createController(){return new n({layer:this.layer,layerView:this})}beforeSetController(){}_doPause(){var s;(s=this.controller)==null||s.pauseStream()}_doResume(){var s;(s=this.controller)==null||s.resumeStream()}};r([i({readOnly:!0})],o.prototype,"updatePolicy",void 0),r([i({readOnly:!0})],o.prototype,"connectionError",null),r([i()],o.prototype,"controller",void 0),r([i({readOnly:!0})],o.prototype,"hasZ",void 0),r([i({readOnly:!0})],o.prototype,"hasM",void 0),r([i({readOnly:!0})],o.prototype,"_streamConnectionStatus",null),o=r([h("esri.views.3d.layers.StreamLayerView3D")],o);const ye=o;export{ye as default}; diff --git a/dist/assets/StreamLayerView3D-nu_wqFzJ.js b/dist/assets/StreamLayerView3D-nu_wqFzJ.js deleted file mode 100644 index 2d25459..0000000 --- a/dist/assets/StreamLayerView3D-nu_wqFzJ.js +++ /dev/null @@ -1 +0,0 @@ -import{e as r,y as i,c as p,cZ as M,p as R,n as _,fe as U,d as f,S as k,dC as C,G as T,E as $,ca as x}from"./index-J0iiHjMT.js";import{o as E}from"./StreamFeatureManager-QrKJ84_c.js";import{createConnection as G}from"./createConnection-4ppGVnSc.js";import{r as j}from"./EventedSet-JGlFrfoR.js";import{E as V}from"./HeatmapDensity.glsl-y7dUg--m.js";import{n as L}from"./LayerView3D-iOx2MD1g.js";import{u as F}from"./LayerView-efDufa6j.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./queryForSymbologySnapping-I1fFQTD_.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./QueryEngine-8tLWlkSE.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./FeatureSet-d4S1oKME.js";import"./FeatureStore-X-AIJLo2.js";import"./BoundsStore-wmwfHjhp.js";import"./projectExtentUtils-TwA6ooHn.js";const N=2500;let d=class extends k{getObjectId(){return this.objectId}};r([i({type:Number,json:{read:!0}})],d.prototype,"objectId",void 0),d=r([p("esri.layers.graphics.controllers.StreamGraphic")],d);let z=class{constructor(e){this.onUpdate=e,this._idToGraphic=new Map}destroy(){this._idToGraphic.clear()}add(e){this._idToGraphic.set(e.objectId,e)}get(e){return this._idToGraphic.get(e)}forEach(e){this._idToGraphic.forEach(e)}removeById(e){const t=this._idToGraphic.get(e);return t?(t.sourceLayer=t.layer=null,this._idToGraphic.delete(e),t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._idToGraphic.size}},n=class extends M(R){constructor(){super(...arguments),this.isPaused=!1,this.graphics=new j,this._updateInfo={websocket:0,client:0},this._updateIntervalId=null,this._outSpatialReference=null}initialize(){this.addResolvingPromise(this.layer.when(()=>this._startup()))}destroy(){this.clear()}_clearInterval(){this._updateIntervalId!==null&&(clearInterval(this._updateIntervalId),this._updateIntervalId=null)}clear(){this._clearInterval(),this.connection=_(this.connection),this.store=_(this.store),this.graphics.clear(),this.removeAllHandles()}get updating(){return!this.connection||this.connection.connectionStatus==="connected"}_startup(){const{layer:e,layerView:t}=this,{spatialReference:l,definitionExpression:c,geometryDefinition:h,objectIdField:u,timeInfo:g,purgeOptions:v,maxReconnectionAttempts:I,maxReconnectionInterval:S,customParameters:w}=e,b=e.geometryType?U.toJSON(e.geometryType):null,O=l,m=t.view.spatialReference,P={geometry:h,where:c};this.clear(),this._set("connection",G(e.parsedUrl,O,m,b,P,I,S,w??void 0)),this._outSpatialReference=m.toJSON(),this.store=new z(this._onUpdate.bind(this)),this.featuresManager=new E(this.store,u,g.toJSON(),v);const y="startup-watches";this.removeHandles(y),this.addHandles([e.on("send-message-to-socket",a=>this.connection.sendMessageToSocket(a)),e.on("send-message-to-client",a=>this.connection.sendMessageToClient(a)),this.connection.on("data-received",a=>this._onFeature(a)),this.connection.on("message-received",a=>this._onWebSocketMessage(a)),f(()=>[e.definitionExpression,e.geometryDefinition,e.purgeOptions],()=>this._startup())],y),this.isPaused||this._initUpdateInterval()}_onWebSocketMessage(e){if(this.layerView.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this.featuresManager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this.featuresManager.removeByTrackId(t);break;case"clear":this.store.forEach(t=>this.featuresManager.removeById(t.objectId))}}_onFeature(e){this._updateInfo.websocket++,this.layerView.hasEventListener("data-received")&&this.layerView.emit("data-received",{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry});try{e.geometry==null||e.geometry.spatialReference||(e.geometry.spatialReference=this._outSpatialReference);const t=d.fromJSON(e);t.sourceLayer=t.layer=this.layer,this.featuresManager.add(t)}catch{}}_onUpdate(e,t){t!=null&&this.graphics.removeMany(t),e!=null&&(this._updateInfo.client+=e.length,this.graphics.addMany(e))}_initUpdateInterval(){this._clearInterval();const{updateInterval:e}=this.layer;let t=performance.now();this._updateIntervalId=setInterval(()=>{const l=performance.now(),c=l-t;if(c>N){t=l;const h=Math.round(this._updateInfo.client/(c/1e3)),u=Math.round(this._updateInfo.websocket/(c/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.layerView.emit("update-rate",{client:h,websocket:u})}this.featuresManager.checkForUpdates()},e)}pauseStream(){this.isPaused=!0,this._clearInterval()}resumeStream(){this.isPaused=!1,this._initUpdateInterval()}};r([i()],n.prototype,"isPaused",void 0),r([i({constructOnly:!0})],n.prototype,"layer",void 0),r([i({constructOnly:!0})],n.prototype,"layerView",void 0),r([i()],n.prototype,"connection",void 0),r([i({readOnly:!0})],n.prototype,"updating",null),n=r([p("esri.layers.graphics.controllers.StreamController")],n);const B=s=>{let e=class extends s{resume(){this._isUserPaused=!1,this.suspended||this._doResume()}pause(){this._isUserPaused=!0,this.suspended||this._doPause()}constructor(...t){super(...t),this._isUserPaused=!1,this.filter=null}get connectionStatus(){return this._isUserPaused?"paused":this._streamConnectionStatus}_onSuspendedChange(t){t?this._doPause():this._isUserPaused||this._doResume()}};return r([i()],e.prototype,"_isUserPaused",void 0),r([i({readOnly:!0})],e.prototype,"connectionStatus",null),r([i({type:C})],e.prototype,"filter",void 0),e=r([p("esri.layers.mixins.StreamLayerView")],e),e};let o=class extends B(V(L(F))){constructor(){super(...arguments),this.type="stream-3d",this.updatePolicy=T.ASYNC,this.hasZ=!0,this.hasM=!1}initialize(){this.addHandles(f(()=>this.suspended,s=>{this.controller&&this._onSuspendedChange(s)}))}get connectionError(){var e,t;const s=(t=(e=this.controller)==null?void 0:e.connection)==null?void 0:t.errorString;return s?new $("stream-controller",s):null}createQuery(){return new x({outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference})}queryLatestObservations(s,e){return this.queryEngine.executeQueryForLatestObservations(this._ensureQuery(s),e==null?void 0:e.signal)}get _streamConnectionStatus(){var s,e;return((e=(s=this.controller)==null?void 0:s.connection)==null?void 0:e.connectionStatus)??"disconnected"}createController(){return new n({layer:this.layer,layerView:this})}beforeSetController(){}_doPause(){var s;(s=this.controller)==null||s.pauseStream()}_doResume(){var s;(s=this.controller)==null||s.resumeStream()}};r([i({readOnly:!0})],o.prototype,"updatePolicy",void 0),r([i({readOnly:!0})],o.prototype,"connectionError",null),r([i()],o.prototype,"controller",void 0),r([i({readOnly:!0})],o.prototype,"hasZ",void 0),r([i({readOnly:!0})],o.prototype,"hasM",void 0),r([i({readOnly:!0})],o.prototype,"_streamConnectionStatus",null),o=r([p("esri.views.3d.layers.StreamLayerView3D")],o);const Ie=o;export{Ie as default}; diff --git a/dist/assets/StyleRepository-UhXfhILC.js b/dist/assets/StyleRepository-TpBuuKhf.js similarity index 90% rename from dist/assets/StyleRepository-UhXfhILC.js rename to dist/assets/StyleRepository-TpBuuKhf.js index d656c2b..e5e0a2b 100644 --- a/dist/assets/StyleRepository-UhXfhILC.js +++ b/dist/assets/StyleRepository-TpBuuKhf.js @@ -1,4 +1,4 @@ -import{qE as _,sk as x,ab as D,sl as Xt,sm as te,sn as ee,so as W,sp as v,sq as M,sr as Q}from"./index-J0iiHjMT.js";import{t as vt}from"./TileClipper-NSFZXMR1.js";import{$ as ge}from"./definitions-DqQMJYPH.js";let _e=class{constructor(t){this._array=[],t<=0&&console.error("strideInBytes must be positive!"),this._stride=t}get array(){return this._array}get index(){return 4*this._array.length/this._stride}get itemSize(){return this._stride}get sizeInBytes(){return 4*this._array.length}reset(){this.array.length=0}toBuffer(){return new Uint32Array(this._array).buffer}static i1616to32(t,e){return 65535&t|e<<16}static i8888to32(t,e,r,s){return 255&t|(255&e)<<8|(255&r)<<16|s<<24}static i8816to32(t,e,r){return 255&t|(255&e)<<8|r<<16}};var c,q;(function(n){n[n.R8_SIGNED=0]="R8_SIGNED",n[n.R8_UNSIGNED=1]="R8_UNSIGNED",n[n.R16_SIGNED=2]="R16_SIGNED",n[n.R16_UNSIGNED=3]="R16_UNSIGNED",n[n.R8G8_SIGNED=4]="R8G8_SIGNED",n[n.R8G8_UNSIGNED=5]="R8G8_UNSIGNED",n[n.R16G16_SIGNED=6]="R16G16_SIGNED",n[n.R16G16_UNSIGNED=7]="R16G16_UNSIGNED",n[n.R8G8B8A8_SIGNED=8]="R8G8B8A8_SIGNED",n[n.R8G8B8A8_UNSIGNED=9]="R8G8B8A8_UNSIGNED",n[n.R8G8B8A8_COLOR=10]="R8G8B8A8_COLOR",n[n.R16G16B16A16_DASHARRAY=11]="R16G16B16A16_DASHARRAY",n[n.R16G16B16A16_PATTERN=12]="R16G16B16A16_PATTERN"})(c||(c={})),function(n){n[n.UNIFORM=0]="UNIFORM",n[n.DATA_DRIVEN=1]="DATA_DRIVEN",n[n.INTERPOLATED_DATA_DRIVEN=2]="INTERPOLATED_DATA_DRIVEN",n[n.UNUSED=3]="UNUSED"}(q||(q={}));let H=class Dt{constructor(t){this._locations=new Map,this._key=t}get key(){return this._key}get type(){return 7&this._key}defines(){return[]}getStride(){return this._layoutInfo||this._buildAttributesInfo(),this._stride}getAttributeLocations(){return this._locations.size===0&&this._buildAttributesInfo(),this._locations}getLayoutInfo(){return this._layoutInfo||this._buildAttributesInfo(),this._layoutInfo}getEncodingInfos(){return this._propertyEncodingInfo||this._buildAttributesInfo(),this._propertyEncodingInfo}getUniforms(){return this._uniforms||this._buildAttributesInfo(),this._uniforms}getShaderHeader(){return this._shaderHeader||this._buildAttributesInfo(),this._shaderHeader}getShaderMain(){return this._shaderMain||this._buildAttributesInfo(),this._shaderMain}setDataUniforms(t,e,r,s,i){const o=this.getUniforms();for(const a of o){const{name:l,type:u,getValue:p}=a,h=p(r,e,s,i);if(h!==null)switch(u){case"float":t.setUniform1f(l,h);break;case"vec2":t.setUniform2fv(l,h);break;case"vec4":t.setUniform4fv(l,h)}}}encodeAttributes(t,e,r,s){var p;const i=this.attributesInfo(),o=this.getEncodingInfos(),a=[];let l=0,u=0;for(const h of Object.keys(o)){const f=o[h],{type:m,precisionFactor:g,isLayout:A}=i[h],w=A?r.getLayoutProperty(h):r.getPaintProperty(h),S=(p=w.interpolator)==null?void 0:p.getInterpolationRange(e);let d=0;for(const I of f){const{offset:E,bufferElementsToAdd:L}=I;if(L>0){for(let N=0;N4)s++,N={dataIndex:s,count:0,offset:0},I!==4&&(r[R]=N),t.push({location:-1,name:"a_data_"+s,count:I,type:S,normalized:E}),$=Math.ceil(Math.max(L/4,1));else{const z=t[N.dataIndex];z.count+=I,$=Math.ceil(Math.max(z.count*d/4,1))-Math.ceil(Math.max(N.offset/4,1))}g.push({dataIndex:N.dataIndex,offset:N.offset,bufferElementsToAdd:$}),N.offset+=L,N.count+=I}}for(const h of t)switch(h.type){case _.BYTE:case _.UNSIGNED_BYTE:h.count=4;break;case _.SHORT:case _.UNSIGNED_SHORT:h.count+=h.count%2}this._buildVertexBufferLayout(t);let l=0;const u=this._layoutInfo.geometry;for(const h of u)this._locations.set(h.name,l++);const p=this._layoutInfo.opacity;if(p)for(const h of p)this._locations.set(h.name,l++);this._buildShaderInfo(t,e),this._propertyEncodingInfo=e}_buildVertexBufferLayout(t){const e={},r=this.geometryInfo();let s=r[0].stride;if(t.length===0)e.geometry=r;else{const i=[];let o=s;for(const a of t)s+=re(a.type)*a.count;for(const a of r)i.push(new x(a.name,a.count,a.type,a.offset,s,a.normalized));for(const a of t)i.push(new x(a.name,a.count,a.type,o,s,a.normalized)),o+=re(a.type)*a.count;e.geometry=i}this.opacityInfo()&&(e.opacity=this.opacityInfo()),this._layoutInfo=e,this._stride=s}_buildShaderInfo(t,e){let r=` +import{qR as _,sx as x,W as D,sy as Xt,sz as te,sA as ee,sB as W,sC as v,sD as M,sE as Q}from"./index-pCX-0tJH.js";import{t as vt}from"./TileClipper-NSFZXMR1.js";import{$ as ge}from"./definitions-SVBNHUSH.js";let _e=class{constructor(t){this._array=[],t<=0&&console.error("strideInBytes must be positive!"),this._stride=t}get array(){return this._array}get index(){return 4*this._array.length/this._stride}get itemSize(){return this._stride}get sizeInBytes(){return 4*this._array.length}reset(){this.array.length=0}toBuffer(){return new Uint32Array(this._array).buffer}static i1616to32(t,e){return 65535&t|e<<16}static i8888to32(t,e,r,s){return 255&t|(255&e)<<8|(255&r)<<16|s<<24}static i8816to32(t,e,r){return 255&t|(255&e)<<8|r<<16}};var c,q;(function(n){n[n.R8_SIGNED=0]="R8_SIGNED",n[n.R8_UNSIGNED=1]="R8_UNSIGNED",n[n.R16_SIGNED=2]="R16_SIGNED",n[n.R16_UNSIGNED=3]="R16_UNSIGNED",n[n.R8G8_SIGNED=4]="R8G8_SIGNED",n[n.R8G8_UNSIGNED=5]="R8G8_UNSIGNED",n[n.R16G16_SIGNED=6]="R16G16_SIGNED",n[n.R16G16_UNSIGNED=7]="R16G16_UNSIGNED",n[n.R8G8B8A8_SIGNED=8]="R8G8B8A8_SIGNED",n[n.R8G8B8A8_UNSIGNED=9]="R8G8B8A8_UNSIGNED",n[n.R8G8B8A8_COLOR=10]="R8G8B8A8_COLOR",n[n.R16G16B16A16_DASHARRAY=11]="R16G16B16A16_DASHARRAY",n[n.R16G16B16A16_PATTERN=12]="R16G16B16A16_PATTERN"})(c||(c={})),function(n){n[n.UNIFORM=0]="UNIFORM",n[n.DATA_DRIVEN=1]="DATA_DRIVEN",n[n.INTERPOLATED_DATA_DRIVEN=2]="INTERPOLATED_DATA_DRIVEN",n[n.UNUSED=3]="UNUSED"}(q||(q={}));let H=class Dt{constructor(t){this._locations=new Map,this._key=t}get key(){return this._key}get type(){return 7&this._key}defines(){return[]}getStride(){return this._layoutInfo||this._buildAttributesInfo(),this._stride}getAttributeLocations(){return this._locations.size===0&&this._buildAttributesInfo(),this._locations}getLayoutInfo(){return this._layoutInfo||this._buildAttributesInfo(),this._layoutInfo}getEncodingInfos(){return this._propertyEncodingInfo||this._buildAttributesInfo(),this._propertyEncodingInfo}getUniforms(){return this._uniforms||this._buildAttributesInfo(),this._uniforms}getShaderHeader(){return this._shaderHeader||this._buildAttributesInfo(),this._shaderHeader}getShaderMain(){return this._shaderMain||this._buildAttributesInfo(),this._shaderMain}setDataUniforms(t,e,r,s,i){const o=this.getUniforms();for(const a of o){const{name:l,type:u,getValue:p}=a,h=p(r,e,s,i);if(h!==null)switch(u){case"float":t.setUniform1f(l,h);break;case"vec2":t.setUniform2fv(l,h);break;case"vec4":t.setUniform4fv(l,h)}}}encodeAttributes(t,e,r,s){var p;const i=this.attributesInfo(),o=this.getEncodingInfos(),a=[];let l=0,u=0;for(const h of Object.keys(o)){const f=o[h],{type:m,precisionFactor:g,isLayout:A}=i[h],w=A?r.getLayoutProperty(h):r.getPaintProperty(h),S=(p=w.interpolator)==null?void 0:p.getInterpolationRange(e);let d=0;for(const I of f){const{offset:E,bufferElementsToAdd:L}=I;if(L>0){for(let N=0;N4)s++,N={dataIndex:s,count:0,offset:0},I!==4&&(r[R]=N),t.push({location:-1,name:"a_data_"+s,count:I,type:S,normalized:E}),$=Math.ceil(Math.max(L/4,1));else{const z=t[N.dataIndex];z.count+=I,$=Math.ceil(Math.max(z.count*d/4,1))-Math.ceil(Math.max(N.offset/4,1))}g.push({dataIndex:N.dataIndex,offset:N.offset,bufferElementsToAdd:$}),N.offset+=L,N.count+=I}}for(const h of t)switch(h.type){case _.BYTE:case _.UNSIGNED_BYTE:h.count=4;break;case _.SHORT:case _.UNSIGNED_SHORT:h.count+=h.count%2}this._buildVertexBufferLayout(t);let l=0;const u=this._layoutInfo.geometry;for(const h of u)this._locations.set(h.name,l++);const p=this._layoutInfo.opacity;if(p)for(const h of p)this._locations.set(h.name,l++);this._buildShaderInfo(t,e),this._propertyEncodingInfo=e}_buildVertexBufferLayout(t){const e={},r=this.geometryInfo();let s=r[0].stride;if(t.length===0)e.geometry=r;else{const i=[];let o=s;for(const a of t)s+=re(a.type)*a.count;for(const a of r)i.push(new x(a.name,a.count,a.type,a.offset,s,a.normalized));for(const a of t)i.push(new x(a.name,a.count,a.type,o,s,a.normalized)),o+=re(a.type)*a.count;e.geometry=i}this.opacityInfo()&&(e.opacity=this.opacityInfo()),this._layoutInfo=e,this._stride=s}_buildShaderInfo(t,e){let r=` `,s=` `;const i=[];for(const u of t)r+=`attribute ${this._getType(u.count)} ${u.name}; `;const o=this.attributes(),a=this.attributesInfo();let l=-1;for(const u of o){l++;const{name:p,type:h,precisionFactor:f,isLayout:m}=a[u],g=f&&f!==1?" * "+1/f:"",{bytesPerElement:A,count:w}=Dt._encodingInfo[h],S=d=>`a_data_${d.dataIndex}${de(w,d.offset,A)}`;switch(this.getAtributeState(l)){case q.UNIFORM:{const d=this._getType(w),I=`u_${p}`;i.push({name:I,type:d,getValue:(E,L,R,N)=>{const $=m?E.getLayoutValue(u,L):E.getPaintValue(u,L);if(h===c.R16G16B16A16_DASHARRAY){const z=E.getDashKey($,E.getLayoutValue("line-cap",L)),it=N.getMosaicItemPosition(z,!1);if(it==null)return null;const{tl:nt,br:Jt}=it;return[nt[0],Jt[1],Jt[0],nt[1]]}if(h===c.R16G16B16A16_PATTERN){const z=N.getMosaicItemPosition($,!u.includes("line-"));if(z==null)return null;const{tl:it,br:nt}=z;return[it[0],nt[1],nt[0],it[1]]}if(h===c.R8G8B8A8_COLOR){const z=$[3];return[z*$[0],z*$[1],z*$[2],z]}return $}}),r+=`uniform ${d} ${I}; diff --git a/dist/assets/SublayersOwner-8xrm3MkT.js b/dist/assets/SublayersOwner-8xrm3MkT.js deleted file mode 100644 index 0bccfcc..0000000 --- a/dist/assets/SublayersOwner-8xrm3MkT.js +++ /dev/null @@ -1,7 +0,0 @@ -import{e as a,y as n,dt as g,dT as z,dU as Y,iu as ee,ar as te,c as k,lb as re,lc as B,s as Q,ep as u,h6 as W,bW as $,df as H,ld as ie,dP as se,m as ae,E as S,eQ as le,le as oe,dJ as ne,lf as ye,Z as E,lg as R,iy as pe,V as U,f3 as ue,lh as _,il as de,ca as ce,de as he,bI as F,li as fe,ji as be,lj as me,fe as q,dw as ge,lk as Se,ey as V,iJ as Ie,du as w,iv as ve,iM as we,it as Ee,iY as G,g0 as K,f6 as Le,eo as L,ij as xe,fP as Oe,d as Te,C as De,ll as Fe,lm as Pe}from"./index-J0iiHjMT.js";import{x as _e}from"./QueryTask-91TvtrTt.js";import{n as Ae}from"./FeatureType-MpRe7WJj.js";import{a as Ve}from"./serviceCapabilitiesUtils-26KpT1VN.js";const ke=r=>{let e=class extends r{constructor(){super(...arguments),this.capabilities=void 0,this.copyright=null,this.fullExtent=null,this.legendEnabled=!0,this.spatialReference=null,this.version=void 0,this._allLayersAndTablesMap=null}readCapabilities(t,i){const s=i.capabilities&&i.capabilities.split(",").map(Z=>Z.toLowerCase().trim());if(!s)return{operations:{supportsExportMap:!1,supportsExportTiles:!1,supportsIdentify:!1,supportsQuery:!1,supportsTileMap:!1},exportMap:null,exportTiles:null};const l=this.type,y=l!=="tile"&&!!i.supportsDynamicLayers,p=s.includes("query"),d=s.includes("map"),c=!!i.exportTilesAllowed,b=s.includes("tilemap"),I=s.includes("data"),x=l!=="tile"&&(!i.tileInfo||y),O=l!=="tile"&&(!i.tileInfo||y),h=l!=="tile",f=i.cimVersion&&re.parse(i.cimVersion),T=(f==null?void 0:f.since(1,4))??!1,D=(f==null?void 0:f.since(2,0))??!1;return{operations:{supportsExportMap:d,supportsExportTiles:c,supportsIdentify:p,supportsQuery:I,supportsTileMap:b},exportMap:d?{supportsArcadeExpressionForLabeling:T,supportsSublayersChanges:h,supportsDynamicLayers:y,supportsSublayerVisibility:x,supportsSublayerDefinitionExpression:O,supportsCIMSymbols:D}:null,exportTiles:c?{maxExportTilesCount:+i.maxExportTilesCount}:null}}readVersion(t,i){let s=i.currentVersion;return s||(s=i.hasOwnProperty("capabilities")||i.hasOwnProperty("tables")?10:i.hasOwnProperty("supportedImageFormatTypes")?9.31:9.3),s}async fetchRelatedService(t){const i=this.portalItem;if(!i||!B(i))return null;this._relatedFeatureServicePromise||(this._relatedFeatureServicePromise=i.fetchRelatedItems({relationshipType:"Service2Service",direction:"reverse"},t).then(l=>l.find(y=>y.type==="Feature Service")??null,()=>null));const s=await this._relatedFeatureServicePromise;return Q(t),s?{itemId:s.id,url:s.url}:null}async fetchSublayerInfo(t,i){var p;const{source:s}=t;if(this!=null&&this.portalItem&&this.type==="tile"&&(s==null?void 0:s.type)==="map-layer"&&B(this.portalItem)&&t.originIdOf("url")u.SERVICE)try{const d=await this._fetchAllLayersAndTablesFromService(l),c=((p=H(l))==null?void 0:p.sublayer)??s.mapLayerId;y=d.get(c)}catch{}else{let d=t.id;(s==null?void 0:s.type)==="map-layer"&&(d=s.mapLayerId);try{y=(await this.fetchAllLayersAndTables(i)).get(d)}catch{}}return y}async fetchAllLayersAndTables(t){var i;return this._fetchAllLayersAndTablesFromService((i=this.parsedUrl)==null?void 0:i.path,t)}async _fetchAllLayersAndTablesFromService(t,i){await this.load(i),this._allLayersAndTablesMap||(this._allLayersAndTablesMap=new Map);const s=H(t),l=ie(this._allLayersAndTablesMap,s==null?void 0:s.url.path,()=>$(W(s==null?void 0:s.url.path,"/layers"),{responseType:"json",query:{f:"json",...this.customParameters,token:this.apiKey}}).then(p=>{const d=new Map;for(const c of p.data.layers)d.set(c.id,c);return{result:d}},p=>({error:p}))),y=await l;if(Q(i),"result"in y)return y.result;throw y.error}};return a([n({readOnly:!0})],e.prototype,"capabilities",void 0),a([g("service","capabilities",["capabilities","exportTilesAllowed","maxExportTilesCount","supportsDynamicLayers","tileInfo"])],e.prototype,"readCapabilities",null),a([n({json:{read:{source:"copyrightText"}}})],e.prototype,"copyright",void 0),a([n({type:z})],e.prototype,"fullExtent",void 0),a([n(Y)],e.prototype,"id",void 0),a([n({type:Boolean,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend"}}})],e.prototype,"legendEnabled",void 0),a([n(ee)],e.prototype,"popupEnabled",void 0),a([n({type:te})],e.prototype,"spatialReference",void 0),a([n({readOnly:!0})],e.prototype,"version",void 0),a([g("version",["currentVersion","capabilities","tables","supportedImageFormatTypes"])],e.prototype,"readVersion",null),e=a([k("esri.layers.mixins.ArcGISMapService")],e),e};var A;function j(r){return r!=null&&r.type==="esriSMS"}function M(r,e,t){var s;const i=this.originIdOf(e)>=L(t.origin);return{ignoreOrigin:!0,allowNull:i,enabled:!!t&&((s=t.layer)==null?void 0:s.type)==="map-image"&&(t.writeSublayerStructure||i)}}function C(r,e,t){var i;return{enabled:!!t&&((i=t.layer)==null?void 0:i.type)==="tile"&&(t.origin&&this.originIdOf(e)>=L(t.origin)||this._isOverridden(e))}}function m(r,e,t){return{ignoreOrigin:!0,enabled:t&&t.writeSublayerStructure||!1}}function P(r,e,t){return{ignoreOrigin:!0,enabled:!!t&&(t.writeSublayerStructure||this.originIdOf(e)>=L(t.origin))}}let je=0;const v=new Set;v.add("layer"),v.add("parent"),v.add("loaded"),v.add("loadStatus"),v.add("loadError"),v.add("loadWarnings");let o=A=class extends se(ae(xe)){constructor(r){super(r),this.capabilities=void 0,this.maxScaleRange={minScale:0,maxScale:0},this.fields=null,this.fullExtent=null,this.geometryType=null,this.globalIdField=null,this.legendEnabled=!0,this.objectIdField=null,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.sourceJSON=null,this.title=null,this.typeIdField=null,this.type="sublayer",this.types=null,this._lastParsedUrl=null}async load(r){return this.addResolvingPromise((async()=>{const{layer:e,url:t}=this;if(!e&&!t)throw new S("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});const i=e?await e.fetchSublayerInfo(this,r):(await $(t,{responseType:"json",query:{f:"json"},...r})).data;i&&(this.sourceJSON=i,this.read({layerDefinition:i},{origin:"service"}))})()),this}readCapabilities(r,e){e=e.layerDefinition||e;const{operations:{supportsQuery:t,supportsQueryAttachments:i},query:{supportsFormatPBF:s},data:{supportsAttachment:l}}=Ve(e,this.url);return{exportMap:{supportsModification:!!e.canModifyLayer},operations:{supportsQuery:t,supportsQueryAttachments:i},data:{supportsAttachment:l},query:{supportsFormatPBF:s}}}get defaultPopupTemplate(){return this.createPopupTemplate()}set definitionExpression(r){this._setAndNotifyLayer("definitionExpression",r)}get effectiveScaleRange(){const{minScale:r,maxScale:e}=this;return{minScale:r,maxScale:e}}readMaxScaleRange(r,e){return{minScale:(e=e.layerDefinition||e).minScale??0,maxScale:e.maxScale??0}}get fieldsIndex(){return new le(this.fields||[])}set floorInfo(r){this._setAndNotifyLayer("floorInfo",r)}readGlobalIdFieldFromService(r,e){if((e=e.layerDefinition||e).globalIdField)return e.globalIdField;if(e.fields){for(const t of e.fields)if(t.type==="esriFieldTypeGlobalID")return t.name}}get id(){return this._get("id")??je++}set id(r){var e,t,i;this._get("id")!==r&&(((i=(t=(e=this.layer)==null?void 0:e.capabilities)==null?void 0:t.exportMap)==null?void 0:i.supportsDynamicLayers)!==!1?this._set("id",r):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}set labelingInfo(r){this._setAndNotifyLayer("labelingInfo",r)}writeLabelingInfo(r,e,t,i){r&&r.length&&(e.layerDefinition={drawingInfo:{labelingInfo:r.map(s=>s.write({},i))}})}set labelsVisible(r){this._setAndNotifyLayer("labelsVisible",r)}set layer(r){this._set("layer",r),this.sublayers&&this.sublayers.forEach(e=>e.layer=r)}set listMode(r){this._set("listMode",r)}set minScale(r){this._setAndNotifyLayer("minScale",r)}readMinScale(r,e){var t;return e.minScale||((t=e.layerDefinition)==null?void 0:t.minScale)||0}set maxScale(r){this._setAndNotifyLayer("maxScale",r)}readMaxScale(r,e){var t;return e.maxScale||((t=e.layerDefinition)==null?void 0:t.maxScale)||0}readObjectIdFieldFromService(r,e){if((e=e.layerDefinition||e).objectIdField)return e.objectIdField;if(e.fields){for(const t of e.fields)if(t.type==="esriFieldTypeOID")return t.name}}set opacity(r){this._setAndNotifyLayer("opacity",r)}readOpacity(r,e){var i;const t=e.layerDefinition;return 1-.01*(((t==null?void 0:t.transparency)!=null?t.transparency:(i=t==null?void 0:t.drawingInfo)==null?void 0:i.transparency)??0)}writeOpacity(r,e,t,i){e.layerDefinition={drawingInfo:{transparency:100-100*r}}}writeParent(r,e){this.parent&&this.parent!==this.layer?e.parentLayerId=oe(this.parent.id):e.parentLayerId=-1}get queryTask(){var y;if(!this.layer)return null;const{spatialReference:r}=this.layer,e="gdbVersion"in this.layer?this.layer.gdbVersion:void 0,{capabilities:t,fieldsIndex:i}=this,s=ne("featurelayer-pbf")&&(t==null?void 0:t.query.supportsFormatPBF),l=((y=t==null?void 0:t.operations)==null?void 0:y.supportsQueryAttachments)??!1;return new _e({url:this.url,pbfSupported:s,fieldsIndex:i,gdbVersion:e,sourceSpatialReference:r,queryAttachmentsSupported:l})}set renderer(r){if(r){for(const e of r.getSymbols())if(ye(e)){E.getLogger(this).warn("Sublayer renderer should use 2D symbols");break}}this._setAndNotifyLayer("renderer",r)}get source(){return this._get("source")||new R({mapLayerId:this.id})}set source(r){this._setAndNotifyLayer("source",r)}set sublayers(r){this._handleSublayersChange(r,this._get("sublayers")),this._set("sublayers",r)}castSublayers(r){return pe(U.ofType(A),r)}writeSublayers(r,e,t){var i;(i=this.sublayers)!=null&&i.length&&(e[t]=this.sublayers.map(s=>s.id).toArray().reverse())}readTitle(r,e){var t;return((t=e.layerDefinition)==null?void 0:t.name)??e.name}readTypeIdField(r,e){let t=(e=e.layerDefinition||e).typeIdField;if(t&&e.fields){t=t.toLowerCase();const i=e.fields.find(s=>s.name.toLowerCase()===t);i&&(t=i.name)}return t}get url(){var i;const r=((i=this.layer)==null?void 0:i.parsedUrl)??this._lastParsedUrl,e=this.source;if(!r)return null;if(this._lastParsedUrl=r,(e==null?void 0:e.type)==="map-layer")return`${r.path}/${e.mapLayerId}`;const t={layer:JSON.stringify({source:this.source})};return`${r.path}/dynamicLayer?${ue(t)}`}set url(r){this._overrideIfSome("url",r)}set visible(r){this._setAndNotifyLayer("visible",r)}writeVisible(r,e,t,i){e[t]=this.getAtOrigin("defaultVisibility","service")||r}clone(){const{store:r}=_(this),e=new A;return _(e).store=r.clone(v),this.commitProperty("url"),e._lastParsedUrl=this._lastParsedUrl,e}createPopupTemplate(r){return de(this,r)}createQuery(){return new ce({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){var s;if(this.hasOwnProperty("sublayers"))return null;const r=(await he(()=>import("./FeatureLayer--S4epFk-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))).default,{layer:e,url:t}=this;let i;if(t&&this.originIdOf("url")>u.SERVICE)i=new r({url:t});else{if(!(e!=null&&e.parsedUrl))throw new S("createFeatureLayer:missing-information","Cannot create a FeatureLayer without a url or a parent layer");{const l=e.parsedUrl;i=new r({url:l.path}),l&&this.source&&(this.source.type==="map-layer"?i.layerId=this.source.mapLayerId:i.dynamicDataSource=this.source)}}return(e==null?void 0:e.refreshInterval)!=null&&(i.refreshInterval=e.refreshInterval),this.definitionExpression&&(i.definitionExpression=this.definitionExpression),this.floorInfo&&(i.floorInfo=F(this.floorInfo)),this.originIdOf("labelingInfo")>u.SERVICE&&(i.labelingInfo=F(this.labelingInfo)),this.originIdOf("labelsVisible")>u.DEFAULTS&&(i.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>u.DEFAULTS&&(i.legendEnabled=this.legendEnabled),this.originIdOf("visible")>u.DEFAULTS&&(i.visible=this.visible),this.originIdOf("minScale")>u.DEFAULTS&&(i.minScale=this.minScale),this.originIdOf("maxScale")>u.DEFAULTS&&(i.maxScale=this.maxScale),this.originIdOf("opacity")>u.DEFAULTS&&(i.opacity=this.opacity),this.originIdOf("popupTemplate")>u.DEFAULTS&&(i.popupTemplate=F(this.popupTemplate)),this.originIdOf("renderer")>u.SERVICE&&(i.renderer=F(this.renderer)),((s=this.source)==null?void 0:s.type)==="data-layer"&&(i.dynamicDataSource=this.source.clone()),this.originIdOf("title")>u.DEFAULTS&&(i.title=this.title),(e==null?void 0:e.type)==="map-image"&&e.originIdOf("customParameters")>u.DEFAULTS&&(i.customParameters=e.customParameters),(e==null?void 0:e.type)==="tile"&&e.originIdOf("customParameters")>u.DEFAULTS&&(i.customParameters=e.customParameters),i}getField(r){return this.fieldsIndex.get(r)}getFeatureType(r){const{typeIdField:e,types:t}=this;if(!e||!r)return null;const i=r.attributes?r.attributes[e]:void 0;if(i==null)return null;let s=null;return t==null||t.some(l=>{const{id:y}=l;return y!=null&&(y.toString()===i.toString()&&(s=l),!!s)}),s}getFieldDomain(r,e){const t=e==null?void 0:e.feature,i=this.getFeatureType(t);if(i){const s=i.domains&&i.domains[r];if(s&&s.type!=="inherited")return s}return this._getLayerDomain(r)}async queryAttachments(r,e){var b,I;await this.load(),r=fe.from(r);const t=this.capabilities;if(!((b=t==null?void 0:t.data)!=null&&b.supportsAttachment))throw new S("queryAttachments:not-supported","this layer doesn't support attachments");const{attachmentTypes:i,objectIds:s,globalIds:l,num:y,size:p,start:d,where:c}=r;if(!((I=t==null?void 0:t.operations)!=null&&I.supportsQueryAttachments)&&((i==null?void 0:i.length)>0||(l==null?void 0:l.length)>0||(p==null?void 0:p.length)>0||y||d||c))throw new S("queryAttachments:option-not-supported","when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",r);if(!(s!=null&&s.length||l!=null&&l.length||c))throw new S("queryAttachments:invalid-query","'objectIds', 'globalIds', or 'where' are required to perform attachment query",r);return this.queryTask.executeAttachmentQuery(r,e)}async queryFeatures(r=this.createQuery(),e){var i,s;if(await this.load(),!this.capabilities.operations.supportsQuery)throw new S("queryFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new S("queryFeatures:not-supported","this layer has no url.");const t=await this.queryTask.execute(r,{...e,query:{...(i=this.layer)==null?void 0:i.customParameters,token:(s=this.layer)==null?void 0:s.apiKey}});if(t!=null&&t.features)for(const l of t.features)l.sourceLayer=this;return t}toExportImageJSON(r){var l,y;const e={id:this.id,source:((l=this.source)==null?void 0:l.toJSON())||{mapLayerId:this.id,type:"mapLayer"}},t=be(r,this.definitionExpression);t!=null&&(e.definitionExpression=t);const i=["renderer","labelingInfo","opacity","labelsVisible"].reduce((p,d)=>(p[d]=this.originIdOf(d),p),{});if(Object.keys(i).some(p=>i[p]>u.SERVICE)){const p=e.drawingInfo={};if(i.renderer>u.SERVICE&&(p.renderer=this.renderer?this.renderer.toJSON():null),i.labelsVisible>u.SERVICE&&(p.showLabels=this.labelsVisible),this.labelsVisible&&i.labelingInfo>u.SERVICE)if(this.labelingInfo){!this.loaded&&((y=this.labelingInfo)!=null&&y.some(c=>!c.labelPlacement))&&E.getLogger(this).warnOnce(`A Sublayer (title: ${this.title}, id: ${this.id}) has an undefined 'labelPlacement' and so labels cannot be displayed. Either define a valid 'labelPlacement' or call Sublayer.load() to use a default value based on geometry type.`,{sublayer:this});let d=this.labelingInfo;this.geometryType!=null&&(d=me(this.labelingInfo,q.toJSON(this.geometryType))),p.showLabels=!0,p.labelingInfo=d.filter(c=>c.labelPlacement).map(c=>c.toJSON({origin:"service",layer:this.layer}))}else p.showLabels=!1;i.opacity>u.SERVICE&&(p.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(p.renderer)}return e}_assignDefaultSymbolColors(r){this._forEachSimpleMarkerSymbols(r,e=>{var t;e.color||e.style!=="esriSMSX"&&e.style!=="esriSMSCross"||((t=e.outline)!=null&&t.color?e.color=e.outline.color:e.color=[0,0,0,0])})}_forEachSimpleMarkerSymbols(r,e){if(r){const t=("uniqueValueInfos"in r?r.uniqueValueInfos:"classBreakInfos"in r?r.classBreakInfos:null)??[];for(const i of t)j(i.symbol)&&e(i.symbol);"symbol"in r&&j(r.symbol)&&e(r.symbol),"defaultSymbol"in r&&j(r.defaultSymbol)&&e(r.defaultSymbol)}}_setAndNotifyLayer(r,e){var p,d,c,b;const t=this.layer,i=this._get(r);let s,l;switch(r){case"definitionExpression":case"floorInfo":s="supportsSublayerDefinitionExpression";break;case"minScale":case"maxScale":case"visible":s="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":s="supportsDynamicLayers",l="supportsModification"}const y=_(this).getDefaultOrigin();if(y!=="service"){if(s&&((c=(d=(p=this.layer)==null?void 0:p.capabilities)==null?void 0:d.exportMap)==null?void 0:c[s])===!1)return void this._logLockedError(r,`capability not available 'layer.capabilities.exportMap.${s}'`);if(l&&((b=this.capabilities)==null?void 0:b.exportMap[l])===!1)return void this._logLockedError(r,`capability not available 'capabilities.exportMap.${l}'`)}r!=="source"||this.loadStatus==="not-loaded"?(this._set(r,e),y!=="service"&&i!==e&&t&&t.emit&&t.emit("sublayer-update",{propertyName:r,target:this})):this._logLockedError(r,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(r,e){e&&(e.forEach(t=>{t.parent=null,t.layer=null}),this.removeAllHandles()),r&&(r.forEach(t=>{t.parent=this,t.layer=this.layer}),this.addHandles([r.on("after-add",({item:t})=>{t.parent=this,t.layer=this.layer}),r.on("after-remove",({item:t})=>{t.parent=null,t.layer=null}),r.on("before-changes",t=>{var s,l,y;const i=(y=(l=(s=this.layer)==null?void 0:s.capabilities)==null?void 0:l.exportMap)==null?void 0:y.supportsSublayersChanges;i==null||i||(E.getLogger(this).error(new S("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),t.preventDefault())})]))}_logLockedError(r,e){const{layer:t,declaredClass:i}=this;E.getLogger(i).error(new S("sublayer:locked",`Property '${String(r)}' can't be changed on Sublayer from the layer '${t==null?void 0:t.id}'`,{reason:e,sublayer:this,layer:t}))}_getLayerDomain(r){const e=this.fieldsIndex.get(r);return e?e.domain:null}};o.test={isMapImageLayerOverridePolicy:r=>r===m||r===M,isTileImageLayerOverridePolicy:r=>r===C},a([n({readOnly:!0})],o.prototype,"capabilities",void 0),a([g("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],o.prototype,"readCapabilities",null),a([n()],o.prototype,"defaultPopupTemplate",null),a([n({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:M}}})],o.prototype,"definitionExpression",null),a([n({readOnly:!0})],o.prototype,"effectiveScaleRange",null),a([g("service","maxScaleRange",["minScale","maxScale"])],o.prototype,"readMaxScaleRange",null),a([n({type:[ge],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],o.prototype,"fields",void 0),a([n({readOnly:!0})],o.prototype,"fieldsIndex",null),a([n({type:Se,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:M},origins:{"web-scene":{read:!1,write:!1}}}})],o.prototype,"floorInfo",null),a([n({type:z,json:{read:{source:"layerDefinition.extent"}}})],o.prototype,"fullExtent",void 0),a([n({type:q.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:q.read}}}}})],o.prototype,"geometryType",void 0),a([n({type:String})],o.prototype,"globalIdField",void 0),a([g("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],o.prototype,"readGlobalIdFieldFromService",null),a([n({type:V,json:{write:{ignoreOrigin:!0}}})],o.prototype,"id",null),a([n({value:null,type:[Ie],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:m}}})],o.prototype,"labelingInfo",null),a([w("labelingInfo")],o.prototype,"writeLabelingInfo",null),a([n({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:m}}})],o.prototype,"labelsVisible",null),a([n({value:null})],o.prototype,"layer",null),a([n({type:String,json:{write:{overridePolicy:C}}})],o.prototype,"layerItemId",void 0),a([n({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:P}}})],o.prototype,"legendEnabled",void 0),a([n({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],o.prototype,"listMode",null),a([n({type:Number,value:0,json:{write:{overridePolicy:m}}})],o.prototype,"minScale",null),a([g("minScale",["minScale","layerDefinition.minScale"])],o.prototype,"readMinScale",null),a([n({type:Number,value:0,json:{write:{overridePolicy:m}}})],o.prototype,"maxScale",null),a([g("maxScale",["maxScale","layerDefinition.maxScale"])],o.prototype,"readMaxScale",null),a([n({type:String})],o.prototype,"objectIdField",void 0),a([g("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],o.prototype,"readObjectIdFieldFromService",null),a([n({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:m}}})],o.prototype,"opacity",null),a([g("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],o.prototype,"readOpacity",null),a([w("opacity")],o.prototype,"writeOpacity",null),a([n({json:{type:V,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:m}}})],o.prototype,"parent",void 0),a([w("parent")],o.prototype,"writeParent",null),a([n({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(r,e)=>!e.disablePopup},write:{target:"disablePopup",overridePolicy:P,writer(r,e,t){e[t]=!r}}}})],o.prototype,"popupEnabled",void 0),a([n({type:ve,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:P}}})],o.prototype,"popupTemplate",void 0),a([n({readOnly:!0})],o.prototype,"queryTask",null),a([n({types:we,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:m},origins:{"web-scene":{types:Ee,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:m}}}}})],o.prototype,"renderer",null),a([n({types:{key:"type",base:null,typeMap:{"data-layer":G,"map-layer":R}},cast(r){if(r){if("mapLayerId"in r)return K(R,r);if("dataSource"in r)return K(G,r)}return r},json:{name:"layerDefinition.source",write:{overridePolicy:m}}})],o.prototype,"source",null),a([n()],o.prototype,"sourceJSON",void 0),a([n({value:null,json:{type:[V],write:{target:"subLayerIds",allowNull:!0,overridePolicy:m}}})],o.prototype,"sublayers",null),a([Le("sublayers")],o.prototype,"castSublayers",null),a([w("sublayers")],o.prototype,"writeSublayers",null),a([n({type:String,json:{name:"name",write:{overridePolicy:P}}})],o.prototype,"title",void 0),a([g("service","title",["name","layerDefinition.name"])],o.prototype,"readTitle",null),a([n({type:String})],o.prototype,"typeIdField",void 0),a([n({json:{read:!1},readOnly:!0,value:"sublayer"})],o.prototype,"type",void 0),a([g("typeIdField",["layerDefinition.typeIdField"])],o.prototype,"readTypeIdField",null),a([n({type:[Ae],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],o.prototype,"types",void 0),a([n({type:String,json:{name:"layerUrl",write:{overridePolicy:C}}})],o.prototype,"url",null),a([n({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:m}}})],o.prototype,"visible",null),a([w("visible")],o.prototype,"writeVisible",null),o=A=a([k("esri.layers.support.Sublayer")],o);const J=o,Me=E.getLogger("esri.layers.TileLayer");function Ce(r,e){const t=[],i={};return r&&r.forEach(s=>{const l=new J;if(l.read(s,e),i[l.id]=l,s.parentLayerId!=null&&s.parentLayerId!==-1){const y=i[s.parentLayerId];y.sublayers||(y.sublayers=[]),y.sublayers.unshift(l)}else t.unshift(l)}),t}const N=U.ofType(J);function X(r,e){r&&r.forEach(t=>{e(t),t.sublayers&&t.sublayers.length&&X(t.sublayers,e)})}const Ue=r=>{let e=class extends r{constructor(...t){super(...t),this.allSublayers=new Oe({getCollections:()=>[this.sublayers],getChildrenFunction:i=>i.sublayers}),this.sublayersSourceJSON={[u.SERVICE]:{},[u.PORTAL_ITEM]:{},[u.WEB_SCENE]:{},[u.WEB_MAP]:{}},this.addHandles(Te(()=>this.sublayers,(i,s)=>this._handleSublayersChange(i,s),De))}destroy(){this.allSublayers.destroy()}readSublayers(t,i){if(!i||!t)return;const{sublayersSourceJSON:s}=this,l=L(i.origin);if(lu.SERVICE))return;this._set("serviceSublayers",this.createSublayersForOrigin("service").sublayers);const{sublayers:y,origin:p}=this.createSublayersForOrigin("web-document"),d=_(this);d.setDefaultOrigin(p),this._set("sublayers",new N(y)),d.setDefaultOrigin("user")}findSublayerById(t){return this.allSublayers.find(i=>i.id===t)}createServiceSublayers(){return this.createSublayersForOrigin("service").sublayers}createSublayersForOrigin(t){const i=L(t==="web-document"?"web-map":t);let s=u.SERVICE,l=this.sublayersSourceJSON[u.SERVICE].layers,y=this.sublayersSourceJSON[u.SERVICE].context,p=null;const d=[u.PORTAL_ITEM,u.WEB_SCENE,u.WEB_MAP].filter(h=>h<=i);for(const h of d){const f=this.sublayersSourceJSON[h];Fe(f.layers)&&(s=h,l=f.layers,y=f.context,f.visibleLayers&&(p={visibleLayers:f.visibleLayers,context:f.context}))}const c=[u.PORTAL_ITEM,u.WEB_SCENE,u.WEB_MAP].filter(h=>h>s&&h<=i);let b=null;for(const h of c){const{layers:f,visibleLayers:T,context:D}=this.sublayersSourceJSON[h];f&&(b={layers:f,context:D}),T&&(p={visibleLayers:T,context:D})}const I=Ce(l,y),x=new Map,O=new Set;if(b)for(const h of b.layers)x.set(h.id,h);if(p!=null&&p.visibleLayers)for(const h of p.visibleLayers)O.add(h);return X(I,h=>{b&&h.read(x.get(h.id),b.context),p&&h.read({defaultVisibility:O.has(h.id)},p.context)}),{origin:Pe(s),sublayers:new N({items:I})}}read(t,i){super.read(t,i),this.readSublayers(t,i)}_handleSublayersChange(t,i){i&&(i.forEach(s=>{s.parent=null,s.layer=null}),this.removeHandles("sublayers-owner")),t&&(t.forEach(s=>{s.parent=this,s.layer=this}),this.addHandles([t.on("after-add",({item:s})=>{s.parent=this,s.layer=this}),t.on("after-remove",({item:s})=>{s.parent=null,s.layer=null})],"sublayers-owner"),this.type==="tile"&&this.addHandles(t.on("before-changes",s=>{Me.error(new S("tilelayer:sublayers-non-modifiable","ISublayer can't be added, moved, or removed from the layer's sublayers",{layer:this})),s.preventDefault()}),"sublayers-owner"))}};return a([n({readOnly:!0})],e.prototype,"allSublayers",void 0),a([n({readOnly:!0,type:U.ofType(J)})],e.prototype,"serviceSublayers",void 0),a([n({value:null,type:N,json:{read:!1,write:{allowNull:!0,ignoreOrigin:!0}}})],e.prototype,"sublayers",void 0),a([n({readOnly:!0})],e.prototype,"sublayersSourceJSON",void 0),e=a([k("esri.layers.mixins.SublayersOwner")],e),e};export{Ue as E,J as X,ke as f}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/FeatureLayer--S4epFk-.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/FeatureLayerBase-jpFp8gE3.js","assets/serviceCapabilitiesUtils-26KpT1VN.js","assets/editsZScale-Wgw9kbYG.js","assets/queryZScale-IaMm02_2.js","assets/FeatureSet-d4S1oKME.js","assets/CustomParametersMixin-Y1bOcayO.js","assets/FeatureEffectLayer-oBa8pIG5.js","assets/FeatureEffect-5bEV-xG1.js","assets/FeatureReductionLayer-RlitE1N6.js","assets/OrderedLayer-M7k5gLgx.js","assets/FeatureTemplate-kUgbbA00.js","assets/FeatureType-MpRe7WJj.js","assets/versionUtils-4v9zIDlv.js","assets/TopFeaturesQuery-E6D2tV-x.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/SublayersOwner-Hx1szNtg.js b/dist/assets/SublayersOwner-Hx1szNtg.js new file mode 100644 index 0000000..a3423a5 --- /dev/null +++ b/dist/assets/SublayersOwner-Hx1szNtg.js @@ -0,0 +1,7 @@ +import{e as s,y as n,dt as g,dO as z,dP as Z,iw as ee,d2 as te,c as k,lj as re,lk as J,ab as Q,ei as u,h8 as K,av as $,df as W,ll as ie,dK as ae,a as se,r as S,eL as le,lm as oe,dE as ne,ln as ye,R as E,lo as R,lh as pe,V as U,e_ as ue,lp as P,io as de,aL as ce,de as he,ah as F,lq as fe,jp as be,lr as me,f9 as q,es as ge,ls as Se,er as V,iK as Ie,du as w,ix as ve,iN as we,iv as Ee,j0 as H,fY as G,f1 as Le,eh as L,il as xe,fK as Oe,B as Te,a9 as De,lt as Fe,lu as _e}from"./index-pCX-0tJH.js";import{x as Pe}from"./QueryTask-Di0fqnMV.js";import{n as Ae}from"./FeatureType-0WPvBvpQ.js";import{a as Ve}from"./serviceCapabilitiesUtils-f-iBP4uh.js";const ke=r=>{let e=class extends r{constructor(){super(...arguments),this.capabilities=void 0,this.copyright=null,this.fullExtent=null,this.legendEnabled=!0,this.spatialReference=null,this.version=void 0,this._allLayersAndTablesMap=null}readCapabilities(t,i){const a=i.capabilities&&i.capabilities.split(",").map(Y=>Y.toLowerCase().trim());if(!a)return{operations:{supportsExportMap:!1,supportsExportTiles:!1,supportsIdentify:!1,supportsQuery:!1,supportsTileMap:!1},exportMap:null,exportTiles:null};const l=this.type,y=l!=="tile"&&!!i.supportsDynamicLayers,p=a.includes("query"),d=a.includes("map"),c=!!i.exportTilesAllowed,b=a.includes("tilemap"),I=a.includes("data"),x=l!=="tile"&&(!i.tileInfo||y),O=l!=="tile"&&(!i.tileInfo||y),h=l!=="tile",f=i.cimVersion&&re.parse(i.cimVersion),T=(f==null?void 0:f.since(1,4))??!1,D=(f==null?void 0:f.since(2,0))??!1;return{operations:{supportsExportMap:d,supportsExportTiles:c,supportsIdentify:p,supportsQuery:I,supportsTileMap:b},exportMap:d?{supportsArcadeExpressionForLabeling:T,supportsSublayersChanges:h,supportsDynamicLayers:y,supportsSublayerVisibility:x,supportsSublayerDefinitionExpression:O,supportsCIMSymbols:D}:null,exportTiles:c?{maxExportTilesCount:+i.maxExportTilesCount}:null}}readVersion(t,i){let a=i.currentVersion;return a||(a=i.hasOwnProperty("capabilities")||i.hasOwnProperty("tables")?10:i.hasOwnProperty("supportedImageFormatTypes")?9.31:9.3),a}async fetchRelatedService(t){const i=this.portalItem;if(!i||!J(i))return null;this._relatedFeatureServicePromise||(this._relatedFeatureServicePromise=i.fetchRelatedItems({relationshipType:"Service2Service",direction:"reverse"},t).then(l=>l.find(y=>y.type==="Feature Service")??null,()=>null));const a=await this._relatedFeatureServicePromise;return Q(t),a?{itemId:a.id,url:a.url}:null}async fetchSublayerInfo(t,i){var p;const{source:a}=t;if(this!=null&&this.portalItem&&this.type==="tile"&&(a==null?void 0:a.type)==="map-layer"&&J(this.portalItem)&&t.originIdOf("url")u.SERVICE)try{const d=await this._fetchAllLayersAndTablesFromService(l),c=((p=W(l))==null?void 0:p.sublayer)??a.mapLayerId;y=d.get(c)}catch{}else{let d=t.id;(a==null?void 0:a.type)==="map-layer"&&(d=a.mapLayerId);try{y=(await this.fetchAllLayersAndTables(i)).get(d)}catch{}}return y}async fetchAllLayersAndTables(t){var i;return this._fetchAllLayersAndTablesFromService((i=this.parsedUrl)==null?void 0:i.path,t)}async _fetchAllLayersAndTablesFromService(t,i){await this.load(i),this._allLayersAndTablesMap||(this._allLayersAndTablesMap=new Map);const a=W(t),l=ie(this._allLayersAndTablesMap,a==null?void 0:a.url.path,()=>$(K(a==null?void 0:a.url.path,"/layers"),{responseType:"json",query:{f:"json",...this.customParameters,token:this.apiKey}}).then(p=>{const d=new Map;for(const c of p.data.layers)d.set(c.id,c);return{result:d}},p=>({error:p}))),y=await l;if(Q(i),"result"in y)return y.result;throw y.error}};return s([n({readOnly:!0})],e.prototype,"capabilities",void 0),s([g("service","capabilities",["capabilities","exportTilesAllowed","maxExportTilesCount","supportsDynamicLayers","tileInfo"])],e.prototype,"readCapabilities",null),s([n({json:{read:{source:"copyrightText"}}})],e.prototype,"copyright",void 0),s([n({type:z})],e.prototype,"fullExtent",void 0),s([n(Z)],e.prototype,"id",void 0),s([n({type:Boolean,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend"}}})],e.prototype,"legendEnabled",void 0),s([n(ee)],e.prototype,"popupEnabled",void 0),s([n({type:te})],e.prototype,"spatialReference",void 0),s([n({readOnly:!0})],e.prototype,"version",void 0),s([g("version",["currentVersion","capabilities","tables","supportedImageFormatTypes"])],e.prototype,"readVersion",null),e=s([k("esri.layers.mixins.ArcGISMapService")],e),e};var A;function j(r){return r!=null&&r.type==="esriSMS"}function M(r,e,t){var a;const i=this.originIdOf(e)>=L(t.origin);return{ignoreOrigin:!0,allowNull:i,enabled:!!t&&((a=t.layer)==null?void 0:a.type)==="map-image"&&(t.writeSublayerStructure||i)}}function C(r,e,t){var i;return{enabled:!!t&&((i=t.layer)==null?void 0:i.type)==="tile"&&(t.origin&&this.originIdOf(e)>=L(t.origin)||this._isOverridden(e))}}function m(r,e,t){return{ignoreOrigin:!0,enabled:t&&t.writeSublayerStructure||!1}}function _(r,e,t){return{ignoreOrigin:!0,enabled:!!t&&(t.writeSublayerStructure||this.originIdOf(e)>=L(t.origin))}}let je=0;const v=new Set;v.add("layer"),v.add("parent"),v.add("loaded"),v.add("loadStatus"),v.add("loadError"),v.add("loadWarnings");let o=A=class extends ae(se(xe)){constructor(r){super(r),this.capabilities=void 0,this.maxScaleRange={minScale:0,maxScale:0},this.fields=null,this.fullExtent=null,this.geometryType=null,this.globalIdField=null,this.legendEnabled=!0,this.objectIdField=null,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.sourceJSON=null,this.title=null,this.typeIdField=null,this.type="sublayer",this.types=null,this._lastParsedUrl=null}async load(r){return this.addResolvingPromise((async()=>{const{layer:e,url:t}=this;if(!e&&!t)throw new S("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});const i=e?await e.fetchSublayerInfo(this,r):(await $(t,{responseType:"json",query:{f:"json"},...r})).data;i&&(this.sourceJSON=i,this.read({layerDefinition:i},{origin:"service"}))})()),this}readCapabilities(r,e){e=e.layerDefinition||e;const{operations:{supportsQuery:t,supportsQueryAttachments:i},query:{supportsFormatPBF:a},data:{supportsAttachment:l}}=Ve(e,this.url);return{exportMap:{supportsModification:!!e.canModifyLayer},operations:{supportsQuery:t,supportsQueryAttachments:i},data:{supportsAttachment:l},query:{supportsFormatPBF:a}}}get defaultPopupTemplate(){return this.createPopupTemplate()}set definitionExpression(r){this._setAndNotifyLayer("definitionExpression",r)}get effectiveScaleRange(){const{minScale:r,maxScale:e}=this;return{minScale:r,maxScale:e}}readMaxScaleRange(r,e){return{minScale:(e=e.layerDefinition||e).minScale??0,maxScale:e.maxScale??0}}get fieldsIndex(){return new le(this.fields||[])}set floorInfo(r){this._setAndNotifyLayer("floorInfo",r)}readGlobalIdFieldFromService(r,e){if((e=e.layerDefinition||e).globalIdField)return e.globalIdField;if(e.fields){for(const t of e.fields)if(t.type==="esriFieldTypeGlobalID")return t.name}}get id(){return this._get("id")??je++}set id(r){var e,t,i;this._get("id")!==r&&(((i=(t=(e=this.layer)==null?void 0:e.capabilities)==null?void 0:t.exportMap)==null?void 0:i.supportsDynamicLayers)!==!1?this._set("id",r):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}set labelingInfo(r){this._setAndNotifyLayer("labelingInfo",r)}writeLabelingInfo(r,e,t,i){r&&r.length&&(e.layerDefinition={drawingInfo:{labelingInfo:r.map(a=>a.write({},i))}})}set labelsVisible(r){this._setAndNotifyLayer("labelsVisible",r)}set layer(r){this._set("layer",r),this.sublayers&&this.sublayers.forEach(e=>e.layer=r)}set listMode(r){this._set("listMode",r)}set minScale(r){this._setAndNotifyLayer("minScale",r)}readMinScale(r,e){var t;return e.minScale||((t=e.layerDefinition)==null?void 0:t.minScale)||0}set maxScale(r){this._setAndNotifyLayer("maxScale",r)}readMaxScale(r,e){var t;return e.maxScale||((t=e.layerDefinition)==null?void 0:t.maxScale)||0}readObjectIdFieldFromService(r,e){if((e=e.layerDefinition||e).objectIdField)return e.objectIdField;if(e.fields){for(const t of e.fields)if(t.type==="esriFieldTypeOID")return t.name}}set opacity(r){this._setAndNotifyLayer("opacity",r)}readOpacity(r,e){var i;const t=e.layerDefinition;return 1-.01*(((t==null?void 0:t.transparency)!=null?t.transparency:(i=t==null?void 0:t.drawingInfo)==null?void 0:i.transparency)??0)}writeOpacity(r,e,t,i){e.layerDefinition={drawingInfo:{transparency:100-100*r}}}writeParent(r,e){this.parent&&this.parent!==this.layer?e.parentLayerId=oe(this.parent.id):e.parentLayerId=-1}get queryTask(){var y;if(!this.layer)return null;const{spatialReference:r}=this.layer,e="gdbVersion"in this.layer?this.layer.gdbVersion:void 0,{capabilities:t,fieldsIndex:i}=this,a=ne("featurelayer-pbf")&&(t==null?void 0:t.query.supportsFormatPBF),l=((y=t==null?void 0:t.operations)==null?void 0:y.supportsQueryAttachments)??!1;return new Pe({url:this.url,pbfSupported:a,fieldsIndex:i,gdbVersion:e,sourceSpatialReference:r,queryAttachmentsSupported:l})}set renderer(r){if(r){for(const e of r.getSymbols())if(ye(e)){E.getLogger(this).warn("Sublayer renderer should use 2D symbols");break}}this._setAndNotifyLayer("renderer",r)}get source(){return this._get("source")||new R({mapLayerId:this.id})}set source(r){this._setAndNotifyLayer("source",r)}set sublayers(r){this._handleSublayersChange(r,this._get("sublayers")),this._set("sublayers",r)}castSublayers(r){return pe(U.ofType(A),r)}writeSublayers(r,e,t){var i;(i=this.sublayers)!=null&&i.length&&(e[t]=this.sublayers.map(a=>a.id).toArray().reverse())}readTitle(r,e){var t;return((t=e.layerDefinition)==null?void 0:t.name)??e.name}readTypeIdField(r,e){let t=(e=e.layerDefinition||e).typeIdField;if(t&&e.fields){t=t.toLowerCase();const i=e.fields.find(a=>a.name.toLowerCase()===t);i&&(t=i.name)}return t}get url(){var i;const r=((i=this.layer)==null?void 0:i.parsedUrl)??this._lastParsedUrl,e=this.source;if(!r)return null;if(this._lastParsedUrl=r,(e==null?void 0:e.type)==="map-layer")return`${r.path}/${e.mapLayerId}`;const t={layer:JSON.stringify({source:this.source})};return`${r.path}/dynamicLayer?${ue(t)}`}set url(r){this._overrideIfSome("url",r)}set visible(r){this._setAndNotifyLayer("visible",r)}writeVisible(r,e,t,i){e[t]=this.getAtOrigin("defaultVisibility","service")||r}clone(){const{store:r}=P(this),e=new A;return P(e).store=r.clone(v),this.commitProperty("url"),e._lastParsedUrl=this._lastParsedUrl,e}createPopupTemplate(r){return de(this,r)}createQuery(){return new ce({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){var a;if(this.hasOwnProperty("sublayers"))return null;const r=(await he(()=>import("./FeatureLayer-9tNCmEbA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))).default,{layer:e,url:t}=this;let i;if(t&&this.originIdOf("url")>u.SERVICE)i=new r({url:t});else{if(!(e!=null&&e.parsedUrl))throw new S("createFeatureLayer:missing-information","Cannot create a FeatureLayer without a url or a parent layer");{const l=e.parsedUrl;i=new r({url:l.path}),l&&this.source&&(this.source.type==="map-layer"?i.layerId=this.source.mapLayerId:i.dynamicDataSource=this.source)}}return(e==null?void 0:e.refreshInterval)!=null&&(i.refreshInterval=e.refreshInterval),this.definitionExpression&&(i.definitionExpression=this.definitionExpression),this.floorInfo&&(i.floorInfo=F(this.floorInfo)),this.originIdOf("labelingInfo")>u.SERVICE&&(i.labelingInfo=F(this.labelingInfo)),this.originIdOf("labelsVisible")>u.DEFAULTS&&(i.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>u.DEFAULTS&&(i.legendEnabled=this.legendEnabled),this.originIdOf("visible")>u.DEFAULTS&&(i.visible=this.visible),this.originIdOf("minScale")>u.DEFAULTS&&(i.minScale=this.minScale),this.originIdOf("maxScale")>u.DEFAULTS&&(i.maxScale=this.maxScale),this.originIdOf("opacity")>u.DEFAULTS&&(i.opacity=this.opacity),this.originIdOf("popupTemplate")>u.DEFAULTS&&(i.popupTemplate=F(this.popupTemplate)),this.originIdOf("renderer")>u.SERVICE&&(i.renderer=F(this.renderer)),((a=this.source)==null?void 0:a.type)==="data-layer"&&(i.dynamicDataSource=this.source.clone()),this.originIdOf("title")>u.DEFAULTS&&(i.title=this.title),(e==null?void 0:e.type)==="map-image"&&e.originIdOf("customParameters")>u.DEFAULTS&&(i.customParameters=e.customParameters),(e==null?void 0:e.type)==="tile"&&e.originIdOf("customParameters")>u.DEFAULTS&&(i.customParameters=e.customParameters),i}getField(r){return this.fieldsIndex.get(r)}getFeatureType(r){const{typeIdField:e,types:t}=this;if(!e||!r)return null;const i=r.attributes?r.attributes[e]:void 0;if(i==null)return null;let a=null;return t==null||t.some(l=>{const{id:y}=l;return y!=null&&(y.toString()===i.toString()&&(a=l),!!a)}),a}getFieldDomain(r,e){const t=e==null?void 0:e.feature,i=this.getFeatureType(t);if(i){const a=i.domains&&i.domains[r];if(a&&a.type!=="inherited")return a}return this._getLayerDomain(r)}async queryAttachments(r,e){var b,I;await this.load(),r=fe.from(r);const t=this.capabilities;if(!((b=t==null?void 0:t.data)!=null&&b.supportsAttachment))throw new S("queryAttachments:not-supported","this layer doesn't support attachments");const{attachmentTypes:i,objectIds:a,globalIds:l,num:y,size:p,start:d,where:c}=r;if(!((I=t==null?void 0:t.operations)!=null&&I.supportsQueryAttachments)&&((i==null?void 0:i.length)>0||(l==null?void 0:l.length)>0||(p==null?void 0:p.length)>0||y||d||c))throw new S("queryAttachments:option-not-supported","when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",r);if(!(a!=null&&a.length||l!=null&&l.length||c))throw new S("queryAttachments:invalid-query","'objectIds', 'globalIds', or 'where' are required to perform attachment query",r);return this.queryTask.executeAttachmentQuery(r,e)}async queryFeatures(r=this.createQuery(),e){var i,a;if(await this.load(),!this.capabilities.operations.supportsQuery)throw new S("queryFeatures:not-supported","this layer doesn't support queries.");if(!this.url)throw new S("queryFeatures:not-supported","this layer has no url.");const t=await this.queryTask.execute(r,{...e,query:{...(i=this.layer)==null?void 0:i.customParameters,token:(a=this.layer)==null?void 0:a.apiKey}});if(t!=null&&t.features)for(const l of t.features)l.sourceLayer=this;return t}toExportImageJSON(r){var l,y;const e={id:this.id,source:((l=this.source)==null?void 0:l.toJSON())||{mapLayerId:this.id,type:"mapLayer"}},t=be(r,this.definitionExpression);t!=null&&(e.definitionExpression=t);const i=["renderer","labelingInfo","opacity","labelsVisible"].reduce((p,d)=>(p[d]=this.originIdOf(d),p),{});if(Object.keys(i).some(p=>i[p]>u.SERVICE)){const p=e.drawingInfo={};if(i.renderer>u.SERVICE&&(p.renderer=this.renderer?this.renderer.toJSON():null),i.labelsVisible>u.SERVICE&&(p.showLabels=this.labelsVisible),this.labelsVisible&&i.labelingInfo>u.SERVICE)if(this.labelingInfo){!this.loaded&&((y=this.labelingInfo)!=null&&y.some(c=>!c.labelPlacement))&&E.getLogger(this).warnOnce(`A Sublayer (title: ${this.title}, id: ${this.id}) has an undefined 'labelPlacement' and so labels cannot be displayed. Either define a valid 'labelPlacement' or call Sublayer.load() to use a default value based on geometry type.`,{sublayer:this});let d=this.labelingInfo;this.geometryType!=null&&(d=me(this.labelingInfo,q.toJSON(this.geometryType))),p.showLabels=!0,p.labelingInfo=d.filter(c=>c.labelPlacement).map(c=>c.toJSON({origin:"service",layer:this.layer}))}else p.showLabels=!1;i.opacity>u.SERVICE&&(p.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(p.renderer)}return e}_assignDefaultSymbolColors(r){this._forEachSimpleMarkerSymbols(r,e=>{var t;e.color||e.style!=="esriSMSX"&&e.style!=="esriSMSCross"||((t=e.outline)!=null&&t.color?e.color=e.outline.color:e.color=[0,0,0,0])})}_forEachSimpleMarkerSymbols(r,e){if(r){const t=("uniqueValueInfos"in r?r.uniqueValueInfos:"classBreakInfos"in r?r.classBreakInfos:null)??[];for(const i of t)j(i.symbol)&&e(i.symbol);"symbol"in r&&j(r.symbol)&&e(r.symbol),"defaultSymbol"in r&&j(r.defaultSymbol)&&e(r.defaultSymbol)}}_setAndNotifyLayer(r,e){var p,d,c,b;const t=this.layer,i=this._get(r);let a,l;switch(r){case"definitionExpression":case"floorInfo":a="supportsSublayerDefinitionExpression";break;case"minScale":case"maxScale":case"visible":a="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":a="supportsDynamicLayers",l="supportsModification"}const y=P(this).getDefaultOrigin();if(y!=="service"){if(a&&((c=(d=(p=this.layer)==null?void 0:p.capabilities)==null?void 0:d.exportMap)==null?void 0:c[a])===!1)return void this._logLockedError(r,`capability not available 'layer.capabilities.exportMap.${a}'`);if(l&&((b=this.capabilities)==null?void 0:b.exportMap[l])===!1)return void this._logLockedError(r,`capability not available 'capabilities.exportMap.${l}'`)}r!=="source"||this.loadStatus==="not-loaded"?(this._set(r,e),y!=="service"&&i!==e&&t&&t.emit&&t.emit("sublayer-update",{propertyName:r,target:this})):this._logLockedError(r,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(r,e){e&&(e.forEach(t=>{t.parent=null,t.layer=null}),this.removeAllHandles()),r&&(r.forEach(t=>{t.parent=this,t.layer=this.layer}),this.addHandles([r.on("after-add",({item:t})=>{t.parent=this,t.layer=this.layer}),r.on("after-remove",({item:t})=>{t.parent=null,t.layer=null}),r.on("before-changes",t=>{var a,l,y;const i=(y=(l=(a=this.layer)==null?void 0:a.capabilities)==null?void 0:l.exportMap)==null?void 0:y.supportsSublayersChanges;i==null||i||(E.getLogger(this).error(new S("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),t.preventDefault())})]))}_logLockedError(r,e){const{layer:t,declaredClass:i}=this;E.getLogger(i).error(new S("sublayer:locked",`Property '${String(r)}' can't be changed on Sublayer from the layer '${t==null?void 0:t.id}'`,{reason:e,sublayer:this,layer:t}))}_getLayerDomain(r){const e=this.fieldsIndex.get(r);return e?e.domain:null}};o.test={isMapImageLayerOverridePolicy:r=>r===m||r===M,isTileImageLayerOverridePolicy:r=>r===C},s([n({readOnly:!0})],o.prototype,"capabilities",void 0),s([g("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],o.prototype,"readCapabilities",null),s([n()],o.prototype,"defaultPopupTemplate",null),s([n({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:M}}})],o.prototype,"definitionExpression",null),s([n({readOnly:!0})],o.prototype,"effectiveScaleRange",null),s([g("service","maxScaleRange",["minScale","maxScale"])],o.prototype,"readMaxScaleRange",null),s([n({type:[ge],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],o.prototype,"fields",void 0),s([n({readOnly:!0})],o.prototype,"fieldsIndex",null),s([n({type:Se,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:M},origins:{"web-scene":{read:!1,write:!1}}}})],o.prototype,"floorInfo",null),s([n({type:z,json:{read:{source:"layerDefinition.extent"}}})],o.prototype,"fullExtent",void 0),s([n({type:q.apiValues,json:{origins:{service:{name:"layerDefinition.geometryType",read:{reader:q.read}}}}})],o.prototype,"geometryType",void 0),s([n({type:String})],o.prototype,"globalIdField",void 0),s([g("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],o.prototype,"readGlobalIdFieldFromService",null),s([n({type:V,json:{write:{ignoreOrigin:!0}}})],o.prototype,"id",null),s([n({value:null,type:[Ie],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:m}}})],o.prototype,"labelingInfo",null),s([w("labelingInfo")],o.prototype,"writeLabelingInfo",null),s([n({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:m}}})],o.prototype,"labelsVisible",null),s([n({value:null})],o.prototype,"layer",null),s([n({type:String,json:{write:{overridePolicy:C}}})],o.prototype,"layerItemId",void 0),s([n({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:_}}})],o.prototype,"legendEnabled",void 0),s([n({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],o.prototype,"listMode",null),s([n({type:Number,value:0,json:{write:{overridePolicy:m}}})],o.prototype,"minScale",null),s([g("minScale",["minScale","layerDefinition.minScale"])],o.prototype,"readMinScale",null),s([n({type:Number,value:0,json:{write:{overridePolicy:m}}})],o.prototype,"maxScale",null),s([g("maxScale",["maxScale","layerDefinition.maxScale"])],o.prototype,"readMaxScale",null),s([n({type:String})],o.prototype,"objectIdField",void 0),s([g("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],o.prototype,"readObjectIdFieldFromService",null),s([n({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:m}}})],o.prototype,"opacity",null),s([g("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],o.prototype,"readOpacity",null),s([w("opacity")],o.prototype,"writeOpacity",null),s([n({json:{type:V,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:m}}})],o.prototype,"parent",void 0),s([w("parent")],o.prototype,"writeParent",null),s([n({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(r,e)=>!e.disablePopup},write:{target:"disablePopup",overridePolicy:_,writer(r,e,t){e[t]=!r}}}})],o.prototype,"popupEnabled",void 0),s([n({type:ve,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:_}}})],o.prototype,"popupTemplate",void 0),s([n({readOnly:!0})],o.prototype,"queryTask",null),s([n({types:we,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:m},origins:{"web-scene":{types:Ee,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:m}}}}})],o.prototype,"renderer",null),s([n({types:{key:"type",base:null,typeMap:{"data-layer":H,"map-layer":R}},cast(r){if(r){if("mapLayerId"in r)return G(R,r);if("dataSource"in r)return G(H,r)}return r},json:{name:"layerDefinition.source",write:{overridePolicy:m}}})],o.prototype,"source",null),s([n()],o.prototype,"sourceJSON",void 0),s([n({value:null,json:{type:[V],write:{target:"subLayerIds",allowNull:!0,overridePolicy:m}}})],o.prototype,"sublayers",null),s([Le("sublayers")],o.prototype,"castSublayers",null),s([w("sublayers")],o.prototype,"writeSublayers",null),s([n({type:String,json:{name:"name",write:{overridePolicy:_}}})],o.prototype,"title",void 0),s([g("service","title",["name","layerDefinition.name"])],o.prototype,"readTitle",null),s([n({type:String})],o.prototype,"typeIdField",void 0),s([n({json:{read:!1},readOnly:!0,value:"sublayer"})],o.prototype,"type",void 0),s([g("typeIdField",["layerDefinition.typeIdField"])],o.prototype,"readTypeIdField",null),s([n({type:[Ae],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],o.prototype,"types",void 0),s([n({type:String,json:{name:"layerUrl",write:{overridePolicy:C}}})],o.prototype,"url",null),s([n({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:m}}})],o.prototype,"visible",null),s([w("visible")],o.prototype,"writeVisible",null),o=A=s([k("esri.layers.support.Sublayer")],o);const B=o,Me=E.getLogger("esri.layers.TileLayer");function Ce(r,e){const t=[],i={};return r&&r.forEach(a=>{const l=new B;if(l.read(a,e),i[l.id]=l,a.parentLayerId!=null&&a.parentLayerId!==-1){const y=i[a.parentLayerId];y.sublayers||(y.sublayers=[]),y.sublayers.unshift(l)}else t.unshift(l)}),t}const N=U.ofType(B);function X(r,e){r&&r.forEach(t=>{e(t),t.sublayers&&t.sublayers.length&&X(t.sublayers,e)})}const Ue=r=>{let e=class extends r{constructor(...t){super(...t),this.allSublayers=new Oe({getCollections:()=>[this.sublayers],getChildrenFunction:i=>i.sublayers}),this.sublayersSourceJSON={[u.SERVICE]:{},[u.PORTAL_ITEM]:{},[u.WEB_SCENE]:{},[u.WEB_MAP]:{}},this.addHandles(Te(()=>this.sublayers,(i,a)=>this._handleSublayersChange(i,a),De))}destroy(){this.allSublayers.destroy()}readSublayers(t,i){if(!i||!t)return;const{sublayersSourceJSON:a}=this,l=L(i.origin);if(lu.SERVICE))return;this._set("serviceSublayers",this.createSublayersForOrigin("service").sublayers);const{sublayers:y,origin:p}=this.createSublayersForOrigin("web-document"),d=P(this);d.setDefaultOrigin(p),this._set("sublayers",new N(y)),d.setDefaultOrigin("user")}findSublayerById(t){return this.allSublayers.find(i=>i.id===t)}createServiceSublayers(){return this.createSublayersForOrigin("service").sublayers}createSublayersForOrigin(t){const i=L(t==="web-document"?"web-map":t);let a=u.SERVICE,l=this.sublayersSourceJSON[u.SERVICE].layers,y=this.sublayersSourceJSON[u.SERVICE].context,p=null;const d=[u.PORTAL_ITEM,u.WEB_SCENE,u.WEB_MAP].filter(h=>h<=i);for(const h of d){const f=this.sublayersSourceJSON[h];Fe(f.layers)&&(a=h,l=f.layers,y=f.context,f.visibleLayers&&(p={visibleLayers:f.visibleLayers,context:f.context}))}const c=[u.PORTAL_ITEM,u.WEB_SCENE,u.WEB_MAP].filter(h=>h>a&&h<=i);let b=null;for(const h of c){const{layers:f,visibleLayers:T,context:D}=this.sublayersSourceJSON[h];f&&(b={layers:f,context:D}),T&&(p={visibleLayers:T,context:D})}const I=Ce(l,y),x=new Map,O=new Set;if(b)for(const h of b.layers)x.set(h.id,h);if(p!=null&&p.visibleLayers)for(const h of p.visibleLayers)O.add(h);return X(I,h=>{b&&h.read(x.get(h.id),b.context),p&&h.read({defaultVisibility:O.has(h.id)},p.context)}),{origin:_e(a),sublayers:new N({items:I})}}read(t,i){super.read(t,i),this.readSublayers(t,i)}_handleSublayersChange(t,i){i&&(i.forEach(a=>{a.parent=null,a.layer=null}),this.removeHandles("sublayers-owner")),t&&(t.forEach(a=>{a.parent=this,a.layer=this}),this.addHandles([t.on("after-add",({item:a})=>{a.parent=this,a.layer=this}),t.on("after-remove",({item:a})=>{a.parent=null,a.layer=null})],"sublayers-owner"),this.type==="tile"&&this.addHandles(t.on("before-changes",a=>{Me.error(new S("tilelayer:sublayers-non-modifiable","ISublayer can't be added, moved, or removed from the layer's sublayers",{layer:this})),a.preventDefault()}),"sublayers-owner"))}};return s([n({readOnly:!0})],e.prototype,"allSublayers",void 0),s([n({readOnly:!0,type:U.ofType(B)})],e.prototype,"serviceSublayers",void 0),s([n({value:null,type:N,json:{read:!1,write:{allowNull:!0,ignoreOrigin:!0}}})],e.prototype,"sublayers",void 0),s([n({readOnly:!0})],e.prototype,"sublayersSourceJSON",void 0),e=s([k("esri.layers.mixins.SublayersOwner")],e),e};export{Ue as E,B as X,ke as f}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/FeatureLayer-9tNCmEbA.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/FeatureLayerBase-mvqC7cJs.js","assets/serviceCapabilitiesUtils-f-iBP4uh.js","assets/editsZScale-4-dTv58d.js","assets/CustomParametersMixin-7nmugR3Y.js","assets/FeatureEffectLayer-OK0TB5f6.js","assets/FeatureEffect-0Jn9Z0sQ.js","assets/FeatureReductionLayer-2X2_PJv9.js","assets/OrderedLayer-XNaJwl_G.js","assets/FeatureTemplate-vSzbyslg.js","assets/FeatureType-0WPvBvpQ.js","assets/versionUtils-idhrDltC.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/SubtypeGroupLayer-lkxtOZrq.js b/dist/assets/SubtypeGroupLayer-lkxtOZrq.js new file mode 100644 index 0000000..c2bd091 --- /dev/null +++ b/dist/assets/SubtypeGroupLayer-lkxtOZrq.js @@ -0,0 +1,7 @@ +import{jm as W,dK as D,dq as k,a as X,ah as j,dy as Y,R as ee,iG as te,jn as A,r as b,io as re,jo as N,jp as L,ei as M,aL as H,e as i,y as n,du as ie,iJ as se,iK as ne,iL as ae,dQ as oe,jl as le,jk as ue,iw as pe,ix as de,dt as I,c as Q,jq as ye,jr as ce,js as he,iz as U,jt as be,ju as fe,jv as ge,il as me,jw as ve,dF as we,ee as je,dJ as Se,dG as Fe,ef as Ie,dH as $e,dI as Oe,eg as Ee,V as _,bs as Te,B as Ce,a9 as _e,dL as Ae,jx as Le,jy as xe,au as Pe,h8 as Ge,jz as qe,jA as Ve,jB as Re,jC as De,gD as ke,de as x,jD as Ne,jE as Me,ep as He,jF as Qe,jG as Ue,jH as Be,jI as Je,jJ as ze,jK as Ke,jj as E,iH as Ze,jL as We,dP as Xe,eh as P,jM as Ye,aI as et}from"./index-pCX-0tJH.js";import{o as tt}from"./CustomParametersMixin-7nmugR3Y.js";import{y as rt,D as it}from"./FeatureLayerBase-mvqC7cJs.js";import{p as B}from"./FeatureTemplate-vSzbyslg.js";import{e as st}from"./versionUtils-idhrDltC.js";import"./serviceCapabilitiesUtils-f-iBP4uh.js";const nt=["charts","editingEnabled","formTemplate","labelsVisible","labelingInfo","legendEnabled","minScale","maxScale","opacity","popupEnabled","popupTemplate","renderer","subtypeCode","templates","title","visible"],J={key:"type",base:ye,errorContext:"renderer",typeMap:{simple:A,"unique-value":ce,"class-breaks":he}},G=U(),q=W({types:J});let at=0;function F(e){const t=e.json.write;return typeof t=="object"?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function ot(e){return new A({symbol:lt(e)})}function lt(e){switch(e){case"point":case"multipoint":return ge.clone();case"polyline":return fe.clone();case"polygon":case"multipatch":return be.clone();default:return null}}function ut(e,t){return!!t&&(e==null?void 0:e.type)==="unique-value"&&typeof e.field=="string"&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression}function z(e,t){var r;return e==null?null:(r=t.subtypes)==null?void 0:r.find(s=>s.code===e)}function pt(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const s={},a=z(e,t);if(a!=null){const{defaultValues:o}=a;for(const u in o)s[u]=o[u]}return s[t.subtypeField]=e,new B({name:"New Feature",drawingTool:r,prototype:{attributes:s}})}const K="esri.layers.support.SubtypeSublayer";let l=class extends D(k(X(me))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${at++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}get capabilities(){var e;return(e=this.parent)==null?void 0:e.capabilities}get effectiveCapabilities(){var e;return(e=this.parent)==null?void 0:e.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){var e;return(e=this.parent)==null?void 0:e.elevationInfo}writeFieldOverrides(e,t,r){const{fields:s,parent:a}=this;let o;if(s){o=[];let u=0;s.forEach(({name:y,alias:c,editable:g,visible:m})=>{var $;if(!m)return;const d=($=a==null?void 0:a.fields)==null?void 0:$.find(S=>S.name===y);if(!d)return;const f={name:y};let w=!1;c!==d.alias&&(f.alias=c,w=!0),g!==d.editable&&(f.editable=g,w=!0),o.push(f),w&&u++}),u===0&&o.length===s.length&&(o=null)}else o=j(e);o!=null&&o.length&&Y(r,o,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,s=e==null?void 0:e.fields;if(!e||!(s!=null&&s.length))return null;const{subtypes:a,subtypeField:o}=e,u=a==null?void 0:a.find(m=>m.code===r),y=u==null?void 0:u.defaultValues,c=u==null?void 0:u.domains,g=[];for(const m of s){const d=m.clone(),{name:f}=d,w=t==null?void 0:t.find(O=>O.name===f);if(d.visible=!t||!!w,w){const{alias:O,editable:Z}=w;O&&(d.alias=O),Z===!1&&(d.editable=!1)}const $=(y==null?void 0:y[f])??null;d.defaultValue=f===o?r:$;const S=(c==null?void 0:c[f])??null;d.domain=f===o?null:S?S.type==="inherited"?d.domain:S.clone():null,g.push(d)}return g}get floorInfo(){var e;return(e=this.parent)==null?void 0:e.floorInfo}get geometryType(){var e;return(e=this.parent)==null?void 0:e.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){var e;return this.parent||ee.getLogger(K).error(v("objectIdField")),(e=this.parent)==null?void 0:e.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){te(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&e.geometryType!=="mesh"?ot(e.geometryType):null}readRendererFromService(e,t,r){var y,c,g;if(t.type==="Table")return null;const s=(y=t.drawingInfo)==null?void 0:y.renderer,a=q(s,t,r);let o;const{subtypeCode:u}=this;if(u!=null&&ut(a,t.subtypeField)){const m=(c=a.uniqueValueInfos)==null?void 0:c.find(({value:d})=>(d=typeof d=="number"?String(d):d)===String(u));m&&(o=new A({symbol:m.symbol}))}else(a==null?void 0:a.type)!=="simple"||(g=a.visualVariables)!=null&&g.length||(o=a);return o}readRenderer(e,t,r){var o,u,y;const s=(u=(o=t==null?void 0:t.layerDefinition)==null?void 0:o.drawingInfo)==null?void 0:u.renderer;return s?((y=s.visualVariables)==null?void 0:y.some(c=>c.type!=="rotationInfo"))?void 0:q(s,t,r)||void 0:void 0}get spatialReference(){var e;return(e=this.parent)==null?void 0:e.spatialReference}readTemplatesFromService(e,t){return[pt(this.subtypeCode,t)]}readTitleFromService(e,t){const r=z(this.subtypeCode,t);return r!=null?r.name:null}get url(){var e;return(e=this.parent)==null?void 0:e.url}get userHasUpdateItemPrivileges(){var e;return!!((e=this.parent)!=null&&e.userHasUpdateItemPrivileges)}async addAttachment(e,t){const{parent:r}=this;if(!r)throw v("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new b("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:s}=this;if(!s)throw v("updateAttachment");if(e.getAttribute(s.subtypeField)!==this.subtypeCode)throw new b("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return s.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw v("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new b("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw v("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:s,title:a}=this;if(r){const{displayField:o,editFieldsInfo:u,objectIdField:y}=r;t={displayField:o,editFieldsInfo:u,fields:s,objectIdField:y,title:a}}return re(t,e)}createQuery(){if(!this.parent)throw v("createQuery");const e=N(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=L(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e){return this._getLayerDomain(e)}hasUserOverrides(){return nt.some(e=>this.originIdOf(e)===M.USER)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw v("queryAttachments");const s=e.clone();return s.where=V(s.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw v("queryFeatures");const s=H.from(e)??r.createQuery();return e!=null&&(s.where=V(s.where,r.parent.subtypeField,r.subtypeCode)),r.parent.queryFeatures(s,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};i([n({readOnly:!0,json:{read:!1}})],l.prototype,"capabilities",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"effectiveCapabilities",null),i([n({json:{write:{ignoreOrigin:!0}}})],l.prototype,"charts",void 0),i([n({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],l.prototype,"editingEnabled",void 0),i([n({type:Boolean,readOnly:!0})],l.prototype,"effectiveEditingEnabled",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"elevationInfo",null),i([n({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],l.prototype,"fieldOverrides",void 0),i([ie("fieldOverrides")],l.prototype,"writeFieldOverrides",null),i([n({...G.fields,readOnly:!0,json:{read:!1}})],l.prototype,"fields",null),i([n(G.fieldsIndex)],l.prototype,"fieldsIndex",void 0),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"floorInfo",null),i([n({type:rt,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],l.prototype,"formTemplate",void 0),i([n({type:String,clonable:!1,readOnly:!0,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],l.prototype,"id",void 0),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"geometryType",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"type",void 0),i([n(F(j(se)))],l.prototype,"labelsVisible",void 0),i([n({type:[ne],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:ae},write:{ignoreOrigin:!0}}})],l.prototype,"labelingInfo",void 0),i([n({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],l.prototype,"layerType",void 0),i([n(F(j(oe)))],l.prototype,"legendEnabled",void 0),i([n({type:["show","hide"]})],l.prototype,"listMode",void 0),i([n((()=>{const e=j(le);return e.json.origins.service.read=!1,F(e)})())],l.prototype,"minScale",void 0),i([n((()=>{const e=j(ue);return e.json.origins.service.read=!1,F(e)})())],l.prototype,"maxScale",void 0),i([n({readOnly:!0})],l.prototype,"effectiveScaleRange",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"objectIdField",null),i([n({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],l.prototype,"opacity",void 0),i([n({clonable:!1})],l.prototype,"parent",void 0),i([n(F(j(pe)))],l.prototype,"popupEnabled",void 0),i([n({type:de,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],l.prototype,"popupTemplate",void 0),i([n({readOnly:!0})],l.prototype,"defaultPopupTemplate",null),i([n({types:J,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],l.prototype,"renderer",null),i([I("service","renderer",["drawingInfo.renderer","subtypeField","type"])],l.prototype,"readRendererFromService",null),i([I("renderer",["layerDefinition.drawingInfo.renderer"])],l.prototype,"readRenderer",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"spatialReference",null),i([n({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],l.prototype,"subtypeCode",void 0),i([n({type:[B],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],l.prototype,"templates",void 0),i([I("service","templates",["geometryType","subtypeField","subtypes","type"])],l.prototype,"readTemplatesFromService",null),i([n({type:String,json:{write:{ignoreOrigin:!0}}})],l.prototype,"title",void 0),i([I("service","title",["subtypes"])],l.prototype,"readTitleFromService",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"url",null),i([n({readOnly:!0})],l.prototype,"userHasUpdateItemPrivileges",null),i([n({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],l.prototype,"visible",void 0),l=i([Q(K)],l);const V=(e,t,r)=>{const s=new RegExp(`${t}\\s*=\\s*\\d+`),a=`${t}=${r}`,o=e??"";return s.test(o)?o.replace(s,a):L(a,o)},v=e=>new b(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),T=l,h="SubtypeGroupLayer",dt="esri.layers.SubtypeGroupLayer";function R(e,t){return new b("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}const C=U();let p=class extends it(ve(we(je(Se(Fe(Ie($e(Oe(D(tt(Ee(k(et))))))))))))){constructor(...e){super(...e),this._sublayersCollectionChanged=!1,this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(_.ofType(T)),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this._debouncedSaveOperations=Te(async(t,r,s)=>{const{save:a,saveAs:o}=await x(()=>import("./featureLayerUtils-m5wDrekx.js"),__vite__mapDeps([0,1,2,3,4,5,6]));switch(t){case E.SAVE:return a(this,r);case E.SAVE_AS:return o(this,s,r)}}),this.addHandles(Ce(()=>this.sublayers,(t,r)=>this._handleSublayersChange(t,r),_e))}destroy(){var e;(e=this.source)==null||e.destroy()}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}load(e){const t=e!=null?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(Ae).then(async()=>{if(!this.url)throw new b("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(this.layerId==null)throw new b("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(t))}).then(()=>Le(this,"load",e));return this.addResolvingPromise(r),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&this.capabilities!=null&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return xe(this)}get parsedUrl(){const e=Pe(this.url);return e!=null&&this.layerId!=null&&(e.path=Ge(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?qe(this.url,t):t}async addAttachment(e,t){return Ve(this,e,t,h)}async updateAttachment(e,t,r){return Re(this,e,t,r,h)}async applyEdits(e,t){return De(this,e,t)}on(e,t){return super.on(e,t)}async createGraphicsSource(e){const{default:t}=await ke(x(()=>import("./FeatureLayerSource-hKAUR546.js"),__vite__mapDeps([7,1,2,8,9,10,11,12,13,14,15])),e);return new t({layer:this}).load({signal:e})}createQuery(){const e=N(this),t=this.sublayers.map(r=>r.subtypeCode);return e.where=L(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){return Ne(this,e,t,h)}async fetchRecomputedExtents(e){return Me(this,e,h)}findSublayerForFeature(e){const t=this.fieldsIndex.get(this.subtypeField),r=e.attributes[t.name];return this.findSublayerForSubtypeCode(r)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}loadAll(){return He(this,e=>{e(this.sublayers)})}async queryAttachments(e,t){return Qe(this,e,t,h)}async queryFeatures(e,t){const r=await this.load(),s=H.from(e)??r.createQuery(),a=s.outFields??[];a.includes(this.subtypeField)||(a.push(this.subtypeField),s.outFields=a);const o=await r.source.queryFeatures(s,t);if(o!=null&&o.features)for(const u of o.features)u.layer=u.sourceLayer=this.findSublayerForFeature(u);return o}async queryObjectIds(e,t){return Ue(this,e,t,h)}async queryFeatureCount(e,t){return Be(this,e,t,h)}async queryExtent(e,t){return Je(this,e,t,h)}async queryRelatedFeatures(e,t){return ze(this,e,t,h)}async queryRelatedFeaturesCount(e,t){return Ke(this,e,t,h)}async save(e){return this._debouncedSaveOperations(E.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(E.SAVE_AS,t,e)}write(e,t){var o;const{origin:r,layerContainerType:s,messages:a}=t;if(this.isTable){if(r==="web-scene"||r==="web-map"&&s!=="tables")return a==null||a.push(R(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&r==="web-map"&&s==="tables")return a==null||a.push(R(this,"using a non-table source cannot be written to tables in web maps")),null;return(o=this.sublayers)!=null&&o.length?super.write(e,t):(a==null||a.push(new b("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&st(this,e)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}async _initLayerProperties(e){var r;this._set("source",e);const{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})),this.isTable)throw new b("subtype-grouplayer:unsupported-source","SubtypeGroupLayer cannot be created using a layer with table source");if(!((r=this.subtypes)!=null&&r.length))throw new b("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),Ze(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return We(this)}_verifyFields(){var t,r;const e=((t=this.parsedUrl)==null?void 0:t.path)??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||e.search(/\/FeatureServer\//i)!==-1||(r=this.fields)!=null&&r.some(s=>s.type==="geometry")||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,t){t&&(t.forEach(r=>{r.parent=null}),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach(r=>{r.parent=this,this._sublayerLookup.set(r.subtypeCode,r)}),this._sublayersCollectionChanged=!1,this.addHandles([e.on("after-add",({item:r})=>{r.parent=this,this._sublayerLookup.set(r.subtypeCode,r)}),e.on("after-remove",({item:r})=>{r.parent=null,this._sublayerLookup.delete(r.subtypeCode)}),e.on("after-changes",()=>{this._sublayersCollectionChanged=!0})],"sublayers-owner"))}};i([n({readOnly:!0})],p.prototype,"createQueryVersion",null),i([n({readOnly:!0})],p.prototype,"editingEnabled",null),i([n({readOnly:!0})],p.prototype,"effectiveEditingEnabled",null),i([n({...C.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],p.prototype,"fields",void 0),i([n(C.fieldsIndex)],p.prototype,"fieldsIndex",void 0),i([n(Xe)],p.prototype,"id",void 0),i([n({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],p.prototype,"listMode",void 0),i([n({value:"SubtypeGroupLayer",type:["SubtypeGroupLayer"],json:{origins:{"portal-item":{name:"layerType",write:{enabled:!0,ignoreOrigin:!0}}}}})],p.prototype,"operationalLayerType",void 0),i([n(C.outFields)],p.prototype,"outFields",void 0),i([n({readOnly:!0})],p.prototype,"parsedUrl",null),i([n({clonable:!1})],p.prototype,"source",null),i([n({type:_.ofType(T),json:{origins:{service:{read:{source:"subtypes",reader:(e,t,r)=>{const s=e.map(({code:a})=>{const o=new T({subtypeCode:a});return o.read(t,r),o});return new(_.ofType(T))(s)}}}},name:"layers",write:{overridePolicy(e,t,r){const s=this.originOf("sublayers"),a=M.PORTAL_ITEM;let o=!0;if(P(s)===a&&P(r.origin)>a){const u=e.some(y=>y.hasUserOverrides());o=this._sublayersCollectionChanged||u}return{enabled:o,ignoreOrigin:!0}}}}})],p.prototype,"sublayers",void 0),i([n({type:Ye})],p.prototype,"timeInfo",void 0),i([n({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],p.prototype,"title",void 0),i([I("service","title",["name"])],p.prototype,"readTitleFromService",null),i([n({json:{read:!1}})],p.prototype,"type",void 0),p=i([Q(dt)],p);const mt=p;export{mt as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/featureLayerUtils-m5wDrekx.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/utils-YxtTVBu2.js","assets/jsonContext-EgdQULbU.js","assets/fetchService-cGWNcQnc.js","assets/requestPresets-f6ZAWLqV.js","assets/FeatureLayerSource-hKAUR546.js","assets/External-Pb5poJ0S.js","assets/editingSupport-HfkJiqt7.js","assets/clientSideDefaults-63pOkJ4Y.js","assets/QueryEngineCapabilities-PzVpW5yD.js","assets/QueryTask-Di0fqnMV.js","assets/executeForIds-PXSIkRGk.js","assets/executeQueryPBF-P21isUTI.js","assets/editsZScale-4-dTv58d.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/SubtypeGroupLayer-xK5RtU9X.js b/dist/assets/SubtypeGroupLayer-xK5RtU9X.js deleted file mode 100644 index ce6e4e4..0000000 --- a/dist/assets/SubtypeGroupLayer-xK5RtU9X.js +++ /dev/null @@ -1,7 +0,0 @@ -import{jf as W,dP as R,dq as k,m as X,bI as j,dD as Y,Z as ee,iF as te,jg as A,E as b,il as re,jh as N,ji as L,ep as M,ca as Q,e as i,y as n,du as ie,iI as se,iJ as ne,iK as ae,dV as oe,je as le,jd as ue,iu as pe,iv as de,dt as I,c as U,jj as ye,jk as ce,jl as he,ix as H,jm as be,jn as fe,jo as me,ij as ge,jp as ve,dK as we,el as je,dO as Se,dL as Fe,em as Ie,dM as Oe,dN as $e,en as Ee,V as _,ah as Te,d as Ce,C as _e,dQ as Ae,jq as Le,jr as xe,bV as Pe,h6 as Ge,js as Ve,jt as qe,ju as De,jv as Re,gG as ke,de as x,jw as Ne,jx as Me,ew as Qe,jy as Ue,jz as He,jA as Be,jB as Je,jC as ze,jD as Ke,jc as E,iG as Ze,jE as We,dU as Xe,eo as P,jF as Ye,c7 as et}from"./index-J0iiHjMT.js";import{o as tt}from"./CustomParametersMixin-Y1bOcayO.js";import{y as rt,D as it}from"./FeatureLayerBase-jpFp8gE3.js";import{p as B}from"./FeatureTemplate-kUgbbA00.js";import{e as st}from"./versionUtils-4v9zIDlv.js";import"./serviceCapabilitiesUtils-26KpT1VN.js";const nt=["charts","editingEnabled","formTemplate","labelsVisible","labelingInfo","legendEnabled","minScale","maxScale","opacity","popupEnabled","popupTemplate","renderer","subtypeCode","templates","title","visible"],J={key:"type",base:ye,errorContext:"renderer",typeMap:{simple:A,"unique-value":ce,"class-breaks":he}},G=H(),V=W({types:J});let at=0;function F(e){const t=e.json.write;return typeof t=="object"?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function ot(e){return new A({symbol:lt(e)})}function lt(e){switch(e){case"point":case"multipoint":return me.clone();case"polyline":return fe.clone();case"polygon":case"multipatch":return be.clone();default:return null}}function ut(e,t){return!!t&&(e==null?void 0:e.type)==="unique-value"&&typeof e.field=="string"&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression}function z(e,t){var r;return e==null?null:(r=t.subtypes)==null?void 0:r.find(s=>s.code===e)}function pt(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const s={},a=z(e,t);if(a!=null){const{defaultValues:o}=a;for(const u in o)s[u]=o[u]}return s[t.subtypeField]=e,new B({name:"New Feature",drawingTool:r,prototype:{attributes:s}})}const K="esri.layers.support.SubtypeSublayer";let l=class extends R(k(X(ge))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${at++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}get capabilities(){var e;return(e=this.parent)==null?void 0:e.capabilities}get effectiveCapabilities(){var e;return(e=this.parent)==null?void 0:e.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){var e;return(e=this.parent)==null?void 0:e.elevationInfo}writeFieldOverrides(e,t,r){const{fields:s,parent:a}=this;let o;if(s){o=[];let u=0;s.forEach(({name:y,alias:c,editable:m,visible:g})=>{var O;if(!g)return;const d=(O=a==null?void 0:a.fields)==null?void 0:O.find(S=>S.name===y);if(!d)return;const f={name:y};let w=!1;c!==d.alias&&(f.alias=c,w=!0),m!==d.editable&&(f.editable=m,w=!0),o.push(f),w&&u++}),u===0&&o.length===s.length&&(o=null)}else o=j(e);o!=null&&o.length&&Y(r,o,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,s=e==null?void 0:e.fields;if(!e||!(s!=null&&s.length))return null;const{subtypes:a,subtypeField:o}=e,u=a==null?void 0:a.find(g=>g.code===r),y=u==null?void 0:u.defaultValues,c=u==null?void 0:u.domains,m=[];for(const g of s){const d=g.clone(),{name:f}=d,w=t==null?void 0:t.find($=>$.name===f);if(d.visible=!t||!!w,w){const{alias:$,editable:Z}=w;$&&(d.alias=$),Z===!1&&(d.editable=!1)}const O=(y==null?void 0:y[f])??null;d.defaultValue=f===o?r:O;const S=(c==null?void 0:c[f])??null;d.domain=f===o?null:S?S.type==="inherited"?d.domain:S.clone():null,m.push(d)}return m}get floorInfo(){var e;return(e=this.parent)==null?void 0:e.floorInfo}get geometryType(){var e;return(e=this.parent)==null?void 0:e.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){var e;return this.parent||ee.getLogger(K).error(v("objectIdField")),(e=this.parent)==null?void 0:e.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){te(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&e.geometryType!=="mesh"?ot(e.geometryType):null}readRendererFromService(e,t,r){var y,c,m;if(t.type==="Table")return null;const s=(y=t.drawingInfo)==null?void 0:y.renderer,a=V(s,t,r);let o;const{subtypeCode:u}=this;if(u!=null&&ut(a,t.subtypeField)){const g=(c=a.uniqueValueInfos)==null?void 0:c.find(({value:d})=>(d=typeof d=="number"?String(d):d)===String(u));g&&(o=new A({symbol:g.symbol}))}else(a==null?void 0:a.type)!=="simple"||(m=a.visualVariables)!=null&&m.length||(o=a);return o}readRenderer(e,t,r){var o,u,y;const s=(u=(o=t==null?void 0:t.layerDefinition)==null?void 0:o.drawingInfo)==null?void 0:u.renderer;return s?((y=s.visualVariables)==null?void 0:y.some(c=>c.type!=="rotationInfo"))?void 0:V(s,t,r)||void 0:void 0}get spatialReference(){var e;return(e=this.parent)==null?void 0:e.spatialReference}readTemplatesFromService(e,t){return[pt(this.subtypeCode,t)]}readTitleFromService(e,t){const r=z(this.subtypeCode,t);return r!=null?r.name:null}get url(){var e;return(e=this.parent)==null?void 0:e.url}get userHasUpdateItemPrivileges(){var e;return!!((e=this.parent)!=null&&e.userHasUpdateItemPrivileges)}async addAttachment(e,t){const{parent:r}=this;if(!r)throw v("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new b("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:s}=this;if(!s)throw v("updateAttachment");if(e.getAttribute(s.subtypeField)!==this.subtypeCode)throw new b("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return s.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw v("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new b("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw v("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:s,title:a}=this;if(r){const{displayField:o,editFieldsInfo:u,objectIdField:y}=r;t={displayField:o,editFieldsInfo:u,fields:s,objectIdField:y,title:a}}return re(t,e)}createQuery(){if(!this.parent)throw v("createQuery");const e=N(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=L(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e){return this._getLayerDomain(e)}hasUserOverrides(){return nt.some(e=>this.originIdOf(e)===M.USER)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw v("queryAttachments");const s=e.clone();return s.where=q(s.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw v("queryFeatures");const s=Q.from(e)??r.createQuery();return e!=null&&(s.where=q(s.where,r.parent.subtypeField,r.subtypeCode)),r.parent.queryFeatures(s,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};i([n({readOnly:!0,json:{read:!1}})],l.prototype,"capabilities",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"effectiveCapabilities",null),i([n({json:{write:{ignoreOrigin:!0}}})],l.prototype,"charts",void 0),i([n({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],l.prototype,"editingEnabled",void 0),i([n({type:Boolean,readOnly:!0})],l.prototype,"effectiveEditingEnabled",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"elevationInfo",null),i([n({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],l.prototype,"fieldOverrides",void 0),i([ie("fieldOverrides")],l.prototype,"writeFieldOverrides",null),i([n({...G.fields,readOnly:!0,json:{read:!1}})],l.prototype,"fields",null),i([n(G.fieldsIndex)],l.prototype,"fieldsIndex",void 0),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"floorInfo",null),i([n({type:rt,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],l.prototype,"formTemplate",void 0),i([n({type:String,clonable:!1,readOnly:!0,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],l.prototype,"id",void 0),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"geometryType",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"type",void 0),i([n(F(j(se)))],l.prototype,"labelsVisible",void 0),i([n({type:[ne],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:ae},write:{ignoreOrigin:!0}}})],l.prototype,"labelingInfo",void 0),i([n({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],l.prototype,"layerType",void 0),i([n(F(j(oe)))],l.prototype,"legendEnabled",void 0),i([n({type:["show","hide"]})],l.prototype,"listMode",void 0),i([n((()=>{const e=j(le);return e.json.origins.service.read=!1,F(e)})())],l.prototype,"minScale",void 0),i([n((()=>{const e=j(ue);return e.json.origins.service.read=!1,F(e)})())],l.prototype,"maxScale",void 0),i([n({readOnly:!0})],l.prototype,"effectiveScaleRange",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"objectIdField",null),i([n({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],l.prototype,"opacity",void 0),i([n({clonable:!1})],l.prototype,"parent",void 0),i([n(F(j(pe)))],l.prototype,"popupEnabled",void 0),i([n({type:de,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],l.prototype,"popupTemplate",void 0),i([n({readOnly:!0})],l.prototype,"defaultPopupTemplate",null),i([n({types:J,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],l.prototype,"renderer",null),i([I("service","renderer",["drawingInfo.renderer","subtypeField","type"])],l.prototype,"readRendererFromService",null),i([I("renderer",["layerDefinition.drawingInfo.renderer"])],l.prototype,"readRenderer",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"spatialReference",null),i([n({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],l.prototype,"subtypeCode",void 0),i([n({type:[B],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],l.prototype,"templates",void 0),i([I("service","templates",["geometryType","subtypeField","subtypes","type"])],l.prototype,"readTemplatesFromService",null),i([n({type:String,json:{write:{ignoreOrigin:!0}}})],l.prototype,"title",void 0),i([I("service","title",["subtypes"])],l.prototype,"readTitleFromService",null),i([n({readOnly:!0,json:{read:!1}})],l.prototype,"url",null),i([n({readOnly:!0})],l.prototype,"userHasUpdateItemPrivileges",null),i([n({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],l.prototype,"visible",void 0),l=i([U(K)],l);const q=(e,t,r)=>{const s=new RegExp(`${t}\\s*=\\s*\\d+`),a=`${t}=${r}`,o=e??"";return s.test(o)?o.replace(s,a):L(a,o)},v=e=>new b(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),T=l,h="SubtypeGroupLayer",dt="esri.layers.SubtypeGroupLayer";function D(e,t){return new b("layer:unsupported",`Layer (${e.title}, ${e.id}) of type '${e.declaredClass}' ${t}`,{layer:e})}const C=H();let p=class extends it(ve(we(je(Se(Fe(Ie(Oe($e(R(tt(Ee(k(et))))))))))))){constructor(...e){super(...e),this._sublayersCollectionChanged=!1,this._sublayerLookup=new Map,this.fields=null,this.fieldsIndex=null,this.outFields=null,this.sublayers=new(_.ofType(T)),this.timeInfo=null,this.title="Layer",this.type="subtype-group",this._debouncedSaveOperations=Te(async(t,r,s)=>{const{save:a,saveAs:o}=await x(()=>import("./featureLayerUtils-o55B7eEP.js"),__vite__mapDeps([0,1,2,3,4,5,6]));switch(t){case E.SAVE:return a(this,r);case E.SAVE_AS:return o(this,s,r)}}),this.addHandles(Ce(()=>this.sublayers,(t,r)=>this._handleSublayersChange(t,r),_e))}destroy(){var e;(e=this.source)==null||e.destroy()}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}load(e){const t=e!=null?e.signal:null,r=this.loadFromPortal({supportedTypes:["Feature Service"]},e).catch(Ae).then(async()=>{if(!this.url)throw new b("subtype-grouplayer:missing-url-or-source","SubtypeGroupLayer must be created with either a url or a portal item");if(this.layerId==null)throw new b("subtype-grouplayer:missing-layerid","layerId is required for a SubtypeGroupLayer created with url");return this._initLayerProperties(await this.createGraphicsSource(t))}).then(()=>Le(this,"load",e));return this.addResolvingPromise(r),Promise.resolve(this)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return this.loaded&&this.capabilities!=null&&this.capabilities.operations.supportsEditing&&this.userHasEditingPrivileges}get effectiveEditingEnabled(){return xe(this)}get parsedUrl(){const e=Pe(this.url);return e!=null&&this.layerId!=null&&(e.path=Ge(e.path,this.layerId.toString())),e}set source(e){this._get("source")!==e&&this._set("source",e)}readTitleFromService(e,{name:t}){return this.url?Ve(this.url,t):t}async addAttachment(e,t){return qe(this,e,t,h)}async updateAttachment(e,t,r){return De(this,e,t,r,h)}async applyEdits(e,t){return Re(this,e,t)}on(e,t){return super.on(e,t)}async createGraphicsSource(e){const{default:t}=await ke(x(()=>import("./FeatureLayerSource-AZE5JEq3.js"),__vite__mapDeps([7,1,2,8,9,10,11,12,13,14,15,16,17,18,19,20,21])),e);return new t({layer:this}).load({signal:e})}createQuery(){const e=N(this),t=this.sublayers.map(r=>r.subtypeCode);return e.where=L(`${this.subtypeField} IN (${t.join(",")})`,this.definitionExpression),e}async deleteAttachments(e,t){return Ne(this,e,t,h)}async fetchRecomputedExtents(e){return Me(this,e,h)}findSublayerForFeature(e){const t=this.fieldsIndex.get(this.subtypeField),r=e.attributes[t.name];return this.findSublayerForSubtypeCode(r)}findSublayerForSubtypeCode(e){return this._sublayerLookup.get(e)}getFieldDomain(e,t){return this._getLayerDomain(e)}getField(e){return this.fieldsIndex.get(e)}loadAll(){return Qe(this,e=>{e(this.sublayers)})}async queryAttachments(e,t){return Ue(this,e,t,h)}async queryFeatures(e,t){const r=await this.load(),s=Q.from(e)??r.createQuery(),a=s.outFields??[];a.includes(this.subtypeField)||(a.push(this.subtypeField),s.outFields=a);const o=await r.source.queryFeatures(s,t);if(o!=null&&o.features)for(const u of o.features)u.layer=u.sourceLayer=this.findSublayerForFeature(u);return o}async queryObjectIds(e,t){return He(this,e,t,h)}async queryFeatureCount(e,t){return Be(this,e,t,h)}async queryExtent(e,t){return Je(this,e,t,h)}async queryRelatedFeatures(e,t){return ze(this,e,t,h)}async queryRelatedFeaturesCount(e,t){return Ke(this,e,t,h)}async save(e){return this._debouncedSaveOperations(E.SAVE,e)}async saveAs(e,t){return this._debouncedSaveOperations(E.SAVE_AS,t,e)}write(e,t){var o;const{origin:r,layerContainerType:s,messages:a}=t;if(this.isTable){if(r==="web-scene"||r==="web-map"&&s!=="tables")return a==null||a.push(D(this,"using a table source cannot be written to web scenes and web maps")),null}else if(this.loaded&&r==="web-map"&&s==="tables")return a==null||a.push(D(this,"using a non-table source cannot be written to tables in web maps")),null;return(o=this.sublayers)!=null&&o.length?super.write(e,t):(a==null||a.push(new b("web-document-write:invalid-property",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' has invalid value for 'sublayers' property. 'sublayers' collection should contain at least one sublayer`,{layer:this})),null)}serviceSupportsSpatialReference(e){return!!this.loaded&&st(this,e)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}async _initLayerProperties(e){var r;this._set("source",e);const{sourceJSON:t}=e;if(t&&(this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})),this.isTable)throw new b("subtype-grouplayer:unsupported-source","SubtypeGroupLayer cannot be created using a layer with table source");if(!((r=this.subtypes)!=null&&r.length))throw new b("subtype-grouplayer:missing-subtypes","SubtypeGroupLayer must be created using a layer with subtypes");this._verifyFields(),Ze(this.timeInfo,this.fieldsIndex)}async hasDataChanged(){return We(this)}_verifyFields(){var t,r;const e=((t=this.parsedUrl)==null?void 0:t.path)??"undefined";this.objectIdField||console.log("SubtypeGroupLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||e.search(/\/FeatureServer\//i)!==-1||(r=this.fields)!=null&&r.some(s=>s.type==="geometry")||console.log("SubtypeGroupLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_handleSublayersChange(e,t){t&&(t.forEach(r=>{r.parent=null}),this.removeHandles("sublayers-owner"),this._sublayerLookup.clear()),e&&(e.forEach(r=>{r.parent=this,this._sublayerLookup.set(r.subtypeCode,r)}),this._sublayersCollectionChanged=!1,this.addHandles([e.on("after-add",({item:r})=>{r.parent=this,this._sublayerLookup.set(r.subtypeCode,r)}),e.on("after-remove",({item:r})=>{r.parent=null,this._sublayerLookup.delete(r.subtypeCode)}),e.on("after-changes",()=>{this._sublayersCollectionChanged=!0})],"sublayers-owner"))}};i([n({readOnly:!0})],p.prototype,"createQueryVersion",null),i([n({readOnly:!0})],p.prototype,"editingEnabled",null),i([n({readOnly:!0})],p.prototype,"effectiveEditingEnabled",null),i([n({...C.fields,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],p.prototype,"fields",void 0),i([n(C.fieldsIndex)],p.prototype,"fieldsIndex",void 0),i([n(Xe)],p.prototype,"id",void 0),i([n({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],p.prototype,"listMode",void 0),i([n({value:"SubtypeGroupLayer",type:["SubtypeGroupLayer"],json:{origins:{"portal-item":{name:"layerType",write:{enabled:!0,ignoreOrigin:!0}}}}})],p.prototype,"operationalLayerType",void 0),i([n(C.outFields)],p.prototype,"outFields",void 0),i([n({readOnly:!0})],p.prototype,"parsedUrl",null),i([n({clonable:!1})],p.prototype,"source",null),i([n({type:_.ofType(T),json:{origins:{service:{read:{source:"subtypes",reader:(e,t,r)=>{const s=e.map(({code:a})=>{const o=new T({subtypeCode:a});return o.read(t,r),o});return new(_.ofType(T))(s)}}}},name:"layers",write:{overridePolicy(e,t,r){const s=this.originOf("sublayers"),a=M.PORTAL_ITEM;let o=!0;if(P(s)===a&&P(r.origin)>a){const u=e.some(y=>y.hasUserOverrides());o=this._sublayersCollectionChanged||u}return{enabled:o,ignoreOrigin:!0}}}}})],p.prototype,"sublayers",void 0),i([n({type:Ye})],p.prototype,"timeInfo",void 0),i([n({json:{origins:{"portal-item":{write:{enabled:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}}}}})],p.prototype,"title",void 0),i([I("service","title",["name"])],p.prototype,"readTitleFromService",null),i([n({json:{read:!1}})],p.prototype,"type",void 0),p=i([U(dt)],p);const gt=p;export{gt as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/featureLayerUtils-o55B7eEP.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/utils-rBsg-VY8.js","assets/jsonContext-cWV_-jAj.js","assets/fetchService-wPWKuma6.js","assets/requestPresets-18nzHK5y.js","assets/FeatureLayerSource-AZE5JEq3.js","assets/External-GV0jSEES.js","assets/editingSupport-EiPa9PKq.js","assets/clientSideDefaults-F-CNnR0g.js","assets/QueryEngineCapabilities-PzVpW5yD.js","assets/QueryTask-91TvtrTt.js","assets/executeForIds-wXO8-pll.js","assets/query-rG0aX6cE.js","assets/pbfQueryUtils-pWizwTQZ.js","assets/pbf-o0zzptPp.js","assets/queryZScale-IaMm02_2.js","assets/executeQueryJSON-ACj9qY0y.js","assets/FeatureSet-d4S1oKME.js","assets/executeQueryPBF-vdaOUMid.js","assets/editsZScale-Wgw9kbYG.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/SymbolProcessor-dUsJwb8f.js b/dist/assets/SymbolProcessor-dUsJwb8f.js new file mode 100644 index 0000000..64933af --- /dev/null +++ b/dist/assets/SymbolProcessor-dUsJwb8f.js @@ -0,0 +1,7 @@ +import{v9 as Ki,v8 as Mt,wH as Q,wI as ee,wJ as me,wK as Xe,gL as v,hJ as et,wL as gt,wM as Xt,wN as pe,pn as Ir,r as bt,l9 as Pr,wO as K,R as St,bE as Gi,wP as $r,wQ as Bt,eV as Cr,ks as He,mm as Ft,wR as L,ag as Er,de as ke,wS as Ye,wT as qe,wU as je,ac as Ae,ad as Qe,gr as Wr,dY as Vr,vs as kr,wV as Ar,e as Rr,c as Br,aF as Fr,vr as Je,ab as Lt,d2 as Or,j3 as Dr}from"./index-pCX-0tJH.js";import{c as Kr,i as Zi,g as Gr,f as Zr,s as Nr,h as Ni,k as Ui,m as ye,o as Ur,p as Xr,q as Hr,V as Yr,j as qr}from"./cimAnalyzer-X6MTpVAO.js";import{f as jr,R as xe,k as Qr,G as Jr,p as Xi}from"./Pipeline-PlEwhMAg.js";import{E as b,S as A,L as G,A as Ot}from"./enums-uQoFEhYh.js";import{d as ge,f as ts,c as ut,w as es,b as Hi,m as E,q as is,g as k,h as rs,n as Yi,l as qi,p as it,i as ss,x as ji,j as Qi,$ as ns,k as as,o as Ji,s as ie,u as tr,v as er,y as tt,z as W,A as Ht,B as Yt}from"./definitions-SVBNHUSH.js";import{o as os,p as hs}from"./BaseProcessor-yc_MfkjR.js";import{r as ls,c as cs,i as ti}from"./TurboLine-cWldrV9L.js";import{x as P,w as M}from"./number-sTjsTbdA.js";import{a as re}from"./labelPoint-1MOq4I_J.js";import{t as us}from"./Rect-bBBxMtVp.js";import{c as ve}from"./GeometryUtils-K2DOc0l8.js";import{e as ir,t as rr}from"./TileClipper-NSFZXMR1.js";function $(s){if(!s)return 0;const{r:t,g:e,b:i,a:r}=s;return P(t*r,e*r,i*r,255*r)}function O(s){if(!s)return 0;const[t,e,i,r]=s;return P(t*(r/255),e*(r/255),i*(r/255),r)}let zt=class Me{constructor(t,e,i,r){this.center=Ki(t,e),this.centerT=Mt(),this.halfWidth=i/2,this.halfHeight=r/2,this.width=i,this.height=r}get x(){return this.center[0]}get y(){return this.center[1]}get blX(){return this.center[0]+this.halfWidth}get blY(){return this.center[1]+this.halfHeight}get trX(){return this.center[0]-this.halfWidth}get trY(){return this.center[1]-this.halfHeight}get xmin(){return this.x-this.halfWidth}get xmax(){return this.x+this.halfWidth}get ymin(){return this.y-this.halfHeight}get ymax(){return this.y+this.halfHeight}set x(t){this.center[0]=t}set y(t){this.center[1]=t}clone(){return new Me(this.x,this.y,this.width,this.height)}serialize(t){return t.writeF32(this.center[0]),t.writeF32(this.center[1]),t.push(this.width),t.push(this.height),t}findCollisionDelta(t,e=4){const i=Math.abs(t.centerT[0]-this.centerT[0]),r=Math.abs(t.centerT[1]-this.centerT[1]),n=(t.halfWidth+this.halfWidth+e)/i,a=(t.halfHeight+this.halfHeight+e)/r,o=Math.min(n,a);return Math.log2(o)}extend(t){const e=Math.min(this.xmin,t.xmin),i=Math.min(this.ymin,t.ymin),r=Math.max(this.xmax,t.xmax)-e,n=Math.max(this.ymax,t.ymax)-i,a=e+r/2,o=i+n/2;this.width=r,this.height=n,this.halfWidth=r/2,this.halfHeight=n/2,this.x=a,this.y=o}static deserialize(t){const e=t.readF32(),i=t.readF32(),r=t.readInt32(),n=t.readInt32();return new Me(e,i,r,n)}};const Re=26,sr=4,ds=Re+sr,fs=Re-6,ei=3,V=8,_s=Math.PI/180,ms=8,ii=1.5;let nr=class{constructor(t,e,i,r){this._rotationT=Q(),this._xBounds=0,this._yBounds=0,this.minZoom=0,this.maxZoom=255,this._bounds=null;const n=i.rect,a=new Float32Array(8);t*=r,e*=r;const o=i.code?n.width*r:i.metrics.width,h=i.code?n.height*r:i.metrics.height;this.width=o,this.height=h,a[0]=t,a[1]=e,a[2]=t+o,a[3]=e,a[4]=t,a[5]=e+h,a[6]=t+o,a[7]=e+h,this._data=a,this._setTextureCoords(n),this._scale=r,this._mosaic=i,this.x=t,this.y=e,this.maxOffset=Math.max(t+o,e+h)}get mosaic(){return this._mosaic}set angle(t){this._angle=t,ee(this._rotationT,-t),this._setOffsets(this._data)}get angle(){return this._angle}get xTopLeft(){return this._data[0]}get yTopLeft(){return this._data[1]}get xBottomRight(){return this._data[6]}get yBottomRight(){return this._data[7]}get texcoords(){return this._texcoords}get textureBinding(){return this._mosaic.textureBinding}get offsets(){return this._offsets||this._setOffsets(this._data),this._offsets}get char(){return String.fromCharCode(this._mosaic.code)}get code(){return this._mosaic.code}get bounds(){if(!this._bounds){const{height:t,width:e}=this._mosaic.metrics,i=e*this._scale,r=Math.abs(t)*this._scale,n=new Float32Array(8);n[0]=this.x,n[1]=this.y,n[2]=this.x+i,n[3]=this.y,n[4]=this.x,n[5]=this.y+r,n[6]=this.x+i,n[7]=this.y+r;const a=me(Q(),this._rotationT,this._transform);Xe(n,n,a);let o=1/0,h=1/0,l=0,u=0;for(let m=0;m<4;m++){const p=n[2*m],y=n[2*m+1];o=Math.min(o,p),h=Math.min(h,y),l=Math.max(l,p),u=Math.max(u,y)}const c=l-o,f=u-h,d=o+c/2,_=h+f/2;this._bounds=new zt(d,_,c,f)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}_setOffsets(t){this._offsets||(this._offsets={upperLeft:0,upperRight:0,lowerLeft:0,lowerRight:0});const e=this._offsets,i=new Float32Array(8),r=me(Q(),this._rotationT,this._transform);Xe(i,t,r),e.upperLeft=M(i[0]*V,i[1]*V),e.upperRight=M(i[2]*V,i[3]*V),e.lowerLeft=M(i[4]*V,i[5]*V),e.lowerRight=M(i[6]*V,i[7]*V)}_setTextureCoords({x:t,y:e,width:i,height:r}){this._texcoords={upperLeft:M(t,e),upperRight:M(t+i,e),lowerLeft:M(t,e+r),lowerRight:M(t+i,e+r)}}};const ps=(s,t)=>({code:0,page:0,sdf:!0,rect:new us(0,0,11,8),textureBinding:t,metrics:{advance:0,height:4,width:s,left:0,top:0}});function Tt(s,t){return s.forEach(e=>gt(e,e,t)),{upperLeft:M(V*s[0][0],V*s[0][1]),upperRight:M(V*s[1][0],V*s[1][1]),lowerLeft:M(V*s[2][0],V*s[2][1]),lowerRight:M(V*s[3][0],V*s[3][1])}}let ys=class{constructor(t,e,i){this._rotation=0,this._decorate(t,e,i),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=e.length>1,this._hasRotation=i.angle!==0,this._transform=this._createGlyphTransform(this.bounds,i),this._borderLineSize=i.borderLineSize,(i.borderLineSize||i.hasBackground)&&([this.bounds,this.background]=this.shapeBackground(this._transform));for(const r of t)r.setTransform(this._transform)}setRotation(t){if(t===0&&this._rotation===0)return;this._rotation=t;const e=this._transform,i=ee(Q(),t);me(e,i,e);for(const r of this.glyphs)r.setTransform(this._transform)}_decorate(t,e,i){if(!i.decoration||i.decoration==="none"||!t.length)return;const r=i.scale,n=i.decoration==="underline"?ds:fs,a=t[0].textureBinding;for(const o of e){const h=o.startX*r,l=o.startY*r,u=(o.width+o.glyphWidthEnd)*r;t.push(new nr(h,l+n*r,ps(u,a),1))}}shapeBackground(t){const e=ms,{xmin:i,ymin:r,xmax:n,ymax:a,x:o,y:h,width:l,height:u}=this.bounds,c=Math.min(l,u)+2*e-ii,f=Math.min(v(this._borderLineSize||0),c),d=(ii+f)/2,_=this._borderLineSize?d:0,m=[i-e,r-e],p=[n+e,r-e],y=[i-e,a+e],x=[n+e,a+e],g=Tt([[m[0]-d,m[1]-d],[p[0]+d,p[1]-d],[m[0]+_,m[1]+_],[p[0]-_,p[1]+_]],t),w=Tt([[y[0]+_,y[1]-_],[x[0]-_,x[1]-_],[y[0]-d,y[1]+d],[x[0]+d,x[1]+d]],t),S=Tt([[m[0]-d,m[1]-d],[m[0]+_,m[1]+_],[y[0]-d,y[1]+d],[y[0]+_,y[1]-_]],t),T=Tt([[p[0]-_,p[1]+_],[p[0]+d,p[1]-d],[x[0]-_,x[1]-_],[x[0]+d,x[1]+d]],t),z={main:Tt([m,p,y,x],t),top:g,bot:w,left:S,right:T};return[new zt(o,h,l+2*d,u+2*d),z]}get boundsT(){const t=this.bounds,e=et(Mt(),t.x,t.y);if(gt(e,e,this._transform),this._hasRotation){const i=Math.max(t.width,t.height);return new zt(e[0],e[1],i,i)}return new zt(e[0],e[1],t.width,t.height)}_createBounds(t){let e=1/0,i=1/0,r=0,n=0;for(const h of t)e=Math.min(e,h.xTopLeft),i=Math.min(i,h.yTopLeft),r=Math.max(r,h.xBottomRight),n=Math.max(n,h.yBottomRight);const a=r-e,o=n-i;return new zt(e+a/2,i+o/2,a,o)}_createGlyphTransform(t,e){const i=_s*e.angle,r=Q(),n=Mt();return Xt(r,r,et(n,e.xOffset,-e.yOffset)),e.isCIM?pe(r,r,i):(Xt(r,r,et(n,t.x,t.y)),pe(r,r,i),Xt(r,r,et(n,-t.x,-t.y))),r}},Dt=class{constructor(t,e,i,r,n,a){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(e,i)),this.end=Math.max(0,Math.max(e,i)),this.ends===10,ri=s=>s===32;function xs(s,t,e){const i=new Array,r=1/e.scale,n=e.maxLineWidth*r,a=t?s.length-1:0,o=t?-1:s.length,h=t?-1:1;let l=a,u=0,c=0,f=l,d=f,_=0,m=1/0,p=0;for(;l!==o;){const{code:x,metrics:g}=s[l],w=Math.abs(g.top);if(we(x)||ri(x)||(m=Math.min(m,w),p=Math.max(p,w+g.height)),we(x))l!==a&&(i.push(new Dt(s,f,l-h,u,m,p)),m=1/0,p=0),u=0,f=l+h,d=l+h,c=0;else if(ri(x))d=l+h,c=0,_=g.advance,u+=g.advance;else if(u>n){if(d!==f){const S=d-2*h;u-=_,i.push(new Dt(s,f,S,u-c,m,p)),m=1/0,p=0,f=d,u=c}else i.push(new Dt(s,f,l-h,u,m,p)),m=1/0,p=0,f=l,d=l,u=0;u+=g.advance,c+=g.advance}else u+=g.advance,c+=g.advance;l+=h}const y=new Dt(s,f,l-h,u,m,p);return y.start>=0&&y.end=this._buffer.length){const e=this._roundToNearest((this._array.byteLength+t*this._buffer.BYTES_PER_ELEMENT)*ws,this._buffer.BYTES_PER_ELEMENT),i=new ArrayBuffer(e),r=new this._ctor(i);r.set(this._buffer,0),this._array=i,this._buffer=r,this._i16View=new Int16Array(this._array)}}ensureSize(t){this._ensureSize(t)}writeF32(t){this._ensureSize(1);const e=this._pos;return new Float32Array(this._array,4*this._pos,1)[0]=t,this._pos++,e}push(t){this._ensureSize(1);const e=this._pos;return this._buffer[this._pos++]=t,e}writeFixed(t){this._buffer[this._pos++]=t}setValue(t,e){this._buffer[t]=e}i1616Add(t,e,i){this._i16View[2*t]+=e,this._i16View[2*t+1]+=i}getValue(t){return this._buffer[t]}incr(t){if(this._buffer.length{const n=1<=ut-i?oi:hi|oi)|(e<0+r?ci:e>=ut-r?li:ci|li));this._current.overlaps|=n}_getVertexWriter(t){if(!this._data.self.has(t)){const e=this._data.self,i=xe(t,this._symbologyType).geometry;e.set(t,new si(t,i,this.hint.records))}return this._data.self.get(t)}};function Ss(s,t,e){const i=G.SIZE_FIELD_STOPS|G.SIZE_MINMAX_VALUE|G.SIZE_SCALE_STOPS|G.SIZE_UNIT_VALUE,r=(t&(Ot.FIELD_TARGETS_OUTLINE|Ot.MINMAX_TARGETS_OUTLINE|Ot.SCALE_TARGETS_OUTLINE|Ot.UNIT_TARGETS_OUTLINE))>>>4;return s===b.LINE&&e.isOutline||s===b.FILL&&ar(e.symbologyType)?i&r:i&~r}const ui=0,di=8,Ls=7,fi=8,_i=11,mi=11,pi=12,yi=13,xi=14,gi=15,vi=16,Mi=17,wi=18,bi=19,Si=20,Li=21,Ti=26,Ts=Object.keys(A).filter(s=>typeof A[s]=="number").reduce((s,t)=>({...s,[t]:A[t]}),{});function zs(s){return s===A.SIMPLE||s===A.OUTLINE_FILL_SIMPLE}function ar(s){return s===A.OUTLINE_FILL||s===A.OUTLINE_FILL_SIMPLE}function or(s){return zs(s.symbologyType)}function qt(s){return ar(s.symbologyType)}function he(s,t){switch(s){case b.FILL:return H.from(t);case b.LINE:return rt.from(t);case b.MARKER:return dt.from(t);case b.TEXT:return Ct.from(t);case b.LABEL:return ct.from(t);default:throw new Error(`Unable to createMaterialKey for unknown geometryType ${s}`)}}function ha(s){switch(Z.load(s).geometryType){case b.MARKER:return new dt(s);case b.FILL:return new H(s);case b.LINE:return new rt(s);case b.TEXT:return new Ct(s);case b.LABEL:return new ct(s)}}class Z{static load(t){const e=this.shared;return e.data=t,e}constructor(t){this._data=0,this._data=t}set data(t){this._data=t??0}get data(){return this._data}get geometryType(){return this.bits(fi,_i)}set geometryType(t){this.setBits(t,fi,_i)}get mapAligned(){return!!this.bit(Si)}set mapAligned(t){this.setBit(Si,t)}get sdf(){return!!this.bit(mi)}set sdf(t){this.setBit(mi,t??!1)}get pattern(){return!!this.bit(pi)}set pattern(t){this.setBit(pi,t)}get textureBinding(){return this.bits(ui,di)}set textureBinding(t){this.setBits(t,ui,di)}get symbologyType(){return this.bits(Li,Ti)}set symbologyType(t){this.setBits(t,Li,Ti)}get geometryTypeString(){switch(this.geometryType){case b.FILL:return"fill";case b.MARKER:return"marker";case b.LINE:return"line";case b.TEXT:return"text";case b.LABEL:return"label";default:throw new bt(`Unable to handle unknown geometryType: ${this.geometryType}`)}}setBit(t,e){const i=1<>t}setBits(t,e,i){for(let r=e,n=0;rclass extends s{get vvSizeMinMaxValue(){return this.bit(vi)!==0}set vvSizeMinMaxValue(t){this.setBit(vi,t)}get vvSizeScaleStops(){return this.bit(Mi)!==0}set vvSizeScaleStops(t){this.setBit(Mi,t)}get vvSizeFieldStops(){return this.bit(wi)!==0}set vvSizeFieldStops(t){this.setBit(wi,t)}get vvSizeUnitValue(){return this.bit(bi)!==0}set vvSizeUnitValue(t){this.setBit(bi,t)}hasSizeVV(){return this.vvSizeMinMaxValue||this.vvSizeScaleStops||this.vvSizeFieldStops||this.vvSizeUnitValue}hasVV(){return super.hasVV()||this.hasSizeVV()}setVV(t,e){super.setVV(t,e);const i=Ss(this.geometryType,t,e)&t;this.vvSizeMinMaxValue=!!(i&G.SIZE_MINMAX_VALUE),this.vvSizeFieldStops=!!(i&G.SIZE_FIELD_STOPS),this.vvSizeUnitValue=!!(i&G.SIZE_UNIT_VALUE),this.vvSizeScaleStops=!!(i&G.SIZE_SCALE_STOPS)}},hr=s=>class extends s{get vvRotation(){return this.bit(gi)!==0}set vvRotation(t){this.setBit(gi,t)}hasVV(){return super.hasVV()||this.vvRotation}setVV(t,e){super.setVV(t,e),this.vvRotation=!e.isOutline&&!!(t&G.ROTATION)}},le=s=>class extends s{get vvColor(){return this.bit(yi)!==0}set vvColor(t){this.setBit(yi,t)}hasVV(){return super.hasVV()||this.vvColor}setVV(t,e){super.setVV(t,e),this.vvColor=!e.isOutline&&!!(t&G.COLOR)}},ce=s=>class extends s{get vvOpacity(){return this.bit(xi)!==0}set vvOpacity(t){this.setBit(xi,t)}hasVV(){return super.hasVV()||this.vvOpacity}setVV(t,e){super.setVV(t,e),this.vvOpacity=!e.isOutline&&!!(t&G.OPACITY)}};let H=class extends le(ce(At(Z))){static load(t){const e=this.shared;return e.data=t,e}static from(t){const{symbologyType:e,vvFlags:i}=t,r=this.load(0);return r.geometryType=b.FILL,r.symbologyType=e,e!==A.DOT_DENSITY&&r.setVV(i,t),r.data}getVariation(){return{...super.getVariation(),vvColor:this.vvColor,vvOpacity:this.vvOpacity,vvSizeFieldStops:this.vvSizeFieldStops,vvSizeMinMaxValue:this.vvSizeMinMaxValue,vvSizeScaleStops:this.vvSizeScaleStops,vvSizeUnitValue:this.vvSizeUnitValue}}};H.shared=new H(0);class dt extends le(ce(hr(At(Z)))){static load(t){const e=this.shared;return e.data=t,e}static from(t){const{symbologyType:e,vvFlags:i}=t,r=this.load(0);return r.geometryType=b.MARKER,r.symbologyType=e,e!==A.HEATMAP&&r.setVV(i,t),r.data}getVariation(){return{...super.getVariation(),vvColor:this.vvColor,vvRotation:this.vvRotation,vvOpacity:this.vvOpacity,vvSizeFieldStops:this.vvSizeFieldStops,vvSizeMinMaxValue:this.vvSizeMinMaxValue,vvSizeScaleStops:this.vvSizeScaleStops,vvSizeUnitValue:this.vvSizeUnitValue}}}dt.shared=new dt(0);let rt=class extends le(ce(At(Z))){static load(t){const e=this.shared;return e.data=t,e}static from(t){const e=this.load(0);return e.geometryType=b.LINE,e.symbologyType=t.symbologyType,e.setVV(t.vvFlags,t),e.data}getVariation(){return{...super.getVariation(),vvColor:this.vvColor,vvOpacity:this.vvOpacity,vvSizeFieldStops:this.vvSizeFieldStops,vvSizeMinMaxValue:this.vvSizeMinMaxValue,vvSizeScaleStops:this.vvSizeScaleStops,vvSizeUnitValue:this.vvSizeUnitValue}}};rt.shared=new rt(0);let Ct=class extends le(ce(hr(At(Z)))){static load(t){const e=this.shared;return e.data=t,e}static from(t){const e=this.load(0);return e.geometryType=b.TEXT,e.symbologyType=t.symbologyType,e.setVV(t.vvFlags,t),e.data}getVariation(){return{...super.getVariation(),vvColor:this.vvColor,vvOpacity:this.vvOpacity,vvRotation:this.vvRotation,vvSizeFieldStops:this.vvSizeFieldStops,vvSizeMinMaxValue:this.vvSizeMinMaxValue,vvSizeScaleStops:this.vvSizeScaleStops,vvSizeUnitValue:this.vvSizeUnitValue}}};Ct.shared=new Ct(0);let ct=class extends At(Z){static load(t){const e=this.shared;return e.data=t,e}static from(t){const e=this.load(0);return e.geometryType=b.LABEL,e.symbologyType=t.symbologyType,e.setVV(t.vvFlags,t),e.mapAligned=Zi(t.placement),e.data}getVariation(){return{...super.getVariation(),vvSizeFieldStops:this.vvSizeFieldStops,vvSizeMinMaxValue:this.vvSizeMinMaxValue,vvSizeScaleStops:this.vvSizeScaleStops,vvSizeUnitValue:this.vvSizeUnitValue}}};ct.shared=new ct(0);const N=0,U=100;function zi(s,t,e){return s[0]=t[0]-e[0],s[1]=t[1]-e[1],s}function lr(s,t){return Math.sqrt(s*s+t*t)}function Ii(s){const t=lr(s[0],s[1]);s[0]/=t,s[1]/=t}function Is(s,t){return lr(s[0]-t[0],s[1]-t[1])}function be(s=2){return 1/Math.max(s,1)}function at(s,t){return[!!(s!=null&&s.minScale)&&t.scaleToZoom(s.minScale)||N,!!(s!=null&&s.maxScale)&&t.scaleToZoom(s.maxScale)||U]}function Ps(s,t){return s[t+1]}function cr(s){return s.length-1}function $s(s){let t=0;for(let e=0;et._index||this._index===t._index&&this._distance>=t._distance}get _segment(){return this._segments[this._index+1]}get angle(){const t=this.dy,e=(0*t+-1*-this.dx)/(1*this.length);let i=Math.acos(e);return t>0&&(i=2*Math.PI-i),i}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:t,dy:e}=this;return Math.sqrt(t*t+e*e)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1t)return this._seekBackwards(t-r);r+=this.length}return this._distance=0,e?this:null}seek(t,e=!1){if(t<0)return this._seekBackwards(Math.abs(t),e);if(t<=this.remainingLength)return this._distance=(this.backwardLength+t)/this.length,this;let i=this.remainingLength;for(;this.next();){if(i+this.length>t)return this.seek(t-i,e);i+=this.length}return this._distance=1,e?this:null}};function Ws(s,t,e,i=!0){const r=$s(s),n=Es.create(s),a=r/2;if(!i)return n.seek(a),void e(n.clone(),0,a+0*t,r);const o=Math.max((r-t)/2,0),h=Math.floor(o/t),l=a-h*t;n.seek(l);for(let u=-h;u<=h;u++)n.x<512&&n.x>=0&&n.y<512&&n.y>=0&&e(n.clone(),u,a+u*t,r),n.seek(t)}function Vs(s,t){const e=t;for(let i=0;i=0&&!(r[m+1]r[c]+u);m++){const p=u-r[m-1]+r[c],y=r[m]-r[m-1],x=r[m]-r[c]class extends s{constructor(...t){super(...t),this._isCIM=!1,this._vertexBoundsScale=1,this.geometryType=b.TEXT,this._aux=P(0,0,this._referenceSize,this._bitset)}bindTextInfo(t,e){this._shapingInfo=t!=null&&t.length?vs(t,e,{scale:this._scale,angle:this._angle,xOffset:this._xOffset,yOffset:this._yOffset,hAlign:this._xAlignD,vAlign:this._yAlignD,maxLineWidth:Math.max(32,Math.min(this._lineWidth,512)),lineHeight:es*Math.max(.25,Math.min(this._lineHeight,4)),decoration:this._decoration,isCIM:this._isCIM,hasBackground:!!this._backgroundColor,borderLineSize:this._borderLineSize}):null}_write(t,e,i,r){const n=e.getDisplayId();this._writeGeometry(t,e,n,i,r)}_writeGeometry(t,e,i,r,n){const a=this._shapingInfo;if(a==null)return;if(this._textPlacement)return this._writePlacedText(t,i,a,r,e,n);const o=n?n.asOptimized():e.geometryType==="esriGeometryPolygon"?e.readCentroid():e.readGeometryForDisplay();if(o!=null){if(o.isPoint){const[h,l]=o.coords;return!t.hasAggregates&&t.hasPixelBufferEnabled&&(h<0||h>=512||l<0||l>=512)?void 0:this._writeGlyphs(t,i,{x:h,y:l},a)}o.forEachVertex((h,l)=>this._writeGlyphs(t,i,{x:h,y:l},a))}}_writePlacedText(t,e,i,r,n,a){const o=this._textPlacement,h=a||re.fromFeatureSetReaderCIM(n);if(!h)return;const l=-1,u=ur.getPlacement(h,l,o,v(1),t.tileKey,r.geometryEngine);if(!u)return;const c=i.bounds,f=Math.sqrt(c.height*c.height+c.width*c.width);let d,_,m;for(;d=u.next();)if(_=d.tx,m=-d.ty,_+f>=0&&_-f<512&&m+f>=0&&m-f<512){const p=-d.getAngle();i.setRotation(p),this._writeGlyphs(t,e,{x:_,y:m},i),i.setRotation(-p)}}_writeGlyphs(t,e,i,r){const n=Z.load(this._materialKey),a=M(Math.round(mt*i.x),Math.round(mt*i.y)),o=this._vertexBoundsScale,{bounds:h,background:l,glyphs:u}=r;u.length>0&&(this._borderLineColor||this._backgroundColor)&&(n.textureBinding=u[0].textureBinding,t.recordStart(e,n.data,this.geometryType,!0),this._writeBackgroundGeometry(t,e,i,h,l),t.recordEnd());const c=2*Math.max(h.width,h.height);for(const f of r.glyphs)n.textureBinding=f.textureBinding,t.recordStart(e,n.data,this.geometryType,!0),t.vertexBounds(i.x+h.x+this._xOffset,i.y+h.y-this._yOffset,c*o,c*o),this._writeVertices(t,e,a,f),t.recordEnd()}_writeGlyph(t,e,i,r,n){const a=Z.load(this._materialKey),o=M(Math.round(mt*i),Math.round(mt*r));a.textureBinding=n.textureBinding,t.recordStart(e,a.data,this.geometryType,!0);const h=n.bounds,l=this._vertexBoundsScale;t.vertexBounds(i+h.x*l,r+h.y*l,h.width*l,h.height*l),this._writeVertices(t,e,o,n),t.recordEnd()}_writeVertices(t,e,i,r){const n=t.vertexCount();this._writeVertexCommon(t,e,i,r),t.vertexWrite(r.offsets.upperLeft),t.vertexWrite(r.texcoords.upperLeft),t.vertexEnd(),this._writeVertexCommon(t,e,i,r),t.vertexWrite(r.offsets.upperRight),t.vertexWrite(r.texcoords.upperRight),t.vertexEnd(),this._writeVertexCommon(t,e,i,r),t.vertexWrite(r.offsets.lowerLeft),t.vertexWrite(r.texcoords.lowerLeft),t.vertexEnd(),this._writeVertexCommon(t,e,i,r),t.vertexWrite(r.offsets.lowerRight),t.vertexWrite(r.texcoords.lowerRight),t.vertexEnd(),t.indexWrite(n+0),t.indexWrite(n+1),t.indexWrite(n+2),t.indexWrite(n+1),t.indexWrite(n+3),t.indexWrite(n+2)}_writeVertexCommon(t,e,i,r){const n=this._color,a=this._haloColor,o=P(0,0,this._referenceSize,this._bitset),h=P(0,0,this._size,this._haloSize);t.vertexWrite(i),t.vertexWrite(e),t.vertexWrite(n),t.vertexWrite(a),t.vertexWrite(h),t.vertexWrite(o),t.vertexWrite(this._minMaxZoom)}_writeBackgroundVertex(t,e,i,r,n,a){const o=P(0,1,this._referenceSize,this._bitset),h=P(0,0,this._size,this._haloSize),l=P(0,0,0,0);t.vertexWrite(i),t.vertexWrite(e),t.vertexWrite(r),t.vertexWrite(l),t.vertexWrite(h),t.vertexWrite(o),t.vertexWrite(this._minMaxZoom),t.vertexWrite(n),t.vertexWrite(a),t.vertexEnd()}_writeBackgroundQuad(t,e,i,r,n,a){const o=t.vertexCount();this._writeBackgroundVertex(t,e,i,r,n.upperLeft,a[0]),this._writeBackgroundVertex(t,e,i,r,n.upperRight,a[1]),this._writeBackgroundVertex(t,e,i,r,n.lowerLeft,a[2]),this._writeBackgroundVertex(t,e,i,r,n.lowerRight,a[3]),t.indexWrite(o+0),t.indexWrite(o+1),t.indexWrite(o+2),t.indexWrite(o+1),t.indexWrite(o+3),t.indexWrite(o+2)}_writeBackgroundGeometry(t,e,i,r,n){const a=M(Math.round(mt*i.x),Math.round(mt*i.y)),{x:o,y:h,width:l,height:u}=r,c=2*Math.max(l,u);if(t.vertexBounds(i.x+o+this._xOffset,i.y+h-this._yOffset,c*this._vertexBoundsScale,c*this._vertexBoundsScale),this._backgroundColor){const f=[Gt,Gt,Gt,Gt];this._writeBackgroundQuad(t,e,a,this._backgroundColor,n.main,f)}if(this._borderLineColor||this._backgroundColor){const f=!!this._borderLineColor&&!!this._borderLineSize&&this._borderLineSize>0,[d,_,m,p,y]=f?[Pi,Pi,$i,$i,this._borderLineColor]:[As,Rs,Bs,Fs,this._backgroundColor];this._writeBackgroundQuad(t,e,a,y,n.top,d),this._writeBackgroundQuad(t,e,a,y,n.bot,_),this._writeBackgroundQuad(t,e,a,y,n.left,m),this._writeBackgroundQuad(t,e,a,y,n.right,p)}}};let Rt=class{constructor(){this._materialKey=null}bindFeature(t,e,i){}write(t,e,i,r){if(this._effects&&this._effects.length>0){let n=re.fromFeatureSetReaderCIM(e);if(n){n.invertY();const a=Zr.executeEffects(this._effects,n,t.tileKey,r.geometryEngine);for(;n=a.next();)n.invertY(),this._write(t,e,r,n)}}else this._write(t,e,r)}_write(t,e,i,r){}};const Os=5;let Le=class Te extends dr(Rt){constructor(t,e,i,r,n,a,o,h,l,u,c,f,d,_,m,p,y,x,g,w,S,T,z,I){super(),this._xOffset=v(d),this._yOffset=v(_),this._decoration=u||"none",this._backgroundColor=T,this._borderLineColor=z,this._borderLineSize=I,this._color=n,this._haloColor=a,this._haloSize=Math.min(Math.floor(Os*v(Pr(i))),127),this._size=Math.min(Math.round(v(e)),127);const Y=Math.min(Math.round(v(r||e)),127);this._referenceSize=Math.round(Math.sqrt(256*Y)),this._scale=this._size/Hi,this._angle=f,this._justify=Nr(o||"center"),this._xAlignD=Ni(o||"center"),this._yAlignD=Ui(h||"baseline"),this._baseline=(h||"baseline")==="baseline",this._bitset=(l===K.MAP?1:0)|(c?1:0)<<1;const ft=Z.load(t);ft.sdf=!0,this._materialKey=ft.data,this._lineWidth=v(m)||512,this._lineHeight=p||1,this._textPlacement=y,this._effects=x,this._isCIM=g??!1,this._minMaxZoom=M(Math.round(w*E),Math.round(S*E))}static fromText(t,e){var a,o;const i=(a=t.font)==null?void 0:a.size,r=new Te(t.materialKey,i,t.haloSize||0,i,t.color&&O(t.color)||0,t.haloColor&&O(t.haloColor)||0,t.horizontalAlignment,t.verticalAlignment,K.SCREEN,(o=t.font)==null?void 0:o.decoration,!1,t.angle||0,t.xoffset||0,t.yoffset||0,t.lineWidth||0,t.lineHeight||0,null,null,!1,N,U,t.backgroundColor&&O(t.backgroundColor),t.borderLineColor&&O(t.borderLineColor),t.borderLineSize),[,n]=ye(t.text);return r.bindTextInfo(e??[],n),r._vertexBoundsScale=t.maxVVSize&&i?t.maxVVSize/i:1,r}static fromCIMText(t,e,i){const r=t.scaleFactor||1,n=t.size*t.sizeRatio*r,[a,o]=at(t.scaleInfo,i),h=new Te(t.materialKey,n,t.outlineSize*t.sizeRatio,t.referenceSize,$(t.color),$(t.outlineColor),t.horizontalAlignment,t.verticalAlignment,t.alignment,t.decoration,t.colorLocked??!1,t.angle,t.offsetX*t.sizeRatio*r,t.offsetY*t.sizeRatio*r,t.lineWidth||512,1,t.markerPlacement,t.effects,!0,a,o,t.backgroundColor?$(t.backgroundColor):void 0,t.borderLineColor?$(t.borderLineColor):void 0,t.borderLineWidth),[,l]=ye(t.text);return h.bindTextInfo(e,l),h._vertexBoundsScale=t.maxVVSize?t.maxVVSize/n:1,h}};const fr=St.getLogger("esri.views.2d.engine.webgl.WGLLabelTemplate"),Ds=(s,t="mapview-labeling")=>fr.error(new bt(t,s)),Zt=1,pt=0,Ks=4,de=25;function Gs(s,t){const e=!!s.minScale&&t.scaleToZoom(s.minScale)||0;return Gi(e,0,25.5)}function Zs(s,t){const e=!!s.maxScale&&t.scaleToZoom(s.maxScale)||255;return Gi(e,0,25.5)}function Ns(s){const t=new Map;return e=>(t.has(e)||t.set(e,s(e)),t.get(e))}const Us=Ns(s=>{let t=0;if(s===0)return 1/0;for(;!(s%2);)t++,s/=2;return t}),Nt=s=>Math.floor(127*s+127),ot=s=>Math.floor(s*E),J=s=>Math.round(s*(254/360));class Qt extends Le{constructor(t,e,i,r){var c,f,d;super(t,(c=i.font)==null?void 0:c.size,i.haloSize||0,(f=i.font)==null?void 0:f.size,i.color&&O(i.color)||0,i.haloColor&&O(i.haloColor)||0,i.horizontalAlignment,i.verticalAlignment,Zi(e.labelPlacement)?K.MAP:K.SCREEN,(d=i.font)==null?void 0:d.decoration,!1,i.angle||0,i.xoffset,i.yoffset,i.lineWidth,i.lineHeight,null,null,!1,null,null,i.backgroundColor&&O(i.backgroundColor),i.borderLineColor&&O(i.borderLineColor),i.borderLineSize),this._outLineLabelAngle=0,this._refPlacementPadding=0,this._refPlacementDirX=0,this._refPlacementDirY=0,this._refOffsetX=0,this._refOffsetY=0,this._zoomLevel=0,this.geometryType=b.LABEL,this._allowOverrun=e.allowOverrun??!1,this._repeatLabel=e.repeatLabel??!0,this._labelPosition=e.labelPosition??"curved";const n=Gs(e,r),a=Zs(e,r),o=e.labelPlacement,[h,l]=Ur(o);this._xAlignD=h,this._yAlignD=l,this._minZoom=n,this._maxZoom=a,this._minBackgroundZoom=n,this._maxBackgroundZoom=a,this._refPlacementPadding=v(i.haloSize)+is,this._repeatLabelDistance=e.repeatLabelDistance?v(e.repeatLabelDistance):128;const u=ct.load(t);u.sdf=!0,this._materialKey=u.data}static fromLabelClass(t,e){if(t.labelPlacement==="esriServerLinePlacementCenterAlong"){const i=t.symbol;i.xoffset=0,i.yoffset=0,i.angle=0,i.font.decoration="none"}return new Qt(t.materialKey,t,t.symbol,e)}get _shapedBox(){return this._shapingInfo.bounds}setZoomLevel(t){this._zoomLevel=t}bindReferenceTemplate(t){let e=Xr(this._xAlignD),i=Hr(this._yAlignD);if(this._refOffsetX=0,this._refOffsetY=0,t==null)return void(this._refSymbolAndPlacementOffset=P(0,0,Nt(e),Nt(i)));if(t.boundsType==="circle"&&(e||i)){const a=Math.sqrt(e*e+i*i);e/=a,i/=a}const r=Math.max(t.height,t.width),n=this._refPlacementPadding*Ks;this._refSymbolAndPlacementOffset=P(n,r,Nt(e),Nt(i)),this._referenceSize=r,this._refPlacementDirX=e,this._refPlacementDirY=i,this._refOffsetX=t.xOffset,this._refOffsetY=t.yOffset}_write(t,e){if(this._shapingInfo==null)return;const i=this._shapingInfo,r=e.getDisplayId(),n=e.geometryType==="esriGeometryPolygon"?e.readLegacyCentroid():e.readLegacyGeometry();if(n)switch(this._current={out:t,inId:r,inShaping:i,zoomLevel:this._zoomLevel},e.geometryType==="esriGeometryPolyline"&&this._labelPosition==="curved"&&(this._borderLineColor||this._backgroundColor)&&fr.warnOnce("TextSymbol properties 'borderLineColor', 'borderLineSize', and 'backgroundColor' are not supported in curved labels"),e.geometryType){case"esriGeometryPolyline":this._placeLineLabels(n);break;case"esriGeometryPoint":case"esriGeometryPolygon":this._placePointLabels(n);break;default:Ds(`Geometry of type ${e.geometryType} is not supported`)}}_isVisible(t,e){const i=ot(this._current.zoomLevel);return ot(t)<=i&&i<=ot(e)}_placePointLabels(t){const{out:e,inId:i,inShaping:r}=this._current;this._writeGlyphs(e,i,t,r)}_placeLineLabels(t){const e=Vs(t.paths,this._current.inShaping.bounds.width),i=this._placeSubdivGlyphs.bind(this),r=(this._shapedBox.width+this._repeatLabelDistance)/(1<0&&(this._borderLineColor||this._backgroundColor);if(this._maxBackgroundZoom=de,this._minBackgroundZoom=Math.max(e,0),l){const u=ct.load(this._materialKey);u.textureBinding=n.glyphs[0].textureBinding;const c=ee(Q(),-t.angle),[f,d]=n.shapeBackground(c);this._outLineLabelAngle=J(o),i.recordStart(r,u.data,this.geometryType,!0),this._writeBackgroundGeometry(i,r,t,f,d),i.recordEnd(),this._outLineLabelAngle=J(h),i.recordStart(r,u.data,this.geometryType,!0),this._writeBackgroundGeometry(i,r,t,f,d),i.recordEnd()}this._outLineLabelAngle=J(o),this._placeFirst(a,e,1,!0),this._outLineLabelAngle=J(h),this._placeFirst(a,e,0,!0),i.metricEnd()}_placeBack(t,e,i,r,n){const a=t.clone();let o=t.backwardLength+pt;for(;a.prev()&&!(o>=r);)this._placeOnSegment(a,e,o,i,-1,n),o+=a.length+pt}_placeForward(t,e,i,r,n){const a=t.clone();let o=t.remainingLength+pt;for(;a.next()&&!(o>=r);)this._placeOnSegment(a,e,o,i,1,n),o+=a.length+pt}_placeFirst(t,e,i,r=!1){const n=t,a=this._current.inShaping,o=a.glyphs,h=this._current.zoomLevel,{out:l,inId:u}=this._current;for(const c of o){const f=c.x>a.bounds.x?i:1-i,d=f*t.remainingLength+(1-f)*t.backwardLength,_=Math.abs(c.x+c.width/2-a.bounds.x),m=Math.max(0,h+Math.log2(_/(d+pt))),p=Math.max(e,r?0:m);if(c.maxZoom=de,c.angle=t.angle+(1-i)*Math.PI,c.minZoom=p,this._writeGlyph(l,u,n.x,n.y,c),i&&this._isVisible(c.minZoom,c.maxZoom)){const y=c.bounds;l.metricBoxWrite(y.center[0],y.center[1],y.width,y.height)}}}_placeOnSegment(t,e,i,r,n,a){const o=this._current.inShaping.glyphs,{out:h,inId:l}=this._current,u=this._current.inShaping,c=this._current.zoomLevel,f=t.dx/t.length,d=t.dy/t.length,_={x:t.x+i*-n*f,y:t.y+i*-n*d};for(const m of o){const p=m.x>u.bounds.x?a:1-a;if(!(p&&n===1||!p&&n===-1))continue;const y=Math.abs(m.x+m.width/2-u.bounds.x),x=Math.max(0,c+Math.log2(y/i)-.1),g=Math.max(r,c+Math.log2(y/(i+t.length+pt)));if(x!==0&&(m.angle=t.angle+(1-a)*Math.PI,m.minZoom=g,m.maxZoom=x,this._writeGlyph(h,l,_.x,_.y,m),a&&this._isVisible(m.minZoom,m.maxZoom))){const w=m.bounds,S=t.x-e.x,T=t.y-e.y;h.metricBoxWrite(w.center[0]+S,w.center[1]+T,w.width,w.height)}}}_writeGlyphs(t,e,i,r,n=this._minZoom){if(i.x<0||i.x>=512||i.y<0||i.y>=512)return;if(r.glyphs.length>0&&(this._borderLineColor||this._backgroundColor)){const c=ct.load(this._materialKey);c.textureBinding=r.glyphs[0].textureBinding,t.recordStart(e,c.data,this.geometryType,!0),this._writeBackgroundGeometry(t,e,i,r.bounds,r.background),t.recordEnd()}const a=i.x+this._refOffsetX,o=i.y-this._refOffsetY;for(const c of r.glyphs)c.minZoom=n,c.maxZoom=this._maxZoom,this._writeGlyph(t,e,a,o,c);const h=this._refPlacementDirX,l=this._refPlacementDirY,u=r.boundsT;t.metricStart(e,n,a,o,h,l,this._referenceSize,this._materialKey),t.metricBoxWrite(u.center[0],u.center[1],u.width,u.height),t.metricEnd()}_writeVertexCommon(t,e,i,r){const n=this._color,a=this._haloColor,o=P(0,0,this._size,this._haloSize),h=Math.max(r.minZoom,this._minZoom),l=Math.min(r.maxZoom,this._maxZoom),u=P(ot(h),ot(l),this._outLineLabelAngle,0);t.vertexWrite(i),t.vertexWrite(e),t.vertexWrite(n),t.vertexWrite(a),t.vertexWrite(o),t.vertexWrite(this._refSymbolAndPlacementOffset),t.vertexWrite(u)}_writeBackgroundVertex(t,e,i,r,n,a){const o=P(0,0,this._size,this._haloSize),h=P(0,0,0,0),l=P(ot(this._minBackgroundZoom),ot(this._maxBackgroundZoom),this._outLineLabelAngle,1);t.vertexWrite(i),t.vertexWrite(e),t.vertexWrite(r),t.vertexWrite(h),t.vertexWrite(o),t.vertexWrite(this._refSymbolAndPlacementOffset),t.vertexWrite(l),t.vertexWrite(n),t.vertexWrite(a),t.vertexEnd()}}const fe=3.14159265359/180,Ci=8,_r=s=>class extends s{constructor(...t){super(...t),this.angle=0,this.xOffset=0,this.yOffset=0,this.width=0,this.height=0,this.boundsType="square",this._anchorX=0,this._anchorY=0,this._computedWidth=0,this._computedHeight=0,this._allowBorrowing=!0,this._vertexBoundsScaleX=1,this._vertexBoundsScaleY=1,this.geometryType=b.MARKER}_write(t,e,i,r){const n=e.getDisplayId();t.recordStart(n,this._materialKey,this.geometryType,!0),this._writeGeometry(t,e,n,i,r),t.recordEnd()}_writeGeometry(t,e,i,r,n){if(this._markerPlacement!=null)return this._writePlacedMarkers(t,e,r,n);if(this._allowBorrowing=!0,!n&&e.geometryType==="esriGeometryPoint"){const o=e.getX(),h=e.getY();return!t.hasAggregates&&t.hasPixelBufferEnabled&&(o<0||o>=513||h<0||h>=513)?void 0:this._writeVertices(t,i,this._getPos(o,h),o,h)}const a=n?n.asOptimized():e.geometryType==="esriGeometryPolygon"?e.readCentroid():e.readGeometryForDisplay();if(a!=null){if(a.isPoint){const[o,h]=a.coords;return!t.hasAggregates&&t.hasPixelBufferEnabled&&(o<0||o>=512||h<0||h>=512)?void 0:this._writeVertices(t,i,this._getPos(o,h),o,h)}a.forEachVertex((o,h)=>{const l=2*ut;o<-l||o>=l||h<-l||h>=l||this._writeVertices(t,i,this._getPos(o,h),o,h)})}}_writePlacedMarkers(t,e,i,r){const n=r||re.fromFeatureSetReaderCIM(e);if(!n)return;const a=-1,o=ur.getPlacement(n,a,this._markerPlacement,v(1),t.tileKey,i.geometryEngine);if(!o)return;this._allowBorrowing=e.geometryType!=="esriGeometryPolygon";const h=e.getDisplayId(),l=Mt(),u=Q(),c=-128,f=640;let d=o.next();for(;d!=null;){const _=d.tx,m=-d.ty;_>=c&&_<=f&&m>=c&&m<=f&&(this._applyTransformation(u,l,-d.getAngle()/fe),this._writeVertices(t,h,this._getPos(_,m),_,m)),d=o.next()}}_writeVertices(t,e,i,r,n){const a=dt.load(this._materialKey);return a.symbologyType===A.HEATMAP?this._writeHeatmapVertices(t,e,i):this._writeMarkerVertices(t,e,a,i,r,n)}_writeMarkerVertices(t,e,i,r,n,a){const o=i.vvRotation,h=t.vertexCount();let l=this._computedWidth*this._vertexBoundsScaleX,u=this._computedHeight*this._vertexBoundsScaleY;if(this.angle){const c=Math.max(l,u);l=c,u=c}if(o){const c=Math.max(this.xOffset,this.yOffset);l+=c,u+=c}this._allowBorrowing&&t.vertexBounds(n+this.xOffset,a-this.yOffset,l,u),t.vertexWrite(r),t.vertexWrite(this._offsetUpperLeft),t.vertexWrite(this._texUpperLeft),t.vertexWrite(this._bitestAndDistRatio),t.vertexWrite(e),t.vertexWrite(this._fillColor),t.vertexWrite(this._outlineColor),t.vertexWrite(this._sizeOutlineWidth),t.vertexWrite(this._minMaxZoom),t.vertexEnd(),t.vertexWrite(r),t.vertexWrite(this._offsetUpperRight),t.vertexWrite(this._texUpperRight),t.vertexWrite(this._bitestAndDistRatio),t.vertexWrite(e),t.vertexWrite(this._fillColor),t.vertexWrite(this._outlineColor),t.vertexWrite(this._sizeOutlineWidth),t.vertexWrite(this._minMaxZoom),t.vertexEnd(),t.vertexWrite(r),t.vertexWrite(this._offsetBottomLeft),t.vertexWrite(this._texBottomLeft),t.vertexWrite(this._bitestAndDistRatio),t.vertexWrite(e),t.vertexWrite(this._fillColor),t.vertexWrite(this._outlineColor),t.vertexWrite(this._sizeOutlineWidth),t.vertexWrite(this._minMaxZoom),t.vertexEnd(),t.vertexWrite(r),t.vertexWrite(this._offsetBottomRight),t.vertexWrite(this._texBottomRight),t.vertexWrite(this._bitestAndDistRatio),t.vertexWrite(e),t.vertexWrite(this._fillColor),t.vertexWrite(this._outlineColor),t.vertexWrite(this._sizeOutlineWidth),t.vertexWrite(this._minMaxZoom),t.vertexEnd(),this._writeIndices(t,h)}_writeHeatmapVertices(t,e,i){const r=t.vertexCount();t.vertexWrite(i),t.vertexWrite(this._offsetUpperLeft),t.vertexWrite(e),t.vertexEnd(),t.vertexWrite(i),t.vertexWrite(this._offsetUpperRight),t.vertexWrite(e),t.vertexEnd(),t.vertexWrite(i),t.vertexWrite(this._offsetBottomLeft),t.vertexWrite(e),t.vertexEnd(),t.vertexWrite(i),t.vertexWrite(this._offsetBottomRight),t.vertexWrite(e),t.vertexEnd(),this._writeIndices(t,r)}_writeIndices(t,e){t.indexWrite(e+0),t.indexWrite(e+1),t.indexWrite(e+2),t.indexWrite(e+1),t.indexWrite(e+3),t.indexWrite(e+2)}_applyTransformation(t,e,i=0){i?ee(t,fe*i):$r(t),Xt(t,t,Ki(this.xOffset,-this.yOffset)),this.angle&&pe(t,t,fe*this.angle);const r=this._computedWidth,n=this._computedHeight,a=-(.5+this._anchorX)*r,o=-(.5-this._anchorY)*n;et(e,a,o),gt(e,e,t),this._offsetUpperLeft=M(16*e[0],16*e[1]),et(e,a+r,o),gt(e,e,t),this._offsetUpperRight=M(16*e[0],16*e[1]),et(e,a,o+n),gt(e,e,t),this._offsetBottomLeft=M(16*e[0],16*e[1]),et(e,a+r,o+n),gt(e,e,t),this._offsetBottomRight=M(16*e[0],16*e[1])}_computeSize(t,e,i,r,n,a,o,h){const l=t*i,u=e*i;if(a.sdf&&!o){const T=h&&t>e?l:t,z=e,I=r+2*1;t=Math.min(T+I,l),e=Math.min(z+I,u)}else t=l,e=u;const c=rs/Math.max(l,u),f=.5*(l-t)*c,d=.5*(u-e)*c,_=a.rect.x+k+f,m=a.rect.y+k+d,p=_+a.width-2*f,y=m+a.height-2*d,x=Math.floor(_),g=Math.floor(m),w=Math.ceil(p),S=Math.ceil(y);t*=(w-x)/(p-_),e*=(S-g)/(y-m),this._texUpperLeft=M(x,g),this._texUpperRight=M(w,g),this._texBottomLeft=M(x,S),this._texBottomRight=M(w,S),this._anchorX*=l/t,this._anchorY*=u/e,t*=n,e*=n,this._computedWidth=t,this._computedHeight=e}_getPos(t,e){return M(Math.round(Ci*t),Math.round(Ci*e))}};let It=class Pt extends _r(Rt){constructor(t,e,i,r,n,a,o,h,l,u,c,f,d,_,m,p,y,x,g,w,S,T,z,I){super(),this.angle=r,this.height=o,this.width=a,this.xOffset=e*g,this.yOffset=i*g,this._markerPlacement=w||void 0,this._effects=S||void 0,this._anchorX=p,this._anchorY=y,this._minMaxZoom=M(Math.round(T*E),Math.round(z*E));const Y=(_===K.MAP?Yi:qi)|(c?it:0)|(d?ss:0)|(f?ji:0),ft=m&&m.sdf,_t=dt.load(t);_t.sdf=ft,_t.pattern=!0,_t.textureBinding=m.textureBinding,this._materialKey=_t.data,this._fillColor=n,this._outlineColor=l,this._sizeOutlineWidth=P(Math.round(Math.min(Math.sqrt(128*a),255)),Math.round(Math.min(Math.sqrt(128*o),255)),Math.round(Math.min(Math.sqrt(128*u),255)),Math.round(Math.min(Math.sqrt(128*h),255))),_t.symbologyType===A.PIE_CHART?(a*=x*g,o*=x*g,this._computedWidth=a,this._computedHeight=o,this._texUpperLeft=M(0,1),this._texUpperRight=M(1,1),this._texBottomLeft=M(0,0),this._texBottomRight=M(1,0)):this._computeSize(a,o,x,u,g,m,_t.hasSizeVV(),I);const Lr=Math.round(64*x);this._bitestAndDistRatio=M(Y,Lr);const Tr=Mt(),zr=Q();this._applyTransformation(zr,Tr)}static fromCIMMarker(t,e,i){const r=e&&e.width||1,n=e&&e.height||1,a=t.size,o=r/n*t.scaleX,h=t.scaleSymbolsProportionally&&t.frameHeight?a/t.frameHeight:1,l=$(t.color),u=$(t.outlineColor),c=v(a),f=c*o,d=v(t.offsetX||0),_=v(t.offsetY||0),m=v(t.outlineWidth||0)*h,p=t.alignment||K.SCREEN,y=v(t.referenceSize),[x,g]=at(t.scaleInfo,i);let w=t.rotation||0;t.rotateClockwise||(w=-w);let S=0,T=0;const z=t.anchorPoint;z&&(t.isAbsoluteAnchorPoint?a&&(S=z.x/(a*o),T=z.y/a):(S=z.x,T=z.y));const I=new Pt(t.materialKey,d,_,w,l,f,c,y,u,m,t.colorLocked,t.scaleSymbolsProportionally,!1,p,e,S,T,t.sizeRatio,t.scaleFactor??1,t.markerPlacement,t.effects,x,g,!0);return I._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/f:1,I._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/c:1,I}static fromPictureMarker(t,e){const i=Math.round(v(t.width)),r=Math.round(v(t.height)),n=Qi,a=Math.round(v(t.xoffset||0)),o=Math.round(v(t.yoffset||0)),h=new Pt(t.materialKey,a,o,t.angle,n,i,r,r,0,0,!1,!1,!1,K.SCREEN,e,0,0,1,1,null,null,N,U,!1);return h._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/t.width:1,h._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/t.height:1,h}static fromSimpleMarker(t,e){const i=t.style,r=O(t.color),n=Math.round(v(t.size));let a=n;i==="esriSMSTriangle"&&(a*=e.height/e.width);const o=Math.round(v(t.xoffset||0)),h=Math.round(v(t.yoffset||0)),l=t.outline,u=0|((l==null?void 0:l.color)&&O(l.color)),c=0|((l==null?void 0:l.width)&&Math.round(v(l.width))),f=new Pt(t.materialKey,o,h,t.angle??0,r,n,a,a,u,c,!1,!1,i==="esriSMSCross"||i==="esriSMSX",K.SCREEN,e,0,0,2,1,null,null,N,U,!1);return f.boundsType=i==="esriSMSCircle"?"circle":"square",f._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/t.size:1,f._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/t.size:1,f}static fromLineSymbolMarker(t,e){const i=O(t.color),r=6,n=Math.round(v(r*t.lineWidth)),a=n,o=t.style==="cross"||t.style==="x";let h;switch(t.placement){case"begin-end":h=Bt.Both;break;case"begin":h=Bt.JustBegin;break;case"end":h=Bt.JustEnd;break;default:h=Bt.None}const l={type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:h,offsetAlongLine:0},u=new Pt(t.materialKey,0,0,0,i,n,a,a/r,i,o?Math.round(v(t.lineWidth)):0,!1,!1,o,K.MAP,e,0,0,2,1,l,null,N,U,!1);return u.boundsType=t.style==="circle"?"circle":"square",u}};function Xs(s,t,e,i,r,n,a){Pe=0;const o=(i-e)*n,h=r&&r.length,l=h?(r[0]-e)*n:o;let u,c,f,d,_,m=mr(t,e,i,0,l,n,!0);if(m&&m.next!==m.prev){if(h&&(m=js(t,e,i,r,m,n)),o>80*n){u=f=t[0+e*n],c=d=t[1+e*n];for(let p=n;p0)for(let h=i;h=i;h-=n)o=Ei(h+t*n,s[h+t*n],s[h+1+t*n],o);return o&<(o,o.next)&&(Vt(o),o=o.next),o}function Et(s,t=s){if(!s)return s;let e,i=s;do if(e=!1,i.steiner||!lt(i,i.next)&&C(i.prev,i,i.next)!==0)i=i.next;else{if(Vt(i),i=t=i.prev,i===i.next)break;e=!0}while(e||i!==t);return t}function Wt(s,t,e,i,r,n,a,o){if(!s)return;!o&&n&&(s=pr(s,i,r,n));let h=s;for(;s.prev!==s.next;){const l=s.prev,u=s.next;if(n?Ys(s,i,r,n):Hs(s))t.push(l.index/e+a),t.push(s.index/e+a),t.push(u.index/e+a),Vt(s),s=u.next,h=u.next;else if((s=u)===h){o?o===1?Wt(s=nn(s,t,e,a),t,e,i,r,n,a,2):o===2&&an(s,t,e,i,r,n,a):Wt(Et(s),t,e,i,r,n,a,1);break}}}function Hs(s){const t=s.prev,e=s,i=s.next;if(C(t,e,i)>=0)return!1;let r=s.next.next;const n=r;let a=0;for(;r!==s.prev&&(a===0||r!==n);){if(a++,vt(t.x,t.y,e.x,e.y,i.x,i.y,r.x,r.y)&&C(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Ys(s,t,e,i){const r=s.prev,n=s,a=s.next;if(C(r,n,a)>=0)return!1;const o=r.xn.x?r.x>a.x?r.x:a.x:n.x>a.x?n.x:a.x,u=r.y>n.y?r.y>a.y?r.y:a.y:n.y>a.y?n.y:a.y,c=ze(o,h,t,e,i),f=ze(l,u,t,e,i);let d=s.prevZ,_=s.nextZ;for(;d&&d.z>=c&&_&&_.z<=f;){if(d!==s.prev&&d!==s.next&&vt(r.x,r.y,n.x,n.y,a.x,a.y,d.x,d.y)&&C(d.prev,d,d.next)>=0||(d=d.prevZ,_!==s.prev&&_!==s.next&&vt(r.x,r.y,n.x,n.y,a.x,a.y,_.x,_.y)&&C(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;d&&d.z>=c;){if(d!==s.prev&&d!==s.next&&vt(r.x,r.y,n.x,n.y,a.x,a.y,d.x,d.y)&&C(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;_&&_.z<=f;){if(_!==s.prev&&_!==s.next&&vt(r.x,r.y,n.x,n.y,a.x,a.y,_.x,_.y)&&C(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Ei(s,t,e,i){const r=wt.create(s,t,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Vt(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function qs(s){let t=s,e=s;do(t.x=e.next.y&&e.next.y!==e.y){const f=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=i&&f>a){if(a=f,f===i){if(r===e.y)return e;if(r===e.next.y)return e.next}n=e.x=e.x&&e.x>=h&&i!==e.x&&vt(rn.x)&&kt(e,s)&&(n=e,c=u)),e=e.next;return n}function pr(s,t,e,i){let r;for(;r!==s;r=r.next){if(r=r||s,r.z===null&&(r.z=ze(r.x,r.y,t,e,i)),r.prev.next!==r||r.next.prev!==r)return r.prev.next=r,r.next.prev=r,pr(s,t,e,i);r.prevZ=r.prev,r.nextZ=r.next}return s.prevZ.nextZ=null,s.prevZ=null,tn(s)}function tn(s){let t,e=1;for(;;){let i,r=s;s=null,t=null;let n=0;for(;r;){n++,i=r;let a=0;for(;a0||o>0&&i;){let h;a===0?(h=i,i=i.nextZ,o--):o!==0&&i?r.z<=i.z?(h=r,r=r.nextZ,a--):(h=i,i=i.nextZ,o--):(h=r,r=r.nextZ,a--),t?t.nextZ=h:s=h,h.prevZ=t,t=h}r=i}if(t.nextZ=null,e*=2,n<2)return s}}function C(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function yr(s,t,e,i){return!!(lt(s,t)&<(e,i)||lt(s,i)&<(e,t))||C(s,t,e)>0!=C(s,t,i)>0&&C(e,i,s)>0!=C(e,i,t)>0}function en(s,t){let e=s;do{if(e.index!==s.index&&e.next.index!==s.index&&e.index!==t.index&&e.next.index!==t.index&&yr(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function rn(s,t,e,i,r,n){let a=0;for(let o=i,h=r-n;o=0&&(s-a)*(i-o)-(e-a)*(t-o)>=0&&(e-a)*(n-o)-(r-a)*(i-o)>=0}function kt(s,t){return C(s.prev,s,s.next)<0?C(s,t,s.next)>=0&&C(s,s.prev,t)>=0:C(s,t,s.prev)<0||C(s,s.next,t)<0}function ze(s,t,e,i,r){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=32767*(s-e)*r)|s<<8))|s<<4))|s<<2))|s<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function lt(s,t){return s.x===t.x&&s.y===t.y}function sn(s,t){return s.x-t.x}function nn(s,t,e,i){let r=s;do{const n=r.prev,a=r.next.next;!lt(n,a)&&yr(n,r,r.next,a)&&kt(n,a)&&kt(a,n)&&(t.push(n.index/e+i),t.push(r.index/e+i),t.push(a.index/e+i),Vt(r),Vt(r.next),r=s=a),r=r.next}while(r!==s);return r}function an(s,t,e,i,r,n,a){let o=s;do{let h=o.next.next;for(;h!==o.prev;){if(o.index!==h.index&&on(o,h)){let l=xr(o,h);return o=Et(o,o.next),l=Et(l,l.next),Wt(o,t,e,i,r,n,a,0),void Wt(l,t,e,i,r,n,a,0)}h=h.next}o=o.next}while(o!==s)}function on(s,t){return s.next.index!==t.index&&s.prev.index!==t.index&&!en(s,t)&&kt(s,t)&&kt(t,s)&&hn(s,t)}function hn(s,t){let e=s,i=!1;const r=(s.x+t.x)/2,n=(s.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==s);return i}function xr(s,t){const e=wt.create(s.index,s.x,s.y),i=wt.create(t.index,t.x,t.y),r=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}class wt{constructor(){this.index=0,this.x=0,this.y=0,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}static create(t,e,i){const r=Pe0))break;c+=y,f.push(o+u),u+=p}const d=a.length;Xs(a,e,o,o+u,f,2,n);const _=un(a,e,d,a.length,n),m=Math.abs(c);if(Math.abs((_-m)/Math.max(1e-7,m))>cn)return a.length=0,!1;h=l,o+=u}return!0}function fn(s){const{coords:t,lengths:e}=s,{buffer:i}=ls(t,e);return i}function _n(s,t,e){let i=0;for(let r=0;re||he)return!0}i+=n}return!1}function mn(s,t){if(s==null)return null;if(!_n(s,-128,ut+128))return s;ht.setPixelMargin(t),ht.reset(rr.Polygon);let e=0;for(let a=0;ar||ur){a=!0;continue}h.push({x:l,y:u})}let c=!1;for(;s.nextPoint();)if(l=s.x,u=s.y,a)e.lineTo(l,u);else{if(lr||ur){c=!0;break}h.push({x:l,y:u})}if(c)a=!0;else{if(a){const f=e.resultWithStarts();if(f)for(const d of f)n.push(d)}else n.push({line:h,start:0});o=s.nextPath(),a=!1}}return n=n.filter(h=>h.line.length>1),n.length===0?null:n}ht.setExtent(ut),$e.setExtent(ut);const Jt=8,B=16,Vi=65535,gr=s=>class extends s{constructor(...t){super(...t),this.tessellationProperties={},this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0},this.geometryType=b.LINE}writeGeometry(t,e,i,r){this._writeGeometry(t,e,i,r)}_initializeTessellator(t){const e=rt.load(this._materialKey),i=H.load(this._materialKey),r=this._tessellationOptions,n=e.vvSizeFieldStops||e.vvSizeMinMaxValue||e.vvSizeScaleStops||e.vvSizeUnitValue,a=this.tessellationProperties._halfWidth(i,r,n,a,o,h,l,u,c,f,d)=>{const _=M(d,Math.ceil(B*s._halfWidth)),m=P(Math.round(B*l),Math.round(B*u),Math.round(B*c),Math.round(B*f)),p=P(B*o,B*h,0,s._bitset),y=s.out;return y.vertexBounds(i,r,t,e),y.vertexWrite(M(Jt*i,Jt*r)),y.vertexWrite(s.id),y.vertexWrite(s._fillColor),y.vertexWrite(m),y.vertexWrite(_),y.vertexWrite(s._tl),y.vertexWrite(s._br),y.vertexWrite(p),y.vertexWrite(M(Math.ceil(B*s._halfReferenceWidth),0)),y.vertexWrite(s.minMaxZoom),y.vertexEnd(),s.offset+s.vertexCount++},xn=(s,t,e)=>(i,r,n,a,o,h,l,u,c,f,d)=>{const _=M(B*s._halfWidth,B*s._halfReferenceWidth),m=P(B*l+128,B*u+128,B*c+128,B*f+128),p=s.out,y=s._bitset<<24|s.id;p.vertexBounds(i,r,t,e),p.vertexWrite(M(Jt*i,Jt*r)),p.vertexWrite(y),p.vertexWrite(s._fillColor);const x=or(s.key);return x||(p.vertexWrite(0),p.vertexWrite(0)),p.vertexWrite(0),p.vertexWrite(_),p.vertexWrite(m),x||p.vertexWrite(s.minMaxZoom),p.vertexEnd(),s.offset+s.vertexCount++},gn=s=>(t,e,i)=>{const r=s.out;r.indexWrite(t),r.indexWrite(e),r.indexWrite(i),s.indexCount+=3};let Ce=class xt extends gr(Rt){constructor(t,e,i,r,n,a,o,h,l,u,c,f,d,_,m,p,y,x,g,w){super();const S=rt.load(t);e&&(S.sdf=e.sdf,S.pattern=!0,S.textureBinding=e.textureBinding),this._capType=r,this._joinType=n,this._miterLimitCosine=be(a),this.tessellationProperties._fillColor=o,this.tessellationProperties._tl=h,this.tessellationProperties._br=l,this._hasPattern=u,this._isDashed=c,this._zOrder=y,this._effects=x||null,this._minMaxZoom=M(Math.round(g*E),Math.round(w*E)),this._materialKey=S.data;const T=(d?it:0)|(_?as:0)|(f?Ji:0)|(m?ie:0);this.tessellationProperties._bitset=T,this.tessellationProperties._halfWidth=.5*i,this.tessellationProperties._halfReferenceWidth=.5*p,this.tessellationProperties.offset=0,this._initializeTessellator(!1)}static fromCIMLine(t,e,i){const r=t.color,n=t.scaleFactor||1,a=!!t.dashTemplate;let o=t.cap;a&&o===He.ROUND&&(o=He.SQUARE);const h=t.join,l=v(t.width)*n,u=v(t.referenceWidth),c=v(t.miterLimit),f=r&&$(r)||0,[d,_]=at(t.scaleInfo,i),m=!1;if(!e)return new xt(t.materialKey,e,l,o,h,c,f,0,0,!1,a,t.scaleDash??!1,t.colorLocked??!1,m,t.sampleAlphaOnly,u,t.zOrder,t.effects,d,_);const{rect:p,width:y,height:x}=e,g=p.x+k,w=p.y+k,S=g+y,T=w+x,z=M(g,w),I=M(S,T),Y=!1;return new xt(t.materialKey,e,l,o,h,c,f,z,I,!0,a,t.scaleDash??!1,t.colorLocked??!1,Y,t.sampleAlphaOnly,u,t.zOrder,t.effects,d,_)}static fromFillOutline(t){var i;const e=H.load(t.materialKey);return qt(e)&&t.outline&&((i=t.outline)==null?void 0:i.style)==="esriSLSSolid"?xt.fromSimpleLine({hash:"",materialKey:t.materialKey,...t.outline},null,!0):null}static fromSimpleLine(t,e,i=!1){const{color:r}=t,n=t.style!=="esriSLSSolid"&&t.style!=="esriSLSNull",a=Qr(t.cap||"round"),o=Jr(t.join||"round");let h=r&&t.style!=="esriSLSNull"&&O(r)||0;t.style==="esriSLSNull"&&(h=0);const l=v(t.width),u=t.miterLimit;if(!e)return new xt(t.materialKey,e,l,a,o,u,h,0,0,!1,n,!0,!1,i,!1,l,0,null,N,U);const{rect:c,width:f,height:d}=e,_=c.x+k,m=c.y+k,p=_+f,y=m+d,x=M(_,m),g=M(p,y);return new xt(t.materialKey,e,l,a,o,u,h,x,g,!0,n,!0,!1,i,!1,l,0,null,N,U)}static fromPictureLineSymbol(t,e,i,r){return St.getLogger("esri.views.2d.engine.webgl.WGLLineTemplate").error("PictureLineSymbol support does not exist!"),null}};const vn=100,ki=1,vr=s=>class extends s{constructor(...t){super(...t),this.forceLibtess=!1,this._bitset=0,this._lineTemplate=null,this.geometryType=b.FILL}_maybeAddLineTemplate(t){this._lineTemplate=Ce.fromFillOutline(t)}_write(t,e,i,r){const n=e.geometryType==="esriGeometryPoint",a=H.load(this._materialKey);t.recordStart(e.getDisplayId(),this._materialKey,this.geometryType,n),this._writeGeometry(t,e,a,r,n),qt(a)&&this._lineTemplate!=null&&this._lineTemplate.writeGeometry(t,e,r,n),t.recordEnd()}_writeGeometry(t,e,i,r,n){const a=this._getGeometry(e,r,n);if(a==null)return;const o=[];if(!(a.maxLength>vn)&&!this.forceLibtess&&dn(o,a))return void(o.length&&this._writeVertices(t,e,a.coords,a.lengths,i,o));const h=fn(a);this._writeVertices(t,e,h,[h.length/2],i)}_writeVertex(t,e,i,r,n,a){const o=M(ki*r,ki*n);if(t.vertexBounds(r,n,0,0),t.vertexWrite(o),t.vertexWrite(e),i.symbologyType===A.DOT_DENSITY)t.vertexWriteF32(1/Math.abs(a.readGeometryArea()));else{t.vertexWrite(this.fillColor);const h=or(i);h||(t.vertexWrite(this.tl),t.vertexWrite(this.br)),t.vertexWrite(this.aux21),t.vertexWrite(this.aux22),t.vertexWrite(this.aux3),h||t.vertexWrite(this._minMaxZoom)}}_writeVertices(t,e,i,r,n,a){const o=e.getDisplayId(),h=this._bitset<<24|o,l=r.reduce((d,_)=>d+_),u=xe(n.geometryType,n.symbologyType).geometry/4,c=t.vertexCount();t.vertexEnsureSize(u*l);let f=0;if(a)for(const d of a){const _=i[2*d],m=i[2*d+1];this._writeVertex(t,h,n,_,m,e),f++}else for(let d=0;d0,o=e.readLegacyFeature(),h=e.getObjectId(),l=this._materialCache,u=this._cimLayer.materialHash;if(!u)return Ai.error("A Dynamic mesh template must have a material hash value or function!"),null;const c=typeof u=="function"?u(o,i,r,h):u,f=l.get(c);if(f!=null)return f;const d=this._ongoingMaterialRequestMap.get(c);if(d)return d;const _=this._cimLayer,m=Yr(_.cim,this._cimLayer.materialOverrides);m.mosaicHash=c;const{type:p,url:y}=_,x={cim:m,type:p,mosaicHash:c,url:y,size:null,dashTemplate:null,text:null,fontName:null,objectId:h,animatedSymbolProperties:null};switch(p){case"marker":x.size=Ft(_.size,o,i,r),x.animatedSymbolProperties=Ft(_.animatedSymbolProperties,o,i,r);break;case"line":x.dashTemplate=_.dashTemplate;break;case"text":x.text=Ft(_.text,o,i,r),x.fontName=Ft(_.fontName,o,i,r)}const g=t.getMosaicItem(x,n).then(w=>(a||(this._ongoingMaterialRequestMap.delete(c),l.set(c,w)),w)).catch(w=>(this._ongoingMaterialRequestMap.delete(c),Ai.error(".analyze()",w.message),null));return a||this._ongoingMaterialRequestMap.set(c,g),g}};function F(s,t){if(s&&"name"in s){const e=s;return t&&t.error(new bt(e.name,e.message,e.details)),!1}return!0}let Mn=class Mr extends vr(ue){constructor(t,e,i){var u;if(super(t),this._minMaxZoom=M(Math.round(e*E),Math.round(i*E)),L(t.color)){const c=(f,d,_)=>{const m=t.color(f,d,_);return m&&$(m)||0};this._dynamicPropertyMap.set("fillColor",c)}else{const c=t.color;this.fillColor=c&&$(c)||0}const r=((u=t.cim.placement)==null?void 0:u.type)==="CIMMarkerPlacementInsidePolygon"&&t.cim.placement.shiftOddRows?2:1,n=t.height;if(L(n)){const c=(f,d,_)=>n(f,d,_)*r;this._dynamicPropertyMap.set("_height",c)}else this._height=(n||0)*r;const a=t.offsetX;if(L(a)){const c=(f,d,_)=>v(a(f,d,_));this._dynamicPropertyMap.set("_offsetX",c)}else this._offsetX=v(a||0);const o=t.offsetY;if(L(o)){const c=(f,d,_)=>v(-o(f,d,_));this._dynamicPropertyMap.set("_offsetY",c)}else this._offsetY=v(-o||0);const h=t.scaleX;L(h)?this._dynamicPropertyMap.set("_scaleX",h):this._scaleX=h||1;const l=t.angle;if(L(l)){const c=(f,d,_)=>ve(l(f,d,_));this._dynamicPropertyMap.set("_angle",c)}else this._angle=ve(l)||0;if(t.effects!=null){const c=t.effects;L(c)?this._dynamicPropertyMap.set("_effects",c):this._effects=c}this._cimFillLayer=t,this._bitset=(t.colorLocked?it:0)|(t.applyRandomOffset?tr:0)|(t.sampleAlphaOnly?ie:0)|(t.hasUnresolvedReplacementColor?er:0),this._fillMaterialKey=t.materialKey}static fromCIMFill(t,e){const[i,r]=at(t.scaleInfo,e);return new Mr(t,i,r)}bindFeature(t,e,i){const r=t.readLegacyFeature();this._dynamicPropertyMap.forEach((u,c)=>{this[c]=u(r,e,i)});const n=H.load(this._fillMaterialKey),a=this._materialCache,o=(0,this._cimFillLayer.materialHash)(r,e,i),h=a.get(o);let l=null;if(h&&F(h.spriteMosaicItem)&&(l=h.spriteMosaicItem),l){const{rect:u,width:c,height:f}=l,d=u.x+k,_=u.y+k,m=d+c,p=_+f;let y=v(this._height);y<=0&&(y=p-_),yL(t.width)?.5*v(t.width(c,f,d)):r;this._dynamicPropertyMap.set("_halfWidth",n),L(t.cap)?this._dynamicPropertyMap.set("_capType",t.cap):this._capType=t.cap,L(t.join)?this._dynamicPropertyMap.set("_joinType",t.join):this._joinType=t.join;const a=t.color;if(L(a)){const c=(f,d,_)=>$(a(f,d,_));this._dynamicPropertyMap.set("_fillColor",c)}else this._fillColor=a&&$(a)||0;const o=t.miterLimit;if(L(o)){const c=(f,d,_)=>be(o(f,d,_));this._dynamicPropertyMap.set("_miterLimitCosine",c)}else this._miterLimitCosine=be(o);if(t.effects!=null){const c=t.effects;L(c)?this._dynamicPropertyMap.set("_effects",c):this._effects=c}this._scaleFactor=t.scaleFactor||1,this._isDashed=t.dashTemplate!=null;const h=t.colorLocked?it:0,l=t.scaleDash?Ji:0,u=t.sampleAlphaOnly?ie:0;this.tessellationProperties._bitset=h|l|u,this._materialKey=t.materialKey,this._initializeTessellator(!0)}static fromCIMLine(t,e){const[i,r]=at(t.scaleInfo,e);return new wr(t,i,r)}bindFeature(t,e,i){const r=t.readLegacyFeature();this._dynamicPropertyMap.forEach((u,c)=>{this[c]=u(r,e,i)}),this._halfWidth*=this._scaleFactor;const n=this._materialCache,a=(0,this._cimLineLayer.materialHash)(r,e,i),o=n.get(a);let h=null;if(o&&F(o.spriteMosaicItem)&&(h=o.spriteMosaicItem),h){this._hasPattern=!0;const{rect:u,width:c,height:f}=h,d=u.x+k,_=u.y+k,m=d+c,p=_+f;this.tessellationProperties._tl=M(d,_),this.tessellationProperties._br=M(m,p)}else this._hasPattern=!1,this.tessellationProperties._tl=0,this.tessellationProperties._br=0;this.tessellationProperties._fillColor=this._fillColor,this.tessellationProperties._halfWidth=this._halfWidth,this.tessellationProperties.offset=0,this.tessellationProperties._halfReferenceWidth=this.tessellationProperties._halfWidth;const l=rt.load(this._materialKey);h&&(l.sdf=h.sdf,l.pattern=!0,l.textureBinding=h.textureBinding),this._materialKey=l.data}};const bn=Mt(),Sn=Q();let Ln=class br extends _r(ue){constructor(t,e,i){super(t),this._cimMarkerLayer=t,this._minMaxZoom=M(Math.round(e*E),Math.round(i*E));const r=t.color;if(L(r)){const f=(d,_,m)=>$(r(d,_,m));this._dynamicPropertyMap.set("_fillColor",f)}else this._fillColor=$(r);const n=t.outlineColor;if(L(n)){const f=(d,_,m)=>$(n(d,_,m));this._dynamicPropertyMap.set("_outlineColor",f)}else this._outlineColor=$(n);const a=t.size;if(L(a)){const f=(d,_,m)=>v(a(d,_,m));this._dynamicPropertyMap.set("_size",f)}else this._size=v(a)||0;const o=t.scaleX;L(o)?this._dynamicPropertyMap.set("_scaleX",o):this._scaleX=o;const h=t.offsetX;if(L(h)){const f=(d,_,m)=>v(h(d,_,m));this._dynamicPropertyMap.set("xOffset",f)}else this.xOffset=v(h)||0;const l=t.offsetY;if(L(l)){const f=(d,_,m)=>v(l(d,_,m));this._dynamicPropertyMap.set("yOffset",f)}else this.yOffset=v(l)||0;const u=t.outlineWidth;if(L(u)){const f=(d,_,m)=>v(u(d,_,m));this._dynamicPropertyMap.set("_outlineWidth",f)}else this._outlineWidth=v(u)||0;const c=t.rotation;if(L(c)?this._dynamicPropertyMap.set("_angle",c):this._angle=c||0,t.effects!=null){const f=t.effects;L(f)?this._dynamicPropertyMap.set("_effects",f):this._effects=f}if(t.markerPlacement!=null){const f=t.markerPlacement;L(f)?this._dynamicPropertyMap.set("_markerPlacement",f):this._markerPlacement=f}this._scaleFactor=t.scaleFactor??1,this._bitSet=(t.alignment===K.MAP?Yi:qi)|(t.colorLocked?it:0)|(t.scaleSymbolsProportionally?ji:0),this._materialKey=t.materialKey}static fromCIMMarker(t,e){const[i,r]=at(t.scaleInfo,e);return new br(t,i,r)}bindFeature(t,e,i){const r=t.readLegacyFeature(),n=t.getObjectId();this._dynamicPropertyMap.forEach((Y,ft)=>{this[ft]=Y(r,e,i)});const a=this._cimMarkerLayer.materialHash,o=typeof a=="function"?a(r,e,i,n):a,h=this._materialCache.get(o);if(!h||!F(h.spriteMosaicItem)||!h.spriteMosaicItem)return void St.getLogger("esri.views.2d.engine.webgl.WGLDynamicMarkerTemplate").error(new bt("mapview-cim","Encountered an error when binding feature"));const l=h.spriteMosaicItem,u=this._cimMarkerLayer.sizeRatio,c=l.width/l.height*this._scaleX,f=dt.load(this._materialKey);f.sdf=l.sdf,f.pattern=!0,f.textureBinding=l.textureBinding,this._materialKey=f.data;const d=this._cimMarkerLayer.rotateClockwise?this._angle:-this._angle,_=this._size,m=_*c,p=this.xOffset,y=this.yOffset;this.xOffset*=this._scaleFactor,this.yOffset*=this._scaleFactor;const x=this._cimMarkerLayer.scaleSymbolsProportionally&&this._cimMarkerLayer.frameHeight?this._size/v(this._cimMarkerLayer.frameHeight):1,g=this._outlineWidth*x,w=v(this._cimMarkerLayer.referenceSize);let S=0,T=0;const z=this._cimMarkerLayer.anchorPoint;z&&(this._cimMarkerLayer.isAbsoluteAnchorPoint?this._size&&(S=v(z.x)/(this._size*c),T=v(z.y)/this._size):(S=z.x,T=z.y)),this._anchorX=S,this._anchorY=T,this._sizeOutlineWidth=P(Math.round(Math.min(Math.sqrt(128*m),255)),Math.round(Math.min(Math.sqrt(128*_),255)),Math.round(Math.min(Math.sqrt(128*g),255)),Math.round(Math.min(Math.sqrt(128*w),255))),this.angle=d;const I=Math.round(64*u);this._bitestAndDistRatio=M(this._bitSet,I),this._computeSize(m,_,u,g,this._scaleFactor,l,f.hasSizeVV(),!0),this._applyTransformation(Sn,bn),this.xOffset=p,this.yOffset=y}};function Ke(s){if(s==null)return[];const t=new Array(s.length);for(let e=0;e$(n(p,y,x));this._dynamicPropertyMap.set("_color",m)}else this._color=$(n);const a=t.outlineColor;if(L(a)){const m=(p,y,x)=>$(a(p,y,x));this._dynamicPropertyMap.set("_haloColor",m)}else this._haloColor=$(a);let o;L(t.size)||(o=Math.min(Math.round(v(t.size*t.sizeRatio)),127));const h=(m,p,y)=>L(t.size)?Math.min(Math.round(v(t.size(m,p,y)*t.sizeRatio)),127):o;if(this._dynamicPropertyMap.set("_size",h),L(t.outlineSize)){const m=(p,y,x)=>Math.min(Math.floor(Ri*v(t.outlineSize(p,y,x)*t.sizeRatio)),127);this._dynamicPropertyMap.set("_haloSize",m)}else this._haloSize=Math.min(Math.floor(Ri*v(t.outlineSize*t.sizeRatio)),127);let l;L(t.offsetX)||(l=Math.round(v(t.offsetX*t.sizeRatio)));const u=(m,p,y)=>L(t.offsetX)?Math.round(v(t.offsetX(m,p,y)*t.sizeRatio)):l;let c;this._dynamicPropertyMap.set("_xOffset",u),L(t.offsetY)||(c=Math.round(v(t.offsetY*t.sizeRatio)));const f=(m,p,y)=>L(t.offsetY)?Math.round(v(t.offsetY(m,p,y)*t.sizeRatio)):c;if(this._dynamicPropertyMap.set("_yOffset",f),L(t.angle)?this._dynamicPropertyMap.set("_angle",t.angle):this._angle=t.angle,L(t.horizontalAlignment)?this._dynamicPropertyMap.set("_horizontalAlignment",t.horizontalAlignment):this._horizontalAlignment=t.horizontalAlignment,L(t.verticalAlignment)?this._dynamicPropertyMap.set("_verticalAlignment",t.verticalAlignment):this._verticalAlignment=t.verticalAlignment,t.effects!=null){const m=t.effects;L(m)?this._dynamicPropertyMap.set("_effects",m):this._effects=m}if(t.markerPlacement!=null){const m=t.markerPlacement;L(m)?this._dynamicPropertyMap.set("_markerPlacement",m):this._textPlacement=m}L(t.text)?this._dynamicPropertyMap.set("_text",t.text):this._text=t.text,this._backgroundColor=t.backgroundColor&&$(t.backgroundColor),this._borderLineColor=t.borderLineColor&&$(t.borderLineColor),this._borderLineSize=t.borderLineWidth,this._scaleFactor=r;const d=Math.min(Math.round(v(t.referenceSize*t.sizeRatio)),127);this._referenceSize=Math.round(Math.sqrt(256*d)),this._materialKey=t.materialKey;const _=Ct.load(this._materialKey);_.sdf=!0,this._bitset=(t.alignment===K.MAP?1:0)|(t.colorLocked?1:0)<<1,this._materialKey=_.data,this._decoration="none",this._lineHeight=1,this._lineWidth=512,this._isCIM=!0}static fromCIMText(t,e){const[i,r]=at(t.scaleInfo,e);return new Sr(t,i,r)}async analyze(t,e,i,r){const n=e.readLegacyFeature(),a=Tn(this._cimTextLayer,n,i,r),o=await super.analyze(t,e,i,r,Ke(a));return o!=null&&o.glyphMosaicItems&&this._textToGlyphs.set(a,o.glyphMosaicItems),o}bindFeature(t,e,i){const r=t.readLegacyFeature();if(this._dynamicPropertyMap.forEach((a,o)=>{this[o]=a(r,e,i)}),!this._text||this._text.length===0)return void(this._shapingInfo=null);this._size*=this._scaleFactor,this._scale=this._size/Hi,this._xOffset*=this._scaleFactor,this._yOffset*=this._scaleFactor,this._xAlignD=Ni(this._horizontalAlignment??"center"),this._yAlignD=Ui(this._verticalAlignment??"baseline");const n=this._textToGlyphs.get(this._text)??[];this.bindTextInfo(n,!1)}};class j extends vr(Rt){constructor(t,e,i,r,n,a,o,h,l,u,c,f,d,_,m,p){super(),this._effects=_||void 0;const y=H.load(t);e&&(y.sdf=e.sdf,y.pattern=!0,y.textureBinding=e.textureBinding),this.fillColor=i,this.tl=r,this.br=n,this.aux21=M(a,o),this.aux22=M(h,l),this.aux3=P(u,c,f,0),this._bitset=d,this._minMaxZoom=M(Math.round(m*E),Math.round(p*E)),this._materialKey=y.data}static fromCIMFill(t,e,i){const r=t.color,n=r&&$(r)||0,a=t.materialKey,[o,h]=at(t.scaleInfo,i);let l=(t.colorLocked?it:0)|(t.applyRandomOffset?tr:0)|(t.sampleAlphaOnly?ie:0)|(t.hasUnresolvedReplacementColor?er:0);if(!e)return new j(a,null,n,0,0,0,0,0,0,0,0,0,l,t.effects,o,h);const{rect:u,width:c,height:f}=e,d=t.scaleX||1,_=u.x+k,m=u.y+k,p=_+c,y=m+f,x=v(t.height);let g=d*x;t.cim.type==="CIMHatchFill"&&(g*=c/f);let w=x;w<=0&&(w=y-m),w{const i=new qr(e,t);return new Cn(await i.analyzeSymbolReference(s.data,!1),s.data,s.rendererKey,s.maxVVSize)};async function X(s,t,e,i){if(!s)return null;if(s.type==="cim")return Bi(s,t,e);if(s.type==="web-style"){const{fetchCIMSymbolReference:r}=await ke(()=>import("./webStyleUtils-0RWyEn-J.js"),__vite__mapDeps([0,1,2])),n={type:"cim",data:await r(s,null,i)??void 0,rendererKey:s.rendererKey,maxVVSize:s.maxVVSize};return Bi(n,t,e)}return s}function Ut(s){if(!s)return null;const{avoidSDFRasterization:t,type:e,cim:i,url:r,materialHash:n,maxVVSize:a}=s,o={cim:i,type:e,mosaicHash:n,url:r,size:null,dashTemplate:null,path:null,text:null,fontName:null,animatedSymbolProperties:null,avoidSDFRasterization:t};switch(e){case"marker":a&&"size"in i&&(i.size=Math.max(a,i.size)),o.size=s.size,o.path=s.path,o.animatedSymbolProperties=s.animatedSymbolProperties;break;case"line":o.dashTemplate=s.dashTemplate;break;case"text":o.text=s.text,o.fontName=s.fontName}return o}const R=St.getLogger("esri.views.2d.engine.webgl.mesh.templates.WGLTemplateStore"),Fi={sortKey:null,templates:new Array},Ge={isOutline:!1,placement:null,symbologyType:A.DEFAULT,vvFlags:0},Wn={...Ye,hash:JSON.stringify(Ye),materialKey:he(b.MARKER,Ge)},Vn={...qe,hash:JSON.stringify(qe),materialKey:he(b.LINE,Ge)},kn={...je,hash:JSON.stringify(je),materialKey:he(b.FILL,Ge)};function q(s,t){const e=s.length;return s.push(null),t.then(i=>s[e]=i),s}function $t(s){return s!=null&&!!(1&s)}function An(s){return s.name==="worker:port-closed"}class Rn{constructor(t,e){this._idCounter=1,this._templateIdCounter=1,this._idToTemplateGroup=new Map,this._symbolToTemplate=new Map,this._fetchQueue=[],this._idToResolver=new Map,this._cimTemplateCache=new Map,this._cimAnalyses=[],this._lock=new In,this._fetchResource=t,this._tileInfo=e}get _markerError(){return this._errorTemplates.marker[0]}get _fillError(){return this._errorTemplates.fill[0]}get _lineError(){return this._errorTemplates.line[0]}get _textError(){return this._errorTemplates.line[0]}createTemplateGroup(t,e,i=null){this._initErrorTemplates();const r=t.hash,n=this._symbolToTemplate.get(r);if(n!=null)return n;const a=new Array,o={sortKey:i,templates:a};e&&this._createMeshTemplates(a,e,!0),this._createMeshTemplates(a,t,!1);const h=this._createGroupId(t.type==="expanded-cim"&&Bn(t));return this._idToTemplateGroup.set(h,o),this._symbolToTemplate.set(r,h),h}getTemplateGroup(t){return this._idToTemplateGroup.get(t)??Fi}getDynamicTemplateGroup(t){return this._idToTemplateGroup.has(t)?($t(t)||R.error("mapview-template-store",`Id ${t} does not refer to a dynamic template`),this._idToTemplateGroup.get(t)):Fi}getMosaicItem(t,e){const i=this._createTemplateId(),r=new Promise(n=>this._idToResolver.set(i,n));return this._fetchQueue.push({symbol:t,id:i,glyphIds:e}),r}finalize(t){return this._fetchQueue.length||this._lock.isHeld()?Pn(this._lock,this._fetchAllQueuedResources.bind(this),t):Promise.resolve()}_initErrorTemplates(){this._errorTemplates||(this._errorTemplates={fill:this._createMeshTemplates([],kn,!1),marker:this._createMeshTemplates([],Wn,!1),line:this._createMeshTemplates([],Vn,!1)})}_fetchAllQueuedResources(t){if(!this._fetchQueue.length)return Promise.resolve();const e=this._fetchQueue,i=this._cimAnalyses;return this._fetchQueue=[],this._cimAnalyses=[],Promise.all(i).then(()=>this._fetchResource(e,t).then(r=>{for(const{id:n,mosaicItem:a}of r)this._idToResolver.get(n)(a),this._idToResolver.delete(n)})).catch(r=>{Ae(r)?this._fetchQueue=this._fetchQueue.concat(e):An(r)||R.error(new bt("mapview-template-store","Unable to fetch requested texture resources",r))})}_createGroupId(t){return this._idCounter++<<1|(t?1:0)}_createTemplateId(){return this._templateIdCounter++}async _createSMS(t){const{spriteMosaicItem:e}=await this.getMosaicItem(t);return F(e,R)?It.fromSimpleMarker(t,e):this._markerError}async _createPMS(t){const{spriteMosaicItem:e}=await this.getMosaicItem(t);return F(e,R)?It.fromPictureMarker(t,e):this._markerError}async _createSFS(t,e){const{spriteMosaicItem:i}=await this.getMosaicItem(t);return F(i,R)?j.fromSimpleFill(t,i,e):this._fillError}async _createPFS(t,e){const{spriteMosaicItem:i}=await this.getMosaicItem(t);return F(i,R)?j.fromPictureFill(t,i,e):this._fillError}async _createSLS(t,e){const{spriteMosaicItem:i}=await this.getMosaicItem(t);return F(i,R)?Ce.fromSimpleLine(t,i):this._lineError}async _createLMS(t){const{spriteMosaicItem:e}=await this.getMosaicItem(t);return F(e,R)?It.fromLineSymbolMarker(t,e):this._markerError}async _createTS(t){const{glyphMosaicItems:e}=await this.getMosaicItem(t);return Le.fromText(t,e??[])}async _createCIMText(t){const{glyphMosaicItems:e}=await this.getMosaicItem(Ut(t),Ke(t.text));return F(e,R)?Le.fromCIMText(t,e,this._tileInfo):this._textError}async _createCIMFill(t){const{spriteMosaicItem:e}=await this.getMosaicItem(Ut(t));return F(e,R)?j.fromCIMFill(t,e,this._tileInfo):this._fillError}async _createCIMLine(t){const{spriteMosaicItem:e}=await this.getMosaicItem(Ut(t));return F(e,R)?Ce.fromCIMLine(t,e,this._tileInfo):this._lineError}async _createCIMMarker(t){const{spriteMosaicItem:e}=await this.getMosaicItem(Ut(t));return F(e,R)?It.fromCIMMarker(t,e,this._tileInfo):this._markerError}async _createCIM(t){const e=t.templateHash;let i=this._cimTemplateCache.get(e);if(i!=null)return i;switch(t.type){case"marker":i=await this._createCIMMarker(t);break;case"line":i=await this._createCIMLine(t);break;case"fill":i=await this._createCIMFill(t);break;case"text":i=await this._createCIMText(t)}return this._cimTemplateCache.set(e,i),i}async _createDynamicCIM(t){const e=t.templateHash;let i=this._cimTemplateCache.get(e);if(i!=null)return i;switch(t.type){case"marker":i=Ln.fromCIMMarker(t,this._tileInfo);break;case"line":i=wn.fromCIMLine(t,this._tileInfo);break;case"fill":i=Mn.fromCIMFill(t,this._tileInfo);break;case"text":i=zn.fromCIMText(t,this._tileInfo)}return this._cimTemplateCache.set(e,i),i}_createPrimitiveMeshTemplates(t,e,i){switch(e.type){case"esriSMS":return q(t,this._createSMS(e));case"esriPMS":return q(t,this._createPMS(e));case"esriSFS":return q(t,this._createSFS(e,i));case"line-marker":return q(t,this._createLMS(e));case"esriPFS":return q(t,this._createPFS(e,i));case"esriSLS":return q(t,this._createSLS(e,!1));case"esriTS":return q(t,this._createTS(e));default:return R.error("Unable to create mesh template for unknown symbol type {: $ }{symbol.type}"),t}}_createMeshTemplates(t,e,i){if(e.type.includes("3d"))return R.error("3D symbols are not supported with MapView"),t;if(e.type==="expanded-cim"){for(const r of e.layers)typeof r.materialHash=="function"?q(t,this._createDynamicCIM(r)):q(t,this._createCIM(r));return t}if(e.type==="composite-symbol"){for(const r of e.layers)this._createPrimitiveMeshTemplates(t,r,i);return t}return e.type==="cim"||e.type==="label"||e.type==="web-style"?t:this._createPrimitiveMeshTemplates(t,e,i)}}const Bn=s=>{if(!s.layers)return!1;for(const t of s.layers)if(typeof t.materialHash=="function")return!0;return!1};class Fn{constructor(t,e,i){this._geometryType=t,this._idField=e,this._templateStore=i}update(t,e){t.mesh.labels!=null&&(this._labelTemplates=this._createLabelTemplates(t.mesh.labels,e)),this._schema=t}_createLabelTemplates(t,e){const i=new Map;if(t.type==="simple"){for(const r of t.classes){const n=Qt.fromLabelClass(r,e);i.set(r.index,n)}return i}for(const r in t.classes){const n=t.classes[r];for(const a of n){const o=Qt.fromLabelClass(a,e);i.set(a.index,o)}}return i}get templates(){return this._templateStore}async analyze(t,e,i,r,n,a,o){if(Qe(o))return;let h;(i==null?void 0:i.type)==="dictionary"&&(h=await i.analyze(this._idField,t.copy(),e,n,a,o));let l=0;for(;t.next();){let u=null;if(u=h?h[l++]:r!=null&&Xi(t.getDisplayId())&&t.readAttribute("cluster_count")!==1?r.match(this._idField,t,this._geometryType,n,a):i.match(this._idField,t,this._geometryType,n,a),t.setGroupId(u),$t(u)){const c=this._templateStore.getDynamicTemplateGroup(u).templates;for(const f of c)f&&f.analyze&&f.analyze(this._templateStore,t,n,a)}}return await ti(),this._templateStore.finalize(o)}async analyzeGraphics(t,e,i,r,n,a){if(Qe(a))return;const o=t.getCursor();for(i&&await i.analyze(this._idField,o.copy(),e,r,n,a);o.next();){let h=o.getGroupId();if(h!=null&&h!==-1||(h=i==null?void 0:i.match(this._idField,o,o.geometryType,r,n),o.setGroupId(h)),$t(h)){const l=this._templateStore.getDynamicTemplateGroup(h).templates;for(const u of l)u&&u.analyze&&u.analyze(this._templateStore,o,r,n)}o.setGroupId(h)}return await ti(),this._templateStore.finalize(a)}writeGraphic(t,e,i,r){const n=e.getGroupId(),a=e.getDisplayId(),o=this._templateStore.getTemplateGroup(n);if(t.featureStart(e.insertAfter,0),a!=null){if($t(n))for(const h of o.templates)h&&h.bindFeature(e,null,null);if(o){for(const h of o.templates)h&&h.write(t,e,i,r);t.featureEnd()}}}writeCursor(t,e,i,r,n,a,o){const h=e.getGroupId(),l=e.getDisplayId(),u=this._templateStore.getTemplateGroup(h),c=u.templates,f=this._getSortKeyValue(e,u);if(t.featureStart(0,f),l!=null&&c){if($t(h))for(const d of c)d.bindFeature(e,i,r);for(const d of c)d.write(t,e,n,o);if(c.length&&a!=null){const d=a&&this._findLabelRef(c);this._writeLabels(t,e,a,d,n,o)}t.featureEnd()}}_getSortKeyValue(t,e){const i=this._schema.mesh.sortKey;if(i==null)return 0;let r=0;return r=i.byRenderer===!0&&e.sortKey!=null?e.sortKey:i.fieldIndex!=null?t.getComputedNumericAtIndex(i.fieldIndex):i.field!=null?t.readAttribute(i.field):t.readAttribute(this._idField),r*=i.order==="asc"?1:-1,r==null||isNaN(r)?0:r}_findLabelRef(t){for(const e of t)if(e instanceof It)return e;return null}_writeLabels(t,e,i,r,n,a){for(const o of i)if(o!=null&&o){const{glyphs:h,rtl:l,index:u}=o,c=this._labelTemplates.get(u);if(!c)continue;c.setZoomLevel(n),c.bindReferenceTemplate(r),c.bindTextInfo(h,l),c.write(t,e,null,a)}}}const Ee=St.getLogger("esri/views/2d/engine/webgl/util/Matcher");async function We(s,t,e,i){switch(s.type){case"simple":case"heatmap":return nt.fromBasicRenderer(s,t,e,i);case"map":return Ne.fromUVRenderer(s,t,e,i);case"interval":return Ze.fromCBRenderer(s,t,e,i);case"dictionary":return Ue.fromDictionaryRenderer(s,t,e,i);case"pie-chart":return te.fromPieChartRenderer(s,t,e,i);case"subtype":return te.fromSubtypes(s,t,e,i)}}class nt{constructor(){this.type="feature",this._defaultResult=null}static async fromBasicRenderer(t,e,i,r){const n=new nt;if(t.symbol){const a=await X(t.symbol,i,r),o=e.createTemplateGroup(a,null);n.setDefault(o)}return n}static async fromPieChartRenderer(t,e,i,r){const n=new nt;if(t.markerSymbol){const a=await X(t.markerSymbol,i,r);let o;t.fillSymbol&&(o=await X(t.fillSymbol,i,r));const h=e.createTemplateGroup(a,o);n.setDefault(h)}return n}size(){return 1}getDefault(){return this._defaultResult}setDefault(t){this._defaultResult=t}match(t,e,i,r,n){return this.getDefault()}async analyze(t,e,i,r,n,a){return null}}class te extends nt{constructor(t,e){super(),this._subMatchers=t,this._subtypeField=e}static async fromSubtypes(t,e,i,r){const n=new Map,a=[];for(const o in t.renderers){const h=parseInt(o,10),l=We(t.renderers[o],e,i,r).then(u=>n.set(h,u));a.push(l)}return await Promise.all(a),new te(n,t.subtypeField)}match(t,e,i,r,n){const a=e.readAttribute(this._subtypeField),o=this._subMatchers.get(a);return o?o.match(t,e,i,r,n):null}}class Ze extends nt{constructor(t,e,i,r){super(),this.type="interval",this._intervals=[],this._isMaxInclusive=e,this._fieldIndex=r,this._field=t,this._normalizationInfo=i}static async fromCBRenderer(t,e,i,r){const{isMaxInclusive:n,normalizationField:a,normalizationTotal:o,normalizationType:h}=t,l=t.field,u=new Ze(l,n,{normalizationField:a,normalizationTotal:o,normalizationType:h},t.fieldIndex),c=await X(t.backgroundFillSymbol,i,r);await Promise.all(t.intervals.map(async d=>{const _=await X(d.symbol,i,r),m=e.createTemplateGroup(_,c),p={min:d.min,max:d.max};u.add(p,m)}));const f=await X(t.defaultSymbol,i,r);if(f){const d=e.createTemplateGroup(f,c);u.setDefault(d)}return u}add(t,e){this._intervals.push({interval:t,result:e}),this._intervals.sort((i,r)=>i.interval.min-r.interval.min)}size(){return super.size()+this._intervals.length}match(t,e,i,r,n){if(this._fieldIndex==null&&!this._field)return this.getDefault();const a=this._fieldIndex!=null?e.getComputedNumericAtIndex(this._fieldIndex):this._getValueFromField(e);if(a==null||isNaN(a)||a===1/0||a===-1/0)return this.getDefault();for(let o=0;o=h.min,c=this._isMaxInclusive?a<=h.max:a{const f=await X(u.symbol,i,r),d=c+1,_=e.createTemplateGroup(f,o,d);u.value===""?h.setNullResult(_):h.add(u.value,_)}));const l=await X(t.defaultSymbol,i,r);if(l){const u=Number.MAX_SAFE_INTEGER,c=e.createTemplateGroup(l,o,u);h.setDefault(c)}return h}setNullResult(t){this._nullResult=t}add(t,e){this._resultsMap.set(t.toString(),e)}size(){return super.size()+this._resultsMap.size}match(t,e,i,r,n){if(this._fieldsIndex==null&&!this._fields)return this.getDefault();const a=this._fieldsIndex!=null?e.getComputedStringAtIndex(this._fieldsIndex):this._getValueFromFields(e);if(this._nullResult!==null&&(a==null||a===""||a===""))return this._nullResult;if(a==null)return this.getDefault();const o=a.toString();return this._resultsMap.has(o)?this._resultsMap.get(o):this.getDefault()}_getValueFromFields(t){const e=[];for(const i of this._fields){const r=t.readAttribute(i);r==null||r===""?e.push(""):e.push(r)}return e.join(this._seperator)}}async function On(s,t){const e=s||1;if(typeof e=="number")return(r,n,a)=>e;const i=await kr(e,t.spatialReference,t.fields);return(r,n,a)=>Ar(i,r,{$view:a},t.geometryType,n)||1}let _e;async function Dn(){return _e||(_e=ke(()=>import("./createSymbolSchema-cxObHUlP.js"),__vite__mapDeps([3,4,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]))),_e}class Ue extends nt{constructor(t,e,i,r,n,a){super(),this.type="dictionary",this._groupIdCache=new Wr(100),this._loader=t,this._fieldMap=t.fieldMap,this._symbolFields=t.getSymbolFields(),this._templates=e,this._info=i,this._scaleFn=r,this._schemaUtilsModule=n,this._symbolOptions=a}static async fromDictionaryRenderer(t,e,i,r){const[{DictionaryLoader:n},a]=await Promise.all([ke(()=>import("./index-pCX-0tJH.js").then(l=>l.zU),__vite__mapDeps([1,2])),Dn()]),o=new n(t.url,t.config,t.fieldMap);await o.fetchResources({spatialReference:i.spatialReference,fields:i.fields});const h=await On(t.scaleExpression,i);return new Ue(o,e,i,h,a,t.symbolOptions)}async _analyzeFeature(t,e,i,r,n){const a=t.readLegacyFeature(),o=this._scaleFn(a,i,r),h=this._attributeHash(a)+"-"+o,l=this._groupIdCache.get(h);if(l)return l;const u={...r,spatialReference:this._info.spatialReference,abortOptions:n,fields:this._info.fields},c=await this._loader.getSymbolAsync(a,u),f=this._schemaUtilsModule.createSymbolSchema(c,this._symbolOptions),d=X(f,this._info,e,n).then(_=>{if((_==null?void 0:_.type)!=="expanded-cim")return Ee.error(new bt("mapview-bad-type",`Found unexpected type ${_==null?void 0:_.type} in dictionary response`)),null;_.hash+="-"+o;for(const m of _.layers)m.scaleFactor=o,m.templateHash+="-"+o;return this._templates.createTemplateGroup(_,null)});return this._groupIdCache.put(h,d,1),d}async analyze(t,e,i,r,n,a){const o=e.getCursor(),h=[];for(;o.next();)h.push(this._analyzeFeature(o,i,r,n,a));return Promise.all(h).then(l=>l.filter(Vr))}match(t,e,i,r,n){return null}_attributeHash(t){var i;let e="";for(const r of this._symbolFields){const n=(i=this._fieldMap)==null?void 0:i[r];n&&(e+=t.attributes[n]+"-")}return e}}class Kn{constructor(t){this._remoteClient=t,this._resourceMap=new Map,this._inFlightResourceMap=new Map,this.geometryEngine=null,this.geometryEnginePromise=null}destroy(){}async fetchResource(t,e){const i=this._resourceMap,r=i.get(t);if(r)return r;let n=this._inFlightResourceMap.get(t);if(n)return n;try{n=this._remoteClient.invoke("tileRenderer.fetchResource",{url:t},{...e}),this._inFlightResourceMap.set(t,n),n.then(a=>(this._inFlightResourceMap.delete(t),i.set(t,a),a))}catch(a){return Ae(a)?null:{width:0,height:0}}return n}getResource(t){return this._resourceMap.get(t)??null}loadFont(t){return Promise.resolve(null)}}function Oi(s,t){const e=t-t/4,i=t+t/2;return(!s.minScale||s.minScale>=e)&&(!s.maxScale||s.maxScale<=i)}function Di(s){var i;const t=s.message,e={message:{data:{},tileKey:t.tileKey,tileKeyOrigin:t.tileKeyOrigin,version:t.version},transferList:new Array};for(const r in t.data){const n=r,a=t.data[n];if(e.message.data[n]=null,a!=null){const o=a.stride,h=a.indices.slice(0),l=a.vertices.slice(0),u=a.records.slice(0),c=(i=a.metrics)==null?void 0:i.slice(0),f={stride:o,indices:h,vertices:l,records:u,metrics:c};e.transferList.push(h,l,u),e.message.data[n]=f}}return e}let Ve=class extends hs{constructor(){super(...arguments),this.type="symbol",this._matchers={feature:null,aggregate:null},this._bufferData=new Map,this._bufferIds=new Map}initialize(){this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this))]),this._resourceManagerProxy=new Kn(this.remoteClient)}destroy(){this._resourceManagerProxy.destroy()}get supportsTileUpdates(){return!0}forEachBufferId(s){this._bufferIds.forEach(t=>{t.forEach(s)})}async update(s,t){var r;const e=t.schema.processors[0];if(e.type!=="symbol")return;const i=Fr(this._schema,e);(Je(i,"mesh")||Je(i,"target"))&&(s.mesh=!0,(r=s.why)==null||r.mesh.push("Symbology changed"),this._schema=e,this._factory=this._createFactory(e),this._factory.update(e,this.tileStore.tileScheme.tileInfo))}onTileMessage(s,t,e,i){return Lt(i),this._onTileData(s,t,e,i)}onTileClear(s,t){const e={clear:!0,end:t};return this._bufferData.delete(s.key.id),this._bufferIds.delete(s.key.id),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:s.id,data:e})}onTileError(s,t,e){const i=e.signal,r={tileKey:s.id,error:t};return this.remoteClient.invoke("tileRenderer.onTileError",r,{signal:i})}onTileUpdate(s){for(const t of s.removed)this._bufferData.has(t.key.id)&&this._bufferData.delete(t.key.id),this._bufferIds.has(t.key.id)&&this._bufferIds.delete(t.key.id);for(const t of s.added)this._bufferData.forEach(e=>{for(const i of e)i.message.tileKey===t.id&&this._updateTileMesh("append",t,Di(i),[],!1,!1,null)})}_addBufferData(s,t){var e;this._bufferData.has(s)||this._bufferData.set(s,[]),(e=this._bufferData.get(s))==null||e.push(Di(t))}_createFactory(s){const{geometryType:t,objectIdField:e,fields:i}=this.service,r=(l,u)=>this.remoteClient.invoke("tileRenderer.getMaterialItems",l,u),n={geometryType:t,fields:i,spatialReference:Or.fromJSON(this.spatialReference)},a=new Rn(r,this.tileStore.tileScheme.tileInfo),{matcher:o,aggregateMatcher:h}=s.mesh;return this._store=a,this._matchers.feature=We(o,a,n,this._resourceManagerProxy),this._matchers.aggregate=h?We(h,a,n,this._resourceManagerProxy):null,new Fn(t,e,a)}async _onTileData(s,t,e,i){var c;Lt(i);const{type:r,addOrUpdate:n,remove:a,clear:o,end:h}=t,l=!!this._schema.mesh.sortKey;if(!n){const f={type:r,addOrUpdate:null,remove:a,clear:o,end:h,sort:l};return this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:s.id,data:f},i)}const u=this._processFeatures(s,n,e,i,(c=t.status)==null?void 0:c.version);try{const f=await u;if(f==null){const _={type:r,addOrUpdate:null,remove:a,clear:o,end:h,sort:l};return this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:s.id,data:_},i)}const d=[];for(const _ of f){let m=!1;const p=_.message.bufferIds,y=s.key.id,x=_.message.tileKey;if(y!==x&&p!=null){if(!this.tileStore.get(x)){this._addBufferData(y,_),d.push(_);continue}let g=this._bufferIds.get(x);g||(g=new Set,this._bufferIds.set(x,g));const w=Array.from(p);for(const S of w){if(g.has(S)){m=!0;break}g.add(S)}}m||(this._addBufferData(y,_),d.push(_))}await Promise.all(d.map(_=>{const m=s.key.id===_.message.tileKey,p=m?t.remove:[],y=m&&t.end;return this._updateTileMesh(r,s,_,p,y,!!t.clear,i.signal)}))}catch(f){this._handleError(s,f,i)}}async _updateTileMesh(s,t,e,i,r,n,a){const o=s,h=e.message.tileKey,l=!!this._schema.mesh.sortKey;h!==t.key.id&&(r=!1);const u=e==null?void 0:e.message,c={type:o,addOrUpdate:u,remove:i,clear:n,end:r,sort:l},f={transferList:(e==null?void 0:e.transferList)??[],signal:a};return Lt(f),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:h,data:c},f)}async _processFeatures(s,t,e,i,r){if(t==null||!t.hasFeatures)return null;const n={transform:s.transform,hasZ:!1,hasM:!1},a=this._factory,o={viewingMode:"",scale:s.scale},h=await this._matchers.feature,l=await this._matchers.aggregate;Lt(i);const u=this._getLabelInfos(s,t);return await a.analyze(t.getCursor(),this._resourceManagerProxy,h,l,n,o),Lt(i),this._writeFeatureSet(s,t,n,u,a,e,r)}_writeFeatureSet(s,t,e,i,r,n,a){const o=t.getSize(),h=this._schema.mesh.matcher.symbologyType,l=new bs(s.key.id,{features:o,records:o,metrics:0},h,n,h!==A.HEATMAP,a),u={viewingMode:"",scale:s.scale},c=t.getCursor();for(;c.next();)try{const d=c.getDisplayId(),_=i!=null?i.get(d):null;r.writeCursor(l,c,e,u,s.level,_,this._resourceManagerProxy)}catch{}const f=s.tileInfoView.tileInfo.isWrappable;return l.serialize(f)}_handleError(s,t,e){if(!Ae(t)){const i={tileKey:s.id,error:t.message};return this.remoteClient.invoke("tileRenderer.onTileError",i,{signal:e.signal})}return Promise.resolve()}_getLabelingSchemaForScale(s){const t=this._schema.mesh.labels;if(t==null)return null;if(t.type==="subtype"){const i={type:"subtype",classes:{}};let r=!1;for(const n in t.classes){const a=t.classes[n].filter(o=>Oi(o,s.scale));r=r||!!a.length,i.classes[n]=a}return r?i:null}const e=t.classes.filter(i=>Oi(i,s.scale));return e.length?{type:"simple",classes:e}:null}_getLabels(s,t){if(t.type==="subtype"){const e=this.service.subtypeField;Dr(e,"Expected to find subtype Field");const i=s.readAttribute(e);return i==null?[]:t.classes[i]??[]}return t.classes}_getLabelInfos(s,t){const e=this._getLabelingSchemaForScale(s);if(e==null)return null;const i=new Map,r=t.getCursor();for(;r.next();){const n=r.getDisplayId(),a=[],o=Xi(n),h=o&&r.readAttribute("cluster_count")!==1?"aggregate":"feature",l=this._getLabels(r,e);for(const u of l){if(u.target!==h)continue;const c=r.getStorage(),f=o&&h==="feature"?c.getComputedStringAtIndex(r.readAttribute("referenceId"),u.fieldIndex):c.getComputedStringAtIndex(n,u.fieldIndex);if(!f)continue;const d=ye(f.toString()),_=d[0],m=d[1];this._store.getMosaicItem(u.symbol,Ke(_)).then(p=>{a[u.index]={glyphs:p.glyphMosaicItems??[],rtl:m,index:u.index}})}i.set(n,a)}return i}};Ve=Rr([Br("esri.views.2d.layers.features.processors.SymbolProcessor")],Ve);const Gn=Ve,xa=Object.freeze(Object.defineProperty({__proto__:null,default:Gn},Symbol.toStringTag,{value:"Module"}));export{ha as A,xa as S,ar as _,he as f}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/webStyleUtils-0RWyEn-J.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/createSymbolSchema-cxObHUlP.js","assets/cimAnalyzer-X6MTpVAO.js","assets/labelPoint-1MOq4I_J.js","assets/TileClipper-NSFZXMR1.js","assets/definitions-SVBNHUSH.js","assets/number-sTjsTbdA.js","assets/BidiEngine-8z8MVveq.js","assets/enums-uQoFEhYh.js","assets/Pipeline-PlEwhMAg.js","assets/QueryEngine-uvDs-vBe.js","assets/WhereClause-FOYoIAAW.js","assets/TimeOnly-gkehHHJx.js","assets/json-v6EOeNTY.js","assets/QueryEngineCapabilities-PzVpW5yD.js","assets/utils-jVYIoPxv.js","assets/generateRendererUtils-3JJTfr19.js","assets/StreamFeatureManager-Iguqr18K.js","assets/quickselect-0UUnLNDW.js","assets/ogcFeatureUtils-8dWL_GtH.js","assets/geojson-162a_hNo.js","assets/date-be_IQzZd.js","assets/clientSideDefaults-63pOkJ4Y.js","assets/createConnection-iXdhuUHv.js","assets/geohashUtils-U0jvYCSY.js","assets/BaseProcessor-yc_MfkjR.js","assets/TurboLine-cWldrV9L.js","assets/Rect-bBBxMtVp.js","assets/GeometryUtils-K2DOc0l8.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/SymbolProcessor-pXDjnfSh.js b/dist/assets/SymbolProcessor-pXDjnfSh.js deleted file mode 100644 index 721e439..0000000 --- a/dist/assets/SymbolProcessor-pXDjnfSh.js +++ /dev/null @@ -1,7 +0,0 @@ -import{uX as Ki,uW as Mt,wp as Q,wq as ee,wr as me,ws as Xe,gO as v,hL as et,wt as gt,wu as Xt,wv as pe,pa as Ir,E as bt,l1 as Pr,ww as K,Z as St,bm as Gi,wx as $r,wy as Bt,e_ as Cr,kk as He,me as Ft,wz as L,bH as Er,de as ke,wA as Ye,wB as qe,wC as je,f as Ae,g as Qe,gu as Wr,e3 as Vr,ve as kr,wD as Ar,e as Rr,c as Br,c4 as Fr,vd as Je,s as Lt,ar as Or,iZ as Dr}from"./index-J0iiHjMT.js";import{c as Kr,i as Zi,g as Gr,f as Zr,s as Nr,h as Ni,k as Ui,m as ye,o as Ur,p as Xr,q as Hr,V as Yr,j as qr}from"./cimAnalyzer-DtyBzAGI.js";import{f as jr,R as xe,k as Qr,G as Jr,p as Xi}from"./Pipeline--6jAENf8.js";import{E as b,S as A,L as G,A as Ot}from"./enums-uQoFEhYh.js";import{d as ge,f as ts,c as ut,w as es,b as Hi,m as E,q as is,g as k,h as rs,n as Yi,l as qi,p as it,i as ss,x as ji,j as Qi,$ as ns,k as as,o as Ji,s as ie,u as tr,v as er,y as tt,z as W,A as Ht,B as Yt}from"./definitions-DqQMJYPH.js";import{o as os,p as hs}from"./BaseProcessor-nWGHAt7P.js";import{r as ls,c as cs,i as ti}from"./TurboLine-SWK4qRwh.js";import{x as P,w as M}from"./number-sTjsTbdA.js";import{a as re}from"./labelPoint-ysDT9nFH.js";import{t as us}from"./Rect-bBBxMtVp.js";import{c as ve}from"./GeometryUtils-K2DOc0l8.js";import{e as ir,t as rr}from"./TileClipper-NSFZXMR1.js";function $(s){if(!s)return 0;const{r:t,g:e,b:i,a:r}=s;return P(t*r,e*r,i*r,255*r)}function O(s){if(!s)return 0;const[t,e,i,r]=s;return P(t*(r/255),e*(r/255),i*(r/255),r)}let zt=class Me{constructor(t,e,i,r){this.center=Ki(t,e),this.centerT=Mt(),this.halfWidth=i/2,this.halfHeight=r/2,this.width=i,this.height=r}get x(){return this.center[0]}get y(){return this.center[1]}get blX(){return this.center[0]+this.halfWidth}get blY(){return this.center[1]+this.halfHeight}get trX(){return this.center[0]-this.halfWidth}get trY(){return this.center[1]-this.halfHeight}get xmin(){return this.x-this.halfWidth}get xmax(){return this.x+this.halfWidth}get ymin(){return this.y-this.halfHeight}get ymax(){return this.y+this.halfHeight}set x(t){this.center[0]=t}set y(t){this.center[1]=t}clone(){return new Me(this.x,this.y,this.width,this.height)}serialize(t){return t.writeF32(this.center[0]),t.writeF32(this.center[1]),t.push(this.width),t.push(this.height),t}findCollisionDelta(t,e=4){const i=Math.abs(t.centerT[0]-this.centerT[0]),r=Math.abs(t.centerT[1]-this.centerT[1]),n=(t.halfWidth+this.halfWidth+e)/i,a=(t.halfHeight+this.halfHeight+e)/r,o=Math.min(n,a);return Math.log2(o)}extend(t){const e=Math.min(this.xmin,t.xmin),i=Math.min(this.ymin,t.ymin),r=Math.max(this.xmax,t.xmax)-e,n=Math.max(this.ymax,t.ymax)-i,a=e+r/2,o=i+n/2;this.width=r,this.height=n,this.halfWidth=r/2,this.halfHeight=n/2,this.x=a,this.y=o}static deserialize(t){const e=t.readF32(),i=t.readF32(),r=t.readInt32(),n=t.readInt32();return new Me(e,i,r,n)}};const Re=26,sr=4,ds=Re+sr,fs=Re-6,ei=3,V=8,_s=Math.PI/180,ms=8,ii=1.5;let nr=class{constructor(t,e,i,r){this._rotationT=Q(),this._xBounds=0,this._yBounds=0,this.minZoom=0,this.maxZoom=255,this._bounds=null;const n=i.rect,a=new Float32Array(8);t*=r,e*=r;const o=i.code?n.width*r:i.metrics.width,h=i.code?n.height*r:i.metrics.height;this.width=o,this.height=h,a[0]=t,a[1]=e,a[2]=t+o,a[3]=e,a[4]=t,a[5]=e+h,a[6]=t+o,a[7]=e+h,this._data=a,this._setTextureCoords(n),this._scale=r,this._mosaic=i,this.x=t,this.y=e,this.maxOffset=Math.max(t+o,e+h)}get mosaic(){return this._mosaic}set angle(t){this._angle=t,ee(this._rotationT,-t),this._setOffsets(this._data)}get angle(){return this._angle}get xTopLeft(){return this._data[0]}get yTopLeft(){return this._data[1]}get xBottomRight(){return this._data[6]}get yBottomRight(){return this._data[7]}get texcoords(){return this._texcoords}get textureBinding(){return this._mosaic.textureBinding}get offsets(){return this._offsets||this._setOffsets(this._data),this._offsets}get char(){return String.fromCharCode(this._mosaic.code)}get code(){return this._mosaic.code}get bounds(){if(!this._bounds){const{height:t,width:e}=this._mosaic.metrics,i=e*this._scale,r=Math.abs(t)*this._scale,n=new Float32Array(8);n[0]=this.x,n[1]=this.y,n[2]=this.x+i,n[3]=this.y,n[4]=this.x,n[5]=this.y+r,n[6]=this.x+i,n[7]=this.y+r;const a=me(Q(),this._rotationT,this._transform);Xe(n,n,a);let o=1/0,h=1/0,l=0,u=0;for(let m=0;m<4;m++){const p=n[2*m],y=n[2*m+1];o=Math.min(o,p),h=Math.min(h,y),l=Math.max(l,p),u=Math.max(u,y)}const c=l-o,f=u-h,d=o+c/2,_=h+f/2;this._bounds=new zt(d,_,c,f)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}_setOffsets(t){this._offsets||(this._offsets={upperLeft:0,upperRight:0,lowerLeft:0,lowerRight:0});const e=this._offsets,i=new Float32Array(8),r=me(Q(),this._rotationT,this._transform);Xe(i,t,r),e.upperLeft=M(i[0]*V,i[1]*V),e.upperRight=M(i[2]*V,i[3]*V),e.lowerLeft=M(i[4]*V,i[5]*V),e.lowerRight=M(i[6]*V,i[7]*V)}_setTextureCoords({x:t,y:e,width:i,height:r}){this._texcoords={upperLeft:M(t,e),upperRight:M(t+i,e),lowerLeft:M(t,e+r),lowerRight:M(t+i,e+r)}}};const ps=(s,t)=>({code:0,page:0,sdf:!0,rect:new us(0,0,11,8),textureBinding:t,metrics:{advance:0,height:4,width:s,left:0,top:0}});function Tt(s,t){return s.forEach(e=>gt(e,e,t)),{upperLeft:M(V*s[0][0],V*s[0][1]),upperRight:M(V*s[1][0],V*s[1][1]),lowerLeft:M(V*s[2][0],V*s[2][1]),lowerRight:M(V*s[3][0],V*s[3][1])}}let ys=class{constructor(t,e,i){this._rotation=0,this._decorate(t,e,i),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=e.length>1,this._hasRotation=i.angle!==0,this._transform=this._createGlyphTransform(this.bounds,i),this._borderLineSize=i.borderLineSize,(i.borderLineSize||i.hasBackground)&&([this.bounds,this.background]=this.shapeBackground(this._transform));for(const r of t)r.setTransform(this._transform)}setRotation(t){if(t===0&&this._rotation===0)return;this._rotation=t;const e=this._transform,i=ee(Q(),t);me(e,i,e);for(const r of this.glyphs)r.setTransform(this._transform)}_decorate(t,e,i){if(!i.decoration||i.decoration==="none"||!t.length)return;const r=i.scale,n=i.decoration==="underline"?ds:fs,a=t[0].textureBinding;for(const o of e){const h=o.startX*r,l=o.startY*r,u=(o.width+o.glyphWidthEnd)*r;t.push(new nr(h,l+n*r,ps(u,a),1))}}shapeBackground(t){const e=ms,{xmin:i,ymin:r,xmax:n,ymax:a,x:o,y:h,width:l,height:u}=this.bounds,c=Math.min(l,u)+2*e-ii,f=Math.min(v(this._borderLineSize||0),c),d=(ii+f)/2,_=this._borderLineSize?d:0,m=[i-e,r-e],p=[n+e,r-e],y=[i-e,a+e],x=[n+e,a+e],g=Tt([[m[0]-d,m[1]-d],[p[0]+d,p[1]-d],[m[0]+_,m[1]+_],[p[0]-_,p[1]+_]],t),w=Tt([[y[0]+_,y[1]-_],[x[0]-_,x[1]-_],[y[0]-d,y[1]+d],[x[0]+d,x[1]+d]],t),S=Tt([[m[0]-d,m[1]-d],[m[0]+_,m[1]+_],[y[0]-d,y[1]+d],[y[0]+_,y[1]-_]],t),T=Tt([[p[0]-_,p[1]+_],[p[0]+d,p[1]-d],[x[0]-_,x[1]-_],[x[0]+d,x[1]+d]],t),z={main:Tt([m,p,y,x],t),top:g,bot:w,left:S,right:T};return[new zt(o,h,l+2*d,u+2*d),z]}get boundsT(){const t=this.bounds,e=et(Mt(),t.x,t.y);if(gt(e,e,this._transform),this._hasRotation){const i=Math.max(t.width,t.height);return new zt(e[0],e[1],i,i)}return new zt(e[0],e[1],t.width,t.height)}_createBounds(t){let e=1/0,i=1/0,r=0,n=0;for(const h of t)e=Math.min(e,h.xTopLeft),i=Math.min(i,h.yTopLeft),r=Math.max(r,h.xBottomRight),n=Math.max(n,h.yBottomRight);const a=r-e,o=n-i;return new zt(e+a/2,i+o/2,a,o)}_createGlyphTransform(t,e){const i=_s*e.angle,r=Q(),n=Mt();return Xt(r,r,et(n,e.xOffset,-e.yOffset)),e.isCIM?pe(r,r,i):(Xt(r,r,et(n,t.x,t.y)),pe(r,r,i),Xt(r,r,et(n,-t.x,-t.y))),r}},Dt=class{constructor(t,e,i,r,n,a){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(e,i)),this.end=Math.max(0,Math.max(e,i)),this.ends===10,ri=s=>s===32;function xs(s,t,e){const i=new Array,r=1/e.scale,n=e.maxLineWidth*r,a=t?s.length-1:0,o=t?-1:s.length,h=t?-1:1;let l=a,u=0,c=0,f=l,d=f,_=0,m=1/0,p=0;for(;l!==o;){const{code:x,metrics:g}=s[l],w=Math.abs(g.top);if(we(x)||ri(x)||(m=Math.min(m,w),p=Math.max(p,w+g.height)),we(x))l!==a&&(i.push(new Dt(s,f,l-h,u,m,p)),m=1/0,p=0),u=0,f=l+h,d=l+h,c=0;else if(ri(x))d=l+h,c=0,_=g.advance,u+=g.advance;else if(u>n){if(d!==f){const S=d-2*h;u-=_,i.push(new Dt(s,f,S,u-c,m,p)),m=1/0,p=0,f=d,u=c}else i.push(new Dt(s,f,l-h,u,m,p)),m=1/0,p=0,f=l,d=l,u=0;u+=g.advance,c+=g.advance}else u+=g.advance,c+=g.advance;l+=h}const y=new Dt(s,f,l-h,u,m,p);return y.start>=0&&y.end=this._buffer.length){const e=this._roundToNearest((this._array.byteLength+t*this._buffer.BYTES_PER_ELEMENT)*ws,this._buffer.BYTES_PER_ELEMENT),i=new ArrayBuffer(e),r=new this._ctor(i);r.set(this._buffer,0),this._array=i,this._buffer=r,this._i16View=new Int16Array(this._array)}}ensureSize(t){this._ensureSize(t)}writeF32(t){this._ensureSize(1);const e=this._pos;return new Float32Array(this._array,4*this._pos,1)[0]=t,this._pos++,e}push(t){this._ensureSize(1);const e=this._pos;return this._buffer[this._pos++]=t,e}writeFixed(t){this._buffer[this._pos++]=t}setValue(t,e){this._buffer[t]=e}i1616Add(t,e,i){this._i16View[2*t]+=e,this._i16View[2*t+1]+=i}getValue(t){return this._buffer[t]}incr(t){if(this._buffer.length{const n=1<=ut-i?oi:hi|oi)|(e<0+r?ci:e>=ut-r?li:ci|li));this._current.overlaps|=n}_getVertexWriter(t){if(!this._data.self.has(t)){const e=this._data.self,i=xe(t,this._symbologyType).geometry;e.set(t,new si(t,i,this.hint.records))}return this._data.self.get(t)}};function Ss(s,t,e){const i=G.SIZE_FIELD_STOPS|G.SIZE_MINMAX_VALUE|G.SIZE_SCALE_STOPS|G.SIZE_UNIT_VALUE,r=(t&(Ot.FIELD_TARGETS_OUTLINE|Ot.MINMAX_TARGETS_OUTLINE|Ot.SCALE_TARGETS_OUTLINE|Ot.UNIT_TARGETS_OUTLINE))>>>4;return s===b.LINE&&e.isOutline||s===b.FILL&&ar(e.symbologyType)?i&r:i&~r}const ui=0,di=8,Ls=7,fi=8,_i=11,mi=11,pi=12,yi=13,xi=14,gi=15,vi=16,Mi=17,wi=18,bi=19,Si=20,Li=21,Ti=26,Ts=Object.keys(A).filter(s=>typeof A[s]=="number").reduce((s,t)=>({...s,[t]:A[t]}),{});function zs(s){return s===A.SIMPLE||s===A.OUTLINE_FILL_SIMPLE}function ar(s){return s===A.OUTLINE_FILL||s===A.OUTLINE_FILL_SIMPLE}function or(s){return zs(s.symbologyType)}function qt(s){return ar(s.symbologyType)}function he(s,t){switch(s){case b.FILL:return H.from(t);case b.LINE:return rt.from(t);case b.MARKER:return dt.from(t);case b.TEXT:return Ct.from(t);case b.LABEL:return ct.from(t);default:throw new Error(`Unable to createMaterialKey for unknown geometryType ${s}`)}}function ha(s){switch(Z.load(s).geometryType){case b.MARKER:return new dt(s);case b.FILL:return new H(s);case b.LINE:return new rt(s);case b.TEXT:return new Ct(s);case b.LABEL:return new ct(s)}}class Z{static load(t){const e=this.shared;return e.data=t,e}constructor(t){this._data=0,this._data=t}set data(t){this._data=t??0}get data(){return this._data}get geometryType(){return this.bits(fi,_i)}set geometryType(t){this.setBits(t,fi,_i)}get mapAligned(){return!!this.bit(Si)}set mapAligned(t){this.setBit(Si,t)}get sdf(){return!!this.bit(mi)}set sdf(t){this.setBit(mi,t??!1)}get pattern(){return!!this.bit(pi)}set pattern(t){this.setBit(pi,t)}get textureBinding(){return this.bits(ui,di)}set textureBinding(t){this.setBits(t,ui,di)}get symbologyType(){return this.bits(Li,Ti)}set symbologyType(t){this.setBits(t,Li,Ti)}get geometryTypeString(){switch(this.geometryType){case b.FILL:return"fill";case b.MARKER:return"marker";case b.LINE:return"line";case b.TEXT:return"text";case b.LABEL:return"label";default:throw new bt(`Unable to handle unknown geometryType: ${this.geometryType}`)}}setBit(t,e){const i=1<>t}setBits(t,e,i){for(let r=e,n=0;rclass extends s{get vvSizeMinMaxValue(){return this.bit(vi)!==0}set vvSizeMinMaxValue(t){this.setBit(vi,t)}get vvSizeScaleStops(){return this.bit(Mi)!==0}set vvSizeScaleStops(t){this.setBit(Mi,t)}get vvSizeFieldStops(){return this.bit(wi)!==0}set vvSizeFieldStops(t){this.setBit(wi,t)}get vvSizeUnitValue(){return this.bit(bi)!==0}set vvSizeUnitValue(t){this.setBit(bi,t)}hasSizeVV(){return this.vvSizeMinMaxValue||this.vvSizeScaleStops||this.vvSizeFieldStops||this.vvSizeUnitValue}hasVV(){return super.hasVV()||this.hasSizeVV()}setVV(t,e){super.setVV(t,e);const i=Ss(this.geometryType,t,e)&t;this.vvSizeMinMaxValue=!!(i&G.SIZE_MINMAX_VALUE),this.vvSizeFieldStops=!!(i&G.SIZE_FIELD_STOPS),this.vvSizeUnitValue=!!(i&G.SIZE_UNIT_VALUE),this.vvSizeScaleStops=!!(i&G.SIZE_SCALE_STOPS)}},hr=s=>class extends s{get vvRotation(){return this.bit(gi)!==0}set vvRotation(t){this.setBit(gi,t)}hasVV(){return super.hasVV()||this.vvRotation}setVV(t,e){super.setVV(t,e),this.vvRotation=!e.isOutline&&!!(t&G.ROTATION)}},le=s=>class extends s{get vvColor(){return this.bit(yi)!==0}set vvColor(t){this.setBit(yi,t)}hasVV(){return super.hasVV()||this.vvColor}setVV(t,e){super.setVV(t,e),this.vvColor=!e.isOutline&&!!(t&G.COLOR)}},ce=s=>class extends s{get vvOpacity(){return this.bit(xi)!==0}set vvOpacity(t){this.setBit(xi,t)}hasVV(){return super.hasVV()||this.vvOpacity}setVV(t,e){super.setVV(t,e),this.vvOpacity=!e.isOutline&&!!(t&G.OPACITY)}};let H=class extends le(ce(At(Z))){static load(t){const e=this.shared;return e.data=t,e}static from(t){const{symbologyType:e,vvFlags:i}=t,r=this.load(0);return r.geometryType=b.FILL,r.symbologyType=e,e!==A.DOT_DENSITY&&r.setVV(i,t),r.data}getVariation(){return{...super.getVariation(),vvColor:this.vvColor,vvOpacity:this.vvOpacity,vvSizeFieldStops:this.vvSizeFieldStops,vvSizeMinMaxValue:this.vvSizeMinMaxValue,vvSizeScaleStops:this.vvSizeScaleStops,vvSizeUnitValue:this.vvSizeUnitValue}}};H.shared=new H(0);class dt extends le(ce(hr(At(Z)))){static load(t){const e=this.shared;return e.data=t,e}static from(t){const{symbologyType:e,vvFlags:i}=t,r=this.load(0);return r.geometryType=b.MARKER,r.symbologyType=e,e!==A.HEATMAP&&r.setVV(i,t),r.data}getVariation(){return{...super.getVariation(),vvColor:this.vvColor,vvRotation:this.vvRotation,vvOpacity:this.vvOpacity,vvSizeFieldStops:this.vvSizeFieldStops,vvSizeMinMaxValue:this.vvSizeMinMaxValue,vvSizeScaleStops:this.vvSizeScaleStops,vvSizeUnitValue:this.vvSizeUnitValue}}}dt.shared=new dt(0);let rt=class extends le(ce(At(Z))){static load(t){const e=this.shared;return e.data=t,e}static from(t){const e=this.load(0);return e.geometryType=b.LINE,e.symbologyType=t.symbologyType,e.setVV(t.vvFlags,t),e.data}getVariation(){return{...super.getVariation(),vvColor:this.vvColor,vvOpacity:this.vvOpacity,vvSizeFieldStops:this.vvSizeFieldStops,vvSizeMinMaxValue:this.vvSizeMinMaxValue,vvSizeScaleStops:this.vvSizeScaleStops,vvSizeUnitValue:this.vvSizeUnitValue}}};rt.shared=new rt(0);let Ct=class extends le(ce(hr(At(Z)))){static load(t){const e=this.shared;return e.data=t,e}static from(t){const e=this.load(0);return e.geometryType=b.TEXT,e.symbologyType=t.symbologyType,e.setVV(t.vvFlags,t),e.data}getVariation(){return{...super.getVariation(),vvColor:this.vvColor,vvOpacity:this.vvOpacity,vvRotation:this.vvRotation,vvSizeFieldStops:this.vvSizeFieldStops,vvSizeMinMaxValue:this.vvSizeMinMaxValue,vvSizeScaleStops:this.vvSizeScaleStops,vvSizeUnitValue:this.vvSizeUnitValue}}};Ct.shared=new Ct(0);let ct=class extends At(Z){static load(t){const e=this.shared;return e.data=t,e}static from(t){const e=this.load(0);return e.geometryType=b.LABEL,e.symbologyType=t.symbologyType,e.setVV(t.vvFlags,t),e.mapAligned=Zi(t.placement),e.data}getVariation(){return{...super.getVariation(),vvSizeFieldStops:this.vvSizeFieldStops,vvSizeMinMaxValue:this.vvSizeMinMaxValue,vvSizeScaleStops:this.vvSizeScaleStops,vvSizeUnitValue:this.vvSizeUnitValue}}};ct.shared=new ct(0);const N=0,U=100;function zi(s,t,e){return s[0]=t[0]-e[0],s[1]=t[1]-e[1],s}function lr(s,t){return Math.sqrt(s*s+t*t)}function Ii(s){const t=lr(s[0],s[1]);s[0]/=t,s[1]/=t}function Is(s,t){return lr(s[0]-t[0],s[1]-t[1])}function be(s=2){return 1/Math.max(s,1)}function at(s,t){return[!!(s!=null&&s.minScale)&&t.scaleToZoom(s.minScale)||N,!!(s!=null&&s.maxScale)&&t.scaleToZoom(s.maxScale)||U]}function Ps(s,t){return s[t+1]}function cr(s){return s.length-1}function $s(s){let t=0;for(let e=0;et._index||this._index===t._index&&this._distance>=t._distance}get _segment(){return this._segments[this._index+1]}get angle(){const t=this.dy,e=(0*t+-1*-this.dx)/(1*this.length);let i=Math.acos(e);return t>0&&(i=2*Math.PI-i),i}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:t,dy:e}=this;return Math.sqrt(t*t+e*e)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1t)return this._seekBackwards(t-r);r+=this.length}return this._distance=0,e?this:null}seek(t,e=!1){if(t<0)return this._seekBackwards(Math.abs(t),e);if(t<=this.remainingLength)return this._distance=(this.backwardLength+t)/this.length,this;let i=this.remainingLength;for(;this.next();){if(i+this.length>t)return this.seek(t-i,e);i+=this.length}return this._distance=1,e?this:null}};function Ws(s,t,e,i=!0){const r=$s(s),n=Es.create(s),a=r/2;if(!i)return n.seek(a),void e(n.clone(),0,a+0*t,r);const o=Math.max((r-t)/2,0),h=Math.floor(o/t),l=a-h*t;n.seek(l);for(let u=-h;u<=h;u++)n.x<512&&n.x>=0&&n.y<512&&n.y>=0&&e(n.clone(),u,a+u*t,r),n.seek(t)}function Vs(s,t){const e=t;for(let i=0;i=0&&!(r[m+1]r[c]+u);m++){const p=u-r[m-1]+r[c],y=r[m]-r[m-1],x=r[m]-r[c]class extends s{constructor(...t){super(...t),this._isCIM=!1,this._vertexBoundsScale=1,this.geometryType=b.TEXT,this._aux=P(0,0,this._referenceSize,this._bitset)}bindTextInfo(t,e){this._shapingInfo=t!=null&&t.length?vs(t,e,{scale:this._scale,angle:this._angle,xOffset:this._xOffset,yOffset:this._yOffset,hAlign:this._xAlignD,vAlign:this._yAlignD,maxLineWidth:Math.max(32,Math.min(this._lineWidth,512)),lineHeight:es*Math.max(.25,Math.min(this._lineHeight,4)),decoration:this._decoration,isCIM:this._isCIM,hasBackground:!!this._backgroundColor,borderLineSize:this._borderLineSize}):null}_write(t,e,i,r){const n=e.getDisplayId();this._writeGeometry(t,e,n,i,r)}_writeGeometry(t,e,i,r,n){const a=this._shapingInfo;if(a==null)return;if(this._textPlacement)return this._writePlacedText(t,i,a,r,e,n);const o=n?n.asOptimized():e.geometryType==="esriGeometryPolygon"?e.readCentroid():e.readGeometryForDisplay();if(o!=null){if(o.isPoint){const[h,l]=o.coords;return!t.hasAggregates&&t.hasPixelBufferEnabled&&(h<0||h>=512||l<0||l>=512)?void 0:this._writeGlyphs(t,i,{x:h,y:l},a)}o.forEachVertex((h,l)=>this._writeGlyphs(t,i,{x:h,y:l},a))}}_writePlacedText(t,e,i,r,n,a){const o=this._textPlacement,h=a||re.fromFeatureSetReaderCIM(n);if(!h)return;const l=-1,u=ur.getPlacement(h,l,o,v(1),t.tileKey,r.geometryEngine);if(!u)return;const c=i.bounds,f=Math.sqrt(c.height*c.height+c.width*c.width);let d,_,m;for(;d=u.next();)if(_=d.tx,m=-d.ty,_+f>=0&&_-f<512&&m+f>=0&&m-f<512){const p=-d.getAngle();i.setRotation(p),this._writeGlyphs(t,e,{x:_,y:m},i),i.setRotation(-p)}}_writeGlyphs(t,e,i,r){const n=Z.load(this._materialKey),a=M(Math.round(mt*i.x),Math.round(mt*i.y)),o=this._vertexBoundsScale,{bounds:h,background:l,glyphs:u}=r;u.length>0&&(this._borderLineColor||this._backgroundColor)&&(n.textureBinding=u[0].textureBinding,t.recordStart(e,n.data,this.geometryType,!0),this._writeBackgroundGeometry(t,e,i,h,l),t.recordEnd());const c=2*Math.max(h.width,h.height);for(const f of r.glyphs)n.textureBinding=f.textureBinding,t.recordStart(e,n.data,this.geometryType,!0),t.vertexBounds(i.x+h.x+this._xOffset,i.y+h.y-this._yOffset,c*o,c*o),this._writeVertices(t,e,a,f),t.recordEnd()}_writeGlyph(t,e,i,r,n){const a=Z.load(this._materialKey),o=M(Math.round(mt*i),Math.round(mt*r));a.textureBinding=n.textureBinding,t.recordStart(e,a.data,this.geometryType,!0);const h=n.bounds,l=this._vertexBoundsScale;t.vertexBounds(i+h.x*l,r+h.y*l,h.width*l,h.height*l),this._writeVertices(t,e,o,n),t.recordEnd()}_writeVertices(t,e,i,r){const n=t.vertexCount();this._writeVertexCommon(t,e,i,r),t.vertexWrite(r.offsets.upperLeft),t.vertexWrite(r.texcoords.upperLeft),t.vertexEnd(),this._writeVertexCommon(t,e,i,r),t.vertexWrite(r.offsets.upperRight),t.vertexWrite(r.texcoords.upperRight),t.vertexEnd(),this._writeVertexCommon(t,e,i,r),t.vertexWrite(r.offsets.lowerLeft),t.vertexWrite(r.texcoords.lowerLeft),t.vertexEnd(),this._writeVertexCommon(t,e,i,r),t.vertexWrite(r.offsets.lowerRight),t.vertexWrite(r.texcoords.lowerRight),t.vertexEnd(),t.indexWrite(n+0),t.indexWrite(n+1),t.indexWrite(n+2),t.indexWrite(n+1),t.indexWrite(n+3),t.indexWrite(n+2)}_writeVertexCommon(t,e,i,r){const n=this._color,a=this._haloColor,o=P(0,0,this._referenceSize,this._bitset),h=P(0,0,this._size,this._haloSize);t.vertexWrite(i),t.vertexWrite(e),t.vertexWrite(n),t.vertexWrite(a),t.vertexWrite(h),t.vertexWrite(o),t.vertexWrite(this._minMaxZoom)}_writeBackgroundVertex(t,e,i,r,n,a){const o=P(0,1,this._referenceSize,this._bitset),h=P(0,0,this._size,this._haloSize),l=P(0,0,0,0);t.vertexWrite(i),t.vertexWrite(e),t.vertexWrite(r),t.vertexWrite(l),t.vertexWrite(h),t.vertexWrite(o),t.vertexWrite(this._minMaxZoom),t.vertexWrite(n),t.vertexWrite(a),t.vertexEnd()}_writeBackgroundQuad(t,e,i,r,n,a){const o=t.vertexCount();this._writeBackgroundVertex(t,e,i,r,n.upperLeft,a[0]),this._writeBackgroundVertex(t,e,i,r,n.upperRight,a[1]),this._writeBackgroundVertex(t,e,i,r,n.lowerLeft,a[2]),this._writeBackgroundVertex(t,e,i,r,n.lowerRight,a[3]),t.indexWrite(o+0),t.indexWrite(o+1),t.indexWrite(o+2),t.indexWrite(o+1),t.indexWrite(o+3),t.indexWrite(o+2)}_writeBackgroundGeometry(t,e,i,r,n){const a=M(Math.round(mt*i.x),Math.round(mt*i.y)),{x:o,y:h,width:l,height:u}=r,c=2*Math.max(l,u);if(t.vertexBounds(i.x+o+this._xOffset,i.y+h-this._yOffset,c*this._vertexBoundsScale,c*this._vertexBoundsScale),this._backgroundColor){const f=[Gt,Gt,Gt,Gt];this._writeBackgroundQuad(t,e,a,this._backgroundColor,n.main,f)}if(this._borderLineColor||this._backgroundColor){const f=!!this._borderLineColor&&!!this._borderLineSize&&this._borderLineSize>0,[d,_,m,p,y]=f?[Pi,Pi,$i,$i,this._borderLineColor]:[As,Rs,Bs,Fs,this._backgroundColor];this._writeBackgroundQuad(t,e,a,y,n.top,d),this._writeBackgroundQuad(t,e,a,y,n.bot,_),this._writeBackgroundQuad(t,e,a,y,n.left,m),this._writeBackgroundQuad(t,e,a,y,n.right,p)}}};let Rt=class{constructor(){this._materialKey=null}bindFeature(t,e,i){}write(t,e,i,r){if(this._effects&&this._effects.length>0){let n=re.fromFeatureSetReaderCIM(e);if(n){n.invertY();const a=Zr.executeEffects(this._effects,n,t.tileKey,r.geometryEngine);for(;n=a.next();)n.invertY(),this._write(t,e,r,n)}}else this._write(t,e,r)}_write(t,e,i,r){}};const Os=5;let Le=class Te extends dr(Rt){constructor(t,e,i,r,n,a,o,h,l,u,c,f,d,_,m,p,y,x,g,w,S,T,z,I){super(),this._xOffset=v(d),this._yOffset=v(_),this._decoration=u||"none",this._backgroundColor=T,this._borderLineColor=z,this._borderLineSize=I,this._color=n,this._haloColor=a,this._haloSize=Math.min(Math.floor(Os*v(Pr(i))),127),this._size=Math.min(Math.round(v(e)),127);const Y=Math.min(Math.round(v(r||e)),127);this._referenceSize=Math.round(Math.sqrt(256*Y)),this._scale=this._size/Hi,this._angle=f,this._justify=Nr(o||"center"),this._xAlignD=Ni(o||"center"),this._yAlignD=Ui(h||"baseline"),this._baseline=(h||"baseline")==="baseline",this._bitset=(l===K.MAP?1:0)|(c?1:0)<<1;const ft=Z.load(t);ft.sdf=!0,this._materialKey=ft.data,this._lineWidth=v(m)||512,this._lineHeight=p||1,this._textPlacement=y,this._effects=x,this._isCIM=g??!1,this._minMaxZoom=M(Math.round(w*E),Math.round(S*E))}static fromText(t,e){var a,o;const i=(a=t.font)==null?void 0:a.size,r=new Te(t.materialKey,i,t.haloSize||0,i,t.color&&O(t.color)||0,t.haloColor&&O(t.haloColor)||0,t.horizontalAlignment,t.verticalAlignment,K.SCREEN,(o=t.font)==null?void 0:o.decoration,!1,t.angle||0,t.xoffset||0,t.yoffset||0,t.lineWidth||0,t.lineHeight||0,null,null,!1,N,U,t.backgroundColor&&O(t.backgroundColor),t.borderLineColor&&O(t.borderLineColor),t.borderLineSize),[,n]=ye(t.text);return r.bindTextInfo(e??[],n),r._vertexBoundsScale=t.maxVVSize&&i?t.maxVVSize/i:1,r}static fromCIMText(t,e,i){const r=t.scaleFactor||1,n=t.size*t.sizeRatio*r,[a,o]=at(t.scaleInfo,i),h=new Te(t.materialKey,n,t.outlineSize*t.sizeRatio,t.referenceSize,$(t.color),$(t.outlineColor),t.horizontalAlignment,t.verticalAlignment,t.alignment,t.decoration,t.colorLocked??!1,t.angle,t.offsetX*t.sizeRatio*r,t.offsetY*t.sizeRatio*r,t.lineWidth||512,1,t.markerPlacement,t.effects,!0,a,o,t.backgroundColor?$(t.backgroundColor):void 0,t.borderLineColor?$(t.borderLineColor):void 0,t.borderLineWidth),[,l]=ye(t.text);return h.bindTextInfo(e,l),h._vertexBoundsScale=t.maxVVSize?t.maxVVSize/n:1,h}};const fr=St.getLogger("esri.views.2d.engine.webgl.WGLLabelTemplate"),Ds=(s,t="mapview-labeling")=>fr.error(new bt(t,s)),Zt=1,pt=0,Ks=4,de=25;function Gs(s,t){const e=!!s.minScale&&t.scaleToZoom(s.minScale)||0;return Gi(e,0,25.5)}function Zs(s,t){const e=!!s.maxScale&&t.scaleToZoom(s.maxScale)||255;return Gi(e,0,25.5)}function Ns(s){const t=new Map;return e=>(t.has(e)||t.set(e,s(e)),t.get(e))}const Us=Ns(s=>{let t=0;if(s===0)return 1/0;for(;!(s%2);)t++,s/=2;return t}),Nt=s=>Math.floor(127*s+127),ot=s=>Math.floor(s*E),J=s=>Math.round(s*(254/360));class Qt extends Le{constructor(t,e,i,r){var c,f,d;super(t,(c=i.font)==null?void 0:c.size,i.haloSize||0,(f=i.font)==null?void 0:f.size,i.color&&O(i.color)||0,i.haloColor&&O(i.haloColor)||0,i.horizontalAlignment,i.verticalAlignment,Zi(e.labelPlacement)?K.MAP:K.SCREEN,(d=i.font)==null?void 0:d.decoration,!1,i.angle||0,i.xoffset,i.yoffset,i.lineWidth,i.lineHeight,null,null,!1,null,null,i.backgroundColor&&O(i.backgroundColor),i.borderLineColor&&O(i.borderLineColor),i.borderLineSize),this._outLineLabelAngle=0,this._refPlacementPadding=0,this._refPlacementDirX=0,this._refPlacementDirY=0,this._refOffsetX=0,this._refOffsetY=0,this._zoomLevel=0,this.geometryType=b.LABEL,this._allowOverrun=e.allowOverrun??!1,this._repeatLabel=e.repeatLabel??!0,this._labelPosition=e.labelPosition??"curved";const n=Gs(e,r),a=Zs(e,r),o=e.labelPlacement,[h,l]=Ur(o);this._xAlignD=h,this._yAlignD=l,this._minZoom=n,this._maxZoom=a,this._minBackgroundZoom=n,this._maxBackgroundZoom=a,this._refPlacementPadding=v(i.haloSize)+is,this._repeatLabelDistance=e.repeatLabelDistance?v(e.repeatLabelDistance):128;const u=ct.load(t);u.sdf=!0,this._materialKey=u.data}static fromLabelClass(t,e){if(t.labelPlacement==="esriServerLinePlacementCenterAlong"){const i=t.symbol;i.xoffset=0,i.yoffset=0,i.angle=0,i.font.decoration="none"}return new Qt(t.materialKey,t,t.symbol,e)}get _shapedBox(){return this._shapingInfo.bounds}setZoomLevel(t){this._zoomLevel=t}bindReferenceTemplate(t){let e=Xr(this._xAlignD),i=Hr(this._yAlignD);if(this._refOffsetX=0,this._refOffsetY=0,t==null)return void(this._refSymbolAndPlacementOffset=P(0,0,Nt(e),Nt(i)));if(t.boundsType==="circle"&&(e||i)){const a=Math.sqrt(e*e+i*i);e/=a,i/=a}const r=Math.max(t.height,t.width),n=this._refPlacementPadding*Ks;this._refSymbolAndPlacementOffset=P(n,r,Nt(e),Nt(i)),this._referenceSize=r,this._refPlacementDirX=e,this._refPlacementDirY=i,this._refOffsetX=t.xOffset,this._refOffsetY=t.yOffset}_write(t,e){if(this._shapingInfo==null)return;const i=this._shapingInfo,r=e.getDisplayId(),n=e.geometryType==="esriGeometryPolygon"?e.readLegacyCentroid():e.readLegacyGeometry();if(n)switch(this._current={out:t,inId:r,inShaping:i,zoomLevel:this._zoomLevel},e.geometryType==="esriGeometryPolyline"&&this._labelPosition==="curved"&&(this._borderLineColor||this._backgroundColor)&&fr.warnOnce("TextSymbol properties 'borderLineColor', 'borderLineSize', and 'backgroundColor' are not supported in curved labels"),e.geometryType){case"esriGeometryPolyline":this._placeLineLabels(n);break;case"esriGeometryPoint":case"esriGeometryPolygon":this._placePointLabels(n);break;default:Ds(`Geometry of type ${e.geometryType} is not supported`)}}_isVisible(t,e){const i=ot(this._current.zoomLevel);return ot(t)<=i&&i<=ot(e)}_placePointLabels(t){const{out:e,inId:i,inShaping:r}=this._current;this._writeGlyphs(e,i,t,r)}_placeLineLabels(t){const e=Vs(t.paths,this._current.inShaping.bounds.width),i=this._placeSubdivGlyphs.bind(this),r=(this._shapedBox.width+this._repeatLabelDistance)/(1<0&&(this._borderLineColor||this._backgroundColor);if(this._maxBackgroundZoom=de,this._minBackgroundZoom=Math.max(e,0),l){const u=ct.load(this._materialKey);u.textureBinding=n.glyphs[0].textureBinding;const c=ee(Q(),-t.angle),[f,d]=n.shapeBackground(c);this._outLineLabelAngle=J(o),i.recordStart(r,u.data,this.geometryType,!0),this._writeBackgroundGeometry(i,r,t,f,d),i.recordEnd(),this._outLineLabelAngle=J(h),i.recordStart(r,u.data,this.geometryType,!0),this._writeBackgroundGeometry(i,r,t,f,d),i.recordEnd()}this._outLineLabelAngle=J(o),this._placeFirst(a,e,1,!0),this._outLineLabelAngle=J(h),this._placeFirst(a,e,0,!0),i.metricEnd()}_placeBack(t,e,i,r,n){const a=t.clone();let o=t.backwardLength+pt;for(;a.prev()&&!(o>=r);)this._placeOnSegment(a,e,o,i,-1,n),o+=a.length+pt}_placeForward(t,e,i,r,n){const a=t.clone();let o=t.remainingLength+pt;for(;a.next()&&!(o>=r);)this._placeOnSegment(a,e,o,i,1,n),o+=a.length+pt}_placeFirst(t,e,i,r=!1){const n=t,a=this._current.inShaping,o=a.glyphs,h=this._current.zoomLevel,{out:l,inId:u}=this._current;for(const c of o){const f=c.x>a.bounds.x?i:1-i,d=f*t.remainingLength+(1-f)*t.backwardLength,_=Math.abs(c.x+c.width/2-a.bounds.x),m=Math.max(0,h+Math.log2(_/(d+pt))),p=Math.max(e,r?0:m);if(c.maxZoom=de,c.angle=t.angle+(1-i)*Math.PI,c.minZoom=p,this._writeGlyph(l,u,n.x,n.y,c),i&&this._isVisible(c.minZoom,c.maxZoom)){const y=c.bounds;l.metricBoxWrite(y.center[0],y.center[1],y.width,y.height)}}}_placeOnSegment(t,e,i,r,n,a){const o=this._current.inShaping.glyphs,{out:h,inId:l}=this._current,u=this._current.inShaping,c=this._current.zoomLevel,f=t.dx/t.length,d=t.dy/t.length,_={x:t.x+i*-n*f,y:t.y+i*-n*d};for(const m of o){const p=m.x>u.bounds.x?a:1-a;if(!(p&&n===1||!p&&n===-1))continue;const y=Math.abs(m.x+m.width/2-u.bounds.x),x=Math.max(0,c+Math.log2(y/i)-.1),g=Math.max(r,c+Math.log2(y/(i+t.length+pt)));if(x!==0&&(m.angle=t.angle+(1-a)*Math.PI,m.minZoom=g,m.maxZoom=x,this._writeGlyph(h,l,_.x,_.y,m),a&&this._isVisible(m.minZoom,m.maxZoom))){const w=m.bounds,S=t.x-e.x,T=t.y-e.y;h.metricBoxWrite(w.center[0]+S,w.center[1]+T,w.width,w.height)}}}_writeGlyphs(t,e,i,r,n=this._minZoom){if(i.x<0||i.x>=512||i.y<0||i.y>=512)return;if(r.glyphs.length>0&&(this._borderLineColor||this._backgroundColor)){const c=ct.load(this._materialKey);c.textureBinding=r.glyphs[0].textureBinding,t.recordStart(e,c.data,this.geometryType,!0),this._writeBackgroundGeometry(t,e,i,r.bounds,r.background),t.recordEnd()}const a=i.x+this._refOffsetX,o=i.y-this._refOffsetY;for(const c of r.glyphs)c.minZoom=n,c.maxZoom=this._maxZoom,this._writeGlyph(t,e,a,o,c);const h=this._refPlacementDirX,l=this._refPlacementDirY,u=r.boundsT;t.metricStart(e,n,a,o,h,l,this._referenceSize,this._materialKey),t.metricBoxWrite(u.center[0],u.center[1],u.width,u.height),t.metricEnd()}_writeVertexCommon(t,e,i,r){const n=this._color,a=this._haloColor,o=P(0,0,this._size,this._haloSize),h=Math.max(r.minZoom,this._minZoom),l=Math.min(r.maxZoom,this._maxZoom),u=P(ot(h),ot(l),this._outLineLabelAngle,0);t.vertexWrite(i),t.vertexWrite(e),t.vertexWrite(n),t.vertexWrite(a),t.vertexWrite(o),t.vertexWrite(this._refSymbolAndPlacementOffset),t.vertexWrite(u)}_writeBackgroundVertex(t,e,i,r,n,a){const o=P(0,0,this._size,this._haloSize),h=P(0,0,0,0),l=P(ot(this._minBackgroundZoom),ot(this._maxBackgroundZoom),this._outLineLabelAngle,1);t.vertexWrite(i),t.vertexWrite(e),t.vertexWrite(r),t.vertexWrite(h),t.vertexWrite(o),t.vertexWrite(this._refSymbolAndPlacementOffset),t.vertexWrite(l),t.vertexWrite(n),t.vertexWrite(a),t.vertexEnd()}}const fe=3.14159265359/180,Ci=8,_r=s=>class extends s{constructor(...t){super(...t),this.angle=0,this.xOffset=0,this.yOffset=0,this.width=0,this.height=0,this.boundsType="square",this._anchorX=0,this._anchorY=0,this._computedWidth=0,this._computedHeight=0,this._allowBorrowing=!0,this._vertexBoundsScaleX=1,this._vertexBoundsScaleY=1,this.geometryType=b.MARKER}_write(t,e,i,r){const n=e.getDisplayId();t.recordStart(n,this._materialKey,this.geometryType,!0),this._writeGeometry(t,e,n,i,r),t.recordEnd()}_writeGeometry(t,e,i,r,n){if(this._markerPlacement!=null)return this._writePlacedMarkers(t,e,r,n);if(this._allowBorrowing=!0,!n&&e.geometryType==="esriGeometryPoint"){const o=e.getX(),h=e.getY();return!t.hasAggregates&&t.hasPixelBufferEnabled&&(o<0||o>=513||h<0||h>=513)?void 0:this._writeVertices(t,i,this._getPos(o,h),o,h)}const a=n?n.asOptimized():e.geometryType==="esriGeometryPolygon"?e.readCentroid():e.readGeometryForDisplay();if(a!=null){if(a.isPoint){const[o,h]=a.coords;return!t.hasAggregates&&t.hasPixelBufferEnabled&&(o<0||o>=512||h<0||h>=512)?void 0:this._writeVertices(t,i,this._getPos(o,h),o,h)}a.forEachVertex((o,h)=>{const l=2*ut;o<-l||o>=l||h<-l||h>=l||this._writeVertices(t,i,this._getPos(o,h),o,h)})}}_writePlacedMarkers(t,e,i,r){const n=r||re.fromFeatureSetReaderCIM(e);if(!n)return;const a=-1,o=ur.getPlacement(n,a,this._markerPlacement,v(1),t.tileKey,i.geometryEngine);if(!o)return;this._allowBorrowing=e.geometryType!=="esriGeometryPolygon";const h=e.getDisplayId(),l=Mt(),u=Q(),c=-128,f=640;let d=o.next();for(;d!=null;){const _=d.tx,m=-d.ty;_>=c&&_<=f&&m>=c&&m<=f&&(this._applyTransformation(u,l,-d.getAngle()/fe),this._writeVertices(t,h,this._getPos(_,m),_,m)),d=o.next()}}_writeVertices(t,e,i,r,n){const a=dt.load(this._materialKey);return a.symbologyType===A.HEATMAP?this._writeHeatmapVertices(t,e,i):this._writeMarkerVertices(t,e,a,i,r,n)}_writeMarkerVertices(t,e,i,r,n,a){const o=i.vvRotation,h=t.vertexCount();let l=this._computedWidth*this._vertexBoundsScaleX,u=this._computedHeight*this._vertexBoundsScaleY;if(this.angle){const c=Math.max(l,u);l=c,u=c}if(o){const c=Math.max(this.xOffset,this.yOffset);l+=c,u+=c}this._allowBorrowing&&t.vertexBounds(n+this.xOffset,a-this.yOffset,l,u),t.vertexWrite(r),t.vertexWrite(this._offsetUpperLeft),t.vertexWrite(this._texUpperLeft),t.vertexWrite(this._bitestAndDistRatio),t.vertexWrite(e),t.vertexWrite(this._fillColor),t.vertexWrite(this._outlineColor),t.vertexWrite(this._sizeOutlineWidth),t.vertexWrite(this._minMaxZoom),t.vertexEnd(),t.vertexWrite(r),t.vertexWrite(this._offsetUpperRight),t.vertexWrite(this._texUpperRight),t.vertexWrite(this._bitestAndDistRatio),t.vertexWrite(e),t.vertexWrite(this._fillColor),t.vertexWrite(this._outlineColor),t.vertexWrite(this._sizeOutlineWidth),t.vertexWrite(this._minMaxZoom),t.vertexEnd(),t.vertexWrite(r),t.vertexWrite(this._offsetBottomLeft),t.vertexWrite(this._texBottomLeft),t.vertexWrite(this._bitestAndDistRatio),t.vertexWrite(e),t.vertexWrite(this._fillColor),t.vertexWrite(this._outlineColor),t.vertexWrite(this._sizeOutlineWidth),t.vertexWrite(this._minMaxZoom),t.vertexEnd(),t.vertexWrite(r),t.vertexWrite(this._offsetBottomRight),t.vertexWrite(this._texBottomRight),t.vertexWrite(this._bitestAndDistRatio),t.vertexWrite(e),t.vertexWrite(this._fillColor),t.vertexWrite(this._outlineColor),t.vertexWrite(this._sizeOutlineWidth),t.vertexWrite(this._minMaxZoom),t.vertexEnd(),this._writeIndices(t,h)}_writeHeatmapVertices(t,e,i){const r=t.vertexCount();t.vertexWrite(i),t.vertexWrite(this._offsetUpperLeft),t.vertexWrite(e),t.vertexEnd(),t.vertexWrite(i),t.vertexWrite(this._offsetUpperRight),t.vertexWrite(e),t.vertexEnd(),t.vertexWrite(i),t.vertexWrite(this._offsetBottomLeft),t.vertexWrite(e),t.vertexEnd(),t.vertexWrite(i),t.vertexWrite(this._offsetBottomRight),t.vertexWrite(e),t.vertexEnd(),this._writeIndices(t,r)}_writeIndices(t,e){t.indexWrite(e+0),t.indexWrite(e+1),t.indexWrite(e+2),t.indexWrite(e+1),t.indexWrite(e+3),t.indexWrite(e+2)}_applyTransformation(t,e,i=0){i?ee(t,fe*i):$r(t),Xt(t,t,Ki(this.xOffset,-this.yOffset)),this.angle&&pe(t,t,fe*this.angle);const r=this._computedWidth,n=this._computedHeight,a=-(.5+this._anchorX)*r,o=-(.5-this._anchorY)*n;et(e,a,o),gt(e,e,t),this._offsetUpperLeft=M(16*e[0],16*e[1]),et(e,a+r,o),gt(e,e,t),this._offsetUpperRight=M(16*e[0],16*e[1]),et(e,a,o+n),gt(e,e,t),this._offsetBottomLeft=M(16*e[0],16*e[1]),et(e,a+r,o+n),gt(e,e,t),this._offsetBottomRight=M(16*e[0],16*e[1])}_computeSize(t,e,i,r,n,a,o,h){const l=t*i,u=e*i;if(a.sdf&&!o){const T=h&&t>e?l:t,z=e,I=r+2*1;t=Math.min(T+I,l),e=Math.min(z+I,u)}else t=l,e=u;const c=rs/Math.max(l,u),f=.5*(l-t)*c,d=.5*(u-e)*c,_=a.rect.x+k+f,m=a.rect.y+k+d,p=_+a.width-2*f,y=m+a.height-2*d,x=Math.floor(_),g=Math.floor(m),w=Math.ceil(p),S=Math.ceil(y);t*=(w-x)/(p-_),e*=(S-g)/(y-m),this._texUpperLeft=M(x,g),this._texUpperRight=M(w,g),this._texBottomLeft=M(x,S),this._texBottomRight=M(w,S),this._anchorX*=l/t,this._anchorY*=u/e,t*=n,e*=n,this._computedWidth=t,this._computedHeight=e}_getPos(t,e){return M(Math.round(Ci*t),Math.round(Ci*e))}};let It=class Pt extends _r(Rt){constructor(t,e,i,r,n,a,o,h,l,u,c,f,d,_,m,p,y,x,g,w,S,T,z,I){super(),this.angle=r,this.height=o,this.width=a,this.xOffset=e*g,this.yOffset=i*g,this._markerPlacement=w||void 0,this._effects=S||void 0,this._anchorX=p,this._anchorY=y,this._minMaxZoom=M(Math.round(T*E),Math.round(z*E));const Y=(_===K.MAP?Yi:qi)|(c?it:0)|(d?ss:0)|(f?ji:0),ft=m&&m.sdf,_t=dt.load(t);_t.sdf=ft,_t.pattern=!0,_t.textureBinding=m.textureBinding,this._materialKey=_t.data,this._fillColor=n,this._outlineColor=l,this._sizeOutlineWidth=P(Math.round(Math.min(Math.sqrt(128*a),255)),Math.round(Math.min(Math.sqrt(128*o),255)),Math.round(Math.min(Math.sqrt(128*u),255)),Math.round(Math.min(Math.sqrt(128*h),255))),_t.symbologyType===A.PIE_CHART?(a*=x*g,o*=x*g,this._computedWidth=a,this._computedHeight=o,this._texUpperLeft=M(0,1),this._texUpperRight=M(1,1),this._texBottomLeft=M(0,0),this._texBottomRight=M(1,0)):this._computeSize(a,o,x,u,g,m,_t.hasSizeVV(),I);const Lr=Math.round(64*x);this._bitestAndDistRatio=M(Y,Lr);const Tr=Mt(),zr=Q();this._applyTransformation(zr,Tr)}static fromCIMMarker(t,e,i){const r=e&&e.width||1,n=e&&e.height||1,a=t.size,o=r/n*t.scaleX,h=t.scaleSymbolsProportionally&&t.frameHeight?a/t.frameHeight:1,l=$(t.color),u=$(t.outlineColor),c=v(a),f=c*o,d=v(t.offsetX||0),_=v(t.offsetY||0),m=v(t.outlineWidth||0)*h,p=t.alignment||K.SCREEN,y=v(t.referenceSize),[x,g]=at(t.scaleInfo,i);let w=t.rotation||0;t.rotateClockwise||(w=-w);let S=0,T=0;const z=t.anchorPoint;z&&(t.isAbsoluteAnchorPoint?a&&(S=z.x/(a*o),T=z.y/a):(S=z.x,T=z.y));const I=new Pt(t.materialKey,d,_,w,l,f,c,y,u,m,t.colorLocked,t.scaleSymbolsProportionally,!1,p,e,S,T,t.sizeRatio,t.scaleFactor??1,t.markerPlacement,t.effects,x,g,!0);return I._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/f:1,I._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/c:1,I}static fromPictureMarker(t,e){const i=Math.round(v(t.width)),r=Math.round(v(t.height)),n=Qi,a=Math.round(v(t.xoffset||0)),o=Math.round(v(t.yoffset||0)),h=new Pt(t.materialKey,a,o,t.angle,n,i,r,r,0,0,!1,!1,!1,K.SCREEN,e,0,0,1,1,null,null,N,U,!1);return h._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/t.width:1,h._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/t.height:1,h}static fromSimpleMarker(t,e){const i=t.style,r=O(t.color),n=Math.round(v(t.size));let a=n;i==="esriSMSTriangle"&&(a*=e.height/e.width);const o=Math.round(v(t.xoffset||0)),h=Math.round(v(t.yoffset||0)),l=t.outline,u=0|((l==null?void 0:l.color)&&O(l.color)),c=0|((l==null?void 0:l.width)&&Math.round(v(l.width))),f=new Pt(t.materialKey,o,h,t.angle??0,r,n,a,a,u,c,!1,!1,i==="esriSMSCross"||i==="esriSMSX",K.SCREEN,e,0,0,2,1,null,null,N,U,!1);return f.boundsType=i==="esriSMSCircle"?"circle":"square",f._vertexBoundsScaleX=t.maxVVSize?t.maxVVSize/t.size:1,f._vertexBoundsScaleY=t.maxVVSize?t.maxVVSize/t.size:1,f}static fromLineSymbolMarker(t,e){const i=O(t.color),r=6,n=Math.round(v(r*t.lineWidth)),a=n,o=t.style==="cross"||t.style==="x";let h;switch(t.placement){case"begin-end":h=Bt.Both;break;case"begin":h=Bt.JustBegin;break;case"end":h=Bt.JustEnd;break;default:h=Bt.None}const l={type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:h,offsetAlongLine:0},u=new Pt(t.materialKey,0,0,0,i,n,a,a/r,i,o?Math.round(v(t.lineWidth)):0,!1,!1,o,K.MAP,e,0,0,2,1,l,null,N,U,!1);return u.boundsType=t.style==="circle"?"circle":"square",u}};function Xs(s,t,e,i,r,n,a){Pe=0;const o=(i-e)*n,h=r&&r.length,l=h?(r[0]-e)*n:o;let u,c,f,d,_,m=mr(t,e,i,0,l,n,!0);if(m&&m.next!==m.prev){if(h&&(m=js(t,e,i,r,m,n)),o>80*n){u=f=t[0+e*n],c=d=t[1+e*n];for(let p=n;p0)for(let h=i;h=i;h-=n)o=Ei(h+t*n,s[h+t*n],s[h+1+t*n],o);return o&<(o,o.next)&&(Vt(o),o=o.next),o}function Et(s,t=s){if(!s)return s;let e,i=s;do if(e=!1,i.steiner||!lt(i,i.next)&&C(i.prev,i,i.next)!==0)i=i.next;else{if(Vt(i),i=t=i.prev,i===i.next)break;e=!0}while(e||i!==t);return t}function Wt(s,t,e,i,r,n,a,o){if(!s)return;!o&&n&&(s=pr(s,i,r,n));let h=s;for(;s.prev!==s.next;){const l=s.prev,u=s.next;if(n?Ys(s,i,r,n):Hs(s))t.push(l.index/e+a),t.push(s.index/e+a),t.push(u.index/e+a),Vt(s),s=u.next,h=u.next;else if((s=u)===h){o?o===1?Wt(s=nn(s,t,e,a),t,e,i,r,n,a,2):o===2&&an(s,t,e,i,r,n,a):Wt(Et(s),t,e,i,r,n,a,1);break}}}function Hs(s){const t=s.prev,e=s,i=s.next;if(C(t,e,i)>=0)return!1;let r=s.next.next;const n=r;let a=0;for(;r!==s.prev&&(a===0||r!==n);){if(a++,vt(t.x,t.y,e.x,e.y,i.x,i.y,r.x,r.y)&&C(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Ys(s,t,e,i){const r=s.prev,n=s,a=s.next;if(C(r,n,a)>=0)return!1;const o=r.xn.x?r.x>a.x?r.x:a.x:n.x>a.x?n.x:a.x,u=r.y>n.y?r.y>a.y?r.y:a.y:n.y>a.y?n.y:a.y,c=ze(o,h,t,e,i),f=ze(l,u,t,e,i);let d=s.prevZ,_=s.nextZ;for(;d&&d.z>=c&&_&&_.z<=f;){if(d!==s.prev&&d!==s.next&&vt(r.x,r.y,n.x,n.y,a.x,a.y,d.x,d.y)&&C(d.prev,d,d.next)>=0||(d=d.prevZ,_!==s.prev&&_!==s.next&&vt(r.x,r.y,n.x,n.y,a.x,a.y,_.x,_.y)&&C(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;d&&d.z>=c;){if(d!==s.prev&&d!==s.next&&vt(r.x,r.y,n.x,n.y,a.x,a.y,d.x,d.y)&&C(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;_&&_.z<=f;){if(_!==s.prev&&_!==s.next&&vt(r.x,r.y,n.x,n.y,a.x,a.y,_.x,_.y)&&C(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Ei(s,t,e,i){const r=wt.create(s,t,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Vt(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function qs(s){let t=s,e=s;do(t.x=e.next.y&&e.next.y!==e.y){const f=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=i&&f>a){if(a=f,f===i){if(r===e.y)return e;if(r===e.next.y)return e.next}n=e.x=e.x&&e.x>=h&&i!==e.x&&vt(rn.x)&&kt(e,s)&&(n=e,c=u)),e=e.next;return n}function pr(s,t,e,i){let r;for(;r!==s;r=r.next){if(r=r||s,r.z===null&&(r.z=ze(r.x,r.y,t,e,i)),r.prev.next!==r||r.next.prev!==r)return r.prev.next=r,r.next.prev=r,pr(s,t,e,i);r.prevZ=r.prev,r.nextZ=r.next}return s.prevZ.nextZ=null,s.prevZ=null,tn(s)}function tn(s){let t,e=1;for(;;){let i,r=s;s=null,t=null;let n=0;for(;r;){n++,i=r;let a=0;for(;a0||o>0&&i;){let h;a===0?(h=i,i=i.nextZ,o--):o!==0&&i?r.z<=i.z?(h=r,r=r.nextZ,a--):(h=i,i=i.nextZ,o--):(h=r,r=r.nextZ,a--),t?t.nextZ=h:s=h,h.prevZ=t,t=h}r=i}if(t.nextZ=null,e*=2,n<2)return s}}function C(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function yr(s,t,e,i){return!!(lt(s,t)&<(e,i)||lt(s,i)&<(e,t))||C(s,t,e)>0!=C(s,t,i)>0&&C(e,i,s)>0!=C(e,i,t)>0}function en(s,t){let e=s;do{if(e.index!==s.index&&e.next.index!==s.index&&e.index!==t.index&&e.next.index!==t.index&&yr(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function rn(s,t,e,i,r,n){let a=0;for(let o=i,h=r-n;o=0&&(s-a)*(i-o)-(e-a)*(t-o)>=0&&(e-a)*(n-o)-(r-a)*(i-o)>=0}function kt(s,t){return C(s.prev,s,s.next)<0?C(s,t,s.next)>=0&&C(s,s.prev,t)>=0:C(s,t,s.prev)<0||C(s,s.next,t)<0}function ze(s,t,e,i,r){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=32767*(s-e)*r)|s<<8))|s<<4))|s<<2))|s<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function lt(s,t){return s.x===t.x&&s.y===t.y}function sn(s,t){return s.x-t.x}function nn(s,t,e,i){let r=s;do{const n=r.prev,a=r.next.next;!lt(n,a)&&yr(n,r,r.next,a)&&kt(n,a)&&kt(a,n)&&(t.push(n.index/e+i),t.push(r.index/e+i),t.push(a.index/e+i),Vt(r),Vt(r.next),r=s=a),r=r.next}while(r!==s);return r}function an(s,t,e,i,r,n,a){let o=s;do{let h=o.next.next;for(;h!==o.prev;){if(o.index!==h.index&&on(o,h)){let l=xr(o,h);return o=Et(o,o.next),l=Et(l,l.next),Wt(o,t,e,i,r,n,a,0),void Wt(l,t,e,i,r,n,a,0)}h=h.next}o=o.next}while(o!==s)}function on(s,t){return s.next.index!==t.index&&s.prev.index!==t.index&&!en(s,t)&&kt(s,t)&&kt(t,s)&&hn(s,t)}function hn(s,t){let e=s,i=!1;const r=(s.x+t.x)/2,n=(s.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==s);return i}function xr(s,t){const e=wt.create(s.index,s.x,s.y),i=wt.create(t.index,t.x,t.y),r=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}class wt{constructor(){this.index=0,this.x=0,this.y=0,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}static create(t,e,i){const r=Pe0))break;c+=y,f.push(o+u),u+=p}const d=a.length;Xs(a,e,o,o+u,f,2,n);const _=un(a,e,d,a.length,n),m=Math.abs(c);if(Math.abs((_-m)/Math.max(1e-7,m))>cn)return a.length=0,!1;h=l,o+=u}return!0}function fn(s){const{coords:t,lengths:e}=s,{buffer:i}=ls(t,e);return i}function _n(s,t,e){let i=0;for(let r=0;re||he)return!0}i+=n}return!1}function mn(s,t){if(s==null)return null;if(!_n(s,-128,ut+128))return s;ht.setPixelMargin(t),ht.reset(rr.Polygon);let e=0;for(let a=0;ar||ur){a=!0;continue}h.push({x:l,y:u})}let c=!1;for(;s.nextPoint();)if(l=s.x,u=s.y,a)e.lineTo(l,u);else{if(lr||ur){c=!0;break}h.push({x:l,y:u})}if(c)a=!0;else{if(a){const f=e.resultWithStarts();if(f)for(const d of f)n.push(d)}else n.push({line:h,start:0});o=s.nextPath(),a=!1}}return n=n.filter(h=>h.line.length>1),n.length===0?null:n}ht.setExtent(ut),$e.setExtent(ut);const Jt=8,B=16,Vi=65535,gr=s=>class extends s{constructor(...t){super(...t),this.tessellationProperties={},this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0},this.geometryType=b.LINE}writeGeometry(t,e,i,r){this._writeGeometry(t,e,i,r)}_initializeTessellator(t){const e=rt.load(this._materialKey),i=H.load(this._materialKey),r=this._tessellationOptions,n=e.vvSizeFieldStops||e.vvSizeMinMaxValue||e.vvSizeScaleStops||e.vvSizeUnitValue,a=this.tessellationProperties._halfWidth(i,r,n,a,o,h,l,u,c,f,d)=>{const _=M(d,Math.ceil(B*s._halfWidth)),m=P(Math.round(B*l),Math.round(B*u),Math.round(B*c),Math.round(B*f)),p=P(B*o,B*h,0,s._bitset),y=s.out;return y.vertexBounds(i,r,t,e),y.vertexWrite(M(Jt*i,Jt*r)),y.vertexWrite(s.id),y.vertexWrite(s._fillColor),y.vertexWrite(m),y.vertexWrite(_),y.vertexWrite(s._tl),y.vertexWrite(s._br),y.vertexWrite(p),y.vertexWrite(M(Math.ceil(B*s._halfReferenceWidth),0)),y.vertexWrite(s.minMaxZoom),y.vertexEnd(),s.offset+s.vertexCount++},xn=(s,t,e)=>(i,r,n,a,o,h,l,u,c,f,d)=>{const _=M(B*s._halfWidth,B*s._halfReferenceWidth),m=P(B*l+128,B*u+128,B*c+128,B*f+128),p=s.out,y=s._bitset<<24|s.id;p.vertexBounds(i,r,t,e),p.vertexWrite(M(Jt*i,Jt*r)),p.vertexWrite(y),p.vertexWrite(s._fillColor);const x=or(s.key);return x||(p.vertexWrite(0),p.vertexWrite(0)),p.vertexWrite(0),p.vertexWrite(_),p.vertexWrite(m),x||p.vertexWrite(s.minMaxZoom),p.vertexEnd(),s.offset+s.vertexCount++},gn=s=>(t,e,i)=>{const r=s.out;r.indexWrite(t),r.indexWrite(e),r.indexWrite(i),s.indexCount+=3};let Ce=class xt extends gr(Rt){constructor(t,e,i,r,n,a,o,h,l,u,c,f,d,_,m,p,y,x,g,w){super();const S=rt.load(t);e&&(S.sdf=e.sdf,S.pattern=!0,S.textureBinding=e.textureBinding),this._capType=r,this._joinType=n,this._miterLimitCosine=be(a),this.tessellationProperties._fillColor=o,this.tessellationProperties._tl=h,this.tessellationProperties._br=l,this._hasPattern=u,this._isDashed=c,this._zOrder=y,this._effects=x||null,this._minMaxZoom=M(Math.round(g*E),Math.round(w*E)),this._materialKey=S.data;const T=(d?it:0)|(_?as:0)|(f?Ji:0)|(m?ie:0);this.tessellationProperties._bitset=T,this.tessellationProperties._halfWidth=.5*i,this.tessellationProperties._halfReferenceWidth=.5*p,this.tessellationProperties.offset=0,this._initializeTessellator(!1)}static fromCIMLine(t,e,i){const r=t.color,n=t.scaleFactor||1,a=!!t.dashTemplate;let o=t.cap;a&&o===He.ROUND&&(o=He.SQUARE);const h=t.join,l=v(t.width)*n,u=v(t.referenceWidth),c=v(t.miterLimit),f=r&&$(r)||0,[d,_]=at(t.scaleInfo,i),m=!1;if(!e)return new xt(t.materialKey,e,l,o,h,c,f,0,0,!1,a,t.scaleDash??!1,t.colorLocked??!1,m,t.sampleAlphaOnly,u,t.zOrder,t.effects,d,_);const{rect:p,width:y,height:x}=e,g=p.x+k,w=p.y+k,S=g+y,T=w+x,z=M(g,w),I=M(S,T),Y=!1;return new xt(t.materialKey,e,l,o,h,c,f,z,I,!0,a,t.scaleDash??!1,t.colorLocked??!1,Y,t.sampleAlphaOnly,u,t.zOrder,t.effects,d,_)}static fromFillOutline(t){var i;const e=H.load(t.materialKey);return qt(e)&&t.outline&&((i=t.outline)==null?void 0:i.style)==="esriSLSSolid"?xt.fromSimpleLine({hash:"",materialKey:t.materialKey,...t.outline},null,!0):null}static fromSimpleLine(t,e,i=!1){const{color:r}=t,n=t.style!=="esriSLSSolid"&&t.style!=="esriSLSNull",a=Qr(t.cap||"round"),o=Jr(t.join||"round");let h=r&&t.style!=="esriSLSNull"&&O(r)||0;t.style==="esriSLSNull"&&(h=0);const l=v(t.width),u=t.miterLimit;if(!e)return new xt(t.materialKey,e,l,a,o,u,h,0,0,!1,n,!0,!1,i,!1,l,0,null,N,U);const{rect:c,width:f,height:d}=e,_=c.x+k,m=c.y+k,p=_+f,y=m+d,x=M(_,m),g=M(p,y);return new xt(t.materialKey,e,l,a,o,u,h,x,g,!0,n,!0,!1,i,!1,l,0,null,N,U)}static fromPictureLineSymbol(t,e,i,r){return St.getLogger("esri.views.2d.engine.webgl.WGLLineTemplate").error("PictureLineSymbol support does not exist!"),null}};const vn=100,ki=1,vr=s=>class extends s{constructor(...t){super(...t),this.forceLibtess=!1,this._bitset=0,this._lineTemplate=null,this.geometryType=b.FILL}_maybeAddLineTemplate(t){this._lineTemplate=Ce.fromFillOutline(t)}_write(t,e,i,r){const n=e.geometryType==="esriGeometryPoint",a=H.load(this._materialKey);t.recordStart(e.getDisplayId(),this._materialKey,this.geometryType,n),this._writeGeometry(t,e,a,r,n),qt(a)&&this._lineTemplate!=null&&this._lineTemplate.writeGeometry(t,e,r,n),t.recordEnd()}_writeGeometry(t,e,i,r,n){const a=this._getGeometry(e,r,n);if(a==null)return;const o=[];if(!(a.maxLength>vn)&&!this.forceLibtess&&dn(o,a))return void(o.length&&this._writeVertices(t,e,a.coords,a.lengths,i,o));const h=fn(a);this._writeVertices(t,e,h,[h.length/2],i)}_writeVertex(t,e,i,r,n,a){const o=M(ki*r,ki*n);if(t.vertexBounds(r,n,0,0),t.vertexWrite(o),t.vertexWrite(e),i.symbologyType===A.DOT_DENSITY)t.vertexWriteF32(1/Math.abs(a.readGeometryArea()));else{t.vertexWrite(this.fillColor);const h=or(i);h||(t.vertexWrite(this.tl),t.vertexWrite(this.br)),t.vertexWrite(this.aux21),t.vertexWrite(this.aux22),t.vertexWrite(this.aux3),h||t.vertexWrite(this._minMaxZoom)}}_writeVertices(t,e,i,r,n,a){const o=e.getDisplayId(),h=this._bitset<<24|o,l=r.reduce((d,_)=>d+_),u=xe(n.geometryType,n.symbologyType).geometry/4,c=t.vertexCount();t.vertexEnsureSize(u*l);let f=0;if(a)for(const d of a){const _=i[2*d],m=i[2*d+1];this._writeVertex(t,h,n,_,m,e),f++}else for(let d=0;d0,o=e.readLegacyFeature(),h=e.getObjectId(),l=this._materialCache,u=this._cimLayer.materialHash;if(!u)return Ai.error("A Dynamic mesh template must have a material hash value or function!"),null;const c=typeof u=="function"?u(o,i,r,h):u,f=l.get(c);if(f!=null)return f;const d=this._ongoingMaterialRequestMap.get(c);if(d)return d;const _=this._cimLayer,m=Yr(_.cim,this._cimLayer.materialOverrides);m.mosaicHash=c;const{type:p,url:y}=_,x={cim:m,type:p,mosaicHash:c,url:y,size:null,dashTemplate:null,text:null,fontName:null,objectId:h,animatedSymbolProperties:null};switch(p){case"marker":x.size=Ft(_.size,o,i,r),x.animatedSymbolProperties=Ft(_.animatedSymbolProperties,o,i,r);break;case"line":x.dashTemplate=_.dashTemplate;break;case"text":x.text=Ft(_.text,o,i,r),x.fontName=Ft(_.fontName,o,i,r)}const g=t.getMosaicItem(x,n).then(w=>(a||(this._ongoingMaterialRequestMap.delete(c),l.set(c,w)),w)).catch(w=>(this._ongoingMaterialRequestMap.delete(c),Ai.error(".analyze()",w.message),null));return a||this._ongoingMaterialRequestMap.set(c,g),g}};function F(s,t){if(s&&"name"in s){const e=s;return t&&t.error(new bt(e.name,e.message,e.details)),!1}return!0}let Mn=class Mr extends vr(ue){constructor(t,e,i){var u;if(super(t),this._minMaxZoom=M(Math.round(e*E),Math.round(i*E)),L(t.color)){const c=(f,d,_)=>{const m=t.color(f,d,_);return m&&$(m)||0};this._dynamicPropertyMap.set("fillColor",c)}else{const c=t.color;this.fillColor=c&&$(c)||0}const r=((u=t.cim.placement)==null?void 0:u.type)==="CIMMarkerPlacementInsidePolygon"&&t.cim.placement.shiftOddRows?2:1,n=t.height;if(L(n)){const c=(f,d,_)=>n(f,d,_)*r;this._dynamicPropertyMap.set("_height",c)}else this._height=(n||0)*r;const a=t.offsetX;if(L(a)){const c=(f,d,_)=>v(a(f,d,_));this._dynamicPropertyMap.set("_offsetX",c)}else this._offsetX=v(a||0);const o=t.offsetY;if(L(o)){const c=(f,d,_)=>v(-o(f,d,_));this._dynamicPropertyMap.set("_offsetY",c)}else this._offsetY=v(-o||0);const h=t.scaleX;L(h)?this._dynamicPropertyMap.set("_scaleX",h):this._scaleX=h||1;const l=t.angle;if(L(l)){const c=(f,d,_)=>ve(l(f,d,_));this._dynamicPropertyMap.set("_angle",c)}else this._angle=ve(l)||0;if(t.effects!=null){const c=t.effects;L(c)?this._dynamicPropertyMap.set("_effects",c):this._effects=c}this._cimFillLayer=t,this._bitset=(t.colorLocked?it:0)|(t.applyRandomOffset?tr:0)|(t.sampleAlphaOnly?ie:0)|(t.hasUnresolvedReplacementColor?er:0),this._fillMaterialKey=t.materialKey}static fromCIMFill(t,e){const[i,r]=at(t.scaleInfo,e);return new Mr(t,i,r)}bindFeature(t,e,i){const r=t.readLegacyFeature();this._dynamicPropertyMap.forEach((u,c)=>{this[c]=u(r,e,i)});const n=H.load(this._fillMaterialKey),a=this._materialCache,o=(0,this._cimFillLayer.materialHash)(r,e,i),h=a.get(o);let l=null;if(h&&F(h.spriteMosaicItem)&&(l=h.spriteMosaicItem),l){const{rect:u,width:c,height:f}=l,d=u.x+k,_=u.y+k,m=d+c,p=_+f;let y=v(this._height);y<=0&&(y=p-_),yL(t.width)?.5*v(t.width(c,f,d)):r;this._dynamicPropertyMap.set("_halfWidth",n),L(t.cap)?this._dynamicPropertyMap.set("_capType",t.cap):this._capType=t.cap,L(t.join)?this._dynamicPropertyMap.set("_joinType",t.join):this._joinType=t.join;const a=t.color;if(L(a)){const c=(f,d,_)=>$(a(f,d,_));this._dynamicPropertyMap.set("_fillColor",c)}else this._fillColor=a&&$(a)||0;const o=t.miterLimit;if(L(o)){const c=(f,d,_)=>be(o(f,d,_));this._dynamicPropertyMap.set("_miterLimitCosine",c)}else this._miterLimitCosine=be(o);if(t.effects!=null){const c=t.effects;L(c)?this._dynamicPropertyMap.set("_effects",c):this._effects=c}this._scaleFactor=t.scaleFactor||1,this._isDashed=t.dashTemplate!=null;const h=t.colorLocked?it:0,l=t.scaleDash?Ji:0,u=t.sampleAlphaOnly?ie:0;this.tessellationProperties._bitset=h|l|u,this._materialKey=t.materialKey,this._initializeTessellator(!0)}static fromCIMLine(t,e){const[i,r]=at(t.scaleInfo,e);return new wr(t,i,r)}bindFeature(t,e,i){const r=t.readLegacyFeature();this._dynamicPropertyMap.forEach((u,c)=>{this[c]=u(r,e,i)}),this._halfWidth*=this._scaleFactor;const n=this._materialCache,a=(0,this._cimLineLayer.materialHash)(r,e,i),o=n.get(a);let h=null;if(o&&F(o.spriteMosaicItem)&&(h=o.spriteMosaicItem),h){this._hasPattern=!0;const{rect:u,width:c,height:f}=h,d=u.x+k,_=u.y+k,m=d+c,p=_+f;this.tessellationProperties._tl=M(d,_),this.tessellationProperties._br=M(m,p)}else this._hasPattern=!1,this.tessellationProperties._tl=0,this.tessellationProperties._br=0;this.tessellationProperties._fillColor=this._fillColor,this.tessellationProperties._halfWidth=this._halfWidth,this.tessellationProperties.offset=0,this.tessellationProperties._halfReferenceWidth=this.tessellationProperties._halfWidth;const l=rt.load(this._materialKey);h&&(l.sdf=h.sdf,l.pattern=!0,l.textureBinding=h.textureBinding),this._materialKey=l.data}};const bn=Mt(),Sn=Q();let Ln=class br extends _r(ue){constructor(t,e,i){super(t),this._cimMarkerLayer=t,this._minMaxZoom=M(Math.round(e*E),Math.round(i*E));const r=t.color;if(L(r)){const f=(d,_,m)=>$(r(d,_,m));this._dynamicPropertyMap.set("_fillColor",f)}else this._fillColor=$(r);const n=t.outlineColor;if(L(n)){const f=(d,_,m)=>$(n(d,_,m));this._dynamicPropertyMap.set("_outlineColor",f)}else this._outlineColor=$(n);const a=t.size;if(L(a)){const f=(d,_,m)=>v(a(d,_,m));this._dynamicPropertyMap.set("_size",f)}else this._size=v(a)||0;const o=t.scaleX;L(o)?this._dynamicPropertyMap.set("_scaleX",o):this._scaleX=o;const h=t.offsetX;if(L(h)){const f=(d,_,m)=>v(h(d,_,m));this._dynamicPropertyMap.set("xOffset",f)}else this.xOffset=v(h)||0;const l=t.offsetY;if(L(l)){const f=(d,_,m)=>v(l(d,_,m));this._dynamicPropertyMap.set("yOffset",f)}else this.yOffset=v(l)||0;const u=t.outlineWidth;if(L(u)){const f=(d,_,m)=>v(u(d,_,m));this._dynamicPropertyMap.set("_outlineWidth",f)}else this._outlineWidth=v(u)||0;const c=t.rotation;if(L(c)?this._dynamicPropertyMap.set("_angle",c):this._angle=c||0,t.effects!=null){const f=t.effects;L(f)?this._dynamicPropertyMap.set("_effects",f):this._effects=f}if(t.markerPlacement!=null){const f=t.markerPlacement;L(f)?this._dynamicPropertyMap.set("_markerPlacement",f):this._markerPlacement=f}this._scaleFactor=t.scaleFactor??1,this._bitSet=(t.alignment===K.MAP?Yi:qi)|(t.colorLocked?it:0)|(t.scaleSymbolsProportionally?ji:0),this._materialKey=t.materialKey}static fromCIMMarker(t,e){const[i,r]=at(t.scaleInfo,e);return new br(t,i,r)}bindFeature(t,e,i){const r=t.readLegacyFeature(),n=t.getObjectId();this._dynamicPropertyMap.forEach((Y,ft)=>{this[ft]=Y(r,e,i)});const a=this._cimMarkerLayer.materialHash,o=typeof a=="function"?a(r,e,i,n):a,h=this._materialCache.get(o);if(!h||!F(h.spriteMosaicItem)||!h.spriteMosaicItem)return void St.getLogger("esri.views.2d.engine.webgl.WGLDynamicMarkerTemplate").error(new bt("mapview-cim","Encountered an error when binding feature"));const l=h.spriteMosaicItem,u=this._cimMarkerLayer.sizeRatio,c=l.width/l.height*this._scaleX,f=dt.load(this._materialKey);f.sdf=l.sdf,f.pattern=!0,f.textureBinding=l.textureBinding,this._materialKey=f.data;const d=this._cimMarkerLayer.rotateClockwise?this._angle:-this._angle,_=this._size,m=_*c,p=this.xOffset,y=this.yOffset;this.xOffset*=this._scaleFactor,this.yOffset*=this._scaleFactor;const x=this._cimMarkerLayer.scaleSymbolsProportionally&&this._cimMarkerLayer.frameHeight?this._size/v(this._cimMarkerLayer.frameHeight):1,g=this._outlineWidth*x,w=v(this._cimMarkerLayer.referenceSize);let S=0,T=0;const z=this._cimMarkerLayer.anchorPoint;z&&(this._cimMarkerLayer.isAbsoluteAnchorPoint?this._size&&(S=v(z.x)/(this._size*c),T=v(z.y)/this._size):(S=z.x,T=z.y)),this._anchorX=S,this._anchorY=T,this._sizeOutlineWidth=P(Math.round(Math.min(Math.sqrt(128*m),255)),Math.round(Math.min(Math.sqrt(128*_),255)),Math.round(Math.min(Math.sqrt(128*g),255)),Math.round(Math.min(Math.sqrt(128*w),255))),this.angle=d;const I=Math.round(64*u);this._bitestAndDistRatio=M(this._bitSet,I),this._computeSize(m,_,u,g,this._scaleFactor,l,f.hasSizeVV(),!0),this._applyTransformation(Sn,bn),this.xOffset=p,this.yOffset=y}};function Ke(s){if(s==null)return[];const t=new Array(s.length);for(let e=0;e$(n(p,y,x));this._dynamicPropertyMap.set("_color",m)}else this._color=$(n);const a=t.outlineColor;if(L(a)){const m=(p,y,x)=>$(a(p,y,x));this._dynamicPropertyMap.set("_haloColor",m)}else this._haloColor=$(a);let o;L(t.size)||(o=Math.min(Math.round(v(t.size*t.sizeRatio)),127));const h=(m,p,y)=>L(t.size)?Math.min(Math.round(v(t.size(m,p,y)*t.sizeRatio)),127):o;if(this._dynamicPropertyMap.set("_size",h),L(t.outlineSize)){const m=(p,y,x)=>Math.min(Math.floor(Ri*v(t.outlineSize(p,y,x)*t.sizeRatio)),127);this._dynamicPropertyMap.set("_haloSize",m)}else this._haloSize=Math.min(Math.floor(Ri*v(t.outlineSize*t.sizeRatio)),127);let l;L(t.offsetX)||(l=Math.round(v(t.offsetX*t.sizeRatio)));const u=(m,p,y)=>L(t.offsetX)?Math.round(v(t.offsetX(m,p,y)*t.sizeRatio)):l;let c;this._dynamicPropertyMap.set("_xOffset",u),L(t.offsetY)||(c=Math.round(v(t.offsetY*t.sizeRatio)));const f=(m,p,y)=>L(t.offsetY)?Math.round(v(t.offsetY(m,p,y)*t.sizeRatio)):c;if(this._dynamicPropertyMap.set("_yOffset",f),L(t.angle)?this._dynamicPropertyMap.set("_angle",t.angle):this._angle=t.angle,L(t.horizontalAlignment)?this._dynamicPropertyMap.set("_horizontalAlignment",t.horizontalAlignment):this._horizontalAlignment=t.horizontalAlignment,L(t.verticalAlignment)?this._dynamicPropertyMap.set("_verticalAlignment",t.verticalAlignment):this._verticalAlignment=t.verticalAlignment,t.effects!=null){const m=t.effects;L(m)?this._dynamicPropertyMap.set("_effects",m):this._effects=m}if(t.markerPlacement!=null){const m=t.markerPlacement;L(m)?this._dynamicPropertyMap.set("_markerPlacement",m):this._textPlacement=m}L(t.text)?this._dynamicPropertyMap.set("_text",t.text):this._text=t.text,this._backgroundColor=t.backgroundColor&&$(t.backgroundColor),this._borderLineColor=t.borderLineColor&&$(t.borderLineColor),this._borderLineSize=t.borderLineWidth,this._scaleFactor=r;const d=Math.min(Math.round(v(t.referenceSize*t.sizeRatio)),127);this._referenceSize=Math.round(Math.sqrt(256*d)),this._materialKey=t.materialKey;const _=Ct.load(this._materialKey);_.sdf=!0,this._bitset=(t.alignment===K.MAP?1:0)|(t.colorLocked?1:0)<<1,this._materialKey=_.data,this._decoration="none",this._lineHeight=1,this._lineWidth=512,this._isCIM=!0}static fromCIMText(t,e){const[i,r]=at(t.scaleInfo,e);return new Sr(t,i,r)}async analyze(t,e,i,r){const n=e.readLegacyFeature(),a=Tn(this._cimTextLayer,n,i,r),o=await super.analyze(t,e,i,r,Ke(a));return o!=null&&o.glyphMosaicItems&&this._textToGlyphs.set(a,o.glyphMosaicItems),o}bindFeature(t,e,i){const r=t.readLegacyFeature();if(this._dynamicPropertyMap.forEach((a,o)=>{this[o]=a(r,e,i)}),!this._text||this._text.length===0)return void(this._shapingInfo=null);this._size*=this._scaleFactor,this._scale=this._size/Hi,this._xOffset*=this._scaleFactor,this._yOffset*=this._scaleFactor,this._xAlignD=Ni(this._horizontalAlignment??"center"),this._yAlignD=Ui(this._verticalAlignment??"baseline");const n=this._textToGlyphs.get(this._text)??[];this.bindTextInfo(n,!1)}};class j extends vr(Rt){constructor(t,e,i,r,n,a,o,h,l,u,c,f,d,_,m,p){super(),this._effects=_||void 0;const y=H.load(t);e&&(y.sdf=e.sdf,y.pattern=!0,y.textureBinding=e.textureBinding),this.fillColor=i,this.tl=r,this.br=n,this.aux21=M(a,o),this.aux22=M(h,l),this.aux3=P(u,c,f,0),this._bitset=d,this._minMaxZoom=M(Math.round(m*E),Math.round(p*E)),this._materialKey=y.data}static fromCIMFill(t,e,i){const r=t.color,n=r&&$(r)||0,a=t.materialKey,[o,h]=at(t.scaleInfo,i);let l=(t.colorLocked?it:0)|(t.applyRandomOffset?tr:0)|(t.sampleAlphaOnly?ie:0)|(t.hasUnresolvedReplacementColor?er:0);if(!e)return new j(a,null,n,0,0,0,0,0,0,0,0,0,l,t.effects,o,h);const{rect:u,width:c,height:f}=e,d=t.scaleX||1,_=u.x+k,m=u.y+k,p=_+c,y=m+f,x=v(t.height);let g=d*x;t.cim.type==="CIMHatchFill"&&(g*=c/f);let w=x;w<=0&&(w=y-m),w{const i=new qr(e,t);return new Cn(await i.analyzeSymbolReference(s.data,!1),s.data,s.rendererKey,s.maxVVSize)};async function X(s,t,e,i){if(!s)return null;if(s.type==="cim")return Bi(s,t,e);if(s.type==="web-style"){const{fetchCIMSymbolReference:r}=await ke(()=>import("./webStyleUtils-7PxVkooF.js"),__vite__mapDeps([0,1,2])),n={type:"cim",data:await r(s,null,i)??void 0,rendererKey:s.rendererKey,maxVVSize:s.maxVVSize};return Bi(n,t,e)}return s}function Ut(s){if(!s)return null;const{avoidSDFRasterization:t,type:e,cim:i,url:r,materialHash:n,maxVVSize:a}=s,o={cim:i,type:e,mosaicHash:n,url:r,size:null,dashTemplate:null,path:null,text:null,fontName:null,animatedSymbolProperties:null,avoidSDFRasterization:t};switch(e){case"marker":a&&"size"in i&&(i.size=Math.max(a,i.size)),o.size=s.size,o.path=s.path,o.animatedSymbolProperties=s.animatedSymbolProperties;break;case"line":o.dashTemplate=s.dashTemplate;break;case"text":o.text=s.text,o.fontName=s.fontName}return o}const R=St.getLogger("esri.views.2d.engine.webgl.mesh.templates.WGLTemplateStore"),Fi={sortKey:null,templates:new Array},Ge={isOutline:!1,placement:null,symbologyType:A.DEFAULT,vvFlags:0},Wn={...Ye,hash:JSON.stringify(Ye),materialKey:he(b.MARKER,Ge)},Vn={...qe,hash:JSON.stringify(qe),materialKey:he(b.LINE,Ge)},kn={...je,hash:JSON.stringify(je),materialKey:he(b.FILL,Ge)};function q(s,t){const e=s.length;return s.push(null),t.then(i=>s[e]=i),s}function $t(s){return s!=null&&!!(1&s)}function An(s){return s.name==="worker:port-closed"}class Rn{constructor(t,e){this._idCounter=1,this._templateIdCounter=1,this._idToTemplateGroup=new Map,this._symbolToTemplate=new Map,this._fetchQueue=[],this._idToResolver=new Map,this._cimTemplateCache=new Map,this._cimAnalyses=[],this._lock=new In,this._fetchResource=t,this._tileInfo=e}get _markerError(){return this._errorTemplates.marker[0]}get _fillError(){return this._errorTemplates.fill[0]}get _lineError(){return this._errorTemplates.line[0]}get _textError(){return this._errorTemplates.line[0]}createTemplateGroup(t,e,i=null){this._initErrorTemplates();const r=t.hash,n=this._symbolToTemplate.get(r);if(n!=null)return n;const a=new Array,o={sortKey:i,templates:a};e&&this._createMeshTemplates(a,e,!0),this._createMeshTemplates(a,t,!1);const h=this._createGroupId(t.type==="expanded-cim"&&Bn(t));return this._idToTemplateGroup.set(h,o),this._symbolToTemplate.set(r,h),h}getTemplateGroup(t){return this._idToTemplateGroup.get(t)??Fi}getDynamicTemplateGroup(t){return this._idToTemplateGroup.has(t)?($t(t)||R.error("mapview-template-store",`Id ${t} does not refer to a dynamic template`),this._idToTemplateGroup.get(t)):Fi}getMosaicItem(t,e){const i=this._createTemplateId(),r=new Promise(n=>this._idToResolver.set(i,n));return this._fetchQueue.push({symbol:t,id:i,glyphIds:e}),r}finalize(t){return this._fetchQueue.length||this._lock.isHeld()?Pn(this._lock,this._fetchAllQueuedResources.bind(this),t):Promise.resolve()}_initErrorTemplates(){this._errorTemplates||(this._errorTemplates={fill:this._createMeshTemplates([],kn,!1),marker:this._createMeshTemplates([],Wn,!1),line:this._createMeshTemplates([],Vn,!1)})}_fetchAllQueuedResources(t){if(!this._fetchQueue.length)return Promise.resolve();const e=this._fetchQueue,i=this._cimAnalyses;return this._fetchQueue=[],this._cimAnalyses=[],Promise.all(i).then(()=>this._fetchResource(e,t).then(r=>{for(const{id:n,mosaicItem:a}of r)this._idToResolver.get(n)(a),this._idToResolver.delete(n)})).catch(r=>{Ae(r)?this._fetchQueue=this._fetchQueue.concat(e):An(r)||R.error(new bt("mapview-template-store","Unable to fetch requested texture resources",r))})}_createGroupId(t){return this._idCounter++<<1|(t?1:0)}_createTemplateId(){return this._templateIdCounter++}async _createSMS(t){const{spriteMosaicItem:e}=await this.getMosaicItem(t);return F(e,R)?It.fromSimpleMarker(t,e):this._markerError}async _createPMS(t){const{spriteMosaicItem:e}=await this.getMosaicItem(t);return F(e,R)?It.fromPictureMarker(t,e):this._markerError}async _createSFS(t,e){const{spriteMosaicItem:i}=await this.getMosaicItem(t);return F(i,R)?j.fromSimpleFill(t,i,e):this._fillError}async _createPFS(t,e){const{spriteMosaicItem:i}=await this.getMosaicItem(t);return F(i,R)?j.fromPictureFill(t,i,e):this._fillError}async _createSLS(t,e){const{spriteMosaicItem:i}=await this.getMosaicItem(t);return F(i,R)?Ce.fromSimpleLine(t,i):this._lineError}async _createLMS(t){const{spriteMosaicItem:e}=await this.getMosaicItem(t);return F(e,R)?It.fromLineSymbolMarker(t,e):this._markerError}async _createTS(t){const{glyphMosaicItems:e}=await this.getMosaicItem(t);return Le.fromText(t,e??[])}async _createCIMText(t){const{glyphMosaicItems:e}=await this.getMosaicItem(Ut(t),Ke(t.text));return F(e,R)?Le.fromCIMText(t,e,this._tileInfo):this._textError}async _createCIMFill(t){const{spriteMosaicItem:e}=await this.getMosaicItem(Ut(t));return F(e,R)?j.fromCIMFill(t,e,this._tileInfo):this._fillError}async _createCIMLine(t){const{spriteMosaicItem:e}=await this.getMosaicItem(Ut(t));return F(e,R)?Ce.fromCIMLine(t,e,this._tileInfo):this._lineError}async _createCIMMarker(t){const{spriteMosaicItem:e}=await this.getMosaicItem(Ut(t));return F(e,R)?It.fromCIMMarker(t,e,this._tileInfo):this._markerError}async _createCIM(t){const e=t.templateHash;let i=this._cimTemplateCache.get(e);if(i!=null)return i;switch(t.type){case"marker":i=await this._createCIMMarker(t);break;case"line":i=await this._createCIMLine(t);break;case"fill":i=await this._createCIMFill(t);break;case"text":i=await this._createCIMText(t)}return this._cimTemplateCache.set(e,i),i}async _createDynamicCIM(t){const e=t.templateHash;let i=this._cimTemplateCache.get(e);if(i!=null)return i;switch(t.type){case"marker":i=Ln.fromCIMMarker(t,this._tileInfo);break;case"line":i=wn.fromCIMLine(t,this._tileInfo);break;case"fill":i=Mn.fromCIMFill(t,this._tileInfo);break;case"text":i=zn.fromCIMText(t,this._tileInfo)}return this._cimTemplateCache.set(e,i),i}_createPrimitiveMeshTemplates(t,e,i){switch(e.type){case"esriSMS":return q(t,this._createSMS(e));case"esriPMS":return q(t,this._createPMS(e));case"esriSFS":return q(t,this._createSFS(e,i));case"line-marker":return q(t,this._createLMS(e));case"esriPFS":return q(t,this._createPFS(e,i));case"esriSLS":return q(t,this._createSLS(e,!1));case"esriTS":return q(t,this._createTS(e));default:return R.error("Unable to create mesh template for unknown symbol type {: $ }{symbol.type}"),t}}_createMeshTemplates(t,e,i){if(e.type.includes("3d"))return R.error("3D symbols are not supported with MapView"),t;if(e.type==="expanded-cim"){for(const r of e.layers)typeof r.materialHash=="function"?q(t,this._createDynamicCIM(r)):q(t,this._createCIM(r));return t}if(e.type==="composite-symbol"){for(const r of e.layers)this._createPrimitiveMeshTemplates(t,r,i);return t}return e.type==="cim"||e.type==="label"||e.type==="web-style"?t:this._createPrimitiveMeshTemplates(t,e,i)}}const Bn=s=>{if(!s.layers)return!1;for(const t of s.layers)if(typeof t.materialHash=="function")return!0;return!1};class Fn{constructor(t,e,i){this._geometryType=t,this._idField=e,this._templateStore=i}update(t,e){t.mesh.labels!=null&&(this._labelTemplates=this._createLabelTemplates(t.mesh.labels,e)),this._schema=t}_createLabelTemplates(t,e){const i=new Map;if(t.type==="simple"){for(const r of t.classes){const n=Qt.fromLabelClass(r,e);i.set(r.index,n)}return i}for(const r in t.classes){const n=t.classes[r];for(const a of n){const o=Qt.fromLabelClass(a,e);i.set(a.index,o)}}return i}get templates(){return this._templateStore}async analyze(t,e,i,r,n,a,o){if(Qe(o))return;let h;(i==null?void 0:i.type)==="dictionary"&&(h=await i.analyze(this._idField,t.copy(),e,n,a,o));let l=0;for(;t.next();){let u=null;if(u=h?h[l++]:r!=null&&Xi(t.getDisplayId())&&t.readAttribute("cluster_count")!==1?r.match(this._idField,t,this._geometryType,n,a):i.match(this._idField,t,this._geometryType,n,a),t.setGroupId(u),$t(u)){const c=this._templateStore.getDynamicTemplateGroup(u).templates;for(const f of c)f&&f.analyze&&f.analyze(this._templateStore,t,n,a)}}return await ti(),this._templateStore.finalize(o)}async analyzeGraphics(t,e,i,r,n,a){if(Qe(a))return;const o=t.getCursor();for(i&&await i.analyze(this._idField,o.copy(),e,r,n,a);o.next();){let h=o.getGroupId();if(h!=null&&h!==-1||(h=i==null?void 0:i.match(this._idField,o,o.geometryType,r,n),o.setGroupId(h)),$t(h)){const l=this._templateStore.getDynamicTemplateGroup(h).templates;for(const u of l)u&&u.analyze&&u.analyze(this._templateStore,o,r,n)}o.setGroupId(h)}return await ti(),this._templateStore.finalize(a)}writeGraphic(t,e,i,r){const n=e.getGroupId(),a=e.getDisplayId(),o=this._templateStore.getTemplateGroup(n);if(t.featureStart(e.insertAfter,0),a!=null){if($t(n))for(const h of o.templates)h&&h.bindFeature(e,null,null);if(o){for(const h of o.templates)h&&h.write(t,e,i,r);t.featureEnd()}}}writeCursor(t,e,i,r,n,a,o){const h=e.getGroupId(),l=e.getDisplayId(),u=this._templateStore.getTemplateGroup(h),c=u.templates,f=this._getSortKeyValue(e,u);if(t.featureStart(0,f),l!=null&&c){if($t(h))for(const d of c)d.bindFeature(e,i,r);for(const d of c)d.write(t,e,n,o);if(c.length&&a!=null){const d=a&&this._findLabelRef(c);this._writeLabels(t,e,a,d,n,o)}t.featureEnd()}}_getSortKeyValue(t,e){const i=this._schema.mesh.sortKey;if(i==null)return 0;let r=0;return r=i.byRenderer===!0&&e.sortKey!=null?e.sortKey:i.fieldIndex!=null?t.getComputedNumericAtIndex(i.fieldIndex):i.field!=null?t.readAttribute(i.field):t.readAttribute(this._idField),r*=i.order==="asc"?1:-1,r==null||isNaN(r)?0:r}_findLabelRef(t){for(const e of t)if(e instanceof It)return e;return null}_writeLabels(t,e,i,r,n,a){for(const o of i)if(o!=null&&o){const{glyphs:h,rtl:l,index:u}=o,c=this._labelTemplates.get(u);if(!c)continue;c.setZoomLevel(n),c.bindReferenceTemplate(r),c.bindTextInfo(h,l),c.write(t,e,null,a)}}}const Ee=St.getLogger("esri/views/2d/engine/webgl/util/Matcher");async function We(s,t,e,i){switch(s.type){case"simple":case"heatmap":return nt.fromBasicRenderer(s,t,e,i);case"map":return Ne.fromUVRenderer(s,t,e,i);case"interval":return Ze.fromCBRenderer(s,t,e,i);case"dictionary":return Ue.fromDictionaryRenderer(s,t,e,i);case"pie-chart":return te.fromPieChartRenderer(s,t,e,i);case"subtype":return te.fromSubtypes(s,t,e,i)}}class nt{constructor(){this.type="feature",this._defaultResult=null}static async fromBasicRenderer(t,e,i,r){const n=new nt;if(t.symbol){const a=await X(t.symbol,i,r),o=e.createTemplateGroup(a,null);n.setDefault(o)}return n}static async fromPieChartRenderer(t,e,i,r){const n=new nt;if(t.markerSymbol){const a=await X(t.markerSymbol,i,r);let o;t.fillSymbol&&(o=await X(t.fillSymbol,i,r));const h=e.createTemplateGroup(a,o);n.setDefault(h)}return n}size(){return 1}getDefault(){return this._defaultResult}setDefault(t){this._defaultResult=t}match(t,e,i,r,n){return this.getDefault()}async analyze(t,e,i,r,n,a){return null}}class te extends nt{constructor(t,e){super(),this._subMatchers=t,this._subtypeField=e}static async fromSubtypes(t,e,i,r){const n=new Map,a=[];for(const o in t.renderers){const h=parseInt(o,10),l=We(t.renderers[o],e,i,r).then(u=>n.set(h,u));a.push(l)}return await Promise.all(a),new te(n,t.subtypeField)}match(t,e,i,r,n){const a=e.readAttribute(this._subtypeField),o=this._subMatchers.get(a);return o?o.match(t,e,i,r,n):null}}class Ze extends nt{constructor(t,e,i,r){super(),this.type="interval",this._intervals=[],this._isMaxInclusive=e,this._fieldIndex=r,this._field=t,this._normalizationInfo=i}static async fromCBRenderer(t,e,i,r){const{isMaxInclusive:n,normalizationField:a,normalizationTotal:o,normalizationType:h}=t,l=t.field,u=new Ze(l,n,{normalizationField:a,normalizationTotal:o,normalizationType:h},t.fieldIndex),c=await X(t.backgroundFillSymbol,i,r);await Promise.all(t.intervals.map(async d=>{const _=await X(d.symbol,i,r),m=e.createTemplateGroup(_,c),p={min:d.min,max:d.max};u.add(p,m)}));const f=await X(t.defaultSymbol,i,r);if(f){const d=e.createTemplateGroup(f,c);u.setDefault(d)}return u}add(t,e){this._intervals.push({interval:t,result:e}),this._intervals.sort((i,r)=>i.interval.min-r.interval.min)}size(){return super.size()+this._intervals.length}match(t,e,i,r,n){if(this._fieldIndex==null&&!this._field)return this.getDefault();const a=this._fieldIndex!=null?e.getComputedNumericAtIndex(this._fieldIndex):this._getValueFromField(e);if(a==null||isNaN(a)||a===1/0||a===-1/0)return this.getDefault();for(let o=0;o=h.min,c=this._isMaxInclusive?a<=h.max:a{const f=await X(u.symbol,i,r),d=c+1,_=e.createTemplateGroup(f,o,d);u.value===""?h.setNullResult(_):h.add(u.value,_)}));const l=await X(t.defaultSymbol,i,r);if(l){const u=Number.MAX_SAFE_INTEGER,c=e.createTemplateGroup(l,o,u);h.setDefault(c)}return h}setNullResult(t){this._nullResult=t}add(t,e){this._resultsMap.set(t.toString(),e)}size(){return super.size()+this._resultsMap.size}match(t,e,i,r,n){if(this._fieldsIndex==null&&!this._fields)return this.getDefault();const a=this._fieldsIndex!=null?e.getComputedStringAtIndex(this._fieldsIndex):this._getValueFromFields(e);if(this._nullResult!==null&&(a==null||a===""||a===""))return this._nullResult;if(a==null)return this.getDefault();const o=a.toString();return this._resultsMap.has(o)?this._resultsMap.get(o):this.getDefault()}_getValueFromFields(t){const e=[];for(const i of this._fields){const r=t.readAttribute(i);r==null||r===""?e.push(""):e.push(r)}return e.join(this._seperator)}}async function On(s,t){const e=s||1;if(typeof e=="number")return(r,n,a)=>e;const i=await kr(e,t.spatialReference,t.fields);return(r,n,a)=>Ar(i,r,{$view:a},t.geometryType,n)||1}let _e;async function Dn(){return _e||(_e=ke(()=>import("./createSymbolSchema-Tv2jMAOE.js"),__vite__mapDeps([3,4,1,2,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]))),_e}class Ue extends nt{constructor(t,e,i,r,n,a){super(),this.type="dictionary",this._groupIdCache=new Wr(100),this._loader=t,this._fieldMap=t.fieldMap,this._symbolFields=t.getSymbolFields(),this._templates=e,this._info=i,this._scaleFn=r,this._schemaUtilsModule=n,this._symbolOptions=a}static async fromDictionaryRenderer(t,e,i,r){const[{DictionaryLoader:n},a]=await Promise.all([ke(()=>import("./index-J0iiHjMT.js").then(l=>l.zB),__vite__mapDeps([1,2])),Dn()]),o=new n(t.url,t.config,t.fieldMap);await o.fetchResources({spatialReference:i.spatialReference,fields:i.fields});const h=await On(t.scaleExpression,i);return new Ue(o,e,i,h,a,t.symbolOptions)}async _analyzeFeature(t,e,i,r,n){const a=t.readLegacyFeature(),o=this._scaleFn(a,i,r),h=this._attributeHash(a)+"-"+o,l=this._groupIdCache.get(h);if(l)return l;const u={...r,spatialReference:this._info.spatialReference,abortOptions:n,fields:this._info.fields},c=await this._loader.getSymbolAsync(a,u),f=this._schemaUtilsModule.createSymbolSchema(c,this._symbolOptions),d=X(f,this._info,e,n).then(_=>{if((_==null?void 0:_.type)!=="expanded-cim")return Ee.error(new bt("mapview-bad-type",`Found unexpected type ${_==null?void 0:_.type} in dictionary response`)),null;_.hash+="-"+o;for(const m of _.layers)m.scaleFactor=o,m.templateHash+="-"+o;return this._templates.createTemplateGroup(_,null)});return this._groupIdCache.put(h,d,1),d}async analyze(t,e,i,r,n,a){const o=e.getCursor(),h=[];for(;o.next();)h.push(this._analyzeFeature(o,i,r,n,a));return Promise.all(h).then(l=>l.filter(Vr))}match(t,e,i,r,n){return null}_attributeHash(t){var i;let e="";for(const r of this._symbolFields){const n=(i=this._fieldMap)==null?void 0:i[r];n&&(e+=t.attributes[n]+"-")}return e}}class Kn{constructor(t){this._remoteClient=t,this._resourceMap=new Map,this._inFlightResourceMap=new Map,this.geometryEngine=null,this.geometryEnginePromise=null}destroy(){}async fetchResource(t,e){const i=this._resourceMap,r=i.get(t);if(r)return r;let n=this._inFlightResourceMap.get(t);if(n)return n;try{n=this._remoteClient.invoke("tileRenderer.fetchResource",{url:t},{...e}),this._inFlightResourceMap.set(t,n),n.then(a=>(this._inFlightResourceMap.delete(t),i.set(t,a),a))}catch(a){return Ae(a)?null:{width:0,height:0}}return n}getResource(t){return this._resourceMap.get(t)??null}loadFont(t){return Promise.resolve(null)}}function Oi(s,t){const e=t-t/4,i=t+t/2;return(!s.minScale||s.minScale>=e)&&(!s.maxScale||s.maxScale<=i)}function Di(s){var i;const t=s.message,e={message:{data:{},tileKey:t.tileKey,tileKeyOrigin:t.tileKeyOrigin,version:t.version},transferList:new Array};for(const r in t.data){const n=r,a=t.data[n];if(e.message.data[n]=null,a!=null){const o=a.stride,h=a.indices.slice(0),l=a.vertices.slice(0),u=a.records.slice(0),c=(i=a.metrics)==null?void 0:i.slice(0),f={stride:o,indices:h,vertices:l,records:u,metrics:c};e.transferList.push(h,l,u),e.message.data[n]=f}}return e}let Ve=class extends hs{constructor(){super(...arguments),this.type="symbol",this._matchers={feature:null,aggregate:null},this._bufferData=new Map,this._bufferIds=new Map}initialize(){this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this))]),this._resourceManagerProxy=new Kn(this.remoteClient)}destroy(){this._resourceManagerProxy.destroy()}get supportsTileUpdates(){return!0}forEachBufferId(s){this._bufferIds.forEach(t=>{t.forEach(s)})}async update(s,t){var r;const e=t.schema.processors[0];if(e.type!=="symbol")return;const i=Fr(this._schema,e);(Je(i,"mesh")||Je(i,"target"))&&(s.mesh=!0,(r=s.why)==null||r.mesh.push("Symbology changed"),this._schema=e,this._factory=this._createFactory(e),this._factory.update(e,this.tileStore.tileScheme.tileInfo))}onTileMessage(s,t,e,i){return Lt(i),this._onTileData(s,t,e,i)}onTileClear(s,t){const e={clear:!0,end:t};return this._bufferData.delete(s.key.id),this._bufferIds.delete(s.key.id),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:s.id,data:e})}onTileError(s,t,e){const i=e.signal,r={tileKey:s.id,error:t};return this.remoteClient.invoke("tileRenderer.onTileError",r,{signal:i})}onTileUpdate(s){for(const t of s.removed)this._bufferData.has(t.key.id)&&this._bufferData.delete(t.key.id),this._bufferIds.has(t.key.id)&&this._bufferIds.delete(t.key.id);for(const t of s.added)this._bufferData.forEach(e=>{for(const i of e)i.message.tileKey===t.id&&this._updateTileMesh("append",t,Di(i),[],!1,!1,null)})}_addBufferData(s,t){var e;this._bufferData.has(s)||this._bufferData.set(s,[]),(e=this._bufferData.get(s))==null||e.push(Di(t))}_createFactory(s){const{geometryType:t,objectIdField:e,fields:i}=this.service,r=(l,u)=>this.remoteClient.invoke("tileRenderer.getMaterialItems",l,u),n={geometryType:t,fields:i,spatialReference:Or.fromJSON(this.spatialReference)},a=new Rn(r,this.tileStore.tileScheme.tileInfo),{matcher:o,aggregateMatcher:h}=s.mesh;return this._store=a,this._matchers.feature=We(o,a,n,this._resourceManagerProxy),this._matchers.aggregate=h?We(h,a,n,this._resourceManagerProxy):null,new Fn(t,e,a)}async _onTileData(s,t,e,i){var c;Lt(i);const{type:r,addOrUpdate:n,remove:a,clear:o,end:h}=t,l=!!this._schema.mesh.sortKey;if(!n){const f={type:r,addOrUpdate:null,remove:a,clear:o,end:h,sort:l};return this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:s.id,data:f},i)}const u=this._processFeatures(s,n,e,i,(c=t.status)==null?void 0:c.version);try{const f=await u;if(f==null){const _={type:r,addOrUpdate:null,remove:a,clear:o,end:h,sort:l};return this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:s.id,data:_},i)}const d=[];for(const _ of f){let m=!1;const p=_.message.bufferIds,y=s.key.id,x=_.message.tileKey;if(y!==x&&p!=null){if(!this.tileStore.get(x)){this._addBufferData(y,_),d.push(_);continue}let g=this._bufferIds.get(x);g||(g=new Set,this._bufferIds.set(x,g));const w=Array.from(p);for(const S of w){if(g.has(S)){m=!0;break}g.add(S)}}m||(this._addBufferData(y,_),d.push(_))}await Promise.all(d.map(_=>{const m=s.key.id===_.message.tileKey,p=m?t.remove:[],y=m&&t.end;return this._updateTileMesh(r,s,_,p,y,!!t.clear,i.signal)}))}catch(f){this._handleError(s,f,i)}}async _updateTileMesh(s,t,e,i,r,n,a){const o=s,h=e.message.tileKey,l=!!this._schema.mesh.sortKey;h!==t.key.id&&(r=!1);const u=e==null?void 0:e.message,c={type:o,addOrUpdate:u,remove:i,clear:n,end:r,sort:l},f={transferList:(e==null?void 0:e.transferList)??[],signal:a};return Lt(f),this.remoteClient.invoke("tileRenderer.onTileData",{tileKey:h,data:c},f)}async _processFeatures(s,t,e,i,r){if(t==null||!t.hasFeatures)return null;const n={transform:s.transform,hasZ:!1,hasM:!1},a=this._factory,o={viewingMode:"",scale:s.scale},h=await this._matchers.feature,l=await this._matchers.aggregate;Lt(i);const u=this._getLabelInfos(s,t);return await a.analyze(t.getCursor(),this._resourceManagerProxy,h,l,n,o),Lt(i),this._writeFeatureSet(s,t,n,u,a,e,r)}_writeFeatureSet(s,t,e,i,r,n,a){const o=t.getSize(),h=this._schema.mesh.matcher.symbologyType,l=new bs(s.key.id,{features:o,records:o,metrics:0},h,n,h!==A.HEATMAP,a),u={viewingMode:"",scale:s.scale},c=t.getCursor();for(;c.next();)try{const d=c.getDisplayId(),_=i!=null?i.get(d):null;r.writeCursor(l,c,e,u,s.level,_,this._resourceManagerProxy)}catch{}const f=s.tileInfoView.tileInfo.isWrappable;return l.serialize(f)}_handleError(s,t,e){if(!Ae(t)){const i={tileKey:s.id,error:t.message};return this.remoteClient.invoke("tileRenderer.onTileError",i,{signal:e.signal})}return Promise.resolve()}_getLabelingSchemaForScale(s){const t=this._schema.mesh.labels;if(t==null)return null;if(t.type==="subtype"){const i={type:"subtype",classes:{}};let r=!1;for(const n in t.classes){const a=t.classes[n].filter(o=>Oi(o,s.scale));r=r||!!a.length,i.classes[n]=a}return r?i:null}const e=t.classes.filter(i=>Oi(i,s.scale));return e.length?{type:"simple",classes:e}:null}_getLabels(s,t){if(t.type==="subtype"){const e=this.service.subtypeField;Dr(e,"Expected to find subtype Field");const i=s.readAttribute(e);return i==null?[]:t.classes[i]??[]}return t.classes}_getLabelInfos(s,t){const e=this._getLabelingSchemaForScale(s);if(e==null)return null;const i=new Map,r=t.getCursor();for(;r.next();){const n=r.getDisplayId(),a=[],o=Xi(n),h=o&&r.readAttribute("cluster_count")!==1?"aggregate":"feature",l=this._getLabels(r,e);for(const u of l){if(u.target!==h)continue;const c=r.getStorage(),f=o&&h==="feature"?c.getComputedStringAtIndex(r.readAttribute("referenceId"),u.fieldIndex):c.getComputedStringAtIndex(n,u.fieldIndex);if(!f)continue;const d=ye(f.toString()),_=d[0],m=d[1];this._store.getMosaicItem(u.symbol,Ke(_)).then(p=>{a[u.index]={glyphs:p.glyphMosaicItems??[],rtl:m,index:u.index}})}i.set(n,a)}return i}};Ve=Rr([Br("esri.views.2d.layers.features.processors.SymbolProcessor")],Ve);const Gn=Ve,xa=Object.freeze(Object.defineProperty({__proto__:null,default:Gn},Symbol.toStringTag,{value:"Module"}));export{ha as A,xa as S,ar as _,he as f}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/webStyleUtils-7PxVkooF.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/createSymbolSchema-Tv2jMAOE.js","assets/cimAnalyzer-DtyBzAGI.js","assets/labelPoint-ysDT9nFH.js","assets/TileClipper-NSFZXMR1.js","assets/definitions-DqQMJYPH.js","assets/number-sTjsTbdA.js","assets/BidiEngine-8z8MVveq.js","assets/enums-uQoFEhYh.js","assets/Pipeline--6jAENf8.js","assets/QueryEngine-8tLWlkSE.js","assets/WhereClause-XAMIZ4-B.js","assets/TimeOnly-ljWtUK7N.js","assets/json-v6EOeNTY.js","assets/QueryEngineCapabilities-PzVpW5yD.js","assets/utils-P5wTOmqv.js","assets/generateRendererUtils-_1jVE02H.js","assets/StreamFeatureManager-QrKJ84_c.js","assets/quickselect-UFB0jJTZ.js","assets/ogcFeatureUtils-dtzP0u64.js","assets/geojson-fSjaGZrp.js","assets/date-be_IQzZd.js","assets/clientSideDefaults-F-CNnR0g.js","assets/query-rG0aX6cE.js","assets/pbfQueryUtils-pWizwTQZ.js","assets/pbf-o0zzptPp.js","assets/queryZScale-IaMm02_2.js","assets/createConnection-4ppGVnSc.js","assets/geohashUtils-U0jvYCSY.js","assets/BaseProcessor-nWGHAt7P.js","assets/TurboLine-SWK4qRwh.js","assets/Rect-bBBxMtVp.js","assets/GeometryUtils-K2DOc0l8.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/TerrainTileTree3DDebugger-Or7WvqAU.js b/dist/assets/TerrainTileTree3DDebugger-3kUE1gqF.js similarity index 58% rename from dist/assets/TerrainTileTree3DDebugger-Or7WvqAU.js rename to dist/assets/TerrainTileTree3DDebugger-3kUE1gqF.js index 56fb077..ad86b4d 100644 --- a/dist/assets/TerrainTileTree3DDebugger-Or7WvqAU.js +++ b/dist/assets/TerrainTileTree3DDebugger-3kUE1gqF.js @@ -1 +1 @@ -import{d as a,P as i,l as t,eD as n,e as l,c as o}from"./index-J0iiHjMT.js";import{d as p}from"./TileTreeDebugger-2DVbY5sQ.js";let s=class extends p{constructor(e){super(e),this.enablePolygons=!1}initialize(){a(()=>this.enabled,e=>this.view.basemapTerrain.renderPatchBorders=e,i)}getTiles(){const e=this.view.basemapTerrain.spatialReference!=null?this.view.basemapTerrain.spatialReference:null;return this.view.basemapTerrain.test.getRenderedTiles().map(r=>({...r,geometry:t.fromExtent(n(r.extent,e))}))}};s=l([o("esri.views.3d.layers.support.TerrainTileTree3DDebugger")],s);export{s as TerrainTileTree3DDebugger}; +import{B as i,P as a,j as t,ex as n,e as l,c as o}from"./index-pCX-0tJH.js";import{d as p}from"./TileTreeDebugger-MxH50s1q.js";let s=class extends p{constructor(e){super(e),this.enablePolygons=!1}initialize(){i(()=>this.enabled,e=>this.view.basemapTerrain.renderPatchBorders=e,a)}getTiles(){const e=this.view.basemapTerrain.spatialReference!=null?this.view.basemapTerrain.spatialReference:null;return this.view.basemapTerrain.test.getRenderedTiles().map(r=>({...r,geometry:t.fromExtent(n(r.extent,e))}))}};s=l([o("esri.views.3d.layers.support.TerrainTileTree3DDebugger")],s);export{s as TerrainTileTree3DDebugger}; diff --git a/dist/assets/TextOverlayItem-YHZxWGyg.js b/dist/assets/TextOverlayItem-YHZxWGyg.js new file mode 100644 index 0000000..a27d5a1 --- /dev/null +++ b/dist/assets/TextOverlayItem-YHZxWGyg.js @@ -0,0 +1 @@ +import{e as n,y as h,c as m,g as b,W as g}from"./index-pCX-0tJH.js";let _=t=>({vnodeSelector:"",properties:void 0,children:void 0,text:t.toString(),domNode:null}),v=(t,e,o)=>{for(let s=0,r=e.length;s({vnodeSelector:"",properties:void 0,children:void 0,text:t.toString(),domNode:null}),v=(t,e,o)=>{for(let s=0,r=e.length;s0;)--t,e(s[t],t)}function Rt(s,e){const t=s.length;for(let i=0;i0;)if(--t,e(s[t],t))return t;return-1}function Qe(s,e){const t=Le(s,e);if(t!==-1)return s[t]}function Ze(s,e){const t=qe(s,e);if(t!==-1)return s[t]}function et(s,e){let t=0,i=s.length,r=!1;for(;t>1,a=e(s[n]);a<0?t=n+1:a===0?(r=!0,t=n+1):i=n}return{found:r,index:r?t-1:t}}function tt(s,e){let t=0,i=s.length,r=!1;for(;t>1,a=e(s[n]);a<0?t=n+1:(a===0&&(r=!0),i=n)}return{found:r,index:t}}function Vt(s,e){let t=s.length;for(;t>0;)--t,e(s[t])||s.splice(t,1)}class Ne{constructor(){Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._disposed=!1}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this._dispose())}}class P{constructor(e){Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispose",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._disposed=!1,this._dispose=e}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this._dispose())}}class Ut extends Ne{constructor(){super(...arguments),Object.defineProperty(this,"_disposers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}_dispose(){g(this._disposers,e=>{e.dispose()})}}class k extends Ne{constructor(e){super(),Object.defineProperty(this,"_disposers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._disposers=e}_dispose(){g(this._disposers,e=>{e.dispose()})}get disposers(){return this._disposers}}class it extends P{constructor(){super(...arguments),Object.defineProperty(this,"_counter",{enumerable:!0,configurable:!0,writable:!0,value:0})}increment(){return++this._counter,new P(()=>{--this._counter,this._counter===0&&this.dispose()})}}class ${constructor(){Object.defineProperty(this,"_listeners",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_killed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_disabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_iterating",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_enabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._listeners=[],this._killed=[],this._disabled={},this._iterating=0,this._enabled=!0,this._disposed=!1}isDisposed(){return this._disposed}dispose(){if(!this._disposed){this._disposed=!0;const e=this._listeners;this._iterating=1,this._listeners=null,this._disabled=null;try{g(e,t=>{t.disposer.dispose()})}finally{this._killed=null,this._iterating=null}}}hasListeners(){return this._listeners.length!==0}hasListenersByType(e){return Je(this._listeners,t=>(t.type===null||t.type===e)&&!t.killed)}enable(){this._enabled=!0}disable(){this._enabled=!1}enableType(e){delete this._disabled[e]}disableType(e,t=1/0){this._disabled[e]=t}_removeListener(e){if(this._iterating===0){const t=this._listeners.indexOf(e);if(t===-1)throw new Error("Invalid state: could not remove listener");this._listeners.splice(t,1)}else this._killed.push(e)}_removeExistingListener(e,t,i,r){if(this._disposed)throw new Error("EventDispatcher is disposed");this._eachListener(n=>{n.once!==e||n.type!==t||i!==void 0&&n.callback!==i||n.context!==r||n.disposer.dispose()})}isEnabled(e){if(this._disposed)throw new Error("EventDispatcher is disposed");return this._enabled&&this._listeners.length>0&&this.hasListenersByType(e)&&this._disabled[e]===void 0}removeType(e){if(this._disposed)throw new Error("EventDispatcher is disposed");this._eachListener(t=>{t.type===e&&t.disposer.dispose()})}has(e,t,i){return Le(this._listeners,r=>r.once!==!0&&r.type===e&&(t===void 0||r.callback===t)&&r.context===i)!==-1}_shouldDispatch(e){if(this._disposed)throw new Error("EventDispatcher is disposed");const t=this._disabled[e];return _(t)?(t<=1?delete this._disabled[e]:--this._disabled[e],!1):this._enabled}_eachListener(e){++this._iterating;try{g(this._listeners,e)}finally{--this._iterating,this._iterating===0&&this._killed.length!==0&&(g(this._killed,t=>{this._removeListener(t)}),this._killed.length=0)}}dispatch(e,t){this._shouldDispatch(e)&&this._eachListener(i=>{i.killed||i.type!==null&&i.type!==e||i.dispatch(e,t)})}_on(e,t,i,r,n,a){if(this._disposed)throw new Error("EventDispatcher is disposed");this._removeExistingListener(e,t,i,r);const o={type:t,callback:i,context:r,shouldClone:n,dispatch:a,killed:!1,once:e,disposer:new P(()=>{o.killed=!0,this._removeListener(o)})};return this._listeners.push(o),o}onAll(e,t,i=!0){return this._on(!1,null,e,t,i,(r,n)=>e.call(t,n)).disposer}on(e,t,i,r=!0){return this._on(!1,e,t,i,r,(n,a)=>t.call(i,a)).disposer}once(e,t,i,r=!0){const n=this._on(!0,e,t,i,r,(a,o)=>{n.disposer.dispose(),t.call(i,o)});return n.disposer}off(e,t,i){this._removeExistingListener(!1,e,t,i)}copyFrom(e){if(this._disposed)throw new Error("EventDispatcher is disposed");if(e===this)throw new Error("Cannot copyFrom the same TargetedEventDispatcher");const t=[];return g(e._listeners,i=>{!i.killed&&i.shouldClone&&(i.type===null?t.push(this.onAll(i.callback,i.context)):i.once?t.push(this.once(i.type,i.callback,i.context)):t.push(this.on(i.type,i.callback,i.context)))}),new k(t)}}function R(s,e){if(!(s>=0&&s=0&&e{this.push(t)})}copyFrom(e){this.pushAll(e._values)}pop(){return this._values.length-1<0?void 0:this.removeIndex(this._values.length-1)}shift(){return this._values.length?this.removeIndex(0):void 0}setAll(e){const t=this._values;this._values=[],this._onClear(t),g(e,i=>{this._values.push(i),this._onPush(i)})}clear(){this.setAll([])}*[Symbol.iterator](){const e=this._values.length;for(let t=0;t{t.dispose()}),super._onClear(e)}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this.autoDispose&&g(this._values,e=>{e.dispose()}))}}class Kt extends st{constructor(e,t){super(),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"make",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e,this.make=t}}class rt extends Re{constructor(e){super(),Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._container=e,this._events=this.events.onAll(t=>{if(t.type==="clear")g(t.oldValues,i=>{this._onRemoved(i)});else if(t.type==="push")this._onInserted(t.newValue);else if(t.type==="setIndex")this._onRemoved(t.oldValue),this._onInserted(t.newValue,t.index);else if(t.type==="insertIndex")this._onInserted(t.newValue,t.index);else if(t.type==="removeIndex")this._onRemoved(t.oldValue);else{if(t.type!=="moveIndex")throw new Error("Unknown IListEvent type");this._onRemoved(t.value),this._onInserted(t.value,t.newIndex)}})}_onInserted(e,t){e._setParent(this._container,!0);const i=this._container._childrenDisplay;t===void 0?i.addChild(e._display):i.addChildAt(e._display,t)}_onRemoved(e){this._container._childrenDisplay.removeChild(e._display),this._container.markDirtyBounds(),this._container.markDirty()}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this._events.dispose(),g(this.values,e=>{e.dispose()}))}}class f{constructor(e){Object.defineProperty(this,"_value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._value=e}get value(){return this._value/100}get percent(){return this._value}toString(){return this._value+"%"}interpolate(e,t){return e+this.value*(t-e)}static normalize(e,t,i){return e instanceof f?e:new f(t===i?0:100*Math.min(Math.max(1/(i-t)*(e-t),0),1))}}function xe(s){return new f(s)}const zt=xe(0),nt=xe(100),at=xe(50);function T(s){return Object.keys(s)}function ot(s,e){return T(s).sort(e)}function Gt(s){return Object.assign({},s)}function w(s,e){T(s).forEach(t=>{e(t,s[t])})}function Yt(s,e){for(let t in s)if(ht(s,t)&&!e(t,s[t]))break}function ht(s,e){return{}.hasOwnProperty.call(s,e)}function Xt(s){s.parentNode&&s.parentNode.removeChild(s)}function Fe(s,e,t,i){return s.addEventListener(e,t,i||!1),new P(()=>{s.removeEventListener(e,t,i||!1)})}function $t(s){return Fe(window,"resize",e=>{s()})}function le(s){switch(s){case"touchevents":return window.hasOwnProperty("TouchEvent");case"pointerevents":return window.hasOwnProperty("PointerEvent");case"mouseevents":return window.hasOwnProperty("MouseEvent");case"wheelevents":return window.hasOwnProperty("WheelEvent");case"keyboardevents":return window.hasOwnProperty("KeyboardEvent")}return!1}function de(s){return s.pointerId||0}function Jt(){if(document.activeElement&&document.activeElement!=document.body)if(document.activeElement.blur)document.activeElement.blur();else{let s=document.createElement("button");s.style.position="fixed",s.style.top="0px",s.style.left="-10000px",document.body.appendChild(s),s.focus(),s.blur(),document.body.removeChild(s)}}function qt(s){s&&s.focus()}function Qt(s){if(le("pointerevents"))return s;if(le("touchevents"))switch(s){case"pointerover":case"pointerdown":return"touchstart";case"pointerout":case"pointerleave":case"pointerup":return"touchend";case"pointermove":return"touchmove";case"click":return"click";case"dblclick":return"dblclick"}else if(le("mouseevents"))switch(s){case"pointerover":return"mouseover";case"pointerout":return"mouseout";case"pointerleave":return"mouseleave";case"pointerdown":return"mousedown";case"pointermove":return"mousemove";case"pointerup":return"mouseup";case"click":return"click";case"dblclick":return"dblclick"}return s}function Se(s){if(typeof Touch<"u"&&s instanceof Touch)return!0;if(typeof PointerEvent<"u"&&s instanceof PointerEvent&&s.pointerType!=null)switch(s.pointerType){case"touch":case"pen":case 2:return!0;case"mouse":case 4:return!1;default:return!(s instanceof MouseEvent)}else if(s.type!=null&&s.type.match(/^mouse/))return!1;return!0}function Zt(s,e,t){s.style[e]=t}function ei(s,e){return s.style[e]}function ti(s){if(s.composedPath){const e=s.composedPath();return e.length===0?null:e[0]}return s.target}function lt(s,e){let t=e;for(;;){if(s===t)return!0;if(t.parentNode===null){if(t.host==null)return!1;t=t.host}else t=t.parentNode}}function dt(s,e){return s.target&<(e.root.dom,s.target)}function ii(s,e){s.style.pointerEvents=e?"auto":"none"}function ut(){return/apple/i.test(navigator.vendor)&&"ontouchend"in document}function si(){return ut()?1:void 0}function C(s,e){return _(s)?s:s!=null&&_(s.value)&&_(e)?e*s.value:0}function ri(s){let e=(""+s).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0}function ue(s,e=0,t="0"){return typeof s!="string"&&(s=s.toString()),e>s.length?Array(e-s.length+1).join(t)+s:s}function pt(s){return s.replace(/^[\s]*/,"")}function ct(s){return s.replace(/[\s]*$/,"")}function We(s){return pt(ct(s))}function gt(s){if(s===void 0)return"string";let e=(s=(s=(s=s.toLowerCase().replace(/^\[[^\]]*\]/,"")).replace(/\[[^\]]+\]/,"")).trim()).match(/\/(date|number|duration)$/);return e?e[1]:s==="number"?"number":s==="date"?"date":s==="duration"?"duration":s.match(/[#0]/)?"number":s.match(/[ymwdhnsqaxkzgtei]/)?"date":"string"}function ni(s){return s.replace(/\/(date|number|duration)$/i,"")}function ai(s){return s&&s.replace(/<[^>]*>/g,"")}function oi(s){return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function hi(s,e=!1){const t=new Date(s.getFullYear(),0,0),i=s.getTime()-t.getTime()+60*(t.getTimezoneOffset()-s.getTimezoneOffset())*1e3;return Math.floor(i/864e5)}function je(s,e=!1){const t=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate())),i=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-i);const r=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-r.getTime())/864e5+1)/7)}function li(s,e=!1){const t=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate())),i=t.getUTCDay()||7;return t.setUTCDate(t.getUTCDate()+4-i),new Date(Date.UTC(t.getUTCFullYear(),0,1)).getFullYear()}function di(s,e=!1){const t=je(new Date(s.getFullYear(),s.getMonth(),1),e);let i=je(s,e);return i==1&&(i=53),i-t+1}function ui(s,e,t=1,i=!1){let r=new Date(e,0,4,0,0,0,0);return i&&r.setUTCFullYear(e),7*s+t-((r.getDay()||7)+3)}function pi(s,e){return s>12?s-=12:s===0&&(s=12),e!=null?s+(e-1):s}function ci(s,e=!1,t=!1,i=!1,r){if(i)return e?"Coordinated Universal Time":"UTC";if(r){const o=s.toLocaleString("en-US",{timeZone:r});return We(s.toLocaleString("en-US",{timeZone:r,timeZoneName:e?"long":"short"}).substr(o.length))}let n=s.toLocaleString("UTC"),a=s.toLocaleString("UTC",{timeZoneName:e?"long":"short"}).substr(n.length);return t===!1&&(a=a.replace(/ (standard|daylight|summer|winter) /i," ")),a}function gi(s){const e=new Date(Date.UTC(2012,0,1,0,0,0,0)),t=new Date(e.toLocaleString("en-US",{timeZone:"UTC"}));return(new Date(e.toLocaleString("en-US",{timeZone:s})).getTime()-t.getTime())/6e4*-1}function _i(s){return s.charAt(0).toUpperCase()+s.slice(1)}function Ve(s){let e,t,i,r=s.h,n=s.s,a=s.l;if(n==0)e=t=i=a;else{let o=function(d,p,u){return u<0&&(u+=1),u>1&&(u-=1),u<.16666666666666666?d+6*(p-d)*u:u<.5?p:u<.6666666666666666?d+(p-d)*(.6666666666666666-u)*6:d},h=a<.5?a*(1+n):a+n-a*n,l=2*a-h;e=o(l,h,r+1/3),t=o(l,h,r),i=o(l,h,r-1/3)}return{r:Math.round(255*e),g:Math.round(255*t),b:Math.round(255*i)}}function Ue(s){let e=s.r/255,t=s.g/255,i=s.b/255,r=Math.max(e,t,i),n=Math.min(e,t,i),a=0,o=0,h=(r+n)/2;if(r===n)a=o=0;else{let l=r-n;switch(o=h>.5?l/(2-r-n):l/(r+n),r){case e:a=(t-i)/l+(t0?255-s:s;return Math.round(t*e)}function mt(s,e){if(s){let t=te(Math.min(Math.max(s.r,s.g,s.b),230),e);return{r:Math.max(0,Math.min(255,Math.round(s.r+t))),g:Math.max(0,Math.min(255,Math.round(s.g+t))),b:Math.max(0,Math.min(255,Math.round(s.b+t))),a:s.a}}return s}function Ee(s){return(299*s.r+587*s.g+114*s.b)/1e3>=128}function ft(s,e){if(s===void 0||e==1)return s;let t=Ue(s);return t.s=e,Ve(t)}function bt(s,e={r:255,g:255,b:255},t={r:255,g:255,b:255}){let i=e,r=t;return Ee(t)&&(i=t,r=e),Ee(s)?r:i}function mi(s,e){return s||(s=[]),[...s,...e].filter((t,i,r)=>r.indexOf(t)===i)}function fi(s,e){return!!e&&s.left==e.left&&s.right==e.right&&s.top==e.top&&s.bottom==e.bottom}function Ke(s){return s[0]==="#"&&(s=s.substr(1)),s.length==3&&(s=s[0].repeat(2)+s[1].repeat(2)+s[2].repeat(2)),parseInt(s,16)}function vt(s){let e=(s=s.replace(/[ ]/g,"")).match(/^rgb\(([0-9]*),([0-9]*),([0-9]*)\)/i);if(e)e.push("1");else if(e=s.match(/^rgba\(([0-9]*),([0-9]*),([0-9]*),([.0-9]*)\)/i),!e)return 0;let t="";for(let i=1;i<=3;i++){let r=parseInt(e[i]).toString(16);r.length==1&&(r="0"+r),t+=r}return Ke(t)}function bi(s){return y.fromAny(s)}class y{constructor(e){Object.defineProperty(this,"_hex",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hex=0|e}get hex(){return this._hex}get r(){return this._hex>>>16}get g(){return this._hex>>8&255}get b(){return 255&this._hex}toCSS(e=1){return"rgba("+this.r+", "+this.g+", "+this.b+", "+e+")"}toCSSHex(){return"#"+ue(this.r.toString(16),2)+ue(this.g.toString(16),2)+ue(this.b.toString(16),2)}toHSL(e=1){return Ue({r:this.r,g:this.g,b:this.b,a:e})}static fromHSL(e,t,i){const r=Ve({h:e,s:t,l:i});return this.fromRGB(r.r,r.g,r.b)}toString(){return this.toCSSHex()}static fromHex(e){return new y(e)}static fromRGB(e,t,i){return new y((0|i)+(t<<8)+(e<<16))}static fromString(e){return new y(Ke(e))}static fromCSS(e){return new y(vt(e))}static fromAny(e){if(Be(e)){if(e[0]=="#")return y.fromString(e);if(e.substr(0,3)=="rgb")return y.fromCSS(e)}else{if(_(e))return y.fromHex(e);if(e instanceof y)return y.fromHex(e.hex)}throw new Error("Unknown color syntax: "+e)}static alternative(e,t,i){const r=bt({r:e.r,g:e.g,b:e.b},t?{r:t.r,g:t.g,b:t.b}:void 0,i?{r:i.r,g:i.g,b:i.b}:void 0);return this.fromRGB(r.r,r.g,r.b)}static interpolate(e,t,i,r="rgb"){if(r=="hsl"){const n=t.toHSL(),a=i.toHSL();return y.fromHSL(M(e,n.h,a.h),M(e,n.s,a.s),M(e,n.l,a.l))}return y.fromRGB(M(e,t.r,i.r),M(e,t.g,i.g),M(e,t.b,i.b))}static lighten(e,t){const i=_t({r:e.r,g:e.g,b:e.b},t);return y.fromRGB(i.r,i.g,i.b)}static brighten(e,t){const i=mt({r:e.r,g:e.g,b:e.b},t);return y.fromRGB(i.r,i.g,i.b)}static saturate(e,t){const i=ft({r:e.r,g:e.g,b:e.b},t);return y.fromRGB(i.r,i.g,i.b)}}function Ce(s){return Z(this,void 0,void 0,function*(){if(s!==void 0){const e=[];w(s,(t,i)=>{e.push(i.waitForStop())}),yield Promise.all(e)}})}function M(s,e,t){return e+s*(t-e)}function yt(s,e,t){return s>=1?t:e}function wt(s,e,t){return new f(M(s,e.percent,t.percent))}function Pt(s,e,t){return y.interpolate(s,e,t)}function Dt(s,e){return typeof s=="number"&&typeof e=="number"?M:s instanceof f&&e instanceof f?wt:s instanceof y&&e instanceof y?Pt:yt}const ze=Math.PI,Ge=ze/180,vi=180/ze;function yi(s,e,t){if(!_(e)||e<=0){let i=Math.round(s);return t&&i-s==.5&&i--,i}{let i=Math.pow(10,e);return Math.round(s*i)/i}}function wi(s,e){if(!_(e)||e<=0)return Math.ceil(s);{let t=Math.pow(10,e);return Math.ceil(s*t)/t}}function Me(s,e,t){return Math.min(Math.max(s,e),t)}function fe(s){return Math.sin(Ge*s)}function be(s){return Math.cos(Ge*s)}function Pi(s){return(s%=360)<0&&(s+=360),s}function Di(s,e,t,i,r){let n=Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,h=-Number.MAX_VALUE,l=[];l.push(pe(r,t)),l.push(pe(r,i));let d=Math.min(90*Math.floor(t/90),90*Math.floor(i/90)),p=Math.max(90*Math.ceil(t/90),90*Math.ceil(i/90));for(let u=d;u<=p;u+=90)u>=t&&u<=i&&l.push(pe(r,u));for(let u=0;uo&&(o=c.x),c.y>h&&(h=c.y)}return{left:s+n,top:e+a,right:s+o,bottom:e+h}}function pe(s,e){return{x:s*be(e),y:s*fe(e)}}function xi(s){const e=s.length;if(e>0){let t=s[0],i=t.left,r=t.top,n=t.right,a=t.bottom;if(e>1)for(let o=1;o{this._userSettings[i]=!0})}get(e,t){const i=this._settings[e];return i!==void 0?i:t}setRaw(e,t){this._settings[e]=t}set(e,t){this._userSettings[e]=!0,this.setRaw(e,t)}remove(e){delete this._userSettings[e],delete this._settings[e]}setAll(e){T(e).forEach(t=>{this.set(t,e[t])})}_eachSetting(e){w(this._settings,e)}apply(){const e={stateAnimationEasing:!0,stateAnimationDuration:!0},t=this._entity.states.lookup("default");this._eachSetting((i,r)=>{e[i]||(e[i]=!0,this!==t&&(i in t._settings||(t._settings[i]=this._entity.get(i))),this._entity.set(i,r))})}applyAnimate(e){e==null&&(e=this._settings.stateAnimationDuration),e==null&&(e=this.get("stateAnimationDuration",this._entity.get("stateAnimationDuration",0)));let t=this._settings.stateAnimationEasing;t==null&&(t=this.get("stateAnimationEasing",this._entity.get("stateAnimationEasing",xt)));const i=this._entity.states.lookup("default"),r={stateAnimationEasing:!0,stateAnimationDuration:!0},n={};return this._eachSetting((a,o)=>{if(!r[a]){r[a]=!0,this!=i&&(a in i._settings||(i._settings[a]=this._entity.get(a)));const h=this._entity.animate({key:a,to:o,duration:e,easing:t});h&&(n[a]=h)}}),n}}class Ot{constructor(e){Object.defineProperty(this,"_states",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_entity",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._entity=e}lookup(e){return this._states[e]}create(e,t){const i=this._states[e];if(i)return i.setAll(t),i;{const r=new kt(this._entity,t);return this._states[e]=r,r}}remove(e){delete this._states[e]}apply(e){const t=this._states[e];t&&t.apply(),this._entity._applyState(e)}applyAnimate(e,t){let i;const r=this._states[e];return r&&(i=r.applyAnimate(t)),this._entity._applyStateAnimated(e,t),i}}class Tt{constructor(){Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.4.8"}),Object.defineProperty(this,"licenses",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"entitiesById",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"rootElements",{enumerable:!0,configurable:!0,writable:!0,value:[]})}}const L=new Tt;function Oi(s){L.licenses.push(s)}function N(s,e){return s===e?0:s{O(i,t)&&this._entity._markDirtyKey(e)})}remove(e){const t=this._callbacks[e];t!==void 0&&(delete this._callbacks[e],t.length!==0&&this._entity._markDirtyKey(e))}enable(e){this._disabled[e]&&(delete this._disabled[e],this._entity._markDirtyKey(e))}disable(e){this._disabled[e]||(this._disabled[e]=!0,this._entity._markDirtyKey(e))}fold(e,t){if(!this._disabled[e]){const i=this._callbacks[e];if(i!==void 0)for(let r=0,n=i.length;r{if(this._stopped)e();else{const i=()=>{r.dispose(),e()},r=this.events.on("stopped",i)}})}_checkEnded(){return!(this._loops>1)||(--this._loops,!1)}_run(e){this._oldTime!==null&&(this._time+=e-this._oldTime,this._time>this._duration&&(this._time=this._duration)),this._oldTime=e}_reset(e){this._oldTime=e,this._time=0}_value(e){return this._interpolate(this._easing(e),this._from,this._to)}}let jt=0;class Et{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:++jt}),Object.defineProperty(this,"_settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_privateSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_settingEvents",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_privateSettingEvents",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_prevSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_prevPrivateSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_animatingSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_animatingPrivateSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_playingAnimations",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_userProperties",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this._settings=e}_checkDirty(){T(this._settings).forEach(e=>{this._userProperties[e]=!0,this._markDirtyKey(e)})}resetUserSettings(){this._userProperties={}}_runAnimation(e){return!this.isDisposed()&&(w(this._animatingSettings,(t,i)=>{if(i._stopped)this._stopAnimation(t);else if(i._playing){i._run(e);const r=i.percentage;r>=1?i._checkEnded()?this.set(t,i._value(1)):(i._reset(e),this._set(t,i._value(1))):this._set(t,i._value(r))}}),w(this._animatingPrivateSettings,(t,i)=>{if(i._stopped)this._stopAnimationPrivate(t);else if(i._playing){i._run(e);const r=i.percentage;r>=1?i._checkEnded()?this.setPrivate(t,i._value(1)):(i._reset(e),this._setPrivate(t,i._value(1))):this._setPrivate(t,i._value(r))}}),this._playingAnimations!==0)}_markDirtyKey(e){this.markDirty()}_markDirtyPrivateKey(e){this.markDirty()}on(e,t){let i=this._settingEvents[e];return i===void 0&&(i=this._settingEvents[e]=[]),i.push(t),new P(()=>{O(i,t),i.length===0&&delete this._settingEvents[e]})}onPrivate(e,t){let i=this._privateSettingEvents[e];return i===void 0&&(i=this._privateSettingEvents[e]=[]),i.push(t),new P(()=>{O(i,t),i.length===0&&delete this._privateSettingEvents[e]})}getRaw(e,t){const i=this._settings[e];return i!==void 0?i:t}get(e,t){return this.getRaw(e,t)}_sendKeyEvent(e,t){const i=this._settingEvents[e];i!==void 0&&g(i,r=>{r(t,this,e)})}_sendPrivateKeyEvent(e,t){const i=this._privateSettingEvents[e];i!==void 0&&g(i,r=>{r(t,this,e)})}_setRaw(e,t,i){this._prevSettings[e]=t,this._sendKeyEvent(e,i)}setRaw(e,t){const i=this._settings[e];this._settings[e]=t,i!==t&&this._setRaw(e,i,t)}_set(e,t){const i=this._settings[e];this._settings[e]=t,i!==t&&(this._setRaw(e,i,t),this._markDirtyKey(e))}_stopAnimation(e){const t=this._animatingSettings[e];t&&(--this._playingAnimations,delete this._animatingSettings[e],t.stop())}set(e,t){return this._set(e,t),this._stopAnimation(e),t}remove(e){e in this._settings&&(this._prevSettings[e]=this._settings[e],delete this._settings[e],this._sendKeyEvent(e,void 0),this._markDirtyKey(e)),this._stopAnimation(e)}removeAll(){g(T(this._settings),e=>{this.remove(e)})}getPrivate(e,t){const i=this._privateSettings[e];return i!==void 0?i:t}_setPrivateRaw(e,t,i){this._prevPrivateSettings[e]=t,this._sendPrivateKeyEvent(e,i)}setPrivateRaw(e,t){const i=this._privateSettings[e];this._privateSettings[e]=t,i!==t&&this._setPrivateRaw(e,i,t)}_setPrivate(e,t){const i=this._privateSettings[e];this._privateSettings[e]=t,i!==t&&(this._setPrivateRaw(e,i,t),this._markDirtyPrivateKey(e))}_stopAnimationPrivate(e){const t=this._animatingPrivateSettings[e];t&&(--this._playingAnimations,t.stop(),delete this._animatingPrivateSettings[e])}setPrivate(e,t){return this._setPrivate(e,t),this._stopAnimationPrivate(e),t}removePrivate(e){e in this._privateSettings&&(this._prevPrivateSettings[e]=this._privateSettings[e],delete this._privateSettings[e],this._markDirtyPrivateKey(e)),this._stopAnimationPrivate(e)}setAll(e){w(e,(t,i)=>{this.set(t,i)})}animate(e){const t=e.key,i=e.to,r=e.duration||0,n=e.loops||1,a=e.from===void 0?this.get(t):e.from,o=e.easing===void 0?Ae:e.easing;if(r===0)this.set(t,i);else{if(a!==void 0&&a!==i){this.set(t,a);const l=this._animatingSettings[t]=new Q(this,a,i,r,o,n,this._animationTime());return++this._playingAnimations,this._startAnimation(),l}this.set(t,i)}const h=new Q(this,a,i,r,o,n,null);return h.stop(),h}animatePrivate(e){const t=e.key,i=e.to,r=e.duration||0,n=e.loops||1,a=e.from===void 0?this.getPrivate(t):e.from,o=e.easing===void 0?Ae:e.easing;if(r===0)this.setPrivate(t,i);else{if(a!==void 0&&a!==i){this.setPrivate(t,a);const l=this._animatingPrivateSettings[t]=new Q(this,a,i,r,o,n,this._animationTime());return++this._playingAnimations,this._startAnimation(),l}this.setPrivate(t,i)}const h=new Q(this,a,i,r,o,n,null);return h.stop(),h}_dispose(){}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this._dispose())}}class A extends Et{constructor(e,t,i,r=[]){if(super(t),Object.defineProperty(this,"_root",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_user_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"states",{enumerable:!0,configurable:!0,writable:!0,value:new Ot(this)}),Object.defineProperty(this,"adapters",{enumerable:!0,configurable:!0,writable:!0,value:new St(this)}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:this._createEvents()}),Object.defineProperty(this,"_userPrivateProperties",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dirty",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dirtyPrivate",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_templates",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_internalTemplates",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultThemes",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_templateDisposers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_disposers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_runSetup",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_disposerProperties",{enumerable:!0,configurable:!0,writable:!0,value:{}}),!i)throw new Error("You cannot use `new Class()`, instead use `Class.new()`");this._root=e,this._internalTemplates=r,t.id&&this._registerId(t.id)}static new(e,t,i){const r=new this(e,t,!0);return r._template=i,r._afterNew(),r}static _new(e,t,i=[]){const r=new this(e,t,!0,i);return r._afterNew(),r}_afterNew(){this._checkDirty();let e=!1;const t=this._template;t&&(e=!0,t._setObjectTemplate(this)),g(this._internalTemplates,i=>{e=!0,i._setObjectTemplate(this)}),e&&this._applyTemplates(!1),this.states.create("default",{}),this._setDefaults()}_afterNewApplyThemes(){this._checkDirty();const e=this._template;e&&e._setObjectTemplate(this),g(this._internalTemplates,t=>{t._setObjectTemplate(this)}),this.states.create("default",{}),this._setDefaults(),this._applyThemes()}_createEvents(){return new $}get classNames(){return this.constructor.classNames}get className(){return this.constructor.className}_setDefaults(){}_setDefault(e,t){e in this._settings||super.set(e,t)}_setRawDefault(e,t){e in this._settings||super.setRaw(e,t)}_clearDirty(){T(this._dirty).forEach(e=>{this._dirty[e]=!1}),T(this._dirtyPrivate).forEach(e=>{this._dirtyPrivate[e]=!1})}isDirty(e){return!!this._dirty[e]}isPrivateDirty(e){return!!this._dirtyPrivate[e]}_markDirtyKey(e){this._dirty[e]=!0,super._markDirtyKey(e)}_markDirtyPrivateKey(e){this._dirtyPrivate[e]=!0,super._markDirtyKey(e)}isType(e){return this.classNames.indexOf(e)!==-1}_pushPropertyDisposer(e,t){let i=this._disposerProperties[e];return i===void 0&&(i=this._disposerProperties[e]=[]),i.push(t),t}_disposeProperty(e){const t=this._disposerProperties[e];t!==void 0&&(g(t,i=>{i.dispose()}),delete this._disposerProperties[e])}set template(e){const t=this._template;t!==e&&(this._template=e,t&&t._removeObjectTemplate(this),e&&e._setObjectTemplate(this),this._applyTemplates())}get template(){return this._template}markDirty(){this._root._addDirtyEntity(this)}_startAnimation(){this._root._addAnimation(this)}_animationTime(){return this._root.animationTime}_applyState(e){}_applyStateAnimated(e,t){}get(e,t){const i=this.adapters.fold(e,this._settings[e]);return i!==void 0?i:t}isUserSetting(e){return this._userProperties[e]||!1}set(e,t){return this._userProperties[e]=!0,super.set(e,t)}setRaw(e,t){this._userProperties[e]=!0,super.setRaw(e,t)}_setSoft(e,t){return this._userProperties[e]?t:super.set(e,t)}remove(e){delete this._userProperties[e],this._removeTemplateProperty(e)}setPrivate(e,t){return this._userPrivateProperties[e]=!0,super.setPrivate(e,t)}setPrivateRaw(e,t){this._userPrivateProperties[e]=!0,super.setPrivateRaw(e,t)}removePrivate(e){delete this._userPrivateProperties[e],this._removeTemplatePrivateProperty(e)}_setTemplateProperty(e,t,i){this._userProperties[t]||e===this._findTemplateByKey(t)&&super.set(t,i)}_setTemplatePrivateProperty(e,t,i){this._userPrivateProperties[t]||e===this._findTemplateByPrivateKey(t)&&super.setPrivate(t,i)}_removeTemplateProperty(e){if(!this._userProperties[e]){const t=this._findTemplateByKey(e);t?super.set(e,t._settings[e]):super.remove(e)}}_removeTemplatePrivateProperty(e){if(!this._userPrivateProperties[e]){const t=this._findTemplateByPrivateKey(e);t?super.setPrivate(e,t._privateSettings[e]):super.removePrivate(e)}}_walkParents(e){e(this._root._rootContainer),e(this)}_applyStateByKey(e){const t=this.states.create(e,{}),i={};this._eachTemplate(r=>{const n=r.states.lookup(e);n&&n._apply(t,i)}),w(t._settings,r=>{i[r]||t._userSettings[r]||t.remove(r)})}_applyTemplate(e,t){this._templateDisposers.push(e._apply(this,t)),w(e._settings,(i,r)=>{t.settings[i]||this._userProperties[i]||(t.settings[i]=!0,super.set(i,r))}),w(e._privateSettings,(i,r)=>{t.privateSettings[i]||this._userPrivateProperties[i]||(t.privateSettings[i]=!0,super.setPrivate(i,r))}),this._runSetup&&e.setup&&(this._runSetup=!1,e.setup(this))}_findStaticTemplate(e){if(this._template&&e(this._template))return this._template}_eachTemplate(e){this._findStaticTemplate(t=>(e(t),!1)),F(this._internalTemplates,e),g(this._templates,e)}_applyTemplates(e=!0){e&&this._disposeTemplates();const t={settings:{},privateSettings:{},states:{}};this._eachTemplate(i=>{this._applyTemplate(i,t)}),e&&(w(this._settings,i=>{this._userProperties[i]||t.settings[i]||super.remove(i)}),w(this._privateSettings,i=>{this._userPrivateProperties[i]||t.privateSettings[i]||super.removePrivate(i)}))}_findTemplate(e){const t=this._findStaticTemplate(e);if(t===void 0){const i=Ze(this._internalTemplates,e);return i===void 0?Qe(this._templates,e):i}return t}_findTemplateByKey(e){return this._findTemplate(t=>e in t._settings)}_findTemplateByPrivateKey(e){return this._findTemplate(t=>e in t._privateSettings)}_disposeTemplates(){g(this._templateDisposers,e=>{e.dispose()}),this._templateDisposers.length=0}_removeTemplates(){g(this._templates,e=>{e._removeObjectTemplate(this)}),this._templates.length=0}_applyThemes(){let e=!1;const t=[];let i=[];const r=new Set,n=this.get("themeTagsSelf");return n&&g(n,a=>{r.add(a)}),this._walkParents(a=>{a===this._root._rootContainer&&(e=!0),a._defaultThemes.length>0&&t.push(a._defaultThemes);const o=a.get("themes");o&&i.push(o);const h=a.get("themeTags");h&&g(h,l=>{r.add(l)})}),i=t.concat(i),this._removeTemplates(),e&&F(this.classNames,a=>{const o=[];g(i,h=>{g(h,l=>{const d=l._lookupRules(a);d&&F(d,p=>{if(p.tags.every(u=>r.has(u))){const u=tt(o,c=>{const m=N(p.tags.length,c.tags.length);return m===0?Ye(p.tags,c.tags,N):m});o.splice(u.index,0,p)}})})}),g(o,h=>{this._templates.push(h.template),h.template._setObjectTemplate(this)})}),this._applyTemplates(),e&&(this._runSetup=!1),e}_changed(){}_beforeChanged(){if(this.isDirty("id")){const e=this.get("id");e&&this._registerId(e);const t=this._prevSettings.id;t&&delete L.entitiesById[t]}}_registerId(e){if(L.entitiesById[e]&&L.entitiesById[e]!==this)throw new Error('An entity with id "'+e+'" already exists.');L.entitiesById[e]=this}_afterChanged(){}addDisposer(e){return this._disposers.push(e),e}_dispose(){super._dispose();const e=this._template;e&&e._removeObjectTemplate(this),g(this._internalTemplates,i=>{i._removeObjectTemplate(this)}),this._removeTemplates(),this._disposeTemplates(),this.events.dispose(),this._disposers.forEach(i=>{i.dispose()}),w(this._disposerProperties,(i,r)=>{g(r,n=>{n.dispose()})});const t=this.get("id");t&&delete L.entitiesById[t]}setTimeout(e,t){const i=setTimeout(()=>{this.removeDispose(r),e()},t),r=new P(()=>{clearTimeout(i)});return this._disposers.push(r),r}removeDispose(e){if(!this.isDisposed()){let t=se(this._disposers,e);t>-1&&this._disposers.splice(t,1)}e.dispose()}hasTag(e){return se(this.get("themeTags",[]),e)!==-1}addTag(e){if(!this.hasTag(e)){const t=this.get("themeTags",[]);t.push(e),this.set("themeTags",t)}}removeTag(e){if(this.hasTag(e)){const t=this.get("themeTags",[]);He(t,e),this.set("themeTags",t)}}_t(e,t,...i){return this._root.language.translate(e,t,...i)}get root(){return this._root}}Object.defineProperty(A,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Entity"}),Object.defineProperty(A,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:["Entity"]});class Ct{constructor(e,t,i){Object.defineProperty(this,"_settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._name=e,this._template=t,this._settings=i}get(e,t){const i=this._settings[e];return i!==void 0?i:t}set(e,t){this._settings[e]=t,this._template._stateChanged(this._name)}remove(e){delete this._settings[e],this._template._stateChanged(this._name)}setAll(e){T(e).forEach(t=>{this._settings[t]=e[t]}),this._template._stateChanged(this._name)}_apply(e,t){w(this._settings,(i,r)=>{t[i]||e._userSettings[i]||(t[i]=!0,e.setRaw(i,r))})}}class Mt{constructor(e){Object.defineProperty(this,"_template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_states",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this._template=e}lookup(e){return this._states[e]}create(e,t){const i=this._states[e];if(i)return i.setAll(t),i;{const r=new Ct(e,this._template,t);return this._states[e]=r,this._template._stateChanged(e),r}}remove(e){delete this._states[e],this._template._stateChanged(e)}_apply(e,t){w(this._states,(i,r)=>{let n=t.states[i];n==null&&(n=t.states[i]={});const a=e.states.create(i,{});r._apply(a,n)})}}class At{constructor(){Object.defineProperty(this,"_callbacks",{enumerable:!0,configurable:!0,writable:!0,value:{}})}add(e,t){let i=this._callbacks[e];return i===void 0&&(i=this._callbacks[e]=[]),i.push(t),new P(()=>{O(i,t),i.length===0&&delete this._callbacks[e]})}remove(e){this._callbacks[e]!==void 0&&delete this._callbacks[e]}_apply(e){const t=[];return w(this._callbacks,(i,r)=>{g(r,n=>{t.push(e.adapters.add(i,n))})}),new k(t)}}class X{constructor(e,t){if(Object.defineProperty(this,"_settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_privateSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_settingEvents",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_privateSettingEvents",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_entities",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"states",{enumerable:!0,configurable:!0,writable:!0,value:new Mt(this)}),Object.defineProperty(this,"adapters",{enumerable:!0,configurable:!0,writable:!0,value:new At}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new $}),Object.defineProperty(this,"setup",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!t)throw new Error("You cannot use `new Class()`, instead use `Class.new()`");this._settings=e}static new(e){return new X(e,!0)}get entities(){return this._entities}get(e,t){const i=this._settings[e];return i!==void 0?i:t}setRaw(e,t){this._settings[e]=t}set(e,t){this._settings[e]!==t&&(this.setRaw(e,t),this._entities.forEach(i=>{i._setTemplateProperty(this,e,t)}))}remove(e){e in this._settings&&(delete this._settings[e],this._entities.forEach(t=>{t._removeTemplateProperty(e)}))}removeAll(){w(this._settings,(e,t)=>{this.remove(e)})}getPrivate(e,t){const i=this._privateSettings[e];return i!==void 0?i:t}setPrivateRaw(e,t){return this._privateSettings[e]=t,t}setPrivate(e,t){return this._privateSettings[e]!==t&&(this.setPrivateRaw(e,t),this._entities.forEach(i=>{i._setTemplatePrivateProperty(this,e,t)})),t}removePrivate(e){e in this._privateSettings&&(delete this._privateSettings[e],this._entities.forEach(t=>{t._removeTemplatePrivateProperty(e)}))}setAll(e){w(e,(t,i)=>{this.set(t,i)})}on(e,t){let i=this._settingEvents[e];return i===void 0&&(i=this._settingEvents[e]=[]),i.push(t),new P(()=>{O(i,t),i.length===0&&delete this._settingEvents[e]})}onPrivate(e,t){let i=this._privateSettingEvents[e];return i===void 0&&(i=this._privateSettingEvents[e]=[]),i.push(t),new P(()=>{O(i,t),i.length===0&&delete this._privateSettingEvents[e]})}_apply(e,t){const i=[];return w(this._settingEvents,(r,n)=>{g(n,a=>{i.push(e.on(r,a))})}),w(this._privateSettingEvents,(r,n)=>{g(n,a=>{i.push(e.onPrivate(r,a))})}),this.states._apply(e,t),i.push(this.adapters._apply(e)),i.push(e.events.copyFrom(this.events)),new k(i)}_setObjectTemplate(e){this._entities.push(e)}_removeObjectTemplate(e){He(this._entities,e)}_stateChanged(e){this._entities.forEach(t=>{t._applyStateByKey(e)})}}class re extends ${constructor(e){super(),Object.defineProperty(this,"_sprite",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rendererDisposers",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dispatchParents",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this._sprite=e}_makePointerEvent(e,t){return{type:e,originalEvent:t.event,point:t.point,simulated:t.simulated,native:t.native,target:this._sprite}}_onRenderer(e,t){this._sprite.set("interactive",!0),this._sprite._display.interactive=!0;let i=this._rendererDisposers[e];if(i===void 0){const r=this._sprite._display.on(e,n=>{t.call(this,n)});i=this._rendererDisposers[e]=new it(()=>{delete this._rendererDisposers[e],r.dispose()})}return i.increment()}_on(e,t,i,r,n,a){const o=super._on(e,t,i,r,n,a),h=re.RENDERER_EVENTS[t];return h!==void 0&&(o.disposer=new k([o.disposer,this._onRenderer(t,h)])),o}stopParentDispatch(){this._dispatchParents=!1}dispatchParents(e,t){const i=this._dispatchParents;this._dispatchParents=!0;try{this.dispatch(e,t),this._dispatchParents&&this._sprite.parent&&this._sprite.parent.events.dispatchParents(e,t)}finally{this._dispatchParents=i}}}Object.defineProperty(re,"RENDERER_EVENTS",{enumerable:!0,configurable:!0,writable:!0,value:{click:function(s){this.isEnabled("click")&&!this._sprite.isDragging()&&this._sprite._hasDown()&&!this._sprite._hasMoved(this._makePointerEvent("click",s))&&this.dispatch("click",this._makePointerEvent("click",s))},rightclick:function(s){this.isEnabled("rightclick")&&this.dispatch("rightclick",this._makePointerEvent("rightclick",s))},middleclick:function(s){this.isEnabled("middleclick")&&this.dispatch("middleclick",this._makePointerEvent("middleclick",s))},dblclick:function(s){this.dispatchParents("dblclick",this._makePointerEvent("dblclick",s))},pointerover:function(s){this.isEnabled("pointerover")&&this.dispatch("pointerover",this._makePointerEvent("pointerover",s))},pointerout:function(s){this.isEnabled("pointerout")&&this.dispatch("pointerout",this._makePointerEvent("pointerout",s))},pointerdown:function(s){this.dispatchParents("pointerdown",this._makePointerEvent("pointerdown",s))},pointerup:function(s){this.isEnabled("pointerup")&&this.dispatch("pointerup",this._makePointerEvent("pointerup",s))},globalpointerup:function(s){this.isEnabled("globalpointerup")&&this.dispatch("globalpointerup",this._makePointerEvent("globalpointerup",s))},globalpointermove:function(s){this.isEnabled("globalpointermove")&&this.dispatch("globalpointermove",this._makePointerEvent("globalpointermove",s))},wheel:function(s){this.dispatchParents("wheel",{type:"wheel",target:this._sprite,originalEvent:s.event,point:s.point})}}});class D extends A{constructor(){super(...arguments),Object.defineProperty(this,"_adjustedLocalBounds",{enumerable:!0,configurable:!0,writable:!0,value:{left:0,right:0,top:0,bottom:0}}),Object.defineProperty(this,"_localBounds",{enumerable:!0,configurable:!0,writable:!0,value:{left:0,right:0,top:0,bottom:0}}),Object.defineProperty(this,"_parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dataItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_templateField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_sizeDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dragEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dragPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isHidden",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isShowing",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isHiding",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_downPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_downPoints",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_toggleDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dragDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_hoverDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_focusDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipMoveDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipPointerDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_statesHandled",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_afterNew(){this.setPrivateRaw("visible",!0),super._afterNew()}_markDirtyKey(e){super._markDirtyKey(e),e!="x"&&e!="y"&&e!="dx"&&e!="dy"||(this.markDirtyBounds(),this._addPercentagePositionChildren(),this.markDirtyPosition())}_markDirtyPrivateKey(e){super._markDirtyPrivateKey(e),e!="x"&&e!="y"||this.markDirtyPosition()}_removeTemplateField(){this._templateField&&this._templateField._removeObjectTemplate(this)}_createEvents(){return new re(this)}_processTemplateField(){let e;const t=this.get("templateField");if(t){const i=this.dataItem;if(i){const r=i.dataContext;r&&(e=r[t],e instanceof X||!e||(e=X.new(e)))}}this._templateField!==e&&(this._removeTemplateField(),this._templateField=e,e&&e._setObjectTemplate(this),this._applyTemplates())}_setDataItem(e){const t=this._dataItem;this._dataItem=e,this._processTemplateField();const i="dataitemchanged";e!=t&&this.events.isEnabled(i)&&this.events.dispatch(i,{type:i,target:this,oldDataItem:t,newDataItem:e})}set dataItem(e){this._setDataItem(e)}get dataItem(){if(this._dataItem)return this._dataItem;{let e=this._parent;for(;e;){if(e._dataItem)return e._dataItem;e=e._parent}}}_addPercentageSizeChildren(){let e=this.parent;e&&(this.get("width")instanceof f||this.get("height")instanceof f?Te(e._percentageSizeChildren,this):O(e._percentageSizeChildren,this))}_addPercentagePositionChildren(){let e=this.parent;e&&(this.get("x")instanceof f||this.get("y")instanceof f?Te(e._percentagePositionChildren,this):O(e._percentagePositionChildren,this))}markDirtyPosition(){this._root._addDirtyPosition(this)}updatePivotPoint(){const e=this._localBounds;if(e){const t=this.get("centerX");t!=null&&(this._display.pivot.x=e.left+C(t,e.right-e.left));const i=this.get("centerY");i!=null&&(this._display.pivot.y=e.top+C(i,e.bottom-e.top))}}_beforeChanged(){if(super._beforeChanged(),this._handleStates(),this.isDirty("tooltip")){const e=this._prevSettings.tooltip;e&&e.dispose()}if((this.isDirty("layer")||this.isDirty("layerMargin"))&&(this._display.setLayer(this.get("layer"),this.get("layerMargin")),this.markDirtyLayer()),this.isDirty("tooltipPosition")){const e=this._tooltipMoveDp;e&&(e.dispose(),this._tooltipMoveDp=void 0);const t=this._tooltipPointerDp;t&&(t.dispose(),this._tooltipPointerDp=void 0),this.get("tooltipPosition")=="pointer"&&(this.isHover()&&(this._tooltipMoveDp=this.events.on("globalpointermove",i=>{this.showTooltip(i.point)})),this._tooltipPointerDp=new k([this.events.on("pointerover",()=>{this._tooltipMoveDp=this.events.on("globalpointermove",i=>{this.showTooltip(i.point)})}),this.events.on("pointerout",()=>{const i=this._tooltipMoveDp;i&&(i.dispose(),this._tooltipMoveDp=void 0)})]))}}_handleStates(){this._statesHandled||(this.isDirty("active")&&(this.get("active")?(this.states.applyAnimate("active"),this.set("ariaChecked",!0)):(this.isHidden()||this.states.applyAnimate("default"),this.set("ariaChecked",!1)),this.markDirtyAccessibility()),this.isDirty("disabled")&&(this.get("disabled")?(this.states.applyAnimate("disabled"),this.set("ariaChecked",!1)):(this.isHidden()||this.states.applyAnimate("default"),this.set("ariaChecked",!0)),this.markDirtyAccessibility()),this._statesHandled=!0)}_changed(){super._changed();const e=this._display,t=this.events;if(this.isDirty("draggable")){const i=this.get("draggable");i?(this.set("interactive",!0),this._dragDp=new k([t.on("pointerdown",r=>{this.dragStart(r)}),t.on("globalpointermove",r=>{this.dragMove(r)}),t.on("globalpointerup",r=>{this.dragStop(r)})])):this._dragDp&&(this._dragDp.dispose(),this._dragDp=void 0),e.cancelTouch=!!i}if(this.isDirty("tooltipText")||this.isDirty("tooltipHTML")||this.isDirty("showTooltipOn")){const i=this.get("tooltipText"),r=this.get("tooltipHTML"),n=this.get("showTooltipOn","hover");this._tooltipDp&&(this._tooltipDp.dispose(),this._tooltipDp=void 0),(i||r)&&(n=="click"?(this._tooltipDp=new k([t.on("click",()=>{this.setTimeout(()=>this.showTooltip(),10)}),Fe(document,"click",a=>{this.hideTooltip()})]),this._disposers.push(this._tooltipDp)):n=="always"||(this._tooltipDp=new k([t.on("pointerover",()=>{this.showTooltip()}),t.on("pointerout",()=>{this.hideTooltip()})]),this._disposers.push(this._tooltipDp)))}if(this.isDirty("toggleKey")){let i=this.get("toggleKey");i&&i!="none"?this._toggleDp=t.on("click",()=>{this._isDragging||this.set(i,!this.get(i))}):this._toggleDp&&(this._toggleDp.dispose(),this._toggleDp=void 0)}if(this.isDirty("opacity")&&(e.alpha=Math.max(0,this.get("opacity",1))),this.isDirty("rotation")&&(this.markDirtyBounds(),e.angle=this.get("rotation",0)),this.isDirty("scale")&&(this.markDirtyBounds(),e.scale=this.get("scale",0)),(this.isDirty("centerX")||this.isDirty("centerY"))&&(this.markDirtyBounds(),this.updatePivotPoint()),(this.isDirty("visible")||this.isPrivateDirty("visible")||this.isDirty("forceHidden"))&&(this.get("visible")&&this.getPrivate("visible")&&!this.get("forceHidden")?e.visible=!0:(e.visible=!1,this.hideTooltip()),this.markDirtyBounds(),this.get("focusable")&&this.markDirtyAccessibility()),this.isDirty("width")||this.isDirty("height")){this.markDirtyBounds(),this._addPercentageSizeChildren();const i=this.parent;i&&(this.isDirty("width")&&this.get("width")instanceof f||this.isDirty("height")&&this.get("height")instanceof f)&&(i.markDirty(),i._prevWidth=0),this._sizeDirty=!0}if((this.isDirty("maxWidth")||this.isDirty("maxHeight")||this.isPrivateDirty("width")||this.isPrivateDirty("height")||this.isDirty("minWidth")||this.isDirty("minHeight")||this.isPrivateDirty("maxWidth")||this.isPrivateDirty("maxHeight")||this.isPrivateDirty("minWidth")||this.isPrivateDirty("minHeight"))&&(this.markDirtyBounds(),this._sizeDirty=!0),this._sizeDirty&&this._updateSize(),this.isDirty("wheelable")){const i=this.get("wheelable");i&&this.set("interactive",!0),e.wheelable=!!i}if((this.isDirty("tabindexOrder")||this.isDirty("focusableGroup"))&&(this.get("focusable")?this._root._registerTabindexOrder(this):this._root._unregisterTabindexOrder(this)),this.isDirty("filter")&&(e.filter=this.get("filter")),this.isDirty("cursorOverStyle")&&(e.cursorOverStyle=this.get("cursorOverStyle")),this.isDirty("hoverOnFocus")&&(this.get("hoverOnFocus")?this._focusDp=new k([t.on("focus",()=>{this.showTooltip()}),t.on("blur",()=>{this.hideTooltip()})]):this._focusDp&&(this._focusDp.dispose(),this._focusDp=void 0)),this.isDirty("focusable")&&(this.get("focusable")?this._root._registerTabindexOrder(this):this._root._unregisterTabindexOrder(this),this.markDirtyAccessibility()),this.isPrivateDirty("focusable")&&this.markDirtyAccessibility(),(this.isDirty("role")||this.isDirty("ariaLive")||this.isDirty("ariaChecked")||this.isDirty("ariaHidden")||this.isDirty("ariaOrientation")||this.isDirty("ariaValueNow")||this.isDirty("ariaValueMin")||this.isDirty("ariaValueMax")||this.isDirty("ariaValueText")||this.isDirty("ariaLabel")||this.isDirty("ariaControls"))&&this.markDirtyAccessibility(),this.isDirty("exportable")&&(e.exportable=this.get("exportable")),this.isDirty("interactive")){const i=this.events;this.get("interactive")?this._hoverDp=new k([i.on("click",r=>{Se(r.originalEvent)&&(this.getPrivate("touchHovering")||this.setTimeout(()=>{this._handleOver(),(this.get("tooltipText")||this.get("tooltipHTML"))&&this.showTooltip(),this.setPrivateRaw("touchHovering",!0),this.events.dispatch("pointerover",{type:"pointerover",target:r.target,originalEvent:r.originalEvent,point:r.point,simulated:r.simulated})},10))}),i.on("globalpointerup",r=>{Se(r.originalEvent)&&this.getPrivate("touchHovering")&&(this._handleOut(),(this.get("tooltipText")||this.get("tooltipHTML"))&&this.hideTooltip(),this.setPrivateRaw("touchHovering",!1),this.events.dispatch("pointerout",{type:"pointerout",target:r.target,originalEvent:r.originalEvent,point:r.point,simulated:r.simulated})),this._isDown&&this._handleUp(r)}),i.on("pointerover",()=>{this._handleOver()}),i.on("pointerout",()=>{this._handleOut()}),i.on("pointerdown",r=>{this._handleDown(r)})]):(this._display.interactive=!1,this._hoverDp&&(this._hoverDp.dispose(),this._hoverDp=void 0))}this.isDirty("forceInactive")&&(this._display.inactive=this.get("forceInactive",!1)),this.get("showTooltipOn")=="always"&&this._display.visible&&this.showTooltip()}dragStart(e){this._dragEvent=e,this.events.stopParentDispatch()}dragStop(e){if(this._dragEvent=void 0,this._dragPoint=void 0,this.events.stopParentDispatch(),this._isDragging){this._isDragging=!1;const t="dragstop";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this,originalEvent:e.originalEvent,point:e.point,simulated:e.simulated})}}_handleOver(){this.isHidden()||(this.get("active")&&this.states.lookup("hoverActive")?this.states.applyAnimate("hoverActive"):this.get("disabled")&&this.states.lookup("hoverDisabled")?this.states.applyAnimate("hoverDisabled"):this.states.applyAnimate("hover"),this.get("draggable")&&this._isDown&&this.states.lookup("down")&&this.states.applyAnimate("down"))}_handleOut(){this.isHidden()||(this.get("active")&&this.states.lookup("active")?this.states.applyAnimate("active"):this.get("disabled")&&this.states.lookup("disabled")?this.states.applyAnimate("disabled"):(this.states.lookup("hover")||this.states.lookup("hoverActive"))&&this.states.applyAnimate("default"),this.get("draggable")&&this._isDown&&this.states.lookup("down")&&this.states.applyAnimate("down"))}_handleUp(e){if(!this.isHidden()){this.get("active")&&this.states.lookup("active")?this.states.applyAnimate("active"):this.get("disabled")&&this.states.lookup("disabled")?this.states.applyAnimate("disabled"):this.states.lookup("down")&&(this.isHover()?this.states.applyAnimate("hover"):this.states.applyAnimate("default")),this._downPoint=void 0;const t=de(e.originalEvent);delete this._downPoints[t],T(this._downPoints).length==0&&(this._isDown=!1)}}_hasMoved(e){const t=de(e.originalEvent),i=this._downPoints[t];if(i){const r=Math.abs(i.x-e.point.x),n=Math.abs(i.y-e.point.y);return r>5||n>5}return!1}_hasDown(){return T(this._downPoints).length>0}_handleDown(e){const t=this.parent;if(t&&!this.get("draggable")&&t._handleDown(e),this.get("interactive")&&!this.isHidden()){this.states.lookup("down")&&this.states.applyAnimate("down"),this._downPoint={x:e.point.x,y:e.point.y},this._isDown=!0;const i=de(e.originalEvent);this._downPoints[i]={x:e.point.x,y:e.point.y}}}dragMove(e){let t=this._dragEvent;if(t){if(t.simulated&&!e.simulated)return!0;let i=0,r=this.parent;for(;r!=null;)i+=r.get("rotation",0),r=r.parent;let n=e.point.x-t.point.x,a=e.point.y-t.point.y;const o=this.events;if(t.simulated&&!this._isDragging){this._isDragging=!0,this._dragEvent=e,this._dragPoint={x:this.x(),y:this.y()};const h="dragstart";o.isEnabled(h)&&o.dispatch(h,{type:h,target:this,originalEvent:e.originalEvent,point:e.point,simulated:e.simulated})}if(this._isDragging){let h=this._dragPoint;this.set("x",h.x+n*be(i)+a*fe(i)),this.set("y",h.y+a*be(i)-n*fe(i));const l="dragged";o.isEnabled(l)&&o.dispatch(l,{type:l,target:this,originalEvent:e.originalEvent,point:e.point,simulated:e.simulated})}else if(Math.hypot(n,a)>5){this._isDragging=!0,this._dragEvent=e,this._dragPoint={x:this.x(),y:this.y()};const h="dragstart";o.isEnabled(h)&&o.dispatch(h,{type:h,target:this,originalEvent:e.originalEvent,point:e.point,simulated:e.simulated})}}}_updateSize(){}_getBounds(){this._localBounds=this._display.getLocalBounds()}depth(){let e=this.parent,t=0;for(;;){if(!e)return t;++t,e=e.parent}}markDirtySize(){this._sizeDirty=!0,this.markDirty()}markDirtyBounds(){const e=this._display;if(this.get("isMeasured")){this._root._addDirtyBounds(this),e.isMeasured=!0,e.invalidateBounds();const t=this.parent;t&&this.get("position")!="absolute"&&(t.get("width")==null||t.get("height")==null||t.get("layout"))&&t.markDirtyBounds(),this.get("focusable")&&this.isFocus()&&this.markDirtyAccessibility()}}markDirtyAccessibility(){this._root._invalidateAccessibility(this)}markDirtyLayer(){this._display.markDirtyLayer(!0)}markDirty(){super.markDirty(),this.markDirtyLayer()}_updateBounds(){const e=this._adjustedLocalBounds;let t;if(this.get("visible")&&this.getPrivate("visible")&&!this.get("forceHidden")?(this._getBounds(),this._fixMinBounds(this._localBounds),this.updatePivotPoint(),this._adjustedLocalBounds=this._display.getAdjustedBounds(this._localBounds),t=this._adjustedLocalBounds):(t={left:0,right:0,top:0,bottom:0},this._localBounds=t,this._adjustedLocalBounds=t),!e||e.left!==t.left||e.top!==t.top||e.right!==t.right||e.bottom!==t.bottom){const i="boundschanged";this.events.isEnabled(i)&&this.events.dispatch(i,{type:i,target:this}),this.parent&&(this.parent.markDirty(),this.parent.markDirtyBounds())}}_fixMinBounds(e){let t=this.get("minWidth",this.getPrivate("minWidth")),i=this.get("minHeight",this.getPrivate("minHeight"));_(t)&&e.right-e.left0?e.right=e.left+r:e.left=e.right+r),_(n)&&(n>0?e.bottom=e.top+n:e.top=e.bottom+n)}_removeParent(e){e&&(e.children.removeValue(this),O(e._percentageSizeChildren,this),O(e._percentagePositionChildren,this))}_clearDirty(){super._clearDirty(),this._sizeDirty=!1,this._statesHandled=!1}hover(){this.showTooltip(),this._handleOver()}unhover(){this.hideTooltip(),this._handleOut()}showTooltip(e){const t=this.getTooltip(),i=this.get("tooltipText"),r=this.get("tooltipHTML");if((i||r)&&t){const n=this.get("tooltipPosition"),a=this.getPrivate("tooltipTarget",this);n!="fixed"&&e||(this._display._setMatrix(),e=this.toGlobal(a._getTooltipPoint())),t.set("pointTo",e),t.set("tooltipTarget",a),t.get("x")||t.set("x",e.x),t.get("y")||t.set("y",e.y),i&&t.label.set("text",i),r&&t.label.set("html",r);const o=this.dataItem;if(o&&t.label._setDataItem(o),this.get("showTooltipOn")=="always"&&(e.x<0||e.x>this._root.width()||e.y<0||e.y>this._root.height()))return void this.hideTooltip();t.label.text.markDirtyText();const h=t.show();return this.setPrivateRaw("showingTooltip",!0),h}}hideTooltip(){const e=this.getTooltip();if(e&&(e.get("tooltipTarget")==this.getPrivate("tooltipTarget",this)||this.get("tooltip")==e)){let t=e.get("keepTargetHover")&&e.get("stateAnimationDuration",0)==0?400:void 0;const i=e.hide(t);return this.setPrivateRaw("showingTooltip",!1),i}}_getTooltipPoint(){const e=this._localBounds;if(e){let t=0,i=0;return this.get("isMeasured")?(t=e.left+C(this.get("tooltipX",0),e.right-e.left),i=e.top+C(this.get("tooltipY",0),e.bottom-e.top)):(t=C(this.get("tooltipX",0),this.width()),i=C(this.get("tooltipY",0),this.height())),{x:t,y:i}}return{x:0,y:0}}getTooltip(){let e=this.get("tooltip");if(e)return e;{let t=this.parent;if(t)return t.getTooltip()}}_updatePosition(){const e=this.parent;let t=this.get("dx",0),i=this.get("dy",0),r=this.get("x"),n=this.getPrivate("x"),a=0,o=0;const h=this.get("position");r instanceof f&&(r=e?e.innerWidth()*r.value+e.get("paddingLeft",0):0),_(r)?a=r+t:n!=null?a=n:e&&h=="relative"&&(a=e.get("paddingLeft",0)+t);let l=this.get("y"),d=this.getPrivate("y");l instanceof f&&(l=e?e.innerHeight()*l.value+e.get("paddingTop",0):0),_(l)?o=l+i:d!=null?o=d:e&&h=="relative"&&(o=e.get("paddingTop",0)+i);const p=this._display;if(p.x!=a||p.y!=o){p.invalidateBounds(),p.x=a,p.y=o;const u="positionchanged";this.events.isEnabled(u)&&this.events.dispatch(u,{type:u,target:this})}this.getPrivate("showingTooltip")&&this.showTooltip()}x(){let e=this.get("x"),t=this.getPrivate("x");const i=this.parent;return i?e instanceof f?C(e,i.innerWidth())+i.get("paddingLeft",0):_(e)?e:t??i.get("paddingLeft",this._display.x):this._display.x}y(){let e=this.getPrivate("y");if(e!=null)return e;let t=this.get("y");const i=this.parent;return i?t instanceof f?C(t,i.innerHeight())+i.get("paddingTop",0):_(t)?t:e??i.get("paddingTop",this._display.y):this._display.y}_dispose(){super._dispose(),this._display.dispose(),this._removeTemplateField(),this._removeParent(this.parent),this._root._removeFocusElement(this);const e=this.get("tooltip");e&&e.dispose(),this.markDirty()}adjustedLocalBounds(){return this._fixMinBounds(this._adjustedLocalBounds),this._adjustedLocalBounds}localBounds(){return this._localBounds}bounds(){const e=this._adjustedLocalBounds,t=this.x(),i=this.y();return{left:e.left+t,right:e.right+t,top:e.top+i,bottom:e.bottom+i}}globalBounds(){const e=this.localBounds(),t=this.toGlobal({x:e.left,y:e.top}),i=this.toGlobal({x:e.right,y:e.top}),r=this.toGlobal({x:e.right,y:e.bottom}),n=this.toGlobal({x:e.left,y:e.bottom});return{left:Math.min(t.x,i.x,r.x,n.x),top:Math.min(t.y,i.y,r.y,n.y),right:Math.max(t.x,i.x,r.x,n.x),bottom:Math.max(t.y,i.y,r.y,n.y)}}_onShow(e){}_onHide(e){}appear(e,t){return Z(this,void 0,void 0,function*(){return yield this.hide(0),t?new Promise((i,r)=>{this.setTimeout(()=>{i(this.show(e))},t)}):this.show(e)})}show(e){return Z(this,void 0,void 0,function*(){if(!this._isShowing){this._isHidden=!1,this._isShowing=!0,this._isHiding=!1,this.states.lookup("default").get("visible")&&this.set("visible",!0),this._onShow(e);const t=this.states.applyAnimate("default",e);yield Ce(t),this._isShowing=!1}})}hide(e){return Z(this,void 0,void 0,function*(){if(!this._isHiding&&!this._isHidden){this._isHiding=!0,this._isShowing=!1;let t=this.states.lookup("hidden");t||(t=this.states.create("hidden",{opacity:0,visible:!1})),this._isHidden=!0,this._onHide(e);const i=this.states.applyAnimate("hidden",e);yield Ce(i),this._isHiding=!1}})}isHidden(){return this._isHidden}isShowing(){return this._isShowing}isHiding(){return this._isHiding}isHover(){return this._display.hovering()}isFocus(){return this._root.focused(this)}isDragging(){return this._isDragging}isVisible(){return!(!this.get("visible")||!this.getPrivate("visible")||this.get("forceHidden"))}isVisibleDeep(){return this._parent?this._parent.isVisibleDeep()&&this.isVisible():this.isVisible()}compositeOpacity(){const e=this.get("opacity",1);return this._parent?this._parent.compositeOpacity()*e:e}width(){let e=this.get("width"),t=this.get("maxWidth",this.getPrivate("maxWidth")),i=this.get("minWidth",this.getPrivate("minWidth")),r=this.getPrivate("width"),n=0;if(_(r))n=r;else if(e==null)this._adjustedLocalBounds&&(n=this._adjustedLocalBounds.right-this._adjustedLocalBounds.left);else if(e instanceof f){const a=this.parent;n=a?a.innerWidth()*e.value:this._root.width()*e.value}else _(e)&&(n=e);return _(i)&&(n=Math.max(i,n)),_(t)&&(n=Math.min(t,n)),n}maxWidth(){let e=this.get("maxWidth",this.getPrivate("maxWidth"));if(_(e))return e;{let i=this.get("width");if(_(i))return i}const t=this.parent;return t?t.innerWidth():this._root.width()}maxHeight(){let e=this.get("maxHeight",this.getPrivate("maxHeight"));if(_(e))return e;{let i=this.get("height");if(_(i))return i}const t=this.parent;return t?t.innerHeight():this._root.height()}height(){let e=this.get("height"),t=this.get("maxHeight",this.getPrivate("maxHeight")),i=this.get("minHeight",this.getPrivate("minHeight")),r=this.getPrivate("height"),n=0;if(_(r))n=r;else if(e==null)this._adjustedLocalBounds&&(n=this._adjustedLocalBounds.bottom-this._adjustedLocalBounds.top);else if(e instanceof f){const a=this.parent;n=a?a.innerHeight()*e.value:this._root.height()*e.value}else _(e)&&(n=e);return _(i)&&(n=Math.max(i,n)),_(t)&&(n=Math.min(t,n)),n}_findStaticTemplate(e){return this._templateField&&e(this._templateField)?this._templateField:super._findStaticTemplate(e)}_walkParents(e){this._parent&&this._walkParent(e)}_walkParent(e){this._parent&&this._parent._walkParent(e),e(this)}get parent(){return this._parent}_setParent(e,t=!1){const i=this._parent;e!==i&&(this.markDirtyBounds(),e.markDirty(),this._parent=e,t&&(this._removeParent(i),e&&(this._addPercentageSizeChildren(),this._addPercentagePositionChildren())),this.markDirtyPosition(),this._applyThemes())}getNumberFormatter(){return this.get("numberFormatter",this._root.numberFormatter)}getDateFormatter(){return this.get("dateFormatter",this._root.dateFormatter)}getDurationFormatter(){return this.get("durationFormatter",this._root.durationFormatter)}toGlobal(e){return this._display.toGlobal(e)}toLocal(e){return this._display.toLocal(e)}_getDownPoint(){const e=this._getDownPointId();if(e)return this._downPoints[e]}_getDownPointId(){if(this._downPoints)return ot(this._downPoints,(e,t)=>e>t?1:e0&&(this._backgroundDisplay.beginFill(r,n),this._backgroundDisplay.drawRect(0,0,t,i),this._backgroundDisplay.endFill()),this._display.angle=this.get("rotation",0),this._draw(),this._pattern=this._root._renderer.createPattern(this._display,this._backgroundDisplay,e,t,i)}}}Object.defineProperty(W,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Pattern"}),Object.defineProperty(W,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:A.classNames.concat([W.className])});class V extends W{constructor(){super(...arguments),Object.defineProperty(this,"_image",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_beforeChanged(){super._beforeChanged(),this._clear=!0,this.isDirty("src")&&this._load()}_draw(){super._draw();const e=this._image;if(e){const t=this.get("width",100),i=this.get("height",100),r=this.get("fit","image");let n=0,a=0;r=="pattern"?(n=t,a=i):(n=e.width,a=e.height,r=="image"&&(this.set("width",n),this.set("height",a)));let o=0,h=0;this.get("centered",!0)&&(o=t/2-n/2,h=i/2-a/2),this._display.image(e,n,a,o,h)}}_load(){const e=this.get("src");if(e){const t=new Image;t.src=e,t.decode().then(()=>{this._image=t,this._draw(),this.events.isEnabled("loaded")&&this.events.dispatch("loaded",{type:"loaded",target:this})}).catch(i=>{})}}}var ve;Object.defineProperty(V,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PicturePattern"}),Object.defineProperty(V,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:W.classNames.concat([V.className])}),function(s){s.ADD="lighter",s.COLOR="color",s.COLOR_BURN="color-burn",s.COLOR_DODGE="color-dodge",s.DARKEN="darken",s.DIFFERENCE="difference",s.DST_OVER="destination-over",s.EXCLUSION="exclusion",s.HARD_LIGHT="hard-light",s.HUE="hue",s.LIGHTEN="lighten",s.LUMINOSITY="luminosity",s.MULTIPLY="multiply",s.NORMAL="source-over",s.OVERLAY="overlay",s.SATURATION="saturation",s.SCREEN="screen",s.SOFT_LIGHT="soft-light",s.SRC_ATOP="source-atop",s.XOR="xor"}(ve||(ve={}));const Si=["fill","fillOpacity","stroke","strokeWidth","strokeOpacity","fillPattern","strokePattern","fillGradient","strokeGradient","strokeDasharray","strokeDashoffset"];class U extends D{constructor(){super(...arguments),Object.defineProperty(this,"_display",{enumerable:!0,configurable:!0,writable:!0,value:this._root._renderer.makeGraphics()}),Object.defineProperty(this,"_clear",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_beforeChanged(){if(super._beforeChanged(),(this.isDirty("draw")||this.isDirty("svgPath"))&&this.markDirtyBounds(),(this.isDirty("fill")||this.isDirty("stroke")||this.isDirty("visible")||this.isDirty("forceHidden")||this.isDirty("scale")||this.isDirty("fillGradient")||this.isDirty("strokeGradient")||this.isDirty("fillPattern")||this.isDirty("strokePattern")||this.isDirty("fillOpacity")||this.isDirty("strokeOpacity")||this.isDirty("strokeWidth")||this.isDirty("draw")||this.isDirty("blendMode")||this.isDirty("strokeDasharray")||this.isDirty("strokeDashoffset")||this.isDirty("svgPath")||this.isDirty("lineJoin")||this.isDirty("shadowColor")||this.isDirty("shadowBlur")||this.isDirty("shadowOffsetX")||this.isDirty("shadowOffsetY"))&&(this._clear=!0),this._display.crisp=this.get("crisp",!1),this.isDirty("fillGradient")){const e=this.get("fillGradient");if(e){this._display.isMeasured=!0;const t=e.get("target");t&&(this._disposers.push(t.events.on("boundschanged",()=>{this._markDirtyKey("fill")})),this._disposers.push(t.events.on("positionchanged",()=>{this._markDirtyKey("fill")})))}}if(this.isDirty("strokeGradient")){const e=this.get("strokeGradient");if(e){this._display.isMeasured=!0;const t=e.get("target");t&&(this._disposers.push(t.events.on("boundschanged",()=>{this._markDirtyKey("stroke")})),this._disposers.push(t.events.on("positionchanged",()=>{this._markDirtyKey("stroke")})))}}}_changed(){if(super._changed(),this._clear){this.markDirtyBounds(),this.markDirtyLayer(),this._display.clear();let e=this.get("strokeDasharray");_(e)&&(e=e<.5?[0]:[e]),this._display.setLineDash(e);const t=this.get("strokeDashoffset");t&&this._display.setLineDashOffset(t);const i=this.get("blendMode",ve.NORMAL);this._display.blendMode=i;const r=this.get("draw");r&&r(this._display,this);const n=this.get("svgPath");n!=null&&this._display.svgPath(n)}}_afterChanged(){if(super._afterChanged(),this._clear){const e=this.get("fill"),t=this.get("fillGradient"),i=this.get("fillPattern"),r=this.get("fillOpacity"),n=this.get("stroke"),a=this.get("strokeGradient"),o=this.get("strokePattern"),h=this.get("shadowColor"),l=this.get("shadowBlur"),d=this.get("shadowOffsetX"),p=this.get("shadowOffsetY"),u=this.get("shadowOpacity");if(h&&(l||d||p)&&this._display.shadow(h,l,d,p,u),i){let c=!1;!e||i.get("fill")&&!i.get("fillInherited")||(i.set("fill",e),i.set("fillInherited",!0),c=!0),!n||i.get("color")&&!i.get("colorInherited")||(i.set("color",n),i.set("colorInherited",!0),c=!0),c&&i._changed();const m=i.pattern;m&&(this._display.beginFill(m,r),this._display.endFill(),i instanceof V&&i.events.once("loaded",()=>{this._clear=!0,this.markDirty()}))}else if(t){if(e){const m=t.get("stops",[]);m.length&&g(m,b=>{b.color&&!b.colorInherited||!e||(b.color=e,b.colorInherited=!0),(b.opacity==null||b.opacityInherited)&&(b.opacity=r,b.opacityInherited=!0)})}const c=t.getFill(this);c&&(this._display.beginFill(c,r),this._display.endFill())}else e&&(this._display.beginFill(e,r),this._display.endFill());if(n||a||o){const c=this.get("strokeOpacity");let m=this.get("strokeWidth",1);this.get("nonScalingStroke")&&(m/=this.get("scale",1)),this.get("crisp")&&(m/=this._root._renderer.resolution);const b=this.get("lineJoin");if(o){let S=!1;!n||o.get("color")&&!o.get("colorInherited")||(o.set("color",n),o.set("colorInherited",!0),S=!0),S&&o._changed();const x=o.pattern;x&&(this._display.lineStyle(m,x,c,b),this._display.endStroke(),o instanceof V&&o.events.once("loaded",()=>{this._clear=!0,this.markDirty()}))}else if(a){const S=a.get("stops",[]);S.length&&g(S,v=>{v.color&&!v.colorInherited||!n||(v.color=n,v.colorInherited=!0),(v.opacity==null||v.opacityInherited)&&(v.opacity=c,v.opacityInherited=!0)});const x=a.getFill(this);x&&(this._display.lineStyle(m,x,c,b),this._display.endStroke())}else n&&(this._display.lineStyle(m,n,c,b),this._display.endStroke())}this.getPrivate("showingTooltip")&&this.showTooltip()}this._clear=!1}}Object.defineProperty(U,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Graphics"}),Object.defineProperty(U,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:D.classNames.concat([U.className])});class K extends U{_beforeChanged(){super._beforeChanged(),(this.isDirty("width")||this.isDirty("height")||this.isPrivateDirty("width")||this.isPrivateDirty("height"))&&(this._clear=!0)}_changed(){super._changed(),this._clear&&!this.get("draw")&&this._draw()}_draw(){this._display.drawRect(0,0,this.width(),this.height())}_updateSize(){this.markDirty(),this._clear=!0}}function j(s,e){s.get("reverseChildren",!1)?s.children.eachReverse(e):s.children.each(e)}Object.defineProperty(K,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Rectangle"}),Object.defineProperty(K,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:U.classNames.concat([K.className])});class E extends A{}Object.defineProperty(E,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Layout"}),Object.defineProperty(E,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:A.classNames.concat([E.className])});class z extends E{updateContainer(e){let t=e.get("paddingLeft",0),i=e.innerWidth(),r=0;j(e,a=>{if(a.isVisible()&&a.get("position")=="relative"){let o=a.get("width");if(o instanceof f){r+=o.value;let h=i*o.value,l=a.get("minWidth",a.getPrivate("minWidth",-1/0));l>h&&(i-=l,r-=o.value);let d=a.get("maxWidth",a.getPrivate("maxWidth",1/0));h>d&&(i-=d,r-=o.value)}else _(o)||(o=a.width()),i-=o+a.get("marginLeft",0)+a.get("marginRight",0)}}),(i<=0||i==1/0)&&(i=.1),j(e,a=>{if(a.isVisible()&&a.get("position")=="relative"){let o=a.get("width");if(o instanceof f){let h=i*o.value/r-a.get("marginLeft",0)-a.get("marginRight",0),l=a.get("minWidth",a.getPrivate("minWidth",-1/0)),d=a.get("maxWidth",a.getPrivate("maxWidth",1/0));h=Math.min(Math.max(l,h),d),a.setPrivate("width",h)}else a._prevSettings.width instanceof f&&a.setPrivate("width",void 0)}});let n=t;j(e,a=>{if(a.get("position")=="relative")if(a.isVisible()){let o=a.adjustedLocalBounds(),h=a.get("marginLeft",0),l=a.get("marginRight",0),d=a.get("maxWidth"),p=o.left,u=o.right;d&&u-p>d&&(u=p+d);let c=n+h-p;a.setPrivate("x",c),n=c+u+l}else a.setPrivate("x",void 0)})}}Object.defineProperty(z,"className",{enumerable:!0,configurable:!0,writable:!0,value:"HorizontalLayout"}),Object.defineProperty(z,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:E.classNames.concat([z.className])});class G extends E{updateContainer(e){let t=e.get("paddingTop",0),i=e.innerHeight(),r=0;j(e,a=>{if(a.isVisible()&&a.get("position")=="relative"){let o=a.get("height");if(o instanceof f){r+=o.value;let h=i*o.value,l=a.get("minHeight",a.getPrivate("minHeight",-1/0));l>h&&(i-=l,r-=o.value);let d=a.get("maxHeight",a.getPrivate("maxHeight",1/0));h>d&&(i-=d,r-=o.value)}else _(o)||(o=a.height()),i-=o+a.get("marginTop",0)+a.get("marginBottom",0)}}),(i<=0||i==1/0)&&(i=.1),j(e,a=>{if(a.isVisible()&&a.get("position")=="relative"){let o=a.get("height");if(o instanceof f){let h=i*o.value/r-a.get("marginTop",0)-a.get("marginBottom",0),l=a.get("minHeight",a.getPrivate("minHeight",-1/0)),d=a.get("maxHeight",a.getPrivate("maxHeight",1/0));h=Math.min(Math.max(l,h),d),a.setPrivate("height",h)}else a._prevSettings.height instanceof f&&a.setPrivate("height",void 0)}});let n=t;j(e,a=>{if(a.get("position")=="relative")if(a.isVisible()){let o=a.adjustedLocalBounds(),h=a.get("marginTop",0),l=o.top,d=o.bottom,p=a.get("maxHeight");p&&d-l>p&&(d=l+p);let u=a.get("marginBottom",0),c=n+h-l;a.setPrivate("y",c),n=c+d+u}else a.setPrivate("y",void 0)})}}Object.defineProperty(G,"className",{enumerable:!0,configurable:!0,writable:!0,value:"VerticalLayout"}),Object.defineProperty(G,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:E.classNames.concat([G.className])});class Y extends E{_afterNew(){this._setRawDefault("maxColumns",Number.MAX_VALUE),super._afterNew()}updateContainer(e){let t=e.get("paddingLeft",0),i=e.get("paddingRight",0),r=e.get("paddingTop",0),n=e.maxWidth()-t-i,a=n,o=1;j(e,m=>{if(m.get("visible")&&m.getPrivate("visible")&&!m.get("forceHidden")&&m.get("position")!="absolute"){let b=m.width();bo&&(o=b)}}),a=Me(a,1,n),o=Me(o,1,n);let h=1;h=this.get("fixedWidthGrid")?n/o:n/a,h=Math.max(1,Math.floor(h)),h=Math.min(this.get("maxColumns",Number.MAX_VALUE),h);let l=this.getColumnWidths(e,h,o,n),d=r,p=0,u=0;h=l.length;let c=t;j(e,m=>{if(m.get("position")=="relative"&&m.isVisible()){const b=m.get("marginTop",0),S=m.get("marginBottom",0);let x=m.adjustedLocalBounds(),v=m.get("marginLeft",0),H=m.get("marginRight",0),J=c+v-x.left,q=d+b-x.top;m.setPrivate("x",J),m.setPrivate("y",q),c+=l[p]+H,u=Math.max(u,m.height()+b+S),p++,p>=h&&(p=0,c=t,d+=u)}})}getColumnWidths(e,t,i,r){let n=0,a=[],o=0;return j(e,h=>{let l=h.adjustedLocalBounds();h.get("position")!="absolute"&&h.isVisible()&&(this.get("fixedWidthGrid")?a[o]=i:a[o]=Math.max(0|a[o],l.right-l.left+h.get("marginLeft",0)+h.get("marginRight",0)),o{n+=h}),n>r?t>2?(t-=1,this.getColumnWidths(e,t,i,r)):[r]:a}}Object.defineProperty(Y,"className",{enumerable:!0,configurable:!0,writable:!0,value:"GridLayout"}),Object.defineProperty(Y,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:E.classNames.concat([Y.className])});class ye{static escape(e){return e.replace(/\[\[/g,this.prefix+"1").replace(/([^\/\]]{1})\]\]/g,"$1"+this.prefix+"2").replace(/\]\]/g,this.prefix+"2").replace(/\{\{/g,this.prefix+"3").replace(/\}\}/g,this.prefix+"4").replace(/\'\'/g,this.prefix+"5")}static unescape(e){return e.replace(new RegExp(this.prefix+"1","g"),"[[").replace(new RegExp(this.prefix+"2","g"),"]]").replace(new RegExp(this.prefix+"3","g"),"{{").replace(new RegExp(this.prefix+"4","g"),"}}").replace(new RegExp(this.prefix+"5","g"),"''")}static cleanUp(e){return e.replace(/\[\[/g,"[").replace(/\]\]/g,"]").replace(/\{\{/g,"{").replace(/\}\}/g,"}").replace(/\'\'/g,"'")}static chunk(e,t=!1,i=!1){let r=[];e=this.escape(e);let n=t?e.split("'"):[e];for(let a=0;a{e.dispose()}),this.getPrivate("htmlElement")&&this._root._removeHTMLContent(this),super._dispose()}_changed(){if(super._changed(),this.isDirty("interactiveChildren")&&(this._display.interactiveChildren=this.get("interactiveChildren",!1)),this.isDirty("layout")&&(this._prevWidth=0,this._prevHeight=0,this.markDirtyBounds(),this._prevSettings.layout&&this.children.each(e=>{e.removePrivate("x"),e.removePrivate("y")})),(this.isDirty("paddingTop")||this.isDirty("paddingBottom")||this.isDirty("paddingLeft")||this.isDirty("paddingRight"))&&this.children.each(e=>{e.markDirtyPosition()}),this.isDirty("maskContent")){const e=this._childrenDisplay;let t=this._contentMask;this.get("maskContent")?t||(t=K.new(this._root,{x:-.5,y:-.5,width:this.width()+1,height:this.height()+1}),this._contentMask=t,e.addChildAt(t._display,0),e.mask=t._display):t&&(e.removeChild(t._display),e.mask=null,t.dispose(),this._contentMask=void 0)}}_updateSize(){super._updateSize(),g(this._percentageSizeChildren,e=>{e._updateSize()}),g(this._percentagePositionChildren,e=>{e.markDirtyPosition(),e._updateSize()}),this.updateBackground()}updateBackground(){const e=this.get("background");let t=this._localBounds;if(t&&!this.isHidden()){let i=t.left,r=t.top,n=t.right-i,a=t.bottom-r,o=this.get("maxWidth"),h=this.get("maxHeight");h&&a>h&&(a=h),o&&n>o&&(n=o);let l=this.width(),d=this.height();e&&(e.setAll({width:n,height:a,x:i,y:r}),this._display.interactive&&(e._display.interactive=!0));const p=this._contentMask;p&&p.setAll({width:l+1,height:d+1});const u=this.get("verticalScrollbar");if(u){u.set("height",d),u.set("x",l-u.width()-u.get("marginRight",0)),u.set("end",u.get("start",0)+d/this._contentHeight);const c=u.get("background");c&&c.setAll({width:u.width(),height:d});let m=!0;this._contentHeight<=d&&(m=!1),u.setPrivate("visible",m)}}}_applyThemes(){return!!super._applyThemes()&&(this.eachChildren(e=>{e._applyThemes()}),!0)}_applyState(e){super._applyState(e),this.get("setStateOnChildren")&&this.eachChildren(t=>{t.states.apply(e)})}_applyStateAnimated(e,t){super._applyStateAnimated(e,t),this.get("setStateOnChildren")&&this.eachChildren(i=>{i.states.applyAnimate(e,t)})}innerWidth(){return this.width()-this.get("paddingRight",0)-this.get("paddingLeft",0)}innerHeight(){return this.height()-this.get("paddingTop",0)-this.get("paddingBottom",0)}_getBounds(){let e=this.get("width"),t=this.get("height"),i=this.getPrivate("width"),r=this.getPrivate("height"),n={left:0,top:0,right:this.width(),bottom:this.height()},a=this.get("layout"),o=!1,h=!1;if((a instanceof z||a instanceof Y)&&(o=!0),a instanceof G&&(h=!0),e==null&&i==null||t==null&&r==null||this.get("verticalScrollbar")){let l=Number.MAX_VALUE,d=l,p=-l,u=l,c=-l;const m=this.get("paddingLeft",0),b=this.get("paddingTop",0),S=this.get("paddingRight",0),x=this.get("paddingBottom",0);this.children.each(v=>{if(v.get("position")!="absolute"&&v.get("isMeasured")){let H=v.adjustedLocalBounds(),J=v.x(),q=v.y(),ne=J+H.left,ae=J+H.right,oe=q+H.top,he=q+H.bottom;o&&(ne-=v.get("marginLeft",0),ae+=v.get("marginRight",0)),h&&(oe-=v.get("marginTop",0),he+=v.get("marginBottom",0)),nep&&(p=ae),oec&&(c=he)}}),d==l&&(d=0),p==-l&&(p=0),u==l&&(u=0),c==-l&&(c=0),n.left=d-m,n.top=u-b,n.right=p+S,n.bottom=c+x}this._contentWidth=n.right-n.left,this._contentHeight=n.bottom-n.top,_(e)&&(n.left=0,n.right=e),_(i)&&(n.left=0,n.right=i),_(t)&&(n.top=0,n.bottom=t),_(r)&&(n.top=0,n.bottom=r),this._localBounds=n}_updateBounds(){const e=this.get("layout");e&&e.updateContainer(this),super._updateBounds(),this.updateBackground()}markDirty(){super.markDirty(),this._root._addDirtyParent(this)}_prepareChildren(){const e=this.innerWidth(),t=this.innerHeight();if(e!=this._prevWidth||t!=this._prevHeight){let i=this.get("layout"),r=!1,n=!1;i&&((i instanceof z||i instanceof Y)&&(r=!0),i instanceof G&&(n=!0)),g(this._percentageSizeChildren,a=>{if(!r){let o=a.get("width");o instanceof f&&a.setPrivate("width",o.value*e)}if(!n){let o=a.get("height");o instanceof f&&a.setPrivate("height",o.value*t)}}),g(this._percentagePositionChildren,a=>{a.markDirtyPosition(),a.markDirtyBounds()}),this._prevWidth=e,this._prevHeight=t,this._sizeDirty=!0,this.updateBackground()}this._handleStates()}_updateChildren(){if(this.isDirty("html")){const e=this.get("html");e&&e!==""?this._root._setHTMLContent(this,we(this,this.get("html",""))):this._root._removeHTMLContent(this),this._root._positionHTMLElement(this)}if(this.isDirty("verticalScrollbar")){const e=this.get("verticalScrollbar");if(e){e._setParent(this),e.startGrip.setPrivate("visible",!1),e.endGrip.setPrivate("visible",!1),this.set("maskContent",!0),this.set("paddingRight",e.width()+e.get("marginRight",0)+e.get("marginLeft",0));let t=this.get("background");t||(t=this.set("background",K.new(this._root,{themeTags:["background"],fillOpacity:0,fill:this._root.interfaceColors.get("alternativeBackground")}))),this._vsbd0=this.events.on("wheel",i=>{const r=i.originalEvent;if(!dt(r,this))return;r.preventDefault();let n=r.deltaY/5e3;const a=e.get("start",0),o=e.get("end",1);a+n<=0&&(n=-a),o+n>=1&&(n=1-o),a+n>=0&&o+n<=1&&(e.set("start",a+n),e.set("end",o+n))}),this._disposers.push(this._vsbd0),this._vsbd1=e.events.on("rangechanged",()=>{let i=this._contentHeight;const r=this._childrenDisplay,n=this._contentMask;r.y=-e.get("start")*i,r.markDirtyLayer(),n&&(n._display.y=-r.y,r.mask=n._display)}),this._disposers.push(this._vsbd1),this._display.addChild(e._display)}else{const t=this._prevSettings.verticalScrollbar;t&&(this._display.removeChild(t._display),this._vsbd0&&this._vsbd0.dispose(),this._vsbd1&&this._vsbd1.dispose(),this._childrenDisplay.y=0,this.setPrivate("height",void 0),this.set("maskContent",!1),this.set("paddingRight",void 0))}}if(this.isDirty("background")){const e=this._prevSettings.background;e&&this._display.removeChild(e._display);const t=this.get("background");t instanceof D&&(t.set("isMeasured",!1),t._setParent(this),this._display.addChildAt(t._display,0))}if(this.isDirty("mask")){const e=this.get("mask"),t=this._prevSettings.mask;if(t&&(this._display.removeChild(t._display),t!=e&&t.dispose()),e){const i=e.parent;i&&i.children.removeValue(e),e._setParent(this),this._display.addChildAt(e._display,0),this._childrenDisplay.mask=e._display}}}_processTemplateField(){super._processTemplateField(),this.children.each(e=>{e._processTemplateField()})}walkChildren(e){this.children.each(t=>{t instanceof I&&t.walkChildren(e),e(t)})}eachChildren(e){const t=this.get("background");t&&e(t);const i=this.get("verticalScrollbar");i&&e(i);const r=this.get("mask");r&&e(r),this.children.values.forEach(n=>{e(n)})}allChildren(){const e=[];return this.eachChildren(t=>{e.push(t)}),e}_setDataItem(e){const t=e!==this._dataItem;super._setDataItem(e);const i=this.get("html","");i&&i!==""&&t&&this._root._setHTMLContent(this,we(this,i))}}Object.defineProperty(I,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Container"}),Object.defineProperty(I,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:D.classNames.concat([I.className])});class ie extends D{constructor(){super(...arguments),Object.defineProperty(this,"textStyle",{enumerable:!0,configurable:!0,writable:!0,value:this._root._renderer.makeTextStyle()}),Object.defineProperty(this,"_display",{enumerable:!0,configurable:!0,writable:!0,value:this._root._renderer.makeText("",this.textStyle)}),Object.defineProperty(this,"_textStyles",{enumerable:!0,configurable:!0,writable:!0,value:["textAlign","fontFamily","fontSize","fontStyle","fontWeight","fontStyle","fontVariant","textDecoration","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","shadowOpacity","lineHeight","baselineRatio","direction","textBaseline","oversizedBehavior","breakWords","ellipsis","minScale"]}),Object.defineProperty(this,"_originalScale",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_updateBounds(){if(this.get("text"))super._updateBounds();else{let e={left:0,right:0,top:0,bottom:0};this._adjustedLocalBounds=e}}_changed(){super._changed(),this._display.clear();let e=this.textStyle;if(this.isDirty("opacity")){let t=this.get("opacity",1);this._display.alpha=t}if((this.isDirty("text")||this.isDirty("populateText"))&&(this._display.text=this._getText(),this.markDirtyBounds(),this.get("role")=="tooltip"&&this._root.updateTooltip(this)),this.isPrivateDirty("tooltipElement")&&this.getPrivate("tooltipElement")&&this._disposers.push(new P(()=>{this._root._removeTooltipElement(this)})),this.isDirty("width")&&(e.wordWrapWidth=this.width(),this.markDirtyBounds()),this.isDirty("oversizedBehavior")&&(e.oversizedBehavior=this.get("oversizedBehavior","none"),this.markDirtyBounds()),this.isDirty("breakWords")&&(e.breakWords=this.get("breakWords",!1),this.markDirtyBounds()),this.isDirty("ellipsis")&&(e.ellipsis=this.get("ellipsis"),this.markDirtyBounds()),this.isDirty("ignoreFormatting")&&(e.ignoreFormatting=this.get("ignoreFormatting",!1),this.markDirtyBounds()),this.isDirty("minScale")&&(e.minScale=this.get("minScale",0),this.markDirtyBounds()),this.isDirty("fill")){let t=this.get("fill");t&&(e.fill=t)}if(this.isDirty("fillOpacity")){let t=this.get("fillOpacity",1);t&&(e.fillOpacity=t)}(this.isDirty("maxWidth")||this.isPrivateDirty("maxWidth"))&&(e.maxWidth=this.get("maxWidth",this.getPrivate("maxWidth")),this.markDirtyBounds()),(this.isDirty("maxHeight")||this.isPrivateDirty("maxHeight"))&&(e.maxHeight=this.get("maxHeight",this.getPrivate("maxHeight")),this.markDirtyBounds()),g(this._textStyles,t=>{this._dirty[t]&&(e[t]=this.get(t),this.markDirtyBounds())}),e.fontSize=this.get("fontSize"),e.fontFamily=this.get("fontFamily"),this._display.style=e,this.isDirty("role")&&this.get("role")=="tooltip"&&this._root.updateTooltip(this)}_getText(){const e=this.get("text","");return this.get("populateText")?we(this,e):e}markDirtyText(){this._display.text=this._getText(),this.get("role")=="tooltip"&&this._root.updateTooltip(this),this.markDirtyBounds(),this.markDirty()}_setDataItem(e){super._setDataItem(e),this.get("populateText")&&this.markDirtyText()}getNumberFormatter(){return this.parent?this.parent.getNumberFormatter():super.getNumberFormatter()}getDateFormatter(){return this.parent?this.parent.getDateFormatter():super.getDateFormatter()}getDurationFormatter(){return this.parent?this.parent.getDurationFormatter():super.getDurationFormatter()}}Object.defineProperty(ie,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Text"}),Object.defineProperty(ie,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:D.classNames.concat([ie.className])});class ce extends I{constructor(){super(...arguments),Object.defineProperty(this,"_text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_textKeys",{enumerable:!0,configurable:!0,writable:!0,value:["text","fill","fillOpacity","textAlign","fontFamily","fontSize","fontStyle","fontWeight","fontStyle","fontVariant","textDecoration","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","shadowOpacity","lineHeight","baselineRatio","direction","textBaseline","oversizedBehavior","breakWords","ellipsis","minScale","populateText","role","ignoreFormatting"]})}get text(){return this._text}_afterNew(){super._afterNew(),this._makeText(),g(this._textKeys,e=>{const t=this.get(e);t!=null&&this._text.set(e,t)}),this.get("html","")!==""&&this._text.set("text",""),this.onPrivate("maxWidth",()=>{this._setMaxDimentions()}),this.onPrivate("maxHeight",()=>{this._setMaxDimentions()})}_makeText(){this._text=this.children.push(ie.new(this._root,{}))}_updateChildren(){if(super._updateChildren(),g(this._textKeys,e=>{this._text.set(e,this.get(e))}),this.isDirty("maxWidth")&&this._setMaxDimentions(),this.isDirty("maxHeight")&&this._setMaxDimentions(),this.isDirty("rotation")&&this._setMaxDimentions(),this.get("html","")!==""?this._text.set("text",""):this._text.set("text",this.get("text")),this.isDirty("textAlign")||this.isDirty("width")){const e=this.get("textAlign");let t;this.get("width")!=null?t=e=="right"?nt:e=="center"?at:0:e=="left"||e=="start"?t=this.get("paddingLeft"):e!="right"&&e!="end"||(t=-this.get("paddingRight")),this.text.set("x",t)}}_setMaxDimentions(){const e=this.get("rotation"),t=e==90||e==270||e==-90,i=this.get("maxWidth",this.getPrivate("maxWidth",1/0));_(i)?this.text.set(t?"maxHeight":"maxWidth",i-this.get("paddingLeft",0)-this.get("paddingRight",0)):this.text.set(t?"maxHeight":"maxWidth",void 0);const r=this.get("maxHeight",this.getPrivate("maxHeight",1/0));_(r)?this.text.set(t?"maxWidth":"maxHeight",r-this.get("paddingTop",0)-this.get("paddingBottom",0)):this.text.set(t?"maxWidth":"maxHeight",void 0)}_setDataItem(e){super._setDataItem(e),this._markDirtyKey("text"),this.text.get("populateText")&&this.text.markDirtyText()}getText(){return this._text._getText()}}Object.defineProperty(ce,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Label"}),Object.defineProperty(ce,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:I.classNames.concat([ce.className])});class ji{constructor(e,t){if(Object.defineProperty(this,"_root",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rules",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this._root=e,!t)throw new Error("You cannot use `new Class()`, instead use `Class.new()`")}static new(e){const t=new this(e,!0);return t.setupDefaultRules(),t}setupDefaultRules(){}_lookupRules(e){return this._rules[e]}ruleRaw(e,t=[]){let i=this._rules[e];i||(i=this._rules[e]=[]),t.sort(N);const{index:r,found:n}=et(i,a=>{const o=N(a.tags.length,t.length);return o===0?Ye(a.tags,t,N):o});if(n)return i[r].template;{const a=X.new({});return i.splice(r,0,{tags:t,template:a}),a}}rule(e,t=[]){return this.ruleRaw(e,t)}}export{T as $,Y as A,X as B,xt as C,Wt as D,A as E,Re as F,fi as G,k as H,Et as I,Gt as J,f as K,wt as L,ie as M,Di as N,xi as O,be as P,I as Q,fe as R,Qe as S,Ge as T,Pi as U,K as V,U as W,at as X,nt as Y,y as Z,Nt as _,st as a,Si as a0,we as a1,zt as a2,Oi as a3,Be as a4,Ie as a5,ni as a6,Oe as a7,Lt as a8,Ht as a9,oi as aA,Yt as aB,Ut as aC,se as aD,Zt as aE,it as aF,Qt as aG,ti as aH,ve as aI,Rt as aJ,ei as aK,Ne as aL,vi as aM,We as aN,ye as aa,$ as ab,G as ac,z as ad,si as ae,L as af,ii as ag,Jt as ah,qt as ai,Vt as aj,N as ak,P as al,Xt as am,ai as an,Te as ao,$t as ap,gi as aq,ue as ar,ci as as,pi as at,hi as au,di as av,je as aw,li as ax,ui as ay,ge as az,mi as b,Fe as c,yi as d,ce as e,Se as f,dt as g,_i as h,ji as i,C as j,Ti as k,_ as l,g as m,De as n,ri as o,Me as p,w as q,le as r,Kt as s,bi as t,wi as u,He as v,Ft as w,ki as x,O as y,xe as z}; +import{d1 as Z}from"./index-pCX-0tJH.js";function De(s){return Number(s)!==s}function Xe(s){return{}.toString.call(s)}function ge(s){if(s!=null&&!_(s)){let e=Number(s);return De(e)&&Be(s)&&s!=""?ge(s.replace(/[^0-9.\-]+/g,"")):e}return s}function $e(s){if(_e(s))return new Date(s);if(_(s))return new Date(s);{let e=Number(s);return _(e)?new Date(e):new Date(s)}}function Ht(s){if(De(s))return"NaN";if(s===1/0)return"Infinity";if(s===-1/0)return"-Infinity";if(s===0&&1/s==-1/0)return"-0";let e=s<0;s=Math.abs(s);let t,i=/^([0-9]+)(?:\.([0-9]+))?(?:e[\+\-]([0-9]+))?$/.exec(""+s),r=i[1],n=i[2]||"";if(i[3]===void 0)t=n===""?r:r+"."+n;else{let a=+i[3];if(s<1)t="0."+ke("0",a-1)+r+n;else{let o=a-n.length;t=o===0?r+n:o<0?r+n.slice(0,o)+"."+n.slice(o):r+n+ke("0",o)}}return e?"-"+t:t}function ke(s,e){return new Array(e+1).join(s)}function _e(s){return Xe(s)==="[object Date]"}function Be(s){return typeof s=="string"}function _(s){return typeof s=="number"&&Number(s)==s}function Ie(s){return typeof s=="object"&&s!==null}const Oe="__§§§__",Lt="__§§§§__";function se(s,e){const t=s.length;for(let i=0;i0;)--t,e(s[t],t)}function Rt(s,e){const t=s.length;for(let i=0;i0;)if(--t,e(s[t],t))return t;return-1}function Qe(s,e){const t=Le(s,e);if(t!==-1)return s[t]}function Ze(s,e){const t=qe(s,e);if(t!==-1)return s[t]}function et(s,e){let t=0,i=s.length,r=!1;for(;t>1,a=e(s[n]);a<0?t=n+1:a===0?(r=!0,t=n+1):i=n}return{found:r,index:r?t-1:t}}function tt(s,e){let t=0,i=s.length,r=!1;for(;t>1,a=e(s[n]);a<0?t=n+1:(a===0&&(r=!0),i=n)}return{found:r,index:t}}function Vt(s,e){let t=s.length;for(;t>0;)--t,e(s[t])||s.splice(t,1)}class Ne{constructor(){Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._disposed=!1}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this._dispose())}}class P{constructor(e){Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispose",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._disposed=!1,this._dispose=e}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this._dispose())}}class Ut extends Ne{constructor(){super(...arguments),Object.defineProperty(this,"_disposers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}_dispose(){g(this._disposers,e=>{e.dispose()})}}class k extends Ne{constructor(e){super(),Object.defineProperty(this,"_disposers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._disposers=e}_dispose(){g(this._disposers,e=>{e.dispose()})}get disposers(){return this._disposers}}class it extends P{constructor(){super(...arguments),Object.defineProperty(this,"_counter",{enumerable:!0,configurable:!0,writable:!0,value:0})}increment(){return++this._counter,new P(()=>{--this._counter,this._counter===0&&this.dispose()})}}class ${constructor(){Object.defineProperty(this,"_listeners",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_killed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_disabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_iterating",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_enabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._listeners=[],this._killed=[],this._disabled={},this._iterating=0,this._enabled=!0,this._disposed=!1}isDisposed(){return this._disposed}dispose(){if(!this._disposed){this._disposed=!0;const e=this._listeners;this._iterating=1,this._listeners=null,this._disabled=null;try{g(e,t=>{t.disposer.dispose()})}finally{this._killed=null,this._iterating=null}}}hasListeners(){return this._listeners.length!==0}hasListenersByType(e){return Je(this._listeners,t=>(t.type===null||t.type===e)&&!t.killed)}enable(){this._enabled=!0}disable(){this._enabled=!1}enableType(e){delete this._disabled[e]}disableType(e,t=1/0){this._disabled[e]=t}_removeListener(e){if(this._iterating===0){const t=this._listeners.indexOf(e);if(t===-1)throw new Error("Invalid state: could not remove listener");this._listeners.splice(t,1)}else this._killed.push(e)}_removeExistingListener(e,t,i,r){if(this._disposed)throw new Error("EventDispatcher is disposed");this._eachListener(n=>{n.once!==e||n.type!==t||i!==void 0&&n.callback!==i||n.context!==r||n.disposer.dispose()})}isEnabled(e){if(this._disposed)throw new Error("EventDispatcher is disposed");return this._enabled&&this._listeners.length>0&&this.hasListenersByType(e)&&this._disabled[e]===void 0}removeType(e){if(this._disposed)throw new Error("EventDispatcher is disposed");this._eachListener(t=>{t.type===e&&t.disposer.dispose()})}has(e,t,i){return Le(this._listeners,r=>r.once!==!0&&r.type===e&&(t===void 0||r.callback===t)&&r.context===i)!==-1}_shouldDispatch(e){if(this._disposed)throw new Error("EventDispatcher is disposed");const t=this._disabled[e];return _(t)?(t<=1?delete this._disabled[e]:--this._disabled[e],!1):this._enabled}_eachListener(e){++this._iterating;try{g(this._listeners,e)}finally{--this._iterating,this._iterating===0&&this._killed.length!==0&&(g(this._killed,t=>{this._removeListener(t)}),this._killed.length=0)}}dispatch(e,t){this._shouldDispatch(e)&&this._eachListener(i=>{i.killed||i.type!==null&&i.type!==e||i.dispatch(e,t)})}_on(e,t,i,r,n,a){if(this._disposed)throw new Error("EventDispatcher is disposed");this._removeExistingListener(e,t,i,r);const o={type:t,callback:i,context:r,shouldClone:n,dispatch:a,killed:!1,once:e,disposer:new P(()=>{o.killed=!0,this._removeListener(o)})};return this._listeners.push(o),o}onAll(e,t,i=!0){return this._on(!1,null,e,t,i,(r,n)=>e.call(t,n)).disposer}on(e,t,i,r=!0){return this._on(!1,e,t,i,r,(n,a)=>t.call(i,a)).disposer}once(e,t,i,r=!0){const n=this._on(!0,e,t,i,r,(a,o)=>{n.disposer.dispose(),t.call(i,o)});return n.disposer}off(e,t,i){this._removeExistingListener(!1,e,t,i)}copyFrom(e){if(this._disposed)throw new Error("EventDispatcher is disposed");if(e===this)throw new Error("Cannot copyFrom the same TargetedEventDispatcher");const t=[];return g(e._listeners,i=>{!i.killed&&i.shouldClone&&(i.type===null?t.push(this.onAll(i.callback,i.context)):i.once?t.push(this.once(i.type,i.callback,i.context)):t.push(this.on(i.type,i.callback,i.context)))}),new k(t)}}function R(s,e){if(!(s>=0&&s=0&&e{this.push(t)})}copyFrom(e){this.pushAll(e._values)}pop(){return this._values.length-1<0?void 0:this.removeIndex(this._values.length-1)}shift(){return this._values.length?this.removeIndex(0):void 0}setAll(e){const t=this._values;this._values=[],this._onClear(t),g(e,i=>{this._values.push(i),this._onPush(i)})}clear(){this.setAll([])}*[Symbol.iterator](){const e=this._values.length;for(let t=0;t{t.dispose()}),super._onClear(e)}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this.autoDispose&&g(this._values,e=>{e.dispose()}))}}class Kt extends st{constructor(e,t){super(),Object.defineProperty(this,"template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"make",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.template=e,this.make=t}}class rt extends Re{constructor(e){super(),Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._container=e,this._events=this.events.onAll(t=>{if(t.type==="clear")g(t.oldValues,i=>{this._onRemoved(i)});else if(t.type==="push")this._onInserted(t.newValue);else if(t.type==="setIndex")this._onRemoved(t.oldValue),this._onInserted(t.newValue,t.index);else if(t.type==="insertIndex")this._onInserted(t.newValue,t.index);else if(t.type==="removeIndex")this._onRemoved(t.oldValue);else{if(t.type!=="moveIndex")throw new Error("Unknown IListEvent type");this._onRemoved(t.value),this._onInserted(t.value,t.newIndex)}})}_onInserted(e,t){e._setParent(this._container,!0);const i=this._container._childrenDisplay;t===void 0?i.addChild(e._display):i.addChildAt(e._display,t)}_onRemoved(e){this._container._childrenDisplay.removeChild(e._display),this._container.markDirtyBounds(),this._container.markDirty()}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this._events.dispose(),g(this.values,e=>{e.dispose()}))}}class f{constructor(e){Object.defineProperty(this,"_value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._value=e}get value(){return this._value/100}get percent(){return this._value}toString(){return this._value+"%"}interpolate(e,t){return e+this.value*(t-e)}static normalize(e,t,i){return e instanceof f?e:new f(t===i?0:100*Math.min(Math.max(1/(i-t)*(e-t),0),1))}}function xe(s){return new f(s)}const zt=xe(0),nt=xe(100),at=xe(50);function T(s){return Object.keys(s)}function ot(s,e){return T(s).sort(e)}function Gt(s){return Object.assign({},s)}function w(s,e){T(s).forEach(t=>{e(t,s[t])})}function Yt(s,e){for(let t in s)if(ht(s,t)&&!e(t,s[t]))break}function ht(s,e){return{}.hasOwnProperty.call(s,e)}function Xt(s){s.parentNode&&s.parentNode.removeChild(s)}function Fe(s,e,t,i){return s.addEventListener(e,t,i||!1),new P(()=>{s.removeEventListener(e,t,i||!1)})}function $t(s){return Fe(window,"resize",e=>{s()})}function le(s){switch(s){case"touchevents":return window.hasOwnProperty("TouchEvent");case"pointerevents":return window.hasOwnProperty("PointerEvent");case"mouseevents":return window.hasOwnProperty("MouseEvent");case"wheelevents":return window.hasOwnProperty("WheelEvent");case"keyboardevents":return window.hasOwnProperty("KeyboardEvent")}return!1}function de(s){return s.pointerId||0}function Jt(){if(document.activeElement&&document.activeElement!=document.body)if(document.activeElement.blur)document.activeElement.blur();else{let s=document.createElement("button");s.style.position="fixed",s.style.top="0px",s.style.left="-10000px",document.body.appendChild(s),s.focus(),s.blur(),document.body.removeChild(s)}}function qt(s){s&&s.focus()}function Qt(s){if(le("pointerevents"))return s;if(le("touchevents"))switch(s){case"pointerover":case"pointerdown":return"touchstart";case"pointerout":case"pointerleave":case"pointerup":return"touchend";case"pointermove":return"touchmove";case"click":return"click";case"dblclick":return"dblclick"}else if(le("mouseevents"))switch(s){case"pointerover":return"mouseover";case"pointerout":return"mouseout";case"pointerleave":return"mouseleave";case"pointerdown":return"mousedown";case"pointermove":return"mousemove";case"pointerup":return"mouseup";case"click":return"click";case"dblclick":return"dblclick"}return s}function Se(s){if(typeof Touch<"u"&&s instanceof Touch)return!0;if(typeof PointerEvent<"u"&&s instanceof PointerEvent&&s.pointerType!=null)switch(s.pointerType){case"touch":case"pen":case 2:return!0;case"mouse":case 4:return!1;default:return!(s instanceof MouseEvent)}else if(s.type!=null&&s.type.match(/^mouse/))return!1;return!0}function Zt(s,e,t){s.style[e]=t}function ei(s,e){return s.style[e]}function ti(s){if(s.composedPath){const e=s.composedPath();return e.length===0?null:e[0]}return s.target}function lt(s,e){let t=e;for(;;){if(s===t)return!0;if(t.parentNode===null){if(t.host==null)return!1;t=t.host}else t=t.parentNode}}function dt(s,e){return s.target&<(e.root.dom,s.target)}function ii(s,e){s.style.pointerEvents=e?"auto":"none"}function ut(){return/apple/i.test(navigator.vendor)&&"ontouchend"in document}function si(){return ut()?1:void 0}function C(s,e){return _(s)?s:s!=null&&_(s.value)&&_(e)?e*s.value:0}function ri(s){let e=(""+s).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0}function ue(s,e=0,t="0"){return typeof s!="string"&&(s=s.toString()),e>s.length?Array(e-s.length+1).join(t)+s:s}function pt(s){return s.replace(/^[\s]*/,"")}function ct(s){return s.replace(/[\s]*$/,"")}function We(s){return pt(ct(s))}function gt(s){if(s===void 0)return"string";let e=(s=(s=(s=s.toLowerCase().replace(/^\[[^\]]*\]/,"")).replace(/\[[^\]]+\]/,"")).trim()).match(/\/(date|number|duration)$/);return e?e[1]:s==="number"?"number":s==="date"?"date":s==="duration"?"duration":s.match(/[#0]/)?"number":s.match(/[ymwdhnsqaxkzgtei]/)?"date":"string"}function ni(s){return s.replace(/\/(date|number|duration)$/i,"")}function ai(s){return s&&s.replace(/<[^>]*>/g,"")}function oi(s){return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function hi(s,e=!1){const t=new Date(s.getFullYear(),0,0),i=s.getTime()-t.getTime()+60*(t.getTimezoneOffset()-s.getTimezoneOffset())*1e3;return Math.floor(i/864e5)}function je(s,e=!1){const t=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate())),i=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-i);const r=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-r.getTime())/864e5+1)/7)}function li(s,e=!1){const t=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate())),i=t.getUTCDay()||7;return t.setUTCDate(t.getUTCDate()+4-i),new Date(Date.UTC(t.getUTCFullYear(),0,1)).getFullYear()}function di(s,e=!1){const t=je(new Date(s.getFullYear(),s.getMonth(),1),e);let i=je(s,e);return i==1&&(i=53),i-t+1}function ui(s,e,t=1,i=!1){let r=new Date(e,0,4,0,0,0,0);return i&&r.setUTCFullYear(e),7*s+t-((r.getDay()||7)+3)}function pi(s,e){return s>12?s-=12:s===0&&(s=12),e!=null?s+(e-1):s}function ci(s,e=!1,t=!1,i=!1,r){if(i)return e?"Coordinated Universal Time":"UTC";if(r){const o=s.toLocaleString("en-US",{timeZone:r});return We(s.toLocaleString("en-US",{timeZone:r,timeZoneName:e?"long":"short"}).substr(o.length))}let n=s.toLocaleString("UTC"),a=s.toLocaleString("UTC",{timeZoneName:e?"long":"short"}).substr(n.length);return t===!1&&(a=a.replace(/ (standard|daylight|summer|winter) /i," ")),a}function gi(s){const e=new Date(Date.UTC(2012,0,1,0,0,0,0)),t=new Date(e.toLocaleString("en-US",{timeZone:"UTC"}));return(new Date(e.toLocaleString("en-US",{timeZone:s})).getTime()-t.getTime())/6e4*-1}function _i(s){return s.charAt(0).toUpperCase()+s.slice(1)}function Ve(s){let e,t,i,r=s.h,n=s.s,a=s.l;if(n==0)e=t=i=a;else{let o=function(d,p,u){return u<0&&(u+=1),u>1&&(u-=1),u<.16666666666666666?d+6*(p-d)*u:u<.5?p:u<.6666666666666666?d+(p-d)*(.6666666666666666-u)*6:d},h=a<.5?a*(1+n):a+n-a*n,l=2*a-h;e=o(l,h,r+1/3),t=o(l,h,r),i=o(l,h,r-1/3)}return{r:Math.round(255*e),g:Math.round(255*t),b:Math.round(255*i)}}function Ue(s){let e=s.r/255,t=s.g/255,i=s.b/255,r=Math.max(e,t,i),n=Math.min(e,t,i),a=0,o=0,h=(r+n)/2;if(r===n)a=o=0;else{let l=r-n;switch(o=h>.5?l/(2-r-n):l/(r+n),r){case e:a=(t-i)/l+(t0?255-s:s;return Math.round(t*e)}function mt(s,e){if(s){let t=te(Math.min(Math.max(s.r,s.g,s.b),230),e);return{r:Math.max(0,Math.min(255,Math.round(s.r+t))),g:Math.max(0,Math.min(255,Math.round(s.g+t))),b:Math.max(0,Math.min(255,Math.round(s.b+t))),a:s.a}}return s}function Ee(s){return(299*s.r+587*s.g+114*s.b)/1e3>=128}function ft(s,e){if(s===void 0||e==1)return s;let t=Ue(s);return t.s=e,Ve(t)}function bt(s,e={r:255,g:255,b:255},t={r:255,g:255,b:255}){let i=e,r=t;return Ee(t)&&(i=t,r=e),Ee(s)?r:i}function mi(s,e){return s||(s=[]),[...s,...e].filter((t,i,r)=>r.indexOf(t)===i)}function fi(s,e){return!!e&&s.left==e.left&&s.right==e.right&&s.top==e.top&&s.bottom==e.bottom}function Ke(s){return s[0]==="#"&&(s=s.substr(1)),s.length==3&&(s=s[0].repeat(2)+s[1].repeat(2)+s[2].repeat(2)),parseInt(s,16)}function vt(s){let e=(s=s.replace(/[ ]/g,"")).match(/^rgb\(([0-9]*),([0-9]*),([0-9]*)\)/i);if(e)e.push("1");else if(e=s.match(/^rgba\(([0-9]*),([0-9]*),([0-9]*),([.0-9]*)\)/i),!e)return 0;let t="";for(let i=1;i<=3;i++){let r=parseInt(e[i]).toString(16);r.length==1&&(r="0"+r),t+=r}return Ke(t)}function bi(s){return y.fromAny(s)}class y{constructor(e){Object.defineProperty(this,"_hex",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hex=0|e}get hex(){return this._hex}get r(){return this._hex>>>16}get g(){return this._hex>>8&255}get b(){return 255&this._hex}toCSS(e=1){return"rgba("+this.r+", "+this.g+", "+this.b+", "+e+")"}toCSSHex(){return"#"+ue(this.r.toString(16),2)+ue(this.g.toString(16),2)+ue(this.b.toString(16),2)}toHSL(e=1){return Ue({r:this.r,g:this.g,b:this.b,a:e})}static fromHSL(e,t,i){const r=Ve({h:e,s:t,l:i});return this.fromRGB(r.r,r.g,r.b)}toString(){return this.toCSSHex()}static fromHex(e){return new y(e)}static fromRGB(e,t,i){return new y((0|i)+(t<<8)+(e<<16))}static fromString(e){return new y(Ke(e))}static fromCSS(e){return new y(vt(e))}static fromAny(e){if(Be(e)){if(e[0]=="#")return y.fromString(e);if(e.substr(0,3)=="rgb")return y.fromCSS(e)}else{if(_(e))return y.fromHex(e);if(e instanceof y)return y.fromHex(e.hex)}throw new Error("Unknown color syntax: "+e)}static alternative(e,t,i){const r=bt({r:e.r,g:e.g,b:e.b},t?{r:t.r,g:t.g,b:t.b}:void 0,i?{r:i.r,g:i.g,b:i.b}:void 0);return this.fromRGB(r.r,r.g,r.b)}static interpolate(e,t,i,r="rgb"){if(r=="hsl"){const n=t.toHSL(),a=i.toHSL();return y.fromHSL(M(e,n.h,a.h),M(e,n.s,a.s),M(e,n.l,a.l))}return y.fromRGB(M(e,t.r,i.r),M(e,t.g,i.g),M(e,t.b,i.b))}static lighten(e,t){const i=_t({r:e.r,g:e.g,b:e.b},t);return y.fromRGB(i.r,i.g,i.b)}static brighten(e,t){const i=mt({r:e.r,g:e.g,b:e.b},t);return y.fromRGB(i.r,i.g,i.b)}static saturate(e,t){const i=ft({r:e.r,g:e.g,b:e.b},t);return y.fromRGB(i.r,i.g,i.b)}}function Ce(s){return Z(this,void 0,void 0,function*(){if(s!==void 0){const e=[];w(s,(t,i)=>{e.push(i.waitForStop())}),yield Promise.all(e)}})}function M(s,e,t){return e+s*(t-e)}function yt(s,e,t){return s>=1?t:e}function wt(s,e,t){return new f(M(s,e.percent,t.percent))}function Pt(s,e,t){return y.interpolate(s,e,t)}function Dt(s,e){return typeof s=="number"&&typeof e=="number"?M:s instanceof f&&e instanceof f?wt:s instanceof y&&e instanceof y?Pt:yt}const ze=Math.PI,Ge=ze/180,vi=180/ze;function yi(s,e,t){if(!_(e)||e<=0){let i=Math.round(s);return t&&i-s==.5&&i--,i}{let i=Math.pow(10,e);return Math.round(s*i)/i}}function wi(s,e){if(!_(e)||e<=0)return Math.ceil(s);{let t=Math.pow(10,e);return Math.ceil(s*t)/t}}function Me(s,e,t){return Math.min(Math.max(s,e),t)}function fe(s){return Math.sin(Ge*s)}function be(s){return Math.cos(Ge*s)}function Pi(s){return(s%=360)<0&&(s+=360),s}function Di(s,e,t,i,r){let n=Number.MAX_VALUE,a=Number.MAX_VALUE,o=-Number.MAX_VALUE,h=-Number.MAX_VALUE,l=[];l.push(pe(r,t)),l.push(pe(r,i));let d=Math.min(90*Math.floor(t/90),90*Math.floor(i/90)),p=Math.max(90*Math.ceil(t/90),90*Math.ceil(i/90));for(let u=d;u<=p;u+=90)u>=t&&u<=i&&l.push(pe(r,u));for(let u=0;uo&&(o=c.x),c.y>h&&(h=c.y)}return{left:s+n,top:e+a,right:s+o,bottom:e+h}}function pe(s,e){return{x:s*be(e),y:s*fe(e)}}function xi(s){const e=s.length;if(e>0){let t=s[0],i=t.left,r=t.top,n=t.right,a=t.bottom;if(e>1)for(let o=1;o{this._userSettings[i]=!0})}get(e,t){const i=this._settings[e];return i!==void 0?i:t}setRaw(e,t){this._settings[e]=t}set(e,t){this._userSettings[e]=!0,this.setRaw(e,t)}remove(e){delete this._userSettings[e],delete this._settings[e]}setAll(e){T(e).forEach(t=>{this.set(t,e[t])})}_eachSetting(e){w(this._settings,e)}apply(){const e={stateAnimationEasing:!0,stateAnimationDuration:!0},t=this._entity.states.lookup("default");this._eachSetting((i,r)=>{e[i]||(e[i]=!0,this!==t&&(i in t._settings||(t._settings[i]=this._entity.get(i))),this._entity.set(i,r))})}applyAnimate(e){e==null&&(e=this._settings.stateAnimationDuration),e==null&&(e=this.get("stateAnimationDuration",this._entity.get("stateAnimationDuration",0)));let t=this._settings.stateAnimationEasing;t==null&&(t=this.get("stateAnimationEasing",this._entity.get("stateAnimationEasing",xt)));const i=this._entity.states.lookup("default"),r={stateAnimationEasing:!0,stateAnimationDuration:!0},n={};return this._eachSetting((a,o)=>{if(!r[a]){r[a]=!0,this!=i&&(a in i._settings||(i._settings[a]=this._entity.get(a)));const h=this._entity.animate({key:a,to:o,duration:e,easing:t});h&&(n[a]=h)}}),n}}class Ot{constructor(e){Object.defineProperty(this,"_states",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_entity",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._entity=e}lookup(e){return this._states[e]}create(e,t){const i=this._states[e];if(i)return i.setAll(t),i;{const r=new kt(this._entity,t);return this._states[e]=r,r}}remove(e){delete this._states[e]}apply(e){const t=this._states[e];t&&t.apply(),this._entity._applyState(e)}applyAnimate(e,t){let i;const r=this._states[e];return r&&(i=r.applyAnimate(t)),this._entity._applyStateAnimated(e,t),i}}class Tt{constructor(){Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"5.4.8"}),Object.defineProperty(this,"licenses",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"entitiesById",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"rootElements",{enumerable:!0,configurable:!0,writable:!0,value:[]})}}const L=new Tt;function Oi(s){L.licenses.push(s)}function N(s,e){return s===e?0:s{O(i,t)&&this._entity._markDirtyKey(e)})}remove(e){const t=this._callbacks[e];t!==void 0&&(delete this._callbacks[e],t.length!==0&&this._entity._markDirtyKey(e))}enable(e){this._disabled[e]&&(delete this._disabled[e],this._entity._markDirtyKey(e))}disable(e){this._disabled[e]||(this._disabled[e]=!0,this._entity._markDirtyKey(e))}fold(e,t){if(!this._disabled[e]){const i=this._callbacks[e];if(i!==void 0)for(let r=0,n=i.length;r{if(this._stopped)e();else{const i=()=>{r.dispose(),e()},r=this.events.on("stopped",i)}})}_checkEnded(){return!(this._loops>1)||(--this._loops,!1)}_run(e){this._oldTime!==null&&(this._time+=e-this._oldTime,this._time>this._duration&&(this._time=this._duration)),this._oldTime=e}_reset(e){this._oldTime=e,this._time=0}_value(e){return this._interpolate(this._easing(e),this._from,this._to)}}let jt=0;class Et{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:++jt}),Object.defineProperty(this,"_settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_privateSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_settingEvents",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_privateSettingEvents",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_prevSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_prevPrivateSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_animatingSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_animatingPrivateSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_playingAnimations",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_userProperties",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this._settings=e}_checkDirty(){T(this._settings).forEach(e=>{this._userProperties[e]=!0,this._markDirtyKey(e)})}resetUserSettings(){this._userProperties={}}_runAnimation(e){return!this.isDisposed()&&(w(this._animatingSettings,(t,i)=>{if(i._stopped)this._stopAnimation(t);else if(i._playing){i._run(e);const r=i.percentage;r>=1?i._checkEnded()?this.set(t,i._value(1)):(i._reset(e),this._set(t,i._value(1))):this._set(t,i._value(r))}}),w(this._animatingPrivateSettings,(t,i)=>{if(i._stopped)this._stopAnimationPrivate(t);else if(i._playing){i._run(e);const r=i.percentage;r>=1?i._checkEnded()?this.setPrivate(t,i._value(1)):(i._reset(e),this._setPrivate(t,i._value(1))):this._setPrivate(t,i._value(r))}}),this._playingAnimations!==0)}_markDirtyKey(e){this.markDirty()}_markDirtyPrivateKey(e){this.markDirty()}on(e,t){let i=this._settingEvents[e];return i===void 0&&(i=this._settingEvents[e]=[]),i.push(t),new P(()=>{O(i,t),i.length===0&&delete this._settingEvents[e]})}onPrivate(e,t){let i=this._privateSettingEvents[e];return i===void 0&&(i=this._privateSettingEvents[e]=[]),i.push(t),new P(()=>{O(i,t),i.length===0&&delete this._privateSettingEvents[e]})}getRaw(e,t){const i=this._settings[e];return i!==void 0?i:t}get(e,t){return this.getRaw(e,t)}_sendKeyEvent(e,t){const i=this._settingEvents[e];i!==void 0&&g(i,r=>{r(t,this,e)})}_sendPrivateKeyEvent(e,t){const i=this._privateSettingEvents[e];i!==void 0&&g(i,r=>{r(t,this,e)})}_setRaw(e,t,i){this._prevSettings[e]=t,this._sendKeyEvent(e,i)}setRaw(e,t){const i=this._settings[e];this._settings[e]=t,i!==t&&this._setRaw(e,i,t)}_set(e,t){const i=this._settings[e];this._settings[e]=t,i!==t&&(this._setRaw(e,i,t),this._markDirtyKey(e))}_stopAnimation(e){const t=this._animatingSettings[e];t&&(--this._playingAnimations,delete this._animatingSettings[e],t.stop())}set(e,t){return this._set(e,t),this._stopAnimation(e),t}remove(e){e in this._settings&&(this._prevSettings[e]=this._settings[e],delete this._settings[e],this._sendKeyEvent(e,void 0),this._markDirtyKey(e)),this._stopAnimation(e)}removeAll(){g(T(this._settings),e=>{this.remove(e)})}getPrivate(e,t){const i=this._privateSettings[e];return i!==void 0?i:t}_setPrivateRaw(e,t,i){this._prevPrivateSettings[e]=t,this._sendPrivateKeyEvent(e,i)}setPrivateRaw(e,t){const i=this._privateSettings[e];this._privateSettings[e]=t,i!==t&&this._setPrivateRaw(e,i,t)}_setPrivate(e,t){const i=this._privateSettings[e];this._privateSettings[e]=t,i!==t&&(this._setPrivateRaw(e,i,t),this._markDirtyPrivateKey(e))}_stopAnimationPrivate(e){const t=this._animatingPrivateSettings[e];t&&(--this._playingAnimations,t.stop(),delete this._animatingPrivateSettings[e])}setPrivate(e,t){return this._setPrivate(e,t),this._stopAnimationPrivate(e),t}removePrivate(e){e in this._privateSettings&&(this._prevPrivateSettings[e]=this._privateSettings[e],delete this._privateSettings[e],this._markDirtyPrivateKey(e)),this._stopAnimationPrivate(e)}setAll(e){w(e,(t,i)=>{this.set(t,i)})}animate(e){const t=e.key,i=e.to,r=e.duration||0,n=e.loops||1,a=e.from===void 0?this.get(t):e.from,o=e.easing===void 0?Ae:e.easing;if(r===0)this.set(t,i);else{if(a!==void 0&&a!==i){this.set(t,a);const l=this._animatingSettings[t]=new Q(this,a,i,r,o,n,this._animationTime());return++this._playingAnimations,this._startAnimation(),l}this.set(t,i)}const h=new Q(this,a,i,r,o,n,null);return h.stop(),h}animatePrivate(e){const t=e.key,i=e.to,r=e.duration||0,n=e.loops||1,a=e.from===void 0?this.getPrivate(t):e.from,o=e.easing===void 0?Ae:e.easing;if(r===0)this.setPrivate(t,i);else{if(a!==void 0&&a!==i){this.setPrivate(t,a);const l=this._animatingPrivateSettings[t]=new Q(this,a,i,r,o,n,this._animationTime());return++this._playingAnimations,this._startAnimation(),l}this.setPrivate(t,i)}const h=new Q(this,a,i,r,o,n,null);return h.stop(),h}_dispose(){}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this._dispose())}}class A extends Et{constructor(e,t,i,r=[]){if(super(t),Object.defineProperty(this,"_root",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_user_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"states",{enumerable:!0,configurable:!0,writable:!0,value:new Ot(this)}),Object.defineProperty(this,"adapters",{enumerable:!0,configurable:!0,writable:!0,value:new St(this)}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:this._createEvents()}),Object.defineProperty(this,"_userPrivateProperties",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dirty",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dirtyPrivate",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_templates",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_internalTemplates",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultThemes",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_templateDisposers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_disposers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_runSetup",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_disposerProperties",{enumerable:!0,configurable:!0,writable:!0,value:{}}),!i)throw new Error("You cannot use `new Class()`, instead use `Class.new()`");this._root=e,this._internalTemplates=r,t.id&&this._registerId(t.id)}static new(e,t,i){const r=new this(e,t,!0);return r._template=i,r._afterNew(),r}static _new(e,t,i=[]){const r=new this(e,t,!0,i);return r._afterNew(),r}_afterNew(){this._checkDirty();let e=!1;const t=this._template;t&&(e=!0,t._setObjectTemplate(this)),g(this._internalTemplates,i=>{e=!0,i._setObjectTemplate(this)}),e&&this._applyTemplates(!1),this.states.create("default",{}),this._setDefaults()}_afterNewApplyThemes(){this._checkDirty();const e=this._template;e&&e._setObjectTemplate(this),g(this._internalTemplates,t=>{t._setObjectTemplate(this)}),this.states.create("default",{}),this._setDefaults(),this._applyThemes()}_createEvents(){return new $}get classNames(){return this.constructor.classNames}get className(){return this.constructor.className}_setDefaults(){}_setDefault(e,t){e in this._settings||super.set(e,t)}_setRawDefault(e,t){e in this._settings||super.setRaw(e,t)}_clearDirty(){T(this._dirty).forEach(e=>{this._dirty[e]=!1}),T(this._dirtyPrivate).forEach(e=>{this._dirtyPrivate[e]=!1})}isDirty(e){return!!this._dirty[e]}isPrivateDirty(e){return!!this._dirtyPrivate[e]}_markDirtyKey(e){this._dirty[e]=!0,super._markDirtyKey(e)}_markDirtyPrivateKey(e){this._dirtyPrivate[e]=!0,super._markDirtyKey(e)}isType(e){return this.classNames.indexOf(e)!==-1}_pushPropertyDisposer(e,t){let i=this._disposerProperties[e];return i===void 0&&(i=this._disposerProperties[e]=[]),i.push(t),t}_disposeProperty(e){const t=this._disposerProperties[e];t!==void 0&&(g(t,i=>{i.dispose()}),delete this._disposerProperties[e])}set template(e){const t=this._template;t!==e&&(this._template=e,t&&t._removeObjectTemplate(this),e&&e._setObjectTemplate(this),this._applyTemplates())}get template(){return this._template}markDirty(){this._root._addDirtyEntity(this)}_startAnimation(){this._root._addAnimation(this)}_animationTime(){return this._root.animationTime}_applyState(e){}_applyStateAnimated(e,t){}get(e,t){const i=this.adapters.fold(e,this._settings[e]);return i!==void 0?i:t}isUserSetting(e){return this._userProperties[e]||!1}set(e,t){return this._userProperties[e]=!0,super.set(e,t)}setRaw(e,t){this._userProperties[e]=!0,super.setRaw(e,t)}_setSoft(e,t){return this._userProperties[e]?t:super.set(e,t)}remove(e){delete this._userProperties[e],this._removeTemplateProperty(e)}setPrivate(e,t){return this._userPrivateProperties[e]=!0,super.setPrivate(e,t)}setPrivateRaw(e,t){this._userPrivateProperties[e]=!0,super.setPrivateRaw(e,t)}removePrivate(e){delete this._userPrivateProperties[e],this._removeTemplatePrivateProperty(e)}_setTemplateProperty(e,t,i){this._userProperties[t]||e===this._findTemplateByKey(t)&&super.set(t,i)}_setTemplatePrivateProperty(e,t,i){this._userPrivateProperties[t]||e===this._findTemplateByPrivateKey(t)&&super.setPrivate(t,i)}_removeTemplateProperty(e){if(!this._userProperties[e]){const t=this._findTemplateByKey(e);t?super.set(e,t._settings[e]):super.remove(e)}}_removeTemplatePrivateProperty(e){if(!this._userPrivateProperties[e]){const t=this._findTemplateByPrivateKey(e);t?super.setPrivate(e,t._privateSettings[e]):super.removePrivate(e)}}_walkParents(e){e(this._root._rootContainer),e(this)}_applyStateByKey(e){const t=this.states.create(e,{}),i={};this._eachTemplate(r=>{const n=r.states.lookup(e);n&&n._apply(t,i)}),w(t._settings,r=>{i[r]||t._userSettings[r]||t.remove(r)})}_applyTemplate(e,t){this._templateDisposers.push(e._apply(this,t)),w(e._settings,(i,r)=>{t.settings[i]||this._userProperties[i]||(t.settings[i]=!0,super.set(i,r))}),w(e._privateSettings,(i,r)=>{t.privateSettings[i]||this._userPrivateProperties[i]||(t.privateSettings[i]=!0,super.setPrivate(i,r))}),this._runSetup&&e.setup&&(this._runSetup=!1,e.setup(this))}_findStaticTemplate(e){if(this._template&&e(this._template))return this._template}_eachTemplate(e){this._findStaticTemplate(t=>(e(t),!1)),F(this._internalTemplates,e),g(this._templates,e)}_applyTemplates(e=!0){e&&this._disposeTemplates();const t={settings:{},privateSettings:{},states:{}};this._eachTemplate(i=>{this._applyTemplate(i,t)}),e&&(w(this._settings,i=>{this._userProperties[i]||t.settings[i]||super.remove(i)}),w(this._privateSettings,i=>{this._userPrivateProperties[i]||t.privateSettings[i]||super.removePrivate(i)}))}_findTemplate(e){const t=this._findStaticTemplate(e);if(t===void 0){const i=Ze(this._internalTemplates,e);return i===void 0?Qe(this._templates,e):i}return t}_findTemplateByKey(e){return this._findTemplate(t=>e in t._settings)}_findTemplateByPrivateKey(e){return this._findTemplate(t=>e in t._privateSettings)}_disposeTemplates(){g(this._templateDisposers,e=>{e.dispose()}),this._templateDisposers.length=0}_removeTemplates(){g(this._templates,e=>{e._removeObjectTemplate(this)}),this._templates.length=0}_applyThemes(){let e=!1;const t=[];let i=[];const r=new Set,n=this.get("themeTagsSelf");return n&&g(n,a=>{r.add(a)}),this._walkParents(a=>{a===this._root._rootContainer&&(e=!0),a._defaultThemes.length>0&&t.push(a._defaultThemes);const o=a.get("themes");o&&i.push(o);const h=a.get("themeTags");h&&g(h,l=>{r.add(l)})}),i=t.concat(i),this._removeTemplates(),e&&F(this.classNames,a=>{const o=[];g(i,h=>{g(h,l=>{const d=l._lookupRules(a);d&&F(d,p=>{if(p.tags.every(u=>r.has(u))){const u=tt(o,c=>{const m=N(p.tags.length,c.tags.length);return m===0?Ye(p.tags,c.tags,N):m});o.splice(u.index,0,p)}})})}),g(o,h=>{this._templates.push(h.template),h.template._setObjectTemplate(this)})}),this._applyTemplates(),e&&(this._runSetup=!1),e}_changed(){}_beforeChanged(){if(this.isDirty("id")){const e=this.get("id");e&&this._registerId(e);const t=this._prevSettings.id;t&&delete L.entitiesById[t]}}_registerId(e){if(L.entitiesById[e]&&L.entitiesById[e]!==this)throw new Error('An entity with id "'+e+'" already exists.');L.entitiesById[e]=this}_afterChanged(){}addDisposer(e){return this._disposers.push(e),e}_dispose(){super._dispose();const e=this._template;e&&e._removeObjectTemplate(this),g(this._internalTemplates,i=>{i._removeObjectTemplate(this)}),this._removeTemplates(),this._disposeTemplates(),this.events.dispose(),this._disposers.forEach(i=>{i.dispose()}),w(this._disposerProperties,(i,r)=>{g(r,n=>{n.dispose()})});const t=this.get("id");t&&delete L.entitiesById[t]}setTimeout(e,t){const i=setTimeout(()=>{this.removeDispose(r),e()},t),r=new P(()=>{clearTimeout(i)});return this._disposers.push(r),r}removeDispose(e){if(!this.isDisposed()){let t=se(this._disposers,e);t>-1&&this._disposers.splice(t,1)}e.dispose()}hasTag(e){return se(this.get("themeTags",[]),e)!==-1}addTag(e){if(!this.hasTag(e)){const t=this.get("themeTags",[]);t.push(e),this.set("themeTags",t)}}removeTag(e){if(this.hasTag(e)){const t=this.get("themeTags",[]);He(t,e),this.set("themeTags",t)}}_t(e,t,...i){return this._root.language.translate(e,t,...i)}get root(){return this._root}}Object.defineProperty(A,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Entity"}),Object.defineProperty(A,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:["Entity"]});class Ct{constructor(e,t,i){Object.defineProperty(this,"_settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._name=e,this._template=t,this._settings=i}get(e,t){const i=this._settings[e];return i!==void 0?i:t}set(e,t){this._settings[e]=t,this._template._stateChanged(this._name)}remove(e){delete this._settings[e],this._template._stateChanged(this._name)}setAll(e){T(e).forEach(t=>{this._settings[t]=e[t]}),this._template._stateChanged(this._name)}_apply(e,t){w(this._settings,(i,r)=>{t[i]||e._userSettings[i]||(t[i]=!0,e.setRaw(i,r))})}}class Mt{constructor(e){Object.defineProperty(this,"_template",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_states",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this._template=e}lookup(e){return this._states[e]}create(e,t){const i=this._states[e];if(i)return i.setAll(t),i;{const r=new Ct(e,this._template,t);return this._states[e]=r,this._template._stateChanged(e),r}}remove(e){delete this._states[e],this._template._stateChanged(e)}_apply(e,t){w(this._states,(i,r)=>{let n=t.states[i];n==null&&(n=t.states[i]={});const a=e.states.create(i,{});r._apply(a,n)})}}class At{constructor(){Object.defineProperty(this,"_callbacks",{enumerable:!0,configurable:!0,writable:!0,value:{}})}add(e,t){let i=this._callbacks[e];return i===void 0&&(i=this._callbacks[e]=[]),i.push(t),new P(()=>{O(i,t),i.length===0&&delete this._callbacks[e]})}remove(e){this._callbacks[e]!==void 0&&delete this._callbacks[e]}_apply(e){const t=[];return w(this._callbacks,(i,r)=>{g(r,n=>{t.push(e.adapters.add(i,n))})}),new k(t)}}class X{constructor(e,t){if(Object.defineProperty(this,"_settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_privateSettings",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_settingEvents",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_privateSettingEvents",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_entities",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"states",{enumerable:!0,configurable:!0,writable:!0,value:new Mt(this)}),Object.defineProperty(this,"adapters",{enumerable:!0,configurable:!0,writable:!0,value:new At}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new $}),Object.defineProperty(this,"setup",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!t)throw new Error("You cannot use `new Class()`, instead use `Class.new()`");this._settings=e}static new(e){return new X(e,!0)}get entities(){return this._entities}get(e,t){const i=this._settings[e];return i!==void 0?i:t}setRaw(e,t){this._settings[e]=t}set(e,t){this._settings[e]!==t&&(this.setRaw(e,t),this._entities.forEach(i=>{i._setTemplateProperty(this,e,t)}))}remove(e){e in this._settings&&(delete this._settings[e],this._entities.forEach(t=>{t._removeTemplateProperty(e)}))}removeAll(){w(this._settings,(e,t)=>{this.remove(e)})}getPrivate(e,t){const i=this._privateSettings[e];return i!==void 0?i:t}setPrivateRaw(e,t){return this._privateSettings[e]=t,t}setPrivate(e,t){return this._privateSettings[e]!==t&&(this.setPrivateRaw(e,t),this._entities.forEach(i=>{i._setTemplatePrivateProperty(this,e,t)})),t}removePrivate(e){e in this._privateSettings&&(delete this._privateSettings[e],this._entities.forEach(t=>{t._removeTemplatePrivateProperty(e)}))}setAll(e){w(e,(t,i)=>{this.set(t,i)})}on(e,t){let i=this._settingEvents[e];return i===void 0&&(i=this._settingEvents[e]=[]),i.push(t),new P(()=>{O(i,t),i.length===0&&delete this._settingEvents[e]})}onPrivate(e,t){let i=this._privateSettingEvents[e];return i===void 0&&(i=this._privateSettingEvents[e]=[]),i.push(t),new P(()=>{O(i,t),i.length===0&&delete this._privateSettingEvents[e]})}_apply(e,t){const i=[];return w(this._settingEvents,(r,n)=>{g(n,a=>{i.push(e.on(r,a))})}),w(this._privateSettingEvents,(r,n)=>{g(n,a=>{i.push(e.onPrivate(r,a))})}),this.states._apply(e,t),i.push(this.adapters._apply(e)),i.push(e.events.copyFrom(this.events)),new k(i)}_setObjectTemplate(e){this._entities.push(e)}_removeObjectTemplate(e){He(this._entities,e)}_stateChanged(e){this._entities.forEach(t=>{t._applyStateByKey(e)})}}class re extends ${constructor(e){super(),Object.defineProperty(this,"_sprite",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rendererDisposers",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dispatchParents",{enumerable:!0,configurable:!0,writable:!0,value:!0}),this._sprite=e}_makePointerEvent(e,t){return{type:e,originalEvent:t.event,point:t.point,simulated:t.simulated,native:t.native,target:this._sprite}}_onRenderer(e,t){this._sprite.set("interactive",!0),this._sprite._display.interactive=!0;let i=this._rendererDisposers[e];if(i===void 0){const r=this._sprite._display.on(e,n=>{t.call(this,n)});i=this._rendererDisposers[e]=new it(()=>{delete this._rendererDisposers[e],r.dispose()})}return i.increment()}_on(e,t,i,r,n,a){const o=super._on(e,t,i,r,n,a),h=re.RENDERER_EVENTS[t];return h!==void 0&&(o.disposer=new k([o.disposer,this._onRenderer(t,h)])),o}stopParentDispatch(){this._dispatchParents=!1}dispatchParents(e,t){const i=this._dispatchParents;this._dispatchParents=!0;try{this.dispatch(e,t),this._dispatchParents&&this._sprite.parent&&this._sprite.parent.events.dispatchParents(e,t)}finally{this._dispatchParents=i}}}Object.defineProperty(re,"RENDERER_EVENTS",{enumerable:!0,configurable:!0,writable:!0,value:{click:function(s){this.isEnabled("click")&&!this._sprite.isDragging()&&this._sprite._hasDown()&&!this._sprite._hasMoved(this._makePointerEvent("click",s))&&this.dispatch("click",this._makePointerEvent("click",s))},rightclick:function(s){this.isEnabled("rightclick")&&this.dispatch("rightclick",this._makePointerEvent("rightclick",s))},middleclick:function(s){this.isEnabled("middleclick")&&this.dispatch("middleclick",this._makePointerEvent("middleclick",s))},dblclick:function(s){this.dispatchParents("dblclick",this._makePointerEvent("dblclick",s))},pointerover:function(s){this.isEnabled("pointerover")&&this.dispatch("pointerover",this._makePointerEvent("pointerover",s))},pointerout:function(s){this.isEnabled("pointerout")&&this.dispatch("pointerout",this._makePointerEvent("pointerout",s))},pointerdown:function(s){this.dispatchParents("pointerdown",this._makePointerEvent("pointerdown",s))},pointerup:function(s){this.isEnabled("pointerup")&&this.dispatch("pointerup",this._makePointerEvent("pointerup",s))},globalpointerup:function(s){this.isEnabled("globalpointerup")&&this.dispatch("globalpointerup",this._makePointerEvent("globalpointerup",s))},globalpointermove:function(s){this.isEnabled("globalpointermove")&&this.dispatch("globalpointermove",this._makePointerEvent("globalpointermove",s))},wheel:function(s){this.dispatchParents("wheel",{type:"wheel",target:this._sprite,originalEvent:s.event,point:s.point})}}});class D extends A{constructor(){super(...arguments),Object.defineProperty(this,"_adjustedLocalBounds",{enumerable:!0,configurable:!0,writable:!0,value:{left:0,right:0,top:0,bottom:0}}),Object.defineProperty(this,"_localBounds",{enumerable:!0,configurable:!0,writable:!0,value:{left:0,right:0,top:0,bottom:0}}),Object.defineProperty(this,"_parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dataItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_templateField",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_sizeDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDragging",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dragEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dragPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isHidden",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isShowing",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isHiding",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_downPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_downPoints",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_toggleDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dragDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_hoverDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_focusDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipMoveDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipPointerDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_statesHandled",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_afterNew(){this.setPrivateRaw("visible",!0),super._afterNew()}_markDirtyKey(e){super._markDirtyKey(e),e!="x"&&e!="y"&&e!="dx"&&e!="dy"||(this.markDirtyBounds(),this._addPercentagePositionChildren(),this.markDirtyPosition())}_markDirtyPrivateKey(e){super._markDirtyPrivateKey(e),e!="x"&&e!="y"||this.markDirtyPosition()}_removeTemplateField(){this._templateField&&this._templateField._removeObjectTemplate(this)}_createEvents(){return new re(this)}_processTemplateField(){let e;const t=this.get("templateField");if(t){const i=this.dataItem;if(i){const r=i.dataContext;r&&(e=r[t],e instanceof X||!e||(e=X.new(e)))}}this._templateField!==e&&(this._removeTemplateField(),this._templateField=e,e&&e._setObjectTemplate(this),this._applyTemplates())}_setDataItem(e){const t=this._dataItem;this._dataItem=e,this._processTemplateField();const i="dataitemchanged";e!=t&&this.events.isEnabled(i)&&this.events.dispatch(i,{type:i,target:this,oldDataItem:t,newDataItem:e})}set dataItem(e){this._setDataItem(e)}get dataItem(){if(this._dataItem)return this._dataItem;{let e=this._parent;for(;e;){if(e._dataItem)return e._dataItem;e=e._parent}}}_addPercentageSizeChildren(){let e=this.parent;e&&(this.get("width")instanceof f||this.get("height")instanceof f?Te(e._percentageSizeChildren,this):O(e._percentageSizeChildren,this))}_addPercentagePositionChildren(){let e=this.parent;e&&(this.get("x")instanceof f||this.get("y")instanceof f?Te(e._percentagePositionChildren,this):O(e._percentagePositionChildren,this))}markDirtyPosition(){this._root._addDirtyPosition(this)}updatePivotPoint(){const e=this._localBounds;if(e){const t=this.get("centerX");t!=null&&(this._display.pivot.x=e.left+C(t,e.right-e.left));const i=this.get("centerY");i!=null&&(this._display.pivot.y=e.top+C(i,e.bottom-e.top))}}_beforeChanged(){if(super._beforeChanged(),this._handleStates(),this.isDirty("tooltip")){const e=this._prevSettings.tooltip;e&&e.dispose()}if((this.isDirty("layer")||this.isDirty("layerMargin"))&&(this._display.setLayer(this.get("layer"),this.get("layerMargin")),this.markDirtyLayer()),this.isDirty("tooltipPosition")){const e=this._tooltipMoveDp;e&&(e.dispose(),this._tooltipMoveDp=void 0);const t=this._tooltipPointerDp;t&&(t.dispose(),this._tooltipPointerDp=void 0),this.get("tooltipPosition")=="pointer"&&(this.isHover()&&(this._tooltipMoveDp=this.events.on("globalpointermove",i=>{this.showTooltip(i.point)})),this._tooltipPointerDp=new k([this.events.on("pointerover",()=>{this._tooltipMoveDp=this.events.on("globalpointermove",i=>{this.showTooltip(i.point)})}),this.events.on("pointerout",()=>{const i=this._tooltipMoveDp;i&&(i.dispose(),this._tooltipMoveDp=void 0)})]))}}_handleStates(){this._statesHandled||(this.isDirty("active")&&(this.get("active")?(this.states.applyAnimate("active"),this.set("ariaChecked",!0)):(this.isHidden()||this.states.applyAnimate("default"),this.set("ariaChecked",!1)),this.markDirtyAccessibility()),this.isDirty("disabled")&&(this.get("disabled")?(this.states.applyAnimate("disabled"),this.set("ariaChecked",!1)):(this.isHidden()||this.states.applyAnimate("default"),this.set("ariaChecked",!0)),this.markDirtyAccessibility()),this._statesHandled=!0)}_changed(){super._changed();const e=this._display,t=this.events;if(this.isDirty("draggable")){const i=this.get("draggable");i?(this.set("interactive",!0),this._dragDp=new k([t.on("pointerdown",r=>{this.dragStart(r)}),t.on("globalpointermove",r=>{this.dragMove(r)}),t.on("globalpointerup",r=>{this.dragStop(r)})])):this._dragDp&&(this._dragDp.dispose(),this._dragDp=void 0),e.cancelTouch=!!i}if(this.isDirty("tooltipText")||this.isDirty("tooltipHTML")||this.isDirty("showTooltipOn")){const i=this.get("tooltipText"),r=this.get("tooltipHTML"),n=this.get("showTooltipOn","hover");this._tooltipDp&&(this._tooltipDp.dispose(),this._tooltipDp=void 0),(i||r)&&(n=="click"?(this._tooltipDp=new k([t.on("click",()=>{this.setTimeout(()=>this.showTooltip(),10)}),Fe(document,"click",a=>{this.hideTooltip()})]),this._disposers.push(this._tooltipDp)):n=="always"||(this._tooltipDp=new k([t.on("pointerover",()=>{this.showTooltip()}),t.on("pointerout",()=>{this.hideTooltip()})]),this._disposers.push(this._tooltipDp)))}if(this.isDirty("toggleKey")){let i=this.get("toggleKey");i&&i!="none"?this._toggleDp=t.on("click",()=>{this._isDragging||this.set(i,!this.get(i))}):this._toggleDp&&(this._toggleDp.dispose(),this._toggleDp=void 0)}if(this.isDirty("opacity")&&(e.alpha=Math.max(0,this.get("opacity",1))),this.isDirty("rotation")&&(this.markDirtyBounds(),e.angle=this.get("rotation",0)),this.isDirty("scale")&&(this.markDirtyBounds(),e.scale=this.get("scale",0)),(this.isDirty("centerX")||this.isDirty("centerY"))&&(this.markDirtyBounds(),this.updatePivotPoint()),(this.isDirty("visible")||this.isPrivateDirty("visible")||this.isDirty("forceHidden"))&&(this.get("visible")&&this.getPrivate("visible")&&!this.get("forceHidden")?e.visible=!0:(e.visible=!1,this.hideTooltip()),this.markDirtyBounds(),this.get("focusable")&&this.markDirtyAccessibility()),this.isDirty("width")||this.isDirty("height")){this.markDirtyBounds(),this._addPercentageSizeChildren();const i=this.parent;i&&(this.isDirty("width")&&this.get("width")instanceof f||this.isDirty("height")&&this.get("height")instanceof f)&&(i.markDirty(),i._prevWidth=0),this._sizeDirty=!0}if((this.isDirty("maxWidth")||this.isDirty("maxHeight")||this.isPrivateDirty("width")||this.isPrivateDirty("height")||this.isDirty("minWidth")||this.isDirty("minHeight")||this.isPrivateDirty("maxWidth")||this.isPrivateDirty("maxHeight")||this.isPrivateDirty("minWidth")||this.isPrivateDirty("minHeight"))&&(this.markDirtyBounds(),this._sizeDirty=!0),this._sizeDirty&&this._updateSize(),this.isDirty("wheelable")){const i=this.get("wheelable");i&&this.set("interactive",!0),e.wheelable=!!i}if((this.isDirty("tabindexOrder")||this.isDirty("focusableGroup"))&&(this.get("focusable")?this._root._registerTabindexOrder(this):this._root._unregisterTabindexOrder(this)),this.isDirty("filter")&&(e.filter=this.get("filter")),this.isDirty("cursorOverStyle")&&(e.cursorOverStyle=this.get("cursorOverStyle")),this.isDirty("hoverOnFocus")&&(this.get("hoverOnFocus")?this._focusDp=new k([t.on("focus",()=>{this.showTooltip()}),t.on("blur",()=>{this.hideTooltip()})]):this._focusDp&&(this._focusDp.dispose(),this._focusDp=void 0)),this.isDirty("focusable")&&(this.get("focusable")?this._root._registerTabindexOrder(this):this._root._unregisterTabindexOrder(this),this.markDirtyAccessibility()),this.isPrivateDirty("focusable")&&this.markDirtyAccessibility(),(this.isDirty("role")||this.isDirty("ariaLive")||this.isDirty("ariaChecked")||this.isDirty("ariaHidden")||this.isDirty("ariaOrientation")||this.isDirty("ariaValueNow")||this.isDirty("ariaValueMin")||this.isDirty("ariaValueMax")||this.isDirty("ariaValueText")||this.isDirty("ariaLabel")||this.isDirty("ariaControls"))&&this.markDirtyAccessibility(),this.isDirty("exportable")&&(e.exportable=this.get("exportable")),this.isDirty("interactive")){const i=this.events;this.get("interactive")?this._hoverDp=new k([i.on("click",r=>{Se(r.originalEvent)&&(this.getPrivate("touchHovering")||this.setTimeout(()=>{this._handleOver(),(this.get("tooltipText")||this.get("tooltipHTML"))&&this.showTooltip(),this.setPrivateRaw("touchHovering",!0),this.events.dispatch("pointerover",{type:"pointerover",target:r.target,originalEvent:r.originalEvent,point:r.point,simulated:r.simulated})},10))}),i.on("globalpointerup",r=>{Se(r.originalEvent)&&this.getPrivate("touchHovering")&&(this._handleOut(),(this.get("tooltipText")||this.get("tooltipHTML"))&&this.hideTooltip(),this.setPrivateRaw("touchHovering",!1),this.events.dispatch("pointerout",{type:"pointerout",target:r.target,originalEvent:r.originalEvent,point:r.point,simulated:r.simulated})),this._isDown&&this._handleUp(r)}),i.on("pointerover",()=>{this._handleOver()}),i.on("pointerout",()=>{this._handleOut()}),i.on("pointerdown",r=>{this._handleDown(r)})]):(this._display.interactive=!1,this._hoverDp&&(this._hoverDp.dispose(),this._hoverDp=void 0))}this.isDirty("forceInactive")&&(this._display.inactive=this.get("forceInactive",!1)),this.get("showTooltipOn")=="always"&&this._display.visible&&this.showTooltip()}dragStart(e){this._dragEvent=e,this.events.stopParentDispatch()}dragStop(e){if(this._dragEvent=void 0,this._dragPoint=void 0,this.events.stopParentDispatch(),this._isDragging){this._isDragging=!1;const t="dragstop";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this,originalEvent:e.originalEvent,point:e.point,simulated:e.simulated})}}_handleOver(){this.isHidden()||(this.get("active")&&this.states.lookup("hoverActive")?this.states.applyAnimate("hoverActive"):this.get("disabled")&&this.states.lookup("hoverDisabled")?this.states.applyAnimate("hoverDisabled"):this.states.applyAnimate("hover"),this.get("draggable")&&this._isDown&&this.states.lookup("down")&&this.states.applyAnimate("down"))}_handleOut(){this.isHidden()||(this.get("active")&&this.states.lookup("active")?this.states.applyAnimate("active"):this.get("disabled")&&this.states.lookup("disabled")?this.states.applyAnimate("disabled"):(this.states.lookup("hover")||this.states.lookup("hoverActive"))&&this.states.applyAnimate("default"),this.get("draggable")&&this._isDown&&this.states.lookup("down")&&this.states.applyAnimate("down"))}_handleUp(e){if(!this.isHidden()){this.get("active")&&this.states.lookup("active")?this.states.applyAnimate("active"):this.get("disabled")&&this.states.lookup("disabled")?this.states.applyAnimate("disabled"):this.states.lookup("down")&&(this.isHover()?this.states.applyAnimate("hover"):this.states.applyAnimate("default")),this._downPoint=void 0;const t=de(e.originalEvent);delete this._downPoints[t],T(this._downPoints).length==0&&(this._isDown=!1)}}_hasMoved(e){const t=de(e.originalEvent),i=this._downPoints[t];if(i){const r=Math.abs(i.x-e.point.x),n=Math.abs(i.y-e.point.y);return r>5||n>5}return!1}_hasDown(){return T(this._downPoints).length>0}_handleDown(e){const t=this.parent;if(t&&!this.get("draggable")&&t._handleDown(e),this.get("interactive")&&!this.isHidden()){this.states.lookup("down")&&this.states.applyAnimate("down"),this._downPoint={x:e.point.x,y:e.point.y},this._isDown=!0;const i=de(e.originalEvent);this._downPoints[i]={x:e.point.x,y:e.point.y}}}dragMove(e){let t=this._dragEvent;if(t){if(t.simulated&&!e.simulated)return!0;let i=0,r=this.parent;for(;r!=null;)i+=r.get("rotation",0),r=r.parent;let n=e.point.x-t.point.x,a=e.point.y-t.point.y;const o=this.events;if(t.simulated&&!this._isDragging){this._isDragging=!0,this._dragEvent=e,this._dragPoint={x:this.x(),y:this.y()};const h="dragstart";o.isEnabled(h)&&o.dispatch(h,{type:h,target:this,originalEvent:e.originalEvent,point:e.point,simulated:e.simulated})}if(this._isDragging){let h=this._dragPoint;this.set("x",h.x+n*be(i)+a*fe(i)),this.set("y",h.y+a*be(i)-n*fe(i));const l="dragged";o.isEnabled(l)&&o.dispatch(l,{type:l,target:this,originalEvent:e.originalEvent,point:e.point,simulated:e.simulated})}else if(Math.hypot(n,a)>5){this._isDragging=!0,this._dragEvent=e,this._dragPoint={x:this.x(),y:this.y()};const h="dragstart";o.isEnabled(h)&&o.dispatch(h,{type:h,target:this,originalEvent:e.originalEvent,point:e.point,simulated:e.simulated})}}}_updateSize(){}_getBounds(){this._localBounds=this._display.getLocalBounds()}depth(){let e=this.parent,t=0;for(;;){if(!e)return t;++t,e=e.parent}}markDirtySize(){this._sizeDirty=!0,this.markDirty()}markDirtyBounds(){const e=this._display;if(this.get("isMeasured")){this._root._addDirtyBounds(this),e.isMeasured=!0,e.invalidateBounds();const t=this.parent;t&&this.get("position")!="absolute"&&(t.get("width")==null||t.get("height")==null||t.get("layout"))&&t.markDirtyBounds(),this.get("focusable")&&this.isFocus()&&this.markDirtyAccessibility()}}markDirtyAccessibility(){this._root._invalidateAccessibility(this)}markDirtyLayer(){this._display.markDirtyLayer(!0)}markDirty(){super.markDirty(),this.markDirtyLayer()}_updateBounds(){const e=this._adjustedLocalBounds;let t;if(this.get("visible")&&this.getPrivate("visible")&&!this.get("forceHidden")?(this._getBounds(),this._fixMinBounds(this._localBounds),this.updatePivotPoint(),this._adjustedLocalBounds=this._display.getAdjustedBounds(this._localBounds),t=this._adjustedLocalBounds):(t={left:0,right:0,top:0,bottom:0},this._localBounds=t,this._adjustedLocalBounds=t),!e||e.left!==t.left||e.top!==t.top||e.right!==t.right||e.bottom!==t.bottom){const i="boundschanged";this.events.isEnabled(i)&&this.events.dispatch(i,{type:i,target:this}),this.parent&&(this.parent.markDirty(),this.parent.markDirtyBounds())}}_fixMinBounds(e){let t=this.get("minWidth",this.getPrivate("minWidth")),i=this.get("minHeight",this.getPrivate("minHeight"));_(t)&&e.right-e.left0?e.right=e.left+r:e.left=e.right+r),_(n)&&(n>0?e.bottom=e.top+n:e.top=e.bottom+n)}_removeParent(e){e&&(e.children.removeValue(this),O(e._percentageSizeChildren,this),O(e._percentagePositionChildren,this))}_clearDirty(){super._clearDirty(),this._sizeDirty=!1,this._statesHandled=!1}hover(){this.showTooltip(),this._handleOver()}unhover(){this.hideTooltip(),this._handleOut()}showTooltip(e){const t=this.getTooltip(),i=this.get("tooltipText"),r=this.get("tooltipHTML");if((i||r)&&t){const n=this.get("tooltipPosition"),a=this.getPrivate("tooltipTarget",this);n!="fixed"&&e||(this._display._setMatrix(),e=this.toGlobal(a._getTooltipPoint())),t.set("pointTo",e),t.set("tooltipTarget",a),t.get("x")||t.set("x",e.x),t.get("y")||t.set("y",e.y),i&&t.label.set("text",i),r&&t.label.set("html",r);const o=this.dataItem;if(o&&t.label._setDataItem(o),this.get("showTooltipOn")=="always"&&(e.x<0||e.x>this._root.width()||e.y<0||e.y>this._root.height()))return void this.hideTooltip();t.label.text.markDirtyText();const h=t.show();return this.setPrivateRaw("showingTooltip",!0),h}}hideTooltip(){const e=this.getTooltip();if(e&&(e.get("tooltipTarget")==this.getPrivate("tooltipTarget",this)||this.get("tooltip")==e)){let t=e.get("keepTargetHover")&&e.get("stateAnimationDuration",0)==0?400:void 0;const i=e.hide(t);return this.setPrivateRaw("showingTooltip",!1),i}}_getTooltipPoint(){const e=this._localBounds;if(e){let t=0,i=0;return this.get("isMeasured")?(t=e.left+C(this.get("tooltipX",0),e.right-e.left),i=e.top+C(this.get("tooltipY",0),e.bottom-e.top)):(t=C(this.get("tooltipX",0),this.width()),i=C(this.get("tooltipY",0),this.height())),{x:t,y:i}}return{x:0,y:0}}getTooltip(){let e=this.get("tooltip");if(e)return e;{let t=this.parent;if(t)return t.getTooltip()}}_updatePosition(){const e=this.parent;let t=this.get("dx",0),i=this.get("dy",0),r=this.get("x"),n=this.getPrivate("x"),a=0,o=0;const h=this.get("position");r instanceof f&&(r=e?e.innerWidth()*r.value+e.get("paddingLeft",0):0),_(r)?a=r+t:n!=null?a=n:e&&h=="relative"&&(a=e.get("paddingLeft",0)+t);let l=this.get("y"),d=this.getPrivate("y");l instanceof f&&(l=e?e.innerHeight()*l.value+e.get("paddingTop",0):0),_(l)?o=l+i:d!=null?o=d:e&&h=="relative"&&(o=e.get("paddingTop",0)+i);const p=this._display;if(p.x!=a||p.y!=o){p.invalidateBounds(),p.x=a,p.y=o;const u="positionchanged";this.events.isEnabled(u)&&this.events.dispatch(u,{type:u,target:this})}this.getPrivate("showingTooltip")&&this.showTooltip()}x(){let e=this.get("x"),t=this.getPrivate("x");const i=this.parent;return i?e instanceof f?C(e,i.innerWidth())+i.get("paddingLeft",0):_(e)?e:t??i.get("paddingLeft",this._display.x):this._display.x}y(){let e=this.getPrivate("y");if(e!=null)return e;let t=this.get("y");const i=this.parent;return i?t instanceof f?C(t,i.innerHeight())+i.get("paddingTop",0):_(t)?t:e??i.get("paddingTop",this._display.y):this._display.y}_dispose(){super._dispose(),this._display.dispose(),this._removeTemplateField(),this._removeParent(this.parent),this._root._removeFocusElement(this);const e=this.get("tooltip");e&&e.dispose(),this.markDirty()}adjustedLocalBounds(){return this._fixMinBounds(this._adjustedLocalBounds),this._adjustedLocalBounds}localBounds(){return this._localBounds}bounds(){const e=this._adjustedLocalBounds,t=this.x(),i=this.y();return{left:e.left+t,right:e.right+t,top:e.top+i,bottom:e.bottom+i}}globalBounds(){const e=this.localBounds(),t=this.toGlobal({x:e.left,y:e.top}),i=this.toGlobal({x:e.right,y:e.top}),r=this.toGlobal({x:e.right,y:e.bottom}),n=this.toGlobal({x:e.left,y:e.bottom});return{left:Math.min(t.x,i.x,r.x,n.x),top:Math.min(t.y,i.y,r.y,n.y),right:Math.max(t.x,i.x,r.x,n.x),bottom:Math.max(t.y,i.y,r.y,n.y)}}_onShow(e){}_onHide(e){}appear(e,t){return Z(this,void 0,void 0,function*(){return yield this.hide(0),t?new Promise((i,r)=>{this.setTimeout(()=>{i(this.show(e))},t)}):this.show(e)})}show(e){return Z(this,void 0,void 0,function*(){if(!this._isShowing){this._isHidden=!1,this._isShowing=!0,this._isHiding=!1,this.states.lookup("default").get("visible")&&this.set("visible",!0),this._onShow(e);const t=this.states.applyAnimate("default",e);yield Ce(t),this._isShowing=!1}})}hide(e){return Z(this,void 0,void 0,function*(){if(!this._isHiding&&!this._isHidden){this._isHiding=!0,this._isShowing=!1;let t=this.states.lookup("hidden");t||(t=this.states.create("hidden",{opacity:0,visible:!1})),this._isHidden=!0,this._onHide(e);const i=this.states.applyAnimate("hidden",e);yield Ce(i),this._isHiding=!1}})}isHidden(){return this._isHidden}isShowing(){return this._isShowing}isHiding(){return this._isHiding}isHover(){return this._display.hovering()}isFocus(){return this._root.focused(this)}isDragging(){return this._isDragging}isVisible(){return!(!this.get("visible")||!this.getPrivate("visible")||this.get("forceHidden"))}isVisibleDeep(){return this._parent?this._parent.isVisibleDeep()&&this.isVisible():this.isVisible()}compositeOpacity(){const e=this.get("opacity",1);return this._parent?this._parent.compositeOpacity()*e:e}width(){let e=this.get("width"),t=this.get("maxWidth",this.getPrivate("maxWidth")),i=this.get("minWidth",this.getPrivate("minWidth")),r=this.getPrivate("width"),n=0;if(_(r))n=r;else if(e==null)this._adjustedLocalBounds&&(n=this._adjustedLocalBounds.right-this._adjustedLocalBounds.left);else if(e instanceof f){const a=this.parent;n=a?a.innerWidth()*e.value:this._root.width()*e.value}else _(e)&&(n=e);return _(i)&&(n=Math.max(i,n)),_(t)&&(n=Math.min(t,n)),n}maxWidth(){let e=this.get("maxWidth",this.getPrivate("maxWidth"));if(_(e))return e;{let i=this.get("width");if(_(i))return i}const t=this.parent;return t?t.innerWidth():this._root.width()}maxHeight(){let e=this.get("maxHeight",this.getPrivate("maxHeight"));if(_(e))return e;{let i=this.get("height");if(_(i))return i}const t=this.parent;return t?t.innerHeight():this._root.height()}height(){let e=this.get("height"),t=this.get("maxHeight",this.getPrivate("maxHeight")),i=this.get("minHeight",this.getPrivate("minHeight")),r=this.getPrivate("height"),n=0;if(_(r))n=r;else if(e==null)this._adjustedLocalBounds&&(n=this._adjustedLocalBounds.bottom-this._adjustedLocalBounds.top);else if(e instanceof f){const a=this.parent;n=a?a.innerHeight()*e.value:this._root.height()*e.value}else _(e)&&(n=e);return _(i)&&(n=Math.max(i,n)),_(t)&&(n=Math.min(t,n)),n}_findStaticTemplate(e){return this._templateField&&e(this._templateField)?this._templateField:super._findStaticTemplate(e)}_walkParents(e){this._parent&&this._walkParent(e)}_walkParent(e){this._parent&&this._parent._walkParent(e),e(this)}get parent(){return this._parent}_setParent(e,t=!1){const i=this._parent;e!==i&&(this.markDirtyBounds(),e.markDirty(),this._parent=e,t&&(this._removeParent(i),e&&(this._addPercentageSizeChildren(),this._addPercentagePositionChildren())),this.markDirtyPosition(),this._applyThemes())}getNumberFormatter(){return this.get("numberFormatter",this._root.numberFormatter)}getDateFormatter(){return this.get("dateFormatter",this._root.dateFormatter)}getDurationFormatter(){return this.get("durationFormatter",this._root.durationFormatter)}toGlobal(e){return this._display.toGlobal(e)}toLocal(e){return this._display.toLocal(e)}_getDownPoint(){const e=this._getDownPointId();if(e)return this._downPoints[e]}_getDownPointId(){if(this._downPoints)return ot(this._downPoints,(e,t)=>e>t?1:e0&&(this._backgroundDisplay.beginFill(r,n),this._backgroundDisplay.drawRect(0,0,t,i),this._backgroundDisplay.endFill()),this._display.angle=this.get("rotation",0),this._draw(),this._pattern=this._root._renderer.createPattern(this._display,this._backgroundDisplay,e,t,i)}}}Object.defineProperty(W,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Pattern"}),Object.defineProperty(W,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:A.classNames.concat([W.className])});class V extends W{constructor(){super(...arguments),Object.defineProperty(this,"_image",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_beforeChanged(){super._beforeChanged(),this._clear=!0,this.isDirty("src")&&this._load()}_draw(){super._draw();const e=this._image;if(e){const t=this.get("width",100),i=this.get("height",100),r=this.get("fit","image");let n=0,a=0;r=="pattern"?(n=t,a=i):(n=e.width,a=e.height,r=="image"&&(this.set("width",n),this.set("height",a)));let o=0,h=0;this.get("centered",!0)&&(o=t/2-n/2,h=i/2-a/2),this._display.image(e,n,a,o,h)}}_load(){const e=this.get("src");if(e){const t=new Image;t.src=e,t.decode().then(()=>{this._image=t,this._draw(),this.events.isEnabled("loaded")&&this.events.dispatch("loaded",{type:"loaded",target:this})}).catch(i=>{})}}}var ve;Object.defineProperty(V,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PicturePattern"}),Object.defineProperty(V,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:W.classNames.concat([V.className])}),function(s){s.ADD="lighter",s.COLOR="color",s.COLOR_BURN="color-burn",s.COLOR_DODGE="color-dodge",s.DARKEN="darken",s.DIFFERENCE="difference",s.DST_OVER="destination-over",s.EXCLUSION="exclusion",s.HARD_LIGHT="hard-light",s.HUE="hue",s.LIGHTEN="lighten",s.LUMINOSITY="luminosity",s.MULTIPLY="multiply",s.NORMAL="source-over",s.OVERLAY="overlay",s.SATURATION="saturation",s.SCREEN="screen",s.SOFT_LIGHT="soft-light",s.SRC_ATOP="source-atop",s.XOR="xor"}(ve||(ve={}));const Si=["fill","fillOpacity","stroke","strokeWidth","strokeOpacity","fillPattern","strokePattern","fillGradient","strokeGradient","strokeDasharray","strokeDashoffset"];class U extends D{constructor(){super(...arguments),Object.defineProperty(this,"_display",{enumerable:!0,configurable:!0,writable:!0,value:this._root._renderer.makeGraphics()}),Object.defineProperty(this,"_clear",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_beforeChanged(){if(super._beforeChanged(),(this.isDirty("draw")||this.isDirty("svgPath"))&&this.markDirtyBounds(),(this.isDirty("fill")||this.isDirty("stroke")||this.isDirty("visible")||this.isDirty("forceHidden")||this.isDirty("scale")||this.isDirty("fillGradient")||this.isDirty("strokeGradient")||this.isDirty("fillPattern")||this.isDirty("strokePattern")||this.isDirty("fillOpacity")||this.isDirty("strokeOpacity")||this.isDirty("strokeWidth")||this.isDirty("draw")||this.isDirty("blendMode")||this.isDirty("strokeDasharray")||this.isDirty("strokeDashoffset")||this.isDirty("svgPath")||this.isDirty("lineJoin")||this.isDirty("shadowColor")||this.isDirty("shadowBlur")||this.isDirty("shadowOffsetX")||this.isDirty("shadowOffsetY"))&&(this._clear=!0),this._display.crisp=this.get("crisp",!1),this.isDirty("fillGradient")){const e=this.get("fillGradient");if(e){this._display.isMeasured=!0;const t=e.get("target");t&&(this._disposers.push(t.events.on("boundschanged",()=>{this._markDirtyKey("fill")})),this._disposers.push(t.events.on("positionchanged",()=>{this._markDirtyKey("fill")})))}}if(this.isDirty("strokeGradient")){const e=this.get("strokeGradient");if(e){this._display.isMeasured=!0;const t=e.get("target");t&&(this._disposers.push(t.events.on("boundschanged",()=>{this._markDirtyKey("stroke")})),this._disposers.push(t.events.on("positionchanged",()=>{this._markDirtyKey("stroke")})))}}}_changed(){if(super._changed(),this._clear){this.markDirtyBounds(),this.markDirtyLayer(),this._display.clear();let e=this.get("strokeDasharray");_(e)&&(e=e<.5?[0]:[e]),this._display.setLineDash(e);const t=this.get("strokeDashoffset");t&&this._display.setLineDashOffset(t);const i=this.get("blendMode",ve.NORMAL);this._display.blendMode=i;const r=this.get("draw");r&&r(this._display,this);const n=this.get("svgPath");n!=null&&this._display.svgPath(n)}}_afterChanged(){if(super._afterChanged(),this._clear){const e=this.get("fill"),t=this.get("fillGradient"),i=this.get("fillPattern"),r=this.get("fillOpacity"),n=this.get("stroke"),a=this.get("strokeGradient"),o=this.get("strokePattern"),h=this.get("shadowColor"),l=this.get("shadowBlur"),d=this.get("shadowOffsetX"),p=this.get("shadowOffsetY"),u=this.get("shadowOpacity");if(h&&(l||d||p)&&this._display.shadow(h,l,d,p,u),i){let c=!1;!e||i.get("fill")&&!i.get("fillInherited")||(i.set("fill",e),i.set("fillInherited",!0),c=!0),!n||i.get("color")&&!i.get("colorInherited")||(i.set("color",n),i.set("colorInherited",!0),c=!0),c&&i._changed();const m=i.pattern;m&&(this._display.beginFill(m,r),this._display.endFill(),i instanceof V&&i.events.once("loaded",()=>{this._clear=!0,this.markDirty()}))}else if(t){if(e){const m=t.get("stops",[]);m.length&&g(m,b=>{b.color&&!b.colorInherited||!e||(b.color=e,b.colorInherited=!0),(b.opacity==null||b.opacityInherited)&&(b.opacity=r,b.opacityInherited=!0)})}const c=t.getFill(this);c&&(this._display.beginFill(c,r),this._display.endFill())}else e&&(this._display.beginFill(e,r),this._display.endFill());if(n||a||o){const c=this.get("strokeOpacity");let m=this.get("strokeWidth",1);this.get("nonScalingStroke")&&(m/=this.get("scale",1)),this.get("crisp")&&(m/=this._root._renderer.resolution);const b=this.get("lineJoin");if(o){let S=!1;!n||o.get("color")&&!o.get("colorInherited")||(o.set("color",n),o.set("colorInherited",!0),S=!0),S&&o._changed();const x=o.pattern;x&&(this._display.lineStyle(m,x,c,b),this._display.endStroke(),o instanceof V&&o.events.once("loaded",()=>{this._clear=!0,this.markDirty()}))}else if(a){const S=a.get("stops",[]);S.length&&g(S,v=>{v.color&&!v.colorInherited||!n||(v.color=n,v.colorInherited=!0),(v.opacity==null||v.opacityInherited)&&(v.opacity=c,v.opacityInherited=!0)});const x=a.getFill(this);x&&(this._display.lineStyle(m,x,c,b),this._display.endStroke())}else n&&(this._display.lineStyle(m,n,c,b),this._display.endStroke())}this.getPrivate("showingTooltip")&&this.showTooltip()}this._clear=!1}}Object.defineProperty(U,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Graphics"}),Object.defineProperty(U,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:D.classNames.concat([U.className])});class K extends U{_beforeChanged(){super._beforeChanged(),(this.isDirty("width")||this.isDirty("height")||this.isPrivateDirty("width")||this.isPrivateDirty("height"))&&(this._clear=!0)}_changed(){super._changed(),this._clear&&!this.get("draw")&&this._draw()}_draw(){this._display.drawRect(0,0,this.width(),this.height())}_updateSize(){this.markDirty(),this._clear=!0}}function j(s,e){s.get("reverseChildren",!1)?s.children.eachReverse(e):s.children.each(e)}Object.defineProperty(K,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Rectangle"}),Object.defineProperty(K,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:U.classNames.concat([K.className])});class E extends A{}Object.defineProperty(E,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Layout"}),Object.defineProperty(E,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:A.classNames.concat([E.className])});class z extends E{updateContainer(e){let t=e.get("paddingLeft",0),i=e.innerWidth(),r=0;j(e,a=>{if(a.isVisible()&&a.get("position")=="relative"){let o=a.get("width");if(o instanceof f){r+=o.value;let h=i*o.value,l=a.get("minWidth",a.getPrivate("minWidth",-1/0));l>h&&(i-=l,r-=o.value);let d=a.get("maxWidth",a.getPrivate("maxWidth",1/0));h>d&&(i-=d,r-=o.value)}else _(o)||(o=a.width()),i-=o+a.get("marginLeft",0)+a.get("marginRight",0)}}),(i<=0||i==1/0)&&(i=.1),j(e,a=>{if(a.isVisible()&&a.get("position")=="relative"){let o=a.get("width");if(o instanceof f){let h=i*o.value/r-a.get("marginLeft",0)-a.get("marginRight",0),l=a.get("minWidth",a.getPrivate("minWidth",-1/0)),d=a.get("maxWidth",a.getPrivate("maxWidth",1/0));h=Math.min(Math.max(l,h),d),a.setPrivate("width",h)}else a._prevSettings.width instanceof f&&a.setPrivate("width",void 0)}});let n=t;j(e,a=>{if(a.get("position")=="relative")if(a.isVisible()){let o=a.adjustedLocalBounds(),h=a.get("marginLeft",0),l=a.get("marginRight",0),d=a.get("maxWidth"),p=o.left,u=o.right;d&&u-p>d&&(u=p+d);let c=n+h-p;a.setPrivate("x",c),n=c+u+l}else a.setPrivate("x",void 0)})}}Object.defineProperty(z,"className",{enumerable:!0,configurable:!0,writable:!0,value:"HorizontalLayout"}),Object.defineProperty(z,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:E.classNames.concat([z.className])});class G extends E{updateContainer(e){let t=e.get("paddingTop",0),i=e.innerHeight(),r=0;j(e,a=>{if(a.isVisible()&&a.get("position")=="relative"){let o=a.get("height");if(o instanceof f){r+=o.value;let h=i*o.value,l=a.get("minHeight",a.getPrivate("minHeight",-1/0));l>h&&(i-=l,r-=o.value);let d=a.get("maxHeight",a.getPrivate("maxHeight",1/0));h>d&&(i-=d,r-=o.value)}else _(o)||(o=a.height()),i-=o+a.get("marginTop",0)+a.get("marginBottom",0)}}),(i<=0||i==1/0)&&(i=.1),j(e,a=>{if(a.isVisible()&&a.get("position")=="relative"){let o=a.get("height");if(o instanceof f){let h=i*o.value/r-a.get("marginTop",0)-a.get("marginBottom",0),l=a.get("minHeight",a.getPrivate("minHeight",-1/0)),d=a.get("maxHeight",a.getPrivate("maxHeight",1/0));h=Math.min(Math.max(l,h),d),a.setPrivate("height",h)}else a._prevSettings.height instanceof f&&a.setPrivate("height",void 0)}});let n=t;j(e,a=>{if(a.get("position")=="relative")if(a.isVisible()){let o=a.adjustedLocalBounds(),h=a.get("marginTop",0),l=o.top,d=o.bottom,p=a.get("maxHeight");p&&d-l>p&&(d=l+p);let u=a.get("marginBottom",0),c=n+h-l;a.setPrivate("y",c),n=c+d+u}else a.setPrivate("y",void 0)})}}Object.defineProperty(G,"className",{enumerable:!0,configurable:!0,writable:!0,value:"VerticalLayout"}),Object.defineProperty(G,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:E.classNames.concat([G.className])});class Y extends E{_afterNew(){this._setRawDefault("maxColumns",Number.MAX_VALUE),super._afterNew()}updateContainer(e){let t=e.get("paddingLeft",0),i=e.get("paddingRight",0),r=e.get("paddingTop",0),n=e.maxWidth()-t-i,a=n,o=1;j(e,m=>{if(m.get("visible")&&m.getPrivate("visible")&&!m.get("forceHidden")&&m.get("position")!="absolute"){let b=m.width();bo&&(o=b)}}),a=Me(a,1,n),o=Me(o,1,n);let h=1;h=this.get("fixedWidthGrid")?n/o:n/a,h=Math.max(1,Math.floor(h)),h=Math.min(this.get("maxColumns",Number.MAX_VALUE),h);let l=this.getColumnWidths(e,h,o,n),d=r,p=0,u=0;h=l.length;let c=t;j(e,m=>{if(m.get("position")=="relative"&&m.isVisible()){const b=m.get("marginTop",0),S=m.get("marginBottom",0);let x=m.adjustedLocalBounds(),v=m.get("marginLeft",0),H=m.get("marginRight",0),J=c+v-x.left,q=d+b-x.top;m.setPrivate("x",J),m.setPrivate("y",q),c+=l[p]+H,u=Math.max(u,m.height()+b+S),p++,p>=h&&(p=0,c=t,d+=u)}})}getColumnWidths(e,t,i,r){let n=0,a=[],o=0;return j(e,h=>{let l=h.adjustedLocalBounds();h.get("position")!="absolute"&&h.isVisible()&&(this.get("fixedWidthGrid")?a[o]=i:a[o]=Math.max(0|a[o],l.right-l.left+h.get("marginLeft",0)+h.get("marginRight",0)),o{n+=h}),n>r?t>2?(t-=1,this.getColumnWidths(e,t,i,r)):[r]:a}}Object.defineProperty(Y,"className",{enumerable:!0,configurable:!0,writable:!0,value:"GridLayout"}),Object.defineProperty(Y,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:E.classNames.concat([Y.className])});class ye{static escape(e){return e.replace(/\[\[/g,this.prefix+"1").replace(/([^\/\]]{1})\]\]/g,"$1"+this.prefix+"2").replace(/\]\]/g,this.prefix+"2").replace(/\{\{/g,this.prefix+"3").replace(/\}\}/g,this.prefix+"4").replace(/\'\'/g,this.prefix+"5")}static unescape(e){return e.replace(new RegExp(this.prefix+"1","g"),"[[").replace(new RegExp(this.prefix+"2","g"),"]]").replace(new RegExp(this.prefix+"3","g"),"{{").replace(new RegExp(this.prefix+"4","g"),"}}").replace(new RegExp(this.prefix+"5","g"),"''")}static cleanUp(e){return e.replace(/\[\[/g,"[").replace(/\]\]/g,"]").replace(/\{\{/g,"{").replace(/\}\}/g,"}").replace(/\'\'/g,"'")}static chunk(e,t=!1,i=!1){let r=[];e=this.escape(e);let n=t?e.split("'"):[e];for(let a=0;a{e.dispose()}),this.getPrivate("htmlElement")&&this._root._removeHTMLContent(this),super._dispose()}_changed(){if(super._changed(),this.isDirty("interactiveChildren")&&(this._display.interactiveChildren=this.get("interactiveChildren",!1)),this.isDirty("layout")&&(this._prevWidth=0,this._prevHeight=0,this.markDirtyBounds(),this._prevSettings.layout&&this.children.each(e=>{e.removePrivate("x"),e.removePrivate("y")})),(this.isDirty("paddingTop")||this.isDirty("paddingBottom")||this.isDirty("paddingLeft")||this.isDirty("paddingRight"))&&this.children.each(e=>{e.markDirtyPosition()}),this.isDirty("maskContent")){const e=this._childrenDisplay;let t=this._contentMask;this.get("maskContent")?t||(t=K.new(this._root,{x:-.5,y:-.5,width:this.width()+1,height:this.height()+1}),this._contentMask=t,e.addChildAt(t._display,0),e.mask=t._display):t&&(e.removeChild(t._display),e.mask=null,t.dispose(),this._contentMask=void 0)}}_updateSize(){super._updateSize(),g(this._percentageSizeChildren,e=>{e._updateSize()}),g(this._percentagePositionChildren,e=>{e.markDirtyPosition(),e._updateSize()}),this.updateBackground()}updateBackground(){const e=this.get("background");let t=this._localBounds;if(t&&!this.isHidden()){let i=t.left,r=t.top,n=t.right-i,a=t.bottom-r,o=this.get("maxWidth"),h=this.get("maxHeight");h&&a>h&&(a=h),o&&n>o&&(n=o);let l=this.width(),d=this.height();e&&(e.setAll({width:n,height:a,x:i,y:r}),this._display.interactive&&(e._display.interactive=!0));const p=this._contentMask;p&&p.setAll({width:l+1,height:d+1});const u=this.get("verticalScrollbar");if(u){u.set("height",d),u.set("x",l-u.width()-u.get("marginRight",0)),u.set("end",u.get("start",0)+d/this._contentHeight);const c=u.get("background");c&&c.setAll({width:u.width(),height:d});let m=!0;this._contentHeight<=d&&(m=!1),u.setPrivate("visible",m)}}}_applyThemes(){return!!super._applyThemes()&&(this.eachChildren(e=>{e._applyThemes()}),!0)}_applyState(e){super._applyState(e),this.get("setStateOnChildren")&&this.eachChildren(t=>{t.states.apply(e)})}_applyStateAnimated(e,t){super._applyStateAnimated(e,t),this.get("setStateOnChildren")&&this.eachChildren(i=>{i.states.applyAnimate(e,t)})}innerWidth(){return this.width()-this.get("paddingRight",0)-this.get("paddingLeft",0)}innerHeight(){return this.height()-this.get("paddingTop",0)-this.get("paddingBottom",0)}_getBounds(){let e=this.get("width"),t=this.get("height"),i=this.getPrivate("width"),r=this.getPrivate("height"),n={left:0,top:0,right:this.width(),bottom:this.height()},a=this.get("layout"),o=!1,h=!1;if((a instanceof z||a instanceof Y)&&(o=!0),a instanceof G&&(h=!0),e==null&&i==null||t==null&&r==null||this.get("verticalScrollbar")){let l=Number.MAX_VALUE,d=l,p=-l,u=l,c=-l;const m=this.get("paddingLeft",0),b=this.get("paddingTop",0),S=this.get("paddingRight",0),x=this.get("paddingBottom",0);this.children.each(v=>{if(v.get("position")!="absolute"&&v.get("isMeasured")){let H=v.adjustedLocalBounds(),J=v.x(),q=v.y(),ne=J+H.left,ae=J+H.right,oe=q+H.top,he=q+H.bottom;o&&(ne-=v.get("marginLeft",0),ae+=v.get("marginRight",0)),h&&(oe-=v.get("marginTop",0),he+=v.get("marginBottom",0)),nep&&(p=ae),oec&&(c=he)}}),d==l&&(d=0),p==-l&&(p=0),u==l&&(u=0),c==-l&&(c=0),n.left=d-m,n.top=u-b,n.right=p+S,n.bottom=c+x}this._contentWidth=n.right-n.left,this._contentHeight=n.bottom-n.top,_(e)&&(n.left=0,n.right=e),_(i)&&(n.left=0,n.right=i),_(t)&&(n.top=0,n.bottom=t),_(r)&&(n.top=0,n.bottom=r),this._localBounds=n}_updateBounds(){const e=this.get("layout");e&&e.updateContainer(this),super._updateBounds(),this.updateBackground()}markDirty(){super.markDirty(),this._root._addDirtyParent(this)}_prepareChildren(){const e=this.innerWidth(),t=this.innerHeight();if(e!=this._prevWidth||t!=this._prevHeight){let i=this.get("layout"),r=!1,n=!1;i&&((i instanceof z||i instanceof Y)&&(r=!0),i instanceof G&&(n=!0)),g(this._percentageSizeChildren,a=>{if(!r){let o=a.get("width");o instanceof f&&a.setPrivate("width",o.value*e)}if(!n){let o=a.get("height");o instanceof f&&a.setPrivate("height",o.value*t)}}),g(this._percentagePositionChildren,a=>{a.markDirtyPosition(),a.markDirtyBounds()}),this._prevWidth=e,this._prevHeight=t,this._sizeDirty=!0,this.updateBackground()}this._handleStates()}_updateChildren(){if(this.isDirty("html")){const e=this.get("html");e&&e!==""?this._root._setHTMLContent(this,we(this,this.get("html",""))):this._root._removeHTMLContent(this),this._root._positionHTMLElement(this)}if(this.isDirty("verticalScrollbar")){const e=this.get("verticalScrollbar");if(e){e._setParent(this),e.startGrip.setPrivate("visible",!1),e.endGrip.setPrivate("visible",!1),this.set("maskContent",!0),this.set("paddingRight",e.width()+e.get("marginRight",0)+e.get("marginLeft",0));let t=this.get("background");t||(t=this.set("background",K.new(this._root,{themeTags:["background"],fillOpacity:0,fill:this._root.interfaceColors.get("alternativeBackground")}))),this._vsbd0=this.events.on("wheel",i=>{const r=i.originalEvent;if(!dt(r,this))return;r.preventDefault();let n=r.deltaY/5e3;const a=e.get("start",0),o=e.get("end",1);a+n<=0&&(n=-a),o+n>=1&&(n=1-o),a+n>=0&&o+n<=1&&(e.set("start",a+n),e.set("end",o+n))}),this._disposers.push(this._vsbd0),this._vsbd1=e.events.on("rangechanged",()=>{let i=this._contentHeight;const r=this._childrenDisplay,n=this._contentMask;r.y=-e.get("start")*i,r.markDirtyLayer(),n&&(n._display.y=-r.y,r.mask=n._display)}),this._disposers.push(this._vsbd1),this._display.addChild(e._display)}else{const t=this._prevSettings.verticalScrollbar;t&&(this._display.removeChild(t._display),this._vsbd0&&this._vsbd0.dispose(),this._vsbd1&&this._vsbd1.dispose(),this._childrenDisplay.y=0,this.setPrivate("height",void 0),this.set("maskContent",!1),this.set("paddingRight",void 0))}}if(this.isDirty("background")){const e=this._prevSettings.background;e&&this._display.removeChild(e._display);const t=this.get("background");t instanceof D&&(t.set("isMeasured",!1),t._setParent(this),this._display.addChildAt(t._display,0))}if(this.isDirty("mask")){const e=this.get("mask"),t=this._prevSettings.mask;if(t&&(this._display.removeChild(t._display),t!=e&&t.dispose()),e){const i=e.parent;i&&i.children.removeValue(e),e._setParent(this),this._display.addChildAt(e._display,0),this._childrenDisplay.mask=e._display}}}_processTemplateField(){super._processTemplateField(),this.children.each(e=>{e._processTemplateField()})}walkChildren(e){this.children.each(t=>{t instanceof I&&t.walkChildren(e),e(t)})}eachChildren(e){const t=this.get("background");t&&e(t);const i=this.get("verticalScrollbar");i&&e(i);const r=this.get("mask");r&&e(r),this.children.values.forEach(n=>{e(n)})}allChildren(){const e=[];return this.eachChildren(t=>{e.push(t)}),e}_setDataItem(e){const t=e!==this._dataItem;super._setDataItem(e);const i=this.get("html","");i&&i!==""&&t&&this._root._setHTMLContent(this,we(this,i))}}Object.defineProperty(I,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Container"}),Object.defineProperty(I,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:D.classNames.concat([I.className])});class ie extends D{constructor(){super(...arguments),Object.defineProperty(this,"textStyle",{enumerable:!0,configurable:!0,writable:!0,value:this._root._renderer.makeTextStyle()}),Object.defineProperty(this,"_display",{enumerable:!0,configurable:!0,writable:!0,value:this._root._renderer.makeText("",this.textStyle)}),Object.defineProperty(this,"_textStyles",{enumerable:!0,configurable:!0,writable:!0,value:["textAlign","fontFamily","fontSize","fontStyle","fontWeight","fontStyle","fontVariant","textDecoration","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","shadowOpacity","lineHeight","baselineRatio","direction","textBaseline","oversizedBehavior","breakWords","ellipsis","minScale"]}),Object.defineProperty(this,"_originalScale",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_updateBounds(){if(this.get("text"))super._updateBounds();else{let e={left:0,right:0,top:0,bottom:0};this._adjustedLocalBounds=e}}_changed(){super._changed(),this._display.clear();let e=this.textStyle;if(this.isDirty("opacity")){let t=this.get("opacity",1);this._display.alpha=t}if((this.isDirty("text")||this.isDirty("populateText"))&&(this._display.text=this._getText(),this.markDirtyBounds(),this.get("role")=="tooltip"&&this._root.updateTooltip(this)),this.isPrivateDirty("tooltipElement")&&this.getPrivate("tooltipElement")&&this._disposers.push(new P(()=>{this._root._removeTooltipElement(this)})),this.isDirty("width")&&(e.wordWrapWidth=this.width(),this.markDirtyBounds()),this.isDirty("oversizedBehavior")&&(e.oversizedBehavior=this.get("oversizedBehavior","none"),this.markDirtyBounds()),this.isDirty("breakWords")&&(e.breakWords=this.get("breakWords",!1),this.markDirtyBounds()),this.isDirty("ellipsis")&&(e.ellipsis=this.get("ellipsis"),this.markDirtyBounds()),this.isDirty("ignoreFormatting")&&(e.ignoreFormatting=this.get("ignoreFormatting",!1),this.markDirtyBounds()),this.isDirty("minScale")&&(e.minScale=this.get("minScale",0),this.markDirtyBounds()),this.isDirty("fill")){let t=this.get("fill");t&&(e.fill=t)}if(this.isDirty("fillOpacity")){let t=this.get("fillOpacity",1);t&&(e.fillOpacity=t)}(this.isDirty("maxWidth")||this.isPrivateDirty("maxWidth"))&&(e.maxWidth=this.get("maxWidth",this.getPrivate("maxWidth")),this.markDirtyBounds()),(this.isDirty("maxHeight")||this.isPrivateDirty("maxHeight"))&&(e.maxHeight=this.get("maxHeight",this.getPrivate("maxHeight")),this.markDirtyBounds()),g(this._textStyles,t=>{this._dirty[t]&&(e[t]=this.get(t),this.markDirtyBounds())}),e.fontSize=this.get("fontSize"),e.fontFamily=this.get("fontFamily"),this._display.style=e,this.isDirty("role")&&this.get("role")=="tooltip"&&this._root.updateTooltip(this)}_getText(){const e=this.get("text","");return this.get("populateText")?we(this,e):e}markDirtyText(){this._display.text=this._getText(),this.get("role")=="tooltip"&&this._root.updateTooltip(this),this.markDirtyBounds(),this.markDirty()}_setDataItem(e){super._setDataItem(e),this.get("populateText")&&this.markDirtyText()}getNumberFormatter(){return this.parent?this.parent.getNumberFormatter():super.getNumberFormatter()}getDateFormatter(){return this.parent?this.parent.getDateFormatter():super.getDateFormatter()}getDurationFormatter(){return this.parent?this.parent.getDurationFormatter():super.getDurationFormatter()}}Object.defineProperty(ie,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Text"}),Object.defineProperty(ie,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:D.classNames.concat([ie.className])});class ce extends I{constructor(){super(...arguments),Object.defineProperty(this,"_text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_textKeys",{enumerable:!0,configurable:!0,writable:!0,value:["text","fill","fillOpacity","textAlign","fontFamily","fontSize","fontStyle","fontWeight","fontStyle","fontVariant","textDecoration","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","shadowOpacity","lineHeight","baselineRatio","direction","textBaseline","oversizedBehavior","breakWords","ellipsis","minScale","populateText","role","ignoreFormatting"]})}get text(){return this._text}_afterNew(){super._afterNew(),this._makeText(),g(this._textKeys,e=>{const t=this.get(e);t!=null&&this._text.set(e,t)}),this.get("html","")!==""&&this._text.set("text",""),this.onPrivate("maxWidth",()=>{this._setMaxDimentions()}),this.onPrivate("maxHeight",()=>{this._setMaxDimentions()})}_makeText(){this._text=this.children.push(ie.new(this._root,{}))}_updateChildren(){if(super._updateChildren(),g(this._textKeys,e=>{this._text.set(e,this.get(e))}),this.isDirty("maxWidth")&&this._setMaxDimentions(),this.isDirty("maxHeight")&&this._setMaxDimentions(),this.isDirty("rotation")&&this._setMaxDimentions(),this.get("html","")!==""?this._text.set("text",""):this._text.set("text",this.get("text")),this.isDirty("textAlign")||this.isDirty("width")){const e=this.get("textAlign");let t;this.get("width")!=null?t=e=="right"?nt:e=="center"?at:0:e=="left"||e=="start"?t=this.get("paddingLeft"):e!="right"&&e!="end"||(t=-this.get("paddingRight")),this.text.set("x",t)}}_setMaxDimentions(){const e=this.get("rotation"),t=e==90||e==270||e==-90,i=this.get("maxWidth",this.getPrivate("maxWidth",1/0));_(i)?this.text.set(t?"maxHeight":"maxWidth",i-this.get("paddingLeft",0)-this.get("paddingRight",0)):this.text.set(t?"maxHeight":"maxWidth",void 0);const r=this.get("maxHeight",this.getPrivate("maxHeight",1/0));_(r)?this.text.set(t?"maxWidth":"maxHeight",r-this.get("paddingTop",0)-this.get("paddingBottom",0)):this.text.set(t?"maxWidth":"maxHeight",void 0)}_setDataItem(e){super._setDataItem(e),this._markDirtyKey("text"),this.text.get("populateText")&&this.text.markDirtyText()}getText(){return this._text._getText()}}Object.defineProperty(ce,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Label"}),Object.defineProperty(ce,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:I.classNames.concat([ce.className])});class ji{constructor(e,t){if(Object.defineProperty(this,"_root",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rules",{enumerable:!0,configurable:!0,writable:!0,value:{}}),this._root=e,!t)throw new Error("You cannot use `new Class()`, instead use `Class.new()`")}static new(e){const t=new this(e,!0);return t.setupDefaultRules(),t}setupDefaultRules(){}_lookupRules(e){return this._rules[e]}ruleRaw(e,t=[]){let i=this._rules[e];i||(i=this._rules[e]=[]),t.sort(N);const{index:r,found:n}=et(i,a=>{const o=N(a.tags.length,t.length);return o===0?Ye(a.tags,t,N):o});if(n)return i[r].template;{const a=X.new({});return i.splice(r,0,{tags:t,template:a}),a}}rule(e,t=[]){return this.ruleRaw(e,t)}}export{T as $,Y as A,X as B,xt as C,Wt as D,A as E,Re as F,fi as G,k as H,Et as I,Gt as J,f as K,wt as L,ie as M,Di as N,xi as O,be as P,I as Q,fe as R,Qe as S,Ge as T,Pi as U,K as V,U as W,at as X,nt as Y,y as Z,Nt as _,st as a,Si as a0,we as a1,zt as a2,Oi as a3,Be as a4,Ie as a5,ni as a6,Oe as a7,Lt as a8,Ht as a9,oi as aA,Yt as aB,Ut as aC,se as aD,Zt as aE,it as aF,Qt as aG,ti as aH,ve as aI,Rt as aJ,ei as aK,Ne as aL,vi as aM,We as aN,ye as aa,$ as ab,G as ac,z as ad,si as ae,L as af,ii as ag,Jt as ah,qt as ai,Vt as aj,N as ak,P as al,Xt as am,ai as an,Te as ao,$t as ap,gi as aq,ue as ar,ci as as,pi as at,hi as au,di as av,je as aw,li as ax,ui as ay,ge as az,mi as b,Fe as c,yi as d,ce as e,Se as f,dt as g,_i as h,ji as i,C as j,Ti as k,_ as l,g as m,De as n,ri as o,Me as p,w as q,le as r,Kt as s,bi as t,wi as u,He as v,Ft as w,ki as x,O as y,xe as z}; diff --git a/dist/assets/Tick-WQ_bPwW2.js b/dist/assets/Tick-bu1aEuYp.js similarity index 99% rename from dist/assets/Tick-WQ_bPwW2.js rename to dist/assets/Tick-bu1aEuYp.js index c180505..675f556 100644 --- a/dist/assets/Tick-WQ_bPwW2.js +++ b/dist/assets/Tick-bu1aEuYp.js @@ -1 +1 @@ -import{da as M}from"./index-J0iiHjMT.js";import{Q as I,W as K,m as b,$ as W,F as q,Y as x,S as Y,a as Z,I as Q,l as T,Z as L,K as J,L as ee,e as E,_ as H}from"./Theme-QNc_77AM.js";class te extends q{constructor(){super(...arguments),Object.defineProperty(this,"processor",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}incrementRef(){}decrementRef(){}_onPush(e){this.processor&&this.processor.processRow(e),super._onPush(e)}_onInsertIndex(e,t){this.processor&&this.processor.processRow(t),super._onInsertIndex(e,t)}_onSetIndex(e,t,i){this.processor&&this.processor.processRow(i),super._onSetIndex(e,t,i)}}class V extends Q{constructor(e,t,i){super(i),Object.defineProperty(this,"component",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dataContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bullets",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"open",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"close",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.dataContext=t,this.component=e,this._settings.visible=!0,this._checkDirty()}markDirty(){this.component.markDirtyValues(this)}_startAnimation(){this.component._root._addAnimation(this)}_animationTime(){return this.component._root.animationTime}_dispose(){this.component&&this.component.disposeDataItem(this),super._dispose()}show(e){this.setRaw("visible",!0),this.component&&this.component.showDataItem(this,e)}hide(e){this.setRaw("visible",!1),this.component&&this.component.hideDataItem(this,e)}isHidden(){return!this.get("visible")}}class $ extends I{constructor(){super(...arguments),Object.defineProperty(this,"_data",{enumerable:!0,configurable:!0,writable:!0,value:new te}),Object.defineProperty(this,"_dataItems",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_mainDataItems",{enumerable:!0,configurable:!0,writable:!0,value:this._dataItems}),Object.defineProperty(this,"valueFields",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"fields",{enumerable:!0,configurable:!0,writable:!0,value:["id"]}),Object.defineProperty(this,"_valueFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valueFieldsF",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fieldsF",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valuesDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataChanged",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataGrouped",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"inited",{enumerable:!0,configurable:!0,writable:!0,value:!1})}set data(e){e.incrementRef(),this._data.decrementRef(),this._data=e}get data(){return this._data}_dispose(){super._dispose(),this._data.decrementRef()}_onDataClear(){}_afterNew(){super._afterNew(),this._data.incrementRef(),this._updateFields(),this._disposers.push(this.data.events.onAll(e=>{const t=this._mainDataItems;if(this.markDirtyValues(),this._markDirtyGroup(),this._dataChanged=!0,e.type==="clear")b(t,i=>{i.dispose()}),t.length=0,this._onDataClear();else if(e.type==="push"){const i=new V(this,e.newValue,this._makeDataItem(e.newValue));t.push(i),this.processDataItem(i)}else if(e.type==="setIndex"){const i=t[e.index],s=this._makeDataItem(e.newValue);i.bullets&&i.bullets.length==0&&(i.bullets=void 0),W(s).forEach(a=>{i.animate({key:a,to:s[a],duration:this.get("interpolationDuration",0),easing:this.get("interpolationEasing")})}),i.dataContext=e.newValue}else if(e.type==="insertIndex"){const i=new V(this,e.newValue,this._makeDataItem(e.newValue));t.splice(e.index,0,i),this.processDataItem(i)}else if(e.type==="removeIndex")t[e.index].dispose(),t.splice(e.index,1);else{if(e.type!=="moveIndex")throw new Error("Unknown IStreamEvent type");{const i=t[e.oldIndex];t.splice(e.oldIndex,1),t.splice(e.newIndex,0,i)}}this._afterDataChange()}))}_updateFields(){this.valueFields&&(this._valueFields=[],this._valueFieldsF={},b(this.valueFields,e=>{this.get(e+"Field")&&(this._valueFields.push(e),this._valueFieldsF[e]={fieldKey:e+"Field",workingKey:e+"Working"})})),this.fields&&(this._fields=[],this._fieldsF={},b(this.fields,e=>{this.get(e+"Field")&&(this._fields.push(e),this._fieldsF[e]=e+"Field")}))}get dataItems(){return this._dataItems}processDataItem(e){}_makeDataItem(e){const t={};return this._valueFields&&b(this._valueFields,i=>{const s=this.get(this._valueFieldsF[i].fieldKey);t[i]=e[s],t[this._valueFieldsF[i].workingKey]=t[i]}),this._fields&&b(this._fields,i=>{const s=this.get(this._fieldsF[i]);t[i]=e[s]}),t}makeDataItem(e){let t=new V(this,void 0,e);return this.processDataItem(t),t}pushDataItem(e){const t=this.makeDataItem(e);return this._mainDataItems.push(t),t}disposeDataItem(e){}showDataItem(e,t){return M(this,void 0,void 0,function*(){e.set("visible",!0)})}hideDataItem(e,t){return M(this,void 0,void 0,function*(){e.set("visible",!1)})}_clearDirty(){super._clearDirty(),this._valuesDirty=!1}_afterDataChange(){}_afterChanged(){if(super._afterChanged(),this._dataChanged){const e="datavalidated";this.events.isEnabled(e)&&this.events.dispatch(e,{type:e,target:this}),this._dataChanged=!1}this.inited=!0}markDirtyValues(e){this.markDirty(),this._valuesDirty=!0}_markDirtyGroup(){this._dataGrouped=!1}markDirtySize(){this._sizeDirty=!0,this.markDirty()}}function ie(l){return new Promise((e,t)=>{setTimeout(e,l)})}Object.defineProperty($,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Component"}),Object.defineProperty($,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:I.classNames.concat([$.className])});let se={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:2629742400,year:31536e6};function O(l,e){return e==null&&(e=1),se[l]*e}function z(l,e,t,i,s,a,n){if(!n||s){let o=0;switch(s||e=="millisecond"||(o=l.getTimezoneOffset(),l.setUTCMinutes(l.getUTCMinutes()-o)),e){case"day":let u=l.getUTCDate();if(t>1){if(a){a=z(a,"day",1);let y=l.getTime()-a.getTime(),w=Math.floor(y/O("day")/t),D=O("day",w*t);l.setTime(a.getTime()+D-o*O("minute"))}}else l.setUTCDate(u);l.setUTCHours(0,0,0,0);break;case"second":let h=l.getUTCSeconds();t>1&&(h=Math.floor(h/t)*t),l.setUTCSeconds(h,0);break;case"millisecond":if(t==1)return l;let c=l.getUTCMilliseconds();c=Math.floor(c/t)*t,l.setUTCMilliseconds(c);break;case"hour":let m=l.getUTCHours();t>1&&(m=Math.floor(m/t)*t),l.setUTCHours(m,0,0,0);break;case"minute":let d=l.getUTCMinutes();t>1&&(d=Math.floor(d/t)*t),l.setUTCMinutes(d,0,0);break;case"month":let r=l.getUTCMonth();t>1&&(r=Math.floor(r/t)*t),l.setUTCMonth(r,1),l.setUTCHours(0,0,0,0);break;case"year":let p=l.getUTCFullYear();t>1&&(p=Math.floor(p/t)*t),l.setUTCFullYear(p,0,1),l.setUTCHours(0,0,0,0);break;case"week":let g=l.getUTCDate(),f=l.getUTCDay();T(i)||(i=1),g=f>=i?g-f+i:g-(7+f)+i,l.setUTCDate(g),l.setUTCHours(0,0,0,0)}if(!s&&e!="millisecond"&&(l.setUTCMinutes(l.getUTCMinutes()+o),e=="day"||e=="week"||e=="month"||e=="year")){let u=l.getTimezoneOffset();if(u!=o){let h=u-o;l.setUTCMinutes(l.getUTCMinutes()+h)}}return l}{if(isNaN(l.getTime()))return l;let o=n.offsetUTC(l),u=l.getTimezoneOffset(),h=n.parseDate(l),c=h.year,m=h.month,d=h.day,r=h.hour,p=h.minute,g=h.second,f=h.millisecond,y=h.weekday;switch(e){case"day":if(t>1&&a){a=z(a,"day",1,i,s,void 0,n);let D=l.getTime()-a.getTime(),_=Math.floor(D/O("day")/t),C=O("day",_*t);l.setTime(a.getTime()+C),h=n.parseDate(l),c=h.year,m=h.month,d=h.day}r=0,p=o-u,g=0,f=0;break;case"second":p+=o-u,t>1&&(g=Math.floor(g/t)*t),f=0;break;case"millisecond":p+=o-u,t>1&&(f=Math.floor(f/t)*t);break;case"hour":t>1&&(r=Math.floor(r/t)*t),p=o-u,g=0,f=0;break;case"minute":t>1&&(p=Math.floor(p/t)*t),p+=o-u,g=0,f=0;break;case"month":t>1&&(m=Math.floor(m/t)*t),d=1,r=0,p=o-u,g=0,f=0;break;case"year":t>1&&(c=Math.floor(c/t)*t),m=0,d=1,r=0,p=o-u,g=0,f=0;break;case"week":T(i)||(i=1),d=y>=i?d-y+i:d-(7+y)+i,r=0,p=o-u,g=0,f=0}let w=(l=new Date(c,m,d,r,p,g,f)).getTimezoneOffset();return w!=u&&l.setTime(l.getTime()+6e4*(u-w)),l}}class N extends ${constructor(){super(...arguments),Object.defineProperty(this,"_aggregatesCalculated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_selectionAggregatesCalculated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataProcessed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_psi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pei",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bullets",{enumerable:!0,configurable:!0,writable:!0,value:new q}),Object.defineProperty(this,"bulletsContainer",{enumerable:!0,configurable:!0,writable:!0,value:I.new(this._root,{width:x,height:x,position:"absolute"})})}_afterNew(){this.valueFields.push("value"),super._afterNew(),this.setPrivate("customData",{}),this._disposers.push(this.bullets.events.onAll(e=>{if(e.type==="clear")this._handleBullets(this.dataItems);else if(e.type==="push")this._handleBullets(this.dataItems);else if(e.type==="setIndex")this._handleBullets(this.dataItems);else if(e.type==="insertIndex")this._handleBullets(this.dataItems);else if(e.type==="removeIndex")this._handleBullets(this.dataItems);else{if(e.type!=="moveIndex")throw new Error("Unknown IListEvent type");this._handleBullets(this.dataItems)}}))}_dispose(){this.bulletsContainer.dispose(),super._dispose()}startIndex(){let e=this.dataItems.length;return Math.min(this.getPrivate("startIndex",0),e)}endIndex(){let e=this.dataItems.length;return Math.min(this.getPrivate("endIndex",e),e)}_handleBullets(e){b(e,t=>{const i=t.bullets;i&&(b(i,s=>{s.dispose()}),t.bullets=void 0)}),this.markDirtyValues()}getDataItemById(e){return Y(this.dataItems,t=>t.get("id")==e)}_makeBullets(e){this._shouldMakeBullet(e)&&(e.bullets=[],this.bullets.each(t=>{this._makeBullet(e,t)}))}_shouldMakeBullet(e){return!0}_makeBullet(e,t,i){const s=t(this._root,this,e);if(s){let a=s.get("sprite");a&&(a._setDataItem(e),a.setRaw("position","absolute"),this.bulletsContainer.children.push(a)),s._index=i,s.series=this,e.bullets.push(s)}return s}_clearDirty(){super._clearDirty(),this._aggregatesCalculated=!1,this._selectionAggregatesCalculated=!1}_prepareChildren(){super._prepareChildren();let e=this.startIndex(),t=this.endIndex();if(this.isDirty("heatRules")&&(this._valuesDirty=!0),this.isPrivateDirty("baseValueSeries")){const i=this.getPrivate("baseValueSeries");i&&this._disposers.push(i.onPrivate("startIndex",()=>{this.markDirtyValues()}))}if(this.get("calculateAggregates")&&(this._valuesDirty&&!this._dataProcessed&&(this._aggregatesCalculated||(this._calculateAggregates(0,this.dataItems.length),this._aggregatesCalculated=!0)),this._psi==e&&this._pei==t||this._selectionAggregatesCalculated||(e===0&&t===this.dataItems.length&&this._aggregatesCalculated||this._calculateAggregates(e,t),this._selectionAggregatesCalculated=!0)),this.isDirty("tooltip")){let i=this.get("tooltip");i&&(i.hide(0),i.set("tooltipTarget",this))}if(this.isDirty("fill")||this.isDirty("stroke")){let i;const s=this.get("legendDataItem");if(s&&(i=s.get("markerRectangle"),i&&this.isVisible())){if(this.isDirty("stroke")){let a=this.get("stroke");i.set("stroke",a)}if(this.isDirty("fill")){let a=this.get("fill");i.set("fill",a)}}this.updateLegendMarker(void 0)}if(this.bullets.length>0){let i=this.startIndex(),s=this.endIndex();s{s[r]=0,a[r]=0,n[r]=0}),b(i,r=>{let p=r+"Change",g=r+"ChangePercent",f=r+"ChangePrevious",y=r+"ChangePreviousPercent",w=r+"ChangeSelection",D=r+"ChangeSelectionPercent",_="valueY";r!="valueX"&&r!="openValueX"&&r!="lowValueX"&&r!="highValueX"||(_="valueX");const C=this.getPrivate("baseValueSeries");for(let S=e;Sv||o[r]==null)&&(o[r]=v),(u[r]{this.setPrivate(r+"AverageSelection",m[r]),this.setPrivate(r+"CountSelection",n[r]),this.setPrivate(r+"SumSelection",s[r]),this.setPrivate(r+"AbsoluteSumSelection",a[r]),this.setPrivate(r+"LowSelection",o[r]),this.setPrivate(r+"HighSelection",u[r]),this.setPrivate(r+"OpenSelection",h[r]),this.setPrivate(r+"CloseSelection",c[r])}),e===0&&t===this.dataItems.length&&b(i,r=>{this.setPrivate(r+"Average",m[r]),this.setPrivate(r+"Count",n[r]),this.setPrivate(r+"Sum",s[r]),this.setPrivate(r+"AbsoluteSum",a[r]),this.setPrivate(r+"Low",o[r]),this.setPrivate(r+"High",u[r]),this.setPrivate(r+"Open",h[r]),this.setPrivate(r+"Close",c[r])})}_updateChildren(){super._updateChildren(),this._psi=this.startIndex(),this._pei=this.endIndex(),this.isDirty("visible")&&this.bulletsContainer.set("visible",this.get("visible"));const e=this.get("heatRules");if(this._valuesDirty&&e&&e.length>0&&b(e,t=>{const i=t.minValue||this.getPrivate(t.dataField+"Low")||0,s=t.maxValue||this.getPrivate(t.dataField+"High")||0;b(t.target._entities,a=>{const n=a.dataItem.get(t.dataField);if(T(n))if(t.customFunction)t.customFunction.call(this,a,i,s,n);else{let o,u;o=t.logarithmic?(Math.log(n)*Math.LOG10E-Math.log(i)*Math.LOG10E)/(Math.log(s)*Math.LOG10E-Math.log(i)*Math.LOG10E):(n-i)/(s-i),!T(n)||T(o)&&Math.abs(o)!=1/0||(o=.5),T(t.min)?u=t.min+(t.max-t.min)*o:t.min instanceof L?u=L.interpolate(o,t.min,t.max):t.min instanceof J&&(u=ee(o,t.min,t.max)),a.set(t.key,u)}else t.neutral&&a.set(t.key,t.neutral)})}),this.get("visible")&&this.bullets.length>0){let t=this.dataItems.length,i=this.startIndex(),s=this.endIndex();s0&&i--;for(let a=0;a{this._positionBullet(t);const i=t.get("sprite");t.get("dynamic")&&(i&&(i._markDirtyKey("fill"),i.markDirtySize()),i instanceof I&&i.walkChildren(s=>{s._markDirtyKey("fill"),s.markDirtySize(),s instanceof E&&s.text.markDirtyText()})),i instanceof E&&i.get("populateText")&&i.text.markDirtyText()})}_hideBullets(e){e.bullets&&b(e.bullets,t=>{let i=t.get("sprite");i&&i.setPrivate("visible",!1)})}_positionBullet(e){}_placeBulletsContainer(e){e.bulletsContainer.children.moveValue(this.bulletsContainer)}_removeBulletsContainer(){const e=this.bulletsContainer;e.parent&&e.parent.children.removeValue(e)}disposeDataItem(e){const t=e.bullets;t&&b(t,i=>{i.dispose()})}_getItemReaderLabel(){return""}showDataItem(e,t){const i=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return M(this,void 0,void 0,function*(){const s=[i.showDataItem.call(this,e,t)],a=e.bullets;a&&b(a,n=>{s.push(n.get("sprite").show(t))}),yield Promise.all(s)})}hideDataItem(e,t){const i=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return M(this,void 0,void 0,function*(){const s=[i.hideDataItem.call(this,e,t)],a=e.bullets;a&&b(a,n=>{s.push(n.get("sprite").hide(t))}),yield Promise.all(s)})}_sequencedShowHide(e,t){return M(this,void 0,void 0,function*(){if(this.get("sequencedInterpolation"))if(T(t)||(t=this.get("interpolationDuration",0)),t>0){const i=this.startIndex(),s=this.endIndex();yield Promise.all(H(this.dataItems,(a,n)=>M(this,void 0,void 0,function*(){let o=t||0;(ns+10)&&(o=0);let u=this.get("sequencedDelay",0)+o/(s-i);yield ie(u*(n-i)),e?yield this.showDataItem(a,o):yield this.hideDataItem(a,o)})))}else yield Promise.all(H(this.dataItems,i=>e?this.showDataItem(i,0):this.hideDataItem(i,0)))})}updateLegendValue(e){if(e){const t=e.get("legendDataItem");if(t){const i=t.get("valueLabel");if(i){const a=i.text;let n="";i._setDataItem(e),n=this.get("legendValueText",a.get("text","")),i.set("text",n),a.markDirtyText()}const s=t.get("label");if(s){const a=s.text;let n="";s._setDataItem(e),n=this.get("legendLabelText",a.get("text","")),s.set("text",n),a.markDirtyText()}}}}updateLegendMarker(e){}_onHide(){super._onHide();const e=this.getTooltip();e&&e.hide()}hoverDataItem(e){}unhoverDataItem(e){}_getBase(e){const t=this.dataItems[this.startIndex()];return t?t.get(e):0}}function G(l,e){for(let t=0,i=e.length;t0){let a=s[0];if(a.length>0){let n=a[0];l.moveTo(n.x,n.y);for(let o=0,u=s.length;o0){let i=e[0];this._display.moveTo(i.x,i.y),G(this._display,[[e]])}else if(t)G(this._display,t);else if(!this.get("draw")){let i=this.width(),s=this.height();this._display.moveTo(0,0),this._display.lineTo(i,s)}}}}function ue(l){return function(){return l}}Object.defineProperty(j,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Line"}),Object.defineProperty(j,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:K.classNames.concat([j.className])});const R=Math.PI,A=2*R,k=1e-6,re=A-k;function X(l){this._+=l[0];for(let e=1,t=l.length;e=0))throw new Error(`invalid digits: ${l}`);if(e>15)return X;const t=10**e;return function(i){this._+=i[0];for(let s=1,a=i.length;sk)if(Math.abs(m*u-h*c)>k&&a){let r=i-n,p=s-o,g=u*u+h*h,f=r*r+p*p,y=Math.sqrt(g),w=Math.sqrt(d),D=a*Math.tan((R-Math.acos((g+d-f)/(2*y*w)))/2),_=D/w,C=D/y;Math.abs(_-1)>k&&this._append`L${e+_*c},${t+_*m}`,this._append`A${a},${a},0,0,${+(m*r>c*p)},${this._x1=e+C*u},${this._y1=t+C*h}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,i,s,a,n){if(e=+e,t=+t,n=!!n,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=i*Math.cos(s),u=i*Math.sin(s),h=e+o,c=t+u,m=1^n,d=n?s-a:a-s;this._x1===null?this._append`M${h},${c}`:(Math.abs(this._x1-h)>k||Math.abs(this._y1-c)>k)&&this._append`L${h},${c}`,i&&(d<0&&(d=d%A+A),d>re?this._append`A${i},${i},0,1,${m},${e-o},${t-u}A${i},${i},0,1,${m},${this._x1=h},${this._y1=c}`:d>k&&this._append`A${i},${i},0,${+(d>=R)},${m},${this._x1=e+i*Math.cos(a)},${this._y1=t+i*Math.sin(a)}`)}rect(e,t,i,s){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${i=+i}v${+s}h${-i}Z`}toString(){return this._}}function de(l){let e=3;return l.digits=function(t){if(!arguments.length)return e;if(t==null)e=null;else{const i=Math.floor(t);if(!(i>=0))throw new RangeError(`invalid digits: ${t}`);e=i}return l},()=>new ne(e)}class F extends I{constructor(){super(...arguments),Object.defineProperty(this,"chartContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(I.new(this._root,{width:x,height:x,interactiveChildren:!1}))}),Object.defineProperty(this,"bulletsContainer",{enumerable:!0,configurable:!0,writable:!0,value:I.new(this._root,{interactiveChildren:!1,isMeasured:!1,position:"absolute",width:x,height:x})})}}Object.defineProperty(F,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Chart"}),Object.defineProperty(F,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:I.classNames.concat([F.className])});class U extends F{constructor(){super(...arguments),Object.defineProperty(this,"seriesContainer",{enumerable:!0,configurable:!0,writable:!0,value:I.new(this._root,{width:x,height:x,isMeasured:!1})}),Object.defineProperty(this,"series",{enumerable:!0,configurable:!0,writable:!0,value:new Z})}_afterNew(){super._afterNew(),this._disposers.push(this.series);const e=this.seriesContainer.children;this._disposers.push(this.series.events.onAll(t=>{if(t.type==="clear"){b(t.oldValues,s=>{this._removeSeries(s)});const i=this.get("colors");i&&i.reset()}else if(t.type==="push")e.moveValue(t.newValue),this._processSeries(t.newValue);else if(t.type==="setIndex")e.setIndex(t.index,t.newValue),this._processSeries(t.newValue);else if(t.type==="insertIndex")e.insertIndex(t.index,t.newValue),this._processSeries(t.newValue);else if(t.type==="removeIndex")this._removeSeries(t.oldValue);else{if(t.type!=="moveIndex")throw new Error("Unknown IListEvent type");e.moveValue(t.value,t.newIndex),this._processSeries(t.value)}}))}_processSeries(e){e.chart=this,e._placeBulletsContainer(this)}_removeSeries(e){e.isDisposed()||(this.seriesContainer.children.removeValue(e),e._removeBulletsContainer())}}Object.defineProperty(U,"className",{enumerable:!0,configurable:!0,writable:!0,value:"SerialChart"}),Object.defineProperty(U,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:F.classNames.concat([U.className])});class B extends j{}Object.defineProperty(B,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Tick"}),Object.defineProperty(B,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:j.classNames.concat([B.className])});export{B,N as D,z as I,U,de as V,$ as _,V as g,ue as k}; +import{d1 as M}from"./index-pCX-0tJH.js";import{Q as I,W as K,m as b,$ as W,F as q,Y as x,S as Y,a as Z,I as Q,l as T,Z as L,K as J,L as ee,e as E,_ as H}from"./Theme-5CV7oVsW.js";class te extends q{constructor(){super(...arguments),Object.defineProperty(this,"processor",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}incrementRef(){}decrementRef(){}_onPush(e){this.processor&&this.processor.processRow(e),super._onPush(e)}_onInsertIndex(e,t){this.processor&&this.processor.processRow(t),super._onInsertIndex(e,t)}_onSetIndex(e,t,i){this.processor&&this.processor.processRow(i),super._onSetIndex(e,t,i)}}class V extends Q{constructor(e,t,i){super(i),Object.defineProperty(this,"component",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dataContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bullets",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"open",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"close",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.dataContext=t,this.component=e,this._settings.visible=!0,this._checkDirty()}markDirty(){this.component.markDirtyValues(this)}_startAnimation(){this.component._root._addAnimation(this)}_animationTime(){return this.component._root.animationTime}_dispose(){this.component&&this.component.disposeDataItem(this),super._dispose()}show(e){this.setRaw("visible",!0),this.component&&this.component.showDataItem(this,e)}hide(e){this.setRaw("visible",!1),this.component&&this.component.hideDataItem(this,e)}isHidden(){return!this.get("visible")}}class $ extends I{constructor(){super(...arguments),Object.defineProperty(this,"_data",{enumerable:!0,configurable:!0,writable:!0,value:new te}),Object.defineProperty(this,"_dataItems",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_mainDataItems",{enumerable:!0,configurable:!0,writable:!0,value:this._dataItems}),Object.defineProperty(this,"valueFields",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"fields",{enumerable:!0,configurable:!0,writable:!0,value:["id"]}),Object.defineProperty(this,"_valueFields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valueFieldsF",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fieldsF",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_valuesDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataChanged",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataGrouped",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"inited",{enumerable:!0,configurable:!0,writable:!0,value:!1})}set data(e){e.incrementRef(),this._data.decrementRef(),this._data=e}get data(){return this._data}_dispose(){super._dispose(),this._data.decrementRef()}_onDataClear(){}_afterNew(){super._afterNew(),this._data.incrementRef(),this._updateFields(),this._disposers.push(this.data.events.onAll(e=>{const t=this._mainDataItems;if(this.markDirtyValues(),this._markDirtyGroup(),this._dataChanged=!0,e.type==="clear")b(t,i=>{i.dispose()}),t.length=0,this._onDataClear();else if(e.type==="push"){const i=new V(this,e.newValue,this._makeDataItem(e.newValue));t.push(i),this.processDataItem(i)}else if(e.type==="setIndex"){const i=t[e.index],s=this._makeDataItem(e.newValue);i.bullets&&i.bullets.length==0&&(i.bullets=void 0),W(s).forEach(a=>{i.animate({key:a,to:s[a],duration:this.get("interpolationDuration",0),easing:this.get("interpolationEasing")})}),i.dataContext=e.newValue}else if(e.type==="insertIndex"){const i=new V(this,e.newValue,this._makeDataItem(e.newValue));t.splice(e.index,0,i),this.processDataItem(i)}else if(e.type==="removeIndex")t[e.index].dispose(),t.splice(e.index,1);else{if(e.type!=="moveIndex")throw new Error("Unknown IStreamEvent type");{const i=t[e.oldIndex];t.splice(e.oldIndex,1),t.splice(e.newIndex,0,i)}}this._afterDataChange()}))}_updateFields(){this.valueFields&&(this._valueFields=[],this._valueFieldsF={},b(this.valueFields,e=>{this.get(e+"Field")&&(this._valueFields.push(e),this._valueFieldsF[e]={fieldKey:e+"Field",workingKey:e+"Working"})})),this.fields&&(this._fields=[],this._fieldsF={},b(this.fields,e=>{this.get(e+"Field")&&(this._fields.push(e),this._fieldsF[e]=e+"Field")}))}get dataItems(){return this._dataItems}processDataItem(e){}_makeDataItem(e){const t={};return this._valueFields&&b(this._valueFields,i=>{const s=this.get(this._valueFieldsF[i].fieldKey);t[i]=e[s],t[this._valueFieldsF[i].workingKey]=t[i]}),this._fields&&b(this._fields,i=>{const s=this.get(this._fieldsF[i]);t[i]=e[s]}),t}makeDataItem(e){let t=new V(this,void 0,e);return this.processDataItem(t),t}pushDataItem(e){const t=this.makeDataItem(e);return this._mainDataItems.push(t),t}disposeDataItem(e){}showDataItem(e,t){return M(this,void 0,void 0,function*(){e.set("visible",!0)})}hideDataItem(e,t){return M(this,void 0,void 0,function*(){e.set("visible",!1)})}_clearDirty(){super._clearDirty(),this._valuesDirty=!1}_afterDataChange(){}_afterChanged(){if(super._afterChanged(),this._dataChanged){const e="datavalidated";this.events.isEnabled(e)&&this.events.dispatch(e,{type:e,target:this}),this._dataChanged=!1}this.inited=!0}markDirtyValues(e){this.markDirty(),this._valuesDirty=!0}_markDirtyGroup(){this._dataGrouped=!1}markDirtySize(){this._sizeDirty=!0,this.markDirty()}}function ie(l){return new Promise((e,t)=>{setTimeout(e,l)})}Object.defineProperty($,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Component"}),Object.defineProperty($,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:I.classNames.concat([$.className])});let se={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:2629742400,year:31536e6};function O(l,e){return e==null&&(e=1),se[l]*e}function z(l,e,t,i,s,a,n){if(!n||s){let o=0;switch(s||e=="millisecond"||(o=l.getTimezoneOffset(),l.setUTCMinutes(l.getUTCMinutes()-o)),e){case"day":let u=l.getUTCDate();if(t>1){if(a){a=z(a,"day",1);let y=l.getTime()-a.getTime(),w=Math.floor(y/O("day")/t),D=O("day",w*t);l.setTime(a.getTime()+D-o*O("minute"))}}else l.setUTCDate(u);l.setUTCHours(0,0,0,0);break;case"second":let h=l.getUTCSeconds();t>1&&(h=Math.floor(h/t)*t),l.setUTCSeconds(h,0);break;case"millisecond":if(t==1)return l;let c=l.getUTCMilliseconds();c=Math.floor(c/t)*t,l.setUTCMilliseconds(c);break;case"hour":let m=l.getUTCHours();t>1&&(m=Math.floor(m/t)*t),l.setUTCHours(m,0,0,0);break;case"minute":let d=l.getUTCMinutes();t>1&&(d=Math.floor(d/t)*t),l.setUTCMinutes(d,0,0);break;case"month":let r=l.getUTCMonth();t>1&&(r=Math.floor(r/t)*t),l.setUTCMonth(r,1),l.setUTCHours(0,0,0,0);break;case"year":let p=l.getUTCFullYear();t>1&&(p=Math.floor(p/t)*t),l.setUTCFullYear(p,0,1),l.setUTCHours(0,0,0,0);break;case"week":let g=l.getUTCDate(),f=l.getUTCDay();T(i)||(i=1),g=f>=i?g-f+i:g-(7+f)+i,l.setUTCDate(g),l.setUTCHours(0,0,0,0)}if(!s&&e!="millisecond"&&(l.setUTCMinutes(l.getUTCMinutes()+o),e=="day"||e=="week"||e=="month"||e=="year")){let u=l.getTimezoneOffset();if(u!=o){let h=u-o;l.setUTCMinutes(l.getUTCMinutes()+h)}}return l}{if(isNaN(l.getTime()))return l;let o=n.offsetUTC(l),u=l.getTimezoneOffset(),h=n.parseDate(l),c=h.year,m=h.month,d=h.day,r=h.hour,p=h.minute,g=h.second,f=h.millisecond,y=h.weekday;switch(e){case"day":if(t>1&&a){a=z(a,"day",1,i,s,void 0,n);let D=l.getTime()-a.getTime(),_=Math.floor(D/O("day")/t),C=O("day",_*t);l.setTime(a.getTime()+C),h=n.parseDate(l),c=h.year,m=h.month,d=h.day}r=0,p=o-u,g=0,f=0;break;case"second":p+=o-u,t>1&&(g=Math.floor(g/t)*t),f=0;break;case"millisecond":p+=o-u,t>1&&(f=Math.floor(f/t)*t);break;case"hour":t>1&&(r=Math.floor(r/t)*t),p=o-u,g=0,f=0;break;case"minute":t>1&&(p=Math.floor(p/t)*t),p+=o-u,g=0,f=0;break;case"month":t>1&&(m=Math.floor(m/t)*t),d=1,r=0,p=o-u,g=0,f=0;break;case"year":t>1&&(c=Math.floor(c/t)*t),m=0,d=1,r=0,p=o-u,g=0,f=0;break;case"week":T(i)||(i=1),d=y>=i?d-y+i:d-(7+y)+i,r=0,p=o-u,g=0,f=0}let w=(l=new Date(c,m,d,r,p,g,f)).getTimezoneOffset();return w!=u&&l.setTime(l.getTime()+6e4*(u-w)),l}}class N extends ${constructor(){super(...arguments),Object.defineProperty(this,"_aggregatesCalculated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_selectionAggregatesCalculated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dataProcessed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_psi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pei",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chart",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bullets",{enumerable:!0,configurable:!0,writable:!0,value:new q}),Object.defineProperty(this,"bulletsContainer",{enumerable:!0,configurable:!0,writable:!0,value:I.new(this._root,{width:x,height:x,position:"absolute"})})}_afterNew(){this.valueFields.push("value"),super._afterNew(),this.setPrivate("customData",{}),this._disposers.push(this.bullets.events.onAll(e=>{if(e.type==="clear")this._handleBullets(this.dataItems);else if(e.type==="push")this._handleBullets(this.dataItems);else if(e.type==="setIndex")this._handleBullets(this.dataItems);else if(e.type==="insertIndex")this._handleBullets(this.dataItems);else if(e.type==="removeIndex")this._handleBullets(this.dataItems);else{if(e.type!=="moveIndex")throw new Error("Unknown IListEvent type");this._handleBullets(this.dataItems)}}))}_dispose(){this.bulletsContainer.dispose(),super._dispose()}startIndex(){let e=this.dataItems.length;return Math.min(this.getPrivate("startIndex",0),e)}endIndex(){let e=this.dataItems.length;return Math.min(this.getPrivate("endIndex",e),e)}_handleBullets(e){b(e,t=>{const i=t.bullets;i&&(b(i,s=>{s.dispose()}),t.bullets=void 0)}),this.markDirtyValues()}getDataItemById(e){return Y(this.dataItems,t=>t.get("id")==e)}_makeBullets(e){this._shouldMakeBullet(e)&&(e.bullets=[],this.bullets.each(t=>{this._makeBullet(e,t)}))}_shouldMakeBullet(e){return!0}_makeBullet(e,t,i){const s=t(this._root,this,e);if(s){let a=s.get("sprite");a&&(a._setDataItem(e),a.setRaw("position","absolute"),this.bulletsContainer.children.push(a)),s._index=i,s.series=this,e.bullets.push(s)}return s}_clearDirty(){super._clearDirty(),this._aggregatesCalculated=!1,this._selectionAggregatesCalculated=!1}_prepareChildren(){super._prepareChildren();let e=this.startIndex(),t=this.endIndex();if(this.isDirty("heatRules")&&(this._valuesDirty=!0),this.isPrivateDirty("baseValueSeries")){const i=this.getPrivate("baseValueSeries");i&&this._disposers.push(i.onPrivate("startIndex",()=>{this.markDirtyValues()}))}if(this.get("calculateAggregates")&&(this._valuesDirty&&!this._dataProcessed&&(this._aggregatesCalculated||(this._calculateAggregates(0,this.dataItems.length),this._aggregatesCalculated=!0)),this._psi==e&&this._pei==t||this._selectionAggregatesCalculated||(e===0&&t===this.dataItems.length&&this._aggregatesCalculated||this._calculateAggregates(e,t),this._selectionAggregatesCalculated=!0)),this.isDirty("tooltip")){let i=this.get("tooltip");i&&(i.hide(0),i.set("tooltipTarget",this))}if(this.isDirty("fill")||this.isDirty("stroke")){let i;const s=this.get("legendDataItem");if(s&&(i=s.get("markerRectangle"),i&&this.isVisible())){if(this.isDirty("stroke")){let a=this.get("stroke");i.set("stroke",a)}if(this.isDirty("fill")){let a=this.get("fill");i.set("fill",a)}}this.updateLegendMarker(void 0)}if(this.bullets.length>0){let i=this.startIndex(),s=this.endIndex();s{s[r]=0,a[r]=0,n[r]=0}),b(i,r=>{let p=r+"Change",g=r+"ChangePercent",f=r+"ChangePrevious",y=r+"ChangePreviousPercent",w=r+"ChangeSelection",D=r+"ChangeSelectionPercent",_="valueY";r!="valueX"&&r!="openValueX"&&r!="lowValueX"&&r!="highValueX"||(_="valueX");const C=this.getPrivate("baseValueSeries");for(let S=e;Sv||o[r]==null)&&(o[r]=v),(u[r]{this.setPrivate(r+"AverageSelection",m[r]),this.setPrivate(r+"CountSelection",n[r]),this.setPrivate(r+"SumSelection",s[r]),this.setPrivate(r+"AbsoluteSumSelection",a[r]),this.setPrivate(r+"LowSelection",o[r]),this.setPrivate(r+"HighSelection",u[r]),this.setPrivate(r+"OpenSelection",h[r]),this.setPrivate(r+"CloseSelection",c[r])}),e===0&&t===this.dataItems.length&&b(i,r=>{this.setPrivate(r+"Average",m[r]),this.setPrivate(r+"Count",n[r]),this.setPrivate(r+"Sum",s[r]),this.setPrivate(r+"AbsoluteSum",a[r]),this.setPrivate(r+"Low",o[r]),this.setPrivate(r+"High",u[r]),this.setPrivate(r+"Open",h[r]),this.setPrivate(r+"Close",c[r])})}_updateChildren(){super._updateChildren(),this._psi=this.startIndex(),this._pei=this.endIndex(),this.isDirty("visible")&&this.bulletsContainer.set("visible",this.get("visible"));const e=this.get("heatRules");if(this._valuesDirty&&e&&e.length>0&&b(e,t=>{const i=t.minValue||this.getPrivate(t.dataField+"Low")||0,s=t.maxValue||this.getPrivate(t.dataField+"High")||0;b(t.target._entities,a=>{const n=a.dataItem.get(t.dataField);if(T(n))if(t.customFunction)t.customFunction.call(this,a,i,s,n);else{let o,u;o=t.logarithmic?(Math.log(n)*Math.LOG10E-Math.log(i)*Math.LOG10E)/(Math.log(s)*Math.LOG10E-Math.log(i)*Math.LOG10E):(n-i)/(s-i),!T(n)||T(o)&&Math.abs(o)!=1/0||(o=.5),T(t.min)?u=t.min+(t.max-t.min)*o:t.min instanceof L?u=L.interpolate(o,t.min,t.max):t.min instanceof J&&(u=ee(o,t.min,t.max)),a.set(t.key,u)}else t.neutral&&a.set(t.key,t.neutral)})}),this.get("visible")&&this.bullets.length>0){let t=this.dataItems.length,i=this.startIndex(),s=this.endIndex();s0&&i--;for(let a=0;a{this._positionBullet(t);const i=t.get("sprite");t.get("dynamic")&&(i&&(i._markDirtyKey("fill"),i.markDirtySize()),i instanceof I&&i.walkChildren(s=>{s._markDirtyKey("fill"),s.markDirtySize(),s instanceof E&&s.text.markDirtyText()})),i instanceof E&&i.get("populateText")&&i.text.markDirtyText()})}_hideBullets(e){e.bullets&&b(e.bullets,t=>{let i=t.get("sprite");i&&i.setPrivate("visible",!1)})}_positionBullet(e){}_placeBulletsContainer(e){e.bulletsContainer.children.moveValue(this.bulletsContainer)}_removeBulletsContainer(){const e=this.bulletsContainer;e.parent&&e.parent.children.removeValue(e)}disposeDataItem(e){const t=e.bullets;t&&b(t,i=>{i.dispose()})}_getItemReaderLabel(){return""}showDataItem(e,t){const i=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return M(this,void 0,void 0,function*(){const s=[i.showDataItem.call(this,e,t)],a=e.bullets;a&&b(a,n=>{s.push(n.get("sprite").show(t))}),yield Promise.all(s)})}hideDataItem(e,t){const i=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return M(this,void 0,void 0,function*(){const s=[i.hideDataItem.call(this,e,t)],a=e.bullets;a&&b(a,n=>{s.push(n.get("sprite").hide(t))}),yield Promise.all(s)})}_sequencedShowHide(e,t){return M(this,void 0,void 0,function*(){if(this.get("sequencedInterpolation"))if(T(t)||(t=this.get("interpolationDuration",0)),t>0){const i=this.startIndex(),s=this.endIndex();yield Promise.all(H(this.dataItems,(a,n)=>M(this,void 0,void 0,function*(){let o=t||0;(ns+10)&&(o=0);let u=this.get("sequencedDelay",0)+o/(s-i);yield ie(u*(n-i)),e?yield this.showDataItem(a,o):yield this.hideDataItem(a,o)})))}else yield Promise.all(H(this.dataItems,i=>e?this.showDataItem(i,0):this.hideDataItem(i,0)))})}updateLegendValue(e){if(e){const t=e.get("legendDataItem");if(t){const i=t.get("valueLabel");if(i){const a=i.text;let n="";i._setDataItem(e),n=this.get("legendValueText",a.get("text","")),i.set("text",n),a.markDirtyText()}const s=t.get("label");if(s){const a=s.text;let n="";s._setDataItem(e),n=this.get("legendLabelText",a.get("text","")),s.set("text",n),a.markDirtyText()}}}}updateLegendMarker(e){}_onHide(){super._onHide();const e=this.getTooltip();e&&e.hide()}hoverDataItem(e){}unhoverDataItem(e){}_getBase(e){const t=this.dataItems[this.startIndex()];return t?t.get(e):0}}function G(l,e){for(let t=0,i=e.length;t0){let a=s[0];if(a.length>0){let n=a[0];l.moveTo(n.x,n.y);for(let o=0,u=s.length;o0){let i=e[0];this._display.moveTo(i.x,i.y),G(this._display,[[e]])}else if(t)G(this._display,t);else if(!this.get("draw")){let i=this.width(),s=this.height();this._display.moveTo(0,0),this._display.lineTo(i,s)}}}}function ue(l){return function(){return l}}Object.defineProperty(j,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Line"}),Object.defineProperty(j,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:K.classNames.concat([j.className])});const R=Math.PI,A=2*R,k=1e-6,re=A-k;function X(l){this._+=l[0];for(let e=1,t=l.length;e=0))throw new Error(`invalid digits: ${l}`);if(e>15)return X;const t=10**e;return function(i){this._+=i[0];for(let s=1,a=i.length;sk)if(Math.abs(m*u-h*c)>k&&a){let r=i-n,p=s-o,g=u*u+h*h,f=r*r+p*p,y=Math.sqrt(g),w=Math.sqrt(d),D=a*Math.tan((R-Math.acos((g+d-f)/(2*y*w)))/2),_=D/w,C=D/y;Math.abs(_-1)>k&&this._append`L${e+_*c},${t+_*m}`,this._append`A${a},${a},0,0,${+(m*r>c*p)},${this._x1=e+C*u},${this._y1=t+C*h}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,i,s,a,n){if(e=+e,t=+t,n=!!n,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=i*Math.cos(s),u=i*Math.sin(s),h=e+o,c=t+u,m=1^n,d=n?s-a:a-s;this._x1===null?this._append`M${h},${c}`:(Math.abs(this._x1-h)>k||Math.abs(this._y1-c)>k)&&this._append`L${h},${c}`,i&&(d<0&&(d=d%A+A),d>re?this._append`A${i},${i},0,1,${m},${e-o},${t-u}A${i},${i},0,1,${m},${this._x1=h},${this._y1=c}`:d>k&&this._append`A${i},${i},0,${+(d>=R)},${m},${this._x1=e+i*Math.cos(a)},${this._y1=t+i*Math.sin(a)}`)}rect(e,t,i,s){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${i=+i}v${+s}h${-i}Z`}toString(){return this._}}function de(l){let e=3;return l.digits=function(t){if(!arguments.length)return e;if(t==null)e=null;else{const i=Math.floor(t);if(!(i>=0))throw new RangeError(`invalid digits: ${t}`);e=i}return l},()=>new ne(e)}class F extends I{constructor(){super(...arguments),Object.defineProperty(this,"chartContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(I.new(this._root,{width:x,height:x,interactiveChildren:!1}))}),Object.defineProperty(this,"bulletsContainer",{enumerable:!0,configurable:!0,writable:!0,value:I.new(this._root,{interactiveChildren:!1,isMeasured:!1,position:"absolute",width:x,height:x})})}}Object.defineProperty(F,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Chart"}),Object.defineProperty(F,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:I.classNames.concat([F.className])});class U extends F{constructor(){super(...arguments),Object.defineProperty(this,"seriesContainer",{enumerable:!0,configurable:!0,writable:!0,value:I.new(this._root,{width:x,height:x,isMeasured:!1})}),Object.defineProperty(this,"series",{enumerable:!0,configurable:!0,writable:!0,value:new Z})}_afterNew(){super._afterNew(),this._disposers.push(this.series);const e=this.seriesContainer.children;this._disposers.push(this.series.events.onAll(t=>{if(t.type==="clear"){b(t.oldValues,s=>{this._removeSeries(s)});const i=this.get("colors");i&&i.reset()}else if(t.type==="push")e.moveValue(t.newValue),this._processSeries(t.newValue);else if(t.type==="setIndex")e.setIndex(t.index,t.newValue),this._processSeries(t.newValue);else if(t.type==="insertIndex")e.insertIndex(t.index,t.newValue),this._processSeries(t.newValue);else if(t.type==="removeIndex")this._removeSeries(t.oldValue);else{if(t.type!=="moveIndex")throw new Error("Unknown IListEvent type");e.moveValue(t.value,t.newIndex),this._processSeries(t.value)}}))}_processSeries(e){e.chart=this,e._placeBulletsContainer(this)}_removeSeries(e){e.isDisposed()||(this.seriesContainer.children.removeValue(e),e._removeBulletsContainer())}}Object.defineProperty(U,"className",{enumerable:!0,configurable:!0,writable:!0,value:"SerialChart"}),Object.defineProperty(U,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:F.classNames.concat([U.className])});class B extends j{}Object.defineProperty(B,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Tick"}),Object.defineProperty(B,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:j.classNames.concat([B.className])});export{B,N as D,z as I,U,de as V,$ as _,V as g,ue as k}; diff --git a/dist/assets/TileLayer-RB9GhSe4.js b/dist/assets/TileLayer-RB9GhSe4.js new file mode 100644 index 0000000..43b9786 --- /dev/null +++ b/dist/assets/TileLayer-RB9GhSe4.js @@ -0,0 +1 @@ +import{dF as _,dJ as S,eY as T,dH as b,dI as w,ef as $,dK as O,dG as R,eg as W,dL as U,d2 as m,au as j,av as u,eZ as f,e_ as I,ep as L,r as d,df as P,dv as A,e$ as B,f0 as M,e as i,y as o,dt as N,du as C,f1 as k,dR as D,c as J,aI as G}from"./index-pCX-0tJH.js";import{E as q,f as E,X as V}from"./SublayersOwner-Hx1szNtg.js";import{o as K}from"./CustomParametersMixin-7nmugR3Y.js";import"./QueryTask-Di0fqnMV.js";import"./executeForIds-PXSIkRGk.js";import"./executeQueryPBF-P21isUTI.js";import"./FeatureType-0WPvBvpQ.js";import"./FeatureTemplate-vSzbyslg.js";import"./serviceCapabilitiesUtils-f-iBP4uh.js";var y;const v=["Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Elevation/World_Hillshade","Elevation/World_Hillshade_Dark","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Ocean_Basemap","Reference/World_Boundaries_and_Places","Reference/World_Boundaries_and_Places_Alternate","Reference/World_Transportation","World_Imagery","World_Street_Map","World_Topo_Map"];let s=y=class extends _(S(q(T(E(b(w($(O(R(W(K(G)))))))))))){constructor(...e){super(...e),this.listMode="show",this.isReference=null,this.operationalLayerType="ArcGISTiledMapServiceLayer",this.resampling=!0,this.sourceJSON=null,this.spatialReference=null,this.path=null,this.sublayers=null,this.type="tile",this.url=null}normalizeCtorArgs(e,r){return typeof e=="string"?{url:e,...r}:e}load(e){const r=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service"]},e).catch(U).then(()=>this._fetchService(r))),Promise.resolve(this)}get attributionDataUrl(){var r;const e=(r=this.parsedUrl)==null?void 0:r.path.toLowerCase();return e?this._getDefaultAttribution(this._getMapName(e)):null}readSpatialReference(e,r){var t;return(e=e||((t=r.tileInfo)==null?void 0:t.spatialReference))&&m.fromJSON(e)}writeSublayers(e,r,t,a){if(!this.loaded||!e)return;const p=e.slice().reverse().flatten(({sublayers:l})=>l&&l.toArray().reverse()).toArray(),n=[],c={writeSublayerStructure:!1,...a};p.forEach(l=>{const h=l.write({},c);n.push(h)}),n.some(l=>Object.keys(l).length>1)&&(r.layers=n)}get tileServers(){var e;return this._getDefaultTileServers((e=this.parsedUrl)==null?void 0:e.path)}castTileServers(e){return Array.isArray(e)?e.map(r=>j(r).path):null}fetchTile(e,r,t,a={}){const{signal:p}=a,n=this.getTileUrl(e,r,t),c={responseType:"image",signal:p,query:{...this.refreshParameters}};return u(n,c).then(l=>l.data)}async fetchImageBitmapTile(e,r,t,a={}){const{signal:p}=a;if(this.fetchTile!==y.prototype.fetchTile){const h=await this.fetchTile(e,r,t,a);return f(h,e,r,t,p)}const n=this.getTileUrl(e,r,t),c={responseType:"blob",signal:p,query:{...this.refreshParameters}},{data:l}=await u(n,c);return f(l,e,r,t,p)}getTileUrl(e,r,t){var c,l;const a=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,p=I({...(c=this.parsedUrl)==null?void 0:c.query,blankTile:!a&&null,...this.customParameters,token:this.apiKey}),n=this.tileServers;return`${n&&n.length?n[r%n.length]:(l=this.parsedUrl)==null?void 0:l.path}/tile/${e}/${r}/${t}${p?"?"+p:""}`}loadAll(){return L(this,e=>{e(this.allSublayers)})}_fetchService(e){return new Promise((r,t)=>{if(this.sourceJSON){if(this.sourceJSON.bandCount!=null&&this.sourceJSON.pixelSizeX!=null)throw new d("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");return void r({data:this.sourceJSON})}if(!this.parsedUrl)throw new d("tile-layer:undefined-url","layer's url is not defined");const a=P(this.parsedUrl.path);if(a!=null&&a.serverType==="ImageServer")throw new d("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");u(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then(r,t)}).then(r=>{let t=this.url;if(r.ssl&&(t=this.url=t.replace(/^http:/i,"https:")),this.sourceJSON=r.data,this.read(r.data,{origin:"service",url:this.parsedUrl}),this.version===10.1&&!A(t))return this._fetchServerVersion(t,e).then(a=>{this.read({currentVersion:a})}).catch(()=>{})})}_fetchServerVersion(e,r){if(!B(e))return Promise.reject();const t=e.replace(/(.*\/rest)\/.*/i,"$1")+"/info";return u(t,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:r}).then(a=>{if(a.data&&a.data.currentVersion)return a.data.currentVersion;throw new d("tile-layer:version-not-available")})}_getMapName(e){const r=e.match(/^(?:https?:)?\/\/(server\.arcgisonline\.com|services\.arcgisonline\.com|ibasemaps-api\.arcgis\.com)\/arcgis\/rest\/services\/([^\/]+(\/[^\/]+)*)\/mapserver/i);return r?r[2]:void 0}_getDefaultAttribution(e){if(e==null)return null;let r;e=e.toLowerCase();for(let t=0,a=v.length;t({enabled:!1})}}})],s.prototype,"isReference",void 0),i([o({readOnly:!0,type:["ArcGISTiledMapServiceLayer"]})],s.prototype,"operationalLayerType",void 0),i([o({type:Boolean})],s.prototype,"resampling",void 0),i([o()],s.prototype,"sourceJSON",void 0),i([o({type:m})],s.prototype,"spatialReference",void 0),i([N("spatialReference",["spatialReference","tileInfo"])],s.prototype,"readSpatialReference",null),i([o({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],s.prototype,"path",void 0),i([o({readOnly:!0})],s.prototype,"sublayers",void 0),i([C("sublayers",{layers:{type:[V]}})],s.prototype,"writeSublayers",null),i([o({json:{read:!1,write:!1}})],s.prototype,"popupEnabled",void 0),i([o()],s.prototype,"tileServers",null),i([k("tileServers")],s.prototype,"castTileServers",null),i([o({readOnly:!0,json:{read:!1}})],s.prototype,"type",void 0),i([o(D)],s.prototype,"url",void 0),s=y=i([J("esri.layers.TileLayer")],s);const g=Symbol("default-fetch-tile");s.prototype.fetchTile[g]=!0;const re=s;export{re as default}; diff --git a/dist/assets/TileLayer-bPSfr5GU.js b/dist/assets/TileLayer-bPSfr5GU.js deleted file mode 100644 index cc6efda..0000000 --- a/dist/assets/TileLayer-bPSfr5GU.js +++ /dev/null @@ -1 +0,0 @@ -import{dK as _,dO as S,f1 as T,dM as b,dN as w,em as O,dP as $,dL as W,en as R,dQ as P,ar as m,bV as U,bW as u,f2 as f,f3 as j,ew as L,E as h,df as M,dv as N,f4 as A,f5 as B,e as i,y as o,dt as I,du as C,f6 as k,dW as D,c as J,c7 as q}from"./index-J0iiHjMT.js";import{E,f as G,X as V}from"./SublayersOwner-8xrm3MkT.js";import{o as K}from"./CustomParametersMixin-Y1bOcayO.js";import"./QueryTask-91TvtrTt.js";import"./executeForIds-wXO8-pll.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./executeQueryJSON-ACj9qY0y.js";import"./FeatureSet-d4S1oKME.js";import"./executeQueryPBF-vdaOUMid.js";import"./FeatureType-MpRe7WJj.js";import"./FeatureTemplate-kUgbbA00.js";import"./serviceCapabilitiesUtils-26KpT1VN.js";var y;const v=["Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Elevation/World_Hillshade","Elevation/World_Hillshade_Dark","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Ocean_Basemap","Reference/World_Boundaries_and_Places","Reference/World_Boundaries_and_Places_Alternate","Reference/World_Transportation","World_Imagery","World_Street_Map","World_Topo_Map"];let s=y=class extends _(S(E(T(G(b(w(O($(W(R(K(q)))))))))))){constructor(...e){super(...e),this.listMode="show",this.isReference=null,this.operationalLayerType="ArcGISTiledMapServiceLayer",this.resampling=!0,this.sourceJSON=null,this.spatialReference=null,this.path=null,this.sublayers=null,this.type="tile",this.url=null}normalizeCtorArgs(e,r){return typeof e=="string"?{url:e,...r}:e}load(e){const r=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service"]},e).catch(P).then(()=>this._fetchService(r))),Promise.resolve(this)}get attributionDataUrl(){var r;const e=(r=this.parsedUrl)==null?void 0:r.path.toLowerCase();return e?this._getDefaultAttribution(this._getMapName(e)):null}readSpatialReference(e,r){var t;return(e=e||((t=r.tileInfo)==null?void 0:t.spatialReference))&&m.fromJSON(e)}writeSublayers(e,r,t,a){if(!this.loaded||!e)return;const p=e.slice().reverse().flatten(({sublayers:l})=>l&&l.toArray().reverse()).toArray(),n=[],c={writeSublayerStructure:!1,...a};p.forEach(l=>{const d=l.write({},c);n.push(d)}),n.some(l=>Object.keys(l).length>1)&&(r.layers=n)}get tileServers(){var e;return this._getDefaultTileServers((e=this.parsedUrl)==null?void 0:e.path)}castTileServers(e){return Array.isArray(e)?e.map(r=>U(r).path):null}fetchTile(e,r,t,a={}){const{signal:p}=a,n=this.getTileUrl(e,r,t),c={responseType:"image",signal:p,query:{...this.refreshParameters}};return u(n,c).then(l=>l.data)}async fetchImageBitmapTile(e,r,t,a={}){const{signal:p}=a;if(this.fetchTile!==y.prototype.fetchTile){const d=await this.fetchTile(e,r,t,a);return f(d,e,r,t,p)}const n=this.getTileUrl(e,r,t),c={responseType:"blob",signal:p,query:{...this.refreshParameters}},{data:l}=await u(n,c);return f(l,e,r,t,p)}getTileUrl(e,r,t){var c,l;const a=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,p=j({...(c=this.parsedUrl)==null?void 0:c.query,blankTile:!a&&null,...this.customParameters,token:this.apiKey}),n=this.tileServers;return`${n&&n.length?n[r%n.length]:(l=this.parsedUrl)==null?void 0:l.path}/tile/${e}/${r}/${t}${p?"?"+p:""}`}loadAll(){return L(this,e=>{e(this.allSublayers)})}_fetchService(e){return new Promise((r,t)=>{if(this.sourceJSON){if(this.sourceJSON.bandCount!=null&&this.sourceJSON.pixelSizeX!=null)throw new h("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");return void r({data:this.sourceJSON})}if(!this.parsedUrl)throw new h("tile-layer:undefined-url","layer's url is not defined");const a=M(this.parsedUrl.path);if(a!=null&&a.serverType==="ImageServer")throw new h("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");u(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then(r,t)}).then(r=>{let t=this.url;if(r.ssl&&(t=this.url=t.replace(/^http:/i,"https:")),this.sourceJSON=r.data,this.read(r.data,{origin:"service",url:this.parsedUrl}),this.version===10.1&&!N(t))return this._fetchServerVersion(t,e).then(a=>{this.read({currentVersion:a})}).catch(()=>{})})}_fetchServerVersion(e,r){if(!A(e))return Promise.reject();const t=e.replace(/(.*\/rest)\/.*/i,"$1")+"/info";return u(t,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:r}).then(a=>{if(a.data&&a.data.currentVersion)return a.data.currentVersion;throw new h("tile-layer:version-not-available")})}_getMapName(e){const r=e.match(/^(?:https?:)?\/\/(server\.arcgisonline\.com|services\.arcgisonline\.com|ibasemaps-api\.arcgis\.com)\/arcgis\/rest\/services\/([^\/]+(\/[^\/]+)*)\/mapserver/i);return r?r[2]:void 0}_getDefaultAttribution(e){if(e==null)return null;let r;e=e.toLowerCase();for(let t=0,a=v.length;t({enabled:!1})}}})],s.prototype,"isReference",void 0),i([o({readOnly:!0,type:["ArcGISTiledMapServiceLayer"]})],s.prototype,"operationalLayerType",void 0),i([o({type:Boolean})],s.prototype,"resampling",void 0),i([o()],s.prototype,"sourceJSON",void 0),i([o({type:m})],s.prototype,"spatialReference",void 0),i([I("spatialReference",["spatialReference","tileInfo"])],s.prototype,"readSpatialReference",null),i([o({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],s.prototype,"path",void 0),i([o({readOnly:!0})],s.prototype,"sublayers",void 0),i([C("sublayers",{layers:{type:[V]}})],s.prototype,"writeSublayers",null),i([o({json:{read:!1,write:!1}})],s.prototype,"popupEnabled",void 0),i([o()],s.prototype,"tileServers",null),i([k("tileServers")],s.prototype,"castTileServers",null),i([o({readOnly:!0,json:{read:!1}})],s.prototype,"type",void 0),i([o(D)],s.prototype,"url",void 0),s=y=i([J("esri.layers.TileLayer")],s);const g=Symbol("default-fetch-tile");s.prototype.fetchTile[g]=!0;const le=s;export{le as default}; diff --git a/dist/assets/TileLayerView3D-5Hf3FIEh.js b/dist/assets/TileLayerView3D-KbvgzCEw.js similarity index 78% rename from dist/assets/TileLayerView3D-5Hf3FIEh.js rename to dist/assets/TileLayerView3D-KbvgzCEw.js index 55a50d8..9dacdce 100644 --- a/dist/assets/TileLayerView3D-5Hf3FIEh.js +++ b/dist/assets/TileLayerView3D-KbvgzCEw.js @@ -1 +1 @@ -import{ct as p,E as n,e as i,y as a,c as h}from"./index-J0iiHjMT.js";import{n as u}from"./LayerView3D-iOx2MD1g.js";import{o as f}from"./TiledLayerView3D-Av58zTxG.js";import{u as m}from"./LayerView-efDufa6j.js";import{a as y}from"./RefreshableLayerView-Pd4dLcWr.js";import{S as c,G as d}from"./MapServiceLayerViewHelper-a8WMaeWS.js";import{r as g}from"./drapedUtils-9db1OpTX.js";let t=class extends y(f(u(m))){constructor(){super(...arguments),this.type="tile-3d",this._popupHighlightHelper=null}get imageFormatIsOpaque(){return this.layer.tileInfo.format==="jpg"}get hasMixedImageFormats(){return this.layer.tileInfo.format==="mixed"}get tileInfo(){return this.layer.tileInfo}initialize(){var e,r;if(this.layer.type==="web-tile"){const l=(e=this.layer.fullExtent)==null?void 0:e.spatialReference,s=(r=this.layer.tileInfo)==null?void 0:r.spatialReference;if(l==null||s==null||!p(l,s)){const o=this.layer.originOf("fullExtent")==="defaults"||this.layer.fullExtent==null?"SceneView requires fullExtent to be specified by the user on WebTileLayer":"SceneView requires fullExtent to be specified in the same spatial reference as tileInfo on WebTileLayer";this.addResolvingPromise(Promise.reject(new n("layerview:incompatible-fullextent",o)))}}c(this,this.layer)&&(this._popupHighlightHelper=new d({createFetchPopupFeaturesQueryGeometry:(l,s)=>g(l,s,this.view),layerView:this,updatingHandles:this._updatingHandles})),this._addTilingSchemeMatchPromise()}destroy(){var e;(e=this._popupHighlightHelper)==null||e.destroy()}async fetchPopupFeatures(e,r){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeatures(e,r):[]}async doRefresh(){this.suspended||this.emit("data-changed")}};i([a()],t.prototype,"imageFormatIsOpaque",null),i([a()],t.prototype,"hasMixedImageFormats",null),i([a()],t.prototype,"layer",void 0),i([a()],t.prototype,"tileInfo",null),t=i([h("esri.views.3d.layers.TileLayerView3D")],t);const E=t;export{E as default}; +import{cj as p,r as n,e as i,y as a,c as h}from"./index-pCX-0tJH.js";import{n as u}from"./LayerView3D-57OghbRh.js";import{o as f}from"./TiledLayerView3D-_U1Q993H.js";import{u as m}from"./LayerView-ixwLVnzr.js";import{a as y}from"./RefreshableLayerView-DVYs7L04.js";import{S as c,G as d}from"./MapServiceLayerViewHelper-45ApjWde.js";import{r as g}from"./drapedUtils-F1ywqHD-.js";let t=class extends y(f(u(m))){constructor(){super(...arguments),this.type="tile-3d",this._popupHighlightHelper=null}get imageFormatIsOpaque(){return this.layer.tileInfo.format==="jpg"}get hasMixedImageFormats(){return this.layer.tileInfo.format==="mixed"}get tileInfo(){return this.layer.tileInfo}initialize(){var e,r;if(this.layer.type==="web-tile"){const l=(e=this.layer.fullExtent)==null?void 0:e.spatialReference,s=(r=this.layer.tileInfo)==null?void 0:r.spatialReference;if(l==null||s==null||!p(l,s)){const o=this.layer.originOf("fullExtent")==="defaults"||this.layer.fullExtent==null?"SceneView requires fullExtent to be specified by the user on WebTileLayer":"SceneView requires fullExtent to be specified in the same spatial reference as tileInfo on WebTileLayer";this.addResolvingPromise(Promise.reject(new n("layerview:incompatible-fullextent",o)))}}c(this,this.layer)&&(this._popupHighlightHelper=new d({createFetchPopupFeaturesQueryGeometry:(l,s)=>g(l,s,this.view),layerView:this,updatingHandles:this._updatingHandles})),this._addTilingSchemeMatchPromise()}destroy(){var e;(e=this._popupHighlightHelper)==null||e.destroy()}async fetchPopupFeatures(e,r){return this._popupHighlightHelper?this._popupHighlightHelper.fetchPopupFeatures(e,r):[]}async doRefresh(){this.suspended||this.emit("data-changed")}};i([a()],t.prototype,"imageFormatIsOpaque",null),i([a()],t.prototype,"hasMixedImageFormats",null),i([a()],t.prototype,"layer",void 0),i([a()],t.prototype,"tileInfo",null),t=i([h("esri.views.3d.layers.TileLayerView3D")],t);const P=t;export{P as default}; diff --git a/dist/assets/TileTreeDebugger-2DVbY5sQ.js b/dist/assets/TileTreeDebugger-2DVbY5sQ.js deleted file mode 100644 index 42977cf..0000000 --- a/dist/assets/TileTreeDebugger-2DVbY5sQ.js +++ /dev/null @@ -1 +0,0 @@ -import{e as r,p as M,bX as P,S,ab as g,bY as O,bZ as $,b_ as j,b$ as A,V as L,c0 as k,c1 as T,y as p,c as E,c2 as z}from"./index-J0iiHjMT.js";const J=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];let a=class extends M{constructor(s){super(s),this.updating=!1,this.enablePolygons=!0,this.enableLabels=!0,this._polygons=new Map,this._labels=new Map,this._enabled=!0}initialize(){this._symbols=J.map(s=>new P({color:[s[0],s[1],s[2],.6],outline:{color:"black",width:1}})),this.update()}destroy(){this._enabled=!1,this.clear()}get enabled(){return this._enabled}set enabled(s){this._enabled!==s&&(this._enabled=s,this.update())}update(){if(!this._enabled)return void this.clear();const s=e=>{if(e.label!=null)return e.label;let l=e.lij.toString();return e.loadPriority!=null&&(l+=` (${e.loadPriority})`),l},h=this.getTiles(),c=new Array,d=new Set((this._labels.size,this._labels.keys()));h.forEach((e,l)=>{const t=e.lij.toString();d.delete(t);const x=e.lij[0],u=e.geometry;if(this.enablePolygons&&!this._polygons.has(t)){const i=new S({geometry:u,symbol:this._symbols[x%this._symbols.length]});this._polygons.set(t,i),c.push(i)}if(this.enableLabels){const i=s(e),w=l/(h.length-1),y=z(0,200,w),_=z(20,6,w)/.75,m=e.loadPriority!=null&&e.loadPriority>=h.length,v=new g([y,m?0:y,m?0:y]),f=this.view.type==="3d"?()=>new O({verticalOffset:new $({screenLength:40/.75}),callout:new j({color:new g("white"),border:new A({color:new g("black")})}),symbolLayers:new L([new k({text:i,halo:{color:"white",size:1/.75},material:{color:v},size:_})])}):()=>new T({text:i,haloColor:"white",haloSize:1/.75,color:v,size:_}),n=this._labels.get(t);if(n){const o=f();n.symbol!=null&&JSON.stringify(o)===JSON.stringify(n.symbol)||(n.symbol=o)}else{const o=new S({geometry:u.extent.center,symbol:f()});this._labels.set(t,o),c.push(o)}}});const b=new Array;d.forEach(e=>{const l=this._polygons.get(e);l!=null&&(b.push(l),this._polygons.delete(e));const t=this._labels.get(e);t!=null&&(b.push(t),this._labels.delete(e))}),this.view.graphics.removeMany(b),this.view.graphics.addMany(c)}clear(){this.view.graphics.removeMany(Array.from(this._polygons.values())),this.view.graphics.removeMany(Array.from(this._labels.values())),this._polygons.clear(),this._labels.clear()}};r([p({constructOnly:!0})],a.prototype,"view",void 0),r([p({readOnly:!0})],a.prototype,"updating",void 0),r([p()],a.prototype,"enabled",null),a=r([E("esri.views.support.TileTreeDebugger")],a);export{a as d}; diff --git a/dist/assets/TileTreeDebugger-MxH50s1q.js b/dist/assets/TileTreeDebugger-MxH50s1q.js new file mode 100644 index 0000000..b7e6f80 --- /dev/null +++ b/dist/assets/TileTreeDebugger-MxH50s1q.js @@ -0,0 +1 @@ +import{e as r,g as M,aw as P,K as z,W as g,ax as A,ay as O,az as j,aA as L,V as $,aB as k,aC as T,y as d,c as C,aD as S}from"./index-pCX-0tJH.js";const D=[[0,179,255],[117,62,128],[0,104,255],[215,189,166],[32,0,193],[98,162,206],[102,112,129],[52,125,0],[142,118,246],[138,83,0],[92,122,255],[122,55,83],[0,142,255],[81,40,179],[0,200,244],[13,24,127],[0,170,147],[19,58,241],[22,44,35]];let a=class extends M{constructor(s){super(s),this.updating=!1,this.enablePolygons=!0,this.enableLabels=!0,this._polygons=new Map,this._labels=new Map,this._enabled=!0}initialize(){this._symbols=D.map(s=>new P({color:[s[0],s[1],s[2],.6],outline:{color:"black",width:1}})),this.update()}destroy(){this._enabled=!1,this.clear()}get enabled(){return this._enabled}set enabled(s){this._enabled!==s&&(this._enabled=s,this.update())}update(){if(!this._enabled)return void this.clear();const s=e=>{if(e.label!=null)return e.label;let l=e.lij.toString();return e.loadPriority!=null&&(l+=` (${e.loadPriority})`),l},h=this.getTiles(),y=new Array,p=new Set((this._labels.size,this._labels.keys()));h.forEach((e,l)=>{const t=e.lij.toString();p.delete(t);const x=e.lij[0],w=e.geometry;if(this.enablePolygons&&!this._polygons.has(t)){const i=new z({geometry:w,symbol:this._symbols[x%this._symbols.length]});this._polygons.set(t,i),y.push(i)}if(this.enableLabels){const i=s(e),u=l/(h.length-1),b=S(0,200,u),_=S(20,6,u)/.75,m=e.loadPriority!=null&&e.loadPriority>=h.length,v=new g([b,m?0:b,m?0:b]),f=this.view.type==="3d"?()=>new A({verticalOffset:new O({screenLength:40/.75}),callout:new j({color:new g("white"),border:new L({color:new g("black")})}),symbolLayers:new $([new k({text:i,halo:{color:"white",size:1/.75},material:{color:v},size:_})])}):()=>new T({text:i,haloColor:"white",haloSize:1/.75,color:v,size:_}),n=this._labels.get(t);if(n){const o=f();n.symbol!=null&&JSON.stringify(o)===JSON.stringify(n.symbol)||(n.symbol=o)}else{const o=new z({geometry:w.extent.center,symbol:f()});this._labels.set(t,o),y.push(o)}}});const c=new Array;p.forEach(e=>{const l=this._polygons.get(e);l!=null&&(c.push(l),this._polygons.delete(e));const t=this._labels.get(e);t!=null&&(c.push(t),this._labels.delete(e))}),this.view.graphics.removeMany(c),this.view.graphics.addMany(y)}clear(){this.view.graphics.removeMany(Array.from(this._polygons.values())),this.view.graphics.removeMany(Array.from(this._labels.values())),this._polygons.clear(),this._labels.clear()}};r([d({constructOnly:!0})],a.prototype,"view",void 0),r([d({readOnly:!0})],a.prototype,"updating",void 0),r([d()],a.prototype,"enabled",null),a=r([C("esri.views.support.TileTreeDebugger")],a);export{a as d}; diff --git a/dist/assets/TiledLayerView3D-Av58zTxG.js b/dist/assets/TiledLayerView3D-Av58zTxG.js deleted file mode 100644 index 8f8c248..0000000 --- a/dist/assets/TiledLayerView3D-Av58zTxG.js +++ /dev/null @@ -1 +0,0 @@ -import{e as r,y as n,fi as u,fj as g,c as d,E as o,w as f,fk as y}from"./index-J0iiHjMT.js";const S=p=>{let a=class extends p{get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}get dataScaleRange(){const e=this.tileInfo.lods;let i=e[0].scale,t=e[e.length-1].scale;if("tilemapCache"in this.layer&&this.layer.tilemapCache){const{effectiveMinLOD:l,effectiveMaxLOD:s}=this.layer.tilemapCache;i=this.tileInfo.lodAt(l).scale,t=this.tileInfo.lodAt(s).scale}return{minScale:i,maxScale:t}}get dataLevelRange(){const{minScale:e,maxScale:i}=this.dataScaleRange;return this.levelRangeFromScaleRange(e,i)}get displayLevelRange(){const e=this.layer.minScale||this.dataScaleRange.minScale,i=this.layer.maxScale||this.dataScaleRange.maxScale,t=this.levelRangeFromScaleRange(e,i);return this.layer.maxScale&&t.maxLevel++,t}getTileUrl(e,i,t){return this.layer.getTileUrl(e,i,t)}_addTilingSchemeMatchPromise(){if(this.fullExtent==null)return this.addResolvingPromise(Promise.reject(new o("tilingscheme:extent-not-defined","This layer doesn't define a fullExtent.")));const e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(e!=null)return this.addResolvingPromise(Promise.reject(e));const i=f(()=>{var t,l;return(l=(t=this.view)==null?void 0:t.basemapTerrain)==null?void 0:l.tilingSchemeLocked}).then(()=>{const t=this.view.basemapTerrain.tilingScheme,l=this._getTileInfoCompatibilityError(this.tileInfo,t);if(l)throw l});this.addResolvingPromise(i)}_getTileInfoSupportError(e,i){const t=y(e,i,this.view.spatialReference,this.view.state.viewingMode);if(t){const l={layer:this.layer,error:t};let s;switch(t.name){case"tilingscheme:spatial-reference-mismatch":case"tilingscheme:global-unsupported-spatial-reference":case"tilingscheme:local-unsupported-spatial-reference":s=new o("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",l);break;default:s=new o("layerview:tiling-scheme-unsupported","The tiling scheme of this layer is not supported by SceneView",l)}return s}return null}_getTileInfoCompatibilityError(e,i){return e!=null&&i.compatibleWith(e)?null:new o("layerview:tiling-scheme-incompatible","The tiling scheme of this layer is incompatible with the tiling scheme of the surface")}levelRangeFromScaleRange(e,i){const t={minLevel:0,maxLevel:1/0},l=this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.tilingScheme;if(!l)return t;const s=l.levels[0],h=m=>{const c=Math.log(s.scale/m)/Math.LN2;return .5-Math.abs(.5-c%1)<1e-9?Math.round(c):Math.ceil(c)};return e!=null&&e>0&&(t.minLevel=Math.max(0,h(e))),i!=null&&i>0&&(t.maxLevel=Math.max(0,h(i))),t}isUpdating(){return!!(this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.updating)}};return r([n({readOnly:!0})],a.prototype,"imageFormatIsOpaque",null),r([n({readOnly:!0})],a.prototype,"updating",void 0),r([n(u)],a.prototype,"updatingProgress",void 0),r([n(g)],a.prototype,"updatingProgressValue",void 0),r([n()],a.prototype,"fullExtent",null),r([n({readOnly:!0})],a.prototype,"isOpaque",null),r([n()],a.prototype,"dataScaleRange",null),r([n({readOnly:!0})],a.prototype,"dataLevelRange",null),r([n({readOnly:!0})],a.prototype,"displayLevelRange",null),r([n()],a.prototype,"layer",void 0),r([n()],a.prototype,"tileInfo",void 0),a=r([d("esri.views.3d.layers.TiledLayerView3D")],a),a};export{S as o}; diff --git a/dist/assets/TiledLayerView3D-_U1Q993H.js b/dist/assets/TiledLayerView3D-_U1Q993H.js new file mode 100644 index 0000000..1c5bf14 --- /dev/null +++ b/dist/assets/TiledLayerView3D-_U1Q993H.js @@ -0,0 +1 @@ +import{e as r,y as n,fd as u,fe as g,c as d,r as o,aa as f,ff as y}from"./index-pCX-0tJH.js";const S=p=>{let a=class extends p{get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}get dataScaleRange(){const e=this.tileInfo.lods;let i=e[0].scale,t=e[e.length-1].scale;if("tilemapCache"in this.layer&&this.layer.tilemapCache){const{effectiveMinLOD:l,effectiveMaxLOD:s}=this.layer.tilemapCache;i=this.tileInfo.lodAt(l).scale,t=this.tileInfo.lodAt(s).scale}return{minScale:i,maxScale:t}}get dataLevelRange(){const{minScale:e,maxScale:i}=this.dataScaleRange;return this.levelRangeFromScaleRange(e,i)}get displayLevelRange(){const e=this.layer.minScale||this.dataScaleRange.minScale,i=this.layer.maxScale||this.dataScaleRange.maxScale,t=this.levelRangeFromScaleRange(e,i);return this.layer.maxScale&&t.maxLevel++,t}getTileUrl(e,i,t){return this.layer.getTileUrl(e,i,t)}_addTilingSchemeMatchPromise(){if(this.fullExtent==null)return this.addResolvingPromise(Promise.reject(new o("tilingscheme:extent-not-defined","This layer doesn't define a fullExtent.")));const e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(e!=null)return this.addResolvingPromise(Promise.reject(e));const i=f(()=>{var t,l;return(l=(t=this.view)==null?void 0:t.basemapTerrain)==null?void 0:l.tilingSchemeLocked}).then(()=>{const t=this.view.basemapTerrain.tilingScheme,l=this._getTileInfoCompatibilityError(this.tileInfo,t);if(l)throw l});this.addResolvingPromise(i)}_getTileInfoSupportError(e,i){const t=y(e,i,this.view.spatialReference,this.view.state.viewingMode);if(t){const l={layer:this.layer,error:t};let s;switch(t.name){case"tilingscheme:spatial-reference-mismatch":case"tilingscheme:global-unsupported-spatial-reference":case"tilingscheme:local-unsupported-spatial-reference":s=new o("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",l);break;default:s=new o("layerview:tiling-scheme-unsupported","The tiling scheme of this layer is not supported by SceneView",l)}return s}return null}_getTileInfoCompatibilityError(e,i){return e!=null&&i.compatibleWith(e)?null:new o("layerview:tiling-scheme-incompatible","The tiling scheme of this layer is incompatible with the tiling scheme of the surface")}levelRangeFromScaleRange(e,i){const t={minLevel:0,maxLevel:1/0},l=this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.tilingScheme;if(!l)return t;const s=l.levels[0],h=m=>{const c=Math.log(s.scale/m)/Math.LN2;return .5-Math.abs(.5-c%1)<1e-9?Math.round(c):Math.ceil(c)};return e!=null&&e>0&&(t.minLevel=Math.max(0,h(e))),i!=null&&i>0&&(t.maxLevel=Math.max(0,h(i))),t}isUpdating(){return!!(this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.updating)}};return r([n({readOnly:!0})],a.prototype,"imageFormatIsOpaque",null),r([n({readOnly:!0})],a.prototype,"updating",void 0),r([n(u)],a.prototype,"updatingProgress",void 0),r([n(g)],a.prototype,"updatingProgressValue",void 0),r([n()],a.prototype,"fullExtent",null),r([n({readOnly:!0})],a.prototype,"isOpaque",null),r([n()],a.prototype,"dataScaleRange",null),r([n({readOnly:!0})],a.prototype,"dataLevelRange",null),r([n({readOnly:!0})],a.prototype,"displayLevelRange",null),r([n()],a.prototype,"layer",void 0),r([n()],a.prototype,"tileInfo",void 0),a=r([d("esri.views.3d.layers.TiledLayerView3D")],a),a};export{S as o}; diff --git a/dist/assets/TimeOnly-ljWtUK7N.js b/dist/assets/TimeOnly-gkehHHJx.js similarity index 97% rename from dist/assets/TimeOnly-ljWtUK7N.js rename to dist/assets/TimeOnly-gkehHHJx.js index 51d174a..2d7ff2b 100644 --- a/dist/assets/TimeOnly-ljWtUK7N.js +++ b/dist/assets/TimeOnly-gkehHHJx.js @@ -1 +1 @@ -import{mA as i,mB as l,mC as M,mD as g,mE as Z,c_ as q,mF as U,dT as b}from"./index-J0iiHjMT.js";var y;(function(s){s.TimeZoneNotRecognized="TimeZoneNotRecognized"})(y||(y={}));const A={[y.TimeZoneNotRecognized]:"Timezone identifier has not been recognized."};class w extends Error{constructor(e,t){super(q(A[e],t)),this.declaredRootClass="esri.arcade.arcadedate.dateerror",Error.captureStackTrace&&Error.captureStackTrace(this,w)}}function h(s,e,t){return st?s-t:0}function d(s,e,t){return st?t:s}class n{constructor(e){this._date=e,this.declaredRootClass="esri.arcade.arcadedate"}static fromParts(e=0,t=1,r=1,a=0,o=0,T=0,S=0,L){if(isNaN(e)||isNaN(t)||isNaN(r)||isNaN(a)||isNaN(o)||isNaN(T)||isNaN(S))return null;const p=i.local(e,t).daysInMonth;let D=i.fromObject({day:d(r,1,p),year:e,month:d(t,1,12),hour:d(a,0,23),minute:d(o,0,59),second:d(T,0,59),millisecond:d(S,0,999)},{zone:m(L)});return D=D.plus({months:h(t,1,12),days:h(r,1,p),hours:h(a,0,23),minutes:h(o,0,59),seconds:h(T,0,59),milliseconds:h(S,0,999)}),new n(D)}static get systemTimeZoneCanonicalName(){return Intl.DateTimeFormat().resolvedOptions().timeZone??"system"}static arcadeDateAndZoneToArcadeDate(e,t){const r=m(t);return e.isUnknownTimeZone||r===l.instance?n.fromParts(e.year,e.monthJS+1,e.day,e.hour,e.minute,e.second,e.millisecond,r):new n(e._date.setZone(r))}static dateJSToArcadeDate(e){return new n(i.fromJSDate(e,{zone:"system"}))}static dateJSAndZoneToArcadeDate(e,t="system"){const r=m(t);return new n(i.fromJSDate(e,{zone:r}))}static unknownEpochToArcadeDate(e){return new n(i.fromMillis(e,{zone:l.instance}))}static unknownDateJSToArcadeDate(e){return new n(i.fromMillis(e.getTime(),{zone:l.instance}))}static epochToArcadeDate(e,t="system"){const r=m(t);return new n(i.fromMillis(e,{zone:r}))}static dateTimeToArcadeDate(e){return new n(e)}clone(){return new n(this._date)}changeTimeZone(e){const t=m(e);return n.dateTimeToArcadeDate(this._date.setZone(t))}static dateTimeAndZoneToArcadeDate(e,t){const r=m(t);return e.zone===l.instance||r===l.instance?n.fromParts(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond,r):new n(e.setZone(r))}static nowToArcadeDate(e){const t=m(e);return new n(i.fromJSDate(new Date,{zone:t}))}static nowUTCToArcadeDate(){return new n(i.utc())}get isSystem(){return this.timeZone==="system"||this.timeZone===n.systemTimeZoneCanonicalName}equals(e){return this.isSystem&&e.isSystem?this.toNumber()===e.toNumber():this.isUnknownTimeZone===e.isUnknownTimeZone&&this._date.equals(e._date)}get isUnknownTimeZone(){return this._date.zone===l.instance}get isValid(){return this._date.isValid}get hour(){return this._date.hour}get second(){return this._date.second}get day(){return this._date.day}get dayOfWeekISO(){return this._date.weekday}get dayOfWeekJS(){let e=this._date.weekday;return e>6&&(e=0),e}get millisecond(){return this._date.millisecond}get monthISO(){return this._date.month}get weekISO(){return this._date.weekNumber}get yearISO(){return this._date.weekYear}get monthJS(){return this._date.month-1}get year(){return this._date.year}get minute(){return this._date.minute}get zone(){return this._date.zone}get timeZoneOffset(){return this.isUnknownTimeZone?0:this._date.offset}get timeZone(){if(this.isUnknownTimeZone)return"unknown";if(this._date.zone.type==="system")return"system";const e=this.zone;return e.type==="fixed"?e.fixed===0?"UTC":e.formatOffset(0,"short"):e.name}stringify(){return JSON.stringify(this.toJSDate())}plus(e){return new n(this._date.plus(e))}diff(e,t="milliseconds"){return this._date.diff(e._date,t)[t]}toISODate(){return this._date.toISODate()}toISOString(e){return e?this._date.toISO({suppressMilliseconds:!0,includeOffset:!this.isUnknownTimeZone}):this._date.toISO({includeOffset:!this.isUnknownTimeZone})}toISOTime(e,t){return this._date.toISOTime({suppressMilliseconds:e,includeOffset:t&&!this.isUnknownTimeZone})}toFormat(e,t){return this.isUnknownTimeZone&&(e=e.replaceAll("Z","")),this._date.toFormat(e,t)}toJSDate(){return this._date.toJSDate()}toSQLValue(){return this._date.toFormat("yyyy-LL-dd HH:mm:ss")}toSQLWithKeyword(){return`timestamp '${this.toSQLValue()}'`}toDateTime(){return this._date}toNumber(){return this._date.toMillis()}getTime(){return this._date.toMillis()}toUTC(){return new n(this._date.toUTC())}toLocal(){return new n(this._date.toLocal())}toString(){return this.toISOString(!0)}static fromReaderAsTimeStampOffset(e){if(!e)return null;const t=i.fromISO(e,{setZone:!0});return new n(t)}}function m(s,e=!0){if(s instanceof M)return s;if(s.toLowerCase()==="system")return"system";if(s.toLowerCase()==="utc")return"UTC";if(s.toLowerCase()==="unknown")return l.instance;if(/^[\+\-]?[0-9]{1,2}([:][0-9]{2})?$/.test(s)){const r=g.parseSpecifier("UTC"+(s.startsWith("+")||s.startsWith("-")?"":"+")+s);if(r)return r}const t=Z.create(s);if(!t.isValid){if(e)throw new w(y.TimeZoneNotRecognized);return null}return t}function k(s){s=s.replaceAll(/LTS|LT|LL?L?L?|l{1,4}/g,"[$&]");let e="";const t=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;for(const r of s.match(t)||[])switch(r){case"D":e+="d";break;case"DD":e+="dd";break;case"DDD":e+="o";break;case"d":e+="c";break;case"ddd":e+="ccc";break;case"dddd":e+="cccc";break;case"M":e+="L";break;case"MM":e+="LL";break;case"MMM":e+="LLL";break;case"MMMM":e+="LLLL";break;case"YY":e+="yy";break;case"Y":case"YYYY":e+="yyyy";break;case"Q":e+="q";break;case"X":case"x":e+=r;break;default:r.length>=2&&r.slice(0,1)==="["&&r.slice(-1)==="]"?e+=`'${r.slice(1,-1)}'`:e+=`'${r}'`}return e}let O=class c{constructor(e,t,r){this._year=e,this._month=t,this._day=r,this.declaredRootClass="esri.core.sql.dateonly"}get month(){return this._month}get monthJS(){return this._month-1}get year(){return this._year}get day(){return this._day}get isValid(){return this.toDateTime("unknown").isValid}equals(e){return e instanceof c&&e.day===this.day&&e.month===this.month&&e.year===this.year}clone(){return new c(this._year,this._month,this._day)}toDateTime(e){return i.fromObject({day:this.day,month:this.month,year:this.year},{zone:m(e)})}toDateTimeLuxon(e){return i.fromObject({day:this.day,month:this.month,year:this.year},{zone:m(e)})}toString(){return`${this.year.toString().padStart(4,"0")}-${this.month.toString().padStart(2,"0")}-${this.day.toString().padStart(2,"0")}`}toFormat(e=null){if(e===null||e==="")return this.toString();if(!(e=k(e)))return"";const t=this.toDateTime("unknown");return n.dateTimeToArcadeDate(t).toFormat(e,{locale:U(),numberingSystem:"latn"})}toArcadeDate(){const e=this.toDateTime("unknown");return n.dateTimeToArcadeDate(e)}toNumber(){return this.toDateTime("unknown").toMillis()}toJSDate(){return this.toDateTime("unknown").toJSDate()}toStorageFormat(){return this.toFormat("yyyy-LL-dd")}toSQLValue(){return this.toFormat("yyyy-LL-dd")}toSQLWithKeyword(){return"date '"+this.toFormat("yyyy-LL-dd")+"'"}plus(e,t){return c.fromDateTime(this.toUTCDateTime().plus({[e]:t}))}toUTCDateTime(){return i.utc(this.year,this.month,this.day,0,0,0,0)}difference(e,t){switch(t.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(e.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(e.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return t==="M"?this.toUTCDateTime().diff(e.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(e.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(e.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(e.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(e.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(e.toUTCDateTime(),"years").years}}static fromMilliseconds(e){const t=i.fromMillis(e,{zone:g.utcInstance});return t.isValid?c.fromParts(t.year,t.month,t.day):null}static fromSeconds(e){const t=i.fromSeconds(e,{zone:g.utcInstance});return t.isValid?c.fromParts(t.year,t.month,t.day):null}static fromReader(e){if(!e)return null;const t=e.split("-");return t.length!==3?null:new c(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10))}static fromParts(e,t,r){const a=new c(e,t,r);return a.isValid===!1?null:a}static fromDateJS(e){return c.fromParts(e.getFullYear(),e.getMonth()+1,e.getDay())}static fromDateTime(e){return c.fromParts(e.year,e.month,e.day)}static fromSqlTimeStampOffset(e){return this.fromDateTime(e.toDateTime())}static fromString(e,t=null){if(e===""||e===null)return null;const r=[];if(t)(t=k(t))&&r.push(t);else if(t===null||t===""){const a=i.fromISO(e,{setZone:!0});return a.isValid?c.fromParts(a.year,a.month,a.day):null}for(const a of r){const o=i.fromFormat(e,t??a);if(o.isValid)return new c(o.year,o.month,o.day)}return null}static fromNow(e="system"){const t=i.fromJSDate(new Date).setZone(m(e));return new c(t.year,t.month,t.day)}};function $(s){if(s==null)return null;if(typeof s=="number")return s;let e=s.toLowerCase();switch(e=e.replaceAll(/\s/g,""),e=e.replaceAll("-",""),e){case"meters":case"meter":case"m":case"squaremeters":case"squaremeter":return 109404;case"miles":case"mile":case"squaremile":case"squaremiles":return 109439;case"kilometers":case"kilometer":case"squarekilometers":case"squarekilometer":case"km":return 109414;case"acres":case"acre":case"ac":return 109402;case"hectares":case"hectare":case"ha":return 109401;case"yard":case"yd":case"yards":case"squareyards":case"squareyard":return 109442;case"feet":case"ft":case"foot":case"squarefeet":case"squarefoot":return 109405;case"nmi":case"nauticalmile":case"nauticalmiles":case"squarenauticalmile":case"squarenauticalmiles":return 109409}return null}function Y(s){if(s==null)return null;switch(s.type){case"polygon":case"multipoint":case"polyline":return s.extent;case"point":return new b({xmin:s.x,ymin:s.y,xmax:s.x,ymax:s.y,spatialReference:s.spatialReference});case"extent":return s}return null}function z(s){if(s==null)return null;if(typeof s=="number")return s;let e=s.toLowerCase();switch(e=e.replaceAll(/\s/g,""),e=e.replaceAll("-",""),e){case"meters":case"meter":case"m":case"squaremeters":case"squaremeter":return 9001;case"miles":case"mile":case"squaremile":case"squaremiles":return 9093;case"kilometers":case"kilometer":case"squarekilometers":case"squarekilometer":case"km":return 9036;case"yard":case"yd":case"yards":case"squareyards":case"squareyard":return 9096;case"feet":case"ft":case"foot":case"squarefeet":case"squarefoot":return 9002;case"nmi":case"nauticalmile":case"nauticalmiles":case"squarenauticalmile":case"squarenauticalmiles":return 9030}return null}function I(s){if(s==null)return null;const e=s.clone();return s.cache._geVersion!==void 0&&(e.cache._geVersion=s.cache._geVersion),e}function f(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s}function C(s){if(!s)return"";const e=/(a|A|hh?|HH?|mm?|ss?|SSS|S|.)/g;let t="";for(const r of s.match(e)||[])switch(r){case"SSS":case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":t+=r;break;case"A":case"a":t+="a";break;default:t+=`'${r}'`}return t}class u{constructor(e,t,r,a){this._hour=e,this._minute=t,this._second=r,this._millisecond=a,this.declaredRootClass="esri.core.sql.timeonly"}get hour(){return this._hour}get minute(){return this._minute}get second(){return this._second}get millisecond(){return this._millisecond}equals(e){return e instanceof u&&e.hour===this.hour&&e.minute===this.minute&&e.second===this.second&&e.millisecond===this.millisecond}clone(){return new u(this.hour,this.minute,this.second,this.millisecond)}isValid(){return f(this.hour)&&f(this.minute)&&f(this.second)&&f(this.millisecond)&&this.hour>=0&&this.hour<24&&this.minute>=0&&this.minute<60&&this.second>=0&&this.second<60&&this.millisecond>=0&&this.millisecond<1e3}toString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`+(this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):"")}toSQLValue(){return this.toString()}toSQLWithKeyword(){return`time '${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}${this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):""}'`}toStorageString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`}toFormat(e=null){return e===null||e===""?this.toString():(e=C(e))?i.local(1970,1,1,this._hour,this._minute,this._second,this._millisecond).toFormat(e,{locale:U(),numberingSystem:"latn"}):""}toNumber(){return this.millisecond+1e3*this.second+1e3*this.minute*60+60*this.hour*60*1e3}static fromParts(e,t,r,a){const o=new u(e,t,r,a);return o.isValid()?o:null}static fromReader(e){if(!e)return null;const t=e.split(":");return t.length!==3?null:new u(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),0)}static fromMilliseconds(e){if(e>864e5||e<0)return null;const t=Math.floor(e/1e3%60),r=Math.floor(e/6e4%60),a=Math.floor(e/36e5%24),o=Math.floor(e%1e3);return new u(a,r,t,o)}static fromDateJS(e){return new u(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}static fromDateTime(e){return new u(e.hour,e.minute,e.second,e.millisecond)}static fromSqlTimeStampOffset(e){return this.fromDateTime(e.toDateTime())}static fromString(e,t=null){if(e===""||e===null)return null;const r=[];t?(t=C(t))&&r.push(t):t!==null&&t!==""||(r.push("HH:mm:ss"),r.push("HH:mm:ss.SSS"),r.push("hh:mm:ss a"),r.push("hh:mm:ss.SSS a"),r.push("HH:mm"),r.push("hh:mm a"),r.push("H:mm"),r.push("h:mm a"),r.push("H:mm:ss"),r.push("h:mm:ss a"),r.push("H:mm:ss.SSS"),r.push("h:mm:ss.SSS a"));for(const a of r){const o=i.fromFormat(e,a);if(o.isValid)return new u(o.hour,o.minute,o.second,o.millisecond)}return null}plus(e,t){switch(e){case"days":case"years":case"months":return this.clone();case"hours":case"minutes":case"seconds":case"milliseconds":return u.fromDateTime(this.toUTCDateTime().plus({[e]:t}))}return null}toUTCDateTime(){return i.utc(1970,1,1,this.hour,this.minute,this.second,this.millisecond)}difference(e,t){switch(t.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(e.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(e.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return t==="M"?this.toUTCDateTime().diff(e.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(e.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(e.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(e.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(e.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(e.toUTCDateTime(),"years").years}}}export{z as a,O as b,I as c,m as h,n as m,u as n,$ as r,Y as s}; +import{mJ as i,mK as l,mL as M,mM as g,mN as Z,cR as q,mO as U,dO as b}from"./index-pCX-0tJH.js";var y;(function(s){s.TimeZoneNotRecognized="TimeZoneNotRecognized"})(y||(y={}));const O={[y.TimeZoneNotRecognized]:"Timezone identifier has not been recognized."};class w extends Error{constructor(e,t){super(q(O[e],t)),this.declaredRootClass="esri.arcade.arcadedate.dateerror",Error.captureStackTrace&&Error.captureStackTrace(this,w)}}function h(s,e,t){return st?s-t:0}function d(s,e,t){return st?t:s}class n{constructor(e){this._date=e,this.declaredRootClass="esri.arcade.arcadedate"}static fromParts(e=0,t=1,r=1,a=0,o=0,T=0,S=0,L){if(isNaN(e)||isNaN(t)||isNaN(r)||isNaN(a)||isNaN(o)||isNaN(T)||isNaN(S))return null;const p=i.local(e,t).daysInMonth;let D=i.fromObject({day:d(r,1,p),year:e,month:d(t,1,12),hour:d(a,0,23),minute:d(o,0,59),second:d(T,0,59),millisecond:d(S,0,999)},{zone:m(L)});return D=D.plus({months:h(t,1,12),days:h(r,1,p),hours:h(a,0,23),minutes:h(o,0,59),seconds:h(T,0,59),milliseconds:h(S,0,999)}),new n(D)}static get systemTimeZoneCanonicalName(){return Intl.DateTimeFormat().resolvedOptions().timeZone??"system"}static arcadeDateAndZoneToArcadeDate(e,t){const r=m(t);return e.isUnknownTimeZone||r===l.instance?n.fromParts(e.year,e.monthJS+1,e.day,e.hour,e.minute,e.second,e.millisecond,r):new n(e._date.setZone(r))}static dateJSToArcadeDate(e){return new n(i.fromJSDate(e,{zone:"system"}))}static dateJSAndZoneToArcadeDate(e,t="system"){const r=m(t);return new n(i.fromJSDate(e,{zone:r}))}static unknownEpochToArcadeDate(e){return new n(i.fromMillis(e,{zone:l.instance}))}static unknownDateJSToArcadeDate(e){return new n(i.fromMillis(e.getTime(),{zone:l.instance}))}static epochToArcadeDate(e,t="system"){const r=m(t);return new n(i.fromMillis(e,{zone:r}))}static dateTimeToArcadeDate(e){return new n(e)}clone(){return new n(this._date)}changeTimeZone(e){const t=m(e);return n.dateTimeToArcadeDate(this._date.setZone(t))}static dateTimeAndZoneToArcadeDate(e,t){const r=m(t);return e.zone===l.instance||r===l.instance?n.fromParts(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond,r):new n(e.setZone(r))}static nowToArcadeDate(e){const t=m(e);return new n(i.fromJSDate(new Date,{zone:t}))}static nowUTCToArcadeDate(){return new n(i.utc())}get isSystem(){return this.timeZone==="system"||this.timeZone===n.systemTimeZoneCanonicalName}equals(e){return this.isSystem&&e.isSystem?this.toNumber()===e.toNumber():this.isUnknownTimeZone===e.isUnknownTimeZone&&this._date.equals(e._date)}get isUnknownTimeZone(){return this._date.zone===l.instance}get isValid(){return this._date.isValid}get hour(){return this._date.hour}get second(){return this._date.second}get day(){return this._date.day}get dayOfWeekISO(){return this._date.weekday}get dayOfWeekJS(){let e=this._date.weekday;return e>6&&(e=0),e}get millisecond(){return this._date.millisecond}get monthISO(){return this._date.month}get weekISO(){return this._date.weekNumber}get yearISO(){return this._date.weekYear}get monthJS(){return this._date.month-1}get year(){return this._date.year}get minute(){return this._date.minute}get zone(){return this._date.zone}get timeZoneOffset(){return this.isUnknownTimeZone?0:this._date.offset}get timeZone(){if(this.isUnknownTimeZone)return"unknown";if(this._date.zone.type==="system")return"system";const e=this.zone;return e.type==="fixed"?e.fixed===0?"UTC":e.formatOffset(0,"short"):e.name}stringify(){return JSON.stringify(this.toJSDate())}plus(e){return new n(this._date.plus(e))}diff(e,t="milliseconds"){return this._date.diff(e._date,t)[t]}toISODate(){return this._date.toISODate()}toISOString(e){return e?this._date.toISO({suppressMilliseconds:!0,includeOffset:!this.isUnknownTimeZone}):this._date.toISO({includeOffset:!this.isUnknownTimeZone})}toISOTime(e,t){return this._date.toISOTime({suppressMilliseconds:e,includeOffset:t&&!this.isUnknownTimeZone})}toFormat(e,t){return this.isUnknownTimeZone&&(e=e.replaceAll("Z","")),this._date.toFormat(e,t)}toJSDate(){return this._date.toJSDate()}toSQLValue(){return this._date.toFormat("yyyy-LL-dd HH:mm:ss")}toSQLWithKeyword(){return`timestamp '${this.toSQLValue()}'`}toDateTime(){return this._date}toNumber(){return this._date.toMillis()}getTime(){return this._date.toMillis()}toUTC(){return new n(this._date.toUTC())}toLocal(){return new n(this._date.toLocal())}toString(){return this.toISOString(!0)}static fromReaderAsTimeStampOffset(e){if(!e)return null;const t=i.fromISO(e,{setZone:!0});return new n(t)}}function m(s,e=!0){if(s instanceof M)return s;if(s.toLowerCase()==="system")return"system";if(s.toLowerCase()==="utc")return"UTC";if(s.toLowerCase()==="unknown")return l.instance;if(/^[\+\-]?[0-9]{1,2}([:][0-9]{2})?$/.test(s)){const r=g.parseSpecifier("UTC"+(s.startsWith("+")||s.startsWith("-")?"":"+")+s);if(r)return r}const t=Z.create(s);if(!t.isValid){if(e)throw new w(y.TimeZoneNotRecognized);return null}return t}function k(s){s=s.replaceAll(/LTS|LT|LL?L?L?|l{1,4}/g,"[$&]");let e="";const t=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;for(const r of s.match(t)||[])switch(r){case"D":e+="d";break;case"DD":e+="dd";break;case"DDD":e+="o";break;case"d":e+="c";break;case"ddd":e+="ccc";break;case"dddd":e+="cccc";break;case"M":e+="L";break;case"MM":e+="LL";break;case"MMM":e+="LLL";break;case"MMMM":e+="LLLL";break;case"YY":e+="yy";break;case"Y":case"YYYY":e+="yyyy";break;case"Q":e+="q";break;case"X":case"x":e+=r;break;default:r.length>=2&&r.slice(0,1)==="["&&r.slice(-1)==="]"?e+=`'${r.slice(1,-1)}'`:e+=`'${r}'`}return e}let A=class c{constructor(e,t,r){this._year=e,this._month=t,this._day=r,this.declaredRootClass="esri.core.sql.dateonly"}get month(){return this._month}get monthJS(){return this._month-1}get year(){return this._year}get day(){return this._day}get isValid(){return this.toDateTime("unknown").isValid}equals(e){return e instanceof c&&e.day===this.day&&e.month===this.month&&e.year===this.year}clone(){return new c(this._year,this._month,this._day)}toDateTime(e){return i.fromObject({day:this.day,month:this.month,year:this.year},{zone:m(e)})}toDateTimeLuxon(e){return i.fromObject({day:this.day,month:this.month,year:this.year},{zone:m(e)})}toString(){return`${this.year.toString().padStart(4,"0")}-${this.month.toString().padStart(2,"0")}-${this.day.toString().padStart(2,"0")}`}toFormat(e=null){if(e===null||e==="")return this.toString();if(!(e=k(e)))return"";const t=this.toDateTime("unknown");return n.dateTimeToArcadeDate(t).toFormat(e,{locale:U(),numberingSystem:"latn"})}toArcadeDate(){const e=this.toDateTime("unknown");return n.dateTimeToArcadeDate(e)}toNumber(){return this.toDateTime("unknown").toMillis()}toJSDate(){return this.toDateTime("unknown").toJSDate()}toStorageFormat(){return this.toFormat("yyyy-LL-dd")}toSQLValue(){return this.toFormat("yyyy-LL-dd")}toSQLWithKeyword(){return"date '"+this.toFormat("yyyy-LL-dd")+"'"}plus(e,t){return c.fromDateTime(this.toUTCDateTime().plus({[e]:t}))}toUTCDateTime(){return i.utc(this.year,this.month,this.day,0,0,0,0)}difference(e,t){switch(t.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(e.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(e.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return t==="M"?this.toUTCDateTime().diff(e.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(e.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(e.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(e.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(e.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(e.toUTCDateTime(),"years").years}}static fromMilliseconds(e){const t=i.fromMillis(e,{zone:g.utcInstance});return t.isValid?c.fromParts(t.year,t.month,t.day):null}static fromSeconds(e){const t=i.fromSeconds(e,{zone:g.utcInstance});return t.isValid?c.fromParts(t.year,t.month,t.day):null}static fromReader(e){if(!e)return null;const t=e.split("-");return t.length!==3?null:new c(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10))}static fromParts(e,t,r){const a=new c(e,t,r);return a.isValid===!1?null:a}static fromDateJS(e){return c.fromParts(e.getFullYear(),e.getMonth()+1,e.getDay())}static fromDateTime(e){return c.fromParts(e.year,e.month,e.day)}static fromSqlTimeStampOffset(e){return this.fromDateTime(e.toDateTime())}static fromString(e,t=null){if(e===""||e===null)return null;const r=[];if(t)(t=k(t))&&r.push(t);else if(t===null||t===""){const a=i.fromISO(e,{setZone:!0});return a.isValid?c.fromParts(a.year,a.month,a.day):null}for(const a of r){const o=i.fromFormat(e,t??a);if(o.isValid)return new c(o.year,o.month,o.day)}return null}static fromNow(e="system"){const t=i.fromJSDate(new Date).setZone(m(e));return new c(t.year,t.month,t.day)}};function $(s){if(s==null)return null;if(typeof s=="number")return s;let e=s.toLowerCase();switch(e=e.replaceAll(/\s/g,""),e=e.replaceAll("-",""),e){case"meters":case"meter":case"m":case"squaremeters":case"squaremeter":return 109404;case"miles":case"mile":case"squaremile":case"squaremiles":return 109439;case"kilometers":case"kilometer":case"squarekilometers":case"squarekilometer":case"km":return 109414;case"acres":case"acre":case"ac":return 109402;case"hectares":case"hectare":case"ha":return 109401;case"yard":case"yd":case"yards":case"squareyards":case"squareyard":return 109442;case"feet":case"ft":case"foot":case"squarefeet":case"squarefoot":return 109405;case"nmi":case"nauticalmile":case"nauticalmiles":case"squarenauticalmile":case"squarenauticalmiles":return 109409}return null}function Y(s){if(s==null)return null;switch(s.type){case"polygon":case"multipoint":case"polyline":return s.extent;case"point":return new b({xmin:s.x,ymin:s.y,xmax:s.x,ymax:s.y,spatialReference:s.spatialReference});case"extent":return s}return null}function z(s){if(s==null)return null;if(typeof s=="number")return s;let e=s.toLowerCase();switch(e=e.replaceAll(/\s/g,""),e=e.replaceAll("-",""),e){case"meters":case"meter":case"m":case"squaremeters":case"squaremeter":return 9001;case"miles":case"mile":case"squaremile":case"squaremiles":return 9093;case"kilometers":case"kilometer":case"squarekilometers":case"squarekilometer":case"km":return 9036;case"yard":case"yd":case"yards":case"squareyards":case"squareyard":return 9096;case"feet":case"ft":case"foot":case"squarefeet":case"squarefoot":return 9002;case"nmi":case"nauticalmile":case"nauticalmiles":case"squarenauticalmile":case"squarenauticalmiles":return 9030}return null}function I(s){if(s==null)return null;const e=s.clone();return s.cache._geVersion!==void 0&&(e.cache._geVersion=s.cache._geVersion),e}function f(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s}function C(s){if(!s)return"";const e=/(a|A|hh?|HH?|mm?|ss?|SSS|S|.)/g;let t="";for(const r of s.match(e)||[])switch(r){case"SSS":case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":t+=r;break;case"A":case"a":t+="a";break;default:t+=`'${r}'`}return t}class u{constructor(e,t,r,a){this._hour=e,this._minute=t,this._second=r,this._millisecond=a,this.declaredRootClass="esri.core.sql.timeonly"}get hour(){return this._hour}get minute(){return this._minute}get second(){return this._second}get millisecond(){return this._millisecond}equals(e){return e instanceof u&&e.hour===this.hour&&e.minute===this.minute&&e.second===this.second&&e.millisecond===this.millisecond}clone(){return new u(this.hour,this.minute,this.second,this.millisecond)}isValid(){return f(this.hour)&&f(this.minute)&&f(this.second)&&f(this.millisecond)&&this.hour>=0&&this.hour<24&&this.minute>=0&&this.minute<60&&this.second>=0&&this.second<60&&this.millisecond>=0&&this.millisecond<1e3}toString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`+(this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):"")}toSQLValue(){return this.toString()}toSQLWithKeyword(){return`time '${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}${this.millisecond>0?"."+this.millisecond.toString().padStart(3,"0"):""}'`}toStorageString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2,"0")}:${this.second.toString().padStart(2,"0")}`}toFormat(e=null){return e===null||e===""?this.toString():(e=C(e))?i.local(1970,1,1,this._hour,this._minute,this._second,this._millisecond).toFormat(e,{locale:U(),numberingSystem:"latn"}):""}toNumber(){return this.millisecond+1e3*this.second+1e3*this.minute*60+60*this.hour*60*1e3}static fromParts(e,t,r,a){const o=new u(e,t,r,a);return o.isValid()?o:null}static fromReader(e){if(!e)return null;const t=e.split(":");return t.length!==3?null:new u(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),0)}static fromMilliseconds(e){if(e>864e5||e<0)return null;const t=Math.floor(e/1e3%60),r=Math.floor(e/6e4%60),a=Math.floor(e/36e5%24),o=Math.floor(e%1e3);return new u(a,r,t,o)}static fromDateJS(e){return new u(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}static fromDateTime(e){return new u(e.hour,e.minute,e.second,e.millisecond)}static fromSqlTimeStampOffset(e){return this.fromDateTime(e.toDateTime())}static fromString(e,t=null){if(e===""||e===null)return null;const r=[];t?(t=C(t))&&r.push(t):t!==null&&t!==""||(r.push("HH:mm:ss"),r.push("HH:mm:ss.SSS"),r.push("hh:mm:ss a"),r.push("hh:mm:ss.SSS a"),r.push("HH:mm"),r.push("hh:mm a"),r.push("H:mm"),r.push("h:mm a"),r.push("H:mm:ss"),r.push("h:mm:ss a"),r.push("H:mm:ss.SSS"),r.push("h:mm:ss.SSS a"));for(const a of r){const o=i.fromFormat(e,a);if(o.isValid)return new u(o.hour,o.minute,o.second,o.millisecond)}return null}plus(e,t){switch(e){case"days":case"years":case"months":return this.clone();case"hours":case"minutes":case"seconds":case"milliseconds":return u.fromDateTime(this.toUTCDateTime().plus({[e]:t}))}return null}toUTCDateTime(){return i.utc(1970,1,1,this.hour,this.minute,this.second,this.millisecond)}difference(e,t){switch(t.toLowerCase()){case"days":case"day":case"d":return this.toUTCDateTime().diff(e.toUTCDateTime(),"days").days;case"months":case"month":return this.toUTCDateTime().diff(e.toUTCDateTime(),"months").months;case"minutes":case"minute":case"m":return t==="M"?this.toUTCDateTime().diff(e.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(e.toUTCDateTime(),"minutes").minutes;case"seconds":case"second":case"s":return this.toUTCDateTime().diff(e.toUTCDateTime(),"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return this.toUTCDateTime().diff(e.toUTCDateTime(),"milliseconds").milliseconds;case"hours":case"hour":case"h":return this.toUTCDateTime().diff(e.toUTCDateTime(),"hours").hours;case"years":case"year":case"y":return this.toUTCDateTime().diff(e.toUTCDateTime(),"years").years}}}export{z as a,A as b,I as c,m as h,n as m,u as n,$ as r,Y as s}; diff --git a/dist/assets/Tooltip-lrFZgXdG.js b/dist/assets/Tooltip-4JsqFz5S.js similarity index 99% rename from dist/assets/Tooltip-lrFZgXdG.js rename to dist/assets/Tooltip-4JsqFz5S.js index ea4534e..4f6f3ca 100644 --- a/dist/assets/Tooltip-lrFZgXdG.js +++ b/dist/assets/Tooltip-4JsqFz5S.js @@ -1 +1 @@ -import{W as M,Q as N,p as u,b as E,e as F,c as x,v as L,H as X,Z as j,K as B}from"./Theme-QNc_77AM.js";class D extends M{_beforeChanged(){super._beforeChanged(),(this.isDirty("pointerBaseWidth")||this.isDirty("cornerRadius")||this.isDirty("pointerLength")||this.isDirty("pointerX")||this.isDirty("pointerY")||this.isDirty("width")||this.isDirty("height"))&&(this._clear=!0)}_changed(){if(super._changed(),this._clear){this.markDirtyBounds();let t=this.width(),i=this.height();if(t>0&&i>0){let e=this.get("cornerRadius",8);e=u(e,0,Math.min(t/2,i/2));let l=this.get("pointerX",0),o=this.get("pointerY",0),a=this.get("pointerBaseWidth",15)/2,T=0,_=0,f=0,c=(l-T)*(i-_)-(o-_)*(t-T),n=(l-f)*(0-i)-(o-i)*(t-f);const s=this._display;if(s.moveTo(e,0),c>0&&n>0){let r=Math.round(u(l,e+a,t-a-e));o=u(o,-1/0,0),s.lineTo(r-a,0),s.lineTo(l,o),s.lineTo(r+a,0)}if(s.lineTo(t-e,0),s.arcTo(t,0,t,e,e),c>0&&n<0){let r=Math.round(u(o,e+a,i-a-e));l=u(l,t,1/0),s.lineTo(t,e),s.lineTo(t,Math.max(r-a,e)),s.lineTo(l,o),s.lineTo(t,r+a)}if(s.lineTo(t,i-e),s.arcTo(t,i,t-e,i,e),c<0&&n<0){let r=Math.round(u(l,e+a,t-a-e));o=u(o,i,1/0),s.lineTo(t-e,i),s.lineTo(r+a,i),s.lineTo(l,o),s.lineTo(r-a,i)}if(s.lineTo(e,i),s.arcTo(0,i,0,i-e,e),c<0&&n>0){let r=Math.round(u(o,e+a,i-e-a));l=u(l,-1/0,0),s.lineTo(0,i-e),s.lineTo(0,r+a),s.lineTo(l,o),s.lineTo(0,Math.max(r-a,e))}s.lineTo(0,e),s.arcTo(0,0,e,0,e),s.closePath()}}}}Object.defineProperty(D,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PointedRectangle"}),Object.defineProperty(D,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:M.classNames.concat([D.className])});class P extends N{constructor(t,i,e,l=[]){super(t,i,e,l),Object.defineProperty(this,"_fx",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_fy",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_label",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fillDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_strokeDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_labelDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_w",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_h",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_keepHoverDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_htmlContentHovered",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_afterNew(){this._settings.themeTags=E(this._settings.themeTags,["tooltip"]),super._afterNew(),this.set("background",D.new(this._root,{themeTags:["tooltip","background"]})),this._label=this.children.push(F.new(this._root,{})),this._disposers.push(this._label.events.on("boundschanged",()=>{this._updateBackground()})),this._disposers.push(this.on("bounds",()=>{this._updateBackground()})),this._updateTextColor(),this._root.tooltipContainer.children.push(this),this.hide(0),this._disposers.push(this.label.onPrivate("htmlElement",t=>{t&&(x(t,"pointerover",i=>{this._htmlContentHovered=!0}),x(t,"pointerout",i=>{this._htmlContentHovered=!1}))})),this._root._tooltips.push(this)}get label(){return this._label}dispose(){super.dispose(),L(this._root._tooltips,this)}_updateChildren(){super._updateChildren(),(this.isDirty("pointerOrientation")||this.isPrivateDirty("minWidth")||this.isPrivateDirty("minHeight"))&&this.get("background")._markDirtyKey("width"),this.get("labelText")!=null&&this.label.set("text",this.get("labelText")),this.get("labelHTML")!=null&&this.label.set("html",this.get("labelHTML"))}_changed(){if(super._changed(),(this.isDirty("pointTo")||this.isDirty("pointerOrientation"))&&this._updateBackground(),this.isDirty("tooltipTarget")&&this.updateBackgroundColor(),this.isDirty("keepTargetHover"))if(this.get("keepTargetHover")){const t=this.get("background");this._keepHoverDp=new X([t.events.on("pointerover",i=>{let e=this.get("tooltipTarget");e&&(e.parent&&e.parent.getPrivate("tooltipTarget")==e&&(e=e.parent),e.hover())}),t.events.on("pointerout",i=>{let e=this.get("tooltipTarget");e&&(e.parent&&e.parent.getPrivate("tooltipTarget")==e&&(e=e.parent),this._htmlContentHovered||e.unhover())})]),this.label.onPrivate("htmlElement",i=>{this._keepHoverDp&&i&&this._keepHoverDp.disposers.push(x(i,"pointerleave",e=>{const l=this.root._renderer.getEvent(e);t.events.dispatch("pointerout",{type:"pointerout",originalEvent:l.event,point:l.point,simulated:!1,target:t})}))})}else this._keepHoverDp&&(this._keepHoverDp.dispose(),this._keepHoverDp=void 0)}_onShow(){super._onShow(),this.updateBackgroundColor()}updateBackgroundColor(){let t=this.get("tooltipTarget");const i=this.get("background");let e,l;t&&i&&(e=t.get("fill"),l=t.get("stroke"),e==null&&(e=l),this.get("getFillFromSprite")&&(this._fillDp&&this._fillDp.dispose(),e!=null&&i.set("fill",e),this._fillDp=t.on("fill",o=>{o!=null&&(i.set("fill",o),this._updateTextColor(o))}),this._disposers.push(this._fillDp)),this.get("getStrokeFromSprite")&&(this._strokeDp&&this._strokeDp.dispose(),e!=null&&i.set("stroke",e),this._strokeDp=t.on("fill",o=>{o!=null&&i.set("stroke",o)}),this._disposers.push(this._strokeDp)),this.get("getLabelFillFromSprite")&&(this._labelDp&&this._labelDp.dispose(),e!=null&&this.label.set("fill",e),this._labelDp=t.on("fill",o=>{o!=null&&this.label.set("fill",o)}),this._disposers.push(this._labelDp))),this._updateTextColor(e)}_updateTextColor(t){this.get("autoTextColor")&&(t==null&&(t=this.get("background").get("fill")),t==null&&(t=this._root.interfaceColors.get("background")),t instanceof j&&this.label.set("fill",j.alternative(t,this._root.interfaceColors.get("alternativeText"),this._root.interfaceColors.get("text"))))}_setDataItem(t){super._setDataItem(t),this.label._setDataItem(t)}_updateBackground(){super.updateBackground();const t=this._root.container;if(t){let i=.5,e=.5,l=this.get("centerX");l instanceof B&&(i=l.value);let o=this.get("centerY");o instanceof B&&(e=o.value);let a=t.width(),T=t.height(),_=this.parent,f=0,c=0;if(_){f=_.x(),c=_.y();const d=_.get("layerMargin");d&&(f+=d.left||0,c+=d.top||0,a+=(d.left||0)+(d.right||0),T+=(d.top||0)+(d.bottom||0))}const n=this.get("bounds",{left:-f,top:-c,right:a-f,bottom:T-c});this._updateBounds();let s=this.width(),r=this.height();s===0&&(s=this._w),r===0&&(r=this._h);let k=this.get("pointTo",{x:a/2,y:T/2}),h=k.x,p=k.y,v=this.get("pointerOrientation"),b=this.get("background"),g=0,m=0,y=0;b instanceof D&&(g=b.get("pointerLength",0),m=b.get("strokeWidth",0)/2,y=m,b.set("width",s),b.set("height",r));let C=0,O=0,H=n.right-n.left,W=n.bottom-n.top;v=="horizontal"||v=="left"||v=="right"?(m=0,v=="horizontal"?h>n.left+H/2?(h-=s*(1-i)+g,y*=-1):h+=s*i+g:v=="left"?h+=s*(1-i)+g:(h-=s*i+g,y*=-1)):(y=0,v=="vertical"?p>n.top+r/2+g?p-=r*(1-e)+g:(p+=r*e+g,m*=-1):v=="down"?p-=r*(1-e)+g:(p+=r*e+g,m*=-1)),h=u(h,n.left+s*i,n.left+H-s*(1-i))+y,p=u(p,n.top+r*e,n.top+W-r*(1-e))-m,C=k.x-h+s*i+y,O=k.y-p+r*e-m,this._fx=h,this._fy=p;const w=this.get("animationDuration",0);if(w>0&&this.get("visible")&&this.get("opacity")>.1){const d=this.get("animationEasing");this.animate({key:"x",to:h,duration:w,easing:d}),this.animate({key:"y",to:p,duration:w,easing:d})}else this.set("x",h),this.set("y",p);b instanceof D&&(b.set("pointerX",C),b.set("pointerY",O)),s>0&&(this._w=s),r>0&&(this._h=r)}}}Object.defineProperty(P,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Tooltip"}),Object.defineProperty(P,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:N.classNames.concat([P.className])});export{P as u}; +import{W as M,Q as N,p as u,b as E,e as F,c as x,v as L,H as X,Z as j,K as B}from"./Theme-5CV7oVsW.js";class D extends M{_beforeChanged(){super._beforeChanged(),(this.isDirty("pointerBaseWidth")||this.isDirty("cornerRadius")||this.isDirty("pointerLength")||this.isDirty("pointerX")||this.isDirty("pointerY")||this.isDirty("width")||this.isDirty("height"))&&(this._clear=!0)}_changed(){if(super._changed(),this._clear){this.markDirtyBounds();let t=this.width(),i=this.height();if(t>0&&i>0){let e=this.get("cornerRadius",8);e=u(e,0,Math.min(t/2,i/2));let l=this.get("pointerX",0),o=this.get("pointerY",0),a=this.get("pointerBaseWidth",15)/2,T=0,_=0,f=0,c=(l-T)*(i-_)-(o-_)*(t-T),n=(l-f)*(0-i)-(o-i)*(t-f);const s=this._display;if(s.moveTo(e,0),c>0&&n>0){let r=Math.round(u(l,e+a,t-a-e));o=u(o,-1/0,0),s.lineTo(r-a,0),s.lineTo(l,o),s.lineTo(r+a,0)}if(s.lineTo(t-e,0),s.arcTo(t,0,t,e,e),c>0&&n<0){let r=Math.round(u(o,e+a,i-a-e));l=u(l,t,1/0),s.lineTo(t,e),s.lineTo(t,Math.max(r-a,e)),s.lineTo(l,o),s.lineTo(t,r+a)}if(s.lineTo(t,i-e),s.arcTo(t,i,t-e,i,e),c<0&&n<0){let r=Math.round(u(l,e+a,t-a-e));o=u(o,i,1/0),s.lineTo(t-e,i),s.lineTo(r+a,i),s.lineTo(l,o),s.lineTo(r-a,i)}if(s.lineTo(e,i),s.arcTo(0,i,0,i-e,e),c<0&&n>0){let r=Math.round(u(o,e+a,i-e-a));l=u(l,-1/0,0),s.lineTo(0,i-e),s.lineTo(0,r+a),s.lineTo(l,o),s.lineTo(0,Math.max(r-a,e))}s.lineTo(0,e),s.arcTo(0,0,e,0,e),s.closePath()}}}}Object.defineProperty(D,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PointedRectangle"}),Object.defineProperty(D,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:M.classNames.concat([D.className])});class P extends N{constructor(t,i,e,l=[]){super(t,i,e,l),Object.defineProperty(this,"_fx",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_fy",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_label",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fillDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_strokeDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_labelDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_w",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_h",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_keepHoverDp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_htmlContentHovered",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_afterNew(){this._settings.themeTags=E(this._settings.themeTags,["tooltip"]),super._afterNew(),this.set("background",D.new(this._root,{themeTags:["tooltip","background"]})),this._label=this.children.push(F.new(this._root,{})),this._disposers.push(this._label.events.on("boundschanged",()=>{this._updateBackground()})),this._disposers.push(this.on("bounds",()=>{this._updateBackground()})),this._updateTextColor(),this._root.tooltipContainer.children.push(this),this.hide(0),this._disposers.push(this.label.onPrivate("htmlElement",t=>{t&&(x(t,"pointerover",i=>{this._htmlContentHovered=!0}),x(t,"pointerout",i=>{this._htmlContentHovered=!1}))})),this._root._tooltips.push(this)}get label(){return this._label}dispose(){super.dispose(),L(this._root._tooltips,this)}_updateChildren(){super._updateChildren(),(this.isDirty("pointerOrientation")||this.isPrivateDirty("minWidth")||this.isPrivateDirty("minHeight"))&&this.get("background")._markDirtyKey("width"),this.get("labelText")!=null&&this.label.set("text",this.get("labelText")),this.get("labelHTML")!=null&&this.label.set("html",this.get("labelHTML"))}_changed(){if(super._changed(),(this.isDirty("pointTo")||this.isDirty("pointerOrientation"))&&this._updateBackground(),this.isDirty("tooltipTarget")&&this.updateBackgroundColor(),this.isDirty("keepTargetHover"))if(this.get("keepTargetHover")){const t=this.get("background");this._keepHoverDp=new X([t.events.on("pointerover",i=>{let e=this.get("tooltipTarget");e&&(e.parent&&e.parent.getPrivate("tooltipTarget")==e&&(e=e.parent),e.hover())}),t.events.on("pointerout",i=>{let e=this.get("tooltipTarget");e&&(e.parent&&e.parent.getPrivate("tooltipTarget")==e&&(e=e.parent),this._htmlContentHovered||e.unhover())})]),this.label.onPrivate("htmlElement",i=>{this._keepHoverDp&&i&&this._keepHoverDp.disposers.push(x(i,"pointerleave",e=>{const l=this.root._renderer.getEvent(e);t.events.dispatch("pointerout",{type:"pointerout",originalEvent:l.event,point:l.point,simulated:!1,target:t})}))})}else this._keepHoverDp&&(this._keepHoverDp.dispose(),this._keepHoverDp=void 0)}_onShow(){super._onShow(),this.updateBackgroundColor()}updateBackgroundColor(){let t=this.get("tooltipTarget");const i=this.get("background");let e,l;t&&i&&(e=t.get("fill"),l=t.get("stroke"),e==null&&(e=l),this.get("getFillFromSprite")&&(this._fillDp&&this._fillDp.dispose(),e!=null&&i.set("fill",e),this._fillDp=t.on("fill",o=>{o!=null&&(i.set("fill",o),this._updateTextColor(o))}),this._disposers.push(this._fillDp)),this.get("getStrokeFromSprite")&&(this._strokeDp&&this._strokeDp.dispose(),e!=null&&i.set("stroke",e),this._strokeDp=t.on("fill",o=>{o!=null&&i.set("stroke",o)}),this._disposers.push(this._strokeDp)),this.get("getLabelFillFromSprite")&&(this._labelDp&&this._labelDp.dispose(),e!=null&&this.label.set("fill",e),this._labelDp=t.on("fill",o=>{o!=null&&this.label.set("fill",o)}),this._disposers.push(this._labelDp))),this._updateTextColor(e)}_updateTextColor(t){this.get("autoTextColor")&&(t==null&&(t=this.get("background").get("fill")),t==null&&(t=this._root.interfaceColors.get("background")),t instanceof j&&this.label.set("fill",j.alternative(t,this._root.interfaceColors.get("alternativeText"),this._root.interfaceColors.get("text"))))}_setDataItem(t){super._setDataItem(t),this.label._setDataItem(t)}_updateBackground(){super.updateBackground();const t=this._root.container;if(t){let i=.5,e=.5,l=this.get("centerX");l instanceof B&&(i=l.value);let o=this.get("centerY");o instanceof B&&(e=o.value);let a=t.width(),T=t.height(),_=this.parent,f=0,c=0;if(_){f=_.x(),c=_.y();const d=_.get("layerMargin");d&&(f+=d.left||0,c+=d.top||0,a+=(d.left||0)+(d.right||0),T+=(d.top||0)+(d.bottom||0))}const n=this.get("bounds",{left:-f,top:-c,right:a-f,bottom:T-c});this._updateBounds();let s=this.width(),r=this.height();s===0&&(s=this._w),r===0&&(r=this._h);let k=this.get("pointTo",{x:a/2,y:T/2}),h=k.x,p=k.y,v=this.get("pointerOrientation"),b=this.get("background"),g=0,m=0,y=0;b instanceof D&&(g=b.get("pointerLength",0),m=b.get("strokeWidth",0)/2,y=m,b.set("width",s),b.set("height",r));let C=0,O=0,H=n.right-n.left,W=n.bottom-n.top;v=="horizontal"||v=="left"||v=="right"?(m=0,v=="horizontal"?h>n.left+H/2?(h-=s*(1-i)+g,y*=-1):h+=s*i+g:v=="left"?h+=s*(1-i)+g:(h-=s*i+g,y*=-1)):(y=0,v=="vertical"?p>n.top+r/2+g?p-=r*(1-e)+g:(p+=r*e+g,m*=-1):v=="down"?p-=r*(1-e)+g:(p+=r*e+g,m*=-1)),h=u(h,n.left+s*i,n.left+H-s*(1-i))+y,p=u(p,n.top+r*e,n.top+W-r*(1-e))-m,C=k.x-h+s*i+y,O=k.y-p+r*e-m,this._fx=h,this._fy=p;const w=this.get("animationDuration",0);if(w>0&&this.get("visible")&&this.get("opacity")>.1){const d=this.get("animationEasing");this.animate({key:"x",to:h,duration:w,easing:d}),this.animate({key:"y",to:p,duration:w,easing:d})}else this.set("x",h),this.set("y",p);b instanceof D&&(b.set("pointerX",C),b.set("pointerY",O)),s>0&&(this._w=s),r>0&&(this._h=r)}}}Object.defineProperty(P,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Tooltip"}),Object.defineProperty(P,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:N.classNames.concat([P.className])});export{P as u}; diff --git a/dist/assets/Tooltip-ON77BKb3.js b/dist/assets/Tooltip-a9KqLK1p.js similarity index 76% rename from dist/assets/Tooltip-ON77BKb3.js rename to dist/assets/Tooltip-a9KqLK1p.js index 5a21c81..94c487b 100644 --- a/dist/assets/Tooltip-ON77BKb3.js +++ b/dist/assets/Tooltip-a9KqLK1p.js @@ -1,7 +1,7 @@ -import{f as yt,s as bt,m as V,z as Mt,Z as P,x as Lt}from"./euclideanLengthMeasurementUtils-VQw5qWk6.js";import{kQ as Ct,as as Et,aa as D,r5 as Vt,kB as Dt,eF as Ot,cp as C,aB as at,kI as wt,aC as dt,aH as zt,al as It,kG as Rt,K as Ft,e as a,y as c,c as v,hn as s,v7 as Nt,hl as A,kM as ht,gD as At,d8 as S,pH as F,rl as vt,d as N,fl as St,hm as xt,hB as Ht,de as E,v8 as Pt,v9 as Ut,va as Wt,vb as qt,p as Kt,vc as Zt,A as H,n as ft,hw as Gt}from"./index-J0iiHjMT.js";import{T as lt,k as Bt,q as mt,x as jt,F as Qt,S as Xt,U as Yt}from"./quantityFormatUtils-NiAiojad.js";function Jt({hasZ:n,spatialReference:t,paths:e},i,o=0){const l=Ct(t);if(l==null)return!1;const r=n?h=>h:h=>Et(te,h[0],h[1],o);for(const h of e){const b=[];for(const T of h){const y=[0,0,o];l(r(T),0,y,0),b.push(y)}i.push(b)}return!0}const te=D();function kt(n,t,e,i,...o){return Vt(n)&&Dt(n)?t.apply(void 0,o):Ot(n)?e.apply(void 0,o):i.apply(void 0,o)}function Tt(n){const{spatialReference:t}=n;return kt(t,se,oe,ae,n)}function rt(n,t){if(!It(n.spatialReference,t.spatialReference))return null;const{spatialReference:e}=n;return O[0]=n.x,O[1]=n.y,O[2]=n.hasZ?n.z:0,z[0]=t.x,z[1]=t.y,z[2]=t.hasZ?t.z:0,ct(O,z,e)}function ct(n,t,e){return kt(e,ee,ne,ie,n,t,e)}function ee(n,t,e){return C(at(ut,n,t,e).distance,"meters")}function ne(n,t,e){return C(wt(le(n,t,e),"meters"),"meters")}function ie(n,t,e){return dt(n,e,_t)&&dt(t,e,gt)?C(at(ut,_t,gt).distance,"meters"):null}function se(n){return C(Rt([n],"meters")[0],"meters")}function oe(n){return C(wt(n,"meters"),"meters")}function ae(n){const t=[];if(!Jt(n,t))return null;let e=0;for(const i of t){let o=0;for(let l=1;l!t.readOnly)}enterInputMode(){this._mode="input",this.emit("focus")}exitInputMode(){this._mode="feedback"}unlockAllFields(){this.allFields.forEach(t=>t.unlock())}};a([c()],w.prototype,"tooltipOptions",void 0),a([c()],w.prototype,"_mode",void 0),a([c()],w.prototype,"mode",null),a([c()],w.prototype,"helpMessage",void 0),a([c()],w.prototype,"viewType",void 0),a([c()],w.prototype,"allFields",null),a([c()],w.prototype,"editableFields",null),w=a([v("esri.views.interactive.tooltip.SketchTooltipInfo")],w);const k="esri-tooltip",p=`${k}-content`,re=`${k}-content--input`,ce=`${k}-content__header`,ue=`${k}-table`,pe=`${k}-help-message`;function f({className:n,helpMessage:t,mode:e,onDiscard:i,onkeydown:o},...l){const r=l.flat(10).filter(h=>!!h);return s("div",{class:Nt(n,p,e==="input"&&re),onkeydown:o},e==="input"?s("div",{class:ce,key:"tooltip-content-header"},s("calcite-button",{appearance:"transparent",iconFlipRtl:"both",iconStart:"chevron-left",kind:"neutral",onclick:i,scale:"s",tabIndex:-1})):null,r.length>0?s("div",{class:ue},...r):null,t?s("div",{class:pe,key:"help-message"},t):null)}const I=`${k}-field`,R={base:I,inputMode:`${I}--input`,title:`${I}__title`,value:`${I}__value`};let u=class extends A{constructor(){super(...arguments),this.hidden=!1,this.mode="feedback"}render(){return s("div",{class:this.classes({[R.base]:!0,[R.inputMode]:this.mode==="input"})},s("div",{class:R.title},this.title),s("div",{class:R.value},this.value))}};a([c()],u.prototype,"hidden",void 0),a([c()],u.prototype,"mode",void 0),a([c()],u.prototype,"title",void 0),a([c()],u.prototype,"value",void 0),u=a([v("esri.views.interactive.tooltip.TooltipField")],u);const de={base:`${k}-value-by-value`};let x=class extends A{constructor(){super(...arguments),this.divider="×"}render(){return s("div",{class:de.base},s("span",null,this.left),s("span",null,this.divider),s("span",null,this.right))}};a([c()],x.prototype,"left",void 0),a([c()],x.prototype,"divider",void 0),a([c()],x.prototype,"right",void 0),x=a([v("esri.views.interactive.tooltip.ValueByValue")],x);let d=class extends A{constructor(){super(...arguments),this._getFormatters=At((n,t)=>({angle:e=>lt(e,e.rotationType),area:(e,i)=>Bt(n,e,i??t.area),length:(e,i,o)=>mt(n,e,i??t.length,o),relativeLength:(e,i)=>jt(n,e,i??t.length),totalLength:(e,i)=>mt(n,e,i??t.length),verticalLength:(e,i)=>Qt(n,e,i??t.length),relativeVerticalLength:(e,i)=>Xt(n,e,i??t.verticalLength),relativeOrientation:e=>S(e,{maximumFractionDigits:2,minimumFractionDigits:2,signDisplay:"exceptZero"}),percentage:e=>S(e.value,{style:"percent"}),scale:e=>S(e,{style:"percent",maximumFractionDigits:0})})),this._formatScale=n=>this._formatters.scale(n),this._formatRelativeOrientation=n=>this._formatters.relativeOrientation(n),this._formatLength=(n,t,e)=>this._formatters.length(n,t,e),this._formatRelativeLength=(n,t)=>this._formatters.relativeLength(n,t),this._formatVerticalLength=(n,t)=>this._formatters.verticalLength(n,t),this._formatRelativeVerticalLength=(n,t)=>this._formatters.relativeVerticalLength(n,t),this._formatArea=(n,t)=>this._formatters.area(n,t),this._formatPercentage=n=>this._formatters.percentage(n),this._onDiscard=()=>{this._exitInputMode()},this._onCommit=(n,t)=>{var r;if(t==="commit-and-exit")return this._exitInputMode();const e=this._getFocusableInputs(),i=e.length,o=e.indexOf(n);if(o===-1)return this._exitInputMode();const l=((o+(t==="commit-and-next"?1:-1))%i+i)%i;(r=e.at(l))==null||r.focus()},this._handleTab=n=>{if(n.code!==F.next)return;const t=this._getFocusableInputs();if(t.length===0)return;const e=t.at(0),i=t.at(-1);e&&i&&(n.shiftKey?document.activeElement===e&&(n.preventDefault(),i.focus()):document.activeElement===i&&(n.preventDefault(),e.focus()))}}get _displayUnits(){const n=vt(this.tooltip.view);return{length:n,verticalLength:n,area:n,angle:"degrees"}}get _inputUnitInfos(){const n=this._messagesUnits,t=h=>({unit:h,abbreviation:Ht(n,h,"abbr")}),e=vt(this.tooltip.view),i=Pt(e),o=Ut(e),l=Wt(e),r="degrees";return{length:t(i),relativeLength:t(i),verticalLength:t(o),relativeVerticalLength:t(o),area:t(l),orientation:t(r),rotation:t(r)}}get _formatters(){return this._getFormatters(this._messagesUnits,this._displayUnits)}get fieldContext(){return{formatters:this._formatters,inputUnitInfos:this._inputUnitInfos,messages:this._messagesTooltip,onCommit:this._onCommit,onDiscard:this._onDiscard}}initialize(){let n=new AbortController;this.addHandles([N(()=>this.info.mode,t=>{this.tooltip.positionMode=t==="input"?"fixed":"follow-cursor"}),St(()=>this.info,"focus",()=>{n==null||n.abort();const{signal:t}=n=new AbortController;requestAnimationFrame(()=>{var e;t.aborted||((e=this._getFocusableInputs().at(0))==null||e.focus())})})])}loadDependencies(){return xt({button:()=>E(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])),icon:()=>E(()=>import("./calcite-icon-itD416se.js"),__vite__mapDeps([16,13,2,3,10])),input:()=>E(()=>import("./calcite-input-V4_hyPVg.js"),__vite__mapDeps([17,18,2,3,4,5,9,6,7,8,10,12,11,13,19]))})}_getHelpMessage(n){var b,T,y,m;const{info:t}=this,{tooltipOptions:e,helpMessage:i,viewType:o}=t,l=(b=e==null?void 0:e.visibleElements)==null?void 0:b.helpMessage,r=n??i,h=o==="3d"?"helpMessages3d":"helpMessages2d";return l&&r?(m=(y=(T=this._messagesTooltip)==null?void 0:T.sketch)==null?void 0:y[h])==null?void 0:m[r]:void 0}_exitInputMode(){this.info.exitInputMode(),document.querySelector(".esri-view-surface").focus()}_getFocusableInputs(){var n;return Array.from(((n=this.domNode)==null?void 0:n.querySelectorAll("input:not([disabled])"))??[])}};a([ht("esri/core/t9n/Units"),c()],d.prototype,"_messagesUnits",void 0),a([ht("esri/views/interactive/tooltip/t9n/Tooltip"),c()],d.prototype,"_messagesTooltip",void 0),a([c()],d.prototype,"info",void 0),a([c()],d.prototype,"tooltip",void 0),a([c()],d.prototype,"_displayUnits",null),a([c()],d.prototype,"_inputUnitInfos",null),a([c()],d.prototype,"_formatters",null),a([c()],d.prototype,"fieldContext",null),d=a([v("esri.views.interactive.tooltip.content.TooltipContent")],d);const he={base:`${p} ${`${p}--draw-rectangle`}`};let U=class extends d{render(){const{area:t,radius:e,xSize:i,ySize:o,tooltipOptions:l}=this.info,{visibleElements:r}=l,h=this._messagesTooltip.sketch;return s(f,{className:he.base,helpMessage:this._getHelpMessage()},r.radius&&e!=null?s(u,{title:h.radius,value:this._formatLength(e)}):null,r.size&&i!=null&&o!=null?s(u,{title:h.size,value:s(x,{left:this._formatLength(i),right:this._formatLength(o)})}):null,r.area?s(u,{title:h.area,value:this._formatArea(t)}):null)}};U=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawCircle")],U);const ve={base:`${p}--draw-mesh`};let W=class extends d{render(){const{elevation:t,tooltipOptions:e}=this.info,{visibleElements:i}=e,o=this._messagesTooltip.sketch;return s(f,{className:ve.base,helpMessage:this._getHelpMessage()},i.elevation?s(u,{title:o.elevation,value:this._formatVerticalLength(t.actual)}):null)}};W=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawMesh")],W);const _=`${k}-editable-field`,g={base:_,inputMode:`${_}--input`,locked:`${_}--locked`,title:`${_}__title`,titleContent:`${_}__title__content`,value:`${_}__value`,valueContent:`${_}__value__content`,input:`${_}__input`,inputDisabled:`${_}__input--disabled`,inputReadOnly:`${_}__input--read-only`,inputSuffix:`${_}__input-suffix`,button:`${_}__button`};let $=class extends A{constructor(){super(...arguments),this._input=null,this._afterInputCreate=t=>{this._input=t},this._selectText=()=>{requestAnimationFrame(()=>{var t;(t=this._input)==null||t.select()})},this._onKeyDown=t=>{t.key===F.discard&&this._discard()},this._onInputKeyDown=t=>{switch(t.key){case F.commit:return this._commit({type:"commit-and-exit",allowLockingCurrentValue:!0});case F.next:return t.stopPropagation(),this._commit({type:t.shiftKey?"commit-and-previous":"commit-and-next",allowLockingCurrentValue:!1})}},this._onInput=t=>{this.field.inputValue=t.target.value},this._onLockClick=()=>{const{field:t}=this;t.locked?t.unlock():this._lock()}}loadDependencies(){return xt({button:()=>E(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])),icon:()=>E(()=>import("./calcite-icon-itD416se.js"),__vite__mapDeps([16,13,2,3,10]))})}render(){const{mode:t,field:e}=this,i=t==="input",{locked:o}=e;return s("div",{class:this.classes({[g.base]:!0,[g.inputMode]:t==="input",[g.locked]:o})},s("div",{class:g.title,key:"title"},s("div",{class:g.titleContent,key:"title-content"},this._title,o&&!i?s("calcite-icon",{icon:"lock",key:"icon",scale:"s"}):null)),s("div",{class:g.value,key:"value"},i?this._renderInput():s("span",{key:"formatted-value"},this._feedbackValue)))}get _initialValue(){const{field:t}=this;return t.actual!=null?t.toInputUnits(t.actual,this.context).value:null}get _feedbackValue(){const{context:t,field:e}=this,{actual:i,committed:o,format:l}=e;return o!=null?l(o,t):i!=null?l(i,t):""}get _displayValue(){const{field:t}=this,{inputValue:e,committed:i}=t;return e??(i!=null?this._toString(t.toInputUnits(i,this.context).value):this._toString(this._initialValue))}get _suffix(){const{suffix:t}=this.field;return typeof t=="string"?t:t(this.context)}get _title(){const{title:t}=this.field;return typeof t=="string"?t:t(this.context)}_renderInput(){const{disabled:t,locked:e,readOnly:i}=this.field;return s("div",{class:g.valueContent,key:"input-container",onkeydown:this._onKeyDown},s("input",{afterCreate:this._afterInputCreate,class:this.classes({[g.input]:!0,[g.inputDisabled]:t,[g.inputReadOnly]:i}),disabled:t||i,onfocus:this._selectText,oninput:this._onInput,onkeydown:this._onInputKeyDown,readOnly:i,type:"text",value:this._displayValue}),s("div",{class:g.inputSuffix,key:"suffix"},this._suffix),i?void 0:s("calcite-button",{appearance:"transparent",class:g.button,disabled:t,iconStart:e?"lock":"unlock",kind:"neutral",onclick:this._onLockClick,scale:"s",tabIndex:-1}))}_commit({type:t,allowLockingCurrentValue:e}){const{_input:i,field:o}=this;i&&(o.locked&&o.inputValue===""?o.unlock():(e||o.inputValue!=null)&&this._lock(),this.context.onCommit(i,t))}_discard(){this._input&&(this.field.inputValue=null,this.context.onDiscard(this._input))}_lock(){const{field:t}=this,e=this._parseNumber(t.inputValue),i=e!=null?t.createQuantity(e,this.context):null;t.lock(i)}_parseNumber(t){if(t==null)return null;const e=parseFloat(t);return isNaN(e)||!isFinite(e)?null:e}_toString(t){return t!=null?t.toFixed(3):"0"}};a([c()],$.prototype,"field",void 0),a([c()],$.prototype,"context",void 0),a([c()],$.prototype,"mode",void 0),a([c()],$.prototype,"_initialValue",null),a([c()],$.prototype,"_feedbackValue",null),a([c()],$.prototype,"_input",void 0),a([c()],$.prototype,"_displayValue",null),a([c()],$.prototype,"_suffix",null),a([c()],$.prototype,"_title",null),$=a([v("esri.views.interactive.tooltip.TooltipEditableField")],$);function pt(n){const t=n.fields.filter(e=>e!=null&&!e.hidden);return t.length===0?null:s(qt,null,t.map(e=>s($,{context:n.context,field:e,key:e.id,mode:n.mode})))}const fe={base:`${p}--draw-point`};let q=class extends d{render(){const{fieldContext:t,info:e}=this,{mode:i,elevation:o,tooltipOptions:l}=e,{visibleElements:r}=l;return s(f,{className:fe.base,helpMessage:this._getHelpMessage(),mode:i,onkeydown:this._handleTab,onDiscard:this._onDiscard},s(pt,{context:t,fields:[r.elevation?o:void 0],mode:i}))}};q=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawPoint")],q);const me={base:`${p} ${`${p}--draw-polygon`}`};let K=class extends d{render(){const{fieldContext:t,info:e}=this,{area:i,distance:o,elevation:l,mode:r,orientation:h,tooltipOptions:b,viewType:T}=e,{inputEnabled:y,visibleElements:m}=b;return s(f,{className:me.base,helpMessage:this._getHelpMessage(),mode:r,onkeydown:this._handleTab,onDiscard:this._onDiscard},s(pt,{context:t,fields:[y&&m.orientation?h:void 0,y&&m.distance?o:void 0,m.elevation&&T!=="2d"?l:void 0,m.area?i:void 0],mode:r}))}};K=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawPolygon")],K);const _e={base:`${p} ${`${p}--draw-polyline`}`};let Z=class extends d{render(){const{fieldContext:t,info:e}=this,{distance:i,elevation:o,mode:l,orientation:r,tooltipOptions:h,totalLength:b,viewType:T}=e,{inputEnabled:y,visibleElements:m}=h;return s(f,{className:_e.base,helpMessage:this._getHelpMessage(),mode:l,onkeydown:this._handleTab,onDiscard:this._onDiscard},s(pt,{context:t,fields:[y&&m.orientation?r:void 0,y&&m.distance?i:void 0,m.elevation&&T!=="2d"?o:void 0,m.totalLength?b:void 0],mode:l}))}};Z=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawPolyline")],Z);const ge={base:`${p} ${`${p}--draw-rectangle`}`};let G=class extends d{render(){const{area:t,xSize:e,ySize:i,tooltipOptions:o}=this.info,{visibleElements:l}=o,r=this._messagesTooltip.sketch;return s(f,{className:ge.base,helpMessage:this._getHelpMessage()},l.size&&e!=null&&i!=null?s(u,{title:r.size,value:s(x,{left:this._formatLength(e),right:this._formatLength(i)})}):null,l.area?s(u,{title:r.area,value:this._formatArea(t)}):null)}};G=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawRectangle")],G);const $e={base:`${p} ${`${p}--extent-rotate`}`};let B=class extends d{render(){const{angle:t,tooltipOptions:e}=this.info,{visibleElements:i}=e,o=this._messagesTooltip.sketch;return s(f,{className:$e.base,helpMessage:this._getHelpMessage()},i.rotation?s(u,{title:o.rotation,value:this._formatRelativeOrientation(t)}):null)}};B=a([v("esri.views.interactive.tooltip.content.TooltipContentExtentRotate")],B);const ye={base:`${p} ${`${p}--extent-scale`}`};let j=class extends d{render(){const t=this.info,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:ye.base,helpMessage:this._getHelpMessage()},e.size?s(u,{title:i.size,value:s(x,{left:this._formatLength(t.xSize),right:this._formatLength(t.ySize)})}):null,e.scale?s(u,{title:i.scale,value:s(x,{left:this._formatScale(t.xScale),right:this._formatScale(t.yScale)})}):null)}};j=a([v("esri.views.interactive.tooltip.content.TooltipContentExtentScale")],j);const be={base:`${p} ${`${p}--reshape-edge-offset`}`};let Q=class extends d{render(){const{area:t,distance:e,totalLength:i,tooltipOptions:o}=this.info,{visibleElements:l}=o,r=this._messagesTooltip.sketch;return s(f,{className:be.base,helpMessage:this._getHelpMessage()},l.distance?s(u,{title:r.distance,value:this._formatRelativeLength(e)}):null,l.area&&t!=null?s(u,{title:r.area,value:this._formatArea(t)}):null,l.totalLength&&i!=null?s(u,{title:r.totalLength,value:this._formatLength(i)}):null)}};Q=a([v("esri.views.interactive.tooltip.content.TooltipContentReshapeEdgeOffset")],Q);const we={base:`${p} ${`${p}--transform-absolute`}`};let X=class extends d{render(){const{info:t}=this,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:we.base,helpMessage:this._getHelpMessage()},e.orientation&&t.orientation!=null?s(u,{key:"orientation",title:i.orientation,value:lt(t.orientation,t.rotationType,t.orientationPrecision)}):null,e.size&&t.size!=null?s(u,{key:"size",title:i.size,value:this._formatLength(t.size,t.sizeUnit,t.sizePrecision)}):null)}};X=a([v("esri.views.interactive.tooltip.content.TooltipContentTransformAbsolute")],X);const xe={base:`${p} ${`${p}--transform-rotate`}`};let Y=class extends d{render(){const{info:t}=this,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:xe.base,helpMessage:this._getHelpMessage()},e.rotation&&t.rotation!=null?s(u,{key:"rotation",title:i.rotation,value:Yt(t.rotation,t.rotationType,t.rotationPrecision)}):null,e.orientation&&t.orientation!=null?s(u,{key:"orientation",title:i.orientation,value:lt(t.orientation,t.rotationType,t.orientationPrecision)}):null)}};Y=a([v("esri.views.interactive.tooltip.content.TooltipContentTransformRotate")],Y);const ke={base:`${p} ${`${p}--transform-scale`}`};let J=class extends d{render(){const{info:t}=this,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:ke.base,helpMessage:this._getHelpMessage()},e.scale&&t.scale!=null?s(u,{key:"scale",title:i.scale,value:this._formatPercentage(t.scale)}):null,e.size&&t.size!=null?s(u,{key:"size",title:i.size,value:this._formatLength(t.size,t.sizeUnit,t.sizePrecision)}):null)}};J=a([v("esri.views.interactive.tooltip.content.TooltipContentTransformScale")],J);const Te={base:`${p} ${`${p}--translate-graphic`}`};let tt=class extends d{render(){const{info:t}=this,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:Te.base,helpMessage:this._getHelpMessage()},e.distance?s(u,{title:i.distance,value:this._formatLength(t.distance)}):null)}};tt=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateGraphic")],tt);const Me={base:`${p} ${`${p}--translate-graphic-xy`}`};let et=class extends d{render(){const{info:t}=this,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:Me.base,helpMessage:this._getHelpMessage()},e.distance?s(u,{title:i.distance,value:this._formatRelativeLength(t.distance)}):null)}};et=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateGraphicXY")],et);const Le={base:`${p} ${`${p}--translate-graphic-z`}`};let nt=class extends d{render(){const{info:n}=this,{visibleElements:t}=n.tooltipOptions,e=this._messagesTooltip.sketch;return s(f,{className:Le.base,helpMessage:this._getHelpMessage()},t.distance?s(u,{title:e.distance,value:this._formatRelativeVerticalLength(n.distance)}):null)}};nt=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateGraphicZ")],nt);const Ce={base:`${p} ${`${p}--translate-vertex`}`};let it=class extends d{render(){const{distance:t,elevation:e,area:i,totalLength:o,tooltipOptions:l}=this.info,{visibleElements:r}=l,h=this._messagesTooltip.sketch;return s(f,{className:Ce.base,helpMessage:this._getHelpMessage()},r.distance?s(u,{title:h.distance,value:this._formatLength(t)}):null,r.elevation&&e!=null?s(u,{title:h.elevation,value:this._formatVerticalLength(e.actual)}):null,r.area&&i!=null?s(u,{title:h.area,value:this._formatArea(i)}):null,r.totalLength&&o!=null?s(u,{title:h.totalLength,value:this._formatLength(o)}):null)}};it=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateVertex")],it);const Ee={base:`${p} ${`${p}--translate-vertex`}`};let st=class extends d{render(){const{area:n,distance:t,elevation:e,totalLength:i,tooltipOptions:o}=this.info,{visibleElements:l}=o,r=this._messagesTooltip.sketch;return s(f,{className:Ee.base,helpMessage:this._getHelpMessage()},l.distance?s(u,{title:r.distance,value:this._formatRelativeLength(t)}):null,l.elevation&&e!=null?s(u,{title:r.elevation,value:this._formatVerticalLength(e.actual)}):null,l.area&&n!=null?s(u,{title:r.area,value:this._formatArea(n)}):null,l.totalLength&&i!=null?s(u,{title:r.totalLength,value:this._formatLength(i)}):null)}};st=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateVertexXY")],st);const Ve={base:`${p} ${`${p}--translate-vertex`}`};let ot=class extends d{render(){const{distance:n,elevation:t,tooltipOptions:e}=this.info,{visibleElements:i}=e,o=this._messagesTooltip.sketch;return s(f,{className:Ve.base,helpMessage:this._getHelpMessage()},i.distance?s(u,{title:o.distance,value:this._formatRelativeVerticalLength(n)}):null,i.elevation&&t!=null?s(u,{title:o.elevation,value:this._formatVerticalLength(t.actual)}):null)}};ot=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateVertexZ")],ot);function De(n,t){if(t==null)return null;const e=document.createElement("div");switch(t.type){case"draw-point":return new q({tooltip:n,info:t,container:e});case"draw-polygon":return new K({tooltip:n,info:t,container:e});case"draw-polyline":return new Z({tooltip:n,info:t,container:e});case"draw-mesh":return new W({tooltip:n,info:t,container:e});case"draw-rectangle":return new G({tooltip:n,info:t,container:e});case"draw-circle":return new U({tooltip:n,info:t,container:e});case"extent-rotate":return new B({tooltip:n,info:t,container:e});case"extent-scale":return new j({tooltip:n,info:t,container:e});case"transform-absolute":return new X({tooltip:n,info:t,container:e});case"transform-rotate":return new Y({tooltip:n,info:t,container:e});case"transform-scale":return new J({tooltip:n,info:t,container:e});case"translate-graphic":return new tt({tooltip:n,info:t,container:e});case"translate-graphic-z":return new nt({tooltip:n,info:t,container:e});case"translate-graphic-xy":return new et({tooltip:n,info:t,container:e});case"translate-vertex":return new it({tooltip:n,info:t,container:e});case"translate-vertex-z":return new ot({tooltip:n,info:t,container:e});case"translate-vertex-xy":return new st({tooltip:n,info:t,container:e});case"reshape-edge-offset":return new Q({tooltip:n,info:t,container:e})}}const Oe={base:`${k}`};let M=class extends Kt{constructor(n){super(n),this.info=null,this.positionMode="follow-cursor",this._contentContainer=(()=>{const t=document.createElement("div");return t.classList.add(Oe.base),Zt(t),t})(),this._contentWidget=null}initialize(){const n=this._contentContainer;this.addHandles([N(()=>{var t;return(t=this.view.overlay)==null?void 0:t.surface},t=>{n.remove(),t==null||t.appendChild(n)},H),N(()=>this.info,(t,e)=>{if(this._contentWidget!=null&&t!=null&&e!=null&&t.type===e.type)this._contentWidget.info=t;else{this._contentWidget=ft(this._contentWidget);const i=De(this,t);i&&(this._contentWidget=i,i.container&&n.appendChild(i.container))}},H),N(()=>({container:this._contentContainer,contentWidget:this._contentWidget,screenPoint:this._screenPoint,positionMode:this.positionMode}),ze,H)])}destroy(){this._contentWidget=ft(this._contentWidget),this._contentContainer.remove()}clear(){this.info=null}get _screenPoint(){const n=this.view.inputManager;return n!=null&&n.multiTouchActive?null:n==null?void 0:n.latestPointerLocation}get test(){var n;return{contentContainer:this._contentContainer,visible:((n=this._contentContainer)==null?void 0:n.style.display)!=="none"}}};function ze({container:n,contentWidget:t,screenPoint:e,positionMode:i}){const{style:o}=n;if(i==="docked")return o.display="block",void(o.transform="none");if(i!=="fixed")if(e!=null&&t!=null){o.display="block";const l=Gt(n),r=`translate(${Math.round(e.x)+$t[0]*(l?-1:1)}px, ${Math.round(e.y)+$t[1]}px)`;o.transform=l?`translate(-100%, 0) ${r}`:r}else o.display="none"}a([c({nonNullable:!0})],M.prototype,"view",void 0),a([c()],M.prototype,"info",void 0),a([c()],M.prototype,"positionMode",void 0),a([c()],M.prototype,"_contentContainer",void 0),a([c()],M.prototype,"_contentWidget",void 0),a([c()],M.prototype,"_screenPoint",null),M=a([v("esri.views.interactive.tooltip.Tooltip")],M);const $t=[20,20];export{He as a,ct as b,Pe as c,Ae as d,Ue as g,Se as l,We as m,Ne as p,kt as r,w as s,M as u}; +import{f as yt,s as bt,m as z,z as Mt,Z as H,x as Lt}from"./euclideanLengthMeasurementUtils-Kj2RYqri.js";import{kE as Ct,bz as Et,a8 as V,ri as zt,kN as Vt,ez as Dt,bu as C,d7 as at,kT as wt,d8 as dt,da as Ot,bt as It,kS as Rt,z as Nt,e as a,y as c,c as v,hF as s,vl as Ft,hD as S,kX as ht,gA as St,c$ as A,pU as N,ry as vt,B as F,fg as At,hE as xt,hv as Pt,de as E,vm as Ht,vn as Ut,vo as Wt,vp as qt,g as Zt,vq as Kt,T as P,b as ft,hq as Gt}from"./index-pCX-0tJH.js";import{T as lt,k as jt,q as mt,x as Xt,F as Bt,S as Yt,U as Qt}from"./quantityFormatUtils-oYgdvR_2.js";function Jt({hasZ:n,spatialReference:t,paths:e},i,o=0){const l=Ct(t);if(l==null)return!1;const r=n?h=>h:h=>Et(te,h[0],h[1],o);for(const h of e){const b=[];for(const T of h){const y=[0,0,o];l(r(T),0,y,0),b.push(y)}i.push(b)}return!0}const te=V();function kt(n,t,e,i,...o){return zt(n)&&Vt(n)?t.apply(void 0,o):Dt(n)?e.apply(void 0,o):i.apply(void 0,o)}function Tt(n){const{spatialReference:t}=n;return kt(t,se,oe,ae,n)}function rt(n,t){if(!It(n.spatialReference,t.spatialReference))return null;const{spatialReference:e}=n;return D[0]=n.x,D[1]=n.y,D[2]=n.hasZ?n.z:0,O[0]=t.x,O[1]=t.y,O[2]=t.hasZ?t.z:0,ct(D,O,e)}function ct(n,t,e){return kt(e,ee,ne,ie,n,t,e)}function ee(n,t,e){return C(at(ut,n,t,e).distance,"meters")}function ne(n,t,e){return C(wt(le(n,t,e),"meters"),"meters")}function ie(n,t,e){return dt(n,e,_t)&&dt(t,e,gt)?C(at(ut,_t,gt).distance,"meters"):null}function se(n){return C(Rt([n],"meters")[0],"meters")}function oe(n){return C(wt(n,"meters"),"meters")}function ae(n){const t=[];if(!Jt(n,t))return null;let e=0;for(const i of t){let o=0;for(let l=1;l!t.readOnly)}enterInputMode(){this._mode="input",this.emit("focus")}exitInputMode(){this._mode="feedback"}unlockAllFields(){this.allFields.forEach(t=>t.unlock())}};a([c()],w.prototype,"tooltipOptions",void 0),a([c()],w.prototype,"_mode",void 0),a([c()],w.prototype,"mode",null),a([c()],w.prototype,"helpMessage",void 0),a([c()],w.prototype,"viewType",void 0),a([c()],w.prototype,"allFields",null),a([c()],w.prototype,"editableFields",null),w=a([v("esri.views.interactive.tooltip.SketchTooltipInfo")],w);const k="esri-tooltip",p=`${k}-content`,re=`${k}-content--input`,ce=`${k}-content__header`,ue=`${k}-table`,pe=`${k}-help-message`;function f({className:n,helpMessage:t,mode:e,onDiscard:i,onkeydown:o},...l){const r=l.flat(10).filter(h=>!!h);return s("div",{class:Ft(n,p,e==="input"&&re),onkeydown:o},e==="input"?s("div",{class:ce,key:"tooltip-content-header"},s("calcite-button",{appearance:"transparent",iconFlipRtl:"both",iconStart:"chevron-left",kind:"neutral",onclick:i,scale:"s",tabIndex:-1})):null,r.length>0?s("div",{class:ue},...r):null,t?s("div",{class:pe,key:"help-message"},t):null)}const I=`${k}-field`,R={base:I,inputMode:`${I}--input`,title:`${I}__title`,value:`${I}__value`};let u=class extends S{constructor(){super(...arguments),this.hidden=!1,this.mode="feedback"}render(){return s("div",{class:this.classes({[R.base]:!0,[R.inputMode]:this.mode==="input"})},s("div",{class:R.title},this.title),s("div",{class:R.value},this.value))}};a([c()],u.prototype,"hidden",void 0),a([c()],u.prototype,"mode",void 0),a([c()],u.prototype,"title",void 0),a([c()],u.prototype,"value",void 0),u=a([v("esri.views.interactive.tooltip.TooltipField")],u);const de={base:`${k}-value-by-value`};let x=class extends S{constructor(){super(...arguments),this.divider="×"}render(){return s("div",{class:de.base},s("span",null,this.left),s("span",null,this.divider),s("span",null,this.right))}};a([c()],x.prototype,"left",void 0),a([c()],x.prototype,"divider",void 0),a([c()],x.prototype,"right",void 0),x=a([v("esri.views.interactive.tooltip.ValueByValue")],x);let d=class extends S{constructor(){super(...arguments),this._getFormatters=St((n,t)=>({angle:e=>lt(e,e.rotationType),area:(e,i)=>jt(n,e,i??t.area),length:(e,i,o)=>mt(n,e,i??t.length,o),relativeLength:(e,i)=>Xt(n,e,i??t.length),totalLength:(e,i)=>mt(n,e,i??t.length),verticalLength:(e,i)=>Bt(n,e,i??t.length),relativeVerticalLength:(e,i)=>Yt(n,e,i??t.verticalLength),relativeOrientation:e=>A(e,{maximumFractionDigits:2,minimumFractionDigits:2,signDisplay:"exceptZero"}),percentage:e=>A(e.value,{style:"percent"}),scale:e=>A(e,{style:"percent",maximumFractionDigits:0})})),this._formatScale=n=>this._formatters.scale(n),this._formatRelativeOrientation=n=>this._formatters.relativeOrientation(n),this._formatLength=(n,t,e)=>this._formatters.length(n,t,e),this._formatRelativeLength=(n,t)=>this._formatters.relativeLength(n,t),this._formatVerticalLength=(n,t)=>this._formatters.verticalLength(n,t),this._formatRelativeVerticalLength=(n,t)=>this._formatters.relativeVerticalLength(n,t),this._formatArea=(n,t)=>this._formatters.area(n,t),this._formatPercentage=n=>this._formatters.percentage(n),this._onDiscard=()=>{this._exitInputMode()},this._onCommit=(n,t)=>{var r;if(t==="commit-and-exit")return this._exitInputMode();const e=this._getFocusableInputs(),i=e.length,o=e.indexOf(n);if(o===-1)return this._exitInputMode();const l=((o+(t==="commit-and-next"?1:-1))%i+i)%i;(r=e.at(l))==null||r.focus()},this._handleTab=n=>{if(n.code!==N.next)return;const t=this._getFocusableInputs();if(t.length===0)return;const e=t.at(0),i=t.at(-1);e&&i&&(n.shiftKey?document.activeElement===e&&(n.preventDefault(),i.focus()):document.activeElement===i&&(n.preventDefault(),e.focus()))}}get _displayUnits(){const n=vt(this.tooltip.view);return{length:n,verticalLength:n,area:n,angle:"degrees"}}get _inputUnitInfos(){const n=this._messagesUnits,t=h=>({unit:h,abbreviation:Pt(n,h,"abbr")}),e=vt(this.tooltip.view),i=Ht(e),o=Ut(e),l=Wt(e),r="degrees";return{length:t(i),relativeLength:t(i),verticalLength:t(o),relativeVerticalLength:t(o),area:t(l),orientation:t(r),rotation:t(r)}}get _formatters(){return this._getFormatters(this._messagesUnits,this._displayUnits)}get fieldContext(){return{formatters:this._formatters,inputUnitInfos:this._inputUnitInfos,messages:this._messagesTooltip,onCommit:this._onCommit,onDiscard:this._onDiscard}}initialize(){let n=new AbortController;this.addHandles([F(()=>this.info.mode,t=>{this.tooltip.positionMode=t==="input"?"fixed":"follow-cursor"}),At(()=>this.info,"focus",()=>{n==null||n.abort();const{signal:t}=n=new AbortController;requestAnimationFrame(()=>{var e;t.aborted||((e=this._getFocusableInputs().at(0))==null||e.focus())})})])}loadDependencies(){return xt({button:()=>E(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])),icon:()=>E(()=>import("./calcite-icon-ZhRmLRGh.js"),__vite__mapDeps([16,13,2,3,10])),input:()=>E(()=>import("./calcite-input-1VO9g4ut.js"),__vite__mapDeps([17,18,2,3,4,5,9,6,7,8,10,12,11,13,19]))})}_getHelpMessage(n){var b,T,y,m;const{info:t}=this,{tooltipOptions:e,helpMessage:i,viewType:o}=t,l=(b=e==null?void 0:e.visibleElements)==null?void 0:b.helpMessage,r=n??i,h=o==="3d"?"helpMessages3d":"helpMessages2d";return l&&r?(m=(y=(T=this._messagesTooltip)==null?void 0:T.sketch)==null?void 0:y[h])==null?void 0:m[r]:void 0}_exitInputMode(){this.info.exitInputMode(),document.querySelector(".esri-view-surface").focus()}_getFocusableInputs(){var n;return Array.from(((n=this.domNode)==null?void 0:n.querySelectorAll("input:not([disabled])"))??[])}};a([ht("esri/core/t9n/Units"),c()],d.prototype,"_messagesUnits",void 0),a([ht("esri/views/interactive/tooltip/t9n/Tooltip"),c()],d.prototype,"_messagesTooltip",void 0),a([c()],d.prototype,"info",void 0),a([c()],d.prototype,"tooltip",void 0),a([c()],d.prototype,"_displayUnits",null),a([c()],d.prototype,"_inputUnitInfos",null),a([c()],d.prototype,"_formatters",null),a([c()],d.prototype,"fieldContext",null),d=a([v("esri.views.interactive.tooltip.content.TooltipContent")],d);const he={base:`${p} ${`${p}--draw-rectangle`}`};let U=class extends d{render(){const{area:t,radius:e,xSize:i,ySize:o,tooltipOptions:l}=this.info,{visibleElements:r}=l,h=this._messagesTooltip.sketch;return s(f,{className:he.base,helpMessage:this._getHelpMessage()},r.radius&&e!=null?s(u,{title:h.radius,value:this._formatLength(e)}):null,r.size&&i!=null&&o!=null?s(u,{title:h.size,value:s(x,{left:this._formatLength(i),right:this._formatLength(o)})}):null,r.area?s(u,{title:h.area,value:this._formatArea(t)}):null)}};U=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawCircle")],U);const ve={base:`${p}--draw-mesh`};let W=class extends d{render(){const{elevation:t,tooltipOptions:e}=this.info,{visibleElements:i}=e,o=this._messagesTooltip.sketch;return s(f,{className:ve.base,helpMessage:this._getHelpMessage()},i.elevation?s(u,{title:o.elevation,value:this._formatVerticalLength(t.actual)}):null)}};W=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawMesh")],W);const _=`${k}-editable-field`,g={base:_,inputMode:`${_}--input`,locked:`${_}--locked`,title:`${_}__title`,titleContent:`${_}__title__content`,value:`${_}__value`,valueContent:`${_}__value__content`,input:`${_}__input`,inputDisabled:`${_}__input--disabled`,inputReadOnly:`${_}__input--read-only`,inputSuffix:`${_}__input-suffix`,button:`${_}__button`};let $=class extends S{constructor(){super(...arguments),this._input=null,this._afterInputCreate=t=>{this._input=t},this._selectText=()=>{requestAnimationFrame(()=>{var t;(t=this._input)==null||t.select()})},this._onKeyDown=t=>{t.key===N.discard&&this._discard()},this._onInputKeyDown=t=>{switch(t.key){case N.commit:return this._commit({type:"commit-and-exit",allowLockingCurrentValue:!0});case N.next:return t.stopPropagation(),this._commit({type:t.shiftKey?"commit-and-previous":"commit-and-next",allowLockingCurrentValue:!1})}},this._onInput=t=>{this.field.inputValue=t.target.value},this._onLockClick=()=>{const{field:t}=this;t.locked?t.unlock():this._lock()}}loadDependencies(){return xt({button:()=>E(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])),icon:()=>E(()=>import("./calcite-icon-ZhRmLRGh.js"),__vite__mapDeps([16,13,2,3,10]))})}render(){const{mode:t,field:e}=this,i=t==="input",{locked:o}=e;return s("div",{class:this.classes({[g.base]:!0,[g.inputMode]:t==="input",[g.locked]:o})},s("div",{class:g.title,key:"title"},s("div",{class:g.titleContent,key:"title-content"},this._title,o&&!i?s("calcite-icon",{icon:"lock",key:"icon",scale:"s"}):null)),s("div",{class:g.value,key:"value"},i?this._renderInput():s("span",{key:"formatted-value"},this._feedbackValue)))}get _initialValue(){const{field:t}=this;return t.actual!=null?t.toInputUnits(t.actual,this.context).value:null}get _feedbackValue(){const{context:t,field:e}=this,{actual:i,committed:o,format:l}=e;return o!=null?l(o,t):i!=null?l(i,t):""}get _displayValue(){const{field:t}=this,{inputValue:e,committed:i}=t;return e??(i!=null?this._toString(t.toInputUnits(i,this.context).value):this._toString(this._initialValue))}get _suffix(){const{suffix:t}=this.field;return typeof t=="string"?t:t(this.context)}get _title(){const{title:t}=this.field;return typeof t=="string"?t:t(this.context)}_renderInput(){const{disabled:t,locked:e,readOnly:i}=this.field;return s("div",{class:g.valueContent,key:"input-container",onkeydown:this._onKeyDown},s("input",{afterCreate:this._afterInputCreate,class:this.classes({[g.input]:!0,[g.inputDisabled]:t,[g.inputReadOnly]:i}),disabled:t||i,onfocus:this._selectText,oninput:this._onInput,onkeydown:this._onInputKeyDown,readOnly:i,type:"text",value:this._displayValue}),s("div",{class:g.inputSuffix,key:"suffix"},this._suffix),i?void 0:s("calcite-button",{appearance:"transparent",class:g.button,disabled:t,iconStart:e?"lock":"unlock",kind:"neutral",onclick:this._onLockClick,scale:"s",tabIndex:-1}))}_commit({type:t,allowLockingCurrentValue:e}){const{_input:i,field:o}=this;i&&(o.locked&&o.inputValue===""?o.unlock():(e||o.inputValue!=null)&&this._lock(),this.context.onCommit(i,t))}_discard(){this._input&&(this.field.inputValue=null,this.context.onDiscard(this._input))}_lock(){const{field:t}=this,e=this._parseNumber(t.inputValue),i=e!=null?t.createQuantity(e,this.context):null;t.lock(i)}_parseNumber(t){if(t==null)return null;const e=parseFloat(t);return isNaN(e)||!isFinite(e)?null:e}_toString(t){return t!=null?t.toFixed(3):"0"}};a([c()],$.prototype,"field",void 0),a([c()],$.prototype,"context",void 0),a([c()],$.prototype,"mode",void 0),a([c()],$.prototype,"_initialValue",null),a([c()],$.prototype,"_feedbackValue",null),a([c()],$.prototype,"_input",void 0),a([c()],$.prototype,"_displayValue",null),a([c()],$.prototype,"_suffix",null),a([c()],$.prototype,"_title",null),$=a([v("esri.views.interactive.tooltip.TooltipEditableField")],$);function pt(n){const t=n.fields.filter(e=>e!=null&&!e.hidden);return t.length===0?null:s(qt,null,t.map(e=>s($,{context:n.context,field:e,key:e.id,mode:n.mode})))}const fe={base:`${p}--draw-point`};let q=class extends d{render(){const{fieldContext:t,info:e}=this,{mode:i,elevation:o,tooltipOptions:l}=e,{visibleElements:r}=l;return s(f,{className:fe.base,helpMessage:this._getHelpMessage(),mode:i,onkeydown:this._handleTab,onDiscard:this._onDiscard},s(pt,{context:t,fields:[r.elevation?o:void 0],mode:i}))}};q=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawPoint")],q);const me={base:`${p} ${`${p}--draw-polygon`}`};let Z=class extends d{render(){const{fieldContext:t,info:e}=this,{area:i,distance:o,elevation:l,mode:r,orientation:h,tooltipOptions:b,viewType:T}=e,{inputEnabled:y,visibleElements:m}=b;return s(f,{className:me.base,helpMessage:this._getHelpMessage(),mode:r,onkeydown:this._handleTab,onDiscard:this._onDiscard},s(pt,{context:t,fields:[y&&m.orientation?h:void 0,y&&m.distance?o:void 0,m.elevation&&T!=="2d"?l:void 0,m.area?i:void 0],mode:r}))}};Z=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawPolygon")],Z);const _e={base:`${p} ${`${p}--draw-polyline`}`};let K=class extends d{render(){const{fieldContext:t,info:e}=this,{distance:i,elevation:o,mode:l,orientation:r,tooltipOptions:h,totalLength:b,viewType:T}=e,{inputEnabled:y,visibleElements:m}=h;return s(f,{className:_e.base,helpMessage:this._getHelpMessage(),mode:l,onkeydown:this._handleTab,onDiscard:this._onDiscard},s(pt,{context:t,fields:[y&&m.orientation?r:void 0,y&&m.distance?i:void 0,m.elevation&&T!=="2d"?o:void 0,m.totalLength?b:void 0],mode:l}))}};K=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawPolyline")],K);const ge={base:`${p} ${`${p}--draw-rectangle`}`};let G=class extends d{render(){const{area:t,xSize:e,ySize:i,tooltipOptions:o}=this.info,{visibleElements:l}=o,r=this._messagesTooltip.sketch;return s(f,{className:ge.base,helpMessage:this._getHelpMessage()},l.size&&e!=null&&i!=null?s(u,{title:r.size,value:s(x,{left:this._formatLength(e),right:this._formatLength(i)})}):null,l.area?s(u,{title:r.area,value:this._formatArea(t)}):null)}};G=a([v("esri.views.interactive.tooltip.content.TooltipContentDrawRectangle")],G);const $e={base:`${p} ${`${p}--extent-rotate`}`};let j=class extends d{render(){const{angle:t,tooltipOptions:e}=this.info,{visibleElements:i}=e,o=this._messagesTooltip.sketch;return s(f,{className:$e.base,helpMessage:this._getHelpMessage()},i.rotation?s(u,{title:o.rotation,value:this._formatRelativeOrientation(t)}):null)}};j=a([v("esri.views.interactive.tooltip.content.TooltipContentExtentRotate")],j);const ye={base:`${p} ${`${p}--extent-scale`}`};let X=class extends d{render(){const t=this.info,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:ye.base,helpMessage:this._getHelpMessage()},e.size?s(u,{title:i.size,value:s(x,{left:this._formatLength(t.xSize),right:this._formatLength(t.ySize)})}):null,e.scale?s(u,{title:i.scale,value:s(x,{left:this._formatScale(t.xScale),right:this._formatScale(t.yScale)})}):null)}};X=a([v("esri.views.interactive.tooltip.content.TooltipContentExtentScale")],X);const be={base:`${p} ${`${p}--reshape-edge-offset`}`};let B=class extends d{render(){const{area:t,distance:e,totalLength:i,tooltipOptions:o}=this.info,{visibleElements:l}=o,r=this._messagesTooltip.sketch;return s(f,{className:be.base,helpMessage:this._getHelpMessage()},l.distance?s(u,{title:r.distance,value:this._formatRelativeLength(e)}):null,l.area&&t!=null?s(u,{title:r.area,value:this._formatArea(t)}):null,l.totalLength&&i!=null?s(u,{title:r.totalLength,value:this._formatLength(i)}):null)}};B=a([v("esri.views.interactive.tooltip.content.TooltipContentReshapeEdgeOffset")],B);const we={base:`${p} ${`${p}--transform-absolute`}`};let Y=class extends d{render(){const{info:t}=this,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:we.base,helpMessage:this._getHelpMessage()},e.orientation&&t.orientation!=null?s(u,{key:"orientation",title:i.orientation,value:lt(t.orientation,t.rotationType,t.orientationPrecision)}):null,e.size&&t.size!=null?s(u,{key:"size",title:i.size,value:this._formatLength(t.size,t.sizeUnit,t.sizePrecision)}):null)}};Y=a([v("esri.views.interactive.tooltip.content.TooltipContentTransformAbsolute")],Y);const xe={base:`${p} ${`${p}--transform-rotate`}`};let Q=class extends d{render(){const{info:t}=this,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:xe.base,helpMessage:this._getHelpMessage()},e.rotation&&t.rotation!=null?s(u,{key:"rotation",title:i.rotation,value:Qt(t.rotation,t.rotationType,t.rotationPrecision)}):null,e.orientation&&t.orientation!=null?s(u,{key:"orientation",title:i.orientation,value:lt(t.orientation,t.rotationType,t.orientationPrecision)}):null)}};Q=a([v("esri.views.interactive.tooltip.content.TooltipContentTransformRotate")],Q);const ke={base:`${p} ${`${p}--transform-scale`}`};let J=class extends d{render(){const{info:t}=this,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:ke.base,helpMessage:this._getHelpMessage()},e.scale&&t.scale!=null?s(u,{key:"scale",title:i.scale,value:this._formatPercentage(t.scale)}):null,e.size&&t.size!=null?s(u,{key:"size",title:i.size,value:this._formatLength(t.size,t.sizeUnit,t.sizePrecision)}):null)}};J=a([v("esri.views.interactive.tooltip.content.TooltipContentTransformScale")],J);const Te={base:`${p} ${`${p}--translate-graphic`}`};let tt=class extends d{render(){const{info:t}=this,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:Te.base,helpMessage:this._getHelpMessage()},e.distance?s(u,{title:i.distance,value:this._formatLength(t.distance)}):null)}};tt=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateGraphic")],tt);const Me={base:`${p} ${`${p}--translate-graphic-xy`}`};let et=class extends d{render(){const{info:t}=this,{visibleElements:e}=t.tooltipOptions,i=this._messagesTooltip.sketch;return s(f,{className:Me.base,helpMessage:this._getHelpMessage()},e.distance?s(u,{title:i.distance,value:this._formatRelativeLength(t.distance)}):null)}};et=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateGraphicXY")],et);const Le={base:`${p} ${`${p}--translate-graphic-z`}`};let nt=class extends d{render(){const{info:n}=this,{visibleElements:t}=n.tooltipOptions,e=this._messagesTooltip.sketch;return s(f,{className:Le.base,helpMessage:this._getHelpMessage()},t.distance?s(u,{title:e.distance,value:this._formatRelativeVerticalLength(n.distance)}):null)}};nt=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateGraphicZ")],nt);const Ce={base:`${p} ${`${p}--translate-vertex`}`};let it=class extends d{render(){const{distance:t,elevation:e,area:i,totalLength:o,tooltipOptions:l}=this.info,{visibleElements:r}=l,h=this._messagesTooltip.sketch;return s(f,{className:Ce.base,helpMessage:this._getHelpMessage()},r.distance?s(u,{title:h.distance,value:this._formatLength(t)}):null,r.elevation&&e!=null?s(u,{title:h.elevation,value:this._formatVerticalLength(e.actual)}):null,r.area&&i!=null?s(u,{title:h.area,value:this._formatArea(i)}):null,r.totalLength&&o!=null?s(u,{title:h.totalLength,value:this._formatLength(o)}):null)}};it=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateVertex")],it);const Ee={base:`${p} ${`${p}--translate-vertex`}`};let st=class extends d{render(){const{area:n,distance:t,elevation:e,totalLength:i,tooltipOptions:o}=this.info,{visibleElements:l}=o,r=this._messagesTooltip.sketch;return s(f,{className:Ee.base,helpMessage:this._getHelpMessage()},l.distance?s(u,{title:r.distance,value:this._formatRelativeLength(t)}):null,l.elevation&&e!=null?s(u,{title:r.elevation,value:this._formatVerticalLength(e.actual)}):null,l.area&&n!=null?s(u,{title:r.area,value:this._formatArea(n)}):null,l.totalLength&&i!=null?s(u,{title:r.totalLength,value:this._formatLength(i)}):null)}};st=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateVertexXY")],st);const ze={base:`${p} ${`${p}--translate-vertex`}`};let ot=class extends d{render(){const{distance:n,elevation:t,tooltipOptions:e}=this.info,{visibleElements:i}=e,o=this._messagesTooltip.sketch;return s(f,{className:ze.base,helpMessage:this._getHelpMessage()},i.distance?s(u,{title:o.distance,value:this._formatRelativeVerticalLength(n)}):null,i.elevation&&t!=null?s(u,{title:o.elevation,value:this._formatVerticalLength(t.actual)}):null)}};ot=a([v("esri.views.interactive.tooltip.content.TooltipContentTranslateVertexZ")],ot);function Ve(n,t){if(t==null)return null;const e=document.createElement("div");switch(t.type){case"draw-point":return new q({tooltip:n,info:t,container:e});case"draw-polygon":return new Z({tooltip:n,info:t,container:e});case"draw-polyline":return new K({tooltip:n,info:t,container:e});case"draw-mesh":return new W({tooltip:n,info:t,container:e});case"draw-rectangle":return new G({tooltip:n,info:t,container:e});case"draw-circle":return new U({tooltip:n,info:t,container:e});case"extent-rotate":return new j({tooltip:n,info:t,container:e});case"extent-scale":return new X({tooltip:n,info:t,container:e});case"transform-absolute":return new Y({tooltip:n,info:t,container:e});case"transform-rotate":return new Q({tooltip:n,info:t,container:e});case"transform-scale":return new J({tooltip:n,info:t,container:e});case"translate-graphic":return new tt({tooltip:n,info:t,container:e});case"translate-graphic-z":return new nt({tooltip:n,info:t,container:e});case"translate-graphic-xy":return new et({tooltip:n,info:t,container:e});case"translate-vertex":return new it({tooltip:n,info:t,container:e});case"translate-vertex-z":return new ot({tooltip:n,info:t,container:e});case"translate-vertex-xy":return new st({tooltip:n,info:t,container:e});case"reshape-edge-offset":return new B({tooltip:n,info:t,container:e})}}const De={base:`${k}`};let M=class extends Zt{constructor(n){super(n),this.info=null,this.positionMode="follow-cursor",this._contentContainer=(()=>{const t=document.createElement("div");return t.classList.add(De.base),Kt(t),t})(),this._contentWidget=null}initialize(){const n=this._contentContainer;this.addHandles([F(()=>{var t;return(t=this.view.overlay)==null?void 0:t.surface},t=>{n.remove(),t==null||t.appendChild(n)},P),F(()=>this.info,(t,e)=>{if(this._contentWidget!=null&&t!=null&&e!=null&&t.type===e.type)this._contentWidget.info=t;else{this._contentWidget=ft(this._contentWidget);const i=Ve(this,t);i&&(this._contentWidget=i,i.container&&n.appendChild(i.container))}},P),F(()=>({container:this._contentContainer,contentWidget:this._contentWidget,screenPoint:this._screenPoint,positionMode:this.positionMode}),Oe,P)])}destroy(){this._contentWidget=ft(this._contentWidget),this._contentContainer.remove()}clear(){this.info=null}get _screenPoint(){const n=this.view.inputManager;return n!=null&&n.multiTouchActive?null:n==null?void 0:n.latestPointerLocation}get test(){var n;return{contentContainer:this._contentContainer,visible:((n=this._contentContainer)==null?void 0:n.style.display)!=="none"}}};function Oe({container:n,contentWidget:t,screenPoint:e,positionMode:i}){const{style:o}=n;if(i==="docked")return o.display="block",void(o.transform="none");if(i!=="fixed")if(e!=null&&t!=null){o.display="block";const l=Gt(n),r=`translate(${Math.round(e.x)+$t[0]*(l?-1:1)}px, ${Math.round(e.y)+$t[1]}px)`;o.transform=l?`translate(-100%, 0) ${r}`:r}else o.display="none"}a([c({nonNullable:!0})],M.prototype,"view",void 0),a([c()],M.prototype,"info",void 0),a([c()],M.prototype,"positionMode",void 0),a([c()],M.prototype,"_contentContainer",void 0),a([c()],M.prototype,"_contentWidget",void 0),a([c()],M.prototype,"_screenPoint",null),M=a([v("esri.views.interactive.tooltip.Tooltip")],M);const $t=[20,20];export{Pe as a,ct as b,He as c,Se as d,Ue as g,Ae as l,We as m,Fe as p,kt as r,w as s,M as u}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/calcite-button-tOn16zeN.js","assets/button-dkwNndhL.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/form-2Iq0hI3D.js","assets/interactive-NKzPUNL4.js","assets/label2-d2vWQ7x7.js","assets/loadable-sxY2K1G3.js","assets/locale-pfkq1d6A.js","assets/key-qdHumIlA.js","assets/observers-JyBmMU24.js","assets/component-dtiBfYiX.js","assets/t9n-od6MEnI1.js","assets/icon-ZwpY5ksA.js","assets/loader-QqciGs1c.js","assets/guid-6vN-YNJI.js","assets/calcite-icon-itD416se.js","assets/calcite-input-V4_hyPVg.js","assets/input-9jE7tcJD.js","assets/progress-puB9lhY4.js"] + __vite__mapDeps.viteFileDeps = ["assets/calcite-button-rIOy-85Y.js","assets/button-4hsayCiP.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/form-1U5Kiwxm.js","assets/interactive-9W9APeiw.js","assets/label2-JXqLMBYY.js","assets/loadable-uNbe2Ndt.js","assets/locale-tKMV0J87.js","assets/key-qdHumIlA.js","assets/observers-eNe735aq.js","assets/component-dtiBfYiX.js","assets/t9n-KLe7iM0R.js","assets/icon-BW6RCrUr.js","assets/loader-plQ4Tft5.js","assets/guid-6vN-YNJI.js","assets/calcite-icon-ZhRmLRGh.js","assets/calcite-input-1VO9g4ut.js","assets/input-_z9XIoLu.js","assets/progress-TBzcAK5D.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/TopFeaturesQuery-E6D2tV-x.js b/dist/assets/TopFeaturesQuery-E6D2tV-x.js deleted file mode 100644 index c2f9cfe..0000000 --- a/dist/assets/TopFeaturesQuery-E6D2tV-x.js +++ /dev/null @@ -1 +0,0 @@ -import{e as t,y as i,c as u,dr as y,dp as h,dx as c,dy as v,ar as m,du as p,ev as w,iy as S,bI as R}from"./index-J0iiHjMT.js";var s;let o=s=class extends y{constructor(r){super(r),this.groupByFields=void 0,this.topCount=void 0,this.orderByFields=void 0}clone(){return new s({groupByFields:this.groupByFields,topCount:this.topCount,orderByFields:this.orderByFields})}};t([i({type:[String],json:{write:!0}})],o.prototype,"groupByFields",void 0),t([i({type:Number,json:{write:!0}})],o.prototype,"topCount",void 0),t([i({type:[String],json:{write:!0}})],o.prototype,"orderByFields",void 0),o=s=t([u("esri.rest.support.TopFilter")],o);const j=o;var n;const a=new h({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),d=new h({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let e=n=class extends y{constructor(r){super(r),this.cacheHint=void 0,this.distance=void 0,this.geometry=null,this.geometryPrecision=void 0,this.maxAllowableOffset=void 0,this.num=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.resultType=null,this.returnGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.start=void 0,this.spatialRelationship="intersects",this.timeExtent=null,this.topFilter=void 0,this.units=null,this.where="1=1"}writeStart(r,l){l.resultOffset=this.start,l.resultRecordCount=this.num||10}clone(){return new n(R({cacheHint:this.cacheHint,distance:this.distance,geometry:this.geometry,geometryPrecision:this.geometryPrecision,maxAllowableOffset:this.maxAllowableOffset,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,resultType:this.resultType,returnGeometry:this.returnGeometry,returnZ:this.returnZ,returnM:this.returnM,start:this.start,spatialRelationship:this.spatialRelationship,timeExtent:this.timeExtent,topFilter:this.topFilter,units:this.units,where:this.where}))}};t([i({type:Boolean,json:{write:!0}})],e.prototype,"cacheHint",void 0),t([i({type:Number,json:{write:{overridePolicy:r=>({enabled:r>0})}}})],e.prototype,"distance",void 0),t([i({types:c,json:{read:v,write:!0}})],e.prototype,"geometry",void 0),t([i({type:Number,json:{write:!0}})],e.prototype,"geometryPrecision",void 0),t([i({type:Number,json:{write:!0}})],e.prototype,"maxAllowableOffset",void 0),t([i({type:Number,json:{read:{source:"resultRecordCount"}}})],e.prototype,"num",void 0),t([i({json:{write:!0}})],e.prototype,"objectIds",void 0),t([i({type:[String],json:{write:!0}})],e.prototype,"orderByFields",void 0),t([i({type:[String],json:{write:!0}})],e.prototype,"outFields",void 0),t([i({type:m,json:{read:{source:"outSR"},write:{target:"outSR"}}})],e.prototype,"outSpatialReference",void 0),t([i({type:String,json:{write:!0}})],e.prototype,"resultType",void 0),t([i({json:{write:!0}})],e.prototype,"returnGeometry",void 0),t([i({type:Boolean,json:{write:{overridePolicy:r=>({enabled:r})}}})],e.prototype,"returnM",void 0),t([i({type:Boolean,json:{write:{overridePolicy:r=>({enabled:r})}}})],e.prototype,"returnZ",void 0),t([i({type:Number,json:{read:{source:"resultOffset"}}})],e.prototype,"start",void 0),t([p("start"),p("num")],e.prototype,"writeStart",null),t([i({type:String,json:{read:{source:"spatialRel",reader:a.read},write:{target:"spatialRel",writer:a.write}}})],e.prototype,"spatialRelationship",void 0),t([i({type:w,json:{write:!0}})],e.prototype,"timeExtent",void 0),t([i({type:j,json:{write:!0}})],e.prototype,"topFilter",void 0),t([i({type:String,json:{read:d.read,write:{writer:d.write,overridePolicy(r){return{enabled:r!=null&&this.distance!=null&&this.distance>0}}}}})],e.prototype,"units",void 0),t([i({type:String,json:{write:!0}})],e.prototype,"where",void 0),e=n=t([u("esri.rest.support.TopFeaturesQuery")],e),e.from=S(e);const g=e;export{g as S}; diff --git a/dist/assets/TranslateTooltipInfos-J6BygtUO.js b/dist/assets/TranslateTooltipInfos-DywsDtXz.js similarity index 94% rename from dist/assets/TranslateTooltipInfos-J6BygtUO.js rename to dist/assets/TranslateTooltipInfos-DywsDtXz.js index 29ff4d5..cf367c3 100644 --- a/dist/assets/TranslateTooltipInfos-J6BygtUO.js +++ b/dist/assets/TranslateTooltipInfos-DywsDtXz.js @@ -1 +1 @@ -import{e as t,I as o,y as e,c as r}from"./index-J0iiHjMT.js";import{s as l}from"./Tooltip-ON77BKb3.js";let p=class extends l{constructor(i){super(i),this.type="translate-graphic",this.distance=o}clear(){this.distance=o}};t([e()],p.prototype,"type",void 0),t([e()],p.prototype,"distance",void 0),p=t([r("esri.views.interactive.tooltip.TranslateGraphicTooltipInfo")],p);let c=class extends l{constructor(i){super(i),this.type="translate-graphic-z",this.distance=o}clear(){this.distance=o}};t([e()],c.prototype,"type",void 0),t([e()],c.prototype,"distance",void 0),c=t([r("esri.views.interactive.tooltip.TranslateGraphicZTooltipInfo")],c);let h=class extends l{constructor(i){super(i),this.type="translate-graphic-xy",this.distance=o}};t([e()],h.prototype,"type",void 0),t([e()],h.prototype,"distance",void 0),h=t([r("esri.views.interactive.tooltip.TranslateGraphicXYTooltipInfo")],h);let s=class extends l{constructor(i){super(i),this.type="translate-vertex",this.distance=o,this.elevation=null,this.area=null,this.totalLength=null}clear(){this.distance=o,this.elevation=null,this.area=null,this.totalLength=null}};t([e()],s.prototype,"type",void 0),t([e()],s.prototype,"distance",void 0),t([e()],s.prototype,"elevation",void 0),t([e()],s.prototype,"area",void 0),t([e()],s.prototype,"totalLength",void 0),s=t([r("esri.views.interactive.tooltip.TranslateVertexTooltipInfo")],s);let n=class extends l{constructor(i){super(i),this.type="translate-vertex-z",this.distance=o,this.elevation=null}clear(){this.distance=o,this.elevation=null}};t([e()],n.prototype,"type",void 0),t([e()],n.prototype,"distance",void 0),t([e()],n.prototype,"elevation",void 0),n=t([r("esri.views.interactive.tooltip.TranslateVertexZTooltipInfo")],n);let a=class extends l{constructor(i){super(i),this.type="translate-vertex-xy",this.distance=o,this.elevation=null,this.area=null,this.totalLength=null}clear(){this.distance=o,this.elevation=null,this.area=null,this.totalLength=null}};t([e()],a.prototype,"type",void 0),t([e()],a.prototype,"distance",void 0),t([e()],a.prototype,"elevation",void 0),t([e()],a.prototype,"area",void 0),t([e()],a.prototype,"totalLength",void 0),a=t([r("esri.views.interactive.tooltip.TranslateVertexXYTooltipInfo")],a);export{c as a,a as c,h as l,n,s as p,p as r}; +import{e as t,w as o,y as e,c as r}from"./index-pCX-0tJH.js";import{s as l}from"./Tooltip-a9KqLK1p.js";let p=class extends l{constructor(i){super(i),this.type="translate-graphic",this.distance=o}clear(){this.distance=o}};t([e()],p.prototype,"type",void 0),t([e()],p.prototype,"distance",void 0),p=t([r("esri.views.interactive.tooltip.TranslateGraphicTooltipInfo")],p);let c=class extends l{constructor(i){super(i),this.type="translate-graphic-z",this.distance=o}clear(){this.distance=o}};t([e()],c.prototype,"type",void 0),t([e()],c.prototype,"distance",void 0),c=t([r("esri.views.interactive.tooltip.TranslateGraphicZTooltipInfo")],c);let h=class extends l{constructor(i){super(i),this.type="translate-graphic-xy",this.distance=o}};t([e()],h.prototype,"type",void 0),t([e()],h.prototype,"distance",void 0),h=t([r("esri.views.interactive.tooltip.TranslateGraphicXYTooltipInfo")],h);let s=class extends l{constructor(i){super(i),this.type="translate-vertex",this.distance=o,this.elevation=null,this.area=null,this.totalLength=null}clear(){this.distance=o,this.elevation=null,this.area=null,this.totalLength=null}};t([e()],s.prototype,"type",void 0),t([e()],s.prototype,"distance",void 0),t([e()],s.prototype,"elevation",void 0),t([e()],s.prototype,"area",void 0),t([e()],s.prototype,"totalLength",void 0),s=t([r("esri.views.interactive.tooltip.TranslateVertexTooltipInfo")],s);let n=class extends l{constructor(i){super(i),this.type="translate-vertex-z",this.distance=o,this.elevation=null}clear(){this.distance=o,this.elevation=null}};t([e()],n.prototype,"type",void 0),t([e()],n.prototype,"distance",void 0),t([e()],n.prototype,"elevation",void 0),n=t([r("esri.views.interactive.tooltip.TranslateVertexZTooltipInfo")],n);let a=class extends l{constructor(i){super(i),this.type="translate-vertex-xy",this.distance=o,this.elevation=null,this.area=null,this.totalLength=null}clear(){this.distance=o,this.elevation=null,this.area=null,this.totalLength=null}};t([e()],a.prototype,"type",void 0),t([e()],a.prototype,"distance",void 0),t([e()],a.prototype,"elevation",void 0),t([e()],a.prototype,"area",void 0),t([e()],a.prototype,"totalLength",void 0),a=t([r("esri.views.interactive.tooltip.TranslateVertexXYTooltipInfo")],a);export{c as a,a as c,h as l,n,s as p,p as r}; diff --git a/dist/assets/TurboLine-SWK4qRwh.js b/dist/assets/TurboLine-SWK4qRwh.js deleted file mode 100644 index 476ba2a..0000000 --- a/dist/assets/TurboLine-SWK4qRwh.js +++ /dev/null @@ -1,7 +0,0 @@ -import{dJ as bt,de as wt,kj as kt,kk as $,kl as D}from"./index-J0iiHjMT.js";import{$ as Rt}from"./definitions-DqQMJYPH.js";const pt=128e3;let ut=null,mt=null;async function At(){return ut||(ut=Mt()),ut}async function Mt(){mt=await(bt("esri-csp-restrictions")?await wt(()=>import("./libtess-asm-MMunuWgb.js"),__vite__mapDeps([0,1,2])).then(i=>i.l):await wt(()=>import("./libtess-R_Me7Q5k.js"),__vite__mapDeps([3,1,2])).then(i=>i.l)).load({locateFile:i=>kt(`esri/core/libs/libtess/${i}`)})}function Ot(r,i){const x=Math.max(r.length,pt);return mt.triangulate(r,i,x)}function Vt(r,i){return r.x===i.x&&r.y===i.y}function Ut(r){if(!r)return;const i=r.length;if(i<=1)return;let x=0;for(let g=1;gg){I=!0;const t=(g-N)/w;w=g-N,W=(1-t)*C+t*W,X=(1-t)*F+t*X,--j}const o=this._writeVertex(C,F,0,0,b,v,v,-b,0,-1,N),y=this._writeVertex(C,F,0,0,b,v,-v,b,0,1,N);N+=w;const J=this._writeVertex(W,X,0,0,b,v,v,-b,0,-1,N),e=this._writeVertex(W,X,0,0,b,v,-v,b,0,1,N);this._writeTriangle(o,y,J),this._writeTriangle(y,J,e),C=W,F=X}}_tessellate(i,x){const g=i[0],N=i[i.length-1],I=Vt(g,N),C=I?3:2;if(i.length{const O=Et(o,y,_,c,G,m,R,st,L,A,h);return d>=0&&l>=0&&O>=0&&Nt(d,l,O),d=l,l=O,O};I&&(w=i[i.length-2],t.x=N.x-w.x,t.y=N.y-w.y,Q=ft(t),t.x/=Q,t.y/=Q);let Y=!1;for(let R=0;R_t&&(Y=!0)),Y){const n=(_t-h)/K;K=_t-h,w={x:(1-n)*w.x+n*i[R].x,y:(1-n)*w.y+n*i[R].y},--R}else w=i[R];o=w.x,y=w.y;const st=R<=0&&!Y,G=R===i.length-1;if(st||(h+=K),J=G?I?i[1]:null:i[R+1],J?(t.x=J.x-o,t.y=J.y-y,Q=ft(t),t.x/=Q,t.y/=Q):(t.x=void 0,t.y=void 0),!I){if(st){k(s,t),_=s.x,c=s.y,B===$.SQUARE&&(u(-t.y-t.x,t.x-t.y,t.x,t.y,0,-1),u(t.y-t.x,-t.x-t.y,t.x,t.y,0,1)),B===$.ROUND&&(u(-t.y-t.x,t.x-t.y,t.x,t.y,-1,-1),u(t.y-t.x,-t.x-t.y,t.x,t.y,-1,1)),B!==$.ROUND&&B!==$.BUTT||(u(-t.y,t.x,t.x,t.y,0,-1),u(t.y,-t.x,t.x,t.y,0,1));continue}if(G){U(s,e),_=s.x,c=s.y,B!==$.ROUND&&B!==$.BUTT||(u(e.y,-e.x,-e.x,-e.y,0,-1),u(-e.y,e.x,-e.x,-e.y,0,1)),B===$.SQUARE&&(u(e.y-e.x,-e.x-e.y,-e.x,-e.y,0,-1),u(-e.y-e.x,e.x-e.y,-e.x,-e.y,0,1)),B===$.ROUND&&(u(e.y-e.x,-e.x-e.y,-e.x,-e.y,1,-1),u(-e.y-e.x,e.x-e.y,-e.x,-e.y,1,1));continue}}let m,L,A=-Bt(e,t);if(Math.abs(A)<.01)gt(e,t)>0?(s.x=e.x,s.y=e.y,A=1,m=Number.MAX_VALUE,L=!0):(k(s,t),A=1,m=1,L=!1);else{s.x=(e.x+t.x)/A,s.y=(e.y+t.y)/A,m=ft(s);const n=(m-1)*b*F;L=m>4||n>K&&n>Q}_=s.x,c=s.y;let O=j;switch(j){case D.BEVEL:m<1.05&&(O=D.MITER);break;case D.ROUND:mW&&(O=D.BEVEL)}switch(O){case D.MITER:if(u(s.x,s.y,-e.x,-e.y,0,-1),u(-s.x,-s.y,-e.x,-e.y,0,1),G)break;if(v){const n=Y?0:h;d=this._writeVertex(o,y,_,c,t.x,t.y,s.x,s.y,0,-1,n),l=this._writeVertex(o,y,_,c,t.x,t.y,-s.x,-s.y,0,1,n)}break;case D.BEVEL:{const n=A<0;let T,V,q,p;if(n){const a=d;d=l,l=a,T=xt,V=nt}else T=nt,V=xt;if(L)q=n?k(this._innerPrev,e):U(this._innerPrev,e),p=n?U(this._innerNext,t):k(this._innerNext,t);else{const a=n?vt(this._inner,s):Tt(this._inner,s);q=a,p=a}const M=n?U(this._bevelStart,e):k(this._bevelStart,e);u(q.x,q.y,-e.x,-e.y,T.x,T.y);const yt=u(M.x,M.y,-e.x,-e.y,V.x,V.y);if(G)break;const P=n?k(this._bevelEnd,t):U(this._bevelEnd,t);if(L){const a=this._writeVertex(o,y,_,c,-e.x,-e.y,0,0,0,0,h);d=this._writeVertex(o,y,_,c,t.x,t.y,p.x,p.y,T.x,T.y,h),l=this._writeVertex(o,y,_,c,t.x,t.y,P.x,P.y,V.x,V.y,h),this._writeTriangle(yt,a,l)}else{if(v){const a=this._bevelMiddle;a.x=(M.x+P.x)/2,a.y=(M.y+P.y)/2,et(f,a,-e.x,-e.y),u(a.x,a.y,-e.x,-e.y,f.x,f.y),et(f,a,t.x,t.y),d=this._writeVertex(o,y,_,c,t.x,t.y,a.x,a.y,f.x,f.y,h),l=this._writeVertex(o,y,_,c,t.x,t.y,p.x,p.y,T.x,T.y,h)}else{const a=d;d=l,l=a}u(P.x,P.y,t.x,t.y,V.x,V.y)}if(n){const a=d;d=l,l=a}break}case D.ROUND:{const n=A<0;let T,V;if(n){const E=d;d=l,l=E,T=xt,V=nt}else T=nt,V=xt;const q=n?vt(this._inner,s):Tt(this._inner,s);let p,M;L?(p=n?k(this._innerPrev,e):U(this._innerPrev,e),M=n?U(this._innerNext,t):k(this._innerNext,t)):(p=q,M=q);const yt=n?U(this._roundStart,e):k(this._roundStart,e),P=n?k(this._roundEnd,t):U(this._roundEnd,t),a=u(p.x,p.y,-e.x,-e.y,T.x,T.y),ot=u(yt.x,yt.y,-e.x,-e.y,V.x,V.y);if(G)break;const z=this._writeVertex(o,y,_,c,-e.x,-e.y,0,0,0,0,h);L||this._writeTriangle(d,l,z);const S=vt(this._outer,q),H=this._writeVertex(o,y,_,c,t.x,t.y,P.x,P.y,V.x,V.y,h);let Z,tt;const lt=m>2;if(lt){let E;m!==Number.MAX_VALUE?(S.x/=m,S.y/=m,E=gt(e,S),E=(m*(E*E-1)+1)/E):E=-1,Z=n?U(this._startBreak,e):k(this._startBreak,e),Z.x+=e.x*E,Z.y+=e.y*E,tt=n?k(this._endBreak,t):U(this._endBreak,t),tt.x+=t.x*E,tt.y+=t.y*E}et(f,S,-e.x,-e.y);const ht=this._writeVertex(o,y,_,c,-e.x,-e.y,S.x,S.y,f.x,f.y,h);et(f,S,t.x,t.y);const ct=v?this._writeVertex(o,y,_,c,t.x,t.y,S.x,S.y,f.x,f.y,h):ht,dt=z,at=v?this._writeVertex(o,y,_,c,t.x,t.y,0,0,0,0,h):z;let it=-1,rt=-1;if(lt&&(et(f,Z,-e.x,-e.y),it=this._writeVertex(o,y,_,c,-e.x,-e.y,Z.x,Z.y,f.x,f.y,h),et(f,tt,t.x,t.y),rt=this._writeVertex(o,y,_,c,t.x,t.y,tt.x,tt.y,f.x,f.y,h)),v?lt?(this._writeTriangle(dt,ot,it),this._writeTriangle(dt,it,ht),this._writeTriangle(at,ct,rt),this._writeTriangle(at,rt,H)):(this._writeTriangle(dt,ot,ht),this._writeTriangle(at,ct,H)):lt?(this._writeTriangle(z,ot,it),this._writeTriangle(z,it,rt),this._writeTriangle(z,rt,H)):(this._writeTriangle(z,ot,ht),this._writeTriangle(z,ct,H)),L?(d=this._writeVertex(o,y,_,c,t.x,t.y,M.x,M.y,T.x,T.y,h),l=H):(d=v?this._writeVertex(o,y,_,c,t.x,t.y,M.x,M.y,T.x,T.y,h):a,this._writeTriangle(d,at,H),l=H),n){const E=d;d=l,l=E}break}}}}}export{Pt as c,At as i,Ot as r}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/libtess-asm-MMunuWgb.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/libtess-R_Me7Q5k.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/TurboLine-cWldrV9L.js b/dist/assets/TurboLine-cWldrV9L.js new file mode 100644 index 0000000..ceb851d --- /dev/null +++ b/dist/assets/TurboLine-cWldrV9L.js @@ -0,0 +1,7 @@ +import{dE as bt,de as wt,kr as Rt,ks as $,kt as D}from"./index-pCX-0tJH.js";import{$ as kt}from"./definitions-SVBNHUSH.js";const pt=128e3;let ut=null,mt=null;async function At(){return ut||(ut=Mt()),ut}async function Mt(){mt=await(bt("esri-csp-restrictions")?await wt(()=>import("./libtess-asm-k59Sl_HW.js"),__vite__mapDeps([0,1,2])).then(i=>i.l):await wt(()=>import("./libtess-TicJCr20.js"),__vite__mapDeps([3,1,2])).then(i=>i.l)).load({locateFile:i=>Rt(`esri/core/libs/libtess/${i}`)})}function Ot(r,i){const x=Math.max(r.length,pt);return mt.triangulate(r,i,x)}function Vt(r,i){return r.x===i.x&&r.y===i.y}function Ut(r){if(!r)return;const i=r.length;if(i<=1)return;let x=0;for(let g=1;gg){I=!0;const t=(g-N)/w;w=g-N,W=(1-t)*C+t*W,X=(1-t)*F+t*X,--j}const o=this._writeVertex(C,F,0,0,b,v,v,-b,0,-1,N),y=this._writeVertex(C,F,0,0,b,v,-v,b,0,1,N);N+=w;const G=this._writeVertex(W,X,0,0,b,v,v,-b,0,-1,N),e=this._writeVertex(W,X,0,0,b,v,-v,b,0,1,N);this._writeTriangle(o,y,G),this._writeTriangle(y,G,e),C=W,F=X}}_tessellate(i,x){const g=i[0],N=i[i.length-1],I=Vt(g,N),C=I?3:2;if(i.length{const O=Et(o,y,_,c,H,m,k,st,L,A,l);return d>=0&&h>=0&&O>=0&&Nt(d,h,O),d=h,h=O,O};I&&(w=i[i.length-2],t.x=N.x-w.x,t.y=N.y-w.y,Q=ft(t),t.x/=Q,t.y/=Q);let Y=!1;for(let k=0;k_t&&(Y=!0)),Y){const n=(_t-l)/K;K=_t-l,w={x:(1-n)*w.x+n*i[k].x,y:(1-n)*w.y+n*i[k].y},--k}else w=i[k];o=w.x,y=w.y;const st=k<=0&&!Y,H=k===i.length-1;if(st||(l+=K),G=H?I?i[1]:null:i[k+1],G?(t.x=G.x-o,t.y=G.y-y,Q=ft(t),t.x/=Q,t.y/=Q):(t.x=void 0,t.y=void 0),!I){if(st){R(s,t),_=s.x,c=s.y,B===$.SQUARE&&(u(-t.y-t.x,t.x-t.y,t.x,t.y,0,-1),u(t.y-t.x,-t.x-t.y,t.x,t.y,0,1)),B===$.ROUND&&(u(-t.y-t.x,t.x-t.y,t.x,t.y,-1,-1),u(t.y-t.x,-t.x-t.y,t.x,t.y,-1,1)),B!==$.ROUND&&B!==$.BUTT||(u(-t.y,t.x,t.x,t.y,0,-1),u(t.y,-t.x,t.x,t.y,0,1));continue}if(H){U(s,e),_=s.x,c=s.y,B!==$.ROUND&&B!==$.BUTT||(u(e.y,-e.x,-e.x,-e.y,0,-1),u(-e.y,e.x,-e.x,-e.y,0,1)),B===$.SQUARE&&(u(e.y-e.x,-e.x-e.y,-e.x,-e.y,0,-1),u(-e.y-e.x,e.x-e.y,-e.x,-e.y,0,1)),B===$.ROUND&&(u(e.y-e.x,-e.x-e.y,-e.x,-e.y,1,-1),u(-e.y-e.x,e.x-e.y,-e.x,-e.y,1,1));continue}}let m,L,A=-Bt(e,t);if(Math.abs(A)<.01)gt(e,t)>0?(s.x=e.x,s.y=e.y,A=1,m=Number.MAX_VALUE,L=!0):(R(s,t),A=1,m=1,L=!1);else{s.x=(e.x+t.x)/A,s.y=(e.y+t.y)/A,m=ft(s);const n=(m-1)*b*F;L=m>4||n>K&&n>Q}_=s.x,c=s.y;let O=j;switch(j){case D.BEVEL:m<1.05&&(O=D.MITER);break;case D.ROUND:mW&&(O=D.BEVEL)}switch(O){case D.MITER:if(u(s.x,s.y,-e.x,-e.y,0,-1),u(-s.x,-s.y,-e.x,-e.y,0,1),H)break;if(v){const n=Y?0:l;d=this._writeVertex(o,y,_,c,t.x,t.y,s.x,s.y,0,-1,n),h=this._writeVertex(o,y,_,c,t.x,t.y,-s.x,-s.y,0,1,n)}break;case D.BEVEL:{const n=A<0;let T,V,q,p;if(n){const a=d;d=h,h=a,T=xt,V=nt}else T=nt,V=xt;if(L)q=n?R(this._innerPrev,e):U(this._innerPrev,e),p=n?U(this._innerNext,t):R(this._innerNext,t);else{const a=n?vt(this._inner,s):Tt(this._inner,s);q=a,p=a}const M=n?U(this._bevelStart,e):R(this._bevelStart,e);u(q.x,q.y,-e.x,-e.y,T.x,T.y);const yt=u(M.x,M.y,-e.x,-e.y,V.x,V.y);if(H)break;const P=n?R(this._bevelEnd,t):U(this._bevelEnd,t);if(L){const a=this._writeVertex(o,y,_,c,-e.x,-e.y,0,0,0,0,l);d=this._writeVertex(o,y,_,c,t.x,t.y,p.x,p.y,T.x,T.y,l),h=this._writeVertex(o,y,_,c,t.x,t.y,P.x,P.y,V.x,V.y,l),this._writeTriangle(yt,a,h)}else{if(v){const a=this._bevelMiddle;a.x=(M.x+P.x)/2,a.y=(M.y+P.y)/2,et(f,a,-e.x,-e.y),u(a.x,a.y,-e.x,-e.y,f.x,f.y),et(f,a,t.x,t.y),d=this._writeVertex(o,y,_,c,t.x,t.y,a.x,a.y,f.x,f.y,l),h=this._writeVertex(o,y,_,c,t.x,t.y,p.x,p.y,T.x,T.y,l)}else{const a=d;d=h,h=a}u(P.x,P.y,t.x,t.y,V.x,V.y)}if(n){const a=d;d=h,h=a}break}case D.ROUND:{const n=A<0;let T,V;if(n){const E=d;d=h,h=E,T=xt,V=nt}else T=nt,V=xt;const q=n?vt(this._inner,s):Tt(this._inner,s);let p,M;L?(p=n?R(this._innerPrev,e):U(this._innerPrev,e),M=n?U(this._innerNext,t):R(this._innerNext,t)):(p=q,M=q);const yt=n?U(this._roundStart,e):R(this._roundStart,e),P=n?R(this._roundEnd,t):U(this._roundEnd,t),a=u(p.x,p.y,-e.x,-e.y,T.x,T.y),ot=u(yt.x,yt.y,-e.x,-e.y,V.x,V.y);if(H)break;const z=this._writeVertex(o,y,_,c,-e.x,-e.y,0,0,0,0,l);L||this._writeTriangle(d,h,z);const S=vt(this._outer,q),J=this._writeVertex(o,y,_,c,t.x,t.y,P.x,P.y,V.x,V.y,l);let Z,tt;const ht=m>2;if(ht){let E;m!==Number.MAX_VALUE?(S.x/=m,S.y/=m,E=gt(e,S),E=(m*(E*E-1)+1)/E):E=-1,Z=n?U(this._startBreak,e):R(this._startBreak,e),Z.x+=e.x*E,Z.y+=e.y*E,tt=n?R(this._endBreak,t):U(this._endBreak,t),tt.x+=t.x*E,tt.y+=t.y*E}et(f,S,-e.x,-e.y);const lt=this._writeVertex(o,y,_,c,-e.x,-e.y,S.x,S.y,f.x,f.y,l);et(f,S,t.x,t.y);const ct=v?this._writeVertex(o,y,_,c,t.x,t.y,S.x,S.y,f.x,f.y,l):lt,dt=z,at=v?this._writeVertex(o,y,_,c,t.x,t.y,0,0,0,0,l):z;let it=-1,rt=-1;if(ht&&(et(f,Z,-e.x,-e.y),it=this._writeVertex(o,y,_,c,-e.x,-e.y,Z.x,Z.y,f.x,f.y,l),et(f,tt,t.x,t.y),rt=this._writeVertex(o,y,_,c,t.x,t.y,tt.x,tt.y,f.x,f.y,l)),v?ht?(this._writeTriangle(dt,ot,it),this._writeTriangle(dt,it,lt),this._writeTriangle(at,ct,rt),this._writeTriangle(at,rt,J)):(this._writeTriangle(dt,ot,lt),this._writeTriangle(at,ct,J)):ht?(this._writeTriangle(z,ot,it),this._writeTriangle(z,it,rt),this._writeTriangle(z,rt,J)):(this._writeTriangle(z,ot,lt),this._writeTriangle(z,ct,J)),L?(d=this._writeVertex(o,y,_,c,t.x,t.y,M.x,M.y,T.x,T.y,l),h=J):(d=v?this._writeVertex(o,y,_,c,t.x,t.y,M.x,M.y,T.x,T.y,l):a,this._writeTriangle(d,at,J),h=J),n){const E=d;d=h,h=E}break}}}}}export{Pt as c,At as i,Ot as r}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/libtess-asm-k59Sl_HW.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/libtess-TicJCr20.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/UnitNormalizer-19C91v_m.js b/dist/assets/UnitNormalizer-19C91v_m.js deleted file mode 100644 index 452049f..0000000 --- a/dist/assets/UnitNormalizer-19C91v_m.js +++ /dev/null @@ -1 +0,0 @@ -import{as as l,at as o,au as h,a0 as _,hJ as p,j_ as i,e2 as s}from"./index-J0iiHjMT.js";function R(t,e){if(l(e,0,0,0),t.length>0){for(let r=0;r0){for(let r=0;r{l(()=>{const n=this.resourceInfo&&(this.resourceInfo.layerType||this.resourceInfo.type);let a="Unknown layer type";n&&(a+=" "+n),o(new d("layer:unknown-layer-type",a,{layerType:n}))})}))}read(r,o){super.read({resourceInfo:r},o)}write(r,o){return null}};s([t({readOnly:!0})],e.prototype,"resourceInfo",void 0),s([t({type:["show","hide"]})],e.prototype,"listMode",void 0),s([t({json:{read:!1},readOnly:!0,value:"unknown"})],e.prototype,"type",void 0),e=s([p("esri.layers.UnknownLayer")],e);const f=e;export{f as default}; +import{dI as i,dK as y,f2 as l,e as s,y as t,c as p,aI as u,r as d}from"./index-pCX-0tJH.js";let e=class extends i(y(u)){constructor(r){super(r),this.resourceInfo=null,this.type="unknown"}initialize(){this.addResolvingPromise(new Promise((r,o)=>{l(()=>{const n=this.resourceInfo&&(this.resourceInfo.layerType||this.resourceInfo.type);let a="Unknown layer type";n&&(a+=" "+n),o(new d("layer:unknown-layer-type",a,{layerType:n}))})}))}read(r,o){super.read({resourceInfo:r},o)}write(r,o){return null}};s([t({readOnly:!0})],e.prototype,"resourceInfo",void 0),s([t({type:["show","hide"]})],e.prototype,"listMode",void 0),s([t({json:{read:!1},readOnly:!0,value:"unknown"})],e.prototype,"type",void 0),e=s([p("esri.layers.UnknownLayer")],e);const f=e;export{f as default}; diff --git a/dist/assets/UnsupportedLayer--BUwN-ET.js b/dist/assets/UnsupportedLayer--BUwN-ET.js new file mode 100644 index 0000000..3003a48 --- /dev/null +++ b/dist/assets/UnsupportedLayer--BUwN-ET.js @@ -0,0 +1 @@ +import{dI as p,dK as a,f2 as d,e as t,y as i,c as l,aI as u,r as y}from"./index-pCX-0tJH.js";let s=class extends p(a(u)){constructor(e){super(e),this.resourceInfo=null,this.persistenceEnabled=!0,this.type="unsupported"}initialize(){this.addResolvingPromise(new Promise((e,o)=>{d(()=>{const r=this.resourceInfo&&(this.resourceInfo.layerType||this.resourceInfo.type);let n="Unsupported layer type";r&&(n+=" "+r),o(new y("layer:unsupported-layer-type",n,{layerType:r}))})}))}read(e,o){const r={resourceInfo:e};e.id!=null&&(r.id=e.id),e.title!=null&&(r.title=e.title),super.read(r,o)}write(e,o){return Object.assign(e||{},this.resourceInfo,{id:this.id})}};t([i({readOnly:!0})],s.prototype,"resourceInfo",void 0),t([i({type:["show","hide"]})],s.prototype,"listMode",void 0),t([i({type:Boolean,readOnly:!1})],s.prototype,"persistenceEnabled",void 0),t([i({json:{read:!1},readOnly:!0,value:"unsupported"})],s.prototype,"type",void 0),s=t([l("esri.layers.UnsupportedLayer")],s);const h=s;export{h as default}; diff --git a/dist/assets/UnsupportedLayer-s0OShVnj.js b/dist/assets/UnsupportedLayer-s0OShVnj.js deleted file mode 100644 index 846ce96..0000000 --- a/dist/assets/UnsupportedLayer-s0OShVnj.js +++ /dev/null @@ -1 +0,0 @@ -import{dN as p,dP as a,f7 as d,e as r,y as i,c as l,c7 as u,E as y}from"./index-J0iiHjMT.js";let t=class extends p(a(u)){constructor(e){super(e),this.resourceInfo=null,this.persistenceEnabled=!0,this.type="unsupported"}initialize(){this.addResolvingPromise(new Promise((e,o)=>{d(()=>{const s=this.resourceInfo&&(this.resourceInfo.layerType||this.resourceInfo.type);let n="Unsupported layer type";s&&(n+=" "+s),o(new y("layer:unsupported-layer-type",n,{layerType:s}))})}))}read(e,o){const s={resourceInfo:e};e.id!=null&&(s.id=e.id),e.title!=null&&(s.title=e.title),super.read(s,o)}write(e,o){return Object.assign(e||{},this.resourceInfo,{id:this.id})}};r([i({readOnly:!0})],t.prototype,"resourceInfo",void 0),r([i({type:["show","hide"]})],t.prototype,"listMode",void 0),r([i({type:Boolean,readOnly:!1})],t.prototype,"persistenceEnabled",void 0),r([i({json:{read:!1},readOnly:!0,value:"unsupported"})],t.prototype,"type",void 0),t=r([l("esri.layers.UnsupportedLayer")],t);const h=t;export{h as default}; diff --git a/dist/assets/VectorTileLayer-0SVRfneU.js b/dist/assets/VectorTileLayer-0SVRfneU.js deleted file mode 100644 index e824eaf..0000000 --- a/dist/assets/VectorTileLayer-0SVRfneU.js +++ /dev/null @@ -1 +0,0 @@ -import{Z,E as I,gm as H,p9 as ee,bV as w,f3 as te,bW as x,s as V,pa as Q,n as re,f as ie,l5 as S,ld as se,fZ as le,g as oe,bI as g,p3 as F,h6 as P,e$ as R,pb as W,dT as U,j8 as K,pc as J,j9 as z,pd as ae,pe as G,pf as E,eV as D,pg as L,T as ne,f0 as ue,dK as pe,dO as ce,f1 as he,em as ye,dM as de,dN as fe,en as me,dP as ge,dQ as $,ph as Ae,pi as Se,jY as M,b as xe,e as c,y,ar as we,du as ve,dt as N,c as _e,c7 as be}from"./index-J0iiHjMT.js";import{o as Ie}from"./CustomParametersMixin-Y1bOcayO.js";import{e as Ue}from"./jsonContext-cWV_-jAj.js";import{l as Re}from"./StyleRepository-UhXfhILC.js";import"./TileClipper-NSFZXMR1.js";import"./definitions-DqQMJYPH.js";let _=null;function $e(e){if(_)return _;const t={lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",lossless:"UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"};return _=new Promise(r=>{const i=new Image;i.onload=()=>{i.onload=i.onerror=null,r(i.width>0&&i.height>0)},i.onerror=()=>{i.onload=i.onerror=null,r(!1)},i.src="data:image/webp;base64,"+t[e]}),_}const B=1.15;class C{constructor(t,r){this._spriteSource=t,this._maxTextureSize=r,this.devicePixelRatio=1,this._spriteImageFormat="png",this._isRetina=!1,this._spritesData={},this.image=null,this.width=null,this.height=null,this.loadStatus="not-loaded",t.type==="url"&&t.spriteFormat&&(this._spriteImageFormat=t.spriteFormat),t.pixelRatio&&(this.devicePixelRatio=t.pixelRatio),this.baseURL=t.spriteUrl}get spriteNames(){const t=[];for(const r in this._spritesData)t.push(r);return t.sort(),t}getSpriteInfo(t){return this._spritesData?this._spritesData[t]:null}async load(t){if(this.baseURL){this.loadStatus="loading";try{await this._loadSprites(t),this.loadStatus="loaded"}catch{this.loadStatus="failed"}}else this.loadStatus="failed"}async _loadSprites(t){this._isRetina=this.devicePixelRatio>B;const{width:r,height:i,data:s,json:o}=await this._getSpriteData(this._spriteSource,t),l=Object.keys(o);if(!l||l.length===0||!s)return this._spritesData=this.image=null,void(this.width=this.height=0);this._spritesData=o,this.width=r,this.height=i;const n=Math.max(this._maxTextureSize,4096);if(r>n||i>n){const u=`Sprite resource for style ${this.baseURL} is bigger than the maximum allowed of ${n} pixels}`;throw Z.getLogger("esri.layers.support.SpriteSource").error(u),new I("SpriteSource",u)}let a;for(let u=0;ut.data.index)),this._tileIndexPromise}async dataKey(t,r){const i=await this.fetchTileIndex();return V(r),this._getIndexedDataKey(i,t)}_getIndexedDataKey(t,r){const i=[r];if(r.level<0||r.row<0||r.col<0||r.row>>r.level>0||r.col>>r.level>0)return null;let s=r;for(;s.level!==0;)s=new Q(s.level-1,s.row>>1,s.col>>1,s.world),i.push(s);let o,l,n=t,a=i.pop();if(n===1)return a;for(;i.length;)if(o=i.pop(),l=(1&o.col)+((1&o.row)<<1),n){if(n[l]===0){a=null;break}if(n[l]===1){a=o;break}a=o,n=n[l]}return a}},Pe=class{constructor(t,r){this._tilemap=t,this._tileIndexUrl=r}destroy(){this._tilemap=re(this._tilemap),this._tileIndexPromise=null}async fetchTileIndex(t){return this._tileIndexPromise||(this._tileIndexPromise=x(this._tileIndexUrl,{query:{...t==null?void 0:t.query}}).then(r=>r.data.index)),this._tileIndexPromise}dataKey(t,r){const{level:i,row:s,col:o}=t,l=new Q(t);return this._tilemap.fetchAvailabilityUpsample(i,s,o,l,r).then(()=>(l.world=t.world,l)).catch(n=>{if(ie(n))throw n;return null})}};class Oe{constructor(t){this._tileUrl=t,this._promise=null,this._abortController=null,this._abortOptions=[]}getData(t){this._promise===null&&(this._abortController=new AbortController,this._promise=this._makeRequest(this._tileUrl,this._abortController.signal));const r=this._abortOptions;return r.push(t),le(t,()=>{r.every(i=>oe(i))&&this._abortController.abort()}),this._promise.then(i=>g(i))}async _makeRequest(t,r){const{data:i}=await x(t,{responseType:"array-buffer",signal:r});return i}}const T=new Map;function je(e,t,r,i,s){const o=w(e),l=o.query;if(l)for(const[a,u]of Object.entries(l))switch(u){case"{x}":l[a]=i.toString();break;case"{y}":l[a]=r.toString();break;case"{z}":l[a]=t.toString()}const n=o.path;return Ee(S(n.replaceAll(/\{z\}/gi,t.toString()).replaceAll(/\{y\}/gi,r.toString()).replaceAll(/\{x\}/gi,i.toString()),{...o.query}),s)}function Ee(e,t){return se(T,e,()=>new Oe(e)).getData(t).then(r=>(T.delete(e),r)).catch(r=>{throw T.delete(e),r})}class De{constructor(t,r,i){this.tilemap=null,this.tileInfo=null,this.capabilities=null,this.fullExtent=null,this.initialExtent=null,this.name=t,this.sourceUrl=r;const s=w(this.sourceUrl),o=g(i),l=o.tiles;if(s)for(let f=0;ff.toLowerCase().trim()),a=(i==null?void 0:i.exportTilesAllowed)===!0,u=(n==null?void 0:n.includes("tilemap"))===!0,h=a&&i.hasOwnProperty("maxExportTilesCount")?i.maxExportTilesCount:0;this.capabilities={operations:{supportsExportTiles:a,supportsTileMap:u},exportTiles:a?{maxExportTilesCount:+h}:null},this.tileInfo=R.fromJSON(o.tileInfo);const d=i.tileMap?S(P(s.path,i.tileMap),s.query??{}):null;u?(this.type="vector-tile",this.tilemap=new Pe(new W({layer:{parsedUrl:s,tileInfo:this.tileInfo},minLOD:o.minLOD??this.tileInfo.lods[0].level,maxLOD:o.maxLOD??this.tileInfo.lods[this.tileInfo.lods.length-1].level}),d)):d&&(this.tilemap=new Te(d)),this.fullExtent=U.fromJSON(i.fullExtent),this.initialExtent=U.fromJSON(i.initialExtent)}destroy(){var t;(t=this.tilemap)==null||t.destroy()}async getRefKey(t,r){var i;return await((i=this.tilemap)==null?void 0:i.dataKey(t,r))??t}requestTile(t,r,i,s){const o=this.tileServers[r%this.tileServers.length];return je(o,t,r,i,s)}isCompatibleWith(t){const r=this.tileInfo,i=t.tileInfo;if(!r.spatialReference.equals(i.spatialReference)||!r.origin.equals(i.origin)||Math.round(r.dpi)!==Math.round(i.dpi))return!1;const s=r.lods,o=i.lods,l=Math.min(s.length,o.length);for(let n=0;n=b||Math.abs(r.y-i.y)>=b)return!1;let s,o;e.lods[0].scale>t.lods[0].scale?(s=e,o=t):(o=e,s=t);for(let l=s.lods[0].scale;l>=o.lods[o.lods.length-1].scale-b;l/=2)if(Math.abs(l-o.lods[0].scale)t.lods[0].scale?e.lods[0]:t.lods[0],a=e.lods[e.lods.length-1].scale<=t.lods[t.lods.length-1].scale?e.lods[e.lods.length-1]:t.lods[t.lods.length-1],u=n.scale,h=n.resolution,d=a.scale,f=[];let m=u,O=h,j=0;for(;m>d;)f.push(new ue({level:j,resolution:O,scale:m})),j++,m/=2,O/=2;return new R({size:[r,r],dpi:s,format:i||"pbf",origin:o,lods:f,spatialReference:l})}let p=class extends pe(ce(he(ye(de(fe(Ie(me(ge(be))))))))){constructor(...e){super(...e),this._spriteSourceMap=new Map,this.currentStyleInfo=null,this.isReference=null,this.operationalLayerType="VectorTileLayer",this.style=null,this.tilemapCache=null,this.type="vector-tile",this.url=null,this.path=null}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}destroy(){var e;if(this.sourceNameToSource)for(const t of Object.values(this.sourceNameToSource))t==null||t.destroy();(e=this.primarySource)==null||e.destroy(),this._spriteSourceMap.clear()}async prefetchResources(e){await this.loadSpriteSource(globalThis.devicePixelRatio||1,e)}load(e){const t=this.loadFromPortal({supportedTypes:["Vector Tile Service"],supportsData:!1},e).catch($).then(async()=>{var i;if(!((i=this.portalItem)!=null&&i.id))return;const r=`${this.portalItem.itemCdnUrl}/resources/styles/root.json`;(await x(r,{...e,query:{f:"json",...this.customParameters,token:this.apiKey}})).data&&this.read({url:r},Ue(this.portalItem))}).catch($).then(()=>this._loadStyle(e));return this.addResolvingPromise(t),Promise.resolve(this)}get attributionDataUrl(){const e=this.currentStyleInfo,t=(e==null?void 0:e.serviceUrl)&&w(e.serviceUrl);if(!t)return null;const r=this._getDefaultAttribution(t.path);return r?S(r,{...this.customParameters,token:this.apiKey}):null}get capabilities(){const e=this.primarySource;return e?e.capabilities:{operations:{supportsExportTiles:!1,supportsTileMap:!1},exportTiles:null}}get fullExtent(){var e;return((e=this.primarySource)==null?void 0:e.fullExtent)||null}get initialExtent(){var e;return((e=this.primarySource)==null?void 0:e.initialExtent)||null}get parsedUrl(){return this.serviceUrl?w(this.serviceUrl):null}get serviceUrl(){var e;return((e=this.currentStyleInfo)==null?void 0:e.serviceUrl)||null}get spatialReference(){var e;return((e=this.tileInfo)==null?void 0:e.spatialReference)??null}get styleUrl(){var e;return((e=this.currentStyleInfo)==null?void 0:e.styleUrl)||null}writeStyleUrl(e,t){e&&K(e)&&(e=`https:${e}`);const r=Ae(e);t.styleUrl=Se(e,r)}get tileInfo(){var r;const e=[];for(const i in this.sourceNameToSource)e.push(this.sourceNameToSource[i]);let t=((r=this.primarySource)==null?void 0:r.tileInfo)||new R;if(e.length>1)for(let i=0;i(this._spriteSourceMap.clear(),this._getSourceAndStyle(r,{signal:s})),t)),this._loadingTask.promise}getStyleLayerId(e){return this.styleRepository.getStyleLayerId(e)}getStyleLayerIndex(e){return this.styleRepository.getStyleLayerIndex(e)}getPaintProperties(e){var t;return g((t=this.styleRepository)==null?void 0:t.getPaintProperties(e))}setPaintProperties(e,t){const r=this.styleRepository.isPainterDataDriven(e);this.styleRepository.setPaintProperties(e,t);const i=this.styleRepository.isPainterDataDriven(e);this.emit("paint-change",{layer:e,paint:t,isDataDriven:r||i})}getStyleLayer(e){return g(this.styleRepository.getStyleLayer(e))}setStyleLayer(e,t){this.styleRepository.setStyleLayer(e,t),this.emit("style-layer-change",{layer:e,index:t})}deleteStyleLayer(e){this.styleRepository.deleteStyleLayer(e),this.emit("delete-style-layer",{layer:e})}getLayoutProperties(e){return g(this.styleRepository.getLayoutProperties(e))}setLayoutProperties(e,t){this.styleRepository.setLayoutProperties(e,t),this.emit("layout-change",{layer:e,layout:t})}setStyleLayerVisibility(e,t){this.styleRepository.setStyleLayerVisibility(e,t),this.emit("style-layer-visibility-change",{layer:e,visibility:t})}getStyleLayerVisibility(e){return this.styleRepository.getStyleLayerVisibility(e)}write(e,t){return t!=null&&t.origin&&!this.styleUrl?(t.messages&&t.messages.push(new I("vectortilelayer:unsupported",`VectorTileLayer (${this.title}, ${this.id}) with style defined by JSON only are not supported`,{layer:this})),null):super.write(e,t)}getTileUrl(e,t,r){return null}async _getSourceAndStyle(e,t){if(!e)throw new Error("invalid style!");const r=await Le(e,{...t,query:{...this.customParameters,token:this.apiKey}});r.spriteFormat==="webp"&&(await $e("lossy")||(r.spriteFormat="png")),this._set("currentStyleInfo",{...r}),typeof e=="string"?(this.url=e,this.style=null):(this.url=null,this.style=e),this._set("sourceNameToSource",r.sourceNameToSource),this._set("primarySource",r.sourceNameToSource[r.primarySourceName]),this._set("styleRepository",new Re(r.style)),this.read(r.layerDefinition,{origin:"service"}),this.emit("load-style")}_getDefaultAttribution(e){const t=e.match(/^https?:\/\/(?:basemaps|basemapsbeta|basemapsdev)(?:-api)?\.arcgis\.com(\/[^\/]+)?\/arcgis\/rest\/services\/([^\/]+(\/[^\/]+)*)\/vectortileserver/i),r=["OpenStreetMap_v2","OpenStreetMap_Daylight_v2","OpenStreetMap_Export_v2","OpenStreetMap_FTS_v2","OpenStreetMap_GCS_v2","World_Basemap","World_Basemap_v2","World_Basemap_Export_v2","World_Basemap_GCS_v2","World_Basemap_WGS84","World_Contours_v2"];if(!t)return;const i=t[2]&&t[2].toLowerCase();if(!i)return;const s=t[1]||"";for(const o of r)if(o.toLowerCase().includes(i))return z(`//static.arcgis.com/attribution/Vector${s}/${o}`)}async _loadStyle(e){var t;return((t=this._loadingTask)==null?void 0:t.promise)??this.loadStyle(null,e)}};c([y({readOnly:!0})],p.prototype,"attributionDataUrl",null),c([y({type:["show","hide"]})],p.prototype,"listMode",void 0),c([y({json:{read:!0,write:!0}})],p.prototype,"blendMode",void 0),c([y({readOnly:!0,json:{read:!1}})],p.prototype,"capabilities",null),c([y({readOnly:!0})],p.prototype,"currentStyleInfo",void 0),c([y({json:{read:!1},readOnly:!0,type:U})],p.prototype,"fullExtent",null),c([y({json:{read:!1},readOnly:!0,type:U})],p.prototype,"initialExtent",null),c([y({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],p.prototype,"isReference",void 0),c([y({type:["VectorTileLayer"]})],p.prototype,"operationalLayerType",void 0),c([y({readOnly:!0})],p.prototype,"parsedUrl",null),c([y()],p.prototype,"style",void 0),c([y({readOnly:!0})],p.prototype,"serviceUrl",null),c([y({type:we,readOnly:!0})],p.prototype,"spatialReference",null),c([y({readOnly:!0})],p.prototype,"styleRepository",void 0),c([y({readOnly:!0})],p.prototype,"sourceNameToSource",void 0),c([y({readOnly:!0})],p.prototype,"primarySource",void 0),c([y({type:String,readOnly:!0,json:{write:{ignoreOrigin:!0},origins:{"web-document":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],p.prototype,"styleUrl",null),c([ve(["portal-item","web-document"],"styleUrl")],p.prototype,"writeStyleUrl",null),c([y({json:{read:!1,origins:{service:{read:!1}}},readOnly:!0,type:R})],p.prototype,"tileInfo",null),c([y()],p.prototype,"tilemapCache",void 0),c([N("service","tilemapCache",["capabilities","tileInfo"])],p.prototype,"readTilemapCache",null),c([y({json:{read:!1},readOnly:!0,value:"vector-tile"})],p.prototype,"type",void 0),c([y({json:{origins:{"web-document":{read:{source:"styleUrl"}},"portal-item":{read:{source:"url"}}},write:!1,read:!1}})],p.prototype,"url",void 0),c([y({readOnly:!0})],p.prototype,"version",void 0),c([N("version",["version","currentVersion"])],p.prototype,"readVersion",null),c([y({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],p.prototype,"path",void 0),p=c([_e("esri.layers.VectorTileLayer")],p);const Ge=p;export{Ge as default}; diff --git a/dist/assets/VectorTileLayer-3l6dancR.js b/dist/assets/VectorTileLayer-3l6dancR.js new file mode 100644 index 0000000..8003320 --- /dev/null +++ b/dist/assets/VectorTileLayer-3l6dancR.js @@ -0,0 +1 @@ +import{R as H,r as I,gj as Z,pm as ee,au as w,e_ as te,av as x,ab as Q,pn as V,b as re,ac as ie,lc as S,ll as se,fU as le,ad as oe,ah as g,pg as F,h8 as P,eW as R,po as W,dO as U,jf as J,pp as K,jg as z,pq as ae,pr as G,ps as j,eQ as D,pt as E,L as ne,eX as ue,dF as pe,dJ as ce,eY as he,ef as ye,dH as de,dI as fe,eg as me,dK as ge,dL as $,pu as Ae,pv as Se,k3 as M,N as xe,e as c,y,d2 as we,du as ve,dt as N,c as _e,aI as be}from"./index-pCX-0tJH.js";import{o as Ie}from"./CustomParametersMixin-7nmugR3Y.js";import{e as Ue}from"./jsonContext-EgdQULbU.js";import{l as Re}from"./StyleRepository-TpBuuKhf.js";import"./TileClipper-NSFZXMR1.js";import"./definitions-SVBNHUSH.js";let _=null;function $e(e){if(_)return _;const t={lossy:"UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",lossless:"UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==",alpha:"UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==",animation:"UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA"};return _=new Promise(r=>{const i=new Image;i.onload=()=>{i.onload=i.onerror=null,r(i.width>0&&i.height>0)},i.onerror=()=>{i.onload=i.onerror=null,r(!1)},i.src="data:image/webp;base64,"+t[e]}),_}const k=1.15;class B{constructor(t,r){this._spriteSource=t,this._maxTextureSize=r,this.devicePixelRatio=1,this._spriteImageFormat="png",this._isRetina=!1,this._spritesData={},this.image=null,this.width=null,this.height=null,this.loadStatus="not-loaded",t.type==="url"&&t.spriteFormat&&(this._spriteImageFormat=t.spriteFormat),t.pixelRatio&&(this.devicePixelRatio=t.pixelRatio),this.baseURL=t.spriteUrl}get spriteNames(){const t=[];for(const r in this._spritesData)t.push(r);return t.sort(),t}getSpriteInfo(t){return this._spritesData?this._spritesData[t]:null}async load(t){if(this.baseURL){this.loadStatus="loading";try{await this._loadSprites(t),this.loadStatus="loaded"}catch{this.loadStatus="failed"}}else this.loadStatus="failed"}async _loadSprites(t){this._isRetina=this.devicePixelRatio>k;const{width:r,height:i,data:s,json:o}=await this._getSpriteData(this._spriteSource,t),l=Object.keys(o);if(!l||l.length===0||!s)return this._spritesData=this.image=null,void(this.width=this.height=0);this._spritesData=o,this.width=r,this.height=i;const n=Math.max(this._maxTextureSize,4096);if(r>n||i>n){const u=`Sprite resource for style ${this.baseURL} is bigger than the maximum allowed of ${n} pixels}`;throw H.getLogger("esri.layers.support.SpriteSource").error(u),new I("SpriteSource",u)}let a;for(let u=0;ut.data.index)),this._tileIndexPromise}async dataKey(t,r){const i=await this.fetchTileIndex();return Q(r),this._getIndexedDataKey(i,t)}_getIndexedDataKey(t,r){const i=[r];if(r.level<0||r.row<0||r.col<0||r.row>>r.level>0||r.col>>r.level>0)return null;let s=r;for(;s.level!==0;)s=new V(s.level-1,s.row>>1,s.col>>1,s.world),i.push(s);let o,l,n=t,a=i.pop();if(n===1)return a;for(;i.length;)if(o=i.pop(),l=(1&o.col)+((1&o.row)<<1),n){if(n[l]===0){a=null;break}if(n[l]===1){a=o;break}a=o,n=n[l]}return a}},Pe=class{constructor(t,r){this._tilemap=t,this._tileIndexUrl=r}destroy(){this._tilemap=re(this._tilemap),this._tileIndexPromise=null}async fetchTileIndex(t){return this._tileIndexPromise||(this._tileIndexPromise=x(this._tileIndexUrl,{query:{...t==null?void 0:t.query}}).then(r=>r.data.index)),this._tileIndexPromise}dataKey(t,r){const{level:i,row:s,col:o}=t,l=new V(t);return this._tilemap.fetchAvailabilityUpsample(i,s,o,l,r).then(()=>(l.world=t.world,l)).catch(n=>{if(ie(n))throw n;return null})}};class Oe{constructor(t){this._tileUrl=t,this._promise=null,this._abortController=null,this._abortOptions=[]}getData(t){this._promise===null&&(this._abortController=new AbortController,this._promise=this._makeRequest(this._tileUrl,this._abortController.signal));const r=this._abortOptions;return r.push(t),le(t,()=>{r.every(i=>oe(i))&&this._abortController.abort()}),this._promise.then(i=>g(i))}async _makeRequest(t,r){const{data:i}=await x(t,{responseType:"array-buffer",signal:r});return i}}const T=new Map;function Le(e,t,r,i,s){const o=w(e),l=o.query;if(l)for(const[a,u]of Object.entries(l))switch(u){case"{x}":l[a]=i.toString();break;case"{y}":l[a]=r.toString();break;case"{z}":l[a]=t.toString()}const n=o.path;return je(S(n.replaceAll(/\{z\}/gi,t.toString()).replaceAll(/\{y\}/gi,r.toString()).replaceAll(/\{x\}/gi,i.toString()),{...o.query}),s)}function je(e,t){return se(T,e,()=>new Oe(e)).getData(t).then(r=>(T.delete(e),r)).catch(r=>{throw T.delete(e),r})}class De{constructor(t,r,i){this.tilemap=null,this.tileInfo=null,this.capabilities=null,this.fullExtent=null,this.initialExtent=null,this.name=t,this.sourceUrl=r;const s=w(this.sourceUrl),o=g(i),l=o.tiles;if(s)for(let f=0;ff.toLowerCase().trim()),a=(i==null?void 0:i.exportTilesAllowed)===!0,u=(n==null?void 0:n.includes("tilemap"))===!0,h=a&&i.hasOwnProperty("maxExportTilesCount")?i.maxExportTilesCount:0;this.capabilities={operations:{supportsExportTiles:a,supportsTileMap:u},exportTiles:a?{maxExportTilesCount:+h}:null},this.tileInfo=R.fromJSON(o.tileInfo);const d=i.tileMap?S(P(s.path,i.tileMap),s.query??{}):null;u?(this.type="vector-tile",this.tilemap=new Pe(new W({layer:{parsedUrl:s,tileInfo:this.tileInfo},minLOD:o.minLOD??this.tileInfo.lods[0].level,maxLOD:o.maxLOD??this.tileInfo.lods[this.tileInfo.lods.length-1].level}),d)):d&&(this.tilemap=new Te(d)),this.fullExtent=U.fromJSON(i.fullExtent),this.initialExtent=U.fromJSON(i.initialExtent)}destroy(){var t;(t=this.tilemap)==null||t.destroy()}async getRefKey(t,r){var i;return await((i=this.tilemap)==null?void 0:i.dataKey(t,r))??t}requestTile(t,r,i,s){const o=this.tileServers[r%this.tileServers.length];return Le(o,t,r,i,s)}isCompatibleWith(t){const r=this.tileInfo,i=t.tileInfo;if(!r.spatialReference.equals(i.spatialReference)||!r.origin.equals(i.origin)||Math.round(r.dpi)!==Math.round(i.dpi))return!1;const s=r.lods,o=i.lods,l=Math.min(s.length,o.length);for(let n=0;n=b||Math.abs(r.y-i.y)>=b)return!1;let s,o;e.lods[0].scale>t.lods[0].scale?(s=e,o=t):(o=e,s=t);for(let l=s.lods[0].scale;l>=o.lods[o.lods.length-1].scale-b;l/=2)if(Math.abs(l-o.lods[0].scale)t.lods[0].scale?e.lods[0]:t.lods[0],a=e.lods[e.lods.length-1].scale<=t.lods[t.lods.length-1].scale?e.lods[e.lods.length-1]:t.lods[t.lods.length-1],u=n.scale,h=n.resolution,d=a.scale,f=[];let m=u,O=h,L=0;for(;m>d;)f.push(new ue({level:L,resolution:O,scale:m})),L++,m/=2,O/=2;return new R({size:[r,r],dpi:s,format:i||"pbf",origin:o,lods:f,spatialReference:l})}let p=class extends pe(ce(he(ye(de(fe(Ie(me(ge(be))))))))){constructor(...e){super(...e),this._spriteSourceMap=new Map,this.currentStyleInfo=null,this.isReference=null,this.operationalLayerType="VectorTileLayer",this.style=null,this.tilemapCache=null,this.type="vector-tile",this.url=null,this.path=null}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}destroy(){var e;if(this.sourceNameToSource)for(const t of Object.values(this.sourceNameToSource))t==null||t.destroy();(e=this.primarySource)==null||e.destroy(),this._spriteSourceMap.clear()}async prefetchResources(e){await this.loadSpriteSource(globalThis.devicePixelRatio||1,e)}load(e){const t=this.loadFromPortal({supportedTypes:["Vector Tile Service"],supportsData:!1},e).catch($).then(async()=>{var i;if(!((i=this.portalItem)!=null&&i.id))return;const r=`${this.portalItem.itemCdnUrl}/resources/styles/root.json`;(await x(r,{...e,query:{f:"json",...this.customParameters,token:this.apiKey}})).data&&this.read({url:r},Ue(this.portalItem))}).catch($).then(()=>this._loadStyle(e));return this.addResolvingPromise(t),Promise.resolve(this)}get attributionDataUrl(){const e=this.currentStyleInfo,t=(e==null?void 0:e.serviceUrl)&&w(e.serviceUrl);if(!t)return null;const r=this._getDefaultAttribution(t.path);return r?S(r,{...this.customParameters,token:this.apiKey}):null}get capabilities(){const e=this.primarySource;return e?e.capabilities:{operations:{supportsExportTiles:!1,supportsTileMap:!1},exportTiles:null}}get fullExtent(){var e;return((e=this.primarySource)==null?void 0:e.fullExtent)||null}get initialExtent(){var e;return((e=this.primarySource)==null?void 0:e.initialExtent)||null}get parsedUrl(){return this.serviceUrl?w(this.serviceUrl):null}get serviceUrl(){var e;return((e=this.currentStyleInfo)==null?void 0:e.serviceUrl)||null}get spatialReference(){var e;return((e=this.tileInfo)==null?void 0:e.spatialReference)??null}get styleUrl(){var e;return((e=this.currentStyleInfo)==null?void 0:e.styleUrl)||null}writeStyleUrl(e,t){e&&J(e)&&(e=`https:${e}`);const r=Ae(e);t.styleUrl=Se(e,r)}get tileInfo(){var r;const e=[];for(const i in this.sourceNameToSource)e.push(this.sourceNameToSource[i]);let t=((r=this.primarySource)==null?void 0:r.tileInfo)||new R;if(e.length>1)for(let i=0;i(this._spriteSourceMap.clear(),this._getSourceAndStyle(r,{signal:s})),t)),this._loadingTask.promise}getStyleLayerId(e){return this.styleRepository.getStyleLayerId(e)}getStyleLayerIndex(e){return this.styleRepository.getStyleLayerIndex(e)}getPaintProperties(e){var t;return g((t=this.styleRepository)==null?void 0:t.getPaintProperties(e))}setPaintProperties(e,t){const r=this.styleRepository.isPainterDataDriven(e);this.styleRepository.setPaintProperties(e,t);const i=this.styleRepository.isPainterDataDriven(e);this.emit("paint-change",{layer:e,paint:t,isDataDriven:r||i})}getStyleLayer(e){return g(this.styleRepository.getStyleLayer(e))}setStyleLayer(e,t){this.styleRepository.setStyleLayer(e,t),this.emit("style-layer-change",{layer:e,index:t})}deleteStyleLayer(e){this.styleRepository.deleteStyleLayer(e),this.emit("delete-style-layer",{layer:e})}getLayoutProperties(e){return g(this.styleRepository.getLayoutProperties(e))}setLayoutProperties(e,t){this.styleRepository.setLayoutProperties(e,t),this.emit("layout-change",{layer:e,layout:t})}setStyleLayerVisibility(e,t){this.styleRepository.setStyleLayerVisibility(e,t),this.emit("style-layer-visibility-change",{layer:e,visibility:t})}getStyleLayerVisibility(e){return this.styleRepository.getStyleLayerVisibility(e)}write(e,t){return t!=null&&t.origin&&!this.styleUrl?(t.messages&&t.messages.push(new I("vectortilelayer:unsupported",`VectorTileLayer (${this.title}, ${this.id}) with style defined by JSON only are not supported`,{layer:this})),null):super.write(e,t)}getTileUrl(e,t,r){return null}async _getSourceAndStyle(e,t){if(!e)throw new Error("invalid style!");const r=await Ee(e,{...t,query:{...this.customParameters,token:this.apiKey}});r.spriteFormat==="webp"&&(await $e("lossy")||(r.spriteFormat="png")),this._set("currentStyleInfo",{...r}),typeof e=="string"?(this.url=e,this.style=null):(this.url=null,this.style=e),this._set("sourceNameToSource",r.sourceNameToSource),this._set("primarySource",r.sourceNameToSource[r.primarySourceName]),this._set("styleRepository",new Re(r.style)),this.read(r.layerDefinition,{origin:"service"}),this.emit("load-style")}_getDefaultAttribution(e){const t=e.match(/^https?:\/\/(?:basemaps|basemapsbeta|basemapsdev)(?:-api)?\.arcgis\.com(\/[^\/]+)?\/arcgis\/rest\/services\/([^\/]+(\/[^\/]+)*)\/vectortileserver/i),r=["OpenStreetMap_v2","OpenStreetMap_Daylight_v2","OpenStreetMap_Export_v2","OpenStreetMap_FTS_v2","OpenStreetMap_GCS_v2","World_Basemap","World_Basemap_v2","World_Basemap_Export_v2","World_Basemap_GCS_v2","World_Basemap_WGS84","World_Contours_v2"];if(!t)return;const i=t[2]&&t[2].toLowerCase();if(!i)return;const s=t[1]||"";for(const o of r)if(o.toLowerCase().includes(i))return z(`//static.arcgis.com/attribution/Vector${s}/${o}`)}async _loadStyle(e){var t;return((t=this._loadingTask)==null?void 0:t.promise)??this.loadStyle(null,e)}};c([y({readOnly:!0})],p.prototype,"attributionDataUrl",null),c([y({type:["show","hide"]})],p.prototype,"listMode",void 0),c([y({json:{read:!0,write:!0}})],p.prototype,"blendMode",void 0),c([y({readOnly:!0,json:{read:!1}})],p.prototype,"capabilities",null),c([y({readOnly:!0})],p.prototype,"currentStyleInfo",void 0),c([y({json:{read:!1},readOnly:!0,type:U})],p.prototype,"fullExtent",null),c([y({json:{read:!1},readOnly:!0,type:U})],p.prototype,"initialExtent",null),c([y({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],p.prototype,"isReference",void 0),c([y({type:["VectorTileLayer"]})],p.prototype,"operationalLayerType",void 0),c([y({readOnly:!0})],p.prototype,"parsedUrl",null),c([y()],p.prototype,"style",void 0),c([y({readOnly:!0})],p.prototype,"serviceUrl",null),c([y({type:we,readOnly:!0})],p.prototype,"spatialReference",null),c([y({readOnly:!0})],p.prototype,"styleRepository",void 0),c([y({readOnly:!0})],p.prototype,"sourceNameToSource",void 0),c([y({readOnly:!0})],p.prototype,"primarySource",void 0),c([y({type:String,readOnly:!0,json:{write:{ignoreOrigin:!0},origins:{"web-document":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],p.prototype,"styleUrl",null),c([ve(["portal-item","web-document"],"styleUrl")],p.prototype,"writeStyleUrl",null),c([y({json:{read:!1,origins:{service:{read:!1}}},readOnly:!0,type:R})],p.prototype,"tileInfo",null),c([y()],p.prototype,"tilemapCache",void 0),c([N("service","tilemapCache",["capabilities","tileInfo"])],p.prototype,"readTilemapCache",null),c([y({json:{read:!1},readOnly:!0,value:"vector-tile"})],p.prototype,"type",void 0),c([y({json:{origins:{"web-document":{read:{source:"styleUrl"}},"portal-item":{read:{source:"url"}}},write:!1,read:!1}})],p.prototype,"url",void 0),c([y({readOnly:!0})],p.prototype,"version",void 0),c([N("version",["version","currentVersion"])],p.prototype,"readVersion",null),c([y({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],p.prototype,"path",void 0),p=c([_e("esri.layers.VectorTileLayer")],p);const Ge=p;export{Ge as default}; diff --git a/dist/assets/VectorTileLayerView3D-eTryeubP.js b/dist/assets/VectorTileLayerView3D-eTryeubP.js new file mode 100644 index 0000000..0e5485f --- /dev/null +++ b/dist/assets/VectorTileLayerView3D-eTryeubP.js @@ -0,0 +1,555 @@ +import{uP as Le,uQ as He,fv as Ue,uR as Ae,av as We,uj as Be,I as ze,lc as he,f_ as Ge,o6 as Je,dL as Ke,pn as ee,ac as Ye,uS as ke,uT as je,uU as Xe,ug as le,sE as U,uV as Y,uW as ce,uX as de,uY as Qe,uZ as ae,u_ as Ze,u$ as et,eW as tt,ab as it,cf as nt,v0 as st,tA as ot,v1 as at,v2 as rt,v3 as j,fR as fe,m5 as V,v4 as F,v5 as lt,v6 as ct,v7 as ut,qR as H,v8 as ht,v9 as dt,sB as A,s5 as Oe,sC as K,va as oe,dE as _e,r as ft,vb as _t,vc as mt,aa as pt,B as gt,T as vt,ad as yt,b as me,e as q,y as B,c as xt}from"./index-pCX-0tJH.js";import{t as $}from"./Rect-bBBxMtVp.js";import{e as wt}from"./rasterizingUtils-_-kX1RtA.js";import{r as bt}from"./vec4f32-NvfHy9q7.js";import{e as k,t as Ne,r as pe}from"./definitions-SVBNHUSH.js";import{T as W}from"./enums-uQoFEhYh.js";import{M as ne}from"./number-sTjsTbdA.js";import{c as ge}from"./GeometryUtils-K2DOc0l8.js";import{l as ve}from"./StyleRepository-TpBuuKhf.js";import{n as St}from"./LayerView3D-57OghbRh.js";import{o as Tt}from"./TiledLayerView3D-_U1Q993H.js";import{u as Pt}from"./LayerView-ixwLVnzr.js";import"./TileClipper-NSFZXMR1.js";let It=class{constructor(e,i,t){this._scale=e,this._shift=i,this._levelShift=t}getLevelRowColumn(e){const i=this.getLevelShift(e[0]),t=this._shift+i;return t?[e[0]-i,e[1]>>t,e[2]>>t]:e}getLevelShift(e){return Math.min(e,this._levelShift)}getOffset(e,i){let t=0,n=0;const s=this._shift+this.getLevelShift(e[0]);if(s){const o=(1<this._width||i>this._height)return new $;let t=null,n=-1;for(let s=0;se&&this._free.push(new $(t.x+e,t.y,t.width-e,i)),t.height>i&&this._free.push(new $(t.x,t.y+i,t.width,t.height-i))):(t.width>e&&this._free.push(new $(t.x+e,t.y,t.width-e,t.height)),t.height>i&&this._free.push(new $(t.x,t.y+i,e,t.height-i))),new $(t.x,t.y,e,i))}release(e){for(let i=0;i{const l=e+r;if(this._rangePromises.has(l))a.push(this._rangePromises.get(l));else{const h=n.getRange(e,r).then(()=>{this._rangePromises.delete(l)},()=>{this._rangePromises.delete(l)});this._rangePromises.set(l,h),a.push(h)}}),Promise.all(a).then(()=>{let r=this._glyphIndex[e];r||(r={},this._glyphIndex[e]=r);for(const l of i){const h=r[l];if(h){t[l]={sdf:!0,rect:h.rect,metrics:h.metrics,page:h.page,code:l};continue}const d=n.getGlyph(e,l);if(!(d!=null&&d.metrics))continue;const f=d.metrics;let c;if(f.width===0)c=new $(0,0,0,0);else{const m=f.width+6,_=f.height+2*3;let p=m%4?4-m%4:4,y=_%4?4-_%4:4;p===1&&(p=5),y===1&&(y=5),c=this._binPack.allocate(m+p,_+y),c.isEmpty&&(this._dirties[this._currentPage]||(this._glyphData[this._currentPage]=null),this._currentPage=this._glyphData.length,this._glyphData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(void 0),this._binPack=new ie(this.width-4,this.height-4),c=this._binPack.allocate(m+p,_+y));const P=this._glyphData[this._currentPage],I=d.bitmap;let x,b;if(I)for(let w=0;w<_;w++){x=m*w,b=this.width*(c.y+w+1)+c.x;for(let v=0;v{t.addRange(i,new re(new Be(new Uint8Array(a.data),new DataView(a.data))))}).catch(()=>{t.addRange(i,new re)})}return t.addRange(i,new re),Promise.resolve()}getGlyph(e,i){const t=this._getFontStack(e);if(!t)return;const n=Math.floor(i/256),s=t.getRange(n);return s?{metrics:s.getMetrics(i),bitmap:s.getBitmap(i)}:void 0}_getFontStack(e){let i=this._glyphInfo[e];return i||(i=this._glyphInfo[e]=new Mt),i}},Rt=class{constructor(e,i,t){this._array=e,this._start=i,this.length=t}at(e){return 0<=e&&e0&&(this._maxItemSize=t),this._binPack=new ie(e-4,i-4)}destroy(){this.dispose()}dispose(){this._binPack=null,this._mosaicsData.length=0,this._mosaicRects={};for(const e of this._textures)e&&e.dispose();this._textures.length=0}getWidth(e){return e>=this._size.length?-1:this._size[e][0]}getHeight(e){return e>=this._size.length?-1:this._size[e][1]}getPageSize(e){return e>=this._size.length?null:this._size[e]}setSpriteSource(e){if(this.dispose(),this.pixelRatio=e.devicePixelRatio,this._mosaicsData.length===0){this._binPack=new ie(this._pageWidth-4,this._pageHeight-4);const i=Math.floor(this._pageWidth),t=Math.floor(this._pageHeight),n=new Uint32Array(i*t);this._mosaicsData[0]=n,this._dirties.push(!0),this._size.push([this._pageWidth,this._pageHeight]),this._textures.push(void 0)}this._sprites=e}getSpriteItem(e,i=!1){let t,n,s=this._mosaicRects[e];if(s)return s;if(!this._sprites||this._sprites.loadStatus!=="loaded"||(e&&e.startsWith(Dt)?([t,n]=this._rasterizeDash(e),i=!0):t=this._sprites.getSpriteInfo(e),!(t!=null&&t.width)||!t.height||t.width<0||t.height<0))return null;const o=t.width,a=t.height,[r,l,h]=this._allocateImage(o,a);return r.width<=0?null:(this._copy(r,t,l,h,i,n),s={rect:r,width:o,height:a,sdf:t.sdf,simplePattern:!1,pixelRatio:t.pixelRatio,page:l},this._mosaicRects[e]=s,s)}getSpriteItems(e){const i={};for(const t of e)i[t.name]=this.getSpriteItem(t.name,t.repeat);return i}getMosaicItemPosition(e,i){const t=this.getSpriteItem(e,i),n=t&&t.rect;if(!n)return null;n.width=t.width,n.height=t.height;const s=t.width,o=t.height,a=2;return{tl:[n.x+a,n.y+a],br:[n.x+a+s,n.y+a+o],page:t.page}}bind(e,i,t=0,n=0){if(t>=this._size.length||t>=this._mosaicsData.length)return;if(!this._textures[t]){const o=new Le;o.wrapMode=Ue.CLAMP_TO_EDGE,o.width=this._size[t][0],o.height=this._size[t][1],this._textures[t]=new Ae(e,o,new Uint8Array(this._mosaicsData[t].buffer))}const s=this._textures[t];s.setSamplingMode(i),this._dirties[t]&&s.setData(new Uint8Array(this._mosaicsData[t].buffer)),e.bindTexture(s,n),this._dirties[t]=!1}static _copyBits(e,i,t,n,s,o,a,r,l,h,d){let f=n*i+t,c=r*o+a;if(d){c-=o;for(let g=-1;g<=h;g++,f=((g+h)%h+n)*i+t,c+=o)for(let m=-1;m<=l;m++)s[c+m]=e[f+(m+l)%l]}else for(let g=0;g=this._mosaicsData.length)return;const a=new Uint32Array(o?o.buffer:this._sprites.image.buffer),r=this._mosaicsData[t];r&&a||console.error("Source or target images are uninitialized!");const l=2,h=o?i.width:this._sprites.width;$e._copyBits(a,h,i.x,i.y,r,n[0],e.x+l,e.y+l,i.width,i.height,s),this._dirties[t]=!0}_allocateImage(e,i){e+=2,i+=2;const t=Math.max(e,i);if(this._maxItemSize&&this._maxItemSizethis._spriteMosaic)}get glyphMosaic(){return this._glyphMosaic}async start(e){this._requestSprite(e);const i=this._layer.currentStyleInfo.glyphsUrl,t=new xe(i?he(i,{...this._layer.customParameters,token:this._layer.apiKey}):null);this._glyphMosaic=new ye(1024,1024,t),this._broadcastPromise=Ge("WorkerTileHandler",{client:this,schedule:e.schedule,signal:e.signal}).then(n=>{var s;if(this._layer&&((s=this._connection)==null||s.close(),this._connection=n,this._layer&&!this._connection.closed)){const o=n.broadcast("setStyle",this._layer.currentStyleInfo.style,e);Promise.all(o).catch(a=>Je(a))}})}_requestSprite(e){var o,a;(o=this._spriteSourceAbortController)==null||o.abort();const i=new AbortController;this._spriteSourceAbortController=i;const t=e==null?void 0:e.signal;this._inputSignalEventListener&&((a=this._startOptionsInputSignal)==null||a.removeEventListener("abort",this._inputSignalEventListener)),this._startOptionsInputSignal=null,t&&(this._inputSignalEventListener=Et(i),t.addEventListener("abort",this._inputSignalEventListener,{once:!0}));const{signal:n}=i,s={...e,signal:n};this._spriteSourcePromise=this._layer.loadSpriteSource(this.devicePixelRatio,s),this._spriteSourcePromise.then(r=>{Ke(n),this._spriteMosaic=new we(1024,1024,250),this._spriteMosaic.setSpriteSource(r)})}async updateStyle(e){return await this._broadcastPromise,this._broadcastPromise=Promise.all(this._connection.broadcast("updateStyle",e)),this._broadcastPromise}setSpriteSource(e){const i=new we(1024,1024,250);return i.setSpriteSource(e),this._spriteMosaic=i,this._spriteSourcePromise=Promise.resolve(e),this._spriteSourceAbortController=null,i}async setStyle(e,i){await this._broadcastPromise,this._styleRepository=e,this._requestSprite();const t=new xe(this._layer.currentStyleInfo.glyphsUrl?he(this._layer.currentStyleInfo.glyphsUrl,{...this._layer.customParameters,token:this._layer.apiKey}):null);return this._glyphMosaic=new ye(1024,1024,t),this._broadcastPromise=Promise.all(this._connection.broadcast("setStyle",i)),this._broadcastPromise}fetchTileData(e,i){return this._getRefKeys(e,i).then(t=>{const n=this._layer.sourceNameToSource,s=[];for(const o in n)s.push(o);return this._getSourcesData(s,t,i)})}parseTileData(e,i){const t=e&&e.data;if(!t)return Promise.resolve(null);const{sourceName2DataAndRefKey:n,transferList:s}=t;return Object.keys(n).length===0?Promise.resolve(null):this._broadcastPromise.then(()=>this._connection.invoke("createTileAndParse",{key:e.key.id,sourceName2DataAndRefKey:n,styleLayerUIDs:e.styleLayerUIDs},{...i,transferList:s}))}async getSprites(e){return await this._spriteSourcePromise,this._spriteMosaic.getSpriteItems(e)}getGlyphs(e){return this._glyphMosaic.getGlyphItems(e.font,e.codePoints)}async _getTilePayload(e,i,t){const n=ee.pool.acquire(e.id),s=this._layer.sourceNameToSource[i],{level:o,row:a,col:r}=n;ee.pool.release(n);try{return{protobuff:await s.requestTile(o,a,r,t),sourceName:i}}catch(l){if(Ye(l))throw l;return{protobuff:null,sourceName:i}}}_getRefKeys(e,i){const t=this._layer.sourceNameToSource,n=new Array;for(const s in t){const o=t[s].getRefKey(e,i);n.push(o)}return Promise.allSettled(n)}_getSourcesData(e,i,t){const n=[];for(let s=0;s{const o={},a=[];for(let r=0;ru.abort()}function Lt(u,e,i,t,n,s){const{iconRotationAlignment:o,textRotationAlignment:a,iconTranslate:r,iconTranslateAnchor:l,textTranslate:h,textTranslateAnchor:d}=t;let f=0;for(const c of u.colliders){const[g,m]=c.partIndex===0?r:h,_=c.partIndex===0?l:d,p=c.minLod<=s&&s<=c.maxLod;f+=p?0:1,c.enabled=p,c.xScreen=c.xTile*n[0]+c.yTile*n[3]+n[6],c.yScreen=c.xTile*n[1]+c.yTile*n[4]+n[7],_===Y.MAP?(c.xScreen+=i*g-e*m,c.yScreen+=e*g+i*m):(c.xScreen+=g,c.yScreen+=m),U.VIEWPORT===(c.partIndex===0?o:a)?(c.dxScreen=c.dxPixels,c.dyScreen=c.dyPixels):(c.dxScreen=i*(c.dxPixels+c.width/2)-e*(c.dyPixels+c.height/2)-c.width/2,c.dyScreen=e*(c.dxPixels+c.width/2)+i*(c.dyPixels+c.height/2)-c.height/2)}u.colliders.length>0&&f===u.colliders.length&&(u.unique.show=!1)}let Ut=class{constructor(e,i,t,n,s,o){this._symbols=e,this._styleRepository=n,this._zoom=s,this._currentLayerCursor=0,this._currentSymbolCursor=0,this._styleProps=new Map,this._allNeededMatrices=new Map,this._gridIndex=new ke(i,t,je),this._si=Math.sin(Math.PI*o/180),this._co=Math.cos(Math.PI*o/180);for(const a of e)for(const r of a.symbols)this._allNeededMatrices.has(r.tile)||this._allNeededMatrices.set(r.tile,Xe(r.tile.transforms.tileUnitsToPixels))}work(e){const i=this._gridIndex;function t(s){const o=s.xScreen+s.dxScreen,a=s.yScreen+s.dyScreen,r=o+s.width,l=a+s.height,[h,d,f,c]=i.getCellSpan(o,a,r,l);for(let g=d;g<=c;g++)for(let m=h;m<=f;m++){const _=i.cells[g][m];for(const p of _){const y=p.xScreen+p.dxScreen,P=p.yScreen+p.dyScreen,I=y+p.width,x=P+p.height;if(!(rI||lx))return!0}}return!1}const n=performance.now();for(;this._currentLayerCursore)return!1;const a=s.symbols[this._currentSymbolCursor];if(!a.unique.show)continue;Lt(a,this._si,this._co,o,this._allNeededMatrices.get(a.tile),this._zoom);const r=a.unique;if(!r.show)continue;const{iconAllowOverlap:l,iconIgnorePlacement:h,textAllowOverlap:d,textIgnorePlacement:f}=o;for(const c of a.colliders){if(!c.enabled)continue;const g=r.parts[c.partIndex];g.show&&!(c.partIndex?d:l)&&t(c)&&(c.hard?r.show=!1:g.show=!1)}if(r.show)for(const c of a.colliders){if(!c.enabled||(c.partIndex?f:h)||!r.parts[c.partIndex].show)continue;const g=c.xScreen+c.dxScreen,m=c.yScreen+c.dyScreen,_=g+c.width,p=m+c.height,[y,P,I,x]=this._gridIndex.getCellSpan(g,m,_,p);for(let b=P;b<=x;b++)for(let w=y;w<=I;w++)this._gridIndex.cells[b][w].push(c)}}}return!0}_getProperties(e){const i=this._styleProps.get(e);if(i)return i;const t=this._zoom,n=this._styleRepository.getStyleLayerByUID(e),s=n.getLayoutValue("symbol-placement",t)!==le.POINT;let o=n.getLayoutValue("icon-rotation-alignment",t);o===U.AUTO&&(o=s?U.MAP:U.VIEWPORT);let a=n.getLayoutValue("text-rotation-alignment",t);a===U.AUTO&&(a=s?U.MAP:U.VIEWPORT);const r=n.getPaintValue("icon-translate",t),l=n.getPaintValue("icon-translate-anchor",t),h=n.getPaintValue("text-translate",t),d=n.getPaintValue("text-translate-anchor",t),f={iconAllowOverlap:n.getLayoutValue("icon-allow-overlap",t),iconIgnorePlacement:n.getLayoutValue("icon-ignore-placement",t),textAllowOverlap:n.getLayoutValue("text-allow-overlap",t),textIgnorePlacement:n.getLayoutValue("text-ignore-placement",t),iconRotationAlignment:o,textRotationAlignment:a,iconTranslateAnchor:l,iconTranslate:r,textTranslateAnchor:d,textTranslate:h};return this._styleProps.set(e,f),f}};function At(u,e){if(u.priority-e.priority)return u.priority-e.priority;const i=u.tile.key,t=e.tile.key;return i.world-t.world?i.world-t.world:i.level-t.level?i.level-t.level:i.row-t.row?i.row-t.row:i.col-t.col?i.col-t.col:u.xTile-e.xTile?u.xTile-e.xTile:u.yTile-e.yTile}let zt=class{get running(){return this._running}constructor(e,i,t,n,s,o){this._visibleTiles=e,this._symbolRepository=i,this._createCollisionJob=t,this._assignTileSymbolsOpacity=n,this._symbolLayerSorter=s,this._isLayerVisible=o,this._selectionJob=null,this._selectionJobCompleted=!1,this._collisionJob=null,this._collisionJobCompleted=!1,this._opacityJob=null,this._opacityJobCompleted=!1,this._running=!0}setScreenSize(e,i){this._screenWidth===e&&this._screenHeight===i||this.restart(),this._screenWidth=e,this._screenHeight=i}restart(){this._selectionJob=null,this._selectionJobCompleted=!1,this._collisionJob=null,this._collisionJobCompleted=!1,this._opacityJob=null,this._opacityJobCompleted=!1,this._running=!0}continue(e){if(this._selectionJob||(this._selectionJob=this._createSelectionJob()),!this._selectionJobCompleted){const i=performance.now();if(!this._selectionJob.work(e)||(this._selectionJobCompleted=!0,(e=Math.max(0,e-(performance.now()-i)))===0))return!1}if(this._collisionJob||(this._collisionJob=this._createCollisionJob(this._selectionJob.sortedSymbols,this._screenWidth,this._screenHeight)),!this._collisionJobCompleted){const i=performance.now();if(!this._collisionJob.work(e)||(this._collisionJobCompleted=!0,(e=Math.max(0,e-(performance.now()-i)))===0))return!1}if(this._opacityJob||(this._opacityJob=this._createOpacityJob()),!this._opacityJobCompleted){const i=performance.now();if(!this._opacityJob.work(e)||(this._opacityJobCompleted=!0,(e=Math.max(0,e-(performance.now()-i)))===0))return!1}return this._running=!1,!0}_createSelectionJob(){const e=this._symbolRepository.uniqueSymbols;for(let r=0;rr)return!1;let g=null,m=!1,_=!1;for(const p of l.tileSymbols)if(!_||!m){const y=p.tile;(!g||y.isCoverage||y.neededForCoverage&&!m)&&(g=p,(y.neededForCoverage||y.isCoverage)&&(_=!0),y.isCoverage&&(m=!0))}if(g.selectedForRendering=!0,_){c.symbols.push(g),l.show=!0;for(const p of l.parts)p.show=!0}else l.show=!1}}for(const d of i)d.symbols.sort(At);return!0}const a=this._symbolLayerSorter;return{work:o,get sortedSymbols(){return i.sort(a)}}}_createOpacityJob(){const e=this._assignTileSymbolsOpacity,i=this._visibleTiles;let t=0;function n(s,o){const a=s.symbols;for(const[r,l]of a)kt(l,o);e(s,o);for(const r of s.childrenTiles)n(r,o)}return{work(s){const o=performance.now();for(;ts)return!1;const a=i[t];a.parentTile==null&&n(a,performance.now())}return!0}}}};function kt(u,e){for(const i of u){const t=i.unique;for(const n of t.parts){const s=n.targetOpacity>.5?1:-1;n.startOpacity+=s*((e-n.startTime)/ce),n.startOpacity=Math.min(Math.max(n.startOpacity,0),1),n.startTime=e,n.targetOpacity=t.show&&n.show?1:0}}}const Ot=32,Nt=8,$t=64;let Vt=class{constructor(e,i,t){this.tileCoordRange=e,this._visibleTiles=i,this._createUnique=t,this._tiles=new Map,this._uniqueSymbolsReferences=new Map}get uniqueSymbols(){return this._uniqueSymbolLayerArray==null&&(this._uniqueSymbolLayerArray=this._createUniqueSymbolLayerArray()),this._uniqueSymbolLayerArray}add(e,i){this._uniqueSymbolLayerArray=null;let t=this._tiles.get(e.id);t||(t={symbols:new Map},this._tiles.set(e.id,t));const n=new Map;if(i)for(const a of i)t.symbols.has(a)&&(n.set(a,t.symbols.get(a)),t.symbols.delete(a));else for(const[a,r]of e.layerData)t.symbols.has(a)&&(n.set(a,t.symbols.get(a)),t.symbols.delete(a));this._removeSymbols(n);const s=e.symbols,o=new Map;for(const[a,r]of s){let l=r.length;if(l>=Ot){let h=this.tileCoordRange;do h/=2,l/=4;while(l>Nt&&h>$t);const d=new ke(this.tileCoordRange,this.tileCoordRange,h);o.set(a,{flat:r,index:d}),t.symbols.set(a,{flat:r,index:d});for(const f of r)d.getCell(f.xTile,f.yTile).push(f)}else o.set(a,{flat:r}),t.symbols.set(a,{flat:r})}this._addSymbols(e.key,s)}deleteStyleLayers(e){this._uniqueSymbolLayerArray=null;for(const[i,t]of this._tiles){const n=new Map;for(const s of e)t.symbols.has(s)&&(n.set(s,t.symbols.get(s)),t.symbols.delete(s));this._removeSymbols(n),t.symbols.size===0&&this._tiles.delete(i)}}removeTile(e){this._uniqueSymbolLayerArray=null;const i=this._tiles.get(e.id);if(!i)return;const t=new Map;for(const[n,s]of e.symbols)i.symbols.has(n)&&(t.set(n,i.symbols.get(n)),i.symbols.delete(n));this._removeSymbols(t),i.symbols.size===0&&this._tiles.delete(e.id)}_removeSymbols(e){for(const[i,{flat:t}]of e)for(const n of t){const s=n.unique,o=s.tileSymbols,a=o.length-1;for(let r=0;ri.level){const s=e.key.level-i.level;if(e.key.row>>s!==i.row||e.key.col>>s!==i.col)return}if(i.level>e.key.level){const s=i.level-e.key.level;if(i.row>>s!==e.key.row||i.col>>s!==e.key.col)return}if(i.equals(e.key)){for(const s of e.childrenTiles)this._matchSymbols(s,i,t);return}const n=new Map;for(const[s,o]of t){const a=[];for(const d of o){const f=de(this.tileCoordRange,d.xTile,i.level,i.col,e.key.level,e.key.col),c=de(this.tileCoordRange,d.yTile,i.level,i.row,e.key.level,e.key.row);f>=0&&f=0&&c0&&n.set(s,r)}for(const s of e.childrenTiles)this._matchSymbols(s,i,n)}_createUniqueSymbolLayerArray(){const e=this._uniqueSymbolsReferences,i=new Array(e.size);let t,n=0;for(const[s,o]of e){const a=new Array(o.size);t=0;for(const r of o)a[t++]=r;i[n]={styleLayerUID:s,uniqueSymbols:a},n++}return i}};function Ft(u){const e=[],i=new Vt(4096,e,()=>{const n=new Ze;return n.show=!1,n.parts.push({startTime:0,startOpacity:0,targetOpacity:0,show:!1}),n.parts.push({startTime:0,startOpacity:0,targetOpacity:0,show:!1}),n}),t=new zt(e,i,(n,s,o)=>new Ut(n,s,o,u.styleRepository,u.key.level,0),(n,s)=>{Qe(n,s,!1)},()=>0,n=>{const s=u.styleRepository.getStyleLayerByUID(n).getLayoutProperty("visibility");return!s||s.getValue()!==ae.NONE});e.push(u),i.add(u),t.setScreenSize(512,512),t.continue(1/0)}let qt=class extends et{constructor(){super(...arguments),this._fullCacheLodInfos=null,this._levelByScale={}}getTileParentId(e){const i=ee.pool.acquire(e),t=i.level===0?null:ee.getId(i.level-1,i.row>>1,i.col>>1,i.world);return ee.pool.release(i),t}getTileCoverage(e,i,t=!0,n){const s=super.getTileCoverage(e,i,t,n);if(!s)return s;const o=1<a.row>=0&&a.rowi[0].scale)return i[0].level;let t,n;for(let s=0;sn.scale)return t=i[s],t.level+(t.scale-e)/(t.scale-n.scale);return i[i.length-1].level}}_initializeFullCacheLODs(e){let i;if(e[0].level===0)i=e.map(t=>({level:t.level,resolution:t.resolution,scale:t.scale}));else{const t=this.tileInfo.size[0],n=this.tileInfo.spatialReference;i=tt.create({size:t,spatialReference:n}).lods.map(s=>({level:s.level,resolution:s.resolution,scale:s.scale}))}for(let t=0;te.abort()),this._ongoingRequestToController.clear(),this._ongoingTileRequests.clear()}async getVectorTile(e,i,t,n){const s=new ee(e,i,t,0);let o=this._memCache.get(s.id);if(o!=null)return o.retain(),o;const a=await this._getVectorTileData(s);if(it(n),!this._layer)return null;if(o=this._memCache.get(s.id),o!=null)return o.retain(),o;const r=this._layer.tileInfo.getTileBounds(nt(),s),l=this._tileInfoView.getTileResolution(e);return o=new st(s,l,r[0],r[3],512,512,this._styleRepository,this._memCache),a?(o.setData(a),o.retain(),this._memCache.put(s.id,o,o.memoryUsed,ot)):o.setData(null),o.neededForCoverage=!0,o.transforms.tileUnitsToPixels=at(1/8,0,0,0,1/8,0,0,0,1),Ft(o),o}_getVectorTileData(e){const i=e.id;if(this._ongoingTileRequests.has(i))return this._ongoingTileRequests.get(i);const t=new AbortController,n={signal:t.signal},s=this._getParsedVectorTileData(e,n).then(o=>(this._ongoingTileRequests.delete(i),this._ongoingRequestToController.delete(i),o)).catch(()=>(this._ongoingTileRequests.delete(i),this._ongoingRequestToController.delete(i),null));return this._ongoingTileRequests.set(i,s),this._ongoingRequestToController.set(i,t),s}_getParsedVectorTileData(e,i){return this.fetchTileData(e,i).then(t=>this.parseTileData({key:e,data:t},i))}},se=class{constructor(){this.name=this.constructor.name||"UnnamedBrush",this.brushEffect=null}prepareState(e,i){}draw(e,i,t){}drawMany(e,i,t){for(const n of i)n.visible&&this.draw(e,n,t)}},Ht=class extends se{constructor(){super(...arguments),this._color=bt(1,0,0,1),this._patternMatrix=rt(),this._programOptions={id:!1,pattern:!1}}dispose(){this._vao&&(this._vao.dispose(),this._vao=null)}drawMany(e,i){const{context:t,painter:n,styleLayerUID:s,requestRender:o,allowDelayedRender:a}=e;this._loadWGLResources(e);const r=e.displayLevel,l=e.styleLayer,h=l.backgroundMaterial,d=n.vectorTilesMaterialManager,f=l.getPaintValue("background-color",r),c=l.getPaintValue("background-opacity",r),g=l.getPaintValue("background-pattern",r),m=g!==void 0,_=f[3]*c,p=1|window.devicePixelRatio,y=e.spriteMosaic;let P,I;const x=p>Ne?2:1,b=e.drawPhase===W.HITTEST,w=this._programOptions;w.id=b,w.pattern=m;const v=d.getMaterialProgram(t,h,w);if(!a||o==null||v.compiled){if(t.bindVAO(this._vao),t.useProgram(v),m){const S=y.getMosaicItemPosition(g,!0);if(S!=null){const{tl:M,br:T,page:D}=S;P=T[0]-M[0],I=T[1]-M[1];const R=y.getPageSize(D);R!=null&&(y.bind(t,j.LINEAR,D,k),v.setUniform4f("u_tlbr",M[0],M[1],T[0],T[1]),v.setUniform2fv("u_mosaicSize",R),v.setUniform1i("u_texture",k))}v.setUniform1f("u_opacity",c)}else this._color[0]=_*f[0],this._color[1]=_*f[1],this._color[2]=_*f[2],this._color[3]=_,v.setUniform4fv("u_color",this._color);if(v.setUniform1f("u_depth",l.z||0),b){const S=ne(s+1);v.setUniform4fv("u_id",S)}for(const S of i){if(v.setUniform1f("u_coord_range",S.rangeX),v.setUniformMatrix3fv("u_dvsMat3",S.transforms.dvs),m){const M=Math.max(2**(Math.round(r)-S.key.level),1),T=x*S.width*M,D=T/fe(P),R=T/fe(I);this._patternMatrix[0]=D,this._patternMatrix[4]=R,v.setUniformMatrix3fv("u_pattern_matrix",this._patternMatrix)}t.setStencilFunction(V.EQUAL,0,255),t.drawArrays(F.TRIANGLE_STRIP,0,4)}}else o()}_loadWGLResources(e){if(this._vao)return;const{context:i,styleLayer:t}=e,n=t.backgroundMaterial,s=new Int8Array([0,0,1,0,0,1,1,1]),o=lt.createVertex(i,ct.STATIC_DRAW,s),a=new ut(i,n.getAttributeLocations(),n.getLayoutInfo(),{geometry:o});this._vao=a}},Wt=class extends se{constructor(){super(...arguments),this._programOptions={id:!1}}dispose(){}drawMany(e,i){const{context:t,displayLevel:n,requiredLevel:s,state:o,drawPhase:a,painter:r,spriteMosaic:l,styleLayerUID:h,requestRender:d,allowDelayedRender:f}=e;if(!i.some(w=>{var v;return((v=w.layerData.get(h))==null?void 0:v.circleIndexCount)??!1}))return;const c=e.styleLayer,g=c.circleMaterial,m=r.vectorTilesMaterialManager,_=1.2,p=c.getPaintValue("circle-translate",n),y=c.getPaintValue("circle-translate-anchor",n),P=a===W.HITTEST,I=this._programOptions;I.id=P;const x=m.getMaterialProgram(t,g,I);if(f&&d!=null&&!x.compiled)return void d();t.useProgram(x),x.setUniformMatrix3fv("u_displayMat3",y===Y.VIEWPORT?o.displayMat3:o.displayViewMat3),x.setUniform2fv("u_circleTranslation",p),x.setUniform1f("u_depth",c.z),x.setUniform1f("u_antialiasingWidth",_);let b=-1;if(P){const w=ne(h+1);x.setUniform4fv("u_id",w)}for(const w of i){if(!w.layerData.has(h))continue;w.key.level!==b&&(b=w.key.level,g.setDataUniforms(x,n,c,b,l));const v=w.layerData.get(h);if(!v.circleIndexCount)continue;v.prepareForRendering(t);const S=v.vao;S!=null&&(t.bindVAO(S),x.setUniformMatrix3fv("u_dvsMat3",w.transforms.dvs),s!==w.key.level?t.setStencilFunction(V.EQUAL,w.stencilRef,255):t.setStencilFunction(V.GREATER,255,255),t.drawElements(F.TRIANGLES,v.circleIndexCount,H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*v.circleIndexStart),w.triangleCount+=v.circleIndexCount/3)}}};const Se=1/65536;let Bt=class extends se{constructor(){super(...arguments),this._fillProgramOptions={id:!1,pattern:!1},this._outlineProgramOptions={id:!1}}dispose(){}drawMany(e,i){const{displayLevel:t,drawPhase:n,renderPass:s,spriteMosaic:o,styleLayerUID:a}=e;let r=!1;for(const x of i)if(x.layerData.has(a)){const b=x.layerData.get(a);if(b.fillIndexCount>0||b.outlineIndexCount>0){r=!0;break}}if(!r)return;const l=e.styleLayer,h=l.getPaintProperty("fill-pattern"),d=h!==void 0,f=d&&h.isDataDriven;let c;if(d&&!f){const x=h.getValue(t);c=o.getMosaicItemPosition(x,!0)}const g=!d&&l.getPaintValue("fill-antialias",t);let m=!0,_=1;if(!d){const x=l.getPaintProperty("fill-color"),b=l.getPaintProperty("fill-opacity");if(!(x!=null&&x.isDataDriven)&&!(b!=null&&b.isDataDriven)){const w=l.getPaintValue("fill-color",t);_=l.getPaintValue("fill-opacity",t)*w[3],_>=1&&(m=!1)}}if(m&&s==="opaque")return;let p;n===W.HITTEST&&(p=ne(a+1));const y=l.getPaintValue("fill-translate",t),P=l.getPaintValue("fill-translate-anchor",t);(m||s!=="translucent")&&this._drawFill(e,a,l,i,y,P,d,c,f,p);const I=!l.hasDataDrivenOutlineColor&&l.outlineUsesFillColor&&_<1;g&&s!=="opaque"&&!I&&this._drawOutline(e,a,l,i,y,P,p)}_drawFill(e,i,t,n,s,o,a,r,l,h){if(a&&!l&&r==null)return;const{context:d,displayLevel:f,state:c,drawPhase:g,painter:m,pixelRatio:_,spriteMosaic:p,requestRender:y,allowDelayedRender:P}=e,I=t.fillMaterial,x=m.vectorTilesMaterialManager,b=_>Ne?2:1,w=g===W.HITTEST,v=this._fillProgramOptions;v.id=w,v.pattern=a;const S=x.getMaterialProgram(d,I,v);if(P&&y!=null&&!S.compiled)return void y();if(d.useProgram(S),r!=null){const{page:T}=r,D=p.getPageSize(T);D!=null&&(p.bind(d,j.LINEAR,T,k),S.setUniform2fv("u_mosaicSize",D),S.setUniform1i("u_texture",k))}S.setUniformMatrix3fv("u_displayMat3",o===Y.VIEWPORT?c.displayMat3:c.displayViewMat3),S.setUniform2fv("u_fillTranslation",s),S.setUniform1f("u_depth",t.z+Se),w&&S.setUniform4fv("u_id",h);let M=-1;for(const T of n){if(!T.layerData.has(i))continue;T.key.level!==M&&(M=T.key.level,I.setDataUniforms(S,f,t,M,p));const D=T.layerData.get(i);if(!D.fillIndexCount)continue;D.prepareForRendering(d);const R=D.fillVAO;if(R!=null){if(d.bindVAO(R),S.setUniformMatrix3fv("u_dvsMat3",T.transforms.dvs),d.setStencilFunction(V.EQUAL,T.stencilRef,255),a){const E=Math.max(2**(Math.round(f)-T.key.level),1),L=T.rangeX/(b*T.width*E);S.setUniform1f("u_patternFactor",L)}if(l){const E=D.patternMap;if(!E)continue;for(const[L,G]of E){const J=p.getPageSize(L);J!=null&&(p.bind(d,j.LINEAR,L,k),S.setUniform2fv("u_mosaicSize",J),S.setUniform1i("u_texture",k),d.drawElements(F.TRIANGLES,G[1],H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*G[0]))}}else d.drawElements(F.TRIANGLES,D.fillIndexCount,H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*D.fillIndexStart);T.triangleCount+=D.fillIndexCount/3}}}_drawOutline(e,i,t,n,s,o,a){const{context:r,displayLevel:l,state:h,drawPhase:d,painter:f,pixelRatio:c,spriteMosaic:g,requestRender:m,allowDelayedRender:_}=e,p=t.outlineMaterial,y=f.vectorTilesMaterialManager,P=.75/c,I=d===W.HITTEST,x=this._outlineProgramOptions;x.id=I;const b=y.getMaterialProgram(r,p,x);if(_&&m!=null&&!b.compiled)return void m();r.useProgram(b),b.setUniformMatrix3fv("u_displayMat3",o===Y.VIEWPORT?h.displayMat3:h.displayViewMat3),b.setUniform2fv("u_fillTranslation",s),b.setUniform1f("u_depth",t.z+Se),b.setUniform1f("u_outline_width",P),I&&b.setUniform4fv("u_id",a);let w=-1;for(const v of n){if(!v.layerData.has(i))continue;v.key.level!==w&&(w=v.key.level,p.setDataUniforms(b,l,t,w,g));const S=v.layerData.get(i);if(S.prepareForRendering(r),!S.outlineIndexCount)continue;const M=S.outlineVAO;M!=null&&(r.bindVAO(M),b.setUniformMatrix3fv("u_dvsMat3",v.transforms.dvs),r.setStencilFunction(V.EQUAL,v.stencilRef,255),r.drawElements(F.TRIANGLES,S.outlineIndexCount,H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*S.outlineIndexStart),v.triangleCount+=S.outlineIndexCount/3)}}},Gt=class extends se{constructor(){super(...arguments),this._programOptions={id:!1,pattern:!1,sdf:!1}}dispose(){}drawMany(e,i){const{context:t,displayLevel:n,state:s,drawPhase:o,painter:a,pixelRatio:r,spriteMosaic:l,styleLayerUID:h,requestRender:d,allowDelayedRender:f}=e;if(!i.some(R=>{var E;return((E=R.layerData.get(h))==null?void 0:E.lineIndexCount)??!1}))return;const c=e.styleLayer,g=c.lineMaterial,m=a.vectorTilesMaterialManager,_=c.getPaintValue("line-translate",n),p=c.getPaintValue("line-translate-anchor",n),y=c.getPaintProperty("line-pattern"),P=y!==void 0,I=P&&y.isDataDriven;let x,b;if(P&&!I){const R=y.getValue(n);x=l.getMosaicItemPosition(R)}let w=!1;if(!P){const R=c.getPaintProperty("line-dasharray");if(b=R!==void 0,w=b&&R.isDataDriven,b&&!w){const E=R.getValue(n),L=c.getDashKey(E,c.getLayoutValue("line-cap",n));x=l.getMosaicItemPosition(L)}}const v=1/r,S=o===W.HITTEST,M=this._programOptions;M.id=S,M.pattern=P,M.sdf=b;const T=m.getMaterialProgram(t,g,M);if(f&&d!=null&&!T.compiled)return void d();if(t.useProgram(T),T.setUniformMatrix3fv("u_displayViewMat3",s.displayViewMat3),T.setUniformMatrix3fv("u_displayMat3",p===Y.VIEWPORT?s.displayMat3:s.displayViewMat3),T.setUniform2fv("u_lineTranslation",_),T.setUniform1f("u_depth",c.z),T.setUniform1f("u_antialiasing",v),S){const R=ne(h+1);T.setUniform4fv("u_id",R)}if(x&&x!=null){const{page:R}=x,E=l.getPageSize(R);E!=null&&(l.bind(t,j.LINEAR,R,k),T.setUniform2fv("u_mosaicSize",E),T.setUniform1i("u_texture",k))}let D=-1;for(const R of i){if(!R.layerData.has(h))continue;R.key.level!==D&&(D=R.key.level,g.setDataUniforms(T,n,c,D,l));const E=2**(n-D)/r;T.setUniform1f("u_zoomFactor",E);const L=R.layerData.get(h);if(!L.lineIndexCount)continue;L.prepareForRendering(t);const G=L.vao;if(G!=null){if(t.bindVAO(G),T.setUniformMatrix3fv("u_dvsMat3",R.transforms.dvs),t.setStencilFunction(V.EQUAL,R.stencilRef,255),I||w){const J=L.patternMap;if(!J)continue;for(const[te,C]of J){const Q=l.getPageSize(te);Q!=null&&(l.bind(t,j.LINEAR,te,k),T.setUniform2fv("u_mosaicSize",Q),T.setUniform1i("u_texture",k),t.drawElements(F.TRIANGLES,C[1],H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*C[0]))}}else t.drawElements(F.TRIANGLES,L.lineIndexCount,H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*L.lineIndexStart);R.triangleCount+=L.lineIndexCount/3}}}};const Jt=1/65536;class Kt extends se{constructor(){super(...arguments),this._iconProgramOptions={id:!1,sdf:!1},this._sdfProgramOptions={id:!1},this._spritesTextureSize=ht()}dispose(){}drawMany(e,i){const{drawPhase:t,styleLayerUID:n}=e,s=e.styleLayer;let o;t===W.HITTEST&&(o=ne(n+1)),this._drawIcons(e,s,i,o),this._drawText(e,s,i,o)}_drawIcons(e,i,t,n){const{context:s,displayLevel:o,drawPhase:a,painter:r,spriteMosaic:l,state:h,styleLayerUID:d,requestRender:f,allowDelayedRender:c}=e,g=i.iconMaterial,m=r.vectorTilesMaterialManager;let _,p=!1;for(const D of t)if(D.layerData.has(d)&&(_=D.layerData.get(d),_.iconPerPageElementsMap.size>0)){p=!0;break}if(!p)return;const y=i.getPaintValue("icon-translate",o),P=i.getPaintValue("icon-translate-anchor",o);let I=i.getLayoutValue("icon-rotation-alignment",o);I===U.AUTO&&(I=i.getLayoutValue("symbol-placement",o)===le.POINT?U.VIEWPORT:U.MAP);const x=I===U.MAP,b=i.getLayoutValue("icon-keep-upright",o)&&x,w=_.isIconSDF,v=a===W.HITTEST,S=this._iconProgramOptions;S.id=v,S.sdf=w;const M=m.getMaterialProgram(s,g,S);if(c&&f!=null&&!M.compiled)return void f();s.useProgram(M),M.setUniformMatrix3fv("u_displayViewMat3",I===U.MAP?h.displayViewMat3:h.displayMat3),M.setUniformMatrix3fv("u_displayMat3",P===Y.VIEWPORT?h.displayMat3:h.displayViewMat3),M.setUniform2fv("u_iconTranslation",y),M.setUniform1f("u_depth",i.z),M.setUniform1f("u_mapRotation",ge(h.rotation)),M.setUniform1f("u_keepUpright",b?1:0),M.setUniform1f("u_level",10*o),M.setUniform1i("u_texture",k),M.setUniform1f("u_fadeDuration",ce/1e3),v&&M.setUniform4fv("u_id",n);let T=-1;for(const D of t){if(!D.layerData.has(d)||(D.key.level!==T&&(T=D.key.level,g.setDataUniforms(M,o,i,T,l)),_=D.layerData.get(d),_.iconPerPageElementsMap.size===0))continue;_.prepareForRendering(s),_.updateOpacityInfo();const R=_.iconVAO;if(R!=null){s.bindVAO(R),M.setUniformMatrix3fv("u_dvsMat3",D.transforms.dvs),M.setUniform1f("u_time",(performance.now()-_.lastOpacityUpdate)/1e3);for(const[E,L]of _.iconPerPageElementsMap)this._renderIconRange(e,M,L,E,D)}}}_renderIconRange(e,i,t,n,s){const{context:o,spriteMosaic:a}=e;this._spritesTextureSize[0]=a.getWidth(n)/4,this._spritesTextureSize[1]=a.getHeight(n)/4,i.setUniform2fv("u_mosaicSize",this._spritesTextureSize),a.bind(o,j.LINEAR,n,k),this._setStencilState(e,s),o.drawElements(F.TRIANGLES,t[1],H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*t[0]),s.triangleCount+=t[1]/3}_drawText(e,i,t,n){const{context:s,displayLevel:o,drawPhase:a,glyphMosaic:r,painter:l,pixelRatio:h,spriteMosaic:d,state:f,styleLayerUID:c,requestRender:g,allowDelayedRender:m}=e,_=i.textMaterial,p=l.vectorTilesMaterialManager;let y,P=!1;for(const N of t)if(N.layerData.has(c)&&(y=N.layerData.get(c),y.glyphPerPageElementsMap.size>0)){P=!0;break}if(!P)return;const I=i.getPaintProperty("text-opacity");if(I&&!I.isDataDriven&&I.getValue(o)===0)return;const x=i.getPaintProperty("text-color"),b=!x||x.isDataDriven||x.getValue(o)[3]>0,w=i.getPaintProperty("text-halo-width"),v=i.getPaintProperty("text-halo-color"),S=(!w||w.isDataDriven||w.getValue(o)>0)&&(!v||v.isDataDriven||v.getValue(o)[3]>0);if(!b&&!S)return;const M=24/8;let T=i.getLayoutValue("text-rotation-alignment",o);T===U.AUTO&&(T=i.getLayoutValue("symbol-placement",o)===le.POINT?U.VIEWPORT:U.MAP);const D=T===U.MAP,R=i.getLayoutValue("text-keep-upright",o)&&D,E=a===W.HITTEST,L=.8*M/h;this._glyphTextureSize||(this._glyphTextureSize=dt(r.width/4,r.height/4));const G=i.getPaintValue("text-translate",o),J=i.getPaintValue("text-translate-anchor",o),te=this._sdfProgramOptions;te.id=E;const C=p.getMaterialProgram(s,_,te);if(m&&g!=null&&!C.compiled)return void g();s.useProgram(C),C.setUniformMatrix3fv("u_displayViewMat3",T===U.MAP?f.displayViewMat3:f.displayMat3),C.setUniformMatrix3fv("u_displayMat3",J===Y.VIEWPORT?f.displayMat3:f.displayViewMat3),C.setUniform2fv("u_textTranslation",G),C.setUniform1f("u_depth",i.z+Jt),C.setUniform2fv("u_mosaicSize",this._glyphTextureSize),C.setUniform1f("u_mapRotation",ge(f.rotation)),C.setUniform1f("u_keepUpright",R?1:0),C.setUniform1f("u_level",10*o),C.setUniform1i("u_texture",pe),C.setUniform1f("u_antialiasingWidth",L),C.setUniform1f("u_fadeDuration",ce/1e3),E&&C.setUniform4fv("u_id",n);let Q=-1;for(const N of t){if(!N.layerData.has(c)||(N.key.level!==Q&&(Q=N.key.level,_.setDataUniforms(C,o,i,Q,d)),y=N.layerData.get(c),y.glyphPerPageElementsMap.size===0))continue;y.prepareForRendering(s),y.updateOpacityInfo();const ue=y.textVAO;if(ue==null)continue;s.bindVAO(ue),C.setUniformMatrix3fv("u_dvsMat3",N.transforms.dvs),this._setStencilState(e,N);const Ve=(performance.now()-y.lastOpacityUpdate)/1e3;C.setUniform1f("u_time",Ve),y.glyphPerPageElementsMap.forEach((Fe,qe)=>{this._renderGlyphRange(s,Fe,qe,r,C,S,b,N)})}}_renderGlyphRange(e,i,t,n,s,o,a,r){n.bind(e,j.LINEAR,t,pe),o&&(s.setUniform1f("u_halo",1),e.drawElements(F.TRIANGLES,i[1],H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*i[0]),r.triangleCount+=i[1]/3),a&&(s.setUniform1f("u_halo",0),e.drawElements(F.TRIANGLES,i[1],H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*i[0]),r.triangleCount+=i[1]/3)}_setStencilState(e,i){const{context:t,is3D:n,stencilSymbols:s}=e;if(t.setStencilTestEnabled(!0),s)return t.setStencilWriteMask(255),void t.setStencilFunction(V.ALWAYS,i.stencilRef,255);t.setStencilWriteMask(0),n?t.setStencilFunction(V.EQUAL,i.stencilRef,255):t.setStencilFunction(V.GREATER,255,255)}}const Yt={vtlBackground:Ht,vtlFill:Bt,vtlLine:Gt,vtlCircle:Wt,vtlSymbol:Kt},jt={background:{"background.frag":`#ifdef PATTERN +uniform lowp float u_opacity; +uniform lowp sampler2D u_texture; +varying mediump vec4 v_tlbr; +varying mediump vec2 v_tileTextureCoord; +#else +uniform lowp vec4 u_color; +#endif +#ifdef ID +varying mediump vec4 v_id; +#endif +void main() { +#ifdef PATTERN +mediump vec2 normalizedTextureCoord = mod(v_tileTextureCoord, 1.0); +mediump vec2 samplePos = mix(v_tlbr.xy, v_tlbr.zw, normalizedTextureCoord); +lowp vec4 color = texture2D(u_texture, samplePos); +gl_FragColor = u_opacity * color; +#else +gl_FragColor = u_color; +#endif +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`,"background.vert":`precision mediump float; +attribute vec2 a_pos; +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +uniform highp mat3 u_dvsMat3; +uniform mediump float u_coord_range; +uniform mediump float u_depth; +#ifdef PATTERN +uniform mediump mat3 u_pattern_matrix; +varying mediump vec2 v_tileTextureCoord; +uniform mediump vec4 u_tlbr; +uniform mediump vec2 u_mosaicSize; +varying mediump vec4 v_tlbr; +#endif +void main() { +gl_Position = vec4((u_dvsMat3 * vec3(u_coord_range * a_pos, 1.0)).xy, u_depth, 1.0); +#ifdef PATTERN +v_tileTextureCoord = (u_pattern_matrix * vec3(a_pos, 1.0)).xy; +v_tlbr = u_tlbr / u_mosaicSize.xyxy; +#endif +#ifdef ID +v_id = u_id / 255.0; +#endif +}`},circle:{"circle.frag":`precision lowp float; +varying lowp vec4 v_color; +varying lowp vec4 v_stroke_color; +varying mediump float v_blur; +varying mediump float v_stroke_width; +varying mediump float v_radius; +varying mediump vec2 v_offset; +#ifdef ID +varying mediump vec4 v_id; +#endif +void main() +{ +mediump float dist = length(v_offset); +mediump float alpha = smoothstep(0.0, -v_blur, dist - 1.0); +lowp float color_mix_ratio = v_stroke_width < 0.01 ? 0.0 : smoothstep(-v_blur, 0.0, dist - v_radius / (v_radius + v_stroke_width)); +gl_FragColor = alpha * mix(v_color, v_stroke_color, color_mix_ratio); +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`,"circle.vert":`precision mediump float; +attribute vec2 a_pos; +#pragma header +varying lowp vec4 v_color; +varying lowp vec4 v_stroke_color; +varying mediump float v_blur; +varying mediump float v_stroke_width; +varying mediump float v_radius; +varying mediump vec2 v_offset; +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform mediump vec2 u_circleTranslation; +uniform mediump float u_depth; +uniform mediump float u_antialiasingWidth; +void main() +{ +#pragma main +v_color = color * opacity; +v_stroke_color = stroke_color * stroke_opacity; +v_stroke_width = stroke_width; +v_radius = radius; +v_blur = max(blur, u_antialiasingWidth / (radius + stroke_width)); +mediump vec2 offset = vec2(mod(a_pos, 2.0) * 2.0 - 1.0); +v_offset = offset; +#ifdef ID +v_id = u_id / 255.0; +#endif +mediump vec3 pos = u_dvsMat3 * vec3(a_pos * 0.5, 1.0) + u_displayMat3 * vec3((v_radius + v_stroke_width) * offset + u_circleTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth, 1.0); +}`},fill:{"fill.frag":`precision lowp float; +#ifdef PATTERN +uniform lowp sampler2D u_texture; +varying mediump vec2 v_tileTextureCoord; +varying mediump vec4 v_tlbr; +#endif +#ifdef ID +varying mediump vec4 v_id; +#endif +varying lowp vec4 v_color; +vec4 mixColors(vec4 color1, vec4 color2) { +float compositeAlpha = color2.a + color1.a * (1.0 - color2.a); +vec3 compositeColor = color2.rgb + color1.rgb * (1.0 - color2.a); +return vec4(compositeColor, compositeAlpha); +} +void main() +{ +#ifdef PATTERN +mediump vec2 normalizedTextureCoord = fract(v_tileTextureCoord); +mediump vec2 samplePos = mix(v_tlbr.xy, v_tlbr.zw, normalizedTextureCoord); +lowp vec4 color = texture2D(u_texture, samplePos); +gl_FragColor = v_color[3] * color; +#else +gl_FragColor = v_color; +#endif +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`,"fill.vert":`precision mediump float; +attribute vec2 a_pos; +#pragma header +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform mediump float u_depth; +uniform mediump vec2 u_fillTranslation; +#ifdef PATTERN +#include +uniform mediump vec2 u_mosaicSize; +uniform mediump float u_patternFactor; +varying mediump vec2 v_tileTextureCoord; +varying mediump vec4 v_tlbr; +#endif +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +varying lowp vec4 v_color; +void main() +{ +#pragma main +v_color = color * opacity; +#ifdef ID +v_id = u_id / 255.0; +#endif +#ifdef PATTERN +float patternWidth = nextPOT(tlbr.z - tlbr.x); +float patternHeight = nextPOT(tlbr.w - tlbr.y); +float scaleX = 1.0 / (patternWidth * u_patternFactor); +float scaleY = 1.0 / (patternHeight * u_patternFactor); +mat3 patterMat = mat3(scaleX, 0.0, 0.0, +0.0, -scaleY, 0.0, +0.0, 0.0, 1.0); +v_tileTextureCoord = (patterMat * vec3(a_pos, 1.0)).xy; +v_tlbr = tlbr / u_mosaicSize.xyxy; +#endif +vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + u_displayMat3 * vec3(u_fillTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth, 1.0); +}`},icon:{"icon.frag":`precision mediump float; +uniform lowp sampler2D u_texture; +#ifdef SDF +uniform lowp vec4 u_color; +uniform lowp vec4 u_outlineColor; +#endif +varying mediump vec2 v_tex; +varying lowp float v_opacity; +varying mediump vec2 v_size; +varying lowp vec4 v_color; +#ifdef SDF +varying mediump flaot v_halo_width; +#endif +#ifdef ID +varying mediump vec4 v_id; +#endif +#include +vec4 mixColors(vec4 color1, vec4 color2) { +float compositeAlpha = color2.a + color1.a * (1.0 - color2.a); +vec3 compositeColor = color2.rgb + color1.rgb * (1.0 - color2.a); +return vec4(compositeColor, compositeAlpha); +} +void main() +{ +#ifdef SDF +lowp vec4 fillPixelColor = v_color; +float d = rgba2float(texture2D(u_texture, v_tex)) - 0.5; +const float softEdgeRatio = 0.248062016; +float size = max(v_size.x, v_size.y); +float dist = d * softEdgeRatio * size; +fillPixelColor *= clamp(0.5 - dist, 0.0, 1.0); +if (v_halo_width > 0.25) { +lowp vec4 outlinePixelColor = u_outlineColor; +const float outlineLimitRatio = (16.0 / 86.0); +float clampedOutlineSize = softEdgeRatio * min(v_halo_width, outlineLimitRatio * max(v_size.x, v_size.y)); +outlinePixelColor *= clamp(0.5 - (abs(dist) - clampedOutlineSize), 0.0, 1.0); +gl_FragColor = v_opacity * mixColors(fillPixelColor, outlinePixelColor); +} +else { +gl_FragColor = v_opacity * fillPixelColor; +} +#else +lowp vec4 texColor = texture2D(u_texture, v_tex); +gl_FragColor = v_opacity * texColor; +#endif +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`,"icon.vert":`attribute vec2 a_pos; +attribute vec2 a_vertexOffset; +attribute vec4 a_texAngleRange; +attribute vec4 a_levelInfo; +attribute float a_opacityInfo; +#pragma header +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +varying lowp vec4 v_color; +#ifdef SDF +varying mediump float v_halo_width; +#endif +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform highp mat3 u_displayViewMat3; +uniform mediump vec2 u_iconTranslation; +uniform vec2 u_mosaicSize; +uniform mediump float u_depth; +uniform mediump float u_mapRotation; +uniform mediump float u_level; +uniform lowp float u_keepUpright; +uniform mediump float u_fadeDuration; +varying mediump vec2 v_tex; +varying lowp float v_opacity; +varying mediump vec2 v_size; +const float C_OFFSET_PRECISION = 1.0 / 8.0; +const float C_256_TO_RAD = 3.14159265359 / 128.0; +const float C_DEG_TO_RAD = 3.14159265359 / 180.0; +const float tileCoordRatio = 1.0 / 8.0; +uniform highp float u_time; +void main() +{ +#pragma main +v_color = color; +v_opacity = opacity; +#ifdef SDF +v_halo_width = halo_width; +#endif +float modded = mod(a_opacityInfo, 128.0); +float targetOpacity = (a_opacityInfo - modded) / 128.0; +float startOpacity = modded / 127.0; +float interpolatedOpacity = clamp(startOpacity + 2.0 * (targetOpacity - 0.5) * u_time / u_fadeDuration, 0.0, 1.0); +v_opacity *= interpolatedOpacity; +mediump float a_angle = a_levelInfo[1]; +mediump float a_minLevel = a_levelInfo[2]; +mediump float a_maxLevel = a_levelInfo[3]; +mediump vec2 a_tex = a_texAngleRange.xy; +mediump float delta_z = 0.0; +mediump float rotated = mod(a_angle + u_mapRotation, 256.0); +delta_z += (1.0 - step(u_keepUpright, 0.0)) * step(64.0, rotated) * (1.0 - step(192.0, rotated)); +delta_z += 1.0 - step(a_minLevel, u_level); +delta_z += step(a_maxLevel, u_level); +delta_z += step(v_opacity, 0.0); +vec2 offset = C_OFFSET_PRECISION * a_vertexOffset; +v_size = abs(offset); +#ifdef SDF +offset = (120.0 / 86.0) * offset; +#endif +mediump vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + u_displayViewMat3 * vec3(size * offset, 0.0) + u_displayMat3 * vec3(u_iconTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth + delta_z, 1.0); +#ifdef ID +v_id = u_id / 255.0; +#endif +v_tex = a_tex.xy / u_mosaicSize; +}`},line:{"line.frag":`precision lowp float; +varying mediump vec2 v_normal; +varying highp float v_accumulatedDistance; +varying mediump float v_lineHalfWidth; +varying lowp vec4 v_color; +varying mediump float v_blur; +#if defined (PATTERN) || defined(SDF) +varying mediump vec4 v_tlbr; +varying mediump vec2 v_patternSize; +varying mediump float v_widthRatio; +uniform sampler2D u_texture; +uniform mediump float u_antialiasing; +#endif +#ifdef SDF +#include +#endif +#ifdef ID +varying mediump vec4 v_id; +#endif +void main() +{ +mediump float fragDist = length(v_normal) * v_lineHalfWidth; +lowp float alpha = clamp((v_lineHalfWidth - fragDist) / v_blur, 0.0, 1.0); +#ifdef PATTERN +mediump float relativeTexX = fract(v_accumulatedDistance / (v_patternSize.x * v_widthRatio)); +mediump float relativeTexY = 0.5 + v_normal.y * v_lineHalfWidth / (v_patternSize.y * v_widthRatio); +mediump vec2 texCoord = mix(v_tlbr.xy, v_tlbr.zw, vec2(relativeTexX, relativeTexY)); +lowp vec4 color = texture2D(u_texture, texCoord); +gl_FragColor = alpha * v_color[3] * color; +#elif defined(SDF) +mediump float relativeTexX = fract((v_accumulatedDistance * 0.5) / (v_patternSize.x * v_widthRatio)); +mediump float relativeTexY = 0.5 + 0.25 * v_normal.y; +mediump vec2 texCoord = mix(v_tlbr.xy, v_tlbr.zw, vec2(relativeTexX, relativeTexY)); +mediump float d = rgba2float(texture2D(u_texture, texCoord)) - 0.5; +float dist = d * (v_lineHalfWidth + u_antialiasing / 2.0); +gl_FragColor = alpha * clamp(0.5 - dist, 0.0, 1.0) * v_color; +#else +gl_FragColor = alpha * v_color; +#endif +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`,"line.vert":`precision mediump float; +attribute vec2 a_pos; +attribute vec4 a_extrude_offset; +attribute vec4 a_dir_normal; +attribute vec2 a_accumulatedDistance; +#pragma header +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform highp mat3 u_displayViewMat3; +uniform mediump float u_zoomFactor; +uniform mediump vec2 u_lineTranslation; +uniform mediump float u_antialiasing; +uniform mediump float u_depth; +varying mediump vec2 v_normal; +varying highp float v_accumulatedDistance; +const float scale = 1.0 / 31.0; +const mediump float tileCoordRatio = 8.0; +#if defined (SDF) +const mediump float sdfPatternHalfWidth = 15.5; +#endif +#if defined (PATTERN) || defined(SDF) +uniform mediump vec2 u_mosaicSize; +varying mediump vec4 v_tlbr; +varying mediump vec2 v_patternSize; +varying mediump float v_widthRatio; +#endif +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +varying lowp vec4 v_color; +varying mediump float v_lineHalfWidth; +varying mediump float v_blur; +void main() +{ +#pragma main +v_color = color * opacity; +v_blur = blur + u_antialiasing; +v_normal = a_dir_normal.zw * scale; +#if defined (PATTERN) || defined(SDF) +v_tlbr = tlbr / u_mosaicSize.xyxy; +v_patternSize = vec2(tlbr.z - tlbr.x, tlbr.y - tlbr.w); +#if defined (PATTERN) +v_widthRatio = width / v_patternSize.y; +#else +v_widthRatio = width / sdfPatternHalfWidth / 2.0; +#endif +#endif +v_lineHalfWidth = (width + u_antialiasing) * 0.5; +mediump vec2 dir = a_dir_normal.xy * scale; +mediump vec2 offset_ = a_extrude_offset.zw * scale * offset; +mediump vec2 dist = v_lineHalfWidth * scale * a_extrude_offset.xy; +mediump vec3 pos = u_dvsMat3 * vec3(a_pos + offset_ * tileCoordRatio / u_zoomFactor, 1.0) + u_displayViewMat3 * vec3(dist, 0.0) + u_displayMat3 * vec3(u_lineTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth, 1.0); +#if defined (PATTERN) || defined(SDF) +v_accumulatedDistance = a_accumulatedDistance.x * u_zoomFactor / tileCoordRatio + dot(dir, dist + offset_); +#endif +#ifdef ID +v_id = u_id / 255.0; +#endif +}`},outline:{"outline.frag":`varying lowp vec4 v_color; +varying mediump vec2 v_normal; +#ifdef ID +varying mediump vec4 v_id; +#endif +void main() +{ +lowp float dist = abs(v_normal.y); +lowp float alpha = smoothstep(1.0, 0.0, dist); +gl_FragColor = alpha * v_color; +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`,"outline.vert":`attribute vec2 a_pos; +attribute vec2 a_offset; +attribute vec2 a_xnormal; +#pragma header +varying lowp vec4 v_color; +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform mediump vec2 u_fillTranslation; +uniform mediump float u_depth; +uniform mediump float u_outline_width; +varying lowp vec2 v_normal; +const float scale = 1.0 / 15.0; +void main() +{ +#pragma main +v_color = color * opacity; +#ifdef ID +v_id = u_id / 255.0; +#endif +v_normal = a_xnormal; +mediump vec2 dist = u_outline_width * scale * a_offset; +mediump vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + u_displayMat3 * vec3(dist + u_fillTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth, 1.0); +}`},text:{"text.frag":`uniform lowp sampler2D u_texture; +varying lowp vec2 v_tex; +varying lowp vec4 v_color; +varying mediump float v_edgeWidth; +varying mediump float v_edgeDistance; +#ifdef ID +varying mediump vec4 v_id; +#endif +void main() +{ +lowp float dist = texture2D(u_texture, v_tex).a; +mediump float alpha = smoothstep(v_edgeDistance - v_edgeWidth, v_edgeDistance + v_edgeWidth, dist); +gl_FragColor = alpha * v_color; +#ifdef ID +if (gl_FragColor.a < 1.0 / 255.0) { +discard; +} +gl_FragColor = v_id; +#endif +}`,"text.vert":`attribute vec2 a_pos; +attribute vec2 a_vertexOffset; +attribute vec4 a_texAngleRange; +attribute vec4 a_levelInfo; +attribute float a_opacityInfo; +#pragma header +varying lowp vec4 v_color; +#ifdef ID +uniform mediump vec4 u_id; +varying mediump vec4 v_id; +#endif +uniform highp mat3 u_dvsMat3; +uniform highp mat3 u_displayMat3; +uniform highp mat3 u_displayViewMat3; +uniform mediump vec2 u_textTranslation; +uniform vec2 u_mosaicSize; +uniform mediump float u_depth; +uniform mediump float u_mapRotation; +uniform mediump float u_level; +uniform lowp float u_keepUpright; +uniform mediump float u_fadeDuration; +varying lowp vec2 v_tex; +const float offsetPrecision = 1.0 / 8.0; +const mediump float edgePos = 0.75; +uniform mediump float u_antialiasingWidth; +varying mediump float v_edgeDistance; +varying mediump float v_edgeWidth; +uniform lowp float u_halo; +const float sdfFontScale = 1.0 / 24.0; +const float sdfPixel = 3.0; +uniform highp float u_time; +void main() +{ +#pragma main +if (u_halo > 0.5) +{ +v_color = halo_color * opacity; +halo_width *= sdfPixel; +halo_blur *= sdfPixel; +} +else +{ +v_color = color * opacity; +halo_width = 0.0; +halo_blur = 0.0; +} +float modded = mod(a_opacityInfo, 128.0); +float targetOpacity = (a_opacityInfo - modded) / 128.0; +float startOpacity = modded / 127.0; +float interpolatedOpacity = clamp(startOpacity + 2.0 * (targetOpacity - 0.5) * u_time / u_fadeDuration, 0.0, 1.0); +v_color *= interpolatedOpacity; +mediump float a_angle = a_levelInfo[1]; +mediump float a_minLevel = a_levelInfo[2]; +mediump float a_maxLevel = a_levelInfo[3]; +mediump vec2 a_tex = a_texAngleRange.xy; +mediump float a_visMinAngle = a_texAngleRange.z; +mediump float a_visMaxAngle = a_texAngleRange.w; +mediump float delta_z = 0.0; +mediump float angle = mod(a_angle + u_mapRotation, 256.0); +if (a_visMinAngle < a_visMaxAngle) +{ +delta_z += (1.0 - step(u_keepUpright, 0.0)) * (step(a_visMaxAngle, angle) + (1.0 - step(a_visMinAngle, angle))); +} +else +{ +delta_z += (1.0 - step(u_keepUpright, 0.0)) * (step(a_visMaxAngle, angle) * (1.0 - step(a_visMinAngle, angle))); +} +delta_z += 1.0 - step(a_minLevel, u_level); +delta_z += step(a_maxLevel, u_level); +delta_z += step(v_color[3], 0.0); +v_tex = a_tex.xy / u_mosaicSize; +#ifdef ID +v_id = u_id / 255.0; +#endif +v_edgeDistance = edgePos - halo_width / size; +v_edgeWidth = (u_antialiasingWidth + halo_blur) / size; +mediump vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + sdfFontScale * u_displayViewMat3 * vec3(offsetPrecision * size * a_vertexOffset, 0.0) + u_displayMat3 * vec3(u_textTranslation, 0.0); +gl_Position = vec4(pos.xy, u_depth + delta_z, 1.0); +}`},util:{"encoding.glsl":`const vec4 rgba2float_factors = vec4( +255.0 / (256.0), +255.0 / (256.0 * 256.0), +255.0 / (256.0 * 256.0 * 256.0), +255.0 / (256.0 * 256.0 * 256.0 * 256.0) +); +float rgba2float(vec4 rgba) { +return dot(rgba, rgba2float_factors); +}`,"util.glsl":`float nextPOT(in float x) { +return pow(2.0, ceil(log2(abs(x)))); +}`}};let Xt=class{constructor(e){this._readFile=e}resolveIncludes(e){return this._resolve(e)}_resolve(e,i=new Map){if(i.has(e))return i.get(e);const t=this._read(e);if(!t)throw new Error(`cannot find shader file ${e}`);const n=/^[^\S\n]*#include\s+<(\S+)>[^\S\n]?/gm;let s=n.exec(t);const o=[];for(;s!=null;)o.push({path:s[1],start:s.index,length:s[0].length}),s=n.exec(t);let a=0,r="";return o.forEach(l=>{r+=t.slice(a,l.start),r+=i.has(l.path)?"":this._resolve(l.path,i),a=l.start+l.length}),r+=t.slice(a),i.set(e,r),r}_read(e){return this._readFile(e)}};function Qt(u){let e=jt;return u.split("/").forEach(i=>{e&&(e=e[i])}),e}const Zt=new Xt(Qt);function z(u){return Zt.resolveIncludes(u)}function ei(u){const{options:e,value:i}=u;return typeof e[i]=="number"}function X(u){let e="";for(const i in u){const t=u[i];if(typeof t=="boolean")t&&(e+=`#define ${i} +`);else if(typeof t=="number")e+=`#define ${i} ${t.toFixed()} +`;else if(typeof t=="object")if(ei(t)){const{value:n,options:s,namespace:o}=t,a=o?`${o}_`:"";for(const r in s)e+=`#define ${a}${r} ${s[r].toFixed()} +`;e+=`#define ${i} ${a}${n} +`}else{const n=t.options;let s=0;for(const o in n)e+=`#define ${n[o]} ${(s++).toFixed()} +`;e+=`#define ${i} ${n[t.value]} +`}}return e}const Te=u=>X({ID:u.id,PATTERN:u.pattern}),ti={shaders:u=>({vertexShader:Te(u)+z("background/background.vert"),fragmentShader:Te(u)+z("background/background.frag")})},Pe=u=>X({ID:u.id}),ii={shaders:u=>({vertexShader:Pe(u)+z("circle/circle.vert"),fragmentShader:Pe(u)+z("circle/circle.frag")})},Ie=u=>X({ID:u.id,PATTERN:u.pattern}),ni={shaders:u=>({vertexShader:Ie(u)+z("fill/fill.vert"),fragmentShader:Ie(u)+z("fill/fill.frag")})},Me=u=>X({ID:u.id}),si={shaders:u=>({vertexShader:Me(u)+z("outline/outline.vert"),fragmentShader:Me(u)+z("outline/outline.frag")})},Re=u=>X({ID:u.id,SDF:u.sdf}),oi={shaders:u=>({vertexShader:Re(u)+z("icon/icon.vert"),fragmentShader:Re(u)+z("icon/icon.frag")})},De=u=>X({ID:u.id,PATTERN:u.pattern,SDF:u.sdf}),ai={shaders:u=>({vertexShader:De(u)+z("line/line.vert"),fragmentShader:De(u)+z("line/line.frag")})},Ce=u=>X({ID:u.id}),ri={shaders:u=>({vertexShader:Ce(u)+z("text/text.vert"),fragmentShader:Ce(u)+z("text/text.frag")})};let li=class{constructor(){this._programByKey=new Map}dispose(){this._programByKey.forEach(e=>e.dispose()),this._programByKey.clear()}getMaterialProgram(e,i,t){const n=i.key<<3|this._getMaterialOptionsValue(i.type,t);if(this._programByKey.has(n))return this._programByKey.get(n);const s=this._getProgramTemplate(i.type),{shaders:o}=s,{vertexShader:a,fragmentShader:r}=o(t),l=i.getShaderHeader(),h=i.getShaderMain(),d=a.replace("#pragma header",l).replace("#pragma main",h),f=e.programCache.acquire(d,r,i.getAttributeLocations());return this._programByKey.set(n,f),f}_getMaterialOptionsValue(e,i){switch(e){case A.BACKGROUND:{const t=i;return(t.pattern?1:0)<<1|(t.id?1:0)}case A.FILL:{const t=i;return(t.pattern?1:0)<<1|(t.id?1:0)}case A.OUTLINE:return i.id?1:0;case A.LINE:{const t=i;return(t.sdf?1:0)<<2|(t.pattern?1:0)<<1|(t.id?1:0)}case A.ICON:{const t=i;return(t.sdf?1:0)<<1|(t.id?1:0)}case A.CIRCLE:return i.id?1:0;case A.TEXT:return i.id?1:0;default:return 0}}_getProgramTemplate(e){switch(e){case A.BACKGROUND:return ti;case A.CIRCLE:return ii;case A.FILL:return ni;case A.ICON:return oi;case A.LINE:return ai;case A.OUTLINE:return si;case A.TEXT:return ri;default:return null}}};const Z=1e-6;class Ee{constructor(e,i){this.spriteMosaic=e,this.glyphMosaic=i,this._brushCache=new Map,this._vtlMaterialManager=new li}dispose(){this._brushCache&&(this._brushCache.forEach(e=>e.dispose()),this._brushCache=null),this._vtlMaterialManager=Oe(this._vtlMaterialManager),this.spriteMosaic.dispose(),this.glyphMosaic.dispose()}get vectorTilesMaterialManager(){return this._vtlMaterialManager}drawSymbols(e,i,t){const n=t.layers;e.renderPass="translucent";for(let s=0;sr+Z||o.maxzoom!==void 0&&o.maxzoom<=r-Z||(e.styleLayerUID=o.uid,e.styleLayer=o,this._drawWithBrush(e,i,"vtlSymbol"))}}drawBackground(e,i,t){if(t.backgroundBucketIds.length===0)return;const{context:n,displayLevel:s,requiredLevel:o}=e;i.key.level=o,n.setBlendingEnabled(!0),n.setDepthTestEnabled(!1),n.setStencilTestEnabled(!1),e.renderPass="background",t.backgroundBucketIds.forEach(a=>{const r=t.getLayerById(a);if(r.type!==K.BACKGROUND)return;const l=r.getLayoutProperty("visibility");l&&l.getValue()===ae.NONE||r.minzoom!==void 0&&r.minzoom>s+Z||r.maxzoom!==void 0&&r.maxzoom<=s-Z||(e.styleLayerUID=r.uid,e.styleLayer=r,this._drawWithBrush(e,i,"vtlBackground"))})}drawTile(e,i,t,n){const{context:s}=e,o=t.layers;s.setBlendingEnabled(!1),s.setDepthTestEnabled(!0),s.setDepthWriteEnabled(!0),s.setDepthFunction(V.LEQUAL),e.renderPass="opaque";for(let a=o.length-1;a>=0;a--){const r=o[a];n!=null&&n!==r.type||this._renderStyleLayer(r,e,i,!1)}s.setDepthWriteEnabled(!1),s.setBlendingEnabled(!0),s.setBlendFunctionSeparate(oe.ONE,oe.ONE_MINUS_SRC_ALPHA,oe.ONE,oe.ONE_MINUS_SRC_ALPHA),e.renderPass="translucent";for(let a=0;ar+Z||e.maxzoom!==void 0&&e.maxzoom<=r-Z)return;const{context:l}=i;l.setStencilTestEnabled(!1),l.setStencilWriteMask(0),i.styleLayerUID=e.uid,i.styleLayer=e,this._drawWithBrush(i,t,a)}_drawWithBrush(e,i,t){if(!this._brushCache.has(t)){const n=Yt[t];this._brushCache.set(t,new n)}this._brushCache.get(t).drawMany(e,[i])}}let O=class extends Tt(St(Pt)){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d",this.levelShift=_e("disable-feature:vtl-level-shift")?0:1}initialize(){if(this.layer.fullExtent==null)return void this.addResolvingPromise(Promise.reject(new ft("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const{basemapTerrain:u,spatialReference:e,state:i,viewingMode:t}=this.view,n=t==="local"&&!_t(e)||mt.force512VTL,s=this.layer.tileInfo.spatialReference.isGeographic,o=n?this.layer.tileInfo:this.layer.tileInfo.getOrCreateCompatible(256,s?1:2),a=this._getTileInfoSupportError(o,this.layer.fullExtent);if(a!=null)return this.addResolvingPromise(Promise.reject(a));const r=pt(()=>{var _,p;return(p=(_=this.view)==null?void 0:_.basemapTerrain)==null?void 0:p.tilingSchemeLocked}).then(()=>{var w,v,S;const _=u.tilingScheme,p=_.pixelSize,y=p===256?1:2,P=(w=u.spatialReference)!=null&&w.isGeographic&&p===256?1:0,I=(v=u.spatialReference)!=null&&v.isGeographic||p!==256?0:1;let x;if(this.schemaHelper=new It(y,P,this.levelShift+I),p===256){const M=this.layer.tileInfo.spatialReference.isGeographic;x=this.layer.tileInfo.getOrCreateCompatible(256,M?1:2)}else x=(S=this.view.spatialReference)!=null&&S.isGeographic?this.layer.tileInfo.getOrCreateCompatible(512,.5):this.layer.tileInfo;const b=this._getTileInfoCompatibilityError(x,_);if(b)throw b;this.tileInfo=x});this._tileHandlerController=new AbortController;const l=this.view.resourceController;this._memCache=l.memoryController.newCache(`vtl-${this.layer.uid}`,_=>{_.release()}),this.addHandles(gt(()=>this.view.qualitySettings.memoryLimit,_=>this._memCache.maxSize=Math.ceil(_/10*1048576),vt));const h=new ve(this.layer.currentStyleInfo.style);this._tileHandler=new be(this.layer,h,i.contentPixelRatio,this._memCache);const d=this._tileHandlerController.signal,f=ci(l),c=this._tileHandler.start({signal:d,schedule:f}),g=this._tileHandler.spriteMosaic;g.then(_=>{!yt(d)&&this._tileHandler&&(this.painter=new Ee(_,this._tileHandler.glyphMosaic))}),c.then(()=>this._tileHandlerController=null),this._updatingHandles.add(()=>{var _;return{style:this.layer.currentStyleInfo.style,pixelRatio:(_=this.view.state)==null?void 0:_.contentPixelRatio}},({style:_,pixelRatio:p})=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const y=new ve(_),P=new be(this.layer,y,p,this._memCache),I=P.start({signal:this._tileHandlerController.signal,schedule:f}),x=P.spriteMosaic;I.then(()=>this._tileHandlerController=null),this._updatingHandles.addPromise(Promise.all([I,x]).then(([,b])=>{const w=this._tileHandler,v=this.painter;this.painter=new Ee(b,P.glyphMosaic),this._tileHandler=P,this.emit("data-changed"),w.destroy(),v&&v.dispose()}))});const m=Promise.all([r,c,g]);this.addResolvingPromise(m)}destroy(){this.painter=Oe(this.painter),this._tileHandlerController=ze(this._tileHandlerController),this._tileHandler=me(this._tileHandler),this._memCache=me(this._memCache)}get contentZoom(){return _e("disable-feature:vtl-level-shift")?1:this.view.qualitySettings.tiledSurface.vtlContentZoom}get displayLevelRange(){const u=this.tileInfo.lods,e=this.layer.minScale||u[0].scale,i=this.layer.maxScale||u[u.length-1].scale,t=this.levelRangeFromScaleRange(e,i);return this.layer.maxScale?t.maxLevel++:t.maxLevel+=this.levelShift,t}get dataScaleRange(){const u=this.tileInfo.lods;return{minScale:u[0].scale,maxScale:u[u.length-1].scale}}get dataLevelRange(){const{minScale:u,maxScale:e}=this.dataScaleRange,i=this.levelRangeFromScaleRange(u,e);return i.minLevel===1&&this.tileInfo.size[0]===256&&(i.minLevel=0),i.maxLevel+=this.levelShift,i}async fetchTile(u,e,i,t){return this._tileHandler.getVectorTile(u,e,i,t)}};q([B()],O.prototype,"layer",void 0),q([B()],O.prototype,"levelShift",void 0),q([B()],O.prototype,"contentZoom",null),q([B()],O.prototype,"displayLevelRange",null),q([B()],O.prototype,"tileInfo",void 0),q([B()],O.prototype,"dataScaleRange",null),q([B()],O.prototype,"dataLevelRange",null),q([B()],O.prototype,"updatingProgressValue",void 0),O=q([xt("esri.views.3d.layers.VectorTileLayerView3D")],O);const Hi=O;function ci(u){return e=>u.immediate.schedule(e)}export{Hi as default}; diff --git a/dist/assets/VectorTileLayerView3D-eexSRj3E.js b/dist/assets/VectorTileLayerView3D-eexSRj3E.js deleted file mode 100644 index 724c208..0000000 --- a/dist/assets/VectorTileLayerView3D-eexSRj3E.js +++ /dev/null @@ -1,555 +0,0 @@ -import{uB as Le,uC as He,fA as Ue,uD as Ae,bW as We,a as ze,l5 as he,g1 as Be,nW as Ge,dQ as Je,pa as ee,f as Ke,uE as ke,uF as Ye,uG as Xe,u3 as le,sr as U,uH as Y,uI as ce,uJ as de,uK as je,uL as ae,uM as Qe,uN as Ze,e$ as et,s as tt,ae as it,uO as nt,tn as st,uP as ot,uQ as at,uR as X,fW as fe,lZ as V,uS as F,uT as rt,uU as lt,uV as ct,qE as H,uW as ut,uX as ht,so as A,s6 as Oe,sp as K,uY as oe,dJ as _e,E as dt,uZ as ft,u_ as _t,w as mt,d as pt,A as gt,g as yt,n as me,e as q,y as B,c as vt}from"./index-J0iiHjMT.js";import{t as $}from"./Rect-bBBxMtVp.js";import{r as xt}from"./pbf-o0zzptPp.js";import{e as wt}from"./rasterizingUtils-6P0UGdzr.js";import{r as bt}from"./vec4f32-NvfHy9q7.js";import{e as k,t as Ne,r as pe}from"./definitions-DqQMJYPH.js";import{T as W}from"./enums-uQoFEhYh.js";import{M as ne}from"./number-sTjsTbdA.js";import{c as ge}from"./GeometryUtils-K2DOc0l8.js";import{l as ye}from"./StyleRepository-UhXfhILC.js";import{n as St}from"./LayerView3D-iOx2MD1g.js";import{o as Tt}from"./TiledLayerView3D-Av58zTxG.js";import{u as Pt}from"./LayerView-efDufa6j.js";import"./TileClipper-NSFZXMR1.js";let It=class{constructor(e,i,t){this._scale=e,this._shift=i,this._levelShift=t}getLevelRowColumn(e){const i=this.getLevelShift(e[0]),t=this._shift+i;return t?[e[0]-i,e[1]>>t,e[2]>>t]:e}getLevelShift(e){return Math.min(e,this._levelShift)}getOffset(e,i){let t=0,n=0;const s=this._shift+this.getLevelShift(e[0]);if(s){const o=(1<this._width||i>this._height)return new $;let t=null,n=-1;for(let s=0;se&&this._free.push(new $(t.x+e,t.y,t.width-e,i)),t.height>i&&this._free.push(new $(t.x,t.y+i,t.width,t.height-i))):(t.width>e&&this._free.push(new $(t.x+e,t.y,t.width-e,t.height)),t.height>i&&this._free.push(new $(t.x,t.y+i,e,t.height-i))),new $(t.x,t.y,e,i))}release(e){for(let i=0;i{const l=e+r;if(this._rangePromises.has(l))a.push(this._rangePromises.get(l));else{const h=n.getRange(e,r).then(()=>{this._rangePromises.delete(l)},()=>{this._rangePromises.delete(l)});this._rangePromises.set(l,h),a.push(h)}}),Promise.all(a).then(()=>{let r=this._glyphIndex[e];r||(r={},this._glyphIndex[e]=r);for(const l of i){const h=r[l];if(h){t[l]={sdf:!0,rect:h.rect,metrics:h.metrics,page:h.page,code:l};continue}const d=n.getGlyph(e,l);if(!(d!=null&&d.metrics))continue;const f=d.metrics;let c;if(f.width===0)c=new $(0,0,0,0);else{const m=f.width+6,_=f.height+2*3;let p=m%4?4-m%4:4,v=_%4?4-_%4:4;p===1&&(p=5),v===1&&(v=5),c=this._binPack.allocate(m+p,_+v),c.isEmpty&&(this._dirties[this._currentPage]||(this._glyphData[this._currentPage]=null),this._currentPage=this._glyphData.length,this._glyphData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(void 0),this._binPack=new ie(this.width-4,this.height-4),c=this._binPack.allocate(m+p,_+v));const P=this._glyphData[this._currentPage],I=d.bitmap;let x,b;if(I)for(let w=0;w<_;w++){x=m*w,b=this.width*(c.y+w+1)+c.x;for(let y=0;y{t.addRange(i,new re(new xt(new Uint8Array(a.data),new DataView(a.data))))}).catch(()=>{t.addRange(i,new re)})}return t.addRange(i,new re),Promise.resolve()}getGlyph(e,i){const t=this._getFontStack(e);if(!t)return;const n=Math.floor(i/256),s=t.getRange(n);return s?{metrics:s.getMetrics(i),bitmap:s.getBitmap(i)}:void 0}_getFontStack(e){let i=this._glyphInfo[e];return i||(i=this._glyphInfo[e]=new Mt),i}},Rt=class{constructor(e,i,t){this._array=e,this._start=i,this.length=t}at(e){return 0<=e&&e0&&(this._maxItemSize=t),this._binPack=new ie(e-4,i-4)}destroy(){this.dispose()}dispose(){this._binPack=null,this._mosaicsData.length=0,this._mosaicRects={};for(const e of this._textures)e&&e.dispose();this._textures.length=0}getWidth(e){return e>=this._size.length?-1:this._size[e][0]}getHeight(e){return e>=this._size.length?-1:this._size[e][1]}getPageSize(e){return e>=this._size.length?null:this._size[e]}setSpriteSource(e){if(this.dispose(),this.pixelRatio=e.devicePixelRatio,this._mosaicsData.length===0){this._binPack=new ie(this._pageWidth-4,this._pageHeight-4);const i=Math.floor(this._pageWidth),t=Math.floor(this._pageHeight),n=new Uint32Array(i*t);this._mosaicsData[0]=n,this._dirties.push(!0),this._size.push([this._pageWidth,this._pageHeight]),this._textures.push(void 0)}this._sprites=e}getSpriteItem(e,i=!1){let t,n,s=this._mosaicRects[e];if(s)return s;if(!this._sprites||this._sprites.loadStatus!=="loaded"||(e&&e.startsWith(Dt)?([t,n]=this._rasterizeDash(e),i=!0):t=this._sprites.getSpriteInfo(e),!(t!=null&&t.width)||!t.height||t.width<0||t.height<0))return null;const o=t.width,a=t.height,[r,l,h]=this._allocateImage(o,a);return r.width<=0?null:(this._copy(r,t,l,h,i,n),s={rect:r,width:o,height:a,sdf:t.sdf,simplePattern:!1,pixelRatio:t.pixelRatio,page:l},this._mosaicRects[e]=s,s)}getSpriteItems(e){const i={};for(const t of e)i[t.name]=this.getSpriteItem(t.name,t.repeat);return i}getMosaicItemPosition(e,i){const t=this.getSpriteItem(e,i),n=t&&t.rect;if(!n)return null;n.width=t.width,n.height=t.height;const s=t.width,o=t.height,a=2;return{tl:[n.x+a,n.y+a],br:[n.x+a+s,n.y+a+o],page:t.page}}bind(e,i,t=0,n=0){if(t>=this._size.length||t>=this._mosaicsData.length)return;if(!this._textures[t]){const o=new Le;o.wrapMode=Ue.CLAMP_TO_EDGE,o.width=this._size[t][0],o.height=this._size[t][1],this._textures[t]=new Ae(e,o,new Uint8Array(this._mosaicsData[t].buffer))}const s=this._textures[t];s.setSamplingMode(i),this._dirties[t]&&s.setData(new Uint8Array(this._mosaicsData[t].buffer)),e.bindTexture(s,n),this._dirties[t]=!1}static _copyBits(e,i,t,n,s,o,a,r,l,h,d){let f=n*i+t,c=r*o+a;if(d){c-=o;for(let g=-1;g<=h;g++,f=((g+h)%h+n)*i+t,c+=o)for(let m=-1;m<=l;m++)s[c+m]=e[f+(m+l)%l]}else for(let g=0;g=this._mosaicsData.length)return;const a=new Uint32Array(o?o.buffer:this._sprites.image.buffer),r=this._mosaicsData[t];r&&a||console.error("Source or target images are uninitialized!");const l=2,h=o?i.width:this._sprites.width;$e._copyBits(a,h,i.x,i.y,r,n[0],e.x+l,e.y+l,i.width,i.height,s),this._dirties[t]=!0}_allocateImage(e,i){e+=2,i+=2;const t=Math.max(e,i);if(this._maxItemSize&&this._maxItemSizethis._spriteMosaic)}get glyphMosaic(){return this._glyphMosaic}async start(e){this._requestSprite(e);const i=this._layer.currentStyleInfo.glyphsUrl,t=new xe(i?he(i,{...this._layer.customParameters,token:this._layer.apiKey}):null);this._glyphMosaic=new ve(1024,1024,t),this._broadcastPromise=Be("WorkerTileHandler",{client:this,schedule:e.schedule,signal:e.signal}).then(n=>{var s;if(this._layer&&((s=this._connection)==null||s.close(),this._connection=n,this._layer&&!this._connection.closed)){const o=n.broadcast("setStyle",this._layer.currentStyleInfo.style,e);Promise.all(o).catch(a=>Ge(a))}})}_requestSprite(e){var o,a;(o=this._spriteSourceAbortController)==null||o.abort();const i=new AbortController;this._spriteSourceAbortController=i;const t=e==null?void 0:e.signal;this._inputSignalEventListener&&((a=this._startOptionsInputSignal)==null||a.removeEventListener("abort",this._inputSignalEventListener)),this._startOptionsInputSignal=null,t&&(this._inputSignalEventListener=Et(i),t.addEventListener("abort",this._inputSignalEventListener,{once:!0}));const{signal:n}=i,s={...e,signal:n};this._spriteSourcePromise=this._layer.loadSpriteSource(this.devicePixelRatio,s),this._spriteSourcePromise.then(r=>{Je(n),this._spriteMosaic=new we(1024,1024,250),this._spriteMosaic.setSpriteSource(r)})}async updateStyle(e){return await this._broadcastPromise,this._broadcastPromise=Promise.all(this._connection.broadcast("updateStyle",e)),this._broadcastPromise}setSpriteSource(e){const i=new we(1024,1024,250);return i.setSpriteSource(e),this._spriteMosaic=i,this._spriteSourcePromise=Promise.resolve(e),this._spriteSourceAbortController=null,i}async setStyle(e,i){await this._broadcastPromise,this._styleRepository=e,this._requestSprite();const t=new xe(this._layer.currentStyleInfo.glyphsUrl?he(this._layer.currentStyleInfo.glyphsUrl,{...this._layer.customParameters,token:this._layer.apiKey}):null);return this._glyphMosaic=new ve(1024,1024,t),this._broadcastPromise=Promise.all(this._connection.broadcast("setStyle",i)),this._broadcastPromise}fetchTileData(e,i){return this._getRefKeys(e,i).then(t=>{const n=this._layer.sourceNameToSource,s=[];for(const o in n)s.push(o);return this._getSourcesData(s,t,i)})}parseTileData(e,i){const t=e&&e.data;if(!t)return Promise.resolve(null);const{sourceName2DataAndRefKey:n,transferList:s}=t;return Object.keys(n).length===0?Promise.resolve(null):this._broadcastPromise.then(()=>this._connection.invoke("createTileAndParse",{key:e.key.id,sourceName2DataAndRefKey:n,styleLayerUIDs:e.styleLayerUIDs},{...i,transferList:s}))}async getSprites(e){return await this._spriteSourcePromise,this._spriteMosaic.getSpriteItems(e)}getGlyphs(e){return this._glyphMosaic.getGlyphItems(e.font,e.codePoints)}async _getTilePayload(e,i,t){const n=ee.pool.acquire(e.id),s=this._layer.sourceNameToSource[i],{level:o,row:a,col:r}=n;ee.pool.release(n);try{return{protobuff:await s.requestTile(o,a,r,t),sourceName:i}}catch(l){if(Ke(l))throw l;return{protobuff:null,sourceName:i}}}_getRefKeys(e,i){const t=this._layer.sourceNameToSource,n=new Array;for(const s in t){const o=t[s].getRefKey(e,i);n.push(o)}return Promise.allSettled(n)}_getSourcesData(e,i,t){const n=[];for(let s=0;s{const o={},a=[];for(let r=0;ru.abort()}function Lt(u,e,i,t,n,s){const{iconRotationAlignment:o,textRotationAlignment:a,iconTranslate:r,iconTranslateAnchor:l,textTranslate:h,textTranslateAnchor:d}=t;let f=0;for(const c of u.colliders){const[g,m]=c.partIndex===0?r:h,_=c.partIndex===0?l:d,p=c.minLod<=s&&s<=c.maxLod;f+=p?0:1,c.enabled=p,c.xScreen=c.xTile*n[0]+c.yTile*n[3]+n[6],c.yScreen=c.xTile*n[1]+c.yTile*n[4]+n[7],_===Y.MAP?(c.xScreen+=i*g-e*m,c.yScreen+=e*g+i*m):(c.xScreen+=g,c.yScreen+=m),U.VIEWPORT===(c.partIndex===0?o:a)?(c.dxScreen=c.dxPixels,c.dyScreen=c.dyPixels):(c.dxScreen=i*(c.dxPixels+c.width/2)-e*(c.dyPixels+c.height/2)-c.width/2,c.dyScreen=e*(c.dxPixels+c.width/2)+i*(c.dyPixels+c.height/2)-c.height/2)}u.colliders.length>0&&f===u.colliders.length&&(u.unique.show=!1)}let Ut=class{constructor(e,i,t,n,s,o){this._symbols=e,this._styleRepository=n,this._zoom=s,this._currentLayerCursor=0,this._currentSymbolCursor=0,this._styleProps=new Map,this._allNeededMatrices=new Map,this._gridIndex=new ke(i,t,Ye),this._si=Math.sin(Math.PI*o/180),this._co=Math.cos(Math.PI*o/180);for(const a of e)for(const r of a.symbols)this._allNeededMatrices.has(r.tile)||this._allNeededMatrices.set(r.tile,Xe(r.tile.transforms.tileUnitsToPixels))}work(e){const i=this._gridIndex;function t(s){const o=s.xScreen+s.dxScreen,a=s.yScreen+s.dyScreen,r=o+s.width,l=a+s.height,[h,d,f,c]=i.getCellSpan(o,a,r,l);for(let g=d;g<=c;g++)for(let m=h;m<=f;m++){const _=i.cells[g][m];for(const p of _){const v=p.xScreen+p.dxScreen,P=p.yScreen+p.dyScreen,I=v+p.width,x=P+p.height;if(!(rI||lx))return!0}}return!1}const n=performance.now();for(;this._currentLayerCursore)return!1;const a=s.symbols[this._currentSymbolCursor];if(!a.unique.show)continue;Lt(a,this._si,this._co,o,this._allNeededMatrices.get(a.tile),this._zoom);const r=a.unique;if(!r.show)continue;const{iconAllowOverlap:l,iconIgnorePlacement:h,textAllowOverlap:d,textIgnorePlacement:f}=o;for(const c of a.colliders){if(!c.enabled)continue;const g=r.parts[c.partIndex];g.show&&!(c.partIndex?d:l)&&t(c)&&(c.hard?r.show=!1:g.show=!1)}if(r.show)for(const c of a.colliders){if(!c.enabled||(c.partIndex?f:h)||!r.parts[c.partIndex].show)continue;const g=c.xScreen+c.dxScreen,m=c.yScreen+c.dyScreen,_=g+c.width,p=m+c.height,[v,P,I,x]=this._gridIndex.getCellSpan(g,m,_,p);for(let b=P;b<=x;b++)for(let w=v;w<=I;w++)this._gridIndex.cells[b][w].push(c)}}}return!0}_getProperties(e){const i=this._styleProps.get(e);if(i)return i;const t=this._zoom,n=this._styleRepository.getStyleLayerByUID(e),s=n.getLayoutValue("symbol-placement",t)!==le.POINT;let o=n.getLayoutValue("icon-rotation-alignment",t);o===U.AUTO&&(o=s?U.MAP:U.VIEWPORT);let a=n.getLayoutValue("text-rotation-alignment",t);a===U.AUTO&&(a=s?U.MAP:U.VIEWPORT);const r=n.getPaintValue("icon-translate",t),l=n.getPaintValue("icon-translate-anchor",t),h=n.getPaintValue("text-translate",t),d=n.getPaintValue("text-translate-anchor",t),f={iconAllowOverlap:n.getLayoutValue("icon-allow-overlap",t),iconIgnorePlacement:n.getLayoutValue("icon-ignore-placement",t),textAllowOverlap:n.getLayoutValue("text-allow-overlap",t),textIgnorePlacement:n.getLayoutValue("text-ignore-placement",t),iconRotationAlignment:o,textRotationAlignment:a,iconTranslateAnchor:l,iconTranslate:r,textTranslateAnchor:d,textTranslate:h};return this._styleProps.set(e,f),f}};function At(u,e){if(u.priority-e.priority)return u.priority-e.priority;const i=u.tile.key,t=e.tile.key;return i.world-t.world?i.world-t.world:i.level-t.level?i.level-t.level:i.row-t.row?i.row-t.row:i.col-t.col?i.col-t.col:u.xTile-e.xTile?u.xTile-e.xTile:u.yTile-e.yTile}let zt=class{get running(){return this._running}constructor(e,i,t,n,s,o){this._visibleTiles=e,this._symbolRepository=i,this._createCollisionJob=t,this._assignTileSymbolsOpacity=n,this._symbolLayerSorter=s,this._isLayerVisible=o,this._selectionJob=null,this._selectionJobCompleted=!1,this._collisionJob=null,this._collisionJobCompleted=!1,this._opacityJob=null,this._opacityJobCompleted=!1,this._running=!0}setScreenSize(e,i){this._screenWidth===e&&this._screenHeight===i||this.restart(),this._screenWidth=e,this._screenHeight=i}restart(){this._selectionJob=null,this._selectionJobCompleted=!1,this._collisionJob=null,this._collisionJobCompleted=!1,this._opacityJob=null,this._opacityJobCompleted=!1,this._running=!0}continue(e){if(this._selectionJob||(this._selectionJob=this._createSelectionJob()),!this._selectionJobCompleted){const i=performance.now();if(!this._selectionJob.work(e)||(this._selectionJobCompleted=!0,(e=Math.max(0,e-(performance.now()-i)))===0))return!1}if(this._collisionJob||(this._collisionJob=this._createCollisionJob(this._selectionJob.sortedSymbols,this._screenWidth,this._screenHeight)),!this._collisionJobCompleted){const i=performance.now();if(!this._collisionJob.work(e)||(this._collisionJobCompleted=!0,(e=Math.max(0,e-(performance.now()-i)))===0))return!1}if(this._opacityJob||(this._opacityJob=this._createOpacityJob()),!this._opacityJobCompleted){const i=performance.now();if(!this._opacityJob.work(e)||(this._opacityJobCompleted=!0,(e=Math.max(0,e-(performance.now()-i)))===0))return!1}return this._running=!1,!0}_createSelectionJob(){const e=this._symbolRepository.uniqueSymbols;for(let r=0;rr)return!1;let g=null,m=!1,_=!1;for(const p of l.tileSymbols)if(!_||!m){const v=p.tile;(!g||v.isCoverage||v.neededForCoverage&&!m)&&(g=p,(v.neededForCoverage||v.isCoverage)&&(_=!0),v.isCoverage&&(m=!0))}if(g.selectedForRendering=!0,_){c.symbols.push(g),l.show=!0;for(const p of l.parts)p.show=!0}else l.show=!1}}for(const d of i)d.symbols.sort(At);return!0}const a=this._symbolLayerSorter;return{work:o,get sortedSymbols(){return i.sort(a)}}}_createOpacityJob(){const e=this._assignTileSymbolsOpacity,i=this._visibleTiles;let t=0;function n(s,o){const a=s.symbols;for(const[r,l]of a)kt(l,o);e(s,o);for(const r of s.childrenTiles)n(r,o)}return{work(s){const o=performance.now();for(;ts)return!1;const a=i[t];a.parentTile==null&&n(a,performance.now())}return!0}}}};function kt(u,e){for(const i of u){const t=i.unique;for(const n of t.parts){const s=n.targetOpacity>.5?1:-1;n.startOpacity+=s*((e-n.startTime)/ce),n.startOpacity=Math.min(Math.max(n.startOpacity,0),1),n.startTime=e,n.targetOpacity=t.show&&n.show?1:0}}}const Ot=32,Nt=8,$t=64;let Vt=class{constructor(e,i,t){this.tileCoordRange=e,this._visibleTiles=i,this._createUnique=t,this._tiles=new Map,this._uniqueSymbolsReferences=new Map}get uniqueSymbols(){return this._uniqueSymbolLayerArray==null&&(this._uniqueSymbolLayerArray=this._createUniqueSymbolLayerArray()),this._uniqueSymbolLayerArray}add(e,i){this._uniqueSymbolLayerArray=null;let t=this._tiles.get(e.id);t||(t={symbols:new Map},this._tiles.set(e.id,t));const n=new Map;if(i)for(const a of i)t.symbols.has(a)&&(n.set(a,t.symbols.get(a)),t.symbols.delete(a));else for(const[a,r]of e.layerData)t.symbols.has(a)&&(n.set(a,t.symbols.get(a)),t.symbols.delete(a));this._removeSymbols(n);const s=e.symbols,o=new Map;for(const[a,r]of s){let l=r.length;if(l>=Ot){let h=this.tileCoordRange;do h/=2,l/=4;while(l>Nt&&h>$t);const d=new ke(this.tileCoordRange,this.tileCoordRange,h);o.set(a,{flat:r,index:d}),t.symbols.set(a,{flat:r,index:d});for(const f of r)d.getCell(f.xTile,f.yTile).push(f)}else o.set(a,{flat:r}),t.symbols.set(a,{flat:r})}this._addSymbols(e.key,s)}deleteStyleLayers(e){this._uniqueSymbolLayerArray=null;for(const[i,t]of this._tiles){const n=new Map;for(const s of e)t.symbols.has(s)&&(n.set(s,t.symbols.get(s)),t.symbols.delete(s));this._removeSymbols(n),t.symbols.size===0&&this._tiles.delete(i)}}removeTile(e){this._uniqueSymbolLayerArray=null;const i=this._tiles.get(e.id);if(!i)return;const t=new Map;for(const[n,s]of e.symbols)i.symbols.has(n)&&(t.set(n,i.symbols.get(n)),i.symbols.delete(n));this._removeSymbols(t),i.symbols.size===0&&this._tiles.delete(e.id)}_removeSymbols(e){for(const[i,{flat:t}]of e)for(const n of t){const s=n.unique,o=s.tileSymbols,a=o.length-1;for(let r=0;ri.level){const s=e.key.level-i.level;if(e.key.row>>s!==i.row||e.key.col>>s!==i.col)return}if(i.level>e.key.level){const s=i.level-e.key.level;if(i.row>>s!==e.key.row||i.col>>s!==e.key.col)return}if(i.equals(e.key)){for(const s of e.childrenTiles)this._matchSymbols(s,i,t);return}const n=new Map;for(const[s,o]of t){const a=[];for(const d of o){const f=de(this.tileCoordRange,d.xTile,i.level,i.col,e.key.level,e.key.col),c=de(this.tileCoordRange,d.yTile,i.level,i.row,e.key.level,e.key.row);f>=0&&f=0&&c0&&n.set(s,r)}for(const s of e.childrenTiles)this._matchSymbols(s,i,n)}_createUniqueSymbolLayerArray(){const e=this._uniqueSymbolsReferences,i=new Array(e.size);let t,n=0;for(const[s,o]of e){const a=new Array(o.size);t=0;for(const r of o)a[t++]=r;i[n]={styleLayerUID:s,uniqueSymbols:a},n++}return i}};function Ft(u){const e=[],i=new Vt(4096,e,()=>{const n=new Qe;return n.show=!1,n.parts.push({startTime:0,startOpacity:0,targetOpacity:0,show:!1}),n.parts.push({startTime:0,startOpacity:0,targetOpacity:0,show:!1}),n}),t=new zt(e,i,(n,s,o)=>new Ut(n,s,o,u.styleRepository,u.key.level,0),(n,s)=>{je(n,s,!1)},()=>0,n=>{const s=u.styleRepository.getStyleLayerByUID(n).getLayoutProperty("visibility");return!s||s.getValue()!==ae.NONE});e.push(u),i.add(u),t.setScreenSize(512,512),t.continue(1/0)}let qt=class extends Ze{constructor(){super(...arguments),this._fullCacheLodInfos=null,this._levelByScale={}}getTileParentId(e){const i=ee.pool.acquire(e),t=i.level===0?null:ee.getId(i.level-1,i.row>>1,i.col>>1,i.world);return ee.pool.release(i),t}getTileCoverage(e,i,t=!0,n){const s=super.getTileCoverage(e,i,t,n);if(!s)return s;const o=1<a.row>=0&&a.rowi[0].scale)return i[0].level;let t,n;for(let s=0;sn.scale)return t=i[s],t.level+(t.scale-e)/(t.scale-n.scale);return i[i.length-1].level}}_initializeFullCacheLODs(e){let i;if(e[0].level===0)i=e.map(t=>({level:t.level,resolution:t.resolution,scale:t.scale}));else{const t=this.tileInfo.size[0],n=this.tileInfo.spatialReference;i=et.create({size:t,spatialReference:n}).lods.map(s=>({level:s.level,resolution:s.resolution,scale:s.scale}))}for(let t=0;te.abort()),this._ongoingRequestToController.clear(),this._ongoingTileRequests.clear()}async getVectorTile(e,i,t,n){const s=new ee(e,i,t,0);let o=this._memCache.get(s.id);if(o!=null)return o.retain(),o;const a=await this._getVectorTileData(s);if(tt(n),!this._layer)return null;if(o=this._memCache.get(s.id),o!=null)return o.retain(),o;const r=this._layer.tileInfo.getTileBounds(it(),s),l=this._tileInfoView.getTileResolution(e);return o=new nt(s,l,r[0],r[3],512,512,this._styleRepository,this._memCache),a?(o.setData(a),o.retain(),this._memCache.put(s.id,o,o.memoryUsed,st)):o.setData(null),o.neededForCoverage=!0,o.transforms.tileUnitsToPixels=ot(1/8,0,0,0,1/8,0,0,0,1),Ft(o),o}_getVectorTileData(e){const i=e.id;if(this._ongoingTileRequests.has(i))return this._ongoingTileRequests.get(i);const t=new AbortController,n={signal:t.signal},s=this._getParsedVectorTileData(e,n).then(o=>(this._ongoingTileRequests.delete(i),this._ongoingRequestToController.delete(i),o)).catch(()=>(this._ongoingTileRequests.delete(i),this._ongoingRequestToController.delete(i),null));return this._ongoingTileRequests.set(i,s),this._ongoingRequestToController.set(i,t),s}_getParsedVectorTileData(e,i){return this.fetchTileData(e,i).then(t=>this.parseTileData({key:e,data:t},i))}},se=class{constructor(){this.name=this.constructor.name||"UnnamedBrush",this.brushEffect=null}prepareState(e,i){}draw(e,i,t){}drawMany(e,i,t){for(const n of i)n.visible&&this.draw(e,n,t)}},Ht=class extends se{constructor(){super(...arguments),this._color=bt(1,0,0,1),this._patternMatrix=at(),this._programOptions={id:!1,pattern:!1}}dispose(){this._vao&&(this._vao.dispose(),this._vao=null)}drawMany(e,i){const{context:t,painter:n,styleLayerUID:s,requestRender:o,allowDelayedRender:a}=e;this._loadWGLResources(e);const r=e.displayLevel,l=e.styleLayer,h=l.backgroundMaterial,d=n.vectorTilesMaterialManager,f=l.getPaintValue("background-color",r),c=l.getPaintValue("background-opacity",r),g=l.getPaintValue("background-pattern",r),m=g!==void 0,_=f[3]*c,p=1|window.devicePixelRatio,v=e.spriteMosaic;let P,I;const x=p>Ne?2:1,b=e.drawPhase===W.HITTEST,w=this._programOptions;w.id=b,w.pattern=m;const y=d.getMaterialProgram(t,h,w);if(!a||o==null||y.compiled){if(t.bindVAO(this._vao),t.useProgram(y),m){const S=v.getMosaicItemPosition(g,!0);if(S!=null){const{tl:M,br:T,page:D}=S;P=T[0]-M[0],I=T[1]-M[1];const R=v.getPageSize(D);R!=null&&(v.bind(t,X.LINEAR,D,k),y.setUniform4f("u_tlbr",M[0],M[1],T[0],T[1]),y.setUniform2fv("u_mosaicSize",R),y.setUniform1i("u_texture",k))}y.setUniform1f("u_opacity",c)}else this._color[0]=_*f[0],this._color[1]=_*f[1],this._color[2]=_*f[2],this._color[3]=_,y.setUniform4fv("u_color",this._color);if(y.setUniform1f("u_depth",l.z||0),b){const S=ne(s+1);y.setUniform4fv("u_id",S)}for(const S of i){if(y.setUniform1f("u_coord_range",S.rangeX),y.setUniformMatrix3fv("u_dvsMat3",S.transforms.dvs),m){const M=Math.max(2**(Math.round(r)-S.key.level),1),T=x*S.width*M,D=T/fe(P),R=T/fe(I);this._patternMatrix[0]=D,this._patternMatrix[4]=R,y.setUniformMatrix3fv("u_pattern_matrix",this._patternMatrix)}t.setStencilFunction(V.EQUAL,0,255),t.drawArrays(F.TRIANGLE_STRIP,0,4)}}else o()}_loadWGLResources(e){if(this._vao)return;const{context:i,styleLayer:t}=e,n=t.backgroundMaterial,s=new Int8Array([0,0,1,0,0,1,1,1]),o=rt.createVertex(i,lt.STATIC_DRAW,s),a=new ct(i,n.getAttributeLocations(),n.getLayoutInfo(),{geometry:o});this._vao=a}},Wt=class extends se{constructor(){super(...arguments),this._programOptions={id:!1}}dispose(){}drawMany(e,i){const{context:t,displayLevel:n,requiredLevel:s,state:o,drawPhase:a,painter:r,spriteMosaic:l,styleLayerUID:h,requestRender:d,allowDelayedRender:f}=e;if(!i.some(w=>{var y;return((y=w.layerData.get(h))==null?void 0:y.circleIndexCount)??!1}))return;const c=e.styleLayer,g=c.circleMaterial,m=r.vectorTilesMaterialManager,_=1.2,p=c.getPaintValue("circle-translate",n),v=c.getPaintValue("circle-translate-anchor",n),P=a===W.HITTEST,I=this._programOptions;I.id=P;const x=m.getMaterialProgram(t,g,I);if(f&&d!=null&&!x.compiled)return void d();t.useProgram(x),x.setUniformMatrix3fv("u_displayMat3",v===Y.VIEWPORT?o.displayMat3:o.displayViewMat3),x.setUniform2fv("u_circleTranslation",p),x.setUniform1f("u_depth",c.z),x.setUniform1f("u_antialiasingWidth",_);let b=-1;if(P){const w=ne(h+1);x.setUniform4fv("u_id",w)}for(const w of i){if(!w.layerData.has(h))continue;w.key.level!==b&&(b=w.key.level,g.setDataUniforms(x,n,c,b,l));const y=w.layerData.get(h);if(!y.circleIndexCount)continue;y.prepareForRendering(t);const S=y.vao;S!=null&&(t.bindVAO(S),x.setUniformMatrix3fv("u_dvsMat3",w.transforms.dvs),s!==w.key.level?t.setStencilFunction(V.EQUAL,w.stencilRef,255):t.setStencilFunction(V.GREATER,255,255),t.drawElements(F.TRIANGLES,y.circleIndexCount,H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*y.circleIndexStart),w.triangleCount+=y.circleIndexCount/3)}}};const Se=1/65536;let Bt=class extends se{constructor(){super(...arguments),this._fillProgramOptions={id:!1,pattern:!1},this._outlineProgramOptions={id:!1}}dispose(){}drawMany(e,i){const{displayLevel:t,drawPhase:n,renderPass:s,spriteMosaic:o,styleLayerUID:a}=e;let r=!1;for(const x of i)if(x.layerData.has(a)){const b=x.layerData.get(a);if(b.fillIndexCount>0||b.outlineIndexCount>0){r=!0;break}}if(!r)return;const l=e.styleLayer,h=l.getPaintProperty("fill-pattern"),d=h!==void 0,f=d&&h.isDataDriven;let c;if(d&&!f){const x=h.getValue(t);c=o.getMosaicItemPosition(x,!0)}const g=!d&&l.getPaintValue("fill-antialias",t);let m=!0,_=1;if(!d){const x=l.getPaintProperty("fill-color"),b=l.getPaintProperty("fill-opacity");if(!(x!=null&&x.isDataDriven)&&!(b!=null&&b.isDataDriven)){const w=l.getPaintValue("fill-color",t);_=l.getPaintValue("fill-opacity",t)*w[3],_>=1&&(m=!1)}}if(m&&s==="opaque")return;let p;n===W.HITTEST&&(p=ne(a+1));const v=l.getPaintValue("fill-translate",t),P=l.getPaintValue("fill-translate-anchor",t);(m||s!=="translucent")&&this._drawFill(e,a,l,i,v,P,d,c,f,p);const I=!l.hasDataDrivenOutlineColor&&l.outlineUsesFillColor&&_<1;g&&s!=="opaque"&&!I&&this._drawOutline(e,a,l,i,v,P,p)}_drawFill(e,i,t,n,s,o,a,r,l,h){if(a&&!l&&r==null)return;const{context:d,displayLevel:f,state:c,drawPhase:g,painter:m,pixelRatio:_,spriteMosaic:p,requestRender:v,allowDelayedRender:P}=e,I=t.fillMaterial,x=m.vectorTilesMaterialManager,b=_>Ne?2:1,w=g===W.HITTEST,y=this._fillProgramOptions;y.id=w,y.pattern=a;const S=x.getMaterialProgram(d,I,y);if(P&&v!=null&&!S.compiled)return void v();if(d.useProgram(S),r!=null){const{page:T}=r,D=p.getPageSize(T);D!=null&&(p.bind(d,X.LINEAR,T,k),S.setUniform2fv("u_mosaicSize",D),S.setUniform1i("u_texture",k))}S.setUniformMatrix3fv("u_displayMat3",o===Y.VIEWPORT?c.displayMat3:c.displayViewMat3),S.setUniform2fv("u_fillTranslation",s),S.setUniform1f("u_depth",t.z+Se),w&&S.setUniform4fv("u_id",h);let M=-1;for(const T of n){if(!T.layerData.has(i))continue;T.key.level!==M&&(M=T.key.level,I.setDataUniforms(S,f,t,M,p));const D=T.layerData.get(i);if(!D.fillIndexCount)continue;D.prepareForRendering(d);const R=D.fillVAO;if(R!=null){if(d.bindVAO(R),S.setUniformMatrix3fv("u_dvsMat3",T.transforms.dvs),d.setStencilFunction(V.EQUAL,T.stencilRef,255),a){const E=Math.max(2**(Math.round(f)-T.key.level),1),L=T.rangeX/(b*T.width*E);S.setUniform1f("u_patternFactor",L)}if(l){const E=D.patternMap;if(!E)continue;for(const[L,G]of E){const J=p.getPageSize(L);J!=null&&(p.bind(d,X.LINEAR,L,k),S.setUniform2fv("u_mosaicSize",J),S.setUniform1i("u_texture",k),d.drawElements(F.TRIANGLES,G[1],H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*G[0]))}}else d.drawElements(F.TRIANGLES,D.fillIndexCount,H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*D.fillIndexStart);T.triangleCount+=D.fillIndexCount/3}}}_drawOutline(e,i,t,n,s,o,a){const{context:r,displayLevel:l,state:h,drawPhase:d,painter:f,pixelRatio:c,spriteMosaic:g,requestRender:m,allowDelayedRender:_}=e,p=t.outlineMaterial,v=f.vectorTilesMaterialManager,P=.75/c,I=d===W.HITTEST,x=this._outlineProgramOptions;x.id=I;const b=v.getMaterialProgram(r,p,x);if(_&&m!=null&&!b.compiled)return void m();r.useProgram(b),b.setUniformMatrix3fv("u_displayMat3",o===Y.VIEWPORT?h.displayMat3:h.displayViewMat3),b.setUniform2fv("u_fillTranslation",s),b.setUniform1f("u_depth",t.z+Se),b.setUniform1f("u_outline_width",P),I&&b.setUniform4fv("u_id",a);let w=-1;for(const y of n){if(!y.layerData.has(i))continue;y.key.level!==w&&(w=y.key.level,p.setDataUniforms(b,l,t,w,g));const S=y.layerData.get(i);if(S.prepareForRendering(r),!S.outlineIndexCount)continue;const M=S.outlineVAO;M!=null&&(r.bindVAO(M),b.setUniformMatrix3fv("u_dvsMat3",y.transforms.dvs),r.setStencilFunction(V.EQUAL,y.stencilRef,255),r.drawElements(F.TRIANGLES,S.outlineIndexCount,H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*S.outlineIndexStart),y.triangleCount+=S.outlineIndexCount/3)}}},Gt=class extends se{constructor(){super(...arguments),this._programOptions={id:!1,pattern:!1,sdf:!1}}dispose(){}drawMany(e,i){const{context:t,displayLevel:n,state:s,drawPhase:o,painter:a,pixelRatio:r,spriteMosaic:l,styleLayerUID:h,requestRender:d,allowDelayedRender:f}=e;if(!i.some(R=>{var E;return((E=R.layerData.get(h))==null?void 0:E.lineIndexCount)??!1}))return;const c=e.styleLayer,g=c.lineMaterial,m=a.vectorTilesMaterialManager,_=c.getPaintValue("line-translate",n),p=c.getPaintValue("line-translate-anchor",n),v=c.getPaintProperty("line-pattern"),P=v!==void 0,I=P&&v.isDataDriven;let x,b;if(P&&!I){const R=v.getValue(n);x=l.getMosaicItemPosition(R)}let w=!1;if(!P){const R=c.getPaintProperty("line-dasharray");if(b=R!==void 0,w=b&&R.isDataDriven,b&&!w){const E=R.getValue(n),L=c.getDashKey(E,c.getLayoutValue("line-cap",n));x=l.getMosaicItemPosition(L)}}const y=1/r,S=o===W.HITTEST,M=this._programOptions;M.id=S,M.pattern=P,M.sdf=b;const T=m.getMaterialProgram(t,g,M);if(f&&d!=null&&!T.compiled)return void d();if(t.useProgram(T),T.setUniformMatrix3fv("u_displayViewMat3",s.displayViewMat3),T.setUniformMatrix3fv("u_displayMat3",p===Y.VIEWPORT?s.displayMat3:s.displayViewMat3),T.setUniform2fv("u_lineTranslation",_),T.setUniform1f("u_depth",c.z),T.setUniform1f("u_antialiasing",y),S){const R=ne(h+1);T.setUniform4fv("u_id",R)}if(x&&x!=null){const{page:R}=x,E=l.getPageSize(R);E!=null&&(l.bind(t,X.LINEAR,R,k),T.setUniform2fv("u_mosaicSize",E),T.setUniform1i("u_texture",k))}let D=-1;for(const R of i){if(!R.layerData.has(h))continue;R.key.level!==D&&(D=R.key.level,g.setDataUniforms(T,n,c,D,l));const E=2**(n-D)/r;T.setUniform1f("u_zoomFactor",E);const L=R.layerData.get(h);if(!L.lineIndexCount)continue;L.prepareForRendering(t);const G=L.vao;if(G!=null){if(t.bindVAO(G),T.setUniformMatrix3fv("u_dvsMat3",R.transforms.dvs),t.setStencilFunction(V.EQUAL,R.stencilRef,255),I||w){const J=L.patternMap;if(!J)continue;for(const[te,C]of J){const Q=l.getPageSize(te);Q!=null&&(l.bind(t,X.LINEAR,te,k),T.setUniform2fv("u_mosaicSize",Q),T.setUniform1i("u_texture",k),t.drawElements(F.TRIANGLES,C[1],H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*C[0]))}}else t.drawElements(F.TRIANGLES,L.lineIndexCount,H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*L.lineIndexStart);R.triangleCount+=L.lineIndexCount/3}}}};const Jt=1/65536;class Kt extends se{constructor(){super(...arguments),this._iconProgramOptions={id:!1,sdf:!1},this._sdfProgramOptions={id:!1},this._spritesTextureSize=ut()}dispose(){}drawMany(e,i){const{drawPhase:t,styleLayerUID:n}=e,s=e.styleLayer;let o;t===W.HITTEST&&(o=ne(n+1)),this._drawIcons(e,s,i,o),this._drawText(e,s,i,o)}_drawIcons(e,i,t,n){const{context:s,displayLevel:o,drawPhase:a,painter:r,spriteMosaic:l,state:h,styleLayerUID:d,requestRender:f,allowDelayedRender:c}=e,g=i.iconMaterial,m=r.vectorTilesMaterialManager;let _,p=!1;for(const D of t)if(D.layerData.has(d)&&(_=D.layerData.get(d),_.iconPerPageElementsMap.size>0)){p=!0;break}if(!p)return;const v=i.getPaintValue("icon-translate",o),P=i.getPaintValue("icon-translate-anchor",o);let I=i.getLayoutValue("icon-rotation-alignment",o);I===U.AUTO&&(I=i.getLayoutValue("symbol-placement",o)===le.POINT?U.VIEWPORT:U.MAP);const x=I===U.MAP,b=i.getLayoutValue("icon-keep-upright",o)&&x,w=_.isIconSDF,y=a===W.HITTEST,S=this._iconProgramOptions;S.id=y,S.sdf=w;const M=m.getMaterialProgram(s,g,S);if(c&&f!=null&&!M.compiled)return void f();s.useProgram(M),M.setUniformMatrix3fv("u_displayViewMat3",I===U.MAP?h.displayViewMat3:h.displayMat3),M.setUniformMatrix3fv("u_displayMat3",P===Y.VIEWPORT?h.displayMat3:h.displayViewMat3),M.setUniform2fv("u_iconTranslation",v),M.setUniform1f("u_depth",i.z),M.setUniform1f("u_mapRotation",ge(h.rotation)),M.setUniform1f("u_keepUpright",b?1:0),M.setUniform1f("u_level",10*o),M.setUniform1i("u_texture",k),M.setUniform1f("u_fadeDuration",ce/1e3),y&&M.setUniform4fv("u_id",n);let T=-1;for(const D of t){if(!D.layerData.has(d)||(D.key.level!==T&&(T=D.key.level,g.setDataUniforms(M,o,i,T,l)),_=D.layerData.get(d),_.iconPerPageElementsMap.size===0))continue;_.prepareForRendering(s),_.updateOpacityInfo();const R=_.iconVAO;if(R!=null){s.bindVAO(R),M.setUniformMatrix3fv("u_dvsMat3",D.transforms.dvs),M.setUniform1f("u_time",(performance.now()-_.lastOpacityUpdate)/1e3);for(const[E,L]of _.iconPerPageElementsMap)this._renderIconRange(e,M,L,E,D)}}}_renderIconRange(e,i,t,n,s){const{context:o,spriteMosaic:a}=e;this._spritesTextureSize[0]=a.getWidth(n)/4,this._spritesTextureSize[1]=a.getHeight(n)/4,i.setUniform2fv("u_mosaicSize",this._spritesTextureSize),a.bind(o,X.LINEAR,n,k),this._setStencilState(e,s),o.drawElements(F.TRIANGLES,t[1],H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*t[0]),s.triangleCount+=t[1]/3}_drawText(e,i,t,n){const{context:s,displayLevel:o,drawPhase:a,glyphMosaic:r,painter:l,pixelRatio:h,spriteMosaic:d,state:f,styleLayerUID:c,requestRender:g,allowDelayedRender:m}=e,_=i.textMaterial,p=l.vectorTilesMaterialManager;let v,P=!1;for(const N of t)if(N.layerData.has(c)&&(v=N.layerData.get(c),v.glyphPerPageElementsMap.size>0)){P=!0;break}if(!P)return;const I=i.getPaintProperty("text-opacity");if(I&&!I.isDataDriven&&I.getValue(o)===0)return;const x=i.getPaintProperty("text-color"),b=!x||x.isDataDriven||x.getValue(o)[3]>0,w=i.getPaintProperty("text-halo-width"),y=i.getPaintProperty("text-halo-color"),S=(!w||w.isDataDriven||w.getValue(o)>0)&&(!y||y.isDataDriven||y.getValue(o)[3]>0);if(!b&&!S)return;const M=24/8;let T=i.getLayoutValue("text-rotation-alignment",o);T===U.AUTO&&(T=i.getLayoutValue("symbol-placement",o)===le.POINT?U.VIEWPORT:U.MAP);const D=T===U.MAP,R=i.getLayoutValue("text-keep-upright",o)&&D,E=a===W.HITTEST,L=.8*M/h;this._glyphTextureSize||(this._glyphTextureSize=ht(r.width/4,r.height/4));const G=i.getPaintValue("text-translate",o),J=i.getPaintValue("text-translate-anchor",o),te=this._sdfProgramOptions;te.id=E;const C=p.getMaterialProgram(s,_,te);if(m&&g!=null&&!C.compiled)return void g();s.useProgram(C),C.setUniformMatrix3fv("u_displayViewMat3",T===U.MAP?f.displayViewMat3:f.displayMat3),C.setUniformMatrix3fv("u_displayMat3",J===Y.VIEWPORT?f.displayMat3:f.displayViewMat3),C.setUniform2fv("u_textTranslation",G),C.setUniform1f("u_depth",i.z+Jt),C.setUniform2fv("u_mosaicSize",this._glyphTextureSize),C.setUniform1f("u_mapRotation",ge(f.rotation)),C.setUniform1f("u_keepUpright",R?1:0),C.setUniform1f("u_level",10*o),C.setUniform1i("u_texture",pe),C.setUniform1f("u_antialiasingWidth",L),C.setUniform1f("u_fadeDuration",ce/1e3),E&&C.setUniform4fv("u_id",n);let Q=-1;for(const N of t){if(!N.layerData.has(c)||(N.key.level!==Q&&(Q=N.key.level,_.setDataUniforms(C,o,i,Q,d)),v=N.layerData.get(c),v.glyphPerPageElementsMap.size===0))continue;v.prepareForRendering(s),v.updateOpacityInfo();const ue=v.textVAO;if(ue==null)continue;s.bindVAO(ue),C.setUniformMatrix3fv("u_dvsMat3",N.transforms.dvs),this._setStencilState(e,N);const Ve=(performance.now()-v.lastOpacityUpdate)/1e3;C.setUniform1f("u_time",Ve),v.glyphPerPageElementsMap.forEach((Fe,qe)=>{this._renderGlyphRange(s,Fe,qe,r,C,S,b,N)})}}_renderGlyphRange(e,i,t,n,s,o,a,r){n.bind(e,X.LINEAR,t,pe),o&&(s.setUniform1f("u_halo",1),e.drawElements(F.TRIANGLES,i[1],H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*i[0]),r.triangleCount+=i[1]/3),a&&(s.setUniform1f("u_halo",0),e.drawElements(F.TRIANGLES,i[1],H.UNSIGNED_INT,Uint32Array.BYTES_PER_ELEMENT*i[0]),r.triangleCount+=i[1]/3)}_setStencilState(e,i){const{context:t,is3D:n,stencilSymbols:s}=e;if(t.setStencilTestEnabled(!0),s)return t.setStencilWriteMask(255),void t.setStencilFunction(V.ALWAYS,i.stencilRef,255);t.setStencilWriteMask(0),n?t.setStencilFunction(V.EQUAL,i.stencilRef,255):t.setStencilFunction(V.GREATER,255,255)}}const Yt={vtlBackground:Ht,vtlFill:Bt,vtlLine:Gt,vtlCircle:Wt,vtlSymbol:Kt},Xt={background:{"background.frag":`#ifdef PATTERN -uniform lowp float u_opacity; -uniform lowp sampler2D u_texture; -varying mediump vec4 v_tlbr; -varying mediump vec2 v_tileTextureCoord; -#else -uniform lowp vec4 u_color; -#endif -#ifdef ID -varying mediump vec4 v_id; -#endif -void main() { -#ifdef PATTERN -mediump vec2 normalizedTextureCoord = mod(v_tileTextureCoord, 1.0); -mediump vec2 samplePos = mix(v_tlbr.xy, v_tlbr.zw, normalizedTextureCoord); -lowp vec4 color = texture2D(u_texture, samplePos); -gl_FragColor = u_opacity * color; -#else -gl_FragColor = u_color; -#endif -#ifdef ID -if (gl_FragColor.a < 1.0 / 255.0) { -discard; -} -gl_FragColor = v_id; -#endif -}`,"background.vert":`precision mediump float; -attribute vec2 a_pos; -#ifdef ID -uniform mediump vec4 u_id; -varying mediump vec4 v_id; -#endif -uniform highp mat3 u_dvsMat3; -uniform mediump float u_coord_range; -uniform mediump float u_depth; -#ifdef PATTERN -uniform mediump mat3 u_pattern_matrix; -varying mediump vec2 v_tileTextureCoord; -uniform mediump vec4 u_tlbr; -uniform mediump vec2 u_mosaicSize; -varying mediump vec4 v_tlbr; -#endif -void main() { -gl_Position = vec4((u_dvsMat3 * vec3(u_coord_range * a_pos, 1.0)).xy, u_depth, 1.0); -#ifdef PATTERN -v_tileTextureCoord = (u_pattern_matrix * vec3(a_pos, 1.0)).xy; -v_tlbr = u_tlbr / u_mosaicSize.xyxy; -#endif -#ifdef ID -v_id = u_id / 255.0; -#endif -}`},circle:{"circle.frag":`precision lowp float; -varying lowp vec4 v_color; -varying lowp vec4 v_stroke_color; -varying mediump float v_blur; -varying mediump float v_stroke_width; -varying mediump float v_radius; -varying mediump vec2 v_offset; -#ifdef ID -varying mediump vec4 v_id; -#endif -void main() -{ -mediump float dist = length(v_offset); -mediump float alpha = smoothstep(0.0, -v_blur, dist - 1.0); -lowp float color_mix_ratio = v_stroke_width < 0.01 ? 0.0 : smoothstep(-v_blur, 0.0, dist - v_radius / (v_radius + v_stroke_width)); -gl_FragColor = alpha * mix(v_color, v_stroke_color, color_mix_ratio); -#ifdef ID -if (gl_FragColor.a < 1.0 / 255.0) { -discard; -} -gl_FragColor = v_id; -#endif -}`,"circle.vert":`precision mediump float; -attribute vec2 a_pos; -#pragma header -varying lowp vec4 v_color; -varying lowp vec4 v_stroke_color; -varying mediump float v_blur; -varying mediump float v_stroke_width; -varying mediump float v_radius; -varying mediump vec2 v_offset; -#ifdef ID -uniform mediump vec4 u_id; -varying mediump vec4 v_id; -#endif -uniform highp mat3 u_dvsMat3; -uniform highp mat3 u_displayMat3; -uniform mediump vec2 u_circleTranslation; -uniform mediump float u_depth; -uniform mediump float u_antialiasingWidth; -void main() -{ -#pragma main -v_color = color * opacity; -v_stroke_color = stroke_color * stroke_opacity; -v_stroke_width = stroke_width; -v_radius = radius; -v_blur = max(blur, u_antialiasingWidth / (radius + stroke_width)); -mediump vec2 offset = vec2(mod(a_pos, 2.0) * 2.0 - 1.0); -v_offset = offset; -#ifdef ID -v_id = u_id / 255.0; -#endif -mediump vec3 pos = u_dvsMat3 * vec3(a_pos * 0.5, 1.0) + u_displayMat3 * vec3((v_radius + v_stroke_width) * offset + u_circleTranslation, 0.0); -gl_Position = vec4(pos.xy, u_depth, 1.0); -}`},fill:{"fill.frag":`precision lowp float; -#ifdef PATTERN -uniform lowp sampler2D u_texture; -varying mediump vec2 v_tileTextureCoord; -varying mediump vec4 v_tlbr; -#endif -#ifdef ID -varying mediump vec4 v_id; -#endif -varying lowp vec4 v_color; -vec4 mixColors(vec4 color1, vec4 color2) { -float compositeAlpha = color2.a + color1.a * (1.0 - color2.a); -vec3 compositeColor = color2.rgb + color1.rgb * (1.0 - color2.a); -return vec4(compositeColor, compositeAlpha); -} -void main() -{ -#ifdef PATTERN -mediump vec2 normalizedTextureCoord = fract(v_tileTextureCoord); -mediump vec2 samplePos = mix(v_tlbr.xy, v_tlbr.zw, normalizedTextureCoord); -lowp vec4 color = texture2D(u_texture, samplePos); -gl_FragColor = v_color[3] * color; -#else -gl_FragColor = v_color; -#endif -#ifdef ID -if (gl_FragColor.a < 1.0 / 255.0) { -discard; -} -gl_FragColor = v_id; -#endif -}`,"fill.vert":`precision mediump float; -attribute vec2 a_pos; -#pragma header -uniform highp mat3 u_dvsMat3; -uniform highp mat3 u_displayMat3; -uniform mediump float u_depth; -uniform mediump vec2 u_fillTranslation; -#ifdef PATTERN -#include -uniform mediump vec2 u_mosaicSize; -uniform mediump float u_patternFactor; -varying mediump vec2 v_tileTextureCoord; -varying mediump vec4 v_tlbr; -#endif -#ifdef ID -uniform mediump vec4 u_id; -varying mediump vec4 v_id; -#endif -varying lowp vec4 v_color; -void main() -{ -#pragma main -v_color = color * opacity; -#ifdef ID -v_id = u_id / 255.0; -#endif -#ifdef PATTERN -float patternWidth = nextPOT(tlbr.z - tlbr.x); -float patternHeight = nextPOT(tlbr.w - tlbr.y); -float scaleX = 1.0 / (patternWidth * u_patternFactor); -float scaleY = 1.0 / (patternHeight * u_patternFactor); -mat3 patterMat = mat3(scaleX, 0.0, 0.0, -0.0, -scaleY, 0.0, -0.0, 0.0, 1.0); -v_tileTextureCoord = (patterMat * vec3(a_pos, 1.0)).xy; -v_tlbr = tlbr / u_mosaicSize.xyxy; -#endif -vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + u_displayMat3 * vec3(u_fillTranslation, 0.0); -gl_Position = vec4(pos.xy, u_depth, 1.0); -}`},icon:{"icon.frag":`precision mediump float; -uniform lowp sampler2D u_texture; -#ifdef SDF -uniform lowp vec4 u_color; -uniform lowp vec4 u_outlineColor; -#endif -varying mediump vec2 v_tex; -varying lowp float v_opacity; -varying mediump vec2 v_size; -varying lowp vec4 v_color; -#ifdef SDF -varying mediump flaot v_halo_width; -#endif -#ifdef ID -varying mediump vec4 v_id; -#endif -#include -vec4 mixColors(vec4 color1, vec4 color2) { -float compositeAlpha = color2.a + color1.a * (1.0 - color2.a); -vec3 compositeColor = color2.rgb + color1.rgb * (1.0 - color2.a); -return vec4(compositeColor, compositeAlpha); -} -void main() -{ -#ifdef SDF -lowp vec4 fillPixelColor = v_color; -float d = rgba2float(texture2D(u_texture, v_tex)) - 0.5; -const float softEdgeRatio = 0.248062016; -float size = max(v_size.x, v_size.y); -float dist = d * softEdgeRatio * size; -fillPixelColor *= clamp(0.5 - dist, 0.0, 1.0); -if (v_halo_width > 0.25) { -lowp vec4 outlinePixelColor = u_outlineColor; -const float outlineLimitRatio = (16.0 / 86.0); -float clampedOutlineSize = softEdgeRatio * min(v_halo_width, outlineLimitRatio * max(v_size.x, v_size.y)); -outlinePixelColor *= clamp(0.5 - (abs(dist) - clampedOutlineSize), 0.0, 1.0); -gl_FragColor = v_opacity * mixColors(fillPixelColor, outlinePixelColor); -} -else { -gl_FragColor = v_opacity * fillPixelColor; -} -#else -lowp vec4 texColor = texture2D(u_texture, v_tex); -gl_FragColor = v_opacity * texColor; -#endif -#ifdef ID -if (gl_FragColor.a < 1.0 / 255.0) { -discard; -} -gl_FragColor = v_id; -#endif -}`,"icon.vert":`attribute vec2 a_pos; -attribute vec2 a_vertexOffset; -attribute vec4 a_texAngleRange; -attribute vec4 a_levelInfo; -attribute float a_opacityInfo; -#pragma header -#ifdef ID -uniform mediump vec4 u_id; -varying mediump vec4 v_id; -#endif -varying lowp vec4 v_color; -#ifdef SDF -varying mediump float v_halo_width; -#endif -uniform highp mat3 u_dvsMat3; -uniform highp mat3 u_displayMat3; -uniform highp mat3 u_displayViewMat3; -uniform mediump vec2 u_iconTranslation; -uniform vec2 u_mosaicSize; -uniform mediump float u_depth; -uniform mediump float u_mapRotation; -uniform mediump float u_level; -uniform lowp float u_keepUpright; -uniform mediump float u_fadeDuration; -varying mediump vec2 v_tex; -varying lowp float v_opacity; -varying mediump vec2 v_size; -const float C_OFFSET_PRECISION = 1.0 / 8.0; -const float C_256_TO_RAD = 3.14159265359 / 128.0; -const float C_DEG_TO_RAD = 3.14159265359 / 180.0; -const float tileCoordRatio = 1.0 / 8.0; -uniform highp float u_time; -void main() -{ -#pragma main -v_color = color; -v_opacity = opacity; -#ifdef SDF -v_halo_width = halo_width; -#endif -float modded = mod(a_opacityInfo, 128.0); -float targetOpacity = (a_opacityInfo - modded) / 128.0; -float startOpacity = modded / 127.0; -float interpolatedOpacity = clamp(startOpacity + 2.0 * (targetOpacity - 0.5) * u_time / u_fadeDuration, 0.0, 1.0); -v_opacity *= interpolatedOpacity; -mediump float a_angle = a_levelInfo[1]; -mediump float a_minLevel = a_levelInfo[2]; -mediump float a_maxLevel = a_levelInfo[3]; -mediump vec2 a_tex = a_texAngleRange.xy; -mediump float delta_z = 0.0; -mediump float rotated = mod(a_angle + u_mapRotation, 256.0); -delta_z += (1.0 - step(u_keepUpright, 0.0)) * step(64.0, rotated) * (1.0 - step(192.0, rotated)); -delta_z += 1.0 - step(a_minLevel, u_level); -delta_z += step(a_maxLevel, u_level); -delta_z += step(v_opacity, 0.0); -vec2 offset = C_OFFSET_PRECISION * a_vertexOffset; -v_size = abs(offset); -#ifdef SDF -offset = (120.0 / 86.0) * offset; -#endif -mediump vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + u_displayViewMat3 * vec3(size * offset, 0.0) + u_displayMat3 * vec3(u_iconTranslation, 0.0); -gl_Position = vec4(pos.xy, u_depth + delta_z, 1.0); -#ifdef ID -v_id = u_id / 255.0; -#endif -v_tex = a_tex.xy / u_mosaicSize; -}`},line:{"line.frag":`precision lowp float; -varying mediump vec2 v_normal; -varying highp float v_accumulatedDistance; -varying mediump float v_lineHalfWidth; -varying lowp vec4 v_color; -varying mediump float v_blur; -#if defined (PATTERN) || defined(SDF) -varying mediump vec4 v_tlbr; -varying mediump vec2 v_patternSize; -varying mediump float v_widthRatio; -uniform sampler2D u_texture; -uniform mediump float u_antialiasing; -#endif -#ifdef SDF -#include -#endif -#ifdef ID -varying mediump vec4 v_id; -#endif -void main() -{ -mediump float fragDist = length(v_normal) * v_lineHalfWidth; -lowp float alpha = clamp((v_lineHalfWidth - fragDist) / v_blur, 0.0, 1.0); -#ifdef PATTERN -mediump float relativeTexX = fract(v_accumulatedDistance / (v_patternSize.x * v_widthRatio)); -mediump float relativeTexY = 0.5 + v_normal.y * v_lineHalfWidth / (v_patternSize.y * v_widthRatio); -mediump vec2 texCoord = mix(v_tlbr.xy, v_tlbr.zw, vec2(relativeTexX, relativeTexY)); -lowp vec4 color = texture2D(u_texture, texCoord); -gl_FragColor = alpha * v_color[3] * color; -#elif defined(SDF) -mediump float relativeTexX = fract((v_accumulatedDistance * 0.5) / (v_patternSize.x * v_widthRatio)); -mediump float relativeTexY = 0.5 + 0.25 * v_normal.y; -mediump vec2 texCoord = mix(v_tlbr.xy, v_tlbr.zw, vec2(relativeTexX, relativeTexY)); -mediump float d = rgba2float(texture2D(u_texture, texCoord)) - 0.5; -float dist = d * (v_lineHalfWidth + u_antialiasing / 2.0); -gl_FragColor = alpha * clamp(0.5 - dist, 0.0, 1.0) * v_color; -#else -gl_FragColor = alpha * v_color; -#endif -#ifdef ID -if (gl_FragColor.a < 1.0 / 255.0) { -discard; -} -gl_FragColor = v_id; -#endif -}`,"line.vert":`precision mediump float; -attribute vec2 a_pos; -attribute vec4 a_extrude_offset; -attribute vec4 a_dir_normal; -attribute vec2 a_accumulatedDistance; -#pragma header -uniform highp mat3 u_dvsMat3; -uniform highp mat3 u_displayMat3; -uniform highp mat3 u_displayViewMat3; -uniform mediump float u_zoomFactor; -uniform mediump vec2 u_lineTranslation; -uniform mediump float u_antialiasing; -uniform mediump float u_depth; -varying mediump vec2 v_normal; -varying highp float v_accumulatedDistance; -const float scale = 1.0 / 31.0; -const mediump float tileCoordRatio = 8.0; -#if defined (SDF) -const mediump float sdfPatternHalfWidth = 15.5; -#endif -#if defined (PATTERN) || defined(SDF) -uniform mediump vec2 u_mosaicSize; -varying mediump vec4 v_tlbr; -varying mediump vec2 v_patternSize; -varying mediump float v_widthRatio; -#endif -#ifdef ID -uniform mediump vec4 u_id; -varying mediump vec4 v_id; -#endif -varying lowp vec4 v_color; -varying mediump float v_lineHalfWidth; -varying mediump float v_blur; -void main() -{ -#pragma main -v_color = color * opacity; -v_blur = blur + u_antialiasing; -v_normal = a_dir_normal.zw * scale; -#if defined (PATTERN) || defined(SDF) -v_tlbr = tlbr / u_mosaicSize.xyxy; -v_patternSize = vec2(tlbr.z - tlbr.x, tlbr.y - tlbr.w); -#if defined (PATTERN) -v_widthRatio = width / v_patternSize.y; -#else -v_widthRatio = width / sdfPatternHalfWidth / 2.0; -#endif -#endif -v_lineHalfWidth = (width + u_antialiasing) * 0.5; -mediump vec2 dir = a_dir_normal.xy * scale; -mediump vec2 offset_ = a_extrude_offset.zw * scale * offset; -mediump vec2 dist = v_lineHalfWidth * scale * a_extrude_offset.xy; -mediump vec3 pos = u_dvsMat3 * vec3(a_pos + offset_ * tileCoordRatio / u_zoomFactor, 1.0) + u_displayViewMat3 * vec3(dist, 0.0) + u_displayMat3 * vec3(u_lineTranslation, 0.0); -gl_Position = vec4(pos.xy, u_depth, 1.0); -#if defined (PATTERN) || defined(SDF) -v_accumulatedDistance = a_accumulatedDistance.x * u_zoomFactor / tileCoordRatio + dot(dir, dist + offset_); -#endif -#ifdef ID -v_id = u_id / 255.0; -#endif -}`},outline:{"outline.frag":`varying lowp vec4 v_color; -varying mediump vec2 v_normal; -#ifdef ID -varying mediump vec4 v_id; -#endif -void main() -{ -lowp float dist = abs(v_normal.y); -lowp float alpha = smoothstep(1.0, 0.0, dist); -gl_FragColor = alpha * v_color; -#ifdef ID -if (gl_FragColor.a < 1.0 / 255.0) { -discard; -} -gl_FragColor = v_id; -#endif -}`,"outline.vert":`attribute vec2 a_pos; -attribute vec2 a_offset; -attribute vec2 a_xnormal; -#pragma header -varying lowp vec4 v_color; -#ifdef ID -uniform mediump vec4 u_id; -varying mediump vec4 v_id; -#endif -uniform highp mat3 u_dvsMat3; -uniform highp mat3 u_displayMat3; -uniform mediump vec2 u_fillTranslation; -uniform mediump float u_depth; -uniform mediump float u_outline_width; -varying lowp vec2 v_normal; -const float scale = 1.0 / 15.0; -void main() -{ -#pragma main -v_color = color * opacity; -#ifdef ID -v_id = u_id / 255.0; -#endif -v_normal = a_xnormal; -mediump vec2 dist = u_outline_width * scale * a_offset; -mediump vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + u_displayMat3 * vec3(dist + u_fillTranslation, 0.0); -gl_Position = vec4(pos.xy, u_depth, 1.0); -}`},text:{"text.frag":`uniform lowp sampler2D u_texture; -varying lowp vec2 v_tex; -varying lowp vec4 v_color; -varying mediump float v_edgeWidth; -varying mediump float v_edgeDistance; -#ifdef ID -varying mediump vec4 v_id; -#endif -void main() -{ -lowp float dist = texture2D(u_texture, v_tex).a; -mediump float alpha = smoothstep(v_edgeDistance - v_edgeWidth, v_edgeDistance + v_edgeWidth, dist); -gl_FragColor = alpha * v_color; -#ifdef ID -if (gl_FragColor.a < 1.0 / 255.0) { -discard; -} -gl_FragColor = v_id; -#endif -}`,"text.vert":`attribute vec2 a_pos; -attribute vec2 a_vertexOffset; -attribute vec4 a_texAngleRange; -attribute vec4 a_levelInfo; -attribute float a_opacityInfo; -#pragma header -varying lowp vec4 v_color; -#ifdef ID -uniform mediump vec4 u_id; -varying mediump vec4 v_id; -#endif -uniform highp mat3 u_dvsMat3; -uniform highp mat3 u_displayMat3; -uniform highp mat3 u_displayViewMat3; -uniform mediump vec2 u_textTranslation; -uniform vec2 u_mosaicSize; -uniform mediump float u_depth; -uniform mediump float u_mapRotation; -uniform mediump float u_level; -uniform lowp float u_keepUpright; -uniform mediump float u_fadeDuration; -varying lowp vec2 v_tex; -const float offsetPrecision = 1.0 / 8.0; -const mediump float edgePos = 0.75; -uniform mediump float u_antialiasingWidth; -varying mediump float v_edgeDistance; -varying mediump float v_edgeWidth; -uniform lowp float u_halo; -const float sdfFontScale = 1.0 / 24.0; -const float sdfPixel = 3.0; -uniform highp float u_time; -void main() -{ -#pragma main -if (u_halo > 0.5) -{ -v_color = halo_color * opacity; -halo_width *= sdfPixel; -halo_blur *= sdfPixel; -} -else -{ -v_color = color * opacity; -halo_width = 0.0; -halo_blur = 0.0; -} -float modded = mod(a_opacityInfo, 128.0); -float targetOpacity = (a_opacityInfo - modded) / 128.0; -float startOpacity = modded / 127.0; -float interpolatedOpacity = clamp(startOpacity + 2.0 * (targetOpacity - 0.5) * u_time / u_fadeDuration, 0.0, 1.0); -v_color *= interpolatedOpacity; -mediump float a_angle = a_levelInfo[1]; -mediump float a_minLevel = a_levelInfo[2]; -mediump float a_maxLevel = a_levelInfo[3]; -mediump vec2 a_tex = a_texAngleRange.xy; -mediump float a_visMinAngle = a_texAngleRange.z; -mediump float a_visMaxAngle = a_texAngleRange.w; -mediump float delta_z = 0.0; -mediump float angle = mod(a_angle + u_mapRotation, 256.0); -if (a_visMinAngle < a_visMaxAngle) -{ -delta_z += (1.0 - step(u_keepUpright, 0.0)) * (step(a_visMaxAngle, angle) + (1.0 - step(a_visMinAngle, angle))); -} -else -{ -delta_z += (1.0 - step(u_keepUpright, 0.0)) * (step(a_visMaxAngle, angle) * (1.0 - step(a_visMinAngle, angle))); -} -delta_z += 1.0 - step(a_minLevel, u_level); -delta_z += step(a_maxLevel, u_level); -delta_z += step(v_color[3], 0.0); -v_tex = a_tex.xy / u_mosaicSize; -#ifdef ID -v_id = u_id / 255.0; -#endif -v_edgeDistance = edgePos - halo_width / size; -v_edgeWidth = (u_antialiasingWidth + halo_blur) / size; -mediump vec3 pos = u_dvsMat3 * vec3(a_pos, 1.0) + sdfFontScale * u_displayViewMat3 * vec3(offsetPrecision * size * a_vertexOffset, 0.0) + u_displayMat3 * vec3(u_textTranslation, 0.0); -gl_Position = vec4(pos.xy, u_depth + delta_z, 1.0); -}`},util:{"encoding.glsl":`const vec4 rgba2float_factors = vec4( -255.0 / (256.0), -255.0 / (256.0 * 256.0), -255.0 / (256.0 * 256.0 * 256.0), -255.0 / (256.0 * 256.0 * 256.0 * 256.0) -); -float rgba2float(vec4 rgba) { -return dot(rgba, rgba2float_factors); -}`,"util.glsl":`float nextPOT(in float x) { -return pow(2.0, ceil(log2(abs(x)))); -}`}};let jt=class{constructor(e){this._readFile=e}resolveIncludes(e){return this._resolve(e)}_resolve(e,i=new Map){if(i.has(e))return i.get(e);const t=this._read(e);if(!t)throw new Error(`cannot find shader file ${e}`);const n=/^[^\S\n]*#include\s+<(\S+)>[^\S\n]?/gm;let s=n.exec(t);const o=[];for(;s!=null;)o.push({path:s[1],start:s.index,length:s[0].length}),s=n.exec(t);let a=0,r="";return o.forEach(l=>{r+=t.slice(a,l.start),r+=i.has(l.path)?"":this._resolve(l.path,i),a=l.start+l.length}),r+=t.slice(a),i.set(e,r),r}_read(e){return this._readFile(e)}};function Qt(u){let e=Xt;return u.split("/").forEach(i=>{e&&(e=e[i])}),e}const Zt=new jt(Qt);function z(u){return Zt.resolveIncludes(u)}function ei(u){const{options:e,value:i}=u;return typeof e[i]=="number"}function j(u){let e="";for(const i in u){const t=u[i];if(typeof t=="boolean")t&&(e+=`#define ${i} -`);else if(typeof t=="number")e+=`#define ${i} ${t.toFixed()} -`;else if(typeof t=="object")if(ei(t)){const{value:n,options:s,namespace:o}=t,a=o?`${o}_`:"";for(const r in s)e+=`#define ${a}${r} ${s[r].toFixed()} -`;e+=`#define ${i} ${a}${n} -`}else{const n=t.options;let s=0;for(const o in n)e+=`#define ${n[o]} ${(s++).toFixed()} -`;e+=`#define ${i} ${n[t.value]} -`}}return e}const Te=u=>j({ID:u.id,PATTERN:u.pattern}),ti={shaders:u=>({vertexShader:Te(u)+z("background/background.vert"),fragmentShader:Te(u)+z("background/background.frag")})},Pe=u=>j({ID:u.id}),ii={shaders:u=>({vertexShader:Pe(u)+z("circle/circle.vert"),fragmentShader:Pe(u)+z("circle/circle.frag")})},Ie=u=>j({ID:u.id,PATTERN:u.pattern}),ni={shaders:u=>({vertexShader:Ie(u)+z("fill/fill.vert"),fragmentShader:Ie(u)+z("fill/fill.frag")})},Me=u=>j({ID:u.id}),si={shaders:u=>({vertexShader:Me(u)+z("outline/outline.vert"),fragmentShader:Me(u)+z("outline/outline.frag")})},Re=u=>j({ID:u.id,SDF:u.sdf}),oi={shaders:u=>({vertexShader:Re(u)+z("icon/icon.vert"),fragmentShader:Re(u)+z("icon/icon.frag")})},De=u=>j({ID:u.id,PATTERN:u.pattern,SDF:u.sdf}),ai={shaders:u=>({vertexShader:De(u)+z("line/line.vert"),fragmentShader:De(u)+z("line/line.frag")})},Ce=u=>j({ID:u.id}),ri={shaders:u=>({vertexShader:Ce(u)+z("text/text.vert"),fragmentShader:Ce(u)+z("text/text.frag")})};let li=class{constructor(){this._programByKey=new Map}dispose(){this._programByKey.forEach(e=>e.dispose()),this._programByKey.clear()}getMaterialProgram(e,i,t){const n=i.key<<3|this._getMaterialOptionsValue(i.type,t);if(this._programByKey.has(n))return this._programByKey.get(n);const s=this._getProgramTemplate(i.type),{shaders:o}=s,{vertexShader:a,fragmentShader:r}=o(t),l=i.getShaderHeader(),h=i.getShaderMain(),d=a.replace("#pragma header",l).replace("#pragma main",h),f=e.programCache.acquire(d,r,i.getAttributeLocations());return this._programByKey.set(n,f),f}_getMaterialOptionsValue(e,i){switch(e){case A.BACKGROUND:{const t=i;return(t.pattern?1:0)<<1|(t.id?1:0)}case A.FILL:{const t=i;return(t.pattern?1:0)<<1|(t.id?1:0)}case A.OUTLINE:return i.id?1:0;case A.LINE:{const t=i;return(t.sdf?1:0)<<2|(t.pattern?1:0)<<1|(t.id?1:0)}case A.ICON:{const t=i;return(t.sdf?1:0)<<1|(t.id?1:0)}case A.CIRCLE:return i.id?1:0;case A.TEXT:return i.id?1:0;default:return 0}}_getProgramTemplate(e){switch(e){case A.BACKGROUND:return ti;case A.CIRCLE:return ii;case A.FILL:return ni;case A.ICON:return oi;case A.LINE:return ai;case A.OUTLINE:return si;case A.TEXT:return ri;default:return null}}};const Z=1e-6;class Ee{constructor(e,i){this.spriteMosaic=e,this.glyphMosaic=i,this._brushCache=new Map,this._vtlMaterialManager=new li}dispose(){this._brushCache&&(this._brushCache.forEach(e=>e.dispose()),this._brushCache=null),this._vtlMaterialManager=Oe(this._vtlMaterialManager),this.spriteMosaic.dispose(),this.glyphMosaic.dispose()}get vectorTilesMaterialManager(){return this._vtlMaterialManager}drawSymbols(e,i,t){const n=t.layers;e.renderPass="translucent";for(let s=0;sr+Z||o.maxzoom!==void 0&&o.maxzoom<=r-Z||(e.styleLayerUID=o.uid,e.styleLayer=o,this._drawWithBrush(e,i,"vtlSymbol"))}}drawBackground(e,i,t){if(t.backgroundBucketIds.length===0)return;const{context:n,displayLevel:s,requiredLevel:o}=e;i.key.level=o,n.setBlendingEnabled(!0),n.setDepthTestEnabled(!1),n.setStencilTestEnabled(!1),e.renderPass="background",t.backgroundBucketIds.forEach(a=>{const r=t.getLayerById(a);if(r.type!==K.BACKGROUND)return;const l=r.getLayoutProperty("visibility");l&&l.getValue()===ae.NONE||r.minzoom!==void 0&&r.minzoom>s+Z||r.maxzoom!==void 0&&r.maxzoom<=s-Z||(e.styleLayerUID=r.uid,e.styleLayer=r,this._drawWithBrush(e,i,"vtlBackground"))})}drawTile(e,i,t,n){const{context:s}=e,o=t.layers;s.setBlendingEnabled(!1),s.setDepthTestEnabled(!0),s.setDepthWriteEnabled(!0),s.setDepthFunction(V.LEQUAL),e.renderPass="opaque";for(let a=o.length-1;a>=0;a--){const r=o[a];n!=null&&n!==r.type||this._renderStyleLayer(r,e,i,!1)}s.setDepthWriteEnabled(!1),s.setBlendingEnabled(!0),s.setBlendFunctionSeparate(oe.ONE,oe.ONE_MINUS_SRC_ALPHA,oe.ONE,oe.ONE_MINUS_SRC_ALPHA),e.renderPass="translucent";for(let a=0;ar+Z||e.maxzoom!==void 0&&e.maxzoom<=r-Z)return;const{context:l}=i;l.setStencilTestEnabled(!1),l.setStencilWriteMask(0),i.styleLayerUID=e.uid,i.styleLayer=e,this._drawWithBrush(i,t,a)}_drawWithBrush(e,i,t){if(!this._brushCache.has(t)){const n=Yt[t];this._brushCache.set(t,new n)}this._brushCache.get(t).drawMany(e,[i])}}let O=class extends Tt(St(Pt)){constructor(){super(...arguments),this._tileHandlerController=null,this.type="vector-tile-3d",this.levelShift=_e("disable-feature:vtl-level-shift")?0:1}initialize(){if(this.layer.fullExtent==null)return void this.addResolvingPromise(Promise.reject(new dt("vectortilelayerview:full-extent-undefined","This layer view's layer does not define a fullExtent.")));const{basemapTerrain:u,spatialReference:e,state:i,viewingMode:t}=this.view,n=t==="local"&&!ft(e)||_t.force512VTL,s=this.layer.tileInfo.spatialReference.isGeographic,o=n?this.layer.tileInfo:this.layer.tileInfo.getOrCreateCompatible(256,s?1:2),a=this._getTileInfoSupportError(o,this.layer.fullExtent);if(a!=null)return this.addResolvingPromise(Promise.reject(a));const r=mt(()=>{var _,p;return(p=(_=this.view)==null?void 0:_.basemapTerrain)==null?void 0:p.tilingSchemeLocked}).then(()=>{var w,y,S;const _=u.tilingScheme,p=_.pixelSize,v=p===256?1:2,P=(w=u.spatialReference)!=null&&w.isGeographic&&p===256?1:0,I=(y=u.spatialReference)!=null&&y.isGeographic||p!==256?0:1;let x;if(this.schemaHelper=new It(v,P,this.levelShift+I),p===256){const M=this.layer.tileInfo.spatialReference.isGeographic;x=this.layer.tileInfo.getOrCreateCompatible(256,M?1:2)}else x=(S=this.view.spatialReference)!=null&&S.isGeographic?this.layer.tileInfo.getOrCreateCompatible(512,.5):this.layer.tileInfo;const b=this._getTileInfoCompatibilityError(x,_);if(b)throw b;this.tileInfo=x});this._tileHandlerController=new AbortController;const l=this.view.resourceController;this._memCache=l.memoryController.newCache(`vtl-${this.layer.uid}`,_=>{_.release()}),this.addHandles(pt(()=>this.view.qualitySettings.memoryLimit,_=>this._memCache.maxSize=Math.ceil(_/10*1048576),gt));const h=new ye(this.layer.currentStyleInfo.style);this._tileHandler=new be(this.layer,h,i.contentPixelRatio,this._memCache);const d=this._tileHandlerController.signal,f=ci(l),c=this._tileHandler.start({signal:d,schedule:f}),g=this._tileHandler.spriteMosaic;g.then(_=>{!yt(d)&&this._tileHandler&&(this.painter=new Ee(_,this._tileHandler.glyphMosaic))}),c.then(()=>this._tileHandlerController=null),this._updatingHandles.add(()=>{var _;return{style:this.layer.currentStyleInfo.style,pixelRatio:(_=this.view.state)==null?void 0:_.contentPixelRatio}},({style:_,pixelRatio:p})=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();const v=new ye(_),P=new be(this.layer,v,p,this._memCache),I=P.start({signal:this._tileHandlerController.signal,schedule:f}),x=P.spriteMosaic;I.then(()=>this._tileHandlerController=null),this._updatingHandles.addPromise(Promise.all([I,x]).then(([,b])=>{const w=this._tileHandler,y=this.painter;this.painter=new Ee(b,P.glyphMosaic),this._tileHandler=P,this.emit("data-changed"),w.destroy(),y&&y.dispose()}))});const m=Promise.all([r,c,g]);this.addResolvingPromise(m)}destroy(){this.painter=Oe(this.painter),this._tileHandlerController=ze(this._tileHandlerController),this._tileHandler=me(this._tileHandler),this._memCache=me(this._memCache)}get contentZoom(){return _e("disable-feature:vtl-level-shift")?1:this.view.qualitySettings.tiledSurface.vtlContentZoom}get displayLevelRange(){const u=this.tileInfo.lods,e=this.layer.minScale||u[0].scale,i=this.layer.maxScale||u[u.length-1].scale,t=this.levelRangeFromScaleRange(e,i);return this.layer.maxScale?t.maxLevel++:t.maxLevel+=this.levelShift,t}get dataScaleRange(){const u=this.tileInfo.lods;return{minScale:u[0].scale,maxScale:u[u.length-1].scale}}get dataLevelRange(){const{minScale:u,maxScale:e}=this.dataScaleRange,i=this.levelRangeFromScaleRange(u,e);return i.minLevel===1&&this.tileInfo.size[0]===256&&(i.minLevel=0),i.maxLevel+=this.levelShift,i}async fetchTile(u,e,i,t){return this._tileHandler.getVectorTile(u,e,i,t)}};q([B()],O.prototype,"layer",void 0),q([B()],O.prototype,"levelShift",void 0),q([B()],O.prototype,"contentZoom",null),q([B()],O.prototype,"displayLevelRange",null),q([B()],O.prototype,"tileInfo",void 0),q([B()],O.prototype,"dataScaleRange",null),q([B()],O.prototype,"dataLevelRange",null),q([B()],O.prototype,"updatingProgressValue",void 0),O=q([vt("esri.views.3d.layers.VectorTileLayerView3D")],O);const Wi=O;function ci(u){return e=>u.immediate.schedule(e)}export{Wi as default}; diff --git a/dist/assets/VertexSnappingCandidate-sgrBHAMS.js b/dist/assets/VertexSnappingCandidate-YEvkEqQJ.js similarity index 51% rename from dist/assets/VertexSnappingCandidate-sgrBHAMS.js rename to dist/assets/VertexSnappingCandidate-YEvkEqQJ.js index c7447eb..cd2fdb4 100644 --- a/dist/assets/VertexSnappingCandidate-sgrBHAMS.js +++ b/dist/assets/VertexSnappingCandidate-YEvkEqQJ.js @@ -1 +1 @@ -import{gA as r,gB as s}from"./index-J0iiHjMT.js";import{n}from"./PointSnappingHint-ULetRXiW.js";class a extends r{constructor(t){super({...t,constraint:new s(t.targetPoint)})}get hints(){return[new n(this.targetPoint,this.isDraped,this.domain)]}}export{a as r}; +import{gx as r,gy as s}from"./index-pCX-0tJH.js";import{n}from"./PointSnappingHint-bwlQAyn6.js";class a extends r{constructor(t){super({...t,constraint:new s(t.targetPoint)})}get hints(){return[new n(this.targetPoint,this.isDraped,this.domain)]}}export{a as r}; diff --git a/dist/assets/VerticesVisualElement-oQAA_hbc.js b/dist/assets/VerticesVisualElement-QZStMB48.js similarity index 92% rename from dist/assets/VerticesVisualElement-oQAA_hbc.js rename to dist/assets/VerticesVisualElement-QZStMB48.js index 1094751..d6cbe41 100644 --- a/dist/assets/VerticesVisualElement-oQAA_hbc.js +++ b/dist/assets/VerticesVisualElement-QZStMB48.js @@ -1 +1 @@ -import{h$ as u,i0 as x,b2 as O,i1 as d,b4 as _,b5 as v,bq as z,as as g,i2 as p,aa as S,i3 as G}from"./index-J0iiHjMT.js";import{a as y}from"./Object3DVisualElement-TMb7y_wl.js";import{j as m}from"./ShadedColorMaterial.glsl-Fp4o6LjC.js";function P(a,e,r,o,n){const t=u(3*a.length),h=u(t.length);a.forEach((s,c)=>{t[3*c]=s[0],t[3*c+1]=s[1],t[3*c+2]=s.length>2?s[2]:0});const l=x(t,e,0,h,0,t,0,t.length/3,r,o,n),i=l!=null;return{numVertices:a.length,position:t,mapPositions:h,projectionSuccess:i,sampledElevation:l}}class w extends y{constructor(e){super(e),this.view=null,this._renderOccluded=O.OccludeAndTransparent,this._vertices=null,this._spatialReference=null,this._color=d([1,127/255,0,1]),this._size=11,this._outlineColor=d([0,0,0,.5]),this._outlineSize=1,this._elevationInfo=null,this.applyProperties(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial(),this._updateOutlineMaterial())}get vertices(){return this._vertices}set vertices(e){this._vertices=e,this.recreateGeometry()}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.recreateGeometry()}get color(){return this._color}set color(e){_(e,this._color)||(v(this._color,e),this._updateMaterial())}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateMaterial())}get outlineColor(){return this._outlineColor}set outlineColor(e){_(e,this._outlineColor)||(v(this._outlineColor,e),this._updateOutlineMaterial())}get outlineSize(){return this._outlineSize}set outlineSize(e){e!==this._outlineSize&&(this._outlineSize=e,this._updateOutlineMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get _vertexMaterialParameters(){return{color:this._color,screenSizeScale:this.size,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}get _vertexOutlineMaterialParameters(){return{color:this._outlineColor,screenSizeScale:this.size+2*this.outlineSize,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateMaterial(){this.attached&&this._vertexMaterial.setParameters(this._vertexMaterialParameters)}_updateOutlineMaterial(){this.attached&&this._vertexOutlineMaterial.setParameters(this._vertexOutlineMaterialParameters)}_createRenderGeometries(){const e=this.vertices;if(e==null||e.length===0)return[];const r=.5,o=.5,n=P(e,this.spatialReference,this.view.elevationProvider,this.view.renderCoordsHelper,z.fromElevationInfo(this.elevationInfo)),t=[],h=n.numVertices,l=n.position;for(let i=0;i{t[3*c]=s[0],t[3*c+1]=s[1],t[3*c+2]=s.length>2?s[2]:0});const l=x(t,e,0,h,0,t,0,t.length/3,r,o,n),i=l!=null;return{numVertices:a.length,position:t,mapPositions:h,projectionSuccess:i,sampledElevation:l}}class w extends y{constructor(e){super(e),this.view=null,this._renderOccluded=O.OccludeAndTransparent,this._vertices=null,this._spatialReference=null,this._color=d([1,127/255,0,1]),this._size=11,this._outlineColor=d([0,0,0,.5]),this._outlineSize=1,this._elevationInfo=null,this.applyProperties(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial(),this._updateOutlineMaterial())}get vertices(){return this._vertices}set vertices(e){this._vertices=e,this.recreateGeometry()}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.recreateGeometry()}get color(){return this._color}set color(e){_(e,this._color)||(v(this._color,e),this._updateMaterial())}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateMaterial())}get outlineColor(){return this._outlineColor}set outlineColor(e){_(e,this._outlineColor)||(v(this._outlineColor,e),this._updateOutlineMaterial())}get outlineSize(){return this._outlineSize}set outlineSize(e){e!==this._outlineSize&&(this._outlineSize=e,this._updateOutlineMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get _vertexMaterialParameters(){return{color:this._color,screenSizeScale:this.size,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}get _vertexOutlineMaterialParameters(){return{color:this._outlineColor,screenSizeScale:this.size+2*this.outlineSize,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateMaterial(){this.attached&&this._vertexMaterial.setParameters(this._vertexMaterialParameters)}_updateOutlineMaterial(){this.attached&&this._vertexOutlineMaterial.setParameters(this._vertexOutlineMaterialParameters)}_createRenderGeometries(){const e=this.vertices;if(e==null||e.length===0)return[];const r=.5,o=.5,n=P(e,this.spatialReference,this.view.elevationProvider,this.view.renderCoordsHelper,z.fromElevationInfo(this.elevationInfo)),t=[],h=n.numVertices,l=n.position;for(let i=0;it.view.ready,s=>{this._resourcesCreated&&(s?this._createResources():this._destroyResources())})}applyProperties(t){let s=!1;for(const e in t)e in this?e==="attached"?s=t[e]:this[e]=t[e]:console.error("Cannot set unknown property",e);this.attached=s}destroy(){this.attached=!1,this._handle.remove()}get attached(){return this._attached}set attached(t){t!==this._attached&&this.view._stage&&(this._attached=t,this._attached&&!this._resourcesCreated?this._createResources():!this._attached&&this._resourcesCreated&&this._destroyResources(),this.onAttachedChange(t))}onAttachedChange(t){}get visible(){return this._visible}set visible(t){t!==this._visible&&(this._visible=t,this.attached&&this.updateVisibility(t))}_createResources(){this.createResources(),this._resourcesCreated=!0,this.updateVisibility(this.visible)}_destroyResources(){this.destroyResources(),this._resourcesCreated=!1}};export{a as t}; +import{B as i}from"./index-pCX-0tJH.js";let a=class{get isDecoration(){return this._isDecoration}set isDecoration(t){this._isDecoration=t}constructor(t){this._isDecoration=!1,this._attached=!1,this._resourcesCreated=!1,this._visible=!0,this.view=t.view,this._handle=i(()=>t.view.ready,s=>{this._resourcesCreated&&(s?this._createResources():this._destroyResources())})}applyProperties(t){let s=!1;for(const e in t)e in this?e==="attached"?s=t[e]:this[e]=t[e]:console.error("Cannot set unknown property",e);this.attached=s}destroy(){this.attached=!1,this._handle.remove()}get attached(){return this._attached}set attached(t){t!==this._attached&&this.view._stage&&(this._attached=t,this._attached&&!this._resourcesCreated?this._createResources():!this._attached&&this._resourcesCreated&&this._destroyResources(),this.onAttachedChange(t))}onAttachedChange(t){}get visible(){return this._visible}set visible(t){t!==this._visible&&(this._visible=t,this.attached&&this.updateVisibility(t))}_createResources(){this.createResources(),this._resourcesCreated=!0,this.updateVisibility(this.visible)}_destroyResources(){this.destroyResources(),this._resourcesCreated=!1}};export{a as t}; diff --git a/dist/assets/VoxelLayer-NKOtejie.js b/dist/assets/VoxelLayer-NKOtejie.js deleted file mode 100644 index 065562a..0000000 --- a/dist/assets/VoxelLayer-NKOtejie.js +++ /dev/null @@ -1 +0,0 @@ -import{aE as $e,aF as ve,up as ae,gr as se,gq as ze,uq as ge,oY as be,ur as Be,aa as Oe,b1 as Q,dq as A,iC as z,iD as R,e as i,y as o,f6 as ee,c as d,dr as v,iz as Ce,eb as ke,ey as $,ab as E,V as c,ef as te,bm as X,c2 as Z,bI as G,Z as Re,ar as Ie,al as Ue,aU as We,us as Je,T as ne,qa as Ye,ut as Ge,at as Qe,iO as Xe,em as Ze,dM as He,dN as Ke,dO as et,dP as tt,en as it,u7 as ot,dQ as st,E as le,dT as Ne,dw as B,il as rt,dV as nt,dW as lt,dt as fe,iv as at,c7 as pt}from"./index-J0iiHjMT.js";const b=Oe(),Se=se(),xe=se(),we=se(),Te=Q(0,0,1),ut=Q(0,1,0),ct=Q(1,0,0);function O(e){$e(b,e),ve(b,b);const t=Math.atan2(b[1],b[0]),s=ae(se(),Te,-t);ze(b,b,s);const r=-1*Math.atan2(b[2],b[0]);return[ge(t)+270,ge(r)+90]}function ie(e,t){return ae(xe,Te,be(e-270)),ae(we,ut,be(t-90)),Be(Se,xe,we),$e(b,ct),ze(b,b,Se),ve(b,b),[b[0],b[1],b[2]]}let I=class extends A(v){constructor(t){super(t),this.enabled=!0,this.label="",this.normal=null,this.point=null}get orientation(){if(!Array.isArray(this.normal)||this.normal.length!==3)return 0;const[t,s]=O(this.normal);return z.normalize(R(t),0,!0)}set orientation(t){const s=ie(t,this.tilt);this._set("normal",s),this._set("orientation",t)}get tilt(){if(!Array.isArray(this.normal)||this.normal.length!==3)return 0;const[t,s]=O(this.normal);return z.normalize(R(s),0,!0)}set tilt(t){const s=ie(this.orientation,t);this._set("normal",s),this._set("tilt",t)}};i([o({type:Boolean,json:{write:!0}})],I.prototype,"enabled",void 0),i([o({type:String,json:{write:!0}})],I.prototype,"label",void 0),i([o({type:Number,json:{read:!1},clonable:!1,range:{min:0,max:360}}),ee(e=>z.normalize(R(e),0,!0))],I.prototype,"orientation",null),i([o({type:Number,json:{read:!1},clonable:!1,range:{min:0,max:360}}),ee(e=>z.normalize(R(e),0,!0))],I.prototype,"tilt",null),i([o({type:[Number],json:{write:!0}})],I.prototype,"normal",void 0),i([o({type:[Number],json:{write:!0}})],I.prototype,"point",void 0),I=i([d("esri.layers.voxel.VoxelSlice")],I);const oe=I;let S=class extends A(v){constructor(){super(...arguments),this.enabled=!0,this.href=null,this.id=null,this.label="",this.normal=null,this.point=null,this.sizeInPixel=null,this.slices=null,this.timeId=0,this.variableId=null}get orientation(){if(!Array.isArray(this.normal)||this.normal.length!==3)return 0;const[t,s]=O(this.normal);return z.normalize(R(t),0,!0)}get tilt(){if(!Array.isArray(this.normal)||this.normal.length!==3)return 0;const[t,s]=O(this.normal);return z.normalize(R(s),0,!0)}};i([o({type:Boolean,json:{default:!0,write:!0}})],S.prototype,"enabled",void 0),i([o({type:String,json:{origins:{service:{read:Ce}},write:{enabled:!0,isRequired:!0}}}),ke({origins:["web-scene"],type:"resource",prefix:"sections",compress:!0})],S.prototype,"href",void 0),i([o({type:$,json:{write:{enabled:!0,isRequired:!0}}})],S.prototype,"id",void 0),i([o({type:String,json:{write:!0}})],S.prototype,"label",void 0),i([o({type:Number,clonable:!1,readOnly:!0,range:{min:0,max:360}})],S.prototype,"orientation",null),i([o({type:Number,clonable:!1,readOnly:!0,range:{min:0,max:360}})],S.prototype,"tilt",null),i([o({type:[Number],json:{write:{enabled:!0,isRequired:!0}}})],S.prototype,"normal",void 0),i([o({type:[Number],json:{write:{enabled:!0,isRequired:!0}}})],S.prototype,"point",void 0),i([o({type:[$],json:{write:{enabled:!0,isRequired:!0}}})],S.prototype,"sizeInPixel",void 0),i([o({type:[oe],json:{write:!0}})],S.prototype,"slices",void 0),i([o({type:$,json:{default:0,write:!0}})],S.prototype,"timeId",void 0),i([o({type:$,json:{write:{enabled:!0,isRequired:!0}}})],S.prototype,"variableId",void 0),S=i([d("esri.layers.voxel.VoxelSection")],S);const pe=S;let k=class extends v{constructor(){super(...arguments),this.diffuseFactor=.5,this.specularFactor=.5}};i([o({type:Number,range:{min:0,max:1},json:{default:.5,write:!0}})],k.prototype,"diffuseFactor",void 0),i([o({type:Number,range:{min:0,max:1},json:{default:.5,write:!0}})],k.prototype,"specularFactor",void 0),k=i([d("esri.layers.voxel.VoxelSimpleShading")],k);const qe=k;let N=class extends v{constructor(){super(...arguments),this.continuity=null,this.hasNoData=!1,this.noData=0,this.offset=0,this.scale=1,this.type=null}};i([o({type:["discrete","continuous"],json:{write:!0}})],N.prototype,"continuity",void 0),i([o({type:Boolean,json:{write:!0}})],N.prototype,"hasNoData",void 0),i([o({type:Number,json:{write:!0}})],N.prototype,"noData",void 0),i([o({type:Number,json:{write:!0}})],N.prototype,"offset",void 0),i([o({type:Number,json:{write:!0}})],N.prototype,"scale",void 0),i([o({type:String,json:{write:{enabled:!0,isRequired:!0}}})],N.prototype,"type",void 0),N=i([d("esri.layers.voxel.VoxelFormat")],N);const Ve=N;let j=class extends v{constructor(){super(...arguments),this.id=null,this.description="",this.name=null,this.originalFormat=null,this.renderingFormat=null,this.unit="",this.volumeId=0,this.type=null}};i([o({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],j.prototype,"id",void 0),i([o({type:String,json:{write:!0}})],j.prototype,"description",void 0),i([o({type:String,json:{write:{enabled:!0,isRequired:!0}}})],j.prototype,"name",void 0),i([o({type:Ve,json:{write:!0}})],j.prototype,"originalFormat",void 0),i([o({type:Ve,json:{write:{enabled:!0,isRequired:!0}}})],j.prototype,"renderingFormat",void 0),i([o({type:String,json:{write:!0}})],j.prototype,"unit",void 0),i([o({type:Number,json:{write:!0}})],j.prototype,"volumeId",void 0),i([o({type:["stc-hot-spot-results","stc-cluster-outlier-results","stc-estimated-bin","generic-nearest-interpolated"],json:{write:!0}})],j.prototype,"type",void 0),j=i([d("esri.layers.voxel.VoxelVariable")],j);const yt=j;let F=class extends A(v){constructor(){super(...arguments),this.color=E.fromArray([0,0,0,0]),this.value=0,this.enabled=!0,this.label="",this.colorLocked=!1}};i([o({type:E,json:{type:[$],write:{enabled:!0,isRequired:!0}}})],F.prototype,"color",void 0),i([o({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],F.prototype,"value",void 0),i([o({type:Boolean,json:{default:!0,write:!0}})],F.prototype,"enabled",void 0),i([o({type:String,json:{write:!0}})],F.prototype,"label",void 0),i([o({type:Boolean,json:{default:!1,write:!0}})],F.prototype,"colorLocked",void 0),F=i([d("esri.layers.voxel.VoxelIsosurface")],F);const De=F;let U=class extends A(v){constructor(){super(...arguments),this.color=null,this.position=0}};i([o({type:E,json:{type:[$],write:{enabled:!0,isRequired:!0}}})],U.prototype,"color",void 0),i([o({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],U.prototype,"position",void 0),U=i([d("esri.layers.voxel.VoxelColorStop")],U);const ue=U;let W=class extends A(v){constructor(){super(...arguments),this.opacity=1,this.position=0}};i([o({type:Number,json:{name:"alpha",write:{enabled:!0,isRequired:!0}}})],W.prototype,"opacity",void 0),i([o({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],W.prototype,"position",void 0),W=i([d("esri.layers.voxel.VoxelOpacityStop")],W);const ce=W;let J=class extends A(v){constructor(){super(...arguments),this.enabled=!1,this.range=null}};i([o({type:Boolean,json:{default:!1,write:!0}})],J.prototype,"enabled",void 0),i([o({type:[Number],json:{write:!0}})],J.prototype,"range",void 0),J=i([d("esri.layers.voxel.VoxelRangeFilter")],J);const dt=J;var V;(function(e){e[e.Color=1]="Color",e[e.Alpha=2]="Alpha",e[e.Both=3]="Both"})(V||(V={}));let T=class extends A(v){constructor(t){super(t),this.interpolation=null,this.stretchRange=null,this.rangeFilter=null,this._colorMapSize=256,this.colorStops=new(c.ofType(ue)),this.opacityStops=new(c.ofType(ce))}set colorStops(t){this._set("colorStops",te(t,this._get("colorStops"),c.ofType(ue)))}set opacityStops(t){this._set("opacityStops",te(t,this._get("opacityStops"),c.ofType(ce)))}getPreviousNext(t,s,r){let n=t;for(;--n>0&&s[n].type!==r&&s[n].type!==V.Both;);let l=t;const y=s.length;for(;++lu.position{h.color[re]=Math.round(Z(C[re],Ee[re],g))})}else m!==-1?H.forEach(g=>{h.color[g]=r[m].color[g]}):H.forEach(g=>{h.color[g]=r[f].color[g]})}}for(const u of r)s.push({color:u.color,position:u.position})}s[0].position=0,s[s.length-1].position=1;let l=0,y=1;for(let p=0;ps[y].position;)l=y++;const h=(u-s[l].position)/(s[y].position-s[l].position),m=s[l].color,f=s[y].color,g=new E;H.forEach(C=>{g[C]=Math.round(Z(m[C],f[C],h))}),g.a=X(1-Z(m.a,f.a,h)/255,0,1),t.push(g)}return t}getColorForContinuousDataValue(t,s){const r=this.rasterizedTransferFunction;if(this.colorStops.length<2||!Array.isArray(this.stretchRange)||this.stretchRange.length<2||r.length<256)return null;let n=this.stretchRange[0],l=this.stretchRange[1];if(n>l){const p=n;n=l,l=p}t=X(t,n,l);const y=r[Math.round((t-n)/(l-n)*(this._colorMapSize-1))].clone();return s||(y.a=1),y}};i([o({type:["linear","nearest"],json:{write:!0}})],T.prototype,"interpolation",void 0),i([o({type:[Number],json:{write:{enabled:!0,isRequired:!0}}})],T.prototype,"stretchRange",void 0),i([o({type:c.ofType(ue),json:{write:{enabled:!0,overridePolicy(){return{enabled:!!this.colorStops&&this.colorStops.length>0}}}}})],T.prototype,"colorStops",null),i([o({type:c.ofType(ce),json:{read:{source:"alphaStops"},write:{enabled:!0,target:"alphaStops",overridePolicy(){return{enabled:!!this.opacityStops&&this.opacityStops.length>0}}}}})],T.prototype,"opacityStops",null),i([o({type:dt,json:{write:!0}})],T.prototype,"rangeFilter",void 0),i([o({type:[E],clonable:!1,json:{read:!1}})],T.prototype,"rasterizedTransferFunction",null),T=i([d("esri.layers.voxel.VoxelTransferFunctionStyle")],T);const ht=T,H=["r","g","b"];let M=class extends A(v){constructor(){super(...arguments),this.color=E.fromArray([0,0,0,0]),this.value=0,this.enabled=!0,this.label=""}};i([o({type:E,json:{type:[$],write:{enabled:!0,isRequired:!0}}})],M.prototype,"color",void 0),i([o({type:$,json:{write:{enabled:!0,isRequired:!0}}})],M.prototype,"value",void 0),i([o({type:Boolean,json:{default:!0,write:!0}})],M.prototype,"enabled",void 0),i([o({type:String,json:{write:!0}})],M.prototype,"label",void 0),M=i([d("esri.layers.voxel.VoxelUniqueValue")],M);const Ae=M;var ye;let L=ye=class extends v{constructor(e){super(e),this.variableId=0,this.label="",this.transferFunction=null,this.uniqueValues=null,this.isosurfaces=null,this.uniqueValues=new(c.ofType(Ae)),this.isosurfaces=new(c.ofType(De))}clone(){return new ye({variableId:this.variableId,label:this.label,transferFunction:G(this.transferFunction),uniqueValues:G(this.uniqueValues),isosurfaces:G(this.isosurfaces)})}};i([o({type:$,json:{write:{enabled:!0,isRequired:!0}}})],L.prototype,"variableId",void 0),i([o({type:String,json:{write:!0}})],L.prototype,"label",void 0),i([o({type:ht,json:{write:{enabled:!0,overridePolicy(){return{enabled:!this.uniqueValues||this.uniqueValues.length<1}}}}})],L.prototype,"transferFunction",void 0),i([o({type:c.ofType(Ae),json:{write:{enabled:!0,overridePolicy(){return{enabled:!!this.uniqueValues&&this.uniqueValues.length>0}}}}})],L.prototype,"uniqueValues",void 0),i([o({type:c.ofType(De),json:{write:{enabled:!0,overridePolicy(){const e=!this.uniqueValues||this.uniqueValues.length<1,t=!!this.isosurfaces&&this.isosurfaces.length>0;return{enabled:e&&t}}}}})],L.prototype,"isosurfaces",void 0),L=ye=i([d("esri.layers.voxel.VoxelVariableStyle")],L);const Fe=L;let K=class extends v{constructor(){super(...arguments),this.values=null}};i([o({type:[Number],json:{write:!0}})],K.prototype,"values",void 0),K=i([d("esri.layers.voxel.VoxelIrregularSpacing")],K);const mt=K;let Y=class extends v{constructor(){super(...arguments),this.scale=1,this.offset=0}};i([o({type:Number,json:{write:!0}})],Y.prototype,"scale",void 0),i([o({type:Number,json:{write:!0}})],Y.prototype,"offset",void 0),Y=i([d("esri.layers.voxel.VoxelRegularSpacing")],Y);const vt=Y;let x=class extends v{constructor(){super(...arguments),this.irregularSpacing=null,this.isPositiveUp=!0,this.isWrappedDateLine=!1,this.label=null,this.name=null,this.quantity=null,this.regularSpacing=null,this.size=0,this.unit=null}get isRegular(){return(this.irregularSpacing==null||this.irregularSpacing===void 0)&&this.regularSpacing!==null}getRange(){var t;return this.isRegular?[this.regularSpacing.offset,this.regularSpacing.offset+this.regularSpacing.scale*(this.size-1)]:Array.isArray((t=this.irregularSpacing)==null?void 0:t.values)&&this.irregularSpacing.values.length>1?[this.irregularSpacing.values[0],this.irregularSpacing.values[this.irregularSpacing.values.length-1]]:[0,0]}};i([o({type:mt,json:{write:!0}})],x.prototype,"irregularSpacing",void 0),i([o({type:Boolean,json:{write:!0}})],x.prototype,"isPositiveUp",void 0),i([o({type:Boolean,json:{write:!0}})],x.prototype,"isWrappedDateLine",void 0),i([o({type:String,json:{write:!0}})],x.prototype,"label",void 0),i([o({type:String,json:{write:!0}})],x.prototype,"name",void 0),i([o({type:String,json:{write:!0}})],x.prototype,"quantity",void 0),i([o({type:vt,json:{write:!0}})],x.prototype,"regularSpacing",void 0),i([o({type:Number,json:{write:!0}})],x.prototype,"size",void 0),i([o({type:String,json:{write:!0}})],x.prototype,"unit",void 0),i([o({type:Boolean,json:{read:!1}})],x.prototype,"isRegular",null),x=i([d("esri.layers.voxel.VoxelDimension")],x);const gt=x,Le="esri.layers.voxel.VoxelVolume",je=Re.getLogger(Le);let w=class extends v{constructor(e){super(e),this.id=0,this.dimensions=null,this.spatialReference=Ie.WGS84}get zDimension(){if(!this.dimensions||!Array.isArray(this.dimensions)||this.dimensions.length!==4)return-1;for(let e=2;e<4;++e)if(this.dimensions[e].size>0)return e;return-1}get isValid(){return!!this.dimensions&&!!Array.isArray(this.dimensions)&&this.dimensions.length===4&&!(this.dimensions[0].size<1||this.dimensions[1].size<1)&&!(this.zDimension===-1||this.dimensions[this.zDimension].size<1)}get originInLayerSpace3D(){if(!this.isValid||this.volumeType==="xyt")return[0,0,0];const e=this.dimensions[0].getRange(),t=this.dimensions[1].getRange(),s=this.dimensions[2],r=s.isRegular?s.getRange():[0,s.size];return[e[0],t[0],r[0]]}get voxelSizeInLayerSpaceSigned(){if(!this.isValid||this.volumeType==="xyt")return[0,0,0];const e=this.dimensions[0].getRange(),t=this.dimensions[1].getRange(),s=this.dimensions[2],r=s.isRegular?s.getRange():[0,s.size],n=[this.sizeInVoxels[0],this.sizeInVoxels[1],this.sizeInVoxels[2]];for(let l=0;l<3;++l)n[l]<2?n[l]=1:n[l]-=1;return s.isRegular&&!s.isPositiveUp&&(n[2]*=-1),[(e[1]-e[0])/n[0],(t[1]-t[0])/n[1],(r[1]-r[0])/n[2]]}get volumeType(){if(this.isValid){const e=this.dimensions[2].size>0,t=this.dimensions[3].size>0;if(!e&&t)return"xyt";if(e&&t)return"xyzt"}return"xyz"}get sizeInVoxels(){if(!this.isValid)return[0,0,0];const e=this.zDimension;return[this.dimensions[0].size,this.dimensions[1].size,this.dimensions[e].size]}computeVoxelSpaceLocation(e){var r;if(!this.isValid)return[0,0,0];if(this.volumeType==="xyt")return je.error("computeVoxelSpacePosition cannot be used with XYT volumes."),[0,0,0];if(!Ue(this.spatialReference,e.spatialReference))return je.error("pos argument should have the same spatial reference as the VoxelLayer."),[0,0,0];const t=Q(e.x,e.y,e.z??0);We(t,t,this.originInLayerSpace3D),Je(t,t,this.voxelSizeInLayerSpaceSigned);const s=this.dimensions[this.zDimension];if(!s.isRegular&&Array.isArray((r=s.irregularSpacing)==null?void 0:r.values)&&s.irregularSpacing.values.length>1){const n=e.z??0,l=s.irregularSpacing.values,y=s.isPositiveUp?1:-1,p=l.reduce((u,h)=>Math.abs(y*h-n)z.normalize(R(e),0,!0))],q.prototype,"orientation",null),i([o({type:Number,json:{read:!1},clonable:!1,range:{min:0,max:360}}),ee(e=>z.normalize(R(e),0,!0))],q.prototype,"tilt",null),i([o({type:[Number],json:{write:!0}})],q.prototype,"normal",void 0),i([o({type:[Number],json:{write:!0}})],q.prototype,"point",void 0),q=i([d("esri.layers.voxel.VoxelDynamicSection")],q);const he=q;var me;let D=me=class extends v{constructor(e){super(e),this.volumeId=0,this.verticalExaggeration=1,this.exaggerationMode="scale-height",this.verticalOffset=0,this.slices=new(c.ofType(oe)),this.dynamicSections=new(c.ofType(he))}set slices(e){this._set("slices",te(e,this._get("slices"),c.ofType(oe)))}set dynamicSections(e){this._set("dynamicSections",te(e,this._get("dynamicSections"),c.ofType(he)))}clone(){return new me({volumeId:this.volumeId,verticalExaggeration:this.verticalExaggeration,exaggerationMode:this.exaggerationMode,verticalOffset:this.verticalOffset,slices:G(this.slices),dynamicSections:G(this.dynamicSections)})}};i([o({type:$,json:{write:{enabled:!0,isRequired:!0}}})],D.prototype,"volumeId",void 0),i([o({type:Number,json:{default:1,write:!0}})],D.prototype,"verticalExaggeration",void 0),i([o({type:["scale-position","scale-height"],json:{default:"scale-height",write:!0}})],D.prototype,"exaggerationMode",void 0),i([o({type:Number,json:{default:0,write:!0}})],D.prototype,"verticalOffset",void 0),i([o({type:c.ofType(oe),json:{write:{enabled:!0,overridePolicy(){return{enabled:!!this.slices&&this.slices.length>0}}}}})],D.prototype,"slices",null),i([o({type:c.ofType(he),json:{write:{enabled:!0,overridePolicy(){return{enabled:!!this.dynamicSections&&this.dynamicSections.length>0}}}}})],D.prototype,"dynamicSections",null),D=me=i([d("esri.layers.voxel.VoxelVolumeStyle")],D);const Me=D,_e="esri.layers.VoxelLayer",P=Re.getLogger(_e);let a=class extends Xe(Ze(He(Ke(et(tt(it(pt))))))){constructor(e){super(e),this.serviceRoot="",this.operationalLayerType="Voxel",this.legendEnabled=!0,this.title=null,this.sections=null,this.currentVariableId=0,this.volumeStyles=null,this.renderMode="volume",this.variableStyles=null,this.enableSlices=!0,this.enableSections=!0,this.enableDynamicSections=!0,this.enableIsosurfaces=!0,this.shading=new qe,this.opacity=1,this.variables=new c,this.volumes=new c,this.index=null,this.minScale=0,this.maxScale=0,this.type="voxel",this.version={major:Number.NaN,minor:Number.NaN,versionString:""},this.fullExtent=null,this.popupEnabled=!1,this.test=null,this.volumeStyles=new(c.ofType(Me)),this.variableStyles=new(c.ofType(Fe)),this.sections=new(c.ofType(pe))}normalizeCtorArgs(e){return e!=null&&e.constantUpscaling&&(this.test={constantUpscaling:!0},delete e.constantUpscaling),e}set url(e){this._set("url",ot(e,P))}load(e){const t=e!=null?e.signal:null,s=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(st).then(()=>this._fetchService(t)).then(()=>this.serviceRoot=this.url);return this.addResolvingPromise(s),Promise.resolve(this)}read(e,t){super.read(e,t);for(const s of this.volumes)s.spatialReference=this.spatialReference}readVersion(e,t){return super.parseVersionString(e)}validateLayer(e){if(e.layerType&&e.layerType!==this.operationalLayerType)throw new le("voxel-layer:layer-type-not-supported","VoxelLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor)||this.version.major<3)throw new le("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"3.x"});if(this.version.major>3)throw new le("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"3.x"})}readFullExtent(e,t,s){if(e!=null&&typeof e=="object"){const r=Ne.fromJSON(e,s);if(r.zmin===0&&r.zmax===0&&Array.isArray(t.volumes)){const n=Pe.fromJSON(t.volumes[0]);if(n.isValid&&n.volumeType!=="xyt"){const l=n.dimensions[2];if(l.isRegular){let y=l.regularSpacing.offset,p=l.regularSpacing.offset+l.regularSpacing.scale*(l.size-1);if(y>p){const u=y;y=p,p=u}r.zmin=y,r.zmax=p}}}return r}return null}get voxelFields(){const e=[new B({name:"Voxel.ServiceValue",alias:"Value",domain:null,editable:!1,length:128,type:"string"}),new B({name:"Voxel.ServiceVariableLabel",alias:"Variable",domain:null,editable:!1,length:128,type:"string"}),new B({name:"Voxel.Position",alias:"Voxel Position",domain:null,editable:!1,length:128,type:"string"})],t=this.getVolume(null);if(t!=null){if(t.volumeType==="xyzt"||t.volumeType==="xyt"){const s=new B({name:"Voxel.ServiceLocalTime",alias:"Local Time",domain:null,editable:!1,length:128,type:"string"});e.push(s);const r=new B({name:"Voxel.ServiceNativeTime",alias:"Native Time",domain:null,editable:!1,length:128,type:"string"});e.push(r)}if(t.volumeType!=="xyt"){const s=new B({name:"Voxel.ServiceDepth",alias:"Depth",domain:null,editable:!1,length:128,type:"string"});e.push(s)}}return e}get popupTemplate(){return this.loaded?this.createPopupTemplate():null}get defaultPopupTemplate(){return this.createPopupTemplate()}createPopupTemplate(e){const t=this.voxelFields,s=this.title;return rt({fields:t,title:s},e)}getConfiguration(){var t,s;const e={layerType:this.operationalLayerType,version:this.version.versionString,name:this.title,spatialReference:this.spatialReference,fullExtent:this.fullExtent,volumes:this.volumes.toJSON(),variables:this.variables.toJSON(),index:(t=this.index)==null?void 0:t.toJSON(),sections:this.getSections(),style:{volumeStyles:this.getVolumeStyles(),currentVariableId:this.currentVariableId,renderMode:this.renderMode,variableStyles:this.getVariableStyles(),enableSections:this.enableSections,enableDynamicSections:this.enableDynamicSections,enableIsosurfaces:this.enableIsosurfaces,enableSlices:this.enableSlices,shading:this.shading}};return e.index&&((s=this.index)!=null&&s.isValid())?JSON.stringify(e):""}getVariableStyle(e){let t=-1;if(t=e??this.currentVariableId,!this.variableStyles||t===-1)return null;const s=this.variableStyles.findIndex(r=>r.variableId===t);return s<0?null:this.variableStyles.at(s)}getVariable(e){let t=-1;if(t=e??this.currentVariableId,!this.variables||t===-1)return null;const s=this.variables.findIndex(r=>r.id===t);return s<0?null:this.variables.at(s)}getVolume(e){const t=this.getVariable(e);return t!=null?this.volumes.find(({id:s})=>s===t.volumeId):null}getVolumeStyle(e){const t=this.getVariable(e);return t!=null?this.volumeStyles.find(({volumeId:s})=>s===t.volumeId):null}getColorForContinuousDataValue(e,t,s){var y;const r=this.getVariable(e);if(r==null||((y=r.renderingFormat)==null?void 0:y.continuity)!=="continuous"||!this.variableStyles)return null;const n=this.variableStyles.findIndex(p=>p.variableId===e);if(n<0)return null;const l=this.variableStyles.at(n);return l!=null&&l.transferFunction?l.transferFunction.getColorForContinuousDataValue(t,s):null}getSections(){const e=[];for(const t of this.sections)e.push(new pe({enabled:t.enabled,href:t.href,id:t.id,label:t.label,normal:t.normal,point:t.point,sizeInPixel:t.sizeInPixel,slices:t.slices,timeId:t.timeId,variableId:t.variableId}));return e}getVariableStyles(){const e=[];for(const t of this.variableStyles){const s=this._getVariable(t);if(s!=null){const r=t.clone();r.isosurfaces.length>4&&(r.isosurfaces=r.isosurfaces.slice(0,3),P.error("A maximum of 4 isosurfaces are supported for Voxel Layers."));for(const n of r.isosurfaces)if(!n.colorLocked){const l=this.getColorForContinuousDataValue(r.variableId,n.value,!1);l===null||l.equals(n.color)||(n.color=l)}if(s.renderingFormat.continuity==="continuous")(r.transferFunction===null||r.transferFunction.colorStops.length<2)&&P.error(`VoxelVariableStyle for variable ${s.id} is invalid. At least 2 color stops are required in the transferFunction for continuous Voxel Layer variables.`),r.transferFunction!==null&&(Array.isArray(r.transferFunction.stretchRange)&&r.transferFunction.stretchRange.length===2||(P.error(`VoxelVariableStyle for variable ${s.id} is invalid. The stretchRange of the transferFunction for continuous Voxel Layer variables must be of the form [minimumDataValue, maximumDataValue].`),r.transferFunction.stretchRange=[0,1],r.transferFunction.colorStops.removeAll()));else if(s.renderingFormat.continuity==="discrete")if(t.uniqueValues.length===0)P.error(`VoxelVariableStyle for variable ${s.id} is invalid. Unique values are required for discrete Voxel Layer variables.`);else for(const n of t.uniqueValues)n.label!==null&&n.label!==void 0||n.value===null||n.value===void 0||(n.label=n.value.toString());e.push(r)}else P.error(`VoxelVariable ID=${t.variableId} doesn't exist, VoxelVariableStyle for this VoxelVariable will be ignored.`)}return e}getVolumeStyles(){const e=[];for(const t of this.volumeStyles){const s=this._getVolumeFromVolumeId(t.volumeId);if(s!=null){const r=t.clone();for(const n of r.slices)this._isPlaneValid(n,[0,1,s.zDimension],s.dimensions)||(n.enabled=!1,n.label="invalid");for(const n of r.dynamicSections)this._isPlaneValid(n,[0,1,s.zDimension],s.dimensions)||(n.enabled=!1,n.label="invalid");e.push(r)}else P.error(`VoxelVolume ID=${t.volumeId} doesn't exist, VoxelVolumeStyle for this VoxelVolume will be ignored.`)}return e}_getVariable(e){const t=e.variableId;for(const s of this.variables)if(s.id===t)return s;return null}_getVolumeFromVolumeId(e){for(const t of this.volumes)if(t.id===e)return t;return null}_isPlaneValid(e,t,s){if(!e.point||!Array.isArray(e.point)||e.point.length!==3||!e.normal||!Array.isArray(e.normal)||e.normal.length!==3)return!1;const r=Q(e.normal[0],e.normal[1],e.normal[2]);ve(r,r);const n=1e-6;return!(Math.abs(r[0])+Math.abs(r[1])+Math.abs(r[2])!t.disablePopup},write:{enabled:!0,ignoreOrigin:!0,writer(e,t,s){t[s]=!e}},origins:{"portal-item":{default:!0},"web-scene":{default:!0}}}})],a.prototype,"popupEnabled",void 0),i([o({type:at,json:{read:!1}})],a.prototype,"popupTemplate",null),i([o({readOnly:!0})],a.prototype,"defaultPopupTemplate",null),a=i([d(_e)],a);const Lt=a;export{Lt as default}; diff --git a/dist/assets/VoxelLayer-ggmlUmsY.js b/dist/assets/VoxelLayer-ggmlUmsY.js new file mode 100644 index 0000000..f7bf44a --- /dev/null +++ b/dist/assets/VoxelLayer-ggmlUmsY.js @@ -0,0 +1 @@ +import{b3 as $e,bL as ve,uD as ae,go as se,gn as ze,uE as ge,p9 as be,uF as Be,a8 as Oe,b1 as K,dq as A,iD as z,iE as R,e as i,y as o,f1 as ee,c as d,dr as v,iA as Ce,e4 as ke,er as $,W as E,V as c,e8 as te,bE as Q,aD as X,ah as H,R as Re,d2 as Ie,bt as Ue,b4 as We,uG as Je,L as ne,qn as Ge,uH as He,bO as Ke,iR as Qe,ef as Xe,dH as Ye,dI as Ze,dJ as et,dK as tt,eg as it,ul as ot,dL as st,r as le,dO as Ne,es as B,io as rt,dQ as nt,dR as lt,dt as fe,ix as at,aI as pt}from"./index-pCX-0tJH.js";const b=Oe(),Se=se(),xe=se(),we=se(),Te=K(0,0,1),ut=K(0,1,0),ct=K(1,0,0);function O(e){$e(b,e),ve(b,b);const t=Math.atan2(b[1],b[0]),s=ae(se(),Te,-t);ze(b,b,s);const r=-1*Math.atan2(b[2],b[0]);return[ge(t)+270,ge(r)+90]}function ie(e,t){return ae(xe,Te,be(e-270)),ae(we,ut,be(t-90)),Be(Se,xe,we),$e(b,ct),ze(b,b,Se),ve(b,b),[b[0],b[1],b[2]]}let I=class extends A(v){constructor(t){super(t),this.enabled=!0,this.label="",this.normal=null,this.point=null}get orientation(){if(!Array.isArray(this.normal)||this.normal.length!==3)return 0;const[t,s]=O(this.normal);return z.normalize(R(t),0,!0)}set orientation(t){const s=ie(t,this.tilt);this._set("normal",s),this._set("orientation",t)}get tilt(){if(!Array.isArray(this.normal)||this.normal.length!==3)return 0;const[t,s]=O(this.normal);return z.normalize(R(s),0,!0)}set tilt(t){const s=ie(this.orientation,t);this._set("normal",s),this._set("tilt",t)}};i([o({type:Boolean,json:{write:!0}})],I.prototype,"enabled",void 0),i([o({type:String,json:{write:!0}})],I.prototype,"label",void 0),i([o({type:Number,json:{read:!1},clonable:!1,range:{min:0,max:360}}),ee(e=>z.normalize(R(e),0,!0))],I.prototype,"orientation",null),i([o({type:Number,json:{read:!1},clonable:!1,range:{min:0,max:360}}),ee(e=>z.normalize(R(e),0,!0))],I.prototype,"tilt",null),i([o({type:[Number],json:{write:!0}})],I.prototype,"normal",void 0),i([o({type:[Number],json:{write:!0}})],I.prototype,"point",void 0),I=i([d("esri.layers.voxel.VoxelSlice")],I);const oe=I;let S=class extends A(v){constructor(){super(...arguments),this.enabled=!0,this.href=null,this.id=null,this.label="",this.normal=null,this.point=null,this.sizeInPixel=null,this.slices=null,this.timeId=0,this.variableId=null}get orientation(){if(!Array.isArray(this.normal)||this.normal.length!==3)return 0;const[t,s]=O(this.normal);return z.normalize(R(t),0,!0)}get tilt(){if(!Array.isArray(this.normal)||this.normal.length!==3)return 0;const[t,s]=O(this.normal);return z.normalize(R(s),0,!0)}};i([o({type:Boolean,json:{default:!0,write:!0}})],S.prototype,"enabled",void 0),i([o({type:String,json:{origins:{service:{read:Ce}},write:{enabled:!0,isRequired:!0}}}),ke({origins:["web-scene"],type:"resource",prefix:"sections",compress:!0})],S.prototype,"href",void 0),i([o({type:$,json:{write:{enabled:!0,isRequired:!0}}})],S.prototype,"id",void 0),i([o({type:String,json:{write:!0}})],S.prototype,"label",void 0),i([o({type:Number,clonable:!1,readOnly:!0,range:{min:0,max:360}})],S.prototype,"orientation",null),i([o({type:Number,clonable:!1,readOnly:!0,range:{min:0,max:360}})],S.prototype,"tilt",null),i([o({type:[Number],json:{write:{enabled:!0,isRequired:!0}}})],S.prototype,"normal",void 0),i([o({type:[Number],json:{write:{enabled:!0,isRequired:!0}}})],S.prototype,"point",void 0),i([o({type:[$],json:{write:{enabled:!0,isRequired:!0}}})],S.prototype,"sizeInPixel",void 0),i([o({type:[oe],json:{write:!0}})],S.prototype,"slices",void 0),i([o({type:$,json:{default:0,write:!0}})],S.prototype,"timeId",void 0),i([o({type:$,json:{write:{enabled:!0,isRequired:!0}}})],S.prototype,"variableId",void 0),S=i([d("esri.layers.voxel.VoxelSection")],S);const pe=S;let k=class extends v{constructor(){super(...arguments),this.diffuseFactor=.5,this.specularFactor=.5}};i([o({type:Number,range:{min:0,max:1},json:{default:.5,write:!0}})],k.prototype,"diffuseFactor",void 0),i([o({type:Number,range:{min:0,max:1},json:{default:.5,write:!0}})],k.prototype,"specularFactor",void 0),k=i([d("esri.layers.voxel.VoxelSimpleShading")],k);const De=k;let N=class extends v{constructor(){super(...arguments),this.continuity=null,this.hasNoData=!1,this.noData=0,this.offset=0,this.scale=1,this.type=null}};i([o({type:["discrete","continuous"],json:{write:!0}})],N.prototype,"continuity",void 0),i([o({type:Boolean,json:{write:!0}})],N.prototype,"hasNoData",void 0),i([o({type:Number,json:{write:!0}})],N.prototype,"noData",void 0),i([o({type:Number,json:{write:!0}})],N.prototype,"offset",void 0),i([o({type:Number,json:{write:!0}})],N.prototype,"scale",void 0),i([o({type:String,json:{write:{enabled:!0,isRequired:!0}}})],N.prototype,"type",void 0),N=i([d("esri.layers.voxel.VoxelFormat")],N);const Ve=N;let j=class extends v{constructor(){super(...arguments),this.id=null,this.description="",this.name=null,this.originalFormat=null,this.renderingFormat=null,this.unit="",this.volumeId=0,this.type=null}};i([o({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],j.prototype,"id",void 0),i([o({type:String,json:{write:!0}})],j.prototype,"description",void 0),i([o({type:String,json:{write:{enabled:!0,isRequired:!0}}})],j.prototype,"name",void 0),i([o({type:Ve,json:{write:!0}})],j.prototype,"originalFormat",void 0),i([o({type:Ve,json:{write:{enabled:!0,isRequired:!0}}})],j.prototype,"renderingFormat",void 0),i([o({type:String,json:{write:!0}})],j.prototype,"unit",void 0),i([o({type:Number,json:{write:!0}})],j.prototype,"volumeId",void 0),i([o({type:["stc-hot-spot-results","stc-cluster-outlier-results","stc-estimated-bin","generic-nearest-interpolated"],json:{write:!0}})],j.prototype,"type",void 0),j=i([d("esri.layers.voxel.VoxelVariable")],j);const yt=j;let F=class extends A(v){constructor(){super(...arguments),this.color=E.fromArray([0,0,0,0]),this.value=0,this.enabled=!0,this.label="",this.colorLocked=!1}};i([o({type:E,json:{type:[$],write:{enabled:!0,isRequired:!0}}})],F.prototype,"color",void 0),i([o({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],F.prototype,"value",void 0),i([o({type:Boolean,json:{default:!0,write:!0}})],F.prototype,"enabled",void 0),i([o({type:String,json:{write:!0}})],F.prototype,"label",void 0),i([o({type:Boolean,json:{default:!1,write:!0}})],F.prototype,"colorLocked",void 0),F=i([d("esri.layers.voxel.VoxelIsosurface")],F);const qe=F;let U=class extends A(v){constructor(){super(...arguments),this.color=null,this.position=0}};i([o({type:E,json:{type:[$],write:{enabled:!0,isRequired:!0}}})],U.prototype,"color",void 0),i([o({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],U.prototype,"position",void 0),U=i([d("esri.layers.voxel.VoxelColorStop")],U);const ue=U;let W=class extends A(v){constructor(){super(...arguments),this.opacity=1,this.position=0}};i([o({type:Number,json:{name:"alpha",write:{enabled:!0,isRequired:!0}}})],W.prototype,"opacity",void 0),i([o({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],W.prototype,"position",void 0),W=i([d("esri.layers.voxel.VoxelOpacityStop")],W);const ce=W;let J=class extends A(v){constructor(){super(...arguments),this.enabled=!1,this.range=null}};i([o({type:Boolean,json:{default:!1,write:!0}})],J.prototype,"enabled",void 0),i([o({type:[Number],json:{write:!0}})],J.prototype,"range",void 0),J=i([d("esri.layers.voxel.VoxelRangeFilter")],J);const dt=J;var V;(function(e){e[e.Color=1]="Color",e[e.Alpha=2]="Alpha",e[e.Both=3]="Both"})(V||(V={}));let T=class extends A(v){constructor(t){super(t),this.interpolation=null,this.stretchRange=null,this.rangeFilter=null,this._colorMapSize=256,this.colorStops=new(c.ofType(ue)),this.opacityStops=new(c.ofType(ce))}set colorStops(t){this._set("colorStops",te(t,this._get("colorStops"),c.ofType(ue)))}set opacityStops(t){this._set("opacityStops",te(t,this._get("opacityStops"),c.ofType(ce)))}getPreviousNext(t,s,r){let n=t;for(;--n>0&&s[n].type!==r&&s[n].type!==V.Both;);let l=t;const y=s.length;for(;++lu.position{h.color[re]=Math.round(X(C[re],Ee[re],g))})}else m!==-1?Y.forEach(g=>{h.color[g]=r[m].color[g]}):Y.forEach(g=>{h.color[g]=r[f].color[g]})}}for(const u of r)s.push({color:u.color,position:u.position})}s[0].position=0,s[s.length-1].position=1;let l=0,y=1;for(let p=0;ps[y].position;)l=y++;const h=(u-s[l].position)/(s[y].position-s[l].position),m=s[l].color,f=s[y].color,g=new E;Y.forEach(C=>{g[C]=Math.round(X(m[C],f[C],h))}),g.a=Q(1-X(m.a,f.a,h)/255,0,1),t.push(g)}return t}getColorForContinuousDataValue(t,s){const r=this.rasterizedTransferFunction;if(this.colorStops.length<2||!Array.isArray(this.stretchRange)||this.stretchRange.length<2||r.length<256)return null;let n=this.stretchRange[0],l=this.stretchRange[1];if(n>l){const p=n;n=l,l=p}t=Q(t,n,l);const y=r[Math.round((t-n)/(l-n)*(this._colorMapSize-1))].clone();return s||(y.a=1),y}};i([o({type:["linear","nearest"],json:{write:!0}})],T.prototype,"interpolation",void 0),i([o({type:[Number],json:{write:{enabled:!0,isRequired:!0}}})],T.prototype,"stretchRange",void 0),i([o({type:c.ofType(ue),json:{write:{enabled:!0,overridePolicy(){return{enabled:!!this.colorStops&&this.colorStops.length>0}}}}})],T.prototype,"colorStops",null),i([o({type:c.ofType(ce),json:{read:{source:"alphaStops"},write:{enabled:!0,target:"alphaStops",overridePolicy(){return{enabled:!!this.opacityStops&&this.opacityStops.length>0}}}}})],T.prototype,"opacityStops",null),i([o({type:dt,json:{write:!0}})],T.prototype,"rangeFilter",void 0),i([o({type:[E],clonable:!1,json:{read:!1}})],T.prototype,"rasterizedTransferFunction",null),T=i([d("esri.layers.voxel.VoxelTransferFunctionStyle")],T);const ht=T,Y=["r","g","b"];let M=class extends A(v){constructor(){super(...arguments),this.color=E.fromArray([0,0,0,0]),this.value=0,this.enabled=!0,this.label=""}};i([o({type:E,json:{type:[$],write:{enabled:!0,isRequired:!0}}})],M.prototype,"color",void 0),i([o({type:$,json:{write:{enabled:!0,isRequired:!0}}})],M.prototype,"value",void 0),i([o({type:Boolean,json:{default:!0,write:!0}})],M.prototype,"enabled",void 0),i([o({type:String,json:{write:!0}})],M.prototype,"label",void 0),M=i([d("esri.layers.voxel.VoxelUniqueValue")],M);const Ae=M;var ye;let L=ye=class extends v{constructor(e){super(e),this.variableId=0,this.label="",this.transferFunction=null,this.uniqueValues=null,this.isosurfaces=null,this.uniqueValues=new(c.ofType(Ae)),this.isosurfaces=new(c.ofType(qe))}clone(){return new ye({variableId:this.variableId,label:this.label,transferFunction:H(this.transferFunction),uniqueValues:H(this.uniqueValues),isosurfaces:H(this.isosurfaces)})}};i([o({type:$,json:{write:{enabled:!0,isRequired:!0}}})],L.prototype,"variableId",void 0),i([o({type:String,json:{write:!0}})],L.prototype,"label",void 0),i([o({type:ht,json:{write:{enabled:!0,overridePolicy(){return{enabled:!this.uniqueValues||this.uniqueValues.length<1}}}}})],L.prototype,"transferFunction",void 0),i([o({type:c.ofType(Ae),json:{write:{enabled:!0,overridePolicy(){return{enabled:!!this.uniqueValues&&this.uniqueValues.length>0}}}}})],L.prototype,"uniqueValues",void 0),i([o({type:c.ofType(qe),json:{write:{enabled:!0,overridePolicy(){const e=!this.uniqueValues||this.uniqueValues.length<1,t=!!this.isosurfaces&&this.isosurfaces.length>0;return{enabled:e&&t}}}}})],L.prototype,"isosurfaces",void 0),L=ye=i([d("esri.layers.voxel.VoxelVariableStyle")],L);const Fe=L;let Z=class extends v{constructor(){super(...arguments),this.values=null}};i([o({type:[Number],json:{write:!0}})],Z.prototype,"values",void 0),Z=i([d("esri.layers.voxel.VoxelIrregularSpacing")],Z);const mt=Z;let G=class extends v{constructor(){super(...arguments),this.scale=1,this.offset=0}};i([o({type:Number,json:{write:!0}})],G.prototype,"scale",void 0),i([o({type:Number,json:{write:!0}})],G.prototype,"offset",void 0),G=i([d("esri.layers.voxel.VoxelRegularSpacing")],G);const vt=G;let x=class extends v{constructor(){super(...arguments),this.irregularSpacing=null,this.isPositiveUp=!0,this.isWrappedDateLine=!1,this.label=null,this.name=null,this.quantity=null,this.regularSpacing=null,this.size=0,this.unit=null}get isRegular(){return(this.irregularSpacing==null||this.irregularSpacing===void 0)&&this.regularSpacing!==null}getRange(){var t;return this.isRegular?[this.regularSpacing.offset,this.regularSpacing.offset+this.regularSpacing.scale*(this.size-1)]:Array.isArray((t=this.irregularSpacing)==null?void 0:t.values)&&this.irregularSpacing.values.length>1?[this.irregularSpacing.values[0],this.irregularSpacing.values[this.irregularSpacing.values.length-1]]:[0,0]}};i([o({type:mt,json:{write:!0}})],x.prototype,"irregularSpacing",void 0),i([o({type:Boolean,json:{write:!0}})],x.prototype,"isPositiveUp",void 0),i([o({type:Boolean,json:{write:!0}})],x.prototype,"isWrappedDateLine",void 0),i([o({type:String,json:{write:!0}})],x.prototype,"label",void 0),i([o({type:String,json:{write:!0}})],x.prototype,"name",void 0),i([o({type:String,json:{write:!0}})],x.prototype,"quantity",void 0),i([o({type:vt,json:{write:!0}})],x.prototype,"regularSpacing",void 0),i([o({type:Number,json:{write:!0}})],x.prototype,"size",void 0),i([o({type:String,json:{write:!0}})],x.prototype,"unit",void 0),i([o({type:Boolean,json:{read:!1}})],x.prototype,"isRegular",null),x=i([d("esri.layers.voxel.VoxelDimension")],x);const gt=x,Le="esri.layers.voxel.VoxelVolume",je=Re.getLogger(Le);let w=class extends v{constructor(e){super(e),this.id=0,this.dimensions=null,this.spatialReference=Ie.WGS84}get zDimension(){if(!this.dimensions||!Array.isArray(this.dimensions)||this.dimensions.length!==4)return-1;for(let e=2;e<4;++e)if(this.dimensions[e].size>0)return e;return-1}get isValid(){return!!this.dimensions&&!!Array.isArray(this.dimensions)&&this.dimensions.length===4&&!(this.dimensions[0].size<1||this.dimensions[1].size<1)&&!(this.zDimension===-1||this.dimensions[this.zDimension].size<1)}get originInLayerSpace3D(){if(!this.isValid||this.volumeType==="xyt")return[0,0,0];const e=this.dimensions[0].getRange(),t=this.dimensions[1].getRange(),s=this.dimensions[2],r=s.isRegular?s.getRange():[0,s.size];return[e[0],t[0],r[0]]}get voxelSizeInLayerSpaceSigned(){if(!this.isValid||this.volumeType==="xyt")return[0,0,0];const e=this.dimensions[0].getRange(),t=this.dimensions[1].getRange(),s=this.dimensions[2],r=s.isRegular?s.getRange():[0,s.size],n=[this.sizeInVoxels[0],this.sizeInVoxels[1],this.sizeInVoxels[2]];for(let l=0;l<3;++l)n[l]<2?n[l]=1:n[l]-=1;return s.isRegular&&!s.isPositiveUp&&(n[2]*=-1),[(e[1]-e[0])/n[0],(t[1]-t[0])/n[1],(r[1]-r[0])/n[2]]}get volumeType(){if(this.isValid){const e=this.dimensions[2].size>0,t=this.dimensions[3].size>0;if(!e&&t)return"xyt";if(e&&t)return"xyzt"}return"xyz"}get sizeInVoxels(){if(!this.isValid)return[0,0,0];const e=this.zDimension;return[this.dimensions[0].size,this.dimensions[1].size,this.dimensions[e].size]}computeVoxelSpaceLocation(e){var r;if(!this.isValid)return[0,0,0];if(this.volumeType==="xyt")return je.error("computeVoxelSpacePosition cannot be used with XYT volumes."),[0,0,0];if(!Ue(this.spatialReference,e.spatialReference))return je.error("pos argument should have the same spatial reference as the VoxelLayer."),[0,0,0];const t=K(e.x,e.y,e.z??0);We(t,t,this.originInLayerSpace3D),Je(t,t,this.voxelSizeInLayerSpaceSigned);const s=this.dimensions[this.zDimension];if(!s.isRegular&&Array.isArray((r=s.irregularSpacing)==null?void 0:r.values)&&s.irregularSpacing.values.length>1){const n=e.z??0,l=s.irregularSpacing.values,y=s.isPositiveUp?1:-1,p=l.reduce((u,h)=>Math.abs(y*h-n)z.normalize(R(e),0,!0))],D.prototype,"orientation",null),i([o({type:Number,json:{read:!1},clonable:!1,range:{min:0,max:360}}),ee(e=>z.normalize(R(e),0,!0))],D.prototype,"tilt",null),i([o({type:[Number],json:{write:!0}})],D.prototype,"normal",void 0),i([o({type:[Number],json:{write:!0}})],D.prototype,"point",void 0),D=i([d("esri.layers.voxel.VoxelDynamicSection")],D);const he=D;var me;let q=me=class extends v{constructor(e){super(e),this.volumeId=0,this.verticalExaggeration=1,this.exaggerationMode="scale-height",this.verticalOffset=0,this.slices=new(c.ofType(oe)),this.dynamicSections=new(c.ofType(he))}set slices(e){this._set("slices",te(e,this._get("slices"),c.ofType(oe)))}set dynamicSections(e){this._set("dynamicSections",te(e,this._get("dynamicSections"),c.ofType(he)))}clone(){return new me({volumeId:this.volumeId,verticalExaggeration:this.verticalExaggeration,exaggerationMode:this.exaggerationMode,verticalOffset:this.verticalOffset,slices:H(this.slices),dynamicSections:H(this.dynamicSections)})}};i([o({type:$,json:{write:{enabled:!0,isRequired:!0}}})],q.prototype,"volumeId",void 0),i([o({type:Number,json:{default:1,write:!0}})],q.prototype,"verticalExaggeration",void 0),i([o({type:["scale-position","scale-height"],json:{default:"scale-height",write:!0}})],q.prototype,"exaggerationMode",void 0),i([o({type:Number,json:{default:0,write:!0}})],q.prototype,"verticalOffset",void 0),i([o({type:c.ofType(oe),json:{write:{enabled:!0,overridePolicy(){return{enabled:!!this.slices&&this.slices.length>0}}}}})],q.prototype,"slices",null),i([o({type:c.ofType(he),json:{write:{enabled:!0,overridePolicy(){return{enabled:!!this.dynamicSections&&this.dynamicSections.length>0}}}}})],q.prototype,"dynamicSections",null),q=me=i([d("esri.layers.voxel.VoxelVolumeStyle")],q);const Me=q,_e="esri.layers.VoxelLayer",P=Re.getLogger(_e);let a=class extends Qe(Xe(Ye(Ze(et(tt(it(pt))))))){constructor(e){super(e),this.serviceRoot="",this.operationalLayerType="Voxel",this.legendEnabled=!0,this.title=null,this.sections=null,this.currentVariableId=0,this.volumeStyles=null,this.renderMode="volume",this.variableStyles=null,this.enableSlices=!0,this.enableSections=!0,this.enableDynamicSections=!0,this.enableIsosurfaces=!0,this.shading=new De,this.opacity=1,this.variables=new c,this.volumes=new c,this.index=null,this.minScale=0,this.maxScale=0,this.type="voxel",this.version={major:Number.NaN,minor:Number.NaN,versionString:""},this.fullExtent=null,this.popupEnabled=!1,this.test=null,this.volumeStyles=new(c.ofType(Me)),this.variableStyles=new(c.ofType(Fe)),this.sections=new(c.ofType(pe))}normalizeCtorArgs(e){return e!=null&&e.constantUpscaling&&(this.test={constantUpscaling:!0},delete e.constantUpscaling),e}set url(e){this._set("url",ot(e,P))}load(e){const t=e!=null?e.signal:null,s=this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(st).then(()=>this._fetchService(t)).then(()=>this.serviceRoot=this.url);return this.addResolvingPromise(s),Promise.resolve(this)}read(e,t){super.read(e,t);for(const s of this.volumes)s.spatialReference=this.spatialReference}readVersion(e,t){return super.parseVersionString(e)}validateLayer(e){if(e.layerType&&e.layerType!==this.operationalLayerType)throw new le("voxel-layer:layer-type-not-supported","VoxelLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor)||this.version.major<3)throw new le("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"3.x"});if(this.version.major>3)throw new le("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"3.x"})}readFullExtent(e,t,s){if(e!=null&&typeof e=="object"){const r=Ne.fromJSON(e,s);if(r.zmin===0&&r.zmax===0&&Array.isArray(t.volumes)){const n=Pe.fromJSON(t.volumes[0]);if(n.isValid&&n.volumeType!=="xyt"){const l=n.dimensions[2];if(l.isRegular){let y=l.regularSpacing.offset,p=l.regularSpacing.offset+l.regularSpacing.scale*(l.size-1);if(y>p){const u=y;y=p,p=u}r.zmin=y,r.zmax=p}}}return r}return null}get voxelFields(){const e=[new B({name:"Voxel.ServiceValue",alias:"Value",domain:null,editable:!1,length:128,type:"string"}),new B({name:"Voxel.ServiceVariableLabel",alias:"Variable",domain:null,editable:!1,length:128,type:"string"}),new B({name:"Voxel.Position",alias:"Voxel Position",domain:null,editable:!1,length:128,type:"string"})],t=this.getVolume(null);if(t!=null){if(t.volumeType==="xyzt"||t.volumeType==="xyt"){const s=new B({name:"Voxel.ServiceLocalTime",alias:"Local Time",domain:null,editable:!1,length:128,type:"string"});e.push(s);const r=new B({name:"Voxel.ServiceNativeTime",alias:"Native Time",domain:null,editable:!1,length:128,type:"string"});e.push(r)}if(t.volumeType!=="xyt"){const s=new B({name:"Voxel.ServiceDepth",alias:"Depth",domain:null,editable:!1,length:128,type:"string"});e.push(s)}}return e}get popupTemplate(){return this.loaded?this.createPopupTemplate():null}get defaultPopupTemplate(){return this.createPopupTemplate()}createPopupTemplate(e){const t=this.voxelFields,s=this.title;return rt({fields:t,title:s},e)}getConfiguration(){var t,s;const e={layerType:this.operationalLayerType,version:this.version.versionString,name:this.title,spatialReference:this.spatialReference,fullExtent:this.fullExtent,volumes:this.volumes.toJSON(),variables:this.variables.toJSON(),index:(t=this.index)==null?void 0:t.toJSON(),sections:this.getSections(),style:{volumeStyles:this.getVolumeStyles(),currentVariableId:this.currentVariableId,renderMode:this.renderMode,variableStyles:this.getVariableStyles(),enableSections:this.enableSections,enableDynamicSections:this.enableDynamicSections,enableIsosurfaces:this.enableIsosurfaces,enableSlices:this.enableSlices,shading:this.shading}};return e.index&&((s=this.index)!=null&&s.isValid())?JSON.stringify(e):""}getVariableStyle(e){let t=-1;if(t=e??this.currentVariableId,!this.variableStyles||t===-1)return null;const s=this.variableStyles.findIndex(r=>r.variableId===t);return s<0?null:this.variableStyles.at(s)}getVariable(e){let t=-1;if(t=e??this.currentVariableId,!this.variables||t===-1)return null;const s=this.variables.findIndex(r=>r.id===t);return s<0?null:this.variables.at(s)}getVolume(e){const t=this.getVariable(e);return t!=null?this.volumes.find(({id:s})=>s===t.volumeId):null}getVolumeStyle(e){const t=this.getVariable(e);return t!=null?this.volumeStyles.find(({volumeId:s})=>s===t.volumeId):null}getColorForContinuousDataValue(e,t,s){var y;const r=this.getVariable(e);if(r==null||((y=r.renderingFormat)==null?void 0:y.continuity)!=="continuous"||!this.variableStyles)return null;const n=this.variableStyles.findIndex(p=>p.variableId===e);if(n<0)return null;const l=this.variableStyles.at(n);return l!=null&&l.transferFunction?l.transferFunction.getColorForContinuousDataValue(t,s):null}getSections(){const e=[];for(const t of this.sections)e.push(new pe({enabled:t.enabled,href:t.href,id:t.id,label:t.label,normal:t.normal,point:t.point,sizeInPixel:t.sizeInPixel,slices:t.slices,timeId:t.timeId,variableId:t.variableId}));return e}getVariableStyles(){const e=[];for(const t of this.variableStyles){const s=this._getVariable(t);if(s!=null){const r=t.clone();r.isosurfaces.length>4&&(r.isosurfaces=r.isosurfaces.slice(0,3),P.error("A maximum of 4 isosurfaces are supported for Voxel Layers."));for(const n of r.isosurfaces)if(!n.colorLocked){const l=this.getColorForContinuousDataValue(r.variableId,n.value,!1);l===null||l.equals(n.color)||(n.color=l)}if(s.renderingFormat.continuity==="continuous")(r.transferFunction===null||r.transferFunction.colorStops.length<2)&&P.error(`VoxelVariableStyle for variable ${s.id} is invalid. At least 2 color stops are required in the transferFunction for continuous Voxel Layer variables.`),r.transferFunction!==null&&(Array.isArray(r.transferFunction.stretchRange)&&r.transferFunction.stretchRange.length===2||(P.error(`VoxelVariableStyle for variable ${s.id} is invalid. The stretchRange of the transferFunction for continuous Voxel Layer variables must be of the form [minimumDataValue, maximumDataValue].`),r.transferFunction.stretchRange=[0,1],r.transferFunction.colorStops.removeAll()));else if(s.renderingFormat.continuity==="discrete")if(t.uniqueValues.length===0)P.error(`VoxelVariableStyle for variable ${s.id} is invalid. Unique values are required for discrete Voxel Layer variables.`);else for(const n of t.uniqueValues)n.label!==null&&n.label!==void 0||n.value===null||n.value===void 0||(n.label=n.value.toString());e.push(r)}else P.error(`VoxelVariable ID=${t.variableId} doesn't exist, VoxelVariableStyle for this VoxelVariable will be ignored.`)}return e}getVolumeStyles(){const e=[];for(const t of this.volumeStyles){const s=this._getVolumeFromVolumeId(t.volumeId);if(s!=null){const r=t.clone();for(const n of r.slices)this._isPlaneValid(n,[0,1,s.zDimension],s.dimensions)||(n.enabled=!1,n.label="invalid");for(const n of r.dynamicSections)this._isPlaneValid(n,[0,1,s.zDimension],s.dimensions)||(n.enabled=!1,n.label="invalid");e.push(r)}else P.error(`VoxelVolume ID=${t.volumeId} doesn't exist, VoxelVolumeStyle for this VoxelVolume will be ignored.`)}return e}_getVariable(e){const t=e.variableId;for(const s of this.variables)if(s.id===t)return s;return null}_getVolumeFromVolumeId(e){for(const t of this.volumes)if(t.id===e)return t;return null}_isPlaneValid(e,t,s){if(!e.point||!Array.isArray(e.point)||e.point.length!==3||!e.normal||!Array.isArray(e.normal)||e.normal.length!==3)return!1;const r=K(e.normal[0],e.normal[1],e.normal[2]);ve(r,r);const n=1e-6;return!(Math.abs(r[0])+Math.abs(r[1])+Math.abs(r[2])!t.disablePopup},write:{enabled:!0,ignoreOrigin:!0,writer(e,t,s){t[s]=!e}},origins:{"portal-item":{default:!0},"web-scene":{default:!0}}}})],a.prototype,"popupEnabled",void 0),i([o({type:at,json:{read:!1}})],a.prototype,"popupTemplate",null),i([o({readOnly:!0})],a.prototype,"defaultPopupTemplate",null),a=i([d(_e)],a);const Lt=a;export{Lt as default}; diff --git a/dist/assets/VoxelLayerView3D-FruX8zyo.js b/dist/assets/VoxelLayerView3D-4VCjvhwH.js similarity index 62% rename from dist/assets/VoxelLayerView3D-FruX8zyo.js rename to dist/assets/VoxelLayerView3D-4VCjvhwH.js index 603d958..39e8b6d 100644 --- a/dist/assets/VoxelLayerView3D-FruX8zyo.js +++ b/dist/assets/VoxelLayerView3D-4VCjvhwH.js @@ -1 +1 @@ -import{E as y,al as v,fK as T,d as l,P as E,fL as r,fM as V,fN as x,bn as A,ar as M,fO as I,aG as L,aF as D,as as P,Z as w,e as b,y as _,c as F,aa as f}from"./index-J0iiHjMT.js";import{n as $}from"./LayerView3D-iOx2MD1g.js";import{i as C}from"./PopupSceneLayerView-cRxapYqF.js";import{u as R}from"./LayerView-efDufa6j.js";var a;(function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"})(a||(a={}));const h=f(),S=f();let u=class extends C($(R)){constructor(){super(...arguments),this._suspendedHandle=null,this._usedMemory=0,this._futureMemory=0,this.type="voxel-3d",this.slicePlaneEnabled=!1,this._wasmLayerId=-1,this.ignoresMemoryFactor=!0,this._dbgFlags=new Set}get baseUrl(){var e;return((e=this.layer.parsedUrl)==null?void 0:e.path)??""}get wasmLayerId(){return this._wasmLayerId}initialize(){var c;if(this._dbgFlags.add(a.Error),this.view.viewingMode!=="local")throw new y("voxel:unsupported-viewingMode","Voxel layers support local viewingMode only.",{});if(!((c=this.view._stage.renderView.renderingContext.capabilities.colorBufferFloat)!=null&&c.textureFloat))throw new y("voxel:missing-color-buffer-float","Voxel layers require the WebGL2 extension EXT_color_buffer_float",{});const e=this.layer.spatialReference;if(!v(e,this.view.spatialReference))throw new y("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const s=this.layer.currentVariableId,i=this.layer.getVolume(s),o=this.layer.getVariable(s);if(i!=null&&o!=null){const d=i.dimensions[0],t=i.dimensions[1],m=i.zDimension;if(m>1){const g=i.dimensions[m],W=d.size*t.size*g.size;let p=1;switch(o.renderingFormat.type){case"Int16":case"UInt16":p=2;break;case"Int32":case"UInt32":case"Float32":p=4}this._futureMemory=p*W}}const n=T(this).then(d=>{this._wasmLayerId=d,this._suspendedHandle=l(()=>this.suspended,t=>{const m=r(this.view);m&&m.setEnabled(this,!t)},E),this.addHandles([l(()=>this.layer.renderMode,t=>this._pushRenderModeToWasm(t)),l(()=>this.layer.currentVariableId,t=>this._pushCurrentVariableIdToWasm(t)),l(()=>this.layer.getSections(),t=>this._pushSectionsToWasm(t)),l(()=>this.layer.getVariableStyles(),t=>this._pushVariableStylesToWasm(t)),l(()=>this.layer.getVolumeStyles(),t=>this._pushVolumeStylesToWasm(t)),l(()=>this.layer.enableDynamicSections,t=>this._pushEnableDynamicSectionsToWasm(t)),l(()=>this.layer.enableIsosurfaces,t=>this._pushEnableIsosurfacesToWasm(t)),l(()=>this.layer.enableSections,t=>this._pushEnableSectionsToWasm(t)),l(()=>this.layer.enableSlices,t=>this._pushEnableSlicesToWasm(t)),l(()=>this.slicePlaneEnabled,t=>this._pushAnalysisSliceToWasm(t,this.view.slicePlane)),l(()=>this.view.slicePlane,t=>this._pushAnalysisSliceToWasm(this.slicePlaneEnabled,t))])}).catch(d=>{if(V(this),this._wasmLayerId=-1,d===-1)throw new y("voxel:addLayer-failure","The voxel layer description was invalid.",{});if(d===-2)throw new y("voxel:addLayer-failure","The voxel layer web assembly module failed to download.",{})});this.addResolvingPromise(n)}destroy(){V(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null)}isUpdating(){const e=r(this.view);return!(this._wasmLayerId<0||e==null)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}get usedMemory(){return this._usedMemory}get unloadedMemory(){return this._futureMemory}get performanceInfo(){return{nodes:0,displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null}}whenGraphicBounds(e,s){const i=e.attributes["Voxel.WorldPosition"];if(i){const o=x(),n=JSON.parse(i);if(A(n,this.view.renderSpatialReference,S,this.view.spatialReference||M.WGS84))return I(o,S),Promise.resolve({boundingBox:o,screenSpaceObjects:[]})}return Promise.reject()}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}captureFrustum(){const e=r(this.view);e==null||e.captureFrustum()}toggleFullVolumeExtentDraw(){const e=r(this.view);e==null||e.toggleFullVolumeExtentDraw(this)}getLayerTimes(){const e=r(this.view);return(e==null?void 0:e.getLayerTimes(this))??[]}getCurrentLayerTimeIndex(){const e=r(this.view);return(e==null?void 0:e.getCurrentLayerTimeIndex(this))??0}_pushRenderModeToWasm(e){const s=r(this.view);this._dbg(a.VerboseAPI,"VoxelLayerView3D._pushRenderModeToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s!=null&&s.setRenderMode(this,e)||this._dbg(a.Error,"VoxelLayerView3D._pushRenderModeToWasm() failed!")}_pushSectionsToWasm(e){const s=r(this.view);this._dbg(a.VerboseAPI,"VoxelLayerView3D._pushSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s!=null&&s.setStaticSections(this,e)||this._dbg(a.Error,"VoxelLayerView3D._pushSectionsToWasm() failed!")}_pushCurrentVariableIdToWasm(e){const s=r(this.view);this._dbg(a.VerboseAPI,"VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, "+(s?"have WASM":"don't have WASM!!!")),s!=null&&s.setCurrentVariable(this,e)||this._dbg(a.Error,"VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!")}_pushVariableStylesToWasm(e){const s=r(this.view);this._dbg(a.VerboseAPI,"VoxelLayerView3D._pushVariableStylesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s!=null&&s.setVariableStyles(this,e)||this._dbg(a.Error,"VoxelLayerView3D._pushVariableStylesToWasm() failed!")}_accountForEnableSlices(e,s){const i=s??this.layer.enableSlices;for(let o=0;o1){const g=a.dimensions[m],W=d.size*t.size*g.size;let p=1;switch(o.renderingFormat.type){case"Int16":case"UInt16":p=2;break;case"Int32":case"UInt32":case"Float32":p=4}this._futureMemory=p*W}}const n=T(this).then(d=>{this._wasmLayerId=d,this._suspendedHandle=l(()=>this.suspended,t=>{const m=r(this.view);m&&m.setEnabled(this,!t)},E),this.addHandles([l(()=>this.layer.renderMode,t=>this._pushRenderModeToWasm(t)),l(()=>this.layer.currentVariableId,t=>this._pushCurrentVariableIdToWasm(t)),l(()=>this.layer.getSections(),t=>this._pushSectionsToWasm(t)),l(()=>this.layer.getVariableStyles(),t=>this._pushVariableStylesToWasm(t)),l(()=>this.layer.getVolumeStyles(),t=>this._pushVolumeStylesToWasm(t)),l(()=>this.layer.enableDynamicSections,t=>this._pushEnableDynamicSectionsToWasm(t)),l(()=>this.layer.enableIsosurfaces,t=>this._pushEnableIsosurfacesToWasm(t)),l(()=>this.layer.enableSections,t=>this._pushEnableSectionsToWasm(t)),l(()=>this.layer.enableSlices,t=>this._pushEnableSlicesToWasm(t)),l(()=>this.slicePlaneEnabled,t=>this._pushAnalysisSliceToWasm(t,this.view.slicePlane)),l(()=>this.view.slicePlane,t=>this._pushAnalysisSliceToWasm(this.slicePlaneEnabled,t))])}).catch(d=>{if(V(this),this._wasmLayerId=-1,d===-1)throw new y("voxel:addLayer-failure","The voxel layer description was invalid.",{});if(d===-2)throw new y("voxel:addLayer-failure","The voxel layer web assembly module failed to download.",{})});this.addResolvingPromise(n)}destroy(){V(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null)}isUpdating(){const e=r(this.view);return!(this._wasmLayerId<0||e==null)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}get usedMemory(){return this._usedMemory}get unloadedMemory(){return this._futureMemory}get performanceInfo(){return{nodes:0,displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null}}whenGraphicBounds(e,s){const a=e.attributes["Voxel.WorldPosition"];if(a){const o=x(),n=JSON.parse(a);if(A(n,this.view.renderSpatialReference,S,this.view.spatialReference||I.WGS84))return M(o,S),Promise.resolve({boundingBox:o,screenSpaceObjects:[]})}return Promise.reject()}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}captureFrustum(){const e=r(this.view);e==null||e.captureFrustum()}toggleFullVolumeExtentDraw(){const e=r(this.view);e==null||e.toggleFullVolumeExtentDraw(this)}getLayerTimes(){const e=r(this.view);return(e==null?void 0:e.getLayerTimes(this))??[]}getCurrentLayerTimeIndex(){const e=r(this.view);return(e==null?void 0:e.getCurrentLayerTimeIndex(this))??0}_pushRenderModeToWasm(e){const s=r(this.view);this._dbg(i.VerboseAPI,"VoxelLayerView3D._pushRenderModeToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s!=null&&s.setRenderMode(this,e)||this._dbg(i.Error,"VoxelLayerView3D._pushRenderModeToWasm() failed!")}_pushSectionsToWasm(e){const s=r(this.view);this._dbg(i.VerboseAPI,"VoxelLayerView3D._pushSectionsToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s!=null&&s.setStaticSections(this,e)||this._dbg(i.Error,"VoxelLayerView3D._pushSectionsToWasm() failed!")}_pushCurrentVariableIdToWasm(e){const s=r(this.view);this._dbg(i.VerboseAPI,"VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, "+(s?"have WASM":"don't have WASM!!!")),s!=null&&s.setCurrentVariable(this,e)||this._dbg(i.Error,"VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!")}_pushVariableStylesToWasm(e){const s=r(this.view);this._dbg(i.VerboseAPI,"VoxelLayerView3D._pushVariableStylesToWasm() called, "+(s?"have WASM":"don't have WASM!!!")),s!=null&&s.setVariableStyles(this,e)||this._dbg(i.Error,"VoxelLayerView3D._pushVariableStylesToWasm() failed!")}_accountForEnableSlices(e,s){const a=s??this.layer.enableSlices;for(let o=0;o$(()=>import("./vxlLayer-oRewqFuR.js"),__vite__mapDeps([0,1,2])).then(i=>i.v).then(({default:i})=>{const s=i({locateFile:he,preinitializedWebGLContext:e,onRuntimeInitialized:()=>t(s)})})).catch(t=>{throw t})}function he(e){return q(`esri/libs/vxl/${e}`)}const v=O.getLogger("esri.layers.VoxelWasmPerSceneView");var o;(function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"})(o||(o={}));let E=class extends z{constructor(e){super(e),this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.produces=new Map([[j.VOXEL,()=>!!this._vxl&&this.view.viewingMode==="local"]]),this.type=H.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(e===o.Error?v.error(t):v.warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view._stage&&(this._dbg(o.Lifetime,"--removeRenderPlugin--"),this.view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(o.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([L(()=>this.view.ready,e=>{e&&this.view.viewingMode==="local"?(this._dbg(o.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view._stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(o.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())},F),L(()=>{var e;return(e=this.view)==null?void 0:e.qualityProfile},e=>{this._dbg(o.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))},F),L(()=>{var e;return(e=this.view)==null?void 0:e.timeExtent},()=>{var e;if(this._vxl){const t=this._getTimeArgs((e=this.view)==null?void 0:e.timeExtent);this._dbg(o.Rendering,"sceneView timeExtent changed to useTime="+t.useTime+" st="+t.startTime+" et="+t.endTime),this._vxl.set_scene_time_extent(t.startTime,t.endTime,t.useTime),this._renderPluginContext.requestRender()}},F),L(()=>{var e;return(e=this.view)==null?void 0:e.stationary},e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()})])}initializeRenderContext(e){this._dbg(o.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;t.type===G.WEBGL2?(this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)):this._dbg(o.Error,"WebGL 1 context only!")}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(o.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!this._rctx)return void this._dbg(o.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const i=!!this._rctx,s=!!this._renderTargetToRestore;if(!i||!s)return 0;const a=this._renderTargetToRestore.fbo.depthStencilTexture;return a?(t===0?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(a,e,!0),1):(this._dbg(o.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,i){if(!this._rctx)return void this._dbg(o.Error,"modifyAllocation callback has no rendering context!");const s=e;i===1?this._rctx.instanceCounter.increment(s,t):this._rctx.instanceCounter.decrement(s,t)}_setBlendState(e,t,i,s){this._rctx?(this._rctx.setBlendingEnabled(e===1),this._rctx.setBlendFunction(t,i),this._rctx.setBlendEquation(s)):this._dbg(o.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(o.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,i){this._rctx?(this._rctx.setDepthFunction(i),this._rctx.setDepthTestEnabled(e===1),this._rctx.setDepthWriteEnabled(t===1),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(X.ALWAYS,0,255),this._rctx.setStencilOpSeparate(V.FRONT,b.KEEP,b.INCR,b.KEEP),this._rctx.setStencilOpSeparate(V.BACK,b.KEEP,b.DECR,b.KEEP)):this._dbg(o.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case w.None:this._rctx.setFaceCullingEnabled(!1);break;case w.Back:this._rctx.setCullFace(V.BACK),this._rctx.setFaceCullingEnabled(!0);break;case w.Front:this._rctx.setCullFace(V.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(o.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,i,s){this._rctx?this._rctx.setViewport(e,t,i,s):this._dbg(o.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach((e,t)=>{if(e.needMemoryUsageUpdate){const i=this._vxl.estimate_memory_usage(t);i>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(i))}})}_syncRequestsResponses(){this._layers.forEach((e,t)=>{const i=[];e.responses.forEach((r,u)=>{i.push(u),this._dbg(o.RequestResponse,"responding for requestID:"+u+" size:"+r.size),this._vxl.respond(t,u,r),r.requestType!==C.TreeIndex&&r.requestType!==C.Section||(e.needMemoryUsageUpdate=!0)});const s=e.responses;for(const r of i)s.delete(r);const a=this._vxl.get_new_requests(t),n=e.abortController.signal;for(const r in a){e.outstandingRequestCount+=1,e.outstandingRequestCount===1&&e.layerView.updatingFlagChanged();const u=a[r],g={responseType:"array-buffer",signal:n};this._dbg(o.RequestResponse,"making requestID:"+r+" url:"+u.url),Y(u.url,g).then(h=>{e.outstandingRequestCount-=1,e.outstandingRequestCount===0&&e.layerView.updatingFlagChanged(),this._dbg(o.RequestResponse,"have response for requestID:"+r);let _=0;if(h.data.byteLength>0){_=this._vxl._malloc(h.data.byteLength);const d=new Uint8Array(this._vxl.HEAPU8.buffer,_,h.data.byteLength),m=new Uint8Array(h.data);for(let f=0;f{e.outstandingRequestCount-=1,e.outstandingRequestCount===0&&e.layerView.updatingFlagChanged(),K(h)||(this._dbg(o.Error,`requestID:${r} failed, error=${h.toString()}`),s.set(+r,{responseType:u.responseType,ptr:0,size:0,success:!1,requestType:u.requestType}))})}})}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach((i,s)=>{if(i.layerView.wasmLayerId===e.wasmLayerId){const a=this._vxl.get_layer_epoch_times(s,e.layer.currentVariableId);for(let n=0;n{i.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(s))}),t}setEnabled(e,t){this._layers.forEach((i,s)=>{i.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(s,t),i.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())})}setStaticSections(e,t){const i={mask:x.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,i,!0)}setCurrentVariable(e,t){const i={mask:x.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,i,!0)}setRenderMode(e,t){const i={mask:x.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,i,!0)}setVerticalExaggerationAndOffset(e,t,i,s){const a={mask:x.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:i,verticalOffset:s}};return this._doMaskedUIUpdate(e,a,!0)}setVariableStyles(e,t){const i={mask:x.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,i,!0)}setVolumeStyles(e,t){const i={mask:x.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,i,!0)}setEnableDynamicSections(e,t){const i={mask:x.ContainerVisibility,containerIsVisible:t,container:S.DynamicSections};return this._doMaskedUIUpdate(e,i,!0)}setEnableIsosurfaces(e,t){const i={mask:x.ContainerVisibility,containerIsVisible:t,container:S.Isosurfaces};return this._doMaskedUIUpdate(e,i,!0)}setEnableSections(e,t){const i={mask:x.ContainerVisibility,containerIsVisible:t,container:S.StaticSections};return this._doMaskedUIUpdate(e,i,!0)}setAnalysisSlice(e,t,i,s){const a={mask:x.AnalysisSlice,analysisSlice:{point:i,normal:s,enabled:t}};return this._doMaskedUIUpdate(e,a,!0)}_doMaskedUIUpdate(e,t,i){if(!this._vxl)return!1;let s=!1;return this._layers.forEach((a,n)=>{if(a.layerView.wasmLayerId===e.wasmLayerId){const r={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(r)&&(s=this._vxl.handle_masked_ui_update(n,r.ptr,r.byteCount)===1,r.isReusable||this._vxl._free(r.ptr))}}),s&&i&&this._renderPluginContext.requestRender(),s}_addTriangleToWasmBuffer(e,t,i,s,a){return e[3*t]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],e[3*(t+=1)]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=a[0],e[3*t+1]=a[1],e[3*t+2]=a[2],t+=1}_addNormalToWasmBuffer(e,t,i){return e[3*t]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,i=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),s=new Float32Array(this._vxl.HEAPF32.buffer,i,3*e),a=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),n=new Float32Array(this._vxl.HEAPF32.buffer,a,e),r=this._frustum.points[p.NEAR_BOTTOM_LEFT],u=this._frustum.points[p.NEAR_BOTTOM_RIGHT],g=this._frustum.points[p.NEAR_TOP_RIGHT],h=this._frustum.points[p.NEAR_TOP_LEFT],_=this._frustum.points[p.FAR_BOTTOM_LEFT],d=this._frustum.points[p.FAR_BOTTOM_RIGHT],m=this._frustum.points[p.FAR_TOP_RIGHT],f=this._frustum.points[p.FAR_TOP_LEFT];let l=0,c=0;const y=this._frustum.planes[T.NEAR];l=this._addTriangleToWasmBuffer(s,l,g,u,r),c=this._addNormalToWasmBuffer(n,c,y),l=this._addTriangleToWasmBuffer(s,l,r,h,g),c=this._addNormalToWasmBuffer(n,c,y);const R=this._frustum.planes[T.FAR];l=this._addTriangleToWasmBuffer(s,l,_,d,m),c=this._addNormalToWasmBuffer(n,c,R),l=this._addTriangleToWasmBuffer(s,l,m,f,_),c=this._addNormalToWasmBuffer(n,c,R);const I=this._frustum.planes[T.TOP];l=this._addTriangleToWasmBuffer(s,l,m,g,h),c=this._addNormalToWasmBuffer(n,c,I),l=this._addTriangleToWasmBuffer(s,l,h,f,m),c=this._addNormalToWasmBuffer(n,c,I);const k=this._frustum.planes[T.BOTTOM];l=this._addTriangleToWasmBuffer(s,l,r,u,d),c=this._addNormalToWasmBuffer(n,c,k),l=this._addTriangleToWasmBuffer(s,l,d,_,r),c=this._addNormalToWasmBuffer(n,c,k);const B=this._frustum.planes[T.LEFT];l=this._addTriangleToWasmBuffer(s,l,h,r,_),c=this._addNormalToWasmBuffer(n,c,B),l=this._addTriangleToWasmBuffer(s,l,_,f,h),c=this._addNormalToWasmBuffer(n,c,B);const U=this._frustum.planes[T.RIGHT];l=this._addTriangleToWasmBuffer(s,l,g,m,d),c=this._addNormalToWasmBuffer(n,c,U),l=this._addTriangleToWasmBuffer(s,l,d,u,g),c=this._addNormalToWasmBuffer(n,c,U),this._frustumRenderableId!==-1&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(i,3*e,a,e,255,0,0,64),this._vxl._free(i),this._vxl._free(a),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){this._renderCoordsHelper===null&&(this._renderCoordsHelper=J.create(Q.Local,Z(!1,this.view.spatialReference))),this._frustum===null&&(this._frustum=new ee(this._renderCoordsHelper)),this._captureFrustum=!0,this._renderPluginContext!==null&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach((t,i)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(i),this._renderPluginContext.requestRender())})}addVoxelLayer(e){if(!this._vxl){const i={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise((a,n)=>{i.resolveCallback=a,i.rejectCallback=n});return this._newLayers.push(i),s}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const s=this._newLayers.findIndex(n=>e.uid===n.layerView.uid);s>=0&&(this._newLayers[s].resolveCallback(-1),this._newLayers.splice(s,1));const a=this._newLayers.length;return a===0&&(this._dbg(o.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),a}let t=-1;this._layers.forEach((s,a)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=a,s.abortController.abort(),this._vxl.remove_layer(t);const n=this.layerUid.indexOf(e.layer.uid);n!==-1&&this.layerUid.splice(n,1)}}),t>=0&&this._layers.delete(t);const i=this._layers.size;return i===0&&(this._dbg(o.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),i}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e=0){(g=t.test)!=null&&g.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const h=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:h,needMemoryUsageUpdate:!1}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||P("mac")){const _=[];let d="";for(const m of e.layer.variables)m.renderingFormat.type!=="Int16"&&m.renderingFormat.type!=="UInt16"||(_.push(m.name),m.id===e.layer.currentVariableId&&(d=m.name));d!==""&&v.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${d}' in this browser`),_.length>0&&v.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${_.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const _=[];let d="";for(const m of e.layer.variables)m.renderingFormat.type==="Float32"&&(_.push(m.name),m.id===e.layer.currentVariableId&&(d=m.name));d!==""&&v.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${d}' in this browser`),_.length>0&&v.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${_.toString()}' in this browser`)}return P("esri-mobile")&&v.warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,i=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(i[0],i[1],i[2],t[0],t[1],t[2]);const s=this._vxl.cull();this._dbg(o.RequestResponse,"missingResourceCount="+s),this._moreToLoad=s>0,this._havePreparedWithAllLayers=this._newLayers.length===0,this._updateMemoryUsage()}renderNode(e){if(!this._vxl)return;for(const i of this._newLayers){const s=this._addVoxelLayer(i.layerView);s===-1?i.rejectCallback(-1):i.resolveCallback(s)}if(this._newLayers=[],this._layers.size===0)return void this._dbg(o.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this.view._stage.renderer.isFeatureEnabled(te.HighResolutionVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach(i=>{i.needMemoryUsageUpdate=!0})),t.x===0&&t.y===0||this._dbg(o.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(o.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._vxl&&(this._layers.forEach(e=>{e.abortController.abort()}),this._wasmMemBlocks.forEach(e=>{e!==0&&this._vxl._free(e)}),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=le(e).then(t=>{var f;if(this._vxl=t,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(o.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const i=this._getTimeArgs((f=this.view)==null?void 0:f.timeExtent),s=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),a=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),n=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),r=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),u=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),g=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),h=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),_=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!P("mac"),m=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(s,a,n,r,u,g,h,_,i.startTime,i.endTime,i.useTime,d,m),this._renderPluginContext&&this._renderPluginContext.requestRender()}).catch(()=>{for(const t of this._newLayers)t.rejectCallback(-2);this._dbg(o.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()})),this._vxlPromise)}pickDepth(e,t,i){if(!this._vxl||!this._rctx||this._layers.size===0)return null;const s=i.viewport[3]-t;if(e<0||e>i.viewport[2]||t<0||t>i.viewport[3])return this._dbg(o.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${s.toFixed(0)}]]`),null;this._beforeDraw();const a=i.viewForward,n=i.eye;this._vxl.update_camera_pos_and_direction(n[0],n[1],n[2],a[0],a[1],a[2]),this.updateWasmCamera(i),this._vxl.begin_frame();const r=this._vxl.pick_depth(e,s);return this._afterDraw(),r.success?r.distanceToCamera:null}pickObject(e,t,i,s){if(!this._vxl||!this._rctx||this._layers.size===0)return null;const a=Math.round(e),n=Math.round(t);if(a<0||a>i.viewport[2]||n<0||n>i.viewport[3])return this._dbg(o.Error,`[js] pickObject: outOfRange, screenXY=[${a}, ${n}], vp=[${i.viewport.toString()}]`),null;this._beforeDraw();const r=i.viewForward,u=i.eye;this._vxl.update_camera_pos_and_direction(u[0],u[1],u[2],r[0],r[1],r[2]),this.updateWasmCamera(i),this._vxl.begin_frame();let g=null;if(s.length===0)g=this._vxl.pick_object(a,n,0,0);else{const h={str:JSON.stringify({layerIds:s}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(h)&&(g=this._vxl.pick_object(a,n,h.ptr,h.byteCount),h.isReusable||this._vxl._free(h.ptr))}return this._afterDraw(),g}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,i,s,a){if(!this._vxl||!this._rctx||this._layers.size===0||!e.options.selectionMode||e.options.isFiltered)return;if(a[0]<0||a[0]>e.camera.viewport[2]||a[1]<0||a[1]>e.camera.viewport[3])return this._dbg(o.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${a[0].toFixed(0)}, ${a[1].toFixed(0)}]`),null;const n=[];this._layers.forEach(g=>{e.options.filteredLayerUids.includes(g.layerView.layer.uid)&&n.push(g.layerView.wasmLayerId)});const r=this.pickObject(a[0],a[1],e.camera,n);if(r==null||r.layerId===-1)return;const u=this._layers.get(r.layerId);if(u){const g=u.layerView.layer.uid,h=r.distanceToCamera/ie(i,s),_=ne();_[0]=r.worldX,_[1]=r.worldY,_[2]=r.worldZ;const d={};if(r.continuousValue!=null&&r.continuousValueUnits!=null?d["Voxel.ServiceValue"]=`${r.continuousValue.toLocaleString()} ${r.continuousValueUnits}`:r.uniqueValueLabel!=null&&r.uniqueValue!=null?d["Voxel.ServiceValue"]=`${r.uniqueValueLabel} (${r.uniqueValue})`:r.uniqueValue!=null&&(d["Voxel.ServiceValue"]=`${r.uniqueValue}`),d["Voxel.ServiceVariableLabel"]=r.variableLabel,d["Voxel.Position"]=r.voxelSpacePosition,r.epochTime!=null&&r.nativeTime!=null&&r.nativeTimeUnits!=null){const y=new Date(r.epochTime);d["Voxel.ServiceLocalTime"]=y.toString(),d["Voxel.ServiceNativeTime"]=`${r.nativeTime.toLocaleString()} ${r.nativeTimeUnits}`}r.depth!=null&&r.depthUnits!=null&&(d["Voxel.ServiceDepth"]=`${r.depth.toLocaleString()} ${r.depthUnits}`);const m=r.faceNormal;d["Voxel.WorldPosition"]=`[${_[0]}, ${_[1]}, ${_[2]}]`;const f=y=>{const R=new oe(_,g,()=>this._createVoxelGraphic(u.layerView.layer,d));y.set(this.type,R,h,m)},l=e.results,c=e.options.store===se.ALL;if((l.min.dist==null||hl.max.dist)&&f(l.max),c){const y=re(e.ray);f(y),e.results.all.push(y)}}}_createVoxelGraphic(e,t){return new ae({layer:e,sourceLayer:e,attributes:t})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,i){this._vxl&&this._vxl.set_upscaling_limits(e,t,i)}};A([N({constructOnly:!0})],E.prototype,"view",void 0),E=A([D("esri.layers.VoxelWasmPerSceneView")],E);const ue=E;export{ue as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/vxlLayer-oRewqFuR.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/VoxelWasmPerSceneView-xko8AJDS.js b/dist/assets/VoxelWasmPerSceneView-xko8AJDS.js new file mode 100644 index 0000000..3e4f922 --- /dev/null +++ b/dist/assets/VoxelWasmPerSceneView-xko8AJDS.js @@ -0,0 +1,7 @@ +import{de as $,kr as q,R as O,e as A,y as N,c as D,m2 as z,m3 as H,ce as j,B as L,P as F,m4 as G,m5 as X,m6 as V,m7 as b,av as K,ac as Y,m8 as p,m9 as T,ma as Q,F as J,mb as Z,mc as ee,dE as P,md as te,by as ie,cc as se,me as re,K as ae,a8 as ne,mf as oe}from"./index-pCX-0tJH.js";var M,C,w,W,x,S;(function(e){e[e.Binary=0]="Binary",e[e.JSON=1]="JSON"})(M||(M={})),function(e){e[e.TreeIndex=0]="TreeIndex",e[e.TreeStats=1]="TreeStats",e[e.TreeData=2]="TreeData",e[e.BrickBundles=3]="BrickBundles",e[e.Section=4]="Section",e[e.VariableStats=5]="VariableStats"}(C||(C={})),function(e){e[e.None=1]="None",e[e.Front=2]="Front",e[e.Back=3]="Back"}(w||(w={})),function(e){e[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High"}(W||(W={})),function(e){e[e.None=0]="None",e[e.StaticSections=1]="StaticSections",e[e.Slices=2]="Slices",e[e.DynamicSections=4]="DynamicSections",e[e.GhostShell=8]="GhostShell",e[e.Isosurface=16]="Isosurface",e[e.Quality=32]="Quality",e[e.SunLocation=64]="SunLocation",e[e.StaticSectionSelection=128]="StaticSectionSelection",e[e.ExaggerationAndOffset=256]="ExaggerationAndOffset",e[e.CurrentTime=512]="CurrentTime",e[e.CurrentVariable=1024]="CurrentVariable",e[e.DeleteIsosurface=2048]="DeleteIsosurface",e[e.ContainerVisibility=4096]="ContainerVisibility",e[e.RenderMode=8192]="RenderMode",e[e.Optimization=16384]="Optimization",e[e.VariableStyles=32768]="VariableStyles",e[e.VolumeStyles=65536]="VolumeStyles",e[e.AnalysisSlice=131072]="AnalysisSlice"}(x||(x={})),function(e){e[e.Isosurfaces=0]="Isosurfaces",e[e.DynamicSections=1]="DynamicSections",e[e.StaticSections=2]="StaticSections"}(S||(S={}));function le(e){return new Promise(t=>$(()=>import("./vxlLayer-t5pvmNBM.js"),__vite__mapDeps([0,1,2])).then(i=>i.v).then(({default:i})=>{const s=i({locateFile:he,preinitializedWebGLContext:e,onRuntimeInitialized:()=>t(s)})})).catch(t=>{throw t})}function he(e){return q(`esri/libs/vxl/${e}`)}const v=O.getLogger("esri.layers.VoxelWasmPerSceneView");var o;(function(e){e[e.Lifetime=1]="Lifetime",e[e.RequestResponse=2]="RequestResponse",e[e.Rendering=3]="Rendering",e[e.Error=4]="Error"})(o||(o={}));let E=class extends z{constructor(e){super(e),this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.produces=new Map([[H.VOXEL,()=>!!this._vxl&&this.view.viewingMode==="local"]]),this.type=j.VOXEL,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(e===o.Error?v.error(t):v.warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view._stage&&(this._dbg(o.Lifetime,"--removeRenderPlugin--"),this.view._stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(o.Lifetime,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([L(()=>this.view.ready,e=>{e&&this.view.viewingMode==="local"?(this._dbg(o.Lifetime,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view._stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(o.Lifetime,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())},F),L(()=>{var e;return(e=this.view)==null?void 0:e.qualityProfile},e=>{this._dbg(o.Rendering,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))},F),L(()=>{var e;return(e=this.view)==null?void 0:e.timeExtent},()=>{var e;if(this._vxl){const t=this._getTimeArgs((e=this.view)==null?void 0:e.timeExtent);this._dbg(o.Rendering,"sceneView timeExtent changed to useTime="+t.useTime+" st="+t.startTime+" et="+t.endTime),this._vxl.set_scene_time_extent(t.startTime,t.endTime,t.useTime),this._renderPluginContext.requestRender()}},F),L(()=>{var e;return(e=this.view)==null?void 0:e.stationary},e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()})])}initializeRenderContext(e){this._dbg(o.Lifetime,"--initializeRenderContext--");const t=e.renderContext.rctx;t.type===G.WEBGL2?(this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)):this._dbg(o.Error,"WebGL 1 context only!")}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(o.Lifetime,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!this._rctx)return void this._dbg(o.Error,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const i=!!this._rctx,s=!!this._renderTargetToRestore;if(!i||!s)return 0;const a=this._renderTargetToRestore.fbo.depthStencilTexture;return a?(t===0?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(a,e,!0),1):(this._dbg(o.Error,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,i){if(!this._rctx)return void this._dbg(o.Error,"modifyAllocation callback has no rendering context!");const s=e;i===1?this._rctx.instanceCounter.increment(s,t):this._rctx.instanceCounter.decrement(s,t)}_setBlendState(e,t,i,s){this._rctx?(this._rctx.setBlendingEnabled(e===1),this._rctx.setBlendFunction(t,i),this._rctx.setBlendEquation(s)):this._dbg(o.Error,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(o.Error,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,i){this._rctx?(this._rctx.setDepthFunction(i),this._rctx.setDepthTestEnabled(e===1),this._rctx.setDepthWriteEnabled(t===1),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(X.ALWAYS,0,255),this._rctx.setStencilOpSeparate(V.FRONT,b.KEEP,b.INCR,b.KEEP),this._rctx.setStencilOpSeparate(V.BACK,b.KEEP,b.DECR,b.KEEP)):this._dbg(o.Error,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case w.None:this._rctx.setFaceCullingEnabled(!1);break;case w.Back:this._rctx.setCullFace(V.BACK),this._rctx.setFaceCullingEnabled(!0);break;case w.Front:this._rctx.setCullFace(V.FRONT),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(o.Error,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,i,s){this._rctx?this._rctx.setViewport(e,t,i,s):this._dbg(o.Error,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach((e,t)=>{if(e.needMemoryUsageUpdate){const i=this._vxl.estimate_memory_usage(t);i>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(i))}})}_syncRequestsResponses(){this._layers.forEach((e,t)=>{const i=[];e.responses.forEach((r,u)=>{i.push(u),this._dbg(o.RequestResponse,"responding for requestID:"+u+" size:"+r.size),this._vxl.respond(t,u,r),r.requestType!==C.TreeIndex&&r.requestType!==C.Section||(e.needMemoryUsageUpdate=!0)});const s=e.responses;for(const r of i)s.delete(r);const a=this._vxl.get_new_requests(t),n=e.abortController.signal;for(const r in a){e.outstandingRequestCount+=1,e.outstandingRequestCount===1&&e.layerView.updatingFlagChanged();const u=a[r],g={responseType:"array-buffer",signal:n};this._dbg(o.RequestResponse,"making requestID:"+r+" url:"+u.url),K(u.url,g).then(h=>{e.outstandingRequestCount-=1,e.outstandingRequestCount===0&&e.layerView.updatingFlagChanged(),this._dbg(o.RequestResponse,"have response for requestID:"+r);let _=0;if(h.data.byteLength>0){_=this._vxl._malloc(h.data.byteLength);const d=new Uint8Array(this._vxl.HEAPU8.buffer,_,h.data.byteLength),m=new Uint8Array(h.data);for(let f=0;f{e.outstandingRequestCount-=1,e.outstandingRequestCount===0&&e.layerView.updatingFlagChanged(),Y(h)||(this._dbg(o.Error,`requestID:${r} failed, error=${h.toString()}`),s.set(+r,{responseType:u.responseType,ptr:0,size:0,success:!1,requestType:u.requestType}))})}})}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach((i,s)=>{if(i.layerView.wasmLayerId===e.wasmLayerId){const a=this._vxl.get_layer_epoch_times(s,e.layer.currentVariableId);for(let n=0;n{i.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(s))}),t}setEnabled(e,t){this._layers.forEach((i,s)=>{i.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(s,t),i.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())})}setStaticSections(e,t){const i={mask:x.StaticSections,staticSections:t};return this._doMaskedUIUpdate(e,i,!0)}setCurrentVariable(e,t){const i={mask:x.CurrentVariable,currentVariable:t};return this._doMaskedUIUpdate(e,i,!0)}setRenderMode(e,t){const i={mask:x.RenderMode,renderMode:t};return this._doMaskedUIUpdate(e,i,!0)}setVerticalExaggerationAndOffset(e,t,i,s){const a={mask:x.ExaggerationAndOffset,volStyleDesc:{volumeId:t,verticalExaggeration:i,verticalOffset:s}};return this._doMaskedUIUpdate(e,a,!0)}setVariableStyles(e,t){const i={mask:x.VariableStyles,variableStyles:t};return this._doMaskedUIUpdate(e,i,!0)}setVolumeStyles(e,t){const i={mask:x.VolumeStyles,volumeStyles:t};return this._doMaskedUIUpdate(e,i,!0)}setEnableDynamicSections(e,t){const i={mask:x.ContainerVisibility,containerIsVisible:t,container:S.DynamicSections};return this._doMaskedUIUpdate(e,i,!0)}setEnableIsosurfaces(e,t){const i={mask:x.ContainerVisibility,containerIsVisible:t,container:S.Isosurfaces};return this._doMaskedUIUpdate(e,i,!0)}setEnableSections(e,t){const i={mask:x.ContainerVisibility,containerIsVisible:t,container:S.StaticSections};return this._doMaskedUIUpdate(e,i,!0)}setAnalysisSlice(e,t,i,s){const a={mask:x.AnalysisSlice,analysisSlice:{point:i,normal:s,enabled:t}};return this._doMaskedUIUpdate(e,a,!0)}_doMaskedUIUpdate(e,t,i){if(!this._vxl)return!1;let s=!1;return this._layers.forEach((a,n)=>{if(a.layerView.wasmLayerId===e.wasmLayerId){const r={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(r)&&(s=this._vxl.handle_masked_ui_update(n,r.ptr,r.byteCount)===1,r.isReusable||this._vxl._free(r.ptr))}}),s&&i&&this._renderPluginContext.requestRender(),s}_addTriangleToWasmBuffer(e,t,i,s,a){return e[3*t]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],e[3*(t+=1)]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=a[0],e[3*t+1]=a[1],e[3*t+2]=a[2],t+=1}_addNormalToWasmBuffer(e,t,i){return e[3*t]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,i=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),s=new Float32Array(this._vxl.HEAPF32.buffer,i,3*e),a=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),n=new Float32Array(this._vxl.HEAPF32.buffer,a,e),r=this._frustum.points[p.NEAR_BOTTOM_LEFT],u=this._frustum.points[p.NEAR_BOTTOM_RIGHT],g=this._frustum.points[p.NEAR_TOP_RIGHT],h=this._frustum.points[p.NEAR_TOP_LEFT],_=this._frustum.points[p.FAR_BOTTOM_LEFT],d=this._frustum.points[p.FAR_BOTTOM_RIGHT],m=this._frustum.points[p.FAR_TOP_RIGHT],f=this._frustum.points[p.FAR_TOP_LEFT];let l=0,c=0;const y=this._frustum.planes[T.NEAR];l=this._addTriangleToWasmBuffer(s,l,g,u,r),c=this._addNormalToWasmBuffer(n,c,y),l=this._addTriangleToWasmBuffer(s,l,r,h,g),c=this._addNormalToWasmBuffer(n,c,y);const R=this._frustum.planes[T.FAR];l=this._addTriangleToWasmBuffer(s,l,_,d,m),c=this._addNormalToWasmBuffer(n,c,R),l=this._addTriangleToWasmBuffer(s,l,m,f,_),c=this._addNormalToWasmBuffer(n,c,R);const I=this._frustum.planes[T.TOP];l=this._addTriangleToWasmBuffer(s,l,m,g,h),c=this._addNormalToWasmBuffer(n,c,I),l=this._addTriangleToWasmBuffer(s,l,h,f,m),c=this._addNormalToWasmBuffer(n,c,I);const k=this._frustum.planes[T.BOTTOM];l=this._addTriangleToWasmBuffer(s,l,r,u,d),c=this._addNormalToWasmBuffer(n,c,k),l=this._addTriangleToWasmBuffer(s,l,d,_,r),c=this._addNormalToWasmBuffer(n,c,k);const B=this._frustum.planes[T.LEFT];l=this._addTriangleToWasmBuffer(s,l,h,r,_),c=this._addNormalToWasmBuffer(n,c,B),l=this._addTriangleToWasmBuffer(s,l,_,f,h),c=this._addNormalToWasmBuffer(n,c,B);const U=this._frustum.planes[T.RIGHT];l=this._addTriangleToWasmBuffer(s,l,g,m,d),c=this._addNormalToWasmBuffer(n,c,U),l=this._addTriangleToWasmBuffer(s,l,d,u,g),c=this._addNormalToWasmBuffer(n,c,U),this._frustumRenderableId!==-1&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(i,3*e,a,e,255,0,0,64),this._vxl._free(i),this._vxl._free(a),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){this._renderCoordsHelper===null&&(this._renderCoordsHelper=Q.create(J.Local,Z(!1,this.view.spatialReference))),this._frustum===null&&(this._frustum=new ee(this._renderCoordsHelper)),this._captureFrustum=!0,this._renderPluginContext!==null&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach((t,i)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(i),this._renderPluginContext.requestRender())})}addVoxelLayer(e){if(!this._vxl){const i={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise((a,n)=>{i.resolveCallback=a,i.rejectCallback=n});return this._newLayers.push(i),s}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const s=this._newLayers.findIndex(n=>e.uid===n.layerView.uid);s>=0&&(this._newLayers[s].resolveCallback(-1),this._newLayers.splice(s,1));const a=this._newLayers.length;return a===0&&(this._dbg(o.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),a}let t=-1;this._layers.forEach((s,a)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=a,s.abortController.abort(),this._vxl.remove_layer(t);const n=this.layerUid.indexOf(e.layer.uid);n!==-1&&this.layerUid.splice(n,1)}}),t>=0&&this._layers.delete(t);const i=this._layers.size;return i===0&&(this._dbg(o.Lifetime," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),i}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e=0){(g=t.test)!=null&&g.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const h=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:h,needMemoryUsageUpdate:!1}),this.layerUid.push(e.layer.uid),!this._halfIntTexturesAvailable||P("mac")){const _=[];let d="";for(const m of e.layer.variables)m.renderingFormat.type!=="Int16"&&m.renderingFormat.type!=="UInt16"||(_.push(m.name),m.id===e.layer.currentVariableId&&(d=m.name));d!==""&&v.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${d}' in this browser`),_.length>0&&v.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${_.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const _=[];let d="";for(const m of e.layer.variables)m.renderingFormat.type==="Float32"&&(_.push(m.name),m.id===e.layer.currentVariableId&&(d=m.name));d!==""&&v.error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${d}' in this browser`),_.length>0&&v.warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${_.toString()}' in this browser`)}return P("esri-mobile")&&v.warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bindParameters.camera.viewForward,i=e.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(i[0],i[1],i[2],t[0],t[1],t[2]);const s=this._vxl.cull();this._dbg(o.RequestResponse,"missingResourceCount="+s),this._moreToLoad=s>0,this._havePreparedWithAllLayers=this._newLayers.length===0,this._updateMemoryUsage()}renderNode(e){if(!this._vxl)return;for(const i of this._newLayers){const s=this._addVoxelLayer(i.layerView);s===-1?i.rejectCallback(-1):i.resolveCallback(s)}if(this._newLayers=[],this._layers.size===0)return void this._dbg(o.Error,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this.view._stage.renderer.isFeatureEnabled(te.HighResolutionVoxel),e.bindParameters.lighting.mainLight.direction[0],e.bindParameters.lighting.mainLight.direction[1],e.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach(i=>{i.needMemoryUsageUpdate=!0})),t.x===0&&t.y===0||this._dbg(o.Error,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bindParameters.camera),this._captureFrustum&&(this._frustum.update(e.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(o.Lifetime,"--destroy--"),this._removeRenderPlugin(),this._vxl&&(this._layers.forEach(e=>{e.abortController.abort()}),this._wasmMemBlocks.forEach(e=>{e!==0&&this._vxl._free(e)}),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=le(e).then(t=>{var f;if(this._vxl=t,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(o.Lifetime," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const i=this._getTimeArgs((f=this.view)==null?void 0:f.timeExtent),s=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),a=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),n=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),r=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),u=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),g=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),h=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),_=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),d=this._halfIntTexturesAvailable&&!P("mac"),m=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(s,a,n,r,u,g,h,_,i.startTime,i.endTime,i.useTime,d,m),this._renderPluginContext&&this._renderPluginContext.requestRender()}).catch(()=>{for(const t of this._newLayers)t.rejectCallback(-2);this._dbg(o.Error," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()})),this._vxlPromise)}pickDepth(e,t,i){if(!this._vxl||!this._rctx||this._layers.size===0)return null;const s=i.viewport[3]-t;if(e<0||e>i.viewport[2]||t<0||t>i.viewport[3])return this._dbg(o.Error,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${s.toFixed(0)}]]`),null;this._beforeDraw();const a=i.viewForward,n=i.eye;this._vxl.update_camera_pos_and_direction(n[0],n[1],n[2],a[0],a[1],a[2]),this.updateWasmCamera(i),this._vxl.begin_frame();const r=this._vxl.pick_depth(e,s);return this._afterDraw(),r.success?r.distanceToCamera:null}pickObject(e,t,i,s){if(!this._vxl||!this._rctx||this._layers.size===0)return null;const a=Math.round(e),n=Math.round(t);if(a<0||a>i.viewport[2]||n<0||n>i.viewport[3])return this._dbg(o.Error,`[js] pickObject: outOfRange, screenXY=[${a}, ${n}], vp=[${i.viewport.toString()}]`),null;this._beforeDraw();const r=i.viewForward,u=i.eye;this._vxl.update_camera_pos_and_direction(u[0],u[1],u[2],r[0],r[1],r[2]),this.updateWasmCamera(i),this._vxl.begin_frame();let g=null;if(s.length===0)g=this._vxl.pick_object(a,n,0,0);else{const h={str:JSON.stringify({layerIds:s}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(h)&&(g=this._vxl.pick_object(a,n,h.ptr,h.byteCount),h.isReusable||this._vxl._free(h.ptr))}return this._afterDraw(),g}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,i,s,a){if(!this._vxl||!this._rctx||this._layers.size===0||!e.options.selectionMode||e.options.isFiltered)return;if(a[0]<0||a[0]>e.camera.viewport[2]||a[1]<0||a[1]>e.camera.viewport[3])return this._dbg(o.Error,`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${a[0].toFixed(0)}, ${a[1].toFixed(0)}]`),null;const n=[];this._layers.forEach(g=>{e.options.filteredLayerUids.includes(g.layerView.layer.uid)&&n.push(g.layerView.wasmLayerId)});const r=this.pickObject(a[0],a[1],e.camera,n);if(r==null||r.layerId===-1)return;const u=this._layers.get(r.layerId);if(u){const g=u.layerView.layer.uid,h=r.distanceToCamera/ie(i,s),_=ne();_[0]=r.worldX,_[1]=r.worldY,_[2]=r.worldZ;const d={};if(r.continuousValue!=null&&r.continuousValueUnits!=null?d["Voxel.ServiceValue"]=`${r.continuousValue.toLocaleString()} ${r.continuousValueUnits}`:r.uniqueValueLabel!=null&&r.uniqueValue!=null?d["Voxel.ServiceValue"]=`${r.uniqueValueLabel} (${r.uniqueValue})`:r.uniqueValue!=null&&(d["Voxel.ServiceValue"]=`${r.uniqueValue}`),d["Voxel.ServiceVariableLabel"]=r.variableLabel,d["Voxel.Position"]=r.voxelSpacePosition,r.epochTime!=null&&r.nativeTime!=null&&r.nativeTimeUnits!=null){const y=new Date(r.epochTime);d["Voxel.ServiceLocalTime"]=y.toString(),d["Voxel.ServiceNativeTime"]=`${r.nativeTime.toLocaleString()} ${r.nativeTimeUnits}`}r.depth!=null&&r.depthUnits!=null&&(d["Voxel.ServiceDepth"]=`${r.depth.toLocaleString()} ${r.depthUnits}`);const m=r.faceNormal;d["Voxel.WorldPosition"]=`[${_[0]}, ${_[1]}, ${_[2]}]`;const f=y=>{const R=new oe(_,g,()=>this._createVoxelGraphic(u.layerView.layer,d));y.set(this.type,R,h,m)},l=e.results,c=e.options.store===se.ALL;if((l.min.dist==null||hl.max.dist)&&f(l.max),c){const y=re(e.ray);f(y),e.results.all.push(y)}}}_createVoxelGraphic(e,t){return new ae({layer:e,sourceLayer:e,attributes:t})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,i){this._vxl&&this._vxl.set_upscaling_limits(e,t,i)}};A([N({constructOnly:!0})],E.prototype,"view",void 0),E=A([D("esri.layers.VoxelWasmPerSceneView")],E);const ue=E;export{ue as default}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/vxlLayer-t5pvmNBM.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/WFSLayer-8l6HCYA6.js b/dist/assets/WFSLayer-8l6HCYA6.js new file mode 100644 index 0000000..1b82303 --- /dev/null +++ b/dist/assets/WFSLayer-8l6HCYA6.js @@ -0,0 +1 @@ +import{e as i,y as r,c as x,il as $,bs as P,h6 as N,dO as j,r as C,f9 as m,jN as E,f_ as J,dE as U,eM as _,dF as k,ee as W,dG as X,dJ as Y,dH as D,dI as L,dK as Q,d2 as T,iG as O,iH as G,es as R,dy as V,au as M,io as Z,aL as y,eq as z,iI as A,du as B,iJ as H,iK as K,iL as ee,dQ as te,er as I,jO as ie,iw as re,ix as se,iN as oe,iv as ae,iO as ne,dR as le,iz as pe,aI as de}from"./index-pCX-0tJH.js";import{l as ue,o as ye}from"./clientSideDefaults-63pOkJ4Y.js";import{v as ce,W as me,q as fe,V as he,S as ge}from"./wfsUtils-vzWdLJRB.js";import{o as we}from"./CustomParametersMixin-7nmugR3Y.js";import{p as ve}from"./FeatureEffectLayer-OK0TB5f6.js";import{c as Fe}from"./FeatureReductionLayer-2X2_PJv9.js";import{c as be}from"./OrderedLayer-XNaJwl_G.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./geojson-162a_hNo.js";import"./date-be_IQzZd.js";import"./xmlUtils-Q_9cB30b.js";import"./FeatureEffect-0Jn9Z0sQ.js";let d=class extends ${constructor(){super(...arguments),this._connection=null,this.capabilities=ue(!1,!1),this.type="wfs",this.refresh=P(async e=>{await this.load();const{extent:t}=await this._connection.invoke("refresh",e);return t&&(this.sourceJSON.extent=t),{dataChanged:!0,updates:{extent:this.sourceJSON.extent}}})}load(e){const t=e!=null?e.signal:null;return this.addResolvingPromise(this._startWorker({signal:t})),Promise.resolve(this)}destroy(){var e;(e=this._connection)==null||e.close(),this._connection=null}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeatures(e,t={}){await this.load(t);const o=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t);return N.fromJSON(o)}async queryFeaturesJSON(e,t={}){return await this.load(t),this._connection.invoke("queryFeatures",e?e.toJSON():null,t)}async queryFeatureCount(e,t={}){return await this.load(t),this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t)}async queryObjectIds(e,t={}){return await this.load(t),this._connection.invoke("queryObjectIds",e?e.toJSON():null,t)}async queryExtent(e,t={}){await this.load(t);const o=await this._connection.invoke("queryExtent",e?e.toJSON():null,t);return{count:o.count,extent:j.fromJSON(o.extent)}}async querySnapping(e,t={}){return await this.load(t),this._connection.invoke("querySnapping",e,t)}async _createLoadOptions(e){var F,b;const{url:t,customParameters:o,name:n,namespaceUri:l,fields:a,geometryType:u,swapXY:f}=this.layer,c=this.layer.originOf("spatialReference")==="defaults"?void 0:this.layer.spatialReference;if(!t)throw new C("wfs-layer:missing-url","WFSLayer must be created with a url");this.wfsCapabilities||(this.wfsCapabilities=await ce(t,{customParameters:o,...e}));const h=["fields","geometryType","name","namespaceUri","swapXY"].some(w=>this.layer[w]==null),p=h?await me(this.wfsCapabilities,n,l,{spatialReference:c,customParameters:o,signal:e==null?void 0:e.signal}):{...fe(a??[]),geometryType:u,name:n,namespaceUri:l,spatialReference:c,swapXY:f},g=he(this.wfsCapabilities.readFeatureTypes(),p.name,p.namespaceUri),q=m.toJSON(p.geometryType);return{customParameters:o,featureType:g,fields:((F=p.fields)==null?void 0:F.map(w=>w.toJSON()))??[],geometryField:p.geometryField,geometryType:q,getFeatureUrl:this.wfsCapabilities.operations.GetFeature.url,getFeatureOutputFormat:this.wfsCapabilities.operations.GetFeature.outputFormat,objectIdField:p.objectIdField,spatialReference:(b=p.spatialReference)==null?void 0:b.toJSON(),swapXY:!!p.swapXY}}async _startWorker(e){const[t,o]=await E([this._createLoadOptions(e),J("WFSSourceWorker",{...e,strategy:U("feature-layers-workers")?"dedicated":"local",registryTarget:this})]),n=t.error||o.error||null,l=o.value||null;if(n)throw l&&l.close(),n;const a=t.value;this._connection=o.value;const u=(await this._connection.invoke("load",a,e)).extent;this.sourceJSON={dateFieldsTimeReference:{timeZoneIANA:_},extent:u,fields:a.fields,geometryType:a.geometryType,objectIdField:a.objectIdField,geometryField:a.geometryField,drawingInfo:ye(a.geometryType),name:a.featureType.title,wfsInfo:{name:a.featureType.name,featureUrl:a.getFeatureUrl,maxFeatures:3e3,swapXY:a.swapXY,supportedSpatialReferences:a.featureType.supportedSpatialReferences,version:"2.0.0",wfsNamespace:a.featureType.namespaceUri}}}};i([r()],d.prototype,"capabilities",void 0),i([r({constructOnly:!0})],d.prototype,"layer",void 0),i([r()],d.prototype,"sourceJSON",void 0),i([r()],d.prototype,"type",void 0),i([r()],d.prototype,"wfsCapabilities",void 0),d=i([x("esri.layers.graphics.sources.WFSSource")],d);var v;const S=pe();let s=v=class extends be(we(Fe(ve(k(W(X(Y(D(L(Q(de))))))))))){static fromWFSLayerInfo(e){const{customParameters:t,fields:o,geometryField:n,geometryType:l,name:a,namespaceUri:u,objectIdField:f,spatialReference:c,swapXY:h,url:p,wfsCapabilities:g}=e;return new v({customParameters:t,fields:o,geometryField:n,geometryType:l,name:a,namespaceUri:u,objectIdField:f,spatialReference:c,swapXY:h,url:p,wfsCapabilities:g})}constructor(e){super(e),this.copyright=null,this.customParameters=null,this.dateFieldsTimeZone=null,this.definitionExpression=null,this.displayField=null,this.elevationInfo=null,this.featureUrl=void 0,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="WFS",this.maxFeatures=3e3,this.mode=0,this.name=null,this.namespaceUri=null,this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new d({layer:this}),this.spatialReference=T.WGS84,this.spatialReferences=[4326],this.swapXY=void 0,this.title="WFS",this.type="wfs",this.url=null,this.version=void 0}destroy(){var e;(e=this.source)==null||e.destroy()}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WFS"]},e).then(()=>this.source.load(e)).then(()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo","spatialReference","name","namespaceUri"],"service"),O(this.renderer,this.fieldsIndex),G(this.timeInfo,this.fieldsIndex)})),Promise.resolve(this)}get capabilities(){var e;return(e=this.source)==null?void 0:e.capabilities}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}writeFields(e,t,o){const n=e.filter(l=>l.name!==ge);this.geometryField&&n.unshift(new R({name:this.geometryField,alias:this.geometryField,type:"geometry"})),V(o,n.map(l=>l.toJSON()),t)}get parsedUrl(){return M(this.url)}set renderer(e){O(e,this.fieldsIndex),this._set("renderer",e)}get wfsCapabilities(){var e;return(e=this.source)==null?void 0:e.wfsCapabilities}set wfsCapabilities(e){this.source&&(this.source.wfsCapabilities=e)}createPopupTemplate(e){return Z(this,e)}createQuery(){const e=new y;e.returnGeometry=!0,e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:t,timeExtent:o}=this;return e.timeExtent=t!=null&&o!=null?o.offset(-t.value,t.unit):o||null,e}getFieldDomain(e,t){var o;return(o=this.getField(e))==null?void 0:o.domain}getField(e){var t;return(t=this.fieldsIndex)==null?void 0:t.get(e)}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(y.from(e)||this.createQuery(),t)).then(o=>{if(o!=null&&o.features)for(const n of o.features)n.layer=n.sourceLayer=this;return o})}queryObjectIds(e,t){return this.load().then(()=>this.source.queryObjectIds(y.from(e)||this.createQuery(),t))}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(y.from(e)||this.createQuery(),t))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(y.from(e)||this.createQuery(),t))}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return t!=null&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};i([r({readOnly:!0})],s.prototype,"capabilities",null),i([r({type:String})],s.prototype,"copyright",void 0),i([r({readOnly:!0})],s.prototype,"createQueryVersion",null),i([r({json:{name:"wfsInfo.customParameters",write:{overridePolicy:e=>({enabled:!!(e&&Object.keys(e).length>0),ignoreOrigin:!0})}}})],s.prototype,"customParameters",void 0),i([r(z("dateFieldsTimeReference"))],s.prototype,"dateFieldsTimeZone",void 0),i([r({readOnly:!0})],s.prototype,"defaultPopupTemplate",null),i([r({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],s.prototype,"definitionExpression",void 0),i([r({type:String})],s.prototype,"displayField",void 0),i([r(A)],s.prototype,"elevationInfo",void 0),i([r({type:String,readOnly:!0,json:{name:"wfsInfo.featureUrl",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"featureUrl",void 0),i([r({type:[R],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],s.prototype,"fields",void 0),i([B("fields")],s.prototype,"writeFields",null),i([r(S.fieldsIndex)],s.prototype,"fieldsIndex",void 0),i([r({type:j,json:{name:"extent"}})],s.prototype,"fullExtent",void 0),i([r()],s.prototype,"geometryField",void 0),i([r({type:String,json:{read:{source:"layerDefinition.geometryType",reader:m.read},write:{target:"layerDefinition.geometryType",writer:m.write,ignoreOrigin:!0},origins:{service:{read:m.read}}}})],s.prototype,"geometryType",void 0),i([r({type:String})],s.prototype,"id",void 0),i([r(H)],s.prototype,"labelsVisible",void 0),i([r({type:[K],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:ee},write:!0}})],s.prototype,"labelingInfo",void 0),i([r(te)],s.prototype,"legendEnabled",void 0),i([r({type:["show","hide"]})],s.prototype,"listMode",void 0),i([r({type:String})],s.prototype,"objectIdField",void 0),i([r({type:["WFS"]})],s.prototype,"operationalLayerType",void 0),i([r({type:I,json:{name:"wfsInfo.maxFeatures",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"maxFeatures",void 0),i([r({type:[0],readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],s.prototype,"mode",void 0),i([r({type:String,json:{name:"wfsInfo.name",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"name",void 0),i([r({type:String,json:{name:"wfsInfo.wfsNamespace",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"namespaceUri",void 0),i([r(ie)],s.prototype,"opacity",void 0),i([r(S.outFields)],s.prototype,"outFields",void 0),i([r({readOnly:!0})],s.prototype,"parsedUrl",null),i([r(re)],s.prototype,"popupEnabled",void 0),i([r({type:se,json:{name:"popupInfo",write:!0}})],s.prototype,"popupTemplate",void 0),i([r({types:oe,json:{origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:ae,name:"layerDefinition.drawingInfo.renderer",write:!0}},name:"layerDefinition.drawingInfo.renderer",write:{ignoreOrigin:!0}}})],s.prototype,"renderer",null),i([r(ne)],s.prototype,"screenSizePerspectiveEnabled",void 0),i([r({readOnly:!0})],s.prototype,"source",void 0),i([r({type:T,json:{name:"layerDefinition.spatialReference",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"extent.spatialReference"}}}})],s.prototype,"spatialReference",void 0),i([r({readOnly:!0,type:[I],json:{name:"wfsInfo.supportedSpatialReferences",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"spatialReferences",void 0),i([r({type:Boolean,value:!1,json:{name:"wfsInfo.swapXY",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"swapXY",void 0),i([r({json:{write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"name"}}}})],s.prototype,"title",void 0),i([r({json:{read:!1},readOnly:!0})],s.prototype,"type",void 0),i([r(le)],s.prototype,"url",void 0),i([r({type:String,readOnly:!0,json:{name:"wfsInfo.version",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"version",void 0),i([r()],s.prototype,"wfsCapabilities",null),s=v=i([x("esri.layers.WFSLayer")],s);const Ee=s;export{Ee as default}; diff --git a/dist/assets/WFSLayer-VPxAc_vg.js b/dist/assets/WFSLayer-VPxAc_vg.js deleted file mode 100644 index 489b2f7..0000000 --- a/dist/assets/WFSLayer-VPxAc_vg.js +++ /dev/null @@ -1 +0,0 @@ -import{e as i,y as r,c as x,ij as $,ah as P,dT as j,E as N,fe as m,jG as C,g1 as E,dJ as J,eR as U,dK as _,el as k,dL as W,dO as D,dM as X,dN as Y,dP as L,ar as T,iF as O,iG as Q,dw as R,dD as V,bV as G,il as M,ca as y,ex as Z,iH as z,du as A,iI as B,iJ as H,iK as K,dV as ee,ey as S,jH as te,iu as ie,iv as re,iM as se,it as oe,iN as ae,dW as ne,ix as le,c7 as pe}from"./index-J0iiHjMT.js";import{l as de,o as ue}from"./clientSideDefaults-F-CNnR0g.js";import{v as ye,W as ce,q as me,V as fe,S as he}from"./wfsUtils-6CAR46-c.js";import{d as ge}from"./FeatureSet-d4S1oKME.js";import{o as we}from"./CustomParametersMixin-Y1bOcayO.js";import{p as ve}from"./FeatureEffectLayer-oBa8pIG5.js";import{c as Fe}from"./FeatureReductionLayer-RlitE1N6.js";import{c as be}from"./OrderedLayer-M7k5gLgx.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./geojson-fSjaGZrp.js";import"./date-be_IQzZd.js";import"./xmlUtils-Q_9cB30b.js";import"./FeatureEffect-5bEV-xG1.js";let d=class extends ${constructor(){super(...arguments),this._connection=null,this.capabilities=de(!1,!1),this.type="wfs",this.refresh=P(async e=>{await this.load();const{extent:t}=await this._connection.invoke("refresh",e);return t&&(this.sourceJSON.extent=t),{dataChanged:!0,updates:{extent:this.sourceJSON.extent}}})}load(e){const t=e!=null?e.signal:null;return this.addResolvingPromise(this._startWorker({signal:t})),Promise.resolve(this)}destroy(){var e;(e=this._connection)==null||e.close(),this._connection=null}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeatures(e,t={}){await this.load(t);const o=await this._connection.invoke("queryFeatures",e?e.toJSON():null,t);return ge.fromJSON(o)}async queryFeaturesJSON(e,t={}){return await this.load(t),this._connection.invoke("queryFeatures",e?e.toJSON():null,t)}async queryFeatureCount(e,t={}){return await this.load(t),this._connection.invoke("queryFeatureCount",e?e.toJSON():null,t)}async queryObjectIds(e,t={}){return await this.load(t),this._connection.invoke("queryObjectIds",e?e.toJSON():null,t)}async queryExtent(e,t={}){await this.load(t);const o=await this._connection.invoke("queryExtent",e?e.toJSON():null,t);return{count:o.count,extent:j.fromJSON(o.extent)}}async querySnapping(e,t={}){return await this.load(t),this._connection.invoke("querySnapping",e,t)}async _createLoadOptions(e){var F,b;const{url:t,customParameters:o,name:n,namespaceUri:l,fields:a,geometryType:u,swapXY:f}=this.layer,c=this.layer.originOf("spatialReference")==="defaults"?void 0:this.layer.spatialReference;if(!t)throw new N("wfs-layer:missing-url","WFSLayer must be created with a url");this.wfsCapabilities||(this.wfsCapabilities=await ye(t,{customParameters:o,...e}));const h=["fields","geometryType","name","namespaceUri","swapXY"].some(w=>this.layer[w]==null),p=h?await ce(this.wfsCapabilities,n,l,{spatialReference:c,customParameters:o,signal:e==null?void 0:e.signal}):{...me(a??[]),geometryType:u,name:n,namespaceUri:l,spatialReference:c,swapXY:f},g=fe(this.wfsCapabilities.readFeatureTypes(),p.name,p.namespaceUri),q=m.toJSON(p.geometryType);return{customParameters:o,featureType:g,fields:((F=p.fields)==null?void 0:F.map(w=>w.toJSON()))??[],geometryField:p.geometryField,geometryType:q,getFeatureUrl:this.wfsCapabilities.operations.GetFeature.url,getFeatureOutputFormat:this.wfsCapabilities.operations.GetFeature.outputFormat,objectIdField:p.objectIdField,spatialReference:(b=p.spatialReference)==null?void 0:b.toJSON(),swapXY:!!p.swapXY}}async _startWorker(e){const[t,o]=await C([this._createLoadOptions(e),E("WFSSourceWorker",{...e,strategy:J("feature-layers-workers")?"dedicated":"local",registryTarget:this})]),n=t.error||o.error||null,l=o.value||null;if(n)throw l&&l.close(),n;const a=t.value;this._connection=o.value;const u=(await this._connection.invoke("load",a,e)).extent;this.sourceJSON={dateFieldsTimeReference:{timeZoneIANA:U},extent:u,fields:a.fields,geometryType:a.geometryType,objectIdField:a.objectIdField,geometryField:a.geometryField,drawingInfo:ue(a.geometryType),name:a.featureType.title,wfsInfo:{name:a.featureType.name,featureUrl:a.getFeatureUrl,maxFeatures:3e3,swapXY:a.swapXY,supportedSpatialReferences:a.featureType.supportedSpatialReferences,version:"2.0.0",wfsNamespace:a.featureType.namespaceUri}}}};i([r()],d.prototype,"capabilities",void 0),i([r({constructOnly:!0})],d.prototype,"layer",void 0),i([r()],d.prototype,"sourceJSON",void 0),i([r()],d.prototype,"type",void 0),i([r()],d.prototype,"wfsCapabilities",void 0),d=i([x("esri.layers.graphics.sources.WFSSource")],d);var v;const I=le();let s=v=class extends be(we(Fe(ve(_(k(W(D(X(Y(L(pe))))))))))){static fromWFSLayerInfo(e){const{customParameters:t,fields:o,geometryField:n,geometryType:l,name:a,namespaceUri:u,objectIdField:f,spatialReference:c,swapXY:h,url:p,wfsCapabilities:g}=e;return new v({customParameters:t,fields:o,geometryField:n,geometryType:l,name:a,namespaceUri:u,objectIdField:f,spatialReference:c,swapXY:h,url:p,wfsCapabilities:g})}constructor(e){super(e),this.copyright=null,this.customParameters=null,this.dateFieldsTimeZone=null,this.definitionExpression=null,this.displayField=null,this.elevationInfo=null,this.featureUrl=void 0,this.fields=null,this.fieldsIndex=null,this.fullExtent=null,this.geometryType=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="WFS",this.maxFeatures=3e3,this.mode=0,this.name=null,this.namespaceUri=null,this.outFields=null,this.popupEnabled=!0,this.popupTemplate=null,this.screenSizePerspectiveEnabled=!0,this.source=new d({layer:this}),this.spatialReference=T.WGS84,this.spatialReferences=[4326],this.swapXY=void 0,this.title="WFS",this.type="wfs",this.url=null,this.version=void 0}destroy(){var e;(e=this.source)==null||e.destroy()}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WFS"]},e).then(()=>this.source.load(e)).then(()=>{this.read(this.source.sourceJSON,{origin:"service",url:this.parsedUrl}),this.revert(["objectIdField","fields","timeInfo","spatialReference","name","namespaceUri"],"service"),O(this.renderer,this.fieldsIndex),Q(this.timeInfo,this.fieldsIndex)})),Promise.resolve(this)}get capabilities(){var e;return(e=this.source)==null?void 0:e.capabilities}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("capabilities"),(this._get("createQueryVersion")||0)+1}get defaultPopupTemplate(){return this.createPopupTemplate()}writeFields(e,t,o){const n=e.filter(l=>l.name!==he);this.geometryField&&n.unshift(new R({name:this.geometryField,alias:this.geometryField,type:"geometry"})),V(o,n.map(l=>l.toJSON()),t)}get parsedUrl(){return G(this.url)}set renderer(e){O(e,this.fieldsIndex),this._set("renderer",e)}get wfsCapabilities(){var e;return(e=this.source)==null?void 0:e.wfsCapabilities}set wfsCapabilities(e){this.source&&(this.source.wfsCapabilities=e)}createPopupTemplate(e){return M(this,e)}createQuery(){const e=new y;e.returnGeometry=!0,e.outFields=["*"],e.where=this.definitionExpression||"1=1";const{timeOffset:t,timeExtent:o}=this;return e.timeExtent=t!=null&&o!=null?o.offset(-t.value,t.unit):o||null,e}getFieldDomain(e,t){var o;return(o=this.getField(e))==null?void 0:o.domain}getField(e){var t;return(t=this.fieldsIndex)==null?void 0:t.get(e)}queryFeatures(e,t){return this.load().then(()=>this.source.queryFeatures(y.from(e)||this.createQuery(),t)).then(o=>{if(o!=null&&o.features)for(const n of o.features)n.layer=n.sourceLayer=this;return o})}queryObjectIds(e,t){return this.load().then(()=>this.source.queryObjectIds(y.from(e)||this.createQuery(),t))}queryFeatureCount(e,t){return this.load().then(()=>this.source.queryFeatureCount(y.from(e)||this.createQuery(),t))}queryExtent(e,t){return this.load().then(()=>this.source.queryExtent(y.from(e)||this.createQuery(),t))}async hasDataChanged(){try{const{dataChanged:e,updates:t}=await this.source.refresh(this.customParameters);return t!=null&&this.read(t,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0}),e}catch{}return!1}};i([r({readOnly:!0})],s.prototype,"capabilities",null),i([r({type:String})],s.prototype,"copyright",void 0),i([r({readOnly:!0})],s.prototype,"createQueryVersion",null),i([r({json:{name:"wfsInfo.customParameters",write:{overridePolicy:e=>({enabled:!!(e&&Object.keys(e).length>0),ignoreOrigin:!0})}}})],s.prototype,"customParameters",void 0),i([r(Z("dateFieldsTimeReference"))],s.prototype,"dateFieldsTimeZone",void 0),i([r({readOnly:!0})],s.prototype,"defaultPopupTemplate",null),i([r({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],s.prototype,"definitionExpression",void 0),i([r({type:String})],s.prototype,"displayField",void 0),i([r(z)],s.prototype,"elevationInfo",void 0),i([r({type:String,readOnly:!0,json:{name:"wfsInfo.featureUrl",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"featureUrl",void 0),i([r({type:[R],json:{name:"layerDefinition.fields",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"fields"}}}})],s.prototype,"fields",void 0),i([A("fields")],s.prototype,"writeFields",null),i([r(I.fieldsIndex)],s.prototype,"fieldsIndex",void 0),i([r({type:j,json:{name:"extent"}})],s.prototype,"fullExtent",void 0),i([r()],s.prototype,"geometryField",void 0),i([r({type:String,json:{read:{source:"layerDefinition.geometryType",reader:m.read},write:{target:"layerDefinition.geometryType",writer:m.write,ignoreOrigin:!0},origins:{service:{read:m.read}}}})],s.prototype,"geometryType",void 0),i([r({type:String})],s.prototype,"id",void 0),i([r(B)],s.prototype,"labelsVisible",void 0),i([r({type:[H],json:{name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:K},write:!0}})],s.prototype,"labelingInfo",void 0),i([r(ee)],s.prototype,"legendEnabled",void 0),i([r({type:["show","hide"]})],s.prototype,"listMode",void 0),i([r({type:String})],s.prototype,"objectIdField",void 0),i([r({type:["WFS"]})],s.prototype,"operationalLayerType",void 0),i([r({type:S,json:{name:"wfsInfo.maxFeatures",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"maxFeatures",void 0),i([r({type:[0],readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0,isRequired:!0}}}}})],s.prototype,"mode",void 0),i([r({type:String,json:{name:"wfsInfo.name",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"name",void 0),i([r({type:String,json:{name:"wfsInfo.wfsNamespace",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"namespaceUri",void 0),i([r(te)],s.prototype,"opacity",void 0),i([r(I.outFields)],s.prototype,"outFields",void 0),i([r({readOnly:!0})],s.prototype,"parsedUrl",null),i([r(ie)],s.prototype,"popupEnabled",void 0),i([r({type:re,json:{name:"popupInfo",write:!0}})],s.prototype,"popupTemplate",void 0),i([r({types:se,json:{origins:{service:{name:"drawingInfo.renderer"},"web-scene":{types:oe,name:"layerDefinition.drawingInfo.renderer",write:!0}},name:"layerDefinition.drawingInfo.renderer",write:{ignoreOrigin:!0}}})],s.prototype,"renderer",null),i([r(ae)],s.prototype,"screenSizePerspectiveEnabled",void 0),i([r({readOnly:!0})],s.prototype,"source",void 0),i([r({type:T,json:{name:"layerDefinition.spatialReference",write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"extent.spatialReference"}}}})],s.prototype,"spatialReference",void 0),i([r({readOnly:!0,type:[S],json:{name:"wfsInfo.supportedSpatialReferences",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"spatialReferences",void 0),i([r({type:Boolean,value:!1,json:{name:"wfsInfo.swapXY",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"swapXY",void 0),i([r({json:{write:{ignoreOrigin:!0,isRequired:!0},origins:{service:{name:"name"}}}})],s.prototype,"title",void 0),i([r({json:{read:!1},readOnly:!0})],s.prototype,"type",void 0),i([r(ne)],s.prototype,"url",void 0),i([r({type:String,readOnly:!0,json:{name:"wfsInfo.version",write:{ignoreOrigin:!0,isRequired:!0}}})],s.prototype,"version",void 0),i([r()],s.prototype,"wfsCapabilities",null),s=v=i([x("esri.layers.WFSLayer")],s);const Je=s;export{Je as default}; diff --git a/dist/assets/WFSLayerView3D-OjHmKjv_.js b/dist/assets/WFSLayerView3D-OjHmKjv_.js deleted file mode 100644 index 8788cca..0000000 --- a/dist/assets/WFSLayerView3D-OjHmKjv_.js +++ /dev/null @@ -1 +0,0 @@ -import{e as r,y as o,c as p}from"./index-J0iiHjMT.js";import{_ as i}from"./FeatureLayerViewBase3D-VurTj7t3.js";import"./HeatmapDensity.glsl-y7dUg--m.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./queryForSymbologySnapping-I1fFQTD_.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates--mMi4sdi.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./QueryEngine-8tLWlkSE.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./FeatureSet-d4S1oKME.js";import"./FeatureStore-X-AIJLo2.js";import"./BoundsStore-wmwfHjhp.js";import"./projectExtentUtils-TwA6ooHn.js";import"./LayerView3D-iOx2MD1g.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./EventedSet-JGlFrfoR.js";import"./FeatureEffect-5bEV-xG1.js";import"./LayerView-efDufa6j.js";import"./RefreshableLayerView-Pd4dLcWr.js";let t=class extends i{constructor(){super(...arguments),this.type="wfs-3d"}};r([o()],t.prototype,"layer",void 0),t=r([p("esri.views.3d.layers.WFSLayerView3D")],t);const C=t;export{C as default}; diff --git a/dist/assets/WFSLayerView3D-_qadKQVq.js b/dist/assets/WFSLayerView3D-_qadKQVq.js new file mode 100644 index 0000000..c8c2b89 --- /dev/null +++ b/dist/assets/WFSLayerView3D-_qadKQVq.js @@ -0,0 +1 @@ +import{e as r,y as o,c as p}from"./index-pCX-0tJH.js";import{_ as i}from"./FeatureLayerViewBase3D-W0Qwl4g_.js";import"./HeatmapDensity.glsl-de3m0xZZ.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./queryForSymbologySnapping-MXWRIdj-.js";import"./hash-SS5GKVPY.js";import"./Graphics3DObjectStates-JUKhPt0b.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./QueryEngine-uvDs-vBe.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./FeatureStore-PXMUgn0j.js";import"./BoundsStore-_-dPK5c-.js";import"./projectExtentUtils-Q4rXasWA.js";import"./LayerView3D-57OghbRh.js";import"./EventedSet-TJfupI82.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./LayerView-ixwLVnzr.js";import"./RefreshableLayerView-DVYs7L04.js";let t=class extends i{constructor(){super(...arguments),this.type="wfs-3d"}};r([o()],t.prototype,"layer",void 0),t=r([p("esri.views.3d.layers.WFSLayerView3D")],t);const k=t;export{k as default}; diff --git a/dist/assets/WFSSourceWorker-AqESE9b6.js b/dist/assets/WFSSourceWorker-AqESE9b6.js new file mode 100644 index 0000000..0fd61cf --- /dev/null +++ b/dist/assets/WFSSourceWorker-AqESE9b6.js @@ -0,0 +1 @@ +import{r as l,ab as c,eL as f,eM as _,N as d,ac as F,R as w,bt as S,eP as E,eO as q}from"./index-pCX-0tJH.js";import{m as x}from"./FeatureStore-PXMUgn0j.js";import{x as R,W as T,j as b}from"./QueryEngine-uvDs-vBe.js";import{E as I,N as j}from"./geojson-162a_hNo.js";import{p as C}from"./sourceUtils-nEhsDpwC.js";import{a as P,B as $}from"./wfsUtils-vzWdLJRB.js";import"./BoundsStore-_-dPK5c-.js";import"./PooledRBush-rhLtoPG7.js";import"./quickselect-0UUnLNDW.js";import"./optimizedFeatureQueryEngineAdapter-46ccFTR0.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./date-be_IQzZd.js";import"./xmlUtils-Q_9cB30b.js";class X{constructor(){this._queryEngine=null,this._customParameters=null}destroy(){var e;(e=this._queryEngine)==null||e.destroy(),this._queryEngine=null}async load(e,t){const{getFeatureUrl:r,getFeatureOutputFormat:p,fields:o,geometryType:i,featureType:n,objectIdField:u,customParameters:a}=e,{spatialReference:s,getFeatureSpatialReference:h}=P(r,n,e.spatialReference);this._featureType=n,this._customParameters=a,this._getFeatureUrl=r,this._getFeatureOutputFormat=p,this._getFeatureSpatialReference=h;try{await R(h,s)}catch{throw new l("unsupported-projection","Projection not supported",{inSpatialReference:h,outSpatialReference:s})}c(t);const y=f.fromLayerJSON({fields:o,dateFieldsTimeReference:o.some(g=>g.type==="esriFieldTypeDate")?{timeZoneIANA:_}:null}),m=await this._snapshotFeatures({fieldsIndex:y,geometryType:i,objectIdField:u,spatialReference:s},t.signal);return this._queryEngine=new T({fieldsIndex:y,geometryType:i,hasM:!1,hasZ:!1,objectIdField:u,spatialReference:s,timeInfo:null,featureStore:new x({geometryType:i,hasM:!1,hasZ:!1})}),this._queryEngine.featureStore.addMany(m),{extent:(await this._queryEngine.fetchRecomputedExtents()).fullExtent}}async applyEdits(){throw new l("wfs-source:editing-not-supported","applyEdits() is not supported on WFSLayer")}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(e){var t;return this._customParameters=e,(t=this._snapshotTask)==null||t.abort(),this._snapshotTask=d(r=>this._snapshotFeatures(this._queryEngine,r)),this._snapshotTask.promise.then(r=>{this._queryEngine.featureStore.clear(),r&&this._queryEngine.featureStore.addMany(r)},r=>{this._queryEngine.featureStore.clear(),F(r)||w.getLogger("esri.layers.WFSLayer").error(new l("wfs-layer:getfeature-error","An error occurred during the GetFeature request",{error:r}))}),await this._waitSnapshotComplete(),{extent:(await this._queryEngine.fetchRecomputedExtents()).fullExtent}}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _snapshotFeatures({objectIdField:e,geometryType:t,spatialReference:r,fieldsIndex:p},o){const i=await $(this._getFeatureUrl??"",this._featureType.typeName,this._getFeatureSpatialReference,this._getFeatureOutputFormat,{customParameters:this._customParameters,signal:o});I(i,this._getFeatureSpatialReference.wkid),c(o);const n=j(i,{geometryType:t,hasZ:!1,objectIdField:e});if(!S(r,this._getFeatureSpatialReference))for(const a of n)a.geometry!=null&&(a.geometry=E(b(q(a.geometry,t,!1,!1),this._getFeatureSpatialReference,r)));let u=1;for(const a of n){const s={};C(p,s,a.attributes,!0),a.attributes=s,s[e]==null&&(a.objectId=s[e]=u++)}return n}}export{X as default}; diff --git a/dist/assets/WFSSourceWorker-iUwpu94Y.js b/dist/assets/WFSSourceWorker-iUwpu94Y.js deleted file mode 100644 index 55b6dd4..0000000 --- a/dist/assets/WFSSourceWorker-iUwpu94Y.js +++ /dev/null @@ -1 +0,0 @@ -import{E as l,s as c,eQ as g,eR as _,b as d,f as F,Z as w,al as E,eU as S,eT as q}from"./index-J0iiHjMT.js";import{m as x}from"./FeatureStore-X-AIJLo2.js";import{x as T,W as R,j as I}from"./QueryEngine-8tLWlkSE.js";import{E as b,N as j}from"./geojson-fSjaGZrp.js";import{p as C}from"./sourceUtils-zbywPEXK.js";import{a as $,B as k}from"./wfsUtils-6CAR46-c.js";import"./BoundsStore-wmwfHjhp.js";import"./PooledRBush-o8tLYBG5.js";import"./quickselect-UFB0jJTZ.js";import"./optimizedFeatureQueryEngineAdapter-KnoSHZzG.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./date-be_IQzZd.js";import"./xmlUtils-Q_9cB30b.js";class X{constructor(){this._queryEngine=null,this._customParameters=null}destroy(){var e;(e=this._queryEngine)==null||e.destroy(),this._queryEngine=null}async load(e,t){const{getFeatureUrl:r,getFeatureOutputFormat:p,fields:o,geometryType:i,featureType:n,objectIdField:u,customParameters:a}=e,{spatialReference:s,getFeatureSpatialReference:h}=$(r,n,e.spatialReference);this._featureType=n,this._customParameters=a,this._getFeatureUrl=r,this._getFeatureOutputFormat=p,this._getFeatureSpatialReference=h;try{await T(h,s)}catch{throw new l("unsupported-projection","Projection not supported",{inSpatialReference:h,outSpatialReference:s})}c(t);const y=g.fromLayerJSON({fields:o,dateFieldsTimeReference:o.some(f=>f.type==="esriFieldTypeDate")?{timeZoneIANA:_}:null}),m=await this._snapshotFeatures({fieldsIndex:y,geometryType:i,objectIdField:u,spatialReference:s},t.signal);return this._queryEngine=new R({fieldsIndex:y,geometryType:i,hasM:!1,hasZ:!1,objectIdField:u,spatialReference:s,timeInfo:null,featureStore:new x({geometryType:i,hasM:!1,hasZ:!1})}),this._queryEngine.featureStore.addMany(m),{extent:(await this._queryEngine.fetchRecomputedExtents()).fullExtent}}async applyEdits(){throw new l("wfs-source:editing-not-supported","applyEdits() is not supported on WFSLayer")}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(e){var t;return this._customParameters=e,(t=this._snapshotTask)==null||t.abort(),this._snapshotTask=d(r=>this._snapshotFeatures(this._queryEngine,r)),this._snapshotTask.promise.then(r=>{this._queryEngine.featureStore.clear(),r&&this._queryEngine.featureStore.addMany(r)},r=>{this._queryEngine.featureStore.clear(),F(r)||w.getLogger("esri.layers.WFSLayer").error(new l("wfs-layer:getfeature-error","An error occurred during the GetFeature request",{error:r}))}),await this._waitSnapshotComplete(),{extent:(await this._queryEngine.fetchRecomputedExtents()).fullExtent}}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _snapshotFeatures({objectIdField:e,geometryType:t,spatialReference:r,fieldsIndex:p},o){const i=await k(this._getFeatureUrl??"",this._featureType.typeName,this._getFeatureSpatialReference,this._getFeatureOutputFormat,{customParameters:this._customParameters,signal:o});b(i,this._getFeatureSpatialReference.wkid),c(o);const n=j(i,{geometryType:t,hasZ:!1,objectIdField:e});if(!E(r,this._getFeatureSpatialReference))for(const a of n)a.geometry!=null&&(a.geometry=S(I(q(a.geometry,t,!1,!1),this._getFeatureSpatialReference,r)));let u=1;for(const a of n){const s={};C(p,s,a.attributes,!0),a.attributes=s,s[e]==null&&(a.objectId=s[e]=u++)}return n}}export{X as default}; diff --git a/dist/assets/WMSLayerView3D-HO_hwLwX.js b/dist/assets/WMSLayerView3D-OqbPQcsr.js similarity index 81% rename from dist/assets/WMSLayerView3D-HO_hwLwX.js rename to dist/assets/WMSLayerView3D-OqbPQcsr.js index 66b4a0c..47673c3 100644 --- a/dist/assets/WMSLayerView3D-HO_hwLwX.js +++ b/dist/assets/WMSLayerView3D-OqbPQcsr.js @@ -1 +1 @@ -import{e as a,y as h,jW as w,c as l,jZ as x,n as f,E as m,dT as g}from"./index-J0iiHjMT.js";import{N as P}from"./DynamicLayerView3D-4lztpXo0.js";import"./LayerView3D-iOx2MD1g.js";import"./projectExtentUtils-TwA6ooHn.js";import"./ImageMaterial.glsl-TdPtjVc_.js";import"./LayerView-efDufa6j.js";import"./RefreshableLayerView-Pd4dLcWr.js";const v=r=>{let e=class extends r{initialize(){this.exportImageParameters=new x({layer:this.layer})}destroy(){this.exportImageParameters=f(this.exportImageParameters)}get exportImageVersion(){var t;return(t=this.exportImageParameters)==null||t.commitProperty("version"),this.commitProperty("timeExtent"),(this._get("exportImageVersion")||0)+1}fetchPopupFeatures(t){const{layer:i}=this;if(!t)return Promise.reject(new m("wmslayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:i}));const{popupEnabled:o}=i;if(!o)return Promise.reject(new m("wmslayerview:fetchPopupFeatures","popupEnabled should be true",{popupEnabled:o}));const n=this.createFetchPopupFeaturesQuery(t);if(!n)return Promise.resolve([]);const{extent:p,width:s,height:u,x:d,y}=n;if(!(p&&s&&u))throw new m("wmslayerview:fetchPopupFeatures","WMSLayer does not support fetching features.",{extent:p,width:s,height:u});return i.fetchFeatureInfo(p,s,u,d,y)}};return a([h()],e.prototype,"exportImageParameters",void 0),a([h({readOnly:!0})],e.prototype,"exportImageVersion",null),a([h()],e.prototype,"layer",void 0),a([h(w)],e.prototype,"timeExtent",void 0),e=a([l("esri.layers.mixins.WMSLayerView")],e),e};let c=class extends v(P){constructor(){super(...arguments),this.type="wms-3d"}initialize(){this.layer.serviceSupportsSpatialReference(this.view.spatialReference)||this.addResolvingPromise(Promise.reject(new m("layerview:spatial-reference-incompatible","The spatial references supported by this WMS layer are incompatible with the spatial reference of the view"))),this._updatingHandles.add(()=>{var r;return(r=this.exportImageParameters)==null?void 0:r.version},()=>{this._updatingHandles.addPromise(this.refreshDebounced())})}createFetchPopupFeaturesQuery(r){const e=this.findExtentInfoAt(r),t=e.extent,i=new g(t[0],t[1],t[2],t[3],this._spatialReference),o=e.imageSize,n=o.width,p=o.height,s=i.width/n;return{extent:i,width:n,height:p,x:Math.round((r.x-i.xmin)/s),y:Math.round((i.ymax-r.y)/s)}}getFetchOptions(){return{timeExtent:this.timeExtent}}};c=a([l("esri.views.3d.layers.WMSLayerView3D")],c);const V=c;export{V as default}; +import{e as a,y as h,k1 as w,c as l,k4 as x,b as f,r as m,dO as g}from"./index-pCX-0tJH.js";import{N as P}from"./DynamicLayerView3D-XykdNh09.js";import"./LayerView3D-57OghbRh.js";import"./projectExtentUtils-Q4rXasWA.js";import"./ImageMaterial.glsl-PU0wbmEN.js";import"./LayerView-ixwLVnzr.js";import"./RefreshableLayerView-DVYs7L04.js";const v=r=>{let e=class extends r{initialize(){this.exportImageParameters=new x({layer:this.layer})}destroy(){this.exportImageParameters=f(this.exportImageParameters)}get exportImageVersion(){var t;return(t=this.exportImageParameters)==null||t.commitProperty("version"),this.commitProperty("timeExtent"),(this._get("exportImageVersion")||0)+1}fetchPopupFeatures(t){const{layer:i}=this;if(!t)return Promise.reject(new m("wmslayerview:fetchPopupFeatures","Nothing to fetch without area",{layer:i}));const{popupEnabled:o}=i;if(!o)return Promise.reject(new m("wmslayerview:fetchPopupFeatures","popupEnabled should be true",{popupEnabled:o}));const n=this.createFetchPopupFeaturesQuery(t);if(!n)return Promise.resolve([]);const{extent:p,width:s,height:u,x:d,y}=n;if(!(p&&s&&u))throw new m("wmslayerview:fetchPopupFeatures","WMSLayer does not support fetching features.",{extent:p,width:s,height:u});return i.fetchFeatureInfo(p,s,u,d,y)}};return a([h()],e.prototype,"exportImageParameters",void 0),a([h({readOnly:!0})],e.prototype,"exportImageVersion",null),a([h()],e.prototype,"layer",void 0),a([h(w)],e.prototype,"timeExtent",void 0),e=a([l("esri.layers.mixins.WMSLayerView")],e),e};let c=class extends v(P){constructor(){super(...arguments),this.type="wms-3d"}initialize(){this.layer.serviceSupportsSpatialReference(this.view.spatialReference)||this.addResolvingPromise(Promise.reject(new m("layerview:spatial-reference-incompatible","The spatial references supported by this WMS layer are incompatible with the spatial reference of the view"))),this._updatingHandles.add(()=>{var r;return(r=this.exportImageParameters)==null?void 0:r.version},()=>{this._updatingHandles.addPromise(this.refreshDebounced())})}createFetchPopupFeaturesQuery(r){const e=this.findExtentInfoAt(r),t=e.extent,i=new g(t[0],t[1],t[2],t[3],this._spatialReference),o=e.imageSize,n=o.width,p=o.height,s=i.width/n;return{extent:i,width:n,height:p,x:Math.round((r.x-i.xmin)/s),y:Math.round((i.ymax-r.y)/s)}}getFetchOptions(){return{timeExtent:this.timeExtent}}};c=a([l("esri.views.3d.layers.WMSLayerView3D")],c);const j=c;export{j as default}; diff --git a/dist/assets/WMTSLayer-Qx8zOTb2.js b/dist/assets/WMTSLayer-Qx8zOTb2.js deleted file mode 100644 index dfc458e..0000000 --- a/dist/assets/WMTSLayer-Qx8zOTb2.js +++ /dev/null @@ -1 +0,0 @@ -import{e as o,y as u,dT as A,e$ as X,c as N,dr as Y,dt as R,V as J,E as _,nz as Z,T as ge,f0 as we,nA as B,nB as xe,e3 as de,dK as ve,dL as Se,dO as Me,dM as Ie,dN as Te,dP as Le,d as ie,C as U,fl as se,dQ as le,nC as Ee,nD as Ce,bW as K,f2 as ae,bI as oe,bV as G,f3 as Pe,du as be,c7 as Re}from"./index-J0iiHjMT.js";import{p as Oe,I as Ae}from"./WebTileLayer-JxqArsF7.js";import{o as ne}from"./xmlUtils-Q_9cB30b.js";var q;let F=q=class extends Y{constructor(e){super(e),this.fullExtent=null,this.id=null,this.tileInfo=null}clone(){const e=new q;return this.hasOwnProperty("fullExtent")&&(e.fullExtent=this.fullExtent&&this.fullExtent.clone()),this.hasOwnProperty("id")&&(e.id=this.id),this.hasOwnProperty("tileInfo")&&(e.tileInfo=this.tileInfo&&this.tileInfo.clone()),e}};o([u({type:A,json:{read:{source:"fullExtent"}}})],F.prototype,"fullExtent",void 0),o([u({type:String,json:{read:{source:"id"}}})],F.prototype,"id",void 0),o([u({type:X,json:{read:{source:"tileInfo"}}})],F.prototype,"tileInfo",void 0),F=q=o([N("esri.layer.support.TileMatrixSet")],F);const Fe=F;var H;let E=H=class extends Y{constructor(e){super(e),this.id=null,this.title=null,this.description=null,this.legendUrl=null}clone(){const e=new H;return this.hasOwnProperty("description")&&(e.description=this.description),this.hasOwnProperty("id")&&(e.id=this.id),this.hasOwnProperty("isDefault")&&(e.isDefault=this.isDefault),this.hasOwnProperty("keywords")&&(e.keywords=this.keywords&&this.keywords.slice()),this.hasOwnProperty("legendUrl")&&(e.legendUrl=this.legendUrl),this.hasOwnProperty("title")&&(e.title=this.title),e}};o([u({json:{read:{source:"id"}}})],E.prototype,"id",void 0),o([u({json:{read:{source:"title"}}})],E.prototype,"title",void 0),o([u({json:{read:{source:"abstract"}}})],E.prototype,"description",void 0),o([u({json:{read:{source:"legendUrl"}}})],E.prototype,"legendUrl",void 0),o([u({json:{read:{source:"isDefault"}}})],E.prototype,"isDefault",void 0),o([u({json:{read:{source:"keywords"}}})],E.prototype,"keywords",void 0),E=H=o([N("esri.layer.support.WMTSStyle")],E);const $e=E;var z;let x=z=class extends Y{constructor(e){super(e),this.description=null,this.fullExtent=null,this.fullExtents=null,this.id=null,this.imageFormats=null,this.layer=null,this.parent=null,this.styles=null,this.title=null,this.tileMatrixSetId=null,this.tileMatrixSets=null}readFullExtent(e,t){return(e=t.fullExtent)?A.fromJSON(e):null}readFullExtents(e,t){var r,i;return(r=t.fullExtents)!=null&&r.length?t.fullExtents.map(s=>A.fromJSON(s)):((i=t.tileMatrixSets)==null?void 0:i.map(s=>A.fromJSON(s.fullExtent)).filter(s=>s))??[]}get imageFormat(){let e=this._get("imageFormat");return e||(e=this.imageFormats&&this.imageFormats.length?this.imageFormats[0]:""),e}set imageFormat(e){const t=this.imageFormats;e&&(e.includes("image/")||t&&!t.includes(e))&&(e.includes("image/")||(e="image/"+e),t&&!t.includes(e))?console.error("The layer doesn't support the format of "+e):this._set("imageFormat",e)}get styleId(){var t,r;let e=this._get("styleId");return e||(e=((r=(t=this.styles)==null?void 0:t.at(0))==null?void 0:r.id)??""),e}set styleId(e){this._set("styleId",e)}get tileMatrixSet(){return this.tileMatrixSets?this.tileMatrixSets.find(e=>e.id===this.tileMatrixSetId):null}clone(){var t,r,i;const e=new z;return this.hasOwnProperty("description")&&(e.description=this.description),this.hasOwnProperty("imageFormats")&&(e.imageFormats=this.imageFormats&&this.imageFormats.slice()),this.hasOwnProperty("imageFormat")&&(e.imageFormat=this.imageFormat),this.hasOwnProperty("fullExtent")&&(e.fullExtent=(t=this.fullExtent)==null?void 0:t.clone()),this.hasOwnProperty("id")&&(e.id=this.id),this.hasOwnProperty("layer")&&(e.layer=this.layer),this.hasOwnProperty("styleId")&&(e.styleId=this.styleId),this.hasOwnProperty("styles")&&(e.styles=(r=this.styles)==null?void 0:r.clone()),this.hasOwnProperty("tileMatrixSetId")&&(e.tileMatrixSetId=this.tileMatrixSetId),this.hasOwnProperty("tileMatrixSets")&&(e.tileMatrixSets=(i=this.tileMatrixSets)==null?void 0:i.clone()),this.hasOwnProperty("title")&&(e.title=this.title),e}};o([u()],x.prototype,"description",void 0),o([u()],x.prototype,"fullExtent",void 0),o([R("fullExtent",["fullExtent"])],x.prototype,"readFullExtent",null),o([u({readOnly:!0})],x.prototype,"fullExtents",void 0),o([R("fullExtents",["fullExtents","tileMatrixSets"])],x.prototype,"readFullExtents",null),o([u()],x.prototype,"id",void 0),o([u()],x.prototype,"imageFormat",null),o([u({json:{read:{source:"formats"}}})],x.prototype,"imageFormats",void 0),o([u()],x.prototype,"layer",void 0),o([u()],x.prototype,"parent",void 0),o([u()],x.prototype,"styleId",null),o([u({type:J.ofType($e),json:{read:{source:"styles"}}})],x.prototype,"styles",void 0),o([u({json:{write:{ignoreOrigin:!0}}})],x.prototype,"title",void 0),o([u()],x.prototype,"tileMatrixSetId",void 0),o([u({readOnly:!0})],x.prototype,"tileMatrixSet",null),o([u({type:J.ofType(Fe),json:{read:{source:"tileMatrixSets"}}})],x.prototype,"tileMatrixSets",void 0),x=z=o([N("esri.layers.support.WMTSSublayer")],x);const j=x,me=90.71428571428571;function ue(e){const t=e.replaceAll(/ows:/gi,"");if(!g("Contents",new DOMParser().parseFromString(t,"text/xml").documentElement))throw new _("wmtslayer:wmts-capabilities-xml-is-not-valid","the wmts get capabilities response is not compliant",{text:e})}function Ve(e,t){var re;e=e.replaceAll(/ows:/gi,"");const r=new DOMParser().parseFromString(e,"text/xml").documentElement,i=new Map,s=new Map,a=g("Contents",r);if(!a)throw new _("wmtslayer:wmts-capabilities-xml-is-not-valid");const l=g("OperationsMetadata",r),n=l==null?void 0:l.querySelector("[name='GetTile']"),c=n==null?void 0:n.getElementsByTagName("Get"),p=c&&Array.prototype.slice.call(c),h=(re=t.url)==null?void 0:re.indexOf("https"),f=h!==void 0&&h>-1;let d,w,S=t.serviceMode,v=t==null?void 0:t.url;if(p!=null&&p.length&&p.some(T=>{const L=g("Constraint",T);return!L||$("AllowedValues","Value",S,L)?(v=T.attributes[0].nodeValue,!0):(!L||$("AllowedValues","Value","RESTful",L)||$("AllowedValues","Value","REST",L)?w=T.attributes[0].nodeValue:L&&!$("AllowedValues","Value","KVP",L)||(d=T.attributes[0].nodeValue),!1)}),!v)if(w)v=w,S="RESTful";else if(d)v=d,S="KVP";else{const T=g("ServiceMetadataURL",r);v=T==null?void 0:T.getAttribute("xlink:href")}const C=v.indexOf("1.0.0/");C===-1&&S==="RESTful"?v+="/":C>-1&&(v=v.substring(0,C)),S==="KVP"&&(v+=C>-1?"":"?"),f&&(v=v.replace(/^http:/i,"https:"));const M=y("ServiceIdentification>ServiceTypeVersion",r),I=y("ServiceIdentification>AccessConstraints",r),P=I&&/^none$/i.test(I)?null:I,k=b("Layer",a),W=b("TileMatrixSet",a),D=k.map(T=>{const L=y("Identifier",T);return i.set(L,T),Ue(L,T,W,f,M)});return{copyright:P,dimensionMap:s,layerMap:i,layers:D,serviceMode:S,tileUrl:v}}function je(e){return e.layers.forEach(t=>{var r;(r=t.tileMatrixSets)==null||r.forEach(i=>{var a;const s=i.tileInfo;s&&s.dpi!==96&&((a=s.lods)==null||a.forEach(l=>{var n;l.scale=96*l.scale/s.dpi,l.resolution=fe((n=s.spatialReference)==null?void 0:n.wkid,l.scale*me/96,i.id)}),s.dpi=96)})}),e}function ee(e){return e.nodeType===Node.ELEMENT_NODE}function g(e,t){for(let r=0;ri.textContent).filter(de)}function y(e,t){return e.split(">").forEach(r=>{t&&(t=g(r,t))}),t&&t.textContent}function $(e,t,r,i){let s;return Array.prototype.slice.call(i.childNodes).some(a=>{if(a.nodeName.includes(e)){const l=g(t,a),n=l==null?void 0:l.textContent;if(n===r||r.split(":")&&r.split(":")[1]===n)return s=a,!0}return!1}),s}function Ue(e,t,r,i,s){const a=y("Abstract",t),l=O("Format",t);return{id:e,fullExtent:We(t),fullExtents:De(t),description:a,formats:l,styles:Be(t,i),title:y("Title",t),tileMatrixSets:Ke(s,t,r)}}function he(e,t){var h;const r=[],i=(h=e.layerMap)==null?void 0:h.get(t);if(!i)return null;const s=b("ResourceURL",i),a=b("Dimension",i);let l,n,c,p;return a.length&&(l=y("Identifier",a[0]),n=O("Default",a[0])||O("Value",a[0])),a.length>1&&(c=y("Identifier",a[1]),p=O("Default",a[1])||O("Value",a[1])),e.dimensionMap.set(t,{dimensions:n,dimensions2:p}),s.forEach(f=>{let d=f.getAttribute("template");if(f.getAttribute("resourceType")==="tile"){if(l&&n.length)if(d.includes("{"+l+"}"))d=d.replace("{"+l+"}","{dimensionValue}");else{const w=d.toLowerCase().indexOf("{"+l.toLowerCase()+"}");w>-1&&(d=d.substring(0,w)+"{dimensionValue}"+d.substring(w+l.length+2))}if(c&&p.length)if(d.includes("{"+c+"}"))d=d.replace("{"+c+"}","{dimensionValue2}");else{const w=d.toLowerCase().indexOf("{"+c.toLowerCase()+"}");w>-1&&(d=d.substring(0,w)+"{dimensionValue2}"+d.substring(w+c.length+2))}r.push({template:d,format:f.getAttribute("format"),resourceType:"tile"})}}),r}function _e(e,t,r,i,s,a,l,n){var d,w;const c=Ne(e,t,i);if(!((c==null?void 0:c.length)>0))return"";const{dimensionMap:p}=e,h=(d=p.get(t).dimensions)==null?void 0:d[0],f=(w=p.get(t).dimensions2)==null?void 0:w[0];return c[l%c.length].template.replaceAll(/\{Style\}/gi,s??"").replaceAll(/\{TileMatrixSet\}/gi,r??"").replaceAll(/\{TileMatrix\}/gi,a).replaceAll(/\{TileRow\}/gi,""+l).replaceAll(/\{TileCol\}/gi,""+n).replaceAll(/\{dimensionValue\}/gi,h).replaceAll(/\{dimensionValue2\}/gi,f)}function Ne(e,t,r){const i=he(e,t),s=i==null?void 0:i.filter(a=>a.format===r);return(s!=null&&s.length?s:i)??[]}function ke(e,t,r,i){var n,c;const{dimensionMap:s}=e,a=he(e,t);let l="";if(a&&a.length>0){const p=(n=s.get(t).dimensions)==null?void 0:n[0],h=(c=s.get(t).dimensions2)==null?void 0:c[0];l=a[0].template,l.indexOf(".xxx")===l.length-4&&(l=l.slice(0,-4)),l=l.replaceAll(/\{Style\}/gi,i),l=l.replaceAll(/\{TileMatrixSet\}/gi,r),l=l.replaceAll(/\{TileMatrix\}/gi,"{level}"),l=l.replaceAll(/\{TileRow\}/gi,"{row}"),l=l.replaceAll(/\{TileCol\}/gi,"{col}"),l=l.replaceAll(/\{dimensionValue\}/gi,p),l=l.replaceAll(/\{dimensionValue2\}/gi,h)}return l}function We(e){const t=g("WGS84BoundingBox",e),r=t?y("LowerCorner",t).split(" "):["-180","-90"],i=t?y("UpperCorner",t).split(" "):["180","90"];return{xmin:parseFloat(r[0]),ymin:parseFloat(r[1]),xmax:parseFloat(i[0]),ymax:parseFloat(i[1]),spatialReference:{wkid:4326}}}function De(e){const t=[];return ne(e,{BoundingBox:r=>{if(!r.getAttribute("crs"))return;const i=r.getAttribute("crs").toLowerCase(),s=te(i),a=i.includes("epsg")&&Z(s.wkid);let l,n,c,p;ne(r,{LowerCorner:h=>{[l,n]=h.textContent.split(" ").map(f=>Number.parseFloat(f)),a&&([l,n]=[n,l])},UpperCorner:h=>{[c,p]=h.textContent.split(" ").map(f=>Number.parseFloat(f)),a&&([c,p]=[p,c])}}),t.push({xmin:l,ymin:n,xmax:c,ymax:p,spatialReference:s})}}),t}function Be(e,t){return b("Style",e).map(r=>{const i=g("LegendURL",r),s=g("Keywords",r),a=s?O("Keyword",s):[];let l=i&&i.getAttribute("xlink:href");return t&&(l=l&&l.replace(/^http:/i,"https:")),{abstract:y("Abstract",r),id:y("Identifier",r),isDefault:r.getAttribute("isDefault")==="true",keywords:a,legendUrl:l,title:y("Title",r)}})}function Ke(e,t,r){return b("TileMatrixSetLink",t).map(i=>Ge(e,i,r))}function Ge(e,t,r){const i=g("TileMatrixSet",t).textContent,s=O("TileMatrix",t),a=r.find(M=>{const I=g("Identifier",M),P=I==null?void 0:I.textContent;return!!(P===i||i.split(":")&&i.split(":")[1]===P)}),l=g("TileMatrixSetLimits",t),n=l&&b("TileMatrixLimits",l),c=new Map;if(n!=null&&n.length)for(const M of n){const I=g("TileMatrix",M).textContent,P=+g("MinTileRow",M).textContent,k=+g("MaxTileRow",M).textContent,W=+g("MinTileCol",M).textContent,D=+g("MaxTileCol",M).textContent;c.set(I,{minCol:W,maxCol:D,minRow:P,maxRow:k})}const p=y("SupportedCRS",a).toLowerCase(),h=Je(a,p),f=h.spatialReference,d=g("TileMatrix",a),w=[parseInt(y("TileWidth",d),10),parseInt(y("TileHeight",d),10)],S=[];s.length?s.forEach((M,I)=>{const P=$("TileMatrix","Identifier",M,a);S.push(ce(P,p,I,i,c))}):b("TileMatrix",a).forEach((M,I)=>{S.push(ce(M,p,I,i,c))});const v=qe(e,a,h,w,S[0]).toJSON(),C=new X({dpi:96,spatialReference:f,size:w,origin:h,lods:S}).toJSON();return{id:i,fullExtent:v,tileInfo:C}}function te(e){e=e.toLowerCase();let t=parseInt(e.split(":").pop(),10);t!==900913&&t!==3857||(t=102100);const r=ze(e);return r!=null&&(t=r),{wkid:t}}function Je(e,t){return ye(g("TileMatrix",e),t)}function ye(e,t){const r=te(t),[i,s]=y("TopLeftCorner",e).split(" ").map(l=>parseFloat(l)),a=t.includes("epsg")&&Z(r.wkid);return new ge(a?{x:s,y:i,spatialReference:r}:{x:i,y:s,spatialReference:r})}function qe(e,t,r,i,s){const a=g("BoundingBox",t);let l,n,c,p,h,f;if(a&&(l=y("LowerCorner",a).split(" "),n=y("UpperCorner",a).split(" ")),l&&l.length>1&&n&&n.length>1)c=parseFloat(l[0]),h=parseFloat(l[1]),p=parseFloat(n[0]),f=parseFloat(n[1]);else{const d=g("TileMatrix",t),w=parseInt(y("MatrixWidth",d),10),S=parseInt(y("MatrixHeight",d),10);c=r.x,f=r.y,p=c+w*i[0]*s.resolution,h=f-S*i[1]*s.resolution}return He(e,r.spatialReference,r)?new A(h,c,f,p,r.spatialReference):new A(c,h,p,f,r.spatialReference)}function He(e,t,r){return e==="1.0.0"&&Z(t.wkid)&&!(r.spatialReference.isGeographic&&r.x<-90&&r.y>=-90)}var V;function ze(e){return e.includes("crs84")||e.includes("crs:84")?V.CRS84:e.includes("crs83")||e.includes("crs:83")?V.CRS83:e.includes("crs27")||e.includes("crs:27")?V.CRS27:null}function ce(e,t,r,i,s){const a=te(t),l=y("Identifier",e);let n=parseFloat(y("ScaleDenominator",e));const c=fe(a.wkid,n,i);n*=96/me;const p=+y("MatrixWidth",e),h=+y("MatrixHeight",e),{maxCol:f=p-1,maxRow:d=h-1,minCol:w=0,minRow:S=0}=s.get(l)??{},{x:v,y:C}=ye(e,t);return new we({cols:[w,f],level:r,levelValue:l,origin:[v,C],scale:n,resolution:c,rows:[S,d]})}function fe(e,t,r){let i;return i=B.hasOwnProperty(""+e)?B.values[B[e]]:r==="default028mm"?6370997*Math.PI/180:xe(e).metersPerDegree,7*t/25e3/i}(function(e){e[e.CRS84=4326]="CRS84",e[e.CRS83=4269]="CRS83",e[e.CRS27=4267]="CRS27"})(V||(V={}));var Q;const pe={"image/png":".png","image/png8":".png","image/png24":".png","image/png32":".png","image/jpg":".jpg","image/jpeg":".jpeg","image/gif":".gif","image/bmp":".bmp","image/tiff":".tif","image/jpgpng":"","image/jpegpng":"","image/unknown":""},Qe=new Set(["version","service","request","layer","style","format","tilematrixset","tilematrix","tilerow","tilecol"]);let m=Q=class extends ve(Se(Me(Ie(Te(Le(Re)))))){constructor(...e){super(...e),this.activeLayer=null,this.copyright="",this.customParameters=null,this.customLayerParameters=null,this.fullExtent=null,this.operationalLayerType="WebTiledLayer",this.resourceInfo=null,this.serviceMode="RESTful",this.sublayers=null,this.type="wmts",this.version="1.0.0",this.addHandles([ie(()=>this.activeLayer,(t,r)=>{var i;r&&!((i=this.sublayers)!=null&&i.includes(r))&&(r.layer=null,r.parent=null),t&&(t.layer=this,t.parent=this)},U),se(()=>this.sublayers,"after-add",({item:t})=>{t.layer=this,t.parent=this},U),se(()=>this.sublayers,"after-remove",({item:t})=>{t.layer=null,t.parent=null},U),ie(()=>this.sublayers,(t,r)=>{if(r)for(const i of r)i.layer=null,i.parent=null;if(t)for(const i of t)i.layer=this,i.parent=this},U)])}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMTS"]},e).catch(le).then(()=>this._fetchService(e)).catch(t=>{throw le(t),new _("wmtslayer:unsupported-service-data","Invalid response from the WMTS service.",{error:t})})),Promise.resolve(this)}readActiveLayerFromService(e,t,r){this.activeLayer||(this.activeLayer=new j);let i=t.layers.find(s=>s.id===this.activeLayer.id);return i||(i=t.layers[0]),this.activeLayer.read(i,r),this.activeLayer}readActiveLayerFromItemOrWebDoc(e,t){const{templateUrl:r,wmtsInfo:i}=t,s=r?this._getLowerCasedUrlParams(r):null,a=i==null?void 0:i.layerIdentifier;let l=null;const n=i==null?void 0:i.tileMatrixSet;n&&(Array.isArray(n)?n.length&&(l=n[0]):l=n);const c=s==null?void 0:s.format,p=s==null?void 0:s.style;return new j({id:a,imageFormat:c,styleId:p,tileMatrixSetId:l})}writeActiveLayer(e,t,r,i){const s=this.activeLayer;t.templateUrl=this.getUrlTemplate(s.id,s.tileMatrixSetId,s.imageFormat,s.styleId);const a=Ee("tileMatrixSet.tileInfo",s);t.tileInfo=a?a.toJSON(i):null,t.wmtsInfo={...t.wmtsInfo,layerIdentifier:s.id,tileMatrixSet:s.tileMatrixSetId}}readCustomParameters(e,t){const r=t.wmtsInfo;return r?this._mergeParams(r.customParameters,r.url):null}get fullExtents(){return this.activeLayer.fullExtents}readServiceMode(e,t){return t.templateUrl.includes("?")?"KVP":"RESTful"}readSublayersFromService(e,t,r){return Xe(t.layers,r)}get supportedSpatialReferences(){var e;return((e=this.activeLayer.tileMatrixSets)==null?void 0:e.map(t=>{var r;return(r=t.tileInfo)==null?void 0:r.spatialReference}).toArray().filter(de))??[]}get tilemapCache(){var t,r;const e=(r=(t=this.activeLayer)==null?void 0:t.tileMatrixSet)==null?void 0:r.tileInfo;return e?new Ce(e):void 0}get title(){var e;return((e=this.activeLayer)==null?void 0:e.title)??"Layer"}set title(e){this._overrideIfSome("title",e)}get url(){return this._get("url")}set url(e){e&&e.substr(-1)==="/"?this._set("url",e.slice(0,-1)):this._set("url",e)}createWebTileLayer(e){const t=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId),r=this._getTileMatrixSetById(e.tileMatrixSetId),i=r==null?void 0:r.tileInfo,s=e.fullExtent,a=new Oe({layerIdentifier:e.id,tileMatrixSet:e.tileMatrixSetId,url:this.url});return this.customLayerParameters&&(a.customLayerParameters=this.customLayerParameters),this.customParameters&&(a.customParameters=this.customParameters),new Ae({fullExtent:s,urlTemplate:t,tileInfo:i,wmtsInfo:a})}async fetchTile(e,t,r,i={}){const{signal:s}=i,a=this.getTileUrl(e,t,r),{data:l}=await K(a,{responseType:"image",signal:s});return l}async fetchImageBitmapTile(e,t,r,i={}){const{signal:s}=i;if(this.fetchTile!==Q.prototype.fetchTile){const n=await this.fetchTile(e,t,r,i);return ae(n,e,t,r,s)}const a=this.getTileUrl(e,t,r),{data:l}=await K(a,{responseType:"blob",signal:s});return ae(l,e,t,r,s)}findSublayerById(e){var t;return(t=this.sublayers)==null?void 0:t.find(r=>r.id===e)}getTileUrl(e,t,r){var n;const i=this._getTileMatrixSetById(this.activeLayer.tileMatrixSetId),s=(n=i==null?void 0:i.tileInfo)==null?void 0:n.lods[e],a=s?s.levelValue||`${s.level}`:`${e}`;let l=this.resourceInfo?"":_e({dimensionMap:this.dimensionMap,layerMap:this.layerMap},this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId,a,t,r);return l||(l=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId).replaceAll(/\{level\}/gi,a).replaceAll(/\{row\}/gi,`${t}`).replaceAll(/\{col\}/gi,`${r}`)),l=this._appendCustomLayerParameters(l),l}getUrlTemplate(e,t,r,i){if(!this.resourceInfo){const s=ke({dimensionMap:this.dimensionMap,layerMap:this.layerMap},e,t,i);if(s)return s}if(this.serviceMode==="KVP")return this.url+"?SERVICE=WMTS&VERSION="+this.version+"&REQUEST=GetTile&LAYER="+e+"&STYLE="+i+"&FORMAT="+r+"&TILEMATRIXSET="+t+"&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}";if(this.serviceMode==="RESTful"){let s="";return pe[r.toLowerCase()]&&(s=pe[r.toLowerCase()]),this.url+e+"/"+i+"/"+t+"/{level}/{row}/{col}"+s}return""}async _fetchService(e){let t;if(this.resourceInfo)this.resourceInfo.serviceMode==="KVP"&&(this.url+=this.url.includes("?")?"":"?"),t={ssl:!1,data:this.resourceInfo};else try{t=await this._getCapabilities(this.serviceMode,e),ue(t.data)}catch{const r=this.serviceMode==="KVP"?"RESTful":"KVP";try{t=await this._getCapabilities(r,e),ue(t.data),this.serviceMode=r}catch(i){throw new _("wmtslayer:unsupported-service-data","Services does not support RESTful or KVP service modes.",{error:i})}}this.resourceInfo?t.data=je(t.data):t.data=Ve(t.data,{serviceMode:this.serviceMode,url:this.url}),t.data&&this.read(t.data,{origin:"service"})}async _getCapabilities(e,t){const r=this._getCapabilitiesUrl(e);return await K(r,{...t,responseType:"text"})}_getTileMatrixSetById(e){var i;const t=this.findSublayerById(this.activeLayer.id);return(i=t==null?void 0:t.tileMatrixSets)==null?void 0:i.find(s=>s.id===e)}_appendCustomParameters(e){return this._appendParameters(e,this.customParameters)}_appendCustomLayerParameters(e){return this._appendParameters(e,{...oe(this.customParameters),...this.customLayerParameters})}_appendParameters(e,t){const r=G(e),i={...r.query,...t},s=Pe(i);return s===""?r.path:`${r.path}?${s}`}_getCapabilitiesUrl(e){this.url=G(this.url).path;let t=this.url;switch(e){case"KVP":t+=`?request=GetCapabilities&service=WMTS&version=${this.version}`;break;case"RESTful":{const r=`/${this.version}/WMTSCapabilities.xml`,i=new RegExp(r,"i");t=t.replace(i,""),t+=r;break}}return this._appendCustomParameters(t)}_getLowerCasedUrlParams(e){if(!e)return null;const t=G(e).query;if(!t)return null;const r={};return Object.keys(t).forEach(i=>{r[i.toLowerCase()]=t[i]}),r}_mergeParams(e,t){const r=this._getLowerCasedUrlParams(t);if(r){const i=Object.keys(r);i.length&&(e=e?oe(e):{},i.forEach(s=>{e.hasOwnProperty(s)||Qe.has(s)||(e[s]=r[s])}))}return e}};function Xe(e,t){return e.map(r=>{const i=new j;return i.read(r,t),i})}o([u()],m.prototype,"dimensionMap",void 0),o([u()],m.prototype,"layerMap",void 0),o([u({type:j,json:{origins:{"web-document":{write:{ignoreOrigin:!0}}}}})],m.prototype,"activeLayer",void 0),o([R("service","activeLayer",["layers"])],m.prototype,"readActiveLayerFromService",null),o([R(["web-document","portal-item"],"activeLayer",["wmtsInfo"])],m.prototype,"readActiveLayerFromItemOrWebDoc",null),o([be(["web-document","portal-item"],"activeLayer",{templateUrl:{type:String},tileInfo:{type:X},"wmtsInfo.layerIdentifier":{type:String},"wmtsInfo.tileMatrixSet":{type:String}})],m.prototype,"writeActiveLayer",null),o([u({type:String,value:"",json:{write:!0}})],m.prototype,"copyright",void 0),o([u({type:["show","hide"]})],m.prototype,"listMode",void 0),o([u({json:{read:!0,write:!0}})],m.prototype,"blendMode",void 0),o([u({json:{origins:{"web-document":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}},"portal-item":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}}}}})],m.prototype,"customParameters",void 0),o([R(["portal-item","web-document"],"customParameters")],m.prototype,"readCustomParameters",null),o([u({json:{origins:{"web-document":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}},"portal-item":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}}}}})],m.prototype,"customLayerParameters",void 0),o([u({type:A,json:{write:{ignoreOrigin:!0},origins:{"web-document":{read:{source:"fullExtent"}},"portal-item":{read:{source:"fullExtent"}}}}})],m.prototype,"fullExtent",void 0),o([u({readOnly:!0})],m.prototype,"fullExtents",null),o([u({type:["WebTiledLayer"]})],m.prototype,"operationalLayerType",void 0),o([u()],m.prototype,"resourceInfo",void 0),o([u()],m.prototype,"serviceMode",void 0),o([R(["portal-item","web-document"],"serviceMode",["templateUrl"])],m.prototype,"readServiceMode",null),o([u({type:J.ofType(j)})],m.prototype,"sublayers",void 0),o([R("service","sublayers",["layers"])],m.prototype,"readSublayersFromService",null),o([u({readOnly:!0})],m.prototype,"supportedSpatialReferences",null),o([u({readOnly:!0})],m.prototype,"tilemapCache",null),o([u({json:{read:{source:"title"}}})],m.prototype,"title",null),o([u({json:{read:!1},readOnly:!0,value:"wmts"})],m.prototype,"type",void 0),o([u({json:{origins:{service:{read:{source:"tileUrl"}},"web-document":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}},"portal-item":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}}}}})],m.prototype,"url",null),o([u()],m.prototype,"version",void 0),m=Q=o([N("esri.layers.WMTSLayer")],m);const tt=m;export{tt as default}; diff --git a/dist/assets/WMTSLayer-TE5fyme_.js b/dist/assets/WMTSLayer-TE5fyme_.js new file mode 100644 index 0000000..5e1bf17 --- /dev/null +++ b/dist/assets/WMTSLayer-TE5fyme_.js @@ -0,0 +1 @@ +import{e as o,y as u,dO as A,eW as z,c as N,dr as Q,dt as R,V as G,r as _,nI as Z,L as ge,eX as we,nJ as B,nK as xe,dY as de,dF as ve,dG as Se,dJ as Me,dH as Ie,dI as Te,dK as Le,B as ie,a9 as U,fg as se,dL as le,nL as Ee,nM as Pe,av as K,eZ as ae,ah as oe,au as J,e_ as Ce,du as be,aI as Re}from"./index-pCX-0tJH.js";import{p as Oe,I as Ae}from"./WebTileLayer-jfo0VJmw.js";import{o as ne}from"./xmlUtils-Q_9cB30b.js";var q;let F=q=class extends Q{constructor(e){super(e),this.fullExtent=null,this.id=null,this.tileInfo=null}clone(){const e=new q;return this.hasOwnProperty("fullExtent")&&(e.fullExtent=this.fullExtent&&this.fullExtent.clone()),this.hasOwnProperty("id")&&(e.id=this.id),this.hasOwnProperty("tileInfo")&&(e.tileInfo=this.tileInfo&&this.tileInfo.clone()),e}};o([u({type:A,json:{read:{source:"fullExtent"}}})],F.prototype,"fullExtent",void 0),o([u({type:String,json:{read:{source:"id"}}})],F.prototype,"id",void 0),o([u({type:z,json:{read:{source:"tileInfo"}}})],F.prototype,"tileInfo",void 0),F=q=o([N("esri.layer.support.TileMatrixSet")],F);const Fe=F;var H;let E=H=class extends Q{constructor(e){super(e),this.id=null,this.title=null,this.description=null,this.legendUrl=null}clone(){const e=new H;return this.hasOwnProperty("description")&&(e.description=this.description),this.hasOwnProperty("id")&&(e.id=this.id),this.hasOwnProperty("isDefault")&&(e.isDefault=this.isDefault),this.hasOwnProperty("keywords")&&(e.keywords=this.keywords&&this.keywords.slice()),this.hasOwnProperty("legendUrl")&&(e.legendUrl=this.legendUrl),this.hasOwnProperty("title")&&(e.title=this.title),e}};o([u({json:{read:{source:"id"}}})],E.prototype,"id",void 0),o([u({json:{read:{source:"title"}}})],E.prototype,"title",void 0),o([u({json:{read:{source:"abstract"}}})],E.prototype,"description",void 0),o([u({json:{read:{source:"legendUrl"}}})],E.prototype,"legendUrl",void 0),o([u({json:{read:{source:"isDefault"}}})],E.prototype,"isDefault",void 0),o([u({json:{read:{source:"keywords"}}})],E.prototype,"keywords",void 0),E=H=o([N("esri.layer.support.WMTSStyle")],E);const $e=E;var X;let x=X=class extends Q{constructor(e){super(e),this.description=null,this.fullExtent=null,this.fullExtents=null,this.id=null,this.imageFormats=null,this.layer=null,this.parent=null,this.styles=null,this.title=null,this.tileMatrixSetId=null,this.tileMatrixSets=null}readFullExtent(e,t){return(e=t.fullExtent)?A.fromJSON(e):null}readFullExtents(e,t){var r,i;return(r=t.fullExtents)!=null&&r.length?t.fullExtents.map(s=>A.fromJSON(s)):((i=t.tileMatrixSets)==null?void 0:i.map(s=>A.fromJSON(s.fullExtent)).filter(s=>s))??[]}get imageFormat(){let e=this._get("imageFormat");return e||(e=this.imageFormats&&this.imageFormats.length?this.imageFormats[0]:""),e}set imageFormat(e){const t=this.imageFormats;e&&(e.includes("image/")||t&&!t.includes(e))&&(e.includes("image/")||(e="image/"+e),t&&!t.includes(e))?console.error("The layer doesn't support the format of "+e):this._set("imageFormat",e)}get styleId(){var t,r;let e=this._get("styleId");return e||(e=((r=(t=this.styles)==null?void 0:t.at(0))==null?void 0:r.id)??""),e}set styleId(e){this._set("styleId",e)}get tileMatrixSet(){return this.tileMatrixSets?this.tileMatrixSets.find(e=>e.id===this.tileMatrixSetId):null}clone(){var t,r,i;const e=new X;return this.hasOwnProperty("description")&&(e.description=this.description),this.hasOwnProperty("imageFormats")&&(e.imageFormats=this.imageFormats&&this.imageFormats.slice()),this.hasOwnProperty("imageFormat")&&(e.imageFormat=this.imageFormat),this.hasOwnProperty("fullExtent")&&(e.fullExtent=(t=this.fullExtent)==null?void 0:t.clone()),this.hasOwnProperty("id")&&(e.id=this.id),this.hasOwnProperty("layer")&&(e.layer=this.layer),this.hasOwnProperty("styleId")&&(e.styleId=this.styleId),this.hasOwnProperty("styles")&&(e.styles=(r=this.styles)==null?void 0:r.clone()),this.hasOwnProperty("tileMatrixSetId")&&(e.tileMatrixSetId=this.tileMatrixSetId),this.hasOwnProperty("tileMatrixSets")&&(e.tileMatrixSets=(i=this.tileMatrixSets)==null?void 0:i.clone()),this.hasOwnProperty("title")&&(e.title=this.title),e}};o([u()],x.prototype,"description",void 0),o([u()],x.prototype,"fullExtent",void 0),o([R("fullExtent",["fullExtent"])],x.prototype,"readFullExtent",null),o([u({readOnly:!0})],x.prototype,"fullExtents",void 0),o([R("fullExtents",["fullExtents","tileMatrixSets"])],x.prototype,"readFullExtents",null),o([u()],x.prototype,"id",void 0),o([u()],x.prototype,"imageFormat",null),o([u({json:{read:{source:"formats"}}})],x.prototype,"imageFormats",void 0),o([u()],x.prototype,"layer",void 0),o([u()],x.prototype,"parent",void 0),o([u()],x.prototype,"styleId",null),o([u({type:G.ofType($e),json:{read:{source:"styles"}}})],x.prototype,"styles",void 0),o([u({json:{write:{ignoreOrigin:!0}}})],x.prototype,"title",void 0),o([u()],x.prototype,"tileMatrixSetId",void 0),o([u({readOnly:!0})],x.prototype,"tileMatrixSet",null),o([u({type:G.ofType(Fe),json:{read:{source:"tileMatrixSets"}}})],x.prototype,"tileMatrixSets",void 0),x=X=o([N("esri.layers.support.WMTSSublayer")],x);const j=x,me=90.71428571428571;function ue(e){const t=e.replaceAll(/ows:/gi,"");if(!g("Contents",new DOMParser().parseFromString(t,"text/xml").documentElement))throw new _("wmtslayer:wmts-capabilities-xml-is-not-valid","the wmts get capabilities response is not compliant",{text:e})}function Ve(e,t){var re;e=e.replaceAll(/ows:/gi,"");const r=new DOMParser().parseFromString(e,"text/xml").documentElement,i=new Map,s=new Map,a=g("Contents",r);if(!a)throw new _("wmtslayer:wmts-capabilities-xml-is-not-valid");const l=g("OperationsMetadata",r),n=l==null?void 0:l.querySelector("[name='GetTile']"),c=n==null?void 0:n.getElementsByTagName("Get"),p=c&&Array.prototype.slice.call(c),h=(re=t.url)==null?void 0:re.indexOf("https"),f=h!==void 0&&h>-1;let d,w,S=t.serviceMode,v=t==null?void 0:t.url;if(p!=null&&p.length&&p.some(T=>{const L=g("Constraint",T);return!L||$("AllowedValues","Value",S,L)?(v=T.attributes[0].nodeValue,!0):(!L||$("AllowedValues","Value","RESTful",L)||$("AllowedValues","Value","REST",L)?w=T.attributes[0].nodeValue:L&&!$("AllowedValues","Value","KVP",L)||(d=T.attributes[0].nodeValue),!1)}),!v)if(w)v=w,S="RESTful";else if(d)v=d,S="KVP";else{const T=g("ServiceMetadataURL",r);v=T==null?void 0:T.getAttribute("xlink:href")}const P=v.indexOf("1.0.0/");P===-1&&S==="RESTful"?v+="/":P>-1&&(v=v.substring(0,P)),S==="KVP"&&(v+=P>-1?"":"?"),f&&(v=v.replace(/^http:/i,"https:"));const M=y("ServiceIdentification>ServiceTypeVersion",r),I=y("ServiceIdentification>AccessConstraints",r),C=I&&/^none$/i.test(I)?null:I,k=b("Layer",a),W=b("TileMatrixSet",a),D=k.map(T=>{const L=y("Identifier",T);return i.set(L,T),Ue(L,T,W,f,M)});return{copyright:C,dimensionMap:s,layerMap:i,layers:D,serviceMode:S,tileUrl:v}}function je(e){return e.layers.forEach(t=>{var r;(r=t.tileMatrixSets)==null||r.forEach(i=>{var a;const s=i.tileInfo;s&&s.dpi!==96&&((a=s.lods)==null||a.forEach(l=>{var n;l.scale=96*l.scale/s.dpi,l.resolution=fe((n=s.spatialReference)==null?void 0:n.wkid,l.scale*me/96,i.id)}),s.dpi=96)})}),e}function ee(e){return e.nodeType===Node.ELEMENT_NODE}function g(e,t){for(let r=0;ri.textContent).filter(de)}function y(e,t){return e.split(">").forEach(r=>{t&&(t=g(r,t))}),t&&t.textContent}function $(e,t,r,i){let s;return Array.prototype.slice.call(i.childNodes).some(a=>{if(a.nodeName.includes(e)){const l=g(t,a),n=l==null?void 0:l.textContent;if(n===r||r.split(":")&&r.split(":")[1]===n)return s=a,!0}return!1}),s}function Ue(e,t,r,i,s){const a=y("Abstract",t),l=O("Format",t);return{id:e,fullExtent:We(t),fullExtents:De(t),description:a,formats:l,styles:Be(t,i),title:y("Title",t),tileMatrixSets:Ke(s,t,r)}}function he(e,t){var h;const r=[],i=(h=e.layerMap)==null?void 0:h.get(t);if(!i)return null;const s=b("ResourceURL",i),a=b("Dimension",i);let l,n,c,p;return a.length&&(l=y("Identifier",a[0]),n=O("Default",a[0])||O("Value",a[0])),a.length>1&&(c=y("Identifier",a[1]),p=O("Default",a[1])||O("Value",a[1])),e.dimensionMap.set(t,{dimensions:n,dimensions2:p}),s.forEach(f=>{let d=f.getAttribute("template");if(f.getAttribute("resourceType")==="tile"){if(l&&n.length)if(d.includes("{"+l+"}"))d=d.replace("{"+l+"}","{dimensionValue}");else{const w=d.toLowerCase().indexOf("{"+l.toLowerCase()+"}");w>-1&&(d=d.substring(0,w)+"{dimensionValue}"+d.substring(w+l.length+2))}if(c&&p.length)if(d.includes("{"+c+"}"))d=d.replace("{"+c+"}","{dimensionValue2}");else{const w=d.toLowerCase().indexOf("{"+c.toLowerCase()+"}");w>-1&&(d=d.substring(0,w)+"{dimensionValue2}"+d.substring(w+c.length+2))}r.push({template:d,format:f.getAttribute("format"),resourceType:"tile"})}}),r}function _e(e,t,r,i,s,a,l,n){var d,w;const c=Ne(e,t,i);if(!((c==null?void 0:c.length)>0))return"";const{dimensionMap:p}=e,h=(d=p.get(t).dimensions)==null?void 0:d[0],f=(w=p.get(t).dimensions2)==null?void 0:w[0];return c[l%c.length].template.replaceAll(/\{Style\}/gi,s??"").replaceAll(/\{TileMatrixSet\}/gi,r??"").replaceAll(/\{TileMatrix\}/gi,a).replaceAll(/\{TileRow\}/gi,""+l).replaceAll(/\{TileCol\}/gi,""+n).replaceAll(/\{dimensionValue\}/gi,h).replaceAll(/\{dimensionValue2\}/gi,f)}function Ne(e,t,r){const i=he(e,t),s=i==null?void 0:i.filter(a=>a.format===r);return(s!=null&&s.length?s:i)??[]}function ke(e,t,r,i){var n,c;const{dimensionMap:s}=e,a=he(e,t);let l="";if(a&&a.length>0){const p=(n=s.get(t).dimensions)==null?void 0:n[0],h=(c=s.get(t).dimensions2)==null?void 0:c[0];l=a[0].template,l.indexOf(".xxx")===l.length-4&&(l=l.slice(0,-4)),l=l.replaceAll(/\{Style\}/gi,i),l=l.replaceAll(/\{TileMatrixSet\}/gi,r),l=l.replaceAll(/\{TileMatrix\}/gi,"{level}"),l=l.replaceAll(/\{TileRow\}/gi,"{row}"),l=l.replaceAll(/\{TileCol\}/gi,"{col}"),l=l.replaceAll(/\{dimensionValue\}/gi,p),l=l.replaceAll(/\{dimensionValue2\}/gi,h)}return l}function We(e){const t=g("WGS84BoundingBox",e),r=t?y("LowerCorner",t).split(" "):["-180","-90"],i=t?y("UpperCorner",t).split(" "):["180","90"];return{xmin:parseFloat(r[0]),ymin:parseFloat(r[1]),xmax:parseFloat(i[0]),ymax:parseFloat(i[1]),spatialReference:{wkid:4326}}}function De(e){const t=[];return ne(e,{BoundingBox:r=>{if(!r.getAttribute("crs"))return;const i=r.getAttribute("crs").toLowerCase(),s=te(i),a=i.includes("epsg")&&Z(s.wkid);let l,n,c,p;ne(r,{LowerCorner:h=>{[l,n]=h.textContent.split(" ").map(f=>Number.parseFloat(f)),a&&([l,n]=[n,l])},UpperCorner:h=>{[c,p]=h.textContent.split(" ").map(f=>Number.parseFloat(f)),a&&([c,p]=[p,c])}}),t.push({xmin:l,ymin:n,xmax:c,ymax:p,spatialReference:s})}}),t}function Be(e,t){return b("Style",e).map(r=>{const i=g("LegendURL",r),s=g("Keywords",r),a=s?O("Keyword",s):[];let l=i&&i.getAttribute("xlink:href");return t&&(l=l&&l.replace(/^http:/i,"https:")),{abstract:y("Abstract",r),id:y("Identifier",r),isDefault:r.getAttribute("isDefault")==="true",keywords:a,legendUrl:l,title:y("Title",r)}})}function Ke(e,t,r){return b("TileMatrixSetLink",t).map(i=>Je(e,i,r))}function Je(e,t,r){const i=g("TileMatrixSet",t).textContent,s=O("TileMatrix",t),a=r.find(M=>{const I=g("Identifier",M),C=I==null?void 0:I.textContent;return!!(C===i||i.split(":")&&i.split(":")[1]===C)}),l=g("TileMatrixSetLimits",t),n=l&&b("TileMatrixLimits",l),c=new Map;if(n!=null&&n.length)for(const M of n){const I=g("TileMatrix",M).textContent,C=+g("MinTileRow",M).textContent,k=+g("MaxTileRow",M).textContent,W=+g("MinTileCol",M).textContent,D=+g("MaxTileCol",M).textContent;c.set(I,{minCol:W,maxCol:D,minRow:C,maxRow:k})}const p=y("SupportedCRS",a).toLowerCase(),h=Ge(a,p),f=h.spatialReference,d=g("TileMatrix",a),w=[parseInt(y("TileWidth",d),10),parseInt(y("TileHeight",d),10)],S=[];s.length?s.forEach((M,I)=>{const C=$("TileMatrix","Identifier",M,a);S.push(ce(C,p,I,i,c))}):b("TileMatrix",a).forEach((M,I)=>{S.push(ce(M,p,I,i,c))});const v=qe(e,a,h,w,S[0]).toJSON(),P=new z({dpi:96,spatialReference:f,size:w,origin:h,lods:S}).toJSON();return{id:i,fullExtent:v,tileInfo:P}}function te(e){e=e.toLowerCase();let t=parseInt(e.split(":").pop(),10);t!==900913&&t!==3857||(t=102100);const r=Xe(e);return r!=null&&(t=r),{wkid:t}}function Ge(e,t){return ye(g("TileMatrix",e),t)}function ye(e,t){const r=te(t),[i,s]=y("TopLeftCorner",e).split(" ").map(l=>parseFloat(l)),a=t.includes("epsg")&&Z(r.wkid);return new ge(a?{x:s,y:i,spatialReference:r}:{x:i,y:s,spatialReference:r})}function qe(e,t,r,i,s){const a=g("BoundingBox",t);let l,n,c,p,h,f;if(a&&(l=y("LowerCorner",a).split(" "),n=y("UpperCorner",a).split(" ")),l&&l.length>1&&n&&n.length>1)c=parseFloat(l[0]),h=parseFloat(l[1]),p=parseFloat(n[0]),f=parseFloat(n[1]);else{const d=g("TileMatrix",t),w=parseInt(y("MatrixWidth",d),10),S=parseInt(y("MatrixHeight",d),10);c=r.x,f=r.y,p=c+w*i[0]*s.resolution,h=f-S*i[1]*s.resolution}return He(e,r.spatialReference,r)?new A(h,c,f,p,r.spatialReference):new A(c,h,p,f,r.spatialReference)}function He(e,t,r){return e==="1.0.0"&&Z(t.wkid)&&!(r.spatialReference.isGeographic&&r.x<-90&&r.y>=-90)}var V;function Xe(e){return e.includes("crs84")||e.includes("crs:84")?V.CRS84:e.includes("crs83")||e.includes("crs:83")?V.CRS83:e.includes("crs27")||e.includes("crs:27")?V.CRS27:null}function ce(e,t,r,i,s){const a=te(t),l=y("Identifier",e);let n=parseFloat(y("ScaleDenominator",e));const c=fe(a.wkid,n,i);n*=96/me;const p=+y("MatrixWidth",e),h=+y("MatrixHeight",e),{maxCol:f=p-1,maxRow:d=h-1,minCol:w=0,minRow:S=0}=s.get(l)??{},{x:v,y:P}=ye(e,t);return new we({cols:[w,f],level:r,levelValue:l,origin:[v,P],scale:n,resolution:c,rows:[S,d]})}function fe(e,t,r){let i;return i=B.hasOwnProperty(""+e)?B.values[B[e]]:r==="default028mm"?6370997*Math.PI/180:xe(e).metersPerDegree,7*t/25e3/i}(function(e){e[e.CRS84=4326]="CRS84",e[e.CRS83=4269]="CRS83",e[e.CRS27=4267]="CRS27"})(V||(V={}));var Y;const pe={"image/png":".png","image/png8":".png","image/png24":".png","image/png32":".png","image/jpg":".jpg","image/jpeg":".jpeg","image/gif":".gif","image/bmp":".bmp","image/tiff":".tif","image/jpgpng":"","image/jpegpng":"","image/unknown":""},Ye=new Set(["version","service","request","layer","style","format","tilematrixset","tilematrix","tilerow","tilecol"]);let m=Y=class extends ve(Se(Me(Ie(Te(Le(Re)))))){constructor(...e){super(...e),this.activeLayer=null,this.copyright="",this.customParameters=null,this.customLayerParameters=null,this.fullExtent=null,this.operationalLayerType="WebTiledLayer",this.resourceInfo=null,this.serviceMode="RESTful",this.sublayers=null,this.type="wmts",this.version="1.0.0",this.addHandles([ie(()=>this.activeLayer,(t,r)=>{var i;r&&!((i=this.sublayers)!=null&&i.includes(r))&&(r.layer=null,r.parent=null),t&&(t.layer=this,t.parent=this)},U),se(()=>this.sublayers,"after-add",({item:t})=>{t.layer=this,t.parent=this},U),se(()=>this.sublayers,"after-remove",({item:t})=>{t.layer=null,t.parent=null},U),ie(()=>this.sublayers,(t,r)=>{if(r)for(const i of r)i.layer=null,i.parent=null;if(t)for(const i of t)i.layer=this,i.parent=this},U)])}normalizeCtorArgs(e,t){return typeof e=="string"?{url:e,...t}:e}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMTS"]},e).catch(le).then(()=>this._fetchService(e)).catch(t=>{throw le(t),new _("wmtslayer:unsupported-service-data","Invalid response from the WMTS service.",{error:t})})),Promise.resolve(this)}readActiveLayerFromService(e,t,r){this.activeLayer||(this.activeLayer=new j);let i=t.layers.find(s=>s.id===this.activeLayer.id);return i||(i=t.layers[0]),this.activeLayer.read(i,r),this.activeLayer}readActiveLayerFromItemOrWebDoc(e,t){const{templateUrl:r,wmtsInfo:i}=t,s=r?this._getLowerCasedUrlParams(r):null,a=i==null?void 0:i.layerIdentifier;let l=null;const n=i==null?void 0:i.tileMatrixSet;n&&(Array.isArray(n)?n.length&&(l=n[0]):l=n);const c=s==null?void 0:s.format,p=s==null?void 0:s.style;return new j({id:a,imageFormat:c,styleId:p,tileMatrixSetId:l})}writeActiveLayer(e,t,r,i){const s=this.activeLayer;t.templateUrl=this.getUrlTemplate(s.id,s.tileMatrixSetId,s.imageFormat,s.styleId);const a=Ee("tileMatrixSet.tileInfo",s);t.tileInfo=a?a.toJSON(i):null,t.wmtsInfo={...t.wmtsInfo,layerIdentifier:s.id,tileMatrixSet:s.tileMatrixSetId}}readCustomParameters(e,t){const r=t.wmtsInfo;return r?this._mergeParams(r.customParameters,r.url):null}get fullExtents(){return this.activeLayer.fullExtents}readServiceMode(e,t){return t.templateUrl.includes("?")?"KVP":"RESTful"}readSublayersFromService(e,t,r){return ze(t.layers,r)}get supportedSpatialReferences(){var e;return((e=this.activeLayer.tileMatrixSets)==null?void 0:e.map(t=>{var r;return(r=t.tileInfo)==null?void 0:r.spatialReference}).toArray().filter(de))??[]}get tilemapCache(){var t,r;const e=(r=(t=this.activeLayer)==null?void 0:t.tileMatrixSet)==null?void 0:r.tileInfo;return e?new Pe(e):void 0}get title(){var e;return((e=this.activeLayer)==null?void 0:e.title)??"Layer"}set title(e){this._overrideIfSome("title",e)}get url(){return this._get("url")}set url(e){e&&e.substr(-1)==="/"?this._set("url",e.slice(0,-1)):this._set("url",e)}createWebTileLayer(e){const t=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId),r=this._getTileMatrixSetById(e.tileMatrixSetId),i=r==null?void 0:r.tileInfo,s=e.fullExtent,a=new Oe({layerIdentifier:e.id,tileMatrixSet:e.tileMatrixSetId,url:this.url});return this.customLayerParameters&&(a.customLayerParameters=this.customLayerParameters),this.customParameters&&(a.customParameters=this.customParameters),new Ae({fullExtent:s,urlTemplate:t,tileInfo:i,wmtsInfo:a})}async fetchTile(e,t,r,i={}){const{signal:s}=i,a=this.getTileUrl(e,t,r),{data:l}=await K(a,{responseType:"image",signal:s});return l}async fetchImageBitmapTile(e,t,r,i={}){const{signal:s}=i;if(this.fetchTile!==Y.prototype.fetchTile){const n=await this.fetchTile(e,t,r,i);return ae(n,e,t,r,s)}const a=this.getTileUrl(e,t,r),{data:l}=await K(a,{responseType:"blob",signal:s});return ae(l,e,t,r,s)}findSublayerById(e){var t;return(t=this.sublayers)==null?void 0:t.find(r=>r.id===e)}getTileUrl(e,t,r){var n;const i=this._getTileMatrixSetById(this.activeLayer.tileMatrixSetId),s=(n=i==null?void 0:i.tileInfo)==null?void 0:n.lods[e],a=s?s.levelValue||`${s.level}`:`${e}`;let l=this.resourceInfo?"":_e({dimensionMap:this.dimensionMap,layerMap:this.layerMap},this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId,a,t,r);return l||(l=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId).replaceAll(/\{level\}/gi,a).replaceAll(/\{row\}/gi,`${t}`).replaceAll(/\{col\}/gi,`${r}`)),l=this._appendCustomLayerParameters(l),l}getUrlTemplate(e,t,r,i){if(!this.resourceInfo){const s=ke({dimensionMap:this.dimensionMap,layerMap:this.layerMap},e,t,i);if(s)return s}if(this.serviceMode==="KVP")return this.url+"?SERVICE=WMTS&VERSION="+this.version+"&REQUEST=GetTile&LAYER="+e+"&STYLE="+i+"&FORMAT="+r+"&TILEMATRIXSET="+t+"&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}";if(this.serviceMode==="RESTful"){let s="";return pe[r.toLowerCase()]&&(s=pe[r.toLowerCase()]),this.url+e+"/"+i+"/"+t+"/{level}/{row}/{col}"+s}return""}async _fetchService(e){let t;if(this.resourceInfo)this.resourceInfo.serviceMode==="KVP"&&(this.url+=this.url.includes("?")?"":"?"),t={ssl:!1,data:this.resourceInfo};else try{t=await this._getCapabilities(this.serviceMode,e),ue(t.data)}catch{const r=this.serviceMode==="KVP"?"RESTful":"KVP";try{t=await this._getCapabilities(r,e),ue(t.data),this.serviceMode=r}catch(i){throw new _("wmtslayer:unsupported-service-data","Services does not support RESTful or KVP service modes.",{error:i})}}this.resourceInfo?t.data=je(t.data):t.data=Ve(t.data,{serviceMode:this.serviceMode,url:this.url}),t.data&&this.read(t.data,{origin:"service"})}async _getCapabilities(e,t){const r=this._getCapabilitiesUrl(e);return await K(r,{...t,responseType:"text"})}_getTileMatrixSetById(e){var i;const t=this.findSublayerById(this.activeLayer.id);return(i=t==null?void 0:t.tileMatrixSets)==null?void 0:i.find(s=>s.id===e)}_appendCustomParameters(e){return this._appendParameters(e,this.customParameters)}_appendCustomLayerParameters(e){return this._appendParameters(e,{...oe(this.customParameters),...this.customLayerParameters})}_appendParameters(e,t){const r=J(e),i={...r.query,...t},s=Ce(i);return s===""?r.path:`${r.path}?${s}`}_getCapabilitiesUrl(e){this.url=J(this.url).path;let t=this.url;switch(e){case"KVP":t+=`?request=GetCapabilities&service=WMTS&version=${this.version}`;break;case"RESTful":{const r=`/${this.version}/WMTSCapabilities.xml`,i=new RegExp(r,"i");t=t.replace(i,""),t+=r;break}}return this._appendCustomParameters(t)}_getLowerCasedUrlParams(e){if(!e)return null;const t=J(e).query;if(!t)return null;const r={};return Object.keys(t).forEach(i=>{r[i.toLowerCase()]=t[i]}),r}_mergeParams(e,t){const r=this._getLowerCasedUrlParams(t);if(r){const i=Object.keys(r);i.length&&(e=e?oe(e):{},i.forEach(s=>{e.hasOwnProperty(s)||Ye.has(s)||(e[s]=r[s])}))}return e}};function ze(e,t){return e.map(r=>{const i=new j;return i.read(r,t),i})}o([u()],m.prototype,"dimensionMap",void 0),o([u()],m.prototype,"layerMap",void 0),o([u({type:j,json:{origins:{"web-document":{write:{ignoreOrigin:!0}}}}})],m.prototype,"activeLayer",void 0),o([R("service","activeLayer",["layers"])],m.prototype,"readActiveLayerFromService",null),o([R(["web-document","portal-item"],"activeLayer",["wmtsInfo"])],m.prototype,"readActiveLayerFromItemOrWebDoc",null),o([be(["web-document","portal-item"],"activeLayer",{templateUrl:{type:String},tileInfo:{type:z},"wmtsInfo.layerIdentifier":{type:String},"wmtsInfo.tileMatrixSet":{type:String}})],m.prototype,"writeActiveLayer",null),o([u({type:String,value:"",json:{write:!0}})],m.prototype,"copyright",void 0),o([u({type:["show","hide"]})],m.prototype,"listMode",void 0),o([u({json:{read:!0,write:!0}})],m.prototype,"blendMode",void 0),o([u({json:{origins:{"web-document":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}},"portal-item":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}}}}})],m.prototype,"customParameters",void 0),o([R(["portal-item","web-document"],"customParameters")],m.prototype,"readCustomParameters",null),o([u({json:{origins:{"web-document":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}},"portal-item":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}}}}})],m.prototype,"customLayerParameters",void 0),o([u({type:A,json:{write:{ignoreOrigin:!0},origins:{"web-document":{read:{source:"fullExtent"}},"portal-item":{read:{source:"fullExtent"}}}}})],m.prototype,"fullExtent",void 0),o([u({readOnly:!0})],m.prototype,"fullExtents",null),o([u({type:["WebTiledLayer"]})],m.prototype,"operationalLayerType",void 0),o([u()],m.prototype,"resourceInfo",void 0),o([u()],m.prototype,"serviceMode",void 0),o([R(["portal-item","web-document"],"serviceMode",["templateUrl"])],m.prototype,"readServiceMode",null),o([u({type:G.ofType(j)})],m.prototype,"sublayers",void 0),o([R("service","sublayers",["layers"])],m.prototype,"readSublayersFromService",null),o([u({readOnly:!0})],m.prototype,"supportedSpatialReferences",null),o([u({readOnly:!0})],m.prototype,"tilemapCache",null),o([u({json:{read:{source:"title"}}})],m.prototype,"title",null),o([u({json:{read:!1},readOnly:!0,value:"wmts"})],m.prototype,"type",void 0),o([u({json:{origins:{service:{read:{source:"tileUrl"}},"web-document":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}},"portal-item":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}}}}})],m.prototype,"url",null),o([u()],m.prototype,"version",void 0),m=Y=o([N("esri.layers.WMTSLayer")],m);const tt=m;export{tt as default}; diff --git a/dist/assets/WMTSLayerView3D-6XYesvf9.js b/dist/assets/WMTSLayerView3D-6XYesvf9.js new file mode 100644 index 0000000..8b344ab --- /dev/null +++ b/dist/assets/WMTSLayerView3D-6XYesvf9.js @@ -0,0 +1 @@ +import{aa as d,fT as f,V as u,R as n,e as s,y as o,c as m}from"./index-pCX-0tJH.js";import{n as c}from"./LayerView3D-57OghbRh.js";import{o as p}from"./TiledLayerView3D-_U1Q993H.js";import{u as g}from"./LayerView-ixwLVnzr.js";import{a as y}from"./RefreshableLayerView-DVYs7L04.js";let r=class extends y(p(c(g))){constructor(){super(...arguments),this.type="wmts-3d"}initialize(){this._getCompatibleTileInfoMatrixSet(e=>this._getTileInfoSupportError(e.tileInfo,e.fullExtent));const t=d(()=>{var e,i;return(i=(e=this.view)==null?void 0:e.basemapTerrain)==null?void 0:i.tilingSchemeLocked}).then(()=>{const e=this._getCompatibleTileInfoMatrixSet(i=>this._getTileInfoError(i.tileInfo,i.fullExtent));e!=null&&(e.id!==null&&this.layer.activeLayer.tileMatrixSetId!==e.id&&(this.layer.activeLayer.tileMatrixSetId=e.id),e.tileInfo&&(this.tileInfo=e.tileInfo),this.layer.fullExtent=e.fullExtent)});this.addResolvingPromise(t),this.when(()=>this._postInitialize())}get hasMixedImageFormats(){return!0}refresh(){this.emit("data-changed")}canResume(){if(!super.canResume())return!1;const t=this.layer.activeLayer.tileMatrixSet;return t!=null&&!this._getTileInfoError(t.tileInfo,t.fullExtent)}async doRefresh(){this.suspended||this.emit("data-changed")}_postInitialize(){this._updatingHandles.add(()=>{var t,e;return(e=(t=this.layer)==null?void 0:t.activeLayer)==null?void 0:e.styleId},()=>this.refresh()),this._updatingHandles.add(()=>{var t;return(t=this.layer)==null?void 0:t.activeLayer},t=>{const e=this._getCompatibleTileInfoMatrixSet(i=>this._getTileInfoError(i.tileInfo,i.fullExtent),!0);e&&e.id!=null&&t.tileMatrixSetId!==e.id&&(this.layer.activeLayer.tileMatrixSetId=e.id),this.notifyChange("suspended"),this.canResume()&&this.refresh()})}_getCompatibleTileInfoMatrixSet(t,e=!1){const i=f(this.layer);if(i!=null){if(u.isCollection(i))return i.find(h=>{const l=t(h);return l!=null&&(e?n.getLogger(this).error("The selected tile matrix set is not compatible with the view",l):this.addResolvingPromise(Promise.reject(l))),l==null});const a=t(i);return a!=null&&(e?n.getLogger(this).error("The selected tile matrix set is not compatible with the view",a):this.addResolvingPromise(Promise.reject(a))),i}return null}_getTileInfoError(t,e){return this._getTileInfoSupportError(t,e)||this._getTileInfoCompatibilityError(t,this.view.basemapTerrain.tilingScheme)}};s([o({readOnly:!0})],r.prototype,"hasMixedImageFormats",null),s([o()],r.prototype,"layer",void 0),s([o()],r.prototype,"suspended",void 0),s([o()],r.prototype,"tileInfo",void 0),r=s([m("esri.views.3d.layers.WMTSLayerView3d")],r);const S=r;export{S as default}; diff --git a/dist/assets/WMTSLayerView3D-oO1etwl-.js b/dist/assets/WMTSLayerView3D-oO1etwl-.js deleted file mode 100644 index caa4b5f..0000000 --- a/dist/assets/WMTSLayerView3D-oO1etwl-.js +++ /dev/null @@ -1 +0,0 @@ -import{w as d,fY as f,V as u,Z as a,e as s,y as o,c as m}from"./index-J0iiHjMT.js";import{n as c}from"./LayerView3D-iOx2MD1g.js";import{o as p}from"./TiledLayerView3D-Av58zTxG.js";import{u as g}from"./LayerView-efDufa6j.js";import{a as y}from"./RefreshableLayerView-Pd4dLcWr.js";let r=class extends y(p(c(g))){constructor(){super(...arguments),this.type="wmts-3d"}initialize(){this._getCompatibleTileInfoMatrixSet(e=>this._getTileInfoSupportError(e.tileInfo,e.fullExtent));const t=d(()=>{var e,i;return(i=(e=this.view)==null?void 0:e.basemapTerrain)==null?void 0:i.tilingSchemeLocked}).then(()=>{const e=this._getCompatibleTileInfoMatrixSet(i=>this._getTileInfoError(i.tileInfo,i.fullExtent));e!=null&&(e.id!==null&&this.layer.activeLayer.tileMatrixSetId!==e.id&&(this.layer.activeLayer.tileMatrixSetId=e.id),e.tileInfo&&(this.tileInfo=e.tileInfo),this.layer.fullExtent=e.fullExtent)});this.addResolvingPromise(t),this.when(()=>this._postInitialize())}get hasMixedImageFormats(){return!0}refresh(){this.emit("data-changed")}canResume(){if(!super.canResume())return!1;const t=this.layer.activeLayer.tileMatrixSet;return t!=null&&!this._getTileInfoError(t.tileInfo,t.fullExtent)}async doRefresh(){this.suspended||this.emit("data-changed")}_postInitialize(){this._updatingHandles.add(()=>{var t,e;return(e=(t=this.layer)==null?void 0:t.activeLayer)==null?void 0:e.styleId},()=>this.refresh()),this._updatingHandles.add(()=>{var t;return(t=this.layer)==null?void 0:t.activeLayer},t=>{const e=this._getCompatibleTileInfoMatrixSet(i=>this._getTileInfoError(i.tileInfo,i.fullExtent),!0);e&&e.id!=null&&t.tileMatrixSetId!==e.id&&(this.layer.activeLayer.tileMatrixSetId=e.id),this.notifyChange("suspended"),this.canResume()&&this.refresh()})}_getCompatibleTileInfoMatrixSet(t,e=!1){const i=f(this.layer);if(i!=null){if(u.isCollection(i))return i.find(h=>{const l=t(h);return l!=null&&(e?a.getLogger(this).error("The selected tile matrix set is not compatible with the view",l):this.addResolvingPromise(Promise.reject(l))),l==null});const n=t(i);return n!=null&&(e?a.getLogger(this).error("The selected tile matrix set is not compatible with the view",n):this.addResolvingPromise(Promise.reject(n))),i}return null}_getTileInfoError(t,e){return this._getTileInfoSupportError(t,e)||this._getTileInfoCompatibilityError(t,this.view.basemapTerrain.tilingScheme)}};s([o({readOnly:!0})],r.prototype,"hasMixedImageFormats",null),s([o()],r.prototype,"layer",void 0),s([o()],r.prototype,"suspended",void 0),s([o()],r.prototype,"tileInfo",void 0),r=s([m("esri.views.3d.layers.WMTSLayerView3d")],r);const S=r;export{S as default}; diff --git a/dist/assets/WebTileLayer-JxqArsF7.js b/dist/assets/WebTileLayer-jfo0VJmw.js similarity index 87% rename from dist/assets/WebTileLayer-JxqArsF7.js rename to dist/assets/WebTileLayer-jfo0VJmw.js index ab53bcc..284d59e 100644 --- a/dist/assets/WebTileLayer-JxqArsF7.js +++ b/dist/assets/WebTileLayer-jfo0VJmw.js @@ -1 +1 @@ -import{e as l,y as i,c as T,dr as R,bI as v,dK as $,dL as x,dO as I,dM as M,dN as W,dP as L,dT as j,ar as y,e$ as S,T as U,f0 as s,j6 as h,E as D,j7 as E,j8 as O,j9 as z,bW as w,f2 as g,c_ as A,dt as b,du as _,c7 as q}from"./index-J0iiHjMT.js";var m;let c=m=class extends R{constructor(e){super(e)}clone(){return new m({customLayerParameters:v(this.customLayerParameters),customParameters:v(this.customParameters),layerIdentifier:this.layerIdentifier,tileMatrixSet:this.tileMatrixSet,url:this.url})}};l([i({json:{type:Object,write:!0}})],c.prototype,"customLayerParameters",void 0),l([i({json:{type:Object,write:!0}})],c.prototype,"customParameters",void 0),l([i({type:String,json:{write:!0}})],c.prototype,"layerIdentifier",void 0),l([i({type:String,json:{write:!0}})],c.prototype,"tileMatrixSet",void 0),l([i({type:String,json:{write:!0}})],c.prototype,"url",void 0),c=m=l([T("esri.layer.support.WMTSLayerInfo")],c);var f;let o=f=class extends $(x(I(M(W(L(q)))))){constructor(...e){super(...e),this.copyright="",this.fullExtent=new j(-20037508342787e-6,-2003750834278e-5,2003750834278e-5,20037508342787e-6,y.WebMercator),this.legendEnabled=!1,this.isReference=null,this.popupEnabled=!1,this.spatialReference=y.WebMercator,this.subDomains=null,this.tileInfo=new S({size:[256,256],dpi:96,format:"png8",compressionQuality:0,origin:new U({x:-20037508342787e-6,y:20037508342787e-6,spatialReference:y.WebMercator}),spatialReference:y.WebMercator,lods:[new s({level:0,scale:591657527591555e-6,resolution:156543.033928}),new s({level:1,scale:295828763795777e-6,resolution:78271.5169639999}),new s({level:2,scale:147914381897889e-6,resolution:39135.7584820001}),new s({level:3,scale:73957190948944e-6,resolution:19567.8792409999}),new s({level:4,scale:36978595474472e-6,resolution:9783.93962049996}),new s({level:5,scale:18489297737236e-6,resolution:4891.96981024998}),new s({level:6,scale:9244648868618e-6,resolution:2445.98490512499}),new s({level:7,scale:4622324434309e-6,resolution:1222.99245256249}),new s({level:8,scale:2311162217155e-6,resolution:611.49622628138}),new s({level:9,scale:1155581108577e-6,resolution:305.748113140558}),new s({level:10,scale:577790.554289,resolution:152.874056570411}),new s({level:11,scale:288895.277144,resolution:76.4370282850732}),new s({level:12,scale:144447.638572,resolution:38.2185141425366}),new s({level:13,scale:72223.819286,resolution:19.1092570712683}),new s({level:14,scale:36111.909643,resolution:9.55462853563415}),new s({level:15,scale:18055.954822,resolution:4.77731426794937}),new s({level:16,scale:9027.977411,resolution:2.38865713397468}),new s({level:17,scale:4513.988705,resolution:1.19432856685505}),new s({level:18,scale:2256.994353,resolution:.597164283559817}),new s({level:19,scale:1128.497176,resolution:.298582141647617}),new s({level:20,scale:564.248588,resolution:.14929107082380833}),new s({level:21,scale:282.124294,resolution:.07464553541190416}),new s({level:22,scale:141.062147,resolution:.03732276770595208}),new s({level:23,scale:70.5310735,resolution:.01866138385297604})]}),this.type="web-tile",this.urlTemplate=null,this.wmtsInfo=null}normalizeCtorArgs(e,t){return typeof e=="string"?{urlTemplate:e,...t}:e}load(e){const t=this.loadFromPortal({supportedTypes:["WMTS"]},e).then(()=>{var a;let r="";if(this.urlTemplate)if(this.spatialReference.equals(this.tileInfo.spatialReference)){const n=new h(this.urlTemplate);!(this.subDomains&&this.subDomains.length>0)&&((a=n.authority)!=null&&a.includes("{subDomain}"))&&(r="is missing 'subDomains' property")}else r="spatialReference must match tileInfo.spatialReference";else r="is missing the required 'urlTemplate' property value";if(r)throw new D("web-tile-layer:load",`WebTileLayer (title: '${this.title}', id: '${this.id}') ${r}`)});return this.addResolvingPromise(t),Promise.resolve(this)}get levelValues(){const e=[];if(!this.tileInfo)return null;for(const t of this.tileInfo.lods)e[t.level]=t.levelValue||t.level;return e}readSpatialReference(e,t){var r;return e||y.fromJSON((r=t.fullExtent)==null?void 0:r.spatialReference)}get tileServers(){if(!this.urlTemplate)return null;const e=[],{urlTemplate:t,subDomains:r}=this,a=new h(t),n=a.scheme?a.scheme+"://":"//",u=n+a.authority+"/",p=a.authority;if(p!=null&&p.includes("{subDomain}")){if(r&&r.length>0&&p.split(".").length>1)for(const d of r)e.push(n+p.replaceAll(/\{subDomain\}/gi,d)+"/")}else e.push(u);return e.map(E)}get urlPath(){if(!this.urlTemplate)return null;const e=this.urlTemplate,t=new h(e),r=(t.scheme?t.scheme+"://":"//")+t.authority+"/";return e.substring(r.length)}readUrlTemplate(e,t){return e||t.templateUrl}writeUrlTemplate(e,t){O(e)&&(e="https:"+e),e&&(e=e.replaceAll(/\{z\}/gi,"{level}").replaceAll(/\{x\}/gi,"{col}").replaceAll(/\{y\}/gi,"{row}"),e=z(e)),t.templateUrl=e}fetchTile(e,t,r,a={}){const{signal:n}=a,u=this.getTileUrl(e,t,r),p={responseType:"image",signal:n,query:{...this.refreshParameters}};return w(u,p).then(d=>d.data)}async fetchImageBitmapTile(e,t,r,a={}){const{signal:n}=a;if(this.fetchTile!==f.prototype.fetchTile){const P=await this.fetchTile(e,t,r,a);return g(P,e,t,r,n)}const u=this.getTileUrl(e,t,r),p={responseType:"blob",signal:n,query:{...this.refreshParameters}},{data:d}=await w(u,p);return g(d,e,t,r,n)}getTileUrl(e,t,r){const{levelValues:a,tileServers:n,urlPath:u}=this;if(!a||!n||!u)return"";const p=a[e];return n[t%n.length]+A(u,{level:p,z:p,col:r,x:r,row:t,y:t})}};l([i({type:String,value:"",json:{write:!0}})],o.prototype,"copyright",void 0),l([i({type:j,json:{write:!0},nonNullable:!0})],o.prototype,"fullExtent",void 0),l([i({readOnly:!0,json:{read:!1,write:!1}})],o.prototype,"legendEnabled",void 0),l([i({type:["show","hide"]})],o.prototype,"listMode",void 0),l([i({json:{read:!0,write:!0}})],o.prototype,"blendMode",void 0),l([i()],o.prototype,"levelValues",null),l([i({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],o.prototype,"isReference",void 0),l([i({type:["WebTiledLayer"],value:"WebTiledLayer"})],o.prototype,"operationalLayerType",void 0),l([i({readOnly:!0,json:{read:!1,write:!1}})],o.prototype,"popupEnabled",void 0),l([i({type:y})],o.prototype,"spatialReference",void 0),l([b("spatialReference",["spatialReference","fullExtent.spatialReference"])],o.prototype,"readSpatialReference",null),l([i({type:[String],json:{write:!0}})],o.prototype,"subDomains",void 0),l([i({type:S,json:{write:!0}})],o.prototype,"tileInfo",void 0),l([i({readOnly:!0})],o.prototype,"tileServers",null),l([i({json:{read:!1}})],o.prototype,"type",void 0),l([i()],o.prototype,"urlPath",null),l([i({type:String,json:{origins:{"portal-item":{read:{source:"url"}}}}})],o.prototype,"urlTemplate",void 0),l([b("urlTemplate",["urlTemplate","templateUrl"])],o.prototype,"readUrlTemplate",null),l([_("urlTemplate",{templateUrl:{type:String}})],o.prototype,"writeUrlTemplate",null),l([i({type:c,json:{write:!0}})],o.prototype,"wmtsInfo",void 0),o=f=l([T("esri.layers.WebTileLayer")],o);const V=o,B=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));export{V as I,B as W,c as p}; +import{e as l,y as i,c as T,dr as I,ah as v,dF as P,dG as x,dJ as $,dH as M,dI as W,dK as L,dO as j,d2 as y,eW as S,L as U,eX as s,jd as h,r as D,je as O,jf as E,jg as z,av as w,eZ as g,cR as A,dt as b,du as q,aI as V}from"./index-pCX-0tJH.js";var m;let c=m=class extends I{constructor(e){super(e)}clone(){return new m({customLayerParameters:v(this.customLayerParameters),customParameters:v(this.customParameters),layerIdentifier:this.layerIdentifier,tileMatrixSet:this.tileMatrixSet,url:this.url})}};l([i({json:{type:Object,write:!0}})],c.prototype,"customLayerParameters",void 0),l([i({json:{type:Object,write:!0}})],c.prototype,"customParameters",void 0),l([i({type:String,json:{write:!0}})],c.prototype,"layerIdentifier",void 0),l([i({type:String,json:{write:!0}})],c.prototype,"tileMatrixSet",void 0),l([i({type:String,json:{write:!0}})],c.prototype,"url",void 0),c=m=l([T("esri.layer.support.WMTSLayerInfo")],c);var f;let o=f=class extends P(x($(M(W(L(V)))))){constructor(...e){super(...e),this.copyright="",this.fullExtent=new j(-20037508342787e-6,-2003750834278e-5,2003750834278e-5,20037508342787e-6,y.WebMercator),this.legendEnabled=!1,this.isReference=null,this.popupEnabled=!1,this.spatialReference=y.WebMercator,this.subDomains=null,this.tileInfo=new S({size:[256,256],dpi:96,format:"png8",compressionQuality:0,origin:new U({x:-20037508342787e-6,y:20037508342787e-6,spatialReference:y.WebMercator}),spatialReference:y.WebMercator,lods:[new s({level:0,scale:591657527591555e-6,resolution:156543.033928}),new s({level:1,scale:295828763795777e-6,resolution:78271.5169639999}),new s({level:2,scale:147914381897889e-6,resolution:39135.7584820001}),new s({level:3,scale:73957190948944e-6,resolution:19567.8792409999}),new s({level:4,scale:36978595474472e-6,resolution:9783.93962049996}),new s({level:5,scale:18489297737236e-6,resolution:4891.96981024998}),new s({level:6,scale:9244648868618e-6,resolution:2445.98490512499}),new s({level:7,scale:4622324434309e-6,resolution:1222.99245256249}),new s({level:8,scale:2311162217155e-6,resolution:611.49622628138}),new s({level:9,scale:1155581108577e-6,resolution:305.748113140558}),new s({level:10,scale:577790.554289,resolution:152.874056570411}),new s({level:11,scale:288895.277144,resolution:76.4370282850732}),new s({level:12,scale:144447.638572,resolution:38.2185141425366}),new s({level:13,scale:72223.819286,resolution:19.1092570712683}),new s({level:14,scale:36111.909643,resolution:9.55462853563415}),new s({level:15,scale:18055.954822,resolution:4.77731426794937}),new s({level:16,scale:9027.977411,resolution:2.38865713397468}),new s({level:17,scale:4513.988705,resolution:1.19432856685505}),new s({level:18,scale:2256.994353,resolution:.597164283559817}),new s({level:19,scale:1128.497176,resolution:.298582141647617}),new s({level:20,scale:564.248588,resolution:.14929107082380833}),new s({level:21,scale:282.124294,resolution:.07464553541190416}),new s({level:22,scale:141.062147,resolution:.03732276770595208}),new s({level:23,scale:70.5310735,resolution:.01866138385297604})]}),this.type="web-tile",this.urlTemplate=null,this.wmtsInfo=null}normalizeCtorArgs(e,t){return typeof e=="string"?{urlTemplate:e,...t}:e}load(e){const t=this.loadFromPortal({supportedTypes:["WMTS"]},e).then(()=>{var a;let r="";if(this.urlTemplate)if(this.spatialReference.equals(this.tileInfo.spatialReference)){const n=new h(this.urlTemplate);!(this.subDomains&&this.subDomains.length>0)&&((a=n.authority)!=null&&a.includes("{subDomain}"))&&(r="is missing 'subDomains' property")}else r="spatialReference must match tileInfo.spatialReference";else r="is missing the required 'urlTemplate' property value";if(r)throw new D("web-tile-layer:load",`WebTileLayer (title: '${this.title}', id: '${this.id}') ${r}`)});return this.addResolvingPromise(t),Promise.resolve(this)}get levelValues(){const e=[];if(!this.tileInfo)return null;for(const t of this.tileInfo.lods)e[t.level]=t.levelValue||t.level;return e}readSpatialReference(e,t){var r;return e||y.fromJSON((r=t.fullExtent)==null?void 0:r.spatialReference)}get tileServers(){if(!this.urlTemplate)return null;const e=[],{urlTemplate:t,subDomains:r}=this,a=new h(t),n=a.scheme?a.scheme+"://":"//",u=n+a.authority+"/",p=a.authority;if(p!=null&&p.includes("{subDomain}")){if(r&&r.length>0&&p.split(".").length>1)for(const d of r)e.push(n+p.replaceAll(/\{subDomain\}/gi,d)+"/")}else e.push(u);return e.map(O)}get urlPath(){if(!this.urlTemplate)return null;const e=this.urlTemplate,t=new h(e),r=(t.scheme?t.scheme+"://":"//")+t.authority+"/";return e.substring(r.length)}readUrlTemplate(e,t){return e||t.templateUrl}writeUrlTemplate(e,t){E(e)&&(e="https:"+e),e&&(e=e.replaceAll(/\{z\}/gi,"{level}").replaceAll(/\{x\}/gi,"{col}").replaceAll(/\{y\}/gi,"{row}"),e=z(e)),t.templateUrl=e}fetchTile(e,t,r,a={}){const{signal:n}=a,u=this.getTileUrl(e,t,r),p={responseType:"image",signal:n,query:{...this.refreshParameters}};return w(u,p).then(d=>d.data)}async fetchImageBitmapTile(e,t,r,a={}){const{signal:n}=a;if(this.fetchTile!==f.prototype.fetchTile){const R=await this.fetchTile(e,t,r,a);return g(R,e,t,r,n)}const u=this.getTileUrl(e,t,r),p={responseType:"blob",signal:n,query:{...this.refreshParameters}},{data:d}=await w(u,p);return g(d,e,t,r,n)}getTileUrl(e,t,r){const{levelValues:a,tileServers:n,urlPath:u}=this;if(!a||!n||!u)return"";const p=a[e];return n[t%n.length]+A(u,{level:p,z:p,col:r,x:r,row:t,y:t})}};l([i({type:String,value:"",json:{write:!0}})],o.prototype,"copyright",void 0),l([i({type:j,json:{write:!0},nonNullable:!0})],o.prototype,"fullExtent",void 0),l([i({readOnly:!0,json:{read:!1,write:!1}})],o.prototype,"legendEnabled",void 0),l([i({type:["show","hide"]})],o.prototype,"listMode",void 0),l([i({json:{read:!0,write:!0}})],o.prototype,"blendMode",void 0),l([i()],o.prototype,"levelValues",null),l([i({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],o.prototype,"isReference",void 0),l([i({type:["WebTiledLayer"],value:"WebTiledLayer"})],o.prototype,"operationalLayerType",void 0),l([i({readOnly:!0,json:{read:!1,write:!1}})],o.prototype,"popupEnabled",void 0),l([i({type:y})],o.prototype,"spatialReference",void 0),l([b("spatialReference",["spatialReference","fullExtent.spatialReference"])],o.prototype,"readSpatialReference",null),l([i({type:[String],json:{write:!0}})],o.prototype,"subDomains",void 0),l([i({type:S,json:{write:!0}})],o.prototype,"tileInfo",void 0),l([i({readOnly:!0})],o.prototype,"tileServers",null),l([i({json:{read:!1}})],o.prototype,"type",void 0),l([i()],o.prototype,"urlPath",null),l([i({type:String,json:{origins:{"portal-item":{read:{source:"url"}}}}})],o.prototype,"urlTemplate",void 0),l([b("urlTemplate",["urlTemplate","templateUrl"])],o.prototype,"readUrlTemplate",null),l([q("urlTemplate",{templateUrl:{type:String}})],o.prototype,"writeUrlTemplate",null),l([i({type:c,json:{write:!0}})],o.prototype,"wmtsInfo",void 0),o=f=l([T("esri.layers.WebTileLayer")],o);const _=o,C=Object.freeze(Object.defineProperty({__proto__:null,default:_},Symbol.toStringTag,{value:"Module"}));export{_ as I,C as W,c as p}; diff --git a/dist/assets/WhereClause-XAMIZ4-B.js b/dist/assets/WhereClause-FOYoIAAW.js similarity index 94% rename from dist/assets/WhereClause-XAMIZ4-B.js rename to dist/assets/WhereClause-FOYoIAAW.js index 7e973ec..a0da66f 100644 --- a/dist/assets/WhereClause-XAMIZ4-B.js +++ b/dist/assets/WhereClause-FOYoIAAW.js @@ -1,7 +1,7 @@ -import{b as q,n as Q,m as Ps}from"./TimeOnly-ljWtUK7N.js";import{c_ as ln,mA as _,mC as Ls,mB as jt,pO as Yt,pP as ct,pQ as _s,dJ as tn,mD as Rs}from"./index-J0iiHjMT.js";var d;(function(i){i.InvalidFunctionParameters="InvalidFunctionParameters",i.InvalidValueForAggregateFunction="InvalidValueForAggregateFunction",i.UnsupportedSqlFunction="UnsupportedSqlFunction",i.UnsupportedOperator="UnsupportedOperator",i.UnsupportedSyntax="UnsupportedSyntax",i.UnsupportedIsRhs="UnsupportedIsRhs",i.UnsupportedIsLhs="UnsupportedIsLhs",i.InvalidDataType="InvalidDataType",i.CannotCastValue="CannotCastValue",i.FunctionNotRecognized="FunctionNotRecognized",i.InvalidTime="InvalidTime",i.InvalidParameterCount="InvalidParameterCount",i.InvalidTimeStamp="InvalidTimeStamp",i.InvalidDate="InvalidDate",i.InvalidOperator="InvalidOperator",i.IllegalInterval="IllegalInterval",i.YearMonthIntervals="YearMonthIntervals",i.PrimarySecondaryQualifiers="PrimarySecondaryQualifiers",i.MissingStatisticParameters="MissingStatisticParameters"})(d||(d={}));const Us={[d.InvalidValueForAggregateFunction]:"Invalid value used in aggregate function",[d.MissingStatisticParameters]:"Statistic does not have 1 or 0 Parameters",[d.InvalidFunctionParameters]:"Invalid parameters for call to {function}",[d.UnsupportedIsLhs]:"Unsupported left hand expression in is statement",[d.UnsupportedIsRhs]:"Unsupported right hand expression in is statement",[d.UnsupportedOperator]:"Unsupported operator - {operator}",[d.UnsupportedSyntax]:"Unsupported syntax - {node}",[d.UnsupportedSqlFunction]:"Sql function not found = {function}",[d.InvalidDataType]:"Invalid sql data type",[d.InvalidDate]:"Invalid date encountered",[d.InvalidOperator]:"Invalid operator encountered",[d.InvalidTime]:"Invalid time encountered",[d.IllegalInterval]:"Illegal interval",[d.FunctionNotRecognized]:"Function not recognized",[d.InvalidTimeStamp]:"Invalid timestamp encountered",[d.InvalidParameterCount]:"Invalid parameter count for call to {name}",[d.PrimarySecondaryQualifiers]:"Primary and Secondary SqlInterval qualifiers not supported",[d.YearMonthIntervals]:"Year-Month Intervals not supported",[d.CannotCastValue]:"Cannot cast value to the required data type"};let v=class cn extends Error{constructor(r,u){super(ln(Us[r],u)),this.declaredRootClass="esri.arcade.featureset.support.sqlerror",Error.captureStackTrace&&Error.captureStackTrace(this,cn)}};var W;(function(i){i.NeverReach="NeverReach",i.NotImplemented="NotImplemented",i.Cancelled="Cancelled",i.InvalidStatResponse="InvalidStatResponse",i.InvalidRequest="InvalidRequest",i.RequestFailed="RequestFailed",i.MissingFeatures="MissingFeatures",i.AggregationFieldNotFound="AggregationFieldNotFound",i.DataElementsNotFound="DataElementsNotFound"})(W||(W={}));const Vs={[W.Cancelled]:"Cancelled",[W.InvalidStatResponse]:"Invalid statistics response from service",[W.InvalidRequest]:"Invalid request",[W.RequestFailed]:"Request failed - {reason}",[W.MissingFeatures]:"Missing features",[W.AggregationFieldNotFound]:"Aggregation field not found",[W.DataElementsNotFound]:"Data elements not found on service",[W.NeverReach]:"Encountered unreachable logic",[W.NotImplemented]:"Not implemented"};let hc=class fn extends Error{constructor(r,u){super(ln(Vs[r],u)),this.declaredRootClass="esri.arcade.featureset.support.featureseterror",Error.captureStackTrace&&Error.captureStackTrace(this,fn)}};function en(i){return Number.isNaN(i)||i===0?i:Math.trunc(i)}class z{constructor(r){this._timeStampOffset=r,this._date=null}toDateTime(){return this._date??(this._date=_.fromISO(this._timeStampOffset,{setZone:!0})),this._date}get isValid(){return this.toDateTime().isValid}get timezoneOffsetHour(){return en(this.toDateTime().offset/60)}get timezoneOffsetMinutes(){return en(this.toDateTime().offset%60)}toMilliseconds(){return this.toDateTime().toMillis()}get hour(){return this.toDateTime().hour}get minute(){return this.toDateTime().minute}get second(){return this.toDateTime().second}get day(){return this.toDateTime().day}get month(){return this.toDateTime().month}get year(){return this.toDateTime().year}startOfDay(){return z.fromDateTime(this.toDateTime().startOf("day"))}static fromJSDate(r){return new z(_.fromJSDate(r).toISO({includeOffset:!0}))}static fromDateTime(r){return new z(r.toISO({includeOffset:!0}))}static fromParts(r,u,c=0,l=0,h=0,I=0,e=0,T=!1,O=0,L=0){const U=`${r.toString().padStart(4,"0")}-${u.toString().padStart(2,"0")}-${c.toString().padStart(2,"0")}`;let Z="";I<10&&(Z="0");let C=`${l.toString().padStart(2,"0")}:${h.toString().padStart(2,"0")}:${Z+I.toString()}`;e!==0&&(C+="."+e.toString().padStart(3,"0"));const A=`${T?"-":"+"}${O.toString().padStart(2,"0")}:${L.toString().padStart(2,"0")}`;return new z(U+"T"+C+A)}toStorageFormat(){return this._timeStampOffset}toString(){return this._timeStampOffset}toSQLValue(){let r=this.toDateTime().toSQL({includeOffset:!0,includeOffsetSpace:!0});return r&&(r=r.replace(".000","")),r}toSQLWithKeyword(){return`timestamp '${this.toSQLValue()}'`}addMilliseconds(r){const u=this.toDateTime().plus(r);return z.fromDateTime(u)}}function Js(i,r){const u=dn[i.toLowerCase()];if(u==null)throw new v(d.FunctionNotRecognized);if(r.lengthu.maxParams)throw new v(d.InvalidParameterCount,{name:i.toUpperCase()});return u.evaluate(r)}function nn(i,r){const u=dn[i.toLowerCase()];return u!=null&&r>=u.minParams&&r<=u.maxParams}const dn={min:{minParams:1,maxParams:1,evaluate:i=>rn(i[0],"min")},max:{minParams:1,maxParams:1,evaluate:i=>rn(i[0],"max")},avg:{minParams:1,maxParams:1,evaluate:i=>pn(i[0])},sum:{minParams:1,maxParams:1,evaluate:i=>zs(i[0])},stddev:{minParams:1,maxParams:1,evaluate:i=>Zs(i[0])},count:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:i[0].length},var:{minParams:1,maxParams:1,evaluate:i=>vn(i[0])}};function pn(i){if(i===null)return null;let r=0,u=0;for(let c=0;c=h)&&(u=l,c=h)}return u}function zs(i){if(i===null)return null;let r=0;for(let u=0;uc!==null)).length===0)return null;const r=pn(i);if(r===null)return null;let u=0;for(const c of i){if(!te(c))throw new v(d.InvalidValueForAggregateFunction);u+=(r-c)**2}return u/(i.length-1)}class b{constructor(){this.op="+",this.day=0,this.second=0,this.hour=0,this.month=0,this.year=0,this.minute=0,this.millis=0}static _fixDefaults(r){if(r.precision!==null||r.secondary!==null)throw new v(d.PrimarySecondaryQualifiers)}static _parseSecondsComponent(r,u){if(u.includes(".")){const c=u.split(".");r.second=parseFloat(c[0]),r.millis=parseInt(c[1],10)}else r.second=parseFloat(u)}static createFromMilliseconds(r){const u=new b;return u.second=r/1e3,u}static createFromValueAndQualifer(r,u,c){let l=null;const h=new b;if(h.op=c==="-"?"-":"+",u.type==="interval-period"){b._fixDefaults(u);const I=new RegExp("^[0-9]{1,}$");if(u.period==="year"||u.period==="month")throw new v(d.YearMonthIntervals);if(u.period==="second"){if(!/^[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$/.test(r))throw new v(d.IllegalInterval);b._parseSecondsComponent(h,r)}else{if(!I.test(r))throw new v(d.IllegalInterval);h[u.period]=parseFloat(r)}}else{if(b._fixDefaults(u.start),b._fixDefaults(u.end),u.start.period==="year"||u.start.period==="month"||u.end.period==="year"||u.end.period==="month")throw new v(d.YearMonthIntervals);switch(u.start.period){case"day":switch(u.end.period){case"hour":if(l=new RegExp("^[0-9]{1,} [0-9]{1,}$"),!l.test(r))throw new v(d.IllegalInterval);h[u.start.period]=parseFloat(r.split(" ")[0]),h[u.end.period]=parseFloat(r.split(" ")[1]);break;case"minute":if(l=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,}$"),!l.test(r))throw new v(d.IllegalInterval);{h[u.start.period]=parseFloat(r.split(" ")[0]);const I=r.split(" ")[1].split(":");h.hour=parseFloat(I[0]),h.minute=parseFloat(I[1])}break;case"second":if(l=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!l.test(r))throw new v(d.IllegalInterval);{h[u.start.period]=parseFloat(r.split(" ")[0]);const I=r.split(" ")[1].split(":");h.hour=parseFloat(I[0]),h.minute=parseFloat(I[1]),b._parseSecondsComponent(h,I[2])}break;default:throw new v(d.IllegalInterval)}break;case"hour":switch(u.end.period){case"minute":if(l=new RegExp("^[0-9]{1,}:[0-9]{1,}$"),!l.test(r))throw new v(d.IllegalInterval);h.hour=parseFloat(r.split(":")[0]),h.minute=parseFloat(r.split(":")[1]);break;case"second":if(l=new RegExp("^[0-9]{1,}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!l.test(r))throw new v(d.IllegalInterval);{const I=r.split(":");h.hour=parseFloat(I[0]),h.minute=parseFloat(I[1]),b._parseSecondsComponent(h,I[2])}break;default:throw new v(d.IllegalInterval)}break;case"minute":if(u.end.period!=="second")throw new v(d.IllegalInterval);if(l=new RegExp("^[0-9]{1,}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!l.test(r))throw new v(d.IllegalInterval);{const I=r.split(":");h.minute=parseFloat(I[0]),b._parseSecondsComponent(h,I[1])}break;default:throw new v(d.IllegalInterval)}}return h}valueInMilliseconds(){return(this.op==="-"?-1:1)*(this.millis+1e3*this.second+60*this.minute*1e3+60*this.hour*60*1e3+24*this.day*60*60*1e3+this.month*(365/12)*24*60*60*1e3+365*this.year*24*60*60*1e3)}}const ks=/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/,Hs=/^(\d{1,2}):(\d{1,2})$/,qs=/^(\d{1,2}):(\d{1,2}):(\d{1,2}).([0-9]+)$/,mn=/^(\d{4})-(\d{1,2})-(\d{1,2})$/,js=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$/,Ys=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$/,Bs=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$/,Qs=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/;function bt(i,r){if(r instanceof Ls)return r===jt.instance?_.fromMillis(i.getTime(),{zone:jt.instance}):_.fromJSDate(i,{zone:r});switch(r){case"system":case"local":case null:return _.fromJSDate(i);default:return(r==null?void 0:r.toLowerCase())==="unknown"?_.fromMillis(i.getTime(),{zone:jt.instance}):_.fromJSDate(i,{zone:r})}}function k(i){return typeof i=="number"}function H(i){return typeof i=="string"||i instanceof String}function et(i){return i instanceof b}function Y(i){return i instanceof Date}function M(i){return i instanceof _}function E(i){return i instanceof q}function D(i){return i instanceof Q}function F(i){return i instanceof z}function ee(i){let r=ks.exec(i);if(r!==null){const[,u,c,l]=r,h=Q.fromParts(parseInt(u,10),parseInt(c,10),parseInt(l,10),0);if(h!==null)return h;throw new v(d.InvalidTime)}if(r=Hs.exec(i),r!==null){const[,u,c]=r,l=Q.fromParts(parseInt(u,10),parseInt(c,10),0,0);if(l!==null)return l;throw new v(d.InvalidTime)}if(r=qs.exec(i),r!==null){const[,u,c,l,h]=r,I=Q.fromParts(parseInt(u,10),parseInt(c,10),parseInt(l,10),parseInt(h,10));if(I!==null)return I;throw new v(d.InvalidTime)}throw new v(d.InvalidTime)}function At(i,r,u=!1){let c=js.exec(i);if(c!==null){const[,l,h,I,e,T,O,L]=c,U=_.fromObject({year:parseInt(l,10),month:parseInt(h,10),day:parseInt(I,10),hour:parseInt(e,10),minute:parseInt(T,10),second:parseInt(O,10),millisecond:L?parseInt(L.replace(".",""),10):0},{zone:Yt(r)});if(U.isValid===!1)throw new v(d.InvalidTimeStamp);return U}if(c=Ys.exec(i),c!==null){const[,l,h,I,e,T,O,L,U,Z,C]=c,A=z.fromParts(parseInt(l,10),parseInt(h,10),parseInt(I,10),parseInt(e,10),parseInt(T,10),parseInt(O,10),L?parseInt(L.replace(".",""),10):0,U==="-",parseInt(Z,10),parseInt(C,10));if(A.isValid===!1)throw new v(d.InvalidTimeStamp);return A}if(c=Bs.exec(i),c!==null){const[,l,h,I,e,T,O,L,U]=c,Z=z.fromParts(parseInt(l,10),parseInt(h,10),parseInt(I,10),parseInt(e,10),parseInt(T,10),0,0,O==="-",parseInt(L,10),parseInt(U,10));if(Z.isValid===!1)throw new v(d.InvalidTimeStamp);return Z}if(c=Qs.exec(i),c!==null){const[,l,h,I,e,T]=c,O=_.fromObject({year:parseInt(l,10),month:parseInt(h,10),day:parseInt(I,10),hour:parseInt(e,10),minute:parseInt(T,10),second:0},{zone:Yt(r)});if(O.isValid===!1)throw new v(d.InvalidTimeStamp);return O}if(c=mn.exec(i),c!==null){const[,l,h,I]=c,e=_.fromObject({year:parseInt(l,10),month:parseInt(h,10),day:parseInt(I,10),hour:0,minute:0,second:0},{zone:Yt(r)});if(e.isValid===!1)throw new v(d.InvalidTimeStamp);return e}throw new v(d.InvalidTimeStamp)}function hn(i,r){const u=mn.exec(i);if(u===null)try{return At(i,r)}catch{throw new v(d.InvalidDate)}const[,c,l,h]=u,I=q.fromParts(parseInt(c,10),parseInt(l,10),parseInt(h,10));if(I===null)throw new v(d.InvalidDate);return I}const Ws=321408e5,Gs=26784e5,Ks=864e5,Xs=36e5,tl=6e4;function Bt(i){return!!M(i)||!!F(i)}function el(i){return!!M(i)||!!E(i)||!!F(i)||!!D(i)}function xt(i){if(M(i))return i.toMillis();if(E(i))return i.toNumber();if(F(i))return i.toMilliseconds();throw new v(d.InvalidDataType)}function B(i,r,u,c){if(i==null||r==null)return null;if(k(i)){if(k(r))return G(i,r,u);if(H(r))return nl(i,r,u);if(el(r))throw new v(d.InvalidOperator);if(E(r))throw new v(d.InvalidOperator)}else if(H(i)){if(k(r))return rl(i,r,u);if(H(r))return al(i,r,u);if(M(r))throw new v(d.InvalidOperator);if(E(r))throw new v(d.InvalidOperator);if(D(r))throw new v(d.InvalidOperator);if(F(r))throw new v(d.InvalidOperator)}else if(M(i)){if(Bt(r)){if(i instanceof _&&ct(i.zone)){if(r instanceof _&&ct(r.zone)===!1||r instanceof z)return ft(i,r,u)}else if(r instanceof _&&ct(r.zone)&&(i instanceof _&&ct(i.zone)===!1||i instanceof z))return ft(i,r,u);return G(xt(i),xt(r),u)}if(H(r))throw new v(d.InvalidOperator);if(E(r))return il(i,r,u);if(D(r))throw new v(d.InvalidOperator);if(k(r))throw new v(d.InvalidOperator)}else if(E(i)){if(F(r))return sl(i,r,u);if(M(r))return ul(i,r,u);if(H(r))throw new v(d.InvalidOperator);if(E(r))return G(i.toNumber(),r.toNumber(),u);if(D(r))throw new v(d.InvalidOperator);if(k(r))throw new v(d.InvalidOperator)}else if(D(i)){if(D(r))return G(i.toNumber(),r.toNumber(),u);if(H(r))throw new v(d.InvalidOperator);if(k(r))throw new v(d.InvalidOperator);if(E(r))throw new v(d.InvalidOperator);if(Bt(r))throw new v(d.InvalidOperator)}else if(F(i)){if(Bt(r))return r instanceof _&&ct(r.zone)?ft(i,r,u):G(xt(i),xt(r),u);if(H(r))throw new v(d.InvalidOperator);if(E(r))return ol(i,r,u);if(D(r))throw new v(d.InvalidOperator);if(k(r))throw new v(d.InvalidOperator)}switch(u){case"<>":return i!==r;case"=":return i===r;case">":return i>r;case"<":return i=":return i>=r;case"<=":return i<=r}}function G(i,r,u){switch(u){case"<>":return i!==r;case"=":return i===r;case">":return i>r;case"<":return i=":return i>=r;case"<=":return i<=r}}function nl(i,r,u){const c=parseFloat(r);if(!isNaN(c))return G(i,c,u);const l=i.toString();switch(u){case"<>":return l!==r;case"=":return l===r;case">":return l>r;case"<":return l=":return l>=r;case"<=":return l<=r}}function rl(i,r,u){const c=parseFloat(i);if(!isNaN(c))return G(c,r,u);const l=r.toString();switch(u){case"<>":return i!==l;case"=":return i===l;case">":return i>l;case"<":return i=":return i>=l;case"<=":return i<=l}}function al(i,r,u){switch(u){case"<>":return i!==r;case"=":return i===r;case">":return i>r;case"<":return i=":return i>=r;case"<=":return i<=r}}function il(i,r,u){const c=r.toDateTimeLuxon(i.zone);return G((i=i.startOf("day")).toMillis(),c.toMillis(),u)}function ol(i,r,u){const c=r.toDateTimeLuxon(i.toDateTime().zone);return G((i=i.startOfDay()).toMilliseconds(),c.toMillis(),u)}function ul(i,r,u){const c=i.toDateTimeLuxon(r.zone);return r=r.startOf("day"),G(c.toMillis(),r.toMillis(),u)}function sl(i,r,u){const c=i.toDateTimeLuxon(r.toDateTime().zone);return r=r.startOfDay(),G(c.toMillis(),r.toMilliseconds(),u)}function ft(i,r,u){i instanceof z&&(i=i.toDateTime()),r instanceof z&&(r=r.toDateTime());const c=an(i),l=an(r);switch(u){case"<>":return c!==l;case"=":return c===l;case">":return c>l;case"<":return c=":return c>=l;case"<=":return c<=l}}function an(i){return i.year*Ws+i.month*Gs+i.day*Ks+i.hour*Xs+i.minute*tl+1e3*i.second+i.millisecond}function ne(i,r,u){const c=In[i.toLowerCase()];if(c==null)throw new v(d.FunctionNotRecognized);if(r.lengthc.maxParams)throw new v(d.InvalidParameterCount,{name:i.toUpperCase()});return c.evaluate(r,u)}function ll(i,r){const u=In[i.toLowerCase()];return u!=null&&r>=u.minParams&&r<=u.maxParams}function Mt(i){return typeof i=="string"||i instanceof String}function Qt(i){return!Y(i)&&!E(i)&&!M(i)&&!D(i)&&!F(i)}function wn(i){return E(i)||D(i)?i.toString():F(i)?i.toSQLValue():M(i)?i.millisecond===0?i.toFormat("yyyy-LL-dd HH:mm:ss"):i.toSQL({includeOffset:!1}):Y(i)?wn(_.fromJSDate(i)):i.toString()}function cl(i){if(Y(i))return q.fromDateJS(i);if(M(i))return q.fromParts(i.year,i.month,i.day);if(E(i))return i;if(D(i))throw new v(d.CannotCastValue);if(F(i)&&q.fromParts(i.year,i.month,i.day)===null)throw new v(d.CannotCastValue);if(Mt(i)){const r=q.fromReader(i);if(r!==null&&r.isValid)return r}throw new v(d.CannotCastValue)}function fl(i,r,u){if(Y(i))return bt(i,r);if(M(i))return i;if(E(i))return i.toDateTimeLuxon("unknown");if(D(i))throw new v(d.CannotCastValue);if(F(i))return i;if(Mt(i))return At(i,"unknown",u);throw new v(d.CannotCastValue)}function dl(i){if(Y(i))return Q.fromDateJS(i);if(M(i))return Q.fromDateTime(i);if(E(i))throw new v(d.CannotCastValue);if(D(i))return i;if(F(i))return Q.fromSqlTimeStampOffset(i);if(Mt(i))return ee(i);throw new v(d.CannotCastValue)}const In={extract:{minParams:2,maxParams:2,evaluate:([i,r])=>{if(r==null)return null;if(Y(r))switch(i.toUpperCase()){case"SECOND":return r.getSeconds();case"MINUTE":return r.getMinutes();case"HOUR":return r.getHours();case"DAY":return r.getDate();case"MONTH":return r.getMonth()+1;case"YEAR":return r.getFullYear();case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":return 0}else if(M(r))switch(i.toUpperCase()){case"SECOND":return r.second;case"MINUTE":return r.minute;case"HOUR":return r.hour;case"DAY":return r.day;case"MONTH":return r.month;case"YEAR":return r.year;case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":throw new v(d.InvalidFunctionParameters,{function:"EXTRACT"})}else if(E(r))switch(i.toUpperCase()){case"DAY":return r.day;case"MONTH":return r.month;case"YEAR":return r.year;case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":throw new v(d.InvalidFunctionParameters,{function:"EXTRACT"})}else if(D(r))switch(i.toUpperCase()){case"SECOND":return r.second;case"MINUTE":return r.minute;case"HOUR":return r.hour}else if(F(r))switch(i.toUpperCase()){case"SECOND":return r.second;case"MINUTE":return r.minute;case"HOUR":return r.hour;case"DAY":return r.day;case"MONTH":return r.month;case"YEAR":return r.year;case"TIMEZONE_HOUR":return r.timezoneOffsetHour;case"TIMEZONE_MINUTE":return r.timezoneOffsetMinutes}throw new v(d.InvalidFunctionParameters,{function:"EXTRACT"})}},substring:{minParams:2,maxParams:3,evaluate:i=>{if(i.length===2){const[r,u]=i;return r==null||u==null?null:r.toString().substring(u-1)}if(i.length===3){const[r,u,c]=i;return r==null||u==null||c==null?null:c<=0?"":r.toString().substring(u-1,u+c-1)}}},position:{minParams:2,maxParams:2,evaluate:([i,r])=>i==null||r==null?null:r.indexOf(i)+1},trim:{minParams:2,maxParams:3,evaluate:i=>{const r=i.length===3,u=r?i[1]:" ",c=r?i[2]:i[1];if(u==null||c==null)return null;const l=`(${_s(u)})`;switch(i[0]){case"BOTH":return c.replaceAll(new RegExp(`^${l}*|${l}*$`,"g"),"");case"LEADING":return c.replaceAll(new RegExp(`^${l}*`,"g"),"");case"TRAILING":return c.replaceAll(new RegExp(`${l}*$`,"g"),"")}throw new v(d.InvalidFunctionParameters,{function:"TRIM"})}},abs:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.abs(i[0])},ceiling:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.ceil(i[0])},floor:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.floor(i[0])},log:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.log(i[0])},log10:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.log(i[0])*Math.LOG10E},sin:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.sin(i[0])},cos:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.cos(i[0])},tan:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.tan(i[0])},asin:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.asin(i[0])},acos:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.acos(i[0])},atan:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.atan(i[0])},sign:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:i[0]>0?1:i[1]<0?-1:0},power:{minParams:2,maxParams:2,evaluate:i=>i[0]==null||i[1]==null?null:i[0]**i[1]},mod:{minParams:2,maxParams:2,evaluate:i=>i[0]==null||i[1]==null?null:i[0]%i[1]},round:{minParams:1,maxParams:2,evaluate:i=>{const r=i[0],u=i.length===2?10**i[1]:1;return r==null?null:Math.round(r*u)/u}},truncate:{minParams:1,maxParams:2,evaluate:i=>i[0]==null?null:i.length===1?parseInt(i[0].toFixed(0),10):parseFloat(i[0].toFixed(i[1]))},char_length:{minParams:1,maxParams:1,evaluate:i=>Mt(i[0])?i[0].length:0},concat:{minParams:1,maxParams:1/0,evaluate:i=>{let r="";for(let u=0;ui[0]==null?null:i[0].toString().toLowerCase()},upper:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:i[0].toString().toUpperCase()},coalesce:{minParams:1,maxParams:1/0,evaluate:i=>{for(const r of i)if(r!==null)return r;return null}},cosh:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.cosh(i[0])},sinh:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.sinh(i[0])},tanh:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.tanh(i[0])},nullif:{minParams:2,maxParams:2,evaluate:(i,r)=>B(i[0],i[1],"=")?null:i[0]},cast:{minParams:2,maxParams:2,evaluate:(i,r)=>{const u=i[0],c=i[1];if(u===null)return null;switch(c.type){case"integer":{if(!Qt(u))throw new v(d.CannotCastValue);const l=parseInt(u,10);if(isNaN(l))throw new v(d.CannotCastValue);return l}case"smallint":{if(!Qt(u))throw new v(d.CannotCastValue);const l=parseInt(u,10);if(isNaN(l))throw new v(d.CannotCastValue);if(l>32767||l<-32767)throw new v(d.CannotCastValue);return l}case"float":case"real":{if(!Qt(u))throw new v(d.CannotCastValue);const l=parseFloat(u);if(isNaN(l))throw new v(d.CannotCastValue);return l}case"time":return dl(u);case"date":return cl(u);case"timestamp":return fl(u,r,c.withtimezone===!0);case"varchar":{const l=wn(u);if(l.length>c.size)throw new v(d.CannotCastValue);return l}default:throw new v(d.InvalidDataType)}}}};function gn(i,r,u,c){if(i==="||")return ne("concat",[r,u],c);if(r===null||u===null)return null;if(k(r)){if(k(u))return re(r,u,i);if(et(u))return yl(r,u,i);if(D(u))return El();if(E(u))return Fl();if(F(u))return Ml();if(M(u))return bl();if(H(u))return $l(r,u,i);throw new v(d.InvalidOperator)}if(E(r)){if(k(u))return xl(r,u,i);if(et(u))return Tl(r,u,i);if(D(u))return Jl();if(E(u))return Vl(r,u,i);if(F(u))return Ul(r,u,i);if(M(u))return Rl(r,u,i);if(H(u))return Xl();throw new v(d.InvalidOperator)}if(D(r)){if(k(u))return Cl(r,u,i);if(et(u))return hl(r,u,i);if(D(u))return Bl();if(E(u))return jl();if(F(u))return Yl();if(M(u))return ql();if(H(u))return tc();throw new v(d.InvalidOperator)}if(et(r)){if(k(u))return gl(r,u,i);if(et(u))return Il(r,u,i);if(D(u))return vl(r,u,i);if(E(u))return ml(r,u,i);if(F(u))return wl(r,u,i);if(M(u))return pl(r,u,i);if(H(u))return Ll();throw new v(d.InvalidOperator)}if(M(r)){if(k(u))return Ol(r,u,i);if(et(u))return Nl(r,u,i);if(D(u))return Kl();if(E(u))return Wl(r,u,i);if(F(u))return Gl(r,u,i);if(M(u))return Ql(r,u,i);if(H(u))return ec();throw new v(d.InvalidOperator)}if(F(r)){if(k(u))return Al(r,u,i);if(et(u))return Sl(r,u,i);if(D(u))return zl();if(E(u))return Zl(r,u,i);if(F(u))return Hl(r,u,i);if(M(u))return kl(r,u,i);if(H(u))return nc();throw new v(d.InvalidOperator)}if(H(r)){if(k(u))return Dl(r,u,i);if(et(u))return _l();if(D(u))return rc();if(E(u))return ac();if(F(u))return oc();if(M(u))return ic();if(H(u))return Pl(r,u,i);throw new v(d.InvalidOperator)}throw new v(d.InvalidOperator)}function re(i,r,u){switch(u){case"+":return i+r;case"-":return i-r;case"*":return i*r;case"/":return i/r}throw new v(d.InvalidOperator)}function pl(i,r,u){switch(u){case"+":return r.plus({milliseconds:i.valueInMilliseconds()});case"-":return i.valueInMilliseconds()-r.toMillis()}throw new v(d.InvalidOperator)}function vl(i,r,u){if(u==="+")return r.plus("milliseconds",i.valueInMilliseconds());throw new v(d.InvalidOperator)}function ml(i,r,u){if(u==="+")return r.plus("milliseconds",i.valueInMilliseconds());throw new v(d.InvalidOperator)}function hl(i,r,u){switch(u){case"+":return i.plus("milliseconds",r.valueInMilliseconds());case"-":return i.plus("milliseconds",-1*r.valueInMilliseconds())}throw new v(d.InvalidOperator)}function wl(i,r,u){if(u==="+")return r.addMilliseconds(i.valueInMilliseconds());throw new v(d.InvalidOperator)}function Il(i,r,u){switch(u){case"+":return b.createFromMilliseconds(i.valueInMilliseconds()+r.valueInMilliseconds());case"-":return b.createFromMilliseconds(i.valueInMilliseconds()-r.valueInMilliseconds());case"*":return b.createFromMilliseconds(i.valueInMilliseconds()*r.valueInMilliseconds());case"/":return b.createFromMilliseconds(i.valueInMilliseconds()/r.valueInMilliseconds())}throw new v(d.InvalidOperator)}function gl(i,r,u){switch(u){case"+":return b.createFromMilliseconds(i.valueInMilliseconds()+r);case"-":return b.createFromMilliseconds(i.valueInMilliseconds()-r);case"*":return b.createFromMilliseconds(i.valueInMilliseconds()*r);case"/":return b.createFromMilliseconds(i.valueInMilliseconds()/r)}throw new v(d.InvalidOperator)}function yl(i,r,u){switch(u){case"+":return b.createFromMilliseconds(i+r.valueInMilliseconds());case"-":return b.createFromMilliseconds(i-r.valueInMilliseconds());case"*":return b.createFromMilliseconds(i*r.valueInMilliseconds());case"/":return b.createFromMilliseconds(i/r.valueInMilliseconds())}throw new v(d.InvalidOperator)}function Tl(i,r,u){switch(u){case"+":return i.plus("milliseconds",r.valueInMilliseconds());case"-":return i.plus("milliseconds",-1*r.valueInMilliseconds())}throw new v(d.InvalidOperator)}function Nl(i,r,u){switch(u){case"+":return i.plus({milliseconds:r.valueInMilliseconds()});case"-":return i.minus({milliseconds:r.valueInMilliseconds()})}throw new v(d.InvalidOperator)}function Sl(i,r,u){switch(u){case"+":return i.addMilliseconds(r.valueInMilliseconds());case"-":return i.addMilliseconds(-1*r.valueInMilliseconds())}throw new v(d.InvalidOperator)}function Ol(i,r,u){const c=1e3*r*24*60*60;switch(u){case"+":return i.plus({milliseconds:c});case"-":return i.minus({milliseconds:c})}throw new v(d.InvalidOperator)}function xl(i,r,u){const c=1e3*r*24*60*60;switch(u){case"+":return i.plus("milliseconds",c);case"-":return i.plus("milliseconds",-1*c)}throw new v(d.InvalidOperator)}function Cl(i,r,u){const c=1e3*r*24*60*60;switch(u){case"+":return i.plus("milliseconds",c);case"-":return i.plus("milliseconds",-1*c)}throw new v(d.InvalidOperator)}function bl(i,r,u){throw new v(d.InvalidOperator)}function Al(i,r,u){const c=1e3*r*24*60*60;switch(u){case"+":return i.addMilliseconds(c);case"-":return i.addMilliseconds(-1*c)}throw new v(d.InvalidOperator)}function Ml(i,r,u){throw new v(d.InvalidOperator)}function El(i,r,u){throw new v(d.InvalidOperator)}function Fl(i,r,u){throw new v(d.InvalidOperator)}function $l(i,r,u){const c=parseFloat(r);if(isNaN(c))throw new v(d.InvalidOperator);return re(i,c,u)}function Dl(i,r,u){const c=parseFloat(i);if(isNaN(c))throw new v(d.InvalidOperator);return re(c,r,u)}function Pl(i,r,u){if(u==="+")return i+r;throw new v(d.InvalidOperator)}function Ll(i,r,u){throw new v(d.InvalidOperator)}function _l(i,r,u){throw new v(d.InvalidOperator)}function Rl(i,r,u){if(u==="-")return i.toDateTimeLuxon(r.zone).diff(r).as("days");throw new v(d.InvalidOperator)}function Ul(i,r,u){if(u==="-")return i.toDateTimeLuxon(r.toDateTime().zone).diff(r.toDateTime()).as("days");throw new v(d.InvalidOperator)}function Vl(i,r,u){if(u==="-")return i.toDateTimeLuxon("UTC").diff(r.toDateTimeLuxon("UTC")).as("days");throw new v(d.InvalidOperator)}function Jl(i,r,u){throw new v(d.InvalidOperator)}function zl(i,r,u){throw new v(d.InvalidOperator)}function Zl(i,r,u){if(u==="-")return i.toDateTime().diff(r.toDateTimeLuxon(i.toDateTime().zone)).as("days");throw new v(d.InvalidOperator)}function kl(i,r,u){if(u==="-")return i.toDateTime().diff(r).as("days");throw new v(d.InvalidOperator)}function Hl(i,r,u){if(u==="-")return i.toDateTime().diff(r.toDateTime()).as("days");throw new v(d.InvalidOperator)}function ql(i,r,u){throw new v(d.InvalidOperator)}function jl(i,r,u){throw new v(d.InvalidOperator)}function Yl(i,r,u){throw new v(d.InvalidOperator)}function Bl(i,r,u){throw new v(d.InvalidOperator)}function Ql(i,r,u){if(u==="-")return i.diff(r).as("days");throw new v(d.InvalidOperator)}function Wl(i,r,u){if(u==="-")return i.diff(r.toDateTimeLuxon(i.zone)).as("days");throw new v(d.InvalidOperator)}function Gl(i,r,u){if(u==="-")return i.diff(r.toDateTime()).as("days");throw new v(d.InvalidOperator)}function Kl(i,r,u){throw new v(d.InvalidOperator)}function Xl(i,r,u){throw new v(d.InvalidOperator)}function tc(i,r,u){throw new v(d.InvalidOperator)}function ec(i,r,u){throw new v(d.InvalidOperator)}function nc(i,r,u){throw new v(d.InvalidOperator)}function rc(i,r,u){throw new v(d.InvalidOperator)}function ac(i,r,u){throw new v(d.InvalidOperator)}function ic(i,r,u){throw new v(d.InvalidOperator)}function oc(i,r,u){throw new v(d.InvalidOperator)}var on,un,Wt={exports:{}};Wt.exports,un=function(){function i(l,h){function I(){this.constructor=l}I.prototype=h.prototype,l.prototype=new I}function r(l,h,I,e){var T=Error.call(this,l);return Object.setPrototypeOf&&Object.setPrototypeOf(T,r.prototype),T.expected=h,T.found=I,T.location=e,T.name="SyntaxError",T}function u(l,h,I){return I=I||" ",l.length>h?l:(h-=l.length,l+(I+=I.repeat(h)).slice(0,h))}function c(l,h){var I,e={},T=(h=h!==void 0?h:{}).grammarSource,O={start:Te},L=Te,U="!",Z="=",C=">=",A=">",j="<=",R="<>",xn="<",ae="!=",Et="+",Ft="-",ie="||",Cn="*",bn="/",An="@",oe="'",ue="N'",dt="''",Mn=".",En="null",Fn="true",$n="false",Dn="in",Pn="is",Ln="like",_n="escape",Rn="not",Un="and",Vn="or",Jn="between",zn="from",Zn="for",kn="substring",Hn="extract",qn="trim",jn="position",Yn="timestamp",Bn="date",Qn="time",Wn="leading",Gn="trailing",Kn="both",Xn="cast",tr="as",er="integer",nr="smallint",rr="float",ar="real",ir="varchar",or="to",ur="interval",sr="year",lr="timezone_hour",cr="timezone_minute",fr="month",dr="day",pr="hour",vr="minute",mr="second",hr="case",wr="end",Ir="when",gr="then",yr="else",Tr=",",Nr="(",Sr=")",se="`",Or=/^[A-Za-z_\x80-\uFFFF]/,xr=/^[A-Za-z0-9_]/,le=/^[A-Za-z0-9_.\x80-\uFFFF]/,Cr=/^["]/,ce=/^[^']/,br=/^[0-9]/,Ar=/^[eE]/,Mr=/^[+\-]/,Er=/^[ \t\n\r]/,fe=/^[^`]/,Fr=y("!",!1),de=y("=",!1),$r=y(">=",!1),Dr=y(">",!1),Pr=y("<=",!1),Lr=y("<>",!1),_r=y("<",!1),Rr=y("!=",!1),$t=y("+",!1),Dt=y("-",!1),Ur=y("||",!1),Vr=y("*",!1),Jr=y("/",!1),zr=X([["A","Z"],["a","z"],"_",["€","￿"]],!1,!1),Zr=X([["A","Z"],["a","z"],["0","9"],"_"],!1,!1),pe=X([["A","Z"],["a","z"],["0","9"],"_",".",["€","￿"]],!1,!1),kr=X(['"'],!1,!1),Hr=y("@",!1),ve=y("'",!1),qr=y("N'",!1),me=y("''",!1),he=X(["'"],!0,!1),jr=y(".",!1),Yr=X([["0","9"]],!1,!1),Br=X(["e","E"],!1,!1),Qr=X(["+","-"],!1,!1),Wr=y("NULL",!0),Gr=y("TRUE",!0),Kr=y("FALSE",!0),Xr=y("IN",!0),ta=y("IS",!0),ea=y("LIKE",!0),na=y("ESCAPE",!0),ra=y("NOT",!0),aa=y("AND",!0),ia=y("OR",!0),oa=y("BETWEEN",!0),ua=y("FROM",!0),sa=y("FOR",!0),la=y("SUBSTRING",!0),ca=y("EXTRACT",!0),fa=y("TRIM",!0),da=y("POSITION",!0),pa=y("TIMESTAMP",!0),va=y("DATE",!0),ma=y("TIME",!0),ha=y("LEADING",!0),wa=y("TRAILING",!0),Ia=y("BOTH",!0),ga=y("CAST",!0),ya=y("AS",!0),Ta=y("INTEGER",!0),Na=y("SMALLINT",!0),Sa=y("FLOAT",!0),Oa=y("REAL",!0),xa=y("VARCHAR",!0),Ca=y("TO",!0),ba=y("INTERVAL",!0),Aa=y("YEAR",!0),Ma=y("TIMEZONE_HOUR",!0),Ea=y("TIMEZONE_MINUTE",!0),Fa=y("MONTH",!0),$a=y("DAY",!0),Da=y("HOUR",!0),Pa=y("MINUTE",!0),La=y("SECOND",!0),_a=y("CASE",!0),Ra=y("END",!0),Ua=y("WHEN",!0),Va=y("THEN",!0),Ja=y("ELSE",!0),za=y(",",!1),Za=y("(",!1),ka=y(")",!1),Ha=X([" "," ",` -`,"\r"],!1,!1),we=y("`",!1),Ie=X(["`"],!0,!1),qa=function(t){return t},ja=function(t,a){var o={type:"expression-list"},s=Es(t,a);return o.value=s,o},Ya=function(t,a){return lt(t,a)},Ba=function(t,a){return lt(t,a)},Qa=function(t){return As("NOT",t)},Wa=function(t,a){return a==""||a==null||a==null?t:a.type=="arithmetic"?lt(t,a.tail):Xe(a.op,t,a.right,a.escape)},Ga=function(t){return{type:"arithmetic",tail:t}},Ka=function(t,a){return{op:t+"NOT",right:a}},Xa=function(t,a){return{op:t,right:a}},ti=function(t,a,o){return{op:"NOT"+t,right:{type:"expression-list",value:[a,o]}}},ei=function(t,a,o){return{op:t,right:{type:"expression-list",value:[a,o]}}},ni=function(t){return t[0]+" "+t[2]},ri=function(t){return t[0]+" "+t[2]},ai=function(t,a,o){return{op:t,right:a,escape:o.value}},ii=function(t,a){return{op:t,right:a,escape:""}},oi=function(t,a){return{op:t,right:a}},ui=function(t){return{op:t,right:{type:"expression-list",value:[]}}},si=function(t,a){return{op:t,right:a}},li=function(t,a){return lt(t,a)},ci=function(t,a){return lt(t,a)},fi=function(t){return t.paren=!0,t},di=function(t){return/^CURRENT_DATE$/i.test(t)?{type:"current-time",mode:"date"}:/^CURRENT_TIMESTAMP$/i.test(t)?{type:"current-time",mode:"timestamp"}:{type:"column-reference",table:"",column:t}},pi=function(t){return{type:"column-reference",table:"",column:t,delimited:!0}},vi=function(t){return t},mi=function(t,a){return t+a.join("")},hi=function(t,a){return t+a.join("")},wi=function(t){return t},Ii=function(t){return t.join("")},gi=function(){return'"'},yi=function(t){return{type:"parameter",value:t[1]}},Ti=function(t,a){return{type:"function",name:"extract",args:{type:"expression-list",value:[{type:"string",value:t},a]}}},Ni=function(t,a,o){return{type:"function",name:"substring",args:{type:"expression-list",value:o?[t,a,o[2]]:[t,a]}}},Si=function(t,a){return{type:"function",name:"cast",args:{type:"expression-list",value:[t,a]}}},Oi=function(){return{type:"data-type",value:{type:"integer"}}},xi=function(){return{type:"data-type",value:{type:"smallint"}}},Ci=function(){return{type:"data-type",value:{type:"float"}}},bi=function(){return{type:"data-type",value:{type:"real"}}},Ai=function(){return{type:"data-type",value:{type:"date"}}},Mi=function(){return{type:"data-type",value:{type:"timestamp"}}},Ei=function(){return{type:"data-type",value:{type:"time"}}},Fi=function(t){return{type:"data-type",value:{type:"varchar",size:parseInt(t)}}},$i=function(t,a,o){return{type:"function",name:"trim",args:{type:"expression-list",value:[{type:"string",value:t??"BOTH"},a,o]}}},Di=function(t,a){return{type:"function",name:"trim",args:{type:"expression-list",value:[{type:"string",value:t??"BOTH"},a]}}},Pi=function(t,a){return{type:"function",name:"position",args:{type:"expression-list",value:[t,a]}}},Li=function(t,a){return{type:"function",name:t,args:a||{type:"expression-list",value:[]}}},_i=function(t){return t.type==="string"&&Fs(t.value),{type:"timestamp",value:t.value}},Ri=function(t){return t.type==="string"&&$s(t.value),{type:"time",value:t.value}},Ui=function(t,a,o){return{type:"interval",value:a,qualifier:o,op:t}},Vi=function(t,a){return{type:"interval",value:t,qualifier:a,op:""}},Ji=function(t,a){return{type:"interval-qualifier",start:t,end:a}},zi=function(t,a){return{type:"interval-period",period:t.value,precision:a,secondary:null}},Zi=function(t){return{type:"interval-period",period:t.value,precision:null,secondary:null}},ki=function(t){return{type:"interval-period",period:t.value,precision:null,secondary:null}},Hi=function(t,a){return{type:"interval-period",period:"second",precision:t,secondary:a}},qi=function(t){return{type:"interval-period",period:"second",precision:t,secondary:null}},ji=function(){return{type:"interval-period",period:"second",precision:null,secondary:null}},Yi=function(t,a){return{type:"interval-period",period:t.value,precision:a,secondary:null}},Bi=function(t){return{type:"interval-period",period:t.value,precision:null,secondary:null}},Qi=function(t,a){return{type:"interval-period",period:"second",precision:t,secondary:a}},Wi=function(t){return{type:"interval-period",period:"second",precision:t,secondary:null}},Gi=function(){return{type:"interval-period",period:"second",precision:null,secondary:null}},Ki=function(){return{type:"string",value:"day"}},Xi=function(){return{type:"string",value:"hour"}},to=function(){return{type:"string",value:"minute"}},eo=function(){return{type:"string",value:"month"}},no=function(){return{type:"string",value:"year"}},ro=function(t){return parseFloat(t)},ao=function(t){return parseFloat(t)},io=function(t){return t.type==="string"&&Ds(t.value),{type:"date",value:t.value}},oo=function(){return{type:"null",value:null}},uo=function(){return{type:"boolean",value:!0}},so=function(){return{type:"boolean",value:!1}},ge=function(){return"'"},lo=function(t){return{type:"string",value:t.join("")}},co=function(t,a){return{type:"case-expression",format:"simple",operand:t,clauses:a,else:null}},fo=function(t,a,o){return{type:"case-expression",format:"simple",operand:t,clauses:a,else:o.value}},po=function(t){return{type:"case-expression",format:"searched",clauses:t,else:null}},vo=function(t,a){return{type:"case-expression",format:"searched",clauses:t,else:a.value}},mo=function(t,a){return{type:"when-clause",operand:t,value:a}},ho=function(t,a){return{type:"when-clause",operand:t,value:a}},wo=function(t){return{type:"else-clause",value:t}},Io=function(t){return{type:"number",value:t}},go=function(t,a,o){return parseFloat(t+a+o)},yo=function(t,a){return parseFloat(t+a)},To=function(t,a){return parseFloat(t+a)},No=function(t){return parseFloat(t)},So=function(t,a){return t[0]+a},Oo=function(t){return"."+(t??"")},xo=function(t,a){return t+a},Co=function(t){return t.join("")},bo=function(t,a){return"e"+(a===null?"":a)},Ao=function(){return"IN"},Mo=function(){return"IS"},Eo=function(){return"LIKE"},Fo=function(){return"ESCAPE"},$o=function(){return"NOT"},Do=function(){return"AND"},Po=function(){return"OR"},Lo=function(){return"BETWEEN"},_o=function(){return"FROM"},Ro=function(){return"FOR"},Uo=function(){return"SUBSTRING"},Vo=function(){return"EXTRACT"},Jo=function(){return"TRIM"},zo=function(){return"POSITION"},Zo=function(){return"TIMESTAMP"},ko=function(){return"DATE"},Ho=function(){return"TIME"},qo=function(){return"LEADING"},jo=function(){return"TRAILING"},Yo=function(){return"BOTH"},Bo=function(){return"CAST"},Qo=function(){return"AS"},Wo=function(){return"INTEGER"},Go=function(){return"SMALLINT"},Ko=function(){return"FLOAT"},Xo=function(){return"REAL"},tu=function(){return"VARCHAR"},eu=function(){return"TO"},nu=function(){return"INTERVAL"},ru=function(){return"YEAR"},au=function(){return"TIMEZONE_HOUR"},iu=function(){return"TIMEZONE_MINUTE"},ou=function(){return"MONTH"},uu=function(){return"DAY"},su=function(){return"HOUR"},lu=function(){return"MINUTE"},cu=function(){return"SECOND"},fu=function(){return"CASE"},du=function(){return"END"},pu=function(){return"WHEN"},vu=function(){return"THEN"},mu=function(){return"ELSE"},hu=function(t){return t},wu=function(t){return t.join("")},n=0,m=0,pt=[{line:1,column:1}],K=0,Pt=[],f=0;if("startRule"in h){if(!(h.startRule in O))throw new Error(`Can't start parsing from rule "`+h.startRule+'".');L=O[h.startRule]}function Lt(t,a){throw gu(t,a=a!==void 0?a:_t(m,n))}function y(t,a){return{type:"literal",text:t,ignoreCase:a}}function X(t,a,o){return{type:"class",parts:t,inverted:a,ignoreCase:o}}function Iu(){return{type:"end"}}function ye(t){var a,o=pt[t];if(o)return o;for(a=t-1;!pt[a];)a--;for(o={line:(o=pt[a]).line,column:o.column};aK&&(K=n,Pt=[]),Pt.push(t))}function gu(t,a){return new r(t,null,null,a)}function yu(t,a,o){return new r(r.buildMessage(t,a),t,a,o)}function Te(){var t,a;return t=n,p(),(a=P())!==e?(p(),m=t,t=qa(a)):(n=t,t=e),t}function Ne(){var t,a,o,s,g,S,x,$;if(t=n,(a=P())!==e){for(o=[],s=n,g=p(),(S=Ot())!==e?(x=p(),($=P())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);s!==e;)o.push(s),s=n,g=p(),(S=Ot())!==e?(x=p(),($=P())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);m=t,t=ja(a,o)}else n=t,t=e;return t}function P(){var t,a,o,s,g,S,x,$;if(t=n,(a=Rt())!==e){for(o=[],s=n,g=p(),(S=Ue())!==e?(x=p(),($=Rt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);s!==e;)o.push(s),s=n,g=p(),(S=Ue())!==e?(x=p(),($=Rt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);m=t,t=Ya(a,o)}else n=t,t=e;return t}function Rt(){var t,a,o,s,g,S,x,$;if(t=n,(a=vt())!==e){for(o=[],s=n,g=p(),(S=Tt())!==e?(x=p(),($=vt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);s!==e;)o.push(s),s=n,g=p(),(S=Tt())!==e?(x=p(),($=vt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);m=t,t=Ba(a,o)}else n=t,t=e;return t}function vt(){var t,a,o,s,g;return t=n,(a=st())===e&&(a=n,l.charCodeAt(n)===33?(o=U,n++):(o=e,f===0&&w(Fr)),o!==e?(s=n,f++,l.charCodeAt(n)===61?(g=Z,n++):(g=e,f===0&&w(de)),f--,g===e?s=void 0:(n=s,s=e),s!==e?a=o=[o,s]:(n=a,a=e)):(n=a,a=e)),a!==e?(o=p(),(s=vt())!==e?(m=t,t=Qa(s)):(n=t,t=e)):(n=t,t=e),t===e&&(t=Tu()),t}function Tu(){var t,a,o;return t=n,(a=tt())!==e?(p(),(o=Nu())===e&&(o=null),m=t,t=Wa(a,o)):(n=t,t=e),t}function Nu(){var t;return(t=Su())===e&&(t=bu())===e&&(t=xu())===e&&(t=Ou())===e&&(t=Cu()),t}function Su(){var t,a,o,s,g,S,x;if(t=n,a=[],o=n,s=p(),(g=Se())!==e?(S=p(),(x=tt())!==e?o=s=[s,g,S,x]:(n=o,o=e)):(n=o,o=e),o!==e)for(;o!==e;)a.push(o),o=n,s=p(),(g=Se())!==e?(S=p(),(x=tt())!==e?o=s=[s,g,S,x]:(n=o,o=e)):(n=o,o=e);else a=e;return a!==e&&(m=t,a=Ga(a)),t=a}function Se(){var t;return l.substr(n,2)===C?(t=C,n+=2):(t=e,f===0&&w($r)),t===e&&(l.charCodeAt(n)===62?(t=A,n++):(t=e,f===0&&w(Dr)),t===e&&(l.substr(n,2)===j?(t=j,n+=2):(t=e,f===0&&w(Pr)),t===e&&(l.substr(n,2)===R?(t=R,n+=2):(t=e,f===0&&w(Lr)),t===e&&(l.charCodeAt(n)===60?(t=xn,n++):(t=e,f===0&&w(_r)),t===e&&(l.charCodeAt(n)===61?(t=Z,n++):(t=e,f===0&&w(de)),t===e&&(l.substr(n,2)===ae?(t=ae,n+=2):(t=e,f===0&&w(Rr)))))))),t}function Ou(){var t,a,o,s;return t=n,(a=_e())!==e?(p(),(o=st())!==e?(p(),(s=tt())!==e?(m=t,t=Ka(a,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=_e())!==e?(p(),(o=tt())!==e?(m=t,t=Xa(a,o)):(n=t,t=e)):(n=t,t=e)),t}function xu(){var t,a,o,s,g,S;return t=n,(a=st())!==e?(p(),(o=Ve())!==e?(p(),(s=tt())!==e?(p(),(g=Tt())!==e?(p(),(S=tt())!==e?(m=t,t=ti(o,s,S)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=Ve())!==e?(p(),(o=tt())!==e?(p(),(s=Tt())!==e?(p(),(g=tt())!==e?(m=t,t=ei(a,o,g)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)),t}function Oe(){var t,a,o,s,g;return t=n,a=n,(o=st())!==e?(s=p(),(g=Re())!==e?a=o=[o,s,g]:(n=a,a=e)):(n=a,a=e),a!==e&&(m=t,a=ni(a)),(t=a)===e&&(t=Re()),t}function Ut(){var t,a,o,s,g;return t=n,a=n,(o=st())!==e?(s=p(),(g=Ht())!==e?a=o=[o,s,g]:(n=a,a=e)):(n=a,a=e),a!==e&&(m=t,a=ri(a)),(t=a)===e&&(t=Ht()),t}function Cu(){var t,a,o,s;return t=n,(a=Oe())!==e?(p(),(o=nt())!==e?(p(),ss()!==e?(p(),(s=kt())!==e?(m=t,t=ai(a,o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=Oe())!==e?(p(),(o=nt())!==e?(m=t,t=ii(a,o)):(n=t,t=e)):(n=t,t=e)),t}function bu(){var t,a,o,s;return t=n,(a=Ut())!==e?(p(),(o=V())!==e?(p(),(s=Ne())!==e?(p(),J()!==e?(m=t,t=oi(a,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=Ut())!==e?(p(),(o=V())!==e?(p(),(s=J())!==e?(m=t,t=ui(a)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=Ut())!==e?(p(),(o=Zt())!==e?(m=t,t=si(a,o)):(n=t,t=e)):(n=t,t=e))),t}function tt(){var t,a,o,s,g,S,x,$;if(t=n,(a=Vt())!==e){for(o=[],s=n,g=p(),(S=xe())!==e?(x=p(),($=Vt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);s!==e;)o.push(s),s=n,g=p(),(S=xe())!==e?(x=p(),($=Vt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);m=t,t=li(a,o)}else n=t,t=e;return t}function xe(){var t;return l.charCodeAt(n)===43?(t=Et,n++):(t=e,f===0&&w($t)),t===e&&(l.charCodeAt(n)===45?(t=Ft,n++):(t=e,f===0&&w(Dt)),t===e&&(l.substr(n,2)===ie?(t=ie,n+=2):(t=e,f===0&&w(Ur)))),t}function Vt(){var t,a,o,s,g,S,x,$;if(t=n,(a=Jt())!==e){for(o=[],s=n,g=p(),(S=Ce())!==e?(x=p(),($=Jt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);s!==e;)o.push(s),s=n,g=p(),(S=Ce())!==e?(x=p(),($=Jt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);m=t,t=ci(a,o)}else n=t,t=e;return t}function Ce(){var t;return l.charCodeAt(n)===42?(t=Cn,n++):(t=e,f===0&&w(Vr)),t===e&&(l.charCodeAt(n)===47?(t=bn,n++):(t=e,f===0&&w(Jr))),t}function Jt(){var t,a;return(t=ku())===e&&(t=Lu())===e&&(t=_u())===e&&(t=Vu())===e&&(t=Ju())===e&&(t=Ru())===e&&(t=zu())===e&&(t=Xu())===e&&(t=Au())===e&&(t=Zt())===e&&(t=n,V()!==e?(p(),(a=P())!==e?(p(),J()!==e?(m=t,t=fi(a)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)),t}function Au(){var t,a;return t=n,(a=Mu())!==e&&(m=t,a=di(a)),(t=a)===e&&(t=n,(a=Fu())!==e&&(m=t,a=pi(a)),t=a),t}function Mu(){var t,a;return t=n,(a=Eu())!==e&&(m=t,a=vi(a)),t=a}function Eu(){var t,a,o,s;if(t=n,(a=zt())!==e){for(o=[],s=Ae();s!==e;)o.push(s),s=Ae();m=t,t=mi(a,o)}else n=t,t=e;return t}function be(){var t,a,o,s;if(t=n,(a=zt())!==e){for(o=[],s=N();s!==e;)o.push(s),s=N();m=t,t=hi(a,o)}else n=t,t=e;return t}function zt(){var t;return Or.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(zr)),t}function N(){var t;return xr.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(Zr)),t}function Ae(){var t;return le.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(pe)),t}function Fu(){var t,a;return t=n,mt()!==e?(a=$u(),mt()!==e?(m=t,t=wi(a)):(n=t,t=e)):(n=t,t=e),t}function $u(){var t,a,o;for(t=n,a=[],o=Me();o!==e;)a.push(o),o=Me();return m=t,t=a=Ii(a)}function Me(){var t;return(t=Pu())===e&&(t=Du()),t}function Du(){var t;return t=n,mt()!==e&&mt()!==e?(m=t,t=gi()):(n=t,t=e),t}function Pu(){var t;return le.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(pe)),t}function mt(){var t;return Cr.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(kr)),t}function Zt(){var t,a,o,s;return t=n,a=n,l.charCodeAt(n)===64?(o=An,n++):(o=e,f===0&&w(Hr)),o!==e&&(s=be())!==e?a=o=[o,s]:(n=a,a=e),a!==e&&(m=t,a=yi(a)),t=a}function Lu(){var t,a,o;return t=n,fs()!==e?(p(),V()!==e?(p(),(a=Zu())!==e?(p(),qt()!==e?(p(),(o=P())!==e?(p(),J()!==e?(m=t,t=Ti(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function _u(){var t,a,o,s,g,S,x;return t=n,cs()!==e?(p(),V()!==e?(p(),(a=P())!==e?(p(),qt()!==e?(p(),(o=P())!==e?(p(),s=n,(g=ls())!==e?(S=p(),(x=P())!==e?s=g=[g,S,x,p()]:(n=s,s=e)):(n=s,s=e),s===e&&(s=null),(g=J())!==e?(m=t,t=Ni(a,o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function Ru(){var t,a,o;return t=n,hs()!==e?(p(),V()!==e?(p(),(a=P())!==e?(p(),ws()!==e?(p(),(o=Uu())!==e?(p(),J()!==e?(m=t,t=Si(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function Uu(){var t,a,o;return t=n,(a=Is())!==e&&(m=t,a=Oi()),(t=a)===e&&(t=n,(a=gs())!==e&&(m=t,a=xi()),(t=a)===e&&(t=n,(a=ys())!==e&&(m=t,a=Ci()),(t=a)===e&&(t=n,(a=Ts())!==e&&(m=t,a=bi()),(t=a)===e&&(t=n,(a=Ze())!==e&&(m=t,a=Ai()),(t=a)===e&&(t=n,(a=ze())!==e&&(m=t,a=Mi()),(t=a)===e&&(t=n,(a=ke())!==e&&(m=t,a=Ei()),(t=a)===e&&(t=n,(a=Ns())!==e?(p(),V()!==e?(p(),(o=rt())!==e?(p(),J()!==e?(m=t,t=Fi(o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)))))))),t}function Vu(){var t,a,o,s;return t=n,Je()!==e?(p(),V()!==e?(p(),(a=Ee())===e&&(a=null),p(),(o=P())!==e?(p(),qt()!==e?(p(),(s=P())!==e?(p(),J()!==e?(m=t,t=$i(a,o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,Je()!==e?(p(),V()!==e?(p(),(a=Ee())===e&&(a=null),p(),(o=P())!==e?(p(),J()!==e?(m=t,t=Di(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)),t}function Ee(){var t;return(t=ps())===e&&(t=vs())===e&&(t=ms()),t}function Ju(){var t,a,o;return t=n,ds()!==e?(p(),V()!==e?(p(),(a=P())!==e?(p(),Ht()!==e?(p(),(o=P())!==e?(p(),J()!==e?(m=t,t=Pi(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function zu(){var t,a,o;return t=n,(a=bs())!==e?(p(),V()!==e?(p(),(o=Ne())===e&&(o=null),p(),J()!==e?(m=t,t=Li(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function Zu(){var t;return(t=qe())===e&&(t=je())===e&&(t=Ye())===e&&(t=Be())===e&&(t=Qe())===e&&(t=at())===e&&(t=Os())===e&&(t=xs()),t}function ku(){var t;return(t=kt())===e&&(t=ns())===e&&(t=Ku())===e&&(t=Gu())===e&&(t=Wu())===e&&(t=Hu())===e&&(t=ju())===e&&(t=qu()),t}function Hu(){var t,a;return t=n,ze()!==e?(p(),(a=nt())!==e?(m=t,t=_i(a)):(n=t,t=e)):(n=t,t=e),t}function qu(){var t,a;return t=n,ke()!==e?(p(),(a=nt())!==e?(m=t,t=Ri(a)):(n=t,t=e)):(n=t,t=e),t}function ju(){var t,a,o,s;return t=n,He()!==e?(p(),l.charCodeAt(n)===45?(a=Ft,n++):(a=e,f===0&&w(Dt)),a===e&&(l.charCodeAt(n)===43?(a=Et,n++):(a=e,f===0&&w($t))),a!==e?(p(),(o=nt())!==e?(p(),(s=Fe())!==e?(m=t,t=Ui(a,o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,He()!==e?(p(),(a=nt())!==e?(p(),(o=Fe())!==e?(m=t,t=Vi(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)),t}function Fe(){var t,a,o;return t=n,(a=Yu())!==e?(p(),Ss()!==e?(p(),(o=Bu())!==e?(m=t,t=Ji(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=Qu()),t}function Yu(){var t,a,o;return t=n,(a=ut())!==e?(p(),V()!==e?(p(),(o=wt())!==e?(p(),J()!==e?(m=t,t=zi(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=ut())!==e&&(m=t,a=Zi(a)),t=a),t}function Bu(){var t,a,o,s;return t=n,(a=ut())!==e&&(m=t,a=ki(a)),(t=a)===e&&(t=n,(a=at())!==e?(p(),V()!==e?(p(),(o=wt())!==e?(p(),Ot()!==e?(p(),(s=ht())!==e?(p(),J()!==e?(m=t,t=Hi(o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=at())!==e?(p(),V()!==e?(p(),(o=wt())!==e?(p(),J()!==e?(m=t,t=qi(o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=at())!==e&&(m=t,a=ji()),t=a))),t}function Qu(){var t,a,o,s;return t=n,(a=ut())!==e?(p(),V()!==e?(p(),(o=ht())!==e?(p(),J()!==e?(m=t,t=Yi(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=ut())!==e&&(m=t,a=Bi(a)),(t=a)===e&&(t=n,(a=at())!==e?(p(),V()!==e?(p(),(o=wt())!==e?(p(),Ot()!==e?(p(),(s=ht())!==e?(p(),J()!==e?(m=t,t=Qi(o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=at())!==e?(p(),V()!==e?(p(),(o=ht())!==e?(p(),J()!==e?(m=t,t=Wi(o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=at())!==e&&(m=t,a=Gi()),t=a)))),t}function ut(){var t,a;return t=n,(a=Ye())!==e&&(m=t,a=Ki()),(t=a)===e&&(t=n,(a=Be())!==e&&(m=t,a=Xi()),(t=a)===e&&(t=n,(a=Qe())!==e&&(m=t,a=to()),(t=a)===e&&(t=n,(a=je())!==e&&(m=t,a=eo()),(t=a)===e&&(t=n,(a=qe())!==e&&(m=t,a=no()),t=a)))),t}function ht(){var t,a;return t=n,(a=rt())!==e&&(m=t,a=ro(a)),t=a}function wt(){var t,a;return t=n,(a=rt())!==e&&(m=t,a=ao(a)),t=a}function Wu(){var t,a;return t=n,Ze()!==e?(p(),(a=nt())!==e?(m=t,t=io(a)):(n=t,t=e)):(n=t,t=e),t}function Gu(){var t,a;return t=n,(a=is())!==e&&(m=t,a=oo()),t=a}function Ku(){var t,a;return t=n,(a=os())!==e&&(m=t,a=uo()),(t=a)===e&&(t=n,(a=us())!==e&&(m=t,a=so()),t=a),t}function nt(){var t;return(t=kt())===e&&(t=Zt()),t}function kt(){var t,a,o,s,g;if(t=n,l.charCodeAt(n)===39?(a=oe,n++):(a=e,f===0&&w(ve)),a===e&&(l.substr(n,2)===ue?(a=ue,n+=2):(a=e,f===0&&w(qr))),a!==e){for(o=[],s=n,l.substr(n,2)===dt?(g=dt,n+=2):(g=e,f===0&&w(me)),g!==e&&(m=s,g=ge()),(s=g)===e&&(ce.test(l.charAt(n))?(s=l.charAt(n),n++):(s=e,f===0&&w(he)));s!==e;)o.push(s),s=n,l.substr(n,2)===dt?(g=dt,n+=2):(g=e,f===0&&w(me)),g!==e&&(m=s,g=ge()),(s=g)===e&&(ce.test(l.charAt(n))?(s=l.charAt(n),n++):(s=e,f===0&&w(he)));l.charCodeAt(n)===39?(s=oe,n++):(s=e,f===0&&w(ve)),s!==e?(m=t,t=lo(o)):(n=t,t=e)}else n=t,t=e;return t}function Xu(){var t;return(t=ts())===e&&(t=es()),t}function ts(){var t,a,o,s,g;if(t=n,Nt()!==e)if(p(),(a=P())!==e){for(p(),o=[],s=gt();s!==e;)o.push(s),s=gt();s=p(),(g=St())!==e?(m=t,t=co(a,o)):(n=t,t=e)}else n=t,t=e;else n=t,t=e;if(t===e)if(t=n,Nt()!==e)if(p(),(a=P())!==e){for(p(),o=[],s=gt();s!==e;)o.push(s),s=gt();s=p(),(g=$e())!==e?(p(),St()!==e?(m=t,t=fo(a,o,g)):(n=t,t=e)):(n=t,t=e)}else n=t,t=e;else n=t,t=e;return t}function es(){var t,a,o,s;if(t=n,Nt()!==e){for(p(),a=[],o=It();o!==e;)a.push(o),o=It();o=p(),(s=St())!==e?(m=t,t=po(a)):(n=t,t=e)}else n=t,t=e;if(t===e)if(t=n,Nt()!==e){for(p(),a=[],o=It();o!==e;)a.push(o),o=It();o=p(),(s=$e())!==e?(p(),St()!==e?(m=t,t=vo(a,s)):(n=t,t=e)):(n=t,t=e)}else n=t,t=e;return t}function It(){var t,a,o;return t=n,We()!==e?(p(),(a=P())!==e?(p(),Ge()!==e?(p(),(o=P())!==e?(m=t,t=mo(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function gt(){var t,a,o;return t=n,We()!==e?(p(),(a=P())!==e?(p(),Ge()!==e?(p(),(o=P())!==e?(m=t,t=ho(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function $e(){var t,a;return t=n,Cs()!==e?(p(),(a=P())!==e?(m=t,t=wo(a)):(n=t,t=e)):(n=t,t=e),t}function ns(){var t,a,o,s;return t=n,(a=rs())!==e?(o=n,f++,s=zt(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Io(a)):(n=t,t=e)):(n=t,t=e),t}function rs(){var t,a,o,s;return t=n,(a=yt())!==e&&(o=De())!==e&&(s=Pe())!==e?(m=t,t=go(a,o,s)):(n=t,t=e),t===e&&(t=n,(a=yt())!==e&&(o=De())!==e?(m=t,t=yo(a,o)):(n=t,t=e),t===e&&(t=n,(a=yt())!==e&&(o=Pe())!==e?(m=t,t=To(a,o)):(n=t,t=e),t===e&&(t=n,(a=yt())!==e&&(m=t,a=No(a)),t=a))),t}function yt(){var t,a,o;return(t=rt())===e&&(t=n,l.charCodeAt(n)===45?(a=Ft,n++):(a=e,f===0&&w(Dt)),a===e&&(l.charCodeAt(n)===43?(a=Et,n++):(a=e,f===0&&w($t))),a!==e&&(o=rt())!==e?(m=t,t=So(a,o)):(n=t,t=e)),t}function De(){var t,a,o;return t=n,l.charCodeAt(n)===46?(a=Mn,n++):(a=e,f===0&&w(jr)),a!==e?((o=rt())===e&&(o=null),m=t,t=Oo(o)):(n=t,t=e),t}function Pe(){var t,a,o;return t=n,(a=as())!==e&&(o=rt())!==e?(m=t,t=xo(a,o)):(n=t,t=e),t}function rt(){var t,a,o;if(t=n,a=[],(o=Le())!==e)for(;o!==e;)a.push(o),o=Le();else a=e;return a!==e&&(m=t,a=Co(a)),t=a}function Le(){var t;return br.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(Yr)),t}function as(){var t,a,o;return t=n,Ar.test(l.charAt(n))?(a=l.charAt(n),n++):(a=e,f===0&&w(Br)),a!==e?(Mr.test(l.charAt(n))?(o=l.charAt(n),n++):(o=e,f===0&&w(Qr)),o===e&&(o=null),m=t,t=bo(a,o)):(n=t,t=e),t}function is(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===En?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Wr)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?t=a=[a,o]:(n=t,t=e)):(n=t,t=e),t}function os(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Fn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Gr)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?t=a=[a,o]:(n=t,t=e)):(n=t,t=e),t}function us(){var t,a,o,s;return t=n,l.substr(n,5).toLowerCase()===$n?(a=l.substr(n,5),n+=5):(a=e,f===0&&w(Kr)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?t=a=[a,o]:(n=t,t=e)):(n=t,t=e),t}function Ht(){var t,a,o,s;return t=n,l.substr(n,2).toLowerCase()===Dn?(a=l.substr(n,2),n+=2):(a=e,f===0&&w(Xr)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Ao()):(n=t,t=e)):(n=t,t=e),t}function _e(){var t,a,o,s;return t=n,l.substr(n,2).toLowerCase()===Pn?(a=l.substr(n,2),n+=2):(a=e,f===0&&w(ta)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Mo()):(n=t,t=e)):(n=t,t=e),t}function Re(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Ln?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(ea)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Eo()):(n=t,t=e)):(n=t,t=e),t}function ss(){var t,a,o,s;return t=n,l.substr(n,6).toLowerCase()===_n?(a=l.substr(n,6),n+=6):(a=e,f===0&&w(na)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Fo()):(n=t,t=e)):(n=t,t=e),t}function st(){var t,a,o,s;return t=n,l.substr(n,3).toLowerCase()===Rn?(a=l.substr(n,3),n+=3):(a=e,f===0&&w(ra)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=$o()):(n=t,t=e)):(n=t,t=e),t}function Tt(){var t,a,o,s;return t=n,l.substr(n,3).toLowerCase()===Un?(a=l.substr(n,3),n+=3):(a=e,f===0&&w(aa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Do()):(n=t,t=e)):(n=t,t=e),t}function Ue(){var t,a,o,s;return t=n,l.substr(n,2).toLowerCase()===Vn?(a=l.substr(n,2),n+=2):(a=e,f===0&&w(ia)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Po()):(n=t,t=e)):(n=t,t=e),t}function Ve(){var t,a,o,s;return t=n,l.substr(n,7).toLowerCase()===Jn?(a=l.substr(n,7),n+=7):(a=e,f===0&&w(oa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Lo()):(n=t,t=e)):(n=t,t=e),t}function qt(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===zn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(ua)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=_o()):(n=t,t=e)):(n=t,t=e),t}function ls(){var t,a,o,s;return t=n,l.substr(n,3).toLowerCase()===Zn?(a=l.substr(n,3),n+=3):(a=e,f===0&&w(sa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Ro()):(n=t,t=e)):(n=t,t=e),t}function cs(){var t,a,o,s;return t=n,l.substr(n,9).toLowerCase()===kn?(a=l.substr(n,9),n+=9):(a=e,f===0&&w(la)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Uo()):(n=t,t=e)):(n=t,t=e),t}function fs(){var t,a,o,s;return t=n,l.substr(n,7).toLowerCase()===Hn?(a=l.substr(n,7),n+=7):(a=e,f===0&&w(ca)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Vo()):(n=t,t=e)):(n=t,t=e),t}function Je(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===qn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(fa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Jo()):(n=t,t=e)):(n=t,t=e),t}function ds(){var t,a,o,s;return t=n,l.substr(n,8).toLowerCase()===jn?(a=l.substr(n,8),n+=8):(a=e,f===0&&w(da)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=zo()):(n=t,t=e)):(n=t,t=e),t}function ze(){var t,a,o,s;return t=n,l.substr(n,9).toLowerCase()===Yn?(a=l.substr(n,9),n+=9):(a=e,f===0&&w(pa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Zo()):(n=t,t=e)):(n=t,t=e),t}function Ze(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Bn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(va)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=ko()):(n=t,t=e)):(n=t,t=e),t}function ke(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Qn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(ma)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Ho()):(n=t,t=e)):(n=t,t=e),t}function ps(){var t,a,o,s;return t=n,l.substr(n,7).toLowerCase()===Wn?(a=l.substr(n,7),n+=7):(a=e,f===0&&w(ha)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=qo()):(n=t,t=e)):(n=t,t=e),t}function vs(){var t,a,o,s;return t=n,l.substr(n,8).toLowerCase()===Gn?(a=l.substr(n,8),n+=8):(a=e,f===0&&w(wa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=jo()):(n=t,t=e)):(n=t,t=e),t}function ms(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Kn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Ia)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Yo()):(n=t,t=e)):(n=t,t=e),t}function hs(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Xn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(ga)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Bo()):(n=t,t=e)):(n=t,t=e),t}function ws(){var t,a,o,s;return t=n,l.substr(n,2).toLowerCase()===tr?(a=l.substr(n,2),n+=2):(a=e,f===0&&w(ya)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Qo()):(n=t,t=e)):(n=t,t=e),t}function Is(){var t,a,o,s;return t=n,l.substr(n,7).toLowerCase()===er?(a=l.substr(n,7),n+=7):(a=e,f===0&&w(Ta)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Wo()):(n=t,t=e)):(n=t,t=e),t}function gs(){var t,a,o,s;return t=n,l.substr(n,8).toLowerCase()===nr?(a=l.substr(n,8),n+=8):(a=e,f===0&&w(Na)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Go()):(n=t,t=e)):(n=t,t=e),t}function ys(){var t,a,o,s;return t=n,l.substr(n,5).toLowerCase()===rr?(a=l.substr(n,5),n+=5):(a=e,f===0&&w(Sa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Ko()):(n=t,t=e)):(n=t,t=e),t}function Ts(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===ar?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Oa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Xo()):(n=t,t=e)):(n=t,t=e),t}function Ns(){var t,a,o,s;return t=n,l.substr(n,7).toLowerCase()===ir?(a=l.substr(n,7),n+=7):(a=e,f===0&&w(xa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=tu()):(n=t,t=e)):(n=t,t=e),t}function Ss(){var t,a,o,s;return t=n,l.substr(n,2).toLowerCase()===or?(a=l.substr(n,2),n+=2):(a=e,f===0&&w(Ca)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=eu()):(n=t,t=e)):(n=t,t=e),t}function He(){var t,a,o,s;return t=n,l.substr(n,8).toLowerCase()===ur?(a=l.substr(n,8),n+=8):(a=e,f===0&&w(ba)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=nu()):(n=t,t=e)):(n=t,t=e),t}function qe(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===sr?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Aa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=ru()):(n=t,t=e)):(n=t,t=e),t}function Os(){var t,a,o,s;return t=n,l.substr(n,13).toLowerCase()===lr?(a=l.substr(n,13),n+=13):(a=e,f===0&&w(Ma)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=au()):(n=t,t=e)):(n=t,t=e),t}function xs(){var t,a,o,s;return t=n,l.substr(n,15).toLowerCase()===cr?(a=l.substr(n,15),n+=15):(a=e,f===0&&w(Ea)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=iu()):(n=t,t=e)):(n=t,t=e),t}function je(){var t,a,o,s;return t=n,l.substr(n,5).toLowerCase()===fr?(a=l.substr(n,5),n+=5):(a=e,f===0&&w(Fa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=ou()):(n=t,t=e)):(n=t,t=e),t}function Ye(){var t,a,o,s;return t=n,l.substr(n,3).toLowerCase()===dr?(a=l.substr(n,3),n+=3):(a=e,f===0&&w($a)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=uu()):(n=t,t=e)):(n=t,t=e),t}function Be(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===pr?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Da)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=su()):(n=t,t=e)):(n=t,t=e),t}function Qe(){var t,a,o,s;return t=n,l.substr(n,6).toLowerCase()===vr?(a=l.substr(n,6),n+=6):(a=e,f===0&&w(Pa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=lu()):(n=t,t=e)):(n=t,t=e),t}function at(){var t,a,o,s;return t=n,l.substr(n,6).toLowerCase()===mr?(a=l.substr(n,6),n+=6):(a=e,f===0&&w(La)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=cu()):(n=t,t=e)):(n=t,t=e),t}function Nt(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===hr?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(_a)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=fu()):(n=t,t=e)):(n=t,t=e),t}function St(){var t,a,o,s;return t=n,l.substr(n,3).toLowerCase()===wr?(a=l.substr(n,3),n+=3):(a=e,f===0&&w(Ra)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=du()):(n=t,t=e)):(n=t,t=e),t}function We(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Ir?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Ua)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=pu()):(n=t,t=e)):(n=t,t=e),t}function Ge(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===gr?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Va)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=vu()):(n=t,t=e)):(n=t,t=e),t}function Cs(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===yr?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Ja)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=mu()):(n=t,t=e)):(n=t,t=e),t}function Ot(){var t;return l.charCodeAt(n)===44?(t=Tr,n++):(t=e,f===0&&w(za)),t}function V(){var t;return l.charCodeAt(n)===40?(t=Nr,n++):(t=e,f===0&&w(Za)),t}function J(){var t;return l.charCodeAt(n)===41?(t=Sr,n++):(t=e,f===0&&w(ka)),t}function p(){var t,a;for(t=[],a=Ke();a!==e;)t.push(a),a=Ke();return t}function Ke(){var t;return Er.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(Ha)),t}function bs(){var t,a,o,s;if(t=n,(a=be())!==e&&(m=t,a=hu(a)),(t=a)===e)if(t=n,l.charCodeAt(n)===96?(a=se,n++):(a=e,f===0&&w(we)),a!==e){if(o=[],fe.test(l.charAt(n))?(s=l.charAt(n),n++):(s=e,f===0&&w(Ie)),s!==e)for(;s!==e;)o.push(s),fe.test(l.charAt(n))?(s=l.charAt(n),n++):(s=e,f===0&&w(Ie));else o=e;o!==e?(l.charCodeAt(n)===96?(s=se,n++):(s=e,f===0&&w(we)),s!==e?(m=t,t=wu(o)):(n=t,t=e)):(n=t,t=e)}else n=t,t=e;return t}function As(t,a){return{type:"unary-expression",operator:t,expr:a}}function Xe(t,a,o,s){var g={type:"binary-expression",operator:t,left:a,right:o};return s!==void 0&&(g.escape=s),g}function Ms(t,a){for(var o=[t],s=0;su.maxParams)throw new v(d.InvalidParameterCount,{name:i.toUpperCase()});return u.evaluate(r)}function nn(i,r){const u=dn[i.toLowerCase()];return u!=null&&r>=u.minParams&&r<=u.maxParams}const dn={min:{minParams:1,maxParams:1,evaluate:i=>rn(i[0],"min")},max:{minParams:1,maxParams:1,evaluate:i=>rn(i[0],"max")},avg:{minParams:1,maxParams:1,evaluate:i=>pn(i[0])},sum:{minParams:1,maxParams:1,evaluate:i=>zs(i[0])},stddev:{minParams:1,maxParams:1,evaluate:i=>Zs(i[0])},count:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:i[0].length},var:{minParams:1,maxParams:1,evaluate:i=>vn(i[0])}};function pn(i){if(i===null)return null;let r=0,u=0;for(let c=0;c=h)&&(u=l,c=h)}return u}function zs(i){if(i===null)return null;let r=0;for(let u=0;uc!==null)).length===0)return null;const r=pn(i);if(r===null)return null;let u=0;for(const c of i){if(!te(c))throw new v(d.InvalidValueForAggregateFunction);u+=(r-c)**2}return u/(i.length-1)}class b{constructor(){this.op="+",this.day=0,this.second=0,this.hour=0,this.month=0,this.year=0,this.minute=0,this.millis=0}static _fixDefaults(r){if(r.precision!==null||r.secondary!==null)throw new v(d.PrimarySecondaryQualifiers)}static _parseSecondsComponent(r,u){if(u.includes(".")){const c=u.split(".");r.second=parseFloat(c[0]),r.millis=parseInt(c[1],10)}else r.second=parseFloat(u)}static createFromMilliseconds(r){const u=new b;return u.second=r/1e3,u}static createFromValueAndQualifer(r,u,c){let l=null;const h=new b;if(h.op=c==="-"?"-":"+",u.type==="interval-period"){b._fixDefaults(u);const I=new RegExp("^[0-9]{1,}$");if(u.period==="year"||u.period==="month")throw new v(d.YearMonthIntervals);if(u.period==="second"){if(!/^[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$/.test(r))throw new v(d.IllegalInterval);b._parseSecondsComponent(h,r)}else{if(!I.test(r))throw new v(d.IllegalInterval);h[u.period]=parseFloat(r)}}else{if(b._fixDefaults(u.start),b._fixDefaults(u.end),u.start.period==="year"||u.start.period==="month"||u.end.period==="year"||u.end.period==="month")throw new v(d.YearMonthIntervals);switch(u.start.period){case"day":switch(u.end.period){case"hour":if(l=new RegExp("^[0-9]{1,} [0-9]{1,}$"),!l.test(r))throw new v(d.IllegalInterval);h[u.start.period]=parseFloat(r.split(" ")[0]),h[u.end.period]=parseFloat(r.split(" ")[1]);break;case"minute":if(l=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,}$"),!l.test(r))throw new v(d.IllegalInterval);{h[u.start.period]=parseFloat(r.split(" ")[0]);const I=r.split(" ")[1].split(":");h.hour=parseFloat(I[0]),h.minute=parseFloat(I[1])}break;case"second":if(l=new RegExp("^[0-9]{1,} [0-9]{1,2}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!l.test(r))throw new v(d.IllegalInterval);{h[u.start.period]=parseFloat(r.split(" ")[0]);const I=r.split(" ")[1].split(":");h.hour=parseFloat(I[0]),h.minute=parseFloat(I[1]),b._parseSecondsComponent(h,I[2])}break;default:throw new v(d.IllegalInterval)}break;case"hour":switch(u.end.period){case"minute":if(l=new RegExp("^[0-9]{1,}:[0-9]{1,}$"),!l.test(r))throw new v(d.IllegalInterval);h.hour=parseFloat(r.split(":")[0]),h.minute=parseFloat(r.split(":")[1]);break;case"second":if(l=new RegExp("^[0-9]{1,}:[0-9]{1,2}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!l.test(r))throw new v(d.IllegalInterval);{const I=r.split(":");h.hour=parseFloat(I[0]),h.minute=parseFloat(I[1]),b._parseSecondsComponent(h,I[2])}break;default:throw new v(d.IllegalInterval)}break;case"minute":if(u.end.period!=="second")throw new v(d.IllegalInterval);if(l=new RegExp("^[0-9]{1,}:[0-9]{1,}([.]{1}[0-9]{1,}){0,1}$"),!l.test(r))throw new v(d.IllegalInterval);{const I=r.split(":");h.minute=parseFloat(I[0]),b._parseSecondsComponent(h,I[1])}break;default:throw new v(d.IllegalInterval)}}return h}valueInMilliseconds(){return(this.op==="-"?-1:1)*(this.millis+1e3*this.second+60*this.minute*1e3+60*this.hour*60*1e3+24*this.day*60*60*1e3+this.month*(365/12)*24*60*60*1e3+365*this.year*24*60*60*1e3)}}const ks=/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/,qs=/^(\d{1,2}):(\d{1,2})$/,Hs=/^(\d{1,2}):(\d{1,2}):(\d{1,2}).([0-9]+)$/,mn=/^(\d{4})-(\d{1,2})-(\d{1,2})$/,js=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?$/,Ys=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})(\.[0-9]+)?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$/,Bs=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})?[ ]{0,1}(\+|\-)(\d{1,2}):(\d{1,2})$/,Qs=/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/;function bt(i,r){if(r instanceof Ls)return r===jt.instance?_.fromMillis(i.getTime(),{zone:jt.instance}):_.fromJSDate(i,{zone:r});switch(r){case"system":case"local":case null:return _.fromJSDate(i);default:return(r==null?void 0:r.toLowerCase())==="unknown"?_.fromMillis(i.getTime(),{zone:jt.instance}):_.fromJSDate(i,{zone:r})}}function k(i){return typeof i=="number"}function q(i){return typeof i=="string"||i instanceof String}function et(i){return i instanceof b}function Y(i){return i instanceof Date}function M(i){return i instanceof _}function E(i){return i instanceof H}function D(i){return i instanceof Q}function F(i){return i instanceof z}function ee(i){let r=ks.exec(i);if(r!==null){const[,u,c,l]=r,h=Q.fromParts(parseInt(u,10),parseInt(c,10),parseInt(l,10),0);if(h!==null)return h;throw new v(d.InvalidTime)}if(r=qs.exec(i),r!==null){const[,u,c]=r,l=Q.fromParts(parseInt(u,10),parseInt(c,10),0,0);if(l!==null)return l;throw new v(d.InvalidTime)}if(r=Hs.exec(i),r!==null){const[,u,c,l,h]=r,I=Q.fromParts(parseInt(u,10),parseInt(c,10),parseInt(l,10),parseInt(h,10));if(I!==null)return I;throw new v(d.InvalidTime)}throw new v(d.InvalidTime)}function At(i,r,u=!1){let c=js.exec(i);if(c!==null){const[,l,h,I,e,T,O,L]=c,U=_.fromObject({year:parseInt(l,10),month:parseInt(h,10),day:parseInt(I,10),hour:parseInt(e,10),minute:parseInt(T,10),second:parseInt(O,10),millisecond:L?parseInt(L.replace(".",""),10):0},{zone:Yt(r)});if(U.isValid===!1)throw new v(d.InvalidTimeStamp);return U}if(c=Ys.exec(i),c!==null){const[,l,h,I,e,T,O,L,U,Z,C]=c,A=z.fromParts(parseInt(l,10),parseInt(h,10),parseInt(I,10),parseInt(e,10),parseInt(T,10),parseInt(O,10),L?parseInt(L.replace(".",""),10):0,U==="-",parseInt(Z,10),parseInt(C,10));if(A.isValid===!1)throw new v(d.InvalidTimeStamp);return A}if(c=Bs.exec(i),c!==null){const[,l,h,I,e,T,O,L,U]=c,Z=z.fromParts(parseInt(l,10),parseInt(h,10),parseInt(I,10),parseInt(e,10),parseInt(T,10),0,0,O==="-",parseInt(L,10),parseInt(U,10));if(Z.isValid===!1)throw new v(d.InvalidTimeStamp);return Z}if(c=Qs.exec(i),c!==null){const[,l,h,I,e,T]=c,O=_.fromObject({year:parseInt(l,10),month:parseInt(h,10),day:parseInt(I,10),hour:parseInt(e,10),minute:parseInt(T,10),second:0},{zone:Yt(r)});if(O.isValid===!1)throw new v(d.InvalidTimeStamp);return O}if(c=mn.exec(i),c!==null){const[,l,h,I]=c,e=_.fromObject({year:parseInt(l,10),month:parseInt(h,10),day:parseInt(I,10),hour:0,minute:0,second:0},{zone:Yt(r)});if(e.isValid===!1)throw new v(d.InvalidTimeStamp);return e}throw new v(d.InvalidTimeStamp)}function hn(i,r){const u=mn.exec(i);if(u===null)try{return At(i,r)}catch{throw new v(d.InvalidDate)}const[,c,l,h]=u,I=H.fromParts(parseInt(c,10),parseInt(l,10),parseInt(h,10));if(I===null)throw new v(d.InvalidDate);return I}const Ws=321408e5,Gs=26784e5,Ks=864e5,Xs=36e5,tl=6e4;function Bt(i){return!!M(i)||!!F(i)}function el(i){return!!M(i)||!!E(i)||!!F(i)||!!D(i)}function xt(i){if(M(i))return i.toMillis();if(E(i))return i.toNumber();if(F(i))return i.toMilliseconds();throw new v(d.InvalidDataType)}function B(i,r,u,c){if(i==null||r==null)return null;if(k(i)){if(k(r))return G(i,r,u);if(q(r))return nl(i,r,u);if(el(r))throw new v(d.InvalidOperator);if(E(r))throw new v(d.InvalidOperator)}else if(q(i)){if(k(r))return rl(i,r,u);if(q(r))return al(i,r,u);if(M(r))throw new v(d.InvalidOperator);if(E(r))throw new v(d.InvalidOperator);if(D(r))throw new v(d.InvalidOperator);if(F(r))throw new v(d.InvalidOperator)}else if(M(i)){if(Bt(r)){if(i instanceof _&&ct(i.zone)){if(r instanceof _&&ct(r.zone)===!1||r instanceof z)return ft(i,r,u)}else if(r instanceof _&&ct(r.zone)&&(i instanceof _&&ct(i.zone)===!1||i instanceof z))return ft(i,r,u);return G(xt(i),xt(r),u)}if(q(r))throw new v(d.InvalidOperator);if(E(r))return il(i,r,u);if(D(r))throw new v(d.InvalidOperator);if(k(r))throw new v(d.InvalidOperator)}else if(E(i)){if(F(r))return sl(i,r,u);if(M(r))return ul(i,r,u);if(q(r))throw new v(d.InvalidOperator);if(E(r))return G(i.toNumber(),r.toNumber(),u);if(D(r))throw new v(d.InvalidOperator);if(k(r))throw new v(d.InvalidOperator)}else if(D(i)){if(D(r))return G(i.toNumber(),r.toNumber(),u);if(q(r))throw new v(d.InvalidOperator);if(k(r))throw new v(d.InvalidOperator);if(E(r))throw new v(d.InvalidOperator);if(Bt(r))throw new v(d.InvalidOperator)}else if(F(i)){if(Bt(r))return r instanceof _&&ct(r.zone)?ft(i,r,u):G(xt(i),xt(r),u);if(q(r))throw new v(d.InvalidOperator);if(E(r))return ol(i,r,u);if(D(r))throw new v(d.InvalidOperator);if(k(r))throw new v(d.InvalidOperator)}switch(u){case"<>":return i!==r;case"=":return i===r;case">":return i>r;case"<":return i=":return i>=r;case"<=":return i<=r}}function G(i,r,u){switch(u){case"<>":return i!==r;case"=":return i===r;case">":return i>r;case"<":return i=":return i>=r;case"<=":return i<=r}}function nl(i,r,u){const c=parseFloat(r);if(!isNaN(c))return G(i,c,u);const l=i.toString();switch(u){case"<>":return l!==r;case"=":return l===r;case">":return l>r;case"<":return l=":return l>=r;case"<=":return l<=r}}function rl(i,r,u){const c=parseFloat(i);if(!isNaN(c))return G(c,r,u);const l=r.toString();switch(u){case"<>":return i!==l;case"=":return i===l;case">":return i>l;case"<":return i=":return i>=l;case"<=":return i<=l}}function al(i,r,u){switch(u){case"<>":return i!==r;case"=":return i===r;case">":return i>r;case"<":return i=":return i>=r;case"<=":return i<=r}}function il(i,r,u){const c=r.toDateTimeLuxon(i.zone);return G((i=i.startOf("day")).toMillis(),c.toMillis(),u)}function ol(i,r,u){const c=r.toDateTimeLuxon(i.toDateTime().zone);return G((i=i.startOfDay()).toMilliseconds(),c.toMillis(),u)}function ul(i,r,u){const c=i.toDateTimeLuxon(r.zone);return r=r.startOf("day"),G(c.toMillis(),r.toMillis(),u)}function sl(i,r,u){const c=i.toDateTimeLuxon(r.toDateTime().zone);return r=r.startOfDay(),G(c.toMillis(),r.toMilliseconds(),u)}function ft(i,r,u){i instanceof z&&(i=i.toDateTime()),r instanceof z&&(r=r.toDateTime());const c=an(i),l=an(r);switch(u){case"<>":return c!==l;case"=":return c===l;case">":return c>l;case"<":return c=":return c>=l;case"<=":return c<=l}}function an(i){return i.year*Ws+i.month*Gs+i.day*Ks+i.hour*Xs+i.minute*tl+1e3*i.second+i.millisecond}function ne(i,r,u){const c=In[i.toLowerCase()];if(c==null)throw new v(d.FunctionNotRecognized);if(r.lengthc.maxParams)throw new v(d.InvalidParameterCount,{name:i.toUpperCase()});return c.evaluate(r,u)}function ll(i,r){const u=In[i.toLowerCase()];return u!=null&&r>=u.minParams&&r<=u.maxParams}function Mt(i){return typeof i=="string"||i instanceof String}function Qt(i){return!Y(i)&&!E(i)&&!M(i)&&!D(i)&&!F(i)}function wn(i){return E(i)||D(i)?i.toString():F(i)?i.toSQLValue():M(i)?i.millisecond===0?i.toFormat("yyyy-LL-dd HH:mm:ss"):i.toSQL({includeOffset:!1}):Y(i)?wn(_.fromJSDate(i)):i.toString()}function cl(i){if(Y(i))return H.fromDateJS(i);if(M(i))return H.fromParts(i.year,i.month,i.day);if(E(i))return i;if(D(i))throw new v(d.CannotCastValue);if(F(i)&&H.fromParts(i.year,i.month,i.day)===null)throw new v(d.CannotCastValue);if(Mt(i)){const r=H.fromReader(i);if(r!==null&&r.isValid)return r}throw new v(d.CannotCastValue)}function fl(i,r,u){if(Y(i))return bt(i,r);if(M(i))return i;if(E(i))return i.toDateTimeLuxon("unknown");if(D(i))throw new v(d.CannotCastValue);if(F(i))return i;if(Mt(i))return At(i,"unknown",u);throw new v(d.CannotCastValue)}function dl(i){if(Y(i))return Q.fromDateJS(i);if(M(i))return Q.fromDateTime(i);if(E(i))throw new v(d.CannotCastValue);if(D(i))return i;if(F(i))return Q.fromSqlTimeStampOffset(i);if(Mt(i))return ee(i);throw new v(d.CannotCastValue)}const In={extract:{minParams:2,maxParams:2,evaluate:([i,r])=>{if(r==null)return null;if(Y(r))switch(i.toUpperCase()){case"SECOND":return r.getSeconds();case"MINUTE":return r.getMinutes();case"HOUR":return r.getHours();case"DAY":return r.getDate();case"MONTH":return r.getMonth()+1;case"YEAR":return r.getFullYear();case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":return 0}else if(M(r))switch(i.toUpperCase()){case"SECOND":return r.second;case"MINUTE":return r.minute;case"HOUR":return r.hour;case"DAY":return r.day;case"MONTH":return r.month;case"YEAR":return r.year;case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":throw new v(d.InvalidFunctionParameters,{function:"EXTRACT"})}else if(E(r))switch(i.toUpperCase()){case"DAY":return r.day;case"MONTH":return r.month;case"YEAR":return r.year;case"TIMEZONE_HOUR":case"TIMEZONE_MINUTE":throw new v(d.InvalidFunctionParameters,{function:"EXTRACT"})}else if(D(r))switch(i.toUpperCase()){case"SECOND":return r.second;case"MINUTE":return r.minute;case"HOUR":return r.hour}else if(F(r))switch(i.toUpperCase()){case"SECOND":return r.second;case"MINUTE":return r.minute;case"HOUR":return r.hour;case"DAY":return r.day;case"MONTH":return r.month;case"YEAR":return r.year;case"TIMEZONE_HOUR":return r.timezoneOffsetHour;case"TIMEZONE_MINUTE":return r.timezoneOffsetMinutes}throw new v(d.InvalidFunctionParameters,{function:"EXTRACT"})}},substring:{minParams:2,maxParams:3,evaluate:i=>{if(i.length===2){const[r,u]=i;return r==null||u==null?null:r.toString().substring(u-1)}if(i.length===3){const[r,u,c]=i;return r==null||u==null||c==null?null:c<=0?"":r.toString().substring(u-1,u+c-1)}}},position:{minParams:2,maxParams:2,evaluate:([i,r])=>i==null||r==null?null:r.indexOf(i)+1},trim:{minParams:2,maxParams:3,evaluate:i=>{const r=i.length===3,u=r?i[1]:" ",c=r?i[2]:i[1];if(u==null||c==null)return null;const l=`(${_s(u)})`;switch(i[0]){case"BOTH":return c.replaceAll(new RegExp(`^${l}*|${l}*$`,"g"),"");case"LEADING":return c.replaceAll(new RegExp(`^${l}*`,"g"),"");case"TRAILING":return c.replaceAll(new RegExp(`${l}*$`,"g"),"")}throw new v(d.InvalidFunctionParameters,{function:"TRIM"})}},abs:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.abs(i[0])},ceiling:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.ceil(i[0])},floor:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.floor(i[0])},log:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.log(i[0])},log10:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.log(i[0])*Math.LOG10E},sin:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.sin(i[0])},cos:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.cos(i[0])},tan:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.tan(i[0])},asin:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.asin(i[0])},acos:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.acos(i[0])},atan:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.atan(i[0])},sign:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:i[0]>0?1:i[1]<0?-1:0},power:{minParams:2,maxParams:2,evaluate:i=>i[0]==null||i[1]==null?null:i[0]**i[1]},mod:{minParams:2,maxParams:2,evaluate:i=>i[0]==null||i[1]==null?null:i[0]%i[1]},round:{minParams:1,maxParams:2,evaluate:i=>{const r=i[0],u=i.length===2?10**i[1]:1;return r==null?null:Math.round(r*u)/u}},truncate:{minParams:1,maxParams:2,evaluate:i=>i[0]==null?null:i.length===1?parseInt(i[0].toFixed(0),10):parseFloat(i[0].toFixed(i[1]))},char_length:{minParams:1,maxParams:1,evaluate:i=>Mt(i[0])?i[0].length:0},concat:{minParams:1,maxParams:1/0,evaluate:i=>{let r="";for(let u=0;ui[0]==null?null:i[0].toString().toLowerCase()},upper:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:i[0].toString().toUpperCase()},coalesce:{minParams:1,maxParams:1/0,evaluate:i=>{for(const r of i)if(r!==null)return r;return null}},cosh:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.cosh(i[0])},sinh:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.sinh(i[0])},tanh:{minParams:1,maxParams:1,evaluate:i=>i[0]==null?null:Math.tanh(i[0])},nullif:{minParams:2,maxParams:2,evaluate:(i,r)=>B(i[0],i[1],"=")?null:i[0]},cast:{minParams:2,maxParams:2,evaluate:(i,r)=>{const u=i[0],c=i[1];if(u===null)return null;switch(c.type){case"integer":{if(!Qt(u))throw new v(d.CannotCastValue);const l=parseInt(u,10);if(isNaN(l))throw new v(d.CannotCastValue);return l}case"smallint":{if(!Qt(u))throw new v(d.CannotCastValue);const l=parseInt(u,10);if(isNaN(l))throw new v(d.CannotCastValue);if(l>32767||l<-32767)throw new v(d.CannotCastValue);return l}case"float":case"real":{if(!Qt(u))throw new v(d.CannotCastValue);const l=parseFloat(u);if(isNaN(l))throw new v(d.CannotCastValue);return l}case"time":return dl(u);case"date":return cl(u);case"timestamp":return fl(u,r,c.withtimezone===!0);case"varchar":{const l=wn(u);if(l.length>c.size)throw new v(d.CannotCastValue);return l}default:throw new v(d.InvalidDataType)}}}};function gn(i,r,u,c){if(i==="||")return ne("concat",[r,u],c);if(r===null||u===null)return null;if(k(r)){if(k(u))return re(r,u,i);if(et(u))return yl(r,u,i);if(D(u))return El();if(E(u))return Fl();if(F(u))return Ml();if(M(u))return bl();if(q(u))return $l(r,u,i);throw new v(d.InvalidOperator)}if(E(r)){if(k(u))return xl(r,u,i);if(et(u))return Tl(r,u,i);if(D(u))return Jl();if(E(u))return Vl(r,u,i);if(F(u))return Ul(r,u,i);if(M(u))return Rl(r,u,i);if(q(u))return Xl();throw new v(d.InvalidOperator)}if(D(r)){if(k(u))return Cl(r,u,i);if(et(u))return hl(r,u,i);if(D(u))return Bl();if(E(u))return jl();if(F(u))return Yl();if(M(u))return Hl();if(q(u))return tc();throw new v(d.InvalidOperator)}if(et(r)){if(k(u))return gl(r,u,i);if(et(u))return Il(r,u,i);if(D(u))return vl(r,u,i);if(E(u))return ml(r,u,i);if(F(u))return wl(r,u,i);if(M(u))return pl(r,u,i);if(q(u))return Ll();throw new v(d.InvalidOperator)}if(M(r)){if(k(u))return Ol(r,u,i);if(et(u))return Nl(r,u,i);if(D(u))return Kl();if(E(u))return Wl(r,u,i);if(F(u))return Gl(r,u,i);if(M(u))return Ql(r,u,i);if(q(u))return ec();throw new v(d.InvalidOperator)}if(F(r)){if(k(u))return Al(r,u,i);if(et(u))return Sl(r,u,i);if(D(u))return zl();if(E(u))return Zl(r,u,i);if(F(u))return ql(r,u,i);if(M(u))return kl(r,u,i);if(q(u))return nc();throw new v(d.InvalidOperator)}if(q(r)){if(k(u))return Dl(r,u,i);if(et(u))return _l();if(D(u))return rc();if(E(u))return ac();if(F(u))return oc();if(M(u))return ic();if(q(u))return Pl(r,u,i);throw new v(d.InvalidOperator)}throw new v(d.InvalidOperator)}function re(i,r,u){switch(u){case"+":return i+r;case"-":return i-r;case"*":return i*r;case"/":return i/r}throw new v(d.InvalidOperator)}function pl(i,r,u){switch(u){case"+":return r.plus({milliseconds:i.valueInMilliseconds()});case"-":return i.valueInMilliseconds()-r.toMillis()}throw new v(d.InvalidOperator)}function vl(i,r,u){if(u==="+")return r.plus("milliseconds",i.valueInMilliseconds());throw new v(d.InvalidOperator)}function ml(i,r,u){if(u==="+")return r.plus("milliseconds",i.valueInMilliseconds());throw new v(d.InvalidOperator)}function hl(i,r,u){switch(u){case"+":return i.plus("milliseconds",r.valueInMilliseconds());case"-":return i.plus("milliseconds",-1*r.valueInMilliseconds())}throw new v(d.InvalidOperator)}function wl(i,r,u){if(u==="+")return r.addMilliseconds(i.valueInMilliseconds());throw new v(d.InvalidOperator)}function Il(i,r,u){switch(u){case"+":return b.createFromMilliseconds(i.valueInMilliseconds()+r.valueInMilliseconds());case"-":return b.createFromMilliseconds(i.valueInMilliseconds()-r.valueInMilliseconds());case"*":return b.createFromMilliseconds(i.valueInMilliseconds()*r.valueInMilliseconds());case"/":return b.createFromMilliseconds(i.valueInMilliseconds()/r.valueInMilliseconds())}throw new v(d.InvalidOperator)}function gl(i,r,u){switch(u){case"+":return b.createFromMilliseconds(i.valueInMilliseconds()+r);case"-":return b.createFromMilliseconds(i.valueInMilliseconds()-r);case"*":return b.createFromMilliseconds(i.valueInMilliseconds()*r);case"/":return b.createFromMilliseconds(i.valueInMilliseconds()/r)}throw new v(d.InvalidOperator)}function yl(i,r,u){switch(u){case"+":return b.createFromMilliseconds(i+r.valueInMilliseconds());case"-":return b.createFromMilliseconds(i-r.valueInMilliseconds());case"*":return b.createFromMilliseconds(i*r.valueInMilliseconds());case"/":return b.createFromMilliseconds(i/r.valueInMilliseconds())}throw new v(d.InvalidOperator)}function Tl(i,r,u){switch(u){case"+":return i.plus("milliseconds",r.valueInMilliseconds());case"-":return i.plus("milliseconds",-1*r.valueInMilliseconds())}throw new v(d.InvalidOperator)}function Nl(i,r,u){switch(u){case"+":return i.plus({milliseconds:r.valueInMilliseconds()});case"-":return i.minus({milliseconds:r.valueInMilliseconds()})}throw new v(d.InvalidOperator)}function Sl(i,r,u){switch(u){case"+":return i.addMilliseconds(r.valueInMilliseconds());case"-":return i.addMilliseconds(-1*r.valueInMilliseconds())}throw new v(d.InvalidOperator)}function Ol(i,r,u){const c=1e3*r*24*60*60;switch(u){case"+":return i.plus({milliseconds:c});case"-":return i.minus({milliseconds:c})}throw new v(d.InvalidOperator)}function xl(i,r,u){const c=1e3*r*24*60*60;switch(u){case"+":return i.plus("milliseconds",c);case"-":return i.plus("milliseconds",-1*c)}throw new v(d.InvalidOperator)}function Cl(i,r,u){const c=1e3*r*24*60*60;switch(u){case"+":return i.plus("milliseconds",c);case"-":return i.plus("milliseconds",-1*c)}throw new v(d.InvalidOperator)}function bl(i,r,u){throw new v(d.InvalidOperator)}function Al(i,r,u){const c=1e3*r*24*60*60;switch(u){case"+":return i.addMilliseconds(c);case"-":return i.addMilliseconds(-1*c)}throw new v(d.InvalidOperator)}function Ml(i,r,u){throw new v(d.InvalidOperator)}function El(i,r,u){throw new v(d.InvalidOperator)}function Fl(i,r,u){throw new v(d.InvalidOperator)}function $l(i,r,u){const c=parseFloat(r);if(isNaN(c))throw new v(d.InvalidOperator);return re(i,c,u)}function Dl(i,r,u){const c=parseFloat(i);if(isNaN(c))throw new v(d.InvalidOperator);return re(c,r,u)}function Pl(i,r,u){if(u==="+")return i+r;throw new v(d.InvalidOperator)}function Ll(i,r,u){throw new v(d.InvalidOperator)}function _l(i,r,u){throw new v(d.InvalidOperator)}function Rl(i,r,u){if(u==="-")return i.toDateTimeLuxon(r.zone).diff(r).as("days");throw new v(d.InvalidOperator)}function Ul(i,r,u){if(u==="-")return i.toDateTimeLuxon(r.toDateTime().zone).diff(r.toDateTime()).as("days");throw new v(d.InvalidOperator)}function Vl(i,r,u){if(u==="-")return i.toDateTimeLuxon("UTC").diff(r.toDateTimeLuxon("UTC")).as("days");throw new v(d.InvalidOperator)}function Jl(i,r,u){throw new v(d.InvalidOperator)}function zl(i,r,u){throw new v(d.InvalidOperator)}function Zl(i,r,u){if(u==="-")return i.toDateTime().diff(r.toDateTimeLuxon(i.toDateTime().zone)).as("days");throw new v(d.InvalidOperator)}function kl(i,r,u){if(u==="-")return i.toDateTime().diff(r).as("days");throw new v(d.InvalidOperator)}function ql(i,r,u){if(u==="-")return i.toDateTime().diff(r.toDateTime()).as("days");throw new v(d.InvalidOperator)}function Hl(i,r,u){throw new v(d.InvalidOperator)}function jl(i,r,u){throw new v(d.InvalidOperator)}function Yl(i,r,u){throw new v(d.InvalidOperator)}function Bl(i,r,u){throw new v(d.InvalidOperator)}function Ql(i,r,u){if(u==="-")return i.diff(r).as("days");throw new v(d.InvalidOperator)}function Wl(i,r,u){if(u==="-")return i.diff(r.toDateTimeLuxon(i.zone)).as("days");throw new v(d.InvalidOperator)}function Gl(i,r,u){if(u==="-")return i.diff(r.toDateTime()).as("days");throw new v(d.InvalidOperator)}function Kl(i,r,u){throw new v(d.InvalidOperator)}function Xl(i,r,u){throw new v(d.InvalidOperator)}function tc(i,r,u){throw new v(d.InvalidOperator)}function ec(i,r,u){throw new v(d.InvalidOperator)}function nc(i,r,u){throw new v(d.InvalidOperator)}function rc(i,r,u){throw new v(d.InvalidOperator)}function ac(i,r,u){throw new v(d.InvalidOperator)}function ic(i,r,u){throw new v(d.InvalidOperator)}function oc(i,r,u){throw new v(d.InvalidOperator)}var on,un,Wt={exports:{}};Wt.exports,un=function(){function i(l,h){function I(){this.constructor=l}I.prototype=h.prototype,l.prototype=new I}function r(l,h,I,e){var T=Error.call(this,l);return Object.setPrototypeOf&&Object.setPrototypeOf(T,r.prototype),T.expected=h,T.found=I,T.location=e,T.name="SyntaxError",T}function u(l,h,I){return I=I||" ",l.length>h?l:(h-=l.length,l+(I+=I.repeat(h)).slice(0,h))}function c(l,h){var I,e={},T=(h=h!==void 0?h:{}).grammarSource,O={start:Te},L=Te,U="!",Z="=",C=">=",A=">",j="<=",R="<>",xn="<",ae="!=",Et="+",Ft="-",ie="||",Cn="*",bn="/",An="@",oe="'",ue="N'",dt="''",Mn=".",En="null",Fn="true",$n="false",Dn="in",Pn="is",Ln="like",_n="escape",Rn="not",Un="and",Vn="or",Jn="between",zn="from",Zn="for",kn="substring",qn="extract",Hn="trim",jn="position",Yn="timestamp",Bn="date",Qn="time",Wn="leading",Gn="trailing",Kn="both",Xn="cast",tr="as",er="integer",nr="smallint",rr="float",ar="real",ir="varchar",or="to",ur="interval",sr="year",lr="timezone_hour",cr="timezone_minute",fr="month",dr="day",pr="hour",vr="minute",mr="second",hr="case",wr="end",Ir="when",gr="then",yr="else",Tr=",",Nr="(",Sr=")",se="`",Or=/^[A-Za-z_\x80-\uFFFF]/,xr=/^[A-Za-z0-9_]/,le=/^[A-Za-z0-9_.\x80-\uFFFF]/,Cr=/^["]/,ce=/^[^']/,br=/^[0-9]/,Ar=/^[eE]/,Mr=/^[+\-]/,Er=/^[ \t\n\r]/,fe=/^[^`]/,Fr=y("!",!1),de=y("=",!1),$r=y(">=",!1),Dr=y(">",!1),Pr=y("<=",!1),Lr=y("<>",!1),_r=y("<",!1),Rr=y("!=",!1),$t=y("+",!1),Dt=y("-",!1),Ur=y("||",!1),Vr=y("*",!1),Jr=y("/",!1),zr=X([["A","Z"],["a","z"],"_",["€","￿"]],!1,!1),Zr=X([["A","Z"],["a","z"],["0","9"],"_"],!1,!1),pe=X([["A","Z"],["a","z"],["0","9"],"_",".",["€","￿"]],!1,!1),kr=X(['"'],!1,!1),qr=y("@",!1),ve=y("'",!1),Hr=y("N'",!1),me=y("''",!1),he=X(["'"],!0,!1),jr=y(".",!1),Yr=X([["0","9"]],!1,!1),Br=X(["e","E"],!1,!1),Qr=X(["+","-"],!1,!1),Wr=y("NULL",!0),Gr=y("TRUE",!0),Kr=y("FALSE",!0),Xr=y("IN",!0),ta=y("IS",!0),ea=y("LIKE",!0),na=y("ESCAPE",!0),ra=y("NOT",!0),aa=y("AND",!0),ia=y("OR",!0),oa=y("BETWEEN",!0),ua=y("FROM",!0),sa=y("FOR",!0),la=y("SUBSTRING",!0),ca=y("EXTRACT",!0),fa=y("TRIM",!0),da=y("POSITION",!0),pa=y("TIMESTAMP",!0),va=y("DATE",!0),ma=y("TIME",!0),ha=y("LEADING",!0),wa=y("TRAILING",!0),Ia=y("BOTH",!0),ga=y("CAST",!0),ya=y("AS",!0),Ta=y("INTEGER",!0),Na=y("SMALLINT",!0),Sa=y("FLOAT",!0),Oa=y("REAL",!0),xa=y("VARCHAR",!0),Ca=y("TO",!0),ba=y("INTERVAL",!0),Aa=y("YEAR",!0),Ma=y("TIMEZONE_HOUR",!0),Ea=y("TIMEZONE_MINUTE",!0),Fa=y("MONTH",!0),$a=y("DAY",!0),Da=y("HOUR",!0),Pa=y("MINUTE",!0),La=y("SECOND",!0),_a=y("CASE",!0),Ra=y("END",!0),Ua=y("WHEN",!0),Va=y("THEN",!0),Ja=y("ELSE",!0),za=y(",",!1),Za=y("(",!1),ka=y(")",!1),qa=X([" "," ",` +`,"\r"],!1,!1),we=y("`",!1),Ie=X(["`"],!0,!1),Ha=function(t){return t},ja=function(t,a){var o={type:"expression-list"},s=Es(t,a);return o.value=s,o},Ya=function(t,a){return lt(t,a)},Ba=function(t,a){return lt(t,a)},Qa=function(t){return As("NOT",t)},Wa=function(t,a){return a==""||a==null||a==null?t:a.type=="arithmetic"?lt(t,a.tail):Xe(a.op,t,a.right,a.escape)},Ga=function(t){return{type:"arithmetic",tail:t}},Ka=function(t,a){return{op:t+"NOT",right:a}},Xa=function(t,a){return{op:t,right:a}},ti=function(t,a,o){return{op:"NOT"+t,right:{type:"expression-list",value:[a,o]}}},ei=function(t,a,o){return{op:t,right:{type:"expression-list",value:[a,o]}}},ni=function(t){return t[0]+" "+t[2]},ri=function(t){return t[0]+" "+t[2]},ai=function(t,a,o){return{op:t,right:a,escape:o.value}},ii=function(t,a){return{op:t,right:a,escape:""}},oi=function(t,a){return{op:t,right:a}},ui=function(t){return{op:t,right:{type:"expression-list",value:[]}}},si=function(t,a){return{op:t,right:a}},li=function(t,a){return lt(t,a)},ci=function(t,a){return lt(t,a)},fi=function(t){return t.paren=!0,t},di=function(t){return/^CURRENT_DATE$/i.test(t)?{type:"current-time",mode:"date"}:/^CURRENT_TIMESTAMP$/i.test(t)?{type:"current-time",mode:"timestamp"}:{type:"column-reference",table:"",column:t}},pi=function(t){return{type:"column-reference",table:"",column:t,delimited:!0}},vi=function(t){return t},mi=function(t,a){return t+a.join("")},hi=function(t,a){return t+a.join("")},wi=function(t){return t},Ii=function(t){return t.join("")},gi=function(){return'"'},yi=function(t){return{type:"parameter",value:t[1]}},Ti=function(t,a){return{type:"function",name:"extract",args:{type:"expression-list",value:[{type:"string",value:t},a]}}},Ni=function(t,a,o){return{type:"function",name:"substring",args:{type:"expression-list",value:o?[t,a,o[2]]:[t,a]}}},Si=function(t,a){return{type:"function",name:"cast",args:{type:"expression-list",value:[t,a]}}},Oi=function(){return{type:"data-type",value:{type:"integer"}}},xi=function(){return{type:"data-type",value:{type:"smallint"}}},Ci=function(){return{type:"data-type",value:{type:"float"}}},bi=function(){return{type:"data-type",value:{type:"real"}}},Ai=function(){return{type:"data-type",value:{type:"date"}}},Mi=function(){return{type:"data-type",value:{type:"timestamp"}}},Ei=function(){return{type:"data-type",value:{type:"time"}}},Fi=function(t){return{type:"data-type",value:{type:"varchar",size:parseInt(t)}}},$i=function(t,a,o){return{type:"function",name:"trim",args:{type:"expression-list",value:[{type:"string",value:t??"BOTH"},a,o]}}},Di=function(t,a){return{type:"function",name:"trim",args:{type:"expression-list",value:[{type:"string",value:t??"BOTH"},a]}}},Pi=function(t,a){return{type:"function",name:"position",args:{type:"expression-list",value:[t,a]}}},Li=function(t,a){return{type:"function",name:t,args:a||{type:"expression-list",value:[]}}},_i=function(t){return t.type==="string"&&Fs(t.value),{type:"timestamp",value:t.value}},Ri=function(t){return t.type==="string"&&$s(t.value),{type:"time",value:t.value}},Ui=function(t,a,o){return{type:"interval",value:a,qualifier:o,op:t}},Vi=function(t,a){return{type:"interval",value:t,qualifier:a,op:""}},Ji=function(t,a){return{type:"interval-qualifier",start:t,end:a}},zi=function(t,a){return{type:"interval-period",period:t.value,precision:a,secondary:null}},Zi=function(t){return{type:"interval-period",period:t.value,precision:null,secondary:null}},ki=function(t){return{type:"interval-period",period:t.value,precision:null,secondary:null}},qi=function(t,a){return{type:"interval-period",period:"second",precision:t,secondary:a}},Hi=function(t){return{type:"interval-period",period:"second",precision:t,secondary:null}},ji=function(){return{type:"interval-period",period:"second",precision:null,secondary:null}},Yi=function(t,a){return{type:"interval-period",period:t.value,precision:a,secondary:null}},Bi=function(t){return{type:"interval-period",period:t.value,precision:null,secondary:null}},Qi=function(t,a){return{type:"interval-period",period:"second",precision:t,secondary:a}},Wi=function(t){return{type:"interval-period",period:"second",precision:t,secondary:null}},Gi=function(){return{type:"interval-period",period:"second",precision:null,secondary:null}},Ki=function(){return{type:"string",value:"day"}},Xi=function(){return{type:"string",value:"hour"}},to=function(){return{type:"string",value:"minute"}},eo=function(){return{type:"string",value:"month"}},no=function(){return{type:"string",value:"year"}},ro=function(t){return parseFloat(t)},ao=function(t){return parseFloat(t)},io=function(t){return t.type==="string"&&Ds(t.value),{type:"date",value:t.value}},oo=function(){return{type:"null",value:null}},uo=function(){return{type:"boolean",value:!0}},so=function(){return{type:"boolean",value:!1}},ge=function(){return"'"},lo=function(t){return{type:"string",value:t.join("")}},co=function(t,a){return{type:"case-expression",format:"simple",operand:t,clauses:a,else:null}},fo=function(t,a,o){return{type:"case-expression",format:"simple",operand:t,clauses:a,else:o.value}},po=function(t){return{type:"case-expression",format:"searched",clauses:t,else:null}},vo=function(t,a){return{type:"case-expression",format:"searched",clauses:t,else:a.value}},mo=function(t,a){return{type:"when-clause",operand:t,value:a}},ho=function(t,a){return{type:"when-clause",operand:t,value:a}},wo=function(t){return{type:"else-clause",value:t}},Io=function(t){return{type:"number",value:t}},go=function(t,a,o){return parseFloat(t+a+o)},yo=function(t,a){return parseFloat(t+a)},To=function(t,a){return parseFloat(t+a)},No=function(t){return parseFloat(t)},So=function(t,a){return t[0]+a},Oo=function(t){return"."+(t??"")},xo=function(t,a){return t+a},Co=function(t){return t.join("")},bo=function(t,a){return"e"+(a===null?"":a)},Ao=function(){return"IN"},Mo=function(){return"IS"},Eo=function(){return"LIKE"},Fo=function(){return"ESCAPE"},$o=function(){return"NOT"},Do=function(){return"AND"},Po=function(){return"OR"},Lo=function(){return"BETWEEN"},_o=function(){return"FROM"},Ro=function(){return"FOR"},Uo=function(){return"SUBSTRING"},Vo=function(){return"EXTRACT"},Jo=function(){return"TRIM"},zo=function(){return"POSITION"},Zo=function(){return"TIMESTAMP"},ko=function(){return"DATE"},qo=function(){return"TIME"},Ho=function(){return"LEADING"},jo=function(){return"TRAILING"},Yo=function(){return"BOTH"},Bo=function(){return"CAST"},Qo=function(){return"AS"},Wo=function(){return"INTEGER"},Go=function(){return"SMALLINT"},Ko=function(){return"FLOAT"},Xo=function(){return"REAL"},tu=function(){return"VARCHAR"},eu=function(){return"TO"},nu=function(){return"INTERVAL"},ru=function(){return"YEAR"},au=function(){return"TIMEZONE_HOUR"},iu=function(){return"TIMEZONE_MINUTE"},ou=function(){return"MONTH"},uu=function(){return"DAY"},su=function(){return"HOUR"},lu=function(){return"MINUTE"},cu=function(){return"SECOND"},fu=function(){return"CASE"},du=function(){return"END"},pu=function(){return"WHEN"},vu=function(){return"THEN"},mu=function(){return"ELSE"},hu=function(t){return t},wu=function(t){return t.join("")},n=0,m=0,pt=[{line:1,column:1}],K=0,Pt=[],f=0;if("startRule"in h){if(!(h.startRule in O))throw new Error(`Can't start parsing from rule "`+h.startRule+'".');L=O[h.startRule]}function Lt(t,a){throw gu(t,a=a!==void 0?a:_t(m,n))}function y(t,a){return{type:"literal",text:t,ignoreCase:a}}function X(t,a,o){return{type:"class",parts:t,inverted:a,ignoreCase:o}}function Iu(){return{type:"end"}}function ye(t){var a,o=pt[t];if(o)return o;for(a=t-1;!pt[a];)a--;for(o={line:(o=pt[a]).line,column:o.column};aK&&(K=n,Pt=[]),Pt.push(t))}function gu(t,a){return new r(t,null,null,a)}function yu(t,a,o){return new r(r.buildMessage(t,a),t,a,o)}function Te(){var t,a;return t=n,p(),(a=P())!==e?(p(),m=t,t=Ha(a)):(n=t,t=e),t}function Ne(){var t,a,o,s,g,S,x,$;if(t=n,(a=P())!==e){for(o=[],s=n,g=p(),(S=Ot())!==e?(x=p(),($=P())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);s!==e;)o.push(s),s=n,g=p(),(S=Ot())!==e?(x=p(),($=P())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);m=t,t=ja(a,o)}else n=t,t=e;return t}function P(){var t,a,o,s,g,S,x,$;if(t=n,(a=Rt())!==e){for(o=[],s=n,g=p(),(S=Ue())!==e?(x=p(),($=Rt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);s!==e;)o.push(s),s=n,g=p(),(S=Ue())!==e?(x=p(),($=Rt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);m=t,t=Ya(a,o)}else n=t,t=e;return t}function Rt(){var t,a,o,s,g,S,x,$;if(t=n,(a=vt())!==e){for(o=[],s=n,g=p(),(S=Tt())!==e?(x=p(),($=vt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);s!==e;)o.push(s),s=n,g=p(),(S=Tt())!==e?(x=p(),($=vt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);m=t,t=Ba(a,o)}else n=t,t=e;return t}function vt(){var t,a,o,s,g;return t=n,(a=st())===e&&(a=n,l.charCodeAt(n)===33?(o=U,n++):(o=e,f===0&&w(Fr)),o!==e?(s=n,f++,l.charCodeAt(n)===61?(g=Z,n++):(g=e,f===0&&w(de)),f--,g===e?s=void 0:(n=s,s=e),s!==e?a=o=[o,s]:(n=a,a=e)):(n=a,a=e)),a!==e?(o=p(),(s=vt())!==e?(m=t,t=Qa(s)):(n=t,t=e)):(n=t,t=e),t===e&&(t=Tu()),t}function Tu(){var t,a,o;return t=n,(a=tt())!==e?(p(),(o=Nu())===e&&(o=null),m=t,t=Wa(a,o)):(n=t,t=e),t}function Nu(){var t;return(t=Su())===e&&(t=bu())===e&&(t=xu())===e&&(t=Ou())===e&&(t=Cu()),t}function Su(){var t,a,o,s,g,S,x;if(t=n,a=[],o=n,s=p(),(g=Se())!==e?(S=p(),(x=tt())!==e?o=s=[s,g,S,x]:(n=o,o=e)):(n=o,o=e),o!==e)for(;o!==e;)a.push(o),o=n,s=p(),(g=Se())!==e?(S=p(),(x=tt())!==e?o=s=[s,g,S,x]:(n=o,o=e)):(n=o,o=e);else a=e;return a!==e&&(m=t,a=Ga(a)),t=a}function Se(){var t;return l.substr(n,2)===C?(t=C,n+=2):(t=e,f===0&&w($r)),t===e&&(l.charCodeAt(n)===62?(t=A,n++):(t=e,f===0&&w(Dr)),t===e&&(l.substr(n,2)===j?(t=j,n+=2):(t=e,f===0&&w(Pr)),t===e&&(l.substr(n,2)===R?(t=R,n+=2):(t=e,f===0&&w(Lr)),t===e&&(l.charCodeAt(n)===60?(t=xn,n++):(t=e,f===0&&w(_r)),t===e&&(l.charCodeAt(n)===61?(t=Z,n++):(t=e,f===0&&w(de)),t===e&&(l.substr(n,2)===ae?(t=ae,n+=2):(t=e,f===0&&w(Rr)))))))),t}function Ou(){var t,a,o,s;return t=n,(a=_e())!==e?(p(),(o=st())!==e?(p(),(s=tt())!==e?(m=t,t=Ka(a,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=_e())!==e?(p(),(o=tt())!==e?(m=t,t=Xa(a,o)):(n=t,t=e)):(n=t,t=e)),t}function xu(){var t,a,o,s,g,S;return t=n,(a=st())!==e?(p(),(o=Ve())!==e?(p(),(s=tt())!==e?(p(),(g=Tt())!==e?(p(),(S=tt())!==e?(m=t,t=ti(o,s,S)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=Ve())!==e?(p(),(o=tt())!==e?(p(),(s=Tt())!==e?(p(),(g=tt())!==e?(m=t,t=ei(a,o,g)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)),t}function Oe(){var t,a,o,s,g;return t=n,a=n,(o=st())!==e?(s=p(),(g=Re())!==e?a=o=[o,s,g]:(n=a,a=e)):(n=a,a=e),a!==e&&(m=t,a=ni(a)),(t=a)===e&&(t=Re()),t}function Ut(){var t,a,o,s,g;return t=n,a=n,(o=st())!==e?(s=p(),(g=qt())!==e?a=o=[o,s,g]:(n=a,a=e)):(n=a,a=e),a!==e&&(m=t,a=ri(a)),(t=a)===e&&(t=qt()),t}function Cu(){var t,a,o,s;return t=n,(a=Oe())!==e?(p(),(o=nt())!==e?(p(),ss()!==e?(p(),(s=kt())!==e?(m=t,t=ai(a,o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=Oe())!==e?(p(),(o=nt())!==e?(m=t,t=ii(a,o)):(n=t,t=e)):(n=t,t=e)),t}function bu(){var t,a,o,s;return t=n,(a=Ut())!==e?(p(),(o=V())!==e?(p(),(s=Ne())!==e?(p(),J()!==e?(m=t,t=oi(a,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=Ut())!==e?(p(),(o=V())!==e?(p(),(s=J())!==e?(m=t,t=ui(a)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=Ut())!==e?(p(),(o=Zt())!==e?(m=t,t=si(a,o)):(n=t,t=e)):(n=t,t=e))),t}function tt(){var t,a,o,s,g,S,x,$;if(t=n,(a=Vt())!==e){for(o=[],s=n,g=p(),(S=xe())!==e?(x=p(),($=Vt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);s!==e;)o.push(s),s=n,g=p(),(S=xe())!==e?(x=p(),($=Vt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);m=t,t=li(a,o)}else n=t,t=e;return t}function xe(){var t;return l.charCodeAt(n)===43?(t=Et,n++):(t=e,f===0&&w($t)),t===e&&(l.charCodeAt(n)===45?(t=Ft,n++):(t=e,f===0&&w(Dt)),t===e&&(l.substr(n,2)===ie?(t=ie,n+=2):(t=e,f===0&&w(Ur)))),t}function Vt(){var t,a,o,s,g,S,x,$;if(t=n,(a=Jt())!==e){for(o=[],s=n,g=p(),(S=Ce())!==e?(x=p(),($=Jt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);s!==e;)o.push(s),s=n,g=p(),(S=Ce())!==e?(x=p(),($=Jt())!==e?s=g=[g,S,x,$]:(n=s,s=e)):(n=s,s=e);m=t,t=ci(a,o)}else n=t,t=e;return t}function Ce(){var t;return l.charCodeAt(n)===42?(t=Cn,n++):(t=e,f===0&&w(Vr)),t===e&&(l.charCodeAt(n)===47?(t=bn,n++):(t=e,f===0&&w(Jr))),t}function Jt(){var t,a;return(t=ku())===e&&(t=Lu())===e&&(t=_u())===e&&(t=Vu())===e&&(t=Ju())===e&&(t=Ru())===e&&(t=zu())===e&&(t=Xu())===e&&(t=Au())===e&&(t=Zt())===e&&(t=n,V()!==e?(p(),(a=P())!==e?(p(),J()!==e?(m=t,t=fi(a)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)),t}function Au(){var t,a;return t=n,(a=Mu())!==e&&(m=t,a=di(a)),(t=a)===e&&(t=n,(a=Fu())!==e&&(m=t,a=pi(a)),t=a),t}function Mu(){var t,a;return t=n,(a=Eu())!==e&&(m=t,a=vi(a)),t=a}function Eu(){var t,a,o,s;if(t=n,(a=zt())!==e){for(o=[],s=Ae();s!==e;)o.push(s),s=Ae();m=t,t=mi(a,o)}else n=t,t=e;return t}function be(){var t,a,o,s;if(t=n,(a=zt())!==e){for(o=[],s=N();s!==e;)o.push(s),s=N();m=t,t=hi(a,o)}else n=t,t=e;return t}function zt(){var t;return Or.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(zr)),t}function N(){var t;return xr.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(Zr)),t}function Ae(){var t;return le.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(pe)),t}function Fu(){var t,a;return t=n,mt()!==e?(a=$u(),mt()!==e?(m=t,t=wi(a)):(n=t,t=e)):(n=t,t=e),t}function $u(){var t,a,o;for(t=n,a=[],o=Me();o!==e;)a.push(o),o=Me();return m=t,t=a=Ii(a)}function Me(){var t;return(t=Pu())===e&&(t=Du()),t}function Du(){var t;return t=n,mt()!==e&&mt()!==e?(m=t,t=gi()):(n=t,t=e),t}function Pu(){var t;return le.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(pe)),t}function mt(){var t;return Cr.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(kr)),t}function Zt(){var t,a,o,s;return t=n,a=n,l.charCodeAt(n)===64?(o=An,n++):(o=e,f===0&&w(qr)),o!==e&&(s=be())!==e?a=o=[o,s]:(n=a,a=e),a!==e&&(m=t,a=yi(a)),t=a}function Lu(){var t,a,o;return t=n,fs()!==e?(p(),V()!==e?(p(),(a=Zu())!==e?(p(),Ht()!==e?(p(),(o=P())!==e?(p(),J()!==e?(m=t,t=Ti(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function _u(){var t,a,o,s,g,S,x;return t=n,cs()!==e?(p(),V()!==e?(p(),(a=P())!==e?(p(),Ht()!==e?(p(),(o=P())!==e?(p(),s=n,(g=ls())!==e?(S=p(),(x=P())!==e?s=g=[g,S,x,p()]:(n=s,s=e)):(n=s,s=e),s===e&&(s=null),(g=J())!==e?(m=t,t=Ni(a,o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function Ru(){var t,a,o;return t=n,hs()!==e?(p(),V()!==e?(p(),(a=P())!==e?(p(),ws()!==e?(p(),(o=Uu())!==e?(p(),J()!==e?(m=t,t=Si(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function Uu(){var t,a,o;return t=n,(a=Is())!==e&&(m=t,a=Oi()),(t=a)===e&&(t=n,(a=gs())!==e&&(m=t,a=xi()),(t=a)===e&&(t=n,(a=ys())!==e&&(m=t,a=Ci()),(t=a)===e&&(t=n,(a=Ts())!==e&&(m=t,a=bi()),(t=a)===e&&(t=n,(a=Ze())!==e&&(m=t,a=Ai()),(t=a)===e&&(t=n,(a=ze())!==e&&(m=t,a=Mi()),(t=a)===e&&(t=n,(a=ke())!==e&&(m=t,a=Ei()),(t=a)===e&&(t=n,(a=Ns())!==e?(p(),V()!==e?(p(),(o=rt())!==e?(p(),J()!==e?(m=t,t=Fi(o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)))))))),t}function Vu(){var t,a,o,s;return t=n,Je()!==e?(p(),V()!==e?(p(),(a=Ee())===e&&(a=null),p(),(o=P())!==e?(p(),Ht()!==e?(p(),(s=P())!==e?(p(),J()!==e?(m=t,t=$i(a,o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,Je()!==e?(p(),V()!==e?(p(),(a=Ee())===e&&(a=null),p(),(o=P())!==e?(p(),J()!==e?(m=t,t=Di(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)),t}function Ee(){var t;return(t=ps())===e&&(t=vs())===e&&(t=ms()),t}function Ju(){var t,a,o;return t=n,ds()!==e?(p(),V()!==e?(p(),(a=P())!==e?(p(),qt()!==e?(p(),(o=P())!==e?(p(),J()!==e?(m=t,t=Pi(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function zu(){var t,a,o;return t=n,(a=bs())!==e?(p(),V()!==e?(p(),(o=Ne())===e&&(o=null),p(),J()!==e?(m=t,t=Li(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function Zu(){var t;return(t=He())===e&&(t=je())===e&&(t=Ye())===e&&(t=Be())===e&&(t=Qe())===e&&(t=at())===e&&(t=Os())===e&&(t=xs()),t}function ku(){var t;return(t=kt())===e&&(t=ns())===e&&(t=Ku())===e&&(t=Gu())===e&&(t=Wu())===e&&(t=qu())===e&&(t=ju())===e&&(t=Hu()),t}function qu(){var t,a;return t=n,ze()!==e?(p(),(a=nt())!==e?(m=t,t=_i(a)):(n=t,t=e)):(n=t,t=e),t}function Hu(){var t,a;return t=n,ke()!==e?(p(),(a=nt())!==e?(m=t,t=Ri(a)):(n=t,t=e)):(n=t,t=e),t}function ju(){var t,a,o,s;return t=n,qe()!==e?(p(),l.charCodeAt(n)===45?(a=Ft,n++):(a=e,f===0&&w(Dt)),a===e&&(l.charCodeAt(n)===43?(a=Et,n++):(a=e,f===0&&w($t))),a!==e?(p(),(o=nt())!==e?(p(),(s=Fe())!==e?(m=t,t=Ui(a,o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,qe()!==e?(p(),(a=nt())!==e?(p(),(o=Fe())!==e?(m=t,t=Vi(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)),t}function Fe(){var t,a,o;return t=n,(a=Yu())!==e?(p(),Ss()!==e?(p(),(o=Bu())!==e?(m=t,t=Ji(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=Qu()),t}function Yu(){var t,a,o;return t=n,(a=ut())!==e?(p(),V()!==e?(p(),(o=wt())!==e?(p(),J()!==e?(m=t,t=zi(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=ut())!==e&&(m=t,a=Zi(a)),t=a),t}function Bu(){var t,a,o,s;return t=n,(a=ut())!==e&&(m=t,a=ki(a)),(t=a)===e&&(t=n,(a=at())!==e?(p(),V()!==e?(p(),(o=wt())!==e?(p(),Ot()!==e?(p(),(s=ht())!==e?(p(),J()!==e?(m=t,t=qi(o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=at())!==e?(p(),V()!==e?(p(),(o=wt())!==e?(p(),J()!==e?(m=t,t=Hi(o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=at())!==e&&(m=t,a=ji()),t=a))),t}function Qu(){var t,a,o,s;return t=n,(a=ut())!==e?(p(),V()!==e?(p(),(o=ht())!==e?(p(),J()!==e?(m=t,t=Yi(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=ut())!==e&&(m=t,a=Bi(a)),(t=a)===e&&(t=n,(a=at())!==e?(p(),V()!==e?(p(),(o=wt())!==e?(p(),Ot()!==e?(p(),(s=ht())!==e?(p(),J()!==e?(m=t,t=Qi(o,s)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=at())!==e?(p(),V()!==e?(p(),(o=ht())!==e?(p(),J()!==e?(m=t,t=Wi(o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t===e&&(t=n,(a=at())!==e&&(m=t,a=Gi()),t=a)))),t}function ut(){var t,a;return t=n,(a=Ye())!==e&&(m=t,a=Ki()),(t=a)===e&&(t=n,(a=Be())!==e&&(m=t,a=Xi()),(t=a)===e&&(t=n,(a=Qe())!==e&&(m=t,a=to()),(t=a)===e&&(t=n,(a=je())!==e&&(m=t,a=eo()),(t=a)===e&&(t=n,(a=He())!==e&&(m=t,a=no()),t=a)))),t}function ht(){var t,a;return t=n,(a=rt())!==e&&(m=t,a=ro(a)),t=a}function wt(){var t,a;return t=n,(a=rt())!==e&&(m=t,a=ao(a)),t=a}function Wu(){var t,a;return t=n,Ze()!==e?(p(),(a=nt())!==e?(m=t,t=io(a)):(n=t,t=e)):(n=t,t=e),t}function Gu(){var t,a;return t=n,(a=is())!==e&&(m=t,a=oo()),t=a}function Ku(){var t,a;return t=n,(a=os())!==e&&(m=t,a=uo()),(t=a)===e&&(t=n,(a=us())!==e&&(m=t,a=so()),t=a),t}function nt(){var t;return(t=kt())===e&&(t=Zt()),t}function kt(){var t,a,o,s,g;if(t=n,l.charCodeAt(n)===39?(a=oe,n++):(a=e,f===0&&w(ve)),a===e&&(l.substr(n,2)===ue?(a=ue,n+=2):(a=e,f===0&&w(Hr))),a!==e){for(o=[],s=n,l.substr(n,2)===dt?(g=dt,n+=2):(g=e,f===0&&w(me)),g!==e&&(m=s,g=ge()),(s=g)===e&&(ce.test(l.charAt(n))?(s=l.charAt(n),n++):(s=e,f===0&&w(he)));s!==e;)o.push(s),s=n,l.substr(n,2)===dt?(g=dt,n+=2):(g=e,f===0&&w(me)),g!==e&&(m=s,g=ge()),(s=g)===e&&(ce.test(l.charAt(n))?(s=l.charAt(n),n++):(s=e,f===0&&w(he)));l.charCodeAt(n)===39?(s=oe,n++):(s=e,f===0&&w(ve)),s!==e?(m=t,t=lo(o)):(n=t,t=e)}else n=t,t=e;return t}function Xu(){var t;return(t=ts())===e&&(t=es()),t}function ts(){var t,a,o,s,g;if(t=n,Nt()!==e)if(p(),(a=P())!==e){for(p(),o=[],s=gt();s!==e;)o.push(s),s=gt();s=p(),(g=St())!==e?(m=t,t=co(a,o)):(n=t,t=e)}else n=t,t=e;else n=t,t=e;if(t===e)if(t=n,Nt()!==e)if(p(),(a=P())!==e){for(p(),o=[],s=gt();s!==e;)o.push(s),s=gt();s=p(),(g=$e())!==e?(p(),St()!==e?(m=t,t=fo(a,o,g)):(n=t,t=e)):(n=t,t=e)}else n=t,t=e;else n=t,t=e;return t}function es(){var t,a,o,s;if(t=n,Nt()!==e){for(p(),a=[],o=It();o!==e;)a.push(o),o=It();o=p(),(s=St())!==e?(m=t,t=po(a)):(n=t,t=e)}else n=t,t=e;if(t===e)if(t=n,Nt()!==e){for(p(),a=[],o=It();o!==e;)a.push(o),o=It();o=p(),(s=$e())!==e?(p(),St()!==e?(m=t,t=vo(a,s)):(n=t,t=e)):(n=t,t=e)}else n=t,t=e;return t}function It(){var t,a,o;return t=n,We()!==e?(p(),(a=P())!==e?(p(),Ge()!==e?(p(),(o=P())!==e?(m=t,t=mo(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function gt(){var t,a,o;return t=n,We()!==e?(p(),(a=P())!==e?(p(),Ge()!==e?(p(),(o=P())!==e?(m=t,t=ho(a,o)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e)):(n=t,t=e),t}function $e(){var t,a;return t=n,Cs()!==e?(p(),(a=P())!==e?(m=t,t=wo(a)):(n=t,t=e)):(n=t,t=e),t}function ns(){var t,a,o,s;return t=n,(a=rs())!==e?(o=n,f++,s=zt(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Io(a)):(n=t,t=e)):(n=t,t=e),t}function rs(){var t,a,o,s;return t=n,(a=yt())!==e&&(o=De())!==e&&(s=Pe())!==e?(m=t,t=go(a,o,s)):(n=t,t=e),t===e&&(t=n,(a=yt())!==e&&(o=De())!==e?(m=t,t=yo(a,o)):(n=t,t=e),t===e&&(t=n,(a=yt())!==e&&(o=Pe())!==e?(m=t,t=To(a,o)):(n=t,t=e),t===e&&(t=n,(a=yt())!==e&&(m=t,a=No(a)),t=a))),t}function yt(){var t,a,o;return(t=rt())===e&&(t=n,l.charCodeAt(n)===45?(a=Ft,n++):(a=e,f===0&&w(Dt)),a===e&&(l.charCodeAt(n)===43?(a=Et,n++):(a=e,f===0&&w($t))),a!==e&&(o=rt())!==e?(m=t,t=So(a,o)):(n=t,t=e)),t}function De(){var t,a,o;return t=n,l.charCodeAt(n)===46?(a=Mn,n++):(a=e,f===0&&w(jr)),a!==e?((o=rt())===e&&(o=null),m=t,t=Oo(o)):(n=t,t=e),t}function Pe(){var t,a,o;return t=n,(a=as())!==e&&(o=rt())!==e?(m=t,t=xo(a,o)):(n=t,t=e),t}function rt(){var t,a,o;if(t=n,a=[],(o=Le())!==e)for(;o!==e;)a.push(o),o=Le();else a=e;return a!==e&&(m=t,a=Co(a)),t=a}function Le(){var t;return br.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(Yr)),t}function as(){var t,a,o;return t=n,Ar.test(l.charAt(n))?(a=l.charAt(n),n++):(a=e,f===0&&w(Br)),a!==e?(Mr.test(l.charAt(n))?(o=l.charAt(n),n++):(o=e,f===0&&w(Qr)),o===e&&(o=null),m=t,t=bo(a,o)):(n=t,t=e),t}function is(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===En?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Wr)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?t=a=[a,o]:(n=t,t=e)):(n=t,t=e),t}function os(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Fn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Gr)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?t=a=[a,o]:(n=t,t=e)):(n=t,t=e),t}function us(){var t,a,o,s;return t=n,l.substr(n,5).toLowerCase()===$n?(a=l.substr(n,5),n+=5):(a=e,f===0&&w(Kr)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?t=a=[a,o]:(n=t,t=e)):(n=t,t=e),t}function qt(){var t,a,o,s;return t=n,l.substr(n,2).toLowerCase()===Dn?(a=l.substr(n,2),n+=2):(a=e,f===0&&w(Xr)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Ao()):(n=t,t=e)):(n=t,t=e),t}function _e(){var t,a,o,s;return t=n,l.substr(n,2).toLowerCase()===Pn?(a=l.substr(n,2),n+=2):(a=e,f===0&&w(ta)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Mo()):(n=t,t=e)):(n=t,t=e),t}function Re(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Ln?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(ea)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Eo()):(n=t,t=e)):(n=t,t=e),t}function ss(){var t,a,o,s;return t=n,l.substr(n,6).toLowerCase()===_n?(a=l.substr(n,6),n+=6):(a=e,f===0&&w(na)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Fo()):(n=t,t=e)):(n=t,t=e),t}function st(){var t,a,o,s;return t=n,l.substr(n,3).toLowerCase()===Rn?(a=l.substr(n,3),n+=3):(a=e,f===0&&w(ra)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=$o()):(n=t,t=e)):(n=t,t=e),t}function Tt(){var t,a,o,s;return t=n,l.substr(n,3).toLowerCase()===Un?(a=l.substr(n,3),n+=3):(a=e,f===0&&w(aa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Do()):(n=t,t=e)):(n=t,t=e),t}function Ue(){var t,a,o,s;return t=n,l.substr(n,2).toLowerCase()===Vn?(a=l.substr(n,2),n+=2):(a=e,f===0&&w(ia)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Po()):(n=t,t=e)):(n=t,t=e),t}function Ve(){var t,a,o,s;return t=n,l.substr(n,7).toLowerCase()===Jn?(a=l.substr(n,7),n+=7):(a=e,f===0&&w(oa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Lo()):(n=t,t=e)):(n=t,t=e),t}function Ht(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===zn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(ua)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=_o()):(n=t,t=e)):(n=t,t=e),t}function ls(){var t,a,o,s;return t=n,l.substr(n,3).toLowerCase()===Zn?(a=l.substr(n,3),n+=3):(a=e,f===0&&w(sa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Ro()):(n=t,t=e)):(n=t,t=e),t}function cs(){var t,a,o,s;return t=n,l.substr(n,9).toLowerCase()===kn?(a=l.substr(n,9),n+=9):(a=e,f===0&&w(la)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Uo()):(n=t,t=e)):(n=t,t=e),t}function fs(){var t,a,o,s;return t=n,l.substr(n,7).toLowerCase()===qn?(a=l.substr(n,7),n+=7):(a=e,f===0&&w(ca)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Vo()):(n=t,t=e)):(n=t,t=e),t}function Je(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Hn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(fa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Jo()):(n=t,t=e)):(n=t,t=e),t}function ds(){var t,a,o,s;return t=n,l.substr(n,8).toLowerCase()===jn?(a=l.substr(n,8),n+=8):(a=e,f===0&&w(da)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=zo()):(n=t,t=e)):(n=t,t=e),t}function ze(){var t,a,o,s;return t=n,l.substr(n,9).toLowerCase()===Yn?(a=l.substr(n,9),n+=9):(a=e,f===0&&w(pa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Zo()):(n=t,t=e)):(n=t,t=e),t}function Ze(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Bn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(va)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=ko()):(n=t,t=e)):(n=t,t=e),t}function ke(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Qn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(ma)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=qo()):(n=t,t=e)):(n=t,t=e),t}function ps(){var t,a,o,s;return t=n,l.substr(n,7).toLowerCase()===Wn?(a=l.substr(n,7),n+=7):(a=e,f===0&&w(ha)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Ho()):(n=t,t=e)):(n=t,t=e),t}function vs(){var t,a,o,s;return t=n,l.substr(n,8).toLowerCase()===Gn?(a=l.substr(n,8),n+=8):(a=e,f===0&&w(wa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=jo()):(n=t,t=e)):(n=t,t=e),t}function ms(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Kn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Ia)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Yo()):(n=t,t=e)):(n=t,t=e),t}function hs(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Xn?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(ga)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Bo()):(n=t,t=e)):(n=t,t=e),t}function ws(){var t,a,o,s;return t=n,l.substr(n,2).toLowerCase()===tr?(a=l.substr(n,2),n+=2):(a=e,f===0&&w(ya)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Qo()):(n=t,t=e)):(n=t,t=e),t}function Is(){var t,a,o,s;return t=n,l.substr(n,7).toLowerCase()===er?(a=l.substr(n,7),n+=7):(a=e,f===0&&w(Ta)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Wo()):(n=t,t=e)):(n=t,t=e),t}function gs(){var t,a,o,s;return t=n,l.substr(n,8).toLowerCase()===nr?(a=l.substr(n,8),n+=8):(a=e,f===0&&w(Na)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Go()):(n=t,t=e)):(n=t,t=e),t}function ys(){var t,a,o,s;return t=n,l.substr(n,5).toLowerCase()===rr?(a=l.substr(n,5),n+=5):(a=e,f===0&&w(Sa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Ko()):(n=t,t=e)):(n=t,t=e),t}function Ts(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===ar?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Oa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=Xo()):(n=t,t=e)):(n=t,t=e),t}function Ns(){var t,a,o,s;return t=n,l.substr(n,7).toLowerCase()===ir?(a=l.substr(n,7),n+=7):(a=e,f===0&&w(xa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=tu()):(n=t,t=e)):(n=t,t=e),t}function Ss(){var t,a,o,s;return t=n,l.substr(n,2).toLowerCase()===or?(a=l.substr(n,2),n+=2):(a=e,f===0&&w(Ca)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=eu()):(n=t,t=e)):(n=t,t=e),t}function qe(){var t,a,o,s;return t=n,l.substr(n,8).toLowerCase()===ur?(a=l.substr(n,8),n+=8):(a=e,f===0&&w(ba)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=nu()):(n=t,t=e)):(n=t,t=e),t}function He(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===sr?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Aa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=ru()):(n=t,t=e)):(n=t,t=e),t}function Os(){var t,a,o,s;return t=n,l.substr(n,13).toLowerCase()===lr?(a=l.substr(n,13),n+=13):(a=e,f===0&&w(Ma)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=au()):(n=t,t=e)):(n=t,t=e),t}function xs(){var t,a,o,s;return t=n,l.substr(n,15).toLowerCase()===cr?(a=l.substr(n,15),n+=15):(a=e,f===0&&w(Ea)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=iu()):(n=t,t=e)):(n=t,t=e),t}function je(){var t,a,o,s;return t=n,l.substr(n,5).toLowerCase()===fr?(a=l.substr(n,5),n+=5):(a=e,f===0&&w(Fa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=ou()):(n=t,t=e)):(n=t,t=e),t}function Ye(){var t,a,o,s;return t=n,l.substr(n,3).toLowerCase()===dr?(a=l.substr(n,3),n+=3):(a=e,f===0&&w($a)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=uu()):(n=t,t=e)):(n=t,t=e),t}function Be(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===pr?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Da)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=su()):(n=t,t=e)):(n=t,t=e),t}function Qe(){var t,a,o,s;return t=n,l.substr(n,6).toLowerCase()===vr?(a=l.substr(n,6),n+=6):(a=e,f===0&&w(Pa)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=lu()):(n=t,t=e)):(n=t,t=e),t}function at(){var t,a,o,s;return t=n,l.substr(n,6).toLowerCase()===mr?(a=l.substr(n,6),n+=6):(a=e,f===0&&w(La)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=cu()):(n=t,t=e)):(n=t,t=e),t}function Nt(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===hr?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(_a)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=fu()):(n=t,t=e)):(n=t,t=e),t}function St(){var t,a,o,s;return t=n,l.substr(n,3).toLowerCase()===wr?(a=l.substr(n,3),n+=3):(a=e,f===0&&w(Ra)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=du()):(n=t,t=e)):(n=t,t=e),t}function We(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===Ir?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Ua)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=pu()):(n=t,t=e)):(n=t,t=e),t}function Ge(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===gr?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Va)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=vu()):(n=t,t=e)):(n=t,t=e),t}function Cs(){var t,a,o,s;return t=n,l.substr(n,4).toLowerCase()===yr?(a=l.substr(n,4),n+=4):(a=e,f===0&&w(Ja)),a!==e?(o=n,f++,s=N(),f--,s===e?o=void 0:(n=o,o=e),o!==e?(m=t,t=mu()):(n=t,t=e)):(n=t,t=e),t}function Ot(){var t;return l.charCodeAt(n)===44?(t=Tr,n++):(t=e,f===0&&w(za)),t}function V(){var t;return l.charCodeAt(n)===40?(t=Nr,n++):(t=e,f===0&&w(Za)),t}function J(){var t;return l.charCodeAt(n)===41?(t=Sr,n++):(t=e,f===0&&w(ka)),t}function p(){var t,a;for(t=[],a=Ke();a!==e;)t.push(a),a=Ke();return t}function Ke(){var t;return Er.test(l.charAt(n))?(t=l.charAt(n),n++):(t=e,f===0&&w(qa)),t}function bs(){var t,a,o,s;if(t=n,(a=be())!==e&&(m=t,a=hu(a)),(t=a)===e)if(t=n,l.charCodeAt(n)===96?(a=se,n++):(a=e,f===0&&w(we)),a!==e){if(o=[],fe.test(l.charAt(n))?(s=l.charAt(n),n++):(s=e,f===0&&w(Ie)),s!==e)for(;s!==e;)o.push(s),fe.test(l.charAt(n))?(s=l.charAt(n),n++):(s=e,f===0&&w(Ie));else o=e;o!==e?(l.charCodeAt(n)===96?(s=se,n++):(s=e,f===0&&w(we)),s!==e?(m=t,t=wu(o)):(n=t,t=e)):(n=t,t=e)}else n=t,t=e;return t}function As(t,a){return{type:"unary-expression",operator:t,expr:a}}function Xe(t,a,o,s){var g={type:"binary-expression",operator:t,left:a,right:o};return s!==void 0&&(g.escape=s),g}function Ms(t,a){for(var o=[t],s=0;s `+L+` `+Z+` | `+O.line+" | "+C+` `+Z+" | "+u("",T.column-1," ")+u("",A,"^")}else h+=` - at `+L}return h},r.buildMessage=function(l,h){var I={literal:function(C){return'"'+T(C.text)+'"'},class:function(C){var A=C.parts.map(function(j){return Array.isArray(j)?O(j[0])+"-"+O(j[1]):O(j)});return"["+(C.inverted?"^":"")+A.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(C){return C.description}};function e(C){return C.charCodeAt(0).toString(16).toUpperCase()}function T(C){return C.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(A){return"\\x0"+e(A)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(A){return"\\x"+e(A)})}function O(C){return C.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(A){return"\\x0"+e(A)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(A){return"\\x"+e(A)})}function L(C){return I[C.type](C)}function U(C){var A,j,R=C.map(L);if(R.sort(),R.length>0){for(A=1,j=1;A=")&&B(r,u[1],"<=")}static notbetween(r,u,c){return r==null||u[0]==null||u[1]==null?null:B(r,u[0],"<")||B(r,u[1],">")}static ternaryNot(r){return Ct(r)}static ternaryAnd(r,u){return Nn(r,u)}static ternaryOr(r,u){return Sn(r,u)}}let fc=class yn{constructor(r,u,c="UTC"){this.fieldsIndex=u,this.timeZone=c,this.parameters={},this._hasDateFunctions=void 0,this.parseTree=sc.parse(r);const{isStandardized:l,isAggregate:h,referencedFieldNames:I}=this._extractExpressionInfo(u);this._referencedFieldNames=I,this.isStandardized=l,this.isAggregate=h}static convertValueToStorageFormat(r,u=null){if(u===null)return Y(r)?r.getTime():M(r)?r.toMillis():F(r)?r.toStorageFormat():D(r)?r.toStorageString():E(r)?r.toStorageFormat():r;switch(u){case"date":return Y(r)?r.getTime():M(r)?r.toMillis():F(r)?r.toMilliseconds():E(r)?r.toNumber():r;case"date-only":return Y(r)?q.fromDateJS(r).toString():F(r)?q.fromSqlTimeStampOffset(r).toString():M(r)?q.fromDateTime(r).toString():r;case"time-only":return Y(r)?Q.fromDateJS(r).toStorageString():M(r)?Q.fromDateTime(r).toStorageString():F(r)?Q.fromSqlTimeStampOffset(r).toStorageString():D(r)?r.toStorageString():r;case"timestamp-offset":if(Y(r))return z.fromJSDate(r).toStorageFormat();if(M(r))return z.fromDateTime(r).toStorageFormat();if(F(r))return r.toStorageFormat()}return r}static create(r,u,c="UTC"){return new yn(r,u,c)}get fieldNames(){return this._referencedFieldNames}testSet(r,u=ot){return!!this._evaluateNode(this.parseTree,null,u,r)}calculateValue(r,u=ot){const c=this._evaluateNode(this.parseTree,r,u,null);return c instanceof b?c.valueInMilliseconds()/864e5:c}calculateValueCompiled(r,u=ot){return this.parseTree._compiledVersion!=null?this.parseTree._compiledVersion(r,this.parameters,u,this.fieldsIndex,this.timeZone):tn("esri-csp-restrictions")?this.calculateValue(r,u):(this._compileMe(),this.parseTree._compiledVersion(r,this.parameters,u,this.fieldsIndex,this.timeZone))}testFeature(r,u=ot){return!!this._evaluateNode(this.parseTree,r,u,null)}testFeatureCompiled(r,u=ot){return this.parseTree._compiledVersion!=null?!!this.parseTree._compiledVersion(r,this.parameters,u,this.fieldsIndex,this.timeZone):tn("esri-csp-restrictions")?this.testFeature(r,u):(this._compileMe(),!!this.parseTree._compiledVersion(r,this.parameters,u,this.fieldsIndex,this.timeZone))}get hasDateFunctions(){return this._hasDateFunctions!=null||(this._hasDateFunctions=!1,this._visitAll(this.parseTree,r=>{r.type==="current-time"?this._hasDateFunctions=!0:r.type==="function"&&(this._hasDateFunctions=this._hasDateFunctions||lc.has(r.name.toLowerCase()))})),this._hasDateFunctions}getFunctions(){const r=new Set;return this._visitAll(this.parseTree,u=>{u.type==="function"&&r.add(u.name.toLowerCase())}),Array.from(r)}getExpressions(){const r=new Map;return this._visitAll(this.parseTree,u=>{if(u.type==="function"){const c=u.name.toLowerCase(),l=u.args.value[0];if(l.type==="column-reference"){const h=l.column,I=`${c}-${h}`;r.has(I)||r.set(I,{aggregateType:c,field:h})}}}),[...r.values()]}getVariables(){const r=new Set;return this._visitAll(this.parseTree,u=>{u.type==="parameter"&&r.add(u.value.toLowerCase())}),Array.from(r)}_compileMe(){const r="return this.convertInterval("+this.evaluateNodeToJavaScript(this.parseTree)+")";this.parseTree._compiledVersion=new Function("feature","lookups","attributeAdapter","fieldsIndex","timeZone",r).bind(cc)}_extractExpressionInfo(r){const u=[],c=new Set;let l=!0,h=!1;return this._visitAll(this.parseTree,I=>{switch(I.type){case"column-reference":{const e=r==null?void 0:r.get(I.column);let T,O;e?T=O=e.name??"":(O=I.column,T=O.toLowerCase()),c.has(T)||(c.add(T),u.push(O)),I.column=O;break}case"function":{const{name:e,args:T}=I,O=T.value.length;l&&(l=ll(e,O)),h===!1&&(h=nn(e,O));break}}}),{referencedFieldNames:Array.from(u),isStandardized:l,isAggregate:h}}_visitAll(r,u){if(r!=null)switch(u(r),r.type){case"when-clause":this._visitAll(r.operand,u),this._visitAll(r.value,u);break;case"case-expression":for(const c of r.clauses)this._visitAll(c,u);r.format==="simple"&&this._visitAll(r.operand,u),r.else!==null&&this._visitAll(r.else,u);break;case"expression-list":for(const c of r.value)this._visitAll(c,u);break;case"unary-expression":this._visitAll(r.expr,u);break;case"binary-expression":this._visitAll(r.left,u),this._visitAll(r.right,u);break;case"function":this._visitAll(r.args,u)}}evaluateNodeToJavaScript(r){switch(r.type){case"interval":return"this.makeSqlInterval("+this.evaluateNodeToJavaScript(r.value)+", "+JSON.stringify(r.qualifier)+","+JSON.stringify(r.op)+")";case"case-expression":{let u="";if(r.format==="simple"){const c=this.evaluateNodeToJavaScript(r.operand);u="( ";for(let l=0;l=",this.timeZone)&&B(e,T[1],"<=",this.timeZone)}case"NOTBETWEEN":{const e=this._evaluateNode(r.left,u,c,l),T=this._evaluateNode(r.right,u,c,l);return e==null||T[0]==null||T[1]==null?null:B(e,T[0],"<",this.timeZone)||B(e,T[1],">",this.timeZone)}case"LIKE":return Xt(this._evaluateNode(r.left,u,c,l),this._evaluateNode(r.right,u,c,l),r.escape);case"NOT LIKE":return Ct(Xt(this._evaluateNode(r.left,u,c,l),this._evaluateNode(r.right,u,c,l),r.escape));case"<>":case"<":case">":case">=":case"<=":case"=":return B(this._evaluateNode(r.left,u,c,l),this._evaluateNode(r.right,u,c,l),r.operator,this.timeZone);case"-":case"+":case"*":case"/":case"||":return gn(r.operator,this._evaluateNode(r.left,u,c,l),this._evaluateNode(r.right,u,c,l),this.timeZone)}case"null":case"boolean":case"string":case"number":return r.value;case"date":return r.parsedValue??(r.parsedValue=hn(r.value,"unknown")),r.parsedValue;case"timestamp":return r.parsedValue??(r.parsedValue=At(r.value,"unknown")),r.parsedValue;case"time":return ee(r.value);case"current-time":return r.mode==="date"?q.fromNow(this.timeZone):bt(new Date,this.timeZone);case"column-reference":return On(u,r.column,this.fieldsIndex,c);case"data-type":return r.value;case"function":{if(this.isAggregate&&nn(r.name,r.args.value.length)){const T=[];for(const O of((I=r.args)==null?void 0:I.value)||[]){const L=[];for(const U of l||[])L.push(this._evaluateNode(O,U,c,null));T.push(L)}return Js(r.name,T)}const e=this._evaluateNode(r.args,u,c,l);return ne(r.name,e,this.timeZone)}}throw new v(d.UnsupportedSyntax,{node:r.type})}};function Tn(i){return i===!0}function Gt(i){return Array.isArray(i)?i:[i]}function Ct(i){return i!==null?i!==!0:null}function Nn(i,r){return i!=null&&r!=null?i===!0&&r===!0:i!==!1&&r!==!1&&null}function Sn(i,r){return i!=null&&r!=null?i===!0||r===!0:i===!0||r===!0||null}function Kt(i,r){if(i==null)return null;let u=!1;for(const c of r)if(c==null)u=null;else if(i===c){u=!0;break}return u}const sn="-[]/{}()*+?.\\^$|";var it;function dc(i,r){const u=r;let c="",l=it.Normal;for(let h=0;h(pc(i)?i.attributes:i)[r]},wc=Object.freeze(Object.defineProperty({__proto__:null,WhereClause:fc,defaultAttributeAdapter:ot},Symbol.toStringTag,{value:"Module"}));export{wc as W,W as a,v as n,z as r,hc as s,d as t,fc as x}; + at `+L}return h},r.buildMessage=function(l,h){var I={literal:function(C){return'"'+T(C.text)+'"'},class:function(C){var A=C.parts.map(function(j){return Array.isArray(j)?O(j[0])+"-"+O(j[1]):O(j)});return"["+(C.inverted?"^":"")+A.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(C){return C.description}};function e(C){return C.charCodeAt(0).toString(16).toUpperCase()}function T(C){return C.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(A){return"\\x0"+e(A)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(A){return"\\x"+e(A)})}function O(C){return C.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(A){return"\\x0"+e(A)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(A){return"\\x"+e(A)})}function L(C){return I[C.type](C)}function U(C){var A,j,R=C.map(L);if(R.sort(),R.length>0){for(A=1,j=1;A=")&&B(r,u[1],"<=")}static notbetween(r,u,c){return r==null||u[0]==null||u[1]==null?null:B(r,u[0],"<")||B(r,u[1],">")}static ternaryNot(r){return Ct(r)}static ternaryAnd(r,u){return Nn(r,u)}static ternaryOr(r,u){return Sn(r,u)}}let fc=class yn{constructor(r,u,c="UTC"){this.fieldsIndex=u,this.timeZone=c,this.parameters={},this._hasDateFunctions=void 0,this.parseTree=sc.parse(r);const{isStandardized:l,isAggregate:h,referencedFieldNames:I}=this._extractExpressionInfo(u);this._referencedFieldNames=I,this.isStandardized=l,this.isAggregate=h}static convertValueToStorageFormat(r,u=null){if(u===null)return Y(r)?r.getTime():M(r)?r.toMillis():F(r)?r.toStorageFormat():D(r)?r.toStorageString():E(r)?r.toStorageFormat():r;switch(u){case"date":return Y(r)?r.getTime():M(r)?r.toMillis():F(r)?r.toMilliseconds():E(r)?r.toNumber():r;case"date-only":return Y(r)?H.fromDateJS(r).toString():F(r)?H.fromSqlTimeStampOffset(r).toString():M(r)?H.fromDateTime(r).toString():r;case"time-only":return Y(r)?Q.fromDateJS(r).toStorageString():M(r)?Q.fromDateTime(r).toStorageString():F(r)?Q.fromSqlTimeStampOffset(r).toStorageString():D(r)?r.toStorageString():r;case"timestamp-offset":if(Y(r))return z.fromJSDate(r).toStorageFormat();if(M(r))return z.fromDateTime(r).toStorageFormat();if(F(r))return r.toStorageFormat()}return r}static create(r,u,c="UTC"){return new yn(r,u,c)}get fieldNames(){return this._referencedFieldNames}testSet(r,u=ot){return!!this._evaluateNode(this.parseTree,null,u,r)}calculateValue(r,u=ot){const c=this._evaluateNode(this.parseTree,r,u,null);return c instanceof b?c.valueInMilliseconds()/864e5:c}calculateValueCompiled(r,u=ot){return this.parseTree._compiledVersion!=null?this.parseTree._compiledVersion(r,this.parameters,u,this.fieldsIndex,this.timeZone):tn("esri-csp-restrictions")?this.calculateValue(r,u):(this._compileMe(),this.parseTree._compiledVersion(r,this.parameters,u,this.fieldsIndex,this.timeZone))}testFeature(r,u=ot){return!!this._evaluateNode(this.parseTree,r,u,null)}testFeatureCompiled(r,u=ot){return this.parseTree._compiledVersion!=null?!!this.parseTree._compiledVersion(r,this.parameters,u,this.fieldsIndex,this.timeZone):tn("esri-csp-restrictions")?this.testFeature(r,u):(this._compileMe(),!!this.parseTree._compiledVersion(r,this.parameters,u,this.fieldsIndex,this.timeZone))}get hasDateFunctions(){return this._hasDateFunctions!=null||(this._hasDateFunctions=!1,this._visitAll(this.parseTree,r=>{r.type==="current-time"?this._hasDateFunctions=!0:r.type==="function"&&(this._hasDateFunctions=this._hasDateFunctions||lc.has(r.name.toLowerCase()))})),this._hasDateFunctions}getFunctions(){const r=new Set;return this._visitAll(this.parseTree,u=>{u.type==="function"&&r.add(u.name.toLowerCase())}),Array.from(r)}getExpressions(){const r=new Map;return this._visitAll(this.parseTree,u=>{if(u.type==="function"){const c=u.name.toLowerCase(),l=u.args.value[0];if(l.type==="column-reference"){const h=l.column,I=`${c}-${h}`;r.has(I)||r.set(I,{aggregateType:c,field:h})}}}),[...r.values()]}getVariables(){const r=new Set;return this._visitAll(this.parseTree,u=>{u.type==="parameter"&&r.add(u.value.toLowerCase())}),Array.from(r)}_compileMe(){const r="return this.convertInterval("+this.evaluateNodeToJavaScript(this.parseTree)+")";this.parseTree._compiledVersion=new Function("feature","lookups","attributeAdapter","fieldsIndex","timeZone",r).bind(cc)}_extractExpressionInfo(r){const u=[],c=new Set;let l=!0,h=!1;return this._visitAll(this.parseTree,I=>{switch(I.type){case"column-reference":{const e=r==null?void 0:r.get(I.column);let T,O;e?T=O=e.name??"":(O=I.column,T=O.toLowerCase()),c.has(T)||(c.add(T),u.push(O)),I.column=O;break}case"function":{const{name:e,args:T}=I,O=T.value.length;l&&(l=ll(e,O)),h===!1&&(h=nn(e,O));break}}}),{referencedFieldNames:Array.from(u),isStandardized:l,isAggregate:h}}_visitAll(r,u){if(r!=null)switch(u(r),r.type){case"when-clause":this._visitAll(r.operand,u),this._visitAll(r.value,u);break;case"case-expression":for(const c of r.clauses)this._visitAll(c,u);r.format==="simple"&&this._visitAll(r.operand,u),r.else!==null&&this._visitAll(r.else,u);break;case"expression-list":for(const c of r.value)this._visitAll(c,u);break;case"unary-expression":this._visitAll(r.expr,u);break;case"binary-expression":this._visitAll(r.left,u),this._visitAll(r.right,u);break;case"function":this._visitAll(r.args,u)}}evaluateNodeToJavaScript(r){switch(r.type){case"interval":return"this.makeSqlInterval("+this.evaluateNodeToJavaScript(r.value)+", "+JSON.stringify(r.qualifier)+","+JSON.stringify(r.op)+")";case"case-expression":{let u="";if(r.format==="simple"){const c=this.evaluateNodeToJavaScript(r.operand);u="( ";for(let l=0;l=",this.timeZone)&&B(e,T[1],"<=",this.timeZone)}case"NOTBETWEEN":{const e=this._evaluateNode(r.left,u,c,l),T=this._evaluateNode(r.right,u,c,l);return e==null||T[0]==null||T[1]==null?null:B(e,T[0],"<",this.timeZone)||B(e,T[1],">",this.timeZone)}case"LIKE":return Xt(this._evaluateNode(r.left,u,c,l),this._evaluateNode(r.right,u,c,l),r.escape);case"NOT LIKE":return Ct(Xt(this._evaluateNode(r.left,u,c,l),this._evaluateNode(r.right,u,c,l),r.escape));case"<>":case"<":case">":case">=":case"<=":case"=":return B(this._evaluateNode(r.left,u,c,l),this._evaluateNode(r.right,u,c,l),r.operator,this.timeZone);case"-":case"+":case"*":case"/":case"||":return gn(r.operator,this._evaluateNode(r.left,u,c,l),this._evaluateNode(r.right,u,c,l),this.timeZone)}case"null":case"boolean":case"string":case"number":return r.value;case"date":return r.parsedValue??(r.parsedValue=hn(r.value,"unknown")),r.parsedValue;case"timestamp":return r.parsedValue??(r.parsedValue=At(r.value,"unknown")),r.parsedValue;case"time":return ee(r.value);case"current-time":return r.mode==="date"?H.fromNow(this.timeZone):bt(new Date,this.timeZone);case"column-reference":return On(u,r.column,this.fieldsIndex,c);case"data-type":return r.value;case"function":{if(this.isAggregate&&nn(r.name,r.args.value.length)){const T=[];for(const O of((I=r.args)==null?void 0:I.value)||[]){const L=[];for(const U of l||[])L.push(this._evaluateNode(O,U,c,null));T.push(L)}return Js(r.name,T)}const e=this._evaluateNode(r.args,u,c,l);return ne(r.name,e,this.timeZone)}}throw new v(d.UnsupportedSyntax,{node:r.type})}};function Tn(i){return i===!0}function Gt(i){return Array.isArray(i)?i:[i]}function Ct(i){return i!==null?i!==!0:null}function Nn(i,r){return i!=null&&r!=null?i===!0&&r===!0:i!==!1&&r!==!1&&null}function Sn(i,r){return i!=null&&r!=null?i===!0||r===!0:i===!0||r===!0||null}function Kt(i,r){if(i==null)return null;let u=!1;for(const c of r)if(c==null)u=null;else if(i===c){u=!0;break}return u}const sn="-[]/{}()*+?.\\^$|";var it;function dc(i,r){const u=r;let c="",l=it.Normal;for(let h=0;h(pc(i)?i.attributes:i)[r]},wc=Object.freeze(Object.defineProperty({__proto__:null,WhereClause:fc,defaultAttributeAdapter:ot},Symbol.toStringTag,{value:"Module"}));export{wc as W,W as a,v as n,z as r,hc as s,d as t,fc as x}; diff --git a/dist/assets/WorkerTileHandler-9KieSe2P.js b/dist/assets/WorkerTileHandler-9KieSe2P.js deleted file mode 100644 index a1baf27..0000000 --- a/dist/assets/WorkerTileHandler-9KieSe2P.js +++ /dev/null @@ -1,2 +0,0 @@ -import{sr as ie,t_ as Le,t$ as k,u0 as me,u1 as ke,cU as ve,u2 as Se,lV as Ce,u3 as be,iZ as Ye,u4 as Ze,u5 as Pe,sp as ee,g as Je,f as He,u6 as oe}from"./index-J0iiHjMT.js";import{h as A,t as Qe,e as Xe,_ as et}from"./TileClipper-NSFZXMR1.js";import{e as Be,t as le,n as se,f as Ee,i as Ke,r as Re,a as E,T as tt,m as st,N as Y,h as ge,l as it}from"./StyleRepository-UhXfhILC.js";import{t as Oe}from"./Rect-bBBxMtVp.js";import{r as rt}from"./pbf-o0zzptPp.js";import{r as nt,c as at,i as ot}from"./TurboLine-SWK4qRwh.js";import{C as lt}from"./BidiEngine-8z8MVveq.js";import"./definitions-DqQMJYPH.js";function ht(u){return u===746||u===747||!(u<4352)&&(u>=12704&&u<=12735||u>=12544&&u<=12591||u>=65072&&u<=65103&&!(u>=65097&&u<=65103)||u>=63744&&u<=64255||u>=13056&&u<=13311||u>=11904&&u<=12031||u>=12736&&u<=12783||u>=12288&&u<=12351&&!(u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||u>=13312&&u<=19903||u>=19968&&u<=40959||u>=12800&&u<=13055||u>=12592&&u<=12687||u>=43360&&u<=43391||u>=55216&&u<=55295||u>=4352&&u<=4607||u>=44032&&u<=55215||u>=12352&&u<=12447||u>=12272&&u<=12287||u>=12688&&u<=12703||u>=12032&&u<=12255||u>=12784&&u<=12799||u>=12448&&u<=12543&&u!==12540||u>=65280&&u<=65519&&!(u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||u>=65104&&u<=65135&&!(u>=65112&&u<=65118||u>=65123&&u<=65126)||u>=5120&&u<=5759||u>=6320&&u<=6399||u>=65040&&u<=65055||u>=19904&&u<=19967||u>=40960&&u<=42127||u>=42128&&u<=42191)}function ct(u){return!(u<11904)&&(u>=12704&&u<=12735||u>=12544&&u<=12591||u>=65072&&u<=65103||u>=63744&&u<=64255||u>=13056&&u<=13311||u>=11904&&u<=12031||u>=12736&&u<=12783||u>=12288&&u<=12351||u>=13312&&u<=19903||u>=19968&&u<=40959||u>=12800&&u<=13055||u>=65280&&u<=65519||u>=12352&&u<=12447||u>=12272&&u<=12287||u>=12032&&u<=12255||u>=12784&&u<=12799||u>=12448&&u<=12543||u>=65040&&u<=65055||u>=42128&&u<=42191||u>=40960&&u<=42127)}function ut(u){switch(u){case 10:case 32:case 38:case 40:case 41:case 43:case 45:case 47:case 173:case 183:case 8203:case 8208:case 8211:case 8231:return!0}return!1}function Fe(u){switch(u){case 9:case 10:case 11:case 12:case 13:case 32:return!0}return!1}const K=24,We=17;let je=class{constructor(e,t,i,s,r,n,a){this._glyphItems=e,this._maxWidth=t,this._lineHeight=i,this._letterSpacing=s,this._hAnchor=r,this._vAnchor=n,this._justify=a}getShaping(e,t,i){const s=this._letterSpacing,r=this._lineHeight,n=this._justify,a=this._maxWidth,o=[];let c=0,h=0;for(const g of e){const I=g.codePointAt(0);if(I==null)continue;const b=i&&ht(I);let m;for(const M of this._glyphItems)if(m=M[I],m)break;o.push({codePoint:I,x:c,y:h,vertical:b,glyphMosaicItem:m}),m&&(c+=m.metrics.advance+s)}let f=c;a>0&&(f=c/Math.max(1,Math.ceil(c/a)));const l=e.includes("​"),d=[],x=o.length;for(let g=0;gb&&Fe(o[m].codePoint);)o[m].glyphMosaicItem=null,--m;if(b<=m){const M=o[b].x;for(let T=b;T<=m;T++)o[T].x-=M,o[T].y=h;let B=o[m].x;o[m].glyphMosaicItem&&(B+=o[m].glyphMosaicItem.metrics.advance),w=Math.max(B,w),n&&this._applyJustification(o,b,m)}_=I,h+=y}if(o.length>0){const g=p.length-1,I=(n-this._hAnchor)*w;let b=(-this._vAnchor*(g+1)+.5)*r;t&&g&&(b+=g*r);for(const m of o)m.x+=I,m.y+=b}return o.filter(g=>g.glyphMosaicItem)}static getTextBox(e,t){if(!e.length)return null;let i=1/0,s=1/0,r=0,n=0;for(const a of e){const o=a.glyphMosaicItem.metrics.advance,c=a.x,h=a.y-We,f=c+o,l=h+t;i=Math.min(i,c),r=Math.max(r,f),s=Math.min(s,h),n=Math.max(n,l)}return{x:i,y:s,width:r-i,height:n-s}}static getBox(e){if(!e.length)return null;let t=1/0,i=1/0,s=0,r=0;for(const n of e){const{height:a,left:o,top:c,width:h}=n.glyphMosaicItem.metrics,f=n.x,l=n.y-(a-Math.abs(c)),d=f+h+o,x=l+a;t=Math.min(t,f),s=Math.max(s,d),i=Math.min(i,l),r=Math.max(r,x)}return{x:t,y:i,width:s-t,height:r-i}}static addDecoration(e,t){const i=e.length;if(i===0)return;const s=3;let r=e[0].x+e[0].glyphMosaicItem.metrics.left,n=e[0].y;for(let o=1;o=0&&a,d=s.allowOverlap&&s.ignorePlacement?null:[],x=[],p=4,w=!l;let y=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY,g=y,I=_;const b=(l||a)&&o,m=s.size/K;let M=!1;for(const P of t)if(P.vertical){M=!0;break}let B,T=0,D=0;if(!l&&M){const P=je.getTextBox(t,s.lineHeight*K);switch(s.anchor){case k.LEFT:T=P.height/2,D=-P.width/2;break;case k.RIGHT:T=-P.height/2,D=P.width/2;break;case k.TOP:T=P.height/2,D=P.width/2;break;case k.BOTTOM:T=-P.height/2,D=-P.width/2;break;case k.TOP_LEFT:T=P.height;break;case k.BOTTOM_LEFT:D=-P.width;break;case k.TOP_RIGHT:D=P.width;break;case k.BOTTOM_RIGHT:T=-P.height}}T+=s.offset[0]*K,D+=s.offset[1]*K;for(const P of t){const S=P.glyphMosaicItem;if(!S||S.rect.isEmpty)continue;const L=S.rect,v=S.metrics,R=S.page;if(d&&w){if(B!==void 0&&B!==P.y){let C,F,N,z;M?(C=-I+T,F=y+D,N=I-g,z=_-y):(C=y+T,F=g+D,N=_-y,z=I-g);const G={xTile:e.x,yTile:e.y,dxPixels:C*m-c,dyPixels:F*m-c,hard:!s.optional,partIndex:1,width:N*m+2*c,height:z*m+2*c,angle:n,minLod:X,maxLod:se};d.push(G),y=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY,g=y,I=_}B=P.y}const Z=[];if(l){const C=.5*S.metrics.width,F=(P.x+v.left-p+C)*m*he;if(h=this._placeGlyph(e,h,F,i,e.segment,1,P.vertical,R,Z),o&&(h=this._placeGlyph(e,h,F,i,e.segment,-1,P.vertical,R,Z)),h>=Te)break}else Z.push(new _e(r,f,f,R,!1)),a&&o&&Z.push(new _e(r,f+le,f+le,R,!1));const $=P.x+v.left,j=P.y-We-v.top,J=$+v.width,we=j+v.height;let O,H,ce,ue,Q,fe,Ae,Ve;if(!l&&M)if(P.vertical){const C=($+J)/2-v.height/2,F=(j+we)/2+v.width/2;O=new A(-F-p+T,C-p+D),H=new A(O.x+L.width,O.y+L.height),ce=new A(O.x,H.y),ue=new A(H.x,O.y)}else O=new A(-j+p+T,$-p+D),H=new A(O.x-L.height,O.y+L.width),ce=new A(H.x,O.y),ue=new A(O.x,H.y);else O=new A($-p+T,j-p+D),H=new A(O.x+L.width,O.y+L.height),ce=new A(O.x,H.y),ue=new A(H.x,O.y);for(const C of Z){let F,N,z,G;if(C.alternateVerticalGlyph){if(!Q){const q=(j+we)/2+D;Q=new A(($+J)/2+T-v.height/2-p,q+v.width/2+p),fe=new A(Q.x+L.height,Q.y-L.width),Ae=new A(fe.x,Q.y),Ve=new A(Q.x,fe.y)}F=Q,N=Ae,z=Ve,G=fe}else F=O,N=ce,z=ue,G=H;const de=j,Me=we,ye=C.glyphAngle+n;if(ye!==0){const q=Math.cos(ye),xe=Math.sin(ye);F=F.clone(),N=N==null?void 0:N.clone(),z=z==null?void 0:z.clone(),G=G==null?void 0:G.clone(),F.rotate(q,xe),G==null||G.rotate(q,xe),N==null||N.rotate(q,xe),z==null||z.rotate(q,xe)}let ne=0,ae=256;if(l&&M?P.vertical?C.alternateVerticalGlyph?(ne=32,ae=96):(ne=224,ae=32):(ne=224,ae=96):(ne=192,ae=64),x.push(new ze(F,z,N,G,L,C.labelAngle,ne,ae,C.anchor,C.minzoom,C.maxzoom,C.page)),d&&(!b||this._legible(C.labelAngle))){if(w)$_&&(_=J),Me>I&&(I=Me);else if(C.minzoom=Te)return null;if(d&&w){let P,S,L,v;M?(P=-I+T,S=y+D,L=I-g,v=_-y):(P=y+T,S=g+D,L=_-y,v=I-g);const R={xTile:e.x,yTile:e.y,dxPixels:P*m-c,dyPixels:S*m-c,hard:!s.optional,partIndex:1,width:L*m+2*c,height:v*m+2*c,angle:n,minLod:X,maxLod:se};d.push(R)}const V=new Ue(x);return d&&d.length>0&&(V.textColliders=d),V}_legible(e){const t=Ke(e);return t<65||t>=193}_placeGlyph(e,t,i,s,r,n,a,o,c){let h=n;const f=h<0?Ee(e.angle+le,Re):e.angle;let l=0;i<0&&(h*=-1,i*=-1,l=le),h>0&&++r;let d=new A(e.x,e.y),x=s[r],p=se;if(s.length<=r)return p;for(;;){const w=x.x-d.x,y=x.y-d.y,_=Math.sqrt(w*w+y*y),g=Math.max(i/_,t),I=w/_,b=y/_,m=Ee(Math.atan2(b,I)+l,Re);if(c.push(new _e(d,f,m,o,!1,g,p)),a&&c.push(new _e(d,f,m,o,!0,g,p)),g<=t)return g;d=x.clone();do{if(r+=h,s.length<=r||r<0)return g;x=s[r]}while(d.isEqual(x));let M=x.x-d.x,B=x.y-d.y;const T=Math.sqrt(M*M+B*B);M*=_/T,B*=_/T,d.x-=M,d.y-=B,p=g}}};var re;(function(u){u[u.moveTo=1]="moveTo",u[u.lineTo=2]="lineTo",u[u.close=7]="close"})(re||(re={}));let dt=class{constructor(e,t){this.values={},this._geometry=void 0,this._pbfGeometry=null;const i=t.keys,s=t.values,r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:this.id=r.getUInt64();break;case 2:{const n=r.getMessage().asUnsafe(),a=this.values;for(;!n.empty();){const o=n.getUInt32(),c=n.getUInt32();a[i[o]]=s[c]}n.release();break}case 3:this.type=r.getUInt32();break;case 4:this._pbfGeometry=r.getMessage();break;default:r.skip()}}getGeometry(e){if(this._geometry!==void 0)return this._geometry;if(!this._pbfGeometry)return null;const t=this._pbfGeometry.asUnsafe();let i,s;this._pbfGeometry=null,e?e.reset(this.type):i=[];let r,n=re.moveTo,a=0,o=0,c=0;for(;!t.empty();){if(a===0){const h=t.getUInt32();n=7&h,a=h>>3}switch(a--,n){case re.moveTo:o+=t.getSInt32(),c+=t.getSInt32(),e?e.moveTo(o,c):i&&(s&&i.push(s),s=[],s.push(new A(o,c)));break;case re.lineTo:o+=t.getSInt32(),c+=t.getSInt32(),e?e.lineTo(o,c):s&&s.push(new A(o,c));break;case re.close:e?e.close():s&&!s[0].equals(o,c)&&s.push(s[0].clone());break;default:throw t.release(),new Error("Invalid path operation")}}return e?r=e.result():i&&(s&&i.push(s),r=i),t.release(),this._geometry=r,r}},te=class extends E{constructor(){super(12)}add(e,t,i){const s=this.array;s.push(e),s.push(t),s.push(i)}};class De{constructor(e){this.extent=4096,this.keys=[],this.values=[],this._pbfLayer=e.clone();const t=e.asUnsafe();for(;t.next();)switch(t.tag()){case 1:this.name=t.getString();break;case 3:this.keys.push(t.getString());break;case 4:this.values.push(t.processMessage(De._parseValue));break;case 5:this.extent=t.getUInt32();break;default:t.skip()}}getData(){return this._pbfLayer}static _parseValue(e){for(;e.next();)switch(e.tag()){case 1:return e.getString();case 2:return e.getFloat();case 3:return e.getDouble();case 4:return e.getInt64();case 5:return e.getUInt64();case 6:return e.getSInt64();case 7:return e.getBool();default:e.skip()}return null}}let yt=class extends E{constructor(e){super(e)}add(e,t,i,s,r,n,a,o,c,h,f,l){const d=this.array;let x=E.i1616to32(e,t);d.push(x);const p=31;x=E.i8888to32(Math.round(p*i),Math.round(p*s),Math.round(p*r),Math.round(p*n)),d.push(x),x=E.i8888to32(Math.round(p*a),Math.round(p*o),Math.round(p*c),Math.round(p*h)),d.push(x),x=E.i1616to32(f,0),d.push(x),l&&d.push(...l)}},xt=class extends E{constructor(e){super(e)}add(e,t,i){const s=this.array;s.push(E.i1616to32(e,t)),i&&s.push(...i)}};class gt extends E{constructor(e){super(e)}add(e,t,i,s,r,n,a){const o=this.array,c=this.index;let h=E.i1616to32(e,t);o.push(h);const f=15;return h=E.i8888to32(Math.round(f*i),Math.round(f*s),r,n),o.push(h),a&&o.push(...a),c}}class Ge extends E{constructor(e){super(e)}add(e,t,i,s,r,n,a,o,c,h,f,l){const d=this.array;let x=E.i1616to32(e,t);d.push(x),x=E.i1616to32(Math.round(8*i),Math.round(8*s)),d.push(x),x=E.i8888to32(r/4,n/4,o,c),d.push(x),x=E.i8888to32(0,Ke(a),10*h,Math.min(10*f,255)),d.push(x),l&&d.push(...l)}}class pt extends E{constructor(e){super(e)}add(e,t,i,s,r){const n=this.array,a=E.i1616to32(2*e+i,2*t+s);n.push(a),r&&n.push(...r)}}class Ie{constructor(e,t,i){this.layerExtent=4096,this._features=[],this.layer=e,this.zoom=t,this._spriteInfo=i,this._filter=e.getFeatureFilter()}pushFeature(e){this._filter&&!this._filter.filter(e,this.zoom)||this._features.push(e)}hasFeatures(){return this._features.length>0}getResources(e,t,i){}}let _t=class extends Ie{constructor(e,t,i,s,r){super(e,t,i),this.type=me.CIRCLE,this._circleVertexBuffer=s,this._circleIndexBuffer=r}get circleIndexStart(){return this._circleIndexStart}get circleIndexCount(){return this._circleIndexCount}processFeatures(e){const t=this._circleVertexBuffer,i=this._circleIndexBuffer;this._circleIndexStart=3*i.index,this._circleIndexCount=0;const s=this.layer,r=this.zoom;e&&e.setExtent(this.layerExtent);for(const n of this._features){const a=n.getGeometry(e);if(!a)continue;const o=s.circleMaterial.encodeAttributes(n,r,s);for(const c of a)if(c)for(const h of c){const f=t.index;t.add(h.x,h.y,0,0,o),t.add(h.x,h.y,0,1,o),t.add(h.x,h.y,1,0,o),t.add(h.x,h.y,1,1,o),i.add(f,f+1,f+2),i.add(f+1,f+2,f+3),this._circleIndexCount+=6}}}serialize(){let e=6;e+=this.layerUIDs.length,e+=this._circleVertexBuffer.array.length,e+=this._circleIndexBuffer.array.length;const t=new Uint32Array(e),i=new Int32Array(t.buffer);let s=0;t[s++]=this.type,t[s++]=this.layerUIDs.length;for(let r=0;rI.page-b.page);for(const{ddFillAttributes:I,ddOutlineAttributes:b,page:m,geometry:M}of d)this._processFeature(M,h,t.outlineUsesFillColor,I,b,l,m)}}else for(const d of f){const x=n?s.encodeAttributes(d,i,t):null,p=h&&a?r.encodeAttributes(d,i,t):null,w=d.getGeometry(e);this._processFeature(w,h,t.outlineUsesFillColor,x,p,l)}}serialize(){let e=10;e+=this.layerUIDs.length,e+=this._fillVertexBuffer.array.length,e+=this._fillIndexBuffer.array.length,e+=this._outlineVertexBuffer.array.length,e+=this._outlineIndexBuffer.array.length,e+=3*this._patternMap.size+1;const t=new Uint32Array(e),i=new Int32Array(t.buffer);let s=0;t[s++]=this.type,t[s++]=this.layerUIDs.length;for(let a=0;a0)for(const[a,[o,c]]of r)t[s++]=a,t[s++]=o,t[s++]=c;t[s++]=this._fillVertexBuffer.array.length;for(let a=0;ah?(f!==void 0&&this._processFill(e,f,s,n,a),f=[l]):d<-h&&f!==void 0&&f.push(l)}f!==void 0&&this._processFill(e,f,s,n,a)}_processOutline(e,t){const i=this._outlineVertexBuffer,s=this._outlineIndexBuffer,r=s.index;let n,a,o;const c=new A(0,0),h=new A(0,0),f=new A(0,0);let l=-1,d=-1,x=-1,p=-1,w=-1,y=!1;const _=0;let g=e.length;if(g<2)return;const I=e[_];let b=e[g-1];for(;g&&b.isEqual(I);)--g,b=e[g-1];if(!(g-_<2)){for(let m=_;m8&&(D=8),B>=0?(x=i.add(a.x,a.y,c.x,c.y,0,1,t),p===-1&&(p=x),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),d=i.add(a.x,a.y,D*-f.x,D*-f.y,0,-1,t),w===-1&&(w=d),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),l=d,d=x,x=i.add(a.x,a.y,f.x,f.y,0,1,t),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),d=i.add(a.x,a.y,h.x,h.y,0,1,t),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x)):(x=i.add(a.x,a.y,D*f.x,D*f.y,0,1,t),p===-1&&(p=x),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),d=i.add(a.x,a.y,-c.x,-c.y,0,-1,t),w===-1&&(w=d),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),l=d,d=x,x=i.add(a.x,a.y,-f.x,-f.y,0,-1,t),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),l=i.add(a.x,a.y,-h.x,-h.y,0,-1,t),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x))}l>=0&&d>=0&&p>=0&&!y&&s.add(l,d,p),l>=0&&p>=0&&w>=0&&!y&&s.add(l,w,p),this._outlineIndexCount+=3*(s.index-r)}}_processFill(e,t,i,s,r){s=!0;let n;t.length>1&&(n=[]);let a=0;for(const f of t)a!==0&&n.push(a),a+=e[f].length;const o=2*a,c=ke.acquire();for(const f of t){const l=e[f],d=l.length;for(let x=0;x0){const f=t.map(x=>e[x].length),{buffer:l,vertexCount:d}=nt(c,f);if(d>0){const x=this._fillVertexBuffer.index;for(let p=0;p0){const l=this._fillVertexBuffer.index;let d=0;for(;d=4160:e.y===t.y&&(e.y<=-64||e.y>=4160)}static _area(e){let t=0;const i=e.length-1;for(let s=0;sP.page-S.page),r.textured=!0;for(const{ddAttributes:P,page:S,cap:L,join:v,miterLimit:R,roundLimit:Z,halfWidth:$,offset:j,geometry:J}of V)r.capType=L,r.joinType=v,r.miterLimit=R,r.roundLimit=Z,r.halfWidth=$,r.offset=j,this._processFeature(J,P,S)}else{if(o){const V=o.getValue(i),P=this._spriteInfo[V];if(!(P!=null&&P.rect))return}r.textured=!(!o&&!c),r.capType=x,r.joinType=_,r.miterLimit=I,r.roundLimit=m,r.halfWidth=.5*B,r.offset=D;for(const V of s){const P=n?a.encodeAttributes(V,i,t):null;d&&(r.capType=d.getValue(i,V)),y&&(r.joinType=y.getValue(i,V)),g&&(r.miterLimit=g.getValue(i,V)),b&&(r.roundLimit=b.getValue(i,V)),M&&(r.halfWidth=.5*M.getValue(i,V)),T&&(r.offset=T.getValue(i,V));const S=V.getGeometry(e);this._processFeature(S,P)}}}serialize(){let e=6;e+=this.layerUIDs.length,e+=this.tessellationProperties._lineVertexBuffer.array.length,e+=this.tessellationProperties._lineIndexBuffer.array.length,e+=3*this._patternMap.size+1;const t=new Uint32Array(e),i=new Int32Array(t.buffer);let s=0;t[s++]=this.type,t[s++]=this.layerUIDs.length;for(let a=0;a0)for(const[a,[o,c]]of r)t[s++]=a,t[s++]=o,t[s++]=c;t[s++]=this.tessellationProperties._lineVertexBuffer.array.length;for(let a=0;a(e,t,i,s,r,n,a,o,c,h,f)=>(u._lineVertexBuffer.add(e,t,a,o,i,s,r,n,c,h,f,u._ddValues),u._lineVertexBuffer.index-1),bt=u=>(e,t,i)=>{u._lineIndexBuffer.add(e,t,i)},$e=10;function Pt(u,e){return u.iconMosaicItem&&e.iconMosaicItem?u.iconMosaicItem.page===e.iconMosaicItem.page?0:u.iconMosaicItem.page-e.iconMosaicItem.page:u.iconMosaicItem&&!e.iconMosaicItem?1:!u.iconMosaicItem&&e.iconMosaicItem?-1:0}class U extends Ie{constructor(e,t,i,s,r,n,a,o){super(e,t,o.getSpriteItems()),this.type=me.SYMBOL,this._markerMap=new Map,this._glyphMap=new Map,this._glyphBufferDataStorage=new Map,this._isIconSDF=!1,this._iconVertexBuffer=i,this._iconIndexBuffer=s,this._textVertexBuffer=r,this._textIndexBuffer=n,this._placementEngine=a,this._workerTileHandler=o}get markerPageMap(){return this._markerMap}get glyphsPageMap(){return this._glyphMap}get symbolInstances(){return this._symbolInstances}getResources(e,t,i){const s=this.layer,r=this.zoom;e&&e.setExtent(this.layerExtent);const n=s.getLayoutProperty("icon-image"),a=s.getLayoutProperty("text-field");let o=s.getLayoutProperty("text-transform"),c=s.getLayoutProperty("text-font");const h=[];let f,l,d,x;n&&!n.isDataDriven&&(f=n.getValue(r)),a&&!a.isDataDriven&&(l=a.getValue(r)),o&&o.isDataDriven||(d=s.getLayoutValue("text-transform",r),o=null),c&&c.isDataDriven||(x=s.getLayoutValue("text-font",r),c=null);for(const p of this._features){const w=p.getGeometry(e);if(!w||w.length===0)continue;let y,_;n&&(y=n.isDataDriven?n.getValue(r,p):this._replaceKeys(f,p.values),y&&t(y));let g=!1;if(a&&(_=a.isDataDriven?a.getValue(r,p):this._replaceKeys(l,p.values),_)){switch(_=_.replaceAll("\\n",` -`),o&&(d=o.getValue(r,p)),d){case Se.LOWERCASE:_=_.toLowerCase();break;case Se.UPPERCASE:_=_.toUpperCase()}if(U._bidiEngine.hasBidiChar(_)){let m;m=U._bidiEngine.checkContextual(_)==="rtl"?"IDNNN":"ICNNN",_=U._bidiEngine.bidiTransform(_,m,"VLYSN"),g=!0}if(_.length>0){c&&(x=c.getValue(r,p));for(const m of x){let M=i[m];M||(M=i[m]=new Set);for(const B of _){const T=B.codePointAt(0);T!=null&&M.add(T)}}}}if(!y&&!_)continue;const I=s.getLayoutValue("symbol-sort-key",r,p),b={feature:p,sprite:y,label:_,rtl:g,geometry:w,hash:(_?Ce(_):0)^(y?Ce(y):0),priority:I,textFont:x};h.push(b)}this._symbolFeatures=h}processFeatures(e){e&&e.setExtent(this.layerExtent);const t=this.layer,i=this.zoom,s=t.getLayoutValue("symbol-placement",i),r=s!==be.POINT,n=t.getLayoutValue("symbol-spacing",i)*he,a=t.getLayoutProperty("icon-image"),o=t.getLayoutProperty("text-field"),c=a?new tt(t,i,r):null,h=o?new st(t,i,r):null,f=this._workerTileHandler;let l;a&&(l=f.getSpriteItems()),this._iconIndexStart=3*this._iconIndexBuffer.index,this._textIndexStart=3*this._textIndexBuffer.index,this._iconIndexCount=0,this._textIndexCount=0,this._markerMap.clear(),this._glyphMap.clear();const d=[];let x=1;h&&h.size&&(x=h.size/K);const p=h?h.maxAngle*Be:0,w=h?h.size*he:0;for(const y of this._symbolFeatures){let _;c&&l&&y.sprite&&(_=l[y.sprite],_&&_.sdf&&(this._isIconSDF=!0));let g;_&&c.update(i,y.feature);let I=0;const b=y.label;if(b){Ye(h),h.update(i,y.feature);const m=r&&h.rotationAlignment===ie.MAP?h.keepUpright:h.writingMode&&h.writingMode.includes(Ze.VERTICAL);let M=.5;switch(h.anchor){case k.TOP_LEFT:case k.LEFT:case k.BOTTOM_LEFT:M=0;break;case k.TOP_RIGHT:case k.RIGHT:case k.BOTTOM_RIGHT:M=1}let B=.5;switch(h.anchor){case k.TOP_LEFT:case k.TOP:case k.TOP_RIGHT:B=0;break;case k.BOTTOM_LEFT:case k.BOTTOM:case k.BOTTOM_RIGHT:B=1}let T=.5;switch(h.justify){case Pe.AUTO:T=M;break;case Pe.LEFT:T=0;break;case Pe.RIGHT:T=1}const D=h.letterSpacing*K,V=r?0:h.maxWidth*K,P=h.lineHeight*K,S=y.textFont.map(L=>f.getGlyphItems(L));if(g=new je(S,V,P,D,M,B,T).getShaping(b,y.rtl,m),g&&g.length>0){let L=1e30,v=-1e30;for(const R of g)L=Math.min(L,R.x),v=Math.max(v,R.x);I=(v-L+2*K)*x*he}}for(let m of y.geometry){const M=[];if(s===be.LINE){if(g!=null&&g.length&&(h!=null&&h.size)){const B=h.size*he*(2+Math.min(2,4*Math.abs(h.offset[1])));m=U._smoothVertices(m,B)}U._pushAnchors(M,m,n,I)}else s===be.LINE_CENTER?U._pushCenterAnchor(M,m):y.feature.type===Qe.Polygon?U._pushCentroid(M,m):M.push(new pe(m[0].x,m[0].y));for(const B of M){if(B.x<0||B.x>Ne||B.y<0||B.y>Ne||r&&I>0&&(h==null?void 0:h.rotationAlignment)===ie.MAP&&!U._honorsTextMaxAngle(m,B,I,p,w))continue;const T={shaping:g,line:m,iconMosaicItem:_,anchor:B,symbolFeature:y,textColliders:[],iconColliders:[],textVertexRanges:[],iconVertexRanges:[]};d.push(T),this._processFeature(T,c,h)}}}d.sort(Pt),this._addPlacedGlyphs(),this._symbolInstances=d}serialize(){let e=11;e+=this.layerUIDs.length,e+=3*this.markerPageMap.size,e+=3*this.glyphsPageMap.size,e+=U._symbolsSerializationLength(this._symbolInstances),e+=this._iconVertexBuffer.array.length,e+=this._iconIndexBuffer.array.length,e+=this._textVertexBuffer.array.length,e+=this._textIndexBuffer.array.length;const t=new Uint32Array(e),i=new Int32Array(t.buffer),s=new Float32Array(t.buffer);let r=0;t[r++]=this.type,t[r++]=this.layerUIDs.length;for(let n=0;ns in t?t[s]:"")}_processFeature(e,t,i){const{line:s,iconMosaicItem:r,shaping:n,anchor:a}=e,o=this.zoom,c=this.layer,h=!!r;let f=!0;h&&(f=(t==null?void 0:t.optional)||!r);const l=n&&n.length>0,d=!l||(i==null?void 0:i.optional);let x,p;if(h&&(x=this._placementEngine.getIconPlacement(a,r,t)),(x||f)&&(l&&(p=this._placementEngine.getTextPlacement(a,n,s,i)),p||d)){if(x&&p||(d||f?d||p?f||x||(p=null):x=null:(x=null,p=null)),p){const w=c.hasDataDrivenText?c.textMaterial.encodeAttributes(e.symbolFeature.feature,o,c):null;if(this._storePlacedGlyphs(e,p.shapes,o,i.rotationAlignment,w),p.textColliders){e.textColliders=p.textColliders;for(const y of p.textColliders){y.minLod=Math.max(o+Y(y.minLod),0),y.maxLod=Math.min(o+Y(y.maxLod),25);const _=y.angle;if(_){const g=Math.cos(_),I=Math.sin(_),b=y.dxPixels*g-y.dyPixels*I,m=y.dxPixels*I+y.dyPixels*g,M=(y.dxPixels+y.width)*g-y.dyPixels*I,B=(y.dxPixels+y.width)*I+y.dyPixels*g,T=y.dxPixels*g-(y.dyPixels+y.height)*I,D=y.dxPixels*I+(y.dyPixels+y.height)*g,V=(y.dxPixels+y.width)*g-(y.dyPixels+y.height)*I,P=(y.dxPixels+y.width)*I+(y.dyPixels+y.height)*g,S=Math.min(b,M,T,V),L=Math.max(b,M,T,V),v=Math.min(m,B,D,P),R=Math.max(m,B,D,P);y.dxPixels=S,y.dyPixels=v,y.width=L-S,y.height=R-v}}}}if(x){const w=c.hasDataDrivenIcon?c.iconMaterial.encodeAttributes(e.symbolFeature.feature,o,c):null;if(this._addPlacedIcons(e,x.shapes,o,r.page,t.rotationAlignment===ie.VIEWPORT,w),x.iconColliders){e.iconColliders=x.iconColliders;for(const y of x.iconColliders){y.minLod=Math.max(o+Y(y.minLod),0),y.maxLod=Math.min(o+Y(y.maxLod),25);const _=y.angle;if(_){const g=Math.cos(_),I=Math.sin(_),b=y.dxPixels*g-y.dyPixels*I,m=y.dxPixels*I+y.dyPixels*g,M=(y.dxPixels+y.width)*g-y.dyPixels*I,B=(y.dxPixels+y.width)*I+y.dyPixels*g,T=y.dxPixels*g-(y.dyPixels+y.height)*I,D=y.dxPixels*I+(y.dyPixels+y.height)*g,V=(y.dxPixels+y.width)*g-(y.dyPixels+y.height)*I,P=(y.dxPixels+y.width)*I+(y.dyPixels+y.height)*g,S=Math.min(b,M,T,V),L=Math.max(b,M,T,V),v=Math.min(m,B,D,P),R=Math.max(m,B,D,P);y.dxPixels=S,y.dyPixels=v,y.width=L-S,y.height=R-v}}}}}}_addPlacedIcons(e,t,i,s,r,n){const a=Math.max(i-1,0),o=this._iconVertexBuffer,c=this._iconIndexBuffer,h=this._markerMap;for(const f of t){const l=r?0:Math.max(i+Y(f.minzoom),a),d=r?25:Math.min(i+Y(f.maxzoom),25);if(d<=l)continue;const x=f.tl,p=f.tr,w=f.bl,y=f.br,_=f.mosaicRect,g=f.labelAngle,I=f.minAngle,b=f.maxAngle,m=f.anchor,M=o.index,B=_.x,T=_.y,D=B+_.width,V=T+_.height,P=o.index;o.add(m.x,m.y,x.x,x.y,B,T,g,I,b,l,d,n),o.add(m.x,m.y,p.x,p.y,D,T,g,I,b,l,d,n),o.add(m.x,m.y,w.x,w.y,B,V,g,I,b,l,d,n),o.add(m.x,m.y,y.x,y.y,D,V,g,I,b,l,d,n),e.iconVertexRanges.length>0&&e.iconVertexRanges[0][0]+e.iconVertexRanges[0][1]===P?e.iconVertexRanges[0][1]+=4:e.iconVertexRanges.push([P,4]),c.add(M,M+1,M+2),c.add(M+1,M+2,M+3),h.has(s)?h.get(s)[1]+=6:h.set(s,[this._iconIndexStart+this._iconIndexCount,6]),this._iconIndexCount+=6}}_addPlacedGlyphs(){const e=this._textVertexBuffer,t=this._textIndexBuffer,i=this._glyphMap;for(const[s,r]of this._glyphBufferDataStorage)for(const n of r){const a=e.index,o=n.symbolInstance,c=n.ddAttributes,h=e.index;e.add(n.glyphAnchor[0],n.glyphAnchor[1],n.tl[0],n.tl[1],n.xmin,n.ymin,n.labelAngle,n.minAngle,n.maxAngle,n.minLod,n.maxLod,c),e.add(n.glyphAnchor[0],n.glyphAnchor[1],n.tr[0],n.tr[1],n.xmax,n.ymin,n.labelAngle,n.minAngle,n.maxAngle,n.minLod,n.maxLod,c),e.add(n.glyphAnchor[0],n.glyphAnchor[1],n.bl[0],n.bl[1],n.xmin,n.ymax,n.labelAngle,n.minAngle,n.maxAngle,n.minLod,n.maxLod,c),e.add(n.glyphAnchor[0],n.glyphAnchor[1],n.br[0],n.br[1],n.xmax,n.ymax,n.labelAngle,n.minAngle,n.maxAngle,n.minLod,n.maxLod,c),o.textVertexRanges.length>0&&o.textVertexRanges[0][0]+o.textVertexRanges[0][1]===h?o.textVertexRanges[0][1]+=4:o.textVertexRanges.push([h,4]),t.add(a,a+1,a+2),t.add(a+1,a+2,a+3),i.has(s)?i.get(s)[1]+=6:i.set(s,[this._textIndexStart+this._textIndexCount,6]),this._textIndexCount+=6}this._glyphBufferDataStorage.clear()}_storePlacedGlyphs(e,t,i,s,r){const n=Math.max(i-1,0),a=s===ie.VIEWPORT;let o,c,h,f,l,d,x,p,w,y,_;for(const g of t)o=a?0:Math.max(i+Y(g.minzoom),n),c=a?25:Math.min(i+Y(g.maxzoom),25),!(c<=o)&&(h=g.tl,f=g.tr,l=g.bl,d=g.br,x=g.labelAngle,p=g.minAngle,w=g.maxAngle,y=g.anchor,_=g.mosaicRect,this._glyphBufferDataStorage.has(g.page)||this._glyphBufferDataStorage.set(g.page,[]),this._glyphBufferDataStorage.get(g.page).push({glyphAnchor:[y.x,y.y],tl:[h.x,h.y],tr:[f.x,f.y],bl:[l.x,l.y],br:[d.x,d.y],xmin:_.x,ymin:_.y,xmax:_.x+_.width,ymax:_.y+_.height,labelAngle:x,minAngle:p,maxAngle:w,minLod:o,maxLod:c,placementLod:n,symbolInstance:e,ddAttributes:r}))}static _pushAnchors(e,t,i,s){i+=s;let r=0;const n=t.length-1;for(let l=0;l-a;){if(--c,c<0)return!1;n-=A.distance(e[c],o),o=e[c]}n+=A.distance(e[c],e[c+1]);const h=[];let f=0;const l=e.length;for(;nr;)f-=h.shift().deviation;if(Math.abs(f)>s)return!1;n+=A.distance(x,w),c=p}return!0}static _smoothVertices(e,t){if(t<=0)return e;let i=e.length;if(i<3)return e;const s=[];let r=0,n=0;s.push(0);for(let p=1;p0&&(r+=w,s.push(r),n++,n!==p&&(e[n]=e[p]))}if(i=n+1,i<3)return e;t=Math.min(t,.2*r);const a=e[0].x,o=e[0].y,c=e[i-1].x,h=e[i-1].y,f=A.sub(e[0],e[1]);f.normalize(),e[0].x+=t*f.x,e[0].y+=t*f.y,f.assignSub(e[i-1],e[i-2]),f.normalize(),e[i-1].x+=t*f.x,e[i-1].y+=t*f.y,s[0]-=t,s[i-1]+=t;const l=[];l.push(new A(a,o));const d=1e-6,x=.5*t;for(let p=1;p=0;g--){const I=x+s[g+1]-s[p];if(I<0)break;const b=s[g+1]-s[g],m=s[p]-s[g]4096&&(f=4096),f<0&&(f=0),l>4096&&(l=4096),l<0&&(l=0);for(let d=1;d4096&&(x=4096),x<0&&(x=0),p>4096&&(p=4096),p<0&&(p=0),w>4096&&(w=4096),w<0&&(w=0),y>4096&&(y=4096),y<0&&(y=0);const _=(x-f)*(y-l)-(w-f)*(p-l);o+=_*(f+x+w),c+=_*(l+p+y),h+=_}o/=3*h,c/=3*h,isNaN(o)||isNaN(c)||e.push(new pe(o,c))}}U._bidiEngine=new lt;var W;(function(u){u[u.INITIALIZED=0]="INITIALIZED",u[u.NO_DATA=1]="NO_DATA",u[u.READY=2]="READY",u[u.MODIFIED=3]="MODIFIED",u[u.INVALID=4]="INVALID"})(W||(W={}));const Tt=8,Bt=14,Dt=16;class At{constructor(e,t,i,s,r){var h;if(this._pbfTiles={},this._tileClippers={},this._client=i,this._tile=t,r){this._styleLayerUIDs=new Set;for(const f of r)this._styleLayerUIDs.add(f)}this._styleRepository=s,this._layers=((h=this._styleRepository)==null?void 0:h.layers)??[];const[n,a,o]=t.tileKey.split("/").map(parseFloat);this._level=n;const c=Tt+Math.max((this._level-Bt)*Dt,0);for(const f of Object.keys(e)){const l=e[f];if(this._pbfTiles[f]=new rt(new Uint8Array(l.protobuff),new DataView(l.protobuff)),l.refKey){const[d]=l.refKey.split("/").map(parseFloat),x=n-d;if(x>0){const p=(1<{n.has(h)||(r.push({name:h,repeat:f}),n.add(h))},o={};for(const h of s)h.getResources(h.tileClipper,a,o);if(this._tile.status===W.INVALID)return[];const c=this._fetchResources(r,o,e);return Promise.all([...c,t]).then(()=>this._processFeatures(i.returnedBuckets))}_initialize(e){return{signal:e==null?void 0:e.signal,sourceNameToTileData:this._parseTileData(this._pbfTiles),layers:this._layers,zoom:this._level,sourceNameToTileClipper:this._tileClippers,sourceNameToUniqueSourceLayerBuckets:{},sourceNameToUniqueSourceLayers:{},returnedBuckets:[],layerIdToBucket:{},referencerUIDToReferencedId:new Map}}_processLayers(e){const{sourceNameToTileData:t,layers:i,zoom:s,sourceNameToTileClipper:r,sourceNameToUniqueSourceLayerBuckets:n,sourceNameToUniqueSourceLayers:a,returnedBuckets:o,layerIdToBucket:c,referencerUIDToReferencedId:h}=e;for(let f=i.length-1;f>=0;f--){const l=i[f];if(!this._canParseStyleLayer(l.uid)||l.minzoom&&s=l.maxzoom||l.type===ee.BACKGROUND||!t[l.source]||!r[l.source])continue;const d=t[l.source],x=r[l.source],p=l.sourceLayer,w=d[p];if(w){let y=a[l.source];if(y||(y=a[l.source]=new Set),y.add(l.sourceLayer),l.refLayerId)h.set(l.uid,l.refLayerId);else{const _=this._createBucket(l);if(_){_.layerUIDs=[l.uid],_.layerExtent=w.extent,_.tileClipper=x;let g=n[l.source];g||(g=n[l.source]={});let I=g[p];I||(I=g[p]=[]),I.push(_),o.push(_),c[l.id]=_}}}}}_linkReferences(e){const{layerIdToBucket:t,referencerUIDToReferencedId:i}=e;i.forEach((s,r)=>{t[s]&&t[s].layerUIDs.push(r)})}_filterFeatures(e){const{signal:t,sourceNameToTileData:i,sourceNameToUniqueSourceLayerBuckets:s,sourceNameToUniqueSourceLayers:r}=e,n=10*this._level,a=10*(this._level+1),o=[],c=[];for(const h of Object.keys(r))r[h].forEach(f=>{o.push(f),c.push(h)});for(let h=0;h=a)continue;const I=_._maxzoom;if(I&&I<=n)continue}for(const g of x)g.pushFeature(y)}}}_fetchResources(e,t,i){const s=[],r=this._tile.getWorkerTileHandler();let n,a;e.length>0&&(n=r.fetchSprites(e,this._client,i),s.push(n));for(const o in t){const c=t[o];c.size>0&&(a=r.fetchGlyphs(this._tile.tileKey,o,c,this._client,i),s.push(a))}return s}_processFeatures(e){const t=e.filter(i=>i.hasFeatures()||this._canParseStyleLayer(i.layer.uid));for(const i of t)i.processFeatures(i.tileClipper);return t}_parseTileData(e){const t={};for(const i of Object.keys(e)){const s=e[i],r={};for(;s.next();)switch(s.tag()){case 3:{const n=s.getMessage(),a=new De(n);n.release(),r[a.name]=a;break}default:s.skip()}t[i]=r}return t}_createBucket(e){switch(e.type){case ee.BACKGROUND:return null;case ee.FILL:return this._createFillBucket(e);case ee.LINE:return this._createLineBucket(e);case ee.CIRCLE:return this._createCircleBucket(e);case ee.SYMBOL:return this._createSymbolBucket(e)}}_createFillBucket(e){return new mt(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new xt(e.fillMaterial.getStride()),new te,new gt(e.outlineMaterial.getStride()),new te)}_createLineBucket(e){return new wt(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new yt(e.lineMaterial.getStride()),new te)}_createCircleBucket(e){return new _t(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new pt(e.circleMaterial.getStride()),new te)}_createSymbolBucket(e){const t=this._tile;return new U(e,this._level,new Ge(e.iconMaterial.getStride()),new te,new Ge(e.textMaterial.getStride()),new te,t.placementEngine,t.getWorkerTileHandler())}}class Vt{constructor(e,t,i,s){this.status=W.INITIALIZED,this.placementEngine=new ft,this.tileKey=e,this.refKeys=t,this._workerTileHandler=i,this._styleRepository=s}release(){this.tileKey="",this.refKeys=null,this.status=W.INITIALIZED,this._workerTileHandler=null}async parse(e,t){const i=t==null?void 0:t.signal;if(i!=null){const h=()=>{i.removeEventListener("abort",h),this.status=W.INVALID};i.addEventListener("abort",h)}let s;const r={bucketsWithData:[],emptyBuckets:null};try{s=await this._parse(e,t)}catch(h){if(He(h))throw h;return{result:r,transferList:[]}}this.status=W.READY;const n=r.bucketsWithData,a=[];for(const h of s)if(h.hasFeatures()){const f=h.serialize();n.push(f)}else a.push(h.layer.uid);const o=[...n];let c=null;return a.length>0&&(c=Uint32Array.from(a),o.push(c.buffer)),r.emptyBuckets=c,{result:r,transferList:o}}setObsolete(){this.status=W.INVALID}getLayers(){return this._workerTileHandler.getLayers()}getWorkerTileHandler(){return this._workerTileHandler}async _parse(e,t){const i=e.sourceName2DataAndRefKey;return Object.keys(i).length===0?[]:(this.status=W.MODIFIED,new At(i,this,t.client,this._styleRepository,e.styleLayerUIDs).parse(t))}}class jt{constructor(){this._spriteInfo={},this._glyphInfo={}}reset(){return this._spriteInfo={},this._glyphInfo={},Promise.resolve()}getLayers(){var e;return((e=this._styleRepository)==null?void 0:e.layers)??[]}async createTileAndParse(e,t){const{key:i}=e,s={};for(const n of Object.keys(e.sourceName2DataAndRefKey)){const a=e.sourceName2DataAndRefKey[n];s[n]=a.refKey}const r=new Vt(i,s,this,this._styleRepository);try{return await r.parse(e,t)}catch(n){if(r.setObsolete(),r.release(),!He(n))throw n;return null}}updateStyle(e){if(!e||e.length===0||!this._styleRepository)return;const t=this._styleRepository;for(const i of e){const s=i.type,r=i.data;switch(s){case oe.PAINTER_CHANGED:t.setPaintProperties(r.layer,r.paint);break;case oe.LAYOUT_CHANGED:t.setLayoutProperties(r.layer,r.layout);break;case oe.LAYER_REMOVED:t.deleteStyleLayer(r.layer);break;case oe.LAYER_CHANGED:t.setStyleLayer(r.layer,r.index);break;case oe.SPRITES_CHANGED:this._spriteInfo={}}}}setStyle(e){this._styleRepository=new it(e),this._spriteInfo={},this._glyphInfo={}}fetchSprites(e,t,i){const s=[],r=this._spriteInfo;for(const n of e)r[n.name]===void 0&&s.push(n);return s.length===0?Promise.resolve():t.invoke("getSprites",s,{signal:i==null?void 0:i.signal}).then(n=>{for(const a in n){const o=n[a];r[a]=o}})}getSpriteItems(){return this._spriteInfo}fetchGlyphs(e,t,i,s,r){const n=[];let a=this._glyphInfo[t];return a?i.forEach(o=>{a[o]||n.push(o)}):(a=this._glyphInfo[t]=[],i.forEach(o=>n.push(o))),n.length===0?Promise.resolve():s.invoke("getGlyphs",{tileID:e,font:t,codePoints:n},r).then(o=>{for(let c=0;c=12704&&u<=12735||u>=12544&&u<=12591||u>=65072&&u<=65103&&!(u>=65097&&u<=65103)||u>=63744&&u<=64255||u>=13056&&u<=13311||u>=11904&&u<=12031||u>=12736&&u<=12783||u>=12288&&u<=12351&&!(u>=12296&&u<=12305||u>=12308&&u<=12319||u===12336)||u>=13312&&u<=19903||u>=19968&&u<=40959||u>=12800&&u<=13055||u>=12592&&u<=12687||u>=43360&&u<=43391||u>=55216&&u<=55295||u>=4352&&u<=4607||u>=44032&&u<=55215||u>=12352&&u<=12447||u>=12272&&u<=12287||u>=12688&&u<=12703||u>=12032&&u<=12255||u>=12784&&u<=12799||u>=12448&&u<=12543&&u!==12540||u>=65280&&u<=65519&&!(u===65288||u===65289||u===65293||u>=65306&&u<=65310||u===65339||u===65341||u===65343||u>=65371&&u<=65503||u===65507||u>=65512&&u<=65519)||u>=65104&&u<=65135&&!(u>=65112&&u<=65118||u>=65123&&u<=65126)||u>=5120&&u<=5759||u>=6320&&u<=6399||u>=65040&&u<=65055||u>=19904&&u<=19967||u>=40960&&u<=42127||u>=42128&&u<=42191)}function ct(u){return!(u<11904)&&(u>=12704&&u<=12735||u>=12544&&u<=12591||u>=65072&&u<=65103||u>=63744&&u<=64255||u>=13056&&u<=13311||u>=11904&&u<=12031||u>=12736&&u<=12783||u>=12288&&u<=12351||u>=13312&&u<=19903||u>=19968&&u<=40959||u>=12800&&u<=13055||u>=65280&&u<=65519||u>=12352&&u<=12447||u>=12272&&u<=12287||u>=12032&&u<=12255||u>=12784&&u<=12799||u>=12448&&u<=12543||u>=65040&&u<=65055||u>=42128&&u<=42191||u>=40960&&u<=42127)}function ut(u){switch(u){case 10:case 32:case 38:case 40:case 41:case 43:case 45:case 47:case 173:case 183:case 8203:case 8208:case 8211:case 8231:return!0}return!1}function Fe(u){switch(u){case 9:case 10:case 11:case 12:case 13:case 32:return!0}return!1}const K=24,We=17;let je=class{constructor(e,t,i,s,r,n,a){this._glyphItems=e,this._maxWidth=t,this._lineHeight=i,this._letterSpacing=s,this._hAnchor=r,this._vAnchor=n,this._justify=a}getShaping(e,t,i){const s=this._letterSpacing,r=this._lineHeight,n=this._justify,a=this._maxWidth,o=[];let c=0,h=0;for(const g of e){const I=g.codePointAt(0);if(I==null)continue;const b=i&&ht(I);let m;for(const M of this._glyphItems)if(m=M[I],m)break;o.push({codePoint:I,x:c,y:h,vertical:b,glyphMosaicItem:m}),m&&(c+=m.metrics.advance+s)}let f=c;a>0&&(f=c/Math.max(1,Math.ceil(c/a)));const l=e.includes("​"),d=[],x=o.length;for(let g=0;gb&&Fe(o[m].codePoint);)o[m].glyphMosaicItem=null,--m;if(b<=m){const M=o[b].x;for(let T=b;T<=m;T++)o[T].x-=M,o[T].y=h;let B=o[m].x;o[m].glyphMosaicItem&&(B+=o[m].glyphMosaicItem.metrics.advance),w=Math.max(B,w),n&&this._applyJustification(o,b,m)}_=I,h+=y}if(o.length>0){const g=p.length-1,I=(n-this._hAnchor)*w;let b=(-this._vAnchor*(g+1)+.5)*r;t&&g&&(b+=g*r);for(const m of o)m.x+=I,m.y+=b}return o.filter(g=>g.glyphMosaicItem)}static getTextBox(e,t){if(!e.length)return null;let i=1/0,s=1/0,r=0,n=0;for(const a of e){const o=a.glyphMosaicItem.metrics.advance,c=a.x,h=a.y-We,f=c+o,l=h+t;i=Math.min(i,c),r=Math.max(r,f),s=Math.min(s,h),n=Math.max(n,l)}return{x:i,y:s,width:r-i,height:n-s}}static getBox(e){if(!e.length)return null;let t=1/0,i=1/0,s=0,r=0;for(const n of e){const{height:a,left:o,top:c,width:h}=n.glyphMosaicItem.metrics,f=n.x,l=n.y-(a-Math.abs(c)),d=f+h+o,x=l+a;t=Math.min(t,f),s=Math.max(s,d),i=Math.min(i,l),r=Math.max(r,x)}return{x:t,y:i,width:s-t,height:r-i}}static addDecoration(e,t){const i=e.length;if(i===0)return;const s=3;let r=e[0].x+e[0].glyphMosaicItem.metrics.left,n=e[0].y;for(let o=1;o=0&&a,d=s.allowOverlap&&s.ignorePlacement?null:[],x=[],p=4,w=!l;let y=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY,g=y,I=_;const b=(l||a)&&o,m=s.size/K;let M=!1;for(const P of t)if(P.vertical){M=!0;break}let B,T=0,D=0;if(!l&&M){const P=je.getTextBox(t,s.lineHeight*K);switch(s.anchor){case k.LEFT:T=P.height/2,D=-P.width/2;break;case k.RIGHT:T=-P.height/2,D=P.width/2;break;case k.TOP:T=P.height/2,D=P.width/2;break;case k.BOTTOM:T=-P.height/2,D=-P.width/2;break;case k.TOP_LEFT:T=P.height;break;case k.BOTTOM_LEFT:D=-P.width;break;case k.TOP_RIGHT:D=P.width;break;case k.BOTTOM_RIGHT:T=-P.height}}T+=s.offset[0]*K,D+=s.offset[1]*K;for(const P of t){const C=P.glyphMosaicItem;if(!C||C.rect.isEmpty)continue;const V=C.rect,v=C.metrics,R=C.page;if(d&&w){if(B!==void 0&&B!==P.y){let S,F,N,z;M?(S=-I+T,F=y+D,N=I-g,z=_-y):(S=y+T,F=g+D,N=_-y,z=I-g);const G={xTile:e.x,yTile:e.y,dxPixels:S*m-c,dyPixels:F*m-c,hard:!s.optional,partIndex:1,width:N*m+2*c,height:z*m+2*c,angle:n,minLod:X,maxLod:se};d.push(G),y=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY,g=y,I=_}B=P.y}const Z=[];if(l){const S=.5*C.metrics.width,F=(P.x+v.left-p+S)*m*he;if(h=this._placeGlyph(e,h,F,i,e.segment,1,P.vertical,R,Z),o&&(h=this._placeGlyph(e,h,F,i,e.segment,-1,P.vertical,R,Z)),h>=Te)break}else Z.push(new _e(r,f,f,R,!1)),a&&o&&Z.push(new _e(r,f+le,f+le,R,!1));const $=P.x+v.left,j=P.y-We-v.top,J=$+v.width,we=j+v.height;let O,H,ce,ue,Q,fe,Ae,Le;if(!l&&M)if(P.vertical){const S=($+J)/2-v.height/2,F=(j+we)/2+v.width/2;O=new A(-F-p+T,S-p+D),H=new A(O.x+V.width,O.y+V.height),ce=new A(O.x,H.y),ue=new A(H.x,O.y)}else O=new A(-j+p+T,$-p+D),H=new A(O.x-V.height,O.y+V.width),ce=new A(H.x,O.y),ue=new A(O.x,H.y);else O=new A($-p+T,j-p+D),H=new A(O.x+V.width,O.y+V.height),ce=new A(O.x,H.y),ue=new A(H.x,O.y);for(const S of Z){let F,N,z,G;if(S.alternateVerticalGlyph){if(!Q){const q=(j+we)/2+D;Q=new A(($+J)/2+T-v.height/2-p,q+v.width/2+p),fe=new A(Q.x+V.height,Q.y-V.width),Ae=new A(fe.x,Q.y),Le=new A(Q.x,fe.y)}F=Q,N=Ae,z=Le,G=fe}else F=O,N=ce,z=ue,G=H;const de=j,Me=we,ye=S.glyphAngle+n;if(ye!==0){const q=Math.cos(ye),xe=Math.sin(ye);F=F.clone(),N=N==null?void 0:N.clone(),z=z==null?void 0:z.clone(),G=G==null?void 0:G.clone(),F.rotate(q,xe),G==null||G.rotate(q,xe),N==null||N.rotate(q,xe),z==null||z.rotate(q,xe)}let ne=0,ae=256;if(l&&M?P.vertical?S.alternateVerticalGlyph?(ne=32,ae=96):(ne=224,ae=32):(ne=224,ae=96):(ne=192,ae=64),x.push(new ze(F,z,N,G,V,S.labelAngle,ne,ae,S.anchor,S.minzoom,S.maxzoom,S.page)),d&&(!b||this._legible(S.labelAngle))){if(w)$_&&(_=J),Me>I&&(I=Me);else if(S.minzoom=Te)return null;if(d&&w){let P,C,V,v;M?(P=-I+T,C=y+D,V=I-g,v=_-y):(P=y+T,C=g+D,V=_-y,v=I-g);const R={xTile:e.x,yTile:e.y,dxPixels:P*m-c,dyPixels:C*m-c,hard:!s.optional,partIndex:1,width:V*m+2*c,height:v*m+2*c,angle:n,minLod:X,maxLod:se};d.push(R)}const L=new Ue(x);return d&&d.length>0&&(L.textColliders=d),L}_legible(e){const t=Ke(e);return t<65||t>=193}_placeGlyph(e,t,i,s,r,n,a,o,c){let h=n;const f=h<0?Ee(e.angle+le,Re):e.angle;let l=0;i<0&&(h*=-1,i*=-1,l=le),h>0&&++r;let d=new A(e.x,e.y),x=s[r],p=se;if(s.length<=r)return p;for(;;){const w=x.x-d.x,y=x.y-d.y,_=Math.sqrt(w*w+y*y),g=Math.max(i/_,t),I=w/_,b=y/_,m=Ee(Math.atan2(b,I)+l,Re);if(c.push(new _e(d,f,m,o,!1,g,p)),a&&c.push(new _e(d,f,m,o,!0,g,p)),g<=t)return g;d=x.clone();do{if(r+=h,s.length<=r||r<0)return g;x=s[r]}while(d.isEqual(x));let M=x.x-d.x,B=x.y-d.y;const T=Math.sqrt(M*M+B*B);M*=_/T,B*=_/T,d.x-=M,d.y-=B,p=g}}};var re;(function(u){u[u.moveTo=1]="moveTo",u[u.lineTo=2]="lineTo",u[u.close=7]="close"})(re||(re={}));let dt=class{constructor(e,t){this.values={},this._geometry=void 0,this._pbfGeometry=null;const i=t.keys,s=t.values,r=e.asUnsafe();for(;r.next();)switch(r.tag()){case 1:this.id=r.getUInt64();break;case 2:{const n=r.getMessage().asUnsafe(),a=this.values;for(;!n.empty();){const o=n.getUInt32(),c=n.getUInt32();a[i[o]]=s[c]}n.release();break}case 3:this.type=r.getUInt32();break;case 4:this._pbfGeometry=r.getMessage();break;default:r.skip()}}getGeometry(e){if(this._geometry!==void 0)return this._geometry;if(!this._pbfGeometry)return null;const t=this._pbfGeometry.asUnsafe();let i,s;this._pbfGeometry=null,e?e.reset(this.type):i=[];let r,n=re.moveTo,a=0,o=0,c=0;for(;!t.empty();){if(a===0){const h=t.getUInt32();n=7&h,a=h>>3}switch(a--,n){case re.moveTo:o+=t.getSInt32(),c+=t.getSInt32(),e?e.moveTo(o,c):i&&(s&&i.push(s),s=[],s.push(new A(o,c)));break;case re.lineTo:o+=t.getSInt32(),c+=t.getSInt32(),e?e.lineTo(o,c):s&&s.push(new A(o,c));break;case re.close:e?e.close():s&&!s[0].equals(o,c)&&s.push(s[0].clone());break;default:throw t.release(),new Error("Invalid path operation")}}return e?r=e.result():i&&(s&&i.push(s),r=i),t.release(),this._geometry=r,r}},te=class extends E{constructor(){super(12)}add(e,t,i){const s=this.array;s.push(e),s.push(t),s.push(i)}};class De{constructor(e){this.extent=4096,this.keys=[],this.values=[],this._pbfLayer=e.clone();const t=e.asUnsafe();for(;t.next();)switch(t.tag()){case 1:this.name=t.getString();break;case 3:this.keys.push(t.getString());break;case 4:this.values.push(t.processMessage(De._parseValue));break;case 5:this.extent=t.getUInt32();break;default:t.skip()}}getData(){return this._pbfLayer}static _parseValue(e){for(;e.next();)switch(e.tag()){case 1:return e.getString();case 2:return e.getFloat();case 3:return e.getDouble();case 4:return e.getInt64();case 5:return e.getUInt64();case 6:return e.getSInt64();case 7:return e.getBool();default:e.skip()}return null}}let yt=class extends E{constructor(e){super(e)}add(e,t,i,s,r,n,a,o,c,h,f,l){const d=this.array;let x=E.i1616to32(e,t);d.push(x);const p=31;x=E.i8888to32(Math.round(p*i),Math.round(p*s),Math.round(p*r),Math.round(p*n)),d.push(x),x=E.i8888to32(Math.round(p*a),Math.round(p*o),Math.round(p*c),Math.round(p*h)),d.push(x),x=E.i1616to32(f,0),d.push(x),l&&d.push(...l)}},xt=class extends E{constructor(e){super(e)}add(e,t,i){const s=this.array;s.push(E.i1616to32(e,t)),i&&s.push(...i)}};class gt extends E{constructor(e){super(e)}add(e,t,i,s,r,n,a){const o=this.array,c=this.index;let h=E.i1616to32(e,t);o.push(h);const f=15;return h=E.i8888to32(Math.round(f*i),Math.round(f*s),r,n),o.push(h),a&&o.push(...a),c}}class Ge extends E{constructor(e){super(e)}add(e,t,i,s,r,n,a,o,c,h,f,l){const d=this.array;let x=E.i1616to32(e,t);d.push(x),x=E.i1616to32(Math.round(8*i),Math.round(8*s)),d.push(x),x=E.i8888to32(r/4,n/4,o,c),d.push(x),x=E.i8888to32(0,Ke(a),10*h,Math.min(10*f,255)),d.push(x),l&&d.push(...l)}}class pt extends E{constructor(e){super(e)}add(e,t,i,s,r){const n=this.array,a=E.i1616to32(2*e+i,2*t+s);n.push(a),r&&n.push(...r)}}class Ie{constructor(e,t,i){this.layerExtent=4096,this._features=[],this.layer=e,this.zoom=t,this._spriteInfo=i,this._filter=e.getFeatureFilter()}pushFeature(e){this._filter&&!this._filter.filter(e,this.zoom)||this._features.push(e)}hasFeatures(){return this._features.length>0}getResources(e,t,i){}}let _t=class extends Ie{constructor(e,t,i,s,r){super(e,t,i),this.type=me.CIRCLE,this._circleVertexBuffer=s,this._circleIndexBuffer=r}get circleIndexStart(){return this._circleIndexStart}get circleIndexCount(){return this._circleIndexCount}processFeatures(e){const t=this._circleVertexBuffer,i=this._circleIndexBuffer;this._circleIndexStart=3*i.index,this._circleIndexCount=0;const s=this.layer,r=this.zoom;e&&e.setExtent(this.layerExtent);for(const n of this._features){const a=n.getGeometry(e);if(!a)continue;const o=s.circleMaterial.encodeAttributes(n,r,s);for(const c of a)if(c)for(const h of c){const f=t.index;t.add(h.x,h.y,0,0,o),t.add(h.x,h.y,0,1,o),t.add(h.x,h.y,1,0,o),t.add(h.x,h.y,1,1,o),i.add(f,f+1,f+2),i.add(f+1,f+2,f+3),this._circleIndexCount+=6}}}serialize(){let e=6;e+=this.layerUIDs.length,e+=this._circleVertexBuffer.array.length,e+=this._circleIndexBuffer.array.length;const t=new Uint32Array(e),i=new Int32Array(t.buffer);let s=0;t[s++]=this.type,t[s++]=this.layerUIDs.length;for(let r=0;rI.page-b.page);for(const{ddFillAttributes:I,ddOutlineAttributes:b,page:m,geometry:M}of d)this._processFeature(M,h,t.outlineUsesFillColor,I,b,l,m)}}else for(const d of f){const x=n?s.encodeAttributes(d,i,t):null,p=h&&a?r.encodeAttributes(d,i,t):null,w=d.getGeometry(e);this._processFeature(w,h,t.outlineUsesFillColor,x,p,l)}}serialize(){let e=10;e+=this.layerUIDs.length,e+=this._fillVertexBuffer.array.length,e+=this._fillIndexBuffer.array.length,e+=this._outlineVertexBuffer.array.length,e+=this._outlineIndexBuffer.array.length,e+=3*this._patternMap.size+1;const t=new Uint32Array(e),i=new Int32Array(t.buffer);let s=0;t[s++]=this.type,t[s++]=this.layerUIDs.length;for(let a=0;a0)for(const[a,[o,c]]of r)t[s++]=a,t[s++]=o,t[s++]=c;t[s++]=this._fillVertexBuffer.array.length;for(let a=0;ah?(f!==void 0&&this._processFill(e,f,s,n,a),f=[l]):d<-h&&f!==void 0&&f.push(l)}f!==void 0&&this._processFill(e,f,s,n,a)}_processOutline(e,t){const i=this._outlineVertexBuffer,s=this._outlineIndexBuffer,r=s.index;let n,a,o;const c=new A(0,0),h=new A(0,0),f=new A(0,0);let l=-1,d=-1,x=-1,p=-1,w=-1,y=!1;const _=0;let g=e.length;if(g<2)return;const I=e[_];let b=e[g-1];for(;g&&b.isEqual(I);)--g,b=e[g-1];if(!(g-_<2)){for(let m=_;m8&&(D=8),B>=0?(x=i.add(a.x,a.y,c.x,c.y,0,1,t),p===-1&&(p=x),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),d=i.add(a.x,a.y,D*-f.x,D*-f.y,0,-1,t),w===-1&&(w=d),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),l=d,d=x,x=i.add(a.x,a.y,f.x,f.y,0,1,t),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),d=i.add(a.x,a.y,h.x,h.y,0,1,t),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x)):(x=i.add(a.x,a.y,D*f.x,D*f.y,0,1,t),p===-1&&(p=x),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),d=i.add(a.x,a.y,-c.x,-c.y,0,-1,t),w===-1&&(w=d),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),l=d,d=x,x=i.add(a.x,a.y,-f.x,-f.y,0,-1,t),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x),l=i.add(a.x,a.y,-h.x,-h.y,0,-1,t),l>=0&&d>=0&&x>=0&&!M&&s.add(l,d,x))}l>=0&&d>=0&&p>=0&&!y&&s.add(l,d,p),l>=0&&p>=0&&w>=0&&!y&&s.add(l,w,p),this._outlineIndexCount+=3*(s.index-r)}}_processFill(e,t,i,s,r){s=!0;let n;t.length>1&&(n=[]);let a=0;for(const f of t)a!==0&&n.push(a),a+=e[f].length;const o=2*a,c=ke.acquire();for(const f of t){const l=e[f],d=l.length;for(let x=0;x0){const f=t.map(x=>e[x].length),{buffer:l,vertexCount:d}=nt(c,f);if(d>0){const x=this._fillVertexBuffer.index;for(let p=0;p0){const l=this._fillVertexBuffer.index;let d=0;for(;d=4160:e.y===t.y&&(e.y<=-64||e.y>=4160)}static _area(e){let t=0;const i=e.length-1;for(let s=0;sP.page-C.page),r.textured=!0;for(const{ddAttributes:P,page:C,cap:V,join:v,miterLimit:R,roundLimit:Z,halfWidth:$,offset:j,geometry:J}of L)r.capType=V,r.joinType=v,r.miterLimit=R,r.roundLimit=Z,r.halfWidth=$,r.offset=j,this._processFeature(J,P,C)}else{if(o){const L=o.getValue(i),P=this._spriteInfo[L];if(!(P!=null&&P.rect))return}r.textured=!(!o&&!c),r.capType=x,r.joinType=_,r.miterLimit=I,r.roundLimit=m,r.halfWidth=.5*B,r.offset=D;for(const L of s){const P=n?a.encodeAttributes(L,i,t):null;d&&(r.capType=d.getValue(i,L)),y&&(r.joinType=y.getValue(i,L)),g&&(r.miterLimit=g.getValue(i,L)),b&&(r.roundLimit=b.getValue(i,L)),M&&(r.halfWidth=.5*M.getValue(i,L)),T&&(r.offset=T.getValue(i,L));const C=L.getGeometry(e);this._processFeature(C,P)}}}serialize(){let e=6;e+=this.layerUIDs.length,e+=this.tessellationProperties._lineVertexBuffer.array.length,e+=this.tessellationProperties._lineIndexBuffer.array.length,e+=3*this._patternMap.size+1;const t=new Uint32Array(e),i=new Int32Array(t.buffer);let s=0;t[s++]=this.type,t[s++]=this.layerUIDs.length;for(let a=0;a0)for(const[a,[o,c]]of r)t[s++]=a,t[s++]=o,t[s++]=c;t[s++]=this.tessellationProperties._lineVertexBuffer.array.length;for(let a=0;a(e,t,i,s,r,n,a,o,c,h,f)=>(u._lineVertexBuffer.add(e,t,a,o,i,s,r,n,c,h,f,u._ddValues),u._lineVertexBuffer.index-1),bt=u=>(e,t,i)=>{u._lineIndexBuffer.add(e,t,i)},$e=10;function Pt(u,e){return u.iconMosaicItem&&e.iconMosaicItem?u.iconMosaicItem.page===e.iconMosaicItem.page?0:u.iconMosaicItem.page-e.iconMosaicItem.page:u.iconMosaicItem&&!e.iconMosaicItem?1:!u.iconMosaicItem&&e.iconMosaicItem?-1:0}class U extends Ie{constructor(e,t,i,s,r,n,a,o){super(e,t,o.getSpriteItems()),this.type=me.SYMBOL,this._markerMap=new Map,this._glyphMap=new Map,this._glyphBufferDataStorage=new Map,this._isIconSDF=!1,this._iconVertexBuffer=i,this._iconIndexBuffer=s,this._textVertexBuffer=r,this._textIndexBuffer=n,this._placementEngine=a,this._workerTileHandler=o}get markerPageMap(){return this._markerMap}get glyphsPageMap(){return this._glyphMap}get symbolInstances(){return this._symbolInstances}getResources(e,t,i){const s=this.layer,r=this.zoom;e&&e.setExtent(this.layerExtent);const n=s.getLayoutProperty("icon-image"),a=s.getLayoutProperty("text-field");let o=s.getLayoutProperty("text-transform"),c=s.getLayoutProperty("text-font");const h=[];let f,l,d,x;n&&!n.isDataDriven&&(f=n.getValue(r)),a&&!a.isDataDriven&&(l=a.getValue(r)),o&&o.isDataDriven||(d=s.getLayoutValue("text-transform",r),o=null),c&&c.isDataDriven||(x=s.getLayoutValue("text-font",r),c=null);for(const p of this._features){const w=p.getGeometry(e);if(!w||w.length===0)continue;let y,_;n&&(y=n.isDataDriven?n.getValue(r,p):this._replaceKeys(f,p.values),y&&t(y));let g=!1;if(a&&(_=a.isDataDriven?a.getValue(r,p):this._replaceKeys(l,p.values),_)){switch(_=_.replaceAll("\\n",` +`),o&&(d=o.getValue(r,p)),d){case Ce.LOWERCASE:_=_.toLowerCase();break;case Ce.UPPERCASE:_=_.toUpperCase()}if(U._bidiEngine.hasBidiChar(_)){let m;m=U._bidiEngine.checkContextual(_)==="rtl"?"IDNNN":"ICNNN",_=U._bidiEngine.bidiTransform(_,m,"VLYSN"),g=!0}if(_.length>0){c&&(x=c.getValue(r,p));for(const m of x){let M=i[m];M||(M=i[m]=new Set);for(const B of _){const T=B.codePointAt(0);T!=null&&M.add(T)}}}}if(!y&&!_)continue;const I=s.getLayoutValue("symbol-sort-key",r,p),b={feature:p,sprite:y,label:_,rtl:g,geometry:w,hash:(_?Se(_):0)^(y?Se(y):0),priority:I,textFont:x};h.push(b)}this._symbolFeatures=h}processFeatures(e){e&&e.setExtent(this.layerExtent);const t=this.layer,i=this.zoom,s=t.getLayoutValue("symbol-placement",i),r=s!==be.POINT,n=t.getLayoutValue("symbol-spacing",i)*he,a=t.getLayoutProperty("icon-image"),o=t.getLayoutProperty("text-field"),c=a?new st(t,i,r):null,h=o?new it(t,i,r):null,f=this._workerTileHandler;let l;a&&(l=f.getSpriteItems()),this._iconIndexStart=3*this._iconIndexBuffer.index,this._textIndexStart=3*this._textIndexBuffer.index,this._iconIndexCount=0,this._textIndexCount=0,this._markerMap.clear(),this._glyphMap.clear();const d=[];let x=1;h&&h.size&&(x=h.size/K);const p=h?h.maxAngle*Be:0,w=h?h.size*he:0;for(const y of this._symbolFeatures){let _;c&&l&&y.sprite&&(_=l[y.sprite],_&&_.sdf&&(this._isIconSDF=!0));let g;_&&c.update(i,y.feature);let I=0;const b=y.label;if(b){Ye(h),h.update(i,y.feature);const m=r&&h.rotationAlignment===ie.MAP?h.keepUpright:h.writingMode&&h.writingMode.includes(Ze.VERTICAL);let M=.5;switch(h.anchor){case k.TOP_LEFT:case k.LEFT:case k.BOTTOM_LEFT:M=0;break;case k.TOP_RIGHT:case k.RIGHT:case k.BOTTOM_RIGHT:M=1}let B=.5;switch(h.anchor){case k.TOP_LEFT:case k.TOP:case k.TOP_RIGHT:B=0;break;case k.BOTTOM_LEFT:case k.BOTTOM:case k.BOTTOM_RIGHT:B=1}let T=.5;switch(h.justify){case Pe.AUTO:T=M;break;case Pe.LEFT:T=0;break;case Pe.RIGHT:T=1}const D=h.letterSpacing*K,L=r?0:h.maxWidth*K,P=h.lineHeight*K,C=y.textFont.map(V=>f.getGlyphItems(V));if(g=new je(C,L,P,D,M,B,T).getShaping(b,y.rtl,m),g&&g.length>0){let V=1e30,v=-1e30;for(const R of g)V=Math.min(V,R.x),v=Math.max(v,R.x);I=(v-V+2*K)*x*he}}for(let m of y.geometry){const M=[];if(s===be.LINE){if(g!=null&&g.length&&(h!=null&&h.size)){const B=h.size*he*(2+Math.min(2,4*Math.abs(h.offset[1])));m=U._smoothVertices(m,B)}U._pushAnchors(M,m,n,I)}else s===be.LINE_CENTER?U._pushCenterAnchor(M,m):y.feature.type===Xe.Polygon?U._pushCentroid(M,m):M.push(new pe(m[0].x,m[0].y));for(const B of M){if(B.x<0||B.x>Ne||B.y<0||B.y>Ne||r&&I>0&&(h==null?void 0:h.rotationAlignment)===ie.MAP&&!U._honorsTextMaxAngle(m,B,I,p,w))continue;const T={shaping:g,line:m,iconMosaicItem:_,anchor:B,symbolFeature:y,textColliders:[],iconColliders:[],textVertexRanges:[],iconVertexRanges:[]};d.push(T),this._processFeature(T,c,h)}}}d.sort(Pt),this._addPlacedGlyphs(),this._symbolInstances=d}serialize(){let e=11;e+=this.layerUIDs.length,e+=3*this.markerPageMap.size,e+=3*this.glyphsPageMap.size,e+=U._symbolsSerializationLength(this._symbolInstances),e+=this._iconVertexBuffer.array.length,e+=this._iconIndexBuffer.array.length,e+=this._textVertexBuffer.array.length,e+=this._textIndexBuffer.array.length;const t=new Uint32Array(e),i=new Int32Array(t.buffer),s=new Float32Array(t.buffer);let r=0;t[r++]=this.type,t[r++]=this.layerUIDs.length;for(let n=0;ns in t?t[s]:"")}_processFeature(e,t,i){const{line:s,iconMosaicItem:r,shaping:n,anchor:a}=e,o=this.zoom,c=this.layer,h=!!r;let f=!0;h&&(f=(t==null?void 0:t.optional)||!r);const l=n&&n.length>0,d=!l||(i==null?void 0:i.optional);let x,p;if(h&&(x=this._placementEngine.getIconPlacement(a,r,t)),(x||f)&&(l&&(p=this._placementEngine.getTextPlacement(a,n,s,i)),p||d)){if(x&&p||(d||f?d||p?f||x||(p=null):x=null:(x=null,p=null)),p){const w=c.hasDataDrivenText?c.textMaterial.encodeAttributes(e.symbolFeature.feature,o,c):null;if(this._storePlacedGlyphs(e,p.shapes,o,i.rotationAlignment,w),p.textColliders){e.textColliders=p.textColliders;for(const y of p.textColliders){y.minLod=Math.max(o+Y(y.minLod),0),y.maxLod=Math.min(o+Y(y.maxLod),25);const _=y.angle;if(_){const g=Math.cos(_),I=Math.sin(_),b=y.dxPixels*g-y.dyPixels*I,m=y.dxPixels*I+y.dyPixels*g,M=(y.dxPixels+y.width)*g-y.dyPixels*I,B=(y.dxPixels+y.width)*I+y.dyPixels*g,T=y.dxPixels*g-(y.dyPixels+y.height)*I,D=y.dxPixels*I+(y.dyPixels+y.height)*g,L=(y.dxPixels+y.width)*g-(y.dyPixels+y.height)*I,P=(y.dxPixels+y.width)*I+(y.dyPixels+y.height)*g,C=Math.min(b,M,T,L),V=Math.max(b,M,T,L),v=Math.min(m,B,D,P),R=Math.max(m,B,D,P);y.dxPixels=C,y.dyPixels=v,y.width=V-C,y.height=R-v}}}}if(x){const w=c.hasDataDrivenIcon?c.iconMaterial.encodeAttributes(e.symbolFeature.feature,o,c):null;if(this._addPlacedIcons(e,x.shapes,o,r.page,t.rotationAlignment===ie.VIEWPORT,w),x.iconColliders){e.iconColliders=x.iconColliders;for(const y of x.iconColliders){y.minLod=Math.max(o+Y(y.minLod),0),y.maxLod=Math.min(o+Y(y.maxLod),25);const _=y.angle;if(_){const g=Math.cos(_),I=Math.sin(_),b=y.dxPixels*g-y.dyPixels*I,m=y.dxPixels*I+y.dyPixels*g,M=(y.dxPixels+y.width)*g-y.dyPixels*I,B=(y.dxPixels+y.width)*I+y.dyPixels*g,T=y.dxPixels*g-(y.dyPixels+y.height)*I,D=y.dxPixels*I+(y.dyPixels+y.height)*g,L=(y.dxPixels+y.width)*g-(y.dyPixels+y.height)*I,P=(y.dxPixels+y.width)*I+(y.dyPixels+y.height)*g,C=Math.min(b,M,T,L),V=Math.max(b,M,T,L),v=Math.min(m,B,D,P),R=Math.max(m,B,D,P);y.dxPixels=C,y.dyPixels=v,y.width=V-C,y.height=R-v}}}}}}_addPlacedIcons(e,t,i,s,r,n){const a=Math.max(i-1,0),o=this._iconVertexBuffer,c=this._iconIndexBuffer,h=this._markerMap;for(const f of t){const l=r?0:Math.max(i+Y(f.minzoom),a),d=r?25:Math.min(i+Y(f.maxzoom),25);if(d<=l)continue;const x=f.tl,p=f.tr,w=f.bl,y=f.br,_=f.mosaicRect,g=f.labelAngle,I=f.minAngle,b=f.maxAngle,m=f.anchor,M=o.index,B=_.x,T=_.y,D=B+_.width,L=T+_.height,P=o.index;o.add(m.x,m.y,x.x,x.y,B,T,g,I,b,l,d,n),o.add(m.x,m.y,p.x,p.y,D,T,g,I,b,l,d,n),o.add(m.x,m.y,w.x,w.y,B,L,g,I,b,l,d,n),o.add(m.x,m.y,y.x,y.y,D,L,g,I,b,l,d,n),e.iconVertexRanges.length>0&&e.iconVertexRanges[0][0]+e.iconVertexRanges[0][1]===P?e.iconVertexRanges[0][1]+=4:e.iconVertexRanges.push([P,4]),c.add(M,M+1,M+2),c.add(M+1,M+2,M+3),h.has(s)?h.get(s)[1]+=6:h.set(s,[this._iconIndexStart+this._iconIndexCount,6]),this._iconIndexCount+=6}}_addPlacedGlyphs(){const e=this._textVertexBuffer,t=this._textIndexBuffer,i=this._glyphMap;for(const[s,r]of this._glyphBufferDataStorage)for(const n of r){const a=e.index,o=n.symbolInstance,c=n.ddAttributes,h=e.index;e.add(n.glyphAnchor[0],n.glyphAnchor[1],n.tl[0],n.tl[1],n.xmin,n.ymin,n.labelAngle,n.minAngle,n.maxAngle,n.minLod,n.maxLod,c),e.add(n.glyphAnchor[0],n.glyphAnchor[1],n.tr[0],n.tr[1],n.xmax,n.ymin,n.labelAngle,n.minAngle,n.maxAngle,n.minLod,n.maxLod,c),e.add(n.glyphAnchor[0],n.glyphAnchor[1],n.bl[0],n.bl[1],n.xmin,n.ymax,n.labelAngle,n.minAngle,n.maxAngle,n.minLod,n.maxLod,c),e.add(n.glyphAnchor[0],n.glyphAnchor[1],n.br[0],n.br[1],n.xmax,n.ymax,n.labelAngle,n.minAngle,n.maxAngle,n.minLod,n.maxLod,c),o.textVertexRanges.length>0&&o.textVertexRanges[0][0]+o.textVertexRanges[0][1]===h?o.textVertexRanges[0][1]+=4:o.textVertexRanges.push([h,4]),t.add(a,a+1,a+2),t.add(a+1,a+2,a+3),i.has(s)?i.get(s)[1]+=6:i.set(s,[this._textIndexStart+this._textIndexCount,6]),this._textIndexCount+=6}this._glyphBufferDataStorage.clear()}_storePlacedGlyphs(e,t,i,s,r){const n=Math.max(i-1,0),a=s===ie.VIEWPORT;let o,c,h,f,l,d,x,p,w,y,_;for(const g of t)o=a?0:Math.max(i+Y(g.minzoom),n),c=a?25:Math.min(i+Y(g.maxzoom),25),!(c<=o)&&(h=g.tl,f=g.tr,l=g.bl,d=g.br,x=g.labelAngle,p=g.minAngle,w=g.maxAngle,y=g.anchor,_=g.mosaicRect,this._glyphBufferDataStorage.has(g.page)||this._glyphBufferDataStorage.set(g.page,[]),this._glyphBufferDataStorage.get(g.page).push({glyphAnchor:[y.x,y.y],tl:[h.x,h.y],tr:[f.x,f.y],bl:[l.x,l.y],br:[d.x,d.y],xmin:_.x,ymin:_.y,xmax:_.x+_.width,ymax:_.y+_.height,labelAngle:x,minAngle:p,maxAngle:w,minLod:o,maxLod:c,placementLod:n,symbolInstance:e,ddAttributes:r}))}static _pushAnchors(e,t,i,s){i+=s;let r=0;const n=t.length-1;for(let l=0;l-a;){if(--c,c<0)return!1;n-=A.distance(e[c],o),o=e[c]}n+=A.distance(e[c],e[c+1]);const h=[];let f=0;const l=e.length;for(;nr;)f-=h.shift().deviation;if(Math.abs(f)>s)return!1;n+=A.distance(x,w),c=p}return!0}static _smoothVertices(e,t){if(t<=0)return e;let i=e.length;if(i<3)return e;const s=[];let r=0,n=0;s.push(0);for(let p=1;p0&&(r+=w,s.push(r),n++,n!==p&&(e[n]=e[p]))}if(i=n+1,i<3)return e;t=Math.min(t,.2*r);const a=e[0].x,o=e[0].y,c=e[i-1].x,h=e[i-1].y,f=A.sub(e[0],e[1]);f.normalize(),e[0].x+=t*f.x,e[0].y+=t*f.y,f.assignSub(e[i-1],e[i-2]),f.normalize(),e[i-1].x+=t*f.x,e[i-1].y+=t*f.y,s[0]-=t,s[i-1]+=t;const l=[];l.push(new A(a,o));const d=1e-6,x=.5*t;for(let p=1;p=0;g--){const I=x+s[g+1]-s[p];if(I<0)break;const b=s[g+1]-s[g],m=s[p]-s[g]4096&&(f=4096),f<0&&(f=0),l>4096&&(l=4096),l<0&&(l=0);for(let d=1;d4096&&(x=4096),x<0&&(x=0),p>4096&&(p=4096),p<0&&(p=0),w>4096&&(w=4096),w<0&&(w=0),y>4096&&(y=4096),y<0&&(y=0);const _=(x-f)*(y-l)-(w-f)*(p-l);o+=_*(f+x+w),c+=_*(l+p+y),h+=_}o/=3*h,c/=3*h,isNaN(o)||isNaN(c)||e.push(new pe(o,c))}}U._bidiEngine=new lt;var W;(function(u){u[u.INITIALIZED=0]="INITIALIZED",u[u.NO_DATA=1]="NO_DATA",u[u.READY=2]="READY",u[u.MODIFIED=3]="MODIFIED",u[u.INVALID=4]="INVALID"})(W||(W={}));const Tt=8,Bt=14,Dt=16;class At{constructor(e,t,i,s,r){var h;if(this._pbfTiles={},this._tileClippers={},this._client=i,this._tile=t,r){this._styleLayerUIDs=new Set;for(const f of r)this._styleLayerUIDs.add(f)}this._styleRepository=s,this._layers=((h=this._styleRepository)==null?void 0:h.layers)??[];const[n,a,o]=t.tileKey.split("/").map(parseFloat);this._level=n;const c=Tt+Math.max((this._level-Bt)*Dt,0);for(const f of Object.keys(e)){const l=e[f];if(this._pbfTiles[f]=new Je(new Uint8Array(l.protobuff),new DataView(l.protobuff)),l.refKey){const[d]=l.refKey.split("/").map(parseFloat),x=n-d;if(x>0){const p=(1<{n.has(h)||(r.push({name:h,repeat:f}),n.add(h))},o={};for(const h of s)h.getResources(h.tileClipper,a,o);if(this._tile.status===W.INVALID)return[];const c=this._fetchResources(r,o,e);return Promise.all([...c,t]).then(()=>this._processFeatures(i.returnedBuckets))}_initialize(e){return{signal:e==null?void 0:e.signal,sourceNameToTileData:this._parseTileData(this._pbfTiles),layers:this._layers,zoom:this._level,sourceNameToTileClipper:this._tileClippers,sourceNameToUniqueSourceLayerBuckets:{},sourceNameToUniqueSourceLayers:{},returnedBuckets:[],layerIdToBucket:{},referencerUIDToReferencedId:new Map}}_processLayers(e){const{sourceNameToTileData:t,layers:i,zoom:s,sourceNameToTileClipper:r,sourceNameToUniqueSourceLayerBuckets:n,sourceNameToUniqueSourceLayers:a,returnedBuckets:o,layerIdToBucket:c,referencerUIDToReferencedId:h}=e;for(let f=i.length-1;f>=0;f--){const l=i[f];if(!this._canParseStyleLayer(l.uid)||l.minzoom&&s=l.maxzoom||l.type===ee.BACKGROUND||!t[l.source]||!r[l.source])continue;const d=t[l.source],x=r[l.source],p=l.sourceLayer,w=d[p];if(w){let y=a[l.source];if(y||(y=a[l.source]=new Set),y.add(l.sourceLayer),l.refLayerId)h.set(l.uid,l.refLayerId);else{const _=this._createBucket(l);if(_){_.layerUIDs=[l.uid],_.layerExtent=w.extent,_.tileClipper=x;let g=n[l.source];g||(g=n[l.source]={});let I=g[p];I||(I=g[p]=[]),I.push(_),o.push(_),c[l.id]=_}}}}}_linkReferences(e){const{layerIdToBucket:t,referencerUIDToReferencedId:i}=e;i.forEach((s,r)=>{t[s]&&t[s].layerUIDs.push(r)})}_filterFeatures(e){const{signal:t,sourceNameToTileData:i,sourceNameToUniqueSourceLayerBuckets:s,sourceNameToUniqueSourceLayers:r}=e,n=10*this._level,a=10*(this._level+1),o=[],c=[];for(const h of Object.keys(r))r[h].forEach(f=>{o.push(f),c.push(h)});for(let h=0;h=a)continue;const I=_._maxzoom;if(I&&I<=n)continue}for(const g of x)g.pushFeature(y)}}}_fetchResources(e,t,i){const s=[],r=this._tile.getWorkerTileHandler();let n,a;e.length>0&&(n=r.fetchSprites(e,this._client,i),s.push(n));for(const o in t){const c=t[o];c.size>0&&(a=r.fetchGlyphs(this._tile.tileKey,o,c,this._client,i),s.push(a))}return s}_processFeatures(e){const t=e.filter(i=>i.hasFeatures()||this._canParseStyleLayer(i.layer.uid));for(const i of t)i.processFeatures(i.tileClipper);return t}_parseTileData(e){const t={};for(const i of Object.keys(e)){const s=e[i],r={};for(;s.next();)switch(s.tag()){case 3:{const n=s.getMessage(),a=new De(n);n.release(),r[a.name]=a;break}default:s.skip()}t[i]=r}return t}_createBucket(e){switch(e.type){case ee.BACKGROUND:return null;case ee.FILL:return this._createFillBucket(e);case ee.LINE:return this._createLineBucket(e);case ee.CIRCLE:return this._createCircleBucket(e);case ee.SYMBOL:return this._createSymbolBucket(e)}}_createFillBucket(e){return new mt(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new xt(e.fillMaterial.getStride()),new te,new gt(e.outlineMaterial.getStride()),new te)}_createLineBucket(e){return new wt(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new yt(e.lineMaterial.getStride()),new te)}_createCircleBucket(e){return new _t(e,this._level,this._tile.getWorkerTileHandler().getSpriteItems(),new pt(e.circleMaterial.getStride()),new te)}_createSymbolBucket(e){const t=this._tile;return new U(e,this._level,new Ge(e.iconMaterial.getStride()),new te,new Ge(e.textMaterial.getStride()),new te,t.placementEngine,t.getWorkerTileHandler())}}class Lt{constructor(e,t,i,s){this.status=W.INITIALIZED,this.placementEngine=new ft,this.tileKey=e,this.refKeys=t,this._workerTileHandler=i,this._styleRepository=s}release(){this.tileKey="",this.refKeys=null,this.status=W.INITIALIZED,this._workerTileHandler=null}async parse(e,t){const i=t==null?void 0:t.signal;if(i!=null){const h=()=>{i.removeEventListener("abort",h),this.status=W.INVALID};i.addEventListener("abort",h)}let s;const r={bucketsWithData:[],emptyBuckets:null};try{s=await this._parse(e,t)}catch(h){if(He(h))throw h;return{result:r,transferList:[]}}this.status=W.READY;const n=r.bucketsWithData,a=[];for(const h of s)if(h.hasFeatures()){const f=h.serialize();n.push(f)}else a.push(h.layer.uid);const o=[...n];let c=null;return a.length>0&&(c=Uint32Array.from(a),o.push(c.buffer)),r.emptyBuckets=c,{result:r,transferList:o}}setObsolete(){this.status=W.INVALID}getLayers(){return this._workerTileHandler.getLayers()}getWorkerTileHandler(){return this._workerTileHandler}async _parse(e,t){const i=e.sourceName2DataAndRefKey;return Object.keys(i).length===0?[]:(this.status=W.MODIFIED,new At(i,this,t.client,this._styleRepository,e.styleLayerUIDs).parse(t))}}class Wt{constructor(){this._spriteInfo={},this._glyphInfo={}}reset(){return this._spriteInfo={},this._glyphInfo={},Promise.resolve()}getLayers(){var e;return((e=this._styleRepository)==null?void 0:e.layers)??[]}async createTileAndParse(e,t){const{key:i}=e,s={};for(const n of Object.keys(e.sourceName2DataAndRefKey)){const a=e.sourceName2DataAndRefKey[n];s[n]=a.refKey}const r=new Lt(i,s,this,this._styleRepository);try{return await r.parse(e,t)}catch(n){if(r.setObsolete(),r.release(),!He(n))throw n;return null}}updateStyle(e){if(!e||e.length===0||!this._styleRepository)return;const t=this._styleRepository;for(const i of e){const s=i.type,r=i.data;switch(s){case oe.PAINTER_CHANGED:t.setPaintProperties(r.layer,r.paint);break;case oe.LAYOUT_CHANGED:t.setLayoutProperties(r.layer,r.layout);break;case oe.LAYER_REMOVED:t.deleteStyleLayer(r.layer);break;case oe.LAYER_CHANGED:t.setStyleLayer(r.layer,r.index);break;case oe.SPRITES_CHANGED:this._spriteInfo={}}}}setStyle(e){this._styleRepository=new rt(e),this._spriteInfo={},this._glyphInfo={}}fetchSprites(e,t,i){const s=[],r=this._spriteInfo;for(const n of e)r[n.name]===void 0&&s.push(n);return s.length===0?Promise.resolve():t.invoke("getSprites",s,{signal:i==null?void 0:i.signal}).then(n=>{for(const a in n){const o=n[a];r[a]=o}})}getSpriteItems(){return this._spriteInfo}fetchGlyphs(e,t,i,s,r){const n=[];let a=this._glyphInfo[t];return a?i.forEach(o=>{a[o]||n.push(o)}):(a=this._glyphInfo[t]=[],i.forEach(o=>n.push(o))),n.length===0?Promise.resolve():s.invoke("getGlyphs",{tileID:e,font:t,codePoints:n},r).then(o=>{for(let c=0;cy(this)),this.guid=`calcite-action-${k()}`,this.indicatorId=`${this.guid}-indicator`,this.buttonId=`${this.guid}-button`,this.handleTooltipSlotChange=t=>{const i=t.target.assignedElements({flatten:!0}).filter(a=>a==null?void 0:a.matches("calcite-tooltip"))[0];i&&(i.referenceElement=this.buttonEl)},this.active=!1,this.alignment=void 0,this.appearance="solid",this.compact=!1,this.disabled=!1,this.icon=void 0,this.iconFlipRtl=!1,this.indicator=!1,this.label=void 0,this.loading=!1,this.scale="m",this.text=void 0,this.textEnabled=!1,this.messages=void 0,this.messageOverrides=void 0,this.effectiveLocale="",this.defaultMessages=void 0}onMessagesChange(){}effectiveLocaleChange(){F(this,this.effectiveLocale)}connectedCallback(){var t;z(this),S(this),H(this),(t=this.mutationObserver)==null||t.observe(this.el,{childList:!0,subtree:!0})}async componentWillLoad(){E(this),await R(this)}componentDidLoad(){L(this)}disconnectedCallback(){var t;w(this),M(this),W(this),(t=this.mutationObserver)==null||t.disconnect()}componentDidRender(){I(this)}async setFocus(){var t;await T(this),(t=this.buttonEl)==null||t.focus()}renderTextContainer(){const{text:t,textEnabled:e}=this,i={[o.textContainer]:!0,[o.textContainerVisible]:e};return t?n("div",{class:i,key:"text-container"},t):null}renderIndicatorText(){const{indicator:t,messages:e,indicatorId:i,buttonId:a}=this;return n("div",{"aria-labelledby":a,"aria-live":"polite",class:o.indicatorText,id:i,role:"region"},t?e.indicator:null)}renderIconContainer(){var r;const{loading:t,icon:e,scale:i,el:a,iconFlipRtl:l,indicator:d}=this,u=i==="l"?"l":"m",b=t?n("calcite-loader",{inline:!0,label:this.messages.loading,scale:u}):null,c=e?n("calcite-icon",{class:{[o.indicatorWithIcon]:d},flipRtl:l,icon:e,scale:$(this.scale)}):null,s=b||c,h=s||((r=a.children)==null?void 0:r.length),p=n("div",{class:{[o.slotContainer]:!0,[o.slotContainerHidden]:t}},n("slot",null));return h?n("div",{"aria-hidden":"true",class:o.iconContainer,key:"icon-container"},s,p):null}render(){const{active:t,compact:e,disabled:i,icon:a,loading:l,textEnabled:d,label:u,text:b,indicator:c,indicatorId:s,buttonId:h,messages:p}=this,r=`${u||b}${c?` (${p.indicator})`:""}`,m={[o.button]:!0,[o.buttonTextVisible]:d,[o.buttonCompact]:e};return n(C,null,n("button",{"aria-busy":f(l),"aria-controls":c?s:null,"aria-disabled":f(i),"aria-label":r,"aria-pressed":f(t),class:m,disabled:i,id:h,ref:g=>this.buttonEl=g},this.renderIconContainer(),this.renderTextContainer(),!a&&c&&n("div",{class:o.indicatorWithoutIcon,key:"indicator-no-icon"})),n("slot",{name:V.tooltip,onSlotchange:this.handleTooltipSlotChange}),this.renderIndicatorText())}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return _}},[1,"calcite-action",{active:[516],alignment:[513],appearance:[513],compact:[516],disabled:[516],icon:[1],iconFlipRtl:[516,"icon-flip-rtl"],indicator:[516],label:[1],loading:[516],scale:[513],text:[1],textEnabled:[516,"text-enabled"],messages:[1040],messageOverrides:[1040],effectiveLocale:[32],defaultMessages:[32],setFocus:[64]}]);function U(){if(typeof customElements>"u")return;["calcite-action","calcite-icon","calcite-loader"].forEach(e=>{switch(e){case"calcite-action":customElements.get(e)||customElements.define(e,A);break;case"calcite-icon":customElements.get(e)||j();break;case"calcite-loader":customElements.get(e)||D();break}})}U();export{A,U as d}; + )}.button:active{background-color:var(--calcite-ui-foreground-3)}.button .icon-container{pointer-events:none;margin:0px;display:flex;align-items:center;justify-content:center;min-inline-size:1rem;min-block-size:1rem}.button .text-container{margin:0px;inline-size:0px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.5rem;opacity:0;transition-property:opacity;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-property:margin;transition-property:inline-size}.button .text-container--visible{inline-size:auto;flex:1 1 auto;opacity:1}:host([scale=s]) .button{padding-inline:0.5rem;padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-normal)}:host([scale=s]) .button--text-visible .icon-container{margin-inline-end:0.5rem}:host([scale=m]) .button{padding-inline:1rem;padding-block:0.75rem;font-size:var(--calcite-font-size--1);line-height:1rem;font-weight:var(--calcite-font-weight-normal)}:host([scale=m]) .button--text-visible .icon-container{margin-inline-end:0.75rem}:host([scale=l]) .button{padding:1.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-weight:var(--calcite-font-weight-normal)}:host([scale=l]) .button--text-visible .icon-container{margin-inline-end:1rem}:host([alignment=center]) .button{justify-content:center}:host([alignment=end]) .button{justify-content:flex-end}:host([alignment=center]) .button .text-container--visible,:host([alignment=end]) .button .text-container--visible{flex:0 1 auto}:host([scale=s][compact]) .button,:host([scale=m][compact]) .button,:host([scale=l][compact]) .button{padding-inline:0px}.slot-container{display:flex}.slot-container--hidden{display:none}.button--text-visible{inline-size:100%}:host([active]) .button,:host([active]) .button:hover,:host([active]) .button:focus,:host([active][loading]) .button{background-color:var(--calcite-ui-foreground-3);fill:var(--calcite-ui-text-1);color:var(--calcite-ui-text-1)}:host([active]) .button:active{background-color:var(--calcite-ui-foreground-1)}:host([appearance=transparent]) .button{background-color:transparent}:host([appearance=transparent][active]) .button,:host([appearance=transparent]) .button:hover,:host([appearance=transparent]) .button:focus{background-color:var(--calcite-button-transparent-hover)}:host([appearance=transparent]) .button:active{background-color:var(--calcite-button-transparent-press)}:host([appearance=transparent][disabled]) .button{background-color:transparent}:host([loading][appearance=solid]) .button,:host([loading][appearance=solid]) .button:hover,:host([loading][appearance=solid]) .button:focus{background-color:var(--calcite-ui-foreground-1)}:host([loading][appearance=solid]) .button .text-container,:host([loading][appearance=solid]) .button:hover .text-container,:host([loading][appearance=solid]) .button:focus .text-container{opacity:var(--calcite-ui-opacity-disabled)}:host([loading]) calcite-loader[inline]{color:var(--calcite-ui-text-3);margin-inline-end:0px}:host([disabled]) .button,:host([disabled]) .button:hover,:host([disabled]) .button:focus{cursor:default;background-color:var(--calcite-ui-foreground-1);opacity:var(--calcite-ui-opacity-disabled)}:host([disabled][active]) .button,:host([disabled][active]) .button:hover,:host([disabled][active]) .button:focus{background-color:var(--calcite-ui-foreground-3);opacity:var(--calcite-ui-opacity-disabled)}:host([appearance=transparent]) .button{background-color:transparent;transition-property:box-shadow;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.indicator-with-icon{position:relative}.indicator-with-icon::after{content:"";position:absolute;block-size:0.5rem;inline-size:0.5rem;border-radius:9999px;inset-block-end:-0.275rem;inset-inline-end:-0.275rem;background-color:var(--calcite-action-indicator-color)}.indicator-without-icon{margin-inline:0.25rem;inline-size:1rem;position:relative}.indicator-without-icon::after{content:"";position:absolute;block-size:0.5rem;inline-size:0.5rem;border-radius:9999px;inset-block-end:-0.275rem;inset-inline-end:-0.275rem;background-color:var(--calcite-action-indicator-color)}.indicator-text{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}:host([hidden]){display:none}[hidden]{display:none}`,A=v(class extends x{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.mutationObserver=O("mutation",()=>y(this)),this.guid=`calcite-action-${C()}`,this.indicatorId=`${this.guid}-indicator`,this.buttonId=`${this.guid}-button`,this.handleTooltipSlotChange=t=>{const i=t.target.assignedElements({flatten:!0}).filter(a=>a==null?void 0:a.matches("calcite-tooltip"))[0];i&&(i.referenceElement=this.buttonEl)},this.active=!1,this.alignment=void 0,this.appearance="solid",this.compact=!1,this.disabled=!1,this.icon=void 0,this.iconFlipRtl=!1,this.indicator=!1,this.label=void 0,this.loading=!1,this.scale="m",this.text=void 0,this.textEnabled=!1,this.messages=void 0,this.messageOverrides=void 0,this.effectiveLocale="",this.defaultMessages=void 0}onMessagesChange(){}effectiveLocaleChange(){F(this,this.effectiveLocale)}connectedCallback(){var t;z(this),S(this),H(this),(t=this.mutationObserver)==null||t.observe(this.el,{childList:!0,subtree:!0})}async componentWillLoad(){E(this),await R(this)}componentDidLoad(){L(this)}disconnectedCallback(){var t;w(this),M(this),W(this),(t=this.mutationObserver)==null||t.disconnect()}componentDidRender(){I(this)}async setFocus(){var t;await T(this),(t=this.buttonEl)==null||t.focus()}renderTextContainer(){const{text:t,textEnabled:e}=this,i={[o.textContainer]:!0,[o.textContainerVisible]:e};return t?n("div",{class:i,key:"text-container"},t):null}renderIndicatorText(){const{indicator:t,messages:e,indicatorId:i,buttonId:a}=this;return n("div",{"aria-labelledby":a,"aria-live":"polite",class:o.indicatorText,id:i,role:"region"},t?e.indicator:null)}renderIconContainer(){var r;const{loading:t,icon:e,scale:i,el:a,iconFlipRtl:l,indicator:d}=this,u=i==="l"?"l":"m",b=t?n("calcite-loader",{inline:!0,label:this.messages.loading,scale:u}):null,c=e?n("calcite-icon",{class:{[o.indicatorWithIcon]:d},flipRtl:l,icon:e,scale:$(this.scale)}):null,s=b||c,h=s||((r=a.children)==null?void 0:r.length),p=n("div",{class:{[o.slotContainer]:!0,[o.slotContainerHidden]:t}},n("slot",null));return h?n("div",{"aria-hidden":"true",class:o.iconContainer,key:"icon-container"},s,p):null}render(){const{active:t,compact:e,disabled:i,icon:a,loading:l,textEnabled:d,label:u,text:b,indicator:c,indicatorId:s,buttonId:h,messages:p}=this,r=`${u||b}${c?` (${p.indicator})`:""}`,m={[o.button]:!0,[o.buttonTextVisible]:d,[o.buttonCompact]:e};return n(k,null,n("button",{"aria-busy":f(l),"aria-controls":c?s:null,"aria-disabled":f(i),"aria-label":r,"aria-pressed":f(t),class:m,disabled:i,id:h,ref:g=>this.buttonEl=g},this.renderIconContainer(),this.renderTextContainer(),!a&&c&&n("div",{class:o.indicatorWithoutIcon,key:"indicator-no-icon"})),n("slot",{name:V.tooltip,onSlotchange:this.handleTooltipSlotChange}),this.renderIndicatorText())}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return _}},[1,"calcite-action",{active:[516],alignment:[513],appearance:[513],compact:[516],disabled:[516],icon:[1],iconFlipRtl:[516,"icon-flip-rtl"],indicator:[516],label:[1],loading:[516],scale:[513],text:[1],textEnabled:[516,"text-enabled"],messages:[1040],messageOverrides:[1040],effectiveLocale:[32],defaultMessages:[32],setFocus:[64]}]);function U(){if(typeof customElements>"u")return;["calcite-action","calcite-icon","calcite-loader"].forEach(e=>{switch(e){case"calcite-action":customElements.get(e)||customElements.define(e,A);break;case"calcite-icon":customElements.get(e)||j();break;case"calcite-loader":customElements.get(e)||D();break}})}U();export{A,U as d}; diff --git a/dist/assets/action-group-8XaPC2xM.js b/dist/assets/action-group-6S1AUKwx.js similarity index 89% rename from dist/assets/action-group-8XaPC2xM.js rename to dist/assets/action-group-6S1AUKwx.js index ef60461..8f35ff6 100644 --- a/dist/assets/action-group-8XaPC2xM.js +++ b/dist/assets/action-group-6S1AUKwx.js @@ -1,4 +1,4 @@ -import{q as u,H as d,h7 as m,t as o}from"./index-J0iiHjMT.js";import{c as p,d as h}from"./conditionalSlot-e55zipTI.js";import{c as g,s as f,a as b}from"./loadable-sxY2K1G3.js";import{c as x,d as C}from"./locale-pfkq1d6A.js";import{u as v,c as y,d as M,s as E}from"./t9n-od6MEnI1.js";import{d as S,S as i}from"./action-menu-h_LAlWK7.js";import{d as L}from"./action-W5zDPNjG.js";import{d as O}from"./icon-ZwpY5ksA.js";import{d as k}from"./loader-QqciGs1c.js";import{d as A}from"./popover-Jm1QI0N1.js";/*! +import{p as u,H as d,h9 as m,k as o}from"./index-pCX-0tJH.js";import{c as p,d as h}from"./conditionalSlot-OgY0Ln74.js";import{c as g,s as f,a as b}from"./loadable-uNbe2Ndt.js";import{c as x,d as C}from"./locale-tKMV0J87.js";import{u as v,c as y,d as M,s as E}from"./t9n-KLe7iM0R.js";import{d as S,S as i}from"./action-menu-FiGuYhhw.js";import{d as L}from"./action-bN6v5--b.js";import{d as O}from"./icon-BW6RCrUr.js";import{d as k}from"./loader-plQ4Tft5.js";import{d as A}from"./popover-QEcoULsC.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/action-menu-h_LAlWK7.js b/dist/assets/action-menu-FiGuYhhw.js similarity index 91% rename from dist/assets/action-menu-h_LAlWK7.js rename to dist/assets/action-menu-FiGuYhhw.js index 6ea0bee..6f2a7fe 100644 --- a/dist/assets/action-menu-h_LAlWK7.js +++ b/dist/assets/action-menu-FiGuYhhw.js @@ -1,4 +1,4 @@ -import{q as g,H as E,r as v,v as x,B as c,ac as I,t as s,ad as M}from"./index-J0iiHjMT.js";import{g as b}from"./guid-6vN-YNJI.js";import{i as B}from"./key-qdHumIlA.js";import{s as A,a as C,c as w}from"./loadable-sxY2K1G3.js";import{d as D}from"./action-W5zDPNjG.js";import{d as O}from"./icon-ZwpY5ksA.js";import{d as P}from"./loader-QqciGs1c.js";import{d as y}from"./popover-Jm1QI0N1.js";/*! +import{p as g,H as E,d as v,t as x,m as c,X as I,k as s,Y as M}from"./index-pCX-0tJH.js";import{g as b}from"./guid-6vN-YNJI.js";import{i as B}from"./key-qdHumIlA.js";import{s as A,a as C,c as w}from"./loadable-uNbe2Ndt.js";import{d as D}from"./action-bN6v5--b.js";import{d as O}from"./icon-BW6RCrUr.js";import{d as P}from"./loader-plQ4Tft5.js";import{d as y}from"./popover-QEcoULsC.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 @@ -6,7 +6,7 @@ import{q as g,H as E,r as v,v as x,B as c,ac as I,t as s,ad as M}from"./index-J0 * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const r={menu:"menu",defaultTrigger:"default-trigger"},d={tooltip:"tooltip",trigger:"trigger"},S={menu:"ellipsis"},T="data-active",k=`:host{box-sizing:border-box;display:flex;flex-direction:column;font-size:var(--calcite-font-size-1);color:var(--calcite-ui-text-2)}.menu ::slotted(calcite-action){margin:0.125rem;display:flex;outline-color:transparent}.menu ::slotted(calcite-action[data-active]){outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc( + */const r={menu:"menu",defaultTrigger:"default-trigger"},d={tooltip:"tooltip",trigger:"trigger"},S={menu:"ellipsis"},k="data-active",T=`:host{box-sizing:border-box;display:flex;flex-direction:column;font-size:var(--calcite-font-size-1);color:var(--calcite-ui-text-2)}.menu ::slotted(calcite-action){margin:0.125rem;display:flex;outline-color:transparent}.menu ::slotted(calcite-action[data-active]){outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc( 2px * calc( 1 - @@ -16,4 +16,4 @@ import{q as g,H as E,r as v,v as x,B as c,ac as I,t as s,ad as M}from"./index-J0 1 ) ) - );outline-offset:0px}.default-trigger{position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}slot[name=trigger]::slotted(calcite-action),calcite-action::slotted([slot=trigger]){position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}.menu{flex-direction:column;flex-wrap:nowrap;outline:2px solid transparent;outline-offset:2px}:host([hidden]){display:none}[hidden]{display:none}`,H=["ArrowUp","ArrowDown","End","Home"],L=g(class extends E{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteActionMenuOpen=v(this,"calciteActionMenuOpen",6),this.actionElements=[],this.guid=`calcite-action-menu-${b()}`,this.menuId=`${this.guid}-menu`,this.menuButtonId=`${this.guid}-menu-button`,this.connectMenuButtonEl=()=>{const{menuButtonId:e,menuId:t,open:n,label:o}=this,i=this.slottedMenuButtonEl||this.defaultMenuButtonEl;this.menuButtonEl!==i&&(this.disconnectMenuButtonEl(),this.menuButtonEl=i,this.setTooltipReferenceElement(),i&&(i.active=n,i.setAttribute("aria-controls",t),i.setAttribute("aria-expanded",x(n)),i.setAttribute("aria-haspopup","true"),i.id||(i.id=e),i.label||(i.label=o),i.text||(i.text=o),i.addEventListener("pointerdown",this.menuButtonClick),i.addEventListener("keydown",this.menuButtonKeyDown)))},this.disconnectMenuButtonEl=()=>{const{menuButtonEl:e}=this;e&&(e.removeEventListener("pointerdown",this.menuButtonClick),e.removeEventListener("keydown",this.menuButtonKeyDown))},this.setMenuButtonEl=e=>{const t=e.target.assignedElements({flatten:!0}).filter(n=>n==null?void 0:n.matches("calcite-action"));this.slottedMenuButtonEl=t[0],this.connectMenuButtonEl()},this.setDefaultMenuButtonEl=e=>{this.defaultMenuButtonEl=e,this.connectMenuButtonEl()},this.handleCalciteActionClick=()=>{this.open=!1,this.setFocus()},this.menuButtonClick=e=>{c(e)&&this.toggleOpen()},this.updateTooltip=e=>{const t=e.target.assignedElements({flatten:!0}).filter(n=>n==null?void 0:n.matches("calcite-tooltip"));this.tooltipEl=t[0],this.setTooltipReferenceElement()},this.setTooltipReferenceElement=()=>{const{tooltipEl:e,expanded:t,menuButtonEl:n,open:o}=this;e&&(e.referenceElement=!t&&!o?n:null)},this.updateAction=(e,t)=>{const{guid:n,activeMenuItemIndex:o}=this,i=`${n}-action-${t}`;e.tabIndex=-1,e.setAttribute("role","menuitem"),e.id||(e.id=i),e.toggleAttribute(T,t===o)},this.updateActions=e=>{e==null||e.forEach(this.updateAction)},this.handleDefaultSlotChange=e=>{const t=e.target.assignedElements({flatten:!0}).filter(n=>n==null?void 0:n.matches("calcite-action"));this.actionElements=t},this.menuButtonKeyDown=e=>{const{key:t}=e,{actionElements:n,activeMenuItemIndex:o,open:i}=this;if(n.length){if(B(t)){if(e.preventDefault(),!i){this.toggleOpen();return}const a=n[o];a?a.click():this.toggleOpen(!1)}if(t==="Tab"){this.open=!1;return}if(t==="Escape"){this.toggleOpen(!1),e.preventDefault();return}this.handleActionNavigation(e,t,n)}},this.handleActionNavigation=(e,t,n)=>{if(!this.isValidKey(t,H))return;if(e.preventDefault(),!this.open){this.toggleOpen(),(t==="Home"||t==="ArrowDown")&&(this.activeMenuItemIndex=0),(t==="End"||t==="ArrowUp")&&(this.activeMenuItemIndex=n.length-1);return}t==="Home"&&(this.activeMenuItemIndex=0),t==="End"&&(this.activeMenuItemIndex=n.length-1);const o=this.activeMenuItemIndex;t==="ArrowUp"&&(this.activeMenuItemIndex=u(Math.max(o-1,-1),n.length)),t==="ArrowDown"&&(this.activeMenuItemIndex=u(o+1,n.length))},this.toggleOpenEnd=()=>{this.setFocus(),this.el.removeEventListener("calcitePopoverOpen",this.toggleOpenEnd)},this.toggleOpen=(e=!this.open)=>{this.el.addEventListener("calcitePopoverOpen",this.toggleOpenEnd),this.open=e},this.appearance="solid",this.expanded=!1,this.flipPlacements=void 0,this.label=void 0,this.open=!1,this.overlayPositioning="absolute",this.placement="auto",this.scale=void 0,this.menuButtonEl=void 0,this.activeMenuItemIndex=-1}componentWillLoad(){A(this)}componentDidLoad(){C(this)}disconnectedCallback(){this.disconnectMenuButtonEl()}expandedHandler(){this.open=!1,this.setTooltipReferenceElement()}openHandler(e){this.activeMenuItemIndex=this.open?0:-1,this.menuButtonEl&&(this.menuButtonEl.active=e),this.calciteActionMenuOpen.emit(),this.setTooltipReferenceElement()}closeCalciteActionMenuOnClick(e){!c(e)||e.composedPath().includes(this.el)||(this.open=!1)}activeMenuItemIndexHandler(){this.updateActions(this.actionElements)}async setFocus(){return await w(this),I(this.menuButtonEl)}renderMenuButton(){const{appearance:e,label:t,scale:n,expanded:o}=this;return s("slot",{name:d.trigger,onSlotchange:this.setMenuButtonEl},s("calcite-action",{appearance:e,class:r.defaultTrigger,icon:S.menu,scale:n,text:t,textEnabled:o,ref:this.setDefaultMenuButtonEl}))}renderMenuItems(){const{actionElements:e,activeMenuItemIndex:t,open:n,menuId:o,menuButtonEl:i,label:a,placement:m,overlayPositioning:h,flipPlacements:p}=this,l=e[t],f=(l==null?void 0:l.id)||null;return s("calcite-popover",{flipPlacements:p,focusTrapDisabled:!0,label:a,offsetDistance:0,open:n,overlayPositioning:h,placement:m,pointerDisabled:!0,referenceElement:i},s("div",{"aria-activedescendant":f,"aria-labelledby":i==null?void 0:i.id,class:r.menu,id:o,onClick:this.handleCalciteActionClick,role:"menu",tabIndex:-1},s("slot",{onSlotchange:this.handleDefaultSlotChange})))}render(){return s(M,null,this.renderMenuButton(),this.renderMenuItems(),s("slot",{name:d.tooltip,onSlotchange:this.updateTooltip}))}isValidKey(e,t){return!!t.find(n=>n===e)}get el(){return this}static get watchers(){return{expanded:["expandedHandler"],open:["openHandler"],activeMenuItemIndex:["activeMenuItemIndexHandler"]}}static get style(){return k}},[1,"calcite-action-menu",{appearance:[513],expanded:[516],flipPlacements:[16],label:[1],open:[1540],overlayPositioning:[513,"overlay-positioning"],placement:[513],scale:[513],menuButtonEl:[32],activeMenuItemIndex:[32],setFocus:[64]},[[9,"pointerdown","closeCalciteActionMenuOnClick"]]]);function $(){if(typeof customElements>"u")return;["calcite-action-menu","calcite-action","calcite-icon","calcite-loader","calcite-popover"].forEach(t=>{switch(t){case"calcite-action-menu":customElements.get(t)||customElements.define(t,L);break;case"calcite-action":customElements.get(t)||D();break;case"calcite-icon":customElements.get(t)||O();break;case"calcite-loader":customElements.get(t)||P();break;case"calcite-popover":customElements.get(t)||y();break}})}$();export{d as S,$ as d}; + );outline-offset:0px}.default-trigger{position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}slot[name=trigger]::slotted(calcite-action),calcite-action::slotted([slot=trigger]){position:relative;block-size:100%;flex:0 1 auto;align-self:stretch}.menu{flex-direction:column;flex-wrap:nowrap;outline:2px solid transparent;outline-offset:2px}:host([hidden]){display:none}[hidden]{display:none}`,H=["ArrowUp","ArrowDown","End","Home"],L=g(class extends E{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteActionMenuOpen=v(this,"calciteActionMenuOpen",6),this.actionElements=[],this.guid=`calcite-action-menu-${b()}`,this.menuId=`${this.guid}-menu`,this.menuButtonId=`${this.guid}-menu-button`,this.connectMenuButtonEl=()=>{const{menuButtonId:e,menuId:t,open:n,label:o}=this,i=this.slottedMenuButtonEl||this.defaultMenuButtonEl;this.menuButtonEl!==i&&(this.disconnectMenuButtonEl(),this.menuButtonEl=i,this.setTooltipReferenceElement(),i&&(i.active=n,i.setAttribute("aria-controls",t),i.setAttribute("aria-expanded",x(n)),i.setAttribute("aria-haspopup","true"),i.id||(i.id=e),i.label||(i.label=o),i.text||(i.text=o),i.addEventListener("pointerdown",this.menuButtonClick),i.addEventListener("keydown",this.menuButtonKeyDown)))},this.disconnectMenuButtonEl=()=>{const{menuButtonEl:e}=this;e&&(e.removeEventListener("pointerdown",this.menuButtonClick),e.removeEventListener("keydown",this.menuButtonKeyDown))},this.setMenuButtonEl=e=>{const t=e.target.assignedElements({flatten:!0}).filter(n=>n==null?void 0:n.matches("calcite-action"));this.slottedMenuButtonEl=t[0],this.connectMenuButtonEl()},this.setDefaultMenuButtonEl=e=>{this.defaultMenuButtonEl=e,this.connectMenuButtonEl()},this.handleCalciteActionClick=()=>{this.open=!1,this.setFocus()},this.menuButtonClick=e=>{c(e)&&this.toggleOpen()},this.updateTooltip=e=>{const t=e.target.assignedElements({flatten:!0}).filter(n=>n==null?void 0:n.matches("calcite-tooltip"));this.tooltipEl=t[0],this.setTooltipReferenceElement()},this.setTooltipReferenceElement=()=>{const{tooltipEl:e,expanded:t,menuButtonEl:n,open:o}=this;e&&(e.referenceElement=!t&&!o?n:null)},this.updateAction=(e,t)=>{const{guid:n,activeMenuItemIndex:o}=this,i=`${n}-action-${t}`;e.tabIndex=-1,e.setAttribute("role","menuitem"),e.id||(e.id=i),e.toggleAttribute(k,t===o)},this.updateActions=e=>{e==null||e.forEach(this.updateAction)},this.handleDefaultSlotChange=e=>{const t=e.target.assignedElements({flatten:!0}).filter(n=>n==null?void 0:n.matches("calcite-action"));this.actionElements=t},this.menuButtonKeyDown=e=>{const{key:t}=e,{actionElements:n,activeMenuItemIndex:o,open:i}=this;if(n.length){if(B(t)){if(e.preventDefault(),!i){this.toggleOpen();return}const a=n[o];a?a.click():this.toggleOpen(!1)}if(t==="Tab"){this.open=!1;return}if(t==="Escape"){this.toggleOpen(!1),e.preventDefault();return}this.handleActionNavigation(e,t,n)}},this.handleActionNavigation=(e,t,n)=>{if(!this.isValidKey(t,H))return;if(e.preventDefault(),!this.open){this.toggleOpen(),(t==="Home"||t==="ArrowDown")&&(this.activeMenuItemIndex=0),(t==="End"||t==="ArrowUp")&&(this.activeMenuItemIndex=n.length-1);return}t==="Home"&&(this.activeMenuItemIndex=0),t==="End"&&(this.activeMenuItemIndex=n.length-1);const o=this.activeMenuItemIndex;t==="ArrowUp"&&(this.activeMenuItemIndex=u(Math.max(o-1,-1),n.length)),t==="ArrowDown"&&(this.activeMenuItemIndex=u(o+1,n.length))},this.toggleOpenEnd=()=>{this.setFocus(),this.el.removeEventListener("calcitePopoverOpen",this.toggleOpenEnd)},this.toggleOpen=(e=!this.open)=>{this.el.addEventListener("calcitePopoverOpen",this.toggleOpenEnd),this.open=e},this.appearance="solid",this.expanded=!1,this.flipPlacements=void 0,this.label=void 0,this.open=!1,this.overlayPositioning="absolute",this.placement="auto",this.scale=void 0,this.menuButtonEl=void 0,this.activeMenuItemIndex=-1}componentWillLoad(){A(this)}componentDidLoad(){C(this)}disconnectedCallback(){this.disconnectMenuButtonEl()}expandedHandler(){this.open=!1,this.setTooltipReferenceElement()}openHandler(e){this.activeMenuItemIndex=this.open?0:-1,this.menuButtonEl&&(this.menuButtonEl.active=e),this.calciteActionMenuOpen.emit(),this.setTooltipReferenceElement()}closeCalciteActionMenuOnClick(e){!c(e)||e.composedPath().includes(this.el)||(this.open=!1)}activeMenuItemIndexHandler(){this.updateActions(this.actionElements)}async setFocus(){return await w(this),I(this.menuButtonEl)}renderMenuButton(){const{appearance:e,label:t,scale:n,expanded:o}=this;return s("slot",{name:d.trigger,onSlotchange:this.setMenuButtonEl},s("calcite-action",{appearance:e,class:r.defaultTrigger,icon:S.menu,scale:n,text:t,textEnabled:o,ref:this.setDefaultMenuButtonEl}))}renderMenuItems(){const{actionElements:e,activeMenuItemIndex:t,open:n,menuId:o,menuButtonEl:i,label:a,placement:m,overlayPositioning:h,flipPlacements:p}=this,l=e[t],f=(l==null?void 0:l.id)||null;return s("calcite-popover",{flipPlacements:p,focusTrapDisabled:!0,label:a,offsetDistance:0,open:n,overlayPositioning:h,placement:m,pointerDisabled:!0,referenceElement:i},s("div",{"aria-activedescendant":f,"aria-labelledby":i==null?void 0:i.id,class:r.menu,id:o,onClick:this.handleCalciteActionClick,role:"menu",tabIndex:-1},s("slot",{onSlotchange:this.handleDefaultSlotChange})))}render(){return s(M,null,this.renderMenuButton(),this.renderMenuItems(),s("slot",{name:d.tooltip,onSlotchange:this.updateTooltip}))}isValidKey(e,t){return!!t.find(n=>n===e)}get el(){return this}static get watchers(){return{expanded:["expandedHandler"],open:["openHandler"],activeMenuItemIndex:["activeMenuItemIndexHandler"]}}static get style(){return T}},[1,"calcite-action-menu",{appearance:[513],expanded:[516],flipPlacements:[16],label:[1],open:[1540],overlayPositioning:[513,"overlay-positioning"],placement:[513],scale:[513],menuButtonEl:[32],activeMenuItemIndex:[32],setFocus:[64]},[[9,"pointerdown","closeCalciteActionMenuOnClick"]]]);function $(){if(typeof customElements>"u")return;["calcite-action-menu","calcite-action","calcite-icon","calcite-loader","calcite-popover"].forEach(t=>{switch(t){case"calcite-action-menu":customElements.get(t)||customElements.define(t,L);break;case"calcite-action":customElements.get(t)||D();break;case"calcite-icon":customElements.get(t)||O();break;case"calcite-loader":customElements.get(t)||P();break;case"calcite-popover":customElements.get(t)||y();break}})}$();export{d as S,$ as d}; diff --git a/dist/assets/analysisViewUtils-AQaQeJpR.js b/dist/assets/analysisViewUtils-AQaQeJpR.js deleted file mode 100644 index 796beaf..0000000 --- a/dist/assets/analysisViewUtils-AQaQeJpR.js +++ /dev/null @@ -1 +0,0 @@ -import{fZ as c,b as s,w as v,ak as r,d as u,A as w}from"./index-J0iiHjMT.js";function y(t,n){t.interactive=!0;const{tool:a,view:e}=t;e.activeTool=a;let i=c(n,()=>{e.activeTool===a&&(e.activeTool=null)});return s(async o=>{await v(()=>a==null||!a.active,o),i=r(i)},n)}function $(t,n){return u(()=>t.interactive,()=>f(t,n),w)}function f(t,n){t.interactive?d(t,n):l(t)}function d(t,n){l(t);const{view:a,analysis:e}=t,i=new n({view:a,analysis:e,analysisViewData:t});return t.tool=i,a.tools.add(i),i}function l(t){const{view:n,tool:a}=t;a!=null&&(n.tools.remove(a),t.tool=null)}export{$ as a,y as l,l as v}; diff --git a/dist/assets/analysisViewUtils-lJExoyyw.js b/dist/assets/analysisViewUtils-lJExoyyw.js new file mode 100644 index 0000000..8c6eff5 --- /dev/null +++ b/dist/assets/analysisViewUtils-lJExoyyw.js @@ -0,0 +1 @@ +import{fU as s,N as c,aa as v,bq as r,B as u,T as w}from"./index-pCX-0tJH.js";function y(t,a){t.interactive=!0;const{tool:n,view:e}=t;e.activeTool=n;let i=s(a,()=>{e.activeTool===n&&(e.activeTool=null)});return c(async o=>{await v(()=>n==null||!n.active,o),i=r(i)},a)}function T(t,a){return u(()=>t.interactive,()=>f(t,a),w)}function f(t,a){t.interactive?d(t,a):l(t)}function d(t,a){l(t);const{view:n,analysis:e}=t,i=new a({view:n,analysis:e,analysisViewData:t});return t.tool=i,n.tools.add(i),i}function l(t){const{view:a,tool:n}=t;n!=null&&(a.tools.remove(n),t.tool=null)}export{T as a,y as l,l as v}; diff --git a/dist/assets/apng-_AWHiAIA.js b/dist/assets/apng-_AWHiAIA.js new file mode 100644 index 0000000..3df1ccf --- /dev/null +++ b/dist/assets/apng-_AWHiAIA.js @@ -0,0 +1 @@ +import{aR as G,ab as S,gJ as V}from"./index-pCX-0tJH.js";var R,T,k={exports:{}};k.exports,R=k,k.exports,T=function(){return function(b){var l={};function s(a){if(l[a])return l[a].exports;var h=l[a]={exports:{},id:a,loaded:!1};return b[a].call(h.exports,h,h.exports,s),h.loaded=!0,h.exports}return s.m=b,s.c=l,s.p="",s(0)}([function(b,l,s){Object.defineProperty(l,"__esModule",{value:!0}),l.isNotPNG=n,l.isNotAPNG=r,l.default=t;var a=p(s(1)),h=s(2);function p(u){return u&&u.__esModule?u:{default:u}}var y=new Error("Not a PNG"),e=new Error("Not an animated PNG");function n(u){return u===y}function r(u){return u===e}var i=new Uint8Array([137,80,78,71,13,10,26,10]);function t(u){var g=new Uint8Array(u);if(Array.prototype.some.call(i,function(L,w){return L!==g[w]}))return y;var _=!1;if(o(g,function(L){return!(_=L==="acTL")}),!_)return e;var d=[],O=[],P=null,c=null,I=0,x=new h.APNG;if(o(g,function(L,w,f,U){var F=new DataView(w.buffer);switch(L){case"IHDR":P=w.subarray(f+8,f+8+U),x.width=F.getUint32(f+8),x.height=F.getUint32(f+12);break;case"acTL":x.numPlays=F.getUint32(f+8+4);break;case"fcTL":c&&(x.frames.push(c),I++),(c=new h.Frame).width=F.getUint32(f+8+4),c.height=F.getUint32(f+8+8),c.left=F.getUint32(f+8+12),c.top=F.getUint32(f+8+16);var M=F.getUint16(f+8+20),N=F.getUint16(f+8+22);N===0&&(N=100),c.delay=1e3*M/N,c.delay<=10&&(c.delay=100),x.playTime+=c.delay,c.disposeOp=F.getUint8(f+8+24),c.blendOp=F.getUint8(f+8+25),c.dataParts=[],I===0&&c.disposeOp===2&&(c.disposeOp=1);break;case"fdAT":c&&c.dataParts.push(w.subarray(f+8+4,f+8+U));break;case"IDAT":c&&c.dataParts.push(w.subarray(f+8,f+8+U));break;case"IEND":O.push(E(w,f,12+U));break;default:d.push(E(w,f,12+U))}}),c&&x.frames.push(c),x.frames.length==0)return e;var j=new Blob(d),C=new Blob(O);return x.frames.forEach(function(L){var w=[];w.push(i),P.set(D(L.width),0),P.set(D(L.height),4),w.push(A("IHDR",P)),w.push(j),L.dataParts.forEach(function(f){return w.push(A("IDAT",f))}),w.push(C),L.imageData=new Blob(w,{type:"image/png"}),delete L.dataParts,w=null}),x}function o(u,g){var _=new DataView(u.buffer),d=8,O=void 0,P=void 0,c=void 0;do P=_.getUint32(d),c=g(O=v(u,d+4,4),u,d,P),d+=12+P;while(c!==!1&&O!="IEND"&&d>>24&255,u>>>16&255,u>>>8&255,255&u])}},function(b,l){Object.defineProperty(l,"__esModule",{value:!0}),l.default=function(y){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=e,i=e+(arguments.length>2&&arguments[2]!==void 0?arguments[2]:y.length-e);r>>8^s[255&(n^y[r])];return-1^n};for(var s=new Uint32Array(256),a=0;a<256;a++){for(var h=a,p=0;p<8;p++)h=1&h?3988292384^h>>>1:h>>>1;s[a]=h}},function(b,l,s){Object.defineProperty(l,"__esModule",{value:!0}),l.Frame=l.APNG=void 0;var a=function(){function e(n,r){for(var i=0;i1&&arguments[1]!==void 0&&arguments[1];return this.createImages().then(function(){return new h.default(r,n,i)})}}]),e}(),l.Frame=function(){function e(){y(this,e),this.left=0,this.top=0,this.width=0,this.height=0,this.delay=0,this.disposeOp=0,this.blendOp=0,this.imageData=null,this.imageElement=null}return a(e,[{key:"createImage",value:function(){var n=this;return this.imageElement?Promise.resolve():new Promise(function(r,i){var t=URL.createObjectURL(n.imageData);n.imageElement=document.createElement("img"),n.imageElement.onload=function(){URL.revokeObjectURL(t),r()},n.imageElement.onerror=function(){URL.revokeObjectURL(t),n.imageElement=null,i(new Error("Image creation error"))},n.imageElement.src=t})}}]),e}()},function(b,l,s){Object.defineProperty(l,"__esModule",{value:!0});var a=function(){function r(i,t){for(var o=0;o=this._apng.numPlays&&(this._ended=!0,this._paused=!0)),this._prevFrame&&this._prevFrame.disposeOp==1?this.context.clearRect(this._prevFrame.left,this._prevFrame.top,this._prevFrame.width,this._prevFrame.height):this._prevFrame&&this._prevFrame.disposeOp==2&&this.context.putImageData(this._prevFrameData,this._prevFrame.left,this._prevFrame.top);var t=this.currentFrame;this._prevFrame=t,this._prevFrameData=null,t.disposeOp==2&&(this._prevFrameData=this.context.getImageData(t.left,t.top,t.width,t.height)),t.blendOp==0&&this.context.clearRect(t.left,t.top,t.width,t.height),this.context.drawImage(t.imageElement,t.left,t.top),this.emit("frame",this._currentFrameNumber),this._ended&&this.emit("end")}},{key:"play",value:function(){var t=this;this.emit("play"),this._ended&&this.stop(),this._paused=!1;var o=performance.now()+this.currentFrame.delay/this.playbackRate,v=function m(E){if(!t._ended&&!t._paused){if(E>=o){for(;E-o>=t._apng.playTime/t.playbackRate;)o+=t._apng.playTime/t.playbackRate,t._numPlays++;do t.renderNextFrame(),o+=t.currentFrame.delay/t.playbackRate;while(!t._ended&&E>o)}requestAnimationFrame(m)}};requestAnimationFrame(v)}},{key:"pause",value:function(){this._paused||(this.emit("pause"),this._paused=!0)}},{key:"stop",value:function(){this.emit("stop"),this._numPlays=0,this._ended=!1,this._paused=!0,this._currentFrameNumber=-1,this.context.clearRect(0,0,this._apng.width,this._apng.height),this.renderNextFrame()}},{key:"currentFrameNumber",get:function(){return this._currentFrameNumber}},{key:"currentFrame",get:function(){return this._apng.frames[this._currentFrameNumber]}},{key:"paused",get:function(){return this._paused}},{key:"ended",get:function(){return this._ended}}]),i}(h(s(4)).default);l.default=n},function(b,l){function s(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function a(e){return typeof e=="function"}function h(e){return typeof e=="number"}function p(e){return typeof e=="object"&&e!==null}function y(e){return e===void 0}b.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0,s.defaultMaxListeners=10,s.prototype.setMaxListeners=function(e){if(!h(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},s.prototype.emit=function(e){var n,r,i,t,o,v;if(this._events||(this._events={}),e==="error"&&(!this._events.error||p(this._events.error)&&!this._events.error.length)){if((n=arguments[1])instanceof Error)throw n;var m=new Error('Uncaught, unspecified "error" event. ('+n+")");throw m.context=n,m}if(y(r=this._events[e]))return!1;if(a(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:t=Array.prototype.slice.call(arguments,1),r.apply(this,t)}else if(p(r))for(t=Array.prototype.slice.call(arguments,1),i=(v=r.slice()).length,o=0;o0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),typeof console.trace=="function"&&console.trace()),this},s.prototype.on=s.prototype.addListener,s.prototype.once=function(e,n){if(!a(n))throw TypeError("listener must be a function");var r=!1;function i(){this.removeListener(e,i),r||(r=!0,n.apply(this,arguments))}return i.listener=n,this.on(e,i),this},s.prototype.removeListener=function(e,n){var r,i,t,o;if(!a(n))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(t=(r=this._events[e]).length,i=-1,r===n||a(r.listener)&&r.listener===n)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,n);else if(p(r)){for(o=t;o-- >0;)if(r[o]===n||r[o].listener&&r[o].listener===n){i=o;break}if(i<0)return this;r.length===1?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,n)}return this},s.prototype.removeAllListeners=function(e){var n,r;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[e]&&delete this._events[e],this;if(arguments.length===0){for(n in this._events)n!=="removeListener"&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events={},this}if(a(r=this._events[e]))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},s.prototype.listeners=function(e){return this._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[]},s.prototype.listenerCount=function(e){if(this._events){var n=this._events[e];if(a(n))return 1;if(n)return n.length}return 0},s.listenerCount=function(e,n){return e.listenerCount(n)}}])},R.exports=T();const q=G(k.exports);async function J(b,l){const s=q(b);if(s instanceof Error)throw s;await s.createImages(),S(l);const{frames:a,width:h,height:p}=s,y=document.createElement("canvas");y.width=h,y.height=p;const e=y.getContext("2d",{willReadFrequently:!0}),n=[],r=[];let i=0;for(const t of a){const o=V(t.delay||100);r.push(o),i+=o;const v=t.imageElement;t.blendOp===0?e.globalCompositeOperation="copy":e.globalCompositeOperation="source-over";const m=t.disposeOp===2?e.getImageData(t.left,t.top,t.width,t.height):void 0;e.drawImage(v,t.left,t.top);const E=e.getImageData(0,0,h,p);n.push(E),t.disposeOp===0||(t.disposeOp===1?e.clearRect(t.left,t.top,t.width,t.height):t.disposeOp===2&&e.putImageData(m,t.left,t.top))}return{frameCount:a.length,duration:i,frameDurations:r,getFrame:t=>n[t],width:h,height:p}}const B=[137,80,78,71,13,10,26,10];function $(b){const l=new Uint8Array(b);return!B.some((s,a)=>s!==l[a])}function z(b){if(!$(b))return!1;const l=new DataView(b),s=new Uint8Array(b);let a,h=8;do{const p=l.getUint32(h);if(a=String.fromCharCode.apply(String,Array.prototype.slice.call(s.subarray(h+4,h+8))),a==="acTL")return!0;h+=12+p}while(a!=="IEND"&&h>>24&255,u>>>16&255,u>>>8&255,255&u])}},function(b,l){Object.defineProperty(l,"__esModule",{value:!0}),l.default=function(y){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=e,i=e+(arguments.length>2&&arguments[2]!==void 0?arguments[2]:y.length-e);r>>8^s[255&(n^y[r])];return-1^n};for(var s=new Uint32Array(256),a=0;a<256;a++){for(var h=a,p=0;p<8;p++)h=1&h?3988292384^h>>>1:h>>>1;s[a]=h}},function(b,l,s){Object.defineProperty(l,"__esModule",{value:!0}),l.Frame=l.APNG=void 0;var a=function(){function e(n,r){for(var i=0;i1&&arguments[1]!==void 0&&arguments[1];return this.createImages().then(function(){return new h.default(r,n,i)})}}]),e}(),l.Frame=function(){function e(){y(this,e),this.left=0,this.top=0,this.width=0,this.height=0,this.delay=0,this.disposeOp=0,this.blendOp=0,this.imageData=null,this.imageElement=null}return a(e,[{key:"createImage",value:function(){var n=this;return this.imageElement?Promise.resolve():new Promise(function(r,i){var t=URL.createObjectURL(n.imageData);n.imageElement=document.createElement("img"),n.imageElement.onload=function(){URL.revokeObjectURL(t),r()},n.imageElement.onerror=function(){URL.revokeObjectURL(t),n.imageElement=null,i(new Error("Image creation error"))},n.imageElement.src=t})}}]),e}()},function(b,l,s){Object.defineProperty(l,"__esModule",{value:!0});var a=function(){function r(i,t){for(var o=0;o=this._apng.numPlays&&(this._ended=!0,this._paused=!0)),this._prevFrame&&this._prevFrame.disposeOp==1?this.context.clearRect(this._prevFrame.left,this._prevFrame.top,this._prevFrame.width,this._prevFrame.height):this._prevFrame&&this._prevFrame.disposeOp==2&&this.context.putImageData(this._prevFrameData,this._prevFrame.left,this._prevFrame.top);var t=this.currentFrame;this._prevFrame=t,this._prevFrameData=null,t.disposeOp==2&&(this._prevFrameData=this.context.getImageData(t.left,t.top,t.width,t.height)),t.blendOp==0&&this.context.clearRect(t.left,t.top,t.width,t.height),this.context.drawImage(t.imageElement,t.left,t.top),this.emit("frame",this._currentFrameNumber),this._ended&&this.emit("end")}},{key:"play",value:function(){var t=this;this.emit("play"),this._ended&&this.stop(),this._paused=!1;var o=performance.now()+this.currentFrame.delay/this.playbackRate,v=function m(E){if(!t._ended&&!t._paused){if(E>=o){for(;E-o>=t._apng.playTime/t.playbackRate;)o+=t._apng.playTime/t.playbackRate,t._numPlays++;do t.renderNextFrame(),o+=t.currentFrame.delay/t.playbackRate;while(!t._ended&&E>o)}requestAnimationFrame(m)}};requestAnimationFrame(v)}},{key:"pause",value:function(){this._paused||(this.emit("pause"),this._paused=!0)}},{key:"stop",value:function(){this.emit("stop"),this._numPlays=0,this._ended=!1,this._paused=!0,this._currentFrameNumber=-1,this.context.clearRect(0,0,this._apng.width,this._apng.height),this.renderNextFrame()}},{key:"currentFrameNumber",get:function(){return this._currentFrameNumber}},{key:"currentFrame",get:function(){return this._apng.frames[this._currentFrameNumber]}},{key:"paused",get:function(){return this._paused}},{key:"ended",get:function(){return this._ended}}]),i}(h(s(4)).default);l.default=n},function(b,l){function s(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function a(e){return typeof e=="function"}function h(e){return typeof e=="number"}function p(e){return typeof e=="object"&&e!==null}function y(e){return e===void 0}b.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0,s.defaultMaxListeners=10,s.prototype.setMaxListeners=function(e){if(!h(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},s.prototype.emit=function(e){var n,r,i,t,o,v;if(this._events||(this._events={}),e==="error"&&(!this._events.error||p(this._events.error)&&!this._events.error.length)){if((n=arguments[1])instanceof Error)throw n;var m=new Error('Uncaught, unspecified "error" event. ('+n+")");throw m.context=n,m}if(y(r=this._events[e]))return!1;if(a(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:t=Array.prototype.slice.call(arguments,1),r.apply(this,t)}else if(p(r))for(t=Array.prototype.slice.call(arguments,1),i=(v=r.slice()).length,o=0;o0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),typeof console.trace=="function"&&console.trace()),this},s.prototype.on=s.prototype.addListener,s.prototype.once=function(e,n){if(!a(n))throw TypeError("listener must be a function");var r=!1;function i(){this.removeListener(e,i),r||(r=!0,n.apply(this,arguments))}return i.listener=n,this.on(e,i),this},s.prototype.removeListener=function(e,n){var r,i,t,o;if(!a(n))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(t=(r=this._events[e]).length,i=-1,r===n||a(r.listener)&&r.listener===n)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,n);else if(p(r)){for(o=t;o-- >0;)if(r[o]===n||r[o].listener&&r[o].listener===n){i=o;break}if(i<0)return this;r.length===1?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,n)}return this},s.prototype.removeAllListeners=function(e){var n,r;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[e]&&delete this._events[e],this;if(arguments.length===0){for(n in this._events)n!=="removeListener"&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events={},this}if(a(r=this._events[e]))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},s.prototype.listeners=function(e){return this._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[]},s.prototype.listenerCount=function(e){if(this._events){var n=this._events[e];if(a(n))return 1;if(n)return n.length}return 0},s.listenerCount=function(e,n){return e.listenerCount(n)}}])},R.exports=T();const q=G(k.exports);async function z(b,l){const s=q(b);if(s instanceof Error)throw s;await s.createImages(),S(l);const{frames:a,width:h,height:p}=s,y=document.createElement("canvas");y.width=h,y.height=p;const e=y.getContext("2d",{willReadFrequently:!0}),n=[],r=[];let i=0;for(const t of a){const o=V(t.delay||100);r.push(o),i+=o;const v=t.imageElement;t.blendOp===0?e.globalCompositeOperation="copy":e.globalCompositeOperation="source-over";const m=t.disposeOp===2?e.getImageData(t.left,t.top,t.width,t.height):void 0;e.drawImage(v,t.left,t.top);const E=e.getImageData(0,0,h,p);n.push(E),t.disposeOp===0||(t.disposeOp===1?e.clearRect(t.left,t.top,t.width,t.height):t.disposeOp===2&&e.putImageData(m,t.left,t.top))}return{frameCount:a.length,duration:i,frameDurations:r,getFrame:t=>n[t],width:h,height:p}}const B=[137,80,78,71,13,10,26,10];function $(b){const l=new Uint8Array(b);return!B.some((s,a)=>s!==l[a])}function J(b){if(!$(b))return!1;const l=new DataView(b),s=new Uint8Array(b);let a,h=8;do{const p=l.getUint32(h);if(a=String.fromCharCode.apply(String,Array.prototype.slice.call(s.subarray(h+4,h+8))),a==="acTL")return!0;h+=12+p}while(a!=="IEND"&&h{const r={spatialReference:this.context.spatialReference,console:this.context.console,lrucache:this.context.lrucache,timeZone:this.context.timeZone??null,exports:this.context.exports,libraryResolver:this.context.libraryResolver,interceptor:this.context.interceptor,localScope:{},depthCounter:{depth:e.depthCounter+1},globalScope:this.context.globalScope};if(r.depthCounter.depth>64)throw new l(e,s.MaximumCallDepth,null);return K(this.definition,r,t,null)}}call(e,t){return L(e,t,(r,o,a)=>{const i={spatialReference:e.spatialReference,services:e.services,console:e.console,libraryResolver:e.libraryResolver,exports:e.exports,lrucache:e.lrucache,timeZone:e.timeZone??null,interceptor:e.interceptor,localScope:{},abortSignal:e.abortSignal,globalScope:e.globalScope,depthCounter:{depth:e.depthCounter.depth+1}};if(i.depthCounter.depth>64)throw new l(e,s.MaximumCallDepth,t);return K(this.definition,i,a,t)})}marshalledCall(e,t,r,o){return o(e,t,async(a,i,u)=>{const f={spatialReference:e.spatialReference,globalScope:r.globalScope,depthCounter:{depth:e.depthCounter.depth+1},libraryResolver:e.libraryResolver,exports:e.exports,console:e.console,abortSignal:e.abortSignal,lrucache:e.lrucache,timeZone:e.timeZone??null,interceptor:e.interceptor,localScope:{}};return u=u.map(w=>!v(w)||w instanceof D?w:H(w,e,o)),H(await K(this.definition,f,u,t),r,o)})}}class C extends xe{constructor(e){super(e)}async global(e){const t=this.executingContext.globalScope[e.toLowerCase()];if(t.valueset||(t.value=await c(this.executingContext,t.node),t.valueset=!0),v(t.value)&&!(t.value instanceof D)){const r=new D;r.fn=t.value,r.parameterEvaluator=L,r.context=this.executingContext,t.value=r}return t.value}setGlobal(e,t){if(v(t))throw new l(null,s.AssignModuleFunction,null);this.executingContext.globalScope[e.toLowerCase()]={value:t,valueset:!0,node:null}}hasGlobal(e){return this.executingContext.exports[e]===void 0&&(e=e.toLowerCase()),this.executingContext.exports[e]!==void 0}async loadModule(e){let t=e.spatialReference;t==null&&(t=new ne({wkid:102100})),this.moduleScope=ie({},e.customfunctions,e.timeZone),this.executingContext={spatialReference:t,services:e.services,libraryResolver:new X(e.libraryResolver._moduleSingletons,this.source.syntax.loadedModules),exports:{},abortSignal:e.abortSignal===void 0||e.abortSignal===null?{aborted:!1}:e.abortSignal,globalScope:this.moduleScope,console:e.console??le,lrucache:e.lrucache,timeZone:e.timeZone??null,interceptor:e.interceptor,localScope:null,depthCounter:{depth:1}},await c(this.executingContext,this.source.syntax)}}async function L(n,e,t){if(e.preparsed===!0){const o=t(n,null,e.arguments);return J(o),o}const r=t(n,e,await V(n,e));return J(r),r}async function c(n,e,t){if(e.breakpoint&&t!==!0)return await e.breakpoint(),c(n,e,!0);try{switch(e==null?void 0:e.type){case"VariableDeclarator":return await Ze(n,e);case"ImportDeclaration":return await De(n,e);case"ExportNamedDeclaration":return await Ge(n,e);case"VariableDeclaration":return await re(n,e,0);case"BlockStatement":case"Program":return await Pe(n,e);case"FunctionDeclaration":return await qe(n,e);case"ReturnStatement":return await Ke(n,e);case"IfStatement":return await je(n,e);case"ExpressionStatement":return await $e(n,e);case"UpdateExpression":return await Ee(n,e);case"AssignmentExpression":return await Be(n,e);case"ForStatement":return await Ne(n,e);case"WhileStatement":return await Ae(n,e);case"ForInStatement":return await ke(n,e);case"BreakStatement":return S;case"EmptyStatement":return p;case"ContinueStatement":return E;case"TemplateElement":return await He(n,e);case"TemplateLiteral":return await Je(n,e);case"Identifier":return await _(n,e);case"MemberExpression":return await Te(n,e);case"Literal":return e.value;case"CallExpression":return await ze(n,e);case"UnaryExpression":return await Ue(n,e);case"BinaryExpression":return await Ve(n,e);case"LogicalExpression":return await _e(n,e);case"ArrayExpression":return await We(n,e);case"ObjectExpression":return await Ce(n,e);case"Property":return await Re(n,e);default:throw new l(n,s.Unrecognized,e)}}catch(r){throw ge(n,e,r)}}async function Ce(n,e){const t=[];for(let i=0;i{try{t.testResult===!0?++a>j?(a=0,setTimeout(()=>{k(n,e,t,r,o,a)},0)):k(n,e,t,r,o,a):t.lastAction instanceof y?r(t.lastAction):r(p)}catch(i){o(i)}},i=>{o(i)})}catch(i){o(i)}}function Ne(n,e){try{return e.init!==null?c(n,e.init).then(()=>new Promise((t,r)=>{k(n,e,{testResult:!0,lastAction:p},o=>{t(o)},o=>{r(o)},0)})):new Promise((t,r)=>{k(n,e,{testResult:!0,lastAction:p},o=>{t(o)},o=>{r(o)},0)})}catch(t){return Promise.reject(t)}}function G(n,e,t,r,o,a,i,u,f,w){try{if(r<=a)return void u(p);o.value=i==="k"?t[a]:a,c(n,e.body).then(m=>{try{m instanceof y?u(m):m===S?u(p):++w>j?(w=0,setTimeout(()=>{G(n,e,t,r,o,a+1,i,u,f,w)},0)):G(n,e,t,r,o,a+1,i,u,f,w)}catch(P){f(P)}},m=>{f(m)})}catch(m){f(m)}}function Z(n,e,t,r,o,a,i,u,f){try{if(t.length()<=o)return void i(p);r.value=a==="k"?t.get(o):o,c(n,e.body).then(w=>{w instanceof y?i(w):w===S?i(p):++f>j?(f=0,setTimeout(()=>{Z(n,e,t,r,o+1,a,i,u,f)},0)):Z(n,e,t,r,o+1,a,i,u,f)},w=>{u(w)})}catch(w){u(w)}}function T(n,e,t,r,o,a){try{if(a===void 0&&(a="i"),t.length===0)return void r.resolve(p);G(n,e,t,t.length,o,0,a,i=>{r.resolve(i)},i=>{r.reject(i)},0)}catch(i){r.reject(i)}}function Le(n,e,t,r,o,a){try{if(a===void 0&&(a="i"),t.length===0)return void r.resolve(p);Z(n,e,t,o,0,a,i=>{r.resolve(i)},i=>{r.reject(i)},0)}catch(i){r.reject(i)}}function Oe(n,e,t,r,o){try{T(n,e,t.keys(),r,o,"k")}catch(a){r.reject(a)}}function U(n,e,t,r,o,a,i,u){try{n.next().then(f=>{try{if(f===null)a(p);else{const w=ee.createFromGraphicLikeObject(f.geometry,f.attributes,r,e.timeZone);w._underlyingGraphic=f,o.value=w,c(e,t.body).then(m=>{try{m===S?a(p):m instanceof y?a(m):++u>j?(u=0,setTimeout(()=>{U(n,e,t,r,o,a,i,u)},0)):U(n,e,t,r,o,a,i,u)}catch(P){i(P)}},m=>{i(m)})}}catch(w){i(w)}},f=>{i(f)})}catch(f){i(f)}}async function ke(n,e){return new Promise((t,r)=>{c(n,e.right).then(o=>{try{let a=null;a=e.left.type==="VariableDeclaration"?c(n,e.left):Promise.resolve(),a.then(()=>{try{let i="";if(e.left.type==="VariableDeclaration"){const f=e.left.declarations[0].id;f.type==="Identifier"&&(i=f.name)}else e.left.type==="Identifier"&&(i=e.left.name);if(!i)throw new l(n,s.InvalidIdentifier,e);i=i.toLowerCase();let u=null;if(n.localScope!=null&&n.localScope[i]!==void 0&&(u=n.localScope[i]),u===null&&n.globalScope[i]!==void 0&&(u=n.globalScope[i]),u===null)return void r(new l(n,s.InvalidIdentifier,e));B(o)||h(o)?T(n,e,o,{reject:r,resolve:t},u):$(o)?Le(n,e,o,{reject:r,resolve:t},u):o instanceof F||M(o)?Oe(n,e,o,{reject:r,resolve:t},u):me(o)?U(o.iterator(n.abortSignal),n,e,o,u,f=>{t(f)},f=>{r(f)},0):T(n,e,[],{reject:r,resolve:t},u)}catch(i){r(i)}},r)}catch(a){r(a)}},r)})}async function Ee(n,e){const t=e.argument;if(t.type==="MemberExpression"){const a={t:null},i=await c(n,t.object);let u=null;a.t=i,t.computed===!0?u=await c(n,t.property):t.property.type==="Identifier"&&(u=t.property.name);const f=a.t;let w;if(B(f)){if(!R(u))throw new l(n,s.ArrayAccessorMustBeNumber,e);if(u<0&&(u=f.length+u),u<0||u>=f.length)throw new l(n,s.OutOfBounds,e);w=d(f[u]),f[u]=e.operator==="++"?w+1:w-1}else if(f instanceof F){if(h(u)===!1)throw new l(n,s.KeyAccessorMustBeString,e);if(f.hasField(u)!==!0)throw new l(n,s.FieldNotFound,e,{key:u});w=d(f.field(u)),f.setField(u,e.operator==="++"?w+1:w-1)}else if(f instanceof C){if(h(u)===!1)throw new l(n,s.ModuleAccessorMustBeString,e);if(f.hasGlobal(u)!==!0)throw new l(n,s.ModuleExportNotFound,e);w=d(await f.global(u)),f.setGlobal(u,e.operator==="++"?w+1:w-1)}else{if(!M(f))throw $(f)?new l(n,s.Immutable,e):new l(n,s.InvalidParameter,e);if(h(u)===!1)throw new l(n,s.KeyAccessorMustBeString,e);if(f.hasField(u)!==!0)throw new l(n,s.FieldNotFound,e,{key:u});w=d(f.field(u)),f.setField(u,e.operator==="++"?w+1:w-1)}return e.prefix===!1?w:e.operator==="++"?w+1:w-1}const r=e.argument.type==="Identifier"?e.argument.name.toLowerCase():"";if(!r)throw new l(n,s.InvalidIdentifier,e);let o;if(n.localScope!=null&&n.localScope[r]!==void 0)return o=d(n.localScope[r].value),n.localScope[r]={value:e.operator==="++"?o+1:o-1,valueset:!0,node:e},e.prefix===!1?o:e.operator==="++"?o+1:o-1;if(n.globalScope[r]!==void 0)return o=d(n.globalScope[r].value),n.globalScope[r]={value:e.operator==="++"?o+1:o-1,valueset:!0,node:e},e.prefix===!1?o:e.operator==="++"?o+1:o-1;throw new l(n,s.InvalidIdentifier,e)}function b(n,e,t,r,o){switch(e){case"=":return n===p?null:n;case"/=":return d(t)/d(n);case"*=":return d(t)*d(n);case"-=":return d(t)-d(n);case"+=":return h(t)||h(n)?N(t)+N(n):d(t)+d(n);case"%=":return d(t)%d(n);default:throw new l(o,s.UnsupportedOperator,r)}}async function Be(n,e){const t=e.left;if(t.type==="MemberExpression"){const o=await c(n,t.object);let a=null;if(t.computed===!0)a=await c(n,t.property);else{if(t.property.type!=="Identifier")throw new l(n,s.InvalidIdentifier,e);a=t.property.name}const i=await c(n,e.right);if(B(o)){if(!R(a))throw new l(n,s.ArrayAccessorMustBeNumber,e);if(a<0&&(a=o.length+a),a<0||a>o.length)throw new l(n,s.OutOfBounds,e);if(a===o.length){if(e.operator!=="=")throw new l(n,s.OutOfBounds,e);o[a]=b(i,e.operator,o[a],e,n)}else o[a]=b(i,e.operator,o[a],e,n)}else if(o instanceof F){if(h(a)===!1)throw new l(n,s.KeyAccessorMustBeString,e);if(o.hasField(a)===!0)o.setField(a,b(i,e.operator,o.field(a),e,n));else{if(e.operator!=="=")throw new l(n,s.FieldNotFound,e,{key:a});o.setField(a,b(i,e.operator,null,e,n))}}else if(o instanceof C){if(h(a)===!1)throw new l(n,s.KeyAccessorMustBeString,e);if(o.hasGlobal(a)!==!0)throw new l(n,s.ModuleExportNotFound,e);o.setGlobal(a,b(i,e.operator,await o.global(a),e,n))}else{if(!M(o))throw $(o)?new l(n,s.Immutable,e):new l(n,s.InvalidParameter,e);if(h(a)===!1)throw new l(n,s.KeyAccessorMustBeString,e);if(o.hasField(a)===!0)o.setField(a,b(i,e.operator,o.field(a),e,n));else{if(e.operator!=="=")throw new l(n,s.FieldNotFound,e,{key:a});o.setField(a,b(i,e.operator,null,e,n))}}return p}const r=t.name.toLowerCase();if(n.localScope!=null&&n.localScope[r]!==void 0){const o=await c(n,e.right);return n.localScope[r]={value:b(o,e.operator,n.localScope[r].value,e,n),valueset:!0,node:e.right},p}if(n.globalScope[r]!==void 0){const o=await c(n,e.right);return n.globalScope[r]={value:b(o,e.operator,n.globalScope[r].value,e,n),valueset:!0,node:e.right},p}throw new l(n,s.InvalidIdentifier,e)}async function $e(n,e){if(e.expression.type==="AssignmentExpression")return c(n,e.expression);if(e.expression.type==="CallExpression"){const r=await c(n,e.expression);return r===p?p:new O(r)}const t=await c(n,e.expression);return t===p?p:new O(t)}async function je(n,e){const t=await c(n,e.test);if(t===!0)return c(n,e.consequent);if(t===!1)return e.alternate!==null?c(n,e.alternate):p;throw new l(n,s.BooleanConditionRequired,e)}async function Pe(n,e){return te(n,e,0)}async function te(n,e,t){if(t>=e.body.length)return p;const r=await c(n,e.body[t]);return r instanceof y||r===S||r===E||t===e.body.length-1?r:te(n,e,t+1)}async function Ke(n,e){if(e.argument===null)return new y(p);const t=await c(n,e.argument);return new y(t)}async function qe(n,e){const t=e.id.name.toLowerCase();return n.globalScope[t]={valueset:!0,node:null,value:new Fe(e,n)},p}async function De(n,e){var a,i;const t=e.specifiers[0].local.name.toLowerCase(),r=n.libraryResolver.loadLibrary(t);let o=null;return(a=n.libraryResolver._moduleSingletons)!=null&&a.has(r.uri)?o=n.libraryResolver._moduleSingletons.get(r.uri):(o=new C(r),await o.loadModule(n),(i=n.libraryResolver._moduleSingletons)==null||i.set(r.uri,o)),n.globalScope[t]={value:o,valueset:!0,node:e},p}async function Ge(n,e){if(await c(n,e.declaration),e.declaration.type==="FunctionDeclaration")n.exports[e.declaration.id.name.toLowerCase()]="function";else if(e.declaration.type==="VariableDeclaration")for(const t of e.declaration.declarations)n.exports[t.id.name.toLowerCase()]="variable";return p}async function re(n,e,t){return t>=e.declarations.length?p:(await c(n,e.declarations[t]),t===e.declarations.length-1||await re(n,e,t+1),p)}async function Ze(n,e){let t=null;if(t=e.init===null?null:await c(n,e.init),n.localScope!==null){if(t===p&&(t=null),e.id.type!=="Identifier")throw new l(n,s.InvalidIdentifier,e);const o=e.id.name.toLowerCase();return n.localScope!=null&&(n.localScope[o]={value:t,valueset:!0,node:e.init}),p}if(e.id.type!=="Identifier")throw new l(n,s.InvalidIdentifier,e);const r=e.id.name.toLowerCase();return t===p&&(t=null),n.globalScope[r]={value:t,valueset:!0,node:e.init},p}async function Te(n,e){const t=await c(n,e.object);if(t===null)throw new l(n,s.MemberOfNull,e);if(e.computed===!1){if(e.property.type==="Identifier"){if(t instanceof F||M(t))return t.field(e.property.name);if(t instanceof Y)return z(t,e.property.name,n,e);if(t instanceof C){if(!t.hasGlobal(e.property.name))throw new l(n,s.InvalidIdentifier,e);return t.global(e.property.name)}throw new l(n,s.InvalidMemberAccessKey,e)}throw new l(n,s.InvalidMemberAccessKey,e)}let r=await c(n,e.property);if(t instanceof F||M(t)){if(h(r))return t.field(r);throw new l(n,s.InvalidMemberAccessKey,e)}if(t instanceof C){if(h(r))return t.global(r);throw new l(n,s.InvalidMemberAccessKey,e)}if(t instanceof Y){if(h(r))return z(t,r,n,e);throw new l(n,s.InvalidMemberAccessKey,e)}if(B(t)){if(R(r)&&isFinite(r)&&Math.floor(r)===r){if(r<0&&(r=t.length+r),r>=t.length||r<0)throw new l(n,s.OutOfBounds,e);return t[r]}throw new l(n,s.InvalidMemberAccessKey,e)}if($(t)){if(R(r)&&isFinite(r)&&Math.floor(r)===r){if(r<0&&(r=t.length()+r),r>=t.length()||r<0)throw new l(n,s.OutOfBounds,e);return t.get(r)}throw new l(n,s.InvalidMemberAccessKey,e)}if(h(t)){if(R(r)&&isFinite(r)&&Math.floor(r)===r){if(r<0&&(r=t.length+r),r>=t.length||r<0)throw new l(n,s.OutOfBounds,e);return t[r]}throw new l(n,s.InvalidMemberAccessKey,e)}throw new l(n,s.InvalidMemberAccessKey,e)}async function Ue(n,e){const t=await c(n,e.argument);if(I(t)){if(e.operator==="!")return!t;if(e.operator==="-")return-1*d(t);if(e.operator==="+")return 1*d(t);if(e.operator==="~")return~d(t);throw new l(n,s.UnsupportedUnaryOperator,e)}if(e.operator==="-")return-1*d(t);if(e.operator==="+")return 1*d(t);if(e.operator==="~")return~d(t);throw new l(n,s.UnsupportedUnaryOperator,e)}async function We(n,e){const t=[];for(let r=0;r>":case">>>":case"^":case"&":return ve(d(r),d(o),e.operator);case"==":return q(r,o);case"!=":return!q(r,o);case"<":case">":case"<=":case">=":return ye(r,o,e.operator);case"+":return h(r)||h(o)?N(r)+N(o):d(r)+d(o);case"-":return d(r)-d(o);case"*":return d(r)*d(o);case"/":return d(r)/d(o);case"%":return d(r)%d(o);default:throw new l(n,s.UnsupportedOperator,e)}}async function _e(n,e){const t=await c(n,e.left);let r=null;if(!I(t))throw new l(n,s.LogicalExpressionOnlyBoolean,e);switch(e.operator){case"||":if(t===!0)return t;if(r=await c(n,e.right),I(r))return r;throw new l(n,s.LogicExpressionOrAnd,e);case"&&":if(t===!1)return t;if(r=await c(n,e.right),I(r))return r;throw new l(n,s.LogicExpressionOrAnd,e);default:throw new l(n,s.LogicExpressionOrAnd,e)}}async function _(n,e){const t=e.name.toLowerCase();if(n.localScope!=null&&n.localScope[t]!==void 0){const r=n.localScope[t];if(r.valueset===!0)return r.value;if(r.d!==null)return r.d;r.d=c(n,r.node);const o=await r.d;return r.value=o,r.valueset=!0,o}if(n.globalScope[t]!==void 0){const r=n.globalScope[t];if(r.valueset===!0)return r.value;if(r.d!==null)return r.d;r.d=c(n,r.node);const o=await r.d;return r.value=o,r.valueset=!0,o}throw new l(n,s.InvalidIdentifier,e)}async function ze(n,e){if(e.callee.type==="MemberExpression"){const t=await c(n,e.callee.object);if(!(t instanceof C))throw new l(n,s.FunctionNotFound,e);const r=e.callee.computed===!1?e.callee.property.name:await c(n,e.callee.property);if(!t.hasGlobal(r))throw new l(n,s.FunctionNotFound,e);const o=await t.global(r);if(!v(o))throw new l(n,s.CallNonFunction,e);return o.call(n,e)}if(e.callee.type!=="Identifier")throw new l(n,s.FunctionNotFound,e);if(n.localScope!=null&&n.localScope[e.callee.name.toLowerCase()]!==void 0){const t=n.localScope[e.callee.name.toLowerCase()];if(v(t.value))return t.value.call(n,e);throw new l(n,s.CallNonFunction,e)}if(n.globalScope[e.callee.name.toLowerCase()]!==void 0){const t=n.globalScope[e.callee.name.toLowerCase()];if(v(t.value))return t.value.call(n,e);throw new l(n,s.CallNonFunction,e)}throw new l(n,s.FunctionNotFound,e)}async function He(n,e){return e.value?e.value.cooked:""}function Ye(n,e,t){if(v(n))throw new l(e,s.NoFunctionInTemplateLiteral,t);return n}async function Je(n,e){const t=[];for(let a=0;a{const r={spatialReference:this.context.spatialReference,console:this.context.console,lrucache:this.context.lrucache,timeZone:this.context.timeZone??null,exports:this.context.exports,libraryResolver:this.context.libraryResolver,interceptor:this.context.interceptor,localScope:{},depthCounter:{depth:e.depthCounter+1},globalScope:this.context.globalScope};if(r.depthCounter.depth>64)throw new l(e,s.MaximumCallDepth,null);return K(this.definition,r,t,null)}}call(e,t){return L(e,t,(r,o,a)=>{const i={spatialReference:e.spatialReference,services:e.services,console:e.console,libraryResolver:e.libraryResolver,exports:e.exports,lrucache:e.lrucache,timeZone:e.timeZone??null,interceptor:e.interceptor,localScope:{},abortSignal:e.abortSignal,globalScope:e.globalScope,depthCounter:{depth:e.depthCounter.depth+1}};if(i.depthCounter.depth>64)throw new l(e,s.MaximumCallDepth,t);return K(this.definition,i,a,t)})}marshalledCall(e,t,r,o){return o(e,t,async(a,i,u)=>{const f={spatialReference:e.spatialReference,globalScope:r.globalScope,depthCounter:{depth:e.depthCounter.depth+1},libraryResolver:e.libraryResolver,exports:e.exports,console:e.console,abortSignal:e.abortSignal,lrucache:e.lrucache,timeZone:e.timeZone??null,interceptor:e.interceptor,localScope:{}};return u=u.map(w=>!v(w)||w instanceof D?w:H(w,e,o)),H(await K(this.definition,f,u,t),r,o)})}}class C extends xe{constructor(e){super(e)}async global(e){const t=this.executingContext.globalScope[e.toLowerCase()];if(t.valueset||(t.value=await c(this.executingContext,t.node),t.valueset=!0),v(t.value)&&!(t.value instanceof D)){const r=new D;r.fn=t.value,r.parameterEvaluator=L,r.context=this.executingContext,t.value=r}return t.value}setGlobal(e,t){if(v(t))throw new l(null,s.AssignModuleFunction,null);this.executingContext.globalScope[e.toLowerCase()]={value:t,valueset:!0,node:null}}hasGlobal(e){return this.executingContext.exports[e]===void 0&&(e=e.toLowerCase()),this.executingContext.exports[e]!==void 0}async loadModule(e){let t=e.spatialReference;t==null&&(t=new ne({wkid:102100})),this.moduleScope=ie({},e.customfunctions,e.timeZone),this.executingContext={spatialReference:t,services:e.services,libraryResolver:new X(e.libraryResolver._moduleSingletons,this.source.syntax.loadedModules),exports:{},abortSignal:e.abortSignal===void 0||e.abortSignal===null?{aborted:!1}:e.abortSignal,globalScope:this.moduleScope,console:e.console??le,lrucache:e.lrucache,timeZone:e.timeZone??null,interceptor:e.interceptor,localScope:null,depthCounter:{depth:1}},await c(this.executingContext,this.source.syntax)}}async function L(n,e,t){if(e.preparsed===!0){const o=t(n,null,e.arguments);return J(o),o}const r=t(n,e,await V(n,e));return J(r),r}async function c(n,e,t){if(e.breakpoint&&t!==!0)return await e.breakpoint(),c(n,e,!0);try{switch(e==null?void 0:e.type){case"VariableDeclarator":return await Ze(n,e);case"ImportDeclaration":return await De(n,e);case"ExportNamedDeclaration":return await Ge(n,e);case"VariableDeclaration":return await re(n,e,0);case"BlockStatement":case"Program":return await Pe(n,e);case"FunctionDeclaration":return await qe(n,e);case"ReturnStatement":return await Ke(n,e);case"IfStatement":return await je(n,e);case"ExpressionStatement":return await $e(n,e);case"UpdateExpression":return await Ee(n,e);case"AssignmentExpression":return await Be(n,e);case"ForStatement":return await Ne(n,e);case"WhileStatement":return await Ae(n,e);case"ForInStatement":return await ke(n,e);case"BreakStatement":return S;case"EmptyStatement":return p;case"ContinueStatement":return E;case"TemplateElement":return await He(n,e);case"TemplateLiteral":return await Je(n,e);case"Identifier":return await _(n,e);case"MemberExpression":return await Te(n,e);case"Literal":return e.value;case"CallExpression":return await ze(n,e);case"UnaryExpression":return await Ue(n,e);case"BinaryExpression":return await Ve(n,e);case"LogicalExpression":return await _e(n,e);case"ArrayExpression":return await We(n,e);case"ObjectExpression":return await Ce(n,e);case"Property":return await Re(n,e);default:throw new l(n,s.Unrecognized,e)}}catch(r){throw ge(n,e,r)}}async function Ce(n,e){const t=[];for(let i=0;i{try{t.testResult===!0?++a>j?(a=0,setTimeout(()=>{k(n,e,t,r,o,a)},0)):k(n,e,t,r,o,a):t.lastAction instanceof y?r(t.lastAction):r(p)}catch(i){o(i)}},i=>{o(i)})}catch(i){o(i)}}function Ne(n,e){try{return e.init!==null?c(n,e.init).then(()=>new Promise((t,r)=>{k(n,e,{testResult:!0,lastAction:p},o=>{t(o)},o=>{r(o)},0)})):new Promise((t,r)=>{k(n,e,{testResult:!0,lastAction:p},o=>{t(o)},o=>{r(o)},0)})}catch(t){return Promise.reject(t)}}function G(n,e,t,r,o,a,i,u,f,w){try{if(r<=a)return void u(p);o.value=i==="k"?t[a]:a,c(n,e.body).then(m=>{try{m instanceof y?u(m):m===S?u(p):++w>j?(w=0,setTimeout(()=>{G(n,e,t,r,o,a+1,i,u,f,w)},0)):G(n,e,t,r,o,a+1,i,u,f,w)}catch(P){f(P)}},m=>{f(m)})}catch(m){f(m)}}function Z(n,e,t,r,o,a,i,u,f){try{if(t.length()<=o)return void i(p);r.value=a==="k"?t.get(o):o,c(n,e.body).then(w=>{w instanceof y?i(w):w===S?i(p):++f>j?(f=0,setTimeout(()=>{Z(n,e,t,r,o+1,a,i,u,f)},0)):Z(n,e,t,r,o+1,a,i,u,f)},w=>{u(w)})}catch(w){u(w)}}function T(n,e,t,r,o,a){try{if(a===void 0&&(a="i"),t.length===0)return void r.resolve(p);G(n,e,t,t.length,o,0,a,i=>{r.resolve(i)},i=>{r.reject(i)},0)}catch(i){r.reject(i)}}function Le(n,e,t,r,o,a){try{if(a===void 0&&(a="i"),t.length===0)return void r.resolve(p);Z(n,e,t,o,0,a,i=>{r.resolve(i)},i=>{r.reject(i)},0)}catch(i){r.reject(i)}}function Oe(n,e,t,r,o){try{T(n,e,t.keys(),r,o,"k")}catch(a){r.reject(a)}}function U(n,e,t,r,o,a,i,u){try{n.next().then(f=>{try{if(f===null)a(p);else{const w=ee.createFromGraphicLikeObject(f.geometry,f.attributes,r,e.timeZone);w._underlyingGraphic=f,o.value=w,c(e,t.body).then(m=>{try{m===S?a(p):m instanceof y?a(m):++u>j?(u=0,setTimeout(()=>{U(n,e,t,r,o,a,i,u)},0)):U(n,e,t,r,o,a,i,u)}catch(P){i(P)}},m=>{i(m)})}}catch(w){i(w)}},f=>{i(f)})}catch(f){i(f)}}async function ke(n,e){return new Promise((t,r)=>{c(n,e.right).then(o=>{try{let a=null;a=e.left.type==="VariableDeclaration"?c(n,e.left):Promise.resolve(),a.then(()=>{try{let i="";if(e.left.type==="VariableDeclaration"){const f=e.left.declarations[0].id;f.type==="Identifier"&&(i=f.name)}else e.left.type==="Identifier"&&(i=e.left.name);if(!i)throw new l(n,s.InvalidIdentifier,e);i=i.toLowerCase();let u=null;if(n.localScope!=null&&n.localScope[i]!==void 0&&(u=n.localScope[i]),u===null&&n.globalScope[i]!==void 0&&(u=n.globalScope[i]),u===null)return void r(new l(n,s.InvalidIdentifier,e));B(o)||h(o)?T(n,e,o,{reject:r,resolve:t},u):$(o)?Le(n,e,o,{reject:r,resolve:t},u):o instanceof F||M(o)?Oe(n,e,o,{reject:r,resolve:t},u):me(o)?U(o.iterator(n.abortSignal),n,e,o,u,f=>{t(f)},f=>{r(f)},0):T(n,e,[],{reject:r,resolve:t},u)}catch(i){r(i)}},r)}catch(a){r(a)}},r)})}async function Ee(n,e){const t=e.argument;if(t.type==="MemberExpression"){const a={t:null},i=await c(n,t.object);let u=null;a.t=i,t.computed===!0?u=await c(n,t.property):t.property.type==="Identifier"&&(u=t.property.name);const f=a.t;let w;if(B(f)){if(!R(u))throw new l(n,s.ArrayAccessorMustBeNumber,e);if(u<0&&(u=f.length+u),u<0||u>=f.length)throw new l(n,s.OutOfBounds,e);w=d(f[u]),f[u]=e.operator==="++"?w+1:w-1}else if(f instanceof F){if(h(u)===!1)throw new l(n,s.KeyAccessorMustBeString,e);if(f.hasField(u)!==!0)throw new l(n,s.FieldNotFound,e,{key:u});w=d(f.field(u)),f.setField(u,e.operator==="++"?w+1:w-1)}else if(f instanceof C){if(h(u)===!1)throw new l(n,s.ModuleAccessorMustBeString,e);if(f.hasGlobal(u)!==!0)throw new l(n,s.ModuleExportNotFound,e);w=d(await f.global(u)),f.setGlobal(u,e.operator==="++"?w+1:w-1)}else{if(!M(f))throw $(f)?new l(n,s.Immutable,e):new l(n,s.InvalidParameter,e);if(h(u)===!1)throw new l(n,s.KeyAccessorMustBeString,e);if(f.hasField(u)!==!0)throw new l(n,s.FieldNotFound,e,{key:u});w=d(f.field(u)),f.setField(u,e.operator==="++"?w+1:w-1)}return e.prefix===!1?w:e.operator==="++"?w+1:w-1}const r=e.argument.type==="Identifier"?e.argument.name.toLowerCase():"";if(!r)throw new l(n,s.InvalidIdentifier,e);let o;if(n.localScope!=null&&n.localScope[r]!==void 0)return o=d(n.localScope[r].value),n.localScope[r]={value:e.operator==="++"?o+1:o-1,valueset:!0,node:e},e.prefix===!1?o:e.operator==="++"?o+1:o-1;if(n.globalScope[r]!==void 0)return o=d(n.globalScope[r].value),n.globalScope[r]={value:e.operator==="++"?o+1:o-1,valueset:!0,node:e},e.prefix===!1?o:e.operator==="++"?o+1:o-1;throw new l(n,s.InvalidIdentifier,e)}function b(n,e,t,r,o){switch(e){case"=":return n===p?null:n;case"/=":return d(t)/d(n);case"*=":return d(t)*d(n);case"-=":return d(t)-d(n);case"+=":return h(t)||h(n)?N(t)+N(n):d(t)+d(n);case"%=":return d(t)%d(n);default:throw new l(o,s.UnsupportedOperator,r)}}async function Be(n,e){const t=e.left;if(t.type==="MemberExpression"){const o=await c(n,t.object);let a=null;if(t.computed===!0)a=await c(n,t.property);else{if(t.property.type!=="Identifier")throw new l(n,s.InvalidIdentifier,e);a=t.property.name}const i=await c(n,e.right);if(B(o)){if(!R(a))throw new l(n,s.ArrayAccessorMustBeNumber,e);if(a<0&&(a=o.length+a),a<0||a>o.length)throw new l(n,s.OutOfBounds,e);if(a===o.length){if(e.operator!=="=")throw new l(n,s.OutOfBounds,e);o[a]=b(i,e.operator,o[a],e,n)}else o[a]=b(i,e.operator,o[a],e,n)}else if(o instanceof F){if(h(a)===!1)throw new l(n,s.KeyAccessorMustBeString,e);if(o.hasField(a)===!0)o.setField(a,b(i,e.operator,o.field(a),e,n));else{if(e.operator!=="=")throw new l(n,s.FieldNotFound,e,{key:a});o.setField(a,b(i,e.operator,null,e,n))}}else if(o instanceof C){if(h(a)===!1)throw new l(n,s.KeyAccessorMustBeString,e);if(o.hasGlobal(a)!==!0)throw new l(n,s.ModuleExportNotFound,e);o.setGlobal(a,b(i,e.operator,await o.global(a),e,n))}else{if(!M(o))throw $(o)?new l(n,s.Immutable,e):new l(n,s.InvalidParameter,e);if(h(a)===!1)throw new l(n,s.KeyAccessorMustBeString,e);if(o.hasField(a)===!0)o.setField(a,b(i,e.operator,o.field(a),e,n));else{if(e.operator!=="=")throw new l(n,s.FieldNotFound,e,{key:a});o.setField(a,b(i,e.operator,null,e,n))}}return p}const r=t.name.toLowerCase();if(n.localScope!=null&&n.localScope[r]!==void 0){const o=await c(n,e.right);return n.localScope[r]={value:b(o,e.operator,n.localScope[r].value,e,n),valueset:!0,node:e.right},p}if(n.globalScope[r]!==void 0){const o=await c(n,e.right);return n.globalScope[r]={value:b(o,e.operator,n.globalScope[r].value,e,n),valueset:!0,node:e.right},p}throw new l(n,s.InvalidIdentifier,e)}async function $e(n,e){if(e.expression.type==="AssignmentExpression")return c(n,e.expression);if(e.expression.type==="CallExpression"){const r=await c(n,e.expression);return r===p?p:new O(r)}const t=await c(n,e.expression);return t===p?p:new O(t)}async function je(n,e){const t=await c(n,e.test);if(t===!0)return c(n,e.consequent);if(t===!1)return e.alternate!==null?c(n,e.alternate):p;throw new l(n,s.BooleanConditionRequired,e)}async function Pe(n,e){return te(n,e,0)}async function te(n,e,t){if(t>=e.body.length)return p;const r=await c(n,e.body[t]);return r instanceof y||r===S||r===E||t===e.body.length-1?r:te(n,e,t+1)}async function Ke(n,e){if(e.argument===null)return new y(p);const t=await c(n,e.argument);return new y(t)}async function qe(n,e){const t=e.id.name.toLowerCase();return n.globalScope[t]={valueset:!0,node:null,value:new Fe(e,n)},p}async function De(n,e){var a,i;const t=e.specifiers[0].local.name.toLowerCase(),r=n.libraryResolver.loadLibrary(t);let o=null;return(a=n.libraryResolver._moduleSingletons)!=null&&a.has(r.uri)?o=n.libraryResolver._moduleSingletons.get(r.uri):(o=new C(r),await o.loadModule(n),(i=n.libraryResolver._moduleSingletons)==null||i.set(r.uri,o)),n.globalScope[t]={value:o,valueset:!0,node:e},p}async function Ge(n,e){if(await c(n,e.declaration),e.declaration.type==="FunctionDeclaration")n.exports[e.declaration.id.name.toLowerCase()]="function";else if(e.declaration.type==="VariableDeclaration")for(const t of e.declaration.declarations)n.exports[t.id.name.toLowerCase()]="variable";return p}async function re(n,e,t){return t>=e.declarations.length?p:(await c(n,e.declarations[t]),t===e.declarations.length-1||await re(n,e,t+1),p)}async function Ze(n,e){let t=null;if(t=e.init===null?null:await c(n,e.init),n.localScope!==null){if(t===p&&(t=null),e.id.type!=="Identifier")throw new l(n,s.InvalidIdentifier,e);const o=e.id.name.toLowerCase();return n.localScope!=null&&(n.localScope[o]={value:t,valueset:!0,node:e.init}),p}if(e.id.type!=="Identifier")throw new l(n,s.InvalidIdentifier,e);const r=e.id.name.toLowerCase();return t===p&&(t=null),n.globalScope[r]={value:t,valueset:!0,node:e.init},p}async function Te(n,e){const t=await c(n,e.object);if(t===null)throw new l(n,s.MemberOfNull,e);if(e.computed===!1){if(e.property.type==="Identifier"){if(t instanceof F||M(t))return t.field(e.property.name);if(t instanceof Y)return z(t,e.property.name,n,e);if(t instanceof C){if(!t.hasGlobal(e.property.name))throw new l(n,s.InvalidIdentifier,e);return t.global(e.property.name)}throw new l(n,s.InvalidMemberAccessKey,e)}throw new l(n,s.InvalidMemberAccessKey,e)}let r=await c(n,e.property);if(t instanceof F||M(t)){if(h(r))return t.field(r);throw new l(n,s.InvalidMemberAccessKey,e)}if(t instanceof C){if(h(r))return t.global(r);throw new l(n,s.InvalidMemberAccessKey,e)}if(t instanceof Y){if(h(r))return z(t,r,n,e);throw new l(n,s.InvalidMemberAccessKey,e)}if(B(t)){if(R(r)&&isFinite(r)&&Math.floor(r)===r){if(r<0&&(r=t.length+r),r>=t.length||r<0)throw new l(n,s.OutOfBounds,e);return t[r]}throw new l(n,s.InvalidMemberAccessKey,e)}if($(t)){if(R(r)&&isFinite(r)&&Math.floor(r)===r){if(r<0&&(r=t.length()+r),r>=t.length()||r<0)throw new l(n,s.OutOfBounds,e);return t.get(r)}throw new l(n,s.InvalidMemberAccessKey,e)}if(h(t)){if(R(r)&&isFinite(r)&&Math.floor(r)===r){if(r<0&&(r=t.length+r),r>=t.length||r<0)throw new l(n,s.OutOfBounds,e);return t[r]}throw new l(n,s.InvalidMemberAccessKey,e)}throw new l(n,s.InvalidMemberAccessKey,e)}async function Ue(n,e){const t=await c(n,e.argument);if(I(t)){if(e.operator==="!")return!t;if(e.operator==="-")return-1*d(t);if(e.operator==="+")return 1*d(t);if(e.operator==="~")return~d(t);throw new l(n,s.UnsupportedUnaryOperator,e)}if(e.operator==="-")return-1*d(t);if(e.operator==="+")return 1*d(t);if(e.operator==="~")return~d(t);throw new l(n,s.UnsupportedUnaryOperator,e)}async function We(n,e){const t=[];for(let r=0;r>":case">>>":case"^":case"&":return ve(d(r),d(o),e.operator);case"==":return q(r,o);case"!=":return!q(r,o);case"<":case">":case"<=":case">=":return ye(r,o,e.operator);case"+":return h(r)||h(o)?N(r)+N(o):d(r)+d(o);case"-":return d(r)-d(o);case"*":return d(r)*d(o);case"/":return d(r)/d(o);case"%":return d(r)%d(o);default:throw new l(n,s.UnsupportedOperator,e)}}async function _e(n,e){const t=await c(n,e.left);let r=null;if(!I(t))throw new l(n,s.LogicalExpressionOnlyBoolean,e);switch(e.operator){case"||":if(t===!0)return t;if(r=await c(n,e.right),I(r))return r;throw new l(n,s.LogicExpressionOrAnd,e);case"&&":if(t===!1)return t;if(r=await c(n,e.right),I(r))return r;throw new l(n,s.LogicExpressionOrAnd,e);default:throw new l(n,s.LogicExpressionOrAnd,e)}}async function _(n,e){const t=e.name.toLowerCase();if(n.localScope!=null&&n.localScope[t]!==void 0){const r=n.localScope[t];if(r.valueset===!0)return r.value;if(r.d!==null)return r.d;r.d=c(n,r.node);const o=await r.d;return r.value=o,r.valueset=!0,o}if(n.globalScope[t]!==void 0){const r=n.globalScope[t];if(r.valueset===!0)return r.value;if(r.d!==null)return r.d;r.d=c(n,r.node);const o=await r.d;return r.value=o,r.valueset=!0,o}throw new l(n,s.InvalidIdentifier,e)}async function ze(n,e){if(e.callee.type==="MemberExpression"){const t=await c(n,e.callee.object);if(!(t instanceof C))throw new l(n,s.FunctionNotFound,e);const r=e.callee.computed===!1?e.callee.property.name:await c(n,e.callee.property);if(!t.hasGlobal(r))throw new l(n,s.FunctionNotFound,e);const o=await t.global(r);if(!v(o))throw new l(n,s.CallNonFunction,e);return o.call(n,e)}if(e.callee.type!=="Identifier")throw new l(n,s.FunctionNotFound,e);if(n.localScope!=null&&n.localScope[e.callee.name.toLowerCase()]!==void 0){const t=n.localScope[e.callee.name.toLowerCase()];if(v(t.value))return t.value.call(n,e);throw new l(n,s.CallNonFunction,e)}if(n.globalScope[e.callee.name.toLowerCase()]!==void 0){const t=n.globalScope[e.callee.name.toLowerCase()];if(v(t.value))return t.value.call(n,e);throw new l(n,s.CallNonFunction,e)}throw new l(n,s.FunctionNotFound,e)}async function He(n,e){return e.value?e.value.cooked:""}function Ye(n,e,t){if(v(n))throw new l(e,s.NoFunctionInTemplateLiteral,t);return n}async function Je(n,e){const t=[];for(let a=0;athis.fn(t,{preparsed:!0,arguments:n})}call(t,n){return this.fn(t,n)}marshalledCall(t,n,r,a){return a(t,n,(u,o,i)=>{i=i.map(c=>c instanceof tt&&!(c instanceof ze)?dt(c,t,a):c);const s=this.call(r,{args:i});return qe(s)?s.then(c=>dt(c,r,a)):s})}},ze=class extends tt{constructor(){super(...arguments),this.fn=null,this.context=null}createFunction(t){return this.fn.createFunction(this.context)}call(t,n){return this.fn.marshalledCall(t,n,this.context,this.parameterEvaluator)}marshalledCall(t,n,r){return this.fn.marshalledCall(t,n,this.context,this.parameterEvaluator)}},se=class{constructor(t=[]){this._elements=t}length(){return this._elements.length}get(t){return this._elements[t]}toArray(){const t=[];for(let n=0;nn)throw new d(r,l.WrongNumberOfParameters,a)}function Nn(e){return e<0?-Math.round(-e):Math.round(e)}function st(){let e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,t=>{const n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),(t==="x"?n:3&n|8).toString(16)})}function tr(e,t){return isNaN(e)||t==null||t===""?e.toString():(t=He(t,"‰",""),t=He(t,"¤",""),ya(e,{pattern:t}))}function on(e,t){return t==null||t===""?e.toISOString(!0):e.toFormat(nr(t),{locale:Kn(),numberingSystem:"latn"})}function nr(e,t=!1){e=e.replaceAll(/LTS|LT|LL?L?L?|l{1,4}/g,"[$&]");let n="";const r=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|Z{1,5}|.)/g;for(const a of e.match(r)||[])switch(a){case"D":n+="d";break;case"DD":n+="dd";break;case"DDD":n+="o";break;case"d":n+="c";break;case"ddd":n+="ccc";break;case"dddd":n+="cccc";break;case"M":n+="L";break;case"MM":n+="LL";break;case"MMM":n+="LLL";break;case"MMMM":n+="LLLL";break;case"YY":n+="yy";break;case"Y":case"YYYY":n+="yyyy";break;case"Q":n+="q";break;case"Z":n+="Z";break;case"ZZ":n+="ZZ";break;case"ZZZ":n+="ZZZ";break;case"ZZZZ":n+=t?"[ZZZZ]":"ZZZZ";break;case"ZZZZZ":n+=t?"[ZZZZZ]":"ZZZZZ";break;case"S":n+="'S'";break;case"SS":n+="'SS'";break;case"SSS":n+="u";break;case"A":case"a":n+="a";break;case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":case"X":case"x":n+=a;break;default:a.length>=2&&a.slice(0,1)==="["&&a.slice(-1)==="]"?n+=`'${a.slice(1,-1)}'`:n+=`'${a}'`}return n}function N(e,t,n){switch(n){case">":return e>t;case"<":return e=":return e>=t;case"<=":return e<=t}return!1}function rr(e,t,n){if(e===null){if(t===null||t===A)return N(null,null,n);if(q(t))return N(0,t,n);if(C(t)||z(t))return N(0,h(t),n);if(V(t))return N(0,t.toNumber(),n);if(J(t)||P(t))return N(e,t.toNumber(),n)}if(e===A){if(t===null||t===A)return N(null,null,n);if(q(t))return N(0,t,n);if(C(t)||z(t))return N(0,h(t),n);if(V(t))return N(0,t.toNumber(),n);if(J(t)||P(t))return N(e,t.toNumber(),n)}else if(q(e)){if(q(t))return N(e,t,n);if(z(t))return N(e,h(t),n);if(t===null||t===A)return N(e,0,n);if(C(t))return N(e,h(t),n);if(V(t)||J(t)||P(t))return N(e,t.toNumber(),n)}else if(C(e)){if(C(t))return N(w(e),w(t),n);if(V(t)||J(t)||P(t))return N(h(e),t.toNumber(),n);if(q(t))return N(h(e),t,n);if(t===null||t===A)return N(h(e),0,n);if(z(t))return N(h(e),h(t),n)}else if(V(e)){if(V(t))return e.timeZone!==t.timeZone&&(e.isUnknownTimeZone?e=O.arcadeDateAndZoneToArcadeDate(e,t.timeZone):t.isUnknownTimeZone&&(t=O.arcadeDateAndZoneToArcadeDate(t,e.timeZone))),N(e.toNumber(),t.toNumber(),n);if(t===null||t===A)return N(e.toNumber(),0,n);if(q(t))return N(e.toNumber(),t,n);if(z(t)||C(t))return N(e.toNumber(),h(t),n);if(J(t))throw new d(null,l.CannotCompareDateAndTime,null);if(P(t))return N(e.toNumber(),t.toNumber(),n)}else if(z(e)){if(z(t))return N(e,t,n);if(q(t))return N(h(e),h(t),n);if(V(t)||J(t)||P(t))return N(h(e),t.toNumber(),n);if(t===null||t===A)return N(h(e),0,n);if(C(t))return N(h(e),h(t),n)}else if(P(e)){if(V(t))return N(e.toNumber(),t.toNumber(),n);if(t===null||t===A)return N(e.toNumber(),0,n);if(q(t))return N(e.toNumber(),t,n);if(z(t)||C(t))return N(e.toNumber(),h(t),n);if(J(t))throw new d(null,l.CannotCompareDateAndTime,null);if(P(t))return N(e.toNumber(),t.toNumber(),n)}else if(J(e)){if(V(t))throw new d(null,l.CannotCompareDateAndTime,null);if(t===null||t===A)return N(e.toNumber(),0,n);if(q(t))return N(e.toNumber(),t,n);if(z(t)||C(t))return N(e.toNumber(),h(t),n);if(J(t))return N(e.toNumber(),t.toNumber(),n);if(P(t))throw new d(null,l.CannotCompareDateAndTime,null)}return!!Ee(e,t)&&(n==="<="||n===">=")}function Ee(e,t){if(e===t||e===null&&t===A||t===null&&e===A)return!0;if(V(e)&&V(t)||J(e)&&J(t)||P(e)&&P(t))return e.equals(t);if(e instanceof Tn||e instanceof it)return e.equalityTest(t);if(e instanceof H&&t instanceof H){const n=e.cache._arcadeCacheId,r=t.cache._arcadeCacheId;if(n!=null)return n===r}return!!(Bn(e)&&Bn(t)&&(e._arcadeCacheId===t._arcadeCacheId&&e._arcadeCacheId!==void 0&&e._arcadeCacheId!==null||e._underlyingGraphic===t._underlyingGraphic&&e._underlyingGraphic!==void 0&&e._underlyingGraphic!==null))}function w(e,t){if(C(e))return e;if(e===null)return"";if(q(e))return tr(e,t);if(z(e))return e.toString();if(V(e))return on(e,t);if(J(e)||P(e))return e.toFormat(t);if(e instanceof B)return JSON.stringify(e.toJSON());if(T(e)){const n=[];for(let r=0;rr.key===a.key?0:r.key==="spatialReference"?1:a.key==="spatialReference"||r.keya.key?1:0);if(T(e)){const r=[];for(let a=0;a0)return e;return null}if(e instanceof oe){if(e.paths.length===0)return null;for(const t of e.paths)if(t.length>0)return e;return null}return e instanceof be?e.points.length===0?null:e:e instanceof ge?e.xmin==="NaN"||e.xmin===null||isNaN(e.xmin)?null:e:null}function mi(e,t){if(!e||!e.domain)return t;let n=null,r=null;if(e.field.type==="string"||e.field.type==="esriFieldTypeString")n=w(t);else{if(t==null)return null;if(t==="")return t;n=h(t)}for(let a=0;a{var s;return i.id===r&&(a=(s=i.domains)==null?void 0:s[o.name],a&&a.type==="inherited"&&(a=Ar(o.name,t),u=!0),!0)}),u||a||(a=Ar(e,t)),{field:o,domain:a}}function Ar(e,t){let n;return t.fields.some(r=>(r.name.toLowerCase()===e.toLowerCase()&&(n=r.domain),!!n)),n}function _n(e,t){t||(t={}),typeof t=="function"&&(t={cmp:t});const n=typeof t.cycles=="boolean"&&t.cycles,r=t.cmp&&(a=t.cmp,function(o){return function(i,s){const c={key:i,value:o[i]},p={key:s,value:o[s]};return a(c,p)}});var a;const u=[];return function o(i){if(i!=null&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i===void 0)return;if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);let s,c;if(Array.isArray(i)){for(c="[",s=0;s0&&(u=e[0].spatialReference,n=e[0].hasZ,r=e[0].hasM)}else if(e instanceof it)a=e._elements,a.length>0&&(n=e._hasZ,r=e._hasM,u=e.get(0).spatialReference);else{if(!R(e))throw new d(null,l.InvalidParameter,null);for(const o of e.toArray())mt(a,o);a.length>0&&(u=e.get(0).spatialReference,n=e.get(0).hasZ===!0,r=e.get(0).hasM===!0)}return a.length===0?null:(Xr(a)||(a=a.slice(0).reverse()),new ue({rings:[a],spatialReference:u,hasZ:n,hasM:r}))}return e}function kt(e,t){if(T(e)||R(e)){let n=!1,r=!1,a=[],u=t;if(T(e)){for(const o of e)mt(a,o);a.length>0&&(u=e[0].spatialReference,n=e[0].hasZ===!0,r=e[0].hasM===!0)}else if(e instanceof it)a=e._elements,a.length>0&&(n=e._hasZ,r=e._hasM,u=e.get(0).spatialReference);else if(R(e)){for(const o of e.toArray())mt(a,o);a.length>0&&(u=e.get(0).spatialReference,n=e.get(0).hasZ===!0,r=e.get(0).hasM===!0)}return a.length===0?null:new oe({paths:[a],spatialReference:u,hasZ:n,hasM:r})}return e}function Vt(e,t){if(T(e)||R(e)){let n=!1,r=!1,a=[],u=t;if(T(e)){for(const o of e)mt(a,o);a.length>0&&(u=e[0].spatialReference,n=e[0].hasZ===!0,r=e[0].hasM===!0)}else if(e instanceof it)a=e._elements,a.length>0&&(n=e._hasZ,r=e._hasM,u=e.get(0).spatialReference);else if(R(e)){for(const o of e.toArray())mt(a,o);a.length>0&&(u=e.get(0).spatialReference,n=e.get(0).hasZ===!0,r=e.get(0).hasM===!0)}return a.length===0?null:new be({points:a,spatialReference:u,hasZ:n,hasM:r})}return e}function Na(e,t=!1){const n=[];if(e===null)return n;if(T(e)===!0){for(let r=0;r{setTimeout(()=>{t(e)},0)})):e}function ir(e,t,n){switch(n){case"&":return e&t;case"|":return e|t;case"^":return e^t;case"<<":return e<>":return e>>t;case">>>":return e>>>t}}function Ke(e,t=null){return e==null?null:z(e)||q(e)||C(e)?e:e instanceof B?(t==null?void 0:t.keepGeometryType)===!0?e:e.toJSON():e instanceof se?e.toArray().map(n=>Ke(n,t)):e instanceof Array?e.map(n=>Ke(n,t)):Wt(e)?e:V(e)?e.toJSDate():J(e)?e.toString():P(e)?e.toJSDate():e!==null&&typeof e=="object"&&e.castAsJson!==void 0?e.castAsJson(t):null}async function Ma(e,t,n,r,a){const u=await ar(e,t,n);a[r]=u}async function ar(e,t=null,n=null){if(e instanceof se&&(e=e.toArray()),e==null)return null;if(Ge(e)||e instanceof B||Wt(e)||V(e))return Ke(e,n);if(e instanceof Array){const r=[],a=[];for(const u of e)u===null||Ge(u)||u instanceof B||Wt(u)||V(u)?a.push(Ke(u,n)):(a.push(null),r.push(Ma(u,t,n,a.length-1,a)));return r.length>0&&await Promise.all(r),a}return e!==null&&typeof e=="object"&&e.castAsJsonAsync!==void 0?e.castAsJsonAsync(t,n):null}function Ut(e){return Di(e)?e.parent:e}function Di(e){return e&&"declaredClass"in e&&e.declaredClass==="esri.layers.support.SubtypeSublayer"}function $a(e){return e&&"declaredClass"in e&&e.declaredClass==="esri.layers.SubtypeGroupLayer"}function gi(e,t,n){const r=Ut(e.fullSchema());return r===null||!r.fields?null:un(t,r,e,n)}function jt(e){const t=Ut(e.fullSchema());return t===null?null:t.fields&&t.typeIdField?{subtypeField:t.typeIdField,subtypes:t.types?t.types.map(n=>({name:n.name,code:n.id})):[]}:null}function yi(e,t,n,r){const a=Ut(e.fullSchema());if(a===null||!a.fields)return null;const u=un(t,a,e,r);if(n===void 0)try{n=e.field(t)}catch{return null}return mi(u,n)}function wi(e,t,n,r){const a=Ut(e.fullSchema());if(a===null||!a.fields)return null;if(n===void 0){try{n=e.field(t)}catch{return null}return n}return pi(un(t,a,e,r),n)}function _(e){return(e==null?void 0:e.timeZone)??"system"}function xi(e){const t=Ut(e.fullSchema());if(t===null||!t.fields)return null;const n=[];for(const r of t.fields)n.push(Ta(r));return{objectIdField:t.objectIdField,globalIdField:t.globalIdField??"",geometryType:Fr[t.geometryType]===void 0?"":Fr[t.geometryType],fields:n}}function Fi(e,t){return e==="system"&&(e=O.systemTimeZoneCanonicalName),{version:Ci,engineVersion:Qr,timeZone:e,spatialReference:t instanceof yt?t.toJSON():t,application:wa.applicationName??"",engine:"web",locale:Kn()}}const Ci="1.24",Ai=Object.freeze(Object.defineProperty({__proto__:null,ImplicitResult:ft,ImplicitResultE:fi,ReturnResult:ye,ReturnResultE:di,absRound:Nn,arcadeVersion:Ci,autoCastArrayOfPointsToMultiPoint:Vt,autoCastArrayOfPointsToPolygon:Mn,autoCastArrayOfPointsToPolyline:kt,autoCastFeatureToGeometry:Z,binaryOperator:ir,breakResult:Ie,castAsJson:Ke,castAsJsonAsync:ar,continueResult:wt,defaultExecutingContext:Fi,defaultTimeZone:_,defaultUndefined:$,equalityTest:Ee,featureDomainCodeLookup:wi,featureDomainValueLookup:yi,featureFullDomain:gi,featureSchema:xi,featureSubtypes:jt,fixNullGeometry:Ye,fixSpatialReference:te,formatDate:on,formatNumber:tr,generateUUID:st,getDomain:un,getDomainCode:pi,getDomainValue:mi,getType:Qn,greaterThanLessThan:rr,isArray:T,isBoolean:z,isDate:V,isDateOnly:P,isDictionary:hi,isFeature:ee,isFeatureSet:xt,isFeatureSetCollection:Rt,isFunctionParameter:X,isGeometry:er,isImmutableArray:R,isInteger:Pe,isJsDate:Wt,isModule:Xn,isNumber:q,isObject:Bn,isSimpleType:Ge,isString:C,isSubtypeGrouplayer:$a,isSubtypeSublayer:Di,isTime:J,multiReplace:He,pcCheck:D,stableStringify:_n,standardiseDateFormat:nr,tick:_a,toBoolean:ht,toDate:ae,toNumber:h,toNumberArray:We,toString:w,toStringArray:Na,toStringExplicit:we,voidOperation:A},Symbol.toStringTag,{value:"Module"}));function La(e){bi=e}let bi;function Mt(e){return e===null?null:V(e)?e.clone():Ge(e)?e:er(e)?e.clone():R(e)?e.toArray().map(t=>Mt(t)):T(e)?e.map(t=>Mt(t)):ee(e)?bi.createFromArcadeFeature(e):Rt(e)||xt(e)?e:hi(e)||(e==null?void 0:e.declaredClass)==="esri.arcade.Attachment"?e.deepClone():((e==null?void 0:e.declaredClass)==="esri.arcade.Portal"||e instanceof Pt||X(e),e)}function Xt(e,t,n=!1,r=!1){if(e==null)return null;if(q(e))return h(e);if(z(e))return ht(e);if(C(e))return w(e);if(V(e))return ae(e,t);if(P(e)||J(e))return e;if(T(e)){const u=[];for(const o of e)u.push(Xt(o,t,n,r));return u}if(r&&er(e))return e;const a=new k;a.immutable=!1;for(const u of Object.keys(e)){const o=e[u];o!==void 0&&a.setField(u,Xt(o,t,n,r))}return a.immutable=n,a}let k=class Ht{constructor(t){this.declaredClass="esri.arcade.Dictionary",this.attributes=null,this.plain=!1,this.immutable=!0,this.attributes=t instanceof Ht?t.attributes:t??{}}field(t){const n=t.toLowerCase(),r=this.attributes[t];if(r!==void 0)return r;for(const a in this.attributes)if(a.toLowerCase()===n)return this.attributes[a];throw new d(null,l.FieldNotFound,null,{key:t})}setField(t,n){if(this.immutable)throw new d(null,l.Immutable,null);if(X(n))throw new d(null,l.NoFunctionInDictionary,null);const r=t.toLowerCase();if(n instanceof Date&&(n=O.dateJSToArcadeDate(n)),this.attributes[t]===void 0){for(const a in this.attributes)if(a.toLowerCase()===r)return void(this.attributes[a]=n);this.attributes[t]=n}else this.attributes[t]=n}hasField(t){const n=t.toLowerCase();if(this.attributes[t]!==void 0)return!0;for(const r in this.attributes)if(r.toLowerCase()===n)return!0;return!1}keys(){let t=[];for(const n in this.attributes)t.push(n);return t=t.sort(),t}castToText(t=!1){let n="";for(const r in this.attributes){n!==""&&(n+=",");const a=this.attributes[r];a==null?n+=JSON.stringify(r)+":null":z(a)||q(a)||C(a)?n+=JSON.stringify(r)+":"+JSON.stringify(a):a instanceof B?n+=JSON.stringify(r)+":"+we(a):a instanceof se||a instanceof Array?n+=JSON.stringify(r)+":"+we(a,null,t):a instanceof O?n+=t?JSON.stringify(r)+":"+JSON.stringify(a.getTime()):JSON.stringify(r)+":"+a.stringify():a!==null&&typeof a=="object"&&a.castToText!==void 0&&(n+=JSON.stringify(r)+":"+a.castToText(t))}return"{"+n+"}"}static convertObjectToArcadeDictionary(t,n,r=!0,a=!1){const u=new Ht;u.immutable=!1;for(const o in t){const i=t[o];i!==void 0&&u.setField(o.toString(),Xt(i,n,r,a))}return u.immutable=r,u}static convertJsonToArcade(t,n,r=!1){return Xt(t,n,r)}castAsJson(t=null){const n={};for(let r in this.attributes){const a=this.attributes[r];a!==void 0&&(t!=null&&t.keyTranslate&&(r=t.keyTranslate(r)),n[r]=Ke(a,t))}return n}async castDictionaryValueAsJsonAsync(t,n,r,a=null,u){const o=await ar(r,a,u);return t[n]=o,o}async castAsJsonAsync(t=null,n=null){const r={},a=[];for(let u in this.attributes){const o=this.attributes[u];n!=null&&n.keyTranslate&&(u=n.keyTranslate(u)),o!==void 0&&(Ge(o)||o instanceof B||o instanceof O?r[u]=Ke(o,n):a.push(this.castDictionaryValueAsJsonAsync(r,u,o,t,n)))}return a.length>0&&await Promise.all(a),r}deepClone(){const t=new Ht;t.immutable=!1;for(const n of this.keys())t.setField(n,Mt(this.field(n)));return t}},Q=class Fe{constructor(){this.arcadeDeclaredClass="esri.arcade.Feature",this._optimizedGeomDefinition=null,this._geometry=null,this.attributes=null,this._layer=null,this._fieldTypesFixed=!0,this.fieldsIndex=null,this.contextTimeZone=null,this.immutable=!0,this._fieldsToFixDataTypes=null,this.immutable=!0}static createFromGraphic(t,n){const r=new Fe;return r.contextTimeZone=n??null,r._geometry=t.geometry!=null?t.geometry:null,t.attributes===void 0||t.attributes===null?r.attributes={}:r.attributes=t.attributes,t._sourceLayer?(r._layer=t._sourceLayer,r._fieldTypesFixed=!1):t._layer?(r._layer=t._layer,r._fieldTypesFixed=!1):t.layer&&"fields"in t.layer?(r._layer=t.layer,r._fieldTypesFixed=!1):t.sourceLayer&&"fields"in t.sourceLayer&&(r._layer=t.sourceLayer,r._fieldTypesFixed=!1),r._layer&&!r._fieldTypesFixed&&(r.fieldsIndex=this.hydrateFieldsIndex(r._layer)),r}static createFromArcadeFeature(t){if(t instanceof Fe){const r=new Fe;return r._fieldTypesFixed=t._fieldTypesFixed,r.attributes=t.attributes,r._geometry=t._geometry,r._optimizedGeomDefinition=t._optimizedGeomDefinition,t._layer&&(r._layer=t._layer),r.fieldsIndex=t.fieldsIndex,r.contextTimeZone=t.contextTimeZone,r}const n={};for(const r of t.keys())n[r]=t.field(r);return Fe.createFromGraphicLikeObject(t.geometry(),n,t.fullSchema(),t.contextTimeZone)}static createFromOptimisedFeature(t,n,r){const a=new Fe;return a._geometry=t.geometry?{geometry:t.geometry}:null,a._optimizedGeomDefinition=r,a.attributes=t.attributes||{},a._layer=n,a._fieldTypesFixed=!1,a}static createFromArcadeDictionary(t){const n=new Fe;return n.attributes=t.field("attributes"),n.attributes!==null&&n.attributes instanceof k?(n.attributes=n.attributes.attributes,n.attributes===null&&(n.attributes={})):n.attributes={},n._geometry=t.field("geometry"),n._geometry!==null&&(n._geometry instanceof k?n._geometry=Fe.parseGeometryFromDictionary(n._geometry):n._geometry instanceof B||(n._geometry=null)),n}static createFromGraphicLikeObject(t,n,r=null,a){const u=new Fe;return u.contextTimeZone=a??null,n===null&&(n={}),u.attributes=n,u._geometry=t??null,u._layer=r,u._layer&&(u._fieldTypesFixed=!1,u.fieldsIndex=this.hydrateFieldsIndex(u._layer)),u}static hydrateFieldsIndex(t){return t===null?null:xt(t)?t.getFieldsIndex():t.fieldsIndex?t.fieldsIndex:xa.fromLayerJSON({datesInUnknownTimezone:t.datesInUnknownTimezone,fields:t.fields,timeInfo:t.timeInfo,editFieldsInfo:t.editFieldsInfo,dateFieldsTimeReference:t.dateFieldsTimeReference??{timeZone:"UTC",respectsDaylightSaving:!1}})}repurposeFromGraphicLikeObject(t,n,r=null){n===null&&(n={}),this.attributes=n,this._geometry=t??null,this._layer=r,this._layer?this._fieldTypesFixed=!1:this._fieldTypesFixed=!0}castToText(t=!1){let n="";this._fieldTypesFixed===!1&&this._fixFieldTypes();for(const r in this.attributes){n!==""&&(n+=",");const a=this.attributes[r];a==null?n+=JSON.stringify(r)+":null":z(a)||q(a)||C(a)?n+=JSON.stringify(r)+":"+JSON.stringify(a):a instanceof B?n+=JSON.stringify(r)+":"+we(a):a instanceof fe||a instanceof de?n+=`${JSON.stringify(r)}:${JSON.stringify(a.toString())}`:a instanceof se||a instanceof Array?n+=JSON.stringify(r)+":"+we(a,null,t):a instanceof O?n+=t?JSON.stringify(r)+":"+JSON.stringify(a.getTime()):JSON.stringify(r)+":"+a.stringify():a!==null&&typeof a=="object"&&a.castToText!==void 0&&(n+=JSON.stringify(r)+":"+a.castToText(t))}return'{"geometry":'+(this.geometry()===null?"null":we(this.geometry()))+',"attributes":{'+n+"}}"}_fixFieldTypes(){var r;if(this._fieldsToFixDataTypes&&((r=this._fieldsToFixDataTypes)==null?void 0:r.length)>0)return this._fixAllFields(this._fieldsToFixDataTypes),void(this._fieldTypesFixed=!0);const t=[],n=this._layer.fields;for(let a=0;a0&&this._fixAllFields(t),this._fieldTypesFixed=!0}isUnknownDateTimeField(t){var n;return((n=this.fieldsIndex)==null?void 0:n.getTimeZone(t))==="unknown"}_fixAllFields(t){this.attributes={...this.attributes};const n=this.contextTimeZone??"system";for(let r=0;r!n&&(a.type==="Identifier"&&a.name&&a.name.toLowerCase()===r&&(n=!0),!0)),n}function Si(e){const t=[];return K(e,n=>(n.type==="ImportDeclaration"&&n.source&&n.source.value&&t.push({libname:n.specifiers[0].local.name.toLowerCase(),source:n.source.value}),!0)),t}function Ra(e,t){let n=!1;const r=t.toLowerCase();return K(e,a=>!n&&(a.type!=="CallExpression"||a.callee.type!=="Identifier"||!a.callee.name||a.callee.name.toLowerCase()!==r||(n=!0,!1))),n}function Ua(e){const t=[];return K(e,n=>{var r;return n.type!=="MemberExpression"||n.object.type!=="Identifier"||(n.computed===!1&&n.object&&n.object.name&&n.property&&n.property.type==="Identifier"&&n.property.name?t.push(n.object.name.toLowerCase()+"."+n.property.name.toLowerCase()):n.object&&n.object.name&&n.property&&n.property.type==="Literal"&&typeof n.property.value=="string"&&t.push(n.object.name.toLowerCase()+"."+((r=n.property.value)==null?void 0:r.toString().toLowerCase())),!1)}),t}function za(e){const t=[];return K(e,n=>{var r;if(n.type==="CallExpression"){if(n.callee.type==="Identifier"&&n.callee.name.toLowerCase()==="expects"){let a="";for(let u=0;u<(n.arguments||[]).length;u++)u===0?n.arguments[u].type==="Identifier"&&(a=n.arguments[u].name.toLowerCase()):a&&n.arguments[u].type==="Literal"&&Er(n.arguments[u].value)&&t.push(a+"."+n.arguments[u].value.toLowerCase());return!1}if(n.callee.type==="Identifier"&&["domainname","domaincode","domain","haskey"].includes(n.callee.name.toLowerCase())&&n.arguments.length>=2){let a="";return n.arguments[0].type==="Identifier"&&(a=n.arguments[0].name.toLowerCase()),a&&n.arguments[1].type==="Literal"&&Er(n.arguments[1].value)&&t.push(a+"."+n.arguments[1].value.toLowerCase()),!1}}return n.type!=="MemberExpression"||n.object.type!=="Identifier"||(n.computed===!1&&n.object&&n.object.name&&n.property&&n.property.type==="Identifier"&&n.property.name?t.push(n.object.name.toLowerCase()+"."+n.property.name.toLowerCase()):n.object&&n.object.name&&n.property&&n.property.type==="Literal"&&typeof n.property.value=="string"&&t.push(n.object.name.toLowerCase()+"."+((r=n.property.value)==null?void 0:r.toString().toLowerCase())),!1)}),t}function Ln(e){const t=[];return K(e,n=>(n.type==="CallExpression"&&n.callee.type==="Identifier"&&t.push(n.callee.name.toLowerCase()),!0)),t}function zt(e,t=[]){let n=null;if(e.usesFeatureSet===void 0){n===null&&(n=Ln(e)),e.usesFeatureSet=!1;for(let r=0;r0){for(const r of t)if(Ei(e,r)){e.usesFeatureSet=!0,e.isAsync=!0;break}}}if(e.usesModules===void 0&&(e.usesModules=!1,Si(e).length>0&&(e.usesModules=!0)),e.usesGeometry===void 0){e.usesGeometry=!1,n===null&&(n=Ln(e));for(let r=0;r0||s.length>0;)if(i.length>0&&s.length>0){let f=c(i[0],s[0]);isNaN(f)&&(f=0),f<=0?(p.push(i[0]),i=i.slice(1)):(p.push(s[0]),s=s.slice(1))}else i.length>0?(p.push(i[0]),i=i.slice(1)):s.length>0&&(p.push(s[0]),s=s.slice(1));return p}async function a(i,s){const c=i.length,p=Math.floor(c/2);if(c===0)return[];if(c===1)return[i[0]];const f=[await a(i.slice(0,p),s),await a(i.slice(p,c),s)];return u(f[0],f[1],s,[])}async function u(i,s,c,p){const f=p;if(!(i.length>0||s.length>0))return p;if(i.length>0&&s.length>0){let m=await c(i[0],s[0]);return isNaN(m)&&(m=1),m<=0?(f.push(i[0]),i=i.slice(1)):(f.push(s[0]),s=s.slice(1)),u(i,s,c,p)}return i.length>0?(f.push(i[0]),u(i=i.slice(1),s,c,p)):s.length>0?(f.push(s[0]),u(i,s=s.slice(1),c,p)):void 0}function o(i,s,c,p){D(c,1,2,i,s);let f=c[0];if(R(f)&&(f=f.toArray()),T(f)===!1)throw new d(i,l.InvalidParameter,s);if(c.length>1){if(X(c[1])===!1)throw new d(i,l.InvalidParameter,s);let I=f;const W=c[1].createFunction(i);return p?a(I,W):(I=n(I,(pe,Zt)=>W(pe,Zt)),I)}let m=f;if(m.length===0)return[];const g={};for(let I=0;I1||M==="String"?n(m,(I,W)=>{if(I==null||I===A)return W==null||W===A?0:1;if(W==null||W===A)return-1;const pe=w(I),Zt=w(W);return peI-W):M==="Boolean"?n(m,(I,W)=>I===W?0:W?-1:1):M==="Date"?n(m,(I,W)=>W-I):m.slice(0),m}e.functions.array=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,0,2,i,s),f.length===0)return new Array;if(f.length===1&&f[0]===null)return new Array;if(T(f[0])){if(f.length===2&&z(f[1])===!1)throw new d(i,l.InvalidParameter,s);return $(f[1],!1)===!0?Mt(f[0]):f[0].slice(0)}if(R(f[0])){if(f.length===2&&z(f[1])===!1)throw new d(i,l.InvalidParameter,s);return $(f[1],!1)===!0?Mt(f[0]):f[0].toArray().slice(0)}const m=h(f[0]);if(isNaN(m)||Pe(m)===!1)throw new d(i,l.InvalidParameter,s);const g=$(f[1],null),x=new Array(m);return x.fill(g),x})},e.functions.front=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,1,1,i,s),R(f[0])){if(f[0].length()<=0)throw new d(i,l.OutOfBounds,s);return f[0].get(0)}if(T(f[0])){if(f[0].length<=0)throw new d(i,l.OutOfBounds,s);return f[0][0]}throw new d(i,l.InvalidParameter,s)})},e.functions.back=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,1,1,i,s),R(f[0])){if(f[0].length()<=0)throw new d(i,l.OutOfBounds,s);return f[0].get(f[0].length()-1)}if(T(f[0])){if(f[0].length<=0)throw new d(i,l.OutOfBounds,s);return f[0][f[0].length-1]}throw new d(i,l.InvalidParameter,s)})},e.functions.push=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,1,2,i,s),T(f[0]))return f[0][f[0].length]=f[1],f[0].length;throw new d(i,l.InvalidParameter,s)})},e.functions.pop=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,1,1,i,s),T(f[0])){if(f[0].length<=0)throw new d(i,l.OutOfBounds,s);const m=f[0][f[0].length-1];return f[0].length=f[0].length-1,m}throw new d(i,l.InvalidParameter,s)})},e.functions.erase=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,2,2,i,s),T(f[0])){let m=h(f[1]);if(isNaN(m)||Pe(m)===!1)throw new d(i,l.InvalidParameter,s);const g=f[0];if(g.length<=0)throw new d(i,l.OutOfBounds,s);if(m<0&&(m=g.length+m),m<0)throw new d(i,l.OutOfBounds,s);if(m>=g.length)throw new d(i,l.OutOfBounds,s);return g.splice(m,1),A}throw new d(i,l.InvalidParameter,s)})},e.functions.insert=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,3,3,i,s),T(f[0])){const m=h(f[1]);if(isNaN(m)||Pe(m)===!1)throw new d(i,l.InvalidParameter,s);const g=f[2],x=f[0];if(m>x.length)throw new d(i,l.OutOfBounds,s);if(m<0&&m<-1*x.length)throw new d(i,l.OutOfBounds,s);return m===x.length?(x[m]=g,A):(x.splice(m,0,g),A)}throw new d(i,l.InvalidParameter,s)})},e.functions.resize=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,2,3,i,s),T(f[0])){const m=h(f[1]);if(isNaN(m)||Pe(m)===!1)throw new d(i,l.InvalidParameter,s);if(m<0)throw new d(i,l.InvalidParameter,s);const g=$(f[2],null),x=f[0];if(x.length>=m)return x.length=m,A;const M=x.length;x.length=m;for(let I=M;I{if(D(f,2,2,i,s),T(f[0])){const m=f[1];return f[0].findIndex(g=>Ee(g,m))>-1}if(R(f[0])){const m=f[1];return f[0].toArray().findIndex(g=>Ee(g,m))>-1}throw new d(i,l.InvalidParameter,s)})},e.functions.slice=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,1,3,i,s),T(f[0])){const m=h($(f[1],0)),g=h($(f[2],f[0].length));if(isNaN(m)||Pe(m)===!1)throw new d(i,l.InvalidParameter,s);if(isNaN(g)||Pe(g)===!1)throw new d(i,l.InvalidParameter,s);return f[0].slice(m,g)}if(R(f[0])){const m=f[0],g=h($(f[1],0)),x=h($(f[2],m.length()));if(isNaN(g)||Pe(g)===!1)throw new d(i,l.InvalidParameter,s);if(isNaN(x)||Pe(x)===!1)throw new d(i,l.InvalidParameter,s);return m.toArray().slice(g,x)}throw new d(i,l.InvalidParameter,s)})},e.functions.splice=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{const m=[];for(let g=0;g{if(D(f,2,2,i,s),T(f[0]))return h(f[1])>=f[0].length?f[0].slice(0):f[0].slice(0,h(f[1]));if(R(f[0]))return h(f[1])>=f[0].length()?f[0].slice(0):f[0].slice(0,h(f[1]));throw new d(i,l.InvalidParameter,s)})},e.functions.first=function(i,s){return e.standardFunction(i,s,(c,p,f)=>(D(f,1,1,i,s),T(f[0])?f[0].length===0?null:f[0][0]:R(f[0])?f[0].length()===0?null:f[0].get(0):null))},e.mode==="sync"&&(e.functions.sort=function(i,s){return e.standardFunction(i,s,(c,p,f)=>o(i,s,f,!1))},e.functions.any=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g){const M=m(x);if(z(M)&&M===!0)return!0}return!1})},e.functions.all=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g)if(m(x)!==!0)return!1;return!0})},e.functions.none=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g)if(m(x)===!0)return!1;return!0})},e.functions.reduce=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,3,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);return f.length===2?g.length===0?null:g.reduce((x,M)=>{const I=m(x,M);return x=I!==void 0&&I!==A?I:null}):g.reduce((x,M)=>{const I=m(x,M);return x=I!==void 0&&I!==A?I:null},f[2])})},e.functions.map=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s),x=[];for(const M of g){const I=m(M);I!==void 0&&I!==A?x.push(I):x.push(null)}return x})},e.functions.filter=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s),x=[];for(const M of g)m(M)===!0&&x.push(M);return x})}),e.mode==="async"&&(e.functions.sort=function(i,s){return e.standardFunctionAsync(i,s,(c,p,f)=>o(i,s,f,!0))},e.functions.any=function(i,s){return e.standardFunctionAsync(i,s,async(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g){const M=await m(x);let I=null;if(I=qe(I)?await M:M,z(I)&&I===!0)return!0}return!1})},e.functions.all=function(i,s){return e.standardFunctionAsync(i,s,async(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g){const M=await m(x);let I=null;if(I=qe(I)?await M:M,I!==!0)return!1}return!0})},e.functions.none=function(i,s){return e.standardFunctionAsync(i,s,async(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g){const M=await m(x);let I=null;if(I=qe(I)?await M:M,I===!0)return!1}return!0})},e.functions.filter=function(i,s){return e.standardFunctionAsync(i,s,async(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s),x=[];for(const M of g){const I=await m(M);let W=null;W=qe(W)?await I:I,W===!0&&x.push(M)}return x})},e.functions.reduce=function(i,s){return e.standardFunctionAsync(i,s,(c,p,f)=>{D(f,2,3,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);let x=null;if(f.length>2){const M=$(f[2],null);x=g.reduce(async(I,W)=>{let pe=await I;return pe!==void 0&&pe!==A||(pe=null),m(pe,W)},Promise.resolve(M))}else{if(g.length===0)return null;x=g.reduce(async(M,I,W)=>{if(W<=1)return m(M,I);let pe=await M;return pe!==void 0&&pe!==A||(pe=null),m(pe,I)})}return x.then(M=>M!==void 0&&M!==A?M:null)})},e.functions.map=function(i,s){return e.standardFunctionAsync(i,s,async(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s),x=[];for(const M of g){const I=await m(M);let W=null;W=qe(W)?await I:I,W!==void 0&&W!==A?x.push(W):x.push(null)}return x})})}const On=Object.freeze(Object.defineProperty({__proto__:null,registerFunctions:Ga},Symbol.toStringTag,{value:"Module"}));function Za(e,t,n){return e+(Ja(n)?Va:qa)[t]}function Ja(e){return e%4==0&&(e%100!=0||e%400==0)}const qa=[0,31,59,90,120,151,181,212,243,273,304,334],Va=[0,31,60,91,121,152,182,213,244,274,305,335];function Be(e){return e===null?e:e.isValid===!1?null:e}function Ft(e,t){return e===""||e.toLowerCase().trim()==="default"?_(t):e==="z"||e==="Z"?"UTC":e}function $e(e,t){return P(e)?e.toArcadeDate():ae(e,_(t))}function vi(e,t){e.today=function(n,r){return t(n,r,(a,u,o)=>{D(o,0,0,n,r);const i=new Date;return i.setHours(0,0,0,0),O.dateJSAndZoneToArcadeDate(i,_(n))})},e.time=function(n,r){return t(n,r,(a,u,o)=>{switch(D(o,0,4,n,r),o.length){case 0:{const i=O.nowToArcadeDate(_(n));return new fe(i.hour,i.minute,i.second,i.millisecond)}case 1:{if(J(o[0]))return o[0].clone();if(V(o[0]))return new fe(o[0].hour,o[0].minute,o[0].second,o[0].millisecond);if(P(o[0]))return new fe(0,0,0,0);if(C(o[0]))return fe.fromString(o[0]);const i=h(o[0]);return isNaN(i)===!1?fe.fromMilliseconds(i):null}case 2:return C(o[0])&&C(o[1])?fe.fromString(o[0],o[1]):fe.fromParts(h(o[0]),h(o[1]),0,0);case 3:return fe.fromParts(h(o[0]),h(o[1]),h(o[2]),0);case 4:return fe.fromParts(h(o[0]),h(o[1]),h(o[2]),h(o[3]))}throw new d(n,l.InvalidParameter,r)})},e.dateonly=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,0,3,n,r),o.length===3)return de.fromParts(h(o[0]),h(o[1])+1,h(o[2]));if(o.length===2){const i=w(o[1]);return i===""?null:i==="X"?de.fromSeconds(h(o[0])):i==="x"?de.fromMilliseconds(h(o[0])):de.fromString(w(o[0]),i)}if(o.length===1){if(C(o[0])){if(o[0].replaceAll(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")==="")return null;if(/^[0-9][0-9][0-9][0-9]$/.test(o[0])===!0)return de.fromString(o[0]+"-01-01")}if(P(o[0]))return o[0].clone();if(V(o[0]))return de.fromParts(o[0].year,o[0].monthJS+1,o[0].day);const i=h(o[0]);return isNaN(i)===!1?de.fromMilliseconds(i):C(o[0])?de.fromString(o[0]):null}if(o.length===0){const i=O.nowToArcadeDate(_(n));return i.isValid===!1?null:de.fromParts(i.year,i.monthJS+1,i.day)}return null})},e.changetimezone=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,2,n,r),o[0]===null)return null;if(P(o[0]))throw new d(n,l.CannotChangeTimeZoneDateOnly,r);if(P(o[0]))throw new d(n,l.CannotChangeTimeZoneTime,r);const i=ae(o[0],_(n));if(i===null)throw new d(n,l.InvalidParameter,r);const s=bt(Ft(w(o[1]),n),!1);if(s===null)return null;const c=O.arcadeDateAndZoneToArcadeDate(i,s);return c.isValid===!1?null:c})},e.timezone=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,2,n,r),J(o[0])||P(o[0]))return"Unknown";const i=ae(o[0],_(n));if(i===null)return null;const s=i.timeZone;return s==="system"?O.systemTimeZoneCanonicalName:s.toLowerCase()==="utc"?"UTC":s.toLowerCase()==="unknown"?"Unknown":s})},e.timezoneoffset=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=ae(o[0],_(n));return i===null?null:60*i.timeZoneOffset*1e3})},e.now=function(n,r){return t(n,r,(a,u,o)=>{D(o,0,0,n,r);const i=O.nowToArcadeDate(_(n));return i.isValid===!1?null:i})},e.timestamp=function(n,r){return t(n,r,(a,u,o)=>{D(o,0,0,n,r);const i=O.nowUTCToArcadeDate();return i.isValid===!1?null:i})},e.toutc=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=ae(o[0],_(n));return i===null?null:i.toUTC()})},e.tolocal=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=ae(o[0],_(n));return i===null?null:i.toLocal()})},e.day=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.day})},e.month=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.monthJS})},e.year=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.year})},e.hour=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),J(o[0]))return o[0].hour;const i=ae(o[0],_(n));return i===null?NaN:i.hour})},e.second=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),J(o[0]))return o[0].second;const i=ae(o[0],_(n));return i===null?NaN:i.second})},e.millisecond=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),J(o[0]))return o[0].millisecond;const i=ae(o[0],_(n));return i===null?NaN:i.millisecond})},e.minute=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),J(o[0]))return o[0].minute;const i=ae(o[0],_(n));return i===null?NaN:i.minute})},e.week=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,2,n,r);const i=$e(o[0],_(n));if(i===null)return NaN;const s=h($(o[1],0));if(s<0||s>6)throw new d(n,l.InvalidParameter,r);const c=i.day,p=i.monthJS,f=i.year,m=i.dayOfWeekJS,g=Za(c,p,f)-1,x=Math.floor(g/7);return m-s+(m-s<0?7:0){D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.dayOfWeekJS})},e.isoweekday=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.dayOfWeekISO})},e.isomonth=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.monthISO})},e.isoweek=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.weekISO})},e.isoyear=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.yearISO})},e.date=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,0,8,n,r),o.length===3){if(P(o[0])&&J(o[1])&&C(o[2])){const i=bt(Ft(w(o[2])??"unknown",n),!1);return i===null?null:Be(O.fromParts(o[0].year,o[0].month,o[0].day,o[1].hour,o[1].minute,o[1].second,o[1].millisecond,i))}return Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),0,0,0,0,_(n)))}if(o.length===4)return Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),h(o[3]),0,0,0,_(n)));if(o.length===5)return Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),h(o[3]),h(o[4]),0,0,_(n)));if(o.length===6)return Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),h(o[3]),h(o[4]),h(o[5]),0,_(n)));if(o.length===7)return Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),h(o[3]),h(o[4]),h(o[5]),h(o[6]),_(n)));if(o.length===8){const i=bt(Ft(w(o[7])??"unknown",n),!1);return i===null?null:Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),h(o[3]),h(o[4]),h(o[5]),h(o[6]),i))}if(o.length===2){if(P(o[0])&&C(o[1])){const c=bt(Ft(w(o[1])??"unknown",n),!1);return c===null?null:Be(O.fromParts(o[0].year,o[0].month,o[0].day,0,0,0,0,c))}if(P(o[0])&&J(o[1]))return Be(O.fromParts(o[0].year,o[0].month,o[0].day,o[1].hour,o[1].minute,o[1].second,o[1].millisecond,"unknown"));let i,s=w(o[1]);return s===""?null:(s=nr(s,!0),i=s==="X"?Qe.fromSeconds(h(o[0])):s==="x"?Qe.fromMillis(h(o[0])):Qe.fromFormat(w(o[0]),s,{locale:Kn(),numberingSystem:"latn"}),i.isValid?O.dateTimeToArcadeDate(i):null)}if(o.length===1){if(P(o[0]))return Be(O.fromParts(o[0].year,o[0].month,o[0].day,0,0,0,0,"unknown"));if(C(o[0])){if(o[0].replaceAll(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")==="")return null;if(/^[0-9][0-9][0-9][0-9]$/.test(o[0])===!0)return ae(o[0]+"-01-01",_(n))}const i=h(o[0]);if(isNaN(i)===!1){const s=Qe.fromMillis(i);return s.isValid?O.dateTimeAndZoneToArcadeDate(s,_(n)):null}return ae(o[0],_(n))}return o.length===0?O.nowToArcadeDate(_(n)):null})},e.datediff=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,4,n,r),J(o[0]))return J(o[1])?o[0].difference(o[1],w(o[2])):NaN;if(J(o[1]))return NaN;if(P(o[0]))return P(o[1])?o[0].difference(o[1],w(o[2])):NaN;if(P(o[1]))return NaN;let i=ae(o[0],_(n)),s=ae(o[1],_(n));if(i===null||s===null)return NaN;let c=$(o[3],"");switch(c!==""&&c!==null?(c=Ft(w(c),n),i=O.arcadeDateAndZoneToArcadeDate(i,c),s=O.arcadeDateAndZoneToArcadeDate(s,c)):i.timeZone!==s.timeZone&&(i.isUnknownTimeZone?i=O.arcadeDateAndZoneToArcadeDate(i,s.timeZone):s=(s.isUnknownTimeZone,O.arcadeDateAndZoneToArcadeDate(s,i.timeZone))),w(o[2]).toLowerCase()){case"days":case"day":case"d":return i.diff(s,"days");case"months":case"month":return i.diff(s,"months");case"minutes":case"minute":case"m":return o[2]==="M"?i.diff(s,"months"):i.diff(s,"minutes");case"seconds":case"second":case"s":return i.diff(s,"seconds");case"milliseconds":case"millisecond":case"ms":default:return i.diff(s);case"hours":case"hour":case"h":return i.diff(s,"hours");case"years":case"year":case"y":return i.diff(s,"years")}})},e.dateadd=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,3,n,r);let i=h(o[1]);if(isNaN(i)||i===1/0||i===-1/0)return J(o[0])||P(o[0])?o[0].clone():ae(o[0],_(n));let s="milliseconds";switch(w(o[2]).toLowerCase()){case"days":case"day":case"d":s="days",i=P(o[0])?i:Nn(i);break;case"months":case"month":s="months",i=P(o[0])?i:Nn(i);break;case"minutes":case"minute":case"m":s=o[2]==="M"?"months":"minutes";break;case"seconds":case"second":case"s":s="seconds";break;case"milliseconds":case"millisecond":case"ms":s="milliseconds";break;case"hours":case"hour":case"h":s="hours";break;case"years":case"year":case"y":s="years"}if(J(o[0])||P(o[0]))return o[0].plus(s,i);const c=ae(o[0],_(n));return c===null?null:c.plus({[s]:i})})}}function Ct(e,t,n){return Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]!==void 0&&t[2]!==void 0?(e[2]*n-t[2]*n)**2:0))}const Et=[];for(const e of[[9002,56146130,6131,6132,8050,8051,8228],[9003,5702,6358,6359,6360,8052,8053],[9095,5754]]){const t=e[0];for(let n=1;n0?(r.x/=a,r.y/=a,t&&(r.z/=a),n&&(r.m/=a)):(r.x=e[0][0],r.y=e[0][1],t&&(r.z=e[0][2]),n&&t?r.m=e[0][3]:n&&(r.m=e[0][2])),r}function Ha(e,t,n,r){const a={x:(e[0]+t[0])/2,y:(e[1]+t[1])/2};return n&&(a.z=(e[2]+t[2])/2),n&&r?a.m=(e[3]+t[3])/2:r&&(a.m=(e[2]+t[2])/2),a}function Ka(e,t){if(e.length<=1)return 0;let n=0;for(let r=1;r0?(n.x/=a,n.y/=a,e.hasZ===!0&&(n.z/=a),e.hasM===!0&&(n.m/=a),new H(n)):r>0?(t.x/=r,t.y/=r,e.hasZ===!0&&(n.z/=r),e.hasM===!0&&(t.m/=r),new H(t)):null}function Xa(e){if(e.points.length===0)return null;let t=0,n=0,r=0,a=0;for(let o=0;o=r;)e-=t;return e}function ki(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function to(e,t){return cn(ki(e,t),2*Math.PI)*(180/Math.PI)}function no(e,t){return cn(Math.PI/2-ki(e,t),2*Math.PI)*(180/Math.PI)}function Ti(e,t,n){const r={x:e.x-t.x,y:e.y-t.y},a={x:n.x-t.x,y:n.y-t.y};return Math.atan2(eo(r,a),Qa(r,a))}function ro(e,t,n){return ei(cn(Ti(e,t,n),2*Math.PI))}function io(e,t,n){return ei(cn(-1*Ti(e,t,n),2*Math.PI))}Tt[9002]=.3048,Tt[9003]=.3048006096012192,Tt[9095]=.3048007491;const ie=[0,0];function vr(e){for(let t=0;t{D(o,1,1,n,r);let i=[];if(o[0]===null)return!1;if(T(o[0]))for(const s of o[0]){if(!(s instanceof H))throw new d(n,l.InvalidParameter,r);i.push(s.hasZ?s.hasM?[s.x,s.y,s.z,s.m]:[s.x,s.y,s.z]:[s.x,s.y])}else if(o[0]instanceof it)i=o[0]._elements;else{if(!R(o[0]))throw new d(n,l.InvalidParameter,r);for(const s of o[0].toArray()){if(!(s instanceof H))throw new d(n,l.InvalidParameter,r);i.push(s.hasZ?s.hasM?[s.x,s.y,s.z,s.m]:[s.x,s.y,s.z]:[s.x,s.y])}}return!(i.length<3)&&Xr(i)})},e.polygon=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);let i=null;if(o[0]instanceof k){if(i=te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference),!(i instanceof ue))throw new d(n,l.InvalidParameter,r)}else i=o[0]instanceof ue?De(o[0].toJSON()):te(new ue(JSON.parse(o[0])),n.spatialReference);if(i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.polyline=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);let i=null;if(o[0]instanceof k){if(i=te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference),!(i instanceof oe))throw new d(n,l.InvalidParameter,r)}else i=o[0]instanceof oe?De(o[0].toJSON()):te(new oe(JSON.parse(o[0])),n.spatialReference);if(i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.point=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);let i=null;if(o[0]instanceof k){if(i=te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference),!(i instanceof H))throw new d(n,l.InvalidParameter,r)}else i=o[0]instanceof H?De(o[0].toJSON()):te(new H(JSON.parse(o[0])),n.spatialReference);if(i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.multipoint=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);let i=null;if(o[0]instanceof k){if(i=te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference),!(i instanceof be))throw new d(n,l.InvalidParameter,r)}else i=o[0]instanceof be?De(o[0].toJSON()):te(new be(JSON.parse(o[0])),n.spatialReference);if(i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.extent=function(n,r){return t(n,r,(a,u,o)=>{var s;o=Z(o),D(o,1,1,n,r);let i=null;if(o[0]instanceof k)i=te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference);else if(o[0]instanceof H){const c={xmin:o[0].x,ymin:o[0].y,xmax:o[0].x,ymax:o[0].y,spatialReference:o[0].spatialReference.toJSON()},p=o[0];p.hasZ?(c.zmin=p.z,c.zmax=p.z):p.hasM&&(c.mmin=p.m,c.mmax=p.m),i=De(c)}else i=o[0]instanceof ue||o[0]instanceof oe||o[0]instanceof be?De((s=o[0].extent)==null?void 0:s.toJSON()):o[0]instanceof ge?De(o[0].toJSON()):te(new ge(JSON.parse(o[0])),n.spatialReference);if(i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.geometry=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);let i=null;if(o[0]===null)return null;if(i=qt(o[0])?te(o[0].geometry(),n.spatialReference):o[0]instanceof k?te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference):te(De(JSON.parse(o[0])),n.spatialReference),i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.setgeometry=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,2,n,r),!qt(o[0]))throw new d(n,l.InvalidParameter,r);if(o[0].immutable===!0)throw new d(n,l.Immutable,r);if(!(o[1]instanceof B||o[1]===null))throw new d(n,l.InvalidParameter,r);return o[0]._geometry=o[1],A})},e.feature=function(n,r){return t(n,r,(a,u,o)=>{if(o.length===0)throw new d(n,l.WrongNumberOfParameters,r);let i=null;if(o.length===1)if(C(o[0]))i=Q.fromJson(JSON.parse(o[0]),n.timeZone);else if(qt(o[0]))i=Q.createFromArcadeFeature(o[0]);else if(o[0]instanceof B)i=Q.createFromGraphicLikeObject(o[0],null,null,n.timeZone);else{if(!(o[0]instanceof k))throw new d(n,l.InvalidParameter,r);{let s=o[0].hasField("geometry")?o[0].field("geometry"):null,c=o[0].hasField("attributes")?o[0].field("attributes"):null;s!==null&&s instanceof k&&(s=Q.parseGeometryFromDictionary(s)),c!==null&&(c=Q.parseAttributesFromDictionary(c)),i=Q.createFromGraphicLikeObject(s,c,null,n.timeZone)}}else if(o.length===2){let s=null,c=null;if(o[0]!==null)if(o[0]instanceof B)s=o[0];else{if(!(s instanceof k))throw new d(n,l.InvalidParameter,r);s=Q.parseGeometryFromDictionary(o[0])}if(o[1]!==null){if(!(o[1]instanceof k))throw new d(n,l.InvalidParameter,r);c=Q.parseAttributesFromDictionary(o[1])}i=Q.createFromGraphicLikeObject(s,c,null,n.timeZone)}else{let s=null;const c={};if(o[0]!==null)if(o[0]instanceof B)s=o[0];else{if(!(s instanceof k))throw new d(n,l.InvalidParameter,r);s=Q.parseGeometryFromDictionary(o[0])}for(let p=1;p{if(o.length===0||o.length===1&&o[0]===null){const c=new k;return c.immutable=!1,c}if(o.length===1&&C(o[0]))try{const c=JSON.parse(o[0]),p=k.convertObjectToArcadeDictionary(c,_(n),!1);return p.immutable=!1,p}catch{throw new d(n,l.InvalidParameter,r)}if(o.length===1&&o[0]instanceof B)try{const c=o[0].toJSON();c.hasZ=o[0].hasZ===!0,c.hasM=o[0].hasM===!0;const p=k.convertObjectToArcadeDictionary(c,_(n),!1);return p.immutable=!1,p}catch{throw new d(n,l.InvalidParameter,r)}if(o.length===1&&ee(o[0]))try{const c=new k;c.immutable=!1,c.setField("geometry",o[0].geometry());const p=new k;p.immutable=!1,c.setField("attributes",p);for(const f of o[0].keys())p.setField(f,o[0].field(f));return c}catch{throw new d(n,l.InvalidParameter,r)}if(o.length===1&&o[0]instanceof k)try{const c=new k;c.immutable=!1;for(const p of o[0].keys())c.setField(p,o[0].field(p));return c}catch{throw new d(n,l.InvalidParameter,r)}if(o.length===2&&o[0]instanceof k&&z(o[1]))try{if(o[1]!==!0){const c=new k;c.immutable=!1;for(const p of o[0].keys())c.setField(p,o[0].field(p));return c}return o[0].deepClone()}catch{throw new d(n,l.InvalidParameter,r)}if(o.length%2!=0)throw new d(n,l.WrongNumberOfParameters,r);const i={};for(let c=0;c{D(o,2,2,n,r);const i=w(o[1]);if(qt(o[0])||o[0]instanceof k)return o[0].hasField(i);if(o[0]instanceof B){const s=$t(o[0],i,null,null,2);return!s||s.keystate!=="notfound"}throw new d(n,l.InvalidParameter,r)})},e.hasvalue=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,2,n,r),o[0]===null||o[1]===null)return!1;const i=w(o[1]);return ee(o[0])||o[0]instanceof k?!!o[0].hasField(i)&&o[0].field(i)!==null:o[0]instanceof B?$t(o[0],i,null,null,0)!==null:!1})},e.indexof=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,2,n,r);const i=o[1];if(T(o[0])){for(let s=0;s{if(o=Z(o),D(o,2,3,n,r),!(o[0]instanceof H))throw new d(n,l.InvalidParameter,r);if(!(o[1]instanceof H))throw new d(n,l.InvalidParameter,r);if(o.length>2&&!(o[2]instanceof H))throw new d(n,l.InvalidParameter,r);return o.length===2?to(o[0],o[1]):ro(o[0],o[1],o[2])})},e.bearing=function(n,r){return t(n,r,(a,u,o)=>{if(o=Z(o),D(o,2,3,n,r),!(o[0]instanceof H))throw new d(n,l.InvalidParameter,r);if(!(o[1]instanceof H))throw new d(n,l.InvalidParameter,r);if(o.length>2&&!(o[2]instanceof H))throw new d(n,l.InvalidParameter,r);return o.length===2?no(o[0],o[1]):io(o[0],o[1],o[2])})},e.isselfintersecting=function(n,r){return t(n,r,(a,u,o)=>{o=Z(o),D(o,1,1,n,r);let i=o[0];if(i instanceof ue)return i.isSelfIntersecting;if(i instanceof oe)return i=i.paths,vr(i);if(i instanceof be){const s=i.points;for(let c=0;c(i=Z(i),n(r,a,i),i[0]===null||i[1]===null||U.disjoint(i[0],i[1])))},e.intersects=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.intersects(i[0],i[1])))},e.touches=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.touches(i[0],i[1])))},e.crosses=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.crosses(i[0],i[1])))},e.within=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.within(i[0],i[1])))},e.contains=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.contains(i[0],i[1])))},e.overlaps=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.overlaps(i[0],i[1])))},e.equals=function(r,a){return t(r,a,(u,o,i)=>(D(i,2,2,r,a),i[0]===i[1]||(i[0]instanceof B&&i[1]instanceof B?U.equals(i[0],i[1]):(V(i[0])&&V(i[1])||J(i[0])&&J(i[1])||!(!P(i[0])||!P(i[1])))&&i[0].equals(i[1]))))},e.relate=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,3,3,r,a),i[0]instanceof B&&i[1]instanceof B)return U.relate(i[0],i[1],w(i[2]));if(i[0]instanceof B&&i[1]===null||i[1]instanceof B&&i[0]===null||i[0]===null&&i[1]===null)return!1;throw new d(r,l.InvalidParameter,a)})},e.intersection=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]===null||i[1]===null?null:U.intersect(i[0],i[1])))},e.union=function(r,a){return t(r,a,(u,o,i)=>{const s=[];if((i=Z(i)).length===0)throw new d(r,l.WrongNumberOfParameters,a);if(i.length===1)if(T(i[0])){const c=Z(i[0]);for(let p=0;p(i=Z(i),n(r,a,i),i[0]!==null&&i[1]===null?Se(i[0]):i[0]===null?null:U.difference(i[0],i[1])))},e.symmetricdifference=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]===null&&i[1]===null?null:i[0]===null?Se(i[1]):i[1]===null?Se(i[0]):U.symmetricDifference(i[0],i[1])))},e.clip=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,2,r,a),!(i[1]instanceof ge)&&i[1]!==null)throw new d(r,l.InvalidParameter,a);if(i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return i[1]===null?null:U.clip(i[0],i[1])})},e.cut=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,2,r,a),!(i[1]instanceof oe)&&i[1]!==null)throw new d(r,l.InvalidParameter,a);if(i[0]===null)return[];if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return i[1]===null?[Se(i[0])]:U.cut(i[0],i[1])})},e.area=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),(i=Z(i))[0]===null)return 0;if(T(i[0])||R(i[0])){const s=Mn(i[0],r.spatialReference);return s===null?0:U.planarArea(s,Jt($(i[1],-1)))}if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.planarArea(i[0],Jt($(i[1],-1)))})},e.areageodetic=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),(i=Z(i))[0]===null)return 0;if(T(i[0])||R(i[0])){const s=Mn(i[0],r.spatialReference);return s===null?0:U.geodesicArea(s,Jt($(i[1],-1)))}if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.geodesicArea(i[0],Jt($(i[1],-1)))})},e.length=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),(i=Z(i))[0]===null)return 0;if(T(i[0])||R(i[0])){const s=kt(i[0],r.spatialReference);return s===null?0:U.planarLength(s,re($(i[1],-1)))}if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.planarLength(i[0],re($(i[1],-1)))})},e.length3d=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),(i=Z(i))[0]===null)return 0;if(T(i[0])||R(i[0])){const s=kt(i[0],r.spatialReference);return s===null?0:s.hasZ===!0?kr(s,re($(i[1],-1))):U.planarLength(s,re($(i[1],-1)))}if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return i[0].hasZ===!0?kr(i[0],re($(i[1],-1))):U.planarLength(i[0],re($(i[1],-1)))})},e.lengthgeodetic=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),(i=Z(i))[0]===null)return 0;if(T(i[0])||R(i[0])){const s=kt(i[0],r.spatialReference);return s===null?0:U.geodesicLength(s,re($(i[1],-1)))}if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.geodesicLength(i[0],re($(i[1],-1)))})},e.distance=function(r,a){return t(r,a,(u,o,i)=>{i=Z(i),D(i,2,3,r,a);let s=i[0];(T(i[0])||R(i[0]))&&(s=Vt(i[0],r.spatialReference));let c=i[1];if((T(i[1])||R(i[1]))&&(c=Vt(i[1],r.spatialReference)),!(s instanceof B))throw new d(r,l.InvalidParameter,a);if(!(c instanceof B))throw new d(r,l.InvalidParameter,a);return U.distance(s,c,re($(i[2],-1)))})},e.distancegeodetic=function(r,a){return t(r,a,(u,o,i)=>{i=Z(i),D(i,2,3,r,a);const s=i[0],c=i[1];if(!(s instanceof H))throw new d(r,l.InvalidParameter,a);if(!(c instanceof H))throw new d(r,l.InvalidParameter,a);const p=new oe({paths:[],spatialReference:s.spatialReference});return p.addPath([s,c]),U.geodesicLength(p,re($(i[2],-1)))})},e.densify=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,3,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);if(s<=0)throw new d(r,l.InvalidParameter,a);return i[0]instanceof ue||i[0]instanceof oe?U.densify(i[0],s,re($(i[2],-1))):i[0]instanceof ge?U.densify(Ir(i[0]),s,re($(i[2],-1))):i[0]})},e.densifygeodetic=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,3,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);if(s<=0)throw new d(r,l.InvalidParameter,a);return i[0]instanceof ue||i[0]instanceof oe?U.geodesicDensify(i[0],s,re($(i[2],-1))):i[0]instanceof ge?U.geodesicDensify(Ir(i[0]),s,re($(i[2],-1))):i[0]})},e.generalize=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,4,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);return U.generalize(i[0],s,ht($(i[2],!0)),re($(i[3],-1)))})},e.buffer=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,3,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);return s===0?Se(i[0]):U.buffer(i[0],s,re($(i[2],-1)))})},e.buffergeodetic=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,3,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);return s===0?Se(i[0]):U.geodesicBuffer(i[0],s,re($(i[2],-1)))})},e.offset=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,6,r,a),i[0]===null)return null;if(!(i[0]instanceof ue||i[0]instanceof oe))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);const c=h($(i[4],10));if(isNaN(c))throw new d(r,l.InvalidParameter,a);const p=h($(i[5],0));if(isNaN(p))throw new d(r,l.InvalidParameter,a);return U.offset(i[0],s,re($(i[2],-1)),w($(i[3],"round")).toLowerCase(),c,p)})},e.rotate=function(r,a){return t(r,a,(u,o,i)=>{i=Z(i),D(i,2,3,r,a);let s=i[0];if(s===null)return null;if(!(s instanceof B))throw new d(r,l.InvalidParameter,a);s instanceof ge&&(s=ue.fromExtent(s));const c=h(i[1]);if(isNaN(c))throw new d(r,l.InvalidParameter,a);const p=$(i[2],null);if(p===null)return U.rotate(s,c);if(p instanceof H)return U.rotate(s,c,p);throw new d(r,l.InvalidParameter,a)})},e.centroid=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,1,1,r,a),i[0]===null)return null;let s=i[0];if((T(i[0])||R(i[0]))&&(s=Vt(i[0],r.spatialReference)),s===null)return null;if(!(s instanceof B))throw new d(r,l.InvalidParameter,a);return s instanceof H?te(Se(i[0]),r.spatialReference):s instanceof ue?s.centroid:s instanceof oe?Ya(s):s instanceof be?Xa(s):s instanceof ge?s.center:null})},e.multiparttosinglepart=function(r,a){return t(r,a,(u,o,i)=>{i=Z(i),D(i,1,1,r,a);const s=[];if(i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);if(i[0]instanceof H)return[te(Se(i[0]),r.spatialReference)];if(i[0]instanceof ge)return[te(Se(i[0]),r.spatialReference)];const c=U.simplify(i[0]);if(c instanceof ue){const p=[],f=[];for(let m=0;m{if(i=Z(i),D(i,1,1,r,a),i[0]===null)return!0;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.isSimple(i[0])})},e.simplify=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,1,1,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.simplify(i[0])})},e.convexhull=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,1,1,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.convexHull(i[0])})},e.nearestcoordinate=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,2,r,a),!(i[0]instanceof B||i[0]===null))throw new d(r,l.InvalidParameter,a);if(!(i[1]instanceof H||i[1]===null))throw new d(r,l.InvalidParameter,a);if(i[0]===null||i[1]===null)return null;const s=U.nearestCoordinate(i[0],i[1]);return s===null||s.isEmpty?null:k.convertObjectToArcadeDictionary({coordinate:s.coordinate,distance:s.distance},_(r),!1,!0)})},e.nearestvertex=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,2,r,a),!(i[0]instanceof B||i[0]===null))throw new d(r,l.InvalidParameter,a);if(!(i[1]instanceof H||i[1]===null))throw new d(r,l.InvalidParameter,a);if(i[0]===null||i[1]===null)return null;const s=U.nearestVertex(i[0],i[1]);return s===null||s.isEmpty?null:k.convertObjectToArcadeDictionary({coordinate:s.coordinate,distance:s.distance},_(r),!1,!0)})}}function gn(e,t,n){return n===void 0||+n==0?Math[e](t):(t=+t,n=+n,isNaN(t)||typeof n!="number"||n%1!=0?NaN:(t=t.toString().split("e"),+((t=(t=Math[e](+(t[0]+"e"+(t[1]?+t[1]-n:-n)))).toString().split("e"))[0]+"e"+(t[1]?+t[1]+n:n))))}function _i(e,t){function n(r,a,u){const o=h(r);return isNaN(o)?o:isNaN(a)||isNaN(u)||a>u?NaN:ou?u:o}e.number=function(r,a){return t(r,a,(u,o,i)=>{D(i,1,2,r,a);const s=i[0];if(q(s))return s;if(s===null)return 0;if(V(s)||J(s)||P(s))return s.toNumber();if(z(s))return Number(s);if(T(s))return NaN;if(s===""||s===void 0)return Number(s);if(C(s)){if(i[1]!==void 0){let c=He(i[1],"‰","");return c=He(c,"¤",""),Yr(s,{pattern:c})}return Number(s.trim())}return Number(s)})},e.abs=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.abs(h(i[0]))))},e.acos=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.acos(h(i[0]))))},e.asin=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.asin(h(i[0]))))},e.atan=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.atan(h(i[0]))))},e.atan2=function(r,a){return t(r,a,(u,o,i)=>(D(i,2,2,r,a),Math.atan2(h(i[0]),h(i[1]))))},e.ceil=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),i.length===2){let s=h(i[1]);return isNaN(s)&&(s=0),gn("ceil",h(i[0]),-1*s)}return Math.ceil(h(i[0]))})},e.round=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),i.length===2){let s=h(i[1]);return isNaN(s)&&(s=0),gn("round",h(i[0]),-1*s)}return Math.round(h(i[0]))})},e.floor=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),i.length===2){let s=h(i[1]);return isNaN(s)&&(s=0),gn("floor",h(i[0]),-1*s)}return Math.floor(h(i[0]))})},e.cos=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.cos(h(i[0]))))},e.isnan=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),typeof i[0]=="number"&&isNaN(i[0])))},e.exp=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.exp(h(i[0]))))},e.log=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.log(h(i[0]))))},e.pow=function(r,a){return t(r,a,(u,o,i)=>(D(i,2,2,r,a),h(i[0])**h(i[1])))},e.random=function(r,a){return t(r,a,(u,o,i)=>(D(i,0,0,r,a),Math.random()))},e.sin=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.sin(h(i[0]))))},e.sqrt=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.sqrt(h(i[0]))))},e.tan=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.tan(h(i[0]))))},e.defaultvalue=function(r,a){return t(r,a,(u,o,i)=>(D(i,2,2,r,a),i[0]===null||i[0]===""||i[0]===void 0?i[1]:i[0]))},e.isempty=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),i[0]===null||i[0]===""||i[0]===void 0))},e.boolean=function(r,a){return t(r,a,(u,o,i)=>{D(i,1,1,r,a);const s=i[0];return ht(s)})},e.constrain=function(r,a){return t(r,a,(u,o,i)=>{D(i,3,3,r,a);const s=h(i[1]),c=h(i[2]);if(T(i[0])){const p=[];for(const f of i[0])p.push(n(f,s,c));return p}if(R(i[0])){const p=[];for(let f=0;f=t&&t!==-1)return n}return n}function yn(e,t,n=1e3){switch(e.toLowerCase()){case"distinct":return uo(t,n);case"avg":case"mean":return Mi(We(t));case"min":return Math.min.apply(Math,We(t));case"sum":return oo(We(t));case"max":return Math.max.apply(Math,We(t));case"stdev":case"stddev":return Math.sqrt(Tr(We(t)));case"var":case"variance":return Tr(We(t));case"count":return t.length}return 0}function Ze(e,t,n,r){if(r.length===1){if(T(r[0]))return yn(e,r[0],-1);if(R(r[0]))return yn(e,r[0].toArray(),-1)}return yn(e,r,-1)}function $i(e,t){e.stdev=function(n,r){return t(n,r,(a,u,o)=>Ze("stdev",a,u,o))},e.variance=function(n,r){return t(n,r,(a,u,o)=>Ze("variance",a,u,o))},e.average=function(n,r){return t(n,r,(a,u,o)=>Ze("mean",a,u,o))},e.mean=function(n,r){return t(n,r,(a,u,o)=>Ze("mean",a,u,o))},e.sum=function(n,r){return t(n,r,(a,u,o)=>Ze("sum",a,u,o))},e.min=function(n,r){return t(n,r,(a,u,o)=>Ze("min",a,u,o))},e.max=function(n,r){return t(n,r,(a,u,o)=>Ze("max",a,u,o))},e.distinct=function(n,r){return t(n,r,(a,u,o)=>Ze("distinct",a,u,o))},e.count=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),T(o[0])||C(o[0]))return o[0].length;if(R(o[0]))return o[0].length();throw new d(n,l.InvalidParameter,r)})}}let Pn=class extends k{constructor(t){super(),this.declaredClass="esri.arcade.Portal",this.immutable=!1,this.setField("url",t),this.immutable=!0}},so=class Li extends k{constructor(t,n,r,a,u,o,i){super(),this.attachmentUrl=u,this.declaredClass="esri.arcade.Attachment",this.immutable=!1,this.setField("id",t),this.setField("name",n),this.setField("contenttype",r),this.setField("size",a),this.setField("exifinfo",o),this.setField("keywords",i),this.immutable=!0}deepClone(){var t;return new Li(this.field("id"),this.field("name"),this.field("contenttype"),this.field("size"),this.attachmentUrl,((t=this.field("exifinfo"))==null?void 0:t.deepClone())??null,this.field("keywords"))}};const or=e=>(t,n,r)=>(r=r||14,+e(t,n).toFixed(r)),lo=(e,t)=>e+t,co=(e,t)=>e*t,fo=(e,t)=>e/t,Br=(e,t,n)=>or(lo)(e,t,n),ct=(e,t,n)=>or(co)(e,t,n),Qt=(e,t,n)=>or(fo)(e,t,n),en=360,ho=400,mo=2*Math.PI,ve=3600,Nr=3240,Bt=60,je=60,_r=180*ve/Math.PI,St=en*Bt*je,wn=90*ve,at=180*ve,po=270*ve,Oi="ᵍ",vt="°";function At(e){if(C(e)===!1)throw new d(null,l.InvalidParameter,null);return e}function Rn(e,t){const n=10**t;return Math.round(e*n)/n}function Do(e,t){return e%t}function ot(e){const t=parseFloat(e.toString().replace(Math.trunc(e).toString(),"0"))*Math.sign(e);return e<0?{fraction:t,integer:Math.ceil(e)}:{fraction:t,integer:Math.floor(e)}}var Y,y,j,Un;function lt(e,t){switch(e){case Y.north:return t==="SHORT"?"N":"North";case Y.east:return t==="SHORT"?"E":"East";case Y.south:return t==="SHORT"?"S":"South";case Y.west:return t==="SHORT"?"W":"West"}}function xn(e,t){return e-Math.floor(e/t)*t}function Fn(e){switch(e){case y.truncated_degrees:case y.decimal_degrees:return en;case y.radians:return mo;case y.gradians:return ho;case y.seconds:return St;case y.fractional_degree_minutes:return Bt;case y.fractional_minute_seconds:return je;default:throw new d(null,l.LogicError,null,{reason:"unsupported evaluations"})}}function Mr(e){switch(e.toUpperCase().trim()){case"NORTH":case"NORTHAZIMUTH":case"NORTH AZIMUTH":return j.north_azimuth;case"POLAR":return j.polar;case"QUADRANT":return j.quadrant;case"SOUTH":case"SOUTHAZIMUTH":case"SOUTH AZIMUTH":return j.south_azimuth}throw new d(null,l.LogicError,null,{reason:"unsupported directionType"})}function $r(e){switch(e.toUpperCase().trim()){case"D":case"DD":case"DECIMALDEGREE":case"DECIMAL DEGREE":case"DEGREE":case"DECIMALDEGREES":case"DECIMAL DEGREES":case"DEGREES":return y.decimal_degrees;case"DMS":case"DEGREESMINUTESSECONDS":case"DEGREES MINUTES SECONDS":return y.degrees_minutes_seconds;case"R":case"RAD":case"RADS":case"RADIAN":case"RADIANS":return y.radians;case"G":case"GON":case"GONS":case"GRAD":case"GRADS":case"GRADIAN":case"GRADIANS":return y.gradians}throw new d(null,l.LogicError,null,{reason:"unsupported units"})}(function(e){e[e.north=0]="north",e[e.east=1]="east",e[e.south=2]="south",e[e.west=3]="west"})(Y||(Y={})),function(e){e[e.decimal_degrees=1]="decimal_degrees",e[e.seconds=2]="seconds",e[e.degrees_minutes_seconds=3]="degrees_minutes_seconds",e[e.radians=4]="radians",e[e.gradians=5]="gradians",e[e.truncated_degrees=6]="truncated_degrees",e[e.fractional_degree_minutes=7]="fractional_degree_minutes",e[e.fractional_minute_seconds=8]="fractional_minute_seconds"}(y||(y={})),function(e){e[e.north_azimuth=1]="north_azimuth",e[e.polar=2]="polar",e[e.quadrant=3]="quadrant",e[e.south_azimuth=4]="south_azimuth"}(j||(j={})),function(e){e[e.meridian=0]="meridian",e[e.direction=1]="direction"}(Un||(Un={}));let pt=class Kt{constructor(t,n,r){this.m_degrees=t,this.m_minutes=n,this.m_seconds=r}getField(t){switch(t){case y.decimal_degrees:case y.truncated_degrees:return this.m_degrees;case y.fractional_degree_minutes:return this.m_minutes;case y.seconds:case y.fractional_minute_seconds:return this.m_seconds;default:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"})}}static secondsToDMS(t){const n=ot(t).fraction;let r=ot(t).integer;const a=Math.floor(r/ve);r-=a*ve;const u=Math.floor(r/je);return r-=u*je,new Kt(a,u,r+n)}static numberToDms(t){const n=ot(t).fraction,r=ot(t).integer,a=ct(ot(100*n).fraction,100),u=ot(100*n).integer;return new Kt(r,u,a)}format(t,n){let r=Rn(this.m_seconds,n),a=this.m_minutes,u=this.m_degrees;if(t===y.seconds||t===y.fractional_minute_seconds)je<=r&&(r-=je,++a),Bt<=a&&(a=0,++u),en<=u&&(u=0);else if(t===y.fractional_degree_minutes)r=0,a=30<=this.m_seconds?this.m_minutes+1:this.m_minutes,u=this.m_degrees,Bt<=a&&(a=0,++u),en<=u&&(u=0);else if(t===y.decimal_degrees||t===y.truncated_degrees){const o=Qt(this.m_seconds,ve),i=Qt(this.m_minutes,Bt);u=Math.round(this.m_degrees+i+o),a=0,r=0}return new Kt(u,a,r)}static dmsToSeconds(t,n,r){return t*ve+n*je+r}},go=class{constructor(t,n,r){this.meridian=t,this.angle=n,this.direction=r}fetchAzimuth(t){return t===Un.meridian?this.meridian:this.direction}},Je=class Re{constructor(t){this._angle=t}static createFromAngleAndDirection(t,n){return new Re(new Ne(Re._convertDirectionFormat(t.extractAngularUnits(y.seconds),n,j.north_azimuth)))}getAngle(t){const n=this._angle.extractAngularUnits(y.seconds);switch(t){case j.north_azimuth:case j.south_azimuth:case j.polar:return new Ne(Re._convertDirectionFormat(n,j.north_azimuth,t));case j.quadrant:{const r=Re.secondsNorthAzimuthToQuadrant(n);return new Ne(r.angle)}}}getMeridian(t){const n=this._angle.extractAngularUnits(y.seconds);switch(t){case j.north_azimuth:return Y.north;case j.south_azimuth:return Y.south;case j.polar:return Y.east;case j.quadrant:return Re.secondsNorthAzimuthToQuadrant(n).meridian}}getDirection(t){const n=this._angle.extractAngularUnits(y.seconds);switch(t){case j.north_azimuth:return Y.east;case j.south_azimuth:return Y.west;case j.polar:return Y.north;case j.quadrant:return Re.secondsNorthAzimuthToQuadrant(n).direction}}static secondsNorthAzimuthToQuadrant(t){const n=t<=wn||t>=po?Y.north:Y.south,r=n===Y.north?Math.min(St-t,t):Math.abs(t-at),a=t>at?Y.west:Y.east;return new go(n,r,a)}static createFromAngleMeridianAndDirection(t,n,r){return new Re(new Ne(Re.secondsQuadrantToNorthAzimuth(t.extractAngularUnits(y.seconds),n,r)))}static secondsQuadrantToNorthAzimuth(t,n,r){return n===Y.north?r===Y.east?t:St-t:r===Y.east?at-t:at+t}static _convertDirectionFormat(t,n,r){let a=0;switch(n){case j.north_azimuth:a=t;break;case j.polar:a=wn-t;break;case j.quadrant:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"});case j.south_azimuth:a=t+at}let u=0;switch(r){case j.north_azimuth:u=a;break;case j.polar:u=wn-a;break;case j.quadrant:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"});case j.south_azimuth:u=a-at}return u=Do(u,St),u<0?St+u:u}};function Lr(e,t,n){let r=null;switch(t){case y.decimal_degrees:r=ct(e,ve);break;case y.seconds:r=e;break;case y.gradians:r=ct(e,Nr);break;case y.radians:r=ct(e,_r);break;default:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"})}switch(n){case y.decimal_degrees:return Qt(r,ve);case y.seconds:return r;case y.gradians:return Qt(r,Nr);case y.radians:return r/_r;default:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"})}}let Ne=class zn{constructor(t){this._seconds=t}static createFromAngleAndUnits(t,n){return new zn(Lr(t,n,y.seconds))}extractAngularUnits(t){return Lr(this._seconds,y.seconds,Lt(t))}static createFromDegreesMinutesSeconds(t,n,r){return new zn(Br(Br(ct(t,ve),ct(n,je)),r))}};function Lt(e){switch(ti(e),e){case y.decimal_degrees:case y.truncated_degrees:case y.degrees_minutes_seconds:return y.decimal_degrees;case y.gradians:return y.gradians;case y.fractional_degree_minutes:return y.fractional_degree_minutes;case y.radians:return y.radians;case y.seconds:case y.fractional_minute_seconds:return y.seconds}}let yo=class Pi{constructor(t,n,r,a){this.view=t,this.angle=n,this.merdian=r,this.direction=a,this._dms=null,this._formattedDms=null}static createFromStringAndBearing(t,n,r){return new Pi(t,n.getAngle(r),n.getMeridian(r),n.getDirection(r))}fetchAngle(){return this.angle}fetchMeridian(){return this.merdian}fetchDirection(){return this.direction}fetchView(){return this.view}fetchDms(){return this._dms===null&&this._calculateDms(),this._dms}fetchFormattedDms(){return this._formattedDms===null&&this._calculateDms(),this._formattedDms}_calculateDms(){let t=null,n=y.truncated_degrees,r=0;for(let a=0;a0?1:0),"0");case y.truncated_degrees:case y.fractional_degree_minutes:return u=xn(a.fetchFormattedDms().getField(t),Fn(t)),u.toFixed(r).padStart(n+r+(r>0?1:0),"0");case y.fractional_minute_seconds:return u=xn(Rn(a.fetchDms().getField(t),r),Fn(t)),u.toFixed(r).padStart(n+r+(r>0?1:0),"0");default:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"})}}function xo(e,t,n){if(n===j.quadrant)throw new d(null,l.LogicError,null,{reason:"conversion error"});if(t===y.degrees_minutes_seconds){const r=pt.numberToDms(e);return Je.createFromAngleAndDirection(Ne.createFromDegreesMinutesSeconds(r.m_degrees,r.m_minutes,r.m_seconds),n)}return Je.createFromAngleAndDirection(Ne.createFromAngleAndUnits(e,Lt(t)),n)}function Fo(e){switch(h(e)){case 1:return{first:Y.north,second:Y.east};case 2:return{first:Y.south,second:Y.east};case 3:return{first:Y.south,second:Y.west};case 4:return{first:Y.north,second:Y.west}}return null}function Or(e){switch(e.toUpperCase().trim()){case"N":case"NORTH":return Y.north;case"E":case"EAST":return Y.east;case"S":case"SOUTH":return Y.south;case"W":case"WEST":return Y.west}return null}function ut(e){const t=parseFloat(e);if(q(t)){if(isNaN(t))throw new d(null,l.LogicError,null,{reason:"invalid conversion"});return t}throw new d(null,l.LogicError,null,{reason:"invalid conversion"})}function Cn(e,t,n){const r=n===j.quadrant;let a=null,u=null,o=0,i=0,s=0;if(r){if(e.length<2)throw new d(null,l.LogicError,null,{reason:"conversion error"});s=1;const c=Fo(w(e[e.length-1]));if(c?(a=c.first,u=c.second):(o=1,a=Or(w(e[0])),u=Or(w(e[e.length-1]))),a===null||u===null)throw new d(null,l.LogicError,null,{reason:"invalid conversion"})}switch(t){case y.decimal_degrees:case y.radians:case y.gradians:if(e.length===0)throw new d(null,l.LogicError,null,{reason:"invalid conversion"});return r?Je.createFromAngleMeridianAndDirection(Ne.createFromAngleAndUnits(ut(e[o]),Lt(t)),a,u):Je.createFromAngleAndDirection(Ne.createFromAngleAndUnits(ut(e[o]),Lt(t)),n);case y.degrees_minutes_seconds:if(i=e.length-s-o,i===3){const c=Ne.createFromDegreesMinutesSeconds(ut(e[o]),ut(e[o+1]),ut(e[o+2]));return r?Je.createFromAngleMeridianAndDirection(c,a,u):Je.createFromAngleAndDirection(c,n)}if(i===1){const c=ut(e[o]),p=pt.numberToDms(c),f=Ne.createFromDegreesMinutesSeconds(p.m_degrees,p.m_minutes,p.m_seconds);return r?Je.createFromAngleMeridianAndDirection(f,a,u):Je.createFromAngleAndDirection(f,n)}}throw new d(null,l.LogicError,null,{reason:"invalid conversion"})}function Co(e){const t=new Set([" ","-","/","'",'"',"\\","^",vt,Oi," ","\r",` -`,"*"]);let n="";for(let r=0;rr!=="")}function Ao(e,t,n){if(q(e))return xo(h(e),t,n);if(C(e))return Cn(Co(e),t,n);if(T(e))return Cn(e,t,n);if(R(e))return Cn(e.toArray(),t,n);throw new d(null,l.LogicError,null,{reason:"conversion error"})}function bo(e,t,n){const r=Lt(n);if(r&&n!==y.degrees_minutes_seconds)return e.getAngle(t).extractAngularUnits(r);throw new d(null,l.LogicError,null,{reason:"conversion error"})}function Eo(e,t,n){const r=e.getAngle(t);if(t===j.quadrant&&n===y.degrees_minutes_seconds){const a=pt.secondsToDMS(r.extractAngularUnits(y.seconds));return[lt(e.getMeridian(t),"SHORT"),a.m_degrees,a.m_minutes,a.m_seconds,lt(e.getDirection(t),"SHORT")]}if(n===y.degrees_minutes_seconds){const a=pt.secondsToDMS(r.extractAngularUnits(y.seconds));return[a.m_degrees,a.m_minutes,a.m_seconds]}return t===j.quadrant?[lt(e.getMeridian(t),"SHORT"),r.extractAngularUnits(n),lt(e.getDirection(t),"SHORT")]:[r.extractAngularUnits(n)]}function So(e,t){let n="";switch(e){case y.decimal_degrees:n=t===j.quadrant?"DD.DD"+vt:"DDD.DD"+vt;break;case y.degrees_minutes_seconds:n=t===j.quadrant?"dd"+vt+` mm' ss"`:"ddd"+vt+` mm' ss.ss"`;break;case y.radians:n="R.RR";break;case y.gradians:n="GGG.GG"+Oi;break;default:throw new d(null,l.LogicError,null,{reason:"conversion error"})}return t===j.quadrant&&(n="p "+n+" b"),n}function Gn(e,t,n){const r={padding:0,rounding:0,newpos:t};let a=!1;for(;t(D(o,1,1,n,r),new Pn(w(o[0]))))},e.typeof=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=Qn(o[0]);if(i==="Unrecognized Type")throw new d(n,l.UnrecognizedType,r);return i})},e.trim=function(n,r){return t(n,r,(a,u,o)=>(D(o,1,1,n,r),w(o[0]).trim()))},e.tohex=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=h(o[0]);return isNaN(i)?i:i.toString(16)})},e.upper=function(n,r){return t(n,r,(a,u,o)=>(D(o,1,1,n,r),w(o[0]).toUpperCase()))},e.proper=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,2,n,r);let i=1;o.length===2&&w(o[1]).toLowerCase()==="firstword"&&(i=2);const s=/\s/,c=w(o[0]);let p="",f=!0;for(let m=0;m(D(o,1,1,n,r),w(o[0]).toLowerCase()))},e.guid=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,0,1,n,r),o.length>0)switch(w(o[0]).toLowerCase()){case"digits":return st().replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return st();case"digits-hyphen-braces":return"{"+st()+"}";case"digits-hyphen-parentheses":return"("+st()+")"}return"{"+st()+"}"})},e.standardizeguid=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,2,n,r);let i=w(o[0]);if(i===""||i===null)return"";const s=/^(\{|\()?(?[0-9a-z]{8})(\-?)(?[0-9a-z]{4})(\-?)(?[0-9a-z]{4})(\-?)(?[0-9a-z]{4})(\-?)(?[0-9a-z]{12})(\}|\))?$/gim.exec(i);if(!s)return"";const c=s.groups;switch(i=c.partA+"-"+c.partB+"-"+c.partC+"-"+c.partD+"-"+c.partE,w(o[1]).toLowerCase()){case"digits":return i.replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return i;case"digits-hyphen-braces":return"{"+i+"}";case"digits-hyphen-parentheses":return"("+i+")"}return"{"+i+"}"})},e.console=function(n,r){return t(n,r,(a,u,o)=>(o.length===0||(o.length===1?n.console(w(o[0])):n.console(w(o))),A))},e.mid=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,3,n,r);let i=h(o[1]);if(isNaN(i))return"";if(i<0&&(i=0),o.length===2)return w(o[0]).substr(i);let s=h(o[2]);return isNaN(s)?"":(s<0&&(s=0),w(o[0]).substr(i,s))})},e.find=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,3,n,r);let i=0;if(o.length>2){if(i=h($(o[2],0)),isNaN(i))return-1;i<0&&(i=0)}return w(o[1]).indexOf(w(o[0]),i)})},e.left=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,2,n,r);let i=h(o[1]);return isNaN(i)?"":(i<0&&(i=0),w(o[0]).substr(0,i))})},e.right=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,2,n,r);let i=h(o[1]);return isNaN(i)?"":(i<0&&(i=0),w(o[0]).substr(-1*i,i))})},e.split=function(n,r){return t(n,r,(a,u,o)=>{let i;D(o,2,4,n,r);let s=h($(o[2],-1));const c=ht($(o[3],!1));if(s===-1||s===null||c===!0?i=w(o[0]).split(w(o[1])):(isNaN(s)&&(s=-1),s<-1&&(s=-1),i=w(o[0]).split(w(o[1]),s)),c===!1)return i;const p=[];for(let f=0;f=s);f++)i[f]!==""&&i[f]!==void 0&&p.push(i[f]);return p})},e.text=function(n,r){return t(n,r,(a,u,o)=>(D(o,1,2,n,r),we(o[0],o[1])))},e.concatenate=function(n,r){return t(n,r,(a,u,o)=>{const i=[];if(o.length<1)return"";if(T(o[0])){const s=$(o[2],"");for(let c=0;c1?i.join(o[1]):i.join("")}if(R(o[0])){const s=$(o[2],"");for(let c=0;c1?i.join(o[1]):i.join("")}for(let s=0;s{if(D(o,1,1,n,r),T(o[0])){const i=o[0].slice(0);return i.reverse(),i}if(R(o[0])){const i=o[0].toArray().slice(0);return i.reverse(),i}throw new d(n,l.InvalidParameter,r)})},e.replace=function(n,r){return t(n,r,(a,u,o)=>{D(o,3,4,n,r);const i=w(o[0]),s=w(o[1]),c=w(o[2]);return o.length!==4||ht(o[3])?He(i,s,c):i.replace(s,c)})},e.schema=function(n,r){return t(n,r,(a,u,o)=>{if(ee(o[0])){const i=xi(o[0]);return i?k.convertObjectToArcadeDictionary(i,_(n)):null}throw new d(n,l.InvalidParameter,r)})},e.subtypes=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),ee(o[0])){const i=jt(o[0]);return i?k.convertObjectToArcadeDictionary(i,_(n)):null}throw new d(n,l.InvalidParameter,r)})},e.subtypecode=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),ee(o[0])){const i=jt(o[0]);if(!i)return null;if(i.subtypeField&&o[0].hasField(i.subtypeField)){const s=o[0].field(i.subtypeField);for(const c of i.subtypes)if(c.code===s)return c.code;return null}return null}throw new d(n,l.InvalidParameter,r)})},e.subtypename=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),ee(o[0])){const i=jt(o[0]);if(!i)return"";if(i.subtypeField&&o[0].hasField(i.subtypeField)){const s=o[0].field(i.subtypeField);for(const c of i.subtypes)if(c.code===s)return c.name;return""}return""}throw new d(n,l.InvalidParameter,r)})},e.gdbversion=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),ee(o[0]))return o[0].gdbVersion();throw new d(n,l.InvalidParameter,r)})},e.domain=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,3,n,r),ee(o[0])){const i=gi(o[0],w(o[1]),o[2]===void 0?void 0:o[2]);return i&&i.domain?i.domain.type==="coded-value"||i.domain.type==="codedValue"?k.convertObjectToArcadeDictionary({type:"codedValue",name:i.domain.name,dataType:Cr[i.field.type],codedValues:i.domain.codedValues.map(s=>({name:s.name,code:s.code}))},_(n)):k.convertObjectToArcadeDictionary({type:"range",name:i.domain.name,dataType:Cr[i.field.type],min:i.domain.min,max:i.domain.max},_(n)):null}throw new d(n,l.InvalidParameter,r)})},e.domainname=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,4,n,r),ee(o[0]))return yi(o[0],w(o[1]),o[2],o[3]===void 0?void 0:o[3]);throw new d(n,l.InvalidParameter,r)})},e.domaincode=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,4,n,r),ee(o[0]))return wi(o[0],w(o[1]),o[2],o[3]===void 0?void 0:o[3]);throw new d(n,l.InvalidParameter,r)})},e.urlencode=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),o[0]===null)return"";if(o[0]instanceof k){let i="";for(const s of o[0].keys()){const c=o[0].field(s);i!==""&&(i+="&"),i+=c===null?encodeURIComponent(s)+"=":encodeURIComponent(s)+"="+encodeURIComponent(c)}return i}return encodeURIComponent(w(o[0]))})},e.hash=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=new Sa(0);return Ce(o[0],i,{context:n,node:r,map:new Map,currentLength:0}),i.digest()})},e.convertdirection=function(n,r){return t(n,r,(a,u,o)=>(D(o,3,3,n,r),ko(o[0],o[1],o[2])))},e.fromjson=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),C(o[0])===!1)throw new d(n,l.InvalidParameter,r);return k.convertJsonToArcade(JSON.parse(w(o[0])),_(n))})},e.expects=function(n,r){return t(n,r,(a,u,o)=>{if(o.length<1)throw new d(n,l.WrongNumberOfParameters,r);return A})},e.tocharcode=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,2,n,r);const i=h($(o[1],0)),s=w(o[0]);if(s.length===0&&o.length===1)return null;if(s.length<=i||i<0)throw new d(n,l.OutOfBounds,r);return s.charCodeAt(i)})},e.tocodepoint=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,2,n,r);const i=h($(o[1],0)),s=w(o[0]);if(s.length===0&&o.length===1)return null;if(s.length<=i||i<0)throw new d(n,l.OutOfBounds,r);return s.codePointAt(i)})},e.fromcharcode=function(n,r){return t(n,r,(a,u,o)=>{if(o.length<1)throw new d(n,l.WrongNumberOfParameters,r);const i=o.map(s=>Math.trunc(h(s))).filter(s=>s>=0&&s<=65535);return i.length===0?null:String.fromCharCode.apply(null,i)})},e.fromcodepoint=function(n,r){return t(n,r,(a,u,o)=>{if(o.length<1)throw new d(n,l.WrongNumberOfParameters,r);let i;try{i=o.map(s=>Math.trunc(h(s))).filter(s=>s<=1114111&&s>>>0===s)}catch{return null}return i.length===0?null:String.fromCodePoint.apply(null,i)})},e.getuser=function(n,r){return t(n,r,(a,u,o)=>{var s;D(o,0,2,n,r);let i=$(o[1],"");if(i=i===!0||i===!1?"":w(i),i!==null&&i!=="")return null;if(o.length===0||o[0]instanceof Pn){let c=null;if(c=(s=n.services)!=null&&s.portal?n.services.portal:Wn.getDefault(),o.length>0&&!Bo(o[0].field("url"),c)||!c)return null;if(i===""){const p=To(c);if(p){const f=JSON.parse(JSON.stringify(p));for(const m of["lastLogin","created","modified"])f[m]!==void 0&&f[m]!==null&&(f[m]=new Date(f[m]));return k.convertObjectToArcadeDictionary(f,_(n))}}return null}throw new d(n,l.InvalidParameter,r)})},e.getenvironment=function(n,r){return t(n,r,(a,u,o)=>(D(o,0,0,n,r),k.convertObjectToArcadeDictionary(Fi(_(n),n.spatialReference),_(n),!0)))}}let No=class extends tt{constructor(t,n){super(),this.paramCount=n,this.fn=t}createFunction(t){return(...n)=>{if(n.length!==this.paramCount)throw new d(t,l.WrongNumberOfParameters,null);return this.fn(...n)}}call(t,n){return this.fn(...n.arguments)}marshalledCall(t,n,r,a){return a(t,n,(u,o,i)=>{i=i.map(c=>!X(c)||c instanceof ze?c:dt(c,t,a));const s=this.call(r,{arguments:i});return qe(s)?s.then(c=>dt(c,r,a)):s})}};function Ae(e,t,n){try{return n(e,null,t.arguments)}catch(r){throw r}}function S(e,t){try{switch(t.type){case"EmptyStatement":return"lc.voidOperation";case"VariableDeclarator":return Vo(e,t);case"VariableDeclaration":return qo(e,t);case"BlockStatement":case"Program":return Zn(e,t);case"FunctionDeclaration":return Jo(e,t);case"ImportDeclaration":return Go(e,t);case"ExportNamedDeclaration":return Zo(e,t);case"ReturnStatement":return zo(e,t);case"IfStatement":return Ui(e,t);case"ExpressionStatement":return Uo(e,t);case"AssignmentExpression":return Ro(e,t);case"UpdateExpression":return Oo(e,t);case"BreakStatement":return"break";case"ContinueStatement":return"continue";case"TemplateLiteral":return Wo(e,t);case"TemplateElement":return JSON.stringify(t.value?t.value.cooked:"");case"ForStatement":return Lo(e,t);case"ForInStatement":return $o(e,t);case"WhileStatement":return Po(e,t);case"Identifier":return Qo(e,t);case"MemberExpression":return jo(e,t);case"Literal":return t.value===null||t.value===void 0?"null":JSON.stringify(t.value);case"CallExpression":return eu(e,t);case"UnaryExpression":return Ho(e,t);case"BinaryExpression":return Yo(e,t);case"LogicalExpression":return Xo(e,t);case"ArrayExpression":return Ko(e,t);case"ObjectExpression":return _o(e,t);case"Property":return Mo(e,t);case"Array":throw new le(e,l.NeverReach,t);default:throw new le(e,l.Unrecognized,t)}}catch(n){throw n}}function _o(e,t){let n="lang.dictionary([";for(let r=0;r0&&(n+=","),n+="lang.strCheck("+(a.key.type==="Identifier"?"'"+a.key.name+"'":S(e,a.key))+",'ObjectExpression'),lang.aCheck("+S(e,a.value)+", 'ObjectExpression')"}return n+="])",n}function Mo(e,t){throw new le(e,l.NeverReach,t)}function $o(e,t){const n=_e(e),r=_e(e),a=_e(e);let u="var "+n+" = "+S(e,t.right)+`; +import{cR as Hn,fs as Ve,L as H,es as ga,mJ as Qe,dO as ge,j as ue,E as oe,ho as be,hc as B,wW as ya,mO as Kn,wX as Yr,hn as Xr,kC as Qr,d2 as yt,dN as wa,eL as xa,fZ as De,eO as Fa,ch as ei,kk as pr,dX as Ca,j3 as ti,ar as Wn,wY as Aa,de as qe,av as ba,dE as ni,ah as Ea}from"./index-pCX-0tJH.js";import{m as O,b as de,n as fe,h as bt,c as Se,r as Jt,a as re}from"./TimeOnly-gkehHHJx.js";import{i as Sa}from"./hash-SS5GKVPY.js";let Pt=class{constructor(t){this.source=t}},an=class{constructor(t,n){this._moduleSingletons=t,this._syntaxModules=n}loadLibrary(t){if(this._syntaxModules==null)return null;const n=this._syntaxModules[t.toLowerCase()];return n?{syntax:n.script,uri:n.uri}:null}};var l;(function(e){e.AsyncNotEnabled="AsyncNotEnabled",e.ModulesNotSupported="ModulesNotSupported",e.CircularModules="CircularModules",e.CannotCompareDateAndTime="CannotCompareDateAndTime",e.NeverReach="NeverReach",e.UnsupportedHashType="UnsupportedHashType",e.InvalidParameter="InvalidParameter",e.UnexpectedToken="UnexpectedToken",e.Unrecognized="Unrecognized",e.UnrecognizedType="UnrecognizedType",e.MaximumCallDepth="MaximumCallDepth",e.BooleanConditionRequired="BooleanConditionRequired",e.TypeNotAllowedInFeature="TypeNotAllowedInFeature",e.KeyMustBeString="KeyMustBeString",e.WrongNumberOfParameters="WrongNumberOfParameters",e.CallNonFunction="CallNonFunction",e.NoFunctionInTemplateLiteral="NoFunctionInTemplateLiteral",e.NoFunctionInDictionary="NoFunctionInDictionary",e.NoFunctionInArray="NoFunctionInArray",e.AssignModuleFunction="AssignModuleFunction",e.LogicExpressionOrAnd="LogicExpressionOrAnd",e.LogicalExpressionOnlyBoolean="LogicalExpressionOnlyBoolean",e.FunctionNotFound="FunctionNotFound",e.InvalidMemberAccessKey="InvalidMemberAccessKey",e.UnsupportedUnaryOperator="UnsupportUnaryOperator",e.InvalidIdentifier="InvalidIdentifier",e.MemberOfNull="MemberOfNull",e.UnsupportedOperator="UnsupportedOperator",e.Cancelled="Cancelled",e.ModuleAccessorMustBeString="ModuleAccessorMustBeString",e.ModuleExportNotFound="ModuleExportNotFound",e.Immutable="Immutable",e.OutOfBounds="OutOfBounds",e.IllegalResult="IllegalResult",e.FieldNotFound="FieldNotFound",e.PortalRequired="PortalRequired",e.LogicError="LogicError",e.ArrayAccessorMustBeNumber="ArrayAccessMustBeNumber",e.KeyAccessorMustBeString="KeyAccessorMustBeString",e.WrongSpatialReference="WrongSpatialReference",e.CannotChangeTimeZoneTime="CannotChangeTimeZoneTime",e.CannotChangeTimeZoneDateOnly="CannotChangeTimeZoneDateOnly"})(l||(l={}));const ri={[l.TypeNotAllowedInFeature]:"Feature attributes only support dates, numbers, strings, guids.",[l.LogicError]:"Logic error - {reason}",[l.CannotCompareDateAndTime]:"Cannot compare date or dateonly with timeonly types",[l.NeverReach]:"Encountered unreachable logic",[l.AsyncNotEnabled]:"Async Arcade must be enabled for this script",[l.ModuleAccessorMustBeString]:"Module accessor must be a string",[l.ModuleExportNotFound]:"Module has no export with provided identifier",[l.ModulesNotSupported]:"Current profile does not support modules",[l.ArrayAccessorMustBeNumber]:"Array accessor must be a number",[l.FunctionNotFound]:"Function not found",[l.FieldNotFound]:"Key not found - {key}",[l.CircularModules]:"Circular module dependencies are not allowed",[l.Cancelled]:"Execution cancelled",[l.UnsupportedHashType]:"Type not supported in hash function",[l.IllegalResult]:"Value is not a supported return type",[l.PortalRequired]:"Portal is required",[l.InvalidParameter]:"Invalid parameter",[l.WrongNumberOfParameters]:"Call with wrong number of parameters",[l.Unrecognized]:"Unrecognized code structure",[l.UnrecognizedType]:"Unrecognized type",[l.WrongSpatialReference]:"Cannot work with geometry in this spatial reference. It is different to the execution spatial reference",[l.BooleanConditionRequired]:"Conditions must use booleans",[l.NoFunctionInDictionary]:"Dictionaries cannot contain functions.",[l.NoFunctionInArray]:"Arrays cannot contain functions.",[l.NoFunctionInTemplateLiteral]:"Template Literals do not expect functions by value.",[l.KeyAccessorMustBeString]:"Accessor must be a string",[l.KeyMustBeString]:"Object keys must be a string",[l.Immutable]:"Object is immutable",[l.UnexpectedToken]:"Unexpected token",[l.MemberOfNull]:"Cannot access property of null object",[l.MaximumCallDepth]:"Exceeded maximum function depth",[l.OutOfBounds]:"Out of bounds",[l.InvalidIdentifier]:"Identifier not recognized",[l.CallNonFunction]:"Expression is not a function",[l.InvalidMemberAccessKey]:"Cannot access value using a key of this type",[l.AssignModuleFunction]:"Cannot assign function to module variable",[l.UnsupportedUnaryOperator]:"Unsupported unary operator",[l.UnsupportedOperator]:"Unsupported operator",[l.LogicalExpressionOnlyBoolean]:"Logical expressions must be boolean",[l.LogicExpressionOrAnd]:"Logical expression can only be combined with || or &&",[l.CannotChangeTimeZoneTime]:"Cannot change the timezone of a Time",[l.CannotChangeTimeZoneDateOnly]:"Cannot change the timezone of a DateOnly"};let va=class extends Error{constructor(...t){super(...t)}},Dr=class ii extends va{constructor(t,n){super(Yn(n)+t.message,{cause:t}),this.loc=null,Error.captureStackTrace&&Error.captureStackTrace(this,ii),n!=null&&n.loc&&(this.loc=n.loc)}},d=class ai extends Error{constructor(t,n,r,a){super("Execution error - "+Yn(r)+Hn(ri[n],a)),this.loc=null,this.declaredRootClass="esri.arcade.arcadeexecutionerror",Error.captureStackTrace&&Error.captureStackTrace(this,ai),r!=null&&r.loc&&(this.loc=r.loc)}};function Yn(e){var t,n;return e&&e.loc?`Line : ${(t=e.loc.start)==null?void 0:t.line}, ${(n=e.loc.start)==null?void 0:n.column}: `:""}let le=class oi extends Error{constructor(t,n,r,a){super("Compilation error - "+Yn(r)+Hn(ri[n],a)),this.loc=null,this.declaredRootClass="esri.arcade.arcadecompilationerror",Error.captureStackTrace&&Error.captureStackTrace(this,oi),r!=null&&r.loc&&(this.loc=r.loc)}},mn=class ui extends Error{constructor(){super("Uncompilable code structures"),this.declaredRootClass="esri.arcade.arcadeuncompilableerror",Error.captureStackTrace&&Error.captureStackTrace(this,ui)}};function Ia(e,t,n){return n.declaredRootClass==="esri.arcade.arcadeexecutionerror"||n.declaredRootClass==="esri.arcade.arcadecompilationerror"?n.loc===null&&(t!=null&&t.loc)?new Dr(n,{cause:n}):n:(n.declaredRootClass==="esri.arcade.featureset.support.featureseterror"||n.declaredRootClass==="esri.arcade.featureset.support.sqlerror"||n.declaredRootClass,t!=null&&t.loc?new Dr(n,{cause:n}):n)}var et;(function(e){e.UnrecognizedUri="UnrecognizedUri",e.UnsupportedUriProtocol="UnsupportedUriProtocol"})(et||(et={}));const ka={[et.UnrecognizedUri]:"Unrecognized uri - {uri}",[et.UnsupportedUriProtocol]:"Unrecognized uri protocol"};let pn=class si extends Error{constructor(t,n){super(Hn(ka[t],n)),this.declaredRootClass="esri.arcade.arcademoduleerror",Error.captureStackTrace&&Error.captureStackTrace(this,si)}},tt=class{constructor(){}};function dt(e,t,n){if(e instanceof tt&&!(e instanceof ze)){const r=new ze;return r.fn=e,r.parameterEvaluator=n,r.context=t,r}return e}let nt=class extends tt{constructor(t){super(),this.fn=t}createFunction(t){return(...n)=>this.fn(t,{preparsed:!0,arguments:n})}call(t,n){return this.fn(t,n)}marshalledCall(t,n,r,a){return a(t,n,(u,o,i)=>{i=i.map(c=>c instanceof tt&&!(c instanceof ze)?dt(c,t,a):c);const s=this.call(r,{args:i});return Ve(s)?s.then(c=>dt(c,r,a)):s})}},ze=class extends tt{constructor(){super(...arguments),this.fn=null,this.context=null}createFunction(t){return this.fn.createFunction(this.context)}call(t,n){return this.fn.marshalledCall(t,n,this.context,this.parameterEvaluator)}marshalledCall(t,n,r){return this.fn.marshalledCall(t,n,this.context,this.parameterEvaluator)}},se=class{constructor(t=[]){this._elements=t}length(){return this._elements.length}get(t){return this._elements[t]}toArray(){const t=[];for(let n=0;nn)throw new d(r,l.WrongNumberOfParameters,a)}function Nn(e){return e<0?-Math.round(-e):Math.round(e)}function st(){let e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,t=>{const n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),(t==="x"?n:3&n|8).toString(16)})}function tr(e,t){return isNaN(e)||t==null||t===""?e.toString():(t=He(t,"‰",""),t=He(t,"¤",""),ya(e,{pattern:t}))}function on(e,t){return t==null||t===""?e.toISOString(!0):e.toFormat(nr(t),{locale:Kn(),numberingSystem:"latn"})}function nr(e,t=!1){e=e.replaceAll(/LTS|LT|LL?L?L?|l{1,4}/g,"[$&]");let n="";const r=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|Z{1,5}|.)/g;for(const a of e.match(r)||[])switch(a){case"D":n+="d";break;case"DD":n+="dd";break;case"DDD":n+="o";break;case"d":n+="c";break;case"ddd":n+="ccc";break;case"dddd":n+="cccc";break;case"M":n+="L";break;case"MM":n+="LL";break;case"MMM":n+="LLL";break;case"MMMM":n+="LLLL";break;case"YY":n+="yy";break;case"Y":case"YYYY":n+="yyyy";break;case"Q":n+="q";break;case"Z":n+="Z";break;case"ZZ":n+="ZZ";break;case"ZZZ":n+="ZZZ";break;case"ZZZZ":n+=t?"[ZZZZ]":"ZZZZ";break;case"ZZZZZ":n+=t?"[ZZZZZ]":"ZZZZZ";break;case"S":n+="'S'";break;case"SS":n+="'SS'";break;case"SSS":n+="u";break;case"A":case"a":n+="a";break;case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":case"X":case"x":n+=a;break;default:a.length>=2&&a.slice(0,1)==="["&&a.slice(-1)==="]"?n+=`'${a.slice(1,-1)}'`:n+=`'${a}'`}return n}function N(e,t,n){switch(n){case">":return e>t;case"<":return e=":return e>=t;case"<=":return e<=t}return!1}function rr(e,t,n){if(e===null){if(t===null||t===A)return N(null,null,n);if(V(t))return N(0,t,n);if(C(t)||z(t))return N(0,h(t),n);if(q(t))return N(0,t.toNumber(),n);if(J(t)||P(t))return N(e,t.toNumber(),n)}if(e===A){if(t===null||t===A)return N(null,null,n);if(V(t))return N(0,t,n);if(C(t)||z(t))return N(0,h(t),n);if(q(t))return N(0,t.toNumber(),n);if(J(t)||P(t))return N(e,t.toNumber(),n)}else if(V(e)){if(V(t))return N(e,t,n);if(z(t))return N(e,h(t),n);if(t===null||t===A)return N(e,0,n);if(C(t))return N(e,h(t),n);if(q(t)||J(t)||P(t))return N(e,t.toNumber(),n)}else if(C(e)){if(C(t))return N(w(e),w(t),n);if(q(t)||J(t)||P(t))return N(h(e),t.toNumber(),n);if(V(t))return N(h(e),t,n);if(t===null||t===A)return N(h(e),0,n);if(z(t))return N(h(e),h(t),n)}else if(q(e)){if(q(t))return e.timeZone!==t.timeZone&&(e.isUnknownTimeZone?e=O.arcadeDateAndZoneToArcadeDate(e,t.timeZone):t.isUnknownTimeZone&&(t=O.arcadeDateAndZoneToArcadeDate(t,e.timeZone))),N(e.toNumber(),t.toNumber(),n);if(t===null||t===A)return N(e.toNumber(),0,n);if(V(t))return N(e.toNumber(),t,n);if(z(t)||C(t))return N(e.toNumber(),h(t),n);if(J(t))throw new d(null,l.CannotCompareDateAndTime,null);if(P(t))return N(e.toNumber(),t.toNumber(),n)}else if(z(e)){if(z(t))return N(e,t,n);if(V(t))return N(h(e),h(t),n);if(q(t)||J(t)||P(t))return N(h(e),t.toNumber(),n);if(t===null||t===A)return N(h(e),0,n);if(C(t))return N(h(e),h(t),n)}else if(P(e)){if(q(t))return N(e.toNumber(),t.toNumber(),n);if(t===null||t===A)return N(e.toNumber(),0,n);if(V(t))return N(e.toNumber(),t,n);if(z(t)||C(t))return N(e.toNumber(),h(t),n);if(J(t))throw new d(null,l.CannotCompareDateAndTime,null);if(P(t))return N(e.toNumber(),t.toNumber(),n)}else if(J(e)){if(q(t))throw new d(null,l.CannotCompareDateAndTime,null);if(t===null||t===A)return N(e.toNumber(),0,n);if(V(t))return N(e.toNumber(),t,n);if(z(t)||C(t))return N(e.toNumber(),h(t),n);if(J(t))return N(e.toNumber(),t.toNumber(),n);if(P(t))throw new d(null,l.CannotCompareDateAndTime,null)}return!!Ee(e,t)&&(n==="<="||n===">=")}function Ee(e,t){if(e===t||e===null&&t===A||t===null&&e===A)return!0;if(q(e)&&q(t)||J(e)&&J(t)||P(e)&&P(t))return e.equals(t);if(e instanceof Tn||e instanceof it)return e.equalityTest(t);if(e instanceof H&&t instanceof H){const n=e.cache._arcadeCacheId,r=t.cache._arcadeCacheId;if(n!=null)return n===r}return!!(Bn(e)&&Bn(t)&&(e._arcadeCacheId===t._arcadeCacheId&&e._arcadeCacheId!==void 0&&e._arcadeCacheId!==null||e._underlyingGraphic===t._underlyingGraphic&&e._underlyingGraphic!==void 0&&e._underlyingGraphic!==null))}function w(e,t){if(C(e))return e;if(e===null)return"";if(V(e))return tr(e,t);if(z(e))return e.toString();if(q(e))return on(e,t);if(J(e)||P(e))return e.toFormat(t);if(e instanceof B)return JSON.stringify(e.toJSON());if(T(e)){const n=[];for(let r=0;rr.key===a.key?0:r.key==="spatialReference"?1:a.key==="spatialReference"||r.keya.key?1:0);if(T(e)){const r=[];for(let a=0;a0)return e;return null}if(e instanceof oe){if(e.paths.length===0)return null;for(const t of e.paths)if(t.length>0)return e;return null}return e instanceof be?e.points.length===0?null:e:e instanceof ge?e.xmin==="NaN"||e.xmin===null||isNaN(e.xmin)?null:e:null}function mi(e,t){if(!e||!e.domain)return t;let n=null,r=null;if(e.field.type==="string"||e.field.type==="esriFieldTypeString")n=w(t);else{if(t==null)return null;if(t==="")return t;n=h(t)}for(let a=0;a{var s;return i.id===r&&(a=(s=i.domains)==null?void 0:s[o.name],a&&a.type==="inherited"&&(a=Ar(o.name,t),u=!0),!0)}),u||a||(a=Ar(e,t)),{field:o,domain:a}}function Ar(e,t){let n;return t.fields.some(r=>(r.name.toLowerCase()===e.toLowerCase()&&(n=r.domain),!!n)),n}function _n(e,t){t||(t={}),typeof t=="function"&&(t={cmp:t});const n=typeof t.cycles=="boolean"&&t.cycles,r=t.cmp&&(a=t.cmp,function(o){return function(i,s){const c={key:i,value:o[i]},p={key:s,value:o[s]};return a(c,p)}});var a;const u=[];return function o(i){if(i!=null&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i===void 0)return;if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);let s,c;if(Array.isArray(i)){for(c="[",s=0;s0&&(u=e[0].spatialReference,n=e[0].hasZ,r=e[0].hasM)}else if(e instanceof it)a=e._elements,a.length>0&&(n=e._hasZ,r=e._hasM,u=e.get(0).spatialReference);else{if(!R(e))throw new d(null,l.InvalidParameter,null);for(const o of e.toArray())mt(a,o);a.length>0&&(u=e.get(0).spatialReference,n=e.get(0).hasZ===!0,r=e.get(0).hasM===!0)}return a.length===0?null:(Xr(a)||(a=a.slice(0).reverse()),new ue({rings:[a],spatialReference:u,hasZ:n,hasM:r}))}return e}function kt(e,t){if(T(e)||R(e)){let n=!1,r=!1,a=[],u=t;if(T(e)){for(const o of e)mt(a,o);a.length>0&&(u=e[0].spatialReference,n=e[0].hasZ===!0,r=e[0].hasM===!0)}else if(e instanceof it)a=e._elements,a.length>0&&(n=e._hasZ,r=e._hasM,u=e.get(0).spatialReference);else if(R(e)){for(const o of e.toArray())mt(a,o);a.length>0&&(u=e.get(0).spatialReference,n=e.get(0).hasZ===!0,r=e.get(0).hasM===!0)}return a.length===0?null:new oe({paths:[a],spatialReference:u,hasZ:n,hasM:r})}return e}function qt(e,t){if(T(e)||R(e)){let n=!1,r=!1,a=[],u=t;if(T(e)){for(const o of e)mt(a,o);a.length>0&&(u=e[0].spatialReference,n=e[0].hasZ===!0,r=e[0].hasM===!0)}else if(e instanceof it)a=e._elements,a.length>0&&(n=e._hasZ,r=e._hasM,u=e.get(0).spatialReference);else if(R(e)){for(const o of e.toArray())mt(a,o);a.length>0&&(u=e.get(0).spatialReference,n=e.get(0).hasZ===!0,r=e.get(0).hasM===!0)}return a.length===0?null:new be({points:a,spatialReference:u,hasZ:n,hasM:r})}return e}function Na(e,t=!1){const n=[];if(e===null)return n;if(T(e)===!0){for(let r=0;r{setTimeout(()=>{t(e)},0)})):e}function ir(e,t,n){switch(n){case"&":return e&t;case"|":return e|t;case"^":return e^t;case"<<":return e<>":return e>>t;case">>>":return e>>>t}}function Ke(e,t=null){return e==null?null:z(e)||V(e)||C(e)?e:e instanceof B?(t==null?void 0:t.keepGeometryType)===!0?e:e.toJSON():e instanceof se?e.toArray().map(n=>Ke(n,t)):e instanceof Array?e.map(n=>Ke(n,t)):Wt(e)?e:q(e)?e.toJSDate():J(e)?e.toString():P(e)?e.toJSDate():e!==null&&typeof e=="object"&&e.castAsJson!==void 0?e.castAsJson(t):null}async function Ma(e,t,n,r,a){const u=await ar(e,t,n);a[r]=u}async function ar(e,t=null,n=null){if(e instanceof se&&(e=e.toArray()),e==null)return null;if(Ge(e)||e instanceof B||Wt(e)||q(e))return Ke(e,n);if(e instanceof Array){const r=[],a=[];for(const u of e)u===null||Ge(u)||u instanceof B||Wt(u)||q(u)?a.push(Ke(u,n)):(a.push(null),r.push(Ma(u,t,n,a.length-1,a)));return r.length>0&&await Promise.all(r),a}return e!==null&&typeof e=="object"&&e.castAsJsonAsync!==void 0?e.castAsJsonAsync(t,n):null}function Ut(e){return Di(e)?e.parent:e}function Di(e){return e&&"declaredClass"in e&&e.declaredClass==="esri.layers.support.SubtypeSublayer"}function $a(e){return e&&"declaredClass"in e&&e.declaredClass==="esri.layers.SubtypeGroupLayer"}function gi(e,t,n){const r=Ut(e.fullSchema());return r===null||!r.fields?null:un(t,r,e,n)}function jt(e){const t=Ut(e.fullSchema());return t===null?null:t.fields&&t.typeIdField?{subtypeField:t.typeIdField,subtypes:t.types?t.types.map(n=>({name:n.name,code:n.id})):[]}:null}function yi(e,t,n,r){const a=Ut(e.fullSchema());if(a===null||!a.fields)return null;const u=un(t,a,e,r);if(n===void 0)try{n=e.field(t)}catch{return null}return mi(u,n)}function wi(e,t,n,r){const a=Ut(e.fullSchema());if(a===null||!a.fields)return null;if(n===void 0){try{n=e.field(t)}catch{return null}return n}return pi(un(t,a,e,r),n)}function _(e){return(e==null?void 0:e.timeZone)??"system"}function xi(e){const t=Ut(e.fullSchema());if(t===null||!t.fields)return null;const n=[];for(const r of t.fields)n.push(Ta(r));return{objectIdField:t.objectIdField,globalIdField:t.globalIdField??"",geometryType:Fr[t.geometryType]===void 0?"":Fr[t.geometryType],fields:n}}function Fi(e,t){return e==="system"&&(e=O.systemTimeZoneCanonicalName),{version:Ci,engineVersion:Qr,timeZone:e,spatialReference:t instanceof yt?t.toJSON():t,application:wa.applicationName??"",engine:"web",locale:Kn()}}const Ci="1.24",Ai=Object.freeze(Object.defineProperty({__proto__:null,ImplicitResult:ft,ImplicitResultE:fi,ReturnResult:ye,ReturnResultE:di,absRound:Nn,arcadeVersion:Ci,autoCastArrayOfPointsToMultiPoint:qt,autoCastArrayOfPointsToPolygon:Mn,autoCastArrayOfPointsToPolyline:kt,autoCastFeatureToGeometry:Z,binaryOperator:ir,breakResult:Ie,castAsJson:Ke,castAsJsonAsync:ar,continueResult:wt,defaultExecutingContext:Fi,defaultTimeZone:_,defaultUndefined:$,equalityTest:Ee,featureDomainCodeLookup:wi,featureDomainValueLookup:yi,featureFullDomain:gi,featureSchema:xi,featureSubtypes:jt,fixNullGeometry:Ye,fixSpatialReference:te,formatDate:on,formatNumber:tr,generateUUID:st,getDomain:un,getDomainCode:pi,getDomainValue:mi,getType:Qn,greaterThanLessThan:rr,isArray:T,isBoolean:z,isDate:q,isDateOnly:P,isDictionary:hi,isFeature:ee,isFeatureSet:xt,isFeatureSetCollection:Rt,isFunctionParameter:X,isGeometry:er,isImmutableArray:R,isInteger:Pe,isJsDate:Wt,isModule:Xn,isNumber:V,isObject:Bn,isSimpleType:Ge,isString:C,isSubtypeGrouplayer:$a,isSubtypeSublayer:Di,isTime:J,multiReplace:He,pcCheck:D,stableStringify:_n,standardiseDateFormat:nr,tick:_a,toBoolean:ht,toDate:ae,toNumber:h,toNumberArray:We,toString:w,toStringArray:Na,toStringExplicit:we,voidOperation:A},Symbol.toStringTag,{value:"Module"}));function La(e){bi=e}let bi;function Mt(e){return e===null?null:q(e)?e.clone():Ge(e)?e:er(e)?e.clone():R(e)?e.toArray().map(t=>Mt(t)):T(e)?e.map(t=>Mt(t)):ee(e)?bi.createFromArcadeFeature(e):Rt(e)||xt(e)?e:hi(e)||(e==null?void 0:e.declaredClass)==="esri.arcade.Attachment"?e.deepClone():((e==null?void 0:e.declaredClass)==="esri.arcade.Portal"||e instanceof Pt||X(e),e)}function Xt(e,t,n=!1,r=!1){if(e==null)return null;if(V(e))return h(e);if(z(e))return ht(e);if(C(e))return w(e);if(q(e))return ae(e,t);if(P(e)||J(e))return e;if(T(e)){const u=[];for(const o of e)u.push(Xt(o,t,n,r));return u}if(r&&er(e))return e;const a=new k;a.immutable=!1;for(const u of Object.keys(e)){const o=e[u];o!==void 0&&a.setField(u,Xt(o,t,n,r))}return a.immutable=n,a}let k=class Ht{constructor(t){this.declaredClass="esri.arcade.Dictionary",this.attributes=null,this.plain=!1,this.immutable=!0,this.attributes=t instanceof Ht?t.attributes:t??{}}field(t){const n=t.toLowerCase(),r=this.attributes[t];if(r!==void 0)return r;for(const a in this.attributes)if(a.toLowerCase()===n)return this.attributes[a];throw new d(null,l.FieldNotFound,null,{key:t})}setField(t,n){if(this.immutable)throw new d(null,l.Immutable,null);if(X(n))throw new d(null,l.NoFunctionInDictionary,null);const r=t.toLowerCase();if(n instanceof Date&&(n=O.dateJSToArcadeDate(n)),this.attributes[t]===void 0){for(const a in this.attributes)if(a.toLowerCase()===r)return void(this.attributes[a]=n);this.attributes[t]=n}else this.attributes[t]=n}hasField(t){const n=t.toLowerCase();if(this.attributes[t]!==void 0)return!0;for(const r in this.attributes)if(r.toLowerCase()===n)return!0;return!1}keys(){let t=[];for(const n in this.attributes)t.push(n);return t=t.sort(),t}castToText(t=!1){let n="";for(const r in this.attributes){n!==""&&(n+=",");const a=this.attributes[r];a==null?n+=JSON.stringify(r)+":null":z(a)||V(a)||C(a)?n+=JSON.stringify(r)+":"+JSON.stringify(a):a instanceof B?n+=JSON.stringify(r)+":"+we(a):a instanceof se||a instanceof Array?n+=JSON.stringify(r)+":"+we(a,null,t):a instanceof O?n+=t?JSON.stringify(r)+":"+JSON.stringify(a.getTime()):JSON.stringify(r)+":"+a.stringify():a!==null&&typeof a=="object"&&a.castToText!==void 0&&(n+=JSON.stringify(r)+":"+a.castToText(t))}return"{"+n+"}"}static convertObjectToArcadeDictionary(t,n,r=!0,a=!1){const u=new Ht;u.immutable=!1;for(const o in t){const i=t[o];i!==void 0&&u.setField(o.toString(),Xt(i,n,r,a))}return u.immutable=r,u}static convertJsonToArcade(t,n,r=!1){return Xt(t,n,r)}castAsJson(t=null){const n={};for(let r in this.attributes){const a=this.attributes[r];a!==void 0&&(t!=null&&t.keyTranslate&&(r=t.keyTranslate(r)),n[r]=Ke(a,t))}return n}async castDictionaryValueAsJsonAsync(t,n,r,a=null,u){const o=await ar(r,a,u);return t[n]=o,o}async castAsJsonAsync(t=null,n=null){const r={},a=[];for(let u in this.attributes){const o=this.attributes[u];n!=null&&n.keyTranslate&&(u=n.keyTranslate(u)),o!==void 0&&(Ge(o)||o instanceof B||o instanceof O?r[u]=Ke(o,n):a.push(this.castDictionaryValueAsJsonAsync(r,u,o,t,n)))}return a.length>0&&await Promise.all(a),r}deepClone(){const t=new Ht;t.immutable=!1;for(const n of this.keys())t.setField(n,Mt(this.field(n)));return t}},Q=class Fe{constructor(){this.arcadeDeclaredClass="esri.arcade.Feature",this._optimizedGeomDefinition=null,this._geometry=null,this.attributes=null,this._layer=null,this._fieldTypesFixed=!0,this.fieldsIndex=null,this.contextTimeZone=null,this.immutable=!0,this._fieldsToFixDataTypes=null,this.immutable=!0}static createFromGraphic(t,n){const r=new Fe;return r.contextTimeZone=n??null,r._geometry=t.geometry!=null?t.geometry:null,t.attributes===void 0||t.attributes===null?r.attributes={}:r.attributes=t.attributes,t._sourceLayer?(r._layer=t._sourceLayer,r._fieldTypesFixed=!1):t._layer?(r._layer=t._layer,r._fieldTypesFixed=!1):t.layer&&"fields"in t.layer?(r._layer=t.layer,r._fieldTypesFixed=!1):t.sourceLayer&&"fields"in t.sourceLayer&&(r._layer=t.sourceLayer,r._fieldTypesFixed=!1),r._layer&&!r._fieldTypesFixed&&(r.fieldsIndex=this.hydrateFieldsIndex(r._layer)),r}static createFromArcadeFeature(t){if(t instanceof Fe){const r=new Fe;return r._fieldTypesFixed=t._fieldTypesFixed,r.attributes=t.attributes,r._geometry=t._geometry,r._optimizedGeomDefinition=t._optimizedGeomDefinition,t._layer&&(r._layer=t._layer),r.fieldsIndex=t.fieldsIndex,r.contextTimeZone=t.contextTimeZone,r}const n={};for(const r of t.keys())n[r]=t.field(r);return Fe.createFromGraphicLikeObject(t.geometry(),n,t.fullSchema(),t.contextTimeZone)}static createFromOptimisedFeature(t,n,r){const a=new Fe;return a._geometry=t.geometry?{geometry:t.geometry}:null,a._optimizedGeomDefinition=r,a.attributes=t.attributes||{},a._layer=n,a._fieldTypesFixed=!1,a}static createFromArcadeDictionary(t){const n=new Fe;return n.attributes=t.field("attributes"),n.attributes!==null&&n.attributes instanceof k?(n.attributes=n.attributes.attributes,n.attributes===null&&(n.attributes={})):n.attributes={},n._geometry=t.field("geometry"),n._geometry!==null&&(n._geometry instanceof k?n._geometry=Fe.parseGeometryFromDictionary(n._geometry):n._geometry instanceof B||(n._geometry=null)),n}static createFromGraphicLikeObject(t,n,r=null,a){const u=new Fe;return u.contextTimeZone=a??null,n===null&&(n={}),u.attributes=n,u._geometry=t??null,u._layer=r,u._layer&&(u._fieldTypesFixed=!1,u.fieldsIndex=this.hydrateFieldsIndex(u._layer)),u}static hydrateFieldsIndex(t){return t===null?null:xt(t)?t.getFieldsIndex():t.fieldsIndex?t.fieldsIndex:xa.fromLayerJSON({datesInUnknownTimezone:t.datesInUnknownTimezone,fields:t.fields,timeInfo:t.timeInfo,editFieldsInfo:t.editFieldsInfo,dateFieldsTimeReference:t.dateFieldsTimeReference??{timeZone:"UTC",respectsDaylightSaving:!1}})}repurposeFromGraphicLikeObject(t,n,r=null){n===null&&(n={}),this.attributes=n,this._geometry=t??null,this._layer=r,this._layer?this._fieldTypesFixed=!1:this._fieldTypesFixed=!0}castToText(t=!1){let n="";this._fieldTypesFixed===!1&&this._fixFieldTypes();for(const r in this.attributes){n!==""&&(n+=",");const a=this.attributes[r];a==null?n+=JSON.stringify(r)+":null":z(a)||V(a)||C(a)?n+=JSON.stringify(r)+":"+JSON.stringify(a):a instanceof B?n+=JSON.stringify(r)+":"+we(a):a instanceof fe||a instanceof de?n+=`${JSON.stringify(r)}:${JSON.stringify(a.toString())}`:a instanceof se||a instanceof Array?n+=JSON.stringify(r)+":"+we(a,null,t):a instanceof O?n+=t?JSON.stringify(r)+":"+JSON.stringify(a.getTime()):JSON.stringify(r)+":"+a.stringify():a!==null&&typeof a=="object"&&a.castToText!==void 0&&(n+=JSON.stringify(r)+":"+a.castToText(t))}return'{"geometry":'+(this.geometry()===null?"null":we(this.geometry()))+',"attributes":{'+n+"}}"}_fixFieldTypes(){var r;if(this._fieldsToFixDataTypes&&((r=this._fieldsToFixDataTypes)==null?void 0:r.length)>0)return this._fixAllFields(this._fieldsToFixDataTypes),void(this._fieldTypesFixed=!0);const t=[],n=this._layer.fields;for(let a=0;a0&&this._fixAllFields(t),this._fieldTypesFixed=!0}isUnknownDateTimeField(t){var n;return((n=this.fieldsIndex)==null?void 0:n.getTimeZone(t))==="unknown"}_fixAllFields(t){this.attributes={...this.attributes};const n=this.contextTimeZone??"system";for(let r=0;r!n&&(a.type==="Identifier"&&a.name&&a.name.toLowerCase()===r&&(n=!0),!0)),n}function Si(e){const t=[];return K(e,n=>(n.type==="ImportDeclaration"&&n.source&&n.source.value&&t.push({libname:n.specifiers[0].local.name.toLowerCase(),source:n.source.value}),!0)),t}function Ra(e,t){let n=!1;const r=t.toLowerCase();return K(e,a=>!n&&(a.type!=="CallExpression"||a.callee.type!=="Identifier"||!a.callee.name||a.callee.name.toLowerCase()!==r||(n=!0,!1))),n}function Ua(e){const t=[];return K(e,n=>{var r;return n.type!=="MemberExpression"||n.object.type!=="Identifier"||(n.computed===!1&&n.object&&n.object.name&&n.property&&n.property.type==="Identifier"&&n.property.name?t.push(n.object.name.toLowerCase()+"."+n.property.name.toLowerCase()):n.object&&n.object.name&&n.property&&n.property.type==="Literal"&&typeof n.property.value=="string"&&t.push(n.object.name.toLowerCase()+"."+((r=n.property.value)==null?void 0:r.toString().toLowerCase())),!1)}),t}function za(e){const t=[];return K(e,n=>{var r;if(n.type==="CallExpression"){if(n.callee.type==="Identifier"&&n.callee.name.toLowerCase()==="expects"){let a="";for(let u=0;u<(n.arguments||[]).length;u++)u===0?n.arguments[u].type==="Identifier"&&(a=n.arguments[u].name.toLowerCase()):a&&n.arguments[u].type==="Literal"&&Er(n.arguments[u].value)&&t.push(a+"."+n.arguments[u].value.toLowerCase());return!1}if(n.callee.type==="Identifier"&&["domainname","domaincode","domain","haskey"].includes(n.callee.name.toLowerCase())&&n.arguments.length>=2){let a="";return n.arguments[0].type==="Identifier"&&(a=n.arguments[0].name.toLowerCase()),a&&n.arguments[1].type==="Literal"&&Er(n.arguments[1].value)&&t.push(a+"."+n.arguments[1].value.toLowerCase()),!1}}return n.type!=="MemberExpression"||n.object.type!=="Identifier"||(n.computed===!1&&n.object&&n.object.name&&n.property&&n.property.type==="Identifier"&&n.property.name?t.push(n.object.name.toLowerCase()+"."+n.property.name.toLowerCase()):n.object&&n.object.name&&n.property&&n.property.type==="Literal"&&typeof n.property.value=="string"&&t.push(n.object.name.toLowerCase()+"."+((r=n.property.value)==null?void 0:r.toString().toLowerCase())),!1)}),t}function Ln(e){const t=[];return K(e,n=>(n.type==="CallExpression"&&n.callee.type==="Identifier"&&t.push(n.callee.name.toLowerCase()),!0)),t}function zt(e,t=[]){let n=null;if(e.usesFeatureSet===void 0){n===null&&(n=Ln(e)),e.usesFeatureSet=!1;for(let r=0;r0){for(const r of t)if(Ei(e,r)){e.usesFeatureSet=!0,e.isAsync=!0;break}}}if(e.usesModules===void 0&&(e.usesModules=!1,Si(e).length>0&&(e.usesModules=!0)),e.usesGeometry===void 0){e.usesGeometry=!1,n===null&&(n=Ln(e));for(let r=0;r0||s.length>0;)if(i.length>0&&s.length>0){let f=c(i[0],s[0]);isNaN(f)&&(f=0),f<=0?(p.push(i[0]),i=i.slice(1)):(p.push(s[0]),s=s.slice(1))}else i.length>0?(p.push(i[0]),i=i.slice(1)):s.length>0&&(p.push(s[0]),s=s.slice(1));return p}async function a(i,s){const c=i.length,p=Math.floor(c/2);if(c===0)return[];if(c===1)return[i[0]];const f=[await a(i.slice(0,p),s),await a(i.slice(p,c),s)];return u(f[0],f[1],s,[])}async function u(i,s,c,p){const f=p;if(!(i.length>0||s.length>0))return p;if(i.length>0&&s.length>0){let m=await c(i[0],s[0]);return isNaN(m)&&(m=1),m<=0?(f.push(i[0]),i=i.slice(1)):(f.push(s[0]),s=s.slice(1)),u(i,s,c,p)}return i.length>0?(f.push(i[0]),u(i=i.slice(1),s,c,p)):s.length>0?(f.push(s[0]),u(i,s=s.slice(1),c,p)):void 0}function o(i,s,c,p){D(c,1,2,i,s);let f=c[0];if(R(f)&&(f=f.toArray()),T(f)===!1)throw new d(i,l.InvalidParameter,s);if(c.length>1){if(X(c[1])===!1)throw new d(i,l.InvalidParameter,s);let I=f;const W=c[1].createFunction(i);return p?a(I,W):(I=n(I,(pe,Zt)=>W(pe,Zt)),I)}let m=f;if(m.length===0)return[];const g={};for(let I=0;I1||M==="String"?n(m,(I,W)=>{if(I==null||I===A)return W==null||W===A?0:1;if(W==null||W===A)return-1;const pe=w(I),Zt=w(W);return peI-W):M==="Boolean"?n(m,(I,W)=>I===W?0:W?-1:1):M==="Date"?n(m,(I,W)=>W-I):m.slice(0),m}e.functions.array=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,0,2,i,s),f.length===0)return new Array;if(f.length===1&&f[0]===null)return new Array;if(T(f[0])){if(f.length===2&&z(f[1])===!1)throw new d(i,l.InvalidParameter,s);return $(f[1],!1)===!0?Mt(f[0]):f[0].slice(0)}if(R(f[0])){if(f.length===2&&z(f[1])===!1)throw new d(i,l.InvalidParameter,s);return $(f[1],!1)===!0?Mt(f[0]):f[0].toArray().slice(0)}const m=h(f[0]);if(isNaN(m)||Pe(m)===!1)throw new d(i,l.InvalidParameter,s);const g=$(f[1],null),x=new Array(m);return x.fill(g),x})},e.functions.front=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,1,1,i,s),R(f[0])){if(f[0].length()<=0)throw new d(i,l.OutOfBounds,s);return f[0].get(0)}if(T(f[0])){if(f[0].length<=0)throw new d(i,l.OutOfBounds,s);return f[0][0]}throw new d(i,l.InvalidParameter,s)})},e.functions.back=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,1,1,i,s),R(f[0])){if(f[0].length()<=0)throw new d(i,l.OutOfBounds,s);return f[0].get(f[0].length()-1)}if(T(f[0])){if(f[0].length<=0)throw new d(i,l.OutOfBounds,s);return f[0][f[0].length-1]}throw new d(i,l.InvalidParameter,s)})},e.functions.push=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,1,2,i,s),T(f[0]))return f[0][f[0].length]=f[1],f[0].length;throw new d(i,l.InvalidParameter,s)})},e.functions.pop=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,1,1,i,s),T(f[0])){if(f[0].length<=0)throw new d(i,l.OutOfBounds,s);const m=f[0][f[0].length-1];return f[0].length=f[0].length-1,m}throw new d(i,l.InvalidParameter,s)})},e.functions.erase=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,2,2,i,s),T(f[0])){let m=h(f[1]);if(isNaN(m)||Pe(m)===!1)throw new d(i,l.InvalidParameter,s);const g=f[0];if(g.length<=0)throw new d(i,l.OutOfBounds,s);if(m<0&&(m=g.length+m),m<0)throw new d(i,l.OutOfBounds,s);if(m>=g.length)throw new d(i,l.OutOfBounds,s);return g.splice(m,1),A}throw new d(i,l.InvalidParameter,s)})},e.functions.insert=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,3,3,i,s),T(f[0])){const m=h(f[1]);if(isNaN(m)||Pe(m)===!1)throw new d(i,l.InvalidParameter,s);const g=f[2],x=f[0];if(m>x.length)throw new d(i,l.OutOfBounds,s);if(m<0&&m<-1*x.length)throw new d(i,l.OutOfBounds,s);return m===x.length?(x[m]=g,A):(x.splice(m,0,g),A)}throw new d(i,l.InvalidParameter,s)})},e.functions.resize=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,2,3,i,s),T(f[0])){const m=h(f[1]);if(isNaN(m)||Pe(m)===!1)throw new d(i,l.InvalidParameter,s);if(m<0)throw new d(i,l.InvalidParameter,s);const g=$(f[2],null),x=f[0];if(x.length>=m)return x.length=m,A;const M=x.length;x.length=m;for(let I=M;I{if(D(f,2,2,i,s),T(f[0])){const m=f[1];return f[0].findIndex(g=>Ee(g,m))>-1}if(R(f[0])){const m=f[1];return f[0].toArray().findIndex(g=>Ee(g,m))>-1}throw new d(i,l.InvalidParameter,s)})},e.functions.slice=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{if(D(f,1,3,i,s),T(f[0])){const m=h($(f[1],0)),g=h($(f[2],f[0].length));if(isNaN(m)||Pe(m)===!1)throw new d(i,l.InvalidParameter,s);if(isNaN(g)||Pe(g)===!1)throw new d(i,l.InvalidParameter,s);return f[0].slice(m,g)}if(R(f[0])){const m=f[0],g=h($(f[1],0)),x=h($(f[2],m.length()));if(isNaN(g)||Pe(g)===!1)throw new d(i,l.InvalidParameter,s);if(isNaN(x)||Pe(x)===!1)throw new d(i,l.InvalidParameter,s);return m.toArray().slice(g,x)}throw new d(i,l.InvalidParameter,s)})},e.functions.splice=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{const m=[];for(let g=0;g{if(D(f,2,2,i,s),T(f[0]))return h(f[1])>=f[0].length?f[0].slice(0):f[0].slice(0,h(f[1]));if(R(f[0]))return h(f[1])>=f[0].length()?f[0].slice(0):f[0].slice(0,h(f[1]));throw new d(i,l.InvalidParameter,s)})},e.functions.first=function(i,s){return e.standardFunction(i,s,(c,p,f)=>(D(f,1,1,i,s),T(f[0])?f[0].length===0?null:f[0][0]:R(f[0])?f[0].length()===0?null:f[0].get(0):null))},e.mode==="sync"&&(e.functions.sort=function(i,s){return e.standardFunction(i,s,(c,p,f)=>o(i,s,f,!1))},e.functions.any=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g){const M=m(x);if(z(M)&&M===!0)return!0}return!1})},e.functions.all=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g)if(m(x)!==!0)return!1;return!0})},e.functions.none=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g)if(m(x)===!0)return!1;return!0})},e.functions.reduce=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,3,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);return f.length===2?g.length===0?null:g.reduce((x,M)=>{const I=m(x,M);return x=I!==void 0&&I!==A?I:null}):g.reduce((x,M)=>{const I=m(x,M);return x=I!==void 0&&I!==A?I:null},f[2])})},e.functions.map=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s),x=[];for(const M of g){const I=m(M);I!==void 0&&I!==A?x.push(I):x.push(null)}return x})},e.functions.filter=function(i,s){return e.standardFunction(i,s,(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s),x=[];for(const M of g)m(M)===!0&&x.push(M);return x})}),e.mode==="async"&&(e.functions.sort=function(i,s){return e.standardFunctionAsync(i,s,(c,p,f)=>o(i,s,f,!0))},e.functions.any=function(i,s){return e.standardFunctionAsync(i,s,async(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g){const M=await m(x);let I=null;if(I=Ve(I)?await M:M,z(I)&&I===!0)return!0}return!1})},e.functions.all=function(i,s){return e.standardFunctionAsync(i,s,async(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g){const M=await m(x);let I=null;if(I=Ve(I)?await M:M,I!==!0)return!1}return!0})},e.functions.none=function(i,s){return e.standardFunctionAsync(i,s,async(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);for(const x of g){const M=await m(x);let I=null;if(I=Ve(I)?await M:M,I===!0)return!1}return!0})},e.functions.filter=function(i,s){return e.standardFunctionAsync(i,s,async(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s),x=[];for(const M of g){const I=await m(M);let W=null;W=Ve(W)?await I:I,W===!0&&x.push(M)}return x})},e.functions.reduce=function(i,s){return e.standardFunctionAsync(i,s,(c,p,f)=>{D(f,2,3,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s);let x=null;if(f.length>2){const M=$(f[2],null);x=g.reduce(async(I,W)=>{let pe=await I;return pe!==void 0&&pe!==A||(pe=null),m(pe,W)},Promise.resolve(M))}else{if(g.length===0)return null;x=g.reduce(async(M,I,W)=>{if(W<=1)return m(M,I);let pe=await M;return pe!==void 0&&pe!==A||(pe=null),m(pe,I)})}return x.then(M=>M!==void 0&&M!==A?M:null)})},e.functions.map=function(i,s){return e.standardFunctionAsync(i,s,async(c,p,f)=>{D(f,2,2,i,s);const m=f[1].createFunction(i),g=t(f[0],i,s),x=[];for(const M of g){const I=await m(M);let W=null;W=Ve(W)?await I:I,W!==void 0&&W!==A?x.push(W):x.push(null)}return x})})}const On=Object.freeze(Object.defineProperty({__proto__:null,registerFunctions:Ga},Symbol.toStringTag,{value:"Module"}));function Za(e,t,n){return e+(Ja(n)?qa:Va)[t]}function Ja(e){return e%4==0&&(e%100!=0||e%400==0)}const Va=[0,31,59,90,120,151,181,212,243,273,304,334],qa=[0,31,60,91,121,152,182,213,244,274,305,335];function Be(e){return e===null?e:e.isValid===!1?null:e}function Ft(e,t){return e===""||e.toLowerCase().trim()==="default"?_(t):e==="z"||e==="Z"?"UTC":e}function $e(e,t){return P(e)?e.toArcadeDate():ae(e,_(t))}function vi(e,t){e.today=function(n,r){return t(n,r,(a,u,o)=>{D(o,0,0,n,r);const i=new Date;return i.setHours(0,0,0,0),O.dateJSAndZoneToArcadeDate(i,_(n))})},e.time=function(n,r){return t(n,r,(a,u,o)=>{switch(D(o,0,4,n,r),o.length){case 0:{const i=O.nowToArcadeDate(_(n));return new fe(i.hour,i.minute,i.second,i.millisecond)}case 1:{if(J(o[0]))return o[0].clone();if(q(o[0]))return new fe(o[0].hour,o[0].minute,o[0].second,o[0].millisecond);if(P(o[0]))return new fe(0,0,0,0);if(C(o[0]))return fe.fromString(o[0]);const i=h(o[0]);return isNaN(i)===!1?fe.fromMilliseconds(i):null}case 2:return C(o[0])&&C(o[1])?fe.fromString(o[0],o[1]):fe.fromParts(h(o[0]),h(o[1]),0,0);case 3:return fe.fromParts(h(o[0]),h(o[1]),h(o[2]),0);case 4:return fe.fromParts(h(o[0]),h(o[1]),h(o[2]),h(o[3]))}throw new d(n,l.InvalidParameter,r)})},e.dateonly=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,0,3,n,r),o.length===3)return de.fromParts(h(o[0]),h(o[1])+1,h(o[2]));if(o.length===2){const i=w(o[1]);return i===""?null:i==="X"?de.fromSeconds(h(o[0])):i==="x"?de.fromMilliseconds(h(o[0])):de.fromString(w(o[0]),i)}if(o.length===1){if(C(o[0])){if(o[0].replaceAll(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")==="")return null;if(/^[0-9][0-9][0-9][0-9]$/.test(o[0])===!0)return de.fromString(o[0]+"-01-01")}if(P(o[0]))return o[0].clone();if(q(o[0]))return de.fromParts(o[0].year,o[0].monthJS+1,o[0].day);const i=h(o[0]);return isNaN(i)===!1?de.fromMilliseconds(i):C(o[0])?de.fromString(o[0]):null}if(o.length===0){const i=O.nowToArcadeDate(_(n));return i.isValid===!1?null:de.fromParts(i.year,i.monthJS+1,i.day)}return null})},e.changetimezone=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,2,n,r),o[0]===null)return null;if(P(o[0]))throw new d(n,l.CannotChangeTimeZoneDateOnly,r);if(P(o[0]))throw new d(n,l.CannotChangeTimeZoneTime,r);const i=ae(o[0],_(n));if(i===null)throw new d(n,l.InvalidParameter,r);const s=bt(Ft(w(o[1]),n),!1);if(s===null)return null;const c=O.arcadeDateAndZoneToArcadeDate(i,s);return c.isValid===!1?null:c})},e.timezone=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,2,n,r),J(o[0])||P(o[0]))return"Unknown";const i=ae(o[0],_(n));if(i===null)return null;const s=i.timeZone;return s==="system"?O.systemTimeZoneCanonicalName:s.toLowerCase()==="utc"?"UTC":s.toLowerCase()==="unknown"?"Unknown":s})},e.timezoneoffset=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=ae(o[0],_(n));return i===null?null:60*i.timeZoneOffset*1e3})},e.now=function(n,r){return t(n,r,(a,u,o)=>{D(o,0,0,n,r);const i=O.nowToArcadeDate(_(n));return i.isValid===!1?null:i})},e.timestamp=function(n,r){return t(n,r,(a,u,o)=>{D(o,0,0,n,r);const i=O.nowUTCToArcadeDate();return i.isValid===!1?null:i})},e.toutc=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=ae(o[0],_(n));return i===null?null:i.toUTC()})},e.tolocal=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=ae(o[0],_(n));return i===null?null:i.toLocal()})},e.day=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.day})},e.month=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.monthJS})},e.year=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.year})},e.hour=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),J(o[0]))return o[0].hour;const i=ae(o[0],_(n));return i===null?NaN:i.hour})},e.second=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),J(o[0]))return o[0].second;const i=ae(o[0],_(n));return i===null?NaN:i.second})},e.millisecond=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),J(o[0]))return o[0].millisecond;const i=ae(o[0],_(n));return i===null?NaN:i.millisecond})},e.minute=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),J(o[0]))return o[0].minute;const i=ae(o[0],_(n));return i===null?NaN:i.minute})},e.week=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,2,n,r);const i=$e(o[0],_(n));if(i===null)return NaN;const s=h($(o[1],0));if(s<0||s>6)throw new d(n,l.InvalidParameter,r);const c=i.day,p=i.monthJS,f=i.year,m=i.dayOfWeekJS,g=Za(c,p,f)-1,x=Math.floor(g/7);return m-s+(m-s<0?7:0){D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.dayOfWeekJS})},e.isoweekday=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.dayOfWeekISO})},e.isomonth=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.monthISO})},e.isoweek=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.weekISO})},e.isoyear=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=$e(o[0],_(n));return i===null?NaN:i.yearISO})},e.date=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,0,8,n,r),o.length===3){if(P(o[0])&&J(o[1])&&C(o[2])){const i=bt(Ft(w(o[2])??"unknown",n),!1);return i===null?null:Be(O.fromParts(o[0].year,o[0].month,o[0].day,o[1].hour,o[1].minute,o[1].second,o[1].millisecond,i))}return Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),0,0,0,0,_(n)))}if(o.length===4)return Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),h(o[3]),0,0,0,_(n)));if(o.length===5)return Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),h(o[3]),h(o[4]),0,0,_(n)));if(o.length===6)return Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),h(o[3]),h(o[4]),h(o[5]),0,_(n)));if(o.length===7)return Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),h(o[3]),h(o[4]),h(o[5]),h(o[6]),_(n)));if(o.length===8){const i=bt(Ft(w(o[7])??"unknown",n),!1);return i===null?null:Be(O.fromParts(h(o[0]),h(o[1])+1,h(o[2]),h(o[3]),h(o[4]),h(o[5]),h(o[6]),i))}if(o.length===2){if(P(o[0])&&C(o[1])){const c=bt(Ft(w(o[1])??"unknown",n),!1);return c===null?null:Be(O.fromParts(o[0].year,o[0].month,o[0].day,0,0,0,0,c))}if(P(o[0])&&J(o[1]))return Be(O.fromParts(o[0].year,o[0].month,o[0].day,o[1].hour,o[1].minute,o[1].second,o[1].millisecond,"unknown"));let i,s=w(o[1]);return s===""?null:(s=nr(s,!0),i=s==="X"?Qe.fromSeconds(h(o[0])):s==="x"?Qe.fromMillis(h(o[0])):Qe.fromFormat(w(o[0]),s,{locale:Kn(),numberingSystem:"latn"}),i.isValid?O.dateTimeToArcadeDate(i):null)}if(o.length===1){if(P(o[0]))return Be(O.fromParts(o[0].year,o[0].month,o[0].day,0,0,0,0,"unknown"));if(C(o[0])){if(o[0].replaceAll(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")==="")return null;if(/^[0-9][0-9][0-9][0-9]$/.test(o[0])===!0)return ae(o[0]+"-01-01",_(n))}const i=h(o[0]);if(isNaN(i)===!1){const s=Qe.fromMillis(i);return s.isValid?O.dateTimeAndZoneToArcadeDate(s,_(n)):null}return ae(o[0],_(n))}return o.length===0?O.nowToArcadeDate(_(n)):null})},e.datediff=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,4,n,r),J(o[0]))return J(o[1])?o[0].difference(o[1],w(o[2])):NaN;if(J(o[1]))return NaN;if(P(o[0]))return P(o[1])?o[0].difference(o[1],w(o[2])):NaN;if(P(o[1]))return NaN;let i=ae(o[0],_(n)),s=ae(o[1],_(n));if(i===null||s===null)return NaN;let c=$(o[3],"");switch(c!==""&&c!==null?(c=Ft(w(c),n),i=O.arcadeDateAndZoneToArcadeDate(i,c),s=O.arcadeDateAndZoneToArcadeDate(s,c)):i.timeZone!==s.timeZone&&(i.isUnknownTimeZone?i=O.arcadeDateAndZoneToArcadeDate(i,s.timeZone):s=(s.isUnknownTimeZone,O.arcadeDateAndZoneToArcadeDate(s,i.timeZone))),w(o[2]).toLowerCase()){case"days":case"day":case"d":return i.diff(s,"days");case"months":case"month":return i.diff(s,"months");case"minutes":case"minute":case"m":return o[2]==="M"?i.diff(s,"months"):i.diff(s,"minutes");case"seconds":case"second":case"s":return i.diff(s,"seconds");case"milliseconds":case"millisecond":case"ms":default:return i.diff(s);case"hours":case"hour":case"h":return i.diff(s,"hours");case"years":case"year":case"y":return i.diff(s,"years")}})},e.dateadd=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,3,n,r);let i=h(o[1]);if(isNaN(i)||i===1/0||i===-1/0)return J(o[0])||P(o[0])?o[0].clone():ae(o[0],_(n));let s="milliseconds";switch(w(o[2]).toLowerCase()){case"days":case"day":case"d":s="days",i=P(o[0])?i:Nn(i);break;case"months":case"month":s="months",i=P(o[0])?i:Nn(i);break;case"minutes":case"minute":case"m":s=o[2]==="M"?"months":"minutes";break;case"seconds":case"second":case"s":s="seconds";break;case"milliseconds":case"millisecond":case"ms":s="milliseconds";break;case"hours":case"hour":case"h":s="hours";break;case"years":case"year":case"y":s="years"}if(J(o[0])||P(o[0]))return o[0].plus(s,i);const c=ae(o[0],_(n));return c===null?null:c.plus({[s]:i})})}}function Ct(e,t,n){return Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]!==void 0&&t[2]!==void 0?(e[2]*n-t[2]*n)**2:0))}const Et=[];for(const e of[[9002,56146130,6131,6132,8050,8051,8228],[9003,5702,6358,6359,6360,8052,8053],[9095,5754]]){const t=e[0];for(let n=1;n0?(r.x/=a,r.y/=a,t&&(r.z/=a),n&&(r.m/=a)):(r.x=e[0][0],r.y=e[0][1],t&&(r.z=e[0][2]),n&&t?r.m=e[0][3]:n&&(r.m=e[0][2])),r}function Ha(e,t,n,r){const a={x:(e[0]+t[0])/2,y:(e[1]+t[1])/2};return n&&(a.z=(e[2]+t[2])/2),n&&r?a.m=(e[3]+t[3])/2:r&&(a.m=(e[2]+t[2])/2),a}function Ka(e,t){if(e.length<=1)return 0;let n=0;for(let r=1;r0?(n.x/=a,n.y/=a,e.hasZ===!0&&(n.z/=a),e.hasM===!0&&(n.m/=a),new H(n)):r>0?(t.x/=r,t.y/=r,e.hasZ===!0&&(n.z/=r),e.hasM===!0&&(t.m/=r),new H(t)):null}function Xa(e){if(e.points.length===0)return null;let t=0,n=0,r=0,a=0;for(let o=0;o=r;)e-=t;return e}function ki(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function to(e,t){return cn(ki(e,t),2*Math.PI)*(180/Math.PI)}function no(e,t){return cn(Math.PI/2-ki(e,t),2*Math.PI)*(180/Math.PI)}function Ti(e,t,n){const r={x:e.x-t.x,y:e.y-t.y},a={x:n.x-t.x,y:n.y-t.y};return Math.atan2(eo(r,a),Qa(r,a))}function ro(e,t,n){return ei(cn(Ti(e,t,n),2*Math.PI))}function io(e,t,n){return ei(cn(-1*Ti(e,t,n),2*Math.PI))}Tt[9002]=.3048,Tt[9003]=.3048006096012192,Tt[9095]=.3048007491;const ie=[0,0];function vr(e){for(let t=0;t{D(o,1,1,n,r);let i=[];if(o[0]===null)return!1;if(T(o[0]))for(const s of o[0]){if(!(s instanceof H))throw new d(n,l.InvalidParameter,r);i.push(s.hasZ?s.hasM?[s.x,s.y,s.z,s.m]:[s.x,s.y,s.z]:[s.x,s.y])}else if(o[0]instanceof it)i=o[0]._elements;else{if(!R(o[0]))throw new d(n,l.InvalidParameter,r);for(const s of o[0].toArray()){if(!(s instanceof H))throw new d(n,l.InvalidParameter,r);i.push(s.hasZ?s.hasM?[s.x,s.y,s.z,s.m]:[s.x,s.y,s.z]:[s.x,s.y])}}return!(i.length<3)&&Xr(i)})},e.polygon=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);let i=null;if(o[0]instanceof k){if(i=te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference),!(i instanceof ue))throw new d(n,l.InvalidParameter,r)}else i=o[0]instanceof ue?De(o[0].toJSON()):te(new ue(JSON.parse(o[0])),n.spatialReference);if(i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.polyline=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);let i=null;if(o[0]instanceof k){if(i=te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference),!(i instanceof oe))throw new d(n,l.InvalidParameter,r)}else i=o[0]instanceof oe?De(o[0].toJSON()):te(new oe(JSON.parse(o[0])),n.spatialReference);if(i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.point=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);let i=null;if(o[0]instanceof k){if(i=te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference),!(i instanceof H))throw new d(n,l.InvalidParameter,r)}else i=o[0]instanceof H?De(o[0].toJSON()):te(new H(JSON.parse(o[0])),n.spatialReference);if(i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.multipoint=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);let i=null;if(o[0]instanceof k){if(i=te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference),!(i instanceof be))throw new d(n,l.InvalidParameter,r)}else i=o[0]instanceof be?De(o[0].toJSON()):te(new be(JSON.parse(o[0])),n.spatialReference);if(i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.extent=function(n,r){return t(n,r,(a,u,o)=>{var s;o=Z(o),D(o,1,1,n,r);let i=null;if(o[0]instanceof k)i=te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference);else if(o[0]instanceof H){const c={xmin:o[0].x,ymin:o[0].y,xmax:o[0].x,ymax:o[0].y,spatialReference:o[0].spatialReference.toJSON()},p=o[0];p.hasZ?(c.zmin=p.z,c.zmax=p.z):p.hasM&&(c.mmin=p.m,c.mmax=p.m),i=De(c)}else i=o[0]instanceof ue||o[0]instanceof oe||o[0]instanceof be?De((s=o[0].extent)==null?void 0:s.toJSON()):o[0]instanceof ge?De(o[0].toJSON()):te(new ge(JSON.parse(o[0])),n.spatialReference);if(i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.geometry=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);let i=null;if(o[0]===null)return null;if(i=Vt(o[0])?te(o[0].geometry(),n.spatialReference):o[0]instanceof k?te(Q.parseGeometryFromDictionary(o[0]),n.spatialReference):te(De(JSON.parse(o[0])),n.spatialReference),i!==null&&i.spatialReference.equals(n.spatialReference)===!1)throw new d(n,l.WrongSpatialReference,r);return Ye(i)})},e.setgeometry=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,2,n,r),!Vt(o[0]))throw new d(n,l.InvalidParameter,r);if(o[0].immutable===!0)throw new d(n,l.Immutable,r);if(!(o[1]instanceof B||o[1]===null))throw new d(n,l.InvalidParameter,r);return o[0]._geometry=o[1],A})},e.feature=function(n,r){return t(n,r,(a,u,o)=>{if(o.length===0)throw new d(n,l.WrongNumberOfParameters,r);let i=null;if(o.length===1)if(C(o[0]))i=Q.fromJson(JSON.parse(o[0]),n.timeZone);else if(Vt(o[0]))i=Q.createFromArcadeFeature(o[0]);else if(o[0]instanceof B)i=Q.createFromGraphicLikeObject(o[0],null,null,n.timeZone);else{if(!(o[0]instanceof k))throw new d(n,l.InvalidParameter,r);{let s=o[0].hasField("geometry")?o[0].field("geometry"):null,c=o[0].hasField("attributes")?o[0].field("attributes"):null;s!==null&&s instanceof k&&(s=Q.parseGeometryFromDictionary(s)),c!==null&&(c=Q.parseAttributesFromDictionary(c)),i=Q.createFromGraphicLikeObject(s,c,null,n.timeZone)}}else if(o.length===2){let s=null,c=null;if(o[0]!==null)if(o[0]instanceof B)s=o[0];else{if(!(s instanceof k))throw new d(n,l.InvalidParameter,r);s=Q.parseGeometryFromDictionary(o[0])}if(o[1]!==null){if(!(o[1]instanceof k))throw new d(n,l.InvalidParameter,r);c=Q.parseAttributesFromDictionary(o[1])}i=Q.createFromGraphicLikeObject(s,c,null,n.timeZone)}else{let s=null;const c={};if(o[0]!==null)if(o[0]instanceof B)s=o[0];else{if(!(s instanceof k))throw new d(n,l.InvalidParameter,r);s=Q.parseGeometryFromDictionary(o[0])}for(let p=1;p{if(o.length===0||o.length===1&&o[0]===null){const c=new k;return c.immutable=!1,c}if(o.length===1&&C(o[0]))try{const c=JSON.parse(o[0]),p=k.convertObjectToArcadeDictionary(c,_(n),!1);return p.immutable=!1,p}catch{throw new d(n,l.InvalidParameter,r)}if(o.length===1&&o[0]instanceof B)try{const c=o[0].toJSON();c.hasZ=o[0].hasZ===!0,c.hasM=o[0].hasM===!0;const p=k.convertObjectToArcadeDictionary(c,_(n),!1);return p.immutable=!1,p}catch{throw new d(n,l.InvalidParameter,r)}if(o.length===1&&ee(o[0]))try{const c=new k;c.immutable=!1,c.setField("geometry",o[0].geometry());const p=new k;p.immutable=!1,c.setField("attributes",p);for(const f of o[0].keys())p.setField(f,o[0].field(f));return c}catch{throw new d(n,l.InvalidParameter,r)}if(o.length===1&&o[0]instanceof k)try{const c=new k;c.immutable=!1;for(const p of o[0].keys())c.setField(p,o[0].field(p));return c}catch{throw new d(n,l.InvalidParameter,r)}if(o.length===2&&o[0]instanceof k&&z(o[1]))try{if(o[1]!==!0){const c=new k;c.immutable=!1;for(const p of o[0].keys())c.setField(p,o[0].field(p));return c}return o[0].deepClone()}catch{throw new d(n,l.InvalidParameter,r)}if(o.length%2!=0)throw new d(n,l.WrongNumberOfParameters,r);const i={};for(let c=0;c{D(o,2,2,n,r);const i=w(o[1]);if(Vt(o[0])||o[0]instanceof k)return o[0].hasField(i);if(o[0]instanceof B){const s=$t(o[0],i,null,null,2);return!s||s.keystate!=="notfound"}throw new d(n,l.InvalidParameter,r)})},e.hasvalue=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,2,n,r),o[0]===null||o[1]===null)return!1;const i=w(o[1]);return ee(o[0])||o[0]instanceof k?!!o[0].hasField(i)&&o[0].field(i)!==null:o[0]instanceof B?$t(o[0],i,null,null,0)!==null:!1})},e.indexof=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,2,n,r);const i=o[1];if(T(o[0])){for(let s=0;s{if(o=Z(o),D(o,2,3,n,r),!(o[0]instanceof H))throw new d(n,l.InvalidParameter,r);if(!(o[1]instanceof H))throw new d(n,l.InvalidParameter,r);if(o.length>2&&!(o[2]instanceof H))throw new d(n,l.InvalidParameter,r);return o.length===2?to(o[0],o[1]):ro(o[0],o[1],o[2])})},e.bearing=function(n,r){return t(n,r,(a,u,o)=>{if(o=Z(o),D(o,2,3,n,r),!(o[0]instanceof H))throw new d(n,l.InvalidParameter,r);if(!(o[1]instanceof H))throw new d(n,l.InvalidParameter,r);if(o.length>2&&!(o[2]instanceof H))throw new d(n,l.InvalidParameter,r);return o.length===2?no(o[0],o[1]):io(o[0],o[1],o[2])})},e.isselfintersecting=function(n,r){return t(n,r,(a,u,o)=>{o=Z(o),D(o,1,1,n,r);let i=o[0];if(i instanceof ue)return i.isSelfIntersecting;if(i instanceof oe)return i=i.paths,vr(i);if(i instanceof be){const s=i.points;for(let c=0;c(i=Z(i),n(r,a,i),i[0]===null||i[1]===null||U.disjoint(i[0],i[1])))},e.intersects=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.intersects(i[0],i[1])))},e.touches=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.touches(i[0],i[1])))},e.crosses=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.crosses(i[0],i[1])))},e.within=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.within(i[0],i[1])))},e.contains=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.contains(i[0],i[1])))},e.overlaps=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]!==null&&i[1]!==null&&U.overlaps(i[0],i[1])))},e.equals=function(r,a){return t(r,a,(u,o,i)=>(D(i,2,2,r,a),i[0]===i[1]||(i[0]instanceof B&&i[1]instanceof B?U.equals(i[0],i[1]):(q(i[0])&&q(i[1])||J(i[0])&&J(i[1])||!(!P(i[0])||!P(i[1])))&&i[0].equals(i[1]))))},e.relate=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,3,3,r,a),i[0]instanceof B&&i[1]instanceof B)return U.relate(i[0],i[1],w(i[2]));if(i[0]instanceof B&&i[1]===null||i[1]instanceof B&&i[0]===null||i[0]===null&&i[1]===null)return!1;throw new d(r,l.InvalidParameter,a)})},e.intersection=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]===null||i[1]===null?null:U.intersect(i[0],i[1])))},e.union=function(r,a){return t(r,a,(u,o,i)=>{const s=[];if((i=Z(i)).length===0)throw new d(r,l.WrongNumberOfParameters,a);if(i.length===1)if(T(i[0])){const c=Z(i[0]);for(let p=0;p(i=Z(i),n(r,a,i),i[0]!==null&&i[1]===null?Se(i[0]):i[0]===null?null:U.difference(i[0],i[1])))},e.symmetricdifference=function(r,a){return t(r,a,(u,o,i)=>(i=Z(i),n(r,a,i),i[0]===null&&i[1]===null?null:i[0]===null?Se(i[1]):i[1]===null?Se(i[0]):U.symmetricDifference(i[0],i[1])))},e.clip=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,2,r,a),!(i[1]instanceof ge)&&i[1]!==null)throw new d(r,l.InvalidParameter,a);if(i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return i[1]===null?null:U.clip(i[0],i[1])})},e.cut=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,2,r,a),!(i[1]instanceof oe)&&i[1]!==null)throw new d(r,l.InvalidParameter,a);if(i[0]===null)return[];if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return i[1]===null?[Se(i[0])]:U.cut(i[0],i[1])})},e.area=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),(i=Z(i))[0]===null)return 0;if(T(i[0])||R(i[0])){const s=Mn(i[0],r.spatialReference);return s===null?0:U.planarArea(s,Jt($(i[1],-1)))}if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.planarArea(i[0],Jt($(i[1],-1)))})},e.areageodetic=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),(i=Z(i))[0]===null)return 0;if(T(i[0])||R(i[0])){const s=Mn(i[0],r.spatialReference);return s===null?0:U.geodesicArea(s,Jt($(i[1],-1)))}if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.geodesicArea(i[0],Jt($(i[1],-1)))})},e.length=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),(i=Z(i))[0]===null)return 0;if(T(i[0])||R(i[0])){const s=kt(i[0],r.spatialReference);return s===null?0:U.planarLength(s,re($(i[1],-1)))}if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.planarLength(i[0],re($(i[1],-1)))})},e.length3d=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),(i=Z(i))[0]===null)return 0;if(T(i[0])||R(i[0])){const s=kt(i[0],r.spatialReference);return s===null?0:s.hasZ===!0?kr(s,re($(i[1],-1))):U.planarLength(s,re($(i[1],-1)))}if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return i[0].hasZ===!0?kr(i[0],re($(i[1],-1))):U.planarLength(i[0],re($(i[1],-1)))})},e.lengthgeodetic=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),(i=Z(i))[0]===null)return 0;if(T(i[0])||R(i[0])){const s=kt(i[0],r.spatialReference);return s===null?0:U.geodesicLength(s,re($(i[1],-1)))}if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.geodesicLength(i[0],re($(i[1],-1)))})},e.distance=function(r,a){return t(r,a,(u,o,i)=>{i=Z(i),D(i,2,3,r,a);let s=i[0];(T(i[0])||R(i[0]))&&(s=qt(i[0],r.spatialReference));let c=i[1];if((T(i[1])||R(i[1]))&&(c=qt(i[1],r.spatialReference)),!(s instanceof B))throw new d(r,l.InvalidParameter,a);if(!(c instanceof B))throw new d(r,l.InvalidParameter,a);return U.distance(s,c,re($(i[2],-1)))})},e.distancegeodetic=function(r,a){return t(r,a,(u,o,i)=>{i=Z(i),D(i,2,3,r,a);const s=i[0],c=i[1];if(!(s instanceof H))throw new d(r,l.InvalidParameter,a);if(!(c instanceof H))throw new d(r,l.InvalidParameter,a);const p=new oe({paths:[],spatialReference:s.spatialReference});return p.addPath([s,c]),U.geodesicLength(p,re($(i[2],-1)))})},e.densify=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,3,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);if(s<=0)throw new d(r,l.InvalidParameter,a);return i[0]instanceof ue||i[0]instanceof oe?U.densify(i[0],s,re($(i[2],-1))):i[0]instanceof ge?U.densify(Ir(i[0]),s,re($(i[2],-1))):i[0]})},e.densifygeodetic=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,3,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);if(s<=0)throw new d(r,l.InvalidParameter,a);return i[0]instanceof ue||i[0]instanceof oe?U.geodesicDensify(i[0],s,re($(i[2],-1))):i[0]instanceof ge?U.geodesicDensify(Ir(i[0]),s,re($(i[2],-1))):i[0]})},e.generalize=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,4,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);return U.generalize(i[0],s,ht($(i[2],!0)),re($(i[3],-1)))})},e.buffer=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,3,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);return s===0?Se(i[0]):U.buffer(i[0],s,re($(i[2],-1)))})},e.buffergeodetic=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,3,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);return s===0?Se(i[0]):U.geodesicBuffer(i[0],s,re($(i[2],-1)))})},e.offset=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,6,r,a),i[0]===null)return null;if(!(i[0]instanceof ue||i[0]instanceof oe))throw new d(r,l.InvalidParameter,a);const s=h(i[1]);if(isNaN(s))throw new d(r,l.InvalidParameter,a);const c=h($(i[4],10));if(isNaN(c))throw new d(r,l.InvalidParameter,a);const p=h($(i[5],0));if(isNaN(p))throw new d(r,l.InvalidParameter,a);return U.offset(i[0],s,re($(i[2],-1)),w($(i[3],"round")).toLowerCase(),c,p)})},e.rotate=function(r,a){return t(r,a,(u,o,i)=>{i=Z(i),D(i,2,3,r,a);let s=i[0];if(s===null)return null;if(!(s instanceof B))throw new d(r,l.InvalidParameter,a);s instanceof ge&&(s=ue.fromExtent(s));const c=h(i[1]);if(isNaN(c))throw new d(r,l.InvalidParameter,a);const p=$(i[2],null);if(p===null)return U.rotate(s,c);if(p instanceof H)return U.rotate(s,c,p);throw new d(r,l.InvalidParameter,a)})},e.centroid=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,1,1,r,a),i[0]===null)return null;let s=i[0];if((T(i[0])||R(i[0]))&&(s=qt(i[0],r.spatialReference)),s===null)return null;if(!(s instanceof B))throw new d(r,l.InvalidParameter,a);return s instanceof H?te(Se(i[0]),r.spatialReference):s instanceof ue?s.centroid:s instanceof oe?Ya(s):s instanceof be?Xa(s):s instanceof ge?s.center:null})},e.multiparttosinglepart=function(r,a){return t(r,a,(u,o,i)=>{i=Z(i),D(i,1,1,r,a);const s=[];if(i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);if(i[0]instanceof H)return[te(Se(i[0]),r.spatialReference)];if(i[0]instanceof ge)return[te(Se(i[0]),r.spatialReference)];const c=U.simplify(i[0]);if(c instanceof ue){const p=[],f=[];for(let m=0;m{if(i=Z(i),D(i,1,1,r,a),i[0]===null)return!0;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.isSimple(i[0])})},e.simplify=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,1,1,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.simplify(i[0])})},e.convexhull=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,1,1,r,a),i[0]===null)return null;if(!(i[0]instanceof B))throw new d(r,l.InvalidParameter,a);return U.convexHull(i[0])})},e.nearestcoordinate=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,2,r,a),!(i[0]instanceof B||i[0]===null))throw new d(r,l.InvalidParameter,a);if(!(i[1]instanceof H||i[1]===null))throw new d(r,l.InvalidParameter,a);if(i[0]===null||i[1]===null)return null;const s=U.nearestCoordinate(i[0],i[1]);return s===null||s.isEmpty?null:k.convertObjectToArcadeDictionary({coordinate:s.coordinate,distance:s.distance},_(r),!1,!0)})},e.nearestvertex=function(r,a){return t(r,a,(u,o,i)=>{if(i=Z(i),D(i,2,2,r,a),!(i[0]instanceof B||i[0]===null))throw new d(r,l.InvalidParameter,a);if(!(i[1]instanceof H||i[1]===null))throw new d(r,l.InvalidParameter,a);if(i[0]===null||i[1]===null)return null;const s=U.nearestVertex(i[0],i[1]);return s===null||s.isEmpty?null:k.convertObjectToArcadeDictionary({coordinate:s.coordinate,distance:s.distance},_(r),!1,!0)})}}function gn(e,t,n){return n===void 0||+n==0?Math[e](t):(t=+t,n=+n,isNaN(t)||typeof n!="number"||n%1!=0?NaN:(t=t.toString().split("e"),+((t=(t=Math[e](+(t[0]+"e"+(t[1]?+t[1]-n:-n)))).toString().split("e"))[0]+"e"+(t[1]?+t[1]+n:n))))}function _i(e,t){function n(r,a,u){const o=h(r);return isNaN(o)?o:isNaN(a)||isNaN(u)||a>u?NaN:ou?u:o}e.number=function(r,a){return t(r,a,(u,o,i)=>{D(i,1,2,r,a);const s=i[0];if(V(s))return s;if(s===null)return 0;if(q(s)||J(s)||P(s))return s.toNumber();if(z(s))return Number(s);if(T(s))return NaN;if(s===""||s===void 0)return Number(s);if(C(s)){if(i[1]!==void 0){let c=He(i[1],"‰","");return c=He(c,"¤",""),Yr(s,{pattern:c})}return Number(s.trim())}return Number(s)})},e.abs=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.abs(h(i[0]))))},e.acos=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.acos(h(i[0]))))},e.asin=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.asin(h(i[0]))))},e.atan=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.atan(h(i[0]))))},e.atan2=function(r,a){return t(r,a,(u,o,i)=>(D(i,2,2,r,a),Math.atan2(h(i[0]),h(i[1]))))},e.ceil=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),i.length===2){let s=h(i[1]);return isNaN(s)&&(s=0),gn("ceil",h(i[0]),-1*s)}return Math.ceil(h(i[0]))})},e.round=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),i.length===2){let s=h(i[1]);return isNaN(s)&&(s=0),gn("round",h(i[0]),-1*s)}return Math.round(h(i[0]))})},e.floor=function(r,a){return t(r,a,(u,o,i)=>{if(D(i,1,2,r,a),i.length===2){let s=h(i[1]);return isNaN(s)&&(s=0),gn("floor",h(i[0]),-1*s)}return Math.floor(h(i[0]))})},e.cos=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.cos(h(i[0]))))},e.isnan=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),typeof i[0]=="number"&&isNaN(i[0])))},e.exp=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.exp(h(i[0]))))},e.log=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.log(h(i[0]))))},e.pow=function(r,a){return t(r,a,(u,o,i)=>(D(i,2,2,r,a),h(i[0])**h(i[1])))},e.random=function(r,a){return t(r,a,(u,o,i)=>(D(i,0,0,r,a),Math.random()))},e.sin=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.sin(h(i[0]))))},e.sqrt=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.sqrt(h(i[0]))))},e.tan=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),Math.tan(h(i[0]))))},e.defaultvalue=function(r,a){return t(r,a,(u,o,i)=>(D(i,2,2,r,a),i[0]===null||i[0]===""||i[0]===void 0?i[1]:i[0]))},e.isempty=function(r,a){return t(r,a,(u,o,i)=>(D(i,1,1,r,a),i[0]===null||i[0]===""||i[0]===void 0))},e.boolean=function(r,a){return t(r,a,(u,o,i)=>{D(i,1,1,r,a);const s=i[0];return ht(s)})},e.constrain=function(r,a){return t(r,a,(u,o,i)=>{D(i,3,3,r,a);const s=h(i[1]),c=h(i[2]);if(T(i[0])){const p=[];for(const f of i[0])p.push(n(f,s,c));return p}if(R(i[0])){const p=[];for(let f=0;f=t&&t!==-1)return n}return n}function yn(e,t,n=1e3){switch(e.toLowerCase()){case"distinct":return uo(t,n);case"avg":case"mean":return Mi(We(t));case"min":return Math.min.apply(Math,We(t));case"sum":return oo(We(t));case"max":return Math.max.apply(Math,We(t));case"stdev":case"stddev":return Math.sqrt(Tr(We(t)));case"var":case"variance":return Tr(We(t));case"count":return t.length}return 0}function Ze(e,t,n,r){if(r.length===1){if(T(r[0]))return yn(e,r[0],-1);if(R(r[0]))return yn(e,r[0].toArray(),-1)}return yn(e,r,-1)}function $i(e,t){e.stdev=function(n,r){return t(n,r,(a,u,o)=>Ze("stdev",a,u,o))},e.variance=function(n,r){return t(n,r,(a,u,o)=>Ze("variance",a,u,o))},e.average=function(n,r){return t(n,r,(a,u,o)=>Ze("mean",a,u,o))},e.mean=function(n,r){return t(n,r,(a,u,o)=>Ze("mean",a,u,o))},e.sum=function(n,r){return t(n,r,(a,u,o)=>Ze("sum",a,u,o))},e.min=function(n,r){return t(n,r,(a,u,o)=>Ze("min",a,u,o))},e.max=function(n,r){return t(n,r,(a,u,o)=>Ze("max",a,u,o))},e.distinct=function(n,r){return t(n,r,(a,u,o)=>Ze("distinct",a,u,o))},e.count=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),T(o[0])||C(o[0]))return o[0].length;if(R(o[0]))return o[0].length();throw new d(n,l.InvalidParameter,r)})}}let Pn=class extends k{constructor(t){super(),this.declaredClass="esri.arcade.Portal",this.immutable=!1,this.setField("url",t),this.immutable=!0}},so=class Li extends k{constructor(t,n,r,a,u,o,i){super(),this.attachmentUrl=u,this.declaredClass="esri.arcade.Attachment",this.immutable=!1,this.setField("id",t),this.setField("name",n),this.setField("contenttype",r),this.setField("size",a),this.setField("exifinfo",o),this.setField("keywords",i),this.immutable=!0}deepClone(){var t;return new Li(this.field("id"),this.field("name"),this.field("contenttype"),this.field("size"),this.attachmentUrl,((t=this.field("exifinfo"))==null?void 0:t.deepClone())??null,this.field("keywords"))}};const or=e=>(t,n,r)=>(r=r||14,+e(t,n).toFixed(r)),lo=(e,t)=>e+t,co=(e,t)=>e*t,fo=(e,t)=>e/t,Br=(e,t,n)=>or(lo)(e,t,n),ct=(e,t,n)=>or(co)(e,t,n),Qt=(e,t,n)=>or(fo)(e,t,n),en=360,ho=400,mo=2*Math.PI,ve=3600,Nr=3240,Bt=60,je=60,_r=180*ve/Math.PI,St=en*Bt*je,wn=90*ve,at=180*ve,po=270*ve,Oi="ᵍ",vt="°";function At(e){if(C(e)===!1)throw new d(null,l.InvalidParameter,null);return e}function Rn(e,t){const n=10**t;return Math.round(e*n)/n}function Do(e,t){return e%t}function ot(e){const t=parseFloat(e.toString().replace(Math.trunc(e).toString(),"0"))*Math.sign(e);return e<0?{fraction:t,integer:Math.ceil(e)}:{fraction:t,integer:Math.floor(e)}}var Y,y,j,Un;function lt(e,t){switch(e){case Y.north:return t==="SHORT"?"N":"North";case Y.east:return t==="SHORT"?"E":"East";case Y.south:return t==="SHORT"?"S":"South";case Y.west:return t==="SHORT"?"W":"West"}}function xn(e,t){return e-Math.floor(e/t)*t}function Fn(e){switch(e){case y.truncated_degrees:case y.decimal_degrees:return en;case y.radians:return mo;case y.gradians:return ho;case y.seconds:return St;case y.fractional_degree_minutes:return Bt;case y.fractional_minute_seconds:return je;default:throw new d(null,l.LogicError,null,{reason:"unsupported evaluations"})}}function Mr(e){switch(e.toUpperCase().trim()){case"NORTH":case"NORTHAZIMUTH":case"NORTH AZIMUTH":return j.north_azimuth;case"POLAR":return j.polar;case"QUADRANT":return j.quadrant;case"SOUTH":case"SOUTHAZIMUTH":case"SOUTH AZIMUTH":return j.south_azimuth}throw new d(null,l.LogicError,null,{reason:"unsupported directionType"})}function $r(e){switch(e.toUpperCase().trim()){case"D":case"DD":case"DECIMALDEGREE":case"DECIMAL DEGREE":case"DEGREE":case"DECIMALDEGREES":case"DECIMAL DEGREES":case"DEGREES":return y.decimal_degrees;case"DMS":case"DEGREESMINUTESSECONDS":case"DEGREES MINUTES SECONDS":return y.degrees_minutes_seconds;case"R":case"RAD":case"RADS":case"RADIAN":case"RADIANS":return y.radians;case"G":case"GON":case"GONS":case"GRAD":case"GRADS":case"GRADIAN":case"GRADIANS":return y.gradians}throw new d(null,l.LogicError,null,{reason:"unsupported units"})}(function(e){e[e.north=0]="north",e[e.east=1]="east",e[e.south=2]="south",e[e.west=3]="west"})(Y||(Y={})),function(e){e[e.decimal_degrees=1]="decimal_degrees",e[e.seconds=2]="seconds",e[e.degrees_minutes_seconds=3]="degrees_minutes_seconds",e[e.radians=4]="radians",e[e.gradians=5]="gradians",e[e.truncated_degrees=6]="truncated_degrees",e[e.fractional_degree_minutes=7]="fractional_degree_minutes",e[e.fractional_minute_seconds=8]="fractional_minute_seconds"}(y||(y={})),function(e){e[e.north_azimuth=1]="north_azimuth",e[e.polar=2]="polar",e[e.quadrant=3]="quadrant",e[e.south_azimuth=4]="south_azimuth"}(j||(j={})),function(e){e[e.meridian=0]="meridian",e[e.direction=1]="direction"}(Un||(Un={}));let pt=class Kt{constructor(t,n,r){this.m_degrees=t,this.m_minutes=n,this.m_seconds=r}getField(t){switch(t){case y.decimal_degrees:case y.truncated_degrees:return this.m_degrees;case y.fractional_degree_minutes:return this.m_minutes;case y.seconds:case y.fractional_minute_seconds:return this.m_seconds;default:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"})}}static secondsToDMS(t){const n=ot(t).fraction;let r=ot(t).integer;const a=Math.floor(r/ve);r-=a*ve;const u=Math.floor(r/je);return r-=u*je,new Kt(a,u,r+n)}static numberToDms(t){const n=ot(t).fraction,r=ot(t).integer,a=ct(ot(100*n).fraction,100),u=ot(100*n).integer;return new Kt(r,u,a)}format(t,n){let r=Rn(this.m_seconds,n),a=this.m_minutes,u=this.m_degrees;if(t===y.seconds||t===y.fractional_minute_seconds)je<=r&&(r-=je,++a),Bt<=a&&(a=0,++u),en<=u&&(u=0);else if(t===y.fractional_degree_minutes)r=0,a=30<=this.m_seconds?this.m_minutes+1:this.m_minutes,u=this.m_degrees,Bt<=a&&(a=0,++u),en<=u&&(u=0);else if(t===y.decimal_degrees||t===y.truncated_degrees){const o=Qt(this.m_seconds,ve),i=Qt(this.m_minutes,Bt);u=Math.round(this.m_degrees+i+o),a=0,r=0}return new Kt(u,a,r)}static dmsToSeconds(t,n,r){return t*ve+n*je+r}},go=class{constructor(t,n,r){this.meridian=t,this.angle=n,this.direction=r}fetchAzimuth(t){return t===Un.meridian?this.meridian:this.direction}},Je=class Re{constructor(t){this._angle=t}static createFromAngleAndDirection(t,n){return new Re(new Ne(Re._convertDirectionFormat(t.extractAngularUnits(y.seconds),n,j.north_azimuth)))}getAngle(t){const n=this._angle.extractAngularUnits(y.seconds);switch(t){case j.north_azimuth:case j.south_azimuth:case j.polar:return new Ne(Re._convertDirectionFormat(n,j.north_azimuth,t));case j.quadrant:{const r=Re.secondsNorthAzimuthToQuadrant(n);return new Ne(r.angle)}}}getMeridian(t){const n=this._angle.extractAngularUnits(y.seconds);switch(t){case j.north_azimuth:return Y.north;case j.south_azimuth:return Y.south;case j.polar:return Y.east;case j.quadrant:return Re.secondsNorthAzimuthToQuadrant(n).meridian}}getDirection(t){const n=this._angle.extractAngularUnits(y.seconds);switch(t){case j.north_azimuth:return Y.east;case j.south_azimuth:return Y.west;case j.polar:return Y.north;case j.quadrant:return Re.secondsNorthAzimuthToQuadrant(n).direction}}static secondsNorthAzimuthToQuadrant(t){const n=t<=wn||t>=po?Y.north:Y.south,r=n===Y.north?Math.min(St-t,t):Math.abs(t-at),a=t>at?Y.west:Y.east;return new go(n,r,a)}static createFromAngleMeridianAndDirection(t,n,r){return new Re(new Ne(Re.secondsQuadrantToNorthAzimuth(t.extractAngularUnits(y.seconds),n,r)))}static secondsQuadrantToNorthAzimuth(t,n,r){return n===Y.north?r===Y.east?t:St-t:r===Y.east?at-t:at+t}static _convertDirectionFormat(t,n,r){let a=0;switch(n){case j.north_azimuth:a=t;break;case j.polar:a=wn-t;break;case j.quadrant:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"});case j.south_azimuth:a=t+at}let u=0;switch(r){case j.north_azimuth:u=a;break;case j.polar:u=wn-a;break;case j.quadrant:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"});case j.south_azimuth:u=a-at}return u=Do(u,St),u<0?St+u:u}};function Lr(e,t,n){let r=null;switch(t){case y.decimal_degrees:r=ct(e,ve);break;case y.seconds:r=e;break;case y.gradians:r=ct(e,Nr);break;case y.radians:r=ct(e,_r);break;default:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"})}switch(n){case y.decimal_degrees:return Qt(r,ve);case y.seconds:return r;case y.gradians:return Qt(r,Nr);case y.radians:return r/_r;default:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"})}}let Ne=class zn{constructor(t){this._seconds=t}static createFromAngleAndUnits(t,n){return new zn(Lr(t,n,y.seconds))}extractAngularUnits(t){return Lr(this._seconds,y.seconds,Lt(t))}static createFromDegreesMinutesSeconds(t,n,r){return new zn(Br(Br(ct(t,ve),ct(n,je)),r))}};function Lt(e){switch(ti(e),e){case y.decimal_degrees:case y.truncated_degrees:case y.degrees_minutes_seconds:return y.decimal_degrees;case y.gradians:return y.gradians;case y.fractional_degree_minutes:return y.fractional_degree_minutes;case y.radians:return y.radians;case y.seconds:case y.fractional_minute_seconds:return y.seconds}}let yo=class Pi{constructor(t,n,r,a){this.view=t,this.angle=n,this.merdian=r,this.direction=a,this._dms=null,this._formattedDms=null}static createFromStringAndBearing(t,n,r){return new Pi(t,n.getAngle(r),n.getMeridian(r),n.getDirection(r))}fetchAngle(){return this.angle}fetchMeridian(){return this.merdian}fetchDirection(){return this.direction}fetchView(){return this.view}fetchDms(){return this._dms===null&&this._calculateDms(),this._dms}fetchFormattedDms(){return this._formattedDms===null&&this._calculateDms(),this._formattedDms}_calculateDms(){let t=null,n=y.truncated_degrees,r=0;for(let a=0;a0?1:0),"0");case y.truncated_degrees:case y.fractional_degree_minutes:return u=xn(a.fetchFormattedDms().getField(t),Fn(t)),u.toFixed(r).padStart(n+r+(r>0?1:0),"0");case y.fractional_minute_seconds:return u=xn(Rn(a.fetchDms().getField(t),r),Fn(t)),u.toFixed(r).padStart(n+r+(r>0?1:0),"0");default:throw new d(null,l.LogicError,null,{reason:"unexpected evaluation"})}}function xo(e,t,n){if(n===j.quadrant)throw new d(null,l.LogicError,null,{reason:"conversion error"});if(t===y.degrees_minutes_seconds){const r=pt.numberToDms(e);return Je.createFromAngleAndDirection(Ne.createFromDegreesMinutesSeconds(r.m_degrees,r.m_minutes,r.m_seconds),n)}return Je.createFromAngleAndDirection(Ne.createFromAngleAndUnits(e,Lt(t)),n)}function Fo(e){switch(h(e)){case 1:return{first:Y.north,second:Y.east};case 2:return{first:Y.south,second:Y.east};case 3:return{first:Y.south,second:Y.west};case 4:return{first:Y.north,second:Y.west}}return null}function Or(e){switch(e.toUpperCase().trim()){case"N":case"NORTH":return Y.north;case"E":case"EAST":return Y.east;case"S":case"SOUTH":return Y.south;case"W":case"WEST":return Y.west}return null}function ut(e){const t=parseFloat(e);if(V(t)){if(isNaN(t))throw new d(null,l.LogicError,null,{reason:"invalid conversion"});return t}throw new d(null,l.LogicError,null,{reason:"invalid conversion"})}function Cn(e,t,n){const r=n===j.quadrant;let a=null,u=null,o=0,i=0,s=0;if(r){if(e.length<2)throw new d(null,l.LogicError,null,{reason:"conversion error"});s=1;const c=Fo(w(e[e.length-1]));if(c?(a=c.first,u=c.second):(o=1,a=Or(w(e[0])),u=Or(w(e[e.length-1]))),a===null||u===null)throw new d(null,l.LogicError,null,{reason:"invalid conversion"})}switch(t){case y.decimal_degrees:case y.radians:case y.gradians:if(e.length===0)throw new d(null,l.LogicError,null,{reason:"invalid conversion"});return r?Je.createFromAngleMeridianAndDirection(Ne.createFromAngleAndUnits(ut(e[o]),Lt(t)),a,u):Je.createFromAngleAndDirection(Ne.createFromAngleAndUnits(ut(e[o]),Lt(t)),n);case y.degrees_minutes_seconds:if(i=e.length-s-o,i===3){const c=Ne.createFromDegreesMinutesSeconds(ut(e[o]),ut(e[o+1]),ut(e[o+2]));return r?Je.createFromAngleMeridianAndDirection(c,a,u):Je.createFromAngleAndDirection(c,n)}if(i===1){const c=ut(e[o]),p=pt.numberToDms(c),f=Ne.createFromDegreesMinutesSeconds(p.m_degrees,p.m_minutes,p.m_seconds);return r?Je.createFromAngleMeridianAndDirection(f,a,u):Je.createFromAngleAndDirection(f,n)}}throw new d(null,l.LogicError,null,{reason:"invalid conversion"})}function Co(e){const t=new Set([" ","-","/","'",'"',"\\","^",vt,Oi," ","\r",` +`,"*"]);let n="";for(let r=0;rr!=="")}function Ao(e,t,n){if(V(e))return xo(h(e),t,n);if(C(e))return Cn(Co(e),t,n);if(T(e))return Cn(e,t,n);if(R(e))return Cn(e.toArray(),t,n);throw new d(null,l.LogicError,null,{reason:"conversion error"})}function bo(e,t,n){const r=Lt(n);if(r&&n!==y.degrees_minutes_seconds)return e.getAngle(t).extractAngularUnits(r);throw new d(null,l.LogicError,null,{reason:"conversion error"})}function Eo(e,t,n){const r=e.getAngle(t);if(t===j.quadrant&&n===y.degrees_minutes_seconds){const a=pt.secondsToDMS(r.extractAngularUnits(y.seconds));return[lt(e.getMeridian(t),"SHORT"),a.m_degrees,a.m_minutes,a.m_seconds,lt(e.getDirection(t),"SHORT")]}if(n===y.degrees_minutes_seconds){const a=pt.secondsToDMS(r.extractAngularUnits(y.seconds));return[a.m_degrees,a.m_minutes,a.m_seconds]}return t===j.quadrant?[lt(e.getMeridian(t),"SHORT"),r.extractAngularUnits(n),lt(e.getDirection(t),"SHORT")]:[r.extractAngularUnits(n)]}function So(e,t){let n="";switch(e){case y.decimal_degrees:n=t===j.quadrant?"DD.DD"+vt:"DDD.DD"+vt;break;case y.degrees_minutes_seconds:n=t===j.quadrant?"dd"+vt+` mm' ss"`:"ddd"+vt+` mm' ss.ss"`;break;case y.radians:n="R.RR";break;case y.gradians:n="GGG.GG"+Oi;break;default:throw new d(null,l.LogicError,null,{reason:"conversion error"})}return t===j.quadrant&&(n="p "+n+" b"),n}function Gn(e,t,n){const r={padding:0,rounding:0,newpos:t};let a=!1;for(;t(D(o,1,1,n,r),new Pn(w(o[0]))))},e.typeof=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=Qn(o[0]);if(i==="Unrecognized Type")throw new d(n,l.UnrecognizedType,r);return i})},e.trim=function(n,r){return t(n,r,(a,u,o)=>(D(o,1,1,n,r),w(o[0]).trim()))},e.tohex=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=h(o[0]);return isNaN(i)?i:i.toString(16)})},e.upper=function(n,r){return t(n,r,(a,u,o)=>(D(o,1,1,n,r),w(o[0]).toUpperCase()))},e.proper=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,2,n,r);let i=1;o.length===2&&w(o[1]).toLowerCase()==="firstword"&&(i=2);const s=/\s/,c=w(o[0]);let p="",f=!0;for(let m=0;m(D(o,1,1,n,r),w(o[0]).toLowerCase()))},e.guid=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,0,1,n,r),o.length>0)switch(w(o[0]).toLowerCase()){case"digits":return st().replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return st();case"digits-hyphen-braces":return"{"+st()+"}";case"digits-hyphen-parentheses":return"("+st()+")"}return"{"+st()+"}"})},e.standardizeguid=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,2,n,r);let i=w(o[0]);if(i===""||i===null)return"";const s=/^(\{|\()?(?[0-9a-z]{8})(\-?)(?[0-9a-z]{4})(\-?)(?[0-9a-z]{4})(\-?)(?[0-9a-z]{4})(\-?)(?[0-9a-z]{12})(\}|\))?$/gim.exec(i);if(!s)return"";const c=s.groups;switch(i=c.partA+"-"+c.partB+"-"+c.partC+"-"+c.partD+"-"+c.partE,w(o[1]).toLowerCase()){case"digits":return i.replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return i;case"digits-hyphen-braces":return"{"+i+"}";case"digits-hyphen-parentheses":return"("+i+")"}return"{"+i+"}"})},e.console=function(n,r){return t(n,r,(a,u,o)=>(o.length===0||(o.length===1?n.console(w(o[0])):n.console(w(o))),A))},e.mid=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,3,n,r);let i=h(o[1]);if(isNaN(i))return"";if(i<0&&(i=0),o.length===2)return w(o[0]).substr(i);let s=h(o[2]);return isNaN(s)?"":(s<0&&(s=0),w(o[0]).substr(i,s))})},e.find=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,3,n,r);let i=0;if(o.length>2){if(i=h($(o[2],0)),isNaN(i))return-1;i<0&&(i=0)}return w(o[1]).indexOf(w(o[0]),i)})},e.left=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,2,n,r);let i=h(o[1]);return isNaN(i)?"":(i<0&&(i=0),w(o[0]).substr(0,i))})},e.right=function(n,r){return t(n,r,(a,u,o)=>{D(o,2,2,n,r);let i=h(o[1]);return isNaN(i)?"":(i<0&&(i=0),w(o[0]).substr(-1*i,i))})},e.split=function(n,r){return t(n,r,(a,u,o)=>{let i;D(o,2,4,n,r);let s=h($(o[2],-1));const c=ht($(o[3],!1));if(s===-1||s===null||c===!0?i=w(o[0]).split(w(o[1])):(isNaN(s)&&(s=-1),s<-1&&(s=-1),i=w(o[0]).split(w(o[1]),s)),c===!1)return i;const p=[];for(let f=0;f=s);f++)i[f]!==""&&i[f]!==void 0&&p.push(i[f]);return p})},e.text=function(n,r){return t(n,r,(a,u,o)=>(D(o,1,2,n,r),we(o[0],o[1])))},e.concatenate=function(n,r){return t(n,r,(a,u,o)=>{const i=[];if(o.length<1)return"";if(T(o[0])){const s=$(o[2],"");for(let c=0;c1?i.join(o[1]):i.join("")}if(R(o[0])){const s=$(o[2],"");for(let c=0;c1?i.join(o[1]):i.join("")}for(let s=0;s{if(D(o,1,1,n,r),T(o[0])){const i=o[0].slice(0);return i.reverse(),i}if(R(o[0])){const i=o[0].toArray().slice(0);return i.reverse(),i}throw new d(n,l.InvalidParameter,r)})},e.replace=function(n,r){return t(n,r,(a,u,o)=>{D(o,3,4,n,r);const i=w(o[0]),s=w(o[1]),c=w(o[2]);return o.length!==4||ht(o[3])?He(i,s,c):i.replace(s,c)})},e.schema=function(n,r){return t(n,r,(a,u,o)=>{if(ee(o[0])){const i=xi(o[0]);return i?k.convertObjectToArcadeDictionary(i,_(n)):null}throw new d(n,l.InvalidParameter,r)})},e.subtypes=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),ee(o[0])){const i=jt(o[0]);return i?k.convertObjectToArcadeDictionary(i,_(n)):null}throw new d(n,l.InvalidParameter,r)})},e.subtypecode=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),ee(o[0])){const i=jt(o[0]);if(!i)return null;if(i.subtypeField&&o[0].hasField(i.subtypeField)){const s=o[0].field(i.subtypeField);for(const c of i.subtypes)if(c.code===s)return c.code;return null}return null}throw new d(n,l.InvalidParameter,r)})},e.subtypename=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),ee(o[0])){const i=jt(o[0]);if(!i)return"";if(i.subtypeField&&o[0].hasField(i.subtypeField)){const s=o[0].field(i.subtypeField);for(const c of i.subtypes)if(c.code===s)return c.name;return""}return""}throw new d(n,l.InvalidParameter,r)})},e.gdbversion=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),ee(o[0]))return o[0].gdbVersion();throw new d(n,l.InvalidParameter,r)})},e.domain=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,3,n,r),ee(o[0])){const i=gi(o[0],w(o[1]),o[2]===void 0?void 0:o[2]);return i&&i.domain?i.domain.type==="coded-value"||i.domain.type==="codedValue"?k.convertObjectToArcadeDictionary({type:"codedValue",name:i.domain.name,dataType:Cr[i.field.type],codedValues:i.domain.codedValues.map(s=>({name:s.name,code:s.code}))},_(n)):k.convertObjectToArcadeDictionary({type:"range",name:i.domain.name,dataType:Cr[i.field.type],min:i.domain.min,max:i.domain.max},_(n)):null}throw new d(n,l.InvalidParameter,r)})},e.domainname=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,4,n,r),ee(o[0]))return yi(o[0],w(o[1]),o[2],o[3]===void 0?void 0:o[3]);throw new d(n,l.InvalidParameter,r)})},e.domaincode=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,2,4,n,r),ee(o[0]))return wi(o[0],w(o[1]),o[2],o[3]===void 0?void 0:o[3]);throw new d(n,l.InvalidParameter,r)})},e.urlencode=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),o[0]===null)return"";if(o[0]instanceof k){let i="";for(const s of o[0].keys()){const c=o[0].field(s);i!==""&&(i+="&"),i+=c===null?encodeURIComponent(s)+"=":encodeURIComponent(s)+"="+encodeURIComponent(c)}return i}return encodeURIComponent(w(o[0]))})},e.hash=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,1,n,r);const i=new Sa(0);return Ce(o[0],i,{context:n,node:r,map:new Map,currentLength:0}),i.digest()})},e.convertdirection=function(n,r){return t(n,r,(a,u,o)=>(D(o,3,3,n,r),ko(o[0],o[1],o[2])))},e.fromjson=function(n,r){return t(n,r,(a,u,o)=>{if(D(o,1,1,n,r),C(o[0])===!1)throw new d(n,l.InvalidParameter,r);return k.convertJsonToArcade(JSON.parse(w(o[0])),_(n))})},e.expects=function(n,r){return t(n,r,(a,u,o)=>{if(o.length<1)throw new d(n,l.WrongNumberOfParameters,r);return A})},e.tocharcode=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,2,n,r);const i=h($(o[1],0)),s=w(o[0]);if(s.length===0&&o.length===1)return null;if(s.length<=i||i<0)throw new d(n,l.OutOfBounds,r);return s.charCodeAt(i)})},e.tocodepoint=function(n,r){return t(n,r,(a,u,o)=>{D(o,1,2,n,r);const i=h($(o[1],0)),s=w(o[0]);if(s.length===0&&o.length===1)return null;if(s.length<=i||i<0)throw new d(n,l.OutOfBounds,r);return s.codePointAt(i)})},e.fromcharcode=function(n,r){return t(n,r,(a,u,o)=>{if(o.length<1)throw new d(n,l.WrongNumberOfParameters,r);const i=o.map(s=>Math.trunc(h(s))).filter(s=>s>=0&&s<=65535);return i.length===0?null:String.fromCharCode.apply(null,i)})},e.fromcodepoint=function(n,r){return t(n,r,(a,u,o)=>{if(o.length<1)throw new d(n,l.WrongNumberOfParameters,r);let i;try{i=o.map(s=>Math.trunc(h(s))).filter(s=>s<=1114111&&s>>>0===s)}catch{return null}return i.length===0?null:String.fromCodePoint.apply(null,i)})},e.getuser=function(n,r){return t(n,r,(a,u,o)=>{var s;D(o,0,2,n,r);let i=$(o[1],"");if(i=i===!0||i===!1?"":w(i),i!==null&&i!=="")return null;if(o.length===0||o[0]instanceof Pn){let c=null;if(c=(s=n.services)!=null&&s.portal?n.services.portal:Wn.getDefault(),o.length>0&&!Bo(o[0].field("url"),c)||!c)return null;if(i===""){const p=To(c);if(p){const f=JSON.parse(JSON.stringify(p));for(const m of["lastLogin","created","modified"])f[m]!==void 0&&f[m]!==null&&(f[m]=new Date(f[m]));return k.convertObjectToArcadeDictionary(f,_(n))}}return null}throw new d(n,l.InvalidParameter,r)})},e.getenvironment=function(n,r){return t(n,r,(a,u,o)=>(D(o,0,0,n,r),k.convertObjectToArcadeDictionary(Fi(_(n),n.spatialReference),_(n),!0)))}}let No=class extends tt{constructor(t,n){super(),this.paramCount=n,this.fn=t}createFunction(t){return(...n)=>{if(n.length!==this.paramCount)throw new d(t,l.WrongNumberOfParameters,null);return this.fn(...n)}}call(t,n){return this.fn(...n.arguments)}marshalledCall(t,n,r,a){return a(t,n,(u,o,i)=>{i=i.map(c=>!X(c)||c instanceof ze?c:dt(c,t,a));const s=this.call(r,{arguments:i});return Ve(s)?s.then(c=>dt(c,r,a)):s})}};function Ae(e,t,n){try{return n(e,null,t.arguments)}catch(r){throw r}}function S(e,t){try{switch(t.type){case"EmptyStatement":return"lc.voidOperation";case"VariableDeclarator":return qo(e,t);case"VariableDeclaration":return Vo(e,t);case"BlockStatement":case"Program":return Zn(e,t);case"FunctionDeclaration":return Jo(e,t);case"ImportDeclaration":return Go(e,t);case"ExportNamedDeclaration":return Zo(e,t);case"ReturnStatement":return zo(e,t);case"IfStatement":return Ui(e,t);case"ExpressionStatement":return Uo(e,t);case"AssignmentExpression":return Ro(e,t);case"UpdateExpression":return Oo(e,t);case"BreakStatement":return"break";case"ContinueStatement":return"continue";case"TemplateLiteral":return Wo(e,t);case"TemplateElement":return JSON.stringify(t.value?t.value.cooked:"");case"ForStatement":return Lo(e,t);case"ForInStatement":return $o(e,t);case"WhileStatement":return Po(e,t);case"Identifier":return Qo(e,t);case"MemberExpression":return jo(e,t);case"Literal":return t.value===null||t.value===void 0?"null":JSON.stringify(t.value);case"CallExpression":return eu(e,t);case"UnaryExpression":return Ho(e,t);case"BinaryExpression":return Yo(e,t);case"LogicalExpression":return Xo(e,t);case"ArrayExpression":return Ko(e,t);case"ObjectExpression":return _o(e,t);case"Property":return Mo(e,t);case"Array":throw new le(e,l.NeverReach,t);default:throw new le(e,l.Unrecognized,t)}}catch(n){throw n}}function _o(e,t){let n="lang.dictionary([";for(let r=0;r0&&(n+=","),n+="lang.strCheck("+(a.key.type==="Identifier"?"'"+a.key.name+"'":S(e,a.key))+",'ObjectExpression'),lang.aCheck("+S(e,a.value)+", 'ObjectExpression')"}return n+="])",n}function Mo(e,t){throw new le(e,l.NeverReach,t)}function $o(e,t){const n=_e(e),r=_e(e),a=_e(e);let u="var "+n+" = "+S(e,t.right)+`; `;t.left.type==="VariableDeclaration"&&(u+=S(e,t.left));let o=t.left.type==="VariableDeclaration"?t.left.declarations[0].id.name:t.left.name;o=o.toLowerCase(),xe(o);let i="";e.localScope!==null&&(e.localScope[o]!==void 0?i="lscope['"+o+"']":e.localScope._SymbolsMap[o]!==void 0&&(i="lscope['"+e.localScope._SymbolsMap[o]+"']"));let s="";if(i===""){if(e.globalScope[o]!==void 0)i="gscope['"+o+"']";else if(e.globalScope._SymbolsMap[o]!==void 0)i="gscope['"+e.globalScope._SymbolsMap[o]+"']";else if(e.localScope!==null)if(e.undeclaredGlobalsInFunctions.has(o))i="gscope['"+e.undeclaredGlobalsInFunctions.get(o).manglename+"']",s=e.undeclaredGlobalsInFunctions.get(o).manglename;else{const c={manglename:Te(e),node:t.left};e.undeclaredGlobalsInFunctions.set(o,c),i="gscope['"+c.manglename+"']",s=c.manglename}}return s&&(u+="lang.chkAssig('"+s+`',runtimeCtx); `),u+="if ("+n+`===null) { lastStatement = lc.voidOperation; } `,u+="else if (lc.isArray("+n+") || lc.isString("+n+")) {",u+="var "+r+"="+n+`.length; @@ -82,10 +82,10 @@ import{c_ as Hn,fx as qe,T as H,dw as ga,mA as Qe,dT as ge,l as ue,N as oe,hq as `):(o+=Zn(u,t.body)+` return lastStatement; }, runtimeCtx),`+t.params.length+")",o+=` lastStatement = lc.voidOperation; -`),a?"gscope[lang.setAssig('"+r+"', runtimeCtx)]="+o:"gscope['"+r+"']="+o}function qo(e,t){const n=[];for(let r=0;r0&&(u+=", "),u+=S(e,t.arguments[o]);return u+="]",e.isAsync?"(yield lang.callModuleFunction("+S(e,t.callee.object)+","+u+","+a+",runtimeCtx))":"lang.callModuleFunction("+S(e,t.callee.object)+","+u+","+a+",runtimeCtx)"}if(t.callee.type!=="Identifier")throw new le(e,l.FunctionNotFound,t);const n=t.callee.name.toLowerCase();if(n==="iif")return tu(e,t);if(n==="when")return nu(e,t);if(n==="decode")return ru(e,t);let r="";if(e.localScope!==null&&(e.localScope[n]!==void 0?r="lscope['"+n+"']":e.localScope._SymbolsMap[n]!==void 0&&(r="lscope['"+e.localScope._SymbolsMap[n]+"']")),r===""){if(e.globalScope[n]!==void 0)r="gscope['"+n+"']";else if(e.globalScope._SymbolsMap[n]!==void 0)r="gscope['"+e.globalScope._SymbolsMap[n]+"']";else if(e.localScope!==null)if(e.undeclaredGlobalsInFunctions.has(n))r="gscope[lang.chkAssig('"+e.undeclaredGlobalsInFunctions.get(n).manglename+"',runtimeCtx)]";else{const a={manglename:Te(e),node:t.argument};e.undeclaredGlobalsInFunctions.set(n,a),r="gscope[lang.chkAssig('"+a.manglename+"',runtimeCtx)]"}}if(r!==""){let a="[";for(let u=0;u0&&(a+=", "),a+=S(e,t.arguments[u]);return a+="]",e.isAsync?"(yield lang.callfunc("+r+","+a+",runtimeCtx) )":"lang.callfunc("+r+","+a+",runtimeCtx)"}throw new le(e,l.FunctionNotFound,t)}catch(n){throw n}}function tu(e,t){try{if(t.arguments.length!==3)throw new le(e,l.WrongNumberOfParameters,t);const n=_e(e);return`${e.isAsync?`(yield (function() { +`}function qo(e,t){let n=t.init===null?null:S(e,t.init);n===A&&(n=null);const r=t.id.name.toLowerCase();if(xe(r),e.localScope!==null){if(e.localScope[r]!==void 0)return"lscope['"+r+"']="+n+"; ";if(e.localScope._SymbolsMap[r]!==void 0)return"lscope['"+e.localScope._SymbolsMap[r]+"']="+n+"; ";{const u=Te(e);return e.localScope._SymbolsMap[r]=u,e.mangleMap[r]=u,"lscope['"+u+"']="+n+"; "}}if(e.globalScope[r]!==void 0)return"gscope['"+r+"']="+n+"; ";if(e.globalScope._SymbolsMap[r]!==void 0)return"gscope['"+e.globalScope._SymbolsMap[r]+"']="+n+"; ";if(e.undeclaredGlobalsInFunctions.has(r)){const u=e.undeclaredGlobalsInFunctions.get(r).manglename;return e.globalScope._SymbolsMap[r]=u,e.mangleMap[r]=u,e.undeclaredGlobalsInFunctions.delete(r),"gscope[lang.setAssig('"+u+"', runtimeCtx)]="+n+"; "}const a=Te(e);return e.globalScope._SymbolsMap[r]=a,e.mangleMap[r]=a,"gscope['"+a+"']="+n+"; "}function jo(e,t){try{let n;return t.computed===!0?n=S(e,t.property):(n="'"+t.property.name+"'",xe(t.property.name)),"lang.member("+S(e,t.object)+","+n+")"}catch(n){throw n}}function Ho(e,t){try{return"lang.unary("+S(e,t.argument)+",'"+t.operator+"')"}catch(n){throw n}}function Ko(e,t){try{const n=[];for(let r=0;r0&&(u+=", "),u+=S(e,t.arguments[o]);return u+="]",e.isAsync?"(yield lang.callModuleFunction("+S(e,t.callee.object)+","+u+","+a+",runtimeCtx))":"lang.callModuleFunction("+S(e,t.callee.object)+","+u+","+a+",runtimeCtx)"}if(t.callee.type!=="Identifier")throw new le(e,l.FunctionNotFound,t);const n=t.callee.name.toLowerCase();if(n==="iif")return tu(e,t);if(n==="when")return nu(e,t);if(n==="decode")return ru(e,t);let r="";if(e.localScope!==null&&(e.localScope[n]!==void 0?r="lscope['"+n+"']":e.localScope._SymbolsMap[n]!==void 0&&(r="lscope['"+e.localScope._SymbolsMap[n]+"']")),r===""){if(e.globalScope[n]!==void 0)r="gscope['"+n+"']";else if(e.globalScope._SymbolsMap[n]!==void 0)r="gscope['"+e.globalScope._SymbolsMap[n]+"']";else if(e.localScope!==null)if(e.undeclaredGlobalsInFunctions.has(n))r="gscope[lang.chkAssig('"+e.undeclaredGlobalsInFunctions.get(n).manglename+"',runtimeCtx)]";else{const a={manglename:Te(e),node:t.argument};e.undeclaredGlobalsInFunctions.set(n,a),r="gscope[lang.chkAssig('"+a.manglename+"',runtimeCtx)]"}}if(r!==""){let a="[";for(let u=0;u0&&(a+=", "),a+=S(e,t.arguments[u]);return a+="]",e.isAsync?"(yield lang.callfunc("+r+","+a+",runtimeCtx) )":"lang.callfunc("+r+","+a+",runtimeCtx)"}throw new le(e,l.FunctionNotFound,t)}catch(n){throw n}}function tu(e,t){try{if(t.arguments.length!==3)throw new le(e,l.WrongNumberOfParameters,t);const n=_e(e);return`${e.isAsync?`(yield (function() { return lang.__awaiter(this, void 0, void 0, function* () {`:"function() {"} var ${n} = ${S(e,t.arguments[0])}; @@ -116,7 +116,7 @@ import{c_ as Hn,fx as qe,T as H,dw as ga,mA as Qe,dT as ge,l as ue,N as oe,hq as ${a} return ${S(e,t.arguments[t.arguments.length-1])} ${e.isAsync?"})}()))":"}()"}`}catch(n){throw n}}const ne={};function Te(e){return e.symbols.symbolCounter++,"_T"+e.symbols.symbolCounter.toString()}function _e(e){return e.symbols.symbolCounter++,"_Tvar"+e.symbols.symbolCounter.toString()}vi(ne,Ae),Ri(ne,Ae),_i(ne,Ae),Bi(ne,Ae),$i(ne,Ae),ne.iif=function(e,t){try{return Ae(e,t,(n,r,a)=>{throw new d(e,l.Unrecognized,t)})}catch(n){throw n}},ne.decode=function(e,t){try{return Ae(e,t,(n,r,a)=>{throw new d(e,l.Unrecognized,t)})}catch(n){throw n}},ne.when=function(e,t){try{return Ae(e,t,(n,r,a)=>{throw new d(e,l.Unrecognized,t)})}catch(n){throw n}};const Dt={};for(const e in ne)Dt[e]=new nt(ne[e]);Ni(ne,Ae);for(const e in ne)ne[e]=new nt(ne[e]);const ur=function(){};ur.prototype=ne;const sr=function(){};function zi(e,t,n){const r={};e||(e={}),n||(n={}),r._SymbolsMap={},r.textformatting=1,r.infinity=1,r.pi=1;for(const a in t)r[a]=1;for(const a in n)r[a]=1;for(const a in e)r[a]=1;return r}function Gi(e,t,n,r){const a=n?new sr:new ur;e||(e={}),t||(t={});const u=new k({newline:` -`,tab:" ",singlequote:"'",doublequote:'"',forwardslash:"/",backwardslash:"\\"});u.immutable=!1,a._SymbolsMap={textformatting:1,infinity:1,pi:1},a.textformatting=u,a.infinity=Number.POSITIVE_INFINITY,a.pi=Math.PI;for(const o in t)a[o]=t[o],a._SymbolsMap[o]=1;for(const o in e)a._SymbolsMap[o]=1,e[o]&&e[o].declaredClass==="esri.Graphic"?a[o]=Q.createFromGraphic(e[o],r??null):a[o]=e[o];return a}sr.prototype=Dt;function rt(e,t){const n={mode:t,compiled:!0,functions:{},signatures:[],standardFunction:Ae,standardFunctionAsync:Ae,evaluateIdentifier:iu};for(let r=0;r0){if(n.substr(0,2).toLowerCase()!=="_t"&&e.localStack[e.localStack.length-1][n]!==void 0)return e.localStack[e.localStack.length-1][n];const a=e.mangleMap[n];if(a!==void 0&&e.localStack[e.localStack.length-1][a]!==void 0)return e.localStack[e.localStack.length-1][a]}if(n.substr(0,2).toLowerCase()!=="_t"&&e.globalScope[n]!==void 0||e.globalScope._SymbolsMap[n]===1)return e.globalScope[n];const r=e.mangleMap[n];return r!==void 0?e.globalScope[r]:void 0}rt([On],"sync"),rt([On],"async");let An=0;const Zi={error(e){throw new d(null,e,null)},__awaiter:(e,t,n,r)=>new Promise((a,u)=>{function o(c){try{s(r.next(c))}catch(p){u(p)}}function i(c){try{s(r.throw(c))}catch(p){u(p)}}function s(c){var p;c.done?a(c.value):(p=c.value)!=null&&p.then?c.value.then(o,i):(An++,An%100==0?setTimeout(()=>{An=0,o(c.value)},0):o(c.value))}s((r=r.apply(e,t||[])).next())}),functionDepthchecker:(e,t)=>function(){if(t.depthCounter.depth++,t.localStack.push([]),t.depthCounter.depth>64)throw new d(null,l.MaximumCallDepth,null);const n=e.apply(this,arguments);return qe(n)?n.then(r=>(t.depthCounter.depth--,t.localStack.length=t.localStack.length-1,r)):(t.depthCounter.depth--,t.localStack.length=t.localStack.length-1,n)},chkAssig(e,t){if(t.gdefs[e]===void 0)throw new d(t,l.InvalidIdentifier,null);return e},mustBoolean(e,t){if(e===!0||e===!1)return e;throw new d(t,l.BooleanConditionRequired,null)},setAssig:(e,t)=>(t.gdefs[e]=1,e),castString:e=>w(e),aCheck(e,t){if(X(e))throw t==="ArrayExpression"?new d(null,l.NoFunctionInArray,null):t==="ObjectExpression"?new d(null,l.NoFunctionInDictionary,null):new d(null,l.NoFunctionInTemplateLiteral,null);return e===A?null:e},Dictionary:k,Feature:Q,UserDefinedCompiledFunction:No,dictionary(e){const t={},n=new Map;for(let a=0;a>":case">>>":case"^":case"&":return ir(h(e),h(t),n);case"==":case"=":return Ee(e,t);case"!=":return!Ee(e,t);case"<":case">":case"<=":case">=":return rr(e,t,n);case"+":return C(e)||C(t)?w(e)+w(t):h(e)+h(t);case"-":return h(e)-h(t);case"*":return h(e)*h(t);case"/":return h(e)/h(t);case"%":return h(e)%h(t);default:throw new d(null,l.UnsupportedOperator,null)}},assign(e,t,n){switch(t){case"=":return e===A?null:e;case"/=":return h(n)/h(e);case"*=":return h(n)*h(e);case"-=":return h(n)-h(e);case"+=":return C(n)||C(e)?w(n)+w(e):h(n)+h(e);case"%=":return h(n)%h(e);default:throw new d(null,l.UnsupportedOperator,null)}},update(e,t,n,r){const a=h(e[t]);return e[t]=n==="++"?a+1:a-1,r===!1?a:n==="++"?a+1:a-1},graphicToFeature:(e,t,n)=>e===null?null:Q.createFromGraphicLikeObject(e.geometry,e.attributes,t,n.timeZone),memberupdate(e,t,n,r){let a;if(T(e)){if(!q(t))throw new d(null,l.ArrayAccessorMustBeNumber,null);if(t<0&&(t=e.length+t),t<0||t>=e.length)throw new d(null,l.OutOfBounds,null);a=h(e[t]),e[t]=n==="++"?a+1:a-1}else if(e instanceof k){if(C(t)===!1)throw new d(null,l.KeyAccessorMustBeString,null);if(e.hasField(t)!==!0)throw new d(null,l.FieldNotFound,null,{key:t});a=h(e.field(t)),e.setField(t,n==="++"?a+1:a-1)}else if(ee(e)){if(C(t)===!1)throw new d(null,l.KeyAccessorMustBeString,null);if(e.hasField(t)!==!0)throw new d(null,l.FieldNotFound,null);a=h(e.field(t)),e.setField(t,n==="++"?a+1:a-1)}else{if(R(e))throw new d(null,l.Immutable,null);if(!(e instanceof It))throw new d(null,l.InvalidIdentifier,null);if(C(t)===!1)throw new d(null,l.ModuleAccessorMustBeString,null);if(e.hasGlobal(t)!==!0)throw new d(null,l.ModuleExportNotFound,null);a=h(e.global(t)),e.setGlobal(t,n==="++"?a+1:a-1)}return r===!1?a:n==="++"?a+1:a-1},assignmember(e,t,n,r){if(T(e)){if(!q(t))throw new d(null,l.ArrayAccessorMustBeNumber,null);if(t<0&&(t=e.length+t),t<0||t>e.length)throw new d(null,l.OutOfBounds,null);if(t===e.length){if(n!=="=")throw new d(null,l.OutOfBounds,null);e[t]=this.assign(r,n,e[t])}else e[t]=this.assign(r,n,e[t])}else if(e instanceof k){if(C(t)===!1)throw new d(null,l.KeyAccessorMustBeString,null);if(e.hasField(t)===!0)e.setField(t,this.assign(r,n,e.field(t)));else{if(n!=="=")throw new d(null,l.FieldNotFound,null);e.setField(t,this.assign(r,n,null))}}else if(ee(e)){if(C(t)===!1)throw new d(null,l.KeyAccessorMustBeString,null);if(e.hasField(t)===!0)e.setField(t,this.assign(r,n,e.field(t)));else{if(n!=="=")throw new d(null,l.FieldNotFound,null);e.setField(t,this.assign(r,n,null))}}else{if(R(e))throw new d(null,l.Immutable,null);if(!(e instanceof It))throw new d(null,l.InvalidIdentifier,null);if(C(t)===!1)throw new d(null,l.ModuleAccessorMustBeString,null);if(!e.hasGlobal(t))throw new d(null,l.ModuleExportNotFound,null);e.setGlobal(t,this.assign(r,n,e.global(t)))}},member(e,t){if(e===null)throw new d(null,l.MemberOfNull,null);if(e instanceof k||ee(e)){if(C(t))return e.field(t);throw new d(null,l.InvalidMemberAccessKey,null)}if(e instanceof B){if(C(t))return $t(e,t,null,null);throw new d(null,l.InvalidMemberAccessKey,null)}if(T(e)){if(q(t)&&isFinite(t)&&Math.floor(t)===t){if(t<0&&(t=e.length+t),t>=e.length||t<0)throw new d(null,l.OutOfBounds,null);return e[t]}throw new d(null,l.InvalidMemberAccessKey,null)}if(C(e)){if(q(t)&&isFinite(t)&&Math.floor(t)===t){if(t<0&&(t=e.length+t),t>=e.length||t<0)throw new d(null,l.OutOfBounds,null);return e[t]}throw new d(null,l.InvalidMemberAccessKey,null)}if(R(e)){if(q(t)&&isFinite(t)&&Math.floor(t)===t){if(t<0&&(t=e.length()+t),t>=e.length()||t<0)throw new d(null,l.OutOfBounds,null);return e.get(t)}throw new d(null,l.InvalidMemberAccessKey,null)}if(e instanceof It){if(C(t))return e.global(t);throw new d(null,l.InvalidMemberAccessKey,null)}throw new d(null,l.InvalidMemberAccessKey,null)},callfunc:(e,t,n)=>e.call(n,{arguments:t,preparsed:!0}),loadModule(e,t){const n=t.moduleFactoryMap[e];if(t.moduleSingletons[n])return t.moduleSingletons[n];const r=t.moduleFactory[n]({vars:{},moduleSingletons:t.moduleSingletons,depthCounter:t.depthCounter,console:t.console,abortSignal:t.abortSignal,isAsync:t.isAsync,services:t.services,lrucache:t.lrucache,timeZone:t.timeZone??null,interceptor:t.interceptor},t.spatialReference);return t.moduleSingletons[n]=r,r},callModuleFunction(e,t,n,r){if(!(e instanceof It))throw new d(null,l.FunctionNotFound,null);const a=e.global(n);if(X(a)===!1)throw new d(null,l.CallNonFunction,null);return a.call(r,{preparsed:!0,arguments:t})}};function tn(e){console.log(e)}function Ji(e,t,n=!1){t===null&&(t={vars:{},customfunctions:{}});let r=null;e.usesModules&&(r=new an(null,e.loadedModules));const a={isAsync:n,globalScope:zi(t.vars,n?Dt:ne,t.customfunctions),moduleFactory:{},moduleFactoryMap:{},undeclaredGlobalsInFunctions:new Map,customfunctions:t.customfunctions,libraryResolver:r,localScope:null,mangleMap:{},depthCounter:{depth:1},exports:{},console:tn,lrucache:t.lrucache,timeZone:t.timeZone??null,interceptor:t.interceptor,services:t.services,symbols:{symbolCounter:0}};let u=S(a,e);u===""&&(u="lc.voidOperation; "),a.undeclaredGlobalsInFunctions.size>0&&a.undeclaredGlobalsInFunctions.forEach(m=>{throw new le(t,l.InvalidIdentifier,m.node)});let o="";o=n?`var runtimeCtx=this.prepare(context, true); +`,tab:" ",singlequote:"'",doublequote:'"',forwardslash:"/",backwardslash:"\\"});u.immutable=!1,a._SymbolsMap={textformatting:1,infinity:1,pi:1},a.textformatting=u,a.infinity=Number.POSITIVE_INFINITY,a.pi=Math.PI;for(const o in t)a[o]=t[o],a._SymbolsMap[o]=1;for(const o in e)a._SymbolsMap[o]=1,e[o]&&e[o].declaredClass==="esri.Graphic"?a[o]=Q.createFromGraphic(e[o],r??null):a[o]=e[o];return a}sr.prototype=Dt;function rt(e,t){const n={mode:t,compiled:!0,functions:{},signatures:[],standardFunction:Ae,standardFunctionAsync:Ae,evaluateIdentifier:iu};for(let r=0;r0){if(n.substr(0,2).toLowerCase()!=="_t"&&e.localStack[e.localStack.length-1][n]!==void 0)return e.localStack[e.localStack.length-1][n];const a=e.mangleMap[n];if(a!==void 0&&e.localStack[e.localStack.length-1][a]!==void 0)return e.localStack[e.localStack.length-1][a]}if(n.substr(0,2).toLowerCase()!=="_t"&&e.globalScope[n]!==void 0||e.globalScope._SymbolsMap[n]===1)return e.globalScope[n];const r=e.mangleMap[n];return r!==void 0?e.globalScope[r]:void 0}rt([On],"sync"),rt([On],"async");let An=0;const Zi={error(e){throw new d(null,e,null)},__awaiter:(e,t,n,r)=>new Promise((a,u)=>{function o(c){try{s(r.next(c))}catch(p){u(p)}}function i(c){try{s(r.throw(c))}catch(p){u(p)}}function s(c){var p;c.done?a(c.value):(p=c.value)!=null&&p.then?c.value.then(o,i):(An++,An%100==0?setTimeout(()=>{An=0,o(c.value)},0):o(c.value))}s((r=r.apply(e,t||[])).next())}),functionDepthchecker:(e,t)=>function(){if(t.depthCounter.depth++,t.localStack.push([]),t.depthCounter.depth>64)throw new d(null,l.MaximumCallDepth,null);const n=e.apply(this,arguments);return Ve(n)?n.then(r=>(t.depthCounter.depth--,t.localStack.length=t.localStack.length-1,r)):(t.depthCounter.depth--,t.localStack.length=t.localStack.length-1,n)},chkAssig(e,t){if(t.gdefs[e]===void 0)throw new d(t,l.InvalidIdentifier,null);return e},mustBoolean(e,t){if(e===!0||e===!1)return e;throw new d(t,l.BooleanConditionRequired,null)},setAssig:(e,t)=>(t.gdefs[e]=1,e),castString:e=>w(e),aCheck(e,t){if(X(e))throw t==="ArrayExpression"?new d(null,l.NoFunctionInArray,null):t==="ObjectExpression"?new d(null,l.NoFunctionInDictionary,null):new d(null,l.NoFunctionInTemplateLiteral,null);return e===A?null:e},Dictionary:k,Feature:Q,UserDefinedCompiledFunction:No,dictionary(e){const t={},n=new Map;for(let a=0;a>":case">>>":case"^":case"&":return ir(h(e),h(t),n);case"==":case"=":return Ee(e,t);case"!=":return!Ee(e,t);case"<":case">":case"<=":case">=":return rr(e,t,n);case"+":return C(e)||C(t)?w(e)+w(t):h(e)+h(t);case"-":return h(e)-h(t);case"*":return h(e)*h(t);case"/":return h(e)/h(t);case"%":return h(e)%h(t);default:throw new d(null,l.UnsupportedOperator,null)}},assign(e,t,n){switch(t){case"=":return e===A?null:e;case"/=":return h(n)/h(e);case"*=":return h(n)*h(e);case"-=":return h(n)-h(e);case"+=":return C(n)||C(e)?w(n)+w(e):h(n)+h(e);case"%=":return h(n)%h(e);default:throw new d(null,l.UnsupportedOperator,null)}},update(e,t,n,r){const a=h(e[t]);return e[t]=n==="++"?a+1:a-1,r===!1?a:n==="++"?a+1:a-1},graphicToFeature:(e,t,n)=>e===null?null:Q.createFromGraphicLikeObject(e.geometry,e.attributes,t,n.timeZone),memberupdate(e,t,n,r){let a;if(T(e)){if(!V(t))throw new d(null,l.ArrayAccessorMustBeNumber,null);if(t<0&&(t=e.length+t),t<0||t>=e.length)throw new d(null,l.OutOfBounds,null);a=h(e[t]),e[t]=n==="++"?a+1:a-1}else if(e instanceof k){if(C(t)===!1)throw new d(null,l.KeyAccessorMustBeString,null);if(e.hasField(t)!==!0)throw new d(null,l.FieldNotFound,null,{key:t});a=h(e.field(t)),e.setField(t,n==="++"?a+1:a-1)}else if(ee(e)){if(C(t)===!1)throw new d(null,l.KeyAccessorMustBeString,null);if(e.hasField(t)!==!0)throw new d(null,l.FieldNotFound,null);a=h(e.field(t)),e.setField(t,n==="++"?a+1:a-1)}else{if(R(e))throw new d(null,l.Immutable,null);if(!(e instanceof It))throw new d(null,l.InvalidIdentifier,null);if(C(t)===!1)throw new d(null,l.ModuleAccessorMustBeString,null);if(e.hasGlobal(t)!==!0)throw new d(null,l.ModuleExportNotFound,null);a=h(e.global(t)),e.setGlobal(t,n==="++"?a+1:a-1)}return r===!1?a:n==="++"?a+1:a-1},assignmember(e,t,n,r){if(T(e)){if(!V(t))throw new d(null,l.ArrayAccessorMustBeNumber,null);if(t<0&&(t=e.length+t),t<0||t>e.length)throw new d(null,l.OutOfBounds,null);if(t===e.length){if(n!=="=")throw new d(null,l.OutOfBounds,null);e[t]=this.assign(r,n,e[t])}else e[t]=this.assign(r,n,e[t])}else if(e instanceof k){if(C(t)===!1)throw new d(null,l.KeyAccessorMustBeString,null);if(e.hasField(t)===!0)e.setField(t,this.assign(r,n,e.field(t)));else{if(n!=="=")throw new d(null,l.FieldNotFound,null);e.setField(t,this.assign(r,n,null))}}else if(ee(e)){if(C(t)===!1)throw new d(null,l.KeyAccessorMustBeString,null);if(e.hasField(t)===!0)e.setField(t,this.assign(r,n,e.field(t)));else{if(n!=="=")throw new d(null,l.FieldNotFound,null);e.setField(t,this.assign(r,n,null))}}else{if(R(e))throw new d(null,l.Immutable,null);if(!(e instanceof It))throw new d(null,l.InvalidIdentifier,null);if(C(t)===!1)throw new d(null,l.ModuleAccessorMustBeString,null);if(!e.hasGlobal(t))throw new d(null,l.ModuleExportNotFound,null);e.setGlobal(t,this.assign(r,n,e.global(t)))}},member(e,t){if(e===null)throw new d(null,l.MemberOfNull,null);if(e instanceof k||ee(e)){if(C(t))return e.field(t);throw new d(null,l.InvalidMemberAccessKey,null)}if(e instanceof B){if(C(t))return $t(e,t,null,null);throw new d(null,l.InvalidMemberAccessKey,null)}if(T(e)){if(V(t)&&isFinite(t)&&Math.floor(t)===t){if(t<0&&(t=e.length+t),t>=e.length||t<0)throw new d(null,l.OutOfBounds,null);return e[t]}throw new d(null,l.InvalidMemberAccessKey,null)}if(C(e)){if(V(t)&&isFinite(t)&&Math.floor(t)===t){if(t<0&&(t=e.length+t),t>=e.length||t<0)throw new d(null,l.OutOfBounds,null);return e[t]}throw new d(null,l.InvalidMemberAccessKey,null)}if(R(e)){if(V(t)&&isFinite(t)&&Math.floor(t)===t){if(t<0&&(t=e.length()+t),t>=e.length()||t<0)throw new d(null,l.OutOfBounds,null);return e.get(t)}throw new d(null,l.InvalidMemberAccessKey,null)}if(e instanceof It){if(C(t))return e.global(t);throw new d(null,l.InvalidMemberAccessKey,null)}throw new d(null,l.InvalidMemberAccessKey,null)},callfunc:(e,t,n)=>e.call(n,{arguments:t,preparsed:!0}),loadModule(e,t){const n=t.moduleFactoryMap[e];if(t.moduleSingletons[n])return t.moduleSingletons[n];const r=t.moduleFactory[n]({vars:{},moduleSingletons:t.moduleSingletons,depthCounter:t.depthCounter,console:t.console,abortSignal:t.abortSignal,isAsync:t.isAsync,services:t.services,lrucache:t.lrucache,timeZone:t.timeZone??null,interceptor:t.interceptor},t.spatialReference);return t.moduleSingletons[n]=r,r},callModuleFunction(e,t,n,r){if(!(e instanceof It))throw new d(null,l.FunctionNotFound,null);const a=e.global(n);if(X(a)===!1)throw new d(null,l.CallNonFunction,null);return a.call(r,{preparsed:!0,arguments:t})}};function tn(e){console.log(e)}function Ji(e,t,n=!1){t===null&&(t={vars:{},customfunctions:{}});let r=null;e.usesModules&&(r=new an(null,e.loadedModules));const a={isAsync:n,globalScope:zi(t.vars,n?Dt:ne,t.customfunctions),moduleFactory:{},moduleFactoryMap:{},undeclaredGlobalsInFunctions:new Map,customfunctions:t.customfunctions,libraryResolver:r,localScope:null,mangleMap:{},depthCounter:{depth:1},exports:{},console:tn,lrucache:t.lrucache,timeZone:t.timeZone??null,interceptor:t.interceptor,services:t.services,symbols:{symbolCounter:0}};let u=S(a,e);u===""&&(u="lc.voidOperation; "),a.undeclaredGlobalsInFunctions.size>0&&a.undeclaredGlobalsInFunctions.forEach(m=>{throw new le(t,l.InvalidIdentifier,m.node)});let o="";o=n?`var runtimeCtx=this.prepare(context, true); var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; return lang.__awaiter(this, void 0, void 0, function* () { @@ -131,7 +131,7 @@ return lang.__awaiter(this, void 0, void 0, function* () { var lastStatement=lc.voidOperation; `+u+` return lastStatement; } - return this.postProcess(mainBody()); `;const i=a.moduleFactory,s=a.moduleFactoryMap,c=a.exports,p={};for(const m in c)p[m]=a.mangleMap[m]!==void 0?a.mangleMap[m]:m;const f={lc:Ai,lang:Zi,mangles:a.mangleMap,postProcess(m){if(m instanceof ye&&(m=m.value),m instanceof ft&&(m=m.value),m===A&&(m=null),m===Ie)throw new d(null,l.IllegalResult,null);if(m===wt)throw new d(null,l.IllegalResult,null);if(X(m))throw new d(null,l.IllegalResult,null);return m},prepare(m,g){let x=m.spatialReference;x==null&&(x=yt.WebMercator);const M=Gi(m.vars,m.customfunctions,g,m.timeZone);return{localStack:[],isAsync:g,moduleFactory:i,moduleFactoryMap:s,mangleMap:this.mangles,moduleSingletons:{},exports:c,gdefs:{},exportmangle:p,spatialReference:x,globalScope:M,abortSignal:m.abortSignal===void 0||m.abortSignal===null?{aborted:!1}:m.abortSignal,localScope:null,services:m.services,console:m.console??tn,lrucache:m.lrucache,timeZone:m.timeZone??null,interceptor:m.interceptor,symbols:{symbolCounter:0},depthCounter:{depth:1}}}};return new Function("context","spatialReference",o).bind(f)}async function au(){return rt([await Ve(()=>import("./geomasync-_hAyjeTi.js"),__vite__mapDeps([0,1,2,3,4,5,6]))],"async"),!0}class It extends Pt{constructor(t){super(null),this.moduleContext=t}hasGlobal(t){return this.moduleContext.exports[t]===void 0&&(t=t.toLowerCase()),this.moduleContext.exports[t]!==void 0}setGlobal(t,n){const r=this.moduleContext.globalScope,a=t.toLowerCase();if(X(n))throw new d(null,l.AssignModuleFunction,null);r[this.moduleContext.exportmangle[a]]=n}global(t){const n=this.moduleContext.globalScope;t=t.toLowerCase();const r=n[this.moduleContext.exportmangle[t]];if(r===void 0)throw new d(null,l.InvalidIdentifier,null);if(X(r)&&!(r instanceof ze)){const a=new ze;return a.fn=r,a.parameterEvaluator=Ae,a.context=this.moduleContext,n[this.moduleContext.exportmangle[t]]=a,a}return r}}function ou(e,t,n=!1){const r={isAsync:n,moduleFactory:t.moduleFactory,moduleFactoryMap:{},libraryResolver:new an(null,e.loadedModules),globalScope:zi(t.vars,n?Dt:ne,t.customfunctions),customfunctions:t.customfunctions,localScope:null,mangleMap:{},undeclaredGlobalsInFunctions:new Map,depthCounter:{depth:1},exports:{},console:tn,lrucache:t.lrucache,timeZone:t.timeZone??null,interceptor:t.interceptor,services:t.services,symbols:{symbolCounter:0}};let a=S(r,e);a===""&&(a="lc.voidOperation; ");let u="";u=n?`var runtimeCtx=this.prepare(context, true); + return this.postProcess(mainBody()); `;const i=a.moduleFactory,s=a.moduleFactoryMap,c=a.exports,p={};for(const m in c)p[m]=a.mangleMap[m]!==void 0?a.mangleMap[m]:m;const f={lc:Ai,lang:Zi,mangles:a.mangleMap,postProcess(m){if(m instanceof ye&&(m=m.value),m instanceof ft&&(m=m.value),m===A&&(m=null),m===Ie)throw new d(null,l.IllegalResult,null);if(m===wt)throw new d(null,l.IllegalResult,null);if(X(m))throw new d(null,l.IllegalResult,null);return m},prepare(m,g){let x=m.spatialReference;x==null&&(x=yt.WebMercator);const M=Gi(m.vars,m.customfunctions,g,m.timeZone);return{localStack:[],isAsync:g,moduleFactory:i,moduleFactoryMap:s,mangleMap:this.mangles,moduleSingletons:{},exports:c,gdefs:{},exportmangle:p,spatialReference:x,globalScope:M,abortSignal:m.abortSignal===void 0||m.abortSignal===null?{aborted:!1}:m.abortSignal,localScope:null,services:m.services,console:m.console??tn,lrucache:m.lrucache,timeZone:m.timeZone??null,interceptor:m.interceptor,symbols:{symbolCounter:0},depthCounter:{depth:1}}}};return new Function("context","spatialReference",o).bind(f)}async function au(){return rt([await qe(()=>import("./geomasync-7v4-s3fM.js"),__vite__mapDeps([0,1,2,3,4,5,6]))],"async"),!0}class It extends Pt{constructor(t){super(null),this.moduleContext=t}hasGlobal(t){return this.moduleContext.exports[t]===void 0&&(t=t.toLowerCase()),this.moduleContext.exports[t]!==void 0}setGlobal(t,n){const r=this.moduleContext.globalScope,a=t.toLowerCase();if(X(n))throw new d(null,l.AssignModuleFunction,null);r[this.moduleContext.exportmangle[a]]=n}global(t){const n=this.moduleContext.globalScope;t=t.toLowerCase();const r=n[this.moduleContext.exportmangle[t]];if(r===void 0)throw new d(null,l.InvalidIdentifier,null);if(X(r)&&!(r instanceof ze)){const a=new ze;return a.fn=r,a.parameterEvaluator=Ae,a.context=this.moduleContext,n[this.moduleContext.exportmangle[t]]=a,a}return r}}function ou(e,t,n=!1){const r={isAsync:n,moduleFactory:t.moduleFactory,moduleFactoryMap:{},libraryResolver:new an(null,e.loadedModules),globalScope:zi(t.vars,n?Dt:ne,t.customfunctions),customfunctions:t.customfunctions,localScope:null,mangleMap:{},undeclaredGlobalsInFunctions:new Map,depthCounter:{depth:1},exports:{},console:tn,lrucache:t.lrucache,timeZone:t.timeZone??null,interceptor:t.interceptor,services:t.services,symbols:{symbolCounter:0}};let a=S(r,e);a===""&&(a="lc.voidOperation; ");let u="";u=n?`var runtimeCtx=this.prepare(context, true); var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; return lang.__awaiter(this, void 0, void 0, function* () { @@ -148,22 +148,22 @@ return lang.__awaiter(this, void 0, void 0, function* () { `+a+` return lastStatement; } mainBody(); - return this.prepareModule(runtimeCtx); `;const o=r.moduleFactory,i=r.moduleFactoryMap,s=r.exports,c={};for(const f in s)c[f]=r.mangleMap[f]!==void 0?r.mangleMap[f]:f;const p={lc:Ai,lang:Zi,mangles:r.mangleMap,prepareModule:f=>new It(f),prepare(f,m){let g=f.spatialReference;g==null&&(g=new yt({wkid:102100}));const x=Gi(f.vars,f.customfunctions,m,f.timeZone);return{localStack:[],isAsync:m,exports:s,exportmangle:c,gdefs:{},moduleFactory:o,moduleFactoryMap:i,moduleSingletons:f.moduleSingletons,mangleMap:this.mangles,spatialReference:g,globalScope:x,abortSignal:f.abortSignal===void 0||f.abortSignal===null?{aborted:!1}:f.abortSignal,localScope:null,services:f.services,console:f.console??tn,lrucache:f.lrucache,timeZone:f.timeZone??null,interceptor:f.interceptor,symbols:{symbolCounter:0},depthCounter:f.depthCounter}}};return new Function("context","spatialReference",u).bind(p)}var L,b;(function(e){e.Break="break",e.Continue="continue",e.Else="else",e.False="false",e.For="for",e.From="from",e.Function="function",e.If="if",e.Import="import",e.Export="export",e.In="in",e.Null="null",e.Return="return",e.True="true",e.Var="var",e.While="while"})(L||(L={})),function(e){e.AssignmentExpression="AssignmentExpression",e.ArrayExpression="ArrayExpression",e.BlockComment="BlockComment",e.BlockStatement="BlockStatement",e.BinaryExpression="BinaryExpression",e.BreakStatement="BreakStatement",e.CallExpression="CallExpression",e.ContinueStatement="ContinueStatement",e.EmptyStatement="EmptyStatement",e.ExpressionStatement="ExpressionStatement",e.ExportNamedDeclaration="ExportNamedDeclaration",e.ExportSpecifier="ExportSpecifier",e.ForStatement="ForStatement",e.ForInStatement="ForInStatement",e.FunctionDeclaration="FunctionDeclaration",e.Identifier="Identifier",e.IfStatement="IfStatement",e.ImportDeclaration="ImportDeclaration",e.ImportDefaultSpecifier="ImportDefaultSpecifier",e.LineComment="LineComment",e.Literal="Literal",e.LogicalExpression="LogicalExpression",e.MemberExpression="MemberExpression",e.ObjectExpression="ObjectExpression",e.Program="Program",e.Property="Property",e.ReturnStatement="ReturnStatement",e.TemplateElement="TemplateElement",e.TemplateLiteral="TemplateLiteral",e.UnaryExpression="UnaryExpression",e.UpdateExpression="UpdateExpression",e.VariableDeclaration="VariableDeclaration",e.VariableDeclarator="VariableDeclarator",e.WhileStatement="WhileStatement"}(b||(b={}));const Jn=["++","--"],qi=["-","+","!","~"],Vi=["=","/=","*=","%=","+=","-="],ji=["||","&&"],uu=["|","&",">>","<<",">>>","^","==","!=","<","<=",">",">=","+","-","*","/","%"],su={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10};var E;(function(e){e[e.Unknown=0]="Unknown",e[e.BooleanLiteral=1]="BooleanLiteral",e[e.EOF=2]="EOF",e[e.Identifier=3]="Identifier",e[e.Keyword=4]="Keyword",e[e.NullLiteral=5]="NullLiteral",e[e.NumericLiteral=6]="NumericLiteral",e[e.Punctuator=7]="Punctuator",e[e.StringLiteral=8]="StringLiteral",e[e.Template=10]="Template"})(E||(E={}));const lu=["Unknown","Boolean","","Identifier","Keyword","Null","Numeric","Punctuator","String","RegularExpression","Template"];var F;(function(e){e.InvalidModuleUri="InvalidModuleUri",e.ForInOfLoopInitializer="ForInOfLoopInitializer",e.IdentiferExpected="IdentiferExpected",e.InvalidEscapedReservedWord="InvalidEscapedReservedWord",e.InvalidExpression="InvalidExpression",e.InvalidFunctionIdentifier="InvalidFunctionIdentifier",e.InvalidHexEscapeSequence="InvalidHexEscapeSequence",e.InvalidLeftHandSideInAssignment="InvalidLeftHandSideInAssignment",e.InvalidLeftHandSideInForIn="InvalidLeftHandSideInForIn",e.InvalidTemplateHead="InvalidTemplateHead",e.InvalidVariableAssignment="InvalidVariableAssignment",e.KeyMustBeString="KeyMustBeString",e.NoFunctionInsideBlock="NoFunctionInsideBlock",e.NoFunctionInsideFunction="NoFunctionInsideFunction",e.ModuleExportRootOnly="ModuleExportRootOnly",e.ModuleImportRootOnly="ModuleImportRootOnly",e.PunctuatorExpected="PunctuatorExpected",e.TemplateOctalLiteral="TemplateOctalLiteral",e.UnexpectedBoolean="UnexpectedBoolean",e.UnexpectedEndOfScript="UnexpectedEndOfScript",e.UnexpectedIdentifier="UnexpectedIdentifier",e.UnexpectedKeyword="UnexpectedKeyword",e.UnexpectedNull="UnexpectedNull",e.UnexpectedNumber="UnexpectedNumber",e.UnexpectedPunctuator="UnexpectedPunctuator",e.UnexpectedString="UnexpectedString",e.UnexpectedTemplate="UnexpectedTemplate",e.UnexpectedToken="UnexpectedToken"})(F||(F={}));const cu={[F.InvalidModuleUri]:"Module uri must be a text literal.",[F.ForInOfLoopInitializer]:"for-in loop variable declaration may not have an initializer.",[F.IdentiferExpected]:"'${value}' is an invalid identifier.",[F.InvalidEscapedReservedWord]:"Keyword cannot contain escaped characters.",[F.InvalidExpression]:"Invalid expression.",[F.InvalidFunctionIdentifier]:"'${value}' is an invalid function identifier.",[F.InvalidHexEscapeSequence]:"Invalid hexadecimal escape sequence.",[F.InvalidLeftHandSideInAssignment]:"Invalid left-hand side in assignment.",[F.InvalidLeftHandSideInForIn]:"Invalid left-hand side in for-in.",[F.InvalidTemplateHead]:"Invalid template structure.",[F.InvalidVariableAssignment]:"Invalid variable assignment.",[F.KeyMustBeString]:"Object property keys must be a word starting with a letter.",[F.NoFunctionInsideBlock]:"Functions cannot be declared inside of code blocks.",[F.NoFunctionInsideFunction]:"Functions cannot be declared inside another function.",[F.ModuleExportRootOnly]:"Module exports cannot be declared inside of code blocks.",[F.ModuleImportRootOnly]:"Module import cannot be declared inside of code blocks.",[F.PunctuatorExpected]:"'${value}' expected.",[F.TemplateOctalLiteral]:"Octal literals are not allowed in template literals.",[F.UnexpectedBoolean]:"Unexpected boolean literal.",[F.UnexpectedEndOfScript]:"Unexpected end of Arcade expression.",[F.UnexpectedIdentifier]:"Unexpected identifier.",[F.UnexpectedKeyword]:"Unexpected keyword.",[F.UnexpectedNull]:"Unexpected null literal.",[F.UnexpectedNumber]:"Unexpected number.",[F.UnexpectedPunctuator]:"Unexpected ponctuator.",[F.UnexpectedString]:"Unexpected text literal.",[F.UnexpectedTemplate]:"Unexpected quasi '${value}'.",[F.UnexpectedToken]:"Unexpected token '${value}'."};let Ot=class Hi extends Error{constructor({code:t,index:n,line:r,column:a,len:u=0,description:o,data:i}){var s;super(`${o??t}`),this.declaredRootClass="esri.arcade.lib.parsingerror",this.name="ParsingError",this.code=t,this.index=n,this.line=r,this.column=a,this.len=u,this.data=i,this.description=o,this.range={start:{line:r,column:a-1},end:{line:r,column:a+u}},(s=Error.captureStackTrace)==null||s.call(Error,this,Hi)}};function du(e){return(e==null?void 0:e.type)===b.Program}function Ur(e){return(e==null?void 0:e.type)===b.BlockStatement}function fu(e){return(e==null?void 0:e.type)===b.BlockComment}function hu(e){return(e==null?void 0:e.type)===b.EmptyStatement}function mu(e){return(e==null?void 0:e.type)===b.VariableDeclarator}function bn(e,t){return!!t&&t.loc.end.line===e.loc.start.line&&t.loc.end.column<=e.loc.start.column}function zr(e,t){return e.range[0]>=t.range[0]&&e.range[1]<=t.range[1]}let pu=class{constructor(){this.comments=[],this._nodeStack=[],this._newComments=[]}insertInnerComments(t){if(!Ur(t)||t.body.length!==0)return;const n=[];for(let r=this._newComments.length-1;r>=0;--r){const a=this._newComments[r];t.range[1]>=a.range[0]&&(n.unshift(a),this._newComments.splice(r,1))}n.length&&(t.innerComments=n)}attachTrailingComments(t){if(!t)return;const n=this._nodeStack[this._nodeStack.length-1];if(Ur(t)&&zr(n,t))for(let a=this._newComments.length-1;a>=0;--a){const u=this._newComments[a];zr(u,t)&&(n.trailingComments=[...n.trailingComments??[],u],this._newComments.splice(a,1))}let r=[];if(this._newComments.length>0)for(let a=this._newComments.length-1;a>=0;--a){const u=this._newComments[a];bn(u,n)?(n.trailingComments=[...n.trailingComments??[],u],this._newComments.splice(a,1)):bn(u,t)&&(r.unshift(u),this._newComments.splice(a,1))}n!=null&&n.trailingComments&&bn(n.trailingComments[0],t)&&(r=[...r,...n.trailingComments],delete n.trailingComments),r.length>0&&(t.trailingComments=r)}attachLeadingComments(t){var u,o;if(!t)return;let n;for(;this._nodeStack.length>0;){const i=this._nodeStack[this._nodeStack.length-1];if(!(t.range[0]<=i.range[0]))break;n=i,this._nodeStack.pop()}const r=[],a=[];if(n){for(let i=(((u=n.leadingComments)==null?void 0:u.length)??0)-1;i>=0;--i){const s=n.leadingComments[i];t.range[0]>=s.range[1]?(r.unshift(s),n.leadingComments.splice(i,1)):mu(t)&&!fu(s)&&(a.unshift(s),n.leadingComments.splice(i,1))}return((o=n.leadingComments)==null?void 0:o.length)===0&&delete n.leadingComments,r.length&&(t.leadingComments=r),void(a.length&&(t.trailingComments=[...a,...t.trailingComments??[]]))}for(let i=this._newComments.length-1;i>=0;--i){const s=this._newComments[i];t.range[0]>=s.range[0]&&(r.unshift(s),this._newComments.splice(i,1))}r.length&&(t.leadingComments=r)}attachComments(t){if(du(t)&&t.body.length>0){const n=this._nodeStack[this._nodeStack.length-1];return n?(n.trailingComments=[...n.trailingComments??[],...this._newComments],this._newComments.length=0,void this._nodeStack.pop()):(t.trailingComments=[...this._newComments],void(this._newComments.length=0))}this.attachTrailingComments(t),this.attachLeadingComments(t),this.insertInnerComments(t),this._nodeStack.push(t)}collectComment(t){this.comments.push(t),this._newComments.push(t)}};function qn(e,t){const n=cu[e];return t?n.replaceAll(/\${(.*?)}/g,(r,a)=>{var u;return((u=t[a])==null?void 0:u.toString())??""}):n}let Du=class{constructor(t=!1){this.tolerant=t,this.errors=[]}recordError(t){this.errors.push(t)}tolerate(t){if(!this.tolerant)throw t;this.recordError(t)}throwError(t){throw t.description=t.description??qn(t.code,t.data),new Ot(t)}tolerateError(t){t.description=t.description??qn(t.code,t.data);const n=new Ot(t);if(!this.tolerant)throw n;this.recordError(n)}};function Gr(e,t){if(!e)throw new Error("ASSERT: "+t)}const Zr={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD46\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E\uDC5F\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},G={fromCodePoint:e=>e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023)),isWhiteSpace:e=>e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e),isLineTerminator:e=>e===10||e===13||e===8232||e===8233,isIdentifierStart:e=>e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&Zr.NonAsciiIdentifierStart.test(G.fromCodePoint(e)),isIdentifierPart:e=>e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&Zr.NonAsciiIdentifierPart.test(G.fromCodePoint(e)),isDecimalDigit:e=>e>=48&&e<=57,isHexDigit:e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,isOctalDigit:e=>e>=48&&e<=55};function Jr(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function En(e){return"01234567".indexOf(e)}const Xe=[[],[],[]];Jn.forEach(e=>Xe[e.length-1].push(e)),qi.forEach(e=>Xe[e.length-1].push(e)),ji.forEach(e=>Xe[e.length-1].push(e)),Vi.forEach(e=>Xe[e.length-1].push(e)),uu.forEach(e=>Xe[e.length-1].push(e));let gu=class{constructor(t,n){this.source=t,this.errorHandler=n,this._length=t.length,this.index=0,this.lineNumber=1,this.lineStart=0,this.curlyStack=[]}saveState(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart,curlyStack:this.curlyStack.slice()}}restoreState(t){this.index=t.index,this.lineNumber=t.lineNumber,this.lineStart=t.lineStart,this.curlyStack=t.curlyStack}eof(){return this.index>=this._length}throwUnexpectedToken(t=F.UnexpectedToken){this.errorHandler.throwError({code:t,index:this.index,line:this.lineNumber,column:this.index-this.lineStart+1})}tolerateUnexpectedToken(t=F.UnexpectedToken){this.errorHandler.tolerateError({code:t,index:this.index,line:this.lineNumber,column:this.index-this.lineStart+1})}skipSingleLineComment(t){const n=[],r=this.index-t,a={start:{line:this.lineNumber,column:this.index-this.lineStart-t},end:{line:0,column:0}};for(;!this.eof();){const u=this.source.charCodeAt(this.index);if(++this.index,G.isLineTerminator(u)){if(a){a.end={line:this.lineNumber,column:this.index-this.lineStart-1};const o={multiLine:!1,start:r+t,end:this.index-1,range:[r,this.index-1],loc:a};n.push(o)}return u===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index,n}}if(a){a.end={line:this.lineNumber,column:this.index-this.lineStart};const u={multiLine:!1,start:r+t,end:this.index,range:[r,this.index],loc:a};n.push(u)}return n}skipMultiLineComment(){const t=[],n=this.index-2,r={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{line:0,column:0}};for(;!this.eof();){const a=this.source.charCodeAt(this.index);if(G.isLineTerminator(a))a===13&&this.source.charCodeAt(this.index+1)===10&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(a===42){if(this.source.charCodeAt(this.index+1)===47){if(this.index+=2,r){r.end={line:this.lineNumber,column:this.index-this.lineStart};const u={multiLine:!0,start:n+2,end:this.index-2,range:[n,this.index],loc:r};t.push(u)}return t}++this.index}else++this.index}if(r){r.end={line:this.lineNumber,column:this.index-this.lineStart};const a={multiLine:!0,start:n+2,end:this.index,range:[n,this.index],loc:r};t.push(a)}return this.tolerateUnexpectedToken(),t}scanComments(){let t=[];for(;!this.eof();){let n=this.source.charCodeAt(this.index);if(G.isWhiteSpace(n))++this.index;else if(G.isLineTerminator(n))++this.index,n===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index;else{if(n!==47)break;if(n=this.source.charCodeAt(this.index+1),n===47){this.index+=2;const r=this.skipSingleLineComment(2);t=[...t,...r]}else{if(n!==42)break;{this.index+=2;const r=this.skipMultiLineComment();t=[...t,...r]}}}}return t}isKeyword(t){switch((t=t.toLowerCase()).length){case 2:return t===L.If||t===L.In;case 3:return t===L.Var||t===L.For;case 4:return t===L.Else;case 5:return t===L.Break||t===L.While;case 6:return t===L.Return||t===L.Import||t===L.Export;case 8:return t===L.Function||t===L.Continue;default:return!1}}codePointAt(t){let n=this.source.charCodeAt(t);if(n>=55296&&n<=56319){const r=this.source.charCodeAt(t+1);r>=56320&&r<=57343&&(n=1024*(n-55296)+r-56320+65536)}return n}scanHexEscape(t){const n=t==="u"?4:2;let r=0;for(let a=0;a1114111||t!=="}")&&this.throwUnexpectedToken(),G.fromCodePoint(n)}getIdentifier(){const t=this.index++;for(;!this.eof();){const n=this.source.charCodeAt(this.index);if(n===92)return this.index=t,this.getComplexIdentifier();if(n>=55296&&n<57343)return this.index=t,this.getComplexIdentifier();if(!G.isIdentifierPart(n))break;++this.index}return this.source.slice(t,this.index)}getComplexIdentifier(){let t,n=this.codePointAt(this.index),r=G.fromCodePoint(n);for(this.index+=r.length,n===92&&(this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,t=this.scanUnicodeCodePointEscape()):(t=this.scanHexEscape("u"),t!==null&&t!=="\\"&&G.isIdentifierStart(t.charCodeAt(0))||this.throwUnexpectedToken()),r=t);!this.eof()&&(n=this.codePointAt(this.index),G.isIdentifierPart(n));)t=G.fromCodePoint(n),r+=t,this.index+=t.length,n===92&&(r=r.substring(0,r.length-1),this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,t=this.scanUnicodeCodePointEscape()):(t=this.scanHexEscape("u"),t!==null&&t!=="\\"&&G.isIdentifierPart(t.charCodeAt(0))||this.throwUnexpectedToken()),r+=t);return r}octalToDecimal(t){let n=t!=="0",r=En(t);return!this.eof()&&G.isOctalDigit(this.source.charCodeAt(this.index))&&(n=!0,r=8*r+En(this.source[this.index++]),"0123".includes(t)&&!this.eof()&&G.isOctalDigit(this.source.charCodeAt(this.index))&&(r=8*r+En(this.source[this.index++]))),{code:r,octal:n}}scanIdentifier(){let t;const n=this.index,r=this.source.charCodeAt(n)===92?this.getComplexIdentifier():this.getIdentifier();if(t=r.length===1?E.Identifier:this.isKeyword(r)?E.Keyword:r.toLowerCase()===L.Null?E.NullLiteral:r.toLowerCase()===L.True||r.toLowerCase()===L.False?E.BooleanLiteral:E.Identifier,t!==E.Identifier&&n+r.length!==this.index){const a=this.index;this.index=n,this.tolerateUnexpectedToken(F.InvalidEscapedReservedWord),this.index=a}return{type:t,value:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:n,end:this.index}}scanPunctuator(){const t=this.index;let n=this.source[this.index];switch(n){case"(":case"{":n==="{"&&this.curlyStack.push("{"),++this.index;break;case".":case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;case"}":++this.index,this.curlyStack.pop();break;default:for(let r=Xe.length;r>0;r--)if(n=this.source.substring(this.index,this.index+r),Xe[r-1].includes(n)){this.index+=r;break}}return this.index===t&&this.throwUnexpectedToken(),{type:E.Punctuator,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanHexLiteral(t){let n="";for(;!this.eof()&&G.isHexDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return n.length===0&&this.throwUnexpectedToken(),G.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:E.NumericLiteral,value:parseInt("0x"+n,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanBinaryLiteral(t){let n="";for(;!this.eof();){const r=this.source[this.index];if(r!=="0"&&r!=="1")break;n+=this.source[this.index++]}if(n.length===0&&this.throwUnexpectedToken(),!this.eof()){const r=this.source.charCodeAt(this.index);(G.isIdentifierStart(r)||G.isDecimalDigit(r))&&this.throwUnexpectedToken()}return{type:E.NumericLiteral,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanOctalLiteral(t,n){let r="",a=!1;for(G.isOctalDigit(t.charCodeAt(0))?(a=!0,r="0"+this.source[this.index++]):++this.index;!this.eof()&&G.isOctalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];return a||r.length!==0||this.throwUnexpectedToken(),(G.isIdentifierStart(this.source.charCodeAt(this.index))||G.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:E.NumericLiteral,value:parseInt(r,8),lineNumber:this.lineNumber,lineStart:this.lineStart,start:n,end:this.index}}scanNumericLiteral(){const t=this.index;let n=this.source[t];Gr(G.isDecimalDigit(n.charCodeAt(0))||n===".","Numeric literal must start with a decimal digit or a decimal point");let r="";if(n!=="."){if(r=this.source[this.index++],n=this.source[this.index],r==="0"){if(n==="x"||n==="X")return++this.index,this.scanHexLiteral(t);if(n==="b"||n==="B")return++this.index,this.scanBinaryLiteral(t);if(n==="o"||n==="O")return this.scanOctalLiteral(n,t)}for(;G.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];n=this.source[this.index]}if(n==="."){for(r+=this.source[this.index++];G.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];n=this.source[this.index]}if(n==="e"||n==="E")if(r+=this.source[this.index++],n=this.source[this.index],n!=="+"&&n!=="-"||(r+=this.source[this.index++]),G.isDecimalDigit(this.source.charCodeAt(this.index)))for(;G.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];else this.throwUnexpectedToken();return G.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:E.NumericLiteral,value:parseFloat(r),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanStringLiteral(){const t=this.index;let n=this.source[t];Gr(n==="'"||n==='"',"String literal must starts with a quote"),++this.index;let r=!1,a="";for(;!this.eof();){let u=this.source[this.index++];if(u===n){n="";break}if(u==="\\")if(u=this.source[this.index++],u&&G.isLineTerminator(u.charCodeAt(0)))++this.lineNumber,u==="\r"&&this.source[this.index]===` + return this.prepareModule(runtimeCtx); `;const o=r.moduleFactory,i=r.moduleFactoryMap,s=r.exports,c={};for(const f in s)c[f]=r.mangleMap[f]!==void 0?r.mangleMap[f]:f;const p={lc:Ai,lang:Zi,mangles:r.mangleMap,prepareModule:f=>new It(f),prepare(f,m){let g=f.spatialReference;g==null&&(g=new yt({wkid:102100}));const x=Gi(f.vars,f.customfunctions,m,f.timeZone);return{localStack:[],isAsync:m,exports:s,exportmangle:c,gdefs:{},moduleFactory:o,moduleFactoryMap:i,moduleSingletons:f.moduleSingletons,mangleMap:this.mangles,spatialReference:g,globalScope:x,abortSignal:f.abortSignal===void 0||f.abortSignal===null?{aborted:!1}:f.abortSignal,localScope:null,services:f.services,console:f.console??tn,lrucache:f.lrucache,timeZone:f.timeZone??null,interceptor:f.interceptor,symbols:{symbolCounter:0},depthCounter:f.depthCounter}}};return new Function("context","spatialReference",u).bind(p)}var L,b;(function(e){e.Break="break",e.Continue="continue",e.Else="else",e.False="false",e.For="for",e.From="from",e.Function="function",e.If="if",e.Import="import",e.Export="export",e.In="in",e.Null="null",e.Return="return",e.True="true",e.Var="var",e.While="while"})(L||(L={})),function(e){e.AssignmentExpression="AssignmentExpression",e.ArrayExpression="ArrayExpression",e.BlockComment="BlockComment",e.BlockStatement="BlockStatement",e.BinaryExpression="BinaryExpression",e.BreakStatement="BreakStatement",e.CallExpression="CallExpression",e.ContinueStatement="ContinueStatement",e.EmptyStatement="EmptyStatement",e.ExpressionStatement="ExpressionStatement",e.ExportNamedDeclaration="ExportNamedDeclaration",e.ExportSpecifier="ExportSpecifier",e.ForStatement="ForStatement",e.ForInStatement="ForInStatement",e.FunctionDeclaration="FunctionDeclaration",e.Identifier="Identifier",e.IfStatement="IfStatement",e.ImportDeclaration="ImportDeclaration",e.ImportDefaultSpecifier="ImportDefaultSpecifier",e.LineComment="LineComment",e.Literal="Literal",e.LogicalExpression="LogicalExpression",e.MemberExpression="MemberExpression",e.ObjectExpression="ObjectExpression",e.Program="Program",e.Property="Property",e.ReturnStatement="ReturnStatement",e.TemplateElement="TemplateElement",e.TemplateLiteral="TemplateLiteral",e.UnaryExpression="UnaryExpression",e.UpdateExpression="UpdateExpression",e.VariableDeclaration="VariableDeclaration",e.VariableDeclarator="VariableDeclarator",e.WhileStatement="WhileStatement"}(b||(b={}));const Jn=["++","--"],Vi=["-","+","!","~"],qi=["=","/=","*=","%=","+=","-="],ji=["||","&&"],uu=["|","&",">>","<<",">>>","^","==","!=","<","<=",">",">=","+","-","*","/","%"],su={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10};var E;(function(e){e[e.Unknown=0]="Unknown",e[e.BooleanLiteral=1]="BooleanLiteral",e[e.EOF=2]="EOF",e[e.Identifier=3]="Identifier",e[e.Keyword=4]="Keyword",e[e.NullLiteral=5]="NullLiteral",e[e.NumericLiteral=6]="NumericLiteral",e[e.Punctuator=7]="Punctuator",e[e.StringLiteral=8]="StringLiteral",e[e.Template=10]="Template"})(E||(E={}));const lu=["Unknown","Boolean","","Identifier","Keyword","Null","Numeric","Punctuator","String","RegularExpression","Template"];var F;(function(e){e.InvalidModuleUri="InvalidModuleUri",e.ForInOfLoopInitializer="ForInOfLoopInitializer",e.IdentiferExpected="IdentiferExpected",e.InvalidEscapedReservedWord="InvalidEscapedReservedWord",e.InvalidExpression="InvalidExpression",e.InvalidFunctionIdentifier="InvalidFunctionIdentifier",e.InvalidHexEscapeSequence="InvalidHexEscapeSequence",e.InvalidLeftHandSideInAssignment="InvalidLeftHandSideInAssignment",e.InvalidLeftHandSideInForIn="InvalidLeftHandSideInForIn",e.InvalidTemplateHead="InvalidTemplateHead",e.InvalidVariableAssignment="InvalidVariableAssignment",e.KeyMustBeString="KeyMustBeString",e.NoFunctionInsideBlock="NoFunctionInsideBlock",e.NoFunctionInsideFunction="NoFunctionInsideFunction",e.ModuleExportRootOnly="ModuleExportRootOnly",e.ModuleImportRootOnly="ModuleImportRootOnly",e.PunctuatorExpected="PunctuatorExpected",e.TemplateOctalLiteral="TemplateOctalLiteral",e.UnexpectedBoolean="UnexpectedBoolean",e.UnexpectedEndOfScript="UnexpectedEndOfScript",e.UnexpectedIdentifier="UnexpectedIdentifier",e.UnexpectedKeyword="UnexpectedKeyword",e.UnexpectedNull="UnexpectedNull",e.UnexpectedNumber="UnexpectedNumber",e.UnexpectedPunctuator="UnexpectedPunctuator",e.UnexpectedString="UnexpectedString",e.UnexpectedTemplate="UnexpectedTemplate",e.UnexpectedToken="UnexpectedToken"})(F||(F={}));const cu={[F.InvalidModuleUri]:"Module uri must be a text literal.",[F.ForInOfLoopInitializer]:"for-in loop variable declaration may not have an initializer.",[F.IdentiferExpected]:"'${value}' is an invalid identifier.",[F.InvalidEscapedReservedWord]:"Keyword cannot contain escaped characters.",[F.InvalidExpression]:"Invalid expression.",[F.InvalidFunctionIdentifier]:"'${value}' is an invalid function identifier.",[F.InvalidHexEscapeSequence]:"Invalid hexadecimal escape sequence.",[F.InvalidLeftHandSideInAssignment]:"Invalid left-hand side in assignment.",[F.InvalidLeftHandSideInForIn]:"Invalid left-hand side in for-in.",[F.InvalidTemplateHead]:"Invalid template structure.",[F.InvalidVariableAssignment]:"Invalid variable assignment.",[F.KeyMustBeString]:"Object property keys must be a word starting with a letter.",[F.NoFunctionInsideBlock]:"Functions cannot be declared inside of code blocks.",[F.NoFunctionInsideFunction]:"Functions cannot be declared inside another function.",[F.ModuleExportRootOnly]:"Module exports cannot be declared inside of code blocks.",[F.ModuleImportRootOnly]:"Module import cannot be declared inside of code blocks.",[F.PunctuatorExpected]:"'${value}' expected.",[F.TemplateOctalLiteral]:"Octal literals are not allowed in template literals.",[F.UnexpectedBoolean]:"Unexpected boolean literal.",[F.UnexpectedEndOfScript]:"Unexpected end of Arcade expression.",[F.UnexpectedIdentifier]:"Unexpected identifier.",[F.UnexpectedKeyword]:"Unexpected keyword.",[F.UnexpectedNull]:"Unexpected null literal.",[F.UnexpectedNumber]:"Unexpected number.",[F.UnexpectedPunctuator]:"Unexpected ponctuator.",[F.UnexpectedString]:"Unexpected text literal.",[F.UnexpectedTemplate]:"Unexpected quasi '${value}'.",[F.UnexpectedToken]:"Unexpected token '${value}'."};let Ot=class Hi extends Error{constructor({code:t,index:n,line:r,column:a,len:u=0,description:o,data:i}){var s;super(`${o??t}`),this.declaredRootClass="esri.arcade.lib.parsingerror",this.name="ParsingError",this.code=t,this.index=n,this.line=r,this.column=a,this.len=u,this.data=i,this.description=o,this.range={start:{line:r,column:a-1},end:{line:r,column:a+u}},(s=Error.captureStackTrace)==null||s.call(Error,this,Hi)}};function du(e){return(e==null?void 0:e.type)===b.Program}function Ur(e){return(e==null?void 0:e.type)===b.BlockStatement}function fu(e){return(e==null?void 0:e.type)===b.BlockComment}function hu(e){return(e==null?void 0:e.type)===b.EmptyStatement}function mu(e){return(e==null?void 0:e.type)===b.VariableDeclarator}function bn(e,t){return!!t&&t.loc.end.line===e.loc.start.line&&t.loc.end.column<=e.loc.start.column}function zr(e,t){return e.range[0]>=t.range[0]&&e.range[1]<=t.range[1]}let pu=class{constructor(){this.comments=[],this._nodeStack=[],this._newComments=[]}insertInnerComments(t){if(!Ur(t)||t.body.length!==0)return;const n=[];for(let r=this._newComments.length-1;r>=0;--r){const a=this._newComments[r];t.range[1]>=a.range[0]&&(n.unshift(a),this._newComments.splice(r,1))}n.length&&(t.innerComments=n)}attachTrailingComments(t){if(!t)return;const n=this._nodeStack[this._nodeStack.length-1];if(Ur(t)&&zr(n,t))for(let a=this._newComments.length-1;a>=0;--a){const u=this._newComments[a];zr(u,t)&&(n.trailingComments=[...n.trailingComments??[],u],this._newComments.splice(a,1))}let r=[];if(this._newComments.length>0)for(let a=this._newComments.length-1;a>=0;--a){const u=this._newComments[a];bn(u,n)?(n.trailingComments=[...n.trailingComments??[],u],this._newComments.splice(a,1)):bn(u,t)&&(r.unshift(u),this._newComments.splice(a,1))}n!=null&&n.trailingComments&&bn(n.trailingComments[0],t)&&(r=[...r,...n.trailingComments],delete n.trailingComments),r.length>0&&(t.trailingComments=r)}attachLeadingComments(t){var u,o;if(!t)return;let n;for(;this._nodeStack.length>0;){const i=this._nodeStack[this._nodeStack.length-1];if(!(t.range[0]<=i.range[0]))break;n=i,this._nodeStack.pop()}const r=[],a=[];if(n){for(let i=(((u=n.leadingComments)==null?void 0:u.length)??0)-1;i>=0;--i){const s=n.leadingComments[i];t.range[0]>=s.range[1]?(r.unshift(s),n.leadingComments.splice(i,1)):mu(t)&&!fu(s)&&(a.unshift(s),n.leadingComments.splice(i,1))}return((o=n.leadingComments)==null?void 0:o.length)===0&&delete n.leadingComments,r.length&&(t.leadingComments=r),void(a.length&&(t.trailingComments=[...a,...t.trailingComments??[]]))}for(let i=this._newComments.length-1;i>=0;--i){const s=this._newComments[i];t.range[0]>=s.range[0]&&(r.unshift(s),this._newComments.splice(i,1))}r.length&&(t.leadingComments=r)}attachComments(t){if(du(t)&&t.body.length>0){const n=this._nodeStack[this._nodeStack.length-1];return n?(n.trailingComments=[...n.trailingComments??[],...this._newComments],this._newComments.length=0,void this._nodeStack.pop()):(t.trailingComments=[...this._newComments],void(this._newComments.length=0))}this.attachTrailingComments(t),this.attachLeadingComments(t),this.insertInnerComments(t),this._nodeStack.push(t)}collectComment(t){this.comments.push(t),this._newComments.push(t)}};function Vn(e,t){const n=cu[e];return t?n.replaceAll(/\${(.*?)}/g,(r,a)=>{var u;return((u=t[a])==null?void 0:u.toString())??""}):n}let Du=class{constructor(t=!1){this.tolerant=t,this.errors=[]}recordError(t){this.errors.push(t)}tolerate(t){if(!this.tolerant)throw t;this.recordError(t)}throwError(t){throw t.description=t.description??Vn(t.code,t.data),new Ot(t)}tolerateError(t){t.description=t.description??Vn(t.code,t.data);const n=new Ot(t);if(!this.tolerant)throw n;this.recordError(n)}};function Gr(e,t){if(!e)throw new Error("ASSERT: "+t)}const Zr={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD46\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E\uDC5F\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},G={fromCodePoint:e=>e<65536?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10))+String.fromCharCode(56320+(e-65536&1023)),isWhiteSpace:e=>e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e),isLineTerminator:e=>e===10||e===13||e===8232||e===8233,isIdentifierStart:e=>e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&Zr.NonAsciiIdentifierStart.test(G.fromCodePoint(e)),isIdentifierPart:e=>e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&Zr.NonAsciiIdentifierPart.test(G.fromCodePoint(e)),isDecimalDigit:e=>e>=48&&e<=57,isHexDigit:e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,isOctalDigit:e=>e>=48&&e<=55};function Jr(e){return"0123456789abcdef".indexOf(e.toLowerCase())}function En(e){return"01234567".indexOf(e)}const Xe=[[],[],[]];Jn.forEach(e=>Xe[e.length-1].push(e)),Vi.forEach(e=>Xe[e.length-1].push(e)),ji.forEach(e=>Xe[e.length-1].push(e)),qi.forEach(e=>Xe[e.length-1].push(e)),uu.forEach(e=>Xe[e.length-1].push(e));let gu=class{constructor(t,n){this.source=t,this.errorHandler=n,this._length=t.length,this.index=0,this.lineNumber=1,this.lineStart=0,this.curlyStack=[]}saveState(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart,curlyStack:this.curlyStack.slice()}}restoreState(t){this.index=t.index,this.lineNumber=t.lineNumber,this.lineStart=t.lineStart,this.curlyStack=t.curlyStack}eof(){return this.index>=this._length}throwUnexpectedToken(t=F.UnexpectedToken){this.errorHandler.throwError({code:t,index:this.index,line:this.lineNumber,column:this.index-this.lineStart+1})}tolerateUnexpectedToken(t=F.UnexpectedToken){this.errorHandler.tolerateError({code:t,index:this.index,line:this.lineNumber,column:this.index-this.lineStart+1})}skipSingleLineComment(t){const n=[],r=this.index-t,a={start:{line:this.lineNumber,column:this.index-this.lineStart-t},end:{line:0,column:0}};for(;!this.eof();){const u=this.source.charCodeAt(this.index);if(++this.index,G.isLineTerminator(u)){if(a){a.end={line:this.lineNumber,column:this.index-this.lineStart-1};const o={multiLine:!1,start:r+t,end:this.index-1,range:[r,this.index-1],loc:a};n.push(o)}return u===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index,n}}if(a){a.end={line:this.lineNumber,column:this.index-this.lineStart};const u={multiLine:!1,start:r+t,end:this.index,range:[r,this.index],loc:a};n.push(u)}return n}skipMultiLineComment(){const t=[],n=this.index-2,r={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{line:0,column:0}};for(;!this.eof();){const a=this.source.charCodeAt(this.index);if(G.isLineTerminator(a))a===13&&this.source.charCodeAt(this.index+1)===10&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(a===42){if(this.source.charCodeAt(this.index+1)===47){if(this.index+=2,r){r.end={line:this.lineNumber,column:this.index-this.lineStart};const u={multiLine:!0,start:n+2,end:this.index-2,range:[n,this.index],loc:r};t.push(u)}return t}++this.index}else++this.index}if(r){r.end={line:this.lineNumber,column:this.index-this.lineStart};const a={multiLine:!0,start:n+2,end:this.index,range:[n,this.index],loc:r};t.push(a)}return this.tolerateUnexpectedToken(),t}scanComments(){let t=[];for(;!this.eof();){let n=this.source.charCodeAt(this.index);if(G.isWhiteSpace(n))++this.index;else if(G.isLineTerminator(n))++this.index,n===13&&this.source.charCodeAt(this.index)===10&&++this.index,++this.lineNumber,this.lineStart=this.index;else{if(n!==47)break;if(n=this.source.charCodeAt(this.index+1),n===47){this.index+=2;const r=this.skipSingleLineComment(2);t=[...t,...r]}else{if(n!==42)break;{this.index+=2;const r=this.skipMultiLineComment();t=[...t,...r]}}}}return t}isKeyword(t){switch((t=t.toLowerCase()).length){case 2:return t===L.If||t===L.In;case 3:return t===L.Var||t===L.For;case 4:return t===L.Else;case 5:return t===L.Break||t===L.While;case 6:return t===L.Return||t===L.Import||t===L.Export;case 8:return t===L.Function||t===L.Continue;default:return!1}}codePointAt(t){let n=this.source.charCodeAt(t);if(n>=55296&&n<=56319){const r=this.source.charCodeAt(t+1);r>=56320&&r<=57343&&(n=1024*(n-55296)+r-56320+65536)}return n}scanHexEscape(t){const n=t==="u"?4:2;let r=0;for(let a=0;a1114111||t!=="}")&&this.throwUnexpectedToken(),G.fromCodePoint(n)}getIdentifier(){const t=this.index++;for(;!this.eof();){const n=this.source.charCodeAt(this.index);if(n===92)return this.index=t,this.getComplexIdentifier();if(n>=55296&&n<57343)return this.index=t,this.getComplexIdentifier();if(!G.isIdentifierPart(n))break;++this.index}return this.source.slice(t,this.index)}getComplexIdentifier(){let t,n=this.codePointAt(this.index),r=G.fromCodePoint(n);for(this.index+=r.length,n===92&&(this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,t=this.scanUnicodeCodePointEscape()):(t=this.scanHexEscape("u"),t!==null&&t!=="\\"&&G.isIdentifierStart(t.charCodeAt(0))||this.throwUnexpectedToken()),r=t);!this.eof()&&(n=this.codePointAt(this.index),G.isIdentifierPart(n));)t=G.fromCodePoint(n),r+=t,this.index+=t.length,n===92&&(r=r.substring(0,r.length-1),this.source.charCodeAt(this.index)!==117&&this.throwUnexpectedToken(),++this.index,this.source[this.index]==="{"?(++this.index,t=this.scanUnicodeCodePointEscape()):(t=this.scanHexEscape("u"),t!==null&&t!=="\\"&&G.isIdentifierPart(t.charCodeAt(0))||this.throwUnexpectedToken()),r+=t);return r}octalToDecimal(t){let n=t!=="0",r=En(t);return!this.eof()&&G.isOctalDigit(this.source.charCodeAt(this.index))&&(n=!0,r=8*r+En(this.source[this.index++]),"0123".includes(t)&&!this.eof()&&G.isOctalDigit(this.source.charCodeAt(this.index))&&(r=8*r+En(this.source[this.index++]))),{code:r,octal:n}}scanIdentifier(){let t;const n=this.index,r=this.source.charCodeAt(n)===92?this.getComplexIdentifier():this.getIdentifier();if(t=r.length===1?E.Identifier:this.isKeyword(r)?E.Keyword:r.toLowerCase()===L.Null?E.NullLiteral:r.toLowerCase()===L.True||r.toLowerCase()===L.False?E.BooleanLiteral:E.Identifier,t!==E.Identifier&&n+r.length!==this.index){const a=this.index;this.index=n,this.tolerateUnexpectedToken(F.InvalidEscapedReservedWord),this.index=a}return{type:t,value:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:n,end:this.index}}scanPunctuator(){const t=this.index;let n=this.source[this.index];switch(n){case"(":case"{":n==="{"&&this.curlyStack.push("{"),++this.index;break;case".":case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;case"}":++this.index,this.curlyStack.pop();break;default:for(let r=Xe.length;r>0;r--)if(n=this.source.substring(this.index,this.index+r),Xe[r-1].includes(n)){this.index+=r;break}}return this.index===t&&this.throwUnexpectedToken(),{type:E.Punctuator,value:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanHexLiteral(t){let n="";for(;!this.eof()&&G.isHexDigit(this.source.charCodeAt(this.index));)n+=this.source[this.index++];return n.length===0&&this.throwUnexpectedToken(),G.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:E.NumericLiteral,value:parseInt("0x"+n,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanBinaryLiteral(t){let n="";for(;!this.eof();){const r=this.source[this.index];if(r!=="0"&&r!=="1")break;n+=this.source[this.index++]}if(n.length===0&&this.throwUnexpectedToken(),!this.eof()){const r=this.source.charCodeAt(this.index);(G.isIdentifierStart(r)||G.isDecimalDigit(r))&&this.throwUnexpectedToken()}return{type:E.NumericLiteral,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanOctalLiteral(t,n){let r="",a=!1;for(G.isOctalDigit(t.charCodeAt(0))?(a=!0,r="0"+this.source[this.index++]):++this.index;!this.eof()&&G.isOctalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];return a||r.length!==0||this.throwUnexpectedToken(),(G.isIdentifierStart(this.source.charCodeAt(this.index))||G.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:E.NumericLiteral,value:parseInt(r,8),lineNumber:this.lineNumber,lineStart:this.lineStart,start:n,end:this.index}}scanNumericLiteral(){const t=this.index;let n=this.source[t];Gr(G.isDecimalDigit(n.charCodeAt(0))||n===".","Numeric literal must start with a decimal digit or a decimal point");let r="";if(n!=="."){if(r=this.source[this.index++],n=this.source[this.index],r==="0"){if(n==="x"||n==="X")return++this.index,this.scanHexLiteral(t);if(n==="b"||n==="B")return++this.index,this.scanBinaryLiteral(t);if(n==="o"||n==="O")return this.scanOctalLiteral(n,t)}for(;G.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];n=this.source[this.index]}if(n==="."){for(r+=this.source[this.index++];G.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];n=this.source[this.index]}if(n==="e"||n==="E")if(r+=this.source[this.index++],n=this.source[this.index],n!=="+"&&n!=="-"||(r+=this.source[this.index++]),G.isDecimalDigit(this.source.charCodeAt(this.index)))for(;G.isDecimalDigit(this.source.charCodeAt(this.index));)r+=this.source[this.index++];else this.throwUnexpectedToken();return G.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:E.NumericLiteral,value:parseFloat(r),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanStringLiteral(){const t=this.index;let n=this.source[t];Gr(n==="'"||n==='"',"String literal must starts with a quote"),++this.index;let r=!1,a="";for(;!this.eof();){let u=this.source[this.index++];if(u===n){n="";break}if(u==="\\")if(u=this.source[this.index++],u&&G.isLineTerminator(u.charCodeAt(0)))++this.lineNumber,u==="\r"&&this.source[this.index]===` `&&++this.index,this.lineStart=this.index;else switch(u){case"u":if(this.source[this.index]==="{")++this.index,a+=this.scanUnicodeCodePointEscape();else{const o=this.scanHexEscape(u);o===null&&this.throwUnexpectedToken(),a+=o}break;case"x":{const o=this.scanHexEscape(u);o===null&&this.throwUnexpectedToken(F.InvalidHexEscapeSequence),a+=o;break}case"n":a+=` `;break;case"r":a+="\r";break;case"t":a+=" ";break;case"b":a+="\b";break;case"f":a+="\f";break;case"v":a+="\v";break;case"8":case"9":a+=u,this.tolerateUnexpectedToken();break;default:if(u&&G.isOctalDigit(u.charCodeAt(0))){const o=this.octalToDecimal(u);r=o.octal||r,a+=String.fromCharCode(o.code)}else a+=u}else{if(G.isLineTerminator(u.charCodeAt(0)))break;a+=u}}return n!==""&&(this.index=t,this.throwUnexpectedToken()),{type:E.StringLiteral,value:a,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanTemplate(){let t="",n=!1;const r=this.index,a=this.source[r]==="`";let u=!1,o=2;for(++this.index;!this.eof();){let i=this.source[this.index++];if(i==="`"){o=1,u=!0,n=!0;break}if(i!=="$")if(i!=="\\")G.isLineTerminator(i.charCodeAt(0))?(++this.lineNumber,i==="\r"&&this.source[this.index]===` `&&++this.index,this.lineStart=this.index,t+=` `):t+=i;else if(i=this.source[this.index++],G.isLineTerminator(i.charCodeAt(0)))++this.lineNumber,i==="\r"&&this.source[this.index]===` `&&++this.index,this.lineStart=this.index;else switch(i){case"n":t+=` -`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"u":if(this.source[this.index]==="{")++this.index,t+=this.scanUnicodeCodePointEscape();else{const s=this.index,c=this.scanHexEscape(i);c!==null?t+=c:(this.index=s,t+=i)}break;case"x":{const s=this.scanHexEscape(i);s===null&&this.throwUnexpectedToken(F.InvalidHexEscapeSequence),t+=s;break}case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:i==="0"?(G.isDecimalDigit(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(F.TemplateOctalLiteral),t+="\0"):G.isOctalDigit(i.charCodeAt(0))?this.throwUnexpectedToken(F.TemplateOctalLiteral):t+=i}else{if(this.source[this.index]==="{"){this.curlyStack.push("${"),++this.index,n=!0;break}t+=i}}return n||this.throwUnexpectedToken(),a||this.curlyStack.pop(),{type:E.Template,value:this.source.slice(r+1,this.index-o),cooked:t,head:a,tail:u,lineNumber:this.lineNumber,lineStart:this.lineStart,start:r,end:this.index}}lex(){if(this.eof())return{type:E.EOF,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index};const t=this.source.charCodeAt(this.index);return G.isIdentifierStart(t)?this.scanIdentifier():t===40||t===41||t===59?this.scanPunctuator():t===39||t===34?this.scanStringLiteral():t===46?G.isDecimalDigit(this.source.charCodeAt(this.index+1))?this.scanNumericLiteral():this.scanPunctuator():G.isDecimalDigit(t)?this.scanNumericLiteral():t===96||t===125&&this.curlyStack[this.curlyStack.length-1]==="${"?this.scanTemplate():t>=55296&&t<57343&&G.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()}};var ce,Nt;function qr(e,t=0){let n=e.start-e.lineStart,r=e.lineNumber;return n<0&&(n+=t,r--),{index:e.start,line:r,column:n}}function Vr(e){return[{index:e.range[0],...e.loc.start},{index:e.range[1],...e.loc.end}]}function jr(e){return su[e]??0}(function(e){e[e.None=0]="None",e[e.Function=1]="Function",e[e.IfClause=2]="IfClause",e[e.ForLoop=4]="ForLoop",e[e.WhileLoop=8]="WhileLoop"})(ce||(ce={})),function(e){e[e.AsObject=0]="AsObject",e[e.Automatic=1]="Automatic"}(Nt||(Nt={}));class yu{constructor(t,n={},r){this.delegate=r,this.hasLineTerminator=!1,this.options={tokens:typeof n.tokens=="boolean"&&n.tokens,comments:typeof n.comments=="boolean"&&n.comments,tolerant:typeof n.tolerant=="boolean"&&n.tolerant},this.options.comments&&(this.commentHandler=new pu),this.errorHandler=new Du(this.options.tolerant),this.scanner=new gu(t,this.errorHandler),this.context={isAssignmentTarget:!1,blockContext:ce.None,curlyParsingType:Nt.AsObject},this.rawToken={type:E.EOF,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.endMarker={index:0,line:this.scanner.lineNumber,column:0},this.readNextRawToken(),this.endMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}throwIfInvalidType(t,n,{validTypes:r,invalidTypes:a}){r!=null&&r.some(u=>t.type===u)||a!=null&&a.some(u=>t.type===u)&&this.throwError(F.InvalidExpression,n)}throwError(t,n,r=this.endMarker){const{index:a,line:u,column:o}=n,i=r.index-a-1;this.errorHandler.throwError({code:t,index:a,line:u,column:o+1,len:i})}tolerateError(t,n){throw new Error("######################################### !!!")}unexpectedTokenError(t={}){const{rawToken:n}=t;let r,{code:a,data:u}=t;if(n){if(!a)switch(n.type){case E.EOF:a=F.UnexpectedEndOfScript;break;case E.Identifier:a=F.UnexpectedIdentifier;break;case E.NumericLiteral:a=F.UnexpectedNumber;break;case E.StringLiteral:a=F.UnexpectedString;break;case E.Template:a=F.UnexpectedTemplate}r=n.value.toString()}else r="ILLEGAL";a=a??F.UnexpectedToken,u||(u={value:r});const o=qn(a,u);if(n){const c=n.start,p=n.lineNumber,f=n.start-n.lineStart+1;return new Ot({code:a,index:c,line:p,column:f,len:n.end-n.start-1,data:u,description:o})}const{index:i,line:s}=this.endMarker;return new Ot({code:a,index:i,line:s,column:this.endMarker.column+1,data:u,description:o})}throwUnexpectedToken(t={}){throw t.rawToken=t.rawToken??this.rawToken,this.unexpectedTokenError(t)}collectComments(t){const{commentHandler:n}=this;n&&t.length&&t.forEach(r=>{const a={type:r.multiLine?b.BlockComment:b.LineComment,value:this.getSourceValue(r),range:r.range,loc:r.loc};n.collectComment(a)})}peekAhead(t){const n=()=>(this.scanner.scanComments(),this.scanner.lex()),r=this.scanner.saveState(),a=t.call(this,n);return this.scanner.restoreState(r),a}getSourceValue(t){return this.scanner.source.slice(t.start,t.end)}convertToToken(t){return{type:lu[t.type],value:this.getSourceValue(t),range:[t.start,t.end],loc:{start:{line:this.startMarker.line,column:this.startMarker.column},end:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}}}readNextRawToken(){this.endMarker.index=this.scanner.index,this.endMarker.line=this.scanner.lineNumber,this.endMarker.column=this.scanner.index-this.scanner.lineStart;const t=this.rawToken;this.collectComments(this.scanner.scanComments()),this.scanner.index!==this.startMarker.index&&(this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart),this.rawToken=this.scanner.lex(),this.hasLineTerminator=t.lineNumber!==this.rawToken.lineNumber,this.options.tokens&&this.rawToken.type!==E.EOF&&this.tokens.push(this.convertToToken(this.rawToken))}captureStartMarker(){return{index:this.startMarker.index,line:this.startMarker.line,column:this.startMarker.column}}getItemLocation(t){return{range:[t.index,this.endMarker.index],loc:{start:{line:t.line,column:t.column},end:{line:this.endMarker.line,column:this.endMarker.column}}}}finalize(t){var n,r;return(this.delegate||this.commentHandler)&&((n=this.commentHandler)==null||n.attachComments(t),(r=this.delegate)==null||r.call(this,t)),t}expectPunctuator(t){const n=this.rawToken;this.matchPunctuator(t)?this.readNextRawToken():this.throwUnexpectedToken({rawToken:n,code:F.PunctuatorExpected,data:{value:t}})}expectKeyword(t){this.rawToken.type!==E.Keyword||this.rawToken.value.toLowerCase()!==t?this.throwUnexpectedToken({rawToken:this.rawToken}):this.readNextRawToken()}expectContextualKeyword(t){this.rawToken.type!==E.Identifier||this.rawToken.value.toLowerCase()!==t?this.throwUnexpectedToken({rawToken:this.rawToken}):this.readNextRawToken()}matchKeyword(t){return this.rawToken.type===E.Keyword&&this.rawToken.value.toLowerCase()===t}matchContextualKeyword(t){return this.rawToken.type===E.Identifier&&this.rawToken.value===t}matchPunctuator(t){return this.rawToken.type===E.Punctuator&&this.rawToken.value===t}getMatchingPunctuator(t){if(typeof t=="string"&&(t=t.split("")),this.rawToken.type===E.Punctuator&&(t==null?void 0:t.length))return t.find(this.matchPunctuator,this)}isolateCoverGrammar(t){const n=this.context.isAssignmentTarget;this.context.isAssignmentTarget=!0;const r=t.call(this);return this.context.isAssignmentTarget=n,r}inheritCoverGrammar(t){const n=this.context.isAssignmentTarget;this.context.isAssignmentTarget=!0;const r=t.call(this);return this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,r}withBlockContext(t,n){const r=this.context.blockContext;this.context.blockContext=this.context.blockContext|t;const a=this.context.curlyParsingType;this.context.curlyParsingType=Nt.Automatic;const u=n.call(this);return this.context.blockContext=r,this.context.curlyParsingType=a,u}consumeSemicolon(){if(this.matchPunctuator(";"))this.readNextRawToken();else if(!this.hasLineTerminator)return this.rawToken.type===E.EOF||this.matchPunctuator("}")?(this.endMarker.index=this.startMarker.index,this.endMarker.line=this.startMarker.line,void(this.endMarker.column=this.startMarker.column)):void this.throwUnexpectedToken({rawToken:this.rawToken})}parsePrimaryExpression(){const t=this.captureStartMarker(),n=this.rawToken;switch(n.type){case E.Identifier:return this.readNextRawToken(),this.finalize({type:b.Identifier,name:n.value,...this.getItemLocation(t)});case E.NumericLiteral:case E.StringLiteral:return this.context.isAssignmentTarget=!1,this.readNextRawToken(),this.finalize({type:b.Literal,value:n.value,raw:this.getSourceValue(n),isString:typeof n.value=="string",...this.getItemLocation(t)});case E.BooleanLiteral:return this.context.isAssignmentTarget=!1,this.readNextRawToken(),this.finalize({type:b.Literal,value:n.value.toLowerCase()===L.True,raw:this.getSourceValue(n),isString:!1,...this.getItemLocation(t)});case E.NullLiteral:return this.context.isAssignmentTarget=!1,this.readNextRawToken(),this.finalize({type:b.Literal,value:null,raw:this.getSourceValue(n),isString:!1,...this.getItemLocation(t)});case E.Template:return this.parseTemplateLiteral();case E.Punctuator:switch(n.value){case"(":return this.inheritCoverGrammar(this.parseGroupExpression);case"[":return this.inheritCoverGrammar(this.parseArrayInitializer);case"{":return this.inheritCoverGrammar(this.parseObjectExpression);default:return this.throwUnexpectedToken({rawToken:this.rawToken})}case E.Keyword:return this.context.isAssignmentTarget=!1,this.throwUnexpectedToken({rawToken:this.rawToken});default:return this.throwUnexpectedToken({rawToken:this.rawToken})}}parseArrayInitializer(){const t=this.captureStartMarker();this.expectPunctuator("[");const n=[];for(;!this.matchPunctuator("]");){const r=this.captureStartMarker();this.matchPunctuator(",")?(this.readNextRawToken(),this.throwError(F.InvalidExpression,r)):(n.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.matchPunctuator("]")||this.expectPunctuator(","))}return this.expectPunctuator("]"),this.finalize({type:b.ArrayExpression,elements:n,...this.getItemLocation(t)})}parseObjectPropertyKey(){const t=this.captureStartMarker(),n=this.rawToken;switch(n.type){case E.StringLiteral:return this.readNextRawToken(),this.finalize({type:b.Literal,value:n.value,raw:this.getSourceValue(n),isString:!0,...this.getItemLocation(t)});case E.Identifier:case E.BooleanLiteral:case E.NullLiteral:case E.Keyword:return this.readNextRawToken(),this.finalize({type:b.Identifier,name:n.value,...this.getItemLocation(t)});default:this.throwError(F.KeyMustBeString,t)}}parseObjectProperty(){const t=this.rawToken,n=this.captureStartMarker(),r=this.parseObjectPropertyKey();let a=!1,u=null;return this.matchPunctuator(":")?(this.readNextRawToken(),u=this.inheritCoverGrammar(this.parseAssignmentExpression)):t.type===E.Identifier?(a=!0,u=this.finalize({type:b.Identifier,name:t.value,...this.getItemLocation(n)})):this.throwUnexpectedToken({rawToken:this.rawToken}),this.finalize({type:b.Property,kind:"init",key:r,value:u,shorthand:a,...this.getItemLocation(n)})}parseObjectExpression(){const t=this.captureStartMarker();this.expectPunctuator("{");const n=[];for(;!this.matchPunctuator("}");)n.push(this.parseObjectProperty()),this.matchPunctuator("}")||this.expectPunctuator(",");return this.expectPunctuator("}"),this.finalize({type:b.ObjectExpression,properties:n,...this.getItemLocation(t)})}parseTemplateElement(t=!1){const n=this.rawToken;n.type!==E.Template&&this.throwUnexpectedToken({rawToken:n}),t&&!n.head&&this.throwUnexpectedToken({code:F.InvalidTemplateHead,rawToken:n});const r=this.captureStartMarker();this.readNextRawToken();const{value:a,cooked:u,tail:o}=n,i=this.finalize({type:b.TemplateElement,value:{raw:a,cooked:u},tail:o,...this.getItemLocation(r)});return i.loc.start.column++,i.loc.end.column=i.loc.end.column-(o?1:2),i}parseTemplateLiteral(){const t=this.captureStartMarker(),n=[],r=[];let a=this.parseTemplateElement(!0);for(r.push(a);!a.tail;)n.push(this.parseExpression()),a=this.parseTemplateElement(),r.push(a);return this.finalize({type:b.TemplateLiteral,quasis:r,expressions:n,...this.getItemLocation(t)})}parseGroupExpression(){this.expectPunctuator("(");const t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.expectPunctuator(")"),t}parseArguments(){this.expectPunctuator("(");const t=[];if(!this.matchPunctuator(")"))for(;;){const n=this.isolateCoverGrammar(this.parseAssignmentExpression);if(t.push(n),this.matchPunctuator(")")||(this.expectPunctuator(","),this.matchPunctuator(")")))break}return this.expectPunctuator(")"),t}parseMemberName(){const t=this.rawToken,n=this.captureStartMarker();return this.readNextRawToken(),t.type!==E.NullLiteral&&t.type!==E.Identifier&&t.type!==E.Keyword&&t.type!==E.BooleanLiteral&&this.throwUnexpectedToken({rawToken:t}),this.finalize({type:b.Identifier,name:t.value,...this.getItemLocation(n)})}parseLeftHandSideExpression(){const t=this.captureStartMarker();let n=this.inheritCoverGrammar(this.parsePrimaryExpression);const r=this.captureStartMarker();let a;for(;a=this.getMatchingPunctuator("([.");)switch(a){case"(":{this.context.isAssignmentTarget=!1,n.type!==b.Identifier&&n.type!==b.MemberExpression&&this.throwError(F.IdentiferExpected,t,r);const u=this.parseArguments();n=this.finalize({type:b.CallExpression,callee:n,arguments:u,...this.getItemLocation(t)});continue}case"[":{this.context.isAssignmentTarget=!0,this.expectPunctuator("[");const u=this.isolateCoverGrammar(this.parseExpression);this.expectPunctuator("]"),n=this.finalize({type:b.MemberExpression,computed:!0,object:n,property:u,...this.getItemLocation(t)});continue}case".":{this.context.isAssignmentTarget=!0,this.expectPunctuator(".");const u=this.parseMemberName();n=this.finalize({type:b.MemberExpression,computed:!1,object:n,property:u,...this.getItemLocation(t)});continue}}return n}parseUpdateExpression(){const t=this.captureStartMarker();let n=this.getMatchingPunctuator(Jn);if(n){this.readNextRawToken();const o=this.captureStartMarker(),i=this.inheritCoverGrammar(this.parseUnaryExpression);return i.type!==b.Identifier&&i.type!==b.MemberExpression&&i.type!==b.CallExpression&&this.throwError(F.InvalidExpression,o),this.context.isAssignmentTarget||this.tolerateError(F.InvalidLeftHandSideInAssignment,t),this.context.isAssignmentTarget=!1,this.finalize({type:b.UpdateExpression,operator:n,argument:i,prefix:!0,...this.getItemLocation(t)})}const r=this.captureStartMarker(),a=this.inheritCoverGrammar(this.parseLeftHandSideExpression),u=this.captureStartMarker();return this.hasLineTerminator?a:(n=this.getMatchingPunctuator(Jn),n?(a.type!==b.Identifier&&a.type!==b.MemberExpression&&this.throwError(F.InvalidExpression,r,u),this.context.isAssignmentTarget||this.tolerateError(F.InvalidLeftHandSideInAssignment,t),this.readNextRawToken(),this.context.isAssignmentTarget=!1,this.finalize({type:b.UpdateExpression,operator:n,argument:a,prefix:!1,...this.getItemLocation(t)})):a)}parseUnaryExpression(){const t=this.getMatchingPunctuator(qi);if(t){const n=this.captureStartMarker();this.readNextRawToken();const r=this.inheritCoverGrammar(this.parseUnaryExpression);return this.context.isAssignmentTarget=!1,this.finalize({type:b.UnaryExpression,operator:t,argument:r,prefix:!0,...this.getItemLocation(n)})}return this.parseUpdateExpression()}parseBinaryExpression(){const t=this.rawToken;let n=this.inheritCoverGrammar(this.parseUnaryExpression);if(this.rawToken.type!==E.Punctuator)return n;const r=this.rawToken.value;let a=jr(r);if(a===0)return n;this.readNextRawToken(),this.context.isAssignmentTarget=!1;const u=[t,this.rawToken];let o=n,i=this.inheritCoverGrammar(this.parseUnaryExpression);const s=[o,r,i],c=[a];for(;this.rawToken.type===E.Punctuator&&(a=jr(this.rawToken.value))>0;){for(;s.length>2&&a<=c[c.length-1];){i=s.pop();const m=s.pop();c.pop(),o=s.pop(),u.pop();const g=u[u.length-1],x=qr(g,g.lineStart);s.push(this.finalize(this.createBinaryOrLogicalExpression(x,m,o,i)))}s.push(this.rawToken.value),c.push(a),u.push(this.rawToken),this.readNextRawToken(),s.push(this.inheritCoverGrammar(this.parseUnaryExpression))}let p=s.length-1;n=s[p];let f=u.pop();for(;p>1;){const m=u.pop();if(!m)break;const g=f==null?void 0:f.lineStart,x=qr(m,g),M=s[p-1];n=this.finalize(this.createBinaryOrLogicalExpression(x,M,s[p-2],n)),p-=2,f=m}return n}createBinaryOrLogicalExpression(t,n,r,a){const u=ji.includes(n)?b.LogicalExpression:b.BinaryExpression;return u===b.BinaryExpression||(r.type!==b.AssignmentExpression&&r.type!==b.UpdateExpression||this.throwError(F.InvalidExpression,...Vr(r)),a.type!==b.AssignmentExpression&&a.type!==b.UpdateExpression||this.throwError(F.InvalidExpression,...Vr(r))),{type:u,operator:n,left:r,right:a,...this.getItemLocation(t)}}parseAssignmentExpression(){const t=this.captureStartMarker(),n=this.inheritCoverGrammar(this.parseBinaryExpression),r=this.captureStartMarker(),a=this.getMatchingPunctuator(Vi);if(!a)return n;n.type!==b.Identifier&&n.type!==b.MemberExpression&&this.throwError(F.InvalidExpression,t,r),this.context.isAssignmentTarget||this.tolerateError(F.InvalidLeftHandSideInAssignment,t),this.matchPunctuator("=")||(this.context.isAssignmentTarget=!1),this.readNextRawToken();const u=this.isolateCoverGrammar(this.parseAssignmentExpression);return this.finalize({type:b.AssignmentExpression,left:n,operator:a,right:u,...this.getItemLocation(t)})}parseExpression(){return this.isolateCoverGrammar(this.parseAssignmentExpression)}parseStatements(t){const n=[];for(;this.rawToken.type!==E.EOF&&!this.matchPunctuator(t);){const r=this.parseStatementListItem();hu(r)||n.push(r)}return n}parseStatementListItem(){return this.context.isAssignmentTarget=!0,this.matchKeyword(L.Function)?this.parseFunctionDeclaration():this.matchKeyword(L.Export)?this.parseExportDeclaration():this.matchKeyword(L.Import)?this.parseImportDeclaration():this.parseStatement()}parseBlock(){const t=this.captureStartMarker();this.expectPunctuator("{");const n=this.parseStatements("}");return this.expectPunctuator("}"),this.finalize({type:b.BlockStatement,body:n,...this.getItemLocation(t)})}parseObjectStatement(){const t=this.captureStartMarker(),n=this.parseObjectExpression();return this.finalize({type:b.ExpressionStatement,expression:n,...this.getItemLocation(t)})}parseBlockOrObjectStatement(){return this.context.curlyParsingType===Nt.AsObject?this.parseObjectStatement():this.peekAhead(t=>{let n=t();return(n.type===E.Identifier||n.type===E.StringLiteral)&&(n=t(),n.type===E.Punctuator&&n.value===":")})?this.parseObjectStatement():this.parseBlock()}parseIdentifier(){const t=this.rawToken;if(t.type!==E.Identifier)return null;const n=this.captureStartMarker();return this.readNextRawToken(),this.finalize({type:b.Identifier,name:t.value,...this.getItemLocation(n)})}parseVariableDeclarator(){const t=this.captureStartMarker(),n=this.parseIdentifier();n||this.throwUnexpectedToken({code:F.IdentiferExpected});let r=null;if(this.matchPunctuator("=")){this.readNextRawToken();const a=this.rawToken;try{r=this.isolateCoverGrammar(this.parseAssignmentExpression)}catch{this.throwUnexpectedToken({rawToken:a,code:F.InvalidVariableAssignment})}}return this.finalize({type:b.VariableDeclarator,id:n,init:r,...this.getItemLocation(t)})}parseVariableDeclarationList(){const t=[this.parseVariableDeclarator()];for(;this.matchPunctuator(",");)this.readNextRawToken(),t.push(this.parseVariableDeclarator());return t}parseVariableDeclaration(){const t=this.captureStartMarker();this.expectKeyword(L.Var);const n=this.parseVariableDeclarationList();return this.consumeSemicolon(),this.finalize({type:b.VariableDeclaration,declarations:n,kind:"var",...this.getItemLocation(t)})}parseEmptyStatement(){const t=this.captureStartMarker();return this.expectPunctuator(";"),this.finalize({type:b.EmptyStatement,...this.getItemLocation(t)})}parseExpressionStatement(){const t=this.captureStartMarker(),n=this.parseExpression();return this.consumeSemicolon(),this.finalize({type:b.ExpressionStatement,expression:n,...this.getItemLocation(t)})}parseIfClause(){return this.withBlockContext(ce.IfClause,this.parseStatement)}parseIfStatement(){const t=this.captureStartMarker();this.expectKeyword(L.If),this.expectPunctuator("(");const n=this.captureStartMarker(),r=this.parseExpression(),a=this.captureStartMarker();this.expectPunctuator(")"),r.type!==b.AssignmentExpression&&r.type!==b.UpdateExpression||this.throwError(F.InvalidExpression,n,a);const u=this.parseIfClause();let o=null;return this.matchKeyword(L.Else)&&(this.readNextRawToken(),o=this.parseIfClause()),this.finalize({type:b.IfStatement,test:r,consequent:u,alternate:o,...this.getItemLocation(t)})}parseWhileStatement(){const t=this.captureStartMarker();this.expectKeyword(L.While),this.expectPunctuator("(");const n=this.captureStartMarker(),r=this.parseExpression(),a=this.captureStartMarker();this.expectPunctuator(")"),r.type!==b.AssignmentExpression&&r.type!==b.UpdateExpression||this.throwError(F.InvalidExpression,n,a);const u=this.withBlockContext(ce.WhileLoop,this.parseStatement);return this.finalize({type:b.WhileStatement,test:r,body:u,...this.getItemLocation(t)})}parseForStatement(){let t=null,n=null,r=null,a=null,u=null;const o=this.captureStartMarker();if(this.expectKeyword(L.For),this.expectPunctuator("("),this.matchPunctuator(";"))this.readNextRawToken();else if(this.matchKeyword(L.Var)){const s=this.captureStartMarker();this.readNextRawToken();const c=this.parseVariableDeclarationList();c.length===1&&this.matchKeyword(L.In)?(c[0].init&&this.throwError(F.ForInOfLoopInitializer,s),a=this.finalize({type:b.VariableDeclaration,declarations:c,kind:"var",...this.getItemLocation(s)}),this.readNextRawToken(),u=this.parseExpression()):(this.matchKeyword(L.In)&&this.throwError(F.InvalidLeftHandSideInForIn,s),t=this.finalize({type:b.VariableDeclaration,declarations:c,kind:"var",...this.getItemLocation(s)}),this.expectPunctuator(";"))}else{const s=this.context.isAssignmentTarget,c=this.captureStartMarker();t=this.inheritCoverGrammar(this.parseAssignmentExpression),this.matchKeyword(L.In)?(this.context.isAssignmentTarget||this.tolerateError(F.InvalidLeftHandSideInForIn,c),t.type!==b.Identifier&&this.throwError(F.InvalidLeftHandSideInForIn,c),this.readNextRawToken(),a=t,u=this.parseExpression(),t=null):(this.context.isAssignmentTarget=s,this.expectPunctuator(";"))}a||(this.matchPunctuator(";")||(n=this.isolateCoverGrammar(this.parseExpression)),this.expectPunctuator(";"),this.matchPunctuator(")")||(r=this.isolateCoverGrammar(this.parseExpression))),this.expectPunctuator(")");const i=this.withBlockContext(ce.ForLoop,()=>this.isolateCoverGrammar(this.parseStatement));return a&&u?this.finalize({type:b.ForInStatement,left:a,right:u,body:i,...this.getItemLocation(o)}):this.finalize({type:b.ForStatement,init:t,test:n,update:r,body:i,...this.getItemLocation(o)})}parseContinueStatement(){const t=this.captureStartMarker();return this.expectKeyword(L.Continue),this.consumeSemicolon(),this.finalize({type:b.ContinueStatement,...this.getItemLocation(t)})}parseBreakStatement(){const t=this.captureStartMarker();return this.expectKeyword(L.Break),this.consumeSemicolon(),this.finalize({type:b.BreakStatement,...this.getItemLocation(t)})}parseReturnStatement(){const t=this.captureStartMarker();this.expectKeyword(L.Return);const n=!this.matchPunctuator(";")&&!this.matchPunctuator("}")&&!this.hasLineTerminator&&this.rawToken.type!==E.EOF||this.rawToken.type===E.StringLiteral||this.rawToken.type===E.Template?this.parseExpression():null;return this.consumeSemicolon(),this.finalize({type:b.ReturnStatement,argument:n,...this.getItemLocation(t)})}parseStatement(){switch(this.rawToken.type){case E.BooleanLiteral:case E.NullLiteral:case E.NumericLiteral:case E.StringLiteral:case E.Template:case E.Identifier:return this.parseExpressionStatement();case E.Punctuator:return this.rawToken.value==="{"?this.parseBlockOrObjectStatement():this.rawToken.value==="("?this.parseExpressionStatement():this.rawToken.value===";"?this.parseEmptyStatement():this.parseExpressionStatement();case E.Keyword:switch(this.rawToken.value.toLowerCase()){case L.Break:return this.parseBreakStatement();case L.Continue:return this.parseContinueStatement();case L.For:return this.parseForStatement();case L.Function:return this.parseFunctionDeclaration();case L.If:return this.parseIfStatement();case L.Return:return this.parseReturnStatement();case L.Var:return this.parseVariableDeclaration();case L.While:return this.parseWhileStatement();default:return this.parseExpressionStatement()}default:return this.throwUnexpectedToken({rawToken:this.rawToken})}}parseFormalParameters(){const t=[];if(this.expectPunctuator("("),!this.matchPunctuator(")"))for(;this.rawToken.type!==E.EOF;){const n=this.parseIdentifier();if(n||this.throwUnexpectedToken({rawToken:this.rawToken,code:F.IdentiferExpected}),t.push(n),this.matchPunctuator(")")||(this.expectPunctuator(","),this.matchPunctuator(")")))break}return this.expectPunctuator(")"),t}parseFunctionDeclaration(){(this.context.blockContext&ce.Function)===ce.Function&&this.throwUnexpectedToken({code:F.NoFunctionInsideFunction}),(this.context.blockContext&ce.WhileLoop)!==ce.WhileLoop&&(this.context.blockContext&ce.IfClause)!==ce.IfClause||this.throwUnexpectedToken({code:F.NoFunctionInsideBlock});const t=this.captureStartMarker();this.expectKeyword(L.Function);const n=this.parseIdentifier();n||this.throwUnexpectedToken({code:F.InvalidFunctionIdentifier});const r=this.parseFormalParameters(),a=this.context.blockContext;this.context.blockContext=this.context.blockContext|ce.Function;const u=this.parseBlock();return this.context.blockContext=a,this.finalize({type:b.FunctionDeclaration,id:n,params:r,body:u,...this.getItemLocation(t)})}parseScript(){const t=this.captureStartMarker(),n=this.parseStatements(),r=this.finalize({type:b.Program,body:n,...this.getItemLocation(t)});return this.options.tokens&&(r.tokens=this.tokens),this.options.tolerant&&(r.errors=this.errorHandler.errors),r}parseExportDeclaration(){this.context.blockContext!==ce.None&&this.throwUnexpectedToken({code:F.ModuleExportRootOnly});let t=null;const n=this.captureStartMarker();return this.expectKeyword(L.Export),this.matchKeyword(L.Var)?t=this.parseVariableDeclaration():this.matchKeyword("function")?t=this.parseFunctionDeclaration():this.throwUnexpectedToken({code:F.InvalidExpression}),this.finalize({type:b.ExportNamedDeclaration,declaration:t,specifiers:[],source:null,...this.getItemLocation(n)})}parseModuleSpecifier(){const t=this.captureStartMarker(),n=this.rawToken;if(n.type===E.StringLiteral)return this.readNextRawToken(),this.finalize({type:b.Literal,value:n.value,raw:this.getSourceValue(n),isString:!0,...this.getItemLocation(t)});this.throwError(F.InvalidModuleUri,t)}parseDefaultSpecifier(){const t=this.captureStartMarker(),n=this.parseIdentifier();return n||this.throwUnexpectedToken({code:F.IdentiferExpected}),this.finalize({type:b.ImportDefaultSpecifier,local:n,...this.getItemLocation(t)})}parseImportDeclaration(){this.context.blockContext!==ce.None&&this.throwUnexpectedToken({code:F.ModuleImportRootOnly});const t=this.captureStartMarker();this.expectKeyword(L.Import);const n=this.parseDefaultSpecifier();this.expectContextualKeyword(L.From);const r=this.parseModuleSpecifier();return this.finalize({type:b.ImportDeclaration,specifiers:[n],source:r,...this.getItemLocation(t)})}}function wu(e,t,n){return new yu(e,t,n).parseScript()}function nn(e,t=[]){const n=wu(e);if(n.body===null||n.body===void 0)throw new Ot({index:0,line:0,column:0,data:null,description:"",code:F.InvalidExpression});return n.loadedModules={},zt(n,t),n}class rn{constructor(t){const n=this;n._keys=[],n._values=[],n.length=0,t&&t.forEach(r=>{n.set(r[0],r[1])})}entries(){return[].slice.call(this.keys().map((t,n)=>[t,this._values[n]]))}keys(){return[].slice.call(this._keys)}values(){return[].slice.call(this._values)}has(t){return this._keys.includes(t)}get(t){const n=this._keys.indexOf(t);return n>-1?this._values[n]:null}deepGet(t){if(!(t!=null&&t.length))return null;const n=(r,a)=>r==null?null:a.length?n(r instanceof rn?r.get(a[0]):r[a[0]],a.slice(1)):r;return n(this.get(t[0]),t.slice(1))}set(t,n){const r=this,a=this._keys.indexOf(t);return a>-1?r._values[a]=n:(r._keys.push(t),r._values.push(n),r.length=r._values.length),this}sortedSet(t,n,r,a){const u=this,o=this._keys.length,i=r||0,s=a!==void 0?a:o-1;if(o===0)return u._keys.push(t),u._values.push(n),u;if(t===this._keys[i])return this._values.splice(i,0,n),this;if(t===this._keys[s])return this._values.splice(s,0,n),this;if(t>this._keys[s])return this._keys.splice(s+1,0,t),this._values.splice(s+1,0,n),this;if(t=s)return this;const c=i+Math.floor((s-i)/2);return tthis._keys[c]?this.sortedSet(t,n,c+1,s):this}size(){return this.length}clear(){const t=this;return t._keys.length=t.length=t._values.length=0,this}delete(t){const n=this,r=n._keys.indexOf(t);return r>-1&&(n._keys.splice(r,1),n._values.splice(r,1),n.length=n._keys.length,!0)}forEach(t){this._keys.forEach((n,r)=>{t(this._values[r],n,r)})}map(t){return this.keys().map((n,r)=>t(this._values[r],n,r))}filter(t){const n=this;return n._keys.forEach((r,a)=>{t(n._values[a],r,a)===!1&&n.delete(r)}),this}clone(){return new rn(this.entries())}}class Hr{constructor(t=20){this._maxEntries=t,this._values=new rn}delete(t){this._values.has(t)&&this._values.delete(t)}get(t){let n=null;return this._values.has(t)&&(n=this._values.get(t),this._values.delete(t),this._values.set(t,n)),n}put(t,n){if(this._values.size()>=this._maxEntries){const r=this._values.keys()[0];this._values.delete(r)}this._values.set(t,n)}}class xu{constructor(t=20){this._maxEntries=t,this._cache=new Hr(this._maxEntries)}clear(){this._cache=new Hr(this._maxEntries)}addToCache(t,n){this._cache.put(t,n)}removeFromCache(t){this._cache.delete(t)}getFromCache(t){return this._cache.get(t)}}class me{constructor(t){this.portalUri=t}normalizeModuleUri(t){const n=/^[a-z0-9A-Z]+(@[0-9]+\.[0-9]+\.[0-9]+)?([\?|\/].*)?$/gi,r=/(?.+)\/home\/item\.html\?id\=(?.+)$/gi,a=/(?.+)\/sharing\/rest\/content\/users\/[a-zA-Z0-9]+\/items\/(?.+)$/gi,u=/(?.+)\/sharing\/rest\/content\/items\/(?.+)$/gi,o=/(?.*)@(?[0-9]+\.[0-9]+\.[0-9]+)([\?|\/].*)?$/gi;if(t.startsWith("portal+")){let i=t.substring(7),s="",c=i,p=!1;for(const g of[r,u,a]){const x=g.exec(i);if(x!==null){const M=x.groups;c=M.itemid,s=M.portalurl,p=!0;break}}if(p===!1){if(!n.test(i))throw new pn(et.UnsupportedUriProtocol,{uri:t});c=i,s=this.portalUri}c.includes("/")&&(c=c.split("/")[0]),c.includes("?")&&(c=c.split("?")[0]);let f="current";const m=o.exec(c);if(m!==null){const g=m.groups;c=g.itemid,f=g.versionstring}return i=new Wn({url:s}).restUrl+"/content/items/"+c+"/resources/"+f+".arc",{url:i,scheme:"portal",uri:"PO:"+i}}if(t.startsWith("mock")){if(t==="mock")return{url:"",scheme:"mock",data:` +`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"u":if(this.source[this.index]==="{")++this.index,t+=this.scanUnicodeCodePointEscape();else{const s=this.index,c=this.scanHexEscape(i);c!==null?t+=c:(this.index=s,t+=i)}break;case"x":{const s=this.scanHexEscape(i);s===null&&this.throwUnexpectedToken(F.InvalidHexEscapeSequence),t+=s;break}case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:i==="0"?(G.isDecimalDigit(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(F.TemplateOctalLiteral),t+="\0"):G.isOctalDigit(i.charCodeAt(0))?this.throwUnexpectedToken(F.TemplateOctalLiteral):t+=i}else{if(this.source[this.index]==="{"){this.curlyStack.push("${"),++this.index,n=!0;break}t+=i}}return n||this.throwUnexpectedToken(),a||this.curlyStack.pop(),{type:E.Template,value:this.source.slice(r+1,this.index-o),cooked:t,head:a,tail:u,lineNumber:this.lineNumber,lineStart:this.lineStart,start:r,end:this.index}}lex(){if(this.eof())return{type:E.EOF,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index};const t=this.source.charCodeAt(this.index);return G.isIdentifierStart(t)?this.scanIdentifier():t===40||t===41||t===59?this.scanPunctuator():t===39||t===34?this.scanStringLiteral():t===46?G.isDecimalDigit(this.source.charCodeAt(this.index+1))?this.scanNumericLiteral():this.scanPunctuator():G.isDecimalDigit(t)?this.scanNumericLiteral():t===96||t===125&&this.curlyStack[this.curlyStack.length-1]==="${"?this.scanTemplate():t>=55296&&t<57343&&G.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()}};var ce,Nt;function Vr(e,t=0){let n=e.start-e.lineStart,r=e.lineNumber;return n<0&&(n+=t,r--),{index:e.start,line:r,column:n}}function qr(e){return[{index:e.range[0],...e.loc.start},{index:e.range[1],...e.loc.end}]}function jr(e){return su[e]??0}(function(e){e[e.None=0]="None",e[e.Function=1]="Function",e[e.IfClause=2]="IfClause",e[e.ForLoop=4]="ForLoop",e[e.WhileLoop=8]="WhileLoop"})(ce||(ce={})),function(e){e[e.AsObject=0]="AsObject",e[e.Automatic=1]="Automatic"}(Nt||(Nt={}));class yu{constructor(t,n={},r){this.delegate=r,this.hasLineTerminator=!1,this.options={tokens:typeof n.tokens=="boolean"&&n.tokens,comments:typeof n.comments=="boolean"&&n.comments,tolerant:typeof n.tolerant=="boolean"&&n.tolerant},this.options.comments&&(this.commentHandler=new pu),this.errorHandler=new Du(this.options.tolerant),this.scanner=new gu(t,this.errorHandler),this.context={isAssignmentTarget:!1,blockContext:ce.None,curlyParsingType:Nt.AsObject},this.rawToken={type:E.EOF,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.endMarker={index:0,line:this.scanner.lineNumber,column:0},this.readNextRawToken(),this.endMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}throwIfInvalidType(t,n,{validTypes:r,invalidTypes:a}){r!=null&&r.some(u=>t.type===u)||a!=null&&a.some(u=>t.type===u)&&this.throwError(F.InvalidExpression,n)}throwError(t,n,r=this.endMarker){const{index:a,line:u,column:o}=n,i=r.index-a-1;this.errorHandler.throwError({code:t,index:a,line:u,column:o+1,len:i})}tolerateError(t,n){throw new Error("######################################### !!!")}unexpectedTokenError(t={}){const{rawToken:n}=t;let r,{code:a,data:u}=t;if(n){if(!a)switch(n.type){case E.EOF:a=F.UnexpectedEndOfScript;break;case E.Identifier:a=F.UnexpectedIdentifier;break;case E.NumericLiteral:a=F.UnexpectedNumber;break;case E.StringLiteral:a=F.UnexpectedString;break;case E.Template:a=F.UnexpectedTemplate}r=n.value.toString()}else r="ILLEGAL";a=a??F.UnexpectedToken,u||(u={value:r});const o=Vn(a,u);if(n){const c=n.start,p=n.lineNumber,f=n.start-n.lineStart+1;return new Ot({code:a,index:c,line:p,column:f,len:n.end-n.start-1,data:u,description:o})}const{index:i,line:s}=this.endMarker;return new Ot({code:a,index:i,line:s,column:this.endMarker.column+1,data:u,description:o})}throwUnexpectedToken(t={}){throw t.rawToken=t.rawToken??this.rawToken,this.unexpectedTokenError(t)}collectComments(t){const{commentHandler:n}=this;n&&t.length&&t.forEach(r=>{const a={type:r.multiLine?b.BlockComment:b.LineComment,value:this.getSourceValue(r),range:r.range,loc:r.loc};n.collectComment(a)})}peekAhead(t){const n=()=>(this.scanner.scanComments(),this.scanner.lex()),r=this.scanner.saveState(),a=t.call(this,n);return this.scanner.restoreState(r),a}getSourceValue(t){return this.scanner.source.slice(t.start,t.end)}convertToToken(t){return{type:lu[t.type],value:this.getSourceValue(t),range:[t.start,t.end],loc:{start:{line:this.startMarker.line,column:this.startMarker.column},end:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}}}readNextRawToken(){this.endMarker.index=this.scanner.index,this.endMarker.line=this.scanner.lineNumber,this.endMarker.column=this.scanner.index-this.scanner.lineStart;const t=this.rawToken;this.collectComments(this.scanner.scanComments()),this.scanner.index!==this.startMarker.index&&(this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart),this.rawToken=this.scanner.lex(),this.hasLineTerminator=t.lineNumber!==this.rawToken.lineNumber,this.options.tokens&&this.rawToken.type!==E.EOF&&this.tokens.push(this.convertToToken(this.rawToken))}captureStartMarker(){return{index:this.startMarker.index,line:this.startMarker.line,column:this.startMarker.column}}getItemLocation(t){return{range:[t.index,this.endMarker.index],loc:{start:{line:t.line,column:t.column},end:{line:this.endMarker.line,column:this.endMarker.column}}}}finalize(t){var n,r;return(this.delegate||this.commentHandler)&&((n=this.commentHandler)==null||n.attachComments(t),(r=this.delegate)==null||r.call(this,t)),t}expectPunctuator(t){const n=this.rawToken;this.matchPunctuator(t)?this.readNextRawToken():this.throwUnexpectedToken({rawToken:n,code:F.PunctuatorExpected,data:{value:t}})}expectKeyword(t){this.rawToken.type!==E.Keyword||this.rawToken.value.toLowerCase()!==t?this.throwUnexpectedToken({rawToken:this.rawToken}):this.readNextRawToken()}expectContextualKeyword(t){this.rawToken.type!==E.Identifier||this.rawToken.value.toLowerCase()!==t?this.throwUnexpectedToken({rawToken:this.rawToken}):this.readNextRawToken()}matchKeyword(t){return this.rawToken.type===E.Keyword&&this.rawToken.value.toLowerCase()===t}matchContextualKeyword(t){return this.rawToken.type===E.Identifier&&this.rawToken.value===t}matchPunctuator(t){return this.rawToken.type===E.Punctuator&&this.rawToken.value===t}getMatchingPunctuator(t){if(typeof t=="string"&&(t=t.split("")),this.rawToken.type===E.Punctuator&&(t==null?void 0:t.length))return t.find(this.matchPunctuator,this)}isolateCoverGrammar(t){const n=this.context.isAssignmentTarget;this.context.isAssignmentTarget=!0;const r=t.call(this);return this.context.isAssignmentTarget=n,r}inheritCoverGrammar(t){const n=this.context.isAssignmentTarget;this.context.isAssignmentTarget=!0;const r=t.call(this);return this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,r}withBlockContext(t,n){const r=this.context.blockContext;this.context.blockContext=this.context.blockContext|t;const a=this.context.curlyParsingType;this.context.curlyParsingType=Nt.Automatic;const u=n.call(this);return this.context.blockContext=r,this.context.curlyParsingType=a,u}consumeSemicolon(){if(this.matchPunctuator(";"))this.readNextRawToken();else if(!this.hasLineTerminator)return this.rawToken.type===E.EOF||this.matchPunctuator("}")?(this.endMarker.index=this.startMarker.index,this.endMarker.line=this.startMarker.line,void(this.endMarker.column=this.startMarker.column)):void this.throwUnexpectedToken({rawToken:this.rawToken})}parsePrimaryExpression(){const t=this.captureStartMarker(),n=this.rawToken;switch(n.type){case E.Identifier:return this.readNextRawToken(),this.finalize({type:b.Identifier,name:n.value,...this.getItemLocation(t)});case E.NumericLiteral:case E.StringLiteral:return this.context.isAssignmentTarget=!1,this.readNextRawToken(),this.finalize({type:b.Literal,value:n.value,raw:this.getSourceValue(n),isString:typeof n.value=="string",...this.getItemLocation(t)});case E.BooleanLiteral:return this.context.isAssignmentTarget=!1,this.readNextRawToken(),this.finalize({type:b.Literal,value:n.value.toLowerCase()===L.True,raw:this.getSourceValue(n),isString:!1,...this.getItemLocation(t)});case E.NullLiteral:return this.context.isAssignmentTarget=!1,this.readNextRawToken(),this.finalize({type:b.Literal,value:null,raw:this.getSourceValue(n),isString:!1,...this.getItemLocation(t)});case E.Template:return this.parseTemplateLiteral();case E.Punctuator:switch(n.value){case"(":return this.inheritCoverGrammar(this.parseGroupExpression);case"[":return this.inheritCoverGrammar(this.parseArrayInitializer);case"{":return this.inheritCoverGrammar(this.parseObjectExpression);default:return this.throwUnexpectedToken({rawToken:this.rawToken})}case E.Keyword:return this.context.isAssignmentTarget=!1,this.throwUnexpectedToken({rawToken:this.rawToken});default:return this.throwUnexpectedToken({rawToken:this.rawToken})}}parseArrayInitializer(){const t=this.captureStartMarker();this.expectPunctuator("[");const n=[];for(;!this.matchPunctuator("]");){const r=this.captureStartMarker();this.matchPunctuator(",")?(this.readNextRawToken(),this.throwError(F.InvalidExpression,r)):(n.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.matchPunctuator("]")||this.expectPunctuator(","))}return this.expectPunctuator("]"),this.finalize({type:b.ArrayExpression,elements:n,...this.getItemLocation(t)})}parseObjectPropertyKey(){const t=this.captureStartMarker(),n=this.rawToken;switch(n.type){case E.StringLiteral:return this.readNextRawToken(),this.finalize({type:b.Literal,value:n.value,raw:this.getSourceValue(n),isString:!0,...this.getItemLocation(t)});case E.Identifier:case E.BooleanLiteral:case E.NullLiteral:case E.Keyword:return this.readNextRawToken(),this.finalize({type:b.Identifier,name:n.value,...this.getItemLocation(t)});default:this.throwError(F.KeyMustBeString,t)}}parseObjectProperty(){const t=this.rawToken,n=this.captureStartMarker(),r=this.parseObjectPropertyKey();let a=!1,u=null;return this.matchPunctuator(":")?(this.readNextRawToken(),u=this.inheritCoverGrammar(this.parseAssignmentExpression)):t.type===E.Identifier?(a=!0,u=this.finalize({type:b.Identifier,name:t.value,...this.getItemLocation(n)})):this.throwUnexpectedToken({rawToken:this.rawToken}),this.finalize({type:b.Property,kind:"init",key:r,value:u,shorthand:a,...this.getItemLocation(n)})}parseObjectExpression(){const t=this.captureStartMarker();this.expectPunctuator("{");const n=[];for(;!this.matchPunctuator("}");)n.push(this.parseObjectProperty()),this.matchPunctuator("}")||this.expectPunctuator(",");return this.expectPunctuator("}"),this.finalize({type:b.ObjectExpression,properties:n,...this.getItemLocation(t)})}parseTemplateElement(t=!1){const n=this.rawToken;n.type!==E.Template&&this.throwUnexpectedToken({rawToken:n}),t&&!n.head&&this.throwUnexpectedToken({code:F.InvalidTemplateHead,rawToken:n});const r=this.captureStartMarker();this.readNextRawToken();const{value:a,cooked:u,tail:o}=n,i=this.finalize({type:b.TemplateElement,value:{raw:a,cooked:u},tail:o,...this.getItemLocation(r)});return i.loc.start.column++,i.loc.end.column=i.loc.end.column-(o?1:2),i}parseTemplateLiteral(){const t=this.captureStartMarker(),n=[],r=[];let a=this.parseTemplateElement(!0);for(r.push(a);!a.tail;)n.push(this.parseExpression()),a=this.parseTemplateElement(),r.push(a);return this.finalize({type:b.TemplateLiteral,quasis:r,expressions:n,...this.getItemLocation(t)})}parseGroupExpression(){this.expectPunctuator("(");const t=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.expectPunctuator(")"),t}parseArguments(){this.expectPunctuator("(");const t=[];if(!this.matchPunctuator(")"))for(;;){const n=this.isolateCoverGrammar(this.parseAssignmentExpression);if(t.push(n),this.matchPunctuator(")")||(this.expectPunctuator(","),this.matchPunctuator(")")))break}return this.expectPunctuator(")"),t}parseMemberName(){const t=this.rawToken,n=this.captureStartMarker();return this.readNextRawToken(),t.type!==E.NullLiteral&&t.type!==E.Identifier&&t.type!==E.Keyword&&t.type!==E.BooleanLiteral&&this.throwUnexpectedToken({rawToken:t}),this.finalize({type:b.Identifier,name:t.value,...this.getItemLocation(n)})}parseLeftHandSideExpression(){const t=this.captureStartMarker();let n=this.inheritCoverGrammar(this.parsePrimaryExpression);const r=this.captureStartMarker();let a;for(;a=this.getMatchingPunctuator("([.");)switch(a){case"(":{this.context.isAssignmentTarget=!1,n.type!==b.Identifier&&n.type!==b.MemberExpression&&this.throwError(F.IdentiferExpected,t,r);const u=this.parseArguments();n=this.finalize({type:b.CallExpression,callee:n,arguments:u,...this.getItemLocation(t)});continue}case"[":{this.context.isAssignmentTarget=!0,this.expectPunctuator("[");const u=this.isolateCoverGrammar(this.parseExpression);this.expectPunctuator("]"),n=this.finalize({type:b.MemberExpression,computed:!0,object:n,property:u,...this.getItemLocation(t)});continue}case".":{this.context.isAssignmentTarget=!0,this.expectPunctuator(".");const u=this.parseMemberName();n=this.finalize({type:b.MemberExpression,computed:!1,object:n,property:u,...this.getItemLocation(t)});continue}}return n}parseUpdateExpression(){const t=this.captureStartMarker();let n=this.getMatchingPunctuator(Jn);if(n){this.readNextRawToken();const o=this.captureStartMarker(),i=this.inheritCoverGrammar(this.parseUnaryExpression);return i.type!==b.Identifier&&i.type!==b.MemberExpression&&i.type!==b.CallExpression&&this.throwError(F.InvalidExpression,o),this.context.isAssignmentTarget||this.tolerateError(F.InvalidLeftHandSideInAssignment,t),this.context.isAssignmentTarget=!1,this.finalize({type:b.UpdateExpression,operator:n,argument:i,prefix:!0,...this.getItemLocation(t)})}const r=this.captureStartMarker(),a=this.inheritCoverGrammar(this.parseLeftHandSideExpression),u=this.captureStartMarker();return this.hasLineTerminator?a:(n=this.getMatchingPunctuator(Jn),n?(a.type!==b.Identifier&&a.type!==b.MemberExpression&&this.throwError(F.InvalidExpression,r,u),this.context.isAssignmentTarget||this.tolerateError(F.InvalidLeftHandSideInAssignment,t),this.readNextRawToken(),this.context.isAssignmentTarget=!1,this.finalize({type:b.UpdateExpression,operator:n,argument:a,prefix:!1,...this.getItemLocation(t)})):a)}parseUnaryExpression(){const t=this.getMatchingPunctuator(Vi);if(t){const n=this.captureStartMarker();this.readNextRawToken();const r=this.inheritCoverGrammar(this.parseUnaryExpression);return this.context.isAssignmentTarget=!1,this.finalize({type:b.UnaryExpression,operator:t,argument:r,prefix:!0,...this.getItemLocation(n)})}return this.parseUpdateExpression()}parseBinaryExpression(){const t=this.rawToken;let n=this.inheritCoverGrammar(this.parseUnaryExpression);if(this.rawToken.type!==E.Punctuator)return n;const r=this.rawToken.value;let a=jr(r);if(a===0)return n;this.readNextRawToken(),this.context.isAssignmentTarget=!1;const u=[t,this.rawToken];let o=n,i=this.inheritCoverGrammar(this.parseUnaryExpression);const s=[o,r,i],c=[a];for(;this.rawToken.type===E.Punctuator&&(a=jr(this.rawToken.value))>0;){for(;s.length>2&&a<=c[c.length-1];){i=s.pop();const m=s.pop();c.pop(),o=s.pop(),u.pop();const g=u[u.length-1],x=Vr(g,g.lineStart);s.push(this.finalize(this.createBinaryOrLogicalExpression(x,m,o,i)))}s.push(this.rawToken.value),c.push(a),u.push(this.rawToken),this.readNextRawToken(),s.push(this.inheritCoverGrammar(this.parseUnaryExpression))}let p=s.length-1;n=s[p];let f=u.pop();for(;p>1;){const m=u.pop();if(!m)break;const g=f==null?void 0:f.lineStart,x=Vr(m,g),M=s[p-1];n=this.finalize(this.createBinaryOrLogicalExpression(x,M,s[p-2],n)),p-=2,f=m}return n}createBinaryOrLogicalExpression(t,n,r,a){const u=ji.includes(n)?b.LogicalExpression:b.BinaryExpression;return u===b.BinaryExpression||(r.type!==b.AssignmentExpression&&r.type!==b.UpdateExpression||this.throwError(F.InvalidExpression,...qr(r)),a.type!==b.AssignmentExpression&&a.type!==b.UpdateExpression||this.throwError(F.InvalidExpression,...qr(r))),{type:u,operator:n,left:r,right:a,...this.getItemLocation(t)}}parseAssignmentExpression(){const t=this.captureStartMarker(),n=this.inheritCoverGrammar(this.parseBinaryExpression),r=this.captureStartMarker(),a=this.getMatchingPunctuator(qi);if(!a)return n;n.type!==b.Identifier&&n.type!==b.MemberExpression&&this.throwError(F.InvalidExpression,t,r),this.context.isAssignmentTarget||this.tolerateError(F.InvalidLeftHandSideInAssignment,t),this.matchPunctuator("=")||(this.context.isAssignmentTarget=!1),this.readNextRawToken();const u=this.isolateCoverGrammar(this.parseAssignmentExpression);return this.finalize({type:b.AssignmentExpression,left:n,operator:a,right:u,...this.getItemLocation(t)})}parseExpression(){return this.isolateCoverGrammar(this.parseAssignmentExpression)}parseStatements(t){const n=[];for(;this.rawToken.type!==E.EOF&&!this.matchPunctuator(t);){const r=this.parseStatementListItem();hu(r)||n.push(r)}return n}parseStatementListItem(){return this.context.isAssignmentTarget=!0,this.matchKeyword(L.Function)?this.parseFunctionDeclaration():this.matchKeyword(L.Export)?this.parseExportDeclaration():this.matchKeyword(L.Import)?this.parseImportDeclaration():this.parseStatement()}parseBlock(){const t=this.captureStartMarker();this.expectPunctuator("{");const n=this.parseStatements("}");return this.expectPunctuator("}"),this.finalize({type:b.BlockStatement,body:n,...this.getItemLocation(t)})}parseObjectStatement(){const t=this.captureStartMarker(),n=this.parseObjectExpression();return this.finalize({type:b.ExpressionStatement,expression:n,...this.getItemLocation(t)})}parseBlockOrObjectStatement(){return this.context.curlyParsingType===Nt.AsObject?this.parseObjectStatement():this.peekAhead(t=>{let n=t();return(n.type===E.Identifier||n.type===E.StringLiteral)&&(n=t(),n.type===E.Punctuator&&n.value===":")})?this.parseObjectStatement():this.parseBlock()}parseIdentifier(){const t=this.rawToken;if(t.type!==E.Identifier)return null;const n=this.captureStartMarker();return this.readNextRawToken(),this.finalize({type:b.Identifier,name:t.value,...this.getItemLocation(n)})}parseVariableDeclarator(){const t=this.captureStartMarker(),n=this.parseIdentifier();n||this.throwUnexpectedToken({code:F.IdentiferExpected});let r=null;if(this.matchPunctuator("=")){this.readNextRawToken();const a=this.rawToken;try{r=this.isolateCoverGrammar(this.parseAssignmentExpression)}catch{this.throwUnexpectedToken({rawToken:a,code:F.InvalidVariableAssignment})}}return this.finalize({type:b.VariableDeclarator,id:n,init:r,...this.getItemLocation(t)})}parseVariableDeclarationList(){const t=[this.parseVariableDeclarator()];for(;this.matchPunctuator(",");)this.readNextRawToken(),t.push(this.parseVariableDeclarator());return t}parseVariableDeclaration(){const t=this.captureStartMarker();this.expectKeyword(L.Var);const n=this.parseVariableDeclarationList();return this.consumeSemicolon(),this.finalize({type:b.VariableDeclaration,declarations:n,kind:"var",...this.getItemLocation(t)})}parseEmptyStatement(){const t=this.captureStartMarker();return this.expectPunctuator(";"),this.finalize({type:b.EmptyStatement,...this.getItemLocation(t)})}parseExpressionStatement(){const t=this.captureStartMarker(),n=this.parseExpression();return this.consumeSemicolon(),this.finalize({type:b.ExpressionStatement,expression:n,...this.getItemLocation(t)})}parseIfClause(){return this.withBlockContext(ce.IfClause,this.parseStatement)}parseIfStatement(){const t=this.captureStartMarker();this.expectKeyword(L.If),this.expectPunctuator("(");const n=this.captureStartMarker(),r=this.parseExpression(),a=this.captureStartMarker();this.expectPunctuator(")"),r.type!==b.AssignmentExpression&&r.type!==b.UpdateExpression||this.throwError(F.InvalidExpression,n,a);const u=this.parseIfClause();let o=null;return this.matchKeyword(L.Else)&&(this.readNextRawToken(),o=this.parseIfClause()),this.finalize({type:b.IfStatement,test:r,consequent:u,alternate:o,...this.getItemLocation(t)})}parseWhileStatement(){const t=this.captureStartMarker();this.expectKeyword(L.While),this.expectPunctuator("(");const n=this.captureStartMarker(),r=this.parseExpression(),a=this.captureStartMarker();this.expectPunctuator(")"),r.type!==b.AssignmentExpression&&r.type!==b.UpdateExpression||this.throwError(F.InvalidExpression,n,a);const u=this.withBlockContext(ce.WhileLoop,this.parseStatement);return this.finalize({type:b.WhileStatement,test:r,body:u,...this.getItemLocation(t)})}parseForStatement(){let t=null,n=null,r=null,a=null,u=null;const o=this.captureStartMarker();if(this.expectKeyword(L.For),this.expectPunctuator("("),this.matchPunctuator(";"))this.readNextRawToken();else if(this.matchKeyword(L.Var)){const s=this.captureStartMarker();this.readNextRawToken();const c=this.parseVariableDeclarationList();c.length===1&&this.matchKeyword(L.In)?(c[0].init&&this.throwError(F.ForInOfLoopInitializer,s),a=this.finalize({type:b.VariableDeclaration,declarations:c,kind:"var",...this.getItemLocation(s)}),this.readNextRawToken(),u=this.parseExpression()):(this.matchKeyword(L.In)&&this.throwError(F.InvalidLeftHandSideInForIn,s),t=this.finalize({type:b.VariableDeclaration,declarations:c,kind:"var",...this.getItemLocation(s)}),this.expectPunctuator(";"))}else{const s=this.context.isAssignmentTarget,c=this.captureStartMarker();t=this.inheritCoverGrammar(this.parseAssignmentExpression),this.matchKeyword(L.In)?(this.context.isAssignmentTarget||this.tolerateError(F.InvalidLeftHandSideInForIn,c),t.type!==b.Identifier&&this.throwError(F.InvalidLeftHandSideInForIn,c),this.readNextRawToken(),a=t,u=this.parseExpression(),t=null):(this.context.isAssignmentTarget=s,this.expectPunctuator(";"))}a||(this.matchPunctuator(";")||(n=this.isolateCoverGrammar(this.parseExpression)),this.expectPunctuator(";"),this.matchPunctuator(")")||(r=this.isolateCoverGrammar(this.parseExpression))),this.expectPunctuator(")");const i=this.withBlockContext(ce.ForLoop,()=>this.isolateCoverGrammar(this.parseStatement));return a&&u?this.finalize({type:b.ForInStatement,left:a,right:u,body:i,...this.getItemLocation(o)}):this.finalize({type:b.ForStatement,init:t,test:n,update:r,body:i,...this.getItemLocation(o)})}parseContinueStatement(){const t=this.captureStartMarker();return this.expectKeyword(L.Continue),this.consumeSemicolon(),this.finalize({type:b.ContinueStatement,...this.getItemLocation(t)})}parseBreakStatement(){const t=this.captureStartMarker();return this.expectKeyword(L.Break),this.consumeSemicolon(),this.finalize({type:b.BreakStatement,...this.getItemLocation(t)})}parseReturnStatement(){const t=this.captureStartMarker();this.expectKeyword(L.Return);const n=!this.matchPunctuator(";")&&!this.matchPunctuator("}")&&!this.hasLineTerminator&&this.rawToken.type!==E.EOF||this.rawToken.type===E.StringLiteral||this.rawToken.type===E.Template?this.parseExpression():null;return this.consumeSemicolon(),this.finalize({type:b.ReturnStatement,argument:n,...this.getItemLocation(t)})}parseStatement(){switch(this.rawToken.type){case E.BooleanLiteral:case E.NullLiteral:case E.NumericLiteral:case E.StringLiteral:case E.Template:case E.Identifier:return this.parseExpressionStatement();case E.Punctuator:return this.rawToken.value==="{"?this.parseBlockOrObjectStatement():this.rawToken.value==="("?this.parseExpressionStatement():this.rawToken.value===";"?this.parseEmptyStatement():this.parseExpressionStatement();case E.Keyword:switch(this.rawToken.value.toLowerCase()){case L.Break:return this.parseBreakStatement();case L.Continue:return this.parseContinueStatement();case L.For:return this.parseForStatement();case L.Function:return this.parseFunctionDeclaration();case L.If:return this.parseIfStatement();case L.Return:return this.parseReturnStatement();case L.Var:return this.parseVariableDeclaration();case L.While:return this.parseWhileStatement();default:return this.parseExpressionStatement()}default:return this.throwUnexpectedToken({rawToken:this.rawToken})}}parseFormalParameters(){const t=[];if(this.expectPunctuator("("),!this.matchPunctuator(")"))for(;this.rawToken.type!==E.EOF;){const n=this.parseIdentifier();if(n||this.throwUnexpectedToken({rawToken:this.rawToken,code:F.IdentiferExpected}),t.push(n),this.matchPunctuator(")")||(this.expectPunctuator(","),this.matchPunctuator(")")))break}return this.expectPunctuator(")"),t}parseFunctionDeclaration(){(this.context.blockContext&ce.Function)===ce.Function&&this.throwUnexpectedToken({code:F.NoFunctionInsideFunction}),(this.context.blockContext&ce.WhileLoop)!==ce.WhileLoop&&(this.context.blockContext&ce.IfClause)!==ce.IfClause||this.throwUnexpectedToken({code:F.NoFunctionInsideBlock});const t=this.captureStartMarker();this.expectKeyword(L.Function);const n=this.parseIdentifier();n||this.throwUnexpectedToken({code:F.InvalidFunctionIdentifier});const r=this.parseFormalParameters(),a=this.context.blockContext;this.context.blockContext=this.context.blockContext|ce.Function;const u=this.parseBlock();return this.context.blockContext=a,this.finalize({type:b.FunctionDeclaration,id:n,params:r,body:u,...this.getItemLocation(t)})}parseScript(){const t=this.captureStartMarker(),n=this.parseStatements(),r=this.finalize({type:b.Program,body:n,...this.getItemLocation(t)});return this.options.tokens&&(r.tokens=this.tokens),this.options.tolerant&&(r.errors=this.errorHandler.errors),r}parseExportDeclaration(){this.context.blockContext!==ce.None&&this.throwUnexpectedToken({code:F.ModuleExportRootOnly});let t=null;const n=this.captureStartMarker();return this.expectKeyword(L.Export),this.matchKeyword(L.Var)?t=this.parseVariableDeclaration():this.matchKeyword("function")?t=this.parseFunctionDeclaration():this.throwUnexpectedToken({code:F.InvalidExpression}),this.finalize({type:b.ExportNamedDeclaration,declaration:t,specifiers:[],source:null,...this.getItemLocation(n)})}parseModuleSpecifier(){const t=this.captureStartMarker(),n=this.rawToken;if(n.type===E.StringLiteral)return this.readNextRawToken(),this.finalize({type:b.Literal,value:n.value,raw:this.getSourceValue(n),isString:!0,...this.getItemLocation(t)});this.throwError(F.InvalidModuleUri,t)}parseDefaultSpecifier(){const t=this.captureStartMarker(),n=this.parseIdentifier();return n||this.throwUnexpectedToken({code:F.IdentiferExpected}),this.finalize({type:b.ImportDefaultSpecifier,local:n,...this.getItemLocation(t)})}parseImportDeclaration(){this.context.blockContext!==ce.None&&this.throwUnexpectedToken({code:F.ModuleImportRootOnly});const t=this.captureStartMarker();this.expectKeyword(L.Import);const n=this.parseDefaultSpecifier();this.expectContextualKeyword(L.From);const r=this.parseModuleSpecifier();return this.finalize({type:b.ImportDeclaration,specifiers:[n],source:r,...this.getItemLocation(t)})}}function wu(e,t,n){return new yu(e,t,n).parseScript()}function nn(e,t=[]){const n=wu(e);if(n.body===null||n.body===void 0)throw new Ot({index:0,line:0,column:0,data:null,description:"",code:F.InvalidExpression});return n.loadedModules={},zt(n,t),n}class rn{constructor(t){const n=this;n._keys=[],n._values=[],n.length=0,t&&t.forEach(r=>{n.set(r[0],r[1])})}entries(){return[].slice.call(this.keys().map((t,n)=>[t,this._values[n]]))}keys(){return[].slice.call(this._keys)}values(){return[].slice.call(this._values)}has(t){return this._keys.includes(t)}get(t){const n=this._keys.indexOf(t);return n>-1?this._values[n]:null}deepGet(t){if(!(t!=null&&t.length))return null;const n=(r,a)=>r==null?null:a.length?n(r instanceof rn?r.get(a[0]):r[a[0]],a.slice(1)):r;return n(this.get(t[0]),t.slice(1))}set(t,n){const r=this,a=this._keys.indexOf(t);return a>-1?r._values[a]=n:(r._keys.push(t),r._values.push(n),r.length=r._values.length),this}sortedSet(t,n,r,a){const u=this,o=this._keys.length,i=r||0,s=a!==void 0?a:o-1;if(o===0)return u._keys.push(t),u._values.push(n),u;if(t===this._keys[i])return this._values.splice(i,0,n),this;if(t===this._keys[s])return this._values.splice(s,0,n),this;if(t>this._keys[s])return this._keys.splice(s+1,0,t),this._values.splice(s+1,0,n),this;if(t=s)return this;const c=i+Math.floor((s-i)/2);return tthis._keys[c]?this.sortedSet(t,n,c+1,s):this}size(){return this.length}clear(){const t=this;return t._keys.length=t.length=t._values.length=0,this}delete(t){const n=this,r=n._keys.indexOf(t);return r>-1&&(n._keys.splice(r,1),n._values.splice(r,1),n.length=n._keys.length,!0)}forEach(t){this._keys.forEach((n,r)=>{t(this._values[r],n,r)})}map(t){return this.keys().map((n,r)=>t(this._values[r],n,r))}filter(t){const n=this;return n._keys.forEach((r,a)=>{t(n._values[a],r,a)===!1&&n.delete(r)}),this}clone(){return new rn(this.entries())}}class Hr{constructor(t=20){this._maxEntries=t,this._values=new rn}delete(t){this._values.has(t)&&this._values.delete(t)}get(t){let n=null;return this._values.has(t)&&(n=this._values.get(t),this._values.delete(t),this._values.set(t,n)),n}put(t,n){if(this._values.size()>=this._maxEntries){const r=this._values.keys()[0];this._values.delete(r)}this._values.set(t,n)}}class xu{constructor(t=20){this._maxEntries=t,this._cache=new Hr(this._maxEntries)}clear(){this._cache=new Hr(this._maxEntries)}addToCache(t,n){this._cache.put(t,n)}removeFromCache(t){this._cache.delete(t)}getFromCache(t){return this._cache.get(t)}}class me{constructor(t){this.portalUri=t}normalizeModuleUri(t){const n=/^[a-z0-9A-Z]+(@[0-9]+\.[0-9]+\.[0-9]+)?([\?|\/].*)?$/gi,r=/(?.+)\/home\/item\.html\?id\=(?.+)$/gi,a=/(?.+)\/sharing\/rest\/content\/users\/[a-zA-Z0-9]+\/items\/(?.+)$/gi,u=/(?.+)\/sharing\/rest\/content\/items\/(?.+)$/gi,o=/(?.*)@(?[0-9]+\.[0-9]+\.[0-9]+)([\?|\/].*)?$/gi;if(t.startsWith("portal+")){let i=t.substring(7),s="",c=i,p=!1;for(const g of[r,u,a]){const x=g.exec(i);if(x!==null){const M=x.groups;c=M.itemid,s=M.portalurl,p=!0;break}}if(p===!1){if(!n.test(i))throw new pn(et.UnsupportedUriProtocol,{uri:t});c=i,s=this.portalUri}c.includes("/")&&(c=c.split("/")[0]),c.includes("?")&&(c=c.split("?")[0]);let f="current";const m=o.exec(c);if(m!==null){const g=m.groups;c=g.itemid,f=g.versionstring}return i=new Wn({url:s}).restUrl+"/content/items/"+c+"/resources/"+f+".arc",{url:i,scheme:"portal",uri:"PO:"+i}}if(t.startsWith("mock")){if(t==="mock")return{url:"",scheme:"mock",data:` export var hello = 1; export function helloWorld() { return "Hello World " + hello; } - `,uri:"mock"};const i=t.replace("mock:","");if(me.mocks[i]!==void 0)return{url:"",scheme:"mock",data:me.mocks[i],uri:t}}throw new pn(et.UnrecognizedUri,{uri:t})}async fetchModule(t){const n=me.cachedModules.getFromCache(t.uri);if(n)return n;const r=this.fetchSource(t);me.cachedModules.addToCache(t.uri,r);let a=null;try{a=await r}catch(u){throw me.cachedModules.removeFromCache(t.uri),u}return a}async fetchSource(t){if(t.scheme==="portal"){const n=await ba(t.url,{responseType:"text",query:{}});if(n.data)return nn(n.data,[])}if(t.scheme==="mock")return nn(t.data??"",[]);throw new pn(et.UnsupportedUriProtocol)}static create(t){return new me(t)}static getDefault(){return this._default??(me._default=me._moduleResolverFactory())}static set moduleResolverClass(t){this._moduleResolverFactory=t,this._default=null}}me.mocks={},me.cachedModules=new xu(30),me._default=null,me._moduleResolverFactory=()=>{const e=Wn.getDefault();return new me(e.url)};let Fu=class extends tt{constructor(t,n){super(),this.definition=null,this.context=null,this.definition=t,this.context=n}createFunction(t){return(...n)=>{const r={spatialReference:this.context.spatialReference,console:this.context.console,services:this.context.services,timeZone:this.context.timeZone??null,lrucache:this.context.lrucache,exports:this.context.exports,libraryResolver:this.context.libraryResolver,interceptor:this.context.interceptor,localScope:{},depthCounter:{depth:t.depthCounter.depth+1},globalScope:this.context.globalScope};if(r.depthCounter.depth>64)throw new d(t,l.MaximumCallDepth,null);return Sn(this.definition,r,n,null)}}call(t,n){return Ue(t,n,(r,a,u)=>{const o={spatialReference:t.spatialReference,services:t.services,globalScope:t.globalScope,depthCounter:{depth:t.depthCounter.depth+1},libraryResolver:t.libraryResolver,exports:t.exports,timeZone:t.timeZone??null,console:t.console,lrucache:t.lrucache,interceptor:t.interceptor,localScope:{}};if(o.depthCounter.depth>64)throw new d(t,l.MaximumCallDepth,n);return Sn(this.definition,o,u,n)})}marshalledCall(t,n,r,a){return a(t,n,(u,o,i)=>{const s={spatialReference:t.spatialReference,globalScope:r.globalScope,services:t.services,depthCounter:{depth:t.depthCounter.depth+1},libraryResolver:t.libraryResolver,exports:t.exports,console:t.console,timeZone:t.timeZone??null,lrucache:t.lrucache,interceptor:t.interceptor,localScope:{}};return i=i.map(c=>!X(c)||c instanceof ze?c:dt(c,t,a)),dt(Sn(this.definition,s,i,n),r,a)})}},gt=class extends Pt{constructor(t){super(t)}global(t){const n=this.executingContext.globalScope[t.toLowerCase()];if(n.valueset||(n.value=v(this.executingContext,n.node),n.valueset=!0),X(n.value)&&!(n.value instanceof ze)){const r=new ze;r.fn=n.value,r.parameterEvaluator=Ue,r.context=this.executingContext,n.value=r}return n.value}setGlobal(t,n){if(X(n))throw new d(null,l.AssignModuleFunction,null);this.executingContext.globalScope[t.toLowerCase()]={value:n,valueset:!0,node:null}}hasGlobal(t){return this.executingContext.exports[t]===void 0&&(t=t.toLowerCase()),this.executingContext.exports[t]!==void 0}loadModule(t){let n=t.spatialReference;n==null&&(n=new yt({wkid:102100})),this.moduleScope=Xi({},t.customfunctions,t.timeZone),this.executingContext={spatialReference:n,globalScope:this.moduleScope,localScope:null,libraryResolver:new an(t.libraryResolver._moduleSingletons,this.source.syntax.loadedModules),exports:{},services:t.services,console:t.console??Qi,timeZone:t.timeZone??null,lrucache:t.lrucache,interceptor:t.interceptor,depthCounter:{depth:1}},v(this.executingContext,this.source.syntax)}};function Cu(e,t){const n=[];for(let r=0;r=r.length)throw new d(e,l.OutOfBounds,t);n=h(r[a]),r[a]=t.operator==="++"?n+1:n-1}else if(r instanceof k){if(C(a)===!1)throw new d(e,l.KeyAccessorMustBeString,t);if(r.hasField(a)!==!0)throw new d(e,l.FieldNotFound,t);n=h(r.field(a)),r.setField(a,t.operator==="++"?n+1:n-1)}else if(ee(r)){if(C(a)===!1)throw new d(e,l.KeyAccessorMustBeString,t);if(r.hasField(a)!==!0)throw new d(e,l.FieldNotFound,t);n=h(r.field(a)),r.setField(a,t.operator==="++"?n+1:n-1)}else{if(R(r))throw new d(e,l.Immutable,t);if(!(r instanceof gt))throw new d(e,l.InvalidParameter,t);if(C(a)===!1)throw new d(e,l.ModuleAccessorMustBeString,t);if(r.hasGlobal(a)!==!0)throw new d(e,l.ModuleExportNotFound,t);n=h(r.global(a)),r.setGlobal(a,t.operator==="++"?n+1:n-1)}return t.prefix===!1?n:t.operator==="++"?n+1:n-1}if(r=t.argument.type==="Identifier"?t.argument.name.toLowerCase():"",!r)throw new d(e,l.InvalidIdentifier,t);if(e.localScope!=null&&e.localScope[r]!==void 0)return n=h(e.localScope[r].value),e.localScope[r]={value:t.operator==="++"?n+1:n-1,valueset:!0,node:t},t.prefix===!1?n:t.operator==="++"?n+1:n-1;if(e.globalScope[r]!==void 0)return n=h(e.globalScope[r].value),e.globalScope[r]={value:t.operator==="++"?n+1:n-1,valueset:!0,node:t},t.prefix===!1?n:t.operator==="++"?n+1:n-1;throw new d(e,l.InvalidIdentifier,t)}function Oe(e,t,n,r,a){switch(t){case"=":return e===A?null:e;case"/=":return h(n)/h(e);case"*=":return h(n)*h(e);case"-=":return h(n)-h(e);case"+=":return C(n)||C(e)?w(n)+w(e):h(n)+h(e);case"%=":return h(n)%h(e);default:throw new d(a,l.UnsupportedOperator,r)}}function Tu(e,t){let n=null,r="";if(t.left.type==="MemberExpression"){if(n=v(e,t.left.object),t.left.computed===!0)r=v(e,t.left.property);else{if(t.left.property.type!=="Identifier")throw new d(e,l.InvalidIdentifier,t);r=t.left.property.name}const u=v(e,t.right);if(T(n)){if(!q(r))throw new d(e,l.ArrayAccessorMustBeNumber,t);if(r<0&&(r=n.length+r),r<0||r>n.length)throw new d(e,l.OutOfBounds,t);if(r===n.length){if(t.operator!=="=")throw new d(e,l.OutOfBounds,t);n[r]=Oe(u,t.operator,n[r],t,e)}else n[r]=Oe(u,t.operator,n[r],t,e)}else if(n instanceof k){if(C(r)===!1)throw new d(e,l.KeyAccessorMustBeString,t);if(n.hasField(r)===!0)n.setField(r,Oe(u,t.operator,n.field(r),t,e));else{if(t.operator!=="=")throw new d(e,l.FieldNotFound,t,{key:r});n.setField(r,Oe(u,t.operator,null,t,e))}}else if(ee(n)){if(C(r)===!1)throw new d(e,l.KeyAccessorMustBeString,t);if(n.hasField(r)===!0)n.setField(r,Oe(u,t.operator,n.field(r),t,e));else{if(t.operator!=="=")throw new d(e,l.FieldNotFound,t,{key:r});n.setField(r,Oe(u,t.operator,null,t,e))}}else{if(R(n))throw new d(e,l.Immutable,t);if(!(n instanceof gt))throw new d(e,l.InvalidIdentifier,t);if(C(r)===!1)throw new d(e,l.ModuleAccessorMustBeString,t);if(n.hasGlobal(r)!==!0)throw new d(e,l.ModuleExportNotFound,t);n.setGlobal(r,Oe(u,t.operator,n.global(r),t,e))}return A}n=t.left.name.toLowerCase();const a=v(e,t.right);if(e.localScope!=null&&e.localScope[n]!==void 0)return e.localScope[n]={value:Oe(a,t.operator,e.localScope[n].value,t,e),valueset:!0,node:t.right},A;if(e.globalScope[n]!==void 0)return e.globalScope[n]={value:Oe(a,t.operator,e.globalScope[n].value,t,e),valueset:!0,node:t.right},A;throw new d(e,l.InvalidIdentifier,t)}function Bu(e,t){if(t.expression.type==="AssignmentExpression"||t.expression.type==="UpdateExpression")return v(e,t.expression);if(t.expression.type==="CallExpression"){const n=v(e,t.expression);return n===A?A:new ft(n)}{const n=v(e,t.expression);return n===A?A:new ft(n)}}function Nu(e,t){const n=v(e,t.test);if(n===!0)return v(e,t.consequent);if(n===!1)return t.alternate!==null?v(e,t.alternate):A;throw new d(e,l.BooleanConditionRequired,t)}function _u(e,t){let n=A;for(let r=0;r=n.length||r<0)throw new d(e,l.OutOfBounds,t);return n[r]}throw new d(e,l.InvalidMemberAccessKey,t)}if(C(n)){if(q(r)&&isFinite(r)&&Math.floor(r)===r){if(r<0&&(r=n.length+r),r>=n.length||r<0)throw new d(e,l.OutOfBounds,t);return n[r]}throw new d(e,l.InvalidMemberAccessKey,t)}if(R(n)){if(q(r)&&isFinite(r)&&Math.floor(r)===r){if(r<0&&(r=n.length()+r),r>=n.length()||r<0)throw new d(e,l.OutOfBounds,t);return n.get(r)}throw new d(e,l.InvalidMemberAccessKey,t)}throw new d(e,l.InvalidMemberAccessKey,t)}}catch(n){throw n}}function zu(e,t){try{const n=v(e,t.argument);if(z(n)){if(t.operator==="!")return!n;if(t.operator==="-")return-1*h(n);if(t.operator==="+")return 1*h(n);if(t.operator==="~")return~h(n);throw new d(e,l.UnsupportedUnaryOperator,t)}if(t.operator==="~")return~h(n);if(t.operator==="-")return-1*h(n);if(t.operator==="+")return 1*h(n);throw new d(e,l.UnsupportedUnaryOperator,t)}catch(n){throw n}}function Gu(e,t){try{const n=[];for(let r=0;r>":case">>>":case"^":case"&":return ir(h(r),h(a),t.operator);case"==":return Ee(r,a);case"!=":return!Ee(r,a);case"<":case">":case"<=":case">=":return rr(r,a,t.operator);case"+":return C(r)||C(a)?w(r)+w(a):h(r)+h(a);case"-":return h(r)-h(a);case"*":return h(r)*h(a);case"/":return h(r)/h(a);case"%":return h(r)%h(a);default:throw new d(e,l.UnsupportedOperator,t)}}catch(n){throw n}}function Ju(e,t){try{const n=v(e,t.left);if(z(n))switch(t.operator){case"||":if(n===!0)return n;{const r=v(e,t.right);if(z(r))return r;throw new d(e,l.LogicExpressionOrAnd,t)}case"&&":if(n===!1)return n;{const r=v(e,t.right);if(z(r))return r;throw new d(e,l.LogicExpressionOrAnd,t)}default:throw new d(e,l.LogicExpressionOrAnd,t)}throw new d(e,l.LogicalExpressionOnlyBoolean,t)}catch(n){throw n}}function qu(e,t){return t.value?t.value.cooked:""}function Vu(e,t,n){if(X(e))throw new d(t,l.NoFunctionInTemplateLiteral,n);return e}function ju(e,t){let n="",r=0;for(const a of t.quasis)n+=a.value?a.value.cooked:"",a.tail===!1&&(n+=t.expressions[r]?w(Vu(v(e,t.expressions[r]),e,t)):"",r++);return n}function Ki(e,t){let n;try{const r=t.name.toLowerCase();if(e.localScope!=null&&e.localScope[r]!==void 0)return n=e.localScope[r],n.valueset===!0||(n.value=v(e,n.node),n.valueset=!0),n.value;if(e.globalScope[r]!==void 0)return n=e.globalScope[r],n.valueset===!0||(n.value=v(e,n.node),n.valueset=!0),n.value;throw new d(e,l.InvalidIdentifier,t)}catch(r){throw r}}function Hu(e,t){try{if(t.callee.type==="MemberExpression"){const n=v(e,t.callee.object);if(!(n instanceof gt))throw new d(e,l.FunctionNotFound,t);const r=t.callee.computed===!1?t.callee.property.name:v(e,t.callee.property);if(!n.hasGlobal(r))throw new d(e,l.FunctionNotFound,t);const a=n.global(r);if(!X(a))throw new d(e,l.CallNonFunction,t);return a.call(e,t)}if(t.callee.type!=="Identifier")throw new d(e,l.FunctionNotFound,t);if(e.localScope!=null&&e.localScope[t.callee.name.toLowerCase()]!==void 0){const n=e.localScope[t.callee.name.toLowerCase()];if(X(n.value))return n.value.call(e,t);throw new d(e,l.CallNonFunction,t)}if(e.globalScope[t.callee.name.toLowerCase()]!==void 0){const n=e.globalScope[t.callee.name.toLowerCase()];if(X(n.value))return n.value.call(e,t);throw new d(e,l.CallNonFunction,t)}throw new d(e,l.FunctionNotFound,t)}catch(n){throw n}}const he={};function Wi(e,t,n,r){try{const a=t.arguments,u=v(e,a[n]);if(Ee(u,r))return v(e,a[n+1]);{const o=a.length-n;return o===1?v(e,a[n]):o===2?null:o===3?v(e,a[n+2]):Wi(e,t,n+2,r)}}catch(a){throw a}}function Yi(e,t,n,r){try{const a=t.arguments;if(r===!0)return v(e,a[n+1]);if(a.length-n===3)return v(e,a[n+2]);{const u=v(e,a[n+2]);if(z(u)===!1)throw new d(e,l.BooleanConditionRequired,a[n+2]);return Yi(e,t,n+2,u)}}catch(a){throw a}}function Sn(e,t,n,r){try{const a=e.body;if(n.length!==e.params.length)throw new d(t,l.WrongNumberOfParameters,r);if(t.localScope!=null)for(let o=0;oimport("./index-J0iiHjMT.js").then(t=>t.zJ),__vite__mapDeps([1,2]));return na=!0,ao(e),!0}let In=null;function fr(){return In!==null||(In=oa()),In}async function oa(){await au(),ke=await Ve(()=>import("./arcadeAsyncRuntime-RlgIDugP.js"),__vite__mapDeps([7,0,1,2,3,4,5,6]));for(const e of jn)ke.extend(e),rt(e,"async");return jn=null,!0}function ua(){return ta}function sa(){return!!ke}function la(){return na}let kn=null;function hr(){return kn||(kn=ca(),kn)}async function ca(){await fr();const[e,t,n,r,a]=await Promise.all([Ve(()=>import("./featureSetUtils-DaHg3px6.js").then(u=>u.l),__vite__mapDeps([8,1,2,9,3,10,5,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33])),Ve(()=>import("./featuresetbase-WjFIOCEy.js"),__vite__mapDeps([34,3,1,2,8,9,10,5,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,4,6])),Ve(()=>import("./featuresetgeom-3-0z5YnY.js"),__vite__mapDeps([35,3,1,2,10,9,5,6])),Ve(()=>import("./featuresetstats-NfM8OXOZ.js"),__vite__mapDeps([36,3,1,2,9,6])),Ve(()=>import("./featuresetstring-bt3R_cQ2.js"),__vite__mapDeps([37,1,2,3,6]))]);return pa=e,ke.extend([t,n,r,a]),rt([t,n,r,a],"async"),ta=!0,!0}function da(e,t=[]){return e.usesFeatureSet===void 0&&zt(e,t),e.usesFeatureSet===!0}function ts(e,t=[]){return e.isAsync===void 0&&zt(e,t),e.isAsync===!0}function ns(e,t){if(t){for(const n of t)if(dn(e,n))return!0;return!1}return!1}async function fa(e,t,n=[],r=!1,a=null){return mr(new Set,e,t,n,r,a)}async function mr(e,t,n,r=[],a=!1,u=null){const o=typeof t=="string"?lr(t):t,i=[];return o&&(la()===!1&&(fn(o)||a)&&i.push(dr()),sa()===!1&&(o.isAsync===!0||n)&&i.push(fr()),ua()===!1&&(da(o)||ns(o,r))&&i.push(hr())),i.length&&await Promise.all(i),await ha(e,o,u,n,a),!0}function rs(e,t=[]){return e.usesModules===void 0&&zt(e,t),e.usesModules===!0}async function ha(e,t,n=null,r=!1,a=!1){const u=Si(t);n===null&&u.length>0&&(n=me.getDefault()),t.loadedModules={};for(const o of u){ti(n);const i=n.normalizeModuleUri(o.source);if(e.has(i.uri))throw new d(null,l.CircularModules,null);e.add(i.uri);const s=await n.fetchModule(i);await mr(e,s,r,[],a,n),e.delete(i.uri),s.isAsync&&(t.isAsync=!0),s.usesFeatureSet&&(t.usesFeatureSet=!0),s.usesGeometry&&(t.usesGeometry=!0),t.loadedModules[o.libname]={uri:i.uri,script:s}}}function ma(e){if(fn(e))return!0;const t=Ln(e);let n=!1;for(let r=0;r{Kr.test(o)&&(o=o.replace(Kr,""),a.push(o))});const u=a.filter(o=>o.includes("*"));return a=a.filter(o=>!u.includes(o)),t&&u.forEach(o=>{const i=new RegExp(`^${o.split(/\*+/).map(os).join(".*")}$`,"i");t.forEach(s=>i.test(s)?a.push(s):null)}),[...new Set(a.sort())]}function Ds(e){return dn(e,"$view")}function gs(e,t){return!!e&&dn(e,t)}function ys(e){if(!(!e||e.spatialReference==null&&(e.scale==null||e.viewingMode==null)))return{view:e.viewingMode&&e.scale!=null?new k({viewingMode:e.viewingMode,scale:e.scale}):null,sr:e.spatialReference}}function ws({url:e,spatialReference:t,lrucache:n,interceptor:r}){const a=hn();return a?a.createFeatureSetCollectionFromService(e,t,n,r):null}function xs({layer:e,spatialReference:t,outFields:n,returnGeometry:r,lrucache:a,interceptor:u}){if(e===null)return null;const o=hn();return o?o.constructFeatureSet(e,t,n,r??!0,a,u):null}function Fs(e){if((e==null?void 0:e.map)===null)return null;const t=hn();return t?t.createFeatureSetCollectionFromMap(e.map,e.spatialReference,e.lrucache,e.interceptor):null}function Cs(e,t){return k.convertJsonToArcade(e,t)}function As(e,t,n=[]){return fa(e,t,n)}function bs(){return dr()}function Es(){return hr()}function Ss(e){return e.type==="simple"||e.type==="class-breaks"||e.type==="unique-value"||e.type==="dot-density"||e.type==="dictionary"||e.type==="pie-chart"}function vs(e){return e.declaredClass==="esri.layers.support.LabelClass"}function Is(e){return e.declaredClass==="esri.PopupTemplate"}function Da(e,t){var r,a;if(!e)return!1;if(typeof e=="string")return t(e);const n=e;if(Ss(n)){if(n.type==="dot-density"){const i=(r=n.attributes)==null?void 0:r.some(s=>t(s.valueExpression));if(i)return i}const u=n.visualVariables,o=!!u&&u.some(i=>{let s=t(i.valueExpression);return i.type==="size"&&(Wr(i.minSize)&&(s=s||t(i.minSize.valueExpression)),Wr(i.maxSize)&&(s=s||t(i.maxSize.valueExpression))),s});return!(!("valueExpression"in n)||!t(n.valueExpression))||o}if(vs(n)){const u=(a=n.labelExpressionInfo)==null?void 0:a.expression;return!(!u||!t(u))||!1}return!!Is(n)&&(!!n.expressionInfos&&n.expressionInfos.some(u=>t(u.expression))||Array.isArray(n.content)&&n.content.some(u=>{var o;return u.type==="expression"&&t((o=u.expressionInfo)==null?void 0:o.expression)}))}function ks(e){const t=Gt(e);return!!t&&ma(t)}function Ts(e){return Da(e,ks)}function Bs(e){const t=Gt(e);return!!t&&fn(t)}function Ns(e){return Da(e,Bs)}function Wr(e){return e&&e.declaredClass==="esri.renderers.visualVariables.SizeVariable"}const hl=Object.freeze(Object.defineProperty({__proto__:null,Dictionary:k,arcade:is,arcadeFeature:Q,convertFeatureLayerToFeatureSet:xs,convertJsonToArcade:Cs,convertMapToFeatureSetCollection:Fs,convertServiceUrlToWorkspace:ws,createExecContext:ls,createFeature:cs,createFunction:ss,createSyntaxTree:Gt,dependsOnView:Ds,enableFeatureSetOperations:Es,enableGeometryOperations:bs,evalSyntaxTree:fs,executeAsyncFunction:ms,executeFunction:hs,extractFieldNames:ps,getArcadeType:us,getViewInfo:ys,hasGeometryFunctions:Ts,hasGeometryOperations:Ns,hasVariable:gs,loadScriptDependencies:As,updateExecContext:ds},Symbol.toStringTag,{value:"Module"}));export{Ri as $,$ as A,ht as B,vi as C,Q as D,Pn as E,ye as F,z as G,xt as H,ir as I,se as J,J as K,$t as L,ft as M,k as N,Ie as O,C as P,V as Q,wt as R,Na as S,He as T,ee as U,Zs as V,Bi as W,P as X,yn as Y,Z,gi as _,d as a,un as a0,jt as a1,yi as a2,mi as a3,wi as a4,pi as a5,we as a6,xi as a7,Cr as a8,Mn as a9,so as aA,$a as aB,Di as aC,hl as aD,kt as aa,Vt as ab,Ya as ac,Xa as ad,ja as ae,Ct as af,gr as ag,wr as ah,Vs as ai,Hs as aj,xr as ak,js as al,qs as am,Js as an,Ks as ao,el as ap,yr as aq,Ws as ar,Xs as as,Ta as at,Fr as au,Ys as av,_a as aw,Qs as ax,nl as ay,tl as az,R as b,h as c,w as d,nt as e,$i as f,rr as g,Ee as h,te as i,tt as j,ze as k,dt as l,_i as m,D as n,$n as o,On as p,T as q,l as r,an as s,Pt as t,Ia as u,X as v,A as w,ae as x,_ as y,q as z}; + `,uri:"mock"};const i=t.replace("mock:","");if(me.mocks[i]!==void 0)return{url:"",scheme:"mock",data:me.mocks[i],uri:t}}throw new pn(et.UnrecognizedUri,{uri:t})}async fetchModule(t){const n=me.cachedModules.getFromCache(t.uri);if(n)return n;const r=this.fetchSource(t);me.cachedModules.addToCache(t.uri,r);let a=null;try{a=await r}catch(u){throw me.cachedModules.removeFromCache(t.uri),u}return a}async fetchSource(t){if(t.scheme==="portal"){const n=await ba(t.url,{responseType:"text",query:{}});if(n.data)return nn(n.data,[])}if(t.scheme==="mock")return nn(t.data??"",[]);throw new pn(et.UnsupportedUriProtocol)}static create(t){return new me(t)}static getDefault(){return this._default??(me._default=me._moduleResolverFactory())}static set moduleResolverClass(t){this._moduleResolverFactory=t,this._default=null}}me.mocks={},me.cachedModules=new xu(30),me._default=null,me._moduleResolverFactory=()=>{const e=Wn.getDefault();return new me(e.url)};let Fu=class extends tt{constructor(t,n){super(),this.definition=null,this.context=null,this.definition=t,this.context=n}createFunction(t){return(...n)=>{const r={spatialReference:this.context.spatialReference,console:this.context.console,services:this.context.services,timeZone:this.context.timeZone??null,lrucache:this.context.lrucache,exports:this.context.exports,libraryResolver:this.context.libraryResolver,interceptor:this.context.interceptor,localScope:{},depthCounter:{depth:t.depthCounter.depth+1},globalScope:this.context.globalScope};if(r.depthCounter.depth>64)throw new d(t,l.MaximumCallDepth,null);return Sn(this.definition,r,n,null)}}call(t,n){return Ue(t,n,(r,a,u)=>{const o={spatialReference:t.spatialReference,services:t.services,globalScope:t.globalScope,depthCounter:{depth:t.depthCounter.depth+1},libraryResolver:t.libraryResolver,exports:t.exports,timeZone:t.timeZone??null,console:t.console,lrucache:t.lrucache,interceptor:t.interceptor,localScope:{}};if(o.depthCounter.depth>64)throw new d(t,l.MaximumCallDepth,n);return Sn(this.definition,o,u,n)})}marshalledCall(t,n,r,a){return a(t,n,(u,o,i)=>{const s={spatialReference:t.spatialReference,globalScope:r.globalScope,services:t.services,depthCounter:{depth:t.depthCounter.depth+1},libraryResolver:t.libraryResolver,exports:t.exports,console:t.console,timeZone:t.timeZone??null,lrucache:t.lrucache,interceptor:t.interceptor,localScope:{}};return i=i.map(c=>!X(c)||c instanceof ze?c:dt(c,t,a)),dt(Sn(this.definition,s,i,n),r,a)})}},gt=class extends Pt{constructor(t){super(t)}global(t){const n=this.executingContext.globalScope[t.toLowerCase()];if(n.valueset||(n.value=v(this.executingContext,n.node),n.valueset=!0),X(n.value)&&!(n.value instanceof ze)){const r=new ze;r.fn=n.value,r.parameterEvaluator=Ue,r.context=this.executingContext,n.value=r}return n.value}setGlobal(t,n){if(X(n))throw new d(null,l.AssignModuleFunction,null);this.executingContext.globalScope[t.toLowerCase()]={value:n,valueset:!0,node:null}}hasGlobal(t){return this.executingContext.exports[t]===void 0&&(t=t.toLowerCase()),this.executingContext.exports[t]!==void 0}loadModule(t){let n=t.spatialReference;n==null&&(n=new yt({wkid:102100})),this.moduleScope=Xi({},t.customfunctions,t.timeZone),this.executingContext={spatialReference:n,globalScope:this.moduleScope,localScope:null,libraryResolver:new an(t.libraryResolver._moduleSingletons,this.source.syntax.loadedModules),exports:{},services:t.services,console:t.console??Qi,timeZone:t.timeZone??null,lrucache:t.lrucache,interceptor:t.interceptor,depthCounter:{depth:1}},v(this.executingContext,this.source.syntax)}};function Cu(e,t){const n=[];for(let r=0;r=r.length)throw new d(e,l.OutOfBounds,t);n=h(r[a]),r[a]=t.operator==="++"?n+1:n-1}else if(r instanceof k){if(C(a)===!1)throw new d(e,l.KeyAccessorMustBeString,t);if(r.hasField(a)!==!0)throw new d(e,l.FieldNotFound,t);n=h(r.field(a)),r.setField(a,t.operator==="++"?n+1:n-1)}else if(ee(r)){if(C(a)===!1)throw new d(e,l.KeyAccessorMustBeString,t);if(r.hasField(a)!==!0)throw new d(e,l.FieldNotFound,t);n=h(r.field(a)),r.setField(a,t.operator==="++"?n+1:n-1)}else{if(R(r))throw new d(e,l.Immutable,t);if(!(r instanceof gt))throw new d(e,l.InvalidParameter,t);if(C(a)===!1)throw new d(e,l.ModuleAccessorMustBeString,t);if(r.hasGlobal(a)!==!0)throw new d(e,l.ModuleExportNotFound,t);n=h(r.global(a)),r.setGlobal(a,t.operator==="++"?n+1:n-1)}return t.prefix===!1?n:t.operator==="++"?n+1:n-1}if(r=t.argument.type==="Identifier"?t.argument.name.toLowerCase():"",!r)throw new d(e,l.InvalidIdentifier,t);if(e.localScope!=null&&e.localScope[r]!==void 0)return n=h(e.localScope[r].value),e.localScope[r]={value:t.operator==="++"?n+1:n-1,valueset:!0,node:t},t.prefix===!1?n:t.operator==="++"?n+1:n-1;if(e.globalScope[r]!==void 0)return n=h(e.globalScope[r].value),e.globalScope[r]={value:t.operator==="++"?n+1:n-1,valueset:!0,node:t},t.prefix===!1?n:t.operator==="++"?n+1:n-1;throw new d(e,l.InvalidIdentifier,t)}function Oe(e,t,n,r,a){switch(t){case"=":return e===A?null:e;case"/=":return h(n)/h(e);case"*=":return h(n)*h(e);case"-=":return h(n)-h(e);case"+=":return C(n)||C(e)?w(n)+w(e):h(n)+h(e);case"%=":return h(n)%h(e);default:throw new d(a,l.UnsupportedOperator,r)}}function Tu(e,t){let n=null,r="";if(t.left.type==="MemberExpression"){if(n=v(e,t.left.object),t.left.computed===!0)r=v(e,t.left.property);else{if(t.left.property.type!=="Identifier")throw new d(e,l.InvalidIdentifier,t);r=t.left.property.name}const u=v(e,t.right);if(T(n)){if(!V(r))throw new d(e,l.ArrayAccessorMustBeNumber,t);if(r<0&&(r=n.length+r),r<0||r>n.length)throw new d(e,l.OutOfBounds,t);if(r===n.length){if(t.operator!=="=")throw new d(e,l.OutOfBounds,t);n[r]=Oe(u,t.operator,n[r],t,e)}else n[r]=Oe(u,t.operator,n[r],t,e)}else if(n instanceof k){if(C(r)===!1)throw new d(e,l.KeyAccessorMustBeString,t);if(n.hasField(r)===!0)n.setField(r,Oe(u,t.operator,n.field(r),t,e));else{if(t.operator!=="=")throw new d(e,l.FieldNotFound,t,{key:r});n.setField(r,Oe(u,t.operator,null,t,e))}}else if(ee(n)){if(C(r)===!1)throw new d(e,l.KeyAccessorMustBeString,t);if(n.hasField(r)===!0)n.setField(r,Oe(u,t.operator,n.field(r),t,e));else{if(t.operator!=="=")throw new d(e,l.FieldNotFound,t,{key:r});n.setField(r,Oe(u,t.operator,null,t,e))}}else{if(R(n))throw new d(e,l.Immutable,t);if(!(n instanceof gt))throw new d(e,l.InvalidIdentifier,t);if(C(r)===!1)throw new d(e,l.ModuleAccessorMustBeString,t);if(n.hasGlobal(r)!==!0)throw new d(e,l.ModuleExportNotFound,t);n.setGlobal(r,Oe(u,t.operator,n.global(r),t,e))}return A}n=t.left.name.toLowerCase();const a=v(e,t.right);if(e.localScope!=null&&e.localScope[n]!==void 0)return e.localScope[n]={value:Oe(a,t.operator,e.localScope[n].value,t,e),valueset:!0,node:t.right},A;if(e.globalScope[n]!==void 0)return e.globalScope[n]={value:Oe(a,t.operator,e.globalScope[n].value,t,e),valueset:!0,node:t.right},A;throw new d(e,l.InvalidIdentifier,t)}function Bu(e,t){if(t.expression.type==="AssignmentExpression"||t.expression.type==="UpdateExpression")return v(e,t.expression);if(t.expression.type==="CallExpression"){const n=v(e,t.expression);return n===A?A:new ft(n)}{const n=v(e,t.expression);return n===A?A:new ft(n)}}function Nu(e,t){const n=v(e,t.test);if(n===!0)return v(e,t.consequent);if(n===!1)return t.alternate!==null?v(e,t.alternate):A;throw new d(e,l.BooleanConditionRequired,t)}function _u(e,t){let n=A;for(let r=0;r=n.length||r<0)throw new d(e,l.OutOfBounds,t);return n[r]}throw new d(e,l.InvalidMemberAccessKey,t)}if(C(n)){if(V(r)&&isFinite(r)&&Math.floor(r)===r){if(r<0&&(r=n.length+r),r>=n.length||r<0)throw new d(e,l.OutOfBounds,t);return n[r]}throw new d(e,l.InvalidMemberAccessKey,t)}if(R(n)){if(V(r)&&isFinite(r)&&Math.floor(r)===r){if(r<0&&(r=n.length()+r),r>=n.length()||r<0)throw new d(e,l.OutOfBounds,t);return n.get(r)}throw new d(e,l.InvalidMemberAccessKey,t)}throw new d(e,l.InvalidMemberAccessKey,t)}}catch(n){throw n}}function zu(e,t){try{const n=v(e,t.argument);if(z(n)){if(t.operator==="!")return!n;if(t.operator==="-")return-1*h(n);if(t.operator==="+")return 1*h(n);if(t.operator==="~")return~h(n);throw new d(e,l.UnsupportedUnaryOperator,t)}if(t.operator==="~")return~h(n);if(t.operator==="-")return-1*h(n);if(t.operator==="+")return 1*h(n);throw new d(e,l.UnsupportedUnaryOperator,t)}catch(n){throw n}}function Gu(e,t){try{const n=[];for(let r=0;r>":case">>>":case"^":case"&":return ir(h(r),h(a),t.operator);case"==":return Ee(r,a);case"!=":return!Ee(r,a);case"<":case">":case"<=":case">=":return rr(r,a,t.operator);case"+":return C(r)||C(a)?w(r)+w(a):h(r)+h(a);case"-":return h(r)-h(a);case"*":return h(r)*h(a);case"/":return h(r)/h(a);case"%":return h(r)%h(a);default:throw new d(e,l.UnsupportedOperator,t)}}catch(n){throw n}}function Ju(e,t){try{const n=v(e,t.left);if(z(n))switch(t.operator){case"||":if(n===!0)return n;{const r=v(e,t.right);if(z(r))return r;throw new d(e,l.LogicExpressionOrAnd,t)}case"&&":if(n===!1)return n;{const r=v(e,t.right);if(z(r))return r;throw new d(e,l.LogicExpressionOrAnd,t)}default:throw new d(e,l.LogicExpressionOrAnd,t)}throw new d(e,l.LogicalExpressionOnlyBoolean,t)}catch(n){throw n}}function Vu(e,t){return t.value?t.value.cooked:""}function qu(e,t,n){if(X(e))throw new d(t,l.NoFunctionInTemplateLiteral,n);return e}function ju(e,t){let n="",r=0;for(const a of t.quasis)n+=a.value?a.value.cooked:"",a.tail===!1&&(n+=t.expressions[r]?w(qu(v(e,t.expressions[r]),e,t)):"",r++);return n}function Ki(e,t){let n;try{const r=t.name.toLowerCase();if(e.localScope!=null&&e.localScope[r]!==void 0)return n=e.localScope[r],n.valueset===!0||(n.value=v(e,n.node),n.valueset=!0),n.value;if(e.globalScope[r]!==void 0)return n=e.globalScope[r],n.valueset===!0||(n.value=v(e,n.node),n.valueset=!0),n.value;throw new d(e,l.InvalidIdentifier,t)}catch(r){throw r}}function Hu(e,t){try{if(t.callee.type==="MemberExpression"){const n=v(e,t.callee.object);if(!(n instanceof gt))throw new d(e,l.FunctionNotFound,t);const r=t.callee.computed===!1?t.callee.property.name:v(e,t.callee.property);if(!n.hasGlobal(r))throw new d(e,l.FunctionNotFound,t);const a=n.global(r);if(!X(a))throw new d(e,l.CallNonFunction,t);return a.call(e,t)}if(t.callee.type!=="Identifier")throw new d(e,l.FunctionNotFound,t);if(e.localScope!=null&&e.localScope[t.callee.name.toLowerCase()]!==void 0){const n=e.localScope[t.callee.name.toLowerCase()];if(X(n.value))return n.value.call(e,t);throw new d(e,l.CallNonFunction,t)}if(e.globalScope[t.callee.name.toLowerCase()]!==void 0){const n=e.globalScope[t.callee.name.toLowerCase()];if(X(n.value))return n.value.call(e,t);throw new d(e,l.CallNonFunction,t)}throw new d(e,l.FunctionNotFound,t)}catch(n){throw n}}const he={};function Wi(e,t,n,r){try{const a=t.arguments,u=v(e,a[n]);if(Ee(u,r))return v(e,a[n+1]);{const o=a.length-n;return o===1?v(e,a[n]):o===2?null:o===3?v(e,a[n+2]):Wi(e,t,n+2,r)}}catch(a){throw a}}function Yi(e,t,n,r){try{const a=t.arguments;if(r===!0)return v(e,a[n+1]);if(a.length-n===3)return v(e,a[n+2]);{const u=v(e,a[n+2]);if(z(u)===!1)throw new d(e,l.BooleanConditionRequired,a[n+2]);return Yi(e,t,n+2,u)}}catch(a){throw a}}function Sn(e,t,n,r){try{const a=e.body;if(n.length!==e.params.length)throw new d(t,l.WrongNumberOfParameters,r);if(t.localScope!=null)for(let o=0;oimport("./index-pCX-0tJH.js").then(t=>t.A0),__vite__mapDeps([1,2]));return na=!0,ao(e),!0}let In=null;function fr(){return In!==null||(In=oa()),In}async function oa(){await au(),ke=await qe(()=>import("./arcadeAsyncRuntime-RaDNZAaP.js"),__vite__mapDeps([7,0,1,2,3,4,5,6]));for(const e of jn)ke.extend(e),rt(e,"async");return jn=null,!0}function ua(){return ta}function sa(){return!!ke}function la(){return na}let kn=null;function hr(){return kn||(kn=ca(),kn)}async function ca(){await fr();const[e,t,n,r,a]=await Promise.all([qe(()=>import("./featureSetUtils-0rkR6o7D.js").then(u=>u.l),__vite__mapDeps([8,1,2,9,3,10,5,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])),qe(()=>import("./featuresetbase-ggs9CyN5.js"),__vite__mapDeps([26,3,1,2,8,9,10,5,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,4,6])),qe(()=>import("./featuresetgeom-WIoEup4p.js"),__vite__mapDeps([27,3,1,2,10,9,5,6])),qe(()=>import("./featuresetstats-XgeLbwEn.js"),__vite__mapDeps([28,3,1,2,9,6])),qe(()=>import("./featuresetstring-fiKCNpVo.js"),__vite__mapDeps([29,1,2,3,6]))]);return pa=e,ke.extend([t,n,r,a]),rt([t,n,r,a],"async"),ta=!0,!0}function da(e,t=[]){return e.usesFeatureSet===void 0&&zt(e,t),e.usesFeatureSet===!0}function ts(e,t=[]){return e.isAsync===void 0&&zt(e,t),e.isAsync===!0}function ns(e,t){if(t){for(const n of t)if(dn(e,n))return!0;return!1}return!1}async function fa(e,t,n=[],r=!1,a=null){return mr(new Set,e,t,n,r,a)}async function mr(e,t,n,r=[],a=!1,u=null){const o=typeof t=="string"?lr(t):t,i=[];return o&&(la()===!1&&(fn(o)||a)&&i.push(dr()),sa()===!1&&(o.isAsync===!0||n)&&i.push(fr()),ua()===!1&&(da(o)||ns(o,r))&&i.push(hr())),i.length&&await Promise.all(i),await ha(e,o,u,n,a),!0}function rs(e,t=[]){return e.usesModules===void 0&&zt(e,t),e.usesModules===!0}async function ha(e,t,n=null,r=!1,a=!1){const u=Si(t);n===null&&u.length>0&&(n=me.getDefault()),t.loadedModules={};for(const o of u){ti(n);const i=n.normalizeModuleUri(o.source);if(e.has(i.uri))throw new d(null,l.CircularModules,null);e.add(i.uri);const s=await n.fetchModule(i);await mr(e,s,r,[],a,n),e.delete(i.uri),s.isAsync&&(t.isAsync=!0),s.usesFeatureSet&&(t.usesFeatureSet=!0),s.usesGeometry&&(t.usesGeometry=!0),t.loadedModules[o.libname]={uri:i.uri,script:s}}}function ma(e){if(fn(e))return!0;const t=Ln(e);let n=!1;for(let r=0;r{Kr.test(o)&&(o=o.replace(Kr,""),a.push(o))});const u=a.filter(o=>o.includes("*"));return a=a.filter(o=>!u.includes(o)),t&&u.forEach(o=>{const i=new RegExp(`^${o.split(/\*+/).map(os).join(".*")}$`,"i");t.forEach(s=>i.test(s)?a.push(s):null)}),[...new Set(a.sort())]}function Ds(e){return dn(e,"$view")}function gs(e,t){return!!e&&dn(e,t)}function ys(e){if(!(!e||e.spatialReference==null&&(e.scale==null||e.viewingMode==null)))return{view:e.viewingMode&&e.scale!=null?new k({viewingMode:e.viewingMode,scale:e.scale}):null,sr:e.spatialReference}}function ws({url:e,spatialReference:t,lrucache:n,interceptor:r}){const a=hn();return a?a.createFeatureSetCollectionFromService(e,t,n,r):null}function xs({layer:e,spatialReference:t,outFields:n,returnGeometry:r,lrucache:a,interceptor:u}){if(e===null)return null;const o=hn();return o?o.constructFeatureSet(e,t,n,r??!0,a,u):null}function Fs(e){if((e==null?void 0:e.map)===null)return null;const t=hn();return t?t.createFeatureSetCollectionFromMap(e.map,e.spatialReference,e.lrucache,e.interceptor):null}function Cs(e,t){return k.convertJsonToArcade(e,t)}function As(e,t,n=[]){return fa(e,t,n)}function bs(){return dr()}function Es(){return hr()}function Ss(e){return e.type==="simple"||e.type==="class-breaks"||e.type==="unique-value"||e.type==="dot-density"||e.type==="dictionary"||e.type==="pie-chart"}function vs(e){return e.declaredClass==="esri.layers.support.LabelClass"}function Is(e){return e.declaredClass==="esri.PopupTemplate"}function Da(e,t){var r,a;if(!e)return!1;if(typeof e=="string")return t(e);const n=e;if(Ss(n)){if(n.type==="dot-density"){const i=(r=n.attributes)==null?void 0:r.some(s=>t(s.valueExpression));if(i)return i}const u=n.visualVariables,o=!!u&&u.some(i=>{let s=t(i.valueExpression);return i.type==="size"&&(Wr(i.minSize)&&(s=s||t(i.minSize.valueExpression)),Wr(i.maxSize)&&(s=s||t(i.maxSize.valueExpression))),s});return!(!("valueExpression"in n)||!t(n.valueExpression))||o}if(vs(n)){const u=(a=n.labelExpressionInfo)==null?void 0:a.expression;return!(!u||!t(u))||!1}return!!Is(n)&&(!!n.expressionInfos&&n.expressionInfos.some(u=>t(u.expression))||Array.isArray(n.content)&&n.content.some(u=>{var o;return u.type==="expression"&&t((o=u.expressionInfo)==null?void 0:o.expression)}))}function ks(e){const t=Gt(e);return!!t&&ma(t)}function Ts(e){return Da(e,ks)}function Bs(e){const t=Gt(e);return!!t&&fn(t)}function Ns(e){return Da(e,Bs)}function Wr(e){return e&&e.declaredClass==="esri.renderers.visualVariables.SizeVariable"}const hl=Object.freeze(Object.defineProperty({__proto__:null,Dictionary:k,arcade:is,arcadeFeature:Q,convertFeatureLayerToFeatureSet:xs,convertJsonToArcade:Cs,convertMapToFeatureSetCollection:Fs,convertServiceUrlToWorkspace:ws,createExecContext:ls,createFeature:cs,createFunction:ss,createSyntaxTree:Gt,dependsOnView:Ds,enableFeatureSetOperations:Es,enableGeometryOperations:bs,evalSyntaxTree:fs,executeAsyncFunction:ms,executeFunction:hs,extractFieldNames:ps,getArcadeType:us,getViewInfo:ys,hasGeometryFunctions:Ts,hasGeometryOperations:Ns,hasVariable:gs,loadScriptDependencies:As,updateExecContext:ds},Symbol.toStringTag,{value:"Module"}));export{Ri as $,$ as A,ht as B,vi as C,Q as D,Pn as E,ye as F,z as G,xt as H,ir as I,se as J,J as K,$t as L,ft as M,k as N,Ie as O,C as P,q as Q,wt as R,Na as S,He as T,ee as U,Zs as V,Bi as W,P as X,yn as Y,Z,gi as _,d as a,un as a0,jt as a1,yi as a2,mi as a3,wi as a4,pi as a5,we as a6,xi as a7,Cr as a8,Mn as a9,so as aA,$a as aB,Di as aC,hl as aD,kt as aa,qt as ab,Ya as ac,Xa as ad,ja as ae,Ct as af,gr as ag,wr as ah,qs as ai,Hs as aj,xr as ak,js as al,Vs as am,Js as an,Ks as ao,el as ap,yr as aq,Ws as ar,Xs as as,Ta as at,Fr as au,Ys as av,_a as aw,Qs as ax,nl as ay,tl as az,R as b,h as c,w as d,nt as e,$i as f,rr as g,Ee as h,te as i,tt as j,ze as k,dt as l,_i as m,D as n,$n as o,On as p,T as q,l as r,an as s,Pt as t,Ia as u,X as v,A as w,ae as x,_ as y,V as z}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/geomasync-_hAyjeTi.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/TimeOnly-ljWtUK7N.js","assets/portalUtils-MqaWunxU.js","assets/geometryEngineAsync-QjQc0riy.js","assets/hash-SS5GKVPY.js","assets/arcadeAsyncRuntime-RlgIDugP.js","assets/featureSetUtils-DaHg3px6.js","assets/WhereClause-XAMIZ4-B.js","assets/SpatialFilter-CXhA7RaJ.js","assets/FeatureLayer--S4epFk-.js","assets/FeatureLayerBase-jpFp8gE3.js","assets/serviceCapabilitiesUtils-26KpT1VN.js","assets/editsZScale-Wgw9kbYG.js","assets/queryZScale-IaMm02_2.js","assets/FeatureSet-d4S1oKME.js","assets/CustomParametersMixin-Y1bOcayO.js","assets/FeatureEffectLayer-oBa8pIG5.js","assets/FeatureEffect-5bEV-xG1.js","assets/FeatureReductionLayer-RlitE1N6.js","assets/OrderedLayer-M7k5gLgx.js","assets/FeatureTemplate-kUgbbA00.js","assets/FeatureType-MpRe7WJj.js","assets/versionUtils-4v9zIDlv.js","assets/TopFeaturesQuery-E6D2tV-x.js","assets/SubtypeGroupLayer-xK5RtU9X.js","assets/executeQueryJSON-ACj9qY0y.js","assets/query-rG0aX6cE.js","assets/pbfQueryUtils-pWizwTQZ.js","assets/pbf-o0zzptPp.js","assets/executeQueryPBF-vdaOUMid.js","assets/AttachmentInfo-kbEMEIl0.js","assets/executeForIds-wXO8-pll.js","assets/featuresetbase-WjFIOCEy.js","assets/featuresetgeom-3-0z5YnY.js","assets/featuresetstats-NfM8OXOZ.js","assets/featuresetstring-bt3R_cQ2.js"] + __vite__mapDeps.viteFileDeps = ["assets/geomasync-7v4-s3fM.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/TimeOnly-gkehHHJx.js","assets/portalUtils-siGJ35LN.js","assets/geometryEngineAsync-ly7k1Z_H.js","assets/hash-SS5GKVPY.js","assets/arcadeAsyncRuntime-RaDNZAaP.js","assets/featureSetUtils-0rkR6o7D.js","assets/WhereClause-FOYoIAAW.js","assets/SpatialFilter-h73GoH-a.js","assets/FeatureLayer-9tNCmEbA.js","assets/FeatureLayerBase-mvqC7cJs.js","assets/serviceCapabilitiesUtils-f-iBP4uh.js","assets/editsZScale-4-dTv58d.js","assets/CustomParametersMixin-7nmugR3Y.js","assets/FeatureEffectLayer-OK0TB5f6.js","assets/FeatureEffect-0Jn9Z0sQ.js","assets/FeatureReductionLayer-2X2_PJv9.js","assets/OrderedLayer-XNaJwl_G.js","assets/FeatureTemplate-vSzbyslg.js","assets/FeatureType-0WPvBvpQ.js","assets/versionUtils-idhrDltC.js","assets/SubtypeGroupLayer-lkxtOZrq.js","assets/executeQueryPBF-P21isUTI.js","assets/executeForIds-PXSIkRGk.js","assets/featuresetbase-ggs9CyN5.js","assets/featuresetgeom-WIoEup4p.js","assets/featuresetstats-XgeLbwEn.js","assets/featuresetstring-fiKCNpVo.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/arcgis-knowledge-client-core-k0_SaRI-.js b/dist/assets/arcgis-knowledge-client-core-FOb54Y-y.js similarity index 91% rename from dist/assets/arcgis-knowledge-client-core-k0_SaRI-.js rename to dist/assets/arcgis-knowledge-client-core-FOb54Y-y.js index 67663df..055a256 100644 --- a/dist/assets/arcgis-knowledge-client-core-k0_SaRI-.js +++ b/dist/assets/arcgis-knowledge-client-core-FOb54Y-y.js @@ -1,3 +1,3 @@ -import{cg as Ke,g_ as Rr}from"./index-J0iiHjMT.js";function Qe(S,c){for(var z=0;zE[U]})}}}return Object.freeze(Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}))}var $e,Yr,ke,Pr={exports:{}};Pr.exports,$e=Pr,Pr.exports,Yr=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,ke=function(S){var c,z,E;S=S||{},c||(c=S!==void 0?S:{}),c.ready=new Promise(function(r,e){z=r,E=e});var U=Object.assign({},c),q="./this.program",x="";typeof document<"u"&&document.currentScript&&(x=document.currentScript.src),Yr&&(x=Yr),x=x.indexOf("blob:")!==0?x.substr(0,x.replace(/[?#].*/,"").lastIndexOf("/")+1):"";var J,Oe=c.print||console.log.bind(console),N=c.printErr||console.warn.bind(console);Object.assign(c,U),U=null,c.thisProgram&&(q=c.thisProgram),c.wasmBinary&&(J=c.wasmBinary),c.noExitRuntime,typeof WebAssembly!="object"&&K("no native wasm support detected");var Cr,$r,F,_,Y,X,w,y,Hr,Vr,Br,zr,qr=!1,Nr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ur(r,e,n){var t=e+n;for(n=e;r[n]&&!(n>=t);)++n;if(16(a=(240&a)==224?(15&a)<<12|i<<6|f:(7&a)<<18|i<<12|f<<6|63&r[e++])?t+=String.fromCharCode(a):(a-=65536,t+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else t+=String.fromCharCode(a)}return t}function Lr(r,e,n,t){if(0=i&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),127>=i){if(n>=t)break;e[n++]=i}else{if(2047>=i){if(n+1>=t)break;e[n++]=192|i>>6}else{if(65535>=i){if(n+2>=t)break;e[n++]=224|i>>12}else{if(n+3>=t)break;e[n++]=240|i>>18,e[n++]=128|i>>12&63}e[n++]=128|i>>6&63}e[n++]=128|63&i}}e[n]=0}}function Gr(r){for(var e=0,n=0;n=t?e++:2047>=t?e+=2:55296<=t&&57343>=t?(e+=4,++n):e+=3}return e}function Jr(){var r=Cr.buffer;$r=r,c.HEAP8=F=new Int8Array(r),c.HEAP16=Y=new Int16Array(r),c.HEAP32=w=new Int32Array(r),c.HEAPU8=_=new Uint8Array(r),c.HEAPU16=X=new Uint16Array(r),c.HEAPU32=y=new Uint32Array(r),c.HEAPF32=Hr=new Float32Array(r),c.HEAPF64=zr=new Float64Array(r),c.HEAP64=Vr=new BigInt64Array(r),c.HEAPU64=Br=new BigUint64Array(r)}var Xr,Zr=[],Kr=[],Qr=[];function Ee(){var r=c.preRun.shift();Zr.unshift(r)}var D,H=0,Z=null;function K(r){throw c.onAbort&&c.onAbort(r),N(r="Aborted("+r+")"),qr=!0,r=new WebAssembly.RuntimeError(r+". Build with -sASSERTIONS for more info."),E(r),r}function re(){return D.startsWith("data:application/octet-stream;base64,")}if(D="arcgis-knowledge-client-core.wasm",!re()){var ee=D;D=c.locateFile?c.locateFile(ee,x):x+ee}function ne(){var r=D;try{if(r==D&&J)return new Uint8Array(J);throw"both async and sync fetching of the wasm failed"}catch(e){K(e)}}function je(){return J||typeof fetch!="function"?Promise.resolve().then(function(){return ne()}):fetch(D,{credentials:"same-origin"}).then(function(r){if(!r.ok)throw"failed to load wasm binary file at '"+D+"'";return r.arrayBuffer()}).catch(function(){return ne()})}function kr(r){for(;0>2]=e},this.Oa=function(e){y[this.fa+8>>2]=e},this.Ua=function(){w[this.fa>>2]=0},this.Ma=function(){F[this.fa+12>>0]=0},this.Va=function(){F[this.fa+13>>0]=0},this.Ia=function(e,n){this.La(),this.Ya(e),this.Oa(n),this.Ua(),this.Ma(),this.Va()},this.La=function(){y[this.fa+16>>2]=0}}var cr={};function fr(r){for(;r.length;){var e=r.pop();r.pop()(e)}}function Q(r){return this.fromWireType(w[r>>2])}var L={},V={},sr={};function te(r){if(r===void 0)return"_unknown";var e=(r=r.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=e&&57>=e?"_"+r:r}function Wr(r,e){return r=te(r),function(){return e.apply(this,arguments)}}function Or(r){var e=Error,n=Wr(r,function(t){this.name=r,this.message=t,(t=Error(t).stack)!==void 0&&(this.stack=this.toString()+` -`+t.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},n}var ae=void 0;function lr(r){throw new ae(r)}function $(r,e,n){function t(u){(u=n(u)).length!==r.length&&lr("Mismatched type converter count");for(var l=0;l{V.hasOwnProperty(u)?a[l]=V[u]:(i.push(u),L.hasOwnProperty(u)||(L[u]=[]),L[u].push(()=>{a[l]=V[u],++f===i.length&&t(a)}))}),i.length===0&&t(a)}function rr(r){if(r===null)return"null";var e=typeof r;return e==="object"||e==="array"||e==="function"?r.toString():""+r}var ie=void 0;function b(r){for(var e="";_[r];)e+=ie[_[r++]];return e}var G=void 0;function m(r){throw new G(r)}function k(r,e,n={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var t=e.name;if(r||m('type "'+t+'" must have a positive integer typeid pointer'),V.hasOwnProperty(r)){if(n.Wa)return;m("Cannot register type '"+t+"' twice")}V[r]=e,delete sr[r],L.hasOwnProperty(r)&&(e=L[r],delete L[r],e.forEach(a=>a()))}function oe(r,e,n){switch(e){case 0:return n?function(t){return F[t]}:function(t){return _[t]};case 1:return n?function(t){return Y[t>>1]}:function(t){return X[t>>1]};case 2:return n?function(t){return w[t>>2]}:function(t){return y[t>>2]};case 3:return n?function(t){return Vr[t>>3]}:function(t){return Br[t>>3]};default:throw new TypeError("Unknown integer type: "+r)}}function er(r){switch(r){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+r)}}function Er(r){m(r.da.ga.ea.name+" instance already deleted")}var jr=!1;function ue(){}function ce(r){--r.count.value,r.count.value===0&&(r.ia?r.ka.na(r.ia):r.ga.ea.na(r.fa))}function fe(r,e,n){return e===n?r:n.la===void 0||(r=fe(r,e,n.la))===null?null:n.Ka(r)}var se={},nr=[];function Sr(){for(;nr.length;){var r=nr.pop();r.da.ta=!1,r.delete()}}var tr=void 0,ar={};function Fe(r,e){for(e===void 0&&m("ptr should not be undefined");r.la;)e=r.va(e),r=r.la;return ar[e]}function hr(r,e){return e.ga&&e.fa||lr("makeClassHandle requires ptr and ptrType"),!!e.ka!=!!e.ia&&lr("Both smartPtrType and smartPtr must be specified"),e.count={value:1},dr(Object.create(r,{da:{value:e}}))}function dr(r){return typeof FinalizationRegistry>"u"?(dr=e=>e,r):(jr=new FinalizationRegistry(e=>{ce(e.da)}),ue=e=>{jr.unregister(e)},(dr=e=>{var n=e.da;return n.ia&&jr.register(e,{da:n},e),e})(r))}function I(){}function Fr(r,e,n){if(r[e].ha===void 0){var t=r[e];r[e]=function(){return r[e].ha.hasOwnProperty(arguments.length)||m("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+r[e].ha+")!"),r[e].ha[arguments.length].apply(this,arguments)},r[e].ha=[],r[e].ha[t.sa]=t}}function Dr(r,e,n){c.hasOwnProperty(r)?((n===void 0||c[r].ha!==void 0&&c[r].ha[n]!==void 0)&&m("Cannot register public name '"+r+"' twice"),Fr(c,r,r),c.hasOwnProperty(n)&&m("Cannot register multiple overloads of a function with the same number of arguments ("+n+")!"),c[r].ha[n]=e):(c[r]=e,n!==void 0&&(c[r].kb=n))}function De(r,e,n,t,a,i,f,u){this.name=r,this.constructor=e,this.oa=n,this.na=t,this.la=a,this.Pa=i,this.va=f,this.Ka=u,this.$a=[]}function pr(r,e,n){for(;e!==n;)e.va||m("Expected null or instance of "+n.name+", got an instance of "+e.name),r=e.va(r),e=e.la;return r}function Me(r,e){return e===null?(this.Aa&&m("null is not a valid "+this.name),0):(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),pr(e.da.fa,e.da.ga.ea,this.ea))}function Ue(r,e){if(e===null){if(this.Aa&&m("null is not a valid "+this.name),this.xa){var n=this.Ba();return r!==null&&r.push(this.na,n),n}return 0}if(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),!this.wa&&e.da.ga.wa&&m("Cannot convert argument of type "+(e.da.ka?e.da.ka.name:e.da.ga.name)+" to parameter type "+this.name),n=pr(e.da.fa,e.da.ga.ea,this.ea),this.xa)switch(e.da.ia===void 0&&m("Passing raw pointer to smart pointer is illegal"),this.fb){case 0:e.da.ka===this?n=e.da.ia:m("Cannot convert argument of type "+(e.da.ka?e.da.ka.name:e.da.ga.name)+" to parameter type "+this.name);break;case 1:n=e.da.ia;break;case 2:if(e.da.ka===this)n=e.da.ia;else{var t=e.clone();n=this.ab(n,O(function(){t.delete()})),r!==null&&r.push(this.na,n)}break;default:m("Unsupporting sharing policy")}return n}function xe(r,e){return e===null?(this.Aa&&m("null is not a valid "+this.name),0):(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),e.da.ga.wa&&m("Cannot convert argument of type "+e.da.ga.name+" to parameter type "+this.name),pr(e.da.fa,e.da.ga.ea,this.ea))}function j(r,e,n,t,a,i,f,u,l,s,h){this.name=r,this.ea=e,this.Aa=n,this.wa=t,this.xa=a,this.Za=i,this.fb=f,this.Ga=u,this.Ba=l,this.ab=s,this.na=h,a||e.la!==void 0?this.toWireType=Ue:(this.toWireType=t?Me:xe,this.ja=null)}function le(r,e,n){c.hasOwnProperty(r)||lr("Replacing nonexistant public symbol"),c[r].ha!==void 0&&n!==void 0?c[r].ha[n]=e:(c[r]=e,c[r].sa=n)}var vr=[];function T(r,e){r=b(r);var n=vr[e];return n||(e>=vr.length&&(vr.length=e+1),vr[e]=n=Xr.get(e)),typeof n!="function"&&m("unknown function pointer with signature "+r+": "+e),n}var he=void 0;function de(r){var e=b(r=_e(r));return M(r),e}function B(r,e){function n(i){a[i]||V[i]||(sr[i]?sr[i].forEach(n):(t.push(i),a[i]=!0))}var t=[],a={};throw e.forEach(n),new he(r+": "+t.map(de).join([", "]))}function gr(r,e,n,t,a){var i=e.length;2>i&&m("argTypes array size mismatch! Must at least get return value and 'this' types!");var f=e[1]!==null&&n!==null,u=!1;for(n=1;n>2]);return n}function pe(r,e,n){return r instanceof Object||m(n+' with invalid "this": '+r),r instanceof e.ea.constructor||m(n+' incompatible with "this" of type '+r.constructor.name),r.da.fa||m("cannot call emscripten binding method "+n+" on deleted object"),pr(r.da.fa,r.da.ga.ea,e.ea)}var Mr=[],W=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Ur(r){4(r||m("Cannot use deleted val. handle = "+r),W[r].value),O=r=>{switch(r){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var e=Mr.length?Mr.pop():W.length;return W[e]={Ca:1,value:r},e}};function Ie(r,e,n){switch(e){case 0:return function(t){return this.fromWireType((n?F:_)[t])};case 1:return function(t){return this.fromWireType((n?Y:X)[t>>1])};case 2:return function(t){return this.fromWireType((n?w:y)[t>>2])};default:throw new TypeError("Unknown integer type: "+r)}}function ir(r,e){var n=V[r];return n===void 0&&m(e+" has unknown type "+de(r)),n}function Re(r,e){switch(e){case 2:return function(n){return this.fromWireType(Hr[n>>2])};case 3:return function(n){return this.fromWireType(zr[n>>3])};default:throw new TypeError("Unknown float type: "+r)}}var ve=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Ye(r,e){for(var n=r>>1,t=n+e/2;!(n>=t)&&X[n];)++n;if(32<(n<<=1)-r&&ve)return ve.decode(_.subarray(r,n));for(n="",t=0;!(t>=e/2);++t){var a=Y[r+2*t>>1];if(a==0)break;n+=String.fromCharCode(a)}return n}function He(r,e,n){if(n===void 0&&(n=2147483647),2>n)return 0;var t=e;n=(n-=2)<2*r.length?n/2:r.length;for(var a=0;a>1]=r.charCodeAt(a),e+=2;return Y[e>>1]=0,e-t}function Ve(r){return 2*r.length}function Be(r,e){for(var n=0,t="";!(n>=e/4);){var a=w[r+4*n>>2];if(a==0)break;++n,65536<=a?(a-=65536,t+=String.fromCharCode(55296|a>>10,56320|1023&a)):t+=String.fromCharCode(a)}return t}function ze(r,e,n){if(n===void 0&&(n=2147483647),4>n)return 0;var t=e;n=t+n-4;for(var a=0;a=i&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),w[e>>2]=i,(e+=4)+4>n)break}return w[e>>2]=0,e-t}function qe(r){for(var e=0,n=0;n=t&&++n,e+=4}return e}function ge(r,e){for(var n=Array(r),t=0;t>2],"parameter "+t);return n}var Ne={};function yr(r){var e=Ne[r];return e===void 0?b(r):e}var br=[];function me(){function r(e){e.$$$embind_global$$$=e;var n=typeof $$$embind_global$$$=="object"&&e.$$$embind_global$$$==e;return n||delete e.$$$embind_global$$$,n}if(typeof globalThis=="object")return globalThis;if(typeof $$$embind_global$$$=="object"||(typeof Rr=="object"&&r(Rr)?$$$embind_global$$$=Rr:typeof self=="object"&&r(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")}function Le(r){var e=br.length;return br.push(r),e}var ye=[],xr={};function be(){if(!Ir){var r,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:q||"./this.program"};for(r in xr)xr[r]===void 0?delete e[r]:e[r]=xr[r];var n=[];for(r in e)n.push(r+"="+e[r]);Ir=n}return Ir}var Ir,Ge=[null,[],[]];function wr(r){return r%4==0&&(r%100!=0||r%400==0)}var we=[31,29,31,30,31,30,31,31,30,31,30,31],Ae=[31,28,31,30,31,30,31,31,30,31,30,31];function Je(r){var e=Array(Gr(r)+1);return Lr(r,e,0,e.length),e}function Xe(r,e,n,t){function a(o,d,g){for(o=typeof o=="number"?o.toString():o||"";o.lengthC?-1:0A-o.getDate())){o.setDate(o.getDate()+d);break}d-=A-o.getDate()+1,o.setDate(1),11>g?o.setMonth(g+1):(o.setMonth(0),o.setFullYear(o.getFullYear()+1))}return g=new Date(o.getFullYear()+1,0,4),d=u(new Date(o.getFullYear(),0,4)),g=u(g),0>=f(d,o)?0>=f(g,o)?o.getFullYear()+1:o.getFullYear():o.getFullYear()-1}var s=w[t+40>>2];for(var h in t={ib:w[t>>2],hb:w[t+4>>2],ya:w[t+8>>2],Da:w[t+12>>2],za:w[t+16>>2],ra:w[t+20>>2],ma:w[t+24>>2],qa:w[t+28>>2],lb:w[t+32>>2],gb:w[t+36>>2],jb:s&&s?ur(_,s):""},n=n?ur(_,n):"",s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(h,"g"),s[h]);var p="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),v="January February March April May June July August September October November December".split(" ");for(h in s={"%a":function(o){return p[o.ma].substring(0,3)},"%A":function(o){return p[o.ma]},"%b":function(o){return v[o.za].substring(0,3)},"%B":function(o){return v[o.za]},"%C":function(o){return i((o.ra+1900)/100|0,2)},"%d":function(o){return i(o.Da,2)},"%e":function(o){return a(o.Da,2," ")},"%g":function(o){return l(o).toString().substring(2)},"%G":function(o){return l(o)},"%H":function(o){return i(o.ya,2)},"%I":function(o){return(o=o.ya)==0?o=12:12o.ya?"AM":"PM"},"%S":function(o){return i(o.ib,2)},"%t":function(){return" "},"%u":function(o){return o.ma||7},"%U":function(o){return i(Math.floor((o.qa+7-o.ma)/7),2)},"%V":function(o){var d=Math.floor((o.qa+7-(o.ma+6)%7)/7);if(2>=(o.ma+371-o.qa-2)%7&&d++,d)d==53&&((g=(o.ma+371-o.qa)%7)==4||g==3&&wr(o.ra)||(d=1));else{d=52;var g=(o.ma+7-o.qa-1)%7;(g==4||g==5&&wr(o.ra%400-1))&&d++}return i(d,2)},"%w":function(o){return o.ma},"%W":function(o){return i(Math.floor((o.qa+7-(o.ma+6)%7)/7),2)},"%y":function(o){return(o.ra+1900).toString().substring(2)},"%Y":function(o){return o.ra+1900},"%z":function(o){var d=0<=(o=o.gb);return o=Math.abs(o)/60,(d?"+":"-")+("0000"+(o/60*100+o%60)).slice(-4)},"%Z":function(o){return o.jb},"%%":function(){return"%"}},n=n.replace(/%%/g,"\0\0"),s)n.includes(h)&&(n=n.replace(new RegExp(h,"g"),s[h](t)));return(h=Je(n=n.replace(/\0\0/g,"%"))).length>e?0:(F.set(h,r),h.length-1)}ae=c.InternalError=Or("InternalError");for(var Te=Array(256),Ar=0;256>Ar;++Ar)Te[Ar]=String.fromCharCode(Ar);ie=Te,G=c.BindingError=Or("BindingError"),I.prototype.isAliasOf=function(r){if(!(this instanceof I&&r instanceof I))return!1;var e=this.da.ga.ea,n=this.da.fa,t=r.da.ga.ea;for(r=r.da.fa;e.la;)n=e.va(n),e=e.la;for(;t.la;)r=t.va(r),t=t.la;return e===t&&n===r},I.prototype.clone=function(){if(this.da.fa||Er(this),this.da.ua)return this.da.count.value+=1,this;var r=dr,e=Object,n=e.create,t=Object.getPrototypeOf(this),a=this.da;return(r=r(n.call(e,t,{da:{value:{count:a.count,ta:a.ta,ua:a.ua,fa:a.fa,ga:a.ga,ia:a.ia,ka:a.ka}}}))).da.count.value+=1,r.da.ta=!1,r},I.prototype.delete=function(){this.da.fa||Er(this),this.da.ta&&!this.da.ua&&m("Object already scheduled for deletion"),ue(this),ce(this.da),this.da.ua||(this.da.ia=void 0,this.da.fa=void 0)},I.prototype.isDeleted=function(){return!this.da.fa},I.prototype.deleteLater=function(){return this.da.fa||Er(this),this.da.ta&&!this.da.ua&&m("Object already scheduled for deletion"),nr.push(this),nr.length===1&&tr&&tr(Sr),this.da.ta=!0,this},c.getInheritedInstanceCount=function(){return Object.keys(ar).length},c.getLiveInheritedInstances=function(){var r,e=[];for(r in ar)ar.hasOwnProperty(r)&&e.push(ar[r]);return e},c.flushPendingDeletes=Sr,c.setDelayFunction=function(r){tr=r,nr.length&&tr&&tr(Sr)},j.prototype.Qa=function(r){return this.Ga&&(r=this.Ga(r)),r},j.prototype.Ea=function(r){this.na&&this.na(r)},j.prototype.argPackAdvance=8,j.prototype.readValueFromPointer=Q,j.prototype.deleteObject=function(r){r!==null&&r.delete()},j.prototype.fromWireType=function(r){function e(){return this.xa?hr(this.ea.oa,{ga:this.Za,fa:n,ka:this,ia:r}):hr(this.ea.oa,{ga:this,fa:r})}var n=this.Qa(r);if(!n)return this.Ea(r),null;var t=Fe(this.ea,n);if(t!==void 0)return t.da.count.value===0?(t.da.fa=n,t.da.ia=r,t.clone()):(t=t.clone(),this.Ea(r),t);if(t=this.ea.Pa(n),!(t=se[t]))return e.call(this);t=this.wa?t.Ha:t.pointerType;var a=fe(n,this.ea,t.ea);return a===null?e.call(this):this.xa?hr(t.ea.oa,{ga:t,fa:a,ka:this,ia:r}):hr(t.ea.oa,{ga:t,fa:a})},he=c.UnboundTypeError=Or("UnboundTypeError"),c.count_emval_handles=function(){for(var r=0,e=5;ei.Ta).concat(a.map(i=>i.cb)),i=>{var f={};return a.forEach((u,l)=>{var s=i[l],h=u.Ra,p=u.Sa,v=i[l+a.length],o=u.bb,d=u.eb;f[u.Na]={read:g=>s.fromWireType(h(p,g)),write:(g,A)=>{var C=[];o(d,g,v.toWireType(C,A)),fr(C)}}}),[{name:e.name,fromWireType:function(u){var l,s={};for(l in f)s[l]=f[l].read(u);return t(u),s},toWireType:function(u,l){for(var s in f)if(!(s in l))throw new TypeError('Missing field: "'+s+'"');var h=n();for(s in f)f[s].write(h,l[s]);return u!==null&&u.push(t,h),h},argPackAdvance:8,readValueFromPointer:Q,ja:t}]})},E:function(r,e,n,t,a){e=b(e),n=er(n);var i=e.indexOf("u")!=-1;i&&(a=(1n<<64n)-1n),k(r,{name:e,fromWireType:function(f){return f},toWireType:function(f,u){if(typeof u!="bigint"&&typeof u!="number")throw new TypeError('Cannot convert "'+rr(u)+'" to '+this.name);if(ua)throw new TypeError('Passing a number "'+rr(u)+'" from JS side to C/C++ side to an argument of type "'+e+'", which is outside the valid range ['+t+", "+a+"]!");return u},argPackAdvance:8,readValueFromPointer:oe(e,n,!i),ja:null})},S:function(r,e,n,t,a){var i=er(n);k(r,{name:e=b(e),fromWireType:function(f){return!!f},toWireType:function(f,u){return u?t:a},argPackAdvance:8,readValueFromPointer:function(f){if(n===1)var u=F;else if(n===2)u=Y;else{if(n!==4)throw new TypeError("Unknown boolean type size: "+e);u=w}return this.fromWireType(u[f>>i])},ja:null})},f:function(r,e,n,t,a,i,f,u,l,s,h,p,v){h=b(h),i=T(a,i),u&&(u=T(f,u)),s&&(s=T(l,s)),v=T(p,v);var o=te(h);Dr(o,function(){B("Cannot construct "+h+" due to unbound types",[t])}),$([r,e,n],t?[t]:[],function(d){if(d=d[0],t)var g=d.ea,A=g.oa;else A=I.prototype;d=Wr(o,function(){if(Object.getPrototypeOf(this)!==C)throw new G("Use 'new' to construct "+h);if(R.pa===void 0)throw new G(h+" has no accessible constructor");var Ce=R.pa[arguments.length];if(Ce===void 0)throw new G("Tried to invoke ctor of "+h+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(R.pa).toString()+") parameters instead!");return Ce.apply(this,arguments)});var C=Object.create(A,{constructor:{value:d}});d.prototype=C;var R=new De(h,d,C,v,g,i,u,s);g=new j(h,R,!0,!1,!1),A=new j(h+"*",R,!1,!1,!1);var or=new j(h+" const*",R,!1,!0,!1);return se[r]={pointerType:A,Ha:or},le(o,d),[g,A,or]})},o:function(r,e,n,t,a,i,f){var u=mr(n,t);e=b(e),i=T(a,i),$([],[r],function(l){function s(){B("Cannot call "+h+" due to unbound types",u)}var h=(l=l[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var p=l.ea.constructor;return p[e]===void 0?(s.sa=n-1,p[e]=s):(Fr(p,e,h),p[e].ha[n-1]=s),$([],u,function(v){return v=gr(h,[v[0],null].concat(v.slice(1)),null,i,f),p[e].ha===void 0?(v.sa=n-1,p[e]=v):p[e].ha[n-1]=v,[]}),[]})},i:function(r,e,n,t,a,i){0{B("Cannot construct "+u.name+" due to unbound types",f)},$([],f,function(s){return s.splice(1,0,null),u.ea.pa[e-1]=gr(l,s,null,a,i),[]}),[]})},b:function(r,e,n,t,a,i,f,u){var l=mr(n,t);e=b(e),i=T(a,i),$([],[r],function(s){function h(){B("Cannot call "+p+" due to unbound types",l)}var p=(s=s[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),u&&s.ea.$a.push(e);var v=s.ea.oa,o=v[e];return o===void 0||o.ha===void 0&&o.className!==s.name&&o.sa===n-2?(h.sa=n-2,h.className=s.name,v[e]=h):(Fr(v,e,p),v[e].ha[n-2]=h),$([],l,function(d){return d=gr(p,d,s,i,f),v[e].ha===void 0?(d.sa=n-2,v[e]=d):v[e].ha[n-2]=d,[]}),[]})},c:function(r,e,n,t,a,i,f,u,l,s){e=b(e),a=T(t,a),$([],[r],function(h){var p=(h=h[0]).name+"."+e,v={get:function(){B("Cannot access "+p+" due to unbound types",[n,f])},enumerable:!0,configurable:!0};return v.set=l?()=>{B("Cannot access "+p+" due to unbound types",[n,f])}:()=>{m(p+" is a read-only property")},Object.defineProperty(h.ea.oa,e,v),$([],l?[n,f]:[n],function(o){var d=o[0],g={get:function(){var C=pe(this,h,p+" getter");return d.fromWireType(a(i,C))},enumerable:!0};if(l){l=T(u,l);var A=o[1];g.set=function(C){var R=pe(this,h,p+" setter"),or=[];l(s,R,A.toWireType(or,C)),fr(or)}}return Object.defineProperty(h.ea.oa,e,g),[]}),[]})},R:function(r,e){k(r,{name:e=b(e),fromWireType:function(n){var t=P(n);return Ur(n),t},toWireType:function(n,t){return O(t)},argPackAdvance:8,readValueFromPointer:Q,ja:null})},s:function(r,e,n,t){function a(){}n=er(n),e=b(e),a.values={},k(r,{name:e,constructor:a,fromWireType:function(i){return this.constructor.values[i]},toWireType:function(i,f){return f.value},argPackAdvance:8,readValueFromPointer:Ie(e,n,t),ja:null}),Dr(e,a)},e:function(r,e,n){var t=ir(r,"enum");e=b(e),r=t.constructor,t=Object.create(t.constructor.prototype,{value:{value:n},constructor:{value:Wr(t.name+"_"+e,function(){})}}),r.values[n]=t,r[e]=t},D:function(r,e,n){n=er(n),k(r,{name:e=b(e),fromWireType:function(t){return t},toWireType:function(t,a){return a},argPackAdvance:8,readValueFromPointer:Re(e,n),ja:null})},V:function(r,e,n,t,a,i){var f=mr(e,n);r=b(r),a=T(t,a),Dr(r,function(){B("Cannot call "+r+" due to unbound types",f)},e-1),$([],f,function(u){return le(r,gr(r,[u[0],null].concat(u.slice(1)),null,a,i),e-1),[]})},w:function(r,e,n,t,a){e=b(e),a===-1&&(a=4294967295),a=er(n);var i=u=>u;if(t===0){var f=32-8*n;i=u=>u<>>f}n=e.includes("unsigned")?function(u,l){return l>>>0}:function(u,l){return l},k(r,{name:e,fromWireType:i,toWireType:n,argPackAdvance:8,readValueFromPointer:oe(e,a,t!==0),ja:null})},q:function(r,e,n){function t(i){var f=y;return new a($r,f[1+(i>>=2)],f[i])}var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][e];k(r,{name:n=b(n),fromWireType:t,argPackAdvance:8,readValueFromPointer:t},{Wa:!0})},h:function(r,e,n,t,a,i,f,u,l,s,h,p){n=b(n),i=T(a,i),u=T(f,u),s=T(l,s),p=T(h,p),$([r],[e],function(v){return v=v[0],[new j(n,v.ea,!1,!1,!0,v,t,i,u,s,p)]})},F:function(r,e){var n=(e=b(e))==="std::string";k(r,{name:e,fromWireType:function(t){var a=y[t>>2],i=t+4;if(n)for(var f=i,u=0;u<=a;++u){var l=i+u;if(u==a||_[l]==0){if(f=f?ur(_,f,l-f):"",s===void 0)var s=f;else s+="\0",s+=f;f=l+1}}else{for(s=Array(a),u=0;u>2]=f,n&&i)Lr(a,_,l,f+1);else if(i)for(i=0;iX,u=1;else e===4&&(t=Be,a=ze,i=qe,f=()=>y,u=2);k(r,{name:n,fromWireType:function(l){for(var s,h=y[l>>2],p=f(),v=l+4,o=0;o<=h;++o){var d=l+4+o*e;o!=h&&p[d>>u]!=0||(v=t(v,d-v),s===void 0?s=v:(s+="\0",s+=v),v=d+e)}return M(l),s},toWireType:function(l,s){typeof s!="string"&&m("Cannot pass non-string to C++ string type "+n);var h=i(s),p=_r(4+h+e);return y[p>>2]=h>>u,a(s,p+4,h+e),l!==null&&l.push(M,p),p},argPackAdvance:8,readValueFromPointer:Q,ja:function(l){M(l)}})},v:function(r,e,n,t,a,i){cr[r]={name:b(e),Ba:T(n,t),na:T(a,i),Fa:[]}},l:function(r,e,n,t,a,i,f,u,l,s){cr[r].Fa.push({Na:b(e),Ta:n,Ra:T(t,a),Sa:i,cb:f,bb:T(u,l),eb:s})},T:function(r,e){k(r,{Xa:!0,name:e=b(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},k:function(r,e,n){r=P(r),e=ir(e,"emval::as");var t=[],a=O(t);return y[n>>2]=a,e.toWireType(t,r)},z:function(r,e){return r=P(r),(e=ir(e,"emval::as")).toWireType(null,r)},W:function(r,e,n,t){r=P(r),n=ge(e,n);for(var a=Array(e),i=0;i>2]=O(i),r(e,n,i,a)},G:function(r,e,n,t){(r=br[r])(e=P(e),n=yr(n),null,t)},a:Ur,H:function(r){return r===0?O(me()):(r=yr(r),O(me()[r]))},B:function(r,e){var n=ge(r,e),t=n[0];e=t.name+"_$"+n.slice(1).map(function(f){return f.name}).join("_")+"$";var a=ye[e];if(a!==void 0)return a;var i=Array(r-1);return a=Le((f,u,l,s)=>{for(var h=0,p=0;p>>=0))return!1;for(var n=1;4>=n;n*=2){var t=e*(1+.2/n);t=Math.min(t,r+100663296);var a=Math;t=Math.max(r,t),a=a.min.call(a,2147483648,t+(65536-t%65536)%65536);r:{try{Cr.grow(a-$r.byteLength+65535>>>16),Jr();var i=1;break r}catch{}i=void 0}if(i)return!0}return!1},K:function(r,e){var n=0;return be().forEach(function(t,a){var i=e+n;for(a=y[r+4*a>>2]=i,i=0;i>0]=t.charCodeAt(i);F[a>>0]=0,n+=t.length+1}),0},L:function(r,e){var n=be();y[r>>2]=n.length;var t=0;return n.forEach(function(a){t+=a.length+1}),y[e>>2]=t,0},Q:function(){return 52},P:function(){return 70},O:function(r,e,n,t){for(var a=0,i=0;i>2],u=y[e+4>>2];e+=8;for(var l=0;l>2]=a,0},J:function(r,e,n,t){return Xe(r,e,n,t)}};(function(){function r(a){c.asm=a.exports,Cr=c.asm.X,Jr(),Xr=c.asm.ba,Kr.unshift(c.asm.Y),H--,c.monitorRunDependencies&&c.monitorRunDependencies(H),H==0&&Z&&(a=Z,Z=null,a())}function e(a){r(a.instance)}function n(a){return je().then(function(i){return WebAssembly.instantiate(i,t)}).then(function(i){return i}).then(a,function(i){N("failed to asynchronously prepare wasm: "+i),K(i)})}var t={a:Ze};if(H++,c.monitorRunDependencies&&c.monitorRunDependencies(H),c.instantiateWasm)try{return c.instantiateWasm(t,r)}catch(a){N("Module.instantiateWasm callback failed with error: "+a),E(a)}(J||typeof WebAssembly.instantiateStreaming!="function"||re()||typeof fetch!="function"?n(e):fetch(D,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,t).then(e,function(i){return N("wasm streaming compile failed: "+i),N("falling back to ArrayBuffer instantiation"),n(e)})})).catch(E)})(),c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.Y).apply(null,arguments)};var Tr,_r=c._malloc=function(){return(_r=c._malloc=c.asm.Z).apply(null,arguments)},M=c._free=function(){return(M=c._free=c.asm._).apply(null,arguments)},_e=c.___getTypeName=function(){return(_e=c.___getTypeName=c.asm.$).apply(null,arguments)};function Pe(){function r(){if(!Tr&&(Tr=!0,c.calledRun=!0,!qr)){if(kr(Kr),z(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;){var e=c.postRun.shift();Qr.unshift(e)}kr(Qr)}}if(!(0E[R]})}}}return Object.freeze(Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}))}var $e,Yr,ke,Pr={exports:{}};Pr.exports,$e=Pr,Pr.exports,Yr=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,ke=function(S){var c,z,E;S=S||{},c||(c=S!==void 0?S:{}),c.ready=new Promise(function(r,e){z=r,E=e});var R=Object.assign({},c),q="./this.program",U="";typeof document<"u"&&document.currentScript&&(U=document.currentScript.src),Yr&&(U=Yr),U=U.indexOf("blob:")!==0?U.substr(0,U.replace(/[?#].*/,"").lastIndexOf("/")+1):"";var J,Oe=c.print||console.log.bind(console),N=c.printErr||console.warn.bind(console);Object.assign(c,R),R=null,c.thisProgram&&(q=c.thisProgram),c.wasmBinary&&(J=c.wasmBinary),c.noExitRuntime,typeof WebAssembly!="object"&&K("no native wasm support detected");var Cr,$r,F,_,Y,X,w,y,Hr,Vr,Br,zr,qr=!1,Nr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ur(r,e,n){var t=e+n;for(n=e;r[n]&&!(n>=t);)++n;if(16(a=(240&a)==224?(15&a)<<12|i<<6|f:(7&a)<<18|i<<12|f<<6|63&r[e++])?t+=String.fromCharCode(a):(a-=65536,t+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else t+=String.fromCharCode(a)}return t}function Lr(r,e,n,t){if(0=i&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),127>=i){if(n>=t)break;e[n++]=i}else{if(2047>=i){if(n+1>=t)break;e[n++]=192|i>>6}else{if(65535>=i){if(n+2>=t)break;e[n++]=224|i>>12}else{if(n+3>=t)break;e[n++]=240|i>>18,e[n++]=128|i>>12&63}e[n++]=128|i>>6&63}e[n++]=128|63&i}}e[n]=0}}function Gr(r){for(var e=0,n=0;n=t?e++:2047>=t?e+=2:55296<=t&&57343>=t?(e+=4,++n):e+=3}return e}function Jr(){var r=Cr.buffer;$r=r,c.HEAP8=F=new Int8Array(r),c.HEAP16=Y=new Int16Array(r),c.HEAP32=w=new Int32Array(r),c.HEAPU8=_=new Uint8Array(r),c.HEAPU16=X=new Uint16Array(r),c.HEAPU32=y=new Uint32Array(r),c.HEAPF32=Hr=new Float32Array(r),c.HEAPF64=zr=new Float64Array(r),c.HEAP64=Vr=new BigInt64Array(r),c.HEAPU64=Br=new BigUint64Array(r)}var Xr,Zr=[],Kr=[],Qr=[];function Ee(){var r=c.preRun.shift();Zr.unshift(r)}var D,H=0,Z=null;function K(r){throw c.onAbort&&c.onAbort(r),N(r="Aborted("+r+")"),qr=!0,r=new WebAssembly.RuntimeError(r+". Build with -sASSERTIONS for more info."),E(r),r}function re(){return D.startsWith("data:application/octet-stream;base64,")}if(D="arcgis-knowledge-client-core.wasm",!re()){var ee=D;D=c.locateFile?c.locateFile(ee,U):U+ee}function ne(){var r=D;try{if(r==D&&J)return new Uint8Array(J);throw"both async and sync fetching of the wasm failed"}catch(e){K(e)}}function je(){return J||typeof fetch!="function"?Promise.resolve().then(function(){return ne()}):fetch(D,{credentials:"same-origin"}).then(function(r){if(!r.ok)throw"failed to load wasm binary file at '"+D+"'";return r.arrayBuffer()}).catch(function(){return ne()})}function kr(r){for(;0>2]=e},this.Oa=function(e){y[this.fa+8>>2]=e},this.Ua=function(){w[this.fa>>2]=0},this.Ma=function(){F[this.fa+12>>0]=0},this.Va=function(){F[this.fa+13>>0]=0},this.Ia=function(e,n){this.La(),this.Ya(e),this.Oa(n),this.Ua(),this.Ma(),this.Va()},this.La=function(){y[this.fa+16>>2]=0}}var cr={};function fr(r){for(;r.length;){var e=r.pop();r.pop()(e)}}function Q(r){return this.fromWireType(w[r>>2])}var L={},V={},sr={};function te(r){if(r===void 0)return"_unknown";var e=(r=r.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=e&&57>=e?"_"+r:r}function Wr(r,e){return r=te(r),function(){return e.apply(this,arguments)}}function Or(r){var e=Error,n=Wr(r,function(t){this.name=r,this.message=t,(t=Error(t).stack)!==void 0&&(this.stack=this.toString()+` +`+t.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},n}var ae=void 0;function lr(r){throw new ae(r)}function $(r,e,n){function t(u){(u=n(u)).length!==r.length&&lr("Mismatched type converter count");for(var l=0;l{V.hasOwnProperty(u)?a[l]=V[u]:(i.push(u),L.hasOwnProperty(u)||(L[u]=[]),L[u].push(()=>{a[l]=V[u],++f===i.length&&t(a)}))}),i.length===0&&t(a)}function rr(r){if(r===null)return"null";var e=typeof r;return e==="object"||e==="array"||e==="function"?r.toString():""+r}var ie=void 0;function b(r){for(var e="";_[r];)e+=ie[_[r++]];return e}var G=void 0;function m(r){throw new G(r)}function k(r,e,n={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var t=e.name;if(r||m('type "'+t+'" must have a positive integer typeid pointer'),V.hasOwnProperty(r)){if(n.Wa)return;m("Cannot register type '"+t+"' twice")}V[r]=e,delete sr[r],L.hasOwnProperty(r)&&(e=L[r],delete L[r],e.forEach(a=>a()))}function oe(r,e,n){switch(e){case 0:return n?function(t){return F[t]}:function(t){return _[t]};case 1:return n?function(t){return Y[t>>1]}:function(t){return X[t>>1]};case 2:return n?function(t){return w[t>>2]}:function(t){return y[t>>2]};case 3:return n?function(t){return Vr[t>>3]}:function(t){return Br[t>>3]};default:throw new TypeError("Unknown integer type: "+r)}}function er(r){switch(r){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+r)}}function Er(r){m(r.da.ga.ea.name+" instance already deleted")}var jr=!1;function ue(){}function ce(r){--r.count.value,r.count.value===0&&(r.ia?r.ka.na(r.ia):r.ga.ea.na(r.fa))}function fe(r,e,n){return e===n?r:n.la===void 0||(r=fe(r,e,n.la))===null?null:n.Ka(r)}var se={},nr=[];function Sr(){for(;nr.length;){var r=nr.pop();r.da.ta=!1,r.delete()}}var tr=void 0,ar={};function Fe(r,e){for(e===void 0&&m("ptr should not be undefined");r.la;)e=r.va(e),r=r.la;return ar[e]}function hr(r,e){return e.ga&&e.fa||lr("makeClassHandle requires ptr and ptrType"),!!e.ka!=!!e.ia&&lr("Both smartPtrType and smartPtr must be specified"),e.count={value:1},dr(Object.create(r,{da:{value:e}}))}function dr(r){return typeof FinalizationRegistry>"u"?(dr=e=>e,r):(jr=new FinalizationRegistry(e=>{ce(e.da)}),ue=e=>{jr.unregister(e)},(dr=e=>{var n=e.da;return n.ia&&jr.register(e,{da:n},e),e})(r))}function x(){}function Fr(r,e,n){if(r[e].ha===void 0){var t=r[e];r[e]=function(){return r[e].ha.hasOwnProperty(arguments.length)||m("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+r[e].ha+")!"),r[e].ha[arguments.length].apply(this,arguments)},r[e].ha=[],r[e].ha[t.sa]=t}}function Dr(r,e,n){c.hasOwnProperty(r)?((n===void 0||c[r].ha!==void 0&&c[r].ha[n]!==void 0)&&m("Cannot register public name '"+r+"' twice"),Fr(c,r,r),c.hasOwnProperty(n)&&m("Cannot register multiple overloads of a function with the same number of arguments ("+n+")!"),c[r].ha[n]=e):(c[r]=e,n!==void 0&&(c[r].kb=n))}function De(r,e,n,t,a,i,f,u){this.name=r,this.constructor=e,this.oa=n,this.na=t,this.la=a,this.Pa=i,this.va=f,this.Ka=u,this.$a=[]}function pr(r,e,n){for(;e!==n;)e.va||m("Expected null or instance of "+n.name+", got an instance of "+e.name),r=e.va(r),e=e.la;return r}function Me(r,e){return e===null?(this.Aa&&m("null is not a valid "+this.name),0):(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),pr(e.da.fa,e.da.ga.ea,this.ea))}function Re(r,e){if(e===null){if(this.Aa&&m("null is not a valid "+this.name),this.xa){var n=this.Ba();return r!==null&&r.push(this.na,n),n}return 0}if(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),!this.wa&&e.da.ga.wa&&m("Cannot convert argument of type "+(e.da.ka?e.da.ka.name:e.da.ga.name)+" to parameter type "+this.name),n=pr(e.da.fa,e.da.ga.ea,this.ea),this.xa)switch(e.da.ia===void 0&&m("Passing raw pointer to smart pointer is illegal"),this.fb){case 0:e.da.ka===this?n=e.da.ia:m("Cannot convert argument of type "+(e.da.ka?e.da.ka.name:e.da.ga.name)+" to parameter type "+this.name);break;case 1:n=e.da.ia;break;case 2:if(e.da.ka===this)n=e.da.ia;else{var t=e.clone();n=this.ab(n,O(function(){t.delete()})),r!==null&&r.push(this.na,n)}break;default:m("Unsupporting sharing policy")}return n}function Ue(r,e){return e===null?(this.Aa&&m("null is not a valid "+this.name),0):(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),e.da.ga.wa&&m("Cannot convert argument of type "+e.da.ga.name+" to parameter type "+this.name),pr(e.da.fa,e.da.ga.ea,this.ea))}function j(r,e,n,t,a,i,f,u,l,s,h){this.name=r,this.ea=e,this.Aa=n,this.wa=t,this.xa=a,this.Za=i,this.fb=f,this.Ga=u,this.Ba=l,this.ab=s,this.na=h,a||e.la!==void 0?this.toWireType=Re:(this.toWireType=t?Me:Ue,this.ja=null)}function le(r,e,n){c.hasOwnProperty(r)||lr("Replacing nonexistant public symbol"),c[r].ha!==void 0&&n!==void 0?c[r].ha[n]=e:(c[r]=e,c[r].sa=n)}var vr=[];function T(r,e){r=b(r);var n=vr[e];return n||(e>=vr.length&&(vr.length=e+1),vr[e]=n=Xr.get(e)),typeof n!="function"&&m("unknown function pointer with signature "+r+": "+e),n}var he=void 0;function de(r){var e=b(r=_e(r));return M(r),e}function B(r,e){function n(i){a[i]||V[i]||(sr[i]?sr[i].forEach(n):(t.push(i),a[i]=!0))}var t=[],a={};throw e.forEach(n),new he(r+": "+t.map(de).join([", "]))}function gr(r,e,n,t,a){var i=e.length;2>i&&m("argTypes array size mismatch! Must at least get return value and 'this' types!");var f=e[1]!==null&&n!==null,u=!1;for(n=1;n>2]);return n}function pe(r,e,n){return r instanceof Object||m(n+' with invalid "this": '+r),r instanceof e.ea.constructor||m(n+' incompatible with "this" of type '+r.constructor.name),r.da.fa||m("cannot call emscripten binding method "+n+" on deleted object"),pr(r.da.fa,r.da.ga.ea,e.ea)}var Mr=[],W=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Rr(r){4(r||m("Cannot use deleted val. handle = "+r),W[r].value),O=r=>{switch(r){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var e=Mr.length?Mr.pop():W.length;return W[e]={Ca:1,value:r},e}};function xe(r,e,n){switch(e){case 0:return function(t){return this.fromWireType((n?F:_)[t])};case 1:return function(t){return this.fromWireType((n?Y:X)[t>>1])};case 2:return function(t){return this.fromWireType((n?w:y)[t>>2])};default:throw new TypeError("Unknown integer type: "+r)}}function ir(r,e){var n=V[r];return n===void 0&&m(e+" has unknown type "+de(r)),n}function Ie(r,e){switch(e){case 2:return function(n){return this.fromWireType(Hr[n>>2])};case 3:return function(n){return this.fromWireType(zr[n>>3])};default:throw new TypeError("Unknown float type: "+r)}}var ve=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Ye(r,e){for(var n=r>>1,t=n+e/2;!(n>=t)&&X[n];)++n;if(32<(n<<=1)-r&&ve)return ve.decode(_.subarray(r,n));for(n="",t=0;!(t>=e/2);++t){var a=Y[r+2*t>>1];if(a==0)break;n+=String.fromCharCode(a)}return n}function He(r,e,n){if(n===void 0&&(n=2147483647),2>n)return 0;var t=e;n=(n-=2)<2*r.length?n/2:r.length;for(var a=0;a>1]=r.charCodeAt(a),e+=2;return Y[e>>1]=0,e-t}function Ve(r){return 2*r.length}function Be(r,e){for(var n=0,t="";!(n>=e/4);){var a=w[r+4*n>>2];if(a==0)break;++n,65536<=a?(a-=65536,t+=String.fromCharCode(55296|a>>10,56320|1023&a)):t+=String.fromCharCode(a)}return t}function ze(r,e,n){if(n===void 0&&(n=2147483647),4>n)return 0;var t=e;n=t+n-4;for(var a=0;a=i&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),w[e>>2]=i,(e+=4)+4>n)break}return w[e>>2]=0,e-t}function qe(r){for(var e=0,n=0;n=t&&++n,e+=4}return e}function ge(r,e){for(var n=Array(r),t=0;t>2],"parameter "+t);return n}var Ne={};function yr(r){var e=Ne[r];return e===void 0?b(r):e}var br=[];function me(){function r(e){e.$$$embind_global$$$=e;var n=typeof $$$embind_global$$$=="object"&&e.$$$embind_global$$$==e;return n||delete e.$$$embind_global$$$,n}if(typeof globalThis=="object")return globalThis;if(typeof $$$embind_global$$$=="object"||(typeof Ir=="object"&&r(Ir)?$$$embind_global$$$=Ir:typeof self=="object"&&r(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")}function Le(r){var e=br.length;return br.push(r),e}var ye=[],Ur={};function be(){if(!xr){var r,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:q||"./this.program"};for(r in Ur)Ur[r]===void 0?delete e[r]:e[r]=Ur[r];var n=[];for(r in e)n.push(r+"="+e[r]);xr=n}return xr}var xr,Ge=[null,[],[]];function wr(r){return r%4==0&&(r%100!=0||r%400==0)}var we=[31,29,31,30,31,30,31,31,30,31,30,31],Ae=[31,28,31,30,31,30,31,31,30,31,30,31];function Je(r){var e=Array(Gr(r)+1);return Lr(r,e,0,e.length),e}function Xe(r,e,n,t){function a(o,d,g){for(o=typeof o=="number"?o.toString():o||"";o.lengthC?-1:0A-o.getDate())){o.setDate(o.getDate()+d);break}d-=A-o.getDate()+1,o.setDate(1),11>g?o.setMonth(g+1):(o.setMonth(0),o.setFullYear(o.getFullYear()+1))}return g=new Date(o.getFullYear()+1,0,4),d=u(new Date(o.getFullYear(),0,4)),g=u(g),0>=f(d,o)?0>=f(g,o)?o.getFullYear()+1:o.getFullYear():o.getFullYear()-1}var s=w[t+40>>2];for(var h in t={ib:w[t>>2],hb:w[t+4>>2],ya:w[t+8>>2],Da:w[t+12>>2],za:w[t+16>>2],ra:w[t+20>>2],ma:w[t+24>>2],qa:w[t+28>>2],lb:w[t+32>>2],gb:w[t+36>>2],jb:s&&s?ur(_,s):""},n=n?ur(_,n):"",s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(h,"g"),s[h]);var p="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),v="January February March April May June July August September October November December".split(" ");for(h in s={"%a":function(o){return p[o.ma].substring(0,3)},"%A":function(o){return p[o.ma]},"%b":function(o){return v[o.za].substring(0,3)},"%B":function(o){return v[o.za]},"%C":function(o){return i((o.ra+1900)/100|0,2)},"%d":function(o){return i(o.Da,2)},"%e":function(o){return a(o.Da,2," ")},"%g":function(o){return l(o).toString().substring(2)},"%G":function(o){return l(o)},"%H":function(o){return i(o.ya,2)},"%I":function(o){return(o=o.ya)==0?o=12:12o.ya?"AM":"PM"},"%S":function(o){return i(o.ib,2)},"%t":function(){return" "},"%u":function(o){return o.ma||7},"%U":function(o){return i(Math.floor((o.qa+7-o.ma)/7),2)},"%V":function(o){var d=Math.floor((o.qa+7-(o.ma+6)%7)/7);if(2>=(o.ma+371-o.qa-2)%7&&d++,d)d==53&&((g=(o.ma+371-o.qa)%7)==4||g==3&&wr(o.ra)||(d=1));else{d=52;var g=(o.ma+7-o.qa-1)%7;(g==4||g==5&&wr(o.ra%400-1))&&d++}return i(d,2)},"%w":function(o){return o.ma},"%W":function(o){return i(Math.floor((o.qa+7-(o.ma+6)%7)/7),2)},"%y":function(o){return(o.ra+1900).toString().substring(2)},"%Y":function(o){return o.ra+1900},"%z":function(o){var d=0<=(o=o.gb);return o=Math.abs(o)/60,(d?"+":"-")+("0000"+(o/60*100+o%60)).slice(-4)},"%Z":function(o){return o.jb},"%%":function(){return"%"}},n=n.replace(/%%/g,"\0\0"),s)n.includes(h)&&(n=n.replace(new RegExp(h,"g"),s[h](t)));return(h=Je(n=n.replace(/\0\0/g,"%"))).length>e?0:(F.set(h,r),h.length-1)}ae=c.InternalError=Or("InternalError");for(var Te=Array(256),Ar=0;256>Ar;++Ar)Te[Ar]=String.fromCharCode(Ar);ie=Te,G=c.BindingError=Or("BindingError"),x.prototype.isAliasOf=function(r){if(!(this instanceof x&&r instanceof x))return!1;var e=this.da.ga.ea,n=this.da.fa,t=r.da.ga.ea;for(r=r.da.fa;e.la;)n=e.va(n),e=e.la;for(;t.la;)r=t.va(r),t=t.la;return e===t&&n===r},x.prototype.clone=function(){if(this.da.fa||Er(this),this.da.ua)return this.da.count.value+=1,this;var r=dr,e=Object,n=e.create,t=Object.getPrototypeOf(this),a=this.da;return(r=r(n.call(e,t,{da:{value:{count:a.count,ta:a.ta,ua:a.ua,fa:a.fa,ga:a.ga,ia:a.ia,ka:a.ka}}}))).da.count.value+=1,r.da.ta=!1,r},x.prototype.delete=function(){this.da.fa||Er(this),this.da.ta&&!this.da.ua&&m("Object already scheduled for deletion"),ue(this),ce(this.da),this.da.ua||(this.da.ia=void 0,this.da.fa=void 0)},x.prototype.isDeleted=function(){return!this.da.fa},x.prototype.deleteLater=function(){return this.da.fa||Er(this),this.da.ta&&!this.da.ua&&m("Object already scheduled for deletion"),nr.push(this),nr.length===1&&tr&&tr(Sr),this.da.ta=!0,this},c.getInheritedInstanceCount=function(){return Object.keys(ar).length},c.getLiveInheritedInstances=function(){var r,e=[];for(r in ar)ar.hasOwnProperty(r)&&e.push(ar[r]);return e},c.flushPendingDeletes=Sr,c.setDelayFunction=function(r){tr=r,nr.length&&tr&&tr(Sr)},j.prototype.Qa=function(r){return this.Ga&&(r=this.Ga(r)),r},j.prototype.Ea=function(r){this.na&&this.na(r)},j.prototype.argPackAdvance=8,j.prototype.readValueFromPointer=Q,j.prototype.deleteObject=function(r){r!==null&&r.delete()},j.prototype.fromWireType=function(r){function e(){return this.xa?hr(this.ea.oa,{ga:this.Za,fa:n,ka:this,ia:r}):hr(this.ea.oa,{ga:this,fa:r})}var n=this.Qa(r);if(!n)return this.Ea(r),null;var t=Fe(this.ea,n);if(t!==void 0)return t.da.count.value===0?(t.da.fa=n,t.da.ia=r,t.clone()):(t=t.clone(),this.Ea(r),t);if(t=this.ea.Pa(n),!(t=se[t]))return e.call(this);t=this.wa?t.Ha:t.pointerType;var a=fe(n,this.ea,t.ea);return a===null?e.call(this):this.xa?hr(t.ea.oa,{ga:t,fa:a,ka:this,ia:r}):hr(t.ea.oa,{ga:t,fa:a})},he=c.UnboundTypeError=Or("UnboundTypeError"),c.count_emval_handles=function(){for(var r=0,e=5;ei.Ta).concat(a.map(i=>i.cb)),i=>{var f={};return a.forEach((u,l)=>{var s=i[l],h=u.Ra,p=u.Sa,v=i[l+a.length],o=u.bb,d=u.eb;f[u.Na]={read:g=>s.fromWireType(h(p,g)),write:(g,A)=>{var C=[];o(d,g,v.toWireType(C,A)),fr(C)}}}),[{name:e.name,fromWireType:function(u){var l,s={};for(l in f)s[l]=f[l].read(u);return t(u),s},toWireType:function(u,l){for(var s in f)if(!(s in l))throw new TypeError('Missing field: "'+s+'"');var h=n();for(s in f)f[s].write(h,l[s]);return u!==null&&u.push(t,h),h},argPackAdvance:8,readValueFromPointer:Q,ja:t}]})},E:function(r,e,n,t,a){e=b(e),n=er(n);var i=e.indexOf("u")!=-1;i&&(a=(1n<<64n)-1n),k(r,{name:e,fromWireType:function(f){return f},toWireType:function(f,u){if(typeof u!="bigint"&&typeof u!="number")throw new TypeError('Cannot convert "'+rr(u)+'" to '+this.name);if(ua)throw new TypeError('Passing a number "'+rr(u)+'" from JS side to C/C++ side to an argument of type "'+e+'", which is outside the valid range ['+t+", "+a+"]!");return u},argPackAdvance:8,readValueFromPointer:oe(e,n,!i),ja:null})},S:function(r,e,n,t,a){var i=er(n);k(r,{name:e=b(e),fromWireType:function(f){return!!f},toWireType:function(f,u){return u?t:a},argPackAdvance:8,readValueFromPointer:function(f){if(n===1)var u=F;else if(n===2)u=Y;else{if(n!==4)throw new TypeError("Unknown boolean type size: "+e);u=w}return this.fromWireType(u[f>>i])},ja:null})},f:function(r,e,n,t,a,i,f,u,l,s,h,p,v){h=b(h),i=T(a,i),u&&(u=T(f,u)),s&&(s=T(l,s)),v=T(p,v);var o=te(h);Dr(o,function(){B("Cannot construct "+h+" due to unbound types",[t])}),$([r,e,n],t?[t]:[],function(d){if(d=d[0],t)var g=d.ea,A=g.oa;else A=x.prototype;d=Wr(o,function(){if(Object.getPrototypeOf(this)!==C)throw new G("Use 'new' to construct "+h);if(I.pa===void 0)throw new G(h+" has no accessible constructor");var Ce=I.pa[arguments.length];if(Ce===void 0)throw new G("Tried to invoke ctor of "+h+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(I.pa).toString()+") parameters instead!");return Ce.apply(this,arguments)});var C=Object.create(A,{constructor:{value:d}});d.prototype=C;var I=new De(h,d,C,v,g,i,u,s);g=new j(h,I,!0,!1,!1),A=new j(h+"*",I,!1,!1,!1);var or=new j(h+" const*",I,!1,!0,!1);return se[r]={pointerType:A,Ha:or},le(o,d),[g,A,or]})},o:function(r,e,n,t,a,i,f){var u=mr(n,t);e=b(e),i=T(a,i),$([],[r],function(l){function s(){B("Cannot call "+h+" due to unbound types",u)}var h=(l=l[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var p=l.ea.constructor;return p[e]===void 0?(s.sa=n-1,p[e]=s):(Fr(p,e,h),p[e].ha[n-1]=s),$([],u,function(v){return v=gr(h,[v[0],null].concat(v.slice(1)),null,i,f),p[e].ha===void 0?(v.sa=n-1,p[e]=v):p[e].ha[n-1]=v,[]}),[]})},i:function(r,e,n,t,a,i){0{B("Cannot construct "+u.name+" due to unbound types",f)},$([],f,function(s){return s.splice(1,0,null),u.ea.pa[e-1]=gr(l,s,null,a,i),[]}),[]})},b:function(r,e,n,t,a,i,f,u){var l=mr(n,t);e=b(e),i=T(a,i),$([],[r],function(s){function h(){B("Cannot call "+p+" due to unbound types",l)}var p=(s=s[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),u&&s.ea.$a.push(e);var v=s.ea.oa,o=v[e];return o===void 0||o.ha===void 0&&o.className!==s.name&&o.sa===n-2?(h.sa=n-2,h.className=s.name,v[e]=h):(Fr(v,e,p),v[e].ha[n-2]=h),$([],l,function(d){return d=gr(p,d,s,i,f),v[e].ha===void 0?(d.sa=n-2,v[e]=d):v[e].ha[n-2]=d,[]}),[]})},c:function(r,e,n,t,a,i,f,u,l,s){e=b(e),a=T(t,a),$([],[r],function(h){var p=(h=h[0]).name+"."+e,v={get:function(){B("Cannot access "+p+" due to unbound types",[n,f])},enumerable:!0,configurable:!0};return v.set=l?()=>{B("Cannot access "+p+" due to unbound types",[n,f])}:()=>{m(p+" is a read-only property")},Object.defineProperty(h.ea.oa,e,v),$([],l?[n,f]:[n],function(o){var d=o[0],g={get:function(){var C=pe(this,h,p+" getter");return d.fromWireType(a(i,C))},enumerable:!0};if(l){l=T(u,l);var A=o[1];g.set=function(C){var I=pe(this,h,p+" setter"),or=[];l(s,I,A.toWireType(or,C)),fr(or)}}return Object.defineProperty(h.ea.oa,e,g),[]}),[]})},R:function(r,e){k(r,{name:e=b(e),fromWireType:function(n){var t=P(n);return Rr(n),t},toWireType:function(n,t){return O(t)},argPackAdvance:8,readValueFromPointer:Q,ja:null})},s:function(r,e,n,t){function a(){}n=er(n),e=b(e),a.values={},k(r,{name:e,constructor:a,fromWireType:function(i){return this.constructor.values[i]},toWireType:function(i,f){return f.value},argPackAdvance:8,readValueFromPointer:xe(e,n,t),ja:null}),Dr(e,a)},e:function(r,e,n){var t=ir(r,"enum");e=b(e),r=t.constructor,t=Object.create(t.constructor.prototype,{value:{value:n},constructor:{value:Wr(t.name+"_"+e,function(){})}}),r.values[n]=t,r[e]=t},D:function(r,e,n){n=er(n),k(r,{name:e=b(e),fromWireType:function(t){return t},toWireType:function(t,a){return a},argPackAdvance:8,readValueFromPointer:Ie(e,n),ja:null})},V:function(r,e,n,t,a,i){var f=mr(e,n);r=b(r),a=T(t,a),Dr(r,function(){B("Cannot call "+r+" due to unbound types",f)},e-1),$([],f,function(u){return le(r,gr(r,[u[0],null].concat(u.slice(1)),null,a,i),e-1),[]})},w:function(r,e,n,t,a){e=b(e),a===-1&&(a=4294967295),a=er(n);var i=u=>u;if(t===0){var f=32-8*n;i=u=>u<>>f}n=e.includes("unsigned")?function(u,l){return l>>>0}:function(u,l){return l},k(r,{name:e,fromWireType:i,toWireType:n,argPackAdvance:8,readValueFromPointer:oe(e,a,t!==0),ja:null})},q:function(r,e,n){function t(i){var f=y;return new a($r,f[1+(i>>=2)],f[i])}var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][e];k(r,{name:n=b(n),fromWireType:t,argPackAdvance:8,readValueFromPointer:t},{Wa:!0})},h:function(r,e,n,t,a,i,f,u,l,s,h,p){n=b(n),i=T(a,i),u=T(f,u),s=T(l,s),p=T(h,p),$([r],[e],function(v){return v=v[0],[new j(n,v.ea,!1,!1,!0,v,t,i,u,s,p)]})},F:function(r,e){var n=(e=b(e))==="std::string";k(r,{name:e,fromWireType:function(t){var a=y[t>>2],i=t+4;if(n)for(var f=i,u=0;u<=a;++u){var l=i+u;if(u==a||_[l]==0){if(f=f?ur(_,f,l-f):"",s===void 0)var s=f;else s+="\0",s+=f;f=l+1}}else{for(s=Array(a),u=0;u>2]=f,n&&i)Lr(a,_,l,f+1);else if(i)for(i=0;iX,u=1;else e===4&&(t=Be,a=ze,i=qe,f=()=>y,u=2);k(r,{name:n,fromWireType:function(l){for(var s,h=y[l>>2],p=f(),v=l+4,o=0;o<=h;++o){var d=l+4+o*e;o!=h&&p[d>>u]!=0||(v=t(v,d-v),s===void 0?s=v:(s+="\0",s+=v),v=d+e)}return M(l),s},toWireType:function(l,s){typeof s!="string"&&m("Cannot pass non-string to C++ string type "+n);var h=i(s),p=_r(4+h+e);return y[p>>2]=h>>u,a(s,p+4,h+e),l!==null&&l.push(M,p),p},argPackAdvance:8,readValueFromPointer:Q,ja:function(l){M(l)}})},v:function(r,e,n,t,a,i){cr[r]={name:b(e),Ba:T(n,t),na:T(a,i),Fa:[]}},l:function(r,e,n,t,a,i,f,u,l,s){cr[r].Fa.push({Na:b(e),Ta:n,Ra:T(t,a),Sa:i,cb:f,bb:T(u,l),eb:s})},T:function(r,e){k(r,{Xa:!0,name:e=b(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},k:function(r,e,n){r=P(r),e=ir(e,"emval::as");var t=[],a=O(t);return y[n>>2]=a,e.toWireType(t,r)},z:function(r,e){return r=P(r),(e=ir(e,"emval::as")).toWireType(null,r)},W:function(r,e,n,t){r=P(r),n=ge(e,n);for(var a=Array(e),i=0;i>2]=O(i),r(e,n,i,a)},G:function(r,e,n,t){(r=br[r])(e=P(e),n=yr(n),null,t)},a:Rr,H:function(r){return r===0?O(me()):(r=yr(r),O(me()[r]))},B:function(r,e){var n=ge(r,e),t=n[0];e=t.name+"_$"+n.slice(1).map(function(f){return f.name}).join("_")+"$";var a=ye[e];if(a!==void 0)return a;var i=Array(r-1);return a=Le((f,u,l,s)=>{for(var h=0,p=0;p>>=0))return!1;for(var n=1;4>=n;n*=2){var t=e*(1+.2/n);t=Math.min(t,r+100663296);var a=Math;t=Math.max(r,t),a=a.min.call(a,2147483648,t+(65536-t%65536)%65536);r:{try{Cr.grow(a-$r.byteLength+65535>>>16),Jr();var i=1;break r}catch{}i=void 0}if(i)return!0}return!1},K:function(r,e){var n=0;return be().forEach(function(t,a){var i=e+n;for(a=y[r+4*a>>2]=i,i=0;i>0]=t.charCodeAt(i);F[a>>0]=0,n+=t.length+1}),0},L:function(r,e){var n=be();y[r>>2]=n.length;var t=0;return n.forEach(function(a){t+=a.length+1}),y[e>>2]=t,0},Q:function(){return 52},P:function(){return 70},O:function(r,e,n,t){for(var a=0,i=0;i>2],u=y[e+4>>2];e+=8;for(var l=0;l>2]=a,0},J:function(r,e,n,t){return Xe(r,e,n,t)}};(function(){function r(a){c.asm=a.exports,Cr=c.asm.X,Jr(),Xr=c.asm.ba,Kr.unshift(c.asm.Y),H--,c.monitorRunDependencies&&c.monitorRunDependencies(H),H==0&&Z&&(a=Z,Z=null,a())}function e(a){r(a.instance)}function n(a){return je().then(function(i){return WebAssembly.instantiate(i,t)}).then(function(i){return i}).then(a,function(i){N("failed to asynchronously prepare wasm: "+i),K(i)})}var t={a:Ze};if(H++,c.monitorRunDependencies&&c.monitorRunDependencies(H),c.instantiateWasm)try{return c.instantiateWasm(t,r)}catch(a){N("Module.instantiateWasm callback failed with error: "+a),E(a)}(J||typeof WebAssembly.instantiateStreaming!="function"||re()||typeof fetch!="function"?n(e):fetch(D,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,t).then(e,function(i){return N("wasm streaming compile failed: "+i),N("falling back to ArrayBuffer instantiation"),n(e)})})).catch(E)})(),c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.Y).apply(null,arguments)};var Tr,_r=c._malloc=function(){return(_r=c._malloc=c.asm.Z).apply(null,arguments)},M=c._free=function(){return(M=c._free=c.asm._).apply(null,arguments)},_e=c.___getTypeName=function(){return(_e=c.___getTypeName=c.asm.$).apply(null,arguments)};function Pe(){function r(){if(!Tr&&(Tr=!0,c.calledRun=!0,!qr)){if(kr(Kr),z(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;){var e=c.postRun.shift();Qr.unshift(e)}kr(Qr)}}if(!(0E[U]})}}}return Object.freeze(Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}))}var $e,Yr,ke,Pr={exports:{}};Pr.exports,$e=Pr,Pr.exports,Yr=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,ke=function(S){var c,z,E;S=S||{},c||(c=S!==void 0?S:{}),c.ready=new Promise(function(r,e){z=r,E=e});var U=Object.assign({},c),q="./this.program",x="";typeof document<"u"&&document.currentScript&&(x=document.currentScript.src),Yr&&(x=Yr),x=x.indexOf("blob:")!==0?x.substr(0,x.replace(/[?#].*/,"").lastIndexOf("/")+1):"";var J,Oe=c.print||console.log.bind(console),N=c.printErr||console.warn.bind(console);Object.assign(c,U),U=null,c.thisProgram&&(q=c.thisProgram),c.wasmBinary&&(J=c.wasmBinary),c.noExitRuntime,typeof WebAssembly!="object"&&K("no native wasm support detected");var Cr,$r,F,_,Y,X,w,y,Hr,Vr,Br,zr,qr=!1,Nr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ur(r,e,n){var t=e+n;for(n=e;r[n]&&!(n>=t);)++n;if(16(a=(240&a)==224?(15&a)<<12|i<<6|f:(7&a)<<18|i<<12|f<<6|63&r[e++])?t+=String.fromCharCode(a):(a-=65536,t+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else t+=String.fromCharCode(a)}return t}function Lr(r,e,n,t){if(0=i&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),127>=i){if(n>=t)break;e[n++]=i}else{if(2047>=i){if(n+1>=t)break;e[n++]=192|i>>6}else{if(65535>=i){if(n+2>=t)break;e[n++]=224|i>>12}else{if(n+3>=t)break;e[n++]=240|i>>18,e[n++]=128|i>>12&63}e[n++]=128|i>>6&63}e[n++]=128|63&i}}e[n]=0}}function Gr(r){for(var e=0,n=0;n=t?e++:2047>=t?e+=2:55296<=t&&57343>=t?(e+=4,++n):e+=3}return e}function Jr(){var r=Cr.buffer;$r=r,c.HEAP8=F=new Int8Array(r),c.HEAP16=Y=new Int16Array(r),c.HEAP32=w=new Int32Array(r),c.HEAPU8=_=new Uint8Array(r),c.HEAPU16=X=new Uint16Array(r),c.HEAPU32=y=new Uint32Array(r),c.HEAPF32=Hr=new Float32Array(r),c.HEAPF64=zr=new Float64Array(r),c.HEAP64=Vr=new BigInt64Array(r),c.HEAPU64=Br=new BigUint64Array(r)}var Xr,Zr=[],Kr=[],Qr=[];function Ee(){var r=c.preRun.shift();Zr.unshift(r)}var D,H=0,Z=null;function K(r){throw c.onAbort&&c.onAbort(r),N(r="Aborted("+r+")"),qr=!0,r=new WebAssembly.RuntimeError(r+". Build with -sASSERTIONS for more info."),E(r),r}function re(){return D.startsWith("data:application/octet-stream;base64,")}if(D="arcgis-knowledge-client-core-simd.wasm",!re()){var ee=D;D=c.locateFile?c.locateFile(ee,x):x+ee}function ne(){var r=D;try{if(r==D&&J)return new Uint8Array(J);throw"both async and sync fetching of the wasm failed"}catch(e){K(e)}}function je(){return J||typeof fetch!="function"?Promise.resolve().then(function(){return ne()}):fetch(D,{credentials:"same-origin"}).then(function(r){if(!r.ok)throw"failed to load wasm binary file at '"+D+"'";return r.arrayBuffer()}).catch(function(){return ne()})}function kr(r){for(;0>2]=e},this.Oa=function(e){y[this.fa+8>>2]=e},this.Ua=function(){w[this.fa>>2]=0},this.Ma=function(){F[this.fa+12>>0]=0},this.Va=function(){F[this.fa+13>>0]=0},this.Ia=function(e,n){this.La(),this.Ya(e),this.Oa(n),this.Ua(),this.Ma(),this.Va()},this.La=function(){y[this.fa+16>>2]=0}}var cr={};function fr(r){for(;r.length;){var e=r.pop();r.pop()(e)}}function Q(r){return this.fromWireType(w[r>>2])}var L={},V={},sr={};function te(r){if(r===void 0)return"_unknown";var e=(r=r.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=e&&57>=e?"_"+r:r}function Wr(r,e){return r=te(r),function(){return e.apply(this,arguments)}}function Or(r){var e=Error,n=Wr(r,function(t){this.name=r,this.message=t,(t=Error(t).stack)!==void 0&&(this.stack=this.toString()+` -`+t.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},n}var ae=void 0;function lr(r){throw new ae(r)}function $(r,e,n){function t(u){(u=n(u)).length!==r.length&&lr("Mismatched type converter count");for(var l=0;l{V.hasOwnProperty(u)?a[l]=V[u]:(i.push(u),L.hasOwnProperty(u)||(L[u]=[]),L[u].push(()=>{a[l]=V[u],++f===i.length&&t(a)}))}),i.length===0&&t(a)}function rr(r){if(r===null)return"null";var e=typeof r;return e==="object"||e==="array"||e==="function"?r.toString():""+r}var ie=void 0;function b(r){for(var e="";_[r];)e+=ie[_[r++]];return e}var G=void 0;function m(r){throw new G(r)}function k(r,e,n={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var t=e.name;if(r||m('type "'+t+'" must have a positive integer typeid pointer'),V.hasOwnProperty(r)){if(n.Wa)return;m("Cannot register type '"+t+"' twice")}V[r]=e,delete sr[r],L.hasOwnProperty(r)&&(e=L[r],delete L[r],e.forEach(a=>a()))}function oe(r,e,n){switch(e){case 0:return n?function(t){return F[t]}:function(t){return _[t]};case 1:return n?function(t){return Y[t>>1]}:function(t){return X[t>>1]};case 2:return n?function(t){return w[t>>2]}:function(t){return y[t>>2]};case 3:return n?function(t){return Vr[t>>3]}:function(t){return Br[t>>3]};default:throw new TypeError("Unknown integer type: "+r)}}function er(r){switch(r){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+r)}}function Er(r){m(r.da.ga.ea.name+" instance already deleted")}var jr=!1;function ue(){}function ce(r){--r.count.value,r.count.value===0&&(r.ia?r.ka.na(r.ia):r.ga.ea.na(r.fa))}function fe(r,e,n){return e===n?r:n.la===void 0||(r=fe(r,e,n.la))===null?null:n.Ka(r)}var se={},nr=[];function Sr(){for(;nr.length;){var r=nr.pop();r.da.ta=!1,r.delete()}}var tr=void 0,ar={};function Fe(r,e){for(e===void 0&&m("ptr should not be undefined");r.la;)e=r.va(e),r=r.la;return ar[e]}function hr(r,e){return e.ga&&e.fa||lr("makeClassHandle requires ptr and ptrType"),!!e.ka!=!!e.ia&&lr("Both smartPtrType and smartPtr must be specified"),e.count={value:1},dr(Object.create(r,{da:{value:e}}))}function dr(r){return typeof FinalizationRegistry>"u"?(dr=e=>e,r):(jr=new FinalizationRegistry(e=>{ce(e.da)}),ue=e=>{jr.unregister(e)},(dr=e=>{var n=e.da;return n.ia&&jr.register(e,{da:n},e),e})(r))}function I(){}function Fr(r,e,n){if(r[e].ha===void 0){var t=r[e];r[e]=function(){return r[e].ha.hasOwnProperty(arguments.length)||m("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+r[e].ha+")!"),r[e].ha[arguments.length].apply(this,arguments)},r[e].ha=[],r[e].ha[t.sa]=t}}function Dr(r,e,n){c.hasOwnProperty(r)?((n===void 0||c[r].ha!==void 0&&c[r].ha[n]!==void 0)&&m("Cannot register public name '"+r+"' twice"),Fr(c,r,r),c.hasOwnProperty(n)&&m("Cannot register multiple overloads of a function with the same number of arguments ("+n+")!"),c[r].ha[n]=e):(c[r]=e,n!==void 0&&(c[r].kb=n))}function De(r,e,n,t,a,i,f,u){this.name=r,this.constructor=e,this.oa=n,this.na=t,this.la=a,this.Pa=i,this.va=f,this.Ka=u,this.$a=[]}function pr(r,e,n){for(;e!==n;)e.va||m("Expected null or instance of "+n.name+", got an instance of "+e.name),r=e.va(r),e=e.la;return r}function Me(r,e){return e===null?(this.Aa&&m("null is not a valid "+this.name),0):(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),pr(e.da.fa,e.da.ga.ea,this.ea))}function Ue(r,e){if(e===null){if(this.Aa&&m("null is not a valid "+this.name),this.xa){var n=this.Ba();return r!==null&&r.push(this.na,n),n}return 0}if(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),!this.wa&&e.da.ga.wa&&m("Cannot convert argument of type "+(e.da.ka?e.da.ka.name:e.da.ga.name)+" to parameter type "+this.name),n=pr(e.da.fa,e.da.ga.ea,this.ea),this.xa)switch(e.da.ia===void 0&&m("Passing raw pointer to smart pointer is illegal"),this.fb){case 0:e.da.ka===this?n=e.da.ia:m("Cannot convert argument of type "+(e.da.ka?e.da.ka.name:e.da.ga.name)+" to parameter type "+this.name);break;case 1:n=e.da.ia;break;case 2:if(e.da.ka===this)n=e.da.ia;else{var t=e.clone();n=this.ab(n,O(function(){t.delete()})),r!==null&&r.push(this.na,n)}break;default:m("Unsupporting sharing policy")}return n}function xe(r,e){return e===null?(this.Aa&&m("null is not a valid "+this.name),0):(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),e.da.ga.wa&&m("Cannot convert argument of type "+e.da.ga.name+" to parameter type "+this.name),pr(e.da.fa,e.da.ga.ea,this.ea))}function j(r,e,n,t,a,i,f,u,l,s,h){this.name=r,this.ea=e,this.Aa=n,this.wa=t,this.xa=a,this.Za=i,this.fb=f,this.Ga=u,this.Ba=l,this.ab=s,this.na=h,a||e.la!==void 0?this.toWireType=Ue:(this.toWireType=t?Me:xe,this.ja=null)}function le(r,e,n){c.hasOwnProperty(r)||lr("Replacing nonexistant public symbol"),c[r].ha!==void 0&&n!==void 0?c[r].ha[n]=e:(c[r]=e,c[r].sa=n)}var vr=[];function T(r,e){r=b(r);var n=vr[e];return n||(e>=vr.length&&(vr.length=e+1),vr[e]=n=Xr.get(e)),typeof n!="function"&&m("unknown function pointer with signature "+r+": "+e),n}var he=void 0;function de(r){var e=b(r=_e(r));return M(r),e}function B(r,e){function n(i){a[i]||V[i]||(sr[i]?sr[i].forEach(n):(t.push(i),a[i]=!0))}var t=[],a={};throw e.forEach(n),new he(r+": "+t.map(de).join([", "]))}function gr(r,e,n,t,a){var i=e.length;2>i&&m("argTypes array size mismatch! Must at least get return value and 'this' types!");var f=e[1]!==null&&n!==null,u=!1;for(n=1;n>2]);return n}function pe(r,e,n){return r instanceof Object||m(n+' with invalid "this": '+r),r instanceof e.ea.constructor||m(n+' incompatible with "this" of type '+r.constructor.name),r.da.fa||m("cannot call emscripten binding method "+n+" on deleted object"),pr(r.da.fa,r.da.ga.ea,e.ea)}var Mr=[],W=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Ur(r){4(r||m("Cannot use deleted val. handle = "+r),W[r].value),O=r=>{switch(r){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var e=Mr.length?Mr.pop():W.length;return W[e]={Ca:1,value:r},e}};function Ie(r,e,n){switch(e){case 0:return function(t){return this.fromWireType((n?F:_)[t])};case 1:return function(t){return this.fromWireType((n?Y:X)[t>>1])};case 2:return function(t){return this.fromWireType((n?w:y)[t>>2])};default:throw new TypeError("Unknown integer type: "+r)}}function ir(r,e){var n=V[r];return n===void 0&&m(e+" has unknown type "+de(r)),n}function Re(r,e){switch(e){case 2:return function(n){return this.fromWireType(Hr[n>>2])};case 3:return function(n){return this.fromWireType(zr[n>>3])};default:throw new TypeError("Unknown float type: "+r)}}var ve=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Ye(r,e){for(var n=r>>1,t=n+e/2;!(n>=t)&&X[n];)++n;if(32<(n<<=1)-r&&ve)return ve.decode(_.subarray(r,n));for(n="",t=0;!(t>=e/2);++t){var a=Y[r+2*t>>1];if(a==0)break;n+=String.fromCharCode(a)}return n}function He(r,e,n){if(n===void 0&&(n=2147483647),2>n)return 0;var t=e;n=(n-=2)<2*r.length?n/2:r.length;for(var a=0;a>1]=r.charCodeAt(a),e+=2;return Y[e>>1]=0,e-t}function Ve(r){return 2*r.length}function Be(r,e){for(var n=0,t="";!(n>=e/4);){var a=w[r+4*n>>2];if(a==0)break;++n,65536<=a?(a-=65536,t+=String.fromCharCode(55296|a>>10,56320|1023&a)):t+=String.fromCharCode(a)}return t}function ze(r,e,n){if(n===void 0&&(n=2147483647),4>n)return 0;var t=e;n=t+n-4;for(var a=0;a=i&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),w[e>>2]=i,(e+=4)+4>n)break}return w[e>>2]=0,e-t}function qe(r){for(var e=0,n=0;n=t&&++n,e+=4}return e}function ge(r,e){for(var n=Array(r),t=0;t>2],"parameter "+t);return n}var Ne={};function yr(r){var e=Ne[r];return e===void 0?b(r):e}var br=[];function me(){function r(e){e.$$$embind_global$$$=e;var n=typeof $$$embind_global$$$=="object"&&e.$$$embind_global$$$==e;return n||delete e.$$$embind_global$$$,n}if(typeof globalThis=="object")return globalThis;if(typeof $$$embind_global$$$=="object"||(typeof Rr=="object"&&r(Rr)?$$$embind_global$$$=Rr:typeof self=="object"&&r(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")}function Le(r){var e=br.length;return br.push(r),e}var ye=[],xr={};function be(){if(!Ir){var r,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:q||"./this.program"};for(r in xr)xr[r]===void 0?delete e[r]:e[r]=xr[r];var n=[];for(r in e)n.push(r+"="+e[r]);Ir=n}return Ir}var Ir,Ge=[null,[],[]];function wr(r){return r%4==0&&(r%100!=0||r%400==0)}var we=[31,29,31,30,31,30,31,31,30,31,30,31],Ae=[31,28,31,30,31,30,31,31,30,31,30,31];function Je(r){var e=Array(Gr(r)+1);return Lr(r,e,0,e.length),e}function Xe(r,e,n,t){function a(o,d,g){for(o=typeof o=="number"?o.toString():o||"";o.lengthC?-1:0A-o.getDate())){o.setDate(o.getDate()+d);break}d-=A-o.getDate()+1,o.setDate(1),11>g?o.setMonth(g+1):(o.setMonth(0),o.setFullYear(o.getFullYear()+1))}return g=new Date(o.getFullYear()+1,0,4),d=u(new Date(o.getFullYear(),0,4)),g=u(g),0>=f(d,o)?0>=f(g,o)?o.getFullYear()+1:o.getFullYear():o.getFullYear()-1}var s=w[t+40>>2];for(var h in t={ib:w[t>>2],hb:w[t+4>>2],ya:w[t+8>>2],Da:w[t+12>>2],za:w[t+16>>2],ra:w[t+20>>2],ma:w[t+24>>2],qa:w[t+28>>2],lb:w[t+32>>2],gb:w[t+36>>2],jb:s&&s?ur(_,s):""},n=n?ur(_,n):"",s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(h,"g"),s[h]);var p="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),v="January February March April May June July August September October November December".split(" ");for(h in s={"%a":function(o){return p[o.ma].substring(0,3)},"%A":function(o){return p[o.ma]},"%b":function(o){return v[o.za].substring(0,3)},"%B":function(o){return v[o.za]},"%C":function(o){return i((o.ra+1900)/100|0,2)},"%d":function(o){return i(o.Da,2)},"%e":function(o){return a(o.Da,2," ")},"%g":function(o){return l(o).toString().substring(2)},"%G":function(o){return l(o)},"%H":function(o){return i(o.ya,2)},"%I":function(o){return(o=o.ya)==0?o=12:12o.ya?"AM":"PM"},"%S":function(o){return i(o.ib,2)},"%t":function(){return" "},"%u":function(o){return o.ma||7},"%U":function(o){return i(Math.floor((o.qa+7-o.ma)/7),2)},"%V":function(o){var d=Math.floor((o.qa+7-(o.ma+6)%7)/7);if(2>=(o.ma+371-o.qa-2)%7&&d++,d)d==53&&((g=(o.ma+371-o.qa)%7)==4||g==3&&wr(o.ra)||(d=1));else{d=52;var g=(o.ma+7-o.qa-1)%7;(g==4||g==5&&wr(o.ra%400-1))&&d++}return i(d,2)},"%w":function(o){return o.ma},"%W":function(o){return i(Math.floor((o.qa+7-(o.ma+6)%7)/7),2)},"%y":function(o){return(o.ra+1900).toString().substring(2)},"%Y":function(o){return o.ra+1900},"%z":function(o){var d=0<=(o=o.gb);return o=Math.abs(o)/60,(d?"+":"-")+("0000"+(o/60*100+o%60)).slice(-4)},"%Z":function(o){return o.jb},"%%":function(){return"%"}},n=n.replace(/%%/g,"\0\0"),s)n.includes(h)&&(n=n.replace(new RegExp(h,"g"),s[h](t)));return(h=Je(n=n.replace(/\0\0/g,"%"))).length>e?0:(F.set(h,r),h.length-1)}ae=c.InternalError=Or("InternalError");for(var Te=Array(256),Ar=0;256>Ar;++Ar)Te[Ar]=String.fromCharCode(Ar);ie=Te,G=c.BindingError=Or("BindingError"),I.prototype.isAliasOf=function(r){if(!(this instanceof I&&r instanceof I))return!1;var e=this.da.ga.ea,n=this.da.fa,t=r.da.ga.ea;for(r=r.da.fa;e.la;)n=e.va(n),e=e.la;for(;t.la;)r=t.va(r),t=t.la;return e===t&&n===r},I.prototype.clone=function(){if(this.da.fa||Er(this),this.da.ua)return this.da.count.value+=1,this;var r=dr,e=Object,n=e.create,t=Object.getPrototypeOf(this),a=this.da;return(r=r(n.call(e,t,{da:{value:{count:a.count,ta:a.ta,ua:a.ua,fa:a.fa,ga:a.ga,ia:a.ia,ka:a.ka}}}))).da.count.value+=1,r.da.ta=!1,r},I.prototype.delete=function(){this.da.fa||Er(this),this.da.ta&&!this.da.ua&&m("Object already scheduled for deletion"),ue(this),ce(this.da),this.da.ua||(this.da.ia=void 0,this.da.fa=void 0)},I.prototype.isDeleted=function(){return!this.da.fa},I.prototype.deleteLater=function(){return this.da.fa||Er(this),this.da.ta&&!this.da.ua&&m("Object already scheduled for deletion"),nr.push(this),nr.length===1&&tr&&tr(Sr),this.da.ta=!0,this},c.getInheritedInstanceCount=function(){return Object.keys(ar).length},c.getLiveInheritedInstances=function(){var r,e=[];for(r in ar)ar.hasOwnProperty(r)&&e.push(ar[r]);return e},c.flushPendingDeletes=Sr,c.setDelayFunction=function(r){tr=r,nr.length&&tr&&tr(Sr)},j.prototype.Qa=function(r){return this.Ga&&(r=this.Ga(r)),r},j.prototype.Ea=function(r){this.na&&this.na(r)},j.prototype.argPackAdvance=8,j.prototype.readValueFromPointer=Q,j.prototype.deleteObject=function(r){r!==null&&r.delete()},j.prototype.fromWireType=function(r){function e(){return this.xa?hr(this.ea.oa,{ga:this.Za,fa:n,ka:this,ia:r}):hr(this.ea.oa,{ga:this,fa:r})}var n=this.Qa(r);if(!n)return this.Ea(r),null;var t=Fe(this.ea,n);if(t!==void 0)return t.da.count.value===0?(t.da.fa=n,t.da.ia=r,t.clone()):(t=t.clone(),this.Ea(r),t);if(t=this.ea.Pa(n),!(t=se[t]))return e.call(this);t=this.wa?t.Ha:t.pointerType;var a=fe(n,this.ea,t.ea);return a===null?e.call(this):this.xa?hr(t.ea.oa,{ga:t,fa:a,ka:this,ia:r}):hr(t.ea.oa,{ga:t,fa:a})},he=c.UnboundTypeError=Or("UnboundTypeError"),c.count_emval_handles=function(){for(var r=0,e=5;ei.Ta).concat(a.map(i=>i.cb)),i=>{var f={};return a.forEach((u,l)=>{var s=i[l],h=u.Ra,p=u.Sa,v=i[l+a.length],o=u.bb,d=u.eb;f[u.Na]={read:g=>s.fromWireType(h(p,g)),write:(g,A)=>{var C=[];o(d,g,v.toWireType(C,A)),fr(C)}}}),[{name:e.name,fromWireType:function(u){var l,s={};for(l in f)s[l]=f[l].read(u);return t(u),s},toWireType:function(u,l){for(var s in f)if(!(s in l))throw new TypeError('Missing field: "'+s+'"');var h=n();for(s in f)f[s].write(h,l[s]);return u!==null&&u.push(t,h),h},argPackAdvance:8,readValueFromPointer:Q,ja:t}]})},E:function(r,e,n,t,a){e=b(e),n=er(n);var i=e.indexOf("u")!=-1;i&&(a=(1n<<64n)-1n),k(r,{name:e,fromWireType:function(f){return f},toWireType:function(f,u){if(typeof u!="bigint"&&typeof u!="number")throw new TypeError('Cannot convert "'+rr(u)+'" to '+this.name);if(ua)throw new TypeError('Passing a number "'+rr(u)+'" from JS side to C/C++ side to an argument of type "'+e+'", which is outside the valid range ['+t+", "+a+"]!");return u},argPackAdvance:8,readValueFromPointer:oe(e,n,!i),ja:null})},S:function(r,e,n,t,a){var i=er(n);k(r,{name:e=b(e),fromWireType:function(f){return!!f},toWireType:function(f,u){return u?t:a},argPackAdvance:8,readValueFromPointer:function(f){if(n===1)var u=F;else if(n===2)u=Y;else{if(n!==4)throw new TypeError("Unknown boolean type size: "+e);u=w}return this.fromWireType(u[f>>i])},ja:null})},f:function(r,e,n,t,a,i,f,u,l,s,h,p,v){h=b(h),i=T(a,i),u&&(u=T(f,u)),s&&(s=T(l,s)),v=T(p,v);var o=te(h);Dr(o,function(){B("Cannot construct "+h+" due to unbound types",[t])}),$([r,e,n],t?[t]:[],function(d){if(d=d[0],t)var g=d.ea,A=g.oa;else A=I.prototype;d=Wr(o,function(){if(Object.getPrototypeOf(this)!==C)throw new G("Use 'new' to construct "+h);if(R.pa===void 0)throw new G(h+" has no accessible constructor");var Ce=R.pa[arguments.length];if(Ce===void 0)throw new G("Tried to invoke ctor of "+h+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(R.pa).toString()+") parameters instead!");return Ce.apply(this,arguments)});var C=Object.create(A,{constructor:{value:d}});d.prototype=C;var R=new De(h,d,C,v,g,i,u,s);g=new j(h,R,!0,!1,!1),A=new j(h+"*",R,!1,!1,!1);var or=new j(h+" const*",R,!1,!0,!1);return se[r]={pointerType:A,Ha:or},le(o,d),[g,A,or]})},o:function(r,e,n,t,a,i,f){var u=mr(n,t);e=b(e),i=T(a,i),$([],[r],function(l){function s(){B("Cannot call "+h+" due to unbound types",u)}var h=(l=l[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var p=l.ea.constructor;return p[e]===void 0?(s.sa=n-1,p[e]=s):(Fr(p,e,h),p[e].ha[n-1]=s),$([],u,function(v){return v=gr(h,[v[0],null].concat(v.slice(1)),null,i,f),p[e].ha===void 0?(v.sa=n-1,p[e]=v):p[e].ha[n-1]=v,[]}),[]})},i:function(r,e,n,t,a,i){0{B("Cannot construct "+u.name+" due to unbound types",f)},$([],f,function(s){return s.splice(1,0,null),u.ea.pa[e-1]=gr(l,s,null,a,i),[]}),[]})},b:function(r,e,n,t,a,i,f,u){var l=mr(n,t);e=b(e),i=T(a,i),$([],[r],function(s){function h(){B("Cannot call "+p+" due to unbound types",l)}var p=(s=s[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),u&&s.ea.$a.push(e);var v=s.ea.oa,o=v[e];return o===void 0||o.ha===void 0&&o.className!==s.name&&o.sa===n-2?(h.sa=n-2,h.className=s.name,v[e]=h):(Fr(v,e,p),v[e].ha[n-2]=h),$([],l,function(d){return d=gr(p,d,s,i,f),v[e].ha===void 0?(d.sa=n-2,v[e]=d):v[e].ha[n-2]=d,[]}),[]})},c:function(r,e,n,t,a,i,f,u,l,s){e=b(e),a=T(t,a),$([],[r],function(h){var p=(h=h[0]).name+"."+e,v={get:function(){B("Cannot access "+p+" due to unbound types",[n,f])},enumerable:!0,configurable:!0};return v.set=l?()=>{B("Cannot access "+p+" due to unbound types",[n,f])}:()=>{m(p+" is a read-only property")},Object.defineProperty(h.ea.oa,e,v),$([],l?[n,f]:[n],function(o){var d=o[0],g={get:function(){var C=pe(this,h,p+" getter");return d.fromWireType(a(i,C))},enumerable:!0};if(l){l=T(u,l);var A=o[1];g.set=function(C){var R=pe(this,h,p+" setter"),or=[];l(s,R,A.toWireType(or,C)),fr(or)}}return Object.defineProperty(h.ea.oa,e,g),[]}),[]})},R:function(r,e){k(r,{name:e=b(e),fromWireType:function(n){var t=P(n);return Ur(n),t},toWireType:function(n,t){return O(t)},argPackAdvance:8,readValueFromPointer:Q,ja:null})},s:function(r,e,n,t){function a(){}n=er(n),e=b(e),a.values={},k(r,{name:e,constructor:a,fromWireType:function(i){return this.constructor.values[i]},toWireType:function(i,f){return f.value},argPackAdvance:8,readValueFromPointer:Ie(e,n,t),ja:null}),Dr(e,a)},e:function(r,e,n){var t=ir(r,"enum");e=b(e),r=t.constructor,t=Object.create(t.constructor.prototype,{value:{value:n},constructor:{value:Wr(t.name+"_"+e,function(){})}}),r.values[n]=t,r[e]=t},D:function(r,e,n){n=er(n),k(r,{name:e=b(e),fromWireType:function(t){return t},toWireType:function(t,a){return a},argPackAdvance:8,readValueFromPointer:Re(e,n),ja:null})},V:function(r,e,n,t,a,i){var f=mr(e,n);r=b(r),a=T(t,a),Dr(r,function(){B("Cannot call "+r+" due to unbound types",f)},e-1),$([],f,function(u){return le(r,gr(r,[u[0],null].concat(u.slice(1)),null,a,i),e-1),[]})},w:function(r,e,n,t,a){e=b(e),a===-1&&(a=4294967295),a=er(n);var i=u=>u;if(t===0){var f=32-8*n;i=u=>u<>>f}n=e.includes("unsigned")?function(u,l){return l>>>0}:function(u,l){return l},k(r,{name:e,fromWireType:i,toWireType:n,argPackAdvance:8,readValueFromPointer:oe(e,a,t!==0),ja:null})},q:function(r,e,n){function t(i){var f=y;return new a($r,f[1+(i>>=2)],f[i])}var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][e];k(r,{name:n=b(n),fromWireType:t,argPackAdvance:8,readValueFromPointer:t},{Wa:!0})},h:function(r,e,n,t,a,i,f,u,l,s,h,p){n=b(n),i=T(a,i),u=T(f,u),s=T(l,s),p=T(h,p),$([r],[e],function(v){return v=v[0],[new j(n,v.ea,!1,!1,!0,v,t,i,u,s,p)]})},F:function(r,e){var n=(e=b(e))==="std::string";k(r,{name:e,fromWireType:function(t){var a=y[t>>2],i=t+4;if(n)for(var f=i,u=0;u<=a;++u){var l=i+u;if(u==a||_[l]==0){if(f=f?ur(_,f,l-f):"",s===void 0)var s=f;else s+="\0",s+=f;f=l+1}}else{for(s=Array(a),u=0;u>2]=f,n&&i)Lr(a,_,l,f+1);else if(i)for(i=0;iX,u=1;else e===4&&(t=Be,a=ze,i=qe,f=()=>y,u=2);k(r,{name:n,fromWireType:function(l){for(var s,h=y[l>>2],p=f(),v=l+4,o=0;o<=h;++o){var d=l+4+o*e;o!=h&&p[d>>u]!=0||(v=t(v,d-v),s===void 0?s=v:(s+="\0",s+=v),v=d+e)}return M(l),s},toWireType:function(l,s){typeof s!="string"&&m("Cannot pass non-string to C++ string type "+n);var h=i(s),p=_r(4+h+e);return y[p>>2]=h>>u,a(s,p+4,h+e),l!==null&&l.push(M,p),p},argPackAdvance:8,readValueFromPointer:Q,ja:function(l){M(l)}})},v:function(r,e,n,t,a,i){cr[r]={name:b(e),Ba:T(n,t),na:T(a,i),Fa:[]}},l:function(r,e,n,t,a,i,f,u,l,s){cr[r].Fa.push({Na:b(e),Ta:n,Ra:T(t,a),Sa:i,cb:f,bb:T(u,l),eb:s})},T:function(r,e){k(r,{Xa:!0,name:e=b(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},k:function(r,e,n){r=P(r),e=ir(e,"emval::as");var t=[],a=O(t);return y[n>>2]=a,e.toWireType(t,r)},z:function(r,e){return r=P(r),(e=ir(e,"emval::as")).toWireType(null,r)},W:function(r,e,n,t){r=P(r),n=ge(e,n);for(var a=Array(e),i=0;i>2]=O(i),r(e,n,i,a)},G:function(r,e,n,t){(r=br[r])(e=P(e),n=yr(n),null,t)},a:Ur,H:function(r){return r===0?O(me()):(r=yr(r),O(me()[r]))},B:function(r,e){var n=ge(r,e),t=n[0];e=t.name+"_$"+n.slice(1).map(function(f){return f.name}).join("_")+"$";var a=ye[e];if(a!==void 0)return a;var i=Array(r-1);return a=Le((f,u,l,s)=>{for(var h=0,p=0;p>>=0))return!1;for(var n=1;4>=n;n*=2){var t=e*(1+.2/n);t=Math.min(t,r+100663296);var a=Math;t=Math.max(r,t),a=a.min.call(a,2147483648,t+(65536-t%65536)%65536);r:{try{Cr.grow(a-$r.byteLength+65535>>>16),Jr();var i=1;break r}catch{}i=void 0}if(i)return!0}return!1},K:function(r,e){var n=0;return be().forEach(function(t,a){var i=e+n;for(a=y[r+4*a>>2]=i,i=0;i>0]=t.charCodeAt(i);F[a>>0]=0,n+=t.length+1}),0},L:function(r,e){var n=be();y[r>>2]=n.length;var t=0;return n.forEach(function(a){t+=a.length+1}),y[e>>2]=t,0},Q:function(){return 52},P:function(){return 70},O:function(r,e,n,t){for(var a=0,i=0;i>2],u=y[e+4>>2];e+=8;for(var l=0;l>2]=a,0},J:function(r,e,n,t){return Xe(r,e,n,t)}};(function(){function r(a){c.asm=a.exports,Cr=c.asm.X,Jr(),Xr=c.asm.ba,Kr.unshift(c.asm.Y),H--,c.monitorRunDependencies&&c.monitorRunDependencies(H),H==0&&Z&&(a=Z,Z=null,a())}function e(a){r(a.instance)}function n(a){return je().then(function(i){return WebAssembly.instantiate(i,t)}).then(function(i){return i}).then(a,function(i){N("failed to asynchronously prepare wasm: "+i),K(i)})}var t={a:Ze};if(H++,c.monitorRunDependencies&&c.monitorRunDependencies(H),c.instantiateWasm)try{return c.instantiateWasm(t,r)}catch(a){N("Module.instantiateWasm callback failed with error: "+a),E(a)}(J||typeof WebAssembly.instantiateStreaming!="function"||re()||typeof fetch!="function"?n(e):fetch(D,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,t).then(e,function(i){return N("wasm streaming compile failed: "+i),N("falling back to ArrayBuffer instantiation"),n(e)})})).catch(E)})(),c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.Y).apply(null,arguments)};var Tr,_r=c._malloc=function(){return(_r=c._malloc=c.asm.Z).apply(null,arguments)},M=c._free=function(){return(M=c._free=c.asm._).apply(null,arguments)},_e=c.___getTypeName=function(){return(_e=c.___getTypeName=c.asm.$).apply(null,arguments)};function Pe(){function r(){if(!Tr&&(Tr=!0,c.calledRun=!0,!qr)){if(kr(Kr),z(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;){var e=c.postRun.shift();Qr.unshift(e)}kr(Qr)}}if(!(0E[R]})}}}return Object.freeze(Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}))}var $e,Yr,ke,Pr={exports:{}};Pr.exports,$e=Pr,Pr.exports,Yr=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,ke=function(S){var c,z,E;S=S||{},c||(c=S!==void 0?S:{}),c.ready=new Promise(function(r,e){z=r,E=e});var R=Object.assign({},c),q="./this.program",U="";typeof document<"u"&&document.currentScript&&(U=document.currentScript.src),Yr&&(U=Yr),U=U.indexOf("blob:")!==0?U.substr(0,U.replace(/[?#].*/,"").lastIndexOf("/")+1):"";var J,Oe=c.print||console.log.bind(console),N=c.printErr||console.warn.bind(console);Object.assign(c,R),R=null,c.thisProgram&&(q=c.thisProgram),c.wasmBinary&&(J=c.wasmBinary),c.noExitRuntime,typeof WebAssembly!="object"&&K("no native wasm support detected");var Cr,$r,F,_,Y,X,w,y,Hr,Vr,Br,zr,qr=!1,Nr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ur(r,e,n){var t=e+n;for(n=e;r[n]&&!(n>=t);)++n;if(16(a=(240&a)==224?(15&a)<<12|i<<6|f:(7&a)<<18|i<<12|f<<6|63&r[e++])?t+=String.fromCharCode(a):(a-=65536,t+=String.fromCharCode(55296|a>>10,56320|1023&a))}}else t+=String.fromCharCode(a)}return t}function Lr(r,e,n,t){if(0=i&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),127>=i){if(n>=t)break;e[n++]=i}else{if(2047>=i){if(n+1>=t)break;e[n++]=192|i>>6}else{if(65535>=i){if(n+2>=t)break;e[n++]=224|i>>12}else{if(n+3>=t)break;e[n++]=240|i>>18,e[n++]=128|i>>12&63}e[n++]=128|i>>6&63}e[n++]=128|63&i}}e[n]=0}}function Gr(r){for(var e=0,n=0;n=t?e++:2047>=t?e+=2:55296<=t&&57343>=t?(e+=4,++n):e+=3}return e}function Jr(){var r=Cr.buffer;$r=r,c.HEAP8=F=new Int8Array(r),c.HEAP16=Y=new Int16Array(r),c.HEAP32=w=new Int32Array(r),c.HEAPU8=_=new Uint8Array(r),c.HEAPU16=X=new Uint16Array(r),c.HEAPU32=y=new Uint32Array(r),c.HEAPF32=Hr=new Float32Array(r),c.HEAPF64=zr=new Float64Array(r),c.HEAP64=Vr=new BigInt64Array(r),c.HEAPU64=Br=new BigUint64Array(r)}var Xr,Zr=[],Kr=[],Qr=[];function Ee(){var r=c.preRun.shift();Zr.unshift(r)}var D,H=0,Z=null;function K(r){throw c.onAbort&&c.onAbort(r),N(r="Aborted("+r+")"),qr=!0,r=new WebAssembly.RuntimeError(r+". Build with -sASSERTIONS for more info."),E(r),r}function re(){return D.startsWith("data:application/octet-stream;base64,")}if(D="arcgis-knowledge-client-core-simd.wasm",!re()){var ee=D;D=c.locateFile?c.locateFile(ee,U):U+ee}function ne(){var r=D;try{if(r==D&&J)return new Uint8Array(J);throw"both async and sync fetching of the wasm failed"}catch(e){K(e)}}function je(){return J||typeof fetch!="function"?Promise.resolve().then(function(){return ne()}):fetch(D,{credentials:"same-origin"}).then(function(r){if(!r.ok)throw"failed to load wasm binary file at '"+D+"'";return r.arrayBuffer()}).catch(function(){return ne()})}function kr(r){for(;0>2]=e},this.Oa=function(e){y[this.fa+8>>2]=e},this.Ua=function(){w[this.fa>>2]=0},this.Ma=function(){F[this.fa+12>>0]=0},this.Va=function(){F[this.fa+13>>0]=0},this.Ia=function(e,n){this.La(),this.Ya(e),this.Oa(n),this.Ua(),this.Ma(),this.Va()},this.La=function(){y[this.fa+16>>2]=0}}var cr={};function fr(r){for(;r.length;){var e=r.pop();r.pop()(e)}}function Q(r){return this.fromWireType(w[r>>2])}var L={},V={},sr={};function te(r){if(r===void 0)return"_unknown";var e=(r=r.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=e&&57>=e?"_"+r:r}function Wr(r,e){return r=te(r),function(){return e.apply(this,arguments)}}function Or(r){var e=Error,n=Wr(r,function(t){this.name=r,this.message=t,(t=Error(t).stack)!==void 0&&(this.stack=this.toString()+` +`+t.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},n}var ae=void 0;function lr(r){throw new ae(r)}function $(r,e,n){function t(u){(u=n(u)).length!==r.length&&lr("Mismatched type converter count");for(var l=0;l{V.hasOwnProperty(u)?a[l]=V[u]:(i.push(u),L.hasOwnProperty(u)||(L[u]=[]),L[u].push(()=>{a[l]=V[u],++f===i.length&&t(a)}))}),i.length===0&&t(a)}function rr(r){if(r===null)return"null";var e=typeof r;return e==="object"||e==="array"||e==="function"?r.toString():""+r}var ie=void 0;function b(r){for(var e="";_[r];)e+=ie[_[r++]];return e}var G=void 0;function m(r){throw new G(r)}function k(r,e,n={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var t=e.name;if(r||m('type "'+t+'" must have a positive integer typeid pointer'),V.hasOwnProperty(r)){if(n.Wa)return;m("Cannot register type '"+t+"' twice")}V[r]=e,delete sr[r],L.hasOwnProperty(r)&&(e=L[r],delete L[r],e.forEach(a=>a()))}function oe(r,e,n){switch(e){case 0:return n?function(t){return F[t]}:function(t){return _[t]};case 1:return n?function(t){return Y[t>>1]}:function(t){return X[t>>1]};case 2:return n?function(t){return w[t>>2]}:function(t){return y[t>>2]};case 3:return n?function(t){return Vr[t>>3]}:function(t){return Br[t>>3]};default:throw new TypeError("Unknown integer type: "+r)}}function er(r){switch(r){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+r)}}function Er(r){m(r.da.ga.ea.name+" instance already deleted")}var jr=!1;function ue(){}function ce(r){--r.count.value,r.count.value===0&&(r.ia?r.ka.na(r.ia):r.ga.ea.na(r.fa))}function fe(r,e,n){return e===n?r:n.la===void 0||(r=fe(r,e,n.la))===null?null:n.Ka(r)}var se={},nr=[];function Sr(){for(;nr.length;){var r=nr.pop();r.da.ta=!1,r.delete()}}var tr=void 0,ar={};function Fe(r,e){for(e===void 0&&m("ptr should not be undefined");r.la;)e=r.va(e),r=r.la;return ar[e]}function hr(r,e){return e.ga&&e.fa||lr("makeClassHandle requires ptr and ptrType"),!!e.ka!=!!e.ia&&lr("Both smartPtrType and smartPtr must be specified"),e.count={value:1},dr(Object.create(r,{da:{value:e}}))}function dr(r){return typeof FinalizationRegistry>"u"?(dr=e=>e,r):(jr=new FinalizationRegistry(e=>{ce(e.da)}),ue=e=>{jr.unregister(e)},(dr=e=>{var n=e.da;return n.ia&&jr.register(e,{da:n},e),e})(r))}function x(){}function Fr(r,e,n){if(r[e].ha===void 0){var t=r[e];r[e]=function(){return r[e].ha.hasOwnProperty(arguments.length)||m("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+r[e].ha+")!"),r[e].ha[arguments.length].apply(this,arguments)},r[e].ha=[],r[e].ha[t.sa]=t}}function Dr(r,e,n){c.hasOwnProperty(r)?((n===void 0||c[r].ha!==void 0&&c[r].ha[n]!==void 0)&&m("Cannot register public name '"+r+"' twice"),Fr(c,r,r),c.hasOwnProperty(n)&&m("Cannot register multiple overloads of a function with the same number of arguments ("+n+")!"),c[r].ha[n]=e):(c[r]=e,n!==void 0&&(c[r].kb=n))}function De(r,e,n,t,a,i,f,u){this.name=r,this.constructor=e,this.oa=n,this.na=t,this.la=a,this.Pa=i,this.va=f,this.Ka=u,this.$a=[]}function pr(r,e,n){for(;e!==n;)e.va||m("Expected null or instance of "+n.name+", got an instance of "+e.name),r=e.va(r),e=e.la;return r}function Me(r,e){return e===null?(this.Aa&&m("null is not a valid "+this.name),0):(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),pr(e.da.fa,e.da.ga.ea,this.ea))}function Re(r,e){if(e===null){if(this.Aa&&m("null is not a valid "+this.name),this.xa){var n=this.Ba();return r!==null&&r.push(this.na,n),n}return 0}if(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),!this.wa&&e.da.ga.wa&&m("Cannot convert argument of type "+(e.da.ka?e.da.ka.name:e.da.ga.name)+" to parameter type "+this.name),n=pr(e.da.fa,e.da.ga.ea,this.ea),this.xa)switch(e.da.ia===void 0&&m("Passing raw pointer to smart pointer is illegal"),this.fb){case 0:e.da.ka===this?n=e.da.ia:m("Cannot convert argument of type "+(e.da.ka?e.da.ka.name:e.da.ga.name)+" to parameter type "+this.name);break;case 1:n=e.da.ia;break;case 2:if(e.da.ka===this)n=e.da.ia;else{var t=e.clone();n=this.ab(n,O(function(){t.delete()})),r!==null&&r.push(this.na,n)}break;default:m("Unsupporting sharing policy")}return n}function Ue(r,e){return e===null?(this.Aa&&m("null is not a valid "+this.name),0):(e.da||m('Cannot pass "'+rr(e)+'" as a '+this.name),e.da.fa||m("Cannot pass deleted object as a pointer of type "+this.name),e.da.ga.wa&&m("Cannot convert argument of type "+e.da.ga.name+" to parameter type "+this.name),pr(e.da.fa,e.da.ga.ea,this.ea))}function j(r,e,n,t,a,i,f,u,l,s,h){this.name=r,this.ea=e,this.Aa=n,this.wa=t,this.xa=a,this.Za=i,this.fb=f,this.Ga=u,this.Ba=l,this.ab=s,this.na=h,a||e.la!==void 0?this.toWireType=Re:(this.toWireType=t?Me:Ue,this.ja=null)}function le(r,e,n){c.hasOwnProperty(r)||lr("Replacing nonexistant public symbol"),c[r].ha!==void 0&&n!==void 0?c[r].ha[n]=e:(c[r]=e,c[r].sa=n)}var vr=[];function T(r,e){r=b(r);var n=vr[e];return n||(e>=vr.length&&(vr.length=e+1),vr[e]=n=Xr.get(e)),typeof n!="function"&&m("unknown function pointer with signature "+r+": "+e),n}var he=void 0;function de(r){var e=b(r=_e(r));return M(r),e}function B(r,e){function n(i){a[i]||V[i]||(sr[i]?sr[i].forEach(n):(t.push(i),a[i]=!0))}var t=[],a={};throw e.forEach(n),new he(r+": "+t.map(de).join([", "]))}function gr(r,e,n,t,a){var i=e.length;2>i&&m("argTypes array size mismatch! Must at least get return value and 'this' types!");var f=e[1]!==null&&n!==null,u=!1;for(n=1;n>2]);return n}function pe(r,e,n){return r instanceof Object||m(n+' with invalid "this": '+r),r instanceof e.ea.constructor||m(n+' incompatible with "this" of type '+r.constructor.name),r.da.fa||m("cannot call emscripten binding method "+n+" on deleted object"),pr(r.da.fa,r.da.ga.ea,e.ea)}var Mr=[],W=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Rr(r){4(r||m("Cannot use deleted val. handle = "+r),W[r].value),O=r=>{switch(r){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var e=Mr.length?Mr.pop():W.length;return W[e]={Ca:1,value:r},e}};function xe(r,e,n){switch(e){case 0:return function(t){return this.fromWireType((n?F:_)[t])};case 1:return function(t){return this.fromWireType((n?Y:X)[t>>1])};case 2:return function(t){return this.fromWireType((n?w:y)[t>>2])};default:throw new TypeError("Unknown integer type: "+r)}}function ir(r,e){var n=V[r];return n===void 0&&m(e+" has unknown type "+de(r)),n}function Ie(r,e){switch(e){case 2:return function(n){return this.fromWireType(Hr[n>>2])};case 3:return function(n){return this.fromWireType(zr[n>>3])};default:throw new TypeError("Unknown float type: "+r)}}var ve=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Ye(r,e){for(var n=r>>1,t=n+e/2;!(n>=t)&&X[n];)++n;if(32<(n<<=1)-r&&ve)return ve.decode(_.subarray(r,n));for(n="",t=0;!(t>=e/2);++t){var a=Y[r+2*t>>1];if(a==0)break;n+=String.fromCharCode(a)}return n}function He(r,e,n){if(n===void 0&&(n=2147483647),2>n)return 0;var t=e;n=(n-=2)<2*r.length?n/2:r.length;for(var a=0;a>1]=r.charCodeAt(a),e+=2;return Y[e>>1]=0,e-t}function Ve(r){return 2*r.length}function Be(r,e){for(var n=0,t="";!(n>=e/4);){var a=w[r+4*n>>2];if(a==0)break;++n,65536<=a?(a-=65536,t+=String.fromCharCode(55296|a>>10,56320|1023&a)):t+=String.fromCharCode(a)}return t}function ze(r,e,n){if(n===void 0&&(n=2147483647),4>n)return 0;var t=e;n=t+n-4;for(var a=0;a=i&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),w[e>>2]=i,(e+=4)+4>n)break}return w[e>>2]=0,e-t}function qe(r){for(var e=0,n=0;n=t&&++n,e+=4}return e}function ge(r,e){for(var n=Array(r),t=0;t>2],"parameter "+t);return n}var Ne={};function yr(r){var e=Ne[r];return e===void 0?b(r):e}var br=[];function me(){function r(e){e.$$$embind_global$$$=e;var n=typeof $$$embind_global$$$=="object"&&e.$$$embind_global$$$==e;return n||delete e.$$$embind_global$$$,n}if(typeof globalThis=="object")return globalThis;if(typeof $$$embind_global$$$=="object"||(typeof Ir=="object"&&r(Ir)?$$$embind_global$$$=Ir:typeof self=="object"&&r(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")}function Le(r){var e=br.length;return br.push(r),e}var ye=[],Ur={};function be(){if(!xr){var r,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:q||"./this.program"};for(r in Ur)Ur[r]===void 0?delete e[r]:e[r]=Ur[r];var n=[];for(r in e)n.push(r+"="+e[r]);xr=n}return xr}var xr,Ge=[null,[],[]];function wr(r){return r%4==0&&(r%100!=0||r%400==0)}var we=[31,29,31,30,31,30,31,31,30,31,30,31],Ae=[31,28,31,30,31,30,31,31,30,31,30,31];function Je(r){var e=Array(Gr(r)+1);return Lr(r,e,0,e.length),e}function Xe(r,e,n,t){function a(o,d,g){for(o=typeof o=="number"?o.toString():o||"";o.lengthC?-1:0A-o.getDate())){o.setDate(o.getDate()+d);break}d-=A-o.getDate()+1,o.setDate(1),11>g?o.setMonth(g+1):(o.setMonth(0),o.setFullYear(o.getFullYear()+1))}return g=new Date(o.getFullYear()+1,0,4),d=u(new Date(o.getFullYear(),0,4)),g=u(g),0>=f(d,o)?0>=f(g,o)?o.getFullYear()+1:o.getFullYear():o.getFullYear()-1}var s=w[t+40>>2];for(var h in t={ib:w[t>>2],hb:w[t+4>>2],ya:w[t+8>>2],Da:w[t+12>>2],za:w[t+16>>2],ra:w[t+20>>2],ma:w[t+24>>2],qa:w[t+28>>2],lb:w[t+32>>2],gb:w[t+36>>2],jb:s&&s?ur(_,s):""},n=n?ur(_,n):"",s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(h,"g"),s[h]);var p="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),v="January February March April May June July August September October November December".split(" ");for(h in s={"%a":function(o){return p[o.ma].substring(0,3)},"%A":function(o){return p[o.ma]},"%b":function(o){return v[o.za].substring(0,3)},"%B":function(o){return v[o.za]},"%C":function(o){return i((o.ra+1900)/100|0,2)},"%d":function(o){return i(o.Da,2)},"%e":function(o){return a(o.Da,2," ")},"%g":function(o){return l(o).toString().substring(2)},"%G":function(o){return l(o)},"%H":function(o){return i(o.ya,2)},"%I":function(o){return(o=o.ya)==0?o=12:12o.ya?"AM":"PM"},"%S":function(o){return i(o.ib,2)},"%t":function(){return" "},"%u":function(o){return o.ma||7},"%U":function(o){return i(Math.floor((o.qa+7-o.ma)/7),2)},"%V":function(o){var d=Math.floor((o.qa+7-(o.ma+6)%7)/7);if(2>=(o.ma+371-o.qa-2)%7&&d++,d)d==53&&((g=(o.ma+371-o.qa)%7)==4||g==3&&wr(o.ra)||(d=1));else{d=52;var g=(o.ma+7-o.qa-1)%7;(g==4||g==5&&wr(o.ra%400-1))&&d++}return i(d,2)},"%w":function(o){return o.ma},"%W":function(o){return i(Math.floor((o.qa+7-(o.ma+6)%7)/7),2)},"%y":function(o){return(o.ra+1900).toString().substring(2)},"%Y":function(o){return o.ra+1900},"%z":function(o){var d=0<=(o=o.gb);return o=Math.abs(o)/60,(d?"+":"-")+("0000"+(o/60*100+o%60)).slice(-4)},"%Z":function(o){return o.jb},"%%":function(){return"%"}},n=n.replace(/%%/g,"\0\0"),s)n.includes(h)&&(n=n.replace(new RegExp(h,"g"),s[h](t)));return(h=Je(n=n.replace(/\0\0/g,"%"))).length>e?0:(F.set(h,r),h.length-1)}ae=c.InternalError=Or("InternalError");for(var Te=Array(256),Ar=0;256>Ar;++Ar)Te[Ar]=String.fromCharCode(Ar);ie=Te,G=c.BindingError=Or("BindingError"),x.prototype.isAliasOf=function(r){if(!(this instanceof x&&r instanceof x))return!1;var e=this.da.ga.ea,n=this.da.fa,t=r.da.ga.ea;for(r=r.da.fa;e.la;)n=e.va(n),e=e.la;for(;t.la;)r=t.va(r),t=t.la;return e===t&&n===r},x.prototype.clone=function(){if(this.da.fa||Er(this),this.da.ua)return this.da.count.value+=1,this;var r=dr,e=Object,n=e.create,t=Object.getPrototypeOf(this),a=this.da;return(r=r(n.call(e,t,{da:{value:{count:a.count,ta:a.ta,ua:a.ua,fa:a.fa,ga:a.ga,ia:a.ia,ka:a.ka}}}))).da.count.value+=1,r.da.ta=!1,r},x.prototype.delete=function(){this.da.fa||Er(this),this.da.ta&&!this.da.ua&&m("Object already scheduled for deletion"),ue(this),ce(this.da),this.da.ua||(this.da.ia=void 0,this.da.fa=void 0)},x.prototype.isDeleted=function(){return!this.da.fa},x.prototype.deleteLater=function(){return this.da.fa||Er(this),this.da.ta&&!this.da.ua&&m("Object already scheduled for deletion"),nr.push(this),nr.length===1&&tr&&tr(Sr),this.da.ta=!0,this},c.getInheritedInstanceCount=function(){return Object.keys(ar).length},c.getLiveInheritedInstances=function(){var r,e=[];for(r in ar)ar.hasOwnProperty(r)&&e.push(ar[r]);return e},c.flushPendingDeletes=Sr,c.setDelayFunction=function(r){tr=r,nr.length&&tr&&tr(Sr)},j.prototype.Qa=function(r){return this.Ga&&(r=this.Ga(r)),r},j.prototype.Ea=function(r){this.na&&this.na(r)},j.prototype.argPackAdvance=8,j.prototype.readValueFromPointer=Q,j.prototype.deleteObject=function(r){r!==null&&r.delete()},j.prototype.fromWireType=function(r){function e(){return this.xa?hr(this.ea.oa,{ga:this.Za,fa:n,ka:this,ia:r}):hr(this.ea.oa,{ga:this,fa:r})}var n=this.Qa(r);if(!n)return this.Ea(r),null;var t=Fe(this.ea,n);if(t!==void 0)return t.da.count.value===0?(t.da.fa=n,t.da.ia=r,t.clone()):(t=t.clone(),this.Ea(r),t);if(t=this.ea.Pa(n),!(t=se[t]))return e.call(this);t=this.wa?t.Ha:t.pointerType;var a=fe(n,this.ea,t.ea);return a===null?e.call(this):this.xa?hr(t.ea.oa,{ga:t,fa:a,ka:this,ia:r}):hr(t.ea.oa,{ga:t,fa:a})},he=c.UnboundTypeError=Or("UnboundTypeError"),c.count_emval_handles=function(){for(var r=0,e=5;ei.Ta).concat(a.map(i=>i.cb)),i=>{var f={};return a.forEach((u,l)=>{var s=i[l],h=u.Ra,p=u.Sa,v=i[l+a.length],o=u.bb,d=u.eb;f[u.Na]={read:g=>s.fromWireType(h(p,g)),write:(g,A)=>{var C=[];o(d,g,v.toWireType(C,A)),fr(C)}}}),[{name:e.name,fromWireType:function(u){var l,s={};for(l in f)s[l]=f[l].read(u);return t(u),s},toWireType:function(u,l){for(var s in f)if(!(s in l))throw new TypeError('Missing field: "'+s+'"');var h=n();for(s in f)f[s].write(h,l[s]);return u!==null&&u.push(t,h),h},argPackAdvance:8,readValueFromPointer:Q,ja:t}]})},E:function(r,e,n,t,a){e=b(e),n=er(n);var i=e.indexOf("u")!=-1;i&&(a=(1n<<64n)-1n),k(r,{name:e,fromWireType:function(f){return f},toWireType:function(f,u){if(typeof u!="bigint"&&typeof u!="number")throw new TypeError('Cannot convert "'+rr(u)+'" to '+this.name);if(ua)throw new TypeError('Passing a number "'+rr(u)+'" from JS side to C/C++ side to an argument of type "'+e+'", which is outside the valid range ['+t+", "+a+"]!");return u},argPackAdvance:8,readValueFromPointer:oe(e,n,!i),ja:null})},S:function(r,e,n,t,a){var i=er(n);k(r,{name:e=b(e),fromWireType:function(f){return!!f},toWireType:function(f,u){return u?t:a},argPackAdvance:8,readValueFromPointer:function(f){if(n===1)var u=F;else if(n===2)u=Y;else{if(n!==4)throw new TypeError("Unknown boolean type size: "+e);u=w}return this.fromWireType(u[f>>i])},ja:null})},f:function(r,e,n,t,a,i,f,u,l,s,h,p,v){h=b(h),i=T(a,i),u&&(u=T(f,u)),s&&(s=T(l,s)),v=T(p,v);var o=te(h);Dr(o,function(){B("Cannot construct "+h+" due to unbound types",[t])}),$([r,e,n],t?[t]:[],function(d){if(d=d[0],t)var g=d.ea,A=g.oa;else A=x.prototype;d=Wr(o,function(){if(Object.getPrototypeOf(this)!==C)throw new G("Use 'new' to construct "+h);if(I.pa===void 0)throw new G(h+" has no accessible constructor");var Ce=I.pa[arguments.length];if(Ce===void 0)throw new G("Tried to invoke ctor of "+h+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(I.pa).toString()+") parameters instead!");return Ce.apply(this,arguments)});var C=Object.create(A,{constructor:{value:d}});d.prototype=C;var I=new De(h,d,C,v,g,i,u,s);g=new j(h,I,!0,!1,!1),A=new j(h+"*",I,!1,!1,!1);var or=new j(h+" const*",I,!1,!0,!1);return se[r]={pointerType:A,Ha:or},le(o,d),[g,A,or]})},o:function(r,e,n,t,a,i,f){var u=mr(n,t);e=b(e),i=T(a,i),$([],[r],function(l){function s(){B("Cannot call "+h+" due to unbound types",u)}var h=(l=l[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var p=l.ea.constructor;return p[e]===void 0?(s.sa=n-1,p[e]=s):(Fr(p,e,h),p[e].ha[n-1]=s),$([],u,function(v){return v=gr(h,[v[0],null].concat(v.slice(1)),null,i,f),p[e].ha===void 0?(v.sa=n-1,p[e]=v):p[e].ha[n-1]=v,[]}),[]})},i:function(r,e,n,t,a,i){0{B("Cannot construct "+u.name+" due to unbound types",f)},$([],f,function(s){return s.splice(1,0,null),u.ea.pa[e-1]=gr(l,s,null,a,i),[]}),[]})},b:function(r,e,n,t,a,i,f,u){var l=mr(n,t);e=b(e),i=T(a,i),$([],[r],function(s){function h(){B("Cannot call "+p+" due to unbound types",l)}var p=(s=s[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),u&&s.ea.$a.push(e);var v=s.ea.oa,o=v[e];return o===void 0||o.ha===void 0&&o.className!==s.name&&o.sa===n-2?(h.sa=n-2,h.className=s.name,v[e]=h):(Fr(v,e,p),v[e].ha[n-2]=h),$([],l,function(d){return d=gr(p,d,s,i,f),v[e].ha===void 0?(d.sa=n-2,v[e]=d):v[e].ha[n-2]=d,[]}),[]})},c:function(r,e,n,t,a,i,f,u,l,s){e=b(e),a=T(t,a),$([],[r],function(h){var p=(h=h[0]).name+"."+e,v={get:function(){B("Cannot access "+p+" due to unbound types",[n,f])},enumerable:!0,configurable:!0};return v.set=l?()=>{B("Cannot access "+p+" due to unbound types",[n,f])}:()=>{m(p+" is a read-only property")},Object.defineProperty(h.ea.oa,e,v),$([],l?[n,f]:[n],function(o){var d=o[0],g={get:function(){var C=pe(this,h,p+" getter");return d.fromWireType(a(i,C))},enumerable:!0};if(l){l=T(u,l);var A=o[1];g.set=function(C){var I=pe(this,h,p+" setter"),or=[];l(s,I,A.toWireType(or,C)),fr(or)}}return Object.defineProperty(h.ea.oa,e,g),[]}),[]})},R:function(r,e){k(r,{name:e=b(e),fromWireType:function(n){var t=P(n);return Rr(n),t},toWireType:function(n,t){return O(t)},argPackAdvance:8,readValueFromPointer:Q,ja:null})},s:function(r,e,n,t){function a(){}n=er(n),e=b(e),a.values={},k(r,{name:e,constructor:a,fromWireType:function(i){return this.constructor.values[i]},toWireType:function(i,f){return f.value},argPackAdvance:8,readValueFromPointer:xe(e,n,t),ja:null}),Dr(e,a)},e:function(r,e,n){var t=ir(r,"enum");e=b(e),r=t.constructor,t=Object.create(t.constructor.prototype,{value:{value:n},constructor:{value:Wr(t.name+"_"+e,function(){})}}),r.values[n]=t,r[e]=t},D:function(r,e,n){n=er(n),k(r,{name:e=b(e),fromWireType:function(t){return t},toWireType:function(t,a){return a},argPackAdvance:8,readValueFromPointer:Ie(e,n),ja:null})},V:function(r,e,n,t,a,i){var f=mr(e,n);r=b(r),a=T(t,a),Dr(r,function(){B("Cannot call "+r+" due to unbound types",f)},e-1),$([],f,function(u){return le(r,gr(r,[u[0],null].concat(u.slice(1)),null,a,i),e-1),[]})},w:function(r,e,n,t,a){e=b(e),a===-1&&(a=4294967295),a=er(n);var i=u=>u;if(t===0){var f=32-8*n;i=u=>u<>>f}n=e.includes("unsigned")?function(u,l){return l>>>0}:function(u,l){return l},k(r,{name:e,fromWireType:i,toWireType:n,argPackAdvance:8,readValueFromPointer:oe(e,a,t!==0),ja:null})},q:function(r,e,n){function t(i){var f=y;return new a($r,f[1+(i>>=2)],f[i])}var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][e];k(r,{name:n=b(n),fromWireType:t,argPackAdvance:8,readValueFromPointer:t},{Wa:!0})},h:function(r,e,n,t,a,i,f,u,l,s,h,p){n=b(n),i=T(a,i),u=T(f,u),s=T(l,s),p=T(h,p),$([r],[e],function(v){return v=v[0],[new j(n,v.ea,!1,!1,!0,v,t,i,u,s,p)]})},F:function(r,e){var n=(e=b(e))==="std::string";k(r,{name:e,fromWireType:function(t){var a=y[t>>2],i=t+4;if(n)for(var f=i,u=0;u<=a;++u){var l=i+u;if(u==a||_[l]==0){if(f=f?ur(_,f,l-f):"",s===void 0)var s=f;else s+="\0",s+=f;f=l+1}}else{for(s=Array(a),u=0;u>2]=f,n&&i)Lr(a,_,l,f+1);else if(i)for(i=0;iX,u=1;else e===4&&(t=Be,a=ze,i=qe,f=()=>y,u=2);k(r,{name:n,fromWireType:function(l){for(var s,h=y[l>>2],p=f(),v=l+4,o=0;o<=h;++o){var d=l+4+o*e;o!=h&&p[d>>u]!=0||(v=t(v,d-v),s===void 0?s=v:(s+="\0",s+=v),v=d+e)}return M(l),s},toWireType:function(l,s){typeof s!="string"&&m("Cannot pass non-string to C++ string type "+n);var h=i(s),p=_r(4+h+e);return y[p>>2]=h>>u,a(s,p+4,h+e),l!==null&&l.push(M,p),p},argPackAdvance:8,readValueFromPointer:Q,ja:function(l){M(l)}})},v:function(r,e,n,t,a,i){cr[r]={name:b(e),Ba:T(n,t),na:T(a,i),Fa:[]}},l:function(r,e,n,t,a,i,f,u,l,s){cr[r].Fa.push({Na:b(e),Ta:n,Ra:T(t,a),Sa:i,cb:f,bb:T(u,l),eb:s})},T:function(r,e){k(r,{Xa:!0,name:e=b(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},k:function(r,e,n){r=P(r),e=ir(e,"emval::as");var t=[],a=O(t);return y[n>>2]=a,e.toWireType(t,r)},z:function(r,e){return r=P(r),(e=ir(e,"emval::as")).toWireType(null,r)},W:function(r,e,n,t){r=P(r),n=ge(e,n);for(var a=Array(e),i=0;i>2]=O(i),r(e,n,i,a)},G:function(r,e,n,t){(r=br[r])(e=P(e),n=yr(n),null,t)},a:Rr,H:function(r){return r===0?O(me()):(r=yr(r),O(me()[r]))},B:function(r,e){var n=ge(r,e),t=n[0];e=t.name+"_$"+n.slice(1).map(function(f){return f.name}).join("_")+"$";var a=ye[e];if(a!==void 0)return a;var i=Array(r-1);return a=Le((f,u,l,s)=>{for(var h=0,p=0;p>>=0))return!1;for(var n=1;4>=n;n*=2){var t=e*(1+.2/n);t=Math.min(t,r+100663296);var a=Math;t=Math.max(r,t),a=a.min.call(a,2147483648,t+(65536-t%65536)%65536);r:{try{Cr.grow(a-$r.byteLength+65535>>>16),Jr();var i=1;break r}catch{}i=void 0}if(i)return!0}return!1},K:function(r,e){var n=0;return be().forEach(function(t,a){var i=e+n;for(a=y[r+4*a>>2]=i,i=0;i>0]=t.charCodeAt(i);F[a>>0]=0,n+=t.length+1}),0},L:function(r,e){var n=be();y[r>>2]=n.length;var t=0;return n.forEach(function(a){t+=a.length+1}),y[e>>2]=t,0},Q:function(){return 52},P:function(){return 70},O:function(r,e,n,t){for(var a=0,i=0;i>2],u=y[e+4>>2];e+=8;for(var l=0;l>2]=a,0},J:function(r,e,n,t){return Xe(r,e,n,t)}};(function(){function r(a){c.asm=a.exports,Cr=c.asm.X,Jr(),Xr=c.asm.ba,Kr.unshift(c.asm.Y),H--,c.monitorRunDependencies&&c.monitorRunDependencies(H),H==0&&Z&&(a=Z,Z=null,a())}function e(a){r(a.instance)}function n(a){return je().then(function(i){return WebAssembly.instantiate(i,t)}).then(function(i){return i}).then(a,function(i){N("failed to asynchronously prepare wasm: "+i),K(i)})}var t={a:Ze};if(H++,c.monitorRunDependencies&&c.monitorRunDependencies(H),c.instantiateWasm)try{return c.instantiateWasm(t,r)}catch(a){N("Module.instantiateWasm callback failed with error: "+a),E(a)}(J||typeof WebAssembly.instantiateStreaming!="function"||re()||typeof fetch!="function"?n(e):fetch(D,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,t).then(e,function(i){return N("wasm streaming compile failed: "+i),N("falling back to ArrayBuffer instantiation"),n(e)})})).catch(E)})(),c.___wasm_call_ctors=function(){return(c.___wasm_call_ctors=c.asm.Y).apply(null,arguments)};var Tr,_r=c._malloc=function(){return(_r=c._malloc=c.asm.Z).apply(null,arguments)},M=c._free=function(){return(M=c._free=c.asm._).apply(null,arguments)},_e=c.___getTypeName=function(){return(_e=c.___getTypeName=c.asm.$).apply(null,arguments)};function Pe(){function r(){if(!Tr&&(Tr=!0,c.calledRun=!0,!qr)){if(kr(Kr),z(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;){var e=c.postRun.shift();Qr.unshift(e)}kr(Qr)}}if(!(0import("./index-J0iiHjMT.js").then(n=>n.zF),__vite__mapDeps([0,1]))).default({title:e.parsedUrl.title});return await _(l,e,t),l}function O(r,s){return r?r.find(e=>e.id===s):null}async function _(r,s,e){function t(a,n,u,i){const c={...e,layerId:n,sublayerTitleMode:"service-name"};return a!=null&&(c.url=a),u!=null&&(c.sourceJSON=u),i(c)}const l=s.sublayerConstructorProvider;for(const{id:a,serverUrl:n}of s.layers){const u=O(s.sublayerInfos,a),i=(u&&(l==null?void 0:l(u)))??s.Constructor,c=t(n,a,u,d=>new i(d));r.add(c)}if(s.tables.length){const a=await p("FeatureLayer");s.tables.forEach(({id:n,serverUrl:u})=>{const i=t(u,n,O(s.tableInfos,n),c=>new a(c));r.tables.add(i)})}}async function x(r,s){var d,v,w,S,b,h,I;let e=F(r);if(e==null&&(e=await $(r,s)),e==null)throw new T("arcgis-layers:url-mismatch","The url '${url}' is not a valid arcgis resource",{url:r});const{serverType:t,sublayer:l}=e;let a;const n={FeatureServer:"FeatureLayer",StreamServer:"StreamLayer",VectorTileServer:"VectorTileLayer"},u=t==="FeatureServer",i=t==="SceneServer",c={parsedUrl:e,Constructor:null,layerId:u||i?l??void 0:void 0,layers:[],tables:[]};switch(t){case"MapServer":l!=null?a="FeatureLayer":a=await z(r,s)?"TileLayer":"MapImageLayer";break;case"ImageServer":{const o=await f(r,{customParameters:s}),{tileInfo:y,cacheType:m}=o;a=y?((d=y==null?void 0:y.format)==null?void 0:d.toUpperCase())!=="LERC"||m&&m.toLowerCase()!=="elevation"?"ImageryTileLayer":"ElevationLayer":"ImageryLayer";break}case"SceneServer":{const o=await f(e.url.path,{customParameters:s});if(a="SceneLayer",o){const y=o==null?void 0:o.layers;if((o==null?void 0:o.layerType)==="Voxel")a="VoxelLayer";else if(y!=null&&y.length){const m=(v=y[0])==null?void 0:v.layerType;m!=null&&L[m]!=null&&(a=L[m])}}break}case"FeatureServer":if(a="FeatureLayer",l!=null){const o=await f(r,{customParameters:s});c.sourceJSON=o,o.type==="Oriented Imagery Layer"&&(a="OrientedImageryLayer")}break;default:a=n[t]}if(k[a]&&l==null){const o=await M(r,t,s);if(u&&(c.sublayerInfos=o.layerInfos,c.tableInfos=o.tableInfos),o.layers.length+o.tables.length!==1)c.layers=o.layers,c.tables=o.tables,u&&((w=o.layerInfos)!=null&&w.length)&&(c.sublayerConstructorProvider=await j(o.layerInfos));else if(u||i){const y=((S=o.layerInfos)==null?void 0:S[0])??((b=o.tableInfos)==null?void 0:b[0]);c.layerId=((h=o.layers[0])==null?void 0:h.id)??((I=o.tables[0])==null?void 0:I.id),c.sourceJSON=y,u&&(y==null?void 0:y.type)==="Oriented Imagery Layer"&&(a="OrientedImageryLayer")}}return c.Constructor=await p(a),c}async function $(r,s){var u;const e=await f(r,{customParameters:s});let t=null,l=null;const a=e.type;if(a==="Feature Layer"||a==="Table"?(t="FeatureServer",l=e.id??null):a==="indexedVector"?t="VectorTileServer":e.hasOwnProperty("mapName")?t="MapServer":e.hasOwnProperty("bandCount")&&e.hasOwnProperty("pixelSizeX")?t="ImageServer":e.hasOwnProperty("maxRecordCount")&&e.hasOwnProperty("allowGeometryUpdates")?t="FeatureServer":e.hasOwnProperty("streamUrls")?t="StreamServer":P(e)?(t="SceneServer",l=e.id):e.hasOwnProperty("layers")&&P((u=e.layers)==null?void 0:u[0])&&(t="SceneServer"),!t)return null;const n=l!=null?U(r):null;return{title:n!=null&&e.name||C(r),serverType:t,sublayer:l,url:{path:n!=null?n.serviceUrl:N(r).path}}}function P(r){return r!=null&&r.hasOwnProperty("store")&&r.hasOwnProperty("id")&&typeof r.id=="number"}async function M(r,s,e){let t,l,a=!1;switch(s){case"FeatureServer":{const i=await V(r,{customParameters:e});a=!!i.layersJSON,t=i.layersJSON||i.serviceJSON;break}case"SceneServer":{const i=await R(r,e);t=i.serviceInfo,l=i.tableServerUrl;break}default:t=await f(r,{customParameters:e})}const n=t==null?void 0:t.layers,u=t==null?void 0:t.tables;return{layers:(n==null?void 0:n.map(i=>({id:i.id})).reverse())||[],tables:(u==null?void 0:u.map(i=>({serverUrl:l,id:i.id})).reverse())||[],layerInfos:a?n:[],tableInfos:a?u:[]}}async function R(r,s){var l;const e=await f(r,{customParameters:s});if(!((l=e.layers)==null?void 0:l[0]))return{serviceInfo:e};try{const{serverUrl:a}=await J(r),n=await f(a,{customParameters:s}).catch(()=>null);return n&&(e.tables=n.tables),{serviceInfo:e,tableServerUrl:a}}catch{return{serviceInfo:e}}}async function p(r){return(0,E[r])()}async function z(r,s){return(await f(r,{customParameters:s})).tileInfo}async function j(r){const s=[],e=[];if(r.forEach(a=>{const{type:n}=a;n==="Oriented Imagery Layer"?(s.push(n),e.push(p("OrientedImageryLayer"))):(s.push(n),e.push(p("FeatureLayer")))}),!e.length)return;const t=await Promise.all(e),l=new Map;return s.forEach((a,n)=>{l.set(a,t[n])}),a=>l.get(a.type)}export{X as fromUrl}; +import{de as g,df as T,r as F,dg as U,dh as C,au as N,di as J,dj as k,dk as L}from"./index-pCX-0tJH.js";import{t as E}from"./fetchService-cGWNcQnc.js";import{t as f}from"./requestPresets-f6ZAWLqV.js";const V={FeatureLayer:!0,SceneLayer:!0};async function X(r){var a;const s=(a=r.properties)==null?void 0:a.customParameters,e=await x(r.url,s),t={...r.properties,url:r.url};if(e.layers.length+e.tables.length===0)return e.layerId!=null&&(t.layerId=e.layerId),e.sourceJSON!=null&&(t.sourceJSON=e.sourceJSON),new e.Constructor(t);const l=new(await g(()=>import("./index-pCX-0tJH.js").then(n=>n.zY),__vite__mapDeps([0,1]))).default({title:e.parsedUrl.title});return await _(l,e,t),l}function O(r,s){return r?r.find(e=>e.id===s):null}async function _(r,s,e){function t(a,n,u,i){const c={...e,layerId:n,sublayerTitleMode:"service-name"};return a!=null&&(c.url=a),u!=null&&(c.sourceJSON=u),i(c)}const l=s.sublayerConstructorProvider;for(const{id:a,serverUrl:n}of s.layers){const u=O(s.sublayerInfos,a),i=(u&&(l==null?void 0:l(u)))??s.Constructor,c=t(n,a,u,d=>new i(d));r.add(c)}if(s.tables.length){const a=await p("FeatureLayer");s.tables.forEach(({id:n,serverUrl:u})=>{const i=t(u,n,O(s.tableInfos,n),c=>new a(c));r.tables.add(i)})}}async function x(r,s){var d,v,w,S,b,h,I;let e=T(r);if(e==null&&(e=await $(r,s)),e==null)throw new F("arcgis-layers:url-mismatch","The url '${url}' is not a valid arcgis resource",{url:r});const{serverType:t,sublayer:l}=e;let a;const n={FeatureServer:"FeatureLayer",StreamServer:"StreamLayer",VectorTileServer:"VectorTileLayer"},u=t==="FeatureServer",i=t==="SceneServer",c={parsedUrl:e,Constructor:null,layerId:u||i?l??void 0:void 0,layers:[],tables:[]};switch(t){case"MapServer":l!=null?a="FeatureLayer":a=await z(r,s)?"TileLayer":"MapImageLayer";break;case"ImageServer":{const o=await f(r,{customParameters:s}),{tileInfo:y,cacheType:m}=o;a=y?((d=y==null?void 0:y.format)==null?void 0:d.toUpperCase())!=="LERC"||m&&m.toLowerCase()!=="elevation"?"ImageryTileLayer":"ElevationLayer":"ImageryLayer";break}case"SceneServer":{const o=await f(e.url.path,{customParameters:s});if(a="SceneLayer",o){const y=o==null?void 0:o.layers;if((o==null?void 0:o.layerType)==="Voxel")a="VoxelLayer";else if(y!=null&&y.length){const m=(v=y[0])==null?void 0:v.layerType;m!=null&&L[m]!=null&&(a=L[m])}}break}case"FeatureServer":if(a="FeatureLayer",l!=null){const o=await f(r,{customParameters:s});c.sourceJSON=o,o.type==="Oriented Imagery Layer"&&(a="OrientedImageryLayer")}break;default:a=n[t]}if(V[a]&&l==null){const o=await M(r,t,s);if(u&&(c.sublayerInfos=o.layerInfos,c.tableInfos=o.tableInfos),o.layers.length+o.tables.length!==1)c.layers=o.layers,c.tables=o.tables,u&&((w=o.layerInfos)!=null&&w.length)&&(c.sublayerConstructorProvider=await j(o.layerInfos));else if(u||i){const y=((S=o.layerInfos)==null?void 0:S[0])??((b=o.tableInfos)==null?void 0:b[0]);c.layerId=((h=o.layers[0])==null?void 0:h.id)??((I=o.tables[0])==null?void 0:I.id),c.sourceJSON=y,u&&(y==null?void 0:y.type)==="Oriented Imagery Layer"&&(a="OrientedImageryLayer")}}return c.Constructor=await p(a),c}async function $(r,s){var u;const e=await f(r,{customParameters:s});let t=null,l=null;const a=e.type;if(a==="Feature Layer"||a==="Table"?(t="FeatureServer",l=e.id??null):a==="indexedVector"?t="VectorTileServer":e.hasOwnProperty("mapName")?t="MapServer":e.hasOwnProperty("bandCount")&&e.hasOwnProperty("pixelSizeX")?t="ImageServer":e.hasOwnProperty("maxRecordCount")&&e.hasOwnProperty("allowGeometryUpdates")?t="FeatureServer":e.hasOwnProperty("streamUrls")?t="StreamServer":P(e)?(t="SceneServer",l=e.id):e.hasOwnProperty("layers")&&P((u=e.layers)==null?void 0:u[0])&&(t="SceneServer"),!t)return null;const n=l!=null?U(r):null;return{title:n!=null&&e.name||C(r),serverType:t,sublayer:l,url:{path:n!=null?n.serviceUrl:N(r).path}}}function P(r){return r!=null&&r.hasOwnProperty("store")&&r.hasOwnProperty("id")&&typeof r.id=="number"}async function M(r,s,e){let t,l,a=!1;switch(s){case"FeatureServer":{const i=await E(r,{customParameters:e});a=!!i.layersJSON,t=i.layersJSON||i.serviceJSON;break}case"SceneServer":{const i=await R(r,e);t=i.serviceInfo,l=i.tableServerUrl;break}default:t=await f(r,{customParameters:e})}const n=t==null?void 0:t.layers,u=t==null?void 0:t.tables;return{layers:(n==null?void 0:n.map(i=>({id:i.id})).reverse())||[],tables:(u==null?void 0:u.map(i=>({serverUrl:l,id:i.id})).reverse())||[],layerInfos:a?n:[],tableInfos:a?u:[]}}async function R(r,s){var l;const e=await f(r,{customParameters:s});if(!((l=e.layers)==null?void 0:l[0]))return{serviceInfo:e};try{const{serverUrl:a}=await J(r),n=await f(a,{customParameters:s}).catch(()=>null);return n&&(e.tables=n.tables),{serviceInfo:e,tableServerUrl:a}}catch{return{serviceInfo:e}}}async function p(r){return(0,k[r])()}async function z(r,s){return(await f(r,{customParameters:s})).tileInfo}async function j(r){const s=[],e=[];if(r.forEach(a=>{const{type:n}=a;n==="Oriented Imagery Layer"?(s.push(n),e.push(p("OrientedImageryLayer"))):(s.push(n),e.push(p("FeatureLayer")))}),!e.length)return;const t=await Promise.all(e),l=new Map;return s.forEach((a,n)=>{l.set(a,t[n])}),a=>l.get(a.type)}export{X as fromUrl}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css"] + __vite__mapDeps.viteFileDeps = ["assets/index-pCX-0tJH.js","assets/index-4b4radwv.css"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/automaticAreaMeasurementUtils-kRuWnHc-.js b/dist/assets/automaticAreaMeasurementUtils-kRuWnHc-.js new file mode 100644 index 0000000..9519a6e --- /dev/null +++ b/dist/assets/automaticAreaMeasurementUtils-kRuWnHc-.js @@ -0,0 +1 @@ +import{h,g,k as i}from"./euclideanAreaMeasurementUtils-jpli3_gk.js";import{kE as q,bz as $,a8 as k,cK as o,kF as l,d9 as b,d2 as d}from"./index-pCX-0tJH.js";import{r as y}from"./Tooltip-a9KqLK1p.js";function M({hasZ:r,spatialReference:n,rings:e},s,u=0){const a=q(n);if(a==null)return!1;const m=r?t=>t:t=>$(R,t[0],t[1],u);for(const t of e){const c=[];for(const p of t){const f=[0,0,u];a(m(p),0,f,0),c.push(f)}s.push(c)}return!0}const R=k();function G(r){const{spatialReference:n}=r;return y(n,w,x,z,r)}function w(r){return o(Math.abs(l([r],"square-meters")[0]),"square-meters")}function x(r){try{return o(Math.abs(b(r,"square-meters")),"square-meters")}catch{return null}}function z(r){const n=[];return M(r,n)?o(Math.abs(l([{type:"polygon",rings:n,spatialReference:d.WGS84}],"square-meters")[0]),"square-meters"):null}function E(r,n,e=i()){if(n==="on-the-ground"){const s=G(r);return s??h(r,e)}return g(r,e)}function W(r,n=i()){return E(r,"on-the-ground",n)}export{E as o,W as u}; diff --git a/dist/assets/automaticAreaMeasurementUtils-nVd6Y5mX.js b/dist/assets/automaticAreaMeasurementUtils-nVd6Y5mX.js deleted file mode 100644 index a6dcfd7..0000000 --- a/dist/assets/automaticAreaMeasurementUtils-nVd6Y5mX.js +++ /dev/null @@ -1 +0,0 @@ -import{h,g,k as i}from"./euclideanAreaMeasurementUtils-zmzttSyV.js";import{kQ as q,as as $,aa as k,cT as o,kH as l,aD as b,ar as y}from"./index-J0iiHjMT.js";import{r as M}from"./Tooltip-ON77BKb3.js";function R({hasZ:r,spatialReference:n,rings:s},e,a=0){const u=q(n);if(u==null)return!1;const m=r?t=>t:t=>$(d,t[0],t[1],a);for(const t of s){const c=[];for(const p of t){const f=[0,0,a];u(m(p),0,f,0),c.push(f)}e.push(c)}return!0}const d=k();function G(r){const{spatialReference:n}=r;return M(n,w,x,D,r)}function w(r){return o(Math.abs(l([r],"square-meters")[0]),"square-meters")}function x(r){try{return o(Math.abs(b(r,"square-meters")),"square-meters")}catch{return null}}function D(r){const n=[];return R(r,n)?o(Math.abs(l([{type:"polygon",rings:n,spatialReference:y.WGS84}],"square-meters")[0]),"square-meters"):null}function H(r,n,s=i()){if(n==="on-the-ground"){const e=G(r);return e??h(r,s)}return g(r,s)}function W(r,n=i()){return H(r,"on-the-ground",n)}export{H as o,W as u}; diff --git a/dist/assets/basis_transcoder-FsrOzl2Q.js b/dist/assets/basis_transcoder-5u4h2z6s.js similarity index 99% rename from dist/assets/basis_transcoder-FsrOzl2Q.js rename to dist/assets/basis_transcoder-5u4h2z6s.js index 8f03c0b..8eef00e 100644 --- a/dist/assets/basis_transcoder-FsrOzl2Q.js +++ b/dist/assets/basis_transcoder-5u4h2z6s.js @@ -1,2 +1,2 @@ -import{cg as Sn,g_ as ze}from"./index-J0iiHjMT.js";function On(k,Y){for(var H=0;Hn[C]})}}}return Object.freeze(Object.defineProperty(k,Symbol.toStringTag,{value:"Module"}))}var Ar,se,Wr,_e={exports:{}};_e.exports,Ar=_e,_e.exports,se=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(se=se||__filename),Wr=function(k){var Y,H,n=(k=k||{})!==void 0?k:{};n.ready=new Promise(function(e,r){Y=e,H=r});var C,E={};for(C in n)n.hasOwnProperty(C)&&(E[C]=n[C]);var le=!1,I=!1,Pe=!1,qe=!1;le=typeof window=="object",I=typeof importScripts=="function",Pe=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",qe=!le&&!Pe&&!I;var ce,Z,Ae,We,T="";function Sr(e){return n.locateFile?n.locateFile(e,T):T+e}Pe?(T=I?require("path").dirname(T)+"/":__dirname+"/",ce=function(e,r){return Ae||(Ae=require("fs")),We||(We=require("path")),e=We.normalize(e),Ae.readFileSync(e,r?null:"utf8")},Z=function(e){var r=ce(e,!0);return r.buffer||(r=new Uint8Array(r)),Ee(r.buffer),r},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof Wn))throw e}),process.on("unhandledRejection",B),n.inspect=function(){return"[Emscripten Module object]"}):qe?(typeof read<"u"&&(ce=function(e){return read(e)}),Z=function(e){var r;return typeof readbuffer=="function"?new Uint8Array(readbuffer(e)):(Ee(typeof(r=read(e,"binary"))=="object"),r)},typeof scriptArgs<"u"&&scriptArgs,typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(le||I)&&(I?T=self.location.href:document.currentScript&&(T=document.currentScript.src),se&&(T=se),T=T.indexOf("blob:")!==0?T.substr(0,T.lastIndexOf("/")+1):"",ce=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},I&&(Z=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}));var K,Q,Or=n.print||console.log.bind(console),z=n.printErr||console.warn.bind(console);for(C in E)E.hasOwnProperty(C)&&(n[C]=E[C]);E=null,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.quit&&n.quit,n.wasmBinary&&(K=n.wasmBinary),n.noExitRuntime&&n.noExitRuntime,typeof WebAssembly!="object"&&B("no native wasm support detected");var jr=new WebAssembly.Table({initial:157,maximum:157,element:"anyfunc"}),Be=!1;function Ee(e,r){e||B("Assertion failed: "+r)}var Ne=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Ge(e,r,t){for(var i=r+t,o=r;e[o]&&!(o>=i);)++o;if(o-r>16&&e.subarray&&Ne)return Ne.decode(e.subarray(r,o));for(var a="";r>10,56320|1023&c)}}else a+=String.fromCharCode((31&s)<<6|u)}else a+=String.fromCharCode(s)}return a}function Le(e,r){return e?Ge(b,e,r):""}function kr(e,r,t,i){if(!(i>0))return 0;for(var o=t,a=t+i-1,s=0;s=55296&&u<=57343&&(u=65536+((1023&u)<<10)|1023&e.charCodeAt(++s)),u<=127){if(t>=a)break;r[t++]=u}else if(u<=2047){if(t+1>=a)break;r[t++]=192|u>>6,r[t++]=128|63&u}else if(u<=65535){if(t+2>=a)break;r[t++]=224|u>>12,r[t++]=128|u>>6&63,r[t++]=128|63&u}else{if(t+3>=a)break;r[t++]=240|u>>18,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|63&u}}return r[t]=0,t-o}function Fr(e,r,t){return kr(e,b,r,t)}function Rr(e){for(var r=0,t=0;t=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++t)),i<=127?++r:r+=i<=2047?2:i<=65535?3:4}return r}var Xe=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function xr(e,r){for(var t=e,i=t>>1,o=i+r/2;!(i>=o)&&ee[i];)++i;if((t=i<<1)-e>32&&Xe)return Xe.decode(b.subarray(e,t));for(var a=0,s="";;){var u=U[e+2*a>>1];if(u==0||a==r/2)return s;++a,s+=String.fromCharCode(u)}}function Dr(e,r,t){if(t===void 0&&(t=2147483647),t<2)return 0;for(var i=r,o=(t-=2)<2*e.length?t/2:e.length,a=0;a>1]=s,r+=2}return U[r>>1]=0,r-i}function Ir(e){return 2*e.length}function Ur(e,r){for(var t=0,i="";!(t>=r/4);){var o=g[e+4*t>>2];if(o==0)break;if(++t,o>=65536){var a=o-65536;i+=String.fromCharCode(55296|a>>10,56320|1023&a)}else i+=String.fromCharCode(o)}return i}function Mr(e,r,t){if(t===void 0&&(t=2147483647),t<4)return 0;for(var i=r,o=i+t-4,a=0;a=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),g[r>>2]=s,(r+=4)+4>o)break}return g[r>>2]=0,r-i}function Vr(e){for(var r=0,t=0;t=55296&&i<=57343&&++t,r+=4}return r}var q,fe,b,U,ee,g,P,Je,Ye,Ze=65536;function Hr(e,r){return e%r>0&&(e+=r-e%r),e}function Ke(e){q=e,n.HEAP8=fe=new Int8Array(e),n.HEAP16=U=new Int16Array(e),n.HEAP32=g=new Int32Array(e),n.HEAPU8=b=new Uint8Array(e),n.HEAPU16=ee=new Uint16Array(e),n.HEAPU32=P=new Uint32Array(e),n.HEAPF32=Je=new Float32Array(e),n.HEAPF64=Ye=new Float64Array(e)}var zr=5565536,qr=322496,Qe=n.INITIAL_MEMORY||16777216;function pe(e){for(;e.length>0;){var r=e.shift();if(typeof r!="function"){var t=r.func;typeof t=="number"?r.arg===void 0?n.dynCall_v(t):n.dynCall_vi(t,r.arg):t(r.arg===void 0?null:r.arg)}else r(n)}}(Q=n.wasmMemory?n.wasmMemory:new WebAssembly.Memory({initial:Qe/Ze,maximum:2147483648/Ze}))&&(q=Q.buffer),Qe=q.byteLength,Ke(q),g[qr>>2]=zr;var er=[],rr=[],Br=[],tr=[];function Nr(){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)Jr(n.preRun.shift());pe(er)}function Gr(){pe(rr)}function Lr(){pe(Br)}function Xr(){if(n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;)Yr(n.postRun.shift());pe(tr)}function Jr(e){er.unshift(e)}function Yr(e){tr.unshift(e)}var Zr=Math.ceil,Kr=Math.floor,M=0,re=null;function Qr(e){M++,n.monitorRunDependencies&&n.monitorRunDependencies(M)}function et(e){if(M--,n.monitorRunDependencies&&n.monitorRunDependencies(M),M==0&&re){var r=re;re=null,r()}}function B(e){n.onAbort&&n.onAbort(e),z(e+=""),Be=!0,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var r=new WebAssembly.RuntimeError(e);throw H(r),r}function nr(e,r){return String.prototype.startsWith?e.startsWith(r):e.indexOf(r)===0}n.preloadedImages={},n.preloadedAudios={};var rt="data:application/octet-stream;base64,";function ir(e){return nr(e,rt)}var tt="file://";function or(e){return nr(e,tt)}var A="basis_transcoder.wasm";function ar(){try{if(K)return new Uint8Array(K);if(Z)return Z(A);throw"both async and sync fetching of the wasm failed"}catch(e){B(e)}}function nt(){return K||!le&&!I||typeof fetch!="function"||or(A)?new Promise(function(e,r){e(ar())}):fetch(A,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+A+"'";return e.arrayBuffer()}).catch(function(){return ar()})}function it(){var e={a:An};function r(a,s){var u=a.exports;n.asm=u,et()}function t(a){r(a.instance)}function i(a){return nt().then(function(s){return WebAssembly.instantiate(s,e)}).then(a,function(s){z("failed to asynchronously prepare wasm: "+s),B(s)})}function o(){if(K||typeof WebAssembly.instantiateStreaming!="function"||ir(A)||or(A)||typeof fetch!="function")return i(t);fetch(A,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,e).then(t,function(s){return z("wasm streaming compile failed: "+s),z("falling back to ArrayBuffer instantiation"),i(t)})})}if(Qr(),n.instantiateWasm)try{return n.instantiateWasm(e,r)}catch(a){return z("Module.instantiateWasm callback failed with error: "+a),!1}return o(),{}}ir(A)||(A=Sr(A)),rr.push({func:function(){Cr()}});var de={};function ye(e){for(;e.length;){var r=e.pop();e.pop()(r)}}function te(e){return this.fromWireType(P[e>>2])}var N={},V={},me={},ot=48,at=57;function ur(e){if(e===void 0)return"_unknown";var r=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return r>=ot&&r<=at?"_"+e:e}function Se(e,r){return e=ur(e),function(){return r.apply(this,arguments)}}function Oe(e,r){var t=Se(r,function(i){this.name=r,this.message=i;var o=new Error(i).stack;o!==void 0&&(this.stack=this.toString()+` +import{aR as Sn,gX as ze}from"./index-pCX-0tJH.js";function On(k,Y){for(var H=0;Hn[C]})}}}return Object.freeze(Object.defineProperty(k,Symbol.toStringTag,{value:"Module"}))}var Ar,se,Wr,_e={exports:{}};_e.exports,Ar=_e,_e.exports,se=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(se=se||__filename),Wr=function(k){var Y,H,n=(k=k||{})!==void 0?k:{};n.ready=new Promise(function(e,r){Y=e,H=r});var C,E={};for(C in n)n.hasOwnProperty(C)&&(E[C]=n[C]);var le=!1,I=!1,Pe=!1,qe=!1;le=typeof window=="object",I=typeof importScripts=="function",Pe=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",qe=!le&&!Pe&&!I;var ce,Z,Ae,We,T="";function Sr(e){return n.locateFile?n.locateFile(e,T):T+e}Pe?(T=I?require("path").dirname(T)+"/":__dirname+"/",ce=function(e,r){return Ae||(Ae=require("fs")),We||(We=require("path")),e=We.normalize(e),Ae.readFileSync(e,r?null:"utf8")},Z=function(e){var r=ce(e,!0);return r.buffer||(r=new Uint8Array(r)),Ee(r.buffer),r},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof Wn))throw e}),process.on("unhandledRejection",B),n.inspect=function(){return"[Emscripten Module object]"}):qe?(typeof read<"u"&&(ce=function(e){return read(e)}),Z=function(e){var r;return typeof readbuffer=="function"?new Uint8Array(readbuffer(e)):(Ee(typeof(r=read(e,"binary"))=="object"),r)},typeof scriptArgs<"u"&&scriptArgs,typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(le||I)&&(I?T=self.location.href:document.currentScript&&(T=document.currentScript.src),se&&(T=se),T=T.indexOf("blob:")!==0?T.substr(0,T.lastIndexOf("/")+1):"",ce=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},I&&(Z=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}));var K,Q,Or=n.print||console.log.bind(console),z=n.printErr||console.warn.bind(console);for(C in E)E.hasOwnProperty(C)&&(n[C]=E[C]);E=null,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.quit&&n.quit,n.wasmBinary&&(K=n.wasmBinary),n.noExitRuntime&&n.noExitRuntime,typeof WebAssembly!="object"&&B("no native wasm support detected");var jr=new WebAssembly.Table({initial:157,maximum:157,element:"anyfunc"}),Be=!1;function Ee(e,r){e||B("Assertion failed: "+r)}var Ne=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Ge(e,r,t){for(var i=r+t,o=r;e[o]&&!(o>=i);)++o;if(o-r>16&&e.subarray&&Ne)return Ne.decode(e.subarray(r,o));for(var a="";r>10,56320|1023&c)}}else a+=String.fromCharCode((31&s)<<6|u)}else a+=String.fromCharCode(s)}return a}function Le(e,r){return e?Ge(b,e,r):""}function kr(e,r,t,i){if(!(i>0))return 0;for(var o=t,a=t+i-1,s=0;s=55296&&u<=57343&&(u=65536+((1023&u)<<10)|1023&e.charCodeAt(++s)),u<=127){if(t>=a)break;r[t++]=u}else if(u<=2047){if(t+1>=a)break;r[t++]=192|u>>6,r[t++]=128|63&u}else if(u<=65535){if(t+2>=a)break;r[t++]=224|u>>12,r[t++]=128|u>>6&63,r[t++]=128|63&u}else{if(t+3>=a)break;r[t++]=240|u>>18,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|63&u}}return r[t]=0,t-o}function Fr(e,r,t){return kr(e,b,r,t)}function Rr(e){for(var r=0,t=0;t=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++t)),i<=127?++r:r+=i<=2047?2:i<=65535?3:4}return r}var Xe=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function xr(e,r){for(var t=e,i=t>>1,o=i+r/2;!(i>=o)&&ee[i];)++i;if((t=i<<1)-e>32&&Xe)return Xe.decode(b.subarray(e,t));for(var a=0,s="";;){var u=U[e+2*a>>1];if(u==0||a==r/2)return s;++a,s+=String.fromCharCode(u)}}function Dr(e,r,t){if(t===void 0&&(t=2147483647),t<2)return 0;for(var i=r,o=(t-=2)<2*e.length?t/2:e.length,a=0;a>1]=s,r+=2}return U[r>>1]=0,r-i}function Ir(e){return 2*e.length}function Ur(e,r){for(var t=0,i="";!(t>=r/4);){var o=g[e+4*t>>2];if(o==0)break;if(++t,o>=65536){var a=o-65536;i+=String.fromCharCode(55296|a>>10,56320|1023&a)}else i+=String.fromCharCode(o)}return i}function Mr(e,r,t){if(t===void 0&&(t=2147483647),t<4)return 0;for(var i=r,o=i+t-4,a=0;a=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),g[r>>2]=s,(r+=4)+4>o)break}return g[r>>2]=0,r-i}function Vr(e){for(var r=0,t=0;t=55296&&i<=57343&&++t,r+=4}return r}var q,fe,b,U,ee,g,P,Je,Ye,Ze=65536;function Hr(e,r){return e%r>0&&(e+=r-e%r),e}function Ke(e){q=e,n.HEAP8=fe=new Int8Array(e),n.HEAP16=U=new Int16Array(e),n.HEAP32=g=new Int32Array(e),n.HEAPU8=b=new Uint8Array(e),n.HEAPU16=ee=new Uint16Array(e),n.HEAPU32=P=new Uint32Array(e),n.HEAPF32=Je=new Float32Array(e),n.HEAPF64=Ye=new Float64Array(e)}var zr=5565536,qr=322496,Qe=n.INITIAL_MEMORY||16777216;function pe(e){for(;e.length>0;){var r=e.shift();if(typeof r!="function"){var t=r.func;typeof t=="number"?r.arg===void 0?n.dynCall_v(t):n.dynCall_vi(t,r.arg):t(r.arg===void 0?null:r.arg)}else r(n)}}(Q=n.wasmMemory?n.wasmMemory:new WebAssembly.Memory({initial:Qe/Ze,maximum:2147483648/Ze}))&&(q=Q.buffer),Qe=q.byteLength,Ke(q),g[qr>>2]=zr;var er=[],rr=[],Br=[],tr=[];function Nr(){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)Jr(n.preRun.shift());pe(er)}function Gr(){pe(rr)}function Lr(){pe(Br)}function Xr(){if(n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;)Yr(n.postRun.shift());pe(tr)}function Jr(e){er.unshift(e)}function Yr(e){tr.unshift(e)}var Zr=Math.ceil,Kr=Math.floor,M=0,re=null;function Qr(e){M++,n.monitorRunDependencies&&n.monitorRunDependencies(M)}function et(e){if(M--,n.monitorRunDependencies&&n.monitorRunDependencies(M),M==0&&re){var r=re;re=null,r()}}function B(e){n.onAbort&&n.onAbort(e),z(e+=""),Be=!0,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var r=new WebAssembly.RuntimeError(e);throw H(r),r}function nr(e,r){return String.prototype.startsWith?e.startsWith(r):e.indexOf(r)===0}n.preloadedImages={},n.preloadedAudios={};var rt="data:application/octet-stream;base64,";function ir(e){return nr(e,rt)}var tt="file://";function or(e){return nr(e,tt)}var A="basis_transcoder.wasm";function ar(){try{if(K)return new Uint8Array(K);if(Z)return Z(A);throw"both async and sync fetching of the wasm failed"}catch(e){B(e)}}function nt(){return K||!le&&!I||typeof fetch!="function"||or(A)?new Promise(function(e,r){e(ar())}):fetch(A,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+A+"'";return e.arrayBuffer()}).catch(function(){return ar()})}function it(){var e={a:An};function r(a,s){var u=a.exports;n.asm=u,et()}function t(a){r(a.instance)}function i(a){return nt().then(function(s){return WebAssembly.instantiate(s,e)}).then(a,function(s){z("failed to asynchronously prepare wasm: "+s),B(s)})}function o(){if(K||typeof WebAssembly.instantiateStreaming!="function"||ir(A)||or(A)||typeof fetch!="function")return i(t);fetch(A,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,e).then(t,function(s){return z("wasm streaming compile failed: "+s),z("falling back to ArrayBuffer instantiation"),i(t)})})}if(Qr(),n.instantiateWasm)try{return n.instantiateWasm(e,r)}catch(a){return z("Module.instantiateWasm callback failed with error: "+a),!1}return o(),{}}ir(A)||(A=Sr(A)),rr.push({func:function(){Cr()}});var de={};function ye(e){for(;e.length;){var r=e.pop();e.pop()(r)}}function te(e){return this.fromWireType(P[e>>2])}var N={},V={},me={},ot=48,at=57;function ur(e){if(e===void 0)return"_unknown";var r=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return r>=ot&&r<=at?"_"+e:e}function Se(e,r){return e=ur(e),function(){return r.apply(this,arguments)}}function Oe(e,r){var t=Se(r,function(i){this.name=r,this.message=i;var o=new Error(i).stack;o!==void 0&&(this.stack=this.toString()+` `+o.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},t}var sr=void 0;function he(e){throw new sr(e)}function F(e,r,t){function i(u){var l=t(u);l.length!==e.length&&he("Mismatched type converter count");for(var c=0;c>a])},destructorFunction:null})}function ct(e){if(!(this instanceof R)||!(e instanceof R))return!1;for(var r=this.$$.ptrType.registeredClass,t=this.$$.ptr,i=e.$$.ptrType.registeredClass,o=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;i.baseClass;)o=i.upcast(o),i=i.baseClass;return r===i&&t===o}function ft(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function je(e){function r(t){return t.$$.ptrType.registeredClass.name}p(r(e)+" instance already deleted")}var ke=!1;function cr(e){}function pt(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function fr(e){e.count.value-=1,e.count.value===0&&pt(e)}function ne(e){return typeof FinalizationGroup>"u"?(ne=function(r){return r},e):(ke=new FinalizationGroup(function(r){for(var t=r.next();!t.done;t=r.next()){var i=t.value;i.ptr?fr(i):console.warn("object already deleted: "+i.ptr)}}),ne=function(r){return ke.register(r,r.$$,r.$$),r},cr=function(r){ke.unregister(r.$$)},ne(e))}function dt(){if(this.$$.ptr||je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=ne(Object.create(Object.getPrototypeOf(this),{$$:{value:ft(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function yt(){this.$$.ptr||je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&p("Object already scheduled for deletion"),cr(this),fr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function mt(){return!this.$$.ptr}var ie=void 0,oe=[];function Fe(){for(;oe.length;){var e=oe.pop();e.$$.deleteScheduled=!1,e.delete()}}function ht(){return this.$$.ptr||je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&p("Object already scheduled for deletion"),oe.push(this),oe.length===1&&ie&&ie(Fe),this.$$.deleteScheduled=!0,this}function vt(){R.prototype.isAliasOf=ct,R.prototype.clone=dt,R.prototype.delete=yt,R.prototype.isDeleted=mt,R.prototype.deleteLater=ht}function R(){}var pr={};function dr(e,r,t){if(e[r].overloadTable===void 0){var i=e[r];e[r]=function(){return e[r].overloadTable.hasOwnProperty(arguments.length)||p("Function '"+t+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[r].overloadTable+")!"),e[r].overloadTable[arguments.length].apply(this,arguments)},e[r].overloadTable=[],e[r].overloadTable[i.argCount]=i}}function Re(e,r,t){n.hasOwnProperty(e)?((t===void 0||n[e].overloadTable!==void 0&&n[e].overloadTable[t]!==void 0)&&p("Cannot register public name '"+e+"' twice"),dr(n,e,e),n.hasOwnProperty(t)&&p("Cannot register multiple overloads of a function with the same number of arguments ("+t+")!"),n[e].overloadTable[t]=r):(n[e]=r,t!==void 0&&(n[e].numArguments=t))}function gt(e,r,t,i,o,a,s,u){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=i,this.baseClass=o,this.getActualType=a,this.upcast=s,this.downcast=u,this.pureVirtualFunctions=[]}function xe(e,r,t){for(;r!==t;)r.upcast||p("Expected null or instance of "+t.name+", got an instance of "+r.name),e=r.upcast(e),r=r.baseClass;return e}function bt(e,r){if(r===null)return this.isReference&&p("null is not a valid "+this.name),0;r.$$||p('Cannot pass "'+L(r)+'" as a '+this.name),r.$$.ptr||p("Cannot pass deleted object as a pointer of type "+this.name);var t=r.$$.ptrType.registeredClass;return xe(r.$$.ptr,t,this.registeredClass)}function $t(e,r){var t;if(r===null)return this.isReference&&p("null is not a valid "+this.name),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;r.$$||p('Cannot pass "'+L(r)+'" as a '+this.name),r.$$.ptr||p("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&r.$$.ptrType.isConst&&p("Cannot convert argument of type "+(r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name)+" to parameter type "+this.name);var i=r.$$.ptrType.registeredClass;if(t=xe(r.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&p("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:p("Cannot convert argument of type "+(r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var o=r.clone();t=this.rawShare(t,O(function(){o.delete()})),e!==null&&e.push(this.rawDestructor,t)}break;default:p("Unsupporting sharing policy")}return t}function Ct(e,r){if(r===null)return this.isReference&&p("null is not a valid "+this.name),0;r.$$||p('Cannot pass "'+L(r)+'" as a '+this.name),r.$$.ptr||p("Cannot pass deleted object as a pointer of type "+this.name),r.$$.ptrType.isConst&&p("Cannot convert argument of type "+r.$$.ptrType.name+" to parameter type "+this.name);var t=r.$$.ptrType.registeredClass;return xe(r.$$.ptr,t,this.registeredClass)}function wt(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function Tt(e){this.rawDestructor&&this.rawDestructor(e)}function _t(e){e!==null&&e.delete()}function yr(e,r,t){if(r===t)return e;if(t.baseClass===void 0)return null;var i=yr(e,r,t.baseClass);return i===null?null:t.downcast(i)}function Pt(){return Object.keys(ae).length}function At(){var e=[];for(var r in ae)ae.hasOwnProperty(r)&&e.push(ae[r]);return e}function Wt(e){ie=e,oe.length&&ie&&ie(Fe)}function Et(){n.getInheritedInstanceCount=Pt,n.getLiveInheritedInstances=At,n.flushPendingDeletes=Fe,n.setDelayFunction=Wt}var ae={};function St(e,r){for(r===void 0&&p("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r}function Ot(e,r){return r=St(e,r),ae[r]}function ge(e,r){return r.ptrType&&r.ptr||he("makeClassHandle requires ptr and ptrType"),!!r.smartPtrType!=!!r.smartPtr&&he("Both smartPtrType and smartPtr must be specified"),r.count={value:1},ne(Object.create(e,{$$:{value:r}}))}function jt(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=Ot(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var i=t.clone();return this.destructor(e),i}function o(){return this.isSmartPointer?ge(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):ge(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a,s=this.registeredClass.getActualType(r),u=pr[s];if(!u)return o.call(this);a=this.isConst?u.constPointerType:u.pointerType;var l=yr(r,this.registeredClass,a.registeredClass);return l===null?o.call(this):this.isSmartPointer?ge(a.registeredClass.instancePrototype,{ptrType:a,ptr:l,smartPtrType:this,smartPtr:e}):ge(a.registeredClass.instancePrototype,{ptrType:a,ptr:l})}function kt(){S.prototype.getPointee=wt,S.prototype.destructor=Tt,S.prototype.argPackAdvance=8,S.prototype.readValueFromPointer=te,S.prototype.deleteObject=_t,S.prototype.fromWireType=jt}function S(e,r,t,i,o,a,s,u,l,c,f){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=i,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=s,this.rawGetPointee=u,this.rawConstructor=l,this.rawShare=c,this.rawDestructor=f,o||r.baseClass!==void 0?this.toWireType=$t:i?(this.toWireType=bt,this.destructorFunction=null):(this.toWireType=Ct,this.destructorFunction=null)}function mr(e,r,t){n.hasOwnProperty(e)||he("Replacing nonexistant public symbol"),n[e].overloadTable!==void 0&&t!==void 0?n[e].overloadTable[t]=r:(n[e]=r,n[e].argCount=t)}function _(e,r){function t(o){var a=[r];return function(){a.length=arguments.length+1;for(var s=0;s>2)+i]);return t}function Rt(e,r,t,i,o,a){Ee(r>0);var s=De(r,t);o=_(i,o);var u=[a],l=[];F([],[e],function(c){var f="constructor "+(c=c[0]).name;if(c.registeredClass.constructor_body===void 0&&(c.registeredClass.constructor_body=[]),c.registeredClass.constructor_body[r-1]!==void 0)throw new G("Cannot register multiple constructors with identical number of parameters ("+(r-1)+") for class '"+c.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return c.registeredClass.constructor_body[r-1]=function(){be("Cannot construct "+c.name+" due to unbound types",s)},F([],s,function(m){return c.registeredClass.constructor_body[r-1]=function(){arguments.length!==r-1&&p(f+" called with "+arguments.length+" arguments, expected "+(r-1)),l.length=0,u.length=r;for(var d=1;d4&&--w[e].refcount==0&&(w[e]=void 0,Ie.push(e))}function It(){for(var e=0,r=5;r>1])};case 2:return function(i){var o=t?g:P;return this.fromWireType(o[i>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function zt(e,r,t,i){var o=ve(t);function a(){}r=v(r),a.values={},W(e,{name:r,constructor:a,fromWireType:function(s){return this.constructor.values[s]},toWireType:function(s,u){return u.value},argPackAdvance:8,readValueFromPointer:Ht(r,o,i),destructorFunction:null}),Re(r,a)}function $e(e,r){var t=V[e];return t===void 0&&p(r+" has unknown type "+vr(e)),t}function qt(e,r,t){var i=$e(e,"enum");r=v(r);var o=i.constructor,a=Object.create(i.constructor.prototype,{value:{value:t},constructor:{value:Se(i.name+"_"+r,function(){})}});o.values[t]=a,o[r]=a}function L(e){if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e}function Bt(e,r){switch(r){case 2:return function(t){return this.fromWireType(Je[t>>2])};case 3:return function(t){return this.fromWireType(Ye[t>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Nt(e,r,t){var i=ve(t);W(e,{name:r=v(r),fromWireType:function(o){return o},toWireType:function(o,a){if(typeof a!="number"&&typeof a!="boolean")throw new TypeError('Cannot convert "'+L(a)+'" to '+this.name);return a},argPackAdvance:8,readValueFromPointer:Bt(r,i),destructorFunction:null})}function Gt(e,r,t,i,o,a){var s=De(r,t);e=v(e),o=_(i,o),Re(e,function(){be("Cannot call "+e+" due to unbound types",s)},r-1),F([],s,function(u){var l=[u[0],null].concat(u.slice(1));return mr(e,gr(e,l,null,o,a),r-1),[]})}function Lt(e,r,t){switch(r){case 0:return t?function(i){return fe[i]}:function(i){return b[i]};case 1:return t?function(i){return U[i>>1]}:function(i){return ee[i>>1]};case 2:return t?function(i){return g[i>>2]}:function(i){return P[i>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function Xt(e,r,t,i,o){r=v(r),o===-1&&(o=4294967295);var a=ve(t),s=function(c){return c};if(i===0){var u=32-8*t;s=function(c){return c<>>u}}var l=r.indexOf("unsigned")!=-1;W(e,{name:r,fromWireType:s,toWireType:function(c,f){if(typeof f!="number"&&typeof f!="boolean")throw new TypeError('Cannot convert "'+L(f)+'" to '+this.name);if(fo)throw new TypeError('Passing a number "'+L(f)+'" from JS side to C/C++ side to an argument of type "'+r+'", which is outside the valid range ['+i+", "+o+"]!");return l?f>>>0:0|f},argPackAdvance:8,readValueFromPointer:Lt(r,a,i!==0),destructorFunction:null})}function Jt(e,r,t){var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][r];function o(a){var s=P,u=s[a>>=2],l=s[a+1];return new i(q,l,u)}W(e,{name:t=v(t),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})}function Yt(e,r){var t=(r=v(r))==="std::string";W(e,{name:r,fromWireType:function(i){var o,a=P[i>>2];if(t)for(var s=i+4,u=0;u<=a;++u){var l=i+4+u;if(u==a||b[l]==0){var c=Le(s,l-s);o===void 0?o=c:(o+="\0",o+=c),s=l+1}}else{var f=new Array(a);for(u=0;u>2]=s,t&&a)Fr(o,u+4,s+1);else if(a)for(var l=0;l255&&(j(u),p("String has UTF-16 code units that do not fit in 8 bits")),b[u+4+l]=c}else for(l=0;l>2],m=a(),d=l+4,h=0;h<=f;++h){var $=l+4+h*r;if(h==f||m[$>>u]==0){var y=i(d,$-d);c===void 0?c=y:(c+="\0",c+=y),d=$+r}}return j(l),c},toWireType:function(l,c){typeof c!="string"&&p("Cannot pass non-string to C++ string type "+t);var f=s(c),m=Ve(4+f+r);return P[m>>2]=f>>u,o(c,m+4,f+r),l!==null&&l.push(j,m),m},argPackAdvance:8,readValueFromPointer:te,destructorFunction:function(l){j(l)}})}function Kt(e,r,t,i,o,a){de[e]={name:v(r),rawConstructor:_(t,i),rawDestructor:_(o,a),fields:[]}}function Qt(e,r,t,i,o,a,s,u,l,c){de[e].fields.push({fieldName:v(r),getterReturnType:t,getter:_(i,o),getterContext:a,setterArgumentType:s,setter:_(u,l),setterContext:c})}function en(e,r){W(e,{isVoid:!0,name:r=v(r),argPackAdvance:0,fromWireType:function(){},toWireType:function(t,i){}})}function ue(e){return e||p("Cannot use deleted val. handle = "+e),w[e].value}function rn(e,r,t){e=ue(e),r=$e(r,"emval::as");var i=[],o=O(i);return g[t>>2]=o,r.toWireType(i,e)}var tn={};function Ce(e){var r=tn[e];return r===void 0?v(e):r}var Me=[];function nn(e,r,t,i){(e=Me[e])(r=ue(r),t=Ce(t),null,i)}function br(){if(typeof globalThis=="object")return globalThis;function e(r){r.$$$embind_global$$$=r;var t=typeof $$$embind_global$$$=="object"&&r.$$$embind_global$$$===r;return t||delete r.$$$embind_global$$$,t}if(typeof $$$embind_global$$$=="object"||(typeof ze=="object"&&e(ze)?$$$embind_global$$$=ze:typeof self=="object"&&e(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")}function on(e){return e===0?O(br()):(e=Ce(e),O(br()[e]))}function an(e){var r=Me.length;return Me.push(e),r}function un(e,r){for(var t=new Array(e),i=0;i>2)+i],"parameter "+i);return t}function sn(e,r){var t=un(e,r),i=t[0],o=new Array(e-1);return an(function(a,s,u,l){for(var c=0,f=0;f4&&(w[e].refcount+=1)}function pn(e){var r=new Array(e+1);return function(t,i,o){r[0]=t;for(var a=0;a>2)+a],"parameter "+a);r[a+1]=s.readValueFromPointer(o),o+=s.argPackAdvance}return O(new(t.bind.apply(t,r)))}}var $r={};function dn(e,r,t,i){e=ue(e);var o=$r[r];return o||(o=pn(r),$r[r]=o),o(e,t,i)}function yn(e){return O(Ce(e))}function mn(e){ye(w[e].value),Ue(e)}function hn(){B()}function vn(e,r,t){b.copyWithin(e,r,r+t)}function gn(){return b.length}function bn(e){try{return Q.grow(e-q.byteLength+65535>>>16),Ke(Q.buffer),1}catch{}}function $n(e){e>>>=0;var r=gn(),t=65536,i=2147483648;if(e>i)return!1;for(var o=16777216,a=1;a<=4;a*=2){var s=r*(1+.2/a);if(s=Math.min(s,e+100663296),bn(Math.min(i,Hr(Math.max(o,e,s),t))))return!0}return!1}var we={mappings:{},buffers:[null,[],[]],printChar:function(e,r){var t=we.buffers[e];r===0||r===10?((e===1?Or:z)(Ge(t,0)),t.length=0):t.push(r)},varargs:void 0,get:function(){return we.varargs+=4,g[we.varargs-4>>2]},getStr:function(e){return Le(e)},get64:function(e,r){return e}};function Cn(e){return 0}function wn(e,r,t,i,o){}function Tn(e,r,t,i){for(var o=0,a=0;a>2],u=g[r+(8*a+4)>>2],l=0;l>2]=o,0}function _n(e){return(e=+e)>=0?+Kr(e+.5):+Zr(e-.5)}function Pn(e){}sr=n.InternalError=Oe(Error,"InternalError"),st(),G=n.BindingError=Oe(Error,"BindingError"),vt(),kt(),Et(),hr=n.UnboundTypeError=Oe(Error,"UnboundTypeError"),Mt();var An={u:ut,J:lt,y:Ft,x:Rt,d:xt,k:Dt,I:Vt,n:zt,a:qt,B:Nt,i:Gt,j:Xt,h:Jt,C:Yt,w:Zt,v:Kt,c:Qt,K:en,m:rn,s:nn,b:Ue,z:on,t:sn,r:ln,e:cn,g:fn,q:dn,f:yn,l:mn,p:hn,F:vn,G:$n,H:Cn,D:wn,A:Tn,memory:Q,o:_n,E:Pn,table:jr};it();var Te,Cr=n.___wasm_call_ctors=function(){return(Cr=n.___wasm_call_ctors=n.asm.L).apply(null,arguments)},Ve=n._malloc=function(){return(Ve=n._malloc=n.asm.M).apply(null,arguments)},j=n._free=function(){return(j=n._free=n.asm.N).apply(null,arguments)},wr=n.___getTypeName=function(){return(wr=n.___getTypeName=n.asm.O).apply(null,arguments)};function Wn(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function He(e){function r(){Te||(Te=!0,n.calledRun=!0,Be||(Gr(),Lr(),Y(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),Xr()))}M>0||(Nr(),M>0||(n.setStatus?(n.setStatus("Running..."),setTimeout(function(){setTimeout(function(){n.setStatus("")},1),r()},1)):r()))}if(n.___embind_register_native_and_builtin_types=function(){return(n.___embind_register_native_and_builtin_types=n.asm.P).apply(null,arguments)},n.dynCall_viii=function(){return(n.dynCall_viii=n.asm.Q).apply(null,arguments)},n.dynCall_vi=function(){return(n.dynCall_vi=n.asm.R).apply(null,arguments)},n.dynCall_v=function(){return(n.dynCall_v=n.asm.S).apply(null,arguments)},n.dynCall_i=function(){return(n.dynCall_i=n.asm.T).apply(null,arguments)},n.dynCall_iii=function(){return(n.dynCall_iii=n.asm.U).apply(null,arguments)},n.dynCall_ii=function(){return(n.dynCall_ii=n.asm.V).apply(null,arguments)},n.dynCall_vii=function(){return(n.dynCall_vii=n.asm.W).apply(null,arguments)},n.dynCall_iiii=function(){return(n.dynCall_iiii=n.asm.X).apply(null,arguments)},n.dynCall_iiiii=function(){return(n.dynCall_iiiii=n.asm.Y).apply(null,arguments)},n.dynCall_iiiiii=function(){return(n.dynCall_iiiiii=n.asm.Z).apply(null,arguments)},n.dynCall_iiiiiiii=function(){return(n.dynCall_iiiiiiii=n.asm._).apply(null,arguments)},n.dynCall_iiiiiiiii=function(){return(n.dynCall_iiiiiiiii=n.asm.$).apply(null,arguments)},n.dynCall_viiii=function(){return(n.dynCall_viiii=n.asm.aa).apply(null,arguments)},n.dynCall_iiiiiii=function(){return(n.dynCall_iiiiiii=n.asm.ba).apply(null,arguments)},n.dynCall_iiiiiiiiiiiiiiiiiiii=function(){return(n.dynCall_iiiiiiiiiiiiiiiiiiii=n.asm.ca).apply(null,arguments)},n.dynCall_iiiiiiiiiiiiiiiiiiiii=function(){return(n.dynCall_iiiiiiiiiiiiiiiiiiiii=n.asm.da).apply(null,arguments)},n.dynCall_iiiiiiiiiiiiiiiiiii=function(){return(n.dynCall_iiiiiiiiiiiiiiiiiii=n.asm.ea).apply(null,arguments)},n.dynCall_viiiii=function(){return(n.dynCall_viiiii=n.asm.fa).apply(null,arguments)},n.dynCall_iiiiiiiiii=function(){return(n.dynCall_iiiiiiiiii=n.asm.ga).apply(null,arguments)},n.dynCall_iiiiiiiiiii=function(){return(n.dynCall_iiiiiiiiiii=n.asm.ha).apply(null,arguments)},n.dynCall_jiji=function(){return(n.dynCall_jiji=n.asm.ia).apply(null,arguments)},n.dynCall_viiiiii=function(){return(n.dynCall_viiiiii=n.asm.ja).apply(null,arguments)},re=function e(){Te||He(),Te||(re=e)},n.run=He,n.preInit)for(typeof n.preInit=="function"&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return He(),k.ready},Ar.exports=Wr;var Er=_e.exports;const kn=On({__proto__:null,default:Sn(Er)},[Er]);export{kn as b}; diff --git a/dist/assets/button-dkwNndhL.js b/dist/assets/button-4hsayCiP.js similarity index 98% rename from dist/assets/button-dkwNndhL.js rename to dist/assets/button-4hsayCiP.js index e1ddc7f..afedf4a 100644 --- a/dist/assets/button-dkwNndhL.js +++ b/dist/assets/button-4hsayCiP.js @@ -1,4 +1,4 @@ -import{q as g,H as f,t as r}from"./index-J0iiHjMT.js";import{s as k,r as m,f as x}from"./form-2Iq0hI3D.js";import{c as w,d as y,u as z}from"./interactive-NKzPUNL4.js";import{c as E,d as C,g as L}from"./label2-d2vWQ7x7.js";import{s as S,a as O,c as T}from"./loadable-sxY2K1G3.js";import{c as A,d as F}from"./locale-pfkq1d6A.js";import{c as u}from"./observers-JyBmMU24.js";import{g as h}from"./component-dtiBfYiX.js";import{c as M,d as R,s as I,u as H}from"./t9n-od6MEnI1.js";import{d as j}from"./icon-ZwpY5ksA.js";import{d as G}from"./loader-QqciGs1c.js";/*! +import{p as g,H as f,k as r}from"./index-pCX-0tJH.js";import{s as k,r as m,f as x}from"./form-1U5Kiwxm.js";import{c as w,d as y,u as z}from"./interactive-9W9APeiw.js";import{c as E,d as C,g as L}from"./label2-JXqLMBYY.js";import{s as S,a as O,c as T}from"./loadable-uNbe2Ndt.js";import{c as A,d as F}from"./locale-tKMV0J87.js";import{c as u}from"./observers-eNe735aq.js";import{g as h}from"./component-dtiBfYiX.js";import{c as M,d as R,s as I,u as H}from"./t9n-KLe7iM0R.js";import{d as j}from"./icon-BW6RCrUr.js";import{d as G}from"./loader-plQ4Tft5.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-action-GYDrwtQs.js b/dist/assets/calcite-action-GYDrwtQs.js new file mode 100644 index 0000000..ae0b17c --- /dev/null +++ b/dist/assets/calcite-action-GYDrwtQs.js @@ -0,0 +1,5 @@ +import{A as t,d as o}from"./action-bN6v5--b.js";import"./index-pCX-0tJH.js";import"./guid-6vN-YNJI.js";import"./interactive-9W9APeiw.js";import"./loadable-uNbe2Ndt.js";import"./locale-tKMV0J87.js";import"./key-qdHumIlA.js";import"./observers-eNe735aq.js";import"./component-dtiBfYiX.js";import"./t9n-KLe7iM0R.js";import"./icon-BW6RCrUr.js";import"./loader-plQ4Tft5.js";/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. + * v1.11.0 + */const A=t,C=o;export{A as CalciteAction,C as defineCustomElement}; diff --git a/dist/assets/calcite-action-bar-yKX8eCZY.js b/dist/assets/calcite-action-bar-1xecS7ni.js similarity index 88% rename from dist/assets/calcite-action-bar-yKX8eCZY.js rename to dist/assets/calcite-action-bar-1xecS7ni.js index c24f8fa..f0a9bb7 100644 --- a/dist/assets/calcite-action-bar-yKX8eCZY.js +++ b/dist/assets/calcite-action-bar-1xecS7ni.js @@ -1,9 +1,9 @@ -import{ch as T,t as r,cn as H,q as O,H as D,r as k,kr as v,h7 as A,ks as B,x as G}from"./index-J0iiHjMT.js";import{c as M,d as $}from"./conditionalSlot-e55zipTI.js";import{a as q,s as P,c as R}from"./loadable-sxY2K1G3.js";import{c as W,d as I}from"./locale-pfkq1d6A.js";import{c as E}from"./observers-JyBmMU24.js";import{u as F,c as _,s as U,d as j}from"./t9n-od6MEnI1.js";import{S as m,d as J}from"./action-group-8XaPC2xM.js";import{S as K,d as Q}from"./action-menu-h_LAlWK7.js";import{d as V}from"./action-W5zDPNjG.js";import{d as X}from"./icon-ZwpY5ksA.js";import{d as Y}from"./loader-QqciGs1c.js";import{d as Z}from"./popover-Jm1QI0N1.js";import{d as N}from"./debounce-HnHf1UOZ.js";import"./key-qdHumIlA.js";import"./guid-6vN-YNJI.js";import"./interactive-NKzPUNL4.js";import"./component-dtiBfYiX.js";import"./floating-ui-McpI0u1Z.js";import"./openCloseComponent-yw47Oy2q.js";import"./FloatingArrow-BghsONry.js";/*! +import{aS as T,k as r,aY as H,p as O,H as D,d as k,kz as v,h9 as A,kA as B,l as G}from"./index-pCX-0tJH.js";import{c as M,d as $}from"./conditionalSlot-OgY0Ln74.js";import{a as q,s as P,c as R}from"./loadable-uNbe2Ndt.js";import{c as W,d as I}from"./locale-tKMV0J87.js";import{c as E}from"./observers-eNe735aq.js";import{u as F,c as _,s as U,d as j}from"./t9n-KLe7iM0R.js";import{S as m,d as Y}from"./action-group-6S1AUKwx.js";import{S as J,d as K}from"./action-menu-FiGuYhhw.js";import{d as Q}from"./action-bN6v5--b.js";import{d as V}from"./icon-BW6RCrUr.js";import{d as X}from"./loader-plQ4Tft5.js";import{d as Z}from"./popover-QEcoULsC.js";import{d as N}from"./debounce-HnHf1UOZ.js";import"./key-qdHumIlA.js";import"./guid-6vN-YNJI.js";import"./interactive-9W9APeiw.js";import"./component-dtiBfYiX.js";import"./floating-ui-C10Xvlxv.js";import"./openCloseComponent-lU2sdEaR.js";import"./FloatingArrow-FUeqM5kw.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const tt=150,et=2,C=t=>t.reduce((e,o)=>e+o,0)/t.length,ot=t=>{const e=t.filter(s=>s.slot!==m.menuActions),o=e==null?void 0:e.length;return{actionWidth:o?C(e.map(s=>s.clientWidth||0)):0,actionHeight:o?C(e.map(s=>s.clientHeight||0)):0}},st=({width:t,actionWidth:e,layout:o,height:s,actionHeight:c,groupCount:i})=>{const a=o==="horizontal"?t:s,n=o==="horizontal"?e:c;return Math.floor((a-i*et)/n)},nt=({layout:t,actionCount:e,actionWidth:o,width:s,actionHeight:c,height:i,groupCount:a})=>Math.max(e-st({width:s,actionWidth:o,layout:t,height:i,actionHeight:c,groupCount:a}),0),x=t=>Array.from(t.querySelectorAll("calcite-action")).filter(e=>e.closest("calcite-action-menu")?e.slot===K.trigger:!0),it=({actionGroups:t,expanded:e,overflowCount:o})=>{let s=o;t.reverse().forEach(c=>{let i=0;const a=x(c).reverse();a.forEach(n=>{n.slot===m.menuActions&&(n.removeAttribute("slot"),n.textEnabled=e)}),s>0&&a.some(n=>(a.filter(l=>!l.slot).length>1&&a.length>2&&!n.closest("calcite-action-menu")&&(n.textEnabled=!0,n.setAttribute("slot",m.menuActions),i++,i>1&&s--),s<1)),H(c)})},y={chevronsLeft:"chevrons-left",chevronsRight:"chevrons-right"};function at(t,e){var o;return t||((o=e.closest("calcite-shell-panel"))==null?void 0:o.position)||"start"}function f({el:t,expanded:e}){x(t).filter(o=>o.slot!==m.menuActions).forEach(o=>o.textEnabled=e),t.querySelectorAll("calcite-action-group, calcite-action-menu").forEach(o=>o.expanded=e)}const ct=({tooltip:t,referenceElement:e,expanded:o,ref:s})=>(t&&(t.referenceElement=!o&&e?e:null),s&&s(e),e),lt=({expanded:t,expandText:e,collapseText:o,toggle:s,el:c,position:i,tooltip:a,ref:n,scale:h})=>{const l=T(c)==="rtl",u=t?o:e,d=[y.chevronsLeft,y.chevronsRight];l&&d.reverse();const p=at(i,c)==="end",g=p?d[1]:d[0],z=p?d[0]:d[1];return r("calcite-action",{icon:t?g:z,onClick:s,scale:h,text:u,textEnabled:t,title:!t&&!a?u:null,ref:L=>ct({tooltip:a,referenceElement:L,expanded:t,ref:n})})};/*! + */const tt=150,et=2,C=t=>t.reduce((e,o)=>e+o,0)/t.length,ot=t=>{const e=t.filter(s=>s.slot!==m.menuActions),o=e==null?void 0:e.length;return{actionWidth:o?C(e.map(s=>s.clientWidth||0)):0,actionHeight:o?C(e.map(s=>s.clientHeight||0)):0}},st=({width:t,actionWidth:e,layout:o,height:s,actionHeight:c,groupCount:i})=>{const a=o==="horizontal"?t:s,n=o==="horizontal"?e:c;return Math.floor((a-i*et)/n)},nt=({layout:t,actionCount:e,actionWidth:o,width:s,actionHeight:c,height:i,groupCount:a})=>Math.max(e-st({width:s,actionWidth:o,layout:t,height:i,actionHeight:c,groupCount:a}),0),x=t=>Array.from(t.querySelectorAll("calcite-action")).filter(e=>e.closest("calcite-action-menu")?e.slot===J.trigger:!0),it=({actionGroups:t,expanded:e,overflowCount:o})=>{let s=o;t.reverse().forEach(c=>{let i=0;const a=x(c).reverse();a.forEach(n=>{n.slot===m.menuActions&&(n.removeAttribute("slot"),n.textEnabled=e)}),s>0&&a.some(n=>(a.filter(l=>!l.slot).length>1&&a.length>2&&!n.closest("calcite-action-menu")&&(n.textEnabled=!0,n.setAttribute("slot",m.menuActions),i++,i>1&&s--),s<1)),H(c)})},y={chevronsLeft:"chevrons-left",chevronsRight:"chevrons-right"};function at(t,e){var o;return t||((o=e.closest("calcite-shell-panel"))==null?void 0:o.position)||"start"}function f({el:t,expanded:e}){x(t).filter(o=>o.slot!==m.menuActions).forEach(o=>o.textEnabled=e),t.querySelectorAll("calcite-action-group, calcite-action-menu").forEach(o=>o.expanded=e)}const ct=({tooltip:t,referenceElement:e,expanded:o,ref:s})=>(t&&(t.referenceElement=!o&&e?e:null),s&&s(e),e),lt=({expanded:t,expandText:e,collapseText:o,toggle:s,el:c,position:i,tooltip:a,ref:n,scale:h})=>{const l=T(c)==="rtl",u=t?o:e,d=[y.chevronsLeft,y.chevronsRight];l&&d.reverse();const p=at(i,c)==="end",g=p?d[1]:d[0],z=p?d[0]:d[1];return r("calcite-action",{icon:t?g:z,onClick:s,scale:h,text:u,textEnabled:t,title:!t&&!a?u:null,ref:L=>ct({tooltip:a,referenceElement:L,expanded:t,ref:n})})};/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const rt={actionGroupEnd:"action-group--end"},b={actionsEnd:"actions-end",bottomActions:"bottom-actions",expandTooltip:"expand-tooltip"},dt=":host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host{pointer-events:auto;display:inline-flex;align-self:stretch;--calcite-action-bar-expanded-max-width:auto}:host([layout=vertical]){flex-direction:column}:host([layout=vertical]) .action-group--end{margin-block-start:auto}:host([layout=horizontal]){flex-direction:row}:host([layout=horizontal]) .action-group--end{margin-inline-start:auto}:host([layout=vertical][overflow-actions-disabled]){overflow-y:auto}:host([layout=horizontal][overflow-actions-disabled]){overflow-x:auto}:host([layout=vertical][expanded]){max-inline-size:var(--calcite-action-bar-expanded-max-width)}::slotted(calcite-action-group){border-block-end:1px solid var(--calcite-ui-border-3)}:host([layout=horizontal]) ::slotted(calcite-action-group){border-block-end:0;border-inline-end:1px solid var(--calcite-ui-border-3)}:host([layout=horizontal][expand-disabled]) ::slotted(calcite-action-group:last-of-type){border-inline-end:0}::slotted(calcite-action-group:last-child){border-block-end:0;border-inline-end:0}.action-group--end{justify-content:flex-end}:host([hidden]){display:none}[hidden]{display:none}",w=O(class extends D{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteActionBarToggle=k(this,"calciteActionBarToggle",6),this.mutationObserver=E("mutation",()=>{const{el:t,expanded:e}=this;f({el:t,expanded:e}),this.overflowActions()}),this.resizeObserver=E("resize",t=>this.resizeHandlerEntries(t)),this.actionMenuOpenHandler=t=>{if(t.target.menuOpen){const e=t.composedPath();Array.from(this.el.querySelectorAll("calcite-action-group")).forEach(o=>{e.includes(o)||(o.menuOpen=!1)})}},this.resizeHandlerEntries=t=>{t.forEach(this.resizeHandler)},this.resizeHandler=t=>{const{width:e,height:o}=t.contentRect;this.resize({width:e,height:o})},this.resize=N(({width:t,height:e})=>{const{el:o,expanded:s,expandDisabled:c,layout:i,overflowActionsDisabled:a}=this;if(a||i==="vertical"&&!e||i==="horizontal"&&!t)return;const n=x(o),h=c?n.length:n.length+1,l=Array.from(o.querySelectorAll("calcite-action-group"));this.setGroupLayout(l);const u=this.hasActionsEnd||this.hasBottomActions||!c?l.length+1:l.length,{actionHeight:d,actionWidth:p}=ot(n),g=nt({layout:i,actionCount:h,actionHeight:d,actionWidth:p,height:e,width:t,groupCount:u});it({actionGroups:l,expanded:s,overflowCount:g})},tt),this.toggleExpand=()=>{this.expanded=!this.expanded,this.calciteActionBarToggle.emit()},this.setExpandToggleRef=t=>{this.expandToggleEl=t},this.handleDefaultSlotChange=t=>{const e=v(t).filter(o=>o.matches("calcite-action-group"));this.setGroupLayout(e)},this.handleActionsEndSlotChange=t=>{this.hasActionsEnd=A(t)},this.handleBottomActionsSlotChange=t=>{this.hasBottomActions=A(t)},this.handleTooltipSlotChange=t=>{const e=v(t).filter(o=>o==null?void 0:o.matches("calcite-tooltip"));this.expandTooltip=e[0]},this.actionsEndGroupLabel=void 0,this.expandDisabled=!1,this.expanded=!1,this.layout="vertical",this.overflowActionsDisabled=!1,this.position=void 0,this.scale=void 0,this.messages=void 0,this.messageOverrides=void 0,this.effectiveLocale=void 0,this.hasActionsEnd=!1,this.hasBottomActions=!1,this.expandTooltip=void 0,this.defaultMessages=void 0}expandHandler(){this.overflowActions()}expandedHandler(){const{el:t,expanded:e}=this;f({el:t,expanded:e}),this.overflowActions()}layoutHandler(){this.updateGroups()}overflowDisabledHandler(t){var e,o;if(t){(e=this.resizeObserver)==null||e.disconnect();return}(o=this.resizeObserver)==null||o.observe(this.el),this.overflowActions()}onMessagesChange(){}effectiveLocaleChange(){F(this,this.effectiveLocale)}componentDidLoad(){const{el:t,expanded:e}=this;q(this),f({el:t,expanded:e}),this.overflowActions()}connectedCallback(){var o,s;const{el:t,expanded:e}=this;W(this),_(this),f({el:t,expanded:e}),(o=this.mutationObserver)==null||o.observe(t,{childList:!0,subtree:!0}),this.overflowActionsDisabled||(s=this.resizeObserver)==null||s.observe(t),this.overflowActions(),M(this)}async componentWillLoad(){P(this),await U(this)}disconnectedCallback(){var t,e;(t=this.mutationObserver)==null||t.disconnect(),(e=this.resizeObserver)==null||e.disconnect(),$(this),I(this),j(this)}async overflowActions(){this.resize({width:this.el.clientWidth,height:this.el.clientHeight})}async setFocus(){await R(this),B(this.el)}updateGroups(){this.setGroupLayout(Array.from(this.el.querySelectorAll("calcite-action-group")))}setGroupLayout(t){t.forEach(e=>e.layout=this.layout)}renderBottomActionGroup(){const{expanded:t,expandDisabled:e,el:o,position:s,toggleExpand:c,scale:i,layout:a,messages:n,actionsEndGroupLabel:h}=this,l=e?null:r(lt,{collapseText:n.collapse,el:o,expandText:n.expand,expanded:t,position:s,scale:i,toggle:c,tooltip:this.expandTooltip,ref:this.setExpandToggleRef});return r("calcite-action-group",{class:rt.actionGroupEnd,hidden:this.expandDisabled&&!(this.hasActionsEnd||this.hasBottomActions),label:h,layout:a,scale:i},r("slot",{name:b.actionsEnd,onSlotchange:this.handleActionsEndSlotChange}),r("slot",{name:b.bottomActions,onSlotchange:this.handleBottomActionsSlotChange}),r("slot",{name:b.expandTooltip,onSlotchange:this.handleTooltipSlotChange}),l)}render(){return r(G,{onCalciteActionMenuOpen:this.actionMenuOpenHandler},r("slot",{onSlotchange:this.handleDefaultSlotChange}),this.renderBottomActionGroup())}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{expandDisabled:["expandHandler"],expanded:["expandedHandler"],layout:["layoutHandler"],overflowActionsDisabled:["overflowDisabledHandler"],messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return dt}},[1,"calcite-action-bar",{actionsEndGroupLabel:[1,"actions-end-group-label"],expandDisabled:[516,"expand-disabled"],expanded:[1540],layout:[513],overflowActionsDisabled:[516,"overflow-actions-disabled"],position:[513],scale:[513],messages:[1040],messageOverrides:[1040],effectiveLocale:[32],hasActionsEnd:[32],hasBottomActions:[32],expandTooltip:[32],defaultMessages:[32],overflowActions:[64],setFocus:[64]}]);function S(){if(typeof customElements>"u")return;["calcite-action-bar","calcite-action","calcite-action-group","calcite-action-menu","calcite-icon","calcite-loader","calcite-popover"].forEach(e=>{switch(e){case"calcite-action-bar":customElements.get(e)||customElements.define(e,w);break;case"calcite-action":customElements.get(e)||V();break;case"calcite-action-group":customElements.get(e)||J();break;case"calcite-action-menu":customElements.get(e)||Q();break;case"calcite-icon":customElements.get(e)||X();break;case"calcite-loader":customElements.get(e)||Y();break;case"calcite-popover":customElements.get(e)||Z();break}})}S();const kt=w,Bt=S;export{kt as CalciteActionBar,Bt as defineCustomElement}; + */const rt={actionGroupEnd:"action-group--end"},b={actionsEnd:"actions-end",bottomActions:"bottom-actions",expandTooltip:"expand-tooltip"},dt=":host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host{pointer-events:auto;display:inline-flex;align-self:stretch;--calcite-action-bar-expanded-max-width:auto}:host([layout=vertical]){flex-direction:column}:host([layout=vertical]) .action-group--end{margin-block-start:auto}:host([layout=horizontal]){flex-direction:row}:host([layout=horizontal]) .action-group--end{margin-inline-start:auto}:host([layout=vertical][overflow-actions-disabled]){overflow-y:auto}:host([layout=horizontal][overflow-actions-disabled]){overflow-x:auto}:host([layout=vertical][expanded]){max-inline-size:var(--calcite-action-bar-expanded-max-width)}::slotted(calcite-action-group){border-block-end:1px solid var(--calcite-ui-border-3)}:host([layout=horizontal]) ::slotted(calcite-action-group){border-block-end:0;border-inline-end:1px solid var(--calcite-ui-border-3)}:host([layout=horizontal][expand-disabled]) ::slotted(calcite-action-group:last-of-type){border-inline-end:0}::slotted(calcite-action-group:last-child){border-block-end:0;border-inline-end:0}.action-group--end{justify-content:flex-end}:host([hidden]){display:none}[hidden]{display:none}",w=O(class extends D{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteActionBarToggle=k(this,"calciteActionBarToggle",6),this.mutationObserver=E("mutation",()=>{const{el:t,expanded:e}=this;f({el:t,expanded:e}),this.overflowActions()}),this.resizeObserver=E("resize",t=>this.resizeHandlerEntries(t)),this.actionMenuOpenHandler=t=>{if(t.target.menuOpen){const e=t.composedPath();Array.from(this.el.querySelectorAll("calcite-action-group")).forEach(o=>{e.includes(o)||(o.menuOpen=!1)})}},this.resizeHandlerEntries=t=>{t.forEach(this.resizeHandler)},this.resizeHandler=t=>{const{width:e,height:o}=t.contentRect;this.resize({width:e,height:o})},this.resize=N(({width:t,height:e})=>{const{el:o,expanded:s,expandDisabled:c,layout:i,overflowActionsDisabled:a}=this;if(a||i==="vertical"&&!e||i==="horizontal"&&!t)return;const n=x(o),h=c?n.length:n.length+1,l=Array.from(o.querySelectorAll("calcite-action-group"));this.setGroupLayout(l);const u=this.hasActionsEnd||this.hasBottomActions||!c?l.length+1:l.length,{actionHeight:d,actionWidth:p}=ot(n),g=nt({layout:i,actionCount:h,actionHeight:d,actionWidth:p,height:e,width:t,groupCount:u});it({actionGroups:l,expanded:s,overflowCount:g})},tt),this.toggleExpand=()=>{this.expanded=!this.expanded,this.calciteActionBarToggle.emit()},this.setExpandToggleRef=t=>{this.expandToggleEl=t},this.handleDefaultSlotChange=t=>{const e=v(t).filter(o=>o.matches("calcite-action-group"));this.setGroupLayout(e)},this.handleActionsEndSlotChange=t=>{this.hasActionsEnd=A(t)},this.handleBottomActionsSlotChange=t=>{this.hasBottomActions=A(t)},this.handleTooltipSlotChange=t=>{const e=v(t).filter(o=>o==null?void 0:o.matches("calcite-tooltip"));this.expandTooltip=e[0]},this.actionsEndGroupLabel=void 0,this.expandDisabled=!1,this.expanded=!1,this.layout="vertical",this.overflowActionsDisabled=!1,this.position=void 0,this.scale=void 0,this.messages=void 0,this.messageOverrides=void 0,this.effectiveLocale=void 0,this.hasActionsEnd=!1,this.hasBottomActions=!1,this.expandTooltip=void 0,this.defaultMessages=void 0}expandHandler(){this.overflowActions()}expandedHandler(){const{el:t,expanded:e}=this;f({el:t,expanded:e}),this.overflowActions()}layoutHandler(){this.updateGroups()}overflowDisabledHandler(t){var e,o;if(t){(e=this.resizeObserver)==null||e.disconnect();return}(o=this.resizeObserver)==null||o.observe(this.el),this.overflowActions()}onMessagesChange(){}effectiveLocaleChange(){F(this,this.effectiveLocale)}componentDidLoad(){const{el:t,expanded:e}=this;q(this),f({el:t,expanded:e}),this.overflowActions()}connectedCallback(){var o,s;const{el:t,expanded:e}=this;W(this),_(this),f({el:t,expanded:e}),(o=this.mutationObserver)==null||o.observe(t,{childList:!0,subtree:!0}),this.overflowActionsDisabled||(s=this.resizeObserver)==null||s.observe(t),this.overflowActions(),M(this)}async componentWillLoad(){P(this),await U(this)}disconnectedCallback(){var t,e;(t=this.mutationObserver)==null||t.disconnect(),(e=this.resizeObserver)==null||e.disconnect(),$(this),I(this),j(this)}async overflowActions(){this.resize({width:this.el.clientWidth,height:this.el.clientHeight})}async setFocus(){await R(this),B(this.el)}updateGroups(){this.setGroupLayout(Array.from(this.el.querySelectorAll("calcite-action-group")))}setGroupLayout(t){t.forEach(e=>e.layout=this.layout)}renderBottomActionGroup(){const{expanded:t,expandDisabled:e,el:o,position:s,toggleExpand:c,scale:i,layout:a,messages:n,actionsEndGroupLabel:h}=this,l=e?null:r(lt,{collapseText:n.collapse,el:o,expandText:n.expand,expanded:t,position:s,scale:i,toggle:c,tooltip:this.expandTooltip,ref:this.setExpandToggleRef});return r("calcite-action-group",{class:rt.actionGroupEnd,hidden:this.expandDisabled&&!(this.hasActionsEnd||this.hasBottomActions),label:h,layout:a,scale:i},r("slot",{name:b.actionsEnd,onSlotchange:this.handleActionsEndSlotChange}),r("slot",{name:b.bottomActions,onSlotchange:this.handleBottomActionsSlotChange}),r("slot",{name:b.expandTooltip,onSlotchange:this.handleTooltipSlotChange}),l)}render(){return r(G,{onCalciteActionMenuOpen:this.actionMenuOpenHandler},r("slot",{onSlotchange:this.handleDefaultSlotChange}),this.renderBottomActionGroup())}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{expandDisabled:["expandHandler"],expanded:["expandedHandler"],layout:["layoutHandler"],overflowActionsDisabled:["overflowDisabledHandler"],messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return dt}},[1,"calcite-action-bar",{actionsEndGroupLabel:[1,"actions-end-group-label"],expandDisabled:[516,"expand-disabled"],expanded:[1540],layout:[513],overflowActionsDisabled:[516,"overflow-actions-disabled"],position:[513],scale:[513],messages:[1040],messageOverrides:[1040],effectiveLocale:[32],hasActionsEnd:[32],hasBottomActions:[32],expandTooltip:[32],defaultMessages:[32],overflowActions:[64],setFocus:[64]}]);function S(){if(typeof customElements>"u")return;["calcite-action-bar","calcite-action","calcite-action-group","calcite-action-menu","calcite-icon","calcite-loader","calcite-popover"].forEach(e=>{switch(e){case"calcite-action-bar":customElements.get(e)||customElements.define(e,w);break;case"calcite-action":customElements.get(e)||Q();break;case"calcite-action-group":customElements.get(e)||Y();break;case"calcite-action-menu":customElements.get(e)||K();break;case"calcite-icon":customElements.get(e)||V();break;case"calcite-loader":customElements.get(e)||X();break;case"calcite-popover":customElements.get(e)||Z();break}})}S();const kt=w,Bt=S;export{kt as CalciteActionBar,Bt as defineCustomElement}; diff --git a/dist/assets/calcite-action-group-ZfO11pHg.js b/dist/assets/calcite-action-group-ZfO11pHg.js new file mode 100644 index 0000000..334fb6b --- /dev/null +++ b/dist/assets/calcite-action-group-ZfO11pHg.js @@ -0,0 +1,5 @@ +import{A as o,d as t}from"./action-group-6S1AUKwx.js";import"./index-pCX-0tJH.js";import"./conditionalSlot-OgY0Ln74.js";import"./observers-eNe735aq.js";import"./loadable-uNbe2Ndt.js";import"./locale-tKMV0J87.js";import"./key-qdHumIlA.js";import"./t9n-KLe7iM0R.js";import"./action-menu-FiGuYhhw.js";import"./guid-6vN-YNJI.js";import"./action-bN6v5--b.js";import"./interactive-9W9APeiw.js";import"./component-dtiBfYiX.js";import"./icon-BW6RCrUr.js";import"./loader-plQ4Tft5.js";import"./popover-QEcoULsC.js";import"./floating-ui-C10Xvlxv.js";import"./debounce-HnHf1UOZ.js";import"./openCloseComponent-lU2sdEaR.js";import"./FloatingArrow-FUeqM5kw.js";/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. + * v1.11.0 + */const g=o,h=t;export{g as CalciteActionGroup,h as defineCustomElement}; diff --git a/dist/assets/calcite-action-group-_Xoggrsa.js b/dist/assets/calcite-action-group-_Xoggrsa.js deleted file mode 100644 index daf7a4f..0000000 --- a/dist/assets/calcite-action-group-_Xoggrsa.js +++ /dev/null @@ -1,5 +0,0 @@ -import{A as o,d as t}from"./action-group-8XaPC2xM.js";import"./index-J0iiHjMT.js";import"./conditionalSlot-e55zipTI.js";import"./observers-JyBmMU24.js";import"./loadable-sxY2K1G3.js";import"./locale-pfkq1d6A.js";import"./key-qdHumIlA.js";import"./t9n-od6MEnI1.js";import"./action-menu-h_LAlWK7.js";import"./guid-6vN-YNJI.js";import"./action-W5zDPNjG.js";import"./interactive-NKzPUNL4.js";import"./component-dtiBfYiX.js";import"./icon-ZwpY5ksA.js";import"./loader-QqciGs1c.js";import"./popover-Jm1QI0N1.js";import"./floating-ui-McpI0u1Z.js";import"./debounce-HnHf1UOZ.js";import"./openCloseComponent-yw47Oy2q.js";import"./FloatingArrow-BghsONry.js";/*! - * All material copyright ESRI, All Rights Reserved, unless otherwise specified. - * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. - * v1.11.0 - */const g=o,h=t;export{g as CalciteActionGroup,h as defineCustomElement}; diff --git a/dist/assets/calcite-action-mEzyoc-Z.js b/dist/assets/calcite-action-mEzyoc-Z.js deleted file mode 100644 index 6f70815..0000000 --- a/dist/assets/calcite-action-mEzyoc-Z.js +++ /dev/null @@ -1,5 +0,0 @@ -import{A as t,d as o}from"./action-W5zDPNjG.js";import"./index-J0iiHjMT.js";import"./guid-6vN-YNJI.js";import"./interactive-NKzPUNL4.js";import"./loadable-sxY2K1G3.js";import"./locale-pfkq1d6A.js";import"./key-qdHumIlA.js";import"./observers-JyBmMU24.js";import"./component-dtiBfYiX.js";import"./t9n-od6MEnI1.js";import"./icon-ZwpY5ksA.js";import"./loader-QqciGs1c.js";/*! - * All material copyright ESRI, All Rights Reserved, unless otherwise specified. - * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. - * v1.11.0 - */const A=t,C=o;export{A as CalciteAction,C as defineCustomElement}; diff --git a/dist/assets/calcite-button-rIOy-85Y.js b/dist/assets/calcite-button-rIOy-85Y.js new file mode 100644 index 0000000..5f0ba8e --- /dev/null +++ b/dist/assets/calcite-button-rIOy-85Y.js @@ -0,0 +1,5 @@ +import{B as t,d as o}from"./button-4hsayCiP.js";import"./index-pCX-0tJH.js";import"./form-1U5Kiwxm.js";import"./interactive-9W9APeiw.js";import"./label2-JXqLMBYY.js";import"./loadable-uNbe2Ndt.js";import"./locale-tKMV0J87.js";import"./key-qdHumIlA.js";import"./observers-eNe735aq.js";import"./component-dtiBfYiX.js";import"./t9n-KLe7iM0R.js";import"./icon-BW6RCrUr.js";import"./loader-plQ4Tft5.js";import"./guid-6vN-YNJI.js";/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. + * v1.11.0 + */const C=t,E=o;export{C as CalciteButton,E as defineCustomElement}; diff --git a/dist/assets/calcite-button-tOn16zeN.js b/dist/assets/calcite-button-tOn16zeN.js deleted file mode 100644 index e2b7d39..0000000 --- a/dist/assets/calcite-button-tOn16zeN.js +++ /dev/null @@ -1,5 +0,0 @@ -import{B as t,d as o}from"./button-dkwNndhL.js";import"./index-J0iiHjMT.js";import"./form-2Iq0hI3D.js";import"./interactive-NKzPUNL4.js";import"./label2-d2vWQ7x7.js";import"./loadable-sxY2K1G3.js";import"./locale-pfkq1d6A.js";import"./key-qdHumIlA.js";import"./observers-JyBmMU24.js";import"./component-dtiBfYiX.js";import"./t9n-od6MEnI1.js";import"./icon-ZwpY5ksA.js";import"./loader-QqciGs1c.js";import"./guid-6vN-YNJI.js";/*! - * All material copyright ESRI, All Rights Reserved, unless otherwise specified. - * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. - * v1.11.0 - */const C=t,E=o;export{C as CalciteButton,E as defineCustomElement}; diff --git a/dist/assets/calcite-checkbox-OaFCWd7i.js b/dist/assets/calcite-checkbox-u3DU2spl.js similarity index 93% rename from dist/assets/calcite-checkbox-OaFCWd7i.js rename to dist/assets/calcite-checkbox-u3DU2spl.js index deb1cf7..b444971 100644 --- a/dist/assets/calcite-checkbox-OaFCWd7i.js +++ b/dist/assets/calcite-checkbox-u3DU2spl.js @@ -1,4 +1,4 @@ -import{q as n,H as a,r as o,t,v as l,x as r}from"./index-J0iiHjMT.js";import{c as h,d,H as u}from"./form-2Iq0hI3D.js";import{g as m}from"./guid-6vN-YNJI.js";import{c as b,d as g,u as p}from"./interactive-NKzPUNL4.js";import{i as k}from"./key-qdHumIlA.js";import{c as f,d as v,g as x}from"./label2-d2vWQ7x7.js";import{c as C,s as y,a as w}from"./loadable-sxY2K1G3.js";/*! +import{p as n,H as a,d as o,k as t,t as l,l as r}from"./index-pCX-0tJH.js";import{c as h,d,H as u}from"./form-1U5Kiwxm.js";import{g as m}from"./guid-6vN-YNJI.js";import{c as b,d as g,u as p}from"./interactive-9W9APeiw.js";import{i as k}from"./key-qdHumIlA.js";import{c as f,d as v,g as x}from"./label2-JXqLMBYY.js";import{c as C,s as y,a as w}from"./loadable-uNbe2Ndt.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-chip-MkTbFpRn.js b/dist/assets/calcite-chip-SaUQXOua.js similarity index 95% rename from dist/assets/calcite-chip-MkTbFpRn.js rename to dist/assets/calcite-chip-SaUQXOua.js index fc81fe7..93275b9 100644 --- a/dist/assets/calcite-chip-MkTbFpRn.js +++ b/dist/assets/calcite-chip-SaUQXOua.js @@ -1,4 +1,4 @@ -import{q as h,H as p,r as s,h7 as u,t,v as o,x as m}from"./index-J0iiHjMT.js";import{c as v,d as g}from"./conditionalSlot-e55zipTI.js";import{a as b,s as f,c as k}from"./loadable-sxY2K1G3.js";import{u as x,c as C,d as y,s as z}from"./t9n-od6MEnI1.js";import{c as I,u as E,d as w}from"./interactive-NKzPUNL4.js";import{c as S,d as M}from"./locale-pfkq1d6A.js";import{c as L}from"./observers-JyBmMU24.js";import{i as H}from"./key-qdHumIlA.js";import{g as a}from"./component-dtiBfYiX.js";import{d as D}from"./icon-ZwpY5ksA.js";/*! +import{p as h,H as p,d as s,h9 as u,k as t,t as o,l as m}from"./index-pCX-0tJH.js";import{c as v,d as g}from"./conditionalSlot-OgY0Ln74.js";import{a as b,s as f,c as k}from"./loadable-uNbe2Ndt.js";import{u as x,c as C,d as y,s as z}from"./t9n-KLe7iM0R.js";import{c as I,u as E,d as w}from"./interactive-9W9APeiw.js";import{c as S,d as M}from"./locale-tKMV0J87.js";import{c as L}from"./observers-eNe735aq.js";import{i as H}from"./key-qdHumIlA.js";import{g as a}from"./component-dtiBfYiX.js";import{d as D}from"./icon-BW6RCrUr.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 @@ -26,4 +26,4 @@ import{q as h,H as p,r as s,h7 as u,t,v as o,x as m}from"./index-J0iiHjMT.js";im * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const W=l,G=r;export{W as CalciteChip,G as defineCustomElement}; + */const q=l,G=r;export{q as CalciteChip,G as defineCustomElement}; diff --git a/dist/assets/calcite-color-picker-iQ658ZQD.js b/dist/assets/calcite-color-picker--cLRGCVy.js similarity index 98% rename from dist/assets/calcite-color-picker-iQ658ZQD.js rename to dist/assets/calcite-color-picker--cLRGCVy.js index 030b7df..ac1be42 100644 --- a/dist/assets/calcite-color-picker-iQ658ZQD.js +++ b/dist/assets/calcite-color-picker--cLRGCVy.js @@ -1,8 +1,8 @@ -import{q as R,H as V,r as y,db as oe,B as X,dc as re,ch as q,t as c,dd as Ze,x as te,ac as Dt,qB as Pt,ad as Te,qC as Qe,j$ as Mt,qD as Ve,v as Rt}from"./index-J0iiHjMT.js";import{a as de,s as he,c as ue}from"./loadable-sxY2K1G3.js";import{d as ie}from"./icon-ZwpY5ksA.js";import{s as et,c as tt,d as it,H as nt}from"./form-2Iq0hI3D.js";import{c as pe,d as be,u as fe}from"./interactive-NKzPUNL4.js";import{n as Vt,i as Nt}from"./key-qdHumIlA.js";import{c as st,d as at,g as ot}from"./label2-d2vWQ7x7.js";import{n as A,i as K,p as Bt,s as $t,a as Kt,c as me,d as ge,B as Wt}from"./locale-pfkq1d6A.js";import{c as J}from"./observers-JyBmMU24.js";import{u as ve,c as ye,d as xe,s as Ce}from"./t9n-od6MEnI1.js";import{g as M}from"./component-dtiBfYiX.js";import{d as we}from"./progress-puB9lhY4.js";import{r as Ne,c as qt,a as _t}from"./math-SoUQJWjz.js";import{d as Ut}from"./button-dkwNndhL.js";import{d as jt}from"./loader-QqciGs1c.js";import{g as rt}from"./guid-6vN-YNJI.js";import{c as Gt,d as Xt}from"./debounce-HnHf1UOZ.js";/*! +import{p as R,H as V,d as y,db as oe,m as X,dc as re,aS as q,k as c,dd as Ze,l as te,X as Dt,qO as Pt,Y as Te,qP as Qe,k6 as Mt,qQ as Ve,t as Rt}from"./index-pCX-0tJH.js";import{a as de,s as he,c as ue}from"./loadable-uNbe2Ndt.js";import{d as ie}from"./icon-BW6RCrUr.js";import{s as et,c as tt,d as it,H as nt}from"./form-1U5Kiwxm.js";import{c as pe,d as be,u as fe}from"./interactive-9W9APeiw.js";import{n as Vt,i as Nt}from"./key-qdHumIlA.js";import{c as st,d as at,g as ot}from"./label2-JXqLMBYY.js";import{n as A,i as K,p as Bt,s as $t,a as Kt,c as me,d as ge,B as Wt}from"./locale-tKMV0J87.js";import{c as Y}from"./observers-eNe735aq.js";import{u as ve,c as ye,d as xe,s as Ce}from"./t9n-KLe7iM0R.js";import{g as M}from"./component-dtiBfYiX.js";import{d as we}from"./progress-TBzcAK5D.js";import{r as Ne,c as qt,a as _t}from"./math-SoUQJWjz.js";import{d as Ut}from"./button-4hsayCiP.js";import{d as jt}from"./loader-plQ4Tft5.js";import{g as rt}from"./guid-6vN-YNJI.js";import{c as Gt,d as Xt}from"./debounce-HnHf1UOZ.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */function lt(e,t,i){return i={path:t,exports:{},require:function(n,s){return Jt()}},e(i,i.exports),i.exports}function Jt(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var Y={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Yt=function(t){return!t||typeof t=="string"?!1:t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&t.constructor.name!=="String")},Z=lt(function(e){var t=Array.prototype.concat,i=Array.prototype.slice,n=e.exports=function(a){for(var o=[],r=0,l=a.length;r=4&&r[3]!==1&&(l=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+l+")"},s.to.keyword=function(r){return i[r.slice(0,3)]};function a(r,l,d){return Math.min(Math.max(l,r),d)}function o(r){var l=Math.round(r).toString(16).toUpperCase();return l.length<2?"0"+l:l}}),ee={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const ct={};for(const e of Object.keys(ee))ct[ee[e]]=e;const h={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var _=h;for(const e of Object.keys(h)){if(!("channels"in h[e]))throw new Error("missing channels property: "+e);if(!("labels"in h[e]))throw new Error("missing channel labels property: "+e);if(h[e].labels.length!==h[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:i}=h[e];delete h[e].channels,delete h[e].labels,Object.defineProperty(h[e],"channels",{value:t}),Object.defineProperty(h[e],"labels",{value:i})}h.rgb.hsl=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.min(t,i,n),a=Math.max(t,i,n),o=a-s;let r,l;a===s?r=0:t===a?r=(i-n)/o:i===a?r=2+(n-t)/o:n===a&&(r=4+(t-i)/o),r=Math.min(r*60,360),r<0&&(r+=360);const d=(s+a)/2;return a===s?l=0:d<=.5?l=o/(a+s):l=o/(2-a-s),[r,l*100,d*100]};h.rgb.hsv=function(e){let t,i,n,s,a;const o=e[0]/255,r=e[1]/255,l=e[2]/255,d=Math.max(o,r,l),u=d-Math.min(o,r,l),f=function(v){return(d-v)/6/u+1/2};return u===0?(s=0,a=0):(a=u/d,t=f(o),i=f(r),n=f(l),o===d?s=n-i:r===d?s=1/3+t-n:l===d&&(s=2/3+i-t),s<0?s+=1:s>1&&(s-=1)),[s*360,a*100,d*100]};h.rgb.hwb=function(e){const t=e[0],i=e[1];let n=e[2];const s=h.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(i,n));return n=1-1/255*Math.max(t,Math.max(i,n)),[s,a*100,n*100]};h.rgb.cmyk=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.min(1-t,1-i,1-n),a=(1-t-s)/(1-s)||0,o=(1-i-s)/(1-s)||0,r=(1-n-s)/(1-s)||0;return[a*100,o*100,r*100,s*100]};function Zt(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}h.rgb.keyword=function(e){const t=ct[e];if(t)return t;let i=1/0,n;for(const s of Object.keys(ee)){const a=ee[s],o=Zt(e,a);o.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;const s=t*.4124+i*.3576+n*.1805,a=t*.2126+i*.7152+n*.0722,o=t*.0193+i*.1192+n*.9505;return[s*100,a*100,o*100]};h.rgb.lab=function(e){const t=h.rgb.xyz(e);let i=t[0],n=t[1],s=t[2];i/=95.047,n/=100,s/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const a=116*n-16,o=500*(i-n),r=200*(n-s);return[a,o,r]};h.hsl.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;let s,a,o;if(i===0)return o=n*255,[o,o,o];n<.5?s=n*(1+i):s=n+i-n*i;const r=2*n-s,l=[0,0,0];for(let d=0;d<3;d++)a=t+1/3*-(d-1),a<0&&a++,a>1&&a--,6*a<1?o=r+(s-r)*6*a:2*a<1?o=s:3*a<2?o=r+(s-r)*(2/3-a)*6:o=r,l[d]=o*255;return l};h.hsl.hsv=function(e){const t=e[0];let i=e[1]/100,n=e[2]/100,s=i;const a=Math.max(n,.01);n*=2,i*=n<=1?n:2-n,s*=a<=1?a:2-a;const o=(n+i)/2,r=n===0?2*s/(a+s):2*i/(n+i);return[t,r*100,o*100]};h.hsv.rgb=function(e){const t=e[0]/60,i=e[1]/100;let n=e[2]/100;const s=Math.floor(t)%6,a=t-Math.floor(t),o=255*n*(1-i),r=255*n*(1-i*a),l=255*n*(1-i*(1-a));switch(n*=255,s){case 0:return[n,l,o];case 1:return[r,n,o];case 2:return[o,n,l];case 3:return[o,r,n];case 4:return[l,o,n];case 5:return[n,o,r]}};h.hsv.hsl=function(e){const t=e[0],i=e[1]/100,n=e[2]/100,s=Math.max(n,.01);let a,o;o=(2-i)*n;const r=(2-i)*s;return a=i*s,a/=r<=1?r:2-r,a=a||0,o/=2,[t,a*100,o*100]};h.hwb.rgb=function(e){const t=e[0]/360;let i=e[1]/100,n=e[2]/100;const s=i+n;let a;s>1&&(i/=s,n/=s);const o=Math.floor(6*t),r=1-n;a=6*t-o,o&1&&(a=1-a);const l=i+a*(r-i);let d,u,f;switch(o){default:case 6:case 0:d=r,u=l,f=i;break;case 1:d=l,u=r,f=i;break;case 2:d=i,u=r,f=l;break;case 3:d=i,u=l,f=r;break;case 4:d=l,u=i,f=r;break;case 5:d=r,u=i,f=l;break}return[d*255,u*255,f*255]};h.cmyk.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100,s=e[3]/100,a=1-Math.min(1,t*(1-s)+s),o=1-Math.min(1,i*(1-s)+s),r=1-Math.min(1,n*(1-s)+s);return[a*255,o*255,r*255]};h.xyz.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100;let s,a,o;return s=t*3.2406+i*-1.5372+n*-.4986,a=t*-.9689+i*1.8758+n*.0415,o=t*.0557+i*-.204+n*1.057,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=Math.min(Math.max(0,s),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[s*255,a*255,o*255]};h.xyz.lab=function(e){let t=e[0],i=e[1],n=e[2];t/=95.047,i/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;const s=116*i-16,a=500*(t-i),o=200*(i-n);return[s,a,o]};h.lab.xyz=function(e){const t=e[0],i=e[1],n=e[2];let s,a,o;a=(t+16)/116,s=i/500+a,o=a-n/200;const r=a**3,l=s**3,d=o**3;return a=r>.008856?r:(a-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,o=d>.008856?d:(o-16/116)/7.787,s*=95.047,a*=100,o*=108.883,[s,a,o]};h.lab.lch=function(e){const t=e[0],i=e[1],n=e[2];let s;s=Math.atan2(n,i)*360/2/Math.PI,s<0&&(s+=360);const o=Math.sqrt(i*i+n*n);return[t,o,s]};h.lch.lab=function(e){const t=e[0],i=e[1],s=e[2]/360*2*Math.PI,a=i*Math.cos(s),o=i*Math.sin(s);return[t,a,o]};h.rgb.ansi16=function(e,t=null){const[i,n,s]=e;let a=t===null?h.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(i/255));return a===2&&(o+=60),o};h.hsv.ansi16=function(e){return h.rgb.ansi16(h.hsv.rgb(e),e[2])};h.rgb.ansi256=function(e){const t=e[0],i=e[1],n=e[2];return t===i&&i===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5)};h.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const i=(~~(e>50)+1)*.5,n=(t&1)*i*255,s=(t>>1&1)*i*255,a=(t>>2&1)*i*255;return[n,s,a]};h.ansi256.rgb=function(e){if(e>=232){const a=(e-232)*10+8;return[a,a,a]}e-=16;let t;const i=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,s=t%6/5*255;return[i,n,s]};h.rgb.hex=function(e){const i=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(i.length)+i};h.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let i=t[0];t[0].length===3&&(i=i.split("").map(r=>r+r).join(""));const n=parseInt(i,16),s=n>>16&255,a=n>>8&255,o=n&255;return[s,a,o]};h.rgb.hcg=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.max(Math.max(t,i),n),a=Math.min(Math.min(t,i),n),o=s-a;let r,l;return o<1?r=a/(1-o):r=0,o<=0?l=0:s===t?l=(i-n)/o%6:s===i?l=2+(n-t)/o:l=4+(t-i)/o,l/=6,l%=1,[l*360,o*100,r*100]};h.hsl.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=i<.5?2*t*i:2*t*(1-i);let s=0;return n<1&&(s=(i-.5*n)/(1-n)),[e[0],n*100,s*100]};h.hsv.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=t*i;let s=0;return n<1&&(s=(i-n)/(1-n)),[e[0],n*100,s*100]};h.hcg.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;if(i===0)return[n*255,n*255,n*255];const s=[0,0,0],a=t%1*6,o=a%1,r=1-o;let l=0;switch(Math.floor(a)){case 0:s[0]=1,s[1]=o,s[2]=0;break;case 1:s[0]=r,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=o;break;case 3:s[0]=0,s[1]=r,s[2]=1;break;case 4:s[0]=o,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=r}return l=(1-i)*n,[(i*s[0]+l)*255,(i*s[1]+l)*255,(i*s[2]+l)*255]};h.hcg.hsv=function(e){const t=e[1]/100,i=e[2]/100,n=t+i*(1-t);let s=0;return n>0&&(s=t/n),[e[0],s*100,n*100]};h.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let s=0;return n>0&&n<.5?s=t/(2*n):n>=.5&&n<1&&(s=t/(2*(1-n))),[e[0],s*100,n*100]};h.hcg.hwb=function(e){const t=e[1]/100,i=e[2]/100,n=t+i*(1-t);return[e[0],(n-t)*100,(1-n)*100]};h.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,s=n-t;let a=0;return s<1&&(a=(n-s)/(1-s)),[e[0],s*100,a*100]};h.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};h.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};h.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};h.gray.hsl=function(e){return[0,0,e[0]]};h.gray.hsv=h.gray.hsl;h.gray.hwb=function(e){return[0,100,e[0]]};h.gray.cmyk=function(e){return[0,0,0,e[0]]};h.gray.lab=function(e){return[e[0],0,0]};h.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n};h.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function Qt(){const e={},t=Object.keys(_);for(let i=t.length,n=0;n1&&(i=n),e(i))};return"conversion"in e&&(t.conversion=e.conversion),t}function oi(e){const t=function(...i){const n=i[0];if(n==null)return n;n.length>1&&(i=n);const s=e(i);if(typeof s=="object")for(let a=s.length,o=0;o{G[e]={},Object.defineProperty(G[e],"channels",{value:_[e].channels}),Object.defineProperty(G[e],"labels",{value:_[e].labels});const t=ni(e);Object.keys(t).forEach(n=>{const s=t[n];G[e][n]=oi(s),G[e][n].raw=ai(s)})});var T=G;const dt=["keyword","gray","hex"],Ee={};for(const e of Object.keys(T))Ee[[...T[e].labels].sort().join("")]=e;const le={};function I(e,t){if(!(this instanceof I))return new I(e,t);if(t&&t in dt&&(t=null),t&&!(t in T))throw new Error("Unknown model: "+t);let i,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof I)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){const s=j.get(e);if(s===null)throw new Error("Unable to parse color from string: "+e);this.model=s.model,n=T[this.model].channels,this.color=s.value.slice(0,n),this.valpha=typeof s.value[n]=="number"?s.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=T[this.model].channels;const s=Array.prototype.slice.call(e,0,n);this.color=ze(s,n),this.valpha=typeof e[n]=="number"?e[n]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;const s=Object.keys(e);"alpha"in e&&(s.splice(s.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);const a=s.sort().join("");if(!(a in Ee))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Ee[a];const{labels:o}=T[this.model],r=[];for(i=0;i(e%360+360)%360),saturationl:C("hsl",1,k(100)),lightness:C("hsl",2,k(100)),saturationv:C("hsv",1,k(100)),value:C("hsv",2,k(100)),chroma:C("hcg",1,k(100)),gray:C("hcg",2,k(100)),white:C("hwb",1,k(100)),wblack:C("hwb",2,k(100)),cyan:C("cmyk",0,k(100)),magenta:C("cmyk",1,k(100)),yellow:C("cmyk",2,k(100)),black:C("cmyk",3,k(100)),x:C("xyz",0,k(95.047)),y:C("xyz",1,k(100)),z:C("xyz",2,k(108.833)),l:C("lab",0,k(100)),a:C("lab",1),b:C("lab",2),keyword(e){return e!==void 0?new I(e):T[this.model].keyword(this.color)},hex(e){return e!==void 0?new I(e):j.to.hex(this.rgb().round().color)},hexa(e){if(e!==void 0)return new I(e);const t=this.rgb().round().color;let i=Math.round(this.valpha*255).toString(16).toUpperCase();return i.length===1&&(i="0"+i),j.to.hex(t)+i},rgbNumber(){const e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){const e=this.rgb().color,t=[];for(const[i,n]of e.entries()){const s=n/255;t[i]=s<=.04045?s/12.92:((s+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),i=e.luminosity();return t>i?(t+.05)/(i+.05):(i+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return I.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let i=t.color[0];return i=(i+e)%360,i=i<0?360+i:i,t.color[0]=i,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const i=e.rgb(),n=this.rgb(),s=t===void 0?.5:t,a=2*s-1,o=i.alpha()-n.alpha(),r=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,l=1-r;return I.rgb(r*i.red()+l*n.red(),r*i.green()+l*n.green(),r*i.blue()+l*n.blue(),i.alpha()*s+n.alpha()*(1-s))}};for(const e of Object.keys(T)){if(dt.includes(e))continue;const{channels:t}=T[e];I.prototype[e]=function(...i){return this.model===e?new I(this):i.length>0?new I(i,e):new I([...ci(T[this.model][e].raw(this.color)),this.valpha],e)},I[e]=function(...i){let n=i[0];return typeof n=="number"&&(n=ze(i,t)),new I(n,e)}}function ri(e,t){return Number(e.toFixed(t))}function li(e){return function(t){return ri(t,e)}}function C(e,t,i){e=Array.isArray(e)?e:[e];for(const n of e)(le[n]||(le[n]=[]))[t]=i;return e=e[0],function(n){let s;return n!==void 0?(i&&(n=i(n)),s=this[e](),s.color[t]=n,s):(s=this[e]().color[t],i&&(s=i(s)),s)}}function k(e){return function(t){return Math.max(0,Math.min(e,t))}}function ci(e){return Array.isArray(e)?e:[e]}function ze(e,t){for(let i=0;i=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&t.constructor.name!=="String")},Z=lt(function(e){var t=Array.prototype.concat,i=Array.prototype.slice,n=e.exports=function(a){for(var o=[],r=0,l=a.length;r=4&&r[3]!==1&&(l=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+l+")"},s.to.keyword=function(r){return i[r.slice(0,3)]};function a(r,l,d){return Math.min(Math.max(l,r),d)}function o(r){var l=Math.round(r).toString(16).toUpperCase();return l.length<2?"0"+l:l}}),ee={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const ct={};for(const e of Object.keys(ee))ct[ee[e]]=e;const h={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var _=h;for(const e of Object.keys(h)){if(!("channels"in h[e]))throw new Error("missing channels property: "+e);if(!("labels"in h[e]))throw new Error("missing channel labels property: "+e);if(h[e].labels.length!==h[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:i}=h[e];delete h[e].channels,delete h[e].labels,Object.defineProperty(h[e],"channels",{value:t}),Object.defineProperty(h[e],"labels",{value:i})}h.rgb.hsl=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.min(t,i,n),a=Math.max(t,i,n),o=a-s;let r,l;a===s?r=0:t===a?r=(i-n)/o:i===a?r=2+(n-t)/o:n===a&&(r=4+(t-i)/o),r=Math.min(r*60,360),r<0&&(r+=360);const d=(s+a)/2;return a===s?l=0:d<=.5?l=o/(a+s):l=o/(2-a-s),[r,l*100,d*100]};h.rgb.hsv=function(e){let t,i,n,s,a;const o=e[0]/255,r=e[1]/255,l=e[2]/255,d=Math.max(o,r,l),u=d-Math.min(o,r,l),f=function(v){return(d-v)/6/u+1/2};return u===0?(s=0,a=0):(a=u/d,t=f(o),i=f(r),n=f(l),o===d?s=n-i:r===d?s=1/3+t-n:l===d&&(s=2/3+i-t),s<0?s+=1:s>1&&(s-=1)),[s*360,a*100,d*100]};h.rgb.hwb=function(e){const t=e[0],i=e[1];let n=e[2];const s=h.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(i,n));return n=1-1/255*Math.max(t,Math.max(i,n)),[s,a*100,n*100]};h.rgb.cmyk=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.min(1-t,1-i,1-n),a=(1-t-s)/(1-s)||0,o=(1-i-s)/(1-s)||0,r=(1-n-s)/(1-s)||0;return[a*100,o*100,r*100,s*100]};function Zt(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}h.rgb.keyword=function(e){const t=ct[e];if(t)return t;let i=1/0,n;for(const s of Object.keys(ee)){const a=ee[s],o=Zt(e,a);o.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;const s=t*.4124+i*.3576+n*.1805,a=t*.2126+i*.7152+n*.0722,o=t*.0193+i*.1192+n*.9505;return[s*100,a*100,o*100]};h.rgb.lab=function(e){const t=h.rgb.xyz(e);let i=t[0],n=t[1],s=t[2];i/=95.047,n/=100,s/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const a=116*n-16,o=500*(i-n),r=200*(n-s);return[a,o,r]};h.hsl.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;let s,a,o;if(i===0)return o=n*255,[o,o,o];n<.5?s=n*(1+i):s=n+i-n*i;const r=2*n-s,l=[0,0,0];for(let d=0;d<3;d++)a=t+1/3*-(d-1),a<0&&a++,a>1&&a--,6*a<1?o=r+(s-r)*6*a:2*a<1?o=s:3*a<2?o=r+(s-r)*(2/3-a)*6:o=r,l[d]=o*255;return l};h.hsl.hsv=function(e){const t=e[0];let i=e[1]/100,n=e[2]/100,s=i;const a=Math.max(n,.01);n*=2,i*=n<=1?n:2-n,s*=a<=1?a:2-a;const o=(n+i)/2,r=n===0?2*s/(a+s):2*i/(n+i);return[t,r*100,o*100]};h.hsv.rgb=function(e){const t=e[0]/60,i=e[1]/100;let n=e[2]/100;const s=Math.floor(t)%6,a=t-Math.floor(t),o=255*n*(1-i),r=255*n*(1-i*a),l=255*n*(1-i*(1-a));switch(n*=255,s){case 0:return[n,l,o];case 1:return[r,n,o];case 2:return[o,n,l];case 3:return[o,r,n];case 4:return[l,o,n];case 5:return[n,o,r]}};h.hsv.hsl=function(e){const t=e[0],i=e[1]/100,n=e[2]/100,s=Math.max(n,.01);let a,o;o=(2-i)*n;const r=(2-i)*s;return a=i*s,a/=r<=1?r:2-r,a=a||0,o/=2,[t,a*100,o*100]};h.hwb.rgb=function(e){const t=e[0]/360;let i=e[1]/100,n=e[2]/100;const s=i+n;let a;s>1&&(i/=s,n/=s);const o=Math.floor(6*t),r=1-n;a=6*t-o,o&1&&(a=1-a);const l=i+a*(r-i);let d,u,f;switch(o){default:case 6:case 0:d=r,u=l,f=i;break;case 1:d=l,u=r,f=i;break;case 2:d=i,u=r,f=l;break;case 3:d=i,u=l,f=r;break;case 4:d=l,u=i,f=r;break;case 5:d=r,u=i,f=l;break}return[d*255,u*255,f*255]};h.cmyk.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100,s=e[3]/100,a=1-Math.min(1,t*(1-s)+s),o=1-Math.min(1,i*(1-s)+s),r=1-Math.min(1,n*(1-s)+s);return[a*255,o*255,r*255]};h.xyz.rgb=function(e){const t=e[0]/100,i=e[1]/100,n=e[2]/100;let s,a,o;return s=t*3.2406+i*-1.5372+n*-.4986,a=t*-.9689+i*1.8758+n*.0415,o=t*.0557+i*-.204+n*1.057,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=Math.min(Math.max(0,s),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[s*255,a*255,o*255]};h.xyz.lab=function(e){let t=e[0],i=e[1],n=e[2];t/=95.047,i/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;const s=116*i-16,a=500*(t-i),o=200*(i-n);return[s,a,o]};h.lab.xyz=function(e){const t=e[0],i=e[1],n=e[2];let s,a,o;a=(t+16)/116,s=i/500+a,o=a-n/200;const r=a**3,l=s**3,d=o**3;return a=r>.008856?r:(a-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,o=d>.008856?d:(o-16/116)/7.787,s*=95.047,a*=100,o*=108.883,[s,a,o]};h.lab.lch=function(e){const t=e[0],i=e[1],n=e[2];let s;s=Math.atan2(n,i)*360/2/Math.PI,s<0&&(s+=360);const o=Math.sqrt(i*i+n*n);return[t,o,s]};h.lch.lab=function(e){const t=e[0],i=e[1],s=e[2]/360*2*Math.PI,a=i*Math.cos(s),o=i*Math.sin(s);return[t,a,o]};h.rgb.ansi16=function(e,t=null){const[i,n,s]=e;let a=t===null?h.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(i/255));return a===2&&(o+=60),o};h.hsv.ansi16=function(e){return h.rgb.ansi16(h.hsv.rgb(e),e[2])};h.rgb.ansi256=function(e){const t=e[0],i=e[1],n=e[2];return t===i&&i===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5)};h.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const i=(~~(e>50)+1)*.5,n=(t&1)*i*255,s=(t>>1&1)*i*255,a=(t>>2&1)*i*255;return[n,s,a]};h.ansi256.rgb=function(e){if(e>=232){const a=(e-232)*10+8;return[a,a,a]}e-=16;let t;const i=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,s=t%6/5*255;return[i,n,s]};h.rgb.hex=function(e){const i=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(i.length)+i};h.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let i=t[0];t[0].length===3&&(i=i.split("").map(r=>r+r).join(""));const n=parseInt(i,16),s=n>>16&255,a=n>>8&255,o=n&255;return[s,a,o]};h.rgb.hcg=function(e){const t=e[0]/255,i=e[1]/255,n=e[2]/255,s=Math.max(Math.max(t,i),n),a=Math.min(Math.min(t,i),n),o=s-a;let r,l;return o<1?r=a/(1-o):r=0,o<=0?l=0:s===t?l=(i-n)/o%6:s===i?l=2+(n-t)/o:l=4+(t-i)/o,l/=6,l%=1,[l*360,o*100,r*100]};h.hsl.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=i<.5?2*t*i:2*t*(1-i);let s=0;return n<1&&(s=(i-.5*n)/(1-n)),[e[0],n*100,s*100]};h.hsv.hcg=function(e){const t=e[1]/100,i=e[2]/100,n=t*i;let s=0;return n<1&&(s=(i-n)/(1-n)),[e[0],n*100,s*100]};h.hcg.rgb=function(e){const t=e[0]/360,i=e[1]/100,n=e[2]/100;if(i===0)return[n*255,n*255,n*255];const s=[0,0,0],a=t%1*6,o=a%1,r=1-o;let l=0;switch(Math.floor(a)){case 0:s[0]=1,s[1]=o,s[2]=0;break;case 1:s[0]=r,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=o;break;case 3:s[0]=0,s[1]=r,s[2]=1;break;case 4:s[0]=o,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=r}return l=(1-i)*n,[(i*s[0]+l)*255,(i*s[1]+l)*255,(i*s[2]+l)*255]};h.hcg.hsv=function(e){const t=e[1]/100,i=e[2]/100,n=t+i*(1-t);let s=0;return n>0&&(s=t/n),[e[0],s*100,n*100]};h.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let s=0;return n>0&&n<.5?s=t/(2*n):n>=.5&&n<1&&(s=t/(2*(1-n))),[e[0],s*100,n*100]};h.hcg.hwb=function(e){const t=e[1]/100,i=e[2]/100,n=t+i*(1-t);return[e[0],(n-t)*100,(1-n)*100]};h.hwb.hcg=function(e){const t=e[1]/100,n=1-e[2]/100,s=n-t;let a=0;return s<1&&(a=(n-s)/(1-s)),[e[0],s*100,a*100]};h.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};h.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};h.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};h.gray.hsl=function(e){return[0,0,e[0]]};h.gray.hsv=h.gray.hsl;h.gray.hwb=function(e){return[0,100,e[0]]};h.gray.cmyk=function(e){return[0,0,0,e[0]]};h.gray.lab=function(e){return[e[0],0,0]};h.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n};h.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function Qt(){const e={},t=Object.keys(_);for(let i=t.length,n=0;n1&&(i=n),e(i))};return"conversion"in e&&(t.conversion=e.conversion),t}function oi(e){const t=function(...i){const n=i[0];if(n==null)return n;n.length>1&&(i=n);const s=e(i);if(typeof s=="object")for(let a=s.length,o=0;o{G[e]={},Object.defineProperty(G[e],"channels",{value:_[e].channels}),Object.defineProperty(G[e],"labels",{value:_[e].labels});const t=ni(e);Object.keys(t).forEach(n=>{const s=t[n];G[e][n]=oi(s),G[e][n].raw=ai(s)})});var T=G;const dt=["keyword","gray","hex"],Ee={};for(const e of Object.keys(T))Ee[[...T[e].labels].sort().join("")]=e;const le={};function I(e,t){if(!(this instanceof I))return new I(e,t);if(t&&t in dt&&(t=null),t&&!(t in T))throw new Error("Unknown model: "+t);let i,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof I)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){const s=j.get(e);if(s===null)throw new Error("Unable to parse color from string: "+e);this.model=s.model,n=T[this.model].channels,this.color=s.value.slice(0,n),this.valpha=typeof s.value[n]=="number"?s.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=T[this.model].channels;const s=Array.prototype.slice.call(e,0,n);this.color=ze(s,n),this.valpha=typeof e[n]=="number"?e[n]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;const s=Object.keys(e);"alpha"in e&&(s.splice(s.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);const a=s.sort().join("");if(!(a in Ee))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=Ee[a];const{labels:o}=T[this.model],r=[];for(i=0;i(e%360+360)%360),saturationl:C("hsl",1,k(100)),lightness:C("hsl",2,k(100)),saturationv:C("hsv",1,k(100)),value:C("hsv",2,k(100)),chroma:C("hcg",1,k(100)),gray:C("hcg",2,k(100)),white:C("hwb",1,k(100)),wblack:C("hwb",2,k(100)),cyan:C("cmyk",0,k(100)),magenta:C("cmyk",1,k(100)),yellow:C("cmyk",2,k(100)),black:C("cmyk",3,k(100)),x:C("xyz",0,k(95.047)),y:C("xyz",1,k(100)),z:C("xyz",2,k(108.833)),l:C("lab",0,k(100)),a:C("lab",1),b:C("lab",2),keyword(e){return e!==void 0?new I(e):T[this.model].keyword(this.color)},hex(e){return e!==void 0?new I(e):j.to.hex(this.rgb().round().color)},hexa(e){if(e!==void 0)return new I(e);const t=this.rgb().round().color;let i=Math.round(this.valpha*255).toString(16).toUpperCase();return i.length===1&&(i="0"+i),j.to.hex(t)+i},rgbNumber(){const e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){const e=this.rgb().color,t=[];for(const[i,n]of e.entries()){const s=n/255;t[i]=s<=.04045?s/12.92:((s+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),i=e.luminosity();return t>i?(t+.05)/(i+.05):(i+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return I.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let i=t.color[0];return i=(i+e)%360,i=i<0?360+i:i,t.color[0]=i,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const i=e.rgb(),n=this.rgb(),s=t===void 0?.5:t,a=2*s-1,o=i.alpha()-n.alpha(),r=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,l=1-r;return I.rgb(r*i.red()+l*n.red(),r*i.green()+l*n.green(),r*i.blue()+l*n.blue(),i.alpha()*s+n.alpha()*(1-s))}};for(const e of Object.keys(T)){if(dt.includes(e))continue;const{channels:t}=T[e];I.prototype[e]=function(...i){return this.model===e?new I(this):i.length>0?new I(i,e):new I([...ci(T[this.model][e].raw(this.color)),this.valpha],e)},I[e]=function(...i){let n=i[0];return typeof n=="number"&&(n=ze(i,t)),new I(n,e)}}function ri(e,t){return Number(e.toFixed(t))}function li(e){return function(t){return ri(t,e)}}function C(e,t,i){e=Array.isArray(e)?e:[e];for(const n of e)(le[n]||(le[n]=[]))[t]=i;return e=e[0],function(n){let s;return n!==void 0?(i&&(n=i(n)),s=this[e](),s.color[t]=n,s):(s=this[e]().color[t],i&&(s=i(s)),s)}}function k(e){return function(t){return Math.max(0,Math.min(e,t))}}function ci(e){return Array.isArray(e)?e:[e]}function ze(e,t){for(let i=0;ithis.setDisabledAction()),this.userChangedValue=!1,this.keyDownHandler=e=>{this.readOnly||this.disabled||(this.isClearable&&e.key==="Escape"&&(this.clearInputValue(e),e.preventDefault()),e.key==="Enter"&&!e.defaultPrevented&&et(this)&&e.preventDefault())},this.clearInputValue=e=>{this.setNumberValue({committing:!0,nativeEvent:e,origin:"user",value:""})},this.emitChangeIfUserModified=()=>{this.previousValueOrigin==="user"&&this.value!==this.previousEmittedNumberValue&&(this.calciteInputNumberChange.emit(),this.setPreviousEmittedNumberValue(this.value))},this.inputNumberBlurHandler=()=>{window.clearInterval(this.nudgeNumberValueIntervalId),this.calciteInternalInputNumberBlur.emit(),this.emitChangeIfUserModified()},this.clickHandler=e=>{if(this.disabled)return;const t=oe(this.el,"action");e.target!==t&&this.setFocus()},this.inputNumberFocusHandler=()=>{this.calciteInternalInputNumberFocus.emit()},this.inputNumberInputHandler=e=>{if(this.disabled||this.readOnly)return;const t=e.target.value;A.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,useGrouping:this.groupSeparator};const i=A.delocalize(t);e.inputType==="insertFromPaste"?((!K(i)||this.integer&&(i.includes("e")||i.includes(".")))&&e.preventDefault(),this.setNumberValue({nativeEvent:e,origin:"user",value:Bt(i)}),this.childNumberEl.value=this.localizedValue):this.setNumberValue({nativeEvent:e,origin:"user",value:i})},this.inputNumberKeyDownHandler=e=>{if(this.disabled||this.readOnly)return;if(e.key==="ArrowUp"){e.preventDefault(),this.nudgeNumberValue("up",e);return}if(e.key==="ArrowDown"){this.nudgeNumberValue("down",e);return}const t=[...Vt,"ArrowLeft","ArrowRight","Backspace","Delete","Enter","Escape","Tab"];if(e.altKey||e.ctrlKey||e.metaKey)return;const i=e.shiftKey&&e.key==="Tab";if(t.includes(e.key)||i){e.key==="Enter"&&this.emitChangeIfUserModified();return}A.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,useGrouping:this.groupSeparator},!(e.key===A.decimal&&!this.integer&&(!this.value&&!this.childNumberEl.value||this.value&&this.childNumberEl.value.indexOf(A.decimal)===-1))&&(/[eE]/.test(e.key)&&!this.integer&&(!this.value&&!this.childNumberEl.value||this.value&&!/[eE]/.test(this.childNumberEl.value))||e.key==="-"&&(!this.value&&!this.childNumberEl.value||this.value&&this.childNumberEl.value.split("-").length<=2)||e.preventDefault())},this.nudgeNumberValue=(e,t)=>{if(t instanceof KeyboardEvent&&t.repeat)return;const i=this.maxString?parseFloat(this.maxString):null,n=this.minString?parseFloat(this.minString):null,s=150;this.incrementOrDecrementNumberValue(e,i,n,t),this.nudgeNumberValueIntervalId&&window.clearInterval(this.nudgeNumberValueIntervalId);let a=!0;this.nudgeNumberValueIntervalId=window.setInterval(()=>{if(a){a=!1;return}this.incrementOrDecrementNumberValue(e,i,n,t)},s)},this.nudgeButtonPointerUpHandler=e=>{X(e)&&window.clearInterval(this.nudgeNumberValueIntervalId)},this.nudgeButtonPointerOutHandler=()=>{window.clearInterval(this.nudgeNumberValueIntervalId)},this.nudgeButtonPointerDownHandler=e=>{if(!X(e))return;e.preventDefault();const t=e.target.dataset.adjustment;this.disabled||this.nudgeNumberValue(t,e)},this.hiddenInputChangeHandler=e=>{e.target.name===this.name&&this.setNumberValue({value:e.target.value,origin:"direct"}),e.stopPropagation()},this.setChildNumberElRef=e=>{this.childNumberEl=e},this.setInputNumberValue=e=>{this.childNumberEl&&(this.childNumberEl.value=e)},this.setPreviousEmittedNumberValue=e=>{this.previousEmittedNumberValue=this.normalizeValue(e)},this.setPreviousNumberValue=e=>{this.previousValue=this.normalizeValue(e)},this.setNumberValue=({committing:e=!1,nativeEvent:t,origin:i,previousValue:n,value:s})=>{var f,v;A.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,useGrouping:this.groupSeparator};const a=((f=this.previousValue)==null?void 0:f.length)>s.length||((v=this.value)==null?void 0:v.length)>s.length,o=this.integer?s.replace(/[e.]/g,""):s,r=o.charAt(o.length-1)===".",l=r&&a?o:$t(o),d=s&&!l?K(this.previousValue)?this.previousValue:"":l;let u=A.localize(d);i!=="connected"&&!r&&(u=Kt(u,d,A)),this.localizedValue=r&&a?`${u}${A.decimal}`:u,this.setPreviousNumberValue(n??this.value),this.previousValueOrigin=i,this.userChangedValue=i==="user"&&this.value!==d,this.value=["-","."].includes(d)?"":d,i==="direct"&&(this.setInputNumberValue(u),this.setPreviousEmittedNumberValue(u)),t&&(this.calciteInputNumberInput.emit().defaultPrevented?(this.value=this.previousValue,this.localizedValue=A.localize(this.previousValue)):e&&this.emitChangeIfUserModified())},this.inputNumberKeyUpHandler=()=>{window.clearInterval(this.nudgeNumberValueIntervalId)},this.alignment="start",this.autofocus=!1,this.clearable=!1,this.disabled=!1,this.form=void 0,this.groupSeparator=!1,this.hidden=!1,this.icon=void 0,this.iconFlipRtl=!1,this.integer=!1,this.label=void 0,this.loading=!1,this.numberingSystem=void 0,this.localeFormat=!1,this.max=void 0,this.min=void 0,this.maxLength=void 0,this.minLength=void 0,this.name=void 0,this.numberButtonType="vertical",this.placeholder=void 0,this.prefixText=void 0,this.readOnly=!1,this.required=!1,this.scale="m",this.status="idle",this.step=void 0,this.autocomplete=void 0,this.inputMode="decimal",this.enterKeyHint=void 0,this.suffixText=void 0,this.editingEnabled=!1,this.value="",this.messages=void 0,this.messageOverrides=void 0,this.effectiveLocale="",this.defaultMessages=void 0,this.localizedValue=void 0,this.slottedActionElDisabledInternally=!1}disabledWatcher(){this.setDisabledAction()}maxWatcher(){var e;this.maxString=((e=this.max)==null?void 0:e.toString())||null}minWatcher(){var e;this.minString=((e=this.min)==null?void 0:e.toString())||null}onMessagesChange(){}valueWatcher(e,t){this.userChangedValue||(this.setNumberValue({origin:"direct",previousValue:t,value:e==null||e==""?"":K(e)?e:this.previousValue||""}),this.warnAboutInvalidNumberValue(e)),this.userChangedValue=!1}updateRequestedIcon(){this.requestedIcon=re({},this.icon,"number")}get isClearable(){return this.clearable&&this.value.length>0}effectiveLocaleWatcher(e){ve(this,this.effectiveLocale),A.numberFormatOptions={locale:e,numberingSystem:this.numberingSystem,useGrouping:!1}}connectedCallback(){var e;pe(this),me(this),ye(this),this.inlineEditableEl=this.el.closest("calcite-inline-editable"),this.inlineEditableEl&&(this.editingEnabled=this.inlineEditableEl.editingEnabled||!1),st(this),tt(this),this.setPreviousEmittedNumberValue(this.value),this.setPreviousNumberValue(this.value),this.warnAboutInvalidNumberValue(this.value),this.setNumberValue({origin:"connected",value:K(this.value)?this.value:""}),(e=this.mutationObserver)==null||e.observe(this.el,{childList:!0}),this.setDisabledAction(),this.el.addEventListener("calciteInternalHiddenInputChange",this.hiddenInputChangeHandler)}componentDidLoad(){de(this)}disconnectedCallback(){var e;be(this),at(this),it(this),ge(this),xe(this),(e=this.mutationObserver)==null||e.disconnect(),this.el.removeEventListener("calciteInternalHiddenInputChange",this.hiddenInputChangeHandler)}async componentWillLoad(){var e,t;he(this),this.maxString=(e=this.max)==null?void 0:e.toString(),this.minString=(t=this.min)==null?void 0:t.toString(),this.requestedIcon=re({},this.icon,"number"),await Ce(this)}componentShouldUpdate(e,t,i){return i==="value"&&e&&!K(e)?(this.setNumberValue({origin:"reset",value:t}),!1):!0}componentDidRender(){fe(this)}async setFocus(){var e;await ue(this),(e=this.childNumberEl)==null||e.focus()}async selectText(){var e;(e=this.childNumberEl)==null||e.select()}onLabelClick(){this.setFocus()}incrementOrDecrementNumberValue(e,t,i,n){const{value:s}=this,a=e==="up"?1:-1,o=this.integer&&this.step!=="any"?Math.round(this.step):this.step,r=o==="any"?1:Math.abs(o||1),d=new Wt(s!==""?s:"0").add(`${r*a}`),u=()=>typeof i=="number"&&!isNaN(i)&&d.subtract(`${i}`).isNegative,f=()=>typeof t=="number"&&!isNaN(t)&&!d.subtract(`${t}`).isNegative,v=u()?`${i}`:f()?`${t}`:d.toString();this.setNumberValue({committing:!0,nativeEvent:n,origin:"user",value:v})}onFormReset(){this.setNumberValue({origin:"reset",value:this.defaultValue})}syncHiddenFormInput(e){var t,i;e.type="number",e.min=((t=this.min)==null?void 0:t.toString(10))??"",e.max=((i=this.max)==null?void 0:i.toString(10))??""}setDisabledAction(){const e=oe(this.el,"action");e&&(this.disabled?(e.getAttribute("disabled")==null&&(this.slottedActionElDisabledInternally=!0),e.setAttribute("disabled","")):this.slottedActionElDisabledInternally&&(e.removeAttribute("disabled"),this.slottedActionElDisabledInternally=!1))}normalizeValue(e){return K(e)?e:""}warnAboutInvalidNumberValue(e){e&&!K(e)&&console.warn(`The specified value "${e}" cannot be parsed, or is out of range.`)}render(){const e=q(this.el),t=c("div",{class:S.loader},c("calcite-progress",{label:this.messages.loading,type:"indeterminate"})),i=c("button",{"aria-label":this.messages.clear,class:S.clearButton,disabled:this.disabled||this.readOnly,onClick:this.clearInputValue,tabIndex:-1,type:"button"},c("calcite-icon",{icon:"x",scale:M(this.scale)})),n=c("calcite-icon",{class:S.inputIcon,flipRtl:this.iconFlipRtl,icon:this.requestedIcon,scale:M(this.scale)}),s=this.numberButtonType==="horizontal",a=c("button",{"aria-hidden":"true",class:{[S.numberButtonItem]:!0,[S.buttonItemHorizontal]:s},"data-adjustment":"up",disabled:this.disabled||this.readOnly,onPointerDown:this.nudgeButtonPointerDownHandler,onPointerOut:this.nudgeButtonPointerOutHandler,onPointerUp:this.nudgeButtonPointerUpHandler,tabIndex:-1,type:"button"},c("calcite-icon",{icon:"chevron-up",scale:M(this.scale)})),o=c("button",{"aria-hidden":"true",class:{[S.numberButtonItem]:!0,[S.buttonItemHorizontal]:s},"data-adjustment":"down",disabled:this.disabled||this.readOnly,onPointerDown:this.nudgeButtonPointerDownHandler,onPointerOut:this.nudgeButtonPointerOutHandler,onPointerUp:this.nudgeButtonPointerUpHandler,tabIndex:-1,type:"button"},c("calcite-icon",{icon:"chevron-down",scale:M(this.scale)})),r=c("div",{class:S.numberButtonWrapper},a,o),l=c("div",{class:S.prefix},this.prefixText),d=c("div",{class:S.suffix},this.suffixText),u=c("input",{"aria-label":ot(this),autocomplete:this.autocomplete,autofocus:this.autofocus?!0:null,defaultValue:this.defaultValue,disabled:this.disabled?!0:null,enterKeyHint:this.enterKeyHint,inputMode:this.inputMode,key:"localized-input",maxLength:this.maxLength,minLength:this.minLength,name:void 0,onBlur:this.inputNumberBlurHandler,onFocus:this.inputNumberFocusHandler,onInput:this.inputNumberInputHandler,onKeyDown:this.inputNumberKeyDownHandler,onKeyUp:this.inputNumberKeyUpHandler,placeholder:this.placeholder||"",readOnly:this.readOnly,type:"text",value:this.localizedValue,ref:this.setChildNumberElRef});return c(te,{onClick:this.clickHandler,onKeyDown:this.keyDownHandler},c("div",{class:{[S.inputWrapper]:!0,[Ze.rtl]:e==="rtl"}},this.numberButtonType==="horizontal"&&!this.readOnly?o:null,this.prefixText?l:null,c("div",{class:S.wrapper},u,this.isClearable?i:null,this.requestedIcon?n:null,this.loading?t:null),c("div",{class:S.actionWrapper},c("slot",{name:vi.action})),this.numberButtonType==="vertical"&&!this.readOnly?r:null,this.suffixText?d:null,this.numberButtonType==="horizontal"&&!this.readOnly?a:null,c(nt,{component:this})))}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{disabled:["disabledWatcher"],max:["maxWatcher"],min:["minWatcher"],messageOverrides:["onMessagesChange"],value:["valueWatcher"],icon:["updateRequestedIcon"],effectiveLocale:["effectiveLocaleWatcher"]}}static get style(){return yi}},[1,"calcite-input-number",{alignment:[513],autofocus:[516],clearable:[516],disabled:[516],form:[513],groupSeparator:[516,"group-separator"],hidden:[516],icon:[520],iconFlipRtl:[516,"icon-flip-rtl"],integer:[4],label:[1],loading:[516],numberingSystem:[513,"numbering-system"],localeFormat:[4,"locale-format"],max:[514],min:[514],maxLength:[514,"max-length"],minLength:[514,"min-length"],name:[513],numberButtonType:[513,"number-button-type"],placeholder:[1],prefixText:[1,"prefix-text"],readOnly:[516,"read-only"],required:[516],scale:[513],status:[513],step:[520],autocomplete:[1],inputMode:[1,"input-mode"],enterKeyHint:[1,"enter-key-hint"],suffixText:[1,"suffix-text"],editingEnabled:[1540,"editing-enabled"],value:[1025],messages:[1040],messageOverrides:[1040],effectiveLocale:[32],defaultMessages:[32],localizedValue:[32],slottedActionElDisabledInternally:[32],setFocus:[64],selectText:[64]}]);function Fe(){if(typeof customElements>"u")return;["calcite-input-number","calcite-icon","calcite-progress"].forEach(t=>{switch(t){case"calcite-input-number":customElements.get(t)||customElements.define(t,xi);break;case"calcite-icon":customElements.get(t)||ie();break;case"calcite-progress":customElements.get(t)||we();break}})}Fe();/*! + )}.clear-button:disabled{opacity:var(--calcite-ui-opacity-disabled)}.loader{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}.action-wrapper{order:7;display:flex}.prefix,.suffix{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;user-select:none;align-content:center;align-items:center;overflow-wrap:break-word;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium);line-height:1;color:var(--calcite-ui-text-2)}.prefix{order:2;border-inline-end-width:0px}.suffix{order:5;border-inline-start-width:0px}:host([alignment=start]) input{text-align:start}:host([alignment=end]) input{text-align:end}.number-button-wrapper{pointer-events:none;order:6;box-sizing:border-box;display:flex;flex-direction:column;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}:host([number-button-type=vertical]) .wrapper{flex-direction:row;display:flex}:host([number-button-type=vertical]) input{order:2}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=down] calcite-icon{transform:rotate(-90deg)}:host([number-button-type=horizontal]) .calcite--rtl .number-button-item[data-adjustment=up] calcite-icon{transform:rotate(-90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down],.number-button-item.number-button-item--horizontal[data-adjustment=up]{order:1;max-block-size:100%;min-block-size:100%;align-self:stretch}.number-button-item.number-button-item--horizontal[data-adjustment=down] calcite-icon,.number-button-item.number-button-item--horizontal[data-adjustment=up] calcite-icon{transform:rotate(90deg)}.number-button-item.number-button-item--horizontal[data-adjustment=down]{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);border-inline-end-width:0px}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item.number-button-item--horizontal[data-adjustment=up]{order:5}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}.number-button-item.number-button-item--horizontal[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover{background-color:var(--calcite-ui-foreground-2)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=up]:hover calcite-icon{color:var(--calcite-ui-text-1)}:host([number-button-type=vertical]) .number-button-item[data-adjustment=down]{border-block-start-width:0px}.number-button-item{max-block-size:50%;min-block-size:50%;pointer-events:initial;margin:0px;box-sizing:border-box;display:flex;cursor:pointer;align-items:center;align-self:center;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);padding-block:0px;padding-inline:0.5rem;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-inline-start-width:0px}.number-button-item calcite-icon{pointer-events:none;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.number-button-item:focus{background-color:var(--calcite-ui-foreground-2)}.number-button-item:focus calcite-icon{color:var(--calcite-ui-text-1)}.number-button-item:active{background-color:var(--calcite-ui-foreground-3)}.number-button-item:disabled{pointer-events:none}.wrapper{position:relative;display:flex;flex-direction:row;align-items:center}:host(.no-bottom-border) input{border-block-end-width:0px}:host(.border-top-color-one) input{border-block-start-color:var(--calcite-ui-border-1)}.inline-child{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.inline-child .editing-enabled{background-color:inherit}.inline-child:not(.editing-enabled){display:flex;cursor:pointer;border-color:transparent;padding-inline-start:0}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}`,xi=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteInternalInputNumberFocus=y(this,"calciteInternalInputNumberFocus",6),this.calciteInternalInputNumberBlur=y(this,"calciteInternalInputNumberBlur",6),this.calciteInputNumberInput=y(this,"calciteInputNumberInput",7),this.calciteInputNumberChange=y(this,"calciteInputNumberChange",6),this.previousValueOrigin="initial",this.mutationObserver=Y("mutation",()=>this.setDisabledAction()),this.userChangedValue=!1,this.keyDownHandler=e=>{this.readOnly||this.disabled||(this.isClearable&&e.key==="Escape"&&(this.clearInputValue(e),e.preventDefault()),e.key==="Enter"&&!e.defaultPrevented&&et(this)&&e.preventDefault())},this.clearInputValue=e=>{this.setNumberValue({committing:!0,nativeEvent:e,origin:"user",value:""})},this.emitChangeIfUserModified=()=>{this.previousValueOrigin==="user"&&this.value!==this.previousEmittedNumberValue&&(this.calciteInputNumberChange.emit(),this.setPreviousEmittedNumberValue(this.value))},this.inputNumberBlurHandler=()=>{window.clearInterval(this.nudgeNumberValueIntervalId),this.calciteInternalInputNumberBlur.emit(),this.emitChangeIfUserModified()},this.clickHandler=e=>{if(this.disabled)return;const t=oe(this.el,"action");e.target!==t&&this.setFocus()},this.inputNumberFocusHandler=()=>{this.calciteInternalInputNumberFocus.emit()},this.inputNumberInputHandler=e=>{if(this.disabled||this.readOnly)return;const t=e.target.value;A.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,useGrouping:this.groupSeparator};const i=A.delocalize(t);e.inputType==="insertFromPaste"?((!K(i)||this.integer&&(i.includes("e")||i.includes(".")))&&e.preventDefault(),this.setNumberValue({nativeEvent:e,origin:"user",value:Bt(i)}),this.childNumberEl.value=this.localizedValue):this.setNumberValue({nativeEvent:e,origin:"user",value:i})},this.inputNumberKeyDownHandler=e=>{if(this.disabled||this.readOnly)return;if(e.key==="ArrowUp"){e.preventDefault(),this.nudgeNumberValue("up",e);return}if(e.key==="ArrowDown"){this.nudgeNumberValue("down",e);return}const t=[...Vt,"ArrowLeft","ArrowRight","Backspace","Delete","Enter","Escape","Tab"];if(e.altKey||e.ctrlKey||e.metaKey)return;const i=e.shiftKey&&e.key==="Tab";if(t.includes(e.key)||i){e.key==="Enter"&&this.emitChangeIfUserModified();return}A.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,useGrouping:this.groupSeparator},!(e.key===A.decimal&&!this.integer&&(!this.value&&!this.childNumberEl.value||this.value&&this.childNumberEl.value.indexOf(A.decimal)===-1))&&(/[eE]/.test(e.key)&&!this.integer&&(!this.value&&!this.childNumberEl.value||this.value&&!/[eE]/.test(this.childNumberEl.value))||e.key==="-"&&(!this.value&&!this.childNumberEl.value||this.value&&this.childNumberEl.value.split("-").length<=2)||e.preventDefault())},this.nudgeNumberValue=(e,t)=>{if(t instanceof KeyboardEvent&&t.repeat)return;const i=this.maxString?parseFloat(this.maxString):null,n=this.minString?parseFloat(this.minString):null,s=150;this.incrementOrDecrementNumberValue(e,i,n,t),this.nudgeNumberValueIntervalId&&window.clearInterval(this.nudgeNumberValueIntervalId);let a=!0;this.nudgeNumberValueIntervalId=window.setInterval(()=>{if(a){a=!1;return}this.incrementOrDecrementNumberValue(e,i,n,t)},s)},this.nudgeButtonPointerUpHandler=e=>{X(e)&&window.clearInterval(this.nudgeNumberValueIntervalId)},this.nudgeButtonPointerOutHandler=()=>{window.clearInterval(this.nudgeNumberValueIntervalId)},this.nudgeButtonPointerDownHandler=e=>{if(!X(e))return;e.preventDefault();const t=e.target.dataset.adjustment;this.disabled||this.nudgeNumberValue(t,e)},this.hiddenInputChangeHandler=e=>{e.target.name===this.name&&this.setNumberValue({value:e.target.value,origin:"direct"}),e.stopPropagation()},this.setChildNumberElRef=e=>{this.childNumberEl=e},this.setInputNumberValue=e=>{this.childNumberEl&&(this.childNumberEl.value=e)},this.setPreviousEmittedNumberValue=e=>{this.previousEmittedNumberValue=this.normalizeValue(e)},this.setPreviousNumberValue=e=>{this.previousValue=this.normalizeValue(e)},this.setNumberValue=({committing:e=!1,nativeEvent:t,origin:i,previousValue:n,value:s})=>{var f,v;A.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,useGrouping:this.groupSeparator};const a=((f=this.previousValue)==null?void 0:f.length)>s.length||((v=this.value)==null?void 0:v.length)>s.length,o=this.integer?s.replace(/[e.]/g,""):s,r=o.charAt(o.length-1)===".",l=r&&a?o:$t(o),d=s&&!l?K(this.previousValue)?this.previousValue:"":l;let u=A.localize(d);i!=="connected"&&!r&&(u=Kt(u,d,A)),this.localizedValue=r&&a?`${u}${A.decimal}`:u,this.setPreviousNumberValue(n??this.value),this.previousValueOrigin=i,this.userChangedValue=i==="user"&&this.value!==d,this.value=["-","."].includes(d)?"":d,i==="direct"&&(this.setInputNumberValue(u),this.setPreviousEmittedNumberValue(u)),t&&(this.calciteInputNumberInput.emit().defaultPrevented?(this.value=this.previousValue,this.localizedValue=A.localize(this.previousValue)):e&&this.emitChangeIfUserModified())},this.inputNumberKeyUpHandler=()=>{window.clearInterval(this.nudgeNumberValueIntervalId)},this.alignment="start",this.autofocus=!1,this.clearable=!1,this.disabled=!1,this.form=void 0,this.groupSeparator=!1,this.hidden=!1,this.icon=void 0,this.iconFlipRtl=!1,this.integer=!1,this.label=void 0,this.loading=!1,this.numberingSystem=void 0,this.localeFormat=!1,this.max=void 0,this.min=void 0,this.maxLength=void 0,this.minLength=void 0,this.name=void 0,this.numberButtonType="vertical",this.placeholder=void 0,this.prefixText=void 0,this.readOnly=!1,this.required=!1,this.scale="m",this.status="idle",this.step=void 0,this.autocomplete=void 0,this.inputMode="decimal",this.enterKeyHint=void 0,this.suffixText=void 0,this.editingEnabled=!1,this.value="",this.messages=void 0,this.messageOverrides=void 0,this.effectiveLocale="",this.defaultMessages=void 0,this.localizedValue=void 0,this.slottedActionElDisabledInternally=!1}disabledWatcher(){this.setDisabledAction()}maxWatcher(){var e;this.maxString=((e=this.max)==null?void 0:e.toString())||null}minWatcher(){var e;this.minString=((e=this.min)==null?void 0:e.toString())||null}onMessagesChange(){}valueWatcher(e,t){this.userChangedValue||(this.setNumberValue({origin:"direct",previousValue:t,value:e==null||e==""?"":K(e)?e:this.previousValue||""}),this.warnAboutInvalidNumberValue(e)),this.userChangedValue=!1}updateRequestedIcon(){this.requestedIcon=re({},this.icon,"number")}get isClearable(){return this.clearable&&this.value.length>0}effectiveLocaleWatcher(e){ve(this,this.effectiveLocale),A.numberFormatOptions={locale:e,numberingSystem:this.numberingSystem,useGrouping:!1}}connectedCallback(){var e;pe(this),me(this),ye(this),this.inlineEditableEl=this.el.closest("calcite-inline-editable"),this.inlineEditableEl&&(this.editingEnabled=this.inlineEditableEl.editingEnabled||!1),st(this),tt(this),this.setPreviousEmittedNumberValue(this.value),this.setPreviousNumberValue(this.value),this.warnAboutInvalidNumberValue(this.value),this.setNumberValue({origin:"connected",value:K(this.value)?this.value:""}),(e=this.mutationObserver)==null||e.observe(this.el,{childList:!0}),this.setDisabledAction(),this.el.addEventListener("calciteInternalHiddenInputChange",this.hiddenInputChangeHandler)}componentDidLoad(){de(this)}disconnectedCallback(){var e;be(this),at(this),it(this),ge(this),xe(this),(e=this.mutationObserver)==null||e.disconnect(),this.el.removeEventListener("calciteInternalHiddenInputChange",this.hiddenInputChangeHandler)}async componentWillLoad(){var e,t;he(this),this.maxString=(e=this.max)==null?void 0:e.toString(),this.minString=(t=this.min)==null?void 0:t.toString(),this.requestedIcon=re({},this.icon,"number"),await Ce(this)}componentShouldUpdate(e,t,i){return i==="value"&&e&&!K(e)?(this.setNumberValue({origin:"reset",value:t}),!1):!0}componentDidRender(){fe(this)}async setFocus(){var e;await ue(this),(e=this.childNumberEl)==null||e.focus()}async selectText(){var e;(e=this.childNumberEl)==null||e.select()}onLabelClick(){this.setFocus()}incrementOrDecrementNumberValue(e,t,i,n){const{value:s}=this,a=e==="up"?1:-1,o=this.integer&&this.step!=="any"?Math.round(this.step):this.step,r=o==="any"?1:Math.abs(o||1),d=new Wt(s!==""?s:"0").add(`${r*a}`),u=()=>typeof i=="number"&&!isNaN(i)&&d.subtract(`${i}`).isNegative,f=()=>typeof t=="number"&&!isNaN(t)&&!d.subtract(`${t}`).isNegative,v=u()?`${i}`:f()?`${t}`:d.toString();this.setNumberValue({committing:!0,nativeEvent:n,origin:"user",value:v})}onFormReset(){this.setNumberValue({origin:"reset",value:this.defaultValue})}syncHiddenFormInput(e){var t,i;e.type="number",e.min=((t=this.min)==null?void 0:t.toString(10))??"",e.max=((i=this.max)==null?void 0:i.toString(10))??""}setDisabledAction(){const e=oe(this.el,"action");e&&(this.disabled?(e.getAttribute("disabled")==null&&(this.slottedActionElDisabledInternally=!0),e.setAttribute("disabled","")):this.slottedActionElDisabledInternally&&(e.removeAttribute("disabled"),this.slottedActionElDisabledInternally=!1))}normalizeValue(e){return K(e)?e:""}warnAboutInvalidNumberValue(e){e&&!K(e)&&console.warn(`The specified value "${e}" cannot be parsed, or is out of range.`)}render(){const e=q(this.el),t=c("div",{class:S.loader},c("calcite-progress",{label:this.messages.loading,type:"indeterminate"})),i=c("button",{"aria-label":this.messages.clear,class:S.clearButton,disabled:this.disabled||this.readOnly,onClick:this.clearInputValue,tabIndex:-1,type:"button"},c("calcite-icon",{icon:"x",scale:M(this.scale)})),n=c("calcite-icon",{class:S.inputIcon,flipRtl:this.iconFlipRtl,icon:this.requestedIcon,scale:M(this.scale)}),s=this.numberButtonType==="horizontal",a=c("button",{"aria-hidden":"true",class:{[S.numberButtonItem]:!0,[S.buttonItemHorizontal]:s},"data-adjustment":"up",disabled:this.disabled||this.readOnly,onPointerDown:this.nudgeButtonPointerDownHandler,onPointerOut:this.nudgeButtonPointerOutHandler,onPointerUp:this.nudgeButtonPointerUpHandler,tabIndex:-1,type:"button"},c("calcite-icon",{icon:"chevron-up",scale:M(this.scale)})),o=c("button",{"aria-hidden":"true",class:{[S.numberButtonItem]:!0,[S.buttonItemHorizontal]:s},"data-adjustment":"down",disabled:this.disabled||this.readOnly,onPointerDown:this.nudgeButtonPointerDownHandler,onPointerOut:this.nudgeButtonPointerOutHandler,onPointerUp:this.nudgeButtonPointerUpHandler,tabIndex:-1,type:"button"},c("calcite-icon",{icon:"chevron-down",scale:M(this.scale)})),r=c("div",{class:S.numberButtonWrapper},a,o),l=c("div",{class:S.prefix},this.prefixText),d=c("div",{class:S.suffix},this.suffixText),u=c("input",{"aria-label":ot(this),autocomplete:this.autocomplete,autofocus:this.autofocus?!0:null,defaultValue:this.defaultValue,disabled:this.disabled?!0:null,enterKeyHint:this.enterKeyHint,inputMode:this.inputMode,key:"localized-input",maxLength:this.maxLength,minLength:this.minLength,name:void 0,onBlur:this.inputNumberBlurHandler,onFocus:this.inputNumberFocusHandler,onInput:this.inputNumberInputHandler,onKeyDown:this.inputNumberKeyDownHandler,onKeyUp:this.inputNumberKeyUpHandler,placeholder:this.placeholder||"",readOnly:this.readOnly,type:"text",value:this.localizedValue,ref:this.setChildNumberElRef});return c(te,{onClick:this.clickHandler,onKeyDown:this.keyDownHandler},c("div",{class:{[S.inputWrapper]:!0,[Ze.rtl]:e==="rtl"}},this.numberButtonType==="horizontal"&&!this.readOnly?o:null,this.prefixText?l:null,c("div",{class:S.wrapper},u,this.isClearable?i:null,this.requestedIcon?n:null,this.loading?t:null),c("div",{class:S.actionWrapper},c("slot",{name:vi.action})),this.numberButtonType==="vertical"&&!this.readOnly?r:null,this.suffixText?d:null,this.numberButtonType==="horizontal"&&!this.readOnly?a:null,c(nt,{component:this})))}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{disabled:["disabledWatcher"],max:["maxWatcher"],min:["minWatcher"],messageOverrides:["onMessagesChange"],value:["valueWatcher"],icon:["updateRequestedIcon"],effectiveLocale:["effectiveLocaleWatcher"]}}static get style(){return yi}},[1,"calcite-input-number",{alignment:[513],autofocus:[516],clearable:[516],disabled:[516],form:[513],groupSeparator:[516,"group-separator"],hidden:[516],icon:[520],iconFlipRtl:[516,"icon-flip-rtl"],integer:[4],label:[1],loading:[516],numberingSystem:[513,"numbering-system"],localeFormat:[4,"locale-format"],max:[514],min:[514],maxLength:[514,"max-length"],minLength:[514,"min-length"],name:[513],numberButtonType:[513,"number-button-type"],placeholder:[1],prefixText:[1,"prefix-text"],readOnly:[516,"read-only"],required:[516],scale:[513],status:[513],step:[520],autocomplete:[1],inputMode:[1,"input-mode"],enterKeyHint:[1,"enter-key-hint"],suffixText:[1,"suffix-text"],editingEnabled:[1540,"editing-enabled"],value:[1025],messages:[1040],messageOverrides:[1040],effectiveLocale:[32],defaultMessages:[32],localizedValue:[32],slottedActionElDisabledInternally:[32],setFocus:[64],selectText:[64]}]);function Fe(){if(typeof customElements>"u")return;["calcite-input-number","calcite-icon","calcite-progress"].forEach(t=>{switch(t){case"calcite-input-number":customElements.get(t)||customElements.define(t,xi);break;case"calcite-icon":customElements.get(t)||ie();break;case"calcite-progress":customElements.get(t)||we();break}})}Fe();/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 @@ -74,7 +74,7 @@ import{q as R,H as V,r as y,db as oe,B as X,dc as re,ch as q,t as c,dd as Ze,x a 1 ) ) - )}.clear-button:disabled{opacity:var(--calcite-ui-opacity-disabled)}.loader{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}.action-wrapper{order:7;display:flex}.prefix,.suffix{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;user-select:none;align-content:center;align-items:center;overflow-wrap:break-word;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium);line-height:1;color:var(--calcite-ui-text-2)}.prefix{order:2;border-inline-end-width:0px}.suffix{order:5;border-inline-start-width:0px}:host([alignment=start]) input{text-align:start}:host([alignment=end]) input{text-align:end}.wrapper{position:relative;display:flex;flex-direction:row;align-items:center}:host(.no-bottom-border) input{border-block-end-width:0px}:host(.border-top-color-one) input{border-block-start-color:var(--calcite-ui-border-1)}.inline-child{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.inline-child .editing-enabled{background-color:inherit}.inline-child:not(.editing-enabled){display:flex;cursor:pointer;border-color:transparent;padding-inline-start:0}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}`,ki=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteInternalInputTextFocus=y(this,"calciteInternalInputTextFocus",7),this.calciteInternalInputTextBlur=y(this,"calciteInternalInputTextBlur",7),this.calciteInputTextInput=y(this,"calciteInputTextInput",7),this.calciteInputTextChange=y(this,"calciteInputTextChange",7),this.previousValueOrigin="initial",this.mutationObserver=J("mutation",()=>this.setDisabledAction()),this.userChangedValue=!1,this.keyDownHandler=e=>{this.readOnly||this.disabled||(this.isClearable&&e.key==="Escape"&&(this.clearInputTextValue(e),e.preventDefault()),e.key==="Enter"&&!e.defaultPrevented&&et(this)&&e.preventDefault())},this.clearInputTextValue=e=>{this.setValue({committing:!0,nativeEvent:e,origin:"user",value:""})},this.emitChangeIfUserModified=()=>{this.previousValueOrigin==="user"&&this.value!==this.previousEmittedValue&&(this.calciteInputTextChange.emit(),this.setPreviousEmittedValue(this.value))},this.inputTextBlurHandler=()=>{this.calciteInternalInputTextBlur.emit({element:this.childEl,value:this.value}),this.emitChangeIfUserModified()},this.clickHandler=e=>{if(this.disabled)return;const t=oe(this.el,"action");e.target!==t&&this.setFocus()},this.inputTextFocusHandler=()=>{this.calciteInternalInputTextFocus.emit({element:this.childEl,value:this.value})},this.inputTextInputHandler=e=>{this.disabled||this.readOnly||this.setValue({nativeEvent:e,origin:"user",value:e.target.value})},this.inputTextKeyDownHandler=e=>{this.disabled||this.readOnly||e.key==="Enter"&&this.emitChangeIfUserModified()},this.hiddenInputChangeHandler=e=>{e.target.name===this.name&&this.setValue({value:e.target.value,origin:"direct"}),e.stopPropagation()},this.setChildElRef=e=>{this.childEl=e},this.setInputValue=e=>{this.childEl&&(this.childEl.value=e)},this.setPreviousEmittedValue=e=>{this.previousEmittedValue=e},this.setPreviousValue=e=>{this.previousValue=e},this.setValue=({committing:e=!1,nativeEvent:t,origin:i,previousValue:n,value:s})=>{this.setPreviousValue(n??this.value),this.previousValueOrigin=i,this.userChangedValue=i==="user"&&s!==this.value,this.value=s,i==="direct"&&(this.setInputValue(s),this.setPreviousEmittedValue(s)),t&&(this.calciteInputTextInput.emit().defaultPrevented?this.value=this.previousValue:e&&this.emitChangeIfUserModified())},this.alignment="start",this.autofocus=!1,this.clearable=!1,this.disabled=!1,this.form=void 0,this.hidden=!1,this.icon=void 0,this.iconFlipRtl=!1,this.label=void 0,this.loading=!1,this.maxLength=void 0,this.minLength=void 0,this.name=void 0,this.placeholder=void 0,this.prefixText=void 0,this.readOnly=!1,this.required=!1,this.scale="m",this.status="idle",this.autocomplete=void 0,this.inputMode="text",this.enterKeyHint=void 0,this.pattern=void 0,this.suffixText=void 0,this.editingEnabled=!1,this.value="",this.messages=void 0,this.messageOverrides=void 0,this.effectiveLocale=void 0,this.defaultMessages=void 0,this.slottedActionElDisabledInternally=!1}disabledWatcher(){this.setDisabledAction()}onMessagesChange(){}valueWatcher(e,t){this.userChangedValue||this.setValue({origin:"direct",previousValue:t,value:e||""}),this.userChangedValue=!1}updateRequestedIcon(){this.requestedIcon=re({},this.icon,"text")}get isClearable(){return this.clearable&&this.value.length>0}effectiveLocaleChange(){ve(this,this.effectiveLocale)}connectedCallback(){var e;pe(this),me(this),ye(this),this.inlineEditableEl=this.el.closest("calcite-inline-editable"),this.inlineEditableEl&&(this.editingEnabled=this.inlineEditableEl.editingEnabled||!1),this.setPreviousEmittedValue(this.value),this.setPreviousValue(this.value),st(this),tt(this),(e=this.mutationObserver)==null||e.observe(this.el,{childList:!0}),this.setDisabledAction(),this.el.addEventListener("calciteInternalHiddenInputChange",this.hiddenInputChangeHandler)}disconnectedCallback(){var e;be(this),at(this),it(this),ge(this),xe(this),(e=this.mutationObserver)==null||e.disconnect(),this.el.removeEventListener("calciteInternalHiddenInputChange",this.hiddenInputChangeHandler)}async componentWillLoad(){he(this),this.requestedIcon=re({},this.icon,"text"),await Ce(this)}componentDidLoad(){de(this)}componentDidRender(){fe(this)}async setFocus(){var e;await ue(this),(e=this.childEl)==null||e.focus()}async selectText(){var e;(e=this.childEl)==null||e.select()}onLabelClick(){this.setFocus()}onFormReset(){this.setValue({origin:"reset",value:this.defaultValue})}syncHiddenFormInput(e){this.minLength!=null&&(e.minLength=this.minLength),this.maxLength!=null&&(e.maxLength=this.maxLength)}setDisabledAction(){const e=oe(this.el,"action");e&&(this.disabled?(e.getAttribute("disabled")==null&&(this.slottedActionElDisabledInternally=!0),e.setAttribute("disabled","")):this.slottedActionElDisabledInternally&&(e.removeAttribute("disabled"),this.slottedActionElDisabledInternally=!1))}render(){const e=q(this.el),t=c("div",{class:L.loader},c("calcite-progress",{label:this.messages.loading,type:"indeterminate"})),i=c("button",{"aria-label":this.messages.clear,class:L.clearButton,disabled:this.disabled||this.readOnly,onClick:this.clearInputTextValue,tabIndex:-1,type:"button"},c("calcite-icon",{icon:"x",scale:M(this.scale)})),n=c("calcite-icon",{class:L.inputIcon,flipRtl:this.iconFlipRtl,icon:this.requestedIcon,scale:M(this.scale)}),s=c("div",{class:L.prefix},this.prefixText),a=c("div",{class:L.suffix},this.suffixText),o=c("input",{"aria-label":ot(this),autocomplete:this.autocomplete,autofocus:this.autofocus?!0:null,class:{[L.editingEnabled]:this.editingEnabled,[L.inlineChild]:!!this.inlineEditableEl},defaultValue:this.defaultValue,disabled:this.disabled?!0:null,enterKeyHint:this.enterKeyHint,inputMode:this.inputMode,maxLength:this.maxLength,minLength:this.minLength,name:this.name,onBlur:this.inputTextBlurHandler,onFocus:this.inputTextFocusHandler,onInput:this.inputTextInputHandler,onKeyDown:this.inputTextKeyDownHandler,pattern:this.pattern,placeholder:this.placeholder||"",readOnly:this.readOnly,required:this.required?!0:null,tabIndex:this.disabled||this.inlineEditableEl&&!this.editingEnabled?-1:null,type:"text",value:this.value,ref:this.setChildElRef});return c(te,{onClick:this.clickHandler,onKeyDown:this.keyDownHandler},c("div",{class:{[L.inputWrapper]:!0,[Ze.rtl]:e==="rtl"}},this.prefixText?s:null,c("div",{class:L.wrapper},o,this.isClearable?i:null,this.requestedIcon?n:null,this.loading?t:null),c("div",{class:L.actionWrapper},c("slot",{name:Ci.action})),this.suffixText?a:null,c(nt,{component:this})))}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{disabled:["disabledWatcher"],messageOverrides:["onMessagesChange"],value:["valueWatcher"],icon:["updateRequestedIcon"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return wi}},[1,"calcite-input-text",{alignment:[513],autofocus:[516],clearable:[516],disabled:[516],form:[513],hidden:[516],icon:[520],iconFlipRtl:[516,"icon-flip-rtl"],label:[1],loading:[516],maxLength:[514,"max-length"],minLength:[514,"min-length"],name:[513],placeholder:[1],prefixText:[1,"prefix-text"],readOnly:[516,"read-only"],required:[516],scale:[513],status:[513],autocomplete:[1],inputMode:[1,"input-mode"],enterKeyHint:[1,"enter-key-hint"],pattern:[1],suffixText:[1,"suffix-text"],editingEnabled:[1540,"editing-enabled"],value:[1025],messages:[1040],messageOverrides:[1040],effectiveLocale:[32],defaultMessages:[32],slottedActionElDisabledInternally:[32],setFocus:[64],selectText:[64]}]);function Oe(){if(typeof customElements>"u")return;["calcite-input-text","calcite-icon","calcite-progress"].forEach(t=>{switch(t){case"calcite-input-text":customElements.get(t)||customElements.define(t,ki);break;case"calcite-icon":customElements.get(t)||ie();break;case"calcite-progress":customElements.get(t)||we();break}})}Oe();/*! + )}.clear-button:disabled{opacity:var(--calcite-ui-opacity-disabled)}.loader{inset-block-start:1px;inset-inline:1px;pointer-events:none;position:absolute;display:block}.action-wrapper{order:7;display:flex}.prefix,.suffix{box-sizing:border-box;display:flex;block-size:auto;min-block-size:100%;-webkit-user-select:none;user-select:none;align-content:center;align-items:center;overflow-wrap:break-word;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-background);font-weight:var(--calcite-font-weight-medium);line-height:1;color:var(--calcite-ui-text-2)}.prefix{order:2;border-inline-end-width:0px}.suffix{order:5;border-inline-start-width:0px}:host([alignment=start]) input{text-align:start}:host([alignment=end]) input{text-align:end}.wrapper{position:relative;display:flex;flex-direction:row;align-items:center}:host(.no-bottom-border) input{border-block-end-width:0px}:host(.border-top-color-one) input{border-block-start-color:var(--calcite-ui-border-1)}.inline-child{background-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s}.inline-child .editing-enabled{background-color:inherit}.inline-child:not(.editing-enabled){display:flex;cursor:pointer;border-color:transparent;padding-inline-start:0}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}`,ki=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteInternalInputTextFocus=y(this,"calciteInternalInputTextFocus",7),this.calciteInternalInputTextBlur=y(this,"calciteInternalInputTextBlur",7),this.calciteInputTextInput=y(this,"calciteInputTextInput",7),this.calciteInputTextChange=y(this,"calciteInputTextChange",7),this.previousValueOrigin="initial",this.mutationObserver=Y("mutation",()=>this.setDisabledAction()),this.userChangedValue=!1,this.keyDownHandler=e=>{this.readOnly||this.disabled||(this.isClearable&&e.key==="Escape"&&(this.clearInputTextValue(e),e.preventDefault()),e.key==="Enter"&&!e.defaultPrevented&&et(this)&&e.preventDefault())},this.clearInputTextValue=e=>{this.setValue({committing:!0,nativeEvent:e,origin:"user",value:""})},this.emitChangeIfUserModified=()=>{this.previousValueOrigin==="user"&&this.value!==this.previousEmittedValue&&(this.calciteInputTextChange.emit(),this.setPreviousEmittedValue(this.value))},this.inputTextBlurHandler=()=>{this.calciteInternalInputTextBlur.emit({element:this.childEl,value:this.value}),this.emitChangeIfUserModified()},this.clickHandler=e=>{if(this.disabled)return;const t=oe(this.el,"action");e.target!==t&&this.setFocus()},this.inputTextFocusHandler=()=>{this.calciteInternalInputTextFocus.emit({element:this.childEl,value:this.value})},this.inputTextInputHandler=e=>{this.disabled||this.readOnly||this.setValue({nativeEvent:e,origin:"user",value:e.target.value})},this.inputTextKeyDownHandler=e=>{this.disabled||this.readOnly||e.key==="Enter"&&this.emitChangeIfUserModified()},this.hiddenInputChangeHandler=e=>{e.target.name===this.name&&this.setValue({value:e.target.value,origin:"direct"}),e.stopPropagation()},this.setChildElRef=e=>{this.childEl=e},this.setInputValue=e=>{this.childEl&&(this.childEl.value=e)},this.setPreviousEmittedValue=e=>{this.previousEmittedValue=e},this.setPreviousValue=e=>{this.previousValue=e},this.setValue=({committing:e=!1,nativeEvent:t,origin:i,previousValue:n,value:s})=>{this.setPreviousValue(n??this.value),this.previousValueOrigin=i,this.userChangedValue=i==="user"&&s!==this.value,this.value=s,i==="direct"&&(this.setInputValue(s),this.setPreviousEmittedValue(s)),t&&(this.calciteInputTextInput.emit().defaultPrevented?this.value=this.previousValue:e&&this.emitChangeIfUserModified())},this.alignment="start",this.autofocus=!1,this.clearable=!1,this.disabled=!1,this.form=void 0,this.hidden=!1,this.icon=void 0,this.iconFlipRtl=!1,this.label=void 0,this.loading=!1,this.maxLength=void 0,this.minLength=void 0,this.name=void 0,this.placeholder=void 0,this.prefixText=void 0,this.readOnly=!1,this.required=!1,this.scale="m",this.status="idle",this.autocomplete=void 0,this.inputMode="text",this.enterKeyHint=void 0,this.pattern=void 0,this.suffixText=void 0,this.editingEnabled=!1,this.value="",this.messages=void 0,this.messageOverrides=void 0,this.effectiveLocale=void 0,this.defaultMessages=void 0,this.slottedActionElDisabledInternally=!1}disabledWatcher(){this.setDisabledAction()}onMessagesChange(){}valueWatcher(e,t){this.userChangedValue||this.setValue({origin:"direct",previousValue:t,value:e||""}),this.userChangedValue=!1}updateRequestedIcon(){this.requestedIcon=re({},this.icon,"text")}get isClearable(){return this.clearable&&this.value.length>0}effectiveLocaleChange(){ve(this,this.effectiveLocale)}connectedCallback(){var e;pe(this),me(this),ye(this),this.inlineEditableEl=this.el.closest("calcite-inline-editable"),this.inlineEditableEl&&(this.editingEnabled=this.inlineEditableEl.editingEnabled||!1),this.setPreviousEmittedValue(this.value),this.setPreviousValue(this.value),st(this),tt(this),(e=this.mutationObserver)==null||e.observe(this.el,{childList:!0}),this.setDisabledAction(),this.el.addEventListener("calciteInternalHiddenInputChange",this.hiddenInputChangeHandler)}disconnectedCallback(){var e;be(this),at(this),it(this),ge(this),xe(this),(e=this.mutationObserver)==null||e.disconnect(),this.el.removeEventListener("calciteInternalHiddenInputChange",this.hiddenInputChangeHandler)}async componentWillLoad(){he(this),this.requestedIcon=re({},this.icon,"text"),await Ce(this)}componentDidLoad(){de(this)}componentDidRender(){fe(this)}async setFocus(){var e;await ue(this),(e=this.childEl)==null||e.focus()}async selectText(){var e;(e=this.childEl)==null||e.select()}onLabelClick(){this.setFocus()}onFormReset(){this.setValue({origin:"reset",value:this.defaultValue})}syncHiddenFormInput(e){this.minLength!=null&&(e.minLength=this.minLength),this.maxLength!=null&&(e.maxLength=this.maxLength)}setDisabledAction(){const e=oe(this.el,"action");e&&(this.disabled?(e.getAttribute("disabled")==null&&(this.slottedActionElDisabledInternally=!0),e.setAttribute("disabled","")):this.slottedActionElDisabledInternally&&(e.removeAttribute("disabled"),this.slottedActionElDisabledInternally=!1))}render(){const e=q(this.el),t=c("div",{class:L.loader},c("calcite-progress",{label:this.messages.loading,type:"indeterminate"})),i=c("button",{"aria-label":this.messages.clear,class:L.clearButton,disabled:this.disabled||this.readOnly,onClick:this.clearInputTextValue,tabIndex:-1,type:"button"},c("calcite-icon",{icon:"x",scale:M(this.scale)})),n=c("calcite-icon",{class:L.inputIcon,flipRtl:this.iconFlipRtl,icon:this.requestedIcon,scale:M(this.scale)}),s=c("div",{class:L.prefix},this.prefixText),a=c("div",{class:L.suffix},this.suffixText),o=c("input",{"aria-label":ot(this),autocomplete:this.autocomplete,autofocus:this.autofocus?!0:null,class:{[L.editingEnabled]:this.editingEnabled,[L.inlineChild]:!!this.inlineEditableEl},defaultValue:this.defaultValue,disabled:this.disabled?!0:null,enterKeyHint:this.enterKeyHint,inputMode:this.inputMode,maxLength:this.maxLength,minLength:this.minLength,name:this.name,onBlur:this.inputTextBlurHandler,onFocus:this.inputTextFocusHandler,onInput:this.inputTextInputHandler,onKeyDown:this.inputTextKeyDownHandler,pattern:this.pattern,placeholder:this.placeholder||"",readOnly:this.readOnly,required:this.required?!0:null,tabIndex:this.disabled||this.inlineEditableEl&&!this.editingEnabled?-1:null,type:"text",value:this.value,ref:this.setChildElRef});return c(te,{onClick:this.clickHandler,onKeyDown:this.keyDownHandler},c("div",{class:{[L.inputWrapper]:!0,[Ze.rtl]:e==="rtl"}},this.prefixText?s:null,c("div",{class:L.wrapper},o,this.isClearable?i:null,this.requestedIcon?n:null,this.loading?t:null),c("div",{class:L.actionWrapper},c("slot",{name:Ci.action})),this.suffixText?a:null,c(nt,{component:this})))}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{disabled:["disabledWatcher"],messageOverrides:["onMessagesChange"],value:["valueWatcher"],icon:["updateRequestedIcon"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return wi}},[1,"calcite-input-text",{alignment:[513],autofocus:[516],clearable:[516],disabled:[516],form:[513],hidden:[516],icon:[520],iconFlipRtl:[516,"icon-flip-rtl"],label:[1],loading:[516],maxLength:[514,"max-length"],minLength:[514,"min-length"],name:[513],placeholder:[1],prefixText:[1,"prefix-text"],readOnly:[516,"read-only"],required:[516],scale:[513],status:[513],autocomplete:[1],inputMode:[1,"input-mode"],enterKeyHint:[1,"enter-key-hint"],pattern:[1],suffixText:[1,"suffix-text"],editingEnabled:[1540,"editing-enabled"],value:[1025],messages:[1040],messageOverrides:[1040],effectiveLocale:[32],defaultMessages:[32],slottedActionElDisabledInternally:[32],setFocus:[64],selectText:[64]}]);function Oe(){if(typeof customElements>"u")return;["calcite-input-text","calcite-icon","calcite-progress"].forEach(t=>{switch(t){case"calcite-input-text":customElements.get(t)||customElements.define(t,ki);break;case"calcite-icon":customElements.get(t)||ie();break;case"calcite-progress":customElements.get(t)||we();break}})}Oe();/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 @@ -82,15 +82,15 @@ import{q as R,H as V,r as y,db as oe,B as X,dc as re,ch as q,t as c,dd as Ze,x a * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const ae={swatch:"swatch",noColorSwatch:"swatch--no-color",checker:"checker"},Xe={borderLight:"rgba(0, 0, 0, 0.3)",borderDark:"rgba(255, 255, 255, 0.15)"},Je=4,B={squareSize:Je,size:Je*2},Ti=":host{position:relative;display:inline-flex}:host([scale=s]){block-size:1.25rem;inline-size:1.25rem}:host([scale=m]){block-size:1.5rem;inline-size:1.5rem}:host([scale=l]){block-size:2rem;inline-size:2rem}.swatch{overflow:hidden;block-size:inherit;inline-size:inherit}.swatch rect{transition-property:all;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.swatch--no-color rect{fill:var(--calcite-ui-foreground-1)}.swatch--no-color line{stroke:var(--calcite-ui-danger)}.checker{fill:#cacaca}:host([hidden]){display:none}[hidden]{display:none}",Ei=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.active=!1,this.color=void 0,this.scale="m"}handleColorChange(e){this.internalColor=e?F(e):null}componentWillLoad(){this.handleColorChange(this.color)}render(){const e=!this.internalColor,t={[ae.swatch]:!0,[ae.noColorSwatch]:e};return c("svg",{class:t,xmlns:"http://www.w3.org/2000/svg"},this.renderSwatch())}renderSwatch(){const{active:e,el:t,internalColor:i}=this,n=e?"100%":"0",a=Pt(t)==="light"?Xe.borderLight:Xe.borderDark,o={height:"100%",rx:n,stroke:a,"stroke-width":"2",width:"100%"};if(!i)return c(Te,null,c("clipPath",{id:"shape"},c("rect",{height:"100%",rx:n,width:"100%"})),c("rect",{"clip-path":`inset(0 round ${n})`,rx:n,...o}),c("line",{"clip-path":"url(#shape)","stroke-width":"3",x1:"100%",x2:"0",y1:"0",y2:"100%"}));const l=i.alpha(),d=E(i),u=E(i,l<1);return c(Te,null,c("title",null,u),c("defs",null,c("pattern",{height:B.size,id:"checker",patternUnits:"userSpaceOnUse",width:B.size,x:"0",y:"0"},c("rect",{class:ae.checker,height:B.squareSize,width:B.squareSize,x:"0",y:"0"}),c("rect",{class:ae.checker,height:B.squareSize,width:B.squareSize,x:B.squareSize,y:B.squareSize}))),c("rect",{fill:"url(#checker)",height:"100%",rx:n,width:"100%"}),c("rect",{fill:d,style:{"clip-path":l<1?"polygon(100% 0, 0 0, 0 100%)":`inset(0 round ${n})`},...o}),l<1?c("rect",{fill:u,key:"opacity-fill",style:{"clip-path":"polygon(100% 0, 100% 100%, 0 100%)"},...o}):null)}get el(){return this}static get watchers(){return{color:["handleColorChange"]}}static get style(){return Ti}},[1,"calcite-color-picker-swatch",{active:[516],color:[1],scale:[513]}]);function ft(){if(typeof customElements>"u")return;["calcite-color-picker-swatch"].forEach(t=>{switch(t){case"calcite-color-picker-swatch":customElements.get(t)||customElements.define(t,Ei);break}})}ft();/*! + */const ae={swatch:"swatch",noColorSwatch:"swatch--no-color",checker:"checker"},Xe={borderLight:"rgba(0, 0, 0, 0.3)",borderDark:"rgba(255, 255, 255, 0.15)"},Ye=4,B={squareSize:Ye,size:Ye*2},Ti=":host{position:relative;display:inline-flex}:host([scale=s]){block-size:1.25rem;inline-size:1.25rem}:host([scale=m]){block-size:1.5rem;inline-size:1.5rem}:host([scale=l]){block-size:2rem;inline-size:2rem}.swatch{overflow:hidden;block-size:inherit;inline-size:inherit}.swatch rect{transition-property:all;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.swatch--no-color rect{fill:var(--calcite-ui-foreground-1)}.swatch--no-color line{stroke:var(--calcite-ui-danger)}.checker{fill:#cacaca}:host([hidden]){display:none}[hidden]{display:none}",Ei=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.active=!1,this.color=void 0,this.scale="m"}handleColorChange(e){this.internalColor=e?F(e):null}componentWillLoad(){this.handleColorChange(this.color)}render(){const e=!this.internalColor,t={[ae.swatch]:!0,[ae.noColorSwatch]:e};return c("svg",{class:t,xmlns:"http://www.w3.org/2000/svg"},this.renderSwatch())}renderSwatch(){const{active:e,el:t,internalColor:i}=this,n=e?"100%":"0",a=Pt(t)==="light"?Xe.borderLight:Xe.borderDark,o={height:"100%",rx:n,stroke:a,"stroke-width":"2",width:"100%"};if(!i)return c(Te,null,c("clipPath",{id:"shape"},c("rect",{height:"100%",rx:n,width:"100%"})),c("rect",{"clip-path":`inset(0 round ${n})`,rx:n,...o}),c("line",{"clip-path":"url(#shape)","stroke-width":"3",x1:"100%",x2:"0",y1:"0",y2:"100%"}));const l=i.alpha(),d=E(i),u=E(i,l<1);return c(Te,null,c("title",null,u),c("defs",null,c("pattern",{height:B.size,id:"checker",patternUnits:"userSpaceOnUse",width:B.size,x:"0",y:"0"},c("rect",{class:ae.checker,height:B.squareSize,width:B.squareSize,x:"0",y:"0"}),c("rect",{class:ae.checker,height:B.squareSize,width:B.squareSize,x:B.squareSize,y:B.squareSize}))),c("rect",{fill:"url(#checker)",height:"100%",rx:n,width:"100%"}),c("rect",{fill:d,style:{"clip-path":l<1?"polygon(100% 0, 0 0, 0 100%)":`inset(0 round ${n})`},...o}),l<1?c("rect",{fill:u,key:"opacity-fill",style:{"clip-path":"polygon(100% 0, 100% 100%, 0 100%)"},...o}):null)}get el(){return this}static get watchers(){return{color:["handleColorChange"]}}static get style(){return Ti}},[1,"calcite-color-picker-swatch",{active:[516],color:[1],scale:[513]}]);function ft(){if(typeof customElements>"u")return;["calcite-color-picker-swatch"].forEach(t=>{switch(t){case"calcite-color-picker-swatch":customElements.get(t)||customElements.define(t,Ei);break}})}ft();/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const Ye={container:"container",content:"content"},zi=":host([selected]) section,:host([selected]) .container{display:block}:host{display:none;block-size:100%;inline-size:100%}:host([selected]){display:block;block-size:100%;inline-size:100%;overflow:auto}.scale-s .content{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}.scale-m .content{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}.scale-l .content{padding-block:0.625rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}section,.container{display:none;block-size:100%;inline-size:100%}:host([hidden]){display:none}[hidden]{display:none}",Ai=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteInternalTabRegister=y(this,"calciteInternalTabRegister",6),this.guid=`calcite-tab-title-${rt()}`,this.tab=void 0,this.selected=!1,this.scale="m",this.labeledBy=void 0}render(){const e=this.el.id||this.guid;return c(te,{"aria-labelledby":this.labeledBy,id:e},c("div",{class:{[Ye.container]:!0,[`scale-${this.scale}`]:!0},role:"tabpanel",tabIndex:this.selected?0:-1},c("section",{class:Ye.content},c("slot",null))))}connectedCallback(){this.parentTabsEl=this.el.closest("calcite-tabs")}componentDidLoad(){this.calciteInternalTabRegister.emit()}disconnectedCallback(){var e;(e=document.body)==null||e.dispatchEvent(new CustomEvent("calciteTabUnregister",{detail:this.el}))}internalTabChangeHandler(e){e.composedPath().find(i=>i.tagName==="CALCITE-TABS")===this.parentTabsEl&&(this.tab?this.selected=this.tab===e.detail.tab:this.getTabIndex().then(i=>{this.selected=i===e.detail.tab}),e.stopPropagation())}async getTabIndex(){return Array.prototype.indexOf.call(Qe(this.el.parentElement.children).filter(e=>e.matches("calcite-tab")),this.el)}async updateAriaInfo(e=[],t=[]){this.labeledBy=t[e.indexOf(this.el.id)]||null}get el(){return this}static get style(){return zi}},[1,"calcite-tab",{tab:[513],selected:[1540],scale:[1],labeledBy:[32],getTabIndex:[64],updateAriaInfo:[64]},[[16,"calciteInternalTabChange","internalTabChangeHandler"]]]);function mt(){if(typeof customElements>"u")return;["calcite-tab"].forEach(t=>{switch(t){case"calcite-tab":customElements.get(t)||customElements.define(t,Ai);break}})}mt();/*! + */const Je={container:"container",content:"content"},zi=":host([selected]) section,:host([selected]) .container{display:block}:host{display:none;block-size:100%;inline-size:100%}:host([selected]){display:block;block-size:100%;inline-size:100%;overflow:auto}.scale-s .content{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem}.scale-m .content{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem}.scale-l .content{padding-block:0.625rem;font-size:var(--calcite-font-size-0);line-height:1.25rem}section,.container{display:none;block-size:100%;inline-size:100%}:host([hidden]){display:none}[hidden]{display:none}",Ai=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteInternalTabRegister=y(this,"calciteInternalTabRegister",6),this.guid=`calcite-tab-title-${rt()}`,this.tab=void 0,this.selected=!1,this.scale="m",this.labeledBy=void 0}render(){const e=this.el.id||this.guid;return c(te,{"aria-labelledby":this.labeledBy,id:e},c("div",{class:{[Je.container]:!0,[`scale-${this.scale}`]:!0},role:"tabpanel",tabIndex:this.selected?0:-1},c("section",{class:Je.content},c("slot",null))))}connectedCallback(){this.parentTabsEl=this.el.closest("calcite-tabs")}componentDidLoad(){this.calciteInternalTabRegister.emit()}disconnectedCallback(){var e;(e=document.body)==null||e.dispatchEvent(new CustomEvent("calciteTabUnregister",{detail:this.el}))}internalTabChangeHandler(e){e.composedPath().find(i=>i.tagName==="CALCITE-TABS")===this.parentTabsEl&&(this.tab?this.selected=this.tab===e.detail.tab:this.getTabIndex().then(i=>{this.selected=i===e.detail.tab}),e.stopPropagation())}async getTabIndex(){return Array.prototype.indexOf.call(Qe(this.el.parentElement.children).filter(e=>e.matches("calcite-tab")),this.el)}async updateAriaInfo(e=[],t=[]){this.labeledBy=t[e.indexOf(this.el.id)]||null}get el(){return this}static get style(){return zi}},[1,"calcite-tab",{tab:[513],selected:[1540],scale:[1],labeledBy:[32],getTabIndex:[64],updateAriaInfo:[64]},[[16,"calciteInternalTabChange","internalTabChangeHandler"]]]);function mt(){if(typeof customElements>"u")return;["calcite-tab"].forEach(t=>{switch(t){case"calcite-tab":customElements.get(t)||customElements.define(t,Ai);break}})}mt();/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const Hi={container:"tab-nav"},Fi=":host{position:relative;display:flex}.scale-s{min-block-size:1.5rem}.scale-m{min-block-size:2rem}.scale-l{min-block-size:2.75rem}:host([layout=center]:not([bordered])){padding-inline:1.25rem}:host([layout=center]:not([bordered])) .tab-nav ::slotted(calcite-tab-title:last-child){margin-inline-end:0px}:host(:not([bordered])) .scale-l ::slotted(calcite-tab-title){margin-inline-end:1.5rem}:host(:not([bordered])) .scale-m ::slotted(calcite-tab-title){margin-inline-end:1.25rem}:host(:not([bordered])) .scale-s ::slotted(calcite-tab-title){margin-inline-end:1rem}.tab-nav{display:flex;inline-size:100%;justify-content:flex-start;overflow:auto}.tab-nav-active-indicator-container{position:absolute;inset-inline:0px;inset-block-end:0px;block-size:0.125rem;inline-size:100%;overflow:hidden}.tab-nav-active-indicator{position:absolute;inset-block-end:0px;display:block;block-size:0.125rem;background-color:var(--calcite-ui-brand);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}:host([layout=center]) .tab-nav{justify-content:space-evenly}:host .position-bottom .tab-nav-active-indicator{inset-block-end:unset;inset-block-start:0px}:host .position-bottom .tab-nav-active-indicator-container{inset-block-end:unset;inset-block-start:0px}:host([bordered]) .tab-nav-active-indicator-container{inset-block-end:unset}:host([bordered]) .position-bottom .tab-nav-active-indicator-container{inset-block-end:0;inset-block-start:unset}@media (forced-colors: active){.tab-nav-active-indicator{background-color:highlight}}:host([hidden]){display:none}[hidden]{display:none}",Oi=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteTabChange=y(this,"calciteTabChange",6),this.calciteInternalTabChange=y(this,"calciteInternalTabChange",6),this.animationActiveDuration=.3,this.resizeObserver=J("resize",()=>{this.activeIndicatorEl&&(this.activeIndicatorEl.style.transitionDuration="0s",this.updateActiveWidth(),this.updateOffsetPosition())}),this.handleTabFocus=(e,t,i)=>{Mt(this.enabledTabTitles,t,i),e.stopPropagation()},this.handleContainerScroll=()=>{this.activeIndicatorEl.style.transitionDuration="0s",this.updateOffsetPosition()},this.storageId=void 0,this.syncId=void 0,this.selectedTitle=null,this.scale="m",this.layout="inline",this.position="bottom",this.bordered=!1,this.indicatorOffset=void 0,this.indicatorWidth=void 0,this.selectedTabId=void 0}async selectedTabIdChanged(){localStorage&&this.storageId&&this.selectedTabId!==void 0&&this.selectedTabId!==null&&localStorage.setItem(`calcite-tab-nav-${this.storageId}`,JSON.stringify(this.selectedTabId)),this.calciteInternalTabChange.emit({tab:this.selectedTabId}),this.selectedTitle=await this.getTabTitleById(this.selectedTabId)}selectedTitleChanged(){this.updateOffsetPosition(),this.updateActiveWidth(),this.activeIndicatorEl.style.transitionDuration=`${this.animationActiveDuration}s`}connectedCallback(){var e;this.parentTabsEl=this.el.closest("calcite-tabs"),(e=this.resizeObserver)==null||e.observe(this.el)}componentWillLoad(){const e=`calcite-tab-nav-${this.storageId}`;if(localStorage&&this.storageId&&localStorage.getItem(e)){const t=JSON.parse(localStorage.getItem(e));this.selectedTabId=t}}componentWillRender(){const{parentTabsEl:e}=this;this.layout=e==null?void 0:e.layout,this.bordered=e==null?void 0:e.bordered,this.selectedTitle&&this.updateOffsetPosition()}componentDidRender(){this.tabTitles.length&&this.tabTitles.every(e=>!e.selected)&&!this.selectedTabId&&this.tabTitles[0].getTabIdentifier().then(e=>{this.calciteInternalTabChange.emit({tab:e})})}disconnectedCallback(){var e;(e=this.resizeObserver)==null||e.disconnect()}render(){const e=q(this.el),t=`${this.indicatorWidth}px`,i=`${this.indicatorOffset}px`,n=e!=="rtl"?{width:t,left:i}:{width:t,right:i};return c(te,{role:"tablist"},c("div",{class:{[Hi.container]:!0,[`scale-${this.scale}`]:!0,[`position-${this.position}`]:!0},onScroll:this.handleContainerScroll,ref:s=>this.tabNavEl=s},c("slot",null),c("div",{class:"tab-nav-active-indicator-container",ref:s=>this.activeIndicatorContainerEl=s},c("div",{class:"tab-nav-active-indicator",style:n,ref:s=>this.activeIndicatorEl=s}))))}focusPreviousTabHandler(e){this.handleTabFocus(e,e.target,"previous")}focusNextTabHandler(e){this.handleTabFocus(e,e.target,"next")}focusFirstTabHandler(e){this.handleTabFocus(e,e.target,"first")}focusLastTabHandler(e){this.handleTabFocus(e,e.target,"last")}internalActivateTabHandler(e){this.selectedTabId=e.detail.tab?e.detail.tab:this.getIndexOfTabTitle(e.target),e.stopPropagation()}activateTabHandler(e){this.calciteTabChange.emit(),e.stopPropagation()}internalCloseTabHandler(e){const t=e.target;this.handleTabTitleClose(t),e.stopPropagation()}updateTabTitles(e){e.target.selected&&(this.selectedTabId=e.detail)}globalInternalTabChangeHandler(e){this.syncId&&e.target!==this.el&&e.target.syncId===this.syncId&&this.selectedTabId!==e.detail.tab&&(this.selectedTabId=e.detail.tab),e.stopPropagation()}iconStartChangeHandler(){this.updateActiveWidth(),this.updateOffsetPosition()}updateOffsetPosition(){var a,o,r,l,d;const e=q(this.el),t=(a=this.activeIndicatorContainerEl)==null?void 0:a.offsetWidth,i=(o=this.selectedTitle)==null?void 0:o.offsetLeft,n=(r=this.selectedTitle)==null?void 0:r.offsetWidth,s=t-(i+n);this.indicatorOffset=e!=="rtl"?i-((l=this.tabNavEl)==null?void 0:l.scrollLeft):s+((d=this.tabNavEl)==null?void 0:d.scrollLeft)}updateActiveWidth(){var e;this.indicatorWidth=(e=this.selectedTitle)==null?void 0:e.offsetWidth}getIndexOfTabTitle(e,t=this.tabTitles){return t.indexOf(e)}async getTabTitleById(e){return Promise.all(this.tabTitles.map(t=>t.getTabIdentifier())).then(t=>this.tabTitles[t.indexOf(e)])}get tabTitles(){return Ve(this.el,"calcite-tab-title")}get enabledTabTitles(){return Ve(this.el,"calcite-tab-title:not([disabled])").filter(e=>!e.closed)}handleTabTitleClose(e){const{tabTitles:t}=this,i=t.reduce((s,a,o)=>a.closed?s:[...s,o],[]),n=i.length;if(n===1&&t[i[0]].closable)t[i[0]].closable=!1,this.selectedTabId=i[0];else if(n>1){const s=t.findIndex(o=>o===e),a=i.find(o=>o>s);this.selectedTabId===s&&(this.selectedTabId=a||n-1)}requestAnimationFrame(()=>{this.updateOffsetPosition(),this.updateActiveWidth(),t[this.selectedTabId].focus()})}get el(){return this}static get watchers(){return{selectedTabId:["selectedTabIdChanged"],selectedTitle:["selectedTitleChanged"]}}static get style(){return Fi}},[1,"calcite-tab-nav",{storageId:[513,"storage-id"],syncId:[513,"sync-id"],selectedTitle:[1040],scale:[1],layout:[1537],position:[1],bordered:[1540],indicatorOffset:[1026,"indicator-offset"],indicatorWidth:[1026,"indicator-width"],selectedTabId:[32]},[[0,"calciteInternalTabsFocusPrevious","focusPreviousTabHandler"],[0,"calciteInternalTabsFocusNext","focusNextTabHandler"],[0,"calciteInternalTabsFocusFirst","focusFirstTabHandler"],[0,"calciteInternalTabsFocusLast","focusLastTabHandler"],[0,"calciteInternalTabsActivate","internalActivateTabHandler"],[0,"calciteTabsActivate","activateTabHandler"],[0,"calciteInternalTabsClose","internalCloseTabHandler"],[0,"calciteInternalTabTitleRegister","updateTabTitles"],[16,"calciteInternalTabChange","globalInternalTabChangeHandler"],[0,"calciteInternalTabIconChanged","iconStartChangeHandler"]]]);function gt(){if(typeof customElements>"u")return;["calcite-tab-nav"].forEach(t=>{switch(t){case"calcite-tab-nav":customElements.get(t)||customElements.define(t,Oi);break}})}gt();/*! + */const Hi={container:"tab-nav"},Fi=":host{position:relative;display:flex}.scale-s{min-block-size:1.5rem}.scale-m{min-block-size:2rem}.scale-l{min-block-size:2.75rem}:host([layout=center]:not([bordered])){padding-inline:1.25rem}:host([layout=center]:not([bordered])) .tab-nav ::slotted(calcite-tab-title:last-child){margin-inline-end:0px}:host(:not([bordered])) .scale-l ::slotted(calcite-tab-title){margin-inline-end:1.5rem}:host(:not([bordered])) .scale-m ::slotted(calcite-tab-title){margin-inline-end:1.25rem}:host(:not([bordered])) .scale-s ::slotted(calcite-tab-title){margin-inline-end:1rem}.tab-nav{display:flex;inline-size:100%;justify-content:flex-start;overflow:auto}.tab-nav-active-indicator-container{position:absolute;inset-inline:0px;inset-block-end:0px;block-size:0.125rem;inline-size:100%;overflow:hidden}.tab-nav-active-indicator{position:absolute;inset-block-end:0px;display:block;block-size:0.125rem;background-color:var(--calcite-ui-brand);transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}:host([layout=center]) .tab-nav{justify-content:space-evenly}:host .position-bottom .tab-nav-active-indicator{inset-block-end:unset;inset-block-start:0px}:host .position-bottom .tab-nav-active-indicator-container{inset-block-end:unset;inset-block-start:0px}:host([bordered]) .tab-nav-active-indicator-container{inset-block-end:unset}:host([bordered]) .position-bottom .tab-nav-active-indicator-container{inset-block-end:0;inset-block-start:unset}@media (forced-colors: active){.tab-nav-active-indicator{background-color:highlight}}:host([hidden]){display:none}[hidden]{display:none}",Oi=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteTabChange=y(this,"calciteTabChange",6),this.calciteInternalTabChange=y(this,"calciteInternalTabChange",6),this.animationActiveDuration=.3,this.resizeObserver=Y("resize",()=>{this.activeIndicatorEl&&(this.activeIndicatorEl.style.transitionDuration="0s",this.updateActiveWidth(),this.updateOffsetPosition())}),this.handleTabFocus=(e,t,i)=>{Mt(this.enabledTabTitles,t,i),e.stopPropagation()},this.handleContainerScroll=()=>{this.activeIndicatorEl.style.transitionDuration="0s",this.updateOffsetPosition()},this.storageId=void 0,this.syncId=void 0,this.selectedTitle=null,this.scale="m",this.layout="inline",this.position="bottom",this.bordered=!1,this.indicatorOffset=void 0,this.indicatorWidth=void 0,this.selectedTabId=void 0}async selectedTabIdChanged(){localStorage&&this.storageId&&this.selectedTabId!==void 0&&this.selectedTabId!==null&&localStorage.setItem(`calcite-tab-nav-${this.storageId}`,JSON.stringify(this.selectedTabId)),this.calciteInternalTabChange.emit({tab:this.selectedTabId}),this.selectedTitle=await this.getTabTitleById(this.selectedTabId)}selectedTitleChanged(){this.updateOffsetPosition(),this.updateActiveWidth(),this.activeIndicatorEl.style.transitionDuration=`${this.animationActiveDuration}s`}connectedCallback(){var e;this.parentTabsEl=this.el.closest("calcite-tabs"),(e=this.resizeObserver)==null||e.observe(this.el)}componentWillLoad(){const e=`calcite-tab-nav-${this.storageId}`;if(localStorage&&this.storageId&&localStorage.getItem(e)){const t=JSON.parse(localStorage.getItem(e));this.selectedTabId=t}}componentWillRender(){const{parentTabsEl:e}=this;this.layout=e==null?void 0:e.layout,this.bordered=e==null?void 0:e.bordered,this.selectedTitle&&this.updateOffsetPosition()}componentDidRender(){this.tabTitles.length&&this.tabTitles.every(e=>!e.selected)&&!this.selectedTabId&&this.tabTitles[0].getTabIdentifier().then(e=>{this.calciteInternalTabChange.emit({tab:e})})}disconnectedCallback(){var e;(e=this.resizeObserver)==null||e.disconnect()}render(){const e=q(this.el),t=`${this.indicatorWidth}px`,i=`${this.indicatorOffset}px`,n=e!=="rtl"?{width:t,left:i}:{width:t,right:i};return c(te,{role:"tablist"},c("div",{class:{[Hi.container]:!0,[`scale-${this.scale}`]:!0,[`position-${this.position}`]:!0},onScroll:this.handleContainerScroll,ref:s=>this.tabNavEl=s},c("slot",null),c("div",{class:"tab-nav-active-indicator-container",ref:s=>this.activeIndicatorContainerEl=s},c("div",{class:"tab-nav-active-indicator",style:n,ref:s=>this.activeIndicatorEl=s}))))}focusPreviousTabHandler(e){this.handleTabFocus(e,e.target,"previous")}focusNextTabHandler(e){this.handleTabFocus(e,e.target,"next")}focusFirstTabHandler(e){this.handleTabFocus(e,e.target,"first")}focusLastTabHandler(e){this.handleTabFocus(e,e.target,"last")}internalActivateTabHandler(e){this.selectedTabId=e.detail.tab?e.detail.tab:this.getIndexOfTabTitle(e.target),e.stopPropagation()}activateTabHandler(e){this.calciteTabChange.emit(),e.stopPropagation()}internalCloseTabHandler(e){const t=e.target;this.handleTabTitleClose(t),e.stopPropagation()}updateTabTitles(e){e.target.selected&&(this.selectedTabId=e.detail)}globalInternalTabChangeHandler(e){this.syncId&&e.target!==this.el&&e.target.syncId===this.syncId&&this.selectedTabId!==e.detail.tab&&(this.selectedTabId=e.detail.tab),e.stopPropagation()}iconStartChangeHandler(){this.updateActiveWidth(),this.updateOffsetPosition()}updateOffsetPosition(){var a,o,r,l,d;const e=q(this.el),t=(a=this.activeIndicatorContainerEl)==null?void 0:a.offsetWidth,i=(o=this.selectedTitle)==null?void 0:o.offsetLeft,n=(r=this.selectedTitle)==null?void 0:r.offsetWidth,s=t-(i+n);this.indicatorOffset=e!=="rtl"?i-((l=this.tabNavEl)==null?void 0:l.scrollLeft):s+((d=this.tabNavEl)==null?void 0:d.scrollLeft)}updateActiveWidth(){var e;this.indicatorWidth=(e=this.selectedTitle)==null?void 0:e.offsetWidth}getIndexOfTabTitle(e,t=this.tabTitles){return t.indexOf(e)}async getTabTitleById(e){return Promise.all(this.tabTitles.map(t=>t.getTabIdentifier())).then(t=>this.tabTitles[t.indexOf(e)])}get tabTitles(){return Ve(this.el,"calcite-tab-title")}get enabledTabTitles(){return Ve(this.el,"calcite-tab-title:not([disabled])").filter(e=>!e.closed)}handleTabTitleClose(e){const{tabTitles:t}=this,i=t.reduce((s,a,o)=>a.closed?s:[...s,o],[]),n=i.length;if(n===1&&t[i[0]].closable)t[i[0]].closable=!1,this.selectedTabId=i[0];else if(n>1){const s=t.findIndex(o=>o===e),a=i.find(o=>o>s);this.selectedTabId===s&&(this.selectedTabId=a||n-1)}requestAnimationFrame(()=>{this.updateOffsetPosition(),this.updateActiveWidth(),t[this.selectedTabId].focus()})}get el(){return this}static get watchers(){return{selectedTabId:["selectedTabIdChanged"],selectedTitle:["selectedTitleChanged"]}}static get style(){return Fi}},[1,"calcite-tab-nav",{storageId:[513,"storage-id"],syncId:[513,"sync-id"],selectedTitle:[1040],scale:[1],layout:[1537],position:[1],bordered:[1540],indicatorOffset:[1026,"indicator-offset"],indicatorWidth:[1026,"indicator-width"],selectedTabId:[32]},[[0,"calciteInternalTabsFocusPrevious","focusPreviousTabHandler"],[0,"calciteInternalTabsFocusNext","focusNextTabHandler"],[0,"calciteInternalTabsFocusFirst","focusFirstTabHandler"],[0,"calciteInternalTabsFocusLast","focusLastTabHandler"],[0,"calciteInternalTabsActivate","internalActivateTabHandler"],[0,"calciteTabsActivate","activateTabHandler"],[0,"calciteInternalTabsClose","internalCloseTabHandler"],[0,"calciteInternalTabTitleRegister","updateTabTitles"],[16,"calciteInternalTabChange","globalInternalTabChangeHandler"],[0,"calciteInternalTabIconChanged","iconStartChangeHandler"]]]);function gt(){if(typeof customElements>"u")return;["calcite-tab-nav"].forEach(t=>{switch(t){case"calcite-tab-nav":customElements.get(t)||customElements.define(t,Oi);break}})}gt();/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 @@ -114,11 +114,11 @@ import{q as R,H as V,r as y,db as oe,B as X,dc as re,ch as q,t as c,dd as Ze,x a 1 ) ) - );outline-offset:-1px}.close-button:focus,.close-button:hover{color:var(--calcite-ui-text-1);background-color:var(--calcite-ui-foreground-2)}.close-button:active{color:var(--calcite-ui-text-1);background-color:var(--calcite-ui-foreground-3)}.close-button calcite-icon{color:inherit}:host([icon-start][icon-end]) .calcite-tab-title--icon:first-child{margin-inline-end:0.5rem}:host([bordered]){margin-inline-end:0}:host([bordered][selected]){box-shadow:inset 0px -2px var(--calcite-ui-foreground-1)}:host([bordered][selected][position=bottom]){box-shadow:inset 0 2px 0 var(--calcite-ui-foreground-1)}:host([bordered]:hover) .container,:host([bordered]:focus) .container,:host([bordered]:active) .container{position:relative}:host([bordered]:hover) .container{background-color:var(--calcite-button-transparent-hover)}:host([closable]) .container,:host([bordered]) .container{border-inline-start:1px solid transparent;border-inline-end:1px solid transparent}:host([closable]) .container .close-button,:host([bordered]) .container .close-button{margin-inline:0}:host([closable]) .content{box-sizing:border-box;block-size:100%;border-block-end-color:transparent}:host([closable][position=bottom]) .container,:host([bordered][position=bottom]) .container{border-block-start-style:unset}:host([selected][bordered]) .container{border-inline-start-color:var(--calcite-ui-border-1);border-inline-end-color:var(--calcite-ui-border-1)}:host([bordered]) .content{padding-inline:0.75rem}:host([bordered]) .scale-s .content{padding-inline:0.5rem}:host([bordered]) .scale-l .content{padding-inline:1rem}@media (forced-colors: active){:host{outline-width:0;outline-offset:0}:host(:focus) .container{outline-color:highlight}:host([bordered]) .container{border-block-end-style:solid}:host([bordered][position=bottom]) .container{border-block-start-style:solid}:host([bordered][selected]) .container{border-block-end-style:none}:host([bordered][position=bottom][selected]) .container{border-block-start-style:none}.close-button{z-index:var(--calcite-app-z-index)}}:host([hidden]){display:none}[hidden]{display:none}`,Pi=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteTabsActivate=y(this,"calciteTabsActivate",6),this.calciteInternalTabsActivate=y(this,"calciteInternalTabsActivate",6),this.calciteTabsClose=y(this,"calciteTabsClose",6),this.calciteInternalTabsClose=y(this,"calciteInternalTabsClose",6),this.calciteInternalTabsFocusNext=y(this,"calciteInternalTabsFocusNext",6),this.calciteInternalTabsFocusPrevious=y(this,"calciteInternalTabsFocusPrevious",6),this.calciteInternalTabsFocusFirst=y(this,"calciteInternalTabsFocusFirst",6),this.calciteInternalTabsFocusLast=y(this,"calciteInternalTabsFocusLast",6),this.calciteInternalTabTitleRegister=y(this,"calciteInternalTabTitleRegister",6),this.calciteInternalTabIconChanged=y(this,"calciteInternalTabIconChanged",6),this.closeClickHandler=()=>{this.closeTabTitleAndNotify()},this.mutationObserver=J("mutation",()=>this.updateHasText()),this.resizeObserver=J("resize",()=>{this.calciteInternalTabIconChanged.emit()}),this.guid=`calcite-tab-title-${rt()}`,this.selected=!1,this.closable=!1,this.closed=!1,this.disabled=!1,this.iconEnd=void 0,this.iconFlipRtl=void 0,this.iconStart=void 0,this.layout=void 0,this.position="top",this.scale="m",this.bordered=!1,this.tab=void 0,this.messages=void 0,this.messageOverrides=void 0,this.controls=void 0,this.defaultMessages=void 0,this.effectiveLocale=void 0,this.hasText=!1}selectedHandler(){this.selected&&this.emitActiveTab(!1)}onMessagesChange(){}connectedCallback(){pe(this),me(this),ye(this),this.setupTextContentObserver(),this.parentTabNavEl=this.el.closest("calcite-tab-nav"),this.parentTabsEl=this.el.closest("calcite-tabs")}disconnectedCallback(){var e,t,i;(e=this.mutationObserver)==null||e.disconnect(),(t=document.body)==null||t.dispatchEvent(new CustomEvent("calciteTabTitleUnregister",{detail:this.el})),(i=this.resizeObserver)==null||i.disconnect(),be(this),ge(this),xe(this)}async componentWillLoad(){await Ce(this),this.updateHasText(),this.tab&&this.selected&&this.emitActiveTab(!1)}componentWillRender(){this.parentTabsEl&&(this.layout=this.parentTabsEl.layout,this.bordered=this.parentTabsEl.bordered)}render(){const{el:e,closed:t}=this,i=e.id||this.guid,n=c("calcite-icon",{class:{[P.titleIcon]:!0,[P.iconStart]:!0},flipRtl:this.iconFlipRtl==="start"||this.iconFlipRtl==="both",icon:this.iconStart,scale:M(this.scale)}),s=c("calcite-icon",{class:{[P.titleIcon]:!0,[P.iconEnd]:!0},flipRtl:this.iconFlipRtl==="end"||this.iconFlipRtl==="both",icon:this.iconEnd,scale:M(this.scale)});return c(te,{"aria-controls":this.controls,"aria-selected":Rt(this.selected),id:i,role:"tab",tabIndex:this.selected?0:-1},c("div",{class:{container:!0,[P.iconPresent]:!!this.iconStart||!!this.iconEnd,[`scale-${this.scale}`]:!0},hidden:t,ref:a=>{var o;return(o=this.resizeObserver)==null?void 0:o.observe(a)}},c("div",{class:{[P.content]:!0,[P.contentHasText]:this.hasText}},this.iconStart?n:null,c("slot",null),this.iconEnd?s:null),this.renderCloseButton()))}renderCloseButton(){const{closable:e,messages:t}=this;return e?c("button",{"aria-label":t.close,class:P.closeButton,disabled:!1,key:P.closeButton,onClick:this.closeClickHandler,title:t.close,type:"button",ref:i=>this.closeButtonEl=i},c("calcite-icon",{icon:Li.close,scale:M(this.scale)})):null}async componentDidLoad(){this.calciteInternalTabTitleRegister.emit(await this.getTabIdentifier())}componentDidRender(){fe(this,()=>this.selected)}internalTabChangeHandler(e){e.composedPath().find(i=>i.tagName==="CALCITE-TABS")===this.parentTabsEl&&(this.tab?this.selected=this.tab===e.detail.tab:this.getTabIndex().then(i=>{this.selected=i===e.detail.tab}),e.stopPropagation())}onClick(){this.disabled||this.emitActiveTab()}keyDownHandler(e){switch(e.key){case" ":case"Enter":e.composedPath().includes(this.closeButtonEl)||(this.emitActiveTab(),e.preventDefault());break;case"ArrowRight":e.preventDefault(),q(this.el)==="ltr"?this.calciteInternalTabsFocusNext.emit():this.calciteInternalTabsFocusPrevious.emit();break;case"ArrowLeft":e.preventDefault(),q(this.el)==="ltr"?this.calciteInternalTabsFocusPrevious.emit():this.calciteInternalTabsFocusNext.emit();break;case"Home":e.preventDefault(),this.calciteInternalTabsFocusFirst.emit();break;case"End":e.preventDefault(),this.calciteInternalTabsFocusLast.emit();break}}async getTabIndex(){return Array.prototype.indexOf.call(Qe(this.el.parentElement.children).filter(e=>e.matches("calcite-tab-title")),this.el)}async getTabIdentifier(){return this.tab?this.tab:this.getTabIndex()}async updateAriaInfo(e=[],t=[]){this.controls=e[t.indexOf(this.el.id)]||null}effectiveLocaleChange(){ve(this,this.effectiveLocale)}updateHasText(){this.hasText=this.el.textContent.trim().length>0}setupTextContentObserver(){var e;(e=this.mutationObserver)==null||e.observe(this.el,{childList:!0,subtree:!0})}emitActiveTab(e=!0){if(this.disabled||this.closed)return;const t={tab:this.tab};this.calciteInternalTabsActivate.emit(t),e&&requestAnimationFrame(()=>this.calciteTabsActivate.emit())}closeTabTitleAndNotify(){this.closed=!0,this.calciteInternalTabsClose.emit({tab:this.tab}),this.calciteTabsClose.emit()}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{selected:["selectedHandler"],messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return Di}},[1,"calcite-tab-title",{selected:[1540],closable:[516],closed:[1540],disabled:[516],iconEnd:[513,"icon-end"],iconFlipRtl:[513,"icon-flip-rtl"],iconStart:[513,"icon-start"],layout:[1537],position:[1],scale:[1],bordered:[1540],tab:[513],messages:[1040],messageOverrides:[1040],controls:[32],defaultMessages:[32],effectiveLocale:[32],hasText:[32],getTabIndex:[64],getTabIdentifier:[64],updateAriaInfo:[64]},[[16,"calciteInternalTabChange","internalTabChangeHandler"],[0,"click","onClick"],[0,"keydown","keyDownHandler"]]]);function vt(){if(typeof customElements>"u")return;["calcite-tab-title","calcite-icon"].forEach(t=>{switch(t){case"calcite-tab-title":customElements.get(t)||customElements.define(t,Pi);break;case"calcite-icon":customElements.get(t)||ie();break}})}vt();/*! + );outline-offset:-1px}.close-button:focus,.close-button:hover{color:var(--calcite-ui-text-1);background-color:var(--calcite-ui-foreground-2)}.close-button:active{color:var(--calcite-ui-text-1);background-color:var(--calcite-ui-foreground-3)}.close-button calcite-icon{color:inherit}:host([icon-start][icon-end]) .calcite-tab-title--icon:first-child{margin-inline-end:0.5rem}:host([bordered]){margin-inline-end:0}:host([bordered][selected]){box-shadow:inset 0px -2px var(--calcite-ui-foreground-1)}:host([bordered][selected][position=bottom]){box-shadow:inset 0 2px 0 var(--calcite-ui-foreground-1)}:host([bordered]:hover) .container,:host([bordered]:focus) .container,:host([bordered]:active) .container{position:relative}:host([bordered]:hover) .container{background-color:var(--calcite-button-transparent-hover)}:host([closable]) .container,:host([bordered]) .container{border-inline-start:1px solid transparent;border-inline-end:1px solid transparent}:host([closable]) .container .close-button,:host([bordered]) .container .close-button{margin-inline:0}:host([closable]) .content{box-sizing:border-box;block-size:100%;border-block-end-color:transparent}:host([closable][position=bottom]) .container,:host([bordered][position=bottom]) .container{border-block-start-style:unset}:host([selected][bordered]) .container{border-inline-start-color:var(--calcite-ui-border-1);border-inline-end-color:var(--calcite-ui-border-1)}:host([bordered]) .content{padding-inline:0.75rem}:host([bordered]) .scale-s .content{padding-inline:0.5rem}:host([bordered]) .scale-l .content{padding-inline:1rem}@media (forced-colors: active){:host{outline-width:0;outline-offset:0}:host(:focus) .container{outline-color:highlight}:host([bordered]) .container{border-block-end-style:solid}:host([bordered][position=bottom]) .container{border-block-start-style:solid}:host([bordered][selected]) .container{border-block-end-style:none}:host([bordered][position=bottom][selected]) .container{border-block-start-style:none}.close-button{z-index:var(--calcite-app-z-index)}}:host([hidden]){display:none}[hidden]{display:none}`,Pi=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteTabsActivate=y(this,"calciteTabsActivate",6),this.calciteInternalTabsActivate=y(this,"calciteInternalTabsActivate",6),this.calciteTabsClose=y(this,"calciteTabsClose",6),this.calciteInternalTabsClose=y(this,"calciteInternalTabsClose",6),this.calciteInternalTabsFocusNext=y(this,"calciteInternalTabsFocusNext",6),this.calciteInternalTabsFocusPrevious=y(this,"calciteInternalTabsFocusPrevious",6),this.calciteInternalTabsFocusFirst=y(this,"calciteInternalTabsFocusFirst",6),this.calciteInternalTabsFocusLast=y(this,"calciteInternalTabsFocusLast",6),this.calciteInternalTabTitleRegister=y(this,"calciteInternalTabTitleRegister",6),this.calciteInternalTabIconChanged=y(this,"calciteInternalTabIconChanged",6),this.closeClickHandler=()=>{this.closeTabTitleAndNotify()},this.mutationObserver=Y("mutation",()=>this.updateHasText()),this.resizeObserver=Y("resize",()=>{this.calciteInternalTabIconChanged.emit()}),this.guid=`calcite-tab-title-${rt()}`,this.selected=!1,this.closable=!1,this.closed=!1,this.disabled=!1,this.iconEnd=void 0,this.iconFlipRtl=void 0,this.iconStart=void 0,this.layout=void 0,this.position="top",this.scale="m",this.bordered=!1,this.tab=void 0,this.messages=void 0,this.messageOverrides=void 0,this.controls=void 0,this.defaultMessages=void 0,this.effectiveLocale=void 0,this.hasText=!1}selectedHandler(){this.selected&&this.emitActiveTab(!1)}onMessagesChange(){}connectedCallback(){pe(this),me(this),ye(this),this.setupTextContentObserver(),this.parentTabNavEl=this.el.closest("calcite-tab-nav"),this.parentTabsEl=this.el.closest("calcite-tabs")}disconnectedCallback(){var e,t,i;(e=this.mutationObserver)==null||e.disconnect(),(t=document.body)==null||t.dispatchEvent(new CustomEvent("calciteTabTitleUnregister",{detail:this.el})),(i=this.resizeObserver)==null||i.disconnect(),be(this),ge(this),xe(this)}async componentWillLoad(){await Ce(this),this.updateHasText(),this.tab&&this.selected&&this.emitActiveTab(!1)}componentWillRender(){this.parentTabsEl&&(this.layout=this.parentTabsEl.layout,this.bordered=this.parentTabsEl.bordered)}render(){const{el:e,closed:t}=this,i=e.id||this.guid,n=c("calcite-icon",{class:{[P.titleIcon]:!0,[P.iconStart]:!0},flipRtl:this.iconFlipRtl==="start"||this.iconFlipRtl==="both",icon:this.iconStart,scale:M(this.scale)}),s=c("calcite-icon",{class:{[P.titleIcon]:!0,[P.iconEnd]:!0},flipRtl:this.iconFlipRtl==="end"||this.iconFlipRtl==="both",icon:this.iconEnd,scale:M(this.scale)});return c(te,{"aria-controls":this.controls,"aria-selected":Rt(this.selected),id:i,role:"tab",tabIndex:this.selected?0:-1},c("div",{class:{container:!0,[P.iconPresent]:!!this.iconStart||!!this.iconEnd,[`scale-${this.scale}`]:!0},hidden:t,ref:a=>{var o;return(o=this.resizeObserver)==null?void 0:o.observe(a)}},c("div",{class:{[P.content]:!0,[P.contentHasText]:this.hasText}},this.iconStart?n:null,c("slot",null),this.iconEnd?s:null),this.renderCloseButton()))}renderCloseButton(){const{closable:e,messages:t}=this;return e?c("button",{"aria-label":t.close,class:P.closeButton,disabled:!1,key:P.closeButton,onClick:this.closeClickHandler,title:t.close,type:"button",ref:i=>this.closeButtonEl=i},c("calcite-icon",{icon:Li.close,scale:M(this.scale)})):null}async componentDidLoad(){this.calciteInternalTabTitleRegister.emit(await this.getTabIdentifier())}componentDidRender(){fe(this,()=>this.selected)}internalTabChangeHandler(e){e.composedPath().find(i=>i.tagName==="CALCITE-TABS")===this.parentTabsEl&&(this.tab?this.selected=this.tab===e.detail.tab:this.getTabIndex().then(i=>{this.selected=i===e.detail.tab}),e.stopPropagation())}onClick(){this.disabled||this.emitActiveTab()}keyDownHandler(e){switch(e.key){case" ":case"Enter":e.composedPath().includes(this.closeButtonEl)||(this.emitActiveTab(),e.preventDefault());break;case"ArrowRight":e.preventDefault(),q(this.el)==="ltr"?this.calciteInternalTabsFocusNext.emit():this.calciteInternalTabsFocusPrevious.emit();break;case"ArrowLeft":e.preventDefault(),q(this.el)==="ltr"?this.calciteInternalTabsFocusPrevious.emit():this.calciteInternalTabsFocusNext.emit();break;case"Home":e.preventDefault(),this.calciteInternalTabsFocusFirst.emit();break;case"End":e.preventDefault(),this.calciteInternalTabsFocusLast.emit();break}}async getTabIndex(){return Array.prototype.indexOf.call(Qe(this.el.parentElement.children).filter(e=>e.matches("calcite-tab-title")),this.el)}async getTabIdentifier(){return this.tab?this.tab:this.getTabIndex()}async updateAriaInfo(e=[],t=[]){this.controls=e[t.indexOf(this.el.id)]||null}effectiveLocaleChange(){ve(this,this.effectiveLocale)}updateHasText(){this.hasText=this.el.textContent.trim().length>0}setupTextContentObserver(){var e;(e=this.mutationObserver)==null||e.observe(this.el,{childList:!0,subtree:!0})}emitActiveTab(e=!0){if(this.disabled||this.closed)return;const t={tab:this.tab};this.calciteInternalTabsActivate.emit(t),e&&requestAnimationFrame(()=>this.calciteTabsActivate.emit())}closeTabTitleAndNotify(){this.closed=!0,this.calciteInternalTabsClose.emit({tab:this.tab}),this.calciteTabsClose.emit()}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{selected:["selectedHandler"],messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return Di}},[1,"calcite-tab-title",{selected:[1540],closable:[516],closed:[1540],disabled:[516],iconEnd:[513,"icon-end"],iconFlipRtl:[513,"icon-flip-rtl"],iconStart:[513,"icon-start"],layout:[1537],position:[1],scale:[1],bordered:[1540],tab:[513],messages:[1040],messageOverrides:[1040],controls:[32],defaultMessages:[32],effectiveLocale:[32],hasText:[32],getTabIndex:[64],getTabIdentifier:[64],updateAriaInfo:[64]},[[16,"calciteInternalTabChange","internalTabChangeHandler"],[0,"click","onClick"],[0,"keydown","keyDownHandler"]]]);function vt(){if(typeof customElements>"u")return;["calcite-tab-title","calcite-icon"].forEach(t=>{switch(t){case"calcite-tab-title":customElements.get(t)||customElements.define(t,Pi);break;case"calcite-icon":customElements.get(t)||ie();break}})}vt();/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const Mi={titleGroup:"title-group"},Ri=":host{display:flex;flex-direction:column}:host([bordered]){box-shadow:inset 0 1px 0 var(--calcite-ui-border-1);background-color:var(--calcite-ui-foreground-1)}:host([bordered]:not([position=bottom])) ::slotted(calcite-tab-nav){margin-block-end:-1px}:host([bordered][position=bottom]){box-shadow:inset 0 1px 0 var(--calcite-ui-border-1), inset 0 -1px 0 var(--calcite-ui-border-1)}:host([bordered]) section{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1)}:host([bordered][scale=s]) section{padding:0.75rem}:host([bordered][scale=m]) section{padding:0.5rem}:host([bordered][scale=l]) section{padding:1rem}:host([position=bottom]){flex-direction:column-reverse}section{display:flex;flex-grow:1;overflow:hidden;border-block-start-width:1px;border-block-start-color:var(--calcite-ui-border-1);border-block-start-style:solid}:host([position=bottom]) section{flex-direction:column-reverse;border-block-start-width:0px;border-block-end-width:1px;border-block-end-color:var(--calcite-ui-border-1)}:host([position=bottom]:not([bordered])) section{border-block-end-style:solid}@media (forced-colors: active){:host([bordered]) section{border-block-start-width:0px;border-block-end-width:1px}:host([position=bottom][bordered]) section{border-block-start-width:1px;border-block-end-width:0px}}:host([hidden]){display:none}[hidden]{display:none}",Vi=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.mutationObserver=J("mutation",e=>{for(const t of e){const i=t.target;(i.nodeName==="CALCITE-TAB-NAV"||i.nodeName==="CALCITE-TAB-TITLE"||i.nodeName==="CALCITE-TAB")&&this.updateItems()}}),this.layout="inline",this.position="top",this.scale="m",this.bordered=!1,this.titles=[],this.tabs=[]}handleInheritableProps(){this.updateItems()}connectedCallback(){this.mutationObserver.observe(this.el,{childList:!0}),this.updateItems()}async componentWillLoad(){this.updateItems()}disconnectedCallback(){var e;(e=this.mutationObserver)==null||e.disconnect()}render(){return c(Te,null,c("slot",{name:Mi.titleGroup}),c("section",null,c("slot",null)))}calciteInternalTabTitleRegister(e){this.titles=[...this.titles,e.target],this.registryHandler(),e.stopPropagation()}calciteTabTitleUnregister(e){this.titles=this.titles.filter(t=>t!==e.detail),this.registryHandler(),e.stopPropagation()}calciteInternalTabRegister(e){this.tabs=[...this.tabs,e.target],this.registryHandler(),e.stopPropagation()}calciteTabUnregister(e){this.tabs=this.tabs.filter(t=>t!==e.detail),this.registryHandler(),e.stopPropagation()}updateItems(){const{position:e,scale:t}=this,i=this.el.querySelector("calcite-tab-nav");i&&(i.position=e,i.scale=t),Array.from(this.el.querySelectorAll("calcite-tab")).forEach(n=>{n.parentElement===this.el&&(n.scale=t)}),Array.from(this.el.querySelectorAll("calcite-tab-nav > calcite-tab-title")).forEach(n=>{n.position=e,n.scale=t})}async registryHandler(){let e,t;if(this.tabs.some(i=>i.tab)||this.titles.some(i=>i.tab))e=this.tabs.sort((i,n)=>i.tab.localeCompare(n.tab)).map(i=>i.id),t=this.titles.sort((i,n)=>i.tab.localeCompare(n.tab)).map(i=>i.id);else{const i=await Promise.all(this.tabs.map(s=>s.getTabIndex())),n=await Promise.all(this.titles.map(s=>s.getTabIndex()));e=i.reduce((s,a,o)=>(s[a]=this.tabs[o].id,s),[]),t=n.reduce((s,a,o)=>(s[a]=this.titles[o].id,s),[])}this.tabs.forEach(i=>i.updateAriaInfo(e,t)),this.titles.forEach(i=>i.updateAriaInfo(e,t))}get el(){return this}static get watchers(){return{position:["handleInheritableProps"],scale:["handleInheritableProps"]}}static get style(){return Ri}},[1,"calcite-tabs",{layout:[513],position:[513],scale:[513],bordered:[4],titles:[32],tabs:[32]},[[0,"calciteInternalTabTitleRegister","calciteInternalTabTitleRegister"],[16,"calciteTabTitleUnregister","calciteTabTitleUnregister"],[0,"calciteInternalTabRegister","calciteInternalTabRegister"],[16,"calciteTabUnregister","calciteTabUnregister"]]]);function yt(){if(typeof customElements>"u")return;["calcite-tabs"].forEach(t=>{switch(t){case"calcite-tabs":customElements.get(t)||customElements.define(t,Vi);break}})}yt();/*! + */const Mi={titleGroup:"title-group"},Ri=":host{display:flex;flex-direction:column}:host([bordered]){box-shadow:inset 0 1px 0 var(--calcite-ui-border-1);background-color:var(--calcite-ui-foreground-1)}:host([bordered]:not([position=bottom])) ::slotted(calcite-tab-nav){margin-block-end:-1px}:host([bordered][position=bottom]){box-shadow:inset 0 1px 0 var(--calcite-ui-border-1), inset 0 -1px 0 var(--calcite-ui-border-1)}:host([bordered]) section{border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1)}:host([bordered][scale=s]) section{padding:0.75rem}:host([bordered][scale=m]) section{padding:0.5rem}:host([bordered][scale=l]) section{padding:1rem}:host([position=bottom]){flex-direction:column-reverse}section{display:flex;flex-grow:1;overflow:hidden;border-block-start-width:1px;border-block-start-color:var(--calcite-ui-border-1);border-block-start-style:solid}:host([position=bottom]) section{flex-direction:column-reverse;border-block-start-width:0px;border-block-end-width:1px;border-block-end-color:var(--calcite-ui-border-1)}:host([position=bottom]:not([bordered])) section{border-block-end-style:solid}@media (forced-colors: active){:host([bordered]) section{border-block-start-width:0px;border-block-end-width:1px}:host([position=bottom][bordered]) section{border-block-start-width:1px;border-block-end-width:0px}}:host([hidden]){display:none}[hidden]{display:none}",Vi=R(class extends V{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.mutationObserver=Y("mutation",e=>{for(const t of e){const i=t.target;(i.nodeName==="CALCITE-TAB-NAV"||i.nodeName==="CALCITE-TAB-TITLE"||i.nodeName==="CALCITE-TAB")&&this.updateItems()}}),this.layout="inline",this.position="top",this.scale="m",this.bordered=!1,this.titles=[],this.tabs=[]}handleInheritableProps(){this.updateItems()}connectedCallback(){this.mutationObserver.observe(this.el,{childList:!0}),this.updateItems()}async componentWillLoad(){this.updateItems()}disconnectedCallback(){var e;(e=this.mutationObserver)==null||e.disconnect()}render(){return c(Te,null,c("slot",{name:Mi.titleGroup}),c("section",null,c("slot",null)))}calciteInternalTabTitleRegister(e){this.titles=[...this.titles,e.target],this.registryHandler(),e.stopPropagation()}calciteTabTitleUnregister(e){this.titles=this.titles.filter(t=>t!==e.detail),this.registryHandler(),e.stopPropagation()}calciteInternalTabRegister(e){this.tabs=[...this.tabs,e.target],this.registryHandler(),e.stopPropagation()}calciteTabUnregister(e){this.tabs=this.tabs.filter(t=>t!==e.detail),this.registryHandler(),e.stopPropagation()}updateItems(){const{position:e,scale:t}=this,i=this.el.querySelector("calcite-tab-nav");i&&(i.position=e,i.scale=t),Array.from(this.el.querySelectorAll("calcite-tab")).forEach(n=>{n.parentElement===this.el&&(n.scale=t)}),Array.from(this.el.querySelectorAll("calcite-tab-nav > calcite-tab-title")).forEach(n=>{n.position=e,n.scale=t})}async registryHandler(){let e,t;if(this.tabs.some(i=>i.tab)||this.titles.some(i=>i.tab))e=this.tabs.sort((i,n)=>i.tab.localeCompare(n.tab)).map(i=>i.id),t=this.titles.sort((i,n)=>i.tab.localeCompare(n.tab)).map(i=>i.id);else{const i=await Promise.all(this.tabs.map(s=>s.getTabIndex())),n=await Promise.all(this.titles.map(s=>s.getTabIndex()));e=i.reduce((s,a,o)=>(s[a]=this.tabs[o].id,s),[]),t=n.reduce((s,a,o)=>(s[a]=this.titles[o].id,s),[])}this.tabs.forEach(i=>i.updateAriaInfo(e,t)),this.titles.forEach(i=>i.updateAriaInfo(e,t))}get el(){return this}static get watchers(){return{position:["handleInheritableProps"],scale:["handleInheritableProps"]}}static get style(){return Ri}},[1,"calcite-tabs",{layout:[513],position:[513],scale:[513],bordered:[4],titles:[32],tabs:[32]},[[0,"calciteInternalTabTitleRegister","calciteInternalTabTitleRegister"],[16,"calciteTabTitleUnregister","calciteTabTitleUnregister"],[0,"calciteInternalTabRegister","calciteInternalTabRegister"],[16,"calciteTabUnregister","calciteTabUnregister"]]]);function yt(){if(typeof customElements>"u")return;["calcite-tabs"].forEach(t=>{switch(t){case"calcite-tabs":customElements.get(t)||customElements.define(t,Vi);break}})}yt();/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-dropdown-group-bJt5U1w-.js b/dist/assets/calcite-dropdown-group-5Uhho6JI.js similarity index 95% rename from dist/assets/calcite-dropdown-group-bJt5U1w-.js rename to dist/assets/calcite-dropdown-group-5Uhho6JI.js index 68dcfb8..0152f8f 100644 --- a/dist/assets/calcite-dropdown-group-bJt5U1w-.js +++ b/dist/assets/calcite-dropdown-group-5Uhho6JI.js @@ -1,4 +1,4 @@ -import{q as s,H as a,r as d,t as o,x as l}from"./index-J0iiHjMT.js";import{c}from"./observers-JyBmMU24.js";import{C as r}from"./resources2-gI505pgk.js";/*! +import{p as s,H as a,d,k as o,l}from"./index-pCX-0tJH.js";import{c}from"./observers-eNe735aq.js";import{C as r}from"./resources2-gI505pgk.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-dropdown-item-HvBJs5CH.js b/dist/assets/calcite-dropdown-item-UdaqM-Sc.js similarity index 96% rename from dist/assets/calcite-dropdown-item-HvBJs5CH.js rename to dist/assets/calcite-dropdown-item-UdaqM-Sc.js index 9b82e5d..f9ec2a9 100644 --- a/dist/assets/calcite-dropdown-item-HvBJs5CH.js +++ b/dist/assets/calcite-dropdown-item-UdaqM-Sc.js @@ -1,4 +1,4 @@ -import{q as k,H as v,r as c,t as i,v as I,x as D}from"./index-J0iiHjMT.js";import{C as t}from"./resources2-gI505pgk.js";import{c as E,s as x,a as y}from"./loadable-sxY2K1G3.js";import{g as a}from"./component-dtiBfYiX.js";import{d as C}from"./icon-ZwpY5ksA.js";import"./observers-JyBmMU24.js";/*! +import{p as k,H as v,d as c,k as i,t as I,l as D}from"./index-pCX-0tJH.js";import{C as t}from"./resources2-gI505pgk.js";import{c as E,s as x,a as y}from"./loadable-uNbe2Ndt.js";import{g as a}from"./component-dtiBfYiX.js";import{d as C}from"./icon-BW6RCrUr.js";import"./observers-eNe735aq.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-dropdown-caxGPYrb.js b/dist/assets/calcite-dropdown-r3pviJNw.js similarity index 92% rename from dist/assets/calcite-dropdown-caxGPYrb.js rename to dist/assets/calcite-dropdown-r3pviJNw.js index 67e8261..5e7ccf8 100644 --- a/dist/assets/calcite-dropdown-caxGPYrb.js +++ b/dist/assets/calcite-dropdown-r3pviJNw.js @@ -1,8 +1,8 @@ -import{q as v,H as E,r,t as s,v as d,x as D,B as y,j$ as a,ac as p}from"./index-J0iiHjMT.js";import{f as C,c as h,b as x,a as O,F as m,r as I}from"./floating-ui-McpI0u1Z.js";import{g as H}from"./guid-6vN-YNJI.js";import{c as P,u as S,d as k}from"./interactive-NKzPUNL4.js";import{i as F}from"./key-qdHumIlA.js";import{c as z,s as T,a as A}from"./loadable-sxY2K1G3.js";import{c as f}from"./observers-JyBmMU24.js";import{o as u}from"./openCloseComponent-yw47Oy2q.js";import"./debounce-HnHf1UOZ.js";/*! +import{p as E,H as v,d as r,k as s,t as d,l as D,m as y,k6 as a,X as p}from"./index-pCX-0tJH.js";import{f as C,c as h,b as x,a as O,F as m,r as I}from"./floating-ui-C10Xvlxv.js";import{g as H}from"./guid-6vN-YNJI.js";import{c as P,u as S,d as k}from"./interactive-9W9APeiw.js";import{i as F}from"./key-qdHumIlA.js";import{c as z,s as T,a as A}from"./loadable-uNbe2Ndt.js";import{c as f}from"./observers-eNe735aq.js";import{o as u}from"./openCloseComponent-lU2sdEaR.js";import"./debounce-HnHf1UOZ.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const B={dropdownTrigger:"trigger"},L=":host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:inline-flex;flex:0 1 auto}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host .calcite-dropdown-wrapper{--calcite-floating-ui-z-index:var(--calcite-app-z-index-dropdown);display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index);visibility:hidden}.calcite-dropdown-wrapper .calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}.calcite-dropdown-wrapper[data-placement^=bottom] .calcite-floating-ui-anim{transform:translateY(-5px)}.calcite-dropdown-wrapper[data-placement^=top] .calcite-floating-ui-anim{transform:translateY(5px)}.calcite-dropdown-wrapper[data-placement^=left] .calcite-floating-ui-anim{transform:translateX(5px)}.calcite-dropdown-wrapper[data-placement^=right] .calcite-floating-ui-anim{transform:translateX(-5px)}.calcite-dropdown-wrapper[data-placement] .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([open]) .calcite-dropdown-wrapper{visibility:visible}:host .calcite-dropdown-content{max-block-size:45vh;inline-size:auto;overflow-y:auto;overflow-x:hidden;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}.calcite-trigger-container{position:relative;display:flex;flex:1 1 auto;word-wrap:break-word;word-break:break-word}@media (forced-colors: active){:host([open]) .calcite-dropdown-wrapper{border:1px solid canvasText}}:host([width=s]){--calcite-dropdown-width:12rem}:host([width=m]){--calcite-dropdown-width:14rem}:host([width=l]){--calcite-dropdown-width:16rem}:host([hidden]){display:none}[hidden]{display:none}",w=v(class extends E{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteDropdownSelect=r(this,"calciteDropdownSelect",6),this.calciteDropdownBeforeClose=r(this,"calciteDropdownBeforeClose",6),this.calciteDropdownClose=r(this,"calciteDropdownClose",6),this.calciteDropdownBeforeOpen=r(this,"calciteDropdownBeforeOpen",6),this.calciteDropdownOpen=r(this,"calciteDropdownOpen",6),this.items=[],this.groups=[],this.mutationObserver=f("mutation",()=>this.updateItems()),this.resizeObserver=f("resize",e=>this.resizeObserverCallback(e)),this.openTransitionProp="opacity",this.guid=`calcite-dropdown-${H()}`,this.defaultAssignedElements=[],this.slotChangeHandler=e=>{this.defaultAssignedElements=e.target.assignedElements({flatten:!0}),this.updateItems()},this.setFilteredPlacements=()=>{const{el:e,flipPlacements:t}=this;this.filteredFlipPlacements=t?C(t,e):null},this.updateTriggers=e=>{this.triggers=e.target.assignedElements({flatten:!0}),this.reposition(!0)},this.updateItems=()=>{this.items=this.groups.map(e=>Array.from(e==null?void 0:e.querySelectorAll("calcite-dropdown-item"))).reduce((e,t)=>[...e,...t],[]),this.updateSelectedItems(),this.reposition(!0),this.items.forEach(e=>e.scale=this.scale)},this.updateGroups=e=>{const t=e.target.assignedElements({flatten:!0}).filter(i=>i==null?void 0:i.matches("calcite-dropdown-group"));this.groups=t,this.updateItems()},this.resizeObserverCallback=e=>{e.forEach(t=>{const{target:i}=t;i===this.referenceEl?this.setDropdownWidth():i===this.scrollerEl&&this.setMaxScrollerHeight()})},this.setDropdownWidth=()=>{const{referenceEl:e,scrollerEl:t}=this,i=e==null?void 0:e.clientWidth;!i||!t||(t.style.minWidth=`${i}px`)},this.setMaxScrollerHeight=()=>{const{scrollerEl:e}=this;if(!e)return;this.reposition(!0);const t=this.getMaxScrollerHeight();e.style.maxHeight=t>0?`${t}px`:"",this.reposition(!0)},this.setScrollerAndTransitionEl=e=>{this.resizeObserver.observe(e),this.scrollerEl=e,this.transitionEl=e},this.setReferenceEl=e=>{this.referenceEl=e,h(this,this.referenceEl,this.floatingEl),this.resizeObserver.observe(e)},this.setFloatingEl=e=>{this.floatingEl=e,h(this,this.referenceEl,this.floatingEl)},this.keyDownHandler=e=>{if(!e.composedPath().includes(this.referenceEl))return;const{defaultPrevented:t,key:i}=e;if(!t){if(this.open){if(i==="Escape"){this.closeCalciteDropdown(),e.preventDefault();return}else if(e.shiftKey&&i==="Tab"){this.closeCalciteDropdown(),e.preventDefault();return}}F(i)?(this.openCalciteDropdown(),e.preventDefault()):i==="Escape"&&(this.closeCalciteDropdown(),e.preventDefault())}},this.focusOnFirstActiveOrFirstItem=()=>{this.getFocusableElement(this.items.find(e=>e.selected)||this.items[0])},this.toggleOpenEnd=()=>{this.focusOnFirstActiveOrFirstItem(),this.el.removeEventListener("calciteDropdownOpen",this.toggleOpenEnd)},this.openCalciteDropdown=()=>{this.open=!this.open,this.open&&this.el.addEventListener("calciteDropdownOpen",this.toggleOpenEnd)},this.open=!1,this.closeOnSelectDisabled=!1,this.disabled=!1,this.flipPlacements=void 0,this.maxItems=0,this.overlayPositioning="absolute",this.placement=x,this.selectedItems=[],this.type="click",this.width=void 0,this.scale="m"}openHandler(e){if(!this.disabled){e&&this.reposition(!0),u(this);return}this.open=!1}handleDisabledChange(e){e||(this.open=!1)}flipPlacementsHandler(){this.setFilteredPlacements(),this.reposition(!0)}maxItemsHandler(){this.setMaxScrollerHeight()}overlayPositioningHandler(){this.reposition(!0)}placementHandler(){this.reposition(!0)}handlePropsChange(){this.updateItems()}async setFocus(){await z(this),this.el.focus()}connectedCallback(){var e;(e=this.mutationObserver)==null||e.observe(this.el,{childList:!0,subtree:!0}),this.setFilteredPlacements(),this.reposition(!0),this.open&&(this.openHandler(this.open),u(this)),P(this),this.updateItems()}componentWillLoad(){T(this)}componentDidLoad(){A(this),this.reposition(!0)}componentDidRender(){S(this)}disconnectedCallback(){var e,t;(e=this.mutationObserver)==null||e.disconnect(),(t=this.resizeObserver)==null||t.disconnect(),k(this),O(this,this.referenceEl,this.floatingEl)}render(){const{open:e,guid:t}=this;return s(D,null,s("div",{class:"calcite-trigger-container",id:`${t}-menubutton`,onClick:this.openCalciteDropdown,onKeyDown:this.keyDownHandler,ref:this.setReferenceEl},s("slot",{"aria-controls":`${t}-menu`,"aria-expanded":d(e),"aria-haspopup":"menu",name:B.dropdownTrigger,onSlotchange:this.updateTriggers})),s("div",{"aria-hidden":d(!e),class:"calcite-dropdown-wrapper",ref:this.setFloatingEl},s("div",{"aria-labelledby":`${t}-menubutton`,class:{"calcite-dropdown-content":!0,[m.animation]:!0,[m.animationActive]:e},id:`${t}-menu`,role:"menu",ref:this.setScrollerAndTransitionEl},s("slot",{onSlotchange:this.updateGroups}))))}async reposition(e=!1){const{floatingEl:t,referenceEl:i,placement:o,overlayPositioning:n,filteredFlipPlacements:l}=this;return I(this,{floatingEl:t,referenceEl:i,overlayPositioning:n,placement:o,flipPlacements:l,type:"menu"},e)}closeCalciteDropdownOnClick(e){this.disabled||!y(e)||!this.open||e.composedPath().includes(this.el)||this.closeCalciteDropdown(!1)}closeCalciteDropdownOnEvent(e){this.closeCalciteDropdown(),e.stopPropagation()}closeCalciteDropdownOnOpenEvent(e){e.composedPath().includes(this.el)||(this.open=!1)}pointerEnterHandler(){this.disabled||this.type!=="hover"||this.openCalciteDropdown()}pointerLeaveHandler(){this.disabled||this.type!=="hover"||this.closeCalciteDropdown()}calciteInternalDropdownItemKeyEvent(e){const{keyboardEvent:t}=e.detail,i=t.target;switch(t.key){case"Tab":this.open=!1,this.updateTabIndexOfItems(i);break;case"ArrowDown":a(this.items,i,"next");break;case"ArrowUp":a(this.items,i,"previous");break;case"Home":a(this.items,i,"first");break;case"End":a(this.items,i,"last");break}e.stopPropagation()}handleItemSelect(e){this.updateSelectedItems(),e.stopPropagation(),this.calciteDropdownSelect.emit(),(!this.closeOnSelectDisabled||e.detail.requestedDropdownGroup.selectionMode==="none")&&this.closeCalciteDropdown(),e.stopPropagation()}onBeforeOpen(){this.calciteDropdownBeforeOpen.emit()}onOpen(){this.calciteDropdownOpen.emit()}onBeforeClose(){this.calciteDropdownBeforeClose.emit()}onClose(){this.calciteDropdownClose.emit()}updateSelectedItems(){this.selectedItems=this.items.filter(e=>e.selected)}getMaxScrollerHeight(){const{maxItems:e,items:t}=this;let i=0,o=0,n;return this.groups.forEach(l=>{e>0&&i{b===0&&(isNaN(n)&&(n=c.offsetTop),o+=n),ie?o:0}closeCalciteDropdown(e=!0){this.open=!1,e&&p(this.triggers[0])}getFocusableElement(e){if(!e)return;const t=e.attributes.isLink?e.shadowRoot.querySelector("a"):e;p(t)}updateTabIndexOfItems(e){this.items.forEach(t=>{t.tabIndex=e!==t?-1:0})}static get delegatesFocus(){return!0}get el(){return this}static get watchers(){return{open:["openHandler"],disabled:["handleDisabledChange"],flipPlacements:["flipPlacementsHandler"],maxItems:["maxItemsHandler"],overlayPositioning:["overlayPositioningHandler"],placement:["placementHandler"],scale:["handlePropsChange"]}}static get style(){return L}},[17,"calcite-dropdown",{open:[1540],closeOnSelectDisabled:[516,"close-on-select-disabled"],disabled:[516],flipPlacements:[16],maxItems:[514,"max-items"],overlayPositioning:[513,"overlay-positioning"],placement:[513],selectedItems:[1040],type:[513],width:[513],scale:[513],setFocus:[64],reposition:[64]},[[9,"pointerdown","closeCalciteDropdownOnClick"],[0,"calciteInternalDropdownCloseRequest","closeCalciteDropdownOnEvent"],[8,"calciteDropdownOpen","closeCalciteDropdownOnOpenEvent"],[1,"pointerenter","pointerEnterHandler"],[1,"pointerleave","pointerLeaveHandler"],[0,"calciteInternalDropdownItemKeyEvent","calciteInternalDropdownItemKeyEvent"],[0,"calciteInternalDropdownItemSelect","handleItemSelect"]]]);function g(){if(typeof customElements>"u")return;["calcite-dropdown"].forEach(t=>{switch(t){case"calcite-dropdown":customElements.get(t)||customElements.define(t,w);break}})}g();/*! + */const L={dropdownTrigger:"trigger"},B=":host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:inline-flex;flex:0 1 auto}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host .calcite-dropdown-wrapper{--calcite-floating-ui-z-index:var(--calcite-app-z-index-dropdown);display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index);visibility:hidden}.calcite-dropdown-wrapper .calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}.calcite-dropdown-wrapper[data-placement^=bottom] .calcite-floating-ui-anim{transform:translateY(-5px)}.calcite-dropdown-wrapper[data-placement^=top] .calcite-floating-ui-anim{transform:translateY(5px)}.calcite-dropdown-wrapper[data-placement^=left] .calcite-floating-ui-anim{transform:translateX(5px)}.calcite-dropdown-wrapper[data-placement^=right] .calcite-floating-ui-anim{transform:translateX(-5px)}.calcite-dropdown-wrapper[data-placement] .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([open]) .calcite-dropdown-wrapper{visibility:visible}:host .calcite-dropdown-content{max-block-size:45vh;inline-size:auto;overflow-y:auto;overflow-x:hidden;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}.calcite-trigger-container{position:relative;display:flex;flex:1 1 auto;word-wrap:break-word;word-break:break-word}@media (forced-colors: active){:host([open]) .calcite-dropdown-wrapper{border:1px solid canvasText}}:host([width=s]){--calcite-dropdown-width:12rem}:host([width=m]){--calcite-dropdown-width:14rem}:host([width=l]){--calcite-dropdown-width:16rem}:host([hidden]){display:none}[hidden]{display:none}",w=E(class extends v{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteDropdownSelect=r(this,"calciteDropdownSelect",6),this.calciteDropdownBeforeClose=r(this,"calciteDropdownBeforeClose",6),this.calciteDropdownClose=r(this,"calciteDropdownClose",6),this.calciteDropdownBeforeOpen=r(this,"calciteDropdownBeforeOpen",6),this.calciteDropdownOpen=r(this,"calciteDropdownOpen",6),this.items=[],this.groups=[],this.mutationObserver=f("mutation",()=>this.updateItems()),this.resizeObserver=f("resize",e=>this.resizeObserverCallback(e)),this.openTransitionProp="opacity",this.guid=`calcite-dropdown-${H()}`,this.defaultAssignedElements=[],this.slotChangeHandler=e=>{this.defaultAssignedElements=e.target.assignedElements({flatten:!0}),this.updateItems()},this.setFilteredPlacements=()=>{const{el:e,flipPlacements:t}=this;this.filteredFlipPlacements=t?C(t,e):null},this.updateTriggers=e=>{this.triggers=e.target.assignedElements({flatten:!0}),this.reposition(!0)},this.updateItems=()=>{this.items=this.groups.map(e=>Array.from(e==null?void 0:e.querySelectorAll("calcite-dropdown-item"))).reduce((e,t)=>[...e,...t],[]),this.updateSelectedItems(),this.reposition(!0),this.items.forEach(e=>e.scale=this.scale)},this.updateGroups=e=>{const t=e.target.assignedElements({flatten:!0}).filter(i=>i==null?void 0:i.matches("calcite-dropdown-group"));this.groups=t,this.updateItems()},this.resizeObserverCallback=e=>{e.forEach(t=>{const{target:i}=t;i===this.referenceEl?this.setDropdownWidth():i===this.scrollerEl&&this.setMaxScrollerHeight()})},this.setDropdownWidth=()=>{const{referenceEl:e,scrollerEl:t}=this,i=e==null?void 0:e.clientWidth;!i||!t||(t.style.minWidth=`${i}px`)},this.setMaxScrollerHeight=()=>{const{scrollerEl:e}=this;if(!e)return;this.reposition(!0);const t=this.getMaxScrollerHeight();e.style.maxHeight=t>0?`${t}px`:"",this.reposition(!0)},this.setScrollerAndTransitionEl=e=>{this.resizeObserver.observe(e),this.scrollerEl=e,this.transitionEl=e},this.setReferenceEl=e=>{this.referenceEl=e,h(this,this.referenceEl,this.floatingEl),this.resizeObserver.observe(e)},this.setFloatingEl=e=>{this.floatingEl=e,h(this,this.referenceEl,this.floatingEl)},this.keyDownHandler=e=>{if(!e.composedPath().includes(this.referenceEl))return;const{defaultPrevented:t,key:i}=e;if(!t){if(this.open){if(i==="Escape"){this.closeCalciteDropdown(),e.preventDefault();return}else if(e.shiftKey&&i==="Tab"){this.closeCalciteDropdown(),e.preventDefault();return}}F(i)?(this.openCalciteDropdown(),e.preventDefault()):i==="Escape"&&(this.closeCalciteDropdown(),e.preventDefault())}},this.focusOnFirstActiveOrFirstItem=()=>{this.getFocusableElement(this.items.find(e=>e.selected)||this.items[0])},this.toggleOpenEnd=()=>{this.focusOnFirstActiveOrFirstItem(),this.el.removeEventListener("calciteDropdownOpen",this.toggleOpenEnd)},this.openCalciteDropdown=()=>{this.open=!this.open,this.open&&this.el.addEventListener("calciteDropdownOpen",this.toggleOpenEnd)},this.open=!1,this.closeOnSelectDisabled=!1,this.disabled=!1,this.flipPlacements=void 0,this.maxItems=0,this.overlayPositioning="absolute",this.placement=x,this.selectedItems=[],this.type="click",this.width=void 0,this.scale="m"}openHandler(e){if(!this.disabled){e&&this.reposition(!0),u(this);return}this.open=!1}handleDisabledChange(e){e||(this.open=!1)}flipPlacementsHandler(){this.setFilteredPlacements(),this.reposition(!0)}maxItemsHandler(){this.setMaxScrollerHeight()}overlayPositioningHandler(){this.reposition(!0)}placementHandler(){this.reposition(!0)}handlePropsChange(){this.updateItems()}async setFocus(){await z(this),this.el.focus()}connectedCallback(){var e;(e=this.mutationObserver)==null||e.observe(this.el,{childList:!0,subtree:!0}),this.setFilteredPlacements(),this.reposition(!0),this.open&&(this.openHandler(this.open),u(this)),P(this),this.updateItems()}componentWillLoad(){T(this)}componentDidLoad(){A(this),this.reposition(!0)}componentDidRender(){S(this)}disconnectedCallback(){var e,t;(e=this.mutationObserver)==null||e.disconnect(),(t=this.resizeObserver)==null||t.disconnect(),k(this),O(this,this.referenceEl,this.floatingEl)}render(){const{open:e,guid:t}=this;return s(D,null,s("div",{class:"calcite-trigger-container",id:`${t}-menubutton`,onClick:this.openCalciteDropdown,onKeyDown:this.keyDownHandler,ref:this.setReferenceEl},s("slot",{"aria-controls":`${t}-menu`,"aria-expanded":d(e),"aria-haspopup":"menu",name:L.dropdownTrigger,onSlotchange:this.updateTriggers})),s("div",{"aria-hidden":d(!e),class:"calcite-dropdown-wrapper",ref:this.setFloatingEl},s("div",{"aria-labelledby":`${t}-menubutton`,class:{"calcite-dropdown-content":!0,[m.animation]:!0,[m.animationActive]:e},id:`${t}-menu`,role:"menu",ref:this.setScrollerAndTransitionEl},s("slot",{onSlotchange:this.updateGroups}))))}async reposition(e=!1){const{floatingEl:t,referenceEl:i,placement:o,overlayPositioning:n,filteredFlipPlacements:l}=this;return I(this,{floatingEl:t,referenceEl:i,overlayPositioning:n,placement:o,flipPlacements:l,type:"menu"},e)}closeCalciteDropdownOnClick(e){this.disabled||!y(e)||!this.open||e.composedPath().includes(this.el)||this.closeCalciteDropdown(!1)}closeCalciteDropdownOnEvent(e){this.closeCalciteDropdown(),e.stopPropagation()}closeCalciteDropdownOnOpenEvent(e){e.composedPath().includes(this.el)||(this.open=!1)}pointerEnterHandler(){this.disabled||this.type!=="hover"||this.openCalciteDropdown()}pointerLeaveHandler(){this.disabled||this.type!=="hover"||this.closeCalciteDropdown()}calciteInternalDropdownItemKeyEvent(e){const{keyboardEvent:t}=e.detail,i=t.target;switch(t.key){case"Tab":this.open=!1,this.updateTabIndexOfItems(i);break;case"ArrowDown":a(this.items,i,"next");break;case"ArrowUp":a(this.items,i,"previous");break;case"Home":a(this.items,i,"first");break;case"End":a(this.items,i,"last");break}e.stopPropagation()}handleItemSelect(e){this.updateSelectedItems(),e.stopPropagation(),this.calciteDropdownSelect.emit(),(!this.closeOnSelectDisabled||e.detail.requestedDropdownGroup.selectionMode==="none")&&this.closeCalciteDropdown(),e.stopPropagation()}onBeforeOpen(){this.calciteDropdownBeforeOpen.emit()}onOpen(){this.calciteDropdownOpen.emit()}onBeforeClose(){this.calciteDropdownBeforeClose.emit()}onClose(){this.calciteDropdownClose.emit()}updateSelectedItems(){this.selectedItems=this.items.filter(e=>e.selected)}getMaxScrollerHeight(){const{maxItems:e,items:t}=this;let i=0,o=0,n;return this.groups.forEach(l=>{e>0&&i{b===0&&(isNaN(n)&&(n=c.offsetTop),o+=n),ie?o:0}closeCalciteDropdown(e=!0){this.open=!1,e&&p(this.triggers[0])}getFocusableElement(e){if(!e)return;const t=e.attributes.isLink?e.shadowRoot.querySelector("a"):e;p(t)}updateTabIndexOfItems(e){this.items.forEach(t=>{t.tabIndex=e!==t?-1:0})}static get delegatesFocus(){return!0}get el(){return this}static get watchers(){return{open:["openHandler"],disabled:["handleDisabledChange"],flipPlacements:["flipPlacementsHandler"],maxItems:["maxItemsHandler"],overlayPositioning:["overlayPositioningHandler"],placement:["placementHandler"],scale:["handlePropsChange"]}}static get style(){return B}},[17,"calcite-dropdown",{open:[1540],closeOnSelectDisabled:[516,"close-on-select-disabled"],disabled:[516],flipPlacements:[16],maxItems:[514,"max-items"],overlayPositioning:[513,"overlay-positioning"],placement:[513],selectedItems:[1040],type:[513],width:[513],scale:[513],setFocus:[64],reposition:[64]},[[9,"pointerdown","closeCalciteDropdownOnClick"],[0,"calciteInternalDropdownCloseRequest","closeCalciteDropdownOnEvent"],[8,"calciteDropdownOpen","closeCalciteDropdownOnOpenEvent"],[1,"pointerenter","pointerEnterHandler"],[1,"pointerleave","pointerLeaveHandler"],[0,"calciteInternalDropdownItemKeyEvent","calciteInternalDropdownItemKeyEvent"],[0,"calciteInternalDropdownItemSelect","handleItemSelect"]]]);function g(){if(typeof customElements>"u")return;["calcite-dropdown"].forEach(t=>{switch(t){case"calcite-dropdown":customElements.get(t)||customElements.define(t,w);break}})}g();/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-flow-A39UdeqN.js b/dist/assets/calcite-flow-Hhr0ymgr.js similarity index 95% rename from dist/assets/calcite-flow-A39UdeqN.js rename to dist/assets/calcite-flow-Hhr0ymgr.js index f5beaec..c03734d 100644 --- a/dist/assets/calcite-flow-A39UdeqN.js +++ b/dist/assets/calcite-flow-Hhr0ymgr.js @@ -1,4 +1,4 @@ -import{q as h,H as u,t as m}from"./index-J0iiHjMT.js";import{c as p}from"./observers-JyBmMU24.js";import{c as g,s as w,a as b}from"./loadable-sxY2K1G3.js";/*! +import{p as h,H as u,k as m}from"./index-pCX-0tJH.js";import{c as p}from"./observers-eNe735aq.js";import{c as g,s as w,a as b}from"./loadable-uNbe2Ndt.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-flow-item-mBjWFd-U.js b/dist/assets/calcite-flow-item-cLwEh1ST.js similarity index 90% rename from dist/assets/calcite-flow-item-mBjWFd-U.js rename to dist/assets/calcite-flow-item-cLwEh1ST.js index 387a227..16016d9 100644 --- a/dist/assets/calcite-flow-item-mBjWFd-U.js +++ b/dist/assets/calcite-flow-item-cLwEh1ST.js @@ -1,9 +1,9 @@ -import{q as S,H as w,r as u,h7 as p,kr as J,ks as Q,t as n,v as k,ad as V,ch as X,x as Y}from"./index-J0iiHjMT.js";import{c as E,u as A,d as y}from"./interactive-NKzPUNL4.js";import{s as H,a as F,c as B}from"./loadable-sxY2K1G3.js";import{c as z,d as L}from"./locale-pfkq1d6A.js";import{c as I,s as M,d as P,u as O}from"./t9n-od6MEnI1.js";import{c as Z}from"./observers-JyBmMU24.js";import{d as T,S as N}from"./action-menu-h_LAlWK7.js";import{d as D,H as ee}from"./popover-Jm1QI0N1.js";import{d as $}from"./action-W5zDPNjG.js";import{d as R}from"./icon-ZwpY5ksA.js";import{d as _}from"./loader-QqciGs1c.js";import{d as W}from"./scrim-OeyGkB0-.js";import"./key-qdHumIlA.js";import"./guid-6vN-YNJI.js";import"./floating-ui-McpI0u1Z.js";import"./debounce-HnHf1UOZ.js";import"./openCloseComponent-yw47Oy2q.js";import"./FloatingArrow-BghsONry.js";import"./component-dtiBfYiX.js";/*! +import{p as S,H as w,d as u,h9 as p,kz as q,kA as J,k as n,t as v,Y as Q,aS as V,l as X}from"./index-pCX-0tJH.js";import{c as E,u as A,d as y}from"./interactive-9W9APeiw.js";import{s as H,a as F,c as B}from"./loadable-uNbe2Ndt.js";import{c as z,d as L}from"./locale-tKMV0J87.js";import{c as I,s as M,d as P,u as O}from"./t9n-KLe7iM0R.js";import{c as Z}from"./observers-eNe735aq.js";import{d as T,S as N}from"./action-menu-FiGuYhhw.js";import{d as D,H as ee}from"./popover-QEcoULsC.js";import{d as $}from"./action-bN6v5--b.js";import{d as R}from"./icon-BW6RCrUr.js";import{d as _}from"./loader-plQ4Tft5.js";import{d as W}from"./scrim-yAG2Pcs1.js";import"./key-qdHumIlA.js";import"./guid-6vN-YNJI.js";import"./floating-ui-C10Xvlxv.js";import"./debounce-HnHf1UOZ.js";import"./openCloseComponent-lU2sdEaR.js";import"./FloatingArrow-FUeqM5kw.js";import"./component-dtiBfYiX.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const o={actionBarContainer:"action-bar-container",backButton:"back-button",container:"container",header:"header",headerContainer:"header-container",headerContainerBorderEnd:"header-container--border-end",heading:"heading",summary:"summary",description:"description",headerContent:"header-content",headerActions:"header-actions",headerActionsEnd:"header-actions--end",headerActionsStart:"header-actions--start",contentWrapper:"content-wrapper",fabContainer:"fab-container",footer:"footer"},C={close:"x",menu:"ellipsis",backLeft:"chevron-left",backRight:"chevron-right",expand:"chevron-down",collapse:"chevron-up"},s={actionBar:"action-bar",headerActionsStart:"header-actions-start",headerActionsEnd:"header-actions-end",headerMenuActions:"header-menu-actions",headerContent:"header-content",fab:"fab",footer:"footer",footerActions:"footer-actions"},te=":host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:flex;block-size:100%;inline-size:100%;flex:1 1 auto;--calcite-min-header-height:calc(var(--calcite-icon-size) * 3)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.header{margin:0px;display:flex;align-content:space-between;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}.heading{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}.header .heading{flex:1 1 auto;padding:0.5rem}.container{margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;background-color:var(--calcite-ui-background);padding:0px;transition:max-block-size var(--calcite-animation-timing), inline-size var(--calcite-animation-timing)}.container[hidden]{display:none}.header{z-index:var(--calcite-app-z-index-header);display:flex;flex-direction:column;background-color:var(--calcite-ui-foreground-1);border-block-end:var(--calcite-panel-header-border-block-end, 1px solid var(--calcite-ui-border-3))}.header-container{display:flex;inline-size:100%;flex-direction:row;align-items:stretch;justify-content:flex-start;flex:0 0 auto}.header-container--border-end{border-block-end:1px solid var(--calcite-ui-border-3)}.action-bar-container{inline-size:100%}.action-bar-container ::slotted(calcite-action-bar){inline-size:100%}.header-content{display:flex;flex-direction:column;overflow:hidden;padding-inline:0.75rem;padding-block:0.875rem;margin-inline-end:auto}.header-content .heading,.header-content .description{display:block;overflow-wrap:break-word;padding:0px}.header-content .heading{margin-inline:0px;margin-block:0px 0.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-weight:var(--calcite-font-weight-medium)}.header-content .heading:only-child{margin-block-end:0px}.header-content .description{font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}.header-actions{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch}.header-actions--end{margin-inline-start:auto}.content-wrapper{display:flex;block-size:100%;flex:1 1 auto;flex-direction:column;flex-wrap:nowrap;align-items:stretch;overflow:auto;background-color:var(--calcite-ui-background)}.footer{display:flex;inline-size:100%;justify-content:space-evenly;background-color:var(--calcite-ui-foreground-1);flex:0 0 auto;padding:var(--calcite-panel-footer-padding, 0.5rem);border-block-start:1px solid var(--calcite-ui-border-3)}.fab-container{position:sticky;inset-block-end:0px;z-index:var(--calcite-app-z-index-sticky);margin-block:0px;margin-inline:auto;display:block;padding:0.5rem;inset-inline:0;inline-size:-moz-fit-content;inline-size:fit-content}:host([hidden]){display:none}[hidden]{display:none}",ne=S(class extends w{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calcitePanelClose=u(this,"calcitePanelClose",6),this.calcitePanelToggle=u(this,"calcitePanelToggle",6),this.calcitePanelScroll=u(this,"calcitePanelScroll",6),this.resizeObserver=Z("resize",()=>this.resizeHandler()),this.resizeHandler=()=>{const{panelScrollEl:e}=this;!e||typeof e.scrollHeight!="number"||typeof e.offsetHeight!="number"||(e.tabIndex=e.scrollHeight>e.offsetHeight?0:-1)},this.setContainerRef=e=>{this.containerEl=e},this.panelKeyDownHandler=e=>{this.closable&&e.key==="Escape"&&!e.defaultPrevented&&(this.close(),e.preventDefault())},this.close=()=>{this.closed=!0,this.calcitePanelClose.emit()},this.collapse=()=>{this.collapsed=!this.collapsed,this.calcitePanelToggle.emit()},this.panelScrollHandler=()=>{this.calcitePanelScroll.emit()},this.handleHeaderActionsStartSlotChange=e=>{this.hasStartActions=p(e)},this.handleHeaderActionsEndSlotChange=e=>{this.hasEndActions=p(e)},this.handleHeaderMenuActionsSlotChange=e=>{this.hasMenuItems=p(e)},this.handleActionBarSlotChange=e=>{const t=J(e).filter(a=>a==null?void 0:a.matches("calcite-action-bar"));t.forEach(a=>a.layout="horizontal"),this.hasActionBar=!!t.length},this.handleHeaderContentSlotChange=e=>{this.hasHeaderContent=p(e)},this.handleFooterSlotChange=e=>{this.hasFooterContent=p(e)},this.handleFooterActionsSlotChange=e=>{this.hasFooterActions=p(e)},this.handleFabSlotChange=e=>{this.hasFab=p(e)},this.setPanelScrollEl=e=>{var t,a;this.panelScrollEl=e,(t=this.resizeObserver)==null||t.disconnect(),e&&((a=this.resizeObserver)==null||a.observe(e),this.resizeHandler())},this.closed=!1,this.disabled=!1,this.closable=!1,this.collapsed=!1,this.collapseDirection="down",this.collapsible=!1,this.headingLevel=void 0,this.loading=!1,this.heading=void 0,this.description=void 0,this.menuOpen=!1,this.messageOverrides=void 0,this.messages=void 0,this.hasStartActions=!1,this.hasEndActions=!1,this.hasMenuItems=!1,this.hasHeaderContent=!1,this.hasActionBar=!1,this.hasFooterContent=!1,this.hasFooterActions=!1,this.hasFab=!1,this.defaultMessages=void 0,this.effectiveLocale="",this.showHeaderContent=!1}onMessagesChange(){}connectedCallback(){E(this),z(this),I(this)}async componentWillLoad(){H(this),await M(this)}componentDidLoad(){F(this)}componentDidRender(){A(this)}disconnectedCallback(){var e;y(this),L(this),P(this),(e=this.resizeObserver)==null||e.disconnect()}effectiveLocaleChange(){O(this,this.effectiveLocale)}async setFocus(){await B(this),Q(this.containerEl)}async scrollContentTo(e){var t;(t=this.panelScrollEl)==null||t.scrollTo(e)}renderHeaderContent(){const{heading:e,headingLevel:t,description:a,hasHeaderContent:i}=this,c=e?n(ee,{class:o.heading,level:t},e):null,l=a?n("span",{class:o.description},a):null;return!i&&(c||l)?n("div",{class:o.headerContent,key:"header-content"},c,l):null}renderActionBar(){return n("div",{class:o.actionBarContainer,hidden:!this.hasActionBar},n("slot",{name:s.actionBar,onSlotchange:this.handleActionBarSlotChange}))}renderHeaderSlottedContent(){return n("div",{class:o.headerContent,hidden:!this.hasHeaderContent,key:"slotted-header-content"},n("slot",{name:s.headerContent,onSlotchange:this.handleHeaderContentSlotChange}))}renderHeaderStartActions(){const{hasStartActions:e}=this;return n("div",{class:{[o.headerActionsStart]:!0,[o.headerActions]:!0},hidden:!e,key:"header-actions-start"},n("slot",{name:s.headerActionsStart,onSlotchange:this.handleHeaderActionsStartSlotChange}))}renderHeaderActionsEnd(){const{hasEndActions:e,messages:t,closable:a,collapsed:i,collapseDirection:c,collapsible:l,hasMenuItems:r}=this,{collapse:d,expand:f,close:m}=t,b=[C.expand,C.collapse];c==="up"&&b.reverse();const g=l?n("calcite-action",{"aria-expanded":k(!i),"aria-label":d,"data-test":"collapse",icon:i?b[0]:b[1],onClick:this.collapse,text:d,title:i?f:d}):null,v=a?n("calcite-action",{"aria-label":m,"data-test":"close",icon:C.close,onClick:this.close,text:m,title:m}):null,q=n("slot",{name:s.headerActionsEnd,onSlotchange:this.handleHeaderActionsEndSlotChange}),G=e||g||v||r;return n("div",{class:{[o.headerActionsEnd]:!0,[o.headerActions]:!0},hidden:!G,key:"header-actions-end"},q,this.renderMenu(),g,v)}renderMenu(){const{hasMenuItems:e,messages:t,menuOpen:a}=this;return n("calcite-action-menu",{flipPlacements:["top","bottom"],hidden:!e,key:"menu",label:t.options,open:a,placement:"bottom-end"},n("calcite-action",{icon:C.menu,slot:N.trigger,text:t.options}),n("slot",{name:s.headerMenuActions,onSlotchange:this.handleHeaderMenuActionsSlotChange}))}renderHeaderNode(){const{hasHeaderContent:e,hasStartActions:t,hasEndActions:a,closable:i,collapsible:c,hasMenuItems:l,hasActionBar:r}=this,d=this.renderHeaderContent(),f=e||!!d||t||a||c||i||l;return this.showHeaderContent=f,n("header",{class:o.header,hidden:!(f||r)},n("div",{class:{[o.headerContainer]:!0,[o.headerContainerBorderEnd]:r},hidden:!f},this.renderHeaderStartActions(),this.renderHeaderSlottedContent(),d,this.renderHeaderActionsEnd()),this.renderActionBar())}renderFooterNode(){const{hasFooterContent:e,hasFooterActions:t}=this,a=e||t;return n("footer",{class:o.footer,hidden:!a},n("slot",{key:"footer-slot",name:s.footer,onSlotchange:this.handleFooterSlotChange}),n("slot",{key:"footer-actions-slot",name:s.footerActions,onSlotchange:this.handleFooterActionsSlotChange}))}renderContent(){return n("div",{class:o.contentWrapper,hidden:this.collapsible&&this.collapsed,onScroll:this.panelScrollHandler,ref:this.setPanelScrollEl},n("slot",null),this.renderFab())}renderFab(){return n("div",{class:o.fabContainer,hidden:!this.hasFab},n("slot",{name:s.fab,onSlotchange:this.handleFabSlotChange}))}render(){const{loading:e,panelKeyDownHandler:t,closed:a,closable:i}=this,c=n("article",{"aria-busy":k(e),class:o.container,hidden:a,onKeyDown:t,tabIndex:i?0:-1,ref:this.setContainerRef},this.renderHeaderNode(),this.renderContent(),this.renderFooterNode());return n(V,null,e?n("calcite-scrim",{loading:e}):null,c)}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return te}},[1,"calcite-panel",{closed:[1540],disabled:[516],closable:[516],collapsed:[516],collapseDirection:[1,"collapse-direction"],collapsible:[516],headingLevel:[514,"heading-level"],loading:[516],heading:[1],description:[1],menuOpen:[516,"menu-open"],messageOverrides:[1040],messages:[1040],hasStartActions:[32],hasEndActions:[32],hasMenuItems:[32],hasHeaderContent:[32],hasActionBar:[32],hasFooterContent:[32],hasFooterActions:[32],hasFab:[32],defaultMessages:[32],effectiveLocale:[32],showHeaderContent:[32],setFocus:[64],scrollContentTo:[64]}]);function K(){if(typeof customElements>"u")return;["calcite-panel","calcite-action","calcite-action-menu","calcite-icon","calcite-loader","calcite-popover","calcite-scrim"].forEach(t=>{switch(t){case"calcite-panel":customElements.get(t)||customElements.define(t,ne);break;case"calcite-action":customElements.get(t)||$();break;case"calcite-action-menu":customElements.get(t)||T();break;case"calcite-icon":customElements.get(t)||R();break;case"calcite-loader":customElements.get(t)||_();break;case"calcite-popover":customElements.get(t)||D();break;case"calcite-scrim":customElements.get(t)||W();break}})}K();/*! + */const o={actionBarContainer:"action-bar-container",backButton:"back-button",container:"container",header:"header",headerContainer:"header-container",headerContainerBorderEnd:"header-container--border-end",heading:"heading",summary:"summary",description:"description",headerContent:"header-content",headerActions:"header-actions",headerActionsEnd:"header-actions--end",headerActionsStart:"header-actions--start",contentWrapper:"content-wrapper",fabContainer:"fab-container",footer:"footer"},C={close:"x",menu:"ellipsis",backLeft:"chevron-left",backRight:"chevron-right",expand:"chevron-down",collapse:"chevron-up"},s={actionBar:"action-bar",headerActionsStart:"header-actions-start",headerActionsEnd:"header-actions-end",headerMenuActions:"header-menu-actions",headerContent:"header-content",fab:"fab",footer:"footer",footerActions:"footer-actions"},te=":host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:flex;block-size:100%;inline-size:100%;flex:1 1 auto;--calcite-min-header-height:calc(var(--calcite-icon-size) * 3)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.header{margin:0px;display:flex;align-content:space-between;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}.heading{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}.header .heading{flex:1 1 auto;padding:0.5rem}.container{margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;background-color:var(--calcite-ui-background);padding:0px;transition:max-block-size var(--calcite-animation-timing), inline-size var(--calcite-animation-timing)}.container[hidden]{display:none}.header{z-index:var(--calcite-app-z-index-header);display:flex;flex-direction:column;background-color:var(--calcite-ui-foreground-1);border-block-end:var(--calcite-panel-header-border-block-end, 1px solid var(--calcite-ui-border-3))}.header-container{display:flex;inline-size:100%;flex-direction:row;align-items:stretch;justify-content:flex-start;flex:0 0 auto}.header-container--border-end{border-block-end:1px solid var(--calcite-ui-border-3)}.action-bar-container{inline-size:100%}.action-bar-container ::slotted(calcite-action-bar){inline-size:100%}.header-content{display:flex;flex-direction:column;overflow:hidden;padding-inline:0.75rem;padding-block:0.875rem;margin-inline-end:auto}.header-content .heading,.header-content .description{display:block;overflow-wrap:break-word;padding:0px}.header-content .heading{margin-inline:0px;margin-block:0px 0.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-weight:var(--calcite-font-weight-medium)}.header-content .heading:only-child{margin-block-end:0px}.header-content .description{font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}.header-actions{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch}.header-actions--end{margin-inline-start:auto}.content-wrapper{display:flex;block-size:100%;flex:1 1 auto;flex-direction:column;flex-wrap:nowrap;align-items:stretch;overflow:auto;background-color:var(--calcite-ui-background)}.footer{display:flex;inline-size:100%;justify-content:space-evenly;background-color:var(--calcite-ui-foreground-1);flex:0 0 auto;padding:var(--calcite-panel-footer-padding, 0.5rem);border-block-start:1px solid var(--calcite-ui-border-3)}.fab-container{position:sticky;inset-block-end:0px;z-index:var(--calcite-app-z-index-sticky);margin-block:0px;margin-inline:auto;display:block;padding:0.5rem;inset-inline:0;inline-size:-moz-fit-content;inline-size:fit-content}:host([hidden]){display:none}[hidden]{display:none}",ne=S(class extends w{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calcitePanelClose=u(this,"calcitePanelClose",6),this.calcitePanelToggle=u(this,"calcitePanelToggle",6),this.calcitePanelScroll=u(this,"calcitePanelScroll",6),this.resizeObserver=Z("resize",()=>this.resizeHandler()),this.resizeHandler=()=>{const{panelScrollEl:e}=this;!e||typeof e.scrollHeight!="number"||typeof e.offsetHeight!="number"||(e.tabIndex=e.scrollHeight>e.offsetHeight?0:-1)},this.setContainerRef=e=>{this.containerEl=e},this.panelKeyDownHandler=e=>{this.closable&&e.key==="Escape"&&!e.defaultPrevented&&(this.close(),e.preventDefault())},this.close=()=>{this.closed=!0,this.calcitePanelClose.emit()},this.collapse=()=>{this.collapsed=!this.collapsed,this.calcitePanelToggle.emit()},this.panelScrollHandler=()=>{this.calcitePanelScroll.emit()},this.handleHeaderActionsStartSlotChange=e=>{this.hasStartActions=p(e)},this.handleHeaderActionsEndSlotChange=e=>{this.hasEndActions=p(e)},this.handleHeaderMenuActionsSlotChange=e=>{this.hasMenuItems=p(e)},this.handleActionBarSlotChange=e=>{const t=q(e).filter(a=>a==null?void 0:a.matches("calcite-action-bar"));t.forEach(a=>a.layout="horizontal"),this.hasActionBar=!!t.length},this.handleHeaderContentSlotChange=e=>{this.hasHeaderContent=p(e)},this.handleFooterSlotChange=e=>{this.hasFooterContent=p(e)},this.handleFooterActionsSlotChange=e=>{this.hasFooterActions=p(e)},this.handleFabSlotChange=e=>{this.hasFab=p(e)},this.setPanelScrollEl=e=>{var t,a;this.panelScrollEl=e,(t=this.resizeObserver)==null||t.disconnect(),e&&((a=this.resizeObserver)==null||a.observe(e),this.resizeHandler())},this.closed=!1,this.disabled=!1,this.closable=!1,this.collapsed=!1,this.collapseDirection="down",this.collapsible=!1,this.headingLevel=void 0,this.loading=!1,this.heading=void 0,this.description=void 0,this.menuOpen=!1,this.messageOverrides=void 0,this.messages=void 0,this.hasStartActions=!1,this.hasEndActions=!1,this.hasMenuItems=!1,this.hasHeaderContent=!1,this.hasActionBar=!1,this.hasFooterContent=!1,this.hasFooterActions=!1,this.hasFab=!1,this.defaultMessages=void 0,this.effectiveLocale="",this.showHeaderContent=!1}onMessagesChange(){}connectedCallback(){E(this),z(this),I(this)}async componentWillLoad(){H(this),await M(this)}componentDidLoad(){F(this)}componentDidRender(){A(this)}disconnectedCallback(){var e;y(this),L(this),P(this),(e=this.resizeObserver)==null||e.disconnect()}effectiveLocaleChange(){O(this,this.effectiveLocale)}async setFocus(){await B(this),J(this.containerEl)}async scrollContentTo(e){var t;(t=this.panelScrollEl)==null||t.scrollTo(e)}renderHeaderContent(){const{heading:e,headingLevel:t,description:a,hasHeaderContent:i}=this,c=e?n(ee,{class:o.heading,level:t},e):null,l=a?n("span",{class:o.description},a):null;return!i&&(c||l)?n("div",{class:o.headerContent,key:"header-content"},c,l):null}renderActionBar(){return n("div",{class:o.actionBarContainer,hidden:!this.hasActionBar},n("slot",{name:s.actionBar,onSlotchange:this.handleActionBarSlotChange}))}renderHeaderSlottedContent(){return n("div",{class:o.headerContent,hidden:!this.hasHeaderContent,key:"slotted-header-content"},n("slot",{name:s.headerContent,onSlotchange:this.handleHeaderContentSlotChange}))}renderHeaderStartActions(){const{hasStartActions:e}=this;return n("div",{class:{[o.headerActionsStart]:!0,[o.headerActions]:!0},hidden:!e,key:"header-actions-start"},n("slot",{name:s.headerActionsStart,onSlotchange:this.handleHeaderActionsStartSlotChange}))}renderHeaderActionsEnd(){const{hasEndActions:e,messages:t,closable:a,collapsed:i,collapseDirection:c,collapsible:l,hasMenuItems:r}=this,{collapse:d,expand:f,close:m}=t,b=[C.expand,C.collapse];c==="up"&&b.reverse();const g=l?n("calcite-action",{"aria-expanded":v(!i),"aria-label":d,"data-test":"collapse",icon:i?b[0]:b[1],onClick:this.collapse,text:d,title:i?f:d}):null,k=a?n("calcite-action",{"aria-label":m,"data-test":"close",icon:C.close,onClick:this.close,text:m,title:m}):null,G=n("slot",{name:s.headerActionsEnd,onSlotchange:this.handleHeaderActionsEndSlotChange}),Y=e||g||k||r;return n("div",{class:{[o.headerActionsEnd]:!0,[o.headerActions]:!0},hidden:!Y,key:"header-actions-end"},G,this.renderMenu(),g,k)}renderMenu(){const{hasMenuItems:e,messages:t,menuOpen:a}=this;return n("calcite-action-menu",{flipPlacements:["top","bottom"],hidden:!e,key:"menu",label:t.options,open:a,placement:"bottom-end"},n("calcite-action",{icon:C.menu,slot:N.trigger,text:t.options}),n("slot",{name:s.headerMenuActions,onSlotchange:this.handleHeaderMenuActionsSlotChange}))}renderHeaderNode(){const{hasHeaderContent:e,hasStartActions:t,hasEndActions:a,closable:i,collapsible:c,hasMenuItems:l,hasActionBar:r}=this,d=this.renderHeaderContent(),f=e||!!d||t||a||c||i||l;return this.showHeaderContent=f,n("header",{class:o.header,hidden:!(f||r)},n("div",{class:{[o.headerContainer]:!0,[o.headerContainerBorderEnd]:r},hidden:!f},this.renderHeaderStartActions(),this.renderHeaderSlottedContent(),d,this.renderHeaderActionsEnd()),this.renderActionBar())}renderFooterNode(){const{hasFooterContent:e,hasFooterActions:t}=this,a=e||t;return n("footer",{class:o.footer,hidden:!a},n("slot",{key:"footer-slot",name:s.footer,onSlotchange:this.handleFooterSlotChange}),n("slot",{key:"footer-actions-slot",name:s.footerActions,onSlotchange:this.handleFooterActionsSlotChange}))}renderContent(){return n("div",{class:o.contentWrapper,hidden:this.collapsible&&this.collapsed,onScroll:this.panelScrollHandler,ref:this.setPanelScrollEl},n("slot",null),this.renderFab())}renderFab(){return n("div",{class:o.fabContainer,hidden:!this.hasFab},n("slot",{name:s.fab,onSlotchange:this.handleFabSlotChange}))}render(){const{loading:e,panelKeyDownHandler:t,closed:a,closable:i}=this,c=n("article",{"aria-busy":v(e),class:o.container,hidden:a,onKeyDown:t,tabIndex:i?0:-1,ref:this.setContainerRef},this.renderHeaderNode(),this.renderContent(),this.renderFooterNode());return n(Q,null,e?n("calcite-scrim",{loading:e}):null,c)}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return te}},[1,"calcite-panel",{closed:[1540],disabled:[516],closable:[516],collapsed:[516],collapseDirection:[1,"collapse-direction"],collapsible:[516],headingLevel:[514,"heading-level"],loading:[516],heading:[1],description:[1],menuOpen:[516,"menu-open"],messageOverrides:[1040],messages:[1040],hasStartActions:[32],hasEndActions:[32],hasMenuItems:[32],hasHeaderContent:[32],hasActionBar:[32],hasFooterContent:[32],hasFooterActions:[32],hasFab:[32],defaultMessages:[32],effectiveLocale:[32],showHeaderContent:[32],setFocus:[64],scrollContentTo:[64]}]);function K(){if(typeof customElements>"u")return;["calcite-panel","calcite-action","calcite-action-menu","calcite-icon","calcite-loader","calcite-popover","calcite-scrim"].forEach(t=>{switch(t){case"calcite-panel":customElements.get(t)||customElements.define(t,ne);break;case"calcite-action":customElements.get(t)||$();break;case"calcite-action-menu":customElements.get(t)||T();break;case"calcite-icon":customElements.get(t)||R();break;case"calcite-loader":customElements.get(t)||_();break;case"calcite-popover":customElements.get(t)||D();break;case"calcite-scrim":customElements.get(t)||W();break}})}K();/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const ae={backButton:"back-button"},x={backLeft:"chevron-left",backRight:"chevron-right"},h={actionBar:"action-bar",headerActionsStart:"header-actions-start",headerActionsEnd:"header-actions-end",headerMenuActions:"header-menu-actions",headerContent:"header-content",fab:"fab",footer:"footer",footerActions:"footer-actions"},oe=":host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}calcite-panel{--calcite-panel-footer-padding:var(--calcite-flow-item-footer-padding);--calcite-panel-header-border-block-end:var(--calcite-flow-item-header-border-block-end)}:host([hidden]){display:none}[hidden]{display:none}",j=S(class extends w{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteFlowItemBack=u(this,"calciteFlowItemBack",7),this.calciteFlowItemScroll=u(this,"calciteFlowItemScroll",6),this.calciteFlowItemClose=u(this,"calciteFlowItemClose",6),this.calciteFlowItemToggle=u(this,"calciteFlowItemToggle",6),this.handlePanelScroll=e=>{e.stopPropagation(),this.calciteFlowItemScroll.emit()},this.handlePanelClose=e=>{e.stopPropagation(),this.calciteFlowItemClose.emit()},this.handlePanelToggle=e=>{e.stopPropagation(),this.collapsed=e.target.collapsed,this.calciteFlowItemToggle.emit()},this.backButtonClick=()=>{this.calciteFlowItemBack.emit()},this.setBackRef=e=>{this.backButtonEl=e},this.setContainerRef=e=>{this.containerEl=e},this.closable=!1,this.closed=!1,this.collapsed=!1,this.collapseDirection="down",this.collapsible=!1,this.beforeBack=void 0,this.description=void 0,this.disabled=!1,this.heading=void 0,this.headingLevel=void 0,this.loading=!1,this.menuOpen=!1,this.messageOverrides=void 0,this.messages=void 0,this.showBackButton=!1,this.defaultMessages=void 0,this.effectiveLocale=""}onMessagesChange(){}connectedCallback(){E(this),z(this),I(this)}async componentWillLoad(){await M(this),H(this)}componentDidRender(){A(this)}disconnectedCallback(){y(this),L(this),P(this)}componentDidLoad(){F(this)}effectiveLocaleChange(){O(this,this.effectiveLocale)}async setFocus(){await B(this);const{backButtonEl:e,containerEl:t}=this;if(e)return e.setFocus();if(t)return t.setFocus()}async scrollContentTo(e){var t;await((t=this.containerEl)==null?void 0:t.scrollContentTo(e))}renderBackButton(){const{el:e}=this,t=X(e)==="rtl",{showBackButton:a,backButtonClick:i,messages:c}=this,l=c.back,r=t?x.backRight:x.backLeft;return a?n("calcite-action",{"aria-label":l,class:ae.backButton,icon:r,key:"flow-back-button",onClick:i,scale:"s",slot:"header-actions-start",text:l,title:l,ref:this.setBackRef}):null}render(){const{collapsed:e,collapseDirection:t,collapsible:a,closable:i,closed:c,description:l,disabled:r,heading:d,headingLevel:f,loading:m,menuOpen:b,messages:g}=this;return n(Y,null,n("calcite-panel",{closable:i,closed:c,collapseDirection:t,collapsed:e,collapsible:a,description:l,disabled:r,heading:d,headingLevel:f,loading:m,menuOpen:b,messageOverrides:g,onCalcitePanelClose:this.handlePanelClose,onCalcitePanelScroll:this.handlePanelScroll,onCalcitePanelToggle:this.handlePanelToggle,ref:this.setContainerRef},this.renderBackButton(),n("slot",{name:h.actionBar,slot:s.actionBar}),n("slot",{name:h.headerActionsStart,slot:s.headerActionsStart}),n("slot",{name:h.headerActionsEnd,slot:s.headerActionsEnd}),n("slot",{name:h.headerContent,slot:s.headerContent}),n("slot",{name:h.headerMenuActions,slot:s.headerMenuActions}),n("slot",{name:h.fab,slot:s.fab}),n("slot",{name:h.footerActions,slot:s.footerActions}),n("slot",{name:h.footer,slot:s.footer}),n("slot",null)))}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return oe}},[1,"calcite-flow-item",{closable:[516],closed:[516],collapsed:[516],collapseDirection:[1,"collapse-direction"],collapsible:[516],beforeBack:[16],description:[1],disabled:[516],heading:[1],headingLevel:[514,"heading-level"],loading:[516],menuOpen:[516,"menu-open"],messageOverrides:[1040],messages:[1040],showBackButton:[4,"show-back-button"],defaultMessages:[32],effectiveLocale:[32],setFocus:[64],scrollContentTo:[64]}]);function U(){if(typeof customElements>"u")return;["calcite-flow-item","calcite-action","calcite-action-menu","calcite-icon","calcite-loader","calcite-panel","calcite-popover","calcite-scrim"].forEach(t=>{switch(t){case"calcite-flow-item":customElements.get(t)||customElements.define(t,j);break;case"calcite-action":customElements.get(t)||$();break;case"calcite-action-menu":customElements.get(t)||T();break;case"calcite-icon":customElements.get(t)||R();break;case"calcite-loader":customElements.get(t)||_();break;case"calcite-panel":customElements.get(t)||K();break;case"calcite-popover":customElements.get(t)||D();break;case"calcite-scrim":customElements.get(t)||W();break}})}U();const Ee=j,Ae=U;export{Ee as CalciteFlowItem,Ae as defineCustomElement}; + */const ae={backButton:"back-button"},x={backLeft:"chevron-left",backRight:"chevron-right"},h={actionBar:"action-bar",headerActionsStart:"header-actions-start",headerActionsEnd:"header-actions-end",headerMenuActions:"header-menu-actions",headerContent:"header-content",fab:"fab",footer:"footer",footerActions:"footer-actions"},oe=":host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}calcite-panel{--calcite-panel-footer-padding:var(--calcite-flow-item-footer-padding);--calcite-panel-header-border-block-end:var(--calcite-flow-item-header-border-block-end)}:host([hidden]){display:none}[hidden]{display:none}",j=S(class extends w{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteFlowItemBack=u(this,"calciteFlowItemBack",7),this.calciteFlowItemScroll=u(this,"calciteFlowItemScroll",6),this.calciteFlowItemClose=u(this,"calciteFlowItemClose",6),this.calciteFlowItemToggle=u(this,"calciteFlowItemToggle",6),this.handlePanelScroll=e=>{e.stopPropagation(),this.calciteFlowItemScroll.emit()},this.handlePanelClose=e=>{e.stopPropagation(),this.calciteFlowItemClose.emit()},this.handlePanelToggle=e=>{e.stopPropagation(),this.collapsed=e.target.collapsed,this.calciteFlowItemToggle.emit()},this.backButtonClick=()=>{this.calciteFlowItemBack.emit()},this.setBackRef=e=>{this.backButtonEl=e},this.setContainerRef=e=>{this.containerEl=e},this.closable=!1,this.closed=!1,this.collapsed=!1,this.collapseDirection="down",this.collapsible=!1,this.beforeBack=void 0,this.description=void 0,this.disabled=!1,this.heading=void 0,this.headingLevel=void 0,this.loading=!1,this.menuOpen=!1,this.messageOverrides=void 0,this.messages=void 0,this.showBackButton=!1,this.defaultMessages=void 0,this.effectiveLocale=""}onMessagesChange(){}connectedCallback(){E(this),z(this),I(this)}async componentWillLoad(){await M(this),H(this)}componentDidRender(){A(this)}disconnectedCallback(){y(this),L(this),P(this)}componentDidLoad(){F(this)}effectiveLocaleChange(){O(this,this.effectiveLocale)}async setFocus(){await B(this);const{backButtonEl:e,containerEl:t}=this;if(e)return e.setFocus();if(t)return t.setFocus()}async scrollContentTo(e){var t;await((t=this.containerEl)==null?void 0:t.scrollContentTo(e))}renderBackButton(){const{el:e}=this,t=V(e)==="rtl",{showBackButton:a,backButtonClick:i,messages:c}=this,l=c.back,r=t?x.backRight:x.backLeft;return a?n("calcite-action",{"aria-label":l,class:ae.backButton,icon:r,key:"flow-back-button",onClick:i,scale:"s",slot:"header-actions-start",text:l,title:l,ref:this.setBackRef}):null}render(){const{collapsed:e,collapseDirection:t,collapsible:a,closable:i,closed:c,description:l,disabled:r,heading:d,headingLevel:f,loading:m,menuOpen:b,messages:g}=this;return n(X,null,n("calcite-panel",{closable:i,closed:c,collapseDirection:t,collapsed:e,collapsible:a,description:l,disabled:r,heading:d,headingLevel:f,loading:m,menuOpen:b,messageOverrides:g,onCalcitePanelClose:this.handlePanelClose,onCalcitePanelScroll:this.handlePanelScroll,onCalcitePanelToggle:this.handlePanelToggle,ref:this.setContainerRef},this.renderBackButton(),n("slot",{name:h.actionBar,slot:s.actionBar}),n("slot",{name:h.headerActionsStart,slot:s.headerActionsStart}),n("slot",{name:h.headerActionsEnd,slot:s.headerActionsEnd}),n("slot",{name:h.headerContent,slot:s.headerContent}),n("slot",{name:h.headerMenuActions,slot:s.headerMenuActions}),n("slot",{name:h.fab,slot:s.fab}),n("slot",{name:h.footerActions,slot:s.footerActions}),n("slot",{name:h.footer,slot:s.footer}),n("slot",null)))}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return oe}},[1,"calcite-flow-item",{closable:[516],closed:[516],collapsed:[516],collapseDirection:[1,"collapse-direction"],collapsible:[516],beforeBack:[16],description:[1],disabled:[516],heading:[1],headingLevel:[514,"heading-level"],loading:[516],menuOpen:[516,"menu-open"],messageOverrides:[1040],messages:[1040],showBackButton:[4,"show-back-button"],defaultMessages:[32],effectiveLocale:[32],setFocus:[64],scrollContentTo:[64]}]);function U(){if(typeof customElements>"u")return;["calcite-flow-item","calcite-action","calcite-action-menu","calcite-icon","calcite-loader","calcite-panel","calcite-popover","calcite-scrim"].forEach(t=>{switch(t){case"calcite-flow-item":customElements.get(t)||customElements.define(t,j);break;case"calcite-action":customElements.get(t)||$();break;case"calcite-action-menu":customElements.get(t)||T();break;case"calcite-icon":customElements.get(t)||R();break;case"calcite-loader":customElements.get(t)||_();break;case"calcite-panel":customElements.get(t)||K();break;case"calcite-popover":customElements.get(t)||D();break;case"calcite-scrim":customElements.get(t)||W();break}})}U();const Ee=j,Ae=U;export{Ee as CalciteFlowItem,Ae as defineCustomElement}; diff --git a/dist/assets/calcite-icon-itD416se.js b/dist/assets/calcite-icon-ZhRmLRGh.js similarity index 69% rename from dist/assets/calcite-icon-itD416se.js rename to dist/assets/calcite-icon-ZhRmLRGh.js index 43cf19a..d425b18 100644 --- a/dist/assets/calcite-icon-itD416se.js +++ b/dist/assets/calcite-icon-ZhRmLRGh.js @@ -1,4 +1,4 @@ -import{I as o,d as t}from"./icon-ZwpY5ksA.js";import"./index-J0iiHjMT.js";import"./observers-JyBmMU24.js";/*! +import{I as o,d as t}from"./icon-BW6RCrUr.js";import"./index-pCX-0tJH.js";import"./observers-eNe735aq.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-input-1VO9g4ut.js b/dist/assets/calcite-input-1VO9g4ut.js new file mode 100644 index 0000000..cbca355 --- /dev/null +++ b/dist/assets/calcite-input-1VO9g4ut.js @@ -0,0 +1,5 @@ +import{I as t,d as o}from"./input-_z9XIoLu.js";import"./index-pCX-0tJH.js";import"./form-1U5Kiwxm.js";import"./interactive-9W9APeiw.js";import"./key-qdHumIlA.js";import"./label2-JXqLMBYY.js";import"./loadable-uNbe2Ndt.js";import"./locale-tKMV0J87.js";import"./observers-eNe735aq.js";import"./t9n-KLe7iM0R.js";import"./component-dtiBfYiX.js";import"./icon-BW6RCrUr.js";import"./progress-TBzcAK5D.js";/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. + * v1.11.0 + */const C=t,I=o;export{C as CalciteInput,I as defineCustomElement}; diff --git a/dist/assets/calcite-input-V4_hyPVg.js b/dist/assets/calcite-input-V4_hyPVg.js deleted file mode 100644 index 6b2a72a..0000000 --- a/dist/assets/calcite-input-V4_hyPVg.js +++ /dev/null @@ -1,5 +0,0 @@ -import{I as t,d as o}from"./input-9jE7tcJD.js";import"./index-J0iiHjMT.js";import"./form-2Iq0hI3D.js";import"./interactive-NKzPUNL4.js";import"./key-qdHumIlA.js";import"./label2-d2vWQ7x7.js";import"./loadable-sxY2K1G3.js";import"./locale-pfkq1d6A.js";import"./observers-JyBmMU24.js";import"./t9n-od6MEnI1.js";import"./component-dtiBfYiX.js";import"./icon-ZwpY5ksA.js";import"./progress-puB9lhY4.js";/*! - * All material copyright ESRI, All Rights Reserved, unless otherwise specified. - * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. - * v1.11.0 - */const C=t,I=o;export{C as CalciteInput,I as defineCustomElement}; diff --git a/dist/assets/calcite-label-lSeWOYbm.js b/dist/assets/calcite-label-DHrtVvrs.js similarity index 96% rename from dist/assets/calcite-label-lSeWOYbm.js rename to dist/assets/calcite-label-DHrtVvrs.js index 8da2a24..61263a6 100644 --- a/dist/assets/calcite-label-lSeWOYbm.js +++ b/dist/assets/calcite-label-DHrtVvrs.js @@ -1,4 +1,4 @@ -import{q as l,H as s,r as o,t,x as c}from"./index-J0iiHjMT.js";import{l as r,a as d}from"./label2-d2vWQ7x7.js";/*! +import{p as l,H as s,d as o,k as t,l as c}from"./index-pCX-0tJH.js";import{l as r,a as d}from"./label2-JXqLMBYY.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-list-LJfGqLbO.js b/dist/assets/calcite-list-KbTGTbJq.js similarity index 98% rename from dist/assets/calcite-list-LJfGqLbO.js rename to dist/assets/calcite-list-KbTGTbJq.js index 073e00d..3fc0f64 100644 --- a/dist/assets/calcite-list-LJfGqLbO.js +++ b/dist/assets/calcite-list-KbTGTbJq.js @@ -1,4 +1,4 @@ -import{q as pe,H as ge,h7 as pt,t as w,x as _n,r as Ct,ad as An,v as On}from"./index-J0iiHjMT.js";import{c as Ye,u as $e,d as Ge}from"./interactive-NKzPUNL4.js";import{c as Fn}from"./observers-JyBmMU24.js";import{u as Ln,a as Pn,M as kn}from"./utils3-_ao2jQXg.js";import{s as We,a as Ue,c as qe}from"./loadable-sxY2K1G3.js";import{S as Se,i as me,r as Mn,b as be,f as Nn,a as jn,c as Ke,d as Ve}from"./debounce-HnHf1UOZ.js";import{c as Hn,d as Rn}from"./locale-pfkq1d6A.js";import{u as Bn,s as zn,c as Xn,d as Yn}from"./t9n-od6MEnI1.js";import{d as Ze}from"./icon-ZwpY5ksA.js";import{d as Qe}from"./input-9jE7tcJD.js";import{d as Je}from"./progress-puB9lhY4.js";import{d as $n}from"./loader-QqciGs1c.js";import{d as Gn}from"./scrim-OeyGkB0-.js";import"./key-qdHumIlA.js";import"./form-2Iq0hI3D.js";import"./label2-d2vWQ7x7.js";import"./component-dtiBfYiX.js";import"./guid-6vN-YNJI.js";/*! +import{p as pe,H as ge,h9 as pt,k as w,l as _n,d as Ct,Y as An,t as On}from"./index-pCX-0tJH.js";import{c as Ye,u as $e,d as Ge}from"./interactive-9W9APeiw.js";import{c as Fn}from"./observers-eNe735aq.js";import{u as Ln,a as Pn,M as kn}from"./utils3--QEgMxFs.js";import{s as We,a as Ue,c as qe}from"./loadable-uNbe2Ndt.js";import{S as Se,i as me,r as Mn,b as be,f as Nn,a as jn,c as Ke,d as Ve}from"./debounce-HnHf1UOZ.js";import{c as Hn,d as Rn}from"./locale-tKMV0J87.js";import{u as Bn,s as zn,c as Xn,d as Yn}from"./t9n-KLe7iM0R.js";import{d as Ze}from"./icon-BW6RCrUr.js";import{d as Qe}from"./input-_z9XIoLu.js";import{d as Je}from"./progress-TBzcAK5D.js";import{d as $n}from"./loader-plQ4Tft5.js";import{d as Gn}from"./scrim-yAG2Pcs1.js";import"./key-qdHumIlA.js";import"./form-1U5Kiwxm.js";import"./label2-JXqLMBYY.js";import"./component-dtiBfYiX.js";import"./guid-6vN-YNJI.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-list-item-OtIyVNHT.js b/dist/assets/calcite-list-item-ewhQm-Oo.js similarity index 94% rename from dist/assets/calcite-list-item-OtIyVNHT.js rename to dist/assets/calcite-list-item-ewhQm-Oo.js index 7dc9033..e104a2e 100644 --- a/dist/assets/calcite-list-item-OtIyVNHT.js +++ b/dist/assets/calcite-list-item-ewhQm-Oo.js @@ -1,8 +1,8 @@ -import{q as I,H as L,r as p,t as i,v,h7 as g,ch as U,x as j}from"./index-J0iiHjMT.js";import{c as R,u as W,d as q}from"./interactive-NKzPUNL4.js";import{g as x,I as m,C as a,S as C,a as G,u as J}from"./utils3-_ao2jQXg.js";import{c as E,d as k}from"./locale-pfkq1d6A.js";import{c as A,s as w,d as D,u as H}from"./t9n-od6MEnI1.js";import{s as M,a as B,c as P}from"./loadable-sxY2K1G3.js";import{d as Q}from"./action-W5zDPNjG.js";import{d as z}from"./icon-ZwpY5ksA.js";import{d as V}from"./loader-QqciGs1c.js";import"./key-qdHumIlA.js";import"./observers-JyBmMU24.js";import"./guid-6vN-YNJI.js";import"./component-dtiBfYiX.js";/*! +import{p as I,H as L,d as p,k as i,t as v,h9 as g,aS as U,l as j}from"./index-pCX-0tJH.js";import{c as R,u as W,d as G}from"./interactive-9W9APeiw.js";import{g as y,I as m,C as a,S as C,a as q,u as J}from"./utils3--QEgMxFs.js";import{c as E,d as k}from"./locale-tKMV0J87.js";import{c as A,s as w,d as D,u as H}from"./t9n-KLe7iM0R.js";import{s as M,a as B,c as P}from"./loadable-uNbe2Ndt.js";import{d as Q}from"./action-bN6v5--b.js";import{d as z}from"./icon-BW6RCrUr.js";import{d as V}from"./loader-plQ4Tft5.js";import"./key-qdHumIlA.js";import"./observers-eNe735aq.js";import"./guid-6vN-YNJI.js";import"./component-dtiBfYiX.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const y={handle:"handle",handleActivated:"handle--activated"},X={drag:"drag"},Y=`:host{display:flex}.handle{display:flex;cursor:move;align-items:center;justify-content:center;align-self:stretch;border-style:none;background-color:transparent;outline-color:transparent;color:var(--calcite-ui-border-input);padding-block:0.75rem;padding-inline:0.25rem;line-height:0}.handle:hover{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}.handle:focus{color:var(--calcite-ui-text-1);outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc( + */const x={handle:"handle",handleActivated:"handle--activated"},X={drag:"drag"},Y=`:host{display:flex}.handle{display:flex;cursor:move;align-items:center;justify-content:center;align-self:stretch;border-style:none;background-color:transparent;outline-color:transparent;color:var(--calcite-ui-border-input);padding-block:0.75rem;padding-inline:0.25rem;line-height:0}.handle:hover{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}.handle:focus{color:var(--calcite-ui-text-1);outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc( -2px * calc( 1 - @@ -12,7 +12,7 @@ import{q as I,H as L,r as p,t as i,v,h7 as g,ch as U,x as j}from"./index-J0iiHjM 1 ) ) - )}.handle--activated{background-color:var(--calcite-ui-foreground-3);color:var(--calcite-ui-text-1)}.handle calcite-icon{color:inherit}:host([hidden]){display:none}[hidden]{display:none}`,Z=I(class extends L{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteHandleNudge=p(this,"calciteHandleNudge",6),this.calciteInternalHandleChange=p(this,"calciteInternalHandleChange",6),this.handleKeyDown=e=>{switch(e.key){case" ":this.activated=!this.activated,e.preventDefault();break;case"ArrowUp":if(!this.activated)return;e.preventDefault(),this.calciteHandleNudge.emit({direction:"up"});break;case"ArrowDown":if(!this.activated)return;e.preventDefault(),this.calciteHandleNudge.emit({direction:"down"});break}},this.handleBlur=()=>{this.activated=!1},this.activated=!1,this.dragHandle=void 0,this.messages=void 0,this.setPosition=void 0,this.setSize=void 0,this.label=void 0,this.messageOverrides=void 0,this.effectiveLocale=void 0,this.defaultMessages=void 0}handleAriaTextChange(){const e=this.getAriaText("live");e&&this.calciteInternalHandleChange.emit({message:e})}onMessagesChange(){}connectedCallback(){A(this),E(this)}async componentWillLoad(){M(this),await w(this)}componentDidLoad(){B(this)}disconnectedCallback(){D(this),k(this)}effectiveLocaleChange(){H(this,this.effectiveLocale)}async setFocus(){var e;await P(this),(e=this.handleButton)==null||e.focus()}getAriaText(e){const{setPosition:t,setSize:n,label:s,messages:l,activated:o}=this;return!l||!s||typeof n!="number"||typeof t!="number"?null:(e==="label"?o?l.dragHandleChange:l.dragHandleIdle:o?l.dragHandleActive:l.dragHandleCommit).replace("{position}",t.toString()).replace("{itemLabel}",s).replace("{total}",n.toString())}render(){var e;return i("span",{"aria-label":this.getAriaText("label"),"aria-pressed":v(this.activated),class:{[y.handle]:!0,[y.handleActivated]:this.activated},onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,role:"button",tabindex:"0",title:(e=this.messages)==null?void 0:e.dragHandle,ref:t=>{this.handleButton=t}},i("calcite-icon",{icon:X.drag,scale:"s"}))}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{messages:["handleAriaTextChange"],label:["handleAriaTextChange"],activated:["handleAriaTextChange"],setPosition:["handleAriaTextChange"],setSize:["handleAriaTextChange"],messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return Y}},[1,"calcite-handle",{activated:[1540],dragHandle:[513,"drag-handle"],messages:[16],setPosition:[2,"set-position"],setSize:[2,"set-size"],label:[1],messageOverrides:[16],effectiveLocale:[32],defaultMessages:[32],setFocus:[64]}]);function O(){if(typeof customElements>"u")return;["calcite-handle","calcite-icon"].forEach(t=>{switch(t){case"calcite-handle":customElements.get(t)||customElements.define(t,Z);break;case"calcite-icon":customElements.get(t)||z();break}})}O();/*! + )}.handle--activated{background-color:var(--calcite-ui-foreground-3);color:var(--calcite-ui-text-1)}.handle calcite-icon{color:inherit}:host([hidden]){display:none}[hidden]{display:none}`,Z=I(class extends L{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteHandleNudge=p(this,"calciteHandleNudge",6),this.calciteInternalHandleChange=p(this,"calciteInternalHandleChange",6),this.handleKeyDown=e=>{switch(e.key){case" ":this.activated=!this.activated,e.preventDefault();break;case"ArrowUp":if(!this.activated)return;e.preventDefault(),this.calciteHandleNudge.emit({direction:"up"});break;case"ArrowDown":if(!this.activated)return;e.preventDefault(),this.calciteHandleNudge.emit({direction:"down"});break}},this.handleBlur=()=>{this.activated=!1},this.activated=!1,this.dragHandle=void 0,this.messages=void 0,this.setPosition=void 0,this.setSize=void 0,this.label=void 0,this.messageOverrides=void 0,this.effectiveLocale=void 0,this.defaultMessages=void 0}handleAriaTextChange(){const e=this.getAriaText("live");e&&this.calciteInternalHandleChange.emit({message:e})}onMessagesChange(){}connectedCallback(){A(this),E(this)}async componentWillLoad(){M(this),await w(this)}componentDidLoad(){B(this)}disconnectedCallback(){D(this),k(this)}effectiveLocaleChange(){H(this,this.effectiveLocale)}async setFocus(){var e;await P(this),(e=this.handleButton)==null||e.focus()}getAriaText(e){const{setPosition:t,setSize:n,label:s,messages:l,activated:o}=this;return!l||!s||typeof n!="number"||typeof t!="number"?null:(e==="label"?o?l.dragHandleChange:l.dragHandleIdle:o?l.dragHandleActive:l.dragHandleCommit).replace("{position}",t.toString()).replace("{itemLabel}",s).replace("{total}",n.toString())}render(){var e;return i("span",{"aria-label":this.getAriaText("label"),"aria-pressed":v(this.activated),class:{[x.handle]:!0,[x.handleActivated]:this.activated},onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,role:"button",tabindex:"0",title:(e=this.messages)==null?void 0:e.dragHandle,ref:t=>{this.handleButton=t}},i("calcite-icon",{icon:X.drag,scale:"s"}))}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{messages:["handleAriaTextChange"],label:["handleAriaTextChange"],activated:["handleAriaTextChange"],setPosition:["handleAriaTextChange"],setSize:["handleAriaTextChange"],messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return Y}},[1,"calcite-handle",{activated:[1540],dragHandle:[513,"drag-handle"],messages:[16],setPosition:[2,"set-position"],setSize:[2,"set-size"],label:[1],messageOverrides:[16],effectiveLocale:[32],defaultMessages:[32],setFocus:[64]}]);function O(){if(typeof customElements>"u")return;["calcite-handle","calcite-icon"].forEach(t=>{switch(t){case"calcite-handle":customElements.get(t)||customElements.define(t,Z);break;case"calcite-icon":customElements.get(t)||z();break}})}O();/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 @@ -26,4 +26,4 @@ import{q as I,H as L,r as p,t as i,v,h7 as g,ch as U,x as j}from"./index-J0iiHjM 1 ) ) - )}.content,.custom-content{display:flex;flex:1 1 auto;flex-direction:column;justify-content:center;padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--2);line-height:1.375}.label,.description,.content-bottom{font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);word-wrap:break-word;word-break:break-word}.label:only-child,.description:only-child,.content-bottom:only-child{margin:0px;padding-block:0.25rem}.label{color:var(--calcite-ui-text-1)}.description{margin-block-start:0.125rem;color:var(--calcite-ui-text-3)}.content-start{justify-content:flex-start}.content-end{justify-content:flex-end}.content-start,.content-end{flex:1 1 auto}.content-bottom{display:flex;flex-direction:column;background-color:var(--calcite-ui-foreground-1);padding-inline-start:calc(var(--calcite-list-item-spacing-indent) * var(--calcite-list-item-spacing-indent-multiplier))}.content-container--has-center-content .content-start,.content-container--has-center-content .content-end{flex:0 1 auto}.selection-container{display:flex;padding-inline:0.75rem;color:var(--calcite-list-item-icon-color)}.actions-start,.actions-end,.content-start,.content-end,.selection-container,.drag-container,.open-container{display:flex;align-items:center}.open-container,.selection-container{cursor:pointer}.content-start ::slotted(calcite-icon),.content-end ::slotted(calcite-icon){margin-inline:0.75rem;align-self:center}.actions-start ::slotted(calcite-action),.actions-start ::slotted(calcite-action-menu),.actions-start ::slotted(calcite-handle),.actions-start ::slotted(calcite-dropdown),.actions-end ::slotted(calcite-action),.actions-end ::slotted(calcite-action-menu),.actions-end ::slotted(calcite-handle),.actions-end ::slotted(calcite-dropdown){align-self:stretch;color:inherit}::slotted(calcite-list-item){border-width:0px;border-block-start-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}:host([hidden]){display:none}[hidden]{display:none}`,b=new Map,ee="calcite-list",T=I(class extends L{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteListItemSelect=p(this,"calciteListItemSelect",6),this.calciteListItemClose=p(this,"calciteListItemClose",6),this.calciteInternalListItemSelect=p(this,"calciteInternalListItemSelect",6),this.calciteInternalListItemActive=p(this,"calciteInternalListItemActive",6),this.calciteInternalFocusPreviousItem=p(this,"calciteInternalFocusPreviousItem",6),this.calciteInternalListItemChange=p(this,"calciteInternalListItemChange",6),this.closeClickHandler=()=>{this.closed=!0,this.calciteListItemClose.emit()},this.handleContentSlotChange=e=>{this.hasCustomContent=g(e)},this.handleActionsStartSlotChange=e=>{this.hasActionsStart=g(e)},this.handleActionsEndSlotChange=e=>{this.hasActionsEnd=g(e)},this.handleContentStartSlotChange=e=>{this.hasContentStart=g(e)},this.handleContentEndSlotChange=e=>{this.hasContentEnd=g(e)},this.handleContentBottomSlotChange=e=>{this.hasContentBottom=g(e)},this.handleDefaultSlotChange=e=>{this.handleOpenableChange(e.target)},this.toggleOpen=()=>{this.open=!this.open},this.itemClicked=e=>{e.defaultPrevented||(this.toggleSelected(),this.calciteInternalListItemActive.emit())},this.toggleSelected=()=>{const{selectionMode:e,selected:t}=this;this.disabled||(e==="multiple"||e==="single"?this.selected=!t:e==="single-persist"&&(this.selected=!0),this.calciteListItemSelect.emit())},this.handleItemKeyDown=e=>{if(e.defaultPrevented)return;const{key:t}=e,n=e.composedPath(),{containerEl:s,contentEl:l,actionsStartEl:o,actionsEndEl:c,open:d,openable:f}=this,r=[o,l,c].filter(Boolean),h=r.findIndex(u=>n.includes(u));if(t==="Enter"&&!n.includes(o)&&!n.includes(c))e.preventDefault(),this.toggleSelected();else if(t==="ArrowRight"){e.preventDefault();const u=h+1;h===-1?!d&&f?(this.open=!0,this.focusCell(null)):r[0]&&this.focusCell(r[0]):r[h]&&r[u]&&this.focusCell(r[u])}else if(t==="ArrowLeft"){e.preventDefault();const u=h-1;h===-1?(this.focusCell(null),d&&f?this.open=!1:this.calciteInternalFocusPreviousItem.emit()):h===0?(this.focusCell(null),s.focus()):r[h]&&r[u]&&this.focusCell(r[u])}},this.focusCellNull=()=>{this.focusCell(null)},this.focusCell=(e,t=!0)=>{const{contentEl:n,actionsStartEl:s,actionsEndEl:l,parentListEl:o}=this;t&&b.set(o,null),[s,n,l].filter(Boolean).forEach((c,d)=>{const f="tabindex";c===e?(c.setAttribute(f,"0"),t&&b.set(o,d)):c.removeAttribute(f)}),e==null||e.focus()},this.active=!1,this.closable=!1,this.closed=!1,this.description=void 0,this.disabled=!1,this.dragHandle=!1,this.label=void 0,this.metadata=void 0,this.open=!1,this.setSize=null,this.setPosition=null,this.selected=!1,this.value=void 0,this.selectionMode=null,this.selectionAppearance=null,this.messageOverrides=void 0,this.messages=void 0,this.effectiveLocale="",this.defaultMessages=void 0,this.level=null,this.visualLevel=null,this.parentListEl=void 0,this.openable=!1,this.hasActionsStart=!1,this.hasActionsEnd=!1,this.hasCustomContent=!1,this.hasContentStart=!1,this.hasContentEnd=!1,this.hasContentBottom=!1}activeHandler(e){e||this.focusCell(null,!1)}handleClosedChange(){this.emitCalciteInternalListItemChange()}handleDisabledChange(){this.emitCalciteInternalListItemChange()}handleSelectedChange(){this.calciteInternalListItemSelect.emit()}onMessagesChange(){}handleCalciteInternalListDefaultSlotChanges(e){e.stopPropagation(),this.handleOpenableChange(this.defaultSlotEl)}effectiveLocaleChange(){H(this,this.effectiveLocale)}connectedCallback(){R(this),E(this),A(this);const{el:e}=this;this.parentListEl=e.closest(ee),this.level=x(e)+1,this.visualLevel=x(e,!0),this.setSelectionDefaults()}async componentWillLoad(){M(this),await w(this)}componentDidLoad(){B(this)}componentDidRender(){W(this)}disconnectedCallback(){q(this),k(this),D(this)}async setFocus(){await P(this);const{containerEl:e,contentEl:t,actionsStartEl:n,actionsEndEl:s,parentListEl:l}=this,o=b.get(l);if(typeof o=="number"){const c=[n,t,s].filter(Boolean);c[o]?this.focusCell(c[o]):e==null||e.focus();return}e==null||e.focus()}renderSelected(){const{selected:e,selectionMode:t,selectionAppearance:n}=this;return t==="none"||n==="border"?null:i("td",{class:a.selectionContainer,key:"selection-container",onClick:this.itemClicked},i("calcite-icon",{icon:e?t==="multiple"?m.selectedMultiple:m.selectedSingle:m.unselected,scale:"s"}))}renderDragHandle(){return this.dragHandle?i("td",{class:a.dragContainer,key:"drag-handle-container"},i("calcite-handle",{label:this.label,setPosition:this.setPosition,setSize:this.setSize})):null}renderOpen(){const{el:e,open:t,openable:n,parentListEl:s}=this,l=U(e),o=n?t?m.open:l==="rtl"?m.closedRTL:m.closedLTR:m.blank,c=n?this.toggleOpen:this.itemClicked;return n||s!=null&&s.openable?i("td",{class:a.openContainer,key:"open-container",onClick:c},i("calcite-icon",{icon:o,key:o,scale:"s"})):null}renderActionsStart(){const{label:e,hasActionsStart:t}=this;return i("td",{"aria-label":e,class:a.actionsStart,hidden:!t,key:"actions-start-container",role:"gridcell",ref:n=>this.actionsStartEl=n},i("slot",{name:C.actionsStart,onSlotchange:this.handleActionsStartSlotChange}))}renderActionsEnd(){const{label:e,hasActionsEnd:t,closable:n,messages:s}=this;return i("td",{"aria-label":e,class:a.actionsEnd,hidden:!(t||n),key:"actions-end-container",role:"gridcell",ref:l=>this.actionsEndEl=l},i("slot",{name:C.actionsEnd,onSlotchange:this.handleActionsEndSlotChange}),n?i("calcite-action",{appearance:"transparent",icon:m.close,key:"close-action",label:s.close,onClick:this.closeClickHandler,text:s.close}):null)}renderContentStart(){const{hasContentStart:e}=this;return i("div",{class:a.contentStart,hidden:!e},i("slot",{name:C.contentStart,onSlotchange:this.handleContentStartSlotChange}))}renderCustomContent(){const{hasCustomContent:e}=this;return i("div",{class:a.customContent,hidden:!e},i("slot",{name:C.content,onSlotchange:this.handleContentSlotChange}))}renderContentEnd(){const{hasContentEnd:e}=this;return i("div",{class:a.contentEnd,hidden:!e},i("slot",{name:C.contentEnd,onSlotchange:this.handleContentEndSlotChange}))}renderContentBottom(){const{hasContentBottom:e,visualLevel:t}=this;return i("div",{class:a.contentBottom,hidden:!e,style:{"--calcite-list-item-spacing-indent-multiplier":`${t}`}},i("slot",{name:C.contentBottom,onSlotchange:this.handleContentBottomSlotChange}))}renderDefaultContainer(){return i("div",{class:{[a.nestedContainer]:!0,[a.nestedContainerHidden]:this.openable&&!this.open}},i("slot",{onSlotchange:this.handleDefaultSlotChange,ref:e=>this.defaultSlotEl=e}))}renderContentProperties(){const{label:e,description:t,hasCustomContent:n}=this;return!n&&(e||t)?i("div",{class:a.content,key:"content"},e?i("div",{class:a.label,key:"label"},e):null,t?i("div",{class:a.description,key:"description"},t):null):null}renderContentContainer(){const{description:e,label:t,selectionMode:n,hasCustomContent:s}=this,l=s||!!t||!!e,o=[this.renderContentStart(),this.renderCustomContent(),this.renderContentProperties(),this.renderContentEnd()];return i("td",{"aria-label":t,class:{[a.contentContainer]:!0,[a.contentContainerSelectable]:n!=="none",[a.contentContainerHasCenterContent]:l},key:"content-container",onClick:this.itemClicked,role:"gridcell",ref:c=>this.contentEl=c},o)}render(){const{openable:e,open:t,level:n,setPosition:s,setSize:l,active:o,label:c,selected:d,selectionAppearance:f,selectionMode:r,closed:h,visualLevel:u}=this,S=r!=="none"&&f==="border",F=S&&d,_=S&&!d;return i(j,null,i("tr",{"aria-expanded":e?v(t):null,"aria-label":c,"aria-level":n,"aria-posinset":s,"aria-selected":v(d),"aria-setsize":l,class:{[a.container]:!0,[a.containerBorderSelected]:F,[a.containerBorderUnselected]:_},hidden:h,onFocus:this.focusCellNull,onKeyDown:this.handleItemKeyDown,role:"row",style:{"--calcite-list-item-spacing-indent-multiplier":`${u}`},tabIndex:o?0:-1,ref:K=>this.containerEl=K},this.renderDragHandle(),this.renderSelected(),this.renderOpen(),this.renderActionsStart(),this.renderContentContainer(),this.renderActionsEnd()),this.renderContentBottom(),this.renderDefaultContainer())}emitCalciteInternalListItemChange(){this.calciteInternalListItemChange.emit()}setSelectionDefaults(){const{parentListEl:e,selectionMode:t,selectionAppearance:n}=this;e&&(t||(this.selectionMode=e.selectionMode),n||(this.selectionAppearance=e.selectionAppearance))}handleOpenableChange(e){if(!e)return;const{parentListEl:t}=this,n=G(e);J(n);const s=!!n.length;s&&t&&!t.openable&&(t.openable=!0),this.openable=s,s||(this.open=!1)}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{active:["activeHandler"],closed:["handleClosedChange"],disabled:["handleDisabledChange"],selected:["handleSelectedChange"],messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return N}},[1,"calcite-list-item",{active:[4],closable:[516],closed:[1540],description:[1],disabled:[516],dragHandle:[4,"drag-handle"],label:[1],metadata:[16],open:[1540],setSize:[2,"set-size"],setPosition:[2,"set-position"],selected:[1540],value:[8],selectionMode:[1025,"selection-mode"],selectionAppearance:[1025,"selection-appearance"],messageOverrides:[1040],messages:[1040],effectiveLocale:[32],defaultMessages:[32],level:[32],visualLevel:[32],parentListEl:[32],openable:[32],hasActionsStart:[32],hasActionsEnd:[32],hasCustomContent:[32],hasContentStart:[32],hasContentEnd:[32],hasContentBottom:[32],setFocus:[64]},[[0,"calciteInternalListItemGroupDefaultSlotChange","handleCalciteInternalListDefaultSlotChanges"],[0,"calciteInternalListDefaultSlotChange","handleCalciteInternalListDefaultSlotChanges"]]]);function $(){if(typeof customElements>"u")return;["calcite-list-item","calcite-action","calcite-handle","calcite-icon","calcite-loader"].forEach(t=>{switch(t){case"calcite-list-item":customElements.get(t)||customElements.define(t,T);break;case"calcite-action":customElements.get(t)||Q();break;case"calcite-handle":customElements.get(t)||O();break;case"calcite-icon":customElements.get(t)||z();break;case"calcite-loader":customElements.get(t)||V();break}})}$();const me=T,pe=$;export{me as CalciteListItem,pe as defineCustomElement}; + )}.content,.custom-content{display:flex;flex:1 1 auto;flex-direction:column;justify-content:center;padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--2);line-height:1.375}.label,.description,.content-bottom{font-family:var(--calcite-sans-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal);word-wrap:break-word;word-break:break-word}.label:only-child,.description:only-child,.content-bottom:only-child{margin:0px;padding-block:0.25rem}.label{color:var(--calcite-ui-text-1)}.description{margin-block-start:0.125rem;color:var(--calcite-ui-text-3)}.content-start{justify-content:flex-start}.content-end{justify-content:flex-end}.content-start,.content-end{flex:1 1 auto}.content-bottom{display:flex;flex-direction:column;background-color:var(--calcite-ui-foreground-1);padding-inline-start:calc(var(--calcite-list-item-spacing-indent) * var(--calcite-list-item-spacing-indent-multiplier))}.content-container--has-center-content .content-start,.content-container--has-center-content .content-end{flex:0 1 auto}.selection-container{display:flex;padding-inline:0.75rem;color:var(--calcite-list-item-icon-color)}.actions-start,.actions-end,.content-start,.content-end,.selection-container,.drag-container,.open-container{display:flex;align-items:center}.open-container,.selection-container{cursor:pointer}.content-start ::slotted(calcite-icon),.content-end ::slotted(calcite-icon){margin-inline:0.75rem;align-self:center}.actions-start ::slotted(calcite-action),.actions-start ::slotted(calcite-action-menu),.actions-start ::slotted(calcite-handle),.actions-start ::slotted(calcite-dropdown),.actions-end ::slotted(calcite-action),.actions-end ::slotted(calcite-action-menu),.actions-end ::slotted(calcite-handle),.actions-end ::slotted(calcite-dropdown){align-self:stretch;color:inherit}::slotted(calcite-list-item){border-width:0px;border-block-start-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}:host([hidden]){display:none}[hidden]{display:none}`,b=new Map,ee="calcite-list",T=I(class extends L{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteListItemSelect=p(this,"calciteListItemSelect",6),this.calciteListItemClose=p(this,"calciteListItemClose",6),this.calciteInternalListItemSelect=p(this,"calciteInternalListItemSelect",6),this.calciteInternalListItemActive=p(this,"calciteInternalListItemActive",6),this.calciteInternalFocusPreviousItem=p(this,"calciteInternalFocusPreviousItem",6),this.calciteInternalListItemChange=p(this,"calciteInternalListItemChange",6),this.closeClickHandler=()=>{this.closed=!0,this.calciteListItemClose.emit()},this.handleContentSlotChange=e=>{this.hasCustomContent=g(e)},this.handleActionsStartSlotChange=e=>{this.hasActionsStart=g(e)},this.handleActionsEndSlotChange=e=>{this.hasActionsEnd=g(e)},this.handleContentStartSlotChange=e=>{this.hasContentStart=g(e)},this.handleContentEndSlotChange=e=>{this.hasContentEnd=g(e)},this.handleContentBottomSlotChange=e=>{this.hasContentBottom=g(e)},this.handleDefaultSlotChange=e=>{this.handleOpenableChange(e.target)},this.toggleOpen=()=>{this.open=!this.open},this.itemClicked=e=>{e.defaultPrevented||(this.toggleSelected(),this.calciteInternalListItemActive.emit())},this.toggleSelected=()=>{const{selectionMode:e,selected:t}=this;this.disabled||(e==="multiple"||e==="single"?this.selected=!t:e==="single-persist"&&(this.selected=!0),this.calciteListItemSelect.emit())},this.handleItemKeyDown=e=>{if(e.defaultPrevented)return;const{key:t}=e,n=e.composedPath(),{containerEl:s,contentEl:l,actionsStartEl:o,actionsEndEl:c,open:d,openable:f}=this,r=[o,l,c].filter(Boolean),h=r.findIndex(u=>n.includes(u));if(t==="Enter"&&!n.includes(o)&&!n.includes(c))e.preventDefault(),this.toggleSelected();else if(t==="ArrowRight"){e.preventDefault();const u=h+1;h===-1?!d&&f?(this.open=!0,this.focusCell(null)):r[0]&&this.focusCell(r[0]):r[h]&&r[u]&&this.focusCell(r[u])}else if(t==="ArrowLeft"){e.preventDefault();const u=h-1;h===-1?(this.focusCell(null),d&&f?this.open=!1:this.calciteInternalFocusPreviousItem.emit()):h===0?(this.focusCell(null),s.focus()):r[h]&&r[u]&&this.focusCell(r[u])}},this.focusCellNull=()=>{this.focusCell(null)},this.focusCell=(e,t=!0)=>{const{contentEl:n,actionsStartEl:s,actionsEndEl:l,parentListEl:o}=this;t&&b.set(o,null),[s,n,l].filter(Boolean).forEach((c,d)=>{const f="tabindex";c===e?(c.setAttribute(f,"0"),t&&b.set(o,d)):c.removeAttribute(f)}),e==null||e.focus()},this.active=!1,this.closable=!1,this.closed=!1,this.description=void 0,this.disabled=!1,this.dragHandle=!1,this.label=void 0,this.metadata=void 0,this.open=!1,this.setSize=null,this.setPosition=null,this.selected=!1,this.value=void 0,this.selectionMode=null,this.selectionAppearance=null,this.messageOverrides=void 0,this.messages=void 0,this.effectiveLocale="",this.defaultMessages=void 0,this.level=null,this.visualLevel=null,this.parentListEl=void 0,this.openable=!1,this.hasActionsStart=!1,this.hasActionsEnd=!1,this.hasCustomContent=!1,this.hasContentStart=!1,this.hasContentEnd=!1,this.hasContentBottom=!1}activeHandler(e){e||this.focusCell(null,!1)}handleClosedChange(){this.emitCalciteInternalListItemChange()}handleDisabledChange(){this.emitCalciteInternalListItemChange()}handleSelectedChange(){this.calciteInternalListItemSelect.emit()}onMessagesChange(){}handleCalciteInternalListDefaultSlotChanges(e){e.stopPropagation(),this.handleOpenableChange(this.defaultSlotEl)}effectiveLocaleChange(){H(this,this.effectiveLocale)}connectedCallback(){R(this),E(this),A(this);const{el:e}=this;this.parentListEl=e.closest(ee),this.level=y(e)+1,this.visualLevel=y(e,!0),this.setSelectionDefaults()}async componentWillLoad(){M(this),await w(this)}componentDidLoad(){B(this)}componentDidRender(){W(this)}disconnectedCallback(){G(this),k(this),D(this)}async setFocus(){await P(this);const{containerEl:e,contentEl:t,actionsStartEl:n,actionsEndEl:s,parentListEl:l}=this,o=b.get(l);if(typeof o=="number"){const c=[n,t,s].filter(Boolean);c[o]?this.focusCell(c[o]):e==null||e.focus();return}e==null||e.focus()}renderSelected(){const{selected:e,selectionMode:t,selectionAppearance:n}=this;return t==="none"||n==="border"?null:i("td",{class:a.selectionContainer,key:"selection-container",onClick:this.itemClicked},i("calcite-icon",{icon:e?t==="multiple"?m.selectedMultiple:m.selectedSingle:m.unselected,scale:"s"}))}renderDragHandle(){return this.dragHandle?i("td",{class:a.dragContainer,key:"drag-handle-container"},i("calcite-handle",{label:this.label,setPosition:this.setPosition,setSize:this.setSize})):null}renderOpen(){const{el:e,open:t,openable:n,parentListEl:s}=this,l=U(e),o=n?t?m.open:l==="rtl"?m.closedRTL:m.closedLTR:m.blank,c=n?this.toggleOpen:this.itemClicked;return n||s!=null&&s.openable?i("td",{class:a.openContainer,key:"open-container",onClick:c},i("calcite-icon",{icon:o,key:o,scale:"s"})):null}renderActionsStart(){const{label:e,hasActionsStart:t}=this;return i("td",{"aria-label":e,class:a.actionsStart,hidden:!t,key:"actions-start-container",role:"gridcell",ref:n=>this.actionsStartEl=n},i("slot",{name:C.actionsStart,onSlotchange:this.handleActionsStartSlotChange}))}renderActionsEnd(){const{label:e,hasActionsEnd:t,closable:n,messages:s}=this;return i("td",{"aria-label":e,class:a.actionsEnd,hidden:!(t||n),key:"actions-end-container",role:"gridcell",ref:l=>this.actionsEndEl=l},i("slot",{name:C.actionsEnd,onSlotchange:this.handleActionsEndSlotChange}),n?i("calcite-action",{appearance:"transparent",icon:m.close,key:"close-action",label:s.close,onClick:this.closeClickHandler,text:s.close}):null)}renderContentStart(){const{hasContentStart:e}=this;return i("div",{class:a.contentStart,hidden:!e},i("slot",{name:C.contentStart,onSlotchange:this.handleContentStartSlotChange}))}renderCustomContent(){const{hasCustomContent:e}=this;return i("div",{class:a.customContent,hidden:!e},i("slot",{name:C.content,onSlotchange:this.handleContentSlotChange}))}renderContentEnd(){const{hasContentEnd:e}=this;return i("div",{class:a.contentEnd,hidden:!e},i("slot",{name:C.contentEnd,onSlotchange:this.handleContentEndSlotChange}))}renderContentBottom(){const{hasContentBottom:e,visualLevel:t}=this;return i("div",{class:a.contentBottom,hidden:!e,style:{"--calcite-list-item-spacing-indent-multiplier":`${t}`}},i("slot",{name:C.contentBottom,onSlotchange:this.handleContentBottomSlotChange}))}renderDefaultContainer(){return i("div",{class:{[a.nestedContainer]:!0,[a.nestedContainerHidden]:this.openable&&!this.open}},i("slot",{onSlotchange:this.handleDefaultSlotChange,ref:e=>this.defaultSlotEl=e}))}renderContentProperties(){const{label:e,description:t,hasCustomContent:n}=this;return!n&&(e||t)?i("div",{class:a.content,key:"content"},e?i("div",{class:a.label,key:"label"},e):null,t?i("div",{class:a.description,key:"description"},t):null):null}renderContentContainer(){const{description:e,label:t,selectionMode:n,hasCustomContent:s}=this,l=s||!!t||!!e,o=[this.renderContentStart(),this.renderCustomContent(),this.renderContentProperties(),this.renderContentEnd()];return i("td",{"aria-label":t,class:{[a.contentContainer]:!0,[a.contentContainerSelectable]:n!=="none",[a.contentContainerHasCenterContent]:l},key:"content-container",onClick:this.itemClicked,role:"gridcell",ref:c=>this.contentEl=c},o)}render(){const{openable:e,open:t,level:n,setPosition:s,setSize:l,active:o,label:c,selected:d,selectionAppearance:f,selectionMode:r,closed:h,visualLevel:u}=this,S=r!=="none"&&f==="border",F=S&&d,_=S&&!d;return i(j,null,i("tr",{"aria-expanded":e?v(t):null,"aria-label":c,"aria-level":n,"aria-posinset":s,"aria-selected":v(d),"aria-setsize":l,class:{[a.container]:!0,[a.containerBorderSelected]:F,[a.containerBorderUnselected]:_},hidden:h,onFocus:this.focusCellNull,onKeyDown:this.handleItemKeyDown,role:"row",style:{"--calcite-list-item-spacing-indent-multiplier":`${u}`},tabIndex:o?0:-1,ref:K=>this.containerEl=K},this.renderDragHandle(),this.renderSelected(),this.renderOpen(),this.renderActionsStart(),this.renderContentContainer(),this.renderActionsEnd()),this.renderContentBottom(),this.renderDefaultContainer())}emitCalciteInternalListItemChange(){this.calciteInternalListItemChange.emit()}setSelectionDefaults(){const{parentListEl:e,selectionMode:t,selectionAppearance:n}=this;e&&(t||(this.selectionMode=e.selectionMode),n||(this.selectionAppearance=e.selectionAppearance))}handleOpenableChange(e){if(!e)return;const{parentListEl:t}=this,n=q(e);J(n);const s=!!n.length;s&&t&&!t.openable&&(t.openable=!0),this.openable=s,s||(this.open=!1)}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{active:["activeHandler"],closed:["handleClosedChange"],disabled:["handleDisabledChange"],selected:["handleSelectedChange"],messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return N}},[1,"calcite-list-item",{active:[4],closable:[516],closed:[1540],description:[1],disabled:[516],dragHandle:[4,"drag-handle"],label:[1],metadata:[16],open:[1540],setSize:[2,"set-size"],setPosition:[2,"set-position"],selected:[1540],value:[8],selectionMode:[1025,"selection-mode"],selectionAppearance:[1025,"selection-appearance"],messageOverrides:[1040],messages:[1040],effectiveLocale:[32],defaultMessages:[32],level:[32],visualLevel:[32],parentListEl:[32],openable:[32],hasActionsStart:[32],hasActionsEnd:[32],hasCustomContent:[32],hasContentStart:[32],hasContentEnd:[32],hasContentBottom:[32],setFocus:[64]},[[0,"calciteInternalListItemGroupDefaultSlotChange","handleCalciteInternalListDefaultSlotChanges"],[0,"calciteInternalListDefaultSlotChange","handleCalciteInternalListDefaultSlotChanges"]]]);function $(){if(typeof customElements>"u")return;["calcite-list-item","calcite-action","calcite-handle","calcite-icon","calcite-loader"].forEach(t=>{switch(t){case"calcite-list-item":customElements.get(t)||customElements.define(t,T);break;case"calcite-action":customElements.get(t)||Q();break;case"calcite-handle":customElements.get(t)||O();break;case"calcite-icon":customElements.get(t)||z();break;case"calcite-loader":customElements.get(t)||V();break}})}$();const me=T,pe=$;export{me as CalciteListItem,pe as defineCustomElement}; diff --git a/dist/assets/calcite-list-item-group-havhVECR.js b/dist/assets/calcite-list-item-group-L6UN1q3l.js similarity index 93% rename from dist/assets/calcite-list-item-group-havhVECR.js rename to dist/assets/calcite-list-item-group-L6UN1q3l.js index 4f0ff59..a7a14cf 100644 --- a/dist/assets/calcite-list-item-group-havhVECR.js +++ b/dist/assets/calcite-list-item-group-L6UN1q3l.js @@ -1,4 +1,4 @@ -import{q as o,H as l,r as c,t as i,x as r}from"./index-J0iiHjMT.js";import{c as d,u as h,d as u}from"./interactive-NKzPUNL4.js";import{g as m,M as p}from"./utils3-_ao2jQXg.js";/*! +import{p as o,H as l,d as c,k as i,l as r}from"./index-pCX-0tJH.js";import{c as d,u as h,d as u}from"./interactive-9W9APeiw.js";import{g as m,M as p}from"./utils3--QEgMxFs.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-loader-Z65agR8e.js b/dist/assets/calcite-loader-IfjW-6zZ.js similarity index 69% rename from dist/assets/calcite-loader-Z65agR8e.js rename to dist/assets/calcite-loader-IfjW-6zZ.js index ab0d2cd..bd9cefa 100644 --- a/dist/assets/calcite-loader-Z65agR8e.js +++ b/dist/assets/calcite-loader-IfjW-6zZ.js @@ -1,4 +1,4 @@ -import{L as e,d as o}from"./loader-QqciGs1c.js";import"./index-J0iiHjMT.js";import"./guid-6vN-YNJI.js";/*! +import{L as e,d as o}from"./loader-plQ4Tft5.js";import"./index-pCX-0tJH.js";import"./guid-6vN-YNJI.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-notice-zH528nES.js b/dist/assets/calcite-notice-6pbWdSt0.js similarity index 95% rename from dist/assets/calcite-notice-zH528nES.js rename to dist/assets/calcite-notice-6pbWdSt0.js index 5c60f98..36feacb 100644 --- a/dist/assets/calcite-notice-zH528nES.js +++ b/dist/assets/calcite-notice-6pbWdSt0.js @@ -1,4 +1,4 @@ -import{q as p,H as f,r as s,dc as a,t,db as u}from"./index-J0iiHjMT.js";import{c as v,d as k}from"./conditionalSlot-e55zipTI.js";import{s as b,a as x,c as w}from"./loadable-sxY2K1G3.js";import{c as C,d as z}from"./locale-pfkq1d6A.js";import{c as y,d as E,s as L,u as B}from"./t9n-od6MEnI1.js";import{o as l}from"./openCloseComponent-yw47Oy2q.js";import{g as r}from"./component-dtiBfYiX.js";import{d as O}from"./icon-ZwpY5ksA.js";import"./observers-JyBmMU24.js";import"./key-qdHumIlA.js";/*! +import{p,H as f,d as s,dc as a,k as t,db as u}from"./index-pCX-0tJH.js";import{c as v,d as k}from"./conditionalSlot-OgY0Ln74.js";import{s as b,a as x,c as w}from"./loadable-uNbe2Ndt.js";import{c as C,d as z}from"./locale-tKMV0J87.js";import{c as y,d as E,s as L,u as B}from"./t9n-KLe7iM0R.js";import{o as l}from"./openCloseComponent-lU2sdEaR.js";import{g as r}from"./component-dtiBfYiX.js";import{d as O}from"./icon-BW6RCrUr.js";import"./observers-eNe735aq.js";import"./key-qdHumIlA.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-option-LMeeGK3H.js b/dist/assets/calcite-option-XCvROySu.js similarity index 94% rename from dist/assets/calcite-option-LMeeGK3H.js rename to dist/assets/calcite-option-XCvROySu.js index b170a21..79162cf 100644 --- a/dist/assets/calcite-option-LMeeGK3H.js +++ b/dist/assets/calcite-option-XCvROySu.js @@ -1,4 +1,4 @@ -import{q as o,H as r,r as c,t as h}from"./index-J0iiHjMT.js";import{c as d}from"./observers-JyBmMU24.js";/*! +import{p as o,H as r,d as c,k as h}from"./index-pCX-0tJH.js";import{c as d}from"./observers-eNe735aq.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-popover-Lvoq79Pm.js b/dist/assets/calcite-popover-Lvoq79Pm.js new file mode 100644 index 0000000..f7c127c --- /dev/null +++ b/dist/assets/calcite-popover-Lvoq79Pm.js @@ -0,0 +1,5 @@ +import{P as o,d as t}from"./popover-QEcoULsC.js";import"./index-pCX-0tJH.js";import"./floating-ui-C10Xvlxv.js";import"./debounce-HnHf1UOZ.js";import"./guid-6vN-YNJI.js";import"./openCloseComponent-lU2sdEaR.js";import"./locale-tKMV0J87.js";import"./key-qdHumIlA.js";import"./observers-eNe735aq.js";import"./t9n-KLe7iM0R.js";import"./loadable-uNbe2Ndt.js";import"./FloatingArrow-FUeqM5kw.js";import"./component-dtiBfYiX.js";import"./action-bN6v5--b.js";import"./interactive-9W9APeiw.js";import"./icon-BW6RCrUr.js";import"./loader-plQ4Tft5.js";/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. + * v1.11.0 + */const x=o,$=t;export{x as CalcitePopover,$ as defineCustomElement}; diff --git a/dist/assets/calcite-popover-PeZ1jQob.js b/dist/assets/calcite-popover-PeZ1jQob.js deleted file mode 100644 index 3e3e9b5..0000000 --- a/dist/assets/calcite-popover-PeZ1jQob.js +++ /dev/null @@ -1,5 +0,0 @@ -import{P as o,d as t}from"./popover-Jm1QI0N1.js";import"./index-J0iiHjMT.js";import"./floating-ui-McpI0u1Z.js";import"./debounce-HnHf1UOZ.js";import"./guid-6vN-YNJI.js";import"./openCloseComponent-yw47Oy2q.js";import"./locale-pfkq1d6A.js";import"./key-qdHumIlA.js";import"./observers-JyBmMU24.js";import"./t9n-od6MEnI1.js";import"./loadable-sxY2K1G3.js";import"./FloatingArrow-BghsONry.js";import"./component-dtiBfYiX.js";import"./action-W5zDPNjG.js";import"./interactive-NKzPUNL4.js";import"./icon-ZwpY5ksA.js";import"./loader-QqciGs1c.js";/*! - * All material copyright ESRI, All Rights Reserved, unless otherwise specified. - * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. - * v1.11.0 - */const x=o,$=t;export{x as CalcitePopover,$ as defineCustomElement}; diff --git a/dist/assets/calcite-scrim-iUD6Tmec.js b/dist/assets/calcite-scrim-eUqm3Zfl.js similarity index 50% rename from dist/assets/calcite-scrim-iUD6Tmec.js rename to dist/assets/calcite-scrim-eUqm3Zfl.js index 4aadf6e..eb0bfbe 100644 --- a/dist/assets/calcite-scrim-iUD6Tmec.js +++ b/dist/assets/calcite-scrim-eUqm3Zfl.js @@ -1,4 +1,4 @@ -import{S as t,d as m}from"./scrim-OeyGkB0-.js";import"./index-J0iiHjMT.js";import"./locale-pfkq1d6A.js";import"./key-qdHumIlA.js";import"./observers-JyBmMU24.js";import"./t9n-od6MEnI1.js";import"./loader-QqciGs1c.js";import"./guid-6vN-YNJI.js";/*! +import{S as t,d as m}from"./scrim-yAG2Pcs1.js";import"./index-pCX-0tJH.js";import"./locale-tKMV0J87.js";import"./key-qdHumIlA.js";import"./observers-eNe735aq.js";import"./t9n-KLe7iM0R.js";import"./loader-plQ4Tft5.js";import"./guid-6vN-YNJI.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/calcite-select-0Yw6DsYN.js b/dist/assets/calcite-select-h4uorzoD.js similarity index 91% rename from dist/assets/calcite-select-0Yw6DsYN.js rename to dist/assets/calcite-select-h4uorzoD.js index 1fa6331..bdd9ea3 100644 --- a/dist/assets/calcite-select-0Yw6DsYN.js +++ b/dist/assets/calcite-select-h4uorzoD.js @@ -1,8 +1,8 @@ -import{q as r,H as d,r as h,ac as m,t as s,ad as p}from"./index-J0iiHjMT.js";import{c as u,d as f,a as b,H as v}from"./form-2Iq0hI3D.js";import{c as g,d as E,u as C}from"./interactive-NKzPUNL4.js";import{c as x,d as w,g as N}from"./label2-d2vWQ7x7.js";import{s as S,a as y,c as I}from"./loadable-sxY2K1G3.js";import{c as z}from"./observers-JyBmMU24.js";import{g as T}from"./component-dtiBfYiX.js";import{d as O}from"./icon-ZwpY5ksA.js";/*! +import{p as r,H as d,d as h,X as m,k as s,Y as p}from"./index-pCX-0tJH.js";import{c as u,d as f,a as b,H as v}from"./form-1U5Kiwxm.js";import{c as g,d as E,u as C}from"./interactive-9W9APeiw.js";import{c as x,d as w,g as N}from"./label2-JXqLMBYY.js";import{s as S,a as y,c as I}from"./loadable-uNbe2Ndt.js";import{c as z}from"./observers-eNe735aq.js";import{g as T}from"./component-dtiBfYiX.js";import{d as k}from"./icon-BW6RCrUr.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const a={icon:"icon",iconContainer:"icon-container",select:"select"},k=`:host{--calcite-icon-size:1rem;--calcite-spacing-eighth:0.125rem;--calcite-spacing-quarter:0.25rem;--calcite-spacing-half:0.5rem;--calcite-spacing-three-quarters:0.75rem;--calcite-spacing:1rem;--calcite-spacing-plus-quarter:1.25rem;--calcite-spacing-plus-half:1.5rem;--calcite-spacing-double:2rem;--calcite-menu-min-width:10rem;--calcite-header-min-height:3rem;--calcite-footer-min-height:3rem}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:flex;align-items:stretch;inline-size:var(--select-width)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([scale=s]){block-size:1.5rem;--calcite-select-font-size:var(--calcite-font-size--2);--calcite-select-spacing-inline:0.5rem 2rem}:host([scale=s]) .icon-container{padding-inline:0.5rem}:host([scale=m]){block-size:2rem;--calcite-select-font-size:var(--calcite-font-size--1);--calcite-select-spacing-inline:0.75rem 2.5rem}:host([scale=m]) .icon-container{padding-inline:0.75rem}:host([scale=l]){block-size:44px;--calcite-select-font-size:var(--calcite-font-size-0);--calcite-select-spacing-inline:1rem 3rem}:host([scale=l]) .icon-container{padding-inline:1rem}:host([width=auto]){inline-size:auto}:host([width=half]){inline-size:50%}:host([width=full]){inline-size:100%}.select{margin:0px;box-sizing:border-box;inline-size:100%;cursor:pointer;appearance:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:0px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);font-family:inherit;color:var(--calcite-ui-text-2);outline-color:transparent;font-size:var(--calcite-select-font-size);padding-inline:var(--calcite-select-spacing-inline);border-inline-end-width:0px}.select:focus{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc( + */const a={icon:"icon",iconContainer:"icon-container",select:"select"},O=`:host{--calcite-icon-size:1rem;--calcite-spacing-eighth:0.125rem;--calcite-spacing-quarter:0.25rem;--calcite-spacing-half:0.5rem;--calcite-spacing-three-quarters:0.75rem;--calcite-spacing:1rem;--calcite-spacing-plus-quarter:1.25rem;--calcite-spacing-plus-half:1.5rem;--calcite-spacing-double:2rem;--calcite-menu-min-width:10rem;--calcite-header-min-height:3rem;--calcite-footer-min-height:3rem}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:flex;align-items:stretch;inline-size:var(--select-width)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([scale=s]){block-size:1.5rem;--calcite-select-font-size:var(--calcite-font-size--2);--calcite-select-spacing-inline:0.5rem 2rem}:host([scale=s]) .icon-container{padding-inline:0.5rem}:host([scale=m]){block-size:2rem;--calcite-select-font-size:var(--calcite-font-size--1);--calcite-select-spacing-inline:0.75rem 2.5rem}:host([scale=m]) .icon-container{padding-inline:0.75rem}:host([scale=l]){block-size:44px;--calcite-select-font-size:var(--calcite-font-size-0);--calcite-select-spacing-inline:1rem 3rem}:host([scale=l]) .icon-container{padding-inline:1rem}:host([width=auto]){inline-size:auto}:host([width=half]){inline-size:50%}:host([width=full]){inline-size:100%}.select{margin:0px;box-sizing:border-box;inline-size:100%;cursor:pointer;appearance:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:0px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);font-family:inherit;color:var(--calcite-ui-text-2);outline-color:transparent;font-size:var(--calcite-select-font-size);padding-inline:var(--calcite-select-spacing-inline);border-inline-end-width:0px}.select:focus{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc( -2px * calc( 1 - @@ -12,4 +12,4 @@ import{q as r,H as d,r as h,ac as m,t as s,ad as p}from"./index-J0iiHjMT.js";imp 1 ) ) - )}.select:hover{background-color:var(--calcite-ui-foreground-2)}select:disabled{border-color:var(--calcite-ui-border-input);--tw-bg-opacity:1}.icon-container{pointer-events:none;position:absolute;inset-block:0px;display:flex;align-items:center;border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:transparent;color:var(--calcite-ui-text-2);inset-inline-end:0px;border-inline-width:0px 1px}.select:focus~.icon-container{border-color:transparent}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}`;function c(e){return e.tagName==="CALCITE-OPTION"}function A(e){return e.tagName==="CALCITE-OPTION-GROUP"}const l=r(class extends d{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteSelectChange=h(this,"calciteSelectChange",6),this.componentToNativeEl=new Map,this.mutationObserver=z("mutation",()=>this.populateInternalSelect()),this.handleInternalSelectChange=()=>{const e=this.selectEl.selectedOptions[0];this.selectFromNativeOption(e),requestAnimationFrame(()=>this.emitChangeEvent())},this.populateInternalSelect=()=>{const e=Array.from(this.el.children).filter(t=>t.tagName==="CALCITE-OPTION"||t.tagName==="CALCITE-OPTION-GROUP");this.clearInternalSelect(),e.forEach(t=>{var i;return(i=this.selectEl)==null?void 0:i.append(this.toNativeElement(t))})},this.storeSelectRef=e=>{this.selectEl=e,this.populateInternalSelect();const t=this.selectEl.selectedOptions[0];this.selectFromNativeOption(t)},this.emitChangeEvent=()=>{this.calciteSelectChange.emit()},this.disabled=!1,this.form=void 0,this.label=void 0,this.name=void 0,this.required=!1,this.scale="m",this.value=null,this.selectedOption=void 0,this.width="auto"}valueHandler(e){this.el.querySelectorAll("calcite-option").forEach(i=>i.selected=i.value===e)}selectedOptionHandler(e){this.value=e==null?void 0:e.value}connectedCallback(){var t;const{el:e}=this;(t=this.mutationObserver)==null||t.observe(e,{subtree:!0,childList:!0}),g(this),x(this),u(this)}disconnectedCallback(){var e;(e=this.mutationObserver)==null||e.disconnect(),E(this),w(this),f(this)}componentWillLoad(){S(this)}componentDidLoad(){var e;y(this),b(this,((e=this.selectedOption)==null?void 0:e.value)??"")}componentDidRender(){C(this)}async setFocus(){await I(this),m(this.selectEl)}handleOptionOrGroupChange(e){e.stopPropagation();const t=e.target,i=this.componentToNativeEl.get(t);i&&(this.updateNativeElement(t,i),c(t)&&t.selected&&(this.deselectAllExcept(t),this.selectedOption=t))}onLabelClick(){this.setFocus()}updateNativeElement(e,t){if(t.disabled=e.disabled,t.label=e.label,c(e)){const i=t;i.selected=e.selected,i.value=e.value,i.innerText=e.label}}clearInternalSelect(){this.componentToNativeEl.forEach(e=>e.remove()),this.componentToNativeEl.clear()}selectFromNativeOption(e){if(!e)return;let t;this.componentToNativeEl.forEach((i,n)=>{c(n)&&i===e&&(n.selected=!0,t=n,this.deselectAllExcept(n))}),t&&(this.selectedOption=t)}toNativeElement(e){if(c(e)){const t=document.createElement("option");return this.updateNativeElement(e,t),this.componentToNativeEl.set(e,t),t}if(A(e)){const t=document.createElement("optgroup");return this.updateNativeElement(e,t),Array.from(e.children).forEach(i=>{const n=this.toNativeElement(i);t.append(n),this.componentToNativeEl.set(e,n)}),this.componentToNativeEl.set(e,t),t}throw new Error("unsupported element child provided")}deselectAllExcept(e){this.el.querySelectorAll("calcite-option").forEach(t=>{t!==e&&(t.selected=!1)})}renderChevron(){return s("div",{class:a.iconContainer},s("calcite-icon",{class:a.icon,icon:"chevron-down",scale:T(this.scale)}))}render(){return s(p,null,s("select",{"aria-label":N(this),class:a.select,disabled:this.disabled,onChange:this.handleInternalSelectChange,ref:this.storeSelectRef},s("slot",null)),this.renderChevron(),s(v,{component:this}))}get el(){return this}static get watchers(){return{value:["valueHandler"],selectedOption:["selectedOptionHandler"]}}static get style(){return k}},[1,"calcite-select",{disabled:[516],form:[513],label:[1],name:[513],required:[516],scale:[513],value:[1025],selectedOption:[1040],width:[513],setFocus:[64]},[[0,"calciteInternalOptionChange","handleOptionOrGroupChange"],[0,"calciteInternalOptionGroupChange","handleOptionOrGroupChange"]]]);function o(){if(typeof customElements>"u")return;["calcite-select","calcite-icon"].forEach(t=>{switch(t){case"calcite-select":customElements.get(t)||customElements.define(t,l);break;case"calcite-icon":customElements.get(t)||O();break}})}o();const U=l,$=o;export{U as CalciteSelect,$ as defineCustomElement}; + )}.select:hover{background-color:var(--calcite-ui-foreground-2)}select:disabled{border-color:var(--calcite-ui-border-input);--tw-bg-opacity:1}.icon-container{pointer-events:none;position:absolute;inset-block:0px;display:flex;align-items:center;border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:transparent;color:var(--calcite-ui-text-2);inset-inline-end:0px;border-inline-width:0px 1px}.select:focus~.icon-container{border-color:transparent}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}`;function c(e){return e.tagName==="CALCITE-OPTION"}function A(e){return e.tagName==="CALCITE-OPTION-GROUP"}const l=r(class extends d{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteSelectChange=h(this,"calciteSelectChange",6),this.componentToNativeEl=new Map,this.mutationObserver=z("mutation",()=>this.populateInternalSelect()),this.handleInternalSelectChange=()=>{const e=this.selectEl.selectedOptions[0];this.selectFromNativeOption(e),requestAnimationFrame(()=>this.emitChangeEvent())},this.populateInternalSelect=()=>{const e=Array.from(this.el.children).filter(t=>t.tagName==="CALCITE-OPTION"||t.tagName==="CALCITE-OPTION-GROUP");this.clearInternalSelect(),e.forEach(t=>{var i;return(i=this.selectEl)==null?void 0:i.append(this.toNativeElement(t))})},this.storeSelectRef=e=>{this.selectEl=e,this.populateInternalSelect();const t=this.selectEl.selectedOptions[0];this.selectFromNativeOption(t)},this.emitChangeEvent=()=>{this.calciteSelectChange.emit()},this.disabled=!1,this.form=void 0,this.label=void 0,this.name=void 0,this.required=!1,this.scale="m",this.value=null,this.selectedOption=void 0,this.width="auto"}valueHandler(e){this.el.querySelectorAll("calcite-option").forEach(i=>i.selected=i.value===e)}selectedOptionHandler(e){this.value=e==null?void 0:e.value}connectedCallback(){var t;const{el:e}=this;(t=this.mutationObserver)==null||t.observe(e,{subtree:!0,childList:!0}),g(this),x(this),u(this)}disconnectedCallback(){var e;(e=this.mutationObserver)==null||e.disconnect(),E(this),w(this),f(this)}componentWillLoad(){S(this)}componentDidLoad(){var e;y(this),b(this,((e=this.selectedOption)==null?void 0:e.value)??"")}componentDidRender(){C(this)}async setFocus(){await I(this),m(this.selectEl)}handleOptionOrGroupChange(e){e.stopPropagation();const t=e.target,i=this.componentToNativeEl.get(t);i&&(this.updateNativeElement(t,i),c(t)&&t.selected&&(this.deselectAllExcept(t),this.selectedOption=t))}onLabelClick(){this.setFocus()}updateNativeElement(e,t){if(t.disabled=e.disabled,t.label=e.label,c(e)){const i=t;i.selected=e.selected,i.value=e.value,i.innerText=e.label}}clearInternalSelect(){this.componentToNativeEl.forEach(e=>e.remove()),this.componentToNativeEl.clear()}selectFromNativeOption(e){if(!e)return;let t;this.componentToNativeEl.forEach((i,n)=>{c(n)&&i===e&&(n.selected=!0,t=n,this.deselectAllExcept(n))}),t&&(this.selectedOption=t)}toNativeElement(e){if(c(e)){const t=document.createElement("option");return this.updateNativeElement(e,t),this.componentToNativeEl.set(e,t),t}if(A(e)){const t=document.createElement("optgroup");return this.updateNativeElement(e,t),Array.from(e.children).forEach(i=>{const n=this.toNativeElement(i);t.append(n),this.componentToNativeEl.set(e,n)}),this.componentToNativeEl.set(e,t),t}throw new Error("unsupported element child provided")}deselectAllExcept(e){this.el.querySelectorAll("calcite-option").forEach(t=>{t!==e&&(t.selected=!1)})}renderChevron(){return s("div",{class:a.iconContainer},s("calcite-icon",{class:a.icon,icon:"chevron-down",scale:T(this.scale)}))}render(){return s(p,null,s("select",{"aria-label":N(this),class:a.select,disabled:this.disabled,onChange:this.handleInternalSelectChange,ref:this.storeSelectRef},s("slot",null)),this.renderChevron(),s(v,{component:this}))}get el(){return this}static get watchers(){return{value:["valueHandler"],selectedOption:["selectedOptionHandler"]}}static get style(){return O}},[1,"calcite-select",{disabled:[516],form:[513],label:[1],name:[513],required:[516],scale:[513],value:[1025],selectedOption:[1040],width:[513],setFocus:[64]},[[0,"calciteInternalOptionChange","handleOptionOrGroupChange"],[0,"calciteInternalOptionGroupChange","handleOptionOrGroupChange"]]]);function o(){if(typeof customElements>"u")return;["calcite-select","calcite-icon"].forEach(t=>{switch(t){case"calcite-select":customElements.get(t)||customElements.define(t,l);break;case"calcite-icon":customElements.get(t)||k();break}})}o();const U=l,$=o;export{U as CalciteSelect,$ as defineCustomElement}; diff --git a/dist/assets/calcite-slider--uw2bYfU.js b/dist/assets/calcite-slider-czDRxbAt.js similarity index 97% rename from dist/assets/calcite-slider--uw2bYfU.js rename to dist/assets/calcite-slider-czDRxbAt.js index 6e8a605..948f281 100644 --- a/dist/assets/calcite-slider--uw2bYfU.js +++ b/dist/assets/calcite-slider-czDRxbAt.js @@ -1,4 +1,4 @@ -import{q as C,H as F,cn as G,t as s,r as S,B as _,x as W,kp as P}from"./index-J0iiHjMT.js";import{g as B}from"./guid-6vN-YNJI.js";import{c as Y,d as Z,a as K,H as J}from"./form-2Iq0hI3D.js";import{c as N,d as Q,u as ee}from"./interactive-NKzPUNL4.js";import{i as te}from"./key-qdHumIlA.js";import{c as ae,d as ie,g as se}from"./label2-d2vWQ7x7.js";import{s as ne,a as le,c as re}from"./loadable-sxY2K1G3.js";import{n as z,c as oe,d as he}from"./locale-pfkq1d6A.js";import{d as w,c as ce}from"./math-SoUQJWjz.js";import{c as de}from"./observers-JyBmMU24.js";/*! +import{p as C,H as F,aY as G,k as s,d as S,m as _,l as W,kx as P}from"./index-pCX-0tJH.js";import{g as B}from"./guid-6vN-YNJI.js";import{c as Y,d as Z,a as K,H as J}from"./form-1U5Kiwxm.js";import{c as N,d as Q,u as ee}from"./interactive-9W9APeiw.js";import{i as te}from"./key-qdHumIlA.js";import{c as ae,d as ie,g as se}from"./label2-JXqLMBYY.js";import{s as ne,a as le,c as re}from"./loadable-uNbe2Ndt.js";import{n as z,c as oe,d as he}from"./locale-tKMV0J87.js";import{d as w,c as ce}from"./math-SoUQJWjz.js";import{c as de}from"./observers-eNe735aq.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 @@ -36,4 +36,4 @@ import{q as C,H as F,cn as G,t as s,r as S,B as _,x as W,kp as P}from"./index-J0 1 ) ) - )}.thumb:focus .handle-extension{background-color:var(--calcite-ui-brand)}.thumb.thumb--minValue{transform:translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset))}.thumb.thumb--precise{--calcite-slider-thumb-y-offset:-0.125rem}:host([label-handles]) .thumb{--calcite-slider-thumb-x-offset:50%}:host([label-handles]):host(:not([has-histogram])) .scale--s .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-1.4375rem}:host([label-handles]):host(:not([has-histogram])) .scale--m .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-1.875rem}:host([label-handles]):host(:not([has-histogram])) .scale--l .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-2rem}:host([has-histogram][label-handles]) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--minValue.thumb--precise .handle__label{margin-block-start:0.5em}:host(:not([has-histogram]):not([precise])) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--value .handle__label{margin-block-end:0.5em}:host([label-handles][precise]):host(:not([has-histogram])) .scale--s .thumb--value{--calcite-slider-thumb-y-offset:-2.075rem}:host([label-handles][precise]):host(:not([has-histogram])) .scale--m .thumb--value{--calcite-slider-thumb-y-offset:-2.75rem}:host([label-handles][precise]):host(:not([has-histogram])) .scale--l .thumb--value{--calcite-slider-thumb-y-offset:-3.0625rem}.thumb:focus .handle,.thumb--active .handle{background-color:var(--calcite-ui-brand);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.16)}.thumb:hover.thumb--precise:after,.thumb:focus.thumb--precise:after,.thumb--active.thumb--precise:after{background-color:var(--calcite-ui-brand)}.track{position:relative;block-size:0.125rem;border-radius:0px;background-color:var(--calcite-ui-border-2);transition:all var(--calcite-internal-animation-timing-medium) ease-in}.track__range{position:absolute;inset-block-start:0px;block-size:0.125rem;background-color:var(--calcite-ui-brand)}.container--range .track__range:hover{cursor:ew-resize}.container--range .track__range:after{position:absolute;inline-size:100%;content:"";inset-block-start:calc(var(--calcite-slider-full-handle-height) * 0.5 * -1);block-size:calc(var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height))}@media (forced-colors: active){.thumb{outline-width:0;outline-offset:0}.handle{outline:2px solid transparent;outline-offset:2px}.thumb:focus .handle,.thumb .handle-extension,.thumb:hover .handle-extension,.thumb:focus .handle-extension,.thumb:active .handle-extension{background-color:canvasText}.track{background-color:canvasText}.track__range{background-color:highlight}}.tick{position:absolute;block-size:0.25rem;inline-size:0.125rem;border-width:1px;border-style:solid;background-color:var(--calcite-ui-border-input);border-color:var(--calcite-ui-foreground-1);inset-block-start:-2px;pointer-events:none;margin-inline-start:calc(-1 * 0.125rem)}.tick--active{background-color:var(--calcite-ui-brand)}.tick__label{pointer-events:none;margin-block-start:0.875rem;display:flex;justify-content:center}.tick__label--min{transition:opacity var(--calcite-animation-timing)}.tick__label--max{transition:opacity var(--calcite-internal-animation-timing-fast)}:host([has-histogram][label-handles]) .tick__label--min,:host([has-histogram][label-handles]) .tick__label--max,:host([has-histogram][precise]) .tick__label--min,:host([has-histogram][precise]) .tick__label--max{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}.graph{color:var(--calcite-ui-foreground-3);block-size:48px}:host([label-ticks][ticks]) .container{padding-block-end:calc(0.875rem + var(--calcite-slider-container-font-size))}:host([has-histogram]):host([precise][label-handles]) .container{padding-block-end:calc(var(--calcite-slider-full-handle-height) + 1em)}:host([has-histogram]):host([label-handles]:not([precise])) .container{padding-block-end:calc(var(--calcite-slider-handle-size) * 0.5 + 1em)}:host([has-histogram]):host([precise]:not([label-handles])) .container{padding-block-end:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container{padding-block-start:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container--range{padding-block-end:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([label-handles]:not([precise])) .container{padding-block-start:calc(var(--calcite-slider-full-handle-height) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container{padding-block-start:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container--range{padding-block-end:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}`;function V(e){return Array.isArray(e)}const E=C(class extends F{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteSliderInput=S(this,"calciteSliderInput",6),this.calciteSliderChange=S(this,"calciteSliderChange",6),this.activeProp="value",this.guid=`calcite-slider-${B()}`,this.dragUpdate=e=>{if(!this.disabled&&(e.preventDefault(),this.dragProp)){const t=this.translate(e.clientX||e.pageX);if(V(this.value)&&this.dragProp==="minMaxValue")if(this.minValueDragRange&&this.maxValueDragRange&&this.minMaxValueRange){const i=t-this.minValueDragRange,a=t+this.maxValueDragRange;a<=this.max&&i>=this.min&&a-i===this.minMaxValueRange&&this.setValue({minValue:this.clamp(i,"minValue"),maxValue:this.clamp(a,"maxValue")})}else this.minValueDragRange=t-this.minValue,this.maxValueDragRange=this.maxValue-t,this.minMaxValueRange=this.maxValue-this.minValue;else this.setValue({[this.dragProp]:this.clamp(t,this.dragProp)})}},this.pointerUpDragEnd=e=>{this.disabled||!_(e)||this.dragEnd(e)},this.dragEnd=e=>{this.disabled||(this.removeDragListeners(),this.focusActiveHandle(e.clientX),this.lastDragPropValue!=this[this.dragProp]&&this.emitChange(),this.dragProp=null,this.lastDragPropValue=null,this.minValueDragRange=null,this.maxValueDragRange=null,this.minMaxValueRange=null)},this.storeTrackRef=e=>{this.trackEl=e},this.determineGroupSeparator=e=>{if(typeof e=="number")return z.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,useGrouping:this.groupSeparator},z.localize(e.toString())},this.disabled=!1,this.form=void 0,this.groupSeparator=!1,this.hasHistogram=!1,this.histogram=void 0,this.histogramStops=void 0,this.labelHandles=!1,this.labelTicks=!1,this.max=100,this.maxLabel=void 0,this.maxValue=void 0,this.min=0,this.minLabel=void 0,this.minValue=void 0,this.mirrored=!1,this.name=void 0,this.numberingSystem=void 0,this.pageStep=void 0,this.precise=!1,this.required=!1,this.snap=!1,this.step=1,this.ticks=void 0,this.value=0,this.scale="m",this.effectiveLocale="",this.minMaxValueRange=null,this.minValueDragRange=null,this.maxValueDragRange=null,this.tickValues=[]}histogramWatcher(e){this.hasHistogram=!!e}ticksWatcher(){this.tickValues=this.generateTickValues()}valueHandler(){this.setMinMaxFromValue()}minMaxValueHandler(){this.setValueFromMinMax()}connectedCallback(){N(this),oe(this),this.setMinMaxFromValue(),this.setValueFromMinMax(),ae(this),Y(this)}disconnectedCallback(){Q(this),ie(this),Z(this),he(this),this.removeDragListeners()}componentWillLoad(){ne(this),V(this.value)||(this.value=this.snap?this.getClosestStep(this.value):this.clamp(this.value)),this.ticksWatcher(),this.histogramWatcher(this.histogram),K(this,this.value)}componentDidLoad(){le(this)}componentDidRender(){this.labelHandles&&(this.adjustHostObscuredHandleLabel("value"),V(this.value)&&(this.adjustHostObscuredHandleLabel("minValue"),this.precise&&!this.hasHistogram||this.hyphenateCollidingRangeHandleLabels())),this.hideObscuredBoundingTickLabels(),ee(this)}render(){const e=this.el.id||this.guid,t=V(this.value)?"maxValue":"value",i=V(this.value)?this.maxValue:this.value,a=this.determineGroupSeparator(i),n=this.determineGroupSeparator(this.minValue),h=this.minValue||this.min,d=this.shouldUseMinValue(),r=this.getUnitInterval(d?this.minValue:h)*100,o=this.getUnitInterval(i)*100,c=this.shouldMirror(),m=`${c?100-r:r}%`,u=`${c?o:100-o}%`,p=V(this.value),g=`${H.handleLabel} ${H.handleLabelMinValue}`,f=`${H.handleLabel} ${H.handleLabelValue}`,v=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("div",{class:"handle"})),b=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("span",{"aria-hidden":"true",class:f},a),s("span",{"aria-hidden":"true",class:`${f} static`},a),s("span",{"aria-hidden":"true",class:`${f} transformed`},a),s("div",{class:"handle"})),k=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("div",{class:"handle"}),s("span",{"aria-hidden":"true",class:f},a),s("span",{"aria-hidden":"true",class:`${f} static`},a),s("span",{"aria-hidden":"true",class:`${f} transformed`},a)),x=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t,"thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("div",{class:"handle"}),s("div",{class:"handle-extension"})),y=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t,"thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("div",{class:"handle-extension"}),s("div",{class:"handle"})),L=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t,"thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("span",{"aria-hidden":"true",class:f},a),s("span",{"aria-hidden":"true",class:`${f} static`},a),s("span",{"aria-hidden":"true",class:`${f} transformed`},a),s("div",{class:"handle"}),s("div",{class:"handle-extension"})),M=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t,"thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("div",{class:"handle-extension"}),s("div",{class:"handle"}),s("span",{"aria-hidden":"true",class:f},a),s("span",{"aria-hidden":"true",class:`${f} static`},a),s("span",{"aria-hidden":"true",class:`${f} transformed`},a)),X=s("div",{"aria-disabled":this.disabled,"aria-label":this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":this.minValue,class:{thumb:!0,"thumb--minValue":!0,"thumb--active":this.dragProp==="minValue"},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp="minValue",onPointerDown:l=>this.pointerDownDragStart(l,"minValue"),role:"slider",style:{left:m},tabIndex:0,ref:l=>this.minHandle=l},s("div",{class:"handle"})),q=s("div",{"aria-disabled":this.disabled,"aria-label":this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":this.minValue,class:{thumb:!0,"thumb--minValue":!0,"thumb--active":this.dragProp==="minValue"},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp="minValue",onPointerDown:l=>this.pointerDownDragStart(l,"minValue"),role:"slider",style:{left:m},tabIndex:0,ref:l=>this.minHandle=l},s("span",{"aria-hidden":"true",class:g},n),s("span",{"aria-hidden":"true",class:`${g} static`},n),s("span",{"aria-hidden":"true",class:`${g} transformed`},n),s("div",{class:"handle"})),A=s("div",{"aria-disabled":this.disabled,"aria-label":this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":this.minValue,class:{thumb:!0,"thumb--minValue":!0,"thumb--active":this.dragProp==="minValue"},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp="minValue",onPointerDown:l=>this.pointerDownDragStart(l,"minValue"),role:"slider",style:{left:m},tabIndex:0,ref:l=>this.minHandle=l},s("div",{class:"handle"}),s("span",{"aria-hidden":"true",class:g},n),s("span",{"aria-hidden":"true",class:`${g} static`},n),s("span",{"aria-hidden":"true",class:`${g} transformed`},n)),U=s("div",{"aria-disabled":this.disabled,"aria-label":this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":this.minValue,class:{thumb:!0,"thumb--minValue":!0,"thumb--active":this.dragProp==="minValue","thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp="minValue",onPointerDown:l=>this.pointerDownDragStart(l,"minValue"),role:"slider",style:{left:m},tabIndex:0,ref:l=>this.minHandle=l},s("div",{class:"handle-extension"}),s("div",{class:"handle"})),j=s("div",{"aria-disabled":this.disabled,"aria-label":this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":this.minValue,class:{thumb:!0,"thumb--minValue":!0,"thumb--active":this.dragProp==="minValue","thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp="minValue",onPointerDown:l=>this.pointerDownDragStart(l,"minValue"),role:"slider",style:{left:m},tabIndex:0,ref:l=>this.minHandle=l},s("div",{class:"handle-extension"}),s("div",{class:"handle"}),s("span",{"aria-hidden":"true",class:g},n),s("span",{"aria-hidden":"true",class:`${g} static`},n),s("span",{"aria-hidden":"true",class:`${g} transformed`},n));return s(W,{id:e,onTouchStart:this.handleTouchStart},s("div",{"aria-label":se(this),class:{container:!0,"container--range":p,[`scale--${this.scale}`]:!0}},this.renderGraph(),s("div",{class:"track",ref:this.storeTrackRef},s("div",{class:"track__range",onPointerDown:l=>this.pointerDownDragStart(l,"minMaxValue"),style:{left:`${c?100-o:r}%`,right:`${c?r:100-o}%`}}),s("div",{class:"ticks"},this.tickValues.map(l=>{const $=`${this.getUnitInterval(l)*100}%`;let D=l>=h&&l<=i;return d&&(D=l>=this.minValue&&l<=this.maxValue),s("span",{class:{tick:!0,"tick--active":D},style:{left:c?"":$,right:c?$:""}},this.renderTickLabel(l))}))),s("div",{class:"thumb-container"},!this.precise&&!this.labelHandles&&p&&X,!this.hasHistogram&&!this.precise&&this.labelHandles&&p&&q,this.precise&&!this.labelHandles&&p&&U,this.precise&&this.labelHandles&&p&&j,this.hasHistogram&&!this.precise&&this.labelHandles&&p&&A,!this.precise&&!this.labelHandles&&v,!this.hasHistogram&&!this.precise&&this.labelHandles&&b,!this.hasHistogram&&this.precise&&!this.labelHandles&&x,this.hasHistogram&&this.precise&&!this.labelHandles&&y,!this.hasHistogram&&this.precise&&this.labelHandles&&L,this.hasHistogram&&!this.precise&&this.labelHandles&&k,this.hasHistogram&&this.precise&&this.labelHandles&&M,s(J,{component:this}))))}renderGraph(){return this.histogram?s("calcite-graph",{class:"graph",colorStops:this.histogramStops,data:this.histogram,highlightMax:V(this.value)?this.maxValue:this.value,highlightMin:V(this.value)?this.minValue:this.min,max:this.max,min:this.min}):null}renderTickLabel(e){const t=V(this.value),i=e===this.min,a=e===this.max,n=this.determineGroupSeparator(e),h=s("span",{class:{tick__label:!0,[H.tickMin]:i,[H.tickMax]:a}},n);return this.labelTicks&&!this.hasHistogram&&!t||this.labelTicks&&!this.hasHistogram&&t&&!this.precise&&!this.labelHandles||this.labelTicks&&!this.hasHistogram&&t&&!this.precise&&this.labelHandles||this.labelTicks&&!this.hasHistogram&&t&&this.precise&&(i||a)||this.labelTicks&&this.hasHistogram&&!this.precise&&!this.labelHandles||this.labelTicks&&this.hasHistogram&&this.precise&&!this.labelHandles&&(i||a)||this.labelTicks&&this.hasHistogram&&!this.precise&&this.labelHandles&&(i||a)||this.labelTicks&&this.hasHistogram&&this.precise&&this.labelHandles&&(i||a)?h:null}keyDownHandler(e){const t=this.shouldMirror(),{activeProp:i,max:a,min:n,pageStep:h,step:d}=this,r=this[i],{key:o}=e;if(te(o)){e.preventDefault();return}let c;if(o==="ArrowUp"||o==="ArrowRight"?c=r+d*(t&&o==="ArrowRight"?-1:1):o==="ArrowDown"||o==="ArrowLeft"?c=r-d*(t&&o==="ArrowLeft"?-1:1):o==="PageUp"?h&&(c=r+h):o==="PageDown"?h&&(c=r-h):o==="Home"?c=n:o==="End"&&(c=a),isNaN(c))return;e.preventDefault();const m=Number(c.toFixed(w(d)));this.setValue({[i]:this.clamp(m,i)})}pointerDownHandler(e){if(this.disabled||!_(e))return;const t=e.clientX||e.pageX,i=this.translate(t);let a="value";V(this.value)&&(i>=this.minValue&&i<=this.maxValue&&this.lastDragProp==="minMaxValue"?a="minMaxValue":a=Math.abs(this.maxValue-i)this.maxValue?"maxValue":"minValue"),this.lastDragPropValue=this[a],this.dragStart(a),this.el.shadowRoot.querySelector(".thumb:active")||this.setValue({[a]:this.clamp(i,a)}),this.focusActiveHandle(t)}handleTouchStart(e){e.preventDefault()}async setFocus(){await re(this);const e=this.minHandle?this.minHandle:this.maxHandle;e==null||e.focus()}setValueFromMinMax(){const{minValue:e,maxValue:t}=this;typeof e=="number"&&typeof t=="number"&&(this.value=[e,t])}setMinMaxFromValue(){const{value:e}=this;V(e)&&(this.minValue=e[0],this.maxValue=e[1])}onLabelClick(){this.setFocus()}shouldMirror(){return this.mirrored&&!this.hasHistogram}shouldUseMinValue(){return V(this.value)?this.hasHistogram&&this.maxValue===0||!this.hasHistogram&&this.minValue===0:!1}getTickDensity(){const e=(this.max-this.min)/this.ticks/ve;return e<1?1:e}generateTickValues(){const e=this.ticks??0;if(e<=0)return[];const t=[this.min],i=this.getTickDensity(),a=e*i;let n=this.min;for(;n{const n=e[a];t||(t=this[a]!==n),this[a]=n}),!t)return;this.dragProp||this.emitChange(),this.emitInput()}clamp(e,t){return e=ce(e,this.min,this.max),t==="maxValue"&&(e=Math.max(e,this.minValue)),t==="minValue"&&(e=Math.min(e,this.maxValue)),e}translate(e){const t=this.max-this.min,{left:i,width:a}=this.trackEl.getBoundingClientRect(),n=(e-i)/a,h=this.shouldMirror(),d=this.clamp(this.min+t*(h?1-n:n));let r=Number(d.toFixed(w(this.step)));return this.snap&&this.step&&(r=this.getClosestStep(r)),r}getClosestStep(e){if(e=Number(this.clamp(e).toFixed(w(this.step))),this.step){const t=Math.round(e/this.step)*this.step;e=Number(this.clamp(t).toFixed(w(this.step)))}return e}getClosestHandle(e){return this.getDistanceX(this.maxHandle,e)>this.getDistanceX(this.minHandle,e)?this.minHandle:this.maxHandle}getDistanceX(e,t){return Math.abs(e.getBoundingClientRect().left-t)}getFontSizeForElement(e){return Number(window.getComputedStyle(e).getPropertyValue("font-size").match(/\d+/)[0])}getUnitInterval(e){e=this.clamp(e);const t=this.max-this.min;return(e-this.min)/t}adjustHostObscuredHandleLabel(e){const t=this.el.shadowRoot.querySelector(`.handle__label--${e}`),i=this.el.shadowRoot.querySelector(`.handle__label--${e}.static`),a=this.el.shadowRoot.querySelector(`.handle__label--${e}.transformed`),n=i.getBoundingClientRect(),h=this.getHostOffset(n.left,n.right);t.style.transform=`translateX(${h}px)`,a.style.transform=`translateX(${h}px)`}hyphenateCollidingRangeHandleLabels(){const{shadowRoot:e}=this.el,t=this.shouldMirror(),i=t?"value":"minValue",a=t?"minValue":"value",n=e.querySelector(`.handle__label--${i}`),h=e.querySelector(`.handle__label--${i}.static`),d=e.querySelector(`.handle__label--${i}.transformed`),r=this.getHostOffset(h.getBoundingClientRect().left,h.getBoundingClientRect().right),o=e.querySelector(`.handle__label--${a}`),c=e.querySelector(`.handle__label--${a}.static`),m=e.querySelector(`.handle__label--${a}.transformed`),u=this.getHostOffset(c.getBoundingClientRect().left,c.getBoundingClientRect().right),p=this.getFontSizeForElement(n),g=this.getRangeLabelOverlap(d,m),f=n,v=p/2;if(g>0){if(f.classList.add("hyphen","hyphen--wrap"),u===0&&r===0){let b=g/2-v;b=Math.sign(b)===-1?Math.abs(b):-b;const k=this.getHostOffset(d.getBoundingClientRect().left+b-v,d.getBoundingClientRect().right+b-v);let x=g/2;const y=this.getHostOffset(m.getBoundingClientRect().left+x,m.getBoundingClientRect().right+x);k!==0&&(b+=k,x+=k),y!==0&&(b+=y,x+=y),n.style.transform=`translateX(${b}px)`,d.style.transform=`translateX(${b-v}px)`,o.style.transform=`translateX(${x}px)`,m.style.transform=`translateX(${x}px)`}else if(r>0||u>0)n.style.transform=`translateX(${r+v}px)`,o.style.transform=`translateX(${g+u}px)`,m.style.transform=`translateX(${g+u}px)`;else if(r<0||u<0){let b=Math.abs(r)+g-v;b=Math.sign(b)===-1?Math.abs(b):-b,n.style.transform=`translateX(${b}px)`,d.style.transform=`translateX(${b-v}px)`}}else f.classList.remove("hyphen","hyphen--wrap"),n.style.transform=`translateX(${r}px)`,d.style.transform=`translateX(${r}px)`,o.style.transform=`translateX(${u}px)`,m.style.transform=`translateX(${u}px)`}hideObscuredBoundingTickLabels(){const e=V(this.value);if(!this.hasHistogram&&!e&&!this.labelHandles&&!this.precise||!this.hasHistogram&&!e&&this.labelHandles&&!this.precise||!this.hasHistogram&&!e&&!this.labelHandles&&this.precise||!this.hasHistogram&&!e&&this.labelHandles&&this.precise||!this.hasHistogram&&e&&!this.precise||this.hasHistogram&&!this.precise&&!this.labelHandles)return;const t=this.el.shadowRoot.querySelector(".thumb--minValue"),i=this.el.shadowRoot.querySelector(".thumb--value"),a=this.el.shadowRoot.querySelector(".tick__label--min"),n=this.el.shadowRoot.querySelector(".tick__label--max");!t&&i&&a&&n&&(a.style.opacity=this.isMinTickLabelObscured(a,i)?"0":"1",n.style.opacity=this.isMaxTickLabelObscured(n,i)?"0":"1"),t&&i&&a&&n&&(a.style.opacity=this.isMinTickLabelObscured(a,t)||this.isMinTickLabelObscured(a,i)?"0":"1",n.style.opacity=this.isMaxTickLabelObscured(n,t)||this.isMaxTickLabelObscured(n,i)&&this.hasHistogram?"0":"1")}getHostOffset(e,t){const i=this.el.getBoundingClientRect(),a=7;return e+ai.right?-(t-i.right)+a:0}getRangeLabelOverlap(e,t){const i=e.getBoundingClientRect(),a=t.getBoundingClientRect(),n=this.getFontSizeForElement(e),h=i.right+n-a.left;return Math.max(h,0)}isMinTickLabelObscured(e,t){const i=e.getBoundingClientRect(),a=t.getBoundingClientRect();return P(i,a)}isMaxTickLabelObscured(e,t){const i=e.getBoundingClientRect(),a=t.getBoundingClientRect();return P(i,a)}static get delegatesFocus(){return!0}get el(){return this}static get watchers(){return{histogram:["histogramWatcher"],ticks:["ticksWatcher"],value:["valueHandler"],minValue:["minMaxValueHandler"],maxValue:["minMaxValueHandler"]}}static get style(){return xe}},[17,"calcite-slider",{disabled:[516],form:[513],groupSeparator:[516,"group-separator"],hasHistogram:[1540,"has-histogram"],histogram:[16],histogramStops:[16],labelHandles:[516,"label-handles"],labelTicks:[516,"label-ticks"],max:[514],maxLabel:[1,"max-label"],maxValue:[1026,"max-value"],min:[514],minLabel:[1,"min-label"],minValue:[1026,"min-value"],mirrored:[516],name:[513],numberingSystem:[1,"numbering-system"],pageStep:[514,"page-step"],precise:[516],required:[516],snap:[516],step:[514],ticks:[514],value:[1538],scale:[513],effectiveLocale:[32],minMaxValueRange:[32],minValueDragRange:[32],maxValueDragRange:[32],tickValues:[32],setFocus:[64]},[[0,"keydown","keyDownHandler"],[1,"pointerdown","pointerDownHandler"]]]);function I(){if(typeof customElements>"u")return;["calcite-slider","calcite-graph"].forEach(t=>{switch(t){case"calcite-slider":customElements.get(t)||customElements.define(t,E);break;case"calcite-graph":customElements.get(t)||O();break}})}I();const Se=E,Pe=I;export{Se as CalciteSlider,Pe as defineCustomElement}; + )}.thumb:focus .handle-extension{background-color:var(--calcite-ui-brand)}.thumb.thumb--minValue{transform:translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset))}.thumb.thumb--precise{--calcite-slider-thumb-y-offset:-0.125rem}:host([label-handles]) .thumb{--calcite-slider-thumb-x-offset:50%}:host([label-handles]):host(:not([has-histogram])) .scale--s .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-1.4375rem}:host([label-handles]):host(:not([has-histogram])) .scale--m .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-1.875rem}:host([label-handles]):host(:not([has-histogram])) .scale--l .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-2rem}:host([has-histogram][label-handles]) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--minValue.thumb--precise .handle__label{margin-block-start:0.5em}:host(:not([has-histogram]):not([precise])) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--value .handle__label{margin-block-end:0.5em}:host([label-handles][precise]):host(:not([has-histogram])) .scale--s .thumb--value{--calcite-slider-thumb-y-offset:-2.075rem}:host([label-handles][precise]):host(:not([has-histogram])) .scale--m .thumb--value{--calcite-slider-thumb-y-offset:-2.75rem}:host([label-handles][precise]):host(:not([has-histogram])) .scale--l .thumb--value{--calcite-slider-thumb-y-offset:-3.0625rem}.thumb:focus .handle,.thumb--active .handle{background-color:var(--calcite-ui-brand);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.16)}.thumb:hover.thumb--precise:after,.thumb:focus.thumb--precise:after,.thumb--active.thumb--precise:after{background-color:var(--calcite-ui-brand)}.track{position:relative;block-size:0.125rem;border-radius:0px;background-color:var(--calcite-ui-border-2);transition:all var(--calcite-internal-animation-timing-medium) ease-in}.track__range{position:absolute;inset-block-start:0px;block-size:0.125rem;background-color:var(--calcite-ui-brand)}.container--range .track__range:hover{cursor:ew-resize}.container--range .track__range:after{position:absolute;inline-size:100%;content:"";inset-block-start:calc(var(--calcite-slider-full-handle-height) * 0.5 * -1);block-size:calc(var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height))}@media (forced-colors: active){.thumb{outline-width:0;outline-offset:0}.handle{outline:2px solid transparent;outline-offset:2px}.thumb:focus .handle,.thumb .handle-extension,.thumb:hover .handle-extension,.thumb:focus .handle-extension,.thumb:active .handle-extension{background-color:canvasText}.track{background-color:canvasText}.track__range{background-color:highlight}}.tick{position:absolute;block-size:0.25rem;inline-size:0.125rem;border-width:1px;border-style:solid;background-color:var(--calcite-ui-border-input);border-color:var(--calcite-ui-foreground-1);inset-block-start:-2px;pointer-events:none;margin-inline-start:calc(-1 * 0.125rem)}.tick--active{background-color:var(--calcite-ui-brand)}.tick__label{pointer-events:none;margin-block-start:0.875rem;display:flex;justify-content:center}.tick__label--min{transition:opacity var(--calcite-animation-timing)}.tick__label--max{transition:opacity var(--calcite-internal-animation-timing-fast)}:host([has-histogram][label-handles]) .tick__label--min,:host([has-histogram][label-handles]) .tick__label--max,:host([has-histogram][precise]) .tick__label--min,:host([has-histogram][precise]) .tick__label--max{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}.graph{color:var(--calcite-ui-foreground-3);block-size:48px}:host([label-ticks][ticks]) .container{padding-block-end:calc(0.875rem + var(--calcite-slider-container-font-size))}:host([has-histogram]):host([precise][label-handles]) .container{padding-block-end:calc(var(--calcite-slider-full-handle-height) + 1em)}:host([has-histogram]):host([label-handles]:not([precise])) .container{padding-block-end:calc(var(--calcite-slider-handle-size) * 0.5 + 1em)}:host([has-histogram]):host([precise]:not([label-handles])) .container{padding-block-end:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container{padding-block-start:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container--range{padding-block-end:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([label-handles]:not([precise])) .container{padding-block-start:calc(var(--calcite-slider-full-handle-height) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container{padding-block-start:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container--range{padding-block-end:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}`;function V(e){return Array.isArray(e)}const E=C(class extends F{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteSliderInput=S(this,"calciteSliderInput",6),this.calciteSliderChange=S(this,"calciteSliderChange",6),this.activeProp="value",this.guid=`calcite-slider-${B()}`,this.dragUpdate=e=>{if(!this.disabled&&(e.preventDefault(),this.dragProp)){const t=this.translate(e.clientX||e.pageX);if(V(this.value)&&this.dragProp==="minMaxValue")if(this.minValueDragRange&&this.maxValueDragRange&&this.minMaxValueRange){const i=t-this.minValueDragRange,a=t+this.maxValueDragRange;a<=this.max&&i>=this.min&&a-i===this.minMaxValueRange&&this.setValue({minValue:this.clamp(i,"minValue"),maxValue:this.clamp(a,"maxValue")})}else this.minValueDragRange=t-this.minValue,this.maxValueDragRange=this.maxValue-t,this.minMaxValueRange=this.maxValue-this.minValue;else this.setValue({[this.dragProp]:this.clamp(t,this.dragProp)})}},this.pointerUpDragEnd=e=>{this.disabled||!_(e)||this.dragEnd(e)},this.dragEnd=e=>{this.disabled||(this.removeDragListeners(),this.focusActiveHandle(e.clientX),this.lastDragPropValue!=this[this.dragProp]&&this.emitChange(),this.dragProp=null,this.lastDragPropValue=null,this.minValueDragRange=null,this.maxValueDragRange=null,this.minMaxValueRange=null)},this.storeTrackRef=e=>{this.trackEl=e},this.determineGroupSeparator=e=>{if(typeof e=="number")return z.numberFormatOptions={locale:this.effectiveLocale,numberingSystem:this.numberingSystem,useGrouping:this.groupSeparator},z.localize(e.toString())},this.disabled=!1,this.form=void 0,this.groupSeparator=!1,this.hasHistogram=!1,this.histogram=void 0,this.histogramStops=void 0,this.labelHandles=!1,this.labelTicks=!1,this.max=100,this.maxLabel=void 0,this.maxValue=void 0,this.min=0,this.minLabel=void 0,this.minValue=void 0,this.mirrored=!1,this.name=void 0,this.numberingSystem=void 0,this.pageStep=void 0,this.precise=!1,this.required=!1,this.snap=!1,this.step=1,this.ticks=void 0,this.value=0,this.scale="m",this.effectiveLocale="",this.minMaxValueRange=null,this.minValueDragRange=null,this.maxValueDragRange=null,this.tickValues=[]}histogramWatcher(e){this.hasHistogram=!!e}ticksWatcher(){this.tickValues=this.generateTickValues()}valueHandler(){this.setMinMaxFromValue()}minMaxValueHandler(){this.setValueFromMinMax()}connectedCallback(){N(this),oe(this),this.setMinMaxFromValue(),this.setValueFromMinMax(),ae(this),Y(this)}disconnectedCallback(){Q(this),ie(this),Z(this),he(this),this.removeDragListeners()}componentWillLoad(){ne(this),V(this.value)||(this.value=this.snap?this.getClosestStep(this.value):this.clamp(this.value)),this.ticksWatcher(),this.histogramWatcher(this.histogram),K(this,this.value)}componentDidLoad(){le(this)}componentDidRender(){this.labelHandles&&(this.adjustHostObscuredHandleLabel("value"),V(this.value)&&(this.adjustHostObscuredHandleLabel("minValue"),this.precise&&!this.hasHistogram||this.hyphenateCollidingRangeHandleLabels())),this.hideObscuredBoundingTickLabels(),ee(this)}render(){const e=this.el.id||this.guid,t=V(this.value)?"maxValue":"value",i=V(this.value)?this.maxValue:this.value,a=this.determineGroupSeparator(i),n=this.determineGroupSeparator(this.minValue),h=this.minValue||this.min,d=this.shouldUseMinValue(),r=this.getUnitInterval(d?this.minValue:h)*100,o=this.getUnitInterval(i)*100,c=this.shouldMirror(),m=`${c?100-r:r}%`,u=`${c?o:100-o}%`,p=V(this.value),g=`${H.handleLabel} ${H.handleLabelMinValue}`,f=`${H.handleLabel} ${H.handleLabelValue}`,v=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("div",{class:"handle"})),b=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("span",{"aria-hidden":"true",class:f},a),s("span",{"aria-hidden":"true",class:`${f} static`},a),s("span",{"aria-hidden":"true",class:`${f} transformed`},a),s("div",{class:"handle"})),k=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("div",{class:"handle"}),s("span",{"aria-hidden":"true",class:f},a),s("span",{"aria-hidden":"true",class:`${f} static`},a),s("span",{"aria-hidden":"true",class:`${f} transformed`},a)),x=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t,"thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("div",{class:"handle"}),s("div",{class:"handle-extension"})),y=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t,"thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("div",{class:"handle-extension"}),s("div",{class:"handle"})),L=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t,"thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("span",{"aria-hidden":"true",class:f},a),s("span",{"aria-hidden":"true",class:`${f} static`},a),s("span",{"aria-hidden":"true",class:`${f} transformed`},a),s("div",{class:"handle"}),s("div",{class:"handle-extension"})),M=s("div",{"aria-disabled":this.disabled,"aria-label":p?this.maxLabel:this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":i,class:{thumb:!0,"thumb--value":!0,"thumb--active":this.lastDragProp!=="minMaxValue"&&this.dragProp===t,"thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp=t,onPointerDown:l=>this.pointerDownDragStart(l,t),role:"slider",style:{right:u},tabIndex:0,ref:l=>this.maxHandle=l},s("div",{class:"handle-extension"}),s("div",{class:"handle"}),s("span",{"aria-hidden":"true",class:f},a),s("span",{"aria-hidden":"true",class:`${f} static`},a),s("span",{"aria-hidden":"true",class:`${f} transformed`},a)),X=s("div",{"aria-disabled":this.disabled,"aria-label":this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":this.minValue,class:{thumb:!0,"thumb--minValue":!0,"thumb--active":this.dragProp==="minValue"},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp="minValue",onPointerDown:l=>this.pointerDownDragStart(l,"minValue"),role:"slider",style:{left:m},tabIndex:0,ref:l=>this.minHandle=l},s("div",{class:"handle"})),A=s("div",{"aria-disabled":this.disabled,"aria-label":this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":this.minValue,class:{thumb:!0,"thumb--minValue":!0,"thumb--active":this.dragProp==="minValue"},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp="minValue",onPointerDown:l=>this.pointerDownDragStart(l,"minValue"),role:"slider",style:{left:m},tabIndex:0,ref:l=>this.minHandle=l},s("span",{"aria-hidden":"true",class:g},n),s("span",{"aria-hidden":"true",class:`${g} static`},n),s("span",{"aria-hidden":"true",class:`${g} transformed`},n),s("div",{class:"handle"})),U=s("div",{"aria-disabled":this.disabled,"aria-label":this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":this.minValue,class:{thumb:!0,"thumb--minValue":!0,"thumb--active":this.dragProp==="minValue"},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp="minValue",onPointerDown:l=>this.pointerDownDragStart(l,"minValue"),role:"slider",style:{left:m},tabIndex:0,ref:l=>this.minHandle=l},s("div",{class:"handle"}),s("span",{"aria-hidden":"true",class:g},n),s("span",{"aria-hidden":"true",class:`${g} static`},n),s("span",{"aria-hidden":"true",class:`${g} transformed`},n)),q=s("div",{"aria-disabled":this.disabled,"aria-label":this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":this.minValue,class:{thumb:!0,"thumb--minValue":!0,"thumb--active":this.dragProp==="minValue","thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp="minValue",onPointerDown:l=>this.pointerDownDragStart(l,"minValue"),role:"slider",style:{left:m},tabIndex:0,ref:l=>this.minHandle=l},s("div",{class:"handle-extension"}),s("div",{class:"handle"})),j=s("div",{"aria-disabled":this.disabled,"aria-label":this.minLabel,"aria-orientation":"horizontal","aria-valuemax":this.max,"aria-valuemin":this.min,"aria-valuenow":this.minValue,class:{thumb:!0,"thumb--minValue":!0,"thumb--active":this.dragProp==="minValue","thumb--precise":!0},onBlur:()=>this.activeProp=null,onFocus:()=>this.activeProp="minValue",onPointerDown:l=>this.pointerDownDragStart(l,"minValue"),role:"slider",style:{left:m},tabIndex:0,ref:l=>this.minHandle=l},s("div",{class:"handle-extension"}),s("div",{class:"handle"}),s("span",{"aria-hidden":"true",class:g},n),s("span",{"aria-hidden":"true",class:`${g} static`},n),s("span",{"aria-hidden":"true",class:`${g} transformed`},n));return s(W,{id:e,onTouchStart:this.handleTouchStart},s("div",{"aria-label":se(this),class:{container:!0,"container--range":p,[`scale--${this.scale}`]:!0}},this.renderGraph(),s("div",{class:"track",ref:this.storeTrackRef},s("div",{class:"track__range",onPointerDown:l=>this.pointerDownDragStart(l,"minMaxValue"),style:{left:`${c?100-o:r}%`,right:`${c?r:100-o}%`}}),s("div",{class:"ticks"},this.tickValues.map(l=>{const $=`${this.getUnitInterval(l)*100}%`;let D=l>=h&&l<=i;return d&&(D=l>=this.minValue&&l<=this.maxValue),s("span",{class:{tick:!0,"tick--active":D},style:{left:c?"":$,right:c?$:""}},this.renderTickLabel(l))}))),s("div",{class:"thumb-container"},!this.precise&&!this.labelHandles&&p&&X,!this.hasHistogram&&!this.precise&&this.labelHandles&&p&&A,this.precise&&!this.labelHandles&&p&&q,this.precise&&this.labelHandles&&p&&j,this.hasHistogram&&!this.precise&&this.labelHandles&&p&&U,!this.precise&&!this.labelHandles&&v,!this.hasHistogram&&!this.precise&&this.labelHandles&&b,!this.hasHistogram&&this.precise&&!this.labelHandles&&x,this.hasHistogram&&this.precise&&!this.labelHandles&&y,!this.hasHistogram&&this.precise&&this.labelHandles&&L,this.hasHistogram&&!this.precise&&this.labelHandles&&k,this.hasHistogram&&this.precise&&this.labelHandles&&M,s(J,{component:this}))))}renderGraph(){return this.histogram?s("calcite-graph",{class:"graph",colorStops:this.histogramStops,data:this.histogram,highlightMax:V(this.value)?this.maxValue:this.value,highlightMin:V(this.value)?this.minValue:this.min,max:this.max,min:this.min}):null}renderTickLabel(e){const t=V(this.value),i=e===this.min,a=e===this.max,n=this.determineGroupSeparator(e),h=s("span",{class:{tick__label:!0,[H.tickMin]:i,[H.tickMax]:a}},n);return this.labelTicks&&!this.hasHistogram&&!t||this.labelTicks&&!this.hasHistogram&&t&&!this.precise&&!this.labelHandles||this.labelTicks&&!this.hasHistogram&&t&&!this.precise&&this.labelHandles||this.labelTicks&&!this.hasHistogram&&t&&this.precise&&(i||a)||this.labelTicks&&this.hasHistogram&&!this.precise&&!this.labelHandles||this.labelTicks&&this.hasHistogram&&this.precise&&!this.labelHandles&&(i||a)||this.labelTicks&&this.hasHistogram&&!this.precise&&this.labelHandles&&(i||a)||this.labelTicks&&this.hasHistogram&&this.precise&&this.labelHandles&&(i||a)?h:null}keyDownHandler(e){const t=this.shouldMirror(),{activeProp:i,max:a,min:n,pageStep:h,step:d}=this,r=this[i],{key:o}=e;if(te(o)){e.preventDefault();return}let c;if(o==="ArrowUp"||o==="ArrowRight"?c=r+d*(t&&o==="ArrowRight"?-1:1):o==="ArrowDown"||o==="ArrowLeft"?c=r-d*(t&&o==="ArrowLeft"?-1:1):o==="PageUp"?h&&(c=r+h):o==="PageDown"?h&&(c=r-h):o==="Home"?c=n:o==="End"&&(c=a),isNaN(c))return;e.preventDefault();const m=Number(c.toFixed(w(d)));this.setValue({[i]:this.clamp(m,i)})}pointerDownHandler(e){if(this.disabled||!_(e))return;const t=e.clientX||e.pageX,i=this.translate(t);let a="value";V(this.value)&&(i>=this.minValue&&i<=this.maxValue&&this.lastDragProp==="minMaxValue"?a="minMaxValue":a=Math.abs(this.maxValue-i)this.maxValue?"maxValue":"minValue"),this.lastDragPropValue=this[a],this.dragStart(a),this.el.shadowRoot.querySelector(".thumb:active")||this.setValue({[a]:this.clamp(i,a)}),this.focusActiveHandle(t)}handleTouchStart(e){e.preventDefault()}async setFocus(){await re(this);const e=this.minHandle?this.minHandle:this.maxHandle;e==null||e.focus()}setValueFromMinMax(){const{minValue:e,maxValue:t}=this;typeof e=="number"&&typeof t=="number"&&(this.value=[e,t])}setMinMaxFromValue(){const{value:e}=this;V(e)&&(this.minValue=e[0],this.maxValue=e[1])}onLabelClick(){this.setFocus()}shouldMirror(){return this.mirrored&&!this.hasHistogram}shouldUseMinValue(){return V(this.value)?this.hasHistogram&&this.maxValue===0||!this.hasHistogram&&this.minValue===0:!1}getTickDensity(){const e=(this.max-this.min)/this.ticks/ve;return e<1?1:e}generateTickValues(){const e=this.ticks??0;if(e<=0)return[];const t=[this.min],i=this.getTickDensity(),a=e*i;let n=this.min;for(;n{const n=e[a];t||(t=this[a]!==n),this[a]=n}),!t)return;this.dragProp||this.emitChange(),this.emitInput()}clamp(e,t){return e=ce(e,this.min,this.max),t==="maxValue"&&(e=Math.max(e,this.minValue)),t==="minValue"&&(e=Math.min(e,this.maxValue)),e}translate(e){const t=this.max-this.min,{left:i,width:a}=this.trackEl.getBoundingClientRect(),n=(e-i)/a,h=this.shouldMirror(),d=this.clamp(this.min+t*(h?1-n:n));let r=Number(d.toFixed(w(this.step)));return this.snap&&this.step&&(r=this.getClosestStep(r)),r}getClosestStep(e){if(e=Number(this.clamp(e).toFixed(w(this.step))),this.step){const t=Math.round(e/this.step)*this.step;e=Number(this.clamp(t).toFixed(w(this.step)))}return e}getClosestHandle(e){return this.getDistanceX(this.maxHandle,e)>this.getDistanceX(this.minHandle,e)?this.minHandle:this.maxHandle}getDistanceX(e,t){return Math.abs(e.getBoundingClientRect().left-t)}getFontSizeForElement(e){return Number(window.getComputedStyle(e).getPropertyValue("font-size").match(/\d+/)[0])}getUnitInterval(e){e=this.clamp(e);const t=this.max-this.min;return(e-this.min)/t}adjustHostObscuredHandleLabel(e){const t=this.el.shadowRoot.querySelector(`.handle__label--${e}`),i=this.el.shadowRoot.querySelector(`.handle__label--${e}.static`),a=this.el.shadowRoot.querySelector(`.handle__label--${e}.transformed`),n=i.getBoundingClientRect(),h=this.getHostOffset(n.left,n.right);t.style.transform=`translateX(${h}px)`,a.style.transform=`translateX(${h}px)`}hyphenateCollidingRangeHandleLabels(){const{shadowRoot:e}=this.el,t=this.shouldMirror(),i=t?"value":"minValue",a=t?"minValue":"value",n=e.querySelector(`.handle__label--${i}`),h=e.querySelector(`.handle__label--${i}.static`),d=e.querySelector(`.handle__label--${i}.transformed`),r=this.getHostOffset(h.getBoundingClientRect().left,h.getBoundingClientRect().right),o=e.querySelector(`.handle__label--${a}`),c=e.querySelector(`.handle__label--${a}.static`),m=e.querySelector(`.handle__label--${a}.transformed`),u=this.getHostOffset(c.getBoundingClientRect().left,c.getBoundingClientRect().right),p=this.getFontSizeForElement(n),g=this.getRangeLabelOverlap(d,m),f=n,v=p/2;if(g>0){if(f.classList.add("hyphen","hyphen--wrap"),u===0&&r===0){let b=g/2-v;b=Math.sign(b)===-1?Math.abs(b):-b;const k=this.getHostOffset(d.getBoundingClientRect().left+b-v,d.getBoundingClientRect().right+b-v);let x=g/2;const y=this.getHostOffset(m.getBoundingClientRect().left+x,m.getBoundingClientRect().right+x);k!==0&&(b+=k,x+=k),y!==0&&(b+=y,x+=y),n.style.transform=`translateX(${b}px)`,d.style.transform=`translateX(${b-v}px)`,o.style.transform=`translateX(${x}px)`,m.style.transform=`translateX(${x}px)`}else if(r>0||u>0)n.style.transform=`translateX(${r+v}px)`,o.style.transform=`translateX(${g+u}px)`,m.style.transform=`translateX(${g+u}px)`;else if(r<0||u<0){let b=Math.abs(r)+g-v;b=Math.sign(b)===-1?Math.abs(b):-b,n.style.transform=`translateX(${b}px)`,d.style.transform=`translateX(${b-v}px)`}}else f.classList.remove("hyphen","hyphen--wrap"),n.style.transform=`translateX(${r}px)`,d.style.transform=`translateX(${r}px)`,o.style.transform=`translateX(${u}px)`,m.style.transform=`translateX(${u}px)`}hideObscuredBoundingTickLabels(){const e=V(this.value);if(!this.hasHistogram&&!e&&!this.labelHandles&&!this.precise||!this.hasHistogram&&!e&&this.labelHandles&&!this.precise||!this.hasHistogram&&!e&&!this.labelHandles&&this.precise||!this.hasHistogram&&!e&&this.labelHandles&&this.precise||!this.hasHistogram&&e&&!this.precise||this.hasHistogram&&!this.precise&&!this.labelHandles)return;const t=this.el.shadowRoot.querySelector(".thumb--minValue"),i=this.el.shadowRoot.querySelector(".thumb--value"),a=this.el.shadowRoot.querySelector(".tick__label--min"),n=this.el.shadowRoot.querySelector(".tick__label--max");!t&&i&&a&&n&&(a.style.opacity=this.isMinTickLabelObscured(a,i)?"0":"1",n.style.opacity=this.isMaxTickLabelObscured(n,i)?"0":"1"),t&&i&&a&&n&&(a.style.opacity=this.isMinTickLabelObscured(a,t)||this.isMinTickLabelObscured(a,i)?"0":"1",n.style.opacity=this.isMaxTickLabelObscured(n,t)||this.isMaxTickLabelObscured(n,i)&&this.hasHistogram?"0":"1")}getHostOffset(e,t){const i=this.el.getBoundingClientRect(),a=7;return e+ai.right?-(t-i.right)+a:0}getRangeLabelOverlap(e,t){const i=e.getBoundingClientRect(),a=t.getBoundingClientRect(),n=this.getFontSizeForElement(e),h=i.right+n-a.left;return Math.max(h,0)}isMinTickLabelObscured(e,t){const i=e.getBoundingClientRect(),a=t.getBoundingClientRect();return P(i,a)}isMaxTickLabelObscured(e,t){const i=e.getBoundingClientRect(),a=t.getBoundingClientRect();return P(i,a)}static get delegatesFocus(){return!0}get el(){return this}static get watchers(){return{histogram:["histogramWatcher"],ticks:["ticksWatcher"],value:["valueHandler"],minValue:["minMaxValueHandler"],maxValue:["minMaxValueHandler"]}}static get style(){return xe}},[17,"calcite-slider",{disabled:[516],form:[513],groupSeparator:[516,"group-separator"],hasHistogram:[1540,"has-histogram"],histogram:[16],histogramStops:[16],labelHandles:[516,"label-handles"],labelTicks:[516,"label-ticks"],max:[514],maxLabel:[1,"max-label"],maxValue:[1026,"max-value"],min:[514],minLabel:[1,"min-label"],minValue:[1026,"min-value"],mirrored:[516],name:[513],numberingSystem:[1,"numbering-system"],pageStep:[514,"page-step"],precise:[516],required:[516],snap:[516],step:[514],ticks:[514],value:[1538],scale:[513],effectiveLocale:[32],minMaxValueRange:[32],minValueDragRange:[32],maxValueDragRange:[32],tickValues:[32],setFocus:[64]},[[0,"keydown","keyDownHandler"],[1,"pointerdown","pointerDownHandler"]]]);function I(){if(typeof customElements>"u")return;["calcite-slider","calcite-graph"].forEach(t=>{switch(t){case"calcite-slider":customElements.get(t)||customElements.define(t,E);break;case"calcite-graph":customElements.get(t)||O();break}})}I();const Se=E,Pe=I;export{Se as CalciteSlider,Pe as defineCustomElement}; diff --git a/dist/assets/calcite-tooltip-DucKIjb_.js b/dist/assets/calcite-tooltip-ewJ_kzN3.js similarity index 94% rename from dist/assets/calcite-tooltip-DucKIjb_.js rename to dist/assets/calcite-tooltip-ewJ_kzN3.js index 90dcc72..fe100cb 100644 --- a/dist/assets/calcite-tooltip-DucKIjb_.js +++ b/dist/assets/calcite-tooltip-ewJ_kzN3.js @@ -1,5 +1,5 @@ -import{q as g,H as T,r as l,t as r,v as E,x as w,z as C,B as y,D as H}from"./index-J0iiHjMT.js";import{c as b,d as L,a as k,r as O,F as d}from"./floating-ui-McpI0u1Z.js";import{g as R}from"./guid-6vN-YNJI.js";import{o as c}from"./openCloseComponent-yw47Oy2q.js";import{F as S}from"./FloatingArrow-BghsONry.js";import"./debounce-HnHf1UOZ.js";/*! +import{p as g,H as T,d as l,k as r,t as E,l as w,q as C,m as y,n as H}from"./index-pCX-0tJH.js";import{c as b,d as k,a as L,r as O,F as d}from"./floating-ui-C10Xvlxv.js";import{g as R}from"./guid-6vN-YNJI.js";import{o as c}from"./openCloseComponent-lU2sdEaR.js";import{F as S}from"./FloatingArrow-FUeqM5kw.js";import"./debounce-HnHf1UOZ.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const x={container:"container"},D=300,A=500,h="aria-describedby";function f(o){const{referenceElement:e}=o;return(typeof e=="string"?C(o,{id:e}):e)||null}class P{constructor(){this.registeredElements=new WeakMap,this.registeredShadowRootCounts=new WeakMap,this.hoverOpenTimeout=null,this.hoverCloseTimeout=null,this.hoveredTooltip=null,this.clickedTooltip=null,this.activeTooltip=null,this.registeredElementCount=0,this.queryTooltip=e=>{const{registeredElements:t}=this,i=e.find(s=>t.has(s));return t.get(i)},this.keyDownHandler=e=>{if(e.key==="Escape"&&!e.defaultPrevented){const{activeTooltip:t}=this;if(t!=null&&t.open){this.clearHoverTimeout(),this.closeActiveTooltip();const i=f(t);i instanceof Element&&i.contains(e.target)&&e.preventDefault()}}},this.pointerMoveHandler=e=>{const t=e.composedPath(),{activeTooltip:i}=this;if((i==null?void 0:i.open)&&t.includes(i)){this.clearHoverTimeout();return}const n=this.queryTooltip(t);this.hoveredTooltip=n,!this.isClosableClickedTooltip(n)&&(this.clickedTooltip=null,n?this.openHoveredTooltip(n):i&&this.closeHoveredTooltip())},this.pointerDownHandler=e=>{if(!y(e))return;const t=this.queryTooltip(e.composedPath());this.clickedTooltip=t,t!=null&&t.closeOnClick&&(this.toggleTooltip(t,!1),this.clearHoverTimeout())},this.focusInHandler=e=>{this.queryFocusedTooltip(e,!0)},this.focusOutHandler=e=>{this.queryFocusedTooltip(e,!1)},this.openHoveredTooltip=e=>{this.hoverOpenTimeout=window.setTimeout(()=>{this.hoverOpenTimeout!==null&&(this.clearHoverCloseTimeout(),this.activeTooltip!==this.hoveredTooltip&&(this.closeActiveTooltip(),e===this.hoveredTooltip&&this.toggleTooltip(e,!0)))},this.activeTooltip?0:D)},this.closeHoveredTooltip=()=>{this.hoverCloseTimeout=window.setTimeout(()=>{this.hoverCloseTimeout!==null&&this.closeActiveTooltip()},A)}}registerElement(e,t){this.registeredElementCount++,this.registeredElements.set(e,t);const i=this.getReferenceElShadowRootNode(e);i&&this.registerShadowRoot(i),this.registeredElementCount===1&&this.addListeners()}unregisterElement(e){const t=this.getReferenceElShadowRootNode(e);t&&this.unregisterShadowRoot(t),this.registeredElements.delete(e)&&this.registeredElementCount--,this.registeredElementCount===0&&this.removeListeners()}addShadowListeners(e){e.addEventListener("focusin",this.focusInHandler,{capture:!0}),e.addEventListener("focusout",this.focusOutHandler,{capture:!0})}removeShadowListeners(e){e.removeEventListener("focusin",this.focusInHandler,{capture:!0}),e.removeEventListener("focusout",this.focusOutHandler,{capture:!0})}addListeners(){document.addEventListener("keydown",this.keyDownHandler,{capture:!0}),document.addEventListener("pointermove",this.pointerMoveHandler,{capture:!0}),document.addEventListener("pointerdown",this.pointerDownHandler,{capture:!0}),document.addEventListener("focusin",this.focusInHandler,{capture:!0}),document.addEventListener("focusout",this.focusOutHandler,{capture:!0})}removeListeners(){document.removeEventListener("keydown",this.keyDownHandler,{capture:!0}),document.removeEventListener("pointermove",this.pointerMoveHandler,{capture:!0}),document.removeEventListener("pointerdown",this.pointerDownHandler,{capture:!0}),document.removeEventListener("focusin",this.focusInHandler,{capture:!0}),document.removeEventListener("focusout",this.focusOutHandler,{capture:!0})}clearHoverOpenTimeout(){window.clearTimeout(this.hoverOpenTimeout),this.hoverOpenTimeout=null}clearHoverCloseTimeout(){window.clearTimeout(this.hoverCloseTimeout),this.hoverCloseTimeout=null}clearHoverTimeout(){this.clearHoverOpenTimeout(),this.clearHoverCloseTimeout()}closeActiveTooltip(){const{activeTooltip:e}=this;e!=null&&e.open&&this.toggleTooltip(e,!1)}toggleFocusedTooltip(e,t){this.closeActiveTooltip(),t&&this.clearHoverTimeout(),this.toggleTooltip(e,t)}toggleTooltip(e,t){e.open=t,this.activeTooltip=t?e:null}queryFocusedTooltip(e,t){const i=this.queryTooltip(e.composedPath());!i||this.isClosableClickedTooltip(i)||this.toggleFocusedTooltip(i,t)}isClosableClickedTooltip(e){return(e==null?void 0:e.closeOnClick)&&e===this.clickedTooltip}registerShadowRoot(e){const{registeredShadowRootCounts:t}=this,i=(t.get(e)??0)+1;i===1&&this.addShadowListeners(e),t.set(e,i)}unregisterShadowRoot(e){const{registeredShadowRootCounts:t}=this,i=t.get(e)-1;i===0&&this.removeShadowListeners(e),t.set(e,i)}getReferenceElShadowRootNode(e){return e instanceof Element?H(e):null}}const z=":host{--calcite-floating-ui-z-index:var(--calcite-tooltip-z-index, var(--calcite-app-z-index-tooltip));display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index)}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-app-z-index) * -1);fill:var(--calcite-ui-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-ui-border-3)}.container{position:relative;overflow:hidden;border-radius:0.25rem;padding-block:0.75rem;padding-inline:1rem;font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);max-inline-size:20rem;max-block-size:20rem;text-align:start}.calcite-floating-ui-anim{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}.arrow::before{outline:1px solid var(--calcite-ui-border-3)}:host([hidden]){display:none}[hidden]{display:none}",u=new P,p=g(class extends T{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteTooltipBeforeClose=l(this,"calciteTooltipBeforeClose",6),this.calciteTooltipClose=l(this,"calciteTooltipClose",6),this.calciteTooltipBeforeOpen=l(this,"calciteTooltipBeforeOpen",6),this.calciteTooltipOpen=l(this,"calciteTooltipOpen",6),this.guid=`calcite-tooltip-${R()}`,this.hasLoaded=!1,this.openTransitionProp="opacity",this.setTransitionEl=o=>{this.transitionEl=o},this.setUpReferenceElement=(o=!0)=>{this.removeReferences(),this.effectiveReferenceElement=f(this.el),b(this,this.effectiveReferenceElement,this.el);const{el:e,referenceElement:t,effectiveReferenceElement:i}=this;o&&t&&!i&&console.warn(`${e.tagName}: reference-element id "${t}" was not found.`,{el:e}),this.addReferences()},this.getId=()=>this.el.id||this.guid,this.addReferences=()=>{const{effectiveReferenceElement:o}=this;if(!o)return;const e=this.getId();"setAttribute"in o&&o.setAttribute(h,e),u.registerElement(o,this.el)},this.removeReferences=()=>{const{effectiveReferenceElement:o}=this;o&&("removeAttribute"in o&&o.removeAttribute(h),u.unregisterElement(o))},this.closeOnClick=!1,this.label=void 0,this.offsetDistance=L,this.offsetSkidding=0,this.open=!1,this.overlayPositioning="absolute",this.placement="auto",this.referenceElement=void 0,this.effectiveReferenceElement=void 0,this.floatingLayout="vertical"}offsetDistanceOffsetHandler(){this.reposition(!0)}offsetSkiddingHandler(){this.reposition(!0)}openHandler(o){c(this),o&&this.reposition(!0)}overlayPositioningHandler(){this.reposition(!0)}placementHandler(){this.reposition(!0)}referenceElementHandler(){this.setUpReferenceElement()}connectedCallback(){this.setUpReferenceElement(this.hasLoaded),this.open&&c(this)}async componentWillLoad(){this.open&&c(this)}componentDidLoad(){this.referenceElement&&!this.effectiveReferenceElement&&this.setUpReferenceElement(),this.reposition(!0),this.hasLoaded=!0}disconnectedCallback(){this.removeReferences(),k(this,this.effectiveReferenceElement,this.el)}async reposition(o=!1){const{el:e,effectiveReferenceElement:t,placement:i,overlayPositioning:s,offsetDistance:n,offsetSkidding:a,arrowEl:v}=this;return O(this,{floatingEl:e,referenceEl:t,overlayPositioning:s,placement:i,offsetDistance:n,offsetSkidding:a,arrowEl:v,type:"tooltip"},o)}onBeforeOpen(){this.calciteTooltipBeforeOpen.emit()}onOpen(){this.calciteTooltipOpen.emit()}onBeforeClose(){this.calciteTooltipBeforeClose.emit()}onClose(){this.calciteTooltipClose.emit()}render(){const{effectiveReferenceElement:o,label:e,open:t,floatingLayout:i}=this,s=o&&t,n=!s;return r(w,{"aria-hidden":E(n),"aria-label":e,"aria-live":"polite","calcite-hydrated-hidden":n,id:this.getId(),role:"tooltip"},r("div",{class:{[d.animation]:!0,[d.animationActive]:s},ref:this.setTransitionEl},r(S,{floatingLayout:i,ref:a=>this.arrowEl=a}),r("div",{class:x.container},r("slot",null))))}get el(){return this}static get watchers(){return{offsetDistance:["offsetDistanceOffsetHandler"],offsetSkidding:["offsetSkiddingHandler"],open:["openHandler"],overlayPositioning:["overlayPositioningHandler"],placement:["placementHandler"],referenceElement:["referenceElementHandler"]}}static get style(){return z}},[1,"calcite-tooltip",{closeOnClick:[516,"close-on-click"],label:[1],offsetDistance:[514,"offset-distance"],offsetSkidding:[514,"offset-skidding"],open:[516],overlayPositioning:[513,"overlay-positioning"],placement:[513],referenceElement:[1,"reference-element"],effectiveReferenceElement:[32],floatingLayout:[32],reposition:[64]}]);function m(){if(typeof customElements>"u")return;["calcite-tooltip"].forEach(e=>{switch(e){case"calcite-tooltip":customElements.get(e)||customElements.define(e,p);break}})}m();const U=p,Y=m;export{U as CalciteTooltip,Y as defineCustomElement}; + */const x={container:"container"},D=300,A=500,h="aria-describedby";function f(o){const{referenceElement:e}=o;return(typeof e=="string"?C(o,{id:e}):e)||null}class P{constructor(){this.registeredElements=new WeakMap,this.registeredShadowRootCounts=new WeakMap,this.hoverOpenTimeout=null,this.hoverCloseTimeout=null,this.hoveredTooltip=null,this.clickedTooltip=null,this.activeTooltip=null,this.registeredElementCount=0,this.queryTooltip=e=>{const{registeredElements:t}=this,i=e.find(s=>t.has(s));return t.get(i)},this.keyDownHandler=e=>{if(e.key==="Escape"&&!e.defaultPrevented){const{activeTooltip:t}=this;if(t!=null&&t.open){this.clearHoverTimeout(),this.closeActiveTooltip();const i=f(t);i instanceof Element&&i.contains(e.target)&&e.preventDefault()}}},this.pointerMoveHandler=e=>{const t=e.composedPath(),{activeTooltip:i}=this;if((i==null?void 0:i.open)&&t.includes(i)){this.clearHoverTimeout();return}const n=this.queryTooltip(t);this.hoveredTooltip=n,!this.isClosableClickedTooltip(n)&&(this.clickedTooltip=null,n?this.openHoveredTooltip(n):i&&this.closeHoveredTooltip())},this.pointerDownHandler=e=>{if(!y(e))return;const t=this.queryTooltip(e.composedPath());this.clickedTooltip=t,t!=null&&t.closeOnClick&&(this.toggleTooltip(t,!1),this.clearHoverTimeout())},this.focusInHandler=e=>{this.queryFocusedTooltip(e,!0)},this.focusOutHandler=e=>{this.queryFocusedTooltip(e,!1)},this.openHoveredTooltip=e=>{this.hoverOpenTimeout=window.setTimeout(()=>{this.hoverOpenTimeout!==null&&(this.clearHoverCloseTimeout(),this.activeTooltip!==this.hoveredTooltip&&(this.closeActiveTooltip(),e===this.hoveredTooltip&&this.toggleTooltip(e,!0)))},this.activeTooltip?0:D)},this.closeHoveredTooltip=()=>{this.hoverCloseTimeout=window.setTimeout(()=>{this.hoverCloseTimeout!==null&&this.closeActiveTooltip()},A)}}registerElement(e,t){this.registeredElementCount++,this.registeredElements.set(e,t);const i=this.getReferenceElShadowRootNode(e);i&&this.registerShadowRoot(i),this.registeredElementCount===1&&this.addListeners()}unregisterElement(e){const t=this.getReferenceElShadowRootNode(e);t&&this.unregisterShadowRoot(t),this.registeredElements.delete(e)&&this.registeredElementCount--,this.registeredElementCount===0&&this.removeListeners()}addShadowListeners(e){e.addEventListener("focusin",this.focusInHandler,{capture:!0}),e.addEventListener("focusout",this.focusOutHandler,{capture:!0})}removeShadowListeners(e){e.removeEventListener("focusin",this.focusInHandler,{capture:!0}),e.removeEventListener("focusout",this.focusOutHandler,{capture:!0})}addListeners(){document.addEventListener("keydown",this.keyDownHandler,{capture:!0}),document.addEventListener("pointermove",this.pointerMoveHandler,{capture:!0}),document.addEventListener("pointerdown",this.pointerDownHandler,{capture:!0}),document.addEventListener("focusin",this.focusInHandler,{capture:!0}),document.addEventListener("focusout",this.focusOutHandler,{capture:!0})}removeListeners(){document.removeEventListener("keydown",this.keyDownHandler,{capture:!0}),document.removeEventListener("pointermove",this.pointerMoveHandler,{capture:!0}),document.removeEventListener("pointerdown",this.pointerDownHandler,{capture:!0}),document.removeEventListener("focusin",this.focusInHandler,{capture:!0}),document.removeEventListener("focusout",this.focusOutHandler,{capture:!0})}clearHoverOpenTimeout(){window.clearTimeout(this.hoverOpenTimeout),this.hoverOpenTimeout=null}clearHoverCloseTimeout(){window.clearTimeout(this.hoverCloseTimeout),this.hoverCloseTimeout=null}clearHoverTimeout(){this.clearHoverOpenTimeout(),this.clearHoverCloseTimeout()}closeActiveTooltip(){const{activeTooltip:e}=this;e!=null&&e.open&&this.toggleTooltip(e,!1)}toggleFocusedTooltip(e,t){this.closeActiveTooltip(),t&&this.clearHoverTimeout(),this.toggleTooltip(e,t)}toggleTooltip(e,t){e.open=t,this.activeTooltip=t?e:null}queryFocusedTooltip(e,t){const i=this.queryTooltip(e.composedPath());!i||this.isClosableClickedTooltip(i)||this.toggleFocusedTooltip(i,t)}isClosableClickedTooltip(e){return(e==null?void 0:e.closeOnClick)&&e===this.clickedTooltip}registerShadowRoot(e){const{registeredShadowRootCounts:t}=this,i=(t.get(e)??0)+1;i===1&&this.addShadowListeners(e),t.set(e,i)}unregisterShadowRoot(e){const{registeredShadowRootCounts:t}=this,i=t.get(e)-1;i===0&&this.removeShadowListeners(e),t.set(e,i)}getReferenceElShadowRootNode(e){return e instanceof Element?H(e):null}}const I=":host{--calcite-floating-ui-z-index:var(--calcite-tooltip-z-index, var(--calcite-app-z-index-tooltip));display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index)}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-app-z-index) * -1);fill:var(--calcite-ui-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-ui-border-3)}.container{position:relative;overflow:hidden;border-radius:0.25rem;padding-block:0.75rem;padding-inline:1rem;font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);max-inline-size:20rem;max-block-size:20rem;text-align:start}.calcite-floating-ui-anim{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}.arrow::before{outline:1px solid var(--calcite-ui-border-3)}:host([hidden]){display:none}[hidden]{display:none}",u=new P,p=g(class extends T{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calciteTooltipBeforeClose=l(this,"calciteTooltipBeforeClose",6),this.calciteTooltipClose=l(this,"calciteTooltipClose",6),this.calciteTooltipBeforeOpen=l(this,"calciteTooltipBeforeOpen",6),this.calciteTooltipOpen=l(this,"calciteTooltipOpen",6),this.guid=`calcite-tooltip-${R()}`,this.hasLoaded=!1,this.openTransitionProp="opacity",this.setTransitionEl=o=>{this.transitionEl=o},this.setUpReferenceElement=(o=!0)=>{this.removeReferences(),this.effectiveReferenceElement=f(this.el),b(this,this.effectiveReferenceElement,this.el);const{el:e,referenceElement:t,effectiveReferenceElement:i}=this;o&&t&&!i&&console.warn(`${e.tagName}: reference-element id "${t}" was not found.`,{el:e}),this.addReferences()},this.getId=()=>this.el.id||this.guid,this.addReferences=()=>{const{effectiveReferenceElement:o}=this;if(!o)return;const e=this.getId();"setAttribute"in o&&o.setAttribute(h,e),u.registerElement(o,this.el)},this.removeReferences=()=>{const{effectiveReferenceElement:o}=this;o&&("removeAttribute"in o&&o.removeAttribute(h),u.unregisterElement(o))},this.closeOnClick=!1,this.label=void 0,this.offsetDistance=k,this.offsetSkidding=0,this.open=!1,this.overlayPositioning="absolute",this.placement="auto",this.referenceElement=void 0,this.effectiveReferenceElement=void 0,this.floatingLayout="vertical"}offsetDistanceOffsetHandler(){this.reposition(!0)}offsetSkiddingHandler(){this.reposition(!0)}openHandler(o){c(this),o&&this.reposition(!0)}overlayPositioningHandler(){this.reposition(!0)}placementHandler(){this.reposition(!0)}referenceElementHandler(){this.setUpReferenceElement()}connectedCallback(){this.setUpReferenceElement(this.hasLoaded),this.open&&c(this)}async componentWillLoad(){this.open&&c(this)}componentDidLoad(){this.referenceElement&&!this.effectiveReferenceElement&&this.setUpReferenceElement(),this.reposition(!0),this.hasLoaded=!0}disconnectedCallback(){this.removeReferences(),L(this,this.effectiveReferenceElement,this.el)}async reposition(o=!1){const{el:e,effectiveReferenceElement:t,placement:i,overlayPositioning:s,offsetDistance:n,offsetSkidding:a,arrowEl:v}=this;return O(this,{floatingEl:e,referenceEl:t,overlayPositioning:s,placement:i,offsetDistance:n,offsetSkidding:a,arrowEl:v,type:"tooltip"},o)}onBeforeOpen(){this.calciteTooltipBeforeOpen.emit()}onOpen(){this.calciteTooltipOpen.emit()}onBeforeClose(){this.calciteTooltipBeforeClose.emit()}onClose(){this.calciteTooltipClose.emit()}render(){const{effectiveReferenceElement:o,label:e,open:t,floatingLayout:i}=this,s=o&&t,n=!s;return r(w,{"aria-hidden":E(n),"aria-label":e,"aria-live":"polite","calcite-hydrated-hidden":n,id:this.getId(),role:"tooltip"},r("div",{class:{[d.animation]:!0,[d.animationActive]:s},ref:this.setTransitionEl},r(S,{floatingLayout:i,ref:a=>this.arrowEl=a}),r("div",{class:x.container},r("slot",null))))}get el(){return this}static get watchers(){return{offsetDistance:["offsetDistanceOffsetHandler"],offsetSkidding:["offsetSkiddingHandler"],open:["openHandler"],overlayPositioning:["overlayPositioningHandler"],placement:["placementHandler"],referenceElement:["referenceElementHandler"]}}static get style(){return I}},[1,"calcite-tooltip",{closeOnClick:[516,"close-on-click"],label:[1],offsetDistance:[514,"offset-distance"],offsetSkidding:[514,"offset-skidding"],open:[516],overlayPositioning:[513,"overlay-positioning"],placement:[513],referenceElement:[1,"reference-element"],effectiveReferenceElement:[32],floatingLayout:[32],reposition:[64]}]);function m(){if(typeof customElements>"u")return;["calcite-tooltip"].forEach(e=>{switch(e){case"calcite-tooltip":customElements.get(e)||customElements.define(e,p);break}})}m();const U=p,Y=m;export{U as CalciteTooltip,Y as defineCustomElement}; diff --git a/dist/assets/chartCommon-ZPkVkRIK.js b/dist/assets/chartCommon-OKgpftOz.js similarity index 96% rename from dist/assets/chartCommon-ZPkVkRIK.js rename to dist/assets/chartCommon-OKgpftOz.js index 7ec79cf..ce816f6 100644 --- a/dist/assets/chartCommon-ZPkVkRIK.js +++ b/dist/assets/chartCommon-OKgpftOz.js @@ -1 +1 @@ -import{Q as v,b as w,W as x,g as f,l as m,i as T,t as B}from"./Theme-QNc_77AM.js";import{l as R,d as j}from"./Responsive-QKXcW_1q.js";import{n as y,o as P}from"./Button-1STHXt3M.js";import{u as E}from"./Tooltip-lrFZgXdG.js";import{s as F}from"./ColorSet-j9kKRPwP.js";import"./index-J0iiHjMT.js";class c extends v{constructor(){super(...arguments),Object.defineProperty(this,"thumb",{enumerable:!0,configurable:!0,writable:!0,value:this._makeThumb()}),Object.defineProperty(this,"startGrip",{enumerable:!0,configurable:!0,writable:!0,value:this._makeButton()}),Object.defineProperty(this,"endGrip",{enumerable:!0,configurable:!0,writable:!0,value:this._makeButton()}),Object.defineProperty(this,"_thumbBusy",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_startDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_endDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_thumbDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_gripDown",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_addOrientationClass(){this._settings.themeTags=w(this._settings.themeTags,["scrollbar",this._settings.orientation]),this._settings.background||(this._settings.background=y.new(this._root,{themeTags:w(this._settings.themeTags,["main","background"])}))}_makeButton(){return this.children.push(P.new(this._root,{themeTags:["resize","button",this.get("orientation")],icon:x.new(this._root,{themeTags:["icon"]})}))}_makeThumb(){return this.children.push(y.new(this._root,{themeTags:["thumb",this.get("orientation")]}))}_handleAnimation(t){t&&this._disposers.push(t.events.on("stopped",()=>{this.setPrivateRaw("isBusy",!1),this._thumbBusy=!1}))}_afterNew(){this._addOrientationClass(),super._afterNew();const t=this.startGrip,e=this.endGrip,i=this.thumb,r=this.get("background");r&&this._disposers.push(r.events.on("click",s=>{this.setPrivateRaw("isBusy",!0);const a=this._display.toLocal(s.point),h=this.width(),o=this.height(),u=this.get("orientation");let n,d,p;n=u=="vertical"?(a.y-i.height()/2)/o:(a.x-i.width()/2)/h,u=="vertical"?(d=n*o,p="y"):(d=n*h,p="x");const l=this.get("animationDuration",0);l>0?(this._thumbBusy=!0,this._handleAnimation(this.thumb.animate({key:p,to:d,duration:l,easing:this.get("animationEasing")}))):(this.thumb.set(p,d),this._root.events.once("frameended",()=>{this.setPrivateRaw("isBusy",!1)}))})),this._disposers.push(i.events.on("dblclick",s=>{if(!f(s.originalEvent,this))return;const a=this.get("animationDuration",0),h=this.get("animationEasing");this.animate({key:"start",to:0,duration:a,easing:h}),this.animate({key:"end",to:1,duration:a,easing:h})})),this._disposers.push(t.events.on("pointerdown",()=>{this.setPrivateRaw("isBusy",!0),this._startDown=!0,this._gripDown="start"})),this._disposers.push(e.events.on("pointerdown",()=>{this.setPrivateRaw("isBusy",!0),this._endDown=!0,this._gripDown="end"})),this._disposers.push(i.events.on("pointerdown",()=>{this.setPrivateRaw("isBusy",!0),this._thumbDown=!0,this._gripDown=void 0})),this._disposers.push(t.events.on("globalpointerup",()=>{this._startDown&&this.setPrivateRaw("isBusy",!1),this._startDown=!1})),this._disposers.push(e.events.on("globalpointerup",()=>{this._endDown&&this.setPrivateRaw("isBusy",!1),this._endDown=!1})),this._disposers.push(i.events.on("globalpointerup",()=>{this._thumbDown&&this.setPrivateRaw("isBusy",!1),this._thumbDown=!1})),this._disposers.push(t.on("x",()=>{this._updateThumb()})),this._disposers.push(e.on("x",()=>{this._updateThumb()})),this._disposers.push(t.on("y",()=>{this._updateThumb()})),this._disposers.push(e.on("y",()=>{this._updateThumb()})),this._disposers.push(i.events.on("positionchanged",()=>{this._updateGripsByThumb()})),this.get("orientation")=="vertical"?(t.set("x",0),e.set("x",0),this._disposers.push(i.adapters.add("y",s=>Math.max(Math.min(Number(s),this.height()-i.height()),0))),this._disposers.push(i.adapters.add("x",s=>this.width()/2)),this._disposers.push(t.adapters.add("x",s=>this.width()/2)),this._disposers.push(e.adapters.add("x",s=>this.width()/2)),this._disposers.push(t.adapters.add("y",s=>Math.max(Math.min(Number(s),this.height()),0))),this._disposers.push(e.adapters.add("y",s=>Math.max(Math.min(Number(s),this.height()),0)))):(t.set("y",0),e.set("y",0),this._disposers.push(i.adapters.add("x",s=>Math.max(Math.min(Number(s),this.width()-i.width()),0))),this._disposers.push(i.adapters.add("y",s=>this.height()/2)),this._disposers.push(t.adapters.add("y",s=>this.height()/2)),this._disposers.push(e.adapters.add("y",s=>this.height()/2)),this._disposers.push(t.adapters.add("x",s=>Math.max(Math.min(Number(s),this.width()),0))),this._disposers.push(e.adapters.add("x",s=>Math.max(Math.min(Number(s),this.width()),0))))}_updateChildren(){super._updateChildren(),(this.isDirty("end")||this.isDirty("start")||this._sizeDirty)&&this.updateGrips()}_changed(){if(super._changed(),this.isDirty("start")||this.isDirty("end")){const t="rangechanged";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this,start:this.get("start",0),end:this.get("end",1),grip:this._gripDown})}}updateGrips(){const t=this.startGrip,e=this.endGrip,i=this.get("orientation"),r=this.height(),s=this.width();i=="vertical"?(t.set("y",r*this.get("start",0)),e.set("y",r*this.get("end",1))):(t.set("x",s*this.get("start",0)),e.set("x",s*this.get("end",1)));const a=this.getPrivate("positionTextFunction"),h=Math.round(100*this.get("start",0)),o=Math.round(100*this.get("end",0));let u,n;a?(u=a.call(this,this.get("start",0)),n=a.call(this,this.get("end",0))):(u=h+"%",n=o+"%"),t.set("ariaLabel",this._t("From %1",void 0,u)),t.set("ariaValueNow",""+h),t.set("ariaValueText",h+"%"),t.set("ariaValueMin","0"),t.set("ariaValueMax","100"),e.set("ariaLabel",this._t("To %1",void 0,n)),e.set("ariaValueNow",""+o),e.set("ariaValueText",o+"%"),e.set("ariaValueMin","0"),e.set("ariaValueMax","100")}_updateThumb(){const t=this.thumb,e=this.startGrip,i=this.endGrip,r=this.height(),s=this.width();let a=e.x(),h=i.x(),o=e.y(),u=i.y(),n=0,d=1;this.get("orientation")=="vertical"?m(o)&&m(u)&&(this._thumbBusy||t.isDragging()||(t.set("height",u-o),t.set("y",o)),n=o/r,d=u/r):m(a)&&m(h)&&(this._thumbBusy||t.isDragging()||(t.set("width",h-a),t.set("x",a)),n=a/s,d=h/s),!this.getPrivate("isBusy")||this.get("start")==n&&this.get("end")==d||(this.set("start",n),this.set("end",d));const p=this.getPrivate("positionTextFunction"),l=Math.round(100*this.get("start",0)),D=Math.round(100*this.get("end",0));let g,b;p?(g=p.call(this,this.get("start",0)),b=p.call(this,this.get("end",0))):(g=l+"%",b=D+"%"),t.set("ariaLabel",this._t("From %1 to %2",void 0,g,b)),t.set("ariaValueNow",""+l),t.set("ariaValueText",l+"%")}_updateGripsByThumb(){const t=this.thumb,e=this.startGrip,i=this.endGrip;if(this.get("orientation")=="vertical"){const r=t.height();e.set("y",t.y()),i.set("y",t.y()+r)}else{const r=t.width();e.set("x",t.x()),i.set("x",t.x()+r)}}}Object.defineProperty(c,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Scrollbar"}),Object.defineProperty(c,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:v.classNames.concat([c.className])});const N=class extends T{setupDefaultRules(){super.setupDefaultRules(),this.rule("Component").setAll({interpolationDuration:600}),this.rule("Hierarchy").set("animationDuration",600),this.rule("Scrollbar").set("animationDuration",600),this.rule("Tooltip").set("animationDuration",300),this.rule("MapChart").set("animationDuration",1e3),this.rule("MapChart").set("wheelDuration",300),this.rule("Entity").setAll({stateAnimationDuration:600}),this.rule("Sprite").states.create("default",{stateAnimationDuration:600}),this.rule("Tooltip",["axis"]).setAll({animationDuration:200}),this.rule("WordCloud").set("animationDuration",500),this.rule("Polygon").set("animationDuration",600),this.rule("ArcDiagram").set("animationDuration",600)}},G=["#2888B8","#EB7028","#48A375","#9370B1","#e55035","#3d9ccc","#DC7B04","#b87bb0","#3fa681","#EE6386"].map(_=>B(_));export{N as AnimatedThemeAm5,F as ColorSetAm5,R as DarkThemeAm5,j as ResponsiveThemeAm5,c as ScrollbarAm5,T as ThemeAm5,E as TooltipAm5,B as colorAm5,G as esriChartColorSet}; +import{Q as v,b as w,W as x,g as f,l as m,i as T,t as B}from"./Theme-5CV7oVsW.js";import{l as R,d as j}from"./Responsive-QlPOQ03r.js";import{n as y,o as P}from"./Button-HXGuX8_s.js";import{u as E}from"./Tooltip-4JsqFz5S.js";import{s as F}from"./ColorSet-tH4rJdGx.js";import"./index-pCX-0tJH.js";class c extends v{constructor(){super(...arguments),Object.defineProperty(this,"thumb",{enumerable:!0,configurable:!0,writable:!0,value:this._makeThumb()}),Object.defineProperty(this,"startGrip",{enumerable:!0,configurable:!0,writable:!0,value:this._makeButton()}),Object.defineProperty(this,"endGrip",{enumerable:!0,configurable:!0,writable:!0,value:this._makeButton()}),Object.defineProperty(this,"_thumbBusy",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_startDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_endDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_thumbDown",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_gripDown",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}_addOrientationClass(){this._settings.themeTags=w(this._settings.themeTags,["scrollbar",this._settings.orientation]),this._settings.background||(this._settings.background=y.new(this._root,{themeTags:w(this._settings.themeTags,["main","background"])}))}_makeButton(){return this.children.push(P.new(this._root,{themeTags:["resize","button",this.get("orientation")],icon:x.new(this._root,{themeTags:["icon"]})}))}_makeThumb(){return this.children.push(y.new(this._root,{themeTags:["thumb",this.get("orientation")]}))}_handleAnimation(t){t&&this._disposers.push(t.events.on("stopped",()=>{this.setPrivateRaw("isBusy",!1),this._thumbBusy=!1}))}_afterNew(){this._addOrientationClass(),super._afterNew();const t=this.startGrip,e=this.endGrip,i=this.thumb,r=this.get("background");r&&this._disposers.push(r.events.on("click",s=>{this.setPrivateRaw("isBusy",!0);const a=this._display.toLocal(s.point),h=this.width(),o=this.height(),u=this.get("orientation");let n,d,p;n=u=="vertical"?(a.y-i.height()/2)/o:(a.x-i.width()/2)/h,u=="vertical"?(d=n*o,p="y"):(d=n*h,p="x");const l=this.get("animationDuration",0);l>0?(this._thumbBusy=!0,this._handleAnimation(this.thumb.animate({key:p,to:d,duration:l,easing:this.get("animationEasing")}))):(this.thumb.set(p,d),this._root.events.once("frameended",()=>{this.setPrivateRaw("isBusy",!1)}))})),this._disposers.push(i.events.on("dblclick",s=>{if(!f(s.originalEvent,this))return;const a=this.get("animationDuration",0),h=this.get("animationEasing");this.animate({key:"start",to:0,duration:a,easing:h}),this.animate({key:"end",to:1,duration:a,easing:h})})),this._disposers.push(t.events.on("pointerdown",()=>{this.setPrivateRaw("isBusy",!0),this._startDown=!0,this._gripDown="start"})),this._disposers.push(e.events.on("pointerdown",()=>{this.setPrivateRaw("isBusy",!0),this._endDown=!0,this._gripDown="end"})),this._disposers.push(i.events.on("pointerdown",()=>{this.setPrivateRaw("isBusy",!0),this._thumbDown=!0,this._gripDown=void 0})),this._disposers.push(t.events.on("globalpointerup",()=>{this._startDown&&this.setPrivateRaw("isBusy",!1),this._startDown=!1})),this._disposers.push(e.events.on("globalpointerup",()=>{this._endDown&&this.setPrivateRaw("isBusy",!1),this._endDown=!1})),this._disposers.push(i.events.on("globalpointerup",()=>{this._thumbDown&&this.setPrivateRaw("isBusy",!1),this._thumbDown=!1})),this._disposers.push(t.on("x",()=>{this._updateThumb()})),this._disposers.push(e.on("x",()=>{this._updateThumb()})),this._disposers.push(t.on("y",()=>{this._updateThumb()})),this._disposers.push(e.on("y",()=>{this._updateThumb()})),this._disposers.push(i.events.on("positionchanged",()=>{this._updateGripsByThumb()})),this.get("orientation")=="vertical"?(t.set("x",0),e.set("x",0),this._disposers.push(i.adapters.add("y",s=>Math.max(Math.min(Number(s),this.height()-i.height()),0))),this._disposers.push(i.adapters.add("x",s=>this.width()/2)),this._disposers.push(t.adapters.add("x",s=>this.width()/2)),this._disposers.push(e.adapters.add("x",s=>this.width()/2)),this._disposers.push(t.adapters.add("y",s=>Math.max(Math.min(Number(s),this.height()),0))),this._disposers.push(e.adapters.add("y",s=>Math.max(Math.min(Number(s),this.height()),0)))):(t.set("y",0),e.set("y",0),this._disposers.push(i.adapters.add("x",s=>Math.max(Math.min(Number(s),this.width()-i.width()),0))),this._disposers.push(i.adapters.add("y",s=>this.height()/2)),this._disposers.push(t.adapters.add("y",s=>this.height()/2)),this._disposers.push(e.adapters.add("y",s=>this.height()/2)),this._disposers.push(t.adapters.add("x",s=>Math.max(Math.min(Number(s),this.width()),0))),this._disposers.push(e.adapters.add("x",s=>Math.max(Math.min(Number(s),this.width()),0))))}_updateChildren(){super._updateChildren(),(this.isDirty("end")||this.isDirty("start")||this._sizeDirty)&&this.updateGrips()}_changed(){if(super._changed(),this.isDirty("start")||this.isDirty("end")){const t="rangechanged";this.events.isEnabled(t)&&this.events.dispatch(t,{type:t,target:this,start:this.get("start",0),end:this.get("end",1),grip:this._gripDown})}}updateGrips(){const t=this.startGrip,e=this.endGrip,i=this.get("orientation"),r=this.height(),s=this.width();i=="vertical"?(t.set("y",r*this.get("start",0)),e.set("y",r*this.get("end",1))):(t.set("x",s*this.get("start",0)),e.set("x",s*this.get("end",1)));const a=this.getPrivate("positionTextFunction"),h=Math.round(100*this.get("start",0)),o=Math.round(100*this.get("end",0));let u,n;a?(u=a.call(this,this.get("start",0)),n=a.call(this,this.get("end",0))):(u=h+"%",n=o+"%"),t.set("ariaLabel",this._t("From %1",void 0,u)),t.set("ariaValueNow",""+h),t.set("ariaValueText",h+"%"),t.set("ariaValueMin","0"),t.set("ariaValueMax","100"),e.set("ariaLabel",this._t("To %1",void 0,n)),e.set("ariaValueNow",""+o),e.set("ariaValueText",o+"%"),e.set("ariaValueMin","0"),e.set("ariaValueMax","100")}_updateThumb(){const t=this.thumb,e=this.startGrip,i=this.endGrip,r=this.height(),s=this.width();let a=e.x(),h=i.x(),o=e.y(),u=i.y(),n=0,d=1;this.get("orientation")=="vertical"?m(o)&&m(u)&&(this._thumbBusy||t.isDragging()||(t.set("height",u-o),t.set("y",o)),n=o/r,d=u/r):m(a)&&m(h)&&(this._thumbBusy||t.isDragging()||(t.set("width",h-a),t.set("x",a)),n=a/s,d=h/s),!this.getPrivate("isBusy")||this.get("start")==n&&this.get("end")==d||(this.set("start",n),this.set("end",d));const p=this.getPrivate("positionTextFunction"),l=Math.round(100*this.get("start",0)),D=Math.round(100*this.get("end",0));let g,b;p?(g=p.call(this,this.get("start",0)),b=p.call(this,this.get("end",0))):(g=l+"%",b=D+"%"),t.set("ariaLabel",this._t("From %1 to %2",void 0,g,b)),t.set("ariaValueNow",""+l),t.set("ariaValueText",l+"%")}_updateGripsByThumb(){const t=this.thumb,e=this.startGrip,i=this.endGrip;if(this.get("orientation")=="vertical"){const r=t.height();e.set("y",t.y()),i.set("y",t.y()+r)}else{const r=t.width();e.set("x",t.x()),i.set("x",t.x()+r)}}}Object.defineProperty(c,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Scrollbar"}),Object.defineProperty(c,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:v.classNames.concat([c.className])});const N=class extends T{setupDefaultRules(){super.setupDefaultRules(),this.rule("Component").setAll({interpolationDuration:600}),this.rule("Hierarchy").set("animationDuration",600),this.rule("Scrollbar").set("animationDuration",600),this.rule("Tooltip").set("animationDuration",300),this.rule("MapChart").set("animationDuration",1e3),this.rule("MapChart").set("wheelDuration",300),this.rule("Entity").setAll({stateAnimationDuration:600}),this.rule("Sprite").states.create("default",{stateAnimationDuration:600}),this.rule("Tooltip",["axis"]).setAll({animationDuration:200}),this.rule("WordCloud").set("animationDuration",500),this.rule("Polygon").set("animationDuration",600),this.rule("ArcDiagram").set("animationDuration",600)}},G=["#2888B8","#EB7028","#48A375","#9370B1","#e55035","#3d9ccc","#DC7B04","#b87bb0","#3fa681","#EE6386"].map(_=>B(_));export{N as AnimatedThemeAm5,F as ColorSetAm5,R as DarkThemeAm5,j as ResponsiveThemeAm5,c as ScrollbarAm5,T as ThemeAm5,E as TooltipAm5,B as colorAm5,G as esriChartColorSet}; diff --git a/dist/assets/chartUtils-24xN4NV-.js b/dist/assets/chartUtils-24xN4NV-.js new file mode 100644 index 0000000..dd5da76 --- /dev/null +++ b/dist/assets/chartUtils-24xN4NV-.js @@ -0,0 +1,2 @@ +import{d as F,l as q}from"./Responsive-QlPOQ03r.js";import{ab as _,hp as N,hq as D,fq as R,gI as v,hr as G,hs as J,ht as K,co as O,hu as Q,c$ as ee,hv as ie,hw as te,a0 as ne,hx as P,hy as oe}from"./index-pCX-0tJH.js";import{Y as ae,S as se}from"./chartUtilsAm5-owLhGEU2.js";import{o as le,u as Y,_ as re,b as de,r as ce,x as ue}from"./LineSeries-yr_9erUD.js";import{a2 as b,t as x,Y as pe,Z as xe}from"./Theme-5CV7oVsW.js";import{u as W}from"./Tooltip-4JsqFz5S.js";import"./DefaultTheme-uOYPzulo.js";import"./ColorSet-tH4rJdGx.js";import"./Tick-bu1aEuYp.js";import"./Button-HXGuX8_s.js";function fe(e,n,t=10){const i=X(n-e,!1);if(i===0)return[e,n];const o=X(i/(t-1),!0);return[Math.floor(e/o)*o,Math.ceil(n/o)*o]}function X(e,n){const t=Math.floor(Math.log10(e)),i=e/10**t;let o;return o=n?i<1.5?1:i<3?2:i<5?2.5:i<7?5:10:i<=1?1:i<=2?2:i<=3?2.5:i<=5?5:10,o*10**t}const A="#f8f8f8",I="#a9a9a9",g="#323232",me="line",ge="fill",h=15,m=12,z=.001,he=.1,Ae=.02,E={fontFamily:"Avenir Next",paddingBottom:m/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:I,axisTooltipFontSize:12,axisTooltipBackgroundColor:g,axisTooltipLabelColor:A,axisTooltipPaddingTop:Math.round(m/4),axisTooltipPaddingBottom:Math.round(m/4),axisTooltipPaddingHorizontal:Math.round(h/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(m/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(h/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:A,seriesTooltipLabelColor:g,seriesFillLighten:.9,seriesTooltipSpacing:m/2,seriesTooltipPaddingVertical:Math.round(h/4),seriesTooltipPaddingHorizontal:Math.round(h/4)},ve={...E,axisGridStroke:g,axisLabelsColor:I,axisTooltipBackgroundColor:g,axisTooltipLabelColor:A,seriesTooltipBackgroundColor:g,seriesTooltipLabelColor:A,seriesFillLighten:-.75},y={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function je(e){const n=await ae(e.container);_(e.abortOptions);const t=N(),i=t?ve:E;n.setThemes(t?[F.new(n),q.new(n)]:[F.new(n)]);const o=D(e.container),a=n.container.children.push(le.new(n,{panX:!0,panY:!0,paddingTop:i.paddingTop,paddingBottom:i.paddingBottom,paddingLeft:o?i.paddingRight:i.paddingLeft,paddingRight:o?i.paddingLeft:i.paddingRight,maxTooltipDistance:0}));a.zoomOutButton.set("forceHidden",!0);const s=a.xAxes.push(Y.new(n,{renderer:re.new(n,{})})),l=a.yAxes.push(Y.new(n,{renderer:de.new(n,{})})),c=P(null),r=P("loading"),d={params:e,chart:a,xAxis:s,yAxis:l,seriesInfos:new Map,messages:null,theme:i,pointerIsOver:!1,get state(){return r.value},get data(){return c.value},set data(u){c.value=u}};ye(d),Te(d),be(d);const p=R([ke(d,e.onRangeChange),Ce(d,e.onCursorPositionChange),L(n.events.once("frameended",()=>{r.value="ready"})),L(n)]);return{destroy:()=>{p.remove(),r.value="destroyed"},update:u=>{u.data===d.data&&u.messages===d.messages||M(d)||Le(d,u)},zoomOut:()=>V(d)}}function M(e){return e.state==="destroyed"}function be({chart:e,xAxis:n,yAxis:t}){const i=ce.new(e.root,{behavior:"none",xAxis:n,yAxis:t});i.lineY.set("visible",!1),e.set("cursor",i)}function ye(e){var s;const{chart:n,xAxis:t,theme:i}=e;t.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:U(e,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),t.axisHeader.set("forceHidden",!0);const o=t.get("renderer");o.setAll({inside:!1,minGridDistance:i.xAxisMinGridDistance}),o.labels.template.setAll({centerX:b,centerY:b,fill:x(i.axisLabelsColor),fontFamily:i.fontFamily,fontSize:i.axisLabelsFontSize,fontWeight:i.axisLabelsFontWeight,maxPosition:i.xAxisMaxLabelPosition,minPosition:i.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:i.xAxisLabelsSpacing});const a=t.set("tooltip",W.new(n.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));(s=a.get("background"))==null||s.setAll({fill:x(i.axisTooltipBackgroundColor),stroke:void 0}),a.label.setAll({fill:x(i.axisTooltipLabelColor),fontFamily:i.fontFamily,fontSize:i.axisTooltipFontSize,paddingBottom:i.axisTooltipPaddingBottom,paddingLeft:i.axisTooltipPaddingHorizontal,paddingRight:i.axisTooltipPaddingHorizontal,paddingTop:i.axisTooltipPaddingTop}),o.grid.template.setAll({strokeOpacity:1,stroke:x(i.axisGridStroke)})}function Te(e){const{yAxis:n,theme:t}=e;n.setAll({baseValue:v().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:U(e,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),n.axisHeader.set("visible",!1);const i=D(e.params.container),o=n.get("renderer");o.setAll({minGridDistance:t.yAxisMinGridDistance,opposite:i,inside:!0}),o.labels.template.setAll({centerX:b,centerY:pe,fill:x(t.axisLabelsColor),fontFamily:t.fontFamily,fontSize:t.axisLabelsFontSize,fontWeight:t.axisLabelsFontWeight,maxPosition:t.yAxisMaxLabelPosition,minPosition:t.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:i?0:t.yAxisLabelSpacing,paddingRight:i?t.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),o.grid.template.setAll({strokeOpacity:1,stroke:x(t.axisGridStroke)})}function Le(e,n){var l;if(M(e))return;const t=e.data??void 0,i=n.data??void 0;(l=e.chart.get("cursor"))==null||l.set("forceHidden",!(i!=null&&i.refined));const o=t!==i,a=(t==null?void 0:t.effectiveUnits)!==(i==null?void 0:i.effectiveUnits),s=(t==null?void 0:t.uniformScaling)!==(i==null?void 0:i.uniformScaling);e.data=i,e.messages=n.messages,(o||a)&&(Me(e),Pe(e)),s&&V(e),T(e)}function V(e){M(e)||(e.xAxis.zoom(0,1),e.yAxis.zoom(0,1))}function Me(e){const{chart:n,data:t,xAxis:i,yAxis:o}=e,{minX:a,maxX:s,minY:l,maxY:c}=Se({data:t,pixelWidth:i.width(),pixelHeight:o.height()}),r=!!(t!=null&&t.uniformScaling),d=!!(t!=null&&t.refined);n.setAll({panX:!0,panY:r,pinchZoomX:d,pinchZoomY:d&&r,wheelX:"panX",wheelY:d?r?"zoomXY":"zoomX":"none"}),i.setAll({max:s,min:a,panX:!0,panY:!1,zoomX:!0,zoomY:r}),o.setAll({max:c,min:l,panX:!1,panY:r,zoomX:r,zoomY:r})}function Se({data:e,pixelWidth:n,pixelHeight:t}){if(e==null)return y;const i=e.statistics,o=0,a=i==null?void 0:i.maxDistance;let s=i==null?void 0:i.minElevation,l=i==null?void 0:i.maxElevation;if(a==null||s==null||l==null)return y;const c=Math.max(a-o,z);let r=Math.max(l-s,z);const d=e.effectiveUnits;if(e.dynamicElevationRange){const p=G(c,d.distance,d.elevation);r=Math.max(r,p/v().maxChartRatio)}return s-=Ae*r,l=s+r+he*r,[s,l]=fe(s,l,10),r=l-s,e.uniformScaling?Fe({data:e,bounds:{minX:o,maxX:a,minY:s,maxY:l},pixelWidth:n,pixelHeight:t,centered:!0}):{minX:o,maxX:o+c,minY:s,maxY:s+r}}function Fe({data:e,bounds:n,pixelWidth:t,pixelHeight:i,centered:o}){if(e==null)return n;let{minX:a,maxX:s,minY:l,maxY:c}=n;if(a==null||s==null||l==null||c==null)return y;const r=s-a,d=c-l,p=e.effectiveUnits,u=G(d,p.elevation,p.distance)/i/(r/t);return u>=1?[a,s]=k([a,s],u,o):[l,c]=k([l,c],1/u,o),{minX:a,maxX:s,minY:l,maxY:c}}function k([e,n],t,i){const o=(n-e)*t;if(i){const a=(e+n)/2-o/2;return[a,a+o]}return[e,e+o]}function Pe(e){var r;const{chart:n,data:t,seriesInfos:i,xAxis:o,yAxis:a}=e;if(t==null||t.lines.length===0)return void n.series.clear();const s=new Map,l=new Set(n.series.values),c=t.lines.length;for(let d=0;d0,{line:s,fill:l}=n;s.set("visible",a),s.set("stroke",i),l==null||l.set("visible",a),l==null||l.set("fill",xe.lighten(i,e.seriesFillLighten)),s.data.setAll(o),l==null||l.data.setAll(o)}function Xe(e,n){const{id:t}=n,i=C(e,`${me}-${t}`);i.setAll({dy:n.chartStrokeOffsetY,tooltip:ze(e)}),i.strokes.template.setAll({strokeWidth:n.chartStrokeWidth});let o=null;return n.chartFillEnabled&&(o=C(e,`${ge}-${t}`),o.fills.template.setAll({fillOpacity:1,visible:!0})),{id:t,line:i,fill:o}}function C(e,n){return ue.new(e.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:n,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:e.xAxis,yAxis:e.yAxis})}function ze({theme:e,chart:n}){var a;const t=W.new(n.root,{forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),i=e.seriesTooltipPaddingHorizontal,o=e.seriesTooltipPaddingVertical;return t.label.setAll({fill:x(e.seriesTooltipLabelColor),fontFamily:e.fontFamily,fontSize:e.seriesTooltipFontSize,paddingBottom:o,paddingLeft:i,paddingRight:i,paddingTop:o,textAlign:"start"}),(a=t.get("background"))==null||a.setAll({stroke:void 0,fill:x(e.seriesTooltipBackgroundColor)}),t.adapters.add("dy",s=>{var r;const l=e.seriesTooltipSpacing,c=((r=t.get("pointTo"))==null?void 0:r.y)??0;return(s??0)+(t.y()>c?l:-l)}),t}function ke(e,n){const{xAxis:t,yAxis:i}=e,o=()=>{n(w(t),w(i))},a=s=>[s.on("start",o),s.on("end",o)];return j([...a(t),...a(i)])}function w(e){const n=Math.abs((e.get("end")??0)-(e.get("start")??0)),t=n!==0?1/n:1;return Math.abs(1-t){e.pointerIsOver=r,T(e)},c=()=>{l(!1),n(null,null)};return j([a==null?void 0:a.events.on("cursormoved",()=>{if(!e.pointerIsOver)return;T(e);let r=(a==null?void 0:a.getPrivate("positionX"))??0,d=(a==null?void 0:a.getPrivate("positionY"))??0;const p=e.data;if((p==null?void 0:p.statistics)!=null){const{maxDistance:u,minElevation:f,maxElevation:S}=p.statistics;u!=null&&(r=H(r,B(i),$(i),0,u)),f!=null&&S!=null&&(d=H(d,B(o),$(o),f,S))}n(r,d)}),s.on("pointerover",()=>l(!0)),s.on("pointerout",c),s.on("blur",c)])}function H(e,n,t,i,o){return(n+e*(t-n)-i)/(o-i)}function T(e){const n=we(e);if(!n)return void e.seriesInfos.forEach(t=>{var i;(i=t.line.get("tooltip"))==null||i.set("forceHidden",!0)});e.seriesInfos.forEach(t=>{const i=t.line.get("tooltip");i.set("forceHidden",!1),i.label.set("text",n)}),e.xAxis.getTooltip().setAll({tooltipText:$e(e)})}function we(e){const{data:n}=e,t=n==null?void 0:n.lines.map(i=>{var o;return{line:i,y:(o=Z(e,i))==null?void 0:o.elevation}}).sort(He);return t&&t.length!==0&&t[0].y!=null?t.map(({y:i,line:o})=>Be(e,o,i)).join(` +`):null}function He({y:e},{y:n}){return e==null?1:n==null?-1:n-e}function Be(e,n,t){const{data:i,messages:o}=e;if(i==null||o==null)return"";const a=v().formatPrecision,s=J(o.chartTooltip,{name:K(n,o),elevation:t!=null?O(o,t,i.effectiveUnits.elevation,a):Q});return`[${n.color.toHex()}]●[/] ${s}`}function $e(e){const{data:n,messages:t}=e;if(n==null||t==null)return"";const i=n.lines[0],o=i?Z(e,i):null,a=v().formatPrecision;return o!=null?O(t,o.distance,n.effectiveUnits.distance,a):"-"}function U(e,n){const t=se.new(e.chart.root,{});return t.format=(i,o,a)=>{const{data:s,messages:l}=e;return l==null||s==null||typeof i=="string"?"":`${ee(i,{maximumFractionDigits:a})} ${ie(l,s.effectiveUnits[n],"abbr")}`},t}function Z({chart:e,xAxis:n},t){const i=t.samples??[];if(i.length===0)return null;const o=e.get("cursor"),a=(o==null?void 0:o.getPrivate("positionX"))??0,s=n.toAxisPosition(a),l=n.positionToValue(s);return te(i,l,c=>c.distance)}function B(e){return e.positionToValue(e.get("start")??0)}function $(e){return e.positionToValue(e.get("end")??1)}function j(e){return R(e.map(L))}function L(e){return ne(()=>{e==null||e.dispose()})}export{je as createChart,Se as getAdjustedBounds}; diff --git a/dist/assets/chartUtils-P39aKol1.js b/dist/assets/chartUtils-P39aKol1.js deleted file mode 100644 index b450c4d..0000000 --- a/dist/assets/chartUtils-P39aKol1.js +++ /dev/null @@ -1,2 +0,0 @@ -import{d as F,l as _}from"./Responsive-QKXcW_1q.js";import{s as N,hv as q,hw as $,fv as R,gL as v,hx as G,hy as J,hz as K,cy as O,hA as Q,d8 as ee,hB as ie,hC as te,a2 as ne,hD as P,hE as oe}from"./index-J0iiHjMT.js";import{Y as ae,S as se}from"./chartUtilsAm5-QfmFJ3lc.js";import{o as le,u as Y,_ as re,b as de,r as ce,x as ue}from"./LineSeries-VcEznTH7.js";import{a2 as b,t as x,Y as pe,Z as xe}from"./Theme-QNc_77AM.js";import{u as W}from"./Tooltip-lrFZgXdG.js";import"./DefaultTheme-T7-VnRhA.js";import"./ColorSet-j9kKRPwP.js";import"./Tick-WQ_bPwW2.js";import"./Button-1STHXt3M.js";function fe(e,n,t=10){const i=X(n-e,!1);if(i===0)return[e,n];const o=X(i/(t-1),!0);return[Math.floor(e/o)*o,Math.ceil(n/o)*o]}function X(e,n){const t=Math.floor(Math.log10(e)),i=e/10**t;let o;return o=n?i<1.5?1:i<3?2:i<5?2.5:i<7?5:10:i<=1?1:i<=2?2:i<=3?2.5:i<=5?5:10,o*10**t}const A="#f8f8f8",E="#a9a9a9",g="#323232",me="line",ge="fill",h=15,m=12,z=.001,he=.1,Ae=.02,I={fontFamily:"Avenir Next",paddingBottom:m/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:E,axisTooltipFontSize:12,axisTooltipBackgroundColor:g,axisTooltipLabelColor:A,axisTooltipPaddingTop:Math.round(m/4),axisTooltipPaddingBottom:Math.round(m/4),axisTooltipPaddingHorizontal:Math.round(h/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(m/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(h/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:A,seriesTooltipLabelColor:g,seriesFillLighten:.9,seriesTooltipSpacing:m/2,seriesTooltipPaddingVertical:Math.round(h/4),seriesTooltipPaddingHorizontal:Math.round(h/4)},ve={...I,axisGridStroke:g,axisLabelsColor:E,axisTooltipBackgroundColor:g,axisTooltipLabelColor:A,seriesTooltipBackgroundColor:g,seriesTooltipLabelColor:A,seriesFillLighten:-.75},y={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function je(e){const n=await ae(e.container);N(e.abortOptions);const t=q(),i=t?ve:I;n.setThemes(t?[F.new(n),_.new(n)]:[F.new(n)]);const o=$(e.container),a=n.container.children.push(le.new(n,{panX:!0,panY:!0,paddingTop:i.paddingTop,paddingBottom:i.paddingBottom,paddingLeft:o?i.paddingRight:i.paddingLeft,paddingRight:o?i.paddingLeft:i.paddingRight,maxTooltipDistance:0}));a.zoomOutButton.set("forceHidden",!0);const s=a.xAxes.push(Y.new(n,{renderer:re.new(n,{})})),l=a.yAxes.push(Y.new(n,{renderer:de.new(n,{})})),c=P(null),r=P("loading"),d={params:e,chart:a,xAxis:s,yAxis:l,seriesInfos:new Map,messages:null,theme:i,pointerIsOver:!1,get state(){return r.value},get data(){return c.value},set data(u){c.value=u}};ye(d),Te(d),be(d);const p=R([Ce(d,e.onRangeChange),ke(d,e.onCursorPositionChange),L(n.events.once("frameended",()=>{r.value="ready"})),L(n)]);return{destroy:()=>{p.remove(),r.value="destroyed"},update:u=>{u.data===d.data&&u.messages===d.messages||M(d)||Le(d,u)},zoomOut:()=>V(d)}}function M(e){return e.state==="destroyed"}function be({chart:e,xAxis:n,yAxis:t}){const i=ce.new(e.root,{behavior:"none",xAxis:n,yAxis:t});i.lineY.set("visible",!1),e.set("cursor",i)}function ye(e){var s;const{chart:n,xAxis:t,theme:i}=e;t.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:U(e,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),t.axisHeader.set("forceHidden",!0);const o=t.get("renderer");o.setAll({inside:!1,minGridDistance:i.xAxisMinGridDistance}),o.labels.template.setAll({centerX:b,centerY:b,fill:x(i.axisLabelsColor),fontFamily:i.fontFamily,fontSize:i.axisLabelsFontSize,fontWeight:i.axisLabelsFontWeight,maxPosition:i.xAxisMaxLabelPosition,minPosition:i.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:i.xAxisLabelsSpacing});const a=t.set("tooltip",W.new(n.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));(s=a.get("background"))==null||s.setAll({fill:x(i.axisTooltipBackgroundColor),stroke:void 0}),a.label.setAll({fill:x(i.axisTooltipLabelColor),fontFamily:i.fontFamily,fontSize:i.axisTooltipFontSize,paddingBottom:i.axisTooltipPaddingBottom,paddingLeft:i.axisTooltipPaddingHorizontal,paddingRight:i.axisTooltipPaddingHorizontal,paddingTop:i.axisTooltipPaddingTop}),o.grid.template.setAll({strokeOpacity:1,stroke:x(i.axisGridStroke)})}function Te(e){const{yAxis:n,theme:t}=e;n.setAll({baseValue:v().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:U(e,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),n.axisHeader.set("visible",!1);const i=$(e.params.container),o=n.get("renderer");o.setAll({minGridDistance:t.yAxisMinGridDistance,opposite:i,inside:!0}),o.labels.template.setAll({centerX:b,centerY:pe,fill:x(t.axisLabelsColor),fontFamily:t.fontFamily,fontSize:t.axisLabelsFontSize,fontWeight:t.axisLabelsFontWeight,maxPosition:t.yAxisMaxLabelPosition,minPosition:t.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:i?0:t.yAxisLabelSpacing,paddingRight:i?t.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),o.grid.template.setAll({strokeOpacity:1,stroke:x(t.axisGridStroke)})}function Le(e,n){var l;if(M(e))return;const t=e.data??void 0,i=n.data??void 0;(l=e.chart.get("cursor"))==null||l.set("forceHidden",!(i!=null&&i.refined));const o=t!==i,a=(t==null?void 0:t.effectiveUnits)!==(i==null?void 0:i.effectiveUnits),s=(t==null?void 0:t.uniformScaling)!==(i==null?void 0:i.uniformScaling);e.data=i,e.messages=n.messages,(o||a)&&(Me(e),Pe(e)),s&&V(e),T(e)}function V(e){M(e)||(e.xAxis.zoom(0,1),e.yAxis.zoom(0,1))}function Me(e){const{chart:n,data:t,xAxis:i,yAxis:o}=e,{minX:a,maxX:s,minY:l,maxY:c}=Se({data:t,pixelWidth:i.width(),pixelHeight:o.height()}),r=!!(t!=null&&t.uniformScaling),d=!!(t!=null&&t.refined);n.setAll({panX:!0,panY:r,pinchZoomX:d,pinchZoomY:d&&r,wheelX:"panX",wheelY:d?r?"zoomXY":"zoomX":"none"}),i.setAll({max:s,min:a,panX:!0,panY:!1,zoomX:!0,zoomY:r}),o.setAll({max:c,min:l,panX:!1,panY:r,zoomX:r,zoomY:r})}function Se({data:e,pixelWidth:n,pixelHeight:t}){if(e==null)return y;const i=e.statistics,o=0,a=i==null?void 0:i.maxDistance;let s=i==null?void 0:i.minElevation,l=i==null?void 0:i.maxElevation;if(a==null||s==null||l==null)return y;const c=Math.max(a-o,z);let r=Math.max(l-s,z);const d=e.effectiveUnits;if(e.dynamicElevationRange){const p=G(c,d.distance,d.elevation);r=Math.max(r,p/v().maxChartRatio)}return s-=Ae*r,l=s+r+he*r,[s,l]=fe(s,l,10),r=l-s,e.uniformScaling?Fe({data:e,bounds:{minX:o,maxX:a,minY:s,maxY:l},pixelWidth:n,pixelHeight:t,centered:!0}):{minX:o,maxX:o+c,minY:s,maxY:s+r}}function Fe({data:e,bounds:n,pixelWidth:t,pixelHeight:i,centered:o}){if(e==null)return n;let{minX:a,maxX:s,minY:l,maxY:c}=n;if(a==null||s==null||l==null||c==null)return y;const r=s-a,d=c-l,p=e.effectiveUnits,u=G(d,p.elevation,p.distance)/i/(r/t);return u>=1?[a,s]=C([a,s],u,o):[l,c]=C([l,c],1/u,o),{minX:a,maxX:s,minY:l,maxY:c}}function C([e,n],t,i){const o=(n-e)*t;if(i){const a=(e+n)/2-o/2;return[a,a+o]}return[e,e+o]}function Pe(e){var r;const{chart:n,data:t,seriesInfos:i,xAxis:o,yAxis:a}=e;if(t==null||t.lines.length===0)return void n.series.clear();const s=new Map,l=new Set(n.series.values),c=t.lines.length;for(let d=0;d0,{line:s,fill:l}=n;s.set("visible",a),s.set("stroke",i),l==null||l.set("visible",a),l==null||l.set("fill",xe.lighten(i,e.seriesFillLighten)),s.data.setAll(o),l==null||l.data.setAll(o)}function Xe(e,n){const{id:t}=n,i=k(e,`${me}-${t}`);i.setAll({dy:n.chartStrokeOffsetY,tooltip:ze(e)}),i.strokes.template.setAll({strokeWidth:n.chartStrokeWidth});let o=null;return n.chartFillEnabled&&(o=k(e,`${ge}-${t}`),o.fills.template.setAll({fillOpacity:1,visible:!0})),{id:t,line:i,fill:o}}function k(e,n){return ue.new(e.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:n,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:e.xAxis,yAxis:e.yAxis})}function ze({theme:e,chart:n}){var a;const t=W.new(n.root,{forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),i=e.seriesTooltipPaddingHorizontal,o=e.seriesTooltipPaddingVertical;return t.label.setAll({fill:x(e.seriesTooltipLabelColor),fontFamily:e.fontFamily,fontSize:e.seriesTooltipFontSize,paddingBottom:o,paddingLeft:i,paddingRight:i,paddingTop:o,textAlign:"start"}),(a=t.get("background"))==null||a.setAll({stroke:void 0,fill:x(e.seriesTooltipBackgroundColor)}),t.adapters.add("dy",s=>{var r;const l=e.seriesTooltipSpacing,c=((r=t.get("pointTo"))==null?void 0:r.y)??0;return(s??0)+(t.y()>c?l:-l)}),t}function Ce(e,n){const{xAxis:t,yAxis:i}=e,o=()=>{n(w(t),w(i))},a=s=>[s.on("start",o),s.on("end",o)];return j([...a(t),...a(i)])}function w(e){const n=Math.abs((e.get("end")??0)-(e.get("start")??0)),t=n!==0?1/n:1;return Math.abs(1-t){e.pointerIsOver=r,T(e)},c=()=>{l(!1),n(null,null)};return j([a==null?void 0:a.events.on("cursormoved",()=>{if(!e.pointerIsOver)return;T(e);let r=(a==null?void 0:a.getPrivate("positionX"))??0,d=(a==null?void 0:a.getPrivate("positionY"))??0;const p=e.data;if((p==null?void 0:p.statistics)!=null){const{maxDistance:u,minElevation:f,maxElevation:S}=p.statistics;u!=null&&(r=B(r,H(i),D(i),0,u)),f!=null&&S!=null&&(d=B(d,H(o),D(o),f,S))}n(r,d)}),s.on("pointerover",()=>l(!0)),s.on("pointerout",c),s.on("blur",c)])}function B(e,n,t,i,o){return(n+e*(t-n)-i)/(o-i)}function T(e){const n=we(e);if(!n)return void e.seriesInfos.forEach(t=>{var i;(i=t.line.get("tooltip"))==null||i.set("forceHidden",!0)});e.seriesInfos.forEach(t=>{const i=t.line.get("tooltip");i.set("forceHidden",!1),i.label.set("text",n)}),e.xAxis.getTooltip().setAll({tooltipText:De(e)})}function we(e){const{data:n}=e,t=n==null?void 0:n.lines.map(i=>{var o;return{line:i,y:(o=Z(e,i))==null?void 0:o.elevation}}).sort(Be);return t&&t.length!==0&&t[0].y!=null?t.map(({y:i,line:o})=>He(e,o,i)).join(` -`):null}function Be({y:e},{y:n}){return e==null?1:n==null?-1:n-e}function He(e,n,t){const{data:i,messages:o}=e;if(i==null||o==null)return"";const a=v().formatPrecision,s=J(o.chartTooltip,{name:K(n,o),elevation:t!=null?O(o,t,i.effectiveUnits.elevation,a):Q});return`[${n.color.toHex()}]●[/] ${s}`}function De(e){const{data:n,messages:t}=e;if(n==null||t==null)return"";const i=n.lines[0],o=i?Z(e,i):null,a=v().formatPrecision;return o!=null?O(t,o.distance,n.effectiveUnits.distance,a):"-"}function U(e,n){const t=se.new(e.chart.root,{});return t.format=(i,o,a)=>{const{data:s,messages:l}=e;return l==null||s==null||typeof i=="string"?"":`${ee(i,{maximumFractionDigits:a})} ${ie(l,s.effectiveUnits[n],"abbr")}`},t}function Z({chart:e,xAxis:n},t){const i=t.samples??[];if(i.length===0)return null;const o=e.get("cursor"),a=(o==null?void 0:o.getPrivate("positionX"))??0,s=n.toAxisPosition(a),l=n.positionToValue(s);return te(i,l,c=>c.distance)}function H(e){return e.positionToValue(e.get("start")??0)}function D(e){return e.positionToValue(e.get("end")??1)}function j(e){return R(e.map(L))}function L(e){return ne(()=>{e==null||e.dispose()})}export{je as createChart,Se as getAdjustedBounds}; diff --git a/dist/assets/chartUtilsAm5-QfmFJ3lc.js b/dist/assets/chartUtilsAm5-owLhGEU2.js similarity index 99% rename from dist/assets/chartUtilsAm5-QfmFJ3lc.js rename to dist/assets/chartUtilsAm5-owLhGEU2.js index ff6d7e7..ca5793f 100644 --- a/dist/assets/chartUtilsAm5-QfmFJ3lc.js +++ b/dist/assets/chartUtilsAm5-owLhGEU2.js @@ -1,4 +1,4 @@ -import{mF as nt,de as w}from"./index-J0iiHjMT.js";import{E as te,a3 as ot,a4 as pe,a5 as qe,a6 as De,J as lt,a7 as Q,a8 as K,q as ue,a9 as ht,aa as U,ab as ut,ac as ct,ad as dt,A as bt,ae as _t,m as v,af as ie,Q as q,z as Ze,Y as Z,V as ft,t as re,W as ze,ag as J,r as ge,c as A,ah as pt,ai as gt,aj as me,$ as se,ak as mt,al as X,y as Ce,am as yt,v as ae,an as Ie,ao as Te,a1 as vt,M as wt,ap as Je,l as H,aq as xt,ar as C,as as de,at as be,au as Re,av as Pt,aw as Fe,ax as Ot,ay as kt,az as V,aA as Ye,aB as Et,_ as Mt,aC as St,aD as Tt,Z as ee,aE as xe,aF as jt,H as He,aG as je,aH as Ke,D as Dt,aI as Ct,aJ as Qe,K as et,U as Bt,aK as At,aL as Lt,N as zt,aM as le,aN as Pe}from"./Theme-QNc_77AM.js";import{u as Ve}from"./Tooltip-lrFZgXdG.js";import{s as It}from"./DefaultTheme-T7-VnRhA.js";class Rt{constructor(){Object.defineProperty(this,"_observer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_targets",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this._observer=new ResizeObserver(e=>{v(e,t=>{v(this._targets,i=>{i.target===t.target&&i.callback()})})})}addTarget(e,t){this._observer.observe(e,{box:"border-box"}),this._targets.push({target:e,callback:t})}removeTarget(e){this._observer.unobserve(e),me(this._targets,t=>t.target!==e)}}class ye{constructor(){Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_targets",{enumerable:!0,configurable:!0,writable:!0,value:[]})}addTarget(e,t){if(this._timer===null){let r=null;const a=()=>{const s=Date.now();(r===null||s>r+ye.delay)&&(r=s,v(this._targets,n=>{let u=n.target.getBoundingClientRect();u.width===n.size.width&&u.height===n.size.height||(n.size=u,n.callback())})),this._targets.length===0?this._timer=null:this._timer=requestAnimationFrame(a)};this._timer=requestAnimationFrame(a)}let i={width:0,height:0,left:0,right:0,top:0,bottom:0,x:0,y:0};this._targets.push({target:e,callback:t,size:i})}removeTarget(e){me(this._targets,t=>t.target!==e),this._targets.length===0&&this._timer!==null&&(cancelAnimationFrame(this._timer),this._timer=null)}}Object.defineProperty(ye,"delay",{enumerable:!0,configurable:!0,writable:!0,value:200});let Oe=null;function Ft(){return Oe===null&&(Oe=typeof ResizeObserver<"u"?new Rt:new ye),Oe}class Yt{constructor(e,t){Object.defineProperty(this,"_sensor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this._sensor=Ft(),this._element=e,this._listener=Je(t),this._sensor.addTarget(e,t)}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this._sensor.removeTarget(this._element),this._listener.dispose())}get sensor(){return this._sensor}}class fe extends te{}Object.defineProperty(fe,"className",{enumerable:!0,configurable:!0,writable:!0,value:"InterfaceColors"}),Object.defineProperty(fe,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:te.classNames.concat([fe.className])});class Ht extends te{_setDefaults(){this._setDefault("negativeBase",0),this._setDefault("numberFormat","#,###.#####"),this._setDefault("smallNumberThreshold",1);const e="_big_number_suffix_",t="_small_number_suffix_",i="_byte_suffix_";this._setDefault("bigNumberPrefixes",[{number:1e3,suffix:this._t(e+"3")},{number:1e6,suffix:this._t(e+"6")},{number:1e9,suffix:this._t(e+"9")},{number:1e12,suffix:this._t(e+"12")},{number:1e15,suffix:this._t(e+"15")},{number:1e18,suffix:this._t(e+"18")},{number:1e21,suffix:this._t(e+"21")},{number:1e24,suffix:this._t(e+"24")}]),this._setDefault("smallNumberPrefixes",[{number:1e-24,suffix:this._t(t+"24")},{number:1e-21,suffix:this._t(t+"21")},{number:1e-18,suffix:this._t(t+"18")},{number:1e-15,suffix:this._t(t+"15")},{number:1e-12,suffix:this._t(t+"12")},{number:1e-9,suffix:this._t(t+"9")},{number:1e-6,suffix:this._t(t+"6")},{number:.001,suffix:this._t(t+"3")}]),this._setDefault("bytePrefixes",[{number:1,suffix:this._t(i+"B")},{number:1024,suffix:this._t(i+"KB")},{number:1048576,suffix:this._t(i+"MB")},{number:1073741824,suffix:this._t(i+"GB")},{number:1099511627776,suffix:this._t(i+"TB")},{number:0x4000000000000,suffix:this._t(i+"PB")}]),super._setDefaults()}_beforeChanged(){super._beforeChanged()}format(e,t,i){let r;(t==null||pe(t)&&t.toLowerCase()==="number")&&(t=this.get("numberFormat",""));let a=Number(e);if(qe(t))try{return this.get("intlLocales")?new Intl.NumberFormat(this.get("intlLocales"),t).format(a):new Intl.NumberFormat(void 0,t).format(a)}catch{return"Invalid"}else{t=De(t);let s,n=this.parseFormat(t,this._root.language);s=a>this.get("negativeBase")?n.positive:a{if(u.parsed)return;let h=u.source;h.toLowerCase()==="number"&&(h=this.get("numberFormat","#,###.#####"));let p=U.chunk(h,!0);for(let c=0;c=0?e.toExponential(t.decimals.passive).split("e"):e.toExponential().split("e"),e=Number(c[0]),a="e"+c[1],t.modSpacing&&(a=" "+a)}else if(t.decimals.passive===0)e=Math.round(e);else if(t.decimals.passive>0){let c=Math.pow(10,t.decimals.passive);e=Math.round(e*c)/c}let n="",u=ht(e).split("."),h=u[0];if(h.length0){let c=[],b=h.split("").reverse().join("");for(let l=0,m=h.length;l<=m;l+=t.thousands.interval){let o=b.substr(l,t.thousands.interval).split("").reverse().join("");o!==""&&c.unshift(o)}h=c.join(t.thousands.separator)}n+=h,u.length===1&&u.push("");let p=u[1];return p.length{switch(p.type){case"year":t=+p.value;break;case"month":i=+p.value-1;break;case"day":r=+p.value;break;case"hour":a=+p.value;break;case"minute":s=+p.value;break;case"second":n=+p.value;break;case"fractionalSecond":u=+p.value;break;case"weekday":switch(p.value){case"Sun":h=0;break;case"Mon":h=1;break;case"Tue":h=2;break;case"Wed":h=3;break;case"Thu":h=4;break;case"Fri":h=5;break;case"Sat":h=6}}}),a===24&&(a=0),{year:t,month:i,day:r,hour:a,minute:s,second:n,millisecond:u,weekday:h}}function We(d,e){const{year:t,month:i,day:r,hour:a,minute:s,second:n,millisecond:u}=tt(d,e);return Date.UTC(t,i,r,a,s,n,u)}class Vt{constructor(e,t){if(Object.defineProperty(this,"_utc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dtf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!t)throw new Error("You cannot use `new Class()`, instead use `Class.new()`");this.name=e,this._utc=new Intl.DateTimeFormat("UTC",{hour12:!1,timeZone:"UTC",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",fractionalSecondDigits:3}),this._dtf=new Intl.DateTimeFormat("UTC",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",fractionalSecondDigits:3})}static new(e){return new this(e,!0)}convertLocal(e){const t=this.offsetUTC(e),i=e.getTimezoneOffset(),r=new Date(e);r.setUTCMinutes(r.getUTCMinutes()-(t-i));const a=r.getTimezoneOffset();return i!=a&&r.setUTCMinutes(r.getUTCMinutes()+a-i),r}offsetUTC(e){return(We(this._utc,e)-We(this._dtf,e))/6e4}parseDate(e){return tt(this._dtf,e)}}class Wt extends te{_setDefaults(){this._setDefault("capitalize",!0),this._setDefault("dateFormat","yyyy-MM-dd"),super._setDefaults()}_beforeChanged(){super._beforeChanged()}format(e,t){let i;t!==void 0&&t!==""||(t=this.get("dateFormat","yyyy-MM-dd"));let r=e;if(qe(t))try{const n=this.get("intlLocales");return n?new Intl.DateTimeFormat(n,t).format(r):new Intl.DateTimeFormat(void 0,t).format(r)}catch{return"Invalid"}let a=this.parseFormat(t);const s=this._root.timezone;return s&&!this._root.utc&&(r=s.convertLocal(r)),H(r.getTime())?(i=this.applyFormat(r,a),this.get("capitalize")&&(i=i.replace(/^.{1}/,i.substr(0,1).toUpperCase())),i):"Invalid date"}applyFormat(e,t){let i,r,a,s,n,u,h,p,c=t.template,b=e.getTime();this._root.utc?(i=e.getUTCFullYear(),r=e.getUTCMonth(),a=e.getUTCDay(),s=e.getUTCDate(),n=e.getUTCHours(),u=e.getUTCMinutes(),h=e.getUTCSeconds(),p=e.getUTCMilliseconds()):(i=e.getFullYear(),r=e.getMonth(),a=e.getDay(),s=e.getDate(),n=e.getHours(),u=e.getMinutes(),h=e.getSeconds(),p=e.getMilliseconds());for(let l=0,m=t.parts.length;l=12?this._t("PM"):this._t("AM");break;case"aa":o=n>=12?this._t("P.M."):this._t("A.M.");break;case"aaa":o=n>=12?this._t("P"):this._t("A");break;case"h":o=be(n).toString();break;case"hh":o=C(be(n),2,"0");break;case"H":o=n.toString();break;case"HH":o=C(n,2,"0");break;case"K":o=be(n,0).toString();break;case"KK":o=C(be(n,0),2,"0");break;case"k":o=(n+1).toString();break;case"kk":o=C(n+1,2,"0");break;case"m":o=u.toString();break;case"mm":o=C(u,2,"0");break;case"s":o=h.toString();break;case"ss":o=C(h,2,"0");break;case"S":case"SS":case"SSS":o=Math.round(p/1e3*Math.pow(10,t.parts[l].length)).toString();break;case"x":o=b.toString();break;case"n":case"nn":case"nnn":o=C(p,t.parts[l].length,"0");break;case"z":o=de(e,!1,!1,this._root.utc,this._root.timezone?this._root.timezone.name:void 0);break;case"zz":o=de(e,!0,!1,this._root.utc,this._root.timezone?this._root.timezone.name:void 0);break;case"zzz":o=de(e,!1,!0,this._root.utc,this._root.timezone?this._root.timezone.name:void 0);break;case"zzzz":o=de(e,!0,!0,this._root.utc,this._root.timezone?this._root.timezone.name:void 0);break;case"Z":case"ZZ":let g=this._root.utc?"UTC":this._root.timezone;g instanceof Vt&&(g=g.name);const x=g?xt(g):e.getTimezoneOffset();let y=Math.abs(x)/60,_=Math.floor(y),P=60*y-60*_;this._root.utc&&(_=0,P=0),t.parts[l]=="Z"?(o="GMT",o+=x>0?"-":"+",o+=C(_,2)+":"+C(P,2)):(o=x>0?"-":"+",o+=C(_,2)+C(P,2));break;case"i":o=e.toISOString();break;case"I":o=e.toUTCString()}c=c.replace(Q,o)}return c}parseFormat(e){let t={template:"",parts:[]},i=U.chunk(e,!0);for(let r=0;r-1&&(n.year=parseInt(c[s.year])),s.year3>-1){let b=parseInt(c[s.year3]);b+=1e3,n.year=b}if(s.year2>-1){let b=parseInt(c[s.year2]);b+=b>50?1e3:2e3,n.year=b}if(s.year1>-1){let b=parseInt(c[s.year1]);b=10*Math.floor(new Date().getFullYear()/10)+b,n.year=b}if(s.monthLong>-1&&(n.month=this.resolveMonth(c[s.monthLong])),s.monthShort>-1&&(n.month=this.resolveShortMonth(c[s.monthShort])),s.month>-1&&(n.month=parseInt(c[s.month])-1),s.week>-1&&s.day===-1&&(n.month=0,n.day=kt(parseInt(c[s.week]),n.year,1,this._root.utc)),s.day>-1&&(n.day=parseInt(c[s.day])),s.yearDay>-1&&(n.month=0,n.day=parseInt(c[s.yearDay])),s.hourBase0>-1&&(n.hour=parseInt(c[s.hourBase0])),s.hourBase1>-1&&(n.hour=parseInt(c[s.hourBase1])-1),s.hour12Base0>-1){let b=parseInt(c[s.hour12Base0]);b==11&&(b=0),s.am>-1&&!this.isAm(c[s.am])&&(b+=12),n.hour=b}if(s.hour12Base1>-1){let b=parseInt(c[s.hour12Base1]);b==12&&(b=0),s.am>-1&&!this.isAm(c[s.am])&&(b+=12),n.hour=b}if(s.minute>-1&&(n.minute=parseInt(c[s.minute])),s.second>-1&&(n.second=parseInt(c[s.second])),s.millisecond>-1){let b=parseInt(c[s.millisecond]);s.millisecondDigits==2?b*=10:s.millisecondDigits==1&&(b*=100),n.millisecond=b}if(s.timestamp>-1){n.timestamp=parseInt(c[s.timestamp]);const b=new Date(n.timestamp);n.year=b.getUTCFullYear(),n.month=b.getUTCMonth(),n.day=b.getUTCDate(),n.hour=b.getUTCHours(),n.minute=b.getUTCMinutes(),n.second=b.getUTCSeconds(),n.millisecond=b.getUTCMilliseconds()}s.zone>-1&&(n.offset=this.resolveTimezoneOffset(new Date(n.year,n.month,n.day),c[s.zone])),s.iso>-1&&(n.year=V(c[s.iso+0]),n.month=V(c[s.iso+1])-1,n.day=V(c[s.iso+2]),n.hour=V(c[s.iso+3]),n.minute=V(c[s.iso+4]),n.second=V(c[s.iso+5]),n.millisecond=V(c[s.iso+6]),c[s.iso+7]=="Z"||c[s.iso+7]=="z"?n.utc=!0:c[s.iso+7]!=""&&(n.offset=this.resolveTimezoneOffset(new Date(n.year,n.month,n.day),c[s.iso+7]))),i=n.utc?new Date(Date.UTC(n.year,n.month,n.day,n.hour,n.minute,n.second,n.millisecond)):new Date(n.year,n.month,n.day,n.hour,n.minute+n.offset,n.second,n.millisecond)}else i=new Date(e);return i}resolveTimezoneOffset(e,t){if(t.match(/([+\-]?)([0-9]{2}):?([0-9]{2})/)){let i=t.match(/([+\-]?)([0-9]{2}):?([0-9]{2})/),r=i[1],a=i[2],s=i[3],n=60*parseInt(a)+parseInt(s);return r=="+"&&(n*=-1),n-(e||new Date).getTimezoneOffset()}return 0}resolveMonth(e){let t=this._months().indexOf(e);return t>-1||!this._root.language.isDefault()&&(t=this._root.language.translateAll(this._months()).indexOf(e),t>-1)?t:0}resolveShortMonth(e){let t=this._shortMonths().indexOf(e);return t>-1?t:(t=this._months().indexOf(e),t>-1||this._root.language&&!this._root.language.isDefault()&&(t=this._root.language.translateAll(this._shortMonths()).indexOf(e),t>-1)?t:0)}isAm(e){return this.getStringList(["AM","A.M.","A"]).indexOf(e.toUpperCase())>-1}getStringList(e){let t=[];for(let i=0;ithis.get("negativeBase")?s.positive:n{if(n.parsed)return;let u=n.source,h=[];h=n.source.match(/^\[([^\]]*)\]/),h&&h.length&&h[0]!==""&&(u=n.source.substr(h[0].length),n.color=h[1]);let p=U.chunk(u,!0);for(let c=0;c{if(a==t||i){if(r/s<=1)return i||(i=a),!1;i=a}return!0}),i}getMilliseconds(e,t){return t||(t=this.get("baseUnit")),e*this._getUnitValue(t)}_getUnitValue(e){return this._getUnitValues()[e]}_getUnitValues(){return{millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:2592e6,year:31536e6}}}const it={firstDayOfWeek:1,_decimalSeparator:".",_thousandSeparator:",",_percentPrefix:null,_percentSuffix:"%",_big_number_suffix_3:"k",_big_number_suffix_6:"M",_big_number_suffix_9:"G",_big_number_suffix_12:"T",_big_number_suffix_15:"P",_big_number_suffix_18:"E",_big_number_suffix_21:"Z",_big_number_suffix_24:"Y",_small_number_suffix_3:"m",_small_number_suffix_6:"μ",_small_number_suffix_9:"n",_small_number_suffix_12:"p",_small_number_suffix_15:"f",_small_number_suffix_18:"a",_small_number_suffix_21:"z",_small_number_suffix_24:"y",_byte_suffix_B:"B",_byte_suffix_KB:"KB",_byte_suffix_MB:"MB",_byte_suffix_GB:"GB",_byte_suffix_TB:"TB",_byte_suffix_PB:"PB",_date:"yyyy-MM-dd",_date_millisecond:"mm:ss SSS",_date_millisecond_full:"HH:mm:ss SSS",_date_second:"HH:mm:ss",_date_second_full:"HH:mm:ss",_date_minute:"HH:mm",_date_minute_full:"HH:mm - MMM dd, yyyy",_date_hour:"HH:mm",_date_hour_full:"HH:mm - MMM dd, yyyy",_date_day:"MMM dd",_date_day_full:"MMM dd, yyyy",_date_week:"ww",_date_week_full:"MMM dd, yyyy",_date_month:"MMM",_date_month_full:"MMM, yyyy",_date_year:"yyyy",_duration_millisecond:"SSS",_duration_millisecond_second:"ss.SSS",_duration_millisecond_minute:"mm:ss SSS",_duration_millisecond_hour:"hh:mm:ss SSS",_duration_millisecond_day:"d'd' mm:ss SSS",_duration_millisecond_week:"d'd' mm:ss SSS",_duration_millisecond_month:"M'm' dd'd' mm:ss SSS",_duration_millisecond_year:"y'y' MM'm' dd'd' mm:ss SSS",_duration_second:"ss",_duration_second_minute:"mm:ss",_duration_second_hour:"hh:mm:ss",_duration_second_day:"d'd' hh:mm:ss",_duration_second_week:"d'd' hh:mm:ss",_duration_second_month:"M'm' dd'd' hh:mm:ss",_duration_second_year:"y'y' MM'm' dd'd' hh:mm:ss",_duration_minute:"mm",_duration_minute_hour:"hh:mm",_duration_minute_day:"d'd' hh:mm",_duration_minute_week:"d'd' hh:mm",_duration_minute_month:"M'm' dd'd' hh:mm",_duration_minute_year:"y'y' MM'm' dd'd' hh:mm",_duration_hour:"hh'h'",_duration_hour_day:"d'd' hh'h'",_duration_hour_week:"d'd' hh'h'",_duration_hour_month:"M'm' dd'd' hh'h'",_duration_hour_year:"y'y' MM'm' dd'd' hh'h'",_duration_day:"d'd'",_duration_day_week:"d'd'",_duration_day_month:"M'm' dd'd'",_duration_day_year:"y'y' MM'm' dd'd'",_duration_week:"w'w'",_duration_week_month:"w'w'",_duration_week_year:"w'w'",_duration_month:"M'm'",_duration_month_year:"y'y' MM'm'",_duration_year:"y'y'",_era_ad:"AD",_era_bc:"BC",A:"",P:"",AM:"",PM:"","A.M.":"","P.M.":"",January:"",February:"",March:"",April:"",May:"",June:"",July:"",August:"",September:"",October:"",November:"",December:"",Jan:"",Feb:"",Mar:"",Apr:"","May(short)":"May",Jun:"",Jul:"",Aug:"",Sep:"",Oct:"",Nov:"",Dec:"",Sunday:"",Monday:"",Tuesday:"",Wednesday:"",Thursday:"",Friday:"",Saturday:"",Sun:"",Mon:"",Tue:"",Wed:"",Thu:"",Fri:"",Sat:"",_dateOrd:function(d){let e="th";if(d<11||d>13)switch(d%10){case 1:e="st";break;case 2:e="nd";break;case 3:e="rd"}return e},"Zoom Out":"",Play:"",Stop:"",Legend:"","Press ENTER to toggle":"",Loading:"",Home:"",Chart:"","Serial chart":"","X/Y chart":"","Pie chart":"","Gauge chart":"","Radar chart":"","Sankey diagram":"","Flow diagram":"","Chord diagram":"","TreeMap chart":"","Force directed tree":"","Sliced chart":"",Series:"","Candlestick Series":"","OHLC Series":"","Column Series":"","Line Series":"","Pie Slice Series":"","Funnel Series":"","Pyramid Series":"","X/Y Series":"",Map:"","Press ENTER to zoom in":"","Press ENTER to zoom out":"","Use arrow keys to zoom in and out":"","Use plus and minus keys on your keyboard to zoom in and out":"",Export:"",Image:"",Data:"",Print:"","Press ENTER or use arrow keys to navigate":"","Press ENTER to open":"","Press ENTER to print.":"","Press ENTER to export as %1.":"","(Press ESC to close this message)":"","Image Export Complete":"","Export operation took longer than expected. Something might have gone wrong.":"","Saved from":"",PNG:"",JPG:"",GIF:"",SVG:"",PDF:"",JSON:"",CSV:"",XLSX:"",HTML:"","Use TAB to select grip buttons or left and right arrows to change selection":"","Use left and right arrows to move selection":"","Use left and right arrows to move left selection":"","Use left and right arrows to move right selection":"","Use TAB select grip buttons or up and down arrows to change selection":"","Use up and down arrows to move selection":"","Use up and down arrows to move lower selection":"","Use up and down arrows to move upper selection":"","From %1 to %2":"","From %1":"","To %1":"","No parser available for file: %1":"","Error parsing file: %1":"","Unable to load file: %1":"","Invalid date":"",Close:"",Minimize:""};class $t extends te{_setDefaults(){this.setPrivate("defaultLocale",it),super._setDefaults()}translate(e,t,...i){t||(t=this._root.locale||this.getPrivate("defaultLocale"));let r=e,a=t[e];if(a===null)r="";else if(a!=null)a&&(r=a);else if(t!==this.getPrivate("defaultLocale"))return this.translate(e,this.getPrivate("defaultLocale"),...i);if(i.length)for(let s=i.length,n=0;n{this.setTranslationAny(i,r,t)})}translateEmpty(e,t,...i){let r=this.translate(e,t,...i);return r==e?"":r}translateFunc(e,t){return this._root.locale[e]?this._root.locale[e]:t!==this.getPrivate("defaultLocale")?this.translateFunc(e,this.getPrivate("defaultLocale")):()=>""}translateAll(e,t){return this.isDefault()?e:Mt(e,i=>this.translate(i,t))}isDefault(){return this.getPrivate("defaultLocale")===this._root.locale}}class ke{constructor(e=1,t=0,i=0,r=1,a=0,s=0){Object.defineProperty(this,"a",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"b",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"c",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"d",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.a=e,this.b=t,this.c=i,this.d=r,this.tx=a,this.ty=s}setTransform(e,t,i,r,a,s=1){this.a=Math.cos(a)*s,this.b=Math.sin(a)*s,this.c=-Math.sin(a)*s,this.d=Math.cos(a)*s,this.tx=e-(i*this.a+r*this.c),this.ty=t-(i*this.b+r*this.d)}apply(e){return{x:this.a*e.x+this.c*e.y+this.tx,y:this.b*e.x+this.d*e.y+this.ty}}applyInverse(e){const t=1/(this.a*this.d+this.c*-this.b);return{x:this.d*t*e.x+-this.c*t*e.y+(this.ty*this.c-this.tx*this.d)*t,y:this.a*t*e.y+-this.b*t*e.x+(-this.ty*this.a+this.tx*this.b)*t}}append(e){const t=this.a,i=this.b,r=this.c,a=this.d;this.a=e.a*t+e.b*r,this.b=e.a*i+e.b*a,this.c=e.c*t+e.d*r,this.d=e.c*i+e.d*a,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*i+e.ty*a+this.ty}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const i=this.a,r=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=r*e.a+this.d*e.c,this.d=r*e.b+this.d*e.d}this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty}copyFrom(e){this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty}}var Xt=function(){function d(e,t){var i=[],r=!0,a=!1,s=void 0;try{for(var n,u=e[Symbol.iterator]();!(r=(n=u.next()).done)&&(i.push(n.value),!t||i.length!==t);r=!0);}catch(h){a=!0,s=h}finally{try{!r&&u.return&&u.return()}finally{if(a)throw s}}return i}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return d(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),he=2*Math.PI,Ee=function(d,e,t,i,r,a,s){var n=d.x,u=d.y;return{x:i*(n*=e)-r*(u*=t)+a,y:r*n+i*u+s}},Nt=function(d,e){var t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=Math.cos(d),r=Math.sin(d),a=Math.cos(d+e),s=Math.sin(d+e);return[{x:i-r*t,y:r+i*t},{x:a+s*t,y:s-a*t},{x:a,y:s}]},Ue=function(d,e,t,i){var r=d*t+e*i;return r>1&&(r=1),r<-1&&(r=-1),(d*i-e*t<0?-1:1)*Math.acos(r)},Gt=function(d,e,t,i,r,a,s,n,u,h,p,c){var b=Math.pow(r,2),l=Math.pow(a,2),m=Math.pow(p,2),o=Math.pow(c,2),f=b*l-b*o-l*m;f<0&&(f=0),f/=b*o+l*m;var g=(f=Math.sqrt(f)*(s===n?-1:1))*r/a*c,x=f*-a/r*p,y=h*g-u*x+(d+t)/2,_=u*g+h*x+(e+i)/2,P=(p-g)/r,E=(c-x)/a,S=(-p-g)/r,T=(-c-x)/a,D=Ue(1,0,P,E),O=Ue(P,E,S,T);return n===0&&O>0&&(O-=he),n===1&&O<0&&(O+=he),[y,_,D,O]},qt=function(d){var e=d.px,t=d.py,i=d.cx,r=d.cy,a=d.rx,s=d.ry,n=d.xAxisRotation,u=n===void 0?0:n,h=d.largeArcFlag,p=h===void 0?0:h,c=d.sweepFlag,b=c===void 0?0:c,l=[];if(a===0||s===0)return[];var m=Math.sin(u*he/360),o=Math.cos(u*he/360),f=o*(e-i)/2+m*(t-r)/2,g=-m*(e-i)/2+o*(t-r)/2;if(f===0&&g===0)return[];a=Math.abs(a),s=Math.abs(s);var x=Math.pow(f,2)/Math.pow(a,2)+Math.pow(g,2)/Math.pow(s,2);x>1&&(a*=Math.sqrt(x),s*=Math.sqrt(x));var y=Gt(e,t,i,r,a,s,p,b,m,o,f,g),_=Xt(y,4),P=_[0],E=_[1],S=_[2],T=_[3],D=Math.abs(T)/(he/4);Math.abs(1-D)<1e-7&&(D=1);var O=Math.max(Math.ceil(D),1);T/=O;for(var I=0;I1){const r=/^([01])([01])(.*)$/.exec(i);r!==null&&(d.splice(t,0,r[1]),++t,d.splice(t,0,r[2]),++t,r[3].length>0?d[t]=r[3]:d.splice(t,1))}if(++t,i=d[t],i.length>1){const r=/^([01])(.+)$/.exec(i);r!==null&&(d.splice(t,0,r[1]),++t,d[t]=r[2])}}}function $e(d){if(d===0||d===1)return d;throw new Error("Flag must be 0 or 1")}function Kt(d){const e=[0,0,0];for(let t=0;t<24;t++)e[t%3]<<=1,e[t%3]|=1&d,d>>=1;return(0|e[2])+(e[1]<<8)+(e[0]<<16)}function _e(d,e){for(;(!d.interactive||e(d))&&d._parent;)d=d._parent}function Qt(d,e,t){return A(d,je(e),i=>{const r=Ke(i);let a=i.touches;a?(a.length==0&&(a=i.changedTouches),t(Dt(a),r)):t([i],r)})}function Xe(d){const e=document.createElement("canvas");e.width=1,e.height=1;const t=e.getContext("2d",{willReadFrequently:!0});t.drawImage(d,0,0,1,1);try{return t.getImageData(0,0,1,1),!1}catch{return console.warn('Image "'+d.src+'" is loaded from different host and is not covered by CORS policy. For more information about the implications read here: https://www.amcharts.com/docs/v5/concepts/cors'),!0}}function oe(d){d.width=0,d.height=0,d.style.width="0px",d.style.height="0px"}class ei{constructor(){Object.defineProperty(this,"_x",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_y",{enumerable:!0,configurable:!0,writable:!0,value:0})}get x(){return this._x}get y(){return this._y}set x(e){this._x=e}set y(e){this._y=e}}class ve extends Lt{constructor(e){super(),Object.defineProperty(this,"_layer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mask",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"exportable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"interactive",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"inactive",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"wheelable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"cancelTouch",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isMeasured",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"buttonMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"alpha",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"compoundAlpha",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"angle",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"scale",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"crisp",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"pivot",{enumerable:!0,configurable:!0,writable:!0,value:new ei}),Object.defineProperty(this,"filter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cursorOverStyle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_replacedCursorStyle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_localMatrix",{enumerable:!0,configurable:!0,writable:!0,value:new ke}),Object.defineProperty(this,"_matrix",{enumerable:!0,configurable:!0,writable:!0,value:new ke}),Object.defineProperty(this,"_uMatrix",{enumerable:!0,configurable:!0,writable:!0,value:new ke}),Object.defineProperty(this,"_renderer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_localBounds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_bounds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_colorId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._renderer=e}_dispose(){this._renderer._removeObject(this),this.getLayer().dirty=!0}getCanvas(){return this.getLayer().view}getLayer(){let e=this;for(;;){if(e._layer)return e._layer;if(!e._parent)return this._renderer.defaultLayer;e=e._parent}}setLayer(e,t){e==null?this._layer=void 0:(this._layer=this._renderer.getLayer(e,!0),this._layer.visible=!0,this._layer.margin=t,t&&J(this._layer.view,!1),this._renderer._ghostLayer.setMargin(this._renderer.layers),this._parent&&this._parent.registerChildLayer(this._layer),this._layer.dirty=!0,this._renderer.resizeLayer(this._layer),this._renderer.resizeGhost())}markDirtyLayer(){this.getLayer().dirty=!0}clear(){this.invalidateBounds()}invalidateBounds(){this._localBounds=void 0}_addBounds(e){}_getColorId(){return this._colorId===void 0&&(this._colorId=this._renderer.paintId(this)),this._colorId}_isInteractive(){return this.inactive==0&&(this.interactive||this._renderer._forceInteractive>0)}_isInteractiveMask(){return this._isInteractive()}contains(e){for(;;){if(e===this)return!0;if(!e._parent)return!1;e=e._parent}}toGlobal(e){return this._matrix.apply(e)}toLocal(e){return this._matrix.applyInverse(e)}getLocalMatrix(){return this._uMatrix.setTransform(0,0,this.pivot.x,this.pivot.y,this.angle*Math.PI/180,this.scale),this._uMatrix}getLocalBounds(){return this._localBounds||(this._localBounds={left:1e7,top:1e7,right:-1e7,bottom:-1e7},this._addBounds(this._localBounds)),this._localBounds}getAdjustedBounds(e){this._setMatrix();const t=this.getLocalMatrix(),i=t.apply({x:e.left,y:e.top}),r=t.apply({x:e.right,y:e.top}),a=t.apply({x:e.right,y:e.bottom}),s=t.apply({x:e.left,y:e.bottom});return{left:Math.min(i.x,r.x,a.x,s.x),top:Math.min(i.y,r.y,a.y,s.y),right:Math.max(i.x,r.x,a.x,s.x),bottom:Math.max(i.y,r.y,a.y,s.y)}}on(e,t,i){return this.interactive?this._renderer._addEvent(this,e,t,i):new X(()=>{})}_setMatrix(){this._localMatrix.setTransform(this.x,this.y,this.pivot.x,this.pivot.y,this.angle*Math.PI/180,this.scale),this._matrix.copyFrom(this._localMatrix),this._parent&&this._matrix.prepend(this._parent._matrix)}_transform(e,t){const i=this._matrix;let r=i.tx*t,a=i.ty*t;this.crisp&&(r=Math.floor(r)+.5,a=Math.floor(a)+.5),e.setTransform(i.a*t,i.b*t,i.c*t,i.d*t,r,a)}_transformMargin(e,t,i){const r=this._matrix;e.setTransform(r.a*t,r.b*t,r.c*t,r.d*t,(r.tx+i.left)*t,(r.ty+i.top)*t)}_transformLayer(e,t,i){i.margin?this._transformMargin(e,i.scale||t,i.margin):this._transform(e,i.scale||t)}render(e){if(this.visible&&(this.exportable!==!1||!this._renderer._omitTainted)){this._setMatrix();const t=this._renderer.resolution,i=this._renderer.layers,r=this._renderer._ghostLayer,a=r.context,s=this.mask;s&&s._setMatrix(),v(i,n=>{if(n){const u=n.context;u.save(),s&&(s._transformLayer(u,t,n),s._runPath(u),u.clip()),u.globalAlpha=this.compoundAlpha*this.alpha,this._transformLayer(u,t,n),this.filter&&(u.filter=this.filter)}}),a.save(),s&&this._isInteractiveMask()&&(s._transformMargin(a,t,r.margin),s._runPath(a),a.clip()),this._transformMargin(a,t,r.margin),this._render(e),a.restore(),v(i,n=>{n&&n.context.restore()})}}_render(e){this.exportable===!1&&((this._layer||e).tainted=!0)}hovering(){return this._renderer._hovering.has(this)}dragging(){return this._renderer._dragging.some(e=>e.value===this)}shouldCancelTouch(){const e=this._renderer;return!(e.tapToActivate&&!e._touchActive)&&(!!this.cancelTouch||!!this._parent&&this._parent.shouldCancelTouch())}}class ti extends ve{constructor(){super(...arguments),Object.defineProperty(this,"interactiveChildren",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_childLayers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_children",{enumerable:!0,configurable:!0,writable:!0,value:[]})}_isInteractiveMask(){return this.interactiveChildren||super._isInteractiveMask()}addChild(e){e._parent=this,this._children.push(e),e._layer&&this.registerChildLayer(e._layer)}addChildAt(e,t){e._parent=this,this._children.splice(t,0,e),e._layer&&this.registerChildLayer(e._layer)}removeChild(e){e._parent=void 0,Ce(this._children,e)}_render(e){super._render(e);const t=this._renderer;this.interactive&&this.interactiveChildren&&++t._forceInteractive;const i=this._layer||e;v(this._children,r=>{r.compoundAlpha=this.compoundAlpha*this.alpha,r.render(i)}),this.interactive&&this.interactiveChildren&&--t._forceInteractive}registerChildLayer(e){this._childLayers||(this._childLayers=[]),Te(this._childLayers,e),this._parent&&this._parent.registerChildLayer(e)}markDirtyLayer(e=!1){super.markDirtyLayer(),e&&this._childLayers&&v(this._childLayers,t=>t.dirty=!0)}_dispose(){super._dispose(),this._childLayers&&v(this._childLayers,e=>{e.dirty=!0})}}function M(d,e){d.left=Math.min(d.left,e.x),d.top=Math.min(d.top,e.y),d.right=Math.max(d.right,e.x),d.bottom=Math.max(d.bottom,e.y)}class j{colorize(e,t){}path(e){}addBounds(e){}}class ii extends j{colorize(e,t){e.beginPath()}}class Me extends j{constructor(e){super(),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:e})}colorize(e,t){e.fillStyle=t!==void 0?t:this.color}}class ri extends j{constructor(e){super(),Object.defineProperty(this,"clearShadow",{enumerable:!0,configurable:!0,writable:!0,value:e})}colorize(e,t){e.fill(),this.clearShadow&&(e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}}class si extends j{colorize(e,t){e.stroke()}}class Se extends j{constructor(e,t,i){super(),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"lineJoin",{enumerable:!0,configurable:!0,writable:!0,value:i})}colorize(e,t){e.strokeStyle=t!==void 0?t:this.color,e.lineWidth=this.width,this.lineJoin&&(e.lineJoin=this.lineJoin)}}class ai extends j{constructor(e){super(),Object.defineProperty(this,"dash",{enumerable:!0,configurable:!0,writable:!0,value:e})}colorize(e,t){e.setLineDash(this.dash)}}class ni extends j{constructor(e){super(),Object.defineProperty(this,"dashOffset",{enumerable:!0,configurable:!0,writable:!0,value:e})}colorize(e,t){e.lineDashOffset=this.dashOffset}}class oi extends j{constructor(e,t,i,r){super(),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:r})}path(e){e.rect(this.x,this.y,this.width,this.height)}addBounds(e){const t=this.x,i=this.y,r=t+this.width,a=i+this.height;M(e,{x:t,y:i}),M(e,{x:r,y:i}),M(e,{x:t,y:a}),M(e,{x:r,y:a})}}class li extends j{constructor(e,t,i){super(),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"radius",{enumerable:!0,configurable:!0,writable:!0,value:i})}path(e){e.moveTo(this.x+this.radius,this.y),e.arc(this.x,this.y,this.radius,0,2*Math.PI)}addBounds(e){M(e,{x:this.x-this.radius,y:this.y-this.radius}),M(e,{x:this.x+this.radius,y:this.y+this.radius})}}class hi extends j{constructor(e,t,i,r){super(),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"radiusX",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"radiusY",{enumerable:!0,configurable:!0,writable:!0,value:r})}path(e){e.ellipse(0,0,this.radiusX,this.radiusY,0,0,2*Math.PI)}addBounds(e){M(e,{x:this.x-this.radiusX,y:this.y-this.radiusY}),M(e,{x:this.x+this.radiusX,y:this.y+this.radiusY})}}class ui extends j{constructor(e,t,i,r,a,s){super(),Object.defineProperty(this,"cx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cy",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"radius",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"startAngle",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"endAngle",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"anticlockwise",{enumerable:!0,configurable:!0,writable:!0,value:s})}path(e){this.radius>0&&e.arc(this.cx,this.cy,this.radius,this.startAngle,this.endAngle,this.anticlockwise)}addBounds(e){let t=zt(this.cx,this.cy,this.startAngle*le,this.endAngle*le,this.radius);M(e,{x:t.left,y:t.top}),M(e,{x:t.right,y:t.bottom})}}class ci extends j{constructor(e,t,i,r,a){super(),Object.defineProperty(this,"x1",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y1",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"x2",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"y2",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"radius",{enumerable:!0,configurable:!0,writable:!0,value:a})}path(e){this.radius>0&&e.arcTo(this.x1,this.y1,this.x2,this.y2,this.radius)}addBounds(e){}}class di extends j{constructor(e,t){super(),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t})}path(e){e.lineTo(this.x,this.y)}addBounds(e){M(e,{x:this.x,y:this.y})}}class bi extends j{constructor(e,t){super(),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t})}path(e){e.moveTo(this.x,this.y)}addBounds(e){M(e,{x:this.x,y:this.y})}}class _i extends j{path(e){e.closePath()}}class fi extends j{constructor(e,t,i,r,a,s){super(),Object.defineProperty(this,"cpX",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cpY",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"cpX2",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"cpY2",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"toX",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"toY",{enumerable:!0,configurable:!0,writable:!0,value:s})}path(e){e.bezierCurveTo(this.cpX,this.cpY,this.cpX2,this.cpY2,this.toX,this.toY)}addBounds(e){M(e,{x:this.cpX,y:this.cpY}),M(e,{x:this.cpX2,y:this.cpY2}),M(e,{x:this.toX,y:this.toY})}}class pi extends j{constructor(e,t,i,r){super(),Object.defineProperty(this,"cpX",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cpY",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"toX",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"toY",{enumerable:!0,configurable:!0,writable:!0,value:r})}path(e){e.quadraticCurveTo(this.cpX,this.cpY,this.toX,this.toY)}addBounds(e){M(e,{x:this.cpX,y:this.cpY}),M(e,{x:this.toX,y:this.toY})}}class gi extends j{constructor(e,t,i,r,a){super(),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"blur",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"offsetX",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"offsetY",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"opacity",{enumerable:!0,configurable:!0,writable:!0,value:a})}colorize(e,t){this.opacity&&(e.fillStyle=this.color),e.shadowColor=this.color,e.shadowBlur=this.blur,e.shadowOffsetX=this.offsetX,e.shadowOffsetY=this.offsetY}}class mi extends j{constructor(e,t,i,r,a){super(),Object.defineProperty(this,"image",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:a})}path(e){e.drawImage(this.image,this.x,this.y,this.width,this.height)}addBounds(e){M(e,{x:this.x,y:this.y}),M(e,{x:this.width,y:this.height})}}class yi extends ve{constructor(){super(...arguments),Object.defineProperty(this,"_operations",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"blendMode",{enumerable:!0,configurable:!0,writable:!0,value:Ct.NORMAL}),Object.defineProperty(this,"_hasShadows",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_fillAlpha",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_strokeAlpha",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}clear(){super.clear(),this._operations.length=0}_pushOp(e){this._operations.push(e)}beginFill(e,t=1){this._fillAlpha=t,e?e instanceof ee?this._pushOp(new Me(e.toCSS(t))):(this.isMeasured=!0,this._pushOp(new Me(e))):this._pushOp(new Me("rgba(0, 0, 0, "+t+")"))}endFill(){this._pushOp(new ri(this._hasShadows))}endStroke(){this._pushOp(new si)}beginPath(){this._pushOp(new ii)}lineStyle(e=0,t,i=1,r){this._strokeAlpha=i,t?t instanceof ee?this._pushOp(new Se(e,t.toCSS(i),r)):this._pushOp(new Se(e,t,r)):this._pushOp(new Se(e,"rgba(0, 0, 0, "+i+")",r))}setLineDash(e){this._pushOp(new ai(e||[]))}setLineDashOffset(e=0){this._pushOp(new ni(e))}drawRect(e,t,i,r){this._pushOp(new oi(e,t,i,r))}drawCircle(e,t,i){this._pushOp(new li(e,t,i))}drawEllipse(e,t,i,r){this._pushOp(new hi(e,t,i,r))}arc(e,t,i,r,a,s=!1){this._pushOp(new ui(e,t,i,r,a,s))}arcTo(e,t,i,r,a){this._pushOp(new ci(e,t,i,r,a))}lineTo(e,t){this._pushOp(new di(e,t))}moveTo(e,t){this._pushOp(new bi(e,t))}bezierCurveTo(e,t,i,r,a,s){this._pushOp(new fi(e,t,i,r,a,s))}quadraticCurveTo(e,t,i,r){this._pushOp(new pi(e,t,i,r))}closePath(){this._pushOp(new _i)}shadow(e,t=0,i=0,r=0,a){this._hasShadows=!0,this._pushOp(new gi(a?e.toCSS(a):e.toCSS(this._fillAlpha||this._strokeAlpha),t,i,r))}image(e,t,i,r,a){this._pushOp(new mi(e,t,i,r,a))}svgPath(e){let t=0,i=0,r=null,a=null,s=null,n=null;const u=/([MmZzLlHhVvCcSsQqTtAa])([^MmZzLlHhVvCcSsQqTtAa]*)/g,h=/[\u0009\u0020\u000A\u000C\u000D]*([\+\-]?[0-9]*\.?[0-9]+(?:[eE][\+\-]?[0-9]+)?)[\u0009\u0020\u000A\u000C\u000D]*,?/g;let p;for(;(p=u.exec(e))!==null;){const c=p[1],b=p[2],l=[];for(;(p=h.exec(b))!==null;)l.push(p[1]);switch(c!=="S"&&c!=="s"&&c!=="C"&&c!=="c"&&(r=null,a=null),c!=="Q"&&c!=="q"&&c!=="T"&&c!=="t"&&(s=null,n=null),c){case"M":z(c,l.length,2),t=+l[0],i=+l[1],this.moveTo(t,i);for(let o=2;o{this.bezierCurveTo(y.x1,y.y1,y.x2,y.y2,y.x,y.y),t=y.x,i=y.y})}break;case"Z":case"z":Zt(c,l.length,0),this.closePath()}}}_runPath(e){e.beginPath(),v(this._operations,t=>{t.path(e)})}_render(e){super._render(e);const t=this._layer||e,i=t.dirty,r=this._isInteractive();if(i||r){const a=t.context,s=this._renderer._ghostLayer.context;let n;i&&(a.globalCompositeOperation=this.blendMode,a.beginPath()),r&&(s.beginPath(),n=this._getColorId()),v(this._operations,u=>{i&&(u.path(a),u.colorize(a,void 0)),r&&(u.path(s),u.colorize(s,n))})}}renderDetached(e){if(this.visible){this._setMatrix(),e.save();const t=this.mask;t&&(t._setMatrix(),t._transform(e,1),t._runPath(e),e.clip()),e.globalAlpha=this.compoundAlpha*this.alpha,this._transform(e,1),this.filter&&(e.filter=this.filter),e.globalCompositeOperation=this.blendMode,e.beginPath(),v(this._operations,i=>{i.path(e),i.colorize(e,void 0)}),e.restore()}}_addBounds(e){this.visible&&this.isMeasured&&v(this._operations,t=>{t.addBounds(e)})}}class rt extends ve{constructor(e,t,i){super(e),Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolution",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"textVisible",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_textInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_originalScale",{enumerable:!0,configurable:!0,writable:!0,value:1}),this.text=t,this.style=i}invalidateBounds(){super.invalidateBounds(),this._textInfo=void 0}_shared(e){this.style.textAlign&&(e.textAlign=this.style.textAlign),this.style.direction&&(e.direction=this.style.direction),this.style.textBaseline&&(e.textBaseline=this.style.textBaseline)}_prerender(e,t=!1,i=!1){super._render(e);const r=e.context,a=this._renderer._ghostLayer.context,s=this.style;let n=this._getFontStyle(void 0,i);r.font=n,this._isInteractive()&&!t&&(a.font=n),s.fill&&(s.fill instanceof ee?r.fillStyle=s.fill.toCSS(s.fillOpacity!=null?s.fillOpacity:1):r.fillStyle=s.fill),s.shadowColor&&(e.context.shadowColor=s.shadowColor.toCSS(s.shadowOpacity||1)),s.shadowBlur&&(e.context.shadowBlur=s.shadowBlur),s.shadowOffsetX&&(e.context.shadowOffsetX=s.shadowOffsetX),s.shadowOffsetY&&(e.context.shadowOffsetY=s.shadowOffsetY),this._shared(r),this._isInteractive()&&!t&&(a.fillStyle=this._getColorId(),this._shared(a))}_getFontStyle(e,t=!1){const i=this.style;let r=[];return e&&e.fontVariant?r.push(e.fontVariant):i.fontVariant&&r.push(i.fontVariant),t||(e&&e.fontWeight?r.push(e.fontWeight):i.fontWeight&&r.push(i.fontWeight)),e&&e.fontStyle?r.push(e.fontStyle):i.fontStyle&&r.push(i.fontStyle),e&&e.fontSize?(H(e.fontSize)&&(e.fontSize=e.fontSize+"px"),r.push(e.fontSize)):i.fontSize&&(H(i.fontSize)&&(i.fontSize=i.fontSize+"px"),r.push(i.fontSize)),e&&e.fontFamily?r.push(e.fontFamily):i.fontFamily?r.push(i.fontFamily):r.length&&r.push("Arial"),r.join(" ")}_render(e){const t=this._layer||e;if(this._textInfo||this._measure(t),this.textVisible){const i=this._isInteractive(),r=t.context,a=t.dirty,s=this._renderer._ghostLayer.context;r.save(),s.save(),this._prerender(t),v(this._textInfo,(n,u)=>{v(n.textChunks,(h,p)=>{if(h.style&&(r.save(),s.save(),r.font=h.style,this._isInteractive()&&(s.font=h.style)),h.fill&&(r.save(),r.fillStyle=h.fill.toCSS()),a&&r.fillText(h.text,h.offsetX,n.offsetY+h.offsetY),h.textDecoration=="underline"||h.textDecoration=="line-through"){let c,b=1,l=1,m=h.height,o=h.offsetX;switch(this.style.textAlign){case"right":case"end":o-=h.width;break;case"center":o-=h.width/2}if(h.style)switch(U.getTextStyle(h.style).fontWeight){case"bolder":case"bold":case"700":case"800":case"900":b=2}m&&(l=m/20),c=h.textDecoration=="line-through"?b+n.offsetY+h.offsetY-h.height/2:b+1.5*l+n.offsetY+h.offsetY,r.save(),r.beginPath(),h.fill?r.strokeStyle=h.fill.toCSS():this.style.fill&&this.style.fill instanceof ee&&(r.strokeStyle=this.style.fill.toCSS()),r.lineWidth=b*l,r.moveTo(o,c),r.lineTo(o+h.width,c),r.stroke(),r.restore()}i&&this.interactive&&s.fillText(h.text,h.offsetX,n.offsetY+h.offsetY),h.fill&&r.restore(),h.style&&(r.restore(),s.restore())})}),r.restore(),s.restore()}}_addBounds(e){if(this.visible&&this.isMeasured){const t=this._measure(this.getLayer());M(e,{x:t.left,y:t.top}),M(e,{x:t.right,y:t.bottom})}}_ignoreFontWeight(){return/apple/i.test(navigator.vendor)}_measure(e){const t=e.context,i=this._renderer._ghostLayer.context,r=this.style.direction=="rtl";this._textInfo=[];const a=this.style.oversizedBehavior,s=this.style.maxWidth,n=H(s)&&a=="truncate",u=H(s)&&(a=="wrap"||a=="wrap-no-break");t.save(),i.save(),this._prerender(e,!0,this._ignoreFontWeight());const h="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",p=this.text.toString().replace(/\r/g,"").split(/\n/);let c,b=!0,l=0,m=0,o=0;v(p,(g,x)=>{let y;for(y=g==""?[{type:"value",text:""}]:U.chunk(g,!1,this.style.ignoreFormatting);y.length>0;){let _={offsetY:o,ascent:0,width:0,height:0,left:0,right:0,textChunks:[]};const P=this._measureText(h,t),E=P.actualBoundingBoxAscent+P.actualBoundingBoxDescent;let S;_.height=E,_.ascent=P.actualBoundingBoxAscent;let T,D,O,I=this.style.textDecoration,L=!1,F=!0,N=[];Qe(y,(B,ce)=>{if(B.type=="format")if(B.text=="[/]")b||(t.restore(),i.restore(),b=!0),T=void 0,c=void 0,D=void 0,I=this.style.textDecoration,O=void 0,S=B.text;else{b||(t.restore(),i.restore());let k=U.getTextStyle(B.text);const R=this._getFontStyle(k);t.save(),i.save(),t.font=R,c=R,S=B.text,k.textDecoration&&(I=k.textDecoration),k.fill&&(T=k.fill),k.width&&(D=V(k.width)),k.verticalAlign&&(O=k.verticalAlign),b=!1;const Y=this._measureText(h,t),G=Y.actualBoundingBoxAscent+Y.actualBoundingBoxDescent;G>_.height&&(_.height=G),Y.actualBoundingBoxAscent>_.ascent&&(_.ascent=Y.actualBoundingBoxAscent)}else if(B.type=="value"&&!L){const k=this._measureText(B.text,t);let R=k.actualBoundingBoxLeft+k.actualBoundingBoxRight;if(n){let W=F||this.style.breakWords||!1;const $=this.style.ellipsis||"",Le=this._measureText($,t),st=Le.actualBoundingBoxLeft+Le.actualBoundingBoxRight;if(_.width+R>s){const at=s-_.width-st;B.text=this._truncateText(t,B.text,at,W),B.text+=$,L=!0}}else if(u&&_.width+R>s){const W=s-_.width,$=this._truncateText(t,B.text,W,!1,F&&this.style.oversizedBehavior!="wrap-no-break");if($=="")return this.textVisible=!0,!1;N=y.slice(ce+1),Pe($)!=Pe(B.text)&&(N.unshift({type:"value",text:B.text.substr($.length)}),S&&N.unshift({type:"format",text:S})),B.text=Pe($),y=[],L=!0}let Y=1,G=1;if(c&&D&&D>R){const W=R/D;switch(this.style.textAlign){case"right":case"end":Y=W;break;case"center":Y=W,G=W;break;default:G=W}R=D}const we=k.actualBoundingBoxAscent+k.actualBoundingBoxDescent;we>_.height&&(_.height=we),k.actualBoundingBoxAscent>_.ascent&&(_.ascent=k.actualBoundingBoxAscent),_.width+=R,_.left+=k.actualBoundingBoxLeft/Y,_.right+=k.actualBoundingBoxRight/G,_.textChunks.push({style:c,fill:T,text:B.text,width:R,height:we,left:k.actualBoundingBoxLeft,right:k.actualBoundingBoxRight,ascent:k.actualBoundingBoxAscent,offsetX:0,offsetY:0,textDecoration:I,verticalAlign:O}),F=!1}return!0}),this.style.lineHeight instanceof et?(_.height*=this.style.lineHeight.value,_.ascent*=this.style.lineHeight.value):(_.height*=this.style.lineHeight||1.2,_.ascent*=this.style.lineHeight||1.2),l<_.left&&(l=_.left),m<_.right&&(m=_.right),this._textInfo.push(_),o+=_.height,y=N||[]}}),b||(t.restore(),i.restore()),v(this._textInfo,(g,x)=>{let y=0;v(g.textChunks,_=>{if(_.offsetX=y+_.left-g.left,_.offsetY+=g.height-g.height*(this.style.baselineRatio||.19),y+=_.width,_.verticalAlign)switch(_.verticalAlign){case"super":_.offsetY-=g.height/2-_.height/2;break;case"sub":_.offsetY+=_.height/2}})});const f={left:r?-m:-l,top:0,right:r?l:m,bottom:o};if(a!=="none"){const g=this._fitRatio(f);if(g<1)if(a=="fit")H(this.style.minScale)&&gi&&t!="");return t}_measureText(e,t){let i=t.measureText(e),r={};if(i.actualBoundingBoxAscent==null){const s=document.createElement("div");s.innerText=e,s.style.visibility="hidden",s.style.position="absolute",s.style.top="-1000000px;",s.style.fontFamily=this.style.fontFamily||"",s.style.fontSize=this.style.fontSize+"",document.body.appendChild(s);const n=s.getBoundingClientRect();document.body.removeChild(s);const u=n.height,h=i.width;r={actualBoundingBoxAscent:u,actualBoundingBoxDescent:0,actualBoundingBoxLeft:0,actualBoundingBoxRight:h,fontBoundingBoxAscent:u,fontBoundingBoxDescent:0,width:h}}else r={actualBoundingBoxAscent:i.actualBoundingBoxAscent,actualBoundingBoxDescent:i.actualBoundingBoxDescent,actualBoundingBoxLeft:i.actualBoundingBoxLeft,actualBoundingBoxRight:i.actualBoundingBoxRight,fontBoundingBoxAscent:i.actualBoundingBoxAscent,fontBoundingBoxDescent:i.actualBoundingBoxDescent,width:i.width};const a=i.width;switch(this.style.textAlign){case"right":case"end":r.actualBoundingBoxLeft=a,r.actualBoundingBoxRight=0;break;case"center":r.actualBoundingBoxLeft=a/2,r.actualBoundingBoxRight=a/2;break;default:r.actualBoundingBoxLeft=0,r.actualBoundingBoxRight=a}return r}}class vi{constructor(){Object.defineProperty(this,"fill",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fillOpacity",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"textAlign",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontFamily",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontWeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontVariant",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"textDecoration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowBlur",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOffsetX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOffsetY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOpacity",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lineHeight",{enumerable:!0,configurable:!0,writable:!0,value:Ze(120)}),Object.defineProperty(this,"baselineRatio",{enumerable:!0,configurable:!0,writable:!0,value:.19}),Object.defineProperty(this,"direction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"textBaseline",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"oversizedBehavior",{enumerable:!0,configurable:!0,writable:!0,value:"none"}),Object.defineProperty(this,"breakWords",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ellipsis",{enumerable:!0,configurable:!0,writable:!0,value:"…"}),Object.defineProperty(this,"maxWidth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxHeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"minScale",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ignoreFormatting",{enumerable:!0,configurable:!0,writable:!0,value:!1})}}class wi extends rt{constructor(){super(...arguments),Object.defineProperty(this,"textType",{enumerable:!0,configurable:!0,writable:!0,value:"circular"}),Object.defineProperty(this,"radius",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startAngle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inside",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"orientation",{enumerable:!0,configurable:!0,writable:!0,value:"auto"}),Object.defineProperty(this,"kerning",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_textReversed",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_render(e){this.textType==="circular"?this._renderCircular(e):super._render(e)}_renderCircular(e){if(this.textVisible){const t=this._layer||e;this._prerender(t);const i=this._isInteractive(),r=t.context,a=t.dirty,s=this._renderer._ghostLayer.context;r.save(),i&&s.save(),this._textInfo||this._measure(t);let n=this.radius||0,u=this.startAngle||0,h=0,p=this.orientation,c=p=="auto"?"auto":p=="inward";const b=this.inside,l=this.style.textAlign||"left",m=this.kerning||0;let o=l=="left"?1:-1;const f=!this._textReversed;if(c=="auto"){let g=0,x=0;v(this._textInfo,(y,_)=>{const P=u+y.width/(n-y.height)/2*-o;P>g&&(g=P)}),x=l=="left"?(g+h/2)*le:l=="right"?(g-h/2)*le:u*le,x=Bt(x),c=x>=270||x<=90}c==1&&f&&(this._textInfo.reverse(),this._textReversed=!0),v(this._textInfo,(g,x)=>{const y=g.height;b||(n+=y),(o==-1&&c||o==1&&!c)&&f&&g.textChunks.reverse();let _=u;h=0,l=="center"&&(_+=g.width/(n-y)/2*-o,h=_-u),_+=Math.PI*(c?0:1),r.save(),i&&s.save(),r.rotate(_),i&&s.rotate(_);let P=0;v(g.textChunks,(E,S)=>{const T=E.text,D=E.width;P=D/2/(n-y)*o,r.rotate(P),i&&s.rotate(P),E.style&&(r.save(),s.save(),r.font=E.style,i&&(s.font=E.style)),E.fill&&(r.save(),r.fillStyle=E.fill.toCSS()),r.textBaseline="middle",r.textAlign="center",i&&(s.textBaseline="middle",s.textAlign="center"),a&&r.fillText(T,0,(c?1:-1)*(0-n+y/2)),i&&s.fillText(T,0,(c?1:-1)*(0-n+y/2)),E.fill&&r.restore(),E.style&&(r.restore(),s.restore()),P=(D/2+m)/(n-y)*o,r.rotate(P),i&&s.rotate(P)}),r.restore(),i&&s.restore(),b&&(n-=y)}),r.restore(),i&&s.restore()}}_measure(e){return this.textType==="circular"?this._measureCircular(e):super._measure(e)}_measureCircular(e){const t=e.context,i=this._renderer._ghostLayer.context,r=this.style.direction=="rtl",a=this.style.oversizedBehavior,s=this.style.maxWidth,n=H(s)&&a=="truncate",u=this.style.ellipsis||"";let h;this.textVisible=!0,this._textInfo=[],this._textReversed=!1,t.save(),i.save(),this._prerender(e,!0);const p=this.text.toString().replace(/\r/g,"").split(/\n/);let c=!0,b=0,l=0;return v(p,(m,o)=>{let f,g,x,y=U.chunk(m,!1,this.style.ignoreFormatting),_={offsetY:l,ascent:0,width:0,height:0,left:0,right:0,textChunks:[]};v(y,(P,E)=>{if(P.type=="format"){if(P.text=="[/]")c||(t.restore(),i.restore(),c=!0),g=void 0,f=void 0,x=void 0;else{let S=U.getTextStyle(P.text);const T=this._getFontStyle(S);t.save(),i.save(),t.font=T,f=T,S.fill&&(g=S.fill),S.width&&(x=V(S.width)),c=!1}n&&(h=this._measureText(u,t))}else if(P.type=="value"){const S=P.text.match(/./gu)||[];r&&S.reverse();for(let T=0;TI&&(I=x);const L=O.actualBoundingBoxAscent+O.actualBoundingBoxDescent;if(L>_.height&&(_.height=L),O.actualBoundingBoxAscent>_.ascent&&(_.ascent=O.actualBoundingBoxAscent),_.width+=I,_.left+=O.actualBoundingBoxLeft,_.right+=O.actualBoundingBoxRight,_.textChunks.push({style:f,fill:g,text:D,width:I,height:L+O.actualBoundingBoxDescent,left:O.actualBoundingBoxLeft,right:O.actualBoundingBoxRight,ascent:O.actualBoundingBoxAscent,offsetX:0,offsetY:L,textDecoration:void 0}),b+=I,n){h||(h=this._measureText(u,t));const F=h.actualBoundingBoxLeft+h.actualBoundingBoxRight;if(b+=F,b+F>s){_.textChunks.length==1?this.textVisible=!1:(_.width+=F,_.left+=h.actualBoundingBoxLeft,_.right+=h.actualBoundingBoxRight,_.textChunks.push({style:f,fill:g,text:u,width:F,height:L+h.actualBoundingBoxDescent,left:h.actualBoundingBoxLeft,right:h.actualBoundingBoxRight,ascent:h.actualBoundingBoxAscent,offsetX:0,offsetY:L,textDecoration:void 0}));break}}if(r)break}}}),this.style.lineHeight instanceof et?_.height*=this.style.lineHeight.value:_.height*=this.style.lineHeight||1.2,this._textInfo.push(_),l+=_.height}),c||(t.restore(),i.restore()),a=="hide"&&b>s&&(this.textVisible=!1),v(this._textInfo,m=>{v(m.textChunks,o=>{o.offsetY+=Math.round((m.height-o.height+(m.ascent-o.ascent))/2)})}),t.restore(),i.restore(),{left:0,top:0,right:0,bottom:0}}}class xi extends ve{constructor(e,t){super(e),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"image",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tainted",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowBlur",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOffsetX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOffsetY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOpacity",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_imageMask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.image=t}_dispose(){super._dispose(),this._imageMask&&oe(this._imageMask)}getLocalBounds(){if(!this._localBounds){let e=0,t=0;this.width&&(e=this.width),this.height&&(t=this.height),this._localBounds={left:0,top:0,right:e,bottom:t},this._addBounds(this._localBounds)}return this._localBounds}_render(e){if(super._render(e),this.image){const t=this._layer||e;if(this.tainted===void 0&&(this.tainted=Xe(this.image),t.tainted=!0),this.tainted&&this._renderer._omitTainted)return;if(t.dirty){this.shadowColor&&(t.context.shadowColor=this.shadowColor.toCSS(this.shadowOpacity||1)),this.shadowBlur&&(t.context.shadowBlur=this.shadowBlur),this.shadowOffsetX&&(t.context.shadowOffsetX=this.shadowOffsetX),this.shadowOffsetY&&(t.context.shadowOffsetY=this.shadowOffsetY);const i=this.width||this.image.naturalWidth,r=this.height||this.image.naturalHeight;t.context.drawImage(this.image,0,0,i,r)}if(this.interactive&&this._isInteractive()){const i=this._getMask(this.image);this._renderer._ghostLayer.context.drawImage(i,0,0)}}}clear(){super.clear(),this.image=void 0,this._imageMask=void 0}_getMask(e){if(this._imageMask===void 0){const t=this.width||e.naturalWidth,i=this.height||e.naturalHeight,r=document.createElement("canvas");r.width=t,r.height=i;const a=r.getContext("2d");a.imageSmoothingEnabled=!1,a.fillStyle=this._getColorId(),a.fillRect(0,0,t,i),Xe(e)||(a.globalCompositeOperation="destination-in",a.drawImage(e,0,0,t,i)),this._imageMask=r}return this._imageMask}}class Pi{constructor(e,t,i,r){Object.defineProperty(this,"event",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"originalPoint",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"point",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"bbox",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"simulated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"native",{enumerable:!0,configurable:!0,writable:!0,value:!0}),ge("touchevents")&&e instanceof Touch?this.id=e.identifier:this.id=null}}class Oi extends St{constructor(e){if(super(),Object.defineProperty(this,"view",{enumerable:!0,configurable:!0,writable:!0,value:document.createElement("div")}),Object.defineProperty(this,"_layerDom",{enumerable:!0,configurable:!0,writable:!0,value:document.createElement("div")}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_dirtyLayers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"defaultLayer",{enumerable:!0,configurable:!0,writable:!0,value:this.getLayer(0)}),Object.defineProperty(this,"_ghostLayer",{enumerable:!0,configurable:!0,writable:!0,value:new ki}),Object.defineProperty(this,"_patternCanvas",{enumerable:!0,configurable:!0,writable:!0,value:document.createElement("canvas")}),Object.defineProperty(this,"_patternContext",{enumerable:!0,configurable:!0,writable:!0,value:this._patternCanvas.getContext("2d")}),Object.defineProperty(this,"_realWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_realHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_calculatedWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_calculatedHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"resolution",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"interactionsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_listeners",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_events",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_colorId",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_colorMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_forceInteractive",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_omitTainted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_hovering",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"_dragging",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_mousedown",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_lastPointerMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tapToActivate",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"tapToActivateTimeout",{enumerable:!0,configurable:!0,writable:!0,value:3e3}),Object.defineProperty(this,"_touchActive",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_touchActiveTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.resolution=e??window.devicePixelRatio,this.view.style.position="absolute",this.view.setAttribute("aria-hidden","true"),this.view.appendChild(this._layerDom),this._disposers.push(new X(()=>{ue(this._events,(t,i)=>{i.disposer.dispose()}),v(this.layers,t=>{oe(t.view),t.exportableView&&oe(t.exportableView)}),oe(this._ghostLayer.view),oe(this._patternCanvas)})),this._disposers.push(Je(()=>{e==null&&(this.resolution=window.devicePixelRatio)})),ge("touchevents")){const t=i=>{this._dragging.length!==0&&Qe(this._dragging,r=>!r.value.shouldCancelTouch()||(i.preventDefault(),!1)),this._touchActiveTimeout&&this._delayTouchDeactivate()};this._disposers.push(A(window,"touchstart",t,{passive:!1})),this._disposers.push(A(this.view,"touchstart",t,{passive:!1})),this._disposers.push(A(this.view,"touchmove",()=>{this._touchActiveTimeout&&this._delayTouchDeactivate()},{passive:!0})),this._disposers.push(A(window,"click",i=>{this._touchActive=!1},{passive:!0})),this._disposers.push(A(this.view,"click",i=>{window.setTimeout(()=>{this._touchActive=!0,this._delayTouchDeactivate()},100)},{passive:!0}))}ge("wheelevents")&&this._disposers.push(A(this.view,"wheel",t=>{let i=!1;this._hovering.forEach(r=>{if(r.wheelable)return i=!0,!1}),i&&t.preventDefault()},{passive:!1}))}_delayTouchDeactivate(){this._touchActiveTimeout&&clearTimeout(this._touchActiveTimeout),this.tapToActivateTimeout>0&&(this._touchActiveTimeout=window.setTimeout(()=>{this._touchActive=!1},this.tapToActivateTimeout))}get debugGhostView(){return!!this._ghostLayer.view.parentNode}set debugGhostView(e){e?this._ghostLayer.view.parentNode||this.view.appendChild(this._ghostLayer.view):this._ghostLayer.view.parentNode&&this._ghostLayer.view.parentNode.removeChild(this._ghostLayer.view)}createLinearGradient(e,t,i,r){return this.defaultLayer.context.createLinearGradient(e,t,i,r)}createRadialGradient(e,t,i,r,a,s){return this.defaultLayer.context.createRadialGradient(e,t,i,r,a,s)}createPattern(e,t,i,r,a){return this._patternCanvas.width=r,this._patternCanvas.height=a,this._patternContext.clearRect(0,0,r,a),t.renderDetached(this._patternContext),e.renderDetached(this._patternContext),this._patternContext.createPattern(this._patternCanvas,i)}makeContainer(){return new ti(this)}makeGraphics(){return new yi(this)}makeText(e,t){return new rt(this,e,t)}makeTextStyle(){return new vi}makeRadialText(e,t){return new wi(this,e,t)}makePicture(e){return new xi(this,e)}resizeLayer(e){e.resize(this._calculatedWidth,this._calculatedHeight,this._calculatedWidth,this._calculatedHeight,this.resolution)}resizeGhost(){this._ghostLayer.resize(this._calculatedWidth,this._calculatedHeight,this._calculatedWidth,this._calculatedHeight,this.resolution)}resize(e,t,i,r){this._realWidth=e,this._realHeight=t,this._calculatedWidth=i,this._calculatedHeight=r,v(this.layers,a=>{a&&(a.dirty=!0,this.resizeLayer(a))}),this.resizeGhost(),this.view.style.width=i+"px",this.view.style.height=r+"px"}createDetachedLayer(e=!1){const t=document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:e}),r=new Ei(t,i);return t.style.position="absolute",t.style.top="0px",t.style.left="0px",r}getLayerByOrder(e){const t=this.layers,i=t.length;for(let r=0;ru.order>h.order?1:u.order{t&&t.dirty&&t.visible&&(this._dirtyLayers.push(t),t.clear())}),this._ghostLayer.clear(),e.render(this.defaultLayer),this._ghostLayer.context.restore(),v(this.layers,t=>{if(t){const i=t.context;i.beginPath(),i.moveTo(0,0),i.stroke()}}),v(this._dirtyLayers,t=>{t.context.restore(),t.dirty=!1}),this._hovering.size&&this._lastPointerMoveEvent){const{events:t,target:i,native:r}=this._lastPointerMoveEvent;v(t,a=>{this._dispatchGlobalMousemove(a,i,r)})}}paintId(e){const t=Kt(++this._colorId),i=ee.fromHex(t).toCSS();return this._colorMap[i]=e,i}_removeObject(e){e._colorId!==void 0&&delete this._colorMap[e._colorId]}_adjustBoundingBox(e){const t=this._ghostLayer.margin;return new DOMRect(-t.left,-t.top,e.width+t.left+t.right,e.height+t.top+t.bottom)}getEvent(e,t=!0){const i=this.view.getBoundingClientRect(),r=e.clientX||0,a=e.clientY||0,s=this._calculatedWidth/this._realWidth,n=this._calculatedHeight/this._realHeight,u={x:r-i.left,y:a-i.top},h={x:(r-(t?i.left:0))*s,y:(a-(t?i.top:0))*n};return new Pi(e,u,h,this._adjustBoundingBox(i))}_getHitTarget(e,t,i){if(t.width===0||t.height===0||e.xt.right||e.yt.bottom||!i||!this._layerDom.contains(i))return;const r=this._ghostLayer.getImageData(e,t);if(r.data[0]===0&&r.data[1]===0&&r.data[2]===0)return!1;const a=ee.fromRGB(r.data[0],r.data[1],r.data[2]).toCSS();return this._colorMap[a]}_withEvents(e,t){const i=this._events[e];if(i!==void 0){i.dispatching=!0;try{t(i)}finally{i.dispatching=!1,i.cleanup&&(i.cleanup=!1,me(i.callbacks,r=>!r.disposed),i.callbacks.length===0&&(i.disposer.dispose(),delete this._events[e]))}}}_dispatchEventAll(e,t){this.interactionsEnabled&&this._withEvents(e,i=>{v(i.callbacks,r=>{r.disposed||r.callback.call(r.context,t)})})}_dispatchEvent(e,t,i){if(!this.interactionsEnabled)return!1;let r=!1;return this._withEvents(e,a=>{v(a.callbacks,s=>{s.disposed||s.object!==t||(s.callback.call(s.context,i),r=!0)})}),r}_dispatchMousedown(e,t){const i=e.button;if(i!=0&&i!=2&&i!=1&&i!==void 0)return;const r=this.getEvent(e),a=this._getHitTarget(r.originalPoint,r.bbox,t);if(a){const s=r.id;let n=!1;_e(a,u=>{const h={id:s,value:u};return this._mousedown.push(h),!n&&this._dispatchEvent("pointerdown",u,r)&&(n=!0,this._dragging.some(p=>p.value===u&&p.id===s)||this._dragging.push(h)),!0})}}_dispatchGlobalMousemove(e,t,i){const r=this.getEvent(e),a=this._getHitTarget(r.originalPoint,r.bbox,t);r.native=i,a?(this._hovering.forEach(s=>{s.contains(a)||(this._hovering.delete(s),s.cursorOverStyle&&xe(document.body,"cursor",s._replacedCursorStyle),this._dispatchEvent("pointerout",s,r))}),r.native&&_e(a,s=>(this._hovering.has(s)||(this._hovering.add(s),s.cursorOverStyle&&(s._replacedCursorStyle=At(document.body,"cursor"),xe(document.body,"cursor",s.cursorOverStyle)),this._dispatchEvent("pointerover",s,r)),!0))):(this._hovering.forEach(s=>{s.cursorOverStyle&&xe(document.body,"cursor",s._replacedCursorStyle),this._dispatchEvent("pointerout",s,r)}),this._hovering.clear()),this._dispatchEventAll("globalpointermove",r)}_dispatchGlobalMouseup(e,t){const i=this.getEvent(e);i.native=t,this._dispatchEventAll("globalpointerup",i)}_dispatchDragMove(e){if(this._dragging.length!==0){const t=this.getEvent(e),i=t.id;this._dragging.forEach(r=>{r.id===i&&this._dispatchEvent("pointermove",r.value,t)})}}_dispatchDragEnd(e,t){const i=e.button;let r;if(i==0||i===void 0)r="click";else if(i==2)r="rightclick";else{if(i!=1)return;r="middleclick"}const a=this.getEvent(e),s=a.id;if(this._mousedown.length!==0){const n=this._getHitTarget(a.originalPoint,a.bbox,t);n&&this._mousedown.forEach(u=>{u.id===s&&u.value.contains(n)&&this._dispatchEvent(r,u.value,a)}),this._mousedown.length=0}this._dragging.length!==0&&(this._dragging.forEach(n=>{n.id===s&&this._dispatchEvent("pointerup",n.value,a)}),this._dragging.length=0)}_dispatchDoubleClick(e,t){const i=this.getEvent(e),r=this._getHitTarget(i.originalPoint,i.bbox,t);r&&_e(r,a=>!this._dispatchEvent("dblclick",a,i))}_dispatchWheel(e,t){const i=this.getEvent(e),r=this._getHitTarget(i.originalPoint,i.bbox,t);r&&_e(r,a=>!this._dispatchEvent("wheel",a,i))}_makeSharedEvent(e,t){if(this._listeners[e]===void 0){const i=t();this._listeners[e]=new jt(()=>{delete this._listeners[e],i.dispose()})}return this._listeners[e].increment()}_onPointerEvent(e,t){let i=!1,r=null;function a(){r=null,i=!1}return new He([new X(()=>{r!==null&&clearTimeout(r),a()}),A(this.view,je(e),s=>{i=!0,r!==null&&clearTimeout(r),r=window.setTimeout(a,0)}),Qt(window,e,(s,n)=>{r!==null&&(clearTimeout(r),r=null),t(s,n,i),i=!1})])}_initEvent(e){switch(e){case"globalpointermove":case"pointerover":case"pointerout":return this._makeSharedEvent("pointermove",()=>{const t=(i,r,a)=>{this._lastPointerMoveEvent={events:i,target:r,native:a},v(i,s=>{this._dispatchGlobalMousemove(s,r,a)})};return new He([this._onPointerEvent("pointerdown",t),this._onPointerEvent("pointermove",t)])});case"globalpointerup":return this._makeSharedEvent("pointerup",()=>{const t=this._onPointerEvent("pointerup",(r,a,s)=>{v(r,n=>{this._dispatchGlobalMouseup(n,s)}),this._lastPointerMoveEvent={events:r,target:a,native:s}}),i=this._onPointerEvent("pointercancel",(r,a,s)=>{v(r,n=>{this._dispatchGlobalMouseup(n,s)}),this._lastPointerMoveEvent={events:r,target:a,native:s}});return new X(()=>{t.dispose(),i.dispose()})});case"click":case"rightclick":case"middleclick":case"pointerdown":case"pointermove":case"pointerup":return this._makeSharedEvent("pointerdown",()=>{const t=this._onPointerEvent("pointerdown",(s,n)=>{v(s,u=>{this._dispatchMousedown(u,n)})}),i=this._onPointerEvent("pointermove",s=>{v(s,n=>{this._dispatchDragMove(n)})}),r=this._onPointerEvent("pointerup",(s,n)=>{v(s,u=>{this._dispatchDragEnd(u,n)})}),a=this._onPointerEvent("pointercancel",(s,n)=>{v(s,u=>{this._dispatchDragEnd(u,n)})});return new X(()=>{t.dispose(),i.dispose(),r.dispose(),a.dispose()})});case"dblclick":return this._makeSharedEvent("dblclick",()=>this._onPointerEvent("dblclick",(t,i)=>{v(t,r=>{this._dispatchDoubleClick(r,i)})}));case"wheel":return this._makeSharedEvent("wheel",()=>A(window,je("wheel"),t=>{this._dispatchWheel(t,Ke(t))},{passive:!1}))}}_addEvent(e,t,i,r){let a=this._events[t];a===void 0&&(a=this._events[t]={disposer:this._initEvent(t),callbacks:[],dispatching:!1,cleanup:!1});const s={object:e,context:r,callback:i,disposed:!1};return a.callbacks.push(s),new X(()=>{s.disposed=!0,a.dispatching?a.cleanup=!0:(Ce(a.callbacks,s),a.callbacks.length===0&&(a.disposer.dispose(),delete this._events[t]))})}getCanvas(e,t){this.render(e),t||(t={});let i=this.resolution,r=Math.floor(this._calculatedWidth*this.resolution),a=Math.floor(this._calculatedHeight*this.resolution);if(t.minWidth&&t.minWidth>r){let l=t.minWidth/r;l>i&&(i=l*this.resolution)}if(t.minHeight&&t.minHeight>a){let l=t.minHeight/a;l>i&&(i=l*this.resolution)}if(t.maxWidth&&t.maxWidtha){let l=t.maxHeight/a;l{if(l&&l.visible&&(l.tainted||n)){b=!0,l.exportableView=l.view,l.exportableContext=l.context,l.view=document.createElement("canvas"),l.view.style.position="fixed",l.view.style.top="-10000px",this.view.appendChild(l.view),s.push(l.view);let m=0,o=0;l.margin&&(m+=l.margin.left||0+l.margin.right||0,o+=l.margin.top||0+l.margin.bottom||0),l.view.width=r+m,l.view.height=a+o,l.context=l.view.getContext("2d"),l.dirty=!0,l.scale=i}}),b&&(this._omitTainted=!0,this.render(e),this._omitTainted=!1),v(this.layers,l=>{if(l&&l.visible){let m=0,o=0;l.margin&&(m=-(l.margin.left||0)*this.resolution,o=-(l.margin.top||0)*this.resolution),h.drawImage(l.view,m,o),l.exportableView&&(l.view=l.exportableView,l.exportableView=void 0),l.exportableContext&&(l.context=l.exportableContext,l.exportableContext=void 0),p{l.style.position="",l.style.top="",this.view.removeChild(l)}),u}}class ki{constructor(){Object.defineProperty(this,"view",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"margin",{enumerable:!0,configurable:!0,writable:!0,value:{left:0,right:0,top:0,bottom:0}}),Object.defineProperty(this,"_width",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_height",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.view=document.createElement("canvas"),this.context=this.view.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.context.imageSmoothingEnabled=!1,this.view.style.position="absolute",this.view.style.top="0px",this.view.style.left="0px"}resize(e,t,i,r,a){e+=this.margin.left+this.margin.right,t+=this.margin.top+this.margin.bottom,i+=this.margin.left+this.margin.right,r+=this.margin.top+this.margin.bottom,this.view.style.left=-this.margin.left+"px",this.view.style.top=-this.margin.top+"px",this._width=Math.floor(e*a),this._height=Math.floor(t*a),this.view.width=this._width,this.view.style.width=i+"px",this.view.height=this._height,this.view.style.height=r+"px"}getImageData(e,t){return this.context.getImageData(Math.round((e.x-t.left)/t.width*this._width),Math.round((e.y-t.top)/t.height*this._height),1,1)}setMargin(e){this.margin.left=0,this.margin.right=0,this.margin.top=0,this.margin.bottom=0,v(e,t=>{t.margin&&(this.margin.left=Math.max(this.margin.left,t.margin.left),this.margin.right=Math.max(this.margin.right,t.margin.right),this.margin.top=Math.max(this.margin.top,t.margin.top),this.margin.bottom=Math.max(this.margin.bottom,t.margin.bottom))})}clear(){this.context.save(),this.context.fillStyle="#000",this.context.fillRect(0,0,this._width,this._height)}}class Ei{constructor(e,t){Object.defineProperty(this,"view",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tainted",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"margin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"order",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"scale",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dirty",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"exportableView",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exportableContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_width",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_height",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.view=e,this.context=t}resize(e,t,i,r,a){this.width!=null&&(e=this.width,i=this.width),this.height!=null&&(t=this.height,r=this.height),this.margin?(e+=this.margin.left+this.margin.right,t+=this.margin.top+this.margin.bottom,i+=this.margin.left+this.margin.right,r+=this.margin.top+this.margin.bottom,this.view.style.left=-this.margin.left+"px",this.view.style.top=-this.margin.top+"px"):(this.view.style.left="0px",this.view.style.top="0px"),this._width=Math.floor(e*a),this._height=Math.floor(t*a),this.view.width=this._width,this.view.style.width=i+"px",this.view.height=this._height,this.view.style.height=r+"px"}clear(){this.context.save(),this.context.clearRect(0,0,this._width,this._height)}}function Ne(d,e){d==null?requestAnimationFrame(e):setTimeout(()=>{requestAnimationFrame(e)},1e3/d)}class Be{constructor(e,t={},i){if(Object.defineProperty(this,"dom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_inner",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDirtyParents",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dirty",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dirtyParents",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dirtyBounds",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dirtyPositions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_ticker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_tickers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_updateTick",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new ut}),Object.defineProperty(this,"animationTime",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_animations",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_renderer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rootContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tooltipContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipContainerSettings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltip",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"language",{enumerable:!0,configurable:!0,writable:!0,value:$t.new(this,{})}),Object.defineProperty(this,"locale",{enumerable:!0,configurable:!0,writable:!0,value:it}),Object.defineProperty(this,"utc",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timezone",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fps",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numberFormatter",{enumerable:!0,configurable:!0,writable:!0,value:Ht.new(this,{})}),Object.defineProperty(this,"dateFormatter",{enumerable:!0,configurable:!0,writable:!0,value:Wt.new(this,{})}),Object.defineProperty(this,"durationFormatter",{enumerable:!0,configurable:!0,writable:!0,value:Ut.new(this,{})}),Object.defineProperty(this,"tabindex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_tabindexes",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_a11yD",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_focusElementDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_focusElementContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_focusedSprite",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isShift",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_keyboardDragPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipElementContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_readerAlertElement",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_logo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipDiv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nonce",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"interfaceColors",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"verticalLayout",{enumerable:!0,configurable:!0,writable:!0,value:ct.new(this,{})}),Object.defineProperty(this,"horizontalLayout",{enumerable:!0,configurable:!0,writable:!0,value:dt.new(this,{})}),Object.defineProperty(this,"gridLayout",{enumerable:!0,configurable:!0,writable:!0,value:bt.new(this,{})}),Object.defineProperty(this,"_paused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"autoResize",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_fontHash",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_isDisposed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_disposers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_resizeSensorDisposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltips",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_htmlElementContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_htmlEnabledContainers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),!i)throw new Error("You cannot use `new Class()`, instead use `Class.new()`");let r,a;if(this._settings=t,t.accessible==0&&(this._a11yD=!0),t.useSafeResolution==null&&(t.useSafeResolution=!0),t.useSafeResolution&&(r=_t()),this._renderer=new Oi(r),a=e instanceof HTMLElement?e:document.getElementById(e),v(ie.rootElements,u=>{if(u.dom===a)throw new Error("You cannot have multiple Roots on the same DOM node")}),this.interfaceColors=fe.new(this,{}),a===null)throw new Error("Could not find HTML element with id `"+e+"`");this.dom=a;let s=document.createElement("div");s.style.position="relative",s.style.width="100%",s.style.height="100%",a.appendChild(s);const n=t.tooltipContainerBounds;n&&(this._tooltipContainerSettings=n),this._inner=s,this._updateComputedStyles(),ie.rootElements.push(this)}static new(e,t){const i=new Be(e,t,!0);return i._init(),i}moveDOM(e){let t;if(t=e instanceof HTMLElement?e:document.getElementById(e),t){for(;this.dom.childNodes.length>0;)t.appendChild(this.dom.childNodes[0]);this.dom=t,this._initResizeSensor(),this.resize()}}_handleLogo(){if(this._logo){const e=this.dom.offsetWidth,t=this.dom.offsetHeight;e<=150||t<=60?this._logo.hide():this._logo.show()}}_showBranding(){if(!this._logo){const e=this.tooltipContainer.children.push(q.new(this,{interactive:!0,interactiveChildren:!1,position:"absolute",setStateOnChildren:!0,paddingTop:9,paddingRight:9,paddingBottom:9,paddingLeft:9,scale:.6,y:Ze(100),centerY:Z,tooltipText:"Created using amCharts 5",tooltipX:Z,cursorOverStyle:"pointer",background:ft.new(this,{fill:re(4671320),fillOpacity:0,tooltipY:5})})),t=Ve.new(this,{pointerOrientation:"horizontal",paddingTop:4,paddingRight:7,paddingBottom:4,paddingLeft:7});t.label.setAll({fontSize:12}),t.get("background").setAll({fill:this.interfaceColors.get("background"),stroke:this.interfaceColors.get("grid"),strokeOpacity:.3}),e.set("tooltip",t),e.events.on("click",()=>{window.open("https://www.amcharts.com/","_blank")}),e.states.create("hover",{}),e.children.push(ze.new(this,{stroke:re(13421772),strokeWidth:3,svgPath:"M5 25 L13 25h13.6c3.4 0 6 0 10.3-4.3s5.2-12 8.6-12c3.4 0 4.3 8.6 7.7 8.6M83.4 25H79.8c-3.4 0-6 0-10.3-4.3s-5.2-12-8.6-12-4.3 8.6-7.7 8.6"})).states.create("hover",{stroke:re(3976191)}),e.children.push(ze.new(this,{stroke:re(8947848),strokeWidth:3,svgPath:"M83.4 25h-31C37 25 39.5 4.4 28.4 4.4S18.9 24.2 4.3 25H0"})).states.create("hover",{stroke:re(4671320)}),this._logo=e,this._handleLogo()}}_getRealSize(){return this.dom.getBoundingClientRect()}_getCalculatedSize(e){return this._settings.calculateSize?this._settings.calculateSize(e):{width:e.width,height:e.height}}_init(){const e=this._settings;e.accessible!==!1&&(e.focusable&&(this._inner.setAttribute("focusable","true"),this._inner.setAttribute("tabindex",this.tabindex+"")),e.ariaLabel&&this._inner.setAttribute("aria-label",e.ariaLabel));const t=this._renderer,i=this._getRealSize(),r=this._getCalculatedSize(i),a=Math.floor(r.width),s=Math.floor(r.height),n=Math.floor(i.width),u=Math.floor(i.height),h=q.new(this,{visible:!0,width:a,height:s});this._rootContainer=h,this._rootContainer._defaultThemes.push(It.new(this));const p=h.children.push(q.new(this,{visible:!0,width:Z,height:Z}));this.container=p,t.resize(n,u,a,s),this._inner.appendChild(t.view),this._initResizeSensor();const c=document.createElement("div");if(this._htmlElementContainer=c,c.className="am5-html-container",c.style.position="absolute",c.style.pointerEvents="none",this._tooltipContainerSettings||(c.style.overflow="hidden"),this._inner.appendChild(c),this._a11yD!==!0){const b=document.createElement("div");b.className="am5-reader-container",b.setAttribute("role","alert"),b.style.position="absolute",b.style.width="1px",b.style.height="1px",b.style.overflow="hidden",b.style.clip="rect(1px, 1px, 1px, 1px)",this._readerAlertElement=b,this._inner.appendChild(this._readerAlertElement);const l=document.createElement("div");l.className="am5-focus-container",l.style.position="absolute",l.style.pointerEvents="none",l.style.top="0px",l.style.left="0px",l.style.overflow="hidden",l.style.width=a+"px",l.style.height=s+"px",l.setAttribute("role","graphics-document"),J(l,!1),this._focusElementContainer=l,this._inner.appendChild(this._focusElementContainer);const m=document.createElement("div");this._tooltipElementContainer=m,m.className="am5-tooltip-container",this._inner.appendChild(m),ge("keyboardevents")&&(this._disposers.push(A(window,"keydown",o=>{o.keyCode==16?this._isShift=!0:o.keyCode==9&&(this._isShift=o.shiftKey)})),this._disposers.push(A(window,"keyup",o=>{o.keyCode==16&&(this._isShift=!1)})),this._disposers.push(A(l,"click",()=>{const o=this._focusedSprite;if(o){const f=t.getEvent(new MouseEvent("click"));o.events.dispatch("click",{type:"click",originalEvent:f.event,point:f.point,simulated:!0,target:o})}})),this._disposers.push(A(l,"keydown",o=>{const f=this._focusedSprite;if(f){o.keyCode==27&&(pt(),this._focusedSprite=void 0);let g=0,x=0;switch(o.keyCode){case 13:o.preventDefault();const y=t.getEvent(new MouseEvent("click"));return void f.events.dispatch("click",{type:"click",originalEvent:y.event,point:y.point,simulated:!0,target:f});case 37:g=-6;break;case 39:g=6;break;case 38:x=-6;break;case 40:x=6;break;default:return}if(g!=0||x!=0){if(o.preventDefault(),!f.isDragging()){this._keyboardDragPoint={x:0,y:0};const P=t.getEvent(new MouseEvent("mousedown",{clientX:0,clientY:0}));f.events.isEnabled("pointerdown")&&f.events.dispatch("pointerdown",{type:"pointerdown",originalEvent:P.event,point:P.point,simulated:!0,target:f})}const y=this._keyboardDragPoint;y.x+=g,y.y+=x;const _=t.getEvent(new MouseEvent("mousemove",{clientX:y.x,clientY:y.y}),!1);f.events.isEnabled("globalpointermove")&&f.events.dispatch("globalpointermove",{type:"globalpointermove",originalEvent:_.event,point:_.point,simulated:!0,target:f})}}})),this._disposers.push(A(l,"keyup",o=>{if(this._focusedSprite){const f=this._focusedSprite,g=o.keyCode;switch(g){case 37:case 39:case 38:case 40:if(f.isDragging()){const x=this._keyboardDragPoint,y=t.getEvent(new MouseEvent("mouseup",{clientX:x.x,clientY:x.y}));return f.events.isEnabled("globalpointerup")&&f.events.dispatch("globalpointerup",{type:"globalpointerup",originalEvent:y.event,point:y.point,simulated:!0,target:f}),void(this._keyboardDragPoint=void 0)}if(f.get("focusableGroup")){const x=f.get("focusableGroup"),y=this._tabindexes.filter(E=>E.get("focusableGroup")==x&&E.getPrivate("focusable")!==!1);let _=y.indexOf(f);const P=y.length-1;_+=g==39||g==40?1:-1,_<0?_=P:_>P&&(_=0),gt(y[_].getPrivate("focusElement").dom)}}}})))}this._startTicker(),this.setThemes([]),this._addTooltip(),this._hasLicense()||this._showBranding()}_initResizeSensor(){this._resizeSensorDisposer&&this._resizeSensorDisposer.dispose(),this._resizeSensorDisposer=new Yt(this.dom,()=>{this.autoResize&&this.resize()}),this._disposers.push(this._resizeSensorDisposer)}resize(){const e=this._getRealSize(),t=this._getCalculatedSize(e),i=Math.floor(t.width),r=Math.floor(t.height);if(i>0&&r>0){const a=Math.floor(e.width),s=Math.floor(e.height),n=this._htmlElementContainer;if(n.style.width=i+"px",n.style.height=r+"px",this._a11yD!==!0){const h=this._focusElementContainer;h.style.width=i+"px",h.style.height=r+"px"}this._renderer.resize(a,s,i,r);const u=this._rootContainer;u.setPrivate("width",i),u.setPrivate("height",r),this._render(),this._handleLogo()}}_render(){this._renderer.render(this._rootContainer._display),this._focusElementDirty&&(this._updateCurrentFocus(),this._focusElementDirty=!1)}_runTickers(e){v(this._tickers,t=>{t(e)})}_runAnimations(e){me(this._animations,t=>t._runAnimation(e))}_runDirties(){let e={};for(;this._isDirtyParents;)this._isDirtyParents=!1,se(this._dirtyParents).forEach(s=>{const n=this._dirtyParents[s];delete this._dirtyParents[s],n.isDisposed()||(e[n.uid]=n,n._prepareChildren())});se(e).forEach(s=>{e[s]._updateChildren()});const t=[];se(this._dirty).forEach(s=>{const n=this._dirty[s];n.isDisposed()?delete this._dirty[n.uid]:(t.push(n),n._beforeChanged())}),t.forEach(s=>{s._changed(),delete this._dirty[s.uid],s._clearDirty()}),this._isDirty=!1;const i={},r=[];se(this._dirtyBounds).forEach(s=>{const n=this._dirtyBounds[s];delete this._dirtyBounds[s],n.isDisposed()||(i[n.uid]=n.depth(),r.push(n))}),this._positionHTMLElements(),r.sort((s,n)=>mt(i[n.uid],i[s.uid])),r.forEach(s=>{s._updateBounds()});const a=this._dirtyPositions;se(a).forEach(s=>{const n=a[s];delete a[s],n.isDisposed()||n._updatePosition()}),t.forEach(s=>{s._afterChanged()})}_renderFrame(e){return!this._updateTick||(this.events.isEnabled("framestarted")&&this.events.dispatch("framestarted",{type:"framestarted",target:this,timestamp:e}),this._checkComputedStyles(),this._runTickers(e),this._runAnimations(e),this._runDirties(),this._render(),this._positionHTMLElements(),this.events.isEnabled("frameended")&&this.events.dispatch("frameended",{type:"frameended",target:this,timestamp:e}),this._tickers.length===0&&this._animations.length===0&&!this._isDirty)}_runTicker(e,t){this.isDisposed()||(this.animationTime=e,this._renderFrame(e)?(this._ticker=null,this.animationTime=null):this._paused||(t?this._ticker:Ne(this.fps,this._ticker)))}_runTickerNow(e=1e4){if(!this.isDisposed()){const t=performance.now()+e;for(;;){const i=performance.now();if(i>=t){this.animationTime=null;break}if(this.animationTime=i,this._renderFrame(i)){this.animationTime=null;break}}}}_startTicker(){this._ticker===null&&(this.animationTime=null,this._ticker=e=>{this._runTicker(e)},Ne(this.fps,this._ticker))}get updateTick(){return this._updateTick}set updateTick(e){this._updateTick=e,e&&this._startTicker()}_addDirtyEntity(e){this._dirty[e.uid]===void 0&&(this._isDirty=!0,this._dirty[e.uid]=e,this._startTicker())}_addDirtyParent(e){this._dirtyParents[e.uid]===void 0&&(this._isDirty=!0,this._isDirtyParents=!0,this._dirtyParents[e.uid]=e,this._startTicker())}_addDirtyBounds(e){this._dirtyBounds[e.uid]===void 0&&(this._isDirty=!0,this._dirtyBounds[e.uid]=e,this._startTicker())}_addDirtyPosition(e){this._dirtyPositions[e.uid]===void 0&&(this._isDirty=!0,this._dirtyPositions[e.uid]=e,this._startTicker())}_addAnimation(e){this._animations.indexOf(e)===-1&&(this._animations.push(e),this._startTicker())}_markDirty(){this._isDirty=!0}_markDirtyRedraw(){this.events.once("frameended",()=>{this._isDirty=!0,this._startTicker()})}eachFrame(e){return this._tickers.push(e),this._startTicker(),new X(()=>{Ce(this._tickers,e)})}markDirtyGlobal(e){e||(e=this.container),e.walkChildren(t=>{t instanceof q&&this.markDirtyGlobal(t),t.markDirty(),t.markDirtyBounds()})}width(){return Math.floor(this._getCalculatedSize(this._getRealSize()).width)}height(){return Math.floor(this._getCalculatedSize(this._getRealSize()).height)}dispose(){this._isDisposed||(this._isDisposed=!0,this._rootContainer.dispose(),this._renderer.dispose(),this.horizontalLayout.dispose(),this.verticalLayout.dispose(),this.interfaceColors.dispose(),v(this._disposers,e=>{e.dispose()}),this._inner&&yt(this._inner),ae(ie.rootElements,this))}isDisposed(){return this._isDisposed}readerAlert(e){this._a11yD!==!0&&(this._readerAlertElement.innerHTML=Ie(e))}setThemes(e){this._rootContainer.set("themes",e);const t=this.tooltipContainer;t&&t._applyThemes();const i=this.interfaceColors;i&&i._applyThemes()}_addTooltip(){if(!this.tooltipContainer){const e=this._tooltipContainerSettings,t=this._rootContainer.children.push(q.new(this,{position:"absolute",isMeasured:!1,width:Z,height:Z,layer:e?35:30,layerMargin:e||void 0}));this.tooltipContainer=t;const i=Ve.new(this,{});this.container.set("tooltip",i),i.hide(0),this._tooltip=i}}_registerTabindexOrder(e){this._a11yD!=1&&(e.get("focusable")?Te(this._tabindexes,e):ae(this._tabindexes,e),this._invalidateTabindexes())}_unregisterTabindexOrder(e){this._a11yD!=1&&(ae(this._tabindexes,e),this._invalidateTabindexes())}_invalidateTabindexes(){if(this._a11yD==1)return;this._tabindexes.sort((t,i)=>{const r=t.get("tabindexOrder",0),a=i.get("tabindexOrder",0);return r==a?0:r>a?1:-1});const e=[];v(this._tabindexes,(t,i)=>{t.getPrivate("focusElement")?this._moveFocusElement(i,t):this._makeFocusElement(i,t);const r=t.get("focusableGroup");r&&t.getPrivate("focusable")!==!1&&(e.indexOf(r)!==-1?t.getPrivate("focusElement").dom.setAttribute("tabindex","-1"):e.push(r))})}_updateCurrentFocus(){this._a11yD!=1&&this._focusedSprite&&(this._decorateFocusElement(this._focusedSprite),this._positionFocusElement(this._focusedSprite))}_decorateFocusElement(e,t){if(this._a11yD==1||(t||(t=e.getPrivate("focusElement").dom),!t))return;const i=e.get("role");i?t.setAttribute("role",i):t.removeAttribute("role");const r=e.get("ariaLabel");if(r){const l=vt(e,r);t.setAttribute("aria-label",l)}else t.removeAttribute("aria-label");const a=e.get("ariaLive");a?t.setAttribute("aria-live",a):t.removeAttribute("aria-live");const s=e.get("ariaChecked");s!=null?t.setAttribute("aria-checked",s?"true":"false"):t.removeAttribute("aria-checked"),e.get("ariaHidden")?t.setAttribute("aria-hidden","true"):t.removeAttribute("aria-hidden");const n=e.get("ariaOrientation");n?t.setAttribute("aria-orientation",n):t.removeAttribute("aria-orientation");const u=e.get("ariaValueNow");u?t.setAttribute("aria-valuenow",u):t.removeAttribute("aria-valuenow");const h=e.get("ariaValueMin");h?t.setAttribute("aria-valuemin",h):t.removeAttribute("aria-valuemin");const p=e.get("ariaValueMax");p?t.setAttribute("aria-valuemax",p):t.removeAttribute("aria-valuemax");const c=e.get("ariaValueText");c?t.setAttribute("aria-valuetext",c):t.removeAttribute("aria-valuetext");const b=e.get("ariaControls");b?t.setAttribute("aria-controls",b):t.removeAttribute("aria-controls"),e.get("visible")&&e.get("opacity")!==0&&e.get("role")!="tooltip"&&!e.isHidden()&&e.getPrivate("focusable")!==!1?(t.getAttribute("tabindex")!="-1"&&t.setAttribute("tabindex",""+this.tabindex),t.removeAttribute("aria-hidden")):(t.removeAttribute("tabindex"),t.setAttribute("aria-hidden","true"))}_makeFocusElement(e,t){if(t.getPrivate("focusElement")||this._a11yD==1)return;const i=document.createElement("div");t.get("role")!="tooltip"&&(i.tabIndex=this.tabindex),i.style.position="absolute",J(i,!1);const r=[];t.setPrivate("focusElement",{dom:i,disposers:r}),this._decorateFocusElement(t),r.push(A(i,"focus",a=>{this._handleFocus(a,e)})),r.push(A(i,"blur",a=>{this._handleBlur(a,e)})),this._moveFocusElement(e,t)}_removeFocusElement(e){if(this._a11yD==1)return;ae(this._tabindexes,e);const t=e.getPrivate("focusElement");t&&(this._focusElementContainer.removeChild(t.dom),v(t.disposers,i=>{i.dispose()}))}_hideFocusElement(e){this._a11yD!=1&&(e.getPrivate("focusElement").dom.style.display="none")}_moveFocusElement(e,t){if(this._a11yD==1)return;const i=this._focusElementContainer,r=t.getPrivate("focusElement").dom;if(r===this._focusElementContainer.children[e])return;const a=this._focusElementContainer.children[e+1];a?i.insertBefore(r,a):i.append(r)}_positionFocusElement(e){if(this._a11yD==1||e==null)return;const t=e.globalBounds();let i=t.right==t.left?e.width():t.right-t.left,r=t.top==t.bottom?e.height():t.bottom-t.top,a=t.left-2,s=t.top-2;i<0&&(a+=i,i=Math.abs(i)),r<0&&(s+=r,r=Math.abs(r));const n=e.getPrivate("focusElement").dom;n.style.top=s+"px",n.style.left=a+"px",n.style.width=i+4+"px",n.style.height=r+4+"px"}_handleFocus(e,t){if(this._a11yD==1)return;const i=this._tabindexes[t];i.isVisibleDeep()?(this._positionFocusElement(i),this._focusedSprite=i,i.events.isEnabled("focus")&&i.events.dispatch("focus",{type:"focus",originalEvent:e,target:i})):this._focusNext(e.target,this._isShift?-1:1)}_focusNext(e,t){if(this._a11yD==1)return;const i=Array.from(document.querySelectorAll(["a[href]","area[href]","button:not([disabled])","details","input:not([disabled])","iframe:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[contentEditable=""]','[contentEditable="true"]','[contentEditable="TRUE"]','[tabindex]:not([tabindex^="-"])'].join(",")));let r=i.indexOf(e)+t;r<0?r=i.length-1:r>=i.length&&(r=0),i[r].focus()}_handleBlur(e,t){if(this._a11yD==1)return;const i=this._focusedSprite;i&&i.events.isEnabled("blur")&&i.events.dispatch("blur",{type:"blur",originalEvent:e,target:i}),this._focusedSprite=void 0}updateTooltip(e){if(this._a11yD==1)return;const t=Ie(e._getText());let i=e.getPrivate("tooltipElement");e.get("role")=="tooltip"&&t!=""?(i||(i=this._makeTooltipElement(e)),i.innerHTML!=t&&(i.innerHTML=t)):i&&(i.remove(),e.removePrivate("tooltipElement"))}_makeTooltipElement(e){const t=this._tooltipElementContainer,i=document.createElement("div");return i.style.position="absolute",i.style.width="1px",i.style.height="1px",i.style.overflow="hidden",i.style.clip="rect(1px, 1px, 1px, 1px)",J(i,!1),this._decorateFocusElement(e,i),t.append(i),e.setPrivate("tooltipElement",i),i}_removeTooltipElement(e){if(this._a11yD==1)return;const t=e.getPrivate("tooltipElement");if(t){const i=t.parentElement;i&&i.removeChild(t)}}_invalidateAccessibility(e){if(this._a11yD==1)return;this._focusElementDirty=!0;const t=e.getPrivate("focusElement");e.get("focusable")?t&&(this._decorateFocusElement(e),this._positionFocusElement(e)):t&&this._removeFocusElement(e)}focused(e){return this._focusedSprite===e}documentPointToRoot(e){const t=this._getRealSize(),i=this._getCalculatedSize(t),r=i.width/t.width,a=i.height/t.height;return{x:(e.x-t.left)*r,y:(e.y-t.top)*a}}rootPointToDocument(e){const t=this._getRealSize(),i=this._getCalculatedSize(t),r=i.width/t.width,a=i.height/t.height;return{x:e.x/r+t.left,y:e.y/a+t.top}}addDisposer(e){return this._disposers.push(e),e}_updateComputedStyles(){const e=window.getComputedStyle(this.dom);let t="";ue(e,(r,a)=>{pe(r)&&r.match(/^font/)&&(t+=a)});const i=t!=this._fontHash;return i&&(this._fontHash=t),i}_checkComputedStyles(){this._updateComputedStyles()&&this._invalidateLabelBounds(this.container)}_invalidateLabelBounds(e){e instanceof q?e.children.each(t=>{this._invalidateLabelBounds(t)}):e instanceof wt&&e.markDirtyBounds()}_hasLicense(){for(let e=0;e{const a=this._renderer.getEvent(r);e.events.dispatch("click",{type:"click",originalEvent:a.event,point:a.point,simulated:!1,target:e})}))),this._positionHTMLElement(e),t.append(i),Te(this._htmlEnabledContainers,e),i}_positionHTMLElements(){v(this._htmlEnabledContainers,e=>{this._positionHTMLElement(e)})}_positionHTMLElement(e){const t=e.getPrivate("htmlElement");if(t){v(["paddingTop","paddingRight","paddingBottom","paddingLeft","minWidth","minHeight","maxWidth","maxHeight"],p=>{const c=e.get(p);t.style[p]=c?c+"px":""});const i=e.compositeOpacity();setTimeout(()=>{t.style.opacity=i+""},10);const r=e.isVisibleDeep();r&&(t.style.display="block");const a=e.globalBounds();t.style.top=a.top+"px",t.style.left=a.left+"px";const s=e.get("width"),n=e.get("height");let u=0,h=0;if(s&&(u=e.width()),n&&(h=e.height()),s&&n)e.removePrivate("minWidth"),e.removePrivate("minHeight");else{t.style.position="fixed",t.style.width="",t.style.height="";const p=t.getBoundingClientRect();t.style.position="absolute",u=p.width,h=p.height,e._adjustedLocalBounds={left:0,right:0,top:0,bottom:0},e.setPrivate("minWidth",u),e.setPrivate("minHeight",h)}u>0&&(t.style.minWidth=u+"px"),h>0&&(t.style.minHeight=h+"px"),r&&i!=0||(t.style.display="none")}}_setHTMLContent(e,t){let i=e.getPrivate("htmlElement");i||(i=this._makeHTMLElement(e)),i.innerHTML!=t&&(i.innerHTML=t)}_removeHTMLContent(e){let t=e.getPrivate("htmlElement");t&&this._htmlElementContainer.removeChild(t),ae(this._htmlEnabledContainers,e)}}ot("AM5C241025748");const Ge="en-us",Ae=new Map([["ar",()=>w(()=>import("./ar-m2Ru99Kw.js"),__vite__mapDeps([]))],["bg-bg",()=>w(()=>import("./bg_BG-Zh0O8yIZ.js"),__vite__mapDeps([]))],["bs-ba",()=>w(()=>import("./bs_BA-EoGo05fu.js"),__vite__mapDeps([]))],["ca-es",()=>w(()=>import("./ca_ES-hscFeNNn.js"),__vite__mapDeps([]))],["cs-cz",()=>w(()=>import("./cs_CZ-6GM5cGtg.js"),__vite__mapDeps([]))],["da-dk",()=>w(()=>import("./da_DK-havyKYv2.js"),__vite__mapDeps([]))],["de-de",()=>w(()=>import("./de_DE-Fwy8dxxc.js"),__vite__mapDeps([]))],["de-ch",()=>w(()=>import("./de_CH-V5QttSa-.js"),__vite__mapDeps([]))],["el-gr",()=>w(()=>import("./el_GR-Yz-QyhSI.js"),__vite__mapDeps([]))],["en-us",()=>w(()=>import("./en_US-eyWLRifP.js"),__vite__mapDeps([]))],["en-ca",()=>w(()=>import("./en_CA-eyWLRifP.js"),__vite__mapDeps([]))],["es-es",()=>w(()=>import("./es_ES-o2wkmEuo.js"),__vite__mapDeps([]))],["et-ee",()=>w(()=>import("./et_EE-jAuARBOS.js"),__vite__mapDeps([]))],["fi-fi",()=>w(()=>import("./fi_FI-d4Rs7vi8.js"),__vite__mapDeps([]))],["fr-fr",()=>w(()=>import("./fr_FR-hDvN628_.js"),__vite__mapDeps([]))],["he-il",()=>w(()=>import("./he_IL-uMiAw4Wl.js"),__vite__mapDeps([]))],["hr-hr",()=>w(()=>import("./hr_HR-tOrtwB1u.js"),__vite__mapDeps([]))],["hu-hu",()=>w(()=>import("./hu_HU-tBJnhXJb.js"),__vite__mapDeps([]))],["id-id",()=>w(()=>import("./id_ID-XHyCBpw9.js"),__vite__mapDeps([]))],["it-it",()=>w(()=>import("./it_IT-AbCCe__c.js"),__vite__mapDeps([]))],["ja-jp",()=>w(()=>import("./ja_JP-Rlf-hOL0.js"),__vite__mapDeps([]))],["ko-kr",()=>w(()=>import("./ko_KR-_v1iWWtT.js"),__vite__mapDeps([]))],["lt-lt",()=>w(()=>import("./lt_LT-UBpPtM2w.js"),__vite__mapDeps([]))],["lv-lv",()=>w(()=>import("./lv_LV-Wuccr2bP.js"),__vite__mapDeps([]))],["nb-no",()=>w(()=>import("./nb_NO-QiKaA4xA.js"),__vite__mapDeps([]))],["nl-nl",()=>w(()=>import("./nl_NL-YPMyQFKz.js"),__vite__mapDeps([]))],["pl-pl",()=>w(()=>import("./pl_PL-1aQ453OS.js"),__vite__mapDeps([]))],["pt-br",()=>w(()=>import("./pt_BR-lyUqGwB2.js"),__vite__mapDeps([]))],["pt-pt",()=>w(()=>import("./pt_PT-o6ZnsHgl.js"),__vite__mapDeps([]))],["ro-ro",()=>w(()=>import("./ro_RO-YIwLBwwg.js"),__vite__mapDeps([]))],["ru-ru",()=>w(()=>import("./ru_RU-Xn7Ds-ry.js"),__vite__mapDeps([]))],["sk-sk",()=>w(()=>import("./sk_SK-lW-A9Llp.js"),__vite__mapDeps([]))],["sl-sl",()=>w(()=>import("./sl_SL-DJbbPhCy.js"),__vite__mapDeps([]))],["sr-rs",()=>w(()=>import("./sr_RS-HTzJ9Pkx.js"),__vite__mapDeps([]))],["sv-se",()=>w(()=>import("./sv_SE-Z8LyXaIi.js"),__vite__mapDeps([]))],["th-th",()=>w(()=>import("./th_TH-4uUl3VxF.js"),__vite__mapDeps([]))],["tr-tr",()=>w(()=>import("./tr_TR-vXXQf5Mr.js"),__vite__mapDeps([]))],["uk-ua",()=>w(()=>import("./uk_UA-DutcYu8K.js"),__vite__mapDeps([]))],["vi-vn",()=>w(()=>import("./vi_VN-bEo-fMOP.js"),__vite__mapDeps([]))],["zh-cn",()=>w(()=>import("./zh_Hans-l-imEkFY.js"),__vite__mapDeps([]))],["zh-hk",()=>w(()=>import("./zh_Hant-8IW9KGhY.js"),__vite__mapDeps([]))],["zh-tw",()=>w(()=>import("./zh_Hant-8IW9KGhY.js"),__vite__mapDeps([]))]]);function Mi(d){const e=d.split("-")[0].toLowerCase();let t=null;for(const i of Ae.keys())if(i.startsWith(e)){t=i;break}return t}function Si(d){return d?Ae.has(d.toLowerCase())?d.toLowerCase():Mi(d)||Ge:Ge}async function Ti(d,e=nt()){const t=Be.new(d);return t.locale=(await Ae.get(Si(e))()).default,t}const Ai=Object.freeze(Object.defineProperty({__proto__:null,createRoot:Ti},Symbol.toStringTag,{value:"Module"}));export{Ht as S,Ti as Y,Ai as c}; +import{mO as nt,de as w}from"./index-pCX-0tJH.js";import{E as te,a3 as ot,a4 as pe,a5 as qe,a6 as De,J as lt,a7 as Q,a8 as K,q as ue,a9 as ht,aa as U,ab as ut,ac as ct,ad as dt,A as bt,ae as _t,m as v,af as ie,Q as q,z as Ze,Y as Z,V as ft,t as re,W as ze,ag as J,r as ge,c as A,ah as pt,ai as gt,aj as me,$ as se,ak as mt,al as X,y as Ce,am as yt,v as ae,an as Ie,ao as Te,a1 as vt,M as wt,ap as Je,l as H,aq as xt,ar as C,as as de,at as be,au as Re,av as Pt,aw as Fe,ax as Ot,ay as kt,az as V,aA as Ye,aB as Et,_ as Mt,aC as St,aD as Tt,Z as ee,aE as xe,aF as jt,H as He,aG as je,aH as Ke,D as Dt,aI as Ct,aJ as Qe,K as et,U as Bt,aK as At,aL as Lt,N as zt,aM as le,aN as Pe}from"./Theme-5CV7oVsW.js";import{u as Ve}from"./Tooltip-4JsqFz5S.js";import{s as It}from"./DefaultTheme-uOYPzulo.js";class Rt{constructor(){Object.defineProperty(this,"_observer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_targets",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this._observer=new ResizeObserver(e=>{v(e,t=>{v(this._targets,i=>{i.target===t.target&&i.callback()})})})}addTarget(e,t){this._observer.observe(e,{box:"border-box"}),this._targets.push({target:e,callback:t})}removeTarget(e){this._observer.unobserve(e),me(this._targets,t=>t.target!==e)}}class ye{constructor(){Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_targets",{enumerable:!0,configurable:!0,writable:!0,value:[]})}addTarget(e,t){if(this._timer===null){let r=null;const a=()=>{const s=Date.now();(r===null||s>r+ye.delay)&&(r=s,v(this._targets,n=>{let u=n.target.getBoundingClientRect();u.width===n.size.width&&u.height===n.size.height||(n.size=u,n.callback())})),this._targets.length===0?this._timer=null:this._timer=requestAnimationFrame(a)};this._timer=requestAnimationFrame(a)}let i={width:0,height:0,left:0,right:0,top:0,bottom:0,x:0,y:0};this._targets.push({target:e,callback:t,size:i})}removeTarget(e){me(this._targets,t=>t.target!==e),this._targets.length===0&&this._timer!==null&&(cancelAnimationFrame(this._timer),this._timer=null)}}Object.defineProperty(ye,"delay",{enumerable:!0,configurable:!0,writable:!0,value:200});let Oe=null;function Ft(){return Oe===null&&(Oe=typeof ResizeObserver<"u"?new Rt:new ye),Oe}class Yt{constructor(e,t){Object.defineProperty(this,"_sensor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_disposed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this._sensor=Ft(),this._element=e,this._listener=Je(t),this._sensor.addTarget(e,t)}isDisposed(){return this._disposed}dispose(){this._disposed||(this._disposed=!0,this._sensor.removeTarget(this._element),this._listener.dispose())}get sensor(){return this._sensor}}class fe extends te{}Object.defineProperty(fe,"className",{enumerable:!0,configurable:!0,writable:!0,value:"InterfaceColors"}),Object.defineProperty(fe,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:te.classNames.concat([fe.className])});class Ht extends te{_setDefaults(){this._setDefault("negativeBase",0),this._setDefault("numberFormat","#,###.#####"),this._setDefault("smallNumberThreshold",1);const e="_big_number_suffix_",t="_small_number_suffix_",i="_byte_suffix_";this._setDefault("bigNumberPrefixes",[{number:1e3,suffix:this._t(e+"3")},{number:1e6,suffix:this._t(e+"6")},{number:1e9,suffix:this._t(e+"9")},{number:1e12,suffix:this._t(e+"12")},{number:1e15,suffix:this._t(e+"15")},{number:1e18,suffix:this._t(e+"18")},{number:1e21,suffix:this._t(e+"21")},{number:1e24,suffix:this._t(e+"24")}]),this._setDefault("smallNumberPrefixes",[{number:1e-24,suffix:this._t(t+"24")},{number:1e-21,suffix:this._t(t+"21")},{number:1e-18,suffix:this._t(t+"18")},{number:1e-15,suffix:this._t(t+"15")},{number:1e-12,suffix:this._t(t+"12")},{number:1e-9,suffix:this._t(t+"9")},{number:1e-6,suffix:this._t(t+"6")},{number:.001,suffix:this._t(t+"3")}]),this._setDefault("bytePrefixes",[{number:1,suffix:this._t(i+"B")},{number:1024,suffix:this._t(i+"KB")},{number:1048576,suffix:this._t(i+"MB")},{number:1073741824,suffix:this._t(i+"GB")},{number:1099511627776,suffix:this._t(i+"TB")},{number:0x4000000000000,suffix:this._t(i+"PB")}]),super._setDefaults()}_beforeChanged(){super._beforeChanged()}format(e,t,i){let r;(t==null||pe(t)&&t.toLowerCase()==="number")&&(t=this.get("numberFormat",""));let a=Number(e);if(qe(t))try{return this.get("intlLocales")?new Intl.NumberFormat(this.get("intlLocales"),t).format(a):new Intl.NumberFormat(void 0,t).format(a)}catch{return"Invalid"}else{t=De(t);let s,n=this.parseFormat(t,this._root.language);s=a>this.get("negativeBase")?n.positive:a{if(u.parsed)return;let h=u.source;h.toLowerCase()==="number"&&(h=this.get("numberFormat","#,###.#####"));let p=U.chunk(h,!0);for(let c=0;c=0?e.toExponential(t.decimals.passive).split("e"):e.toExponential().split("e"),e=Number(c[0]),a="e"+c[1],t.modSpacing&&(a=" "+a)}else if(t.decimals.passive===0)e=Math.round(e);else if(t.decimals.passive>0){let c=Math.pow(10,t.decimals.passive);e=Math.round(e*c)/c}let n="",u=ht(e).split("."),h=u[0];if(h.length0){let c=[],b=h.split("").reverse().join("");for(let l=0,m=h.length;l<=m;l+=t.thousands.interval){let o=b.substr(l,t.thousands.interval).split("").reverse().join("");o!==""&&c.unshift(o)}h=c.join(t.thousands.separator)}n+=h,u.length===1&&u.push("");let p=u[1];return p.length{switch(p.type){case"year":t=+p.value;break;case"month":i=+p.value-1;break;case"day":r=+p.value;break;case"hour":a=+p.value;break;case"minute":s=+p.value;break;case"second":n=+p.value;break;case"fractionalSecond":u=+p.value;break;case"weekday":switch(p.value){case"Sun":h=0;break;case"Mon":h=1;break;case"Tue":h=2;break;case"Wed":h=3;break;case"Thu":h=4;break;case"Fri":h=5;break;case"Sat":h=6}}}),a===24&&(a=0),{year:t,month:i,day:r,hour:a,minute:s,second:n,millisecond:u,weekday:h}}function We(d,e){const{year:t,month:i,day:r,hour:a,minute:s,second:n,millisecond:u}=tt(d,e);return Date.UTC(t,i,r,a,s,n,u)}class Vt{constructor(e,t){if(Object.defineProperty(this,"_utc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dtf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),!t)throw new Error("You cannot use `new Class()`, instead use `Class.new()`");this.name=e,this._utc=new Intl.DateTimeFormat("UTC",{hour12:!1,timeZone:"UTC",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",fractionalSecondDigits:3}),this._dtf=new Intl.DateTimeFormat("UTC",{hour12:!1,timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",fractionalSecondDigits:3})}static new(e){return new this(e,!0)}convertLocal(e){const t=this.offsetUTC(e),i=e.getTimezoneOffset(),r=new Date(e);r.setUTCMinutes(r.getUTCMinutes()-(t-i));const a=r.getTimezoneOffset();return i!=a&&r.setUTCMinutes(r.getUTCMinutes()+a-i),r}offsetUTC(e){return(We(this._utc,e)-We(this._dtf,e))/6e4}parseDate(e){return tt(this._dtf,e)}}class Wt extends te{_setDefaults(){this._setDefault("capitalize",!0),this._setDefault("dateFormat","yyyy-MM-dd"),super._setDefaults()}_beforeChanged(){super._beforeChanged()}format(e,t){let i;t!==void 0&&t!==""||(t=this.get("dateFormat","yyyy-MM-dd"));let r=e;if(qe(t))try{const n=this.get("intlLocales");return n?new Intl.DateTimeFormat(n,t).format(r):new Intl.DateTimeFormat(void 0,t).format(r)}catch{return"Invalid"}let a=this.parseFormat(t);const s=this._root.timezone;return s&&!this._root.utc&&(r=s.convertLocal(r)),H(r.getTime())?(i=this.applyFormat(r,a),this.get("capitalize")&&(i=i.replace(/^.{1}/,i.substr(0,1).toUpperCase())),i):"Invalid date"}applyFormat(e,t){let i,r,a,s,n,u,h,p,c=t.template,b=e.getTime();this._root.utc?(i=e.getUTCFullYear(),r=e.getUTCMonth(),a=e.getUTCDay(),s=e.getUTCDate(),n=e.getUTCHours(),u=e.getUTCMinutes(),h=e.getUTCSeconds(),p=e.getUTCMilliseconds()):(i=e.getFullYear(),r=e.getMonth(),a=e.getDay(),s=e.getDate(),n=e.getHours(),u=e.getMinutes(),h=e.getSeconds(),p=e.getMilliseconds());for(let l=0,m=t.parts.length;l=12?this._t("PM"):this._t("AM");break;case"aa":o=n>=12?this._t("P.M."):this._t("A.M.");break;case"aaa":o=n>=12?this._t("P"):this._t("A");break;case"h":o=be(n).toString();break;case"hh":o=C(be(n),2,"0");break;case"H":o=n.toString();break;case"HH":o=C(n,2,"0");break;case"K":o=be(n,0).toString();break;case"KK":o=C(be(n,0),2,"0");break;case"k":o=(n+1).toString();break;case"kk":o=C(n+1,2,"0");break;case"m":o=u.toString();break;case"mm":o=C(u,2,"0");break;case"s":o=h.toString();break;case"ss":o=C(h,2,"0");break;case"S":case"SS":case"SSS":o=Math.round(p/1e3*Math.pow(10,t.parts[l].length)).toString();break;case"x":o=b.toString();break;case"n":case"nn":case"nnn":o=C(p,t.parts[l].length,"0");break;case"z":o=de(e,!1,!1,this._root.utc,this._root.timezone?this._root.timezone.name:void 0);break;case"zz":o=de(e,!0,!1,this._root.utc,this._root.timezone?this._root.timezone.name:void 0);break;case"zzz":o=de(e,!1,!0,this._root.utc,this._root.timezone?this._root.timezone.name:void 0);break;case"zzzz":o=de(e,!0,!0,this._root.utc,this._root.timezone?this._root.timezone.name:void 0);break;case"Z":case"ZZ":let g=this._root.utc?"UTC":this._root.timezone;g instanceof Vt&&(g=g.name);const x=g?xt(g):e.getTimezoneOffset();let y=Math.abs(x)/60,_=Math.floor(y),P=60*y-60*_;this._root.utc&&(_=0,P=0),t.parts[l]=="Z"?(o="GMT",o+=x>0?"-":"+",o+=C(_,2)+":"+C(P,2)):(o=x>0?"-":"+",o+=C(_,2)+C(P,2));break;case"i":o=e.toISOString();break;case"I":o=e.toUTCString()}c=c.replace(Q,o)}return c}parseFormat(e){let t={template:"",parts:[]},i=U.chunk(e,!0);for(let r=0;r-1&&(n.year=parseInt(c[s.year])),s.year3>-1){let b=parseInt(c[s.year3]);b+=1e3,n.year=b}if(s.year2>-1){let b=parseInt(c[s.year2]);b+=b>50?1e3:2e3,n.year=b}if(s.year1>-1){let b=parseInt(c[s.year1]);b=10*Math.floor(new Date().getFullYear()/10)+b,n.year=b}if(s.monthLong>-1&&(n.month=this.resolveMonth(c[s.monthLong])),s.monthShort>-1&&(n.month=this.resolveShortMonth(c[s.monthShort])),s.month>-1&&(n.month=parseInt(c[s.month])-1),s.week>-1&&s.day===-1&&(n.month=0,n.day=kt(parseInt(c[s.week]),n.year,1,this._root.utc)),s.day>-1&&(n.day=parseInt(c[s.day])),s.yearDay>-1&&(n.month=0,n.day=parseInt(c[s.yearDay])),s.hourBase0>-1&&(n.hour=parseInt(c[s.hourBase0])),s.hourBase1>-1&&(n.hour=parseInt(c[s.hourBase1])-1),s.hour12Base0>-1){let b=parseInt(c[s.hour12Base0]);b==11&&(b=0),s.am>-1&&!this.isAm(c[s.am])&&(b+=12),n.hour=b}if(s.hour12Base1>-1){let b=parseInt(c[s.hour12Base1]);b==12&&(b=0),s.am>-1&&!this.isAm(c[s.am])&&(b+=12),n.hour=b}if(s.minute>-1&&(n.minute=parseInt(c[s.minute])),s.second>-1&&(n.second=parseInt(c[s.second])),s.millisecond>-1){let b=parseInt(c[s.millisecond]);s.millisecondDigits==2?b*=10:s.millisecondDigits==1&&(b*=100),n.millisecond=b}if(s.timestamp>-1){n.timestamp=parseInt(c[s.timestamp]);const b=new Date(n.timestamp);n.year=b.getUTCFullYear(),n.month=b.getUTCMonth(),n.day=b.getUTCDate(),n.hour=b.getUTCHours(),n.minute=b.getUTCMinutes(),n.second=b.getUTCSeconds(),n.millisecond=b.getUTCMilliseconds()}s.zone>-1&&(n.offset=this.resolveTimezoneOffset(new Date(n.year,n.month,n.day),c[s.zone])),s.iso>-1&&(n.year=V(c[s.iso+0]),n.month=V(c[s.iso+1])-1,n.day=V(c[s.iso+2]),n.hour=V(c[s.iso+3]),n.minute=V(c[s.iso+4]),n.second=V(c[s.iso+5]),n.millisecond=V(c[s.iso+6]),c[s.iso+7]=="Z"||c[s.iso+7]=="z"?n.utc=!0:c[s.iso+7]!=""&&(n.offset=this.resolveTimezoneOffset(new Date(n.year,n.month,n.day),c[s.iso+7]))),i=n.utc?new Date(Date.UTC(n.year,n.month,n.day,n.hour,n.minute,n.second,n.millisecond)):new Date(n.year,n.month,n.day,n.hour,n.minute+n.offset,n.second,n.millisecond)}else i=new Date(e);return i}resolveTimezoneOffset(e,t){if(t.match(/([+\-]?)([0-9]{2}):?([0-9]{2})/)){let i=t.match(/([+\-]?)([0-9]{2}):?([0-9]{2})/),r=i[1],a=i[2],s=i[3],n=60*parseInt(a)+parseInt(s);return r=="+"&&(n*=-1),n-(e||new Date).getTimezoneOffset()}return 0}resolveMonth(e){let t=this._months().indexOf(e);return t>-1||!this._root.language.isDefault()&&(t=this._root.language.translateAll(this._months()).indexOf(e),t>-1)?t:0}resolveShortMonth(e){let t=this._shortMonths().indexOf(e);return t>-1?t:(t=this._months().indexOf(e),t>-1||this._root.language&&!this._root.language.isDefault()&&(t=this._root.language.translateAll(this._shortMonths()).indexOf(e),t>-1)?t:0)}isAm(e){return this.getStringList(["AM","A.M.","A"]).indexOf(e.toUpperCase())>-1}getStringList(e){let t=[];for(let i=0;ithis.get("negativeBase")?s.positive:n{if(n.parsed)return;let u=n.source,h=[];h=n.source.match(/^\[([^\]]*)\]/),h&&h.length&&h[0]!==""&&(u=n.source.substr(h[0].length),n.color=h[1]);let p=U.chunk(u,!0);for(let c=0;c{if(a==t||i){if(r/s<=1)return i||(i=a),!1;i=a}return!0}),i}getMilliseconds(e,t){return t||(t=this.get("baseUnit")),e*this._getUnitValue(t)}_getUnitValue(e){return this._getUnitValues()[e]}_getUnitValues(){return{millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:2592e6,year:31536e6}}}const it={firstDayOfWeek:1,_decimalSeparator:".",_thousandSeparator:",",_percentPrefix:null,_percentSuffix:"%",_big_number_suffix_3:"k",_big_number_suffix_6:"M",_big_number_suffix_9:"G",_big_number_suffix_12:"T",_big_number_suffix_15:"P",_big_number_suffix_18:"E",_big_number_suffix_21:"Z",_big_number_suffix_24:"Y",_small_number_suffix_3:"m",_small_number_suffix_6:"μ",_small_number_suffix_9:"n",_small_number_suffix_12:"p",_small_number_suffix_15:"f",_small_number_suffix_18:"a",_small_number_suffix_21:"z",_small_number_suffix_24:"y",_byte_suffix_B:"B",_byte_suffix_KB:"KB",_byte_suffix_MB:"MB",_byte_suffix_GB:"GB",_byte_suffix_TB:"TB",_byte_suffix_PB:"PB",_date:"yyyy-MM-dd",_date_millisecond:"mm:ss SSS",_date_millisecond_full:"HH:mm:ss SSS",_date_second:"HH:mm:ss",_date_second_full:"HH:mm:ss",_date_minute:"HH:mm",_date_minute_full:"HH:mm - MMM dd, yyyy",_date_hour:"HH:mm",_date_hour_full:"HH:mm - MMM dd, yyyy",_date_day:"MMM dd",_date_day_full:"MMM dd, yyyy",_date_week:"ww",_date_week_full:"MMM dd, yyyy",_date_month:"MMM",_date_month_full:"MMM, yyyy",_date_year:"yyyy",_duration_millisecond:"SSS",_duration_millisecond_second:"ss.SSS",_duration_millisecond_minute:"mm:ss SSS",_duration_millisecond_hour:"hh:mm:ss SSS",_duration_millisecond_day:"d'd' mm:ss SSS",_duration_millisecond_week:"d'd' mm:ss SSS",_duration_millisecond_month:"M'm' dd'd' mm:ss SSS",_duration_millisecond_year:"y'y' MM'm' dd'd' mm:ss SSS",_duration_second:"ss",_duration_second_minute:"mm:ss",_duration_second_hour:"hh:mm:ss",_duration_second_day:"d'd' hh:mm:ss",_duration_second_week:"d'd' hh:mm:ss",_duration_second_month:"M'm' dd'd' hh:mm:ss",_duration_second_year:"y'y' MM'm' dd'd' hh:mm:ss",_duration_minute:"mm",_duration_minute_hour:"hh:mm",_duration_minute_day:"d'd' hh:mm",_duration_minute_week:"d'd' hh:mm",_duration_minute_month:"M'm' dd'd' hh:mm",_duration_minute_year:"y'y' MM'm' dd'd' hh:mm",_duration_hour:"hh'h'",_duration_hour_day:"d'd' hh'h'",_duration_hour_week:"d'd' hh'h'",_duration_hour_month:"M'm' dd'd' hh'h'",_duration_hour_year:"y'y' MM'm' dd'd' hh'h'",_duration_day:"d'd'",_duration_day_week:"d'd'",_duration_day_month:"M'm' dd'd'",_duration_day_year:"y'y' MM'm' dd'd'",_duration_week:"w'w'",_duration_week_month:"w'w'",_duration_week_year:"w'w'",_duration_month:"M'm'",_duration_month_year:"y'y' MM'm'",_duration_year:"y'y'",_era_ad:"AD",_era_bc:"BC",A:"",P:"",AM:"",PM:"","A.M.":"","P.M.":"",January:"",February:"",March:"",April:"",May:"",June:"",July:"",August:"",September:"",October:"",November:"",December:"",Jan:"",Feb:"",Mar:"",Apr:"","May(short)":"May",Jun:"",Jul:"",Aug:"",Sep:"",Oct:"",Nov:"",Dec:"",Sunday:"",Monday:"",Tuesday:"",Wednesday:"",Thursday:"",Friday:"",Saturday:"",Sun:"",Mon:"",Tue:"",Wed:"",Thu:"",Fri:"",Sat:"",_dateOrd:function(d){let e="th";if(d<11||d>13)switch(d%10){case 1:e="st";break;case 2:e="nd";break;case 3:e="rd"}return e},"Zoom Out":"",Play:"",Stop:"",Legend:"","Press ENTER to toggle":"",Loading:"",Home:"",Chart:"","Serial chart":"","X/Y chart":"","Pie chart":"","Gauge chart":"","Radar chart":"","Sankey diagram":"","Flow diagram":"","Chord diagram":"","TreeMap chart":"","Force directed tree":"","Sliced chart":"",Series:"","Candlestick Series":"","OHLC Series":"","Column Series":"","Line Series":"","Pie Slice Series":"","Funnel Series":"","Pyramid Series":"","X/Y Series":"",Map:"","Press ENTER to zoom in":"","Press ENTER to zoom out":"","Use arrow keys to zoom in and out":"","Use plus and minus keys on your keyboard to zoom in and out":"",Export:"",Image:"",Data:"",Print:"","Press ENTER or use arrow keys to navigate":"","Press ENTER to open":"","Press ENTER to print.":"","Press ENTER to export as %1.":"","(Press ESC to close this message)":"","Image Export Complete":"","Export operation took longer than expected. Something might have gone wrong.":"","Saved from":"",PNG:"",JPG:"",GIF:"",SVG:"",PDF:"",JSON:"",CSV:"",XLSX:"",HTML:"","Use TAB to select grip buttons or left and right arrows to change selection":"","Use left and right arrows to move selection":"","Use left and right arrows to move left selection":"","Use left and right arrows to move right selection":"","Use TAB select grip buttons or up and down arrows to change selection":"","Use up and down arrows to move selection":"","Use up and down arrows to move lower selection":"","Use up and down arrows to move upper selection":"","From %1 to %2":"","From %1":"","To %1":"","No parser available for file: %1":"","Error parsing file: %1":"","Unable to load file: %1":"","Invalid date":"",Close:"",Minimize:""};class $t extends te{_setDefaults(){this.setPrivate("defaultLocale",it),super._setDefaults()}translate(e,t,...i){t||(t=this._root.locale||this.getPrivate("defaultLocale"));let r=e,a=t[e];if(a===null)r="";else if(a!=null)a&&(r=a);else if(t!==this.getPrivate("defaultLocale"))return this.translate(e,this.getPrivate("defaultLocale"),...i);if(i.length)for(let s=i.length,n=0;n{this.setTranslationAny(i,r,t)})}translateEmpty(e,t,...i){let r=this.translate(e,t,...i);return r==e?"":r}translateFunc(e,t){return this._root.locale[e]?this._root.locale[e]:t!==this.getPrivate("defaultLocale")?this.translateFunc(e,this.getPrivate("defaultLocale")):()=>""}translateAll(e,t){return this.isDefault()?e:Mt(e,i=>this.translate(i,t))}isDefault(){return this.getPrivate("defaultLocale")===this._root.locale}}class ke{constructor(e=1,t=0,i=0,r=1,a=0,s=0){Object.defineProperty(this,"a",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"b",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"c",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"d",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ty",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.a=e,this.b=t,this.c=i,this.d=r,this.tx=a,this.ty=s}setTransform(e,t,i,r,a,s=1){this.a=Math.cos(a)*s,this.b=Math.sin(a)*s,this.c=-Math.sin(a)*s,this.d=Math.cos(a)*s,this.tx=e-(i*this.a+r*this.c),this.ty=t-(i*this.b+r*this.d)}apply(e){return{x:this.a*e.x+this.c*e.y+this.tx,y:this.b*e.x+this.d*e.y+this.ty}}applyInverse(e){const t=1/(this.a*this.d+this.c*-this.b);return{x:this.d*t*e.x+-this.c*t*e.y+(this.ty*this.c-this.tx*this.d)*t,y:this.a*t*e.y+-this.b*t*e.x+(-this.ty*this.a+this.tx*this.b)*t}}append(e){const t=this.a,i=this.b,r=this.c,a=this.d;this.a=e.a*t+e.b*r,this.b=e.a*i+e.b*a,this.c=e.c*t+e.d*r,this.d=e.c*i+e.d*a,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*i+e.ty*a+this.ty}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const i=this.a,r=this.c;this.a=i*e.a+this.b*e.c,this.b=i*e.b+this.b*e.d,this.c=r*e.a+this.d*e.c,this.d=r*e.b+this.d*e.d}this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty}copyFrom(e){this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty}}var Xt=function(){function d(e,t){var i=[],r=!0,a=!1,s=void 0;try{for(var n,u=e[Symbol.iterator]();!(r=(n=u.next()).done)&&(i.push(n.value),!t||i.length!==t);r=!0);}catch(h){a=!0,s=h}finally{try{!r&&u.return&&u.return()}finally{if(a)throw s}}return i}return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return d(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),he=2*Math.PI,Ee=function(d,e,t,i,r,a,s){var n=d.x,u=d.y;return{x:i*(n*=e)-r*(u*=t)+a,y:r*n+i*u+s}},Nt=function(d,e){var t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),i=Math.cos(d),r=Math.sin(d),a=Math.cos(d+e),s=Math.sin(d+e);return[{x:i-r*t,y:r+i*t},{x:a+s*t,y:s-a*t},{x:a,y:s}]},Ue=function(d,e,t,i){var r=d*t+e*i;return r>1&&(r=1),r<-1&&(r=-1),(d*i-e*t<0?-1:1)*Math.acos(r)},Gt=function(d,e,t,i,r,a,s,n,u,h,p,c){var b=Math.pow(r,2),l=Math.pow(a,2),m=Math.pow(p,2),o=Math.pow(c,2),f=b*l-b*o-l*m;f<0&&(f=0),f/=b*o+l*m;var g=(f=Math.sqrt(f)*(s===n?-1:1))*r/a*c,x=f*-a/r*p,y=h*g-u*x+(d+t)/2,_=u*g+h*x+(e+i)/2,P=(p-g)/r,E=(c-x)/a,S=(-p-g)/r,T=(-c-x)/a,D=Ue(1,0,P,E),O=Ue(P,E,S,T);return n===0&&O>0&&(O-=he),n===1&&O<0&&(O+=he),[y,_,D,O]},qt=function(d){var e=d.px,t=d.py,i=d.cx,r=d.cy,a=d.rx,s=d.ry,n=d.xAxisRotation,u=n===void 0?0:n,h=d.largeArcFlag,p=h===void 0?0:h,c=d.sweepFlag,b=c===void 0?0:c,l=[];if(a===0||s===0)return[];var m=Math.sin(u*he/360),o=Math.cos(u*he/360),f=o*(e-i)/2+m*(t-r)/2,g=-m*(e-i)/2+o*(t-r)/2;if(f===0&&g===0)return[];a=Math.abs(a),s=Math.abs(s);var x=Math.pow(f,2)/Math.pow(a,2)+Math.pow(g,2)/Math.pow(s,2);x>1&&(a*=Math.sqrt(x),s*=Math.sqrt(x));var y=Gt(e,t,i,r,a,s,p,b,m,o,f,g),_=Xt(y,4),P=_[0],E=_[1],S=_[2],T=_[3],D=Math.abs(T)/(he/4);Math.abs(1-D)<1e-7&&(D=1);var O=Math.max(Math.ceil(D),1);T/=O;for(var I=0;I1){const r=/^([01])([01])(.*)$/.exec(i);r!==null&&(d.splice(t,0,r[1]),++t,d.splice(t,0,r[2]),++t,r[3].length>0?d[t]=r[3]:d.splice(t,1))}if(++t,i=d[t],i.length>1){const r=/^([01])(.+)$/.exec(i);r!==null&&(d.splice(t,0,r[1]),++t,d[t]=r[2])}}}function $e(d){if(d===0||d===1)return d;throw new Error("Flag must be 0 or 1")}function Kt(d){const e=[0,0,0];for(let t=0;t<24;t++)e[t%3]<<=1,e[t%3]|=1&d,d>>=1;return(0|e[2])+(e[1]<<8)+(e[0]<<16)}function _e(d,e){for(;(!d.interactive||e(d))&&d._parent;)d=d._parent}function Qt(d,e,t){return A(d,je(e),i=>{const r=Ke(i);let a=i.touches;a?(a.length==0&&(a=i.changedTouches),t(Dt(a),r)):t([i],r)})}function Xe(d){const e=document.createElement("canvas");e.width=1,e.height=1;const t=e.getContext("2d",{willReadFrequently:!0});t.drawImage(d,0,0,1,1);try{return t.getImageData(0,0,1,1),!1}catch{return console.warn('Image "'+d.src+'" is loaded from different host and is not covered by CORS policy. For more information about the implications read here: https://www.amcharts.com/docs/v5/concepts/cors'),!0}}function oe(d){d.width=0,d.height=0,d.style.width="0px",d.style.height="0px"}class ei{constructor(){Object.defineProperty(this,"_x",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_y",{enumerable:!0,configurable:!0,writable:!0,value:0})}get x(){return this._x}get y(){return this._y}set x(e){this._x=e}set y(e){this._y=e}}class ve extends Lt{constructor(e){super(),Object.defineProperty(this,"_layer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mask",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"exportable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"interactive",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"inactive",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"wheelable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"cancelTouch",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isMeasured",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"buttonMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"alpha",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"compoundAlpha",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"angle",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"scale",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"crisp",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"pivot",{enumerable:!0,configurable:!0,writable:!0,value:new ei}),Object.defineProperty(this,"filter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cursorOverStyle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_replacedCursorStyle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_localMatrix",{enumerable:!0,configurable:!0,writable:!0,value:new ke}),Object.defineProperty(this,"_matrix",{enumerable:!0,configurable:!0,writable:!0,value:new ke}),Object.defineProperty(this,"_uMatrix",{enumerable:!0,configurable:!0,writable:!0,value:new ke}),Object.defineProperty(this,"_renderer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_localBounds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_bounds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_colorId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._renderer=e}_dispose(){this._renderer._removeObject(this),this.getLayer().dirty=!0}getCanvas(){return this.getLayer().view}getLayer(){let e=this;for(;;){if(e._layer)return e._layer;if(!e._parent)return this._renderer.defaultLayer;e=e._parent}}setLayer(e,t){e==null?this._layer=void 0:(this._layer=this._renderer.getLayer(e,!0),this._layer.visible=!0,this._layer.margin=t,t&&J(this._layer.view,!1),this._renderer._ghostLayer.setMargin(this._renderer.layers),this._parent&&this._parent.registerChildLayer(this._layer),this._layer.dirty=!0,this._renderer.resizeLayer(this._layer),this._renderer.resizeGhost())}markDirtyLayer(){this.getLayer().dirty=!0}clear(){this.invalidateBounds()}invalidateBounds(){this._localBounds=void 0}_addBounds(e){}_getColorId(){return this._colorId===void 0&&(this._colorId=this._renderer.paintId(this)),this._colorId}_isInteractive(){return this.inactive==0&&(this.interactive||this._renderer._forceInteractive>0)}_isInteractiveMask(){return this._isInteractive()}contains(e){for(;;){if(e===this)return!0;if(!e._parent)return!1;e=e._parent}}toGlobal(e){return this._matrix.apply(e)}toLocal(e){return this._matrix.applyInverse(e)}getLocalMatrix(){return this._uMatrix.setTransform(0,0,this.pivot.x,this.pivot.y,this.angle*Math.PI/180,this.scale),this._uMatrix}getLocalBounds(){return this._localBounds||(this._localBounds={left:1e7,top:1e7,right:-1e7,bottom:-1e7},this._addBounds(this._localBounds)),this._localBounds}getAdjustedBounds(e){this._setMatrix();const t=this.getLocalMatrix(),i=t.apply({x:e.left,y:e.top}),r=t.apply({x:e.right,y:e.top}),a=t.apply({x:e.right,y:e.bottom}),s=t.apply({x:e.left,y:e.bottom});return{left:Math.min(i.x,r.x,a.x,s.x),top:Math.min(i.y,r.y,a.y,s.y),right:Math.max(i.x,r.x,a.x,s.x),bottom:Math.max(i.y,r.y,a.y,s.y)}}on(e,t,i){return this.interactive?this._renderer._addEvent(this,e,t,i):new X(()=>{})}_setMatrix(){this._localMatrix.setTransform(this.x,this.y,this.pivot.x,this.pivot.y,this.angle*Math.PI/180,this.scale),this._matrix.copyFrom(this._localMatrix),this._parent&&this._matrix.prepend(this._parent._matrix)}_transform(e,t){const i=this._matrix;let r=i.tx*t,a=i.ty*t;this.crisp&&(r=Math.floor(r)+.5,a=Math.floor(a)+.5),e.setTransform(i.a*t,i.b*t,i.c*t,i.d*t,r,a)}_transformMargin(e,t,i){const r=this._matrix;e.setTransform(r.a*t,r.b*t,r.c*t,r.d*t,(r.tx+i.left)*t,(r.ty+i.top)*t)}_transformLayer(e,t,i){i.margin?this._transformMargin(e,i.scale||t,i.margin):this._transform(e,i.scale||t)}render(e){if(this.visible&&(this.exportable!==!1||!this._renderer._omitTainted)){this._setMatrix();const t=this._renderer.resolution,i=this._renderer.layers,r=this._renderer._ghostLayer,a=r.context,s=this.mask;s&&s._setMatrix(),v(i,n=>{if(n){const u=n.context;u.save(),s&&(s._transformLayer(u,t,n),s._runPath(u),u.clip()),u.globalAlpha=this.compoundAlpha*this.alpha,this._transformLayer(u,t,n),this.filter&&(u.filter=this.filter)}}),a.save(),s&&this._isInteractiveMask()&&(s._transformMargin(a,t,r.margin),s._runPath(a),a.clip()),this._transformMargin(a,t,r.margin),this._render(e),a.restore(),v(i,n=>{n&&n.context.restore()})}}_render(e){this.exportable===!1&&((this._layer||e).tainted=!0)}hovering(){return this._renderer._hovering.has(this)}dragging(){return this._renderer._dragging.some(e=>e.value===this)}shouldCancelTouch(){const e=this._renderer;return!(e.tapToActivate&&!e._touchActive)&&(!!this.cancelTouch||!!this._parent&&this._parent.shouldCancelTouch())}}class ti extends ve{constructor(){super(...arguments),Object.defineProperty(this,"interactiveChildren",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_childLayers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_children",{enumerable:!0,configurable:!0,writable:!0,value:[]})}_isInteractiveMask(){return this.interactiveChildren||super._isInteractiveMask()}addChild(e){e._parent=this,this._children.push(e),e._layer&&this.registerChildLayer(e._layer)}addChildAt(e,t){e._parent=this,this._children.splice(t,0,e),e._layer&&this.registerChildLayer(e._layer)}removeChild(e){e._parent=void 0,Ce(this._children,e)}_render(e){super._render(e);const t=this._renderer;this.interactive&&this.interactiveChildren&&++t._forceInteractive;const i=this._layer||e;v(this._children,r=>{r.compoundAlpha=this.compoundAlpha*this.alpha,r.render(i)}),this.interactive&&this.interactiveChildren&&--t._forceInteractive}registerChildLayer(e){this._childLayers||(this._childLayers=[]),Te(this._childLayers,e),this._parent&&this._parent.registerChildLayer(e)}markDirtyLayer(e=!1){super.markDirtyLayer(),e&&this._childLayers&&v(this._childLayers,t=>t.dirty=!0)}_dispose(){super._dispose(),this._childLayers&&v(this._childLayers,e=>{e.dirty=!0})}}function M(d,e){d.left=Math.min(d.left,e.x),d.top=Math.min(d.top,e.y),d.right=Math.max(d.right,e.x),d.bottom=Math.max(d.bottom,e.y)}class j{colorize(e,t){}path(e){}addBounds(e){}}class ii extends j{colorize(e,t){e.beginPath()}}class Me extends j{constructor(e){super(),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:e})}colorize(e,t){e.fillStyle=t!==void 0?t:this.color}}class ri extends j{constructor(e){super(),Object.defineProperty(this,"clearShadow",{enumerable:!0,configurable:!0,writable:!0,value:e})}colorize(e,t){e.fill(),this.clearShadow&&(e.shadowColor="",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0)}}class si extends j{colorize(e,t){e.stroke()}}class Se extends j{constructor(e,t,i){super(),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"lineJoin",{enumerable:!0,configurable:!0,writable:!0,value:i})}colorize(e,t){e.strokeStyle=t!==void 0?t:this.color,e.lineWidth=this.width,this.lineJoin&&(e.lineJoin=this.lineJoin)}}class ai extends j{constructor(e){super(),Object.defineProperty(this,"dash",{enumerable:!0,configurable:!0,writable:!0,value:e})}colorize(e,t){e.setLineDash(this.dash)}}class ni extends j{constructor(e){super(),Object.defineProperty(this,"dashOffset",{enumerable:!0,configurable:!0,writable:!0,value:e})}colorize(e,t){e.lineDashOffset=this.dashOffset}}class oi extends j{constructor(e,t,i,r){super(),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:r})}path(e){e.rect(this.x,this.y,this.width,this.height)}addBounds(e){const t=this.x,i=this.y,r=t+this.width,a=i+this.height;M(e,{x:t,y:i}),M(e,{x:r,y:i}),M(e,{x:t,y:a}),M(e,{x:r,y:a})}}class li extends j{constructor(e,t,i){super(),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"radius",{enumerable:!0,configurable:!0,writable:!0,value:i})}path(e){e.moveTo(this.x+this.radius,this.y),e.arc(this.x,this.y,this.radius,0,2*Math.PI)}addBounds(e){M(e,{x:this.x-this.radius,y:this.y-this.radius}),M(e,{x:this.x+this.radius,y:this.y+this.radius})}}class hi extends j{constructor(e,t,i,r){super(),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"radiusX",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"radiusY",{enumerable:!0,configurable:!0,writable:!0,value:r})}path(e){e.ellipse(0,0,this.radiusX,this.radiusY,0,0,2*Math.PI)}addBounds(e){M(e,{x:this.x-this.radiusX,y:this.y-this.radiusY}),M(e,{x:this.x+this.radiusX,y:this.y+this.radiusY})}}class ui extends j{constructor(e,t,i,r,a,s){super(),Object.defineProperty(this,"cx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cy",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"radius",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"startAngle",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"endAngle",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"anticlockwise",{enumerable:!0,configurable:!0,writable:!0,value:s})}path(e){this.radius>0&&e.arc(this.cx,this.cy,this.radius,this.startAngle,this.endAngle,this.anticlockwise)}addBounds(e){let t=zt(this.cx,this.cy,this.startAngle*le,this.endAngle*le,this.radius);M(e,{x:t.left,y:t.top}),M(e,{x:t.right,y:t.bottom})}}class ci extends j{constructor(e,t,i,r,a){super(),Object.defineProperty(this,"x1",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y1",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"x2",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"y2",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"radius",{enumerable:!0,configurable:!0,writable:!0,value:a})}path(e){this.radius>0&&e.arcTo(this.x1,this.y1,this.x2,this.y2,this.radius)}addBounds(e){}}class di extends j{constructor(e,t){super(),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t})}path(e){e.lineTo(this.x,this.y)}addBounds(e){M(e,{x:this.x,y:this.y})}}class bi extends j{constructor(e,t){super(),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:t})}path(e){e.moveTo(this.x,this.y)}addBounds(e){M(e,{x:this.x,y:this.y})}}class _i extends j{path(e){e.closePath()}}class fi extends j{constructor(e,t,i,r,a,s){super(),Object.defineProperty(this,"cpX",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cpY",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"cpX2",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"cpY2",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"toX",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"toY",{enumerable:!0,configurable:!0,writable:!0,value:s})}path(e){e.bezierCurveTo(this.cpX,this.cpY,this.cpX2,this.cpY2,this.toX,this.toY)}addBounds(e){M(e,{x:this.cpX,y:this.cpY}),M(e,{x:this.cpX2,y:this.cpY2}),M(e,{x:this.toX,y:this.toY})}}class pi extends j{constructor(e,t,i,r){super(),Object.defineProperty(this,"cpX",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cpY",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"toX",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"toY",{enumerable:!0,configurable:!0,writable:!0,value:r})}path(e){e.quadraticCurveTo(this.cpX,this.cpY,this.toX,this.toY)}addBounds(e){M(e,{x:this.cpX,y:this.cpY}),M(e,{x:this.toX,y:this.toY})}}class gi extends j{constructor(e,t,i,r,a){super(),Object.defineProperty(this,"color",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"blur",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"offsetX",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"offsetY",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"opacity",{enumerable:!0,configurable:!0,writable:!0,value:a})}colorize(e,t){this.opacity&&(e.fillStyle=this.color),e.shadowColor=this.color,e.shadowBlur=this.blur,e.shadowOffsetX=this.offsetX,e.shadowOffsetY=this.offsetY}}class mi extends j{constructor(e,t,i,r,a){super(),Object.defineProperty(this,"image",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"x",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"y",{enumerable:!0,configurable:!0,writable:!0,value:a})}path(e){e.drawImage(this.image,this.x,this.y,this.width,this.height)}addBounds(e){M(e,{x:this.x,y:this.y}),M(e,{x:this.width,y:this.height})}}class yi extends ve{constructor(){super(...arguments),Object.defineProperty(this,"_operations",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"blendMode",{enumerable:!0,configurable:!0,writable:!0,value:Ct.NORMAL}),Object.defineProperty(this,"_hasShadows",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_fillAlpha",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_strokeAlpha",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}clear(){super.clear(),this._operations.length=0}_pushOp(e){this._operations.push(e)}beginFill(e,t=1){this._fillAlpha=t,e?e instanceof ee?this._pushOp(new Me(e.toCSS(t))):(this.isMeasured=!0,this._pushOp(new Me(e))):this._pushOp(new Me("rgba(0, 0, 0, "+t+")"))}endFill(){this._pushOp(new ri(this._hasShadows))}endStroke(){this._pushOp(new si)}beginPath(){this._pushOp(new ii)}lineStyle(e=0,t,i=1,r){this._strokeAlpha=i,t?t instanceof ee?this._pushOp(new Se(e,t.toCSS(i),r)):this._pushOp(new Se(e,t,r)):this._pushOp(new Se(e,"rgba(0, 0, 0, "+i+")",r))}setLineDash(e){this._pushOp(new ai(e||[]))}setLineDashOffset(e=0){this._pushOp(new ni(e))}drawRect(e,t,i,r){this._pushOp(new oi(e,t,i,r))}drawCircle(e,t,i){this._pushOp(new li(e,t,i))}drawEllipse(e,t,i,r){this._pushOp(new hi(e,t,i,r))}arc(e,t,i,r,a,s=!1){this._pushOp(new ui(e,t,i,r,a,s))}arcTo(e,t,i,r,a){this._pushOp(new ci(e,t,i,r,a))}lineTo(e,t){this._pushOp(new di(e,t))}moveTo(e,t){this._pushOp(new bi(e,t))}bezierCurveTo(e,t,i,r,a,s){this._pushOp(new fi(e,t,i,r,a,s))}quadraticCurveTo(e,t,i,r){this._pushOp(new pi(e,t,i,r))}closePath(){this._pushOp(new _i)}shadow(e,t=0,i=0,r=0,a){this._hasShadows=!0,this._pushOp(new gi(a?e.toCSS(a):e.toCSS(this._fillAlpha||this._strokeAlpha),t,i,r))}image(e,t,i,r,a){this._pushOp(new mi(e,t,i,r,a))}svgPath(e){let t=0,i=0,r=null,a=null,s=null,n=null;const u=/([MmZzLlHhVvCcSsQqTtAa])([^MmZzLlHhVvCcSsQqTtAa]*)/g,h=/[\u0009\u0020\u000A\u000C\u000D]*([\+\-]?[0-9]*\.?[0-9]+(?:[eE][\+\-]?[0-9]+)?)[\u0009\u0020\u000A\u000C\u000D]*,?/g;let p;for(;(p=u.exec(e))!==null;){const c=p[1],b=p[2],l=[];for(;(p=h.exec(b))!==null;)l.push(p[1]);switch(c!=="S"&&c!=="s"&&c!=="C"&&c!=="c"&&(r=null,a=null),c!=="Q"&&c!=="q"&&c!=="T"&&c!=="t"&&(s=null,n=null),c){case"M":z(c,l.length,2),t=+l[0],i=+l[1],this.moveTo(t,i);for(let o=2;o{this.bezierCurveTo(y.x1,y.y1,y.x2,y.y2,y.x,y.y),t=y.x,i=y.y})}break;case"Z":case"z":Zt(c,l.length,0),this.closePath()}}}_runPath(e){e.beginPath(),v(this._operations,t=>{t.path(e)})}_render(e){super._render(e);const t=this._layer||e,i=t.dirty,r=this._isInteractive();if(i||r){const a=t.context,s=this._renderer._ghostLayer.context;let n;i&&(a.globalCompositeOperation=this.blendMode,a.beginPath()),r&&(s.beginPath(),n=this._getColorId()),v(this._operations,u=>{i&&(u.path(a),u.colorize(a,void 0)),r&&(u.path(s),u.colorize(s,n))})}}renderDetached(e){if(this.visible){this._setMatrix(),e.save();const t=this.mask;t&&(t._setMatrix(),t._transform(e,1),t._runPath(e),e.clip()),e.globalAlpha=this.compoundAlpha*this.alpha,this._transform(e,1),this.filter&&(e.filter=this.filter),e.globalCompositeOperation=this.blendMode,e.beginPath(),v(this._operations,i=>{i.path(e),i.colorize(e,void 0)}),e.restore()}}_addBounds(e){this.visible&&this.isMeasured&&v(this._operations,t=>{t.addBounds(e)})}}class rt extends ve{constructor(e,t,i){super(e),Object.defineProperty(this,"text",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"style",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolution",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"textVisible",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_textInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_originalScale",{enumerable:!0,configurable:!0,writable:!0,value:1}),this.text=t,this.style=i}invalidateBounds(){super.invalidateBounds(),this._textInfo=void 0}_shared(e){this.style.textAlign&&(e.textAlign=this.style.textAlign),this.style.direction&&(e.direction=this.style.direction),this.style.textBaseline&&(e.textBaseline=this.style.textBaseline)}_prerender(e,t=!1,i=!1){super._render(e);const r=e.context,a=this._renderer._ghostLayer.context,s=this.style;let n=this._getFontStyle(void 0,i);r.font=n,this._isInteractive()&&!t&&(a.font=n),s.fill&&(s.fill instanceof ee?r.fillStyle=s.fill.toCSS(s.fillOpacity!=null?s.fillOpacity:1):r.fillStyle=s.fill),s.shadowColor&&(e.context.shadowColor=s.shadowColor.toCSS(s.shadowOpacity||1)),s.shadowBlur&&(e.context.shadowBlur=s.shadowBlur),s.shadowOffsetX&&(e.context.shadowOffsetX=s.shadowOffsetX),s.shadowOffsetY&&(e.context.shadowOffsetY=s.shadowOffsetY),this._shared(r),this._isInteractive()&&!t&&(a.fillStyle=this._getColorId(),this._shared(a))}_getFontStyle(e,t=!1){const i=this.style;let r=[];return e&&e.fontVariant?r.push(e.fontVariant):i.fontVariant&&r.push(i.fontVariant),t||(e&&e.fontWeight?r.push(e.fontWeight):i.fontWeight&&r.push(i.fontWeight)),e&&e.fontStyle?r.push(e.fontStyle):i.fontStyle&&r.push(i.fontStyle),e&&e.fontSize?(H(e.fontSize)&&(e.fontSize=e.fontSize+"px"),r.push(e.fontSize)):i.fontSize&&(H(i.fontSize)&&(i.fontSize=i.fontSize+"px"),r.push(i.fontSize)),e&&e.fontFamily?r.push(e.fontFamily):i.fontFamily?r.push(i.fontFamily):r.length&&r.push("Arial"),r.join(" ")}_render(e){const t=this._layer||e;if(this._textInfo||this._measure(t),this.textVisible){const i=this._isInteractive(),r=t.context,a=t.dirty,s=this._renderer._ghostLayer.context;r.save(),s.save(),this._prerender(t),v(this._textInfo,(n,u)=>{v(n.textChunks,(h,p)=>{if(h.style&&(r.save(),s.save(),r.font=h.style,this._isInteractive()&&(s.font=h.style)),h.fill&&(r.save(),r.fillStyle=h.fill.toCSS()),a&&r.fillText(h.text,h.offsetX,n.offsetY+h.offsetY),h.textDecoration=="underline"||h.textDecoration=="line-through"){let c,b=1,l=1,m=h.height,o=h.offsetX;switch(this.style.textAlign){case"right":case"end":o-=h.width;break;case"center":o-=h.width/2}if(h.style)switch(U.getTextStyle(h.style).fontWeight){case"bolder":case"bold":case"700":case"800":case"900":b=2}m&&(l=m/20),c=h.textDecoration=="line-through"?b+n.offsetY+h.offsetY-h.height/2:b+1.5*l+n.offsetY+h.offsetY,r.save(),r.beginPath(),h.fill?r.strokeStyle=h.fill.toCSS():this.style.fill&&this.style.fill instanceof ee&&(r.strokeStyle=this.style.fill.toCSS()),r.lineWidth=b*l,r.moveTo(o,c),r.lineTo(o+h.width,c),r.stroke(),r.restore()}i&&this.interactive&&s.fillText(h.text,h.offsetX,n.offsetY+h.offsetY),h.fill&&r.restore(),h.style&&(r.restore(),s.restore())})}),r.restore(),s.restore()}}_addBounds(e){if(this.visible&&this.isMeasured){const t=this._measure(this.getLayer());M(e,{x:t.left,y:t.top}),M(e,{x:t.right,y:t.bottom})}}_ignoreFontWeight(){return/apple/i.test(navigator.vendor)}_measure(e){const t=e.context,i=this._renderer._ghostLayer.context,r=this.style.direction=="rtl";this._textInfo=[];const a=this.style.oversizedBehavior,s=this.style.maxWidth,n=H(s)&&a=="truncate",u=H(s)&&(a=="wrap"||a=="wrap-no-break");t.save(),i.save(),this._prerender(e,!0,this._ignoreFontWeight());const h="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",p=this.text.toString().replace(/\r/g,"").split(/\n/);let c,b=!0,l=0,m=0,o=0;v(p,(g,x)=>{let y;for(y=g==""?[{type:"value",text:""}]:U.chunk(g,!1,this.style.ignoreFormatting);y.length>0;){let _={offsetY:o,ascent:0,width:0,height:0,left:0,right:0,textChunks:[]};const P=this._measureText(h,t),E=P.actualBoundingBoxAscent+P.actualBoundingBoxDescent;let S;_.height=E,_.ascent=P.actualBoundingBoxAscent;let T,D,O,I=this.style.textDecoration,L=!1,F=!0,N=[];Qe(y,(B,ce)=>{if(B.type=="format")if(B.text=="[/]")b||(t.restore(),i.restore(),b=!0),T=void 0,c=void 0,D=void 0,I=this.style.textDecoration,O=void 0,S=B.text;else{b||(t.restore(),i.restore());let k=U.getTextStyle(B.text);const R=this._getFontStyle(k);t.save(),i.save(),t.font=R,c=R,S=B.text,k.textDecoration&&(I=k.textDecoration),k.fill&&(T=k.fill),k.width&&(D=V(k.width)),k.verticalAlign&&(O=k.verticalAlign),b=!1;const Y=this._measureText(h,t),G=Y.actualBoundingBoxAscent+Y.actualBoundingBoxDescent;G>_.height&&(_.height=G),Y.actualBoundingBoxAscent>_.ascent&&(_.ascent=Y.actualBoundingBoxAscent)}else if(B.type=="value"&&!L){const k=this._measureText(B.text,t);let R=k.actualBoundingBoxLeft+k.actualBoundingBoxRight;if(n){let W=F||this.style.breakWords||!1;const $=this.style.ellipsis||"",Le=this._measureText($,t),st=Le.actualBoundingBoxLeft+Le.actualBoundingBoxRight;if(_.width+R>s){const at=s-_.width-st;B.text=this._truncateText(t,B.text,at,W),B.text+=$,L=!0}}else if(u&&_.width+R>s){const W=s-_.width,$=this._truncateText(t,B.text,W,!1,F&&this.style.oversizedBehavior!="wrap-no-break");if($=="")return this.textVisible=!0,!1;N=y.slice(ce+1),Pe($)!=Pe(B.text)&&(N.unshift({type:"value",text:B.text.substr($.length)}),S&&N.unshift({type:"format",text:S})),B.text=Pe($),y=[],L=!0}let Y=1,G=1;if(c&&D&&D>R){const W=R/D;switch(this.style.textAlign){case"right":case"end":Y=W;break;case"center":Y=W,G=W;break;default:G=W}R=D}const we=k.actualBoundingBoxAscent+k.actualBoundingBoxDescent;we>_.height&&(_.height=we),k.actualBoundingBoxAscent>_.ascent&&(_.ascent=k.actualBoundingBoxAscent),_.width+=R,_.left+=k.actualBoundingBoxLeft/Y,_.right+=k.actualBoundingBoxRight/G,_.textChunks.push({style:c,fill:T,text:B.text,width:R,height:we,left:k.actualBoundingBoxLeft,right:k.actualBoundingBoxRight,ascent:k.actualBoundingBoxAscent,offsetX:0,offsetY:0,textDecoration:I,verticalAlign:O}),F=!1}return!0}),this.style.lineHeight instanceof et?(_.height*=this.style.lineHeight.value,_.ascent*=this.style.lineHeight.value):(_.height*=this.style.lineHeight||1.2,_.ascent*=this.style.lineHeight||1.2),l<_.left&&(l=_.left),m<_.right&&(m=_.right),this._textInfo.push(_),o+=_.height,y=N||[]}}),b||(t.restore(),i.restore()),v(this._textInfo,(g,x)=>{let y=0;v(g.textChunks,_=>{if(_.offsetX=y+_.left-g.left,_.offsetY+=g.height-g.height*(this.style.baselineRatio||.19),y+=_.width,_.verticalAlign)switch(_.verticalAlign){case"super":_.offsetY-=g.height/2-_.height/2;break;case"sub":_.offsetY+=_.height/2}})});const f={left:r?-m:-l,top:0,right:r?l:m,bottom:o};if(a!=="none"){const g=this._fitRatio(f);if(g<1)if(a=="fit")H(this.style.minScale)&&gi&&t!="");return t}_measureText(e,t){let i=t.measureText(e),r={};if(i.actualBoundingBoxAscent==null){const s=document.createElement("div");s.innerText=e,s.style.visibility="hidden",s.style.position="absolute",s.style.top="-1000000px;",s.style.fontFamily=this.style.fontFamily||"",s.style.fontSize=this.style.fontSize+"",document.body.appendChild(s);const n=s.getBoundingClientRect();document.body.removeChild(s);const u=n.height,h=i.width;r={actualBoundingBoxAscent:u,actualBoundingBoxDescent:0,actualBoundingBoxLeft:0,actualBoundingBoxRight:h,fontBoundingBoxAscent:u,fontBoundingBoxDescent:0,width:h}}else r={actualBoundingBoxAscent:i.actualBoundingBoxAscent,actualBoundingBoxDescent:i.actualBoundingBoxDescent,actualBoundingBoxLeft:i.actualBoundingBoxLeft,actualBoundingBoxRight:i.actualBoundingBoxRight,fontBoundingBoxAscent:i.actualBoundingBoxAscent,fontBoundingBoxDescent:i.actualBoundingBoxDescent,width:i.width};const a=i.width;switch(this.style.textAlign){case"right":case"end":r.actualBoundingBoxLeft=a,r.actualBoundingBoxRight=0;break;case"center":r.actualBoundingBoxLeft=a/2,r.actualBoundingBoxRight=a/2;break;default:r.actualBoundingBoxLeft=0,r.actualBoundingBoxRight=a}return r}}class vi{constructor(){Object.defineProperty(this,"fill",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fillOpacity",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"textAlign",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontFamily",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontWeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontStyle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fontVariant",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"textDecoration",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowBlur",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOffsetX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOffsetY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOpacity",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"lineHeight",{enumerable:!0,configurable:!0,writable:!0,value:Ze(120)}),Object.defineProperty(this,"baselineRatio",{enumerable:!0,configurable:!0,writable:!0,value:.19}),Object.defineProperty(this,"direction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"textBaseline",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"oversizedBehavior",{enumerable:!0,configurable:!0,writable:!0,value:"none"}),Object.defineProperty(this,"breakWords",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"ellipsis",{enumerable:!0,configurable:!0,writable:!0,value:"…"}),Object.defineProperty(this,"maxWidth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxHeight",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"minScale",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ignoreFormatting",{enumerable:!0,configurable:!0,writable:!0,value:!1})}}class wi extends rt{constructor(){super(...arguments),Object.defineProperty(this,"textType",{enumerable:!0,configurable:!0,writable:!0,value:"circular"}),Object.defineProperty(this,"radius",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"startAngle",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inside",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"orientation",{enumerable:!0,configurable:!0,writable:!0,value:"auto"}),Object.defineProperty(this,"kerning",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_textReversed",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_render(e){this.textType==="circular"?this._renderCircular(e):super._render(e)}_renderCircular(e){if(this.textVisible){const t=this._layer||e;this._prerender(t);const i=this._isInteractive(),r=t.context,a=t.dirty,s=this._renderer._ghostLayer.context;r.save(),i&&s.save(),this._textInfo||this._measure(t);let n=this.radius||0,u=this.startAngle||0,h=0,p=this.orientation,c=p=="auto"?"auto":p=="inward";const b=this.inside,l=this.style.textAlign||"left",m=this.kerning||0;let o=l=="left"?1:-1;const f=!this._textReversed;if(c=="auto"){let g=0,x=0;v(this._textInfo,(y,_)=>{const P=u+y.width/(n-y.height)/2*-o;P>g&&(g=P)}),x=l=="left"?(g+h/2)*le:l=="right"?(g-h/2)*le:u*le,x=Bt(x),c=x>=270||x<=90}c==1&&f&&(this._textInfo.reverse(),this._textReversed=!0),v(this._textInfo,(g,x)=>{const y=g.height;b||(n+=y),(o==-1&&c||o==1&&!c)&&f&&g.textChunks.reverse();let _=u;h=0,l=="center"&&(_+=g.width/(n-y)/2*-o,h=_-u),_+=Math.PI*(c?0:1),r.save(),i&&s.save(),r.rotate(_),i&&s.rotate(_);let P=0;v(g.textChunks,(E,S)=>{const T=E.text,D=E.width;P=D/2/(n-y)*o,r.rotate(P),i&&s.rotate(P),E.style&&(r.save(),s.save(),r.font=E.style,i&&(s.font=E.style)),E.fill&&(r.save(),r.fillStyle=E.fill.toCSS()),r.textBaseline="middle",r.textAlign="center",i&&(s.textBaseline="middle",s.textAlign="center"),a&&r.fillText(T,0,(c?1:-1)*(0-n+y/2)),i&&s.fillText(T,0,(c?1:-1)*(0-n+y/2)),E.fill&&r.restore(),E.style&&(r.restore(),s.restore()),P=(D/2+m)/(n-y)*o,r.rotate(P),i&&s.rotate(P)}),r.restore(),i&&s.restore(),b&&(n-=y)}),r.restore(),i&&s.restore()}}_measure(e){return this.textType==="circular"?this._measureCircular(e):super._measure(e)}_measureCircular(e){const t=e.context,i=this._renderer._ghostLayer.context,r=this.style.direction=="rtl",a=this.style.oversizedBehavior,s=this.style.maxWidth,n=H(s)&&a=="truncate",u=this.style.ellipsis||"";let h;this.textVisible=!0,this._textInfo=[],this._textReversed=!1,t.save(),i.save(),this._prerender(e,!0);const p=this.text.toString().replace(/\r/g,"").split(/\n/);let c=!0,b=0,l=0;return v(p,(m,o)=>{let f,g,x,y=U.chunk(m,!1,this.style.ignoreFormatting),_={offsetY:l,ascent:0,width:0,height:0,left:0,right:0,textChunks:[]};v(y,(P,E)=>{if(P.type=="format"){if(P.text=="[/]")c||(t.restore(),i.restore(),c=!0),g=void 0,f=void 0,x=void 0;else{let S=U.getTextStyle(P.text);const T=this._getFontStyle(S);t.save(),i.save(),t.font=T,f=T,S.fill&&(g=S.fill),S.width&&(x=V(S.width)),c=!1}n&&(h=this._measureText(u,t))}else if(P.type=="value"){const S=P.text.match(/./gu)||[];r&&S.reverse();for(let T=0;TI&&(I=x);const L=O.actualBoundingBoxAscent+O.actualBoundingBoxDescent;if(L>_.height&&(_.height=L),O.actualBoundingBoxAscent>_.ascent&&(_.ascent=O.actualBoundingBoxAscent),_.width+=I,_.left+=O.actualBoundingBoxLeft,_.right+=O.actualBoundingBoxRight,_.textChunks.push({style:f,fill:g,text:D,width:I,height:L+O.actualBoundingBoxDescent,left:O.actualBoundingBoxLeft,right:O.actualBoundingBoxRight,ascent:O.actualBoundingBoxAscent,offsetX:0,offsetY:L,textDecoration:void 0}),b+=I,n){h||(h=this._measureText(u,t));const F=h.actualBoundingBoxLeft+h.actualBoundingBoxRight;if(b+=F,b+F>s){_.textChunks.length==1?this.textVisible=!1:(_.width+=F,_.left+=h.actualBoundingBoxLeft,_.right+=h.actualBoundingBoxRight,_.textChunks.push({style:f,fill:g,text:u,width:F,height:L+h.actualBoundingBoxDescent,left:h.actualBoundingBoxLeft,right:h.actualBoundingBoxRight,ascent:h.actualBoundingBoxAscent,offsetX:0,offsetY:L,textDecoration:void 0}));break}}if(r)break}}}),this.style.lineHeight instanceof et?_.height*=this.style.lineHeight.value:_.height*=this.style.lineHeight||1.2,this._textInfo.push(_),l+=_.height}),c||(t.restore(),i.restore()),a=="hide"&&b>s&&(this.textVisible=!1),v(this._textInfo,m=>{v(m.textChunks,o=>{o.offsetY+=Math.round((m.height-o.height+(m.ascent-o.ascent))/2)})}),t.restore(),i.restore(),{left:0,top:0,right:0,bottom:0}}}class xi extends ve{constructor(e,t){super(e),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"image",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tainted",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowColor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowBlur",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOffsetX",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOffsetY",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shadowOpacity",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_imageMask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.image=t}_dispose(){super._dispose(),this._imageMask&&oe(this._imageMask)}getLocalBounds(){if(!this._localBounds){let e=0,t=0;this.width&&(e=this.width),this.height&&(t=this.height),this._localBounds={left:0,top:0,right:e,bottom:t},this._addBounds(this._localBounds)}return this._localBounds}_render(e){if(super._render(e),this.image){const t=this._layer||e;if(this.tainted===void 0&&(this.tainted=Xe(this.image),t.tainted=!0),this.tainted&&this._renderer._omitTainted)return;if(t.dirty){this.shadowColor&&(t.context.shadowColor=this.shadowColor.toCSS(this.shadowOpacity||1)),this.shadowBlur&&(t.context.shadowBlur=this.shadowBlur),this.shadowOffsetX&&(t.context.shadowOffsetX=this.shadowOffsetX),this.shadowOffsetY&&(t.context.shadowOffsetY=this.shadowOffsetY);const i=this.width||this.image.naturalWidth,r=this.height||this.image.naturalHeight;t.context.drawImage(this.image,0,0,i,r)}if(this.interactive&&this._isInteractive()){const i=this._getMask(this.image);this._renderer._ghostLayer.context.drawImage(i,0,0)}}}clear(){super.clear(),this.image=void 0,this._imageMask=void 0}_getMask(e){if(this._imageMask===void 0){const t=this.width||e.naturalWidth,i=this.height||e.naturalHeight,r=document.createElement("canvas");r.width=t,r.height=i;const a=r.getContext("2d");a.imageSmoothingEnabled=!1,a.fillStyle=this._getColorId(),a.fillRect(0,0,t,i),Xe(e)||(a.globalCompositeOperation="destination-in",a.drawImage(e,0,0,t,i)),this._imageMask=r}return this._imageMask}}class Pi{constructor(e,t,i,r){Object.defineProperty(this,"event",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"originalPoint",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"point",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"bbox",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"simulated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"native",{enumerable:!0,configurable:!0,writable:!0,value:!0}),ge("touchevents")&&e instanceof Touch?this.id=e.identifier:this.id=null}}class Oi extends St{constructor(e){if(super(),Object.defineProperty(this,"view",{enumerable:!0,configurable:!0,writable:!0,value:document.createElement("div")}),Object.defineProperty(this,"_layerDom",{enumerable:!0,configurable:!0,writable:!0,value:document.createElement("div")}),Object.defineProperty(this,"layers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_dirtyLayers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"defaultLayer",{enumerable:!0,configurable:!0,writable:!0,value:this.getLayer(0)}),Object.defineProperty(this,"_ghostLayer",{enumerable:!0,configurable:!0,writable:!0,value:new ki}),Object.defineProperty(this,"_patternCanvas",{enumerable:!0,configurable:!0,writable:!0,value:document.createElement("canvas")}),Object.defineProperty(this,"_patternContext",{enumerable:!0,configurable:!0,writable:!0,value:this._patternCanvas.getContext("2d")}),Object.defineProperty(this,"_realWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_realHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_calculatedWidth",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_calculatedHeight",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"resolution",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"interactionsEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_listeners",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_events",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_colorId",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_colorMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_forceInteractive",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_omitTainted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_hovering",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"_dragging",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_mousedown",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_lastPointerMoveEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tapToActivate",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"tapToActivateTimeout",{enumerable:!0,configurable:!0,writable:!0,value:3e3}),Object.defineProperty(this,"_touchActive",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_touchActiveTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.resolution=e??window.devicePixelRatio,this.view.style.position="absolute",this.view.setAttribute("aria-hidden","true"),this.view.appendChild(this._layerDom),this._disposers.push(new X(()=>{ue(this._events,(t,i)=>{i.disposer.dispose()}),v(this.layers,t=>{oe(t.view),t.exportableView&&oe(t.exportableView)}),oe(this._ghostLayer.view),oe(this._patternCanvas)})),this._disposers.push(Je(()=>{e==null&&(this.resolution=window.devicePixelRatio)})),ge("touchevents")){const t=i=>{this._dragging.length!==0&&Qe(this._dragging,r=>!r.value.shouldCancelTouch()||(i.preventDefault(),!1)),this._touchActiveTimeout&&this._delayTouchDeactivate()};this._disposers.push(A(window,"touchstart",t,{passive:!1})),this._disposers.push(A(this.view,"touchstart",t,{passive:!1})),this._disposers.push(A(this.view,"touchmove",()=>{this._touchActiveTimeout&&this._delayTouchDeactivate()},{passive:!0})),this._disposers.push(A(window,"click",i=>{this._touchActive=!1},{passive:!0})),this._disposers.push(A(this.view,"click",i=>{window.setTimeout(()=>{this._touchActive=!0,this._delayTouchDeactivate()},100)},{passive:!0}))}ge("wheelevents")&&this._disposers.push(A(this.view,"wheel",t=>{let i=!1;this._hovering.forEach(r=>{if(r.wheelable)return i=!0,!1}),i&&t.preventDefault()},{passive:!1}))}_delayTouchDeactivate(){this._touchActiveTimeout&&clearTimeout(this._touchActiveTimeout),this.tapToActivateTimeout>0&&(this._touchActiveTimeout=window.setTimeout(()=>{this._touchActive=!1},this.tapToActivateTimeout))}get debugGhostView(){return!!this._ghostLayer.view.parentNode}set debugGhostView(e){e?this._ghostLayer.view.parentNode||this.view.appendChild(this._ghostLayer.view):this._ghostLayer.view.parentNode&&this._ghostLayer.view.parentNode.removeChild(this._ghostLayer.view)}createLinearGradient(e,t,i,r){return this.defaultLayer.context.createLinearGradient(e,t,i,r)}createRadialGradient(e,t,i,r,a,s){return this.defaultLayer.context.createRadialGradient(e,t,i,r,a,s)}createPattern(e,t,i,r,a){return this._patternCanvas.width=r,this._patternCanvas.height=a,this._patternContext.clearRect(0,0,r,a),t.renderDetached(this._patternContext),e.renderDetached(this._patternContext),this._patternContext.createPattern(this._patternCanvas,i)}makeContainer(){return new ti(this)}makeGraphics(){return new yi(this)}makeText(e,t){return new rt(this,e,t)}makeTextStyle(){return new vi}makeRadialText(e,t){return new wi(this,e,t)}makePicture(e){return new xi(this,e)}resizeLayer(e){e.resize(this._calculatedWidth,this._calculatedHeight,this._calculatedWidth,this._calculatedHeight,this.resolution)}resizeGhost(){this._ghostLayer.resize(this._calculatedWidth,this._calculatedHeight,this._calculatedWidth,this._calculatedHeight,this.resolution)}resize(e,t,i,r){this._realWidth=e,this._realHeight=t,this._calculatedWidth=i,this._calculatedHeight=r,v(this.layers,a=>{a&&(a.dirty=!0,this.resizeLayer(a))}),this.resizeGhost(),this.view.style.width=i+"px",this.view.style.height=r+"px"}createDetachedLayer(e=!1){const t=document.createElement("canvas"),i=t.getContext("2d",{willReadFrequently:e}),r=new Ei(t,i);return t.style.position="absolute",t.style.top="0px",t.style.left="0px",r}getLayerByOrder(e){const t=this.layers,i=t.length;for(let r=0;ru.order>h.order?1:u.order{t&&t.dirty&&t.visible&&(this._dirtyLayers.push(t),t.clear())}),this._ghostLayer.clear(),e.render(this.defaultLayer),this._ghostLayer.context.restore(),v(this.layers,t=>{if(t){const i=t.context;i.beginPath(),i.moveTo(0,0),i.stroke()}}),v(this._dirtyLayers,t=>{t.context.restore(),t.dirty=!1}),this._hovering.size&&this._lastPointerMoveEvent){const{events:t,target:i,native:r}=this._lastPointerMoveEvent;v(t,a=>{this._dispatchGlobalMousemove(a,i,r)})}}paintId(e){const t=Kt(++this._colorId),i=ee.fromHex(t).toCSS();return this._colorMap[i]=e,i}_removeObject(e){e._colorId!==void 0&&delete this._colorMap[e._colorId]}_adjustBoundingBox(e){const t=this._ghostLayer.margin;return new DOMRect(-t.left,-t.top,e.width+t.left+t.right,e.height+t.top+t.bottom)}getEvent(e,t=!0){const i=this.view.getBoundingClientRect(),r=e.clientX||0,a=e.clientY||0,s=this._calculatedWidth/this._realWidth,n=this._calculatedHeight/this._realHeight,u={x:r-i.left,y:a-i.top},h={x:(r-(t?i.left:0))*s,y:(a-(t?i.top:0))*n};return new Pi(e,u,h,this._adjustBoundingBox(i))}_getHitTarget(e,t,i){if(t.width===0||t.height===0||e.xt.right||e.yt.bottom||!i||!this._layerDom.contains(i))return;const r=this._ghostLayer.getImageData(e,t);if(r.data[0]===0&&r.data[1]===0&&r.data[2]===0)return!1;const a=ee.fromRGB(r.data[0],r.data[1],r.data[2]).toCSS();return this._colorMap[a]}_withEvents(e,t){const i=this._events[e];if(i!==void 0){i.dispatching=!0;try{t(i)}finally{i.dispatching=!1,i.cleanup&&(i.cleanup=!1,me(i.callbacks,r=>!r.disposed),i.callbacks.length===0&&(i.disposer.dispose(),delete this._events[e]))}}}_dispatchEventAll(e,t){this.interactionsEnabled&&this._withEvents(e,i=>{v(i.callbacks,r=>{r.disposed||r.callback.call(r.context,t)})})}_dispatchEvent(e,t,i){if(!this.interactionsEnabled)return!1;let r=!1;return this._withEvents(e,a=>{v(a.callbacks,s=>{s.disposed||s.object!==t||(s.callback.call(s.context,i),r=!0)})}),r}_dispatchMousedown(e,t){const i=e.button;if(i!=0&&i!=2&&i!=1&&i!==void 0)return;const r=this.getEvent(e),a=this._getHitTarget(r.originalPoint,r.bbox,t);if(a){const s=r.id;let n=!1;_e(a,u=>{const h={id:s,value:u};return this._mousedown.push(h),!n&&this._dispatchEvent("pointerdown",u,r)&&(n=!0,this._dragging.some(p=>p.value===u&&p.id===s)||this._dragging.push(h)),!0})}}_dispatchGlobalMousemove(e,t,i){const r=this.getEvent(e),a=this._getHitTarget(r.originalPoint,r.bbox,t);r.native=i,a?(this._hovering.forEach(s=>{s.contains(a)||(this._hovering.delete(s),s.cursorOverStyle&&xe(document.body,"cursor",s._replacedCursorStyle),this._dispatchEvent("pointerout",s,r))}),r.native&&_e(a,s=>(this._hovering.has(s)||(this._hovering.add(s),s.cursorOverStyle&&(s._replacedCursorStyle=At(document.body,"cursor"),xe(document.body,"cursor",s.cursorOverStyle)),this._dispatchEvent("pointerover",s,r)),!0))):(this._hovering.forEach(s=>{s.cursorOverStyle&&xe(document.body,"cursor",s._replacedCursorStyle),this._dispatchEvent("pointerout",s,r)}),this._hovering.clear()),this._dispatchEventAll("globalpointermove",r)}_dispatchGlobalMouseup(e,t){const i=this.getEvent(e);i.native=t,this._dispatchEventAll("globalpointerup",i)}_dispatchDragMove(e){if(this._dragging.length!==0){const t=this.getEvent(e),i=t.id;this._dragging.forEach(r=>{r.id===i&&this._dispatchEvent("pointermove",r.value,t)})}}_dispatchDragEnd(e,t){const i=e.button;let r;if(i==0||i===void 0)r="click";else if(i==2)r="rightclick";else{if(i!=1)return;r="middleclick"}const a=this.getEvent(e),s=a.id;if(this._mousedown.length!==0){const n=this._getHitTarget(a.originalPoint,a.bbox,t);n&&this._mousedown.forEach(u=>{u.id===s&&u.value.contains(n)&&this._dispatchEvent(r,u.value,a)}),this._mousedown.length=0}this._dragging.length!==0&&(this._dragging.forEach(n=>{n.id===s&&this._dispatchEvent("pointerup",n.value,a)}),this._dragging.length=0)}_dispatchDoubleClick(e,t){const i=this.getEvent(e),r=this._getHitTarget(i.originalPoint,i.bbox,t);r&&_e(r,a=>!this._dispatchEvent("dblclick",a,i))}_dispatchWheel(e,t){const i=this.getEvent(e),r=this._getHitTarget(i.originalPoint,i.bbox,t);r&&_e(r,a=>!this._dispatchEvent("wheel",a,i))}_makeSharedEvent(e,t){if(this._listeners[e]===void 0){const i=t();this._listeners[e]=new jt(()=>{delete this._listeners[e],i.dispose()})}return this._listeners[e].increment()}_onPointerEvent(e,t){let i=!1,r=null;function a(){r=null,i=!1}return new He([new X(()=>{r!==null&&clearTimeout(r),a()}),A(this.view,je(e),s=>{i=!0,r!==null&&clearTimeout(r),r=window.setTimeout(a,0)}),Qt(window,e,(s,n)=>{r!==null&&(clearTimeout(r),r=null),t(s,n,i),i=!1})])}_initEvent(e){switch(e){case"globalpointermove":case"pointerover":case"pointerout":return this._makeSharedEvent("pointermove",()=>{const t=(i,r,a)=>{this._lastPointerMoveEvent={events:i,target:r,native:a},v(i,s=>{this._dispatchGlobalMousemove(s,r,a)})};return new He([this._onPointerEvent("pointerdown",t),this._onPointerEvent("pointermove",t)])});case"globalpointerup":return this._makeSharedEvent("pointerup",()=>{const t=this._onPointerEvent("pointerup",(r,a,s)=>{v(r,n=>{this._dispatchGlobalMouseup(n,s)}),this._lastPointerMoveEvent={events:r,target:a,native:s}}),i=this._onPointerEvent("pointercancel",(r,a,s)=>{v(r,n=>{this._dispatchGlobalMouseup(n,s)}),this._lastPointerMoveEvent={events:r,target:a,native:s}});return new X(()=>{t.dispose(),i.dispose()})});case"click":case"rightclick":case"middleclick":case"pointerdown":case"pointermove":case"pointerup":return this._makeSharedEvent("pointerdown",()=>{const t=this._onPointerEvent("pointerdown",(s,n)=>{v(s,u=>{this._dispatchMousedown(u,n)})}),i=this._onPointerEvent("pointermove",s=>{v(s,n=>{this._dispatchDragMove(n)})}),r=this._onPointerEvent("pointerup",(s,n)=>{v(s,u=>{this._dispatchDragEnd(u,n)})}),a=this._onPointerEvent("pointercancel",(s,n)=>{v(s,u=>{this._dispatchDragEnd(u,n)})});return new X(()=>{t.dispose(),i.dispose(),r.dispose(),a.dispose()})});case"dblclick":return this._makeSharedEvent("dblclick",()=>this._onPointerEvent("dblclick",(t,i)=>{v(t,r=>{this._dispatchDoubleClick(r,i)})}));case"wheel":return this._makeSharedEvent("wheel",()=>A(window,je("wheel"),t=>{this._dispatchWheel(t,Ke(t))},{passive:!1}))}}_addEvent(e,t,i,r){let a=this._events[t];a===void 0&&(a=this._events[t]={disposer:this._initEvent(t),callbacks:[],dispatching:!1,cleanup:!1});const s={object:e,context:r,callback:i,disposed:!1};return a.callbacks.push(s),new X(()=>{s.disposed=!0,a.dispatching?a.cleanup=!0:(Ce(a.callbacks,s),a.callbacks.length===0&&(a.disposer.dispose(),delete this._events[t]))})}getCanvas(e,t){this.render(e),t||(t={});let i=this.resolution,r=Math.floor(this._calculatedWidth*this.resolution),a=Math.floor(this._calculatedHeight*this.resolution);if(t.minWidth&&t.minWidth>r){let l=t.minWidth/r;l>i&&(i=l*this.resolution)}if(t.minHeight&&t.minHeight>a){let l=t.minHeight/a;l>i&&(i=l*this.resolution)}if(t.maxWidth&&t.maxWidtha){let l=t.maxHeight/a;l{if(l&&l.visible&&(l.tainted||n)){b=!0,l.exportableView=l.view,l.exportableContext=l.context,l.view=document.createElement("canvas"),l.view.style.position="fixed",l.view.style.top="-10000px",this.view.appendChild(l.view),s.push(l.view);let m=0,o=0;l.margin&&(m+=l.margin.left||0+l.margin.right||0,o+=l.margin.top||0+l.margin.bottom||0),l.view.width=r+m,l.view.height=a+o,l.context=l.view.getContext("2d"),l.dirty=!0,l.scale=i}}),b&&(this._omitTainted=!0,this.render(e),this._omitTainted=!1),v(this.layers,l=>{if(l&&l.visible){let m=0,o=0;l.margin&&(m=-(l.margin.left||0)*this.resolution,o=-(l.margin.top||0)*this.resolution),h.drawImage(l.view,m,o),l.exportableView&&(l.view=l.exportableView,l.exportableView=void 0),l.exportableContext&&(l.context=l.exportableContext,l.exportableContext=void 0),p{l.style.position="",l.style.top="",this.view.removeChild(l)}),u}}class ki{constructor(){Object.defineProperty(this,"view",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"margin",{enumerable:!0,configurable:!0,writable:!0,value:{left:0,right:0,top:0,bottom:0}}),Object.defineProperty(this,"_width",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_height",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.view=document.createElement("canvas"),this.context=this.view.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.context.imageSmoothingEnabled=!1,this.view.style.position="absolute",this.view.style.top="0px",this.view.style.left="0px"}resize(e,t,i,r,a){e+=this.margin.left+this.margin.right,t+=this.margin.top+this.margin.bottom,i+=this.margin.left+this.margin.right,r+=this.margin.top+this.margin.bottom,this.view.style.left=-this.margin.left+"px",this.view.style.top=-this.margin.top+"px",this._width=Math.floor(e*a),this._height=Math.floor(t*a),this.view.width=this._width,this.view.style.width=i+"px",this.view.height=this._height,this.view.style.height=r+"px"}getImageData(e,t){return this.context.getImageData(Math.round((e.x-t.left)/t.width*this._width),Math.round((e.y-t.top)/t.height*this._height),1,1)}setMargin(e){this.margin.left=0,this.margin.right=0,this.margin.top=0,this.margin.bottom=0,v(e,t=>{t.margin&&(this.margin.left=Math.max(this.margin.left,t.margin.left),this.margin.right=Math.max(this.margin.right,t.margin.right),this.margin.top=Math.max(this.margin.top,t.margin.top),this.margin.bottom=Math.max(this.margin.bottom,t.margin.bottom))})}clear(){this.context.save(),this.context.fillStyle="#000",this.context.fillRect(0,0,this._width,this._height)}}class Ei{constructor(e,t){Object.defineProperty(this,"view",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tainted",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"margin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"order",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"visible",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"width",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"height",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"scale",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dirty",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"exportableView",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exportableContext",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_width",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_height",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.view=e,this.context=t}resize(e,t,i,r,a){this.width!=null&&(e=this.width,i=this.width),this.height!=null&&(t=this.height,r=this.height),this.margin?(e+=this.margin.left+this.margin.right,t+=this.margin.top+this.margin.bottom,i+=this.margin.left+this.margin.right,r+=this.margin.top+this.margin.bottom,this.view.style.left=-this.margin.left+"px",this.view.style.top=-this.margin.top+"px"):(this.view.style.left="0px",this.view.style.top="0px"),this._width=Math.floor(e*a),this._height=Math.floor(t*a),this.view.width=this._width,this.view.style.width=i+"px",this.view.height=this._height,this.view.style.height=r+"px"}clear(){this.context.save(),this.context.clearRect(0,0,this._width,this._height)}}function Ne(d,e){d==null?requestAnimationFrame(e):setTimeout(()=>{requestAnimationFrame(e)},1e3/d)}class Be{constructor(e,t={},i){if(Object.defineProperty(this,"dom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_inner",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDirtyParents",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dirty",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dirtyParents",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dirtyBounds",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_dirtyPositions",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_ticker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_tickers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_updateTick",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:new ut}),Object.defineProperty(this,"animationTime",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_animations",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_renderer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rootContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"container",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tooltipContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipContainerSettings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltip",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"language",{enumerable:!0,configurable:!0,writable:!0,value:$t.new(this,{})}),Object.defineProperty(this,"locale",{enumerable:!0,configurable:!0,writable:!0,value:it}),Object.defineProperty(this,"utc",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"timezone",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fps",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"numberFormatter",{enumerable:!0,configurable:!0,writable:!0,value:Ht.new(this,{})}),Object.defineProperty(this,"dateFormatter",{enumerable:!0,configurable:!0,writable:!0,value:Wt.new(this,{})}),Object.defineProperty(this,"durationFormatter",{enumerable:!0,configurable:!0,writable:!0,value:Ut.new(this,{})}),Object.defineProperty(this,"tabindex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_tabindexes",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_a11yD",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_focusElementDirty",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_focusElementContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_focusedSprite",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isShift",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_keyboardDragPoint",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipElementContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_readerAlertElement",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_logo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltipDiv",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nonce",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"interfaceColors",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"verticalLayout",{enumerable:!0,configurable:!0,writable:!0,value:ct.new(this,{})}),Object.defineProperty(this,"horizontalLayout",{enumerable:!0,configurable:!0,writable:!0,value:dt.new(this,{})}),Object.defineProperty(this,"gridLayout",{enumerable:!0,configurable:!0,writable:!0,value:bt.new(this,{})}),Object.defineProperty(this,"_paused",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"autoResize",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_fontHash",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_isDisposed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_disposers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_resizeSensorDisposer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tooltips",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_htmlElementContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_htmlEnabledContainers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),!i)throw new Error("You cannot use `new Class()`, instead use `Class.new()`");let r,a;if(this._settings=t,t.accessible==0&&(this._a11yD=!0),t.useSafeResolution==null&&(t.useSafeResolution=!0),t.useSafeResolution&&(r=_t()),this._renderer=new Oi(r),a=e instanceof HTMLElement?e:document.getElementById(e),v(ie.rootElements,u=>{if(u.dom===a)throw new Error("You cannot have multiple Roots on the same DOM node")}),this.interfaceColors=fe.new(this,{}),a===null)throw new Error("Could not find HTML element with id `"+e+"`");this.dom=a;let s=document.createElement("div");s.style.position="relative",s.style.width="100%",s.style.height="100%",a.appendChild(s);const n=t.tooltipContainerBounds;n&&(this._tooltipContainerSettings=n),this._inner=s,this._updateComputedStyles(),ie.rootElements.push(this)}static new(e,t){const i=new Be(e,t,!0);return i._init(),i}moveDOM(e){let t;if(t=e instanceof HTMLElement?e:document.getElementById(e),t){for(;this.dom.childNodes.length>0;)t.appendChild(this.dom.childNodes[0]);this.dom=t,this._initResizeSensor(),this.resize()}}_handleLogo(){if(this._logo){const e=this.dom.offsetWidth,t=this.dom.offsetHeight;e<=150||t<=60?this._logo.hide():this._logo.show()}}_showBranding(){if(!this._logo){const e=this.tooltipContainer.children.push(q.new(this,{interactive:!0,interactiveChildren:!1,position:"absolute",setStateOnChildren:!0,paddingTop:9,paddingRight:9,paddingBottom:9,paddingLeft:9,scale:.6,y:Ze(100),centerY:Z,tooltipText:"Created using amCharts 5",tooltipX:Z,cursorOverStyle:"pointer",background:ft.new(this,{fill:re(4671320),fillOpacity:0,tooltipY:5})})),t=Ve.new(this,{pointerOrientation:"horizontal",paddingTop:4,paddingRight:7,paddingBottom:4,paddingLeft:7});t.label.setAll({fontSize:12}),t.get("background").setAll({fill:this.interfaceColors.get("background"),stroke:this.interfaceColors.get("grid"),strokeOpacity:.3}),e.set("tooltip",t),e.events.on("click",()=>{window.open("https://www.amcharts.com/","_blank")}),e.states.create("hover",{}),e.children.push(ze.new(this,{stroke:re(13421772),strokeWidth:3,svgPath:"M5 25 L13 25h13.6c3.4 0 6 0 10.3-4.3s5.2-12 8.6-12c3.4 0 4.3 8.6 7.7 8.6M83.4 25H79.8c-3.4 0-6 0-10.3-4.3s-5.2-12-8.6-12-4.3 8.6-7.7 8.6"})).states.create("hover",{stroke:re(3976191)}),e.children.push(ze.new(this,{stroke:re(8947848),strokeWidth:3,svgPath:"M83.4 25h-31C37 25 39.5 4.4 28.4 4.4S18.9 24.2 4.3 25H0"})).states.create("hover",{stroke:re(4671320)}),this._logo=e,this._handleLogo()}}_getRealSize(){return this.dom.getBoundingClientRect()}_getCalculatedSize(e){return this._settings.calculateSize?this._settings.calculateSize(e):{width:e.width,height:e.height}}_init(){const e=this._settings;e.accessible!==!1&&(e.focusable&&(this._inner.setAttribute("focusable","true"),this._inner.setAttribute("tabindex",this.tabindex+"")),e.ariaLabel&&this._inner.setAttribute("aria-label",e.ariaLabel));const t=this._renderer,i=this._getRealSize(),r=this._getCalculatedSize(i),a=Math.floor(r.width),s=Math.floor(r.height),n=Math.floor(i.width),u=Math.floor(i.height),h=q.new(this,{visible:!0,width:a,height:s});this._rootContainer=h,this._rootContainer._defaultThemes.push(It.new(this));const p=h.children.push(q.new(this,{visible:!0,width:Z,height:Z}));this.container=p,t.resize(n,u,a,s),this._inner.appendChild(t.view),this._initResizeSensor();const c=document.createElement("div");if(this._htmlElementContainer=c,c.className="am5-html-container",c.style.position="absolute",c.style.pointerEvents="none",this._tooltipContainerSettings||(c.style.overflow="hidden"),this._inner.appendChild(c),this._a11yD!==!0){const b=document.createElement("div");b.className="am5-reader-container",b.setAttribute("role","alert"),b.style.position="absolute",b.style.width="1px",b.style.height="1px",b.style.overflow="hidden",b.style.clip="rect(1px, 1px, 1px, 1px)",this._readerAlertElement=b,this._inner.appendChild(this._readerAlertElement);const l=document.createElement("div");l.className="am5-focus-container",l.style.position="absolute",l.style.pointerEvents="none",l.style.top="0px",l.style.left="0px",l.style.overflow="hidden",l.style.width=a+"px",l.style.height=s+"px",l.setAttribute("role","graphics-document"),J(l,!1),this._focusElementContainer=l,this._inner.appendChild(this._focusElementContainer);const m=document.createElement("div");this._tooltipElementContainer=m,m.className="am5-tooltip-container",this._inner.appendChild(m),ge("keyboardevents")&&(this._disposers.push(A(window,"keydown",o=>{o.keyCode==16?this._isShift=!0:o.keyCode==9&&(this._isShift=o.shiftKey)})),this._disposers.push(A(window,"keyup",o=>{o.keyCode==16&&(this._isShift=!1)})),this._disposers.push(A(l,"click",()=>{const o=this._focusedSprite;if(o){const f=t.getEvent(new MouseEvent("click"));o.events.dispatch("click",{type:"click",originalEvent:f.event,point:f.point,simulated:!0,target:o})}})),this._disposers.push(A(l,"keydown",o=>{const f=this._focusedSprite;if(f){o.keyCode==27&&(pt(),this._focusedSprite=void 0);let g=0,x=0;switch(o.keyCode){case 13:o.preventDefault();const y=t.getEvent(new MouseEvent("click"));return void f.events.dispatch("click",{type:"click",originalEvent:y.event,point:y.point,simulated:!0,target:f});case 37:g=-6;break;case 39:g=6;break;case 38:x=-6;break;case 40:x=6;break;default:return}if(g!=0||x!=0){if(o.preventDefault(),!f.isDragging()){this._keyboardDragPoint={x:0,y:0};const P=t.getEvent(new MouseEvent("mousedown",{clientX:0,clientY:0}));f.events.isEnabled("pointerdown")&&f.events.dispatch("pointerdown",{type:"pointerdown",originalEvent:P.event,point:P.point,simulated:!0,target:f})}const y=this._keyboardDragPoint;y.x+=g,y.y+=x;const _=t.getEvent(new MouseEvent("mousemove",{clientX:y.x,clientY:y.y}),!1);f.events.isEnabled("globalpointermove")&&f.events.dispatch("globalpointermove",{type:"globalpointermove",originalEvent:_.event,point:_.point,simulated:!0,target:f})}}})),this._disposers.push(A(l,"keyup",o=>{if(this._focusedSprite){const f=this._focusedSprite,g=o.keyCode;switch(g){case 37:case 39:case 38:case 40:if(f.isDragging()){const x=this._keyboardDragPoint,y=t.getEvent(new MouseEvent("mouseup",{clientX:x.x,clientY:x.y}));return f.events.isEnabled("globalpointerup")&&f.events.dispatch("globalpointerup",{type:"globalpointerup",originalEvent:y.event,point:y.point,simulated:!0,target:f}),void(this._keyboardDragPoint=void 0)}if(f.get("focusableGroup")){const x=f.get("focusableGroup"),y=this._tabindexes.filter(E=>E.get("focusableGroup")==x&&E.getPrivate("focusable")!==!1);let _=y.indexOf(f);const P=y.length-1;_+=g==39||g==40?1:-1,_<0?_=P:_>P&&(_=0),gt(y[_].getPrivate("focusElement").dom)}}}})))}this._startTicker(),this.setThemes([]),this._addTooltip(),this._hasLicense()||this._showBranding()}_initResizeSensor(){this._resizeSensorDisposer&&this._resizeSensorDisposer.dispose(),this._resizeSensorDisposer=new Yt(this.dom,()=>{this.autoResize&&this.resize()}),this._disposers.push(this._resizeSensorDisposer)}resize(){const e=this._getRealSize(),t=this._getCalculatedSize(e),i=Math.floor(t.width),r=Math.floor(t.height);if(i>0&&r>0){const a=Math.floor(e.width),s=Math.floor(e.height),n=this._htmlElementContainer;if(n.style.width=i+"px",n.style.height=r+"px",this._a11yD!==!0){const h=this._focusElementContainer;h.style.width=i+"px",h.style.height=r+"px"}this._renderer.resize(a,s,i,r);const u=this._rootContainer;u.setPrivate("width",i),u.setPrivate("height",r),this._render(),this._handleLogo()}}_render(){this._renderer.render(this._rootContainer._display),this._focusElementDirty&&(this._updateCurrentFocus(),this._focusElementDirty=!1)}_runTickers(e){v(this._tickers,t=>{t(e)})}_runAnimations(e){me(this._animations,t=>t._runAnimation(e))}_runDirties(){let e={};for(;this._isDirtyParents;)this._isDirtyParents=!1,se(this._dirtyParents).forEach(s=>{const n=this._dirtyParents[s];delete this._dirtyParents[s],n.isDisposed()||(e[n.uid]=n,n._prepareChildren())});se(e).forEach(s=>{e[s]._updateChildren()});const t=[];se(this._dirty).forEach(s=>{const n=this._dirty[s];n.isDisposed()?delete this._dirty[n.uid]:(t.push(n),n._beforeChanged())}),t.forEach(s=>{s._changed(),delete this._dirty[s.uid],s._clearDirty()}),this._isDirty=!1;const i={},r=[];se(this._dirtyBounds).forEach(s=>{const n=this._dirtyBounds[s];delete this._dirtyBounds[s],n.isDisposed()||(i[n.uid]=n.depth(),r.push(n))}),this._positionHTMLElements(),r.sort((s,n)=>mt(i[n.uid],i[s.uid])),r.forEach(s=>{s._updateBounds()});const a=this._dirtyPositions;se(a).forEach(s=>{const n=a[s];delete a[s],n.isDisposed()||n._updatePosition()}),t.forEach(s=>{s._afterChanged()})}_renderFrame(e){return!this._updateTick||(this.events.isEnabled("framestarted")&&this.events.dispatch("framestarted",{type:"framestarted",target:this,timestamp:e}),this._checkComputedStyles(),this._runTickers(e),this._runAnimations(e),this._runDirties(),this._render(),this._positionHTMLElements(),this.events.isEnabled("frameended")&&this.events.dispatch("frameended",{type:"frameended",target:this,timestamp:e}),this._tickers.length===0&&this._animations.length===0&&!this._isDirty)}_runTicker(e,t){this.isDisposed()||(this.animationTime=e,this._renderFrame(e)?(this._ticker=null,this.animationTime=null):this._paused||(t?this._ticker:Ne(this.fps,this._ticker)))}_runTickerNow(e=1e4){if(!this.isDisposed()){const t=performance.now()+e;for(;;){const i=performance.now();if(i>=t){this.animationTime=null;break}if(this.animationTime=i,this._renderFrame(i)){this.animationTime=null;break}}}}_startTicker(){this._ticker===null&&(this.animationTime=null,this._ticker=e=>{this._runTicker(e)},Ne(this.fps,this._ticker))}get updateTick(){return this._updateTick}set updateTick(e){this._updateTick=e,e&&this._startTicker()}_addDirtyEntity(e){this._dirty[e.uid]===void 0&&(this._isDirty=!0,this._dirty[e.uid]=e,this._startTicker())}_addDirtyParent(e){this._dirtyParents[e.uid]===void 0&&(this._isDirty=!0,this._isDirtyParents=!0,this._dirtyParents[e.uid]=e,this._startTicker())}_addDirtyBounds(e){this._dirtyBounds[e.uid]===void 0&&(this._isDirty=!0,this._dirtyBounds[e.uid]=e,this._startTicker())}_addDirtyPosition(e){this._dirtyPositions[e.uid]===void 0&&(this._isDirty=!0,this._dirtyPositions[e.uid]=e,this._startTicker())}_addAnimation(e){this._animations.indexOf(e)===-1&&(this._animations.push(e),this._startTicker())}_markDirty(){this._isDirty=!0}_markDirtyRedraw(){this.events.once("frameended",()=>{this._isDirty=!0,this._startTicker()})}eachFrame(e){return this._tickers.push(e),this._startTicker(),new X(()=>{Ce(this._tickers,e)})}markDirtyGlobal(e){e||(e=this.container),e.walkChildren(t=>{t instanceof q&&this.markDirtyGlobal(t),t.markDirty(),t.markDirtyBounds()})}width(){return Math.floor(this._getCalculatedSize(this._getRealSize()).width)}height(){return Math.floor(this._getCalculatedSize(this._getRealSize()).height)}dispose(){this._isDisposed||(this._isDisposed=!0,this._rootContainer.dispose(),this._renderer.dispose(),this.horizontalLayout.dispose(),this.verticalLayout.dispose(),this.interfaceColors.dispose(),v(this._disposers,e=>{e.dispose()}),this._inner&&yt(this._inner),ae(ie.rootElements,this))}isDisposed(){return this._isDisposed}readerAlert(e){this._a11yD!==!0&&(this._readerAlertElement.innerHTML=Ie(e))}setThemes(e){this._rootContainer.set("themes",e);const t=this.tooltipContainer;t&&t._applyThemes();const i=this.interfaceColors;i&&i._applyThemes()}_addTooltip(){if(!this.tooltipContainer){const e=this._tooltipContainerSettings,t=this._rootContainer.children.push(q.new(this,{position:"absolute",isMeasured:!1,width:Z,height:Z,layer:e?35:30,layerMargin:e||void 0}));this.tooltipContainer=t;const i=Ve.new(this,{});this.container.set("tooltip",i),i.hide(0),this._tooltip=i}}_registerTabindexOrder(e){this._a11yD!=1&&(e.get("focusable")?Te(this._tabindexes,e):ae(this._tabindexes,e),this._invalidateTabindexes())}_unregisterTabindexOrder(e){this._a11yD!=1&&(ae(this._tabindexes,e),this._invalidateTabindexes())}_invalidateTabindexes(){if(this._a11yD==1)return;this._tabindexes.sort((t,i)=>{const r=t.get("tabindexOrder",0),a=i.get("tabindexOrder",0);return r==a?0:r>a?1:-1});const e=[];v(this._tabindexes,(t,i)=>{t.getPrivate("focusElement")?this._moveFocusElement(i,t):this._makeFocusElement(i,t);const r=t.get("focusableGroup");r&&t.getPrivate("focusable")!==!1&&(e.indexOf(r)!==-1?t.getPrivate("focusElement").dom.setAttribute("tabindex","-1"):e.push(r))})}_updateCurrentFocus(){this._a11yD!=1&&this._focusedSprite&&(this._decorateFocusElement(this._focusedSprite),this._positionFocusElement(this._focusedSprite))}_decorateFocusElement(e,t){if(this._a11yD==1||(t||(t=e.getPrivate("focusElement").dom),!t))return;const i=e.get("role");i?t.setAttribute("role",i):t.removeAttribute("role");const r=e.get("ariaLabel");if(r){const l=vt(e,r);t.setAttribute("aria-label",l)}else t.removeAttribute("aria-label");const a=e.get("ariaLive");a?t.setAttribute("aria-live",a):t.removeAttribute("aria-live");const s=e.get("ariaChecked");s!=null?t.setAttribute("aria-checked",s?"true":"false"):t.removeAttribute("aria-checked"),e.get("ariaHidden")?t.setAttribute("aria-hidden","true"):t.removeAttribute("aria-hidden");const n=e.get("ariaOrientation");n?t.setAttribute("aria-orientation",n):t.removeAttribute("aria-orientation");const u=e.get("ariaValueNow");u?t.setAttribute("aria-valuenow",u):t.removeAttribute("aria-valuenow");const h=e.get("ariaValueMin");h?t.setAttribute("aria-valuemin",h):t.removeAttribute("aria-valuemin");const p=e.get("ariaValueMax");p?t.setAttribute("aria-valuemax",p):t.removeAttribute("aria-valuemax");const c=e.get("ariaValueText");c?t.setAttribute("aria-valuetext",c):t.removeAttribute("aria-valuetext");const b=e.get("ariaControls");b?t.setAttribute("aria-controls",b):t.removeAttribute("aria-controls"),e.get("visible")&&e.get("opacity")!==0&&e.get("role")!="tooltip"&&!e.isHidden()&&e.getPrivate("focusable")!==!1?(t.getAttribute("tabindex")!="-1"&&t.setAttribute("tabindex",""+this.tabindex),t.removeAttribute("aria-hidden")):(t.removeAttribute("tabindex"),t.setAttribute("aria-hidden","true"))}_makeFocusElement(e,t){if(t.getPrivate("focusElement")||this._a11yD==1)return;const i=document.createElement("div");t.get("role")!="tooltip"&&(i.tabIndex=this.tabindex),i.style.position="absolute",J(i,!1);const r=[];t.setPrivate("focusElement",{dom:i,disposers:r}),this._decorateFocusElement(t),r.push(A(i,"focus",a=>{this._handleFocus(a,e)})),r.push(A(i,"blur",a=>{this._handleBlur(a,e)})),this._moveFocusElement(e,t)}_removeFocusElement(e){if(this._a11yD==1)return;ae(this._tabindexes,e);const t=e.getPrivate("focusElement");t&&(this._focusElementContainer.removeChild(t.dom),v(t.disposers,i=>{i.dispose()}))}_hideFocusElement(e){this._a11yD!=1&&(e.getPrivate("focusElement").dom.style.display="none")}_moveFocusElement(e,t){if(this._a11yD==1)return;const i=this._focusElementContainer,r=t.getPrivate("focusElement").dom;if(r===this._focusElementContainer.children[e])return;const a=this._focusElementContainer.children[e+1];a?i.insertBefore(r,a):i.append(r)}_positionFocusElement(e){if(this._a11yD==1||e==null)return;const t=e.globalBounds();let i=t.right==t.left?e.width():t.right-t.left,r=t.top==t.bottom?e.height():t.bottom-t.top,a=t.left-2,s=t.top-2;i<0&&(a+=i,i=Math.abs(i)),r<0&&(s+=r,r=Math.abs(r));const n=e.getPrivate("focusElement").dom;n.style.top=s+"px",n.style.left=a+"px",n.style.width=i+4+"px",n.style.height=r+4+"px"}_handleFocus(e,t){if(this._a11yD==1)return;const i=this._tabindexes[t];i.isVisibleDeep()?(this._positionFocusElement(i),this._focusedSprite=i,i.events.isEnabled("focus")&&i.events.dispatch("focus",{type:"focus",originalEvent:e,target:i})):this._focusNext(e.target,this._isShift?-1:1)}_focusNext(e,t){if(this._a11yD==1)return;const i=Array.from(document.querySelectorAll(["a[href]","area[href]","button:not([disabled])","details","input:not([disabled])","iframe:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[contentEditable=""]','[contentEditable="true"]','[contentEditable="TRUE"]','[tabindex]:not([tabindex^="-"])'].join(",")));let r=i.indexOf(e)+t;r<0?r=i.length-1:r>=i.length&&(r=0),i[r].focus()}_handleBlur(e,t){if(this._a11yD==1)return;const i=this._focusedSprite;i&&i.events.isEnabled("blur")&&i.events.dispatch("blur",{type:"blur",originalEvent:e,target:i}),this._focusedSprite=void 0}updateTooltip(e){if(this._a11yD==1)return;const t=Ie(e._getText());let i=e.getPrivate("tooltipElement");e.get("role")=="tooltip"&&t!=""?(i||(i=this._makeTooltipElement(e)),i.innerHTML!=t&&(i.innerHTML=t)):i&&(i.remove(),e.removePrivate("tooltipElement"))}_makeTooltipElement(e){const t=this._tooltipElementContainer,i=document.createElement("div");return i.style.position="absolute",i.style.width="1px",i.style.height="1px",i.style.overflow="hidden",i.style.clip="rect(1px, 1px, 1px, 1px)",J(i,!1),this._decorateFocusElement(e,i),t.append(i),e.setPrivate("tooltipElement",i),i}_removeTooltipElement(e){if(this._a11yD==1)return;const t=e.getPrivate("tooltipElement");if(t){const i=t.parentElement;i&&i.removeChild(t)}}_invalidateAccessibility(e){if(this._a11yD==1)return;this._focusElementDirty=!0;const t=e.getPrivate("focusElement");e.get("focusable")?t&&(this._decorateFocusElement(e),this._positionFocusElement(e)):t&&this._removeFocusElement(e)}focused(e){return this._focusedSprite===e}documentPointToRoot(e){const t=this._getRealSize(),i=this._getCalculatedSize(t),r=i.width/t.width,a=i.height/t.height;return{x:(e.x-t.left)*r,y:(e.y-t.top)*a}}rootPointToDocument(e){const t=this._getRealSize(),i=this._getCalculatedSize(t),r=i.width/t.width,a=i.height/t.height;return{x:e.x/r+t.left,y:e.y/a+t.top}}addDisposer(e){return this._disposers.push(e),e}_updateComputedStyles(){const e=window.getComputedStyle(this.dom);let t="";ue(e,(r,a)=>{pe(r)&&r.match(/^font/)&&(t+=a)});const i=t!=this._fontHash;return i&&(this._fontHash=t),i}_checkComputedStyles(){this._updateComputedStyles()&&this._invalidateLabelBounds(this.container)}_invalidateLabelBounds(e){e instanceof q?e.children.each(t=>{this._invalidateLabelBounds(t)}):e instanceof wt&&e.markDirtyBounds()}_hasLicense(){for(let e=0;e{const a=this._renderer.getEvent(r);e.events.dispatch("click",{type:"click",originalEvent:a.event,point:a.point,simulated:!1,target:e})}))),this._positionHTMLElement(e),t.append(i),Te(this._htmlEnabledContainers,e),i}_positionHTMLElements(){v(this._htmlEnabledContainers,e=>{this._positionHTMLElement(e)})}_positionHTMLElement(e){const t=e.getPrivate("htmlElement");if(t){v(["paddingTop","paddingRight","paddingBottom","paddingLeft","minWidth","minHeight","maxWidth","maxHeight"],p=>{const c=e.get(p);t.style[p]=c?c+"px":""});const i=e.compositeOpacity();setTimeout(()=>{t.style.opacity=i+""},10);const r=e.isVisibleDeep();r&&(t.style.display="block");const a=e.globalBounds();t.style.top=a.top+"px",t.style.left=a.left+"px";const s=e.get("width"),n=e.get("height");let u=0,h=0;if(s&&(u=e.width()),n&&(h=e.height()),s&&n)e.removePrivate("minWidth"),e.removePrivate("minHeight");else{t.style.position="fixed",t.style.width="",t.style.height="";const p=t.getBoundingClientRect();t.style.position="absolute",u=p.width,h=p.height,e._adjustedLocalBounds={left:0,right:0,top:0,bottom:0},e.setPrivate("minWidth",u),e.setPrivate("minHeight",h)}u>0&&(t.style.minWidth=u+"px"),h>0&&(t.style.minHeight=h+"px"),r&&i!=0||(t.style.display="none")}}_setHTMLContent(e,t){let i=e.getPrivate("htmlElement");i||(i=this._makeHTMLElement(e)),i.innerHTML!=t&&(i.innerHTML=t)}_removeHTMLContent(e){let t=e.getPrivate("htmlElement");t&&this._htmlElementContainer.removeChild(t),ae(this._htmlEnabledContainers,e)}}ot("AM5C241025748");const Ge="en-us",Ae=new Map([["ar",()=>w(()=>import("./ar-m2Ru99Kw.js"),__vite__mapDeps([]))],["bg-bg",()=>w(()=>import("./bg_BG-Zh0O8yIZ.js"),__vite__mapDeps([]))],["bs-ba",()=>w(()=>import("./bs_BA-EoGo05fu.js"),__vite__mapDeps([]))],["ca-es",()=>w(()=>import("./ca_ES-hscFeNNn.js"),__vite__mapDeps([]))],["cs-cz",()=>w(()=>import("./cs_CZ-6GM5cGtg.js"),__vite__mapDeps([]))],["da-dk",()=>w(()=>import("./da_DK-havyKYv2.js"),__vite__mapDeps([]))],["de-de",()=>w(()=>import("./de_DE-Fwy8dxxc.js"),__vite__mapDeps([]))],["de-ch",()=>w(()=>import("./de_CH-V5QttSa-.js"),__vite__mapDeps([]))],["el-gr",()=>w(()=>import("./el_GR-Yz-QyhSI.js"),__vite__mapDeps([]))],["en-us",()=>w(()=>import("./en_US-eyWLRifP.js"),__vite__mapDeps([]))],["en-ca",()=>w(()=>import("./en_CA-eyWLRifP.js"),__vite__mapDeps([]))],["es-es",()=>w(()=>import("./es_ES-o2wkmEuo.js"),__vite__mapDeps([]))],["et-ee",()=>w(()=>import("./et_EE-jAuARBOS.js"),__vite__mapDeps([]))],["fi-fi",()=>w(()=>import("./fi_FI-d4Rs7vi8.js"),__vite__mapDeps([]))],["fr-fr",()=>w(()=>import("./fr_FR-hDvN628_.js"),__vite__mapDeps([]))],["he-il",()=>w(()=>import("./he_IL-uMiAw4Wl.js"),__vite__mapDeps([]))],["hr-hr",()=>w(()=>import("./hr_HR-tOrtwB1u.js"),__vite__mapDeps([]))],["hu-hu",()=>w(()=>import("./hu_HU-tBJnhXJb.js"),__vite__mapDeps([]))],["id-id",()=>w(()=>import("./id_ID-XHyCBpw9.js"),__vite__mapDeps([]))],["it-it",()=>w(()=>import("./it_IT-AbCCe__c.js"),__vite__mapDeps([]))],["ja-jp",()=>w(()=>import("./ja_JP-Rlf-hOL0.js"),__vite__mapDeps([]))],["ko-kr",()=>w(()=>import("./ko_KR-_v1iWWtT.js"),__vite__mapDeps([]))],["lt-lt",()=>w(()=>import("./lt_LT-UBpPtM2w.js"),__vite__mapDeps([]))],["lv-lv",()=>w(()=>import("./lv_LV-Wuccr2bP.js"),__vite__mapDeps([]))],["nb-no",()=>w(()=>import("./nb_NO-QiKaA4xA.js"),__vite__mapDeps([]))],["nl-nl",()=>w(()=>import("./nl_NL-YPMyQFKz.js"),__vite__mapDeps([]))],["pl-pl",()=>w(()=>import("./pl_PL-1aQ453OS.js"),__vite__mapDeps([]))],["pt-br",()=>w(()=>import("./pt_BR-lyUqGwB2.js"),__vite__mapDeps([]))],["pt-pt",()=>w(()=>import("./pt_PT-o6ZnsHgl.js"),__vite__mapDeps([]))],["ro-ro",()=>w(()=>import("./ro_RO-YIwLBwwg.js"),__vite__mapDeps([]))],["ru-ru",()=>w(()=>import("./ru_RU-Xn7Ds-ry.js"),__vite__mapDeps([]))],["sk-sk",()=>w(()=>import("./sk_SK-lW-A9Llp.js"),__vite__mapDeps([]))],["sl-sl",()=>w(()=>import("./sl_SL-DJbbPhCy.js"),__vite__mapDeps([]))],["sr-rs",()=>w(()=>import("./sr_RS-HTzJ9Pkx.js"),__vite__mapDeps([]))],["sv-se",()=>w(()=>import("./sv_SE-Z8LyXaIi.js"),__vite__mapDeps([]))],["th-th",()=>w(()=>import("./th_TH-4uUl3VxF.js"),__vite__mapDeps([]))],["tr-tr",()=>w(()=>import("./tr_TR-vXXQf5Mr.js"),__vite__mapDeps([]))],["uk-ua",()=>w(()=>import("./uk_UA-DutcYu8K.js"),__vite__mapDeps([]))],["vi-vn",()=>w(()=>import("./vi_VN-bEo-fMOP.js"),__vite__mapDeps([]))],["zh-cn",()=>w(()=>import("./zh_Hans-l-imEkFY.js"),__vite__mapDeps([]))],["zh-hk",()=>w(()=>import("./zh_Hant-8IW9KGhY.js"),__vite__mapDeps([]))],["zh-tw",()=>w(()=>import("./zh_Hant-8IW9KGhY.js"),__vite__mapDeps([]))]]);function Mi(d){const e=d.split("-")[0].toLowerCase();let t=null;for(const i of Ae.keys())if(i.startsWith(e)){t=i;break}return t}function Si(d){return d?Ae.has(d.toLowerCase())?d.toLowerCase():Mi(d)||Ge:Ge}async function Ti(d,e=nt()){const t=Be.new(d);return t.locale=(await Ae.get(Si(e))()).default,t}const Ai=Object.freeze(Object.defineProperty({__proto__:null,createRoot:Ti},Symbol.toStringTag,{value:"Module"}));export{Ht as S,Ti as Y,Ai as c}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] diff --git a/dist/assets/cimAnalyzer-DtyBzAGI.js b/dist/assets/cimAnalyzer-DtyBzAGI.js deleted file mode 100644 index 1fa1858..0000000 --- a/dist/assets/cimAnalyzer-DtyBzAGI.js +++ /dev/null @@ -1 +0,0 @@ -import{wH as St,wI as pe,wJ as wt,k7 as De,ar as He,wK as k,wL as D,wM as Ft,eJ as st,k8 as Ye,wN as he,wO as tt,wy as ft,wP as Ce,uA as ci,wQ as Et,wR as ce,wS as Bi,gO as rt,gY as Ji,Z as Ve,dz as nt,eK as bt,eI as ve,wT as x,wU as It,a4 as Ot,bI as ot,a6 as j,a7 as mt,wV as Be,wW as Je,wX as Wi,wY as ui,wZ as fi,w_ as Ct,w$ as $e,x0 as _e,x1 as Ui,x2 as qi,d_ as ji,eH as qe,r3 as Ki,ae as Zi,eL as Qi,mH as ts,x3 as es,x4 as is,x5 as ss,x6 as rs,x7 as ns,x8 as je,x9 as os,xa as as,xb as Ke,ky as ls,xc as hs,xd as cs,ve as mi,wD as Lt,xe as us,xf as fs,ab as pi,dJ as ms,xg as ps,xh as _s,fX as ds,lV as F,ww as ge,xi as H,xj as ue,wz as w,xk as gs,xl as ys,md as Ps,me as Ze,xm as Nt,kk as we,kl as ke}from"./index-J0iiHjMT.js";import{a as $,l as Ms}from"./labelPoint-ysDT9nFH.js";import{t as Qe,e as bs}from"./TileClipper-NSFZXMR1.js";import{C as _i,g as di}from"./definitions-DqQMJYPH.js";import"./number-sTjsTbdA.js";import{C as xs}from"./BidiEngine-8z8MVveq.js";const Ie=new xs;function Ss(u){if(u==null)return["",!1];if(!Ie.hasBidiChar(u))return[u,!1];let t;return t=Ie.checkContextual(u)==="rtl"?"IDNNN":"ICNNN",[Ie.bidiTransform(u,t,"VLYSN"),!0]}const Cs=512;let et,Ge=class{constructor(t){this._geometry=t}next(){const t=this._geometry;return this._geometry=null,t}};function We(u,t){et||(et=new bs(0,0,0,1));const e=u.geometryType==="esriGeometryPolygon",i=e?Qe.Polygon:Qe.LineString,n=e?3:2;let s,r;for(et.reset(i),et.setPixelMargin(t+1),et.setExtent(Cs);u.nextPath();)if(!(u.pathSize1&&y>0&&l>0&&(o*d+a*g)/y/l<=this._maxCosAngle&&t.setControlPointAt(f-1),f===1&&(h=d,c=g,m=y),y>0&&(n=_,s=p,o=d,a=g,l=y)}this._isClosed&&l>0&&m>0&&(o*h+a*c)/m/l<=this._maxCosAngle&&t.setControlPointAt(0)}}},At=class{constructor(){this.setIdentity()}getAngle(){return(this.rz==null||this.rz===0&&this.rzCos!==1&&this.rzSin!==0)&&(this.rz=Math.atan2(this.rzSin,this.rzCos)),this.rz}setIdentity(){this.tx=0,this.ty=0,this.tz=0,this.s=1,this.rx=0,this.ry=0,this.rz=0,this.rzCos=1,this.rzSin=0}setTranslate(t,e){this.tx=t,this.ty=e}setTranslateZ(t){this.tz=t}setRotateCS(t,e){this.rz=void 0,this.rzCos=t,this.rzSin=e}setRotate(t){this.rz=t,this.rzCos=void 0,this.rzSin=void 0}setRotateY(t){this.ry=t}setScale(t){this.s=t}setMeasure(t){this.m=t}};function Le(u,t){u[4]=t}let ne=class{constructor(t,e=!0,i=!0,n=0){this.isClosed=!1,this.geometryCursor=null,this.geometryCursor=!e&&t.geometryType==="esriGeometryPolygon"||!i&&t.geometryType==="esriGeometryPolyline"?null:t,this.geomUnitsPerPoint=n,this.iteratePath=!1,this.internalPlacement=new At}next(){if(!this.geometryCursor)return null;for(;this.iteratePath||this.geometryCursor.nextPath();){this.geometryCursor.seekPathStart();const t=this.processPath(this.geometryCursor);if(t)return t}return this.geometryCursor=null,null}},be=class{constructor(t,e,i,n=0){this.isClosed=!1,this.inputGeometries=t,this.acceptPolygon=e,this.acceptPolyline=i,this.geomUnitsPerPoint=n,this.iteratePath=!1,this.multiPathCursor=null}next(){for(;;){if(!this.multiPathCursor){let t=this.inputGeometries.next();for(;t&&(this.isClosed=this.acceptPolygon&&t.geometryType==="esriGeometryPolygon"||t.geometryType==="esriGeometryEnvelope",this.multiPathCursor=t,!this.multiPathCursor);)t=this.inputGeometries.next();if(!this.multiPathCursor)return null}for(;this.iteratePath||this.multiPathCursor.nextPath();){this.multiPathCursor.seekPathStart();const t=this.processPath(this.multiPathCursor);if(t)return t}this.multiPathCursor=null}}};const re=.03;let at=class{constructor(t=0,e=!1){}isEmpty(t){if(!t.nextPoint())return!0;let e,i,n,s;for(e=t.x,i=t.y;t.nextPoint();e=i,i=s)if(n=t.x,s=t.y,n!==e||s!==i)return t.seekPathStart(),!1;return t.seekPathStart(),!0}normalize(t){const e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);e!==0&&(t[0]/=e,t[1]/=e)}getLength(t,e,i,n){const s=i-t,r=n-e;return Math.sqrt(s*s+r*r)}getSegLength(t){const[[e,i],[n,s]]=t;return this.getLength(e,i,n,s)}getCoord2D(t,e,i,n,s){return[t+(i-t)*s,e+(n-e)*s]}getSegCoord2D(t,e){const[[i,n],[s,r]]=t;return this.getCoord2D(i,n,s,r,e)}getAngle(t,e,i,n,s){const r=i-t,o=n-e;return Math.atan2(o,r)}getAngleCS(t,e,i,n,s){const r=i-t,o=n-e,a=Math.sqrt(r*r+o*o);return a>0?[r/a,o/a]:[1,0]}getSegAngleCS(t,e){const[[i,n],[s,r]]=t;return this.getAngleCS(i,n,s,r,e)}cut(t,e,i,n,s,r){return[s<=0?[t,e]:this.getCoord2D(t,e,i,n,s),r>=1?[i,n]:this.getCoord2D(t,e,i,n,r)]}getSubCurve(t,e,i){const n=$.createEmptyOptimizedCIM("esriGeometryPolyline");return this.appendSubCurve(n,t,e,i)?n:null}appendSubCurve(t,e,i,n){t.startPath(),e.seekPathStart();let s=0,r=!0;if(!e.nextPoint())return!1;let o=e.x,a=e.y;for(;e.nextPoint();){const l=this.getLength(o,a,e.x,e.y);if(l!==0){if(r){if(s+l>i){const h=(i-s)/l;let c=1,m=!1;s+l>=n&&(c=(n-s)/l,m=!0);const f=this.cut(o,a,e.x,e.y,h,c);if(f&&t.pushPoints(f),m)break;r=!1}}else{if(s+l>n){const h=this.cut(o,a,e.x,e.y,0,(n-s)/l);h&&t.pushPoint(h[1]);break}t.pushXY(e.x,e.y)}s+=l,o=e.x,a=e.y}else o=e.x,a=e.y}return!0}getCIMPointAlong(t,e){if(!t.nextPoint())return null;let i,n,s,r,o=0;for(i=t.x,n=t.y;t.nextPoint();i=s,n=r){s=t.x,r=t.y;const a=this.getLength(i,n,s,r);if(a!==0){if(o+a>e){const l=(e-o)/a;return this.getCoord2D(i,n,s,r,l)}o+=a}}return null}offset(t,e,i,n,s){if(!t||t.length<2)return null;let r=0,o=t[r++],a=r;for(;r=0==e<=0){if(g<1){const y=[_[0]-p[0],_[1]-p[1]];this.normalize(y);const M=Math.sqrt((1+g)/2);if(M>1/n){const P=-Math.abs(e)/M;h.push([c[0]-y[0]*P,c[1]-y[1]*P])}}}else switch(i){case St.Mitered:{const y=Math.sqrt((1+g)/2);if(y>0&&1/y0){const M=1/y;let P=M;for(let b=1;b0){const s=$.createEmptyOptimizedCIM(t.geometryType),r=De(t)[0],o=this._curveHelper.offset(r,this._size,St.Rounded,4,this._offsetFlattenError);if(o)return s.pushPath(o),s}else if(this._size<0){const s=t.asJSON();if(Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._size>0)return $.fromJSONCIM({xmin:s.xmin-this._size,xmax:s.xmax+this._size,ymin:s.ymin-this._size,ymax:s.ymax+this._size})}}const e=this._geometryEngine;if(e==null)return null;const i=this._tileKey?We(t,this._maxInflateSize):t;if(!i)continue;const n=e.buffer(He.WebMercator,i.asJSON(),this._size,1);return n?$.fromJSONCIM(n):null}return null}},Pi=class Xt{static local(){return Xt.instance===null&&(Xt.instance=new Xt),Xt.instance}execute(t,e,i,n,s){return new Os(t,e,i)}};Pi.instance=null;let Os=class{constructor(t,e,i){this._defaultPointSize=20,this._inputGeometries=t,this._geomUnitsPerPoint=i,this._rule=e.rule??k.FullGeometry,this._defaultSize=this._defaultPointSize*i}next(){let t;for(;t=this._inputGeometries.next();){const e=this._processGeom(De(t));if(e&&e.length)return $.fromJSONCIM({paths:e})}return null}_clone(t){return[t[0],t[1]]}_mid(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}_mix(t,e,i,n){return[t[0]*e+i[0]*n,t[1]*e+i[1]*n]}_add(t,e){return[t[0]+e[0],t[1]+e[1]]}_add2(t,e,i){return[t[0]+e,t[1]+i]}_sub(t,e){return[t[0]-e[0],t[1]-e[1]]}_dist(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}_norm(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}_normalize(t,e=1){const i=e/this._norm(t);t[0]*=i,t[1]*=i}_leftPerpendicular(t){const e=-t[1],i=t[0];t[0]=e,t[1]=i}_leftPerp(t){return[-t[1],t[0]]}_rightPerpendicular(t){const e=t[1],i=-t[0];t[0]=e,t[1]=i}_rightPerp(t){return[t[1],-t[0]]}_dotProduct(t,e){return t[0]*e[0]+t[1]*e[1]}_crossProduct(t,e){return t[0]*e[1]-t[1]*e[0]}_rotateDirect(t,e,i){const n=t[0]*e-t[1]*i,s=t[0]*i+t[1]*e;t[0]=n,t[1]=s}_makeCtrlPt(t){const e=[t[0],t[1]];return Le(e,1),e}_addAngledTicks(t,e,i,n){const s=this._sub(i,e);this._normalize(s);const r=this._crossProduct(s,this._sub(n,e));let o;o=r>0?this._rightPerp(s):this._leftPerp(s);const a=Math.abs(r)/2,l=[];l.push([e[0]+(o[0]-s[0])*a,e[1]+(o[1]-s[1])*a]),l.push(e),l.push(i),l.push([i[0]+(o[0]+s[0])*a,i[1]+(o[1]+s[1])*a]),t.push(l)}_addBezier2(t,e,i,n,s){if(s--==0)return void t.push(n);const r=this._mid(e,i),o=this._mid(i,n),a=this._mid(r,o);this._addBezier2(t,e,r,a,s),this._addBezier2(t,a,o,n,s)}_addBezier3(t,e,i,n,s,r){if(r--==0)return void t.push(s);const o=this._mid(e,i),a=this._mid(i,n),l=this._mid(n,s),h=this._mid(o,a),c=this._mid(a,l),m=this._mid(h,c);this._addBezier3(t,e,o,h,m,r),this._addBezier3(t,m,c,l,s,r)}_add90DegArc(t,e,i,n,s){const r=s??this._crossProduct(this._sub(i,e),this._sub(n,e))>0,o=this._mid(e,i),a=this._sub(o,e);r?this._leftPerpendicular(a):this._rightPerpendicular(a),o[0]+=a[0],o[1]+=a[1],this._addBezier3(t,e,this._mix(e,.33333,o,.66667),this._mix(i,.33333,o,.66667),i,4)}_addArrow(t,e,i){const n=e[0],s=e[1],r=e[e.length-1],o=this._sub(n,s);this._normalize(o);const a=this._crossProduct(o,this._sub(r,s)),l=.5*a,h=this._leftPerp(o),c=[r[0]-h[0]*a,r[1]-h[1]*a],m=e.length-1,f=[];f.push(i?[-h[0],-h[1]]:h);let _=[-o[0],-o[1]];for(let p=1;p0;p--)t.push([e[p][0]+f[p][0]*l,e[p][1]+f[p][1]*l]);t.push([c[0]+f[0][0]*l,c[1]+f[0][1]*l]),t.push([c[0]+f[0][0]*a,c[1]+f[0][1]*a]),t.push(n),t.push([c[0]-f[0][0]*a,c[1]-f[0][1]*a]),t.push([c[0]-f[0][0]*l,c[1]-f[0][1]*l]);for(let p=1;p=2?t[1]:this._add2(t[0],e*this._defaultSize,i*this._defaultSize)}_cp3(t,e,i,n){if(t.length>=3)return t[2];const s=this._mix(t[0],1-i,e,i),r=this._sub(e,t[0]);return this._normalize(r),this._rightPerpendicular(r),[s[0]+r[0]*n*this._defaultSize,s[1]+r[1]*n*this._defaultSize]}_arrowPath(t){if(t.length>2)return t;const e=t[0],i=this._cp2(t,-4,0),n=this._sub(e,i);this._normalize(n);const s=this._rightPerp(n);return[e,i,[e[0]+(s[0]-n[0])*this._defaultSize,e[1]+(s[1]-n[1])*this._defaultSize]]}_arrowLastSeg(t){const e=t[0],i=this._cp2(t,-4,0);let n;if(t.length>=3)n=t[t.length-1];else{const s=this._sub(e,i);this._normalize(s);const r=this._rightPerp(s);n=[e[0]+(r[0]-s[0])*this._defaultSize,e[1]+(r[1]-s[1])*this._defaultSize]}return[i,n]}_processGeom(t){if(!t)return null;const e=[];for(const i of t){if(!i||i.length===0)continue;const n=i.length;let s=i[0];switch(this._rule){case k.PerpendicularFromFirstSegment:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,4),a=[];a.push(o),a.push(this._mid(s,r)),e.push(a);break}case k.ReversedFirstSegment:{const r=this._cp2(i,0,-1);e.push([r,s]);break}case k.PerpendicularToSecondSegment:{const r=this._cp2(i,-4,1),o=this._cp3(i,r,.882353,-1.94),a=[];a.push(this._mid(r,o)),a.push(s),e.push(a);break}case k.SecondSegmentWithTicks:{const r=this._cp2(i,-4,1),o=this._cp3(i,r,.882353,-1.94),a=this._sub(o,r);let l;l=this._crossProduct(a,this._sub(s,r))>0?this._rightPerp(l):this._leftPerp(a);const h=[];h.push([r[0]+(l[0]-a[0])/3,r[1]+(l[1]-a[1])/3]),h.push(r),h.push(o),h.push([o[0]+(l[0]+a[0])/3,o[1]+(l[1]+a[1])/3]),e.push(h);break}case k.DoublePerpendicular:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,3),a=this._mid(s,r),l=this._sub(a,o);this._normalize(l);const h=this._crossProduct(l,this._sub(s,o));this._leftPerpendicular(l);const c=[];c.push(s),c.push([o[0]+l[0]*h,o[1]+l[1]*h]),e.push(c);const m=[];m.push([o[0]-l[0]*h,o[1]-l[1]*h]),m.push(r),e.push(m);break}case k.OppositeToFirstSegment:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,3),a=this._mid(s,r),l=this._sub(a,o);this._normalize(l);const h=this._crossProduct(l,this._sub(s,o));this._leftPerpendicular(l);const c=[];c.push([o[0]+l[0]*h,o[1]+l[1]*h]),c.push([o[0]-l[0]*h,o[1]-l[1]*h]),e.push(c);break}case k.TriplePerpendicular:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,4),a=this._mid(s,r),l=this._sub(a,o);this._normalize(l);const h=this._crossProduct(l,this._sub(s,o));this._leftPerpendicular(l);const c=[];c.push([o[0]+l[0]*h*.8,o[1]+l[1]*h*.8]),c.push([a[0]+.8*(s[0]-a[0]),a[1]+.8*(s[1]-a[1])]),e.push(c),e.push([o,a]);const m=[];m.push([o[0]-l[0]*h*.8,o[1]-l[1]*h*.8]),m.push([a[0]+.8*(r[0]-a[0]),a[1]+.8*(r[1]-a[1])]),e.push(m);break}case k.HalfCircleFirstSegment:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,4),a=this._mid(s,r);let l=this._sub(r,s);const h=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),m=Math.sqrt((1+h)/2),f=Math.sqrt((1-h)/2),_=[];let p;this._crossProduct(l,this._sub(o,s))>0?(_.push(s),l=this._sub(s,a),p=r):(_.push(r),l=this._sub(r,a),p=s),this._rotateDirect(l,m,f),l[0]/=m,l[1]/=m;for(let d=1;d<=18;d++)_.push(this._add(a,l)),this._rotateDirect(l,h,c);_.push(p),e.push(_);break}case k.HalfCircleSecondSegment:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,1,-1);let a=this._sub(s,r);this._normalize(a);const l=this._crossProduct(a,this._sub(o,r))/2;this._leftPerpendicular(a);const h=[r[0]+a[0]*l,r[1]+a[1]*l];a=this._sub(r,h);const c=Math.cos(Math.PI/18);let m=Math.sin(Math.PI/18);l>0&&(m=-m);const f=[r];for(let _=1;_<=18;_++)this._rotateDirect(a,c,m),f.push(this._add(h,a));e.push(f);break}case k.HalfCircleExtended:{const r=this._cp2(i,0,-2),o=this._cp3(i,r,1,-1);let a;if(n>=4)a=i[3];else{const _=this._sub(s,r);a=this._add(o,_)}const l=this._dist(r,o)/2/.75,h=this._sub(r,s);this._normalize(h,l);const c=this._sub(o,a);this._normalize(c,l);const m=[a,o];e.push(m);const f=[this._clone(o)];this._addBezier3(f,o,this._add(o,c),this._add(r,h),r,4),f.push(s),e.push(f);break}case k.OpenCircle:{const r=this._cp2(i,-2,0),o=this._sub(r,s),a=Math.cos(Math.PI/18),l=-Math.sin(Math.PI/18),h=[r];for(let c=1;c<=33;c++)this._rotateDirect(o,a,l),h.push(this._add(s,o));e.push(h);break}case k.CoverageEdgesWithTicks:{const r=this._cp2(i,0,-1);let o,a;if(n>=3)o=i[2];else{const m=this._sub(r,s),f=this._leftPerp(m);o=[s[0]+f[0]-.25*m[0],s[1]+f[1]-.25*m[1]]}if(n>=4)a=i[3];else{const m=this._mid(s,r),f=this._sub(s,r);this._normalize(f),this._leftPerpendicular(f);const _=this._crossProduct(f,this._sub(o,m));this._rightPerpendicular(f),a=[o[0]+f[0]*_*2,o[1]+f[1]*_*2]}const l=this._sub(r,s);let h,c;h=this._crossProduct(l,this._sub(o,s))>0?this._rightPerp(l):this._leftPerp(l),c=[],c.push(o),c.push(s),c.push([s[0]+(h[0]-l[0])/3,s[1]+(h[1]-l[1])/3]),e.push(c),h=this._crossProduct(l,this._sub(a,r))>0?this._rightPerp(h):this._leftPerp(l),c=[],c.push([r[0]+(h[0]+l[0])/3,r[1]+(h[1]+l[1])/3]),c.push(r),c.push(a),e.push(c);break}case k.GapExtentWithDoubleTicks:{const r=this._cp2(i,0,2),o=this._cp3(i,r,0,1);let a;if(n>=4)a=i[3];else{const l=this._sub(r,s);a=this._add(o,l)}this._addAngledTicks(e,s,r,this._mid(o,a)),this._addAngledTicks(e,o,a,this._mid(s,r));break}case k.GapExtentMidline:{const r=this._cp2(i,2,0),o=this._cp3(i,r,0,1);let a;if(n>=4)a=i[3];else{const h=this._sub(r,s);a=this._add(o,h)}const l=[];l.push(this._mid(s,o)),l.push(this._mid(r,a)),e.push(l);break}case k.Chevron:{const r=this._cp2(i,-1,-1);let o;if(n>=3)o=i[2];else{const a=this._sub(r,s);this._leftPerpendicular(a),o=this._add(s,a)}e.push([r,this._makeCtrlPt(s),o]);break}case k.PerpendicularWithArc:{const r=this._cp2(i,0,-2),o=this._cp3(i,r,.5,-1);let a=this._sub(r,s);const l=this._norm(a);a[0]/=l,a[1]/=l;const h=this._crossProduct(a,this._sub(o,s));let c=this._dotProduct(a,this._sub(o,s));c<.05*l?c=.05*l:c>.95*l&&(c=.95*l);const m=[s[0]+a[0]*c,s[1]+a[1]*c];this._leftPerpendicular(a);let f=[];f.push([m[0]-a[0]*h,m[1]-a[1]*h]),f.push([m[0]+a[0]*h,m[1]+a[1]*h]),e.push(f);const _=[r[0]+a[0]*h,r[1]+a[1]*h];a=this._sub(r,_);const p=Math.cos(Math.PI/18);let d=Math.sin(Math.PI/18);h<0&&(d=-d),f=[s,r];for(let g=1;g<=9;g++)this._rotateDirect(a,p,d),f.push(this._add(_,a));e.push(f);break}case k.ClosedHalfCircle:{const r=this._cp2(i,2,0),o=this._mid(s,r),a=this._sub(r,o),l=Math.cos(Math.PI/18),h=Math.sin(Math.PI/18),c=[s,r];for(let m=1;m<=18;m++)this._rotateDirect(a,l,h),c.push(this._add(o,a));e.push(c);break}case k.TripleParallelExtended:{const r=this._cp2(i,0,-2),o=this._cp3(i,r,1,-2),a=this._mid(s,r),l=this._sub(o,r);this._normalize(l);const h=Math.abs(this._crossProduct(l,this._sub(a,r)))/2,c=this._dist(r,o),m=[r,s];m.push([s[0]+l[0]*c*.5,s[1]+l[1]*c*.5]),e.push(m);const f=[];f.push([a[0]-l[0]*h,a[1]-l[1]*h]),f.push([a[0]+l[0]*c*.375,a[1]+l[1]*c*.375]),Le(f[f.length-1],1),f.push([a[0]+l[0]*c*.75,a[1]+l[1]*c*.75]),e.push(f);const _=[r,o];e.push(_);break}case k.ParallelWithTicks:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._sub(o,r);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a),this._addAngledTicks(e,s,r,o),this._addAngledTicks(e,this._mix(s,1,a,l),this._mix(r,1,a,l),this._mid(s,r));break}case k.Parallel:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._sub(r,s);this._normalize(a);const l=this._leftPerp(a),h=this._crossProduct(a,this._sub(o,s));let c=[s,r];e.push(c),c=[],c.push([s[0]+l[0]*h,s[1]+l[1]*h]),c.push([r[0]+l[0]*h,r[1]+l[1]*h]),e.push(c);break}case k.PerpendicularToFirstSegment:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._mid(s,r),l=this._sub(r,s);this._normalize(l);const h=this._crossProduct(l,this._sub(o,s));this._leftPerpendicular(l);const c=[];c.push([a[0]-l[0]*h*.25,a[1]-l[1]*h*.25]),c.push([a[0]+l[0]*h*1.25,a[1]+l[1]*h*1.25]),e.push(c);break}case k.ParallelOffset:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._sub(r,s);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a);const h=[];h.push([s[0]-a[0]*l,s[1]-a[1]*l]),h.push([r[0]-a[0]*l,r[1]-a[1]*l]),e.push(h);const c=[];c.push([s[0]+a[0]*l,s[1]+a[1]*l]),c.push([r[0]+a[0]*l,r[1]+a[1]*l]),e.push(c);break}case k.OffsetOpposite:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._sub(r,s);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a);const h=[];h.push([s[0]-a[0]*l,s[1]-a[1]*l]),h.push([r[0]-a[0]*l,r[1]-a[1]*l]),e.push(h);break}case k.OffsetSame:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._sub(r,s);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a);const h=[];h.push([s[0]+a[0]*l,s[1]+a[1]*l]),h.push([r[0]+a[0]*l,r[1]+a[1]*l]),e.push(h);break}case k.CircleWithArc:{let r=this._cp2(i,3,0);const o=this._cp3(i,r,.5,-1);let a,l;if(n>=4)a=i[3],l=this._crossProduct(this._sub(a,r),this._sub(o,r))>0;else{a=r,l=this._crossProduct(this._sub(a,s),this._sub(o,s))>0;const _=24*this._geomUnitsPerPoint,p=this._sub(a,s);this._normalize(p,_);const d=Math.sqrt(2)/2;this._rotateDirect(p,d,l?d:-d),r=this._add(s,p)}const h=this._sub(r,s),c=Math.cos(Math.PI/18),m=Math.sin(Math.PI/18),f=[r];for(let _=1;_<=36;_++)this._rotateDirect(h,c,m),f.push(this._add(s,h));this._add90DegArc(f,r,a,o,l),Le(f[f.length-8],1),e.push(f);break}case k.DoubleJog:{let r,o,a=this._cp2(i,-3,1);if(r=n>=3?i[2]:this._add(s,this._sub(s,a)),n>=4)o=i[3];else{const g=s;s=a,o=r;const y=this._dist(s,g),M=this._dist(o,g);let P=30*this._geomUnitsPerPoint;.5*y0?this._rotateDirect(p,_,-_):this._rotateDirect(p,_,_);let d=[];d.push(a),d.push(this._add(l,p)),d.push(this._sub(l,p)),d.push(s),e.push(d),p=this._sub(o,r),this._normalize(p,f),this._crossProduct(p,this._sub(s,r))<0?this._rotateDirect(p,_,_):this._rotateDirect(p,_,-_),d=[],d.push(r),d.push(this._add(h,p)),d.push(this._sub(h,p)),d.push(o),e.push(d);break}case k.PerpendicularOffset:{const r=this._cp2(i,-4,1),o=this._cp3(i,r,.882353,-1.94),a=this._sub(o,r);this._crossProduct(a,this._sub(s,r))>0?this._rightPerpendicular(a):this._leftPerpendicular(a);const l=[a[0]/8,a[1]/8],h=this._sub(this._mid(r,o),l);e.push([h,s]);break}case k.LineExcludingLastSegment:{const r=this._arrowPath(i),o=[];let a=r.length-2;for(;a--;)o.push(r[a]);e.push(o);break}case k.MultivertexArrow:{const r=this._arrowPath(i),o=[];this._addArrow(o,r,!1),e.push(o);break}case k.CrossedArrow:{const r=this._arrowPath(i),o=[];this._addArrow(o,r,!0),e.push(o);break}case k.ChevronArrow:{const[r,o]=this._arrowLastSeg(i),a=10*this._geomUnitsPerPoint,l=this._sub(s,r);this._normalize(l);const h=this._crossProduct(l,this._sub(o,r)),c=this._leftPerp(l),m=[o[0]-c[0]*h*2,o[1]-c[1]*h*2],f=[];f.push([o[0]+l[0]*a,o[1]+l[1]*a]),f.push(s),f.push([m[0]+l[0]*a,m[1]+l[1]*a]),e.push(f);break}case k.ChevronArrowOffset:{const[r,o]=this._arrowLastSeg(i),a=this._sub(s,r);this._normalize(a);const l=this._crossProduct(a,this._sub(o,r));this._leftPerpendicular(a);const h=[o[0]-a[0]*l,o[1]-a[1]*l],c=[];c.push([h[0]+a[0]*l*.5,h[1]+a[1]*l*.5]),c.push(this._mid(h,s)),c.push([h[0]-a[0]*l*.5,h[1]-a[1]*l*.5]),e.push(c);break}case k.PartialFirstSegment:{const[r,o]=this._arrowLastSeg(i),a=this._sub(s,r);this._normalize(a);const l=this._crossProduct(a,this._sub(o,r));this._leftPerpendicular(a);const h=[o[0]-a[0]*l,o[1]-a[1]*l];e.push([r,h]);break}case k.Arch:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,1),a=this._sub(s,r),l=this._mix(o,1,a,.55),h=this._mix(o,1,a,-.55),c=[s];this._addBezier2(c,s,l,o,4),this._addBezier2(c,o,h,r,4),e.push(c);break}case k.CurvedParallelTicks:{const r=this._cp2(i,-4,1),o=this._cp3(i,r,.882353,-1.94),a=this._sub(o,r);this._crossProduct(a,this._sub(s,r))>0?this._rightPerpendicular(a):this._leftPerpendicular(a);const l=[a[0]/8,a[1]/8],h=this._sub(this._mid(r,o),l),c=this._sub(this._mix(r,.75,o,.25),l),m=this._sub(this._mix(r,.25,o,.75),l),f=[r];this._addBezier2(f,r,c,h,3),this._addBezier2(f,h,m,o,3),e.push(f);for(let _=0;_<8;_++){const p=f[2*_+1],d=[this._clone(p)];d.push(this._add(p,[a[0]/4,a[1]/4])),e.push(d)}break}case k.Arc90Degrees:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,1),a=[r];this._add90DegArc(a,r,s,o),e.push(a);break}case k.FullGeometry:default:e.push(i)}}return e}},Mi=class Dt{static local(){return Dt.instance===null&&(Dt.instance=new Dt),Dt.instance}execute(t,e,i,n,s){return new As(t,e,i)}};Mi.instance=null;let As=class extends be{constructor(t,e,i){super(t,!0,!0),this._curveHelper=new at,this._beginCut=(e.beginCut!==void 0?e.beginCut:1)*i,this._endCut=(e.endCut!==void 0?e.endCut:1)*i,this._middleCut=(e.middleCut!==void 0?e.middleCut:0)*i,this._invert=e.invert!==void 0&&e.invert,this._beginCut<0&&(this._beginCut=0),this._endCut<0&&(this._endCut=0),this._middleCut<0&&(this._middleCut=0)}processPath(t){const{_beginCut:e,_endCut:i,_middleCut:n}=this,s=t.pathLength(),r=$.createEmptyOptimizedCIM("esriGeometryPolyline");if(this._invert){if(e!==0||i!==0||n!==0)if(e+i+n>=s)for(r.startPath();t.nextPoint();)r.pushXY(t.x,t.y);else this._curveHelper.appendSubCurve(r,t,0,e),this._curveHelper.appendSubCurve(r,t,.5*(s-n),.5*(s+n)),this._curveHelper.appendSubCurve(r,t,s-i,i)}else if(e===0&&i===0&&n===0)for(r.startPath();t.nextPoint();)r.pushXY(t.x,t.y);else e+i+n0&&(s/=this._currentPosition.segmentLength),this._currentPosition.copyTo(e);e.abscissa+t*this._partLengthRatio>e.segmentLength+this._tolerance;){if(i){if(i.pathSize===0)if(s===0){const o=e.segment[0];i.pushXY(o[0],o[1])}else i.pushPoint(this.getSegCoord2D(e.segment,s));const r=e.segment[1];i.pushXY(r[0],r[1])}if(s=0,t-=(e.segmentLength-e.abscissa)/this._partLengthRatio,this._partSegCount)e.segment=this._nextSegment(),e.segmentLength=this.getSegLength(e.segment),e.abscissa=0,this._partSegCount--;else{if(!this._setPosAtNextPart())return n!==ut.FAIL&&(e.segmentLength=this.getSegLength(e.segment),e.isPartEnd=!0,n===ut.END?(e.abscissa=e.segmentLength,e.isPathEnd=!0):e.abscissa=e.segmentLength+t,!0);this._currentPosition.copyTo(e)}}if(e.abscissa+=t*this._partLengthRatio,i){i.pathSize===0&&(s===0?i.pushPoint(e.segment[0]):i.pushPoint(this.getSegCoord2D(e.segment,s)));const r=e.abscissa/e.segmentLength;r===1?i.pushPoint(e.segment[1]):i.pushPoint(this.getSegCoord2D(e.segment,r))}return this._partSegCount||Math.abs(e.abscissa-e.segmentLength)=this._pathCursor.pathSize&&(i=0),this._ctrlPtEnd=this._pathCursor.getControlPointAt(i),this._patternLength>0){const n=this._ctrlPtBegin?this._partCtrlPtGap:this._partExtPtGap,s=this._ctrlPtEnd?this._partCtrlPtGap:this._partExtPtGap;let r=Math.round((this._partLength-(n+s))/this._patternLength);r<=0&&(r=n+s>0?0:1),this._partLengthRatio=this._partLength/(n+s+r*this._patternLength),this._partLengthRatio<.01&&(this._partLengthRatio=1)}else this._partLengthRatio=1;return!0}_hasNextSegment(){return this._seg=e;)n-=e,e=this._pattern.nextValue(),r=!r;e-=n,r?(this._walker.nextPosition(e),e=this._pattern.nextValue()):this.isClosed&&(this._firstCurve=this._walker.nextCurve(e),e=this._pattern.nextValue(),this._walker.nextPosition(e),e=this._pattern.nextValue())}let i=this._walker.nextCurve(e);if(i)if(this._walker.isPathEnd()){if(this.iteratePath=!1,this._firstCurve){for(this._firstCurve.nextPath();this._firstCurve.nextPoint();)i.pushXY(this._firstCurve.x,this._firstCurve.y);this._firstCurve=null}}else e=this._pattern.nextValue(),!this._walker.nextPosition(e)||this._walker.isPathEnd()?(this.iteratePath=!1,this._firstCurve&&(i.pushCursor(this._firstCurve),this._firstCurve=null)):this.iteratePath=!0;else this.iteratePath=!1,i=this._firstCurve,this._firstCurve=null;return i==null||i.reset(),i}},xi=class Yt{static local(){return Yt.instance===null&&(Yt.instance=new Yt),Yt.instance}execute(t,e,i,n,s,r){return new Fs(t,e,i,n,s,r)}};xi.instance=null;let Fs=class{constructor(t,e,i,n,s,r){switch(this._inputGeometries=t,this._tileKey=n,this._geometryEngine=s,this._maxInflateSize=r*i,this._width=(e.width!==void 0?e.width:2)*i,e.method){case Ft.Mitered:case Ft.Bevelled:case Ft.Rounded:case Ft.TrueBuffer:case Ft.Square:}this._option=e.option}next(){let t;for(;t=this._inputGeometries.next();){if(t.geometryType==="esriGeometryEnvelope"&&this._width>0){const e=t.asJSON();return Math.min(e.xmax-e.xmin,e.ymax-e.ymin)-2*this._width<0?t:$.fromJSONCIM({paths:[[[e.xmin+this._width,e.ymin+this._width],[e.xmax-this._width,e.ymin+this._width],[e.xmax-this._width,e.ymax-this._width],[e.xmin+this._width,e.ymax-this._width],[e.xmin+this._width,e.ymin+this._width]],[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]})}if(t.geometryType==="esriGeometryPolygon"){if(this._width===0)return t.clone();const e=this._geometryEngine;if(e==null)return null;const i=this._tileKey?We(t,this._maxInflateSize):t.clone();if(!i)continue;const n=e.buffer(He.WebMercator,i.asJSON(),-this._width,1);if(n)for(const s of n.rings)s&&i.pushPath(s.reverse());return i}}return null}},Si=class Vt{static local(){return Vt.instance===null&&(Vt.instance=new Vt),Vt.instance}execute(t,e,i,n,s){return new Es(t,e,i)}};Si.instance=null;let Es=class extends be{constructor(t,e,i){super(t,!1,!0),this._curveHelper=new at,this._length=(e.length!==void 0?e.length:20)*i,this._angle=e.angle!==void 0?e.angle:225,this._position=e.position!==void 0?e.position:50,this._length<0&&(this._length=-this._length),this._position<20&&(this._position=20),this._position>80&&(this._position=80),this._mirror=!1}processPath(t){const e=$.createEmptyOptimizedCIM("esriGeometryPolyline");if(this._curveHelper.isEmpty(t))return null;t.seekInPath(0);const i=t.x,n=t.y;t.seekInPath(t.pathSize-1);const s=t.x,r=t.y,o=[s-i,r-n];this._curveHelper.normalize(o);const a=i+(s-i)*this._position/100,l=n+(r-n)*this._position/100,h=Math.cos((90-this._angle)/180*Math.PI);let c=Math.sin((90-this._angle)/180*Math.PI);this._mirror&&(c=-c),this._mirror=!this._mirror;const m=[a-this._length/2*h,l-this._length/2*c],f=[a+this._length/2*h,l+this._length/2*c];return e.pushPath([[i,n],m,f,[s,r]]),e}},Ci=class Bt{static local(){return Bt.instance===null&&(Bt.instance=new Bt),Bt.instance}execute(t,e,i,n,s){return new Ns(t,e,i)}};Ci.instance=null;let Ns=class{constructor(t,e,i){this._inputGeometries=t,this._offsetX=e.offsetX!==void 0?e.offsetX*i:0,this._offsetY=e.offsetY!==void 0?e.offsetY*i:0}next(){let t=this._inputGeometries.next();for(;t;){if(t.totalSize>0)return this._move(t.clone(),this._offsetX,this._offsetY);t=this._inputGeometries.next()}return null}_move(t,e,i){for(;t.nextPath();)for(;t.nextPoint();)t.x=t.x+e,t.y=t.y+i;return t.reset(),t}},vi=class Jt{static local(){return Jt.instance===null&&(Jt.instance=new Jt),Jt.instance}execute(t,e,i,n,s,r){return new $s(t,e,i,n,s,r)}};vi.instance=null;let $s=class{constructor(t,e,i,n,s,r){this._inputGeometries=t,this._tileKey=n,this._geometryEngine=s,this._curveHelper=new at,this._offset=(e.offset??1)*i,this._method=e.method,this._maxInflateSize=r*i,this._option=e.option,this._offsetFlattenError=re*i}next(){let t;for(;t=this._inputGeometries.next();){if(this._offset===0)return t.clone();if(t.geometryType==="esriGeometryEnvelope"){if(this._method===St.Rounded&&this._offset>0){const r=wt(t),o=this._curveHelper.offset(r,-this._offset,this._method,4,this._offsetFlattenError);if(o){const a=$.createEmptyOptimizedCIM(t.geometryType);return a.pushPath(o),a}return null}const s=t.asJSON();if(st(s)&&Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._offset>0)return $.fromJSONCIM({xmin:s.xmin-this._offset,xmax:s.xmax+this._offset,ymin:s.ymin-this._offset,ymax:s.ymax+this._offset})}const e=this._geometryEngine;if(e==null)continue;const i=this._tileKey?We(t,this._maxInflateSize):t.clone();if(!i)continue;const n=e.offset(He.WebMercator,i.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return n?$.fromJSONCIM(n):null}return null}},wi=class Wt{static local(){return Wt.instance===null&&(Wt.instance=new Wt),Wt.instance}execute(t,e,i,n,s){return new Gs(t,e,i)}};wi.instance=null;let Gs=class{constructor(t,e,i){this._inputGeometries=t,this._reverse=e.reverse===void 0||e.reverse}next(){let t=this._inputGeometries.next();for(;t;){if(!this._reverse)return t;if(t.geometryType==="esriGeometryPolyline")return Rs(t.clone());t=this._inputGeometries.next()}return null}};function Rs(u){for(;u.nextPath();)for(let t=0;t0){const e=Ye(t),i=(e[2]+e[0])/2,n=(e[3]+e[1])/2;return t.reset(),this._rotate(t.clone(),i,n)}t=this._inputGeometries.next()}return null}_rotate(t,e,i){const n=Math.cos(this._rotateAngle),s=Math.sin(this._rotateAngle);for(;t.nextPath();)for(;t.nextPoint();){const r=t.x-e,o=t.y-i;t.x=e+r*n-o*s,t.y=i+r*s+o*n}return t.reset(),t}},Ii=class qt{static local(){return qt.instance===null&&(qt.instance=new qt),qt.instance}execute(t,e,i,n,s){return new Ds(t,e,i)}};Ii.instance=null;let Ds=class{constructor(t,e,i){this._inputGeometries=t,this._xFactor=e.XScaleFactor!==void 0?e.XScaleFactor:1.15,this._yFactor=e.YScaleFactor!==void 0?e.YScaleFactor:1.15}next(){const t=this._inputGeometries.next();if(t){if(this._xFactor===1&&this._yFactor===1||t.geometryType==="esriGeometryPoint")return t;if(t.totalSize>0){const e=Ye(t),i=(e[2]+e[0])/2,n=(e[3]+e[1])/2;return t.reset(),this._scaleCursor(t.clone(),i,n)}}return null}_scaleCursor(t,e,i){for(;t.nextPath();)for(;t.nextPoint();)t.x=e+(t.x-e)*this._xFactor,t.y=i+(t.y-i)*this._yFactor;return t.reset(),t}},Li=class jt{static local(){return jt.instance===null&&(jt.instance=new jt),jt.instance}execute(t,e,i,n,s){return new Hs(t,e,i)}};Li.instance=null;let Hs=class{constructor(t,e,i){this._inputGeometries=t,this._height=(e.amplitude!==void 0?e.amplitude:2)*i,this._period=(e.period!==void 0?e.period:3)*i,this._style=e.waveform,this._height<=0&&(this._height=Math.abs(this._height)),this._period<=0&&(this._period=Math.abs(this._period)),this._pattern=new xe,this._pattern.addValue(this._period),this._pattern.addValue(this._period),this._walker=new Se,this._walker.updateTolerance(i)}next(){let t=this._inputGeometries.next();for(;t;){if(this._height===0||this._period===0)return t;const e=this._processGeom(t);if(e)return e;t=this._inputGeometries.next()}return null}_processGeom(t){const e=$.createEmptyOptimizedCIM(t.geometryType);for(;t.nextPath();){e.startPath();const i=t.pathLength();if(this._walker.init(t,this._pattern))switch(this._style){case he.Sinus:default:this._constructCurve(e,i,!1);break;case he.Square:this._constructSquare(e,i);break;case he.Triangle:this._constructTriangle(e,i);break;case he.Random:this._constructCurve(e,i,!0)}else for(;t.nextPoint();)e.pushXY(t.x,t.y)}return e}_constructCurve(t,e,i){let n=Math.round(e/this._period);n===0&&(n=1);const s=n*16+1,r=e/n,o=this._period/16,a=1/s,l=2*Math.PI*e/r,h=2*Math.PI*Math.random(),c=2*Math.PI*Math.random(),m=2*Math.PI*Math.random(),f=.75-Math.random()/2,_=.75-Math.random()/2,p=new it;this._walker.curPointAndAngle(p),t.pushPoint(p.pt);let d=0;for(;;){if(!this._walker.nextPointAndAngle(o,p)){t.pushPoint(this._walker.getPathEnd());break}{const g=d;let y;if(d+=a,i){const M=this._height/2*(1+.3*Math.sin(f*l*g+h));y=M*Math.sin(l*g+c),y+=M*Math.sin(_*l*g+m),y/=2}else y=.5*this._height*Math.sin(.5*l*g);t.pushXY(p.pt[0]-y*p.sa,p.pt[1]+y*p.ca)}}}_constructSquare(t,e){Math.round(e/this._period);let i=!0;for(;;){let n=!1;if(this._walker.curPositionIsValid()){const s=new it;this._walker.curPointAndAngle(s);const r=new it;if(this._walker.nextPointAndAngle(this._period,r)){const o=new it;this._walker.nextPointAndAngle(this._period,o)&&(i?(t.pushPoint(s.pt),i=!1):t.pushPoint(s.pt),t.pushXY(s.pt[0]-this._height/2*s.sa,s.pt[1]+this._height/2*s.ca),t.pushXY(r.pt[0]-this._height/2*r.sa,r.pt[1]+this._height/2*r.ca),t.pushXY(r.pt[0]+this._height/2*r.sa,r.pt[1]-this._height/2*r.ca),t.pushXY(o.pt[0]+this._height/2*o.sa,o.pt[1]-this._height/2*o.ca),n=!0)}}if(!n){t.pushPoint(this._walker.getPathEnd());break}}}_constructTriangle(t,e){Math.round(e/this._period);let i=!0;for(;;){let n=!1;if(this._walker.curPositionIsValid()){const s=new it;this._walker.curPointAndAngle(s);const r=new it;if(this._walker.nextPointAndAngle(this._period/2,r)){const o=new it;this._walker.nextPointAndAngle(this._period,o)&&(this._walker.nextPosition(this._period/2)&&(i?(t.pushPoint(s.pt),i=!1):t.pushPoint(s.pt),t.pushXY(r.pt[0]-this._height/2*r.sa,r.pt[1]+this._height/2*r.ca),t.pushXY(o.pt[0]+this._height/2*o.sa,o.pt[1]-this._height/2*o.ca)),n=!0)}}if(!n){t.pushPoint(this._walker.getPathEnd());break}}}},zi=class Kt{static local(){return Kt.instance===null&&(Kt.instance=new Kt),Kt.instance}execute(t,e,i,n,s){return new Ys(t,e,i)}};zi.instance=null;let Ys=class extends ne{constructor(t,e,i){super(t),this._geometryWalker=new Se,this._geometryWalker.updateTolerance(i),this._angleToLine=e.angleToLine??!0,this._offset=(e.offset?e.offset:0)*i,this._originalEndings=e.endings,this._offsetAtEnd=(e.customEndingOffset?e.customEndingOffset:0)*i,this._position=-(e.offsetAlongLine?e.offsetAlongLine:0)*i,this._pattern=new xe,this._pattern.init(e.placementTemplate,!1),this._pattern.scale(i),this._endings=this._originalEndings}processPath(t){if(this._pattern.isEmpty())return null;let e;if(this.iteratePath)e=this._pattern.nextValue();else{this._originalEndings===tt.WithFullGap&&this.isClosed?this._endings=tt.WithMarkers:this._endings=this._originalEndings,this._pattern.extPtGap=0;let n,s=!0;switch(this._endings){case tt.NoConstraint:n=-this._position,n=this._adjustPosition(n),s=!1;break;case tt.WithHalfGap:default:n=-this._pattern.lastValue()/2;break;case tt.WithFullGap:n=-this._pattern.lastValue(),this._pattern.extPtGap=this._pattern.lastValue();break;case tt.WithMarkers:n=0;break;case tt.Custom:n=-this._position,n=this._adjustPosition(n),this._pattern.extPtGap=.5*this._offsetAtEnd}if(!this._geometryWalker.init(t,this._pattern,s))return null;this._pattern.reset();let r=0;for(;n>r;)n-=r,r=this._pattern.nextValue();r-=n,e=r,this.iteratePath=!0}const i=new it;return this._geometryWalker.nextPointAndAngle(e,i)?this._endings===tt.WithFullGap&&this._geometryWalker.isPathEnd()?(this.iteratePath=!1,null):this._endings===tt.WithMarkers&&this._geometryWalker.isPathEnd()&&(this.iteratePath=!1,this.isClosed)?null:(this.internalPlacement.setTranslate(i.pt[0]-this._offset*i.sa,i.pt[1]+this._offset*i.ca),this._angleToLine&&this.internalPlacement.setRotateCS(i.ca,i.sa),this.internalPlacement):(this.iteratePath=!1,null)}_adjustPosition(t){let e=t/this._pattern.length();return e-=Math.floor(e),e*this._pattern.length()}},Oi=class Zt{static local(){return Zt.instance===null&&(Zt.instance=new Zt),Zt.instance}execute(t,e,i,n,s){return new Vs(t,e,i)}};Oi.instance=null;let Vs=class extends ne{constructor(t,e,i){super(t,!1,!0),this._curveHelper=new at,this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._type=e.extremityPlacement,this._position=e.offsetAlongLine!==void 0?e.offsetAlongLine*i:0,this._beginProcessed=!1}processPath(t){let e;switch(this._type){case ft.Both:default:this._beginProcessed?(e=this._atExtremities(t,this._position,!1),this._beginProcessed=!1,this.iteratePath=!1):(e=this._atExtremities(t,this._position,!0),this._beginProcessed=!0,this.iteratePath=!0);break;case ft.JustBegin:e=this._atExtremities(t,this._position,!0);break;case ft.JustEnd:e=this._atExtremities(t,this._position,!1);case ft.None:}return e}_atExtremities(t,e,i){if(i||t.seekPathEnd(),i?t.nextPoint():t.prevPoint()){let n=0,[s,r]=[0,0],[o,a]=[t.x,t.y];for(;i?t.nextPoint():t.prevPoint();){s=o,r=a,o=t.x,a=t.y;const l=this._curveHelper.getLength(s,r,o,a);if(n+l>e){const h=(e-n)/l,[c,m]=this._curveHelper.getAngleCS(s,r,o,a,h),f=this._curveHelper.getCoord2D(s,r,o,a,h);return this.internalPlacement.setTranslate(f[0]-this._offset*m,f[1]+this._offset*c),this._angleToLine&&this.internalPlacement.setRotateCS(-c,-m),this.internalPlacement}n+=l}}return null}},Ai=class Qt{static local(){return Qt.instance===null&&(Qt.instance=new Qt),Qt.instance}execute(t,e,i,n,s){return new Bs(t,e,i)}};Ai.instance=null;let Bs=class extends ne{constructor(t,e,i){super(t),this._walker=new Se,this._walker.updateTolerance(i),this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._beginGap=e.beginPosition!==void 0?e.beginPosition*i:0,this._endGap=e.endPosition!==void 0?e.endPosition*i:0,this._flipFirst=e.flipFirst===void 0||e.flipFirst,this._pattern=new xe,this._pattern.init(e.positionArray,!1,!1),this._subPathLen=0,this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0}processPath(t){if(this._pattern.isEmpty())return null;let e;if(this.iteratePath){const o=this._pattern.nextValue()*this._subPathLen,a=this._beginGap+o;e=a-this._prevPos,this._prevPos=a}else{if(this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0,this._subPathLen=t.pathLength()-this._beginGap-this._endGap,this._subPathLen<0)return this.iteratePath=!1,null;if(!this._walker.init(t,this._pattern,!1))return null;this._pattern.reset();const o=this._pattern.nextValue()*this._subPathLen,a=this._beginGap+o;e=a-this._prevPos,this._prevPos=a,this.iteratePath=!0}const i=new it;if(!this._walker.nextPointAndAngle(e,i,ut.END))return this.iteratePath=!1,null;this.internalPlacement.setTranslate(i.pt[0]-this._offset*i.sa,i.pt[1]+this._offset*i.ca);const n=this._isFirst&&this._flipFirst;let s,r;return this._angleToLine?(s=i.ca,r=i.sa):(s=1,r=0),n&&(s=-s,r=-r),this.internalPlacement.setRotateCS(s,r),this._isFirst=!1,this._posCount--,this._posCount===0&&(this.iteratePath=!1),this.internalPlacement}};const ct=512,Js=10,W=24,ye=1e-6;let Ti=class te{static local(){return te.instance===null&&(te.instance=new te),te.instance}execute(t,e,i,n,s){return new Ws(t,e,i,n,s)}};Ti.instance=null;let Ws=class Pt{constructor(t,e,i,n,s){if(this._xMin=0,this._xMax=0,this._yMin=0,this._yMax=0,this._currentX=0,this._currentY=0,this._accelerationMap=null,this._testInsidePolygon=!1,this._verticalSubdivision=!0,this._stepX=Math.abs(e.stepX??16)*i,this._stepY=Math.abs(e.stepY??16)*i,this._stepX=Math.round(128*this._stepX)/128,this._stepY=Math.round(128*this._stepY)/128,this._stepX!==0&&this._stepY!==0){if(this._gridType=e.gridType??Ce.Fixed,this._gridType===Ce.Random){const r=e.seed??13,o=1;this._randomLCG=new ci(r*o),this._randomness=(e.randomness??100)/100,this._gridAngle=0,this._shiftOddRows=!1,this._cosAngle=1,this._sinAngle=0,this._offsetX=0,this._offsetY=0,this._buildRandomValues()}else{if(this._randomness=0,this._gridAngle=e.gridAngle??0,this._shiftOddRows=e.shiftOddRows??!1,this._offsetX=(e.offsetX??0)*i,this._offsetY=(e.offsetY??0)*i,this._cosAngle=Math.cos(this._gridAngle/180*Math.PI),this._sinAngle=-Math.sin(this._gridAngle/180*Math.PI),this._stepX)if(this._offsetX<0)for(;this._offsetX<-.5*this._stepX;)this._offsetX+=this._stepX;else for(;this._offsetX>=.5*this._stepX;)this._offsetX-=this._stepX;if(this._stepY)if(this._offsetY<0)for(;this._offsetY<-.5*this._stepY;)this._offsetY+=this._stepY;else for(;this._offsetY>=.5*this._stepY;)this._offsetY-=this._stepY}if(this._graphicOriginX=0,this._graphicOriginY=0,n!=null){const[r,o,a,l]=n.split("/"),h=parseFloat(r),c=parseFloat(o),m=parseFloat(a),f=parseFloat(l);this._graphicOriginX=-(f*2**h+m)*ct,this._graphicOriginY=c*ct,this._testInsidePolygon=!0}this._internalPlacement=new At,this._calculateMinMax(t),this._geometryCursor=t}}next(){return this._geometryCursor?this._nextInside():null}_buildRandomValues(){if(!Pt._randValues){Pt._randValues=[];for(let t=0;t=y,this._polygonMin=this._verticalSubdivision?m:_,this._testInsidePolygon){let M=0-this._graphicOriginX-this._offsetX-this._stepX,P=ct-this._graphicOriginX-this._offsetX+this._stepX,b=-ct-this._graphicOriginY-this._offsetY-this._stepY,S=0-this._graphicOriginY-this._offsetY+this._stepY;if(d){const v=[[M,b],[M,S],[P,b],[P,S]];M=b=Number.MAX_VALUE,P=S=-Number.MAX_VALUE;for(const C of v){const I=this._cosAngle*C[0]-this._sinAngle*C[1],L=this._sinAngle*C[0]+this._cosAngle*C[1];M=Math.min(M,I),P=Math.max(P,I),b=Math.min(b,L),S=Math.max(S,L)}}a=a!==Number.MAX_VALUE?Math.max(a,M):M,l=l!==Number.MAX_VALUE?Math.max(l,b):b,h=h!==-Number.MAX_VALUE?Math.min(h,P):P,c=c!==-Number.MAX_VALUE?Math.min(c,S):S}this._xMin=Math.round(a/this._stepX),this._xMax=Math.round(h/this._stepX),this._yMin=Math.round(l/this._stepY),this._yMax=Math.round(c/this._stepY),this._currentX=this._xMax+1,this._currentY=this._yMin-1,this._buildAccelerationMap(t,_,p,m,f)}_buildAccelerationMap(t,e,i,n,s){t.reset();const r=new Map,o=this._verticalSubdivision,a=o?s-n:i-e;let l=Math.ceil(a/Js);if(l<=1)return;const h=Math.floor(a/l);let c,m,f,_,p,d,g,y,M,P,b;for(l++,this._delta=h,o?(M=-ct-this._stepY,P=this._stepY,b=n):(M=-this._stepX,P=ct+this._stepX,b=e);t.nextPath();)if(!(t.pathSize<2)&&t.nextPoint())for(c=t.x,m=t.y;t.nextPoint();c=f,m=_){if(f=t.x,_=t.y,o){if(m===_||mP&&_>P)continue;p=Math.min(m,_),d=Math.max(m,_)}else{if(c===f||cP&&f>P)continue;p=Math.min(c,f),d=Math.max(c,f)}for(;pg&&ei(y,c,m,f,_,r)}this._accelerationMap=r}_nextInside(){for(;;){if(this._currentX>this._xMax){if(this._currentY++,this._currentY>this._yMax)return null;this._currentX=this._xMin,this._shiftOddRows&&this._currentY%2&&this._currentX--}let t=this._currentX*this._stepX+this._offsetX;this._shiftOddRows&&this._currentY%2&&(t+=.5*this._stepX);const e=this._currentY*this._stepY+this._offsetY;let i,n;if(this._currentX++,this._gridType===Ce.Random){const s=(this._currentX%W+W)%W,r=(this._currentY%W+W)%W;i=this._graphicOriginX+t+this._stepX*this._randomness*(.5-Pt._randValues[r*W+s])*2/3,n=this._graphicOriginY+e+this._stepY*this._randomness*(.5-Pt._randValues[r*W+s+1])*2/3}else i=this._graphicOriginX+this._cosAngle*t+this._sinAngle*e,n=this._graphicOriginY-this._sinAngle*t+this._cosAngle*e;if(!this._testInsidePolygon||this._isInsidePolygon(i,n,this._geometryCursor))return this._internalPlacement.setTranslate(i,n),this._internalPlacement}}_isInsidePolygon(t,e,i){if(this._accelerationMap==null)return Us(t,e,i);t+=ye,e+=ye;const n=this._verticalSubdivision,s=n?e:t,r=Math.floor((s-this._polygonMin)/this._delta),o=this._accelerationMap.get(r);if(!o)return!1;let a,l,h,c=0;for(const m of o){if(a=m[0],l=m[1],n){if(a[1]>e==l[1]>e)continue;h=(l[0]-a[0])*(e-a[1])-(l[1]-a[1])*(t-a[0])}else{if(a[0]>t==l[0]>t)continue;h=(l[1]-a[1])*(t-a[0])-(l[0]-a[0])*(e-a[1])}h>0?c++:c--}return c!==0}};function Us(u,t,e){let i,n,s,r,o=0;for(u+=ye,t+=ye,e.reset();e.nextPath();)if(e.nextPoint())for(i=e.x,n=e.y;e.nextPoint();i=s,n=r)s=e.x,r=e.y,n>t!=r>t&&((s-i)*(t-n)-(r-n)*(u-i)>0?o++:o--);return o!==0}function ei(u,t,e,i,n,s){let r=s.get(u);r||(r=[],s.set(u,r)),r.push([[t,e],[i,n]])}const qs=.001;let Fi=class ee{static local(){return ee.instance===null&&(ee.instance=new ee),ee.instance}execute(t,e,i,n,s){return new js(t,e,i)}};Fi.instance=null;let js=class extends ne{constructor(t,e,i){super(t),this._curveHelper=new at,this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._relativeTo=e.relativeTo,this._position=e.startPointOffset!==void 0?e.startPointOffset*i:0,this._epsilon=qs*i}processPath(t){const e=this._position;if(this._relativeTo===Et.SegmentMidpoint){if(this.iteratePath||(this.iteratePath=!0),t.nextPoint()){let[n,s]=[t.x,t.y],[r,o]=[0,0];for(;t.nextPoint();){r=t.x,o=t.y;const a=this._curveHelper.getLength(n,s,r,o);if(an){const m=(n-r)/c,[f,_]=this._curveHelper.getAngleCS(o,a,l,h,m),p=this._curveHelper.getCoord2D(o,a,l,h,m),d=s?-this._offset:this._offset;return this.internalPlacement.setTranslate(p[0]-d*_,p[1]+d*f),this._angleToLine&&(s?this.internalPlacement.setRotateCS(-f,-_):this.internalPlacement.setRotateCS(f,_)),this.internalPlacement}o=l,a=h,r+=c}}return null}};const Ks=1e-15;let Ei=class ie{static local(){return ie.instance===null&&(ie.instance=new ie),ie.instance}execute(t,e,i,n,s){return new Zs(t,e,i)}};Ei.instance=null;let Zs=class extends ne{constructor(t,e,i){super(t),this._curveHelper=new at,this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._endPoints=e.placeOnEndPoints===void 0||e.placeOnEndPoints,this._controlPoints=e.placeOnControlPoints===void 0||e.placeOnControlPoints,this._regularVertices=e.placeOnRegularVertices===void 0||e.placeOnRegularVertices,this._tags=[],this._tagIterator=0}processPath(t){if(this.iteratePath||(this._preparePath(t),this.iteratePath=!0),this._tagIterator>=this._tags.length)return this._tags.length=0,this._tagIterator=0,this.iteratePath=!1,null;const e=this._tags[this._tagIterator];this._angleToLine&&this.internalPlacement.setRotate(e[2]);let i=e[0],n=e[1];if(this._offset!==0){const s=Math.cos(e[2]),r=Math.sin(e[2]);i-=this._offset*r,n+=this._offset*s}return this.internalPlacement.setTranslate(i,n),this._tagIterator++,this.internalPlacement}_preparePath(t){this._tags.length=0,this._tagIterator=0,t.seekPathStart();const e=t.isClosed();let i=0,n=!1,s=0,r=0;if(t.seekPathStart(),t.nextPoint()){let o=t.x,a=t.y,l=t.getControlPoint(),h=!0,c=t.nextPoint();for(;c;){const m=t.x,f=t.y,_=t.getControlPoint();(this._angleToLine||this._offset!==0)&&(s=this._curveHelper.getAngle(o,a,m,f,0)),h?(h=!1,e?(i=s,n=l):(this._endPoints||this._controlPoints&&l)&&this._tags.push([o,a,s])):l?this._controlPoints&&this._tags.push([o,a,me(r,s)]):this._regularVertices&&this._tags.push([o,a,me(r,s)]),(this._angleToLine||this._offset!==0)&&(r=this._curveHelper.getAngle(o,a,m,f,1)),c=t.nextPoint(),c||(e?_||n?this._controlPoints&&this._tags.push([m,f,me(r,i)]):this._regularVertices&&this._tags.push([m,f,me(r,i)]):(this._endPoints||this._controlPoints&&_)&&this._tags.push([m,f,r])),o=m,a=f,l=_}}this._tagIterator=0}};function me(u,t){const e=Math.PI;for(;Math.abs(t-u)>e+2*Ks;)t-u>e?t-=2*e:t+=2*e;return(u+t)/2}let Ni=class se{static local(){return se.instance===null&&(se.instance=new se),se.instance}execute(t,e,i,n,s){return new Qs(t,e,i)}};Ni.instance=null;let Qs=class{constructor(t,e,i){this._geometryCursor=t,this._offsetX=e.offsetX!==void 0?e.offsetX*i:0,this._offsetY=e.offsetY!==void 0?e.offsetY*i:0,this._method=e.method!==void 0?e.method:ce.OnPolygon,this._internalPlacement=new At}next(){const t=this._geometryCursor;return this._geometryCursor=null,t?this._polygonCenter(t):null}_polygonCenter(t){let e=!1;switch(this._method){case ce.CenterOfMass:{const i=Bi(t);i&&(this._internalPlacement.setTranslate(i[0]+this._offsetX,i[1]+this._offsetY),e=!0)}break;case ce.BoundingBoxCenter:{const i=Ye(t);i&&(this._internalPlacement.setTranslate((i[2]+i[0])/2+this._offsetX,(i[3]+i[1])/2+this._offsetY),e=!0)}break;case ce.OnPolygon:default:{const i=Ms(t);i!==null&&(this._internalPlacement.setTranslate(i[0]+this._offsetX,i[1]+this._offsetY),e=!0)}}return e?this._internalPlacement:null}};function Re(u){if(!u)return null;switch(u.type){case"CIMGeometricEffectAddControlPoints":return gi.local();case"CIMGeometricEffectArrow":return vt.local();case"CIMGeometricEffectBuffer":return yi.local();case"CIMGeometricEffectControlMeasureLine":return Pi.local();case"CIMGeometricEffectCut":return Mi.local();case"CIMGeometricEffectDashes":return bi.local();case"CIMGeometricEffectDonut":return xi.local();case"CIMGeometricEffectJog":return Si.local();case"CIMGeometricEffectMove":return Ci.local();case"CIMGeometricEffectOffset":return vi.local();case"CIMGeometricEffectReverse":return wi.local();case"CIMGeometricEffectRotate":return ki.local();case"CIMGeometricEffectScale":return Ii.local();case"CIMGeometricEffectWave":return Li.local()}return null}function tr(u){if(!u)return null;switch(u.type){case"CIMMarkerPlacementAlongLineSameSize":return zi.local();case"CIMMarkerPlacementAtExtremities":return Oi.local();case"CIMMarkerPlacementAtRatioPositions":return Ai.local();case"CIMMarkerPlacementInsidePolygon":return Ti.local();case"CIMMarkerPlacementOnLine":return Fi.local();case"CIMMarkerPlacementOnVertices":return Ei.local();case"CIMMarkerPlacementPolygonCenter":return Ni.local()}return null}function Oe(u){const t=u.getFrame(0);if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)return t;const e=document.createElement("canvas");e.width=u.width,e.height=u.height;const i=e.getContext("2d");return t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0),e}let $i=class{constructor(t=0,e=0,i=0,n=0){this.x=t,this.y=e,this.width=i,this.height=n}get isEmpty(){return this.width<=0||this.height<=0}union(t){this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.width=Math.max(this.width,t.width),this.height=Math.max(this.height,t.height)}};function er(u){return`rgb(${u.slice(0,3).toString()})`}function Ae(u){return`rgba(${u.slice(0,3).toString()},${u[3]})`}let Gi=class{constructor(t){t&&(this._textRasterizationCanvas=t)}rasterizeText(t,e){var A,R;this._textRasterizationCanvas||(this._textRasterizationCanvas=document.createElement("canvas"));const i=this._textRasterizationCanvas,n=i.getContext("2d");this._setFontProperties(n,e),this._parameters=e,this._textLines=t.split(/\r?\n/),this._lineHeight=this._computeLineHeight();const{decoration:s,weight:r}=e.font;this._lineThroughWidthOffset=s&&s==="line-through"?.1*this._lineHeight:0;const o=e.backgroundColor!=null||e.borderLine!=null,a=o?Ji:0,l=this._computeTextWidth(n,e)+2*a,h=this._lineHeight*this._textLines.length+2*a;if(i.width=l+2*this._lineThroughWidthOffset,i.height=h,i.width===0||i.height===0)return i.width=i.height=1,{size:[0,0],image:new Uint32Array(0),sdf:!1,simplePattern:!1,anchorX:0,anchorY:0,canvas:i};this._renderedLineHeight=Math.round(this._lineHeight*e.pixelRatio),this._renderedHaloSize=rt(e.halo.size)*e.pixelRatio,this._renderedWidth=l*e.pixelRatio,this._renderedHeight=h*e.pixelRatio,this._lineThroughWidthOffset*=e.pixelRatio;const c=e.color??[0,0,0,0],m=e.halo&&e.halo.color?e.halo.color:[0,0,0,0];this._fillStyle=Ae(c),this._haloStyle=er(m);const f=this._renderedLineHeight,_=this._renderedHaloSize;n.save(),n.clearRect(0,0,i.width,i.height),this._setFontProperties(n,e);const p=a*e.pixelRatio,d=ir(n.textAlign,this._renderedWidth-2*p)+_+p,g=_+p,y=_>0;let M=this._lineThroughWidthOffset,P=0;if(o){n.save();const z=e.backgroundColor??[0,0,0,0],E=((A=e.borderLine)==null?void 0:A.color)??[0,0,0,0],V=2*rt(((R=e.borderLine)==null?void 0:R.size)??0);n.fillStyle=Ae(z),n.strokeStyle=Ae(E),n.lineWidth=V,n.fillRect(0,0,i.width,i.height),n.strokeRect(0,0,i.width,i.height),n.restore()}y&&this._renderHalo(n,d,g,M,P,e),P+=g,M+=d;for(const z of this._textLines)y?(n.globalCompositeOperation="destination-out",n.fillStyle="rgb(0, 0, 0)",n.fillText(z,M,P),n.globalCompositeOperation="source-over",n.fillStyle=this._fillStyle,n.fillText(z,M,P)):(n.fillStyle=this._fillStyle,n.fillText(z,M,P)),s&&s!=="none"&&this._renderDecoration(n,M,P,s,r),P+=f;n.restore();const b=this._renderedWidth+2*this._lineThroughWidthOffset,S=this._renderedHeight,v=n.getImageData(0,0,b,S),C=new Uint8Array(v.data);if(e.premultiplyColors){let z;for(let E=0;E600)&&(i+=.3*t.measureText("w").width),i+=2*rt(this._parameters.halo.size),Math.round(i)}_computeLineHeight(){let t=1.275*this._parameters.size;const e=this._parameters.font.decoration;return e&&e==="underline"&&(t*=1.3),Math.round(t+2*rt(this._parameters.halo.size))}_renderDecoration(t,e,i,n,s,r){const o=.9*this._lineHeight,a=s==="bold"?.06:s==="bolder"?.09:.04;switch(t.textAlign){case"center":e-=this._renderedWidth/2;break;case"right":e-=this._renderedWidth}const l=t.textBaseline;if(n==="underline")switch(l){case"top":i+=o;break;case"middle":i+=o/2}else if(n==="line-through")switch(l){case"top":i+=o/1.5;break;case"middle":i+=o/3}const h=r?1.5*r:Math.ceil(o*a);t.save(),t.beginPath(),t.strokeStyle=t.fillStyle,t.lineWidth=h,t.moveTo(e-this._lineThroughWidthOffset,i),t.lineTo(e+this._renderedWidth+2*this._lineThroughWidthOffset,i),t.stroke(),t.restore()}};function ir(u,t){return u==="center"?.5*t:u==="right"?t:0}var N,G;function xn(u){switch(u){case"left":return N.Left;case"right":return N.Right;case"center":return N.Center}}function Sn(u){switch(u){case"top":return G.Top;case"middle":return G.Center;case"baseline":return G.Baseline;case"bottom":return G.Bottom}}function Cn(u){switch(u){case"above-left":case"esriServerPointLabelPlacementAboveLeft":return[N.Right,G.Bottom];case"above-center":case"above-along":case"esriServerPointLabelPlacementAboveCenter":case"esriServerLinePlacementAboveAlong":return[N.Center,G.Bottom];case"above-right":case"esriServerPointLabelPlacementAboveRight":return[N.Left,G.Bottom];case"center-left":case"esriServerPointLabelPlacementCenterLeft":return[N.Right,G.Center];case"center-center":case"center-along":case"esriServerPointLabelPlacementCenterCenter":case"esriServerLinePlacementCenterAlong":case"always-horizontal":case"esriServerPolygonPlacementAlwaysHorizontal":return[N.Center,G.Center];case"center-right":case"esriServerPointLabelPlacementCenterRight":return[N.Left,G.Center];case"below-left":case"esriServerPointLabelPlacementBelowLeft":return[N.Right,G.Top];case"below-center":case"below-along":case"esriServerPointLabelPlacementBelowCenter":case"esriServerLinePlacementBelowAlong":return[N.Center,G.Top];case"below-right":case"esriServerPointLabelPlacementBelowRight":return[N.Left,G.Top];default:return console.debug(`Found invalid placement type ${u}`),[N.Center,G.Center]}}function vn(u){switch(u){case N.Right:return-1;case N.Center:return 0;case N.Left:return 1;default:return console.debug(`Found invalid horizontal alignment ${u}`),0}}function wn(u){switch(u){case G.Top:return 1;case G.Center:return 0;case G.Bottom:case G.Baseline:return-1;default:return console.debug(`Found invalid vertical alignment ${u}`),0}}function kn(u){switch(u){case"left":return N.Left;case"right":return N.Right;case"center":return N.Center}}function In(u){switch(u){case"above-along":case"below-along":case"center-along":case"esriServerLinePlacementAboveAlong":case"esriServerLinePlacementBelowAlong":case"esriServerLinePlacementCenterAlong":return!0;default:return!1}}(function(u){u[u.Left=-1]="Left",u[u.Center=0]="Center",u[u.Right=1]="Right"})(N||(N={})),function(u){u[u.Top=1]="Top",u[u.Center=0]="Center",u[u.Bottom=-1]="Bottom",u[u.Baseline=2]="Baseline"}(G||(G={}));const yt=Math.PI/180,sr=Ve.getLogger("esri.symbols.cim.CIMSymbolDrawHelper"),zt=4,Pe=10,rr=10,Ue=4,Ri=10;let Mt=class q{constructor(t){this._t=t}static createIdentity(){return new q([1,0,0,0,1,0])}clone(){const t=this._t;return new q(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new q([t,0,0,0,e,0])}scale(t,e){const i=this._t;return i[0]*=t,i[1]*=t,i[2]*=t,i[3]*=e,i[4]*=e,i[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new q([0,0,t,0,0,e])}translate(t,e){const i=this._t;return i[2]+=t,i[5]+=e,this}static createRotate(t){const e=Math.cos(t),i=Math.sin(t);return new q([e,-i,0,i,e,0])}rotate(t){return q.multiply(this,q.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],i=Math.sqrt(t*t+e*e);return[t/i,e/i]}static multiply(t,e,i){const n=t._t,s=e._t,r=n[0]*s[0]+n[3]*s[1],o=n[1]*s[0]+n[4]*s[1],a=n[2]*s[0]+n[5]*s[1]+s[2],l=n[0]*s[3]+n[3]*s[4],h=n[1]*s[3]+n[4]*s[4],c=n[2]*s[3]+n[5]*s[4]+s[5],m=i._t;return m[0]=r,m[1]=o,m[2]=a,m[3]=l,m[4]=h,m[5]=c,i}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(e===0)return new q([0,0,0,0,0,0]);e=1/e;const i=(t[1]*t[5]-t[2]*t[4])*e,n=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,r=-t[1]*e,o=-t[3]*e,a=t[0]*e;return new q([s,r,i,o,a,n])}},Xi=class{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new ji(At,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||Mt.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1)}setTransform(t,e){this._transfos=[t||Mt.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e){const i=e?t.scaleRatio():1;Mt.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*i)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1)}drawSymbol(t,e,i){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,i)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const i=t.symbolLayers;if(!i)return;const n=t.effects;if(n&&n.length>0){const s=this.executeEffects(n,e);if(s){let r=s.next();for(;r;)this.drawSymbolLayers(i,r.asJSON()),r=s.next()}}else this.drawSymbolLayers(i,e)}executeEffects(t,e){const i=this._resourceManager.geometryEngine;let n=new Ge($.fromJSONCIM(e));for(const s of t){const r=Re(s);r&&(n=r.execute(n,s,this.geomUnitsPerPoint(),null,i))}return n}drawSymbolLayers(t,e){let i=t.length;for(;i--;){const n=t[i];if(!n||n.enable===!1)continue;const s=n.effects;if(s&&s.length>0){const r=this.executeEffects(s,e);if(r){let o=null;for(;(o=r.next())&&(this.drawSymbolLayer(n,o.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(n,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const i=this._buildHatchPolyline(e,t,this.geomUnitsPerPoint());i&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,i),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const i=t.markerPlacement;if(i){const n=tr(i);if(n){const s=i.type==="CIMMarkerPlacementInsidePolygon"||i.type==="CIMMarkerPlacementPolygonCenter"&&i.clipAtBoundary;s&&this.pushClipPath(e);const r=n.execute($.fromJSONCIM(e),i,this.geomUnitsPerPoint(),null,this._resourceManager.geometryEngine);if(r){let o=null;for(;(o=r.next())&&(this.drawMarker(t,o),!this._earlyReturn););}s&&this.popClipPath()}}else{const n=this._placementPool.acquire();if(qe(e))n.tx=e.x,n.ty=e.y,this.drawMarker(t,n);else if(nt(e)){const s=Ki(e);s&&([n.tx,n.ty]=s,this.drawMarker(t,n))}else for(const s of e.points)if(n.tx=s[0],n.ty=s[1],this.drawMarker(t,n),this._earlyReturn)break;this._placementPool.release(n)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const i=this._resourceManager.getResource(t.url),n=x(t.size,Pe);if(i==null||n<=0)return;const s=i.width,r=i.height;if(!s||!r)return;const o=s/r,a=x(t.scaleX,1),l=Mt.createIdentity(),h=t.anchorPoint;if(h){let d=h.x,g=h.y;t.anchorPointUnits!=="Absolute"&&(d*=n*o*a,g*=n),l.translate(-d,-g)}let c=x(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*yt);let m=x(t.offsetX),f=x(t.offsetY);if(m||f){if(this._mapRotation){const d=yt*this._mapRotation,g=Math.cos(d),y=Math.sin(d),M=m*y+f*g;m=m*g-f*y,f=M}l.translate(m,f)}const _=this.geomUnitsPerPoint();_!==1&&l.scale(_,_);const p=e.getAngle();p&&l.rotate(p),l.translate(e.tx,e.ty),this.push(l,!1),this.drawImage(t,n),this.pop()}drawVectorMarker(t,e){if(!t)return;const i=t.markerGraphics;if(!i)return;const n=x(t.size,Pe),s=t.frame,r=s?s.ymax-s.ymin:0,o=n&&r?n/r:1,a=Mt.createIdentity();s&&a.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let p=l.x,d=l.y;t.anchorPointUnits!=="Absolute"?s&&(p*=s.xmax-s.xmin,d*=s.ymax-s.ymin):(p/=o,d/=o),a.translate(-p,-d)}o!==1&&a.scale(o,o);let h=x(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&a.rotate(h*yt);let c=x(t.offsetX),m=x(t.offsetY);if(c||m){if(this._mapRotation){const p=yt*this._mapRotation,d=Math.cos(p),g=Math.sin(p),y=c*g+m*d;c=c*d-m*g,m=y}a.translate(c,m)}const f=this.geomUnitsPerPoint();f!==1&&a.scale(f,f);const _=e.getAngle();_&&a.rotate(_),a.translate(e.tx,e.ty),this.push(a,t.scaleSymbolsProportionally);for(const p of i)if(p!=null&&p.symbol&&p.geometry||sr.error("Invalid marker graphic",p),this.drawSymbol(p.symbol,p.geometry,p.textString),this._earlyReturn)break;this.pop()}drawTextSymbol(t,e,i){if(!t||!qe(e)||x(t.height,Ri)<=0)return;const n=Mt.createIdentity();let s=x(t.angle);s=-s,s&&n.rotate(s*yt);const r=x(t.offsetX),o=x(t.offsetY);(r||o)&&n.translate(r,o);const a=this.geomUnitsPerPoint();a!==1&&n.scale(a,a),n.translate(e.x,e.y),this.push(n,!1),this.drawText(t,i),this.pop()}_buildHatchPolyline(t,e,i){let n=x(t.separation,Ue)*i,s=x(t.rotation);if(n===0)return null;n<0&&(n=-n);let r=0;const o=.5*n;for(;r>o;)r-=n;for(;r<-o;)r+=n;const a=Zi();Qi(a,e),a[0]-=o,a[1]-=o,a[2]+=o,a[3]+=o;const l=[[a[0],a[1]],[a[0],a[3]],[a[2],a[3]],[a[2],a[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const h=Math.cos(s*yt),c=Math.sin(s*yt),m=-n*c,f=n*h;let _,p,d,g;r=x(t.offsetX)*i*c-x(t.offsetY)*i*h,_=d=Number.MAX_VALUE,p=g=-Number.MAX_VALUE;for(const C of l){const I=C[0],L=C[1],A=h*I+c*L,R=-c*I+h*L;_=Math.min(_,A),d=Math.min(d,R),p=Math.max(p,A),g=Math.max(g,R)}d=Math.floor(d/n)*n;let y=h*_-c*d-m*r/n,M=c*_+h*d-f*r/n,P=h*p-c*d-m*r/n,b=c*p+h*d-f*r/n;const S=1+Math.round((g-d)/n),v=[];for(let C=0;C0))if(nt(t))this._processPath(t.rings,0);else if(bt(t))this._processPath(t.paths,0);else if(st(t)){const e=xt(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,i){if(!t||this._clipCount>0)return;const n=.5*this.transformSize(x(i,zt));if(nt(t))this._processPath(t.rings,n);else if(bt(t))this._processPath(t.paths,n);else if(st(t)){const s=xt(t);s&&this._processPath(s.rings,n)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){nt(e)&&t.markerPlacement&&(t.markerPlacement.type==="CIMMarkerPlacementInsidePolygon"||t.markerPlacement.type==="CIMMarkerPlacementPolygonCenter"&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:i}=t,n=x(t.scaleX,1);let s=n*e,r=e;const o=this._resourceManager.getResource(i);e||o==null||(s=n*o.width,r=o.height),this._merge(this.transformPt([-s/2,-r/2]),0),this._merge(this.transformPt([-s/2,r/2]),0),this._merge(this.transformPt([s/2,-r/2]),0),this._merge(this.transformPt([s/2,r/2]),0)}drawText(t,e){if(!e||e.length===0)return;this._textRasterizer||(this._textRasterizer=new Gi);const i=Di(t),[n,s]=this._textRasterizer.computeTextSize(e,i);let r=0;switch(t.horizontalAlignment){case"Left":r=n/2;break;case"Right":r=-n/2}let o=0;switch(t.verticalAlignment){case"Bottom":o=s/2;break;case"Top":o=-s/2;break;case"Baseline":o=s/6}this._merge(this.transformPt([-n/2+r,-s/2+o]),0),this._merge(this.transformPt([-n/2+r,s/2+o]),0),this._merge(this.transformPt([n/2+r,-s/2+o]),0),this._merge(this.transformPt([n/2+r,s/2+o]),0)}_processPath(t,e){if(t)for(const i of t){const n=i?i.length:0;if(n>1){this._merge(this.transformPt(i[0]),e);for(let s=1;sthis._xmax&&(this._xmax=t[0]+e),t[1]-ethis._ymax&&(this._ymax=t[1]+e)}};class or extends Xi{constructor(t,e,i,n){super(e,i),this._applyAdditionalRenderProps=n,this._colorSubstitutionHelper=new vs,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(nt(t))this._buildPath(t.rings,!0);else if(bt(t))this._buildPath(t.paths,!0);else if(st(t))this._buildPath(xt(t).rings,!0);else{if(!ve(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const i=this._ctx;i.fillStyle=typeof e=="string"?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",i.fill("evenodd")}drawSolidStroke(t,e,i,n,s,r){if(!t||!e||i===0)return;if(nt(t))this._buildPath(t.rings,!0);else if(bt(t))this._buildPath(t.paths,!1);else{if(!st(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(xt(t).rings,!0)}const o=this._ctx;o.strokeStyle=typeof e=="string"?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",o.lineWidth=Math.max(this.transformSize(i),.5),this._setCapStyle(n),this._setJoinStyle(s),o.miterLimit=r,o.stroke()}pushClipPath(t){if(this._ctx.save(),nt(t))this._buildPath(t.rings,!0);else if(bt(t))this._buildPath(t.paths,!0);else{if(!st(t))return;this._buildPath(xt(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:i,url:n,tintColor:s}=t,r=x(t.scaleX,1),o=this._resourceManager.getResource(n);if(o==null)return;let a=e*(o.width/o.height),l=e;e||(a=o.width,l=o.height);const h=It(n)||"src"in o&&It(o.src);let c="getFrame"in o?Oe(o):o;i&&(c=this._colorSubstitutionHelper.applyColorSubstituition(c,i)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,_]=this.getTransformAngle(),p=this.transformSize(1),d=this._ctx;d.save(),d.setTransform({m11:r*p*f,m12:r*p*_,m21:-p*_,m22:p*f,m41:m[0],m42:m[1]}),d.drawImage(c,-a/2,-l/2,a,l),d.restore()}drawText(t,e){if(!e||e.length===0)return;this._textRasterizer||(this._textRasterizer=new Gi);const i=Di(t);i.size*=this.transformSize(Ot(1));const n=this._textRasterizer.rasterizeText(e,i);if(!n)return;const{size:s,anchorX:r,anchorY:o,canvas:a}=n,l=s[0]*(r+.5),h=s[1]*(o-.5),c=this._ctx,m=this.transformPt([0,0]),[f,_]=this.getTransformAngle(),p=1;c.save(),c.setTransform({m11:p*f,m12:p*_,m21:-p*_,m22:p*f,m41:m[0]-p*l,m42:m[1]+p*h}),c.drawImage(a,0,0),c.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:i,height:n,offsetX:s,offsetY:r,rotation:o,scaleX:a,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(c==null)return;if(nt(t))this._buildPath(t.rings,!0);else if(bt(t))this._buildPath(t.paths,!0);else if(st(t))this._buildPath(xt(t).rings,!0);else{if(!ve(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=It(h)||"src"in c&&It(c.src);let _,p="getFrame"in c?Oe(c):c;if(i&&(p=this._colorSubstitutionHelper.applyColorSubstituition(p,i)),this._applyAdditionalRenderProps){f||l&&(p=this._colorSubstitutionHelper.tintImageData(p,l)),_=m.createPattern(p,"repeat");const d=this.transformSize(1);o||(o=0),s?s*=d:s=0,r?r*=d:r=0,n&&(n*=d);const g=n?n/c.height:1,y=a&&n?a*n/c.width:1;if(o!==0||g!==1||y!==1||s!==0||r!==0){const M=new DOMMatrix;M.rotateSelf(0,0,-o).translateSelf(s,r).scaleSelf(y,g,1),_.setTransform(M)}}else _=m.createPattern(p,"repeat");m.save(),m.fillStyle=_,m.fill("evenodd"),m.restore()}drawPictureStroke(t,e){if(!t)return;let{colorSubstitutions:i,capStyle:n,joinStyle:s,miterLimit:r,tintColor:o,url:a,width:l}=e;const h=this._resourceManager.getResource(a);if(h==null)return;let c;if(nt(t))c=t.rings;else if(bt(t))c=t.paths;else{if(!st(t))return ve(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;c=xt(t).rings}l||(l=h.width);const m=It(a)||"src"in h&&It(h.src);let f="getFrame"in h?Oe(h):h;i&&(f=this._colorSubstitutionHelper.applyColorSubstituition(f,i)),this._applyAdditionalRenderProps&&(m||o&&(f=this._colorSubstitutionHelper.tintImageData(f,o)));const _=Math.max(this.transformSize(rt(l)),.5),p=_/f.width,d=this._ctx,g=d.createPattern(f,"repeat-y");let y,M;d.save(),this._setCapStyle(n),this._setJoinStyle(s),r!==void 0&&(d.miterLimit=r),d.lineWidth=_;for(let P of c)if(P=ot(P),hr(P),P&&!(P.length<=1)){y=this.transformPt(P[0]);for(let b=1;b1){let r=this.transformPt(n[0]);i.moveTo(r[0],r[1]);for(let o=1;ou?{spatialReference:u.spatialReference,rings:[[[u.xmin,u.ymin],[u.xmin,u.ymax],[u.xmax,u.ymax],[u.xmax,u.ymin],[u.xmin,u.ymin]]]}:null;function Di(u,t=1){var g;const e=Be(u),i=Je(u.fontStyleName),n=u.fontFamilyName??Wi,{weight:s,style:r}=i,o=t*(u.height||5),a=ui(u.horizontalAlignment),l=fi(u.verticalAlignment),h=Ct(u),c=Ct(u.haloSymbol),m=c?t*(0|u.haloSize):0,f=((g=u.callout)==null?void 0:g.type)==="CIMBackgroundCallout"?u.callout.backgroundSymbol:null,_=Ct(f),p=$e(f),d=_e(f);return{color:h,size:o,horizontalAlignment:a,verticalAlignment:l,font:{family:n,style:Ui(r),weight:qi(s),decoration:e},halo:{size:m||0,color:c,style:r},backgroundColor:_,borderLine:p!=null&&d!=null?{size:p,color:d}:null,pixelRatio:1,premultiplyColors:!0}}const lr=1e-4;function hr(u){let t,e,i,n,s,r=u[0],o=1;for(;oh.width&&h.width>0?_*h.width:_),lineDashEnding:m,controlPointEnding:D.FullPattern}]:void 0;r.push({type:"CIMSolidStroke",capStyle:c?j.Round:j.Butt,enable:!0,width:h.width!=null&&h.width>.667?rt(Math.round(Ot(h.width))):h.width,color:Y(h.color),effects:f})}else!e||t.type!=="line-marker"||t.style!=="cross"&&t.style!=="x"?[o,a]=$t(n):([o,a]=$t(n),r.push({type:"CIMSolidStroke",enable:!0,width:e,color:Y(s)}));r.push({type:"CIMSolidFill",enable:!0,color:Y(s)});const l={type:"CIMPolygonSymbol",symbolLayers:r};return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:x(-t.angle),size:x(t.size||6*e),offsetX:x(t.xoffset),offsetY:x(t.yoffset),frame:o,markerGraphics:[{type:"CIMMarkerGraphic",geometry:a,symbol:l}]}]}}static fromCIMHatchFill(t,e){var a;const i=e*(t.separation??Ue),n=i/2,s=ot(t.lineSymbol);(a=s.symbolLayers)==null||a.forEach(l=>{var h;switch(l.type){case"CIMSolidStroke":l.width!=null&&(l.width*=e),(h=l.effects)==null||h.forEach(c=>{c.type==="CIMGeometricEffectDashes"&&(c.dashTemplate=c.dashTemplate.map(m=>m*e))});break;case"CIMVectorMarker":{l.size!=null&&(l.size*=e);const c=l.markerPlacement;c!=null&&"placementTemplate"in c&&(c.placementTemplate=c.placementTemplate.map(m=>m*e));break}}});let r=this._getLineSymbolPeriod(s)||ii;for(;r{Me.error(`Unsupported font ${n} in CIM symbol`)}))}}}static _getLineSymbolPeriod(t){if(t){const e=this._getEffectsRepeat(t.effects);if(e)return e;if(t.symbolLayers){for(const i of t.symbolLayers)if(i){const n=this._getEffectsRepeat(i.effects);if(n)return n;switch(i.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const s=this._getPlacementRepeat(i.markerPlacement);if(s)return s}}}}}return 0}static _getEffectsRepeat(t){if(t){for(const e of t)if(e)switch(e.type){case"CIMGeometricEffectDashes":{const i=e.dashTemplate;if(i&&i.length){let n=0;for(const s of i)n+=s;return 1&i.length&&(n*=2),n}break}case"CIMGeometricEffectWave":return e.period;default:Me.error(`unsupported geometric effect type ${e.type}`)}}return 0}static _getPlacementRepeat(t){if(t)switch(t.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAlongLineVariableSize":{const e=t.placementTemplate;if(e&&e.length){let i=0;for(const n of e)i+=+n;return 1&e.length&&(i*=2),i}break}}return 0}static fromCIMInsidePolygon(t){const e=t.markerPlacement,i={...t};i.markerPlacement=null,i.anchorPoint=null;const n=Math.abs(e.stepX),s=Math.abs(e.stepY),r=(e.randomness??100)/100;let o,a,l,h;if(e.gridType==="Random"){const c=Ot(_i),m=Math.max(Math.floor(c/n),1),f=Math.max(Math.floor(c/s),1);o=m*n/2,a=f*s/2,l=2*a;const _=new ci(e.seed),p=r*n/1.5,d=r*s/1.5;h=[];for(let g=0;g({type:"CIMMarkerGraphic",geometry:c,symbol:{type:"CIMPointSymbol",symbolLayers:[i]}})),size:l}}static getSize(t){if(t)switch(t.type){case"CIMTextSymbol":return t.height;case"CIMPointSymbol":{let e=0;if(t.symbolLayers){for(const i of t.symbolLayers)if(i)switch(i.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const n=i.size;n!=null&&n>e&&(e=n);break}}}return e}case"CIMLineSymbol":case"CIMPolygonSymbol":{let e=0;if(t.symbolLayers){for(const i of t.symbolLayers)if(i)switch(i.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const n=i.width;n!=null&&n>e&&(e=n);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(i.markerPlacement&&hs(i.markerPlacement)){const n=i.size;n!=null&&n>e&&(e=n)}}}return e}}}static getMarkerScaleRatio(t){if(t&&t.type==="CIMVectorMarker"&&t.scaleSymbolsProportionally!==!1&&t.frame&&t.size!=null){const e=t.frame.ymax-t.frame.ymin;return t.size/e}return 1}}class O{static findApplicableOverrides(t,e,i){if(t&&e){if(t.primitiveName){let n=!1;for(const s of i)if(s.primitiveName===t.primitiveName){n=!0;break}if(!n)for(const s of e)s.primitiveName===t.primitiveName&&i.push(s)}switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(t.effects)for(const n of t.effects)O.findApplicableOverrides(n,e,i);if(t.symbolLayers)for(const n of t.symbolLayers)O.findApplicableOverrides(n,e,i);break;case"CIMTextSymbol":break;case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":case"CIMSolidFill":case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":case"CIMVectorMarker":case"CIMCharacterMarker":case"CIMPictureMarker":if(t.effects)for(const n of t.effects)O.findApplicableOverrides(n,e,i);if(t.markerPlacement&&O.findApplicableOverrides(t.markerPlacement,e,i),t.type==="CIMVectorMarker"){if(t.markerGraphics)for(const n of t.markerGraphics)O.findApplicableOverrides(n,e,i),O.findApplicableOverrides(n.symbol,e,i)}else t.type==="CIMCharacterMarker"?O.findApplicableOverrides(t.symbol,e,i):t.type==="CIMHatchFill"?O.findApplicableOverrides(t.lineSymbol,e,i):t.type==="CIMPictureMarker"&&O.findApplicableOverrides(t.animatedSymbolProperties,e,i)}}}static findEffectOverrides(t,e,i){if(!e||!t)return;const n=t.length;for(let s=0;s{var f;return!((f=m.valueExpressionInfo)!=null&&f.expression.includes("$feature"))})),o||(l=l.filter(m=>{var f;return!((f=m.valueExpressionInfo)!=null&&f.expression.includes("$view"))})),l.length>0){const m=cs(e.attributes);await O.evaluateOverrides(l,e,{spatialReference:i,fields:m,geometryType:s},r,o)}O.applyOverrides(a,l)}return n&&O.applyDictionaryTextOverrides(a,e,n),a}static async evaluateOverrides(t,e,i,n,s){if(!e)return;let r;for(const o of t){const a=o.valueExpressionInfo;if(a&&(i!=null&&i.geometryType)){r||(r=[]),o.value=void 0;const l=mi(a.expression,i.spatialReference,i.fields).then(h=>{o.value=Lt(h,e,{$view:s},i.geometryType,n)});r.push(l)}}r!==void 0&&r.length>0&&await Promise.all(r)}static applyDictionaryTextOverrides(t,e,i,n="Normal"){if(t!=null&&t.type)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":case"CIMTextSymbol":{const s=t.symbolLayers;if(!s)return;for(const r of s)r&&r.type==="CIMVectorMarker"&&O.applyDictionaryTextOverrides(r,e,i,t.type==="CIMTextSymbol"?t.textCase:n)}break;case"CIMVectorMarker":{const s=t.markerGraphics;if(!s)return;for(const r of s)r&&O.applyDictionaryTextOverrides(r,e,i)}break;case"CIMMarkerGraphic":{const s=t.textString;if(s&&s.includes("[")){const r=us(s,i);t.textString=fs(e,r,n)}}}}static applyOverrides(t,e,i,n){if(t.primitiveName){for(const s of e)if(s.primitiveName===t.primitiveName){const r=yr(s.propertyName);if(n&&n.push({cim:t,nocapPropertyName:r,value:t[r]}),s.expression&&(s.value=O.toValue(s.propertyName,s.expression)),i){let o=!1;for(const a of i)a.primitiveName===t.primitiveName&&(o=!0);o||i.push(s)}s.value!=null&&(t[r]=s.value)}}switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(t.effects)for(const s of t.effects)O.applyOverrides(s,e,i,n);if(t.symbolLayers)for(const s of t.symbolLayers)O.applyOverrides(s,e,i,n);break;case"CIMTextSymbol":break;case"CIMSolidStroke":case"CIMSolidFill":case"CIMVectorMarker":if(t.effects)for(const s of t.effects)O.applyOverrides(s,e,i,n);if(t.type==="CIMVectorMarker"&&t.markerGraphics)for(const s of t.markerGraphics)O.applyOverrides(s,e,i,n),O.applyOverrides(s.symbol,e,i,n)}}static restoreOverrides(t){for(const e of t)e.cim[e.nocapPropertyName]=e.value}static buildOverrideKey(t){let e="";for(const i of t)i.value!==void 0&&(e+=`${i.primitiveName}${i.propertyName}${JSON.stringify(i.value)}`);return e}static toValue(t,e){if(t==="DashTemplate")return e.split(" ").map(i=>Number(i));if(t==="Color"){const i=new pi(e).toRgba();return i[3]*=255,i}return e}}const Yi=u=>{if(!u)return j.Butt;switch(u){case"butt":return j.Butt;case"square":return j.Square;case"round":return j.Round}},Vi=u=>{if(!u)return mt.Miter;switch(u){case"miter":return mt.Miter;case"round":return mt.Round;case"bevel":return mt.Bevel}},fr=u=>{if(u==null)return"Center";switch(u){case"left":return"Left";case"right":return"Right";case"center":return"Center"}},mr=u=>{if(u==null)return"Center";switch(u){case"baseline":return"Baseline";case"top":return"Top";case"middle":return"Center";case"bottom":return"Bottom"}},Y=u=>{if(!u)return[0,0,0,0];const{r:t,g:e,b:i,a:n}=u;return[t,e,i,255*n]},pr=(u,t)=>{const e=_r(t),i=dr(u);return e&&i?`${e}-${i}`:`${e}${i}`},_r=u=>{if(!u)return"";switch(u.toLowerCase()){case"bold":case"bolder":return"bold"}return""},dr=u=>{if(!u)return"";switch(u.toLowerCase()){case"italic":case"oblique":return"italic"}return""},Xe=(u,t)=>{const e=ms("safari")?.001:0,i=t==="butt";switch(u){case"dash":case"esriSLSDash":return i?[4,3]:[3,4];case"dash-dot":case"esriSLSDashDot":return i?[4,3,1,3]:[3,4,e,4];case"dot":case"esriSLSDot":return i?[1,3]:[e,4];case"long-dash":case"esriSLSLongDash":return i?[8,3]:[7,4];case"long-dash-dot":case"esriSLSLongDashDot":return i?[8,3,1,3]:[7,4,e,4];case"long-dash-dot-dot":case"esriSLSDashDotDot":return i?[8,3,1,3,1,3]:[7,4,e,4,e,4];case"short-dash":case"esriSLSShortDash":return i?[4,1]:[3,2];case"short-dash-dot":case"esriSLSShortDashDot":return i?[4,1,1,1]:[3,2,e,2];case"short-dash-dot-dot":case"esriSLSShortDashDotDot":return i?[4,1,1,1,1,1]:[3,2,e,2,e,2];case"short-dot":case"esriSLSShortDot":return i?[1,1]:[e,2];case"solid":case"esriSLSSolid":case"none":return Me.error("Unexpected: style does not require rasterization"),[0,0];default:return Me.error(`Tried to rasterize SLS, but found an unexpected style: ${u}!`),[0,0]}},$t=(u,t=100)=>{const e=t/2;let i,n;const s=u;if(s==="circle"||s==="esriSMSCircle"){let o=Math.acos(1-.25/e),a=Math.ceil(Hi/o/4);a===0&&(a=1),o=cr/a,a*=4;const l=[];l.push([e,0]);for(let h=1;hu==="vertical"||u==="horizontal"||u==="cross"||u==="esriSFSCross"||u==="esriSFSVertical"||u==="esriSFSHorizontal",yr=u=>u&&u.charAt(0).toLowerCase()+u.substr(1);function Pr(u,t,e){if(!(!u.effects||t.geometryEngine!=null)){if(t.geometryEnginePromise)return void e.push(t.geometryEnginePromise);ps(u.effects)&&(t.geometryEnginePromise=_s(),e.push(t.geometryEnginePromise),t.geometryEnginePromise.then(i=>t.geometryEngine=i))}}function ri(u){if(!u)return null;let t=null;const{cap:e,color:i,join:n,miterLimit:s,style:r,width:o}=u;return r!=="solid"&&r!=="none"&&r!=="esriSLSSolid"&&r!=="esriSLSNull"&&(t=[{type:"CIMGeometricEffectDashes",dashTemplate:Xe(r,e),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]),{type:"CIMSolidStroke",color:r!=="esriSLSNull"&&r!=="none"?Y(i):[0,0,0,0],capStyle:Yi(e),joinStyle:Vi(n),miterLimit:s,width:o,effects:t}}const ni=.05;function Mr(u){return Math.max(Math.round(u/ni),1)*ni}const br=new Set(["StartTimeOffset","Duration","RepeatDelay"]);function xr(u,t){return br.has(t)?Mr(u):u}function Sr(u){var t;if(!u)return null;switch(u.type){case"CIMPointSymbol":{const e=u.symbolLayers;return e&&e.length===1?Sr(e[0]):null}case"CIMVectorMarker":{const e=u.markerGraphics;if(!e||e.length!==1)return null;const i=e[0];if(!i)return null;const n=i.geometry;if(!n)return null;const s=i.symbol;return!s||s.type!=="CIMPolygonSymbol"&&s.type!=="CIMLineSymbol"||(t=s.symbolLayers)!=null&&t.some(r=>!!r.effects)?null:{geom:n,asFill:s.type==="CIMPolygonSymbol"}}case"sdf":return{geom:u.geom,asFill:u.asFill}}return null}function Cr(u){return u?u.rings?u.rings:u.paths?u.paths:u.xmin!==void 0&&u.ymin!==void 0&&u.xmax!==void 0&&u.ymax!==void 0?[[[u.xmin,u.ymin],[u.xmin,u.ymax],[u.xmax,u.ymax],[u.xmax,u.ymin],[u.xmin,u.ymin]]]:null:null}function vr(u){let t=1/0,e=-1/0,i=1/0,n=-1/0;for(const s of u)for(const r of s)r[0]e&&(e=r[0]),r[1]n&&(n=r[1]);return new $i(t,i,e-t,n-i)}function oi(u){let t=1/0,e=-1/0,i=1/0,n=-1/0;for(const s of u)for(const r of s)r[0]e&&(e=r[0]),r[1]n&&(n=r[1]);return[t,i,e,n]}function ai(u){return u?u.rings?oi(u.rings):u.paths?oi(u.paths):st(u)?[u.xmin,u.ymin,u.xmax,u.ymax]:null:null}function li(u,t,e,i,n){const[s,r,o,a]=u;if(o0&&(P=(t.xmax-t.xmin)/(t.ymax-t.ymin),y=i.x/(e*P),M=i.y/e):(y=i.x,M=i.y)),t&&(y=.5*(t.xmax+t.xmin)+y*(t.xmax-t.xmin),M=.5*(t.ymax+t.ymin)+M*(t.ymax-t.ymin)),y-=s,M-=r,y*=_,M*=_,y+=f,M+=f;let b=y/p-.5,S=M/d-.5;return n&&e&&(b*=e*P,S*=e),[g,b,S]}function On(u){const t=Cr(u.geom),e=vr(t),i=128,n=di,s=Math.floor(.5*(.5*i-n)),r=(i-2*(s+n))/Math.max(e.width,e.height),o=Math.round(e.width*r)+2*s,a=Math.round(e.height*r)+2*s,l=[];for(const c of t)if(c&&c.length>1){const m=[];for(const f of c){let[_,p]=f;_-=e.x,p-=e.y,_*=r,p*=r,_+=s-.5,p+=s-.5,u.asFill?m.push([_,p]):m.push([Math.round(_),Math.round(p)])}if(u.asFill){const f=m.length-1;m[0][0]===m[f][0]&&m[0][1]===m[f][1]||m.push(m[0])}l.push(m)}const h=wr(l,o,a,s);return u.asFill&&kr(l,o,a,s,h),[Ir(h,s),o,a]}function wr(u,t,e,i){const n=t*e,s=new Array(n),r=i*i+1;for(let o=0;ot&&(g=t),y<0&&(y=0),M>e&&(M=e);const P=c[0]-h[0],b=c[1]-h[1],S=P*P+b*b;for(let v=d;vS?(I=c[0],L=c[1]):(A/=S,I=h[0]+A*P,L=h[1]+A*b);const R=(v-I)*(v-I)+(C-L)*(C-L),z=(e-C-1)*t+v;Rt-i&&(p=t-i),de-i&&(g=e-i);for(let y=d;yy==l[1]>y)continue;const M=(e-y-1)*t;for(let P=_;P>8^e)+i|0;while(--i!=0)}return(1+e/(1<<31))/2}function Or(u){return Math.floor(zr(u,Ar)*Tr)}const Ar=53290320,Tr=10,Fr=Ve.getLogger("esri.symbols.cim.cimAnalyzer");function Te(u){switch(u){case"Butt":return we.BUTT;case"Square":return we.SQUARE;default:return we.ROUND}}function Fe(u){switch(u){case"Bevel":return ke.BEVEL;case"Miter":return ke.MITER;default:return ke.ROUND}}function Er(u){const t=u.markerPlacement;return t&&t.angleToLine?ge.MAP:ge.SCREEN}class An{constructor(t,e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._resourceManager=t,this._info=e}async analyzeSymbolReference(t,e,i){if(this._cimLayers=i??[],!t)return this._cimLayers;if(t.primitiveOverrides){this._primitiveOverrides=t.primitiveOverrides,this._poMap={};const r=[],o=this._info;for(const a of this._primitiveOverrides){const l=a.valueExpressionInfo;if(l&&o){const h=l.expression,c=mi(h,o.spatialReference,o.fields).then(m=>{m!=null&&this._setPoMap(a.primitiveName,a.propertyName,m)});r.push(c)}else a.value!=null&&this._setPoMap(a.primitiveName,a.propertyName,a.value);r.length>0&&await Promise.all(r)}}const n=t.symbol,s=[];return kt.fetchResources(n,this._resourceManager,s),s.length>0&&await Promise.all(s),this._analyzeSymbol(n,e),this._cimLayers}_analyzeSymbol(t,e){switch(t==null?void 0:t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(t,e,1,0,0,0)}}_analyzeMultiLayerSymbol(t,e,i,n,s,r){const o=t==null?void 0:t.symbolLayers;if(!o)return;const a=t.effects;let l=ge.SCREEN;const h=kt.getSize(t)??0;t.type==="CIMPointSymbol"&&t.angleAlignment==="Map"&&(l=ge.MAP);const c=t.type==="CIMPolygonSymbol";let m=o.length;for(;m--;){const f=o[m];if(!f||f.enable===!1)continue;let _;a!=null&&a.length&&(_=[...a]);const p=f.effects;p!=null&&p.length&&(a?_.push(...p):_=[...p]);const d=[];let g;O.findEffectOverrides(_,this._primitiveOverrides,d),g=d.length>0?this._createEffectsOverrideFunction(_,d):_;const y=[];switch(O.findApplicableOverrides(f,this._primitiveOverrides,y),f.type){case"CIMSolidFill":this._analyzeSolidFill(f,g);break;case"CIMPictureFill":this._analyzePictureFill(f,g);break;case"CIMHatchFill":this._analyzeHatchFill(f,g);break;case"CIMGradientFill":this._analyzeGradientFill(f,g);break;case"CIMSolidStroke":this._analyzeSolidStroke(f,g,c,h);break;case"CIMPictureStroke":this._analyzePictureStroke(f,g,c,h);break;case"CIMGradientStroke":this._analyzeGradientStroke(f,g,c,h);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{t.type==="CIMLineSymbol"&&(l=Er(f));const M=[],P=f.primitiveName;P&&M.push(P),this._analyzeMarker(f,g,null,M,l,h,1,e,i,n,s,r);break}default:Fr.error("Cannot analyze CIM layer",f.type)}}}_analyzeSolidFill(t,e){const i=t.primitiveName,n=H(t.color),[s,r]=this._analyzePrimitiveOverrides(i,e,null,null),o=F(JSON.stringify(t)+r).toString();this._cimLayers.push({type:"fill",templateHash:o,materialHash:s?()=>o:o,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked,color:this._createOverrideFunction(i,"Color",n,X),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:e,applyRandomOffset:!1,sampleAlphaOnly:!0})}_analyzePictureFill(t,e){const i=t.primitiveName,n=ue(t),[s,r]=this._analyzePrimitiveOverrides(i,e,null,null),o=F(JSON.stringify(t)+r).toString(),a=F(`${t.url}${JSON.stringify(t.colorSubstitutions)}`).toString(),l=x(t.height,rr);let h=x(t.scaleX,1);if("width"in t&&typeof t.width=="number"){const c=t.width;let m=1;const f=this._resourceManager.getResource(t.url);f!=null&&(m=f.width/f.height),h/=m*(l/c)}this._cimLayers.push({type:"fill",templateHash:o,materialHash:s?()=>a:a,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked,effects:e,color:this._createOverrideFunction(i,"TintColor",n,X),height:this._createOverrideFunction(i,"Height",l),scaleX:this._createOverrideFunction(i,"ScaleX",h),angle:this._createOverrideFunction(i,"Rotation",x(t.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",x(t.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",x(t.offsetY)),url:t.url,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeHatchFill(t,e){var m,f;const i=t.primitiveName,n=this._analyzeMaterialOverrides(i,["Rotation","OffsetX","OffsetY"]);let[s,r]=this._analyzePrimitiveOverrides(i,e,null,null);const o=F(JSON.stringify(t)+r).toString(),a=F(`${t.separation}${JSON.stringify(t.lineSymbol)}`).toString();let l={r:255,g:255,b:255,a:1},h=!1;const c=(f=(m=t.lineSymbol)==null?void 0:m.symbolLayers)==null?void 0:f.find(_=>{var p;return _.type==="CIMSolidStroke"&&((p=this._poMap[_.primitiveName])==null?void 0:p.Color)!=null});if(c){l=H(c.color),l=this._createOverrideFunction(c.primitiveName,"Color",l,X);const _=typeof l=="function";s=s||_,h=c.color!=null||_}this._cimLayers.push({type:"fill",templateHash:o,materialHash:s&&n?this._createMaterialHashFunction(a,n):a,cim:t,materialOverrides:n,colorLocked:!!t.colorLocked,effects:e,color:l,height:this._createOverrideFunction(i,"Separation",x(t.separation,Ue)),scaleX:1,angle:this._createOverrideFunction(i,"Rotation",x(t.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",x(t.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",x(t.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!h})}_analyzeGradientFill(t,e){const i=t.primitiveName,[n,s]=this._analyzePrimitiveOverrides(i,e,null,null),r=F(JSON.stringify(t)+s).toString();this._cimLayers.push({type:"fill",templateHash:r,materialHash:n?()=>r:r,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked,effects:e,color:{r:128,g:128,b:128,a:1},height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeSolidStroke(t,e,i,n){const s=t.primitiveName,r=H(t.color),o=x(t.width,zt),a=Te(t.capStyle),l=Fe(t.joinStyle),h=t.miterLimit,[c,m]=this._analyzePrimitiveOverrides(s,e,null,null),f=F(JSON.stringify(t)+m).toString();let _,p;if(e&&e instanceof Array&&e.length>0){const d=e[e.length-1];if(d.type==="CIMGeometricEffectDashes"&&d.lineDashEnding==="NoConstraint"&&d.offsetAlongLine===null){const g=(e=[...e]).pop();_=g.dashTemplate,p=g.scaleDash}}this._cimLayers.push({type:"line",templateHash:f,materialHash:c?()=>f:f,cim:t,materialOverrides:null,isOutline:i,colorLocked:!!t.colorLocked,effects:e,color:this._createOverrideFunction(s,"Color",r,X),width:this._createOverrideFunction(s,"Width",o),cap:this._createOverrideFunction(s,"CapStyle",a),join:this._createOverrideFunction(s,"JoinStyle",l),miterLimit:h&&this._createOverrideFunction(s,"MiterLimit",h),referenceWidth:n,zOrder:Ee(t.name),dashTemplate:_,scaleDash:p,sampleAlphaOnly:!0})}_analyzePictureStroke(t,e,i,n){const s=F(`${t.url}${JSON.stringify(t.colorSubstitutions)}`).toString(),r=t.primitiveName,o=ue(t),a=x(t.width,zt),l=Te(t.capStyle),h=Fe(t.joinStyle),c=t.miterLimit,[m,f]=this._analyzePrimitiveOverrides(r,e,null,null),_=F(JSON.stringify(t)+f).toString();this._cimLayers.push({type:"line",templateHash:_,materialHash:m?()=>s:s,cim:t,materialOverrides:null,isOutline:i,colorLocked:!!t.colorLocked,effects:e,color:this._createOverrideFunction(r,"TintColor",o,X),width:this._createOverrideFunction(r,"Width",a),cap:this._createOverrideFunction(r,"CapStyle",l),join:this._createOverrideFunction(r,"JoinStyle",h),miterLimit:c&&this._createOverrideFunction(r,"MiterLimit",c),referenceWidth:n,zOrder:Ee(t.name),dashTemplate:null,scaleDash:!1,url:t.url,sampleAlphaOnly:!1})}_analyzeGradientStroke(t,e,i,n){const s=t.primitiveName,r=x(t.width,zt),o=Te(t.capStyle),a=Fe(t.joinStyle),l=t.miterLimit,[h,c]=this._analyzePrimitiveOverrides(s,e,null,null),m=F(JSON.stringify(t)+c).toString();this._cimLayers.push({type:"line",templateHash:m,materialHash:h?()=>m:m,cim:t,materialOverrides:null,isOutline:i,colorLocked:!!t.colorLocked,effects:e,color:{r:128,g:128,b:128,a:1},width:this._createOverrideFunction(s,"Width",r),cap:this._createOverrideFunction(s,"CapStyle",o),join:this._createOverrideFunction(s,"JoinStyle",a),miterLimit:l&&this._createOverrideFunction(s,"MiterLimit",l),referenceWidth:n,zOrder:Ee(t.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeMarker(t,e,i,n,s,r,o,a,l,h,c,m,f=!1){if(this._analyzeMarkerInsidePolygon(t,e))return;const _=x(t.size,Pe),p=x(t.rotation),d=x(t.offsetX),g=x(t.offsetY);let y=this._createOverrideFunction(t.primitiveName,"Size",_),M=this._createOverrideFunction(t.primitiveName,"Rotation",p),P=this._createOverrideFunction(t.primitiveName,"OffsetX",d),b=this._createOverrideFunction(t.primitiveName,"OffsetY",g);y=this._transformSize(y,o),M=this._transformRotation(M,!!t.rotateClockwise,h);const S=this._transformOffsetX(P,b,h,o,c),v=this._transformOffsetY(P,b,h,o,m);switch(P=S,b=v,t.type){case"CIMPictureMarker":this._analyzePictureMarker(t,e,i,n,s,r,y,M,P,b,t.colorLocked||f);break;case"CIMVectorMarker":this._analyzeVectorMarker(t,e,i,n,s,r,o,a,y,M,P,b,t.colorLocked||f)}}_analyzeMarkerInsidePolygon(t,e){const{markerPlacement:i,type:n}=t;if(!i||i.type!=="CIMMarkerPlacementInsidePolygon")return!1;if(n==="CIMVectorMarker"||n==="CIMPictureMarker"){const d=t.primitiveName;if(d){const[y,M]=this._analyzePrimitiveOverrides([d],e,null,null);if(y)return!1}const g=i.primitiveName;if(g){const[y,M]=this._analyzePrimitiveOverrides([g],e,null,null);if(y)return!1}if(n==="CIMVectorMarker"){const{markerGraphics:y}=t;if(y)for(const M of y){const{symbol:P}=M;if((P==null?void 0:P.type)==="CIMPolygonSymbol"&&P.symbolLayers){const{symbolLayers:b}=P;for(const S of b)if(S.type==="CIMSolidStroke")return!1}}}else{const{animatedSymbolProperties:y}=t;if(y)return!1}}const s=i,r=Math.abs(s.stepX),o=Math.abs(s.stepY);if(r===0||o===0)return!0;const a=new Set(["Rotation","OffsetX","OffsetY"]),l=this._primitiveOverrides.filter(d=>d.primitiveName!==t.primitiveName||!a.has(d.propertyName)),h="url"in t&&typeof t.url=="string"?t.url:void 0,c=F(JSON.stringify(t)).toString();let m,f,_=null;if(i.gridType==="Random"){const d=Ot(_i),g=Math.max(Math.floor(d/r),1),y=Math.max(Math.floor(d/o),1);m=o*y,_=M=>M?M*y:0,f=g*r/m}else i.shiftOddRows?(m=2*o,_=d=>d?2*d:0,f=r/o*.5):(m=o,_=null,f=r/o);const p=ue(t);return this._cimLayers.push({type:"fill",templateHash:c,materialHash:c,cim:t,materialOverrides:l,colorLocked:!!t.colorLocked,effects:e,color:p,height:this._createOverrideFunction(s.primitiveName,"StepY",m,_),scaleX:f,angle:s.gridAngle,offsetX:x(s.offsetX),offsetY:x(s.offsetY),url:h,applyRandomOffset:i.gridType==="Random",sampleAlphaOnly:!h,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(t,e,i,n,s,r,o,a,l,h,c){let m=x(t.scaleX,1);const f=ue(t),_=F(`${t.url}${JSON.stringify(t.colorSubstitutions)}${JSON.stringify(t.animatedSymbolProperties)}`).toString();i||(i=this._createMarkerPlacementOverrideFunction(t.markerPlacement));const p=this._createAnimatedSymbolPropertiesOverrideFunction(t.animatedSymbolProperties),[d,g]=this._analyzePrimitiveOverrides(n,e,i,p),y=F(JSON.stringify(t)+g).toString(),M=t.anchorPoint??{x:0,y:0};if("width"in t&&typeof t.width=="number"){const S=t.width;let v=1;const C=this._resourceManager.getResource(t.url);C!=null&&(v=C.width/C.height),m/=v*(x(t.size)/S)}function P(S,v){return p!=null?Ze(p,S,v):null}const b=t.animatedSymbolProperties&&t.animatedSymbolProperties.randomizeStartTime===!0?(S,v,C,I)=>{const L=Or(I??0),A=P(S,v);return _+`-MATERIALGROUP(${L})-ASP(${JSON.stringify(A)})`}:d?(S,v)=>{const C=P(S,v);return _+`-ASP(${JSON.stringify(C)})`}:_;this._cimLayers.push({type:"marker",templateHash:y,materialHash:b,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked||!!c,effects:e,scaleSymbolsProportionally:!1,alignment:s,size:o,scaleX:this._createOverrideFunction(t.primitiveName,"ScaleX",m),rotation:a,offsetX:l,offsetY:h,color:this._createOverrideFunction(t.primitiveName,"TintColor",f,X),anchorPoint:{x:M.x,y:M.y},isAbsoluteAnchorPoint:t.anchorPointUnits!=="Relative",outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,frameHeight:0,rotateClockwise:!1,referenceSize:r,sizeRatio:1,markerPlacement:i,url:t.url,animatedSymbolProperties:p})}_analyzeVectorMarker(t,e,i,n,s,r,o,a,l,h,c,m,f){const _=t.markerGraphics;if(!_)return;const p=t.frame;let d=0,g=1;t.scaleSymbolsProportionally&&p&&(d=p.ymax-p.ymin,g=this._transformSize(l,1/d)),g=this._transformSize(g,o),i||(i=this._createMarkerPlacementOverrideFunction(t.markerPlacement));for(const y of _)if(y){const M=y.symbol;if(!M)continue;const P=y.primitiveName;P&&n.push(P);let b=c,S=m;if((M.type==="CIMPointSymbol"||M.type==="CIMTextSymbol")&&p){let v=0,C=0;const I=y.geometry;"x"in I&&"y"in I&&(v+=I.x-.5*(p.xmin+p.xmax),C+=I.y-.5*(p.ymin+p.ymax));const L=t.anchorPoint;L&&(t.anchorPointUnits==="Absolute"?(v-=L.x,C-=L.y):p&&(v-=(p.xmax-p.xmin)*L.x,C-=(p.ymax-p.ymin)*L.y)),b=this._transformOffsetX(v,C,h,g,c),S=this._transformOffsetY(v,C,h,g,m)}switch(M.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":a||$r(M)?this._analyzeMultiLayerGraphicNonSDF(t,e,i,null,y,n,s,r,d,!!f||!!t.colorLocked):this._analyzeMultiLayerGraphic(t,e,i,null,y,n,s,r,d,g,l,h,b,S,!!f||!!t.colorLocked);break;case"CIMTextSymbol":this._analyzeTextGraphic(t,e,i,y,n,s,r,d,g,l,h,b,S,!!f||!!t.colorLocked)}P&&n.pop()}}_analyzeMultiLayerGraphic(t,e,i,n,s,r,o,a,l,h,c,m,f,_,p){const d=s.symbol,g=d.symbolLayers;if(!g)return;let y=g.length;if(Nr(g))return void this._analyzeCompositeMarkerGraphic(t,e,i,n,s,g,r,o,a,l,c,m,f,_,!!p||!!t.colorLocked);const M=this._resourceManager.geometryEngine,P=hi.applyEffects(d.effects,s.geometry,M);if(P)for(;y--;){const b=g[y];if(!b||b.enable===!1)continue;const S=b.primitiveName;switch(S&&r.push(S),b.type){case"CIMSolidFill":case"CIMSolidStroke":{const v=hi.applyEffects(b.effects,P,M),C=ai(v);if(!C)continue;const I=t.anchorPointUnits!=="Relative",[L,A,R]=li(C,t.frame,t.size,t.anchorPoint,I),z=b.type==="CIMSolidFill",E={type:"sdf",geom:v,asFill:z},V=b.path,J=z?H(Ct(b)):V==null?H(_e(b)):{r:0,g:0,b:0,a:0},K=z?{r:0,g:0,b:0,a:0}:H(_e(b)),Z=$e(b)??0;if(!z&&!Z)break;const B=s.primitiveName;let lt=null;z&&!b.colorLocked&&(lt=this._createOverrideFunction(B,"FillColor",J,X));let pt=null;z||b.colorLocked||(pt=this._createOverrideFunction(B,"StrokeColor",K,X));const _t=this._createOverrideFunction(B,"StrokeWidth",Z);let ht=!1,T="";for(const Q of this._primitiveOverrides)r.includes(Q.primitiveName)&&(Q.value!=null?T+=`-${Q.primitiveName}-${Q.propertyName}-${JSON.stringify(Q.value)}`:Q.valueExpressionInfo&&(ht=!0));(e!=null&&typeof e=="function"||i!=null&&typeof i=="function")&&(ht=!0),(w(c)||w(m)||w(f)||w(_))&&(ht=!0);const oe=JSON.stringify({...t,markerGraphics:null}),Tt=F(JSON.stringify(E)+V).toString(),ae=F(JSON.stringify(s)+JSON.stringify(b)+oe+T).toString();this._cimLayers.push({type:"marker",templateHash:ae,materialHash:ht?()=>Tt:Tt,cim:E,materialOverrides:null,colorLocked:!!b.colorLocked||!!p,effects:e,scaleSymbolsProportionally:!!t.scaleSymbolsProportionally,alignment:o,anchorPoint:{x:A,y:R},isAbsoluteAnchorPoint:I,size:c,rotation:m,offsetX:f,offsetY:_,scaleX:1,frameHeight:l,rotateClockwise:!1,referenceSize:a,sizeRatio:L,color:w(lt)?lt:this._createOverrideFunction(S,"Color",J,X),outlineColor:w(pt)?pt:this._createOverrideFunction(S,"Color",K,X),outlineWidth:w(_t)?_t:this._createOverrideFunction(S,"Width",Z),markerPlacement:i,animatedSymbolProperties:n,path:V});break}case"CIMVectorMarker":b.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(t,e,i,n,s,r,o,a,l,!!p||!!b.colorLocked):this._analyzeMarker(b,e,i,r,o,a,h,!1,c,m,f,_,!!p||!!t.colorLocked);break;default:this._analyzeMultiLayerGraphicNonSDF(t,e,i,n,s,r,o,a,l,!!p||!!t.colorLocked)}S&&r.pop()}}_analyzeTextGraphic(t,e,i,n,s,r,o,a,l,h,c,m,f,_){var Q;const p=[];O.findApplicableOverrides(n,this._primitiveOverrides,p);const d=n.geometry;if(!("x"in d)||!("y"in d))return;const g=n.symbol,y=Be(g),M=Je(g.fontStyleName),P=gs(g.fontFamilyName);g.font={family:P,decoration:y,...M};let b=x(g.height,Ri),S=x(g.angle),v=x(g.offsetX),C=x(g.offsetY);b=this._transformSize(b,l),S=this._transformRotation(S,!1,c);const I=this._transformOffsetX(v,C,c,l,m),L=this._transformOffsetY(v,C,c,l,f);v=I,C=L;const A=H(Ct(g));let R=H(_e(g)),z=$e(g)??0;z||(R=H(Ct(g.haloSymbol)),z=x(g.haloSize)),z=this._transformSize(z,l);let E=!1;if((Q=g.symbol)!=null&&Q.symbolLayers)for(const dt of g.symbol.symbolLayers)Ct(dt)!=null&&(E=!!dt.colorLocked);const V=n.primitiveName;let J=null;E||(J=this._createOverrideFunction(V,"Color",A,X));let K=null,Z=null,B=0;if(g.callout&&g.callout.type==="CIMBackgroundCallout"){const dt=g.callout;if(dt.backgroundSymbol){const le=dt.backgroundSymbol.symbolLayers;if(le)for(const gt of le)gt.type==="CIMSolidFill"?K=H(gt.color):gt.type==="CIMSolidStroke"&&(Z=H(gt.color),B=x(gt.width,zt))}}const[lt,pt]=this._analyzePrimitiveOverrides(s,e,i,null),_t=JSON.stringify(t.effects)+Number(t.colorLocked||_).toString()+JSON.stringify(t.anchorPoint)+t.anchorPointUnits+JSON.stringify(t.markerPlacement)+t.size.toString(),ht=F(JSON.stringify(n)+_t+pt).toString();let T=this._createOverrideFunction(n.primitiveName,"TextString",n.textString??"",ys,g.textCase);if(T==null)return;const{fontStyleName:oe}=g,Tt=P+(oe?"-"+oe.toLowerCase():"-regular"),ae=Tt;typeof T=="string"&&T.includes("[")&&g.fieldMap&&(T=Ps(g.fieldMap,T,g.textCase)),this._cimLayers.push({type:"text",templateHash:ht,materialHash:lt||typeof T=="function"||/\[(.*?)\]/.test(T)?(dt,le,gt)=>ae+"-"+Ze(T,dt,le,gt):ae+"-"+F(T),cim:g,materialOverrides:null,colorLocked:!!_||!!E,effects:e,alignment:r,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:t.anchorPointUnits!=="Relative",fontName:Tt,decoration:y,weight:M.weight,style:M.style,size:b,angle:S,offsetX:v,offsetY:C,horizontalAlignment:ui(g.horizontalAlignment),verticalAlignment:fi(g.verticalAlignment),text:T,color:w(J)?J:A,outlineColor:R,outlineSize:z,backgroundColor:K,borderLineColor:Z,borderLineWidth:B,lineWidth:null,referenceSize:o,sizeRatio:1,markerPlacement:i})}_analyzeMultiLayerGraphicNonSDF(t,e,i,n,s,r,o,a,l,h){const c=this._buildSimpleMarker(t,s),m=t.primitiveName,f=this._analyzeMaterialOverrides(m,["Rotation","OffsetX","OffsetY"]),[_,p]=this._analyzePrimitiveOverrides(r,null,null,null),[d,g,y]=kt.getTextureAnchor(c,this._resourceManager),M=x(t.rotation),P=x(t.offsetX),b=x(t.offsetY),S=F(JSON.stringify(c)+p).toString(),v=f&&f.length>0||e!=null&&typeof e=="function";this._cimLayers.push({type:"marker",templateHash:S,materialHash:v&&f?this._createMaterialHashFunction(S,f):S,cim:c,materialOverrides:f,colorLocked:!!t.colorLocked||!!h,effects:e,scaleSymbolsProportionally:!!t.scaleSymbolsProportionally,alignment:o,anchorPoint:{x:d,y:g},isAbsoluteAnchorPoint:!1,size:x(t.size,Pe),rotation:this._createOverrideFunction(m,"Rotation",M),offsetX:this._createOverrideFunction(m,"OffsetX",P),offsetY:this._createOverrideFunction(m,"OffsetY",b),color:{r:255,g:255,b:255,a:1},outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,scaleX:1,frameHeight:l,rotateClockwise:!!t.rotateClockwise,referenceSize:a,sizeRatio:y/rt(t.size),markerPlacement:i,animatedSymbolProperties:n,avoidSDFRasterization:!0})}_buildSimpleMarker(t,e){return{type:t.type,enable:!0,name:t.name,colorLocked:t.colorLocked,primitiveName:t.primitiveName,anchorPoint:t.anchorPoint,anchorPointUnits:t.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:t.rotateClockwise,rotation:0,size:t.size,billboardMode3D:t.billboardMode3D,depth3D:t.depth3D,frame:t.frame,markerGraphics:[e],scaleSymbolsProportionally:t.scaleSymbolsProportionally,respectFrame:t.respectFrame,clippingPath:t.clippingPath}}_analyzeCompositeMarkerGraphic(t,e,i,n,s,r,o,a,l,h,c,m,f,_,p){const d=s.geometry,g=r[0],y=r[1],M=ai(d);if(!M)return;const P=t.anchorPointUnits!=="Relative",[b,S,v]=li(M,t.frame,t.size,t.anchorPoint,P),C={type:"sdf",geom:d,asFill:!0},I=y.path,L=y.primitiveName,A=g.primitiveName,R=H(y.color),z=H(g.color),E=x(g.width,zt),V=s.primitiveName;let J=null;y.colorLocked||p||(J=this._createOverrideFunction(V,"FillColor",R,X));let K=null;g.colorLocked||p||(K=this._createOverrideFunction(V,"StrokeColor",z,X));const Z=this._createOverrideFunction(V,"StrokeWidth",E);let B=!1,lt="";for(const T of this._primitiveOverrides)(T.primitiveName===L||T.primitiveName===A||o.includes(T.primitiveName))&&(T.value!=null?lt+=`-${T.primitiveName}-${T.propertyName}-${JSON.stringify(T.value)}`:T.valueExpressionInfo&&(B=!0));i!=null&&typeof i=="function"&&(B=!0),(w(c)||w(m)||w(f)||w(_))&&(B=!0);const pt=JSON.stringify({...t,markerGraphics:null}),_t=F(JSON.stringify(C)+I).toString(),ht=F(JSON.stringify(s)+JSON.stringify(y)+JSON.stringify(g)+pt+lt).toString();this._cimLayers.push({type:"marker",templateHash:ht,materialHash:B?()=>_t:_t,cim:C,materialOverrides:null,colorLocked:!!p,effects:e,scaleSymbolsProportionally:!!t.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:S,y:v},isAbsoluteAnchorPoint:P,size:c,rotation:m,offsetX:f,offsetY:_,scaleX:1,frameHeight:h,rotateClockwise:!1,referenceSize:l,sizeRatio:b,color:w(J)?J:this._createOverrideFunction(L,"Color",R,X),outlineColor:w(K)?K:this._createOverrideFunction(A,"Color",z,X),outlineWidth:w(Z)?Z:this._createOverrideFunction(A,"Width",E),markerPlacement:i,path:I,animatedSymbolProperties:n})}_createMaterialHashFunction(t,e){var n;const i=(n=this._info)==null?void 0:n.geometryType;if(i){const s=this._poMap;for(const r of e)if(r.valueExpressionInfo){const o=s[r.primitiveName]&&s[r.primitiveName][r.propertyName];o instanceof Nt&&(r.fn=(a,l,h)=>Lt(o,a,{$view:h},i,l))}}return(s,r,o)=>{for(const a of e)a.fn&&(a.value=a.fn(s,r,o));return F(t+O.buildOverrideKey(e)).toString()}}_setPoMap(t,e,i){let n;this._poMap[t]?n=this._poMap[t]:(n={},this._poMap[t]=n),n[e]=i}_createOverrideFunction(t,e,i,n,s){var l;if(t==null)return i;const r=this._poMap[t];if(r==null)return i;const o=r[e];if(typeof o=="string"||typeof o=="number"||o instanceof Array)return n?n.call(null,o,s):o;const a=(l=this._info)==null?void 0:l.geometryType;return o!=null&&o instanceof Nt&&a!=null?(h,c,m)=>{let f=Lt(o,h,{$view:m},a,c);return f!==null&&n&&(f=n.call(null,f,s)),f!==null?f:i}:i}_createEffectsOverrideFunction(t,e){var s;const i=this._poMap,n=(s=this._info)==null?void 0:s.geometryType;for(const r of e)if(r.valueExpressionInfo&&n){const o=i[r.primitiveName]&&i[r.primitiveName][r.propertyName];o instanceof Nt&&(r.fn=(a,l,h)=>Lt(o,a,{$view:h},n,l))}return(r,o,a)=>{for(const h of e)h.fn&&(h.value=h.fn(r,o,a));const l=[];for(let h of t){const c=h==null?void 0:h.primitiveName;if(c){let m=!1;for(const f of e)if(f.primitiveName===c){const _=Ne(f.propertyName);f.value!=null&&f.value!==h[_]&&(m||(h=ot(h),m=!0),h[_]=f.value)}}l.push(h)}return l}}_createMarkerPlacementOverrideFunction(t){var s;const e=[];if(O.findApplicableOverrides(t,this._primitiveOverrides,e),t==null||e.length===0)return t;const i=this._poMap,n=(s=this._info)==null?void 0:s.geometryType;for(const r of e)if(r.valueExpressionInfo&&n){const o=i[r.primitiveName]&&i[r.primitiveName][r.propertyName];o instanceof Nt&&(r.fn=(a,l,h)=>Lt(o,a,{$view:h},n,l))}return(r,o,a)=>{for(const c of e)c.fn&&(c.value=c.fn(r,o,a));const l=ot(t),h=t.primitiveName;for(const c of e)if(c.primitiveName===h){const m=Ne(c.propertyName);c.value!=null&&c.value!==l[m]&&(l[m]=c.value)}return l}}_createAnimatedSymbolPropertiesOverrideFunction(t){var n;const e=[];if(O.findApplicableOverrides(t,this._primitiveOverrides,e),t==null||e.length===0)return t;const i=(n=this._info)==null?void 0:n.geometryType;if(i){const s=this._poMap;for(const r of e)if(r.valueExpressionInfo){const o=s[r.primitiveName]&&s[r.primitiveName][r.propertyName];o instanceof Nt&&(r.fn=(a,l,h)=>Lt(o,a,{$view:h},i,l))}}return(s,r,o)=>{for(const h of e)h.fn&&(h.value=h.fn(s,r,o));const a=ot(t),l=t.primitiveName;for(const h of e)if(h.primitiveName===l){const c=Ne(h.propertyName);if(h.value!=null){const m=xr(h.value,h.propertyName);m!==a[c]&&(a[c]=m)}}return a}}_analyzePrimitiveOverrides(t,e,i,n){let s=!1,r="";typeof t=="string"&&(t=[t]);for(const o of this._primitiveOverrides)t!=null&&t.includes(o.primitiveName)&&(o.value!=null?r+=`-${o.primitiveName}-${o.propertyName}-${JSON.stringify(o.value)}`:o.valueExpressionInfo&&(s=!0));return e!=null&&typeof e=="function"&&(s=!0),i!=null&&typeof i=="function"&&(s=!0),n!=null&&typeof n=="function"&&(s=!0),[s,r]}_analyzeMaterialOverrides(t,e){return this._primitiveOverrides.filter(i=>i.primitiveName!==t||!e.includes(i.propertyName))}_transformSize(t,e){return w(t)||w(e)?(i,n,s)=>(w(t)?t(i,n,s):t)*(w(e)?e(i,n,s):e):t*e}_transformRotation(t,e,i){return w(t)||w(i)?(n,s,r)=>{const o=w(t)?t(n,s,r):t,a=w(i)?i(n,s,r):i;return e?a-o:a+o}:e?i-t:i+t}_transformOffsetX(t,e,i,n,s){if(!(w(t)||w(e)||w(i)||w(n)||w(s))){const r=i*Math.PI/180;if(r){const o=Math.cos(r),a=Math.sin(r);return(o*t-a*e)*n+s}return t*n+s}return(r,o,a)=>{let l=w(i)?i(r,o,a):i;const h=w(n)?n(r,o,a):n,c=w(t)?t(r,o,a):t,m=w(s)?s(r,o,a):s;return l?(l*=Math.PI/180,(Math.cos(l)*c-Math.sin(l)*(w(e)?e(r,o,a):e))*h+m):c*h+m}}_transformOffsetY(t,e,i,n,s){if(!(w(t)||w(e)||w(i)||w(n)||w(s))){const r=i*Math.PI/180;if(r){const o=Math.cos(r);return(Math.sin(r)*t+o*e)*n+s}return e*n+s}return(r,o,a)=>{let l=w(i)?i(r,o,a):i;const h=w(n)?n(r,o,a):n,c=w(e)?e(r,o,a):e,m=w(s)?s(r,o,a):s;if(l){l*=Math.PI/180;const f=Math.cos(l);return(Math.sin(l)*(w(t)?t(r,o,a):t)+f*c)*h+m}return c*h+m}}}function Ee(u){if(u&&u.indexOf("Level_")===0){const t=parseInt(u.substr(6),10);if(!isNaN(t))return t}return 0}function X(u){if(!u||u.length===0)return null;const t=new pi(u).toRgba();return{r:t[0],g:t[1],b:t[2],a:t[3]}}function Ne(u){return u&&u.charAt(0).toLowerCase()+u.substr(1)}function Tn(u,t){if(!t||t.length===0)return u;const e=ot(u);return O.applyOverrides(e,t),e}const Nr=u=>u&&u.length===2&&u[0].enable&&u[1].enable&&u[0].type==="CIMSolidStroke"&&u[1].type==="CIMSolidFill"&&u[0].path==null&&u[1].path==null&&!u[0].effects&&!u[1].effects;function $r(u){const t=u.symbolLayers;if(!t||t.length!==2)return!1;const e=t.find(n=>{var s;return(s=n.effects)==null?void 0:s.find(r=>r.type==="CIMGeometricEffectDashes")}),i=t.find(n=>{var s;return(s=n.effects)==null?void 0:s.find(r=>r.type==="CIMGeometricEffectAddControlPoints")});return!!e&&!!i}export{Mt as Q,Tn as V,Sr as a,On as b,G as c,Xe as d,or as e,hi as f,tr as g,xn as h,In as i,An as j,Sn as k,O as l,Ss as m,kt as n,Cn as o,vn as p,wn as q,Gi as r,kn as s,$i as t}; diff --git a/dist/assets/cimAnalyzer-X6MTpVAO.js b/dist/assets/cimAnalyzer-X6MTpVAO.js new file mode 100644 index 0000000..e66fefb --- /dev/null +++ b/dist/assets/cimAnalyzer-X6MTpVAO.js @@ -0,0 +1 @@ +import{wZ as St,w_ as pe,w$ as wt,kf as De,d2 as He,x0 as k,x1 as D,x2 as Ft,eD as st,kg as Ye,x3 as he,x4 as tt,wQ as ft,x5 as Ce,uO as ci,x6 as Et,x7 as ce,x8 as Bi,gL as rt,gV as Ji,R as Ve,eE as nt,eF as Mt,eC as ve,x9 as b,xa as It,a2 as Ot,ah as ot,a4 as j,a5 as mt,xb as Be,xc as Je,xd as Wi,xe as ui,xf as fi,xg as Ct,xh as $e,xi as _e,xj as Ui,xk as qi,xl as ji,eB as qe,rg as Ki,cf as Qi,eG as Zi,mQ as ts,xm as es,xn as is,xo as ss,xp as rs,xq as ns,xr as je,xs as os,xt as as,xu as Ke,kK as ls,xv as hs,xw as cs,vs as mi,wV as Lt,xx as us,xy as fs,W as pi,dE as ms,xz as ps,xA as _s,fS as ds,m1 as F,wO as ge,xB as H,xC as ue,wR as w,xD as gs,xE as ys,ml as Ps,mm as Qe,xF as Nt,ks as we,kt as ke}from"./index-pCX-0tJH.js";import{a as $,l as xs}from"./labelPoint-1MOq4I_J.js";import{t as Ze,e as Ms}from"./TileClipper-NSFZXMR1.js";import{C as _i,g as di}from"./definitions-SVBNHUSH.js";import"./number-sTjsTbdA.js";import{C as bs}from"./BidiEngine-8z8MVveq.js";const Ie=new bs;function Ss(u){if(u==null)return["",!1];if(!Ie.hasBidiChar(u))return[u,!1];let t;return t=Ie.checkContextual(u)==="rtl"?"IDNNN":"ICNNN",[Ie.bidiTransform(u,t,"VLYSN"),!0]}const Cs=512;let et,Ge=class{constructor(t){this._geometry=t}next(){const t=this._geometry;return this._geometry=null,t}};function We(u,t){et||(et=new Ms(0,0,0,1));const e=u.geometryType==="esriGeometryPolygon",i=e?Ze.Polygon:Ze.LineString,n=e?3:2;let s,r;for(et.reset(i),et.setPixelMargin(t+1),et.setExtent(Cs);u.nextPath();)if(!(u.pathSize1&&y>0&&l>0&&(o*d+a*g)/y/l<=this._maxCosAngle&&t.setControlPointAt(f-1),f===1&&(h=d,c=g,m=y),y>0&&(n=_,s=p,o=d,a=g,l=y)}this._isClosed&&l>0&&m>0&&(o*h+a*c)/m/l<=this._maxCosAngle&&t.setControlPointAt(0)}}},At=class{constructor(){this.setIdentity()}getAngle(){return(this.rz==null||this.rz===0&&this.rzCos!==1&&this.rzSin!==0)&&(this.rz=Math.atan2(this.rzSin,this.rzCos)),this.rz}setIdentity(){this.tx=0,this.ty=0,this.tz=0,this.s=1,this.rx=0,this.ry=0,this.rz=0,this.rzCos=1,this.rzSin=0}setTranslate(t,e){this.tx=t,this.ty=e}setTranslateZ(t){this.tz=t}setRotateCS(t,e){this.rz=void 0,this.rzCos=t,this.rzSin=e}setRotate(t){this.rz=t,this.rzCos=void 0,this.rzSin=void 0}setRotateY(t){this.ry=t}setScale(t){this.s=t}setMeasure(t){this.m=t}};function Le(u,t){u[4]=t}let ne=class{constructor(t,e=!0,i=!0,n=0){this.isClosed=!1,this.geometryCursor=null,this.geometryCursor=!e&&t.geometryType==="esriGeometryPolygon"||!i&&t.geometryType==="esriGeometryPolyline"?null:t,this.geomUnitsPerPoint=n,this.iteratePath=!1,this.internalPlacement=new At}next(){if(!this.geometryCursor)return null;for(;this.iteratePath||this.geometryCursor.nextPath();){this.geometryCursor.seekPathStart();const t=this.processPath(this.geometryCursor);if(t)return t}return this.geometryCursor=null,null}},Me=class{constructor(t,e,i,n=0){this.isClosed=!1,this.inputGeometries=t,this.acceptPolygon=e,this.acceptPolyline=i,this.geomUnitsPerPoint=n,this.iteratePath=!1,this.multiPathCursor=null}next(){for(;;){if(!this.multiPathCursor){let t=this.inputGeometries.next();for(;t&&(this.isClosed=this.acceptPolygon&&t.geometryType==="esriGeometryPolygon"||t.geometryType==="esriGeometryEnvelope",this.multiPathCursor=t,!this.multiPathCursor);)t=this.inputGeometries.next();if(!this.multiPathCursor)return null}for(;this.iteratePath||this.multiPathCursor.nextPath();){this.multiPathCursor.seekPathStart();const t=this.processPath(this.multiPathCursor);if(t)return t}this.multiPathCursor=null}}};const re=.03;let at=class{constructor(t=0,e=!1){}isEmpty(t){if(!t.nextPoint())return!0;let e,i,n,s;for(e=t.x,i=t.y;t.nextPoint();e=i,i=s)if(n=t.x,s=t.y,n!==e||s!==i)return t.seekPathStart(),!1;return t.seekPathStart(),!0}normalize(t){const e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);e!==0&&(t[0]/=e,t[1]/=e)}getLength(t,e,i,n){const s=i-t,r=n-e;return Math.sqrt(s*s+r*r)}getSegLength(t){const[[e,i],[n,s]]=t;return this.getLength(e,i,n,s)}getCoord2D(t,e,i,n,s){return[t+(i-t)*s,e+(n-e)*s]}getSegCoord2D(t,e){const[[i,n],[s,r]]=t;return this.getCoord2D(i,n,s,r,e)}getAngle(t,e,i,n,s){const r=i-t,o=n-e;return Math.atan2(o,r)}getAngleCS(t,e,i,n,s){const r=i-t,o=n-e,a=Math.sqrt(r*r+o*o);return a>0?[r/a,o/a]:[1,0]}getSegAngleCS(t,e){const[[i,n],[s,r]]=t;return this.getAngleCS(i,n,s,r,e)}cut(t,e,i,n,s,r){return[s<=0?[t,e]:this.getCoord2D(t,e,i,n,s),r>=1?[i,n]:this.getCoord2D(t,e,i,n,r)]}getSubCurve(t,e,i){const n=$.createEmptyOptimizedCIM("esriGeometryPolyline");return this.appendSubCurve(n,t,e,i)?n:null}appendSubCurve(t,e,i,n){t.startPath(),e.seekPathStart();let s=0,r=!0;if(!e.nextPoint())return!1;let o=e.x,a=e.y;for(;e.nextPoint();){const l=this.getLength(o,a,e.x,e.y);if(l!==0){if(r){if(s+l>i){const h=(i-s)/l;let c=1,m=!1;s+l>=n&&(c=(n-s)/l,m=!0);const f=this.cut(o,a,e.x,e.y,h,c);if(f&&t.pushPoints(f),m)break;r=!1}}else{if(s+l>n){const h=this.cut(o,a,e.x,e.y,0,(n-s)/l);h&&t.pushPoint(h[1]);break}t.pushXY(e.x,e.y)}s+=l,o=e.x,a=e.y}else o=e.x,a=e.y}return!0}getCIMPointAlong(t,e){if(!t.nextPoint())return null;let i,n,s,r,o=0;for(i=t.x,n=t.y;t.nextPoint();i=s,n=r){s=t.x,r=t.y;const a=this.getLength(i,n,s,r);if(a!==0){if(o+a>e){const l=(e-o)/a;return this.getCoord2D(i,n,s,r,l)}o+=a}}return null}offset(t,e,i,n,s){if(!t||t.length<2)return null;let r=0,o=t[r++],a=r;for(;r=0==e<=0){if(g<1){const y=[_[0]-p[0],_[1]-p[1]];this.normalize(y);const x=Math.sqrt((1+g)/2);if(x>1/n){const P=-Math.abs(e)/x;h.push([c[0]-y[0]*P,c[1]-y[1]*P])}}}else switch(i){case St.Mitered:{const y=Math.sqrt((1+g)/2);if(y>0&&1/y0){const x=1/y;let P=x;for(let M=1;M0){const s=$.createEmptyOptimizedCIM(t.geometryType),r=De(t)[0],o=this._curveHelper.offset(r,this._size,St.Rounded,4,this._offsetFlattenError);if(o)return s.pushPath(o),s}else if(this._size<0){const s=t.asJSON();if(Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._size>0)return $.fromJSONCIM({xmin:s.xmin-this._size,xmax:s.xmax+this._size,ymin:s.ymin-this._size,ymax:s.ymax+this._size})}}const e=this._geometryEngine;if(e==null)return null;const i=this._tileKey?We(t,this._maxInflateSize):t;if(!i)continue;const n=e.buffer(He.WebMercator,i.asJSON(),this._size,1);return n?$.fromJSONCIM(n):null}return null}},Pi=class Xt{static local(){return Xt.instance===null&&(Xt.instance=new Xt),Xt.instance}execute(t,e,i,n,s){return new Os(t,e,i)}};Pi.instance=null;let Os=class{constructor(t,e,i){this._defaultPointSize=20,this._inputGeometries=t,this._geomUnitsPerPoint=i,this._rule=e.rule??k.FullGeometry,this._defaultSize=this._defaultPointSize*i}next(){let t;for(;t=this._inputGeometries.next();){const e=this._processGeom(De(t));if(e&&e.length)return $.fromJSONCIM({paths:e})}return null}_clone(t){return[t[0],t[1]]}_mid(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}_mix(t,e,i,n){return[t[0]*e+i[0]*n,t[1]*e+i[1]*n]}_add(t,e){return[t[0]+e[0],t[1]+e[1]]}_add2(t,e,i){return[t[0]+e,t[1]+i]}_sub(t,e){return[t[0]-e[0],t[1]-e[1]]}_dist(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}_norm(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}_normalize(t,e=1){const i=e/this._norm(t);t[0]*=i,t[1]*=i}_leftPerpendicular(t){const e=-t[1],i=t[0];t[0]=e,t[1]=i}_leftPerp(t){return[-t[1],t[0]]}_rightPerpendicular(t){const e=t[1],i=-t[0];t[0]=e,t[1]=i}_rightPerp(t){return[t[1],-t[0]]}_dotProduct(t,e){return t[0]*e[0]+t[1]*e[1]}_crossProduct(t,e){return t[0]*e[1]-t[1]*e[0]}_rotateDirect(t,e,i){const n=t[0]*e-t[1]*i,s=t[0]*i+t[1]*e;t[0]=n,t[1]=s}_makeCtrlPt(t){const e=[t[0],t[1]];return Le(e,1),e}_addAngledTicks(t,e,i,n){const s=this._sub(i,e);this._normalize(s);const r=this._crossProduct(s,this._sub(n,e));let o;o=r>0?this._rightPerp(s):this._leftPerp(s);const a=Math.abs(r)/2,l=[];l.push([e[0]+(o[0]-s[0])*a,e[1]+(o[1]-s[1])*a]),l.push(e),l.push(i),l.push([i[0]+(o[0]+s[0])*a,i[1]+(o[1]+s[1])*a]),t.push(l)}_addBezier2(t,e,i,n,s){if(s--==0)return void t.push(n);const r=this._mid(e,i),o=this._mid(i,n),a=this._mid(r,o);this._addBezier2(t,e,r,a,s),this._addBezier2(t,a,o,n,s)}_addBezier3(t,e,i,n,s,r){if(r--==0)return void t.push(s);const o=this._mid(e,i),a=this._mid(i,n),l=this._mid(n,s),h=this._mid(o,a),c=this._mid(a,l),m=this._mid(h,c);this._addBezier3(t,e,o,h,m,r),this._addBezier3(t,m,c,l,s,r)}_add90DegArc(t,e,i,n,s){const r=s??this._crossProduct(this._sub(i,e),this._sub(n,e))>0,o=this._mid(e,i),a=this._sub(o,e);r?this._leftPerpendicular(a):this._rightPerpendicular(a),o[0]+=a[0],o[1]+=a[1],this._addBezier3(t,e,this._mix(e,.33333,o,.66667),this._mix(i,.33333,o,.66667),i,4)}_addArrow(t,e,i){const n=e[0],s=e[1],r=e[e.length-1],o=this._sub(n,s);this._normalize(o);const a=this._crossProduct(o,this._sub(r,s)),l=.5*a,h=this._leftPerp(o),c=[r[0]-h[0]*a,r[1]-h[1]*a],m=e.length-1,f=[];f.push(i?[-h[0],-h[1]]:h);let _=[-o[0],-o[1]];for(let p=1;p0;p--)t.push([e[p][0]+f[p][0]*l,e[p][1]+f[p][1]*l]);t.push([c[0]+f[0][0]*l,c[1]+f[0][1]*l]),t.push([c[0]+f[0][0]*a,c[1]+f[0][1]*a]),t.push(n),t.push([c[0]-f[0][0]*a,c[1]-f[0][1]*a]),t.push([c[0]-f[0][0]*l,c[1]-f[0][1]*l]);for(let p=1;p=2?t[1]:this._add2(t[0],e*this._defaultSize,i*this._defaultSize)}_cp3(t,e,i,n){if(t.length>=3)return t[2];const s=this._mix(t[0],1-i,e,i),r=this._sub(e,t[0]);return this._normalize(r),this._rightPerpendicular(r),[s[0]+r[0]*n*this._defaultSize,s[1]+r[1]*n*this._defaultSize]}_arrowPath(t){if(t.length>2)return t;const e=t[0],i=this._cp2(t,-4,0),n=this._sub(e,i);this._normalize(n);const s=this._rightPerp(n);return[e,i,[e[0]+(s[0]-n[0])*this._defaultSize,e[1]+(s[1]-n[1])*this._defaultSize]]}_arrowLastSeg(t){const e=t[0],i=this._cp2(t,-4,0);let n;if(t.length>=3)n=t[t.length-1];else{const s=this._sub(e,i);this._normalize(s);const r=this._rightPerp(s);n=[e[0]+(r[0]-s[0])*this._defaultSize,e[1]+(r[1]-s[1])*this._defaultSize]}return[i,n]}_processGeom(t){if(!t)return null;const e=[];for(const i of t){if(!i||i.length===0)continue;const n=i.length;let s=i[0];switch(this._rule){case k.PerpendicularFromFirstSegment:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,4),a=[];a.push(o),a.push(this._mid(s,r)),e.push(a);break}case k.ReversedFirstSegment:{const r=this._cp2(i,0,-1);e.push([r,s]);break}case k.PerpendicularToSecondSegment:{const r=this._cp2(i,-4,1),o=this._cp3(i,r,.882353,-1.94),a=[];a.push(this._mid(r,o)),a.push(s),e.push(a);break}case k.SecondSegmentWithTicks:{const r=this._cp2(i,-4,1),o=this._cp3(i,r,.882353,-1.94),a=this._sub(o,r);let l;l=this._crossProduct(a,this._sub(s,r))>0?this._rightPerp(l):this._leftPerp(a);const h=[];h.push([r[0]+(l[0]-a[0])/3,r[1]+(l[1]-a[1])/3]),h.push(r),h.push(o),h.push([o[0]+(l[0]+a[0])/3,o[1]+(l[1]+a[1])/3]),e.push(h);break}case k.DoublePerpendicular:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,3),a=this._mid(s,r),l=this._sub(a,o);this._normalize(l);const h=this._crossProduct(l,this._sub(s,o));this._leftPerpendicular(l);const c=[];c.push(s),c.push([o[0]+l[0]*h,o[1]+l[1]*h]),e.push(c);const m=[];m.push([o[0]-l[0]*h,o[1]-l[1]*h]),m.push(r),e.push(m);break}case k.OppositeToFirstSegment:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,3),a=this._mid(s,r),l=this._sub(a,o);this._normalize(l);const h=this._crossProduct(l,this._sub(s,o));this._leftPerpendicular(l);const c=[];c.push([o[0]+l[0]*h,o[1]+l[1]*h]),c.push([o[0]-l[0]*h,o[1]-l[1]*h]),e.push(c);break}case k.TriplePerpendicular:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,4),a=this._mid(s,r),l=this._sub(a,o);this._normalize(l);const h=this._crossProduct(l,this._sub(s,o));this._leftPerpendicular(l);const c=[];c.push([o[0]+l[0]*h*.8,o[1]+l[1]*h*.8]),c.push([a[0]+.8*(s[0]-a[0]),a[1]+.8*(s[1]-a[1])]),e.push(c),e.push([o,a]);const m=[];m.push([o[0]-l[0]*h*.8,o[1]-l[1]*h*.8]),m.push([a[0]+.8*(r[0]-a[0]),a[1]+.8*(r[1]-a[1])]),e.push(m);break}case k.HalfCircleFirstSegment:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,4),a=this._mid(s,r);let l=this._sub(r,s);const h=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),m=Math.sqrt((1+h)/2),f=Math.sqrt((1-h)/2),_=[];let p;this._crossProduct(l,this._sub(o,s))>0?(_.push(s),l=this._sub(s,a),p=r):(_.push(r),l=this._sub(r,a),p=s),this._rotateDirect(l,m,f),l[0]/=m,l[1]/=m;for(let d=1;d<=18;d++)_.push(this._add(a,l)),this._rotateDirect(l,h,c);_.push(p),e.push(_);break}case k.HalfCircleSecondSegment:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,1,-1);let a=this._sub(s,r);this._normalize(a);const l=this._crossProduct(a,this._sub(o,r))/2;this._leftPerpendicular(a);const h=[r[0]+a[0]*l,r[1]+a[1]*l];a=this._sub(r,h);const c=Math.cos(Math.PI/18);let m=Math.sin(Math.PI/18);l>0&&(m=-m);const f=[r];for(let _=1;_<=18;_++)this._rotateDirect(a,c,m),f.push(this._add(h,a));e.push(f);break}case k.HalfCircleExtended:{const r=this._cp2(i,0,-2),o=this._cp3(i,r,1,-1);let a;if(n>=4)a=i[3];else{const _=this._sub(s,r);a=this._add(o,_)}const l=this._dist(r,o)/2/.75,h=this._sub(r,s);this._normalize(h,l);const c=this._sub(o,a);this._normalize(c,l);const m=[a,o];e.push(m);const f=[this._clone(o)];this._addBezier3(f,o,this._add(o,c),this._add(r,h),r,4),f.push(s),e.push(f);break}case k.OpenCircle:{const r=this._cp2(i,-2,0),o=this._sub(r,s),a=Math.cos(Math.PI/18),l=-Math.sin(Math.PI/18),h=[r];for(let c=1;c<=33;c++)this._rotateDirect(o,a,l),h.push(this._add(s,o));e.push(h);break}case k.CoverageEdgesWithTicks:{const r=this._cp2(i,0,-1);let o,a;if(n>=3)o=i[2];else{const m=this._sub(r,s),f=this._leftPerp(m);o=[s[0]+f[0]-.25*m[0],s[1]+f[1]-.25*m[1]]}if(n>=4)a=i[3];else{const m=this._mid(s,r),f=this._sub(s,r);this._normalize(f),this._leftPerpendicular(f);const _=this._crossProduct(f,this._sub(o,m));this._rightPerpendicular(f),a=[o[0]+f[0]*_*2,o[1]+f[1]*_*2]}const l=this._sub(r,s);let h,c;h=this._crossProduct(l,this._sub(o,s))>0?this._rightPerp(l):this._leftPerp(l),c=[],c.push(o),c.push(s),c.push([s[0]+(h[0]-l[0])/3,s[1]+(h[1]-l[1])/3]),e.push(c),h=this._crossProduct(l,this._sub(a,r))>0?this._rightPerp(h):this._leftPerp(l),c=[],c.push([r[0]+(h[0]+l[0])/3,r[1]+(h[1]+l[1])/3]),c.push(r),c.push(a),e.push(c);break}case k.GapExtentWithDoubleTicks:{const r=this._cp2(i,0,2),o=this._cp3(i,r,0,1);let a;if(n>=4)a=i[3];else{const l=this._sub(r,s);a=this._add(o,l)}this._addAngledTicks(e,s,r,this._mid(o,a)),this._addAngledTicks(e,o,a,this._mid(s,r));break}case k.GapExtentMidline:{const r=this._cp2(i,2,0),o=this._cp3(i,r,0,1);let a;if(n>=4)a=i[3];else{const h=this._sub(r,s);a=this._add(o,h)}const l=[];l.push(this._mid(s,o)),l.push(this._mid(r,a)),e.push(l);break}case k.Chevron:{const r=this._cp2(i,-1,-1);let o;if(n>=3)o=i[2];else{const a=this._sub(r,s);this._leftPerpendicular(a),o=this._add(s,a)}e.push([r,this._makeCtrlPt(s),o]);break}case k.PerpendicularWithArc:{const r=this._cp2(i,0,-2),o=this._cp3(i,r,.5,-1);let a=this._sub(r,s);const l=this._norm(a);a[0]/=l,a[1]/=l;const h=this._crossProduct(a,this._sub(o,s));let c=this._dotProduct(a,this._sub(o,s));c<.05*l?c=.05*l:c>.95*l&&(c=.95*l);const m=[s[0]+a[0]*c,s[1]+a[1]*c];this._leftPerpendicular(a);let f=[];f.push([m[0]-a[0]*h,m[1]-a[1]*h]),f.push([m[0]+a[0]*h,m[1]+a[1]*h]),e.push(f);const _=[r[0]+a[0]*h,r[1]+a[1]*h];a=this._sub(r,_);const p=Math.cos(Math.PI/18);let d=Math.sin(Math.PI/18);h<0&&(d=-d),f=[s,r];for(let g=1;g<=9;g++)this._rotateDirect(a,p,d),f.push(this._add(_,a));e.push(f);break}case k.ClosedHalfCircle:{const r=this._cp2(i,2,0),o=this._mid(s,r),a=this._sub(r,o),l=Math.cos(Math.PI/18),h=Math.sin(Math.PI/18),c=[s,r];for(let m=1;m<=18;m++)this._rotateDirect(a,l,h),c.push(this._add(o,a));e.push(c);break}case k.TripleParallelExtended:{const r=this._cp2(i,0,-2),o=this._cp3(i,r,1,-2),a=this._mid(s,r),l=this._sub(o,r);this._normalize(l);const h=Math.abs(this._crossProduct(l,this._sub(a,r)))/2,c=this._dist(r,o),m=[r,s];m.push([s[0]+l[0]*c*.5,s[1]+l[1]*c*.5]),e.push(m);const f=[];f.push([a[0]-l[0]*h,a[1]-l[1]*h]),f.push([a[0]+l[0]*c*.375,a[1]+l[1]*c*.375]),Le(f[f.length-1],1),f.push([a[0]+l[0]*c*.75,a[1]+l[1]*c*.75]),e.push(f);const _=[r,o];e.push(_);break}case k.ParallelWithTicks:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._sub(o,r);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a),this._addAngledTicks(e,s,r,o),this._addAngledTicks(e,this._mix(s,1,a,l),this._mix(r,1,a,l),this._mid(s,r));break}case k.Parallel:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._sub(r,s);this._normalize(a);const l=this._leftPerp(a),h=this._crossProduct(a,this._sub(o,s));let c=[s,r];e.push(c),c=[],c.push([s[0]+l[0]*h,s[1]+l[1]*h]),c.push([r[0]+l[0]*h,r[1]+l[1]*h]),e.push(c);break}case k.PerpendicularToFirstSegment:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._mid(s,r),l=this._sub(r,s);this._normalize(l);const h=this._crossProduct(l,this._sub(o,s));this._leftPerpendicular(l);const c=[];c.push([a[0]-l[0]*h*.25,a[1]-l[1]*h*.25]),c.push([a[0]+l[0]*h*1.25,a[1]+l[1]*h*1.25]),e.push(c);break}case k.ParallelOffset:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._sub(r,s);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a);const h=[];h.push([s[0]-a[0]*l,s[1]-a[1]*l]),h.push([r[0]-a[0]*l,r[1]-a[1]*l]),e.push(h);const c=[];c.push([s[0]+a[0]*l,s[1]+a[1]*l]),c.push([r[0]+a[0]*l,r[1]+a[1]*l]),e.push(c);break}case k.OffsetOpposite:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._sub(r,s);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a);const h=[];h.push([s[0]-a[0]*l,s[1]-a[1]*l]),h.push([r[0]-a[0]*l,r[1]-a[1]*l]),e.push(h);break}case k.OffsetSame:{const r=this._cp2(i,3,0),o=this._cp3(i,r,.5,-1),a=this._sub(r,s);this._normalize(a);const l=this._crossProduct(a,this._sub(o,s));this._leftPerpendicular(a);const h=[];h.push([s[0]+a[0]*l,s[1]+a[1]*l]),h.push([r[0]+a[0]*l,r[1]+a[1]*l]),e.push(h);break}case k.CircleWithArc:{let r=this._cp2(i,3,0);const o=this._cp3(i,r,.5,-1);let a,l;if(n>=4)a=i[3],l=this._crossProduct(this._sub(a,r),this._sub(o,r))>0;else{a=r,l=this._crossProduct(this._sub(a,s),this._sub(o,s))>0;const _=24*this._geomUnitsPerPoint,p=this._sub(a,s);this._normalize(p,_);const d=Math.sqrt(2)/2;this._rotateDirect(p,d,l?d:-d),r=this._add(s,p)}const h=this._sub(r,s),c=Math.cos(Math.PI/18),m=Math.sin(Math.PI/18),f=[r];for(let _=1;_<=36;_++)this._rotateDirect(h,c,m),f.push(this._add(s,h));this._add90DegArc(f,r,a,o,l),Le(f[f.length-8],1),e.push(f);break}case k.DoubleJog:{let r,o,a=this._cp2(i,-3,1);if(r=n>=3?i[2]:this._add(s,this._sub(s,a)),n>=4)o=i[3];else{const g=s;s=a,o=r;const y=this._dist(s,g),x=this._dist(o,g);let P=30*this._geomUnitsPerPoint;.5*y0?this._rotateDirect(p,_,-_):this._rotateDirect(p,_,_);let d=[];d.push(a),d.push(this._add(l,p)),d.push(this._sub(l,p)),d.push(s),e.push(d),p=this._sub(o,r),this._normalize(p,f),this._crossProduct(p,this._sub(s,r))<0?this._rotateDirect(p,_,_):this._rotateDirect(p,_,-_),d=[],d.push(r),d.push(this._add(h,p)),d.push(this._sub(h,p)),d.push(o),e.push(d);break}case k.PerpendicularOffset:{const r=this._cp2(i,-4,1),o=this._cp3(i,r,.882353,-1.94),a=this._sub(o,r);this._crossProduct(a,this._sub(s,r))>0?this._rightPerpendicular(a):this._leftPerpendicular(a);const l=[a[0]/8,a[1]/8],h=this._sub(this._mid(r,o),l);e.push([h,s]);break}case k.LineExcludingLastSegment:{const r=this._arrowPath(i),o=[];let a=r.length-2;for(;a--;)o.push(r[a]);e.push(o);break}case k.MultivertexArrow:{const r=this._arrowPath(i),o=[];this._addArrow(o,r,!1),e.push(o);break}case k.CrossedArrow:{const r=this._arrowPath(i),o=[];this._addArrow(o,r,!0),e.push(o);break}case k.ChevronArrow:{const[r,o]=this._arrowLastSeg(i),a=10*this._geomUnitsPerPoint,l=this._sub(s,r);this._normalize(l);const h=this._crossProduct(l,this._sub(o,r)),c=this._leftPerp(l),m=[o[0]-c[0]*h*2,o[1]-c[1]*h*2],f=[];f.push([o[0]+l[0]*a,o[1]+l[1]*a]),f.push(s),f.push([m[0]+l[0]*a,m[1]+l[1]*a]),e.push(f);break}case k.ChevronArrowOffset:{const[r,o]=this._arrowLastSeg(i),a=this._sub(s,r);this._normalize(a);const l=this._crossProduct(a,this._sub(o,r));this._leftPerpendicular(a);const h=[o[0]-a[0]*l,o[1]-a[1]*l],c=[];c.push([h[0]+a[0]*l*.5,h[1]+a[1]*l*.5]),c.push(this._mid(h,s)),c.push([h[0]-a[0]*l*.5,h[1]-a[1]*l*.5]),e.push(c);break}case k.PartialFirstSegment:{const[r,o]=this._arrowLastSeg(i),a=this._sub(s,r);this._normalize(a);const l=this._crossProduct(a,this._sub(o,r));this._leftPerpendicular(a);const h=[o[0]-a[0]*l,o[1]-a[1]*l];e.push([r,h]);break}case k.Arch:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,1),a=this._sub(s,r),l=this._mix(o,1,a,.55),h=this._mix(o,1,a,-.55),c=[s];this._addBezier2(c,s,l,o,4),this._addBezier2(c,o,h,r,4),e.push(c);break}case k.CurvedParallelTicks:{const r=this._cp2(i,-4,1),o=this._cp3(i,r,.882353,-1.94),a=this._sub(o,r);this._crossProduct(a,this._sub(s,r))>0?this._rightPerpendicular(a):this._leftPerpendicular(a);const l=[a[0]/8,a[1]/8],h=this._sub(this._mid(r,o),l),c=this._sub(this._mix(r,.75,o,.25),l),m=this._sub(this._mix(r,.25,o,.75),l),f=[r];this._addBezier2(f,r,c,h,3),this._addBezier2(f,h,m,o,3),e.push(f);for(let _=0;_<8;_++){const p=f[2*_+1],d=[this._clone(p)];d.push(this._add(p,[a[0]/4,a[1]/4])),e.push(d)}break}case k.Arc90Degrees:{const r=this._cp2(i,0,-1),o=this._cp3(i,r,.5,1),a=[r];this._add90DegArc(a,r,s,o),e.push(a);break}case k.FullGeometry:default:e.push(i)}}return e}},xi=class Dt{static local(){return Dt.instance===null&&(Dt.instance=new Dt),Dt.instance}execute(t,e,i,n,s){return new As(t,e,i)}};xi.instance=null;let As=class extends Me{constructor(t,e,i){super(t,!0,!0),this._curveHelper=new at,this._beginCut=(e.beginCut!==void 0?e.beginCut:1)*i,this._endCut=(e.endCut!==void 0?e.endCut:1)*i,this._middleCut=(e.middleCut!==void 0?e.middleCut:0)*i,this._invert=e.invert!==void 0&&e.invert,this._beginCut<0&&(this._beginCut=0),this._endCut<0&&(this._endCut=0),this._middleCut<0&&(this._middleCut=0)}processPath(t){const{_beginCut:e,_endCut:i,_middleCut:n}=this,s=t.pathLength(),r=$.createEmptyOptimizedCIM("esriGeometryPolyline");if(this._invert){if(e!==0||i!==0||n!==0)if(e+i+n>=s)for(r.startPath();t.nextPoint();)r.pushXY(t.x,t.y);else this._curveHelper.appendSubCurve(r,t,0,e),this._curveHelper.appendSubCurve(r,t,.5*(s-n),.5*(s+n)),this._curveHelper.appendSubCurve(r,t,s-i,i)}else if(e===0&&i===0&&n===0)for(r.startPath();t.nextPoint();)r.pushXY(t.x,t.y);else e+i+n0&&(s/=this._currentPosition.segmentLength),this._currentPosition.copyTo(e);e.abscissa+t*this._partLengthRatio>e.segmentLength+this._tolerance;){if(i){if(i.pathSize===0)if(s===0){const o=e.segment[0];i.pushXY(o[0],o[1])}else i.pushPoint(this.getSegCoord2D(e.segment,s));const r=e.segment[1];i.pushXY(r[0],r[1])}if(s=0,t-=(e.segmentLength-e.abscissa)/this._partLengthRatio,this._partSegCount)e.segment=this._nextSegment(),e.segmentLength=this.getSegLength(e.segment),e.abscissa=0,this._partSegCount--;else{if(!this._setPosAtNextPart())return n!==ut.FAIL&&(e.segmentLength=this.getSegLength(e.segment),e.isPartEnd=!0,n===ut.END?(e.abscissa=e.segmentLength,e.isPathEnd=!0):e.abscissa=e.segmentLength+t,!0);this._currentPosition.copyTo(e)}}if(e.abscissa+=t*this._partLengthRatio,i){i.pathSize===0&&(s===0?i.pushPoint(e.segment[0]):i.pushPoint(this.getSegCoord2D(e.segment,s)));const r=e.abscissa/e.segmentLength;r===1?i.pushPoint(e.segment[1]):i.pushPoint(this.getSegCoord2D(e.segment,r))}return this._partSegCount||Math.abs(e.abscissa-e.segmentLength)=this._pathCursor.pathSize&&(i=0),this._ctrlPtEnd=this._pathCursor.getControlPointAt(i),this._patternLength>0){const n=this._ctrlPtBegin?this._partCtrlPtGap:this._partExtPtGap,s=this._ctrlPtEnd?this._partCtrlPtGap:this._partExtPtGap;let r=Math.round((this._partLength-(n+s))/this._patternLength);r<=0&&(r=n+s>0?0:1),this._partLengthRatio=this._partLength/(n+s+r*this._patternLength),this._partLengthRatio<.01&&(this._partLengthRatio=1)}else this._partLengthRatio=1;return!0}_hasNextSegment(){return this._seg=e;)n-=e,e=this._pattern.nextValue(),r=!r;e-=n,r?(this._walker.nextPosition(e),e=this._pattern.nextValue()):this.isClosed&&(this._firstCurve=this._walker.nextCurve(e),e=this._pattern.nextValue(),this._walker.nextPosition(e),e=this._pattern.nextValue())}let i=this._walker.nextCurve(e);if(i)if(this._walker.isPathEnd()){if(this.iteratePath=!1,this._firstCurve){for(this._firstCurve.nextPath();this._firstCurve.nextPoint();)i.pushXY(this._firstCurve.x,this._firstCurve.y);this._firstCurve=null}}else e=this._pattern.nextValue(),!this._walker.nextPosition(e)||this._walker.isPathEnd()?(this.iteratePath=!1,this._firstCurve&&(i.pushCursor(this._firstCurve),this._firstCurve=null)):this.iteratePath=!0;else this.iteratePath=!1,i=this._firstCurve,this._firstCurve=null;return i==null||i.reset(),i}},bi=class Yt{static local(){return Yt.instance===null&&(Yt.instance=new Yt),Yt.instance}execute(t,e,i,n,s,r){return new Fs(t,e,i,n,s,r)}};bi.instance=null;let Fs=class{constructor(t,e,i,n,s,r){switch(this._inputGeometries=t,this._tileKey=n,this._geometryEngine=s,this._maxInflateSize=r*i,this._width=(e.width!==void 0?e.width:2)*i,e.method){case Ft.Mitered:case Ft.Bevelled:case Ft.Rounded:case Ft.TrueBuffer:case Ft.Square:}this._option=e.option}next(){let t;for(;t=this._inputGeometries.next();){if(t.geometryType==="esriGeometryEnvelope"&&this._width>0){const e=t.asJSON();return Math.min(e.xmax-e.xmin,e.ymax-e.ymin)-2*this._width<0?t:$.fromJSONCIM({paths:[[[e.xmin+this._width,e.ymin+this._width],[e.xmax-this._width,e.ymin+this._width],[e.xmax-this._width,e.ymax-this._width],[e.xmin+this._width,e.ymax-this._width],[e.xmin+this._width,e.ymin+this._width]],[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]})}if(t.geometryType==="esriGeometryPolygon"){if(this._width===0)return t.clone();const e=this._geometryEngine;if(e==null)return null;const i=this._tileKey?We(t,this._maxInflateSize):t.clone();if(!i)continue;const n=e.buffer(He.WebMercator,i.asJSON(),-this._width,1);if(n)for(const s of n.rings)s&&i.pushPath(s.reverse());return i}}return null}},Si=class Vt{static local(){return Vt.instance===null&&(Vt.instance=new Vt),Vt.instance}execute(t,e,i,n,s){return new Es(t,e,i)}};Si.instance=null;let Es=class extends Me{constructor(t,e,i){super(t,!1,!0),this._curveHelper=new at,this._length=(e.length!==void 0?e.length:20)*i,this._angle=e.angle!==void 0?e.angle:225,this._position=e.position!==void 0?e.position:50,this._length<0&&(this._length=-this._length),this._position<20&&(this._position=20),this._position>80&&(this._position=80),this._mirror=!1}processPath(t){const e=$.createEmptyOptimizedCIM("esriGeometryPolyline");if(this._curveHelper.isEmpty(t))return null;t.seekInPath(0);const i=t.x,n=t.y;t.seekInPath(t.pathSize-1);const s=t.x,r=t.y,o=[s-i,r-n];this._curveHelper.normalize(o);const a=i+(s-i)*this._position/100,l=n+(r-n)*this._position/100,h=Math.cos((90-this._angle)/180*Math.PI);let c=Math.sin((90-this._angle)/180*Math.PI);this._mirror&&(c=-c),this._mirror=!this._mirror;const m=[a-this._length/2*h,l-this._length/2*c],f=[a+this._length/2*h,l+this._length/2*c];return e.pushPath([[i,n],m,f,[s,r]]),e}},Ci=class Bt{static local(){return Bt.instance===null&&(Bt.instance=new Bt),Bt.instance}execute(t,e,i,n,s){return new Ns(t,e,i)}};Ci.instance=null;let Ns=class{constructor(t,e,i){this._inputGeometries=t,this._offsetX=e.offsetX!==void 0?e.offsetX*i:0,this._offsetY=e.offsetY!==void 0?e.offsetY*i:0}next(){let t=this._inputGeometries.next();for(;t;){if(t.totalSize>0)return this._move(t.clone(),this._offsetX,this._offsetY);t=this._inputGeometries.next()}return null}_move(t,e,i){for(;t.nextPath();)for(;t.nextPoint();)t.x=t.x+e,t.y=t.y+i;return t.reset(),t}},vi=class Jt{static local(){return Jt.instance===null&&(Jt.instance=new Jt),Jt.instance}execute(t,e,i,n,s,r){return new $s(t,e,i,n,s,r)}};vi.instance=null;let $s=class{constructor(t,e,i,n,s,r){this._inputGeometries=t,this._tileKey=n,this._geometryEngine=s,this._curveHelper=new at,this._offset=(e.offset??1)*i,this._method=e.method,this._maxInflateSize=r*i,this._option=e.option,this._offsetFlattenError=re*i}next(){let t;for(;t=this._inputGeometries.next();){if(this._offset===0)return t.clone();if(t.geometryType==="esriGeometryEnvelope"){if(this._method===St.Rounded&&this._offset>0){const r=wt(t),o=this._curveHelper.offset(r,-this._offset,this._method,4,this._offsetFlattenError);if(o){const a=$.createEmptyOptimizedCIM(t.geometryType);return a.pushPath(o),a}return null}const s=t.asJSON();if(st(s)&&Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._offset>0)return $.fromJSONCIM({xmin:s.xmin-this._offset,xmax:s.xmax+this._offset,ymin:s.ymin-this._offset,ymax:s.ymax+this._offset})}const e=this._geometryEngine;if(e==null)continue;const i=this._tileKey?We(t,this._maxInflateSize):t.clone();if(!i)continue;const n=e.offset(He.WebMercator,i.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return n?$.fromJSONCIM(n):null}return null}},wi=class Wt{static local(){return Wt.instance===null&&(Wt.instance=new Wt),Wt.instance}execute(t,e,i,n,s){return new Gs(t,e,i)}};wi.instance=null;let Gs=class{constructor(t,e,i){this._inputGeometries=t,this._reverse=e.reverse===void 0||e.reverse}next(){let t=this._inputGeometries.next();for(;t;){if(!this._reverse)return t;if(t.geometryType==="esriGeometryPolyline")return Rs(t.clone());t=this._inputGeometries.next()}return null}};function Rs(u){for(;u.nextPath();)for(let t=0;t0){const e=Ye(t),i=(e[2]+e[0])/2,n=(e[3]+e[1])/2;return t.reset(),this._rotate(t.clone(),i,n)}t=this._inputGeometries.next()}return null}_rotate(t,e,i){const n=Math.cos(this._rotateAngle),s=Math.sin(this._rotateAngle);for(;t.nextPath();)for(;t.nextPoint();){const r=t.x-e,o=t.y-i;t.x=e+r*n-o*s,t.y=i+r*s+o*n}return t.reset(),t}},Ii=class qt{static local(){return qt.instance===null&&(qt.instance=new qt),qt.instance}execute(t,e,i,n,s){return new Ds(t,e,i)}};Ii.instance=null;let Ds=class{constructor(t,e,i){this._inputGeometries=t,this._xFactor=e.XScaleFactor!==void 0?e.XScaleFactor:1.15,this._yFactor=e.YScaleFactor!==void 0?e.YScaleFactor:1.15}next(){const t=this._inputGeometries.next();if(t){if(this._xFactor===1&&this._yFactor===1||t.geometryType==="esriGeometryPoint")return t;if(t.totalSize>0){const e=Ye(t),i=(e[2]+e[0])/2,n=(e[3]+e[1])/2;return t.reset(),this._scaleCursor(t.clone(),i,n)}}return null}_scaleCursor(t,e,i){for(;t.nextPath();)for(;t.nextPoint();)t.x=e+(t.x-e)*this._xFactor,t.y=i+(t.y-i)*this._yFactor;return t.reset(),t}},Li=class jt{static local(){return jt.instance===null&&(jt.instance=new jt),jt.instance}execute(t,e,i,n,s){return new Hs(t,e,i)}};Li.instance=null;let Hs=class{constructor(t,e,i){this._inputGeometries=t,this._height=(e.amplitude!==void 0?e.amplitude:2)*i,this._period=(e.period!==void 0?e.period:3)*i,this._style=e.waveform,this._height<=0&&(this._height=Math.abs(this._height)),this._period<=0&&(this._period=Math.abs(this._period)),this._pattern=new be,this._pattern.addValue(this._period),this._pattern.addValue(this._period),this._walker=new Se,this._walker.updateTolerance(i)}next(){let t=this._inputGeometries.next();for(;t;){if(this._height===0||this._period===0)return t;const e=this._processGeom(t);if(e)return e;t=this._inputGeometries.next()}return null}_processGeom(t){const e=$.createEmptyOptimizedCIM(t.geometryType);for(;t.nextPath();){e.startPath();const i=t.pathLength();if(this._walker.init(t,this._pattern))switch(this._style){case he.Sinus:default:this._constructCurve(e,i,!1);break;case he.Square:this._constructSquare(e,i);break;case he.Triangle:this._constructTriangle(e,i);break;case he.Random:this._constructCurve(e,i,!0)}else for(;t.nextPoint();)e.pushXY(t.x,t.y)}return e}_constructCurve(t,e,i){let n=Math.round(e/this._period);n===0&&(n=1);const s=n*16+1,r=e/n,o=this._period/16,a=1/s,l=2*Math.PI*e/r,h=2*Math.PI*Math.random(),c=2*Math.PI*Math.random(),m=2*Math.PI*Math.random(),f=.75-Math.random()/2,_=.75-Math.random()/2,p=new it;this._walker.curPointAndAngle(p),t.pushPoint(p.pt);let d=0;for(;;){if(!this._walker.nextPointAndAngle(o,p)){t.pushPoint(this._walker.getPathEnd());break}{const g=d;let y;if(d+=a,i){const x=this._height/2*(1+.3*Math.sin(f*l*g+h));y=x*Math.sin(l*g+c),y+=x*Math.sin(_*l*g+m),y/=2}else y=.5*this._height*Math.sin(.5*l*g);t.pushXY(p.pt[0]-y*p.sa,p.pt[1]+y*p.ca)}}}_constructSquare(t,e){Math.round(e/this._period);let i=!0;for(;;){let n=!1;if(this._walker.curPositionIsValid()){const s=new it;this._walker.curPointAndAngle(s);const r=new it;if(this._walker.nextPointAndAngle(this._period,r)){const o=new it;this._walker.nextPointAndAngle(this._period,o)&&(i?(t.pushPoint(s.pt),i=!1):t.pushPoint(s.pt),t.pushXY(s.pt[0]-this._height/2*s.sa,s.pt[1]+this._height/2*s.ca),t.pushXY(r.pt[0]-this._height/2*r.sa,r.pt[1]+this._height/2*r.ca),t.pushXY(r.pt[0]+this._height/2*r.sa,r.pt[1]-this._height/2*r.ca),t.pushXY(o.pt[0]+this._height/2*o.sa,o.pt[1]-this._height/2*o.ca),n=!0)}}if(!n){t.pushPoint(this._walker.getPathEnd());break}}}_constructTriangle(t,e){Math.round(e/this._period);let i=!0;for(;;){let n=!1;if(this._walker.curPositionIsValid()){const s=new it;this._walker.curPointAndAngle(s);const r=new it;if(this._walker.nextPointAndAngle(this._period/2,r)){const o=new it;this._walker.nextPointAndAngle(this._period,o)&&(this._walker.nextPosition(this._period/2)&&(i?(t.pushPoint(s.pt),i=!1):t.pushPoint(s.pt),t.pushXY(r.pt[0]-this._height/2*r.sa,r.pt[1]+this._height/2*r.ca),t.pushXY(o.pt[0]+this._height/2*o.sa,o.pt[1]-this._height/2*o.ca)),n=!0)}}if(!n){t.pushPoint(this._walker.getPathEnd());break}}}},zi=class Kt{static local(){return Kt.instance===null&&(Kt.instance=new Kt),Kt.instance}execute(t,e,i,n,s){return new Ys(t,e,i)}};zi.instance=null;let Ys=class extends ne{constructor(t,e,i){super(t),this._geometryWalker=new Se,this._geometryWalker.updateTolerance(i),this._angleToLine=e.angleToLine??!0,this._offset=(e.offset?e.offset:0)*i,this._originalEndings=e.endings,this._offsetAtEnd=(e.customEndingOffset?e.customEndingOffset:0)*i,this._position=-(e.offsetAlongLine?e.offsetAlongLine:0)*i,this._pattern=new be,this._pattern.init(e.placementTemplate,!1),this._pattern.scale(i),this._endings=this._originalEndings}processPath(t){if(this._pattern.isEmpty())return null;let e;if(this.iteratePath)e=this._pattern.nextValue();else{this._originalEndings===tt.WithFullGap&&this.isClosed?this._endings=tt.WithMarkers:this._endings=this._originalEndings,this._pattern.extPtGap=0;let n,s=!0;switch(this._endings){case tt.NoConstraint:n=-this._position,n=this._adjustPosition(n),s=!1;break;case tt.WithHalfGap:default:n=-this._pattern.lastValue()/2;break;case tt.WithFullGap:n=-this._pattern.lastValue(),this._pattern.extPtGap=this._pattern.lastValue();break;case tt.WithMarkers:n=0;break;case tt.Custom:n=-this._position,n=this._adjustPosition(n),this._pattern.extPtGap=.5*this._offsetAtEnd}if(!this._geometryWalker.init(t,this._pattern,s))return null;this._pattern.reset();let r=0;for(;n>r;)n-=r,r=this._pattern.nextValue();r-=n,e=r,this.iteratePath=!0}const i=new it;return this._geometryWalker.nextPointAndAngle(e,i)?this._endings===tt.WithFullGap&&this._geometryWalker.isPathEnd()?(this.iteratePath=!1,null):this._endings===tt.WithMarkers&&this._geometryWalker.isPathEnd()&&(this.iteratePath=!1,this.isClosed)?null:(this.internalPlacement.setTranslate(i.pt[0]-this._offset*i.sa,i.pt[1]+this._offset*i.ca),this._angleToLine&&this.internalPlacement.setRotateCS(i.ca,i.sa),this.internalPlacement):(this.iteratePath=!1,null)}_adjustPosition(t){let e=t/this._pattern.length();return e-=Math.floor(e),e*this._pattern.length()}},Oi=class Qt{static local(){return Qt.instance===null&&(Qt.instance=new Qt),Qt.instance}execute(t,e,i,n,s){return new Vs(t,e,i)}};Oi.instance=null;let Vs=class extends ne{constructor(t,e,i){super(t,!1,!0),this._curveHelper=new at,this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._type=e.extremityPlacement,this._position=e.offsetAlongLine!==void 0?e.offsetAlongLine*i:0,this._beginProcessed=!1}processPath(t){let e;switch(this._type){case ft.Both:default:this._beginProcessed?(e=this._atExtremities(t,this._position,!1),this._beginProcessed=!1,this.iteratePath=!1):(e=this._atExtremities(t,this._position,!0),this._beginProcessed=!0,this.iteratePath=!0);break;case ft.JustBegin:e=this._atExtremities(t,this._position,!0);break;case ft.JustEnd:e=this._atExtremities(t,this._position,!1);case ft.None:}return e}_atExtremities(t,e,i){if(i||t.seekPathEnd(),i?t.nextPoint():t.prevPoint()){let n=0,[s,r]=[0,0],[o,a]=[t.x,t.y];for(;i?t.nextPoint():t.prevPoint();){s=o,r=a,o=t.x,a=t.y;const l=this._curveHelper.getLength(s,r,o,a);if(n+l>e){const h=(e-n)/l,[c,m]=this._curveHelper.getAngleCS(s,r,o,a,h),f=this._curveHelper.getCoord2D(s,r,o,a,h);return this.internalPlacement.setTranslate(f[0]-this._offset*m,f[1]+this._offset*c),this._angleToLine&&this.internalPlacement.setRotateCS(-c,-m),this.internalPlacement}n+=l}}return null}},Ai=class Zt{static local(){return Zt.instance===null&&(Zt.instance=new Zt),Zt.instance}execute(t,e,i,n,s){return new Bs(t,e,i)}};Ai.instance=null;let Bs=class extends ne{constructor(t,e,i){super(t),this._walker=new Se,this._walker.updateTolerance(i),this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._beginGap=e.beginPosition!==void 0?e.beginPosition*i:0,this._endGap=e.endPosition!==void 0?e.endPosition*i:0,this._flipFirst=e.flipFirst===void 0||e.flipFirst,this._pattern=new be,this._pattern.init(e.positionArray,!1,!1),this._subPathLen=0,this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0}processPath(t){if(this._pattern.isEmpty())return null;let e;if(this.iteratePath){const o=this._pattern.nextValue()*this._subPathLen,a=this._beginGap+o;e=a-this._prevPos,this._prevPos=a}else{if(this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0,this._subPathLen=t.pathLength()-this._beginGap-this._endGap,this._subPathLen<0)return this.iteratePath=!1,null;if(!this._walker.init(t,this._pattern,!1))return null;this._pattern.reset();const o=this._pattern.nextValue()*this._subPathLen,a=this._beginGap+o;e=a-this._prevPos,this._prevPos=a,this.iteratePath=!0}const i=new it;if(!this._walker.nextPointAndAngle(e,i,ut.END))return this.iteratePath=!1,null;this.internalPlacement.setTranslate(i.pt[0]-this._offset*i.sa,i.pt[1]+this._offset*i.ca);const n=this._isFirst&&this._flipFirst;let s,r;return this._angleToLine?(s=i.ca,r=i.sa):(s=1,r=0),n&&(s=-s,r=-r),this.internalPlacement.setRotateCS(s,r),this._isFirst=!1,this._posCount--,this._posCount===0&&(this.iteratePath=!1),this.internalPlacement}};const ct=512,Js=10,W=24,ye=1e-6;let Ti=class te{static local(){return te.instance===null&&(te.instance=new te),te.instance}execute(t,e,i,n,s){return new Ws(t,e,i,n,s)}};Ti.instance=null;let Ws=class Pt{constructor(t,e,i,n,s){if(this._xMin=0,this._xMax=0,this._yMin=0,this._yMax=0,this._currentX=0,this._currentY=0,this._accelerationMap=null,this._testInsidePolygon=!1,this._verticalSubdivision=!0,this._stepX=Math.abs(e.stepX??16)*i,this._stepY=Math.abs(e.stepY??16)*i,this._stepX=Math.round(128*this._stepX)/128,this._stepY=Math.round(128*this._stepY)/128,this._stepX!==0&&this._stepY!==0){if(this._gridType=e.gridType??Ce.Fixed,this._gridType===Ce.Random){const r=e.seed??13,o=1;this._randomLCG=new ci(r*o),this._randomness=(e.randomness??100)/100,this._gridAngle=0,this._shiftOddRows=!1,this._cosAngle=1,this._sinAngle=0,this._offsetX=0,this._offsetY=0,this._buildRandomValues()}else{if(this._randomness=0,this._gridAngle=e.gridAngle??0,this._shiftOddRows=e.shiftOddRows??!1,this._offsetX=(e.offsetX??0)*i,this._offsetY=(e.offsetY??0)*i,this._cosAngle=Math.cos(this._gridAngle/180*Math.PI),this._sinAngle=-Math.sin(this._gridAngle/180*Math.PI),this._stepX)if(this._offsetX<0)for(;this._offsetX<-.5*this._stepX;)this._offsetX+=this._stepX;else for(;this._offsetX>=.5*this._stepX;)this._offsetX-=this._stepX;if(this._stepY)if(this._offsetY<0)for(;this._offsetY<-.5*this._stepY;)this._offsetY+=this._stepY;else for(;this._offsetY>=.5*this._stepY;)this._offsetY-=this._stepY}if(this._graphicOriginX=0,this._graphicOriginY=0,n!=null){const[r,o,a,l]=n.split("/"),h=parseFloat(r),c=parseFloat(o),m=parseFloat(a),f=parseFloat(l);this._graphicOriginX=-(f*2**h+m)*ct,this._graphicOriginY=c*ct,this._testInsidePolygon=!0}this._internalPlacement=new At,this._calculateMinMax(t),this._geometryCursor=t}}next(){return this._geometryCursor?this._nextInside():null}_buildRandomValues(){if(!Pt._randValues){Pt._randValues=[];for(let t=0;t=y,this._polygonMin=this._verticalSubdivision?m:_,this._testInsidePolygon){let x=0-this._graphicOriginX-this._offsetX-this._stepX,P=ct-this._graphicOriginX-this._offsetX+this._stepX,M=-ct-this._graphicOriginY-this._offsetY-this._stepY,S=0-this._graphicOriginY-this._offsetY+this._stepY;if(d){const v=[[x,M],[x,S],[P,M],[P,S]];x=M=Number.MAX_VALUE,P=S=-Number.MAX_VALUE;for(const C of v){const I=this._cosAngle*C[0]-this._sinAngle*C[1],L=this._sinAngle*C[0]+this._cosAngle*C[1];x=Math.min(x,I),P=Math.max(P,I),M=Math.min(M,L),S=Math.max(S,L)}}a=a!==Number.MAX_VALUE?Math.max(a,x):x,l=l!==Number.MAX_VALUE?Math.max(l,M):M,h=h!==-Number.MAX_VALUE?Math.min(h,P):P,c=c!==-Number.MAX_VALUE?Math.min(c,S):S}this._xMin=Math.round(a/this._stepX),this._xMax=Math.round(h/this._stepX),this._yMin=Math.round(l/this._stepY),this._yMax=Math.round(c/this._stepY),this._currentX=this._xMax+1,this._currentY=this._yMin-1,this._buildAccelerationMap(t,_,p,m,f)}_buildAccelerationMap(t,e,i,n,s){t.reset();const r=new Map,o=this._verticalSubdivision,a=o?s-n:i-e;let l=Math.ceil(a/Js);if(l<=1)return;const h=Math.floor(a/l);let c,m,f,_,p,d,g,y,x,P,M;for(l++,this._delta=h,o?(x=-ct-this._stepY,P=this._stepY,M=n):(x=-this._stepX,P=ct+this._stepX,M=e);t.nextPath();)if(!(t.pathSize<2)&&t.nextPoint())for(c=t.x,m=t.y;t.nextPoint();c=f,m=_){if(f=t.x,_=t.y,o){if(m===_||mP&&_>P)continue;p=Math.min(m,_),d=Math.max(m,_)}else{if(c===f||cP&&f>P)continue;p=Math.min(c,f),d=Math.max(c,f)}for(;pg&&ei(y,c,m,f,_,r)}this._accelerationMap=r}_nextInside(){for(;;){if(this._currentX>this._xMax){if(this._currentY++,this._currentY>this._yMax)return null;this._currentX=this._xMin,this._shiftOddRows&&this._currentY%2&&this._currentX--}let t=this._currentX*this._stepX+this._offsetX;this._shiftOddRows&&this._currentY%2&&(t+=.5*this._stepX);const e=this._currentY*this._stepY+this._offsetY;let i,n;if(this._currentX++,this._gridType===Ce.Random){const s=(this._currentX%W+W)%W,r=(this._currentY%W+W)%W;i=this._graphicOriginX+t+this._stepX*this._randomness*(.5-Pt._randValues[r*W+s])*2/3,n=this._graphicOriginY+e+this._stepY*this._randomness*(.5-Pt._randValues[r*W+s+1])*2/3}else i=this._graphicOriginX+this._cosAngle*t+this._sinAngle*e,n=this._graphicOriginY-this._sinAngle*t+this._cosAngle*e;if(!this._testInsidePolygon||this._isInsidePolygon(i,n,this._geometryCursor))return this._internalPlacement.setTranslate(i,n),this._internalPlacement}}_isInsidePolygon(t,e,i){if(this._accelerationMap==null)return Us(t,e,i);t+=ye,e+=ye;const n=this._verticalSubdivision,s=n?e:t,r=Math.floor((s-this._polygonMin)/this._delta),o=this._accelerationMap.get(r);if(!o)return!1;let a,l,h,c=0;for(const m of o){if(a=m[0],l=m[1],n){if(a[1]>e==l[1]>e)continue;h=(l[0]-a[0])*(e-a[1])-(l[1]-a[1])*(t-a[0])}else{if(a[0]>t==l[0]>t)continue;h=(l[1]-a[1])*(t-a[0])-(l[0]-a[0])*(e-a[1])}h>0?c++:c--}return c!==0}};function Us(u,t,e){let i,n,s,r,o=0;for(u+=ye,t+=ye,e.reset();e.nextPath();)if(e.nextPoint())for(i=e.x,n=e.y;e.nextPoint();i=s,n=r)s=e.x,r=e.y,n>t!=r>t&&((s-i)*(t-n)-(r-n)*(u-i)>0?o++:o--);return o!==0}function ei(u,t,e,i,n,s){let r=s.get(u);r||(r=[],s.set(u,r)),r.push([[t,e],[i,n]])}const qs=.001;let Fi=class ee{static local(){return ee.instance===null&&(ee.instance=new ee),ee.instance}execute(t,e,i,n,s){return new js(t,e,i)}};Fi.instance=null;let js=class extends ne{constructor(t,e,i){super(t),this._curveHelper=new at,this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._relativeTo=e.relativeTo,this._position=e.startPointOffset!==void 0?e.startPointOffset*i:0,this._epsilon=qs*i}processPath(t){const e=this._position;if(this._relativeTo===Et.SegmentMidpoint){if(this.iteratePath||(this.iteratePath=!0),t.nextPoint()){let[n,s]=[t.x,t.y],[r,o]=[0,0];for(;t.nextPoint();){r=t.x,o=t.y;const a=this._curveHelper.getLength(n,s,r,o);if(an){const m=(n-r)/c,[f,_]=this._curveHelper.getAngleCS(o,a,l,h,m),p=this._curveHelper.getCoord2D(o,a,l,h,m),d=s?-this._offset:this._offset;return this.internalPlacement.setTranslate(p[0]-d*_,p[1]+d*f),this._angleToLine&&(s?this.internalPlacement.setRotateCS(-f,-_):this.internalPlacement.setRotateCS(f,_)),this.internalPlacement}o=l,a=h,r+=c}}return null}};const Ks=1e-15;let Ei=class ie{static local(){return ie.instance===null&&(ie.instance=new ie),ie.instance}execute(t,e,i,n,s){return new Qs(t,e,i)}};Ei.instance=null;let Qs=class extends ne{constructor(t,e,i){super(t),this._curveHelper=new at,this._angleToLine=e.angleToLine===void 0||e.angleToLine,this._offset=e.offset!==void 0?e.offset*i:0,this._endPoints=e.placeOnEndPoints===void 0||e.placeOnEndPoints,this._controlPoints=e.placeOnControlPoints===void 0||e.placeOnControlPoints,this._regularVertices=e.placeOnRegularVertices===void 0||e.placeOnRegularVertices,this._tags=[],this._tagIterator=0}processPath(t){if(this.iteratePath||(this._preparePath(t),this.iteratePath=!0),this._tagIterator>=this._tags.length)return this._tags.length=0,this._tagIterator=0,this.iteratePath=!1,null;const e=this._tags[this._tagIterator];this._angleToLine&&this.internalPlacement.setRotate(e[2]);let i=e[0],n=e[1];if(this._offset!==0){const s=Math.cos(e[2]),r=Math.sin(e[2]);i-=this._offset*r,n+=this._offset*s}return this.internalPlacement.setTranslate(i,n),this._tagIterator++,this.internalPlacement}_preparePath(t){this._tags.length=0,this._tagIterator=0,t.seekPathStart();const e=t.isClosed();let i=0,n=!1,s=0,r=0;if(t.seekPathStart(),t.nextPoint()){let o=t.x,a=t.y,l=t.getControlPoint(),h=!0,c=t.nextPoint();for(;c;){const m=t.x,f=t.y,_=t.getControlPoint();(this._angleToLine||this._offset!==0)&&(s=this._curveHelper.getAngle(o,a,m,f,0)),h?(h=!1,e?(i=s,n=l):(this._endPoints||this._controlPoints&&l)&&this._tags.push([o,a,s])):l?this._controlPoints&&this._tags.push([o,a,me(r,s)]):this._regularVertices&&this._tags.push([o,a,me(r,s)]),(this._angleToLine||this._offset!==0)&&(r=this._curveHelper.getAngle(o,a,m,f,1)),c=t.nextPoint(),c||(e?_||n?this._controlPoints&&this._tags.push([m,f,me(r,i)]):this._regularVertices&&this._tags.push([m,f,me(r,i)]):(this._endPoints||this._controlPoints&&_)&&this._tags.push([m,f,r])),o=m,a=f,l=_}}this._tagIterator=0}};function me(u,t){const e=Math.PI;for(;Math.abs(t-u)>e+2*Ks;)t-u>e?t-=2*e:t+=2*e;return(u+t)/2}let Ni=class se{static local(){return se.instance===null&&(se.instance=new se),se.instance}execute(t,e,i,n,s){return new Zs(t,e,i)}};Ni.instance=null;let Zs=class{constructor(t,e,i){this._geometryCursor=t,this._offsetX=e.offsetX!==void 0?e.offsetX*i:0,this._offsetY=e.offsetY!==void 0?e.offsetY*i:0,this._method=e.method!==void 0?e.method:ce.OnPolygon,this._internalPlacement=new At}next(){const t=this._geometryCursor;return this._geometryCursor=null,t?this._polygonCenter(t):null}_polygonCenter(t){let e=!1;switch(this._method){case ce.CenterOfMass:{const i=Bi(t);i&&(this._internalPlacement.setTranslate(i[0]+this._offsetX,i[1]+this._offsetY),e=!0)}break;case ce.BoundingBoxCenter:{const i=Ye(t);i&&(this._internalPlacement.setTranslate((i[2]+i[0])/2+this._offsetX,(i[3]+i[1])/2+this._offsetY),e=!0)}break;case ce.OnPolygon:default:{const i=xs(t);i!==null&&(this._internalPlacement.setTranslate(i[0]+this._offsetX,i[1]+this._offsetY),e=!0)}}return e?this._internalPlacement:null}};function Re(u){if(!u)return null;switch(u.type){case"CIMGeometricEffectAddControlPoints":return gi.local();case"CIMGeometricEffectArrow":return vt.local();case"CIMGeometricEffectBuffer":return yi.local();case"CIMGeometricEffectControlMeasureLine":return Pi.local();case"CIMGeometricEffectCut":return xi.local();case"CIMGeometricEffectDashes":return Mi.local();case"CIMGeometricEffectDonut":return bi.local();case"CIMGeometricEffectJog":return Si.local();case"CIMGeometricEffectMove":return Ci.local();case"CIMGeometricEffectOffset":return vi.local();case"CIMGeometricEffectReverse":return wi.local();case"CIMGeometricEffectRotate":return ki.local();case"CIMGeometricEffectScale":return Ii.local();case"CIMGeometricEffectWave":return Li.local()}return null}function tr(u){if(!u)return null;switch(u.type){case"CIMMarkerPlacementAlongLineSameSize":return zi.local();case"CIMMarkerPlacementAtExtremities":return Oi.local();case"CIMMarkerPlacementAtRatioPositions":return Ai.local();case"CIMMarkerPlacementInsidePolygon":return Ti.local();case"CIMMarkerPlacementOnLine":return Fi.local();case"CIMMarkerPlacementOnVertices":return Ei.local();case"CIMMarkerPlacementPolygonCenter":return Ni.local()}return null}function Oe(u){const t=u.getFrame(0);if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)return t;const e=document.createElement("canvas");e.width=u.width,e.height=u.height;const i=e.getContext("2d");return t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0),e}let $i=class{constructor(t=0,e=0,i=0,n=0){this.x=t,this.y=e,this.width=i,this.height=n}get isEmpty(){return this.width<=0||this.height<=0}union(t){this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.width=Math.max(this.width,t.width),this.height=Math.max(this.height,t.height)}};function er(u){return`rgb(${u.slice(0,3).toString()})`}function Ae(u){return`rgba(${u.slice(0,3).toString()},${u[3]})`}let Gi=class{constructor(t){t&&(this._textRasterizationCanvas=t)}rasterizeText(t,e){var A,R;this._textRasterizationCanvas||(this._textRasterizationCanvas=document.createElement("canvas"));const i=this._textRasterizationCanvas,n=i.getContext("2d");this._setFontProperties(n,e),this._parameters=e,this._textLines=t.split(/\r?\n/),this._lineHeight=this._computeLineHeight();const{decoration:s,weight:r}=e.font;this._lineThroughWidthOffset=s&&s==="line-through"?.1*this._lineHeight:0;const o=e.backgroundColor!=null||e.borderLine!=null,a=o?Ji:0,l=this._computeTextWidth(n,e)+2*a,h=this._lineHeight*this._textLines.length+2*a;if(i.width=l+2*this._lineThroughWidthOffset,i.height=h,i.width===0||i.height===0)return i.width=i.height=1,{size:[0,0],image:new Uint32Array(0),sdf:!1,simplePattern:!1,anchorX:0,anchorY:0,canvas:i};this._renderedLineHeight=Math.round(this._lineHeight*e.pixelRatio),this._renderedHaloSize=rt(e.halo.size)*e.pixelRatio,this._renderedWidth=l*e.pixelRatio,this._renderedHeight=h*e.pixelRatio,this._lineThroughWidthOffset*=e.pixelRatio;const c=e.color??[0,0,0,0],m=e.halo&&e.halo.color?e.halo.color:[0,0,0,0];this._fillStyle=Ae(c),this._haloStyle=er(m);const f=this._renderedLineHeight,_=this._renderedHaloSize;n.save(),n.clearRect(0,0,i.width,i.height),this._setFontProperties(n,e);const p=a*e.pixelRatio,d=ir(n.textAlign,this._renderedWidth-2*p)+_+p,g=_+p,y=_>0;let x=this._lineThroughWidthOffset,P=0;if(o){n.save();const z=e.backgroundColor??[0,0,0,0],E=((A=e.borderLine)==null?void 0:A.color)??[0,0,0,0],V=2*rt(((R=e.borderLine)==null?void 0:R.size)??0);n.fillStyle=Ae(z),n.strokeStyle=Ae(E),n.lineWidth=V,n.fillRect(0,0,i.width,i.height),n.strokeRect(0,0,i.width,i.height),n.restore()}y&&this._renderHalo(n,d,g,x,P,e),P+=g,x+=d;for(const z of this._textLines)y?(n.globalCompositeOperation="destination-out",n.fillStyle="rgb(0, 0, 0)",n.fillText(z,x,P),n.globalCompositeOperation="source-over",n.fillStyle=this._fillStyle,n.fillText(z,x,P)):(n.fillStyle=this._fillStyle,n.fillText(z,x,P)),s&&s!=="none"&&this._renderDecoration(n,x,P,s,r),P+=f;n.restore();const M=this._renderedWidth+2*this._lineThroughWidthOffset,S=this._renderedHeight,v=n.getImageData(0,0,M,S),C=new Uint8Array(v.data);if(e.premultiplyColors){let z;for(let E=0;E600)&&(i+=.3*t.measureText("w").width),i+=2*rt(this._parameters.halo.size),Math.round(i)}_computeLineHeight(){let t=1.275*this._parameters.size;const e=this._parameters.font.decoration;return e&&e==="underline"&&(t*=1.3),Math.round(t+2*rt(this._parameters.halo.size))}_renderDecoration(t,e,i,n,s,r){const o=.9*this._lineHeight,a=s==="bold"?.06:s==="bolder"?.09:.04;switch(t.textAlign){case"center":e-=this._renderedWidth/2;break;case"right":e-=this._renderedWidth}const l=t.textBaseline;if(n==="underline")switch(l){case"top":i+=o;break;case"middle":i+=o/2}else if(n==="line-through")switch(l){case"top":i+=o/1.5;break;case"middle":i+=o/3}const h=r?1.5*r:Math.ceil(o*a);t.save(),t.beginPath(),t.strokeStyle=t.fillStyle,t.lineWidth=h,t.moveTo(e-this._lineThroughWidthOffset,i),t.lineTo(e+this._renderedWidth+2*this._lineThroughWidthOffset,i),t.stroke(),t.restore()}};function ir(u,t){return u==="center"?.5*t:u==="right"?t:0}var N,G;function bn(u){switch(u){case"left":return N.Left;case"right":return N.Right;case"center":return N.Center}}function Sn(u){switch(u){case"top":return G.Top;case"middle":return G.Center;case"baseline":return G.Baseline;case"bottom":return G.Bottom}}function Cn(u){switch(u){case"above-left":case"esriServerPointLabelPlacementAboveLeft":return[N.Right,G.Bottom];case"above-center":case"above-along":case"esriServerPointLabelPlacementAboveCenter":case"esriServerLinePlacementAboveAlong":return[N.Center,G.Bottom];case"above-right":case"esriServerPointLabelPlacementAboveRight":return[N.Left,G.Bottom];case"center-left":case"esriServerPointLabelPlacementCenterLeft":return[N.Right,G.Center];case"center-center":case"center-along":case"esriServerPointLabelPlacementCenterCenter":case"esriServerLinePlacementCenterAlong":case"always-horizontal":case"esriServerPolygonPlacementAlwaysHorizontal":return[N.Center,G.Center];case"center-right":case"esriServerPointLabelPlacementCenterRight":return[N.Left,G.Center];case"below-left":case"esriServerPointLabelPlacementBelowLeft":return[N.Right,G.Top];case"below-center":case"below-along":case"esriServerPointLabelPlacementBelowCenter":case"esriServerLinePlacementBelowAlong":return[N.Center,G.Top];case"below-right":case"esriServerPointLabelPlacementBelowRight":return[N.Left,G.Top];default:return console.debug(`Found invalid placement type ${u}`),[N.Center,G.Center]}}function vn(u){switch(u){case N.Right:return-1;case N.Center:return 0;case N.Left:return 1;default:return console.debug(`Found invalid horizontal alignment ${u}`),0}}function wn(u){switch(u){case G.Top:return 1;case G.Center:return 0;case G.Bottom:case G.Baseline:return-1;default:return console.debug(`Found invalid vertical alignment ${u}`),0}}function kn(u){switch(u){case"left":return N.Left;case"right":return N.Right;case"center":return N.Center}}function In(u){switch(u){case"above-along":case"below-along":case"center-along":case"esriServerLinePlacementAboveAlong":case"esriServerLinePlacementBelowAlong":case"esriServerLinePlacementCenterAlong":return!0;default:return!1}}(function(u){u[u.Left=-1]="Left",u[u.Center=0]="Center",u[u.Right=1]="Right"})(N||(N={})),function(u){u[u.Top=1]="Top",u[u.Center=0]="Center",u[u.Bottom=-1]="Bottom",u[u.Baseline=2]="Baseline"}(G||(G={}));const yt=Math.PI/180,sr=Ve.getLogger("esri.symbols.cim.CIMSymbolDrawHelper"),zt=4,Pe=10,rr=10,Ue=4,Ri=10;let xt=class q{constructor(t){this._t=t}static createIdentity(){return new q([1,0,0,0,1,0])}clone(){const t=this._t;return new q(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new q([t,0,0,0,e,0])}scale(t,e){const i=this._t;return i[0]*=t,i[1]*=t,i[2]*=t,i[3]*=e,i[4]*=e,i[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new q([0,0,t,0,0,e])}translate(t,e){const i=this._t;return i[2]+=t,i[5]+=e,this}static createRotate(t){const e=Math.cos(t),i=Math.sin(t);return new q([e,-i,0,i,e,0])}rotate(t){return q.multiply(this,q.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],i=Math.sqrt(t*t+e*e);return[t/i,e/i]}static multiply(t,e,i){const n=t._t,s=e._t,r=n[0]*s[0]+n[3]*s[1],o=n[1]*s[0]+n[4]*s[1],a=n[2]*s[0]+n[5]*s[1]+s[2],l=n[0]*s[3]+n[3]*s[4],h=n[1]*s[3]+n[4]*s[4],c=n[2]*s[3]+n[5]*s[4]+s[5],m=i._t;return m[0]=r,m[1]=o,m[2]=a,m[3]=l,m[4]=h,m[5]=c,i}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(e===0)return new q([0,0,0,0,0,0]);e=1/e;const i=(t[1]*t[5]-t[2]*t[4])*e,n=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,r=-t[1]*e,o=-t[3]*e,a=t[0]*e;return new q([s,r,i,o,a,n])}},Xi=class{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new ji(At,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||xt.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1)}setTransform(t,e){this._transfos=[t||xt.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e){const i=e?t.scaleRatio():1;xt.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*i)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1)}drawSymbol(t,e,i){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,i)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const i=t.symbolLayers;if(!i)return;const n=t.effects;if(n&&n.length>0){const s=this.executeEffects(n,e);if(s){let r=s.next();for(;r;)this.drawSymbolLayers(i,r.asJSON()),r=s.next()}}else this.drawSymbolLayers(i,e)}executeEffects(t,e){const i=this._resourceManager.geometryEngine;let n=new Ge($.fromJSONCIM(e));for(const s of t){const r=Re(s);r&&(n=r.execute(n,s,this.geomUnitsPerPoint(),null,i))}return n}drawSymbolLayers(t,e){let i=t.length;for(;i--;){const n=t[i];if(!n||n.enable===!1)continue;const s=n.effects;if(s&&s.length>0){const r=this.executeEffects(s,e);if(r){let o=null;for(;(o=r.next())&&(this.drawSymbolLayer(n,o.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(n,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const i=this._buildHatchPolyline(e,t,this.geomUnitsPerPoint());i&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,i),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const i=t.markerPlacement;if(i){const n=tr(i);if(n){const s=i.type==="CIMMarkerPlacementInsidePolygon"||i.type==="CIMMarkerPlacementPolygonCenter"&&i.clipAtBoundary;s&&this.pushClipPath(e);const r=n.execute($.fromJSONCIM(e),i,this.geomUnitsPerPoint(),null,this._resourceManager.geometryEngine);if(r){let o=null;for(;(o=r.next())&&(this.drawMarker(t,o),!this._earlyReturn););}s&&this.popClipPath()}}else{const n=this._placementPool.acquire();if(qe(e))n.tx=e.x,n.ty=e.y,this.drawMarker(t,n);else if(nt(e)){const s=Ki(e);s&&([n.tx,n.ty]=s,this.drawMarker(t,n))}else for(const s of e.points)if(n.tx=s[0],n.ty=s[1],this.drawMarker(t,n),this._earlyReturn)break;this._placementPool.release(n)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const i=this._resourceManager.getResource(t.url),n=b(t.size,Pe);if(i==null||n<=0)return;const s=i.width,r=i.height;if(!s||!r)return;const o=s/r,a=b(t.scaleX,1),l=xt.createIdentity(),h=t.anchorPoint;if(h){let d=h.x,g=h.y;t.anchorPointUnits!=="Absolute"&&(d*=n*o*a,g*=n),l.translate(-d,-g)}let c=b(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*yt);let m=b(t.offsetX),f=b(t.offsetY);if(m||f){if(this._mapRotation){const d=yt*this._mapRotation,g=Math.cos(d),y=Math.sin(d),x=m*y+f*g;m=m*g-f*y,f=x}l.translate(m,f)}const _=this.geomUnitsPerPoint();_!==1&&l.scale(_,_);const p=e.getAngle();p&&l.rotate(p),l.translate(e.tx,e.ty),this.push(l,!1),this.drawImage(t,n),this.pop()}drawVectorMarker(t,e){if(!t)return;const i=t.markerGraphics;if(!i)return;const n=b(t.size,Pe),s=t.frame,r=s?s.ymax-s.ymin:0,o=n&&r?n/r:1,a=xt.createIdentity();s&&a.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let p=l.x,d=l.y;t.anchorPointUnits!=="Absolute"?s&&(p*=s.xmax-s.xmin,d*=s.ymax-s.ymin):(p/=o,d/=o),a.translate(-p,-d)}o!==1&&a.scale(o,o);let h=b(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&a.rotate(h*yt);let c=b(t.offsetX),m=b(t.offsetY);if(c||m){if(this._mapRotation){const p=yt*this._mapRotation,d=Math.cos(p),g=Math.sin(p),y=c*g+m*d;c=c*d-m*g,m=y}a.translate(c,m)}const f=this.geomUnitsPerPoint();f!==1&&a.scale(f,f);const _=e.getAngle();_&&a.rotate(_),a.translate(e.tx,e.ty),this.push(a,t.scaleSymbolsProportionally);for(const p of i)if(p!=null&&p.symbol&&p.geometry||sr.error("Invalid marker graphic",p),this.drawSymbol(p.symbol,p.geometry,p.textString),this._earlyReturn)break;this.pop()}drawTextSymbol(t,e,i){if(!t||!qe(e)||b(t.height,Ri)<=0)return;const n=xt.createIdentity();let s=b(t.angle);s=-s,s&&n.rotate(s*yt);const r=b(t.offsetX),o=b(t.offsetY);(r||o)&&n.translate(r,o);const a=this.geomUnitsPerPoint();a!==1&&n.scale(a,a),n.translate(e.x,e.y),this.push(n,!1),this.drawText(t,i),this.pop()}_buildHatchPolyline(t,e,i){let n=b(t.separation,Ue)*i,s=b(t.rotation);if(n===0)return null;n<0&&(n=-n);let r=0;const o=.5*n;for(;r>o;)r-=n;for(;r<-o;)r+=n;const a=Qi();Zi(a,e),a[0]-=o,a[1]-=o,a[2]+=o,a[3]+=o;const l=[[a[0],a[1]],[a[0],a[3]],[a[2],a[3]],[a[2],a[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const h=Math.cos(s*yt),c=Math.sin(s*yt),m=-n*c,f=n*h;let _,p,d,g;r=b(t.offsetX)*i*c-b(t.offsetY)*i*h,_=d=Number.MAX_VALUE,p=g=-Number.MAX_VALUE;for(const C of l){const I=C[0],L=C[1],A=h*I+c*L,R=-c*I+h*L;_=Math.min(_,A),d=Math.min(d,R),p=Math.max(p,A),g=Math.max(g,R)}d=Math.floor(d/n)*n;let y=h*_-c*d-m*r/n,x=c*_+h*d-f*r/n,P=h*p-c*d-m*r/n,M=c*p+h*d-f*r/n;const S=1+Math.round((g-d)/n),v=[];for(let C=0;C0))if(nt(t))this._processPath(t.rings,0);else if(Mt(t))this._processPath(t.paths,0);else if(st(t)){const e=bt(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,i){if(!t||this._clipCount>0)return;const n=.5*this.transformSize(b(i,zt));if(nt(t))this._processPath(t.rings,n);else if(Mt(t))this._processPath(t.paths,n);else if(st(t)){const s=bt(t);s&&this._processPath(s.rings,n)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){nt(e)&&t.markerPlacement&&(t.markerPlacement.type==="CIMMarkerPlacementInsidePolygon"||t.markerPlacement.type==="CIMMarkerPlacementPolygonCenter"&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:i}=t,n=b(t.scaleX,1);let s=n*e,r=e;const o=this._resourceManager.getResource(i);e||o==null||(s=n*o.width,r=o.height),this._merge(this.transformPt([-s/2,-r/2]),0),this._merge(this.transformPt([-s/2,r/2]),0),this._merge(this.transformPt([s/2,-r/2]),0),this._merge(this.transformPt([s/2,r/2]),0)}drawText(t,e){if(!e||e.length===0)return;this._textRasterizer||(this._textRasterizer=new Gi);const i=Di(t),[n,s]=this._textRasterizer.computeTextSize(e,i);let r=0;switch(t.horizontalAlignment){case"Left":r=n/2;break;case"Right":r=-n/2}let o=0;switch(t.verticalAlignment){case"Bottom":o=s/2;break;case"Top":o=-s/2;break;case"Baseline":o=s/6}this._merge(this.transformPt([-n/2+r,-s/2+o]),0),this._merge(this.transformPt([-n/2+r,s/2+o]),0),this._merge(this.transformPt([n/2+r,-s/2+o]),0),this._merge(this.transformPt([n/2+r,s/2+o]),0)}_processPath(t,e){if(t)for(const i of t){const n=i?i.length:0;if(n>1){this._merge(this.transformPt(i[0]),e);for(let s=1;sthis._xmax&&(this._xmax=t[0]+e),t[1]-ethis._ymax&&(this._ymax=t[1]+e)}};class or extends Xi{constructor(t,e,i,n){super(e,i),this._applyAdditionalRenderProps=n,this._colorSubstitutionHelper=new vs,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(nt(t))this._buildPath(t.rings,!0);else if(Mt(t))this._buildPath(t.paths,!0);else if(st(t))this._buildPath(bt(t).rings,!0);else{if(!ve(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const i=this._ctx;i.fillStyle=typeof e=="string"?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",i.fill("evenodd")}drawSolidStroke(t,e,i,n,s,r){if(!t||!e||i===0)return;if(nt(t))this._buildPath(t.rings,!0);else if(Mt(t))this._buildPath(t.paths,!1);else{if(!st(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(bt(t).rings,!0)}const o=this._ctx;o.strokeStyle=typeof e=="string"?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",o.lineWidth=Math.max(this.transformSize(i),.5),this._setCapStyle(n),this._setJoinStyle(s),o.miterLimit=r,o.stroke()}pushClipPath(t){if(this._ctx.save(),nt(t))this._buildPath(t.rings,!0);else if(Mt(t))this._buildPath(t.paths,!0);else{if(!st(t))return;this._buildPath(bt(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:i,url:n,tintColor:s}=t,r=b(t.scaleX,1),o=this._resourceManager.getResource(n);if(o==null)return;let a=e*(o.width/o.height),l=e;e||(a=o.width,l=o.height);const h=It(n)||"src"in o&&It(o.src);let c="getFrame"in o?Oe(o):o;i&&(c=this._colorSubstitutionHelper.applyColorSubstituition(c,i)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,_]=this.getTransformAngle(),p=this.transformSize(1),d=this._ctx;d.save(),d.setTransform({m11:r*p*f,m12:r*p*_,m21:-p*_,m22:p*f,m41:m[0],m42:m[1]}),d.drawImage(c,-a/2,-l/2,a,l),d.restore()}drawText(t,e){if(!e||e.length===0)return;this._textRasterizer||(this._textRasterizer=new Gi);const i=Di(t);i.size*=this.transformSize(Ot(1));const n=this._textRasterizer.rasterizeText(e,i);if(!n)return;const{size:s,anchorX:r,anchorY:o,canvas:a}=n,l=s[0]*(r+.5),h=s[1]*(o-.5),c=this._ctx,m=this.transformPt([0,0]),[f,_]=this.getTransformAngle(),p=1;c.save(),c.setTransform({m11:p*f,m12:p*_,m21:-p*_,m22:p*f,m41:m[0]-p*l,m42:m[1]+p*h}),c.drawImage(a,0,0),c.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:i,height:n,offsetX:s,offsetY:r,rotation:o,scaleX:a,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(c==null)return;if(nt(t))this._buildPath(t.rings,!0);else if(Mt(t))this._buildPath(t.paths,!0);else if(st(t))this._buildPath(bt(t).rings,!0);else{if(!ve(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=It(h)||"src"in c&&It(c.src);let _,p="getFrame"in c?Oe(c):c;if(i&&(p=this._colorSubstitutionHelper.applyColorSubstituition(p,i)),this._applyAdditionalRenderProps){f||l&&(p=this._colorSubstitutionHelper.tintImageData(p,l)),_=m.createPattern(p,"repeat");const d=this.transformSize(1);o||(o=0),s?s*=d:s=0,r?r*=d:r=0,n&&(n*=d);const g=n?n/c.height:1,y=a&&n?a*n/c.width:1;if(o!==0||g!==1||y!==1||s!==0||r!==0){const x=new DOMMatrix;x.rotateSelf(0,0,-o).translateSelf(s,r).scaleSelf(y,g,1),_.setTransform(x)}}else _=m.createPattern(p,"repeat");m.save(),m.fillStyle=_,m.fill("evenodd"),m.restore()}drawPictureStroke(t,e){if(!t)return;let{colorSubstitutions:i,capStyle:n,joinStyle:s,miterLimit:r,tintColor:o,url:a,width:l}=e;const h=this._resourceManager.getResource(a);if(h==null)return;let c;if(nt(t))c=t.rings;else if(Mt(t))c=t.paths;else{if(!st(t))return ve(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;c=bt(t).rings}l||(l=h.width);const m=It(a)||"src"in h&&It(h.src);let f="getFrame"in h?Oe(h):h;i&&(f=this._colorSubstitutionHelper.applyColorSubstituition(f,i)),this._applyAdditionalRenderProps&&(m||o&&(f=this._colorSubstitutionHelper.tintImageData(f,o)));const _=Math.max(this.transformSize(rt(l)),.5),p=_/f.width,d=this._ctx,g=d.createPattern(f,"repeat-y");let y,x;d.save(),this._setCapStyle(n),this._setJoinStyle(s),r!==void 0&&(d.miterLimit=r),d.lineWidth=_;for(let P of c)if(P=ot(P),hr(P),P&&!(P.length<=1)){y=this.transformPt(P[0]);for(let M=1;M1){let r=this.transformPt(n[0]);i.moveTo(r[0],r[1]);for(let o=1;ou?{spatialReference:u.spatialReference,rings:[[[u.xmin,u.ymin],[u.xmin,u.ymax],[u.xmax,u.ymax],[u.xmax,u.ymin],[u.xmin,u.ymin]]]}:null;function Di(u,t=1){var g;const e=Be(u),i=Je(u.fontStyleName),n=u.fontFamilyName??Wi,{weight:s,style:r}=i,o=t*(u.height||5),a=ui(u.horizontalAlignment),l=fi(u.verticalAlignment),h=Ct(u),c=Ct(u.haloSymbol),m=c?t*(0|u.haloSize):0,f=((g=u.callout)==null?void 0:g.type)==="CIMBackgroundCallout"?u.callout.backgroundSymbol:null,_=Ct(f),p=$e(f),d=_e(f);return{color:h,size:o,horizontalAlignment:a,verticalAlignment:l,font:{family:n,style:Ui(r),weight:qi(s),decoration:e},halo:{size:m||0,color:c,style:r},backgroundColor:_,borderLine:p!=null&&d!=null?{size:p,color:d}:null,pixelRatio:1,premultiplyColors:!0}}const lr=1e-4;function hr(u){let t,e,i,n,s,r=u[0],o=1;for(;oh.width&&h.width>0?_*h.width:_),lineDashEnding:m,controlPointEnding:D.FullPattern}]:void 0;r.push({type:"CIMSolidStroke",capStyle:c?j.Round:j.Butt,enable:!0,width:h.width!=null&&h.width>.667?rt(Math.round(Ot(h.width))):h.width,color:Y(h.color),effects:f})}else!e||t.type!=="line-marker"||t.style!=="cross"&&t.style!=="x"?[o,a]=$t(n):([o,a]=$t(n),r.push({type:"CIMSolidStroke",enable:!0,width:e,color:Y(s)}));r.push({type:"CIMSolidFill",enable:!0,color:Y(s)});const l={type:"CIMPolygonSymbol",symbolLayers:r};return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:b(-t.angle),size:b(t.size||6*e),offsetX:b(t.xoffset),offsetY:b(t.yoffset),frame:o,markerGraphics:[{type:"CIMMarkerGraphic",geometry:a,symbol:l}]}]}}static fromCIMHatchFill(t,e){var a;const i=e*(t.separation??Ue),n=i/2,s=ot(t.lineSymbol);(a=s.symbolLayers)==null||a.forEach(l=>{var h;switch(l.type){case"CIMSolidStroke":l.width!=null&&(l.width*=e),(h=l.effects)==null||h.forEach(c=>{c.type==="CIMGeometricEffectDashes"&&(c.dashTemplate=c.dashTemplate.map(m=>m*e))});break;case"CIMVectorMarker":{l.size!=null&&(l.size*=e);const c=l.markerPlacement;c!=null&&"placementTemplate"in c&&(c.placementTemplate=c.placementTemplate.map(m=>m*e));break}}});let r=this._getLineSymbolPeriod(s)||ii;for(;r{xe.error(`Unsupported font ${n} in CIM symbol`)}))}}}static _getLineSymbolPeriod(t){if(t){const e=this._getEffectsRepeat(t.effects);if(e)return e;if(t.symbolLayers){for(const i of t.symbolLayers)if(i){const n=this._getEffectsRepeat(i.effects);if(n)return n;switch(i.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const s=this._getPlacementRepeat(i.markerPlacement);if(s)return s}}}}}return 0}static _getEffectsRepeat(t){if(t){for(const e of t)if(e)switch(e.type){case"CIMGeometricEffectDashes":{const i=e.dashTemplate;if(i&&i.length){let n=0;for(const s of i)n+=s;return 1&i.length&&(n*=2),n}break}case"CIMGeometricEffectWave":return e.period;default:xe.error(`unsupported geometric effect type ${e.type}`)}}return 0}static _getPlacementRepeat(t){if(t)switch(t.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAlongLineVariableSize":{const e=t.placementTemplate;if(e&&e.length){let i=0;for(const n of e)i+=+n;return 1&e.length&&(i*=2),i}break}}return 0}static fromCIMInsidePolygon(t){const e=t.markerPlacement,i={...t};i.markerPlacement=null,i.anchorPoint=null;const n=Math.abs(e.stepX),s=Math.abs(e.stepY),r=(e.randomness??100)/100;let o,a,l,h;if(e.gridType==="Random"){const c=Ot(_i),m=Math.max(Math.floor(c/n),1),f=Math.max(Math.floor(c/s),1);o=m*n/2,a=f*s/2,l=2*a;const _=new ci(e.seed),p=r*n/1.5,d=r*s/1.5;h=[];for(let g=0;g({type:"CIMMarkerGraphic",geometry:c,symbol:{type:"CIMPointSymbol",symbolLayers:[i]}})),size:l}}static getSize(t){if(t)switch(t.type){case"CIMTextSymbol":return t.height;case"CIMPointSymbol":{let e=0;if(t.symbolLayers){for(const i of t.symbolLayers)if(i)switch(i.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const n=i.size;n!=null&&n>e&&(e=n);break}}}return e}case"CIMLineSymbol":case"CIMPolygonSymbol":{let e=0;if(t.symbolLayers){for(const i of t.symbolLayers)if(i)switch(i.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const n=i.width;n!=null&&n>e&&(e=n);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(i.markerPlacement&&hs(i.markerPlacement)){const n=i.size;n!=null&&n>e&&(e=n)}}}return e}}}static getMarkerScaleRatio(t){if(t&&t.type==="CIMVectorMarker"&&t.scaleSymbolsProportionally!==!1&&t.frame&&t.size!=null){const e=t.frame.ymax-t.frame.ymin;return t.size/e}return 1}}class O{static findApplicableOverrides(t,e,i){if(t&&e){if(t.primitiveName){let n=!1;for(const s of i)if(s.primitiveName===t.primitiveName){n=!0;break}if(!n)for(const s of e)s.primitiveName===t.primitiveName&&i.push(s)}switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(t.effects)for(const n of t.effects)O.findApplicableOverrides(n,e,i);if(t.symbolLayers)for(const n of t.symbolLayers)O.findApplicableOverrides(n,e,i);break;case"CIMTextSymbol":break;case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":case"CIMSolidFill":case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":case"CIMVectorMarker":case"CIMCharacterMarker":case"CIMPictureMarker":if(t.effects)for(const n of t.effects)O.findApplicableOverrides(n,e,i);if(t.markerPlacement&&O.findApplicableOverrides(t.markerPlacement,e,i),t.type==="CIMVectorMarker"){if(t.markerGraphics)for(const n of t.markerGraphics)O.findApplicableOverrides(n,e,i),O.findApplicableOverrides(n.symbol,e,i)}else t.type==="CIMCharacterMarker"?O.findApplicableOverrides(t.symbol,e,i):t.type==="CIMHatchFill"?O.findApplicableOverrides(t.lineSymbol,e,i):t.type==="CIMPictureMarker"&&O.findApplicableOverrides(t.animatedSymbolProperties,e,i)}}}static findEffectOverrides(t,e,i){if(!e||!t)return;const n=t.length;for(let s=0;s{var f;return!((f=m.valueExpressionInfo)!=null&&f.expression.includes("$feature"))})),o||(l=l.filter(m=>{var f;return!((f=m.valueExpressionInfo)!=null&&f.expression.includes("$view"))})),l.length>0){const m=cs(e.attributes);await O.evaluateOverrides(l,e,{spatialReference:i,fields:m,geometryType:s},r,o)}O.applyOverrides(a,l)}return n&&O.applyDictionaryTextOverrides(a,e,n),a}static async evaluateOverrides(t,e,i,n,s){if(!e)return;let r;for(const o of t){const a=o.valueExpressionInfo;if(a&&(i!=null&&i.geometryType)){r||(r=[]),o.value=void 0;const l=mi(a.expression,i.spatialReference,i.fields).then(h=>{o.value=Lt(h,e,{$view:s},i.geometryType,n)});r.push(l)}}r!==void 0&&r.length>0&&await Promise.all(r)}static applyDictionaryTextOverrides(t,e,i,n="Normal"){if(t!=null&&t.type)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":case"CIMTextSymbol":{const s=t.symbolLayers;if(!s)return;for(const r of s)r&&r.type==="CIMVectorMarker"&&O.applyDictionaryTextOverrides(r,e,i,t.type==="CIMTextSymbol"?t.textCase:n)}break;case"CIMVectorMarker":{const s=t.markerGraphics;if(!s)return;for(const r of s)r&&O.applyDictionaryTextOverrides(r,e,i)}break;case"CIMMarkerGraphic":{const s=t.textString;if(s&&s.includes("[")){const r=us(s,i);t.textString=fs(e,r,n)}}}}static applyOverrides(t,e,i,n){if(t.primitiveName){for(const s of e)if(s.primitiveName===t.primitiveName){const r=yr(s.propertyName);if(n&&n.push({cim:t,nocapPropertyName:r,value:t[r]}),s.expression&&(s.value=O.toValue(s.propertyName,s.expression)),i){let o=!1;for(const a of i)a.primitiveName===t.primitiveName&&(o=!0);o||i.push(s)}s.value!=null&&(t[r]=s.value)}}switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(t.effects)for(const s of t.effects)O.applyOverrides(s,e,i,n);if(t.symbolLayers)for(const s of t.symbolLayers)O.applyOverrides(s,e,i,n);break;case"CIMTextSymbol":break;case"CIMSolidStroke":case"CIMSolidFill":case"CIMVectorMarker":if(t.effects)for(const s of t.effects)O.applyOverrides(s,e,i,n);if(t.type==="CIMVectorMarker"&&t.markerGraphics)for(const s of t.markerGraphics)O.applyOverrides(s,e,i,n),O.applyOverrides(s.symbol,e,i,n)}}static restoreOverrides(t){for(const e of t)e.cim[e.nocapPropertyName]=e.value}static buildOverrideKey(t){let e="";for(const i of t)i.value!==void 0&&(e+=`${i.primitiveName}${i.propertyName}${JSON.stringify(i.value)}`);return e}static toValue(t,e){if(t==="DashTemplate")return e.split(" ").map(i=>Number(i));if(t==="Color"){const i=new pi(e).toRgba();return i[3]*=255,i}return e}}const Yi=u=>{if(!u)return j.Butt;switch(u){case"butt":return j.Butt;case"square":return j.Square;case"round":return j.Round}},Vi=u=>{if(!u)return mt.Miter;switch(u){case"miter":return mt.Miter;case"round":return mt.Round;case"bevel":return mt.Bevel}},fr=u=>{if(u==null)return"Center";switch(u){case"left":return"Left";case"right":return"Right";case"center":return"Center"}},mr=u=>{if(u==null)return"Center";switch(u){case"baseline":return"Baseline";case"top":return"Top";case"middle":return"Center";case"bottom":return"Bottom"}},Y=u=>{if(!u)return[0,0,0,0];const{r:t,g:e,b:i,a:n}=u;return[t,e,i,255*n]},pr=(u,t)=>{const e=_r(t),i=dr(u);return e&&i?`${e}-${i}`:`${e}${i}`},_r=u=>{if(!u)return"";switch(u.toLowerCase()){case"bold":case"bolder":return"bold"}return""},dr=u=>{if(!u)return"";switch(u.toLowerCase()){case"italic":case"oblique":return"italic"}return""},Xe=(u,t)=>{const e=ms("safari")?.001:0,i=t==="butt";switch(u){case"dash":case"esriSLSDash":return i?[4,3]:[3,4];case"dash-dot":case"esriSLSDashDot":return i?[4,3,1,3]:[3,4,e,4];case"dot":case"esriSLSDot":return i?[1,3]:[e,4];case"long-dash":case"esriSLSLongDash":return i?[8,3]:[7,4];case"long-dash-dot":case"esriSLSLongDashDot":return i?[8,3,1,3]:[7,4,e,4];case"long-dash-dot-dot":case"esriSLSDashDotDot":return i?[8,3,1,3,1,3]:[7,4,e,4,e,4];case"short-dash":case"esriSLSShortDash":return i?[4,1]:[3,2];case"short-dash-dot":case"esriSLSShortDashDot":return i?[4,1,1,1]:[3,2,e,2];case"short-dash-dot-dot":case"esriSLSShortDashDotDot":return i?[4,1,1,1,1,1]:[3,2,e,2,e,2];case"short-dot":case"esriSLSShortDot":return i?[1,1]:[e,2];case"solid":case"esriSLSSolid":case"none":return xe.error("Unexpected: style does not require rasterization"),[0,0];default:return xe.error(`Tried to rasterize SLS, but found an unexpected style: ${u}!`),[0,0]}},$t=(u,t=100)=>{const e=t/2;let i,n;const s=u;if(s==="circle"||s==="esriSMSCircle"){let o=Math.acos(1-.25/e),a=Math.ceil(Hi/o/4);a===0&&(a=1),o=cr/a,a*=4;const l=[];l.push([e,0]);for(let h=1;hu==="vertical"||u==="horizontal"||u==="cross"||u==="esriSFSCross"||u==="esriSFSVertical"||u==="esriSFSHorizontal",yr=u=>u&&u.charAt(0).toLowerCase()+u.substr(1);function Pr(u,t,e){if(!(!u.effects||t.geometryEngine!=null)){if(t.geometryEnginePromise)return void e.push(t.geometryEnginePromise);ps(u.effects)&&(t.geometryEnginePromise=_s(),e.push(t.geometryEnginePromise),t.geometryEnginePromise.then(i=>t.geometryEngine=i))}}function ri(u){if(!u)return null;let t=null;const{cap:e,color:i,join:n,miterLimit:s,style:r,width:o}=u;return r!=="solid"&&r!=="none"&&r!=="esriSLSSolid"&&r!=="esriSLSNull"&&(t=[{type:"CIMGeometricEffectDashes",dashTemplate:Xe(r,e),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]),{type:"CIMSolidStroke",color:r!=="esriSLSNull"&&r!=="none"?Y(i):[0,0,0,0],capStyle:Yi(e),joinStyle:Vi(n),miterLimit:s,width:o,effects:t}}const ni=.05;function xr(u){return Math.max(Math.round(u/ni),1)*ni}const Mr=new Set(["StartTimeOffset","Duration","RepeatDelay"]);function br(u,t){return Mr.has(t)?xr(u):u}function Sr(u){var t;if(!u)return null;switch(u.type){case"CIMPointSymbol":{const e=u.symbolLayers;return e&&e.length===1?Sr(e[0]):null}case"CIMVectorMarker":{const e=u.markerGraphics;if(!e||e.length!==1)return null;const i=e[0];if(!i)return null;const n=i.geometry;if(!n)return null;const s=i.symbol;return!s||s.type!=="CIMPolygonSymbol"&&s.type!=="CIMLineSymbol"||(t=s.symbolLayers)!=null&&t.some(r=>!!r.effects)?null:{geom:n,asFill:s.type==="CIMPolygonSymbol"}}case"sdf":return{geom:u.geom,asFill:u.asFill}}return null}function Cr(u){return u?u.rings?u.rings:u.paths?u.paths:u.xmin!==void 0&&u.ymin!==void 0&&u.xmax!==void 0&&u.ymax!==void 0?[[[u.xmin,u.ymin],[u.xmin,u.ymax],[u.xmax,u.ymax],[u.xmax,u.ymin],[u.xmin,u.ymin]]]:null:null}function vr(u){let t=1/0,e=-1/0,i=1/0,n=-1/0;for(const s of u)for(const r of s)r[0]e&&(e=r[0]),r[1]n&&(n=r[1]);return new $i(t,i,e-t,n-i)}function oi(u){let t=1/0,e=-1/0,i=1/0,n=-1/0;for(const s of u)for(const r of s)r[0]e&&(e=r[0]),r[1]n&&(n=r[1]);return[t,i,e,n]}function ai(u){return u?u.rings?oi(u.rings):u.paths?oi(u.paths):st(u)?[u.xmin,u.ymin,u.xmax,u.ymax]:null:null}function li(u,t,e,i,n){const[s,r,o,a]=u;if(o0&&(P=(t.xmax-t.xmin)/(t.ymax-t.ymin),y=i.x/(e*P),x=i.y/e):(y=i.x,x=i.y)),t&&(y=.5*(t.xmax+t.xmin)+y*(t.xmax-t.xmin),x=.5*(t.ymax+t.ymin)+x*(t.ymax-t.ymin)),y-=s,x-=r,y*=_,x*=_,y+=f,x+=f;let M=y/p-.5,S=x/d-.5;return n&&e&&(M*=e*P,S*=e),[g,M,S]}function On(u){const t=Cr(u.geom),e=vr(t),i=128,n=di,s=Math.floor(.5*(.5*i-n)),r=(i-2*(s+n))/Math.max(e.width,e.height),o=Math.round(e.width*r)+2*s,a=Math.round(e.height*r)+2*s,l=[];for(const c of t)if(c&&c.length>1){const m=[];for(const f of c){let[_,p]=f;_-=e.x,p-=e.y,_*=r,p*=r,_+=s-.5,p+=s-.5,u.asFill?m.push([_,p]):m.push([Math.round(_),Math.round(p)])}if(u.asFill){const f=m.length-1;m[0][0]===m[f][0]&&m[0][1]===m[f][1]||m.push(m[0])}l.push(m)}const h=wr(l,o,a,s);return u.asFill&&kr(l,o,a,s,h),[Ir(h,s),o,a]}function wr(u,t,e,i){const n=t*e,s=new Array(n),r=i*i+1;for(let o=0;ot&&(g=t),y<0&&(y=0),x>e&&(x=e);const P=c[0]-h[0],M=c[1]-h[1],S=P*P+M*M;for(let v=d;vS?(I=c[0],L=c[1]):(A/=S,I=h[0]+A*P,L=h[1]+A*M);const R=(v-I)*(v-I)+(C-L)*(C-L),z=(e-C-1)*t+v;Rt-i&&(p=t-i),de-i&&(g=e-i);for(let y=d;yy==l[1]>y)continue;const x=(e-y-1)*t;for(let P=_;P>8^e)+i|0;while(--i!=0)}return(1+e/(1<<31))/2}function Or(u){return Math.floor(zr(u,Ar)*Tr)}const Ar=53290320,Tr=10,Fr=Ve.getLogger("esri.symbols.cim.cimAnalyzer");function Te(u){switch(u){case"Butt":return we.BUTT;case"Square":return we.SQUARE;default:return we.ROUND}}function Fe(u){switch(u){case"Bevel":return ke.BEVEL;case"Miter":return ke.MITER;default:return ke.ROUND}}function Er(u){const t=u.markerPlacement;return t&&t.angleToLine?ge.MAP:ge.SCREEN}class An{constructor(t,e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._resourceManager=t,this._info=e}async analyzeSymbolReference(t,e,i){if(this._cimLayers=i??[],!t)return this._cimLayers;if(t.primitiveOverrides){this._primitiveOverrides=t.primitiveOverrides,this._poMap={};const r=[],o=this._info;for(const a of this._primitiveOverrides){const l=a.valueExpressionInfo;if(l&&o){const h=l.expression,c=mi(h,o.spatialReference,o.fields).then(m=>{m!=null&&this._setPoMap(a.primitiveName,a.propertyName,m)});r.push(c)}else a.value!=null&&this._setPoMap(a.primitiveName,a.propertyName,a.value);r.length>0&&await Promise.all(r)}}const n=t.symbol,s=[];return kt.fetchResources(n,this._resourceManager,s),s.length>0&&await Promise.all(s),this._analyzeSymbol(n,e),this._cimLayers}_analyzeSymbol(t,e){switch(t==null?void 0:t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(t,e,1,0,0,0)}}_analyzeMultiLayerSymbol(t,e,i,n,s,r){const o=t==null?void 0:t.symbolLayers;if(!o)return;const a=t.effects;let l=ge.SCREEN;const h=kt.getSize(t)??0;t.type==="CIMPointSymbol"&&t.angleAlignment==="Map"&&(l=ge.MAP);const c=t.type==="CIMPolygonSymbol";let m=o.length;for(;m--;){const f=o[m];if(!f||f.enable===!1)continue;let _;a!=null&&a.length&&(_=[...a]);const p=f.effects;p!=null&&p.length&&(a?_.push(...p):_=[...p]);const d=[];let g;O.findEffectOverrides(_,this._primitiveOverrides,d),g=d.length>0?this._createEffectsOverrideFunction(_,d):_;const y=[];switch(O.findApplicableOverrides(f,this._primitiveOverrides,y),f.type){case"CIMSolidFill":this._analyzeSolidFill(f,g);break;case"CIMPictureFill":this._analyzePictureFill(f,g);break;case"CIMHatchFill":this._analyzeHatchFill(f,g);break;case"CIMGradientFill":this._analyzeGradientFill(f,g);break;case"CIMSolidStroke":this._analyzeSolidStroke(f,g,c,h);break;case"CIMPictureStroke":this._analyzePictureStroke(f,g,c,h);break;case"CIMGradientStroke":this._analyzeGradientStroke(f,g,c,h);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{t.type==="CIMLineSymbol"&&(l=Er(f));const x=[],P=f.primitiveName;P&&x.push(P),this._analyzeMarker(f,g,null,x,l,h,1,e,i,n,s,r);break}default:Fr.error("Cannot analyze CIM layer",f.type)}}}_analyzeSolidFill(t,e){const i=t.primitiveName,n=H(t.color),[s,r]=this._analyzePrimitiveOverrides(i,e,null,null),o=F(JSON.stringify(t)+r).toString();this._cimLayers.push({type:"fill",templateHash:o,materialHash:s?()=>o:o,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked,color:this._createOverrideFunction(i,"Color",n,X),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:e,applyRandomOffset:!1,sampleAlphaOnly:!0})}_analyzePictureFill(t,e){const i=t.primitiveName,n=ue(t),[s,r]=this._analyzePrimitiveOverrides(i,e,null,null),o=F(JSON.stringify(t)+r).toString(),a=F(`${t.url}${JSON.stringify(t.colorSubstitutions)}`).toString(),l=b(t.height,rr);let h=b(t.scaleX,1);if("width"in t&&typeof t.width=="number"){const c=t.width;let m=1;const f=this._resourceManager.getResource(t.url);f!=null&&(m=f.width/f.height),h/=m*(l/c)}this._cimLayers.push({type:"fill",templateHash:o,materialHash:s?()=>a:a,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked,effects:e,color:this._createOverrideFunction(i,"TintColor",n,X),height:this._createOverrideFunction(i,"Height",l),scaleX:this._createOverrideFunction(i,"ScaleX",h),angle:this._createOverrideFunction(i,"Rotation",b(t.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",b(t.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",b(t.offsetY)),url:t.url,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeHatchFill(t,e){var m,f;const i=t.primitiveName,n=this._analyzeMaterialOverrides(i,["Rotation","OffsetX","OffsetY"]);let[s,r]=this._analyzePrimitiveOverrides(i,e,null,null);const o=F(JSON.stringify(t)+r).toString(),a=F(`${t.separation}${JSON.stringify(t.lineSymbol)}`).toString();let l={r:255,g:255,b:255,a:1},h=!1;const c=(f=(m=t.lineSymbol)==null?void 0:m.symbolLayers)==null?void 0:f.find(_=>{var p;return _.type==="CIMSolidStroke"&&((p=this._poMap[_.primitiveName])==null?void 0:p.Color)!=null});if(c){l=H(c.color),l=this._createOverrideFunction(c.primitiveName,"Color",l,X);const _=typeof l=="function";s=s||_,h=c.color!=null||_}this._cimLayers.push({type:"fill",templateHash:o,materialHash:s&&n?this._createMaterialHashFunction(a,n):a,cim:t,materialOverrides:n,colorLocked:!!t.colorLocked,effects:e,color:l,height:this._createOverrideFunction(i,"Separation",b(t.separation,Ue)),scaleX:1,angle:this._createOverrideFunction(i,"Rotation",b(t.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",b(t.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",b(t.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!h})}_analyzeGradientFill(t,e){const i=t.primitiveName,[n,s]=this._analyzePrimitiveOverrides(i,e,null,null),r=F(JSON.stringify(t)+s).toString();this._cimLayers.push({type:"fill",templateHash:r,materialHash:n?()=>r:r,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked,effects:e,color:{r:128,g:128,b:128,a:1},height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeSolidStroke(t,e,i,n){const s=t.primitiveName,r=H(t.color),o=b(t.width,zt),a=Te(t.capStyle),l=Fe(t.joinStyle),h=t.miterLimit,[c,m]=this._analyzePrimitiveOverrides(s,e,null,null),f=F(JSON.stringify(t)+m).toString();let _,p;if(e&&e instanceof Array&&e.length>0){const d=e[e.length-1];if(d.type==="CIMGeometricEffectDashes"&&d.lineDashEnding==="NoConstraint"&&d.offsetAlongLine===null){const g=(e=[...e]).pop();_=g.dashTemplate,p=g.scaleDash}}this._cimLayers.push({type:"line",templateHash:f,materialHash:c?()=>f:f,cim:t,materialOverrides:null,isOutline:i,colorLocked:!!t.colorLocked,effects:e,color:this._createOverrideFunction(s,"Color",r,X),width:this._createOverrideFunction(s,"Width",o),cap:this._createOverrideFunction(s,"CapStyle",a),join:this._createOverrideFunction(s,"JoinStyle",l),miterLimit:h&&this._createOverrideFunction(s,"MiterLimit",h),referenceWidth:n,zOrder:Ee(t.name),dashTemplate:_,scaleDash:p,sampleAlphaOnly:!0})}_analyzePictureStroke(t,e,i,n){const s=F(`${t.url}${JSON.stringify(t.colorSubstitutions)}`).toString(),r=t.primitiveName,o=ue(t),a=b(t.width,zt),l=Te(t.capStyle),h=Fe(t.joinStyle),c=t.miterLimit,[m,f]=this._analyzePrimitiveOverrides(r,e,null,null),_=F(JSON.stringify(t)+f).toString();this._cimLayers.push({type:"line",templateHash:_,materialHash:m?()=>s:s,cim:t,materialOverrides:null,isOutline:i,colorLocked:!!t.colorLocked,effects:e,color:this._createOverrideFunction(r,"TintColor",o,X),width:this._createOverrideFunction(r,"Width",a),cap:this._createOverrideFunction(r,"CapStyle",l),join:this._createOverrideFunction(r,"JoinStyle",h),miterLimit:c&&this._createOverrideFunction(r,"MiterLimit",c),referenceWidth:n,zOrder:Ee(t.name),dashTemplate:null,scaleDash:!1,url:t.url,sampleAlphaOnly:!1})}_analyzeGradientStroke(t,e,i,n){const s=t.primitiveName,r=b(t.width,zt),o=Te(t.capStyle),a=Fe(t.joinStyle),l=t.miterLimit,[h,c]=this._analyzePrimitiveOverrides(s,e,null,null),m=F(JSON.stringify(t)+c).toString();this._cimLayers.push({type:"line",templateHash:m,materialHash:h?()=>m:m,cim:t,materialOverrides:null,isOutline:i,colorLocked:!!t.colorLocked,effects:e,color:{r:128,g:128,b:128,a:1},width:this._createOverrideFunction(s,"Width",r),cap:this._createOverrideFunction(s,"CapStyle",o),join:this._createOverrideFunction(s,"JoinStyle",a),miterLimit:l&&this._createOverrideFunction(s,"MiterLimit",l),referenceWidth:n,zOrder:Ee(t.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeMarker(t,e,i,n,s,r,o,a,l,h,c,m,f=!1){if(this._analyzeMarkerInsidePolygon(t,e))return;const _=b(t.size,Pe),p=b(t.rotation),d=b(t.offsetX),g=b(t.offsetY);let y=this._createOverrideFunction(t.primitiveName,"Size",_),x=this._createOverrideFunction(t.primitiveName,"Rotation",p),P=this._createOverrideFunction(t.primitiveName,"OffsetX",d),M=this._createOverrideFunction(t.primitiveName,"OffsetY",g);y=this._transformSize(y,o),x=this._transformRotation(x,!!t.rotateClockwise,h);const S=this._transformOffsetX(P,M,h,o,c),v=this._transformOffsetY(P,M,h,o,m);switch(P=S,M=v,t.type){case"CIMPictureMarker":this._analyzePictureMarker(t,e,i,n,s,r,y,x,P,M,t.colorLocked||f);break;case"CIMVectorMarker":this._analyzeVectorMarker(t,e,i,n,s,r,o,a,y,x,P,M,t.colorLocked||f)}}_analyzeMarkerInsidePolygon(t,e){const{markerPlacement:i,type:n}=t;if(!i||i.type!=="CIMMarkerPlacementInsidePolygon")return!1;if(n==="CIMVectorMarker"||n==="CIMPictureMarker"){const d=t.primitiveName;if(d){const[y,x]=this._analyzePrimitiveOverrides([d],e,null,null);if(y)return!1}const g=i.primitiveName;if(g){const[y,x]=this._analyzePrimitiveOverrides([g],e,null,null);if(y)return!1}if(n==="CIMVectorMarker"){const{markerGraphics:y}=t;if(y)for(const x of y){const{symbol:P}=x;if((P==null?void 0:P.type)==="CIMPolygonSymbol"&&P.symbolLayers){const{symbolLayers:M}=P;for(const S of M)if(S.type==="CIMSolidStroke")return!1}}}else{const{animatedSymbolProperties:y}=t;if(y)return!1}}const s=i,r=Math.abs(s.stepX),o=Math.abs(s.stepY);if(r===0||o===0)return!0;const a=new Set(["Rotation","OffsetX","OffsetY"]),l=this._primitiveOverrides.filter(d=>d.primitiveName!==t.primitiveName||!a.has(d.propertyName)),h="url"in t&&typeof t.url=="string"?t.url:void 0,c=F(JSON.stringify(t)).toString();let m,f,_=null;if(i.gridType==="Random"){const d=Ot(_i),g=Math.max(Math.floor(d/r),1),y=Math.max(Math.floor(d/o),1);m=o*y,_=x=>x?x*y:0,f=g*r/m}else i.shiftOddRows?(m=2*o,_=d=>d?2*d:0,f=r/o*.5):(m=o,_=null,f=r/o);const p=ue(t);return this._cimLayers.push({type:"fill",templateHash:c,materialHash:c,cim:t,materialOverrides:l,colorLocked:!!t.colorLocked,effects:e,color:p,height:this._createOverrideFunction(s.primitiveName,"StepY",m,_),scaleX:f,angle:s.gridAngle,offsetX:b(s.offsetX),offsetY:b(s.offsetY),url:h,applyRandomOffset:i.gridType==="Random",sampleAlphaOnly:!h,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(t,e,i,n,s,r,o,a,l,h,c){let m=b(t.scaleX,1);const f=ue(t),_=F(`${t.url}${JSON.stringify(t.colorSubstitutions)}${JSON.stringify(t.animatedSymbolProperties)}`).toString();i||(i=this._createMarkerPlacementOverrideFunction(t.markerPlacement));const p=this._createAnimatedSymbolPropertiesOverrideFunction(t.animatedSymbolProperties),[d,g]=this._analyzePrimitiveOverrides(n,e,i,p),y=F(JSON.stringify(t)+g).toString(),x=t.anchorPoint??{x:0,y:0};if("width"in t&&typeof t.width=="number"){const S=t.width;let v=1;const C=this._resourceManager.getResource(t.url);C!=null&&(v=C.width/C.height),m/=v*(b(t.size)/S)}function P(S,v){return p!=null?Qe(p,S,v):null}const M=t.animatedSymbolProperties&&t.animatedSymbolProperties.randomizeStartTime===!0?(S,v,C,I)=>{const L=Or(I??0),A=P(S,v);return _+`-MATERIALGROUP(${L})-ASP(${JSON.stringify(A)})`}:d?(S,v)=>{const C=P(S,v);return _+`-ASP(${JSON.stringify(C)})`}:_;this._cimLayers.push({type:"marker",templateHash:y,materialHash:M,cim:t,materialOverrides:null,colorLocked:!!t.colorLocked||!!c,effects:e,scaleSymbolsProportionally:!1,alignment:s,size:o,scaleX:this._createOverrideFunction(t.primitiveName,"ScaleX",m),rotation:a,offsetX:l,offsetY:h,color:this._createOverrideFunction(t.primitiveName,"TintColor",f,X),anchorPoint:{x:x.x,y:x.y},isAbsoluteAnchorPoint:t.anchorPointUnits!=="Relative",outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,frameHeight:0,rotateClockwise:!1,referenceSize:r,sizeRatio:1,markerPlacement:i,url:t.url,animatedSymbolProperties:p})}_analyzeVectorMarker(t,e,i,n,s,r,o,a,l,h,c,m,f){const _=t.markerGraphics;if(!_)return;const p=t.frame;let d=0,g=1;t.scaleSymbolsProportionally&&p&&(d=p.ymax-p.ymin,g=this._transformSize(l,1/d)),g=this._transformSize(g,o),i||(i=this._createMarkerPlacementOverrideFunction(t.markerPlacement));for(const y of _)if(y){const x=y.symbol;if(!x)continue;const P=y.primitiveName;P&&n.push(P);let M=c,S=m;if((x.type==="CIMPointSymbol"||x.type==="CIMTextSymbol")&&p){let v=0,C=0;const I=y.geometry;"x"in I&&"y"in I&&(v+=I.x-.5*(p.xmin+p.xmax),C+=I.y-.5*(p.ymin+p.ymax));const L=t.anchorPoint;L&&(t.anchorPointUnits==="Absolute"?(v-=L.x,C-=L.y):p&&(v-=(p.xmax-p.xmin)*L.x,C-=(p.ymax-p.ymin)*L.y)),M=this._transformOffsetX(v,C,h,g,c),S=this._transformOffsetY(v,C,h,g,m)}switch(x.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":a||$r(x)?this._analyzeMultiLayerGraphicNonSDF(t,e,i,null,y,n,s,r,d,!!f||!!t.colorLocked):this._analyzeMultiLayerGraphic(t,e,i,null,y,n,s,r,d,g,l,h,M,S,!!f||!!t.colorLocked);break;case"CIMTextSymbol":this._analyzeTextGraphic(t,e,i,y,n,s,r,d,g,l,h,M,S,!!f||!!t.colorLocked)}P&&n.pop()}}_analyzeMultiLayerGraphic(t,e,i,n,s,r,o,a,l,h,c,m,f,_,p){const d=s.symbol,g=d.symbolLayers;if(!g)return;let y=g.length;if(Nr(g))return void this._analyzeCompositeMarkerGraphic(t,e,i,n,s,g,r,o,a,l,c,m,f,_,!!p||!!t.colorLocked);const x=this._resourceManager.geometryEngine,P=hi.applyEffects(d.effects,s.geometry,x);if(P)for(;y--;){const M=g[y];if(!M||M.enable===!1)continue;const S=M.primitiveName;switch(S&&r.push(S),M.type){case"CIMSolidFill":case"CIMSolidStroke":{const v=hi.applyEffects(M.effects,P,x),C=ai(v);if(!C)continue;const I=t.anchorPointUnits!=="Relative",[L,A,R]=li(C,t.frame,t.size,t.anchorPoint,I),z=M.type==="CIMSolidFill",E={type:"sdf",geom:v,asFill:z},V=M.path,J=z?H(Ct(M)):V==null?H(_e(M)):{r:0,g:0,b:0,a:0},K=z?{r:0,g:0,b:0,a:0}:H(_e(M)),Q=$e(M)??0;if(!z&&!Q)break;const B=s.primitiveName;let lt=null;z&&!M.colorLocked&&(lt=this._createOverrideFunction(B,"FillColor",J,X));let pt=null;z||M.colorLocked||(pt=this._createOverrideFunction(B,"StrokeColor",K,X));const _t=this._createOverrideFunction(B,"StrokeWidth",Q);let ht=!1,T="";for(const Z of this._primitiveOverrides)r.includes(Z.primitiveName)&&(Z.value!=null?T+=`-${Z.primitiveName}-${Z.propertyName}-${JSON.stringify(Z.value)}`:Z.valueExpressionInfo&&(ht=!0));(e!=null&&typeof e=="function"||i!=null&&typeof i=="function")&&(ht=!0),(w(c)||w(m)||w(f)||w(_))&&(ht=!0);const oe=JSON.stringify({...t,markerGraphics:null}),Tt=F(JSON.stringify(E)+V).toString(),ae=F(JSON.stringify(s)+JSON.stringify(M)+oe+T).toString();this._cimLayers.push({type:"marker",templateHash:ae,materialHash:ht?()=>Tt:Tt,cim:E,materialOverrides:null,colorLocked:!!M.colorLocked||!!p,effects:e,scaleSymbolsProportionally:!!t.scaleSymbolsProportionally,alignment:o,anchorPoint:{x:A,y:R},isAbsoluteAnchorPoint:I,size:c,rotation:m,offsetX:f,offsetY:_,scaleX:1,frameHeight:l,rotateClockwise:!1,referenceSize:a,sizeRatio:L,color:w(lt)?lt:this._createOverrideFunction(S,"Color",J,X),outlineColor:w(pt)?pt:this._createOverrideFunction(S,"Color",K,X),outlineWidth:w(_t)?_t:this._createOverrideFunction(S,"Width",Q),markerPlacement:i,animatedSymbolProperties:n,path:V});break}case"CIMVectorMarker":M.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(t,e,i,n,s,r,o,a,l,!!p||!!M.colorLocked):this._analyzeMarker(M,e,i,r,o,a,h,!1,c,m,f,_,!!p||!!t.colorLocked);break;default:this._analyzeMultiLayerGraphicNonSDF(t,e,i,n,s,r,o,a,l,!!p||!!t.colorLocked)}S&&r.pop()}}_analyzeTextGraphic(t,e,i,n,s,r,o,a,l,h,c,m,f,_){var Z;const p=[];O.findApplicableOverrides(n,this._primitiveOverrides,p);const d=n.geometry;if(!("x"in d)||!("y"in d))return;const g=n.symbol,y=Be(g),x=Je(g.fontStyleName),P=gs(g.fontFamilyName);g.font={family:P,decoration:y,...x};let M=b(g.height,Ri),S=b(g.angle),v=b(g.offsetX),C=b(g.offsetY);M=this._transformSize(M,l),S=this._transformRotation(S,!1,c);const I=this._transformOffsetX(v,C,c,l,m),L=this._transformOffsetY(v,C,c,l,f);v=I,C=L;const A=H(Ct(g));let R=H(_e(g)),z=$e(g)??0;z||(R=H(Ct(g.haloSymbol)),z=b(g.haloSize)),z=this._transformSize(z,l);let E=!1;if((Z=g.symbol)!=null&&Z.symbolLayers)for(const dt of g.symbol.symbolLayers)Ct(dt)!=null&&(E=!!dt.colorLocked);const V=n.primitiveName;let J=null;E||(J=this._createOverrideFunction(V,"Color",A,X));let K=null,Q=null,B=0;if(g.callout&&g.callout.type==="CIMBackgroundCallout"){const dt=g.callout;if(dt.backgroundSymbol){const le=dt.backgroundSymbol.symbolLayers;if(le)for(const gt of le)gt.type==="CIMSolidFill"?K=H(gt.color):gt.type==="CIMSolidStroke"&&(Q=H(gt.color),B=b(gt.width,zt))}}const[lt,pt]=this._analyzePrimitiveOverrides(s,e,i,null),_t=JSON.stringify(t.effects)+Number(t.colorLocked||_).toString()+JSON.stringify(t.anchorPoint)+t.anchorPointUnits+JSON.stringify(t.markerPlacement)+t.size.toString(),ht=F(JSON.stringify(n)+_t+pt).toString();let T=this._createOverrideFunction(n.primitiveName,"TextString",n.textString??"",ys,g.textCase);if(T==null)return;const{fontStyleName:oe}=g,Tt=P+(oe?"-"+oe.toLowerCase():"-regular"),ae=Tt;typeof T=="string"&&T.includes("[")&&g.fieldMap&&(T=Ps(g.fieldMap,T,g.textCase)),this._cimLayers.push({type:"text",templateHash:ht,materialHash:lt||typeof T=="function"||/\[(.*?)\]/.test(T)?(dt,le,gt)=>ae+"-"+Qe(T,dt,le,gt):ae+"-"+F(T),cim:g,materialOverrides:null,colorLocked:!!_||!!E,effects:e,alignment:r,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:t.anchorPointUnits!=="Relative",fontName:Tt,decoration:y,weight:x.weight,style:x.style,size:M,angle:S,offsetX:v,offsetY:C,horizontalAlignment:ui(g.horizontalAlignment),verticalAlignment:fi(g.verticalAlignment),text:T,color:w(J)?J:A,outlineColor:R,outlineSize:z,backgroundColor:K,borderLineColor:Q,borderLineWidth:B,lineWidth:null,referenceSize:o,sizeRatio:1,markerPlacement:i})}_analyzeMultiLayerGraphicNonSDF(t,e,i,n,s,r,o,a,l,h){const c=this._buildSimpleMarker(t,s),m=t.primitiveName,f=this._analyzeMaterialOverrides(m,["Rotation","OffsetX","OffsetY"]),[_,p]=this._analyzePrimitiveOverrides(r,null,null,null),[d,g,y]=kt.getTextureAnchor(c,this._resourceManager),x=b(t.rotation),P=b(t.offsetX),M=b(t.offsetY),S=F(JSON.stringify(c)+p).toString(),v=f&&f.length>0||e!=null&&typeof e=="function";this._cimLayers.push({type:"marker",templateHash:S,materialHash:v&&f?this._createMaterialHashFunction(S,f):S,cim:c,materialOverrides:f,colorLocked:!!t.colorLocked||!!h,effects:e,scaleSymbolsProportionally:!!t.scaleSymbolsProportionally,alignment:o,anchorPoint:{x:d,y:g},isAbsoluteAnchorPoint:!1,size:b(t.size,Pe),rotation:this._createOverrideFunction(m,"Rotation",x),offsetX:this._createOverrideFunction(m,"OffsetX",P),offsetY:this._createOverrideFunction(m,"OffsetY",M),color:{r:255,g:255,b:255,a:1},outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,scaleX:1,frameHeight:l,rotateClockwise:!!t.rotateClockwise,referenceSize:a,sizeRatio:y/rt(t.size),markerPlacement:i,animatedSymbolProperties:n,avoidSDFRasterization:!0})}_buildSimpleMarker(t,e){return{type:t.type,enable:!0,name:t.name,colorLocked:t.colorLocked,primitiveName:t.primitiveName,anchorPoint:t.anchorPoint,anchorPointUnits:t.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:t.rotateClockwise,rotation:0,size:t.size,billboardMode3D:t.billboardMode3D,depth3D:t.depth3D,frame:t.frame,markerGraphics:[e],scaleSymbolsProportionally:t.scaleSymbolsProportionally,respectFrame:t.respectFrame,clippingPath:t.clippingPath}}_analyzeCompositeMarkerGraphic(t,e,i,n,s,r,o,a,l,h,c,m,f,_,p){const d=s.geometry,g=r[0],y=r[1],x=ai(d);if(!x)return;const P=t.anchorPointUnits!=="Relative",[M,S,v]=li(x,t.frame,t.size,t.anchorPoint,P),C={type:"sdf",geom:d,asFill:!0},I=y.path,L=y.primitiveName,A=g.primitiveName,R=H(y.color),z=H(g.color),E=b(g.width,zt),V=s.primitiveName;let J=null;y.colorLocked||p||(J=this._createOverrideFunction(V,"FillColor",R,X));let K=null;g.colorLocked||p||(K=this._createOverrideFunction(V,"StrokeColor",z,X));const Q=this._createOverrideFunction(V,"StrokeWidth",E);let B=!1,lt="";for(const T of this._primitiveOverrides)(T.primitiveName===L||T.primitiveName===A||o.includes(T.primitiveName))&&(T.value!=null?lt+=`-${T.primitiveName}-${T.propertyName}-${JSON.stringify(T.value)}`:T.valueExpressionInfo&&(B=!0));i!=null&&typeof i=="function"&&(B=!0),(w(c)||w(m)||w(f)||w(_))&&(B=!0);const pt=JSON.stringify({...t,markerGraphics:null}),_t=F(JSON.stringify(C)+I).toString(),ht=F(JSON.stringify(s)+JSON.stringify(y)+JSON.stringify(g)+pt+lt).toString();this._cimLayers.push({type:"marker",templateHash:ht,materialHash:B?()=>_t:_t,cim:C,materialOverrides:null,colorLocked:!!p,effects:e,scaleSymbolsProportionally:!!t.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:S,y:v},isAbsoluteAnchorPoint:P,size:c,rotation:m,offsetX:f,offsetY:_,scaleX:1,frameHeight:h,rotateClockwise:!1,referenceSize:l,sizeRatio:M,color:w(J)?J:this._createOverrideFunction(L,"Color",R,X),outlineColor:w(K)?K:this._createOverrideFunction(A,"Color",z,X),outlineWidth:w(Q)?Q:this._createOverrideFunction(A,"Width",E),markerPlacement:i,path:I,animatedSymbolProperties:n})}_createMaterialHashFunction(t,e){var n;const i=(n=this._info)==null?void 0:n.geometryType;if(i){const s=this._poMap;for(const r of e)if(r.valueExpressionInfo){const o=s[r.primitiveName]&&s[r.primitiveName][r.propertyName];o instanceof Nt&&(r.fn=(a,l,h)=>Lt(o,a,{$view:h},i,l))}}return(s,r,o)=>{for(const a of e)a.fn&&(a.value=a.fn(s,r,o));return F(t+O.buildOverrideKey(e)).toString()}}_setPoMap(t,e,i){let n;this._poMap[t]?n=this._poMap[t]:(n={},this._poMap[t]=n),n[e]=i}_createOverrideFunction(t,e,i,n,s){var l;if(t==null)return i;const r=this._poMap[t];if(r==null)return i;const o=r[e];if(typeof o=="string"||typeof o=="number"||o instanceof Array)return n?n.call(null,o,s):o;const a=(l=this._info)==null?void 0:l.geometryType;return o!=null&&o instanceof Nt&&a!=null?(h,c,m)=>{let f=Lt(o,h,{$view:m},a,c);return f!==null&&n&&(f=n.call(null,f,s)),f!==null?f:i}:i}_createEffectsOverrideFunction(t,e){var s;const i=this._poMap,n=(s=this._info)==null?void 0:s.geometryType;for(const r of e)if(r.valueExpressionInfo&&n){const o=i[r.primitiveName]&&i[r.primitiveName][r.propertyName];o instanceof Nt&&(r.fn=(a,l,h)=>Lt(o,a,{$view:h},n,l))}return(r,o,a)=>{for(const h of e)h.fn&&(h.value=h.fn(r,o,a));const l=[];for(let h of t){const c=h==null?void 0:h.primitiveName;if(c){let m=!1;for(const f of e)if(f.primitiveName===c){const _=Ne(f.propertyName);f.value!=null&&f.value!==h[_]&&(m||(h=ot(h),m=!0),h[_]=f.value)}}l.push(h)}return l}}_createMarkerPlacementOverrideFunction(t){var s;const e=[];if(O.findApplicableOverrides(t,this._primitiveOverrides,e),t==null||e.length===0)return t;const i=this._poMap,n=(s=this._info)==null?void 0:s.geometryType;for(const r of e)if(r.valueExpressionInfo&&n){const o=i[r.primitiveName]&&i[r.primitiveName][r.propertyName];o instanceof Nt&&(r.fn=(a,l,h)=>Lt(o,a,{$view:h},n,l))}return(r,o,a)=>{for(const c of e)c.fn&&(c.value=c.fn(r,o,a));const l=ot(t),h=t.primitiveName;for(const c of e)if(c.primitiveName===h){const m=Ne(c.propertyName);c.value!=null&&c.value!==l[m]&&(l[m]=c.value)}return l}}_createAnimatedSymbolPropertiesOverrideFunction(t){var n;const e=[];if(O.findApplicableOverrides(t,this._primitiveOverrides,e),t==null||e.length===0)return t;const i=(n=this._info)==null?void 0:n.geometryType;if(i){const s=this._poMap;for(const r of e)if(r.valueExpressionInfo){const o=s[r.primitiveName]&&s[r.primitiveName][r.propertyName];o instanceof Nt&&(r.fn=(a,l,h)=>Lt(o,a,{$view:h},i,l))}}return(s,r,o)=>{for(const h of e)h.fn&&(h.value=h.fn(s,r,o));const a=ot(t),l=t.primitiveName;for(const h of e)if(h.primitiveName===l){const c=Ne(h.propertyName);if(h.value!=null){const m=br(h.value,h.propertyName);m!==a[c]&&(a[c]=m)}}return a}}_analyzePrimitiveOverrides(t,e,i,n){let s=!1,r="";typeof t=="string"&&(t=[t]);for(const o of this._primitiveOverrides)t!=null&&t.includes(o.primitiveName)&&(o.value!=null?r+=`-${o.primitiveName}-${o.propertyName}-${JSON.stringify(o.value)}`:o.valueExpressionInfo&&(s=!0));return e!=null&&typeof e=="function"&&(s=!0),i!=null&&typeof i=="function"&&(s=!0),n!=null&&typeof n=="function"&&(s=!0),[s,r]}_analyzeMaterialOverrides(t,e){return this._primitiveOverrides.filter(i=>i.primitiveName!==t||!e.includes(i.propertyName))}_transformSize(t,e){return w(t)||w(e)?(i,n,s)=>(w(t)?t(i,n,s):t)*(w(e)?e(i,n,s):e):t*e}_transformRotation(t,e,i){return w(t)||w(i)?(n,s,r)=>{const o=w(t)?t(n,s,r):t,a=w(i)?i(n,s,r):i;return e?a-o:a+o}:e?i-t:i+t}_transformOffsetX(t,e,i,n,s){if(!(w(t)||w(e)||w(i)||w(n)||w(s))){const r=i*Math.PI/180;if(r){const o=Math.cos(r),a=Math.sin(r);return(o*t-a*e)*n+s}return t*n+s}return(r,o,a)=>{let l=w(i)?i(r,o,a):i;const h=w(n)?n(r,o,a):n,c=w(t)?t(r,o,a):t,m=w(s)?s(r,o,a):s;return l?(l*=Math.PI/180,(Math.cos(l)*c-Math.sin(l)*(w(e)?e(r,o,a):e))*h+m):c*h+m}}_transformOffsetY(t,e,i,n,s){if(!(w(t)||w(e)||w(i)||w(n)||w(s))){const r=i*Math.PI/180;if(r){const o=Math.cos(r);return(Math.sin(r)*t+o*e)*n+s}return e*n+s}return(r,o,a)=>{let l=w(i)?i(r,o,a):i;const h=w(n)?n(r,o,a):n,c=w(e)?e(r,o,a):e,m=w(s)?s(r,o,a):s;if(l){l*=Math.PI/180;const f=Math.cos(l);return(Math.sin(l)*(w(t)?t(r,o,a):t)+f*c)*h+m}return c*h+m}}}function Ee(u){if(u&&u.indexOf("Level_")===0){const t=parseInt(u.substr(6),10);if(!isNaN(t))return t}return 0}function X(u){if(!u||u.length===0)return null;const t=new pi(u).toRgba();return{r:t[0],g:t[1],b:t[2],a:t[3]}}function Ne(u){return u&&u.charAt(0).toLowerCase()+u.substr(1)}function Tn(u,t){if(!t||t.length===0)return u;const e=ot(u);return O.applyOverrides(e,t),e}const Nr=u=>u&&u.length===2&&u[0].enable&&u[1].enable&&u[0].type==="CIMSolidStroke"&&u[1].type==="CIMSolidFill"&&u[0].path==null&&u[1].path==null&&!u[0].effects&&!u[1].effects;function $r(u){const t=u.symbolLayers;if(!t||t.length!==2)return!1;const e=t.find(n=>{var s;return(s=n.effects)==null?void 0:s.find(r=>r.type==="CIMGeometricEffectDashes")}),i=t.find(n=>{var s;return(s=n.effects)==null?void 0:s.find(r=>r.type==="CIMGeometricEffectAddControlPoints")});return!!e&&!!i}export{xt as Q,Tn as V,Sr as a,On as b,G as c,Xe as d,or as e,hi as f,tr as g,bn as h,In as i,An as j,Sn as k,O as l,Ss as m,kt as n,Cn as o,vn as p,wn as q,Gi as r,kn as s,$i as t}; diff --git a/dist/assets/clientSideDefaults-F-CNnR0g.js b/dist/assets/clientSideDefaults-63pOkJ4Y.js similarity index 86% rename from dist/assets/clientSideDefaults-F-CNnR0g.js rename to dist/assets/clientSideDefaults-63pOkJ4Y.js index 2149a82..ea8f71a 100644 --- a/dist/assets/clientSideDefaults-F-CNnR0g.js +++ b/dist/assets/clientSideDefaults-63pOkJ4Y.js @@ -1,7 +1,7 @@ -import{dG as o,dH as u,dI as n,dJ as i,bI as a}from"./index-J0iiHjMT.js";import{t as l}from"./QueryEngineCapabilities-PzVpW5yD.js";function h(t){return{renderer:{type:"simple",symbol:t==="esriGeometryPoint"||t==="esriGeometryMultipoint"?o:t==="esriGeometryPolyline"?u:n}}}const c=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/;let d=1;function A(t,s){if(i("esri-csp-restrictions"))return()=>({[s]:null,...t});try{let e=`this.${s} = null;`;for(const r in t)e+=`this${c.test(r)?`.${r}`:`["${r}"]`} = ${JSON.stringify(t[r])};`;const p=new Function(` +import{dB as o,dC as u,dD as n,dE as a,ah as i}from"./index-pCX-0tJH.js";import{t as l}from"./QueryEngineCapabilities-PzVpW5yD.js";function h(t){return{renderer:{type:"simple",symbol:t==="esriGeometryPoint"||t==="esriGeometryMultipoint"?o:t==="esriGeometryPolyline"?u:n}}}const c=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/;let d=1;function A(t,s){if(a("esri-csp-restrictions"))return()=>({[s]:null,...t});try{let e=`this.${s} = null;`;for(const r in t)e+=`this${c.test(r)?`.${r}`:`["${r}"]`} = ${JSON.stringify(t[r])};`;const p=new Function(` return class AttributesClass$${d++} { constructor() { ${e}; } } - `)();return()=>new p}catch{return()=>({[s]:null,...t})}}function $(t={}){return[{name:"New Feature",description:"",prototype:{attributes:a(t)}}]}function f(t,s){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:s,supportsDelete:s,supportsEditing:s,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:s,supportsExceedsLimitStatistics:!0,supportsAsyncConvert3D:!1},query:l,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsGeometryUpdate:s,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}export{$ as a,A as i,f as l,h as o}; + `)();return()=>new p}catch{return()=>({[s]:null,...t})}}function $(t={}){return[{name:"New Feature",description:"",prototype:{attributes:i(t)}}]}function f(t,s){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:t},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:s,supportsDelete:s,supportsEditing:s,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:s,supportsExceedsLimitStatistics:!0,supportsAsyncConvert3D:!1},query:l,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsGeometryUpdate:s,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}export{$ as a,A as i,f as l,h as o}; diff --git a/dist/assets/conditionalSlot-e55zipTI.js b/dist/assets/conditionalSlot-OgY0Ln74.js similarity index 83% rename from dist/assets/conditionalSlot-e55zipTI.js rename to dist/assets/conditionalSlot-OgY0Ln74.js index b2b0a75..79bc8f2 100644 --- a/dist/assets/conditionalSlot-e55zipTI.js +++ b/dist/assets/conditionalSlot-OgY0Ln74.js @@ -1,4 +1,4 @@ -import{cn as c}from"./index-J0iiHjMT.js";import{c as i}from"./observers-JyBmMU24.js";/*! +import{aY as c}from"./index-pCX-0tJH.js";import{c as i}from"./observers-eNe735aq.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/createConnection-4ppGVnSc.js b/dist/assets/createConnection-iXdhuUHv.js similarity index 71% rename from dist/assets/createConnection-4ppGVnSc.js rename to dist/assets/createConnection-iXdhuUHv.js index e8ba23c..5a8f7bf 100644 --- a/dist/assets/createConnection-4ppGVnSc.js +++ b/dist/assets/createConnection-iXdhuUHv.js @@ -1,7 +1,7 @@ -import{K as L,E as a,e as d,y as p,c as S,dB as v,l5 as F,Z as c,mo as N,bH as C,bW as O,dy as E,de as x,ca as P,ar as W}from"./index-J0iiHjMT.js";import{c as k}from"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";let m=class extends L.EventedAccessor{destroy(){this.emit("destroy")}get connectionError(){return this.errorString?new a("stream-connection",this.errorString):null}onFeature(t){this.emit("data-received",t)}onMessage(t){this.emit("message-received",t)}};d([p({readOnly:!0})],m.prototype,"connectionError",null),m=d([S("esri.layers.support.StreamConnection")],m);const R=m;var g;(function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"})(g||(g={}));let f=class extends R{constructor(t){super(),this._outstandingMessages=[],this.errorString=null;const{geometryType:r,spatialReference:s,sourceSpatialReference:o}=t;this._config=t,this._featureZScaler=v(r,o,s),this._open()}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),this._websocket!=null&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(this._websocket==null)return"disconnected";switch(this._websocket.readyState){case g.CONNECTING:case g.OPEN:return"connected";case g.CLOSING:case g.CLOSED:return"disconnected"}}sendMessageToSocket(t){this._websocket!=null?this._websocket.send(JSON.stringify(t)):this._outstandingMessages.push(t)}sendMessageToClient(t){this._onMessage(t)}updateCustomParameters(t){this._config.customParameters=t,this._websocket!=null&&this._websocket.close()}async _tryCreateWebSocket(t=this._config.source.path,r=1e3,s=0){try{if(this.destroyed)return;const o=F(t,this._config.customParameters??{});this._websocket=await this._createWebSocket(o),this.notifyChange("connectionStatus")}catch(o){const n=r/1e3;return this._config.maxReconnectionAttempts&&s>=this._config.maxReconnectionAttempts?(c.getLogger(this).error(new a("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(c.getLogger(this).error(new a("websocket-connection",`Failed to connect. Attempting to reconnect in ${n}s`,o)),await N(r),this._tryCreateWebSocket(t,Math.min(1.5*r,1e3*this._config.maxReconnectionInterval),s+1))}}_setWebSocketJSONParseHandler(t){t.onmessage=r=>{try{const s=JSON.parse(r.data);this._onMessage(s)}catch(s){return void c.getLogger(this).error(new a("websocket-connection","Failed to parse message, invalid JSON",{error:s}))}}}_createWebSocket(t){return new Promise((r,s)=>{const o=new WebSocket(t);o.onopen=()=>{if(o.onopen=null,this.destroyed)return o.onclose=null,void o.close();o.onclose=n=>this._onClose(n),o.onerror=n=>this._onError(n),this._setWebSocketJSONParseHandler(o),r(o)},o.onclose=n=>{o.onopen=o.onclose=null,s(n)}})}async _handshake(t=1e4){const r=this._websocket;if(r==null)return;const s=C(),o=r.onmessage,{filter:n,outFields:u,spatialReference:l}=this._config;return s.timeout(t),r.onmessage=h=>{var w;let i=null;try{i=JSON.parse(h.data)}catch{}i&&typeof i=="object"||(c.getLogger(this).error(new a("websocket-connection","Protocol violation. Handshake failed - malformed message",h.data)),s.reject(),this.destroy()),((w=i.spatialReference)==null?void 0:w.wkid)!==(l==null?void 0:l.wkid)&&(c.getLogger(this).error(new a("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${l.wkid}`,h.data)),s.reject(),this.destroy()),i.format!=="json"&&(c.getLogger(this).error(new a("websocket-connection","Protocol violation. Handshake failed - format is not set",h.data)),s.reject(),this.destroy()),n&&i.filter!==n&&c.getLogger(this).error(new a("websocket-connection","Tried to set filter, but server doesn't support it")),u&&i.outFields!==u&&c.getLogger(this).error(new a("websocket-connection","Tried to set outFields, but server doesn't support it")),r.onmessage=o;for(const y of this._outstandingMessages)r.send(JSON.stringify(y));this._outstandingMessages=[],s.resolve()},r.send(JSON.stringify({filter:n,outFields:u,format:"json",spatialReference:{wkid:l.wkid}})),s.promise}_onMessage(t){if(this.onMessage(t),"type"in t)switch(t.type){case"features":case"featureResult":for(const r of t.features)this._featureZScaler!=null&&this._featureZScaler(r.geometry),this.onFeature(r)}}_onError(t){const r="Encountered an error over WebSocket connection";this._set("errorString",r),c.getLogger(this).error("websocket-connection",r)}_onClose(t){this._websocket=null,this.notifyChange("connectionStatus"),t.code!==1e3&&c.getLogger(this).error("websocket-connection",`WebSocket closed unexpectedly with error code ${t.code}`),this.destroyed||this._open()}};d([p()],f.prototype,"connectionStatus",null),d([p()],f.prototype,"errorString",void 0),f=d([S("esri.layers.graphics.sources.connections.WebSocketConnection")],f);const M=1e4,T={maxQueryDepth:5,maxRecordCountFactor:3};let b=class extends f{constructor(e){super({...T,...e}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||c.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const t=this._fetchWebSocketUrl(e.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(t);const{filter:r,outFields:s}=this._config;this.destroyed||this._setFilter(r,s)}_onMessage(e){if("attributes"in e){let t;try{t=this._enrich(e),this._featureZScaler!=null&&this._featureZScaler(t.geometry)}catch(r){return void c.getLogger(this).error(new a("geoevent-connection","Failed to parse message",r))}this.onFeature(t)}else this.onMessage(e)}async _fetchServiceDefinition(e){const t={f:"json",...this._config.customParameters},r=O(e.path,{query:t,responseType:"json"}),s=(await r).data;return this._serviceDefinition=s,s}_fetchWebSocketUrl(e,t){const r=e[0],{urls:s,token:o}=r,n=this._inferWebSocketBaseUrl(s);return F(`${n}/subscribe`,{outSR:""+t.wkid,token:o})}_inferWebSocketBaseUrl(e){if(e.length===1)return e[0];for(const t of e)if(t.includes("wss"))return t;return c.getLogger(this).error(new a("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const r=this._websocket;if(r==null||e==null&&t==null)return;const s=JSON.stringify({filter:this._serializeFilter(e,t)});let o=!1;const n=C(),u=()=>{o||(this.destroyed||this._websocket!==r||c.getLogger(this).error(new a("geoevent-connection","Server timed out when setting filter")),n.reject())},l=h=>{const i=JSON.parse(h.data);i.filter&&(i.error&&(c.getLogger(this).error(new a("geoevent-connection","Failed to set service filter",i.error)),this._set("errorString",`Could not set service filter - ${i.error}`),n.reject(i.error)),this._setWebSocketJSONParseHandler(r),o=!0,n.resolve())};return r.onmessage=l,r.send(s),setTimeout(u,M),n.promise}_serializeFilter(e,t){const r={};if(e==null&&t==null)return r;if(e!=null&&e.geometry)try{const s=E(e.geometry);if(s.type!=="extent")throw new a(`Expected extent but found type ${s.type}`);r.geometry=JSON.stringify(s.shiftCentralMeridian())}catch(s){c.getLogger(this).error(new a("geoevent-connection","Encountered an error when setting connection geometryDefinition",s))}return e!=null&&e.where&&e.where!=="1 = 1"&&e.where!=="1=1"&&(r.where=e.where),t!=null&&(r.outFields=t.join(",")),r}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,r=e.attributes[t],s=this._relatedFeatures.get(r);if(!s)return c.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:o,geometry:n}=s;for(const u in o)e.attributes[u]=o[u];return n&&(e.geometry=n),e.geometry||e.centroid||c.getLogger(this).error(new a("geoevent-connection","Found malformed feature - no geometry found",e)),e}async _queryBuddyServices(){try{const{relatedFeatures:e,keepLatestArchive:t}=this._serviceDefinition,r=this._queryRelatedFeatures(e),s=this._queryArchive(t);await r;const o=await s;if(!o)return;for(const n of o.features)this.onFeature(this._enrich(n))}catch(e){c.getLogger(this).error(new a("geoevent-connection","Encountered an error when querying buddy services",{error:e}))}}async _queryRelatedFeatures(e){if(!e)return;const t=await this._queryBuddy(e.featuresUrl);this._addRelatedFeatures(t)}async _queryArchive(e){if(e)return this._queryBuddy(e.featuresUrl)}async _queryBuddy(e){var y;const t=new(await x(()=>import("./FeatureLayer--S4epFk-.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))).default({url:e}),{capabilities:r}=await t.load(),s=r.query.supportsMaxRecordCountFactor,o=r.query.supportsPagination,n=r.query.supportsCentroid,u=this._config.maxRecordCountFactor,l=t.capabilities.query.maxRecordCount,h=s?l*u:l,i=new P;if(i.outFields=this._config.outFields??["*"],i.where=((y=this._config.filter)==null?void 0:y.where)??"1=1",i.returnGeometry=!0,i.returnExceededLimitFeatures=!0,i.outSpatialReference=W.fromJSON(this._config.spatialReference),n&&(i.returnCentroid=!0),s&&(i.maxRecordCountFactor=u),o)return i.num=h,t.destroy(),this._queryPages(e,i);const w=await k(e,i,this._config.sourceSpatialReference);return t.destroy(),w.data}async _queryPages(e,t,r=[],s=0){t.start=t.num!=null?s*t.num:null;const{data:o}=await k(e,t,this._config.sourceSpatialReference);return o.exceededTransferLimit&&s<(this._config.maxQueryDepth??0)?(o.features.forEach(n=>r.push(n)),this._queryPages(e,t,r,s+1)):(r.forEach(n=>o.features.push(n)),o)}_addRelatedFeatures(e){const t=new Map,r=e.features,s=this._serviceDefinition.relatedFeatures.joinField;for(const o of r){const n=o.attributes[s];t.set(n,o)}this._relatedFeatures=t}};b=d([S("esri.layers.graphics.sources.connections.GeoEventConnection")],b);const q=b;let _=class extends R{constructor(e){super(),this.connectionStatus="connected",this.errorString=null;const{geometryType:t,spatialReference:r,sourceSpatialReference:s}=e;this._featureZScaler=v(t,s,r)}updateCustomParameters(e){}sendMessageToSocket(e){}sendMessageToClient(e){if("type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)this._featureZScaler!=null&&this._featureZScaler(t.geometry),this.onFeature(t)}this.onMessage(e)}};d([p()],_.prototype,"connectionStatus",void 0),d([p()],_.prototype,"errorString",void 0),_=d([S("esri.layers.support.ClientSideConnection")],_);function Z(e,t,r,s,o,n,u,l){const h={source:e,sourceSpatialReference:t,spatialReference:r,geometryType:s,filter:o,maxReconnectionAttempts:n,maxReconnectionInterval:u,customParameters:l};return e?e.path.startsWith("wss://")||e.path.startsWith("ws://")?new f(h):new q(h):new _(h)}export{Z as createConnection}; +import{z as L,r as a,e as d,y as p,c as S,j2 as v,lc as F,R as c,mw as N,ag as C,av as O,fZ as x,de as E,aL as P,d2 as M,nU as k}from"./index-pCX-0tJH.js";let m=class extends L.EventedAccessor{destroy(){this.emit("destroy")}get connectionError(){return this.errorString?new a("stream-connection",this.errorString):null}onFeature(t){this.emit("data-received",t)}onMessage(t){this.emit("message-received",t)}};d([p({readOnly:!0})],m.prototype,"connectionError",null),m=d([S("esri.layers.support.StreamConnection")],m);const R=m;var g;(function(e){e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED"})(g||(g={}));let f=class extends R{constructor(t){super(),this._outstandingMessages=[],this.errorString=null;const{geometryType:r,spatialReference:s,sourceSpatialReference:o}=t;this._config=t,this._featureZScaler=v(r,o,s),this._open()}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),this._websocket!=null&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(this._websocket==null)return"disconnected";switch(this._websocket.readyState){case g.CONNECTING:case g.OPEN:return"connected";case g.CLOSING:case g.CLOSED:return"disconnected"}}sendMessageToSocket(t){this._websocket!=null?this._websocket.send(JSON.stringify(t)):this._outstandingMessages.push(t)}sendMessageToClient(t){this._onMessage(t)}updateCustomParameters(t){this._config.customParameters=t,this._websocket!=null&&this._websocket.close()}async _tryCreateWebSocket(t=this._config.source.path,r=1e3,s=0){try{if(this.destroyed)return;const o=F(t,this._config.customParameters??{});this._websocket=await this._createWebSocket(o),this.notifyChange("connectionStatus")}catch(o){const n=r/1e3;return this._config.maxReconnectionAttempts&&s>=this._config.maxReconnectionAttempts?(c.getLogger(this).error(new a("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(c.getLogger(this).error(new a("websocket-connection",`Failed to connect. Attempting to reconnect in ${n}s`,o)),await N(r),this._tryCreateWebSocket(t,Math.min(1.5*r,1e3*this._config.maxReconnectionInterval),s+1))}}_setWebSocketJSONParseHandler(t){t.onmessage=r=>{try{const s=JSON.parse(r.data);this._onMessage(s)}catch(s){return void c.getLogger(this).error(new a("websocket-connection","Failed to parse message, invalid JSON",{error:s}))}}}_createWebSocket(t){return new Promise((r,s)=>{const o=new WebSocket(t);o.onopen=()=>{if(o.onopen=null,this.destroyed)return o.onclose=null,void o.close();o.onclose=n=>this._onClose(n),o.onerror=n=>this._onError(n),this._setWebSocketJSONParseHandler(o),r(o)},o.onclose=n=>{o.onopen=o.onclose=null,s(n)}})}async _handshake(t=1e4){const r=this._websocket;if(r==null)return;const s=C(),o=r.onmessage,{filter:n,outFields:u,spatialReference:l}=this._config;return s.timeout(t),r.onmessage=h=>{var w;let i=null;try{i=JSON.parse(h.data)}catch{}i&&typeof i=="object"||(c.getLogger(this).error(new a("websocket-connection","Protocol violation. Handshake failed - malformed message",h.data)),s.reject(),this.destroy()),((w=i.spatialReference)==null?void 0:w.wkid)!==(l==null?void 0:l.wkid)&&(c.getLogger(this).error(new a("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${l.wkid}`,h.data)),s.reject(),this.destroy()),i.format!=="json"&&(c.getLogger(this).error(new a("websocket-connection","Protocol violation. Handshake failed - format is not set",h.data)),s.reject(),this.destroy()),n&&i.filter!==n&&c.getLogger(this).error(new a("websocket-connection","Tried to set filter, but server doesn't support it")),u&&i.outFields!==u&&c.getLogger(this).error(new a("websocket-connection","Tried to set outFields, but server doesn't support it")),r.onmessage=o;for(const y of this._outstandingMessages)r.send(JSON.stringify(y));this._outstandingMessages=[],s.resolve()},r.send(JSON.stringify({filter:n,outFields:u,format:"json",spatialReference:{wkid:l.wkid}})),s.promise}_onMessage(t){if(this.onMessage(t),"type"in t)switch(t.type){case"features":case"featureResult":for(const r of t.features)this._featureZScaler!=null&&this._featureZScaler(r.geometry),this.onFeature(r)}}_onError(t){const r="Encountered an error over WebSocket connection";this._set("errorString",r),c.getLogger(this).error("websocket-connection",r)}_onClose(t){this._websocket=null,this.notifyChange("connectionStatus"),t.code!==1e3&&c.getLogger(this).error("websocket-connection",`WebSocket closed unexpectedly with error code ${t.code}`),this.destroyed||this._open()}};d([p()],f.prototype,"connectionStatus",null),d([p()],f.prototype,"errorString",void 0),f=d([S("esri.layers.graphics.sources.connections.WebSocketConnection")],f);const W=1e4,T={maxQueryDepth:5,maxRecordCountFactor:3};let b=class extends f{constructor(e){super({...T,...e}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||c.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const t=this._fetchWebSocketUrl(e.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(t);const{filter:r,outFields:s}=this._config;this.destroyed||this._setFilter(r,s)}_onMessage(e){if("attributes"in e){let t;try{t=this._enrich(e),this._featureZScaler!=null&&this._featureZScaler(t.geometry)}catch(r){return void c.getLogger(this).error(new a("geoevent-connection","Failed to parse message",r))}this.onFeature(t)}else this.onMessage(e)}async _fetchServiceDefinition(e){const t={f:"json",...this._config.customParameters},r=O(e.path,{query:t,responseType:"json"}),s=(await r).data;return this._serviceDefinition=s,s}_fetchWebSocketUrl(e,t){const r=e[0],{urls:s,token:o}=r,n=this._inferWebSocketBaseUrl(s);return F(`${n}/subscribe`,{outSR:""+t.wkid,token:o})}_inferWebSocketBaseUrl(e){if(e.length===1)return e[0];for(const t of e)if(t.includes("wss"))return t;return c.getLogger(this).error(new a("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const r=this._websocket;if(r==null||e==null&&t==null)return;const s=JSON.stringify({filter:this._serializeFilter(e,t)});let o=!1;const n=C(),u=()=>{o||(this.destroyed||this._websocket!==r||c.getLogger(this).error(new a("geoevent-connection","Server timed out when setting filter")),n.reject())},l=h=>{const i=JSON.parse(h.data);i.filter&&(i.error&&(c.getLogger(this).error(new a("geoevent-connection","Failed to set service filter",i.error)),this._set("errorString",`Could not set service filter - ${i.error}`),n.reject(i.error)),this._setWebSocketJSONParseHandler(r),o=!0,n.resolve())};return r.onmessage=l,r.send(s),setTimeout(u,W),n.promise}_serializeFilter(e,t){const r={};if(e==null&&t==null)return r;if(e!=null&&e.geometry)try{const s=x(e.geometry);if(s.type!=="extent")throw new a(`Expected extent but found type ${s.type}`);r.geometry=JSON.stringify(s.shiftCentralMeridian())}catch(s){c.getLogger(this).error(new a("geoevent-connection","Encountered an error when setting connection geometryDefinition",s))}return e!=null&&e.where&&e.where!=="1 = 1"&&e.where!=="1=1"&&(r.where=e.where),t!=null&&(r.outFields=t.join(",")),r}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,r=e.attributes[t],s=this._relatedFeatures.get(r);if(!s)return c.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:o,geometry:n}=s;for(const u in o)e.attributes[u]=o[u];return n&&(e.geometry=n),e.geometry||e.centroid||c.getLogger(this).error(new a("geoevent-connection","Found malformed feature - no geometry found",e)),e}async _queryBuddyServices(){try{const{relatedFeatures:e,keepLatestArchive:t}=this._serviceDefinition,r=this._queryRelatedFeatures(e),s=this._queryArchive(t);await r;const o=await s;if(!o)return;for(const n of o.features)this.onFeature(this._enrich(n))}catch(e){c.getLogger(this).error(new a("geoevent-connection","Encountered an error when querying buddy services",{error:e}))}}async _queryRelatedFeatures(e){if(!e)return;const t=await this._queryBuddy(e.featuresUrl);this._addRelatedFeatures(t)}async _queryArchive(e){if(e)return this._queryBuddy(e.featuresUrl)}async _queryBuddy(e){var y;const t=new(await E(()=>import("./FeatureLayer-9tNCmEbA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))).default({url:e}),{capabilities:r}=await t.load(),s=r.query.supportsMaxRecordCountFactor,o=r.query.supportsPagination,n=r.query.supportsCentroid,u=this._config.maxRecordCountFactor,l=t.capabilities.query.maxRecordCount,h=s?l*u:l,i=new P;if(i.outFields=this._config.outFields??["*"],i.where=((y=this._config.filter)==null?void 0:y.where)??"1=1",i.returnGeometry=!0,i.returnExceededLimitFeatures=!0,i.outSpatialReference=M.fromJSON(this._config.spatialReference),n&&(i.returnCentroid=!0),s&&(i.maxRecordCountFactor=u),o)return i.num=h,t.destroy(),this._queryPages(e,i);const w=await k(e,i,this._config.sourceSpatialReference);return t.destroy(),w.data}async _queryPages(e,t,r=[],s=0){t.start=t.num!=null?s*t.num:null;const{data:o}=await k(e,t,this._config.sourceSpatialReference);return o.exceededTransferLimit&&s<(this._config.maxQueryDepth??0)?(o.features.forEach(n=>r.push(n)),this._queryPages(e,t,r,s+1)):(r.forEach(n=>o.features.push(n)),o)}_addRelatedFeatures(e){const t=new Map,r=e.features,s=this._serviceDefinition.relatedFeatures.joinField;for(const o of r){const n=o.attributes[s];t.set(n,o)}this._relatedFeatures=t}};b=d([S("esri.layers.graphics.sources.connections.GeoEventConnection")],b);const q=b;let _=class extends R{constructor(e){super(),this.connectionStatus="connected",this.errorString=null;const{geometryType:t,spatialReference:r,sourceSpatialReference:s}=e;this._featureZScaler=v(t,s,r)}updateCustomParameters(e){}sendMessageToSocket(e){}sendMessageToClient(e){if("type"in e)switch(e.type){case"features":case"featureResult":for(const t of e.features)this._featureZScaler!=null&&this._featureZScaler(t.geometry),this.onFeature(t)}this.onMessage(e)}};d([p()],_.prototype,"connectionStatus",void 0),d([p()],_.prototype,"errorString",void 0),_=d([S("esri.layers.support.ClientSideConnection")],_);function I(e,t,r,s,o,n,u,l){const h={source:e,sourceSpatialReference:t,spatialReference:r,geometryType:s,filter:o,maxReconnectionAttempts:n,maxReconnectionInterval:u,customParameters:l};return e?e.path.startsWith("wss://")||e.path.startsWith("ws://")?new f(h):new q(h):new _(h)}export{I as createConnection}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/FeatureLayer--S4epFk-.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/FeatureLayerBase-jpFp8gE3.js","assets/serviceCapabilitiesUtils-26KpT1VN.js","assets/editsZScale-Wgw9kbYG.js","assets/queryZScale-IaMm02_2.js","assets/FeatureSet-d4S1oKME.js","assets/CustomParametersMixin-Y1bOcayO.js","assets/FeatureEffectLayer-oBa8pIG5.js","assets/FeatureEffect-5bEV-xG1.js","assets/FeatureReductionLayer-RlitE1N6.js","assets/OrderedLayer-M7k5gLgx.js","assets/FeatureTemplate-kUgbbA00.js","assets/FeatureType-MpRe7WJj.js","assets/versionUtils-4v9zIDlv.js","assets/TopFeaturesQuery-E6D2tV-x.js"] + __vite__mapDeps.viteFileDeps = ["assets/FeatureLayer-9tNCmEbA.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/FeatureLayerBase-mvqC7cJs.js","assets/serviceCapabilitiesUtils-f-iBP4uh.js","assets/editsZScale-4-dTv58d.js","assets/CustomParametersMixin-7nmugR3Y.js","assets/FeatureEffectLayer-OK0TB5f6.js","assets/FeatureEffect-0Jn9Z0sQ.js","assets/FeatureReductionLayer-2X2_PJv9.js","assets/OrderedLayer-XNaJwl_G.js","assets/FeatureTemplate-vSzbyslg.js","assets/FeatureType-0WPvBvpQ.js","assets/versionUtils-idhrDltC.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/createSymbolSchema-Tv2jMAOE.js b/dist/assets/createSymbolSchema-Tv2jMAOE.js deleted file mode 100644 index fa428e2..0000000 --- a/dist/assets/createSymbolSchema-Tv2jMAOE.js +++ /dev/null @@ -1 +0,0 @@ -import{n as V}from"./cimAnalyzer-DtyBzAGI.js";import{E as c,S as b}from"./enums-uQoFEhYh.js";import{f as h,_ as S,A as d}from"./SymbolProcessor-pXDjnfSh.js";import"./index-J0iiHjMT.js";import"./labelPoint-ysDT9nFH.js";import"./TileClipper-NSFZXMR1.js";import"./definitions-DqQMJYPH.js";import"./number-sTjsTbdA.js";import"./BidiEngine-8z8MVveq.js";import"./Pipeline--6jAENf8.js";import"./QueryEngine-8tLWlkSE.js";import"./WhereClause-XAMIZ4-B.js";import"./TimeOnly-ljWtUK7N.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-P5wTOmqv.js";import"./generateRendererUtils-_1jVE02H.js";import"./StreamFeatureManager-QrKJ84_c.js";import"./quickselect-UFB0jJTZ.js";import"./ogcFeatureUtils-dtzP0u64.js";import"./geojson-fSjaGZrp.js";import"./date-be_IQzZd.js";import"./clientSideDefaults-F-CNnR0g.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./createConnection-4ppGVnSc.js";import"./geohashUtils-U0jvYCSY.js";import"./BaseProcessor-nWGHAt7P.js";import"./TurboLine-SWK4qRwh.js";import"./Rect-bBBxMtVp.js";import"./GeometryUtils-K2DOc0l8.js";function y(e){var t;return e.type==="line-marker"?{type:"line-marker",color:(t=e.color)==null?void 0:t.toJSON(),placement:e.placement,style:e.style}:e.constructor.fromJSON(e.toJSON()).toJSON()}function u(e){return d(e)}function x(e,t,r=!1){if(!e)return null;switch(e.type){case"simple-fill":case"picture-fill":return g(e,t,r);case"simple-marker":case"picture-marker":return E(e,t,r);case"simple-line":return z(e,t,r);case"text":return k(e,t,r);case"label":return K(e,t,r);case"cim":return{type:"cim",rendererKey:t.vvFlags,data:e.data,maxVVSize:t.maxVVSize};case"CIMSymbolReference":return{type:"cim",rendererKey:t.vvFlags,data:e,maxVVSize:t.maxVVSize};case"web-style":return{...y(e),type:"web-style",hash:e.hash(),rendererKey:t.vvFlags,maxVVSize:t.maxVVSize};default:throw new Error(`symbol not supported ${e.type}`)}}function K(e,t,r){const o=e.toJSON(),a=h(c.LABEL,{...t,placement:o.labelPlacement});return{materialKey:r?u(a):a,hash:e.hash(),...o,labelPlacement:o.labelPlacement}}function g(e,t,r){const o=h(c.FILL,t),a=r?u(o):o,i=e.clone(),m=i.outline,s=S(t.symbologyType);s||(i.outline=null);const p={materialKey:a,hash:i.hash(),...y(i)};if(s)return p;const l=[];if(l.push(p),m){const n=h(c.LINE,{...t,isOutline:!0}),f={materialKey:r?u(n):n,hash:m.hash(),...y(m)};l.push(f)}return{type:"composite-symbol",layers:l,hash:l.reduce((n,f)=>f.hash+n,"")}}function z(e,t,r){const o=S(t.symbologyType)?b.DEFAULT:t.symbologyType,a=h(c.LINE,{...t,symbologyType:o}),i=r?u(a):a,m=e.clone(),s=m.marker;m.marker=null;const p=[];if(p.push({materialKey:i,hash:m.hash(),...y(m)}),s){const l=h(c.MARKER,t),n=r?u(l):l;s.color=s.color??m.color,p.push({materialKey:n,hash:s.hash(),lineWidth:m.width,...y(s)})}return{type:"composite-symbol",layers:p,hash:p.reduce((l,n)=>n.hash+l,"")}}function E(e,t,r){if(e.type==="simple-marker"&&(e.style==="path"||e.outline&&e.outline.style!=="solid"&&e.outline.style!=="none"))return x({type:"CIMSymbolReference",symbol:V.fromSimpleMarker(e)},t,r);const o=h(c.MARKER,t),a=r?u(o):o,i=y(e);return{materialKey:a,hash:e.hash(),...i,angle:e.angle,maxVVSize:t.maxVVSize}}function k(e,t,r){const o=h(c.TEXT,t),a=r?u(o):o,i=y(e);return{materialKey:a,hash:e.hash(),...i,angle:e.angle,maxVVSize:t.maxVVSize}}export{x as createSymbolSchema}; diff --git a/dist/assets/createSymbolSchema-cxObHUlP.js b/dist/assets/createSymbolSchema-cxObHUlP.js new file mode 100644 index 0000000..7b9f4ff --- /dev/null +++ b/dist/assets/createSymbolSchema-cxObHUlP.js @@ -0,0 +1 @@ +import{n as V}from"./cimAnalyzer-X6MTpVAO.js";import{E as c,S as b}from"./enums-uQoFEhYh.js";import{f as h,_ as S,A as d}from"./SymbolProcessor-dUsJwb8f.js";import"./index-pCX-0tJH.js";import"./labelPoint-1MOq4I_J.js";import"./TileClipper-NSFZXMR1.js";import"./definitions-SVBNHUSH.js";import"./number-sTjsTbdA.js";import"./BidiEngine-8z8MVveq.js";import"./Pipeline-PlEwhMAg.js";import"./QueryEngine-uvDs-vBe.js";import"./WhereClause-FOYoIAAW.js";import"./TimeOnly-gkehHHJx.js";import"./json-v6EOeNTY.js";import"./QueryEngineCapabilities-PzVpW5yD.js";import"./utils-jVYIoPxv.js";import"./generateRendererUtils-3JJTfr19.js";import"./StreamFeatureManager-Iguqr18K.js";import"./quickselect-0UUnLNDW.js";import"./ogcFeatureUtils-8dWL_GtH.js";import"./geojson-162a_hNo.js";import"./date-be_IQzZd.js";import"./clientSideDefaults-63pOkJ4Y.js";import"./createConnection-iXdhuUHv.js";import"./geohashUtils-U0jvYCSY.js";import"./BaseProcessor-yc_MfkjR.js";import"./TurboLine-cWldrV9L.js";import"./Rect-bBBxMtVp.js";import"./GeometryUtils-K2DOc0l8.js";function y(e){var t;return e.type==="line-marker"?{type:"line-marker",color:(t=e.color)==null?void 0:t.toJSON(),placement:e.placement,style:e.style}:e.constructor.fromJSON(e.toJSON()).toJSON()}function u(e){return d(e)}function x(e,t,r=!1){if(!e)return null;switch(e.type){case"simple-fill":case"picture-fill":return g(e,t,r);case"simple-marker":case"picture-marker":return E(e,t,r);case"simple-line":return z(e,t,r);case"text":return k(e,t,r);case"label":return K(e,t,r);case"cim":return{type:"cim",rendererKey:t.vvFlags,data:e.data,maxVVSize:t.maxVVSize};case"CIMSymbolReference":return{type:"cim",rendererKey:t.vvFlags,data:e,maxVVSize:t.maxVVSize};case"web-style":return{...y(e),type:"web-style",hash:e.hash(),rendererKey:t.vvFlags,maxVVSize:t.maxVVSize};default:throw new Error(`symbol not supported ${e.type}`)}}function K(e,t,r){const o=e.toJSON(),a=h(c.LABEL,{...t,placement:o.labelPlacement});return{materialKey:r?u(a):a,hash:e.hash(),...o,labelPlacement:o.labelPlacement}}function g(e,t,r){const o=h(c.FILL,t),a=r?u(o):o,i=e.clone(),m=i.outline,s=S(t.symbologyType);s||(i.outline=null);const p={materialKey:a,hash:i.hash(),...y(i)};if(s)return p;const l=[];if(l.push(p),m){const n=h(c.LINE,{...t,isOutline:!0}),f={materialKey:r?u(n):n,hash:m.hash(),...y(m)};l.push(f)}return{type:"composite-symbol",layers:l,hash:l.reduce((n,f)=>f.hash+n,"")}}function z(e,t,r){const o=S(t.symbologyType)?b.DEFAULT:t.symbologyType,a=h(c.LINE,{...t,symbologyType:o}),i=r?u(a):a,m=e.clone(),s=m.marker;m.marker=null;const p=[];if(p.push({materialKey:i,hash:m.hash(),...y(m)}),s){const l=h(c.MARKER,t),n=r?u(l):l;s.color=s.color??m.color,p.push({materialKey:n,hash:s.hash(),lineWidth:m.width,...y(s)})}return{type:"composite-symbol",layers:p,hash:p.reduce((l,n)=>n.hash+l,"")}}function E(e,t,r){if(e.type==="simple-marker"&&(e.style==="path"||e.outline&&e.outline.style!=="solid"&&e.outline.style!=="none"))return x({type:"CIMSymbolReference",symbol:V.fromSimpleMarker(e)},t,r);const o=h(c.MARKER,t),a=r?u(o):o,i=y(e);return{materialKey:a,hash:e.hash(),...i,angle:e.angle,maxVVSize:t.maxVVSize}}function k(e,t,r){const o=h(c.TEXT,t),a=r?u(o):o,i=y(e);return{materialKey:a,hash:e.hash(),...i,angle:e.angle,maxVVSize:t.maxVVSize}}export{x as createSymbolSchema}; diff --git a/dist/assets/dataUtils-_QoSHbCE.js b/dist/assets/dataUtils-_QoSHbCE.js new file mode 100644 index 0000000..27472d7 --- /dev/null +++ b/dist/assets/dataUtils-_QoSHbCE.js @@ -0,0 +1,7 @@ +import{dp as ve,ey as Er,sA as Pe,uN as Jt,sy as Ee,sz as Rr,W as Re,e as D,y as N,f1 as Lr,c as Ot,dr as Dt,r as yt,ah as et,R as gt,uI as Xt,dt as Ur,du as Or,L as Dr,dO as Le,d2 as Gr,aR as ir,ad as Br,jW as Nr,de as $r,kr as Fr,um as xe,j3 as qt,dE as Vr,ab as _r,uO as sr}from"./index-pCX-0tJH.js";const xn=["random","ndvi","ndvi2","ndvi3","elevation","gray","hillshade"],ar=[{id:"aspect",type:"multipart",colorRamps:[{fromColor:[190,190,190],toColor:[255,45,8]},{fromColor:[255,45,8],toColor:[255,181,61]},{fromColor:[255,181,61],toColor:[255,254,52]},{fromColor:[255,254,52],toColor:[0,251,50]},{fromColor:[0,251,50],toColor:[255,254,52]},{fromColor:[0,253,255],toColor:[0,181,255]},{fromColor:[0,181,255],toColor:[26,35,253]},{fromColor:[26,35,253],toColor:[255,57,251]},{fromColor:[255,57,251],toColor:[255,45,8]}]},{id:"black-to-white",fromColor:[0,0,0],toColor:[255,255,255]},{id:"blue-bright",fromColor:[204,204,255],toColor:[0,0,224]},{id:"blue-light-to-dark",fromColor:[211,229,232],toColor:[46,100,140]},{id:"blue-green-bright",fromColor:[203,245,234],toColor:[48,207,146]},{id:"blue-green-light-to-dark",fromColor:[216,242,237],toColor:[21,79,74]},{id:"brown-light-to-dark",fromColor:[240,236,170],toColor:[102,72,48]},{id:"brown-to-blue-green-diverging-right",type:"multipart",colorRamps:[{fromColor:[156,85,31],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[33,130,145]}]},{id:"brown-to-blue-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[110,70,45],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[48,100,102]}]},{id:"coefficient-bias",fromColor:[214,214,255],toColor:[0,57,148]},{id:"cold-to-hot-diverging",type:"multipart",colorRamps:[{fromColor:[69,117,181],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[214,47,39]}]},{id:"condition-number",type:"multipart",colorRamps:[{fromColor:[0,97,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,34,0]}]},{id:"cyan-to-purple",type:"multipart",colorRamps:[{fromColor:[0,245,245],toColor:[0,0,245]},{fromColor:[0,0,245],toColor:[245,0,245]}]},{id:"cyan-light-to-blue-dark",type:"multipart",colorRamps:[{fromColor:[182,237,240],toColor:[31,131,224]},{fromColor:[31,131,224],toColor:[9,9,145]}]},{id:"distance",fromColor:[255,200,0],toColor:[0,0,255]},{id:"elevation1",type:"multipart",colorRamps:[{fromColor:[175,240,233],toColor:[255,255,179]},{fromColor:[255,255,179],toColor:[0,128,64]},{fromColor:[0,128,64],toColor:[252,186,3]},{fromColor:[252,186,3],toColor:[128,0,0]},{fromColor:[120,0,0],toColor:[105,48,13]},{fromColor:[105,48,13],toColor:[171,171,171]},{fromColor:[171,171,171],toColor:[255,252,255]}]},{id:"elevation2",type:"multipart",colorRamps:[{fromColor:[118,219,211],toColor:[255,255,199]},{fromColor:[255,255,199],toColor:[255,255,128]},{fromColor:[255,255,128],toColor:[217,194,121]},{fromColor:[217,194,121],toColor:[135,96,38]},{fromColor:[135,96,38],toColor:[150,150,181]},{fromColor:[150,150,181],toColor:[181,150,181]},{fromColor:[181,150,181],toColor:[255,252,255]}]},{id:"errors",fromColor:[255,235,214],toColor:[196,10,10]},{id:"gray-light-to-dark",fromColor:[219,219,219],toColor:[69,69,69]},{id:"green-bright",fromColor:[204,255,204],toColor:[14,204,14]},{id:"green-light-to-dark",fromColor:[220,245,233],toColor:[34,102,51]},{id:"green-to-blue",type:"multipart",colorRamps:[{fromColor:[32,204,16],toColor:[0,242,242]},{fromColor:[0,242,242],toColor:[2,33,227]}]},{id:"orange-bright",fromColor:[255,235,204],toColor:[240,118,5]},{id:"orange-light-to-dark",fromColor:[250,233,212],toColor:[171,65,36]},{id:"partial-spectrum",type:"multipart",colorRamps:[{fromColor:[242,241,162],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]},{fromColor:[252,3,69],toColor:[176,7,237]},{fromColor:[176,7,237],toColor:[2,29,173]}]},{id:"partial-spectrum-1-diverging",type:"multipart",colorRamps:[{fromColor:[135,38,38],toColor:[240,149,12]},{fromColor:[240,149,12],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[74,80,181]},{fromColor:[74,80,181],toColor:[39,32,122]}]},{id:"partial-spectrum-2-diverging",type:"multipart",colorRamps:[{fromColor:[115,77,42],toColor:[201,137,52]},{fromColor:[201,137,52],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[91,63,176]},{fromColor:[91,63,176],toColor:[81,13,97]}]},{id:"pink-to-yellow-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[158,30,113],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[99,110,45]}]},{id:"pink-to-yellow-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,47,73],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[22,59,15]}]},{id:"precipitation",type:"multipart",colorRamps:[{fromColor:[194,82,60],toColor:[237,161,19]},{fromColor:[237,161,19],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,219,0]},{fromColor:[0,219,0],toColor:[32,153,143]},{fromColor:[32,153,143],toColor:[11,44,122]}]},{id:"prediction",type:"multipart",colorRamps:[{fromColor:[40,146,199],toColor:[250,250,100]},{fromColor:[250,250,100],toColor:[232,16,20]}]},{id:"purple-bright",fromColor:[255,204,255],toColor:[199,0,199]},{id:"purple-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[77,32,150],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[20,122,11]}]},{id:"purple-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[67,14,89],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[24,79,15]}]},{id:"purple-blue-bright",fromColor:[223,184,230],toColor:[112,12,242]},{id:"purple-blue-light-to-dark",fromColor:[229,213,242],toColor:[93,44,112]},{id:"purple-red-bright",fromColor:[255,204,225],toColor:[199,0,99]},{id:"purple-red-light-to-dark",fromColor:[250,215,246],toColor:[143,17,57]},{id:"red-bright",fromColor:[255,204,204],toColor:[219,0,0]},{id:"red-light-to-dark",fromColor:[255,224,224],toColor:[143,10,10]},{id:"red-to-blue-diverging-bright",type:"multipart",colorRamps:[{fromColor:[196,69,57],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[48,95,207]}]},{id:"red-to-blue-diverging-dark",type:"multipart",colorRamps:[{fromColor:[107,13,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[13,53,97]}]},{id:"red-to-green",type:"multipart",colorRamps:[{fromColor:[245,0,0],toColor:[245,245,0]},{fromColor:[245,245,0],toColor:[0,245,0]}]},{id:"red-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[186,20,20],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[54,145,33]}]},{id:"red-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,21,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[16,69,16]}]},{id:"slope",type:"multipart",colorRamps:[{fromColor:[56,168,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]},{id:"spectrum-full-bright",type:"multipart",colorRamps:[{fromColor:[255,0,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,0,255]}]},{id:"spectrum-full-dark",type:"multipart",colorRamps:[{fromColor:[153,0,0],toColor:[153,153,0]},{fromColor:[153,153,0],toColor:[0,153,153]},{fromColor:[0,153,153],toColor:[0,0,153]}]},{id:"spectrum-full-light",type:"multipart",colorRamps:[{fromColor:[255,153,153],toColor:[255,255,153]},{fromColor:[255,255,153],toColor:[153,255,255]},{fromColor:[153,255,255],toColor:[153,153,255]}]},{id:"surface",type:"multipart",colorRamps:[{fromColor:[112,153,89],toColor:[242,238,162]},{fromColor:[242,238,162],toColor:[242,206,133]},{fromColor:[242,206,133],toColor:[194,140,124]},{fromColor:[194,140,124],toColor:[255,242,255]}]},{id:"temperature",type:"multipart",colorRamps:[{fromColor:[255,252,255],toColor:[255,0,255]},{fromColor:[255,0,255],toColor:[0,0,255]},{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,255,0]},{fromColor:[0,255,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,128,0]},{fromColor:[255,128,0],toColor:[128,0,0]}]},{id:"white-to-black",fromColor:[255,255,255],toColor:[0,0,0]},{id:"yellow-to-dark-red",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[242,167,46]},{fromColor:[242,167,46],toColor:[107,0,0]}]},{id:"yellow-to-green-to-dark-blue",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[56,224,9]},{fromColor:[56,224,9],toColor:[26,147,171]},{fromColor:[26,147,171],toColor:[12,16,120]}]},{id:"yellow-to-red",fromColor:[245,245,0],toColor:[255,0,0]},{id:"yellow-green-bright",fromColor:[236,252,204],toColor:[157,204,16]},{id:"yellow-green-light-to-dark",fromColor:[215,240,175],toColor:[96,107,45]}],jr=new ve({Aspect:"aspect","Black to White":"black-to-white","Blue Bright":"blue-bright","Blue Light to Dark":"blue-light-to-dark","Blue-Green Bright":"blue-green-bright","Blue-Green Light to Dark":"blue-green-light-to-dark","Brown Light to Dark":"brown-light-to-dark","Brown to Blue Green Diverging, Bright":"brown-to-blue-green-diverging-right","Brown to Blue Green Diverging, Dark":"brown-to-blue-green-diverging-dark","Coefficient Bias":"coefficient-bias","Cold to Hot Diverging":"cold-to-hot-diverging","Condition Number":"condition-number","Cyan to Purple":"cyan-to-purple","Cyan-Light to Blue-Dark":"cyan-light-to-blue-dark",Distance:"distance","Elevation #1":"elevation1","Elevation #2":"elevation2",Errors:"errors","Gray Light to Dark":"gray-light-to-dark","Green Bright":"green-bright","Green Light to Dark":"green-light-to-dark","Green to Blue":"green-to-blue","Orange Bright":"orange-bright","Orange Light to Dark":"orange-light-to-dark","Partial Spectrum":"partial-spectrum","Partial Spectrum 1 Diverging":"partial-spectrum-1-diverging","Partial Spectrum 2 Diverging":"partial-spectrum-2-diverging","Pink to YellowGreen Diverging, Bright":"pink-to-yellow-green-diverging-bright","Pink to YellowGreen Diverging, Dark":"pink-to-yellow-green-diverging-dark",Precipitation:"precipitation",Prediction:"prediction","Purple Bright":"purple-bright","Purple to Green Diverging, Bright":"purple-to-green-diverging-bright","Purple to Green Diverging, Dark":"purple-to-green-diverging-dark","Purple-Blue Bright":"purple-blue-bright","Purple-Blue Light to Dark":"purple-blue-light-to-dark","Purple-Red Bright":"purple-red-bright","Purple-Red Light to Dark":"purple-red-light-to-dark","Red Bright":"red-bright","Red Light to Dark":"red-light-to-dark","Red to Blue Diverging, Bright":"red-to-blue-diverging-bright","Red to Blue Diverging, Dark":"red-to-blue-diverging-dark","Red to Green":"red-to-green","Red to Green Diverging, Bright":"red-to-green-diverging-bright","Red to Green Diverging, Dark":"red-to-green-diverging-dark",Slope:"slope","Spectrum-Full Bright":"spectrum-full-bright","Spectrum-Full Dark":"spectrum-full-dark","Spectrum-Full Light":"spectrum-full-light",Surface:"surface",Temperature:"temperature","White to Black":"white-to-black","Yellow to Dark Red":"yellow-to-dark-red","Yellow to Green to Dark Blue":"yellow-to-green-to-dark-blue","Yellow to Red":"yellow-to-red","Yellow-Green Bright":"yellow-green-bright","Yellow-Green Light to Dark":"yellow-green-light-to-dark"});function Wt(t,e){if(!t||!e||t.length!==e.length)return!1;for(let r=0;re[r]+2||t[r]Ue(o))),r}return Ue(t)}function Oe(t,e){if(!t)return;const r=e??ar;let o=null;return t.type==="algorithmic"?r.some(c=>{if(Wt(t.fromColor.toRgb(),c.fromColor)&&Wt(t.toColor.toRgb(),c.toColor))return o=c.id,!0}):t.type==="multipart"&&r.some(c=>{const i=t.colorRamps,u=c.colorRamps;if(i&&u&&i.length===u.length&&!u.some((n,s)=>{if(!Wt(i[s].fromColor.toRgb(),new Re(n.fromColor).toRgb())||!Wt(i[s].toColor.toRgb(),new Re(n.toColor).toRgb()))return!0})){if(o)return!0;o=c.id}}),o}function Wr(t,e,r=!1){if(!t)return;let o=Oe(t,e);return o!=null||r||(o=Oe(t=zr(t),e)),o}function Hr(t,e=!1){const r=typeof t=="string"?t:Wr(t,void 0,e);return r?jr.toJSON(r):null}function kn(t,e="esriCIELabAlgorithm"){const r=ar.find(({id:o})=>o===t);return r?r.colorRamps?{type:"multipart",colorRamps:r.colorRamps.map(o=>({type:"algorithmic",algorithm:e,fromColor:[...o.fromColor],toColor:[...o.toColor]}))}:{type:"algorithmic",algorithm:e,fromColor:[...r.fromColor],toColor:[...r.toColor]}:null}function lr(t){const e=(t=t||{}).numColors||256,r=t.distanceOffset||0,o=t.isCustomInterval!=null?t.isCustomInterval:t.distanceInterval!==null&&t.distanceInterval!==1/(e-1),c=t.distanceInterval||1/(e-1);return{...t,numColors:e,distanceOffset:r,interpolateAlpha:!!t.interpolateAlpha,distanceInterval:c,isCustomInterval:o,weights:t.weights}}function qr(t,e,r){const{numColors:o,distanceOffset:c,distanceInterval:i,isCustomInterval:u}=r,n=t.s===0,s=e.s===0;let l=t.h,a=e.h;n&&!s?l=a:s&&!n&&(e={...e,h:l},a=l);let h,p=Math.abs(a-l);const f=360;pa?p*i:-p*i);const m=(e.s-t.s)*i,g=(e.v-t.v)*i;let{s:v,v:d}=t,y=l;if(c){const C=c/i;y=(y+C*h+f)%f,v+=C*m,d+=C*g}const w=[];for(let C=0;Cf+m);c=c.map(f=>f/p)}else{c=[];for(let p=0;p{c.unshift(i),o||c.pop()}),r}function Ge(t){const e=Jt(t);return{type:"HsvColor",Hue:e.h,Saturation:e.s,Value:e.v,AlphaValue:255}}function Be(t){const e=t.toJSON();return{Algorithm:(e==null?void 0:e.Algorithm)||"esriHSVAlgorithm",type:"AlgorithmicColorRamp",FromColor:Ge(t.fromColor),ToColor:Ge(t.toColor)}}function An(t){const e=Hr(t);if(!e)return null;if(t.type==="algorithmic")return{...Be(t),Name:e};if(t.colorRamps){const r=t.colorRamps.map(Be);return{type:"MultiPartColorRamp",NumColorRamps:r.length,ArrayOfColorRamp:r,Name:e}}return null}function Sn(t){const e=t.reverse().map(r=>{const o=r.toString(16);return o.length<2?"0"+o:o});return 4294967295&Number.parseInt(e.join(""),16)}const Tn=new ve({none:"none",standardDeviation:"standard-deviation",histogramEqualization:"histogram-equalization",minMax:"min-max",percentClip:"percent-clip",sigmoid:"sigmoid"}),Zr={0:"none",3:"standardDeviation",4:"histogramEqualization",5:"minMax",6:"percentClip",9:"sigmoid"};let Ne=class{constructor(e=null,r=null,o=null){this.minValue=e,this.maxValue=r,this.noDataValue=o}};var St;let it=St=class extends Dt{static createEmptyBand(t,e){return new(St.getPixelArrayConstructor(t))(e)}static getPixelArrayConstructor(t){let e;switch(t){case"u1":case"u2":case"u4":case"u8":e=Uint8Array;break;case"u16":e=Uint16Array;break;case"u32":e=Uint32Array;break;case"s8":e=Int8Array;break;case"s16":e=Int16Array;break;case"s32":e=Int32Array;break;case"f32":case"c64":case"c128":case"unknown":e=Float32Array;break;case"f64":e=Float64Array}return e}constructor(t){super(t),this.width=null,this.height=null,this.pixelType="f32",this.validPixelCount=null,this.mask=null,this.maskIsAlpha=!1,this.premultiplyAlpha=!1,this.statistics=null,this.depthCount=1}castPixelType(t){if(!t)return"f32";let e=t.toLowerCase();return["u1","u2","u4"].includes(e)?e="u8":["unknown","u8","s8","u16","s16","u32","s32","f32","f64"].includes(e)||(e="f32"),e}getPlaneCount(){var t;return(t=this.pixels)==null?void 0:t.length}addData(t){if(!t.pixels||t.pixels.length!==this.width*this.height)throw new yt("pixelblock:invalid-or-missing-pixels","add data requires valid pixels array that has same length defined by pixel block width * height");this.pixels||(this.pixels=[]),this.statistics||(this.statistics=[]),this.pixels.push(t.pixels),this.statistics.push(t.statistics??new Ne)}getAsRGBA(){const t=new ArrayBuffer(this.width*this.height*4);switch(this.pixelType){case"s8":case"s16":case"u16":case"s32":case"u32":case"f32":case"f64":this._fillFromNon8Bit(t);break;default:this._fillFrom8Bit(t)}return new Uint8ClampedArray(t)}getAsRGBAFloat(){const t=new Float32Array(this.width*this.height*4);return this._fillFrom32Bit(t),t}updateStatistics(){if(!this.pixels)return;this.statistics=this.pixels.map(r=>this._calculateBandStatistics(r,this.mask));const t=this.mask;let e=0;if(t!=null)for(let r=0;rr?r:np>=e.length),i=o===t.length&&!t.some((p,f)=>p!==f);if(c||i)return this;const u=((h=this.bandMasks)==null?void 0:h.length)===o?t.map(p=>this.bandMasks[p]):void 0;let{mask:n,validPixelCount:s}=this;const{width:l,height:a}=this;if(u){if(u.length===1)n=u[0];else{const p=l*a;n=new Uint8Array(p).fill(255);for(let f=0;f!!p).length}return new St({pixelType:this.pixelType,width:l,height:a,mask:n,bandMasks:u,validPixelCount:s,maskIsAlpha:this.maskIsAlpha,pixels:t.map(p=>e[p]),statistics:r&&t.map(p=>r[p])})}clone(){const t=new St({width:this.width,height:this.height,pixelType:this.pixelType,maskIsAlpha:this.maskIsAlpha,validPixelCount:this.validPixelCount});let e;this.mask!=null&&(this.mask instanceof Uint8Array?t.mask=new Uint8Array(this.mask):t.mask=this.mask.slice(0)),this.bandMasks&&(t.bandMasks=this.bandMasks.map(o=>new Uint8Array(o)));const r=St.getPixelArrayConstructor(this.pixelType);if(this.pixels&&this.pixels.length>0){t.pixels=[];const o=!!this.pixels[0].slice;for(e=0;e=3?(u=c[1],n=c[2]):c.length===2&&(u=c[1]);const l=new Uint32Array(t),a=this.width*this.height;if(i.length===a)if(e!=null&&e.length===a)if(r)for(s=0;s0){for(const g of o)if(g.minValue!=null&&(u=Math.min(u,g.minValue)),g.maxValue!=null&&g.minValue!=null){const v=g.maxValue-g.minValue;n=Math.max(n,v)}i=255/n}else{let g=255;c==="s8"?(u=-128,g=127):c==="u16"?g=65535:c==="s16"?(u=-32768,g=32767):c==="u32"?g=4294967295:c==="s32"?(u=-2147483648,g=2147483647):c==="f32"?(u=-34e38,g=34e38):c==="f64"&&(u=-Number.MAX_VALUE,g=Number.MAX_VALUE),i=255/(g-u)}const s=new Uint32Array(t),l=this.width*this.height;let a,h,p,f,m;if(a=h=p=e[0],a.length!==l)return gt.getLogger(this).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.");if(e.length>=2)if(h=e[1],e.length>=3&&(p=e[2]),r!=null&&r.length===l)for(f=0;f=3?(c=e[1],i=e[2]):e.length===2&&(c=e[1]);const n=this.width*this.height;if(o.length!==n)return gt.getLogger(this).error("getAsRGBAFloat()","Unable to convert to RGBA. The pixelblock is invalid.");let s=0;if(r!=null&&r.length===n)for(u=0;uo?u:o);else for(i=0;io?u:o;return new Ne(r,o)}};D([N({json:{write:!0}})],it.prototype,"width",void 0),D([N({json:{write:!0}})],it.prototype,"height",void 0),D([N({json:{write:!0}})],it.prototype,"pixelType",void 0),D([Lr("pixelType")],it.prototype,"castPixelType",null),D([N({json:{write:!0}})],it.prototype,"validPixelCount",void 0),D([N({json:{write:!0}})],it.prototype,"mask",void 0),D([N({json:{write:!0}})],it.prototype,"maskIsAlpha",void 0),D([N({json:{write:!0}})],it.prototype,"pixels",void 0),D([N()],it.prototype,"premultiplyAlpha",void 0),D([N({json:{write:!0}})],it.prototype,"statistics",void 0),D([N({json:{write:!0}})],it.prototype,"depthCount",void 0),D([N({json:{write:!0}})],it.prototype,"noDataValues",void 0),D([N({json:{write:!0}})],it.prototype,"bandMasks",void 0),it=St=D([Ot("esri.layers.support.PixelBlock")],it);const H=it;var $e,Fe;(function(t){t[t.matchAny=0]="matchAny",t[t.matchAll=1]="matchAll"})($e||($e={})),function(t){t[t.bestMatch=0]="bestMatch",t[t.fail=1]="fail"}(Fe||(Fe={}));const Mn=6;function Q(t){return t!=null&&t.declaredClass==="esri.layers.support.PixelBlock"&&t.pixels&&t.pixels.length>0}function Pn(t){var a;if(!(t!=null&&t.length)||t.some(h=>!Q(h)))return null;if(t.length===1)return((a=t[0])==null?void 0:a.clone())??null;const e=t,{width:r,height:o,pixelType:c}=e[0];if(e.some(h=>h.width!==r||h.height!==o))return null;const i=e.map(({mask:h})=>h).filter(h=>h!=null);let u=null;i.length&&(u=new Uint8Array(r*o),u.set(i[0]),i.length>1&&hr(i.slice(1),u));const n=[];e.forEach(({pixels:h})=>n.push(...h));const s=e.map(({statistics:h})=>h).filter(h=>h==null?void 0:h.length),l=[];return s.forEach(h=>l.push(...h)),new H({pixelType:c,width:r,height:o,mask:u,pixels:n,statistics:l.length?l:null})}function Bt(t){if(!t)return;const e=t.colormap;if(!e||e.length===0)return;const r=e.sort((h,p)=>h[0]-p[0]);let o=0;r[0][0]<0&&(o=r[0][0]);const c=Math.max(256,r[r.length-1][0]-o+1),i=new Uint8Array(4*c),u=[];let n,s=0,l=0;const a=r[0].length===5;if(c>65536)return r.forEach(h=>{u[h[0]-o]=a?h.slice(1):h.slice(1).concat([255])}),{indexed2DColormap:u,offset:o,alphaSpecified:a};if(t.fillUnspecified)for(n=r[l],s=n[0]-o;sd?c[a]=0:(p[a]=u[v],f[a]=u[v+1],m[a]=u[v+2],c[a]=u[v+3]));else{for(c=new Uint8Array(i),a=0;ad?c[a]=0:(p[a]=u[v],f[a]=u[v+1],m[a]=u[v+2],c[a]=u[v+3]);r.mask=c}}else if(n)if(c!=null)for(a=0;ai));const n=[],s=e.outputPixelType||"u8";for(let a=0;a1;){if(l===a.value){g=!0;break}l>a.value?h=m:p=m,m=Math.floor((h+p)/2),a=e[Math.floor(m)]}g||(l===e[h].value?(a=e[h],g=!0):l===e[p].value?(a=e[p],g=!0):le[h].value&&(lC-m);g[0]=c[0],g[g.length-1]=c[c.length-1]+(l?1e-6:0);const v=c.length/2,[d,y]=Xt(u);for(let C=0;C=0;A--)if(k===g[2*A]||k>g[2*A]&&ky?y:k=n[S]&&k<=n[S+1]){h[x]=0,f[x]=0;break}}}return new H({width:r,height:o,pixelType:u,pixels:[h],mask:f})}function _e(t,e,r,o){const c=r!=null&&r.length>=2?new Set(r):null,i=(r==null?void 0:r.length)===1?r[0]:null,u=!!(e!=null&&e.length);for(let n=0;n=e[a]&&s<=e[a+1]){l=!0;break}l||(o[n]=0)}o[n]&&(s===i||c!=null&&c.has(s))&&(o[n]=0)}}function je(t,e){const r=t[0].length;for(let o=0;ov-1e-6);g[0]=r[0],u&&(g[g.length-1]=r[r.length-1]);for(let v=0;vf?f:o[v]g?m=i.rightPadding:d>=g&&(f=i.leftMargin-i.rightPadding,m=0)}if(p.xmax-=m,typeof e!="number")for(let g=p.ymin;gQ(T));if(n==null)return null;const s=c?c.width:e.width,l=c?c.height:e.height,a=n.width,h=n.height,p=e.width/a,f=e.height/h,m={offset:o||{x:0,y:0},mosaic:c||e,block:{width:a,height:h}},g=n.pixelType,v=H.getPixelArrayConstructor(g),d=n.pixels.length,y=[];let w,C;for(let T=0;TT==null||T.mask!=null&&T.mask.length>0),x=t.some(T=>(T==null?void 0:T.bandMasks)&&T.bandMasks.length>1),k=b?new Uint8Array(s*l):void 0,S=x?[]:void 0;if(k){for(let T=0;Td!=null);if(o==null)return null;const c=t.some(d=>d==null||!!d.mask),{width:i,height:u}=e,n=c?new Uint8Array(i*u):null,{blockWidths:s}=r,l=[],a=o.getPlaneCount(),h=H.getPixelArrayConstructor(o.pixelType);if(c)for(let d=0,y=0;d(d==null?void 0:d.bandMasks)&&d.bandMasks.length>1),f=p?[]:void 0,m=i*u;for(let d=0;do||s>c||i===0&&u===0&&n===o&&s===c)return t;t.mask||(t.mask=new Uint8Array(o*c));const l=t.mask;for(let a=0;a=s||p=n?0:1}return t.updateStatistics(),t}function ro(t){if(!Q(t))return null;const e=t.clone(),{width:r,height:o,pixels:c}=t,i=c[0],u=e.pixels[0],n=t.mask;for(let s=2;se&&(r=i.value,e=o),i=c.next();return r}function Ht(t,e,r){if(r===0)return;const o=t.get(e);o===1?t.delete(e):t.set(e,o-1)}function Nt(t,e,r){r!==0&&t.set(e,t.has(e)?t.get(e)+1:1)}function oo(t,e,r){let{x:o,y:c}=e;const{width:i,height:u}=r;if(o===0&&c===0&&u===t.height&&i===t.width)return t;const{width:n,height:s}=t,l=Math.max(0,c),a=Math.max(0,o),h=Math.min(o+i,n),p=Math.min(c+u,s);if(h<0||p<0||!Q(t))return null;o=Math.max(0,-o),c=Math.max(0,-c);const{pixels:f}=t,m=i*u,g=f.length,v=[];for(let C=0;C{const U=I instanceof Float32Array||I instanceof Float64Array?0:.5;for(let R=0;RHe.fromJSON(o));for(let o=0;oc&&(o=c)}else{for(;!this.eof;)this.readBlock();o=this.bufferLength}return this.pos=o,this.buffer.subarray(r,o)},lookChar:function(){for(var e=this.pos;this.bufferLength<=e;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos])},getChar:function(){for(var e=this.pos;this.bufferLength<=e;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos++])},makeSubStream:function(e,r,o){for(var c=e+r;this.bufferLength<=c&&!this.eof;)this.readBlock();return new Stream(this.buffer,e,r,o)},skip:function(e){e||(e=1),this.pos+=e},reset:function(){this.pos=0}},t}(),(Ke=function(){if(!self||!self.Uint32Array)return null;var t=new Uint32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),e=new Uint32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),r=new Uint32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),o=[new Uint32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],c=[new Uint32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];function i(n){throw new Error(n)}function u(n){var s=0,l=n[s++],a=n[s++];l!=-1&&a!=-1||i("Invalid header in flate stream"),(15&l)!=8&&i("Unknown compression method in flate stream"),((l<<8)+a)%31!=0&&i("Bad FCHECK in flate stream"),32&a&&i("FDICT bit set in flate stream"),this.bytes=n,this.bytesPos=s,this.codeSize=0,this.codeBuf=0,ne.call(this)}return u.prototype=Object.create(ne.prototype),u.prototype.getBits=function(n){for(var s,l=this.codeSize,a=this.codeBuf,h=this.bytes,p=this.bytesPos;l>n,this.codeSize=l-=n,this.bytesPos=p,s},u.prototype.getCode=function(n){for(var s=n[0],l=n[1],a=this.codeSize,h=this.codeBuf,p=this.bytes,f=this.bytesPos;a>16,d=65535&g;return(a==0||a>v,this.codeSize=a-v,this.bytesPos=f,d},u.prototype.generateHuffmanTable=function(n){for(var s=n.length,l=0,a=0;al&&(l=n[a]);for(var h=1<>=1;for(a=d;a0;)j[g++]=_}var s=this.getBits(3);if(1&s&&(this.eof=!0),(s>>=1)!=0){var l,a;if(s==1)l=o,a=c;else if(s==2){for(var h=this.getBits(5)+257,p=this.getBits(5)+1,f=this.getBits(4)+4,m=Array(t.length),g=0;g=b&&(b=(R=this.ensureBuffer(x+1)).length),R[x++]=k;else{if(k==256)return void(this.bufferLength=x);var S=(k=e[k-=257])>>16;S>0&&(S=this.getBits(S)),d=(65535&k)+S,k=this.getCode(a),(S=(k=r[k])>>16)>0&&(S=this.getBits(S));var A=(65535&k)+S;x+d>=b&&(b=(R=this.ensureBuffer(x+d)).length);for(var M=0;M{let a=null;u==="jpg"&&n&&(a=dr._getMask(e,{width:c,height:i}));const h=new Blob([new Uint8Array(e)],{type:"image/"+u=="jpg"?"jpeg":u}),p=URL.createObjectURL(h),f=new Image;let m;f.src=p,f.onload=()=>{if(URL.revokeObjectURL(p),Br(o))return void l(Nr());c=f.width,i=f.height,this._canvas&&this._ctx?(this._canvas.width===c&&this._canvas.height===i||(this._canvas.width=c,this._canvas.height=i),this._ctx.clearRect(0,0,c,i)):(this._canvas=document.createElement("canvas"),this._canvas.width=c,this._canvas.height=i,this._ctx=this._canvas.getContext("2d")),this._ctx.drawImage(f,0,0);const g=this._ctx.getImageData(0,0,c,i);let v;if(m=g.data,r.renderOnCanvas){if(a)for(v=0;v{URL.revokeObjectURL(p),l("cannot load image")}})}static _getMask(e,r){let o=null;try{const c=new Uint8Array(e),i=Math.ceil(c.length/2);let u=0;const n=c.length-2;for(u=i;u=0;h--)o[l++]=s[a]>>h&1}}catch{}return o}};var Je,Ye,Xe,me={exports:{}};me.exports,Je=me,Ye=function(){var t=function(){function e(r){this.message="JPEG error: "+r}return e.prototype=new Error,e.prototype.name="JpegError",e.constructor=e,e}();return function(){if(!self||!self.Uint8ClampedArray)return null;var e=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),r=4017,o=799,c=3406,i=2276,u=1567,n=3784,s=5793,l=2896;function a(){this.decodeTransform=null,this.colorTransform=-1}function h(d,y){for(var w,C,b=0,x=[],k=16;k>0&&!d[k-1];)k--;x.push({children:[],index:0});var S,A=x[0];for(w=0;w0;)A=x.pop();for(A.index++,x.push(A);x.length<=w;)x.push(S={children:[],index:0}),A.children[A.index]=S.children,A=S;b++}w+10)return L--,P>>L&1;if((P=d[y++])===255){var $=d[y++];if($)throw new t("unexpected marker "+(P<<8|$).toString(16))}return L=7,P>>>7}function U($){for(var W=$;;){if(typeof(W=W[E()])=="number")return W;if(typeof W!="object")throw new t("invalid huffman sequence")}}function R($){for(var W=0;$>0;)W=W<<1|E(),$--;return W}function B($){if($===1)return E()===1?1:-1;var W=R($);return W>=1<<$-1?W:W+(-1<<$)+1}function G($,W){var K=U($.huffmanTableDC),rt=K===0?0:B(K);$.blockData[W]=$.pred+=rt;for(var at=1;at<64;){var ft=U($.huffmanTableAC),ot=15&ft,lt=ft>>4;if(ot!==0){var Pr=e[at+=lt];$.blockData[W+Pr]=B(ot),at++}else{if(lt<15)break;at+=16}}}function O($,W){var K=U($.huffmanTableDC),rt=K===0?0:B(K)<0)F--;else for(var K=x,rt=k;K<=rt;){var at=U($.huffmanTableAC),ft=15&at,ot=at>>4;if(ft!==0){var lt=e[K+=ot];$.blockData[W+lt]=B(ft)*(1<>4,(K=15&rt)==0)ot<15?(F=R(ot)+(1<=65488&&kt<=65495))break;y+=2}return(ut=v(d,y))&&ut.invalid&&(console.log("decodeScan - unexpected Scan data, next marker is: "+ut.invalid),y=ut.offset),y-I}function m(d,y,w){var C,b,x,k,S,A,M,T,I,P,L,E,U,R,B,G,O,j=d.quantizationTable,F=d.blockData;if(!j)throw new t("missing required Quantization Table.");for(var V=0;V<64;V+=8)I=F[y+V],P=F[y+V+1],L=F[y+V+2],E=F[y+V+3],U=F[y+V+4],R=F[y+V+5],B=F[y+V+6],G=F[y+V+7],I*=j[V],P|L|E|U|R|B|G?(P*=j[V+1],L*=j[V+2],E*=j[V+3],U*=j[V+4],R*=j[V+5],B*=j[V+6],G*=j[V+7],b=(C=(C=s*I+128>>8)+(b=s*U+128>>8)+1>>1)-b,O=(x=L)*n+(k=B)*u+128>>8,x=x*u-k*n+128>>8,M=(S=(S=l*(P-G)+128>>8)+(M=R<<4)+1>>1)-M,A=(T=(T=l*(P+G)+128>>8)+(A=E<<4)+1>>1)-A,k=(C=C+(k=O)+1>>1)-k,x=(b=b+x+1>>1)-x,O=S*i+T*c+2048>>12,S=S*c-T*i+2048>>12,T=O,O=A*o+M*r+2048>>12,A=A*r-M*o+2048>>12,M=O,w[V]=C+T,w[V+7]=C-T,w[V+1]=b+M,w[V+6]=b-M,w[V+2]=x+A,w[V+5]=x-A,w[V+3]=k+S,w[V+4]=k-S):(O=s*I+512>>10,w[V]=O,w[V+1]=O,w[V+2]=O,w[V+3]=O,w[V+4]=O,w[V+5]=O,w[V+6]=O,w[V+7]=O);for(var _=0;_<8;++_)I=w[_],(P=w[_+8])|(L=w[_+16])|(E=w[_+24])|(U=w[_+32])|(R=w[_+40])|(B=w[_+48])|(G=w[_+56])?(b=(C=4112+((C=s*I+2048>>12)+(b=s*U+2048>>12)+1>>1))-b,O=(x=L)*n+(k=B)*u+2048>>12,x=x*u-k*n+2048>>12,k=O,M=(S=(S=l*(P-G)+2048>>12)+(M=R)+1>>1)-M,A=(T=(T=l*(P+G)+2048>>12)+(A=E)+1>>1)-A,O=S*i+T*c+2048>>12,S=S*c-T*i+2048>>12,T=O,O=A*o+M*r+2048>>12,A=A*r-M*o+2048>>12,I=(I=(C=C+k+1>>1)+T)<16?0:I>=4080?255:I>>4,P=(P=(b=b+x+1>>1)+(M=O))<16?0:P>=4080?255:P>>4,L=(L=(x=b-x)+A)<16?0:L>=4080?255:L>>4,E=(E=(k=C-k)+S)<16?0:E>=4080?255:E>>4,U=(U=k-S)<16?0:U>=4080?255:U>>4,R=(R=x-A)<16?0:R>=4080?255:R>>4,B=(B=b-M)<16?0:B>=4080?255:B>>4,G=(G=C-T)<16?0:G>=4080?255:G>>4,F[y+_]=I,F[y+_+8]=P,F[y+_+16]=L,F[y+_+24]=E,F[y+_+32]=U,F[y+_+40]=R,F[y+_+48]=B,F[y+_+56]=G):(O=(O=s*I+8192>>14)<-2040?0:O>=2024?255:O+2056>>4,F[y+_]=O,F[y+_+8]=O,F[y+_+16]=O,F[y+_+24]=O,F[y+_+32]=O,F[y+_+40]=O,F[y+_+48]=O,F[y+_+56]=O)}function g(d,y){for(var w=y.blocksPerLine,C=y.blocksPerColumn,b=new Int16Array(64),x=0;x=b)return null;var k=C(y);if(k>=65472&&k<=65534)return{invalid:null,marker:k,offset:y};for(var S=C(x);!(S>=65472&&S<=65534);){if(++x>=b)return null;S=C(x)}return{invalid:k.toString(16),marker:S,offset:x}}return a.prototype={parse:function(d){function y(){var $=d[k]<<8|d[k+1];return k+=2,$}function w(){var $=y(),W=k+$-2,K=v(d,W,k);K&&K.invalid&&(console.log("readDataBlock - incorrect length, next marker is: "+K.invalid),W=K.offset);var rt=d.subarray(k,W);return k+=rt.length,rt}function C($){for(var W=Math.ceil($.samplesPerLine/8/$.maxH),K=Math.ceil($.scanLines/8/$.maxV),rt=0;rt<$.components.length;rt++){Z=$.components[rt];var at=Math.ceil(Math.ceil($.samplesPerLine/8)*Z.h/$.maxH),ft=Math.ceil(Math.ceil($.scanLines/8)*Z.v/$.maxV),ot=W*Z.h,lt=K*Z.v*64*(ot+1);Z.blockData=new Int16Array(lt),Z.blocksPerLine=at,Z.blocksPerColumn=ft}$.mcusPerLine=W,$.mcusPerColumn=K}var b,x,k=0,S=null,A=null,M=[],T=[],I=[],P=y();if(P!==65496)throw new t("SOI not found");for(P=y();P!==65497;){var L,E,U;switch(P){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var R=w();P===65504&&R[0]===74&&R[1]===70&&R[2]===73&&R[3]===70&&R[4]===0&&(S={version:{major:R[5],minor:R[6]},densityUnits:R[7],xDensity:R[8]<<8|R[9],yDensity:R[10]<<8|R[11],thumbWidth:R[12],thumbHeight:R[13],thumbData:R.subarray(14,14+3*R[12]*R[13])}),P===65518&&R[0]===65&&R[1]===100&&R[2]===111&&R[3]===98&&R[4]===101&&(A={version:R[5]<<8|R[6],flags0:R[7]<<8|R[8],flags1:R[9]<<8|R[10],transformCode:R[11]});break;case 65499:for(var B=y()+k-2;k>4){if(G>>4!=1)throw new t("DQT - invalid table spec");for(E=0;E<64;E++)O[e[E]]=y()}else for(E=0;E<64;E++)O[e[E]]=d[k++];M[15&G]=O}break;case 65472:case 65473:case 65474:if(b)throw new t("Only single frame JPEGs supported");y(),(b={}).extended=P===65473,b.progressive=P===65474,b.precision=d[k++],b.scanLines=y(),b.samplesPerLine=y(),b.components=[],b.componentIds={};var j,F=d[k++],V=0,_=0;for(L=0;L>4,tt=15&d[k+1];V>4?T:I)[15&J]=h(q,dt)}break;case 65501:y(),x=y();break;case 65498:y();var Z,Gt=d[k++],vt=[];for(L=0;L>4],Z.huffmanTableAC=T[15&xt],vt.push(Z)}var _t=d[k++],jt=d[k++],mt=d[k++],zt=f(d,k,b,vt,x,_t,jt,mt>>4,15&mt);k+=zt;break;case 65535:d[k]!==255&&k--;break;default:if(d[k-3]===255&&d[k-2]>=192&&d[k-2]<=254){k-=3;break}throw new t("unknown marker "+P.toString(16))}P=y()}for(this.width=b.samplesPerLine,this.height=b.scanLines,this.jfif=S,this.eof=k,this.adobe=A,this.components=[],L=0;L>8)+F[T+1];return G},_isColorConversionNeeded:function(){return this.adobe?!!this.adobe.transformCode:this.numComponents===3?this.colorTransform!==0:this.colorTransform===1},_convertYccToRgb:function(d){for(var y,w,C,b=0,x=d.length;b4)throw new t("Unsupported color mode");var C=this._getLinearizedBlockData(d,y);if(this.numComponents===1&&w){for(var b=C.length,x=new Uint8ClampedArray(3*b),k=0,S=0;S=0;g--)p[d++]=v[f]>>g&1}catch{}if(n===1&&l.length===i*u){const v=new Uint8Array(l.buffer);h=[v,v,v]}else{for(h=[],f=0;f<3;f++)h.push(new Uint8Array(a));for(g=0,m=0;mimport("./lerc-wasm-WW-RihuZ.js"),__vite__mapDeps([0,1,2])).then(t=>t.l).then(({default:t})=>t({locateFile:e=>Fr(`esri/layers/support/rasterFormats/${e}`)})).then(t=>{po(t)}),ie)}const Yt={getBlobInfo:null,decode:null};function fo(t){return 16+(t>>3<<3)}function bt(t,e,r){r.set(t.slice(e,e+r.length))}function po(t){const{_malloc:e,_free:r,_lerc_getBlobInfo:o,_lerc_getDataRanges:c,_lerc_decode_4D:i,asm:u}=t;let n;const s=Object.values(u).find(a=>a&&"buffer"in a&&a.buffer===t.HEAPU8.buffer),l=a=>{const h=a.map(g=>fo(g)),p=h.reduce((g,v)=>g+v),f=e(p);n=new Uint8Array(s.buffer);let m=h[0];h[0]=f;for(let g=1;g{const f=new Uint8Array(48),m=new Uint8Array(8*3),[g,v,d]=l([a.length,f.length,m.length]);n.set(a,g),n.set(f,v),n.set(m,d);let y=o(g,a.length,v,d,12,3);if(y)throw r(g),new Error(`lerc-getBlobInfo: error code is ${y}`);n=new Uint8Array(s.buffer),bt(n,v,f),bt(n,d,m);const w=new Uint32Array(f.buffer),C=new Float64Array(m.buffer),[b,x,,k,S,A,M,T,I,P,L]=w,E={version:b,depthCount:P,width:k,height:S,validPixelCount:M,bandCount:A,blobSize:T,maskCount:I,dataType:x,minValue:C[0],maxValue:C[1],maxZerror:C[2],statistics:[],bandCountWithNoData:L};if(L&&P>1)return r(g),E;if(P===1&&A===1)return r(g),E.statistics.push({minValue:C[0],maxValue:C[1]}),E;const U=P*A*8,R=new Uint8Array(U),B=new Uint8Array(U);let G=g,O=0,j=0,F=!1;if(n.byteLength1){const wt=V.slice(tt*P,(tt+1)*P),Ct=_.slice(tt*P,(tt+1)*P),J=Math.min.apply(null,wt),q=Math.max.apply(null,Ct);X.push({minValue:J,maxValue:q,depthStats:{minValues:wt,maxValues:Ct}})}else X.push({minValue:V[tt],maxValue:_[tt]});return r(G),F||r(O),E},Yt.decode=(a,h)=>{const{maskCount:p,depthCount:f,bandCount:m,width:g,height:v,dataType:d,bandCountWithNoData:y}=h,w=gr[d],C=g*v,b=new Uint8Array(C*m),x=C*f*m*w.size,k=new Uint8Array(x),S=new Uint8Array(m),A=new Uint8Array(8*m),[M,T,I,P,L]=l([a.length,b.length,k.length,S.length,A.length]);n.set(a,M),n.set(b,T),n.set(k,I),n.set(S,P),n.set(A,L);const E=i(M,a.length,p,T,f,g,v,m,d,I,P,L);if(E)throw r(M),new Error(`lerc-decode: error code is ${E}`);n=new Uint8Array(s.buffer),bt(n,I,k),bt(n,T,b);let U=null;if(y){bt(n,P,S),bt(n,L,A),U=[];const R=new Float64Array(A.buffer);for(let B=0;B1){b.set(y[0]);for(let M=1;M=x;if(f>0&&k)for(let M=0;M1?y:null,{pixelType:A}=g;return{width:s,height:l,bandCount:a,pixelType:A,depthCount:h,statistics:m,pixels:d,mask:b,bandMasks:S,noDataValues:n}}function go(t,e,r,o=!0){if(e%4!=0||r%4!=0){const c=new ArrayBuffer(4*Math.ceil(r/4)),i=new Uint8Array(c),u=new Uint8Array(t,e,r);if(o)for(let n=0;n=i)n-=i,p=h>>>32-i,h<<=i;else{p=h>>>32-n,h=c[a++];const d=i-n;n=32-d,p=(p<>>n),h<<=d}if(p===257)break;if(p===256){i=9,u=Ze(),s=u.length,l=[];continue}const v=u[p];if(v==null){if(p>u.length)throw new Error("data integrity issue: code does not exist on code page");l.push(l[0]),u[s++]=l.slice(),Qe(g,l)}else Qe(g,v),l.push(v[0]),l.length>1&&(u[s++]=l.slice()),l=v.slice();if(Et.has(s)&&i++,n===0&&(h=c[a++],n=32),a>f||a===f&&n<=m)break}return new Uint8Array(g)}Et.add(511),Et.add(1023),Et.add(2047),Et.add(4095),Et.add(8191);const tr=(t,e)=>{const r=e.width*e.height,o=e.pixelType;return Math.floor(t.byteLength/(r*Cr(o)))},Cr=t=>{let e=1;switch(t){case Uint8Array:case Int8Array:e=1;break;case Uint16Array:case Int16Array:e=2;break;case Uint32Array:case Int32Array:case Float32Array:e=4;break;case Float64Array:e=8}return e},yo=(t,e)=>{if(8*t.byteLength=0;n--)o[c++]=i>>n&1;for(n=7;c>n&1,n--;return o};let wo=class{static decode(e,r){const o=r.pixelType,c=[],i=r.width*r.height,u=tr(e,r),{bandIds:n,format:s}=r,l=(n==null?void 0:n.length)||tr(e,r),a=e.byteLength-e.byteLength%(i*Cr(o)),h=new o(e,0,i*u);let p,f,m,g,v=null;if(s==="bip")for(p=0;p>4,c<8?c=1:c===15?(c=4,i=(7&i)<<18|(63&t[r++])<<12|(63&t[r++])<<6|63&t[r++]):c===14?(c=3,i=(15&i)<<12|(63&t[r++])<<6|63&t[r++]):(c=2,i=(31&i)<<6|63&t[r++]),(i!==0||e)&&(o+=String.fromCharCode(i));return o}const Ae=(()=>{const t=[];return t[254]="NEWSUBFILETYPE",t[255]="SUBFILETYPE",t[256]="IMAGEWIDTH",t[257]="IMAGELENGTH",t[258]="BITSPERSAMPLE",t[259]="COMPRESSION",t[262]="PHOTOMETRICINTERPRETATION",t[263]="THRESHHOLDING",t[264]="CELLWIDTH",t[265]="CELLLENGTH",t[266]="FILLORDER",t[269]="DOCUMENTNAME",t[270]="IMAGEDESCRIPTION",t[271]="MAKE",t[272]="MODEL",t[273]="STRIPOFFSETS",t[274]="ORIENTATION",t[277]="SAMPLESPERPIXEL",t[278]="ROWSPERSTRIP",t[279]="STRIPBYTECOUNTS",t[280]="MINSAMPLEVALUE",t[281]="MAXSAMPLEVALUE",t[282]="XRESOLUTION",t[283]="YRESOLUTION",t[284]="PLANARCONFIGURATION",t[285]="PAGENAME",t[286]="XPOSITION",t[287]="YPOSITION",t[288]="FREEOFFSETS",t[289]="FREEBYTECOUNTS",t[290]="GRAYRESPONSEUNIT",t[291]="GRAYRESPONSECURVE",t[292]="T4OPTIONS",t[293]="T6OPTIONS",t[296]="RESOLUTIONUNIT",t[297]="PAGENUMBER",t[300]="COLORRESPONSEUNIT",t[301]="TRANSFERFUNCTION",t[305]="SOFTWARE",t[306]="DATETIME",t[315]="ARTIST",t[316]="HOSTCOMPUTER",t[317]="PREDICTOR",t[318]="WHITEPOINT",t[319]="PRIMARYCHROMATICITIES",t[320]="COLORMAP",t[321]="HALFTONEHINTS",t[322]="TILEWIDTH",t[323]="TILELENGTH",t[324]="TILEOFFSETS",t[325]="TILEBYTECOUNTS",t[326]="BADFAXLINES",t[327]="CLEANFAXDATA",t[328]="CONSECUTIVEBADFAXLINES",t[330]="SUBIFD",t[332]="INKSET",t[333]="INKNAMES",t[334]="NUMBEROFINKS",t[336]="DOTRANGE",t[337]="TARGETPRINTER",t[338]="EXTRASAMPLES",t[339]="SAMPLEFORMAT",t[340]="SMINSAMPLEVALUE",t[341]="SMAXSAMPLEVALUE",t[342]="TRANSFERRANGE",t[347]="JPEGTABLES",t[512]="JPEGPROC",t[513]="JPEGIFOFFSET",t[514]="JPEGIFBYTECOUNT",t[515]="JPEGRESTARTINTERVAL",t[517]="JPEGLOSSLESSPREDICTORS",t[518]="JPEGPOINTTRANSFORM",t[519]="JPEGQTABLES",t[520]="JPEGDCTABLES",t[521]="JPEGACTABLES",t[529]="YCBCRCOEFFICIENTS",t[530]="YCBCRSUBSAMPLING",t[531]="YCBCRPOSITIONING",t[532]="REFERENCEBLACKWHITE",t[700]="XMP",t[33550]="GEOPIXELSCALE",t[33922]="GEOTIEPOINTS",t[33432]="COPYRIGHT",t[42112]="GDAL_METADATA",t[42113]="GDAL_NODATA",t[50844]="RPCCOEFFICIENT",t[34264]="GEOTRANSMATRIX",t[34735]="GEOKEYDIRECTORY",t[34736]="GEODOUBLEPARAMS",t[34737]="GEOASCIIPARAMS",t[34665]="EXIFIFD",t[34853]="GPSIFD",t[40965]="INTEROPERABILITYIFD",t})(),bo=(()=>{const t=Ae.slice();return t[36864]="ExifVersion",t[40960]="FlashpixVersion",t[40961]="ColorSpace",t[42240]="Gamma",t[37121]="ComponentsConfiguration",t[37122]="CompressedBitsPerPixel",t[40962]="PixelXDimension",t[40963]="PixelYDimension",t[37500]="MakerNote",t[37510]="UserComment",t[40964]="RelatedSoundFile",t[36867]="DateTimeOriginal",t[36868]="DateTimeDigitized",t[36880]="OffsetTime",t[36881]="OffsetTimeOriginal",t[36882]="OffsetTimeDigitized",t[37520]="SubSecTime",t[37521]="SubSecTimeOriginal",t[37522]="SubSecTimeDigitized",t[37888]="Temperature",t[37889]="Humidity",t[37890]="Pressure",t[37891]="WaterDepth",t[37892]="Acceleration",t[37893]="CameraElevationAngle",t[42016]="ImageUniqueID",t[42032]="CameraOwnerName",t[42033]="BodySerialNumber",t[42034]="LensSpecification",t[42035]="LensMake",t[42036]="LensModel",t[42037]="LensSerialNumber",t[33434]="ExposureTime",t[33437]="FNumber",t[34850]="ExposureProgram",t[34852]="SpectralSensitivity",t[34855]="PhotographicSensitivity",t[34856]="OECF",t[34864]="SensitivityType",t[34865]="StandardOutputSensitivity",t[34866]="RecommendedExposureIndex",t[34867]="ISOSpeed",t[34868]="ISOSpeedLatitudeyyy",t[34869]="ISOSpeedLatitudezzz",t[37377]="ShutterSpeedValue",t[37378]="ApertureValue",t[37379]="BrightnessValue",t[37380]="ExposureBiasValue",t[37381]="MaxApertureValue",t[37382]="SubjectDistance",t[37383]="MeteringMode",t[37384]="LightSource",t[37385]="Flash",t[37386]="FocalLength",t[37396]="SubjectArea",t[41483]="FlashEnergy",t[41484]="SpatialFrequencyResponse",t[41486]="FocalPlaneXResolution",t[41487]="FocalPlaneYResolution",t[41488]="FocalPlaneResolutionUnit",t[41492]="SubjectLocation",t[41493]="ExposureIndex",t[41495]="SensingMethod",t[41728]="FileSource",t[41729]="SceneType",t[41730]="CFAPattern",t[41985]="CustomRendered",t[41986]="ExposureMode",t[41987]="WhiteBalance",t[41988]="DigitalZoomRatio",t[41989]="FocalLengthIn35mmFilm",t[41990]="SceneCaptureType",t[41991]="GainControl",t[41992]="Contrast",t[41993]="Saturation",t[41994]="Sharpness",t[41995]="DeviceSettingDescription",t[41996]="SubjectDistanceRange",t})(),vo=["GPSVersionID","GPSLatitudeRef","GPSLatitude","GPSLongitudeRef","GPSLongitude","GPSAltitudeRef","GPSAltitude","GPSTimeStamp","GPSSatellites","GPSStatus","GPSMeasureMode","GPSDOP","GPSSpeedRef","GPSSpeed","GPSTrackRef","GPSTrack","GPSImgDirectionRef","GPSImgDirection","GPSMapDatum","GPSDestLatitudeRef","GPSDestLatitude","GPSDestLongitudeRef","GPSDestLongitude","GPSDestBearingRef","GPSDestBearing","GPSDestDistanceRef","GPSDestDistance","GPSProcessingMethod","GPSAreaInformation","GPSDateStamp","GPSDifferential","GPSHPositioningError"],xo=(()=>{const t=[];return t[1024]="GTModelTypeGeoKey",t[1025]="GTRasterTypeGeoKey",t[1026]="GTCitationGeoKey",t[2048]="GeographicTypeGeoKey",t[2049]="GeogCitationGeoKey",t[2050]="GeogGeodeticDatumGeoKey",t[2051]="GeogPrimeMeridianGeoKey",t[2052]="GeogLinearUnitsGeoKey",t[2053]="GeogLinearUnitSizeGeoKey",t[2054]="GeogAngularUnitsGeoKey",t[2055]="GeogAngularUnitSizeGeoKey",t[2056]="GeogEllipsoidGeoKey",t[2057]="GeogSemiMajorAxisGeoKey",t[2058]="GeogSemiMinorAxisGeoKey",t[2059]="GeogInvFlatteningGeoKey",t[2061]="GeogPrimeMeridianLongGeoKey",t[2060]="GeogAzimuthUnitsGeoKey",t[3072]="ProjectedCSTypeGeoKey",t[3073]="PCSCitationGeoKey",t[3074]="ProjectionGeoKey",t[3075]="ProjCoordTransGeoKey",t[3076]="ProjLinearUnitsGeoKey",t[3077]="ProjLinearUnitSizeGeoKey",t[3078]="ProjStdParallel1GeoKey",t[3079]="ProjStdParallel2GeoKey",t[3080]="ProjNatOriginLongGeoKey",t[3081]="ProjNatOriginLatGeoKey",t[3082]="ProjFalseEastingGeoKey",t[3083]="ProjFalseNorthingGeoKey",t[3084]="ProjFalseOriginLongGeoKey",t[3085]="ProjFalseOriginLatGeoKey",t[3086]="ProjFalseOriginEastingGeoKey",t[3087]="ProjFalseOriginNorthingGeoKey",t[3088]="ProjCenterLongGeoKey",t[3090]="ProjCenterEastingGeoKey",t[3091]="ProjCenterNorthingGeoKey",t[3092]="ProjScaleAtNatOriginGeoKey",t[3093]="ProjScaleAtCenterGeoKey",t[3094]="ProjAzimuthAngleGeoKey",t[3095]="ProjStraightVertPoleLongGeoKey",t[4096]="VerticalCSTypeGeoKey",t[4097]="VerticalCitationGeoKey",t[4098]="VerticalDatumGeoKey",t[4099]="VerticalUnitsGeoKey",t})(),ko=(t,e)=>{let r=(e||Ae)[t];return r===void 0&&(r="unknown"+String(t)),r},ge=new Map;ge.set("EXIFIFD",bo),ge.set("GPSIFD",vo);const Lt={tiffTags:Ae,ifdTags:ge,geoKeys:xo,getTagName:ko},Se=(()=>{const t=new ArrayBuffer(4),e=new Uint8Array(t);return new Uint32Array(t)[0]=1,e[0]===1})(),er=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],Ut=4294967296,Ao=new Set([1,5,6,7,8,34712,34887]);function Te(t,e){let r="unknown";return t===3?r=e===64?"f64":"f32":t===1?e===1?r="u1":e===2?r="u2":e===4?r="u4":e<=8?r="u8":e<=16?r="u16":e<=32&&(r="u32"):t===2&&(e<=8?r="s8":e<=16?r="s16":e<=32&&(r="s32")),r}function Zt(t){let e=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":e=Uint8Array;break;case"u16":e=Uint16Array;break;case"u32":e=Uint32Array;break;case"s8":e=Int8Array;break;case"s16":e=Int16Array;break;case"s32":e=Int32Array;break;case"f64":e=Float64Array;break;default:e=Float32Array}return e}function So(t,e){return{x:e[0]*t.x+e[1]*t.y+e[2],y:e[3]*t.x+e[4]*t.y+e[5]}}function br(t,e){var r;return(r=t.get(e))==null?void 0:r.values}function Mt(t,e){var r;return(r=t.get(e))==null?void 0:r.values}function rr(t,e){var r,o;return(o=(r=t.get(e))==null?void 0:r.values)==null?void 0:o[0]}function z(t,e){var r,o;return(o=(r=t.get(e))==null?void 0:r.values)==null?void 0:o[0]}function se(t,e,r,o=0,c=Lt.tiffTags,i=4){const u=i===8,n=u?Me(new DataView(t,r,8),0,e):new DataView(t,r,2).getUint16(0,e),s=4+2*i,l=u?8:2,a=l+n*s;if(r+a>t.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:a};const h=r+a+4<=t.byteLength?Kt(new DataView(t,r+a,i===8?8:4),0,e,i===8):null,p=r+l,f=new Map;let m,g,v,d,y,w=0,C=0;for(let b=0;bwr(t,{inputOffset:e}).pixels[0];function ye(t,e){if(e!==1&&e!==2&&e!==4)return t;const r=new Uint8Array(t),o=8/e,c=new Uint8Array(t.byteLength*o);let i=0;const u=2**e-1;for(let n=0;n>>8-e&u}return c.buffer}function we(t,e,r){const o=new mr;o.parse(t),o.colorTransform=r===6?-1:0;const c=o.getData(o.width,o.height,e!==1&&e!==4);return new Uint8Array(c.buffer)}function Ce(t){const e=new Vt(t).getBytes(),r=new ArrayBuffer(e.length),o=new Uint8Array(r);return o.set(e),o}async function be(t,e,r,o,c){const i=Se===e,u=z(r,"BITSPERSAMPLE"),n=z(r,"SAMPLESPERPIXEL")??1,s=z(r,"PHOTOMETRICINTERPRETATION"),l=z(r,"SAMPLEFORMAT")??1,a=Te(l,u),h=z(r,"COMPRESSION")??1,p=Zt(a);let f,m,g;if(h===34887)return await yr(),To(t,o);if(h===1)f=t.slice(o,o+c),m=new Uint8Array(f);else if(h===8||h===32946)m=new Uint8Array(t,o,c),m=Ce(m),f=m.buffer;else if(h===6)m=new Uint8Array(t,o,c),m=we(m,n,s),f=m.buffer;else if(h===7){const w=r.get("JPEGTABLES").values,C=w.length-2;m=new Uint8Array(C+c-2);for(let x=0;x1&&(h===5||h===8||h===32946)&&d&&y){const w=Qt(r),C=new p(g.length);C.set(g),g=Go(C,y,d,l===3&&v===3,w?1:n)}return g}async function Io(t,e,r){const o=Mt(r,"TILEOFFSETS");if(o===void 0)return null;const c=Mt(r,"TILEBYTECOUNTS"),{width:i,height:u,pixelType:n,tileWidth:s,tileHeight:l}=Ie([r]),a=Qt(r,e),h=z(r,"SAMPLESPERPIXEL")||e.planes,p=i*u,f=z(r,"BITSPERSAMPLE"),m=(z(r,"COMPRESSION")??1)===34887,g=Zt(n),v=[];for(let R=0;R1){const R=Math.round(o.length/h);for(d=0;d{const o=Se===e.littleEndian,c=Mt(r,"STRIPOFFSETS");if(c===void 0)return null;const{width:i,height:u,pixelType:n}=Ie([r]),s=z(r,"SAMPLESPERPIXEL")||e.planes,l=z(r,"PHOTOMETRICINTERPRETATION"),a=i*u,h=z(r,"BITSPERSAMPLE"),p=Zt(n),f=new p(a*s),m=Mt(r,"STRIPBYTECOUNTS"),g=z(r,"ROWSPERSTRIP"),v=z(r,"COMPRESSION")??1;let d,y,w,C,b,x,k,S,A,M=g;if(h%8==0)for(d=0;du?u-d*g:g,n==="u8"||n==="s8"||o)v===8||v===32946?(k=new Uint8Array(t,c[d],m[d]),k=Ce(k),x=k.buffer):v===6?(k=new Uint8Array(t,c[d],m[d]),k=we(k,s,l),x=k.buffer):v===5?(k=ke(t,c[d],m[d],e.littleEndian),x=k.buffer):(m[d]!==M*i*s*h/8&&console.log("strip byte counts is different than expected"),x=t.slice(c[d],c[d]+m[d])),x=ye(x,h),C=new p(x);else{switch(v===6||v===8||v===32946?(k=new Uint8Array(t,c[d],m[d]),S=Ce(k),x=S.buffer):(m[d]!==M*i*s*h/8&&console.log("strip byte counts is different than expected"),x=new ArrayBuffer(m[d]),k=new Uint8Array(t,c[d],m[d]),S=new Uint8Array(x)),n){case"u16":case"s16":for(w=0;w{if(!(t&&t.length>0&&e&&r))return null;let o,c,i;const u=t[0].length,n=t.length,s=new Uint8Array(u);for(let l=0;li?0:1;else for(let a=0;ai?0:1);return s},Eo=t=>{if(!t)return null;const e=t.match(//gi);if(!e||e.length===0)return null;const r=new Map;let o,c,i,u,n;for(let d=0;d")),u=o.indexOf("sample="),u>-1&&(n=o.slice(u+8,o.indexOf('"',u+8))),u=o.indexOf("name="),u>-1&&(c=o.slice(u+6,o.indexOf('"',u+6))),c&&(i=o.slice(o.indexOf(">")+1,o.indexOf("")).trim(),n!=null?r.has(c)?r.get(c)[n]=i:r.set(c,[i]):r.set(c,i)),n=null;const s=r.get("STATISTICS_MINIMUM"),l=r.get("STATISTICS_MAXIMUM"),a=r.get("STATISTICS_MEAN"),h=r.get("STATISTICS_STDDEV");let p=null;if(s&&l){p=[];for(let d=0;dv&&p>(c?t.byteLength:t?t.byteLength-s+o:0))return r.offlineOffsetSize=[s,p],r.values=null,!1;if(f<=v){if(!e)if(v<=32)s>>>=32-f;else{const y=d!=null&&d.length?d[0]:s>>>0,w=d!=null&&d.length?d[1]:Math.round((s-y)/Ut);f<=32?(s=y>>>32-f,d[0]=s):(s=y*2**(32-f)+(w>>>32-f),d[0]=y,d[1]=w>>>32-f)}if(n===1&&h===v)l=[s];else if(v===64){const y=d!=null&&d.length?d[0]:s>>>0,w=d!=null&&d.length?d[1]:Math.round((s-y)/Ut);let C=y,b=32;for(g=1;g<=n;g++){const x=32-h*g%32;if(b>>32-b,S=w<<32-b>>>32-b;C=w,l.push(k+S*2**(h-b)),b-=32-(h-b)}else l.push(C<>>32-h),b-=h;b===0&&(b=32,C=w)}}else for(g=1;g<=n;g++){const y=32-h*g;l.push(s<>>32-h)}}else{s-=o,c&&(s=0);for(let y=s;yparseFloat(G)),p.some(G=>isNaN(G))&&(p=null));const f=z(e,"COMPRESSION")??1;let m;switch(f){case 1:m="NONE";break;case 2:case 3:case 4:case 32771:m="CCITT";break;case 5:m="LZW";break;case 6:case 7:m="JPEG";break;case 32773:m="PACKBITS";break;case 8:case 32946:m="DEFLATE";break;case 34712:m="JPEG2000";break;case 34887:m="LERC";break;default:m=String(f)}let g=!0,v="";Ao.has(f)||(g=!1,v+="unsupported tag compression "+f),s>3&&(g=!1,v+="unsupported tag sampleFormat "+s),u!==1&&u!==2&&u!==4&&u%8!=0&&(g=!1,v+="unsupported tag bitsPerSample "+u);const d=rr(e,"GEOASCIIPARAMS");let y;if(d){const G=d.split("|").find(j=>j.includes("ESRI PE String = ")),O=G?G.replace("ESRI PE String = ",""):"";y=O.startsWith("COMPD_CS")||O.startsWith("PROJCS")||O.startsWith("GEOGCS")?{wkid:null,wkt:O}:null}const w=Mt(e,"GEOTIEPOINTS"),C=Mt(e,"GEOPIXELSCALE"),b=Mt(e,"GEOTRANSMATRIX"),x=e.has("GEOKEYDIRECTORY")?e.get("GEOKEYDIRECTORY").data:null;let k,S,A=!1,M=!1;if(x){A=z(x,"GTRasterTypeGeoKey")===2;const G=z(x,"GTModelTypeGeoKey");if(G===2){const O=z(x,"GeographicTypeGeoKey");O>=1024&&O<=32766&&(y={wkid:O}),y||O!==32767||(M=!0,y={wkid:4326})}else if(G===1){const O=z(x,"ProjectedCSTypeGeoKey");O>=1024&&O<=32766&&(y={wkid:O})}}if(C&&w&&w.length>=6?(k=[C[0],0,w[3]-w[0]*C[0],0,-Math.abs(C[1]),w[4]-w[1]*C[1]],A&&(k[2]-=.5*k[0]+.5*k[1],k[5]-=.5*k[3]+.5*k[4])):b&&b.length===16&&(k=A?[b[0],b[1],b[3]-.5*b[0],b[4],b[5],b[7]-.5*b[5]]:[b[0],b[1],b[3],b[4],b[5],b[7]]),k){const G=[{x:0,y:i},{x:0,y:0},{x:c,y:i},{x:c,y:0}];let O,j=Number.POSITIVE_INFINITY,F=Number.POSITIVE_INFINITY,V=Number.NEGATIVE_INFINITY,_=Number.NEGATIVE_INFINITY;for(let X=0;Xj?j:O.x,V=O.xF?F:O.y,_=O.y<_?_:O.y;S={xmin:j,xmax:V,ymin:F,ymax:_,spatialReference:y}}else S={xmin:-.5,ymin:.5-i,xmax:c-.5,ymax:.5,spatialReference:y};M&&(S.xmax-S.xmin>400||Math.max(Math.abs(S.xmin),Math.abs(S.xmax))>361)&&(y=null,S.spatialReference=null);const T=vr(t);let I,P,L,E,U;if(T.length>0){L=Math.round(Math.log(c/z(T[0],"IMAGEWIDTH"))/Math.LN2);const G=T[T.length-1];E=Math.round(Math.log(c/z(G,"IMAGEWIDTH"))/Math.LN2),I=z(G,"TILEWIDTH"),P=z(G,"TILELENGTH")}I=E!=null&&E>0?I||r:null,P=E!=null&&E>0?P||o:null,r&&(U=[{maxCol:Math.ceil(c/r)-1,maxRow:Math.ceil(i/o)-1,minRow:0,minCol:0}],T.forEach(G=>{U.push({maxCol:Math.ceil(z(G,"IMAGEWIDTH")/z(G,"TILEWIDTH"))-1,maxRow:Math.ceil(z(G,"IMAGELENGTH")/z(G,"TILELENGTH"))-1,minRow:0,minCol:0})}));const R=rr(t[0],"GDAL_METADATA"),B=Eo(R);return v+=" "+kr({width:c,height:i,tileWidth:r,tileHeight:o,planes:n,ifds:t}),{width:c,height:i,tileWidth:r,tileHeight:o,planes:n,isBSQ:a,pixelType:l,compression:m,noData:p,hasMaskBand:xr(t).length===T.length+1,isSupported:g,message:v,extent:S,isPseudoGeographic:M,affine:C?null:k,firstPyramidLevel:L,maximumPyramidLevel:E,pyramidBlockWidth:I,pyramidBlockHeight:P,tileBoundary:U,metadata:B}}function Qt(t,e){const r=br(t,"PLANARCONFIGURATION");return r?r[0]===2:!!e&&e.isBSQ}function vr(t){return t.filter(e=>z(e,"NEWSUBFILETYPE")===1)}function xr(t){return t.filter(e=>{const r=(4&(z(e,"NEWSUBFILETYPE")??0))==4,o=z(e,"PHOTOMETRICINTERPRETATION")===4;return r&&o})}function Lo(t){const{littleEndian:e,isBigTiff:r,firstIFDPos:o}=Oo(t);let c=o;const i=[];do{const u=Do(t,e,c,0,Lt.tiffTags,r?8:4);if(!u.success)break;i.push(u.ifd),c=u.nextIFD}while(c>0);return{...Ie(i),littleEndian:e,isBigTiff:r,ifds:i,pyramidIFDs:vr(i),maskIFDs:xr(i)}}function Me(t,e,r){const o=t.getUint32(e,r),c=t.getUint32(e+4,r);return r?c*Ut+o:o*Ut+c}function Uo(t,e,r){let o=r?t.getInt32(e,r):t.getUint32(e,r),c=r?t.getUint32(e+4,r):t.getInt32(e+4,r);const i=(r?o:c)>=0?1:-1;return r?o*=i:c*=i,i*(r?c*Ut+o:o*Ut+c)}function Kt(t,e,r,o){return o?Me(t,e,r):t.getUint32(e,r)}function Oo(t){const e=new DataView(t,0,16),r=e.getUint16(0,!1);let o=null;if(r===18761)o=!0;else{if(r!==19789)throw new Error("unexpected endianess byte");o=!1}const c=e.getUint16(2,o);if(c!==42&&c!==43)throw new Error("unexpected tiff identifier");let i=4;const u=c===43;if(u){const n=e.getUint16(i,o);if(i+=2,n!==8)throw new Error("unsupported bigtiff version");if(e.getUint16(i,o)!==0)throw new Error("unsupported bigtiff version");i+=2}return{littleEndian:o,isBigTiff:u,firstIFDPos:Kt(e,i,o,u)}}function Do(t,e,r,o=0,c=Lt.tiffTags,i=4){const u=se(t,e,r,o,c,i);let n;const s=u.ifd;if(s){if(Lt.ifdTags.forEach((l,a)=>{s.has(a)&&(n=s.get(a),n.data=se(t,e,n.valueOffset-o,o,l).ifd)}),s.has("GEOKEYDIRECTORY")){n=s.get("GEOKEYDIRECTORY");const l=n.values;if(l&&l.length>4){const a=l[0]+"."+l[1]+"."+l[2];n.data=se(t,e,n.valueOffset+6-o,o,Lt.geoKeys,2).ifd,n.data&&n.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(s.has("XMP")){n=s.get("XMP");const l=n.values;typeof l[0]=="number"&&n.type===7&&(n.values=[Co(new Uint8Array(l))])}}return u}function kr(t){const{width:e,height:r,tileHeight:o,tileWidth:c}=t,i=t.planes,u=c?c*o:e*r,n=z(t.ifds[0],"BITSPERSAMPLE");let s="";return u*i>2**30/(n>8?n/8:1)&&(s=c?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),s}function Go(t,e,r,o,c){const i=o?4:1,u=r*i*c;o&&(t=new Uint8Array(t.buffer));for(let l=0;lA.min):null,k=b?b.map(A=>A.max):null,S={pixelType:l,width:p,height:f,pixels:d,noDataValue:C};return C!=null?xe(S,C):x&&k&&e.applyMinMaxConstraint&&(S.mask=Po(d,x,k)),S}async function No(t,e={}){const r=e.pyramidLevel||0,o=e.headerInfo||Lo(t),{ifds:c,noData:i}=o;if(c.length===0)throw new Error("no valid image file directory");const u=kr(o);if(u)throw u;let n=null;const s=r===-1?c[c.length-1]:c[r],l=i??e.noDataValue;return n=o.tileWidth?await Io(t,o,s):Mo(t,o,s),n&&(l!=null&&xe(n,l),n)}var $o=function(t){var e,r,o,c,i,u;function n(s){var l,a,h,p,f,m,g,v,d,y,w,C,b;for(this.data=s,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},f=null;;){switch(l=this.readUInt32(),v=(function(){var x,k;for(k=[],x=0;x<4;++x)k.push(String.fromCharCode(this.data[this.pos++]));return k}).call(this).join(""),v){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(l);break;case"fcTL":f&&this.animation.frames.push(f),this.pos+=4,f={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},p=this.readUInt16(),h=this.readUInt16()||100,f.delay=1e3*p/h,f.disposeOp=this.data[this.pos++],f.blendOp=this.data[this.pos++],f.data=[];break;case"IDAT":case"fdAT":for(v==="fdAT"&&(this.pos+=4,l-=4),s=(f!=null?f.data:void 0)||this.imgData,w=0;0<=l?wl;0<=l?++w:--w)s.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(l),(d=255-this.transparency.indexed.length)>0)for(C=0;0<=d?Cd;0<=d?++C:--C)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(l)[0];break;case 2:this.transparency.rgb=this.read(l)}break;case"tEXt":m=(y=this.read(l)).indexOf(0),g=String.fromCharCode.apply(String,y.slice(0,m)),this.text[g]=String.fromCharCode.apply(String,y.slice(m+1));break;case"IEND":return f&&this.animation.frames.push(f),this.colors=(function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}).call(this),this.hasAlphaChannel=(b=this.colorType)===4||b===6,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=(function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}).call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=l}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return n.load=function(s,l,a){var h;return typeof l=="function"&&(a=l),(h=new XMLHttpRequest).open("GET",s,!0),h.responseType="arraybuffer",h.onload=function(){var p;return p=new n(new Uint8Array(h.response||h.mozResponseArrayBuffer)),typeof(l!=null?l.getContext:void 0)=="function"&&p.render(l),typeof a=="function"?a(p):void 0},h.send(null)},r=1,o=2,e=0,n.prototype.read=function(s){var l,a;for(a=[],l=0;0<=s?ls;0<=s?++l:--l)a.push(this.data[this.pos++]);return a},n.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},n.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},n.prototype.decodePixels=function(s){var l,a,h,p,f,m,g,v,d,y,w,C,b,x,k,S,A,M,T,I,P,L,E;if(s==null&&(s=this.imgData),s.length===0)return new Uint8Array(0);for(s=(s=new Vt(s)).getBytes(),S=(C=this.pixelBitlength/8)*this.width,b=new Uint8Array(S*this.height),m=s.length,k=0,x=0,a=0;x1&&a/pHo(r,o,t);break;case"tiff":e=_o;break;case"deflate":e=zo;break;case"lzw":e=Wo;break;case"error":e=()=>{throw new yt("rasterCodec:decode","input data contains error")};break;default:e=()=>{throw new yt("rasterCodec:decode","unsupported raster format")}}return e}function Xo(t){let e=null,r=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":r=255,e=Uint8Array;break;case"u16":r=r||65535,e=Uint16Array;break;case"u32":r=r||2**32-1,e=Uint32Array;break;case"s8":r=r||-128,e=Int8Array;break;case"s16":r=r||-32768,e=Int16Array;break;case"s32":r=r||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:r}}function Zo(t,e=1){if(!t)return;const{pixels:r,width:o,height:c,mask:i}=t;if(!r||r.length===0)return;const u=r.length,n=o-1,s=c-1,l=[];let a,h,p,f,m,g,v=null;const d=H.getPixelArrayConstructor(t.pixelType);if(e===0){for(a=0;a1||e&&r.fields.find(c=>c.name.toLowerCase()===e.toLowerCase())==null)}function en(t){const{bandCount:e,dataType:r,pixelType:o}=t;return r==="elevation"||r==="generic"&&e===1&&(o==="s16"||o==="s32"||o==="f32"||o==="f64")}function rn(t,e=!1){const{bandCount:r,colormap:o,pixelType:c}=t;return r===1&&(!!(o!=null&&o.length)||!e&&c==="u8")}function qn(t,e=!1){const{attributeTable:r,bandCount:o}=t;return o===1&&(!e||r!=null||t.histograms!=null)}function Kn(t){const{dataType:e}=t;return e==="vector-uv"||e==="vector-magdir"}function Jn(t){const{dataType:e}=t;return e==="vector-uv"||e==="vector-magdir"}const ae=1,on=[.299,.587,.114];function Tr(t,e=256){e=Math.min(e,256);const{size:r,counts:o}=t,c=new Uint8Array(r),i=o.reduce((a,h)=>a+h/e,0);let u=0,n=0,s=0,l=i;for(let a=0;a=s){const b=Ir(s,o);for(l=0;l1&&(w-=(1/g)**(v*b[l])),ye[l]){const x=w*g*v**(1/o[l])+u;C[a]=i==="floor"?Math.floor(x):i==="round"?Math.round(x):x}else y>=r[l]?C[a]=n:C[a]=u;else C[a]=u;d[l]=C}}else for(l=0;l=r[l])C[a]=n;else{const b=(y-e[l])*f[l]+u;C[a]=i==="floor"?Math.floor(b):i==="round"?Math.round(b):b}d[l]=C}if(t.contrastOffset!=null){const b=nn(t.contrastOffset,t.brightnessOffset);for(l=0;l0&&r<100?n=(200*u-100*c+2*c*o)/(2*(100-r))+i:r<=0&&r>-100?n=(200*u-100*c+2*c*o)*(100+r)/2e4+i:r===100?(n=200*u-100*c+(c+1)*(100-r)+2*c*o,n=n>0?c:0):r===-100&&(n=i),s[u]=n>c?c:n<0?0:n;return s}function sn(t,e,r){const o=[];for(let c=0;c=255)return ae;let e=0;t!==150&&(e=t<=150?45*Math.cos(.01047*t):17*Math.sin(.021*t));const r=255,o=t+e,c=Math.log(t/r),i=Math.log(o/r);if(i===0)return ae;const u=c/i;return isNaN(u)?ae:Math.min(9.9,Math.max(.01,u))}function ln(t,e,r,o){let c=1/0,i=-1/0,u=0,n=0,s=0,l=0;const a=t.length,h=new Map,p=[];for(let k=0;kl&&(l=A,s=S),c=Si?S:i,u+=S,n++}}if(n===0)return{statistics:{min:0,max:0,avg:0,stddev:0,mode:0,median:0},histogram:null};const f=u/n;let m=0;for(let k=0;kk).length:a,v=g<=1?0:Math.sqrt(m/(g-1));p.sort((k,S)=>k-S);const d=n>>>1,y={min:c,max:i,avg:f,stddev:v,mode:s,median:n%2?p[Math.floor(d)]:(p[d-1]+p[d])/2};if(!o)return{statistics:y,histogram:null};if(["u8","s8","u4","u2","u1"].includes(r)){const k=i-c+1,S=new Uint32Array(k);for(let A=0;Aln(u,(c==null?void 0:c[n])??r,o,!0));return{statistics:i.map(({statistics:u})=>u),histograms:i.map(({histogram:u})=>u)}}function cn(t){var A;if(!((A=t==null?void 0:t.pixels)!=null&&A.length))return null;const{pixels:e,mask:r,bandMasks:o,pixelType:c}=t,i=t.width*t.height,u=e.length;let n,s,l,a,h;const p=[],f=[];let m,g,v,d,y,w,C,b,x,k;const S=256;for(a=0;a[T.minValue,T.maxValue,0,0]);else{const T=cn(r);u=T!=null?T.statistics:null,n=T!=null?T.histograms:null}else u=(M=t.statistics)!=null&&M.length?t.statistics:i.statistics,n="histograms"in t?t.histograms:void 0,n||(n=i.histograms);s!=="percentClip"&&s!=="histogramEqualization"||n!=null&&n.length||(s="minMax");const l=(u==null?void 0:u.length)||(n==null?void 0:n.length)||i.bandCount,a=[],h=[];let p,f,m,g,v,d,y,w,C;u&&!Array.isArray(u[0])&&(u=u.map(T=>[T.min,T.max,T.avg,T.stddev]));const[b,x]=Xt(i.pixelType);if(!(u!=null&&u.length)){for(u=[],w=0;wI[1]&&(h[w]=I[1])}}break;case"histogramEqualization":for(qt(n),w=0;w=20&&(g[0]=g[1]=g[2]=g[g.length-1]=g[g.length-2]=0),m=0,f=(p.max-p.min)/p.size,y=p.min===-.5&&f===1?.5:0,C=0;Cd){a[w]=p.min+f*(C+y);break}for(d=(1-(t.maxPercent||0)/100)*m,h[w]=p.max+y,C=p.size-2;C>=0;C--)if(v[C]Tr(T)))):(S=t.max||255,k=t.min||0),un({minCutOff:a,maxCutOff:h,outMax:S,outMin:k,histogramLut:A},o)}function un(t,e){if(e==null||e.length===0)return t;const r=Math.max.apply(null,e),{minCutOff:o,maxCutOff:c,outMin:i,outMax:u,histogramLut:n}=t;return o.length===e.length||o.length<=r?t:{minCutOff:e.map(s=>o[s]),maxCutOff:e.map(s=>c[s]),histogramLut:n?e.map(s=>n[s]):null,outMin:i,outMax:u}}function Ir(t,e){const r=new Float32Array(t);for(let o=0;o1?e[o]>2?r[o]=6.5+(e[o]-2)**2.5:r[o]=6.5+100*(2-e[o])**4:r[o]=1;return r}function le(t,e){var k;if(!((k=t==null?void 0:t.pixels)!=null&&k.length))return t;const{mask:r,bandMasks:o,width:c,height:i,pixels:u}=t,{minCutOff:n,maxCutOff:s,gamma:l}=e,a=e.outMin||0,h=e.outMax||255,p=c*i,f=e.outputPixelType||"u8",m=t.pixels.map(()=>H.createEmptyBand(f,p)),g=m.length,v=h-a,d=[],y=[];for(let S=0;S=g,b=!!e.isRenderer;if(C){const S=Ir(g,l);for(let A=0;A1&&(L-=(1/v)**(P*S[A])),In[A]){const E=L*v*P**(1/l[A])+a;m[A][T]=b?Math.floor(E):w?Math.round(E):E}else I>=s[A]?m[A][T]=h:m[A][T]=a}}}else for(let S=0;Sn[S]){const I=(T-n[S])*d[S]+a;m[S][M]=b?Math.floor(I):w?Math.round(I):I}else T>=s[S]?m[S][M]=h:m[S][M]=a}}const x=new H({width:c,height:i,mask:r,bandMasks:o,pixels:m,pixelType:f});return x.updateStatistics(),x}const st=1,Rt=1/111e3;function Mr(t){let{altitude:e,azimuth:r}=t;const{hillshadeType:o,pixelSizePower:c=1,pixelSizeFactor:i=1,scalingType:u,isGCS:n,resolution:s}=t,l=o==="multi-directional"?2*t.zFactor:t.zFactor,{x:a,y:h}=s;let p=l/(8*a),f=l/(8*h);if(n&&l>.001&&(p/=Rt,f/=Rt),u==="adjusted")if(n){const I=a*Rt,P=h*Rt;p=(l+I**c*i)/(8*I),f=(l+P**c*i)/(8*P)}else p=(l+a**c*i)/(8*a),f=(l+h**c*i)/(8*h);let m=(90-e)*Math.PI/180,g=Math.cos(m),v=(360-r+90)*Math.PI/180,d=Math.sin(m)*Math.cos(v),y=Math.sin(m)*Math.sin(v);const w=[315,270,225,360,180,0],C=[60,60,60,60,60,90],b=new Float32Array([3,5,3,2,1,4]),x=b.reduce((I,P)=>I+P),k=b.map(I=>I/x),S=o==="multi-directional"?w.length:1,A=new Float32Array(6),M=new Float32Array(6),T=new Float32Array(6);if(o==="multi-directional")for(let I=0;Im?m:v],w=u[g],C=w*y,b=C*(1-Math.abs(d%2-1)),x=w-C;switch(Math.floor(d)){case 0:h[g]=C+x,p[g]=b+x,f[g]=x;break;case 1:h[g]=b+x,p[g]=C+x,f[g]=x;break;case 2:h[g]=x,p[g]=C+x,f[g]=b+x;break;case 3:h[g]=x,p[g]=b+x,f[g]=C+x;break;case 4:h[g]=b+x,p[g]=x,f[g]=C+x;break;case 5:case 6:h[g]=C+x,p[g]=x,f[g]=b+x}}t.pixels=[h,p,f],t.updateStatistics()}function Zn(t,e){if(!Q(t))return t;const r=e.zFactor,o=e.pixelSizePower??1,c=e.pixelSizeFactor??1,i=e.slopeType,u=e.isGCS,{x:n,y:s}=e.resolution;let l=r/(8*n),a=r/(8*s);u&&Math.abs(r-1)<1e-4&&(l/=Rt,a/=Rt),i==="adjusted"&&(l=(r+n**o*c)/(8*n),a=(r+s**o*c)/(8*s));const{dzxs:h,dzys:p,outMask:f}=te(t),{width:m,height:g}=t,v=new Float32Array(m*g);for(let y=st;y360&&(d%=360)),a[p+f]=d}}}return ee(a,s,l),new H({width:s,height:l,pixels:[a],mask:n,pixelType:"f32",validPixelCount:t.validPixelCount,statistics:[{minValue:-1,maxValue:360}]})}function ti(t,e){if(!Q(t))return t;const{curvatures:r,outMask:o}=te(t,e),{width:c,height:i}=t;ee(r,c,i);const u=new H({width:c,height:i,pixels:[r],mask:o,pixelType:"f32",validPixelCount:t.validPixelCount});return u.updateStatistics(),u}let Tt=class extends Dt{constructor(t){super(t)}bind(){const{rendererJSON:t}=this;if(!t)return{success:!1};let e;switch(this.lookup={rendererJSON:{}},t.type){case"uniqueValue":e=this._updateUVRenderer(t);break;case"rasterColormap":e=this._updateColormapRenderer(t);break;case"rasterStretch":e=this._updateStretchRenderer(t);break;case"classBreaks":e=this._updateClassBreaksRenderer(t);break;case"rasterShadedRelief":e=this._updateShadedReliefRenderer(t);break;case"vectorField":e=this._updateVectorFieldRenderer();break;case"flowRenderer":e=this._updateFlowRenderer()}return e}symbolize(t){let e=t==null?void 0:t.pixelBlock;if(!nr(e))return e;if(t.simpleStretchParams&&this.rendererJSON.type==="rasterStretch")return this.simpleStretch(e,t.simpleStretchParams);try{let r;switch(e.pixels.length>3&&(e=e.extractBands([0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(e);break;case"classBreaks":r=this._symbolizeClassBreaks(e);break;case"rasterStretch":r=this._symbolizeStretch(e,t.bandIds);break;case"rasterShadedRelief":{const o=t.extent,c=o.spatialReference.isGeographic,i={x:(o.xmax-o.xmin)/e.width,y:(o.ymax-o.ymin)/e.height};r=this._symbolizeShadedRelief(e,{isGCS:c,resolution:i});break}}return r}catch(r){return gt.getLogger(this).error("symbolize",r.message),e}}simpleStretch(t,e){if(!nr(t))return t;try{return t.pixels.length>3&&(t=t.extractBands([0,1,2])),le(t,{...e,isRenderer:!0})}catch(r){return gt.getLogger(this).error("symbolize",r.message),t}}generateWebGLParameters(t){if(["uniqueValue","rasterColormap","classBreaks"].includes(this.rendererJSON.type)){const{indexedColormap:u,offset:n}=this.lookup.colormapLut||{};return{colormap:u,colormapOffset:n,type:"lut"}}const{pixelBlock:e,isGCS:r,resolution:o,bandIds:c}=t,{rendererJSON:i}=this;return i.type==="rasterStretch"?this._generateStretchWebGLParams(e,i,c):i.type==="rasterShadedRelief"?this._generateShadedReliefWebGLParams(i,r,o??void 0):i.type==="vectorField"?this._generateVectorFieldWebGLParams(i):null}_isLUTChanged(t){if(!this.lookup||!this.lookup.rendererJSON)return!0;if("colorRamp"in this.rendererJSON){const e=this.rendererJSON.colorRamp;return t?JSON.stringify(e)!==JSON.stringify(this.lookup.rendererJSON.colorRamp):(this.rendererJSON,this.lookup.rendererJSON,JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON))}return JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON)}_symbolizeColormap(t){return this._isLUTChanged()&&!this.bind().success?t:re(t,this.lookup.colormapLut)}_symbolizeClassBreaks(t){const{canUseIndexedLUT:e}=this._analyzeClassBreaks(this.rendererJSON);return this._isLUTChanged()&&!this.bind().success?t:e?re(t,this.lookup.colormapLut):Qr(t,this.lookup.remapLut??[])}_symbolizeStretch(t,e){var h,p;const{rasterInfo:r}=this,{pixelType:o,bandCount:c}=r,i=this.rendererJSON,u=["u8","u16","s8","s16"].includes(o);let n,s;const{dra:l}=i,{gamma:a}=this.lookup;if(i.stretchType==="histogramEqualization"){const f=l?null:(h=this.lookup)==null?void 0:h.histogramLut,m=Ft(i,{rasterInfo:r,pixelBlock:t,bandIds:e,returnHistogramLut:!f}),g=le(t,{...m,gamma:a,isRenderer:!0});s=Ve(g,{lut:l?m.histogramLut:f,offset:0})}else if(u){if(l){const f=Ft(i,{rasterInfo:r,pixelBlock:t,bandIds:e});n=or({pixelType:o,...f,gamma:a,rounding:"floor"})}else if(this._isLUTChanged()){if(!this.bind().success)return t;n=this.lookup?this.lookup.stretchLut:null}else n=this.lookup?this.lookup.stretchLut:null;if(!n)return t;c>1&&e!=null&&e.length===(t==null?void 0:t.pixels.length)&&(n==null?void 0:n.lut.length)===c&&(n={lut:e.map(f=>n.lut[f]),offset:n.offset}),s=Ve(t,n)}else{const f=Ft(i,{rasterInfo:r,pixelBlock:t,bandIds:e});s=le(t,{...f,gamma:a,isRenderer:!0})}if(i.colorRamp){if(this._isLUTChanged(!0)&&!this.bind().success)return t;s=re(s,(p=this.lookup)==null?void 0:p.colormapLut)}return s}_symbolizeShadedRelief(t,e){var n;const r=this.rendererJSON,o={...r,...e},c=hn(t,o);if(!r.colorRamp)return c;let i;if(this._isLUTChanged(!0)){if(!this.bind().success)return c;i=this.lookup?this.lookup.hsvMap:null}else i=this.lookup?this.lookup.hsvMap:null;if(!i)return c;const u=((n=this.rasterInfo.statistics)==null?void 0:n[0])??{min:0,max:8e3};return fn(c,t,i,u),c}_isVectorFieldData(){const{bandCount:t,dataType:e}=this.rasterInfo;return t===2&&(e==="vector-magdir"||e==="vector-uv")}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(t){var l;const{bandCount:e,attributeTable:r,pixelType:o}=this.rasterInfo,c=t.field1;if(!c)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const i=t.defaultSymbol,u=e===1&&["u8","s8"].includes(o);if(!tn(this.rasterInfo,c)&&!u)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const n=[];if(r!=null){const a=r.fields.find(h=>h.name.toLowerCase()==="value");if(!a)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach(h=>{var m,g;const p=(m=t.uniqueValueInfos)==null?void 0:m.find(v=>String(v.value)===String(h.attributes[c])),f=(g=p==null?void 0:p.symbol)==null?void 0:g.color;f?n.push([h.attributes[a.name]].concat(f)):i&&n.push([h.attributes[a.name]].concat(i.color))})}else{if(c.toLowerCase()!=="value")return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not availalbe.'};(l=t.uniqueValueInfos)==null||l.forEach(a=>{var p;const h=(p=a==null?void 0:a.symbol)==null?void 0:p.color;h?n.push([parseInt(""+a.value,10)].concat(h)):i&&n.push([parseInt(""+a.value,10)].concat(i==null?void 0:i.color))})}if(n.length===0)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const s=Bt({colormap:n});return this.lookup={rendererJSON:t,colormapLut:s},this.canRenderInWebGL=this._isColormapSupportedByWebGL(s==null?void 0:s.indexedColormap),{success:!0}}_updateColormapRenderer(t){if(!rn(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const e=t.colormapInfos.map(o=>[o.value].concat(o.color)).sort((o,c)=>o[0]-c[0]);if(!e||e.length===0)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=Bt({colormap:e});return this.lookup={rendererJSON:t,colormapLut:r},this.canRenderInWebGL=this._isColormapSupportedByWebGL(r==null?void 0:r.indexedColormap),{success:!0}}_updateShadedReliefRenderer(t){if(!en(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(t.colorRamp){const e=De(t.colorRamp,{interpolateAlpha:!0}),r=Bt({colormap:e}),o=[],c=r.indexedColormap;for(let i=0;iu.name.toLowerCase()==="value"):null,c=e!=null?e.fields.find(u=>u.name.toLowerCase()===t.field.toLowerCase()):null,i=o!=null&&c!==null;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||i,tableValueField:o,tableBreakField:c}}_updateClassBreaksRenderer(t){const{attributeTable:e}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:o,tableBreakField:c}=this._analyzeClassBreaks(t),i=t.classBreakInfos;if(!(i!=null&&i.length))return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const u=i.sort((h,p)=>h.classMaxValue-p.classMaxValue),n=u[u.length-1];let s=t.minValue;if(!r){const h=[];for(let p=0;pw>d);y&&l.push([v].concat(y.symbol.color))}}else{s=Math.floor(t.minValue);for(let h=0;h0&&t[0].min!=null&&t[0].max!=null}_updateStretchRenderer(t){var a,h;let{stretchType:e,dra:r}=t;if(!(e==="none"||(a=t.statistics)!=null&&a.length||this._isValidRasterStatistics(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const o=t.histograms||this.rasterInfo.histograms;!this._isHistogramRequired(t.stretchType)||o!=null&&o.length||r||(e="minMax");const{computeGamma:c,useGamma:i,colorRamp:u}=t;let{gamma:n}=t;if(i&&c&&!(n!=null&&n.length)){const p=(h=t.statistics)!=null&&h.length?t.statistics:this.rasterInfo.statistics;n=sn(this.rasterInfo.pixelType,p)}const s=this.rasterInfo.pixelType,l=!r&&["u8","u16","s8","s16"].includes(s);if(e==="histogramEqualization"){const p=o.map(f=>Tr(f));this.lookup={rendererJSON:t,histogramLut:p}}else if(l){const p=Ft(t,{rasterInfo:this.rasterInfo}),f=or({pixelType:s,...p,gamma:i?n:null,rounding:"floor"});this.lookup={rendererJSON:t,stretchLut:f}}if(u&&!this._isStretchColorRampNoop(u)){const p=De(u,{interpolateAlpha:!0});this.lookup||(this.lookup={rendererJSON:t}),this.lookup.colormapLut=Bt({colormap:p}),this.lookup.rendererJSON=t}return this.lookup.gamma=i&&(n!=null&&n.length)?n:null,this.canRenderInWebGL=!0,{success:!0}}_isStretchColorRampNoop(t){return t.type==="algorithmic"&&["0,0,0,255","0,0,0"].includes(t.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(t.toColor.join(","))}_generateStretchWebGLParams(t,e,r){var w;let o=null,c=null;const i=(w=this.lookup)==null?void 0:w.colormapLut;e.colorRamp&&i&&(o=i.indexedColormap,c=i.offset),e.stretchType==="histogramEqualization"&&(e={...e,stretchType:"minMax"});const{gamma:u}=this.lookup,n=!!(e.useGamma&&u&&u.some(C=>C!==1)),{minCutOff:s,maxCutOff:l,outMin:a,outMax:h}=Ft(e,{rasterInfo:this.rasterInfo,pixelBlock:t,bandIds:r});let p=0;t!=null&&(p=t.getPlaneCount(),p===2&&((t=t.clone()).statistics=[t.statistics[0]],t.pixels=[t.pixels[0]]));const{bandCount:f}=this.rasterInfo,m=Math.min(3,(r==null?void 0:r.length)||p||f,f),g=new Float32Array(m),v=o||n?1:255;let d;for(d=0;d1?u[d]>2?y[d]=6.5+(u[d]-2)**2.5:y[d]=6.5+100*(2-u[d])**4:y[d]=1;return{bandCount:m,outMin:a/v,outMax:h/v,minCutOff:s,maxCutOff:l,factor:g,useGamma:n,gamma:n?u:[1,1,1],gammaCorrection:n?y:[1,1,1],colormap:o,colormapOffset:c,stretchType:e.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(t,e=!1,r={x:0,y:0}){var l,a;let o=null,c=null;const i=(l=this.lookup)==null?void 0:l.colormapLut;t.colorRamp&&i&&(o=i.indexedColormap,c=i.offset);const u={...t,isGCS:e,resolution:r},n=Mr(u),s=(a=this.rasterInfo.statistics)==null?void 0:a[0];return{...n,minValue:(s==null?void 0:s.min)??0,maxValue:(s==null?void 0:s.max)??8e3,hillshadeType:t.hillshadeType==="traditional"?0:1,type:"hillshade",colormap:o,colormapOffset:c}}_generateVectorFieldWebGLParams(t){var d,y,w;const{style:e,inputUnit:r,outputUnit:o,visualVariables:c,symbolTileSize:i,flowRepresentation:u}=t;let n;const s=((d=this.rasterInfo.statistics)==null?void 0:d[0].min)??0,l=((y=this.rasterInfo.statistics)==null?void 0:y[0].max)??50,a=(c==null?void 0:c.find(C=>C.type==="sizeInfo"))??{type:"sizeInfo",field:"Magnitude",maxDataValue:l,maxSize:.8*i,minDataValue:s,minSize:.2*i},h=a.minDataValue??s,p=a.maxDataValue??l,f=a.maxSize!=null&&a.minSize!=null?[a.minSize/i,a.maxSize/i]:[.2,.8];if(e==="wind_speed"){const C=(f[0]+f[1])/2;f[0]=f[1]=C}const m=h!=null&&p!=null?[h,p]:null;if(e==="classified_arrow")if(h!=null&&p!=null&&a!=null){n=[];const C=(a.maxDataValue-a.minDataValue)/5;for(let b=0;b<6;b++)n.push(a.minDataValue+C*b)}else n=[0,1e-6,3.5,7,10.5,14];const g=u==="flow_to"==(e==="ocean_current_kn"||e==="ocean_current_m")?0:Math.PI,v=c==null?void 0:c.find(C=>C.type==="rotationInfo");return{breakValues:n,dataRange:m,inputUnit:r,outputUnit:o,symbolTileSize:i,symbolPercentRange:f,style:e||"single_arrow",rotation:g,rotationType:(w=this.rasterInfo.storageInfo)!=null&&w.tileInfo&&this.rasterInfo.dataType==="vector-uv"?"geographic":(v==null?void 0:v.rotationType)||t.rotationType,type:"vectorField"}}};function nr(t){return Q(t)&&t.validPixelCount!==0}D([N({json:{write:!0}})],Tt.prototype,"rendererJSON",void 0),D([N({type:co,json:{write:!0}})],Tt.prototype,"rasterInfo",void 0),D([N({json:{write:!0}})],Tt.prototype,"lookup",void 0),D([N()],Tt.prototype,"canRenderInWebGL",void 0),Tt=D([Ot("esri.renderers.support.RasterSymbolizer")],Tt);const ei=Tt,Pt=gt.getLogger("esri.views.2d.engine.flow.dataUtils"),pn=10;async function ri(t,e,r,o){const c=performance.now(),i=dn(e,r),u=performance.now(),n=gn(e,i,r.width,r.height),s=performance.now(),l=wn(n,!0),a=performance.now(),h=t==="Streamlines"?Cn(l,pn):bn(l),p=performance.now();return Vr("esri-2d-profiler")&&(Pt.info("I.1","_createFlowFieldFromData (ms)",Math.round(u-c)),Pt.info("I.2","_getStreamlines (ms)",Math.round(s-u)),Pt.info("I.3","createAnimatedLinesData (ms)",Math.round(a-s)),Pt.info("I.4","create{Streamlines|Particles}Mesh (ms)",Math.round(p-a)),Pt.info("I.5","createFlowMesh (ms)",Math.round(p-c)),Pt.info("I.6","Mesh size (bytes)",h.vertexData.buffer.byteLength+h.indexData.buffer.byteLength)),await Promise.resolve(),_r(o),h}function dn(t,e){const r=yn(e.data,e.width,e.height,t.smoothing);return t.interpolate?(o,c)=>{const i=Math.floor(o),u=Math.floor(c);if(i<0||i>=e.width)return[0,0];if(u<0||u>=e.height)return[0,0];const n=o-i,s=c-u,l=i,a=u,h=i{const i=Math.round(o),u=Math.round(c);return i<0||i>=e.width||u<0||u>=e.height?[0,0]:[r[2*(u*e.width+i)],r[2*(u*e.width+i)+1]]}}function mn(t,e,r,o,c,i,u,n,s){const l=[];let a=r,h=o,p=0,[f,m]=e(a,h);f*=t.velocityScale,m*=t.velocityScale;const g=Math.sqrt(f*f+m*m);let v,d;l.push({x:a,y:h,t:p,speed:g});for(let y=0;yt.maxTurnAngle)return l;if(t.collisions){const S=Math.round(a*s),A=Math.round(h*s);if(S<0||S>u-1||A<0||A>n-1)return l;const M=i[A*u+S];if(M!==-1&&M!==c)return l;i[A*u+S]=c}l.push({x:a,y:h,t:p,speed:b}),v=x,d=k}return l}function gn(t,e,r,o){const c=[],i=new sr,u=1/Math.max(t.lineCollisionWidth,1),n=Math.round(r*u),s=Math.round(o*u),l=new Int32Array(n*s);for(let h=0;hh.sort-p.sort);for(const{x:h,y:p}of a)if(i.getFloat()=e)continue;const m=i[f+c];h+=m*t[2*(l*e+(a+f))],p+=m*t[2*(l*e+(a+f))+1]}n[2*(l*e+a)]=h,n[2*(l*e+a)+1]=p}const s=new Float32Array(t.length);for(let l=0;l=r)continue;const m=i[f+c];h+=m*n[2*((a+f)*e+l)],p+=m*n[2*((a+f)*e+l)+1]}s[2*(a*e+l)]=h,s[2*(a*e+l)+1]=p}return s}function wn(t,e){const r=new sr,o=t.reduce((s,l)=>s+l.length,0),c=new Float32Array(4*o),i=new Array(t.length);let u=0,n=0;for(const s of t){const l=u;for(const a of s)c[4*u]=a.x,c[4*u+1]=a.y,c[4*u+2]=a.t,c[4*u+3]=a.speed,u++;i[n++]={startVertex:l,numberOfVertices:s.length,totalTime:s[s.length-1].t,timeSeed:e?r.getFloat():0}}return{lineVertices:c,lineDescriptors:i}}function Cn(t,e){const{lineVertices:o,lineDescriptors:c}=t;let i=0,u=0;for(const f of c)i+=2*f.numberOfVertices,u+=6*(f.numberOfVertices-1);const n=new Float32Array(i*9),s=new Uint32Array(u);let l=0,a=0;function h(){s[a++]=l-2,s[a++]=l,s[a++]=l-1,s[a++]=l,s[a++]=l+1,s[a++]=l-1}function p(f,m,g,v,d,y,w,C){const b=l*9;let x=0;n[b+x++]=f,n[b+x++]=m,n[b+x++]=1,n[b+x++]=g,n[b+x++]=y,n[b+x++]=w,n[b+x++]=v/2,n[b+x++]=d/2,n[b+x++]=C,l++,n[b+x++]=f,n[b+x++]=m,n[b+x++]=-1,n[b+x++]=g,n[b+x++]=y,n[b+x++]=w,n[b+x++]=-v/2,n[b+x++]=-d/2,n[b+x++]=C,l++}for(const f of c){const{totalTime:m,timeSeed:g}=f;let v=null,d=null,y=null,w=null,C=null,b=null;for(let x=0;x0){T=k-v,I=S-d;const E=Math.sqrt(T*T+I*I);if(T/=E,I/=E,x>1){let U=T+C,R=I+b;const B=Math.sqrt(U*U+R*R);U/=B,R/=B;const G=Math.min(1/(U*T+R*I),e);U*=G,R*=G,P=-R,L=U}else P=-I,L=T;P!==null&&L!==null&&(p(v,d,y,P,L,m,g,M),h())}v=k,d=S,y=A,C=T,b=I,w=M}p(v,d,y,-b,C,m,g,w)}return{vertexData:n,indexData:s}}function bn(t){const{lineVertices:c,lineDescriptors:i}=t;let u=0,n=0;for(const E of i){const U=E.numberOfVertices-1;u+=4*U*2,n+=6*U*2}const s=new Float32Array(u*16),l=new Uint32Array(n);let a,h,p,f,m,g,v,d,y,w,C,b,x,k,S=0,A=0;function M(){l[A++]=S-8,l[A++]=S-7,l[A++]=S-6,l[A++]=S-7,l[A++]=S-5,l[A++]=S-6,l[A++]=S-4,l[A++]=S-3,l[A++]=S-2,l[A++]=S-3,l[A++]=S-1,l[A++]=S-2}function T(E,U,R,B,G,O,j,F,V,_,X,tt,wt,Ct){const J=S*16;let q=0;for(const ht of[1,2])for(const dt of[1,2,3,4])s[J+q++]=E,s[J+q++]=U,s[J+q++]=R,s[J+q++]=B,s[J+q++]=j,s[J+q++]=F,s[J+q++]=V,s[J+q++]=_,s[J+q++]=ht,s[J+q++]=dt,s[J+q++]=wt,s[J+q++]=Ct,s[J+q++]=G/2,s[J+q++]=O/2,s[J+q++]=X/2,s[J+q++]=tt/2,S++}function I(E,U){let R=y+C,B=w+b;const G=Math.sqrt(R*R+B*B);R/=G,B/=G;const O=y*R+w*B;R/=O,B/=O;let j=C+x,F=b+k;const V=Math.sqrt(j*j+F*F);j/=V,F/=V;const _=C*j+b*F;j/=_,F/=_,T(a,h,p,f,-B,R,m,g,v,d,-F,j,E,U),M()}function P(E,U,R,B,G,O){if(y=C,w=b,C=x,b=k,y==null&&w==null&&(y=C,w=b),m!=null&&g!=null){x=E-m,k=U-g;const j=Math.sqrt(x*x+k*k);x/=j,k/=j}y!=null&&w!=null&&I(G,O),a=m,h=g,p=v,f=d,m=E,g=U,v=R,d=B}function L(E,U){y=C,w=b,C=x,b=k,y==null&&w==null&&(y=C,w=b),y!=null&&w!=null&&I(E,U)}for(const E of i){a=null,h=null,p=null,f=null,m=null,g=null,v=null,d=null,y=null,w=null,C=null,b=null,x=null,k=null;const{totalTime:U,timeSeed:R}=E;for(let B=0;B __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/dataUtils-s_UKlouc.js b/dist/assets/dataUtils-s_UKlouc.js deleted file mode 100644 index 906e190..0000000 --- a/dist/assets/dataUtils-s_UKlouc.js +++ /dev/null @@ -1,7 +0,0 @@ -import{dp as ve,eE as Er,sn as Pe,uz as Jt,sl as Ee,sm as Rr,ab as Re,e as O,y as N,f6 as Lr,c as Dt,dr as Ot,E as yt,bI as et,Z as gt,uu as Xt,dt as Ur,du as Dr,T as Or,dT as Le,ar as Gr,cg as ir,g as Br,jP as Nr,de as $r,kj as Fr,u8 as xe,iZ as qt,dJ as Vr,s as _r,uA as sr}from"./index-J0iiHjMT.js";const xn=["random","ndvi","ndvi2","ndvi3","elevation","gray","hillshade"],ar=[{id:"aspect",type:"multipart",colorRamps:[{fromColor:[190,190,190],toColor:[255,45,8]},{fromColor:[255,45,8],toColor:[255,181,61]},{fromColor:[255,181,61],toColor:[255,254,52]},{fromColor:[255,254,52],toColor:[0,251,50]},{fromColor:[0,251,50],toColor:[255,254,52]},{fromColor:[0,253,255],toColor:[0,181,255]},{fromColor:[0,181,255],toColor:[26,35,253]},{fromColor:[26,35,253],toColor:[255,57,251]},{fromColor:[255,57,251],toColor:[255,45,8]}]},{id:"black-to-white",fromColor:[0,0,0],toColor:[255,255,255]},{id:"blue-bright",fromColor:[204,204,255],toColor:[0,0,224]},{id:"blue-light-to-dark",fromColor:[211,229,232],toColor:[46,100,140]},{id:"blue-green-bright",fromColor:[203,245,234],toColor:[48,207,146]},{id:"blue-green-light-to-dark",fromColor:[216,242,237],toColor:[21,79,74]},{id:"brown-light-to-dark",fromColor:[240,236,170],toColor:[102,72,48]},{id:"brown-to-blue-green-diverging-right",type:"multipart",colorRamps:[{fromColor:[156,85,31],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[33,130,145]}]},{id:"brown-to-blue-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[110,70,45],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[48,100,102]}]},{id:"coefficient-bias",fromColor:[214,214,255],toColor:[0,57,148]},{id:"cold-to-hot-diverging",type:"multipart",colorRamps:[{fromColor:[69,117,181],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[214,47,39]}]},{id:"condition-number",type:"multipart",colorRamps:[{fromColor:[0,97,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,34,0]}]},{id:"cyan-to-purple",type:"multipart",colorRamps:[{fromColor:[0,245,245],toColor:[0,0,245]},{fromColor:[0,0,245],toColor:[245,0,245]}]},{id:"cyan-light-to-blue-dark",type:"multipart",colorRamps:[{fromColor:[182,237,240],toColor:[31,131,224]},{fromColor:[31,131,224],toColor:[9,9,145]}]},{id:"distance",fromColor:[255,200,0],toColor:[0,0,255]},{id:"elevation1",type:"multipart",colorRamps:[{fromColor:[175,240,233],toColor:[255,255,179]},{fromColor:[255,255,179],toColor:[0,128,64]},{fromColor:[0,128,64],toColor:[252,186,3]},{fromColor:[252,186,3],toColor:[128,0,0]},{fromColor:[120,0,0],toColor:[105,48,13]},{fromColor:[105,48,13],toColor:[171,171,171]},{fromColor:[171,171,171],toColor:[255,252,255]}]},{id:"elevation2",type:"multipart",colorRamps:[{fromColor:[118,219,211],toColor:[255,255,199]},{fromColor:[255,255,199],toColor:[255,255,128]},{fromColor:[255,255,128],toColor:[217,194,121]},{fromColor:[217,194,121],toColor:[135,96,38]},{fromColor:[135,96,38],toColor:[150,150,181]},{fromColor:[150,150,181],toColor:[181,150,181]},{fromColor:[181,150,181],toColor:[255,252,255]}]},{id:"errors",fromColor:[255,235,214],toColor:[196,10,10]},{id:"gray-light-to-dark",fromColor:[219,219,219],toColor:[69,69,69]},{id:"green-bright",fromColor:[204,255,204],toColor:[14,204,14]},{id:"green-light-to-dark",fromColor:[220,245,233],toColor:[34,102,51]},{id:"green-to-blue",type:"multipart",colorRamps:[{fromColor:[32,204,16],toColor:[0,242,242]},{fromColor:[0,242,242],toColor:[2,33,227]}]},{id:"orange-bright",fromColor:[255,235,204],toColor:[240,118,5]},{id:"orange-light-to-dark",fromColor:[250,233,212],toColor:[171,65,36]},{id:"partial-spectrum",type:"multipart",colorRamps:[{fromColor:[242,241,162],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]},{fromColor:[252,3,69],toColor:[176,7,237]},{fromColor:[176,7,237],toColor:[2,29,173]}]},{id:"partial-spectrum-1-diverging",type:"multipart",colorRamps:[{fromColor:[135,38,38],toColor:[240,149,12]},{fromColor:[240,149,12],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[74,80,181]},{fromColor:[74,80,181],toColor:[39,32,122]}]},{id:"partial-spectrum-2-diverging",type:"multipart",colorRamps:[{fromColor:[115,77,42],toColor:[201,137,52]},{fromColor:[201,137,52],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[91,63,176]},{fromColor:[91,63,176],toColor:[81,13,97]}]},{id:"pink-to-yellow-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[158,30,113],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[99,110,45]}]},{id:"pink-to-yellow-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,47,73],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[22,59,15]}]},{id:"precipitation",type:"multipart",colorRamps:[{fromColor:[194,82,60],toColor:[237,161,19]},{fromColor:[237,161,19],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,219,0]},{fromColor:[0,219,0],toColor:[32,153,143]},{fromColor:[32,153,143],toColor:[11,44,122]}]},{id:"prediction",type:"multipart",colorRamps:[{fromColor:[40,146,199],toColor:[250,250,100]},{fromColor:[250,250,100],toColor:[232,16,20]}]},{id:"purple-bright",fromColor:[255,204,255],toColor:[199,0,199]},{id:"purple-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[77,32,150],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[20,122,11]}]},{id:"purple-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[67,14,89],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[24,79,15]}]},{id:"purple-blue-bright",fromColor:[223,184,230],toColor:[112,12,242]},{id:"purple-blue-light-to-dark",fromColor:[229,213,242],toColor:[93,44,112]},{id:"purple-red-bright",fromColor:[255,204,225],toColor:[199,0,99]},{id:"purple-red-light-to-dark",fromColor:[250,215,246],toColor:[143,17,57]},{id:"red-bright",fromColor:[255,204,204],toColor:[219,0,0]},{id:"red-light-to-dark",fromColor:[255,224,224],toColor:[143,10,10]},{id:"red-to-blue-diverging-bright",type:"multipart",colorRamps:[{fromColor:[196,69,57],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[48,95,207]}]},{id:"red-to-blue-diverging-dark",type:"multipart",colorRamps:[{fromColor:[107,13,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[13,53,97]}]},{id:"red-to-green",type:"multipart",colorRamps:[{fromColor:[245,0,0],toColor:[245,245,0]},{fromColor:[245,245,0],toColor:[0,245,0]}]},{id:"red-to-green-diverging-bright",type:"multipart",colorRamps:[{fromColor:[186,20,20],toColor:[255,255,191]},{fromColor:[255,255,191],toColor:[54,145,33]}]},{id:"red-to-green-diverging-dark",type:"multipart",colorRamps:[{fromColor:[97,21,13],toColor:[204,204,102]},{fromColor:[204,204,102],toColor:[16,69,16]}]},{id:"slope",type:"multipart",colorRamps:[{fromColor:[56,168,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,0,0]}]},{id:"spectrum-full-bright",type:"multipart",colorRamps:[{fromColor:[255,0,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,0,255]}]},{id:"spectrum-full-dark",type:"multipart",colorRamps:[{fromColor:[153,0,0],toColor:[153,153,0]},{fromColor:[153,153,0],toColor:[0,153,153]},{fromColor:[0,153,153],toColor:[0,0,153]}]},{id:"spectrum-full-light",type:"multipart",colorRamps:[{fromColor:[255,153,153],toColor:[255,255,153]},{fromColor:[255,255,153],toColor:[153,255,255]},{fromColor:[153,255,255],toColor:[153,153,255]}]},{id:"surface",type:"multipart",colorRamps:[{fromColor:[112,153,89],toColor:[242,238,162]},{fromColor:[242,238,162],toColor:[242,206,133]},{fromColor:[242,206,133],toColor:[194,140,124]},{fromColor:[194,140,124],toColor:[255,242,255]}]},{id:"temperature",type:"multipart",colorRamps:[{fromColor:[255,252,255],toColor:[255,0,255]},{fromColor:[255,0,255],toColor:[0,0,255]},{fromColor:[0,0,255],toColor:[0,255,255]},{fromColor:[0,255,255],toColor:[0,255,0]},{fromColor:[0,255,0],toColor:[255,255,0]},{fromColor:[255,255,0],toColor:[255,128,0]},{fromColor:[255,128,0],toColor:[128,0,0]}]},{id:"white-to-black",fromColor:[255,255,255],toColor:[0,0,0]},{id:"yellow-to-dark-red",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[242,167,46]},{fromColor:[242,167,46],toColor:[107,0,0]}]},{id:"yellow-to-green-to-dark-blue",type:"multipart",colorRamps:[{fromColor:[255,255,128],toColor:[56,224,9]},{fromColor:[56,224,9],toColor:[26,147,171]},{fromColor:[26,147,171],toColor:[12,16,120]}]},{id:"yellow-to-red",fromColor:[245,245,0],toColor:[255,0,0]},{id:"yellow-green-bright",fromColor:[236,252,204],toColor:[157,204,16]},{id:"yellow-green-light-to-dark",fromColor:[215,240,175],toColor:[96,107,45]}],jr=new ve({Aspect:"aspect","Black to White":"black-to-white","Blue Bright":"blue-bright","Blue Light to Dark":"blue-light-to-dark","Blue-Green Bright":"blue-green-bright","Blue-Green Light to Dark":"blue-green-light-to-dark","Brown Light to Dark":"brown-light-to-dark","Brown to Blue Green Diverging, Bright":"brown-to-blue-green-diverging-right","Brown to Blue Green Diverging, Dark":"brown-to-blue-green-diverging-dark","Coefficient Bias":"coefficient-bias","Cold to Hot Diverging":"cold-to-hot-diverging","Condition Number":"condition-number","Cyan to Purple":"cyan-to-purple","Cyan-Light to Blue-Dark":"cyan-light-to-blue-dark",Distance:"distance","Elevation #1":"elevation1","Elevation #2":"elevation2",Errors:"errors","Gray Light to Dark":"gray-light-to-dark","Green Bright":"green-bright","Green Light to Dark":"green-light-to-dark","Green to Blue":"green-to-blue","Orange Bright":"orange-bright","Orange Light to Dark":"orange-light-to-dark","Partial Spectrum":"partial-spectrum","Partial Spectrum 1 Diverging":"partial-spectrum-1-diverging","Partial Spectrum 2 Diverging":"partial-spectrum-2-diverging","Pink to YellowGreen Diverging, Bright":"pink-to-yellow-green-diverging-bright","Pink to YellowGreen Diverging, Dark":"pink-to-yellow-green-diverging-dark",Precipitation:"precipitation",Prediction:"prediction","Purple Bright":"purple-bright","Purple to Green Diverging, Bright":"purple-to-green-diverging-bright","Purple to Green Diverging, Dark":"purple-to-green-diverging-dark","Purple-Blue Bright":"purple-blue-bright","Purple-Blue Light to Dark":"purple-blue-light-to-dark","Purple-Red Bright":"purple-red-bright","Purple-Red Light to Dark":"purple-red-light-to-dark","Red Bright":"red-bright","Red Light to Dark":"red-light-to-dark","Red to Blue Diverging, Bright":"red-to-blue-diverging-bright","Red to Blue Diverging, Dark":"red-to-blue-diverging-dark","Red to Green":"red-to-green","Red to Green Diverging, Bright":"red-to-green-diverging-bright","Red to Green Diverging, Dark":"red-to-green-diverging-dark",Slope:"slope","Spectrum-Full Bright":"spectrum-full-bright","Spectrum-Full Dark":"spectrum-full-dark","Spectrum-Full Light":"spectrum-full-light",Surface:"surface",Temperature:"temperature","White to Black":"white-to-black","Yellow to Dark Red":"yellow-to-dark-red","Yellow to Green to Dark Blue":"yellow-to-green-to-dark-blue","Yellow to Red":"yellow-to-red","Yellow-Green Bright":"yellow-green-bright","Yellow-Green Light to Dark":"yellow-green-light-to-dark"});function Wt(t,e){if(!t||!e||t.length!==e.length)return!1;for(let r=0;re[r]+2||t[r]Ue(o))),r}return Ue(t)}function De(t,e){if(!t)return;const r=e??ar;let o=null;return t.type==="algorithmic"?r.some(c=>{if(Wt(t.fromColor.toRgb(),c.fromColor)&&Wt(t.toColor.toRgb(),c.toColor))return o=c.id,!0}):t.type==="multipart"&&r.some(c=>{const i=t.colorRamps,u=c.colorRamps;if(i&&u&&i.length===u.length&&!u.some((n,s)=>{if(!Wt(i[s].fromColor.toRgb(),new Re(n.fromColor).toRgb())||!Wt(i[s].toColor.toRgb(),new Re(n.toColor).toRgb()))return!0})){if(o)return!0;o=c.id}}),o}function Wr(t,e,r=!1){if(!t)return;let o=De(t,e);return o!=null||r||(o=De(t=zr(t),e)),o}function Hr(t,e=!1){const r=typeof t=="string"?t:Wr(t,void 0,e);return r?jr.toJSON(r):null}function kn(t,e="esriCIELabAlgorithm"){const r=ar.find(({id:o})=>o===t);return r?r.colorRamps?{type:"multipart",colorRamps:r.colorRamps.map(o=>({type:"algorithmic",algorithm:e,fromColor:[...o.fromColor],toColor:[...o.toColor]}))}:{type:"algorithmic",algorithm:e,fromColor:[...r.fromColor],toColor:[...r.toColor]}:null}function lr(t){const e=(t=t||{}).numColors||256,r=t.distanceOffset||0,o=t.isCustomInterval!=null?t.isCustomInterval:t.distanceInterval!==null&&t.distanceInterval!==1/(e-1),c=t.distanceInterval||1/(e-1);return{...t,numColors:e,distanceOffset:r,interpolateAlpha:!!t.interpolateAlpha,distanceInterval:c,isCustomInterval:o,weights:t.weights}}function qr(t,e,r){const{numColors:o,distanceOffset:c,distanceInterval:i,isCustomInterval:u}=r,n=t.s===0,s=e.s===0;let l=t.h,a=e.h;n&&!s?l=a:s&&!n&&(e={...e,h:l},a=l);let h,p=Math.abs(a-l);const f=360;pa?p*i:-p*i);const m=(e.s-t.s)*i,g=(e.v-t.v)*i;let{s:v,v:d}=t,y=l;if(c){const C=c/i;y=(y+C*h+f)%f,v+=C*m,d+=C*g}const w=[];for(let C=0;Cf+m);c=c.map(f=>f/p)}else{c=[];for(let p=0;p{c.unshift(i),o||c.pop()}),r}function Ge(t){const e=Jt(t);return{type:"HsvColor",Hue:e.h,Saturation:e.s,Value:e.v,AlphaValue:255}}function Be(t){const e=t.toJSON();return{Algorithm:(e==null?void 0:e.Algorithm)||"esriHSVAlgorithm",type:"AlgorithmicColorRamp",FromColor:Ge(t.fromColor),ToColor:Ge(t.toColor)}}function An(t){const e=Hr(t);if(!e)return null;if(t.type==="algorithmic")return{...Be(t),Name:e};if(t.colorRamps){const r=t.colorRamps.map(Be);return{type:"MultiPartColorRamp",NumColorRamps:r.length,ArrayOfColorRamp:r,Name:e}}return null}function Sn(t){const e=t.reverse().map(r=>{const o=r.toString(16);return o.length<2?"0"+o:o});return 4294967295&Number.parseInt(e.join(""),16)}const Tn=new ve({none:"none",standardDeviation:"standard-deviation",histogramEqualization:"histogram-equalization",minMax:"min-max",percentClip:"percent-clip",sigmoid:"sigmoid"}),Zr={0:"none",3:"standardDeviation",4:"histogramEqualization",5:"minMax",6:"percentClip",9:"sigmoid"};let Ne=class{constructor(e=null,r=null,o=null){this.minValue=e,this.maxValue=r,this.noDataValue=o}};var St;let it=St=class extends Ot{static createEmptyBand(t,e){return new(St.getPixelArrayConstructor(t))(e)}static getPixelArrayConstructor(t){let e;switch(t){case"u1":case"u2":case"u4":case"u8":e=Uint8Array;break;case"u16":e=Uint16Array;break;case"u32":e=Uint32Array;break;case"s8":e=Int8Array;break;case"s16":e=Int16Array;break;case"s32":e=Int32Array;break;case"f32":case"c64":case"c128":case"unknown":e=Float32Array;break;case"f64":e=Float64Array}return e}constructor(t){super(t),this.width=null,this.height=null,this.pixelType="f32",this.validPixelCount=null,this.mask=null,this.maskIsAlpha=!1,this.premultiplyAlpha=!1,this.statistics=null,this.depthCount=1}castPixelType(t){if(!t)return"f32";let e=t.toLowerCase();return["u1","u2","u4"].includes(e)?e="u8":["unknown","u8","s8","u16","s16","u32","s32","f32","f64"].includes(e)||(e="f32"),e}getPlaneCount(){var t;return(t=this.pixels)==null?void 0:t.length}addData(t){if(!t.pixels||t.pixels.length!==this.width*this.height)throw new yt("pixelblock:invalid-or-missing-pixels","add data requires valid pixels array that has same length defined by pixel block width * height");this.pixels||(this.pixels=[]),this.statistics||(this.statistics=[]),this.pixels.push(t.pixels),this.statistics.push(t.statistics??new Ne)}getAsRGBA(){const t=new ArrayBuffer(this.width*this.height*4);switch(this.pixelType){case"s8":case"s16":case"u16":case"s32":case"u32":case"f32":case"f64":this._fillFromNon8Bit(t);break;default:this._fillFrom8Bit(t)}return new Uint8ClampedArray(t)}getAsRGBAFloat(){const t=new Float32Array(this.width*this.height*4);return this._fillFrom32Bit(t),t}updateStatistics(){if(!this.pixels)return;this.statistics=this.pixels.map(r=>this._calculateBandStatistics(r,this.mask));const t=this.mask;let e=0;if(t!=null)for(let r=0;rr?r:np>=e.length),i=o===t.length&&!t.some((p,f)=>p!==f);if(c||i)return this;const u=((h=this.bandMasks)==null?void 0:h.length)===o?t.map(p=>this.bandMasks[p]):void 0;let{mask:n,validPixelCount:s}=this;const{width:l,height:a}=this;if(u){if(u.length===1)n=u[0];else{const p=l*a;n=new Uint8Array(p).fill(255);for(let f=0;f!!p).length}return new St({pixelType:this.pixelType,width:l,height:a,mask:n,bandMasks:u,validPixelCount:s,maskIsAlpha:this.maskIsAlpha,pixels:t.map(p=>e[p]),statistics:r&&t.map(p=>r[p])})}clone(){const t=new St({width:this.width,height:this.height,pixelType:this.pixelType,maskIsAlpha:this.maskIsAlpha,validPixelCount:this.validPixelCount});let e;this.mask!=null&&(this.mask instanceof Uint8Array?t.mask=new Uint8Array(this.mask):t.mask=this.mask.slice(0)),this.bandMasks&&(t.bandMasks=this.bandMasks.map(o=>new Uint8Array(o)));const r=St.getPixelArrayConstructor(this.pixelType);if(this.pixels&&this.pixels.length>0){t.pixels=[];const o=!!this.pixels[0].slice;for(e=0;e=3?(u=c[1],n=c[2]):c.length===2&&(u=c[1]);const l=new Uint32Array(t),a=this.width*this.height;if(i.length===a)if(e!=null&&e.length===a)if(r)for(s=0;s0){for(const g of o)if(g.minValue!=null&&(u=Math.min(u,g.minValue)),g.maxValue!=null&&g.minValue!=null){const v=g.maxValue-g.minValue;n=Math.max(n,v)}i=255/n}else{let g=255;c==="s8"?(u=-128,g=127):c==="u16"?g=65535:c==="s16"?(u=-32768,g=32767):c==="u32"?g=4294967295:c==="s32"?(u=-2147483648,g=2147483647):c==="f32"?(u=-34e38,g=34e38):c==="f64"&&(u=-Number.MAX_VALUE,g=Number.MAX_VALUE),i=255/(g-u)}const s=new Uint32Array(t),l=this.width*this.height;let a,h,p,f,m;if(a=h=p=e[0],a.length!==l)return gt.getLogger(this).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.");if(e.length>=2)if(h=e[1],e.length>=3&&(p=e[2]),r!=null&&r.length===l)for(f=0;f=3?(c=e[1],i=e[2]):e.length===2&&(c=e[1]);const n=this.width*this.height;if(o.length!==n)return gt.getLogger(this).error("getAsRGBAFloat()","Unable to convert to RGBA. The pixelblock is invalid.");let s=0;if(r!=null&&r.length===n)for(u=0;uo?u:o);else for(i=0;io?u:o;return new Ne(r,o)}};O([N({json:{write:!0}})],it.prototype,"width",void 0),O([N({json:{write:!0}})],it.prototype,"height",void 0),O([N({json:{write:!0}})],it.prototype,"pixelType",void 0),O([Lr("pixelType")],it.prototype,"castPixelType",null),O([N({json:{write:!0}})],it.prototype,"validPixelCount",void 0),O([N({json:{write:!0}})],it.prototype,"mask",void 0),O([N({json:{write:!0}})],it.prototype,"maskIsAlpha",void 0),O([N({json:{write:!0}})],it.prototype,"pixels",void 0),O([N()],it.prototype,"premultiplyAlpha",void 0),O([N({json:{write:!0}})],it.prototype,"statistics",void 0),O([N({json:{write:!0}})],it.prototype,"depthCount",void 0),O([N({json:{write:!0}})],it.prototype,"noDataValues",void 0),O([N({json:{write:!0}})],it.prototype,"bandMasks",void 0),it=St=O([Dt("esri.layers.support.PixelBlock")],it);const H=it;var $e,Fe;(function(t){t[t.matchAny=0]="matchAny",t[t.matchAll=1]="matchAll"})($e||($e={})),function(t){t[t.bestMatch=0]="bestMatch",t[t.fail=1]="fail"}(Fe||(Fe={}));const Mn=6;function Q(t){return t!=null&&t.declaredClass==="esri.layers.support.PixelBlock"&&t.pixels&&t.pixels.length>0}function Pn(t){var a;if(!(t!=null&&t.length)||t.some(h=>!Q(h)))return null;if(t.length===1)return((a=t[0])==null?void 0:a.clone())??null;const e=t,{width:r,height:o,pixelType:c}=e[0];if(e.some(h=>h.width!==r||h.height!==o))return null;const i=e.map(({mask:h})=>h).filter(h=>h!=null);let u=null;i.length&&(u=new Uint8Array(r*o),u.set(i[0]),i.length>1&&hr(i.slice(1),u));const n=[];e.forEach(({pixels:h})=>n.push(...h));const s=e.map(({statistics:h})=>h).filter(h=>h==null?void 0:h.length),l=[];return s.forEach(h=>l.push(...h)),new H({pixelType:c,width:r,height:o,mask:u,pixels:n,statistics:l.length?l:null})}function Bt(t){if(!t)return;const e=t.colormap;if(!e||e.length===0)return;const r=e.sort((h,p)=>h[0]-p[0]);let o=0;r[0][0]<0&&(o=r[0][0]);const c=Math.max(256,r[r.length-1][0]-o+1),i=new Uint8Array(4*c),u=[];let n,s=0,l=0;const a=r[0].length===5;if(c>65536)return r.forEach(h=>{u[h[0]-o]=a?h.slice(1):h.slice(1).concat([255])}),{indexed2DColormap:u,offset:o,alphaSpecified:a};if(t.fillUnspecified)for(n=r[l],s=n[0]-o;sd?c[a]=0:(p[a]=u[v],f[a]=u[v+1],m[a]=u[v+2],c[a]=u[v+3]));else{for(c=new Uint8Array(i),a=0;ad?c[a]=0:(p[a]=u[v],f[a]=u[v+1],m[a]=u[v+2],c[a]=u[v+3]);r.mask=c}}else if(n)if(c!=null)for(a=0;ai));const n=[],s=e.outputPixelType||"u8";for(let a=0;a1;){if(l===a.value){g=!0;break}l>a.value?h=m:p=m,m=Math.floor((h+p)/2),a=e[Math.floor(m)]}g||(l===e[h].value?(a=e[h],g=!0):l===e[p].value?(a=e[p],g=!0):le[h].value&&(lC-m);g[0]=c[0],g[g.length-1]=c[c.length-1]+(l?1e-6:0);const v=c.length/2,[d,y]=Xt(u);for(let C=0;C=0;A--)if(k===g[2*A]||k>g[2*A]&&ky?y:k=n[S]&&k<=n[S+1]){h[x]=0,f[x]=0;break}}}return new H({width:r,height:o,pixelType:u,pixels:[h],mask:f})}function _e(t,e,r,o){const c=r!=null&&r.length>=2?new Set(r):null,i=(r==null?void 0:r.length)===1?r[0]:null,u=!!(e!=null&&e.length);for(let n=0;n=e[a]&&s<=e[a+1]){l=!0;break}l||(o[n]=0)}o[n]&&(s===i||c!=null&&c.has(s))&&(o[n]=0)}}function je(t,e){const r=t[0].length;for(let o=0;ov-1e-6);g[0]=r[0],u&&(g[g.length-1]=r[r.length-1]);for(let v=0;vf?f:o[v]g?m=i.rightPadding:d>=g&&(f=i.leftMargin-i.rightPadding,m=0)}if(p.xmax-=m,typeof e!="number")for(let g=p.ymin;gQ(T));if(n==null)return null;const s=c?c.width:e.width,l=c?c.height:e.height,a=n.width,h=n.height,p=e.width/a,f=e.height/h,m={offset:o||{x:0,y:0},mosaic:c||e,block:{width:a,height:h}},g=n.pixelType,v=H.getPixelArrayConstructor(g),d=n.pixels.length,y=[];let w,C;for(let T=0;TT==null||T.mask!=null&&T.mask.length>0),x=t.some(T=>(T==null?void 0:T.bandMasks)&&T.bandMasks.length>1),k=b?new Uint8Array(s*l):void 0,S=x?[]:void 0;if(k){for(let T=0;Td!=null);if(o==null)return null;const c=t.some(d=>d==null||!!d.mask),{width:i,height:u}=e,n=c?new Uint8Array(i*u):null,{blockWidths:s}=r,l=[],a=o.getPlaneCount(),h=H.getPixelArrayConstructor(o.pixelType);if(c)for(let d=0,y=0;d(d==null?void 0:d.bandMasks)&&d.bandMasks.length>1),f=p?[]:void 0,m=i*u;for(let d=0;do||s>c||i===0&&u===0&&n===o&&s===c)return t;t.mask||(t.mask=new Uint8Array(o*c));const l=t.mask;for(let a=0;a=s||p=n?0:1}return t.updateStatistics(),t}function ro(t){if(!Q(t))return null;const e=t.clone(),{width:r,height:o,pixels:c}=t,i=c[0],u=e.pixels[0],n=t.mask;for(let s=2;se&&(r=i.value,e=o),i=c.next();return r}function Ht(t,e,r){if(r===0)return;const o=t.get(e);o===1?t.delete(e):t.set(e,o-1)}function Nt(t,e,r){r!==0&&t.set(e,t.has(e)?t.get(e)+1:1)}function oo(t,e,r){let{x:o,y:c}=e;const{width:i,height:u}=r;if(o===0&&c===0&&u===t.height&&i===t.width)return t;const{width:n,height:s}=t,l=Math.max(0,c),a=Math.max(0,o),h=Math.min(o+i,n),p=Math.min(c+u,s);if(h<0||p<0||!Q(t))return null;o=Math.max(0,-o),c=Math.max(0,-c);const{pixels:f}=t,m=i*u,g=f.length,v=[];for(let C=0;C{const U=I instanceof Float32Array||I instanceof Float64Array?0:.5;for(let R=0;RHe.fromJSON(o));for(let o=0;oc&&(o=c)}else{for(;!this.eof;)this.readBlock();o=this.bufferLength}return this.pos=o,this.buffer.subarray(r,o)},lookChar:function(){for(var e=this.pos;this.bufferLength<=e;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos])},getChar:function(){for(var e=this.pos;this.bufferLength<=e;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos++])},makeSubStream:function(e,r,o){for(var c=e+r;this.bufferLength<=c&&!this.eof;)this.readBlock();return new Stream(this.buffer,e,r,o)},skip:function(e){e||(e=1),this.pos+=e},reset:function(){this.pos=0}},t}(),(Ke=function(){if(!self||!self.Uint32Array)return null;var t=new Uint32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),e=new Uint32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),r=new Uint32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),o=[new Uint32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],c=[new Uint32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];function i(n){throw new Error(n)}function u(n){var s=0,l=n[s++],a=n[s++];l!=-1&&a!=-1||i("Invalid header in flate stream"),(15&l)!=8&&i("Unknown compression method in flate stream"),((l<<8)+a)%31!=0&&i("Bad FCHECK in flate stream"),32&a&&i("FDICT bit set in flate stream"),this.bytes=n,this.bytesPos=s,this.codeSize=0,this.codeBuf=0,ne.call(this)}return u.prototype=Object.create(ne.prototype),u.prototype.getBits=function(n){for(var s,l=this.codeSize,a=this.codeBuf,h=this.bytes,p=this.bytesPos;l>n,this.codeSize=l-=n,this.bytesPos=p,s},u.prototype.getCode=function(n){for(var s=n[0],l=n[1],a=this.codeSize,h=this.codeBuf,p=this.bytes,f=this.bytesPos;a>16,d=65535&g;return(a==0||a>v,this.codeSize=a-v,this.bytesPos=f,d},u.prototype.generateHuffmanTable=function(n){for(var s=n.length,l=0,a=0;al&&(l=n[a]);for(var h=1<>=1;for(a=d;a0;)j[g++]=_}var s=this.getBits(3);if(1&s&&(this.eof=!0),(s>>=1)!=0){var l,a;if(s==1)l=o,a=c;else if(s==2){for(var h=this.getBits(5)+257,p=this.getBits(5)+1,f=this.getBits(4)+4,m=Array(t.length),g=0;g=b&&(b=(R=this.ensureBuffer(x+1)).length),R[x++]=k;else{if(k==256)return void(this.bufferLength=x);var S=(k=e[k-=257])>>16;S>0&&(S=this.getBits(S)),d=(65535&k)+S,k=this.getCode(a),(S=(k=r[k])>>16)>0&&(S=this.getBits(S));var A=(65535&k)+S;x+d>=b&&(b=(R=this.ensureBuffer(x+d)).length);for(var M=0;M{let a=null;u==="jpg"&&n&&(a=dr._getMask(e,{width:c,height:i}));const h=new Blob([new Uint8Array(e)],{type:"image/"+u=="jpg"?"jpeg":u}),p=URL.createObjectURL(h),f=new Image;let m;f.src=p,f.onload=()=>{if(URL.revokeObjectURL(p),Br(o))return void l(Nr());c=f.width,i=f.height,this._canvas&&this._ctx?(this._canvas.width===c&&this._canvas.height===i||(this._canvas.width=c,this._canvas.height=i),this._ctx.clearRect(0,0,c,i)):(this._canvas=document.createElement("canvas"),this._canvas.width=c,this._canvas.height=i,this._ctx=this._canvas.getContext("2d")),this._ctx.drawImage(f,0,0);const g=this._ctx.getImageData(0,0,c,i);let v;if(m=g.data,r.renderOnCanvas){if(a)for(v=0;v{URL.revokeObjectURL(p),l("cannot load image")}})}static _getMask(e,r){let o=null;try{const c=new Uint8Array(e),i=Math.ceil(c.length/2);let u=0;const n=c.length-2;for(u=i;u=0;h--)o[l++]=s[a]>>h&1}}catch{}return o}};var Je,Ye,Xe,me={exports:{}};me.exports,Je=me,Ye=function(){var t=function(){function e(r){this.message="JPEG error: "+r}return e.prototype=new Error,e.prototype.name="JpegError",e.constructor=e,e}();return function(){if(!self||!self.Uint8ClampedArray)return null;var e=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),r=4017,o=799,c=3406,i=2276,u=1567,n=3784,s=5793,l=2896;function a(){this.decodeTransform=null,this.colorTransform=-1}function h(d,y){for(var w,C,b=0,x=[],k=16;k>0&&!d[k-1];)k--;x.push({children:[],index:0});var S,A=x[0];for(w=0;w0;)A=x.pop();for(A.index++,x.push(A);x.length<=w;)x.push(S={children:[],index:0}),A.children[A.index]=S.children,A=S;b++}w+10)return L--,P>>L&1;if((P=d[y++])===255){var $=d[y++];if($)throw new t("unexpected marker "+(P<<8|$).toString(16))}return L=7,P>>>7}function U($){for(var W=$;;){if(typeof(W=W[E()])=="number")return W;if(typeof W!="object")throw new t("invalid huffman sequence")}}function R($){for(var W=0;$>0;)W=W<<1|E(),$--;return W}function B($){if($===1)return E()===1?1:-1;var W=R($);return W>=1<<$-1?W:W+(-1<<$)+1}function G($,W){var K=U($.huffmanTableDC),rt=K===0?0:B(K);$.blockData[W]=$.pred+=rt;for(var at=1;at<64;){var ft=U($.huffmanTableAC),ot=15&ft,lt=ft>>4;if(ot!==0){var Pr=e[at+=lt];$.blockData[W+Pr]=B(ot),at++}else{if(lt<15)break;at+=16}}}function D($,W){var K=U($.huffmanTableDC),rt=K===0?0:B(K)<0)F--;else for(var K=x,rt=k;K<=rt;){var at=U($.huffmanTableAC),ft=15&at,ot=at>>4;if(ft!==0){var lt=e[K+=ot];$.blockData[W+lt]=B(ft)*(1<>4,(K=15&rt)==0)ot<15?(F=R(ot)+(1<=65488&&kt<=65495))break;y+=2}return(ut=v(d,y))&&ut.invalid&&(console.log("decodeScan - unexpected Scan data, next marker is: "+ut.invalid),y=ut.offset),y-I}function m(d,y,w){var C,b,x,k,S,A,M,T,I,P,L,E,U,R,B,G,D,j=d.quantizationTable,F=d.blockData;if(!j)throw new t("missing required Quantization Table.");for(var V=0;V<64;V+=8)I=F[y+V],P=F[y+V+1],L=F[y+V+2],E=F[y+V+3],U=F[y+V+4],R=F[y+V+5],B=F[y+V+6],G=F[y+V+7],I*=j[V],P|L|E|U|R|B|G?(P*=j[V+1],L*=j[V+2],E*=j[V+3],U*=j[V+4],R*=j[V+5],B*=j[V+6],G*=j[V+7],b=(C=(C=s*I+128>>8)+(b=s*U+128>>8)+1>>1)-b,D=(x=L)*n+(k=B)*u+128>>8,x=x*u-k*n+128>>8,M=(S=(S=l*(P-G)+128>>8)+(M=R<<4)+1>>1)-M,A=(T=(T=l*(P+G)+128>>8)+(A=E<<4)+1>>1)-A,k=(C=C+(k=D)+1>>1)-k,x=(b=b+x+1>>1)-x,D=S*i+T*c+2048>>12,S=S*c-T*i+2048>>12,T=D,D=A*o+M*r+2048>>12,A=A*r-M*o+2048>>12,M=D,w[V]=C+T,w[V+7]=C-T,w[V+1]=b+M,w[V+6]=b-M,w[V+2]=x+A,w[V+5]=x-A,w[V+3]=k+S,w[V+4]=k-S):(D=s*I+512>>10,w[V]=D,w[V+1]=D,w[V+2]=D,w[V+3]=D,w[V+4]=D,w[V+5]=D,w[V+6]=D,w[V+7]=D);for(var _=0;_<8;++_)I=w[_],(P=w[_+8])|(L=w[_+16])|(E=w[_+24])|(U=w[_+32])|(R=w[_+40])|(B=w[_+48])|(G=w[_+56])?(b=(C=4112+((C=s*I+2048>>12)+(b=s*U+2048>>12)+1>>1))-b,D=(x=L)*n+(k=B)*u+2048>>12,x=x*u-k*n+2048>>12,k=D,M=(S=(S=l*(P-G)+2048>>12)+(M=R)+1>>1)-M,A=(T=(T=l*(P+G)+2048>>12)+(A=E)+1>>1)-A,D=S*i+T*c+2048>>12,S=S*c-T*i+2048>>12,T=D,D=A*o+M*r+2048>>12,A=A*r-M*o+2048>>12,I=(I=(C=C+k+1>>1)+T)<16?0:I>=4080?255:I>>4,P=(P=(b=b+x+1>>1)+(M=D))<16?0:P>=4080?255:P>>4,L=(L=(x=b-x)+A)<16?0:L>=4080?255:L>>4,E=(E=(k=C-k)+S)<16?0:E>=4080?255:E>>4,U=(U=k-S)<16?0:U>=4080?255:U>>4,R=(R=x-A)<16?0:R>=4080?255:R>>4,B=(B=b-M)<16?0:B>=4080?255:B>>4,G=(G=C-T)<16?0:G>=4080?255:G>>4,F[y+_]=I,F[y+_+8]=P,F[y+_+16]=L,F[y+_+24]=E,F[y+_+32]=U,F[y+_+40]=R,F[y+_+48]=B,F[y+_+56]=G):(D=(D=s*I+8192>>14)<-2040?0:D>=2024?255:D+2056>>4,F[y+_]=D,F[y+_+8]=D,F[y+_+16]=D,F[y+_+24]=D,F[y+_+32]=D,F[y+_+40]=D,F[y+_+48]=D,F[y+_+56]=D)}function g(d,y){for(var w=y.blocksPerLine,C=y.blocksPerColumn,b=new Int16Array(64),x=0;x=b)return null;var k=C(y);if(k>=65472&&k<=65534)return{invalid:null,marker:k,offset:y};for(var S=C(x);!(S>=65472&&S<=65534);){if(++x>=b)return null;S=C(x)}return{invalid:k.toString(16),marker:S,offset:x}}return a.prototype={parse:function(d){function y(){var $=d[k]<<8|d[k+1];return k+=2,$}function w(){var $=y(),W=k+$-2,K=v(d,W,k);K&&K.invalid&&(console.log("readDataBlock - incorrect length, next marker is: "+K.invalid),W=K.offset);var rt=d.subarray(k,W);return k+=rt.length,rt}function C($){for(var W=Math.ceil($.samplesPerLine/8/$.maxH),K=Math.ceil($.scanLines/8/$.maxV),rt=0;rt<$.components.length;rt++){Z=$.components[rt];var at=Math.ceil(Math.ceil($.samplesPerLine/8)*Z.h/$.maxH),ft=Math.ceil(Math.ceil($.scanLines/8)*Z.v/$.maxV),ot=W*Z.h,lt=K*Z.v*64*(ot+1);Z.blockData=new Int16Array(lt),Z.blocksPerLine=at,Z.blocksPerColumn=ft}$.mcusPerLine=W,$.mcusPerColumn=K}var b,x,k=0,S=null,A=null,M=[],T=[],I=[],P=y();if(P!==65496)throw new t("SOI not found");for(P=y();P!==65497;){var L,E,U;switch(P){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var R=w();P===65504&&R[0]===74&&R[1]===70&&R[2]===73&&R[3]===70&&R[4]===0&&(S={version:{major:R[5],minor:R[6]},densityUnits:R[7],xDensity:R[8]<<8|R[9],yDensity:R[10]<<8|R[11],thumbWidth:R[12],thumbHeight:R[13],thumbData:R.subarray(14,14+3*R[12]*R[13])}),P===65518&&R[0]===65&&R[1]===100&&R[2]===111&&R[3]===98&&R[4]===101&&(A={version:R[5]<<8|R[6],flags0:R[7]<<8|R[8],flags1:R[9]<<8|R[10],transformCode:R[11]});break;case 65499:for(var B=y()+k-2;k>4){if(G>>4!=1)throw new t("DQT - invalid table spec");for(E=0;E<64;E++)D[e[E]]=y()}else for(E=0;E<64;E++)D[e[E]]=d[k++];M[15&G]=D}break;case 65472:case 65473:case 65474:if(b)throw new t("Only single frame JPEGs supported");y(),(b={}).extended=P===65473,b.progressive=P===65474,b.precision=d[k++],b.scanLines=y(),b.samplesPerLine=y(),b.components=[],b.componentIds={};var j,F=d[k++],V=0,_=0;for(L=0;L>4,tt=15&d[k+1];V>4?T:I)[15&J]=h(q,dt)}break;case 65501:y(),x=y();break;case 65498:y();var Z,Gt=d[k++],vt=[];for(L=0;L>4],Z.huffmanTableAC=T[15&xt],vt.push(Z)}var _t=d[k++],jt=d[k++],mt=d[k++],zt=f(d,k,b,vt,x,_t,jt,mt>>4,15&mt);k+=zt;break;case 65535:d[k]!==255&&k--;break;default:if(d[k-3]===255&&d[k-2]>=192&&d[k-2]<=254){k-=3;break}throw new t("unknown marker "+P.toString(16))}P=y()}for(this.width=b.samplesPerLine,this.height=b.scanLines,this.jfif=S,this.eof=k,this.adobe=A,this.components=[],L=0;L>8)+F[T+1];return G},_isColorConversionNeeded:function(){return this.adobe?!!this.adobe.transformCode:this.numComponents===3?this.colorTransform!==0:this.colorTransform===1},_convertYccToRgb:function(d){for(var y,w,C,b=0,x=d.length;b4)throw new t("Unsupported color mode");var C=this._getLinearizedBlockData(d,y);if(this.numComponents===1&&w){for(var b=C.length,x=new Uint8ClampedArray(3*b),k=0,S=0;S=0;g--)p[d++]=v[f]>>g&1}catch{}if(n===1&&l.length===i*u){const v=new Uint8Array(l.buffer);h=[v,v,v]}else{for(h=[],f=0;f<3;f++)h.push(new Uint8Array(a));for(g=0,m=0;mimport("./lerc-wasm-v7WMG2so.js"),__vite__mapDeps([0,1,2])).then(t=>t.l).then(({default:t})=>t({locateFile:e=>Fr(`esri/layers/support/rasterFormats/${e}`)})).then(t=>{po(t)}),ie)}const Yt={getBlobInfo:null,decode:null};function fo(t){return 16+(t>>3<<3)}function bt(t,e,r){r.set(t.slice(e,e+r.length))}function po(t){const{_malloc:e,_free:r,_lerc_getBlobInfo:o,_lerc_getDataRanges:c,_lerc_decode_4D:i,asm:u}=t;let n;const s=Object.values(u).find(a=>a&&"buffer"in a&&a.buffer===t.HEAPU8.buffer),l=a=>{const h=a.map(g=>fo(g)),p=h.reduce((g,v)=>g+v),f=e(p);n=new Uint8Array(s.buffer);let m=h[0];h[0]=f;for(let g=1;g{const f=new Uint8Array(48),m=new Uint8Array(8*3),[g,v,d]=l([a.length,f.length,m.length]);n.set(a,g),n.set(f,v),n.set(m,d);let y=o(g,a.length,v,d,12,3);if(y)throw r(g),new Error(`lerc-getBlobInfo: error code is ${y}`);n=new Uint8Array(s.buffer),bt(n,v,f),bt(n,d,m);const w=new Uint32Array(f.buffer),C=new Float64Array(m.buffer),[b,x,,k,S,A,M,T,I,P,L]=w,E={version:b,depthCount:P,width:k,height:S,validPixelCount:M,bandCount:A,blobSize:T,maskCount:I,dataType:x,minValue:C[0],maxValue:C[1],maxZerror:C[2],statistics:[],bandCountWithNoData:L};if(L&&P>1)return r(g),E;if(P===1&&A===1)return r(g),E.statistics.push({minValue:C[0],maxValue:C[1]}),E;const U=P*A*8,R=new Uint8Array(U),B=new Uint8Array(U);let G=g,D=0,j=0,F=!1;if(n.byteLength1){const wt=V.slice(tt*P,(tt+1)*P),Ct=_.slice(tt*P,(tt+1)*P),J=Math.min.apply(null,wt),q=Math.max.apply(null,Ct);X.push({minValue:J,maxValue:q,depthStats:{minValues:wt,maxValues:Ct}})}else X.push({minValue:V[tt],maxValue:_[tt]});return r(G),F||r(D),E},Yt.decode=(a,h)=>{const{maskCount:p,depthCount:f,bandCount:m,width:g,height:v,dataType:d,bandCountWithNoData:y}=h,w=gr[d],C=g*v,b=new Uint8Array(C*m),x=C*f*m*w.size,k=new Uint8Array(x),S=new Uint8Array(m),A=new Uint8Array(8*m),[M,T,I,P,L]=l([a.length,b.length,k.length,S.length,A.length]);n.set(a,M),n.set(b,T),n.set(k,I),n.set(S,P),n.set(A,L);const E=i(M,a.length,p,T,f,g,v,m,d,I,P,L);if(E)throw r(M),new Error(`lerc-decode: error code is ${E}`);n=new Uint8Array(s.buffer),bt(n,I,k),bt(n,T,b);let U=null;if(y){bt(n,P,S),bt(n,L,A),U=[];const R=new Float64Array(A.buffer);for(let B=0;B1){b.set(y[0]);for(let M=1;M=x;if(f>0&&k)for(let M=0;M1?y:null,{pixelType:A}=g;return{width:s,height:l,bandCount:a,pixelType:A,depthCount:h,statistics:m,pixels:d,mask:b,bandMasks:S,noDataValues:n}}function go(t,e,r,o=!0){if(e%4!=0||r%4!=0){const c=new ArrayBuffer(4*Math.ceil(r/4)),i=new Uint8Array(c),u=new Uint8Array(t,e,r);if(o)for(let n=0;n=i)n-=i,p=h>>>32-i,h<<=i;else{p=h>>>32-n,h=c[a++];const d=i-n;n=32-d,p=(p<>>n),h<<=d}if(p===257)break;if(p===256){i=9,u=Ze(),s=u.length,l=[];continue}const v=u[p];if(v==null){if(p>u.length)throw new Error("data integrity issue: code does not exist on code page");l.push(l[0]),u[s++]=l.slice(),Qe(g,l)}else Qe(g,v),l.push(v[0]),l.length>1&&(u[s++]=l.slice()),l=v.slice();if(Et.has(s)&&i++,n===0&&(h=c[a++],n=32),a>f||a===f&&n<=m)break}return new Uint8Array(g)}Et.add(511),Et.add(1023),Et.add(2047),Et.add(4095),Et.add(8191);const tr=(t,e)=>{const r=e.width*e.height,o=e.pixelType;return Math.floor(t.byteLength/(r*Cr(o)))},Cr=t=>{let e=1;switch(t){case Uint8Array:case Int8Array:e=1;break;case Uint16Array:case Int16Array:e=2;break;case Uint32Array:case Int32Array:case Float32Array:e=4;break;case Float64Array:e=8}return e},yo=(t,e)=>{if(8*t.byteLength=0;n--)o[c++]=i>>n&1;for(n=7;c>n&1,n--;return o};let wo=class{static decode(e,r){const o=r.pixelType,c=[],i=r.width*r.height,u=tr(e,r),{bandIds:n,format:s}=r,l=(n==null?void 0:n.length)||tr(e,r),a=e.byteLength-e.byteLength%(i*Cr(o)),h=new o(e,0,i*u);let p,f,m,g,v=null;if(s==="bip")for(p=0;p>4,c<8?c=1:c===15?(c=4,i=(7&i)<<18|(63&t[r++])<<12|(63&t[r++])<<6|63&t[r++]):c===14?(c=3,i=(15&i)<<12|(63&t[r++])<<6|63&t[r++]):(c=2,i=(31&i)<<6|63&t[r++]),(i!==0||e)&&(o+=String.fromCharCode(i));return o}const Ae=(()=>{const t=[];return t[254]="NEWSUBFILETYPE",t[255]="SUBFILETYPE",t[256]="IMAGEWIDTH",t[257]="IMAGELENGTH",t[258]="BITSPERSAMPLE",t[259]="COMPRESSION",t[262]="PHOTOMETRICINTERPRETATION",t[263]="THRESHHOLDING",t[264]="CELLWIDTH",t[265]="CELLLENGTH",t[266]="FILLORDER",t[269]="DOCUMENTNAME",t[270]="IMAGEDESCRIPTION",t[271]="MAKE",t[272]="MODEL",t[273]="STRIPOFFSETS",t[274]="ORIENTATION",t[277]="SAMPLESPERPIXEL",t[278]="ROWSPERSTRIP",t[279]="STRIPBYTECOUNTS",t[280]="MINSAMPLEVALUE",t[281]="MAXSAMPLEVALUE",t[282]="XRESOLUTION",t[283]="YRESOLUTION",t[284]="PLANARCONFIGURATION",t[285]="PAGENAME",t[286]="XPOSITION",t[287]="YPOSITION",t[288]="FREEOFFSETS",t[289]="FREEBYTECOUNTS",t[290]="GRAYRESPONSEUNIT",t[291]="GRAYRESPONSECURVE",t[292]="T4OPTIONS",t[293]="T6OPTIONS",t[296]="RESOLUTIONUNIT",t[297]="PAGENUMBER",t[300]="COLORRESPONSEUNIT",t[301]="TRANSFERFUNCTION",t[305]="SOFTWARE",t[306]="DATETIME",t[315]="ARTIST",t[316]="HOSTCOMPUTER",t[317]="PREDICTOR",t[318]="WHITEPOINT",t[319]="PRIMARYCHROMATICITIES",t[320]="COLORMAP",t[321]="HALFTONEHINTS",t[322]="TILEWIDTH",t[323]="TILELENGTH",t[324]="TILEOFFSETS",t[325]="TILEBYTECOUNTS",t[326]="BADFAXLINES",t[327]="CLEANFAXDATA",t[328]="CONSECUTIVEBADFAXLINES",t[330]="SUBIFD",t[332]="INKSET",t[333]="INKNAMES",t[334]="NUMBEROFINKS",t[336]="DOTRANGE",t[337]="TARGETPRINTER",t[338]="EXTRASAMPLES",t[339]="SAMPLEFORMAT",t[340]="SMINSAMPLEVALUE",t[341]="SMAXSAMPLEVALUE",t[342]="TRANSFERRANGE",t[347]="JPEGTABLES",t[512]="JPEGPROC",t[513]="JPEGIFOFFSET",t[514]="JPEGIFBYTECOUNT",t[515]="JPEGRESTARTINTERVAL",t[517]="JPEGLOSSLESSPREDICTORS",t[518]="JPEGPOINTTRANSFORM",t[519]="JPEGQTABLES",t[520]="JPEGDCTABLES",t[521]="JPEGACTABLES",t[529]="YCBCRCOEFFICIENTS",t[530]="YCBCRSUBSAMPLING",t[531]="YCBCRPOSITIONING",t[532]="REFERENCEBLACKWHITE",t[700]="XMP",t[33550]="GEOPIXELSCALE",t[33922]="GEOTIEPOINTS",t[33432]="COPYRIGHT",t[42112]="GDAL_METADATA",t[42113]="GDAL_NODATA",t[50844]="RPCCOEFFICIENT",t[34264]="GEOTRANSMATRIX",t[34735]="GEOKEYDIRECTORY",t[34736]="GEODOUBLEPARAMS",t[34737]="GEOASCIIPARAMS",t[34665]="EXIFIFD",t[34853]="GPSIFD",t[40965]="INTEROPERABILITYIFD",t})(),bo=(()=>{const t=Ae.slice();return t[36864]="ExifVersion",t[40960]="FlashpixVersion",t[40961]="ColorSpace",t[42240]="Gamma",t[37121]="ComponentsConfiguration",t[37122]="CompressedBitsPerPixel",t[40962]="PixelXDimension",t[40963]="PixelYDimension",t[37500]="MakerNote",t[37510]="UserComment",t[40964]="RelatedSoundFile",t[36867]="DateTimeOriginal",t[36868]="DateTimeDigitized",t[36880]="OffsetTime",t[36881]="OffsetTimeOriginal",t[36882]="OffsetTimeDigitized",t[37520]="SubSecTime",t[37521]="SubSecTimeOriginal",t[37522]="SubSecTimeDigitized",t[37888]="Temperature",t[37889]="Humidity",t[37890]="Pressure",t[37891]="WaterDepth",t[37892]="Acceleration",t[37893]="CameraElevationAngle",t[42016]="ImageUniqueID",t[42032]="CameraOwnerName",t[42033]="BodySerialNumber",t[42034]="LensSpecification",t[42035]="LensMake",t[42036]="LensModel",t[42037]="LensSerialNumber",t[33434]="ExposureTime",t[33437]="FNumber",t[34850]="ExposureProgram",t[34852]="SpectralSensitivity",t[34855]="PhotographicSensitivity",t[34856]="OECF",t[34864]="SensitivityType",t[34865]="StandardOutputSensitivity",t[34866]="RecommendedExposureIndex",t[34867]="ISOSpeed",t[34868]="ISOSpeedLatitudeyyy",t[34869]="ISOSpeedLatitudezzz",t[37377]="ShutterSpeedValue",t[37378]="ApertureValue",t[37379]="BrightnessValue",t[37380]="ExposureBiasValue",t[37381]="MaxApertureValue",t[37382]="SubjectDistance",t[37383]="MeteringMode",t[37384]="LightSource",t[37385]="Flash",t[37386]="FocalLength",t[37396]="SubjectArea",t[41483]="FlashEnergy",t[41484]="SpatialFrequencyResponse",t[41486]="FocalPlaneXResolution",t[41487]="FocalPlaneYResolution",t[41488]="FocalPlaneResolutionUnit",t[41492]="SubjectLocation",t[41493]="ExposureIndex",t[41495]="SensingMethod",t[41728]="FileSource",t[41729]="SceneType",t[41730]="CFAPattern",t[41985]="CustomRendered",t[41986]="ExposureMode",t[41987]="WhiteBalance",t[41988]="DigitalZoomRatio",t[41989]="FocalLengthIn35mmFilm",t[41990]="SceneCaptureType",t[41991]="GainControl",t[41992]="Contrast",t[41993]="Saturation",t[41994]="Sharpness",t[41995]="DeviceSettingDescription",t[41996]="SubjectDistanceRange",t})(),vo=["GPSVersionID","GPSLatitudeRef","GPSLatitude","GPSLongitudeRef","GPSLongitude","GPSAltitudeRef","GPSAltitude","GPSTimeStamp","GPSSatellites","GPSStatus","GPSMeasureMode","GPSDOP","GPSSpeedRef","GPSSpeed","GPSTrackRef","GPSTrack","GPSImgDirectionRef","GPSImgDirection","GPSMapDatum","GPSDestLatitudeRef","GPSDestLatitude","GPSDestLongitudeRef","GPSDestLongitude","GPSDestBearingRef","GPSDestBearing","GPSDestDistanceRef","GPSDestDistance","GPSProcessingMethod","GPSAreaInformation","GPSDateStamp","GPSDifferential","GPSHPositioningError"],xo=(()=>{const t=[];return t[1024]="GTModelTypeGeoKey",t[1025]="GTRasterTypeGeoKey",t[1026]="GTCitationGeoKey",t[2048]="GeographicTypeGeoKey",t[2049]="GeogCitationGeoKey",t[2050]="GeogGeodeticDatumGeoKey",t[2051]="GeogPrimeMeridianGeoKey",t[2052]="GeogLinearUnitsGeoKey",t[2053]="GeogLinearUnitSizeGeoKey",t[2054]="GeogAngularUnitsGeoKey",t[2055]="GeogAngularUnitSizeGeoKey",t[2056]="GeogEllipsoidGeoKey",t[2057]="GeogSemiMajorAxisGeoKey",t[2058]="GeogSemiMinorAxisGeoKey",t[2059]="GeogInvFlatteningGeoKey",t[2061]="GeogPrimeMeridianLongGeoKey",t[2060]="GeogAzimuthUnitsGeoKey",t[3072]="ProjectedCSTypeGeoKey",t[3073]="PCSCitationGeoKey",t[3074]="ProjectionGeoKey",t[3075]="ProjCoordTransGeoKey",t[3076]="ProjLinearUnitsGeoKey",t[3077]="ProjLinearUnitSizeGeoKey",t[3078]="ProjStdParallel1GeoKey",t[3079]="ProjStdParallel2GeoKey",t[3080]="ProjNatOriginLongGeoKey",t[3081]="ProjNatOriginLatGeoKey",t[3082]="ProjFalseEastingGeoKey",t[3083]="ProjFalseNorthingGeoKey",t[3084]="ProjFalseOriginLongGeoKey",t[3085]="ProjFalseOriginLatGeoKey",t[3086]="ProjFalseOriginEastingGeoKey",t[3087]="ProjFalseOriginNorthingGeoKey",t[3088]="ProjCenterLongGeoKey",t[3090]="ProjCenterEastingGeoKey",t[3091]="ProjCenterNorthingGeoKey",t[3092]="ProjScaleAtNatOriginGeoKey",t[3093]="ProjScaleAtCenterGeoKey",t[3094]="ProjAzimuthAngleGeoKey",t[3095]="ProjStraightVertPoleLongGeoKey",t[4096]="VerticalCSTypeGeoKey",t[4097]="VerticalCitationGeoKey",t[4098]="VerticalDatumGeoKey",t[4099]="VerticalUnitsGeoKey",t})(),ko=(t,e)=>{let r=(e||Ae)[t];return r===void 0&&(r="unknown"+String(t)),r},ge=new Map;ge.set("EXIFIFD",bo),ge.set("GPSIFD",vo);const Lt={tiffTags:Ae,ifdTags:ge,geoKeys:xo,getTagName:ko},Se=(()=>{const t=new ArrayBuffer(4),e=new Uint8Array(t);return new Uint32Array(t)[0]=1,e[0]===1})(),er=[0,1,1,2,4,8,1,1,2,4,8,4,8,-1,-1,-1,8,8,8],Ut=4294967296,Ao=new Set([1,5,6,7,8,34712,34887]);function Te(t,e){let r="unknown";return t===3?r=e===64?"f64":"f32":t===1?e===1?r="u1":e===2?r="u2":e===4?r="u4":e<=8?r="u8":e<=16?r="u16":e<=32&&(r="u32"):t===2&&(e<=8?r="s8":e<=16?r="s16":e<=32&&(r="s32")),r}function Zt(t){let e=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":e=Uint8Array;break;case"u16":e=Uint16Array;break;case"u32":e=Uint32Array;break;case"s8":e=Int8Array;break;case"s16":e=Int16Array;break;case"s32":e=Int32Array;break;case"f64":e=Float64Array;break;default:e=Float32Array}return e}function So(t,e){return{x:e[0]*t.x+e[1]*t.y+e[2],y:e[3]*t.x+e[4]*t.y+e[5]}}function br(t,e){var r;return(r=t.get(e))==null?void 0:r.values}function Mt(t,e){var r;return(r=t.get(e))==null?void 0:r.values}function rr(t,e){var r,o;return(o=(r=t.get(e))==null?void 0:r.values)==null?void 0:o[0]}function z(t,e){var r,o;return(o=(r=t.get(e))==null?void 0:r.values)==null?void 0:o[0]}function se(t,e,r,o=0,c=Lt.tiffTags,i=4){const u=i===8,n=u?Me(new DataView(t,r,8),0,e):new DataView(t,r,2).getUint16(0,e),s=4+2*i,l=u?8:2,a=l+n*s;if(r+a>t.byteLength)return{success:!1,ifd:null,nextIFD:null,requiredBufferSize:a};const h=r+a+4<=t.byteLength?Kt(new DataView(t,r+a,i===8?8:4),0,e,i===8):null,p=r+l,f=new Map;let m,g,v,d,y,w=0,C=0;for(let b=0;bwr(t,{inputOffset:e}).pixels[0];function ye(t,e){if(e!==1&&e!==2&&e!==4)return t;const r=new Uint8Array(t),o=8/e,c=new Uint8Array(t.byteLength*o);let i=0;const u=2**e-1;for(let n=0;n>>8-e&u}return c.buffer}function we(t,e,r){const o=new mr;o.parse(t),o.colorTransform=r===6?-1:0;const c=o.getData(o.width,o.height,e!==1&&e!==4);return new Uint8Array(c.buffer)}function Ce(t){const e=new Vt(t).getBytes(),r=new ArrayBuffer(e.length),o=new Uint8Array(r);return o.set(e),o}async function be(t,e,r,o,c){const i=Se===e,u=z(r,"BITSPERSAMPLE"),n=z(r,"SAMPLESPERPIXEL")??1,s=z(r,"PHOTOMETRICINTERPRETATION"),l=z(r,"SAMPLEFORMAT")??1,a=Te(l,u),h=z(r,"COMPRESSION")??1,p=Zt(a);let f,m,g;if(h===34887)return await yr(),To(t,o);if(h===1)f=t.slice(o,o+c),m=new Uint8Array(f);else if(h===8||h===32946)m=new Uint8Array(t,o,c),m=Ce(m),f=m.buffer;else if(h===6)m=new Uint8Array(t,o,c),m=we(m,n,s),f=m.buffer;else if(h===7){const w=r.get("JPEGTABLES").values,C=w.length-2;m=new Uint8Array(C+c-2);for(let x=0;x1&&(h===5||h===8||h===32946)&&d&&y){const w=Qt(r),C=new p(g.length);C.set(g),g=Go(C,y,d,l===3&&v===3,w?1:n)}return g}async function Io(t,e,r){const o=Mt(r,"TILEOFFSETS");if(o===void 0)return null;const c=Mt(r,"TILEBYTECOUNTS"),{width:i,height:u,pixelType:n,tileWidth:s,tileHeight:l}=Ie([r]),a=Qt(r,e),h=z(r,"SAMPLESPERPIXEL")||e.planes,p=i*u,f=z(r,"BITSPERSAMPLE"),m=(z(r,"COMPRESSION")??1)===34887,g=Zt(n),v=[];for(let R=0;R1){const R=Math.round(o.length/h);for(d=0;d{const o=Se===e.littleEndian,c=Mt(r,"STRIPOFFSETS");if(c===void 0)return null;const{width:i,height:u,pixelType:n}=Ie([r]),s=z(r,"SAMPLESPERPIXEL")||e.planes,l=z(r,"PHOTOMETRICINTERPRETATION"),a=i*u,h=z(r,"BITSPERSAMPLE"),p=Zt(n),f=new p(a*s),m=Mt(r,"STRIPBYTECOUNTS"),g=z(r,"ROWSPERSTRIP"),v=z(r,"COMPRESSION")??1;let d,y,w,C,b,x,k,S,A,M=g;if(h%8==0)for(d=0;du?u-d*g:g,n==="u8"||n==="s8"||o)v===8||v===32946?(k=new Uint8Array(t,c[d],m[d]),k=Ce(k),x=k.buffer):v===6?(k=new Uint8Array(t,c[d],m[d]),k=we(k,s,l),x=k.buffer):v===5?(k=ke(t,c[d],m[d],e.littleEndian),x=k.buffer):(m[d]!==M*i*s*h/8&&console.log("strip byte counts is different than expected"),x=t.slice(c[d],c[d]+m[d])),x=ye(x,h),C=new p(x);else{switch(v===6||v===8||v===32946?(k=new Uint8Array(t,c[d],m[d]),S=Ce(k),x=S.buffer):(m[d]!==M*i*s*h/8&&console.log("strip byte counts is different than expected"),x=new ArrayBuffer(m[d]),k=new Uint8Array(t,c[d],m[d]),S=new Uint8Array(x)),n){case"u16":case"s16":for(w=0;w{if(!(t&&t.length>0&&e&&r))return null;let o,c,i;const u=t[0].length,n=t.length,s=new Uint8Array(u);for(let l=0;li?0:1;else for(let a=0;ai?0:1);return s},Eo=t=>{if(!t)return null;const e=t.match(//gi);if(!e||e.length===0)return null;const r=new Map;let o,c,i,u,n;for(let d=0;d")),u=o.indexOf("sample="),u>-1&&(n=o.slice(u+8,o.indexOf('"',u+8))),u=o.indexOf("name="),u>-1&&(c=o.slice(u+6,o.indexOf('"',u+6))),c&&(i=o.slice(o.indexOf(">")+1,o.indexOf("")).trim(),n!=null?r.has(c)?r.get(c)[n]=i:r.set(c,[i]):r.set(c,i)),n=null;const s=r.get("STATISTICS_MINIMUM"),l=r.get("STATISTICS_MAXIMUM"),a=r.get("STATISTICS_MEAN"),h=r.get("STATISTICS_STDDEV");let p=null;if(s&&l){p=[];for(let d=0;dv&&p>(c?t.byteLength:t?t.byteLength-s+o:0))return r.offlineOffsetSize=[s,p],r.values=null,!1;if(f<=v){if(!e)if(v<=32)s>>>=32-f;else{const y=d!=null&&d.length?d[0]:s>>>0,w=d!=null&&d.length?d[1]:Math.round((s-y)/Ut);f<=32?(s=y>>>32-f,d[0]=s):(s=y*2**(32-f)+(w>>>32-f),d[0]=y,d[1]=w>>>32-f)}if(n===1&&h===v)l=[s];else if(v===64){const y=d!=null&&d.length?d[0]:s>>>0,w=d!=null&&d.length?d[1]:Math.round((s-y)/Ut);let C=y,b=32;for(g=1;g<=n;g++){const x=32-h*g%32;if(b>>32-b,S=w<<32-b>>>32-b;C=w,l.push(k+S*2**(h-b)),b-=32-(h-b)}else l.push(C<>>32-h),b-=h;b===0&&(b=32,C=w)}}else for(g=1;g<=n;g++){const y=32-h*g;l.push(s<>>32-h)}}else{s-=o,c&&(s=0);for(let y=s;yparseFloat(G)),p.some(G=>isNaN(G))&&(p=null));const f=z(e,"COMPRESSION")??1;let m;switch(f){case 1:m="NONE";break;case 2:case 3:case 4:case 32771:m="CCITT";break;case 5:m="LZW";break;case 6:case 7:m="JPEG";break;case 32773:m="PACKBITS";break;case 8:case 32946:m="DEFLATE";break;case 34712:m="JPEG2000";break;case 34887:m="LERC";break;default:m=String(f)}let g=!0,v="";Ao.has(f)||(g=!1,v+="unsupported tag compression "+f),s>3&&(g=!1,v+="unsupported tag sampleFormat "+s),u!==1&&u!==2&&u!==4&&u%8!=0&&(g=!1,v+="unsupported tag bitsPerSample "+u);const d=rr(e,"GEOASCIIPARAMS");let y;if(d){const G=d.split("|").find(j=>j.includes("ESRI PE String = ")),D=G?G.replace("ESRI PE String = ",""):"";y=D.startsWith("COMPD_CS")||D.startsWith("PROJCS")||D.startsWith("GEOGCS")?{wkid:null,wkt:D}:null}const w=Mt(e,"GEOTIEPOINTS"),C=Mt(e,"GEOPIXELSCALE"),b=Mt(e,"GEOTRANSMATRIX"),x=e.has("GEOKEYDIRECTORY")?e.get("GEOKEYDIRECTORY").data:null;let k,S,A=!1,M=!1;if(x){A=z(x,"GTRasterTypeGeoKey")===2;const G=z(x,"GTModelTypeGeoKey");if(G===2){const D=z(x,"GeographicTypeGeoKey");D>=1024&&D<=32766&&(y={wkid:D}),y||D!==32767||(M=!0,y={wkid:4326})}else if(G===1){const D=z(x,"ProjectedCSTypeGeoKey");D>=1024&&D<=32766&&(y={wkid:D})}}if(C&&w&&w.length>=6?(k=[C[0],0,w[3]-w[0]*C[0],0,-Math.abs(C[1]),w[4]-w[1]*C[1]],A&&(k[2]-=.5*k[0]+.5*k[1],k[5]-=.5*k[3]+.5*k[4])):b&&b.length===16&&(k=A?[b[0],b[1],b[3]-.5*b[0],b[4],b[5],b[7]-.5*b[5]]:[b[0],b[1],b[3],b[4],b[5],b[7]]),k){const G=[{x:0,y:i},{x:0,y:0},{x:c,y:i},{x:c,y:0}];let D,j=Number.POSITIVE_INFINITY,F=Number.POSITIVE_INFINITY,V=Number.NEGATIVE_INFINITY,_=Number.NEGATIVE_INFINITY;for(let X=0;Xj?j:D.x,V=D.xF?F:D.y,_=D.y<_?_:D.y;S={xmin:j,xmax:V,ymin:F,ymax:_,spatialReference:y}}else S={xmin:-.5,ymin:.5-i,xmax:c-.5,ymax:.5,spatialReference:y};M&&(S.xmax-S.xmin>400||Math.max(Math.abs(S.xmin),Math.abs(S.xmax))>361)&&(y=null,S.spatialReference=null);const T=vr(t);let I,P,L,E,U;if(T.length>0){L=Math.round(Math.log(c/z(T[0],"IMAGEWIDTH"))/Math.LN2);const G=T[T.length-1];E=Math.round(Math.log(c/z(G,"IMAGEWIDTH"))/Math.LN2),I=z(G,"TILEWIDTH"),P=z(G,"TILELENGTH")}I=E!=null&&E>0?I||r:null,P=E!=null&&E>0?P||o:null,r&&(U=[{maxCol:Math.ceil(c/r)-1,maxRow:Math.ceil(i/o)-1,minRow:0,minCol:0}],T.forEach(G=>{U.push({maxCol:Math.ceil(z(G,"IMAGEWIDTH")/z(G,"TILEWIDTH"))-1,maxRow:Math.ceil(z(G,"IMAGELENGTH")/z(G,"TILELENGTH"))-1,minRow:0,minCol:0})}));const R=rr(t[0],"GDAL_METADATA"),B=Eo(R);return v+=" "+kr({width:c,height:i,tileWidth:r,tileHeight:o,planes:n,ifds:t}),{width:c,height:i,tileWidth:r,tileHeight:o,planes:n,isBSQ:a,pixelType:l,compression:m,noData:p,hasMaskBand:xr(t).length===T.length+1,isSupported:g,message:v,extent:S,isPseudoGeographic:M,affine:C?null:k,firstPyramidLevel:L,maximumPyramidLevel:E,pyramidBlockWidth:I,pyramidBlockHeight:P,tileBoundary:U,metadata:B}}function Qt(t,e){const r=br(t,"PLANARCONFIGURATION");return r?r[0]===2:!!e&&e.isBSQ}function vr(t){return t.filter(e=>z(e,"NEWSUBFILETYPE")===1)}function xr(t){return t.filter(e=>{const r=(4&(z(e,"NEWSUBFILETYPE")??0))==4,o=z(e,"PHOTOMETRICINTERPRETATION")===4;return r&&o})}function Lo(t){const{littleEndian:e,isBigTiff:r,firstIFDPos:o}=Do(t);let c=o;const i=[];do{const u=Oo(t,e,c,0,Lt.tiffTags,r?8:4);if(!u.success)break;i.push(u.ifd),c=u.nextIFD}while(c>0);return{...Ie(i),littleEndian:e,isBigTiff:r,ifds:i,pyramidIFDs:vr(i),maskIFDs:xr(i)}}function Me(t,e,r){const o=t.getUint32(e,r),c=t.getUint32(e+4,r);return r?c*Ut+o:o*Ut+c}function Uo(t,e,r){let o=r?t.getInt32(e,r):t.getUint32(e,r),c=r?t.getUint32(e+4,r):t.getInt32(e+4,r);const i=(r?o:c)>=0?1:-1;return r?o*=i:c*=i,i*(r?c*Ut+o:o*Ut+c)}function Kt(t,e,r,o){return o?Me(t,e,r):t.getUint32(e,r)}function Do(t){const e=new DataView(t,0,16),r=e.getUint16(0,!1);let o=null;if(r===18761)o=!0;else{if(r!==19789)throw new Error("unexpected endianess byte");o=!1}const c=e.getUint16(2,o);if(c!==42&&c!==43)throw new Error("unexpected tiff identifier");let i=4;const u=c===43;if(u){const n=e.getUint16(i,o);if(i+=2,n!==8)throw new Error("unsupported bigtiff version");if(e.getUint16(i,o)!==0)throw new Error("unsupported bigtiff version");i+=2}return{littleEndian:o,isBigTiff:u,firstIFDPos:Kt(e,i,o,u)}}function Oo(t,e,r,o=0,c=Lt.tiffTags,i=4){const u=se(t,e,r,o,c,i);let n;const s=u.ifd;if(s){if(Lt.ifdTags.forEach((l,a)=>{s.has(a)&&(n=s.get(a),n.data=se(t,e,n.valueOffset-o,o,l).ifd)}),s.has("GEOKEYDIRECTORY")){n=s.get("GEOKEYDIRECTORY");const l=n.values;if(l&&l.length>4){const a=l[0]+"."+l[1]+"."+l[2];n.data=se(t,e,n.valueOffset+6-o,o,Lt.geoKeys,2).ifd,n.data&&n.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[a]})}}if(s.has("XMP")){n=s.get("XMP");const l=n.values;typeof l[0]=="number"&&n.type===7&&(n.values=[Co(new Uint8Array(l))])}}return u}function kr(t){const{width:e,height:r,tileHeight:o,tileWidth:c}=t,i=t.planes,u=c?c*o:e*r,n=z(t.ifds[0],"BITSPERSAMPLE");let s="";return u*i>2**30/(n>8?n/8:1)&&(s=c?"tiled tiff exceeding 1 gigabits per tile is not supported":"scanline tiff exceeding 1 gigabits is not supported"),s}function Go(t,e,r,o,c){const i=o?4:1,u=r*i*c;o&&(t=new Uint8Array(t.buffer));for(let l=0;lA.min):null,k=b?b.map(A=>A.max):null,S={pixelType:l,width:p,height:f,pixels:d,noDataValue:C};return C!=null?xe(S,C):x&&k&&e.applyMinMaxConstraint&&(S.mask=Po(d,x,k)),S}async function No(t,e={}){const r=e.pyramidLevel||0,o=e.headerInfo||Lo(t),{ifds:c,noData:i}=o;if(c.length===0)throw new Error("no valid image file directory");const u=kr(o);if(u)throw u;let n=null;const s=r===-1?c[c.length-1]:c[r],l=i??e.noDataValue;return n=o.tileWidth?await Io(t,o,s):Mo(t,o,s),n&&(l!=null&&xe(n,l),n)}var $o=function(t){var e,r,o,c,i,u;function n(s){var l,a,h,p,f,m,g,v,d,y,w,C,b;for(this.data=s,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},f=null;;){switch(l=this.readUInt32(),v=(function(){var x,k;for(k=[],x=0;x<4;++x)k.push(String.fromCharCode(this.data[this.pos++]));return k}).call(this).join(""),v){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(l);break;case"fcTL":f&&this.animation.frames.push(f),this.pos+=4,f={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},p=this.readUInt16(),h=this.readUInt16()||100,f.delay=1e3*p/h,f.disposeOp=this.data[this.pos++],f.blendOp=this.data[this.pos++],f.data=[];break;case"IDAT":case"fdAT":for(v==="fdAT"&&(this.pos+=4,l-=4),s=(f!=null?f.data:void 0)||this.imgData,w=0;0<=l?wl;0<=l?++w:--w)s.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(l),(d=255-this.transparency.indexed.length)>0)for(C=0;0<=d?Cd;0<=d?++C:--C)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(l)[0];break;case 2:this.transparency.rgb=this.read(l)}break;case"tEXt":m=(y=this.read(l)).indexOf(0),g=String.fromCharCode.apply(String,y.slice(0,m)),this.text[g]=String.fromCharCode.apply(String,y.slice(m+1));break;case"IEND":return f&&this.animation.frames.push(f),this.colors=(function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}).call(this),this.hasAlphaChannel=(b=this.colorType)===4||b===6,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=(function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}).call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=l}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return n.load=function(s,l,a){var h;return typeof l=="function"&&(a=l),(h=new XMLHttpRequest).open("GET",s,!0),h.responseType="arraybuffer",h.onload=function(){var p;return p=new n(new Uint8Array(h.response||h.mozResponseArrayBuffer)),typeof(l!=null?l.getContext:void 0)=="function"&&p.render(l),typeof a=="function"?a(p):void 0},h.send(null)},r=1,o=2,e=0,n.prototype.read=function(s){var l,a;for(a=[],l=0;0<=s?ls;0<=s?++l:--l)a.push(this.data[this.pos++]);return a},n.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},n.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},n.prototype.decodePixels=function(s){var l,a,h,p,f,m,g,v,d,y,w,C,b,x,k,S,A,M,T,I,P,L,E;if(s==null&&(s=this.imgData),s.length===0)return new Uint8Array(0);for(s=(s=new Vt(s)).getBytes(),S=(C=this.pixelBitlength/8)*this.width,b=new Uint8Array(S*this.height),m=s.length,k=0,x=0,a=0;x1&&a/pHo(r,o,t);break;case"tiff":e=_o;break;case"deflate":e=zo;break;case"lzw":e=Wo;break;case"error":e=()=>{throw new yt("rasterCodec:decode","input data contains error")};break;default:e=()=>{throw new yt("rasterCodec:decode","unsupported raster format")}}return e}function Xo(t){let e=null,r=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":r=255,e=Uint8Array;break;case"u16":r=r||65535,e=Uint16Array;break;case"u32":r=r||2**32-1,e=Uint32Array;break;case"s8":r=r||-128,e=Int8Array;break;case"s16":r=r||-32768,e=Int16Array;break;case"s32":r=r||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:r}}function Zo(t,e=1){if(!t)return;const{pixels:r,width:o,height:c,mask:i}=t;if(!r||r.length===0)return;const u=r.length,n=o-1,s=c-1,l=[];let a,h,p,f,m,g,v=null;const d=H.getPixelArrayConstructor(t.pixelType);if(e===0){for(a=0;a1||e&&r.fields.find(c=>c.name.toLowerCase()===e.toLowerCase())==null)}function en(t){const{bandCount:e,dataType:r,pixelType:o}=t;return r==="elevation"||r==="generic"&&e===1&&(o==="s16"||o==="s32"||o==="f32"||o==="f64")}function rn(t,e=!1){const{bandCount:r,colormap:o,pixelType:c}=t;return r===1&&(!!(o!=null&&o.length)||!e&&c==="u8")}function qn(t,e=!1){const{attributeTable:r,bandCount:o}=t;return o===1&&(!e||r!=null||t.histograms!=null)}function Kn(t){const{dataType:e}=t;return e==="vector-uv"||e==="vector-magdir"}function Jn(t){const{dataType:e}=t;return e==="vector-uv"||e==="vector-magdir"}const ae=1,on=[.299,.587,.114];function Tr(t,e=256){e=Math.min(e,256);const{size:r,counts:o}=t,c=new Uint8Array(r),i=o.reduce((a,h)=>a+h/e,0);let u=0,n=0,s=0,l=i;for(let a=0;a=s){const b=Ir(s,o);for(l=0;l1&&(w-=(1/g)**(v*b[l])),ye[l]){const x=w*g*v**(1/o[l])+u;C[a]=i==="floor"?Math.floor(x):i==="round"?Math.round(x):x}else y>=r[l]?C[a]=n:C[a]=u;else C[a]=u;d[l]=C}}else for(l=0;l=r[l])C[a]=n;else{const b=(y-e[l])*f[l]+u;C[a]=i==="floor"?Math.floor(b):i==="round"?Math.round(b):b}d[l]=C}if(t.contrastOffset!=null){const b=nn(t.contrastOffset,t.brightnessOffset);for(l=0;l0&&r<100?n=(200*u-100*c+2*c*o)/(2*(100-r))+i:r<=0&&r>-100?n=(200*u-100*c+2*c*o)*(100+r)/2e4+i:r===100?(n=200*u-100*c+(c+1)*(100-r)+2*c*o,n=n>0?c:0):r===-100&&(n=i),s[u]=n>c?c:n<0?0:n;return s}function sn(t,e,r){const o=[];for(let c=0;c=255)return ae;let e=0;t!==150&&(e=t<=150?45*Math.cos(.01047*t):17*Math.sin(.021*t));const r=255,o=t+e,c=Math.log(t/r),i=Math.log(o/r);if(i===0)return ae;const u=c/i;return isNaN(u)?ae:Math.min(9.9,Math.max(.01,u))}function ln(t,e,r,o){let c=1/0,i=-1/0,u=0,n=0,s=0,l=0;const a=t.length,h=new Map,p=[];for(let k=0;kl&&(l=A,s=S),c=Si?S:i,u+=S,n++}}if(n===0)return{statistics:{min:0,max:0,avg:0,stddev:0,mode:0,median:0},histogram:null};const f=u/n;let m=0;for(let k=0;kk).length:a,v=g<=1?0:Math.sqrt(m/(g-1));p.sort((k,S)=>k-S);const d=n>>>1,y={min:c,max:i,avg:f,stddev:v,mode:s,median:n%2?p[Math.floor(d)]:(p[d-1]+p[d])/2};if(!o)return{statistics:y,histogram:null};if(["u8","s8","u4","u2","u1"].includes(r)){const k=i-c+1,S=new Uint32Array(k);for(let A=0;Aln(u,(c==null?void 0:c[n])??r,o,!0));return{statistics:i.map(({statistics:u})=>u),histograms:i.map(({histogram:u})=>u)}}function cn(t){var A;if(!((A=t==null?void 0:t.pixels)!=null&&A.length))return null;const{pixels:e,mask:r,bandMasks:o,pixelType:c}=t,i=t.width*t.height,u=e.length;let n,s,l,a,h;const p=[],f=[];let m,g,v,d,y,w,C,b,x,k;const S=256;for(a=0;a[T.minValue,T.maxValue,0,0]);else{const T=cn(r);u=T!=null?T.statistics:null,n=T!=null?T.histograms:null}else u=(M=t.statistics)!=null&&M.length?t.statistics:i.statistics,n="histograms"in t?t.histograms:void 0,n||(n=i.histograms);s!=="percentClip"&&s!=="histogramEqualization"||n!=null&&n.length||(s="minMax");const l=(u==null?void 0:u.length)||(n==null?void 0:n.length)||i.bandCount,a=[],h=[];let p,f,m,g,v,d,y,w,C;u&&!Array.isArray(u[0])&&(u=u.map(T=>[T.min,T.max,T.avg,T.stddev]));const[b,x]=Xt(i.pixelType);if(!(u!=null&&u.length)){for(u=[],w=0;wI[1]&&(h[w]=I[1])}}break;case"histogramEqualization":for(qt(n),w=0;w=20&&(g[0]=g[1]=g[2]=g[g.length-1]=g[g.length-2]=0),m=0,f=(p.max-p.min)/p.size,y=p.min===-.5&&f===1?.5:0,C=0;Cd){a[w]=p.min+f*(C+y);break}for(d=(1-(t.maxPercent||0)/100)*m,h[w]=p.max+y,C=p.size-2;C>=0;C--)if(v[C]Tr(T)))):(S=t.max||255,k=t.min||0),un({minCutOff:a,maxCutOff:h,outMax:S,outMin:k,histogramLut:A},o)}function un(t,e){if(e==null||e.length===0)return t;const r=Math.max.apply(null,e),{minCutOff:o,maxCutOff:c,outMin:i,outMax:u,histogramLut:n}=t;return o.length===e.length||o.length<=r?t:{minCutOff:e.map(s=>o[s]),maxCutOff:e.map(s=>c[s]),histogramLut:n?e.map(s=>n[s]):null,outMin:i,outMax:u}}function Ir(t,e){const r=new Float32Array(t);for(let o=0;o1?e[o]>2?r[o]=6.5+(e[o]-2)**2.5:r[o]=6.5+100*(2-e[o])**4:r[o]=1;return r}function le(t,e){var k;if(!((k=t==null?void 0:t.pixels)!=null&&k.length))return t;const{mask:r,bandMasks:o,width:c,height:i,pixels:u}=t,{minCutOff:n,maxCutOff:s,gamma:l}=e,a=e.outMin||0,h=e.outMax||255,p=c*i,f=e.outputPixelType||"u8",m=t.pixels.map(()=>H.createEmptyBand(f,p)),g=m.length,v=h-a,d=[],y=[];for(let S=0;S=g,b=!!e.isRenderer;if(C){const S=Ir(g,l);for(let A=0;A1&&(L-=(1/v)**(P*S[A])),In[A]){const E=L*v*P**(1/l[A])+a;m[A][T]=b?Math.floor(E):w?Math.round(E):E}else I>=s[A]?m[A][T]=h:m[A][T]=a}}}else for(let S=0;Sn[S]){const I=(T-n[S])*d[S]+a;m[S][M]=b?Math.floor(I):w?Math.round(I):I}else T>=s[S]?m[S][M]=h:m[S][M]=a}}const x=new H({width:c,height:i,mask:r,bandMasks:o,pixels:m,pixelType:f});return x.updateStatistics(),x}const st=1,Rt=1/111e3;function Mr(t){let{altitude:e,azimuth:r}=t;const{hillshadeType:o,pixelSizePower:c=1,pixelSizeFactor:i=1,scalingType:u,isGCS:n,resolution:s}=t,l=o==="multi-directional"?2*t.zFactor:t.zFactor,{x:a,y:h}=s;let p=l/(8*a),f=l/(8*h);if(n&&l>.001&&(p/=Rt,f/=Rt),u==="adjusted")if(n){const I=a*Rt,P=h*Rt;p=(l+I**c*i)/(8*I),f=(l+P**c*i)/(8*P)}else p=(l+a**c*i)/(8*a),f=(l+h**c*i)/(8*h);let m=(90-e)*Math.PI/180,g=Math.cos(m),v=(360-r+90)*Math.PI/180,d=Math.sin(m)*Math.cos(v),y=Math.sin(m)*Math.sin(v);const w=[315,270,225,360,180,0],C=[60,60,60,60,60,90],b=new Float32Array([3,5,3,2,1,4]),x=b.reduce((I,P)=>I+P),k=b.map(I=>I/x),S=o==="multi-directional"?w.length:1,A=new Float32Array(6),M=new Float32Array(6),T=new Float32Array(6);if(o==="multi-directional")for(let I=0;Im?m:v],w=u[g],C=w*y,b=C*(1-Math.abs(d%2-1)),x=w-C;switch(Math.floor(d)){case 0:h[g]=C+x,p[g]=b+x,f[g]=x;break;case 1:h[g]=b+x,p[g]=C+x,f[g]=x;break;case 2:h[g]=x,p[g]=C+x,f[g]=b+x;break;case 3:h[g]=x,p[g]=b+x,f[g]=C+x;break;case 4:h[g]=b+x,p[g]=x,f[g]=C+x;break;case 5:case 6:h[g]=C+x,p[g]=x,f[g]=b+x}}t.pixels=[h,p,f],t.updateStatistics()}function Zn(t,e){if(!Q(t))return t;const r=e.zFactor,o=e.pixelSizePower??1,c=e.pixelSizeFactor??1,i=e.slopeType,u=e.isGCS,{x:n,y:s}=e.resolution;let l=r/(8*n),a=r/(8*s);u&&Math.abs(r-1)<1e-4&&(l/=Rt,a/=Rt),i==="adjusted"&&(l=(r+n**o*c)/(8*n),a=(r+s**o*c)/(8*s));const{dzxs:h,dzys:p,outMask:f}=te(t),{width:m,height:g}=t,v=new Float32Array(m*g);for(let y=st;y360&&(d%=360)),a[p+f]=d}}}return ee(a,s,l),new H({width:s,height:l,pixels:[a],mask:n,pixelType:"f32",validPixelCount:t.validPixelCount,statistics:[{minValue:-1,maxValue:360}]})}function ti(t,e){if(!Q(t))return t;const{curvatures:r,outMask:o}=te(t,e),{width:c,height:i}=t;ee(r,c,i);const u=new H({width:c,height:i,pixels:[r],mask:o,pixelType:"f32",validPixelCount:t.validPixelCount});return u.updateStatistics(),u}let Tt=class extends Ot{constructor(t){super(t)}bind(){const{rendererJSON:t}=this;if(!t)return{success:!1};let e;switch(this.lookup={rendererJSON:{}},t.type){case"uniqueValue":e=this._updateUVRenderer(t);break;case"rasterColormap":e=this._updateColormapRenderer(t);break;case"rasterStretch":e=this._updateStretchRenderer(t);break;case"classBreaks":e=this._updateClassBreaksRenderer(t);break;case"rasterShadedRelief":e=this._updateShadedReliefRenderer(t);break;case"vectorField":e=this._updateVectorFieldRenderer();break;case"flowRenderer":e=this._updateFlowRenderer()}return e}symbolize(t){let e=t==null?void 0:t.pixelBlock;if(!nr(e))return e;if(t.simpleStretchParams&&this.rendererJSON.type==="rasterStretch")return this.simpleStretch(e,t.simpleStretchParams);try{let r;switch(e.pixels.length>3&&(e=e.extractBands([0,1,2])),this.rendererJSON.type){case"uniqueValue":case"rasterColormap":r=this._symbolizeColormap(e);break;case"classBreaks":r=this._symbolizeClassBreaks(e);break;case"rasterStretch":r=this._symbolizeStretch(e,t.bandIds);break;case"rasterShadedRelief":{const o=t.extent,c=o.spatialReference.isGeographic,i={x:(o.xmax-o.xmin)/e.width,y:(o.ymax-o.ymin)/e.height};r=this._symbolizeShadedRelief(e,{isGCS:c,resolution:i});break}}return r}catch(r){return gt.getLogger(this).error("symbolize",r.message),e}}simpleStretch(t,e){if(!nr(t))return t;try{return t.pixels.length>3&&(t=t.extractBands([0,1,2])),le(t,{...e,isRenderer:!0})}catch(r){return gt.getLogger(this).error("symbolize",r.message),t}}generateWebGLParameters(t){if(["uniqueValue","rasterColormap","classBreaks"].includes(this.rendererJSON.type)){const{indexedColormap:u,offset:n}=this.lookup.colormapLut||{};return{colormap:u,colormapOffset:n,type:"lut"}}const{pixelBlock:e,isGCS:r,resolution:o,bandIds:c}=t,{rendererJSON:i}=this;return i.type==="rasterStretch"?this._generateStretchWebGLParams(e,i,c):i.type==="rasterShadedRelief"?this._generateShadedReliefWebGLParams(i,r,o??void 0):i.type==="vectorField"?this._generateVectorFieldWebGLParams(i):null}_isLUTChanged(t){if(!this.lookup||!this.lookup.rendererJSON)return!0;if("colorRamp"in this.rendererJSON){const e=this.rendererJSON.colorRamp;return t?JSON.stringify(e)!==JSON.stringify(this.lookup.rendererJSON.colorRamp):(this.rendererJSON,this.lookup.rendererJSON,JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON))}return JSON.stringify(this.rendererJSON)!==JSON.stringify(this.lookup.rendererJSON)}_symbolizeColormap(t){return this._isLUTChanged()&&!this.bind().success?t:re(t,this.lookup.colormapLut)}_symbolizeClassBreaks(t){const{canUseIndexedLUT:e}=this._analyzeClassBreaks(this.rendererJSON);return this._isLUTChanged()&&!this.bind().success?t:e?re(t,this.lookup.colormapLut):Qr(t,this.lookup.remapLut??[])}_symbolizeStretch(t,e){var h,p;const{rasterInfo:r}=this,{pixelType:o,bandCount:c}=r,i=this.rendererJSON,u=["u8","u16","s8","s16"].includes(o);let n,s;const{dra:l}=i,{gamma:a}=this.lookup;if(i.stretchType==="histogramEqualization"){const f=l?null:(h=this.lookup)==null?void 0:h.histogramLut,m=Ft(i,{rasterInfo:r,pixelBlock:t,bandIds:e,returnHistogramLut:!f}),g=le(t,{...m,gamma:a,isRenderer:!0});s=Ve(g,{lut:l?m.histogramLut:f,offset:0})}else if(u){if(l){const f=Ft(i,{rasterInfo:r,pixelBlock:t,bandIds:e});n=or({pixelType:o,...f,gamma:a,rounding:"floor"})}else if(this._isLUTChanged()){if(!this.bind().success)return t;n=this.lookup?this.lookup.stretchLut:null}else n=this.lookup?this.lookup.stretchLut:null;if(!n)return t;c>1&&e!=null&&e.length===(t==null?void 0:t.pixels.length)&&(n==null?void 0:n.lut.length)===c&&(n={lut:e.map(f=>n.lut[f]),offset:n.offset}),s=Ve(t,n)}else{const f=Ft(i,{rasterInfo:r,pixelBlock:t,bandIds:e});s=le(t,{...f,gamma:a,isRenderer:!0})}if(i.colorRamp){if(this._isLUTChanged(!0)&&!this.bind().success)return t;s=re(s,(p=this.lookup)==null?void 0:p.colormapLut)}return s}_symbolizeShadedRelief(t,e){var n;const r=this.rendererJSON,o={...r,...e},c=hn(t,o);if(!r.colorRamp)return c;let i;if(this._isLUTChanged(!0)){if(!this.bind().success)return c;i=this.lookup?this.lookup.hsvMap:null}else i=this.lookup?this.lookup.hsvMap:null;if(!i)return c;const u=((n=this.rasterInfo.statistics)==null?void 0:n[0])??{min:0,max:8e3};return fn(c,t,i,u),c}_isVectorFieldData(){const{bandCount:t,dataType:e}=this.rasterInfo;return t===2&&(e==="vector-magdir"||e==="vector-uv")}_updateVectorFieldRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; VectorFieldRenderer only supports "vector-magdir" and "vector-uv".`}}_updateFlowRenderer(){return this._isVectorFieldData()?{success:!0}:{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; FlowRenderer only supports "vector-magdir" and "vector-uv".`}}_updateUVRenderer(t){var l;const{bandCount:e,attributeTable:r,pixelType:o}=this.rasterInfo,c=t.field1;if(!c)return{success:!1,error:"Unsupported renderer; missing UniqueValueRenderer.field."};const i=t.defaultSymbol,u=e===1&&["u8","s8"].includes(o);if(!tn(this.rasterInfo,c)&&!u)return{success:!1,error:"Unsupported data; UniqueValueRenderer is only supported on single band data with a valid raster attribute table."};const n=[];if(r!=null){const a=r.fields.find(h=>h.name.toLowerCase()==="value");if(!a)return{success:!1,error:"Unsupported data; the data's raster attribute table does not have a value field."};r.features.forEach(h=>{var m,g;const p=(m=t.uniqueValueInfos)==null?void 0:m.find(v=>String(v.value)===String(h.attributes[c])),f=(g=p==null?void 0:p.symbol)==null?void 0:g.color;f?n.push([h.attributes[a.name]].concat(f)):i&&n.push([h.attributes[a.name]].concat(i.color))})}else{if(c.toLowerCase()!=="value")return{success:!1,error:'Unsupported renderer; UniqueValueRenderer.field must be "Value" when raster attribute table is not availalbe.'};(l=t.uniqueValueInfos)==null||l.forEach(a=>{var p;const h=(p=a==null?void 0:a.symbol)==null?void 0:p.color;h?n.push([parseInt(""+a.value,10)].concat(h)):i&&n.push([parseInt(""+a.value,10)].concat(i==null?void 0:i.color))})}if(n.length===0)return{success:!1,error:"Invalid UniqueValueRenderer. Cannot find matching records in the raster attribute table."};const s=Bt({colormap:n});return this.lookup={rendererJSON:t,colormapLut:s},this.canRenderInWebGL=this._isColormapSupportedByWebGL(s==null?void 0:s.indexedColormap),{success:!0}}_updateColormapRenderer(t){if(!rn(this.rasterInfo))return{success:!1,error:"Unsupported data; the data source does not have a colormap."};const e=t.colormapInfos.map(o=>[o.value].concat(o.color)).sort((o,c)=>o[0]-c[0]);if(!e||e.length===0)return{success:!1,error:"Unsupported renderer; ColormapRenderer must have meaningful colormapInfos."};const r=Bt({colormap:e});return this.lookup={rendererJSON:t,colormapLut:r},this.canRenderInWebGL=this._isColormapSupportedByWebGL(r==null?void 0:r.indexedColormap),{success:!0}}_updateShadedReliefRenderer(t){if(!en(this.rasterInfo))return{success:!1,error:`Unsupported data type "${this.rasterInfo.dataType}"; ShadedReliefRenderer only supports "elevation", or single band float/s16 data.`};if(t.colorRamp){const e=Oe(t.colorRamp,{interpolateAlpha:!0}),r=Bt({colormap:e}),o=[],c=r.indexedColormap;for(let i=0;iu.name.toLowerCase()==="value"):null,c=e!=null?e.fields.find(u=>u.name.toLowerCase()===t.field.toLowerCase()):null,i=o!=null&&c!==null;return{canUseIndexedLUT:["u8","u16","s8","s16"].includes(r)||i,tableValueField:o,tableBreakField:c}}_updateClassBreaksRenderer(t){const{attributeTable:e}=this.rasterInfo,{canUseIndexedLUT:r,tableValueField:o,tableBreakField:c}=this._analyzeClassBreaks(t),i=t.classBreakInfos;if(!(i!=null&&i.length))return{success:!1,error:"Unsupported renderer; missing or invalid ClassBreaksRenderer.classBreakInfos."};const u=i.sort((h,p)=>h.classMaxValue-p.classMaxValue),n=u[u.length-1];let s=t.minValue;if(!r){const h=[];for(let p=0;pw>d);y&&l.push([v].concat(y.symbol.color))}}else{s=Math.floor(t.minValue);for(let h=0;h0&&t[0].min!=null&&t[0].max!=null}_updateStretchRenderer(t){var a,h;let{stretchType:e,dra:r}=t;if(!(e==="none"||(a=t.statistics)!=null&&a.length||this._isValidRasterStatistics(this.rasterInfo.statistics)||r))return{success:!1,error:"Unsupported renderer; StretchRenderer.statistics is required when dynamic range adjustment is not used."};const o=t.histograms||this.rasterInfo.histograms;!this._isHistogramRequired(t.stretchType)||o!=null&&o.length||r||(e="minMax");const{computeGamma:c,useGamma:i,colorRamp:u}=t;let{gamma:n}=t;if(i&&c&&!(n!=null&&n.length)){const p=(h=t.statistics)!=null&&h.length?t.statistics:this.rasterInfo.statistics;n=sn(this.rasterInfo.pixelType,p)}const s=this.rasterInfo.pixelType,l=!r&&["u8","u16","s8","s16"].includes(s);if(e==="histogramEqualization"){const p=o.map(f=>Tr(f));this.lookup={rendererJSON:t,histogramLut:p}}else if(l){const p=Ft(t,{rasterInfo:this.rasterInfo}),f=or({pixelType:s,...p,gamma:i?n:null,rounding:"floor"});this.lookup={rendererJSON:t,stretchLut:f}}if(u&&!this._isStretchColorRampNoop(u)){const p=Oe(u,{interpolateAlpha:!0});this.lookup||(this.lookup={rendererJSON:t}),this.lookup.colormapLut=Bt({colormap:p}),this.lookup.rendererJSON=t}return this.lookup.gamma=i&&(n!=null&&n.length)?n:null,this.canRenderInWebGL=!0,{success:!0}}_isStretchColorRampNoop(t){return t.type==="algorithmic"&&["0,0,0,255","0,0,0"].includes(t.fromColor.join(","))&&["255,255,255,255","255,255,255"].includes(t.toColor.join(","))}_generateStretchWebGLParams(t,e,r){var w;let o=null,c=null;const i=(w=this.lookup)==null?void 0:w.colormapLut;e.colorRamp&&i&&(o=i.indexedColormap,c=i.offset),e.stretchType==="histogramEqualization"&&(e={...e,stretchType:"minMax"});const{gamma:u}=this.lookup,n=!!(e.useGamma&&u&&u.some(C=>C!==1)),{minCutOff:s,maxCutOff:l,outMin:a,outMax:h}=Ft(e,{rasterInfo:this.rasterInfo,pixelBlock:t,bandIds:r});let p=0;t!=null&&(p=t.getPlaneCount(),p===2&&((t=t.clone()).statistics=[t.statistics[0]],t.pixels=[t.pixels[0]]));const{bandCount:f}=this.rasterInfo,m=Math.min(3,(r==null?void 0:r.length)||p||f,f),g=new Float32Array(m),v=o||n?1:255;let d;for(d=0;d1?u[d]>2?y[d]=6.5+(u[d]-2)**2.5:y[d]=6.5+100*(2-u[d])**4:y[d]=1;return{bandCount:m,outMin:a/v,outMax:h/v,minCutOff:s,maxCutOff:l,factor:g,useGamma:n,gamma:n?u:[1,1,1],gammaCorrection:n?y:[1,1,1],colormap:o,colormapOffset:c,stretchType:e.stretchType,type:"stretch"}}_generateShadedReliefWebGLParams(t,e=!1,r={x:0,y:0}){var l,a;let o=null,c=null;const i=(l=this.lookup)==null?void 0:l.colormapLut;t.colorRamp&&i&&(o=i.indexedColormap,c=i.offset);const u={...t,isGCS:e,resolution:r},n=Mr(u),s=(a=this.rasterInfo.statistics)==null?void 0:a[0];return{...n,minValue:(s==null?void 0:s.min)??0,maxValue:(s==null?void 0:s.max)??8e3,hillshadeType:t.hillshadeType==="traditional"?0:1,type:"hillshade",colormap:o,colormapOffset:c}}_generateVectorFieldWebGLParams(t){var d,y,w;const{style:e,inputUnit:r,outputUnit:o,visualVariables:c,symbolTileSize:i,flowRepresentation:u}=t;let n;const s=((d=this.rasterInfo.statistics)==null?void 0:d[0].min)??0,l=((y=this.rasterInfo.statistics)==null?void 0:y[0].max)??50,a=(c==null?void 0:c.find(C=>C.type==="sizeInfo"))??{type:"sizeInfo",field:"Magnitude",maxDataValue:l,maxSize:.8*i,minDataValue:s,minSize:.2*i},h=a.minDataValue??s,p=a.maxDataValue??l,f=a.maxSize!=null&&a.minSize!=null?[a.minSize/i,a.maxSize/i]:[.2,.8];if(e==="wind_speed"){const C=(f[0]+f[1])/2;f[0]=f[1]=C}const m=h!=null&&p!=null?[h,p]:null;if(e==="classified_arrow")if(h!=null&&p!=null&&a!=null){n=[];const C=(a.maxDataValue-a.minDataValue)/5;for(let b=0;b<6;b++)n.push(a.minDataValue+C*b)}else n=[0,1e-6,3.5,7,10.5,14];const g=u==="flow_to"==(e==="ocean_current_kn"||e==="ocean_current_m")?0:Math.PI,v=c==null?void 0:c.find(C=>C.type==="rotationInfo");return{breakValues:n,dataRange:m,inputUnit:r,outputUnit:o,symbolTileSize:i,symbolPercentRange:f,style:e||"single_arrow",rotation:g,rotationType:(w=this.rasterInfo.storageInfo)!=null&&w.tileInfo&&this.rasterInfo.dataType==="vector-uv"?"geographic":(v==null?void 0:v.rotationType)||t.rotationType,type:"vectorField"}}};function nr(t){return Q(t)&&t.validPixelCount!==0}O([N({json:{write:!0}})],Tt.prototype,"rendererJSON",void 0),O([N({type:co,json:{write:!0}})],Tt.prototype,"rasterInfo",void 0),O([N({json:{write:!0}})],Tt.prototype,"lookup",void 0),O([N()],Tt.prototype,"canRenderInWebGL",void 0),Tt=O([Dt("esri.renderers.support.RasterSymbolizer")],Tt);const ei=Tt,Pt=gt.getLogger("esri.views.2d.engine.flow.dataUtils"),pn=10;async function ri(t,e,r,o){const c=performance.now(),i=dn(e,r),u=performance.now(),n=gn(e,i,r.width,r.height),s=performance.now(),l=wn(n,!0),a=performance.now(),h=t==="Streamlines"?Cn(l,pn):bn(l),p=performance.now();return Vr("esri-2d-profiler")&&(Pt.info("I.1","_createFlowFieldFromData (ms)",Math.round(u-c)),Pt.info("I.2","_getStreamlines (ms)",Math.round(s-u)),Pt.info("I.3","createAnimatedLinesData (ms)",Math.round(a-s)),Pt.info("I.4","create{Streamlines|Particles}Mesh (ms)",Math.round(p-a)),Pt.info("I.5","createFlowMesh (ms)",Math.round(p-c)),Pt.info("I.6","Mesh size (bytes)",h.vertexData.buffer.byteLength+h.indexData.buffer.byteLength)),await Promise.resolve(),_r(o),h}function dn(t,e){const r=yn(e.data,e.width,e.height,t.smoothing);return t.interpolate?(o,c)=>{const i=Math.floor(o),u=Math.floor(c);if(i<0||i>=e.width)return[0,0];if(u<0||u>=e.height)return[0,0];const n=o-i,s=c-u,l=i,a=u,h=i{const i=Math.round(o),u=Math.round(c);return i<0||i>=e.width||u<0||u>=e.height?[0,0]:[r[2*(u*e.width+i)],r[2*(u*e.width+i)+1]]}}function mn(t,e,r,o,c,i,u,n,s){const l=[];let a=r,h=o,p=0,[f,m]=e(a,h);f*=t.velocityScale,m*=t.velocityScale;const g=Math.sqrt(f*f+m*m);let v,d;l.push({x:a,y:h,t:p,speed:g});for(let y=0;yt.maxTurnAngle)return l;if(t.collisions){const S=Math.round(a*s),A=Math.round(h*s);if(S<0||S>u-1||A<0||A>n-1)return l;const M=i[A*u+S];if(M!==-1&&M!==c)return l;i[A*u+S]=c}l.push({x:a,y:h,t:p,speed:b}),v=x,d=k}return l}function gn(t,e,r,o){const c=[],i=new sr,u=1/Math.max(t.lineCollisionWidth,1),n=Math.round(r*u),s=Math.round(o*u),l=new Int32Array(n*s);for(let h=0;hh.sort-p.sort);for(const{x:h,y:p}of a)if(i.getFloat()=e)continue;const m=i[f+c];h+=m*t[2*(l*e+(a+f))],p+=m*t[2*(l*e+(a+f))+1]}n[2*(l*e+a)]=h,n[2*(l*e+a)+1]=p}const s=new Float32Array(t.length);for(let l=0;l=r)continue;const m=i[f+c];h+=m*n[2*((a+f)*e+l)],p+=m*n[2*((a+f)*e+l)+1]}s[2*(a*e+l)]=h,s[2*(a*e+l)+1]=p}return s}function wn(t,e){const r=new sr,o=t.reduce((s,l)=>s+l.length,0),c=new Float32Array(4*o),i=new Array(t.length);let u=0,n=0;for(const s of t){const l=u;for(const a of s)c[4*u]=a.x,c[4*u+1]=a.y,c[4*u+2]=a.t,c[4*u+3]=a.speed,u++;i[n++]={startVertex:l,numberOfVertices:s.length,totalTime:s[s.length-1].t,timeSeed:e?r.getFloat():0}}return{lineVertices:c,lineDescriptors:i}}function Cn(t,e){const{lineVertices:o,lineDescriptors:c}=t;let i=0,u=0;for(const f of c)i+=2*f.numberOfVertices,u+=6*(f.numberOfVertices-1);const n=new Float32Array(i*9),s=new Uint32Array(u);let l=0,a=0;function h(){s[a++]=l-2,s[a++]=l,s[a++]=l-1,s[a++]=l,s[a++]=l+1,s[a++]=l-1}function p(f,m,g,v,d,y,w,C){const b=l*9;let x=0;n[b+x++]=f,n[b+x++]=m,n[b+x++]=1,n[b+x++]=g,n[b+x++]=y,n[b+x++]=w,n[b+x++]=v/2,n[b+x++]=d/2,n[b+x++]=C,l++,n[b+x++]=f,n[b+x++]=m,n[b+x++]=-1,n[b+x++]=g,n[b+x++]=y,n[b+x++]=w,n[b+x++]=-v/2,n[b+x++]=-d/2,n[b+x++]=C,l++}for(const f of c){const{totalTime:m,timeSeed:g}=f;let v=null,d=null,y=null,w=null,C=null,b=null;for(let x=0;x0){T=k-v,I=S-d;const E=Math.sqrt(T*T+I*I);if(T/=E,I/=E,x>1){let U=T+C,R=I+b;const B=Math.sqrt(U*U+R*R);U/=B,R/=B;const G=Math.min(1/(U*T+R*I),e);U*=G,R*=G,P=-R,L=U}else P=-I,L=T;P!==null&&L!==null&&(p(v,d,y,P,L,m,g,M),h())}v=k,d=S,y=A,C=T,b=I,w=M}p(v,d,y,-b,C,m,g,w)}return{vertexData:n,indexData:s}}function bn(t){const{lineVertices:c,lineDescriptors:i}=t;let u=0,n=0;for(const E of i){const U=E.numberOfVertices-1;u+=4*U*2,n+=6*U*2}const s=new Float32Array(u*16),l=new Uint32Array(n);let a,h,p,f,m,g,v,d,y,w,C,b,x,k,S=0,A=0;function M(){l[A++]=S-8,l[A++]=S-7,l[A++]=S-6,l[A++]=S-7,l[A++]=S-5,l[A++]=S-6,l[A++]=S-4,l[A++]=S-3,l[A++]=S-2,l[A++]=S-3,l[A++]=S-1,l[A++]=S-2}function T(E,U,R,B,G,D,j,F,V,_,X,tt,wt,Ct){const J=S*16;let q=0;for(const ht of[1,2])for(const dt of[1,2,3,4])s[J+q++]=E,s[J+q++]=U,s[J+q++]=R,s[J+q++]=B,s[J+q++]=j,s[J+q++]=F,s[J+q++]=V,s[J+q++]=_,s[J+q++]=ht,s[J+q++]=dt,s[J+q++]=wt,s[J+q++]=Ct,s[J+q++]=G/2,s[J+q++]=D/2,s[J+q++]=X/2,s[J+q++]=tt/2,S++}function I(E,U){let R=y+C,B=w+b;const G=Math.sqrt(R*R+B*B);R/=G,B/=G;const D=y*R+w*B;R/=D,B/=D;let j=C+x,F=b+k;const V=Math.sqrt(j*j+F*F);j/=V,F/=V;const _=C*j+b*F;j/=_,F/=_,T(a,h,p,f,-B,R,m,g,v,d,-F,j,E,U),M()}function P(E,U,R,B,G,D){if(y=C,w=b,C=x,b=k,y==null&&w==null&&(y=C,w=b),m!=null&&g!=null){x=E-m,k=U-g;const j=Math.sqrt(x*x+k*k);x/=j,k/=j}y!=null&&w!=null&&I(G,D),a=m,h=g,p=v,f=d,m=E,g=U,v=R,d=B}function L(E,U){y=C,w=b,C=x,b=k,y==null&&w==null&&(y=C,w=b),y!=null&&w!=null&&I(E,U)}for(const E of i){a=null,h=null,p=null,f=null,m=null,g=null,v=null,d=null,y=null,w=null,C=null,b=null,x=null,k=null;const{totalTime:U,timeSeed:R}=E;for(let B=0;B __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/definitions-DqQMJYPH.js b/dist/assets/definitions-SVBNHUSH.js similarity index 71% rename from dist/assets/definitions-DqQMJYPH.js rename to dist/assets/definitions-SVBNHUSH.js index 8078fe6..c14dc67 100644 --- a/dist/assets/definitions-DqQMJYPH.js +++ b/dist/assets/definitions-SVBNHUSH.js @@ -1 +1 @@ -import{dJ as a}from"./index-J0iiHjMT.js";const r=1e-30,t=4294967295,o=512,c=128,d=511,f=29,m=24,n=8,p=1,x=2,h=3,i=2,k=1,l=1.05;a("featurelayer-force-marker-text-draw-order");const u=5,w=6,y=1.15,e=2,b=128-2*e,g=8,j=500,v=10,q=1024,z=2,A=0,B=1,C=4,J=8,Q=16,R=4,S=1,V=4,W=8,$=32,D=64;export{l as $,$ as A,D as B,q as C,p as Q,x as R,h as S,i as V,k as W,r as a,m as b,o as c,g as d,u as e,j as f,e as g,b as h,C as i,t as j,S as k,A as l,v as m,B as n,R as o,z as p,n as q,w as r,Q as s,y as t,V as u,W as v,f as w,J as x,d as y,c as z}; +import{dE as a}from"./index-pCX-0tJH.js";const r=1e-30,t=4294967295,o=512,c=128,d=511,f=29,m=24,n=8,p=1,x=2,h=3,i=2,k=1,l=1.05;a("featurelayer-force-marker-text-draw-order");const u=5,w=6,y=1.15,e=2,b=128-2*e,g=8,j=500,v=10,q=1024,z=2,A=0,B=1,C=4,E=8,Q=16,R=4,S=1,V=4,W=8,$=32,D=64;export{l as $,$ as A,D as B,q as C,p as Q,x as R,h as S,i as V,k as W,r as a,m as b,o as c,g as d,u as e,j as f,e as g,b as h,C as i,t as j,S as k,A as l,v as m,B as n,R as o,z as p,n as q,w as r,Q as s,y as t,V as u,W as v,f as w,E as x,d as y,c as z}; diff --git a/dist/assets/dehydratedFeatureComparison-hdPq-zad.js b/dist/assets/dehydratedFeatureComparison-IJSogXWn.js similarity index 96% rename from dist/assets/dehydratedFeatureComparison-hdPq-zad.js rename to dist/assets/dehydratedFeatureComparison-IJSogXWn.js index 2b394ff..71e082e 100644 --- a/dist/assets/dehydratedFeatureComparison-hdPq-zad.js +++ b/dist/assets/dehydratedFeatureComparison-IJSogXWn.js @@ -1 +1 @@ -import{al as u}from"./index-J0iiHjMT.js";function l(e,r){if(e===r)return!0;if(e==null||r==null||e.length!==r.length)return!1;for(let t=0;te)}function Z(n){return C(n,e=>e.plane)}function C(n,e){const t=i(),a=i();let l=!1;return r=>{const o=e(r);if(r.action==="start"){const c=m(r.screenStart,$(x.get())),u=R(n.state.camera,c,T);u!=null&&(l=g(o,u,t))}if(!l)return null;const s=m(r.screenEnd,$(x.get())),d=R(n.state.camera,s,T);return d==null?null:g(o,d,a)?{...r,renderStart:t,renderEnd:a,plane:o,ray:d}:null}}function _(n,e,t=0,a=null,l=null){let r=null;return o=>{if(o.action==="start"&&(r=n.sceneIntersectionHelper.intersectElevationFromScreen(E(o.screenStart.x,o.screenStart.y),e,t,l),r!=null&&a!=null&&!I(r,r,a))||r==null)return null;const s=n.sceneIntersectionHelper.intersectElevationFromScreen(E(o.screenEnd.x,o.screenEnd.y),e,t,l);return s!=null&&(a==null||I(s,s,a))?{...o,mapStart:r,mapEnd:s}:null}}function z(n,e,t,a=null,l=null){return _(n,t,N(e,n,t),a,l)}function J(n,e,t,a=null,l=null){return z(n,t,b(e),a,l)}function j(n,e,t,a){const l=e.toMap(n.screenStart,{include:[t]});return l!=null?J(e,t,l,a):null}function K(n,e){const t=V,a=W,l=w();n.renderCoordsHelper.worldUpAtPosition(e,t);const r=U(l,t,S(a,e,n.state.camera.eye));return U(r,r,t),D(e,r,l)}function nn(n,e,t){let a=null;const l=new q;return l.next(B(n,K(n,e))).next(L(n,e)).next(Q(n,t)).next(r=>{r.mapEnd.x=r.mapStart.x,r.mapEnd.y=r.mapStart.y,a=r}),r=>(a=null,l.execute(r),a)}function L(n,e){const t=i(),a=y(e);n.renderCoordsHelper.worldUpAtPosition(e,t);const l=i(),r=i(),o=s=>(S(s,s,e),G(t,s,s),n.viewingMode==="global"&&y(s)*Math.sign(P(t,s))<.001-a&&S(s,v(s,t,.001),e),A(s,s,e),s);return s=>(s.renderStart=o(H(l,s.renderStart)),s.renderEnd=o(H(r,s.renderEnd)),s)}function Q(n,e){const t=n.renderCoordsHelper;return a=>{const l=t.fromRenderCoords(a.renderStart,e),r=t.fromRenderCoords(a.renderEnd,e);return l!=null&&r!=null?{...a,mapStart:l,mapEnd:r}:null}}var f;function en(n){let e=null;return t=>{switch(t.action){case"start":e=n.disableDisplay();break;case"end":case"cancel":e!=null&&(e.remove(),e=null)}return t}}function tn(n,e=null){const t=h(n.state.viewingMode);t.options.selectionMode=!0,t.options.store=k.MIN,t.options.hud=!1;const a=E(),l={requiresGroundFeedback:!0,enableDraped:!0,exclude:new Set},r=i(),o=e??n.spatialReference,s=c=>{n.map.ground&&n.map.ground.opacity<1?l.exclude.add(O):l.exclude.delete(O),n.sceneIntersectionHelper.intersectIntersectorScreen(m(c,a),t,l);const u=t.results.min;let p;if(u.getIntersectionPoint(r))p=u.intersector===F.TERRAIN?f.GROUND:f.OTHER;else{if(!t.results.ground.getIntersectionPoint(r))return null;p=f.GROUND}return{location:n.renderCoordsHelper.fromRenderCoords(r,o),surfaceType:p}};let d;return c=>{if(c.action==="start"){const p=s(c.screenStart);d=p!=null?p.location:null}if(d==null)return null;const u=s(c.screenEnd);return(u==null?void 0:u.location)!=null?{...c,mapStart:d,mapEnd:u.location,surfaceType:u.surfaceType}:null}}(function(n){n[n.GROUND=0]="GROUND",n[n.OTHER=1]="OTHER"})(f||(f={}));const V=i(),W=i(),T=M();export{en as A,J as D,tn as F,f as G,B as H,j as M,nn as P,z as T,Z as U,Q as k}; diff --git a/dist/assets/dragEventPipeline3D-H_IlIVP7.js b/dist/assets/dragEventPipeline3D-H_IlIVP7.js new file mode 100644 index 0000000..58608a7 --- /dev/null +++ b/dist/assets/dragEventPipeline3D-H_IlIVP7.js @@ -0,0 +1 @@ +import{b0 as T,bY as m,bZ as b,b_ as $,b$ as g,c0 as x,a8 as i,c1 as w,bl as D,c2 as R,b3 as y,c3 as E,c4 as H,c5 as M,c6 as I,b4 as S,c7 as N,c8 as v,c9 as G,ca as P,bO as A,cb as h,cc as k,cd as O,ce as F}from"./index-pCX-0tJH.js";import{U as q}from"./InteractiveToolBase-6mltmL27.js";function B(n,e){return C(n,()=>e)}function W(n){return C(n,e=>e.plane)}function C(n,e){const t=i(),l=i();let s=!1;return r=>{const o=e(r);if(r.action==="start"){const c=m(r.screenStart,b($.get())),u=g(n.state.camera,c,U);u!=null&&(s=x(o,u,t))}if(!s)return null;const a=m(r.screenEnd,b($.get())),d=g(n.state.camera,a,U);return d==null?null:x(o,d,l)?{...r,renderStart:t,renderEnd:l,plane:o,ray:d}:null}}function _(n,e,t=0,l=null,s=null){let r=null;return o=>{if(o.action==="start"&&(r=n.sceneIntersectionHelper.intersectElevationFromScreen(E(o.screenStart.x,o.screenStart.y),e,t,s),r!=null&&l!=null&&!H(r,r,l))||r==null)return null;const a=n.sceneIntersectionHelper.intersectElevationFromScreen(E(o.screenEnd.x,o.screenEnd.y),e,t,s);return a!=null&&(l==null||H(a,a,l))?{...o,mapStart:r,mapEnd:a}:null}}function z(n,e,t,l=null,s=null){return _(n,t,w(e,n,t),l,s)}function Y(n,e,t,l=null,s=null){return z(n,t,D(e),l,s)}function X(n,e,t,l){const s=e.toMap(n.screenStart,{include:[t]});return s!=null?Y(e,t,s,l):null}function Z(n,e){const t=K,l=L,s=M();n.renderCoordsHelper.worldUpAtPosition(e,t);const r=I(s,t,S(l,e,n.state.camera.eye));return I(r,r,t),N(e,r,s)}function nn(n,e,t){let l=null;const s=new q;return s.next(B(n,Z(n,e))).next(j(n,e)).next(J(n,t)).next(r=>{r.mapEnd.x=r.mapStart.x,r.mapEnd.y=r.mapStart.y,l=r}),r=>(l=null,s.execute(r),l)}function j(n,e){const t=i(),l=R(e);n.renderCoordsHelper.worldUpAtPosition(e,t);const s=i(),r=i(),o=a=>(S(a,a,e),v(t,a,a),n.viewingMode==="global"&&R(a)*Math.sign(G(t,a))<.001-l&&S(a,P(a,t,.001),e),A(a,a,e),a);return a=>(a.renderStart=o(y(s,a.renderStart)),a.renderEnd=o(y(r,a.renderEnd)),a)}function J(n,e){const t=n.renderCoordsHelper;return l=>{const s=t.fromRenderCoords(l.renderStart,e),r=t.fromRenderCoords(l.renderEnd,e);return s!=null&&r!=null?{...l,mapStart:s,mapEnd:r}:null}}var f;function en(n){let e=null;return t=>{switch(t.action){case"start":e=n.disableDisplay();break;case"end":case"cancel":e!=null&&(e.remove(),e=null)}return t}}function tn(n,e=null){const t=h(n.state.viewingMode);t.options.selectionMode=!0,t.options.store=k.MIN,t.options.hud=!1;const l=E(),s={requiresGroundFeedback:!0,enableDraped:!0,exclude:new Set},r=i(),o=e??n.spatialReference,a=c=>{n.map.ground&&n.map.ground.opacity<1?s.exclude.add(O):s.exclude.delete(O),n.sceneIntersectionHelper.intersectIntersectorScreen(m(c,l),t,s);const u=t.results.min;let p;if(u.getIntersectionPoint(r))p=u.intersector===F.TERRAIN?f.GROUND:f.OTHER;else{if(!t.results.ground.getIntersectionPoint(r))return null;p=f.GROUND}return{location:n.renderCoordsHelper.fromRenderCoords(r,o),surfaceType:p}};let d;return c=>{if(c.action==="start"){const p=a(c.screenStart);d=p!=null?p.location:null}if(d==null)return null;const u=a(c.screenEnd);return(u==null?void 0:u.location)!=null?{...c,mapStart:d,mapEnd:u.location,surfaceType:u.surfaceType}:null}}(function(n){n[n.GROUND=0]="GROUND",n[n.OTHER=1]="OTHER"})(f||(f={}));const K=i(),L=i(),U=T();export{en as A,Y as D,tn as F,f as G,B as H,X as M,nn as P,z as T,W as U,J as k}; diff --git a/dist/assets/drapedUtils-9db1OpTX.js b/dist/assets/drapedUtils-F1ywqHD-.js similarity index 96% rename from dist/assets/drapedUtils-9db1OpTX.js rename to dist/assets/drapedUtils-F1ywqHD-.js index cac67ee..62041cb 100644 --- a/dist/assets/drapedUtils-9db1OpTX.js +++ b/dist/assets/drapedUtils-F1ywqHD-.js @@ -1 +1 @@ -import{dT as m,e2 as c}from"./index-J0iiHjMT.js";function u(e,n){return n?"xoffset"in n&&n.xoffset?Math.max(e,Math.abs(n.xoffset)):"yoffset"in n&&n.yoffset?Math.max(e,Math.abs(n.yoffset||0)):e:e}function h(e){let n=0,t=0;for(let r=0;ro.type==="size").map(o=>{const{maxSize:a,minSize:f}=o;return(p(a,e)+p(f,e))/2});let r=0;const s=t.length;if(s===0)return e;for(let o=0;o{a=u(a,f.symbol)}),a}if(n.type==="class-breaks"){let a=s;return n.classBreakInfos.forEach(f=>{a=u(a,f.symbol)}),a}return n.type==="dot-density"||n.type,s}function d(e,n,t,r=new m){let s=0;if(t.type==="2d")s=n*(t.resolution??0);else if(t.type==="3d"){const x=t.overlayPixelSizeInMapUnits(e),l=t.basemapSpatialReference;s=l==null||l.equals(t.spatialReference)?n*x:c(l)/c(t.spatialReference)}const i=e.x-s,o=e.y-s,a=e.x+s,f=e.y+s,{spatialReference:y}=t;return r.xmin=Math.min(i,a),r.ymin=Math.min(o,f),r.xmax=Math.max(i,a),r.ymax=Math.max(o,f),r.spatialReference=y,r}function R(e,n,t){const r=t.toMap(e);return r==null?!1:d(r,b(),t,z).intersects(n)}const z=new m;export{R as i,b as o,d as r}; +import{dO as m,dX as c}from"./index-pCX-0tJH.js";function u(e,n){return n?"xoffset"in n&&n.xoffset?Math.max(e,Math.abs(n.xoffset)):"yoffset"in n&&n.yoffset?Math.max(e,Math.abs(n.yoffset||0)):e:e}function h(e){let n=0,t=0;for(let r=0;ro.type==="size").map(o=>{const{maxSize:a,minSize:f}=o;return(p(a,e)+p(f,e))/2});let r=0;const s=t.length;if(s===0)return e;for(let o=0;o{a=u(a,f.symbol)}),a}if(n.type==="class-breaks"){let a=s;return n.classBreakInfos.forEach(f=>{a=u(a,f.symbol)}),a}return n.type==="dot-density"||n.type,s}function d(e,n,t,r=new m){let s=0;if(t.type==="2d")s=n*(t.resolution??0);else if(t.type==="3d"){const x=t.overlayPixelSizeInMapUnits(e),l=t.basemapSpatialReference;s=l==null||l.equals(t.spatialReference)?n*x:c(l)/c(t.spatialReference)}const i=e.x-s,o=e.y-s,a=e.x+s,f=e.y+s,{spatialReference:y}=t;return r.xmin=Math.min(i,a),r.ymin=Math.min(o,f),r.xmax=Math.max(i,a),r.ymax=Math.max(o,f),r.spatialReference=y,r}function R(e,n,t){const r=t.toMap(e);return r==null?!1:d(r,b(),t,z).intersects(n)}const z=new m;export{R as i,b as o,d as r}; diff --git a/dist/assets/drawSurfaces-t1mGEx1r.js b/dist/assets/drawSurfaces-t1mGEx1r.js new file mode 100644 index 0000000..03cedd3 --- /dev/null +++ b/dist/assets/drawSurfaces-t1mGEx1r.js @@ -0,0 +1 @@ +import{L as m,nt as T,nu as z,nv as G,a8 as d,go as b,nw as _,ca as L,c9 as A,b4 as U,bL as B,c6 as q,nx as Q,ny as Y,gn as V,dY as j,z as D,g as X,h as J,nz as H,A as $,nA as K,F as N,B as g,nB as ee,b as x,nC as te,hM as ie,ah as ne,Q as se,br as M,e as a,nD as re,T as C,y as p,c as oe,aF as ae,c3 as O,bU as E,nE as F,bp as R,c1 as pe}from"./index-pCX-0tJH.js";import{r as I}from"./dehydratedFeatureComparison-IJSogXWn.js";import{w as le,V as he,p as ce,l as de}from"./EditGeometryOperations-vpHcsZOg.js";import{d as w,C as ue}from"./InteractiveToolBase-6mltmL27.js";import{e as P}from"./SnappingContext-ax0tf6c6.js";import{f as ge}from"./SnappingDragPipelineStep-HDAWWRgo.js";import{p as me}from"./SnappingOperation-hED0OM8D.js";function v(t,e,i=null){return i!=null?[t,e,i]:[t,e]}function Z(t,e,i=null){return i!=null?{x:t,y:e,z:i}:{x:t,y:e}}class W{constructor(e){this.spatialReference=e}mapToLocalMultiple(e){return e.map(i=>this.mapToLocal(i)).filter(j)}get doUnnormalization(){return!1}}class ve extends W{constructor(e,i,n=null){super(i),this._defaultZ=n,this.transform=T(),this.transformInv=T(),this.transform=z(e),G(this.transformInv,this.transform)}makeMapPoint(e,i){return v(e,i,this._defaultZ)}mapToLocal(e){return Z(this.transform[0]*e[0]+this.transform[2]*e[1]+this.transform[4],this.transform[1]*e[0]+this.transform[3]*e[1]+this.transform[5])}localToMap(e){return v(this.transformInv[0]*e.x+this.transformInv[2]*e.y+this.transformInv[4],this.transformInv[1]*e.x+this.transformInv[3]*e.y+this.transformInv[5],this._defaultZ)}}class ye extends W{constructor(e,i){super(e.spatialReference),this.view=e,this.defaultZ=null,this.pWS=d(),this.tangentFrameUpWS=d(),this.tangentFrameRightWS=d(),this.tangentFrameForwardWS=d(),this.localFrameRightWS=d(),this.localFrameUpWS=d(),this.worldToLocalTransform=b(),this.localToWorldTransform=b(),this.scale=1,this.scale=e.resolution,this.referenceMapPoint=i,this.defaultZ=i.hasZ?i.z:null;const n=e.state.camera.viewRight;this.view.renderCoordsHelper.toRenderCoords(this.referenceMapPoint,this.pWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,_.X,this.tangentFrameRightWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,_.Y,this.tangentFrameUpWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,_.Z,this.tangentFrameForwardWS);const l=d();L(l,this.tangentFrameForwardWS,A(n,this.tangentFrameForwardWS)),U(this.localFrameRightWS,n,l),B(this.localFrameRightWS,this.localFrameRightWS),q(this.localFrameUpWS,this.tangentFrameForwardWS,this.localFrameRightWS),Q(this.worldToLocalTransform,this.localFrameRightWS,this.tangentFrameRightWS),Y(this.localToWorldTransform,this.worldToLocalTransform)}get doUnnormalization(){return this.view.viewingMode==="global"}makeMapPoint(e,i){return v(e,i,this.defaultZ)}mapToLocal(e){const i=d();this.view.renderCoordsHelper.toRenderCoords(new m({x:e[0],y:e[1],spatialReference:this.spatialReference}),i),V(i,i,this.worldToLocalTransform);const n=this.view.renderCoordsHelper.fromRenderCoords(i,this.view.spatialReference);return n!=null?Z(n.x/this.scale,n.y/this.scale):null}localToMap(e){const i=d();this.view.renderCoordsHelper.toRenderCoords(new m({x:e.x*this.scale,y:e.y*this.scale,spatialReference:this.spatialReference}),i),V(i,i,this.localToWorldTransform);const n=this.view.renderCoordsHelper.fromRenderCoords(i,this.view.spatialReference);return n!=null?v(n.x,n.y,this.defaultZ):null}}function Ie(t,e){if(t.type==="2d")return new ve(t.state.transform,t.spatialReference,e.length>2?e[2]:null);if(t.type==="3d"){const i=e.length>2?new m({x:e[0],y:e[1],z:e[2],spatialReference:t.spatialReference}):new m({x:e[0],y:e[1],spatialReference:t.spatialReference});return new ye(t,i)}return null}const Pe=["freehand","hybrid","click"],k="click";class fe{constructor({grabbableForEvent:e}){this.events=new D,this.interactive=!0,this.selectable=!1,this.cursor=null,this.grabbable=!0,this.consumesClicks=!0,this.grabbableForEvent=e}destroy(){}intersectionDistance(e,i){return 0}attach(){}detach(){}onElevationChange(){}onViewChange(){}}const _e="crosshair",xe="progress";let o=class extends D.EventedMixin(X){constructor(t){super(t),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new Set,this._stagedScreenPoint=null,this._stagedPointerType=null,this._stagedPointerId=null,this._updatingHandles=new J,this.constraint=void 0,this.isDraped=!0,this.labelOptions=new H,this.tooltipOptions=new $,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.lastVertex=null,t.elevationInfo==null&&(this.elevationInfo=K(!!t.hasZ))}initialize(){const{geometryType:t,view:e}=this,i=e.spatialReference,n="viewingMode"in e.state?e.state.viewingMode:N.Local,l=t==="segment"||t==="multipoint"?"polyline":t;this.coordinateHelper=le(this.hasZ,this.hasM,i),this._editGeometryOperations=new he(new ce(l,this.coordinateHelper)),this._snappingOperation=new me({view:e,constrainResult:s=>{var r;return s?(r=this._getEffectiveDrawSurface())==null?void 0:r.constrainZ(s):void 0}}),this.addHandles([g(()=>this.stagedVertex,s=>{s!=null&&this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activeComponent.vertices.length,coordinates:this.coordinateHelper.pointToArray(s)}],operation:"apply",type:"vertex-update"})},{sync:!0,equals:(s,r)=>re(s,r,I)}),g(()=>this.view.viewpoint,(s,r)=>{s&&r&&ae(s,r)&&this._onViewpointChange()})]),this._activeComponent=new de(i,n),this._editGeometryOperations.data.components.push(this._activeComponent);const h=this.segmentLabels;h!=null&&(h.context={view:e,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.addHandles([g(()=>this.labelOptions.enabled,s=>{h.visible=s},C),this.on("cursor-update",()=>{const s=this.stagedVertex;h.stagedVertex=s!=null?this.coordinateHelper.pointToVector(s):null})])),this.addHandles(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],s=>{const r=s.vertices.map(u=>({componentIndex:0,vertexIndex:u.index,coordinates:this.coordinateHelper.vectorToArray(u.pos)})),y=r.map(u=>u.coordinates);switch(s.type){case"vertex-add":this.emit(s.type,{...s,added:y,vertices:r});break;case"vertex-update":this.emit(s.type,{...s,updated:y,vertices:r});break;case"vertex-remove":this.emit(s.type,{...s,removed:y,vertices:r})}const S=this._activeComponent.getLastVertex(),f=S!=null?this.coordinateHelper.vectorToDehydratedPoint(S.pos):null;f!=null&&this.lastVertex!=null&&I(this.lastVertex,f)||(this.lastVertex=f)}));const c=this._manipulator=new fe({grabbableForEvent:s=>this.drawingMode!=="click"||s.pointerType==="touch"&&this._snappingEnabled&&this._pointerDownStates.size===1});this.manipulators.add(c),c.grabbable=t!=="point",this.addHandles([this._createManipulatorDragPipeline(c),c.events.on("immediate-click",s=>this._onImmediateClick(s)),c.events.on("immediate-double-click",s=>this._onImmediateDoubleClick(s)),g(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:s})=>{c.cursor=s},C)]),ee(this,()=>{const s=this.view.inputManager.latestPointerType??"mouse",r=this._getSnappingContext(s);this.snappingManager!=null&&this._updatingHandles.addPromise(M(this._snappingOperation.resnap(this.snappingManager,r)))})}destroy(){x(this.segmentLabels),x(this._snappingOperation),this._editGeometryOperations=x(this._editGeometryOperations),this._updatingHandles.destroy()}get _snappingEnabled(){return this.snappingManager!=null&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const t=this._getEffectiveDrawSurface();return this.view.type==="3d"&&this.drawSurface!==t}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activeComponent.vertices.map(t=>this.coordinateHelper.vectorToArray(t.pos))}set drawingMode(t){this._set("drawingMode",t??k)}get effectiveCursor(){return this.loading?xe:this._hideDefaultCursor?null:this.cursor||_e}get interactive(){return this._manipulator.interactive}set interactive(t){this._manipulator.interactive=t}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activeComponent.vertices.length}get numVertices(){return this.stagedVertex!=null?this._activeComponent.vertices.length+1:this._activeComponent.vertices.length}get snappingOptions(){return this.snappingManager!=null?this.snappingManager.options:null}get stagedVertex(){const t=this._snappingOperation.stagedPoint,{constraint:e,elevationInfo:i,view:n}=this;if(!t||!e)return t;const l=te(t,n,i),h=l?e.closestTo(l):void 0;return h?ie(h,t.spatialReference):t}set stagedVertex(t){this._snappingOperation.stagedPoint=ne(t)}get updating(){return this._updatingHandles.updating}get vertices(){const t=this.committedVertices;return this.stagedVertex!=null&&t.push(this.coordinateHelper.pointToArray(this.stagedVertex)),t}cancel(){this.complete({aborted:!0})}commitStagedVertex(){if(this._snappingOperation.abort(),this.stagedVertex!=null){const{stagedVertex:t}=this;this.stagedVertex=null,this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(t))}}complete(t){const e=t&&t.aborted||!1;this._snappingOperation.abort(),this.snappingManager!=null&&this.snappingManager.doneSnapping(),this.geometryType==="segment"||this.geometryType==="point"?this.commitStagedVertex():this.stagedVertex=null;const i=this.geometryType==="multipoint"&&this.numVertices===0||this.geometryType==="polyline"&&this.numVertices<2||this.geometryType==="polygon"&&this.numVertices<3;this._createOperationCompleted=!i,(this.isCompleted||e)&&this.emit("complete",{vertices:this.vertices.map((n,l)=>({componentIndex:0,vertexIndex:l,coordinates:n})),aborted:e,type:"complete"})}onInputEvent(t){switch(t.type){case"pointer-down":this._pointerDownStates.add(t.pointerId);break;case"pointer-up":this._pointerDownStates.delete(t.pointerId)}switch(t.type){case"pointer-move":return this._onPointerMove(t);case"hold":return this._onHold(t)}}redo(){this._editGeometryOperations.redo()}undo(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_closeOnClickVertexIndex(t){const e=this._activeComponent;if(this.geometryType==="polygon"&&e.vertices.length>2){if(this._vertexWithinPointerDistance(e.vertices[0].pos,t))return 0;if(this._vertexWithinPointerDistance(e.vertices[e.vertices.length-1].pos,t))return e.vertices.length-1}return null}_createManipulatorDragPipeline(t){switch(this.drawingMode){case"click":return this._createManipulatorDragPipelineClick(t);case"freehand":return this._createManipulatorDragPipelineFreehand(t);case"hybrid":return this._createManipulatorDragPipelineHybrid(t)}}_createManipulatorDragPipelineClick(t){return w(t,(e,i,n,l)=>{const h=l==="touch"&&this._snappingEnabled;if(this.isCompleted||!h)return;const{snappingStep:c,cancelSnapping:s}=ge({predicate:()=>h,snappingManager:this.snappingManager,snappingContext:new P({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:l,visualizer:this.snappingVisualizer}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});n=n.next(r=>(h&&this.snappingManager!=null&&this.snappingManager.doneSnapping(),r)).next(s),i.next(this._screenToMapDragEventStep()).next(r=>(r.action==="start"&&(this.stagedVertex=r.mapStart,(this.geometryType==="segment"||h&&this.numVertices===0)&&this.commitStagedVertex()),r)).next(ue(this.view,this.elevationInfo)).next(...c).next(r=>(h&&(this.stagedVertex=r.mapEnd,r.action==="end"&&this.commitStagedVertex()),r)).next(r=>(r.action==="end"&&(this.geometryType!=="segment"&&this.geometryType!=="point"||this.complete()),r))})}_createManipulatorDragPipelineFreehand(t){return w(t,(e,i)=>{this.isCompleted||i.next(this._screenToMapDragEventStep()).next(n=>(n.action==="start"&&(this.stagedVertex==null&&(this.stagedVertex=n.mapStart),this.geometryType==="segment"&&this.commitStagedVertex()),n)).next(n=>{switch(n.action){case"start":case"update":this.stagedVertex=n.mapEnd,this.geometryType!=="polygon"&&this.geometryType!=="polyline"||this.commitStagedVertex();break;case"end":this.complete()}return n})})}_createManipulatorDragPipelineHybrid(t){return w(t,(e,i)=>{this.isCompleted||i.next(this._screenToMapDragEventStep()).next(n=>(n.action==="start"&&(this.stagedVertex==null&&(this.stagedVertex=n.mapStart),this.commitStagedVertex()),n)).next(n=>{switch(n.action){case"start":case"update":this.stagedVertex=n.mapEnd,this.geometryType!=="polygon"&&this.geometryType!=="polyline"||this.commitStagedVertex();break;case"end":this.geometryType!=="segment"&&this.geometryType!=="point"||this.complete()}return n})})}get _drawAtFixedElevation(){return(this.geometryType==="segment"||this.geometryType==="polygon")&&this.numCommittedVertices>0}_getEffectiveDrawSurface(){if(this.elevationDrawSurface==null)return this.drawSurface;if(!this.coordinateHelper.hasZ())return this.elevationDrawSurface.defaultZ=null,this.elevationDrawSurface;let t=this.defaultZ,e=!1;return this.elevationInfo!=null&&this.elevationInfo.mode==="absolute-height"&&(e=!0),this.snapToSceneEnabled!=null&&(e=this.snapToSceneEnabled),this.elevationInfo!=null&&this.elevationInfo.mode==="on-the-ground"&&(e=!1),this._drawAtFixedElevation&&(t=this.coordinateHelper.getZ(this._activeComponent.vertices[0].pos),e=!1),e?this.drawSurface:(this.elevationDrawSurface.defaultZ=t,this.elevationDrawSurface)}_mapToScreen(t){var e;return(e=this._getEffectiveDrawSurface())==null?void 0:e.mapToScreen(t)}_onHold(t){this._snappingOperation.abort(),this.drawingMode==="click"&&t.pointerType==="touch"&&this._snappingEnabled&&(this.stagedVertex=t.mapPoint),t.stopPropagation()}_onImmediateClick(t){if(t.pointerType==="mouse"&&t.button===2||this._manipulator.dragging)return;const e=this._activeComponent;if(this._closeOnClickVertexIndex(t.screenPoint)!=null)return t.stopPropagation(),void this.complete();const i=this._screenToMap(t.screenPoint);if(i!=null)switch(this.drawingMode){case"freehand":this.geometryType==="point"&&(this.stagedVertex!=null?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),this.complete());break;case"click":case"hybrid":this._snappingOperation.abort(),this.stagedVertex!=null?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),(this.geometryType==="point"||this.geometryType==="segment"&&e.vertices.length===2||this.geometryType==="segment"&&this.drawingMode==="hybrid"&&e.vertices.length===1)&&this.complete()}t.stopPropagation()}_onImmediateDoubleClick(t){this._manipulator.dragging||this.geometryType==="point"||(this.complete(),t.stopPropagation())}_onPointerMove(t){const e=se(t.x,t.y);this._stagedScreenPoint=e,this._stagedPointerType=t.pointerType,this._stagedPointerId=t.pointerId;const i=this._snappingOperation,n=this._manipulator;this._pointerDownStates.has(t.pointerId)||n.grabbing||!n.interactive?i.abort():(t.stopPropagation(),this._updateStagedVertexOnPointerMove(e,t.pointerType))}_onViewpointChange(){const t=this._manipulator;this._stagedPointerType==="mouse"&&this._stagedScreenPoint&&this._stagedPointerId!=null&&!this._pointerDownStates.has(this._stagedPointerId)&&!t.grabbing&&t.interactive?this._updateStagedVertexOnPointerMove(this._stagedScreenPoint,this._stagedPointerType??"mouse"):this._snappingOperation.abort()}_updateStagedVertexOnPointerMove(t,e){var r;const i=this._snappingOperation,n=this._closeOnClickVertexIndex(t);if(n!=null)return this._closeOnVertex(n),void i.abort();const l=this._screenToMap(t),h=this._requiresScenePoint?(r=this.drawSurface)==null?void 0:r.screenToMap(t):null;if(l==null)return this._hideDefaultCursor=!0,void i.abort();this._hideDefaultCursor=!1;const c=this.snappingManager;if(c==null)return this.stagedVertex=l,void i.abort();const s=this._getSnappingContext(e);this._updatingHandles.addPromise(M(i.snap({point:l,scenePoint:h},c,s)))}_closeOnVertex(t){this.stagedVertex=null;const e={componentIndex:0,vertexIndex:t,coordinates:this.coordinateHelper.vectorToArray(this._activeComponent.vertices[t].pos)};this.emit("cursor-update",{updated:null,vertices:[e],operation:"apply",type:"vertex-update"})}_screenToMap(t){var e;return(e=this._getEffectiveDrawSurface())==null?void 0:e.screenToMap(t)}_screenToMapDragEventStep(){let t=null;return e=>{if(e.action==="start"&&(t=this._screenToMap(e.screenStart)),t==null)return null;const i=this._screenToMap(e.screenEnd);return i!=null?{...e,mapStart:t,mapEnd:i}:null}}_vertexWithinPointerDistance(t,e){const n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(t));return n!=null&&we(n,e,25)}_getSnappingContext(t){var i;const e=this._drawAtFixedElevation?(i=this.elevationDrawSurface)==null?void 0:i.defaultZ:null;return new P({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:t,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:e!=null?{value:e,elevationInfo:this.elevationInfo}:null})}};function we(t,e,i){const n=t.x-e.x,l=t.y-e.y;return n*n+l*l<=i}a([p()],o.prototype,"_hideDefaultCursor",void 0),a([p()],o.prototype,"_snappingOperation",void 0),a([p()],o.prototype,"_snappingEnabled",null),a([p({constructOnly:!0})],o.prototype,"graphic",void 0),a([p()],o.prototype,"constraint",void 0),a([p()],o.prototype,"defaultZ",void 0),a([p()],o.prototype,"isDraped",void 0),a([p({value:k})],o.prototype,"drawingMode",null),a([p({constructOnly:!0})],o.prototype,"elevationDrawSurface",void 0),a([p({constructOnly:!0})],o.prototype,"elevationInfo",void 0),a([p({constructOnly:!0,type:H})],o.prototype,"labelOptions",void 0),a([p({constructOnly:!0,type:$})],o.prototype,"tooltipOptions",void 0),a([p({constructOnly:!0})],o.prototype,"geometryType",void 0),a([p({constructOnly:!0})],o.prototype,"hasM",void 0),a([p({constructOnly:!0})],o.prototype,"hasZ",void 0),a([p()],o.prototype,"cursor",void 0),a([p()],o.prototype,"effectiveCursor",null),a([p()],o.prototype,"loading",void 0),a([p({constructOnly:!0})],o.prototype,"manipulators",void 0),a([p({constructOnly:!0})],o.prototype,"drawSurface",void 0),a([p({constructOnly:!0})],o.prototype,"segmentLabels",void 0),a([p({constructOnly:!0})],o.prototype,"snappingManager",void 0),a([p({constructOnly:!0})],o.prototype,"snappingVisualizer",void 0),a([p()],o.prototype,"snapToSceneEnabled",void 0),a([p()],o.prototype,"stagedVertex",null),a([p()],o.prototype,"lastVertex",void 0),a([p()],o.prototype,"updating",null),a([p({constructOnly:!0})],o.prototype,"view",void 0),o=a([oe("esri.views.draw.DrawOperation")],o);class De{constructor(e,i,n,l=null){this._elevationInfo=e,this.defaultZ=i,this._view=n,this._excludeGraphics=l}screenToMap(e){if(this.defaultZ!=null)return this._view.sceneIntersectionHelper.intersectElevationFromScreen(O(e.x,e.y),this._elevationInfo,this.defaultZ,this._excludeGraphics);const i=this._view.sceneIntersectionHelper.intersectElevationFromScreen(O(e.x,e.y),this._elevationInfo,0,this._excludeGraphics);return i!=null&&(i.z=void 0),i}mapToScreen(e){const i=E(e.x,e.y,F(this._view,e,this._elevationInfo),e.spatialReference);return this._view.toScreen(i)}constrainZ(e){const{defaultZ:i}=this;return i!=null&&e.z!==i&&((e=R(e)).z=i),e}}class He{constructor(e,i,n=[]){this.view=e,this.elevationInfo=i,this.exclude=n}screenToMap(e){const i=this.view.toMap(e,{exclude:this.exclude});return i!=null&&(i.z=pe(i,this.view,this.elevationInfo)),i}mapToScreen(e){let i=e;return this.elevationInfo!=null&&(i=E(e.x,e.y,F(this.view,e,this.elevationInfo),e.spatialReference)),this.view.toScreen(i)}constrainZ(e){return e}}class $e{constructor(e,i=!1,n=0){this.view=e,this.hasZ=i,this.defaultZ=n,this.mapToScreen=l=>e.toScreen(l),this.screenToMap=i?l=>{const h=e.toMap(l);return h.z=n,h}:l=>e.toMap(l)}constrainZ(e){const{defaultZ:i}=this;return this.hasZ&&e.z!==i&&((e=R(e)).z=i),e}}export{Ie as F,$e as a,Pe as c,k as e,Z as g,o as k,He as o,De as r}; diff --git a/dist/assets/drawUtils-woTYaREB.js b/dist/assets/drawUtils-0wb2c6-q.js similarity index 57% rename from dist/assets/drawUtils-woTYaREB.js rename to dist/assets/drawUtils-0wb2c6-q.js index cd660cc..22b796f 100644 --- a/dist/assets/drawUtils-woTYaREB.js +++ b/dist/assets/drawUtils-0wb2c6-q.js @@ -1 +1 @@ -import{R,ae as k,af as w,ag as F}from"./index-J0iiHjMT.js";function Z(n,a,e,o){if(o==null||n.hasZ||(o=void 0),n.type==="point")return n.x+=a,n.y+=e,n.hasZ&&o!=null&&(n.z+=o),n;if(n.type==="multipoint"){const x=n.points;for(let i=0;ir.xmax){const z=r.xmin,T=r.xmax;r.xmin=T,r.xmax=z}if(r.ymin>r.ymax){const z=r.ymin,T=r.ymax;r.ymin=T,r.ymax=z}return r}const m=R(n),t=k(),[x,i,s,l]=w(t,m),y=o?o[0]:(x+s)/2,c=o?o[1]:(l+i)/2,p=n.clone(),M=p.type==="polyline"?p.paths:p.rings;for(let f=0;f2&&m.push(o??n[2]),n.length>3&&m.push(n[3]),m}export{J as a,H as i,K as m,Z as r,I as s}; +import{J,cf as k,cg as w,ch as F}from"./index-pCX-0tJH.js";function Z(n,a,e,o){if(o==null||n.hasZ||(o=void 0),n.type==="point")return n.x+=a,n.y+=e,n.hasZ&&o!=null&&(n.z+=o),n;if(n.type==="multipoint"){const x=n.points;for(let i=0;ir.xmax){const z=r.xmin,T=r.xmax;r.xmin=T,r.xmax=z}if(r.ymin>r.ymax){const z=r.ymin,T=r.ymax;r.ymin=T,r.ymax=z}return r}const m=J(n),t=k(),[x,i,s,l]=w(t,m),y=o?o[0]:(x+s)/2,p=o?o[1]:(l+i)/2,c=n.clone(),M=c.type==="polyline"?c.paths:c.rings;for(let f=0;f2&&m.push(o??n[2]),n.length>3&&m.push(n[3]),m}export{K as a,H as i,L as m,Z as r,I as s}; diff --git a/dist/assets/editPlaneUtils-4qxd7h1E.js b/dist/assets/editPlaneUtils-4qxd7h1E.js deleted file mode 100644 index a527b88..0000000 --- a/dist/assets/editPlaneUtils-4qxd7h1E.js +++ /dev/null @@ -1 +0,0 @@ -import{hq as qt,N as Zt,po as Ct,bI as Qt,fo as Wt,l as Yt,hp as jt,gk as Pt,kF as Kt,e3 as lt,hP as Jt,aa as I,pp as Xt,e2 as Bt,pq as te,pr as ee,T as Rt,as as ot,aq as ie,aC as dt,aU as oe,aF as ne,ps as re,pt as ae,pu as Y,aB as se,aH as le,pv as nt,hx as j,bn as rt,ar as yt,pw as pe,px as ce,cr as gt,nq as at,py as St,pz as ue,pA as he,nw as de,cM as ye,az as ge,pB as fe,pC as ve,cq as me,pD as xe,e as r,y as l,c as V,p as we,p5 as _e,I as w,cp as K,cz as pt,pE as Ut,iC as $e,pF as L,cT as Oe,K as be,no as kt,L as Et,gD as H,Q as Me,d as ft,pG as Te,n as N,pH as Ie,S as Ve,a2 as vt,ns as ze,dA as Ge,A as mt,b1 as Ce,at as Pe,pI as J,pJ as xt,bv as wt,au as _t,pK as $t,nX as Re,hL as E,aL as q,pL as Ot,pM as Se,pN as Ue,a0 as ke,hM as B,hK as bt}from"./index-J0iiHjMT.js";import{g as v,F as Mt}from"./surfaceCoordinateSystems-siQq4eBA.js";import{l as Ee}from"./InteractiveToolBase-WDic4GPF.js";import{i as Dt}from"./measurementUtils-84-ZBArh.js";import{s as A,p as De,d as Fe,a as tt,u as Le}from"./Tooltip-ON77BKb3.js";import{o as Tt}from"./automaticAreaMeasurementUtils-nVd6Y5mX.js";import{t as Ae,a as He,s as Ne,c as qe}from"./EditGeometryOperations-TPE5Wzab.js";function S(t,e){const i=new Rt({x:t[0],y:t[1],spatialReference:e});return t.length>2&&(i.z=t[2]),i}function Ze(t,e){return new qt({points:t,spatialReference:e})}function It(t,e,i){const o=new Zt({paths:t,spatialReference:e});return i&&Ct(o),o}function U(t,e,i,o=!0){const s=Qt(t);s.forEach(a=>{const u=a[0],p=a[a.length-1];Wt(u,p)&&a.length!==1||a.push(a[0])});let n=new Yt({rings:s,spatialReference:e});return n.rings.forEach(a=>{jt(a)||a.reverse()}),i&&Ct(n),o&&n.isSelfIntersecting&&Pt(e)&&(n=Kt(n)),n}function Vt(t,e,i){const o=e.mapToLocalMultiple(t),s=[],n={x:o[0].x,y:o[0].y},a={x:o[1].x,y:o[1].y},u=Math.round(a.x-n.x),p=Math.round(a.y-n.y),h=Math.max(Math.abs(u),Math.abs(p));if(i){const y={x:n.x+h,y:n.y+h},g={x:n.x-h,y:n.y-h};s.push(v(y.x,g.y),v(g.x,g.y),v(g.x,y.y),v(y.x,y.y))}else{const y={x:u>0?n.x+h:n.x-h,y:p>0?n.y+h:n.y-h};s.push(v(n.x,n.y),v(y.x,n.y),v(y.x,y.y),v(n.x,y.y))}return Ft(U([s.map(y=>e.localToMap(y)).filter(lt)],e.spatialReference,e.doUnnormalization,!0),s,e)}function Qe(t,e,i){let o=e.mapToLocalMultiple(t);if(o.length===1){const p=o[0];o=[v(p.x-48,p.y+48),v(p.x+48,p.y-48),v(p.x+48,p.y-48),v(p.x-48,p.y+48)]}const s=[],n={x:o[0].x,y:o[0].y},a={x:o[1].x,y:o[1].y};if(i){const u=Math.round(a.x-n.x),p=Math.round(a.y-n.y);s.push(v(n.x-u,n.y-p),v(a.x,n.y-p),v(a.x,a.y),v(n.x-u,a.y))}else s.push(v(n.x,n.y),v(a.x,n.y),v(a.x,a.y),v(n.x,a.y));return Ft(U([s.map(u=>e.localToMap(u)).filter(lt)],e.spatialReference,e.doUnnormalization,!0),s,e)}function Ft(t,e,i){const o=Z(e[3],e[2],i),s=Z(e[1],e[2],i),n=Z(e[0],e[1],i),a=Z(e[0],e[3],i);return{geometry:t,midpoints:o!=null&&s!=null&&n!=null&&a!=null?{top:o,right:s,bottom:n,left:a}:null}}function Z(t,e,i){D[0]=t.x,D[1]=t.y,D[2]=0,F[0]=e.x,F[1]=e.y,F[2]=0,Jt(D,D,F,.5),Q.x=D[0],Q.y=F[1],Q.z=F[2];const o=i.localToMap(Q);return o!=null?S(o,i.spatialReference):null}const Q=v(0,0,0),D=I(),F=I();function zt(t,e,i,o){const s=e.mapToLocalMultiple(t);let n=null,a=null;if(i)n=s[0],a=s[1];else{const f=s[0],x=s[1],_=Math.round(x.x-f.x),k=Math.round(x.y-f.y),O=Math.max(Math.abs(_),Math.abs(k));n=v(_>0?f.x+O/2:f.x-O/2,k>0?f.y+O/2:f.y-O/2),a=v(Math.abs(_)>Math.abs(k)?n.x-O/2:n.x,Math.abs(_)>Math.abs(k)?n.y:n.y-O/2)}const u=e.localToMap(n),p=e.localToMap(a);if(u==null||p==null)return null;e.doUnnormalization&&Xt([[u,p]],e.spatialReference);const h=S(u,e.spatialReference),y=S(p,e.spatialReference),g=Bt(e.spatialReference);let c=0;if(Pt(e.spatialReference))c=g*te(h,y,null);else{const f=n.x-a.x,x=n.y-a.y;c=g*Math.sqrt(f*f+x*x)*(o||1)}const C=new ee({center:h,radius:c,radiusUnit:"meters",spatialReference:e.spatialReference});return{geometry:U(C.rings,C.spatialReference,!1),center:h,edge:y}}function We(t,e,i){const o=e.mapToLocalMultiple(t),s=o[0],n=o[1],a=Math.round(n.x-s.x),u=Math.round(n.y-s.y),p=v(i?s.x:s.x+a/2,i?s.y:s.y+u/2),h=i?a:a/2,y=i?u:u/2,g=60,c=[],C=2*Math.PI/g;function f(z){const Ht=Math.cos(z),Nt=Math.sin(z);return v(h*Ht+p.x,y*Nt+p.y)}for(let z=0;ze.localToMap(z)).filter(lt)],x,_,!1),O=e.localToMap(f(Math.PI/2)),ct=e.localToMap(f(0)),ut=e.localToMap(f(-Math.PI/2)),ht=e.localToMap(f(Math.PI));return{geometry:k,midpoints:O!=null&&ct!=null&&ut!=null&&ht!=null?{top:S(O,x),right:S(ct,x),bottom:S(ut,x),left:S(ht,x)}:null}}function et(t,e){switch(t){case"point":case"multipoint":return Ye();case"polyline":return je(e);case"polygon":return Ke(e);default:return}}function Ye(t){return"point"}function je(t){return(t!=null&&t.type==="polyline"&&t.paths.length?t.paths[0].length:0)<2?"polylineZeroVertices":"polylineOneVertex"}function Ke(t){const e=t!=null&&t.type==="polygon"&&t.rings.length?t.rings[0].length:0;return e<3?"polylineZeroVertices":e<4?"polygonOneVertex":"polygonTwoVertices"}const Je=(()=>{const t=I(),e=I(),i=I();return(o,s)=>{if(ot(e,o.x,o.y,o.z??0),ot(i,s.x,s.y,s.z??0),ie(e,i))return null;if(!dt(e,o.spatialReference,e)||!dt(i,s.spatialReference,i)){oe(t,i,e),t[2]=0,ne(t,t);let a=re(ae,t);return t[0]<0&&(a=2*Math.PI-a),Y(a,"radians","geographic")}const{azimuth:n}=se(Be,e,i);return n!=null?Y(n,"degrees","geographic"):void 0}})(),Xe=(()=>{const t=I(),e=I();return({x:i,y:o,z:s,spatialReference:n},a,u)=>{const p=s??0;ot(t,i,o,p);const h=nt(j(u.value,u.unit,"degrees"),u.rotationType,"geographic");if(!rt(t,n,t,yt.WGS84)){const y=nt(h,"geographic","arithmetic"),g=j(y,"degrees","radians");return new Rt({x:i+a*Math.cos(g),y:o+a*Math.sin(g),z:p,spatialReference:n})}return pe(e,t,h,a),e[2]=p,ce(e,yt.WGS84,n)}})(),Be=new le;function ti(t,e,i,o){if(!e)return;const{spatialReference:s}=t;if(!gt(s))return;const n=Dt(s),a=gt(n);if(!a)return;const u=at(t,i,o),p=ni;if(!rt(u,s,p,n))return;const h=St(e,a);if((i==null?void 0:i.type)==="3d"&&i.viewingMode==="local")p[0]+=h;else{const g=ue(n),c=he(g,p,de.X,ri);ye(p,p,c,h)}if(!rt(p,n,p,s))return;const y=ge(u,p);return new fe(u,y)}function ei(t,e,i,o){if(!e)return;const s=at(t,i,o),n=Xe(t,1,e);if(!n)return;const a=at(n,i,o);return new ve(s,a)}function ii(t,e,i,o){if(t==null)return;const s=Dt(e),n=me(s);return n?new xe(St(t,n)):void 0}function oi(t){let e;for(const i of t)i&&(e=(e==null?void 0:e.intersect(i))??i);return e}const ni=I(),ri=I();let m=class extends we{constructor(e){super(e),this.committed=null,this.disabled=!1,this.hidden=!1,this.id=_e(),this.inputValue=null,this.readOnly=!1}get dirty(){return this.inputValue!=null}get locked(){return this.committed!=null}lock(e){this.inputValue=null,this.committed=e??this.actual}unlock(){this.committed=null,this.inputValue=null}};r([l()],m.prototype,"actual",void 0),r([l()],m.prototype,"committed",void 0),r([l()],m.prototype,"createQuantity",void 0),r([l()],m.prototype,"disabled",void 0),r([l()],m.prototype,"hidden",void 0),r([l()],m.prototype,"format",void 0),r([l()],m.prototype,"id",void 0),r([l()],m.prototype,"inputValue",void 0),r([l()],m.prototype,"readOnly",void 0),r([l()],m.prototype,"suffix",void 0),r([l()],m.prototype,"title",void 0),r([l()],m.prototype,"toInputUnits",void 0),r([l()],m.prototype,"dirty",null),r([l()],m.prototype,"locked",null),m=r([V("esri.views.interactive.tooltip.fields.TooltipField")],m);let W=class extends m{constructor(e){super(e),this.mode="absolute-height"}normalizeCtorArgs(e){const i=o=>o.inputUnitInfos.verticalLength.unit;return{actual:w,createQuantity:(o,s)=>K(o,i(s)),toInputUnits:(o,s)=>pt(o,i(s)),format:(o,s)=>s.formatters.verticalLength(o),suffix:o=>o.inputUnitInfos.verticalLength.abbreviation,title:o=>o.messages.sketch.elevation,...e}}};r([l()],W.prototype,"mode",void 0),W=r([V("esri.views.interactive.tooltip.fields.TooltipFieldElevation")],W);const Lt=t=>{const e=i=>i.inputUnitInfos.orientation.unit;return new m({actual:Ut,createQuantity:(i,o)=>Y(i,e(o),"geographic"),toInputUnits:({value:i,unit:o,rotationType:s},n)=>{const p=nt(j(i,o,"degrees"),s,"geographic"),h=$e.normalize(p,0,!0),y=e(n),g=j(h,"degrees",y);return Y(g,y,"geographic")},format:(i,o)=>o.formatters.angle(i),suffix:i=>i.inputUnitInfos.orientation.abbreviation,title:i=>i.messages.sketch.orientation,...t})},st=t=>{const e=i=>i.inputUnitInfos.length.unit;return new m({actual:w,createQuantity:(i,o)=>K(i,e(o)),toInputUnits:(i,o)=>pt(i,e(o)),format:(i,o)=>o.formatters.length(i),suffix:i=>i.inputUnitInfos.length.abbreviation,title:i=>i.messages.sketch.distance,...t})},X=t=>new W(t),ai=t=>{const e=i=>i.inputUnitInfos.area.unit;return new m({actual:L,createQuantity:(i,o)=>Oe(i,e(o)),toInputUnits:(i,o)=>pt(i,e(o)),format:(i,o)=>o.formatters.area(i),suffix:i=>i.inputUnitInfos.area.abbreviation,title:i=>i.messages.sketch.area,...t})};let P=class extends A{constructor(e){super(e),this.type="draw-point",this.elevation=X()}get allFields(){return[this.elevation]}};r([l()],P.prototype,"type",void 0),r([l()],P.prototype,"elevation",void 0),r([l()],P.prototype,"allFields",null),r([l()],P.prototype,"helpMessage",void 0),P=r([V("esri.views.interactive.tooltip.DrawPointTooltipInfo")],P);let $=class extends A{constructor(t){super(t),this.type="draw-polyline",this.orientation=Lt(),this.distance=st({title:e=>e.messages.sketch.distance}),this.elevation=X(),this.totalLength=st({format:(e,i)=>i.formatters.totalLength(e),title:e=>e.messages.sketch.totalLength,readOnly:!0})}get allFields(){return[this.orientation,this.distance,this.elevation,this.totalLength]}};r([l()],$.prototype,"type",void 0),r([l()],$.prototype,"orientation",void 0),r([l()],$.prototype,"distance",void 0),r([l()],$.prototype,"elevation",void 0),r([l()],$.prototype,"totalLength",void 0),r([l()],$.prototype,"allFields",null),r([l()],$.prototype,"helpMessage",void 0),$=r([V("esri.views.interactive.tooltip.DrawPolylineTooltipInfo")],$);let M=class extends A{constructor(t){super(t),this.type="draw-polygon",this.orientation=Lt(),this.distance=st({title:e=>e.messages.sketch.distance}),this.elevation=X(),this.area=ai({readOnly:!0})}get allFields(){return[this.orientation,this.distance,this.elevation,this.area]}};r([l()],M.prototype,"type",void 0),r([l()],M.prototype,"distance",void 0),r([l()],M.prototype,"elevation",void 0),r([l()],M.prototype,"area",void 0),r([l()],M.prototype,"allFields",null),r([l()],M.prototype,"helpMessage",void 0),M=r([V("esri.views.interactive.tooltip.DrawPolygonTooltipInfo")],M);let R=class extends A{constructor(e){super(e),this.type="draw-mesh",this.elevation=X()}get allFields(){return[this.elevation]}};r([l()],R.prototype,"type",void 0),r([l()],R.prototype,"elevation",void 0),r([l()],R.prototype,"allFields",null),r([l()],R.prototype,"helpMessage",void 0),R=r([V("esri.views.interactive.tooltip.DrawMeshTooltipInfo")],R);let G=class extends A{constructor(e){super(e),this.type="draw-rectangle",this.xSize=w,this.ySize=w,this.area=L}get allFields(){return[]}};r([l()],G.prototype,"type",void 0),r([l()],G.prototype,"xSize",void 0),r([l()],G.prototype,"ySize",void 0),r([l()],G.prototype,"area",void 0),r([l()],G.prototype,"allFields",null),G=r([V("esri.views.interactive.tooltip.DrawRectangleTooltipInfo")],G);let T=class extends A{constructor(t){super(t),this.type="draw-circle",this.radius=null,this.xSize=null,this.ySize=null,this.area=L}get allFields(){return[]}};r([l()],T.prototype,"type",void 0),r([l()],T.prototype,"radius",void 0),r([l()],T.prototype,"xSize",void 0),r([l()],T.prototype,"ySize",void 0),r([l()],T.prototype,"area",void 0),r([l()],T.prototype,"allFields",null),T=r([V("esri.views.interactive.tooltip.DrawCircleTooltipInfo")],T);class si{constructor(){this.regularVertices=null,this.activeVertex=null,this.full=null,this.outline=null,this.circle=null,this.rectangle=null}}let d=class extends be.EventedMixin(Ee){constructor(t){super(t),this._graphic=null,this._createOperationGeometry=null,this.defaultZ=0,this.geometryType=null,this.hasZ=!0,this.labelOptions=new kt,this.geometryToPlace=null,this.mode=null,this.snappingManager=null,this.snapToScene=!1,this.tooltip=null,this.tooltipOptions=new Et,this._getPointConstraint=H(e=>e),this._getPolylineOrPolygonConstraint=H((e,i,o)=>oi([e,i,o])),this._getDistanceConstraint=H(ti),this._getOrientationConstraint=H(ei),this._getElevationConstraint=H(ii)}initialize(){this.internalGraphicsLayer=new Me({listMode:"hide",internal:!0}),this.view.map.layers.add(this.internalGraphicsLayer),this.drawOperation=this.makeDrawOperation();const t=this.tooltipOptions,e=this.view.type;this.tooltipInfos={point:new P({tooltipOptions:t,viewType:e}),polyline:new $({tooltipOptions:t,viewType:e}),polygon:new M({tooltipOptions:t,viewType:e}),mesh:new R({tooltipOptions:t,viewType:e}),rectangle:new G({tooltipOptions:t}),circle:new T({tooltipOptions:t})},this.addHandles([this.drawOperation.on("vertex-add",i=>this.onVertexAdd(i)),this.drawOperation.on("vertex-remove",i=>this.onVertexRemove(i)),this.drawOperation.on("vertex-update",i=>this.onVertexUpdate(i)),this.drawOperation.on("cursor-update",i=>this.onCursorUpdate(i)),this.drawOperation.on("complete",i=>this.onComplete(i)),ft(()=>this.cursor,i=>{this.drawOperation.cursor=i},mt),ft(()=>this.tooltipOptions.enabled,i=>{this.tooltip=i?new Le({view:this.view,info:this._tooltipInfo}):N(this.tooltip)},mt),Te(()=>this._updateTooltipInfo())]),this.finishToolCreation()}destroy(){this.drawOperation=N(this.drawOperation),this.tooltip=N(this.tooltip),this._destroyAllVisualisations(),this.view.map.remove(this.internalGraphicsLayer),this.internalGraphicsLayer=N(this.internalGraphicsLayer),this._set("view",null)}get _defaultElevation(){return K(this.defaultZ,"meters")}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centered(t){this._set("centered",t),this._updateGraphic()}get cursor(){return this._get("cursor")}set cursor(t){this._set("cursor",t)}set enabled(t){this.drawOperation.interactive=t,this._set("enabled",t)}set forceUniformSize(t){this._set("forceUniformSize",t),this._updateGraphic()}get graphic(){return this._graphic}set graphicSymbol(t){this._set("graphicSymbol",t),this._graphic!=null&&(this._graphic.symbol=t)}get updating(){var t;return((t=this.drawOperation)==null?void 0:t.updating)??!1}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(t){const e=this._tooltipInfo;if(t.type==="key-down"&&t.key===Ie.enterInputMode&&e!=null&&e.editableFields.length>0&&this.tooltipOptions.inputEnabled)return e.enterInputMode(),void t.stopPropagation();this.drawOperation.onInputEvent(t)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo()}_destroyAllVisualisations(){this.removeHandles(b.outline),this.removeHandles(b.regularVertices),this.removeHandles(b.activeVertex),this.removeHandles(it)}_createOrUpdateGraphic(t){if(this._graphic!=null)return this.updateGraphicGeometry(this._graphic,t),this._graphic;const e=this._graphic=new Ve({...this.graphicProperties,symbol:this.graphicSymbol});return this.updateGraphicGeometry(e,t),this.internalGraphicsLayer.add(e),this.addHandles(this.initializeGraphic(e)),this.notifyChange("graphic"),this.addHandles(vt(()=>{this.internalGraphicsLayer.remove(e),N(e),this._graphic===e&&(this._graphic=null)}),it),e}updateGraphicGeometry(t,e){t.geometry=e}_getCreateOperationGeometry(t={operationComplete:!1}){var C;const{drawOperation:e}=this;if(e==null||e.numVertices===0)return null;const{coordinateHelper:i,view:o}=e,s=e.stagedVertex,n=e.committedVertices,a=n.slice(),u=s!=null;u&&a.push(i.pointToArray(s));const p=u?i.pointToArray(s):n.splice(-1)[0],h=a.length,y=o.spatialReference,g=o.type==="3d"&&o.viewingMode==="global",c=new si;switch(this.geometryType){case"point":case"mesh":c.regularVertices=n,c.activeVertex=p,c.full=i.arrayToPoint(a[0]);break;case"multipoint":c.regularVertices=n,c.activeVertex=p,h>0&&(c.full=Ze(a,y));break;case"polyline":c.regularVertices=n,c.activeVertex=p,h>0&&(c.full=It([a],y,g));break;case"polygon":c.regularVertices=n,c.activeVertex=p,h>0&&(c.full=U([a],y,g,!0));break;case"circle":if(h>0){const f=Mt(o,a[0]);if(h===1&&t.operationComplete){const x=a[0],_=f.makeMapPoint(x[0]+Gt*o.resolution,x[1]);c.circle=zt([x,_],f,!0),c.full=c.circle!=null?c.circle.geometry:null}else h===2&&(this.forceUniformSize?(c.circle=zt(a,f,this.centered),c.full=c.circle!=null?c.circle.geometry:null):(c.rectangle=We(a,f,this.centered),c.full=c.rectangle.geometry))}break;case"rectangle":if(h>0){const f=Mt(o,a[0]);if(h===1&&t.operationComplete){const x=a[0],_=f.makeMapPoint(x[0]+Gt*o.resolution,x[1]);c.rectangle=Vt([x,_],f,!0),c.full=c.rectangle.geometry}else h===2&&(c.rectangle=this.forceUniformSize?Vt(a,f,this.centered):Qe(a,f,this.centered),c.full=c.rectangle.geometry)}break;default:return null}switch(this.geometryType){case"point":case"multipoint":break;case"polyline":c.outline=h>1?It([a],y,g):null;break;case"polygon":c.outline=h>1?U([a],y,g):null;break;case"circle":case"rectangle":c.outline=((C=c.full)==null?void 0:C.type)==="polygon"?U(c.full.rings,y,g):null}return c}initializeGraphic(t){return vt()}onComplete(t){this._updateGraphic();let e=null;if(this.drawOperation.isCompleted){const i=this._getCreateOperationGeometry({operationComplete:!0});i!=null&&(e=this._createOrUpdateGraphic(i.full).clone())}this._createOperationGeometry=null,this.emit("complete",{graphic:e,...t})}onCursorUpdate(t){this._updateGraphic(),this.emit("cursor-update",t)}onDeactivate(){this.drawOperation.isCompleted||this.drawOperation.cancel()}onVertexAdd(t){this._updateGraphic(),this._clearConstraints(),this.emit("vertex-add",t)}onVertexRemove(t){this._updateGraphic(),this._clearConstraints(),this.emit("vertex-remove",t)}onVertexUpdate(t){this._updateGraphic(),this.emit("vertex-update",t)}_updateGraphic(){const t=this._getCreateOperationGeometry();this._createOperationGeometry=t,t!=null?(t.outline!=null?this.addHandles(this.onOutlineChanged(t.outline),b.outline):this.removeHandles(b.outline),t.regularVertices!=null?this.addHandles(this.onRegularVerticesChanged(t.regularVertices),b.regularVertices):this.removeHandles(b.regularVertices),t.activeVertex!=null?this.addHandles(this.onActiveVertexChanged(t.activeVertex),b.activeVertex):this.removeHandles(b.activeVertex),t.full!=null?this._createOrUpdateGraphic(t.full):this.removeHandles(it)):this._destroyAllVisualisations()}get _tooltipInfo(){var n;const{drawOperation:t,graphic:e,view:i}=this;if(!t)return null;const o=this.tooltipInfos,s=(n=e==null?void 0:e.geometry)==null?void 0:n.type;switch(this.geometryType){case"point":return i.type==="2d"&&this.defaultZ===0?null:s==="point"?o.point:null;case"polyline":return s==="polyline"?o.polyline:null;case"polygon":return s==="polygon"?o.polygon:null;case"rectangle":return s==="polygon"?o.rectangle:null;case"circle":return s==="polygon"?o.circle:null;case"mesh":return s==="mesh"?o.mesh:null;default:return null}}_updateTooltipInfo(){const{_tooltipInfo:t,tooltip:e}=this;if(t&&e){switch(t.type){case"draw-point":this._updateDrawPointTooltipInfo(t);break;case"draw-polyline":this._updateDrawPolylineTooltipInfo(t);break;case"draw-polygon":this._updateDrawPolygonTooltipInfo(t);break;case"draw-rectangle":this._updateDrawRectangleTooltipInfo(t);break;case"draw-circle":this._updateDrawCircleTooltipInfo(t);break;case"draw-mesh":this.updateDrawMeshTooltipInfo(t)}e.info=t}}_updateDrawPointTooltipInfo(t){const{drawOperation:e,graphic:i,view:o,tooltipOptions:s}=this,{elevationInfo:n,stagedVertex:a}=e;if(t.tooltipOptions=s,t.viewType=o.type,t.helpMessage=et("point",i==null?void 0:i.geometry),this.updateElevation(t.elevation),!a)return void(e.constraint=void 0);const u=e.coordinateHelper.spatialReference;e.constraint=this._getPointConstraint(this._getElevationConstraint(t.elevation.committed,u,o,n))}_updateDrawPolylineTooltipInfo(t){const e=this._createOperationGeometry,i=e!=null?e.full:null;if((i==null?void 0:i.type)!=="polyline")return;const{drawOperation:o,tooltipOptions:s,view:n}=this,{lastVertex:a,stagedVertex:u}=o;this._updatePolylineOrPolygonCommon(t,u);const p=De(i,this._elevationMode);t.totalLength.actual=p??w,t.totalLength.hidden=length==null||!a,t.tooltipOptions=s,t.viewType=n.type,t.helpMessage=et("polyline",i),this.updateElevation(t.elevation)}_updateDrawPolygonTooltipInfo(t){const e=this._createOperationGeometry,i=e!=null?e.full:null;if((i==null?void 0:i.type)!=="polygon")return;const{drawOperation:o,tooltipOptions:s,view:n}=this,{lastVertex:a}=o;let u=o.stagedVertex;(i==null?void 0:i.type)==="polygon"&&a&&!u&&(u=i.getPoint(0,i.rings[0].length-1)),this._updatePolylineOrPolygonCommon(t,u);const p=Tt(i,this._elevationMode);t.area.actual=p??L,t.area.hidden=p==null&&!a,t.tooltipOptions=s,t.viewType=n.type,t.helpMessage=et("polygon",i),this.updateElevation(t.elevation)}_updatePolylineOrPolygonCommon(t,e){const{view:i,drawOperation:o}=this,{elevationInfo:s,lastVertex:n}=o;if(!n||!e)return t.distance.hidden=!0,t.orientation.hidden=!0,void(o.constraint=void 0);const a=Fe(n,e,this._elevationMode);t.distance.actual=a??w,t.distance.hidden=!1;const u=Je(n,e);t.orientation.actual=u??Ut,t.orientation.hidden=!1;const p=o.coordinateHelper.spatialReference;o.constraint=this._getPolylineOrPolygonConstraint(this._getDistanceConstraint(n,t.distance.committed,i,s),this._getOrientationConstraint(n,t.orientation.committed,i,s),this._getElevationConstraint(t.elevation.committed,p,i,s))}updateDrawMeshTooltipInfo(t){}_updateDrawRectangleTooltipInfo(t){t.tooltipOptions=this.tooltipOptions,t.xSize=this._xSize??w,t.ySize=this._ySize??w,t.area=this._fullGeometryArea??L}_updateDrawCircleTooltipInfo(t){const{forceUniformSize:e}=this;t.tooltipOptions=this.tooltipOptions,t.radius=e?this._circleRadius??w:null,t.xSize=e?null:this._xSize??w,t.ySize=e?null:this._ySize??w,t.area=this._fullGeometryArea??L}get _circleRadius(){var e;const t=this._createOperationGeometry;return((e=t==null?void 0:t.circle)==null?void 0:e.center)!=null&&t.circle.edge!=null?tt(t.circle.center,t.circle.edge,this._elevationMode):null}get _xSize(){var e,i;const t=(i=(e=this._createOperationGeometry)==null?void 0:e.rectangle)==null?void 0:i.midpoints;return t!=null?tt(t.left,t.right,this._elevationMode):null}get _ySize(){var e,i;const t=(i=(e=this._createOperationGeometry)==null?void 0:e.rectangle)==null?void 0:i.midpoints;return t!=null?tt(t.top,t.bottom,this._elevationMode):null}get _fullGeometryArea(){var e;const t=(e=this._createOperationGeometry)==null?void 0:e.full;return(t==null?void 0:t.type)!=="polygon"?null:Tt(t,this._elevationMode)}updateElevation(t){t.actual=this._vertexTooltipElevation}get _vertexTooltipElevation(){const{tooltipOptions:t,view:e,drawOperation:i}=this;if(i==null)return this._defaultElevation;const o=i.stagedVertex??i.lastVertex;if(o==null||e.type==="2d")return this._defaultElevation;const s={mode:t.elevation.mode,offset:0},n=(ze(e,o,i.elevationInfo,s)??0)*Ge(o.spatialReference);return K(n,"meters")}get _elevationMode(){return this.drawOperation.isDraped?"on-the-ground":"absolute-height"}_clearConstraints(){for(const[,t]of Object.entries(this.tooltipInfos))t.unlockAllFields()}};r([l()],d.prototype,"_createOperationGeometry",void 0),r([l()],d.prototype,"_defaultElevation",null),r([l({value:!0})],d.prototype,"centered",null),r([l()],d.prototype,"cursor",null),r([l({nonNullable:!0})],d.prototype,"defaultZ",void 0),r([l()],d.prototype,"drawOperation",void 0),r([l({value:!0})],d.prototype,"enabled",null),r([l({value:!0})],d.prototype,"forceUniformSize",null),r([l({constructOnly:!0})],d.prototype,"geometryType",void 0),r([l()],d.prototype,"graphic",null),r([l({constructOnly:!0})],d.prototype,"graphicProperties",void 0),r([l()],d.prototype,"graphicSymbol",null),r([l({constructOnly:!0})],d.prototype,"hasZ",void 0),r([l({constructOnly:!0,type:kt})],d.prototype,"labelOptions",void 0),r([l({constructOnly:!0})],d.prototype,"geometryToPlace",void 0),r([l({constructOnly:!0})],d.prototype,"mode",void 0),r([l()],d.prototype,"snappingManager",void 0),r([l()],d.prototype,"snapToScene",void 0),r([l()],d.prototype,"tooltip",void 0),r([l()],d.prototype,"tooltipInfos",void 0),r([l({constructOnly:!0,type:Et})],d.prototype,"tooltipOptions",void 0),r([l({readOnly:!0})],d.prototype,"type",void 0),r([l({readOnly:!0})],d.prototype,"updating",null),r([l({constructOnly:!0,nonNullable:!0})],d.prototype,"view",void 0),r([l()],d.prototype,"_tooltipInfo",null),r([l()],d.prototype,"_circleRadius",null),r([l()],d.prototype,"_xSize",null),r([l()],d.prototype,"_ySize",null),r([l()],d.prototype,"_fullGeometryArea",null),r([l()],d.prototype,"_vertexTooltipElevation",null),r([l()],d.prototype,"_elevationMode",null),d=r([V("esri.views.draw.DrawGraphicTool")],d);const it="create-operation-graphic",b={outline:"outline-visual",regularVertices:"regular-vertices-visual",activeVertex:"active-vertex-visual"};function Oi(t){switch(t){case"point":case"polyline":case"polygon":case"multipoint":return t;case"circle":case"rectangle":return"segment";case"mesh":return"point"}}const Gt=48;function bi(t,e){return At(t,e,!1)}function Mi(t,e){return At(t,e,!0)}function At(t,e,i){if(t instanceof Ae){if(t.operation instanceof He)return li(t.operation,e,i),!0;if(t.operation instanceof Ne)return pi(t.operation,e,i),!0;if(t.operation instanceof qe)return ci(t.operation,e,i),!0}return!1}function li(t,e,i=!1){const o=i?-1:1,s=Ce(o*t.dx,o*t.dy,o*t.dz);Pe(e.origin,e.origin,s),J(e)}function pi(t,e,i=!1){const o=i?-t.angle:t.angle;xt(e.basis1,e.basis1,wt,o),xt(e.basis2,e.basis2,wt,o),J(e)}function ci(t,e,i=!1){const o=i?1/t.factor1:t.factor1,s=i?1/t.factor2:t.factor2;_t(e.basis1,e.basis1,o),_t(e.basis2,e.basis2,s),$t(e.origin,e.origin,t.origin,t.axis1,o),$t(e.origin,e.origin,t.origin,t.axis2,s),J(e)}function Ti(t,e,i,o){o||(o=Re());const s=E(q.get(),t[1],-t[0]),n=E(q.get(),Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),a=E(q.get(),Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),u=q.get();e.components.forEach(y=>y.vertices.forEach(g=>{const c=g.pos;E(u,Ot(t,c),Ot(s,c)),Se(n,n,u),Ue(a,a,u)}));const p=1e-6,h=E(q.get(),a[0]-n[0]2&&(i.z=t[2]),i}function Qe(t,e){return new Zt({points:t,spatialReference:e})}function Mt(t,e,i){const o=new Qt({paths:t,spatialReference:e});return i&&Ct(o),o}function U(t,e,i,o=!0){const s=Wt(t);s.forEach(a=>{const u=a[0],p=a[a.length-1];Yt(u,p)&&a.length!==1||a.push(a[0])});let n=new jt({rings:s,spatialReference:e});return n.rings.forEach(a=>{Kt(a)||a.reverse()}),i&&Ct(n),o&&n.isSelfIntersecting&&Rt(e)&&(n=qt(n)),n}function Vt(t,e,i){const o=e.mapToLocalMultiple(t),s=[],n={x:o[0].x,y:o[0].y},a={x:o[1].x,y:o[1].y},u=Math.round(a.x-n.x),p=Math.round(a.y-n.y),h=Math.max(Math.abs(u),Math.abs(p));if(i){const y={x:n.x+h,y:n.y+h},g={x:n.x-h,y:n.y-h};s.push(v(y.x,g.y),v(g.x,g.y),v(g.x,y.y),v(y.x,y.y))}else{const y={x:u>0?n.x+h:n.x-h,y:p>0?n.y+h:n.y-h};s.push(v(n.x,n.y),v(y.x,n.y),v(y.x,y.y),v(n.x,y.y))}return Lt(U([s.map(y=>e.localToMap(y)).filter(lt)],e.spatialReference,e.doUnnormalization,!0),s,e)}function We(t,e,i){let o=e.mapToLocalMultiple(t);if(o.length===1){const p=o[0];o=[v(p.x-48,p.y+48),v(p.x+48,p.y-48),v(p.x+48,p.y-48),v(p.x-48,p.y+48)]}const s=[],n={x:o[0].x,y:o[0].y},a={x:o[1].x,y:o[1].y};if(i){const u=Math.round(a.x-n.x),p=Math.round(a.y-n.y);s.push(v(n.x-u,n.y-p),v(a.x,n.y-p),v(a.x,a.y),v(n.x-u,a.y))}else s.push(v(n.x,n.y),v(a.x,n.y),v(a.x,a.y),v(n.x,a.y));return Lt(U([s.map(u=>e.localToMap(u)).filter(lt)],e.spatialReference,e.doUnnormalization,!0),s,e)}function Lt(t,e,i){const o=Q(e[3],e[2],i),s=Q(e[1],e[2],i),n=Q(e[0],e[1],i),a=Q(e[0],e[3],i);return{geometry:t,midpoints:o!=null&&s!=null&&n!=null&&a!=null?{top:o,right:s,bottom:n,left:a}:null}}function Q(t,e,i){D[0]=t.x,D[1]=t.y,D[2]=0,L[0]=e.x,L[1]=e.y,L[2]=0,Jt(D,D,L,.5),W.x=D[0],W.y=L[1],W.z=L[2];const o=i.localToMap(W);return o!=null?S(o,i.spatialReference):null}const W=v(0,0,0),D=M(),L=M();function zt(t,e,i,o){const s=e.mapToLocalMultiple(t);let n=null,a=null;if(i)n=s[0],a=s[1];else{const f=s[0],x=s[1],_=Math.round(x.x-f.x),k=Math.round(x.y-f.y),O=Math.max(Math.abs(_),Math.abs(k));n=v(_>0?f.x+O/2:f.x-O/2,k>0?f.y+O/2:f.y-O/2),a=v(Math.abs(_)>Math.abs(k)?n.x-O/2:n.x,Math.abs(_)>Math.abs(k)?n.y:n.y-O/2)}const u=e.localToMap(n),p=e.localToMap(a);if(u==null||p==null)return null;e.doUnnormalization&&Xt([[u,p]],e.spatialReference);const h=S(u,e.spatialReference),y=S(p,e.spatialReference),g=Bt(e.spatialReference);let c=0;if(Rt(e.spatialReference))c=g*te(h,y,null);else{const f=n.x-a.x,x=n.y-a.y;c=g*Math.sqrt(f*f+x*x)*(o||1)}const C=new ee({center:h,radius:c,radiusUnit:"meters",spatialReference:e.spatialReference});return{geometry:U(C.rings,C.spatialReference,!1),center:h,edge:y}}function Ye(t,e,i){const o=e.mapToLocalMultiple(t),s=o[0],n=o[1],a=Math.round(n.x-s.x),u=Math.round(n.y-s.y),p=v(i?s.x:s.x+a/2,i?s.y:s.y+u/2),h=i?a:a/2,y=i?u:u/2,g=60,c=[],C=2*Math.PI/g;function f(z){const Nt=Math.cos(z),Ht=Math.sin(z);return v(h*Nt+p.x,y*Ht+p.y)}for(let z=0;ze.localToMap(z)).filter(lt)],x,_,!1),O=e.localToMap(f(Math.PI/2)),ct=e.localToMap(f(0)),ut=e.localToMap(f(-Math.PI/2)),ht=e.localToMap(f(Math.PI));return{geometry:k,midpoints:O!=null&&ct!=null&&ut!=null&&ht!=null?{top:S(O,x),right:S(ct,x),bottom:S(ut,x),left:S(ht,x)}:null}}function et(t,e){switch(t){case"point":case"multipoint":return je();case"polyline":return Ke(e);case"polygon":return qe(e);default:return}}function je(t){return"point"}function Ke(t){return(t!=null&&t.type==="polyline"&&t.paths.length?t.paths[0].length:0)<2?"polylineZeroVertices":"polylineOneVertex"}function qe(t){const e=t!=null&&t.type==="polygon"&&t.rings.length?t.rings[0].length:0;return e<3?"polylineZeroVertices":e<4?"polygonOneVertex":"polygonTwoVertices"}const Je=(()=>{const t=M(),e=M(),i=M();return(o,s)=>{if(ot(e,o.x,o.y,o.z??0),ot(i,s.x,s.y,s.z??0),ie(e,i))return null;if(!dt(e,o.spatialReference,e)||!dt(i,s.spatialReference,i)){oe(t,i,e),t[2]=0,ne(t,t);let a=re(ae,t);return t[0]<0&&(a=2*Math.PI-a),j(a,"radians","geographic")}const{azimuth:n}=se(Be,e,i);return n!=null?j(n,"degrees","geographic"):void 0}})(),Xe=(()=>{const t=M(),e=M();return({x:i,y:o,z:s,spatialReference:n},a,u)=>{const p=s??0;ot(t,i,o,p);const h=nt(K(u.value,u.unit,"degrees"),u.rotationType,"geographic");if(!rt(t,n,t,yt.WGS84)){const y=nt(h,"geographic","arithmetic"),g=K(y,"degrees","radians");return new Pt({x:i+a*Math.cos(g),y:o+a*Math.sin(g),z:p,spatialReference:n})}return pe(e,t,h,a),e[2]=p,ce(e,yt.WGS84,n)}})(),Be=new le;function ti(t,e,i,o){if(!e)return;const{spatialReference:s}=t;if(!gt(s))return;const n=Dt(s),a=gt(n);if(!a)return;const u=at(t,i,o),p=ni;if(!rt(u,s,p,n))return;const h=St(e,a);if((i==null?void 0:i.type)==="3d"&&i.viewingMode==="local")p[0]+=h;else{const g=ue(n),c=he(g,p,de.X,ri);ye(p,p,c,h)}if(!rt(p,n,p,s))return;const y=ge(u,p);return new fe(u,y)}function ei(t,e,i,o){if(!e)return;const s=at(t,i,o),n=Xe(t,1,e);if(!n)return;const a=at(n,i,o);return new ve(s,a)}function ii(t,e,i,o){if(t==null)return;const s=Dt(e),n=me(s);return n?new xe(St(t,n)):void 0}function oi(t){let e;for(const i of t)i&&(e=(e==null?void 0:e.intersect(i))??i);return e}const ni=M(),ri=M();let m=class extends we{constructor(e){super(e),this.committed=null,this.disabled=!1,this.hidden=!1,this.id=_e(),this.inputValue=null,this.readOnly=!1}get dirty(){return this.inputValue!=null}get locked(){return this.committed!=null}lock(e){this.inputValue=null,this.committed=e??this.actual}unlock(){this.committed=null,this.inputValue=null}};r([l()],m.prototype,"actual",void 0),r([l()],m.prototype,"committed",void 0),r([l()],m.prototype,"createQuantity",void 0),r([l()],m.prototype,"disabled",void 0),r([l()],m.prototype,"hidden",void 0),r([l()],m.prototype,"format",void 0),r([l()],m.prototype,"id",void 0),r([l()],m.prototype,"inputValue",void 0),r([l()],m.prototype,"readOnly",void 0),r([l()],m.prototype,"suffix",void 0),r([l()],m.prototype,"title",void 0),r([l()],m.prototype,"toInputUnits",void 0),r([l()],m.prototype,"dirty",null),r([l()],m.prototype,"locked",null),m=r([V("esri.views.interactive.tooltip.fields.TooltipField")],m);let Y=class extends m{constructor(e){super(e),this.mode="absolute-height"}normalizeCtorArgs(e){const i=o=>o.inputUnitInfos.verticalLength.unit;return{actual:w,createQuantity:(o,s)=>q(o,i(s)),toInputUnits:(o,s)=>pt(o,i(s)),format:(o,s)=>s.formatters.verticalLength(o),suffix:o=>o.inputUnitInfos.verticalLength.abbreviation,title:o=>o.messages.sketch.elevation,...e}}};r([l()],Y.prototype,"mode",void 0),Y=r([V("esri.views.interactive.tooltip.fields.TooltipFieldElevation")],Y);const Ft=t=>{const e=i=>i.inputUnitInfos.orientation.unit;return new m({actual:Ut,createQuantity:(i,o)=>j(i,e(o),"geographic"),toInputUnits:({value:i,unit:o,rotationType:s},n)=>{const p=nt(K(i,o,"degrees"),s,"geographic"),h=$e.normalize(p,0,!0),y=e(n),g=K(h,"degrees",y);return j(g,y,"geographic")},format:(i,o)=>o.formatters.angle(i),suffix:i=>i.inputUnitInfos.orientation.abbreviation,title:i=>i.messages.sketch.orientation,...t})},st=t=>{const e=i=>i.inputUnitInfos.length.unit;return new m({actual:w,createQuantity:(i,o)=>q(i,e(o)),toInputUnits:(i,o)=>pt(i,e(o)),format:(i,o)=>o.formatters.length(i),suffix:i=>i.inputUnitInfos.length.abbreviation,title:i=>i.messages.sketch.distance,...t})},X=t=>new Y(t),ai=t=>{const e=i=>i.inputUnitInfos.area.unit;return new m({actual:F,createQuantity:(i,o)=>Oe(i,e(o)),toInputUnits:(i,o)=>pt(i,e(o)),format:(i,o)=>o.formatters.area(i),suffix:i=>i.inputUnitInfos.area.abbreviation,title:i=>i.messages.sketch.area,...t})};let R=class extends A{constructor(e){super(e),this.type="draw-point",this.elevation=X()}get allFields(){return[this.elevation]}};r([l()],R.prototype,"type",void 0),r([l()],R.prototype,"elevation",void 0),r([l()],R.prototype,"allFields",null),r([l()],R.prototype,"helpMessage",void 0),R=r([V("esri.views.interactive.tooltip.DrawPointTooltipInfo")],R);let $=class extends A{constructor(t){super(t),this.type="draw-polyline",this.orientation=Ft(),this.distance=st({title:e=>e.messages.sketch.distance}),this.elevation=X(),this.totalLength=st({format:(e,i)=>i.formatters.totalLength(e),title:e=>e.messages.sketch.totalLength,readOnly:!0})}get allFields(){return[this.orientation,this.distance,this.elevation,this.totalLength]}};r([l()],$.prototype,"type",void 0),r([l()],$.prototype,"orientation",void 0),r([l()],$.prototype,"distance",void 0),r([l()],$.prototype,"elevation",void 0),r([l()],$.prototype,"totalLength",void 0),r([l()],$.prototype,"allFields",null),r([l()],$.prototype,"helpMessage",void 0),$=r([V("esri.views.interactive.tooltip.DrawPolylineTooltipInfo")],$);let T=class extends A{constructor(t){super(t),this.type="draw-polygon",this.orientation=Ft(),this.distance=st({title:e=>e.messages.sketch.distance}),this.elevation=X(),this.area=ai({readOnly:!0})}get allFields(){return[this.orientation,this.distance,this.elevation,this.area]}};r([l()],T.prototype,"type",void 0),r([l()],T.prototype,"distance",void 0),r([l()],T.prototype,"elevation",void 0),r([l()],T.prototype,"area",void 0),r([l()],T.prototype,"allFields",null),r([l()],T.prototype,"helpMessage",void 0),T=r([V("esri.views.interactive.tooltip.DrawPolygonTooltipInfo")],T);let P=class extends A{constructor(e){super(e),this.type="draw-mesh",this.elevation=X()}get allFields(){return[this.elevation]}};r([l()],P.prototype,"type",void 0),r([l()],P.prototype,"elevation",void 0),r([l()],P.prototype,"allFields",null),r([l()],P.prototype,"helpMessage",void 0),P=r([V("esri.views.interactive.tooltip.DrawMeshTooltipInfo")],P);let G=class extends A{constructor(e){super(e),this.type="draw-rectangle",this.xSize=w,this.ySize=w,this.area=F}get allFields(){return[]}};r([l()],G.prototype,"type",void 0),r([l()],G.prototype,"xSize",void 0),r([l()],G.prototype,"ySize",void 0),r([l()],G.prototype,"area",void 0),r([l()],G.prototype,"allFields",null),G=r([V("esri.views.interactive.tooltip.DrawRectangleTooltipInfo")],G);let I=class extends A{constructor(t){super(t),this.type="draw-circle",this.radius=null,this.xSize=null,this.ySize=null,this.area=F}get allFields(){return[]}};r([l()],I.prototype,"type",void 0),r([l()],I.prototype,"radius",void 0),r([l()],I.prototype,"xSize",void 0),r([l()],I.prototype,"ySize",void 0),r([l()],I.prototype,"area",void 0),r([l()],I.prototype,"allFields",null),I=r([V("esri.views.interactive.tooltip.DrawCircleTooltipInfo")],I);class si{constructor(){this.regularVertices=null,this.activeVertex=null,this.full=null,this.outline=null,this.circle=null,this.rectangle=null}}let d=class extends be.EventedMixin(Ee){constructor(t){super(t),this._graphic=null,this._createOperationGeometry=null,this.defaultZ=0,this.geometryType=null,this.hasZ=!0,this.labelOptions=new kt,this.geometryToPlace=null,this.mode=null,this.snappingManager=null,this.snapToScene=!1,this.tooltip=null,this.tooltipOptions=new Et,this._getPointConstraint=N(e=>e),this._getPolylineOrPolygonConstraint=N((e,i,o)=>oi([e,i,o])),this._getDistanceConstraint=N(ti),this._getOrientationConstraint=N(ei),this._getElevationConstraint=N(ii)}initialize(){this.internalGraphicsLayer=new Te({listMode:"hide",internal:!0}),this.view.map.layers.add(this.internalGraphicsLayer),this.drawOperation=this.makeDrawOperation();const t=this.tooltipOptions,e=this.view.type;this.tooltipInfos={point:new R({tooltipOptions:t,viewType:e}),polyline:new $({tooltipOptions:t,viewType:e}),polygon:new T({tooltipOptions:t,viewType:e}),mesh:new P({tooltipOptions:t,viewType:e}),rectangle:new G({tooltipOptions:t}),circle:new I({tooltipOptions:t})},this.addHandles([this.drawOperation.on("vertex-add",i=>this.onVertexAdd(i)),this.drawOperation.on("vertex-remove",i=>this.onVertexRemove(i)),this.drawOperation.on("vertex-update",i=>this.onVertexUpdate(i)),this.drawOperation.on("cursor-update",i=>this.onCursorUpdate(i)),this.drawOperation.on("complete",i=>this.onComplete(i)),ft(()=>this.cursor,i=>{this.drawOperation.cursor=i},mt),ft(()=>this.tooltipOptions.enabled,i=>{this.tooltip=i?new Fe({view:this.view,info:this._tooltipInfo}):H(this.tooltip)},mt),Ie(()=>this._updateTooltipInfo())]),this.finishToolCreation()}destroy(){this.drawOperation=H(this.drawOperation),this.tooltip=H(this.tooltip),this._destroyAllVisualisations(),this.view.map.remove(this.internalGraphicsLayer),this.internalGraphicsLayer=H(this.internalGraphicsLayer),this._set("view",null)}get _defaultElevation(){return q(this.defaultZ,"meters")}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centered(t){this._set("centered",t),this._updateGraphic()}get cursor(){return this._get("cursor")}set cursor(t){this._set("cursor",t)}set enabled(t){this.drawOperation.interactive=t,this._set("enabled",t)}set forceUniformSize(t){this._set("forceUniformSize",t),this._updateGraphic()}get graphic(){return this._graphic}set graphicSymbol(t){this._set("graphicSymbol",t),this._graphic!=null&&(this._graphic.symbol=t)}get updating(){var t;return((t=this.drawOperation)==null?void 0:t.updating)??!1}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(t){const e=this._tooltipInfo;if(t.type==="key-down"&&t.key===Me.enterInputMode&&e!=null&&e.editableFields.length>0&&this.tooltipOptions.inputEnabled)return e.enterInputMode(),void t.stopPropagation();this.drawOperation.onInputEvent(t)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo()}_destroyAllVisualisations(){this.removeHandles(b.outline),this.removeHandles(b.regularVertices),this.removeHandles(b.activeVertex),this.removeHandles(it)}_createOrUpdateGraphic(t){if(this._graphic!=null)return this.updateGraphicGeometry(this._graphic,t),this._graphic;const e=this._graphic=new Ve({...this.graphicProperties,symbol:this.graphicSymbol});return this.updateGraphicGeometry(e,t),this.internalGraphicsLayer.add(e),this.addHandles(this.initializeGraphic(e)),this.notifyChange("graphic"),this.addHandles(vt(()=>{this.internalGraphicsLayer.remove(e),H(e),this._graphic===e&&(this._graphic=null)}),it),e}updateGraphicGeometry(t,e){t.geometry=e}_getCreateOperationGeometry(t={operationComplete:!1}){var C;const{drawOperation:e}=this;if(e==null||e.numVertices===0)return null;const{coordinateHelper:i,view:o}=e,s=e.stagedVertex,n=e.committedVertices,a=n.slice(),u=s!=null;u&&a.push(i.pointToArray(s));const p=u?i.pointToArray(s):n.splice(-1)[0],h=a.length,y=o.spatialReference,g=o.type==="3d"&&o.viewingMode==="global",c=new si;switch(this.geometryType){case"point":case"mesh":c.regularVertices=n,c.activeVertex=p,c.full=i.arrayToPoint(a[0]);break;case"multipoint":c.regularVertices=n,c.activeVertex=p,h>0&&(c.full=Qe(a,y));break;case"polyline":c.regularVertices=n,c.activeVertex=p,h>0&&(c.full=Mt([a],y,g));break;case"polygon":c.regularVertices=n,c.activeVertex=p,h>0&&(c.full=U([a],y,g,!0));break;case"circle":if(h>0){const f=Tt(o,a[0]);if(h===1&&t.operationComplete){const x=a[0],_=f.makeMapPoint(x[0]+Gt*o.resolution,x[1]);c.circle=zt([x,_],f,!0),c.full=c.circle!=null?c.circle.geometry:null}else h===2&&(this.forceUniformSize?(c.circle=zt(a,f,this.centered),c.full=c.circle!=null?c.circle.geometry:null):(c.rectangle=Ye(a,f,this.centered),c.full=c.rectangle.geometry))}break;case"rectangle":if(h>0){const f=Tt(o,a[0]);if(h===1&&t.operationComplete){const x=a[0],_=f.makeMapPoint(x[0]+Gt*o.resolution,x[1]);c.rectangle=Vt([x,_],f,!0),c.full=c.rectangle.geometry}else h===2&&(c.rectangle=this.forceUniformSize?Vt(a,f,this.centered):We(a,f,this.centered),c.full=c.rectangle.geometry)}break;default:return null}switch(this.geometryType){case"point":case"multipoint":break;case"polyline":c.outline=h>1?Mt([a],y,g):null;break;case"polygon":c.outline=h>1?U([a],y,g):null;break;case"circle":case"rectangle":c.outline=((C=c.full)==null?void 0:C.type)==="polygon"?U(c.full.rings,y,g):null}return c}initializeGraphic(t){return vt()}onComplete(t){this._updateGraphic();let e=null;if(this.drawOperation.isCompleted){const i=this._getCreateOperationGeometry({operationComplete:!0});i!=null&&(e=this._createOrUpdateGraphic(i.full).clone())}this._createOperationGeometry=null,this.emit("complete",{graphic:e,...t})}onCursorUpdate(t){this._updateGraphic(),this.emit("cursor-update",t)}onDeactivate(){this.drawOperation.isCompleted||this.drawOperation.cancel()}onVertexAdd(t){this._updateGraphic(),this._clearConstraints(),this.emit("vertex-add",t)}onVertexRemove(t){this._updateGraphic(),this._clearConstraints(),this.emit("vertex-remove",t)}onVertexUpdate(t){this._updateGraphic(),this.emit("vertex-update",t)}_updateGraphic(){const t=this._getCreateOperationGeometry();this._createOperationGeometry=t,t!=null?(t.outline!=null?this.addHandles(this.onOutlineChanged(t.outline),b.outline):this.removeHandles(b.outline),t.regularVertices!=null?this.addHandles(this.onRegularVerticesChanged(t.regularVertices),b.regularVertices):this.removeHandles(b.regularVertices),t.activeVertex!=null?this.addHandles(this.onActiveVertexChanged(t.activeVertex),b.activeVertex):this.removeHandles(b.activeVertex),t.full!=null?this._createOrUpdateGraphic(t.full):this.removeHandles(it)):this._destroyAllVisualisations()}get _tooltipInfo(){var n;const{drawOperation:t,graphic:e,view:i}=this;if(!t)return null;const o=this.tooltipInfos,s=(n=e==null?void 0:e.geometry)==null?void 0:n.type;switch(this.geometryType){case"point":return i.type==="2d"&&this.defaultZ===0?null:s==="point"?o.point:null;case"polyline":return s==="polyline"?o.polyline:null;case"polygon":return s==="polygon"?o.polygon:null;case"rectangle":return s==="polygon"?o.rectangle:null;case"circle":return s==="polygon"?o.circle:null;case"mesh":return s==="mesh"?o.mesh:null;default:return null}}_updateTooltipInfo(){const{_tooltipInfo:t,tooltip:e}=this;if(t&&e){switch(t.type){case"draw-point":this._updateDrawPointTooltipInfo(t);break;case"draw-polyline":this._updateDrawPolylineTooltipInfo(t);break;case"draw-polygon":this._updateDrawPolygonTooltipInfo(t);break;case"draw-rectangle":this._updateDrawRectangleTooltipInfo(t);break;case"draw-circle":this._updateDrawCircleTooltipInfo(t);break;case"draw-mesh":this.updateDrawMeshTooltipInfo(t)}e.info=t}}_updateDrawPointTooltipInfo(t){const{drawOperation:e,graphic:i,view:o,tooltipOptions:s}=this,{elevationInfo:n,stagedVertex:a}=e;if(t.tooltipOptions=s,t.viewType=o.type,t.helpMessage=et("point",i==null?void 0:i.geometry),this.updateElevation(t.elevation),!a)return void(e.constraint=void 0);const u=e.coordinateHelper.spatialReference;e.constraint=this._getPointConstraint(this._getElevationConstraint(t.elevation.committed,u,o,n))}_updateDrawPolylineTooltipInfo(t){const e=this._createOperationGeometry,i=e!=null?e.full:null;if((i==null?void 0:i.type)!=="polyline")return;const{drawOperation:o,tooltipOptions:s,view:n}=this,{lastVertex:a,stagedVertex:u}=o;this._updatePolylineOrPolygonCommon(t,u);const p=De(i,this._elevationMode);t.totalLength.actual=p??w,t.totalLength.hidden=length==null||!a,t.tooltipOptions=s,t.viewType=n.type,t.helpMessage=et("polyline",i),this.updateElevation(t.elevation)}_updateDrawPolygonTooltipInfo(t){const e=this._createOperationGeometry,i=e!=null?e.full:null;if((i==null?void 0:i.type)!=="polygon")return;const{drawOperation:o,tooltipOptions:s,view:n}=this,{lastVertex:a}=o;let u=o.stagedVertex;(i==null?void 0:i.type)==="polygon"&&a&&!u&&(u=i.getPoint(0,i.rings[0].length-1)),this._updatePolylineOrPolygonCommon(t,u);const p=It(i,this._elevationMode);t.area.actual=p??F,t.area.hidden=p==null&&!a,t.tooltipOptions=s,t.viewType=n.type,t.helpMessage=et("polygon",i),this.updateElevation(t.elevation)}_updatePolylineOrPolygonCommon(t,e){const{view:i,drawOperation:o}=this,{elevationInfo:s,lastVertex:n}=o;if(!n||!e)return t.distance.hidden=!0,t.orientation.hidden=!0,void(o.constraint=void 0);const a=Le(n,e,this._elevationMode);t.distance.actual=a??w,t.distance.hidden=!1;const u=Je(n,e);t.orientation.actual=u??Ut,t.orientation.hidden=!1;const p=o.coordinateHelper.spatialReference;o.constraint=this._getPolylineOrPolygonConstraint(this._getDistanceConstraint(n,t.distance.committed,i,s),this._getOrientationConstraint(n,t.orientation.committed,i,s),this._getElevationConstraint(t.elevation.committed,p,i,s))}updateDrawMeshTooltipInfo(t){}_updateDrawRectangleTooltipInfo(t){t.tooltipOptions=this.tooltipOptions,t.xSize=this._xSize??w,t.ySize=this._ySize??w,t.area=this._fullGeometryArea??F}_updateDrawCircleTooltipInfo(t){const{forceUniformSize:e}=this;t.tooltipOptions=this.tooltipOptions,t.radius=e?this._circleRadius??w:null,t.xSize=e?null:this._xSize??w,t.ySize=e?null:this._ySize??w,t.area=this._fullGeometryArea??F}get _circleRadius(){var e;const t=this._createOperationGeometry;return((e=t==null?void 0:t.circle)==null?void 0:e.center)!=null&&t.circle.edge!=null?tt(t.circle.center,t.circle.edge,this._elevationMode):null}get _xSize(){var e,i;const t=(i=(e=this._createOperationGeometry)==null?void 0:e.rectangle)==null?void 0:i.midpoints;return t!=null?tt(t.left,t.right,this._elevationMode):null}get _ySize(){var e,i;const t=(i=(e=this._createOperationGeometry)==null?void 0:e.rectangle)==null?void 0:i.midpoints;return t!=null?tt(t.top,t.bottom,this._elevationMode):null}get _fullGeometryArea(){var e;const t=(e=this._createOperationGeometry)==null?void 0:e.full;return(t==null?void 0:t.type)!=="polygon"?null:It(t,this._elevationMode)}updateElevation(t){t.actual=this._vertexTooltipElevation}get _vertexTooltipElevation(){const{tooltipOptions:t,view:e,drawOperation:i}=this;if(i==null)return this._defaultElevation;const o=i.stagedVertex??i.lastVertex;if(o==null||e.type==="2d")return this._defaultElevation;const s={mode:t.elevation.mode,offset:0},n=(ze(e,o,i.elevationInfo,s)??0)*Ge(o.spatialReference);return q(n,"meters")}get _elevationMode(){return this.drawOperation.isDraped?"on-the-ground":"absolute-height"}_clearConstraints(){for(const[,t]of Object.entries(this.tooltipInfos))t.unlockAllFields()}};r([l()],d.prototype,"_createOperationGeometry",void 0),r([l()],d.prototype,"_defaultElevation",null),r([l({value:!0})],d.prototype,"centered",null),r([l()],d.prototype,"cursor",null),r([l({nonNullable:!0})],d.prototype,"defaultZ",void 0),r([l()],d.prototype,"drawOperation",void 0),r([l({value:!0})],d.prototype,"enabled",null),r([l({value:!0})],d.prototype,"forceUniformSize",null),r([l({constructOnly:!0})],d.prototype,"geometryType",void 0),r([l()],d.prototype,"graphic",null),r([l({constructOnly:!0})],d.prototype,"graphicProperties",void 0),r([l()],d.prototype,"graphicSymbol",null),r([l({constructOnly:!0})],d.prototype,"hasZ",void 0),r([l({constructOnly:!0,type:kt})],d.prototype,"labelOptions",void 0),r([l({constructOnly:!0})],d.prototype,"geometryToPlace",void 0),r([l({constructOnly:!0})],d.prototype,"mode",void 0),r([l()],d.prototype,"snappingManager",void 0),r([l()],d.prototype,"snapToScene",void 0),r([l()],d.prototype,"tooltip",void 0),r([l()],d.prototype,"tooltipInfos",void 0),r([l({constructOnly:!0,type:Et})],d.prototype,"tooltipOptions",void 0),r([l({readOnly:!0})],d.prototype,"type",void 0),r([l({readOnly:!0})],d.prototype,"updating",null),r([l({constructOnly:!0,nonNullable:!0})],d.prototype,"view",void 0),r([l()],d.prototype,"_tooltipInfo",null),r([l()],d.prototype,"_circleRadius",null),r([l()],d.prototype,"_xSize",null),r([l()],d.prototype,"_ySize",null),r([l()],d.prototype,"_fullGeometryArea",null),r([l()],d.prototype,"_vertexTooltipElevation",null),r([l()],d.prototype,"_elevationMode",null),d=r([V("esri.views.draw.DrawGraphicTool")],d);const it="create-operation-graphic",b={outline:"outline-visual",regularVertices:"regular-vertices-visual",activeVertex:"active-vertex-visual"};function Oi(t){switch(t){case"point":case"polyline":case"polygon":case"multipoint":return t;case"circle":case"rectangle":return"segment";case"mesh":return"point"}}const Gt=48;function bi(t,e){return At(t,e,!1)}function Ti(t,e){return At(t,e,!0)}function At(t,e,i){if(t instanceof Ae){if(t.operation instanceof Ne)return li(t.operation,e,i),!0;if(t.operation instanceof He)return pi(t.operation,e,i),!0;if(t.operation instanceof Ze)return ci(t.operation,e,i),!0}return!1}function li(t,e,i=!1){const o=i?-1:1,s=Ce(o*t.dx,o*t.dy,o*t.dz);Re(e.origin,e.origin,s),J(e)}function pi(t,e,i=!1){const o=i?-t.angle:t.angle;xt(e.basis1,e.basis1,wt,o),xt(e.basis2,e.basis2,wt,o),J(e)}function ci(t,e,i=!1){const o=i?1/t.factor1:t.factor1,s=i?1/t.factor2:t.factor2;_t(e.basis1,e.basis1,o),_t(e.basis2,e.basis2,s),$t(e.origin,e.origin,t.origin,t.axis1,o),$t(e.origin,e.origin,t.origin,t.axis2,s),J(e)}function Ii(t,e,i,o){o||(o=Pe());const s=E(Z.get(),t[1],-t[0]),n=E(Z.get(),Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),a=E(Z.get(),Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),u=Z.get();e.components.forEach(y=>y.vertices.forEach(g=>{const c=g.pos;E(u,Ot(t,c),Ot(s,c)),Se(n,n,u),Ue(a,a,u)}));const p=1e-6,h=E(Z.get(),a[0]-n[0]{(u.addedFeatures.length||u.updatedFeatures.length||u.deletedFeatures.length||u.addedAttachments.length||u.updatedAttachments.length||u.deletedAttachments.length)&&e.emit("edits",u)});const n={result:s.promise};e.emit("apply-edits",n)}try{const{results:n,edits:u}=await M(e,t,a,r),c=h=>h.filter(A=>!A.error).map(E),l={edits:u,addedFeatures:c(n.addFeatureResults),updatedFeatures:c(n.updateFeatureResults),deletedFeatures:c(n.deleteFeatureResults),addedAttachments:c(n.addAttachmentResults),updatedAttachments:c(n.updateAttachmentResults),deletedAttachments:c(n.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:n.editMoment?new Date(n.editMoment):null,globalIdToObjectId:r.globalIdToObjectId};return(d=n.editedFeatureResults)!=null&&d.length&&(l.editedFeatures=n.editedFeatureResults),s.resolve(l),n}catch(n){throw s.reject(n),n}}async function M(e,t,a,r){var p,d,n,u,c,l;if(await e.load(),!F(t))throw new i(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!S(e))throw new i(`${e.type}-layer:editing-disabled`,"Editing is disabled for layer",{layer:e});const{edits:s,options:o}=await W(e,a,r);return(p=s.addFeatures)!=null&&p.length||(d=s.updateFeatures)!=null&&d.length||(n=s.deleteFeatures)!=null&&n.length||(u=s.addAttachments)!=null&&u.length||(c=s.updateAttachments)!=null&&c.length||(l=s.deleteAttachments)!=null&&l.length?{edits:s,results:await t.applyEdits(s,o)}:{edits:s,results:{addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}}async function W(e,t,a){const r=g(e),s=t&&(t.addFeatures||t.updateFeatures||t.deleteFeatures),o=t&&(t.addAttachments||t.updateAttachments||t.deleteAttachments),p=e.infoFor3D!=null;if(H(t,r,a,!!s,!!o,`${e.type}-layer`),!r.data.isVersioned&&(a==null?void 0:a.gdbVersion))throw new i(`${e.type}-layer:invalid-parameter`,"'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");if(!r.editing.supportsRollbackOnFailure&&(a!=null&&a.rollbackOnFailureEnabled))throw new i(`${e.type}-layer:invalid-parameter`,"This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'");const d={...a};if(d.rollbackOnFailureEnabled!=null||r.editing.supportsRollbackOnFailure||(d.rollbackOnFailureEnabled=!0),d.rollbackOnFailureEnabled||d.returnServiceEditsOption!=="original-and-current-features"||(d.rollbackOnFailureEnabled===!1&&R.getLogger("esri.layers.graphics.editingSupport").warn(`${e.type}-layer:invalid-parameter`,"'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true, but 'rollBackOnFailure' was set to false. 'rollBackOnFailure' has been overwrritten and set to true."),d.rollbackOnFailureEnabled=!0),!r.editing.supportsReturnServiceEditsInSourceSpatialReference&&d.returnServiceEditsInSourceSR)throw new i(`${e.type}-layer:invalid-parameter`,"This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'");if(d.returnServiceEditsInSourceSR&&d.returnServiceEditsOption!=="original-and-current-features")throw new i(`${e.type}-layer:invalid-parameter`,"'returnServiceEditsInSourceSR' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'");const n=_(t,r,`${e.type}-layer`),u=(a==null?void 0:a.globalIdUsed)||p,c=e.fields.filter(l=>l.type==="big-integer"||l.type==="oid"&&(l.length||0)>=8);if(u){const{globalIdField:l}=e;if(l==null)throw new i(`${e.type}-layer:invalid-parameter`,"Layer does not specify a global id field.");n.addFeatures.forEach(h=>q(h,l))}return n.addFeatures.forEach(l=>z(l,e,u,c)),n.updateFeatures.forEach(l=>x(l,e,u,c)),n.deleteFeatures.forEach(l=>C(l,e,u,c)),n.addAttachments.forEach(l=>f(l,e)),n.updateAttachments.forEach(l=>f(l,e)),p&&await J(n,e),{edits:await N(n),options:d}}function y(e,t,a,r){var s,o;if(a){if("attributes"in e&&!e.attributes[t.globalIdField])throw new i(`${t.type}-layer:invalid-parameter`,`Feature should have '${t.globalIdField}' when 'globalIdUsed' is true`);if(!("attributes"in e)&&!e.globalId)throw new i(`${t.type}-layer:invalid-parameter`,"`'globalId' of the feature should be passed when 'globalIdUsed' is true")}if(r.length&&"attributes"in e)for(const p of r){const d=e.attributes[p.name];if(d!==void 0&&!V(p,d))throw new i(`${t.type}-layer:invalid-parameter`,`Big-integer field '${p.name}' of the feature must be less than ${Number.MAX_SAFE_INTEGER}`,{feature:e})}if("geometry"in e&&e.geometry!=null){if(e.geometry.hasZ&&((s=t.capabilities)==null?void 0:s.data.supportsZ)===!1)throw new i(`${t.type}-layer:z-unsupported`,"Layer does not support z values while feature has z values.");if(e.geometry.hasM&&((o=t.capabilities)==null?void 0:o.data.supportsM)===!1)throw new i(`${t.type}-layer:m-unsupported`,"Layer does not support m values while feature has m values.")}}function w(e,t){var a;if("geometry"in e&&((a=e.geometry)==null?void 0:a.type)==="mesh"&&t.infoFor3D!=null){const{geometry:r}=e;if(r.vertexSpace.isGeoreferenced)throw new i(`${t.type}-layer:georeferenced-mesh-unsupported`,"Uploading georeferenced meshes to a layer is not supported.")}}function z(e,t,a,r){y(e,t,a,r),w(e,t)}function C(e,t,a,r){y(e,t,a,r)}function x(e,t,a,r){y(e,t,a,r),w(e,t);const s=g(t);if("geometry"in e&&e.geometry!=null&&!(s!=null&&s.editing.supportsGeometryUpdate))throw new i(`${t.type}-layer:unsupported-operation`,"Layer does not support geometry updates.")}function f(e,t){var s;const{feature:a,attachment:r}=e;if(!a||"attributes"in a&&!a.attributes[t.globalIdField])throw new i(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to a feature with 'globalId'");if(!("attributes"in a)&&!a.globalId)throw new i(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to 'globalId' of the parent feature");if(!r.globalId)throw new i(`${t.type}-layer:invalid-parameter`,"Attachment should have 'globalId'");if(!r.data&&!r.uploadId)throw new i(`${t.type}-layer:invalid-parameter`,"Attachment should have 'data' or 'uploadId'");if(!(r.data instanceof File&&r.data.name)&&!r.name)throw new i(`${t.type}-layer:invalid-parameter`,"'name' is required when attachment is specified as Base64 encoded string using 'data'");if(!((s=t.capabilities)!=null&&s.editing.supportsUploadWithItemId)&&r.uploadId)throw new i(`${t.type}-layer:invalid-parameter`,"This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'");if(typeof r.data=="string"){const o=O(r.data);if(o&&!o.isBase64)throw new i(`${t.type}-layer:invalid-parameter`,"Attachment 'data' should be a Blob, File or Base64 encoded string")}}function q(e,t){const{attributes:a}=e;a[t]==null&&(a[t]=k())}async function N(e){const t=e.addFeatures??[],a=e.updateFeatures??[],r=t.concat(a).map(d=>d.geometry),s=await L(r),o=t.length,p=a.length;return s.slice(0,o).forEach((d,n)=>t[n].geometry=d),s.slice(o,o+p).forEach((d,n)=>a[n].geometry=d),e}function Z(e){return{addFeatures:Array.from((e==null?void 0:e.addFeatures)??[]),updateFeatures:Array.from((e==null?void 0:e.updateFeatures)??[]),deleteFeatures:e&&U.isCollection(e.deleteFeatures)?e.deleteFeatures.toArray():e.deleteFeatures||[],addAttachments:e.addAttachments||[],updateAttachments:e.updateAttachments||[],deleteAttachments:e.deleteAttachments||[]}}function _(e,t,a){var s,o,p;const r=Z(e);if((s=r.addFeatures)!=null&&s.length&&!t.operations.supportsAdd)throw new i(`${a}:unsupported-operation`,"Layer does not support adding features.");if((o=r.updateFeatures)!=null&&o.length&&!t.operations.supportsUpdate)throw new i(`${a}:unsupported-operation`,"Layer does not support updating features.");if((p=r.deleteFeatures)!=null&&p.length&&!t.operations.supportsDelete)throw new i(`${a}:unsupported-operation`,"Layer does not support deleting features.");return r.addFeatures=r.addFeatures.map(m),r.updateFeatures=r.updateFeatures.map(m),r.addAssetFeatures=[],r}function H(e,t,a,r,s,o){if(!e||!r&&!s)throw new i(`${o}:missing-parameters`,"'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required");if(!t.editing.supportsGlobalId&&(a!=null&&a.globalIdUsed))throw new i(`${o}:invalid-parameter`,"This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'");if(!t.editing.supportsGlobalId&&s)throw new i(`${o}:invalid-parameter`,"'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'");if(!(a!=null&&a.globalIdUsed)&&s)throw new i(`${o}:invalid-parameter`,"When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true")}function m(e){const t=new G;return e.attributes||(e.attributes={}),t.geometry=e.geometry,t.attributes=e.attributes,t}async function J(e,t){if(t.infoFor3D==null)return;const{infoFor3D:a}=t,r=j("model/gltf-binary",a.supportedFormats)??T("glb",a.supportedFormats);if(!(r&&a.editFormats.includes(r)))throw new i(`${t.type}-layer:binary-gltf-asset-not-supported`,"3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry.");e.addAssetFeatures??(e.addAssetFeatures=[]);const{addAssetFeatures:s}=e;for(const o of e.addFeatures??[])b(o)&&s.push(o);for(const o of e.updateFeatures??[])b(o)&&s.push(o)}function b(e){var t;return((t=e==null?void 0:e.geometry)==null?void 0:t.type)==="mesh"}function Y(e,t,a,r){if(!F(t))throw new i(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!t.uploadAssets)throw new i(`${e.type}-layer:no-asset-upload-support`,"Layer source does not support uploadAssets capability",{layer:e});return t.uploadAssets(a,r)}export{X as applyEdits,H as checkEditingCapabilities,Q as isFeatureIdentifierArrayWithGlobalId,P as isFeatureIdentifierArrayWithObjectId,D as isFeatureIdentifierWithGlobalId,B as isFeatureIdentifierWithObjectId,Z as normalizeCollections,_ as normalizeEdits,N as normalizeGeometries,m as shallowCloneFeature,Y as uploadAssets}; diff --git a/dist/assets/editingSupport-HfkJiqt7.js b/dist/assets/editingSupport-HfkJiqt7.js new file mode 100644 index 0000000..40127e0 --- /dev/null +++ b/dist/assets/editingSupport-HfkJiqt7.js @@ -0,0 +1 @@ +import{ae as I,af as v,ag as $,ah as E,r as i,ai as S,aj as b,R,ak as O,al as k,am as L,V as U,K as j,an as G,ao as T,ap as V}from"./index-pCX-0tJH.js";function F(e){return(e==null?void 0:e.applyEdits)!=null}function B(e){return typeof e=="object"&&e!=null&&"objectId"in e&&!!e.objectId}function J(e){return e.every(B)}function D(e){return typeof e=="object"&&e!=null&&"globalId"in e&&!!e.globalId}function P(e){return e.every(D)}async function Q(e,t,a,r={}){var d;let s;const o="gdbVersion"in e?e.gdbVersion:null,p=r.gdbVersion??o;if(I(e)&&e.url)s=v(e.url,e.layerId,p,r.returnServiceEditsOption==="original-and-current-features");else{s=$(),s.promise.then(u=>{(u.addedFeatures.length||u.updatedFeatures.length||u.deletedFeatures.length||u.addedAttachments.length||u.updatedAttachments.length||u.deletedAttachments.length)&&e.emit("edits",u)});const n={result:s.promise};e.emit("apply-edits",n)}try{const{results:n,edits:u}=await M(e,t,a,r),c=h=>h.filter(A=>!A.error).map(E),l={edits:u,addedFeatures:c(n.addFeatureResults),updatedFeatures:c(n.updateFeatureResults),deletedFeatures:c(n.deleteFeatureResults),addedAttachments:c(n.addAttachmentResults),updatedAttachments:c(n.updateAttachmentResults),deletedAttachments:c(n.deleteAttachmentResults),exceededTransferLimit:!1,historicMoment:n.editMoment?new Date(n.editMoment):null,globalIdToObjectId:r.globalIdToObjectId};return(d=n.editedFeatureResults)!=null&&d.length&&(l.editedFeatures=n.editedFeatureResults),s.resolve(l),n}catch(n){throw s.reject(n),n}}async function M(e,t,a,r){var p,d,n,u,c,l;if(await e.load(),!F(t))throw new i(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!S(e))throw new i(`${e.type}-layer:editing-disabled`,"Editing is disabled for layer",{layer:e});const{edits:s,options:o}=await W(e,a,r);return(p=s.addFeatures)!=null&&p.length||(d=s.updateFeatures)!=null&&d.length||(n=s.deleteFeatures)!=null&&n.length||(u=s.addAttachments)!=null&&u.length||(c=s.updateAttachments)!=null&&c.length||(l=s.deleteAttachments)!=null&&l.length?{edits:s,results:await t.applyEdits(s,o)}:{edits:s,results:{addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}}async function W(e,t,a){const r=b(e),s=t&&(t.addFeatures||t.updateFeatures||t.deleteFeatures),o=t&&(t.addAttachments||t.updateAttachments||t.deleteAttachments),p=e.infoFor3D!=null;if(K(t,r,a,!!s,!!o,`${e.type}-layer`),!r.data.isVersioned&&(a==null?void 0:a.gdbVersion))throw new i(`${e.type}-layer:invalid-parameter`,"'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");if(!r.editing.supportsRollbackOnFailure&&(a!=null&&a.rollbackOnFailureEnabled))throw new i(`${e.type}-layer:invalid-parameter`,"This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'");const d={...a};if(d.rollbackOnFailureEnabled!=null||r.editing.supportsRollbackOnFailure||(d.rollbackOnFailureEnabled=!0),d.rollbackOnFailureEnabled||d.returnServiceEditsOption!=="original-and-current-features"||(d.rollbackOnFailureEnabled===!1&&R.getLogger("esri.layers.graphics.editingSupport").warn(`${e.type}-layer:invalid-parameter`,"'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true, but 'rollBackOnFailure' was set to false. 'rollBackOnFailure' has been overwrritten and set to true."),d.rollbackOnFailureEnabled=!0),!r.editing.supportsReturnServiceEditsInSourceSpatialReference&&d.returnServiceEditsInSourceSR)throw new i(`${e.type}-layer:invalid-parameter`,"This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'");if(d.returnServiceEditsInSourceSR&&d.returnServiceEditsOption!=="original-and-current-features")throw new i(`${e.type}-layer:invalid-parameter`,"'returnServiceEditsInSourceSR' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'");const n=_(t,r,`${e.type}-layer`),u=(a==null?void 0:a.globalIdUsed)||p,c=e.fields.filter(l=>l.type==="big-integer"||l.type==="oid"&&(l.length||0)>=8);if(u){const{globalIdField:l}=e;if(l==null)throw new i(`${e.type}-layer:invalid-parameter`,"Layer does not specify a global id field.");n.addFeatures.forEach(h=>q(h,l))}return n.addFeatures.forEach(l=>z(l,e,u,c)),n.updateFeatures.forEach(l=>x(l,e,u,c)),n.deleteFeatures.forEach(l=>C(l,e,u,c)),n.addAttachments.forEach(l=>y(l,e)),n.updateAttachments.forEach(l=>y(l,e)),p&&await X(n,e),{edits:await N(n),options:d}}function f(e,t,a,r){var s,o;if(a){if("attributes"in e&&!e.attributes[t.globalIdField])throw new i(`${t.type}-layer:invalid-parameter`,`Feature should have '${t.globalIdField}' when 'globalIdUsed' is true`);if(!("attributes"in e)&&!e.globalId)throw new i(`${t.type}-layer:invalid-parameter`,"`'globalId' of the feature should be passed when 'globalIdUsed' is true")}if(r.length&&"attributes"in e)for(const p of r){const d=e.attributes[p.name];if(d!==void 0&&!V(p,d))throw new i(`${t.type}-layer:invalid-parameter`,`Big-integer field '${p.name}' of the feature must be less than ${Number.MAX_SAFE_INTEGER}`,{feature:e})}if("geometry"in e&&e.geometry!=null){if(e.geometry.hasZ&&((s=t.capabilities)==null?void 0:s.data.supportsZ)===!1)throw new i(`${t.type}-layer:z-unsupported`,"Layer does not support z values while feature has z values.");if(e.geometry.hasM&&((o=t.capabilities)==null?void 0:o.data.supportsM)===!1)throw new i(`${t.type}-layer:m-unsupported`,"Layer does not support m values while feature has m values.")}}function w(e,t){var a;if("geometry"in e&&((a=e.geometry)==null?void 0:a.type)==="mesh"&&t.infoFor3D!=null){const{geometry:r}=e;if(r.vertexSpace.isGeoreferenced)throw new i(`${t.type}-layer:georeferenced-mesh-unsupported`,"Uploading georeferenced meshes to a layer is not supported.")}}function z(e,t,a,r){f(e,t,a,r),w(e,t)}function C(e,t,a,r){f(e,t,a,r)}function x(e,t,a,r){f(e,t,a,r),w(e,t);const s=b(t);if("geometry"in e&&e.geometry!=null&&!(s!=null&&s.editing.supportsGeometryUpdate))throw new i(`${t.type}-layer:unsupported-operation`,"Layer does not support geometry updates.")}function y(e,t){var s;const{feature:a,attachment:r}=e;if(!a||"attributes"in a&&!a.attributes[t.globalIdField])throw new i(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to a feature with 'globalId'");if(!("attributes"in a)&&!a.globalId)throw new i(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to 'globalId' of the parent feature");if(!r.globalId)throw new i(`${t.type}-layer:invalid-parameter`,"Attachment should have 'globalId'");if(!r.data&&!r.uploadId)throw new i(`${t.type}-layer:invalid-parameter`,"Attachment should have 'data' or 'uploadId'");if(!(r.data instanceof File&&r.data.name)&&!r.name)throw new i(`${t.type}-layer:invalid-parameter`,"'name' is required when attachment is specified as Base64 encoded string using 'data'");if(!((s=t.capabilities)!=null&&s.editing.supportsUploadWithItemId)&&r.uploadId)throw new i(`${t.type}-layer:invalid-parameter`,"This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'");if(typeof r.data=="string"){const o=O(r.data);if(o&&!o.isBase64)throw new i(`${t.type}-layer:invalid-parameter`,"Attachment 'data' should be a Blob, File or Base64 encoded string")}}function q(e,t){const{attributes:a}=e;a[t]==null&&(a[t]=k())}async function N(e){const t=e.addFeatures??[],a=e.updateFeatures??[],r=t.concat(a).map(d=>d.geometry),s=await L(r),o=t.length,p=a.length;return s.slice(0,o).forEach((d,n)=>t[n].geometry=d),s.slice(o,o+p).forEach((d,n)=>a[n].geometry=d),e}function Z(e){return{addFeatures:Array.from((e==null?void 0:e.addFeatures)??[]),updateFeatures:Array.from((e==null?void 0:e.updateFeatures)??[]),deleteFeatures:e&&U.isCollection(e.deleteFeatures)?e.deleteFeatures.toArray():e.deleteFeatures||[],addAttachments:e.addAttachments||[],updateAttachments:e.updateAttachments||[],deleteAttachments:e.deleteAttachments||[]}}function _(e,t,a){var s,o,p;const r=Z(e);if((s=r.addFeatures)!=null&&s.length&&!t.operations.supportsAdd)throw new i(`${a}:unsupported-operation`,"Layer does not support adding features.");if((o=r.updateFeatures)!=null&&o.length&&!t.operations.supportsUpdate)throw new i(`${a}:unsupported-operation`,"Layer does not support updating features.");if((p=r.deleteFeatures)!=null&&p.length&&!t.operations.supportsDelete)throw new i(`${a}:unsupported-operation`,"Layer does not support deleting features.");return r.addFeatures=r.addFeatures.map(m),r.updateFeatures=r.updateFeatures.map(m),r.addAssetFeatures=[],r}function K(e,t,a,r,s,o){if(!e||!r&&!s)throw new i(`${o}:missing-parameters`,"'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required");if(!t.editing.supportsGlobalId&&(a!=null&&a.globalIdUsed))throw new i(`${o}:invalid-parameter`,"This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'");if(!t.editing.supportsGlobalId&&s)throw new i(`${o}:invalid-parameter`,"'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'");if(!(a!=null&&a.globalIdUsed)&&s)throw new i(`${o}:invalid-parameter`,"When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true")}function m(e){const t=new j;return e.attributes||(e.attributes={}),t.geometry=e.geometry,t.attributes=e.attributes,t}async function X(e,t){if(t.infoFor3D==null)return;const{infoFor3D:a}=t,r=G("model/gltf-binary",a.supportedFormats)??T("glb",a.supportedFormats);if(!(r&&a.editFormats.includes(r)))throw new i(`${t.type}-layer:binary-gltf-asset-not-supported`,"3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry.");e.addAssetFeatures??(e.addAssetFeatures=[]);const{addAssetFeatures:s}=e;for(const o of e.addFeatures??[])g(o)&&s.push(o);for(const o of e.updateFeatures??[])g(o)&&s.push(o)}function g(e){var t;return((t=e==null?void 0:e.geometry)==null?void 0:t.type)==="mesh"}function Y(e,t,a,r){if(!F(t))throw new i(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!t.uploadAssets)throw new i(`${e.type}-layer:no-asset-upload-support`,"Layer source does not support uploadAssets capability",{layer:e});return t.uploadAssets(a,r)}export{Q as applyEdits,K as checkEditingCapabilities,P as isFeatureIdentifierArrayWithGlobalId,J as isFeatureIdentifierArrayWithObjectId,D as isFeatureIdentifierWithGlobalId,B as isFeatureIdentifierWithObjectId,Z as normalizeCollections,_ as normalizeEdits,N as normalizeGeometries,m as shallowCloneFeature,Y as uploadAssets}; diff --git a/dist/assets/editingTools-1yHclJT1.js b/dist/assets/editingTools-1yHclJT1.js deleted file mode 100644 index dc3b45b..0000000 --- a/dist/assets/editingTools-1yHclJT1.js +++ /dev/null @@ -1 +0,0 @@ -import{a3 as ft,J as Y,d as $,a2 as G,T as b,S as M,hq as Ot,e as h,y as d,P as Lt,n as U,c as J,ab as $t,Q as St,gk as Vt,e1 as Z,pj as dt,O as rt,fd as wt,pk as bt,ag as Dt,pl as Ht,kn as Pt,aa as v,aE as H,nX as q,a9 as Tt,n_ as K,e4 as Ut,cM as B,aU as L,hL as zt,hJ as Et,aQ as z,ax as _t,a0 as It,al as Ft,e2 as ut,au as st,l as Nt,aF as jt,at as O,hP as W,bX as Bt,kz as mt,kS as Wt,pm as Xt,pn as Kt,p as Yt}from"./index-J0iiHjMT.js";import{S as Zt}from"./SnappingVisualizer2D-NnEm1PvQ.js";import{K as qt,X as Jt,V as Gt,l as Qt}from"./editPlaneUtils-4qxd7h1E.js";import{k as te,a as ee}from"./surfaceCoordinateSystems-siQq4eBA.js";import{d as nt,v as lt,l as kt,U as Rt}from"./InteractiveToolBase-WDic4GPF.js";import{s as ie,S as ht}from"./GraphicManipulator-ku6oRBpa.js";import{E,V as Mt,e as ct,p as se}from"./EditGeometryOperations-TPE5Wzab.js";import{m as ae}from"./drawUtils-woTYaREB.js";import"./SnappingContext-6K6JmvvY.js";import"./PointSnappingHint-ULetRXiW.js";import"./measurementUtils-84-ZBArh.js";import"./Tooltip-ON77BKb3.js";import"./euclideanLengthMeasurementUtils-VQw5qWk6.js";import"./quantityFormatUtils-NiAiojad.js";import"./automaticAreaMeasurementUtils-nVd6Y5mX.js";import"./euclideanAreaMeasurementUtils-zmzttSyV.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./SnappingDragPipelineStep-THHIXt-p.js";import"./SnappingOperation-2U48wt1k.js";import"./drapedUtils-9db1OpTX.js";const oe=new ft({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[3.75,3.75],lineDashEnding:"HalfPattern",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:1.6,color:[255,255,255,255]},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:2,color:[0,0,0,255]}]}}}),re=new Y({style:"circle",size:6,color:[127,127,127,1],outline:{color:[50,50,50],width:1}}),ne=new Y({style:"circle",size:6,color:[255,127,0,1],outline:{color:[50,50,50],width:1}});let D=class extends qt{constructor(e){super(e),this._visualElementGraphics={outline:null,regularVertices:null,activeVertex:null},this.activeFillSymbol=null,this.type="draw-2d",this._visualElementSymbols={outline:e.activeLineSymbol??oe,regularVertices:e.regularVerticesSymbol??re,activeVertex:e.activeVertexSymbol??ne,fill:e.activeFillSymbol},e.activeVertexSymbol||this.addHandles($(()=>{var t,s;return(s=(t=this.view)==null?void 0:t.effectiveTheme)==null?void 0:s.accentColor},t=>{var i;if(!t)return;const s=this._visualElementSymbols.activeVertex.clone().set({color:t});(i=this._visualElementGraphics.activeVertex)==null||i.set("symbol",s),this._visualElementSymbols={...this._visualElementSymbols,activeVertex:s}},Lt))}normalizeCtorArgs(e){const t={...e};return delete t.activeFillSymbol,delete t.activeVertexSymbol,delete t.regularVerticesSymbol,delete t.activeLineSymbol,t}initializeGraphic(e){return this._visualElementSymbols.fill!=null&&(e.symbol=this._visualElementSymbols.fill),G()}makeDrawOperation(){const{defaultZ:e,hasZ:t,view:s}=this;return this._createOrUpdateGraphic(null),new te({view:s,manipulators:this.manipulators,geometryType:Jt(this.geometryType),drawingMode:this.mode,hasZ:t,defaultZ:e,snapToSceneEnabled:this.snapToScene,drawSurface:new ee(s,t,e),hasM:!1,snappingManager:this.snappingManager,snappingVisualizer:new Zt(this.internalGraphicsLayer),tooltipOptions:this.tooltipOptions,graphic:this.graphic,cursor:this.cursor})}onActiveVertexChanged(e){if(this.geometryType==="point")return G();const[t,s]=e,i=new b({x:t,y:s,spatialReference:this.view.spatialReference});return this._visualElementGraphics.activeVertex!=null?(this._visualElementGraphics.activeVertex.geometry=i,G()):(this._visualElementGraphics.activeVertex=new M({geometry:i,symbol:this._visualElementSymbols.activeVertex,attributes:{displayOrder:2}}),this.internalGraphicsLayer.add(this._visualElementGraphics.activeVertex),this.internalGraphicsLayer.graphics.sort(at),G(()=>{this._visualElementGraphics.activeVertex!=null&&(this.internalGraphicsLayer.remove(this._visualElementGraphics.activeVertex),this._visualElementGraphics.activeVertex=U(this._visualElementGraphics.activeVertex))}))}onOutlineChanged(e){const t=e.clone();if(t.type==="polyline"){const s=t.paths[t.paths.length-1];s.splice(0,s.length-2)}return this._visualElementGraphics.outline!=null?(this._visualElementGraphics.outline.geometry=t,G()):(this._visualElementGraphics.outline=new M({geometry:t,symbol:this._visualElementSymbols.outline,attributes:{displayOrder:0}}),this.internalGraphicsLayer.add(this._visualElementGraphics.outline),this.internalGraphicsLayer.graphics.sort(at),G(()=>{this._visualElementGraphics.outline!=null&&(this.internalGraphicsLayer.remove(this._visualElementGraphics.outline),this._visualElementGraphics.outline=U(this._visualElementGraphics.outline))}))}onRegularVerticesChanged(e){const t=new Ot({points:e,spatialReference:this.view.spatialReference});return this._visualElementGraphics.regularVertices!=null?(this._visualElementGraphics.regularVertices.geometry=t,G()):(this._visualElementGraphics.regularVertices=new M({geometry:t,symbol:this._visualElementSymbols.regularVertices,attributes:{displayOrder:1}}),this.internalGraphicsLayer.add(this._visualElementGraphics.regularVertices),this.internalGraphicsLayer.graphics.sort(at),G(()=>{this._visualElementGraphics.regularVertices!=null&&(this.internalGraphicsLayer.remove(this._visualElementGraphics.regularVertices),this._visualElementGraphics.regularVertices=U(this._visualElementGraphics.regularVertices))}))}};function at(e,t){var s,i;return(((s=e.attributes)==null?void 0:s.displayOrder)??-1/0)-(((i=t.attributes)==null?void 0:i.displayOrder)??-1/0)}h([d()],D.prototype,"activeFillSymbol",void 0),h([d({readOnly:!0})],D.prototype,"type",void 0),h([d({constructOnly:!0,nonNullable:!0})],D.prototype,"view",void 0),D=h([J("esri.views.2d.interactive.draw.DrawGraphicTool2D")],D);let pt=class{get hovering(){return this.someManipulator(t=>t.hovering)}get grabbing(){return this.someManipulator(t=>t.grabbing)}get dragging(){return this.someManipulator(t=>t.dragging)}hasManipulator(t){return this.someManipulator(s=>s===t)}someManipulator(t){let s=!1;return this.forEachManipulator(i=>{!s&&t(i)&&(s=!0)}),s}};var I;(function(e){e[e.TRANSLATE_XY=0]="TRANSLATE_XY",e[e.SCALE=1]="SCALE",e[e.ROTATE=2]="ROTATE"})(I||(I={}));let At=class extends pt{constructor(t){super(),this._view=t.view,this._tool=t.tool,this._graphic=t.graphic,this._manipulator=this._createManipulator(),this.forEachManipulator(s=>this._tool.manipulators.add(s))}destroy(){this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._manipulator=null,this._graphic=null}forEachManipulator(t){t(this._manipulator,I.TRANSLATE_XY)}createDragPipeline(t,s){let i=null,a=null,r=0,n=0,o=0;const{offsetX:c,offsetY:p,size:u}=ie(this._graphic.symbol);return nt(this._manipulator,(m,P)=>{P.next(g=>{if(g.action==="start"){const l=t();i=l.editGeometryOperations,a=l.constraints}return g}).next(lt(this._view)).next(g=>{const{x:l,y:_,z:y}=g.mapEnd;if(a&&(l+ca.xmax||_+p-u>a.ymax))return g;(g.action==="start"||r===0&&n===0&&o===0)&&(r=g.mapStart.x,n=g.mapStart.y,o=g.mapStart.z);const f=l-r,V=_-n,A=y-o;r=l,n=_,o=y;const C=[];for(const tt of i.data.components)C.push(...tt.vertices);const F=g.action==="start"?E.NEW_STEP:E.ACCUMULATE_STEPS,Q=i.moveVertices(C,f,V,A,F);return s(g,Q),g})})}_createManipulator(){const t=this._view,s=this._graphic;return new ht({view:t,graphic:s,selectable:!0,cursor:"move"})}};const T={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",toggleOpacity:"t",shift:"Shift",primaryKey:bt},le=1,he=10,gt=new $t("#009AF2");let R=class extends kt{constructor(e){super(e),this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this._initialControlPoints=null,this._graphicsLayer=new St({internal:!0,listMode:"hide",visible:!1,effect:"drop-shadow(0px, 0px, 3px)"}),this._undoStack=[],this._redoStack=[],this._sharedUndoStack=[],this._sharedRedoStack=[],this._highlightHandle=null,this.activeHandle=0}initialize(){this._initialize()}destroy(){const{map:e}=this.view;this._controlPointManipulations.forEach(t=>t.destroy()),this._controlPointEditGeometryOperations.forEach(t=>t.destroy()),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=U(this._graphicsLayer),this._georeference=null,this._controlPointGraphics=null,this._controlPointManipulations=null,this._graphicsLayer=null,this._controlPointEditGeometryOperations=null,this._undoStack=null,this._redoStack=null,this._initialControlPoints=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _hasValidSpatialReference(){return Vt(this.view.spatialReference)}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){const e=this._undoStack[this._undoStack.length-1];return e!=null&&this._controlPointEditGeometryOperations[e].canUndo}canRedo(){const e=this._redoStack[this._redoStack.length-1];return e!=null&&this._controlPointEditGeometryOperations[e].canRedo}undo(){if(this._undoStack.length>0){const e=this._undoStack.pop();this._controlPointEditGeometryOperations[e].undo(),this.updateGraphics(),this._redoStack.push(e)}}redo(){if(this._redoStack.length>0){const e=this._redoStack.pop();this._controlPointEditGeometryOperations[e].redo(),this.updateGraphics(),this._undoStack.push(e)}}refresh(){const{mediaElement:e}=this;if(e.georeference==null)return;const t=e.georeference;t.type==="control-points"&&t.coords!=null&&(this._georeference=t,this._georeference.controlPoints.forEach(({mapPoint:s},i)=>{const a=this._controlPointEditGeometryOperations[i],r=a.data.components[0].vertices[0];a.setVertexPosition(r,a.data.coordinateHelper.pointToVector(s))}),this.updateGraphics())}reset(){this._georeference.controlPoints=this._initialControlPoints,this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const e=this._georeference,t=e.controlPoints,s=t[0].mapPoint.spatialReference,i=this._hasValidSpatialReference;this._georeference.controlPoints=this._controlPointEditGeometryOperations.map((a,r)=>{const n=a.data.geometry;return this._controlPointGraphics[r].geometry=n,{mapPoint:Z(n,s),sourcePoint:i?t[r].sourcePoint:e.toSource(n)}})}updateActiveHandle(e){if(this.activeHandle===e)return;const t=this._controlPointGraphics[this.activeHandle].symbol.clone();dt(t,this.view.effectiveTheme.accentColor),this._controlPointGraphics[this.activeHandle].symbol=t;const s=this._controlPointGraphics[e].symbol.clone();dt(s,gt),this._controlPointGraphics[e].symbol=s,this.activeHandle=e,this.view.surface===document.activeElement&&this.highlightActiveHandle()}async highlightActiveHandle(){this.removeHighlightActiveHandle();const e=await this.view.whenLayerView(this._graphicsLayer);this._highlightHandle=e.highlight(this._controlPointGraphics[this.activeHandle])}removeHighlightActiveHandle(){this._highlightHandle&&this._highlightHandle.remove()}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){const{view:e,mediaElement:t}=this;if(t.georeference==null)return;const s=t.georeference;s.type==="control-points"&&s.coords!=null&&(this._georeference=s,this._initialControlPoints=this._georeference.controlPoints,e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._controlPointEditGeometryOperations=this._georeference.controlPoints.map(({mapPoint:i})=>Mt.fromGeometry(Z(i,e.spatialReference),rt.Local)),this._controlPointGraphics=this._controlPointEditGeometryOperations.map((i,a)=>new M({symbol:new ft({data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,colorLocked:!0,anchorPoint:{x:0,y:-15.75},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:9,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:84.3,ymax:84.3},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[83.2,32.5],[84.3,40.7],[83.8,48.9],[81.7,56.9],[78.1,64.3],[73,70.9],[66.9,76.4],[59.7,80.5],[51.9,83.2],[43.7,84.3],[35.4,83.8],[27.4,81.7],[20,78],[13.4,73],[7.9,66.8],[3.8,59.7],[1.1,51.9],[0,43.7],[.5,35.4],[2.6,27.4],[6.3,20],[11.3,13.4],[17.5,7.9],[24.7,3.8],[32.5,1.1],[39.8,.1],[47.1,.3],[54.3,1.8],[61.1,4.5],[67.4,8.4],[72.9,13.3],[77.4,19.1],[80.9,25.5],[83.2,32.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[84.3,0],[84.3,84.3],[0,84.3],[0,0]]]}},rotation:0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:-11.25},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:22.5,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:197.7,ymax:294.7},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[98.9,0],[119.4,23.2],[139.4,49.3],[156.8,75.2],[171.2,100.8],[182.4,125.3],[190.6,148.8],[195.7,171.4],[197.7,192.9],[197.7,195.8],[197.7,200.3],[197.6,202.5],[197.5,204.8],[197.3,207.1],[197,209.4],[196.7,211.7],[196.4,214.1],[196,216.4],[195.5,218.7],[195,221.1],[194.4,223.4],[193.7,225.8],[193,228.1],[192.2,230.5],[191.4,232.8],[190.5,235.1],[189.5,237.5],[188.5,239.7],[187.4,242],[186.2,244.3],[185,246.5],[183.7,248.7],[182.4,250.9],[181,253.1],[179.5,255.2],[178,257.3],[176.4,259.4],[174.7,261.4],[173.1,263.3],[171.3,265.3],[169.5,267.2],[167.7,269],[165.8,270.8],[163.9,272.5],[161.9,274.2],[159.9,275.8],[157.8,277.4],[155.7,278.9],[153.6,280.4],[151.4,281.7],[149.2,283.1],[147,284.4],[144.8,285.6],[142.5,286.7],[140.3,287.8],[138,288.8],[135.7,289.8],[133.4,290.7],[131,291.5],[128.7,292.3],[126.4,293],[124,293.6],[121.7,294.2],[119.4,294.7],[117,295.2],[114.7,295.6],[112.4,296],[110.1,296.3],[107.8,296.5],[105.5,296.7],[103.3,296.8],[101.1,296.9],[98.8,296.9],[83.1,295.7],[67.8,292],[53.3,285.9],[39.9,277.5],[28.1,267.2],[18,255.1],[10,241.5],[4.2,226.9],[.9,211.5],[0,195.8],[.1,192.9],[2.1,171.4],[7.2,148.8],[15.4,125.3],[26.6,100.8],[41,75.2],[58.4,49.3],[78.4,23.2],[98.9,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:a===this.activeHandle?gt.toArray():this.view.effectiveTheme.accentColor.toArray()}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[197.7,0],[197.7,294.7],[0,294.7],[0,0]]]}},rotation:0}],haloSize:1,scaleX:1,angleAlignment:"Display",angle:0}}}),geometry:i.data.geometry})),this._graphicsLayer.graphics.addMany([...this._controlPointGraphics]),this._controlPointManipulations=this._controlPointGraphics.map(i=>new At({tool:this,view:e,graphic:i})),this.addHandles([...this._controlPointManipulations.map((i,a)=>i.createDragPipeline(this._getInfo.bind(this,a),(r,n)=>{r.action==="start"&&(this._undoStack.push(a),this._redoStack=[],this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0),this.updateGraphics()})),$(()=>this.view.scale,()=>this.active?this.updateGraphics():null)]),this._controlPointManipulations.forEach((i,a)=>{const r=n=>{this.addHandles([n.events.on(["click","grab-changed"],o=>this.updateActiveHandle(a))])};i.forEachManipulator(r)}),this.addHandles([e.on("key-down",i=>{e.activeTool===this&&(i.key!==T.shift||i.repeat||(this._isModifierActive=!0,i.stopPropagation()),i.key!==T.toggleOpacity||i.repeat||(t.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled,i.stopPropagation()),i.key!==T.primaryKey||i.repeat||(this._factor=he,i.stopPropagation()),this._isModifierActive&&(i.key===T.up&&(this._move(0,this._factor),i.stopPropagation()),i.key===T.down&&(this._move(0,-this._factor),i.stopPropagation()),i.key===T.left&&(this._move(-this._factor,0),i.stopPropagation()),i.key===T.right&&(this._move(this._factor,0),i.stopPropagation())))}),e.on("key-up",i=>{e.activeTool===this&&(i.key===T.shift&&(this._isModifierActive=!1,i.stopPropagation()),i.key===T.primaryKey&&(this._factor=le,i.stopPropagation()))})]))}async _loadProjectionEngine(){const e=this._georeference.controlPoints[0].mapPoint;return wt(e.spatialReference,this.view.spatialReference)}_getInfo(e){return{editGeometryOperations:this._controlPointEditGeometryOperations[e],constraints:this._hasValidSpatialReference?null:{xmin:0,ymin:0,xmax:this._georeference.width,ymax:this._georeference.height}}}_move(e,t){const s=this._controlPointEditGeometryOperations[this.activeHandle],i=[];for(const r of s.data.components)i.push(...r.vertices);const a=s.moveVertices(i,e*this.view.resolution,t*this.view.resolution,0,E.NEW_STEP);this._sharedUndoStack.push({tool:this,operation:a}),this._sharedRedoStack.length=0,this.updateGraphics()}};h([d()],R.prototype,"_hasValidSpatialReference",null),h([d()],R.prototype,"activeHandle",void 0),h([d({constructOnly:!0,nonNullable:!0})],R.prototype,"mediaElement",void 0),h([d({constructOnly:!0})],R.prototype,"view",void 0),R=h([J("esri.views.2d.interactive.editingTools.ControlPointsTransformTool")],R);function xt(e,t){e.action==="start"?t.cursor="grabbing":t.cursor="grab"}class ce{constructor(){this._lastDragEvent=null,this.next=new Rt,this._enabled=!1}get enabled(){return this._enabled}set enabled(t){if(this._enabled!==t&&this._lastDragEvent!=null){const s={...this._lastDragEvent,action:"update"};t&&this._adjustScaleFactors(s),this.next.execute(s)}this._enabled=t}createDragEventPipelineStep(){return this._lastDragEvent=null,t=>(this._lastDragEvent=t.action!=="end"?{...t}:null,this._enabled&&this._adjustScaleFactors(t),t)}_adjustScaleFactors(t){const s=t.direction[0]!==0&&t.direction[1]!==0?Math.max(Math.abs(t.factor1),Math.abs(t.factor2)):t.direction[0]===0?Math.abs(t.factor2):Math.abs(t.factor1);t.factor1=t.factor1<0?-s:s,t.factor2=t.factor2<0?-s:s}}class pe{constructor(){this._lastDragEvent=null,this.next=new Rt,this._enabled=!1}get enabled(){return this._enabled}set enabled(t){if(this._enabled!==t&&this._lastDragEvent!=null){const s={...this._lastDragEvent,action:"update"};t&&this._adjustRotateAngle(s),this.next.execute(s)}this._enabled=t}createDragEventPipelineStep(){return this._lastDragEvent=null,t=>(this._lastDragEvent=t.action!=="end"?{...t}:null,this._enabled&&this._adjustRotateAngle(t),t)}_adjustRotateAngle(t){const s=Dt(t.rotateAngle);t.rotateAngle=Ht(5*Math.round(s/5))}}class de extends pt{constructor(t){super(),this._handles=new Pt,this._originCache=v(),this._view=t.view,this._tool=t.tool,this._graphic=t.graphic,this._snapRotation=t.snapRotation,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on("grab-changed",s=>xt(s,this._manipulator))]),this.forEachManipulator(s=>this._tool.manipulators.add(s))}destroy(){this._handles.destroy(),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._manipulator=null,this._snapRotation=null,this._graphic=null,this._handles=null,this._originCache=null}forEachManipulator(t){t(this._manipulator,I.ROTATE)}createDragPipeline(t,s){let i=null,a=null;return nt(this._manipulator,(r,n)=>{n.next(o=>{if(o.action==="start"){r.cursor="grabbing";const c=t();i=c.plane,a=c.editGeometryOperations}return o}).next(lt(this._view)).next(o=>({...o,rotateAngle:ae(o.mapStart,o.mapEnd,{x:i.origin[0],y:i.origin[1]},!0)})).next(this._snapRotation.createDragEventPipelineStep(),this._snapRotation.next).next(o=>{const c=H(this._originCache,i.origin),p=[];for(const P of a.data.components)p.push(...P.vertices);const u=o.action==="start"?E.NEW_STEP:E.ACCUMULATE_STEPS,m=a.rotateVertices(p,c,o.rotateAngle,u,ct.REPLACE);return Gt(m,i),s(o,m),o}).next(o=>(o.action==="end"&&(r.cursor="grab"),o))})}_createManipulator(){const t=this._view,s=this._graphic;return new ht({view:t,graphic:s,selectable:!0,cursor:"grab"})}}const ot=10,yt=1e-6,_e=.3;function vt(e){const t=z(e.basis1),s=z(e.basis2);return _e*Math.min(t,s)}class ue extends pt{constructor(t){super(),this._handles=new Pt,this._planeStart=q(),this._displayPlaneStart=q(),this._originCache=v(),this._axisCache=Tt(),this._renderStartCache=v(),this._renderEndCache=v(),this._resizeOriginCache=v(),this._view=t.view,this._tool=t.tool,this._graphic=t.graphic,this._direction=t.direction,this._preserveAspectRatio=t.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on("grab-changed",s=>xt(s,this._manipulator))]),this.forEachManipulator(s=>this._tool.manipulators.add(s))}destroy(){this._handles.destroy(),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(t){t(this._manipulator,I.SCALE)}createDragPipeline(t,s){let i=null,a=null,r=null,n=0,o=null,c=null;const p=this._planeStart,u=this._displayPlaneStart,m=this._direction;return nt(this._manipulator,(P,g)=>{g.next(l=>{if(l.action==="start"){P.cursor="grabbing";const _=t();i=_.plane,a=_.displayPlane,r=_.editGeometryOperations,n=ot*this._view.resolution,K(i,p),K(a,u);const y=Ut(r.data.spatialReference);o=y?y.valid[1]-y.valid[0]-3*ot*this._view.resolution:null}return l}).next(lt(this._view)).next(l=>{const _=H(this._renderStartCache,[l.mapStart.x,l.mapStart.y,0]),y=H(this._renderEndCache,[l.mapEnd.x,l.mapEnd.y,0]),f=H(this._resizeOriginCache,u.origin);B(f,f,u.basis1,-m[0]),B(f,f,u.basis2,-m[1]),L(y,y,f),L(_,_,f);const V=m[0]!==0&&m[1]!==0,A=vt(u),C=vt(a)/A,F=(et,it)=>{if(et===0)return 1;let x=z(it),N=.5*et*_t(it,y)/x;const j=N<0?-1:1;V&&(N+=(x-.5*et*_t(it,_)/x)*j*C);const Ct=x<1.5*n?1:yt;return x=Math.max(x-n,yt),j>0&&(N-=ot*this._view.resolution),j*Math.max(j*(N/x),Ct)},Q=F(m[0],u.basis1),tt=F(m[1],u.basis2);return{...l,direction:m,factor1:Q,factor2:tt}}).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(l=>{const _=H(this._originCache,p.origin);B(_,_,p.basis1,-m[0]),B(_,_,p.basis2,-m[1]);const y=zt(this._axisCache,p.basis1[0],p.basis1[1]);Et(y,y);const f=[];for(const C of r.data.components)f.push(...C.vertices);const V=l.action==="start"?E.NEW_STEP:E.ACCUMULATE_STEPS,A=r.scaleVertices(f,_,y,l.factor1,l.factor2,V,ct.REPLACE);return o&&o(l.action==="end"&&(P.cursor="grab"),l))})}_createManipulator(){return new ht({view:this._view,graphic:this._graphic,selectable:!0,cursor:"grab"})}}const S={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",plus:"+",minus:"-",toggleOpacity:"t",shift:"Shift",primaryKey:bt},me=80,ge=10,ye=30,ve=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]],fe=1,Se=10;let w=class extends kt{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=q(),this._displayPlaneCache=q(),this._mainAxisCache=Tt(),this._rotationHandleCache=v(),this._cornerA=v(),this._cornerB=v(),this._cornerC=v(),this._cornerD=v(),this._avgAB=v(),this._avgBC=v(),this._avgCD=v(),this._avgDA=v(),this._preserveAspectRatio=new ce,this._snapRotation=new pe,this._graphicsLayer=new St({internal:!0,listMode:"hide",visible:!1}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this.preserveAspectRatio=null,this.snapRotation=null}initialize(){this._initialize()}destroy(){const{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach(t=>t.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=U(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){const e=this._graphic.geometry;if(e==null)return null;const t=this._editGeometryOperations.data,s=t.components[0].edges[0],i=It(this._mainAxisCache,s.leftVertex.pos,s.rightVertex.pos);Et(i,i);let a=me*this.view.resolution;const r=this.view.spatialReference;return Ft(r,e.spatialReference)&&(a*=ut(r)/ut(e.spatialReference)),Qt(i,t,a,this._planeCache)}get _displayPlane(){const e=this._plane;if(!e)return null;const t=this._displayPlaneCache;K(e,t);const s=ge*this.view.resolution;return st(t.basis1,t.basis1,1+s/z(t.basis1)),st(t.basis2,t.basis2,1+s/z(t.basis2)),t}get _backgroundGraphicGeometry(){const e=this._displayPlane;if(!e)return null;const t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new Nt({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){const e=this._plane;if(!e)return null;const t=this._rotationHandleCache;return jt(t,e.basis1),st(t,t,ye*this.view.resolution),O(t,t,e.origin),O(t,t,e.basis1),new b({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){const e=this._displayPlane;if(!e)return[];const t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);const{_cornerA:s,_cornerB:i,_cornerC:a,_cornerD:r}=this,n=W(this._avgAB,s,i,.5),o=W(this._avgBC,i,a,.5),c=W(this._avgCD,a,r,.5),p=W(this._avgDA,r,s,.5);return[new b({x:s[0],y:s[1],spatialReference:t}),new b({x:i[0],y:i[1],spatialReference:t}),new b({x:a[0],y:a[1],spatialReference:t}),new b({x:r[0],y:r[1],spatialReference:t}),new b({x:n[0],y:n[1],spatialReference:t}),new b({x:o[0],y:o[1],spatialReference:t}),new b({x:c[0],y:c[1],spatialReference:t}),new b({x:p[0],y:p[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){const{view:e,target:t}=this,s="georeference"in t?t.georeference.coords:t.geometry,i=this._editGeometryOperations,a=i.data.components[0].vertices,r=se.fromGeometry(Z(s,e.spatialReference),rt.Local).components[0].vertices;a.forEach((n,o)=>{i.setVertexPosition(n,r[o].pos)}),this.updateGraphics()}reset(){const{target:e}=this;if("georeference"in e){const t=e.georeference;t.type==="control-points"&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const e=this._editGeometryOperations.data.geometry;"georeference"in this.target&&(this.target.georeference.coords=e),this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach((t,s)=>{this._scaleGraphics[s].geometry=t})}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){const{view:e,target:t}=this;if("georeference"in t){const i=t.georeference;this._graphic=new M({geometry:i.coords}),this._initialControlPoints=i.type==="control-points"?i.controlPoints:null}else this._graphic=t,this._initialGeometry=t.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=Mt.fromGeometry(Z(this._graphic.geometry,e.spatialReference),rt.Local),this._backgroundGraphic=new M({symbol:new Bt({color:"transparent",outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new M({symbol:new Y({color:mt(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map(i=>new M({symbol:new Y({size:6,style:"square",color:mt(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:i})),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new At({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new de({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map((i,a)=>new ue({tool:this,view:e,graphic:i,direction:ve[a],preserveAspectRatio:this._preserveAspectRatio})),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map(i=>i.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this))),$(()=>this.view.scale,()=>this.active?this.updateGraphics():null),e.on("click",async i=>{if(e.activeTool!=null&&e.activeTool!==this)return;const a=Wt(i),r=[];e.map.allLayers.forEach(c=>{c.type!=="vector-tile"&&c.type!=="imagery"||r.push(c)});const n=await this.view.hitTest(a,{exclude:r}),o=n.results;if(o.length===0)e.activeTool=null;else{const c=Xt(n.results),p="georeference"in t,u=o.map(P=>P.type==="media"?P.element:null).filter(Boolean),m=new Set([...this._graphicsLayer.graphics,p?null:t].filter(Boolean));p&&u.includes(t)||c!=null&&m.has(c.graphic)?e.activeTool==null&&(e.activeTool=this):e.activeTool=null}})]);const s=i=>{this.addHandles(i.events.on("grab-changed",a=>{"georeference"in t&&(a.action==="start"?t.opacity*=.5:a.action==="end"&&(t.opacity*=2))}))};this._dragManipulation.forEachManipulator(s),this._rotateManipulation.forEachManipulator(s),this._scaleManipulations.forEach(i=>i.forEachManipulator(s)),this.addHandles([e.on("key-down",i=>{e.activeTool===this&&(i.key!==S.shift||i.repeat||(this.preserveAspectRatio==null&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),this.snapRotation==null&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!0,i.stopPropagation()),i.key!==S.toggleOpacity||i.repeat||("georeference"in t&&(t.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled),i.stopPropagation()),i.key!==S.primaryKey||i.repeat||(this._factor=Se,i.stopPropagation()),this._isModifierActive&&(i.key===S.plus&&(this._scale(this._factor),i.stopPropagation()),i.key===S.minus&&(this._scale(-this._factor),i.stopPropagation()),i.key===S.up&&(this._move(0,this._factor),i.stopPropagation()),i.key===S.down&&(this._move(0,-this._factor),i.stopPropagation()),i.key===S.left&&(this._move(-this._factor,0),i.stopPropagation()),i.key===S.right&&(this._move(this._factor,0),i.stopPropagation())))}),e.on("key-up",i=>{e.activeTool===this&&(i.key===S.shift&&(this.preserveAspectRatio==null&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),this.snapRotation==null&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!1,i.stopPropagation()),i.key===S.primaryKey&&(this._factor=fe,i.stopPropagation()))})])}async _loadProjectionEngine(){const e=this._graphic.geometry;return wt(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){const{basis1:t,basis2:s,origin:i}=e,a=this._cornerA;O(a,i,t),O(a,a,s);const r=this._cornerB;O(r,i,t),L(r,r,s);const n=this._cornerC;L(n,i,t),L(n,n,s);const o=this._cornerD;L(o,i,t),O(o,o,s)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){e.action==="start"&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){var n;const t=this._editGeometryOperations,s=[];for(const o of t.data.components)s.push(...o.vertices);const i=(n=t.data.geometry.extent)==null?void 0:n.width,a=(i+e*this.view.resolution)/i,r=t.scaleVertices(s,this._plane.origin,Kt,a,a,E.NEW_STEP,ct.REPLACE);this._sharedUndoStack.push({tool:this,operation:r}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){const s=this._editGeometryOperations,i=[];for(const r of s.data.components)i.push(...r.vertices);const a=s.moveVertices(i,e*this.view.resolution,t*this.view.resolution,0,E.NEW_STEP);this._sharedUndoStack.push({tool:this,operation:a}),this._sharedRedoStack.length=0,this.updateGraphics()}};h([d()],w.prototype,"_plane",null),h([d()],w.prototype,"_backgroundGraphicGeometry",null),h([d()],w.prototype,"_rotateGraphicGeometry",null),h([d()],w.prototype,"_scaleGraphicGeometries",null),h([d()],w.prototype,"preserveAspectRatio",void 0),h([d()],w.prototype,"snapRotation",void 0),h([d({constructOnly:!0,nonNullable:!0})],w.prototype,"target",void 0),h([d({constructOnly:!0})],w.prototype,"view",void 0),w=h([J("esri.views.2d.interactive.editingTools.TransformTool")],w);const X={redo:"r",undo:"z"};let k=class extends Yt{constructor(e){super(e),this._transformTool=null,this._controlPointsTransformTool=null,this._advancedModeTransformTool=null,this._activeTool=null,this._sharedUndoStack=[],this._sharedRedoStack=[],this._originalOpacity=null,this.activeHandle=0}initialize(){const{view:e,mediaElement:t,preserveAspectRatio:s,snapRotation:i,advancedMode:a}=this;this._originalOpacity=t.opacity,this._transformTool=new w({target:t,view:e,preserveAspectRatio:s,snapRotation:i}),this._controlPointsTransformTool=new R({mediaElement:t,view:e}),this._advancedModeTransformTool=new R({mediaElement:a.mediaElement,view:a.view}),this._transformTool.setSharedUndoStack(this._sharedUndoStack),this._transformTool.setSharedRedoStack(this._sharedRedoStack),this._controlPointsTransformTool.setSharedUndoStack(this._sharedUndoStack),this._controlPointsTransformTool.setSharedRedoStack(this._sharedRedoStack),this._advancedModeTransformTool.setSharedUndoStack(this._sharedUndoStack),this._advancedModeTransformTool.setSharedRedoStack(this._sharedRedoStack);const r=t.georeference,n=a.mediaElement.georeference;a.view.tools.addMany([this._advancedModeTransformTool]),"controlPoints"in n&&"controlPoints"in r&&this.addHandles([a.view.on("key-down",o=>{o.key===X.undo&&this.canUndo()&&(this.undo(),o.stopPropagation()),o.key===X.redo&&this.canRedo()&&(this.redo(),o.stopPropagation())}),a.view.on("focus",async o=>{this._controlPointsTransformTool.removeHighlightActiveHandle(),this._advancedModeTransformTool.highlightActiveHandle()}),$(()=>n.controlPoints,o=>{var c;r.controlPoints=o.map(({sourcePoint:p},u)=>({sourcePoint:p,mapPoint:r.controlPoints[u].mapPoint})),(c=this._activeTool)==null||c.refresh()}),$(()=>this._controlPointsTransformTool.activeHandle,o=>{this._advancedModeTransformTool.updateActiveHandle(o),this.activeHandle=o}),$(()=>this._advancedModeTransformTool.activeHandle,o=>{this._controlPointsTransformTool.updateActiveHandle(o),this.activeHandle=o})]),this.addHandles([e.on("key-down",o=>{o.key===X.undo&&this.canUndo()&&(this.undo(),o.stopPropagation()),o.key===X.redo&&this.canRedo()&&(this.redo(),o.stopPropagation())}),e.on("focus",async o=>{this._advancedModeTransformTool.removeHighlightActiveHandle(),this._controlPointsTransformTool.highlightActiveHandle()})]),e.tools.addMany([this._transformTool,this._controlPointsTransformTool]),e.activeTool=this._transformTool,this._activeTool=this._transformTool,e.focus()}destroy(){var e,t;(e=this._transformTool)==null||e.destroy(),(t=this._controlPointsTransformTool)==null||t.destroy(),this._transformTool=null,this._controlPointsTransformTool=null,this._advancedModeTransformTool=null,this._activeTool=null,this._sharedUndoStack=null,this._sharedRedoStack=null}canUndo(){return this._sharedUndoStack.length>0}canRedo(){return this._sharedRedoStack.length>0}undo(){var e;if(this._sharedUndoStack.length>0){const{tool:t,operation:s}=this._sharedUndoStack.pop();t!==this._activeTool&&t.refresh(),s.undo(),t.updateGraphics(),this._sharedRedoStack.push({tool:t,operation:s}),this._activeTool!==t&&((e=this._activeTool)==null||e.refresh())}}redo(){var e;if(this._sharedRedoStack.length>0){const{tool:t,operation:s}=this._sharedRedoStack.pop();t!==this._activeTool&&t.refresh(),s.apply(),t.updateGraphics(),this._sharedUndoStack.push({tool:t,operation:s}),this._activeTool!==t&&((e=this._activeTool)==null||e.refresh())}}refresh(){this._activeTool.refresh()}reset(){this._activeTool.reset(),this._advancedModeTransformTool.reset()}async enableAdvancedMode(){this.view.activeTool=this._controlPointsTransformTool,this._activeTool=this._controlPointsTransformTool,this._activeTool.refresh(),await this.advancedMode.view.when(),this.advancedMode.view.activeTool=this._advancedModeTransformTool,this._originalOpacity=this._controlPointsTransformTool.mediaElement.opacity,this._controlPointsTransformTool.mediaElement.opacity=.25*this._originalOpacity}disableAdvancedMode(){this.view.activeTool=this._transformTool,this._activeTool=this._transformTool,this._activeTool.refresh(),this.advancedMode.view.activeTool=null,this._controlPointsTransformTool.mediaElement.opacity=this._originalOpacity}};h([d()],k.prototype,"activeHandle",void 0),h([d({constructOnly:!0})],k.prototype,"advancedMode",void 0),h([d()],k.prototype,"preserveAspectRatio",void 0),h([d()],k.prototype,"snapRotation",void 0),h([d({constructOnly:!0,nonNullable:!0})],k.prototype,"mediaElement",void 0),h([d({constructOnly:!0})],k.prototype,"view",void 0),k=h([J("esri.views.2d.interactive.editingTools.MediaTransformToolsWrapper")],k);export{R as ControlPointsTransformTool,D as DrawGraphicTool2D,k as MediaTransformToolsWrapper,w as TransformTool}; diff --git a/dist/assets/editingTools-KuLEWRoO.js b/dist/assets/editingTools-KuLEWRoO.js new file mode 100644 index 0000000..b31c0f5 --- /dev/null +++ b/dist/assets/editingTools-KuLEWRoO.js @@ -0,0 +1 @@ +import{a1 as ft,x as Y,B as $,a0 as E,L as b,K as M,ho as Ot,e as h,y as d,P as Lt,b as U,c as J,W as $t,G as St,gh as Vt,dW as Z,pw as dt,F as rt,f8 as wt,px as bt,ch as Ht,py as Dt,kv as Pt,a8 as v,b3 as D,o7 as q,a7 as Tt,oa as K,dZ as Ut,cD as B,b4 as L,hJ as zt,hH as Gt,c2 as z,c9 as _t,Z as It,bt as Ft,dX as ut,ca as st,j as Nt,bL as jt,bO as O,hO as W,aw as Bt,kL as mt,kH as Wt,pz as Xt,pA as Kt,g as Yt}from"./index-pCX-0tJH.js";import{S as Zt}from"./SnappingVisualizer2D-JqQy3X5x.js";import{K as qt,X as Jt,V as Et,l as Qt}from"./editPlaneUtils-TRKNVTzb.js";import{k as te,a as ee}from"./drawSurfaces-t1mGEx1r.js";import{d as nt,v as lt,l as Rt,U as kt}from"./InteractiveToolBase-6mltmL27.js";import{s as ie,S as ht}from"./GraphicManipulator-59Uc2I6c.js";import{E as G,V as Mt,e as ct,p as se}from"./EditGeometryOperations-vpHcsZOg.js";import{m as oe}from"./drawUtils-0wb2c6-q.js";import"./SnappingContext-ax0tf6c6.js";import"./PointSnappingHint-bwlQAyn6.js";import"./measurementUtils-69EiqRp6.js";import"./Tooltip-a9KqLK1p.js";import"./euclideanLengthMeasurementUtils-Kj2RYqri.js";import"./quantityFormatUtils-oYgdvR_2.js";import"./automaticAreaMeasurementUtils-kRuWnHc-.js";import"./euclideanAreaMeasurementUtils-jpli3_gk.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./SnappingDragPipelineStep-HDAWWRgo.js";import"./SnappingOperation-hED0OM8D.js";import"./drapedUtils-F1ywqHD-.js";const ae=new ft({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[3.75,3.75],lineDashEnding:"HalfPattern",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:1.6,color:[255,255,255,255]},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:2,color:[0,0,0,255]}]}}}),re=new Y({style:"circle",size:6,color:[127,127,127,1],outline:{color:[50,50,50],width:1}}),ne=new Y({style:"circle",size:6,color:[255,127,0,1],outline:{color:[50,50,50],width:1}});let H=class extends qt{constructor(e){super(e),this._visualElementGraphics={outline:null,regularVertices:null,activeVertex:null},this.activeFillSymbol=null,this.type="draw-2d",this._visualElementSymbols={outline:e.activeLineSymbol??ae,regularVertices:e.regularVerticesSymbol??re,activeVertex:e.activeVertexSymbol??ne,fill:e.activeFillSymbol},e.activeVertexSymbol||this.addHandles($(()=>{var t,s;return(s=(t=this.view)==null?void 0:t.effectiveTheme)==null?void 0:s.accentColor},t=>{var i;if(!t)return;const s=this._visualElementSymbols.activeVertex.clone().set({color:t});(i=this._visualElementGraphics.activeVertex)==null||i.set("symbol",s),this._visualElementSymbols={...this._visualElementSymbols,activeVertex:s}},Lt))}normalizeCtorArgs(e){const t={...e};return delete t.activeFillSymbol,delete t.activeVertexSymbol,delete t.regularVerticesSymbol,delete t.activeLineSymbol,t}initializeGraphic(e){return this._visualElementSymbols.fill!=null&&(e.symbol=this._visualElementSymbols.fill),E()}makeDrawOperation(){const{defaultZ:e,hasZ:t,view:s}=this;return this._createOrUpdateGraphic(null),new te({view:s,manipulators:this.manipulators,geometryType:Jt(this.geometryType),drawingMode:this.mode,hasZ:t,defaultZ:e,snapToSceneEnabled:this.snapToScene,drawSurface:new ee(s,t,e),hasM:!1,snappingManager:this.snappingManager,snappingVisualizer:new Zt(this.internalGraphicsLayer),tooltipOptions:this.tooltipOptions,graphic:this.graphic,cursor:this.cursor})}onActiveVertexChanged(e){if(this.geometryType==="point")return E();const[t,s]=e,i=new b({x:t,y:s,spatialReference:this.view.spatialReference});return this._visualElementGraphics.activeVertex!=null?(this._visualElementGraphics.activeVertex.geometry=i,E()):(this._visualElementGraphics.activeVertex=new M({geometry:i,symbol:this._visualElementSymbols.activeVertex,attributes:{displayOrder:2}}),this.internalGraphicsLayer.add(this._visualElementGraphics.activeVertex),this.internalGraphicsLayer.graphics.sort(ot),E(()=>{this._visualElementGraphics.activeVertex!=null&&(this.internalGraphicsLayer.remove(this._visualElementGraphics.activeVertex),this._visualElementGraphics.activeVertex=U(this._visualElementGraphics.activeVertex))}))}onOutlineChanged(e){const t=e.clone();if(t.type==="polyline"){const s=t.paths[t.paths.length-1];s.splice(0,s.length-2)}return this._visualElementGraphics.outline!=null?(this._visualElementGraphics.outline.geometry=t,E()):(this._visualElementGraphics.outline=new M({geometry:t,symbol:this._visualElementSymbols.outline,attributes:{displayOrder:0}}),this.internalGraphicsLayer.add(this._visualElementGraphics.outline),this.internalGraphicsLayer.graphics.sort(ot),E(()=>{this._visualElementGraphics.outline!=null&&(this.internalGraphicsLayer.remove(this._visualElementGraphics.outline),this._visualElementGraphics.outline=U(this._visualElementGraphics.outline))}))}onRegularVerticesChanged(e){const t=new Ot({points:e,spatialReference:this.view.spatialReference});return this._visualElementGraphics.regularVertices!=null?(this._visualElementGraphics.regularVertices.geometry=t,E()):(this._visualElementGraphics.regularVertices=new M({geometry:t,symbol:this._visualElementSymbols.regularVertices,attributes:{displayOrder:1}}),this.internalGraphicsLayer.add(this._visualElementGraphics.regularVertices),this.internalGraphicsLayer.graphics.sort(ot),E(()=>{this._visualElementGraphics.regularVertices!=null&&(this.internalGraphicsLayer.remove(this._visualElementGraphics.regularVertices),this._visualElementGraphics.regularVertices=U(this._visualElementGraphics.regularVertices))}))}};function ot(e,t){var s,i;return(((s=e.attributes)==null?void 0:s.displayOrder)??-1/0)-(((i=t.attributes)==null?void 0:i.displayOrder)??-1/0)}h([d()],H.prototype,"activeFillSymbol",void 0),h([d({readOnly:!0})],H.prototype,"type",void 0),h([d({constructOnly:!0,nonNullable:!0})],H.prototype,"view",void 0),H=h([J("esri.views.2d.interactive.draw.DrawGraphicTool2D")],H);let pt=class{get hovering(){return this.someManipulator(t=>t.hovering)}get grabbing(){return this.someManipulator(t=>t.grabbing)}get dragging(){return this.someManipulator(t=>t.dragging)}hasManipulator(t){return this.someManipulator(s=>s===t)}someManipulator(t){let s=!1;return this.forEachManipulator(i=>{!s&&t(i)&&(s=!0)}),s}};var I;(function(e){e[e.TRANSLATE_XY=0]="TRANSLATE_XY",e[e.SCALE=1]="SCALE",e[e.ROTATE=2]="ROTATE"})(I||(I={}));let At=class extends pt{constructor(t){super(),this._view=t.view,this._tool=t.tool,this._graphic=t.graphic,this._manipulator=this._createManipulator(),this.forEachManipulator(s=>this._tool.manipulators.add(s))}destroy(){this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._manipulator=null,this._graphic=null}forEachManipulator(t){t(this._manipulator,I.TRANSLATE_XY)}createDragPipeline(t,s){let i=null,o=null,r=0,n=0,a=0;const{offsetX:c,offsetY:p,size:u}=ie(this._graphic.symbol);return nt(this._manipulator,(m,P)=>{P.next(g=>{if(g.action==="start"){const l=t();i=l.editGeometryOperations,o=l.constraints}return g}).next(lt(this._view)).next(g=>{const{x:l,y:_,z:y}=g.mapEnd;if(o&&(l+co.xmax||_+p-u>o.ymax))return g;(g.action==="start"||r===0&&n===0&&a===0)&&(r=g.mapStart.x,n=g.mapStart.y,a=g.mapStart.z);const f=l-r,V=_-n,A=y-a;r=l,n=_,a=y;const C=[];for(const tt of i.data.components)C.push(...tt.vertices);const F=g.action==="start"?G.NEW_STEP:G.ACCUMULATE_STEPS,Q=i.moveVertices(C,f,V,A,F);return s(g,Q),g})})}_createManipulator(){const t=this._view,s=this._graphic;return new ht({view:t,graphic:s,selectable:!0,cursor:"move"})}};const T={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",toggleOpacity:"t",shift:"Shift",primaryKey:bt},le=1,he=10,gt=new $t("#009AF2");let k=class extends Rt{constructor(e){super(e),this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this._initialControlPoints=null,this._graphicsLayer=new St({internal:!0,listMode:"hide",visible:!1,effect:"drop-shadow(0px, 0px, 3px)"}),this._undoStack=[],this._redoStack=[],this._sharedUndoStack=[],this._sharedRedoStack=[],this._highlightHandle=null,this.activeHandle=0}initialize(){this._initialize()}destroy(){const{map:e}=this.view;this._controlPointManipulations.forEach(t=>t.destroy()),this._controlPointEditGeometryOperations.forEach(t=>t.destroy()),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=U(this._graphicsLayer),this._georeference=null,this._controlPointGraphics=null,this._controlPointManipulations=null,this._graphicsLayer=null,this._controlPointEditGeometryOperations=null,this._undoStack=null,this._redoStack=null,this._initialControlPoints=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _hasValidSpatialReference(){return Vt(this.view.spatialReference)}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){const e=this._undoStack[this._undoStack.length-1];return e!=null&&this._controlPointEditGeometryOperations[e].canUndo}canRedo(){const e=this._redoStack[this._redoStack.length-1];return e!=null&&this._controlPointEditGeometryOperations[e].canRedo}undo(){if(this._undoStack.length>0){const e=this._undoStack.pop();this._controlPointEditGeometryOperations[e].undo(),this.updateGraphics(),this._redoStack.push(e)}}redo(){if(this._redoStack.length>0){const e=this._redoStack.pop();this._controlPointEditGeometryOperations[e].redo(),this.updateGraphics(),this._undoStack.push(e)}}refresh(){const{mediaElement:e}=this;if(e.georeference==null)return;const t=e.georeference;t.type==="control-points"&&t.coords!=null&&(this._georeference=t,this._georeference.controlPoints.forEach(({mapPoint:s},i)=>{const o=this._controlPointEditGeometryOperations[i],r=o.data.components[0].vertices[0];o.setVertexPosition(r,o.data.coordinateHelper.pointToVector(s))}),this.updateGraphics())}reset(){this._georeference.controlPoints=this._initialControlPoints,this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const e=this._georeference,t=e.controlPoints,s=t[0].mapPoint.spatialReference,i=this._hasValidSpatialReference;this._georeference.controlPoints=this._controlPointEditGeometryOperations.map((o,r)=>{const n=o.data.geometry;return this._controlPointGraphics[r].geometry=n,{mapPoint:Z(n,s),sourcePoint:i?t[r].sourcePoint:e.toSource(n)}})}updateActiveHandle(e){if(this.activeHandle===e)return;const t=this._controlPointGraphics[this.activeHandle].symbol.clone();dt(t,this.view.effectiveTheme.accentColor),this._controlPointGraphics[this.activeHandle].symbol=t;const s=this._controlPointGraphics[e].symbol.clone();dt(s,gt),this._controlPointGraphics[e].symbol=s,this.activeHandle=e,this.view.surface===document.activeElement&&this.highlightActiveHandle()}async highlightActiveHandle(){this.removeHighlightActiveHandle();const e=await this.view.whenLayerView(this._graphicsLayer);this._highlightHandle=e.highlight(this._controlPointGraphics[this.activeHandle])}removeHighlightActiveHandle(){this._highlightHandle&&this._highlightHandle.remove()}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){const{view:e,mediaElement:t}=this;if(t.georeference==null)return;const s=t.georeference;s.type==="control-points"&&s.coords!=null&&(this._georeference=s,this._initialControlPoints=this._georeference.controlPoints,e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._controlPointEditGeometryOperations=this._georeference.controlPoints.map(({mapPoint:i})=>Mt.fromGeometry(Z(i,e.spatialReference),rt.Local)),this._controlPointGraphics=this._controlPointEditGeometryOperations.map((i,o)=>new M({symbol:new ft({data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,colorLocked:!0,anchorPoint:{x:0,y:-15.75},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:9,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:84.3,ymax:84.3},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[83.2,32.5],[84.3,40.7],[83.8,48.9],[81.7,56.9],[78.1,64.3],[73,70.9],[66.9,76.4],[59.7,80.5],[51.9,83.2],[43.7,84.3],[35.4,83.8],[27.4,81.7],[20,78],[13.4,73],[7.9,66.8],[3.8,59.7],[1.1,51.9],[0,43.7],[.5,35.4],[2.6,27.4],[6.3,20],[11.3,13.4],[17.5,7.9],[24.7,3.8],[32.5,1.1],[39.8,.1],[47.1,.3],[54.3,1.8],[61.1,4.5],[67.4,8.4],[72.9,13.3],[77.4,19.1],[80.9,25.5],[83.2,32.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[84.3,0],[84.3,84.3],[0,84.3],[0,0]]]}},rotation:0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:-11.25},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:22.5,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:197.7,ymax:294.7},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[98.9,0],[119.4,23.2],[139.4,49.3],[156.8,75.2],[171.2,100.8],[182.4,125.3],[190.6,148.8],[195.7,171.4],[197.7,192.9],[197.7,195.8],[197.7,200.3],[197.6,202.5],[197.5,204.8],[197.3,207.1],[197,209.4],[196.7,211.7],[196.4,214.1],[196,216.4],[195.5,218.7],[195,221.1],[194.4,223.4],[193.7,225.8],[193,228.1],[192.2,230.5],[191.4,232.8],[190.5,235.1],[189.5,237.5],[188.5,239.7],[187.4,242],[186.2,244.3],[185,246.5],[183.7,248.7],[182.4,250.9],[181,253.1],[179.5,255.2],[178,257.3],[176.4,259.4],[174.7,261.4],[173.1,263.3],[171.3,265.3],[169.5,267.2],[167.7,269],[165.8,270.8],[163.9,272.5],[161.9,274.2],[159.9,275.8],[157.8,277.4],[155.7,278.9],[153.6,280.4],[151.4,281.7],[149.2,283.1],[147,284.4],[144.8,285.6],[142.5,286.7],[140.3,287.8],[138,288.8],[135.7,289.8],[133.4,290.7],[131,291.5],[128.7,292.3],[126.4,293],[124,293.6],[121.7,294.2],[119.4,294.7],[117,295.2],[114.7,295.6],[112.4,296],[110.1,296.3],[107.8,296.5],[105.5,296.7],[103.3,296.8],[101.1,296.9],[98.8,296.9],[83.1,295.7],[67.8,292],[53.3,285.9],[39.9,277.5],[28.1,267.2],[18,255.1],[10,241.5],[4.2,226.9],[.9,211.5],[0,195.8],[.1,192.9],[2.1,171.4],[7.2,148.8],[15.4,125.3],[26.6,100.8],[41,75.2],[58.4,49.3],[78.4,23.2],[98.9,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:o===this.activeHandle?gt.toArray():this.view.effectiveTheme.accentColor.toArray()}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[197.7,0],[197.7,294.7],[0,294.7],[0,0]]]}},rotation:0}],haloSize:1,scaleX:1,angleAlignment:"Display",angle:0}}}),geometry:i.data.geometry})),this._graphicsLayer.graphics.addMany([...this._controlPointGraphics]),this._controlPointManipulations=this._controlPointGraphics.map(i=>new At({tool:this,view:e,graphic:i})),this.addHandles([...this._controlPointManipulations.map((i,o)=>i.createDragPipeline(this._getInfo.bind(this,o),(r,n)=>{r.action==="start"&&(this._undoStack.push(o),this._redoStack=[],this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0),this.updateGraphics()})),$(()=>this.view.scale,()=>this.active?this.updateGraphics():null)]),this._controlPointManipulations.forEach((i,o)=>{const r=n=>{this.addHandles([n.events.on(["click","grab-changed"],a=>this.updateActiveHandle(o))])};i.forEachManipulator(r)}),this.addHandles([e.on("key-down",i=>{e.activeTool===this&&(i.key!==T.shift||i.repeat||(this._isModifierActive=!0,i.stopPropagation()),i.key!==T.toggleOpacity||i.repeat||(t.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled,i.stopPropagation()),i.key!==T.primaryKey||i.repeat||(this._factor=he,i.stopPropagation()),this._isModifierActive&&(i.key===T.up&&(this._move(0,this._factor),i.stopPropagation()),i.key===T.down&&(this._move(0,-this._factor),i.stopPropagation()),i.key===T.left&&(this._move(-this._factor,0),i.stopPropagation()),i.key===T.right&&(this._move(this._factor,0),i.stopPropagation())))}),e.on("key-up",i=>{e.activeTool===this&&(i.key===T.shift&&(this._isModifierActive=!1,i.stopPropagation()),i.key===T.primaryKey&&(this._factor=le,i.stopPropagation()))})]))}async _loadProjectionEngine(){const e=this._georeference.controlPoints[0].mapPoint;return wt(e.spatialReference,this.view.spatialReference)}_getInfo(e){return{editGeometryOperations:this._controlPointEditGeometryOperations[e],constraints:this._hasValidSpatialReference?null:{xmin:0,ymin:0,xmax:this._georeference.width,ymax:this._georeference.height}}}_move(e,t){const s=this._controlPointEditGeometryOperations[this.activeHandle],i=[];for(const r of s.data.components)i.push(...r.vertices);const o=s.moveVertices(i,e*this.view.resolution,t*this.view.resolution,0,G.NEW_STEP);this._sharedUndoStack.push({tool:this,operation:o}),this._sharedRedoStack.length=0,this.updateGraphics()}};h([d()],k.prototype,"_hasValidSpatialReference",null),h([d()],k.prototype,"activeHandle",void 0),h([d({constructOnly:!0,nonNullable:!0})],k.prototype,"mediaElement",void 0),h([d({constructOnly:!0})],k.prototype,"view",void 0),k=h([J("esri.views.2d.interactive.editingTools.ControlPointsTransformTool")],k);function xt(e,t){e.action==="start"?t.cursor="grabbing":t.cursor="grab"}class ce{constructor(){this._lastDragEvent=null,this.next=new kt,this._enabled=!1}get enabled(){return this._enabled}set enabled(t){if(this._enabled!==t&&this._lastDragEvent!=null){const s={...this._lastDragEvent,action:"update"};t&&this._adjustScaleFactors(s),this.next.execute(s)}this._enabled=t}createDragEventPipelineStep(){return this._lastDragEvent=null,t=>(this._lastDragEvent=t.action!=="end"?{...t}:null,this._enabled&&this._adjustScaleFactors(t),t)}_adjustScaleFactors(t){const s=t.direction[0]!==0&&t.direction[1]!==0?Math.max(Math.abs(t.factor1),Math.abs(t.factor2)):t.direction[0]===0?Math.abs(t.factor2):Math.abs(t.factor1);t.factor1=t.factor1<0?-s:s,t.factor2=t.factor2<0?-s:s}}class pe{constructor(){this._lastDragEvent=null,this.next=new kt,this._enabled=!1}get enabled(){return this._enabled}set enabled(t){if(this._enabled!==t&&this._lastDragEvent!=null){const s={...this._lastDragEvent,action:"update"};t&&this._adjustRotateAngle(s),this.next.execute(s)}this._enabled=t}createDragEventPipelineStep(){return this._lastDragEvent=null,t=>(this._lastDragEvent=t.action!=="end"?{...t}:null,this._enabled&&this._adjustRotateAngle(t),t)}_adjustRotateAngle(t){const s=Ht(t.rotateAngle);t.rotateAngle=Dt(5*Math.round(s/5))}}class de extends pt{constructor(t){super(),this._handles=new Pt,this._originCache=v(),this._view=t.view,this._tool=t.tool,this._graphic=t.graphic,this._snapRotation=t.snapRotation,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on("grab-changed",s=>xt(s,this._manipulator))]),this.forEachManipulator(s=>this._tool.manipulators.add(s))}destroy(){this._handles.destroy(),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._manipulator=null,this._snapRotation=null,this._graphic=null,this._handles=null,this._originCache=null}forEachManipulator(t){t(this._manipulator,I.ROTATE)}createDragPipeline(t,s){let i=null,o=null;return nt(this._manipulator,(r,n)=>{n.next(a=>{if(a.action==="start"){r.cursor="grabbing";const c=t();i=c.plane,o=c.editGeometryOperations}return a}).next(lt(this._view)).next(a=>({...a,rotateAngle:oe(a.mapStart,a.mapEnd,{x:i.origin[0],y:i.origin[1]},!0)})).next(this._snapRotation.createDragEventPipelineStep(),this._snapRotation.next).next(a=>{const c=D(this._originCache,i.origin),p=[];for(const P of o.data.components)p.push(...P.vertices);const u=a.action==="start"?G.NEW_STEP:G.ACCUMULATE_STEPS,m=o.rotateVertices(p,c,a.rotateAngle,u,ct.REPLACE);return Et(m,i),s(a,m),a}).next(a=>(a.action==="end"&&(r.cursor="grab"),a))})}_createManipulator(){const t=this._view,s=this._graphic;return new ht({view:t,graphic:s,selectable:!0,cursor:"grab"})}}const at=10,yt=1e-6,_e=.3;function vt(e){const t=z(e.basis1),s=z(e.basis2);return _e*Math.min(t,s)}class ue extends pt{constructor(t){super(),this._handles=new Pt,this._planeStart=q(),this._displayPlaneStart=q(),this._originCache=v(),this._axisCache=Tt(),this._renderStartCache=v(),this._renderEndCache=v(),this._resizeOriginCache=v(),this._view=t.view,this._tool=t.tool,this._graphic=t.graphic,this._direction=t.direction,this._preserveAspectRatio=t.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on("grab-changed",s=>xt(s,this._manipulator))]),this.forEachManipulator(s=>this._tool.manipulators.add(s))}destroy(){this._handles.destroy(),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(t){t(this._manipulator,I.SCALE)}createDragPipeline(t,s){let i=null,o=null,r=null,n=0,a=null,c=null;const p=this._planeStart,u=this._displayPlaneStart,m=this._direction;return nt(this._manipulator,(P,g)=>{g.next(l=>{if(l.action==="start"){P.cursor="grabbing";const _=t();i=_.plane,o=_.displayPlane,r=_.editGeometryOperations,n=at*this._view.resolution,K(i,p),K(o,u);const y=Ut(r.data.spatialReference);a=y?y.valid[1]-y.valid[0]-3*at*this._view.resolution:null}return l}).next(lt(this._view)).next(l=>{const _=D(this._renderStartCache,[l.mapStart.x,l.mapStart.y,0]),y=D(this._renderEndCache,[l.mapEnd.x,l.mapEnd.y,0]),f=D(this._resizeOriginCache,u.origin);B(f,f,u.basis1,-m[0]),B(f,f,u.basis2,-m[1]),L(y,y,f),L(_,_,f);const V=m[0]!==0&&m[1]!==0,A=vt(u),C=vt(o)/A,F=(et,it)=>{if(et===0)return 1;let x=z(it),N=.5*et*_t(it,y)/x;const j=N<0?-1:1;V&&(N+=(x-.5*et*_t(it,_)/x)*j*C);const Ct=x<1.5*n?1:yt;return x=Math.max(x-n,yt),j>0&&(N-=at*this._view.resolution),j*Math.max(j*(N/x),Ct)},Q=F(m[0],u.basis1),tt=F(m[1],u.basis2);return{...l,direction:m,factor1:Q,factor2:tt}}).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(l=>{const _=D(this._originCache,p.origin);B(_,_,p.basis1,-m[0]),B(_,_,p.basis2,-m[1]);const y=zt(this._axisCache,p.basis1[0],p.basis1[1]);Gt(y,y);const f=[];for(const C of r.data.components)f.push(...C.vertices);const V=l.action==="start"?G.NEW_STEP:G.ACCUMULATE_STEPS,A=r.scaleVertices(f,_,y,l.factor1,l.factor2,V,ct.REPLACE);return a&&a(l.action==="end"&&(P.cursor="grab"),l))})}_createManipulator(){return new ht({view:this._view,graphic:this._graphic,selectable:!0,cursor:"grab"})}}const S={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",plus:"+",minus:"-",toggleOpacity:"t",shift:"Shift",primaryKey:bt},me=80,ge=10,ye=30,ve=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]],fe=1,Se=10;let w=class extends Rt{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=q(),this._displayPlaneCache=q(),this._mainAxisCache=Tt(),this._rotationHandleCache=v(),this._cornerA=v(),this._cornerB=v(),this._cornerC=v(),this._cornerD=v(),this._avgAB=v(),this._avgBC=v(),this._avgCD=v(),this._avgDA=v(),this._preserveAspectRatio=new ce,this._snapRotation=new pe,this._graphicsLayer=new St({internal:!0,listMode:"hide",visible:!1}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this.preserveAspectRatio=null,this.snapRotation=null}initialize(){this._initialize()}destroy(){const{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach(t=>t.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=U(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){const e=this._graphic.geometry;if(e==null)return null;const t=this._editGeometryOperations.data,s=t.components[0].edges[0],i=It(this._mainAxisCache,s.leftVertex.pos,s.rightVertex.pos);Gt(i,i);let o=me*this.view.resolution;const r=this.view.spatialReference;return Ft(r,e.spatialReference)&&(o*=ut(r)/ut(e.spatialReference)),Qt(i,t,o,this._planeCache)}get _displayPlane(){const e=this._plane;if(!e)return null;const t=this._displayPlaneCache;K(e,t);const s=ge*this.view.resolution;return st(t.basis1,t.basis1,1+s/z(t.basis1)),st(t.basis2,t.basis2,1+s/z(t.basis2)),t}get _backgroundGraphicGeometry(){const e=this._displayPlane;if(!e)return null;const t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new Nt({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){const e=this._plane;if(!e)return null;const t=this._rotationHandleCache;return jt(t,e.basis1),st(t,t,ye*this.view.resolution),O(t,t,e.origin),O(t,t,e.basis1),new b({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){const e=this._displayPlane;if(!e)return[];const t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);const{_cornerA:s,_cornerB:i,_cornerC:o,_cornerD:r}=this,n=W(this._avgAB,s,i,.5),a=W(this._avgBC,i,o,.5),c=W(this._avgCD,o,r,.5),p=W(this._avgDA,r,s,.5);return[new b({x:s[0],y:s[1],spatialReference:t}),new b({x:i[0],y:i[1],spatialReference:t}),new b({x:o[0],y:o[1],spatialReference:t}),new b({x:r[0],y:r[1],spatialReference:t}),new b({x:n[0],y:n[1],spatialReference:t}),new b({x:a[0],y:a[1],spatialReference:t}),new b({x:c[0],y:c[1],spatialReference:t}),new b({x:p[0],y:p[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){const{view:e,target:t}=this,s="georeference"in t?t.georeference.coords:t.geometry,i=this._editGeometryOperations,o=i.data.components[0].vertices,r=se.fromGeometry(Z(s,e.spatialReference),rt.Local).components[0].vertices;o.forEach((n,a)=>{i.setVertexPosition(n,r[a].pos)}),this.updateGraphics()}reset(){const{target:e}=this;if("georeference"in e){const t=e.georeference;t.type==="control-points"&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const e=this._editGeometryOperations.data.geometry;"georeference"in this.target&&(this.target.georeference.coords=e),this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach((t,s)=>{this._scaleGraphics[s].geometry=t})}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){const{view:e,target:t}=this;if("georeference"in t){const i=t.georeference;this._graphic=new M({geometry:i.coords}),this._initialControlPoints=i.type==="control-points"?i.controlPoints:null}else this._graphic=t,this._initialGeometry=t.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=Mt.fromGeometry(Z(this._graphic.geometry,e.spatialReference),rt.Local),this._backgroundGraphic=new M({symbol:new Bt({color:"transparent",outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new M({symbol:new Y({color:mt(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map(i=>new M({symbol:new Y({size:6,style:"square",color:mt(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:i})),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new At({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new de({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map((i,o)=>new ue({tool:this,view:e,graphic:i,direction:ve[o],preserveAspectRatio:this._preserveAspectRatio})),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map(i=>i.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this))),$(()=>this.view.scale,()=>this.active?this.updateGraphics():null),e.on("click",async i=>{if(e.activeTool!=null&&e.activeTool!==this)return;const o=Wt(i),r=[];e.map.allLayers.forEach(c=>{c.type!=="vector-tile"&&c.type!=="imagery"||r.push(c)});const n=await this.view.hitTest(o,{exclude:r}),a=n.results;if(a.length===0)e.activeTool=null;else{const c=Xt(n.results),p="georeference"in t,u=a.map(P=>P.type==="media"?P.element:null).filter(Boolean),m=new Set([...this._graphicsLayer.graphics,p?null:t].filter(Boolean));p&&u.includes(t)||c!=null&&m.has(c.graphic)?e.activeTool==null&&(e.activeTool=this):e.activeTool=null}})]);const s=i=>{this.addHandles(i.events.on("grab-changed",o=>{"georeference"in t&&(o.action==="start"?t.opacity*=.5:o.action==="end"&&(t.opacity*=2))}))};this._dragManipulation.forEachManipulator(s),this._rotateManipulation.forEachManipulator(s),this._scaleManipulations.forEach(i=>i.forEachManipulator(s)),this.addHandles([e.on("key-down",i=>{e.activeTool===this&&(i.key!==S.shift||i.repeat||(this.preserveAspectRatio==null&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),this.snapRotation==null&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!0,i.stopPropagation()),i.key!==S.toggleOpacity||i.repeat||("georeference"in t&&(t.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled),i.stopPropagation()),i.key!==S.primaryKey||i.repeat||(this._factor=Se,i.stopPropagation()),this._isModifierActive&&(i.key===S.plus&&(this._scale(this._factor),i.stopPropagation()),i.key===S.minus&&(this._scale(-this._factor),i.stopPropagation()),i.key===S.up&&(this._move(0,this._factor),i.stopPropagation()),i.key===S.down&&(this._move(0,-this._factor),i.stopPropagation()),i.key===S.left&&(this._move(-this._factor,0),i.stopPropagation()),i.key===S.right&&(this._move(this._factor,0),i.stopPropagation())))}),e.on("key-up",i=>{e.activeTool===this&&(i.key===S.shift&&(this.preserveAspectRatio==null&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled),this.snapRotation==null&&(this._snapRotation.enabled=!this._snapRotation.enabled),this._isModifierActive=!1,i.stopPropagation()),i.key===S.primaryKey&&(this._factor=fe,i.stopPropagation()))})])}async _loadProjectionEngine(){const e=this._graphic.geometry;return wt(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){const{basis1:t,basis2:s,origin:i}=e,o=this._cornerA;O(o,i,t),O(o,o,s);const r=this._cornerB;O(r,i,t),L(r,r,s);const n=this._cornerC;L(n,i,t),L(n,n,s);const a=this._cornerD;L(a,i,t),O(a,a,s)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){e.action==="start"&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){var n;const t=this._editGeometryOperations,s=[];for(const a of t.data.components)s.push(...a.vertices);const i=(n=t.data.geometry.extent)==null?void 0:n.width,o=(i+e*this.view.resolution)/i,r=t.scaleVertices(s,this._plane.origin,Kt,o,o,G.NEW_STEP,ct.REPLACE);this._sharedUndoStack.push({tool:this,operation:r}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){const s=this._editGeometryOperations,i=[];for(const r of s.data.components)i.push(...r.vertices);const o=s.moveVertices(i,e*this.view.resolution,t*this.view.resolution,0,G.NEW_STEP);this._sharedUndoStack.push({tool:this,operation:o}),this._sharedRedoStack.length=0,this.updateGraphics()}};h([d()],w.prototype,"_plane",null),h([d()],w.prototype,"_backgroundGraphicGeometry",null),h([d()],w.prototype,"_rotateGraphicGeometry",null),h([d()],w.prototype,"_scaleGraphicGeometries",null),h([d()],w.prototype,"preserveAspectRatio",void 0),h([d()],w.prototype,"snapRotation",void 0),h([d({constructOnly:!0,nonNullable:!0})],w.prototype,"target",void 0),h([d({constructOnly:!0})],w.prototype,"view",void 0),w=h([J("esri.views.2d.interactive.editingTools.TransformTool")],w);const X={redo:"r",undo:"z"};let R=class extends Yt{constructor(e){super(e),this._transformTool=null,this._controlPointsTransformTool=null,this._advancedModeTransformTool=null,this._activeTool=null,this._sharedUndoStack=[],this._sharedRedoStack=[],this._originalOpacity=null,this.activeHandle=0}initialize(){const{view:e,mediaElement:t,preserveAspectRatio:s,snapRotation:i,advancedMode:o}=this;this._originalOpacity=t.opacity,this._transformTool=new w({target:t,view:e,preserveAspectRatio:s,snapRotation:i}),this._controlPointsTransformTool=new k({mediaElement:t,view:e}),this._advancedModeTransformTool=new k({mediaElement:o.mediaElement,view:o.view}),this._transformTool.setSharedUndoStack(this._sharedUndoStack),this._transformTool.setSharedRedoStack(this._sharedRedoStack),this._controlPointsTransformTool.setSharedUndoStack(this._sharedUndoStack),this._controlPointsTransformTool.setSharedRedoStack(this._sharedRedoStack),this._advancedModeTransformTool.setSharedUndoStack(this._sharedUndoStack),this._advancedModeTransformTool.setSharedRedoStack(this._sharedRedoStack);const r=t.georeference,n=o.mediaElement.georeference;o.view.tools.addMany([this._advancedModeTransformTool]),"controlPoints"in n&&"controlPoints"in r&&this.addHandles([o.view.on("key-down",a=>{a.key===X.undo&&this.canUndo()&&(this.undo(),a.stopPropagation()),a.key===X.redo&&this.canRedo()&&(this.redo(),a.stopPropagation())}),o.view.on("focus",async a=>{this._controlPointsTransformTool.removeHighlightActiveHandle(),this._advancedModeTransformTool.highlightActiveHandle()}),$(()=>n.controlPoints,a=>{var c;r.controlPoints=a.map(({sourcePoint:p},u)=>({sourcePoint:p,mapPoint:r.controlPoints[u].mapPoint})),(c=this._activeTool)==null||c.refresh()}),$(()=>this._controlPointsTransformTool.activeHandle,a=>{this._advancedModeTransformTool.updateActiveHandle(a),this.activeHandle=a}),$(()=>this._advancedModeTransformTool.activeHandle,a=>{this._controlPointsTransformTool.updateActiveHandle(a),this.activeHandle=a})]),this.addHandles([e.on("key-down",a=>{a.key===X.undo&&this.canUndo()&&(this.undo(),a.stopPropagation()),a.key===X.redo&&this.canRedo()&&(this.redo(),a.stopPropagation())}),e.on("focus",async a=>{this._advancedModeTransformTool.removeHighlightActiveHandle(),this._controlPointsTransformTool.highlightActiveHandle()})]),e.tools.addMany([this._transformTool,this._controlPointsTransformTool]),e.activeTool=this._transformTool,this._activeTool=this._transformTool,e.focus()}destroy(){var e,t;(e=this._transformTool)==null||e.destroy(),(t=this._controlPointsTransformTool)==null||t.destroy(),this._transformTool=null,this._controlPointsTransformTool=null,this._advancedModeTransformTool=null,this._activeTool=null,this._sharedUndoStack=null,this._sharedRedoStack=null}canUndo(){return this._sharedUndoStack.length>0}canRedo(){return this._sharedRedoStack.length>0}undo(){var e;if(this._sharedUndoStack.length>0){const{tool:t,operation:s}=this._sharedUndoStack.pop();t!==this._activeTool&&t.refresh(),s.undo(),t.updateGraphics(),this._sharedRedoStack.push({tool:t,operation:s}),this._activeTool!==t&&((e=this._activeTool)==null||e.refresh())}}redo(){var e;if(this._sharedRedoStack.length>0){const{tool:t,operation:s}=this._sharedRedoStack.pop();t!==this._activeTool&&t.refresh(),s.apply(),t.updateGraphics(),this._sharedUndoStack.push({tool:t,operation:s}),this._activeTool!==t&&((e=this._activeTool)==null||e.refresh())}}refresh(){this._activeTool.refresh()}reset(){this._activeTool.reset(),this._advancedModeTransformTool.reset()}async enableAdvancedMode(){this.view.activeTool=this._controlPointsTransformTool,this._activeTool=this._controlPointsTransformTool,this._activeTool.refresh(),await this.advancedMode.view.when(),this.advancedMode.view.activeTool=this._advancedModeTransformTool,this._originalOpacity=this._controlPointsTransformTool.mediaElement.opacity,this._controlPointsTransformTool.mediaElement.opacity=.25*this._originalOpacity}disableAdvancedMode(){this.view.activeTool=this._transformTool,this._activeTool=this._transformTool,this._activeTool.refresh(),this.advancedMode.view.activeTool=null,this._controlPointsTransformTool.mediaElement.opacity=this._originalOpacity}};h([d()],R.prototype,"activeHandle",void 0),h([d({constructOnly:!0})],R.prototype,"advancedMode",void 0),h([d()],R.prototype,"preserveAspectRatio",void 0),h([d()],R.prototype,"snapRotation",void 0),h([d({constructOnly:!0,nonNullable:!0})],R.prototype,"mediaElement",void 0),h([d({constructOnly:!0})],R.prototype,"view",void 0),R=h([J("esri.views.2d.interactive.editingTools.MediaTransformToolsWrapper")],R);export{k as ControlPointsTransformTool,H as DrawGraphicTool2D,R as MediaTransformToolsWrapper,w as TransformTool}; diff --git a/dist/assets/editingTools-eh7FxppI.js b/dist/assets/editingTools-eh7FxppI.js deleted file mode 100644 index dac2384..0000000 --- a/dist/assets/editingTools-eh7FxppI.js +++ /dev/null @@ -1 +0,0 @@ -import{e as h,y as u,c as k,p as Yt,b as za,kw as Ha,s as Va,d as y,fl as ka,a2 as Z,ab as He,hS as Ua,kz as Xa,kA as Na,pU as Ya,hp as Za,hu as Fa,l0 as Ba,rl as ja,hL as Et,hJ as pa,hK as ha,oV as qa,hM as Wa,a9 as re,aR as Ve,hV as Ka,aa as H,A as Qt,kU as ca,e2 as Ee,dA as Ja,as as rt,aP as z,q4 as Qa,hs as tn,np as en,fv as F,vT as Ei,b2 as Dt,bp as pi,F as Xt,bq as hi,P as $,kY as Y,n as R,vU as an,oW as nn,vV as ci,fw as Gt,pl as ke,vW as ua,hD as Te,at as At,au as Vt,eh as on,bn as Ti,fN as sn,vX as rn,ay as ln,vY as da,kn as Ue,K as $t,vZ as Ae,v_ as ga,bw as Ai,br as x,o4 as B,rm as O,v$ as pn,o7 as Oe,o3 as _a,b1 as j,o6 as Ge,bu as ui,i2 as di,bA as Xe,aO as hn,w0 as cn,ak as gt,w1 as un,w2 as dn,q2 as gn,aU as L,aF as ai,ax as De,aG as It,w3 as _n,w4 as mn,w5 as ma,bx as va,bm as ni,dJ as vn,V as fn,L as Rt,k as gi,w6 as yn,w7 as fa,I as ct,bB as Ne,w8 as Ie,ns as Mn,cQ as me,aV as ya,aT as _i,rz as Ma,w9 as bn,j_ as Gi,cP as Sn,wa as xn,wb as Di,qJ as wn,aQ as te,i3 as ye,gK as On,hP as Pt,q9 as Ii,wc as En,cp as ce,ar as Tn,q8 as yt,N as An,no as ba,wd as Gn,we as Dn,C as $e,o5 as In,pu as Je,wf as $i,nk as $n,ki as le,wg as Rn,ag as ue,wh as Cn,av as Ln,wi as Ri,wj as Ci,qr as Pn,qu as zn,wk as Hn,O as oi,qs as Li,qx as Vn,qt as kn,T as Un,e3 as Xn,wl as Nn,n$ as Sa,aN as xa,aE as si,n_ as de,nX as pe,mj as Yn,pI as Zn,cM as Ht,wm as Pi,cr as Fn}from"./index-J0iiHjMT.js";import{q as Bn}from"./quantityFormatUtils-NiAiojad.js";import{x as jn}from"./TextOverlayItem-eCjvS6IO.js";import{l as qn,a as bt,u as ve,s as Ye,p as Wn,b as Kn,c as Me}from"./Tooltip-ON77BKb3.js";import{O as ge}from"./SnappingVisualizer3D-KWlqByBu.js";import{z as Zt,e as Ft,w as Nt}from"./GraphicState-2UcU5UAX.js";import{G as mi}from"./ExtendedLineVisualElement-YbjiXiBG.js";import{d as zi}from"./VerticesVisualElement-oQAA_hbc.js";import{K as Jn,X as Qn,g as to,V as Ze,l as eo,x as Hi}from"./editPlaneUtils-4qxd7h1E.js";import{k as io,o as ao,r as no}from"./surfaceCoordinateSystems-siQq4eBA.js";import{$ as et,e as w,w as Mt,k as wa,b as ne,v as Oa,F as Ea}from"./ShadedColorMaterial.glsl-Fp4o6LjC.js";import{n as kt}from"./manipulatorUtils-1y2yxq3d.js";import{c as ri}from"./Laserlines.glsl-nvjcCsAw.js";import{x as oo}from"./PointVisualElement-bX-_4FqS.js";import{T as vi,P as Ta,M as so,U as ro,k as lo,D as po,H as fi}from"./dragEventPipeline3D-4CqrlxD2.js";import{x as ho,z as co,d as lt,D as he,y as uo,q as ie,U as Aa,P as Kt,l as Fe,j as go,w as _o,C as Vi,O as mo}from"./InteractiveToolBase-WDic4GPF.js";import{S as vo}from"./GraphicManipulator-ku6oRBpa.js";import{V as Be,y as ki,N as fo,E as St,e as Ga}from"./EditGeometryOperations-TPE5Wzab.js";import{e as Re}from"./SnappingContext-6K6JmvvY.js";import{f as Ce}from"./SnappingDragPipelineStep-THHIXt-p.js";import{r as _e,a as je,l as yi,n as yo,c as Mo,p as bo}from"./TranslateTooltipInfos-J6BygtUO.js";import{y as Le,R as So,d as xo}from"./euclideanLengthMeasurementUtils-VQw5qWk6.js";import{o as wo}from"./automaticAreaMeasurementUtils-nVd6Y5mX.js";import{I as Oo,H as Eo,y as To,g as Ao,c as Go,C as Do,a as Io,h as $o,z as Da,B as Ui,d as Ro,N as Co,D as Lo}from"./SlicePlaneMaterial.glsl-RxywoUhm.js";import{l as Po}from"./Factory-m-O4WAoG.js";import{i as zo,p as Ho}from"./ExtentTooltipInfos-LPjFe37b.js";import"./vec4f32-NvfHy9q7.js";import"./EngineVisualElement-eZNKTKsI.js";import"./VisualElement-kjYXz27t.js";import"./RightAngleQuadVisualElement-y_W8r903.js";import"./Object3DVisualElement-TMb7y_wl.js";import"./measurementUtils-84-ZBArh.js";import"./dehydratedFeatureComparison-hdPq-zad.js";import"./SnappingOperation-2U48wt1k.js";import"./drawUtils-woTYaREB.js";import"./drapedUtils-9db1OpTX.js";import"./PointSnappingHint-ULetRXiW.js";import"./euclideanAreaMeasurementUtils-zmzttSyV.js";import"./ImageMaterial.glsl-TdPtjVc_.js";import"./LineVisualElement-4BP10o6v.js";const Vo=3025,ko={default:15,far:25};let at=class extends Yt{constructor(i){super(i),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance="default",this._messagesUnits=null,this._labelInfos=[],this._nextLabelIndex=0}initialize(){const i=za(async t=>{const e=await Ha("esri/core/t9n/Units");Va(t),this._messagesUnits=e});this.addHandles([y(()=>[this.context!=null&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits],()=>this._update()),...["vertex-add","vertex-update","vertex-remove"].map(t=>ka(()=>{var e;return(e=this.context)==null?void 0:e.editGeometryOperations},t,()=>this._update())),Z(()=>i.abort()),y(()=>this._colors,t=>this._updateStyle(t))])}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop())}get updating(){return this._messagesUnits==null}get test(){return{labelContents:this._labelInfos.slice(0,this._nextLabelIndex).map(i=>i.label.text)}}get _edgeDistancePixels(){return ko[this.edgeDistance]}get _colors(){var t;const i=((t=this.context)==null?void 0:t.view.effectiveTheme.textColor)??He.fromArray([255,255,255]);return{textColor:i,backgroundColor:Ua(Xa(i,Na.Low),.6)}}_update(){if(this.destroyed)return;this._nextLabelIndex=0;const i=this.context;if(i==null)return void this._destroyUnusedLabels();const{components:t,geometry:e,coordinateHelper:n}=i.editGeometryOperations.data;if(!e)return void this._destroyUnusedLabels();const a=t.length;for(let o=0;o{s.push(n.toXYZ(g.pos))}),o===0&&this.stagedVertex!=null&&s.push(n.toXYZ(this.stagedVertex)),s.length<2)continue;const r=s[0],l=s[s.length-1];e.type==="polygon"&&s.length>2&&!Ya(r,l)&&s.push(r);const p=a===1&&!Za(s);let c=Uo,d=Xo;this.toScreenPointArray(i,r,c);for(let g=1;gMath.abs(it[1])?s.anchor=it[0]>0?"left":"right":s.anchor=-it[1]<0?"top":"bottom"}_getOrCreateLabel(i){var s;const t=this._labelInfos.length>this._nextLabelIndex,{textColor:e,backgroundColor:n}=this._colors;if(t){const r=this._labelInfos[this._nextLabelIndex++],{label:l}=r;return l.textColor=e,l.backgroundColor=n,r}const a=new jn({anchor:"center",fontSize:10,textColor:e,backgroundColor:n});(s=i.view.overlay)==null||s.items.add(a);const o={label:a};return this._labelInfos.push(o),this._nextLabelIndex=this._labelInfos.length,o}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:i}){var t,e;(e=(t=this.context)==null?void 0:t.view.overlay)==null||e.items.remove(i),i.destroy()}};h([u()],at.prototype,"context",void 0),h([u()],at.prototype,"stagedVertex",void 0),h([u()],at.prototype,"visible",void 0),h([u()],at.prototype,"edgeDistance",void 0),h([u()],at.prototype,"updating",null),h([u()],at.prototype,"_messagesUnits",void 0),h([u()],at.prototype,"_edgeDistancePixels",null),h([u()],at.prototype,"_colors",null),at=h([k("esri.views.interactive")],at);const it=re(),oe=re(),Uo=Ve(),Xo=Ve();let Pe=class extends at{getCameraOrExtent({view:t}){return t.state.camera}toScreenPointArray({view:t,elevationInfo:e,editGeometryOperations:n},a,o=Ve()){const{spatialReference:s}=n.data.coordinateHelper;return Ka(a,s,e,t,Xi),t.state.camera.projectToScreen(Xi,o),o}};Pe=h([k("esri.views.3d.interactive.SegmentLabels3D")],Pe);const Xi=H();function Mi(i){const{graphic:t}=i;return[y(()=>i.displaying,e=>{e?No(t):Ni(t)},{...Qt}),Z(()=>Ni(t))]}function No(i){const{geometry:t}=i;Ia(t)&&i.notifyMeshTransformChanged({action:ca.EnableFastUpdates})}function Ni(i){const{geometry:t}=i;Ia(t)&&i.notifyMeshTransformChanged({action:ca.DisableFastUpdates})}function Ia(i){return(i==null?void 0:i.type)==="mesh"&&!i.vertexSpace.isGeoreferenced}function Yo(i,t){const e=i==null?void 0:i.geometry;if(!i||(e==null?void 0:e.type)!=="mesh"||!t)return;const{renderCoordsHelper:n,elevationProvider:a}=t,{camera:o}=t.state,{extent:s}=e,{center:r,spatialReference:l}=s,p=Ee(l),c=Ja(l),d=Ee(n.spatialReference),g=s.width*p,_=s.height*c,m=(s.zmax??0)*c,v=m-(s.zmin??0)*c,M=Math.max(g,_,v)/d,{x:b,y:f}=r,E=r.z??0;rt(be,b,f,E),n.toRenderCoords(be,l,be);const D=M/o.computeScreenPixelSizeAt(be);if(D>o.width*Fo)return"meshTooClose";if(Dthis.view.effectiveTheme}),this.geometryType=null,this.type="draw-3d"}initialize(){const{mode:i,offset:t}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new tn({mode:i,offset:t})}normalizeCtorArgs(i){if(!i.elevationInfo){const t=i.hasZ??!0;return{...i,elevationInfo:en(t)}}return i}initializeGraphic(i){const{view:t}=this,e=this._createGraphicState=new Ft({graphic:i});return F([t.maskOccludee(i),t.trackGraphicState(e),y(()=>({element:this._outlineVisualElement,isDraped:e.isDraped}),({element:n,isDraped:a})=>{n&&(n.isDraped=a)},Qt),this._setupLoadingIndicator(e),...Mi(e)])}updateDrawMeshTooltipInfo(i){const{graphic:t,tooltipOptions:e,view:n}=this;i.tooltipOptions=e,i.viewType=n.type,i.helpMessage=Yo(t,this.view),this.updateElevation(i.elevation)}makeDrawOperation(){const{geometryType:i}=this,t=i!=="circle"&&i!=="rectangle";return new io({view:this.view,manipulators:this.manipulators,geometryType:Qn(i),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new ao(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new no(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new ge,segmentLabels:t?new Pe:null,labelOptions:this.labelOptions,tooltipOptions:this.tooltipOptions,isDraped:this._createGraphicState?this._createGraphicState.isDraped:Ei(this.hasZ,this.elevationInfo)==="on-the-ground",cursor:this.cursor})}onActiveVertexChanged(i){const{view:t}=this;if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[i],this._updateVerticalLineVisualElement(i),Z();const e=this._settings,n=e.manipulators.vertex,a=new zi({view:t,spatialReference:t.spatialReference,vertices:[i],elevationInfo:this.internalGraphicsLayer.elevationInfo,size:n.size,outlineSize:n.outlineSize,renderOccluded:n.renderOccluded,attached:!1,isDecoration:!0});this._activeVertexVisualElement=a;const o=e.visualElements.zVerticalLine,s=new mi({view:t,extensionType:o.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:Dt.OccludeAndTransparent,isDecoration:!0});this._verticalLineVisualElement=s;const r=F([y(()=>e.visualElements.zVerticalLine,l=>l.apply(s),$),y(()=>({selectedColor:Y(e.colors.selected),outlineColor:Y(e.manipulators.vertex.outlineColor)}),({selectedColor:l,outlineColor:p})=>{a.color=l,a.outlineColor=p},$),Z(()=>{this._activeVertexVisualElement=R(this._activeVertexVisualElement),this._verticalLineVisualElement=R(this._verticalLineVisualElement)})]);return a.attached=!0,r}_updateVerticalLineVisualElement(i){const t=this._verticalLineVisualElement;if(!t)return;const{renderCoordsHelper:e,elevationProvider:n}=this.view;rt(jt,i[0],i[1],i[2]),Yi.setFromElevationInfo(this.elevationInfo),jt[2]=pi(jt,n,Yi,e),e.toRenderCoords(jt,this.view.spatialReference,jt)?(t.setStartEndFromWorldDownAtLocation(jt),t.attached=!0):t.attached=!1}onOutlineChanged(i){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=i,Z();const t=this.internalGraphicsLayer.elevationInfo,{view:e}=this,n=this._settings,a=new Nt({view:e,geometry:i,elevationInfo:t,isDraped:this._createGraphicState?this._createGraphicState.isDraped:Ei(this.hasZ,t)==="on-the-ground",attached:!1,isDecoration:!0});this._outlineVisualElement=a;const o=F([y(()=>n.visualElements.lineGraphics.outline,s=>s.apply(a),$),y(()=>n.visualElements.lineGraphics.shadowStyle,s=>s.apply(a),$),Z(()=>{this._outlineVisualElement=R(this._outlineVisualElement)})]);return a.attached=!0,a.laserlineEnabled=!0,o}onRegularVerticesChanged(i){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=i,Z();const{view:t}=this,e=this._settings,n=e.manipulators.vertex,a=new zi({view:t,spatialReference:t.spatialReference,vertices:i,elevationInfo:this.internalGraphicsLayer.elevationInfo,size:n.size,outlineSize:n.outlineSize,renderOccluded:n.renderOccluded,attached:!1,isDecoration:!0}),o=F([y(()=>({color:Y(e.manipulators.vertex.color),outlineColor:Y(e.manipulators.vertex.outlineColor)}),({color:s,outlineColor:r})=>{a.color=s,a.outlineColor=r},$),Z(()=>{this._verticesVisualElement=R(this._verticesVisualElement)})]);return a.attached=!0,this._verticesVisualElement=a,o}updateGraphicGeometry(i,t){if(this.geometryType==="mesh"&&(t==null?void 0:t.type)==="point"){const e=this.geometryToPlace;return e&&e.centerAt(t),void(e&&i.geometry===e?e.vertexSpace.isGeoreferenced?i.notifyGeometryChanged():i.notifyMeshTransformChanged():i.geometry=e)}super.updateGraphicGeometry(i,t)}_setupLoadingIndicator(i){const{drawOperation:t}=this;if(!this.geometryToPlace)return t.loading=!1,null;t.loading=!0;const e=Z(()=>{t.loading=!1});let n;const a=()=>n&&cancelAnimationFrame(n);return F([Xt(()=>i.displaying,()=>{a(),n=requestAnimationFrame(()=>e.remove())},{...Qt,once:!0}),Z(a),e])}};h([u({constructOnly:!0})],Bt.prototype,"elevationInfo",void 0),h([u({constructOnly:!0})],Bt.prototype,"geometryType",void 0),h([u()],Bt.prototype,"type",void 0),h([u({constructOnly:!0})],Bt.prototype,"view",void 0),Bt=h([k("esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D")],Bt);const Yi=new hi,jt=H();function jo(i){const t=bi(i);return nn(Math.cos(t),Math.sin(t))}function bi(i){if(i==null||i.type!=="polyline"&&i.type!=="polygon")return 0;const t=i.type==="polyline"?i.paths:i.rings;for(const e of t)for(let n=0;nan)return Math.atan2(o[1]-a[1],o[0]-a[0])}return 0}var st;(function(i){i[i.NONE=0]="NONE",i[i.ANY=1]="ANY",i[i.Z=2]="Z",i[i.XY=4]="XY"})(st||(st={}));var G;(function(i){i[i.TRANSLATE_Z=0]="TRANSLATE_Z",i[i.TRANSLATE_XY=1]="TRANSLATE_XY",i[i.SCALE=2]="SCALE",i[i.ROTATE=3]="ROTATE",i[i.SCALE_ROTATE=4]="SCALE_ROTATE"})(G||(G={}));let $a=class{constructor(){this.grabbingState=st.NONE,this.zManipulator=null,this.firstSelected=null,this.numSelected=0,this.firstGrabbedXY=null}update(t){this.grabbingState=st.NONE,this.zManipulator=null,this.numSelected=0,this.firstSelected=null,this.firstGrabbedXY=null,t.forEachManipulator((e,n)=>{if(n===G.TRANSLATE_Z&&(this.zManipulator=e),e instanceof et&&(e.selected&&(this.numSelected===0&&(this.firstSelected=e),this.numSelected++),this.firstGrabbedXY==null&&e.grabbing&&n===G.TRANSLATE_XY&&(this.firstGrabbedXY=e)),e.grabbing)switch(this.grabbingState|=st.ANY,n){case G.TRANSLATE_Z:this.grabbingState|=st.Z;break;case G.TRANSLATE_XY:this.grabbingState|=st.XY}})}};function qo(i){const{view:t,graphic:e}=i,n=new Ft({graphic:e}),a=Wo(i,n),o=[a,Ko(i,a.visualElement,n),t.maskOccludee(e),t.trackGraphicState(n)];return{visualElement:a.visualElement,remove:()=>ci(o)}}function Wo(i,t){const{view:e,graphic:n}=i,a=new Nt({view:e,geometry:li(n)?n.geometry:null,elevationInfo:z(n),attached:!1,isDecoration:!0}),o=new Zt({getTheme:()=>e.effectiveTheme}),s=()=>{a.attached=t.displaying},r=F([y(()=>o.visualElements.lineGraphics.outline,l=>l.apply(a),$),y(()=>o.visualElements.lineGraphics.shadowStyle,l=>l.apply(a),$),y(()=>t.displaying,s),y(()=>t.isDraped,l=>{a.isDraped=l}),t.on("changed",()=>a.geometry=li(n)?n.geometry:null),Gt(a)]);return s(),{visualElement:a,remove:()=>r.remove()}}function Ko(i,t,e){const{graphic:n,view:a}=i,o=[],s=z(n),r=s.mode==="on-the-ground"||!s.offset&&s.mode!=="absolute-height",l=new $a,p=new Zt({getTheme:()=>a.effectiveTheme}),c=p.visualElements,d=new mi({view:a,extensionType:c.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:Dt.OccludeAndTransparent,isDecoration:!0}),g=ke(c.heightPlaneAngleCutoff),_=new ri({view:a,attached:!1,angleCutoff:g,isDecoration:!0}),m=Te(1);o.push(y(()=>({lineShadowStyle:p.visualElements.lineGraphics.shadowStyle,pointShadowStyle:p.visualElements.pointGraphics.shadowStyle,alpha:m.value}),({lineShadowStyle:E,pointShadowStyle:D,alpha:V})=>{E.apply(t,V),D.apply(d,V)},$));const v=Te(1);o.push(y(()=>({heightPlane:p.visualElements.heightPlane,alpha:v.value}),({heightPlane:E,alpha:D})=>E.apply(_,D),$));const M=()=>{if(l.update(i),!e.displaying||r&&(e.isDraped||!li(n)||!n.geometry.hasZ))return t.laserlineEnabled=!1,d.attached=!1,void(_.attached=!1);t.laserlineEnabled=!0;const E=l.grabbingState&st.XY?c.laserlineAlphaMultiplier:1;m.value=E;const D=l.grabbingState&st.Z?c.laserlineAlphaMultiplier:1;v.value=D,Jo(d,l),Qo(i,t,_,l)};o.push(y(()=>p.visualElements.zVerticalLine,E=>E.apply(d),$)),o.push(e.on("changed",M),y(()=>e.displaying,M),t.events.on("attachment-origin-changed",M),Gt(d),Gt(_));const b=[],f=()=>{ci(b),b.length=0,i.forEachManipulator(E=>b.push(E.events.on("grab-changed",M))),i.forEachManipulator(E=>b.push(E.events.on("select-changed",M))),M()};return f(),o.push(i.onManipulatorsChanged(f),ua(()=>F(b))),F(o)}function Jo(i,t){const e=t.numSelected===1?t.firstSelected:t.numSelected>1&&t.firstGrabbedXY!=null?t.firstGrabbedXY:null;e!=null?(i.setStartEndFromWorldDownAtLocation(e.renderLocation),i.attached=!0):i.attached=!1}function Qo(i,t,e,n){if(n.numSelected>0){rt(Lt,0,0,0);let a=0;i.forEachManipulator((o,s)=>{s===G.TRANSLATE_XY&&o.selected&&o instanceof et&&(At(Lt,Lt,o.renderLocation),a++)}),a>0?(e.heightManifoldTarget=Vt(Lt,Lt,1/a),e.attached=!0):e.attached=!1}else{const a=t.attachmentOrigin;a!=null&&i.view.renderCoordsHelper.toRenderCoords(a,Lt)?(e.heightManifoldTarget=Lt,e.attached=!0):e.attached=!1}}function li(i){return i.geometry!=null&&(i.geometry.type==="polygon"||i.geometry.type==="polyline")}const Lt=H();function ts(i){const{view:t,graphic:e}=i,n=new Ft({graphic:e}),a=[],o=is(i,n,a);return es(i,n,a,o),a.push(t.trackGraphicState(n)),{visualElement:o,remove:()=>ci(a)}}function es(i,t,e,n){const{view:a,graphic:o}=i,s=new Zt({getTheme:()=>a.effectiveTheme}),r=new mi({view:a,extensionType:s.visualElements.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:Dt.OccludeAndTransparent,isDecoration:!0});e.push(y(()=>s.visualElements.zVerticalLine,f=>f.apply(r),$));const l=new ri({view:a,intersectsLineInfinite:!0,attached:!1,isDecoration:!0}),p=ke(s.visualElements.heightPlaneAngleCutoff),c=new ri({view:a,attached:!1,angleCutoff:p,isDecoration:!0}),d=z(i.graphic),g=hi.fromElevationInfo(d),_=d.mode==="on-the-ground"||!d.offset&&d.mode!=="absolute-height",m=new $a,v=Te(1);e.push(y(()=>({heightPlane:s.visualElements.heightPlane,alpha:v.value}),({heightPlane:f,alpha:E})=>f.apply(c,E),$));const M=Te(1);e.push(y(()=>({shadowStyle:s.visualElements.pointGraphics.shadowStyle,alpha:M.value}),({shadowStyle:f,alpha:E})=>f.apply(l,E),$));const b=()=>{m.update(i);const f=Si(o),E=_&&(t.isDraped||f==null||!f.hasZ);let D=!0;if(E||f==null)D=!1;else{const tt=pi(f,a.elevationProvider,g,a.renderCoordsHelper);rt(ot,f.x,f.y,tt),Ti(ot,f.spatialReference,ot,a.renderCoordsHelper.spatialReference),r.setStartEndFromWorldDownAtLocation(ot),l.intersectsWorldUpAtLocation=ot}const V=m.grabbingState&st.Z?s.visualElements.laserlineAlphaMultiplier:1;v.value=V;const N=sn(ss);!E&&t.displaying&&n.calculateMapBounds(N)&&Ti(rn(N,ot),a.spatialReference,ot,a.renderCoordsHelper.spatialReference)?(c.heightManifoldTarget=ot,c.attached=!0):c.attached=!1;const A=m.grabbingState&st.XY?s.visualElements.laserlineAlphaMultiplier:1;M.value=A;const q=D&&t.displaying&&!E;l.attached=q,r.attached=q};e.push(y(()=>[t.displaying,t.isDraped],b),t.on("changed",b)),i.forEachManipulator(f=>{e.push(f.events.on("grab-changed",b))}),e.push(Gt(l)),e.push(Gt(r)),e.push(Gt(c)),b()}function is(i,t,e){const{view:n,graphic:a}=i,o=new oo({view:n,geometry:Si(a),elevationInfo:z(a),isDecoration:!0});return as(i,o,t,e),e.push(Gt(o)),o}function Si(i){const t=i.geometry;return t==null?null:t.type==="point"?t:t.type==="mesh"?t.anchor.clone():null}function as(i,t,e,n){const a=()=>{t.attached=e.displaying},o=new Zt({getTheme:()=>i.view.effectiveTheme});ns(i,t,e,n),o.visualElements.pointGraphics.outline.apply(t),n.push(y(()=>e.displaying,a,$))}function ns(i,t,e,n){const{view:a,graphic:o}=i;let s=null;const r=p=>{s!=null&&(s.remove(),s=null),e.isDraped&&p!=null&&(s=os(a,p,()=>{t.geometry=p}))},l=()=>{const p=Si(o);r(p),t.geometry=p};n.push(e.on("changed",l),ua(()=>s)),l()}function os(i,t,e){const n=i.elevationProvider.spatialReference;ln(t,ot,n);const a=ot[0],o=ot[1];return i.elevationProvider.on("elevation-change",s=>{da(s.extent,a,o)&&e()})}const ot=H(),ss=on();function qe(i){switch(i.graphic.geometry.type){case"point":case"mesh":return ts(i);case"polygon":case"polyline":return qo(i);default:return null}}const Ra=128,ut=70,rs=80,Ca=.02,ls=54,ps=100,La=Math.ceil(ut/3*2),zt=160,Qe=.5,ti=24,qt=9,hs=zt+30,Zi=zt+53,cs=60,us=23,ds=5*Math.PI/12,gs=1*Math.PI/3,Fi=10,Bi=.2,ji=30,qi=53,Wi=.2,Ki=.3,_s=200,ms=3,vs=1e6;let fe=class{constructor(){this._available=!0}set location(t){this._forEachManipulator3D(e=>e.location=t)}set elevationAlignedLocation(t){this._forEachManipulator3D(e=>e.elevationAlignedLocation=t)}set elevationInfo(t){this._forEachManipulator3D(e=>e.elevationInfo=t)}get renderLocation(){let t;return this._forEachManipulator3D(e=>{t||(t=e.renderLocation)}),t}get available(){return this._available}set available(t){this._available=t,this._forEachManipulator3D(e=>e.available=t)}get hovering(){return this.someManipulator(t=>t.hovering)}get grabbing(){return this.someManipulator(t=>t.grabbing)}get dragging(){return this.someManipulator(t=>t.dragging)}hasManipulator(t){return this.someManipulator(e=>e===t)}someManipulator(t){let e=!1;return this.forEachManipulator(n=>{!e&&t(n)&&(e=!0)}),e}_forEachManipulator3D(t){this.forEachManipulator((e,n)=>{e instanceof et&&t(e,n)})}};function We(i,t,e,n){const a=(o,s)=>t({action:o,graphic:i,dxScreen:s.screenDeltaX,dyScreen:s.screenDeltaY});return e((o,s,r)=>(s.next(l=>(l.action==="start"&&a("start",l),l)).next(ho(i,n)).next(l=>{switch(l.action){case"start":case"update":(l.translationX||l.translationY||l.translationZ)&&a("update",l);break;case"end":a("end",l)}return l}),{steps:s,cancel:r=r.next(co(i)).next(l=>(a("end",{screenDeltaX:0,screenDeltaY:0}),l))}))}function ze(i){if((i==null?void 0:i.axis)==null)return 1;const{mapStart:t,mapEnd:e,axis:n}=i,a=[e.x-t.x,e.y-t.y];return a[0]*n[0]+a[1]*n[1]>0?1:-1}let fs=class extends fe{constructor(t){super(),this._handles=new Ue,this._arrowManipulatorInfos=new Array,this._angle=0,this._scale=1,this._radius=ut,this._updateAfterDrag=!1,this.events=new $t,this._tool=t.tool,this._view=t.view,this._opaqueMaterial=this._createMaterial(),this._transparentMaterial=this._createMaterial(.5),t.radius!=null&&(this._radius=t.radius),this._createManipulators(),this.forEachManipulator(e=>this._tool.manipulators.add(e))}set orthogonalAvailable(t){this._arrowManipulatorInfos.length>=3&&(this._arrowManipulatorInfos[1].manipulator.available=t,this._arrowManipulatorInfos[3].manipulator.available=t)}destroy(){this._handles=R(this._handles),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._arrowManipulatorInfos.length=0}forEachManipulator(t){for(const{manipulator:e}of this._arrowManipulatorInfos)t(e,G.TRANSLATE_XY)}createGraphicDragPipeline(t,e,n){const a=e.graphic,o=z(a),s=a.geometry.spatialReference;return We(a,n,r=>this.createDragPipeline((l,p,c,d,g)=>({steps:p,cancel:c}=t(l,p,c,d,g),r(l,p,c)),o,s,a),this._view.state.viewingMode)}createDragPipeline(t,e,n,a){return F(this._arrowManipulatorInfos.map(({manipulator:o},s)=>lt(o,(r,l,p,c,d)=>{const g=l.next(_=>({..._,manipulatorType:G.TRANSLATE_XY})).next(he(this._view,r.elevationAlignedLocation)).next(vi(this._view,r.elevationAlignedLocation,e,n,a)).next(uo(r.location,this.angle+(s+1)*Math.PI*.5)).next(ie());t(r,g,p,c,d)})))}get angle(){return this._angle}set angle(t){this._angle=t,this.dragging?this._updateAfterDrag=!0:this._updateManipulatorTransform()}get displayScale(){return this._scale}set displayScale(t){this._scale=t,this._updateManipulatorTransform()}get radius(){return this._radius}set radius(t){this._radius!==t&&(this._radius=t,this._updateManipulators())}_updateManipulators(){for(let t=0;t{this._updateAfterDrag&&a.action==="end"&&!this.dragging&&(this._updateManipulatorTransform(),this._updateAfterDrag=!1)})),n}_createMaterial(t=1){const e=new ui({cullFace:di.Back,renderOccluded:Dt.Transparent,isDecoration:!0});return this._handles.add(y(()=>He.toUnitRGBA(this._view.effectiveTheme.accentColor),n=>{n[3]*=t,e.setParameters({color:n})},$)),e}get test(){return{arrowManipulators:this._arrowManipulatorInfos.map(({manipulator:t})=>t)}}},ys=class{constructor(){this._view=null,this._elevationInfo=null,this._lastDragEvent=null,this._next=null,this._enabled=!1}get enabled(){return this._enabled}set enabled(t){if(this._enabled!==t&&this._lastDragEvent!=null&&this._next!=null){const e=this._lastDragEvent.mapEnd,n=this._snap(this._lastDragEvent.screenEnd);if(n!=null){const a={action:"update",mapStart:this._lastDragEvent.mapStart,mapEnd:t===!0?n:e,screenStart:this._lastDragEvent.screenEnd,screenEnd:this._lastDragEvent.screenEnd};this._next.execute(a)}}this._enabled=t}_snap(t){const e=this._view!=null?this._view.toMap(t,{exclude:[]}):null;return e!=null&&this._view!=null&&(e.z=hn(e,this._view,this._elevationInfo)),e}createDragEventPipelineStep(t,e){this._view=t,this._elevationInfo=e,this._lastDragEvent=null;const n=new Aa;return this._next=n,[a=>{if(this._lastDragEvent=a.action!=="end"?{...a}:null,this._enabled){const o=this._snap(a.screenEnd);return o!=null?{action:a.action,mapStart:a.mapStart,mapEnd:o,screenStart:a.screenStart,screenEnd:a.screenEnd}:null}return{action:a.action,mapStart:a.mapStart,mapEnd:a.mapEnd,screenStart:a.screenStart,screenEnd:a.screenEnd}},n]}};class Ms extends fe{constructor(t){super(),this._handles=new Ue,this._snapToScene=new ys,this._scale=1,this._radius=ut,this._view=t.view,this._tool=t.tool,this._discMaterial=this._createMaterial(),this._discMaterialTransparent=this._createMaterial(.5),t.snapToScene!=null&&(this.snapToScene=t.snapToScene),t.radius!=null&&(this._radius=t.radius),this._createManipulator(),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this._handles=R(this._handles),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._manipulator=null}forEachManipulator(t){t(this._manipulator,G.TRANSLATE_XY)}get displayScale(){return this._scale}set displayScale(t){this._scale=t,this._updateManipulatorTransform()}get snapToScene(){return this._snapToScene.enabled}set snapToScene(t){this._snapToScene.enabled=t}get radius(){return this._radius}set radius(t){t!==this._radius&&(this._radius=t,this._updateManipulator())}createGraphicDragPipeline(t,e,n){const a=e.graphic,o=z(a),s=a.geometry.spatialReference;return We(a,n,r=>this.createDragPipeline((l,p,c,d,g)=>({steps:p,cancel:c}=t(l,p,c,d,g),r(l,p,c)),o,s,a),this._view.state.viewingMode)}createDragPipeline(t,e,n,a){const o=this._view;return lt(this._manipulator,(s,r,l,p,c)=>{const d=r.next(he(o,s.elevationAlignedLocation)).next(vi(o,s.elevationAlignedLocation,e,n,a)).next(...this._snapToScene.createDragEventPipelineStep(o,e)).next(g=>({...g,manipulatorType:G.TRANSLATE_XY})).next(ie());t(s,d,l,p,c)})}_updateManipulatorTransform(){const t=Ge(B.get(),rt(x.get(),this.displayScale,this.displayScale,this.displayScale));this._manipulator.modelTransform=t}_createManipulator(){const t=this._view;this._manipulator=new et({view:t,worldSized:!1,autoScaleRenderObjects:!1,focusMultiplier:1,touchMultiplier:1,collisionType:{type:"disc",direction:j(0,0,1)},worldOriented:!0}),this._updateManipulator()}_updateManipulator(){const t=cn(this._discMaterial,Ca,1,Ra,j(0,0,1),j(0,0,0));t.transformation=Ge(Xe(),j(this._radius,this._radius,this._radius)),this._manipulator.renderObjects=[new w(t,O.Focused),new w(t.instantiate({material:this._discMaterialTransparent}),O.Unfocused)],this._manipulator.radius=rs*(this._radius/ut)}_createMaterial(t=1){const e=new ui({cullFace:di.Back,renderOccluded:Dt.Transparent,isDecoration:!0});return this._handles.add(y(()=>He.toUnitRGBA(this._view.effectiveTheme.accentColor),n=>{n[3]*=t,e.setParameters({color:n})},$)),e}get test(){return{discManipulator:this._manipulator}}}class bs extends fe{constructor(t){super(),this._radius=ut,this.events=new $t,this._tool=t.tool,this._view=t.view;const e=new Zt({getTheme:()=>this._view.effectiveTheme});this._settings=e,t.radius!=null&&(this._radius=t.radius);const n=this._view.effectiveTheme.accentColor;this._materials={materialUnfocused:Mt(this._createDarkenedColor(n,1,.25),Dt.Occlude),materialFocused:Mt(this._createDarkenedColor(n,1,0),Dt.Occlude),materialOccludedUnfocused:Mt(this._createDarkenedColor(n,.7,0),e.zManipulator.renderOccluded),materialOccludedFocused:Mt(this._createDarkenedColor(n,.85,0),e.zManipulator.renderOccluded)},this._themeHandle=y(()=>this._view.effectiveTheme.accentColor,a=>{const o=this._createDarkenedColor(a,1,.25),s=this._createDarkenedColor(a,1,0),r=this._createDarkenedColor(a,.7,0),l=this._createDarkenedColor(a,.85,0),{materialUnfocused:p,materialFocused:c,materialOccludedUnfocused:d,materialOccludedFocused:g}=this._materials;p.setParameters({color:o}),c.setParameters({color:s}),d.setParameters({color:r}),g.setParameters({color:l})}),this._createManipulator(),this.forEachManipulator(a=>this._tool.manipulators.add(a))}destroy(){this._themeHandle=gt(this._themeHandle),this._manipulator.applyObjectTransform=xs,this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()})}forEachManipulator(t){t(this._manipulator,G.TRANSLATE_Z)}createGraphicDragPipeline(t,e,n){const a=e.graphic.geometry.spatialReference;return We(e.graphic,n,o=>this.createDragPipeline((s,r,l,p,c)=>({steps:r,cancel:l}=t(s,r,l,p,c),o(s,r,l)),a),this._view.state.viewingMode)}createDragPipeline(t,e){const n=this._view;return lt(this._manipulator,(a,o,s,r,l)=>{const p=o.next(c=>({...c,manipulatorType:G.TRANSLATE_Z})).next(Ta(n,a.renderLocation,e)).next(ie());t(a,p,s,r,l)})}get radius(){return this._radius}set radius(t){t!==this._radius&&(this._radius=t,this._updateManipulator())}_updateManipulator(){const t=this._settings,e=this._radius/ut,n=t.zManipulator.height*e,a=t.zManipulator.coneHeight*e,o=t.zManipulator.coneWidth*e,s=t.zManipulator.width*e,r=[j(0,0,0),j(0,0,n)],l=[j(0,0,0),j(0,0,n+a)],p=b=>{const f=Xe();if(mn(f,f,[0,0,n]),ma(f,f,Math.PI/2),b){const E=1+2*b/o;va(f,f,[E,E,E])}return f},c=p(0),{materialUnfocused:d,materialFocused:g,materialOccludedUnfocused:_,materialOccludedFocused:m}=this._materials,v=un(d,r,s/2,16,!1),M=dn(d,a,o/2,16,!1);M.transformation=c,this._manipulator.renderObjects=[new w(M,O.Unfocused),new w(v,O.Unfocused),new w(M.instantiate({material:g}),O.Focused),new w(v.instantiate({material:g}),O.Focused),new w(M.instantiate({material:_}),O.Unfocused),new w(v.instantiate({material:_}),O.Unfocused),new w(M.instantiate({material:m}),O.Focused),new w(v.instantiate({material:m}),O.Focused)],this._manipulator.radius=s/2+2,this._manipulator.collisionType={type:"line",paths:[l]}}_createManipulator(){const t=this._view,e=new et({view:t,autoScaleRenderObjects:!1,worldSized:!1,selectable:!1,cursor:"ns-resize",elevationInfo:this.elevationInfo,worldOriented:!0,collisionPriority:1.6});e.applyObjectTransform=n=>{const a=t.state.camera,o=Ji;t.renderCoordsHelper.toRenderCoords(this._manipulator.elevationAlignedLocation,o);const s=gn(a.eye,o),r=a.computeRenderPixelSizeAtDist(s),l=L(Wt,o,a.eye);ai(l,l);const p=Ss;t.renderCoordsHelper.worldUpAtPosition(Ji,p);const c=Math.abs(De(l,p)),d=It(Wt,l,p),g=It(Wt,d,p),_=ni(c,.01,1),m=1-Math.sqrt(1-_*_)/_/a.fullWidth,v=this._settings,M=this._radius/ut,b=v.zManipulator.width*M;Vt(g,ai(g,g),(1/m-1)*s+r*b),n[12]-=Wt[0],n[13]-=Wt[1],n[14]-=Wt[2]},this._manipulator=e,this._updateManipulator()}_createDarkenedColor(t,e,n){const a=_n(t,n);return a.a*=e,He.toUnitRGBA(a)}get test(){return{manipulator:this._manipulator}}}const Ji=H(),Wt=H(),Ss=H(),xs=()=>{};let Ut=class extends fe{constructor(t){super(),this._handles=new Ue,this._interactive=!0;const{tool:e,view:n,snapToScene:a,radius:o}=t;this._view=n,this.xyManipulation=new Ms({tool:e,view:n,snapToScene:a,radius:o}),this.xyAxisManipulation=new fs({tool:e,view:n,radius:o}),this.zManipulation=new bs({tool:e,view:n,radius:o}),this.xyManipulation.available=t.xyAvailable,this.xyAxisManipulation.available=t.xyAxisAvailable,this.zManipulation.available=t.zAvailable,this._autoHideXYAxis(),this.forEachManipulator(s=>this._handles.add(s.events.on("grab-changed",()=>this._updateManipulatorInteractivity())))}destroy(){this._handles.destroy(),this.xyManipulation.destroy(),this.xyAxisManipulation.destroy(),this.zManipulation.destroy()}createGraphicDragPipeline(t,e,n){return F([this.xyManipulation.createGraphicDragPipeline((a,o,s,r,l)=>t(S.XY,a,o,s,r,l),e,n),this.xyAxisManipulation.createGraphicDragPipeline((a,o,s,r,l)=>t(S.XY_AXIS,a,o,s,r,l),e,n),this.zManipulation.createGraphicDragPipeline((a,o,s,r,l)=>t(S.Z,a,o,s,r,l),e,n)])}createDragPipeline(t,e,n,a){return F([this.xyManipulation.createDragPipeline((o,s,r,l,p)=>t(S.XY,o,s,r,l,p),e,n,a),this.xyAxisManipulation.createDragPipeline((o,s,r,l,p)=>t(S.XY_AXIS,o,s,r,l,p),e,n,a),this.zManipulation.createDragPipeline((o,s,r,l,p)=>t(S.Z,o,s,r,l,p),n)])}set snapToScene(t){this.xyManipulation.snapToScene=t}set angle(t){this.xyAxisManipulation.angle=t}set interactive(t){this._interactive!==t&&(this._interactive=t,this._updateManipulatorInteractivity())}set radius(t){this.xyAxisManipulation.radius=t,this.xyManipulation.radius=t,this.zManipulation.radius=t}set displayScale(t){this.xyManipulation.displayScale=t,this.xyAxisManipulation.displayScale=t}forEachManipulator(t){this.xyManipulation.forEachManipulator(e=>t(e,G.TRANSLATE_XY)),this.xyAxisManipulation.forEachManipulator(e=>t(e,G.TRANSLATE_XY)),this.zManipulation.forEachManipulator(e=>t(e,G.TRANSLATE_Z))}get _xyAxisVisible(){const t=this.xyManipulation.someManipulator(e=>e.focused)||this.xyAxisManipulation.someManipulator(e=>e.focused);return this._view.inputManager&&this._view.inputManager.latestPointerType==="touch"||t}_autoHideXYAxis(){const t=this.xyAxisManipulation,e=this.xyManipulation;if(vn("esri-mobile"))return;const n=[];e.forEachManipulator(o=>n.push(o)),t.forEachManipulator(o=>n.push(o));const a=()=>{const o=[];this._xyAxisVisible||t.forEachManipulator(s=>o.push(s.disableDisplay())),this._handles.remove(Qi),this._handles.add(o,Qi)};for(const o of n)this._handles.add(o.events.on("focus-changed",a));this._view.inputManager&&this._handles.add(Xt(()=>{var o;return(o=this._view.inputManager)==null?void 0:o.latestPointerType},a)),a()}_updateManipulatorInteractivity(){const t=this.grabbing;this.forEachManipulator(e=>{e.interactive=!t&&this._interactive||e.grabbing})}static radiusForSymbol(t){const e=t!=null&&t.type==="point-3d"&&t.symbolLayers;return e&&e.some(n=>n.type==="icon")?La:ut}};const Qi="disable-xy-axis-display";var S;(function(i){i[i.XY=0]="XY",i[i.XY_AXIS=1]="XY_AXIS",i[i.Z=2]="Z"})(S||(S={}));class xi extends fe{constructor(t){super(),this._view=t.view,this._tool=t.tool,this._graphicState=t.graphicState,this._createManipulator(),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._manipulator=null,this._graphicState=null}forEachManipulator(t){t(this._manipulator,G.TRANSLATE_XY)}createGraphicDragPipeline(t){return We(this._graphicState.graphic,t,e=>this.createDragPipeline(e),this._view.state.viewingMode)}createDragPipeline(t){const e=this._view,n=this._graphicState.graphic,a=n.geometry!=null?n.geometry.spatialReference:null;return lt(this._manipulator,(o,s,r,l,p)=>{const c=s.next(so(p,e,n,a)).next(Kt()).next(ie());t(o,c,r,l,p)})}_createManipulator(){const t=this._view,e=this._graphicState.graphic;this._manipulator=new vo({graphic:e,view:t,selectable:!0,cursor:"move"})}}let ws=class{constructor(t){this.allGraphics=t,this.type="graphic-move-start"}};class Os{constructor(t,e,n){this.dx=t,this.dy=e,this.allGraphics=n,this.type="graphic-move"}}class ta{constructor(t){this.allGraphics=t,this.type="graphic-move-stop"}}const pt="manipulators";let dt=class extends $t.EventedMixin(Fe){constructor(i){super(i),this._infos=new Map,this.graphics=new fn,this.enableZ=!0,this.tooltipOptions=new Rt,this.type="move-3d",this._updatingHandles=new gi,this._moveManipulation=null,this._tooltip=null,this._translateGraphicTooltipInfo=null,this._translateGraphicXYTooltipInfo=null,this._translateGraphicZTooltipInfo=null}initialize(){const{view:i}=this;this.addHandles([this.graphics.on("change",e=>{e.removed.forEach(n=>this.removeHandles(n)),this._updateGraphicInfos(e),this._setupFastTransformUpdates(e.added),this._refreshManipulators()}),y(()=>this.tooltipOptions.enabled,e=>{this._tooltip=e?new ve({view:i}):R(this._tooltip)},Qt)]);const t=this.graphics.toArray();this._updateGraphicInfos({added:t,removed:[]}),this._setupFastTransformUpdates(t),this._refreshManipulators(),this.finishToolCreation()}destroy(){this._tooltip=R(this._tooltip),this._moveManipulation=R(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}get updating(){return this._updatingHandles.updating}reset(){}_updateGraphicInfos({added:i,removed:t}){var e;for(const n of i){if(yn(n)!==fa.SUPPORTED)continue;const a=new Es(n),o=this.view.trackGraphicState(a.state);this._infos.set(a.graphic,{info:a,handle:o})}for(const n of t)(e=this._infos.get(n))==null||e.handle.remove(),this._infos.delete(n)}_setupFastTransformUpdates(i){for(const t of i){const{info:e}=this._infos.get(t);this.addHandles(Mi(e.state),t)}}_refreshManipulators(){if(this.removeHandles(pt),this._moveManipulation=R(this._moveManipulation),this.manipulators.removeAll(),this._infos.size===0)return;const i=Array.from(this._infos.values(),({info:t})=>t);this._createManipulators(i),this._createVisualElements(i),this._updateMoveManipulation(i)}_createManipulators(i){for(const t of i){const e=t.state;t.manipulationXY=new xi({tool:this,view:this.view,graphicState:e}),t.manipulationXY.forEachManipulator(n=>this.addHandles([n.events.on("immediate-click",a=>{this.emit("immediate-click",{...a,graphic:e.graphic}),a.stopPropagation()}),n.events.on("grab-changed",({action:a})=>{const{tooltipOptions:o,_tooltip:s}=this;s!=null&&(a==="start"?(this._translateGraphicTooltipInfo??(this._translateGraphicTooltipInfo=new _e({tooltipOptions:o})),s.info=this._translateGraphicTooltipInfo,s.info.tooltipOptions=o,s.info.distance=ct):s.clear())})],pt)),this.addHandles(t.manipulationXY.createDragPipeline((n,a,o,s)=>this._buildDragEventPipeline(i,S.XY,n,a,o,s)),pt)}this._createMoveManipulation(i)}_createMoveManipulation(i){const t=new Ut({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:i.length===1?Ut.radiusForSymbol(i[0].graphic.symbol):ut});this._moveManipulation=t,t.elevationInfo={mode:"absolute-height",offset:0},t.forEachManipulator(o=>{this.addHandles(o.events.on("immediate-click",s=>{t.zManipulation.hasManipulator(o)||this.graphics.length!==1||this.emit("immediate-click",{...s,graphic:this.graphics.at(0)}),s.stopPropagation()}),pt)});const e=o=>s=>{this.addHandles(s.events.on("focus-changed",({action:r})=>{const l=this._tooltip;l!=null&&(r==="focus"?this._updateMoveTooltip(i,o):l.clear())}),pt)};this._moveManipulation.xyManipulation.forEachManipulator(e(S.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(S.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(S.Z));const n=()=>this._updateMoveManipulation(i);for(const o of i)this.addHandles([o.state.on("changed",n),y(()=>o.state.displaying,n)],pt);const a=i[i.length-1];this.addHandles(a.state.on("changed",()=>this._updateMoveManipulationAngle(a)),pt),this.addHandles(t.createDragPipeline((o,s,r,l,p)=>this._buildDragEventPipeline(i,o,s,r,l,p),z(a.graphic),a.graphic.geometry.spatialReference,a.graphic),pt),this._updateMoveManipulationAngle(a)}_createVisualElements(i){for(const t of i){const e=t.graphic,n=qe({view:this.view,graphic:e,forEachManipulator:a=>{var o,s;(o=t.manipulationXY)==null||o.forEachManipulator(a),(s=this._moveManipulation)==null||s.forEachManipulator(a)},onManipulatorsChanged:()=>Z()});n!=null&&(t.geometryRepresentation=n.visualElement,t.geometryRepresentation instanceof Nt&&this.addHandles([t.geometryRepresentation.events.on("attachment-origin-changed",()=>{t.state.isDraped||this._updateMoveManipulation(i)}),y(()=>t.state.isDraped,()=>this._updateMoveManipulation(i))],pt),this.addHandles(n,pt))}}_updateMoveManipulationAngle(i){this._moveManipulation&&(this._moveManipulation.angle=bi(i.graphic.geometry))}_updateMoveManipulation(i){const t=Ne(0,0,0,this.view.spatialReference);let e=0,n=!1;const a=this._moveManipulation;if(a){for(const o of i){if(!o.state.displaying)continue;const s=o.state.graphic;this.enableZ&&kt(s)&&(n=!0);const r=o.geometryRepresentation instanceof Nt&&!o.state.isDraped?o.geometryRepresentation.attachmentOrigin:wa(this.view,s);if(r!=null){const{x:l,y:p,z:c}=r;t.x+=l,t.y+=p,c&&(t.z??(t.z=0),t.z+=c),e++}}e>0?(t.x/=e,t.y/=e,t.z??(t.z=0),t.z/=e,a.location=t,a.xyManipulation.available=!0,a.xyAxisManipulation.available=!0,a.zManipulation.available=n):a.available=!1}}_buildDragEventPipeline(i,t,e,n,a,o){const s=[],r=[];let l=null,p=null;const c=()=>{for(const d of s)d.dragging=!1;s.length=0,r.length=0,l=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(i.length===1&&t===S.XY){const d=i[0].graphic;({steps:n,cancel:a}=this._buildSnappingPipelineSteps(d,z(d),n,a,o))}return a=a.next(d=>p==null?void 0:p(d)).next(()=>(this.emit("graphic-move-stop",new ta(r)),this.destroyed||c(),null)),{steps:n=n.next(d=>{var g,_;if(d.action==="start"){s.length=0,r.length=0;for(const m of i)m.dragging||!((g=m.manipulationXY)!=null&&g.hasManipulator(e))&&((_=m.manipulationXY)!=null&&_.grabbing)||(s.push(m),r.push(m.graphic),m.dragging=!0);if(r.length!==0&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),l=go(r,this.view.state.viewingMode),p=_o(r),this.emit("graphic-move-start",new ws(r)),this.destroyed))return null}return r.length!==0?d:null}).next(d=>l==null?void 0:l(d)).next(d=>(this._updateMoveTooltip(i,t,d),d)).next(d=>{switch(d.action){case"start":case"update":if(d.translationX||d.translationY||d.translationZ){const g=this.view.toScreen(d.mapStart),_=this.view.toScreen(d.mapEnd),m=_.x-g.x,v=_.y-g.y;if(this.emit("graphic-move",new Os(m,v,r)),this.destroyed)return null}break;case"end":if(this.emit("graphic-move-stop",new ta(r)),this.destroyed)return null;c()}return null}),cancel:a}}_updateMoveTooltip(i,t,e){const{tooltipOptions:n,_tooltip:a}=this;if(a==null)return;a.clear();const o=i.length===0?"absolute-height":i[0].state.isDraped?"on-the-ground":"absolute-height";switch(t){case S.XY:a.info=this._translateGraphicTooltipInfo??(this._translateGraphicTooltipInfo=new _e({tooltipOptions:n})),this._updateMoveTooltipDistance(a.info,e,(s,r)=>bt(s,r,o));break;case S.XY_AXIS:a.info=this._translateGraphicXYTooltipInfo??(this._translateGraphicXYTooltipInfo=new yi({tooltipOptions:n})),this._updateMoveTooltipDistance(a.info,e,(s,r)=>{const l=bt(s,r,o);return Ie(l,ze(e))});break;case S.Z:a.info=this._translateGraphicZTooltipInfo??(this._translateGraphicZTooltipInfo=new je({tooltipOptions:n})),this._updateMoveTooltipDistance(a.info,e,Le)}a.info.tooltipOptions=n}_updateMoveTooltipDistance(i,t,e){if(t!=null&&t.action!=="end"){const{mapStart:n,mapEnd:a}=t,o=e(n,a);i.distance=o??ct}else i.distance=ct}_buildSnappingPipelineSteps(i,t,e,n,a){const o=i.geometry;if(o==null||o.type!=="point"&&o.type!=="mesh")return{steps:e,cancel:n};const s=(o.type==="point"?o:o.anchor).clone(),r=new Re({elevationInfo:t,pointer:a,editGeometryOperations:Be.fromGeometry(s,this.view.state.viewingMode),visualizer:new ge,excludeFeature:i}),l=this.snappingManager,{snappingStep:p,cancelSnapping:c}=Ce({snappingContext:r,snappingManager:l,updatingHandles:this._updatingHandles});return n=n.next(c),{steps:e=e.next(d=>(s.z=Mn(this.view,s,z(i),{mode:"absolute-height",offset:0}),{...d,snapOrigin:r.coordinateHelper.pointToVector(s)})).next(...p),cancel:n}}get test(){return{tooltip:this._tooltip}}};h([u({constructOnly:!0,nonNullable:!0})],dt.prototype,"view",void 0),h([u()],dt.prototype,"graphics",void 0),h([u({constructOnly:!0,nonNullable:!0})],dt.prototype,"enableZ",void 0),h([u({constructOnly:!0,type:Rt})],dt.prototype,"tooltipOptions",void 0),h([u({constructOnly:!0})],dt.prototype,"snappingManager",void 0),h([u()],dt.prototype,"type",void 0),h([u()],dt.prototype,"updating",null),dt=h([k("esri.views.3d.interactive.editingTools.graphicMove3D.GraphicMoveTool")],dt);class Es{constructor(t){this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1,this.state=new Ft({graphic:t})}get graphic(){return this.state.graphic}}function ea(i,t,e){const n=e.mode==="on-the-ground"?ki.XY:ki.XYZ;return new fo(i,n,t,0)}function ia(i,t,e){const n=H();if(!i.renderCoordsHelper.toRenderCoords(t,n))return null;const a=aa(i,t,me(e.plane)),o=aa(i,t,e.edgeDirection);if(a==null||o==null)return null;const s=It(H(),a,o);return ya(n,s,_i())}function aa(i,t,e){const n=Ne(t.x+e[0],t.y+e[1],t.z+e[2],t.spatialReference),a=H(),o=H();return i.renderCoordsHelper.toRenderCoords(t,a)&&i.renderCoordsHelper.toRenderCoords(n,o)?Ma(o,a,o):null}function Ts(i,t,e){const n=me(i),a=Ma(H(),t,e),o=It(H(),a,n),s=It(H(),a,o);return bn(a[0],a[1],a[2],0,o[0],o[1],o[2],0,s[0],s[1],s[2],0,0,0,0,1)}function As(i,t,e){const n=e.projectToRenderScreen(i,Gi()),a=e.projectToRenderScreen(t,Gi());return n!=null&&a!=null?Sn(L(n,n,a)):0}let Tt=class extends Ye{constructor(t){super(t),this.type="reshape-edge-offset",this.distance=ct,this.area=null,this.totalLength=null}};h([u()],Tt.prototype,"type",void 0),h([u()],Tt.prototype,"distance",void 0),h([u()],Tt.prototype,"area",void 0),h([u()],Tt.prototype,"totalLength",void 0),Tt=h([k("esri.views.interactive.tooltip.ReshapeEdgeOffsetTooltipInfo")],Tt);let C=class extends $t.EventedMixin(Yt){constructor(t){super(t),this._selectedIndex=0,this._manipulatorHandles=new Ue,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=I.NONE,this._updatingHandles=new gi,this._recreatingManipulators=!1,this._settings=new Zt({getTheme:()=>this.view.effectiveTheme}),this._translateGraphicTooltipInfo=null,this._translateGraphicXYTooltipInfo=null,this._translateGraphicZTooltipInfo=null,this._translateVertexTooltipInfo=null,this._translateVertexXYTooltipInfo=null,this._translateVertexZTooltipInfo=null,this._edgeOffsetTooltipInfo=null,this.outputGeometry=null,this._vertexLaserLineVisualElement=null}initialize(){const{graphic:t,view:e}=this,n=this._settings.manipulators,a=n.vertex;this._vertexManipulatorMaterial=Mt(Y(a.color),a.renderOccluded),this._vertexManipulatorOutlineMaterial=ne(Y(a.outlineColor),a.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=ne(Y(a.hoverOutlineColor),a.renderOccluded);const o=n.edge;this._edgeManipulatorMaterial=Mt(Y(o.color),o.renderOccluded),this._edgeManipulatorOutlineMaterial=ne(Y(o.outlineColor),o.renderOccluded);const s=n.edgeOffset;this._edgeOffsetManipulatorMaterial=Mt(Y(s.color),s.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=Mt(Y(s.hoverColor),s.renderOccluded,!1);const r=n.selected;this._selectedManipulatorMaterial=Mt(Y(r.color),r.renderOccluded),this._selectedManipulatorOutlineMaterial=ne(Y(r.outlineColor),r.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=ne(Y(r.hoverOutlineColor),r.renderOccluded);const l=this._graphicState=new Ft({graphic:t});this._tooltip=new ve({view:e}),this.addHandles([y(()=>{const p=this._settings.manipulators;return{vertexSettings:p.vertex,edgeSettings:p.edge,edgeOffsetSettings:p.edgeOffset,selectedSettings:p.selected}},({vertexSettings:p,edgeSettings:c,edgeOffsetSettings:d,selectedSettings:g})=>{p.applyColor(this._vertexManipulatorMaterial),p.applyOutline(this._vertexManipulatorOutlineMaterial),p.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),c.applyColor(this._edgeManipulatorMaterial),c.applyOutline(this._edgeManipulatorOutlineMaterial),d.applyColor(this._edgeOffsetManipulatorMaterial),d.applyHover(this._edgeOffsetManipulatorHoverMaterial),g.applyColor(this._selectedManipulatorMaterial),g.applyOutline(this._selectedManipulatorOutlineMaterial),g.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),y(()=>l.displaying,p=>{for(const c of this._manipulatorInfos)c.manipulator.available=p}),y(()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:p,enabled:c,edgeOffsetEnabled:d})=>{p!=null&&(p.visible=c,p.edgeDistance=d?"far":"default")},$),Xt(()=>!this._tooltipOptions.enabled,()=>this._tooltip.clear(),$),this.view.trackGraphicState(l)])}destroy(){this._segmentLabels=R(this._segmentLabels),this._tooltip=R(this._tooltip),this._removeManipulators(),this._updatingHandles.destroy()}get inputGeometry(){return this._editGeometryOperations!=null?this._editGeometryOperations.data.geometry:null}set inputGeometry(t){this._recreateEditGeometryAndManipulators(t)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _labelOptions(){return this.tool.labelOptions}get _tooltipOptions(){return this.tool.tooltipOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}removeSelectedVertices(){const t=this._manipulatorInfos.filter(e=>e.manipulator.selected&&e.type==="vertex");this._removeVertices(t)}onManipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=R(this._moveManipulation),this._graphicMoveManipulation=R(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(t){if(this._editGeometryOperations==null)return;const e=z(this.graphic);for(const n of this._editGeometryOperations.data.components){const a=t==null?void 0:t.byComponentIndex.get(n.index);for(const o of n.vertices){const s=a==null?void 0:a.has(o.index);this._createVertexOrEdgeManipulator(o,e,s)}for(const o of n.edges)this._createVertexOrEdgeManipulator(o,e)}this._createGraphicMoveManipulation(),this._createMoveManipulation(e),this._createVisualElements()}get canRedo(){return this._editGeometryOperations!=null&&this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations!=null&&this._editGeometryOperations.canUndo}redo(){if(this._editGeometryOperations==null)return null;const t=this._editGeometryOperations.redo();return t!=null&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),t}undo(){if(this._editGeometryOperations==null)return null;this.emit("undo");const t=this._editGeometryOperations.undo();return t!=null&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),t}_recreateManipulators(){this._recreatingManipulators||(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._createManipulators(),this._recreatingManipulators=!1)}_recreateEditGeometryAndManipulators(t){const e={byComponentIndex:new Map};if(t!=null&&this.inputGeometry!=null&&xn(t,this.inputGeometry)){for(const a of this._manipulatorInfos)if(a.type==="vertex"&&a.manipulator.selected){const{index:o,component:{index:s}}=a.handle,{byComponentIndex:r}=e,l=r.get(s)||new Set;l.add(o),r.set(s,l)}}if(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._editGeometryOperations=R(this._editGeometryOperations),this._segmentLabels=R(this._segmentLabels),t==null)return void(this._recreatingManipulators=!1);const n=t.type==="mesh"?t.anchor:t;this._editGeometryOperations=Be.fromGeometry(n,this.view.state.viewingMode),this._createManipulators(e),this._segmentLabels=new Pe({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:z(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}),this._recreatingManipulators=!1}_perGraphicManipulatorDragAction(t,e){if(e.action==="end")return e;let n=0;const a=[],o=this._manipulatorInfos.some(r=>r.type==="vertex"&&r.manipulator.selected),s=t===Jt.SELECTED_OR_ALL&&o;for(const r of this._manipulatorInfos)r.type==="vertex"&&(r.manipulator.grabbing||s&&!r.manipulator.selected||a.push(r),n++);if(a.length===0)return e;if(this._moveVertices(a,e),a.length===n){if(this._updateEventState(I.MOVING),this.destroyed)return e;this.emit("move",{type:"move",dx:e.screenDeltaX,dy:e.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(I.RESHAPING),this.destroyed)return e;this.emit("reshape",{type:"reshape",mover:this.graphic})}return e}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((t,e)=>e.type==="vertex"&&e.manipulator.selected?t+1:t,0)>1}_perVertexManipulatorDragAction(t){if(this._updateEventState(I.RESHAPING),this.destroyed)return;const{mapDeltaX:e,mapDeltaY:n,mapDeltaZ:a}=t;if(!e&&!n&&!a)return;const o=[];for(const s of this._manipulatorInfos)s.type==="vertex"&&(s.manipulator.selected&&!s.manipulator.grabbing||s===t.info)&&o.push(s);this._moveVertices(o,t,St.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(t){if(t===this._reshapeEventState)return!1;switch(t){case I.NONE:if(this._numGrabbing!==0||this._numDragging!==0)return!1;switch(this._reshapeEventState){case I.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case I.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case I.MOVING:switch(this._reshapeEventState){case I.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case I.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case I.RESHAPING:switch(this._reshapeEventState){case I.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case I.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const e=this._reshapeEventState!==t;return this._reshapeEventState=t,e}_createGraphicMoveManipulation(){const{tool:t,view:e}=this,n=this._graphicState;if(this._graphicMoveManipulation=new xi({tool:t,view:e,graphicState:n}),this.enableMoveGraphic){let a=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline((o,s,r)=>{s.next(l=>this._trackNumDragging(l)).next(l=>(l.action==="start"&&(a=this._editGeometryOperations.createUndoGroup()),l)).next(l=>this._perGraphicManipulatorDragAction(Jt.ALL,l)).next(l=>(this._updateTranslateGraphicTooltip(S.XY,l),l)).next(l=>{l.action==="end"&&(this._tooltip.clear(),a=gt(a))}),r.next(()=>this._onDragCancel(!0,()=>a=gt(a)))})),this._graphicMoveManipulation.forEachManipulator(o=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(o,!1)))}else this._graphicMoveManipulation.forEachManipulator(a=>{a.grabbable=!1,a.cursor=null});this._graphicMoveManipulation.forEachManipulator(a=>this._manipulatorHandles.add(a.events.on("immediate-click",o=>{this._manipulatorInfos.some(s=>s.manipulator.selected)?this._clearSelection():this.emit("immediate-click",{...o,graphic:this.graphic}),o.stopPropagation()})))}_createMoveManipulation(t){const{graphic:e,tool:n,view:a}=this,o=this._graphicState;this._moveManipulation=new Ut({tool:n,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&kt(e),snapToScene:!1,radius:Ut.radiusForSymbol(e.symbol)}),this._moveManipulation.forEachManipulator(l=>this.addHandles([l.events.on("immediate-click",p=>{this._moveManipulation.zManipulation.hasManipulator(l)||this._manipulatorInfos.some(c=>c.manipulator.selected)||this.emit("immediate-click",{...p,graphic:e}),p.stopPropagation()}),this._watchAndUpdateGrabState(l,!1)]));const s=l=>p=>{this.addHandles(p.events.on("focus-changed",({action:c})=>{c==="focus"&&this._tooltipOptions.enabled?this._updateTranslateTooltip(l):this._tooltip.clear()}))};this._moveManipulation.xyManipulation.forEachManipulator(s(S.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(s(S.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(s(S.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const r=e.geometry.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((l,p,c,d,g)=>{const{snappingStep:_,cancelSnapping:m}=Ce({predicate:v=>!!v.info,snappingManager:n.snappingManager,snappingContext:new Re({editGeometryOperations:this._editGeometryOperations,elevationInfo:t,pointer:g,excludeFeature:e,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:!1});return d=d.next(v=>(this._onDragCancel(),v)).next(m),{steps:c=c.next(v=>this._trackNumDragging(v)).next(v=>{const M=this._manipulatorInfos.filter(b=>b.type==="vertex"&&b.manipulator.selected);return v.manipulatorType===G.TRANSLATE_XY&&M.length===1?{...v,info:M[0],snapOrigin:M[0].handle.pos}:v}).next(Vi(this.view,t,e)).next(..._).next(Kt()).next(v=>this._perGraphicManipulatorDragAction(Jt.SELECTED_OR_ALL,v)).next(v=>(this._updateTranslateTooltip(l,v),v)),cancel:d}},t,r,e),y(()=>o.displaying,()=>this._updateMoveManipulationPosition(),$),o.on("changed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),y(()=>o.isDraped,l=>{this._updateMoveManipulationPosition();const p="align-move-manipulation";l?this.addHandles(this.view.elevationProvider.on("elevation-change",()=>this._updateMoveManipulationPosition()),p):this.removeHandles(p)},$)])}_createVisualElements(){const{graphic:t,view:e}=this,n=qe({view:e,graphic:t,forEachManipulator:a=>{if(!this.destroyed&&!this._recreatingManipulators){this._graphicMoveManipulation.forEachManipulator(a),this._moveManipulation.forEachManipulator(a);for(const o of this._manipulatorInfos)a(o.manipulator,G.TRANSLATE_XY)}},onManipulatorsChanged:a=>this.on("manipulators-changed",a)});n!=null&&(this._outlineVisualElement=n.visualElement instanceof Nt?n.visualElement:null),this._outlineVisualElement!=null&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()})),this._manipulatorHandles.add(n)}_createEdgeOffsetManipulator(t,e=z(this.graphic)){var m,v;const n=this._settings.manipulators.edgeOffset,a=n.size/2,o=a+n.collisionPadding,s=a/o,r=s*Math.sqrt(3)/2;this._edgeOffsetManipulatorGeometryInside==null&&(this._edgeOffsetManipulatorGeometryInside=Ae(this._edgeOffsetManipulatorMaterial,r,s/2,s/2,n.height,n.offset)),this._edgeOffsetManipulatorGeometryOutside==null&&(this._edgeOffsetManipulatorGeometryOutside=Ae(this._edgeOffsetManipulatorMaterial,-r,s/2,s/2,n.height,-n.offset));const l=[new w(this._edgeOffsetManipulatorGeometryInside.instantiate(),O.Unfocused),new w(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),O.Focused),new w(this._edgeOffsetManipulatorGeometryOutside.instantiate(),O.Unfocused),new w(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),O.Focused)],p=new et({view:this.view,renderObjects:l,elevationInfo:e.mode!=="on-the-ground"||Di(this.graphic.symbol)?{mode:"absolute-height",offset:0}:e,worldOriented:!1,focusMultiplier:1,radius:o,available:!(!this.graphic.visible||!((m=this.graphic.layer)!=null&&m.visible)),collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),c=new et({view:this.view,worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!((v=this.graphic.layer)!=null&&v.visible)),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),d={manipulator:p,handle:t,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:c,elevationInfo:e,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,n.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const g=[];for(const M of[d.handle.leftVertex,d.handle.rightVertex]){const b=this._getManipulatorInfoFromHandle(M);b!=null&&g.push(b.manipulator.events.on("location-update",()=>this._updateEdgeOffsetManipulator(d)))}d.locationUpdateHandle=F(g),this._manipulatorHandles.add(d.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(c,!0)],p),this._manipulatorHandles.add(lt(p,this._createEdgeOffsetPipeline(d,e)),p),this._manipulatorHandles.add(lt(c,(M,b,f,E)=>{if(E==="touch")this._createEdgeOffsetPipeline(d,e)(M,b,f);else if(this.enableMoveGraphic){const D=this.graphic,V=D.geometry!=null?D.geometry.spatialReference:null;b.next(N=>this._trackNumDragging(N)).next(he(this.view,M.elevationAlignedLocation)).next(vi(this.view,M.elevationAlignedLocation,e,V,D)).next(ie()).next(Kt()).next(N=>this._perGraphicManipulatorDragAction(Jt.ALL,N)).next(N=>(this._updateTranslateGraphicTooltip(S.XY,N),N)).next(N=>{N.action==="end"&&this._tooltip.clear()}),f.next(()=>this._onDragCancel(!M.metadata.deleting))}}),p);const _=M=>{this._manipulatorInfos.some(b=>b.manipulator.selected)?this._clearSelection():this.emit("immediate-click",{...M,graphic:this.graphic}),M.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",_),c.events.on("immediate-click",_),p.events.on("focus-changed",({action:M})=>{const{_tooltipOptions:b,_tooltip:f}=this;M==="focus"&&b.enabled?(f.info=this._edgeOffsetTooltipInfo??(this._edgeOffsetTooltipInfo=new Tt({tooltipOptions:b})),f.info.distance=ct,f.info.tooltipOptions=b,this._updateTooltipAreaOrTotalLength(f.info)):f.clear()})],p),this._manipulatorInfos.push(d),this.manipulators.add(p),this.manipulators.add(c),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(t,e){const n=t.manipulator,a=t.edgeManipulator,o=()=>{t.visibilityHandle=gt(t.visibilityHandle);const s=this._getManipulatorInfoFromHandle(t.handle.leftVertex),r=this._getManipulatorInfoFromHandle(t.handle.rightVertex),l=s!=null&&r!=null&&As(s.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera){n.grabbable=!0,a.grabbable=this.enableMoveGraphic})]))};this._manipulatorHandles.add([n.events.on("focus-changed",o),a.events.on("focus-changed",o),Z(()=>{gt(t.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)})],n),o()}_updateEdgeOffsetManipulator(t){this._updateManipulatorPosition(t);const{coordinateHelper:e}=this._editGeometryOperations.data,n=ia(this.view,t.manipulator.elevationAlignedLocation,ea(e,t.handle,t.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(t.handle.leftVertex),o=this._getManipulatorInfoFromHandle(t.handle.rightVertex);if(a==null||o==null)return;const s=a.manipulator.renderLocation,r=o.manipulator.renderLocation,l=n!=null?Ts(n,s,r):wn;t.manipulator.modelTransform=l,t.edgeManipulator.elevationAlignedLocation=t.manipulator.elevationAlignedLocation,t.edgeManipulator.modelTransform=l;const p=te(L(Se,s,r))/2;t.edgeManipulator.collisionType={type:"line",paths:[[[-p,0,0],[p,0,0]]]}}_createEdgeOffsetPipeline(t,e){return(n,a,o)=>{this._clearSelection();const{step:s,cleanup:r}=this._initializeEdgeOffset(t,e);a.next(l=>this._trackNumDragging(l)).next(he(this.view,n.elevationAlignedLocation)).next(s).next(ro(this.view)).next(lo(this.view,this._editGeometryOperations.data.spatialReference)).next(Kt()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(t)).next(this._showEdgeOffsetTooltip()).next(l=>{l.action==="end"&&r()}),o.next(()=>{n.metadata.deleting||(r(),this._onDragCancel())})}}_initializeEdgeOffset(t,e){const{view:n}=this,a=this._editGeometryOperations,o=ea(a.data.coordinateHelper,t.handle,e),s=a.createUndoGroup(),r=ia(n,t.manipulator.elevationAlignedLocation,o);if(o.requiresSplitEdgeLeft){const m=this._getManipulatorInfoFromHandle(t.handle.leftVertex.leftEdge);m!=null&&this._splitEdgeManipulator(m,1)}if(o.requiresSplitEdgeRight){const m=this._getManipulatorInfoFromHandle(t.handle.rightVertex.rightEdge);m!=null&&this._splitEdgeManipulator(m,0)}const l=()=>new An({paths:[[t.handle.leftVertex.pos,t.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),p=this._settings,c=new Nt({view:n,isDraped:this._graphicState.isDraped,geometry:l(),elevationInfo:t.elevationInfo,width:p.visualElements.lineGraphics.outline.width,attached:!1,isDecoration:!0});let d;const g=()=>{this._cleanEdgeOffsetCollapsedEdges(t),d=gt(d)},_=this.on("undo",g);return d=F([y(()=>Y(this._accentColor),m=>c.color=m,$),Gt(c),y(()=>this._graphicState.isDraped,m=>c.isDraped=m),this._graphicState.on("changed",()=>c.geometry=l()),s,_]),c.attached=!0,{step:m=>o==null||r==null?(g(),null):{...m,operation:o,plane:r},cleanup:g}}_applyEdgeOffsetStep(t){return e=>{if(this.destroyed||e.operation==null)return e;this._updateEventState(I.RESHAPING);const{mapDeltaX:n,mapDeltaY:a,mapDeltaZ:o}=e;return(n||a||o)&&(this._offsetEdge(t,e),this.emit("reshape",{type:"reshape",mover:this.graphic})),e}}_applyComputeEdgeOffsetDistanceStep(){return t=>{const{operation:e,mapEnd:n}=t;return e==null||n==null?t:(t.action==="start"&&e.selectArrowFromStartPoint(n),{...t,signedDistance:e.signedDistanceToPoint(n)})}}_showEdgeOffsetTooltip(){return t=>{const{mapEnd:e,signedDistance:n,operation:a}=t,{_tooltip:o,_tooltipOptions:s}=this;return s.enabled&&n!=null?(o.info=this._edgeOffsetTooltipInfo??(this._edgeOffsetTooltipInfo=new Tt({tooltipOptions:s})),o.info.tooltipOptions=s,o.info.distance=t.action==="end"?ct:Gs(this._graphicState.isDraped,n*a.selectedArrow,e,a.plane,this._editGeometryOperations.data.coordinateHelper),this._updateTooltipAreaOrTotalLength(o.info),t):(o.clear(),t)}}_cleanEdgeOffsetCollapsedEdges(t){var l,p;const e=(l=t.handle.leftVertex.leftEdge)==null?void 0:l.leftVertex,n=t.handle.leftVertex,a=(p=t.handle.rightVertex.rightEdge)==null?void 0:p.rightVertex,o=t.handle.rightVertex,s=this._editGeometryOperations.data.coordinateHelper,r=[];if(e&&s.distance(e.pos,n.pos)this._updateManipulatorPosition(c)))}c.locationUpdateHandle=F(_),this._manipulatorHandles.add(c.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);const d=lt(p,(_,m,v,M)=>{let b=null;const{snappingStep:f,cancelSnapping:E}=Ce({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new Re({editGeometryOperations:this._editGeometryOperations,elevationInfo:e,pointer:M,excludeFeature:this.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:!1});v=v.next(D=>(this._onDragCancel(!_.metadata.deleting,()=>b=gt(b)),D)).next(E),m.next(D=>this._trackNumDragging(D)).next(D=>{if(D.action==="start"&&(b=this._editGeometryOperations.createUndoGroup()),c.type==="edge"){const V=this._splitEdgeManipulator(c);return{...D,info:V,snapOrigin:V.handle.pos}}return{...D,info:c,snapOrigin:c.handle.pos}}).next(he(this.view,_.elevationAlignedLocation)).next(po(this.view,this.graphic,_.elevationAlignedLocation,_.location.spatialReference,this.graphic)).next(Vi(this.view,e,this.graphic)).next(...f).next(Kt()).next(D=>{this._perVertexManipulatorDragAction(D),D.action==="end"&&(b=gt(b)),this._updateTranslateVertexTooltip(_,S.XY,D)})});return this._manipulatorHandles.add([d,p.events.on("immediate-click",_=>this._manipulatorClickCallback(_,c)),p.events.on("select-changed",()=>{c.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()}),p.events.on("focus-changed",({action:_})=>{_==="focus"&&c.type!=="edge"?this._updateTranslateVertexTooltip(p,S.XY):this._tooltip.clear()})],p),this.emit("manipulators-changed"),c}_trackNumDragging(t){switch(t.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return t}_onDragCancel(t=!0,e){switch(this._numDragging--,t&&(this.undo(),this.outputGeometry=this._editGeometryOperations!=null?this._editGeometryOperations.data.geometry:null),this.tool.snappingManager!=null&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case I.NONE:break;case I.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case I.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}e&&e(),this.destroyed||this._updateEventState(I.NONE)}_setTypeSpecificManipulatorSettings(t,e,n){const{graphic:a}=this,o=this._settings;switch(e.type){case"vertex":{t.state=nt.Vertex,t.selectable=!0,t.cursor="move",t.collisionPriority=2;const{size:s,collisionPadding:r}=o.manipulators.vertex;t.radius=s/2+r,t.elevationInfo=n;const{geometry:l}=a,p=l==null?void 0:l.type;t.interactive=p!=null&&p!=="point"&&p!=="mesh";break}case"edge":{t.state=nt.Edge,t.selectable=!1,t.cursor="copy",t.collisionPriority=-1;const{size:s,collisionPadding:r}=o.manipulators.edge;t.radius=s/2+r,t.elevationInfo=n.mode!=="on-the-ground"||Di(a.symbol)?{mode:"absolute-height",offset:0}:n;break}}}_watchAndUpdateGrabState(t,e){return t.events.on("grab-changed",n=>this._onGrabStateChanged(t,e,n.action,n.pointerType))}_onGrabStateChanged(t,e,n,a="mouse"){if(!this._recreatingManipulators){if(n==="start")e&&this._updateSelection(t),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(I.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,(a!=="touch"||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(o=>{const{manipulator:s}=o,{geometry:r}=this.graphic,l=r==null?void 0:r.type;s.interactive=s.grabbing||!this._numGrabbing&&l!=null&&l!=="point"&&l!=="mesh","edgeManipulator"in o&&(o.edgeManipulator.interactive=o.edgeManipulator.grabbing||!this._numGrabbing)}),this._graphicMoveManipulation.forEachManipulator(o=>{o.interactive=o.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const t of this._manipulatorInfos)t.manipulator.grabbing||(t.manipulator.selected=!1)}_updateSelection(t){t.grabbing&&!t.selected&&t.selectable&&(this._clearSelection(),t.selected=!0,this.emit("manipulators-changed"))}_removeManipulator(t){t!=null&&(t.manipulator.metadata.deleting=!0,this.manipulators.remove(t.manipulator),this._manipulatorHandles.remove(t.manipulator),On(this._manipulatorInfos,t),this.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(t){if(t){for(const e of this._manipulatorInfos)if(t===e.handle)return e}return null}_updateManipulatorPosition(t){if(t==null)return;const e=this._editGeometryOperations;if(t.type==="vertex")t.manipulator.location=e.data.coordinateHelper.vectorToDehydratedPoint(t.handle.pos,se),t.manipulator.grabbing&&this._vertexLaserLineVisualElement!=null&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=t.manipulator.renderLocation);else if(t.type==="edge"){const n=this._getManipulatorInfoFromHandle(t.handle.leftVertex),a=this._getManipulatorInfoFromHandle(t.handle.rightVertex);if(n==null||a==null)return;const o=n.manipulator,s=a.manipulator;if(t.manipulator.elevationInfo!=null&&t.manipulator.elevationInfo.mode==="on-the-ground"){const r=o.location,l=s.location,p=.5,c=r.x+p*(l.x-r.x),d=r.y+p*(l.y-r.y),g=r.hasZ&&l.hasZ?0:void 0;t.manipulator.location=Ne(c,d,g,e.data.spatialReference)}else Pt(Se,o.renderLocation,s.renderLocation,.5),t.manipulator.renderLocation=Se}}_splitEdgeManipulator(t,e=.5){const n=this._editGeometryOperations,a=n.splitEdge(t.handle,e).createdVertex;t.locationUpdateHandle=gt(t.locationUpdateHandle);const o=z(this.graphic);let s;this.enableEdgeOffset?(this._removeManipulator(t),s=this._createVertexOrEdgeManipulator(a)):(s=t,s.handle=a,s.type="vertex",this._setTypeSpecificManipulatorSettings(t.manipulator,t.handle,o)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=n.data.geometry,this._updateManipulatorPosition(s),this.enableEdgeOffset||this._updateTranslateVertexTooltip(s.manipulator,S.XY),this._updateSelection(t.manipulator);const r=this._updateEventState(I.RESHAPING),l=n.data.coordinateHelper.vectorToArray(s.handle.pos),p=n.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:l,componentIndex:p,vertexIndex:a.index}],added:l}),r&&this._updateEventState(I.NONE),s}_updateMoveManipulationPosition(){const t=rt(Se,0,0,0);let e=0,n=!1,a=null,o=null;for(const s of this._manipulatorInfos)s.type==="vertex"&&(s.manipulator.selected?(e++,At(t,t,s.manipulator.renderLocation),a==null||s.selectedIndex>a.selectedIndex?(o=a,a=s):(o==null||s.selectedIndex>o.selectedIndex)&&(o=s)):n=!0);if(e===0){const s=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=s,this._moveManipulation.xyAxisManipulation.available=s,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=s,this._moveManipulation.zManipulation.available=s&&this.enableZShape&&kt(this.graphic),this._moveManipulation.angle=bi(this.graphic.geometry),this._moveManipulation.radius=Ut.radiusForSymbol(this.graphic.symbol)}else{const s=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=s,this._moveManipulation.xyAxisManipulation.available=s,this._moveManipulation.zManipulation.available=s&&this.enableZVertex&&kt(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=s&&e!==1;let r=0;if(a!=null){const l=a.handle.pos,p=o!=null?o.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,c=o==null&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;p&&c?this._moveManipulation.xyAxisManipulation.available=!1:p?r=na(p,l):c&&(r=na(l,c))}this._moveManipulation.angle=r,this._moveManipulation.radius=La}e!==0&&n?(Vt(t,t,1/e),se.spatialReference=this._editGeometryOperations.data.spatialReference,se.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(t,se),this._moveManipulation.elevationAlignedLocation=se):this._outlineVisualElement==null||this._graphicState.isDraped||this._outlineVisualElement.attachmentOrigin==null?Oa(this.view,this._moveManipulation,this.graphic):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(t){var a;const e=new Array,n=this._editGeometryOperations;for(const o of t)if(o.type==="vertex"&&n.canRemoveVertex(o.handle.component)){e.push(o.handle),this._removeManipulator(o),this._removeManipulator(this._getManipulatorInfoFromHandle(o.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(o.handle.rightEdge));const s=n.removeVertices([o.handle]),r=(a=s.removedVertices)==null?void 0:a[0].createdEdge;r&&this._createVertexOrEdgeManipulator(r)}if(e.length>0){const o=e.map(r=>{const l=n.data.components.indexOf(r.component);return{coordinates:n.data.coordinateHelper.vectorToArray(r.pos),componentIndex:l,vertexIndex:r.index}});this.outputGeometry=n.data.geometry;const s=this._updateEventState(I.RESHAPING);if(this.destroyed||(this.emit("vertex-remove",{type:"vertex-remove",removed:o.map(r=>r.coordinates),vertices:o}),this.destroyed)||s&&(this._updateEventState(I.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(t,e,n=e.action==="start"?St.NEW_STEP:St.ACCUMULATE_STEPS){const a=this._editGeometryOperations;a.moveVertices(t.map(o=>o.handle),e.mapDeltaX,e.mapDeltaY,e.mapDeltaZ,n),this.outputGeometry=a.data.geometry;for(const o of t)this._updateManipulatorPosition(o)}_offsetEdge(t,e){if(e.operation==null||e.signedDistance==null)return;const n=this._editGeometryOperations,a=e.operation.clone();a.distance=e.signedDistance,n.updateVertices([t.handle.leftVertex,t.handle.rightVertex],a),this.outputGeometry=n.data.geometry,this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t.handle.rightVertex))}_manipulatorClickCallback(t,e){t.shiftKey||this._clearSelection(),e.type==="vertex"&&(e.manipulator.selected=!e.manipulator.selected,t.button===Ii.Right&&this._removeVertices([e])),e.type==="edge"&&t.button===Ii.Left&&this._splitEdgeManipulator(e),t.stopPropagation()}_updateTranslateTooltip(t,e){const n=this._manipulatorInfos.filter(a=>a.type==="vertex"&&a.manipulator.selected);n.length===1?this._updateTranslateVertexTooltip(n[0].manipulator,t,e):this._updateTranslateGraphicTooltip(t,e)}_updateTranslateGraphicTooltip(t,e){const{_tooltipOptions:n,_tooltip:a}=this;if(!n.enabled)return;const o=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case S.XY:a.info=this._translateGraphicTooltipInfo??(this._translateGraphicTooltipInfo=new _e({tooltipOptions:n})),this._updateTranslateTooltipDistance(a.info,e,(s,r)=>bt(s,r,o));break;case S.XY_AXIS:a.info=this._translateGraphicXYTooltipInfo??(this._translateGraphicXYTooltipInfo=new yi({tooltipOptions:n})),this._updateTranslateTooltipDistance(a.info,e,(s,r)=>{const l=bt(s,r,o);return Ie(l,ze(e))});break;case S.Z:a.info=this._translateGraphicZTooltipInfo??(this._translateGraphicZTooltipInfo=new je({tooltipOptions:n})),this._updateTranslateTooltipDistance(a.info,e,Le)}a.info.tooltipOptions=n}_updateTranslateVertexTooltip(t,e,n){const{_tooltipOptions:a,_tooltip:o}=this;if(!a.enabled)return;const s=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(e){case S.XY:o.info=this._translateVertexTooltipInfo??(this._translateVertexTooltipInfo=new bo({tooltipOptions:a})),this._updateTranslateTooltipDistance(o.info,n,(l,p)=>bt(l,p,s)),this._updateTooltipAreaOrTotalLength(o.info);break;case S.XY_AXIS:o.info=this._translateVertexXYTooltipInfo??(this._translateVertexXYTooltipInfo=new Mo({tooltipOptions:a})),this._updateTranslateTooltipDistance(o.info,n,(l,p)=>{const c=bt(l,p,s);return Ie(c,ze(n))}),this._updateTooltipAreaOrTotalLength(o.info);break;case S.Z:o.info=this._translateVertexZTooltipInfo??(this._translateVertexZTooltipInfo=new yo({tooltipOptions:a})),this._updateTranslateTooltipDistance(o.info,n,Le)}const r=So(t.elevationAlignedLocation);r!=null&&(o.info.elevation=to({actual:r})),o.info.tooltipOptions=a}_updateTranslateTooltipDistance(t,e,n){if(e!=null&&e.action!=="end"){const{mapStart:a,mapEnd:o}=e,s=n(a,o);t.distance=s??ct}else t.distance=ct}_updateTooltipAreaOrTotalLength(t){const{geometry:e}=this.graphic;if(e==null)return t.area=null,void(t.totalLength=null);const n=this._graphicState.isDraped?"on-the-ground":"absolute-height";t.area=e.type==="polygon"?wo(e,n):null,t.totalLength=e.type==="polyline"?Wn(e,n):null}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function na(i,t){return Math.atan2(t[1]-i[1],t[0]-i[0])+Math.PI/2}function Gs(i,t,e,n,a){if(i){const o=a.toXYZ(a.pointToVector(e)),s=En(n,o,x.get()),r=Kn(s,o,a.spatialReference);if(r!=null)return ce(r.value*Math.sign(t),r.unit)}return ce(t*Ee(e.spatialReference),"meters")}h([u()],C.prototype,"_editGeometryOperations",void 0),h([u()],C.prototype,"_segmentLabels",void 0),h([u({constructOnly:!0})],C.prototype,"tool",void 0),h([u()],C.prototype,"_tooltip",void 0),h([u()],C.prototype,"inputGeometry",null),h([u()],C.prototype,"outputGeometry",void 0),h([u({readOnly:!0})],C.prototype,"updating",null),h([u()],C.prototype,"manipulators",null),h([u()],C.prototype,"view",null),h([u()],C.prototype,"graphic",null),h([u()],C.prototype,"enableZShape",null),h([u()],C.prototype,"enableZVertex",null),h([u()],C.prototype,"enableMoveGraphic",null),h([u()],C.prototype,"enableMidpoints",null),h([u()],C.prototype,"enableEdgeOffset",null),h([u()],C.prototype,"_labelOptions",null),h([u()],C.prototype,"_tooltipOptions",null),h([u()],C.prototype,"_accentColor",null),C=h([k("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],C);const se=Ne(0,0,void 0,Tn.WGS84),Se=H(),ei=1e-6;var nt,I,Jt;(function(i){i.Vertex=yt.Custom1,i.Edge=yt.Custom2})(nt||(nt={})),function(i){i[i.NONE=0]="NONE",i[i.MOVING=1]="MOVING",i[i.RESHAPING=2]="RESHAPING"}(I||(I={})),function(i){i[i.ALL=0]="ALL",i[i.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(Jt||(Jt={}));let X=class extends $t.EventedMixin(Fe){constructor(i){super(i),this._internalGeometryUpdate=!1,this.enableZShape=!0,this.enableZVertex=!0,this.enableMoveGraphic=!0,this.enableMidpoints=!0,this.enableEdgeOffset=!1,this.type="reshape-3d",this.labelOptions=new ba,this.tooltipOptions=new Rt,this.snappingManager=null,this.automaticManipulatorSelection=!1}initialize(){const i=this._reshapeOperation=new C({tool:this});this.addHandles([i.on("reshape",t=>{t.type==="reshape"&&this._onReshapeGeometryChanged(),this.emit("reshape",t)}),i.on("move",t=>{t.type==="move"&&this._onReshapeGeometryChanged(),this.emit("move",t)}),i.on("vertex-add",t=>{this._onReshapeGeometryChanged(),this.emit("vertex-add",t)}),i.on("vertex-remove",t=>{this._onReshapeGeometryChanged(),this.emit("vertex-remove",t)}),i.on("immediate-click",t=>this.emit("immediate-click",t)),this.view.on("pointer-down",["Shift"],t=>t.stopPropagation()),y(()=>this.graphic,()=>this._updateGraphic(),Qt)]),this.finishToolCreation()}destroy(){this._reshapeOperation=R(this._reshapeOperation)}get updating(){var i;return((i=this._reshapeOperation)==null?void 0:i.updating)??!1}_updateGeometry(){const i=Gn(this.graphic);this._reshapeOperation.inputGeometry=i!=null?i.clone():null}_updateGraphic(){if(this.removeHandles("onGraphicGeometryChange"),this._updateGeometry(),Dn(this.graphic)!==fa.SUPPORTED)return;const i=y(()=>{var t;return(t=this.graphic)==null?void 0:t.geometry},()=>{this._internalGeometryUpdate===!1&&this._updateGeometry()},$e);this.addHandles(i,"onGraphicGeometryChange")}onManipulatorSelectionChanged(){this._reshapeOperation&&this._reshapeOperation.onManipulatorSelectionChanged()}_updateGeometryInternally(i){this._internalGeometryUpdate=!0;const{graphic:t}=this,{geometry:e}=t;(e==null?void 0:e.type)==="mesh"&&i.type==="point"?(t.geometry=e.centerAt(i),t.notifyGeometryChanged()):t.geometry=i,this._internalGeometryUpdate=!1}_onReshapeGeometryChanged(){const{outputGeometry:i}=this._reshapeOperation;this.graphic!=null&&i&&this._updateGeometryInternally(i.clone())}get canUndo(){return this._reshapeOperation.canUndo??!1}undo(){this.snappingManager!=null&&this.snappingManager.doneSnapping();const i=this._reshapeOperation.undo(),{outputGeometry:t}=this._reshapeOperation;i&&t&&this._updateGeometryInternally(t.clone())}get canRedo(){return this._reshapeOperation.canRedo??!1}redo(){this.snappingManager!=null&&this.snappingManager.doneSnapping();const i=this._reshapeOperation.redo(),{outputGeometry:t}=this._reshapeOperation;i&&t&&this._updateGeometryInternally(t.clone())}onInputEvent(i){i.type!=="key-down"||i.key!=="Delete"&&i.key!=="Backspace"||this._reshapeOperation.removeSelectedVertices()}reset(){}get test(){return{snappingManager:this.snappingManager,reshapeOperation:this._reshapeOperation}}};h([u()],X.prototype,"_reshapeOperation",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"view",void 0),h([u({constructOnly:!0})],X.prototype,"graphic",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"enableZShape",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"enableZVertex",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"enableMoveGraphic",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"enableMidpoints",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"enableEdgeOffset",void 0),h([u()],X.prototype,"type",void 0),h([u({constructOnly:!0,type:ba})],X.prototype,"labelOptions",void 0),h([u({constructOnly:!0,type:Rt})],X.prototype,"tooltipOptions",void 0),h([u({constructOnly:!0})],X.prototype,"snappingManager",void 0),h([u()],X.prototype,"updating",null),h([u()],X.prototype,"automaticManipulatorSelection",void 0),X=h([k("esri.views.3d.interactive.editingTools.graphicReshape3D.GraphicReshapeTool")],X);let _t=class extends Ye{constructor(t){super(t),this.type="transform-rotate",this.rotation=null,this.rotationPrecision=null,this.orientation=null,this.orientationPrecision=null,this.rotationType="geographic"}};h([u()],_t.prototype,"type",void 0),h([u()],_t.prototype,"rotation",void 0),h([u()],_t.prototype,"rotationPrecision",void 0),h([u()],_t.prototype,"orientation",void 0),h([u()],_t.prototype,"orientationPrecision",void 0),h([u()],_t.prototype,"rotationType",void 0),_t=h([k("esri.views.interactive.tooltip.TransformRotateTooltipInfo")],_t);let Ot=class extends Ye{constructor(i){super(i),this.type="transform-scale",this.size=null,this.sizeUnit=null,this.sizePrecision=null}};h([u()],Ot.prototype,"type",void 0),h([u()],Ot.prototype,"scale",void 0),h([u()],Ot.prototype,"size",void 0),h([u()],Ot.prototype,"sizeUnit",void 0),h([u()],Ot.prototype,"sizePrecision",void 0),Ot=h([k("esri.views.interactive.tooltip.TransformScaleTooltipInfo")],Ot);let ht=class extends Ye{constructor(t){super(t),this.type="transform-absolute",this.orientation=null,this.orientationPrecision=null,this.rotationType="geographic",this.size=null,this.sizePrecision=null,this.sizeUnit=null}};h([u()],ht.prototype,"type",void 0),h([u()],ht.prototype,"orientation",void 0),h([u()],ht.prototype,"orientationPrecision",void 0),h([u()],ht.prototype,"rotationType",void 0),h([u()],ht.prototype,"size",void 0),h([u()],ht.prototype,"sizePrecision",void 0),h([u()],ht.prototype,"sizeUnit",void 0),ht=h([k("esri.views.interactive.tooltip.TransformAbsoluteTooltipInfo")],ht);var T;(function(i){i.ScaleIn=yt.Custom2,i.ScaleOut=yt.Custom3,i.RotateLeft=yt.Custom4,i.RotateRight=yt.Custom5,i.Unlocked=yt.Custom7,i.DelayedFocused=yt.Custom8,i.TouchInput=yt.Custom12})(T||(T={}));let mt=class extends Yt{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(i){this._ringManipulator.location=i}set elevationAlignedLocation(i){this._ringManipulator.elevationAlignedLocation=i}get grabbing(){return this._ringManipulator.grabbing}set interactive(i){this._ringManipulator.interactive=i}get updating(){return!!this._activeAnimation}constructor(i){super(i),this.mode=null,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=_s,this._absoluteTooltipInfo=null,this._scaleTooltipInfo=null,this._rotateTooltipInfo=null,this.events=new $t,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>{var t;return((t=this._scaleRotateDragData)==null?void 0:t.mode)==="scale"?this.adapter.scale:1}}initialize(){this._tooltip=new ve({view:this.tool.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([Xt(()=>!this.tooltipOptions.enabled,()=>this._tooltip.clear(),$),y(()=>{const{adapter:i}=this,{info:t}=this._tooltip;return t===this._absoluteTooltipInfo&&this.getFocused()?[t,i.size,i.orientationClockwise]:[null]},([i])=>{i&&this._updateFocusTooltip()})])}destroy(){var i;(i=this._activeAnimation)==null||i.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this._tooltip=R(this._tooltip)}startAnimation(i){this.cancelActiveAnimation(),i.start();const t=In({update:({deltaTime:e})=>{i.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...i,frameTask:t}}cancelActiveAnimation(){var i;(i=this._activeAnimation)==null||i.frameTask.remove(),this._activeAnimation=R(this._activeAnimation)}forEachManipulator(i){i(this._ringManipulator,G.SCALE_ROTATE)}_createManipulator(){const i=this._createRingManipulator();this._ringManipulator=i,this.tool.manipulators.add(i);const t=this.tool.graphicState.graphic,e=lt(i,(n,a,o)=>{this._scaleRotateDragData=null;const s=this.adapter.startInteraction(),r={mode:"none",origin:le(n.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=r,this._updateDragState();const l=x.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(n.renderLocation,l),a.next(fi(this.tool.view,ya(n.renderLocation,l,_i()))).next(p=>{const c=me(p.plane),d=Ea(p.renderStart,p.renderEnd,r.origin,c),g=Rn.shortestSignedDiff(r.angle,d);r.angleDir=ni(r.angleDir+g,-Ki,Ki),r.angle=d;const _=Ds(r,p),m=_-this.adapter.scale;if(r.scaleDir=ni(r.scaleDir+m,-Wi,Wi),this._onScaleChanged(),r.mode==="none"){const v=this.mode||Is(p,p.plane,r.origin,this.tool.view.state.camera);if(v!=null){switch(v){case"rotate":this.tool.emit("graphic-rotate-start",{graphic:t,angle:0}),this.tool.emit("record-undo",{record:this.adapter.createUndoRecord()});break;case"scale":this.tool.emit("graphic-scale-start",{graphic:t,xScale:1,yScale:1}),this.tool.emit("record-undo",{record:this.adapter.createUndoRecord()})}r.mode=v}}switch(r.mode){case"rotate":s.state.angle=r.initialAngle+d;break;case"scale":s.state.scale=_,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),p.action){case"start":case"update":switch(r.mode){case"rotate":this.tool.emit("graphic-rotate",{graphic:t,angle:ue(r.angle)});break;case"scale":this.tool.emit("graphic-scale",{graphic:t,xScale:_,yScale:_})}break;case"end":switch(r.mode){case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:t,angle:ue(r.angle)});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:t,xScale:_,yScale:_})}}return p.action==="end"&&(this.startAnimation(oa(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState(),s.done()),p}).next(this._updateTooltipPipelineStep(r)),o.next(()=>{if(s.cancel(),this._scaleRotateDragData!=null){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:t,angle:0});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:t,xScale:1,yScale:1})}this.startAnimation(oa(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()})});this.addHandles([e,i.events.on("focus-changed",n=>{n.action==="focus"?this.startAnimation($s(this,()=>this._updateDelayedFocusedState(),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()}),i.events.on("immediate-click",n=>{n.stopPropagation()}),y(()=>{var n;return(n=this.tool.graphicState)==null?void 0:n.displaying},n=>this._ringManipulator.available=n,$)])}_updateTooltipPipelineStep(i){return t=>{const e=this.tooltipOptions;if(!e.enabled)return t;if(t.action==="end")return this._updateFocusTooltip(),t;const n=this._tooltip,a=this.tooltipOptions.visualVariables;switch(i.mode){case"scale":{n.info=this._scaleTooltipInfo??(this._scaleTooltipInfo=new Ot({tooltipOptions:e}));const{size:o,scale:s}=this.adapter,r=a==null?void 0:a.size,l=n.info;l.tooltipOptions=e,l.scale={value:s},l.size=o!=null?ce(o,"meters"):void 0,l.sizePrecision=we(r==null?void 0:r.valueType),l.sizeUnit=r==null?void 0:r.unit;break}case"rotate":{n.info=this._rotateTooltipInfo??(this._rotateTooltipInfo=new _t({tooltipOptions:e}));const{orientationClockwise:o,relativeAngleClockwise:s}=this.adapter,r=a==null?void 0:a.rotation,l=we(r==null?void 0:r.valueType),p=n.info;p.tooltipOptions=e,p.rotation=s!=null?Je(s,"radians","geographic"):void 0,p.rotationPrecision=l,p.rotationType=(r==null?void 0:r.rotationType)??"geographic",p.orientation=o!=null?Je(o,"radians","geographic"):void 0,p.orientationPrecision=l;break}}return t}}_updateFocusTooltip(){const{tooltipOptions:i,_tooltip:t}=this;if(i.enabled)if(this.getFocused()){const e=i.visualVariables,n=e==null?void 0:e.rotation,a=e==null?void 0:e.size,o=this.mode,{size:s,orientationClockwise:r}=this.adapter,l=r!=null&&(o==null||o==="rotate"),p=s!=null&&(o==null||o==="scale");t.info=this._absoluteTooltipInfo??(this._absoluteTooltipInfo=new ht({tooltipOptions:i}));const c=t.info;c.tooltipOptions=i,c.orientation=l?Je(r,"radians","geographic"):void 0,c.orientationPrecision=we(n==null?void 0:n.valueType),c.rotationType=(n==null?void 0:n.rotationType)??"geographic",c.size=p?ce(s,"meters"):void 0,c.sizeUnit=a==null?void 0:a.unit,c.sizePrecision=we(a==null?void 0:a.valueType)}else t.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(T.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){var i;if(this._ringManipulator.updateStateEnabled(T.Unlocked,!(this._scaleRotateDragData!=null&&((i=this._scaleRotateDragData)==null?void 0:i.mode)!=="none")),this._scaleRotateDragData!=null)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(T.ScaleIn|T.ScaleOut,!1),this._ringManipulator.updateStateEnabled(T.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(T.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(T.RotateLeft|T.RotateRight,!1),this._ringManipulator.updateStateEnabled(T.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(T.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(T.ScaleIn|T.ScaleOut|T.RotateLeft|T.RotateRight,!1)}_updateManipulatorTransform(){const i=_a(B.get(),this.adapter.angle,j(0,0,1));if(i==null)return;const t=this.getScale(),e=Ge(B.get(),rt(x.get(),t,t,t));this._ringManipulator.modelTransform=Oe(B.get(),e,i)}_createRingManipulator(){const i=(A,q,tt)=>{const xt=[],wt=Math.ceil(Ra*(q-A)/(2*Math.PI));for(let U=0;Ui(0,2*Math.PI,A),e=A=>[[-A/2,0],[A/2,0],[A/2,Qe/2],[-A/2,Qe/2]],n=this._createMaterial(1),a=(A,q,tt=n)=>Cn(tt,e(q),A,[],[],!1),o=t(zt),s=a(o,ti),r={left:new Array,right:new Array},l=[];for(let A=0;A<2;A++){const q=A*Math.PI-Math.PI/4,tt=Math.PI/2-ds,xt=q+tt,wt=q+Math.PI/2-tt,U=i(xt,wt,hs),ae=a(U,qt);l.push(U),l.push(i(xt,wt,Zi-ti/2)),r.left.push(ae),r.right.push(ae.instantiate());for(let Ke=0;Ke<2;Ke++){const wi=Ke===0,W=Xe();if(wi){va(W,W,[1,-1,1]),$i(W,W,-xt,[0,0,1]);const Ct=Math.round(Bi*(U.length-1));W[12]=U[Ct][0],W[13]=U[Ct][1],W[14]=U[Ct][2]}else{$i(W,W,wt,[0,0,1]);const Ct=Math.round((1-Bi)*(U.length-1));W[12]=U[Ct][0],W[13]=U[Ct][1],W[14]=U[Ct][2]}const Oi=Ae(n,cs,0,us,Qe);ga(Oi,W),(wi?r.left:r.right).push(Oi)}}const p=[];for(let A=0;A<2;A++){const q=A*Math.PI-Math.PI/4,tt=Math.PI/2-gs,xt=q+tt,wt=q+Math.PI/2-tt,U=i(xt,wt,Zi);p.push(a(U,qt))}const c=this._createMaterial(.66),d=this._createMaterial(.5),g=this._createMaterial(.33),_=t(zt+ji),m=t(zt+qi),v=a(_,qt,c),M=a(m,qt,g),b=t(zt-ji),f=t(zt-qi),E=a(b,qt,c),D=a(f,qt,g);let V=[new w(s,T.DelayedFocused),new w(s.instantiate({material:d}),O.None)];this.mode&&this.mode!=="scale"||(V=V.concat([...p.map(A=>new w(A,T.DelayedFocused|T.Unlocked)),new w(v,T.DelayedFocused|T.ScaleIn),new w(M,T.DelayedFocused|T.ScaleIn),new w(E,T.DelayedFocused|T.ScaleOut),new w(D,T.DelayedFocused|T.ScaleOut)])),this.mode&&this.mode!=="rotate"||(V=V.concat([...r.right.map(A=>new w(A.instantiate(),T.DelayedFocused|T.Unlocked)),...r.left.map(A=>new w(A,T.DelayedFocused|T.RotateLeft)),...r.right.map(A=>new w(A,T.DelayedFocused|T.RotateRight))]));const N=[o,...l];return new et({view:this.tool.view,renderObjects:V,autoScaleRenderObjects:!1,worldOriented:!0,radius:ti,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:z(this.tool.graphicState.graphic),collisionType:{type:"ribbon",paths:N,direction:j(0,0,1)}})}_createMaterial(i){const t=new ui({cullFace:di.Back,renderOccluded:Dt.Transparent,isDecoration:!0});return this.addHandles(y(()=>({color:$n(this.tool.view.effectiveTheme.accentColor,i)}),e=>t.setParameters(e),$)),t}get test(){return{ringManipulator:this._ringManipulator,setRingIndicatorDelayMs:i=>this._ringIndicatorDelayMs=i,tooltip:this._tooltip}}};function Ds(i,t){const e=L(x.get(),t.renderStart,i.origin),n=L(x.get(),t.renderEnd,i.origin),a=te(e),o=te(n);return a===0?0:o/a}function Is(i,t,e,n){const{renderStart:a,renderEnd:o}=i,s=xe(a,n,x.get()),r=xe(o,n,x.get());if(Ln(s,r)n;return{start:()=>{n=i.getScale(),e=i.getScale,i.getScale=a,t()},update:o=>(n+=((n+1)/2-n)*Math.min(o*ms,1),t(),Math.abs(n-1)<.01?ee.STOP:ee.CONTINUE),destroy:()=>{e&&(i.getScale=e),t()}}}function $s(i,t,e){let n=0,a=null;const o=()=>!1;return{start:()=>{a=i.getFocused,i.getFocused=o,n=0,t()},update:s=>(n+=s,!(a!=null&&a())||n>=e.delayMs?ee.STOP:ee.CONTINUE),destroy:()=>{a&&(i.getFocused=a),t()}}}function we(i){switch(i){case"integer":case"long":return 0;default:return null}}h([u({constructOnly:!0})],mt.prototype,"tool",void 0),h([u({constructOnly:!0})],mt.prototype,"adapter",void 0),h([u({constructOnly:!0})],mt.prototype,"tooltipOptions",void 0),h([u()],mt.prototype,"mode",void 0),h([u()],mt.prototype,"_activeAnimation",void 0),h([u()],mt.prototype,"updating",null),mt=h([k("esri.views.3d.interactive.editingTools.transformGraphic.GraphicScaleRotateTransform")],mt),function(i){i[i.CONTINUE=0]="CONTINUE",i[i.STOP=1]="STOP"}(ee||(ee={}));const ii=Ve();function Pa(i){return i.geometry!=null&&i.geometry.type==="mesh"?Rs(i.geometry):Cs(i)}function Rs(i){return i.vertexSpace.isRelative?Ls(i,i.transform,i.vertexSpace):Ps(i)}function Cs(i){let t=i.geometry,e=null;return{undo(n){e=n.geometry,n.geometry=t},redo(n){t=n.geometry,n.geometry=e}}}function Ls(i,t,e){let n=t==null?void 0:t.clone(),a=le(e.origin),o=null,s=null;return{undo:r=>{var l;o=(l=i.transform)==null?void 0:l.clone(),s=le(e.origin),i.transform=n,i.vertexSpace.origin=a,r.notifyMeshTransformChanged()},redo:r=>{var l;n=(l=i.transform)==null?void 0:l.clone(),a=le(e.origin),i.transform=o,i.vertexSpace.origin=s,r.notifyMeshTransformChanged()}}}function Ps(i){let t,e=i.vertexAttributes.clonePositional();return{undo:n=>{t=i.vertexAttributes.clonePositional(),i.vertexAttributes=e,n.notifyGeometryChanged()},redo:n=>{e=i.vertexAttributes.clonePositional(),i.vertexAttributes=t,n.notifyGeometryChanged()}}}let Q=class extends Yt{constructor(i){super(i),this._interactionState=null}initialize(){this.addHandles([Xt(()=>{const i=this._interactionState;return i&&i.angle!==i.previousAngle?{interactionState:i,angle:i.state.angle}:null},({interactionState:i})=>{this._updateMeshRotation(i)},$e),Xt(()=>{const i=this._interactionState;return i&&i.scale!==i.previousScale?{interactionState:i,scale:i.state.scale}:null},({interactionState:i})=>{this._updateMeshSize(i)},$e)])}get initialAngle(){var i;return((i=this._interactionState)==null?void 0:i.initialAngle)??0}get angle(){var e;const i=this.geometry.transform;if(i==null)return((e=this._interactionState)==null?void 0:e.angle)??0;const t=zn(i.rotation)[2];return Math.abs(t)>.999999?ke(Hn(i.rotation))*Math.sign(t):0}get angleClockwise(){return-this.angle}get relativeAngle(){return this.angle-this.initialAngle}get relativeAngleClockwise(){return-this.relativeAngle}get scale(){var i;return((i=this._interactionState)==null?void 0:i.scale)??1}startInteraction(){const i=new vt({angle:this.angle});this._interactionState=i;const t=()=>{this._interactionState=null};return{state:i,done:t,cancel:()=>{i.cancel(),t()}}}createUndoRecord(){return Pa(this.graphic)}_updateMeshRotation(i){const{angle:t,previousAngle:e}=i;i.previousAngle=t;const{geometry:n}=this,{vertexSpace:a}=n,o=ue(t-e);if(a.isGeoreferenced){const s=!a.isRelative&&this.viewingMode===oi.Global,r=this.geometry.anchor;this.geometry.rotate(0,0,o,{origin:r,geographic:s}),this.graphic.notifyGeometryChanged()}else{n.transform??(n.transform=new Li);const{transform:s}=n,r=Vn(0,0,o,zs);s.rotation=kn(s.rotation,r,s.rotation),this.graphic.notifyMeshTransformChanged()}}_updateMeshSize(i){const{scale:t,previousScale:e}=i;i.previousScale=t;const{geometry:n}=this,{vertexSpace:a}=n,o=t/e;if(a.isGeoreferenced){const s=!a.isRelative&&this.viewingMode===oi.Global,r=this.geometry.anchor;this.geometry.scale(o,{origin:r,geographic:s}),this.graphic.notifyGeometryChanged()}else{n.transform??(n.transform=new Li);const{transform:s}=n;s.scale=Vt(s.scale,s.scale,o),this.graphic.notifyMeshTransformChanged()}}};h([u({constructOnly:!0})],Q.prototype,"graphic",void 0),h([u({constructOnly:!0})],Q.prototype,"geometry",void 0),h([u({constructOnly:!0})],Q.prototype,"viewingMode",void 0),h([u()],Q.prototype,"initialAngle",null),h([u()],Q.prototype,"angle",null),h([u()],Q.prototype,"angleClockwise",null),h([u()],Q.prototype,"relativeAngle",null),h([u()],Q.prototype,"relativeAngleClockwise",null),h([u()],Q.prototype,"scale",null),h([u()],Q.prototype,"_interactionState",void 0),Q=h([k("esri.views.3d.interactive.editingTools.transformGraphic.ScaleRotateMeshAdapter")],Q);let vt=class extends Yt{get state(){const{angle:i,scale:t}=this;return{angle:i,scale:t}}constructor(i){super(i),this.angle=0,this.initialAngle=0,this.previousAngle=0,this.previousScale=1,this.scale=1,this.initialAngle=i.angle,this.previousAngle=i.angle}cancel(){this.angle=this.initialAngle,this.scale=1}};h([u()],vt.prototype,"angle",void 0),h([u()],vt.prototype,"initialAngle",void 0),h([u()],vt.prototype,"previousAngle",void 0),h([u()],vt.prototype,"previousScale",void 0),h([u()],vt.prototype,"scale",void 0),h([u()],vt.prototype,"state",null),vt=h([k("InteractionState")],vt);const zs=Pn();let P=class extends Yt{constructor(i){super(i),this.sizeAxis=null,this._interactionState=null}initialize(){this.addHandles(Xt(()=>this._interactionState!=null?this._interactionState.state:null,i=>{this._updateSymbol(i)},$e))}get initialAngle(){var i;return((i=this._interactionState)==null?void 0:i.initialAngle)??0}get angle(){return this._interactionState!=null?this._interactionState.angle:this._orientationReferenceSymbolLayer!=null?Hs(this._orientationReferenceSymbolLayer.heading??0):0}get angleClockwise(){return-this.angle}get orientation(){return this.angle}get orientationClockwise(){return this.angleClockwise}get relativeAngle(){return this.angle-this.initialAngle}get relativeAngleClockwise(){return-this.relativeAngle}get scale(){var i;return((i=this._interactionState)==null?void 0:i.scale)??1}get size(){const i=this._sizeReferenceSymbolLayer;if(i==null)return null;const t=this.findLayerView(),e=this._graphicSymbol;if(t==null||e==null||e.type!=="point-3d")return null;const n=t.getSymbolLayerSize(e,i);if("size"in n&&n.size!=null)return n.size;const a=this.sizeAxis;return!("width"in n)||n.width==null||a!=null&&a!=="width"&&a!=="all"&&a!=="width-and-depth"?!("depth"in n)||i.depth==null||a!=null&&a!=="depth"&&a!=="all"&&a!=="width-and-depth"?!("height"in n)||i.height==null||a!=null&&a!=="height"&&a!=="all"?null:n.height:n.depth:n.width}get _sizeReferenceSymbolLayer(){const i=this._graphicSymbol;return i==null||i.symbolLayers.length===0?null:i.symbolLayers.find(t=>t.type==="object")}get _orientationReferenceSymbolLayer(){const i=this._graphicSymbol;return i==null||i.symbolLayers.length===0?null:i.symbolLayers.find(t=>t.type==="object"&&t.heading!=null)}get _graphicSymbol(){var i;return((i=this.graphic)==null?void 0:i.symbol)!=null&&this.graphic.symbol.type==="point-3d"?this.graphic.symbol:null}set _graphicSymbol(i){this.graphic.symbol=i}startInteraction(){const i=this._graphicSymbol,t=this.findLayerView();if(this._interactionState!=null||i==null||t==null)return Vs;const e=i.symbolLayers.map(r=>r.type==="object"?t.getSymbolLayerSize(i,r):null).toArray(),n=i.clone(),a=this.angle,o=new ft({originalSymbol:n,angle:a,initialSizes:e});this._interactionState=o;const s=()=>{this._interactionState=null};return{state:o,done:s,cancel:()=>{this._graphicSymbol=n,s()}}}createUndoRecord(){let i=this.graphic.symbol,t=null;return{undo:e=>{t=e.symbol,e.symbol=i},redo:e=>{i=e.symbol,e.symbol=t}}}_updateSymbol({scale:i,angle:t,originalSymbol:e,initialSizes:n}){const a=this._graphicSymbol;if(a==null||a.type!=="point-3d")return;const o=a.clone(),s=-ue(t-this.initialAngle);let r=!1;this._forEachObjectSymbolLayerPair(e,o,(l,p,c)=>{const d=(l.heading??0)+s;p.heading!==d&&(p.heading=d,r=!0);const g=n[c];if(g!=null&&"width"in g){g.width=this.sizeFilter(g.width),g.height=this.sizeFilter(g.height),g.depth=this.sizeFilter(g.depth);const _=g.width*i;p.width!==_&&(p.width=_,r=!0);const m=g.depth*i;p.depth!==m&&(p.depth=m,r=!0);const v=g.height*i;p.height!==v&&(p.height=v,r=!0)}}),r&&(this._graphicSymbol=o)}_forEachObjectSymbolLayerPair(i,t,e){i.symbolLayers.forEach((n,a)=>{const o=t.symbolLayers.at(a);n.type==="object"&&o.type==="object"&&e(n,o,a)})}};function Hs(i){return-ke(i)}h([u()],P.prototype,"initialAngle",null),h([u()],P.prototype,"angle",null),h([u()],P.prototype,"angleClockwise",null),h([u()],P.prototype,"orientation",null),h([u()],P.prototype,"orientationClockwise",null),h([u()],P.prototype,"relativeAngle",null),h([u()],P.prototype,"relativeAngleClockwise",null),h([u()],P.prototype,"scale",null),h([u()],P.prototype,"size",null),h([u()],P.prototype,"sizeAxis",void 0),h([u({constructOnly:!0})],P.prototype,"graphic",void 0),h([u()],P.prototype,"_interactionState",void 0),h([u({constructOnly:!0})],P.prototype,"findLayerView",void 0),h([u({constructOnly:!0})],P.prototype,"sizeFilter",void 0),h([u()],P.prototype,"_sizeReferenceSymbolLayer",null),h([u()],P.prototype,"_orientationReferenceSymbolLayer",null),h([u()],P.prototype,"_graphicSymbol",null),P=h([k("esri.views.3d.interactive.editingTools.transformGraphic.ScaleRotateObjectSymbol3DAdapter")],P);const Vs={state:{angle:0,scale:0},done:()=>{},cancel:()=>{}};let ft=class extends Yt{get state(){const{originalSymbol:i,angle:t,initialAngle:e,scale:n,initialSizes:a}=this;return{originalSymbol:i,angle:t,initialAngle:e,scale:n,initialSizes:a}}constructor(i){super(i),this.angle=0,this.initialAngle=0,this.scale=1,this.initialAngle=i.angle}};h([u()],ft.prototype,"originalSymbol",void 0),h([u()],ft.prototype,"angle",void 0),h([u()],ft.prototype,"initialAngle",void 0),h([u()],ft.prototype,"initialSizes",void 0),h([u()],ft.prototype,"scale",void 0),h([u()],ft.prototype,"state",null),ft=h([k("InteractionState")],ft);let K=class extends $t.EventedMixin(Fe){constructor(i){super(i),this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.tooltipOptions=new Rt,this.type="transform-3d",this._updatingHandles=new gi,this._scaleRotate=null,this._tooltip=null,this._translateGraphicTooltipInfo=null,this._translateGraphicXYTooltipInfo=null,this._translateGraphicZTooltipInfo=null}initialize(){const{graphic:i,view:t}=this;this.graphicState=new Ft({graphic:i}),this.addHandles(y(()=>this.tooltipOptions.enabled,o=>{this._tooltip=o?new ve({view:t}):R(this._tooltip)},Qt)),this._moveManipulation=new Ut({tool:this,view:t,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&kt(i),radius:Ut.radiusForSymbol(i.symbol)}),this._moveManipulation.forEachManipulator(o=>this.addHandles(o.events.on("immediate-click",s=>{this.emit("immediate-click",{...s,graphic:i}),s.stopPropagation()})));const e=o=>s=>{this.addHandles(s.events.on("focus-changed",({action:r})=>{const l=this._tooltip;l!=null&&(r==="focus"?this._updateMoveTooltip(o):l.clear())}))};this._moveManipulation.xyManipulation.forEachManipulator(e(S.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(S.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(S.Z));const n=z(i);this._moveManipulation.elevationInfo=n,this.addHandles(Mi(this.graphicState));const{geometry:a}=i;if(this._moveManipulation.createGraphicDragPipeline((o,s,r,l,p)=>{if(a!=null&&o===S.XY){const{snappingStep:c,cancelSnapping:d}=Ce({snappingContext:new Re({elevationInfo:n,pointer:p,editGeometryOperations:Be.fromGeometry(new Un({spatialReference:a.spatialReference}),t.state.viewingMode),visualizer:new ge,excludeFeature:i}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});l=l.next(d),r=r.next(mo(this.view,n)).next(...c)}return{steps:r=r.next(c=>(this._updateMoveTooltip(o,c),c)),cancel:l}},this.graphicState,o=>{const{action:s,graphic:r,dxScreen:l,dyScreen:p}=o,c={graphic:r,dxScreen:l,dyScreen:p};switch(s){case"start":this.emit("graphic-translate-start",c),this.emit("record-undo",{record:this._createGeometryUndoRecord()});break;case"update":this.emit("graphic-translate",c);break;case"end":this.emit("graphic-translate-stop",c)}}),this._moveManipulation.angle=this._scaleRotate!=null?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(y(()=>this._scaleRotateAdapter.angle,()=>this._updateMoveAngle())),this.enableScaling||this.enableRotation){const o=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new mt({tool:this,mode:o,adapter:this._scaleRotateAdapter,tooltipOptions:this.tooltipOptions}),this.addHandles(this._scaleRotate.events.on("scale-changed",()=>this._onScaleChanged()))}this.addHandles([qe({view:this.view,graphic:this.graphic,forEachManipulator:o=>this._forEachManipulator(o),onManipulatorsChanged:()=>Z()}),this.graphicState.on("changed",()=>this._onGeometryChanged()),this._hideManipulatorsForGraphicState(),y(()=>t.scale,()=>this._updateMoveAngle())].filter(Xn)),this.addHandles(this.view.trackGraphicState(this.graphicState)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator(o=>{o instanceof et&&this.addHandles(o.events.on("grab-changed",()=>this._updateManipulatorsInteractive()))}),this.finishToolCreation()}destroy(){this._tooltip=R(this._tooltip),this._moveManipulation.destroy(),this._scaleRotate=R(this._scaleRotate),this._scaleRotateAdapter=R(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("graphic",null)}_updateManipulatorsInteractive(){this._scaleRotate!=null&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){var i,t,e;return this.graphic.geometry!=null&&this.graphic.geometry.type==="mesh"?new Q({graphic:this.graphic,geometry:this.graphic.geometry,viewingMode:this.view.state.viewingMode}):new P({graphic:this.graphic,sizeFilter:n=>this._enforceNonZeroSize(n),findLayerView:()=>this.view.allLayerViews.find(n=>n.layer===this.graphic.layer),sizeAxis:((e=(t=(i=this.tooltipOptions)==null?void 0:i.visualVariables)==null?void 0:t.size)==null?void 0:e.axis)??null})}_forEachManipulator(i){var t,e;(t=this._moveManipulation)==null||t.forEachManipulator(i),(e=this._scaleRotate)==null||e.forEachManipulator(i)}_hideManipulatorsForGraphicState(){return y(()=>this.graphicState.displaying,i=>{this._forEachManipulator(t=>t.available=i),this._moveManipulation.zManipulation.available=i&&this.enableZ&&kt(this.graphic)})}_createGeometryUndoRecord(){return Pa(this.graphic)}set snapToScene(i){this._moveManipulation&&(this._moveManipulation.snapToScene=i),this._set("snapToScene",i)}get updating(){var i;return this._updatingHandles.updating||!!((i=this._scaleRotate)!=null&&i.updating)}set location(i){this._moveManipulation.location=i,this._scaleRotate&&(this._scaleRotate.location=i)}set elevationAlignedLocation(i){this._moveManipulation.elevationAlignedLocation=i,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=i)}reset(){}onHide(){var i;(i=this._scaleRotate)==null||i.cancelActiveAnimation()}_onScaleChanged(){this._scaleRotate!=null&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){this.view.state.viewingMode===oi.Local||this.view.scalebt(o,s,a));break;case S.XY_AXIS:n.info=this._translateGraphicXYTooltipInfo??(this._translateGraphicXYTooltipInfo=new yi({tooltipOptions:e})),this._updateMoveTooltipDistance(n.info,t,(o,s)=>{const r=bt(o,s,a);return Ie(r,ze(t))});break;case S.Z:n.info=this._translateGraphicZTooltipInfo??(this._translateGraphicZTooltipInfo=new je({tooltipOptions:e})),this._updateMoveTooltipDistance(n.info,t,Le)}n.info.tooltipOptions=e}_updateMoveTooltipDistance(i,t,e){if(t!=null&&t.action!=="end"){const{mapStart:n,mapEnd:a}=t,o=e(n,a);i.distance=o??ct}else i.distance=ct}get test(){return{discManipulator:this._moveManipulation.xyManipulation.test.discManipulator,zManipulator:this._moveManipulation.zManipulation.test.manipulator,ringManipulator:this._scaleRotate!=null?this._scaleRotate.test.ringManipulator:null,arrowManipulators:this._moveManipulation.xyAxisManipulation.test.arrowManipulators,setRingIndicatorDelayMs:i=>this._scaleRotate!=null?this._scaleRotate.test.setRingIndicatorDelayMs(i):null,scaleRotateAdapter:this._scaleRotateAdapter,scaleRotateTransform:this._scaleRotate,tooltip:this._tooltip}}};h([u({constructOnly:!0,nonNullable:!0})],K.prototype,"view",void 0),h([u({constructOnly:!0,nonNullable:!0})],K.prototype,"graphic",void 0),h([u({constructOnly:!0,nonNullable:!0})],K.prototype,"enableZ",void 0),h([u()],K.prototype,"enableRotation",void 0),h([u()],K.prototype,"enableScaling",void 0),h([u({constructOnly:!0,type:Rt})],K.prototype,"tooltipOptions",void 0),h([u()],K.prototype,"graphicState",void 0),h([u({value:!1})],K.prototype,"snapToScene",null),h([u({constructOnly:!0})],K.prototype,"snappingManager",void 0),h([u({readOnly:!0})],K.prototype,"type",void 0),h([u({readOnly:!0})],K.prototype,"updating",null),K=h([k("esri.views.3d.interactive.editingTools.graphicTransform3D.GraphicTransformTool")],K);let ks=class{constructor(t,e,n,a){this._tool=t,this._graphicState=e,this._editGeometryOperations=n,this._bounds=a,this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null;const o=this._tool,s=o.view;this.moveXYGraphicManipulation=new xi({view:s,tool:o,graphicState:this._graphicState}),o.addHandles(this._createMoveXYGraphicDragPipeline()),this.moveZManipulator=new Oo(s,Eo.CENTER_ON_CALLOUT),this.moveZManipulator.state|=To,o.manipulators.add(this.moveZManipulator),o.addHandles([this._createMoveZDragPipeline()]),o.addHandles([o.on("graphic-translate-stop",()=>{this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null})])}destroy(){this.moveXYGraphicManipulation.destroy(),this._tool.manipulators.remove(this.moveZManipulator),this.moveZManipulator.destroy()}forEachManipulator(t){this.moveXYGraphicManipulation.forEachManipulator(t),t(this.moveZManipulator,G.TRANSLATE_Z)}updateManipulators(t,e){const n=this.moveZManipulator,a=Nn(B.get(),t,Math.PI);a[12]=0,a[13]=0,a[14]=0,n.modelTransform=a,n.renderLocation=L(x.get(),e.origin,e.basis1)}getUpdatedTooltipInfo(){return this.moveXYGraphicManipulation.grabbing||this.moveXYGraphicManipulation.dragging?this._computeMoveXYTooltipInfo():this.moveZManipulator.focused?this._computeMoveZTooltipInfo():null}_computeMoveXYTooltipInfo(){const t=this._tool.tooltipOptions;return this._moveXYTooltipInfo??(this._moveXYTooltipInfo=new _e({tooltipOptions:t}))}_computeMoveZTooltipInfo(){const t=this._tool,e=t.tooltipOptions,n=this._moveZTooltipInfo??(this._moveZTooltipInfo=new je({tooltipOptions:e}));if(this.moveZManipulator.dragging){const a=this._bounds,o=a.mapBoundsStart.origin,s=a.mapBounds.origin,r=xo(o,s,this._tool.view.spatialReference);if(r==null)return null;n.distance=r}else n.distance=ce(0,t.moveUnit);return n}_updateMoveTooltip(t,e){if(e===S.XY||e===S.XY_AXIS){const n=bt(t.mapStart,t.mapEnd,this._graphicState.isDraped?"on-the-ground":"absolute-height");n!=null&&this._moveXYTooltipInfo!=null&&(this._moveXYTooltipInfo.distance=n)}return t}_createMoveXYGraphicDragPipeline(){return this.moveXYGraphicManipulation.createDragPipeline((t,e,n)=>this._applyGraphicMoveSteps(e,n,S.XY))}_createMoveZDragPipeline(){const t=this._editGeometryOperations.data.spatialReference;return lt(this.moveZManipulator,(e,n,a)=>{const o=le(e.renderLocation),s=n.next(Ta(this._tool.view,o,t)).next(ie());this._applyGraphicMoveSteps(s,a,S.Z)})}_applyGraphicMoveSteps(t,e,n){const a=this._tool,o=a.graphic,s=t.next(r=>(r.action==="start"&&(a.inputState={type:"move"},this._bounds.backupMapBounds(),a.emit("graphic-translate-start",{graphic:o,dxScreen:r.screenDeltaX,dyScreen:r.screenDeltaY})),r)).next(Kt()).next(this._moveDragUpdateGeometry()).next(r=>{const l={graphic:o,dxScreen:r.screenDeltaX,dyScreen:r.screenDeltaY};switch(r.action){case"start":case"update":(r.mapEnd.x-r.mapStart.x||r.mapEnd.y-r.mapStart.y||(r.mapEnd.z??0)-(r.mapStart.z??0))&&a.emit("graphic-translate",l);break;case"end":a.inputState=null,a.emit("graphic-translate-stop",l)}return r}).next(r=>this._updateMoveTooltip(r,n));return e.next(()=>{a.inputState!=null&&a.emit("graphic-translate-stop",{graphic:o,dxScreen:0,dyScreen:0}),a.cancel()}),s}_moveDragUpdateGeometry(){const t=this._tool;return e=>{if(t.inputState==null||t.inputState.type!=="move")return e;const n=[];for(const s of this._editGeometryOperations.data.components)n.push(...s.vertices);const a=e.action==="start"?St.NEW_STEP:St.ACCUMULATE_STEPS,o=this._editGeometryOperations.moveVertices(n,e.mapDeltaX,e.mapDeltaY,e.mapDeltaZ,a);return Ze(o,this._bounds.mapBounds),t.graphic.geometry=this._editGeometryOperations.data.geometry,e}}};class Us{constructor(t,e,n){var r;this._tool=t,this._editGeometryOperations=e,this._bounds=n,this._rotateTooltipInfo=null,this._startAngle=0,this._endAngle=0;const a=this._tool,o=a.view,s=!((r=o._stage)!=null&&r.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result);this.rotateManipulator=new Ao(o,(l,p)=>Po(o.textures,{accentColor:l,contrastColor:p,preMultiplyAlpha:s})),a.addHandles([this.rotateManipulator.events.on("grab-changed",l=>this._onRotateGrab(l)),this._createRotateDragPipeline(this.rotateManipulator)]),a.manipulators.add(this.rotateManipulator),a.addHandles([a.on("graphic-rotate-start",l=>{this._startAngle=l.angle}),a.on("graphic-rotate",l=>{this._endAngle=l.angle}),a.on("graphic-rotate-stop",()=>{this._startAngle=0,this._endAngle=0})])}destroy(){this._tool.manipulators.remove(this.rotateManipulator),this.rotateManipulator.destroy()}forEachManipulator(t){t(this.rotateManipulator,G.ROTATE)}updateManipulators(t,e){const n=this._bounds.mapBounds.plane[2]<0?Math.PI:0,a=ma(B.get(),t,n);a[12]=0,a[13]=0,a[14]=0,this.rotateManipulator.modelTransform=a,this.rotateManipulator.renderLocation=At(x.get(),e.origin,e.basis1)}getUpdatedTooltipInfo(){return this.rotateManipulator.focused?this._computeRotateTooltipInfo():null}_computeRotateTooltipInfo(){const t=this._tool.tooltipOptions,e=this._rotateTooltipInfo??(this._rotateTooltipInfo=new zo({tooltipOptions:t}));return e.angle=this._startAngle-this._endAngle,e}_onRotateGrab({action:t,screenPoint:e}){const n=this._tool,a=this._bounds;if(t!=="start"||!e)return;const o=Go(a.displayBounds,n.view.renderCoordsHelper,Do.HEADING,_i()),s=Sa(n.view.state.camera,e);xa(o,s,x.get())&&(a.backupMapBounds(),n.inputState={type:"rotate",rotatePlane:o})}_createRotateDragPipeline(t){const e=this._tool,n=e.graphic;return lt(t,(a,o,s)=>{const r=e.inputState;r!=null&&(o.next(l=>(l.action==="start"&&e.emit("graphic-rotate-start",{graphic:n,angle:0}),l)).next(fi(e.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdateGeometry()).next(l=>{const p={graphic:n,angle:ue(l.rotateAngle)};switch(l.action){case"start":case"update":e.emit("graphic-rotate",p);break;case"end":e.inputState=null,e.emit("graphic-rotate-stop",p)}return l}),s.next(()=>{e.inputState!=null&&e.emit("graphic-rotate-stop",{graphic:n,angle:0}),e.cancel()}))})}_rotateDragRenderPlaneToRotate(t){return e=>{const n=me(t.rotatePlane),a=Ea(e.renderStart,e.renderEnd,this._bounds.displayBounds.origin,n);return{...e,rotateAxis:n,rotateAngle:a}}}_rotateDragUpdateGeometry(){const t=this._tool,e=this._bounds;return n=>{const a=si(H(),e.mapBoundsStart.origin),o=[];for(const l of this._editGeometryOperations.data.components)o.push(...l.vertices);const s=n.action==="start"?St.NEW_STEP:St.ACCUMULATE_STEPS,r=this._editGeometryOperations.rotateVertices(o,a,n.rotateAngle,s,Ga.REPLACE);return de(e.mapBoundsStart,e.mapBounds),Ze(r,e.mapBounds),t.graphic.geometry=this._editGeometryOperations.data.geometry,n}}}class Xs{constructor(t,e,n){this._tool=t,this._onDisplayBoundsChanged=e,this.mapBounds=pe(),this.mapBoundsStart=pe(),this.displayBounds=pe(),this._calculateMapBounds(n)}get displayBoundsMargin(){var a,o,s;const{view:t,graphic:e}=this._tool,n=((a=t.pointsOfInterest)==null?void 0:a.centerOnSurfaceFrequent.location)??((s=(o=e.geometry)==null?void 0:o.extent)==null?void 0:s.center);return n?Ns*t.pixelSizeAt(n):0}backupMapBounds(){de(this.mapBounds,this.mapBoundsStart)}updateDisplayBounds(){this._calculateDisplayBounds(),this._onDisplayBoundsChanged()}_calculateMapBounds(t){const{view:e,attachmentOrigin:n}=this._tool,a=t.geometry,o=jo(a);ha(o,o,-1);const s=e.spatialReference,r=a.spatialReference,l=n?e.pixelSizeAt(n)*Yn(s)/Ee(r):0;eo(o,t,Ys*l,this.mapBounds)}_calculateDisplayBounds(){const{view:t,attachmentOrigin:e,graphic:n}=this._tool;if(!n.geometry)return;const a=(e==null?void 0:e.z)??pi(this.mapBounds.origin,t.elevationProvider,hi.fromElevationInfo(z(n)),t.renderCoordsHelper),o=de(this.mapBounds);o.origin[2]=a??0,Zs(o,t.renderCoordsHelper,n.geometry.spatialReference,this.displayBoundsMargin,this.displayBounds)}}const Ns=10,Ys=80;function Zs(i,t,e,n=0,a){a||(a=pe()),t.toRenderCoords(i.origin,e,a.origin);const o=x.get();At(o,i.origin,i.basis1),At(o,o,i.basis2),t.toRenderCoords(o,e,o);const s=x.get();At(s,i.origin,i.basis1),L(s,s,i.basis2),t.toRenderCoords(s,e,s);const r=x.get();L(r,i.origin,i.basis1),L(r,r,i.basis2),t.toRenderCoords(r,e,r);const l=x.get();L(l,i.origin,i.basis1),At(l,l,i.basis2),t.toRenderCoords(l,e,l);const p=Pt(x.get(),o,s,.5);L(p,p,a.origin);const c=Pt(x.get(),r,l,.5);L(c,a.origin,c),Pt(a.basis1,p,c,.5);const d=Pt(x.get(),l,o,.5);L(d,d,a.origin);const g=Pt(x.get(),s,r,.5);L(g,a.origin,g),Pt(a.basis2,d,g,.5);const _=It(x.get(),a.basis1,a.basis2),m=It(_,_,a.basis1);return ai(m,m),Vt(a.basis2,m,De(a.basis2,m)),Vt(a.basis1,a.basis1,1+n/te(a.basis1)),Vt(a.basis2,a.basis2,1+n/te(a.basis2)),Zn(a),a}function sa(i,t,e,n){const a=x.get();L(a,L(a,i.origin,i.basis1),i.basis2);const o=x.get();Ht(o,a,i.basis1,2);const s=x.get();Ht(s,o,i.basis2,2);const r=x.get();Ht(r,a,i.basis2,2),a[2]=o[2]=s[2]=r[2]=t;const l=n?"on-the-ground":"absolute-height",p=Pi(Me(a,o,e,l),Me(r,s,e,l)),c=Pi(Me(o,s,e,l),Me(a,r,e,l));return c==null||p==null?null:[p,c]}class Fs{get zMax(){if(!this._zMaxDirty)return this._zMax;const t=this._editGeometryOperations.data;if(t.geometry.hasZ){const e=t.coordinateHelper;this._zMax=Number.NEGATIVE_INFINITY;for(const n of t.components)for(const a of n.vertices){const o=e.getZ(a.pos)??0;this._zMax=Math.max(o,this._zMax)}}else this._zMax=0;return this._zMaxDirty=!1,this._zMax}constructor(t,e,n,a,o){this._tool=t,this._graphicState=e,this._editGeometryOperations=n,this._bounds=a,this._preserveAspectRatioStep=o,this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._scaleTooltipInfo=null,this._displayBoundsStart=pe(),this._displayBoundsMarginStart=0,this._startScale=re(),this._endScale=re(),this._sizeStart=null,this._zMax=0,this._zMaxDirty=!0;const s=this._tool,r=s.view;this.resizeManipulators=this._resizeHandles.map(l=>{const p=new Io(r,l);return s.addHandles([p.events.on("grab-changed",c=>this._onResizeGrab(c)),this._createResizeDragPipeline(p,l)]),p}),s.manipulators.addMany(this.resizeManipulators),s.addHandles([s.on("graphic-scale-start",l=>{Et(this._startScale,l.xScale,l.yScale),Et(this._endScale,l.xScale,l.yScale)}),s.on("graphic-scale",l=>{Et(this._endScale,l.xScale,l.yScale)}),s.on("graphic-scale-stop",()=>{Et(this._startScale,0,0),Et(this._endScale,0,0)}),this._graphicState.on("changed",()=>{var l;((l=s.inputState)==null?void 0:l.type)!=="resize"&&(this._zMaxDirty=!0)})])}destroy(){this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()})}forEachManipulator(t){this.resizeManipulators.forEach(e=>t(e,G.SCALE))}updateManipulators(t,e){this.resizeManipulators.forEach((n,a)=>{$o(n,this._resizeHandles[a],t,e)})}getUpdatedTooltipInfo(){return this.resizeManipulators.some(t=>t.focused)?this._computeScaleTooltipInfo():null}_computeScaleTooltipInfo(){const t=this._tool,e=t.tooltipOptions,n=this._scaleTooltipInfo??(this._scaleTooltipInfo=new Ho({tooltipOptions:e})),a=t.graphic.geometry;if(a==null)return null;const o=sa(this._bounds.mapBounds,this.zMax,a.spatialReference,this._graphicState.isDraped);return o==null?null:(n.xSize=o[0],n.ySize=o[1],this._sizeStart!=null&&this.resizeManipulators.some(s=>s.dragging)?(n.xScale=o[0].value/this._sizeStart[0].value,n.yScale=o[1].value/this._sizeStart[1].value):(n.xScale=1,n.yScale=1),n)}_onResizeGrab({action:t,screenPoint:e}){const n=this._tool,a=this._bounds;if(t!=="start"||!e||!n.graphic.geometry)return;const o=Sa(n.view.state.camera,e);xa(a.displayBounds.plane,o,x.get())&&(a.backupMapBounds(),de(a.displayBounds,this._displayBoundsStart),this._displayBoundsMarginStart=a.displayBoundsMargin,this._sizeStart=sa(a.mapBoundsStart,this.zMax,n.graphic.geometry.spatialReference,this._graphicState.isDraped),n.inputState={type:"resize"})}_createResizeDragPipeline(t,e){const n=this._tool,a=n.graphic;return lt(t,(o,s,r)=>{n.inputState!=null&&(s.next(l=>(l.action==="start"&&n.emit("graphic-scale-start",{graphic:a,xScale:1,yScale:1}),l)).next(fi(n.view,this._displayBoundsStart.plane)).next(l=>({...l,handle:e})).next(this._resizeDragRenderPlaneToFactors()).next(...this._preserveAspectRatioStep()).next(this._resizeDragUpdateGeometry()).next(l=>{const p={graphic:a,xScale:l.factor1,yScale:l.factor2};switch(l.action){case"start":case"update":n.emit("graphic-scale",p);break;case"end":n.inputState=null,n.emit("graphic-scale-stop",p)}return l}),r.next(()=>{n.inputState!=null&&n.emit("graphic-scale-stop",{graphic:a,xScale:1,yScale:1}),n.cancel()}))})}_resizeDragRenderPlaneToFactors(){const t=this._bounds;return e=>{const n=this._displayBoundsStart,a=e.handle.direction,o=t.displayBoundsMargin,s=this._displayBoundsMarginStart,r=si(x.get(),n.origin);Ht(r,r,n.basis1,-a[0]),Ht(r,r,n.basis2,-a[1]);const l=L(x.get(),e.renderEnd,r),p=L(x.get(),e.renderStart,r),c=Da(e.handle),d=Ui(n),g=Ui(t.displayBounds)/d,_=(m,v)=>{if(m===0)return 1;let M=te(v),b=.5*m*De(v,l)/M;const f=b<0?-1:1;c&&(b+=(M-.5*m*De(v,p)/M)*f*g);const E=M<1.5*s?1:ra;return M=Math.max(M-s,ra),f>0&&(b-=o),f*Math.max(f*(b/M),E)};return{...e,factor1:_(a[0],n.basis1),factor2:_(a[1],n.basis2)}}}_resizeDragUpdateGeometry(){const t=this._tool,e=this._bounds;return n=>{const a=si(H(),e.mapBoundsStart.origin);Ht(a,a,e.mapBoundsStart.basis1,-n.handle.direction[0]),Ht(a,a,e.mapBoundsStart.basis2,-n.handle.direction[1]);const o=Et(re(),e.mapBoundsStart.basis1[0],e.mapBoundsStart.basis1[1]);pa(o,o);const s=[];for(const p of this._editGeometryOperations.data.components)s.push(...p.vertices);const r=n.action==="start"?St.NEW_STEP:St.ACCUMULATE_STEPS,l=this._editGeometryOperations.scaleVertices(s,a,o,n.factor1,n.factor2,r,Ga.REPLACE);return de(e.mapBoundsStart,e.mapBounds),Ze(l,e.mapBounds),t.graphic.geometry=this._editGeometryOperations.data.geometry,n}}}const ra=1e-6;class Bs{constructor(){this._lastDragEvent=null,this._next=null,this._enabled=!1}get enabled(){return this._enabled}set enabled(t){if(this._enabled!==t&&this._lastDragEvent!=null&&this._next!=null){const e={...this._lastDragEvent,action:"update"};t&&this._adjustScaleFactors(e),this._next.execute(e)}this._enabled=t}createDragEventPipelineStep(){this._lastDragEvent=null;const t=new Aa;return this._next=t,[e=>(this._lastDragEvent=e.action!=="end"?{...e}:null,this._enabled&&this._adjustScaleFactors(e),e),t]}_adjustScaleFactors(t){const e=Da(t.handle)?Math.max(Math.abs(t.factor1),Math.abs(t.factor2)):t.handle.direction[0]===0?Math.abs(t.factor2):Math.abs(t.factor1);t.factor1=t.factor1<0?-e:e,t.factor2=t.factor2<0?-e:e}get test(){return{_adjustScaleFactors:t=>this._adjustScaleFactors(t)}}}let J=class extends $t.EventedMixin(Fe){constructor(i){super(i),this.enableZ=!0,this.enableScaling=!0,this.enableRotation=!0,this.tooltipOptions=new Rt,this._preserveAspectRatio=new Bs,this.grabbing=!1,this.inputState=null,this._attachmentOrigin=null,this.type="transform-3d",this._outlineVisualElement=null}initialize(){const{view:i,graphic:t}=this,e=this._graphicState=new Ft({graphic:t}),n=t.geometry,a=this._editGeometryOperations=Be.fromGeometry(n,i.state.viewingMode),o=this._bounds=new Xs(this,()=>this._updateManipulators(),a.data);this._extentMove=new ks(this,e,a,o),this._extentScale=new Fs(this,e,a,o,()=>this._preserveAspectRatio.createDragEventPipelineStep()),this._extentRotate=new Us(this,a,o),this.addHandles([y(()=>this.enableZ,()=>this._updateManipulatorAvailability(this._extentMove.moveZManipulator,G.TRANSLATE_Z)),y(()=>this.enableScaling,()=>this._extentScale.forEachManipulator(p=>this._updateManipulatorAvailability(p,G.SCALE))),y(()=>this.enableRotation,()=>this._updateManipulatorAvailability(this._extentRotate.rotateManipulator,G.ROTATE))]),this._updateAllManipulatorAvailability();const s=qe({view:i,graphic:t,forEachManipulator:p=>this._forEachManipulator(p),onManipulatorsChanged:()=>Z()});if(s!=null){const{visualElement:p}=s;p instanceof Nt&&(this._outlineVisualElement=p,this.addHandles(p.events.on("attachment-origin-changed",()=>this._bounds.updateDisplayBounds()))),this.addHandles(s)}this.addHandles([e.on("changed",()=>this._onGeometryChanged()),y(()=>e.displaying,()=>this._updateAllManipulatorAvailability()),y(()=>e.isDraped,()=>this._graphicDrapedChanged(),$),y(()=>{var p;return(p=i.pointsOfInterest)==null?void 0:p.centerOnSurfaceFrequent.location},()=>o.updateDisplayBounds()),i.trackGraphicState(e)]);const r=p=>{this.addHandles(p.events.on("grab-changed",()=>{this.grabbing=p.grabbing,this._updateAllManipulatorAvailability()}))};this._forEachManipulator(r);const l=(p,c)=>{this.addHandles(p.events.on("immediate-click",d=>{c===G.TRANSLATE_XY&&this.emit("immediate-click",{...d,graphic:t}),d.stopPropagation()}))};this._forEachManipulator(l),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._extentMove.destroy(),this._extentScale.destroy(),this._extentRotate.destroy(),this._editGeometryOperations.destroy(),this._tooltip.destroy(),this._set("view",null),this._set("graphic",null)}_initializeTooltip(){const{view:i}=this,t=this._tooltip=new ve({view:i}),e=()=>{t.info=this._getUpdatedTooltipInfo()};this.addHandles([this.on("graphic-translate-start",e),this.on("graphic-translate",e),this.on("graphic-translate-stop",()=>{this._tooltip.clear()}),this.on("graphic-rotate-start",e),this.on("graphic-rotate",e),this.on("graphic-rotate-stop",e),this.on("graphic-scale-start",e),this.on("graphic-scale",e),this.on("graphic-scale-stop",e)]),this._forEachManipulator(n=>{this.addHandles([n.events.on("focus-changed",e),n.events.on("grab-changed",e),n.events.on("drag",a=>{a.action==="cancel"?this._tooltip.clear():e()})])})}_getUpdatedTooltipInfo(){return this.tooltipOptions.enabled?this._extentMove.getUpdatedTooltipInfo()??this._extentScale.getUpdatedTooltipInfo()??this._extentRotate.getUpdatedTooltipInfo():null}_onGeometryChanged(){this._bounds.updateDisplayBounds()}_graphicDrapedChanged(){this.removeHandles(la),this._bounds.updateDisplayBounds(),this._graphicState.isDraped&&this.addHandles(this.view.elevationProvider.on("elevation-change",i=>{this._attachmentOrigin!=null&&da(i.extent,this._attachmentOrigin.x,this._attachmentOrigin.y)&&this._bounds.updateDisplayBounds()}),la)}_updateManipulators(){if(!this.visible)return;const i=this._bounds.displayBounds,t=Ro(i,B.get());this._extentMove.updateManipulators(t,i),this._extentScale.updateManipulators(t,i),this._extentRotate.updateManipulators(t,i)}_updateAllManipulatorAvailability(){this._forEachManipulator((i,t)=>this._updateManipulatorAvailability(i,t))}_updateManipulatorAvailability(i,t){const e=this.grabbing&&!i.grabbing;if(i.interactive=!e,i instanceof et){const n=this._graphicState.displaying,a=this.enableZ&&kt(this.graphic);switch(t){case G.ROTATE:i.available=n&&this.enableRotation;break;case G.SCALE:i.available=n&&(this.enableScaling||this.enableRotation||a),i.interactive=!e&&this.enableScaling,i.state=this.enableScaling?Co:Lo;break;case G.TRANSLATE_Z:i.available=n&&a;break;default:i.available=n}}}_forEachManipulator(i){this._extentMove.forEachManipulator(i),this._extentScale.forEachManipulator(i),this._extentRotate.forEachManipulator(i)}get preserveAspectRatio(){return this._preserveAspectRatio.enabled}set preserveAspectRatio(i){this._preserveAspectRatio.enabled=i,this._set("preserveAspectRatio",i)}get moveUnit(){return Fn(this.view.spatialReference)??"meters"}get attachmentOrigin(){var e,n;const i=this.graphic.geometry,t=this._graphicState.isDraped?null:(e=this._outlineVisualElement)==null?void 0:e.attachmentOrigin;return this._attachmentOrigin=t??wa(this.view,this.graphic)??((n=i==null?void 0:i.extent)==null?void 0:n.center),this._attachmentOrigin}reset(){}cancel(){if(this.canUndo){const i=this._editGeometryOperations.undo();Hi(i,this._bounds.mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry}this.inputState=null}get canUndo(){return this._editGeometryOperations.canUndo}undo(){if(this.inputState!=null)this.view.activeTool=null;else if(this.canUndo){const i=this._editGeometryOperations.undo();Hi(i,this._bounds.mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry}}get canRedo(){return this._editGeometryOperations.canRedo}redo(){if(this.canRedo){const i=this._editGeometryOperations.redo();Ze(i,this._bounds.mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry}}get test(){return{moveZManipulator:this._extentMove.moveZManipulator,resizeManipulators:this._extentScale.resizeManipulators,rotateManipulator:this._extentRotate.rotateManipulator,tooltip:this._tooltip}}};h([u({constructOnly:!0,nonNullable:!0})],J.prototype,"view",void 0),h([u({constructOnly:!0,nonNullable:!0})],J.prototype,"graphic",void 0),h([u()],J.prototype,"enableZ",void 0),h([u()],J.prototype,"enableScaling",void 0),h([u()],J.prototype,"enableRotation",void 0),h([u({constructOnly:!0,type:Rt})],J.prototype,"tooltipOptions",void 0),h([u()],J.prototype,"preserveAspectRatio",null),h([u()],J.prototype,"moveUnit",null),h([u()],J.prototype,"grabbing",void 0),h([u()],J.prototype,"inputState",void 0),h([u({readOnly:!0})],J.prototype,"type",void 0),J=h([k("esri.views.3d.interactive.editingTools.transformGraphic.ExtentTransformTool")],J);const la="draped-elevation-changes";export{Bt as DrawGraphicTool3D,J as ExtentTransformTool,dt as GraphicMoveTool,X as GraphicReshapeTool,K as GraphicTransformTool}; diff --git a/dist/assets/editingTools-ht4PZFTE.js b/dist/assets/editingTools-ht4PZFTE.js new file mode 100644 index 0000000..9a2ef4c --- /dev/null +++ b/dist/assets/editingTools-ht4PZFTE.js @@ -0,0 +1 @@ +import{e as h,y as u,c as k,g as Yt,N as za,kI as Ha,ab as Va,B as y,fg as ka,a0 as Z,W as He,hR as Ua,kL as Xa,kM as Na,q5 as Ya,hn as Za,hC as Fa,l4 as Ba,ry as ja,hJ as Ot,hH as pa,hI as ha,p6 as qa,hK as Wa,a7 as re,c3 as Ve,hU as Ka,a8 as H,T as Qt,l6 as ca,dX as Oe,dw as Ja,bz as rt,bl as z,qh as Qa,hA as tn,nA as en,fq as F,w9 as Oi,b2 as Dt,bG as pi,v as Xt,bH as hi,P as $,l0 as Y,b as R,wa as an,p7 as nn,wb as ci,fr as Gt,py as ke,wc as ua,hx as Te,bO as At,ca as Vt,ea as on,bx as Ti,fI as sn,wd as rn,d5 as ln,we as da,kv as Ue,z as $t,wf as Ae,wg as ga,bP as Ai,bI as w,og as B,rz as E,wh as pn,oj as Ee,of as _a,b1 as j,oi as Ge,bM as ui,hY as di,bT as Xe,c1 as hn,wi as cn,bq as gt,wj as un,wk as dn,qf as gn,b4 as L,bL as ai,c9 as De,c6 as It,wl as _n,wm as mn,wn as ma,bQ as va,bE as ni,dE as vn,V as fn,A as Rt,h as gi,wo as yn,wp as fa,w as ct,bU as Ne,wq as Ie,nE as Mn,cH as me,c7 as ya,c5 as _i,sp as Ma,wr as bn,k5 as Gi,cG as Sn,ws as wn,wt as Di,qW as xn,c2 as te,hZ as ye,gH as En,hO as Pt,qm as Ii,wu as On,bu as ce,d2 as Tn,ql as yt,E as An,nz as ba,wv as Gn,ww as Dn,a9 as $e,oh as In,pH as Je,wx as $i,nF as $n,kq as le,wy as Rn,ch as ue,wz as Cn,d3 as Ln,wA as Ri,wB as Ci,qE as Pn,qH as zn,wC as Hn,F as oi,qF as Li,qK as Vn,qG as kn,L as Un,dY as Xn,wD as Nn,ob as Sa,c0 as wa,b3 as si,oa as de,o7 as pe,mr as Yn,pV as Zn,cD as Ht,wE as Pi,bw as Fn}from"./index-pCX-0tJH.js";import{q as Bn}from"./quantityFormatUtils-oYgdvR_2.js";import{x as jn}from"./TextOverlayItem-YHZxWGyg.js";import{l as qn,a as bt,u as ve,s as Ye,p as Wn,b as Kn,c as Me}from"./Tooltip-a9KqLK1p.js";import{O as ge}from"./SnappingVisualizer3D-PUGfSdbO.js";import{z as Zt,e as Ft,w as Nt}from"./GraphicState-JOHpeXmF.js";import{G as mi}from"./ExtendedLineVisualElement-VJvEdv3K.js";import{d as zi}from"./VerticesVisualElement-QZStMB48.js";import{K as Jn,X as Qn,g as to,V as Ze,l as eo,x as Hi}from"./editPlaneUtils-TRKNVTzb.js";import{k as io,o as ao,r as no}from"./drawSurfaces-t1mGEx1r.js";import{$ as et,e as x,w as Mt,k as xa,b as ne,v as Ea,F as Oa}from"./ShadedColorMaterial.glsl-L0JVQzbX.js";import{n as kt}from"./manipulatorUtils-165rCtzd.js";import{c as ri}from"./Laserlines.glsl-U7nZFq0e.js";import{x as oo}from"./PointVisualElement-m9C0-AJh.js";import{T as vi,P as Ta,M as so,U as ro,k as lo,D as po,H as fi}from"./dragEventPipeline3D-H_IlIVP7.js";import{x as ho,z as co,d as lt,D as he,y as uo,q as ie,U as Aa,P as Kt,l as Fe,j as go,w as _o,C as Vi,O as mo}from"./InteractiveToolBase-6mltmL27.js";import{S as vo}from"./GraphicManipulator-59Uc2I6c.js";import{V as Be,y as ki,N as fo,E as St,e as Ga}from"./EditGeometryOperations-vpHcsZOg.js";import{e as Re}from"./SnappingContext-ax0tf6c6.js";import{f as Ce}from"./SnappingDragPipelineStep-HDAWWRgo.js";import{r as _e,a as je,l as yi,n as yo,c as Mo,p as bo}from"./TranslateTooltipInfos-DywsDtXz.js";import{y as Le,R as So,d as wo}from"./euclideanLengthMeasurementUtils-Kj2RYqri.js";import{o as xo}from"./automaticAreaMeasurementUtils-kRuWnHc-.js";import{I as Eo,H as Oo,y as To,g as Ao,c as Go,C as Do,a as Io,h as $o,z as Da,B as Ui,d as Ro,N as Co,D as Lo}from"./SlicePlaneMaterial.glsl-xVEc2mct.js";import{l as Po}from"./Factory-EVPOwZPk.js";import{i as zo,p as Ho}from"./ExtentTooltipInfos-EukgtOIT.js";import"./vec4f32-NvfHy9q7.js";import"./EngineVisualElement-u0-BOxGn.js";import"./VisualElement--2Scr6Yq.js";import"./RightAngleQuadVisualElement-Jj11oqLR.js";import"./Object3DVisualElement-8HoU366x.js";import"./measurementUtils-69EiqRp6.js";import"./dehydratedFeatureComparison-IJSogXWn.js";import"./SnappingOperation-hED0OM8D.js";import"./drawUtils-0wb2c6-q.js";import"./drapedUtils-F1ywqHD-.js";import"./PointSnappingHint-bwlQAyn6.js";import"./euclideanAreaMeasurementUtils-jpli3_gk.js";import"./ImageMaterial.glsl-PU0wbmEN.js";import"./LineVisualElement-iKo1s90I.js";const Vo=3025,ko={default:15,far:25};let at=class extends Yt{constructor(i){super(i),this.context=null,this.stagedVertex=null,this.visible=!0,this.edgeDistance="default",this._messagesUnits=null,this._labelInfos=[],this._nextLabelIndex=0}initialize(){const i=za(async t=>{const e=await Ha("esri/core/t9n/Units");Va(t),this._messagesUnits=e});this.addHandles([y(()=>[this.context!=null&&this.getCameraOrExtent(this.context),this.visible,this._edgeDistancePixels,this.stagedVertex,this._messagesUnits],()=>this._update()),...["vertex-add","vertex-update","vertex-remove"].map(t=>ka(()=>{var e;return(e=this.context)==null?void 0:e.editGeometryOperations},t,()=>this._update())),Z(()=>i.abort()),y(()=>this._colors,t=>this._updateStyle(t))])}destroy(){for(this._nextLabelIndex=0;this._labelInfos.length;)this._destroyLabel(this._labelInfos.pop())}get updating(){return this._messagesUnits==null}get test(){return{labelContents:this._labelInfos.slice(0,this._nextLabelIndex).map(i=>i.label.text)}}get _edgeDistancePixels(){return ko[this.edgeDistance]}get _colors(){var t;const i=((t=this.context)==null?void 0:t.view.effectiveTheme.textColor)??He.fromArray([255,255,255]);return{textColor:i,backgroundColor:Ua(Xa(i,Na.Low),.6)}}_update(){if(this.destroyed)return;this._nextLabelIndex=0;const i=this.context;if(i==null)return void this._destroyUnusedLabels();const{components:t,geometry:e,coordinateHelper:n}=i.editGeometryOperations.data;if(!e)return void this._destroyUnusedLabels();const a=t.length;for(let o=0;o{s.push(n.toXYZ(g.pos))}),o===0&&this.stagedVertex!=null&&s.push(n.toXYZ(this.stagedVertex)),s.length<2)continue;const r=s[0],l=s[s.length-1];e.type==="polygon"&&s.length>2&&!Ya(r,l)&&s.push(r);const p=a===1&&!Za(s);let c=Uo,d=Xo;this.toScreenPointArray(i,r,c);for(let g=1;gMath.abs(it[1])?s.anchor=it[0]>0?"left":"right":s.anchor=-it[1]<0?"top":"bottom"}_getOrCreateLabel(i){var s;const t=this._labelInfos.length>this._nextLabelIndex,{textColor:e,backgroundColor:n}=this._colors;if(t){const r=this._labelInfos[this._nextLabelIndex++],{label:l}=r;return l.textColor=e,l.backgroundColor=n,r}const a=new jn({anchor:"center",fontSize:10,textColor:e,backgroundColor:n});(s=i.view.overlay)==null||s.items.add(a);const o={label:a};return this._labelInfos.push(o),this._nextLabelIndex=this._labelInfos.length,o}_destroyUnusedLabels(){for(;this._labelInfos.length>this._nextLabelIndex;)this._destroyLabel(this._labelInfos.pop())}_destroyLabel({label:i}){var t,e;(e=(t=this.context)==null?void 0:t.view.overlay)==null||e.items.remove(i),i.destroy()}};h([u()],at.prototype,"context",void 0),h([u()],at.prototype,"stagedVertex",void 0),h([u()],at.prototype,"visible",void 0),h([u()],at.prototype,"edgeDistance",void 0),h([u()],at.prototype,"updating",null),h([u()],at.prototype,"_messagesUnits",void 0),h([u()],at.prototype,"_edgeDistancePixels",null),h([u()],at.prototype,"_colors",null),at=h([k("esri.views.interactive")],at);const it=re(),oe=re(),Uo=Ve(),Xo=Ve();let Pe=class extends at{getCameraOrExtent({view:t}){return t.state.camera}toScreenPointArray({view:t,elevationInfo:e,editGeometryOperations:n},a,o=Ve()){const{spatialReference:s}=n.data.coordinateHelper;return Ka(a,s,e,t,Xi),t.state.camera.projectToScreen(Xi,o),o}};Pe=h([k("esri.views.3d.interactive.SegmentLabels3D")],Pe);const Xi=H();function Mi(i){const{graphic:t}=i;return[y(()=>i.displaying,e=>{e?No(t):Ni(t)},{...Qt}),Z(()=>Ni(t))]}function No(i){const{geometry:t}=i;Ia(t)&&i.notifyMeshTransformChanged({action:ca.EnableFastUpdates})}function Ni(i){const{geometry:t}=i;Ia(t)&&i.notifyMeshTransformChanged({action:ca.DisableFastUpdates})}function Ia(i){return(i==null?void 0:i.type)==="mesh"&&!i.vertexSpace.isGeoreferenced}function Yo(i,t){const e=i==null?void 0:i.geometry;if(!i||(e==null?void 0:e.type)!=="mesh"||!t)return;const{renderCoordsHelper:n,elevationProvider:a}=t,{camera:o}=t.state,{extent:s}=e,{center:r,spatialReference:l}=s,p=Oe(l),c=Ja(l),d=Oe(n.spatialReference),g=s.width*p,_=s.height*c,m=(s.zmax??0)*c,v=m-(s.zmin??0)*c,M=Math.max(g,_,v)/d,{x:b,y:f}=r,O=r.z??0;rt(be,b,f,O),n.toRenderCoords(be,l,be);const D=M/o.computeScreenPixelSizeAt(be);if(D>o.width*Fo)return"meshTooClose";if(Dthis.view.effectiveTheme}),this.geometryType=null,this.type="draw-3d"}initialize(){const{mode:i,offset:t}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new tn({mode:i,offset:t})}normalizeCtorArgs(i){if(!i.elevationInfo){const t=i.hasZ??!0;return{...i,elevationInfo:en(t)}}return i}initializeGraphic(i){const{view:t}=this,e=this._createGraphicState=new Ft({graphic:i});return F([t.maskOccludee(i),t.trackGraphicState(e),y(()=>({element:this._outlineVisualElement,isDraped:e.isDraped}),({element:n,isDraped:a})=>{n&&(n.isDraped=a)},Qt),this._setupLoadingIndicator(e),...Mi(e)])}updateDrawMeshTooltipInfo(i){const{graphic:t,tooltipOptions:e,view:n}=this;i.tooltipOptions=e,i.viewType=n.type,i.helpMessage=Yo(t,this.view),this.updateElevation(i.elevation)}makeDrawOperation(){const{geometryType:i}=this,t=i!=="circle"&&i!=="rectangle";return new io({view:this.view,manipulators:this.manipulators,geometryType:Qn(i),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new ao(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new no(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new ge,segmentLabels:t?new Pe:null,labelOptions:this.labelOptions,tooltipOptions:this.tooltipOptions,isDraped:this._createGraphicState?this._createGraphicState.isDraped:Oi(this.hasZ,this.elevationInfo)==="on-the-ground",cursor:this.cursor})}onActiveVertexChanged(i){const{view:t}=this;if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[i],this._updateVerticalLineVisualElement(i),Z();const e=this._settings,n=e.manipulators.vertex,a=new zi({view:t,spatialReference:t.spatialReference,vertices:[i],elevationInfo:this.internalGraphicsLayer.elevationInfo,size:n.size,outlineSize:n.outlineSize,renderOccluded:n.renderOccluded,attached:!1,isDecoration:!0});this._activeVertexVisualElement=a;const o=e.visualElements.zVerticalLine,s=new mi({view:t,extensionType:o.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:Dt.OccludeAndTransparent,isDecoration:!0});this._verticalLineVisualElement=s;const r=F([y(()=>e.visualElements.zVerticalLine,l=>l.apply(s),$),y(()=>({selectedColor:Y(e.colors.selected),outlineColor:Y(e.manipulators.vertex.outlineColor)}),({selectedColor:l,outlineColor:p})=>{a.color=l,a.outlineColor=p},$),Z(()=>{this._activeVertexVisualElement=R(this._activeVertexVisualElement),this._verticalLineVisualElement=R(this._verticalLineVisualElement)})]);return a.attached=!0,r}_updateVerticalLineVisualElement(i){const t=this._verticalLineVisualElement;if(!t)return;const{renderCoordsHelper:e,elevationProvider:n}=this.view;rt(jt,i[0],i[1],i[2]),Yi.setFromElevationInfo(this.elevationInfo),jt[2]=pi(jt,n,Yi,e),e.toRenderCoords(jt,this.view.spatialReference,jt)?(t.setStartEndFromWorldDownAtLocation(jt),t.attached=!0):t.attached=!1}onOutlineChanged(i){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=i,Z();const t=this.internalGraphicsLayer.elevationInfo,{view:e}=this,n=this._settings,a=new Nt({view:e,geometry:i,elevationInfo:t,isDraped:this._createGraphicState?this._createGraphicState.isDraped:Oi(this.hasZ,t)==="on-the-ground",attached:!1,isDecoration:!0});this._outlineVisualElement=a;const o=F([y(()=>n.visualElements.lineGraphics.outline,s=>s.apply(a),$),y(()=>n.visualElements.lineGraphics.shadowStyle,s=>s.apply(a),$),Z(()=>{this._outlineVisualElement=R(this._outlineVisualElement)})]);return a.attached=!0,a.laserlineEnabled=!0,o}onRegularVerticesChanged(i){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=i,Z();const{view:t}=this,e=this._settings,n=e.manipulators.vertex,a=new zi({view:t,spatialReference:t.spatialReference,vertices:i,elevationInfo:this.internalGraphicsLayer.elevationInfo,size:n.size,outlineSize:n.outlineSize,renderOccluded:n.renderOccluded,attached:!1,isDecoration:!0}),o=F([y(()=>({color:Y(e.manipulators.vertex.color),outlineColor:Y(e.manipulators.vertex.outlineColor)}),({color:s,outlineColor:r})=>{a.color=s,a.outlineColor=r},$),Z(()=>{this._verticesVisualElement=R(this._verticesVisualElement)})]);return a.attached=!0,this._verticesVisualElement=a,o}updateGraphicGeometry(i,t){if(this.geometryType==="mesh"&&(t==null?void 0:t.type)==="point"){const e=this.geometryToPlace;return e&&e.centerAt(t),void(e&&i.geometry===e?e.vertexSpace.isGeoreferenced?i.notifyGeometryChanged():i.notifyMeshTransformChanged():i.geometry=e)}super.updateGraphicGeometry(i,t)}_setupLoadingIndicator(i){const{drawOperation:t}=this;if(!this.geometryToPlace)return t.loading=!1,null;t.loading=!0;const e=Z(()=>{t.loading=!1});let n;const a=()=>n&&cancelAnimationFrame(n);return F([Xt(()=>i.displaying,()=>{a(),n=requestAnimationFrame(()=>e.remove())},{...Qt,once:!0}),Z(a),e])}};h([u({constructOnly:!0})],Bt.prototype,"elevationInfo",void 0),h([u({constructOnly:!0})],Bt.prototype,"geometryType",void 0),h([u()],Bt.prototype,"type",void 0),h([u({constructOnly:!0})],Bt.prototype,"view",void 0),Bt=h([k("esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D")],Bt);const Yi=new hi,jt=H();function jo(i){const t=bi(i);return nn(Math.cos(t),Math.sin(t))}function bi(i){if(i==null||i.type!=="polyline"&&i.type!=="polygon")return 0;const t=i.type==="polyline"?i.paths:i.rings;for(const e of t)for(let n=0;nan)return Math.atan2(o[1]-a[1],o[0]-a[0])}return 0}var st;(function(i){i[i.NONE=0]="NONE",i[i.ANY=1]="ANY",i[i.Z=2]="Z",i[i.XY=4]="XY"})(st||(st={}));var G;(function(i){i[i.TRANSLATE_Z=0]="TRANSLATE_Z",i[i.TRANSLATE_XY=1]="TRANSLATE_XY",i[i.SCALE=2]="SCALE",i[i.ROTATE=3]="ROTATE",i[i.SCALE_ROTATE=4]="SCALE_ROTATE"})(G||(G={}));let $a=class{constructor(){this.grabbingState=st.NONE,this.zManipulator=null,this.firstSelected=null,this.numSelected=0,this.firstGrabbedXY=null}update(t){this.grabbingState=st.NONE,this.zManipulator=null,this.numSelected=0,this.firstSelected=null,this.firstGrabbedXY=null,t.forEachManipulator((e,n)=>{if(n===G.TRANSLATE_Z&&(this.zManipulator=e),e instanceof et&&(e.selected&&(this.numSelected===0&&(this.firstSelected=e),this.numSelected++),this.firstGrabbedXY==null&&e.grabbing&&n===G.TRANSLATE_XY&&(this.firstGrabbedXY=e)),e.grabbing)switch(this.grabbingState|=st.ANY,n){case G.TRANSLATE_Z:this.grabbingState|=st.Z;break;case G.TRANSLATE_XY:this.grabbingState|=st.XY}})}};function qo(i){const{view:t,graphic:e}=i,n=new Ft({graphic:e}),a=Wo(i,n),o=[a,Ko(i,a.visualElement,n),t.maskOccludee(e),t.trackGraphicState(n)];return{visualElement:a.visualElement,remove:()=>ci(o)}}function Wo(i,t){const{view:e,graphic:n}=i,a=new Nt({view:e,geometry:li(n)?n.geometry:null,elevationInfo:z(n),attached:!1,isDecoration:!0}),o=new Zt({getTheme:()=>e.effectiveTheme}),s=()=>{a.attached=t.displaying},r=F([y(()=>o.visualElements.lineGraphics.outline,l=>l.apply(a),$),y(()=>o.visualElements.lineGraphics.shadowStyle,l=>l.apply(a),$),y(()=>t.displaying,s),y(()=>t.isDraped,l=>{a.isDraped=l}),t.on("changed",()=>a.geometry=li(n)?n.geometry:null),Gt(a)]);return s(),{visualElement:a,remove:()=>r.remove()}}function Ko(i,t,e){const{graphic:n,view:a}=i,o=[],s=z(n),r=s.mode==="on-the-ground"||!s.offset&&s.mode!=="absolute-height",l=new $a,p=new Zt({getTheme:()=>a.effectiveTheme}),c=p.visualElements,d=new mi({view:a,extensionType:c.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:Dt.OccludeAndTransparent,isDecoration:!0}),g=ke(c.heightPlaneAngleCutoff),_=new ri({view:a,attached:!1,angleCutoff:g,isDecoration:!0}),m=Te(1);o.push(y(()=>({lineShadowStyle:p.visualElements.lineGraphics.shadowStyle,pointShadowStyle:p.visualElements.pointGraphics.shadowStyle,alpha:m.value}),({lineShadowStyle:O,pointShadowStyle:D,alpha:V})=>{O.apply(t,V),D.apply(d,V)},$));const v=Te(1);o.push(y(()=>({heightPlane:p.visualElements.heightPlane,alpha:v.value}),({heightPlane:O,alpha:D})=>O.apply(_,D),$));const M=()=>{if(l.update(i),!e.displaying||r&&(e.isDraped||!li(n)||!n.geometry.hasZ))return t.laserlineEnabled=!1,d.attached=!1,void(_.attached=!1);t.laserlineEnabled=!0;const O=l.grabbingState&st.XY?c.laserlineAlphaMultiplier:1;m.value=O;const D=l.grabbingState&st.Z?c.laserlineAlphaMultiplier:1;v.value=D,Jo(d,l),Qo(i,t,_,l)};o.push(y(()=>p.visualElements.zVerticalLine,O=>O.apply(d),$)),o.push(e.on("changed",M),y(()=>e.displaying,M),t.events.on("attachment-origin-changed",M),Gt(d),Gt(_));const b=[],f=()=>{ci(b),b.length=0,i.forEachManipulator(O=>b.push(O.events.on("grab-changed",M))),i.forEachManipulator(O=>b.push(O.events.on("select-changed",M))),M()};return f(),o.push(i.onManipulatorsChanged(f),ua(()=>F(b))),F(o)}function Jo(i,t){const e=t.numSelected===1?t.firstSelected:t.numSelected>1&&t.firstGrabbedXY!=null?t.firstGrabbedXY:null;e!=null?(i.setStartEndFromWorldDownAtLocation(e.renderLocation),i.attached=!0):i.attached=!1}function Qo(i,t,e,n){if(n.numSelected>0){rt(Lt,0,0,0);let a=0;i.forEachManipulator((o,s)=>{s===G.TRANSLATE_XY&&o.selected&&o instanceof et&&(At(Lt,Lt,o.renderLocation),a++)}),a>0?(e.heightManifoldTarget=Vt(Lt,Lt,1/a),e.attached=!0):e.attached=!1}else{const a=t.attachmentOrigin;a!=null&&i.view.renderCoordsHelper.toRenderCoords(a,Lt)?(e.heightManifoldTarget=Lt,e.attached=!0):e.attached=!1}}function li(i){return i.geometry!=null&&(i.geometry.type==="polygon"||i.geometry.type==="polyline")}const Lt=H();function ts(i){const{view:t,graphic:e}=i,n=new Ft({graphic:e}),a=[],o=is(i,n,a);return es(i,n,a,o),a.push(t.trackGraphicState(n)),{visualElement:o,remove:()=>ci(a)}}function es(i,t,e,n){const{view:a,graphic:o}=i,s=new Zt({getTheme:()=>a.effectiveTheme}),r=new mi({view:a,extensionType:s.visualElements.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:Dt.OccludeAndTransparent,isDecoration:!0});e.push(y(()=>s.visualElements.zVerticalLine,f=>f.apply(r),$));const l=new ri({view:a,intersectsLineInfinite:!0,attached:!1,isDecoration:!0}),p=ke(s.visualElements.heightPlaneAngleCutoff),c=new ri({view:a,attached:!1,angleCutoff:p,isDecoration:!0}),d=z(i.graphic),g=hi.fromElevationInfo(d),_=d.mode==="on-the-ground"||!d.offset&&d.mode!=="absolute-height",m=new $a,v=Te(1);e.push(y(()=>({heightPlane:s.visualElements.heightPlane,alpha:v.value}),({heightPlane:f,alpha:O})=>f.apply(c,O),$));const M=Te(1);e.push(y(()=>({shadowStyle:s.visualElements.pointGraphics.shadowStyle,alpha:M.value}),({shadowStyle:f,alpha:O})=>f.apply(l,O),$));const b=()=>{m.update(i);const f=Si(o),O=_&&(t.isDraped||f==null||!f.hasZ);let D=!0;if(O||f==null)D=!1;else{const tt=pi(f,a.elevationProvider,g,a.renderCoordsHelper);rt(ot,f.x,f.y,tt),Ti(ot,f.spatialReference,ot,a.renderCoordsHelper.spatialReference),r.setStartEndFromWorldDownAtLocation(ot),l.intersectsWorldUpAtLocation=ot}const V=m.grabbingState&st.Z?s.visualElements.laserlineAlphaMultiplier:1;v.value=V;const N=sn(ss);!O&&t.displaying&&n.calculateMapBounds(N)&&Ti(rn(N,ot),a.spatialReference,ot,a.renderCoordsHelper.spatialReference)?(c.heightManifoldTarget=ot,c.attached=!0):c.attached=!1;const A=m.grabbingState&st.XY?s.visualElements.laserlineAlphaMultiplier:1;M.value=A;const q=D&&t.displaying&&!O;l.attached=q,r.attached=q};e.push(y(()=>[t.displaying,t.isDraped],b),t.on("changed",b)),i.forEachManipulator(f=>{e.push(f.events.on("grab-changed",b))}),e.push(Gt(l)),e.push(Gt(r)),e.push(Gt(c)),b()}function is(i,t,e){const{view:n,graphic:a}=i,o=new oo({view:n,geometry:Si(a),elevationInfo:z(a),isDecoration:!0});return as(i,o,t,e),e.push(Gt(o)),o}function Si(i){const t=i.geometry;return t==null?null:t.type==="point"?t:t.type==="mesh"?t.anchor.clone():null}function as(i,t,e,n){const a=()=>{t.attached=e.displaying},o=new Zt({getTheme:()=>i.view.effectiveTheme});ns(i,t,e,n),o.visualElements.pointGraphics.outline.apply(t),n.push(y(()=>e.displaying,a,$))}function ns(i,t,e,n){const{view:a,graphic:o}=i;let s=null;const r=p=>{s!=null&&(s.remove(),s=null),e.isDraped&&p!=null&&(s=os(a,p,()=>{t.geometry=p}))},l=()=>{const p=Si(o);r(p),t.geometry=p};n.push(e.on("changed",l),ua(()=>s)),l()}function os(i,t,e){const n=i.elevationProvider.spatialReference;ln(t,ot,n);const a=ot[0],o=ot[1];return i.elevationProvider.on("elevation-change",s=>{da(s.extent,a,o)&&e()})}const ot=H(),ss=on();function qe(i){switch(i.graphic.geometry.type){case"point":case"mesh":return ts(i);case"polygon":case"polyline":return qo(i);default:return null}}const Ra=128,ut=70,rs=80,Ca=.02,ls=54,ps=100,La=Math.ceil(ut/3*2),zt=160,Qe=.5,ti=24,qt=9,hs=zt+30,Zi=zt+53,cs=60,us=23,ds=5*Math.PI/12,gs=1*Math.PI/3,Fi=10,Bi=.2,ji=30,qi=53,Wi=.2,Ki=.3,_s=200,ms=3,vs=1e6;let fe=class{constructor(){this._available=!0}set location(t){this._forEachManipulator3D(e=>e.location=t)}set elevationAlignedLocation(t){this._forEachManipulator3D(e=>e.elevationAlignedLocation=t)}set elevationInfo(t){this._forEachManipulator3D(e=>e.elevationInfo=t)}get renderLocation(){let t;return this._forEachManipulator3D(e=>{t||(t=e.renderLocation)}),t}get available(){return this._available}set available(t){this._available=t,this._forEachManipulator3D(e=>e.available=t)}get hovering(){return this.someManipulator(t=>t.hovering)}get grabbing(){return this.someManipulator(t=>t.grabbing)}get dragging(){return this.someManipulator(t=>t.dragging)}hasManipulator(t){return this.someManipulator(e=>e===t)}someManipulator(t){let e=!1;return this.forEachManipulator(n=>{!e&&t(n)&&(e=!0)}),e}_forEachManipulator3D(t){this.forEachManipulator((e,n)=>{e instanceof et&&t(e,n)})}};function We(i,t,e,n){const a=(o,s)=>t({action:o,graphic:i,dxScreen:s.screenDeltaX,dyScreen:s.screenDeltaY});return e((o,s,r)=>(s.next(l=>(l.action==="start"&&a("start",l),l)).next(ho(i,n)).next(l=>{switch(l.action){case"start":case"update":(l.translationX||l.translationY||l.translationZ)&&a("update",l);break;case"end":a("end",l)}return l}),{steps:s,cancel:r=r.next(co(i)).next(l=>(a("end",{screenDeltaX:0,screenDeltaY:0}),l))}))}function ze(i){if((i==null?void 0:i.axis)==null)return 1;const{mapStart:t,mapEnd:e,axis:n}=i,a=[e.x-t.x,e.y-t.y];return a[0]*n[0]+a[1]*n[1]>0?1:-1}let fs=class extends fe{constructor(t){super(),this._handles=new Ue,this._arrowManipulatorInfos=new Array,this._angle=0,this._scale=1,this._radius=ut,this._updateAfterDrag=!1,this.events=new $t,this._tool=t.tool,this._view=t.view,this._opaqueMaterial=this._createMaterial(),this._transparentMaterial=this._createMaterial(.5),t.radius!=null&&(this._radius=t.radius),this._createManipulators(),this.forEachManipulator(e=>this._tool.manipulators.add(e))}set orthogonalAvailable(t){this._arrowManipulatorInfos.length>=3&&(this._arrowManipulatorInfos[1].manipulator.available=t,this._arrowManipulatorInfos[3].manipulator.available=t)}destroy(){this._handles=R(this._handles),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._arrowManipulatorInfos.length=0}forEachManipulator(t){for(const{manipulator:e}of this._arrowManipulatorInfos)t(e,G.TRANSLATE_XY)}createGraphicDragPipeline(t,e,n){const a=e.graphic,o=z(a),s=a.geometry.spatialReference;return We(a,n,r=>this.createDragPipeline((l,p,c,d,g)=>({steps:p,cancel:c}=t(l,p,c,d,g),r(l,p,c)),o,s,a),this._view.state.viewingMode)}createDragPipeline(t,e,n,a){return F(this._arrowManipulatorInfos.map(({manipulator:o},s)=>lt(o,(r,l,p,c,d)=>{const g=l.next(_=>({..._,manipulatorType:G.TRANSLATE_XY})).next(he(this._view,r.elevationAlignedLocation)).next(vi(this._view,r.elevationAlignedLocation,e,n,a)).next(uo(r.location,this.angle+(s+1)*Math.PI*.5)).next(ie());t(r,g,p,c,d)})))}get angle(){return this._angle}set angle(t){this._angle=t,this.dragging?this._updateAfterDrag=!0:this._updateManipulatorTransform()}get displayScale(){return this._scale}set displayScale(t){this._scale=t,this._updateManipulatorTransform()}get radius(){return this._radius}set radius(t){this._radius!==t&&(this._radius=t,this._updateManipulators())}_updateManipulators(){for(let t=0;t{this._updateAfterDrag&&a.action==="end"&&!this.dragging&&(this._updateManipulatorTransform(),this._updateAfterDrag=!1)})),n}_createMaterial(t=1){const e=new ui({cullFace:di.Back,renderOccluded:Dt.Transparent,isDecoration:!0});return this._handles.add(y(()=>He.toUnitRGBA(this._view.effectiveTheme.accentColor),n=>{n[3]*=t,e.setParameters({color:n})},$)),e}get test(){return{arrowManipulators:this._arrowManipulatorInfos.map(({manipulator:t})=>t)}}},ys=class{constructor(){this._view=null,this._elevationInfo=null,this._lastDragEvent=null,this._next=null,this._enabled=!1}get enabled(){return this._enabled}set enabled(t){if(this._enabled!==t&&this._lastDragEvent!=null&&this._next!=null){const e=this._lastDragEvent.mapEnd,n=this._snap(this._lastDragEvent.screenEnd);if(n!=null){const a={action:"update",mapStart:this._lastDragEvent.mapStart,mapEnd:t===!0?n:e,screenStart:this._lastDragEvent.screenEnd,screenEnd:this._lastDragEvent.screenEnd};this._next.execute(a)}}this._enabled=t}_snap(t){const e=this._view!=null?this._view.toMap(t,{exclude:[]}):null;return e!=null&&this._view!=null&&(e.z=hn(e,this._view,this._elevationInfo)),e}createDragEventPipelineStep(t,e){this._view=t,this._elevationInfo=e,this._lastDragEvent=null;const n=new Aa;return this._next=n,[a=>{if(this._lastDragEvent=a.action!=="end"?{...a}:null,this._enabled){const o=this._snap(a.screenEnd);return o!=null?{action:a.action,mapStart:a.mapStart,mapEnd:o,screenStart:a.screenStart,screenEnd:a.screenEnd}:null}return{action:a.action,mapStart:a.mapStart,mapEnd:a.mapEnd,screenStart:a.screenStart,screenEnd:a.screenEnd}},n]}};class Ms extends fe{constructor(t){super(),this._handles=new Ue,this._snapToScene=new ys,this._scale=1,this._radius=ut,this._view=t.view,this._tool=t.tool,this._discMaterial=this._createMaterial(),this._discMaterialTransparent=this._createMaterial(.5),t.snapToScene!=null&&(this.snapToScene=t.snapToScene),t.radius!=null&&(this._radius=t.radius),this._createManipulator(),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this._handles=R(this._handles),this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._manipulator=null}forEachManipulator(t){t(this._manipulator,G.TRANSLATE_XY)}get displayScale(){return this._scale}set displayScale(t){this._scale=t,this._updateManipulatorTransform()}get snapToScene(){return this._snapToScene.enabled}set snapToScene(t){this._snapToScene.enabled=t}get radius(){return this._radius}set radius(t){t!==this._radius&&(this._radius=t,this._updateManipulator())}createGraphicDragPipeline(t,e,n){const a=e.graphic,o=z(a),s=a.geometry.spatialReference;return We(a,n,r=>this.createDragPipeline((l,p,c,d,g)=>({steps:p,cancel:c}=t(l,p,c,d,g),r(l,p,c)),o,s,a),this._view.state.viewingMode)}createDragPipeline(t,e,n,a){const o=this._view;return lt(this._manipulator,(s,r,l,p,c)=>{const d=r.next(he(o,s.elevationAlignedLocation)).next(vi(o,s.elevationAlignedLocation,e,n,a)).next(...this._snapToScene.createDragEventPipelineStep(o,e)).next(g=>({...g,manipulatorType:G.TRANSLATE_XY})).next(ie());t(s,d,l,p,c)})}_updateManipulatorTransform(){const t=Ge(B.get(),rt(w.get(),this.displayScale,this.displayScale,this.displayScale));this._manipulator.modelTransform=t}_createManipulator(){const t=this._view;this._manipulator=new et({view:t,worldSized:!1,autoScaleRenderObjects:!1,focusMultiplier:1,touchMultiplier:1,collisionType:{type:"disc",direction:j(0,0,1)},worldOriented:!0}),this._updateManipulator()}_updateManipulator(){const t=cn(this._discMaterial,Ca,1,Ra,j(0,0,1),j(0,0,0));t.transformation=Ge(Xe(),j(this._radius,this._radius,this._radius)),this._manipulator.renderObjects=[new x(t,E.Focused),new x(t.instantiate({material:this._discMaterialTransparent}),E.Unfocused)],this._manipulator.radius=rs*(this._radius/ut)}_createMaterial(t=1){const e=new ui({cullFace:di.Back,renderOccluded:Dt.Transparent,isDecoration:!0});return this._handles.add(y(()=>He.toUnitRGBA(this._view.effectiveTheme.accentColor),n=>{n[3]*=t,e.setParameters({color:n})},$)),e}get test(){return{discManipulator:this._manipulator}}}class bs extends fe{constructor(t){super(),this._radius=ut,this.events=new $t,this._tool=t.tool,this._view=t.view;const e=new Zt({getTheme:()=>this._view.effectiveTheme});this._settings=e,t.radius!=null&&(this._radius=t.radius);const n=this._view.effectiveTheme.accentColor;this._materials={materialUnfocused:Mt(this._createDarkenedColor(n,1,.25),Dt.Occlude),materialFocused:Mt(this._createDarkenedColor(n,1,0),Dt.Occlude),materialOccludedUnfocused:Mt(this._createDarkenedColor(n,.7,0),e.zManipulator.renderOccluded),materialOccludedFocused:Mt(this._createDarkenedColor(n,.85,0),e.zManipulator.renderOccluded)},this._themeHandle=y(()=>this._view.effectiveTheme.accentColor,a=>{const o=this._createDarkenedColor(a,1,.25),s=this._createDarkenedColor(a,1,0),r=this._createDarkenedColor(a,.7,0),l=this._createDarkenedColor(a,.85,0),{materialUnfocused:p,materialFocused:c,materialOccludedUnfocused:d,materialOccludedFocused:g}=this._materials;p.setParameters({color:o}),c.setParameters({color:s}),d.setParameters({color:r}),g.setParameters({color:l})}),this._createManipulator(),this.forEachManipulator(a=>this._tool.manipulators.add(a))}destroy(){this._themeHandle=gt(this._themeHandle),this._manipulator.applyObjectTransform=ws,this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()})}forEachManipulator(t){t(this._manipulator,G.TRANSLATE_Z)}createGraphicDragPipeline(t,e,n){const a=e.graphic.geometry.spatialReference;return We(e.graphic,n,o=>this.createDragPipeline((s,r,l,p,c)=>({steps:r,cancel:l}=t(s,r,l,p,c),o(s,r,l)),a),this._view.state.viewingMode)}createDragPipeline(t,e){const n=this._view;return lt(this._manipulator,(a,o,s,r,l)=>{const p=o.next(c=>({...c,manipulatorType:G.TRANSLATE_Z})).next(Ta(n,a.renderLocation,e)).next(ie());t(a,p,s,r,l)})}get radius(){return this._radius}set radius(t){t!==this._radius&&(this._radius=t,this._updateManipulator())}_updateManipulator(){const t=this._settings,e=this._radius/ut,n=t.zManipulator.height*e,a=t.zManipulator.coneHeight*e,o=t.zManipulator.coneWidth*e,s=t.zManipulator.width*e,r=[j(0,0,0),j(0,0,n)],l=[j(0,0,0),j(0,0,n+a)],p=b=>{const f=Xe();if(mn(f,f,[0,0,n]),ma(f,f,Math.PI/2),b){const O=1+2*b/o;va(f,f,[O,O,O])}return f},c=p(0),{materialUnfocused:d,materialFocused:g,materialOccludedUnfocused:_,materialOccludedFocused:m}=this._materials,v=un(d,r,s/2,16,!1),M=dn(d,a,o/2,16,!1);M.transformation=c,this._manipulator.renderObjects=[new x(M,E.Unfocused),new x(v,E.Unfocused),new x(M.instantiate({material:g}),E.Focused),new x(v.instantiate({material:g}),E.Focused),new x(M.instantiate({material:_}),E.Unfocused),new x(v.instantiate({material:_}),E.Unfocused),new x(M.instantiate({material:m}),E.Focused),new x(v.instantiate({material:m}),E.Focused)],this._manipulator.radius=s/2+2,this._manipulator.collisionType={type:"line",paths:[l]}}_createManipulator(){const t=this._view,e=new et({view:t,autoScaleRenderObjects:!1,worldSized:!1,selectable:!1,cursor:"ns-resize",elevationInfo:this.elevationInfo,worldOriented:!0,collisionPriority:1.6});e.applyObjectTransform=n=>{const a=t.state.camera,o=Ji;t.renderCoordsHelper.toRenderCoords(this._manipulator.elevationAlignedLocation,o);const s=gn(a.eye,o),r=a.computeRenderPixelSizeAtDist(s),l=L(Wt,o,a.eye);ai(l,l);const p=Ss;t.renderCoordsHelper.worldUpAtPosition(Ji,p);const c=Math.abs(De(l,p)),d=It(Wt,l,p),g=It(Wt,d,p),_=ni(c,.01,1),m=1-Math.sqrt(1-_*_)/_/a.fullWidth,v=this._settings,M=this._radius/ut,b=v.zManipulator.width*M;Vt(g,ai(g,g),(1/m-1)*s+r*b),n[12]-=Wt[0],n[13]-=Wt[1],n[14]-=Wt[2]},this._manipulator=e,this._updateManipulator()}_createDarkenedColor(t,e,n){const a=_n(t,n);return a.a*=e,He.toUnitRGBA(a)}get test(){return{manipulator:this._manipulator}}}const Ji=H(),Wt=H(),Ss=H(),ws=()=>{};let Ut=class extends fe{constructor(t){super(),this._handles=new Ue,this._interactive=!0;const{tool:e,view:n,snapToScene:a,radius:o}=t;this._view=n,this.xyManipulation=new Ms({tool:e,view:n,snapToScene:a,radius:o}),this.xyAxisManipulation=new fs({tool:e,view:n,radius:o}),this.zManipulation=new bs({tool:e,view:n,radius:o}),this.xyManipulation.available=t.xyAvailable,this.xyAxisManipulation.available=t.xyAxisAvailable,this.zManipulation.available=t.zAvailable,this._autoHideXYAxis(),this.forEachManipulator(s=>this._handles.add(s.events.on("grab-changed",()=>this._updateManipulatorInteractivity())))}destroy(){this._handles.destroy(),this.xyManipulation.destroy(),this.xyAxisManipulation.destroy(),this.zManipulation.destroy()}createGraphicDragPipeline(t,e,n){return F([this.xyManipulation.createGraphicDragPipeline((a,o,s,r,l)=>t(S.XY,a,o,s,r,l),e,n),this.xyAxisManipulation.createGraphicDragPipeline((a,o,s,r,l)=>t(S.XY_AXIS,a,o,s,r,l),e,n),this.zManipulation.createGraphicDragPipeline((a,o,s,r,l)=>t(S.Z,a,o,s,r,l),e,n)])}createDragPipeline(t,e,n,a){return F([this.xyManipulation.createDragPipeline((o,s,r,l,p)=>t(S.XY,o,s,r,l,p),e,n,a),this.xyAxisManipulation.createDragPipeline((o,s,r,l,p)=>t(S.XY_AXIS,o,s,r,l,p),e,n,a),this.zManipulation.createDragPipeline((o,s,r,l,p)=>t(S.Z,o,s,r,l,p),n)])}set snapToScene(t){this.xyManipulation.snapToScene=t}set angle(t){this.xyAxisManipulation.angle=t}set interactive(t){this._interactive!==t&&(this._interactive=t,this._updateManipulatorInteractivity())}set radius(t){this.xyAxisManipulation.radius=t,this.xyManipulation.radius=t,this.zManipulation.radius=t}set displayScale(t){this.xyManipulation.displayScale=t,this.xyAxisManipulation.displayScale=t}forEachManipulator(t){this.xyManipulation.forEachManipulator(e=>t(e,G.TRANSLATE_XY)),this.xyAxisManipulation.forEachManipulator(e=>t(e,G.TRANSLATE_XY)),this.zManipulation.forEachManipulator(e=>t(e,G.TRANSLATE_Z))}get _xyAxisVisible(){const t=this.xyManipulation.someManipulator(e=>e.focused)||this.xyAxisManipulation.someManipulator(e=>e.focused);return this._view.inputManager&&this._view.inputManager.latestPointerType==="touch"||t}_autoHideXYAxis(){const t=this.xyAxisManipulation,e=this.xyManipulation;if(vn("esri-mobile"))return;const n=[];e.forEachManipulator(o=>n.push(o)),t.forEachManipulator(o=>n.push(o));const a=()=>{const o=[];this._xyAxisVisible||t.forEachManipulator(s=>o.push(s.disableDisplay())),this._handles.remove(Qi),this._handles.add(o,Qi)};for(const o of n)this._handles.add(o.events.on("focus-changed",a));this._view.inputManager&&this._handles.add(Xt(()=>{var o;return(o=this._view.inputManager)==null?void 0:o.latestPointerType},a)),a()}_updateManipulatorInteractivity(){const t=this.grabbing;this.forEachManipulator(e=>{e.interactive=!t&&this._interactive||e.grabbing})}static radiusForSymbol(t){const e=t!=null&&t.type==="point-3d"&&t.symbolLayers;return e&&e.some(n=>n.type==="icon")?La:ut}};const Qi="disable-xy-axis-display";var S;(function(i){i[i.XY=0]="XY",i[i.XY_AXIS=1]="XY_AXIS",i[i.Z=2]="Z"})(S||(S={}));class wi extends fe{constructor(t){super(),this._view=t.view,this._tool=t.tool,this._graphicState=t.graphicState,this._createManipulator(),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()}),this._tool=null,this._view=null,this._manipulator=null,this._graphicState=null}forEachManipulator(t){t(this._manipulator,G.TRANSLATE_XY)}createGraphicDragPipeline(t){return We(this._graphicState.graphic,t,e=>this.createDragPipeline(e),this._view.state.viewingMode)}createDragPipeline(t){const e=this._view,n=this._graphicState.graphic,a=n.geometry!=null?n.geometry.spatialReference:null;return lt(this._manipulator,(o,s,r,l,p)=>{const c=s.next(so(p,e,n,a)).next(Kt()).next(ie());t(o,c,r,l,p)})}_createManipulator(){const t=this._view,e=this._graphicState.graphic;this._manipulator=new vo({graphic:e,view:t,selectable:!0,cursor:"move"})}}let xs=class{constructor(t){this.allGraphics=t,this.type="graphic-move-start"}};class Es{constructor(t,e,n){this.dx=t,this.dy=e,this.allGraphics=n,this.type="graphic-move"}}class ta{constructor(t){this.allGraphics=t,this.type="graphic-move-stop"}}const pt="manipulators";let dt=class extends $t.EventedMixin(Fe){constructor(i){super(i),this._infos=new Map,this.graphics=new fn,this.enableZ=!0,this.tooltipOptions=new Rt,this.type="move-3d",this._updatingHandles=new gi,this._moveManipulation=null,this._tooltip=null,this._translateGraphicTooltipInfo=null,this._translateGraphicXYTooltipInfo=null,this._translateGraphicZTooltipInfo=null}initialize(){const{view:i}=this;this.addHandles([this.graphics.on("change",e=>{e.removed.forEach(n=>this.removeHandles(n)),this._updateGraphicInfos(e),this._setupFastTransformUpdates(e.added),this._refreshManipulators()}),y(()=>this.tooltipOptions.enabled,e=>{this._tooltip=e?new ve({view:i}):R(this._tooltip)},Qt)]);const t=this.graphics.toArray();this._updateGraphicInfos({added:t,removed:[]}),this._setupFastTransformUpdates(t),this._refreshManipulators(),this.finishToolCreation()}destroy(){this._tooltip=R(this._tooltip),this._moveManipulation=R(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}get updating(){return this._updatingHandles.updating}reset(){}_updateGraphicInfos({added:i,removed:t}){var e;for(const n of i){if(yn(n)!==fa.SUPPORTED)continue;const a=new Os(n),o=this.view.trackGraphicState(a.state);this._infos.set(a.graphic,{info:a,handle:o})}for(const n of t)(e=this._infos.get(n))==null||e.handle.remove(),this._infos.delete(n)}_setupFastTransformUpdates(i){for(const t of i){const{info:e}=this._infos.get(t);this.addHandles(Mi(e.state),t)}}_refreshManipulators(){if(this.removeHandles(pt),this._moveManipulation=R(this._moveManipulation),this.manipulators.removeAll(),this._infos.size===0)return;const i=Array.from(this._infos.values(),({info:t})=>t);this._createManipulators(i),this._createVisualElements(i),this._updateMoveManipulation(i)}_createManipulators(i){for(const t of i){const e=t.state;t.manipulationXY=new wi({tool:this,view:this.view,graphicState:e}),t.manipulationXY.forEachManipulator(n=>this.addHandles([n.events.on("immediate-click",a=>{this.emit("immediate-click",{...a,graphic:e.graphic}),a.stopPropagation()}),n.events.on("grab-changed",({action:a})=>{const{tooltipOptions:o,_tooltip:s}=this;s!=null&&(a==="start"?(this._translateGraphicTooltipInfo??(this._translateGraphicTooltipInfo=new _e({tooltipOptions:o})),s.info=this._translateGraphicTooltipInfo,s.info.tooltipOptions=o,s.info.distance=ct):s.clear())})],pt)),this.addHandles(t.manipulationXY.createDragPipeline((n,a,o,s)=>this._buildDragEventPipeline(i,S.XY,n,a,o,s)),pt)}this._createMoveManipulation(i)}_createMoveManipulation(i){const t=new Ut({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:i.length===1?Ut.radiusForSymbol(i[0].graphic.symbol):ut});this._moveManipulation=t,t.elevationInfo={mode:"absolute-height",offset:0},t.forEachManipulator(o=>{this.addHandles(o.events.on("immediate-click",s=>{t.zManipulation.hasManipulator(o)||this.graphics.length!==1||this.emit("immediate-click",{...s,graphic:this.graphics.at(0)}),s.stopPropagation()}),pt)});const e=o=>s=>{this.addHandles(s.events.on("focus-changed",({action:r})=>{const l=this._tooltip;l!=null&&(r==="focus"?this._updateMoveTooltip(i,o):l.clear())}),pt)};this._moveManipulation.xyManipulation.forEachManipulator(e(S.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(S.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(S.Z));const n=()=>this._updateMoveManipulation(i);for(const o of i)this.addHandles([o.state.on("changed",n),y(()=>o.state.displaying,n)],pt);const a=i[i.length-1];this.addHandles(a.state.on("changed",()=>this._updateMoveManipulationAngle(a)),pt),this.addHandles(t.createDragPipeline((o,s,r,l,p)=>this._buildDragEventPipeline(i,o,s,r,l,p),z(a.graphic),a.graphic.geometry.spatialReference,a.graphic),pt),this._updateMoveManipulationAngle(a)}_createVisualElements(i){for(const t of i){const e=t.graphic,n=qe({view:this.view,graphic:e,forEachManipulator:a=>{var o,s;(o=t.manipulationXY)==null||o.forEachManipulator(a),(s=this._moveManipulation)==null||s.forEachManipulator(a)},onManipulatorsChanged:()=>Z()});n!=null&&(t.geometryRepresentation=n.visualElement,t.geometryRepresentation instanceof Nt&&this.addHandles([t.geometryRepresentation.events.on("attachment-origin-changed",()=>{t.state.isDraped||this._updateMoveManipulation(i)}),y(()=>t.state.isDraped,()=>this._updateMoveManipulation(i))],pt),this.addHandles(n,pt))}}_updateMoveManipulationAngle(i){this._moveManipulation&&(this._moveManipulation.angle=bi(i.graphic.geometry))}_updateMoveManipulation(i){const t=Ne(0,0,0,this.view.spatialReference);let e=0,n=!1;const a=this._moveManipulation;if(a){for(const o of i){if(!o.state.displaying)continue;const s=o.state.graphic;this.enableZ&&kt(s)&&(n=!0);const r=o.geometryRepresentation instanceof Nt&&!o.state.isDraped?o.geometryRepresentation.attachmentOrigin:xa(this.view,s);if(r!=null){const{x:l,y:p,z:c}=r;t.x+=l,t.y+=p,c&&(t.z??(t.z=0),t.z+=c),e++}}e>0?(t.x/=e,t.y/=e,t.z??(t.z=0),t.z/=e,a.location=t,a.xyManipulation.available=!0,a.xyAxisManipulation.available=!0,a.zManipulation.available=n):a.available=!1}}_buildDragEventPipeline(i,t,e,n,a,o){const s=[],r=[];let l=null,p=null;const c=()=>{for(const d of s)d.dragging=!1;s.length=0,r.length=0,l=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(i.length===1&&t===S.XY){const d=i[0].graphic;({steps:n,cancel:a}=this._buildSnappingPipelineSteps(d,z(d),n,a,o))}return a=a.next(d=>p==null?void 0:p(d)).next(()=>(this.emit("graphic-move-stop",new ta(r)),this.destroyed||c(),null)),{steps:n=n.next(d=>{var g,_;if(d.action==="start"){s.length=0,r.length=0;for(const m of i)m.dragging||!((g=m.manipulationXY)!=null&&g.hasManipulator(e))&&((_=m.manipulationXY)!=null&&_.grabbing)||(s.push(m),r.push(m.graphic),m.dragging=!0);if(r.length!==0&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),l=go(r,this.view.state.viewingMode),p=_o(r),this.emit("graphic-move-start",new xs(r)),this.destroyed))return null}return r.length!==0?d:null}).next(d=>l==null?void 0:l(d)).next(d=>(this._updateMoveTooltip(i,t,d),d)).next(d=>{switch(d.action){case"start":case"update":if(d.translationX||d.translationY||d.translationZ){const g=this.view.toScreen(d.mapStart),_=this.view.toScreen(d.mapEnd),m=_.x-g.x,v=_.y-g.y;if(this.emit("graphic-move",new Es(m,v,r)),this.destroyed)return null}break;case"end":if(this.emit("graphic-move-stop",new ta(r)),this.destroyed)return null;c()}return null}),cancel:a}}_updateMoveTooltip(i,t,e){const{tooltipOptions:n,_tooltip:a}=this;if(a==null)return;a.clear();const o=i.length===0?"absolute-height":i[0].state.isDraped?"on-the-ground":"absolute-height";switch(t){case S.XY:a.info=this._translateGraphicTooltipInfo??(this._translateGraphicTooltipInfo=new _e({tooltipOptions:n})),this._updateMoveTooltipDistance(a.info,e,(s,r)=>bt(s,r,o));break;case S.XY_AXIS:a.info=this._translateGraphicXYTooltipInfo??(this._translateGraphicXYTooltipInfo=new yi({tooltipOptions:n})),this._updateMoveTooltipDistance(a.info,e,(s,r)=>{const l=bt(s,r,o);return Ie(l,ze(e))});break;case S.Z:a.info=this._translateGraphicZTooltipInfo??(this._translateGraphicZTooltipInfo=new je({tooltipOptions:n})),this._updateMoveTooltipDistance(a.info,e,Le)}a.info.tooltipOptions=n}_updateMoveTooltipDistance(i,t,e){if(t!=null&&t.action!=="end"){const{mapStart:n,mapEnd:a}=t,o=e(n,a);i.distance=o??ct}else i.distance=ct}_buildSnappingPipelineSteps(i,t,e,n,a){const o=i.geometry;if(o==null||o.type!=="point"&&o.type!=="mesh")return{steps:e,cancel:n};const s=(o.type==="point"?o:o.anchor).clone(),r=new Re({elevationInfo:t,pointer:a,editGeometryOperations:Be.fromGeometry(s,this.view.state.viewingMode),visualizer:new ge,excludeFeature:i}),l=this.snappingManager,{snappingStep:p,cancelSnapping:c}=Ce({snappingContext:r,snappingManager:l,updatingHandles:this._updatingHandles});return n=n.next(c),{steps:e=e.next(d=>(s.z=Mn(this.view,s,z(i),{mode:"absolute-height",offset:0}),{...d,snapOrigin:r.coordinateHelper.pointToVector(s)})).next(...p),cancel:n}}get test(){return{tooltip:this._tooltip}}};h([u({constructOnly:!0,nonNullable:!0})],dt.prototype,"view",void 0),h([u()],dt.prototype,"graphics",void 0),h([u({constructOnly:!0,nonNullable:!0})],dt.prototype,"enableZ",void 0),h([u({constructOnly:!0,type:Rt})],dt.prototype,"tooltipOptions",void 0),h([u({constructOnly:!0})],dt.prototype,"snappingManager",void 0),h([u()],dt.prototype,"type",void 0),h([u()],dt.prototype,"updating",null),dt=h([k("esri.views.3d.interactive.editingTools.graphicMove3D.GraphicMoveTool")],dt);class Os{constructor(t){this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1,this.state=new Ft({graphic:t})}get graphic(){return this.state.graphic}}function ea(i,t,e){const n=e.mode==="on-the-ground"?ki.XY:ki.XYZ;return new fo(i,n,t,0)}function ia(i,t,e){const n=H();if(!i.renderCoordsHelper.toRenderCoords(t,n))return null;const a=aa(i,t,me(e.plane)),o=aa(i,t,e.edgeDirection);if(a==null||o==null)return null;const s=It(H(),a,o);return ya(n,s,_i())}function aa(i,t,e){const n=Ne(t.x+e[0],t.y+e[1],t.z+e[2],t.spatialReference),a=H(),o=H();return i.renderCoordsHelper.toRenderCoords(t,a)&&i.renderCoordsHelper.toRenderCoords(n,o)?Ma(o,a,o):null}function Ts(i,t,e){const n=me(i),a=Ma(H(),t,e),o=It(H(),a,n),s=It(H(),a,o);return bn(a[0],a[1],a[2],0,o[0],o[1],o[2],0,s[0],s[1],s[2],0,0,0,0,1)}function As(i,t,e){const n=e.projectToRenderScreen(i,Gi()),a=e.projectToRenderScreen(t,Gi());return n!=null&&a!=null?Sn(L(n,n,a)):0}let Tt=class extends Ye{constructor(t){super(t),this.type="reshape-edge-offset",this.distance=ct,this.area=null,this.totalLength=null}};h([u()],Tt.prototype,"type",void 0),h([u()],Tt.prototype,"distance",void 0),h([u()],Tt.prototype,"area",void 0),h([u()],Tt.prototype,"totalLength",void 0),Tt=h([k("esri.views.interactive.tooltip.ReshapeEdgeOffsetTooltipInfo")],Tt);let C=class extends $t.EventedMixin(Yt){constructor(t){super(t),this._selectedIndex=0,this._manipulatorHandles=new Ue,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=I.NONE,this._updatingHandles=new gi,this._recreatingManipulators=!1,this._settings=new Zt({getTheme:()=>this.view.effectiveTheme}),this._translateGraphicTooltipInfo=null,this._translateGraphicXYTooltipInfo=null,this._translateGraphicZTooltipInfo=null,this._translateVertexTooltipInfo=null,this._translateVertexXYTooltipInfo=null,this._translateVertexZTooltipInfo=null,this._edgeOffsetTooltipInfo=null,this.outputGeometry=null,this._vertexLaserLineVisualElement=null}initialize(){const{graphic:t,view:e}=this,n=this._settings.manipulators,a=n.vertex;this._vertexManipulatorMaterial=Mt(Y(a.color),a.renderOccluded),this._vertexManipulatorOutlineMaterial=ne(Y(a.outlineColor),a.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=ne(Y(a.hoverOutlineColor),a.renderOccluded);const o=n.edge;this._edgeManipulatorMaterial=Mt(Y(o.color),o.renderOccluded),this._edgeManipulatorOutlineMaterial=ne(Y(o.outlineColor),o.renderOccluded);const s=n.edgeOffset;this._edgeOffsetManipulatorMaterial=Mt(Y(s.color),s.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=Mt(Y(s.hoverColor),s.renderOccluded,!1);const r=n.selected;this._selectedManipulatorMaterial=Mt(Y(r.color),r.renderOccluded),this._selectedManipulatorOutlineMaterial=ne(Y(r.outlineColor),r.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=ne(Y(r.hoverOutlineColor),r.renderOccluded);const l=this._graphicState=new Ft({graphic:t});this._tooltip=new ve({view:e}),this.addHandles([y(()=>{const p=this._settings.manipulators;return{vertexSettings:p.vertex,edgeSettings:p.edge,edgeOffsetSettings:p.edgeOffset,selectedSettings:p.selected}},({vertexSettings:p,edgeSettings:c,edgeOffsetSettings:d,selectedSettings:g})=>{p.applyColor(this._vertexManipulatorMaterial),p.applyOutline(this._vertexManipulatorOutlineMaterial),p.applyHoverOutline(this._vertexManipulatorHoverOutlineMaterial),c.applyColor(this._edgeManipulatorMaterial),c.applyOutline(this._edgeManipulatorOutlineMaterial),d.applyColor(this._edgeOffsetManipulatorMaterial),d.applyHover(this._edgeOffsetManipulatorHoverMaterial),g.applyColor(this._selectedManipulatorMaterial),g.applyOutline(this._selectedManipulatorOutlineMaterial),g.applyHoverOutline(this._selectedManipulatorHoverOutlineMaterial)}),y(()=>l.displaying,p=>{for(const c of this._manipulatorInfos)c.manipulator.available=p}),y(()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:p,enabled:c,edgeOffsetEnabled:d})=>{p!=null&&(p.visible=c,p.edgeDistance=d?"far":"default")},$),Xt(()=>!this._tooltipOptions.enabled,()=>this._tooltip.clear(),$),this.view.trackGraphicState(l)])}destroy(){this._segmentLabels=R(this._segmentLabels),this._tooltip=R(this._tooltip),this._removeManipulators(),this._updatingHandles.destroy()}get inputGeometry(){return this._editGeometryOperations!=null?this._editGeometryOperations.data.geometry:null}set inputGeometry(t){this._recreateEditGeometryAndManipulators(t)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _labelOptions(){return this.tool.labelOptions}get _tooltipOptions(){return this.tool.tooltipOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}removeSelectedVertices(){const t=this._manipulatorInfos.filter(e=>e.manipulator.selected&&e.type==="vertex");this._removeVertices(t)}onManipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=R(this._moveManipulation),this._graphicMoveManipulation=R(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(t){if(this._editGeometryOperations==null)return;const e=z(this.graphic);for(const n of this._editGeometryOperations.data.components){const a=t==null?void 0:t.byComponentIndex.get(n.index);for(const o of n.vertices){const s=a==null?void 0:a.has(o.index);this._createVertexOrEdgeManipulator(o,e,s)}for(const o of n.edges)this._createVertexOrEdgeManipulator(o,e)}this._createGraphicMoveManipulation(),this._createMoveManipulation(e),this._createVisualElements()}get canRedo(){return this._editGeometryOperations!=null&&this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations!=null&&this._editGeometryOperations.canUndo}redo(){if(this._editGeometryOperations==null)return null;const t=this._editGeometryOperations.redo();return t!=null&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),t}undo(){if(this._editGeometryOperations==null)return null;this.emit("undo");const t=this._editGeometryOperations.undo();return t!=null&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),t}_recreateManipulators(){this._recreatingManipulators||(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._createManipulators(),this._recreatingManipulators=!1)}_recreateEditGeometryAndManipulators(t){const e={byComponentIndex:new Map};if(t!=null&&this.inputGeometry!=null&&wn(t,this.inputGeometry)){for(const a of this._manipulatorInfos)if(a.type==="vertex"&&a.manipulator.selected){const{index:o,component:{index:s}}=a.handle,{byComponentIndex:r}=e,l=r.get(s)||new Set;l.add(o),r.set(s,l)}}if(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._editGeometryOperations=R(this._editGeometryOperations),this._segmentLabels=R(this._segmentLabels),t==null)return void(this._recreatingManipulators=!1);const n=t.type==="mesh"?t.anchor:t;this._editGeometryOperations=Be.fromGeometry(n,this.view.state.viewingMode),this._createManipulators(e),this._segmentLabels=new Pe({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:z(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}),this._recreatingManipulators=!1}_perGraphicManipulatorDragAction(t,e){if(e.action==="end")return e;let n=0;const a=[],o=this._manipulatorInfos.some(r=>r.type==="vertex"&&r.manipulator.selected),s=t===Jt.SELECTED_OR_ALL&&o;for(const r of this._manipulatorInfos)r.type==="vertex"&&(r.manipulator.grabbing||s&&!r.manipulator.selected||a.push(r),n++);if(a.length===0)return e;if(this._moveVertices(a,e),a.length===n){if(this._updateEventState(I.MOVING),this.destroyed)return e;this.emit("move",{type:"move",dx:e.screenDeltaX,dy:e.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(I.RESHAPING),this.destroyed)return e;this.emit("reshape",{type:"reshape",mover:this.graphic})}return e}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((t,e)=>e.type==="vertex"&&e.manipulator.selected?t+1:t,0)>1}_perVertexManipulatorDragAction(t){if(this._updateEventState(I.RESHAPING),this.destroyed)return;const{mapDeltaX:e,mapDeltaY:n,mapDeltaZ:a}=t;if(!e&&!n&&!a)return;const o=[];for(const s of this._manipulatorInfos)s.type==="vertex"&&(s.manipulator.selected&&!s.manipulator.grabbing||s===t.info)&&o.push(s);this._moveVertices(o,t,St.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(t){if(t===this._reshapeEventState)return!1;switch(t){case I.NONE:if(this._numGrabbing!==0||this._numDragging!==0)return!1;switch(this._reshapeEventState){case I.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case I.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case I.MOVING:switch(this._reshapeEventState){case I.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case I.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case I.RESHAPING:switch(this._reshapeEventState){case I.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case I.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const e=this._reshapeEventState!==t;return this._reshapeEventState=t,e}_createGraphicMoveManipulation(){const{tool:t,view:e}=this,n=this._graphicState;if(this._graphicMoveManipulation=new wi({tool:t,view:e,graphicState:n}),this.enableMoveGraphic){let a=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline((o,s,r)=>{s.next(l=>this._trackNumDragging(l)).next(l=>(l.action==="start"&&(a=this._editGeometryOperations.createUndoGroup()),l)).next(l=>this._perGraphicManipulatorDragAction(Jt.ALL,l)).next(l=>(this._updateTranslateGraphicTooltip(S.XY,l),l)).next(l=>{l.action==="end"&&(this._tooltip.clear(),a=gt(a))}),r.next(()=>this._onDragCancel(!0,()=>a=gt(a)))})),this._graphicMoveManipulation.forEachManipulator(o=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(o,!1)))}else this._graphicMoveManipulation.forEachManipulator(a=>{a.grabbable=!1,a.cursor=null});this._graphicMoveManipulation.forEachManipulator(a=>this._manipulatorHandles.add(a.events.on("immediate-click",o=>{this._manipulatorInfos.some(s=>s.manipulator.selected)?this._clearSelection():this.emit("immediate-click",{...o,graphic:this.graphic}),o.stopPropagation()})))}_createMoveManipulation(t){const{graphic:e,tool:n,view:a}=this,o=this._graphicState;this._moveManipulation=new Ut({tool:n,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&kt(e),snapToScene:!1,radius:Ut.radiusForSymbol(e.symbol)}),this._moveManipulation.forEachManipulator(l=>this.addHandles([l.events.on("immediate-click",p=>{this._moveManipulation.zManipulation.hasManipulator(l)||this._manipulatorInfos.some(c=>c.manipulator.selected)||this.emit("immediate-click",{...p,graphic:e}),p.stopPropagation()}),this._watchAndUpdateGrabState(l,!1)]));const s=l=>p=>{this.addHandles(p.events.on("focus-changed",({action:c})=>{c==="focus"&&this._tooltipOptions.enabled?this._updateTranslateTooltip(l):this._tooltip.clear()}))};this._moveManipulation.xyManipulation.forEachManipulator(s(S.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(s(S.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(s(S.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const r=e.geometry.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((l,p,c,d,g)=>{const{snappingStep:_,cancelSnapping:m}=Ce({predicate:v=>!!v.info,snappingManager:n.snappingManager,snappingContext:new Re({editGeometryOperations:this._editGeometryOperations,elevationInfo:t,pointer:g,excludeFeature:e,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:!1});return d=d.next(v=>(this._onDragCancel(),v)).next(m),{steps:c=c.next(v=>this._trackNumDragging(v)).next(v=>{const M=this._manipulatorInfos.filter(b=>b.type==="vertex"&&b.manipulator.selected);return v.manipulatorType===G.TRANSLATE_XY&&M.length===1?{...v,info:M[0],snapOrigin:M[0].handle.pos}:v}).next(Vi(this.view,t,e)).next(..._).next(Kt()).next(v=>this._perGraphicManipulatorDragAction(Jt.SELECTED_OR_ALL,v)).next(v=>(this._updateTranslateTooltip(l,v),v)),cancel:d}},t,r,e),y(()=>o.displaying,()=>this._updateMoveManipulationPosition(),$),o.on("changed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),y(()=>o.isDraped,l=>{this._updateMoveManipulationPosition();const p="align-move-manipulation";l?this.addHandles(this.view.elevationProvider.on("elevation-change",()=>this._updateMoveManipulationPosition()),p):this.removeHandles(p)},$)])}_createVisualElements(){const{graphic:t,view:e}=this,n=qe({view:e,graphic:t,forEachManipulator:a=>{if(!this.destroyed&&!this._recreatingManipulators){this._graphicMoveManipulation.forEachManipulator(a),this._moveManipulation.forEachManipulator(a);for(const o of this._manipulatorInfos)a(o.manipulator,G.TRANSLATE_XY)}},onManipulatorsChanged:a=>this.on("manipulators-changed",a)});n!=null&&(this._outlineVisualElement=n.visualElement instanceof Nt?n.visualElement:null),this._outlineVisualElement!=null&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()})),this._manipulatorHandles.add(n)}_createEdgeOffsetManipulator(t,e=z(this.graphic)){var m,v;const n=this._settings.manipulators.edgeOffset,a=n.size/2,o=a+n.collisionPadding,s=a/o,r=s*Math.sqrt(3)/2;this._edgeOffsetManipulatorGeometryInside==null&&(this._edgeOffsetManipulatorGeometryInside=Ae(this._edgeOffsetManipulatorMaterial,r,s/2,s/2,n.height,n.offset)),this._edgeOffsetManipulatorGeometryOutside==null&&(this._edgeOffsetManipulatorGeometryOutside=Ae(this._edgeOffsetManipulatorMaterial,-r,s/2,s/2,n.height,-n.offset));const l=[new x(this._edgeOffsetManipulatorGeometryInside.instantiate(),E.Unfocused),new x(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),E.Focused),new x(this._edgeOffsetManipulatorGeometryOutside.instantiate(),E.Unfocused),new x(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),E.Focused)],p=new et({view:this.view,renderObjects:l,elevationInfo:e.mode!=="on-the-ground"||Di(this.graphic.symbol)?{mode:"absolute-height",offset:0}:e,worldOriented:!1,focusMultiplier:1,radius:o,available:!(!this.graphic.visible||!((m=this.graphic.layer)!=null&&m.visible)),collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),c=new et({view:this.view,worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!((v=this.graphic.layer)!=null&&v.visible)),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),d={manipulator:p,handle:t,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:c,elevationInfo:e,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,n.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const g=[];for(const M of[d.handle.leftVertex,d.handle.rightVertex]){const b=this._getManipulatorInfoFromHandle(M);b!=null&&g.push(b.manipulator.events.on("location-update",()=>this._updateEdgeOffsetManipulator(d)))}d.locationUpdateHandle=F(g),this._manipulatorHandles.add(d.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(c,!0)],p),this._manipulatorHandles.add(lt(p,this._createEdgeOffsetPipeline(d,e)),p),this._manipulatorHandles.add(lt(c,(M,b,f,O)=>{if(O==="touch")this._createEdgeOffsetPipeline(d,e)(M,b,f);else if(this.enableMoveGraphic){const D=this.graphic,V=D.geometry!=null?D.geometry.spatialReference:null;b.next(N=>this._trackNumDragging(N)).next(he(this.view,M.elevationAlignedLocation)).next(vi(this.view,M.elevationAlignedLocation,e,V,D)).next(ie()).next(Kt()).next(N=>this._perGraphicManipulatorDragAction(Jt.ALL,N)).next(N=>(this._updateTranslateGraphicTooltip(S.XY,N),N)).next(N=>{N.action==="end"&&this._tooltip.clear()}),f.next(()=>this._onDragCancel(!M.metadata.deleting))}}),p);const _=M=>{this._manipulatorInfos.some(b=>b.manipulator.selected)?this._clearSelection():this.emit("immediate-click",{...M,graphic:this.graphic}),M.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",_),c.events.on("immediate-click",_),p.events.on("focus-changed",({action:M})=>{const{_tooltipOptions:b,_tooltip:f}=this;M==="focus"&&b.enabled?(f.info=this._edgeOffsetTooltipInfo??(this._edgeOffsetTooltipInfo=new Tt({tooltipOptions:b})),f.info.distance=ct,f.info.tooltipOptions=b,this._updateTooltipAreaOrTotalLength(f.info)):f.clear()})],p),this._manipulatorInfos.push(d),this.manipulators.add(p),this.manipulators.add(c),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(t,e){const n=t.manipulator,a=t.edgeManipulator,o=()=>{t.visibilityHandle=gt(t.visibilityHandle);const s=this._getManipulatorInfoFromHandle(t.handle.leftVertex),r=this._getManipulatorInfoFromHandle(t.handle.rightVertex),l=s!=null&&r!=null&&As(s.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera){n.grabbable=!0,a.grabbable=this.enableMoveGraphic})]))};this._manipulatorHandles.add([n.events.on("focus-changed",o),a.events.on("focus-changed",o),Z(()=>{gt(t.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)})],n),o()}_updateEdgeOffsetManipulator(t){this._updateManipulatorPosition(t);const{coordinateHelper:e}=this._editGeometryOperations.data,n=ia(this.view,t.manipulator.elevationAlignedLocation,ea(e,t.handle,t.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(t.handle.leftVertex),o=this._getManipulatorInfoFromHandle(t.handle.rightVertex);if(a==null||o==null)return;const s=a.manipulator.renderLocation,r=o.manipulator.renderLocation,l=n!=null?Ts(n,s,r):xn;t.manipulator.modelTransform=l,t.edgeManipulator.elevationAlignedLocation=t.manipulator.elevationAlignedLocation,t.edgeManipulator.modelTransform=l;const p=te(L(Se,s,r))/2;t.edgeManipulator.collisionType={type:"line",paths:[[[-p,0,0],[p,0,0]]]}}_createEdgeOffsetPipeline(t,e){return(n,a,o)=>{this._clearSelection();const{step:s,cleanup:r}=this._initializeEdgeOffset(t,e);a.next(l=>this._trackNumDragging(l)).next(he(this.view,n.elevationAlignedLocation)).next(s).next(ro(this.view)).next(lo(this.view,this._editGeometryOperations.data.spatialReference)).next(Kt()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(t)).next(this._showEdgeOffsetTooltip()).next(l=>{l.action==="end"&&r()}),o.next(()=>{n.metadata.deleting||(r(),this._onDragCancel())})}}_initializeEdgeOffset(t,e){const{view:n}=this,a=this._editGeometryOperations,o=ea(a.data.coordinateHelper,t.handle,e),s=a.createUndoGroup(),r=ia(n,t.manipulator.elevationAlignedLocation,o);if(o.requiresSplitEdgeLeft){const m=this._getManipulatorInfoFromHandle(t.handle.leftVertex.leftEdge);m!=null&&this._splitEdgeManipulator(m,1)}if(o.requiresSplitEdgeRight){const m=this._getManipulatorInfoFromHandle(t.handle.rightVertex.rightEdge);m!=null&&this._splitEdgeManipulator(m,0)}const l=()=>new An({paths:[[t.handle.leftVertex.pos,t.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),p=this._settings,c=new Nt({view:n,isDraped:this._graphicState.isDraped,geometry:l(),elevationInfo:t.elevationInfo,width:p.visualElements.lineGraphics.outline.width,attached:!1,isDecoration:!0});let d;const g=()=>{this._cleanEdgeOffsetCollapsedEdges(t),d=gt(d)},_=this.on("undo",g);return d=F([y(()=>Y(this._accentColor),m=>c.color=m,$),Gt(c),y(()=>this._graphicState.isDraped,m=>c.isDraped=m),this._graphicState.on("changed",()=>c.geometry=l()),s,_]),c.attached=!0,{step:m=>o==null||r==null?(g(),null):{...m,operation:o,plane:r},cleanup:g}}_applyEdgeOffsetStep(t){return e=>{if(this.destroyed||e.operation==null)return e;this._updateEventState(I.RESHAPING);const{mapDeltaX:n,mapDeltaY:a,mapDeltaZ:o}=e;return(n||a||o)&&(this._offsetEdge(t,e),this.emit("reshape",{type:"reshape",mover:this.graphic})),e}}_applyComputeEdgeOffsetDistanceStep(){return t=>{const{operation:e,mapEnd:n}=t;return e==null||n==null?t:(t.action==="start"&&e.selectArrowFromStartPoint(n),{...t,signedDistance:e.signedDistanceToPoint(n)})}}_showEdgeOffsetTooltip(){return t=>{const{mapEnd:e,signedDistance:n,operation:a}=t,{_tooltip:o,_tooltipOptions:s}=this;return s.enabled&&n!=null?(o.info=this._edgeOffsetTooltipInfo??(this._edgeOffsetTooltipInfo=new Tt({tooltipOptions:s})),o.info.tooltipOptions=s,o.info.distance=t.action==="end"?ct:Gs(this._graphicState.isDraped,n*a.selectedArrow,e,a.plane,this._editGeometryOperations.data.coordinateHelper),this._updateTooltipAreaOrTotalLength(o.info),t):(o.clear(),t)}}_cleanEdgeOffsetCollapsedEdges(t){var l,p;const e=(l=t.handle.leftVertex.leftEdge)==null?void 0:l.leftVertex,n=t.handle.leftVertex,a=(p=t.handle.rightVertex.rightEdge)==null?void 0:p.rightVertex,o=t.handle.rightVertex,s=this._editGeometryOperations.data.coordinateHelper,r=[];if(e&&s.distance(e.pos,n.pos)this._updateManipulatorPosition(c)))}c.locationUpdateHandle=F(_),this._manipulatorHandles.add(c.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);const d=lt(p,(_,m,v,M)=>{let b=null;const{snappingStep:f,cancelSnapping:O}=Ce({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new Re({editGeometryOperations:this._editGeometryOperations,elevationInfo:e,pointer:M,excludeFeature:this.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:!1});v=v.next(D=>(this._onDragCancel(!_.metadata.deleting,()=>b=gt(b)),D)).next(O),m.next(D=>this._trackNumDragging(D)).next(D=>{if(D.action==="start"&&(b=this._editGeometryOperations.createUndoGroup()),c.type==="edge"){const V=this._splitEdgeManipulator(c);return{...D,info:V,snapOrigin:V.handle.pos}}return{...D,info:c,snapOrigin:c.handle.pos}}).next(he(this.view,_.elevationAlignedLocation)).next(po(this.view,this.graphic,_.elevationAlignedLocation,_.location.spatialReference,this.graphic)).next(Vi(this.view,e,this.graphic)).next(...f).next(Kt()).next(D=>{this._perVertexManipulatorDragAction(D),D.action==="end"&&(b=gt(b)),this._updateTranslateVertexTooltip(_,S.XY,D)})});return this._manipulatorHandles.add([d,p.events.on("immediate-click",_=>this._manipulatorClickCallback(_,c)),p.events.on("select-changed",()=>{c.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()}),p.events.on("focus-changed",({action:_})=>{_==="focus"&&c.type!=="edge"?this._updateTranslateVertexTooltip(p,S.XY):this._tooltip.clear()})],p),this.emit("manipulators-changed"),c}_trackNumDragging(t){switch(t.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return t}_onDragCancel(t=!0,e){switch(this._numDragging--,t&&(this.undo(),this.outputGeometry=this._editGeometryOperations!=null?this._editGeometryOperations.data.geometry:null),this.tool.snappingManager!=null&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case I.NONE:break;case I.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case I.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}e&&e(),this.destroyed||this._updateEventState(I.NONE)}_setTypeSpecificManipulatorSettings(t,e,n){const{graphic:a}=this,o=this._settings;switch(e.type){case"vertex":{t.state=nt.Vertex,t.selectable=!0,t.cursor="move",t.collisionPriority=2;const{size:s,collisionPadding:r}=o.manipulators.vertex;t.radius=s/2+r,t.elevationInfo=n;const{geometry:l}=a,p=l==null?void 0:l.type;t.interactive=p!=null&&p!=="point"&&p!=="mesh";break}case"edge":{t.state=nt.Edge,t.selectable=!1,t.cursor="copy",t.collisionPriority=-1;const{size:s,collisionPadding:r}=o.manipulators.edge;t.radius=s/2+r,t.elevationInfo=n.mode!=="on-the-ground"||Di(a.symbol)?{mode:"absolute-height",offset:0}:n;break}}}_watchAndUpdateGrabState(t,e){return t.events.on("grab-changed",n=>this._onGrabStateChanged(t,e,n.action,n.pointerType))}_onGrabStateChanged(t,e,n,a="mouse"){if(!this._recreatingManipulators){if(n==="start")e&&this._updateSelection(t),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(I.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,(a!=="touch"||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(o=>{const{manipulator:s}=o,{geometry:r}=this.graphic,l=r==null?void 0:r.type;s.interactive=s.grabbing||!this._numGrabbing&&l!=null&&l!=="point"&&l!=="mesh","edgeManipulator"in o&&(o.edgeManipulator.interactive=o.edgeManipulator.grabbing||!this._numGrabbing)}),this._graphicMoveManipulation.forEachManipulator(o=>{o.interactive=o.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const t of this._manipulatorInfos)t.manipulator.grabbing||(t.manipulator.selected=!1)}_updateSelection(t){t.grabbing&&!t.selected&&t.selectable&&(this._clearSelection(),t.selected=!0,this.emit("manipulators-changed"))}_removeManipulator(t){t!=null&&(t.manipulator.metadata.deleting=!0,this.manipulators.remove(t.manipulator),this._manipulatorHandles.remove(t.manipulator),En(this._manipulatorInfos,t),this.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(t){if(t){for(const e of this._manipulatorInfos)if(t===e.handle)return e}return null}_updateManipulatorPosition(t){if(t==null)return;const e=this._editGeometryOperations;if(t.type==="vertex")t.manipulator.location=e.data.coordinateHelper.vectorToDehydratedPoint(t.handle.pos,se),t.manipulator.grabbing&&this._vertexLaserLineVisualElement!=null&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=t.manipulator.renderLocation);else if(t.type==="edge"){const n=this._getManipulatorInfoFromHandle(t.handle.leftVertex),a=this._getManipulatorInfoFromHandle(t.handle.rightVertex);if(n==null||a==null)return;const o=n.manipulator,s=a.manipulator;if(t.manipulator.elevationInfo!=null&&t.manipulator.elevationInfo.mode==="on-the-ground"){const r=o.location,l=s.location,p=.5,c=r.x+p*(l.x-r.x),d=r.y+p*(l.y-r.y),g=r.hasZ&&l.hasZ?0:void 0;t.manipulator.location=Ne(c,d,g,e.data.spatialReference)}else Pt(Se,o.renderLocation,s.renderLocation,.5),t.manipulator.renderLocation=Se}}_splitEdgeManipulator(t,e=.5){const n=this._editGeometryOperations,a=n.splitEdge(t.handle,e).createdVertex;t.locationUpdateHandle=gt(t.locationUpdateHandle);const o=z(this.graphic);let s;this.enableEdgeOffset?(this._removeManipulator(t),s=this._createVertexOrEdgeManipulator(a)):(s=t,s.handle=a,s.type="vertex",this._setTypeSpecificManipulatorSettings(t.manipulator,t.handle,o)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=n.data.geometry,this._updateManipulatorPosition(s),this.enableEdgeOffset||this._updateTranslateVertexTooltip(s.manipulator,S.XY),this._updateSelection(t.manipulator);const r=this._updateEventState(I.RESHAPING),l=n.data.coordinateHelper.vectorToArray(s.handle.pos),p=n.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:l,componentIndex:p,vertexIndex:a.index}],added:l}),r&&this._updateEventState(I.NONE),s}_updateMoveManipulationPosition(){const t=rt(Se,0,0,0);let e=0,n=!1,a=null,o=null;for(const s of this._manipulatorInfos)s.type==="vertex"&&(s.manipulator.selected?(e++,At(t,t,s.manipulator.renderLocation),a==null||s.selectedIndex>a.selectedIndex?(o=a,a=s):(o==null||s.selectedIndex>o.selectedIndex)&&(o=s)):n=!0);if(e===0){const s=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=s,this._moveManipulation.xyAxisManipulation.available=s,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=s,this._moveManipulation.zManipulation.available=s&&this.enableZShape&&kt(this.graphic),this._moveManipulation.angle=bi(this.graphic.geometry),this._moveManipulation.radius=Ut.radiusForSymbol(this.graphic.symbol)}else{const s=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=s,this._moveManipulation.xyAxisManipulation.available=s,this._moveManipulation.zManipulation.available=s&&this.enableZVertex&&kt(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=s&&e!==1;let r=0;if(a!=null){const l=a.handle.pos,p=o!=null?o.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,c=o==null&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;p&&c?this._moveManipulation.xyAxisManipulation.available=!1:p?r=na(p,l):c&&(r=na(l,c))}this._moveManipulation.angle=r,this._moveManipulation.radius=La}e!==0&&n?(Vt(t,t,1/e),se.spatialReference=this._editGeometryOperations.data.spatialReference,se.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(t,se),this._moveManipulation.elevationAlignedLocation=se):this._outlineVisualElement==null||this._graphicState.isDraped||this._outlineVisualElement.attachmentOrigin==null?Ea(this.view,this._moveManipulation,this.graphic):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(t){var a;const e=new Array,n=this._editGeometryOperations;for(const o of t)if(o.type==="vertex"&&n.canRemoveVertex(o.handle.component)){e.push(o.handle),this._removeManipulator(o),this._removeManipulator(this._getManipulatorInfoFromHandle(o.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(o.handle.rightEdge));const s=n.removeVertices([o.handle]),r=(a=s.removedVertices)==null?void 0:a[0].createdEdge;r&&this._createVertexOrEdgeManipulator(r)}if(e.length>0){const o=e.map(r=>{const l=n.data.components.indexOf(r.component);return{coordinates:n.data.coordinateHelper.vectorToArray(r.pos),componentIndex:l,vertexIndex:r.index}});this.outputGeometry=n.data.geometry;const s=this._updateEventState(I.RESHAPING);if(this.destroyed||(this.emit("vertex-remove",{type:"vertex-remove",removed:o.map(r=>r.coordinates),vertices:o}),this.destroyed)||s&&(this._updateEventState(I.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(t,e,n=e.action==="start"?St.NEW_STEP:St.ACCUMULATE_STEPS){const a=this._editGeometryOperations;a.moveVertices(t.map(o=>o.handle),e.mapDeltaX,e.mapDeltaY,e.mapDeltaZ,n),this.outputGeometry=a.data.geometry;for(const o of t)this._updateManipulatorPosition(o)}_offsetEdge(t,e){if(e.operation==null||e.signedDistance==null)return;const n=this._editGeometryOperations,a=e.operation.clone();a.distance=e.signedDistance,n.updateVertices([t.handle.leftVertex,t.handle.rightVertex],a),this.outputGeometry=n.data.geometry,this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t.handle.rightVertex))}_manipulatorClickCallback(t,e){t.shiftKey||this._clearSelection(),e.type==="vertex"&&(e.manipulator.selected=!e.manipulator.selected,t.button===Ii.Right&&this._removeVertices([e])),e.type==="edge"&&t.button===Ii.Left&&this._splitEdgeManipulator(e),t.stopPropagation()}_updateTranslateTooltip(t,e){const n=this._manipulatorInfos.filter(a=>a.type==="vertex"&&a.manipulator.selected);n.length===1?this._updateTranslateVertexTooltip(n[0].manipulator,t,e):this._updateTranslateGraphicTooltip(t,e)}_updateTranslateGraphicTooltip(t,e){const{_tooltipOptions:n,_tooltip:a}=this;if(!n.enabled)return;const o=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case S.XY:a.info=this._translateGraphicTooltipInfo??(this._translateGraphicTooltipInfo=new _e({tooltipOptions:n})),this._updateTranslateTooltipDistance(a.info,e,(s,r)=>bt(s,r,o));break;case S.XY_AXIS:a.info=this._translateGraphicXYTooltipInfo??(this._translateGraphicXYTooltipInfo=new yi({tooltipOptions:n})),this._updateTranslateTooltipDistance(a.info,e,(s,r)=>{const l=bt(s,r,o);return Ie(l,ze(e))});break;case S.Z:a.info=this._translateGraphicZTooltipInfo??(this._translateGraphicZTooltipInfo=new je({tooltipOptions:n})),this._updateTranslateTooltipDistance(a.info,e,Le)}a.info.tooltipOptions=n}_updateTranslateVertexTooltip(t,e,n){const{_tooltipOptions:a,_tooltip:o}=this;if(!a.enabled)return;const s=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(e){case S.XY:o.info=this._translateVertexTooltipInfo??(this._translateVertexTooltipInfo=new bo({tooltipOptions:a})),this._updateTranslateTooltipDistance(o.info,n,(l,p)=>bt(l,p,s)),this._updateTooltipAreaOrTotalLength(o.info);break;case S.XY_AXIS:o.info=this._translateVertexXYTooltipInfo??(this._translateVertexXYTooltipInfo=new Mo({tooltipOptions:a})),this._updateTranslateTooltipDistance(o.info,n,(l,p)=>{const c=bt(l,p,s);return Ie(c,ze(n))}),this._updateTooltipAreaOrTotalLength(o.info);break;case S.Z:o.info=this._translateVertexZTooltipInfo??(this._translateVertexZTooltipInfo=new yo({tooltipOptions:a})),this._updateTranslateTooltipDistance(o.info,n,Le)}const r=So(t.elevationAlignedLocation);r!=null&&(o.info.elevation=to({actual:r})),o.info.tooltipOptions=a}_updateTranslateTooltipDistance(t,e,n){if(e!=null&&e.action!=="end"){const{mapStart:a,mapEnd:o}=e,s=n(a,o);t.distance=s??ct}else t.distance=ct}_updateTooltipAreaOrTotalLength(t){const{geometry:e}=this.graphic;if(e==null)return t.area=null,void(t.totalLength=null);const n=this._graphicState.isDraped?"on-the-ground":"absolute-height";t.area=e.type==="polygon"?xo(e,n):null,t.totalLength=e.type==="polyline"?Wn(e,n):null}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function na(i,t){return Math.atan2(t[1]-i[1],t[0]-i[0])+Math.PI/2}function Gs(i,t,e,n,a){if(i){const o=a.toXYZ(a.pointToVector(e)),s=On(n,o,w.get()),r=Kn(s,o,a.spatialReference);if(r!=null)return ce(r.value*Math.sign(t),r.unit)}return ce(t*Oe(e.spatialReference),"meters")}h([u()],C.prototype,"_editGeometryOperations",void 0),h([u()],C.prototype,"_segmentLabels",void 0),h([u({constructOnly:!0})],C.prototype,"tool",void 0),h([u()],C.prototype,"_tooltip",void 0),h([u()],C.prototype,"inputGeometry",null),h([u()],C.prototype,"outputGeometry",void 0),h([u({readOnly:!0})],C.prototype,"updating",null),h([u()],C.prototype,"manipulators",null),h([u()],C.prototype,"view",null),h([u()],C.prototype,"graphic",null),h([u()],C.prototype,"enableZShape",null),h([u()],C.prototype,"enableZVertex",null),h([u()],C.prototype,"enableMoveGraphic",null),h([u()],C.prototype,"enableMidpoints",null),h([u()],C.prototype,"enableEdgeOffset",null),h([u()],C.prototype,"_labelOptions",null),h([u()],C.prototype,"_tooltipOptions",null),h([u()],C.prototype,"_accentColor",null),C=h([k("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],C);const se=Ne(0,0,void 0,Tn.WGS84),Se=H(),ei=1e-6;var nt,I,Jt;(function(i){i.Vertex=yt.Custom1,i.Edge=yt.Custom2})(nt||(nt={})),function(i){i[i.NONE=0]="NONE",i[i.MOVING=1]="MOVING",i[i.RESHAPING=2]="RESHAPING"}(I||(I={})),function(i){i[i.ALL=0]="ALL",i[i.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(Jt||(Jt={}));let X=class extends $t.EventedMixin(Fe){constructor(i){super(i),this._internalGeometryUpdate=!1,this.enableZShape=!0,this.enableZVertex=!0,this.enableMoveGraphic=!0,this.enableMidpoints=!0,this.enableEdgeOffset=!1,this.type="reshape-3d",this.labelOptions=new ba,this.tooltipOptions=new Rt,this.snappingManager=null,this.automaticManipulatorSelection=!1}initialize(){const i=this._reshapeOperation=new C({tool:this});this.addHandles([i.on("reshape",t=>{t.type==="reshape"&&this._onReshapeGeometryChanged(),this.emit("reshape",t)}),i.on("move",t=>{t.type==="move"&&this._onReshapeGeometryChanged(),this.emit("move",t)}),i.on("vertex-add",t=>{this._onReshapeGeometryChanged(),this.emit("vertex-add",t)}),i.on("vertex-remove",t=>{this._onReshapeGeometryChanged(),this.emit("vertex-remove",t)}),i.on("immediate-click",t=>this.emit("immediate-click",t)),this.view.on("pointer-down",["Shift"],t=>t.stopPropagation()),y(()=>this.graphic,()=>this._updateGraphic(),Qt)]),this.finishToolCreation()}destroy(){this._reshapeOperation=R(this._reshapeOperation)}get updating(){var i;return((i=this._reshapeOperation)==null?void 0:i.updating)??!1}_updateGeometry(){const i=Gn(this.graphic);this._reshapeOperation.inputGeometry=i!=null?i.clone():null}_updateGraphic(){if(this.removeHandles("onGraphicGeometryChange"),this._updateGeometry(),Dn(this.graphic)!==fa.SUPPORTED)return;const i=y(()=>{var t;return(t=this.graphic)==null?void 0:t.geometry},()=>{this._internalGeometryUpdate===!1&&this._updateGeometry()},$e);this.addHandles(i,"onGraphicGeometryChange")}onManipulatorSelectionChanged(){this._reshapeOperation&&this._reshapeOperation.onManipulatorSelectionChanged()}_updateGeometryInternally(i){this._internalGeometryUpdate=!0;const{graphic:t}=this,{geometry:e}=t;(e==null?void 0:e.type)==="mesh"&&i.type==="point"?(t.geometry=e.centerAt(i),t.notifyGeometryChanged()):t.geometry=i,this._internalGeometryUpdate=!1}_onReshapeGeometryChanged(){const{outputGeometry:i}=this._reshapeOperation;this.graphic!=null&&i&&this._updateGeometryInternally(i.clone())}get canUndo(){return this._reshapeOperation.canUndo??!1}undo(){this.snappingManager!=null&&this.snappingManager.doneSnapping();const i=this._reshapeOperation.undo(),{outputGeometry:t}=this._reshapeOperation;i&&t&&this._updateGeometryInternally(t.clone())}get canRedo(){return this._reshapeOperation.canRedo??!1}redo(){this.snappingManager!=null&&this.snappingManager.doneSnapping();const i=this._reshapeOperation.redo(),{outputGeometry:t}=this._reshapeOperation;i&&t&&this._updateGeometryInternally(t.clone())}onInputEvent(i){i.type!=="key-down"||i.key!=="Delete"&&i.key!=="Backspace"||this._reshapeOperation.removeSelectedVertices()}reset(){}get test(){return{snappingManager:this.snappingManager,reshapeOperation:this._reshapeOperation}}};h([u()],X.prototype,"_reshapeOperation",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"view",void 0),h([u({constructOnly:!0})],X.prototype,"graphic",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"enableZShape",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"enableZVertex",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"enableMoveGraphic",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"enableMidpoints",void 0),h([u({constructOnly:!0,nonNullable:!0})],X.prototype,"enableEdgeOffset",void 0),h([u()],X.prototype,"type",void 0),h([u({constructOnly:!0,type:ba})],X.prototype,"labelOptions",void 0),h([u({constructOnly:!0,type:Rt})],X.prototype,"tooltipOptions",void 0),h([u({constructOnly:!0})],X.prototype,"snappingManager",void 0),h([u()],X.prototype,"updating",null),h([u()],X.prototype,"automaticManipulatorSelection",void 0),X=h([k("esri.views.3d.interactive.editingTools.graphicReshape3D.GraphicReshapeTool")],X);let _t=class extends Ye{constructor(t){super(t),this.type="transform-rotate",this.rotation=null,this.rotationPrecision=null,this.orientation=null,this.orientationPrecision=null,this.rotationType="geographic"}};h([u()],_t.prototype,"type",void 0),h([u()],_t.prototype,"rotation",void 0),h([u()],_t.prototype,"rotationPrecision",void 0),h([u()],_t.prototype,"orientation",void 0),h([u()],_t.prototype,"orientationPrecision",void 0),h([u()],_t.prototype,"rotationType",void 0),_t=h([k("esri.views.interactive.tooltip.TransformRotateTooltipInfo")],_t);let Et=class extends Ye{constructor(i){super(i),this.type="transform-scale",this.size=null,this.sizeUnit=null,this.sizePrecision=null}};h([u()],Et.prototype,"type",void 0),h([u()],Et.prototype,"scale",void 0),h([u()],Et.prototype,"size",void 0),h([u()],Et.prototype,"sizeUnit",void 0),h([u()],Et.prototype,"sizePrecision",void 0),Et=h([k("esri.views.interactive.tooltip.TransformScaleTooltipInfo")],Et);let ht=class extends Ye{constructor(t){super(t),this.type="transform-absolute",this.orientation=null,this.orientationPrecision=null,this.rotationType="geographic",this.size=null,this.sizePrecision=null,this.sizeUnit=null}};h([u()],ht.prototype,"type",void 0),h([u()],ht.prototype,"orientation",void 0),h([u()],ht.prototype,"orientationPrecision",void 0),h([u()],ht.prototype,"rotationType",void 0),h([u()],ht.prototype,"size",void 0),h([u()],ht.prototype,"sizePrecision",void 0),h([u()],ht.prototype,"sizeUnit",void 0),ht=h([k("esri.views.interactive.tooltip.TransformAbsoluteTooltipInfo")],ht);var T;(function(i){i.ScaleIn=yt.Custom2,i.ScaleOut=yt.Custom3,i.RotateLeft=yt.Custom4,i.RotateRight=yt.Custom5,i.Unlocked=yt.Custom7,i.DelayedFocused=yt.Custom8,i.TouchInput=yt.Custom12})(T||(T={}));let mt=class extends Yt{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(i){this._ringManipulator.location=i}set elevationAlignedLocation(i){this._ringManipulator.elevationAlignedLocation=i}get grabbing(){return this._ringManipulator.grabbing}set interactive(i){this._ringManipulator.interactive=i}get updating(){return!!this._activeAnimation}constructor(i){super(i),this.mode=null,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=_s,this._absoluteTooltipInfo=null,this._scaleTooltipInfo=null,this._rotateTooltipInfo=null,this.events=new $t,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>{var t;return((t=this._scaleRotateDragData)==null?void 0:t.mode)==="scale"?this.adapter.scale:1}}initialize(){this._tooltip=new ve({view:this.tool.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([Xt(()=>!this.tooltipOptions.enabled,()=>this._tooltip.clear(),$),y(()=>{const{adapter:i}=this,{info:t}=this._tooltip;return t===this._absoluteTooltipInfo&&this.getFocused()?[t,i.size,i.orientationClockwise]:[null]},([i])=>{i&&this._updateFocusTooltip()})])}destroy(){var i;(i=this._activeAnimation)==null||i.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this._tooltip=R(this._tooltip)}startAnimation(i){this.cancelActiveAnimation(),i.start();const t=In({update:({deltaTime:e})=>{i.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...i,frameTask:t}}cancelActiveAnimation(){var i;(i=this._activeAnimation)==null||i.frameTask.remove(),this._activeAnimation=R(this._activeAnimation)}forEachManipulator(i){i(this._ringManipulator,G.SCALE_ROTATE)}_createManipulator(){const i=this._createRingManipulator();this._ringManipulator=i,this.tool.manipulators.add(i);const t=this.tool.graphicState.graphic,e=lt(i,(n,a,o)=>{this._scaleRotateDragData=null;const s=this.adapter.startInteraction(),r={mode:"none",origin:le(n.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=r,this._updateDragState();const l=w.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(n.renderLocation,l),a.next(fi(this.tool.view,ya(n.renderLocation,l,_i()))).next(p=>{const c=me(p.plane),d=Oa(p.renderStart,p.renderEnd,r.origin,c),g=Rn.shortestSignedDiff(r.angle,d);r.angleDir=ni(r.angleDir+g,-Ki,Ki),r.angle=d;const _=Ds(r,p),m=_-this.adapter.scale;if(r.scaleDir=ni(r.scaleDir+m,-Wi,Wi),this._onScaleChanged(),r.mode==="none"){const v=this.mode||Is(p,p.plane,r.origin,this.tool.view.state.camera);if(v!=null){switch(v){case"rotate":this.tool.emit("graphic-rotate-start",{graphic:t,angle:0}),this.tool.emit("record-undo",{record:this.adapter.createUndoRecord()});break;case"scale":this.tool.emit("graphic-scale-start",{graphic:t,xScale:1,yScale:1}),this.tool.emit("record-undo",{record:this.adapter.createUndoRecord()})}r.mode=v}}switch(r.mode){case"rotate":s.state.angle=r.initialAngle+d;break;case"scale":s.state.scale=_,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),p.action){case"start":case"update":switch(r.mode){case"rotate":this.tool.emit("graphic-rotate",{graphic:t,angle:ue(r.angle)});break;case"scale":this.tool.emit("graphic-scale",{graphic:t,xScale:_,yScale:_})}break;case"end":switch(r.mode){case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:t,angle:ue(r.angle)});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:t,xScale:_,yScale:_})}}return p.action==="end"&&(this.startAnimation(oa(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState(),s.done()),p}).next(this._updateTooltipPipelineStep(r)),o.next(()=>{if(s.cancel(),this._scaleRotateDragData!=null){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.emit("graphic-rotate-stop",{graphic:t,angle:0});break;case"scale":this.tool.emit("graphic-scale-stop",{graphic:t,xScale:1,yScale:1})}this.startAnimation(oa(this,()=>this._onScaleChanged())),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()})});this.addHandles([e,i.events.on("focus-changed",n=>{n.action==="focus"?this.startAnimation($s(this,()=>this._updateDelayedFocusedState(),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()}),i.events.on("immediate-click",n=>{n.stopPropagation()}),y(()=>{var n;return(n=this.tool.graphicState)==null?void 0:n.displaying},n=>this._ringManipulator.available=n,$)])}_updateTooltipPipelineStep(i){return t=>{const e=this.tooltipOptions;if(!e.enabled)return t;if(t.action==="end")return this._updateFocusTooltip(),t;const n=this._tooltip,a=this.tooltipOptions.visualVariables;switch(i.mode){case"scale":{n.info=this._scaleTooltipInfo??(this._scaleTooltipInfo=new Et({tooltipOptions:e}));const{size:o,scale:s}=this.adapter,r=a==null?void 0:a.size,l=n.info;l.tooltipOptions=e,l.scale={value:s},l.size=o!=null?ce(o,"meters"):void 0,l.sizePrecision=xe(r==null?void 0:r.valueType),l.sizeUnit=r==null?void 0:r.unit;break}case"rotate":{n.info=this._rotateTooltipInfo??(this._rotateTooltipInfo=new _t({tooltipOptions:e}));const{orientationClockwise:o,relativeAngleClockwise:s}=this.adapter,r=a==null?void 0:a.rotation,l=xe(r==null?void 0:r.valueType),p=n.info;p.tooltipOptions=e,p.rotation=s!=null?Je(s,"radians","geographic"):void 0,p.rotationPrecision=l,p.rotationType=(r==null?void 0:r.rotationType)??"geographic",p.orientation=o!=null?Je(o,"radians","geographic"):void 0,p.orientationPrecision=l;break}}return t}}_updateFocusTooltip(){const{tooltipOptions:i,_tooltip:t}=this;if(i.enabled)if(this.getFocused()){const e=i.visualVariables,n=e==null?void 0:e.rotation,a=e==null?void 0:e.size,o=this.mode,{size:s,orientationClockwise:r}=this.adapter,l=r!=null&&(o==null||o==="rotate"),p=s!=null&&(o==null||o==="scale");t.info=this._absoluteTooltipInfo??(this._absoluteTooltipInfo=new ht({tooltipOptions:i}));const c=t.info;c.tooltipOptions=i,c.orientation=l?Je(r,"radians","geographic"):void 0,c.orientationPrecision=xe(n==null?void 0:n.valueType),c.rotationType=(n==null?void 0:n.rotationType)??"geographic",c.size=p?ce(s,"meters"):void 0,c.sizeUnit=a==null?void 0:a.unit,c.sizePrecision=xe(a==null?void 0:a.valueType)}else t.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(T.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){var i;if(this._ringManipulator.updateStateEnabled(T.Unlocked,!(this._scaleRotateDragData!=null&&((i=this._scaleRotateDragData)==null?void 0:i.mode)!=="none")),this._scaleRotateDragData!=null)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(T.ScaleIn|T.ScaleOut,!1),this._ringManipulator.updateStateEnabled(T.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(T.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(T.RotateLeft|T.RotateRight,!1),this._ringManipulator.updateStateEnabled(T.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(T.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(T.ScaleIn|T.ScaleOut|T.RotateLeft|T.RotateRight,!1)}_updateManipulatorTransform(){const i=_a(B.get(),this.adapter.angle,j(0,0,1));if(i==null)return;const t=this.getScale(),e=Ge(B.get(),rt(w.get(),t,t,t));this._ringManipulator.modelTransform=Ee(B.get(),e,i)}_createRingManipulator(){const i=(A,q,tt)=>{const wt=[],xt=Math.ceil(Ra*(q-A)/(2*Math.PI));for(let U=0;Ui(0,2*Math.PI,A),e=A=>[[-A/2,0],[A/2,0],[A/2,Qe/2],[-A/2,Qe/2]],n=this._createMaterial(1),a=(A,q,tt=n)=>Cn(tt,e(q),A,[],[],!1),o=t(zt),s=a(o,ti),r={left:new Array,right:new Array},l=[];for(let A=0;A<2;A++){const q=A*Math.PI-Math.PI/4,tt=Math.PI/2-ds,wt=q+tt,xt=q+Math.PI/2-tt,U=i(wt,xt,hs),ae=a(U,qt);l.push(U),l.push(i(wt,xt,Zi-ti/2)),r.left.push(ae),r.right.push(ae.instantiate());for(let Ke=0;Ke<2;Ke++){const xi=Ke===0,W=Xe();if(xi){va(W,W,[1,-1,1]),$i(W,W,-wt,[0,0,1]);const Ct=Math.round(Bi*(U.length-1));W[12]=U[Ct][0],W[13]=U[Ct][1],W[14]=U[Ct][2]}else{$i(W,W,xt,[0,0,1]);const Ct=Math.round((1-Bi)*(U.length-1));W[12]=U[Ct][0],W[13]=U[Ct][1],W[14]=U[Ct][2]}const Ei=Ae(n,cs,0,us,Qe);ga(Ei,W),(xi?r.left:r.right).push(Ei)}}const p=[];for(let A=0;A<2;A++){const q=A*Math.PI-Math.PI/4,tt=Math.PI/2-gs,wt=q+tt,xt=q+Math.PI/2-tt,U=i(wt,xt,Zi);p.push(a(U,qt))}const c=this._createMaterial(.66),d=this._createMaterial(.5),g=this._createMaterial(.33),_=t(zt+ji),m=t(zt+qi),v=a(_,qt,c),M=a(m,qt,g),b=t(zt-ji),f=t(zt-qi),O=a(b,qt,c),D=a(f,qt,g);let V=[new x(s,T.DelayedFocused),new x(s.instantiate({material:d}),E.None)];this.mode&&this.mode!=="scale"||(V=V.concat([...p.map(A=>new x(A,T.DelayedFocused|T.Unlocked)),new x(v,T.DelayedFocused|T.ScaleIn),new x(M,T.DelayedFocused|T.ScaleIn),new x(O,T.DelayedFocused|T.ScaleOut),new x(D,T.DelayedFocused|T.ScaleOut)])),this.mode&&this.mode!=="rotate"||(V=V.concat([...r.right.map(A=>new x(A.instantiate(),T.DelayedFocused|T.Unlocked)),...r.left.map(A=>new x(A,T.DelayedFocused|T.RotateLeft)),...r.right.map(A=>new x(A,T.DelayedFocused|T.RotateRight))]));const N=[o,...l];return new et({view:this.tool.view,renderObjects:V,autoScaleRenderObjects:!1,worldOriented:!0,radius:ti,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:z(this.tool.graphicState.graphic),collisionType:{type:"ribbon",paths:N,direction:j(0,0,1)}})}_createMaterial(i){const t=new ui({cullFace:di.Back,renderOccluded:Dt.Transparent,isDecoration:!0});return this.addHandles(y(()=>({color:$n(this.tool.view.effectiveTheme.accentColor,i)}),e=>t.setParameters(e),$)),t}get test(){return{ringManipulator:this._ringManipulator,setRingIndicatorDelayMs:i=>this._ringIndicatorDelayMs=i,tooltip:this._tooltip}}};function Ds(i,t){const e=L(w.get(),t.renderStart,i.origin),n=L(w.get(),t.renderEnd,i.origin),a=te(e),o=te(n);return a===0?0:o/a}function Is(i,t,e,n){const{renderStart:a,renderEnd:o}=i,s=we(a,n,w.get()),r=we(o,n,w.get());if(Ln(s,r)n;return{start:()=>{n=i.getScale(),e=i.getScale,i.getScale=a,t()},update:o=>(n+=((n+1)/2-n)*Math.min(o*ms,1),t(),Math.abs(n-1)<.01?ee.STOP:ee.CONTINUE),destroy:()=>{e&&(i.getScale=e),t()}}}function $s(i,t,e){let n=0,a=null;const o=()=>!1;return{start:()=>{a=i.getFocused,i.getFocused=o,n=0,t()},update:s=>(n+=s,!(a!=null&&a())||n>=e.delayMs?ee.STOP:ee.CONTINUE),destroy:()=>{a&&(i.getFocused=a),t()}}}function xe(i){switch(i){case"integer":case"long":return 0;default:return null}}h([u({constructOnly:!0})],mt.prototype,"tool",void 0),h([u({constructOnly:!0})],mt.prototype,"adapter",void 0),h([u({constructOnly:!0})],mt.prototype,"tooltipOptions",void 0),h([u()],mt.prototype,"mode",void 0),h([u()],mt.prototype,"_activeAnimation",void 0),h([u()],mt.prototype,"updating",null),mt=h([k("esri.views.3d.interactive.editingTools.transformGraphic.GraphicScaleRotateTransform")],mt),function(i){i[i.CONTINUE=0]="CONTINUE",i[i.STOP=1]="STOP"}(ee||(ee={}));const ii=Ve();function Pa(i){return i.geometry!=null&&i.geometry.type==="mesh"?Rs(i.geometry):Cs(i)}function Rs(i){return i.vertexSpace.isRelative?Ls(i,i.transform,i.vertexSpace):Ps(i)}function Cs(i){let t=i.geometry,e=null;return{undo(n){e=n.geometry,n.geometry=t},redo(n){t=n.geometry,n.geometry=e}}}function Ls(i,t,e){let n=t==null?void 0:t.clone(),a=le(e.origin),o=null,s=null;return{undo:r=>{var l;o=(l=i.transform)==null?void 0:l.clone(),s=le(e.origin),i.transform=n,i.vertexSpace.origin=a,r.notifyMeshTransformChanged()},redo:r=>{var l;n=(l=i.transform)==null?void 0:l.clone(),a=le(e.origin),i.transform=o,i.vertexSpace.origin=s,r.notifyMeshTransformChanged()}}}function Ps(i){let t,e=i.vertexAttributes.clonePositional();return{undo:n=>{t=i.vertexAttributes.clonePositional(),i.vertexAttributes=e,n.notifyGeometryChanged()},redo:n=>{e=i.vertexAttributes.clonePositional(),i.vertexAttributes=t,n.notifyGeometryChanged()}}}let Q=class extends Yt{constructor(i){super(i),this._interactionState=null}initialize(){this.addHandles([Xt(()=>{const i=this._interactionState;return i&&i.angle!==i.previousAngle?{interactionState:i,angle:i.state.angle}:null},({interactionState:i})=>{this._updateMeshRotation(i)},$e),Xt(()=>{const i=this._interactionState;return i&&i.scale!==i.previousScale?{interactionState:i,scale:i.state.scale}:null},({interactionState:i})=>{this._updateMeshSize(i)},$e)])}get initialAngle(){var i;return((i=this._interactionState)==null?void 0:i.initialAngle)??0}get angle(){var e;const i=this.geometry.transform;if(i==null)return((e=this._interactionState)==null?void 0:e.angle)??0;const t=zn(i.rotation)[2];return Math.abs(t)>.999999?ke(Hn(i.rotation))*Math.sign(t):0}get angleClockwise(){return-this.angle}get relativeAngle(){return this.angle-this.initialAngle}get relativeAngleClockwise(){return-this.relativeAngle}get scale(){var i;return((i=this._interactionState)==null?void 0:i.scale)??1}startInteraction(){const i=new vt({angle:this.angle});this._interactionState=i;const t=()=>{this._interactionState=null};return{state:i,done:t,cancel:()=>{i.cancel(),t()}}}createUndoRecord(){return Pa(this.graphic)}_updateMeshRotation(i){const{angle:t,previousAngle:e}=i;i.previousAngle=t;const{geometry:n}=this,{vertexSpace:a}=n,o=ue(t-e);if(a.isGeoreferenced){const s=!a.isRelative&&this.viewingMode===oi.Global,r=this.geometry.anchor;this.geometry.rotate(0,0,o,{origin:r,geographic:s}),this.graphic.notifyGeometryChanged()}else{n.transform??(n.transform=new Li);const{transform:s}=n,r=Vn(0,0,o,zs);s.rotation=kn(s.rotation,r,s.rotation),this.graphic.notifyMeshTransformChanged()}}_updateMeshSize(i){const{scale:t,previousScale:e}=i;i.previousScale=t;const{geometry:n}=this,{vertexSpace:a}=n,o=t/e;if(a.isGeoreferenced){const s=!a.isRelative&&this.viewingMode===oi.Global,r=this.geometry.anchor;this.geometry.scale(o,{origin:r,geographic:s}),this.graphic.notifyGeometryChanged()}else{n.transform??(n.transform=new Li);const{transform:s}=n;s.scale=Vt(s.scale,s.scale,o),this.graphic.notifyMeshTransformChanged()}}};h([u({constructOnly:!0})],Q.prototype,"graphic",void 0),h([u({constructOnly:!0})],Q.prototype,"geometry",void 0),h([u({constructOnly:!0})],Q.prototype,"viewingMode",void 0),h([u()],Q.prototype,"initialAngle",null),h([u()],Q.prototype,"angle",null),h([u()],Q.prototype,"angleClockwise",null),h([u()],Q.prototype,"relativeAngle",null),h([u()],Q.prototype,"relativeAngleClockwise",null),h([u()],Q.prototype,"scale",null),h([u()],Q.prototype,"_interactionState",void 0),Q=h([k("esri.views.3d.interactive.editingTools.transformGraphic.ScaleRotateMeshAdapter")],Q);let vt=class extends Yt{get state(){const{angle:i,scale:t}=this;return{angle:i,scale:t}}constructor(i){super(i),this.angle=0,this.initialAngle=0,this.previousAngle=0,this.previousScale=1,this.scale=1,this.initialAngle=i.angle,this.previousAngle=i.angle}cancel(){this.angle=this.initialAngle,this.scale=1}};h([u()],vt.prototype,"angle",void 0),h([u()],vt.prototype,"initialAngle",void 0),h([u()],vt.prototype,"previousAngle",void 0),h([u()],vt.prototype,"previousScale",void 0),h([u()],vt.prototype,"scale",void 0),h([u()],vt.prototype,"state",null),vt=h([k("InteractionState")],vt);const zs=Pn();let P=class extends Yt{constructor(i){super(i),this.sizeAxis=null,this._interactionState=null}initialize(){this.addHandles(Xt(()=>this._interactionState!=null?this._interactionState.state:null,i=>{this._updateSymbol(i)},$e))}get initialAngle(){var i;return((i=this._interactionState)==null?void 0:i.initialAngle)??0}get angle(){return this._interactionState!=null?this._interactionState.angle:this._orientationReferenceSymbolLayer!=null?Hs(this._orientationReferenceSymbolLayer.heading??0):0}get angleClockwise(){return-this.angle}get orientation(){return this.angle}get orientationClockwise(){return this.angleClockwise}get relativeAngle(){return this.angle-this.initialAngle}get relativeAngleClockwise(){return-this.relativeAngle}get scale(){var i;return((i=this._interactionState)==null?void 0:i.scale)??1}get size(){const i=this._sizeReferenceSymbolLayer;if(i==null)return null;const t=this.findLayerView(),e=this._graphicSymbol;if(t==null||e==null||e.type!=="point-3d")return null;const n=t.getSymbolLayerSize(e,i);if("size"in n&&n.size!=null)return n.size;const a=this.sizeAxis;return!("width"in n)||n.width==null||a!=null&&a!=="width"&&a!=="all"&&a!=="width-and-depth"?!("depth"in n)||i.depth==null||a!=null&&a!=="depth"&&a!=="all"&&a!=="width-and-depth"?!("height"in n)||i.height==null||a!=null&&a!=="height"&&a!=="all"?null:n.height:n.depth:n.width}get _sizeReferenceSymbolLayer(){const i=this._graphicSymbol;return i==null||i.symbolLayers.length===0?null:i.symbolLayers.find(t=>t.type==="object")}get _orientationReferenceSymbolLayer(){const i=this._graphicSymbol;return i==null||i.symbolLayers.length===0?null:i.symbolLayers.find(t=>t.type==="object"&&t.heading!=null)}get _graphicSymbol(){var i;return((i=this.graphic)==null?void 0:i.symbol)!=null&&this.graphic.symbol.type==="point-3d"?this.graphic.symbol:null}set _graphicSymbol(i){this.graphic.symbol=i}startInteraction(){const i=this._graphicSymbol,t=this.findLayerView();if(this._interactionState!=null||i==null||t==null)return Vs;const e=i.symbolLayers.map(r=>r.type==="object"?t.getSymbolLayerSize(i,r):null).toArray(),n=i.clone(),a=this.angle,o=new ft({originalSymbol:n,angle:a,initialSizes:e});this._interactionState=o;const s=()=>{this._interactionState=null};return{state:o,done:s,cancel:()=>{this._graphicSymbol=n,s()}}}createUndoRecord(){let i=this.graphic.symbol,t=null;return{undo:e=>{t=e.symbol,e.symbol=i},redo:e=>{i=e.symbol,e.symbol=t}}}_updateSymbol({scale:i,angle:t,originalSymbol:e,initialSizes:n}){const a=this._graphicSymbol;if(a==null||a.type!=="point-3d")return;const o=a.clone(),s=-ue(t-this.initialAngle);let r=!1;this._forEachObjectSymbolLayerPair(e,o,(l,p,c)=>{const d=(l.heading??0)+s;p.heading!==d&&(p.heading=d,r=!0);const g=n[c];if(g!=null&&"width"in g){g.width=this.sizeFilter(g.width),g.height=this.sizeFilter(g.height),g.depth=this.sizeFilter(g.depth);const _=g.width*i;p.width!==_&&(p.width=_,r=!0);const m=g.depth*i;p.depth!==m&&(p.depth=m,r=!0);const v=g.height*i;p.height!==v&&(p.height=v,r=!0)}}),r&&(this._graphicSymbol=o)}_forEachObjectSymbolLayerPair(i,t,e){i.symbolLayers.forEach((n,a)=>{const o=t.symbolLayers.at(a);n.type==="object"&&o.type==="object"&&e(n,o,a)})}};function Hs(i){return-ke(i)}h([u()],P.prototype,"initialAngle",null),h([u()],P.prototype,"angle",null),h([u()],P.prototype,"angleClockwise",null),h([u()],P.prototype,"orientation",null),h([u()],P.prototype,"orientationClockwise",null),h([u()],P.prototype,"relativeAngle",null),h([u()],P.prototype,"relativeAngleClockwise",null),h([u()],P.prototype,"scale",null),h([u()],P.prototype,"size",null),h([u()],P.prototype,"sizeAxis",void 0),h([u({constructOnly:!0})],P.prototype,"graphic",void 0),h([u()],P.prototype,"_interactionState",void 0),h([u({constructOnly:!0})],P.prototype,"findLayerView",void 0),h([u({constructOnly:!0})],P.prototype,"sizeFilter",void 0),h([u()],P.prototype,"_sizeReferenceSymbolLayer",null),h([u()],P.prototype,"_orientationReferenceSymbolLayer",null),h([u()],P.prototype,"_graphicSymbol",null),P=h([k("esri.views.3d.interactive.editingTools.transformGraphic.ScaleRotateObjectSymbol3DAdapter")],P);const Vs={state:{angle:0,scale:0},done:()=>{},cancel:()=>{}};let ft=class extends Yt{get state(){const{originalSymbol:i,angle:t,initialAngle:e,scale:n,initialSizes:a}=this;return{originalSymbol:i,angle:t,initialAngle:e,scale:n,initialSizes:a}}constructor(i){super(i),this.angle=0,this.initialAngle=0,this.scale=1,this.initialAngle=i.angle}};h([u()],ft.prototype,"originalSymbol",void 0),h([u()],ft.prototype,"angle",void 0),h([u()],ft.prototype,"initialAngle",void 0),h([u()],ft.prototype,"initialSizes",void 0),h([u()],ft.prototype,"scale",void 0),h([u()],ft.prototype,"state",null),ft=h([k("InteractionState")],ft);let K=class extends $t.EventedMixin(Fe){constructor(i){super(i),this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.tooltipOptions=new Rt,this.type="transform-3d",this._updatingHandles=new gi,this._scaleRotate=null,this._tooltip=null,this._translateGraphicTooltipInfo=null,this._translateGraphicXYTooltipInfo=null,this._translateGraphicZTooltipInfo=null}initialize(){const{graphic:i,view:t}=this;this.graphicState=new Ft({graphic:i}),this.addHandles(y(()=>this.tooltipOptions.enabled,o=>{this._tooltip=o?new ve({view:t}):R(this._tooltip)},Qt)),this._moveManipulation=new Ut({tool:this,view:t,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&kt(i),radius:Ut.radiusForSymbol(i.symbol)}),this._moveManipulation.forEachManipulator(o=>this.addHandles(o.events.on("immediate-click",s=>{this.emit("immediate-click",{...s,graphic:i}),s.stopPropagation()})));const e=o=>s=>{this.addHandles(s.events.on("focus-changed",({action:r})=>{const l=this._tooltip;l!=null&&(r==="focus"?this._updateMoveTooltip(o):l.clear())}))};this._moveManipulation.xyManipulation.forEachManipulator(e(S.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(S.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(S.Z));const n=z(i);this._moveManipulation.elevationInfo=n,this.addHandles(Mi(this.graphicState));const{geometry:a}=i;if(this._moveManipulation.createGraphicDragPipeline((o,s,r,l,p)=>{if(a!=null&&o===S.XY){const{snappingStep:c,cancelSnapping:d}=Ce({snappingContext:new Re({elevationInfo:n,pointer:p,editGeometryOperations:Be.fromGeometry(new Un({spatialReference:a.spatialReference}),t.state.viewingMode),visualizer:new ge,excludeFeature:i}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});l=l.next(d),r=r.next(mo(this.view,n)).next(...c)}return{steps:r=r.next(c=>(this._updateMoveTooltip(o,c),c)),cancel:l}},this.graphicState,o=>{const{action:s,graphic:r,dxScreen:l,dyScreen:p}=o,c={graphic:r,dxScreen:l,dyScreen:p};switch(s){case"start":this.emit("graphic-translate-start",c),this.emit("record-undo",{record:this._createGeometryUndoRecord()});break;case"update":this.emit("graphic-translate",c);break;case"end":this.emit("graphic-translate-stop",c)}}),this._moveManipulation.angle=this._scaleRotate!=null?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(y(()=>this._scaleRotateAdapter.angle,()=>this._updateMoveAngle())),this.enableScaling||this.enableRotation){const o=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new mt({tool:this,mode:o,adapter:this._scaleRotateAdapter,tooltipOptions:this.tooltipOptions}),this.addHandles(this._scaleRotate.events.on("scale-changed",()=>this._onScaleChanged()))}this.addHandles([qe({view:this.view,graphic:this.graphic,forEachManipulator:o=>this._forEachManipulator(o),onManipulatorsChanged:()=>Z()}),this.graphicState.on("changed",()=>this._onGeometryChanged()),this._hideManipulatorsForGraphicState(),y(()=>t.scale,()=>this._updateMoveAngle())].filter(Xn)),this.addHandles(this.view.trackGraphicState(this.graphicState)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator(o=>{o instanceof et&&this.addHandles(o.events.on("grab-changed",()=>this._updateManipulatorsInteractive()))}),this.finishToolCreation()}destroy(){this._tooltip=R(this._tooltip),this._moveManipulation.destroy(),this._scaleRotate=R(this._scaleRotate),this._scaleRotateAdapter=R(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("graphic",null)}_updateManipulatorsInteractive(){this._scaleRotate!=null&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){var i,t,e;return this.graphic.geometry!=null&&this.graphic.geometry.type==="mesh"?new Q({graphic:this.graphic,geometry:this.graphic.geometry,viewingMode:this.view.state.viewingMode}):new P({graphic:this.graphic,sizeFilter:n=>this._enforceNonZeroSize(n),findLayerView:()=>this.view.allLayerViews.find(n=>n.layer===this.graphic.layer),sizeAxis:((e=(t=(i=this.tooltipOptions)==null?void 0:i.visualVariables)==null?void 0:t.size)==null?void 0:e.axis)??null})}_forEachManipulator(i){var t,e;(t=this._moveManipulation)==null||t.forEachManipulator(i),(e=this._scaleRotate)==null||e.forEachManipulator(i)}_hideManipulatorsForGraphicState(){return y(()=>this.graphicState.displaying,i=>{this._forEachManipulator(t=>t.available=i),this._moveManipulation.zManipulation.available=i&&this.enableZ&&kt(this.graphic)})}_createGeometryUndoRecord(){return Pa(this.graphic)}set snapToScene(i){this._moveManipulation&&(this._moveManipulation.snapToScene=i),this._set("snapToScene",i)}get updating(){var i;return this._updatingHandles.updating||!!((i=this._scaleRotate)!=null&&i.updating)}set location(i){this._moveManipulation.location=i,this._scaleRotate&&(this._scaleRotate.location=i)}set elevationAlignedLocation(i){this._moveManipulation.elevationAlignedLocation=i,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=i)}reset(){}onHide(){var i;(i=this._scaleRotate)==null||i.cancelActiveAnimation()}_onScaleChanged(){this._scaleRotate!=null&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){this.view.state.viewingMode===oi.Local||this.view.scalebt(o,s,a));break;case S.XY_AXIS:n.info=this._translateGraphicXYTooltipInfo??(this._translateGraphicXYTooltipInfo=new yi({tooltipOptions:e})),this._updateMoveTooltipDistance(n.info,t,(o,s)=>{const r=bt(o,s,a);return Ie(r,ze(t))});break;case S.Z:n.info=this._translateGraphicZTooltipInfo??(this._translateGraphicZTooltipInfo=new je({tooltipOptions:e})),this._updateMoveTooltipDistance(n.info,t,Le)}n.info.tooltipOptions=e}_updateMoveTooltipDistance(i,t,e){if(t!=null&&t.action!=="end"){const{mapStart:n,mapEnd:a}=t,o=e(n,a);i.distance=o??ct}else i.distance=ct}get test(){return{discManipulator:this._moveManipulation.xyManipulation.test.discManipulator,zManipulator:this._moveManipulation.zManipulation.test.manipulator,ringManipulator:this._scaleRotate!=null?this._scaleRotate.test.ringManipulator:null,arrowManipulators:this._moveManipulation.xyAxisManipulation.test.arrowManipulators,setRingIndicatorDelayMs:i=>this._scaleRotate!=null?this._scaleRotate.test.setRingIndicatorDelayMs(i):null,scaleRotateAdapter:this._scaleRotateAdapter,scaleRotateTransform:this._scaleRotate,tooltip:this._tooltip}}};h([u({constructOnly:!0,nonNullable:!0})],K.prototype,"view",void 0),h([u({constructOnly:!0,nonNullable:!0})],K.prototype,"graphic",void 0),h([u({constructOnly:!0,nonNullable:!0})],K.prototype,"enableZ",void 0),h([u()],K.prototype,"enableRotation",void 0),h([u()],K.prototype,"enableScaling",void 0),h([u({constructOnly:!0,type:Rt})],K.prototype,"tooltipOptions",void 0),h([u()],K.prototype,"graphicState",void 0),h([u({value:!1})],K.prototype,"snapToScene",null),h([u({constructOnly:!0})],K.prototype,"snappingManager",void 0),h([u({readOnly:!0})],K.prototype,"type",void 0),h([u({readOnly:!0})],K.prototype,"updating",null),K=h([k("esri.views.3d.interactive.editingTools.graphicTransform3D.GraphicTransformTool")],K);let ks=class{constructor(t,e,n,a){this._tool=t,this._graphicState=e,this._editGeometryOperations=n,this._bounds=a,this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null;const o=this._tool,s=o.view;this.moveXYGraphicManipulation=new wi({view:s,tool:o,graphicState:this._graphicState}),o.addHandles(this._createMoveXYGraphicDragPipeline()),this.moveZManipulator=new Eo(s,Oo.CENTER_ON_CALLOUT),this.moveZManipulator.state|=To,o.manipulators.add(this.moveZManipulator),o.addHandles([this._createMoveZDragPipeline()]),o.addHandles([o.on("graphic-translate-stop",()=>{this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null})])}destroy(){this.moveXYGraphicManipulation.destroy(),this._tool.manipulators.remove(this.moveZManipulator),this.moveZManipulator.destroy()}forEachManipulator(t){this.moveXYGraphicManipulation.forEachManipulator(t),t(this.moveZManipulator,G.TRANSLATE_Z)}updateManipulators(t,e){const n=this.moveZManipulator,a=Nn(B.get(),t,Math.PI);a[12]=0,a[13]=0,a[14]=0,n.modelTransform=a,n.renderLocation=L(w.get(),e.origin,e.basis1)}getUpdatedTooltipInfo(){return this.moveXYGraphicManipulation.grabbing||this.moveXYGraphicManipulation.dragging?this._computeMoveXYTooltipInfo():this.moveZManipulator.focused?this._computeMoveZTooltipInfo():null}_computeMoveXYTooltipInfo(){const t=this._tool.tooltipOptions;return this._moveXYTooltipInfo??(this._moveXYTooltipInfo=new _e({tooltipOptions:t}))}_computeMoveZTooltipInfo(){const t=this._tool,e=t.tooltipOptions,n=this._moveZTooltipInfo??(this._moveZTooltipInfo=new je({tooltipOptions:e}));if(this.moveZManipulator.dragging){const a=this._bounds,o=a.mapBoundsStart.origin,s=a.mapBounds.origin,r=wo(o,s,this._tool.view.spatialReference);if(r==null)return null;n.distance=r}else n.distance=ce(0,t.moveUnit);return n}_updateMoveTooltip(t,e){if(e===S.XY||e===S.XY_AXIS){const n=bt(t.mapStart,t.mapEnd,this._graphicState.isDraped?"on-the-ground":"absolute-height");n!=null&&this._moveXYTooltipInfo!=null&&(this._moveXYTooltipInfo.distance=n)}return t}_createMoveXYGraphicDragPipeline(){return this.moveXYGraphicManipulation.createDragPipeline((t,e,n)=>this._applyGraphicMoveSteps(e,n,S.XY))}_createMoveZDragPipeline(){const t=this._editGeometryOperations.data.spatialReference;return lt(this.moveZManipulator,(e,n,a)=>{const o=le(e.renderLocation),s=n.next(Ta(this._tool.view,o,t)).next(ie());this._applyGraphicMoveSteps(s,a,S.Z)})}_applyGraphicMoveSteps(t,e,n){const a=this._tool,o=a.graphic,s=t.next(r=>(r.action==="start"&&(a.inputState={type:"move"},this._bounds.backupMapBounds(),a.emit("graphic-translate-start",{graphic:o,dxScreen:r.screenDeltaX,dyScreen:r.screenDeltaY})),r)).next(Kt()).next(this._moveDragUpdateGeometry()).next(r=>{const l={graphic:o,dxScreen:r.screenDeltaX,dyScreen:r.screenDeltaY};switch(r.action){case"start":case"update":(r.mapEnd.x-r.mapStart.x||r.mapEnd.y-r.mapStart.y||(r.mapEnd.z??0)-(r.mapStart.z??0))&&a.emit("graphic-translate",l);break;case"end":a.inputState=null,a.emit("graphic-translate-stop",l)}return r}).next(r=>this._updateMoveTooltip(r,n));return e.next(()=>{a.inputState!=null&&a.emit("graphic-translate-stop",{graphic:o,dxScreen:0,dyScreen:0}),a.cancel()}),s}_moveDragUpdateGeometry(){const t=this._tool;return e=>{if(t.inputState==null||t.inputState.type!=="move")return e;const n=[];for(const s of this._editGeometryOperations.data.components)n.push(...s.vertices);const a=e.action==="start"?St.NEW_STEP:St.ACCUMULATE_STEPS,o=this._editGeometryOperations.moveVertices(n,e.mapDeltaX,e.mapDeltaY,e.mapDeltaZ,a);return Ze(o,this._bounds.mapBounds),t.graphic.geometry=this._editGeometryOperations.data.geometry,e}}};class Us{constructor(t,e,n){var r;this._tool=t,this._editGeometryOperations=e,this._bounds=n,this._rotateTooltipInfo=null,this._startAngle=0,this._endAngle=0;const a=this._tool,o=a.view,s=!((r=o._stage)!=null&&r.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result);this.rotateManipulator=new Ao(o,(l,p)=>Po(o.textures,{accentColor:l,contrastColor:p,preMultiplyAlpha:s})),a.addHandles([this.rotateManipulator.events.on("grab-changed",l=>this._onRotateGrab(l)),this._createRotateDragPipeline(this.rotateManipulator)]),a.manipulators.add(this.rotateManipulator),a.addHandles([a.on("graphic-rotate-start",l=>{this._startAngle=l.angle}),a.on("graphic-rotate",l=>{this._endAngle=l.angle}),a.on("graphic-rotate-stop",()=>{this._startAngle=0,this._endAngle=0})])}destroy(){this._tool.manipulators.remove(this.rotateManipulator),this.rotateManipulator.destroy()}forEachManipulator(t){t(this.rotateManipulator,G.ROTATE)}updateManipulators(t,e){const n=this._bounds.mapBounds.plane[2]<0?Math.PI:0,a=ma(B.get(),t,n);a[12]=0,a[13]=0,a[14]=0,this.rotateManipulator.modelTransform=a,this.rotateManipulator.renderLocation=At(w.get(),e.origin,e.basis1)}getUpdatedTooltipInfo(){return this.rotateManipulator.focused?this._computeRotateTooltipInfo():null}_computeRotateTooltipInfo(){const t=this._tool.tooltipOptions,e=this._rotateTooltipInfo??(this._rotateTooltipInfo=new zo({tooltipOptions:t}));return e.angle=this._startAngle-this._endAngle,e}_onRotateGrab({action:t,screenPoint:e}){const n=this._tool,a=this._bounds;if(t!=="start"||!e)return;const o=Go(a.displayBounds,n.view.renderCoordsHelper,Do.HEADING,_i()),s=Sa(n.view.state.camera,e);wa(o,s,w.get())&&(a.backupMapBounds(),n.inputState={type:"rotate",rotatePlane:o})}_createRotateDragPipeline(t){const e=this._tool,n=e.graphic;return lt(t,(a,o,s)=>{const r=e.inputState;r!=null&&(o.next(l=>(l.action==="start"&&e.emit("graphic-rotate-start",{graphic:n,angle:0}),l)).next(fi(e.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdateGeometry()).next(l=>{const p={graphic:n,angle:ue(l.rotateAngle)};switch(l.action){case"start":case"update":e.emit("graphic-rotate",p);break;case"end":e.inputState=null,e.emit("graphic-rotate-stop",p)}return l}),s.next(()=>{e.inputState!=null&&e.emit("graphic-rotate-stop",{graphic:n,angle:0}),e.cancel()}))})}_rotateDragRenderPlaneToRotate(t){return e=>{const n=me(t.rotatePlane),a=Oa(e.renderStart,e.renderEnd,this._bounds.displayBounds.origin,n);return{...e,rotateAxis:n,rotateAngle:a}}}_rotateDragUpdateGeometry(){const t=this._tool,e=this._bounds;return n=>{const a=si(H(),e.mapBoundsStart.origin),o=[];for(const l of this._editGeometryOperations.data.components)o.push(...l.vertices);const s=n.action==="start"?St.NEW_STEP:St.ACCUMULATE_STEPS,r=this._editGeometryOperations.rotateVertices(o,a,n.rotateAngle,s,Ga.REPLACE);return de(e.mapBoundsStart,e.mapBounds),Ze(r,e.mapBounds),t.graphic.geometry=this._editGeometryOperations.data.geometry,n}}}class Xs{constructor(t,e,n){this._tool=t,this._onDisplayBoundsChanged=e,this.mapBounds=pe(),this.mapBoundsStart=pe(),this.displayBounds=pe(),this._calculateMapBounds(n)}get displayBoundsMargin(){var a,o,s;const{view:t,graphic:e}=this._tool,n=((a=t.pointsOfInterest)==null?void 0:a.centerOnSurfaceFrequent.location)??((s=(o=e.geometry)==null?void 0:o.extent)==null?void 0:s.center);return n?Ns*t.pixelSizeAt(n):0}backupMapBounds(){de(this.mapBounds,this.mapBoundsStart)}updateDisplayBounds(){this._calculateDisplayBounds(),this._onDisplayBoundsChanged()}_calculateMapBounds(t){const{view:e,attachmentOrigin:n}=this._tool,a=t.geometry,o=jo(a);ha(o,o,-1);const s=e.spatialReference,r=a.spatialReference,l=n?e.pixelSizeAt(n)*Yn(s)/Oe(r):0;eo(o,t,Ys*l,this.mapBounds)}_calculateDisplayBounds(){const{view:t,attachmentOrigin:e,graphic:n}=this._tool;if(!n.geometry)return;const a=(e==null?void 0:e.z)??pi(this.mapBounds.origin,t.elevationProvider,hi.fromElevationInfo(z(n)),t.renderCoordsHelper),o=de(this.mapBounds);o.origin[2]=a??0,Zs(o,t.renderCoordsHelper,n.geometry.spatialReference,this.displayBoundsMargin,this.displayBounds)}}const Ns=10,Ys=80;function Zs(i,t,e,n=0,a){a||(a=pe()),t.toRenderCoords(i.origin,e,a.origin);const o=w.get();At(o,i.origin,i.basis1),At(o,o,i.basis2),t.toRenderCoords(o,e,o);const s=w.get();At(s,i.origin,i.basis1),L(s,s,i.basis2),t.toRenderCoords(s,e,s);const r=w.get();L(r,i.origin,i.basis1),L(r,r,i.basis2),t.toRenderCoords(r,e,r);const l=w.get();L(l,i.origin,i.basis1),At(l,l,i.basis2),t.toRenderCoords(l,e,l);const p=Pt(w.get(),o,s,.5);L(p,p,a.origin);const c=Pt(w.get(),r,l,.5);L(c,a.origin,c),Pt(a.basis1,p,c,.5);const d=Pt(w.get(),l,o,.5);L(d,d,a.origin);const g=Pt(w.get(),s,r,.5);L(g,a.origin,g),Pt(a.basis2,d,g,.5);const _=It(w.get(),a.basis1,a.basis2),m=It(_,_,a.basis1);return ai(m,m),Vt(a.basis2,m,De(a.basis2,m)),Vt(a.basis1,a.basis1,1+n/te(a.basis1)),Vt(a.basis2,a.basis2,1+n/te(a.basis2)),Zn(a),a}function sa(i,t,e,n){const a=w.get();L(a,L(a,i.origin,i.basis1),i.basis2);const o=w.get();Ht(o,a,i.basis1,2);const s=w.get();Ht(s,o,i.basis2,2);const r=w.get();Ht(r,a,i.basis2,2),a[2]=o[2]=s[2]=r[2]=t;const l=n?"on-the-ground":"absolute-height",p=Pi(Me(a,o,e,l),Me(r,s,e,l)),c=Pi(Me(o,s,e,l),Me(a,r,e,l));return c==null||p==null?null:[p,c]}class Fs{get zMax(){if(!this._zMaxDirty)return this._zMax;const t=this._editGeometryOperations.data;if(t.geometry.hasZ){const e=t.coordinateHelper;this._zMax=Number.NEGATIVE_INFINITY;for(const n of t.components)for(const a of n.vertices){const o=e.getZ(a.pos)??0;this._zMax=Math.max(o,this._zMax)}}else this._zMax=0;return this._zMaxDirty=!1,this._zMax}constructor(t,e,n,a,o){this._tool=t,this._graphicState=e,this._editGeometryOperations=n,this._bounds=a,this._preserveAspectRatioStep=o,this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._scaleTooltipInfo=null,this._displayBoundsStart=pe(),this._displayBoundsMarginStart=0,this._startScale=re(),this._endScale=re(),this._sizeStart=null,this._zMax=0,this._zMaxDirty=!0;const s=this._tool,r=s.view;this.resizeManipulators=this._resizeHandles.map(l=>{const p=new Io(r,l);return s.addHandles([p.events.on("grab-changed",c=>this._onResizeGrab(c)),this._createResizeDragPipeline(p,l)]),p}),s.manipulators.addMany(this.resizeManipulators),s.addHandles([s.on("graphic-scale-start",l=>{Ot(this._startScale,l.xScale,l.yScale),Ot(this._endScale,l.xScale,l.yScale)}),s.on("graphic-scale",l=>{Ot(this._endScale,l.xScale,l.yScale)}),s.on("graphic-scale-stop",()=>{Ot(this._startScale,0,0),Ot(this._endScale,0,0)}),this._graphicState.on("changed",()=>{var l;((l=s.inputState)==null?void 0:l.type)!=="resize"&&(this._zMaxDirty=!0)})])}destroy(){this.forEachManipulator(t=>{this._tool.manipulators.remove(t),t.destroy()})}forEachManipulator(t){this.resizeManipulators.forEach(e=>t(e,G.SCALE))}updateManipulators(t,e){this.resizeManipulators.forEach((n,a)=>{$o(n,this._resizeHandles[a],t,e)})}getUpdatedTooltipInfo(){return this.resizeManipulators.some(t=>t.focused)?this._computeScaleTooltipInfo():null}_computeScaleTooltipInfo(){const t=this._tool,e=t.tooltipOptions,n=this._scaleTooltipInfo??(this._scaleTooltipInfo=new Ho({tooltipOptions:e})),a=t.graphic.geometry;if(a==null)return null;const o=sa(this._bounds.mapBounds,this.zMax,a.spatialReference,this._graphicState.isDraped);return o==null?null:(n.xSize=o[0],n.ySize=o[1],this._sizeStart!=null&&this.resizeManipulators.some(s=>s.dragging)?(n.xScale=o[0].value/this._sizeStart[0].value,n.yScale=o[1].value/this._sizeStart[1].value):(n.xScale=1,n.yScale=1),n)}_onResizeGrab({action:t,screenPoint:e}){const n=this._tool,a=this._bounds;if(t!=="start"||!e||!n.graphic.geometry)return;const o=Sa(n.view.state.camera,e);wa(a.displayBounds.plane,o,w.get())&&(a.backupMapBounds(),de(a.displayBounds,this._displayBoundsStart),this._displayBoundsMarginStart=a.displayBoundsMargin,this._sizeStart=sa(a.mapBoundsStart,this.zMax,n.graphic.geometry.spatialReference,this._graphicState.isDraped),n.inputState={type:"resize"})}_createResizeDragPipeline(t,e){const n=this._tool,a=n.graphic;return lt(t,(o,s,r)=>{n.inputState!=null&&(s.next(l=>(l.action==="start"&&n.emit("graphic-scale-start",{graphic:a,xScale:1,yScale:1}),l)).next(fi(n.view,this._displayBoundsStart.plane)).next(l=>({...l,handle:e})).next(this._resizeDragRenderPlaneToFactors()).next(...this._preserveAspectRatioStep()).next(this._resizeDragUpdateGeometry()).next(l=>{const p={graphic:a,xScale:l.factor1,yScale:l.factor2};switch(l.action){case"start":case"update":n.emit("graphic-scale",p);break;case"end":n.inputState=null,n.emit("graphic-scale-stop",p)}return l}),r.next(()=>{n.inputState!=null&&n.emit("graphic-scale-stop",{graphic:a,xScale:1,yScale:1}),n.cancel()}))})}_resizeDragRenderPlaneToFactors(){const t=this._bounds;return e=>{const n=this._displayBoundsStart,a=e.handle.direction,o=t.displayBoundsMargin,s=this._displayBoundsMarginStart,r=si(w.get(),n.origin);Ht(r,r,n.basis1,-a[0]),Ht(r,r,n.basis2,-a[1]);const l=L(w.get(),e.renderEnd,r),p=L(w.get(),e.renderStart,r),c=Da(e.handle),d=Ui(n),g=Ui(t.displayBounds)/d,_=(m,v)=>{if(m===0)return 1;let M=te(v),b=.5*m*De(v,l)/M;const f=b<0?-1:1;c&&(b+=(M-.5*m*De(v,p)/M)*f*g);const O=M<1.5*s?1:ra;return M=Math.max(M-s,ra),f>0&&(b-=o),f*Math.max(f*(b/M),O)};return{...e,factor1:_(a[0],n.basis1),factor2:_(a[1],n.basis2)}}}_resizeDragUpdateGeometry(){const t=this._tool,e=this._bounds;return n=>{const a=si(H(),e.mapBoundsStart.origin);Ht(a,a,e.mapBoundsStart.basis1,-n.handle.direction[0]),Ht(a,a,e.mapBoundsStart.basis2,-n.handle.direction[1]);const o=Ot(re(),e.mapBoundsStart.basis1[0],e.mapBoundsStart.basis1[1]);pa(o,o);const s=[];for(const p of this._editGeometryOperations.data.components)s.push(...p.vertices);const r=n.action==="start"?St.NEW_STEP:St.ACCUMULATE_STEPS,l=this._editGeometryOperations.scaleVertices(s,a,o,n.factor1,n.factor2,r,Ga.REPLACE);return de(e.mapBoundsStart,e.mapBounds),Ze(l,e.mapBounds),t.graphic.geometry=this._editGeometryOperations.data.geometry,n}}}const ra=1e-6;class Bs{constructor(){this._lastDragEvent=null,this._next=null,this._enabled=!1}get enabled(){return this._enabled}set enabled(t){if(this._enabled!==t&&this._lastDragEvent!=null&&this._next!=null){const e={...this._lastDragEvent,action:"update"};t&&this._adjustScaleFactors(e),this._next.execute(e)}this._enabled=t}createDragEventPipelineStep(){this._lastDragEvent=null;const t=new Aa;return this._next=t,[e=>(this._lastDragEvent=e.action!=="end"?{...e}:null,this._enabled&&this._adjustScaleFactors(e),e),t]}_adjustScaleFactors(t){const e=Da(t.handle)?Math.max(Math.abs(t.factor1),Math.abs(t.factor2)):t.handle.direction[0]===0?Math.abs(t.factor2):Math.abs(t.factor1);t.factor1=t.factor1<0?-e:e,t.factor2=t.factor2<0?-e:e}get test(){return{_adjustScaleFactors:t=>this._adjustScaleFactors(t)}}}let J=class extends $t.EventedMixin(Fe){constructor(i){super(i),this.enableZ=!0,this.enableScaling=!0,this.enableRotation=!0,this.tooltipOptions=new Rt,this._preserveAspectRatio=new Bs,this.grabbing=!1,this.inputState=null,this._attachmentOrigin=null,this.type="transform-3d",this._outlineVisualElement=null}initialize(){const{view:i,graphic:t}=this,e=this._graphicState=new Ft({graphic:t}),n=t.geometry,a=this._editGeometryOperations=Be.fromGeometry(n,i.state.viewingMode),o=this._bounds=new Xs(this,()=>this._updateManipulators(),a.data);this._extentMove=new ks(this,e,a,o),this._extentScale=new Fs(this,e,a,o,()=>this._preserveAspectRatio.createDragEventPipelineStep()),this._extentRotate=new Us(this,a,o),this.addHandles([y(()=>this.enableZ,()=>this._updateManipulatorAvailability(this._extentMove.moveZManipulator,G.TRANSLATE_Z)),y(()=>this.enableScaling,()=>this._extentScale.forEachManipulator(p=>this._updateManipulatorAvailability(p,G.SCALE))),y(()=>this.enableRotation,()=>this._updateManipulatorAvailability(this._extentRotate.rotateManipulator,G.ROTATE))]),this._updateAllManipulatorAvailability();const s=qe({view:i,graphic:t,forEachManipulator:p=>this._forEachManipulator(p),onManipulatorsChanged:()=>Z()});if(s!=null){const{visualElement:p}=s;p instanceof Nt&&(this._outlineVisualElement=p,this.addHandles(p.events.on("attachment-origin-changed",()=>this._bounds.updateDisplayBounds()))),this.addHandles(s)}this.addHandles([e.on("changed",()=>this._onGeometryChanged()),y(()=>e.displaying,()=>this._updateAllManipulatorAvailability()),y(()=>e.isDraped,()=>this._graphicDrapedChanged(),$),y(()=>{var p;return(p=i.pointsOfInterest)==null?void 0:p.centerOnSurfaceFrequent.location},()=>o.updateDisplayBounds()),i.trackGraphicState(e)]);const r=p=>{this.addHandles(p.events.on("grab-changed",()=>{this.grabbing=p.grabbing,this._updateAllManipulatorAvailability()}))};this._forEachManipulator(r);const l=(p,c)=>{this.addHandles(p.events.on("immediate-click",d=>{c===G.TRANSLATE_XY&&this.emit("immediate-click",{...d,graphic:t}),d.stopPropagation()}))};this._forEachManipulator(l),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._extentMove.destroy(),this._extentScale.destroy(),this._extentRotate.destroy(),this._editGeometryOperations.destroy(),this._tooltip.destroy(),this._set("view",null),this._set("graphic",null)}_initializeTooltip(){const{view:i}=this,t=this._tooltip=new ve({view:i}),e=()=>{t.info=this._getUpdatedTooltipInfo()};this.addHandles([this.on("graphic-translate-start",e),this.on("graphic-translate",e),this.on("graphic-translate-stop",()=>{this._tooltip.clear()}),this.on("graphic-rotate-start",e),this.on("graphic-rotate",e),this.on("graphic-rotate-stop",e),this.on("graphic-scale-start",e),this.on("graphic-scale",e),this.on("graphic-scale-stop",e)]),this._forEachManipulator(n=>{this.addHandles([n.events.on("focus-changed",e),n.events.on("grab-changed",e),n.events.on("drag",a=>{a.action==="cancel"?this._tooltip.clear():e()})])})}_getUpdatedTooltipInfo(){return this.tooltipOptions.enabled?this._extentMove.getUpdatedTooltipInfo()??this._extentScale.getUpdatedTooltipInfo()??this._extentRotate.getUpdatedTooltipInfo():null}_onGeometryChanged(){this._bounds.updateDisplayBounds()}_graphicDrapedChanged(){this.removeHandles(la),this._bounds.updateDisplayBounds(),this._graphicState.isDraped&&this.addHandles(this.view.elevationProvider.on("elevation-change",i=>{this._attachmentOrigin!=null&&da(i.extent,this._attachmentOrigin.x,this._attachmentOrigin.y)&&this._bounds.updateDisplayBounds()}),la)}_updateManipulators(){if(!this.visible)return;const i=this._bounds.displayBounds,t=Ro(i,B.get());this._extentMove.updateManipulators(t,i),this._extentScale.updateManipulators(t,i),this._extentRotate.updateManipulators(t,i)}_updateAllManipulatorAvailability(){this._forEachManipulator((i,t)=>this._updateManipulatorAvailability(i,t))}_updateManipulatorAvailability(i,t){const e=this.grabbing&&!i.grabbing;if(i.interactive=!e,i instanceof et){const n=this._graphicState.displaying,a=this.enableZ&&kt(this.graphic);switch(t){case G.ROTATE:i.available=n&&this.enableRotation;break;case G.SCALE:i.available=n&&(this.enableScaling||this.enableRotation||a),i.interactive=!e&&this.enableScaling,i.state=this.enableScaling?Co:Lo;break;case G.TRANSLATE_Z:i.available=n&&a;break;default:i.available=n}}}_forEachManipulator(i){this._extentMove.forEachManipulator(i),this._extentScale.forEachManipulator(i),this._extentRotate.forEachManipulator(i)}get preserveAspectRatio(){return this._preserveAspectRatio.enabled}set preserveAspectRatio(i){this._preserveAspectRatio.enabled=i,this._set("preserveAspectRatio",i)}get moveUnit(){return Fn(this.view.spatialReference)??"meters"}get attachmentOrigin(){var e,n;const i=this.graphic.geometry,t=this._graphicState.isDraped?null:(e=this._outlineVisualElement)==null?void 0:e.attachmentOrigin;return this._attachmentOrigin=t??xa(this.view,this.graphic)??((n=i==null?void 0:i.extent)==null?void 0:n.center),this._attachmentOrigin}reset(){}cancel(){if(this.canUndo){const i=this._editGeometryOperations.undo();Hi(i,this._bounds.mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry}this.inputState=null}get canUndo(){return this._editGeometryOperations.canUndo}undo(){if(this.inputState!=null)this.view.activeTool=null;else if(this.canUndo){const i=this._editGeometryOperations.undo();Hi(i,this._bounds.mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry}}get canRedo(){return this._editGeometryOperations.canRedo}redo(){if(this.canRedo){const i=this._editGeometryOperations.redo();Ze(i,this._bounds.mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry}}get test(){return{moveZManipulator:this._extentMove.moveZManipulator,resizeManipulators:this._extentScale.resizeManipulators,rotateManipulator:this._extentRotate.rotateManipulator,tooltip:this._tooltip}}};h([u({constructOnly:!0,nonNullable:!0})],J.prototype,"view",void 0),h([u({constructOnly:!0,nonNullable:!0})],J.prototype,"graphic",void 0),h([u()],J.prototype,"enableZ",void 0),h([u()],J.prototype,"enableScaling",void 0),h([u()],J.prototype,"enableRotation",void 0),h([u({constructOnly:!0,type:Rt})],J.prototype,"tooltipOptions",void 0),h([u()],J.prototype,"preserveAspectRatio",null),h([u()],J.prototype,"moveUnit",null),h([u()],J.prototype,"grabbing",void 0),h([u()],J.prototype,"inputState",void 0),h([u({readOnly:!0})],J.prototype,"type",void 0),J=h([k("esri.views.3d.interactive.editingTools.transformGraphic.ExtentTransformTool")],J);const la="draped-elevation-changes";export{Bt as DrawGraphicTool3D,J as ExtentTransformTool,dt as GraphicMoveTool,X as GraphicReshapeTool,K as GraphicTransformTool}; diff --git a/dist/assets/editsZScale-4-dTv58d.js b/dist/assets/editsZScale-4-dTv58d.js new file mode 100644 index 0000000..df4d120 --- /dev/null +++ b/dist/assets/editsZScale-4-dTv58d.js @@ -0,0 +1 @@ +import{dw as a,bt as l}from"./index-pCX-0tJH.js";function e(n,o,s){if(n.hasM==null||n.hasZ)for(const f of o)for(const t of f)t.length>2&&(t[2]*=s)}function u(n,o,s){if(!n&&!o||!s)return;const f=a(s);r(n,s,f),r(o,s,f)}function r(n,o,s){if(n)for(const f of n)c(f.geometry,o,s)}function c(n,o,s){if(!(n!=null&&n.spatialReference)||l(n.spatialReference,o))return;const f=a(n.spatialReference)/s;if(f!==1){if("x"in n)n.z!=null&&(n.z*=f);else if("rings"in n)e(n,n.rings,f);else if("paths"in n)e(n,n.paths,f);else if("points"in n&&(n.hasM==null||n.hasZ))for(const t of n.points)t.length>2&&(t[2]*=f)}}export{u as i}; diff --git a/dist/assets/editsZScale-Wgw9kbYG.js b/dist/assets/editsZScale-Wgw9kbYG.js deleted file mode 100644 index 22096b9..0000000 --- a/dist/assets/editsZScale-Wgw9kbYG.js +++ /dev/null @@ -1 +0,0 @@ -import{dA as a,al as l}from"./index-J0iiHjMT.js";function t(n,o,s){if(n.hasM==null||n.hasZ)for(const f of o)for(const e of f)e.length>2&&(e[2]*=s)}function u(n,o,s){if(!n&&!o||!s)return;const f=a(s);r(n,s,f),r(o,s,f)}function r(n,o,s){if(n)for(const f of n)c(f.geometry,o,s)}function c(n,o,s){if(!(n!=null&&n.spatialReference)||l(n.spatialReference,o))return;const f=a(n.spatialReference)/s;if(f!==1){if("x"in n)n.z!=null&&(n.z*=f);else if("rings"in n)t(n,n.rings,f);else if("paths"in n)t(n,n.paths,f);else if("points"in n&&(n.hasM==null||n.hasZ))for(const e of n.points)e.length>2&&(e[2]*=f)}}export{u as i}; diff --git a/dist/assets/euclideanAreaMeasurementUtils-jpli3_gk.js b/dist/assets/euclideanAreaMeasurementUtils-jpli3_gk.js new file mode 100644 index 0000000..97dd656 --- /dev/null +++ b/dist/assets/euclideanAreaMeasurementUtils-jpli3_gk.js @@ -0,0 +1 @@ +import{cC as q,a8 as u,bz as $,bx as R,cD as b,cE as j,cF as v,cG as x,cH as y,cI as A,cJ as F,cK as W,cL as Z}from"./index-pCX-0tJH.js";import{i as w}from"./measurementUtils-69EiqRp6.js";function J(t,s=m()){return d(t,s)}function K(t,s=m()){return d(t,s,!1)}function d(t,s,e=t.hasZ){const c=w(t.spatialReference),l=q(c);if(l==null)return null;const C=(i,r)=>!(r.length<2)&&($(i,r[0],r[1],e&&r[2]||0),!0);let h=0;for(const i of t.rings){const r=i.length;if(r<3)continue;const{positionsWorldCoords:o}=s;for(;o.length!(r.length<2)&&($(a,r[0],r[1],e&&r[2]||0),!0);let h=0;for(const a of t.rings){const r=a.length;if(r<3)continue;const{positionsWorldCoords:o}=s;for(;o.lengths.data.count)}async function m(n,t,a){const o=r(n);return e(o,c.from(t),{...a}).then(s=>s.data.objectIds)}export{u as n,m as s}; diff --git a/dist/assets/executeForIds-wXO8-pll.js b/dist/assets/executeForIds-wXO8-pll.js deleted file mode 100644 index e651f78..0000000 --- a/dist/assets/executeForIds-wXO8-pll.js +++ /dev/null @@ -1 +0,0 @@ -import{dZ as c,ca as s}from"./index-J0iiHjMT.js";import{S as f,p as e}from"./query-rG0aX6cE.js";async function u(n,t,o){const r=c(n);return f(r,s.from(t),{...o}).then(a=>a.data.count)}async function d(n,t,o){const r=c(n);return e(r,s.from(t),{...o}).then(a=>a.data.objectIds)}export{u as n,d as s}; diff --git a/dist/assets/executeForTopCount-Cgs-qCAg.js b/dist/assets/executeForTopCount-Cgs-qCAg.js new file mode 100644 index 0000000..17a7698 --- /dev/null +++ b/dist/assets/executeForTopCount-Cgs-qCAg.js @@ -0,0 +1 @@ +import{fV as n,h5 as f}from"./index-pCX-0tJH.js";import{a as s}from"./queryTopFeatures-WO1xu2NM.js";async function e(o,t,a){const r=n(o);return(await s(r,f.from(t),{...a})).data.count}export{e as executeForTopCount}; diff --git a/dist/assets/executeForTopCount-bR-K9CPn.js b/dist/assets/executeForTopCount-bR-K9CPn.js deleted file mode 100644 index a3afb27..0000000 --- a/dist/assets/executeForTopCount-bR-K9CPn.js +++ /dev/null @@ -1 +0,0 @@ -import{dZ as i}from"./index-J0iiHjMT.js";import{a as p}from"./queryTopFeatures-L2nDK2pi.js";import{S as a}from"./TopFeaturesQuery-E6D2tV-x.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";async function x(o,t,r){const m=i(o);return(await p(m,a.from(t),{...r})).data.count}export{x as executeForTopCount}; diff --git a/dist/assets/executeForTopExtents--je_5dPa.js b/dist/assets/executeForTopExtents--je_5dPa.js deleted file mode 100644 index 9845ea1..0000000 --- a/dist/assets/executeForTopExtents--je_5dPa.js +++ /dev/null @@ -1 +0,0 @@ -import{dZ as e,dT as n}from"./index-J0iiHjMT.js";import{d as p}from"./queryTopFeatures-L2nDK2pi.js";import{S as i}from"./TopFeaturesQuery-E6D2tV-x.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";async function T(o,r,m){const a=e(o),t=await p(a,i.from(r),{...m});return{count:t.data.count,extent:n.fromJSON(t.data.extent)}}export{T as executeForTopExtents}; diff --git a/dist/assets/executeForTopExtents-H5vst4yE.js b/dist/assets/executeForTopExtents-H5vst4yE.js new file mode 100644 index 0000000..3d69a72 --- /dev/null +++ b/dist/assets/executeForTopExtents-H5vst4yE.js @@ -0,0 +1 @@ +import{fV as r,h5 as f,dO as m}from"./index-pCX-0tJH.js";import{d as s}from"./queryTopFeatures-WO1xu2NM.js";async function u(o,a,e){const n=r(o),t=await s(n,f.from(a),{...e});return{count:t.data.count,extent:m.fromJSON(t.data.extent)}}export{u as executeForTopExtents}; diff --git a/dist/assets/executeForTopIds-JVLS00pE.js b/dist/assets/executeForTopIds-JVLS00pE.js new file mode 100644 index 0000000..967562e --- /dev/null +++ b/dist/assets/executeForTopIds-JVLS00pE.js @@ -0,0 +1 @@ +import{fV as s,h5 as e}from"./index-pCX-0tJH.js";import{m as f}from"./queryTopFeatures-WO1xu2NM.js";async function n(o,t,a){const r=s(o);return(await f(r,e.from(t),{...a})).data.objectIds}export{n as executeForTopIds}; diff --git a/dist/assets/executeForTopIds-kKHpaQVu.js b/dist/assets/executeForTopIds-kKHpaQVu.js deleted file mode 100644 index 780fd14..0000000 --- a/dist/assets/executeForTopIds-kKHpaQVu.js +++ /dev/null @@ -1 +0,0 @@ -import{dZ as i}from"./index-J0iiHjMT.js";import{m as p}from"./queryTopFeatures-L2nDK2pi.js";import{S as a}from"./TopFeaturesQuery-E6D2tV-x.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";async function x(o,r,t){const m=i(o);return(await p(m,a.from(r),{...t})).data.objectIds}export{x as executeForTopIds}; diff --git a/dist/assets/executeQueryJSON-ACj9qY0y.js b/dist/assets/executeQueryJSON-ACj9qY0y.js deleted file mode 100644 index 788e956..0000000 --- a/dist/assets/executeQueryJSON-ACj9qY0y.js +++ /dev/null @@ -1 +0,0 @@ -import{dZ as f,ca as i}from"./index-J0iiHjMT.js";import{c as e}from"./query-rG0aX6cE.js";import{d as m}from"./FeatureSet-d4S1oKME.js";async function y(a,r,o){const t=await p(a,r,o);return m.fromJSON(t)}async function p(a,r,o){const t=f(a),c={...o},n=i.from(r),{data:s}=await e(t,n,n.sourceSpatialReference,c);return s}export{p as a,y as s}; diff --git a/dist/assets/executeQueryPBF-P21isUTI.js b/dist/assets/executeQueryPBF-P21isUTI.js new file mode 100644 index 0000000..64fbd90 --- /dev/null +++ b/dist/assets/executeQueryPBF-P21isUTI.js @@ -0,0 +1 @@ +import{j2 as c,j3 as l,j4 as f,eO as p,fV as _,aL as y,j5 as m}from"./index-pCX-0tJH.js";function P(o,t){return t}function h(o,t,e,r){switch(e){case 0:return n(o,t+r,0);case 1:return o.originPosition==="lowerLeft"?n(o,t+r,1):G(o,t+r,1)}}function u(o,t,e,r){return e===2?n(o,t,2):h(o,t,e,r)}function C(o,t,e,r){return e===2?n(o,t,3):h(o,t,e,r)}function g(o,t,e,r){return e===3?n(o,t,3):u(o,t,e,r)}function n({translate:o,scale:t},e,r){return o[r]+e*t[r]}function G({translate:o,scale:t},e,r){return o[r]-e*t[r]}class M{constructor(t){this._options=t,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=P,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(t){if(this._options.applyTransform&&(t.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!t.hasZ)return;const e=c(t.geometryType,this._options.sourceSpatialReference,t.spatialReference);if(e!=null)for(const r of t.features)e(r.geometry)}createSpatialReference(){return{}}addField(t,e){const r=t.fields;l(r),r.push(e);const s=r.map(i=>i.name);this._attributesConstructor=function(){for(const i of s)this[i]=null}}addFeature(t,e){t.features.push(e)}prepareFeatures(t){switch(this._transform=t.transform,this._options.applyTransform&&t.transform&&(this._applyTransform=this._deriveApplyTransform(t)),this._vertexDimension=2,t.hasZ&&this._vertexDimension++,t.hasM&&this._vertexDimension++,t.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,r,s)=>this.addCoordinatePoint(e,r,s),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,r,s)=>this._addCoordinatePolygon(e,r,s),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,r,s)=>this._addCoordinatePolyline(e,r,s),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,r,s)=>this._addCoordinateMultipoint(e,r,s),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(t,e,r){this._lengths.length===0&&(this._toAddInCurrentPath=e),this._lengths.push(e)}addQueryGeometry(t,e){const{queryGeometry:r,queryGeometryType:s}=e,i=f(r.clone(),r,!1,!1,this._transform),a=p(i,s,!1,!1);t.queryGeometryType=s,t.queryGeometry={...a}}createPointGeometry(t){const e={x:0,y:0,spatialReference:t.spatialReference};return t.hasZ&&(e.z=0),t.hasM&&(e.m=0),e}addCoordinatePoint(t,e,r){const s=this._transform;switch(e=this._applyTransform(s,e,r,0),r){case 0:t.x=e;break;case 1:t.y=e;break;case 2:"z"in t?t.z=e:t.m=e;break;case 3:t.m=e}}_transformPathLikeValue(t,e){let r=0;e<=1&&(r=this._previousCoordinate[e],this._previousCoordinate[e]+=t);const s=this._transform;return this._applyTransform(s,t,e,r)}_addCoordinatePolyline(t,e,r){this._dehydratedAddPointsCoordinate(t.paths,e,r)}_addCoordinatePolygon(t,e,r){this._dehydratedAddPointsCoordinate(t.rings,e,r)}_addCoordinateMultipoint(t,e,r){r===0&&t.points.push([]);const s=this._transformPathLikeValue(e,r);t.points[t.points.length-1].push(s)}_createPolygonGeometry(t){return{rings:[[]],spatialReference:t.spatialReference,hasZ:!!t.hasZ,hasM:!!t.hasM}}_createPolylineGeometry(t){return{paths:[[]],spatialReference:t.spatialReference,hasZ:!!t.hasZ,hasM:!!t.hasM}}_createMultipointGeometry(t){return{points:[],spatialReference:t.spatialReference,hasZ:!!t.hasZ,hasM:!!t.hasM}}_dehydratedAddPointsCoordinate(t,e,r){r===0&&this._toAddInCurrentPath--==0&&(t.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(e,r),i=t[t.length-1];r===0&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),i.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=s}_deriveApplyTransform(t){const{hasZ:e,hasM:r}=t;return e&&r?g:e?u:r?C:h}}async function v(o,t,e){const r=_(o),s={...e},i=y.from(t),a=!i.quantizationParameters,{data:d}=await m(r,i,new M({sourceSpatialReference:i.sourceSpatialReference,applyTransform:a}),s);return d}export{v as n}; diff --git a/dist/assets/executeQueryPBF-vdaOUMid.js b/dist/assets/executeQueryPBF-vdaOUMid.js deleted file mode 100644 index ab4b208..0000000 --- a/dist/assets/executeQueryPBF-vdaOUMid.js +++ /dev/null @@ -1 +0,0 @@ -import{dB as c,iZ as l,i_ as f,eT as p,dZ as _,ca as m}from"./index-J0iiHjMT.js";import{f as y}from"./query-rG0aX6cE.js";import"./FeatureSet-d4S1oKME.js";function P(o,t){return t}function h(o,t,e,r){switch(e){case 0:return n(o,t+r,0);case 1:return o.originPosition==="lowerLeft"?n(o,t+r,1):G(o,t+r,1)}}function u(o,t,e,r){return e===2?n(o,t,2):h(o,t,e,r)}function C(o,t,e,r){return e===2?n(o,t,3):h(o,t,e,r)}function g(o,t,e,r){return e===3?n(o,t,3):u(o,t,e,r)}function n({translate:o,scale:t},e,r){return o[r]+e*t[r]}function G({translate:o,scale:t},e,r){return o[r]-e*t[r]}class M{constructor(t){this._options=t,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=P,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(t){if(this._options.applyTransform&&(t.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!t.hasZ)return;const e=c(t.geometryType,this._options.sourceSpatialReference,t.spatialReference);if(e!=null)for(const r of t.features)e(r.geometry)}createSpatialReference(){return{}}addField(t,e){const r=t.fields;l(r),r.push(e);const s=r.map(i=>i.name);this._attributesConstructor=function(){for(const i of s)this[i]=null}}addFeature(t,e){t.features.push(e)}prepareFeatures(t){switch(this._transform=t.transform,this._options.applyTransform&&t.transform&&(this._applyTransform=this._deriveApplyTransform(t)),this._vertexDimension=2,t.hasZ&&this._vertexDimension++,t.hasM&&this._vertexDimension++,t.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,r,s)=>this.addCoordinatePoint(e,r,s),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,r,s)=>this._addCoordinatePolygon(e,r,s),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,r,s)=>this._addCoordinatePolyline(e,r,s),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,r,s)=>this._addCoordinateMultipoint(e,r,s),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(t,e,r){this._lengths.length===0&&(this._toAddInCurrentPath=e),this._lengths.push(e)}addQueryGeometry(t,e){const{queryGeometry:r,queryGeometryType:s}=e,i=f(r.clone(),r,!1,!1,this._transform),a=p(i,s,!1,!1);t.queryGeometryType=s,t.queryGeometry={...a}}createPointGeometry(t){const e={x:0,y:0,spatialReference:t.spatialReference};return t.hasZ&&(e.z=0),t.hasM&&(e.m=0),e}addCoordinatePoint(t,e,r){const s=this._transform;switch(e=this._applyTransform(s,e,r,0),r){case 0:t.x=e;break;case 1:t.y=e;break;case 2:"z"in t?t.z=e:t.m=e;break;case 3:t.m=e}}_transformPathLikeValue(t,e){let r=0;e<=1&&(r=this._previousCoordinate[e],this._previousCoordinate[e]+=t);const s=this._transform;return this._applyTransform(s,t,e,r)}_addCoordinatePolyline(t,e,r){this._dehydratedAddPointsCoordinate(t.paths,e,r)}_addCoordinatePolygon(t,e,r){this._dehydratedAddPointsCoordinate(t.rings,e,r)}_addCoordinateMultipoint(t,e,r){r===0&&t.points.push([]);const s=this._transformPathLikeValue(e,r);t.points[t.points.length-1].push(s)}_createPolygonGeometry(t){return{rings:[[]],spatialReference:t.spatialReference,hasZ:!!t.hasZ,hasM:!!t.hasM}}_createPolylineGeometry(t){return{paths:[[]],spatialReference:t.spatialReference,hasZ:!!t.hasZ,hasM:!!t.hasM}}_createMultipointGeometry(t){return{points:[],spatialReference:t.spatialReference,hasZ:!!t.hasZ,hasM:!!t.hasM}}_dehydratedAddPointsCoordinate(t,e,r){r===0&&this._toAddInCurrentPath--==0&&(t.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(e,r),i=t[t.length-1];r===0&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),i.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=s}_deriveApplyTransform(t){const{hasZ:e,hasM:r}=t;return e&&r?g:e?u:r?C:h}}async function b(o,t,e){const r=_(o),s={...e},i=m.from(t),a=!i.quantizationParameters,{data:d}=await y(r,i,new M({sourceSpatialReference:i.sourceSpatialReference,applyTransform:a}),s);return d}export{b as n}; diff --git a/dist/assets/executeRelationshipQuery-A9rcFpIX.js b/dist/assets/executeRelationshipQuery-A9rcFpIX.js deleted file mode 100644 index 03cdcbe..0000000 --- a/dist/assets/executeRelationshipQuery-A9rcFpIX.js +++ /dev/null @@ -1 +0,0 @@ -import{bW as m,et as p,kq as l,dZ as f}from"./index-J0iiHjMT.js";import{t as j}from"./query-rG0aX6cE.js";import{d as R}from"./FeatureSet-d4S1oKME.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";function b(r,t){const e=r.toJSON();return e.objectIds&&(e.objectIds=e.objectIds.join(",")),e.orderByFields&&(e.orderByFields=e.orderByFields.join(",")),e.outFields&&!(t!=null&&t.returnCountOnly)?e.outFields.includes("*")?e.outFields="*":e.outFields=e.outFields.join(","):delete e.outFields,e.outSR&&(e.outSR=p(e.outSR)),e.dynamicDataSource&&(e.layer=JSON.stringify({source:e.dynamicDataSource}),delete e.dynamicDataSource),e}async function F(r,t,e){const n=await y(r,t,e),o=n.data,s=o.geometryType,a=o.spatialReference,c={};for(const d of o.relatedRecordGroups){const u={fields:void 0,objectIdFieldName:void 0,geometryType:s,spatialReference:a,hasZ:!!o.hasZ,hasM:!!o.hasM,features:d.relatedRecords};if(d.objectId!=null)c[d.objectId]=u;else for(const i of Object.keys(d))i!=="relatedRecords"&&(c[d[i]]=u)}return{...n,data:c}}async function h(r,t,e){const n=await y(r,t,e,{returnCountOnly:!0}),o=n.data,s={};for(const a of o.relatedRecordGroups)a.objectId!=null&&(s[a.objectId]=a.count);return{...n,data:s}}async function y(r,t,e={},n){const o=j({...r.query,f:"json",...n,...b(t,n)});return m(r.path+"/queryRelatedRecords",{...e,query:{...e.query,...o}})}async function k(r,t,e){t=l.from(t);const n=f(r);return F(n,t,e).then(o=>{const s=o.data,a={};return Object.keys(s).forEach(c=>a[c]=R.fromJSON(s[c])),a})}async function x(r,t,e){t=l.from(t);const n=f(r);return h(n,t,{...e}).then(o=>o.data)}export{k as executeRelationshipQuery,x as executeRelationshipQueryForCount}; diff --git a/dist/assets/executeRelationshipQuery-ZKqwTeNc.js b/dist/assets/executeRelationshipQuery-ZKqwTeNc.js new file mode 100644 index 0000000..8aa10fb --- /dev/null +++ b/dist/assets/executeRelationshipQuery-ZKqwTeNc.js @@ -0,0 +1 @@ +import{h4 as j,av as R,em as h,ky as l,fV as y,h6 as m}from"./index-pCX-0tJH.js";function p(r,t){const e=r.toJSON();return e.objectIds&&(e.objectIds=e.objectIds.join(",")),e.orderByFields&&(e.orderByFields=e.orderByFields.join(",")),e.outFields&&!(t!=null&&t.returnCountOnly)?e.outFields.includes("*")?e.outFields="*":e.outFields=e.outFields.join(","):delete e.outFields,e.outSR&&(e.outSR=h(e.outSR)),e.dynamicDataSource&&(e.layer=JSON.stringify({source:e.dynamicDataSource}),delete e.dynamicDataSource),e}async function F(r,t,e){const a=await f(r,t,e),o=a.data,s=o.geometryType,n=o.spatialReference,c={};for(const d of o.relatedRecordGroups){const u={fields:void 0,objectIdFieldName:void 0,geometryType:s,spatialReference:n,hasZ:!!o.hasZ,hasM:!!o.hasM,features:d.relatedRecords};if(d.objectId!=null)c[d.objectId]=u;else for(const i of Object.keys(d))i!=="relatedRecords"&&(c[d[i]]=u)}return{...a,data:c}}async function b(r,t,e){const a=await f(r,t,e,{returnCountOnly:!0}),o=a.data,s={};for(const n of o.relatedRecordGroups)n.objectId!=null&&(s[n.objectId]=n.count);return{...a,data:s}}async function f(r,t,e={},a){const o=j({...r.query,f:"json",...a,...p(t,a)});return R(r.path+"/queryRelatedRecords",{...e,query:{...e.query,...o}})}async function I(r,t,e){t=l.from(t);const a=y(r);return F(a,t,e).then(o=>{const s=o.data,n={};return Object.keys(s).forEach(c=>n[c]=m.fromJSON(s[c])),n})}async function O(r,t,e){t=l.from(t);const a=y(r);return b(a,t,{...e}).then(o=>o.data)}export{I as executeRelationshipQuery,O as executeRelationshipQueryForCount}; diff --git a/dist/assets/executeTopFeaturesQuery-pxkhoyar.js b/dist/assets/executeTopFeaturesQuery-pxkhoyar.js new file mode 100644 index 0000000..08cf583 --- /dev/null +++ b/dist/assets/executeTopFeaturesQuery-pxkhoyar.js @@ -0,0 +1 @@ +import{fV as m,h5 as i,h6 as n}from"./index-pCX-0tJH.js";import{p}from"./queryTopFeatures-WO1xu2NM.js";async function d(r,a,o,t){const e=m(r),f={...t},{data:s}=await p(e,i.from(a),o,f);return n.fromJSON(s)}export{d as executeTopFeaturesQuery}; diff --git a/dist/assets/executeTopFeaturesQuery-se6h6fh4.js b/dist/assets/executeTopFeaturesQuery-se6h6fh4.js deleted file mode 100644 index 9b1b9c4..0000000 --- a/dist/assets/executeTopFeaturesQuery-se6h6fh4.js +++ /dev/null @@ -1 +0,0 @@ -import{dZ as f}from"./index-J0iiHjMT.js";import{p as e}from"./queryTopFeatures-L2nDK2pi.js";import{d as s}from"./FeatureSet-d4S1oKME.js";import{S as n}from"./TopFeaturesQuery-E6D2tV-x.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";async function F(r,o,t,m){const i=f(r),p={...m},{data:a}=await e(i,n.from(o),t,p);return s.fromJSON(a)}export{F as executeTopFeaturesQuery}; diff --git a/dist/assets/featureLayerUtils-o55B7eEP.js b/dist/assets/featureLayerUtils-m5wDrekx.js similarity index 77% rename from dist/assets/featureLayerUtils-o55B7eEP.js rename to dist/assets/featureLayerUtils-m5wDrekx.js index 1a28850..2a14490 100644 --- a/dist/assets/featureLayerUtils-o55B7eEP.js +++ b/dist/assets/featureLayerUtils-m5wDrekx.js @@ -1 +1 @@ -import{bT as A,g$ as Y,dj as _,df as m,e3 as G,h0 as P,h1 as T,h as u,h2 as $,h3 as j,E as y,i as b}from"./index-J0iiHjMT.js";import{I as k,y as E,w as N,b as z,u as B,v as V,l as g,d as q,m as I}from"./utils-rBsg-VY8.js";import{t as C}from"./fetchService-wPWKuma6.js";import{o as x}from"./jsonContext-cWV_-jAj.js";import"./requestPresets-18nzHK5y.js";const h="Feature Service",w="feature-layer-utils",H=`${w}-save`,Q=`${w}-save-as`,p=`${w}-saveall`,f=`${w}-saveall-as`;function v(e){return{isValid:j(e)&&(e.type!=="feature"||!e.dynamicDataSource),errorMessage:"Feature layer should be a layer or table in a map or feature service"}}function O(e){const a=[],t=[];for(const{layer:n,layerJSON:o}of e)n.isTable?t.push(o):a.push(o);return{layers:a,tables:t}}function F(e){return O([e])}async function J(e,a){return/\/\d+\/?$/.test(e.url)?F(a[0]):M(a,e)}async function M(e,a){if(!a)return e.reverse(),O(e);const{layer:{url:t,customParameters:n,apiKey:o}}=e[0];let r=await a.fetchData("json");(r==null?void 0:r.layers)!=null&&(r==null?void 0:r.tables)!=null||(r=await W(r,{url:t??"",customParameters:n,apiKey:o},e.map(s=>s.layer.layerId)));for(const s of e)R(s.layer,s.layerJSON,r);return r}async function W(e,a,t){e||(e={}),e.layers||(e.layers=[]),e.tables||(e.tables=[]);const{url:n,customParameters:o,apiKey:r}=a,{serviceJSON:s,layersJSON:l}=await C(n,{customParameters:o,apiKey:r}),i=S(e.layers,s.layers,t),c=S(e.tables,s.tables,t);e.layers=i.itemResources,e.tables=c.itemResources;const d=[...i.added,...c.added],K=l?[...l.layers,...l.tables]:[];return await X(e,d,n,K),e}function S(e,a,t){const n=Y(e,a,(r,s)=>r.id===s.id);e=e.filter(r=>!n.removed.some(s=>s.id===r.id));const o=n.added;return o.forEach(({id:r})=>{e.push({id:r})}),{itemResources:e,added:o.filter(({id:r})=>!t.includes(r))}}async function X(e,a,t,n){const o=await Z(a),r=a.map(({id:s,type:l})=>new(o.get(l))({url:t,layerId:s,sourceJSON:n.find(({id:i})=>i===s)}));await Promise.allSettled(r.map(s=>s.load())),r.forEach(s=>{const{layerId:l,loaded:i,defaultPopupTemplate:c}=s;if(!i||c==null)return;const d={id:l,popupInfo:c.toJSON()};s.operationalLayerType!=="ArcGISFeatureLayer"&&(d.layerType=s.operationalLayerType),R(s,d,e)})}async function Z(e){const a=[];e.forEach(({type:o})=>{const r=ee(o),s=_[r];a.push(s())});const t=await Promise.all(a),n=new Map;return e.forEach(({type:o},r)=>{n.set(o,t[r])}),n}function ee(e){let a;switch(e){case"Feature Layer":case"Table":a="FeatureLayer";break;case"Oriented Imagery Layer":a="OrientedImageryLayer"}return a}function R(e,a,t){e.isTable?L(t.tables,a):L(t.layers,a)}function L(e,a){const t=e.findIndex(({id:n})=>n===a.id);t===-1?e.push(a):e[t]=a}function D(e,a){if(!e.length)throw new y(`${a}:missing-parameters`,"'layers' array should contain at least one feature layer")}function ae(e,a){const t=e.map(n=>n.portalItem.id);if(new Set(t).size>1)throw new y(`${a}:invalid-parameters`,"All layers in the 'layers' array should be loaded from the same portal item")}function U(e,a){const t=e.map(n=>n.layerId);if(new Set(t).size!==t.length)throw new y(`${a}:invalid-parameters`,"'layers' array should contain only one instance each of layer or table in a feature service")}async function te(e){D(e,p),await Promise.all(e.map(a=>a.load()));for(const a of e)g(a,p,v),q({layer:a,itemType:h,errorNamePrefix:p});ae(e,p),U(e,p)}async function re(e,a){const{url:t,layerId:n,title:o,fullExtent:r,isTable:s}=e,l=m(t);a.url=(l==null?void 0:l.serverType)==="FeatureServer"?t:`${t}/${n}`,a.title||(a.title=o),a.extent=null,s||r==null||(a.extent=await P(r)),T(a,u.METADATA),T(a,u.MULTI_LAYER),b(a,u.SINGLE_LAYER),s&&b(a,u.TABLE)}function se(e,a){for(const r of e){const s=r.parsedUrl.path,l=m(s);if(!(l==null?void 0:l.url.path))throw new y(`${a}:invalid-parameters`,I(r,`has unsupported url pattern: ${s}`),{layer:r});const c=l==null?void 0:l.serverType;if(c!=="FeatureServer"&&c!=="MapServer")throw new y(`${a}:invalid-parameters`,I(r,`has unsupported server type: ${c}`),{layer:r});if(c==="MapServer"&&e.length>1)throw new y(`${a}:invalid-parameters`,"Only one layer or table in a map service can be saved")}const t=m(e[0].parsedUrl.path),n=t==null?void 0:t.url.path;if(!e.every(r=>{const s=m(r.parsedUrl.path);return(s==null?void 0:s.url.path)===n}))throw new y(`${a}:invalid-parameters`,"'layers' array should only contain layers or tables that belong to the same feature service")}async function ne(e){D(e,f),await Promise.all(e.map(a=>a.load()));for(const a of e)g(a,f,v);se(e,f),U(e,f)}async function le(e,a){let t=0,n=0;for(const{isTable:s}of a)s?n++:t++;const o=a[0].parsedUrl.path,r=m(o);if(e.url=(r==null?void 0:r.serverType)==="FeatureServer"?r.url.path:o,e.title||(e.title=r.title),e.extent=null,t>0){const s=a.map(l=>l.fullExtent).filter(G).reduce((l,i)=>l.clone().union(i));s&&(e.extent=await P(s))}T(e,u.METADATA),$(e,u.MULTI_LAYER,a.length>1),$(e,u.SINGLE_LAYER,a.length===1),$(e,u.TABLE,n>0&&t===0),N(e)}async function pe(e,a){return k({layer:e,itemType:h,validateLayer:v,createItemData:(t,n)=>J(n,[t]),errorNamePrefix:H},a)}async function fe(e,a){await te(e);const t=e[0].portalItem,n=x(t),o=await Promise.all(e.map(s=>E(s,n,a))),r=await J(t,e.map((s,l)=>({layer:s,layerJSON:o[l]})));return N(t),await t.update({data:r}),await Promise.all(e.slice(1).map(s=>s.portalItem.reload())),A(n),t.clone()}async function me(e,a,t){return z({layer:e,itemType:h,validateLayer:v,createItemData:(n,o)=>Promise.resolve(F(n)),errorNamePrefix:Q,newItem:a,setItemProperties:re},t)}async function de(e,a,t){await ne(e);const n=B({itemType:h,errorNamePrefix:f,newItem:a}),o=x(n),r=await Promise.all(e.map(l=>E(l,o,t))),s=await M(e.map((l,i)=>({layer:l,layerJSON:r[i]})));await le(n,e),await V(n,s,t);for(const l of e)l.portalItem=n.clone();return A(o),n}export{pe as save,fe as saveAll,de as saveAllAs,me as saveAs}; +import{as as A,gY as _,dj as K,df as m,dY as G,gZ as P,g_ as I,f as u,g$ as $,h0 as j,r as y,i as T}from"./index-pCX-0tJH.js";import{I as k,y as g,w as E,b as z,u as B,v as V,l as N,d as q,m as b}from"./utils-YxtTVBu2.js";import{t as C}from"./fetchService-cGWNcQnc.js";import{o as x}from"./jsonContext-EgdQULbU.js";import"./requestPresets-f6ZAWLqV.js";const h="Feature Service",w="feature-layer-utils",H=`${w}-save`,Q=`${w}-save-as`,p=`${w}-saveall`,f=`${w}-saveall-as`;function v(e){return{isValid:j(e)&&(e.type!=="feature"||!e.dynamicDataSource),errorMessage:"Feature layer should be a layer or table in a map or feature service"}}function O(e){const a=[],t=[];for(const{layer:n,layerJSON:o}of e)n.isTable?t.push(o):a.push(o);return{layers:a,tables:t}}function F(e){return O([e])}async function J(e,a){return/\/\d+\/?$/.test(e.url)?F(a[0]):M(a,e)}async function M(e,a){if(!a)return e.reverse(),O(e);const{layer:{url:t,customParameters:n,apiKey:o}}=e[0];let r=await a.fetchData("json");(r==null?void 0:r.layers)!=null&&(r==null?void 0:r.tables)!=null||(r=await W(r,{url:t??"",customParameters:n,apiKey:o},e.map(s=>s.layer.layerId)));for(const s of e)R(s.layer,s.layerJSON,r);return r}async function W(e,a,t){e||(e={}),e.layers||(e.layers=[]),e.tables||(e.tables=[]);const{url:n,customParameters:o,apiKey:r}=a,{serviceJSON:s,layersJSON:l}=await C(n,{customParameters:o,apiKey:r}),i=S(e.layers,s.layers,t),c=S(e.tables,s.tables,t);e.layers=i.itemResources,e.tables=c.itemResources;const d=[...i.added,...c.added],Y=l?[...l.layers,...l.tables]:[];return await X(e,d,n,Y),e}function S(e,a,t){const n=_(e,a,(r,s)=>r.id===s.id);e=e.filter(r=>!n.removed.some(s=>s.id===r.id));const o=n.added;return o.forEach(({id:r})=>{e.push({id:r})}),{itemResources:e,added:o.filter(({id:r})=>!t.includes(r))}}async function X(e,a,t,n){const o=await Z(a),r=a.map(({id:s,type:l})=>new(o.get(l))({url:t,layerId:s,sourceJSON:n.find(({id:i})=>i===s)}));await Promise.allSettled(r.map(s=>s.load())),r.forEach(s=>{const{layerId:l,loaded:i,defaultPopupTemplate:c}=s;if(!i||c==null)return;const d={id:l,popupInfo:c.toJSON()};s.operationalLayerType!=="ArcGISFeatureLayer"&&(d.layerType=s.operationalLayerType),R(s,d,e)})}async function Z(e){const a=[];e.forEach(({type:o})=>{const r=ee(o),s=K[r];a.push(s())});const t=await Promise.all(a),n=new Map;return e.forEach(({type:o},r)=>{n.set(o,t[r])}),n}function ee(e){let a;switch(e){case"Feature Layer":case"Table":a="FeatureLayer";break;case"Oriented Imagery Layer":a="OrientedImageryLayer"}return a}function R(e,a,t){e.isTable?L(t.tables,a):L(t.layers,a)}function L(e,a){const t=e.findIndex(({id:n})=>n===a.id);t===-1?e.push(a):e[t]=a}function D(e,a){if(!e.length)throw new y(`${a}:missing-parameters`,"'layers' array should contain at least one feature layer")}function ae(e,a){const t=e.map(n=>n.portalItem.id);if(new Set(t).size>1)throw new y(`${a}:invalid-parameters`,"All layers in the 'layers' array should be loaded from the same portal item")}function U(e,a){const t=e.map(n=>n.layerId);if(new Set(t).size!==t.length)throw new y(`${a}:invalid-parameters`,"'layers' array should contain only one instance each of layer or table in a feature service")}async function te(e){D(e,p),await Promise.all(e.map(a=>a.load()));for(const a of e)N(a,p,v),q({layer:a,itemType:h,errorNamePrefix:p});ae(e,p),U(e,p)}async function re(e,a){const{url:t,layerId:n,title:o,fullExtent:r,isTable:s}=e,l=m(t);a.url=(l==null?void 0:l.serverType)==="FeatureServer"?t:`${t}/${n}`,a.title||(a.title=o),a.extent=null,s||r==null||(a.extent=await P(r)),I(a,u.METADATA),I(a,u.MULTI_LAYER),T(a,u.SINGLE_LAYER),s&&T(a,u.TABLE)}function se(e,a){for(const r of e){const s=r.parsedUrl.path,l=m(s);if(!(l==null?void 0:l.url.path))throw new y(`${a}:invalid-parameters`,b(r,`has unsupported url pattern: ${s}`),{layer:r});const c=l==null?void 0:l.serverType;if(c!=="FeatureServer"&&c!=="MapServer")throw new y(`${a}:invalid-parameters`,b(r,`has unsupported server type: ${c}`),{layer:r});if(c==="MapServer"&&e.length>1)throw new y(`${a}:invalid-parameters`,"Only one layer or table in a map service can be saved")}const t=m(e[0].parsedUrl.path),n=t==null?void 0:t.url.path;if(!e.every(r=>{const s=m(r.parsedUrl.path);return(s==null?void 0:s.url.path)===n}))throw new y(`${a}:invalid-parameters`,"'layers' array should only contain layers or tables that belong to the same feature service")}async function ne(e){D(e,f),await Promise.all(e.map(a=>a.load()));for(const a of e)N(a,f,v);se(e,f),U(e,f)}async function le(e,a){let t=0,n=0;for(const{isTable:s}of a)s?n++:t++;const o=a[0].parsedUrl.path,r=m(o);if(e.url=(r==null?void 0:r.serverType)==="FeatureServer"?r.url.path:o,e.title||(e.title=r.title),e.extent=null,t>0){const s=a.map(l=>l.fullExtent).filter(G).reduce((l,i)=>l.clone().union(i));s&&(e.extent=await P(s))}I(e,u.METADATA),$(e,u.MULTI_LAYER,a.length>1),$(e,u.SINGLE_LAYER,a.length===1),$(e,u.TABLE,n>0&&t===0),E(e)}async function pe(e,a){return k({layer:e,itemType:h,validateLayer:v,createItemData:(t,n)=>J(n,[t]),errorNamePrefix:H},a)}async function fe(e,a){await te(e);const t=e[0].portalItem,n=x(t),o=await Promise.all(e.map(s=>g(s,n,a))),r=await J(t,e.map((s,l)=>({layer:s,layerJSON:o[l]})));return E(t),await t.update({data:r}),await Promise.all(e.slice(1).map(s=>s.portalItem.reload())),A(n),t.clone()}async function me(e,a,t){return z({layer:e,itemType:h,validateLayer:v,createItemData:(n,o)=>Promise.resolve(F(n)),errorNamePrefix:Q,newItem:a,setItemProperties:re},t)}async function de(e,a,t){await ne(e);const n=B({itemType:h,errorNamePrefix:f,newItem:a}),o=x(n),r=await Promise.all(e.map(l=>g(l,o,t))),s=await M(e.map((l,i)=>({layer:l,layerJSON:r[i]})));await le(n,e),await V(n,s,t);for(const l of e)l.portalItem=n.clone();return A(o),n}export{pe as save,fe as saveAll,de as saveAllAs,me as saveAs}; diff --git a/dist/assets/featureSetUtils-0rkR6o7D.js b/dist/assets/featureSetUtils-0rkR6o7D.js new file mode 100644 index 0000000..60aa7f4 --- /dev/null +++ b/dist/assets/featureSetUtils-0rkR6o7D.js @@ -0,0 +1,7 @@ +import{dE as je,j1 as qe,h6 as Ge,gD as Ue,de as Be,aL as x,j0 as Me,an as he,ao as ce,r as We,d2 as se,fs as $e,j3 as Ve,K as j,eL as Qe,es as U,oU as Re,rs as ke,rt as fe,em as Ze,av as G,fZ as ze,my as pe,kB as _e,hc as Je,ky as ye,aq as Ke}from"./index-pCX-0tJH.js";import{ap as ae,aq as b,V as Xe,ag as v,ah as ge,ai as me,aj as we,ak as Fe,al as Se,aw as $,ax as re,ay as Ye,az as X,N as He,aA as et,aB as V,aC as tt}from"./arcadeUtils-vGyJZHQt.js";import{x as T,s as C,a as D,n as N,t as L,r as it}from"./WhereClause-FOYoIAAW.js";import{x as O,t as y,g as P,m as Q,a as R,y as st,L as at,w as K,E as Ie,T as be,S as Ce,F as rt,v as ve,p as nt,D as Z,I as lt,d as q,b as ot,f as ut,c as w}from"./SpatialFilter-h73GoH-a.js";import{c as dt,b as ht,n as ct}from"./TimeOnly-gkehHHJx.js";import k from"./FeatureLayer-9tNCmEbA.js";import xe from"./SubtypeGroupLayer-lkxtOZrq.js";import{n as ft}from"./executeQueryPBF-P21isUTI.js";import{n as pt,s as _t}from"./executeForIds-PXSIkRGk.js";import{n as yt}from"./FeatureType-0WPvBvpQ.js";async function gt(h,e,t,i){return Ft(e,await mt(h,e,t,i),t,i)}async function mt(h,e,t,i){var o;const s={...i},a=St(e,t),n=((o=e.outStatistics)==null?void 0:o[0])!=null,r=je("featurelayer-pbf-statistics"),l=!n||r;let u;if((t==null?void 0:t.format)==="pbf"&&l)try{u=await ft(h,a,s)}catch(d){if(d.name!=="query:parsing-pbf")throw d;t.format="json"}return(t==null?void 0:t.format)!=="json"&&l||(u=await qe(h,a,s)),wt(t==null?void 0:t.fieldsIndex,u.fields),u}function wt(h,e){if(h!=null&&e!=null)for(const t of e){const i=h.get(t.name);i&&Object.assign(t,i.toJSON())}}async function Ft(h,e,t,i){var n;const s=t==null?void 0:t.infoFor3D;if(!Ne(h,s)||s==null||!e.assetMaps||!((n=e.features)!=null&&n.length))return Ge.fromJSON(e);const{meshFeatureSetFromJSON:a}=await Ue(Be(()=>import("./meshFeatureSet-42GYfSGc.js"),__vite__mapDeps([0,1,2,3])),i);return a(h,s,e)}function St(h,e){let t=x.from(h);t.sourceSpatialReference=t.sourceSpatialReference??(e==null?void 0:e.sourceSpatialReference)??null,(e!=null&&e.gdbVersion||e!=null&&e.dynamicDataSource)&&(t=t===h?t.clone():t,t.gdbVersion=h.gdbVersion||e.gdbVersion,t.dynamicDataSource=h.dynamicDataSource?Me.from(h.dynamicDataSource):e.dynamicDataSource);const i=e==null?void 0:e.infoFor3D;if(i!=null&&Ne(h,i)){t=t===h?t.clone():t,t.formatOf3DObjects=null;const{supportedFormats:s,queryFormats:a}=i,n=he("model/gltf-binary",s)??ce("glb",s),r=he("model/gltf+json",s)??ce("gtlf",s);for(const l of a){if(l===n){t.formatOf3DObjects=l;break}l!==r||t.formatOf3DObjects||(t.formatOf3DObjects=l)}if(!t.formatOf3DObjects)throw new We("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(t.outFields==null||!t.outFields.includes("*")){t=t===h?t.clone():t,t.outFields==null&&(t.outFields=[]);const{originX:l,originY:u,originZ:o,translationX:d,translationY:c,translationZ:p,scaleX:g,scaleY:m,scaleZ:I,rotationX:S,rotationY:f,rotationZ:_,rotationDeg:W}=i.transformFieldRoles;t.outFields.push(l,u,o,d,c,p,g,m,I,S,f,_,W)}}return t}function Ne(h,e){return e!=null&&h.returnGeometry===!0&&h.multipatchOption!=="xyFootprint"&&!h.outStatistics}let Le=class{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(e,t,i){this._layerById[t]=i,this._layerByName[e]=i}async featureSetByName(e,t=!0,i=["*"]){return this._layerByName[e]===void 0?null:this._layerByName[e]}async featureSetById(e,t=!0,i=["*"]){return this._layerById[e]===void 0?null:this._layerById[e]}castToText(e=!1){return"object, FeatureSetCollection"}};class B extends O{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof T?(this._whereclause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereclause=null)}_initialiseFeatureSet(){this._parent!==null?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.fields=[],this.typeIdField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new se({wkid:4326}),this.geometryType=ae.point)}async _getSet(e){if(this._wset===null){await this._ensureLoaded();const t=await this._parent._getFilteredSet("",null,this._whereclause,null,e);return this._checkCancelled(e),this._whereClauseFunction!==null?this._wset=new y(t._candidates.slice(0).concat(t._known.slice(0)),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new y(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){var i;let t=(i=this._parent)==null?void 0:i._isInFeatureSet(e);return t===b.NotInFeatureSet?t:(t=this._idstates[e],t===void 0?b.Unknown:t)}_getFeature(e,t,i){return this._parent._getFeature(e,t,i)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){return this._parent._featureFromCache(e)}executeWhereClause(e){var t;return((t=this._whereclause)==null?void 0:t.testFeature(e))??!1}async executeWhereClauseDeferred(e){if(this._whereClauseFunction!==null){const t=this._whereClauseFunction(e);return $e(t),t}return this.executeWhereClause(e)}async _fetchAndRefineFeatures(e,t,i){var r,l,u;const s=new y([],e,!1,null),a=Math.min(t,e.length);if(await((r=this._parent)==null?void 0:r._getFeatures(s,-1,a,i)),this._checkCancelled(i),this._whereClauseFunction==null){for(let o=0;o":case"=":if(e.left.type==="column-reference"&&e.right.type==="string"){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&this.lkp[e.right.value.toString()]!==void 0)return" ("+s+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if(e.right.type==="column-reference"&&e.left.type==="string"&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+s+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,i,F.BADNESS,a)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,F.BADNESS,a)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,F.BADNESS,a)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,F.BADNESS,a)+") "}case"null":return"null";case"boolean":return e.value===!0?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return at(e.mode==="date",t);case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+s+")":e.column;case"data-type":return e.value;case"function":{const o=this.evaluateNodeToWhereClause(e.args,t,i,F.BADNESS,a);return st(e.name,o,t)}}throw new N(L.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof T?this.reverseLkp[T.convertValueToStorageFormat(this.codefield.calculateValueCompiled(e))]:this.reverseLkp[e.attributes[this.codefield]]}};bt.BADNESS="_!!!_BAD_LKP_!!!!";class Ct extends z{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:Q(e,this.field.name,R(this._sql,v.Standardised),t.getFieldsIndex())}}extractValue(e){return T.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}let Dt=class extends O{static findField(e,t){for(const i of e)if(i.name.toLowerCase()===t.toString().toLowerCase())return i;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_initialiseFeatureSet(){this._parent!==null?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new se({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=ae.point,this.typeIdField="",this.types=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){var t;if(this._wset===null){await this._ensureLoaded();let i=null;return i=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await((t=this._parent)==null?void 0:t._getSet(e)),this._checkCancelled(e),Ve(i),this._wset=new y(i._candidates.slice(0),i._known.slice(0),i._ordered,this._clonePageDefinition(i.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(e,t,i,s){var o,d;const a=[];t!==-1&&this._featureCache[t]===void 0&&a.push(t);const n=this._maxQueryRate();if(this._checkIfNeedToExpandKnownPage(e,n)===!0)return await this._expandPagedSet(e,n,0,0,s),this._getFeatures(e,t,i,s);let r=0;for(let c=e._lastFetchedIndex;c=n)));c++);if(a.length===0)return"success";e=new y([],a,e._ordered,null);const l=Math.min(a.length,i);await((o=this._parent)==null?void 0:o._getFeatures(e,-1,l,s)),this._checkCancelled(s);const u=[];for(let c=0;c0&&(s=s.replaceFields(d))}i!==null?this._extraFilter!==null&&(i=P(this._extraFilter,i)):i=this._extraFilter,await this._ensureLoaded();const u=await this._parent._getFilteredSet(e,t,i,s,a);let o;return this._checkCancelled(a),o=n===!0?new y(u._candidates.slice(0).concat(u._known.slice(0)),[],l===!0&&u._ordered,this._clonePageDefinition(u.pagesDefinition)):new y(u._candidates.slice(0),u._known.slice(0),l===!0&&u._ordered,this._clonePageDefinition(u.pagesDefinition)),o}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(e!==null){for(const i of this.adaptedFields)if(ve(e,i.field.name)===!0){const s=i.rewriteSql(e,this);if(s.rewritten!==!0){t.cannot=!0,t.where=null;break}t.where=s.where}}return t}async _stat(e,t,i,s,a,n,r){let l=!1,u=this._reformulateWithoutAdaptions(t);if(l=u.cannot,t=u.where,u=this._reformulateWithoutAdaptions(a),l=l||u.cannot,(a=u.where)!==null?this._extraFilter!==null&&(a=P(this._extraFilter,a)):a=this._extraFilter,l===!0)return a===null&&i===""&&s===null?this._manualStat(e,t,n,r):{calculated:!1};const o=await this._parent._stat(e,t,i,s,a,n,r);return o.calculated===!1?a===null&&i===""&&s===null?this._manualStat(e,t,n,r):{calculated:!1}:o}async _canDoAggregates(e,t,i,s,a){if(this._parent===null)return!1;for(let l=0;l{for(let s=0;s0?(await $(this._refineSetBlock(e,this._maxProcessingRate(),s)),this._checkCancelled(s),this.getIdColumnDictionary(e,t,i,s)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){if(this._featureCache[e]===void 0){const t=this._parent._featureFromCache(e);return t===void 0?void 0:t===null?null:(this._featureCache[e]=t,t)}return this._featureCache[e]}async _fetchAndRefineFeatures(){throw new C(D.NeverReach)}async _getFilteredSet(e,t,i,s,a){await this._ensureLoaded();const n=await this._parent._getFilteredSet(e,t,i,s===null?this._orderbyclause:s,a);this._checkCancelled(a);const r=new y(n._candidates.slice(0),n._known.slice(0),n._ordered,this._clonePageDefinition(n.pagesDefinition));let l=!0;if(n._candidates.length>0&&(l=!1),r._ordered===!1){let u=await this.manualOrderSet(r,a);return l===!1&&(t===null&&i===null||(u=new y(u._candidates.slice(0).concat(u._known.slice(0)),[],u._ordered,this._clonePageDefinition(u.pagesDefinition)))),u}return r}static registerAction(){O._featuresetFunctions.orderBy=function(e){return e===""?this:new Ae({parentfeatureset:this,orderbyclause:new M(e)})}}getFieldsIndex(){return this._parent.getFieldsIndex()}};function Tt(h){if(h.parseTree.type==="function"){if(h.parseTree.args.value.length===0)return{name:h.parseTree.name,expr:null};if(h.parseTree.args.value.length>1)throw new N(L.MissingStatisticParameters);const e=T.create(nt(h.parseTree.args.value[0],v.Standardised,h.parameters),h.fieldsIndex,h.timeZone);return{name:h.parseTree.name,expr:e}}return null}let Te=class ee{constructor(){this.field="",this.tofieldname="",this.typeofstat="MIN",this.workingexpr=null}clone(){const e=new ee;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,i,s){const a=new ee;a.field=e;const n=T.create(t,i,s),r=Tt(n);if(r===null)throw new N(L.UnsupportedSqlFunction,{function:""});const l=r.name.toUpperCase().trim();if(l==="MIN"){if(a.typeofstat="MIN",a.workingexpr=r.expr,n===null)throw new N(L.InvalidFunctionParameters,{function:"min"})}else if(l==="MAX"){if(a.typeofstat="MAX",a.workingexpr=r.expr,n===null)throw new N(L.InvalidFunctionParameters,{function:"max"})}else if(l==="COUNT")a.typeofstat="COUNT",a.workingexpr=r.expr;else if(l==="STDEV"){if(a.typeofstat="STDDEV",a.workingexpr=r.expr,n===null)throw new N(L.InvalidFunctionParameters,{function:"stdev"})}else if(l==="SUM"){if(a.typeofstat="SUM",a.workingexpr=r.expr,n===null)throw new N(L.InvalidFunctionParameters,{function:"sum"})}else if(l==="MEAN"){if(a.typeofstat="AVG",a.workingexpr=r.expr,n===null)throw new N(L.InvalidFunctionParameters,{function:l})}else if(l==="AVG"){if(a.typeofstat="AVG",a.workingexpr=r.expr,n===null)throw new N(L.InvalidFunctionParameters,{function:"avg"})}else{if(l!=="VAR")throw new N(L.UnsupportedSqlFunction,{function:l});if(a.typeofstat="VAR",a.workingexpr=r.expr,n===null)throw new N(L.InvalidFunctionParameters,{function:"var"})}return a}toStatisticsName(){switch(this.typeofstat.toUpperCase()){case"MIN":return"min";case"MAX":return"max";case"SUM":return"sum";case"COUNT":default:return"count";case"VAR":return"var";case"STDDEV":return"stddev";case"AVG":return"avg"}}};function Rt(h){if(!h)return"COUNT";switch(h.toLowerCase()){case"max":return"MAX";case"var":case"variance":return"VAR";case"avg":case"average":case"mean":return"AVG";case"min":return"MIN";case"sum":return"SUM";case"stdev":case"stddev":return"STDDEV";case"count":return"COUNT"}return"COUNT"}let kt=class Oe extends O{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="esri.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(this._wset===null){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return b.InFeatureSet}_nextUniqueName(e){for(;e["T"+this._uniqueIds.toString()]===1;)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,i=1;const s=this._parent?this._parent.getFieldsIndex():new Qe([]);for(this.objectIdField="ROW__ID",this.globalIdField="";t===!1;){let n=!1;for(let r=0;r0)for(const n of this._parent.fields)this._adaptedFields.push(new Y(n));for(let n=0;n0&&(l=new Dt({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),r.nowhereclause===!0)n=new y(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new H({parentfeatureset:l,orderbyclause:new M(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let u=l;if(i!==null){let o=null;i&&(o=this._reformulateWhereClauseWithoutGroupByFields(i)),u=new B({parentfeatureset:u,whereclause:o})}n=new y(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new H({parentfeatureset:u,orderbyclause:new M(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return n}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=Q(e,t.tofieldname,R(t.workingexpr,v.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=Q(e,t.tofieldname,R(t.expression,v.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const i of this._decodedGroupbyfield)i.tofieldname!==i.name&&t.push({field:i.tofieldname,newfield:i.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return e===null?null:e.aggregatefeaturesetpagedefinition===!0?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,i){return this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)===!0?(await this._expandPagedSet(e,this._maxQuery,0,0,i),this._refineSetBlock(e,t,i)):(this._checkCancelled(i),e._candidates.length,this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e)}_expandPagedSet(e,t,i,s,a){return this._expandPagedSetFeatureSet(e,t,i,s,a)}async _getPhysicalPage(e,t,i){if(e.pagesDefinition.aggregatefeaturesetpagedefinition===!0)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,i,[]);const s=await this._getAgregagtePhysicalPage(e,t,i);for(const a of s){const n={geometry:a.geometry,attributes:{}},r={};for(const l in a.attributes)r[l.toLowerCase()]=a.attributes[l];for(const l of this._decodedGroupbyfield)n.attributes[l.tofieldname]=r[l.name.toLowerCase()];for(const l of this._decodedStatsfield)n.attributes[l.tofieldname]=r[l.field.toLowerCase()];this._featureCache[n.attributes[this.objectIdField]]=new j(n)}return s.length}_sequentialGetPhysicalItem(e,t,i,s){return new Promise((a,n)=>{e.pagesDefinition.internal.iterator===null&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),e.pagesDefinition.internal.fullyResolved===!0||t===0?a(s.length):this._nextAggregateItem(e,t,i,s,r=>{r===null?a(s.length):(t-=1,a(this._sequentialGetPhysicalItem(e,t,i,s)))},n)})}_nextAggregateItem(e,t,i,s,a,n){try{$(e.pagesDefinition.internal.iterator.next()).then(r=>{if(r===null)if(e.pagesDefinition.internal.workingItem!==null){const l=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);s.push(l),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(l.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,a(null)}else e.pagesDefinition.internal.fullyResolved=!0,a(null);else{const l=this._generateAggregateHash(r);if(e.pagesDefinition.internal.workingItem===null)e.pagesDefinition.internal.workingItem={features:[r],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const u=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return s.push(u),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(u.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[r],id:l},void a(u)}e.pagesDefinition.internal.workingItem.features.push(r)}this._nextAggregateItem(e,t,i,s,a,n)}},n)}catch(r){n(r)}}_calculateFieldStat(e,t,i){const s=[];for(let a=0;athis._topnum&&(this._wset._known=this._wset._known.slice(0,this._topnum)),this._setKnownLength(this._wset)>=this._topnum&&(this._wset._candidates=[]),this._wset}return this._wset}_setKnownLength(e){return e._known.length>0&&e._known[e._known.length-1]==="GETPAGES"?e._known.length-1:e._known.length}_isInFeatureSet(e){const t=this._parent._isInFeatureSet(e);if(t===b.NotInFeatureSet)return t;const i=this._idstates[e];return i===b.InFeatureSet||i===b.NotInFeatureSet?i:t===b.InFeatureSet&&i===void 0?this._countedinthis._topnum&&(t=this._topnum),this._countedin>=this._topnum&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset){let r=e._known.length;return r>0&&e._known[r-1]==="GETPAGES"&&(e._known.length=r-1),r=e._candidates.length,r>0&&e._candidates[r-1]==="GETPAGES"&&(e._candidates.length=r-1),"success"}const n=await this._parent._expandPagedSet(e,t,i,s,a);return this._setKnownLength(e)>this._topnum&&(e._known.length=this._topnum),this._setKnownLength(e)>=this._topnum&&(e._candidates.length=0),n}async _getFeatures(e,t,i,s){const a=[],n=this._maxQueryRate();if(this._checkIfNeedToExpandKnownPage(e,n)===!0)return await this._expandPagedSet(e,n,0,0,s),this._getFeatures(e,t,i,s);t!==-1&&this._featureCache[t]===void 0&&a.push(t);let r=0;for(let o=e._lastFetchedIndex;on)));o++);if(a.length===0)return"success";const l=new y([],a,!1,null),u=Math.min(a.length,i);await this._parent._getFeatures(l,-1,u,s);for(let o=0;o=this._topnum)break}else if(r===b.NotInFeatureSet)s===null?s={start:n,end:n}:s.end===n-1?s.end=n:(a.push(s),s={start:n,end:n}),i+=1;else if(r===b.Unknown)break;if(i>=t)break}s!==null&&a.push(s);for(let n=a.length-1;n>=0;n--)e._candidates.splice(a[n].start,a[n].end-a[n].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){O._featuresetFunctions.top=function(e){return new ne({parentfeatureset:this,topnum:e})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}let vt=class te extends O{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,e.outFields!==void 0&&(this._overrideFields=e.outFields),e.includeGeometry!==void 0&&(this._removeGeometry=e.includeGeometry===!1)}_maxQueryRate(){return re}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+Ye(e.toJSON());return Re(t,ke.String)}async loadImpl(){return this._layer.loaded===!0?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){var e,t,i,s,a,n;if(this.spatialReference==null&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this.hasZ=((i=(t=(e=this._layer)==null?void 0:e.capabilities)==null?void 0:t.data)==null?void 0:i.supportsZ)===!0,this.hasM=((n=(a=(s=this._layer)==null?void 0:s.capabilities)==null?void 0:a.data)==null?void 0:n.supportsM)===!0,this._overrideFields!==null)if(this._overrideFields.length===1&&this._overrideFields[0]==="*")this._overrideFields=null;else{const r=[],l=[];for(const u of this.fields)if(u.type==="oid")r.push(u),l.push(u.name);else for(const o of this._overrideFields)if(o.toLowerCase()===u.name.toLowerCase()){r.push(u),l.push(u.name);break}this.fields=r,this._overrideFields=l}if(this._layer.source&&this._layer.source.sourceJSON){const r=this._layer.source.sourceJSON.currentVersion;this._layer.source.sourceJSON.useStandardizedQueries===!0?(this._databaseType=v.StandardisedNoInterval,r!=null&&r>=10.61&&(this._databaseType=v.Standardised)):r!=null&&(r>=10.5&&(this._databaseType=v.StandardisedNoInterval,this._requestStandardised=!0),r>=10.61&&(this._databaseType=v.Standardised))}this.objectIdField=this._layer.objectIdField;for(const r of this.fields)r.type==="global-id"&&(this.globalIdField=r.name);this._layer instanceof xe?(this.typeIdField=this._layer.subtypeField??"",this.types=this._layer.subtypes):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types)}_isInFeatureSet(){return b.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(this._wset===null){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new x;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch{return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||this._layer.capabilities.query.supportsPagination!==!0)}_cacheableFeatureSetSourceKey(){return this._layer.url}pbfSupportedForQuery(e){var i,s;const t=(s=(i=this._layer)==null?void 0:i.capabilities)==null?void 0:s.query;return!e.outStatistics&&(t==null?void 0:t.supportsFormatPBF)===!0&&(t==null?void 0:t.supportsQuantizationEditMode)===!0}async queryPBF(e){return e.quantizationParameters={mode:"edit"},(await gt(this._layer.parsedUrl,e,{format:"pbf"},{})).unquantize()}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}executeQuery(e,t){e.returnZ=this.hasZ,e.returnM=this.hasM;const i=t==="execute"?pe:t==="executeForCount"?pt:_t,s=t==="execute"&&this.pbfSupportedForQuery(e);let a=null;if(this.recentlyUsedQueries){const n=this.convertQueryToLruCacheKey(e);a=this.recentlyUsedQueries.getFromCache(n),a===null&&(a=s!==!0?i(this._layer.parsedUrl.path,e):this.queryPBF(e),this.recentlyUsedQueries.addToCache(n,a),a=a.catch(r=>{var l;throw(l=this.recentlyUsedQueries)==null||l.removeFromCache(n),r}))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),a===null&&(a=s!==!0?i(this._layer.parsedUrl.path,e):this.queryPBF(e)),a}async _getFilteredSet(e,t,i,s,a){const n=await this.databaseType();if(this.isTable()&&t&&e!==null&&e!=="")return new y([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,i,s,a);let r="",l=!1;s!==null&&this._layer.capabilities&&this._layer.capabilities.query&&this._layer.capabilities.query.supportsOrderBy===!0&&(r=s.constructClause(),l=!0);const u=new x;this.datesInUnknownTimezone&&(u.timeReferenceUnknownClient=!0),u.where=i===null?t===null?"1=1":"":R(i,n),this._requestStandardised&&(u.sqlFormat="standard"),u.spatialRelationship=this._makeRelationshipEnum(e),u.outSpatialReference=this.spatialReference,u.orderByFields=r!==""?r.split(","):null,u.geometry=t===null?null:t,u.relationParameter=this._makeRelationshipParam(e);let o=await this.executeQuery(u,"executeForIds");return o===null&&(o=[]),this._checkCancelled(a),new y([],o,l,null)}_expandPagedSet(e,t,i,s,a){return this._expandPagedSetFeatureSet(e,t,i,s,a)}async _getFilteredSetUsingPaging(e,t,i,s,a){var p;let n="",r=!1;s!==null&&this._layer.capabilities&&this._layer.capabilities.query&&this._layer.capabilities.query.supportsOrderBy===!0&&(n=s.constructClause(),r=!0);const l=await this.databaseType();let u=i===null?t===null?"1=1":"":R(i,l);this._layer.definitionExpression&&this._useDefinitionExpression&&(u=u!==""?"(("+this._layer.definitionExpression+") AND ("+u+"))":this._layer.definitionExpression);let o=this._maxQueryRate();const d=(p=this._layer.capabilities)==null?void 0:p.query.maxRecordCount;d!=null&&d=this._maxProcessingRate()-1))break}if(n>=i&&a.length===0)break}if(a.length===0)return"success";const r=new x;this._requestStandardised&&(r.sqlFormat="standard"),this.datesInUnknownTimezone&&(r.timeReferenceUnknownClient=!0),r.objectIds=a,r.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),r.returnGeometry=!0,this._removeGeometry===!0&&(r.returnGeometry=!1),r.outSpatialReference=this.spatialReference;const l=await this.executeQuery(r,"execute");if(this._checkCancelled(s),l.error!==void 0)throw new C(D.RequestFailed,{reason:l.error});const u=this._layer.objectIdField;for(let o=0;o=r)break}return m.features.length===0?l:m.features.length===((S=this._layer.capabilities)==null?void 0:S.query.maxRecordCount)&&l.length"+e.pagesDefinition.internal.lastMaxId.toString()+")":e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString());const a=e.pagesDefinition.internal.lastRetrieved,n=a,r=e.pagesDefinition.internal.lastPage,l=new x;if(this._requestStandardised&&(l.sqlFormat="standard"),l.where=s,l.spatialRelationship=e.pagesDefinition.spatialRel,l.relationParameter=e.pagesDefinition.relationParam,l.outFields=e.pagesDefinition.outFields,l.outStatistics=e.pagesDefinition.outStatistics,l.geometry=e.pagesDefinition.geometry,l.groupByFieldsForStatistics=e.pagesDefinition.groupByFieldsForStatistics,l.num=e.pagesDefinition.resultRecordCount,l.start=e.pagesDefinition.internal.lastPage,l.returnGeometry=e.pagesDefinition.returnGeometry,this.datesInUnknownTimezone&&(l.timeReferenceUnknownClient=!0),l.orderByFields=e.pagesDefinition.orderByFields!==""?e.pagesDefinition.orderByFields.split(","):null,this.isTable()&&l.geometry&&l.spatialRelationship)return[];const u=await this.executeQuery(l,"execute");if(this._checkCancelled(i),!u.hasOwnProperty("features"))throw new C(D.InvalidStatResponse);const o=[];if(e.pagesDefinition.internal.lastPage!==r)return[];u.features.length>0&&u.features[0].attributes[e.pagesDefinition.generatedOid]===void 0&&(e.pagesDefinition.generatedOid=e.pagesDefinition.generatedOid.toLowerCase());for(let d=0;d0||i&&i>0)&&(r.size=[t&&t>0?t:0,i&&i>0?i:t+1]),s&&s.length>0&&(r.attachmentTypes=s),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:r,method:"attachments"});const l=await this._layer.queryAttachments(r),u=[];return l&&l[e]&&l[e].forEach(o=>{const d=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+o.id.toString();let c=null;a&&o.exifInfo&&(c=He.convertJsonToArcade(o.exifInfo,"system",!0)),u.push(new et(o.id,o.name,o.contentType,o.size,d,c,o.keywords??null))}),u}return[]}async queryRelatedFeatures(e){var s;const t={f:"json",relationshipId:e.relationshipId.toString(),definitionExpression:e.where,outFields:(s=e.outFields)==null?void 0:s.join(","),returnGeometry:e.returnGeometry.toString()};e.resultOffset!==void 0&&e.resultOffset!==null&&(t.resultOffset=e.resultOffset.toString()),e.resultRecordCount!==void 0&&e.resultRecordCount!==null&&(t.resultRecordCount=e.resultRecordCount.toString()),e.orderByFields&&(t.orderByFields=e.orderByFields.join(",")),e.objectIds&&e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=Ze(e.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await G(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(i.data){const a={},n=i.data;if(n!=null&&n.relatedRecordGroups){const r=n.spatialReference;for(const l of n.relatedRecordGroups){const u=l.objectId,o=[];for(const d of l.relatedRecords){d.geometry&&(d.geometry.spatialReference=r);const c=new j({geometry:d.geometry?ze(d.geometry):null,attributes:d.attributes});o.push(c)}a[u]={features:o,exceededTransferLimit:n.exceededTransferLimit===!0}}}return a}throw new C(D.InvalidRequest)}async getFeatureByObjectId(e,t){const i=new x;i.outFields=t,i.returnGeometry=!1,i.outSpatialReference=this.spatialReference,i.where=this.objectIdField+"="+e.toString(),this.datesInUnknownTimezone&&(i.timeReferenceUnknownClient=!0),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:i,method:"execute"});const s=await pe(this._layer.parsedUrl.path,i);return s.features.length===1?s.features[0]:null}async getIdentityUser(){var t;await this.load();const e=(t=_e)==null?void 0:t.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){var s,a;await this.load();const e=(s=_e)==null?void 0:s.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const i=t.toLowerCase().indexOf("/rest/services");if(t=i>-1?t.substring(0,i):t,t){t+="/rest/info";try{const n=await G(t,{query:{f:"json"}});let r="";return(a=n.data)!=null&&a.owningSystemUrl&&(r=n.data.owningSystemUrl),r}catch{return""}}return""}getDataSourceFeatureSet(){const e=new te({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){var a,n;if(this.fsetInfo)return this.fsetInfo;let e=null,{parsedUrl:{path:t},serviceItemId:i=null}=this._layer;if(t){const r=await G(t,{responseType:"json",query:{f:"json"}});e=((a=r==null?void 0:r.data)==null?void 0:a.name)??null,i=((n=r==null?void 0:r.data)==null?void 0:n.serviceItemId)??null}const s=this._layer.title&&(this._layer.parent??null)!==null;return this.featureSetInfo={layerId:this._layer.layerId,layerName:e===""?null:e,itemId:i===""?null:i,serviceLayerUrl:t===""?null:t,webMapLayerId:s?this._layer.id??null:null,webMapLayerTitle:s?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}};class le extends O{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,e.isTable===!0&&(this._forceIsTable=!0),e.outFields!==void 0&&(this._overrideFields=e.outFields),e.includeGeometry!==void 0&&(this._removeGeometry=e.includeGeometry===!1)}_maxQueryRate(){return re}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return this._layer.loaded===!0?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}get gdbVersion(){return""}_initialiseFeatureSet(){var e,t,i,s,a,n;if(this.spatialReference==null&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this._overrideFields!==null)if(this._overrideFields.length===1&&this._overrideFields[0]==="*")this._overrideFields=null;else{const r=[],l=[];for(const u of this.fields)if(u.type==="oid")r.push(u),l.push(u.name);else for(const o of this._overrideFields)if(o.toLowerCase()===u.name.toLowerCase()){r.push(u),l.push(u.name);break}this.fields=r,this._overrideFields=l}this.objectIdField=this._layer.objectIdField;for(const r of this.fields)r.type==="global-id"&&(this.globalIdField=r.name);this._databaseType=v.Standardised,this.hasZ=((i=(t=(e=this._layer)==null?void 0:e.capabilities)==null?void 0:t.data)==null?void 0:i.supportsZ)===!0,this.hasM=((n=(a=(s=this._layer)==null?void 0:s.capabilities)==null?void 0:a.data)==null?void 0:n.supportsM)===!0,this._layer instanceof xe?(this.typeIdField=this._layer.subtypeField??"",this.types=this._layer.subtypes):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types)}isTable(){return this._forceIsTable||this._layer.isTable||this._layer.type==="table"||!this._layer.geometryType}_isInFeatureSet(){return b.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(this._wset===null){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new j({geometry:this._removeGeometry===!0?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,a){let n="",r=!1;if(s!==null&&(n=s.constructClause(),r=!0),this.isTable()&&t&&e!==null&&e!=="")return new y([],[],!0,null);const l=new x;l.returnZ=this.hasZ,l.returnM=this.hasM,l.where=i===null?t===null?"1=1":"":R(i,v.Standardised),l.spatialRelationship=this._makeRelationshipEnum(e),l.outSpatialReference=this.spatialReference,l.orderByFields=n!==""?n.split(","):null,l.geometry=t===null?null:t,l.returnGeometry=!0,l.relationParameter=this._makeRelationshipParam(e);const u=await this._layer.queryFeatures(l);if(u===null)return new y([],[],r,null);this._checkCancelled(a);const o=[];return u.features.forEach(d=>{const c=d.attributes[this._layer.objectIdField];o.push(c),this._featureCache[c]=this._changeFeature(d)}),new y([],o,r,null)}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _queryAllFeatures(){if(this._wset)return this._wset;const e=new x;if(e.where="1=1",await this._ensureLoaded(),this._layer.source&&this._layer.source.items){const s=[];return this._layer.source.items.forEach(a=>{const n=a.attributes[this._layer.objectIdField];s.push(n),this._featureCache[n]=this._changeFeature(a)}),this._wset=new y([],s,!1,null),this._wset}e.returnZ=this.hasZ,e.returnM=this.hasM;const t=await this._layer.queryFeatures(e),i=[];return t.features.forEach(s=>{const a=s.attributes[this._layer.objectIdField];i.push(a),this._featureCache[a]=this._changeFeature(s)}),this._wset=new y([],i,!1,null),this._wset}async _getFeatures(e,t,i){const s=[];t!==-1&&this._featureCache[t]===void 0&&s.push(t);for(let a=e._lastFetchedIndex;ai)));a++);if(s.length===0)return"success";throw new C(D.MissingFeatures)}async _refineSetBlock(e){return e}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}relationshipMetaData(){return[]}static _cloneAttr(e){const t={};for(const i in e)t[i]=e[i];return t}nativeCapabilities(){return{title:this._layer.title??"",canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(e,t){var g,m,I,S;let i=e.layerDefinition.objectIdField;const s=e.layerDefinition.typeIdField??"",a=[];if(e.layerDefinition.types)for(const f of e.layerDefinition.types)a.push(yt.fromJSON(f));let n=e.layerDefinition.geometryType;n===void 0&&(n=e.featureSet.geometryType||"");let r=e.featureSet.features;const l=t.toJSON();if(!i){let f=!1;for(const _ of e.layerDefinition.fields)if(_.type==="oid"||_.type==="esriFieldTypeOID"){i=_.name,f=!0;break}if(f===!1){let _="FID",W=!0,de=0;for(;W;){let E=!0;for(const Pe of e.layerDefinition.fields)if(Pe.name===_){E=!1;break}E===!0?W=!1:(de++,_="FID"+de.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:_,alias:_});const J=[];for(let E=0;E_.name):["*"]);u.outFields=o,u.relationshipId=this.relationship.id,u.where="1=1";let d=!0;this._removeGeometry===!0&&(d=!1),u.returnGeometry=d,this._requestStandardised&&(u.sqlFormat="standard"),u.outSpatialReference=this.spatialReference,u.orderByFields=r!==""?r.split(","):null;const c=await n.source.queryRelatedFeatures(u);this._checkCancelled(a);const p=c[this._findObjectId]?c[this._findObjectId].features:[],g=[];for(let _=0;__.name):["*"]);return g=new y(c||p?["GETPAGES"]:[],c||p?[]:["GETPAGES"],r,{outFields:I.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:u,orderByFields:n,returnGeometry:m,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(g,o,0,0,a),g}_expandPagedSet(e,t,i,s,a){return this._expandPagedSetFeatureSet(e,t,i,s,a)}_clonePageDefinition(e){return e===null?null:e.groupbypage!==!0?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,a=s,n=e.pagesDefinition.internal.lastPage,r=this._layer.nativeCapabilities(),l=new ye;this._requestStandardised===!0&&(l.sqlFormat="standard"),l.relationshipId=this.relationship.id,l.objectIds=e.pagesDefinition.objectIds,l.resultOffset=e.pagesDefinition.internal.lastPage,l.resultRecordCount=e.pagesDefinition.resultRecordCount,l.outFields=e.pagesDefinition.outFields.split(","),l.where=e.pagesDefinition.where,l.orderByFields=e.pagesDefinition.orderByFields!==""?e.pagesDefinition.orderByFields.split(","):null,l.returnGeometry=e.pagesDefinition.returnGeometry,l.outSpatialReference=this.spatialReference;const u=await r.source.queryRelatedFeatures(l);if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return 0;const o=u[this._findObjectId]?u[this._findObjectId].features:[];for(let c=0;ci)))&&!(r>=i&&a.length===0);l++);if(a.length===0)return"success";throw new C(D.MissingFeatures)}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,s,a,n,r){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,s,a){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,i,s,a){return this._relatedLayer.queryAttachments(e,t,i,s,a)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){var e;return((e=this._relatedLayer)==null?void 0:e.preferredTimeZone)??null}get dateFieldsTimeZone(){var e;return((e=this._relatedLayer)==null?void 0:e.dateFieldsTimeZone)??null}get datesInUnknownTimezone(){var e;return(e=this._relatedLayer)==null?void 0:e.datesInUnknownTimezone}get editFieldsInfo(){var e;return((e=this._relatedLayer)==null?void 0:e.editFieldsInfo)??null}get timeInfo(){var e;return((e=this._relatedLayer)==null?void 0:e.timeInfo)??null}async getFeatureSetInfo(){return this.fsetInfo??this._layer.featureSetInfo}}function Nt(){w.applicationCache===null&&(w.applicationCache=new w)}async function ie(h,e){if(w.applicationCache){const t=w.applicationCache.getLayerInfo(h);if(t){const a=await t;return new k({url:h,outFields:e,sourceJSON:a})}const i=new k({url:h,outFields:e}),s=(async()=>(await i.load(),i.sourceJSON))();if(w.applicationCache){w.applicationCache.setLayerInfo(h,s);try{return await s,i}catch(a){throw w.applicationCache.clearLayerInfo(h),a}}return await s,i}return new k({url:h,outFields:e})}async function oe(h,e,t,i,s,a=null){return A(await ie(h,["*"]),e,t,i,s,a)}function A(h,e=null,t=null,i=!0,s=null,a=null){if(h instanceof k||V(h)){const r={layer:h,spatialReference:e,outFields:t,includeGeometry:i,lrucache:s,interceptor:a};return h.url||!h.source?new vt(r):new le(r)}const n=A(h.parent,e,t,i,s,a);return n.filter(T.create(h.parent.subtypeField+"="+h.subtypeCode.toString(),h.parent.fieldsIndex,n.dateFieldsTimeZoneDefaultUTC))}async function Lt(h){if(w.applicationCache!==null){const t=w.applicationCache.getLayerInfo(h);if(t!==null)return t}const e=(async()=>{const t=await G(h,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(w.applicationCache!==null){w.applicationCache.setLayerInfo(h,e);try{return await e}catch(t){throw w.applicationCache.clearLayerInfo(h),t}}return e}async function At(h,e){const t="QUERYDATAELEMTS:"+e.toString()+":"+h;if(w.applicationCache!==null){const s=w.applicationCache.getLayerInfo(t);if(s!==null)return s}const i=(async()=>{var a;const s=await G(h+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([e.toString()]),f:"json"}});if(s.data){const n=s.data;if((a=n.layerDataElements)!=null&&a[0])return n.layerDataElements[0]}throw new C(D.DataElementsNotFound)})();if(w.applicationCache!==null){w.applicationCache.setLayerInfo(t,i);try{return await i}catch(s){throw w.applicationCache.clearLayerInfo(t),s}}return i}async function Ee(h){if(w.applicationCache!==null){const t=w.applicationCache.getLayerInfo(h);if(t!==null)return t}const e=(async()=>{const t=await G(h,{responseType:"json",query:{f:"json"}});if(t.data){const i=t.data;return i.layers||(i.layers=[]),i.tables||(i.tables=[]),i}return{layers:[],tables:[]}})();if(w.applicationCache!==null){w.applicationCache.setLayerInfo(h,e);try{return await e}catch(t){throw w.applicationCache.clearLayerInfo(h),t}}return e}async function Ot(h,e){var s,a,n;const t={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null},i=await Ee(h);if(t.metadata=i,((s=i.controllerDatasetLayers)==null?void 0:s.utilityNetworkLayerId)!==void 0&&i.controllerDatasetLayers.utilityNetworkLayerId!==null){if(i.layers)for(const u of i.layers)t.layerNameLkp[u.id]=u.name;if(i.tables)for(const u of i.tables)t.layerNameLkp[u.id]=u.name;const r=i.controllerDatasetLayers.utilityNetworkLayerId;t.networkId=r;const l=await At(h,r);if(l){t.queryelem=l,(a=t.queryelem)!=null&&a.dataElement&&t.queryelem.dataElement.schemaGeneration!==void 0&&(t.unVersion=t.queryelem.dataElement.schemaGeneration),t.lkp={},t.queryelem.dataElement.domainNetworks||(t.queryelem.dataElement.domainNetworks=[]);for(const o of t.queryelem.dataElement.domainNetworks){for(const d of o.edgeSources??[]){const c={layerId:d.layerId,sourceId:d.sourceId,className:t.layerNameLkp[d.layerId]??null};c.className&&(t.lkp[c.className]=c)}for(const d of o.junctionSources??[]){const c={layerId:d.layerId,sourceId:d.sourceId,className:t.layerNameLkp[d.layerId]??null};c.className&&(t.lkp[c.className]=c)}}if(t.queryelem.dataElement.terminalConfigurations)for(const o of t.queryelem.dataElement.terminalConfigurations)for(const d of o.terminals)t.terminals.push({terminalId:d.terminalId,terminalName:d.terminalName});const u=await Lt(h+"/"+r);if(((n=u.systemLayers)==null?void 0:n.associationsTableId)!==void 0&&u.systemLayers.associationsTableId!==null){const o=[];t.unVersion>=4&&(o.push("STATUS"),o.push("PERCENTALONG"));let d=await oe(h+"/"+u.systemLayers.associationsTableId.toString(),e,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...o],!1,null,null);return await d.load(),t.unVersion>=4&&(d=d.filter(T.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63)",d.getFieldsIndex(),d.dateFieldsTimeZoneDefaultUTC)),await d.load()),{lkp:t.lkp,associations:d,unVersion:t.unVersion,terminals:t.terminals}}return{associations:null,unVersion:t.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:t.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:t.unVersion,lkp:null,terminals:[]}}async function Et(h,e,t,i=null,s=null,a=!0,n=null,r=null){let l=h.serviceUrl();if(!l)return null;l=l.charAt(l.length-1)==="/"?l+e.relatedTableId.toString():l+"/"+e.relatedTableId.toString();const u=await oe(l,i,s,a,n,r);return new xt({layer:h,relatedLayer:u,relationship:e,objectId:t,spatialReference:i,outFields:s,includeGeometry:a,lrucache:n,interceptor:r})}B.registerAction(),kt.registerAction(),H.registerAction(),ut.registerAction(),ne.registerAction();class Pt extends Le{constructor(e,t=null,i=null,s=null){super(),this._map=e,this._overridespref=t,this._lrucache=i,this._interceptor=s,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,i=null){const s=A(e,this._overridespref,i===null?["*"]:i,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async featureSetByName(e,t=!0,i=null){if(this._map.loaded!==void 0&&this._map.load!==void 0&&this._map.loaded===!1)return await this._map.load(),this.featureSetByName(e,t,i);i===null&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let r=0;r{if(r instanceof k){if(r.title===e)return!0}else if(V(r)){if(r.title===e)return!0;a.push(r)}return!1});if(n)return this._makeAndAddFeatureSet(n,t,i);if(this._map.tables){const r=this._map.tables.find(l=>!!(l.title&&l.title===e||l.title&&l.title===e));if(r){if(r instanceof k)return this._makeAndAddFeatureSet(r,t,i);if(!r._materializedTable){const l=r.outFields?r:{...r,outFields:["*"]};r._materializedTable=new k(l)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,i)}}for(const r of a){if(r.loadStatus==="not-loaded"||r.loadStatus==="loading")try{await r.load()}catch{}const l=r.sublayers.find(u=>u.title===e);if(l)return this._makeAndAddFeatureSet(l,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){if(this._map.loaded!==void 0&&this._map.load!==void 0&&this._map.loaded===!1)return await this._map.load(),this.featureSetById(e,t,i);i===null&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let r=0;r{if(r instanceof k){if(r.id===e)return!0}else if(V(r)){if(r.id===e)return!0;a.push(r)}return!1});if(n)return this._makeAndAddFeatureSet(n,t,i);if(this._map.tables){const r=this._map.tables.find(l=>l.id===e);if(r){if(r instanceof k)return this._makeAndAddFeatureSet(r,t,i);if(!r._materializedTable){const l={...r,outFields:["*"]};r._materializedTable=new k(l)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,i)}}for(const r of a){if(r.loadStatus==="not-loaded"||r.loadStatus==="loading")try{await r.load()}catch{}const l=r.sublayers.find(u=>u.id===e);if(l)return this._makeAndAddFeatureSet(l,t,i)}return null}}class ue extends Le{constructor(e,t=null,i=null,s=null){super(),this._url=e,this._overridespref=t,this._lrucache=i,this._interceptor=s,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,i=null){const s=A(e,this._overridespref,i===null?["*"]:i,t,this._lrucache);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async _loadMetaData(){const e=await Ee(this._url);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new ue(this._url,this._overridespref,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,i=null){i===null&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let r=0;r __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/featureSetUtils-DaHg3px6.js b/dist/assets/featureSetUtils-DaHg3px6.js deleted file mode 100644 index 6fe96f8..0000000 --- a/dist/assets/featureSetUtils-DaHg3px6.js +++ /dev/null @@ -1,7 +0,0 @@ -import{ar as se,fx as je,iZ as Ge,S as q,eQ as Ue,dw as U,oH as Re,rf as ke,dJ as Be,gG as Me,de as We,ca as x,iY as $e,bO as ce,bP as he,E as Ve,rg as fe,et as Qe,bW as G,dy as Ze,kt as pe,ha as ze,kq as _e,bR as Je}from"./index-J0iiHjMT.js";import{ap as ae,aq as b,V as Ke,ag as v,ah as ye,ai as ge,aj as me,ak as we,al as Fe,aw as W,ax as re,ay as Xe,az as K,N as Ye,aA as He,aB as $,aC as et}from"./arcadeUtils-OUqwHs4P.js";import{x as T,s as C,a as D,n as N,t as A,r as tt}from"./WhereClause-XAMIZ4-B.js";import{x as O,t as y,g as P,m as V,a as R,y as it,L as st,w as J,E as Se,T as Ie,S as be,F as at,v as ve,p as rt,D as Q,I as nt,d as j,b as lt,f as ot,c as w}from"./SpatialFilter-CXhA7RaJ.js";import{c as ut,b as dt,n as ct}from"./TimeOnly-ljWtUK7N.js";import k from"./FeatureLayer--S4epFk-.js";import xe from"./SubtypeGroupLayer-xK5RtU9X.js";import{a as ht,s as Ce}from"./executeQueryJSON-ACj9qY0y.js";import{n as ft}from"./executeQueryPBF-vdaOUMid.js";import{d as pt}from"./FeatureSet-d4S1oKME.js";import"./AttachmentInfo-kbEMEIl0.js";import{n as _t,s as yt}from"./executeForIds-wXO8-pll.js";import"./pbf-o0zzptPp.js";import"./TopFeaturesQuery-E6D2tV-x.js";import{n as gt}from"./FeatureType-MpRe7WJj.js";let Ne=class{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(e,t,i){this._layerById[t]=i,this._layerByName[e]=i}async featureSetByName(e,t=!0,i=["*"]){return this._layerByName[e]===void 0?null:this._layerByName[e]}async featureSetById(e,t=!0,i=["*"]){return this._layerById[e]===void 0?null:this._layerById[e]}castToText(e=!1){return"object, FeatureSetCollection"}},Ae=class X extends O{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof T?(this._whereclause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereclause=null)}_initialiseFeatureSet(){this._parent!==null?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.fields=[],this.typeIdField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new se({wkid:4326}),this.geometryType=ae.point)}async _getSet(e){if(this._wset===null){await this._ensureLoaded();const t=await this._parent._getFilteredSet("",null,this._whereclause,null,e);return this._checkCancelled(e),this._whereClauseFunction!==null?this._wset=new y(t._candidates.slice(0).concat(t._known.slice(0)),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new y(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){var i;let t=(i=this._parent)==null?void 0:i._isInFeatureSet(e);return t===b.NotInFeatureSet?t:(t=this._idstates[e],t===void 0?b.Unknown:t)}_getFeature(e,t,i){return this._parent._getFeature(e,t,i)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){return this._parent._featureFromCache(e)}executeWhereClause(e){var t;return((t=this._whereclause)==null?void 0:t.testFeature(e))??!1}async executeWhereClauseDeferred(e){if(this._whereClauseFunction!==null){const t=this._whereClauseFunction(e);return je(t),t}return this.executeWhereClause(e)}async _fetchAndRefineFeatures(e,t,i){var r,l,u;const s=new y([],e,!1,null),a=Math.min(t,e.length);if(await((r=this._parent)==null?void 0:r._getFeatures(s,-1,a,i)),this._checkCancelled(i),this._whereClauseFunction==null){for(let o=0;o":case"=":if(e.left.type==="column-reference"&&e.right.type==="string"){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&this.lkp[e.right.value.toString()]!==void 0)return" ("+s+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if(e.right.type==="column-reference"&&e.left.type==="string"&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+s+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,i,F.BADNESS,a)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,F.BADNESS,a)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,F.BADNESS,a)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,F.BADNESS,a)+") "}case"null":return"null";case"boolean":return e.value===!0?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return st(e.mode==="date",t);case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+s+")":e.column;case"data-type":return e.value;case"function":{const o=this.evaluateNodeToWhereClause(e.args,t,i,F.BADNESS,a);return it(e.name,o,t)}}throw new N(A.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof T?this.reverseLkp[T.convertValueToStorageFormat(this.codefield.calculateValueCompiled(e))]:this.reverseLkp[e.attributes[this.codefield]]}};wt.BADNESS="_!!!_BAD_LKP_!!!!";class Ft extends Z{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:V(e,this.field.name,R(this._sql,v.Standardised),t.getFieldsIndex())}}extractValue(e){return T.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}let St=class extends O{static findField(e,t){for(const i of e)if(i.name.toLowerCase()===t.toString().toLowerCase())return i;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_initialiseFeatureSet(){this._parent!==null?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new se({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=ae.point,this.typeIdField="",this.types=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){var t;if(this._wset===null){await this._ensureLoaded();let i=null;return i=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await((t=this._parent)==null?void 0:t._getSet(e)),this._checkCancelled(e),Ge(i),this._wset=new y(i._candidates.slice(0),i._known.slice(0),i._ordered,this._clonePageDefinition(i.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(e,t,i,s){var o,d;const a=[];t!==-1&&this._featureCache[t]===void 0&&a.push(t);const n=this._maxQueryRate();if(this._checkIfNeedToExpandKnownPage(e,n)===!0)return await this._expandPagedSet(e,n,0,0,s),this._getFeatures(e,t,i,s);let r=0;for(let h=e._lastFetchedIndex;h=n)));h++);if(a.length===0)return"success";e=new y([],a,e._ordered,null);const l=Math.min(a.length,i);await((o=this._parent)==null?void 0:o._getFeatures(e,-1,l,s)),this._checkCancelled(s);const u=[];for(let h=0;h0&&(s=s.replaceFields(d))}i!==null?this._extraFilter!==null&&(i=P(this._extraFilter,i)):i=this._extraFilter,await this._ensureLoaded();const u=await this._parent._getFilteredSet(e,t,i,s,a);let o;return this._checkCancelled(a),o=n===!0?new y(u._candidates.slice(0).concat(u._known.slice(0)),[],l===!0&&u._ordered,this._clonePageDefinition(u.pagesDefinition)):new y(u._candidates.slice(0),u._known.slice(0),l===!0&&u._ordered,this._clonePageDefinition(u.pagesDefinition)),o}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(e!==null){for(const i of this.adaptedFields)if(ve(e,i.field.name)===!0){const s=i.rewriteSql(e,this);if(s.rewritten!==!0){t.cannot=!0,t.where=null;break}t.where=s.where}}return t}async _stat(e,t,i,s,a,n,r){let l=!1,u=this._reformulateWithoutAdaptions(t);if(l=u.cannot,t=u.where,u=this._reformulateWithoutAdaptions(a),l=l||u.cannot,(a=u.where)!==null?this._extraFilter!==null&&(a=P(this._extraFilter,a)):a=this._extraFilter,l===!0)return a===null&&i===""&&s===null?this._manualStat(e,t,n,r):{calculated:!1};const o=await this._parent._stat(e,t,i,s,a,n,r);return o.calculated===!1?a===null&&i===""&&s===null?this._manualStat(e,t,n,r):{calculated:!1}:o}async _canDoAggregates(e,t,i,s,a){if(this._parent===null)return!1;for(let l=0;l{for(let s=0;s0?(await W(this._refineSetBlock(e,this._maxProcessingRate(),s)),this._checkCancelled(s),this.getIdColumnDictionary(e,t,i,s)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){if(this._featureCache[e]===void 0){const t=this._parent._featureFromCache(e);return t===void 0?void 0:t===null?null:(this._featureCache[e]=t,t)}return this._featureCache[e]}async _fetchAndRefineFeatures(){throw new C(D.NeverReach)}async _getFilteredSet(e,t,i,s,a){await this._ensureLoaded();const n=await this._parent._getFilteredSet(e,t,i,s===null?this._orderbyclause:s,a);this._checkCancelled(a);const r=new y(n._candidates.slice(0),n._known.slice(0),n._ordered,this._clonePageDefinition(n.pagesDefinition));let l=!0;if(n._candidates.length>0&&(l=!1),r._ordered===!1){let u=await this.manualOrderSet(r,a);return l===!1&&(t===null&&i===null||(u=new y(u._candidates.slice(0).concat(u._known.slice(0)),[],u._ordered,this._clonePageDefinition(u.pagesDefinition)))),u}return r}static registerAction(){O._featuresetFunctions.orderBy=function(e){return e===""?this:new Le({parentfeatureset:this,orderbyclause:new B(e)})}}getFieldsIndex(){return this._parent.getFieldsIndex()}};function It(c){if(c.parseTree.type==="function"){if(c.parseTree.args.value.length===0)return{name:c.parseTree.name,expr:null};if(c.parseTree.args.value.length>1)throw new N(A.MissingStatisticParameters);const e=T.create(rt(c.parseTree.args.value[0],v.Standardised,c.parameters),c.fieldsIndex,c.timeZone);return{name:c.parseTree.name,expr:e}}return null}let Te=class ee{constructor(){this.field="",this.tofieldname="",this.typeofstat="MIN",this.workingexpr=null}clone(){const e=new ee;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,i,s){const a=new ee;a.field=e;const n=T.create(t,i,s),r=It(n);if(r===null)throw new N(A.UnsupportedSqlFunction,{function:""});const l=r.name.toUpperCase().trim();if(l==="MIN"){if(a.typeofstat="MIN",a.workingexpr=r.expr,n===null)throw new N(A.InvalidFunctionParameters,{function:"min"})}else if(l==="MAX"){if(a.typeofstat="MAX",a.workingexpr=r.expr,n===null)throw new N(A.InvalidFunctionParameters,{function:"max"})}else if(l==="COUNT")a.typeofstat="COUNT",a.workingexpr=r.expr;else if(l==="STDEV"){if(a.typeofstat="STDDEV",a.workingexpr=r.expr,n===null)throw new N(A.InvalidFunctionParameters,{function:"stdev"})}else if(l==="SUM"){if(a.typeofstat="SUM",a.workingexpr=r.expr,n===null)throw new N(A.InvalidFunctionParameters,{function:"sum"})}else if(l==="MEAN"){if(a.typeofstat="AVG",a.workingexpr=r.expr,n===null)throw new N(A.InvalidFunctionParameters,{function:l})}else if(l==="AVG"){if(a.typeofstat="AVG",a.workingexpr=r.expr,n===null)throw new N(A.InvalidFunctionParameters,{function:"avg"})}else{if(l!=="VAR")throw new N(A.UnsupportedSqlFunction,{function:l});if(a.typeofstat="VAR",a.workingexpr=r.expr,n===null)throw new N(A.InvalidFunctionParameters,{function:"var"})}return a}toStatisticsName(){switch(this.typeofstat.toUpperCase()){case"MIN":return"min";case"MAX":return"max";case"SUM":return"sum";case"COUNT":default:return"count";case"VAR":return"var";case"STDDEV":return"stddev";case"AVG":return"avg"}}};function bt(c){if(!c)return"COUNT";switch(c.toLowerCase()){case"max":return"MAX";case"var":case"variance":return"VAR";case"avg":case"average":case"mean":return"AVG";case"min":return"MIN";case"sum":return"SUM";case"stdev":case"stddev":return"STDDEV";case"count":return"COUNT"}return"COUNT"}let Ct=class Oe extends O{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="esri.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(this._wset===null){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return b.InFeatureSet}_nextUniqueName(e){for(;e["T"+this._uniqueIds.toString()]===1;)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,i=1;const s=this._parent?this._parent.getFieldsIndex():new Ue([]);for(this.objectIdField="ROW__ID",this.globalIdField="";t===!1;){let n=!1;for(let r=0;r0)for(const n of this._parent.fields)this._adaptedFields.push(new Y(n));for(let n=0;n0&&(l=new St({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),r.nowhereclause===!0)n=new y(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new H({parentfeatureset:l,orderbyclause:new B(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let u=l;if(i!==null){let o=null;i&&(o=this._reformulateWhereClauseWithoutGroupByFields(i)),u=new Ae({parentfeatureset:u,whereclause:o})}n=new y(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new H({parentfeatureset:u,orderbyclause:new B(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return n}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=V(e,t.tofieldname,R(t.workingexpr,v.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=V(e,t.tofieldname,R(t.expression,v.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const i of this._decodedGroupbyfield)i.tofieldname!==i.name&&t.push({field:i.tofieldname,newfield:i.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return e===null?null:e.aggregatefeaturesetpagedefinition===!0?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,i){return this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)===!0?(await this._expandPagedSet(e,this._maxQuery,0,0,i),this._refineSetBlock(e,t,i)):(this._checkCancelled(i),e._candidates.length,this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e)}_expandPagedSet(e,t,i,s,a){return this._expandPagedSetFeatureSet(e,t,i,s,a)}async _getPhysicalPage(e,t,i){if(e.pagesDefinition.aggregatefeaturesetpagedefinition===!0)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,i,[]);const s=await this._getAgregagtePhysicalPage(e,t,i);for(const a of s){const n={geometry:a.geometry,attributes:{}},r={};for(const l in a.attributes)r[l.toLowerCase()]=a.attributes[l];for(const l of this._decodedGroupbyfield)n.attributes[l.tofieldname]=r[l.name.toLowerCase()];for(const l of this._decodedStatsfield)n.attributes[l.tofieldname]=r[l.field.toLowerCase()];this._featureCache[n.attributes[this.objectIdField]]=new q(n)}return s.length}_sequentialGetPhysicalItem(e,t,i,s){return new Promise((a,n)=>{e.pagesDefinition.internal.iterator===null&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),e.pagesDefinition.internal.fullyResolved===!0||t===0?a(s.length):this._nextAggregateItem(e,t,i,s,r=>{r===null?a(s.length):(t-=1,a(this._sequentialGetPhysicalItem(e,t,i,s)))},n)})}_nextAggregateItem(e,t,i,s,a,n){try{W(e.pagesDefinition.internal.iterator.next()).then(r=>{if(r===null)if(e.pagesDefinition.internal.workingItem!==null){const l=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);s.push(l),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(l.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,a(null)}else e.pagesDefinition.internal.fullyResolved=!0,a(null);else{const l=this._generateAggregateHash(r);if(e.pagesDefinition.internal.workingItem===null)e.pagesDefinition.internal.workingItem={features:[r],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const u=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return s.push(u),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(u.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[r],id:l},void a(u)}e.pagesDefinition.internal.workingItem.features.push(r)}this._nextAggregateItem(e,t,i,s,a,n)}},n)}catch(r){n(r)}}_calculateFieldStat(e,t,i){const s=[];for(let a=0;athis._topnum&&(this._wset._known=this._wset._known.slice(0,this._topnum)),this._setKnownLength(this._wset)>=this._topnum&&(this._wset._candidates=[]),this._wset}return this._wset}_setKnownLength(e){return e._known.length>0&&e._known[e._known.length-1]==="GETPAGES"?e._known.length-1:e._known.length}_isInFeatureSet(e){const t=this._parent._isInFeatureSet(e);if(t===b.NotInFeatureSet)return t;const i=this._idstates[e];return i===b.InFeatureSet||i===b.NotInFeatureSet?i:t===b.InFeatureSet&&i===void 0?this._countedinthis._topnum&&(t=this._topnum),this._countedin>=this._topnum&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset){let r=e._known.length;return r>0&&e._known[r-1]==="GETPAGES"&&(e._known.length=r-1),r=e._candidates.length,r>0&&e._candidates[r-1]==="GETPAGES"&&(e._candidates.length=r-1),"success"}const n=await this._parent._expandPagedSet(e,t,i,s,a);return this._setKnownLength(e)>this._topnum&&(e._known.length=this._topnum),this._setKnownLength(e)>=this._topnum&&(e._candidates.length=0),n}async _getFeatures(e,t,i,s){const a=[],n=this._maxQueryRate();if(this._checkIfNeedToExpandKnownPage(e,n)===!0)return await this._expandPagedSet(e,n,0,0,s),this._getFeatures(e,t,i,s);t!==-1&&this._featureCache[t]===void 0&&a.push(t);let r=0;for(let o=e._lastFetchedIndex;on)));o++);if(a.length===0)return"success";const l=new y([],a,!1,null),u=Math.min(a.length,i);await this._parent._getFeatures(l,-1,u,s);for(let o=0;o=this._topnum)break}else if(r===b.NotInFeatureSet)s===null?s={start:n,end:n}:s.end===n-1?s.end=n:(a.push(s),s={start:n,end:n}),i+=1;else if(r===b.Unknown)break;if(i>=t)break}s!==null&&a.push(s);for(let n=a.length-1;n>=0;n--)e._candidates.splice(a[n].start,a[n].end-a[n].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){O._featuresetFunctions.top=function(e){return new ne({parentfeatureset:this,topnum:e})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}async function Dt(c,e,t,i){return kt(e,await Tt(c,e,t,i),t,i)}async function Tt(c,e,t,i){var o;const s={...i},a=vt(e,t),n=((o=e.outStatistics)==null?void 0:o[0])!=null,r=Be("featurelayer-pbf-statistics"),l=!n||r;let u;if((t==null?void 0:t.format)==="pbf"&&l)try{u=await ft(c,a,s)}catch(d){if(d.name!=="query:parsing-pbf")throw d;t.format="json"}return(t==null?void 0:t.format)!=="json"&&l||(u=await ht(c,a,s)),Rt(t==null?void 0:t.fieldsIndex,u.fields),u}function Rt(c,e){if(c!=null&&e!=null)for(const t of e){const i=c.get(t.name);i&&Object.assign(t,i.toJSON())}}async function kt(c,e,t,i){var n;const s=t==null?void 0:t.infoFor3D;if(!Ee(c,s)||s==null||!e.assetMaps||!((n=e.features)!=null&&n.length))return pt.fromJSON(e);const{meshFeatureSetFromJSON:a}=await Me(We(()=>import("./meshFeatureSet-Mcou8mDC.js"),__vite__mapDeps([0,1,2,3,4])),i);return a(c,s,e)}function vt(c,e){let t=x.from(c);t.sourceSpatialReference=t.sourceSpatialReference??(e==null?void 0:e.sourceSpatialReference)??null,(e!=null&&e.gdbVersion||e!=null&&e.dynamicDataSource)&&(t=t===c?t.clone():t,t.gdbVersion=c.gdbVersion||e.gdbVersion,t.dynamicDataSource=c.dynamicDataSource?$e.from(c.dynamicDataSource):e.dynamicDataSource);const i=e==null?void 0:e.infoFor3D;if(i!=null&&Ee(c,i)){t=t===c?t.clone():t,t.formatOf3DObjects=null;const{supportedFormats:s,queryFormats:a}=i,n=ce("model/gltf-binary",s)??he("glb",s),r=ce("model/gltf+json",s)??he("gtlf",s);for(const l of a){if(l===n){t.formatOf3DObjects=l;break}l!==r||t.formatOf3DObjects||(t.formatOf3DObjects=l)}if(!t.formatOf3DObjects)throw new Ve("query:unsupported-3d-query-formats","Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf");if(t.outFields==null||!t.outFields.includes("*")){t=t===c?t.clone():t,t.outFields==null&&(t.outFields=[]);const{originX:l,originY:u,originZ:o,translationX:d,translationY:h,translationZ:p,scaleX:g,scaleY:m,scaleZ:I,rotationX:S,rotationY:f,rotationZ:_,rotationDeg:M}=i.transformFieldRoles;t.outFields.push(l,u,o,d,h,p,g,m,I,S,f,_,M)}}return t}function Ee(c,e){return e!=null&&c.returnGeometry===!0&&c.multipatchOption!=="xyFootprint"&&!c.outStatistics}let xt=class te extends O{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,e.outFields!==void 0&&(this._overrideFields=e.outFields),e.includeGeometry!==void 0&&(this._removeGeometry=e.includeGeometry===!1)}_maxQueryRate(){return re}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+Xe(e.toJSON());return Re(t,ke.String)}async loadImpl(){return this._layer.loaded===!0?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){var e,t,i,s,a,n;if(this.spatialReference==null&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this.hasZ=((i=(t=(e=this._layer)==null?void 0:e.capabilities)==null?void 0:t.data)==null?void 0:i.supportsZ)===!0,this.hasM=((n=(a=(s=this._layer)==null?void 0:s.capabilities)==null?void 0:a.data)==null?void 0:n.supportsM)===!0,this._overrideFields!==null)if(this._overrideFields.length===1&&this._overrideFields[0]==="*")this._overrideFields=null;else{const r=[],l=[];for(const u of this.fields)if(u.type==="oid")r.push(u),l.push(u.name);else for(const o of this._overrideFields)if(o.toLowerCase()===u.name.toLowerCase()){r.push(u),l.push(u.name);break}this.fields=r,this._overrideFields=l}if(this._layer.source&&this._layer.source.sourceJSON){const r=this._layer.source.sourceJSON.currentVersion;this._layer.source.sourceJSON.useStandardizedQueries===!0?(this._databaseType=v.StandardisedNoInterval,r!=null&&r>=10.61&&(this._databaseType=v.Standardised)):r!=null&&(r>=10.5&&(this._databaseType=v.StandardisedNoInterval,this._requestStandardised=!0),r>=10.61&&(this._databaseType=v.Standardised))}this.objectIdField=this._layer.objectIdField;for(const r of this.fields)r.type==="global-id"&&(this.globalIdField=r.name);this._layer instanceof xe?(this.typeIdField=this._layer.subtypeField??"",this.types=this._layer.subtypes):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types)}_isInFeatureSet(){return b.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(this._wset===null){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new x;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch{return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||this._layer.capabilities.query.supportsPagination!==!0)}_cacheableFeatureSetSourceKey(){return this._layer.url}pbfSupportedForQuery(e){var i,s;const t=(s=(i=this._layer)==null?void 0:i.capabilities)==null?void 0:s.query;return!e.outStatistics&&(t==null?void 0:t.supportsFormatPBF)===!0&&(t==null?void 0:t.supportsQuantizationEditMode)===!0}async queryPBF(e){return e.quantizationParameters={mode:"edit"},(await Dt(this._layer.parsedUrl,e,{format:"pbf"},{})).unquantize()}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}executeQuery(e,t){e.returnZ=this.hasZ,e.returnM=this.hasM;const i=t==="execute"?Ce:t==="executeForCount"?_t:yt,s=t==="execute"&&this.pbfSupportedForQuery(e);let a=null;if(this.recentlyUsedQueries){const n=this.convertQueryToLruCacheKey(e);a=this.recentlyUsedQueries.getFromCache(n),a===null&&(a=s!==!0?i(this._layer.parsedUrl.path,e):this.queryPBF(e),this.recentlyUsedQueries.addToCache(n,a),a=a.catch(r=>{var l;throw(l=this.recentlyUsedQueries)==null||l.removeFromCache(n),r}))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),a===null&&(a=s!==!0?i(this._layer.parsedUrl.path,e):this.queryPBF(e)),a}async _getFilteredSet(e,t,i,s,a){const n=await this.databaseType();if(this.isTable()&&t&&e!==null&&e!=="")return new y([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,i,s,a);let r="",l=!1;s!==null&&this._layer.capabilities&&this._layer.capabilities.query&&this._layer.capabilities.query.supportsOrderBy===!0&&(r=s.constructClause(),l=!0);const u=new x;this.datesInUnknownTimezone&&(u.timeReferenceUnknownClient=!0),u.where=i===null?t===null?"1=1":"":R(i,n),this._requestStandardised&&(u.sqlFormat="standard"),u.spatialRelationship=this._makeRelationshipEnum(e),u.outSpatialReference=this.spatialReference,u.orderByFields=r!==""?r.split(","):null,u.geometry=t===null?null:t,u.relationParameter=this._makeRelationshipParam(e);let o=await this.executeQuery(u,"executeForIds");return o===null&&(o=[]),this._checkCancelled(a),new y([],o,l,null)}_expandPagedSet(e,t,i,s,a){return this._expandPagedSetFeatureSet(e,t,i,s,a)}async _getFilteredSetUsingPaging(e,t,i,s,a){var p;let n="",r=!1;s!==null&&this._layer.capabilities&&this._layer.capabilities.query&&this._layer.capabilities.query.supportsOrderBy===!0&&(n=s.constructClause(),r=!0);const l=await this.databaseType();let u=i===null?t===null?"1=1":"":R(i,l);this._layer.definitionExpression&&this._useDefinitionExpression&&(u=u!==""?"(("+this._layer.definitionExpression+") AND ("+u+"))":this._layer.definitionExpression);let o=this._maxQueryRate();const d=(p=this._layer.capabilities)==null?void 0:p.query.maxRecordCount;d!=null&&d=this._maxProcessingRate()-1))break}if(n>=i&&a.length===0)break}if(a.length===0)return"success";const r=new x;this._requestStandardised&&(r.sqlFormat="standard"),this.datesInUnknownTimezone&&(r.timeReferenceUnknownClient=!0),r.objectIds=a,r.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),r.returnGeometry=!0,this._removeGeometry===!0&&(r.returnGeometry=!1),r.outSpatialReference=this.spatialReference;const l=await this.executeQuery(r,"execute");if(this._checkCancelled(s),l.error!==void 0)throw new C(D.RequestFailed,{reason:l.error});const u=this._layer.objectIdField;for(let o=0;o=r)break}return m.features.length===0?l:m.features.length===((S=this._layer.capabilities)==null?void 0:S.query.maxRecordCount)&&l.length"+e.pagesDefinition.internal.lastMaxId.toString()+")":e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString());const a=e.pagesDefinition.internal.lastRetrieved,n=a,r=e.pagesDefinition.internal.lastPage,l=new x;if(this._requestStandardised&&(l.sqlFormat="standard"),l.where=s,l.spatialRelationship=e.pagesDefinition.spatialRel,l.relationParameter=e.pagesDefinition.relationParam,l.outFields=e.pagesDefinition.outFields,l.outStatistics=e.pagesDefinition.outStatistics,l.geometry=e.pagesDefinition.geometry,l.groupByFieldsForStatistics=e.pagesDefinition.groupByFieldsForStatistics,l.num=e.pagesDefinition.resultRecordCount,l.start=e.pagesDefinition.internal.lastPage,l.returnGeometry=e.pagesDefinition.returnGeometry,this.datesInUnknownTimezone&&(l.timeReferenceUnknownClient=!0),l.orderByFields=e.pagesDefinition.orderByFields!==""?e.pagesDefinition.orderByFields.split(","):null,this.isTable()&&l.geometry&&l.spatialRelationship)return[];const u=await this.executeQuery(l,"execute");if(this._checkCancelled(i),!u.hasOwnProperty("features"))throw new C(D.InvalidStatResponse);const o=[];if(e.pagesDefinition.internal.lastPage!==r)return[];u.features.length>0&&u.features[0].attributes[e.pagesDefinition.generatedOid]===void 0&&(e.pagesDefinition.generatedOid=e.pagesDefinition.generatedOid.toLowerCase());for(let d=0;d0||i&&i>0)&&(r.size=[t&&t>0?t:0,i&&i>0?i:t+1]),s&&s.length>0&&(r.attachmentTypes=s),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:r,method:"attachments"});const l=await this._layer.queryAttachments(r),u=[];return l&&l[e]&&l[e].forEach(o=>{const d=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+o.id.toString();let h=null;a&&o.exifInfo&&(h=Ye.convertJsonToArcade(o.exifInfo,"system",!0)),u.push(new He(o.id,o.name,o.contentType,o.size,d,h,o.keywords??null))}),u}return[]}async queryRelatedFeatures(e){var s;const t={f:"json",relationshipId:e.relationshipId.toString(),definitionExpression:e.where,outFields:(s=e.outFields)==null?void 0:s.join(","),returnGeometry:e.returnGeometry.toString()};e.resultOffset!==void 0&&e.resultOffset!==null&&(t.resultOffset=e.resultOffset.toString()),e.resultRecordCount!==void 0&&e.resultRecordCount!==null&&(t.resultRecordCount=e.resultRecordCount.toString()),e.orderByFields&&(t.orderByFields=e.orderByFields.join(",")),e.objectIds&&e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=Qe(e.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await G(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(i.data){const a={},n=i.data;if(n!=null&&n.relatedRecordGroups){const r=n.spatialReference;for(const l of n.relatedRecordGroups){const u=l.objectId,o=[];for(const d of l.relatedRecords){d.geometry&&(d.geometry.spatialReference=r);const h=new q({geometry:d.geometry?Ze(d.geometry):null,attributes:d.attributes});o.push(h)}a[u]={features:o,exceededTransferLimit:n.exceededTransferLimit===!0}}}return a}throw new C(D.InvalidRequest)}async getFeatureByObjectId(e,t){const i=new x;i.outFields=t,i.returnGeometry=!1,i.outSpatialReference=this.spatialReference,i.where=this.objectIdField+"="+e.toString(),this.datesInUnknownTimezone&&(i.timeReferenceUnknownClient=!0),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:i,method:"execute"});const s=await Ce(this._layer.parsedUrl.path,i);return s.features.length===1?s.features[0]:null}async getIdentityUser(){var t;await this.load();const e=(t=pe)==null?void 0:t.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){var s,a;await this.load();const e=(s=pe)==null?void 0:s.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const i=t.toLowerCase().indexOf("/rest/services");if(t=i>-1?t.substring(0,i):t,t){t+="/rest/info";try{const n=await G(t,{query:{f:"json"}});let r="";return(a=n.data)!=null&&a.owningSystemUrl&&(r=n.data.owningSystemUrl),r}catch{return""}}return""}getDataSourceFeatureSet(){const e=new te({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){var a,n;if(this.fsetInfo)return this.fsetInfo;let e=null,{parsedUrl:{path:t},serviceItemId:i=null}=this._layer;if(t){const r=await G(t,{responseType:"json",query:{f:"json"}});e=((a=r==null?void 0:r.data)==null?void 0:a.name)??null,i=((n=r==null?void 0:r.data)==null?void 0:n.serviceItemId)??null}const s=this._layer.title&&(this._layer.parent??null)!==null;return this.featureSetInfo={layerId:this._layer.layerId,layerName:e===""?null:e,itemId:i===""?null:i,serviceLayerUrl:t===""?null:t,webMapLayerId:s?this._layer.id??null:null,webMapLayerTitle:s?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}};class le extends O{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,e.isTable===!0&&(this._forceIsTable=!0),e.outFields!==void 0&&(this._overrideFields=e.outFields),e.includeGeometry!==void 0&&(this._removeGeometry=e.includeGeometry===!1)}_maxQueryRate(){return re}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return this._layer.loaded===!0?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}get gdbVersion(){return""}_initialiseFeatureSet(){var e,t,i,s,a,n;if(this.spatialReference==null&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this._overrideFields!==null)if(this._overrideFields.length===1&&this._overrideFields[0]==="*")this._overrideFields=null;else{const r=[],l=[];for(const u of this.fields)if(u.type==="oid")r.push(u),l.push(u.name);else for(const o of this._overrideFields)if(o.toLowerCase()===u.name.toLowerCase()){r.push(u),l.push(u.name);break}this.fields=r,this._overrideFields=l}this.objectIdField=this._layer.objectIdField;for(const r of this.fields)r.type==="global-id"&&(this.globalIdField=r.name);this._databaseType=v.Standardised,this.hasZ=((i=(t=(e=this._layer)==null?void 0:e.capabilities)==null?void 0:t.data)==null?void 0:i.supportsZ)===!0,this.hasM=((n=(a=(s=this._layer)==null?void 0:s.capabilities)==null?void 0:a.data)==null?void 0:n.supportsM)===!0,this._layer instanceof xe?(this.typeIdField=this._layer.subtypeField??"",this.types=this._layer.subtypes):(this.typeIdField=this._layer.typeIdField??"",this.types=this._layer.types)}isTable(){return this._forceIsTable||this._layer.isTable||this._layer.type==="table"||!this._layer.geometryType}_isInFeatureSet(){return b.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(this._wset===null){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new q({geometry:this._removeGeometry===!0?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,a){let n="",r=!1;if(s!==null&&(n=s.constructClause(),r=!0),this.isTable()&&t&&e!==null&&e!=="")return new y([],[],!0,null);const l=new x;l.returnZ=this.hasZ,l.returnM=this.hasM,l.where=i===null?t===null?"1=1":"":R(i,v.Standardised),l.spatialRelationship=this._makeRelationshipEnum(e),l.outSpatialReference=this.spatialReference,l.orderByFields=n!==""?n.split(","):null,l.geometry=t===null?null:t,l.returnGeometry=!0,l.relationParameter=this._makeRelationshipParam(e);const u=await this._layer.queryFeatures(l);if(u===null)return new y([],[],r,null);this._checkCancelled(a);const o=[];return u.features.forEach(d=>{const h=d.attributes[this._layer.objectIdField];o.push(h),this._featureCache[h]=this._changeFeature(d)}),new y([],o,r,null)}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _queryAllFeatures(){if(this._wset)return this._wset;const e=new x;if(e.where="1=1",await this._ensureLoaded(),this._layer.source&&this._layer.source.items){const s=[];return this._layer.source.items.forEach(a=>{const n=a.attributes[this._layer.objectIdField];s.push(n),this._featureCache[n]=this._changeFeature(a)}),this._wset=new y([],s,!1,null),this._wset}e.returnZ=this.hasZ,e.returnM=this.hasM;const t=await this._layer.queryFeatures(e),i=[];return t.features.forEach(s=>{const a=s.attributes[this._layer.objectIdField];i.push(a),this._featureCache[a]=this._changeFeature(s)}),this._wset=new y([],i,!1,null),this._wset}async _getFeatures(e,t,i){const s=[];t!==-1&&this._featureCache[t]===void 0&&s.push(t);for(let a=e._lastFetchedIndex;ai)));a++);if(s.length===0)return"success";throw new C(D.MissingFeatures)}async _refineSetBlock(e){return e}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}relationshipMetaData(){return[]}static _cloneAttr(e){const t={};for(const i in e)t[i]=e[i];return t}nativeCapabilities(){return{title:this._layer.title??"",canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(e,t){var g,m,I,S;let i=e.layerDefinition.objectIdField;const s=e.layerDefinition.typeIdField??"",a=[];if(e.layerDefinition.types)for(const f of e.layerDefinition.types)a.push(gt.fromJSON(f));let n=e.layerDefinition.geometryType;n===void 0&&(n=e.featureSet.geometryType||"");let r=e.featureSet.features;const l=t.toJSON();if(!i){let f=!1;for(const _ of e.layerDefinition.fields)if(_.type==="oid"||_.type==="esriFieldTypeOID"){i=_.name,f=!0;break}if(f===!1){let _="FID",M=!0,de=0;for(;M;){let E=!0;for(const qe of e.layerDefinition.fields)if(qe.name===_){E=!1;break}E===!0?M=!1:(de++,_="FID"+de.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:_,alias:_});const z=[];for(let E=0;E_.name):["*"]);u.outFields=o,u.relationshipId=this.relationship.id,u.where="1=1";let d=!0;this._removeGeometry===!0&&(d=!1),u.returnGeometry=d,this._requestStandardised&&(u.sqlFormat="standard"),u.outSpatialReference=this.spatialReference,u.orderByFields=r!==""?r.split(","):null;const h=await n.source.queryRelatedFeatures(u);this._checkCancelled(a);const p=h[this._findObjectId]?h[this._findObjectId].features:[],g=[];for(let _=0;__.name):["*"]);return g=new y(h||p?["GETPAGES"]:[],h||p?[]:["GETPAGES"],r,{outFields:I.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:u,orderByFields:n,returnGeometry:m,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(g,o,0,0,a),g}_expandPagedSet(e,t,i,s,a){return this._expandPagedSetFeatureSet(e,t,i,s,a)}_clonePageDefinition(e){return e===null?null:e.groupbypage!==!0?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,a=s,n=e.pagesDefinition.internal.lastPage,r=this._layer.nativeCapabilities(),l=new _e;this._requestStandardised===!0&&(l.sqlFormat="standard"),l.relationshipId=this.relationship.id,l.objectIds=e.pagesDefinition.objectIds,l.resultOffset=e.pagesDefinition.internal.lastPage,l.resultRecordCount=e.pagesDefinition.resultRecordCount,l.outFields=e.pagesDefinition.outFields.split(","),l.where=e.pagesDefinition.where,l.orderByFields=e.pagesDefinition.orderByFields!==""?e.pagesDefinition.orderByFields.split(","):null,l.returnGeometry=e.pagesDefinition.returnGeometry,l.outSpatialReference=this.spatialReference;const u=await r.source.queryRelatedFeatures(l);if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return 0;const o=u[this._findObjectId]?u[this._findObjectId].features:[];for(let h=0;hi)))&&!(r>=i&&a.length===0);l++);if(a.length===0)return"success";throw new C(D.MissingFeatures)}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,s,a,n,r){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,s,a){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,i,s,a){return this._relatedLayer.queryAttachments(e,t,i,s,a)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){var e;return((e=this._relatedLayer)==null?void 0:e.preferredTimeZone)??null}get dateFieldsTimeZone(){var e;return((e=this._relatedLayer)==null?void 0:e.dateFieldsTimeZone)??null}get datesInUnknownTimezone(){var e;return(e=this._relatedLayer)==null?void 0:e.datesInUnknownTimezone}get editFieldsInfo(){var e;return((e=this._relatedLayer)==null?void 0:e.editFieldsInfo)??null}get timeInfo(){var e;return((e=this._relatedLayer)==null?void 0:e.timeInfo)??null}async getFeatureSetInfo(){return this.fsetInfo??this._layer.featureSetInfo}}function At(){w.applicationCache===null&&(w.applicationCache=new w)}async function ie(c,e){if(w.applicationCache){const t=w.applicationCache.getLayerInfo(c);if(t){const a=await t;return new k({url:c,outFields:e,sourceJSON:a})}const i=new k({url:c,outFields:e}),s=(async()=>(await i.load(),i.sourceJSON))();if(w.applicationCache){w.applicationCache.setLayerInfo(c,s);try{return await s,i}catch(a){throw w.applicationCache.clearLayerInfo(c),a}}return await s,i}return new k({url:c,outFields:e})}async function oe(c,e,t,i,s,a=null){return L(await ie(c,["*"]),e,t,i,s,a)}function L(c,e=null,t=null,i=!0,s=null,a=null){if(c instanceof k||$(c)){const r={layer:c,spatialReference:e,outFields:t,includeGeometry:i,lrucache:s,interceptor:a};return c.url||!c.source?new xt(r):new le(r)}const n=L(c.parent,e,t,i,s,a);return n.filter(T.create(c.parent.subtypeField+"="+c.subtypeCode.toString(),c.parent.fieldsIndex,n.dateFieldsTimeZoneDefaultUTC))}async function Lt(c){if(w.applicationCache!==null){const t=w.applicationCache.getLayerInfo(c);if(t!==null)return t}const e=(async()=>{const t=await G(c,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(w.applicationCache!==null){w.applicationCache.setLayerInfo(c,e);try{return await e}catch(t){throw w.applicationCache.clearLayerInfo(c),t}}return e}async function Ot(c,e){const t="QUERYDATAELEMTS:"+e.toString()+":"+c;if(w.applicationCache!==null){const s=w.applicationCache.getLayerInfo(t);if(s!==null)return s}const i=(async()=>{var a;const s=await G(c+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([e.toString()]),f:"json"}});if(s.data){const n=s.data;if((a=n.layerDataElements)!=null&&a[0])return n.layerDataElements[0]}throw new C(D.DataElementsNotFound)})();if(w.applicationCache!==null){w.applicationCache.setLayerInfo(t,i);try{return await i}catch(s){throw w.applicationCache.clearLayerInfo(t),s}}return i}async function Pe(c){if(w.applicationCache!==null){const t=w.applicationCache.getLayerInfo(c);if(t!==null)return t}const e=(async()=>{const t=await G(c,{responseType:"json",query:{f:"json"}});if(t.data){const i=t.data;return i.layers||(i.layers=[]),i.tables||(i.tables=[]),i}return{layers:[],tables:[]}})();if(w.applicationCache!==null){w.applicationCache.setLayerInfo(c,e);try{return await e}catch(t){throw w.applicationCache.clearLayerInfo(c),t}}return e}async function Et(c,e){var s,a,n;const t={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null},i=await Pe(c);if(t.metadata=i,((s=i.controllerDatasetLayers)==null?void 0:s.utilityNetworkLayerId)!==void 0&&i.controllerDatasetLayers.utilityNetworkLayerId!==null){if(i.layers)for(const u of i.layers)t.layerNameLkp[u.id]=u.name;if(i.tables)for(const u of i.tables)t.layerNameLkp[u.id]=u.name;const r=i.controllerDatasetLayers.utilityNetworkLayerId;t.networkId=r;const l=await Ot(c,r);if(l){t.queryelem=l,(a=t.queryelem)!=null&&a.dataElement&&t.queryelem.dataElement.schemaGeneration!==void 0&&(t.unVersion=t.queryelem.dataElement.schemaGeneration),t.lkp={},t.queryelem.dataElement.domainNetworks||(t.queryelem.dataElement.domainNetworks=[]);for(const o of t.queryelem.dataElement.domainNetworks){for(const d of o.edgeSources??[]){const h={layerId:d.layerId,sourceId:d.sourceId,className:t.layerNameLkp[d.layerId]??null};h.className&&(t.lkp[h.className]=h)}for(const d of o.junctionSources??[]){const h={layerId:d.layerId,sourceId:d.sourceId,className:t.layerNameLkp[d.layerId]??null};h.className&&(t.lkp[h.className]=h)}}if(t.queryelem.dataElement.terminalConfigurations)for(const o of t.queryelem.dataElement.terminalConfigurations)for(const d of o.terminals)t.terminals.push({terminalId:d.terminalId,terminalName:d.terminalName});const u=await Lt(c+"/"+r);if(((n=u.systemLayers)==null?void 0:n.associationsTableId)!==void 0&&u.systemLayers.associationsTableId!==null){const o=[];t.unVersion>=4&&(o.push("STATUS"),o.push("PERCENTALONG"));let d=await oe(c+"/"+u.systemLayers.associationsTableId.toString(),e,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...o],!1,null,null);return await d.load(),t.unVersion>=4&&(d=d.filter(T.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63)",d.getFieldsIndex(),d.dateFieldsTimeZoneDefaultUTC)),await d.load()),{lkp:t.lkp,associations:d,unVersion:t.unVersion,terminals:t.terminals}}return{associations:null,unVersion:t.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:t.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:t.unVersion,lkp:null,terminals:[]}}async function Pt(c,e,t,i=null,s=null,a=!0,n=null,r=null){let l=c.serviceUrl();if(!l)return null;l=l.charAt(l.length-1)==="/"?l+e.relatedTableId.toString():l+"/"+e.relatedTableId.toString();const u=await oe(l,i,s,a,n,r);return new Nt({layer:c,relatedLayer:u,relationship:e,objectId:t,spatialReference:i,outFields:s,includeGeometry:a,lrucache:n,interceptor:r})}Ae.registerAction(),Ct.registerAction(),H.registerAction(),ot.registerAction(),ne.registerAction();class qt extends Ne{constructor(e,t=null,i=null,s=null){super(),this._map=e,this._overridespref=t,this._lrucache=i,this._interceptor=s,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,i=null){const s=L(e,this._overridespref,i===null?["*"]:i,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async featureSetByName(e,t=!0,i=null){if(this._map.loaded!==void 0&&this._map.load!==void 0&&this._map.loaded===!1)return await this._map.load(),this.featureSetByName(e,t,i);i===null&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let r=0;r{if(r instanceof k){if(r.title===e)return!0}else if($(r)){if(r.title===e)return!0;a.push(r)}return!1});if(n)return this._makeAndAddFeatureSet(n,t,i);if(this._map.tables){const r=this._map.tables.find(l=>!!(l.title&&l.title===e||l.title&&l.title===e));if(r){if(r instanceof k)return this._makeAndAddFeatureSet(r,t,i);if(!r._materializedTable){const l=r.outFields?r:{...r,outFields:["*"]};r._materializedTable=new k(l)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,i)}}for(const r of a){if(r.loadStatus==="not-loaded"||r.loadStatus==="loading")try{await r.load()}catch{}const l=r.sublayers.find(u=>u.title===e);if(l)return this._makeAndAddFeatureSet(l,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){if(this._map.loaded!==void 0&&this._map.load!==void 0&&this._map.loaded===!1)return await this._map.load(),this.featureSetById(e,t,i);i===null&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let r=0;r{if(r instanceof k){if(r.id===e)return!0}else if($(r)){if(r.id===e)return!0;a.push(r)}return!1});if(n)return this._makeAndAddFeatureSet(n,t,i);if(this._map.tables){const r=this._map.tables.find(l=>l.id===e);if(r){if(r instanceof k)return this._makeAndAddFeatureSet(r,t,i);if(!r._materializedTable){const l={...r,outFields:["*"]};r._materializedTable=new k(l)}return await r._materializedTable.load(),this._makeAndAddFeatureSet(r._materializedTable,t,i)}}for(const r of a){if(r.loadStatus==="not-loaded"||r.loadStatus==="loading")try{await r.load()}catch{}const l=r.sublayers.find(u=>u.id===e);if(l)return this._makeAndAddFeatureSet(l,t,i)}return null}}class ue extends Ne{constructor(e,t=null,i=null,s=null){super(),this._url=e,this._overridespref=t,this._lrucache=i,this._interceptor=s,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,i=null){const s=L(e,this._overridespref,i===null?["*"]:i,t,this._lrucache);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async _loadMetaData(){const e=await Pe(this._url);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new ue(this._url,this._overridespref,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,i=null){i===null&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let r=0;r __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/featureUtils-itZGjo5c.js b/dist/assets/featureUtils-aSzMyCi0.js similarity index 80% rename from dist/assets/featureUtils-itZGjo5c.js rename to dist/assets/featureUtils-aSzMyCi0.js index 591bbdf..eadaab2 100644 --- a/dist/assets/featureUtils-itZGjo5c.js +++ b/dist/assets/featureUtils-aSzMyCi0.js @@ -1 +1 @@ -import{Z as U,c_ as g,c$ as L,d0 as b,bK as k,d1 as D,d2 as z,d3 as G,d4 as O,d5 as E,d6 as S,d7 as T,d8 as I,d9 as p}from"./index-J0iiHjMT.js";const _="esri.widgets.Feature.support.featureUtils",F=U.getLogger(_),P=/href=(""|'')/gi,Q=/(\{([^\{\r\n]+)\})/g,H=/\'/g,x=/^\s*expression\//i,B=/(\n)/gi,J=/[\u00A0-\u9999<>\&]/gim,K=/href\s*=\s*(?:\"([^\"]+)\"|\'([^\']+)\')/gi,V=/^(?:mailto:|tel:)/,C="relationships/",w=z("short-date-short-time");function Fe(e){if(e!=null)return(e.sourceLayer||e.layer)??void 0}async function we(e,n){return typeof e=="function"?e(n):e}function Ne(e=""){if(e)return!V.test(e.trim().toLowerCase())}function W(e){return!!e&&x.test(e)}function X(e,n){if(!W(n)||!e)return null;const t=n.replace(x,"").toLowerCase();let r=null;return e.some(i=>i.name.toLowerCase()===t&&(r=i,!0)),r}function Ze(e,n){const t=X(n,e==null?void 0:e.fieldName);return t?t.title||null:e?e.label||e.fieldName:null}function Y(e,n){const t=n.get(e.toLowerCase());return`{${(t==null?void 0:t.fieldName)||e}}`}function ee(e){return e.replaceAll(P,"")}function j(e,n){const t=h(n,e);return t?t.name:e}function $e(e,n){return e&&e.map(t=>j(t,n))}function h(e,n){return e&&typeof e.getField=="function"&&n?e.getField(n)??null:null}function q(e){return`${e}`.trim()}function Ee({attributes:e,globalAttributes:n,layer:t,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?ne({formattedAttributes:n,template:ae(r,{...n,...i,...e},t),fieldInfoMap:o}):""}function ne({formattedAttributes:e,template:n,fieldInfoMap:t}){return q(ee(g(g(n,r=>Y(r,t)),e)))}function te(e,n,t=!1){const r=n[e];if(typeof r=="string"){const i="%27",o=(t?encodeURIComponent(r):r).replaceAll(H,i);n[e]=o}}function re(e,n=!1){const t={...e};return Object.keys(t).forEach(r=>te(r,t,n)),t}function ie(e,n,t){const r=(n=q(n))&&n[0]!=="{";return g(e,re(t,r||!1))}function oe(e,n){return e.replaceAll(Q,(t,r,i)=>{const o=h(n,i);return o?`{${o.name}}`:r})}function ae(e,n,t){const r=oe(e,t);return r&&r.replaceAll(K,(i,o,u)=>ie(i,o||u,n))}function le(e,n){if(typeof e=="string"&&n&&n.dateFormat==null&&(n.places!=null||n.digitSeparator!=null)){const t=Number(e);if(!isNaN(t))return t}return e}function ue(e){return e!=null&&typeof e=="object"&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&(e.type==="feature"||e.type==="scene")&&"when"in e}function se(e){return e!=null&&typeof e=="object"&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function fe(e){return ue(e)&&se(e)}function ce(e,n){var c;const{fieldInfos:t,fieldName:r,preventPlacesFormatting:i,layer:o,timeZone:u}=n,a=pe(t,r),l=h(o,r);if(a&&!T(r)){const f=l==null?void 0:l.type,d=(c=a.format)==null?void 0:c.dateFormat;if(f==="date"||f==="date-only"||f==="time-only"||f==="timestamp-offset"||d)return E(e,{format:d,fieldType:f,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:u,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}})}const s=a==null?void 0:a.format;return typeof e=="string"&&T(r)&&s?de(e,s):typeof(e=le(e,s))=="string"||e==null||s==null?A(e):I(e,i?{...p(s),minimumFractionDigits:0,maximumFractionDigits:20}:p(s))}function de(e,n){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?y(e,",",", ",n):e.includes(";")?y(e,";","; ",n):e.includes(" ")?y(e," "," ",n):I(Number(e),p(n))}function y(e,n,t,r){return e.trim().split(n).map(i=>I(Number(i),p(r))).join(t)}function pe(e,n){if(e!=null&&e.length&&n)return e.find(t=>{var r;return((r=t.fieldName)==null?void 0:r.toLowerCase())===n.toLowerCase()})}function me({fieldName:e,graphic:n,layer:t}){if(v(e)||!t||typeof t.getFeatureType!="function")return null;const{typeIdField:r}=t;if(!r||e!==r)return null;const i=t.getFeatureType(n);return i?i.name:null}function ye({fieldName:e,value:n,graphic:t,layer:r}){if(v(e)||!r||typeof r.getFieldDomain!="function")return null;const i=t&&r.getFieldDomain(e,{feature:t});return i&&i.type==="coded-value"?i.getName(n):null}function xe(e,n,t,r){const{creatorField:i,creationDateField:o,editorField:u,editDateField:a}=e;if(!n)return;const l=L(r&&"preferredTimeZone"in r?r.preferredTimeZone:null,!(!r||!("datesInUnknownTimezone"in r))&&!!r.datesInUnknownTimezone,t,w,"date"),s={...w,...l},c=n[a];if(typeof c=="number"){const d=n[u];return{type:"edit",date:b(c,s),user:d}}const f=n[o];if(typeof f=="number"){const d=n[i];return{type:"create",date:b(f,s),user:d}}return null}function Ce(e,n){const t=new Map;return e&&e.forEach(r=>{const i=j(r.fieldName,n);r.fieldName=i,t.set(i.toLowerCase(),r)}),t}function je(e){const n=[];if(!e)return n;const{fieldInfos:t,content:r}=e;return t&&n.push(...t),r&&Array.isArray(r)&&r.forEach(i=>{if(i.type==="fields"){const o=i==null?void 0:i.fieldInfos;o&&n.push(...o)}}),n}function qe(e){return e.replaceAll(J,n=>`&#${n.charCodeAt(0)};`)}function A(e){return typeof e=="string"?e.replaceAll(B,'
'):e}function M(e){var f;const{value:n,fieldName:t,fieldInfos:r,fieldInfoMap:i,layer:o,graphic:u,timeZone:a}=e;if(n==null)return"";const l=ye({fieldName:t,value:n,graphic:u,layer:o});if(l)return l;const s=me({fieldName:t,graphic:u,layer:o});if(s)return s;if(i.get(t.toLowerCase()))return ce(n,{fieldInfos:r||Array.from(i.values()),fieldName:t,layer:o,timeZone:a});const c=(f=o==null?void 0:o.fieldsIndex)==null?void 0:f.get(t);return c&&(G(c)||O(c))?E(n,{fieldType:c.type,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:a,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}}):A(n)}function Ae({fieldInfos:e,attributes:n,layer:t,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:u}){const a={};return o==null||o.forEach(l=>be({attributes:a,relatedInfo:l,fieldInfoMap:i,fieldInfos:e,layer:t,timeZone:u})),n&&Object.keys(n).forEach(l=>{const s=n[l];a[l]=M({fieldName:l,fieldInfos:e,fieldInfoMap:i,layer:t,value:s,graphic:r,timeZone:u})}),a}async function ge(e,n){var c,f;const{layer:t,graphic:r,outFields:i,objectIds:o,returnGeometry:u,spatialReference:a}=e,l=o[0];if(typeof l!="number"&&typeof l!="string"){const d="Could not query required fields for the specified feature. The feature's ID is invalid.",m={layer:t,graphic:r,objectId:l,requiredFields:i};return F.warn(d,m),null}if(!((f=(c=k(t))==null?void 0:c.operations)!=null&&f.supportsQuery)){const d="The specified layer cannot be queried. The following fields will not be available.",m={layer:t,graphic:r,requiredFields:i,returnGeometry:u};return F.warn(d,m),null}const s=t.createQuery();return s.objectIds=o,s.outFields=i!=null&&i.length?i:[t.objectIdField],s.returnGeometry=!!u,s.returnZ=!!u,s.returnM=!!u,s.outSpatialReference=a,(await t.queryFeatures(s,n)).features[0]}async function Ie(e){var r;if(!((r=e.expressionInfos)!=null&&r.length))return!1;const n=await S(),{arcadeUtils:{hasGeometryFunctions:t}}=n;return t(e)}async function Me({graphic:e,popupTemplate:n,layer:t,spatialReference:r},i){if(!t||!n||(typeof t.load=="function"&&await t.load(i),!e.attributes))return;const o=e.attributes[t.objectIdField];if(o==null)return;const u=[o],a=await n.getRequiredFields(t.fieldsIndex),l=D(a,e),s=l?[]:a,c=n.returnGeometry||await Ie(n);if(l&&!c)return;const f=await ge({layer:t,graphic:e,outFields:s,objectIds:u,returnGeometry:c,spatialReference:r},i);f&&(f.geometry&&(e.geometry=f.geometry),f.attributes&&(e.attributes={...e.attributes,...f.attributes}))}function v(e=""){return!!e&&e.includes(C)}function he(e){return e?`${C}${e.layerId}/${e.fieldName}`:""}function N({attributes:e,graphic:n,relatedInfo:t,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:u}){e&&n&&t&&Object.keys(n.attributes).forEach(a=>{const l=he({layerId:t.relation.id.toString(),fieldName:a}),s=n.attributes[a];e[l]=M({fieldName:l,fieldInfos:r,fieldInfoMap:i,layer:o,value:s,graphic:n,timeZone:u})})}function be({attributes:e,relatedInfo:n,fieldInfoMap:t,fieldInfos:r,layer:i,timeZone:o}){var u,a;e&&n&&((u=n.relatedFeatures)==null||u.forEach(l=>N({attributes:e,graphic:l,relatedInfo:n,fieldInfoMap:t,fieldInfos:r,layer:i,timeZone:o})),(a=n.relatedStatsFeatures)==null||a.forEach(l=>N({attributes:e,graphic:l,relatedInfo:n,fieldInfoMap:t,fieldInfos:r,layer:i,timeZone:o})))}const Z=e=>{if(!e)return!1;const n=e.toUpperCase();return n.includes("CURRENT_TIMESTAMP")||n.includes("CURRENT_DATE")||n.includes("CURRENT_TIME")},R=({layer:e,method:n,query:t,definitionExpression:r})=>{var u,a;if(!((a=(u=e.capabilities)==null?void 0:u.query)!=null&&a.supportsCacheHint)||n==="attachments")return;const i=t.where!=null?t.where:null,o=t.geometry!=null?t.geometry:null;Z(r)||Z(i)||(o==null?void 0:o.type)==="extent"||t.resultType==="tile"||(t.cacheHint=!0)},ve=({query:e,layer:n,method:t})=>{R({layer:n,method:t,query:e,definitionExpression:`${n.definitionExpression} ${n.serviceDefinitionExpression}`})},Re=({queryPayload:e,layer:n,method:t})=>{R({layer:n,method:t,query:e,definitionExpression:`${n.definitionExpression} ${n.serviceDefinitionExpression}`})};function Ue(e,n,t){return e&&n&&t?$(e.allLayers,n,t)||$(e.allTables,n,t):null}function $(e,n,t){const r=n.type==="scene"&&n.associatedLayer?n.associatedLayer.url:n.url;return e.filter(fe).find(i=>i!==n&&i.url===r&&i.layerId===t.relatedTableId)}function Le(e){const n=e.getObjectId();return n!=null?`oid:${n}`:`uid:${e.uid}`}export{Ne as C,Ee as D,Fe as E,Le as F,fe as J,W as M,oe as P,$e as R,Ue as T,pe as Y,A as a,Re as b,Me as c,v as d,ve as h,je as i,xe as n,qe as o,Ze as q,Ce as r,ge as s,Ae as u,j as v,we as x,ne as z}; +import{R as U,cR as g,cS as L,cT as b,aj as k,cU as D,cV as z,cW as G,cX as O,cY as E,cZ as S,c_ as T,c$ as I,d0 as p}from"./index-pCX-0tJH.js";const _="esri.widgets.Feature.support.featureUtils",F=U.getLogger(_),P=/href=(""|'')/gi,Q=/(\{([^\{\r\n]+)\})/g,H=/\'/g,x=/^\s*expression\//i,V=/(\n)/gi,W=/[\u00A0-\u9999<>\&]/gim,X=/href\s*=\s*(?:\"([^\"]+)\"|\'([^\']+)\')/gi,Y=/^(?:mailto:|tel:)/,j="relationships/",w=z("short-date-short-time");function Fe(e){if(e!=null)return(e.sourceLayer||e.layer)??void 0}async function we(e,n){return typeof e=="function"?e(n):e}function Ne(e=""){if(e)return!Y.test(e.trim().toLowerCase())}function B(e){return!!e&&x.test(e)}function J(e,n){if(!B(n)||!e)return null;const t=n.replace(x,"").toLowerCase();let r=null;return e.some(i=>i.name.toLowerCase()===t&&(r=i,!0)),r}function Ze(e,n){const t=J(n,e==null?void 0:e.fieldName);return t?t.title||null:e?e.label||e.fieldName:null}function K(e,n){const t=n.get(e.toLowerCase());return`{${(t==null?void 0:t.fieldName)||e}}`}function ee(e){return e.replaceAll(P,"")}function C(e,n){const t=h(n,e);return t?t.name:e}function $e(e,n){return e&&e.map(t=>C(t,n))}function h(e,n){return e&&typeof e.getField=="function"&&n?e.getField(n)??null:null}function q(e){return`${e}`.trim()}function Ee({attributes:e,globalAttributes:n,layer:t,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?ne({formattedAttributes:n,template:ae(r,{...n,...i,...e},t),fieldInfoMap:o}):""}function ne({formattedAttributes:e,template:n,fieldInfoMap:t}){return q(ee(g(g(n,r=>K(r,t)),e)))}function te(e,n,t=!1){const r=n[e];if(typeof r=="string"){const i="%27",o=(t?encodeURIComponent(r):r).replaceAll(H,i);n[e]=o}}function re(e,n=!1){const t={...e};return Object.keys(t).forEach(r=>te(r,t,n)),t}function ie(e,n,t){const r=(n=q(n))&&n[0]!=="{";return g(e,re(t,r||!1))}function oe(e,n){return e.replaceAll(Q,(t,r,i)=>{const o=h(n,i);return o?`{${o.name}}`:r})}function ae(e,n,t){const r=oe(e,t);return r&&r.replaceAll(X,(i,o,u)=>ie(i,o||u,n))}function le(e,n){if(typeof e=="string"&&n&&n.dateFormat==null&&(n.places!=null||n.digitSeparator!=null)){const t=Number(e);if(!isNaN(t))return t}return e}function ue(e){return e!=null&&typeof e=="object"&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&(e.type==="feature"||e.type==="scene")&&"when"in e}function se(e){return e!=null&&typeof e=="object"&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function fe(e){return ue(e)&&se(e)}function ce(e,n){var c;const{fieldInfos:t,fieldName:r,preventPlacesFormatting:i,layer:o,timeZone:u}=n,a=pe(t,r),l=h(o,r);if(a&&!T(r)){const f=l==null?void 0:l.type,d=(c=a.format)==null?void 0:c.dateFormat;if(f==="date"||f==="date-only"||f==="time-only"||f==="timestamp-offset"||d)return E(e,{format:d,fieldType:f,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:u,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}})}const s=a==null?void 0:a.format;return typeof e=="string"&&T(r)&&s?de(e,s):typeof(e=le(e,s))=="string"||e==null||s==null?A(e):I(e,i?{...p(s),minimumFractionDigits:0,maximumFractionDigits:20}:p(s))}function de(e,n){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?y(e,",",", ",n):e.includes(";")?y(e,";","; ",n):e.includes(" ")?y(e," "," ",n):I(Number(e),p(n))}function y(e,n,t,r){return e.trim().split(n).map(i=>I(Number(i),p(r))).join(t)}function pe(e,n){if(e!=null&&e.length&&n)return e.find(t=>{var r;return((r=t.fieldName)==null?void 0:r.toLowerCase())===n.toLowerCase()})}function me({fieldName:e,graphic:n,layer:t}){if(R(e)||!t||typeof t.getFeatureType!="function")return null;const{typeIdField:r}=t;if(!r||e!==r)return null;const i=t.getFeatureType(n);return i?i.name:null}function ye({fieldName:e,value:n,graphic:t,layer:r}){if(R(e)||!r||typeof r.getFieldDomain!="function")return null;const i=t&&r.getFieldDomain(e,{feature:t});return i&&i.type==="coded-value"?i.getName(n):null}function xe(e,n,t,r){const{creatorField:i,creationDateField:o,editorField:u,editDateField:a}=e;if(!n)return;const l=L(r&&"preferredTimeZone"in r?r.preferredTimeZone:null,!(!r||!("datesInUnknownTimezone"in r))&&!!r.datesInUnknownTimezone,t,w,"date"),s={...w,...l},c=n[a];if(typeof c=="number"){const d=n[u];return{type:"edit",date:b(c,s),user:d}}const f=n[o];if(typeof f=="number"){const d=n[i];return{type:"create",date:b(f,s),user:d}}return null}function je(e,n){const t=new Map;return e&&e.forEach(r=>{const i=C(r.fieldName,n);r.fieldName=i,t.set(i.toLowerCase(),r)}),t}function Ce(e){const n=[];if(!e)return n;const{fieldInfos:t,content:r}=e;return t&&n.push(...t),r&&Array.isArray(r)&&r.forEach(i=>{if(i.type==="fields"){const o=i==null?void 0:i.fieldInfos;o&&n.push(...o)}}),n}function qe(e){return e.replaceAll(W,n=>`&#${n.charCodeAt(0)};`)}function A(e){return typeof e=="string"?e.replaceAll(V,'
'):e}function M(e){var f;const{value:n,fieldName:t,fieldInfos:r,fieldInfoMap:i,layer:o,graphic:u,timeZone:a}=e;if(n==null)return"";const l=ye({fieldName:t,value:n,graphic:u,layer:o});if(l)return l;const s=me({fieldName:t,graphic:u,layer:o});if(s)return s;if(i.get(t.toLowerCase()))return ce(n,{fieldInfos:r||Array.from(i.values()),fieldName:t,layer:o,timeZone:a});const c=(f=o==null?void 0:o.fieldsIndex)==null?void 0:f.get(t);return c&&(G(c)||O(c))?E(n,{fieldType:c.type,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:a,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}}):A(n)}function Ae({fieldInfos:e,attributes:n,layer:t,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:u}){const a={};return o==null||o.forEach(l=>be({attributes:a,relatedInfo:l,fieldInfoMap:i,fieldInfos:e,layer:t,timeZone:u})),n&&Object.keys(n).forEach(l=>{const s=n[l];a[l]=M({fieldName:l,fieldInfos:e,fieldInfoMap:i,layer:t,value:s,graphic:r,timeZone:u})}),a}async function ge(e,n){var c,f;const{layer:t,graphic:r,outFields:i,objectIds:o,returnGeometry:u,spatialReference:a}=e,l=o[0];if(typeof l!="number"&&typeof l!="string"){const d="Could not query required fields for the specified feature. The feature's ID is invalid.",m={layer:t,graphic:r,objectId:l,requiredFields:i};return F.warn(d,m),null}if(!((f=(c=k(t))==null?void 0:c.operations)!=null&&f.supportsQuery)){const d="The specified layer cannot be queried. The following fields will not be available.",m={layer:t,graphic:r,requiredFields:i,returnGeometry:u};return F.warn(d,m),null}const s=t.createQuery();return s.objectIds=o,s.outFields=i!=null&&i.length?i:[t.objectIdField],s.returnGeometry=!!u,s.returnZ=!!u,s.returnM=!!u,s.outSpatialReference=a,(await t.queryFeatures(s,n)).features[0]}async function Ie(e){var r;if(!((r=e.expressionInfos)!=null&&r.length))return!1;const n=await S(),{arcadeUtils:{hasGeometryFunctions:t}}=n;return t(e)}async function Me({graphic:e,popupTemplate:n,layer:t,spatialReference:r},i){if(!t||!n||(typeof t.load=="function"&&await t.load(i),!e.attributes))return;const o=e.attributes[t.objectIdField];if(o==null)return;const u=[o],a=await n.getRequiredFields(t.fieldsIndex),l=D(a,e),s=l?[]:a,c=n.returnGeometry||await Ie(n);if(l&&!c)return;const f=await ge({layer:t,graphic:e,outFields:s,objectIds:u,returnGeometry:c,spatialReference:r},i);f&&(f.geometry&&(e.geometry=f.geometry),f.attributes&&(e.attributes={...e.attributes,...f.attributes}))}function R(e=""){return!!e&&e.includes(j)}function he(e){return e?`${j}${e.layerId}/${e.fieldName}`:""}function N({attributes:e,graphic:n,relatedInfo:t,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:u}){e&&n&&t&&Object.keys(n.attributes).forEach(a=>{const l=he({layerId:t.relation.id.toString(),fieldName:a}),s=n.attributes[a];e[l]=M({fieldName:l,fieldInfos:r,fieldInfoMap:i,layer:o,value:s,graphic:n,timeZone:u})})}function be({attributes:e,relatedInfo:n,fieldInfoMap:t,fieldInfos:r,layer:i,timeZone:o}){var u,a;e&&n&&((u=n.relatedFeatures)==null||u.forEach(l=>N({attributes:e,graphic:l,relatedInfo:n,fieldInfoMap:t,fieldInfos:r,layer:i,timeZone:o})),(a=n.relatedStatsFeatures)==null||a.forEach(l=>N({attributes:e,graphic:l,relatedInfo:n,fieldInfoMap:t,fieldInfos:r,layer:i,timeZone:o})))}const Z=e=>{if(!e)return!1;const n=e.toUpperCase();return n.includes("CURRENT_TIMESTAMP")||n.includes("CURRENT_DATE")||n.includes("CURRENT_TIME")},v=({layer:e,method:n,query:t,definitionExpression:r})=>{var u,a;if(!((a=(u=e.capabilities)==null?void 0:u.query)!=null&&a.supportsCacheHint)||n==="attachments")return;const i=t.where!=null?t.where:null,o=t.geometry!=null?t.geometry:null;Z(r)||Z(i)||(o==null?void 0:o.type)==="extent"||t.resultType==="tile"||(t.cacheHint=!0)},Re=({query:e,layer:n,method:t})=>{v({layer:n,method:t,query:e,definitionExpression:`${n.definitionExpression} ${n.serviceDefinitionExpression}`})},ve=({queryPayload:e,layer:n,method:t})=>{v({layer:n,method:t,query:e,definitionExpression:`${n.definitionExpression} ${n.serviceDefinitionExpression}`})};function Ue(e,n,t){return e&&n&&t?$(e.allLayers,n,t)||$(e.allTables,n,t):null}function $(e,n,t){const r=n.type==="scene"&&n.associatedLayer?n.associatedLayer.url:n.url;return e.filter(fe).find(i=>i!==n&&i.url===r&&i.layerId===t.relatedTableId)}function Le(e){const n=e.getObjectId();return n!=null?`oid:${n}`:`uid:${e.uid}`}export{Ne as C,Ee as D,Fe as E,Le as F,fe as J,B as M,oe as P,$e as R,Ue as T,pe as Y,A as a,ve as b,Me as c,R as d,Re as h,Ce as i,xe as n,qe as o,Ze as q,je as r,ge as s,Ae as u,C as v,we as x,ne as z}; diff --git a/dist/assets/featuresetbase-WjFIOCEy.js b/dist/assets/featuresetbase-WjFIOCEy.js deleted file mode 100644 index ccbace5..0000000 --- a/dist/assets/featuresetbase-WjFIOCEy.js +++ /dev/null @@ -1 +0,0 @@ -import{m as Ie}from"./TimeOnly-ljWtUK7N.js";import{n as N,K as De,X as J,H as L,N as v,a as m,r as p,P,d as b,x as Te,y as fe,Q as ue,A as S,B as U,q as x,U as G,E as Ee,b as M,J as be,v as Ne,c as O,D as xe,S as Ae,T as _,V as X,Y}from"./arcadeUtils-OUqwHs4P.js";import{e as de,j as Le,q as ce,f as Se,c as me,a as Ce,b as ve,d as Pe,g as q,k as Ze,F as Re,T as $e,B as k,h as ke,i as B,L as C,I as ee}from"./featureSetUtils-DaHg3px6.js";import{l as Me}from"./portalUtils-MqaWunxU.js";import{u as Ue,D as pe}from"./SpatialFilter-CXhA7RaJ.js";import{bS as ye,fx as Oe,dw as W}from"./index-J0iiHjMT.js";import{x as T}from"./WhereClause-XAMIZ4-B.js";import ne from"./FeatureLayer--S4epFk-.js";import"./hash-SS5GKVPY.js";import"./SubtypeGroupLayer-xK5RtU9X.js";import"./CustomParametersMixin-Y1bOcayO.js";import"./FeatureLayerBase-jpFp8gE3.js";import"./serviceCapabilitiesUtils-26KpT1VN.js";import"./FeatureTemplate-kUgbbA00.js";import"./versionUtils-4v9zIDlv.js";import"./executeQueryJSON-ACj9qY0y.js";import"./query-rG0aX6cE.js";import"./pbfQueryUtils-pWizwTQZ.js";import"./pbf-o0zzptPp.js";import"./queryZScale-IaMm02_2.js";import"./FeatureSet-d4S1oKME.js";import"./executeQueryPBF-vdaOUMid.js";import"./AttachmentInfo-kbEMEIl0.js";import"./executeForIds-wXO8-pll.js";import"./TopFeaturesQuery-E6D2tV-x.js";import"./FeatureType-MpRe7WJj.js";import"./geometryEngineAsync-QjQc0riy.js";import"./editsZScale-Wgw9kbYG.js";import"./FeatureEffectLayer-oBa8pIG5.js";import"./FeatureEffect-5bEV-xG1.js";import"./FeatureReductionLayer-RlitE1N6.js";import"./OrderedLayer-M7k5gLgx.js";function ze(s,n,r,c){if(c.length===1){if(x(c[0]))return Y(s,c[0],-1);if(M(c[0]))return Y(s,c[0].toArray(),-1)}return Y(s,c,-1)}async function te(s,n,r){const c=s.getVariables();if(c.length>0){const F=[];for(let t=0;t{var u,y;if(N(e,1,2,n,r),De(e[0])||J(e[0]))return"Unknown";if(L(e[0])){if(await e[0].load(),e.length===1||e[1]===null)return e[0].datesInUnknownTimezone?z("unknown"):z(e[0].dateFieldsTimeZone);if(!(e[1]instanceof v)||e[1].hasField("type")===!1)throw new m(n,p.InvalidParameter,r);const o=e[1].field("type");if(P(o)===!1)throw new m(n,p.InvalidParameter,r);switch(b(o).toLowerCase()){case"preferredtimezone":return z(e[0].preferredTimeZone);case"editfieldsinfo":return z(((u=e[0].editFieldsInfo)==null?void 0:u.timeZone)??null);case"timeinfo":return z(((y=e[0].timeInfo)==null?void 0:y.timeZone)??null);case"field":if(e[1].hasField("fieldname")&&P(e[1].field("fieldname")))return z(e[0].fieldTimeZone(b(e[1].field("fieldname"))))}throw new m(n,p.InvalidParameter,r)}const t=Te(e[0],fe(n));if(t===null)return null;const a=t.timeZone;return a==="system"?Ie.systemTimeZoneCanonicalName:a.toLowerCase()==="utc"?"UTC":a.toLowerCase()==="unknown"?"Unknown":a})},s.functions.sqltimestamp=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{N(e,1,3,n,r);const t=e[0];if(ue(t)){if(e.length===1)return t.toSQLWithKeyword();if(e.length===2)return t.changeTimeZone(b(e[1])).toSQLWithKeyword();throw new m(n,p.InvalidParameter,r)}if(J(t))return t.toSQLWithKeyword();if(L(t)){if(e.length!==3)throw new m(n,p.InvalidParameter,r);await t.load();const a=b(e[1]);if(J(e[2]))return e[2].toSQLWithKeyword();if(ue(e[2])===!1)throw new m(n,p.InvalidParameter,r);const u=t.fieldTimeZone(a);return u===null?e[2].toSQLWithKeyword():e[2].changeTimeZone(u).toSQLWithKeyword()}throw new m(n,p.InvalidParameter,r)})},s.signatures.push({name:"sqltimestamp",min:2,max:4}),s.functions.featuresetbyid=function(n,r){return s.standardFunctionAsync(n,r,(c,F,e)=>{if(N(e,2,4,n,r),e[0]instanceof de){const t=b(e[1]);let a=S(e[2],null);const u=U(S(e[3],!0));if(a===null&&(a=["*"]),x(a)===!1)throw new m(n,p.InvalidParameter,r);return e[0].featureSetById(t,u,a)}throw new m(n,p.InvalidParameter,r)})},s.signatures.push({name:"featuresetbyid",min:2,max:4}),s.functions.getfeatureset=function(n,r){return s.standardFunctionAsync(n,r,(c,F,e)=>{if(N(e,1,2,n,r),G(e[0])){let t=S(e[1],"datasource");return t===null&&(t="datasource"),t=b(t).toLowerCase(),Le(e[0].fullSchema(),t,n.lrucache,n.interceptor,n.spatialReference)}throw new m(n,p.InvalidParameter,r)})},s.signatures.push({name:"getfeatureset",min:1,max:2}),s.functions.featuresetbyportalitem=function(n,r){return s.standardFunctionAsync(n,r,(c,F,e)=>{var o,i;if(N(e,2,5,n,r),e[0]===null)throw new m(n,p.PortalRequired,r);if(e[0]instanceof Ee){const l=b(e[1]),f=b(e[2]);let I=S(e[3],null);const D=U(S(e[4],!0));if(I===null&&(I=["*"]),x(I)===!1)throw new m(n,p.InvalidParameter,r);let w=null;return w=(o=n.services)!=null&&o.portal?n.services.portal:ye.getDefault(),w=Me(e[0],w),ce(l,f,n.spatialReference,I,D,w,n.lrucache,n.interceptor)}if(P(e[0])===!1)throw new m(n,p.PortalRequired,r);const t=b(e[0]),a=b(e[1]);let u=S(e[2],null);const y=U(S(e[3],!0));if(u===null&&(u=["*"]),x(u)===!1)throw new m(n,p.InvalidParameter,r);return ce(t,a,n.spatialReference,u,y,((i=n.services)==null?void 0:i.portal)??ye.getDefault(),n.lrucache,n.interceptor)})},s.signatures.push({name:"featuresetbyportalitem",min:2,max:5}),s.functions.featuresetbyname=function(n,r){return s.standardFunctionAsync(n,r,(c,F,e)=>{if(N(e,2,4,n,r),e[0]instanceof de){const t=b(e[1]);let a=S(e[2],null);const u=U(S(e[3],!0));if(a===null&&(a=["*"]),x(a)===!1)throw new m(n,p.InvalidParameter,r);return e[0].featureSetByName(t,u,a)}throw new m(n,p.InvalidParameter,r)})},s.signatures.push({name:"featuresetbyname",min:2,max:4}),s.functions.featureset=function(n,r){return s.standardFunction(n,r,(c,F,e)=>{N(e,1,1,n,r);let t=e[0];const a={layerDefinition:{geometryType:"",objectIdField:"",hasM:!1,hasZ:!1,globalIdField:"",typeIdField:"",fields:[]},featureSet:{geometryType:"",features:[]}};if(P(t))t=JSON.parse(t),t.layerDefinition!==void 0?(a.layerDefinition=t.layerDefinition,a.featureSet=t.featureSet,t.layerDefinition.spatialReference&&(a.layerDefinition.spatialReference=t.layerDefinition.spatialReference)):(a.featureSet.features=t.features,a.featureSet.geometryType=t.geometryType,a.layerDefinition.geometryType=a.featureSet.geometryType,a.layerDefinition.objectIdField=t.objectIdFieldName??"",a.layerDefinition.typeIdField=t.typeIdFieldName,a.layerDefinition.globalIdField=t.globalIdFieldName,a.layerDefinition.fields=t.fields,t.spatialReference&&(a.layerDefinition.spatialReference=t.spatialReference));else{if(!(e[0]instanceof v))throw new m(n,p.InvalidParameter,r);{t=JSON.parse(e[0].castToText(!0));const u=d(t,"layerdefinition");if(u!==null){a.layerDefinition.geometryType=d(u,"geometrytype",""),a.featureSet.geometryType=a.layerDefinition.geometryType,a.layerDefinition.globalIdField=d(u,"globalidfield",""),a.layerDefinition.objectIdField=d(u,"objectidfield",""),a.layerDefinition.typeIdField=d(u,"typeidfield",""),a.layerDefinition.hasZ=d(u,"hasz",!1)===!0,a.layerDefinition.hasM=d(u,"hasm",!1)===!0;const y=d(u,"spatialreference",null);y&&(a.layerDefinition.spatialReference=ie(y));for(const i of d(u,"fields",[])){const l={name:d(i,"name",""),alias:d(i,"alias",""),type:d(i,"type",""),nullable:d(i,"nullable",!0),editable:d(i,"editable",!0),length:d(i,"length",null),domain:we(d(i,"domain"))};a.layerDefinition.fields.push(l)}const o=d(t,"featureset",null);if(o){const i={};for(const l of a.layerDefinition.fields)i[l.name.toLowerCase()]=l.name;for(const l of d(o,"features",[])){const f={},I=d(l,"attributes",{});for(const D in I)f[i[D.toLowerCase()]]=I[D];a.featureSet.features.push({attributes:f,geometry:he(d(l,"geometry",null))})}}}else{a.layerDefinition.hasZ=d(t,"hasz",!1)===!0,a.layerDefinition.hasM=d(t,"hasm",!1)===!0,a.layerDefinition.geometryType=d(t,"geometrytype",""),a.featureSet.geometryType=a.layerDefinition.geometryType,a.layerDefinition.objectIdField=d(t,"objectidfieldname",""),a.layerDefinition.typeIdField=d(t,"typeidfieldname","");const y=d(t,"spatialreference",null);y&&(a.layerDefinition.spatialReference=ie(y));let o=d(t,"fields",null);if(x(o))for(const f of o){const I={name:d(f,"name",""),alias:d(f,"alias",""),type:d(f,"type",""),nullable:d(f,"nullable",!0),editable:d(f,"editable",!0),length:d(f,"length",null),domain:we(d(f,"domain"))};a.layerDefinition.fields.push(I)}else o=null,a.layerDefinition.fields=o;const i={};for(const f of a.layerDefinition.fields)i[f.name.toLowerCase()]=f.name;let l=d(t,"features",null);if(x(l))for(const f of l){const I={},D=d(f,"attributes",{});for(const w in D)I[i[w.toLowerCase()]]=D[w];a.featureSet.features.push({attributes:I,geometry:he(d(f,"geometry",null))})}else l=null,a.featureSet.features=l}}}if(He(a)===!1)throw new m(n,p.InvalidParameter,r);return a.layerDefinition.geometryType||(a.layerDefinition.geometryType="esriGeometryNull"),Se.create(a,n.spatialReference)})},s.signatures.push({name:"featureset",min:1,max:1}),s.functions.filter=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(N(e,2,2,n,r),x(e[0])||M(e[0])){const t=[];let a=e[0];a instanceof be&&(a=a.toArray());let u=null;if(!Ne(e[1]))throw new m(n,p.InvalidParameter,r);u=e[1].createFunction(n);for(const y of a){const o=u(y);Oe(o)?await o===!0&&t.push(y):o===!0&&t.push(y)}return t}if(L(e[0])){const t=await e[0].load(),a=T.create(e[1],t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC),u=a.getVariables();if(u.length>0){const y=[];for(let i=0;i{if(N(e,2,2,n,r),L(e[0])){const t=new Ce(e[1]);return new ve({parentfeatureset:e[0],orderbyclause:t})}throw new m(n,p.InvalidParameter,r)})},s.signatures.push({name:"orderby",min:2,max:2}),s.functions.top=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(N(e,2,2,n,r),L(e[0]))return new Pe({parentfeatureset:e[0],topnum:e[1]});if(x(e[0]))return O(e[1])>=e[0].length?e[0].slice(0):e[0].slice(0,O(e[1]));if(M(e[0]))return O(e[1])>=e[0].length()?e[0].slice(0):e[0].slice(0,O(e[1]));throw new m(n,p.InvalidParameter,r)})},s.signatures.push({name:"top",min:2,max:2}),s.functions.first=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(N(e,1,1,n,r),L(e[0])){const t=await e[0].first(c.abortSignal);if(t!==null){const a=xe.createFromGraphicLikeObject(t.geometry,t.attributes,e[0],n.timeZone);return a._underlyingGraphic=t,a}return t}return x(e[0])?e[0].length===0?null:e[0][0]:M(e[0])?e[0].length()===0?null:e[0].get(0):null})},s.signatures.push({name:"first",min:1,max:1}),s.functions.attachments=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{N(e,1,2,n,r);const t={minsize:-1,maxsize:-1,types:null,returnMetadata:!1};if(e.length>1){if(e[1]instanceof v){if(e[1].hasField("minsize")&&(t.minsize=O(e[1].field("minsize"))),e[1].hasField("metadata")&&(t.returnMetadata=U(e[1].field("metadata"))),e[1].hasField("maxsize")&&(t.maxsize=O(e[1].field("maxsize"))),e[1].hasField("types")){const a=Ae(e[1].field("types"),!1);a.length>0&&(t.types=a)}}else if(e[1]!==null)throw new m(n,p.InvalidParameter,r)}if(G(e[0])){let a=e[0]._layer;return a instanceof ne&&(a=q(a,n.spatialReference,["*"],!0,n.lrucache,n.interceptor)),a===null?[]:L(a)===!1?[]:(await a.load(),a.queryAttachments(e[0].field(a.objectIdField),t.minsize,t.maxsize,t.types,t.returnMetadata))}if(e[0]===null)return[];throw new m(n,p.InvalidParameter,r)})},s.signatures.push({name:"attachments",min:1,max:2}),s.functions.featuresetbyrelationshipname=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{N(e,2,4,n,r);const t=e[0],a=b(e[1]);let u=S(e[2],null);const y=U(S(e[3],!0));if(u===null&&(u=["*"]),x(u)===!1)throw new m(n,p.InvalidParameter,r);if(e[0]===null)return null;if(!G(e[0]))throw new m(n,p.InvalidParameter,r);let o=t._layer;if(o instanceof ne&&(o=q(o,n.spatialReference,["*"],!0,n.lrucache,n.interceptor)),o===null||L(o)===!1)return null;o=await o.load();const i=o.relationshipMetaData().filter(w=>w.name===a);if(i.length===0)return null;if(i[0].relationshipTableId!==void 0&&i[0].relationshipTableId!==null&&i[0].relationshipTableId>-1)return Ze(o,i[0],t.field(o.objectIdField),o.spatialReference,u,y,n.lrucache,n.interceptor);let l=o.serviceUrl();if(!l)return null;l=l.charAt(l.length-1)==="/"?l+i[0].relatedTableId.toString():l+"/"+i[0].relatedTableId.toString();const f=await Re(l,o.spatialReference,u,y,n.lrucache,n.interceptor);await f.load();let I=f.relationshipMetaData();if(I=I.filter(w=>w.id===i[0].id),t.hasField(i[0].keyField)===!1||t.field(i[0].keyField)===null){const w=await o.getFeatureByObjectId(t.field(o.objectIdField),[i[0].keyField]);if(w){const E=T.create(I[0].keyField+"= @id",f.getFieldsIndex(),f.dateFieldsTimeZoneDefaultUTC);return E.parameters={id:w.attributes[i[0].keyField]},f.filter(E)}return new Ue({parentfeatureset:f})}const D=T.create(I[0].keyField+"= @id",f.getFieldsIndex(),f.dateFieldsTimeZoneDefaultUTC);return D.parameters={id:t.field(i[0].keyField)},f.filter(D)})},s.signatures.push({name:"featuresetbyrelationshipname",min:2,max:4}),s.functions.featuresetbyassociation=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{N(e,2,3,n,r);const t=e[0],a=b(S(e[1],"")).toLowerCase(),u=P(e[2])?b(e[2]):null;if(e[0]===null)return null;if(!G(e[0]))throw new m(n,p.InvalidParameter,r);let y=t._layer;if(y instanceof ne&&(y=q(y,n.spatialReference,["*"],!0,n.lrucache,n.interceptor)),y===null||L(y)===!1)return null;await y.load();const o=y.serviceUrl(),i=await $e(o,n.spatialReference);let l=null,f=null,I=!1;if(u!==null&&u!==""&&u!==void 0){for(const g of i.terminals)g.terminalName===u&&(f=g.terminalId);f===null&&(I=!0)}const D=i.associations.getFieldsIndex(),w=D.get("TOGLOBALID").name,E=D.get("FROMGLOBALID").name,K=D.get("TOTERMINALID").name,V=D.get("FROMTERMINALID").name,j=D.get("FROMNETWORKSOURCEID").name,H=D.get("TONETWORKSOURCEID").name,$=D.get("ASSOCIATIONTYPE").name,ge=D.get("ISCONTENTVISIBLE").name,Fe=D.get("OBJECTID").name;for(const g of y.fields)if(g.type==="global-id"){l=t.field(g.name);break}let Z=null,ae=new k(new W({name:"percentalong",alias:"percentalong",type:"double"}),T.create("0",i.associations.getFieldsIndex(),i.associations.dateFieldsTimeZoneDefaultUTC)),re=new k(new W({name:"side",alias:"side",type:"string"}),T.create("''",i.associations.getFieldsIndex(),i.associations.dateFieldsTimeZoneDefaultUTC));const A="globalid",se="globalId",le={};for(const g in i.lkp)le[g]=i.lkp[g].sourceId;const R=new ke(new W({name:"classname",alias:"classname",type:"string"}),null,le);let h="";switch(a){case"midspan":{h=`((${w}='${l}') OR ( ${E}='${l}')) AND (${$} IN (5))`,R.codefield=T.create(`CASE WHEN (${w}='${l}') THEN ${j} ELSE ${H} END`,i.associations.getFieldsIndex(),i.associations.dateFieldsTimeZoneDefaultUTC);const g=X(C.findField(i.associations.fields,E));g.name=A,g.alias=A,Z=new k(g,T.create(`CASE WHEN (${E}='${l}') THEN ${w} ELSE ${E} END`,i.associations.getFieldsIndex(),i.associations.dateFieldsTimeZoneDefaultUTC)),ae=i.unVersion>=4?new ee(C.findField(i.associations.fields,D.get("PERCENTALONG").name)):new k(new W({name:"percentalong",alias:"percentalong",type:"double"}),T.create("0",i.associations.getFieldsIndex(),i.associations.dateFieldsTimeZoneDefaultUTC));break}case"junctionedge":{h=`((${w}='${l}') OR ( ${E}='${l}')) AND (${$} IN (4,6))`,R.codefield=T.create(`CASE WHEN (${w}='${l}') THEN ${j} ELSE ${H} END`,i.associations.getFieldsIndex(),i.associations.dateFieldsTimeZoneDefaultUTC);const g=X(C.findField(i.associations.fields,E));g.name=A,g.alias=A,Z=new k(g,T.create(`CASE WHEN (${E}='${l}') THEN ${w} ELSE ${E} END`,i.associations.getFieldsIndex(),i.associations.dateFieldsTimeZoneDefaultUTC)),re=new k(new W({name:"side",alias:"side",type:"string"}),T.create(`CASE WHEN (${$}=4) THEN 'from' ELSE 'to' END`,i.associations.getFieldsIndex(),i.associations.dateFieldsTimeZoneDefaultUTC));break}case"connected":{let g=`${w}='@T'`,oe=`${E}='@T'`;f!==null&&(g+=` AND ${K}=@A`,oe+=` AND ${V}=@A`),h="(("+g+") OR ("+oe+"))",h=_(h,"@T",l??""),g=_(g,"@T",l??""),f!==null&&(g=_(g,"@A",f.toString()),h=_(h,"@A",f.toString())),R.codefield=T.create("CASE WHEN "+g+` THEN ${j} ELSE ${H} END`,i.associations.getFieldsIndex(),i.associations.dateFieldsTimeZoneDefaultUTC);const Q=X(C.findField(i.associations.fields,E));Q.name=A,Q.alias=A,Z=new k(Q,T.create("CASE WHEN "+g+` THEN ${E} ELSE ${w} END`,i.associations.getFieldsIndex(),i.associations.dateFieldsTimeZoneDefaultUTC));break}case"container":h=`${w}='${l}' AND ${$} = 2`,f!==null&&(h+=` AND ${K} = `+f.toString()),R.codefield=j,h="( "+h+" )",Z=new B(C.findField(i.associations.fields,E),A,A);break;case"content":h=`(${E}='${l}' AND ${$} = 2)`,f!==null&&(h+=` AND ${V} = `+f.toString()),R.codefield=H,h="( "+h+" )",Z=new B(C.findField(i.associations.fields,w),A,A);break;case"structure":h=`(${w}='${l}' AND ${$} = 3)`,f!==null&&(h+=` AND ${K} = `+f.toString()),R.codefield=j,h="( "+h+" )",Z=new B(C.findField(i.associations.fields,E),A,se);break;case"attached":h=`(${E}='${l}' AND ${$} = 3)`,f!==null&&(h+=` AND ${V} = `+f.toString()),R.codefield=H,h="( "+h+" )",Z=new B(C.findField(i.associations.fields,w),A,se);break;default:throw new m(n,p.InvalidParameter,r)}return I&&(h="1 <> 1"),new C({parentfeatureset:i.associations,adaptedFields:[new ee(C.findField(i.associations.fields,Fe)),new ee(C.findField(i.associations.fields,ge)),Z,re,R,ae],extraFilter:h?T.create(h,i.associations.getFieldsIndex(),i.associations.dateFieldsTimeZoneDefaultUTC):null})})},s.signatures.push({name:"featuresetbyassociation",min:2,max:6}),s.functions.groupby=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(N(e,3,3,n,r),!L(e[0]))throw new m(n,p.InvalidParameter,r);const t=await e[0].load(),a=[],u=[];let y=!1,o=[];if(P(e[1]))o.push(e[1]);else if(e[1]instanceof v)o.push(e[1]);else if(x(e[1]))o=e[1];else{if(!M(e[1]))throw new m(n,p.InvalidParameter,r);o=e[1].toArray()}for(const i of o)if(P(i)){const l=T.create(b(i),t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC),f=pe(l)===!0?b(i):"%%%%FIELDNAME";a.push({name:f,expression:l}),f==="%%%%FIELDNAME"&&(y=!0)}else{if(!(i instanceof v))throw new m(n,p.InvalidParameter,r);{const l=i.hasField("name")?i.field("name"):"%%%%FIELDNAME",f=i.hasField("expression")?i.field("expression"):"";if(l==="%%%%FIELDNAME"&&(y=!0),!l)throw new m(n,p.InvalidParameter,r);a.push({name:l,expression:T.create(f||l,t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC)})}}if(o=[],P(e[2]))o.push(e[2]);else if(x(e[2]))o=e[2];else if(M(e[2]))o=e[2].toArray();else{if(!(e[2]instanceof v))throw new m(n,p.InvalidParameter,r);o.push(e[2])}for(const i of o){if(!(i instanceof v))throw new m(n,p.InvalidParameter,r);{const l=i.hasField("name")?i.field("name"):"",f=i.hasField("statistic")?i.field("statistic"):"",I=i.hasField("expression")?i.field("expression"):"";if(!l||!f||!I)throw new m(n,p.InvalidParameter,r);u.push({name:l,statistic:f.toLowerCase(),expression:T.create(I,t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC)})}}if(y){const i={};for(const f of t.fields)i[f.name.toLowerCase()]=1;for(const f of a)f.name!=="%%%%FIELDNAME"&&(i[f.name.toLowerCase()]=1);for(const f of u)f.name!=="%%%%FIELDNAME"&&(i[f.name.toLowerCase()]=1);let l=0;for(const f of a)if(f.name==="%%%%FIELDNAME"){for(;i["field_"+l.toString()]===1;)l++;i["field_"+l.toString()]=1,f.name="FIELD_"+l.toString()}}for(const i of a)await te(i.expression,s,n);for(const i of u)await te(i.expression,s,n);return e[0].groupby(a,u)})},s.signatures.push({name:"groupby",min:3,max:3}),s.functions.distinct=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(L(e[0])){N(e,2,2,n,r);const t=await e[0].load(),a=[];let u=[];if(P(e[1]))u.push(e[1]);else if(e[1]instanceof v)u.push(e[1]);else if(x(e[1]))u=e[1];else{if(!M(e[1]))throw new m(n,p.InvalidParameter,r);u=e[1].toArray()}let y=!1;for(const o of u)if(P(o)){const i=T.create(b(o),t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC),l=pe(i)===!0?b(o):"%%%%FIELDNAME";a.push({name:l,expression:i}),l==="%%%%FIELDNAME"&&(y=!0)}else{if(!(o instanceof v))throw new m(n,p.InvalidParameter,r);{const i=o.hasField("name")?o.field("name"):"%%%%FIELDNAME",l=o.hasField("expression")?o.field("expression"):"";if(i==="%%%%FIELDNAME"&&(y=!0),!i)throw new m(n,p.InvalidParameter,r);a.push({name:i,expression:T.create(l||i,t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC)})}}if(y){const o={};for(const l of t.fields)o[l.name.toLowerCase()]=1;for(const l of a)l.name!=="%%%%FIELDNAME"&&(o[l.name.toLowerCase()]=1);let i=0;for(const l of a)if(l.name==="%%%%FIELDNAME"){for(;o["field_"+i.toString()]===1;)i++;o["field_"+i.toString()]=1,l.name="FIELD_"+i.toString()}}for(const o of a)await te(o.expression,s,n);return e[0].groupby(a,[])}return ze("distinct",c,F,e)})}),s.functions.getfeaturesetinfo=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(N(e,1,1,n,r),!L(e[0]))return null;const t=await e[0].getFeatureSetInfo();return t?v.convertObjectToArcadeDictionary({layerId:t.layerId,layerName:t.layerName,itemId:t.itemId,serviceLayerUrl:t.serviceLayerUrl,webMapLayerId:t.webMapLayerId??null,webMapLayerTitle:t.webMapLayerTitle??null,className:null,objectClassId:null},fe(n),!1,!1):null})},s.signatures.push({name:"getfeaturesetinfo",min:1,max:1})}export{Tn as registerFunctions}; diff --git a/dist/assets/featuresetbase-ggs9CyN5.js b/dist/assets/featuresetbase-ggs9CyN5.js new file mode 100644 index 0000000..3ae4ed3 --- /dev/null +++ b/dist/assets/featuresetbase-ggs9CyN5.js @@ -0,0 +1 @@ +import{m as Ie}from"./TimeOnly-gkehHHJx.js";import{n as N,K as De,X as J,H as L,N as v,a as m,r as y,P,d as b,x as Te,y as fe,Q as ue,A as S,B as U,q as x,U as G,E as Ee,b as M,J as be,v as Ne,c as O,D as xe,S as Ae,T as _,V as X,Y}from"./arcadeUtils-vGyJZHQt.js";import{e as de,j as Le,q as ce,f as Se,c as me,a as Ce,b as ve,d as Pe,g as q,k as Ze,F as Re,T as $e,B as k,h as ke,i as B,L as C,I as ee}from"./featureSetUtils-0rkR6o7D.js";import{l as Me}from"./portalUtils-siGJ35LN.js";import{u as Ue,D as ye}from"./SpatialFilter-h73GoH-a.js";import{ar as pe,fs as Oe,es as W}from"./index-pCX-0tJH.js";import{x as T}from"./WhereClause-FOYoIAAW.js";import ne from"./FeatureLayer-9tNCmEbA.js";import"./hash-SS5GKVPY.js";import"./SubtypeGroupLayer-lkxtOZrq.js";import"./CustomParametersMixin-7nmugR3Y.js";import"./FeatureLayerBase-mvqC7cJs.js";import"./serviceCapabilitiesUtils-f-iBP4uh.js";import"./FeatureTemplate-vSzbyslg.js";import"./versionUtils-idhrDltC.js";import"./executeQueryPBF-P21isUTI.js";import"./executeForIds-PXSIkRGk.js";import"./FeatureType-0WPvBvpQ.js";import"./geometryEngineAsync-ly7k1Z_H.js";import"./editsZScale-4-dTv58d.js";import"./FeatureEffectLayer-OK0TB5f6.js";import"./FeatureEffect-0Jn9Z0sQ.js";import"./FeatureReductionLayer-2X2_PJv9.js";import"./OrderedLayer-XNaJwl_G.js";function ze(s,n,r,c){if(c.length===1){if(x(c[0]))return Y(s,c[0],-1);if(M(c[0]))return Y(s,c[0].toArray(),-1)}return Y(s,c,-1)}async function te(s,n,r){const c=s.getVariables();if(c.length>0){const F=[];for(let t=0;t{var u,p;if(N(e,1,2,n,r),De(e[0])||J(e[0]))return"Unknown";if(L(e[0])){if(await e[0].load(),e.length===1||e[1]===null)return e[0].datesInUnknownTimezone?z("unknown"):z(e[0].dateFieldsTimeZone);if(!(e[1]instanceof v)||e[1].hasField("type")===!1)throw new m(n,y.InvalidParameter,r);const o=e[1].field("type");if(P(o)===!1)throw new m(n,y.InvalidParameter,r);switch(b(o).toLowerCase()){case"preferredtimezone":return z(e[0].preferredTimeZone);case"editfieldsinfo":return z(((u=e[0].editFieldsInfo)==null?void 0:u.timeZone)??null);case"timeinfo":return z(((p=e[0].timeInfo)==null?void 0:p.timeZone)??null);case"field":if(e[1].hasField("fieldname")&&P(e[1].field("fieldname")))return z(e[0].fieldTimeZone(b(e[1].field("fieldname"))))}throw new m(n,y.InvalidParameter,r)}const t=Te(e[0],fe(n));if(t===null)return null;const i=t.timeZone;return i==="system"?Ie.systemTimeZoneCanonicalName:i.toLowerCase()==="utc"?"UTC":i.toLowerCase()==="unknown"?"Unknown":i})},s.functions.sqltimestamp=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{N(e,1,3,n,r);const t=e[0];if(ue(t)){if(e.length===1)return t.toSQLWithKeyword();if(e.length===2)return t.changeTimeZone(b(e[1])).toSQLWithKeyword();throw new m(n,y.InvalidParameter,r)}if(J(t))return t.toSQLWithKeyword();if(L(t)){if(e.length!==3)throw new m(n,y.InvalidParameter,r);await t.load();const i=b(e[1]);if(J(e[2]))return e[2].toSQLWithKeyword();if(ue(e[2])===!1)throw new m(n,y.InvalidParameter,r);const u=t.fieldTimeZone(i);return u===null?e[2].toSQLWithKeyword():e[2].changeTimeZone(u).toSQLWithKeyword()}throw new m(n,y.InvalidParameter,r)})},s.signatures.push({name:"sqltimestamp",min:2,max:4}),s.functions.featuresetbyid=function(n,r){return s.standardFunctionAsync(n,r,(c,F,e)=>{if(N(e,2,4,n,r),e[0]instanceof de){const t=b(e[1]);let i=S(e[2],null);const u=U(S(e[3],!0));if(i===null&&(i=["*"]),x(i)===!1)throw new m(n,y.InvalidParameter,r);return e[0].featureSetById(t,u,i)}throw new m(n,y.InvalidParameter,r)})},s.signatures.push({name:"featuresetbyid",min:2,max:4}),s.functions.getfeatureset=function(n,r){return s.standardFunctionAsync(n,r,(c,F,e)=>{if(N(e,1,2,n,r),G(e[0])){let t=S(e[1],"datasource");return t===null&&(t="datasource"),t=b(t).toLowerCase(),Le(e[0].fullSchema(),t,n.lrucache,n.interceptor,n.spatialReference)}throw new m(n,y.InvalidParameter,r)})},s.signatures.push({name:"getfeatureset",min:1,max:2}),s.functions.featuresetbyportalitem=function(n,r){return s.standardFunctionAsync(n,r,(c,F,e)=>{var o,a;if(N(e,2,5,n,r),e[0]===null)throw new m(n,y.PortalRequired,r);if(e[0]instanceof Ee){const l=b(e[1]),f=b(e[2]);let I=S(e[3],null);const D=U(S(e[4],!0));if(I===null&&(I=["*"]),x(I)===!1)throw new m(n,y.InvalidParameter,r);let w=null;return w=(o=n.services)!=null&&o.portal?n.services.portal:pe.getDefault(),w=Me(e[0],w),ce(l,f,n.spatialReference,I,D,w,n.lrucache,n.interceptor)}if(P(e[0])===!1)throw new m(n,y.PortalRequired,r);const t=b(e[0]),i=b(e[1]);let u=S(e[2],null);const p=U(S(e[3],!0));if(u===null&&(u=["*"]),x(u)===!1)throw new m(n,y.InvalidParameter,r);return ce(t,i,n.spatialReference,u,p,((a=n.services)==null?void 0:a.portal)??pe.getDefault(),n.lrucache,n.interceptor)})},s.signatures.push({name:"featuresetbyportalitem",min:2,max:5}),s.functions.featuresetbyname=function(n,r){return s.standardFunctionAsync(n,r,(c,F,e)=>{if(N(e,2,4,n,r),e[0]instanceof de){const t=b(e[1]);let i=S(e[2],null);const u=U(S(e[3],!0));if(i===null&&(i=["*"]),x(i)===!1)throw new m(n,y.InvalidParameter,r);return e[0].featureSetByName(t,u,i)}throw new m(n,y.InvalidParameter,r)})},s.signatures.push({name:"featuresetbyname",min:2,max:4}),s.functions.featureset=function(n,r){return s.standardFunction(n,r,(c,F,e)=>{N(e,1,1,n,r);let t=e[0];const i={layerDefinition:{geometryType:"",objectIdField:"",hasM:!1,hasZ:!1,globalIdField:"",typeIdField:"",fields:[]},featureSet:{geometryType:"",features:[]}};if(P(t))t=JSON.parse(t),t.layerDefinition!==void 0?(i.layerDefinition=t.layerDefinition,i.featureSet=t.featureSet,t.layerDefinition.spatialReference&&(i.layerDefinition.spatialReference=t.layerDefinition.spatialReference)):(i.featureSet.features=t.features,i.featureSet.geometryType=t.geometryType,i.layerDefinition.geometryType=i.featureSet.geometryType,i.layerDefinition.objectIdField=t.objectIdFieldName??"",i.layerDefinition.typeIdField=t.typeIdFieldName,i.layerDefinition.globalIdField=t.globalIdFieldName,i.layerDefinition.fields=t.fields,t.spatialReference&&(i.layerDefinition.spatialReference=t.spatialReference));else{if(!(e[0]instanceof v))throw new m(n,y.InvalidParameter,r);{t=JSON.parse(e[0].castToText(!0));const u=d(t,"layerdefinition");if(u!==null){i.layerDefinition.geometryType=d(u,"geometrytype",""),i.featureSet.geometryType=i.layerDefinition.geometryType,i.layerDefinition.globalIdField=d(u,"globalidfield",""),i.layerDefinition.objectIdField=d(u,"objectidfield",""),i.layerDefinition.typeIdField=d(u,"typeidfield",""),i.layerDefinition.hasZ=d(u,"hasz",!1)===!0,i.layerDefinition.hasM=d(u,"hasm",!1)===!0;const p=d(u,"spatialreference",null);p&&(i.layerDefinition.spatialReference=ae(p));for(const a of d(u,"fields",[])){const l={name:d(a,"name",""),alias:d(a,"alias",""),type:d(a,"type",""),nullable:d(a,"nullable",!0),editable:d(a,"editable",!0),length:d(a,"length",null),domain:we(d(a,"domain"))};i.layerDefinition.fields.push(l)}const o=d(t,"featureset",null);if(o){const a={};for(const l of i.layerDefinition.fields)a[l.name.toLowerCase()]=l.name;for(const l of d(o,"features",[])){const f={},I=d(l,"attributes",{});for(const D in I)f[a[D.toLowerCase()]]=I[D];i.featureSet.features.push({attributes:f,geometry:he(d(l,"geometry",null))})}}}else{i.layerDefinition.hasZ=d(t,"hasz",!1)===!0,i.layerDefinition.hasM=d(t,"hasm",!1)===!0,i.layerDefinition.geometryType=d(t,"geometrytype",""),i.featureSet.geometryType=i.layerDefinition.geometryType,i.layerDefinition.objectIdField=d(t,"objectidfieldname",""),i.layerDefinition.typeIdField=d(t,"typeidfieldname","");const p=d(t,"spatialreference",null);p&&(i.layerDefinition.spatialReference=ae(p));let o=d(t,"fields",null);if(x(o))for(const f of o){const I={name:d(f,"name",""),alias:d(f,"alias",""),type:d(f,"type",""),nullable:d(f,"nullable",!0),editable:d(f,"editable",!0),length:d(f,"length",null),domain:we(d(f,"domain"))};i.layerDefinition.fields.push(I)}else o=null,i.layerDefinition.fields=o;const a={};for(const f of i.layerDefinition.fields)a[f.name.toLowerCase()]=f.name;let l=d(t,"features",null);if(x(l))for(const f of l){const I={},D=d(f,"attributes",{});for(const w in D)I[a[w.toLowerCase()]]=D[w];i.featureSet.features.push({attributes:I,geometry:he(d(f,"geometry",null))})}else l=null,i.featureSet.features=l}}}if(He(i)===!1)throw new m(n,y.InvalidParameter,r);return i.layerDefinition.geometryType||(i.layerDefinition.geometryType="esriGeometryNull"),Se.create(i,n.spatialReference)})},s.signatures.push({name:"featureset",min:1,max:1}),s.functions.filter=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(N(e,2,2,n,r),x(e[0])||M(e[0])){const t=[];let i=e[0];i instanceof be&&(i=i.toArray());let u=null;if(!Ne(e[1]))throw new m(n,y.InvalidParameter,r);u=e[1].createFunction(n);for(const p of i){const o=u(p);Oe(o)?await o===!0&&t.push(p):o===!0&&t.push(p)}return t}if(L(e[0])){const t=await e[0].load(),i=T.create(e[1],t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC),u=i.getVariables();if(u.length>0){const p=[];for(let a=0;a{if(N(e,2,2,n,r),L(e[0])){const t=new Ce(e[1]);return new ve({parentfeatureset:e[0],orderbyclause:t})}throw new m(n,y.InvalidParameter,r)})},s.signatures.push({name:"orderby",min:2,max:2}),s.functions.top=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(N(e,2,2,n,r),L(e[0]))return new Pe({parentfeatureset:e[0],topnum:e[1]});if(x(e[0]))return O(e[1])>=e[0].length?e[0].slice(0):e[0].slice(0,O(e[1]));if(M(e[0]))return O(e[1])>=e[0].length()?e[0].slice(0):e[0].slice(0,O(e[1]));throw new m(n,y.InvalidParameter,r)})},s.signatures.push({name:"top",min:2,max:2}),s.functions.first=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(N(e,1,1,n,r),L(e[0])){const t=await e[0].first(c.abortSignal);if(t!==null){const i=xe.createFromGraphicLikeObject(t.geometry,t.attributes,e[0],n.timeZone);return i._underlyingGraphic=t,i}return t}return x(e[0])?e[0].length===0?null:e[0][0]:M(e[0])?e[0].length()===0?null:e[0].get(0):null})},s.signatures.push({name:"first",min:1,max:1}),s.functions.attachments=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{N(e,1,2,n,r);const t={minsize:-1,maxsize:-1,types:null,returnMetadata:!1};if(e.length>1){if(e[1]instanceof v){if(e[1].hasField("minsize")&&(t.minsize=O(e[1].field("minsize"))),e[1].hasField("metadata")&&(t.returnMetadata=U(e[1].field("metadata"))),e[1].hasField("maxsize")&&(t.maxsize=O(e[1].field("maxsize"))),e[1].hasField("types")){const i=Ae(e[1].field("types"),!1);i.length>0&&(t.types=i)}}else if(e[1]!==null)throw new m(n,y.InvalidParameter,r)}if(G(e[0])){let i=e[0]._layer;return i instanceof ne&&(i=q(i,n.spatialReference,["*"],!0,n.lrucache,n.interceptor)),i===null?[]:L(i)===!1?[]:(await i.load(),i.queryAttachments(e[0].field(i.objectIdField),t.minsize,t.maxsize,t.types,t.returnMetadata))}if(e[0]===null)return[];throw new m(n,y.InvalidParameter,r)})},s.signatures.push({name:"attachments",min:1,max:2}),s.functions.featuresetbyrelationshipname=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{N(e,2,4,n,r);const t=e[0],i=b(e[1]);let u=S(e[2],null);const p=U(S(e[3],!0));if(u===null&&(u=["*"]),x(u)===!1)throw new m(n,y.InvalidParameter,r);if(e[0]===null)return null;if(!G(e[0]))throw new m(n,y.InvalidParameter,r);let o=t._layer;if(o instanceof ne&&(o=q(o,n.spatialReference,["*"],!0,n.lrucache,n.interceptor)),o===null||L(o)===!1)return null;o=await o.load();const a=o.relationshipMetaData().filter(w=>w.name===i);if(a.length===0)return null;if(a[0].relationshipTableId!==void 0&&a[0].relationshipTableId!==null&&a[0].relationshipTableId>-1)return Ze(o,a[0],t.field(o.objectIdField),o.spatialReference,u,p,n.lrucache,n.interceptor);let l=o.serviceUrl();if(!l)return null;l=l.charAt(l.length-1)==="/"?l+a[0].relatedTableId.toString():l+"/"+a[0].relatedTableId.toString();const f=await Re(l,o.spatialReference,u,p,n.lrucache,n.interceptor);await f.load();let I=f.relationshipMetaData();if(I=I.filter(w=>w.id===a[0].id),t.hasField(a[0].keyField)===!1||t.field(a[0].keyField)===null){const w=await o.getFeatureByObjectId(t.field(o.objectIdField),[a[0].keyField]);if(w){const E=T.create(I[0].keyField+"= @id",f.getFieldsIndex(),f.dateFieldsTimeZoneDefaultUTC);return E.parameters={id:w.attributes[a[0].keyField]},f.filter(E)}return new Ue({parentfeatureset:f})}const D=T.create(I[0].keyField+"= @id",f.getFieldsIndex(),f.dateFieldsTimeZoneDefaultUTC);return D.parameters={id:t.field(a[0].keyField)},f.filter(D)})},s.signatures.push({name:"featuresetbyrelationshipname",min:2,max:4}),s.functions.featuresetbyassociation=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{N(e,2,3,n,r);const t=e[0],i=b(S(e[1],"")).toLowerCase(),u=P(e[2])?b(e[2]):null;if(e[0]===null)return null;if(!G(e[0]))throw new m(n,y.InvalidParameter,r);let p=t._layer;if(p instanceof ne&&(p=q(p,n.spatialReference,["*"],!0,n.lrucache,n.interceptor)),p===null||L(p)===!1)return null;await p.load();const o=p.serviceUrl(),a=await $e(o,n.spatialReference);let l=null,f=null,I=!1;if(u!==null&&u!==""&&u!==void 0){for(const g of a.terminals)g.terminalName===u&&(f=g.terminalId);f===null&&(I=!0)}const D=a.associations.getFieldsIndex(),w=D.get("TOGLOBALID").name,E=D.get("FROMGLOBALID").name,K=D.get("TOTERMINALID").name,V=D.get("FROMTERMINALID").name,j=D.get("FROMNETWORKSOURCEID").name,H=D.get("TONETWORKSOURCEID").name,$=D.get("ASSOCIATIONTYPE").name,ge=D.get("ISCONTENTVISIBLE").name,Fe=D.get("OBJECTID").name;for(const g of p.fields)if(g.type==="global-id"){l=t.field(g.name);break}let Z=null,ie=new k(new W({name:"percentalong",alias:"percentalong",type:"double"}),T.create("0",a.associations.getFieldsIndex(),a.associations.dateFieldsTimeZoneDefaultUTC)),re=new k(new W({name:"side",alias:"side",type:"string"}),T.create("''",a.associations.getFieldsIndex(),a.associations.dateFieldsTimeZoneDefaultUTC));const A="globalid",se="globalId",le={};for(const g in a.lkp)le[g]=a.lkp[g].sourceId;const R=new ke(new W({name:"classname",alias:"classname",type:"string"}),null,le);let h="";switch(i){case"midspan":{h=`((${w}='${l}') OR ( ${E}='${l}')) AND (${$} IN (5))`,R.codefield=T.create(`CASE WHEN (${w}='${l}') THEN ${j} ELSE ${H} END`,a.associations.getFieldsIndex(),a.associations.dateFieldsTimeZoneDefaultUTC);const g=X(C.findField(a.associations.fields,E));g.name=A,g.alias=A,Z=new k(g,T.create(`CASE WHEN (${E}='${l}') THEN ${w} ELSE ${E} END`,a.associations.getFieldsIndex(),a.associations.dateFieldsTimeZoneDefaultUTC)),ie=a.unVersion>=4?new ee(C.findField(a.associations.fields,D.get("PERCENTALONG").name)):new k(new W({name:"percentalong",alias:"percentalong",type:"double"}),T.create("0",a.associations.getFieldsIndex(),a.associations.dateFieldsTimeZoneDefaultUTC));break}case"junctionedge":{h=`((${w}='${l}') OR ( ${E}='${l}')) AND (${$} IN (4,6))`,R.codefield=T.create(`CASE WHEN (${w}='${l}') THEN ${j} ELSE ${H} END`,a.associations.getFieldsIndex(),a.associations.dateFieldsTimeZoneDefaultUTC);const g=X(C.findField(a.associations.fields,E));g.name=A,g.alias=A,Z=new k(g,T.create(`CASE WHEN (${E}='${l}') THEN ${w} ELSE ${E} END`,a.associations.getFieldsIndex(),a.associations.dateFieldsTimeZoneDefaultUTC)),re=new k(new W({name:"side",alias:"side",type:"string"}),T.create(`CASE WHEN (${$}=4) THEN 'from' ELSE 'to' END`,a.associations.getFieldsIndex(),a.associations.dateFieldsTimeZoneDefaultUTC));break}case"connected":{let g=`${w}='@T'`,oe=`${E}='@T'`;f!==null&&(g+=` AND ${K}=@A`,oe+=` AND ${V}=@A`),h="(("+g+") OR ("+oe+"))",h=_(h,"@T",l??""),g=_(g,"@T",l??""),f!==null&&(g=_(g,"@A",f.toString()),h=_(h,"@A",f.toString())),R.codefield=T.create("CASE WHEN "+g+` THEN ${j} ELSE ${H} END`,a.associations.getFieldsIndex(),a.associations.dateFieldsTimeZoneDefaultUTC);const Q=X(C.findField(a.associations.fields,E));Q.name=A,Q.alias=A,Z=new k(Q,T.create("CASE WHEN "+g+` THEN ${E} ELSE ${w} END`,a.associations.getFieldsIndex(),a.associations.dateFieldsTimeZoneDefaultUTC));break}case"container":h=`${w}='${l}' AND ${$} = 2`,f!==null&&(h+=` AND ${K} = `+f.toString()),R.codefield=j,h="( "+h+" )",Z=new B(C.findField(a.associations.fields,E),A,A);break;case"content":h=`(${E}='${l}' AND ${$} = 2)`,f!==null&&(h+=` AND ${V} = `+f.toString()),R.codefield=H,h="( "+h+" )",Z=new B(C.findField(a.associations.fields,w),A,A);break;case"structure":h=`(${w}='${l}' AND ${$} = 3)`,f!==null&&(h+=` AND ${K} = `+f.toString()),R.codefield=j,h="( "+h+" )",Z=new B(C.findField(a.associations.fields,E),A,se);break;case"attached":h=`(${E}='${l}' AND ${$} = 3)`,f!==null&&(h+=` AND ${V} = `+f.toString()),R.codefield=H,h="( "+h+" )",Z=new B(C.findField(a.associations.fields,w),A,se);break;default:throw new m(n,y.InvalidParameter,r)}return I&&(h="1 <> 1"),new C({parentfeatureset:a.associations,adaptedFields:[new ee(C.findField(a.associations.fields,Fe)),new ee(C.findField(a.associations.fields,ge)),Z,re,R,ie],extraFilter:h?T.create(h,a.associations.getFieldsIndex(),a.associations.dateFieldsTimeZoneDefaultUTC):null})})},s.signatures.push({name:"featuresetbyassociation",min:2,max:6}),s.functions.groupby=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(N(e,3,3,n,r),!L(e[0]))throw new m(n,y.InvalidParameter,r);const t=await e[0].load(),i=[],u=[];let p=!1,o=[];if(P(e[1]))o.push(e[1]);else if(e[1]instanceof v)o.push(e[1]);else if(x(e[1]))o=e[1];else{if(!M(e[1]))throw new m(n,y.InvalidParameter,r);o=e[1].toArray()}for(const a of o)if(P(a)){const l=T.create(b(a),t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC),f=ye(l)===!0?b(a):"%%%%FIELDNAME";i.push({name:f,expression:l}),f==="%%%%FIELDNAME"&&(p=!0)}else{if(!(a instanceof v))throw new m(n,y.InvalidParameter,r);{const l=a.hasField("name")?a.field("name"):"%%%%FIELDNAME",f=a.hasField("expression")?a.field("expression"):"";if(l==="%%%%FIELDNAME"&&(p=!0),!l)throw new m(n,y.InvalidParameter,r);i.push({name:l,expression:T.create(f||l,t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC)})}}if(o=[],P(e[2]))o.push(e[2]);else if(x(e[2]))o=e[2];else if(M(e[2]))o=e[2].toArray();else{if(!(e[2]instanceof v))throw new m(n,y.InvalidParameter,r);o.push(e[2])}for(const a of o){if(!(a instanceof v))throw new m(n,y.InvalidParameter,r);{const l=a.hasField("name")?a.field("name"):"",f=a.hasField("statistic")?a.field("statistic"):"",I=a.hasField("expression")?a.field("expression"):"";if(!l||!f||!I)throw new m(n,y.InvalidParameter,r);u.push({name:l,statistic:f.toLowerCase(),expression:T.create(I,t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC)})}}if(p){const a={};for(const f of t.fields)a[f.name.toLowerCase()]=1;for(const f of i)f.name!=="%%%%FIELDNAME"&&(a[f.name.toLowerCase()]=1);for(const f of u)f.name!=="%%%%FIELDNAME"&&(a[f.name.toLowerCase()]=1);let l=0;for(const f of i)if(f.name==="%%%%FIELDNAME"){for(;a["field_"+l.toString()]===1;)l++;a["field_"+l.toString()]=1,f.name="FIELD_"+l.toString()}}for(const a of i)await te(a.expression,s,n);for(const a of u)await te(a.expression,s,n);return e[0].groupby(i,u)})},s.signatures.push({name:"groupby",min:3,max:3}),s.functions.distinct=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(L(e[0])){N(e,2,2,n,r);const t=await e[0].load(),i=[];let u=[];if(P(e[1]))u.push(e[1]);else if(e[1]instanceof v)u.push(e[1]);else if(x(e[1]))u=e[1];else{if(!M(e[1]))throw new m(n,y.InvalidParameter,r);u=e[1].toArray()}let p=!1;for(const o of u)if(P(o)){const a=T.create(b(o),t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC),l=ye(a)===!0?b(o):"%%%%FIELDNAME";i.push({name:l,expression:a}),l==="%%%%FIELDNAME"&&(p=!0)}else{if(!(o instanceof v))throw new m(n,y.InvalidParameter,r);{const a=o.hasField("name")?o.field("name"):"%%%%FIELDNAME",l=o.hasField("expression")?o.field("expression"):"";if(a==="%%%%FIELDNAME"&&(p=!0),!a)throw new m(n,y.InvalidParameter,r);i.push({name:a,expression:T.create(l||a,t.getFieldsIndex(),t.dateFieldsTimeZoneDefaultUTC)})}}if(p){const o={};for(const l of t.fields)o[l.name.toLowerCase()]=1;for(const l of i)l.name!=="%%%%FIELDNAME"&&(o[l.name.toLowerCase()]=1);let a=0;for(const l of i)if(l.name==="%%%%FIELDNAME"){for(;o["field_"+a.toString()]===1;)a++;o["field_"+a.toString()]=1,l.name="FIELD_"+a.toString()}}for(const o of i)await te(o.expression,s,n);return e[0].groupby(i,[])}return ze("distinct",c,F,e)})}),s.functions.getfeaturesetinfo=function(n,r){return s.standardFunctionAsync(n,r,async(c,F,e)=>{if(N(e,1,1,n,r),!L(e[0]))return null;const t=await e[0].getFeatureSetInfo();return t?v.convertObjectToArcadeDictionary({layerId:t.layerId,layerName:t.layerName,itemId:t.itemId,serviceLayerUrl:t.serviceLayerUrl,webMapLayerId:t.webMapLayerId??null,webMapLayerTitle:t.webMapLayerTitle??null,className:null,objectClassId:null},fe(n),!1,!1):null})},s.signatures.push({name:"getfeaturesetinfo",min:1,max:1})}export{yn as registerFunctions}; diff --git a/dist/assets/featuresetgeom-3-0z5YnY.js b/dist/assets/featuresetgeom-WIoEup4p.js similarity index 88% rename from dist/assets/featuresetgeom-3-0z5YnY.js rename to dist/assets/featuresetgeom-WIoEup4p.js index eb2b317..a3de94a 100644 --- a/dist/assets/featuresetgeom-3-0z5YnY.js +++ b/dist/assets/featuresetgeom-WIoEup4p.js @@ -1 +1 @@ -import{Z as S,n as F,d as p,H as i,a as o,r as l}from"./arcadeUtils-OUqwHs4P.js";import{s as w}from"./TimeOnly-ljWtUK7N.js";import{u as c,f as h}from"./SpatialFilter-CXhA7RaJ.js";import{ha as u}from"./index-J0iiHjMT.js";import{relate as I,crosses as A,touches as P,within as g,overlaps as C,contains as O,intersects as R}from"./geometryEngineAsync-QjQc0riy.js";import"./hash-SS5GKVPY.js";import"./WhereClause-XAMIZ4-B.js";function f(r){return r instanceof u}function a(r,t,s,d){return d(r,t,async(y,e,n)=>{if(n.length<2)throw new o(r,l.WrongNumberOfParameters,t);if((n=S(n))[0]===null&&n[1]===null)return!1;if(i(n[0])){if(n[1]instanceof u)return new h({parentfeatureset:n[0],relation:s,relationGeom:n[1]});if(n[1]===null)return new c({parentfeatureset:n[0]});throw new o(r,l.InvalidParameter,t)}if(f(n[0])){if(f(n[1])){switch(s){case"esriSpatialRelEnvelopeIntersects":return R(w(n[0]),w(n[1]));case"esriSpatialRelIntersects":return R(n[0],n[1]);case"esriSpatialRelContains":return O(n[0],n[1]);case"esriSpatialRelOverlaps":return C(n[0],n[1]);case"esriSpatialRelWithin":return g(n[0],n[1]);case"esriSpatialRelTouches":return P(n[0],n[1]);case"esriSpatialRelCrosses":return A(n[0],n[1])}throw new o(r,l.InvalidParameter,t)}if(i(n[1]))return new h({parentfeatureset:n[1],relation:s,relationGeom:n[0]});if(n[1]===null)return!1;throw new o(r,l.InvalidParameter,t)}if(n[0]!==null)throw new o(r,l.InvalidParameter,t);return i(n[1])?new c({parentfeatureset:n[1]}):!(n[1]instanceof u||n[1]===null)&&void 0})}function H(r){r.mode==="async"&&(r.functions.intersects=function(t,s){return a(t,s,"esriSpatialRelIntersects",r.standardFunctionAsync)},r.functions.envelopeintersects=function(t,s){return a(t,s,"esriSpatialRelEnvelopeIntersects",r.standardFunctionAsync)},r.signatures.push({name:"envelopeintersects",min:2,max:2}),r.functions.contains=function(t,s){return a(t,s,"esriSpatialRelContains",r.standardFunctionAsync)},r.functions.overlaps=function(t,s){return a(t,s,"esriSpatialRelOverlaps",r.standardFunctionAsync)},r.functions.within=function(t,s){return a(t,s,"esriSpatialRelWithin",r.standardFunctionAsync)},r.functions.touches=function(t,s){return a(t,s,"esriSpatialRelTouches",r.standardFunctionAsync)},r.functions.crosses=function(t,s){return a(t,s,"esriSpatialRelCrosses",r.standardFunctionAsync)},r.functions.relate=function(t,s){return r.standardFunctionAsync(t,s,(d,y,e)=>{if(e=S(e),F(e,3,3,t,s),f(e[0])&&f(e[1]))return I(e[0],e[1],p(e[2]));if(e[0]instanceof u&&e[1]===null||e[1]instanceof u&&e[0]===null)return!1;if(i(e[0])&&e[1]===null)return new c({parentfeatureset:e[0]});if(i(e[1])&&e[0]===null)return new c({parentfeatureset:e[1]});if(i(e[0])&&e[1]instanceof u)return e[0].relate(e[1],p(e[2]));if(i(e[1])&&e[0]instanceof u)return e[1].relate(e[0],p(e[2]));if(e[0]===null&&e[1]===null)return!1;throw new o(t,l.InvalidParameter,s)})})}export{H as registerFunctions}; +import{Z as S,n as F,d as p,H as i,a as o,r as l}from"./arcadeUtils-vGyJZHQt.js";import{s as w}from"./TimeOnly-gkehHHJx.js";import{u as c,f as h}from"./SpatialFilter-h73GoH-a.js";import{hc as u}from"./index-pCX-0tJH.js";import{relate as I,crosses as A,touches as P,within as g,overlaps as C,contains as O,intersects as R}from"./geometryEngineAsync-ly7k1Z_H.js";import"./hash-SS5GKVPY.js";import"./WhereClause-FOYoIAAW.js";function f(r){return r instanceof u}function a(r,t,s,d){return d(r,t,async(y,e,n)=>{if(n.length<2)throw new o(r,l.WrongNumberOfParameters,t);if((n=S(n))[0]===null&&n[1]===null)return!1;if(i(n[0])){if(n[1]instanceof u)return new h({parentfeatureset:n[0],relation:s,relationGeom:n[1]});if(n[1]===null)return new c({parentfeatureset:n[0]});throw new o(r,l.InvalidParameter,t)}if(f(n[0])){if(f(n[1])){switch(s){case"esriSpatialRelEnvelopeIntersects":return R(w(n[0]),w(n[1]));case"esriSpatialRelIntersects":return R(n[0],n[1]);case"esriSpatialRelContains":return O(n[0],n[1]);case"esriSpatialRelOverlaps":return C(n[0],n[1]);case"esriSpatialRelWithin":return g(n[0],n[1]);case"esriSpatialRelTouches":return P(n[0],n[1]);case"esriSpatialRelCrosses":return A(n[0],n[1])}throw new o(r,l.InvalidParameter,t)}if(i(n[1]))return new h({parentfeatureset:n[1],relation:s,relationGeom:n[0]});if(n[1]===null)return!1;throw new o(r,l.InvalidParameter,t)}if(n[0]!==null)throw new o(r,l.InvalidParameter,t);return i(n[1])?new c({parentfeatureset:n[1]}):!(n[1]instanceof u||n[1]===null)&&void 0})}function H(r){r.mode==="async"&&(r.functions.intersects=function(t,s){return a(t,s,"esriSpatialRelIntersects",r.standardFunctionAsync)},r.functions.envelopeintersects=function(t,s){return a(t,s,"esriSpatialRelEnvelopeIntersects",r.standardFunctionAsync)},r.signatures.push({name:"envelopeintersects",min:2,max:2}),r.functions.contains=function(t,s){return a(t,s,"esriSpatialRelContains",r.standardFunctionAsync)},r.functions.overlaps=function(t,s){return a(t,s,"esriSpatialRelOverlaps",r.standardFunctionAsync)},r.functions.within=function(t,s){return a(t,s,"esriSpatialRelWithin",r.standardFunctionAsync)},r.functions.touches=function(t,s){return a(t,s,"esriSpatialRelTouches",r.standardFunctionAsync)},r.functions.crosses=function(t,s){return a(t,s,"esriSpatialRelCrosses",r.standardFunctionAsync)},r.functions.relate=function(t,s){return r.standardFunctionAsync(t,s,(d,y,e)=>{if(e=S(e),F(e,3,3,t,s),f(e[0])&&f(e[1]))return I(e[0],e[1],p(e[2]));if(e[0]instanceof u&&e[1]===null||e[1]instanceof u&&e[0]===null)return!1;if(i(e[0])&&e[1]===null)return new c({parentfeatureset:e[0]});if(i(e[1])&&e[0]===null)return new c({parentfeatureset:e[1]});if(i(e[0])&&e[1]instanceof u)return e[0].relate(e[1],p(e[2]));if(i(e[1])&&e[0]instanceof u)return e[1].relate(e[0],p(e[2]));if(e[0]===null&&e[1]===null)return!1;throw new o(t,l.InvalidParameter,s)})})}export{H as registerFunctions}; diff --git a/dist/assets/featuresetstats-NfM8OXOZ.js b/dist/assets/featuresetstats-XgeLbwEn.js similarity index 91% rename from dist/assets/featuresetstats-NfM8OXOZ.js rename to dist/assets/featuresetstats-XgeLbwEn.js index f207c7a..bf6c4d3 100644 --- a/dist/assets/featuresetstats-NfM8OXOZ.js +++ b/dist/assets/featuresetstats-XgeLbwEn.js @@ -1 +1 @@ -import{m as g}from"./TimeOnly-ljWtUK7N.js";import{n as h,H as l,q as m,P as p,b as d,a as w,r as S,Y as f,A as c,y as v}from"./arcadeUtils-OUqwHs4P.js";import{x as y,r as x}from"./WhereClause-XAMIZ4-B.js";import"./index-J0iiHjMT.js";import"./hash-SS5GKVPY.js";async function s(n,e,a,t,i,r){if(t.length===1){if(m(t[0]))return f(n,t[0],c(t[1],-1));if(d(t[0]))return f(n,t[0].toArray(),c(t[1],-1))}else if(t.length===2){if(m(t[0]))return f(n,t[0],c(t[1],-1));if(d(t[0]))return f(n,t[0].toArray(),c(t[1],-1));if(l(t[0])){const o=await t[0].load(),u=await F(y.create(t[1],o.getFieldsIndex(),o.dateFieldsTimeZoneDefaultUTC),r,i);return A(i,await t[0].calculateStatistic(n,u,c(t[2],1e3),e.abortSignal))}}else if(t.length===3&&l(t[0])){const o=await t[0].load(),u=await F(y.create(t[1],o.getFieldsIndex(),o.dateFieldsTimeZoneDefaultUTC),r,i);return A(i,await t[0].calculateStatistic(n,u,c(t[2],1e3),e.abortSignal))}return f(n,t,-1)}function A(n,e){return e instanceof x?g.fromReaderAsTimeStampOffset(e.toStorageFormat()):e instanceof Date?g.dateJSAndZoneToArcadeDate(e,v(n)):e}async function F(n,e,a){const t=n.getVariables();if(t.length>0){const i=[];for(let o=0;os("stdev",t,i,r,e,n))},n.functions.variance=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("variance",t,i,r,e,n))},n.functions.average=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("mean",t,i,r,e,n))},n.functions.mean=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("mean",t,i,r,e,n))},n.functions.sum=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("sum",t,i,r,e,n))},n.functions.min=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("min",t,i,r,e,n))},n.functions.max=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("max",t,i,r,e,n))},n.functions.count=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>{if(h(r,1,1,e,a),l(r[0]))return r[0].count(t.abortSignal);if(m(r[0])||p(r[0]))return r[0].length;if(d(r[0]))return r[0].length();throw new w(e,S.InvalidParameter,a)})})}export{Z as registerFunctions}; +import{m as g}from"./TimeOnly-gkehHHJx.js";import{n as h,H as l,q as m,P as p,b as d,a as w,r as S,Y as f,A as c,y as v}from"./arcadeUtils-vGyJZHQt.js";import{x as y,r as x}from"./WhereClause-FOYoIAAW.js";import"./index-pCX-0tJH.js";import"./hash-SS5GKVPY.js";async function s(n,e,a,t,i,r){if(t.length===1){if(m(t[0]))return f(n,t[0],c(t[1],-1));if(d(t[0]))return f(n,t[0].toArray(),c(t[1],-1))}else if(t.length===2){if(m(t[0]))return f(n,t[0],c(t[1],-1));if(d(t[0]))return f(n,t[0].toArray(),c(t[1],-1));if(l(t[0])){const o=await t[0].load(),u=await F(y.create(t[1],o.getFieldsIndex(),o.dateFieldsTimeZoneDefaultUTC),r,i);return A(i,await t[0].calculateStatistic(n,u,c(t[2],1e3),e.abortSignal))}}else if(t.length===3&&l(t[0])){const o=await t[0].load(),u=await F(y.create(t[1],o.getFieldsIndex(),o.dateFieldsTimeZoneDefaultUTC),r,i);return A(i,await t[0].calculateStatistic(n,u,c(t[2],1e3),e.abortSignal))}return f(n,t,-1)}function A(n,e){return e instanceof x?g.fromReaderAsTimeStampOffset(e.toStorageFormat()):e instanceof Date?g.dateJSAndZoneToArcadeDate(e,v(n)):e}async function F(n,e,a){const t=n.getVariables();if(t.length>0){const i=[];for(let o=0;os("stdev",t,i,r,e,n))},n.functions.variance=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("variance",t,i,r,e,n))},n.functions.average=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("mean",t,i,r,e,n))},n.functions.mean=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("mean",t,i,r,e,n))},n.functions.sum=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("sum",t,i,r,e,n))},n.functions.min=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("min",t,i,r,e,n))},n.functions.max=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>s("max",t,i,r,e,n))},n.functions.count=function(e,a){return n.standardFunctionAsync(e,a,(t,i,r)=>{if(h(r,1,1,e,a),l(r[0]))return r[0].count(t.abortSignal);if(m(r[0])||p(r[0]))return r[0].length;if(d(r[0]))return r[0].length();throw new w(e,S.InvalidParameter,a)})})}export{Z as registerFunctions}; diff --git a/dist/assets/featuresetstring-bt3R_cQ2.js b/dist/assets/featuresetstring-fiKCNpVo.js similarity index 95% rename from dist/assets/featuresetstring-bt3R_cQ2.js rename to dist/assets/featuresetstring-fiKCNpVo.js index 4569d6f..cd0eac6 100644 --- a/dist/assets/featuresetstring-bt3R_cQ2.js +++ b/dist/assets/featuresetstring-fiKCNpVo.js @@ -1 +1 @@ -import{n as o,U as s,_ as T,d as u,H as c,a0 as w,a as m,r as y,a1 as b,N as v,y as f,a2 as A,a3 as x,a4 as g,a5 as F,a6 as D,A as L,a7 as V,a8 as l}from"./arcadeUtils-OUqwHs4P.js";import"./index-J0iiHjMT.js";import"./TimeOnly-ljWtUK7N.js";import"./hash-SS5GKVPY.js";function p(a,e){return a&&a.domain?a.domain.type==="coded-value"||a.domain.type==="codedValue"?v.convertObjectToArcadeDictionary({type:"codedValue",name:a.domain.name,dataType:l[a.field.type],codedValues:a.domain.codedValues.map(t=>({name:t.name,code:t.code}))},f(e)):v.convertObjectToArcadeDictionary({type:"range",name:a.domain.name,dataType:l[a.field.type],min:a.domain.min,max:a.domain.max},f(e)):null}function _(a){a.mode==="async"&&(a.functions.domain=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,2,3,e,t),s(n[0]))return p(T(n[0],u(n[1]),n[2]===void 0?void 0:n[2]),e);if(c(n[0]))return await n[0]._ensureLoaded(),p(w(u(n[1]),n[0],null,n[2]===void 0?void 0:n[2]),e);throw new m(e,y.InvalidParameter,t)})},a.functions.subtypes=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,1,1,e,t),s(n[0])){const r=b(n[0]);return r?v.convertObjectToArcadeDictionary(r,f(e)):null}if(c(n[0])){await n[0]._ensureLoaded();const r=n[0].subtypes();return r?v.convertObjectToArcadeDictionary(r,f(e)):null}throw new m(e,y.InvalidParameter,t)})},a.functions.domainname=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,2,4,e,t),s(n[0]))return A(n[0],u(n[1]),n[2],n[3]===void 0?void 0:n[3]);if(c(n[0])){await n[0]._ensureLoaded();const r=w(u(n[1]),n[0],null,n[3]===void 0?void 0:n[3]);return x(r,n[2])}throw new m(e,y.InvalidParameter,t)})},a.signatures.push({name:"domainname",min:2,max:4}),a.functions.domaincode=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,2,4,e,t),s(n[0]))return g(n[0],u(n[1]),n[2],n[3]===void 0?void 0:n[3]);if(c(n[0])){await n[0]._ensureLoaded();const r=w(u(n[1]),n[0],null,n[3]===void 0?void 0:n[3]);return F(r,n[2])}throw new m(e,y.InvalidParameter,t)})},a.signatures.push({name:"domaincode",min:2,max:4})),a.functions.text=function(e,t){return a.standardFunctionAsync(e,t,(i,d,n)=>{if(o(n,1,2,e,t),!c(n[0]))return D(n[0],n[1]);{const r=L(n[1],"");if(r==="")return n[0].castToText();if(r.toLowerCase()==="schema")return n[0].convertToText("schema",i.abortSignal);if(r.toLowerCase()==="featureset")return n[0].convertToText("featureset",i.abortSignal)}})},a.functions.gdbversion=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,1,1,e,t),s(n[0]))return n[0].gdbVersion();if(c(n[0]))return(await n[0].load()).gdbVersion;throw new m(e,y.InvalidParameter,t)})},a.functions.schema=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,1,1,e,t),c(n[0]))return await n[0].load(),v.convertObjectToArcadeDictionary(n[0].schema(),f(e));if(s(n[0])){const r=V(n[0]);return r?v.convertObjectToArcadeDictionary(r,f(e)):null}throw new m(e,y.InvalidParameter,t)})}}export{_ as registerFunctions}; +import{n as o,U as s,_ as T,d as u,H as c,a0 as w,a as m,r as y,a1 as b,N as v,y as f,a2 as A,a3 as x,a4 as g,a5 as F,a6 as D,A as L,a7 as V,a8 as l}from"./arcadeUtils-vGyJZHQt.js";import"./index-pCX-0tJH.js";import"./TimeOnly-gkehHHJx.js";import"./hash-SS5GKVPY.js";function p(a,e){return a&&a.domain?a.domain.type==="coded-value"||a.domain.type==="codedValue"?v.convertObjectToArcadeDictionary({type:"codedValue",name:a.domain.name,dataType:l[a.field.type],codedValues:a.domain.codedValues.map(t=>({name:t.name,code:t.code}))},f(e)):v.convertObjectToArcadeDictionary({type:"range",name:a.domain.name,dataType:l[a.field.type],min:a.domain.min,max:a.domain.max},f(e)):null}function _(a){a.mode==="async"&&(a.functions.domain=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,2,3,e,t),s(n[0]))return p(T(n[0],u(n[1]),n[2]===void 0?void 0:n[2]),e);if(c(n[0]))return await n[0]._ensureLoaded(),p(w(u(n[1]),n[0],null,n[2]===void 0?void 0:n[2]),e);throw new m(e,y.InvalidParameter,t)})},a.functions.subtypes=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,1,1,e,t),s(n[0])){const r=b(n[0]);return r?v.convertObjectToArcadeDictionary(r,f(e)):null}if(c(n[0])){await n[0]._ensureLoaded();const r=n[0].subtypes();return r?v.convertObjectToArcadeDictionary(r,f(e)):null}throw new m(e,y.InvalidParameter,t)})},a.functions.domainname=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,2,4,e,t),s(n[0]))return A(n[0],u(n[1]),n[2],n[3]===void 0?void 0:n[3]);if(c(n[0])){await n[0]._ensureLoaded();const r=w(u(n[1]),n[0],null,n[3]===void 0?void 0:n[3]);return x(r,n[2])}throw new m(e,y.InvalidParameter,t)})},a.signatures.push({name:"domainname",min:2,max:4}),a.functions.domaincode=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,2,4,e,t),s(n[0]))return g(n[0],u(n[1]),n[2],n[3]===void 0?void 0:n[3]);if(c(n[0])){await n[0]._ensureLoaded();const r=w(u(n[1]),n[0],null,n[3]===void 0?void 0:n[3]);return F(r,n[2])}throw new m(e,y.InvalidParameter,t)})},a.signatures.push({name:"domaincode",min:2,max:4})),a.functions.text=function(e,t){return a.standardFunctionAsync(e,t,(i,d,n)=>{if(o(n,1,2,e,t),!c(n[0]))return D(n[0],n[1]);{const r=L(n[1],"");if(r==="")return n[0].castToText();if(r.toLowerCase()==="schema")return n[0].convertToText("schema",i.abortSignal);if(r.toLowerCase()==="featureset")return n[0].convertToText("featureset",i.abortSignal)}})},a.functions.gdbversion=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,1,1,e,t),s(n[0]))return n[0].gdbVersion();if(c(n[0]))return(await n[0].load()).gdbVersion;throw new m(e,y.InvalidParameter,t)})},a.functions.schema=function(e,t){return a.standardFunctionAsync(e,t,async(i,d,n)=>{if(o(n,1,1,e,t),c(n[0]))return await n[0].load(),v.convertObjectToArcadeDictionary(n[0].schema(),f(e));if(s(n[0])){const r=V(n[0]);return r?v.convertObjectToArcadeDictionary(r,f(e)):null}throw new m(e,y.InvalidParameter,t)})}}export{_ as registerFunctions}; diff --git a/dist/assets/fetchService-wPWKuma6.js b/dist/assets/fetchService-cGWNcQnc.js similarity index 90% rename from dist/assets/fetchService-wPWKuma6.js rename to dist/assets/fetchService-cGWNcQnc.js index aea1fe5..65ad5e2 100644 --- a/dist/assets/fetchService-wPWKuma6.js +++ b/dist/assets/fetchService-cGWNcQnc.js @@ -1 +1 @@ -import{t as s}from"./requestPresets-18nzHK5y.js";async function b(t,a){const r=await s(t,a);y(r),o(r);const n={serviceJSON:r};if((r.currentVersion??0)<10.5)return n;const e=await s(t+"/layers",a);return y(e),o(e),n.layersJSON={layers:e.layers,tables:e.tables},n}function i(t){return t.type==="Feature Layer"||t.type==="Oriented Imagery Layer"}function l(t){return t.type==="Table"}function o(t){var a,r;t.layers=(a=t.layers)==null?void 0:a.filter(i),t.tables=(r=t.tables)==null?void 0:r.filter(l)}function c(t){t.type||(t.type="Feature Layer")}function u(t){t.type||(t.type="Table")}function y(t){var a,r;(a=t.layers)==null||a.forEach(c),(r=t.tables)==null||r.forEach(u)}export{b as t}; +import{t as s}from"./requestPresets-f6ZAWLqV.js";async function b(t,a){const r=await s(t,a);y(r),o(r);const n={serviceJSON:r};if((r.currentVersion??0)<10.5)return n;const e=await s(t+"/layers",a);return y(e),o(e),n.layersJSON={layers:e.layers,tables:e.tables},n}function i(t){return t.type==="Feature Layer"||t.type==="Oriented Imagery Layer"}function l(t){return t.type==="Table"}function o(t){var a,r;t.layers=(a=t.layers)==null?void 0:a.filter(i),t.tables=(r=t.tables)==null?void 0:r.filter(l)}function c(t){t.type||(t.type="Feature Layer")}function u(t){t.type||(t.type="Table")}function y(t){var a,r;(a=t.layers)==null||a.forEach(c),(r=t.tables)==null||r.forEach(u)}export{b as t}; diff --git a/dist/assets/floating-ui-McpI0u1Z.js b/dist/assets/floating-ui-C10Xvlxv.js similarity index 99% rename from dist/assets/floating-ui-McpI0u1Z.js rename to dist/assets/floating-ui-C10Xvlxv.js index 05c8a63..7259e4e 100644 --- a/dist/assets/floating-ui-McpI0u1Z.js +++ b/dist/assets/floating-ui-C10Xvlxv.js @@ -1,4 +1,4 @@ -import{ch as It}from"./index-J0iiHjMT.js";import{d as zt}from"./debounce-HnHf1UOZ.js";/*! +import{aS as It}from"./index-pCX-0tJH.js";import{d as zt}from"./debounce-HnHf1UOZ.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/form-2Iq0hI3D.js b/dist/assets/form-1U5Kiwxm.js similarity index 66% rename from dist/assets/form-2Iq0hI3D.js rename to dist/assets/form-1U5Kiwxm.js index b624e60..8edfb37 100644 --- a/dist/assets/form-2Iq0hI3D.js +++ b/dist/assets/form-1U5Kiwxm.js @@ -1,5 +1,5 @@ -import{z as I,cm as b,t as S}from"./index-J0iiHjMT.js";/*! +import{q as I,aX as b,k as S}from"./index-pCX-0tJH.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const f="hidden-form-input";function h(e){return"checked"in e}const m=new WeakMap,E=new WeakSet;function R(e,t){if(b(t.parentElement,"[form]"))return!0;const n="calciteInternalFormComponentRegister";let a=!1;return e.addEventListener(n,d=>{a=d.composedPath().some(u=>E.has(u)),d.stopPropagation()},{once:!0}),t.dispatchEvent(new CustomEvent(n,{bubbles:!0,composed:!0})),a}function L(e){const{formEl:t}=e;return t?(t.requestSubmit(),!0):!1}function P(e){var t;(t=e.formEl)==null||t.reset()}function V(e){const{el:t,value:r}=e,n=y(e);if(!n||R(n,t))return;e.formEl=n,e.defaultValue=r,h(e)&&(e.defaultChecked=e.checked);const a=(e.onFormReset||H).bind(e);n.addEventListener("reset",a),m.set(e.el,a),E.add(t)}function y(e){const{el:t,form:r}=e;return r?I(t,{id:r}):b(t,"form")}function H(){if(h(this)){this.checked=this.defaultChecked;return}this.value=this.defaultValue}function q(e){const{el:t,formEl:r}=e;if(!r)return;const n=m.get(t);r.removeEventListener("reset",n),m.delete(t),e.formEl=null,E.delete(t)}function W(e,t){e.defaultValue=t}const g=e=>{e.target.dispatchEvent(new CustomEvent("calciteInternalHiddenInputChange",{bubbles:!0}))},v=e=>e.removeEventListener("change",g);function w(e){const{el:t,formEl:r,name:n,value:a}=e,{ownerDocument:d}=t,u=t.querySelectorAll(`input[slot="${f}"]`);if(!r||!n){u.forEach(s=>{v(s),s.remove()});return}const i=Array.isArray(a)?a:[a],l=[],F=new Set;u.forEach(s=>{const o=i.find(k=>k==s.value);o!=null?(F.add(o),C(e,s,o)):l.push(s)});let c;i.forEach(s=>{if(F.has(s))return;let o=l.pop();o||(o=d.createElement("input"),o.slot=f),c||(c=d.createDocumentFragment()),c.append(o),o.addEventListener("change",g),C(e,o,s)}),c&&t.append(c),l.forEach(s=>{v(s),s.remove()})}function C(e,t,r){var l;const{defaultValue:n,disabled:a,form:d,name:u,required:i}=e;t.defaultValue=n,t.disabled=a,t.name=u,t.required=i,t.tabIndex=-1,d?t.setAttribute("form",d):t.removeAttribute("form"),h(e)?(t.checked=e.checked,t.defaultChecked=e.defaultChecked,t.value=e.checked?r||"on":""):t.value=r||"",(l=e.syncHiddenFormInput)==null||l.call(e,t)}const x=({component:e})=>(w(e),S("slot",{name:f}));export{x as H,W as a,V as c,q as d,y as f,P as r,L as s}; + */const f="hidden-form-input";function h(e){return"checked"in e}const m=new WeakMap,E=new WeakSet;function R(e,t){if(b(t.parentElement,"[form]"))return!0;const n="calciteInternalFormComponentRegister";let a=!1;return e.addEventListener(n,d=>{a=d.composedPath().some(u=>E.has(u)),d.stopPropagation()},{once:!0}),t.dispatchEvent(new CustomEvent(n,{bubbles:!0,composed:!0})),a}function A(e){const{formEl:t}=e;return t?(t.requestSubmit(),!0):!1}function L(e){var t;(t=e.formEl)==null||t.reset()}function P(e){const{el:t,value:r}=e,n=y(e);if(!n||R(n,t))return;e.formEl=n,e.defaultValue=r,h(e)&&(e.defaultChecked=e.checked);const a=(e.onFormReset||H).bind(e);n.addEventListener("reset",a),m.set(e.el,a),E.add(t)}function y(e){const{el:t,form:r}=e;return r?I(t,{id:r}):b(t,"form")}function H(){if(h(this)){this.checked=this.defaultChecked;return}this.value=this.defaultValue}function V(e){const{el:t,formEl:r}=e;if(!r)return;const n=m.get(t);r.removeEventListener("reset",n),m.delete(t),e.formEl=null,E.delete(t)}function W(e,t){e.defaultValue=t}const g=e=>{e.target.dispatchEvent(new CustomEvent("calciteInternalHiddenInputChange",{bubbles:!0}))},v=e=>e.removeEventListener("change",g);function w(e){const{el:t,formEl:r,name:n,value:a}=e,{ownerDocument:d}=t,u=t.querySelectorAll(`input[slot="${f}"]`);if(!r||!n){u.forEach(s=>{v(s),s.remove()});return}const c=Array.isArray(a)?a:[a],l=[],F=new Set;u.forEach(s=>{const o=c.find(k=>k==s.value);o!=null?(F.add(o),C(e,s,o)):l.push(s)});let i;c.forEach(s=>{if(F.has(s))return;let o=l.pop();o||(o=d.createElement("input"),o.slot=f),i||(i=d.createDocumentFragment()),i.append(o),o.addEventListener("change",g),C(e,o,s)}),i&&t.append(i),l.forEach(s=>{v(s),s.remove()})}function C(e,t,r){var l;const{defaultValue:n,disabled:a,form:d,name:u,required:c}=e;t.defaultValue=n,t.disabled=a,t.name=u,t.required=c,t.tabIndex=-1,d?t.setAttribute("form",d):t.removeAttribute("form"),h(e)?(t.checked=e.checked,t.defaultChecked=e.defaultChecked,t.value=e.checked?r||"on":""):t.value=r||"",(l=e.syncHiddenFormInput)==null||l.call(e,t)}const x=({component:e})=>(w(e),S("slot",{name:f}));export{x as H,W as a,P as c,V as d,y as f,L as r,A as s}; diff --git a/dist/assets/generateRendererUtils-_1jVE02H.js b/dist/assets/generateRendererUtils-3JJTfr19.js similarity index 94% rename from dist/assets/generateRendererUtils-_1jVE02H.js rename to dist/assets/generateRendererUtils-3JJTfr19.js index 4f938cf..43c5f58 100644 --- a/dist/assets/generateRendererUtils-_1jVE02H.js +++ b/dist/assets/generateRendererUtils-3JJTfr19.js @@ -1 +1 @@ -import{dp as C,e as v,iw as I,y as g,c as S,dr as F,Z as B}from"./index-J0iiHjMT.js";const q=new C({esriClassifyEqualInterval:"equal-interval",esriClassifyManual:"manual",esriClassifyNaturalBreaks:"natural-breaks",esriClassifyQuantile:"quantile",esriClassifyStandardDeviation:"standard-deviation",esriClassifyDefinedInterval:"defined-interval"}),w=new C({esriNormalizeByLog:"log",esriNormalizeByPercentOfTotal:"percent-of-total",esriNormalizeByField:"field"});let V=class extends F{constructor(s){super(s),this.type="class-breaks-definition",this.breakCount=null,this.classificationField=null,this.classificationMethod=null,this.normalizationField=null,this.normalizationType=null}set standardDeviationInterval(s){this.classificationMethod==="standard-deviation"&&this._set("standardDeviationInterval",s)}set definedInterval(s){this.classificationMethod==="defined-interval"&&this._set("definedInterval",s)}};v([I({classBreaksDef:"class-breaks-definition"})],V.prototype,"type",void 0),v([g({json:{write:!0}})],V.prototype,"breakCount",void 0),v([g({json:{write:!0}})],V.prototype,"classificationField",void 0),v([g({type:String,json:{read:q.read,write:q.write}})],V.prototype,"classificationMethod",void 0),v([g({json:{write:!0}})],V.prototype,"normalizationField",void 0),v([g({json:{read:w.read,write:w.write}})],V.prototype,"normalizationType",void 0),v([g({value:null,json:{write:!0}})],V.prototype,"standardDeviationInterval",null),v([g({value:null,json:{write:!0}})],V.prototype,"definedInterval",null),V=v([S("esri.rest.support.ClassBreaksDefinition")],V);const O=V,N=B.getLogger("esri.rest.support.generateRendererUtils");function M(a,s){return Number(a.toFixed(s))}function P(a){const{normalizationTotal:s}=a;return{classBreaks:j(a),normalizationTotal:s}}function j(a){const s=a.definition,{classificationMethod:n,normalizationType:i,definedInterval:h}=s,f=s.breakCount??1,u=[];let l=a.values;if(l.length===0)return[];l=l.sort((r,c)=>r-c);const d=l[0],p=l[l.length-1];if(n==="equal-interval")if(l.length>=f){const r=(p-d)/f;let c=d;for(let t=1;t{u.push({minValue:r,maxValue:r,label:b(r,r,i)})});else if(n==="natural-breaks"){const r=D(l),c=a.valueFrequency||r.valueFrequency,t=$(r.uniqueValues,c,f);let e=d;for(let o=1;oo){const m=M(r.uniqueValues[t[o]],6);u.push({minValue:e,maxValue:m,label:b(e,m,i)}),e=m}u.push({minValue:e,maxValue:p,label:b(e,p,i)})}else if(n==="quantile")if(l.length>=f&&d!==p){let r=d,c=Math.ceil(l.length/f),t=0;for(let e=1;el.length&&(o=l.length-1),o<0&&(o=0),u.push({minValue:r,maxValue:l[o],label:b(r,l[o],i)}),r=l[o],t+=c,c=Math.ceil((l.length-t)/(f-e))}u.push({minValue:r,maxValue:p,label:b(r,p,i)})}else{let r=-1;for(let c=0;c=1;y--){const k=M(r-(y-.5)*t,6);u.push({minValue:o,maxValue:k,label:b(o,k,i)}),o=k,e++}let m=M(r+.5*t,6);u.push({minValue:o,maxValue:m,label:b(o,m,i)}),o=m,e++;for(let y=1;y<=f;y++)m=e===2*f?p:M(r+(y+.5)*t,6),u.push({minValue:o,maxValue:m,label:b(o,m,i)}),o=m,e++}}else if(n==="defined-interval"){if(!h)return u;const r=l[0],c=l[l.length-1],t=Math.ceil((c-r)/h);let e=r;for(let o=1;oi&&(n=i);for(let u=0;u0&&o!==a[e+1]&&Math.abs(r-d[e])>Math.abs(r-d[e-1]))a[e]=o;else if(eMath.abs(r-d[e+1])){a[e+1]=o-1;break}c=l,l=0,f=[],u=[];for(let e=0;ec){for(let e=0;e0;t--)for(;n[t]!==n[t-1]+1;){n[t]=n[t]-1;const e=x(t-1,n,i,h);d=e.sbMean,u=e.sbSdcm;const o=x(t,n,i,h);if(p=o.sbMean,l=o.sbSdcm,!(u+l=1?1:f>=.5?.5:.25,f}function L(a){let s=0;for(let n=0;nr-c);const d=l[0],p=l[l.length-1];if(n==="equal-interval")if(l.length>=f){const r=(p-d)/f;let c=d;for(let t=1;t{u.push({minValue:r,maxValue:r,label:b(r,r,i)})});else if(n==="natural-breaks"){const r=D(l),c=a.valueFrequency||r.valueFrequency,t=$(r.uniqueValues,c,f);let e=d;for(let o=1;oo){const m=M(r.uniqueValues[t[o]],6);u.push({minValue:e,maxValue:m,label:b(e,m,i)}),e=m}u.push({minValue:e,maxValue:p,label:b(e,p,i)})}else if(n==="quantile")if(l.length>=f&&d!==p){let r=d,c=Math.ceil(l.length/f),t=0;for(let e=1;el.length&&(o=l.length-1),o<0&&(o=0),u.push({minValue:r,maxValue:l[o],label:b(r,l[o],i)}),r=l[o],t+=c,c=Math.ceil((l.length-t)/(f-e))}u.push({minValue:r,maxValue:p,label:b(r,p,i)})}else{let r=-1;for(let c=0;c=1;y--){const k=M(r-(y-.5)*t,6);u.push({minValue:o,maxValue:k,label:b(o,k,i)}),o=k,e++}let m=M(r+.5*t,6);u.push({minValue:o,maxValue:m,label:b(o,m,i)}),o=m,e++;for(let y=1;y<=f;y++)m=e===2*f?p:M(r+(y+.5)*t,6),u.push({minValue:o,maxValue:m,label:b(o,m,i)}),o=m,e++}}else if(n==="defined-interval"){if(!h)return u;const r=l[0],c=l[l.length-1],t=Math.ceil((c-r)/h);let e=r;for(let o=1;oi&&(n=i);for(let u=0;u0&&o!==a[e+1]&&Math.abs(r-d[e])>Math.abs(r-d[e-1]))a[e]=o;else if(eMath.abs(r-d[e+1])){a[e+1]=o-1;break}c=l,l=0,f=[],u=[];for(let e=0;ec){for(let e=0;e0;t--)for(;n[t]!==n[t-1]+1;){n[t]=n[t]-1;const e=x(t-1,n,i,h);d=e.sbMean,u=e.sbSdcm;const o=x(t,n,i,h);if(p=o.sbMean,l=o.sbSdcm,!(u+l=1?1:f>=.5?.5:.25,f}function L(a){let s=0;for(let n=0;n2)return!0;return!1}function Z(t){return!T(t)}function H(t){return T(t)}function T(t){let n=0;for(let e=0;e=0;o--)b(t,n[o],e);t.lengths.push(n.length)}function b(t,n,e){const[o,r,s]=n;t.coords.push(o,r),e.hasZ&&t.coords.push(s||0)}function W(t){switch(typeof t){case"string":return N(t)?"esriFieldTypeDate":"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function _(t,n=4326){if(!t)throw new P("geojson-layer:empty","GeoJSON data is empty");if(t.type!=="Feature"&&t.type!=="FeatureCollection")throw new P("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:t});const{crs:e}=t;if(!e)return;const o=typeof e=="string"?e:e.type==="name"?e.properties.name:e.type==="EPSG"?e.properties.code:null,r=E({wkid:n})?new RegExp(".*(CRS84H?|4326)$","i"):new RegExp(`.*(${n})$`,"i");if(!o||!r.test(o))throw new P("geojson:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:e})}function tt(t,n={}){const e=[],o=new Set,r=new Set;let s,p=!1,i=null,l=!1,{geometryType:c=null}=n,m=!1;for(const d of G(t)){const{geometry:h,properties:u,id:a}=d;if((!h||(c||(c=S(h.type)),S(h.type)===c))&&(p||(p=A(R(h))),l||(l=a!=null,l&&(s=typeof a,u&&(i=Object.keys(u).filter(y=>u[y]===a)))),u&&i&&l&&a!=null&&(i.length>1?i=i.filter(y=>u[y]===a):i.length===1&&(i=u[i[0]]===a?i:[])),!m&&u)){let y=!0;for(const f in u){if(o.has(f))continue;const F=u[f];if(F==null){y=!1,r.add(f);continue}const k=W(F);if(k==="unknown"){r.add(f);continue}r.delete(f),o.add(f);const M=j(f);M&&e.push({name:M,alias:f,type:k})}m=y}}const w=j((i==null?void 0:i.length)===1&&i[0]||null)??void 0;if(w){for(const d of e)if(d.name===w&&x(d)){d.type="esriFieldTypeOID";break}}return{fields:e,geometryType:c,hasZ:p,objectIdFieldName:w,objectIdFieldType:s,unknownFields:Array.from(r)}}function nt(t,n){return Array.from(v(G(t),n))}export{_ as E,tt as I,nt as N,S as u}; diff --git a/dist/assets/geojson-fSjaGZrp.js b/dist/assets/geojson-fSjaGZrp.js deleted file mode 100644 index 86cb89d..0000000 --- a/dist/assets/geojson-fSjaGZrp.js +++ /dev/null @@ -1 +0,0 @@ -import{t as I}from"./date-be_IQzZd.js";import{E as P,dR as N,eX as G,eY as R,eZ as x,e_ as C}from"./index-J0iiHjMT.js";const D={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function b(t){return D[t]}function*M(t){switch(t.type){case"Feature":yield t;break;case"FeatureCollection":for(const n of t.features)n&&(yield n)}}function*J(t){if(t)switch(t.type){case"Point":yield t.coordinates;break;case"LineString":case"MultiPoint":yield*t.coordinates;break;case"MultiLineString":case"Polygon":for(const n of t.coordinates)yield*n;break;case"MultiPolygon":for(const n of t.coordinates)for(const e of n)yield*e}}function*Z(t,n={}){const{geometryType:e,objectIdField:o}=n;for(const r of t){const{geometry:s,properties:p,id:i}=r;if(s&&b(s.type)!==e)continue;const l=p||{};let c;o&&(c=l[o],i==null||c||(l[o]=c=i)),yield new x(s?X(new C,s,n):null,l,null,c??void 0)}}function v(t){for(const n of t)if(n.length>2)return!0;return!1}function A(t){return!T(t)}function H(t){return T(t)}function T(t){let n=0;for(let e=0;e=0;o--)S(t,n[o],e);t.lengths.push(n.length)}function S(t,n,e){const[o,r,s]=n;t.coords.push(o,r),e.hasZ&&t.coords.push(s||0)}function Q(t){switch(typeof t){case"string":return I(t)?"esriFieldTypeDate":"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function W(t,n=4326){if(!t)throw new P("geojson-layer:empty","GeoJSON data is empty");if(t.type!=="Feature"&&t.type!=="FeatureCollection")throw new P("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:t});const{crs:e}=t;if(!e)return;const o=typeof e=="string"?e:e.type==="name"?e.properties.name:e.type==="EPSG"?e.properties.code:null,r=N({wkid:n})?new RegExp(".*(CRS84H?|4326)$","i"):new RegExp(`.*(${n})$`,"i");if(!o||!r.test(o))throw new P("geojson:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:e})}function tt(t,n={}){const e=[],o=new Set,r=new Set;let s,p=!1,i=null,l=!1,{geometryType:c=null}=n,m=!1;for(const d of M(t)){const{geometry:h,properties:u,id:a}=d;if((!h||(c||(c=b(h.type)),b(h.type)===c))&&(p||(p=v(J(h))),l||(l=a!=null,l&&(s=typeof a,u&&(i=Object.keys(u).filter(y=>u[y]===a)))),u&&i&&l&&a!=null&&(i.length>1?i=i.filter(y=>u[y]===a):i.length===1&&(i=u[i[0]]===a?i:[])),!m&&u)){let y=!0;for(const f in u){if(o.has(f))continue;const F=u[f];if(F==null){y=!1,r.add(f);continue}const k=Q(F);if(k==="unknown"){r.add(f);continue}r.delete(f),o.add(f);const j=G(f);j&&e.push({name:j,alias:f,type:k})}m=y}}const w=G((i==null?void 0:i.length)===1&&i[0]||null)??void 0;if(w){for(const d of e)if(d.name===w&&R(d)){d.type="esriFieldTypeOID";break}}return{fields:e,geometryType:c,hasZ:p,objectIdFieldName:w,objectIdFieldType:s,unknownFields:Array.from(r)}}function nt(t,n){return Array.from(Z(M(t),n))}export{W as E,tt as I,nt as N,b as u}; diff --git a/dist/assets/geomasync-7v4-s3fM.js b/dist/assets/geomasync-7v4-s3fM.js new file mode 100644 index 0000000..d74c82b --- /dev/null +++ b/dist/assets/geomasync-7v4-s3fM.js @@ -0,0 +1 @@ +import{kB as fn,av as B,hc as d,dO as j,E as R,L as O,j as b,ho as W,fZ as H,ar as V,kC as ln,dX as on}from"./index-pCX-0tJH.js";import{Z as o,n as h,Q as K,K as X,X as Q,d as q,a as s,r as u,q as I,b as F,i as L,H as C,A as w,a9 as G,aa as z,ab as U,c as N,B as dn,ac as wn,ad as hn,E as Y,N as J,y as M,ae as mn,af as Z}from"./arcadeUtils-vGyJZHQt.js";import{c as P,r as D,a as y}from"./TimeOnly-gkehHHJx.js";import{l as _}from"./portalUtils-siGJ35LN.js";import{disjoint as yn,intersects as pn,touches as gn,crosses as vn,within as Pn,contains as An,overlaps as In,equals as Fn,relate as Nn,intersect as xn,union as Rn,difference as bn,symmetricDifference as Sn,clip as On,cut as jn,planarArea as $,geodesicArea as nn,planarLength as k,geodesicLength as E,distance as Dn,densify as en,geodesicDensify as rn,generalize as Ln,buffer as Cn,geodesicBuffer as Jn,offset as Mn,rotate as tn,simplify as an,isSimple as Zn,convexHull as kn,nearestCoordinate as Tn,nearestVertex as qn}from"./geometryEngineAsync-ly7k1Z_H.js";import"./hash-SS5GKVPY.js";async function sn(t,e,r){var a,i;if(!((a=fn)==null?void 0:a.findCredential(t.restUrl)))return null;if(t.loadStatus==="loaded"&&e===""&&((i=t.user)!=null&&i.sourceJSON)&&r===!1)return t.user.sourceJSON;const l={responseType:"json",query:{f:"json"}};if(r&&(l.query.returnUserLicenseTypeExtensions=!0),e===""){const f=await B(t.restUrl+"/community/self",l);if(f.data){const m=f.data;if(m!=null&&m.username)return m}return null}const n=await B(t.restUrl+"/community/users/"+e,l);if(n.data){const f=n.data;return f.error?null:f}return null}function un(t){return ln.indexOf("4.")===0?b.fromExtent(t):new b({spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]})}function A(t,e,r){if(h(t,2,2,e,r),!(t[0]instanceof d&&t[1]instanceof d)){if(!(t[0]instanceof d&&t[1]===null)){if(!(t[1]instanceof d&&t[0]===null)){if(t[0]!==null||t[1]!==null)throw new s(e,u.InvalidParameter,r)}}}}async function cn(t,e){if(t.type!=="polygon"&&t.type!=="polyline"&&t.type!=="extent")return 0;let r=1;(t.spatialReference.vcsWkid||t.spatialReference.latestVcsWkid)&&(r=mn(t.spatialReference)/on(t.spatialReference));let c=0;if(t.type==="polyline")for(const n of t.paths)for(let a=1;a(A(n=o(n),e,r),n[0]===null||n[1]===null||yn(n[0],n[1])))},t.functions.intersects=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&pn(n[0],n[1])))},t.functions.touches=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&gn(n[0],n[1])))},t.functions.crosses=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&vn(n[0],n[1])))},t.functions.within=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&Pn(n[0],n[1])))},t.functions.contains=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&An(n[0],n[1])))},t.functions.overlaps=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&In(n[0],n[1])))},t.functions.equals=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(h(n,2,2,e,r),n[0]===n[1]||(n[0]instanceof d&&n[1]instanceof d?Fn(n[0],n[1]):(K(n[0])&&K(n[1])||!!(X(n[0])&&X(n[1])||Q(n[0])&&Q(n[1])))&&n[0].equals(n[1]))))},t.functions.relate=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,3,3,e,r),n[0]instanceof d&&n[1]instanceof d)return Nn(n[0],n[1],q(n[2]));if(n[0]instanceof d&&n[1]===null||n[1]instanceof d&&n[0]===null||n[0]===null&&n[1]===null)return!1;throw new s(e,u.InvalidParameter,r)})},t.functions.intersection=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]===null||n[1]===null?null:xn(n[0],n[1])))},t.functions.union=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{const a=[];if((n=o(n)).length===0)throw new s(e,u.WrongNumberOfParameters,r);if(n.length===1)if(I(n[0])){const i=o(n[0]);for(let f=0;f(A(n=o(n),e,r),n[0]!==null&&n[1]===null?P(n[0]):n[0]===null?null:bn(n[0],n[1])))},t.functions.symmetricdifference=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]===null&&n[1]===null?null:n[0]===null?P(n[1]):n[1]===null?P(n[0]):Sn(n[0],n[1])))},t.functions.clip=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,2,e,r),!(n[1]instanceof j)&&n[1]!==null)throw new s(e,u.InvalidParameter,r);if(n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return n[1]===null?null:On(n[0],n[1])})},t.functions.cut=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,2,e,r),!(n[1]instanceof R)&&n[1]!==null)throw new s(e,u.InvalidParameter,r);if(n[0]===null)return[];if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return n[1]===null?[P(n[0])]:jn(n[0],n[1])})},t.functions.area=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(h(n,1,2,e,r),(n=o(n))[0]===null)return 0;if(C(n[0])){const a=await n[0].sumArea(D(w(n[1],-1)),!1,e.abortSignal);if(e.abortSignal.aborted)throw new s(e,u.Cancelled,r);return a}if(I(n[0])||F(n[0])){const a=G(n[0],e.spatialReference);return a===null?0:$(a,D(w(n[1],-1)))}if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return $(n[0],D(w(n[1],-1)))})},t.functions.areageodetic=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(h(n,1,2,e,r),(n=o(n))[0]===null)return 0;if(C(n[0])){const a=await n[0].sumArea(D(w(n[1],-1)),!0,e.abortSignal);if(e.abortSignal.aborted)throw new s(e,u.Cancelled,r);return a}if(I(n[0])||F(n[0])){const a=G(n[0],e.spatialReference);return a===null?0:nn(a,D(w(n[1],-1)))}if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return nn(n[0],D(w(n[1],-1)))})},t.functions.length=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(h(n,1,2,e,r),(n=o(n))[0]===null)return 0;if(C(n[0])){const a=await n[0].sumLength(y(w(n[1],-1)),!1,e.abortSignal);if(e.abortSignal.aborted)throw new s(e,u.Cancelled,r);return a}if(I(n[0])||F(n[0])){const a=z(n[0],e.spatialReference);return a===null?0:k(a,y(w(n[1],-1)))}if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return k(n[0],y(w(n[1],-1)))})},t.functions.length3d=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(h(n,1,2,e,r),(n=o(n))[0]===null)return 0;if(I(n[0])||F(n[0])){const a=z(n[0],e.spatialReference);return a===null?0:a.hasZ===!0?cn(a,y(w(n[1],-1))):k(a,y(w(n[1],-1)))}if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return n[0].hasZ===!0?cn(n[0],y(w(n[1],-1))):k(n[0],y(w(n[1],-1)))})},t.functions.lengthgeodetic=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(h(n,1,2,e,r),(n=o(n))[0]===null)return 0;if(C(n[0])){const a=await n[0].sumLength(y(w(n[1],-1)),!0,e.abortSignal);if(e.abortSignal.aborted)throw new s(e,u.Cancelled,r);return a}if(I(n[0])||F(n[0])){const a=z(n[0],e.spatialReference);return a===null?0:E(a,y(w(n[1],-1)))}if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return E(n[0],y(w(n[1],-1)))})},t.functions.distance=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{n=o(n),h(n,2,3,e,r);let a=n[0];(I(n[0])||F(n[0]))&&(a=U(n[0],e.spatialReference));let i=n[1];if((I(n[1])||F(n[1]))&&(i=U(n[1],e.spatialReference)),!(a instanceof d))throw new s(e,u.InvalidParameter,r);if(!(i instanceof d))throw new s(e,u.InvalidParameter,r);return Dn(a,i,y(w(n[2],-1)))})},t.functions.distancegeodetic=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{n=o(n),h(n,2,3,e,r);const a=n[0],i=n[1];if(!(a instanceof O))throw new s(e,u.InvalidParameter,r);if(!(i instanceof O))throw new s(e,u.InvalidParameter,r);const f=new R({paths:[],spatialReference:a.spatialReference});return f.addPath([a,i]),E(f,y(w(n[2],-1)))})},t.functions.densify=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,3,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);if(a<=0)throw new s(e,u.InvalidParameter,r);return n[0]instanceof b||n[0]instanceof R?en(n[0],a,y(w(n[2],-1))):n[0]instanceof j?en(un(n[0]),a,y(w(n[2],-1))):n[0]})},t.functions.densifygeodetic=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,3,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);if(a<=0)throw new s(e,u.InvalidParameter,r);return n[0]instanceof b||n[0]instanceof R?rn(n[0],a,y(w(n[2],-1))):n[0]instanceof j?rn(un(n[0]),a,y(w(n[2],-1))):n[0]})},t.functions.generalize=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,4,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);return Ln(n[0],a,dn(w(n[2],!0)),y(w(n[3],-1)))})},t.functions.buffer=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,3,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);return a===0?P(n[0]):Cn(n[0],a,y(w(n[2],-1)))})},t.functions.buffergeodetic=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,3,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);return a===0?P(n[0]):Jn(n[0],a,y(w(n[2],-1)))})},t.functions.offset=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,6,e,r),n[0]===null)return null;if(!(n[0]instanceof b||n[0]instanceof R))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);const i=N(w(n[4],10));if(isNaN(i))throw new s(e,u.InvalidParameter,r);const f=N(w(n[5],0));if(isNaN(f))throw new s(e,u.InvalidParameter,r);return Mn(n[0],a,y(w(n[2],-1)),q(w(n[3],"round")).toLowerCase(),i,f)})},t.functions.rotate=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{n=o(n),h(n,2,3,e,r);let a=n[0];if(a===null)return null;if(!(a instanceof d))throw new s(e,u.InvalidParameter,r);a instanceof j&&(a=b.fromExtent(a));const i=N(n[1]);if(isNaN(i))throw new s(e,u.InvalidParameter,r);const f=w(n[2],null);if(f===null)return tn(a,i);if(f instanceof O)return tn(a,i,f);throw new s(e,u.InvalidParameter,r)})},t.functions.centroid=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,1,1,e,r),n[0]===null)return null;let a=n[0];if((I(n[0])||F(n[0]))&&(a=U(n[0],e.spatialReference)),a===null)return null;if(!(a instanceof d))throw new s(e,u.InvalidParameter,r);return a instanceof O?L(P(n[0]),e.spatialReference):a instanceof b?a.centroid:a instanceof R?wn(a):a instanceof W?hn(a):a instanceof j?a.center:null})},t.functions.multiparttosinglepart=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{n=o(n),h(n,1,1,e,r);const a=[];if(n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);if(n[0]instanceof O)return[L(P(n[0]),e.spatialReference)];if(n[0]instanceof j)return[L(P(n[0]),e.spatialReference)];const i=await an(n[0]);if(i instanceof b){const f=[],m=[];for(let p=0;p{if(n=o(n),h(n,1,1,e,r),n[0]===null)return!0;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return Zn(n[0])})},t.functions.simplify=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,1,1,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return an(n[0])})},t.functions.convexhull=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,1,1,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return kn(n[0])})},t.functions.getuser=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{var m,p;h(n,0,2,e,r);let a=w(n[1],""),i=a===!0;if(a=a===!0||a===!1?"":q(a),n.length===0||n[0]instanceof Y){let g=null;g=(m=e.services)!=null&&m.portal?e.services.portal:V.getDefault(),n.length>0&&(g=_(n[0],g));const S=await sn(g,a,i);if(S){const x=JSON.parse(JSON.stringify(S));for(const v of["lastLogin","created","modified"])x[v]!==void 0&&x[v]!==null&&(x[v]=new Date(x[v]));return J.convertObjectToArcadeDictionary(x,M(e))}return null}let f=null;if(C(n[0])&&(f=n[0]),f){if(i=!1,a)return null;await f.load();const g=await f.getOwningSystemUrl();if(!g){if(!a){const v=await f.getIdentityUser();return v?J.convertObjectToArcadeDictionary({username:v},M(e)):null}return null}let S=null;S=(p=e.services)!=null&&p.portal?e.services.portal:V.getDefault(),S=_(new Y(g),S);const x=await sn(S,a,i);if(x){const v=JSON.parse(JSON.stringify(x));for(const T of["lastLogin","created","modified"])v[T]!==void 0&&v[T]!==null&&(v[T]=new Date(v[T]));return J.convertObjectToArcadeDictionary(v,M(e))}return null}throw new s(e,u.InvalidParameter,r)})}),t.functions.nearestcoordinate=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(n=o(n),h(n,2,2,e,r),!(n[0]instanceof d||n[0]===null))throw new s(e,u.InvalidParameter,r);if(!(n[1]instanceof O||n[1]===null))throw new s(e,u.InvalidParameter,r);if(n[0]===null||n[1]===null)return null;const a=await Tn(n[0],n[1]);return a===null?null:J.convertObjectToArcadeDictionary({coordinate:a.coordinate,distance:a.distance},M(e),!1,!0)})},t.functions.nearestvertex=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(n=o(n),h(n,2,2,e,r),!(n[0]instanceof d||n[0]===null))throw new s(e,u.InvalidParameter,r);if(!(n[1]instanceof O||n[1]===null))throw new s(e,u.InvalidParameter,r);if(n[0]===null||n[1]===null)return null;const a=await qn(n[0],n[1]);return a===null?null:J.convertObjectToArcadeDictionary({coordinate:a.coordinate,distance:a.distance},M(e),!1,!0)})}}export{Vn as registerFunctions}; diff --git a/dist/assets/geomasync-_hAyjeTi.js b/dist/assets/geomasync-_hAyjeTi.js deleted file mode 100644 index 0e39137..0000000 --- a/dist/assets/geomasync-_hAyjeTi.js +++ /dev/null @@ -1 +0,0 @@ -import{kt as fn,bW as W,ha as d,dT as j,N as x,T as O,l as R,hq as B,dy as H,bS as V,ku as ln,e2 as on}from"./index-J0iiHjMT.js";import{Z as o,n as h,Q as K,K as Q,X,d as Z,a as s,r as u,q as I,b as F,i as L,H as T,A as w,a9 as G,aa as z,ab as U,c as N,B as dn,ac as wn,ad as hn,E as Y,N as C,y as J,ae as mn,af as M}from"./arcadeUtils-OUqwHs4P.js";import{c as P,r as D,a as y}from"./TimeOnly-ljWtUK7N.js";import{l as _}from"./portalUtils-MqaWunxU.js";import{disjoint as yn,intersects as pn,touches as gn,crosses as vn,within as Pn,contains as An,overlaps as In,equals as Fn,relate as Nn,intersect as bn,union as xn,difference as Rn,symmetricDifference as Sn,clip as On,cut as jn,planarArea as $,geodesicArea as nn,planarLength as k,geodesicLength as E,distance as Dn,densify as en,geodesicDensify as rn,generalize as Ln,buffer as Tn,geodesicBuffer as Cn,offset as Jn,rotate as tn,simplify as an,isSimple as Mn,convexHull as kn,nearestCoordinate as qn,nearestVertex as Zn}from"./geometryEngineAsync-QjQc0riy.js";import"./hash-SS5GKVPY.js";async function sn(t,e,r){var a,i;if(!((a=fn)==null?void 0:a.findCredential(t.restUrl)))return null;if(t.loadStatus==="loaded"&&e===""&&((i=t.user)!=null&&i.sourceJSON)&&r===!1)return t.user.sourceJSON;const l={responseType:"json",query:{f:"json"}};if(r&&(l.query.returnUserLicenseTypeExtensions=!0),e===""){const f=await W(t.restUrl+"/community/self",l);if(f.data){const m=f.data;if(m!=null&&m.username)return m}return null}const n=await W(t.restUrl+"/community/users/"+e,l);if(n.data){const f=n.data;return f.error?null:f}return null}function un(t){return ln.indexOf("4.")===0?R.fromExtent(t):new R({spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]})}function A(t,e,r){if(h(t,2,2,e,r),!(t[0]instanceof d&&t[1]instanceof d)){if(!(t[0]instanceof d&&t[1]===null)){if(!(t[1]instanceof d&&t[0]===null)){if(t[0]!==null||t[1]!==null)throw new s(e,u.InvalidParameter,r)}}}}async function cn(t,e){if(t.type!=="polygon"&&t.type!=="polyline"&&t.type!=="extent")return 0;let r=1;(t.spatialReference.vcsWkid||t.spatialReference.latestVcsWkid)&&(r=mn(t.spatialReference)/on(t.spatialReference));let c=0;if(t.type==="polyline")for(const n of t.paths)for(let a=1;a(A(n=o(n),e,r),n[0]===null||n[1]===null||yn(n[0],n[1])))},t.functions.intersects=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&pn(n[0],n[1])))},t.functions.touches=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&gn(n[0],n[1])))},t.functions.crosses=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&vn(n[0],n[1])))},t.functions.within=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&Pn(n[0],n[1])))},t.functions.contains=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&An(n[0],n[1])))},t.functions.overlaps=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]!==null&&n[1]!==null&&In(n[0],n[1])))},t.functions.equals=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(h(n,2,2,e,r),n[0]===n[1]||(n[0]instanceof d&&n[1]instanceof d?Fn(n[0],n[1]):(K(n[0])&&K(n[1])||!!(Q(n[0])&&Q(n[1])||X(n[0])&&X(n[1])))&&n[0].equals(n[1]))))},t.functions.relate=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,3,3,e,r),n[0]instanceof d&&n[1]instanceof d)return Nn(n[0],n[1],Z(n[2]));if(n[0]instanceof d&&n[1]===null||n[1]instanceof d&&n[0]===null||n[0]===null&&n[1]===null)return!1;throw new s(e,u.InvalidParameter,r)})},t.functions.intersection=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]===null||n[1]===null?null:bn(n[0],n[1])))},t.functions.union=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{const a=[];if((n=o(n)).length===0)throw new s(e,u.WrongNumberOfParameters,r);if(n.length===1)if(I(n[0])){const i=o(n[0]);for(let f=0;f(A(n=o(n),e,r),n[0]!==null&&n[1]===null?P(n[0]):n[0]===null?null:Rn(n[0],n[1])))},t.functions.symmetricdifference=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>(A(n=o(n),e,r),n[0]===null&&n[1]===null?null:n[0]===null?P(n[1]):n[1]===null?P(n[0]):Sn(n[0],n[1])))},t.functions.clip=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,2,e,r),!(n[1]instanceof j)&&n[1]!==null)throw new s(e,u.InvalidParameter,r);if(n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return n[1]===null?null:On(n[0],n[1])})},t.functions.cut=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,2,e,r),!(n[1]instanceof x)&&n[1]!==null)throw new s(e,u.InvalidParameter,r);if(n[0]===null)return[];if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return n[1]===null?[P(n[0])]:jn(n[0],n[1])})},t.functions.area=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(h(n,1,2,e,r),(n=o(n))[0]===null)return 0;if(T(n[0])){const a=await n[0].sumArea(D(w(n[1],-1)),!1,e.abortSignal);if(e.abortSignal.aborted)throw new s(e,u.Cancelled,r);return a}if(I(n[0])||F(n[0])){const a=G(n[0],e.spatialReference);return a===null?0:$(a,D(w(n[1],-1)))}if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return $(n[0],D(w(n[1],-1)))})},t.functions.areageodetic=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(h(n,1,2,e,r),(n=o(n))[0]===null)return 0;if(T(n[0])){const a=await n[0].sumArea(D(w(n[1],-1)),!0,e.abortSignal);if(e.abortSignal.aborted)throw new s(e,u.Cancelled,r);return a}if(I(n[0])||F(n[0])){const a=G(n[0],e.spatialReference);return a===null?0:nn(a,D(w(n[1],-1)))}if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return nn(n[0],D(w(n[1],-1)))})},t.functions.length=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(h(n,1,2,e,r),(n=o(n))[0]===null)return 0;if(T(n[0])){const a=await n[0].sumLength(y(w(n[1],-1)),!1,e.abortSignal);if(e.abortSignal.aborted)throw new s(e,u.Cancelled,r);return a}if(I(n[0])||F(n[0])){const a=z(n[0],e.spatialReference);return a===null?0:k(a,y(w(n[1],-1)))}if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return k(n[0],y(w(n[1],-1)))})},t.functions.length3d=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(h(n,1,2,e,r),(n=o(n))[0]===null)return 0;if(I(n[0])||F(n[0])){const a=z(n[0],e.spatialReference);return a===null?0:a.hasZ===!0?cn(a,y(w(n[1],-1))):k(a,y(w(n[1],-1)))}if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return n[0].hasZ===!0?cn(n[0],y(w(n[1],-1))):k(n[0],y(w(n[1],-1)))})},t.functions.lengthgeodetic=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(h(n,1,2,e,r),(n=o(n))[0]===null)return 0;if(T(n[0])){const a=await n[0].sumLength(y(w(n[1],-1)),!0,e.abortSignal);if(e.abortSignal.aborted)throw new s(e,u.Cancelled,r);return a}if(I(n[0])||F(n[0])){const a=z(n[0],e.spatialReference);return a===null?0:E(a,y(w(n[1],-1)))}if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return E(n[0],y(w(n[1],-1)))})},t.functions.distance=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{n=o(n),h(n,2,3,e,r);let a=n[0];(I(n[0])||F(n[0]))&&(a=U(n[0],e.spatialReference));let i=n[1];if((I(n[1])||F(n[1]))&&(i=U(n[1],e.spatialReference)),!(a instanceof d))throw new s(e,u.InvalidParameter,r);if(!(i instanceof d))throw new s(e,u.InvalidParameter,r);return Dn(a,i,y(w(n[2],-1)))})},t.functions.distancegeodetic=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{n=o(n),h(n,2,3,e,r);const a=n[0],i=n[1];if(!(a instanceof O))throw new s(e,u.InvalidParameter,r);if(!(i instanceof O))throw new s(e,u.InvalidParameter,r);const f=new x({paths:[],spatialReference:a.spatialReference});return f.addPath([a,i]),E(f,y(w(n[2],-1)))})},t.functions.densify=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,3,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);if(a<=0)throw new s(e,u.InvalidParameter,r);return n[0]instanceof R||n[0]instanceof x?en(n[0],a,y(w(n[2],-1))):n[0]instanceof j?en(un(n[0]),a,y(w(n[2],-1))):n[0]})},t.functions.densifygeodetic=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,3,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);if(a<=0)throw new s(e,u.InvalidParameter,r);return n[0]instanceof R||n[0]instanceof x?rn(n[0],a,y(w(n[2],-1))):n[0]instanceof j?rn(un(n[0]),a,y(w(n[2],-1))):n[0]})},t.functions.generalize=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,4,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);return Ln(n[0],a,dn(w(n[2],!0)),y(w(n[3],-1)))})},t.functions.buffer=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,3,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);return a===0?P(n[0]):Tn(n[0],a,y(w(n[2],-1)))})},t.functions.buffergeodetic=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,3,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);return a===0?P(n[0]):Cn(n[0],a,y(w(n[2],-1)))})},t.functions.offset=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,2,6,e,r),n[0]===null)return null;if(!(n[0]instanceof R||n[0]instanceof x))throw new s(e,u.InvalidParameter,r);const a=N(n[1]);if(isNaN(a))throw new s(e,u.InvalidParameter,r);const i=N(w(n[4],10));if(isNaN(i))throw new s(e,u.InvalidParameter,r);const f=N(w(n[5],0));if(isNaN(f))throw new s(e,u.InvalidParameter,r);return Jn(n[0],a,y(w(n[2],-1)),Z(w(n[3],"round")).toLowerCase(),i,f)})},t.functions.rotate=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{n=o(n),h(n,2,3,e,r);let a=n[0];if(a===null)return null;if(!(a instanceof d))throw new s(e,u.InvalidParameter,r);a instanceof j&&(a=R.fromExtent(a));const i=N(n[1]);if(isNaN(i))throw new s(e,u.InvalidParameter,r);const f=w(n[2],null);if(f===null)return tn(a,i);if(f instanceof O)return tn(a,i,f);throw new s(e,u.InvalidParameter,r)})},t.functions.centroid=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,1,1,e,r),n[0]===null)return null;let a=n[0];if((I(n[0])||F(n[0]))&&(a=U(n[0],e.spatialReference)),a===null)return null;if(!(a instanceof d))throw new s(e,u.InvalidParameter,r);return a instanceof O?L(P(n[0]),e.spatialReference):a instanceof R?a.centroid:a instanceof x?wn(a):a instanceof B?hn(a):a instanceof j?a.center:null})},t.functions.multiparttosinglepart=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{n=o(n),h(n,1,1,e,r);const a=[];if(n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);if(n[0]instanceof O)return[L(P(n[0]),e.spatialReference)];if(n[0]instanceof j)return[L(P(n[0]),e.spatialReference)];const i=await an(n[0]);if(i instanceof R){const f=[],m=[];for(let p=0;p{if(n=o(n),h(n,1,1,e,r),n[0]===null)return!0;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return Mn(n[0])})},t.functions.simplify=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,1,1,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return an(n[0])})},t.functions.convexhull=function(e,r){return t.standardFunctionAsync(e,r,(c,l,n)=>{if(n=o(n),h(n,1,1,e,r),n[0]===null)return null;if(!(n[0]instanceof d))throw new s(e,u.InvalidParameter,r);return kn(n[0])})},t.functions.getuser=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{var m,p;h(n,0,2,e,r);let a=w(n[1],""),i=a===!0;if(a=a===!0||a===!1?"":Z(a),n.length===0||n[0]instanceof Y){let g=null;g=(m=e.services)!=null&&m.portal?e.services.portal:V.getDefault(),n.length>0&&(g=_(n[0],g));const S=await sn(g,a,i);if(S){const b=JSON.parse(JSON.stringify(S));for(const v of["lastLogin","created","modified"])b[v]!==void 0&&b[v]!==null&&(b[v]=new Date(b[v]));return C.convertObjectToArcadeDictionary(b,J(e))}return null}let f=null;if(T(n[0])&&(f=n[0]),f){if(i=!1,a)return null;await f.load();const g=await f.getOwningSystemUrl();if(!g){if(!a){const v=await f.getIdentityUser();return v?C.convertObjectToArcadeDictionary({username:v},J(e)):null}return null}let S=null;S=(p=e.services)!=null&&p.portal?e.services.portal:V.getDefault(),S=_(new Y(g),S);const b=await sn(S,a,i);if(b){const v=JSON.parse(JSON.stringify(b));for(const q of["lastLogin","created","modified"])v[q]!==void 0&&v[q]!==null&&(v[q]=new Date(v[q]));return C.convertObjectToArcadeDictionary(v,J(e))}return null}throw new s(e,u.InvalidParameter,r)})}),t.functions.nearestcoordinate=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(n=o(n),h(n,2,2,e,r),!(n[0]instanceof d||n[0]===null))throw new s(e,u.InvalidParameter,r);if(!(n[1]instanceof O||n[1]===null))throw new s(e,u.InvalidParameter,r);if(n[0]===null||n[1]===null)return null;const a=await qn(n[0],n[1]);return a===null?null:C.convertObjectToArcadeDictionary({coordinate:a.coordinate,distance:a.distance},J(e),!1,!0)})},t.functions.nearestvertex=function(e,r){return t.standardFunctionAsync(e,r,async(c,l,n)=>{if(n=o(n),h(n,2,2,e,r),!(n[0]instanceof d||n[0]===null))throw new s(e,u.InvalidParameter,r);if(!(n[1]instanceof O||n[1]===null))throw new s(e,u.InvalidParameter,r);if(n[0]===null||n[1]===null)return null;const a=await Zn(n[0],n[1]);return a===null?null:C.convertObjectToArcadeDictionary({coordinate:a.coordinate,distance:a.distance},J(e),!1,!0)})}}export{Vn as registerFunctions}; diff --git a/dist/assets/geometryEngineAsync-QjQc0riy.js b/dist/assets/geometryEngineAsync-ly7k1Z_H.js similarity index 74% rename from dist/assets/geometryEngineAsync-QjQc0riy.js rename to dist/assets/geometryEngineAsync-ly7k1Z_H.js index 6c6b4df..f035a9b 100644 --- a/dist/assets/geometryEngineAsync-QjQc0riy.js +++ b/dist/assets/geometryEngineAsync-ly7k1Z_H.js @@ -1 +1 @@ -import{T as l,dy as w,g1 as h}from"./index-J0iiHjMT.js";function n(e){var t;return Array.isArray(e)?(t=e[0])==null?void 0:t.spatialReference:e==null?void 0:e.spatialReference}function p(e){return e&&(Array.isArray(e)?e.map(p):e.toJSON?e.toJSON():e)}function c(e){return Array.isArray(e)?e.map(t=>w(t)):w(e)}function S(e,t){let r;return Array.isArray(e)?r=e:(r=[],r.push(e),t!=null&&r.push(t)),r}let f;async function d(){return f||(f=h("geometryEngineWorker",{strategy:"distributed"})),f}async function a(e,t){return(await d()).invoke("executeGEOperation",{operation:e,parameters:p(t)})}async function m(e,t){const r=await d();return Promise.all(r.broadcast("executeGEOperation",{operation:e,parameters:p(t)}))}function R(e){return a("extendedSpatialReferenceInfo",[e])}async function A(e,t){return c(await a("clip",[n(e),e,t]))}async function O(e,t){return c(await a("cut",[n(e),e,t]))}function D(e,t){return a("contains",[n(e),e,t])}function J(e,t){return a("crosses",[n(e),e,t])}function N(e,t,r){return a("distance",[n(e),e,t,r])}function T(e,t){return a("equals",[n(e),e,t])}function L(e,t){return a("intersects",[n(e),e,t])}function V(e,t){return a("touches",[n(e),e,t])}function v(e,t){return a("within",[n(e),e,t])}function E(e,t){return a("disjoint",[n(e),e,t])}function b(e,t){return a("overlaps",[n(e),e,t])}function z(e,t,r){return a("relate",[n(e),e,t,r])}function H(e){return a("isSimple",[n(e),e])}async function I(e){return c(await a("simplify",[n(e),e]))}async function P(e,t=!1){return c(await a("convexHull",[n(e),e,t]))}async function j(e,t){return c(await a("difference",[n(e),e,t]))}async function k(e,t){return c(await a("symmetricDifference",[n(e),e,t]))}async function q(e,t){return c(await a("intersect",[n(e),e,t]))}async function B(e,t=null){const r=S(e,t);return c(await a("union",[n(r),r]))}async function C(e,t,r,i,s,u){return c(await a("offset",[n(e),e,t,r,i,s,u]))}async function G(e,t,r,i=!1){const s=[n(e),e,t,r,i];return c(await a("buffer",s))}async function $(e,t,r,i,s,u){const g=[n(e),e,t,r,i,s,u];return c(await a("geodesicBuffer",g))}async function W(e,t,r=!0){const i=await a("nearestCoordinate",[n(e),e,t,r]);return{...i,coordinate:l.fromJSON(i.coordinate)}}async function F(e,t){const r=await a("nearestVertex",[n(e),e,t]);return{...r,coordinate:l.fromJSON(r.coordinate)}}async function K(e,t,r,i){return(await a("nearestVertices",[n(e),e,t,r,i])).map(s=>({...s,coordinate:l.fromJSON(s.coordinate)}))}function y(e){var t;return"xmin"in e?e.center:"x"in e?e:(t=e.extent)==null?void 0:t.center}async function M(e,t,r){if(e==null)throw new o;const i=e.spatialReference;if((r=r??y(e))==null)throw new o;const s=e.constructor.fromJSON(await a("rotate",[i,e,t,r]));return s.spatialReference=i,s}async function Q(e,t){if(e==null)throw new o;const r=e.spatialReference;if((t=t??y(e))==null)throw new o;const i=e.constructor.fromJSON(await a("flipHorizontal",[r,e,t]));return i.spatialReference=r,i}async function U(e,t){if(e==null)throw new o;const r=e.spatialReference;if((t=t??y(e))==null)throw new o;const i=e.constructor.fromJSON(await a("flipVertical",[r,e,t]));return i.spatialReference=r,i}async function X(e,t,r,i){return c(await a("generalize",[n(e),e,t,r,i]))}async function Y(e,t,r){return c(await a("densify",[n(e),e,t,r]))}async function Z(e,t,r,i=0){return c(await a("geodesicDensify",[n(e),e,t,r,i]))}function _(e,t){return a("planarArea",[n(e),e,t])}function ee(e,t){return a("planarLength",[n(e),e,t])}function te(e,t,r){return a("geodesicArea",[n(e),e,t,r])}function re(e,t,r){return a("geodesicLength",[n(e),e,t,r])}async function ae(e,t){return c(await a("intersectLinesToPoints",[n(e),e,t]))}async function ne(e,t){await m("changeDefaultSpatialReferenceTolerance",[e,t])}async function ie(e){await m("clearDefaultSpatialReferenceTolerance",[e])}class o extends Error{constructor(){super("Illegal Argument Exception")}}export{G as buffer,ne as changeDefaultSpatialReferenceTolerance,ie as clearDefaultSpatialReferenceTolerance,A as clip,D as contains,P as convexHull,J as crosses,O as cut,Y as densify,j as difference,E as disjoint,N as distance,T as equals,R as extendedSpatialReferenceInfo,Q as flipHorizontal,U as flipVertical,X as generalize,te as geodesicArea,$ as geodesicBuffer,Z as geodesicDensify,re as geodesicLength,q as intersect,ae as intersectLinesToPoints,L as intersects,H as isSimple,W as nearestCoordinate,F as nearestVertex,K as nearestVertices,C as offset,b as overlaps,_ as planarArea,ee as planarLength,z as relate,M as rotate,I as simplify,k as symmetricDifference,V as touches,B as union,v as within}; +import{L as l,fZ as w,f_ as h}from"./index-pCX-0tJH.js";function n(e){var t;return Array.isArray(e)?(t=e[0])==null?void 0:t.spatialReference:e==null?void 0:e.spatialReference}function p(e){return e&&(Array.isArray(e)?e.map(p):e.toJSON?e.toJSON():e)}function c(e){return Array.isArray(e)?e.map(t=>w(t)):w(e)}function S(e,t){let r;return Array.isArray(e)?r=e:(r=[],r.push(e),t!=null&&r.push(t)),r}let f;async function d(){return f||(f=h("geometryEngineWorker",{strategy:"distributed"})),f}async function a(e,t){return(await d()).invoke("executeGEOperation",{operation:e,parameters:p(t)})}async function m(e,t){const r=await d();return Promise.all(r.broadcast("executeGEOperation",{operation:e,parameters:p(t)}))}function R(e){return a("extendedSpatialReferenceInfo",[e])}async function A(e,t){return c(await a("clip",[n(e),e,t]))}async function O(e,t){return c(await a("cut",[n(e),e,t]))}function D(e,t){return a("contains",[n(e),e,t])}function J(e,t){return a("crosses",[n(e),e,t])}function N(e,t,r){return a("distance",[n(e),e,t,r])}function L(e,t){return a("equals",[n(e),e,t])}function T(e,t){return a("intersects",[n(e),e,t])}function V(e,t){return a("touches",[n(e),e,t])}function v(e,t){return a("within",[n(e),e,t])}function E(e,t){return a("disjoint",[n(e),e,t])}function b(e,t){return a("overlaps",[n(e),e,t])}function z(e,t,r){return a("relate",[n(e),e,t,r])}function H(e){return a("isSimple",[n(e),e])}async function I(e){return c(await a("simplify",[n(e),e]))}async function P(e,t=!1){return c(await a("convexHull",[n(e),e,t]))}async function j(e,t){return c(await a("difference",[n(e),e,t]))}async function k(e,t){return c(await a("symmetricDifference",[n(e),e,t]))}async function q(e,t){return c(await a("intersect",[n(e),e,t]))}async function B(e,t=null){const r=S(e,t);return c(await a("union",[n(r),r]))}async function C(e,t,r,i,s,u){return c(await a("offset",[n(e),e,t,r,i,s,u]))}async function G(e,t,r,i=!1){const s=[n(e),e,t,r,i];return c(await a("buffer",s))}async function $(e,t,r,i,s,u){const g=[n(e),e,t,r,i,s,u];return c(await a("geodesicBuffer",g))}async function W(e,t,r=!0){const i=await a("nearestCoordinate",[n(e),e,t,r]);return{...i,coordinate:l.fromJSON(i.coordinate)}}async function Z(e,t){const r=await a("nearestVertex",[n(e),e,t]);return{...r,coordinate:l.fromJSON(r.coordinate)}}async function F(e,t,r,i){return(await a("nearestVertices",[n(e),e,t,r,i])).map(s=>({...s,coordinate:l.fromJSON(s.coordinate)}))}function y(e){var t;return"xmin"in e?e.center:"x"in e?e:(t=e.extent)==null?void 0:t.center}async function K(e,t,r){if(e==null)throw new o;const i=e.spatialReference;if((r=r??y(e))==null)throw new o;const s=e.constructor.fromJSON(await a("rotate",[i,e,t,r]));return s.spatialReference=i,s}async function M(e,t){if(e==null)throw new o;const r=e.spatialReference;if((t=t??y(e))==null)throw new o;const i=e.constructor.fromJSON(await a("flipHorizontal",[r,e,t]));return i.spatialReference=r,i}async function Q(e,t){if(e==null)throw new o;const r=e.spatialReference;if((t=t??y(e))==null)throw new o;const i=e.constructor.fromJSON(await a("flipVertical",[r,e,t]));return i.spatialReference=r,i}async function U(e,t,r,i){return c(await a("generalize",[n(e),e,t,r,i]))}async function X(e,t,r){return c(await a("densify",[n(e),e,t,r]))}async function Y(e,t,r,i=0){return c(await a("geodesicDensify",[n(e),e,t,r,i]))}function _(e,t){return a("planarArea",[n(e),e,t])}function ee(e,t){return a("planarLength",[n(e),e,t])}function te(e,t,r){return a("geodesicArea",[n(e),e,t,r])}function re(e,t,r){return a("geodesicLength",[n(e),e,t,r])}async function ae(e,t){return c(await a("intersectLinesToPoints",[n(e),e,t]))}async function ne(e,t){await m("changeDefaultSpatialReferenceTolerance",[e,t])}async function ie(e){await m("clearDefaultSpatialReferenceTolerance",[e])}class o extends Error{constructor(){super("Illegal Argument Exception")}}export{G as buffer,ne as changeDefaultSpatialReferenceTolerance,ie as clearDefaultSpatialReferenceTolerance,A as clip,D as contains,P as convexHull,J as crosses,O as cut,X as densify,j as difference,E as disjoint,N as distance,L as equals,R as extendedSpatialReferenceInfo,M as flipHorizontal,Q as flipVertical,U as generalize,te as geodesicArea,$ as geodesicBuffer,Y as geodesicDensify,re as geodesicLength,q as intersect,ae as intersectLinesToPoints,T as intersects,H as isSimple,W as nearestCoordinate,Z as nearestVertex,F as nearestVertices,C as offset,b as overlaps,_ as planarArea,ee as planarLength,z as relate,K as rotate,I as simplify,k as symmetricDifference,V as touches,B as union,v as within}; diff --git a/dist/assets/geometryEngineJSON-FxYgI0L3.js b/dist/assets/geometryEngineJSON-0_tJeUzi.js similarity index 98% rename from dist/assets/geometryEngineJSON-FxYgI0L3.js rename to dist/assets/geometryEngineJSON-0_tJeUzi.js index fdf9ac3..d6d8101 100644 --- a/dist/assets/geometryEngineJSON-FxYgI0L3.js +++ b/dist/assets/geometryEngineJSON-0_tJeUzi.js @@ -1 +1 @@ -import{xo as r}from"./index-J0iiHjMT.js";import{t as i}from"./json-v6EOeNTY.js";function a(e){return r.extendedSpatialReferenceInfo(e)}function l(e,n,t){return r.clip(i,e,n,t)}function s(e,n,t){return r.cut(i,e,n,t)}function p(e,n,t){return r.contains(i,e,n,t)}function d(e,n,t){return r.crosses(i,e,n,t)}function g(e,n,t,o){return r.distance(i,e,n,t,o)}function m(e,n,t){return r.equals(i,e,n,t)}function h(e,n,t){return r.intersects(i,e,n,t)}function y(e,n,t){return r.touches(i,e,n,t)}function S(e,n,t){return r.within(i,e,n,t)}function x(e,n,t){return r.disjoint(i,e,n,t)}function D(e,n,t){return r.overlaps(i,e,n,t)}function R(e,n,t,o){return r.relate(i,e,n,t,o)}function T(e,n){return r.isSimple(i,e,n)}function b(e,n){return r.simplify(i,e,n)}function w(e,n,t=!1){return r.convexHull(i,e,n,t)}function A(e,n,t){return r.difference(i,e,n,t)}function L(e,n,t){return r.symmetricDifference(i,e,n,t)}function V(e,n,t){return r.intersect(i,e,n,t)}function v(e,n,t=null){return r.union(i,e,n,t)}function z(e,n,t,o,c,u,f){return r.offset(i,e,n,t,o,c,u,f)}function _(e,n,t,o,c=!1){return r.buffer(i,e,n,t,o,c)}function j(e,n,t,o,c,u,f){return r.geodesicBuffer(i,e,n,t,o,c,u,f)}function E(e,n,t,o=!0){return r.nearestCoordinate(i,e,n,t,o)}function H(e,n,t){return r.nearestVertex(i,e,n,t)}function I(e,n,t,o,c){return r.nearestVertices(i,e,n,t,o,c)}function O(e,n,t,o){if(n==null||o==null)throw new Error("Illegal Argument Exception");const c=r.rotate(n,t,o);return c.spatialReference=e,c}function P(e,n,t){if(n==null||t==null)throw new Error("Illegal Argument Exception");const o=r.flipHorizontal(n,t);return o.spatialReference=e,o}function q(e,n,t){if(n==null||t==null)throw new Error("Illegal Argument Exception");const o=r.flipVertical(n,t);return o.spatialReference=e,o}function B(e,n,t,o,c){return r.generalize(i,e,n,t,o,c)}function C(e,n,t,o){return r.densify(i,e,n,t,o)}function M(e,n,t,o,c=0){return r.geodesicDensify(i,e,n,t,o,c)}function $(e,n,t){return r.planarArea(i,e,n,t)}function G(e,n,t){return r.planarLength(i,e,n,t)}function J(e,n,t,o){return r.geodesicArea(i,e,n,t,o)}function N(e,n,t,o){return r.geodesicLength(i,e,n,t,o)}function k(e,n,t){return n==null||t==null?[]:r.intersectLinesToPoints(i,e,n,t)}function F(e,n){r.changeDefaultSpatialReferenceTolerance(e,n)}function K(e){r.clearDefaultSpatialReferenceTolerance(e)}const W=Object.freeze(Object.defineProperty({__proto__:null,buffer:_,changeDefaultSpatialReferenceTolerance:F,clearDefaultSpatialReferenceTolerance:K,clip:l,contains:p,convexHull:w,crosses:d,cut:s,densify:C,difference:A,disjoint:x,distance:g,equals:m,extendedSpatialReferenceInfo:a,flipHorizontal:P,flipVertical:q,generalize:B,geodesicArea:J,geodesicBuffer:j,geodesicDensify:M,geodesicLength:N,intersect:V,intersectLinesToPoints:k,intersects:h,isSimple:T,nearestCoordinate:E,nearestVertex:H,nearestVertices:I,offset:z,overlaps:D,planarArea:$,planarLength:G,relate:R,rotate:O,simplify:b,symmetricDifference:L,touches:y,union:v,within:S},Symbol.toStringTag,{value:"Module"})),X=Object.freeze(Object.defineProperty({__proto__:null,buffer:_,changeDefaultSpatialReferenceTolerance:F,clearDefaultSpatialReferenceTolerance:K,clip:l,contains:p,convexHull:w,crosses:d,cut:s,densify:C,difference:A,disjoint:x,distance:g,equals:m,extendedSpatialReferenceInfo:a,flipHorizontal:P,flipVertical:q,generalize:B,geodesicArea:J,geodesicBuffer:j,geodesicDensify:M,geodesicLength:N,intersect:V,intersectLinesToPoints:k,intersects:h,isSimple:T,nearestCoordinate:E,nearestVertex:H,nearestVertices:I,offset:z,overlaps:D,planarArea:$,planarLength:G,relate:R,rotate:O,simplify:b,symmetricDifference:L,touches:y,union:v,within:S},Symbol.toStringTag,{value:"Module"}));export{W as O,X as g}; +import{xH as r}from"./index-pCX-0tJH.js";import{t as i}from"./json-v6EOeNTY.js";function a(e){return r.extendedSpatialReferenceInfo(e)}function l(e,n,t){return r.clip(i,e,n,t)}function s(e,n,t){return r.cut(i,e,n,t)}function p(e,n,t){return r.contains(i,e,n,t)}function d(e,n,t){return r.crosses(i,e,n,t)}function g(e,n,t,o){return r.distance(i,e,n,t,o)}function m(e,n,t){return r.equals(i,e,n,t)}function h(e,n,t){return r.intersects(i,e,n,t)}function y(e,n,t){return r.touches(i,e,n,t)}function S(e,n,t){return r.within(i,e,n,t)}function x(e,n,t){return r.disjoint(i,e,n,t)}function D(e,n,t){return r.overlaps(i,e,n,t)}function R(e,n,t,o){return r.relate(i,e,n,t,o)}function T(e,n){return r.isSimple(i,e,n)}function b(e,n){return r.simplify(i,e,n)}function w(e,n,t=!1){return r.convexHull(i,e,n,t)}function A(e,n,t){return r.difference(i,e,n,t)}function L(e,n,t){return r.symmetricDifference(i,e,n,t)}function V(e,n,t){return r.intersect(i,e,n,t)}function v(e,n,t=null){return r.union(i,e,n,t)}function z(e,n,t,o,c,u,f){return r.offset(i,e,n,t,o,c,u,f)}function _(e,n,t,o,c=!1){return r.buffer(i,e,n,t,o,c)}function j(e,n,t,o,c,u,f){return r.geodesicBuffer(i,e,n,t,o,c,u,f)}function E(e,n,t,o=!0){return r.nearestCoordinate(i,e,n,t,o)}function H(e,n,t){return r.nearestVertex(i,e,n,t)}function I(e,n,t,o,c){return r.nearestVertices(i,e,n,t,o,c)}function O(e,n,t,o){if(n==null||o==null)throw new Error("Illegal Argument Exception");const c=r.rotate(n,t,o);return c.spatialReference=e,c}function P(e,n,t){if(n==null||t==null)throw new Error("Illegal Argument Exception");const o=r.flipHorizontal(n,t);return o.spatialReference=e,o}function q(e,n,t){if(n==null||t==null)throw new Error("Illegal Argument Exception");const o=r.flipVertical(n,t);return o.spatialReference=e,o}function B(e,n,t,o,c){return r.generalize(i,e,n,t,o,c)}function C(e,n,t,o){return r.densify(i,e,n,t,o)}function M(e,n,t,o,c=0){return r.geodesicDensify(i,e,n,t,o,c)}function $(e,n,t){return r.planarArea(i,e,n,t)}function G(e,n,t){return r.planarLength(i,e,n,t)}function J(e,n,t,o){return r.geodesicArea(i,e,n,t,o)}function N(e,n,t,o){return r.geodesicLength(i,e,n,t,o)}function k(e,n,t){return n==null||t==null?[]:r.intersectLinesToPoints(i,e,n,t)}function F(e,n){r.changeDefaultSpatialReferenceTolerance(e,n)}function K(e){r.clearDefaultSpatialReferenceTolerance(e)}const W=Object.freeze(Object.defineProperty({__proto__:null,buffer:_,changeDefaultSpatialReferenceTolerance:F,clearDefaultSpatialReferenceTolerance:K,clip:l,contains:p,convexHull:w,crosses:d,cut:s,densify:C,difference:A,disjoint:x,distance:g,equals:m,extendedSpatialReferenceInfo:a,flipHorizontal:P,flipVertical:q,generalize:B,geodesicArea:J,geodesicBuffer:j,geodesicDensify:M,geodesicLength:N,intersect:V,intersectLinesToPoints:k,intersects:h,isSimple:T,nearestCoordinate:E,nearestVertex:H,nearestVertices:I,offset:z,overlaps:D,planarArea:$,planarLength:G,relate:R,rotate:O,simplify:b,symmetricDifference:L,touches:y,union:v,within:S},Symbol.toStringTag,{value:"Module"})),X=Object.freeze(Object.defineProperty({__proto__:null,buffer:_,changeDefaultSpatialReferenceTolerance:F,clearDefaultSpatialReferenceTolerance:K,clip:l,contains:p,convexHull:w,crosses:d,cut:s,densify:C,difference:A,disjoint:x,distance:g,equals:m,extendedSpatialReferenceInfo:a,flipHorizontal:P,flipVertical:q,generalize:B,geodesicArea:J,geodesicBuffer:j,geodesicDensify:M,geodesicLength:N,intersect:V,intersectLinesToPoints:k,intersects:h,isSimple:T,nearestCoordinate:E,nearestVertex:H,nearestVertices:I,offset:z,overlaps:D,planarArea:$,planarLength:G,relate:R,rotate:O,simplify:b,symmetricDifference:L,touches:y,union:v,within:S},Symbol.toStringTag,{value:"Module"}));export{W as O,X as g}; diff --git a/dist/assets/geometryEngineWorker-8ZL1nHC2.js b/dist/assets/geometryEngineWorker-8ZL1nHC2.js new file mode 100644 index 0000000..a01a661 --- /dev/null +++ b/dist/assets/geometryEngineWorker-8ZL1nHC2.js @@ -0,0 +1 @@ +import{O as t}from"./geometryEngineJSON-0_tJeUzi.js";import"./index-pCX-0tJH.js";import"./json-v6EOeNTY.js";function i(r){return(0,t[r.operation])(...r.parameters)}export{i as executeGEOperation}; diff --git a/dist/assets/geometryEngineWorker-yTomxYzK.js b/dist/assets/geometryEngineWorker-yTomxYzK.js deleted file mode 100644 index 8d3a7eb..0000000 --- a/dist/assets/geometryEngineWorker-yTomxYzK.js +++ /dev/null @@ -1 +0,0 @@ -import{O as t}from"./geometryEngineJSON-FxYgI0L3.js";import"./index-J0iiHjMT.js";import"./json-v6EOeNTY.js";function i(r){return(0,t[r.operation])(...r.parameters)}export{i as executeGEOperation}; diff --git a/dist/assets/gif--X7Hb6fX.js b/dist/assets/gif-NERjgkz0.js similarity index 94% rename from dist/assets/gif--X7Hb6fX.js rename to dist/assets/gif-NERjgkz0.js index e66f1a3..673c4b8 100644 --- a/dist/assets/gif--X7Hb6fX.js +++ b/dist/assets/gif-NERjgkz0.js @@ -1 +1 @@ -import{gM as E}from"./index-J0iiHjMT.js";var x={},O={},w={};Object.defineProperty(w,"__esModule",{value:!0}),w.loop=w.conditional=w.parse=void 0;var q=function t(a,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:n;if(Array.isArray(e))e.forEach(function(o){return t(a,o,n,i)});else if(typeof e=="function")e(a,n,i,t);else{var d=Object.keys(e)[0];Array.isArray(e[d])?(i[d]={},t(a,e[d],n,i[d])):i[d]=e[d](a,n,i,t)}return n};w.parse=q;var V=function(t,a){return function(e,n,i,d){a(e,n,i)&&d(e,t,n,i)}};w.conditional=V;var $=function(t,a){return function(e,n,i,d){for(var o=[],c=e.pos;a(e,n,i);){var l={};if(d(e,t,n,l),e.pos===c)break;c=e.pos,o.push(l)}return o}};w.loop=$;var f={};Object.defineProperty(f,"__esModule",{value:!0}),f.readBits=f.readArray=f.readUnsigned=f.readString=f.peekBytes=f.readBytes=f.peekByte=f.readByte=f.buildStream=void 0;var H=function(t){return{data:t,pos:0}};f.buildStream=H;var T=function(){return function(t){return t.data[t.pos++]}};f.readByte=T;var J=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return function(a){return a.data[a.pos+t]}};f.peekByte=J;var _=function(t){return function(a){return a.data.subarray(a.pos,a.pos+=t)}};f.readBytes=_;var K=function(t){return function(a){return a.data.subarray(a.pos,a.pos+t)}};f.peekBytes=K;var L=function(t){return function(a){return Array.from(_(t)(a)).map(function(e){return String.fromCharCode(e)}).join("")}};f.readString=L;var N=function(t){return function(a){var e=_(2)(a);return t?(e[1]<<8)+e[0]:(e[0]<<8)+e[1]}};f.readUnsigned=N;var Q=function(t,a){return function(e,n,i){for(var d=typeof a=="function"?a(e,n,i):a,o=_(t),c=new Array(d),l=0;l=g){var m=g-r.pos;u.push((0,e.readBytes)(m)(r)),h+=m;break}u.push((0,e.readBytes)(y)(r)),h+=y}for(var B=new Uint8Array(h),b=0,v=0;v>=o,h-=o,r>n||r==c)break;if(r==i){d=(1<<(o=u+1))-1,n=i+2,p=C;continue}if(p==C){A[m++]=k[r],p=r,y=r;continue}for(l=r,r==n&&(A[m++]=y,r=p);r>i;)A[m++]=k[r],r=M[r];y=255&k[r],A[m++]=y,nc[r],width:i,height:d}}function ce(t){return U??(U=document.createElement("canvas")),D??(D=U.getContext("2d",{willReadFrequently:!0})),U.width=t.width,U.height=t.height,D.putImageData(t,0,0),U}G=x.decompressFrames=se;const le=[71,73,70];function fe(t){const a=new Uint8Array(t);return!le.some((e,n)=>e!==a[n])}function ye(t){if(!fe(t))return!1;const a=new DataView(t),e=a.getUint8(10);let n=13+(128&e?3*2**(1+(7&e)):0),i=0,d=!1;for(;!d;){switch(a.getUint8(n++)){case 33:if(!o())return!1;break;case 44:c();break;case 59:d=!0;break;default:return!1}if(i>1)return!0}function o(){switch(a.getUint8(n++)){case 249:l();break;case 1:p();break;case 254:r();break;case 255:s();break;default:return!1}return!0}function c(){i++,n+=8;const g=a.getUint8(n++);n+=128&g?3*2**(1+(7&g)):0,n++,u()}function l(){n++,n+=4,u()}function p(){i++,n++,n+=12,u()}function r(){u()}function s(){n++,n+=8,n+=3,u()}function u(){let g;for(;g=a.getUint8(n++);)n+=g}return!1}export{ye as isAnimatedGIF,fe as isGIF,ge as parseGif}; +import{gJ as E}from"./index-pCX-0tJH.js";var x={},O={},w={};Object.defineProperty(w,"__esModule",{value:!0}),w.loop=w.conditional=w.parse=void 0;var q=function t(a,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:n;if(Array.isArray(e))e.forEach(function(o){return t(a,o,n,i)});else if(typeof e=="function")e(a,n,i,t);else{var d=Object.keys(e)[0];Array.isArray(e[d])?(i[d]={},t(a,e[d],n,i[d])):i[d]=e[d](a,n,i,t)}return n};w.parse=q;var V=function(t,a){return function(e,n,i,d){a(e,n,i)&&d(e,t,n,i)}};w.conditional=V;var J=function(t,a){return function(e,n,i,d){for(var o=[],c=e.pos;a(e,n,i);){var l={};if(d(e,t,n,l),e.pos===c)break;c=e.pos,o.push(l)}return o}};w.loop=J;var f={};Object.defineProperty(f,"__esModule",{value:!0}),f.readBits=f.readArray=f.readUnsigned=f.readString=f.peekBytes=f.readBytes=f.peekByte=f.readByte=f.buildStream=void 0;var $=function(t){return{data:t,pos:0}};f.buildStream=$;var T=function(){return function(t){return t.data[t.pos++]}};f.readByte=T;var H=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return function(a){return a.data[a.pos+t]}};f.peekByte=H;var _=function(t){return function(a){return a.data.subarray(a.pos,a.pos+=t)}};f.readBytes=_;var K=function(t){return function(a){return a.data.subarray(a.pos,a.pos+t)}};f.peekBytes=K;var L=function(t){return function(a){return Array.from(_(t)(a)).map(function(e){return String.fromCharCode(e)}).join("")}};f.readString=L;var N=function(t){return function(a){var e=_(2)(a);return t?(e[1]<<8)+e[0]:(e[0]<<8)+e[1]}};f.readUnsigned=N;var Q=function(t,a){return function(e,n,i){for(var d=typeof a=="function"?a(e,n,i):a,o=_(t),c=new Array(d),l=0;l=g){var m=g-r.pos;u.push((0,e.readBytes)(m)(r)),h+=m;break}u.push((0,e.readBytes)(y)(r)),h+=y}for(var B=new Uint8Array(h),b=0,v=0;v>=o,h-=o,r>n||r==c)break;if(r==i){d=(1<<(o=u+1))-1,n=i+2,p=C;continue}if(p==C){A[m++]=k[r],p=r,y=r;continue}for(l=r,r==n&&(A[m++]=y,r=p);r>i;)A[m++]=k[r],r=M[r];y=255&k[r],A[m++]=y,nc[r],width:i,height:d}}function ce(t){return U??(U=document.createElement("canvas")),D??(D=U.getContext("2d",{willReadFrequently:!0})),U.width=t.width,U.height=t.height,D.putImageData(t,0,0),U}G=x.decompressFrames=se;const le=[71,73,70];function fe(t){const a=new Uint8Array(t);return!le.some((e,n)=>e!==a[n])}function ye(t){if(!fe(t))return!1;const a=new DataView(t),e=a.getUint8(10);let n=13+(128&e?3*2**(1+(7&e)):0),i=0,d=!1;for(;!d;){switch(a.getUint8(n++)){case 33:if(!o())return!1;break;case 44:c();break;case 59:d=!0;break;default:return!1}if(i>1)return!0}function o(){switch(a.getUint8(n++)){case 249:l();break;case 1:p();break;case 254:r();break;case 255:s();break;default:return!1}return!0}function c(){i++,n+=8;const g=a.getUint8(n++);n+=128&g?3*2**(1+(7&g)):0,n++,u()}function l(){n++,n+=4,u()}function p(){i++,n++,n+=12,u()}function r(){u()}function s(){n++,n+=8,n+=3,u()}function u(){let g;for(;g=a.getUint8(n++);)n+=g}return!1}export{ye as isAnimatedGIF,fe as isGIF,ge as parseGif}; diff --git a/dist/assets/gltfexport-gleus-sO.js b/dist/assets/gltfexport-W1GDjMOr.js similarity index 88% rename from dist/assets/gltfexport-gleus-sO.js rename to dist/assets/gltfexport-W1GDjMOr.js index dce13db..61f6ffc 100644 --- a/dist/assets/gltfexport-gleus-sO.js +++ b/dist/assets/gltfexport-W1GDjMOr.js @@ -1 +1 @@ -import{qE as p,as as L,aU as Z,aG as re,aF as ne,T as k,aa as O,E as H,o$ as ae,bL as oe,Z as ce,aq as j,bv as he,ki as C,qF as le,qG as fe,qH as ue,qI as ee,mj as de,bx as _e,qJ as pe,qK as me,ln as ge,qw as we,qL as Te,mU as Ae,pl as ye,ld as be,mT as v,fA as A,bA as Ee,qM as xe,gr as Re,qN as Ne,qO as Ie}from"./index-J0iiHjMT.js";var z;(function(i){i[i.JSON=1313821514]="JSON",i[i.BIN=5130562]="BIN"})(z||(z={}));class T{constructor(e,t){if(!e)throw new Error("GLB requires a JSON gltf chunk");this._length=T.HEADER_SIZE,this._length+=T.CHUNK_HEADER_SIZE;const s=this._textToArrayBuffer(e);if(this._length+=this._alignTo(s.byteLength,4),t&&(this._length+=T.CHUNK_HEADER_SIZE,this._length+=t.byteLength,t.byteLength%4))throw new Error("Expected BIN chunk length to be divisible by 4 at this point");this.buffer=new ArrayBuffer(this._length),this._outView=new DataView(this.buffer),this._writeHeader();const r=this._writeChunk(s,12,z.JSON,32);t&&this._writeChunk(t,r,z.BIN)}_writeHeader(){this._outView.setUint32(0,T.MAGIC,!0),this._outView.setUint32(4,T.VERSION,!0),this._outView.setUint32(8,this._length,!0)}_writeChunk(e,t,s,r=0){const n=this._alignTo(e.byteLength,4);for(this._outView.setUint32(t,n,!0),this._outView.setUint32(t+=4,s,!0),this._writeArrayBuffer(this._outView.buffer,e,t+=4,0,e.byteLength),t+=e.byteLength;t%4;)r&&this._outView.setUint8(t,r),t++;return t}_writeArrayBuffer(e,t,s,r,n){new Uint8Array(e,s,n).set(new Uint8Array(t,r,n),0)}_textToArrayBuffer(e){return new TextEncoder().encode(e).buffer}_alignTo(e,t){return t*Math.ceil(e/t)}}T.HEADER_SIZE=12,T.CHUNK_HEADER_SIZE=8,T.MAGIC=1179937895,T.VERSION=2;var R,y,x,w,K,V,J;(function(i){i[i.External=0]="External",i[i.DataURI=1]="DataURI",i[i.GLB=2]="GLB"})(R||(R={})),function(i){i[i.External=0]="External",i[i.DataURI=1]="DataURI",i[i.GLB=2]="GLB"}(y||(y={})),function(i){i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"}(x||(x={})),function(i){i.SCALAR="SCALAR",i.VEC2="VEC2",i.VEC3="VEC3",i.VEC4="VEC4",i.MAT2="MAT2",i.MAT3="MAT3",i.MAT4="MAT4"}(w||(w={})),function(i){i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(K||(K={})),function(i){i.OPAQUE="OPAQUE",i.MASK="MASK",i.BLEND="BLEND"}(V||(V={})),function(i){i[i.NoColor=0]="NoColor",i[i.FaceColor=1]="FaceColor",i[i.VertexColor=2]="VertexColor"}(J||(J={}));let Me=class{constructor(e,t,s,r,n){this._buffer=e,this._componentType=s,this._dataType=r,this._data=[],this._isFinalized=!1,this._accessorIndex=-1,this._accessorAttribute=null,this._accessorMin=null,this._accessorMax=null,t.bufferViews||(t.bufferViews=[]),this.index=t.bufferViews.length,this._bufferView={buffer:e.index,byteLength:-1,target:n};const a=this._getElementSize();a>=4&&n!==x.ELEMENT_ARRAY_BUFFER&&(this._bufferView.byteStride=a),t.bufferViews.push(this._bufferView),this._numComponentsForDataType=this._calculateNumComponentsForDataType()}push(e){const t=this._data.length;if(this._data.push(e),this._accessorIndex>=0){const s=t%this._numComponentsForDataType,r=this._accessorMin[s];this._accessorMin[s]=typeof r!="number"?e:Math.min(r,e);const n=this._accessorMax[s];this._accessorMax[s]=typeof n!="number"?e:Math.max(n,e)}}get dataSize(){return this._data.length*this._sizeComponentType()}get byteSize(){function e(t,s){return s*Math.ceil(t/s)}return e(this.dataSize,4)}getByteOffset(){if(!this._isFinalized)throw new Error("Cannot get BufferView offset until it is finalized");return this._buffer.getByteOffset(this)}get byteOffset(){if(!this._isFinalized)throw new Error("Cannot get BufferView offset until it is finalized");return this._buffer.getByteOffset(this)}_createTypedArray(e,t){switch(this._componentType){case p.BYTE:return new Int8Array(e,t);case p.FLOAT:return new Float32Array(e,t);case p.SHORT:return new Int16Array(e,t);case p.UNSIGNED_BYTE:return new Uint8Array(e,t);case p.UNSIGNED_INT:return new Uint32Array(e,t);case p.UNSIGNED_SHORT:return new Uint16Array(e,t)}}writeOutToBuffer(e,t){this._createTypedArray(e,t).set(this._data)}writeAsync(e){if(this._asyncWritePromise)throw new Error("Can't write multiple bufferView values asynchronously");return this._asyncWritePromise=e.then(t=>{const s=new Uint8Array(t);for(let r=0;r=0)throw new Error("Accessor was started without ending the previous one");this._accessorIndex=this._data.length,this._accessorAttribute=e;const t=this._numComponentsForDataType;this._accessorMin=new Array(t),this._accessorMax=new Array(t)}endAccessor(){if(this._accessorIndex<0)throw new Error("An accessor was not started, but was attempted to be ended");const e=this._getElementSize(),t=this._numComponentsForDataType,s=(this._data.length-this._accessorIndex)/t;if(s%1)throw new Error("An accessor was ended with missing component values");for(let n=0;nthis._finalizedPromiseResolve=e)}async finalize(){const e=this._bufferView,t=this._buffer.getViewFinalizePromises(this);this._asyncWritePromise&&t.push(this._asyncWritePromise),await Promise.allSettled(t),this._isFinalized=!0,e.byteOffset=this.getByteOffset(),e.byteLength=this.dataSize,this._finalizedPromiseResolve&&this._finalizedPromiseResolve()}_getElementSize(){return this._sizeComponentType()*this._numComponentsForDataType}_sizeComponentType(){switch(this._componentType){case p.BYTE:case p.UNSIGNED_BYTE:return 1;case p.SHORT:case p.UNSIGNED_SHORT:return 2;case p.UNSIGNED_INT:case p.FLOAT:return 4}}_calculateNumComponentsForDataType(){switch(this._dataType){case w.SCALAR:return 1;case w.VEC2:return 2;case w.VEC3:return 3;case w.VEC4:case w.MAT2:return 4;case w.MAT3:return 9;case w.MAT4:return 16}}},W=class{constructor(e){this._gltf=e,this._bufferViews=[],this._isFinalized=!1,e.buffers||(e.buffers=[]),this.index=e.buffers.length;const t={byteLength:-1};e.buffers.push(t),this._buffer=t}addBufferView(e,t,s){if(this._finalizePromise)throw new Error("Cannot add buffer view after fiinalizing buffer");const r=new Me(this,this._gltf,e,t,s);return this._bufferViews.push(r),r}getByteOffset(e){let t=0;for(const s of this._bufferViews){if(s===e)return t;t+=s.byteSize}throw new Error("Given bufferView was not present in this buffer")}getViewFinalizePromises(e){const t=[];for(const s of this._bufferViews){if(e&&s===e)return t;t.push(s.finalized)}return t}getArrayBuffer(){if(!this._isFinalized)throw new Error("Cannot get ArrayBuffer from Buffer before it is finalized");const e=this._getTotalSize(),t=new ArrayBuffer(e);let s=0;for(const r of this._bufferViews)r.writeOutToBuffer(t,s),s+=r.byteSize;return t}finalize(){var e;if(this._finalizePromise)throw new Error(`Buffer ${this.index} was already finalized`);return this._finalizePromise=Promise.allSettled(this.getViewFinalizePromises()).then(()=>{this._isFinalized=!0;const t=this.getArrayBuffer();this._buffer.byteLength=t.byteLength,this._buffer.uri=t}),(e=this._gltf.extras)==null||e.promises.push(this._finalizePromise),this._finalizePromise}_getTotalSize(){let e=0;for(const t of this._bufferViews)e+=t.byteSize;return e}};function Oe(i,e){if(i.components)for(const t of i.components)t.faces&&t.shading==="smooth"&&Se(t,e)}function Se(i,e){e.normal==null&&(e.normal=new Float32Array(e.position.length));const t=i.faces,{position:s,normal:r}=e,n=t.length/3;for(let a=0;ae.toBlob(r,t));if(!s)throw new H("imageToArrayBuffer","Failed to encode image");return{data:await s.arrayBuffer(),type:t}}async function Fe(i){if(!(i instanceof HTMLImageElement))return"image/png";const e=i.src;if(ae(e)){const t=oe(e);return(t==null?void 0:t.mediaType)==="image/jpeg"?t.mediaType:"image/png"}return/\.png$/i.test(e)?"image/png":/\.(jpg|jpeg)$/i.test(e)?"image/jpeg":"image/png"}function te(i){if(i instanceof HTMLCanvasElement)return i;if(i instanceof HTMLVideoElement)return null;const e=document.createElement("canvas");e.width=i.width,e.height=i.height;const t=e.getContext("2d");return i instanceof HTMLImageElement?t.drawImage(i,0,0,i.width,i.height):i instanceof ImageData&&t.putImageData(i,0,0),e}function De(i){const e=[],t=new Uint8Array(i);for(let s=0;s{this._addScene(r)}),s&&t.binChunkBuffer.finalize()}_addScene(e){this.gltf.scenes||(this.gltf.scenes=[]);const t={};e.name&&(t.name=e.name),e.forEachNode(s=>{t.nodes||(t.nodes=[]),t.nodes.push(...this._addNodes(s))}),this.gltf.scenes.push(t)}_addNodes(e){this.gltf.nodes||(this.gltf.nodes=[]);const t={};e.name&&(t.name=e.name);const s=e.translation;j(s,he)||(t.translation=C(s));const r=e.rotation;le(r,fe)||(t.rotation=ue(r));const n=e.scale;j(n,ee)||(t.scale=C(n));const a=this.gltf.nodes.length;if(this.gltf.nodes.push(t),e.mesh&&e.mesh.vertexAttributes.position){const o=this._createMeshes(e.mesh),l=[a];if(o.length===1)this._addMesh(t,o[0]);else for(const c of o){const h={};this._addMesh(h,c),l.push(this.gltf.nodes.length),this.gltf.nodes.push(h)}return l}return e.forEachNode(o=>{t.children||(t.children=[]),t.children.push(...this._addNodes(o))}),[a]}_addMesh(e,t){var r;(r=this.gltf).meshes??(r.meshes=[]);const s=this.gltf.meshes.length;this.gltf.meshes.push(t),e.mesh=s}_createMeshes(e){const t=this.gltf.extras,s=t.options.bufferOutputType===R.GLB;let r;r=s?t.binChunkBuffer:new W(this.gltf),this.params.origin||(this.params.origin=Be(e));const{ignoreLocalTransform:n}=this.params,a=n?null:e.transform,{vertexSpace:o,spatialReference:l}=e,c=e.vertexAttributes;let h=null;if(o.type==="local"){const f=de(l);_e(Q,(a==null?void 0:a.localMatrix)??pe,[f,f,f]),h=me(c,Q)}else{const f=n?o.isRelative?new ge({origin:C(o.origin)}):new we:o;h=Te(c,f,a,this.params.origin,{geographic:this.params.geographic,unit:"meters"})}if(h==null)throw new H("Error during gltf export.");c.position&&h.position===c.position&&(h.position=c.position.slice()),c.normal&&h.normal===c.normal&&(h.normal=c.normal.slice()),c.tangent&&h.tangent===c.tangent&&(h.tangent=c.tangent.slice()),Oe(e,h),this._flipYZAxis(h);const g=r.addBufferView(p.FLOAT,w.VEC3,x.ARRAY_BUFFER);let _,m,u,d;h.normal&&(_=r.addBufferView(p.FLOAT,w.VEC3,x.ARRAY_BUFFER)),c.uv&&(m=r.addBufferView(p.FLOAT,w.VEC2,x.ARRAY_BUFFER)),h.tangent&&(u=r.addBufferView(p.FLOAT,w.VEC4,x.ARRAY_BUFFER)),c.color&&(d=r.addBufferView(p.UNSIGNED_BYTE,w.VEC4,x.ARRAY_BUFFER)),g.startAccessor("POSITION"),_&&_.startAccessor("NORMAL"),m&&m.startAccessor("TEXCOORD_0"),u&&u.startAccessor("TANGENT"),d&&d.startAccessor("COLOR_0");const b=h.position.length/3,{position:E,normal:S,tangent:I}=h,{color:M,uv:F}=c;for(let f=0;f0&&e.components[0].faces?(B=r.addBufferView(p.UNSIGNED_INT,w.SCALAR,x.ELEMENT_ARRAY_BUFFER),this._addMeshVertexIndexed(B,e.components,G,q,D,P,U,$)):this._addMeshVertexNonIndexed(e.components,G,q,D,P,U,$),g.finalize(),_&&_.finalize(),m&&m.finalize(),u&&u.finalize(),B&&B.finalize(),d&&d.finalize(),s||r.finalize(),G}_flipYZAxis({position:e,normal:t,tangent:s}){this._flipYZBuffer(e,3),this._flipYZBuffer(t,3),this._flipYZBuffer(s,4)}_flipYZBuffer(e,t){if(e!=null)for(let s=1,r=2;so**2.1,n=o=>{const l=o.toRgba();return l[0]=r(l[0]/255),l[1]=r(l[1]/255),l[2]=r(l[2]/255),l};if(e.color!=null&&(s.pbrMetallicRoughness.baseColorFactor=n(e.color)),e.colorTexture!=null&&(s.pbrMetallicRoughness.baseColorTexture=this._createTextureInfo(e.colorTexture,e.colorTextureTransform)),e.normalTexture!=null&&(s.normalTexture=this._createTextureInfo(e.normalTexture,e.normalTextureTransform)),e instanceof Ae){if(e.emissiveTexture!=null&&(s.emissiveTexture=this._createTextureInfo(e.emissiveTexture,e.emissiveTextureTransform)),e.emissiveColor!=null){const o=n(e.emissiveColor);s.emissiveFactor=[o[0],o[1],o[2]]}e.occlusionTexture!=null&&(s.occlusionTexture=this._createTextureInfo(e.occlusionTexture,e.occlusionTextureTransform)),e.metallicRoughnessTexture!=null&&(s.pbrMetallicRoughness.metallicRoughnessTexture=this._createTextureInfo(e.metallicRoughnessTexture,e.metallicRoughnessTextureTransform)),s.pbrMetallicRoughness.metallicFactor=e.metallic,s.pbrMetallicRoughness.roughnessFactor=e.roughness}else s.pbrMetallicRoughness.metallicFactor=1,s.pbrMetallicRoughness.roughnessFactor=1,Y.warnOnce("Meshes exported to GLTF without MeshMaterialMetallicRoughness material will appear different when imported back.");const a=this.gltf.materials.length;return this.gltf.materials.push(s),this._materialMap.push(e),a}_createTextureInfo(e,t){const s={index:this._addTexture(e)};return t&&(s.extensions||(s.extensions={}),s.extensions.KHR_texture_transform={scale:t.scale,offset:t.offset,rotation:ye(t.rotation)}),s}_addTexture(e){const t=this.gltf.textures??[];return this.gltf.textures=t,be(this._textureMap,e,()=>{const s={sampler:this._addSampler(e),source:this._addImage(e)},r=t.length;return t.push(s),r})}_addImage(e){const t=this._imageMap.get(e);if(t!=null)return t;this.gltf.images||(this.gltf.images=[]);const s={};if(e.url)s.uri=e.url;else{const n=e.data;s.extras=n;for(let o=0;o(s.mimeType=h,c));o.writeAsync(l).then(()=>{o.finalize()})}s.bufferView=o.index;break}case y.DataURI:if(v(n)){Y.warnOnce("Image export for basis compressed textures not available.");break}s.uri=Ve(n);break;default:if(v(n)){Y.warnOnce("Image export for basis compressed textures not available.");break}a.promises.push(X(n).then(({data:o,type:l})=>{s.uri=o,s.mimeType=l}))}}const r=this.gltf.images.length;return this.gltf.images.push(s),this._imageMap.set(e,r),r}_addSampler(e){this.gltf.samplers||(this.gltf.samplers=[]);let t=A.REPEAT,s=A.REPEAT;if(typeof e.wrap=="string")switch(e.wrap){case"clamp":t=A.CLAMP_TO_EDGE,s=A.CLAMP_TO_EDGE;break;case"mirror":t=A.MIRRORED_REPEAT,s=A.MIRRORED_REPEAT}else{switch(e.wrap.vertical){case"clamp":s=A.CLAMP_TO_EDGE;break;case"mirror":s=A.MIRRORED_REPEAT}switch(e.wrap.horizontal){case"clamp":t=A.CLAMP_TO_EDGE;break;case"mirror":t=A.MIRRORED_REPEAT}}const r={wrapS:t,wrapT:s};for(let a=0;a{if(d!=="extras"){if(b instanceof ArrayBuffer){if(Pe(b))switch(e.imageOutputType){case y.DataURI:case y.GLB:break;case y.External:default:{const E=`img${c}.png`;return c++,g[E]=b,E}}switch(e.bufferOutputType){case R.DataURI:return De(b);case R.GLB:if(h)throw new Error("Already encountered an ArrayBuffer, there should only be one in the GLB format.");return void(h=b);case R.External:default:{const E=`data${l}.bin`;return l++,g[E]=b,E}}}return b}},_);return e.bufferOutputType===R.GLB||e.imageOutputType===y.GLB?g[se]=new T(m,h).buffer:g[Ye]=m,g}function He(i,e){return ke(i,{bufferOutputType:R.GLB,imageOutputType:y.GLB,jsonSpacing:0},e)}class qe{constructor(e,t){this._file={type:"model/gltf-binary",data:e},this.origin=t}buffer(){return Promise.resolve(this._file)}download(e){Ie(new Blob([this._file.data],{type:this._file.type}),e)}}function We(i,e){const t=new $e,s=new Ge;return t.addScene(s),s.addNode(new ve(i)),He(t,e).then(r=>new qe(r[se],r.origin))}export{We as toBinaryGLTF}; +import{qR as p,bz as L,b4 as Z,c6 as re,bL as ne,L as k,a8 as S,r as H,pc as ae,ak as oe,R as ce,b6 as j,bN as he,kq as C,qS as le,qT as fe,qU as ue,qV as ee,mr as de,bQ as _e,qW as pe,qX as me,lv as ge,qJ as we,qY as Te,n1 as Ae,py as ye,ll as be,n0 as v,fv as A,bT as Ee,qZ as Re,go as xe,q_ as Ne,q$ as Ie}from"./index-pCX-0tJH.js";var z;(function(i){i[i.JSON=1313821514]="JSON",i[i.BIN=5130562]="BIN"})(z||(z={}));class T{constructor(e,t){if(!e)throw new Error("GLB requires a JSON gltf chunk");this._length=T.HEADER_SIZE,this._length+=T.CHUNK_HEADER_SIZE;const s=this._textToArrayBuffer(e);if(this._length+=this._alignTo(s.byteLength,4),t&&(this._length+=T.CHUNK_HEADER_SIZE,this._length+=t.byteLength,t.byteLength%4))throw new Error("Expected BIN chunk length to be divisible by 4 at this point");this.buffer=new ArrayBuffer(this._length),this._outView=new DataView(this.buffer),this._writeHeader();const r=this._writeChunk(s,12,z.JSON,32);t&&this._writeChunk(t,r,z.BIN)}_writeHeader(){this._outView.setUint32(0,T.MAGIC,!0),this._outView.setUint32(4,T.VERSION,!0),this._outView.setUint32(8,this._length,!0)}_writeChunk(e,t,s,r=0){const n=this._alignTo(e.byteLength,4);for(this._outView.setUint32(t,n,!0),this._outView.setUint32(t+=4,s,!0),this._writeArrayBuffer(this._outView.buffer,e,t+=4,0,e.byteLength),t+=e.byteLength;t%4;)r&&this._outView.setUint8(t,r),t++;return t}_writeArrayBuffer(e,t,s,r,n){new Uint8Array(e,s,n).set(new Uint8Array(t,r,n),0)}_textToArrayBuffer(e){return new TextEncoder().encode(e).buffer}_alignTo(e,t){return t*Math.ceil(e/t)}}T.HEADER_SIZE=12,T.CHUNK_HEADER_SIZE=8,T.MAGIC=1179937895,T.VERSION=2;var x,y,R,w,J,V,K;(function(i){i[i.External=0]="External",i[i.DataURI=1]="DataURI",i[i.GLB=2]="GLB"})(x||(x={})),function(i){i[i.External=0]="External",i[i.DataURI=1]="DataURI",i[i.GLB=2]="GLB"}(y||(y={})),function(i){i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"}(R||(R={})),function(i){i.SCALAR="SCALAR",i.VEC2="VEC2",i.VEC3="VEC3",i.VEC4="VEC4",i.MAT2="MAT2",i.MAT3="MAT3",i.MAT4="MAT4"}(w||(w={})),function(i){i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(J||(J={})),function(i){i.OPAQUE="OPAQUE",i.MASK="MASK",i.BLEND="BLEND"}(V||(V={})),function(i){i[i.NoColor=0]="NoColor",i[i.FaceColor=1]="FaceColor",i[i.VertexColor=2]="VertexColor"}(K||(K={}));let Me=class{constructor(e,t,s,r,n){this._buffer=e,this._componentType=s,this._dataType=r,this._data=[],this._isFinalized=!1,this._accessorIndex=-1,this._accessorAttribute=null,this._accessorMin=null,this._accessorMax=null,t.bufferViews||(t.bufferViews=[]),this.index=t.bufferViews.length,this._bufferView={buffer:e.index,byteLength:-1,target:n};const a=this._getElementSize();a>=4&&n!==R.ELEMENT_ARRAY_BUFFER&&(this._bufferView.byteStride=a),t.bufferViews.push(this._bufferView),this._numComponentsForDataType=this._calculateNumComponentsForDataType()}push(e){const t=this._data.length;if(this._data.push(e),this._accessorIndex>=0){const s=t%this._numComponentsForDataType,r=this._accessorMin[s];this._accessorMin[s]=typeof r!="number"?e:Math.min(r,e);const n=this._accessorMax[s];this._accessorMax[s]=typeof n!="number"?e:Math.max(n,e)}}get dataSize(){return this._data.length*this._sizeComponentType()}get byteSize(){function e(t,s){return s*Math.ceil(t/s)}return e(this.dataSize,4)}getByteOffset(){if(!this._isFinalized)throw new Error("Cannot get BufferView offset until it is finalized");return this._buffer.getByteOffset(this)}get byteOffset(){if(!this._isFinalized)throw new Error("Cannot get BufferView offset until it is finalized");return this._buffer.getByteOffset(this)}_createTypedArray(e,t){switch(this._componentType){case p.BYTE:return new Int8Array(e,t);case p.FLOAT:return new Float32Array(e,t);case p.SHORT:return new Int16Array(e,t);case p.UNSIGNED_BYTE:return new Uint8Array(e,t);case p.UNSIGNED_INT:return new Uint32Array(e,t);case p.UNSIGNED_SHORT:return new Uint16Array(e,t)}}writeOutToBuffer(e,t){this._createTypedArray(e,t).set(this._data)}writeAsync(e){if(this._asyncWritePromise)throw new Error("Can't write multiple bufferView values asynchronously");return this._asyncWritePromise=e.then(t=>{const s=new Uint8Array(t);for(let r=0;r=0)throw new Error("Accessor was started without ending the previous one");this._accessorIndex=this._data.length,this._accessorAttribute=e;const t=this._numComponentsForDataType;this._accessorMin=new Array(t),this._accessorMax=new Array(t)}endAccessor(){if(this._accessorIndex<0)throw new Error("An accessor was not started, but was attempted to be ended");const e=this._getElementSize(),t=this._numComponentsForDataType,s=(this._data.length-this._accessorIndex)/t;if(s%1)throw new Error("An accessor was ended with missing component values");for(let n=0;nthis._finalizedPromiseResolve=e)}async finalize(){const e=this._bufferView,t=this._buffer.getViewFinalizePromises(this);this._asyncWritePromise&&t.push(this._asyncWritePromise),await Promise.allSettled(t),this._isFinalized=!0,e.byteOffset=this.getByteOffset(),e.byteLength=this.dataSize,this._finalizedPromiseResolve&&this._finalizedPromiseResolve()}_getElementSize(){return this._sizeComponentType()*this._numComponentsForDataType}_sizeComponentType(){switch(this._componentType){case p.BYTE:case p.UNSIGNED_BYTE:return 1;case p.SHORT:case p.UNSIGNED_SHORT:return 2;case p.UNSIGNED_INT:case p.FLOAT:return 4}}_calculateNumComponentsForDataType(){switch(this._dataType){case w.SCALAR:return 1;case w.VEC2:return 2;case w.VEC3:return 3;case w.VEC4:case w.MAT2:return 4;case w.MAT3:return 9;case w.MAT4:return 16}}},W=class{constructor(e){this._gltf=e,this._bufferViews=[],this._isFinalized=!1,e.buffers||(e.buffers=[]),this.index=e.buffers.length;const t={byteLength:-1};e.buffers.push(t),this._buffer=t}addBufferView(e,t,s){if(this._finalizePromise)throw new Error("Cannot add buffer view after fiinalizing buffer");const r=new Me(this,this._gltf,e,t,s);return this._bufferViews.push(r),r}getByteOffset(e){let t=0;for(const s of this._bufferViews){if(s===e)return t;t+=s.byteSize}throw new Error("Given bufferView was not present in this buffer")}getViewFinalizePromises(e){const t=[];for(const s of this._bufferViews){if(e&&s===e)return t;t.push(s.finalized)}return t}getArrayBuffer(){if(!this._isFinalized)throw new Error("Cannot get ArrayBuffer from Buffer before it is finalized");const e=this._getTotalSize(),t=new ArrayBuffer(e);let s=0;for(const r of this._bufferViews)r.writeOutToBuffer(t,s),s+=r.byteSize;return t}finalize(){var e;if(this._finalizePromise)throw new Error(`Buffer ${this.index} was already finalized`);return this._finalizePromise=Promise.allSettled(this.getViewFinalizePromises()).then(()=>{this._isFinalized=!0;const t=this.getArrayBuffer();this._buffer.byteLength=t.byteLength,this._buffer.uri=t}),(e=this._gltf.extras)==null||e.promises.push(this._finalizePromise),this._finalizePromise}_getTotalSize(){let e=0;for(const t of this._bufferViews)e+=t.byteSize;return e}};function Se(i,e){if(i.components)for(const t of i.components)t.faces&&t.shading==="smooth"&&Oe(t,e)}function Oe(i,e){e.normal==null&&(e.normal=new Float32Array(e.position.length));const t=i.faces,{position:s,normal:r}=e,n=t.length/3;for(let a=0;ae.toBlob(r,t));if(!s)throw new H("imageToArrayBuffer","Failed to encode image");return{data:await s.arrayBuffer(),type:t}}async function Fe(i){if(!(i instanceof HTMLImageElement))return"image/png";const e=i.src;if(ae(e)){const t=oe(e);return(t==null?void 0:t.mediaType)==="image/jpeg"?t.mediaType:"image/png"}return/\.png$/i.test(e)?"image/png":/\.(jpg|jpeg)$/i.test(e)?"image/jpeg":"image/png"}function te(i){if(i instanceof HTMLCanvasElement)return i;if(i instanceof HTMLVideoElement)return null;const e=document.createElement("canvas");e.width=i.width,e.height=i.height;const t=e.getContext("2d");return i instanceof HTMLImageElement?t.drawImage(i,0,0,i.width,i.height):i instanceof ImageData&&t.putImageData(i,0,0),e}function De(i){const e=[],t=new Uint8Array(i);for(let s=0;s{this._addScene(r)}),s&&t.binChunkBuffer.finalize()}_addScene(e){this.gltf.scenes||(this.gltf.scenes=[]);const t={};e.name&&(t.name=e.name),e.forEachNode(s=>{t.nodes||(t.nodes=[]),t.nodes.push(...this._addNodes(s))}),this.gltf.scenes.push(t)}_addNodes(e){this.gltf.nodes||(this.gltf.nodes=[]);const t={};e.name&&(t.name=e.name);const s=e.translation;j(s,he)||(t.translation=C(s));const r=e.rotation;le(r,fe)||(t.rotation=ue(r));const n=e.scale;j(n,ee)||(t.scale=C(n));const a=this.gltf.nodes.length;if(this.gltf.nodes.push(t),e.mesh&&e.mesh.vertexAttributes.position){const o=this._createMeshes(e.mesh),l=[a];if(o.length===1)this._addMesh(t,o[0]);else for(const c of o){const h={};this._addMesh(h,c),l.push(this.gltf.nodes.length),this.gltf.nodes.push(h)}return l}return e.forEachNode(o=>{t.children||(t.children=[]),t.children.push(...this._addNodes(o))}),[a]}_addMesh(e,t){var r;(r=this.gltf).meshes??(r.meshes=[]);const s=this.gltf.meshes.length;this.gltf.meshes.push(t),e.mesh=s}_createMeshes(e){const t=this.gltf.extras,s=t.options.bufferOutputType===x.GLB;let r;r=s?t.binChunkBuffer:new W(this.gltf),this.params.origin||(this.params.origin=Be(e));const{ignoreLocalTransform:n}=this.params,a=n?null:e.transform,{vertexSpace:o,spatialReference:l}=e,c=e.vertexAttributes;let h=null;if(o.type==="local"){const f=de(l);_e(Q,(a==null?void 0:a.localMatrix)??pe,[f,f,f]),h=me(c,Q)}else{const f=n?o.isRelative?new ge({origin:C(o.origin)}):new we:o;h=Te(c,f,a,this.params.origin,{geographic:this.params.geographic,unit:"meters"})}if(h==null)throw new H("Error during gltf export.");c.position&&h.position===c.position&&(h.position=c.position.slice()),c.normal&&h.normal===c.normal&&(h.normal=c.normal.slice()),c.tangent&&h.tangent===c.tangent&&(h.tangent=c.tangent.slice()),Se(e,h),this._flipYZAxis(h);const g=r.addBufferView(p.FLOAT,w.VEC3,R.ARRAY_BUFFER);let _,m,u,d;h.normal&&(_=r.addBufferView(p.FLOAT,w.VEC3,R.ARRAY_BUFFER)),c.uv&&(m=r.addBufferView(p.FLOAT,w.VEC2,R.ARRAY_BUFFER)),h.tangent&&(u=r.addBufferView(p.FLOAT,w.VEC4,R.ARRAY_BUFFER)),c.color&&(d=r.addBufferView(p.UNSIGNED_BYTE,w.VEC4,R.ARRAY_BUFFER)),g.startAccessor("POSITION"),_&&_.startAccessor("NORMAL"),m&&m.startAccessor("TEXCOORD_0"),u&&u.startAccessor("TANGENT"),d&&d.startAccessor("COLOR_0");const b=h.position.length/3,{position:E,normal:O,tangent:I}=h,{color:M,uv:F}=c;for(let f=0;f0&&e.components[0].faces?(B=r.addBufferView(p.UNSIGNED_INT,w.SCALAR,R.ELEMENT_ARRAY_BUFFER),this._addMeshVertexIndexed(B,e.components,G,q,D,P,U,$)):this._addMeshVertexNonIndexed(e.components,G,q,D,P,U,$),g.finalize(),_&&_.finalize(),m&&m.finalize(),u&&u.finalize(),B&&B.finalize(),d&&d.finalize(),s||r.finalize(),G}_flipYZAxis({position:e,normal:t,tangent:s}){this._flipYZBuffer(e,3),this._flipYZBuffer(t,3),this._flipYZBuffer(s,4)}_flipYZBuffer(e,t){if(e!=null)for(let s=1,r=2;so**2.1,n=o=>{const l=o.toRgba();return l[0]=r(l[0]/255),l[1]=r(l[1]/255),l[2]=r(l[2]/255),l};if(e.color!=null&&(s.pbrMetallicRoughness.baseColorFactor=n(e.color)),e.colorTexture!=null&&(s.pbrMetallicRoughness.baseColorTexture=this._createTextureInfo(e.colorTexture,e.colorTextureTransform)),e.normalTexture!=null&&(s.normalTexture=this._createTextureInfo(e.normalTexture,e.normalTextureTransform)),e instanceof Ae){if(e.emissiveTexture!=null&&(s.emissiveTexture=this._createTextureInfo(e.emissiveTexture,e.emissiveTextureTransform)),e.emissiveColor!=null){const o=n(e.emissiveColor);s.emissiveFactor=[o[0],o[1],o[2]]}e.occlusionTexture!=null&&(s.occlusionTexture=this._createTextureInfo(e.occlusionTexture,e.occlusionTextureTransform)),e.metallicRoughnessTexture!=null&&(s.pbrMetallicRoughness.metallicRoughnessTexture=this._createTextureInfo(e.metallicRoughnessTexture,e.metallicRoughnessTextureTransform)),s.pbrMetallicRoughness.metallicFactor=e.metallic,s.pbrMetallicRoughness.roughnessFactor=e.roughness}else s.pbrMetallicRoughness.metallicFactor=1,s.pbrMetallicRoughness.roughnessFactor=1,Y.warnOnce("Meshes exported to GLTF without MeshMaterialMetallicRoughness material will appear different when imported back.");const a=this.gltf.materials.length;return this.gltf.materials.push(s),this._materialMap.push(e),a}_createTextureInfo(e,t){const s={index:this._addTexture(e)};return t&&(s.extensions||(s.extensions={}),s.extensions.KHR_texture_transform={scale:t.scale,offset:t.offset,rotation:ye(t.rotation)}),s}_addTexture(e){const t=this.gltf.textures??[];return this.gltf.textures=t,be(this._textureMap,e,()=>{const s={sampler:this._addSampler(e),source:this._addImage(e)},r=t.length;return t.push(s),r})}_addImage(e){const t=this._imageMap.get(e);if(t!=null)return t;this.gltf.images||(this.gltf.images=[]);const s={};if(e.url)s.uri=e.url;else{const n=e.data;s.extras=n;for(let o=0;o(s.mimeType=h,c));o.writeAsync(l).then(()=>{o.finalize()})}s.bufferView=o.index;break}case y.DataURI:if(v(n)){Y.warnOnce("Image export for basis compressed textures not available.");break}s.uri=Ve(n);break;default:if(v(n)){Y.warnOnce("Image export for basis compressed textures not available.");break}a.promises.push(X(n).then(({data:o,type:l})=>{s.uri=o,s.mimeType=l}))}}const r=this.gltf.images.length;return this.gltf.images.push(s),this._imageMap.set(e,r),r}_addSampler(e){this.gltf.samplers||(this.gltf.samplers=[]);let t=A.REPEAT,s=A.REPEAT;if(typeof e.wrap=="string")switch(e.wrap){case"clamp":t=A.CLAMP_TO_EDGE,s=A.CLAMP_TO_EDGE;break;case"mirror":t=A.MIRRORED_REPEAT,s=A.MIRRORED_REPEAT}else{switch(e.wrap.vertical){case"clamp":s=A.CLAMP_TO_EDGE;break;case"mirror":s=A.MIRRORED_REPEAT}switch(e.wrap.horizontal){case"clamp":t=A.CLAMP_TO_EDGE;break;case"mirror":t=A.MIRRORED_REPEAT}}const r={wrapS:t,wrapT:s};for(let a=0;a{if(d!=="extras"){if(b instanceof ArrayBuffer){if(Pe(b))switch(e.imageOutputType){case y.DataURI:case y.GLB:break;case y.External:default:{const E=`img${c}.png`;return c++,g[E]=b,E}}switch(e.bufferOutputType){case x.DataURI:return De(b);case x.GLB:if(h)throw new Error("Already encountered an ArrayBuffer, there should only be one in the GLB format.");return void(h=b);case x.External:default:{const E=`data${l}.bin`;return l++,g[E]=b,E}}}return b}},_);return e.bufferOutputType===x.GLB||e.imageOutputType===y.GLB?g[se]=new T(m,h).buffer:g[Ye]=m,g}function He(i,e){return ke(i,{bufferOutputType:x.GLB,imageOutputType:y.GLB,jsonSpacing:0},e)}class qe{constructor(e,t){this._file={type:"model/gltf-binary",data:e},this.origin=t}buffer(){return Promise.resolve(this._file)}download(e){Ie(new Blob([this._file.data],{type:this._file.type}),e)}}function We(i,e){const t=new $e,s=new Ge;return t.addScene(s),s.addNode(new ve(i)),He(t,e).then(r=>new qe(r[se],r.origin))}export{We as toBinaryGLTF}; diff --git a/dist/assets/groupLayerUtils-ciLlAkrK.js b/dist/assets/groupLayerUtils-ciLlAkrK.js deleted file mode 100644 index fc16cb1..0000000 --- a/dist/assets/groupLayerUtils-ciLlAkrK.js +++ /dev/null @@ -1 +0,0 @@ -import{I as y,b as m}from"./utils-rBsg-VY8.js";import{a as o}from"./jsonContext-cWV_-jAj.js";import{u as n,i as p,h as f,j as v}from"./index-J0iiHjMT.js";const c="Group Layer",d="group-layer-save",I="group-layer-save-as",s=f.GROUP_LAYER_MAP;function i(e){return{isValid:e.type==="group",errorMessage:"Layer.type should be 'group'"}}function g(e){return{isValid:v(e,s),errorMessage:`Layer.portalItem.typeKeywords should have '${s}'`}}function u(e){const r=e.layerJSON;return Promise.resolve(r&&Object.keys(r).length?r:null)}async function P(e,r){r.title||(r.title=e.title),p(r,s)}async function x(e,r){return y({layer:e,itemType:c,validateLayer:i,validateItem:g,createJSONContext:a=>o(a,e),createItemData:u,errorNamePrefix:d,saveResources:async(a,t)=>(e.sourceIsPortalItem||await a.removeAllResources().catch(()=>{}),n(e.resourceReferences,t))},r)}async function N(e,r,a){return m({layer:e,itemType:c,validateLayer:i,createJSONContext:t=>o(t,e),createItemData:u,errorNamePrefix:I,newItem:r,setItemProperties:P,saveResources:(t,l)=>n(e.resourceReferences,l)},a)}export{x as save,N as saveAs}; diff --git a/dist/assets/groupLayerUtils-dIBU5FCY.js b/dist/assets/groupLayerUtils-dIBU5FCY.js new file mode 100644 index 0000000..305596b --- /dev/null +++ b/dist/assets/groupLayerUtils-dIBU5FCY.js @@ -0,0 +1 @@ +import{I as y,b as m}from"./utils-YxtTVBu2.js";import{a as o}from"./jsonContext-EgdQULbU.js";import{u as n,i as p,f,s as v}from"./index-pCX-0tJH.js";const c="Group Layer",d="group-layer-save",I="group-layer-save-as",s=f.GROUP_LAYER_MAP;function i(e){return{isValid:e.type==="group",errorMessage:"Layer.type should be 'group'"}}function g(e){return{isValid:v(e,s),errorMessage:`Layer.portalItem.typeKeywords should have '${s}'`}}function u(e){const r=e.layerJSON;return Promise.resolve(r&&Object.keys(r).length?r:null)}async function P(e,r){r.title||(r.title=e.title),p(r,s)}async function x(e,r){return y({layer:e,itemType:c,validateLayer:i,validateItem:g,createJSONContext:t=>o(t,e),createItemData:u,errorNamePrefix:d,saveResources:async(t,a)=>(e.sourceIsPortalItem||await t.removeAllResources().catch(()=>{}),n(e.resourceReferences,a))},r)}async function N(e,r,t){return m({layer:e,itemType:c,validateLayer:i,createJSONContext:a=>o(a,e),createItemData:u,errorNamePrefix:I,newItem:r,setItemProperties:P,saveResources:(a,l)=>n(e.resourceReferences,l)},t)}export{x as save,N as saveAs}; diff --git a/dist/assets/i3s-038C_b0B.js b/dist/assets/i3s-Sea9P9GD.js similarity index 93% rename from dist/assets/i3s-038C_b0B.js rename to dist/assets/i3s-Sea9P9GD.js index 65cec8d..b1648e4 100644 --- a/dist/assets/i3s-038C_b0B.js +++ b/dist/assets/i3s-Sea9P9GD.js @@ -1,2 +1,2 @@ -import{cg as ur}from"./index-J0iiHjMT.js";function cr(k,H){for(var P=0;Pi[E]})}}}return Object.freeze(Object.defineProperty(k,Symbol.toStringTag,{value:"Module"}))}var Ot,ct,Dt,tt={exports:{}};tt.exports,Ot=tt,tt.exports,ct=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,Dt=function(k={}){var H,P,i=k!==void 0?k:{};i.ready=new Promise((t,e)=>{H=t,P=e});var E=Object.assign({},i),x=typeof window=="object",q=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&process.versions.node;var et,b="";function zt(t){return i.locateFile?i.locateFile(t,b):b+t}(x||q)&&(q?b=self.location.href:typeof document<"u"&&document.currentScript&&(b=document.currentScript.src),ct&&(b=ct),b=b.indexOf("blob:")!==0?b.substr(0,b.replace(/[?#].*/,"").lastIndexOf("/")+1):"",q&&(et=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}));var z,N,Vt=i.print||console.log.bind(console),U=i.printErr||console.warn.bind(console);Object.assign(i,E),E=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram,i.quit&&i.quit,i.wasmBinary&&(z=i.wasmBinary),i.noExitRuntime,typeof WebAssembly!="object"&&$("no native wasm support detected");var j,v,I,L,F,p,st,ft,lt,dt=!1;function pt(){var t=N.buffer;i.HEAP8=j=new Int8Array(t),i.HEAP16=I=new Int16Array(t),i.HEAP32=F=new Int32Array(t),i.HEAPU8=v=new Uint8Array(t),i.HEAPU16=L=new Uint16Array(t),i.HEAPU32=p=new Uint32Array(t),i.HEAPF32=st=new Float32Array(t),i.HEAPF64=ft=new Float64Array(t)}var vt=[],ht=[],mt=[];function Mt(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)Nt(i.preRun.shift());rt(vt)}function Bt(){rt(ht)}function qt(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)$t(i.postRun.shift());rt(mt)}function Nt(t){vt.unshift(t)}function Lt(t){ht.unshift(t)}function $t(t){mt.unshift(t)}var R=0,V=null;function Gt(t){R++,i.monitorRunDependencies&&i.monitorRunDependencies(R)}function Xt(t){if(R--,i.monitorRunDependencies&&i.monitorRunDependencies(R),R==0&&V){var e=V;V=null,e()}}function $(t){i.onAbort&&i.onAbort(t),U(t="Aborted("+t+")"),dt=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw P(e),e}var M,Zt="data:application/octet-stream;base64,";function gt(t){return t.startsWith(Zt)}function yt(t){try{if(t==M&&z)return new Uint8Array(z);if(et)return et(t);throw"both async and sync fetching of the wasm failed"}catch(e){$(e)}}function Jt(t){return z||!x&&!q||typeof fetch!="function"?Promise.resolve().then(()=>yt(t)):fetch(t,{credentials:"same-origin"}).then(e=>{if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()}).catch(()=>yt(t))}function _t(t,e,r){return Jt(t).then(n=>WebAssembly.instantiate(n,e)).then(n=>n).then(r,n=>{U("failed to asynchronously prepare wasm: "+n),$(n)})}function Kt(t,e,r,n){return t||typeof WebAssembly.instantiateStreaming!="function"||gt(e)||typeof fetch!="function"?_t(e,r,n):fetch(e,{credentials:"same-origin"}).then(o=>WebAssembly.instantiateStreaming(o,r).then(n,function(u){return U("wasm streaming compile failed: "+u),U("falling back to ArrayBuffer instantiation"),_t(e,r,n)}))}function Qt(){var t={env:St,wasi_snapshot_preview1:St};function e(n,o){var u=n.exports;return i.asm=u,N=i.asm.memory,pt(),lt=i.asm.__indirect_function_table,Lt(i.asm.__wasm_call_ctors),Xt(),u}function r(n){e(n.instance)}if(Gt(),i.instantiateWasm)try{return i.instantiateWasm(t,e)}catch(n){U("Module.instantiateWasm callback failed with error: "+n),P(n)}return Kt(z,M,t,r).catch(P),{}}function rt(t){for(;t.length>0;)t.shift()(i)}gt(M="i3s.wasm")||(M=zt(M));var G=[];function nt(t){var e=G[t];return e||(t>=G.length&&(G.length=t+1),G[t]=e=lt.get(t)),e}function Yt(t,e){nt(t)(e)}function te(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(e){p[this.ptr+4>>2]=e},this.get_type=function(){return p[this.ptr+4>>2]},this.set_destructor=function(e){p[this.ptr+8>>2]=e},this.get_destructor=function(){return p[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,j[this.ptr+12>>0]=e},this.get_caught=function(){return j[this.ptr+12>>0]!=0},this.set_rethrown=function(e){e=e?1:0,j[this.ptr+13>>0]=e},this.get_rethrown=function(){return j[this.ptr+13>>0]!=0},this.init=function(e,r){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(r)},this.set_adjusted_ptr=function(e){p[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return p[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Ut(this.get_type()))return p[this.excPtr>>2];var e=this.get_adjusted_ptr();return e!==0?e:this.excPtr}}function ee(t,e,r){throw new te(t).init(e,r),t}var X={};function wt(t){for(;t.length;){var e=t.pop();t.pop()(e)}}function Z(t){return this.fromWireType(F[t>>2])}var O={},S={},J={},re=48,ne=57;function ie(t){if(t===void 0)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=re&&e<=ne?"_"+t:t}function oe(t,e){return{[t=ie(t)]:function(){return e.apply(this,arguments)}}[t]}function it(t,e){var r=oe(e,function(n){this.name=e,this.message=n;var o=new Error(n).stack;o!==void 0&&(this.stack=this.toString()+` -`+o.replace(/^Error(:[^\n]*)?\n/,""))});return r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},r}var bt=void 0;function At(t){throw new bt(t)}function Tt(t,e,r){function n(a){var s=r(a);s.length!==t.length&&At("Mismatched type converter count");for(var f=0;f{S.hasOwnProperty(a)?o[s]=S[a]:(u.push(a),O.hasOwnProperty(a)||(O[a]=[]),O[a].push(()=>{o[s]=S[a],++c===u.length&&n(o)}))}),u.length===0&&n(o)}function ae(t){var e=X[t];delete X[t];var r=e.rawConstructor,n=e.rawDestructor,o=e.fields;Tt([t],o.map(u=>u.getterReturnType).concat(o.map(u=>u.setterArgumentType)),u=>{var c={};return o.forEach((a,s)=>{var f=a.fieldName,l=u[s],d=a.getter,C=a.getterContext,y=u[s+o.length],_=a.setter,W=a.setterContext;c[f]={read:w=>l.fromWireType(d(C,w)),write:(w,ut)=>{var Y=[];_(W,w,y.toWireType(Y,ut)),wt(Y)}}}),[{name:e.name,fromWireType:function(a){var s={};for(var f in c)s[f]=c[f].read(a);return n(a),s},toWireType:function(a,s){for(var f in c)if(!(f in s))throw new TypeError('Missing field: "'+f+'"');var l=r();for(f in c)c[f].write(l,s[f]);return a!==null&&a.push(n,l),l},argPackAdvance:8,readValueFromPointer:Z,destructorFunction:n}]})}function ue(t,e,r,n,o){}function ot(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}function ce(){for(var t=new Array(256),e=0;e<256;++e)t[e]=String.fromCharCode(e);Ct=t}var Ct=void 0;function h(t){for(var e="",r=t;v[r];)e+=Ct[v[r++]];return e}var Pt=void 0;function m(t){throw new Pt(t)}function A(t,e,r={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=e.name;if(t||m('type "'+n+'" must have a positive integer typeid pointer'),S.hasOwnProperty(t)){if(r.ignoreDuplicateRegistrations)return;m("Cannot register type '"+n+"' twice")}if(S[t]=e,delete J[t],O.hasOwnProperty(t)){var o=O[t];delete O[t],o.forEach(u=>u())}}function se(t,e,r,n,o){var u=ot(r);A(t,{name:e=h(e),fromWireType:function(c){return!!c},toWireType:function(c,a){return a?n:o},argPackAdvance:8,readValueFromPointer:function(c){var a;if(r===1)a=j;else if(r===2)a=I;else{if(r!==4)throw new TypeError("Unknown boolean type size: "+e);a=F}return this.fromWireType(a[c>>u])},destructorFunction:null})}function fe(){this.allocated=[void 0],this.freelist=[],this.get=function(t){return this.allocated[t]},this.allocate=function(t){let e=this.freelist.pop()||this.allocated.length;return this.allocated[e]=t,e},this.free=function(t){this.allocated[t]=void 0,this.freelist.push(t)}}var g=new fe;function Et(t){t>=g.reserved&&--g.get(t).refcount==0&&g.free(t)}function le(){for(var t=0,e=g.reserved;e(t||m("Cannot use deleted val. handle = "+t),g.get(t).value),toHandle:t=>{switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return g.allocate({refcount:1,value:t})}}};function pe(t,e){A(t,{name:e=h(e),fromWireType:function(r){var n=K.toValue(r);return Et(r),n},toWireType:function(r,n){return K.toHandle(n)},argPackAdvance:8,readValueFromPointer:Z,destructorFunction:null})}function ve(t,e){switch(e){case 2:return function(r){return this.fromWireType(st[r>>2])};case 3:return function(r){return this.fromWireType(ft[r>>3])};default:throw new TypeError("Unknown float type: "+t)}}function he(t,e,r){var n=ot(r);A(t,{name:e=h(e),fromWireType:function(o){return o},toWireType:function(o,u){return u},argPackAdvance:8,readValueFromPointer:ve(e,n),destructorFunction:null})}function me(t,e,r,n,o,u){var c=e.length;c<2&&m("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=e[1]!==null&&r!==null,s=!1,f=1;f>2]);return r}function we(t,e,r){i.hasOwnProperty(t)||At("Replacing nonexistant public symbol"),i[t].overloadTable!==void 0&&r!==void 0?i[t].overloadTable[r]=e:(i[t]=e,i[t].argCount=r)}function be(t,e,r){var n=i["dynCall_"+t];return r&&r.length?n.apply(null,[e].concat(r)):n.call(null,e)}function Ae(t,e,r){return t.includes("j")?be(t,e,r):nt(e).apply(null,r)}function Te(t,e){var r=[];return function(){return r.length=0,Object.assign(r,arguments),Ae(t,e,r)}}function B(t,e){function r(){return t.includes("j")?Te(t,e):nt(e)}t=h(t);var n=r();return typeof n!="function"&&m("unknown function pointer with signature "+t+": "+e),n}var Wt=void 0;function kt(t){var e=xt(t),r=h(e);return T(e),r}function Ce(t,e){var r=[],n={};function o(u){n[u]||S[u]||(J[u]?J[u].forEach(o):(r.push(u),n[u]=!0))}throw e.forEach(o),new Wt(t+": "+r.map(kt).join([", "]))}function Pe(t,e,r,n,o,u,c){var a=_e(e,r);t=h(t),o=B(n,o),ye(t,function(){Ce("Cannot call "+t+" due to unbound types",a)},e-1),Tt([],a,function(s){var f=[s[0],null].concat(s.slice(1));return we(t,me(t,f,null,o,u),e-1),[]})}function Ee(t,e,r){switch(e){case 0:return r?function(n){return j[n]}:function(n){return v[n]};case 1:return r?function(n){return I[n>>1]}:function(n){return L[n>>1]};case 2:return r?function(n){return F[n>>2]}:function(n){return p[n>>2]};default:throw new TypeError("Unknown integer type: "+t)}}function We(t,e,r,n,o){e=h(e);var u=ot(r),c=l=>l;if(n===0){var a=32-8*r;c=l=>l<>>a}var s=e.includes("unsigned"),f=(l,d)=>{};A(t,{name:e,fromWireType:c,toWireType:s?function(l,d){return f(d,this.name),d>>>0}:function(l,d){return f(d,this.name),d},argPackAdvance:8,readValueFromPointer:Ee(e,u,n!==0),destructorFunction:null})}function ke(t,e,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function o(u){var c=p,a=c[u>>=2],s=c[u+1];return new n(c.buffer,s,a)}A(t,{name:r=h(r),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})}function je(t,e,r,n){if(!(n>0))return 0;for(var o=r,u=r+n-1,c=0;c=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++c)),a<=127){if(r>=u)break;e[r++]=a}else if(a<=2047){if(r+1>=u)break;e[r++]=192|a>>6,e[r++]=128|63&a}else if(a<=65535){if(r+2>=u)break;e[r++]=224|a>>12,e[r++]=128|a>>6&63,e[r++]=128|63&a}else{if(r+3>=u)break;e[r++]=240|a>>18,e[r++]=128|a>>12&63,e[r++]=128|a>>6&63,e[r++]=128|63&a}}return e[r]=0,r-o}function Fe(t,e,r){return je(t,v,e,r)}function Re(t){for(var e=0,r=0;r=55296&&n<=57343?(e+=4,++r):e+=3}return e}var jt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Ft(t,e,r){for(var n=e+r,o=e;t[o]&&!(o>=n);)++o;if(o-e>16&&t.buffer&&jt)return jt.decode(t.subarray(e,o));for(var u="";e>10,56320|1023&f)}}else u+=String.fromCharCode((31&c)<<6|a)}else u+=String.fromCharCode(c)}return u}function Se(t,e){return t?Ft(v,t,e):""}function xe(t,e){var r=(e=h(e))==="std::string";A(t,{name:e,fromWireType:function(n){var o,u=p[n>>2],c=n+4;if(r)for(var a=c,s=0;s<=u;++s){var f=c+s;if(s==u||v[f]==0){var l=Se(a,f-a);o===void 0?o=l:(o+="\0",o+=l),a=f+1}}else{var d=new Array(u);for(s=0;s>2]=u,r&&c)Fe(o,s,u+1);else if(c)for(var f=0;f255&&(T(s),m("String has UTF-16 code units that do not fit in 8 bits")),v[s+f]=l}else for(f=0;f>1,o=n+e/2;!(n>=o)&&L[n];)++n;if((r=n<<1)-t>32&&Rt)return Rt.decode(v.subarray(t,r));for(var u="",c=0;!(c>=e/2);++c){var a=I[t+2*c>>1];if(a==0)break;u+=String.fromCharCode(a)}return u}function Ie(t,e,r){if(r===void 0&&(r=2147483647),r<2)return 0;for(var n=e,o=(r-=2)<2*t.length?r/2:t.length,u=0;u>1]=c,e+=2}return I[e>>1]=0,e-n}function Oe(t){return 2*t.length}function De(t,e){for(var r=0,n="";!(r>=e/4);){var o=F[t+4*r>>2];if(o==0)break;if(++r,o>=65536){var u=o-65536;n+=String.fromCharCode(55296|u>>10,56320|1023&u)}else n+=String.fromCharCode(o)}return n}function He(t,e,r){if(r===void 0&&(r=2147483647),r<4)return 0;for(var n=e,o=n+r-4,u=0;u=55296&&c<=57343&&(c=65536+((1023&c)<<10)|1023&t.charCodeAt(++u)),F[e>>2]=c,(e+=4)+4>o)break}return F[e>>2]=0,e-n}function ze(t){for(var e=0,r=0;r=55296&&n<=57343&&++r,e+=4}return e}function Ve(t,e,r){var n,o,u,c,a;r=h(r),e===2?(n=Ue,o=Ie,c=Oe,u=()=>L,a=1):e===4&&(n=De,o=He,c=ze,u=()=>p,a=2),A(t,{name:r,fromWireType:function(s){for(var f,l=p[s>>2],d=u(),C=s+4,y=0;y<=l;++y){var _=s+4+y*e;if(y==l||d[_>>a]==0){var W=n(C,_-C);f===void 0?f=W:(f+="\0",f+=W),C=_+e}}return T(s),f},toWireType:function(s,f){typeof f!="string"&&m("Cannot pass non-string to C++ string type "+r);var l=c(f),d=at(4+l+e);return p[d>>2]=l>>a,o(f,d+4,l+e),s!==null&&s.push(T,d),d},argPackAdvance:8,readValueFromPointer:Z,destructorFunction:function(s){T(s)}})}function Me(t,e,r,n,o,u){X[t]={name:h(e),rawConstructor:B(r,n),rawDestructor:B(o,u),fields:[]}}function Be(t,e,r,n,o,u,c,a,s,f){X[t].fields.push({fieldName:h(e),getterReturnType:r,getter:B(n,o),getterContext:u,setterArgumentType:c,setter:B(a,s),setterContext:f})}function qe(t,e){A(t,{isVoid:!0,name:e=h(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(r,n){}})}function Ne(t){t>4&&(g.get(t).refcount+=1)}var Le={};function $e(t){var e=Le[t];return e===void 0?h(t):e}function Ge(t){return K.toHandle($e(t))}function Xe(t,e){var r=S[t];return r===void 0&&m(e+" has unknown type "+kt(t)),r}function Ze(t,e){var r=(t=Xe(t,"_emval_take_value")).readValueFromPointer(e);return K.toHandle(r)}function Je(){$("")}function Ke(t,e,r){v.copyWithin(t,e,e+r)}function Qe(){return 2147483648}function Ye(t){var e=N.buffer;try{return N.grow(t-e.byteLength+65535>>>16),pt(),1}catch{}}function tr(t){var e=v.length;t>>>=0;var r=Qe();if(t>r)return!1;let n=(c,a)=>c+(a-c%a)%a;for(var o=1;o<=4;o*=2){var u=e*(1+.2/o);if(u=Math.min(u,t+100663296),Ye(Math.min(r,n(Math.max(t,u),65536))))return!0}return!1}function er(t){return 52}function rr(t,e,r,n,o){return 70}var nr=[null,[],[]];function ir(t,e){var r=nr[t];e===0||e===10?((t===1?Vt:U)(Ft(r,0)),r.length=0):r.push(e)}function or(t,e,r,n){for(var o=0,u=0;u>2],a=p[e+4>>2];e+=8;for(var s=0;s>2]=o,0}bt=i.InternalError=it(Error,"InternalError"),ce(),Pt=i.BindingError=it(Error,"BindingError"),de(),Wt=i.UnboundTypeError=it(Error,"UnboundTypeError");var St={__call_sighandler:Yt,__cxa_throw:ee,_embind_finalize_value_object:ae,_embind_register_bigint:ue,_embind_register_bool:se,_embind_register_emval:pe,_embind_register_float:he,_embind_register_function:Pe,_embind_register_integer:We,_embind_register_memory_view:ke,_embind_register_std_string:xe,_embind_register_std_wstring:Ve,_embind_register_value_object:Me,_embind_register_value_object_field:Be,_embind_register_void:qe,_emval_decref:Et,_emval_incref:Ne,_emval_new_cstring:Ge,_emval_take_value:Ze,abort:Je,emscripten_memcpy_big:Ke,emscripten_resize_heap:tr,fd_close:er,fd_seek:rr,fd_write:or};Qt();var at=function(){return(at=i.asm.malloc).apply(null,arguments)},T=function(){return(T=i.asm.free).apply(null,arguments)},xt=function(){return(xt=i.asm.__getTypeName).apply(null,arguments)};i.__embind_initialize_bindings=function(){return(i.__embind_initialize_bindings=i.asm._embind_initialize_bindings).apply(null,arguments)};var Q,Ut=function(){return(Ut=i.asm.__cxa_is_pointer_type).apply(null,arguments)};function It(){function t(){Q||(Q=!0,i.calledRun=!0,dt||(Bt(),H(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),qt()))}R>0||(Mt(),R>0||(i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("")},1),t()},1)):t()))}if(i.dynCall_vij=function(){return(i.dynCall_vij=i.asm.dynCall_vij).apply(null,arguments)},i.dynCall_jiji=function(){return(i.dynCall_jiji=i.asm.dynCall_jiji).apply(null,arguments)},V=function t(){Q||It(),Q||(V=t)},i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return It(),k.ready},Ot.exports=Dt;var Ht=tt.exports;const fr=cr({__proto__:null,default:ur(Ht)},[Ht]);export{fr as i}; +import{aR as ur}from"./index-pCX-0tJH.js";function cr(k,H){for(var P=0;Pi[E]})}}}return Object.freeze(Object.defineProperty(k,Symbol.toStringTag,{value:"Module"}))}var Ot,ct,Dt,tt={exports:{}};tt.exports,Ot=tt,tt.exports,ct=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,Dt=function(k={}){var H,P,i=k!==void 0?k:{};i.ready=new Promise((t,e)=>{H=t,P=e});var E=Object.assign({},i),x=typeof window=="object",q=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&process.versions.node;var et,b="";function zt(t){return i.locateFile?i.locateFile(t,b):b+t}(x||q)&&(q?b=self.location.href:typeof document<"u"&&document.currentScript&&(b=document.currentScript.src),ct&&(b=ct),b=b.indexOf("blob:")!==0?b.substr(0,b.replace(/[?#].*/,"").lastIndexOf("/")+1):"",q&&(et=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}));var z,N,Vt=i.print||console.log.bind(console),U=i.printErr||console.warn.bind(console);Object.assign(i,E),E=null,i.arguments&&i.arguments,i.thisProgram&&i.thisProgram,i.quit&&i.quit,i.wasmBinary&&(z=i.wasmBinary),i.noExitRuntime,typeof WebAssembly!="object"&&$("no native wasm support detected");var j,v,I,L,R,p,st,ft,lt,dt=!1;function pt(){var t=N.buffer;i.HEAP8=j=new Int8Array(t),i.HEAP16=I=new Int16Array(t),i.HEAP32=R=new Int32Array(t),i.HEAPU8=v=new Uint8Array(t),i.HEAPU16=L=new Uint16Array(t),i.HEAPU32=p=new Uint32Array(t),i.HEAPF32=st=new Float32Array(t),i.HEAPF64=ft=new Float64Array(t)}var vt=[],ht=[],mt=[];function Mt(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)Nt(i.preRun.shift());rt(vt)}function Bt(){rt(ht)}function qt(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)$t(i.postRun.shift());rt(mt)}function Nt(t){vt.unshift(t)}function Lt(t){ht.unshift(t)}function $t(t){mt.unshift(t)}var F=0,V=null;function Gt(t){F++,i.monitorRunDependencies&&i.monitorRunDependencies(F)}function Xt(t){if(F--,i.monitorRunDependencies&&i.monitorRunDependencies(F),F==0&&V){var e=V;V=null,e()}}function $(t){i.onAbort&&i.onAbort(t),U(t="Aborted("+t+")"),dt=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw P(e),e}var M,Zt="data:application/octet-stream;base64,";function gt(t){return t.startsWith(Zt)}function yt(t){try{if(t==M&&z)return new Uint8Array(z);if(et)return et(t);throw"both async and sync fetching of the wasm failed"}catch(e){$(e)}}function Jt(t){return z||!x&&!q||typeof fetch!="function"?Promise.resolve().then(()=>yt(t)):fetch(t,{credentials:"same-origin"}).then(e=>{if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()}).catch(()=>yt(t))}function _t(t,e,r){return Jt(t).then(n=>WebAssembly.instantiate(n,e)).then(n=>n).then(r,n=>{U("failed to asynchronously prepare wasm: "+n),$(n)})}function Kt(t,e,r,n){return t||typeof WebAssembly.instantiateStreaming!="function"||gt(e)||typeof fetch!="function"?_t(e,r,n):fetch(e,{credentials:"same-origin"}).then(o=>WebAssembly.instantiateStreaming(o,r).then(n,function(u){return U("wasm streaming compile failed: "+u),U("falling back to ArrayBuffer instantiation"),_t(e,r,n)}))}function Qt(){var t={env:St,wasi_snapshot_preview1:St};function e(n,o){var u=n.exports;return i.asm=u,N=i.asm.memory,pt(),lt=i.asm.__indirect_function_table,Lt(i.asm.__wasm_call_ctors),Xt(),u}function r(n){e(n.instance)}if(Gt(),i.instantiateWasm)try{return i.instantiateWasm(t,e)}catch(n){U("Module.instantiateWasm callback failed with error: "+n),P(n)}return Kt(z,M,t,r).catch(P),{}}function rt(t){for(;t.length>0;)t.shift()(i)}gt(M="i3s.wasm")||(M=zt(M));var G=[];function nt(t){var e=G[t];return e||(t>=G.length&&(G.length=t+1),G[t]=e=lt.get(t)),e}function Yt(t,e){nt(t)(e)}function te(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(e){p[this.ptr+4>>2]=e},this.get_type=function(){return p[this.ptr+4>>2]},this.set_destructor=function(e){p[this.ptr+8>>2]=e},this.get_destructor=function(){return p[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,j[this.ptr+12>>0]=e},this.get_caught=function(){return j[this.ptr+12>>0]!=0},this.set_rethrown=function(e){e=e?1:0,j[this.ptr+13>>0]=e},this.get_rethrown=function(){return j[this.ptr+13>>0]!=0},this.init=function(e,r){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(r)},this.set_adjusted_ptr=function(e){p[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return p[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Ut(this.get_type()))return p[this.excPtr>>2];var e=this.get_adjusted_ptr();return e!==0?e:this.excPtr}}function ee(t,e,r){throw new te(t).init(e,r),t}var X={};function wt(t){for(;t.length;){var e=t.pop();t.pop()(e)}}function Z(t){return this.fromWireType(R[t>>2])}var O={},S={},J={},re=48,ne=57;function ie(t){if(t===void 0)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=re&&e<=ne?"_"+t:t}function oe(t,e){return{[t=ie(t)]:function(){return e.apply(this,arguments)}}[t]}function it(t,e){var r=oe(e,function(n){this.name=e,this.message=n;var o=new Error(n).stack;o!==void 0&&(this.stack=this.toString()+` +`+o.replace(/^Error(:[^\n]*)?\n/,""))});return r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},r}var bt=void 0;function At(t){throw new bt(t)}function Tt(t,e,r){function n(a){var s=r(a);s.length!==t.length&&At("Mismatched type converter count");for(var f=0;f{S.hasOwnProperty(a)?o[s]=S[a]:(u.push(a),O.hasOwnProperty(a)||(O[a]=[]),O[a].push(()=>{o[s]=S[a],++c===u.length&&n(o)}))}),u.length===0&&n(o)}function ae(t){var e=X[t];delete X[t];var r=e.rawConstructor,n=e.rawDestructor,o=e.fields;Tt([t],o.map(u=>u.getterReturnType).concat(o.map(u=>u.setterArgumentType)),u=>{var c={};return o.forEach((a,s)=>{var f=a.fieldName,l=u[s],d=a.getter,C=a.getterContext,y=u[s+o.length],_=a.setter,W=a.setterContext;c[f]={read:w=>l.fromWireType(d(C,w)),write:(w,ut)=>{var Y=[];_(W,w,y.toWireType(Y,ut)),wt(Y)}}}),[{name:e.name,fromWireType:function(a){var s={};for(var f in c)s[f]=c[f].read(a);return n(a),s},toWireType:function(a,s){for(var f in c)if(!(f in s))throw new TypeError('Missing field: "'+f+'"');var l=r();for(f in c)c[f].write(l,s[f]);return a!==null&&a.push(n,l),l},argPackAdvance:8,readValueFromPointer:Z,destructorFunction:n}]})}function ue(t,e,r,n,o){}function ot(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}function ce(){for(var t=new Array(256),e=0;e<256;++e)t[e]=String.fromCharCode(e);Ct=t}var Ct=void 0;function h(t){for(var e="",r=t;v[r];)e+=Ct[v[r++]];return e}var Pt=void 0;function m(t){throw new Pt(t)}function A(t,e,r={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=e.name;if(t||m('type "'+n+'" must have a positive integer typeid pointer'),S.hasOwnProperty(t)){if(r.ignoreDuplicateRegistrations)return;m("Cannot register type '"+n+"' twice")}if(S[t]=e,delete J[t],O.hasOwnProperty(t)){var o=O[t];delete O[t],o.forEach(u=>u())}}function se(t,e,r,n,o){var u=ot(r);A(t,{name:e=h(e),fromWireType:function(c){return!!c},toWireType:function(c,a){return a?n:o},argPackAdvance:8,readValueFromPointer:function(c){var a;if(r===1)a=j;else if(r===2)a=I;else{if(r!==4)throw new TypeError("Unknown boolean type size: "+e);a=R}return this.fromWireType(a[c>>u])},destructorFunction:null})}function fe(){this.allocated=[void 0],this.freelist=[],this.get=function(t){return this.allocated[t]},this.allocate=function(t){let e=this.freelist.pop()||this.allocated.length;return this.allocated[e]=t,e},this.free=function(t){this.allocated[t]=void 0,this.freelist.push(t)}}var g=new fe;function Et(t){t>=g.reserved&&--g.get(t).refcount==0&&g.free(t)}function le(){for(var t=0,e=g.reserved;e(t||m("Cannot use deleted val. handle = "+t),g.get(t).value),toHandle:t=>{switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return g.allocate({refcount:1,value:t})}}};function pe(t,e){A(t,{name:e=h(e),fromWireType:function(r){var n=K.toValue(r);return Et(r),n},toWireType:function(r,n){return K.toHandle(n)},argPackAdvance:8,readValueFromPointer:Z,destructorFunction:null})}function ve(t,e){switch(e){case 2:return function(r){return this.fromWireType(st[r>>2])};case 3:return function(r){return this.fromWireType(ft[r>>3])};default:throw new TypeError("Unknown float type: "+t)}}function he(t,e,r){var n=ot(r);A(t,{name:e=h(e),fromWireType:function(o){return o},toWireType:function(o,u){return u},argPackAdvance:8,readValueFromPointer:ve(e,n),destructorFunction:null})}function me(t,e,r,n,o,u){var c=e.length;c<2&&m("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=e[1]!==null&&r!==null,s=!1,f=1;f>2]);return r}function we(t,e,r){i.hasOwnProperty(t)||At("Replacing nonexistant public symbol"),i[t].overloadTable!==void 0&&r!==void 0?i[t].overloadTable[r]=e:(i[t]=e,i[t].argCount=r)}function be(t,e,r){var n=i["dynCall_"+t];return r&&r.length?n.apply(null,[e].concat(r)):n.call(null,e)}function Ae(t,e,r){return t.includes("j")?be(t,e,r):nt(e).apply(null,r)}function Te(t,e){var r=[];return function(){return r.length=0,Object.assign(r,arguments),Ae(t,e,r)}}function B(t,e){function r(){return t.includes("j")?Te(t,e):nt(e)}t=h(t);var n=r();return typeof n!="function"&&m("unknown function pointer with signature "+t+": "+e),n}var Wt=void 0;function kt(t){var e=xt(t),r=h(e);return T(e),r}function Ce(t,e){var r=[],n={};function o(u){n[u]||S[u]||(J[u]?J[u].forEach(o):(r.push(u),n[u]=!0))}throw e.forEach(o),new Wt(t+": "+r.map(kt).join([", "]))}function Pe(t,e,r,n,o,u,c){var a=_e(e,r);t=h(t),o=B(n,o),ye(t,function(){Ce("Cannot call "+t+" due to unbound types",a)},e-1),Tt([],a,function(s){var f=[s[0],null].concat(s.slice(1));return we(t,me(t,f,null,o,u),e-1),[]})}function Ee(t,e,r){switch(e){case 0:return r?function(n){return j[n]}:function(n){return v[n]};case 1:return r?function(n){return I[n>>1]}:function(n){return L[n>>1]};case 2:return r?function(n){return R[n>>2]}:function(n){return p[n>>2]};default:throw new TypeError("Unknown integer type: "+t)}}function We(t,e,r,n,o){e=h(e);var u=ot(r),c=l=>l;if(n===0){var a=32-8*r;c=l=>l<>>a}var s=e.includes("unsigned"),f=(l,d)=>{};A(t,{name:e,fromWireType:c,toWireType:s?function(l,d){return f(d,this.name),d>>>0}:function(l,d){return f(d,this.name),d},argPackAdvance:8,readValueFromPointer:Ee(e,u,n!==0),destructorFunction:null})}function ke(t,e,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function o(u){var c=p,a=c[u>>=2],s=c[u+1];return new n(c.buffer,s,a)}A(t,{name:r=h(r),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})}function je(t,e,r,n){if(!(n>0))return 0;for(var o=r,u=r+n-1,c=0;c=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++c)),a<=127){if(r>=u)break;e[r++]=a}else if(a<=2047){if(r+1>=u)break;e[r++]=192|a>>6,e[r++]=128|63&a}else if(a<=65535){if(r+2>=u)break;e[r++]=224|a>>12,e[r++]=128|a>>6&63,e[r++]=128|63&a}else{if(r+3>=u)break;e[r++]=240|a>>18,e[r++]=128|a>>12&63,e[r++]=128|a>>6&63,e[r++]=128|63&a}}return e[r]=0,r-o}function Re(t,e,r){return je(t,v,e,r)}function Fe(t){for(var e=0,r=0;r=55296&&n<=57343?(e+=4,++r):e+=3}return e}var jt=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Rt(t,e,r){for(var n=e+r,o=e;t[o]&&!(o>=n);)++o;if(o-e>16&&t.buffer&&jt)return jt.decode(t.subarray(e,o));for(var u="";e>10,56320|1023&f)}}else u+=String.fromCharCode((31&c)<<6|a)}else u+=String.fromCharCode(c)}return u}function Se(t,e){return t?Rt(v,t,e):""}function xe(t,e){var r=(e=h(e))==="std::string";A(t,{name:e,fromWireType:function(n){var o,u=p[n>>2],c=n+4;if(r)for(var a=c,s=0;s<=u;++s){var f=c+s;if(s==u||v[f]==0){var l=Se(a,f-a);o===void 0?o=l:(o+="\0",o+=l),a=f+1}}else{var d=new Array(u);for(s=0;s>2]=u,r&&c)Re(o,s,u+1);else if(c)for(var f=0;f255&&(T(s),m("String has UTF-16 code units that do not fit in 8 bits")),v[s+f]=l}else for(f=0;f>1,o=n+e/2;!(n>=o)&&L[n];)++n;if((r=n<<1)-t>32&&Ft)return Ft.decode(v.subarray(t,r));for(var u="",c=0;!(c>=e/2);++c){var a=I[t+2*c>>1];if(a==0)break;u+=String.fromCharCode(a)}return u}function Ie(t,e,r){if(r===void 0&&(r=2147483647),r<2)return 0;for(var n=e,o=(r-=2)<2*t.length?r/2:t.length,u=0;u>1]=c,e+=2}return I[e>>1]=0,e-n}function Oe(t){return 2*t.length}function De(t,e){for(var r=0,n="";!(r>=e/4);){var o=R[t+4*r>>2];if(o==0)break;if(++r,o>=65536){var u=o-65536;n+=String.fromCharCode(55296|u>>10,56320|1023&u)}else n+=String.fromCharCode(o)}return n}function He(t,e,r){if(r===void 0&&(r=2147483647),r<4)return 0;for(var n=e,o=n+r-4,u=0;u=55296&&c<=57343&&(c=65536+((1023&c)<<10)|1023&t.charCodeAt(++u)),R[e>>2]=c,(e+=4)+4>o)break}return R[e>>2]=0,e-n}function ze(t){for(var e=0,r=0;r=55296&&n<=57343&&++r,e+=4}return e}function Ve(t,e,r){var n,o,u,c,a;r=h(r),e===2?(n=Ue,o=Ie,c=Oe,u=()=>L,a=1):e===4&&(n=De,o=He,c=ze,u=()=>p,a=2),A(t,{name:r,fromWireType:function(s){for(var f,l=p[s>>2],d=u(),C=s+4,y=0;y<=l;++y){var _=s+4+y*e;if(y==l||d[_>>a]==0){var W=n(C,_-C);f===void 0?f=W:(f+="\0",f+=W),C=_+e}}return T(s),f},toWireType:function(s,f){typeof f!="string"&&m("Cannot pass non-string to C++ string type "+r);var l=c(f),d=at(4+l+e);return p[d>>2]=l>>a,o(f,d+4,l+e),s!==null&&s.push(T,d),d},argPackAdvance:8,readValueFromPointer:Z,destructorFunction:function(s){T(s)}})}function Me(t,e,r,n,o,u){X[t]={name:h(e),rawConstructor:B(r,n),rawDestructor:B(o,u),fields:[]}}function Be(t,e,r,n,o,u,c,a,s,f){X[t].fields.push({fieldName:h(e),getterReturnType:r,getter:B(n,o),getterContext:u,setterArgumentType:c,setter:B(a,s),setterContext:f})}function qe(t,e){A(t,{isVoid:!0,name:e=h(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(r,n){}})}function Ne(t){t>4&&(g.get(t).refcount+=1)}var Le={};function $e(t){var e=Le[t];return e===void 0?h(t):e}function Ge(t){return K.toHandle($e(t))}function Xe(t,e){var r=S[t];return r===void 0&&m(e+" has unknown type "+kt(t)),r}function Ze(t,e){var r=(t=Xe(t,"_emval_take_value")).readValueFromPointer(e);return K.toHandle(r)}function Je(){$("")}function Ke(t,e,r){v.copyWithin(t,e,e+r)}function Qe(){return 2147483648}function Ye(t){var e=N.buffer;try{return N.grow(t-e.byteLength+65535>>>16),pt(),1}catch{}}function tr(t){var e=v.length;t>>>=0;var r=Qe();if(t>r)return!1;let n=(c,a)=>c+(a-c%a)%a;for(var o=1;o<=4;o*=2){var u=e*(1+.2/o);if(u=Math.min(u,t+100663296),Ye(Math.min(r,n(Math.max(t,u),65536))))return!0}return!1}function er(t){return 52}function rr(t,e,r,n,o){return 70}var nr=[null,[],[]];function ir(t,e){var r=nr[t];e===0||e===10?((t===1?Vt:U)(Rt(r,0)),r.length=0):r.push(e)}function or(t,e,r,n){for(var o=0,u=0;u>2],a=p[e+4>>2];e+=8;for(var s=0;s>2]=o,0}bt=i.InternalError=it(Error,"InternalError"),ce(),Pt=i.BindingError=it(Error,"BindingError"),de(),Wt=i.UnboundTypeError=it(Error,"UnboundTypeError");var St={__call_sighandler:Yt,__cxa_throw:ee,_embind_finalize_value_object:ae,_embind_register_bigint:ue,_embind_register_bool:se,_embind_register_emval:pe,_embind_register_float:he,_embind_register_function:Pe,_embind_register_integer:We,_embind_register_memory_view:ke,_embind_register_std_string:xe,_embind_register_std_wstring:Ve,_embind_register_value_object:Me,_embind_register_value_object_field:Be,_embind_register_void:qe,_emval_decref:Et,_emval_incref:Ne,_emval_new_cstring:Ge,_emval_take_value:Ze,abort:Je,emscripten_memcpy_big:Ke,emscripten_resize_heap:tr,fd_close:er,fd_seek:rr,fd_write:or};Qt();var at=function(){return(at=i.asm.malloc).apply(null,arguments)},T=function(){return(T=i.asm.free).apply(null,arguments)},xt=function(){return(xt=i.asm.__getTypeName).apply(null,arguments)};i.__embind_initialize_bindings=function(){return(i.__embind_initialize_bindings=i.asm._embind_initialize_bindings).apply(null,arguments)};var Q,Ut=function(){return(Ut=i.asm.__cxa_is_pointer_type).apply(null,arguments)};function It(){function t(){Q||(Q=!0,i.calledRun=!0,dt||(Bt(),H(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),qt()))}F>0||(Mt(),F>0||(i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("")},1),t()},1)):t()))}if(i.dynCall_vij=function(){return(i.dynCall_vij=i.asm.dynCall_vij).apply(null,arguments)},i.dynCall_jiji=function(){return(i.dynCall_jiji=i.asm.dynCall_jiji).apply(null,arguments)},V=function t(){Q||It(),Q||(V=t)},i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return It(),k.ready},Ot.exports=Dt;var Ht=tt.exports;const fr=cr({__proto__:null,default:ur(Ht)},[Ht]);export{fr as i}; diff --git a/dist/assets/icon-ZwpY5ksA.js b/dist/assets/icon-BW6RCrUr.js similarity index 73% rename from dist/assets/icon-ZwpY5ksA.js rename to dist/assets/icon-BW6RCrUr.js index be343ff..e7741e0 100644 --- a/dist/assets/icon-ZwpY5ksA.js +++ b/dist/assets/icon-BW6RCrUr.js @@ -1,5 +1,5 @@ -import{q as f,H as m,ch as b,t as h,v as x,x as g,ci as v}from"./index-J0iiHjMT.js";import{c as z}from"./observers-JyBmMU24.js";/*! +import{p as f,H as m,aS as b,k as h,t as x,l as g,aT as v}from"./index-pCX-0tJH.js";import{c as z}from"./observers-eNe735aq.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const y={icon:"icon",flipRtl:"flip-rtl"},p={},d={},u={s:16,m:24,l:32};async function C({icon:t,scale:e}){const s=u[e],n=w(t),c=n.charAt(n.length-1)==="F",i=`${c?n.substring(0,n.length-1):n}${s}${c?"F":""}`;if(p[i])return p[i];d[i]||(d[i]=fetch(v(`./assets/icon/${i}.json`)).then(r=>r.json()).catch(()=>(console.error(`"${i}" is not a valid calcite-ui-icon name`),"")));const o=await d[i];return p[i]=o,o}function w(t){const e=!isNaN(Number(t.charAt(0))),s=t.split("-");if(s.length>0){const c=/[a-z]/i;t=s.map((l,i)=>l.replace(c,function(r,a){return i===0&&a===0?r:r.toUpperCase()})).join("")}return e?`i${t}`:t}const D=":host{display:inline-flex;color:var(--calcite-ui-icon-color)}:host([scale=s]){inline-size:16px;block-size:16px;min-inline-size:16px;min-block-size:16px}:host([scale=m]){inline-size:24px;block-size:24px;min-inline-size:24px;min-block-size:24px}:host([scale=l]){inline-size:32px;block-size:32px;min-inline-size:32px;min-block-size:32px}.flip-rtl{transform:scaleX(-1)}.svg{display:block}:host([hidden]){display:none}[hidden]{display:none}",I=f(class extends m{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.icon=null,this.flipRtl=!1,this.scale="m",this.textLabel=void 0,this.pathData=void 0,this.visible=!1}connectedCallback(){this.waitUntilVisible(()=>{this.visible=!0,this.loadIconPathData()})}disconnectedCallback(){var t;(t=this.intersectionObserver)==null||t.disconnect(),this.intersectionObserver=null}async componentWillLoad(){this.loadIconPathData()}render(){const{el:t,flipRtl:e,pathData:s,scale:n,textLabel:c}=this,l=b(t),i=u[n],o=!!c,r=[].concat(s||"");return h(g,{"aria-hidden":x(!o),"aria-label":o?c:null,role:o?"img":null},h("svg",{"aria-hidden":"true",class:{[y.flipRtl]:l==="rtl"&&e,svg:!0},fill:"currentColor",height:"100%",viewBox:`0 0 ${i} ${i}`,width:"100%",xmlns:"http://www.w3.org/2000/svg"},r.map(a=>typeof a=="string"?h("path",{d:a}):h("path",{d:a.d,opacity:"opacity"in a?a.opacity:1}))))}async loadIconPathData(){const{icon:t,scale:e,visible:s}=this;if(!t||!s)return;const n=await C({icon:t,scale:e});t===this.icon&&(this.pathData=n)}waitUntilVisible(t){if(this.intersectionObserver=z("intersection",e=>{e.forEach(s=>{s.isIntersecting&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null,t())})},{rootMargin:"50px"}),!this.intersectionObserver){t();return}this.intersectionObserver.observe(this.el)}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{icon:["loadIconPathData"],scale:["loadIconPathData"]}}static get style(){return D}},[1,"calcite-icon",{icon:[513],flipRtl:[516,"flip-rtl"],scale:[513],textLabel:[1,"text-label"],pathData:[32],visible:[32]}]);function k(){if(typeof customElements>"u")return;["calcite-icon"].forEach(e=>{switch(e){case"calcite-icon":customElements.get(e)||customElements.define(e,I);break}})}k();export{I,k as d}; + */const y={icon:"icon",flipRtl:"flip-rtl"},p={},d={},u={s:16,m:24,l:32};async function C({icon:t,scale:e}){const s=u[e],n=w(t),o=n.charAt(n.length-1)==="F",i=`${o?n.substring(0,n.length-1):n}${s}${o?"F":""}`;if(p[i])return p[i];d[i]||(d[i]=fetch(v(`./assets/icon/${i}.json`)).then(r=>r.json()).catch(()=>(console.error(`"${i}" is not a valid calcite-ui-icon name`),"")));const a=await d[i];return p[i]=a,a}function w(t){const e=!isNaN(Number(t.charAt(0))),s=t.split("-");if(s.length>0){const o=/[a-z]/i;t=s.map((l,i)=>l.replace(o,function(r,c){return i===0&&c===0?r:r.toUpperCase()})).join("")}return e?`i${t}`:t}const D=":host{display:inline-flex;color:var(--calcite-ui-icon-color)}:host([scale=s]){inline-size:16px;block-size:16px;min-inline-size:16px;min-block-size:16px}:host([scale=m]){inline-size:24px;block-size:24px;min-inline-size:24px;min-block-size:24px}:host([scale=l]){inline-size:32px;block-size:32px;min-inline-size:32px;min-block-size:32px}.flip-rtl{transform:scaleX(-1)}.svg{display:block}:host([hidden]){display:none}[hidden]{display:none}",I=f(class extends m{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.icon=null,this.flipRtl=!1,this.scale="m",this.textLabel=void 0,this.pathData=void 0,this.visible=!1}connectedCallback(){this.waitUntilVisible(()=>{this.visible=!0,this.loadIconPathData()})}disconnectedCallback(){var t;(t=this.intersectionObserver)==null||t.disconnect(),this.intersectionObserver=null}async componentWillLoad(){this.loadIconPathData()}render(){const{el:t,flipRtl:e,pathData:s,scale:n,textLabel:o}=this,l=b(t),i=u[n],a=!!o,r=[].concat(s||"");return h(g,{"aria-hidden":x(!a),"aria-label":a?o:null,role:a?"img":null},h("svg",{"aria-hidden":"true",class:{[y.flipRtl]:l==="rtl"&&e,svg:!0},fill:"currentColor",height:"100%",viewBox:`0 0 ${i} ${i}`,width:"100%",xmlns:"http://www.w3.org/2000/svg"},r.map(c=>typeof c=="string"?h("path",{d:c}):h("path",{d:c.d,opacity:"opacity"in c?c.opacity:1}))))}async loadIconPathData(){const{icon:t,scale:e,visible:s}=this;if(!t||!s)return;const n=await C({icon:t,scale:e});t===this.icon&&(this.pathData=n)}waitUntilVisible(t){if(this.intersectionObserver=z("intersection",e=>{e.forEach(s=>{s.isIntersecting&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null,t())})},{rootMargin:"50px"}),!this.intersectionObserver){t();return}this.intersectionObserver.observe(this.el)}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{icon:["loadIconPathData"],scale:["loadIconPathData"]}}static get style(){return D}},[1,"calcite-icon",{icon:[513],flipRtl:[516,"flip-rtl"],scale:[513],textLabel:[1,"text-label"],pathData:[32],visible:[32]}]);function k(){if(typeof customElements>"u")return;["calcite-icon"].forEach(e=>{switch(e){case"calcite-icon":customElements.get(e)||customElements.define(e,I);break}})}k();export{I,k as d}; diff --git a/dist/assets/imageryUtils-UiAX5Jos.js b/dist/assets/imageryUtils-UiAX5Jos.js new file mode 100644 index 0000000..808ec5b --- /dev/null +++ b/dist/assets/imageryUtils-UiAX5Jos.js @@ -0,0 +1 @@ +import{I as n,b as m}from"./utils-YxtTVBu2.js";import{gZ as o,i as c,f as p}from"./index-pCX-0tJH.js";import"./jsonContext-EgdQULbU.js";const i="Image Service",u="imagery-layer-save",g="imagery-layer-save-as",f="imagery-tile-layer-save",v="imagery-tile-layer-save-as";function s(r){var t;if(r.type==="imagery")return{isValid:!0};const{raster:e}=r,a=(e==null?void 0:e.datasetFormat)==="Function"?(t=e.primaryRasters)==null?void 0:t.rasters[0]:e;return{isValid:(a==null?void 0:a.datasetFormat)==="RasterTileServer"&&(a.tileType==="Raster"||a.tileType==="Map"),errorMessage:"imagery tile layer should be created from a tiled image service."}}function l(r){const e=r.layerJSON;return Promise.resolve(e&&Object.keys(e).length?e:null)}async function d(r,e){const{parsedUrl:a,title:t,fullExtent:y}=r;e.url=a.path,e.title||(e.title=t),e.extent=await o(y),r.type==="imagery-tile"&&c(e,p.TILED_IMAGERY)}async function P(r,e){const a=r.type==="imagery"?u:f;return n({layer:r,itemType:i,validateLayer:s,createItemData:l,errorNamePrefix:a},e)}async function R(r,e,a){const t=r.type==="imagery"?g:v;return m({layer:r,itemType:i,validateLayer:s,createItemData:l,errorNamePrefix:t,newItem:e,setItemProperties:d},a)}export{P as save,R as saveAs}; diff --git a/dist/assets/imageryUtils-djrWgZtb.js b/dist/assets/imageryUtils-djrWgZtb.js deleted file mode 100644 index fdd20f1..0000000 --- a/dist/assets/imageryUtils-djrWgZtb.js +++ /dev/null @@ -1 +0,0 @@ -import{I as n,b as m}from"./utils-rBsg-VY8.js";import{h0 as o,i as c,h as p}from"./index-J0iiHjMT.js";import"./jsonContext-cWV_-jAj.js";const i="Image Service",u="imagery-layer-save",g="imagery-layer-save-as",f="imagery-tile-layer-save",v="imagery-tile-layer-save-as";function s(a){var t;if(a.type==="imagery")return{isValid:!0};const{raster:e}=a,r=(e==null?void 0:e.datasetFormat)==="Function"?(t=e.primaryRasters)==null?void 0:t.rasters[0]:e;return{isValid:(r==null?void 0:r.datasetFormat)==="RasterTileServer"&&(r.tileType==="Raster"||r.tileType==="Map"),errorMessage:"imagery tile layer should be created from a tiled image service."}}function l(a){const e=a.layerJSON;return Promise.resolve(e&&Object.keys(e).length?e:null)}async function d(a,e){const{parsedUrl:r,title:t,fullExtent:y}=a;e.url=r.path,e.title||(e.title=t),e.extent=await o(y),a.type==="imagery-tile"&&c(e,p.TILED_IMAGERY)}async function x(a,e){const r=a.type==="imagery"?u:f;return n({layer:a,itemType:i,validateLayer:s,createItemData:l,errorNamePrefix:r},e)}async function P(a,e,r){const t=a.type==="imagery"?g:v;return m({layer:a,itemType:i,validateLayer:s,createItemData:l,errorNamePrefix:t,newItem:e,setItemProperties:d},r)}export{x as save,P as saveAs}; diff --git a/dist/assets/index-PpMPqKeV.css b/dist/assets/index-4b4radwv.css similarity index 87% rename from dist/assets/index-PpMPqKeV.css rename to dist/assets/index-4b4radwv.css index 9e0dd83..919e07d 100644 --- a/dist/assets/index-PpMPqKeV.css +++ b/dist/assets/index-4b4radwv.css @@ -1 +1 @@ -@import"https://js.arcgis.com/4.28/@arcgis/core/assets/esri/themes/light/main.css";@import"https://js.arcgis.com/calcite-components/1.11.0/calcite.css";html,body,#viewDiv{padding:0;margin:0;height:100%;width:100%;overflow-y:hidden;font-family:Avenir Next W00,Helvetica Neue,Helvetica,Arial,sans-serif;--calcite-ui-brand: #648880;--calcite-ui-brand-hover: #648880;--calcite-ui-brand-press: #648880}body{display:flex}.esri-view .esri-view-surface--touch-none:focus:after{outline:none!important}#header{display:flex;justify-content:space-between;align-items:center}#header-title{margin-left:1rem;margin-right:1rem;color:#fff}table{margin:1em 0}.center{text-align:center}#sketchPanel{width:300px;padding:10px;background-color:#fffc}.esri-button{margin:2px}#configurationDiv{padding:10px;text-align:left;width:250px}#configurationInfoDiv{padding:7px;text-align:left}#snappingctrlkey{display:inline}#actionbuttons,#edgeoperationbuttons{display:none}.update-options{display:flex;flex-direction:row}.edge-button,.shape-button{flex:1;border-style:solid;border-width:1px;border-image:none}.edge-button-selected,.shape-button-selected{background:#4c4c4c;color:#fff}#topbar{background:#fff;padding:10px}.action-button{font-size:16px;background-color:transparent;border:1px solid #d3d3d3;color:#6e6e6e;height:32px;width:32px;text-align:center;box-shadow:0 0 1px #0000004d}.action-button:hover,.action-button:focus{background:#0079c1;color:#e4e4e4}.active{background:#0079c1;color:#e4e4e4}.hide{display:none}img{border:10px solid white;box-shadow:2px 2px 5px #00000080}.action-button2{padding:.6em;border:1px solid #0079c1;text-align:center;background-color:#fff;cursor:pointer}.action-button2:hover,.action-button2:focus{background:#0079c1;color:#fff}#maskDiv{position:absolute;background:#ff33001a;border:2px dashed rgb(255,51,0)}.shadowcast-button{border:0}.button-container{margin:5px 0;text-align:left}#opacitySliderContainer{text-align:center;padding:1em;margin-bottom:20px}#opacity{margin-bottom:.5em}#opacitySlider{margin:.5em 2em}#elevationInput,#navigationUnderground{margin-left:.5em}#calcite-shell{background:#32774e;background:linear-gradient(to right bottom,#648880,#32774e)}#information-panel{padding:.25em}#in-ads-container{margin-left:1rem;margin-right:1rem;width:350px}.esri-component.esri-coordinate-conversion.esri-widget{width:350px;font-size:11px;background-color:#fffc}.esri-coordinate-conversion__row{padding:0 5px}#elevationModels,#navigationUnderground,#elevationInput{padding:.25em}#daylight-container,#shadowcast-container,#sketchPanel{width:100%;height:100%}.responsive-action-bar{flex-wrap:wrap}#layers-container,#wms-layers-container{overflow-y:auto;display:block;height:50vh} +@import"https://js.arcgis.com/4.28/@arcgis/core/assets/esri/themes/light/main.css";@import"https://js.arcgis.com/calcite-components/1.11.0/calcite.css";html,body,#viewDiv{padding:0;margin:0;height:100%;width:100%;overflow-y:hidden;font-family:Avenir Next W00,Helvetica Neue,Helvetica,Arial,sans-serif;--calcite-ui-brand: #648880;--calcite-ui-brand-hover: #648880;--calcite-ui-brand-press: #648880}body{display:flex}.esri-view .esri-view-surface--touch-none:focus:after{outline:none!important}#header{display:flex;justify-content:space-between;align-items:center}#header-title{margin-left:1rem;margin-right:1rem;color:#fff}table{margin:1em 0}.center{text-align:center}#sketchPanel{width:300px;padding:10px;background-color:#fffc}.esri-button{margin:2px}#configurationDiv{padding:10px;text-align:left;width:250px}#configurationInfoDiv{padding:7px;text-align:left}#snappingctrlkey{display:inline}#actionbuttons,#edgeoperationbuttons{display:none}.update-options{display:flex;flex-direction:row}.edge-button,.shape-button{flex:1;border-style:solid;border-width:1px;border-image:none}.edge-button-selected,.shape-button-selected{background:#4c4c4c;color:#fff}#topbar{background:#fff;padding:10px}.action-button{font-size:16px;background-color:transparent;border:1px solid #d3d3d3;color:#6e6e6e;height:32px;width:32px;text-align:center;box-shadow:0 0 1px #0000004d}.action-button:hover,.action-button:focus{background:#0079c1;color:#e4e4e4}.active{background:#0079c1;color:#e4e4e4}.hide{display:none}img{border:10px solid white;box-shadow:2px 2px 5px #00000080}.action-button2{padding:.6em;border:1px solid #0079c1;text-align:center;background-color:#fff;cursor:pointer}.action-button2:hover,.action-button2:focus{background:#0079c1;color:#fff}#maskDiv{position:absolute;background:#ff33001a;border:2px dashed rgb(255,51,0)}.shadowcast-button{border:0}.button-container{margin:5px 0;text-align:left}#opacitySliderContainer{text-align:center;padding:1em;margin-bottom:20px}#opacity{margin-bottom:.5em}#opacitySlider{margin:.5em 2em}#elevationInput,#navigationUnderground{margin-left:.5em}#calcite-shell{background:#32774e;background:linear-gradient(to right bottom,#648880,#32774e)}#information-panel{padding:.25em}#in-ads-container{margin-left:1rem;margin-right:1rem;width:350px}.esri-component.esri-coordinate-conversion.esri-widget{width:350px;font-size:11px;background-color:#fffc}.esri-coordinate-conversion__row{padding:0 5px}#basemapSwitch,#elevationModels,#navigationUnderground,#elevationInput{padding:.25em}#daylight-container,#shadowcast-container,#sketchPanel{width:100%;height:100%}.responsive-action-bar{flex-wrap:wrap}#layers-container,#wms-layers-container{overflow-y:auto;display:block;height:50vh} diff --git a/dist/assets/index-J0iiHjMT.js b/dist/assets/index-pCX-0tJH.js similarity index 52% rename from dist/assets/index-J0iiHjMT.js rename to dist/assets/index-pCX-0tJH.js index 16fb4e4..f5ad9f3 100644 --- a/dist/assets/index-J0iiHjMT.js +++ b/dist/assets/index-pCX-0tJH.js @@ -1,30 +1,9 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function i(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(n){if(n.ep)return;n.ep=!0;const s=i(n);fetch(n.href,s)}})();function y(t,e,i,r){var n,s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,r);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o}function QWt(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function l(_){try{f(r.next(_))}catch(x){o(x)}}function c(_){try{f(r.throw(_))}catch(x){o(x)}}function f(_){_.done?s(_.value):n(_.value).then(l,c)}f((r=r.apply(t,e||[])).next())})}let Xw;function Le(t){return typeof Xw[t]=="function"?Xw[t]=Xw[t](globalThis):Xw[t]}var S3e,T3e,E3e,C3e;Xw=(S3e=globalThis.dojoConfig)!=null&&S3e.has||(T3e=globalThis.esriConfig)!=null&&T3e.has?{...(E3e=globalThis.dojoConfig)==null?void 0:E3e.has,...(C3e=globalThis.esriConfig)==null?void 0:C3e.has}:{},Le.add=(t,e,i,r)=>((r||Xw[t]===void 0)&&(Xw[t]=e),i&&Le(t)),Le.cache=Xw,Le.add("big-integer-warning-enabled",!0),Le.add("esri-deprecation-warnings",!0),Le.add("esri-tests-disable-screenshots",!1),Le.add("esri-tests-use-full-window",!1),Le.add("esri-tests-post-to-influx",!0),(()=>{var e;Le.add("host-webworker",globalThis.WorkerGlobalScope!==void 0&&self instanceof globalThis.WorkerGlobalScope);const t=typeof window<"u"&&typeof location<"u"&&typeof document<"u"&&window.location===location&&window.document===document;if(Le.add("host-browser",t),Le.add("host-node",typeof globalThis.process=="object"&&((e=globalThis.process.versions)==null?void 0:e.node)&&globalThis.process.versions.v8),Le.add("dom",t),Le("host-browser")){const i=navigator,r=i.userAgent,n=i.appVersion,s=parseFloat(n);if(Le.add("wp",parseFloat(r.split("Windows Phone")[1])||void 0),Le.add("msapp",parseFloat(r.split("MSAppHost/")[1])||void 0),Le.add("khtml",n.includes("Konqueror")?s:void 0),Le.add("edge",parseFloat(r.split("Edge/")[1])||void 0),Le.add("opr",parseFloat(r.split("OPR/")[1])||void 0),Le.add("webkit",!Le("wp")&&!Le("edge")&&parseFloat(r.split("WebKit/")[1])||void 0),Le.add("chrome",!Le("edge")&&!Le("opr")&&parseFloat(r.split("Chrome/")[1])||void 0),Le.add("android",!Le("wp")&&parseFloat(r.split("Android ")[1])||void 0),Le.add("safari",!n.includes("Safari")||Le("wp")||Le("chrome")||Le("android")||Le("edge")||Le("opr")?void 0:parseFloat(n.split("Version/")[1])),Le.add("mac",n.includes("Macintosh")),!Le("wp")&&/(iPhone|iPod|iPad)/.test(r)){const o=RegExp.$1.replace(/P/,"p"),l=/OS ([\d_]+)/.test(r)?RegExp.$1:"1",c=parseFloat(l.replace(/_/,".").replaceAll("_",""));Le.add(o,c),Le.add("ios",c)}Le("webkit")||(!r.includes("Gecko")||Le("wp")||Le("khtml")||Le("edge")||Le.add("mozilla",s),Le("mozilla")&&Le.add("ff",parseFloat(r.split("Firefox/")[1]||r.split("Minefield/")[1])||void 0))}})(),(()=>{if(globalThis.navigator){const t=navigator.userAgent,e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(t),i=/iPhone/i.test(t);e&&Le.add("esri-mobile",e),i&&Le.add("esri-iPhone",i),Le.add("esri-geolocation",!!navigator.geolocation)}Le.add("esri-wasm","WebAssembly"in globalThis),Le.add("esri-performance-mode-frames-between-render",20),Le.add("esri-force-performance-mode",!1),Le.add("esri-shared-array-buffer",()=>{const t="SharedArrayBuffer"in globalThis,e=globalThis.crossOriginIsolated===!1;return t&&!e}),Le.add("wasm-simd",()=>{const t=[0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11];return WebAssembly.validate(new Uint8Array(t))}),Le.add("esri-atomics","Atomics"in globalThis),Le.add("esri-workers","Worker"in globalThis),Le.add("web-feat:cache","caches"in globalThis),Le.add("esri-workers-arraybuffer-transfer",!Le("safari")||Number(Le("safari"))>=12),Le.add("workers-pool-size",8),Le.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),Le.add("featurelayer-simplify-payload-size-factors",[1,1,4]),Le.add("featurelayer-animation-enabled",!0),Le.add("featurelayer-snapshot-enabled",!0),Le.add("featurelayer-snapshot-point-min-threshold",8e4),Le.add("featurelayer-snapshot-point-max-threshold",4e5),Le.add("featurelayer-snapshot-point-coverage",.1),Le.add("featurelayer-advanced-symbols",!1),Le.add("featurelayer-pbf",!0),Le.add("featurelayer-pbf-statistics",!1),Le.add("feature-layers-workers",!0),Le.add("feature-polyline-generalization-factor",1),Le.add("mapview-transitions-duration",200),Le.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),Le.add("mapserver-pbf-version-support",10.81),Le.add("mapservice-popup-identify-max-tolerance",20),Le.add("heatmap-allow-raster-fallback",!1),Le.add("heatmap-force-raster",!1),Le("host-webworker")||Le("host-browser")&&(Le.add("esri-csp-restrictions",()=>{try{new Function}catch{return!0}return!1}),Le.add("esri-image-decode",()=>{if("decode"in new Image){const t=new Image;return t.src='data:image/svg+xml;charset=UTF-8,',void t.decode().then(()=>{Le.add("esri-image-decode",!0,!0,!0)}).catch(()=>{Le.add("esri-image-decode",!1,!0,!0)})}return!1}),Le.add("esri-url-encodes-apostrophe",()=>{const t=window.document.createElement("a");return t.href="?'",t.href.includes("?%27")}))})();const Jue=new Set;function _je(t,e,i=!1){i&&Jue.has(e)||(i&&Jue.add(e),t.warn(`🛑 DEPRECATED - ${e}`))}function R3e(t,e,i={}){if(Le("esri-deprecation-warnings")){const{moduleName:r}=i;NO(t,`Function: ${(r?r+"::":"")+e+"()"}`,i)}}function pm(t,e,i={}){if(Le("esri-deprecation-warnings")){const{moduleName:r}=i;NO(t,`Property: ${(r?r+"::":"")+e}`,i)}}function NO(t,e,i={}){if(Le("esri-deprecation-warnings")){const{replacement:r,version:n,see:s,warnOnce:o}=i;let l=e;r&&(l+=` - 🛠️ Replacement: ${r}`),n&&(l+=` - ⚙️ Version: ${n}`),s&&(l+=` - 🔗 See ${s} for more details.`),_je(t,l,o)}}function eYt(t){const e=[];return function*(){yield*e;for(const i of t)e.push(i),yield i}}function bje(t,e){for(const i of t)if(i!=null&&e(i))return i}function BX(t){return t!=null&&typeof t[Symbol.iterator]=="function"}let O_=class jX{constructor(){this._groups=new Map}destroy(){this.removeAll()}get size(){let e=0;return this._groups.forEach(i=>{e+=i.length}),e}add(e,i){if(BX(e)){const r=this._getOrCreateGroup(i);for(const n of e)this._isHandle(n)&&r.push(n)}else this._isHandle(e)&&this._getOrCreateGroup(i).push(e);return this}forEach(e,i){if(typeof e=="function")this._groups.forEach(r=>r.forEach(e));else{const r=this._getGroup(e);r&&i&&r.forEach(i)}}has(e){return this._groups.has(this._ensureGroupKey(e))}remove(e){if(typeof e!="string"&&BX(e)){for(const i of e)this.remove(i);return this}return this.has(e)?(this._removeAllFromGroup(this._getGroup(e)),this._groups.delete(this._ensureGroupKey(e)),this):this}removeAll(){return this._groups.forEach(e=>this._removeAllFromGroup(e)),this._groups.clear(),this}_isHandle(e){return e&&(!!e.remove||e instanceof jX)}_getOrCreateGroup(e){if(this.has(e))return this._getGroup(e);const i=[];return this._groups.set(this._ensureGroupKey(e),i),i}_getGroup(e){return this._groups.get(this._ensureGroupKey(e))}_ensureGroupKey(e){return e||"_default_"}_removeAllFromGroup(e){for(const i of e)i instanceof jX?i.removeAll():i.remove()}},zI=class u3{constructor(e=1){this._seed=e}set seed(e){this._seed=e??Math.random()*u3._m}getInt(){return this._seed=(u3._a*this._seed+u3._c)%u3._m,this._seed}getFloat(){return this.getInt()/(u3._m-1)}getIntRange(e,i){return Math.round(this.getFloatRange(e,i))}getFloatRange(e,i){const r=i-e;return e+this.getInt()/u3._m*r}};zI._m=2147483647,zI._a=48271,zI._c=0;const VV=1.5,wje=1/VV,xje=.5;function Sje(t){if(!t)return;const e=t.length;return e>0?t[e-1]:void 0}function I3e(t){return t}function Tje(t,e=I3e){if(!t||t.length===0)return;let i=t[0],r=e(i);for(let n=1;nr&&(r=o,i=s)}return i}function $3e(t,e=I3e){return Tje(t,i=>-e(i))}function c9(t,e){return e?t.filter((i,r,n)=>n.findIndex(e.bind(null,i))===r):Array.from(new Set(t))}function Fy(t,e,i){if(t==null&&e==null)return!0;if(t==null||e==null||t.length!==e.length)return!1;if(i){for(let r=0;r!t.some(o=>i(o,s))),n=t.filter(s=>!e.some(o=>i(o,s)))):(r=e.filter(s=>!t.includes(s)),n=t.filter(s=>!e.includes(s))),{added:r,removed:n}}function Cje(t){return t&&typeof t.length=="number"}function L3e(t,e){const i=t.length;if(i===0)return[];const r=[];for(let n=0;nt[l]?n=l+1:s=l}const o=t[n];return i?e>=t[r-1]?-1:o===e?n:n-1:o===e?n:-1}function Pje(t,e,i){if(!t||t.length===0)return;const r=t.length-1,n=t[0];if(e<=i(n))return n;const s=t[r];if(e>=i(s))return s;let o=0,l=0,c=r;for(;o0){const x=t[l-1],T=i(x);if(e>T)return e-T>=_-e?f:x}c=l}else{if(l=T-e?x:f}o=l+1}}return t[l]}let N3e=class{constructor(){this.last=0}};const F3e=new N3e;function GX(t,e,i,r){r=r||F3e;const n=Math.max(0,r.last-10);for(let o=n;oKue.getFloat()):Math.random}function iYt(t,e){const i=$je(e);for(let r=t.length-1;r>0;r--){const n=Math.floor(i()*(r+1)),s=t[r];t[r]=t[n],t[n]=s}return t}const Kue=new zI;function Gre(t,e){const i=t.indexOf(e);return i!==-1?(t.splice(i,1),e):null}function rYt(t,e){const i=new Map,r=t.length;for(let n=0;ne+(i?zf(i)?Nje(i,Hre()):i.byteLength+H3e:0),0)}const H3e=145,td=1024;function Fje(t){return W5(t)||q5(t)||GV(t)||BV(t)||qre(t)}function kje(t){return W5(t)||q5(t)}function zje(t){return W5(t)?179769e303:q5(t)?3402823e32:HV(t)?4294967295:jV(t)?65535:Zw(t)||G3e(t)?255:GV(t)?2147483647:BV(t)?32767:qre(t)?127:256}function q3e(t,e){let i;if(e)for(i in t)t.hasOwnProperty(i)&&(t[i]===void 0?delete t[i]:t[i]instanceof Object&&q3e(t[i],!0));else for(i in t)t.hasOwnProperty(i)&&t[i]===void 0&&delete t[i];return t}function Re(t){if(!t||typeof t!="object"||typeof t=="function")return t;const e=X3e(t);if(e!=null)return e;if(Uk(t))return t.clone();if(W3e(t))return t.map(Re);if(Y3e(t))return t.clone();const i={};for(const r of Object.getOwnPropertyNames(t))i[r]=Re(t[r]);return i}function HX(t){if(!t||typeof t!="object"||typeof t=="function"||"HTMLElement"in globalThis&&t instanceof HTMLElement)return t;const e=X3e(t);if(e!=null)return e;if(W3e(t)){let i=!0;const r=t.map(n=>{const s=HX(n);return n!=null&&s==null&&(i=!1),s});return i?r:null}if(Uk(t))return t.clone();if(t instanceof File||t instanceof Blob)return t;if(!Y3e(t)){const i=new(Object.getPrototypeOf(t)).constructor;for(const r of Object.getOwnPropertyNames(t)){const n=t[r],s=HX(n);if(n!=null&&s==null)return null;i[r]=s}return i}return null}function Uk(t){return typeof t.clone=="function"}function W3e(t){return typeof t.map=="function"&&typeof t.forEach=="function"}function Y3e(t){return typeof t.notifyChange=="function"&&typeof t.watch=="function"}function Que(t){if(Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function X3e(t){if(qre(t)||Zw(t)||G3e(t)||BV(t)||jV(t)||GV(t)||HV(t)||q5(t)||W5(t))return t.slice();if(t instanceof Date)return new Date(t.getTime());if(t instanceof ArrayBuffer)return t.slice(0,t.byteLength);if(t instanceof Map){const e=new Map;for(const[i,r]of t)e.set(i,Re(r));return e}if(t instanceof Set){const e=new Set;for(const i of t)e.add(Re(i));return e}return null}function Wre(t,e){return t===e||typeof t=="number"&&isNaN(t)&&typeof e=="number"&&isNaN(e)||typeof(t==null?void 0:t.getTime)=="function"&&typeof(e==null?void 0:e.getTime)=="function"&&t.getTime()===e.getTime()||!1}function Z3e(t,e){return t===e||(t==null||typeof t=="string"?t===e:typeof t=="number"?t===e||typeof e=="number"&&isNaN(t)&&isNaN(e):t instanceof Date?e instanceof Date&&t.getTime()===e.getTime():Array.isArray(t)?Array.isArray(e)&&Fy(t,e):t instanceof Set?e instanceof Set&&Vje(t,e):t instanceof Map?e instanceof Map&&Bje(t,e):!!Que(t)&&Que(e)&&Uje(t,e))}function Uje(t,e){if(t===null||e===null)return!1;const i=Object.keys(t);if(e===null||Object.keys(e).length!==i.length)return!1;for(const r of i)if(t[r]!==e[r]||!Object.prototype.hasOwnProperty.call(e,r))return!1;return!0}function Vje(t,e){if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}function Bje(t,e){if(t.size!==e.size)return!1;for(const[i,r]of t){const n=e.get(i);if(n!==r||n===void 0&&!e.has(i))return!1}return!0}function Yre(t,e,i=!1){return K3e(t,e,i)}function u9(t,e){if(e!=null)return e[t]||J3e(t.split("."),!1,e)}function sE(t,e,i){const r=t.split("."),n=r.pop(),s=J3e(r,!0,i);s&&n&&(s[n]=e)}function J3e(t,e,i){let r=i;for(const n of t){if(r==null)return;if(!(n in r)){if(!e)return;r[n]={}}r=r[n]}return r}function K3e(t,e,i){return e?Object.keys(e).reduce((r,n)=>{let s=r[n],o=e[n];return s===o?r:s===void 0?(r[n]=Re(o),r):(Array.isArray(o)||Array.isArray(r)?(s=s?Array.isArray(s)?r[n]=s.concat():r[n]=[s]:r[n]=[],o&&(Array.isArray(o)||(o=[o]),i?o.forEach(l=>{s.includes(l)||s.push(l)}):r[n]=o.concat())):o&&typeof o=="object"?r[n]=K3e(s,o,i):r.hasOwnProperty(n)&&!e.hasOwnProperty(n)||(r[n]=o),r)},t||{}):t}var A3e;const Ar={apiKey:void 0,applicationName:"",applicationUrl:(A3e=globalThis.location)==null?void 0:A3e.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(Yre(Ar,globalThis.esriConfig,!0),delete Ar.has),!Ar.assetsPath){{const t="4.28";Ar.assetsPath=`https://js.arcgis.com/${t}/@arcgis/core/assets`}Ar.defaultAssetsPath=Ar.assetsPath}const jje=/\{([^\}]+)\}/g;function ehe(t){return t??""}function h9(t,e){return e?t.replaceAll(jje,typeof e=="object"?(i,r)=>ehe(u9(r,e)):(i,r)=>ehe(e(r))):t}function Xre(t,e){return t.replaceAll(/([\.$?*|{}\(\)\[\]\\\/\+\-^])/g,i=>e&&e.includes(i)?i:`\\${i}`)}function Zre(t){let e=0;for(let i=0;ie._loggedMessages.warn.clear()}}static get test(){return{resetLoggers(e=new Map){const i=jc._loggers;return jc._loggers=e,i},set throttlingDisabled(e){jc._throttlingDisabled=e}}}static getLogger(e){return e=typeof e!="string"?e.declaredClass:e,jc._loggers.get(e)||new jc({module:e})}_log(e,i,...r){if(this._matchLevel(e)){if(i!=="always"&&!jc._throttlingDisabled){const n=this._argsToKey(r),s=this._loggedMessages[e].get(n);if(i==="once"&&s!=null||i==="oncePerTick"&&s&&s>=jc._tickCounter)return;this._loggedMessages[e].set(n,jc._tickCounter),jc._scheduleTickCounterIncrement()}for(const n of Ar.log.interceptors)if(n(e,this.module,...r))return;this._inheritedWriter()(e,this.module,...r)}}_parentWithMember(e,i){let r=this;for(;r!=null;){const n=r[e];if(n!=null)return n;r=r.parent}return i}_inheritedWriter(){return this._parentWithMember("writer",this._consoleWriter)}_consoleWriter(e,i,...r){console[e](`[${i}]`,...r)}_matchLevel(e){const i=Ar.log.level||"warn";return the[this._parentWithMember("level",i)]<=the[e]}_argsToKey(...e){return Zre(JSON.stringify(e,(r,n)=>typeof n!="object"||Array.isArray(n)?n:"[Object]"))}static _scheduleTickCounterIncrement(){jc._tickCounterScheduled||(jc._tickCounterScheduled=!0,Promise.resolve().then(()=>{jc._tickCounter++,jc._tickCounterScheduled=!1}))}};Ce._loggers=new Map,Ce._tickCounter=0,Ce._tickCounterScheduled=!1,Ce._throttlingDisabled=!1;function ky(t,e){if(t==null)throw new Error(e??"value is None")}function et(t){return t==null||t.destroy(),null}function Kt(t){return t==null||t.dispose(),null}function en(t){return t==null||t.remove(),null}function gn(t){return t==null||t.abort(),null}function ir(t){return t==null||t.release(),null}function FO(t,e,i){return t!=null&&e!=null?i!=null?i(t,e):t.equals(e):t===e}function ihe(t,e){return t==null?void 0:t[e]}function Hje(t,e){let i;return t.some((r,n)=>(i=e(r,n),i!=null)),i??void 0}const Q3e=Symbol("Accessor-beforeDestroy"),qje={remove:()=>{}};function rr(t){return t?{remove(){t&&(t(),t=void 0)}}:qje}function Wje(t){t.forEach(e=>e==null?void 0:e.remove())}function id(t){return rr(()=>Wje(t))}function sYt(t){return rr(()=>{var e;return(e=t())==null?void 0:e.remove()})}function Jre(t){return rr(t!=null?()=>t.destroy():void 0)}function Zl(t){return t.__accessor__??null}function Yje(t,e){var i;return((i=t==null?void 0:t.metadatas)==null?void 0:i[e])!=null}function c7(t,e,i){return i?Vk(t,e,{policy:i,path:""}):Vk(t,e,null)}function Vk(t,e,i){return e?Object.keys(e).reduce((r,n)=>{const s=n;let o=null,l="merge";if(i&&(o=i.path?`${i.path}.${n}`:n,l=i.policy(o)),l==="replace"||l==="replace-arrays"&&Array.isArray(r[s]))return r[s]=e[s],r;if(r[s]===void 0)return r[s]=Re(e[s]),r;let c=r[s],f=e[s];if(c===f)return r;if(Array.isArray(f)||Array.isArray(r))c=c?Array.isArray(c)?r[s]=c.concat():r[s]=[c]:r[s]=[],f&&(Array.isArray(f)||(f=[f]),f.forEach(_=>{c.includes(_)||c.push(_)}));else if(f&&typeof f=="object")if(i){const _=i.path;i.path=o,r[s]=Vk(c,f,i),i.path=_}else r[s]=Vk(c,f,null);else r.hasOwnProperty(n)&&!e.hasOwnProperty(n)||(r[s]=f);return r},t||{}):t}function eSe(t){return Array.isArray(t)?t:t.split(".")}function rhe(t){return t.includes(",")?t.split(",").map(e=>e.trim()):[t.trim()]}function Xje(t){if(Array.isArray(t)){const e=[];for(const i of t)e.push(...rhe(i));return e}return rhe(t)}function tSe(t,e,i,r){const n=Xje(e);if(n.length!==1){const s=n.map(o=>r(t,o,i));return id(s)}return r(t,n[0],i)}function iSe(t,e){const i=t[t.length-1]==="?"?t.slice(0,-1):t;if(e.getItemAt!=null||Array.isArray(e)){const n=parseInt(i,10);if(!isNaN(n))return Array.isArray(e)?e[n]:e.at(n)}const r=Zl(e);return Yje(r,i)?r.get(i):e[i]}function rSe(t,e,i){if(t==null)return t;const r=iSe(e[i],t);return!r&&i=this._pool.length)){for(let i=e;i0){if(!(n+r{},onTrackingEnd:()=>{}},ZR=[];let UI=jk;function wi(t){UI.onObservableAccessed(t)}let u7=!1,h7=!1;function c_(t,e,i){if(u7)return Kre(t,e,i);sSe(t);const r=e.call(i);return oSe(),r}function nGe(t,e){return c_(jk,t,e)}function Kre(t,e,i){const r=u7;u7=!0,sSe(t);let n=null;try{n=e.call(i)}catch(s){h7&&Ce.getLogger("esri.core.accessorSupport.tracking").error(s)}return oSe(),u7=r,n}function sSe(t){UI=t,ZR.push(t)}function oSe(){const t=ZR.length;if(t>1){const e=ZR.pop();UI=ZR[t-2],e.onTrackingEnd()}else if(t===1){const e=ZR.pop();UI=jk,e.onTrackingEnd()}else UI=jk}function aSe(t,e){if(e.flags&qn.DepTrackingInitialized)return;const i=h7;h7=!1,e.flags&qn.AutoTracked?Kre(e,e.metadata.get,t):lSe(t,e),h7=i}const sGe=[];function lSe(t,e){e.flags&qn.ExplicitlyTracking||(e.flags|=qn.ExplicitlyTracking,Kre(e,()=>{const i=e.metadata.dependsOn||sGe;for(const r of i)if(typeof r!="string"||r.includes(".")){const n=eSe(r);for(let s=0,o=t;s0)for(const i of e)i.onInvalidated()}onCommitted(){const e=this._observers;if(e&&e.length>0){const i=e.slice();for(const r of i)r.onCommitted()}}},oGe=class cSe{constructor(){this._values=new Map,this.multipleOriginsSupported=!1}clone(e){const i=new cSe;return this._values.forEach((r,n)=>{e&&e.has(n)||i.set(n,Re(r))}),i}get(e){return this._values.get(e)}originOf(){return Di.USER}keys(){return[...this._values.keys()]}set(e,i){this._values.set(e,i)}delete(e){this._values.delete(e)}has(e){return this._values.has(e)}forEach(e){this._values.forEach(e)}};function T6(t,e,i){return t!==void 0}function ahe(t,e,i,r){return t!==void 0&&(!(i==null&&t.flags&qn.NonNullable)||(r.lifecycle,Lv.INITIALIZING,!1))}function aGe(t){return t&&typeof t.destroy=="function"}Ce.getLogger("esri.core.accessorSupport.Properties");let lGe=class{constructor(e){this.host=e,this.propertiesByName=new Map,this.ctorArgs=null,this.destroyed=!1,this.lifecycle=Lv.INITIALIZING,this.store=new oGe,this._origin=Di.USER;const i=this.host.constructor.__accessorMetadata__;for(const r in i){const n=new ohe(r,i[r]);this.propertiesByName.set(r,n)}this.metadatas=i}initialize(){this.lifecycle=Lv.CONSTRUCTING}constructed(){this.lifecycle=Lv.CONSTRUCTED}destroy(){this.destroyed=!0;for(const[e,i]of this.propertiesByName){if(i.metadata.autoDestroy){const r=this.internalGet(e);r&&aGe(r)&&(r.destroy(),~i.flags&qn.NonNullable&&this._internalSet(i,null))}i.destroy()}}get initialized(){return this.lifecycle!==Lv.INITIALIZING}get(e){const i=this.propertiesByName.get(e);if(i.metadata.get)return i.getComputed(this);wi(i);const r=this.store;return r.has(e)?r.get(e):i.metadata.value}originOf(e){const i=this.store.originOf(e);if(i===void 0){const r=this.propertiesByName.get(e);if(r!==void 0&&r.flags&qn.HasDefaultValue)return"defaults"}return Bk(i)}has(e){return!!this.propertiesByName.has(e)&&this.store.has(e)}keys(){return[...this.propertiesByName.keys()]}internalGet(e){const i=this.propertiesByName.get(e);if(T6(i))return this.store.has(e)?this.store.get(e):i.metadata.value}internalSet(e,i){const r=this.propertiesByName.get(e);T6(r)&&this._internalSet(r,i)}getDependsInfo(e,i,r){const n=this.propertiesByName.get(i);if(!T6(n))return"";const s=new Set,o=c_({onObservableAccessed:c=>s.add(c),onTrackingEnd:()=>{}},()=>{var c;return(c=n.metadata.get)==null?void 0:c.call(e)});let l=`${r}${e.declaredClass.split(".").pop()}.${i}: ${o} -`;if(s.size===0)return l;r+=" ";for(const c of s)c instanceof ohe&&(l+=`${r}${c.propertyName}: undefined -`);return l}setAtOrigin(e,i,r){const n=this.propertiesByName.get(e);if(T6(n))return this._setAtOrigin(n,i,r)}isOverridden(e){const i=this.propertiesByName.get(e);return i!==void 0&&!!(i.flags&qn.Overriden)}clearOverride(e){const i=this.propertiesByName.get(e);i&&i.flags&qn.Overriden&&(i.flags&=~qn.Overriden,i.notifyChange())}override(e,i){const r=this.propertiesByName.get(e);if(!ahe(r,e,i,this))return;const n=r.metadata.cast;if(n){const s=this._cast(n,i),{valid:o,value:l}=s;if(ZG.release(s),!o)return;i=l}r.flags|=qn.Overriden,this._internalSet(r,i)}set(e,i){const r=this.propertiesByName.get(e);if(!ahe(r,e,i,this))return;const n=r.metadata.cast;if(n){const o=this._cast(n,i),{valid:l,value:c}=o;if(ZG.release(o),!l)return;i=c}const s=r.metadata.set;s?s.call(this.host,i):this._internalSet(r,i)}setDefaultOrigin(e){this._origin=kv(e)}getDefaultOrigin(){return Bk(this._origin)}notifyChange(e){const i=this.propertiesByName.get(e);i!==void 0&&i.notifyChange()}invalidate(e){const i=this.propertiesByName.get(e);i!==void 0&&i.invalidate()}commit(e){const i=this.propertiesByName.get(e);i!==void 0&&i.commit()}_internalSet(e,i){const r=this.lifecycle!==Lv.INITIALIZING?this._origin:Di.DEFAULTS;this._setAtOrigin(e,i,r)}_setAtOrigin(e,i,r){const n=this.store,s=e.propertyName;n.has(s,r)&&Wre(i,n.get(s))&&~e.flags&qn.Overriden&&r===n.originOf(s)||(e.invalidate(),n.set(s,i,r),e.commit(),aSe(this.host,e))}_cast(e,i){const r=ZG.acquire();return r.valid=!0,r.value=i,e&&(r.value=e.call(this.host,i,r)),r}},cGe=class{constructor(){this.value=null,this.valid=!0}acquire(){this.valid=!0}release(){this.value=null}};const ZG=new Ec(cGe);function uGe(t,e){return t.replaceAll(/\$\{([^\s\:\}]*)(?:\:([^\s\:\}]+))?\}/g,(i,r)=>r===""?"$":(u9(r,e)??"").toString())}let uSe=class{constructor(e,i,r){this.name=e,this.details=r,this.message=(i&&uGe(i,r))??""}toString(){return"["+this.name+"]: "+this.message}},se=class hSe extends uSe{constructor(e,i,r){super(e,i,r)}toJSON(){if(this.details!=null)try{return{name:this.name,message:this.message,details:JSON.parse(JSON.stringify(this.details,(e,i)=>{if(i&&typeof i=="object"&&typeof i.toJSON=="function")return i;try{return Re(i)}catch{return"[object]"}}))}}catch(e){throw Ce.getLogger("esri.core.Error").error(e),e}return{name:this.name,message:this.message,details:this.details}}static fromJSON(e){return new hSe(e.name,e.message,e.details)}};se.prototype.type="error";function Gk(t,e,i){if(t&&e)if(typeof e=="object")for(const r of Object.getOwnPropertyNames(e))Gk(t,r,e[r]);else{if(e.includes(".")){const n=e.split("."),s=n.splice(-1,1)[0];return void Gk(au(t,n),s,i)}const r=t.__accessor__;r!=null&&hGe(e,r),t[e]=i}}function hGe(t,e){if(Le("esri-unknown-property-errors")&&!dGe(t,e))throw new se("set:unknown-property",pGe(t,e))}function dGe(t,e){return e.metadatas[t]!=null}function pGe(t,e){return"setting unknown property '"+t+"' on instance of "+e.host.declaredClass}let fGe;function mGe(){return fGe}var lhe;(function(t){t[t.Ignore=0]="Ignore",t[t.Destroy=1]="Destroy",t[t.ThrowError=2]="ThrowError"})(lhe||(lhe={}));function gGe(t){t.length=0}let Uh=class{constructor(e=50,i=50){this._pool=new Ec(Array,void 0,gGe,i,e)}acquire(){return this._pool.acquire()}release(e){this._pool.release(e)}prune(){this._pool.prune(0)}static acquire(){return JG.acquire()}static release(e){return JG.release(e)}static prune(){JG.prune()}};const JG=new Uh(100);let dSe=class extends Ec{constructor(){super(...arguments),this._set=new Set}destroy(){super.destroy(),this._set=null}acquire(...e){const i=super.acquire(...e);return this._set.delete(i),i}release(e){e&&!this._set.has(e)&&(super.release(e),this._set.add(e))}_dispose(e){this._set.delete(e),super._dispose(e)}};const E6=[];function kO(t){E6.push(t),E6.length===1&&queueMicrotask(()=>{const e=E6.slice();E6.length=0;for(const i of e)i()})}let zv=class{constructor(e,i=30){this.name=e,this._counter=0,this._samples=new Array(i)}record(e){e!=null&&(this._samples[++this._counter%this._samples.length]=e)}get median(){return this._samples.slice().sort((e,i)=>e-i)[Math.floor(this._samples.length/2)]}get average(){return this._samples.reduce((e,i)=>e+i,0)/this._samples.length}get last(){return this._samples[this._counter%this._samples.length]}};var YX;(function(t){const e=(s,o,l,c)=>{let f=o,_=o;const x=l>>>1,T=s[f-1];for(;_<=x;){_=f<<1,_so?1:0;function r(s,o,l,c){o===void 0&&(o=0),l===void 0&&(l=s.length),c===void 0&&(c=i);for(let _=l>>>1;_>o;_--)e(s,_,l,c);const f=o+1;for(let _=l-1;_>o;_--){const x=s[o];s[o]=s[_],s[_]=x,e(s,f,_,c)}}function*n(s,o,l,c){o===void 0&&(o=0),l===void 0&&(l=s.length),c===void 0&&(c=i);for(let _=l>>>1;_>o;_--)e(s,_,l,c),yield;const f=o+1;for(let _=l-1;_>o;_--){const x=s[o];s[o]=s[_],s[_]=x,e(s,f,_,c),yield}}t.sort=r,t.iterableSort=n})(YX||(YX={}));const che=YX,yGe=1.5,vGe=1.1;let Pi=class{constructor(e){this.data=[],this._length=0,this._allocator=void 0,this._deallocator=()=>null,this._shrink=()=>{},this._hint=new N3e,e&&(e.initialSize&&(this.data=new Array(e.initialSize)),e.allocator&&(this._allocator=e.allocator),e.deallocator!==void 0&&(this._deallocator=e.deallocator),e.shrink&&(this._shrink=()=>uhe(this)))}toArray(){return this.data.slice(0,this.length)}filter(e){const i=new Array;for(let r=0;r=this._length))return this.data[e]}includes(e,i){const r=this.data.indexOf(e,i);return r!==-1&&rthis._length){if(this._allocator){for(;this._length=this.length||e<0))return this.swapElements(e,this.length-1),this.pop()}removeUnorderedMany(e,i=e.length,r){this.length=Rje(this.data,e,this.length,i,this._hint,r),this._shrink()}front(){if(this.length!==0)return this.data[0]}back(){if(this.length!==0)return this.data[this.length-1]}swapElements(e,i){if(e>=this.length||i>=this.length||e===i)return;const r=this.data[e];this.data[e]=this.data[i],this.data[i]=r}sort(e){che.sort(this.data,0,this.length,e)}iterableSort(e){return che.iterableSort(this.data,0,this.length,e)}some(e,i){for(let r=0;ryGe*t.length&&(t.data.length=Math.floor(t.length*vGe))}function _Ge(t){return{setTimeout:(e,i)=>{const r=t.setTimeout(e,i);return rr(()=>t.clearTimeout(r))}}}const m9=_Ge(globalThis);function qV(t){return t&&(typeof t.on=="function"||typeof t.addEventListener=="function")}function Y5(t,e,i){if(!qV(t))throw new TypeError("target is not a Evented or EventTarget object");if("on"in t)return t.on(e,i);if(Array.isArray(e)){const r=e.slice();for(const n of r)t.addEventListener(n,i);return rr(()=>{for(const n of r)t.removeEventListener(n,i)})}return t.addEventListener(e,i),rr(()=>t.removeEventListener(e,i))}function pSe(t,e,i){if(!qV(t))throw new TypeError("target is not a Evented or EventTarget object");if("once"in t)return t.once(e,i);const r=Y5(t,e,n=>{r.remove(),i.call(t,n)});return r}const bGe={Win:"Meta",Scroll:"ScrollLock",Spacebar:" ",Down:"ArrowDown",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Del:"Delete",Apps:"ContextMenu",Esc:"Escape",Multiply:"*",Add:"+",Subtract:"-",Decimal:".",Divide:"/"};function Sf({key:t}){return bGe[t]||t}function ur(t="Aborted"){return new se("AbortError",t)}function St(t,e="Aborted"){if(xo(t))throw ur(e)}function WV(t){return t!=null?"aborted"in t?t:t.signal:t}function xo(t){const e=WV(t);return e!=null&&e.aborted}function zo(t){if(sn(t))throw t}function XX(t){if(!sn(t))throw t}function Yl(t,e){const i=WV(t);if(i!=null){if(!i.aborted)return pSe(i,"abort",()=>e());e()}}function g9(t,e){const i=WV(t);if(i!=null)return St(i),pSe(i,"abort",()=>e(ur()))}function oT(t,e){return WV(e)==null?t:new Promise((i,r)=>{let n=Yl(e,()=>r(ur()));const s=()=>{n=en(n)};t.then(s,s),t.then(i,r)})}function sn(t){return(t==null?void 0:t.name)==="AbortError"}async function $m(t){try{return await t}catch(e){if(!sn(e))throw e;return}}async function gYt(t,e=Ce.getLogger("esri")){try{return await t}catch(i){sn(i)||e.error(i)}}async function Uv(t){if(!t)return;if(typeof t.forEach!="function"){const i=Object.keys(t),r=i.map(o=>t[o]),n=await Uv(r),s={};return i.map((o,l)=>s[o]=n[l]),s}const e=t;return Promise.allSettled(e).then(i=>Array.from(e,(r,n)=>{const s=i[n];return s.status==="fulfilled"?{promise:r,value:s.value}:{promise:r,error:s.reason}}))}async function wGe(t){return(await Uv(t)).filter(e=>!!e.value).map(e=>e.value)}async function ZX(t){return(await Promise.allSettled(t)).filter(e=>e.status==="fulfilled").map(e=>e.value)}async function xGe(t){return(await Promise.allSettled(t)).filter(e=>e.status==="rejected").map(e=>e.reason)}function T2(t,e=void 0,i){const r=new AbortController;return Yl(i,()=>r.abort()),new Promise((n,s)=>{let o=setTimeout(()=>{o=0,n(e)},t);Yl(r,()=>{o&&(clearTimeout(o),s(ur()))})})}function pd(t){return t&&typeof t.then=="function"}function JX(t){return pd(t)?t:Promise.resolve(t)}function X5(t,e=-1){let i,r,n,s,o=null;const l=(...c)=>{if(i){r=c,s&&s.reject(ur()),s=Jl();const T=s.promise;if(o){const A=o;o=null,A.abort()}return T}if(n=s||Jl(),s=null,e>0){const T=new AbortController;i=JX(t(...c,T.signal));const A=i;T2(e).then(()=>{i===A&&(s?T.abort():o=T)})}else i=1,i=JX(t(...c));const f=()=>{const T=r;r=n=i=o=null,T!=null&&l(...T)},_=i,x=n;return _.then(f,f),_.then(x.resolve,x.reject),x.promise};return l}function Jl(){let t,e;const i=new Promise((n,s)=>{t=n,e=s}),r=n=>{t(n)};return r.resolve=n=>t(n),r.reject=n=>e(n),r.timeout=(n,s)=>m9.setTimeout(()=>r.reject(s),n),r.promise=i,r}function yYt(t,e){return t.then(e,e)}async function Hk(t){await Promise.resolve(),St(t)}function vYt(t){return t}function fSe(t){return 1e3*t}function _Yt(t){return t}function Qre(t){return .001*t}let SGe=class{constructor(e){this.phases=e,this.paused=!1,this.ticks=-1,this.removed=!1}},TGe=class{constructor(e){this.callback=e,this.isActive=!0}remove(){this.isActive=!1}},KX=0,QX=0;const IP={time:0,deltaTime:0,elapsedFrameTime:0,frameDuration:0},eZ=["prepare","preRender","render","postRender","update","finish"],tZ=[],CT=new Pi;let EGe=class{constructor(e){this._task=e}remove(){this._task.removed=!0}pause(){this._task.paused=!0}resume(){this._task.paused=!1}};const qk={frameTasks:CT,willDispatch:!1,clearFrameTasks:CGe,dispatch:ySe,executeFrameTasks:MGe};function tx(t){const e=new TGe(t);return tZ.push(e),qk.willDispatch||(qk.willDispatch=!0,kO(ySe)),e}function AT(t){const e=new SGe(t);return CT.push(e),Wk==null&&(KX=performance.now(),Wk=requestAnimationFrame(mSe)),new EGe(e)}let Wk=null;function CGe(t=!1){CT.forAll(e=>{e.removed=!0}),t&&gSe()}function AGe(t){QX=Math.max(0,t)}function mSe(){const t=performance.now();Wk=null,Wk=CT.length>0?requestAnimationFrame(mSe):null,qk.executeFrameTasks(t)}function MGe(t){const e=t-KX;KX=t;const i=QX>0?QX:1e3/60,r=Math.max(0,e-i);IP.time=t,IP.frameDuration=i-r;for(let n=0;n{var c;l.paused||l.removed||(n===0&&l.ticks++,l.phases[o]&&(IP.elapsedFrameTime=performance.now()-t,IP.deltaTime=l.ticks===0?0:e,(c=l.phases[o])==null||c.call(l,IP)))}),PGe[n].record(performance.now()-s)}gSe(),RGe.record(performance.now()-t)}const C6=new Pi;function gSe(){CT.forAll(t=>{t.removed&&C6.push(t)}),CT.removeUnorderedMany(C6.data,C6.length),C6.clear()}function ySe(){for(;tZ.length;){const t=tZ.shift();t.isActive&&t.callback()}qk.willDispatch=!1}function OGe(t=1,e){const i=Jl(),r=()=>{xo(e)?i.reject(ur()):t===0?i():(--t,kO(()=>r()))};return r(),i.promise}const PGe=eZ.map(t=>new zv(t)),RGe=new zv("total");function d7(t,e){for(const i of t.entries())if(e(i[0]))return!0;return!1}function hhe(t,e){if(!e)return t;for(const i of e)t.add(i);return t}function vSe(t,e){const i=new Set;return hhe(i,t),hhe(i,e),i}function IGe(t,e){const i=new Set;for(const r of e)t.has(r)&&i.add(r);return i}function SYt(t,e){if(!t||!e)return!1;if(t===e)return!0;for(const i of t)if(!e.has(i))return!1;return!0}function TYt(t,e){if(t==null&&e==null)return!0;if(t==null||e==null||t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}function EYt(t,e){const i=new Set(t);for(const r of e)i.delete(r);return i}let $Ge=0;const LGe=0;function hp(){return++$Ge}let YV=class{constructor(e){this._accessed=[],this._handles=[],this._observerObject=new DGe(e),dhe.register(this,new WeakRef(this._observerObject),this)}destroy(){var e;dhe.unregister(this._observerObject),this._accessed.length=0,(e=this._observerObject)==null||e.destroy(),this.clear()}onObservableAccessed(e){const i=this._accessed;i.includes(e)||i.push(e)}onTrackingEnd(){const e=this._handles,i=this._accessed,r=this._observerObject;for(let n=0;n0?e-1:0}destroy(){this.destroyed=!0,this._notify=NGe}};const dhe=new FinalizationRegistry(t=>{var e;(e=t.deref())==null||e.destroy()});function NGe(){}let ZM=!1;const Yk=[];function _Se(t,e){let i=new YV(s),r=null,n=!1;function s(){if(!i||n)return;if(ZM)return void xSe(s);const l=r;i.clear(),ZM=!0,n=!0,r=c_(i,t),n=!1,ZM=!1,e(r,l),SSe()}function o(){i&&(i.destroy(),i=null,r=null)}return n=!0,r=c_(i,t),n=!1,rr(o)}function bSe(t,e){let i=new YV(n),r=null;function n(){e(r,o)}function s(){i&&(i.destroy(),i=null),r=null}function o(){return i?(i.clear(),r=c_(i,t),r):null}return o(),rr(s)}function wSe(t){let e=new YV(r),i=!1;function r(){e&&!i&&(ZM?xSe(r):(e.clear(),ZM=!0,i=!0,c_(e,t),i=!1,ZM=!1,SSe()))}function n(){e&&(e.destroy(),e=null)}return i=!0,c_(e,t),i=!1,rr(n)}function xSe(t){Yk.includes(t)||Yk.unshift(t)}function SSe(){for(;Yk.length;)Yk.pop()()}var VI;(function(t){t[t.Untracked=0]="Untracked",t[t.Tracked=1]="Tracked"})(VI||(VI={}));let eL=class{constructor(){this.uid=hp(),this.removed=!1,this.type=null,this.oldValue=null,this.callback=null,this.getValue=null,this.target=null,this.path=null,this.equals=null}static acquireUntracked(e,i,r,n,s){return this.pool.acquire(VI.Untracked,e,i,r,n,s,Wre)}static acquireTracked(e,i,r,n){return this.pool.acquire(VI.Tracked,e,i,r,null,null,n)}notify(e,i){this.type===VI.Untracked?this.callback.call(this.target,e,i,this.path,this.target):this.callback.call(null,e,i,void 0,void 0)}acquire(e,i,r,n,s,o,l){this.uid=hp(),this.removed=!1,this.type=e,this.oldValue=i,this.callback=r,this.getValue=n,this.target=s,this.path=o,this.equals=l}release(){this.target=this.path=this.oldValue=this.callback=this.getValue=null,this.uid=hp(),this.removed=!0}};eL.pool=new dSe(eL);const p7=new Uh,Yv=new Set;let Xk;function Zk(t){Yv.delete(t),Yv.add(t),Xk||(Xk=tx(zGe))}function FGe(t){if(t.removed)return;const e=t.oldValue,i=t.getValue();t.equals(e,i)||(t.oldValue=i,t.notify(i,e))}function kGe(t){for(const e of Yv.values())e.target===t&&(e.removed=!0)}function zGe(){let t=10;for(;Xk&&t--;){Xk=null;const e=UGe(),i=p7.acquire();for(const r of e){const n=r.uid;FGe(r),n===r.uid&&r.removed&&i.push(r)}for(const r of Yv)r.removed&&(i.push(r),Yv.delete(r));for(const r of i)eL.pool.release(r);p7.release(i),p7.release(e),iZ.forEach(r=>r())}}function UGe(){const t=p7.acquire();t.length=Yv.size;let e=0;for(const i of Yv)t[e]=i,++e;return Yv.clear(),t}const iZ=new Set;function TSe(t){return iZ.add(t),rr(()=>iZ.delete(t))}function VGe(t,e,i){let r=tSe(t,e,i,(n,s,o)=>{let l,c,f=bSe(()=>d9(n,s),(_,x)=>{n.__accessor__.destroyed||l&&l.uid!==c?r.remove():(l||(l=eL.acquireUntracked(_,o,x,n,s),c=l.uid),Zk(l))});return rr(()=>{f.remove(),l&&(l.uid!==c||l.removed||(l.removed=!0,Zk(l)),l=null),r=f=null})});return r}function BGe(t,e,i){const r=tSe(t,e,i,(n,s,o)=>{let l=!1;return _Se(()=>d9(n,s),(c,f)=>{n.__accessor__.destroyed?r.remove():l||(l=!0,Wre(f,c)||o.call(n,c,f,s,n),l=!1)})});return r}function jGe(t,e,i,r=!1){return!t.__accessor__||t.__accessor__.destroyed?rr():r?BGe(t,e,i):VGe(t,e,i)}function GGe(t,e,i){let r,n,s=bSe(t,(o,l)=>{r&&r.uid!==n?s.remove():(r||(r=eL.acquireTracked(o,e,l,i),n=r.uid),Zk(r))});return rr(()=>{s.remove(),r&&(r.uid!==n||r.removed||(r.removed=!0,Zk(r)),r=null),s=null})}function HGe(t,e,i){let r=!1;return _Se(t,(n,s)=>{r||(r=!0,i(s,n)||e(n,s),r=!1)})}function qGe(t,e,i=!1,r=Z3e){return i?HGe(t,e,r):GGe(t,e,r)}function phe(t){return d7(Yv,e=>e.oldValue===t)}function rp(t,e){for(const[i,r]of t)if(e(r,i))return!0;return!1}function OYt(t,e){for(const[i,r]of t)if(e(r,i))return r;return null}function XV(t,e,i){const r=t.get(e);if(r!==void 0)return r;const n=i();return t.set(e,n),n}const JM=Ce.getLogger("esri.core.accessorSupport.ensureTypes");function WGe(t){return t==null?t:new Date(t)}function YGe(t){return t==null?t:!!t}function y9(t){return t==null?t:t.toString()}function Vh(t){return t==null?t:(t=parseFloat(t),isNaN(t)?0:t)}function ene(t){return t==null?t:Math.round(parseFloat(t))}function ESe(t){return(t==null?void 0:t.constructor)&&t.constructor.__accessorMetadata__!==void 0}function Jk(t,e){return e!=null&&t&&!(e instanceof t)}function CSe(t){return t&&"isCollection"in t}function fhe(t){return t!=null&&t.Type?typeof t.Type=="function"?t.Type:t.Type.base:null}function XGe(t,e){if(!(e!=null&&e.constructor)||!CSe(e.constructor))return rZ(t,e)?e:new t(e);const i=fhe(t.prototype.itemType),r=fhe(e.constructor.prototype.itemType);return i?r?i===r?e:i.prototype.isPrototypeOf(r.prototype)?new t(e):(rZ(t,e),e):new t(e):e}function rZ(t,e){return!!ESe(e)&&(JM.error("Accessor#set","Assigning an instance of '"+(e.declaredClass||"unknown")+"' which is not a subclass of '"+ZV(t)+"'"),!0)}function MT(t,e){return e==null?e:CSe(t)?XGe(t,e):Jk(t,e)?rZ(t,e)?e:new t(e):e}function ZV(t){var e;return((e=t==null?void 0:t.prototype)==null?void 0:e.declaredClass)||"unknown"}const ZGe=new WeakMap;function JGe(t){switch(t){case Number:return Vh;case $n:return ene;case Boolean:return YGe;case String:return y9;case Date:return WGe;default:return XV(ZGe,t,()=>MT.bind(null,t))}}function $s(t,e){const i=JGe(t);return arguments.length===1?i:i(e)}function tL(t,e,i){return arguments.length===1?tL.bind(null,t):e&&(Array.isArray(e)?e.map(r=>t(r,i)):[t(e,i)])}function KGe(t,e){return arguments.length===1?tL(i=>$s(t,i)):tL(i=>$s(t,i),e)}function ASe(t,e,i){return e!==0&&Array.isArray(i)?i.map(r=>ASe(t,e-1,r)):t(i)}function Kk(t,e,i){if(arguments.length===2)return s=>Kk(t,e,s);if(!i)return i;i=ASe(t,e,i);let r=e,n=i;for(;r>0&&Array.isArray(n);)r--,n=n[0];if(n!==void 0)for(let s=0;s$s(t,r),e):Kk(r=>$s(t,r),e,i)}function MSe(t){return!!Array.isArray(t)&&!t.some(e=>{const i=typeof e;return!(i==="string"||i==="number"||i==="function"&&t.length>1)})}function nZ(t,e){if(arguments.length===2)return nZ(t).call(null,e);const i=new Set,r=t.filter(l=>typeof l!="function"),n=t.filter(l=>typeof l=="function");for(const l of t)typeof l!="string"&&typeof l!="number"||i.add(l);let s=null,o=null;return(l,c)=>{if(l==null)return l;const f=typeof l,_=f==="string"||f==="number";return _&&(i.has(l)||n.some(x=>f==="string"&&x===String||f==="number"&&x===Number))||f==="object"&&n.some(x=>!Jk(l,x))?l:(_&&r.length?(s||(s=r.map(x=>typeof x=="string"?`'${x}'`:`${x}`).join(", ")),JM.error("Accessor#set",`'${l}' is not a valid value for this property, only the following values are valid: ${s}`)):typeof l=="object"&&n.length?(o||(o=n.map(x=>ZV(x)).join(", ")),JM.error("Accessor#set",`'${l}' is not a valid value for this property, value must be one of ${o}`)):JM.error("Accessor#set",`'${l}' is not a valid value for this property`),c&&(c.valid=!1),null)}}function zy(t,e){if(arguments.length===2)return zy(t).call(null,e);const i={},r=[],n=[];for(const c in t.typeMap){const f=t.typeMap[c];i[c]=$s(f),r.push(ZV(f)),n.push(c)}const s=()=>`'${r.join("', '")}'`,o=()=>`'${n.join("', '")}'`,l=typeof t.key=="string"?c=>c[t.key]:t.key;return c=>{if(t.base&&!Jk(t.base,c)||c==null)return c;const f=l(c)||t.defaultKeyValue,_=i[f];if(!_)return JM.error("Accessor#set",`Invalid property value, value needs to be one of ${s()}, or a plain object that can autocast (having .type = ${o()})`),null;if(!Jk(t.typeMap[f],c))return c;if(typeof t.key=="string"&&!ESe(c)){const x={};for(const T in c)T!==t.key&&(x[T]=c[T]);return _(x)}return _(c)}}let $n=class{};const RYt={native:t=>({type:"native",value:t}),array:t=>({type:"array",value:t}),oneOf:t=>({type:"one-of",values:t})};function eHe(t){if(!t||!("type"in t))return!1;switch(t.type){case"native":case"array":case"one-of":return!0}return!1}function OSe(t){switch(t.type){case"native":return $s(t.value);case"array":return tL(OSe(t.value));case"one-of":return tHe(t);default:return null}}function tHe(t){let e=null;return(i,r)=>oZ(i,t)?i:(e==null&&(e=sZ(t)),JM.error("Accessor#set",`Invalid property value, value needs to be of type ${e}`),r&&(r.valid=!1),null)}function sZ(t){switch(t.type){case"native":switch(t.value){case Number:return"number";case String:return"string";case Boolean:return"boolean";case $n:return"integer";case Date:return"date";default:return ZV(t.value)}case"array":return`array of ${sZ(t.value)}`;case"one-of":{const e=t.values.map(i=>sZ(i));return`one of ${e.slice(0,-1)} or ${e[e.length-1]}`}}return"unknown"}function oZ(t,e){if(t==null)return!0;switch(e.type){case"native":switch(e.value){case Number:case $n:return typeof t=="number";case Boolean:return typeof t=="boolean";case String:return typeof t=="string"}return t instanceof e.value;case"array":return!!Array.isArray(t)&&!t.some(i=>!oZ(i,e.value));case"one-of":return e.values.some(i=>oZ(t,i))}}function w(t={}){return(e,i)=>{if(e===Function.prototype)throw new Error(`Inappropriate use of @property() on a static field: ${e.name}.${i}. Accessor does not support static properties.`);const r=Object.getOwnPropertyDescriptor(e,i),n=f9(e,i);r&&(r.get||r.set?(n.get=r.get||n.get,n.set=r.set||n.set):"value"in r&&("value"in t&&Ce.getLogger("esri.core.accessorSupport.decorators.property").warn(`@property() will redefine the value of "${i}" on "${e.constructor.name}" already defined in the metadata`,t),n.value=t.value=r.value)),t.readOnly!=null&&(n.readOnly=t.readOnly);const s=t.aliasOf;if(s){const c=typeof s=="string"?s:s.source,f=typeof s=="string"?null:s.overridable===!0;let _;n.dependsOn=[c],n.get=function(){let x=au(this,c);if(typeof x=="function"){_||(_=c.split(".").slice(0,-1).join("."));const T=au(this,_);T&&(x=x.bind(T))}return x},n.readOnly||(n.set=f?function(x){this._override(i,x)}:function(x){Gk(this,c,x)})}const o=t.type,l=t.types;n.cast||(o?n.cast=iHe(o):l&&(Array.isArray(l)?n.cast=tL(zy(l[0])):n.cast=zy(l))),Zje(n,t),t.range&&(n.cast=rHe(n.cast,t.range))}}function tne(t,e,i){const r=f9(t,i);r.json||(r.json={});let n=r.json;return e!==void 0&&(n.origins||(n.origins={}),n.origins[e]||(n.origins[e]={}),n=n.origins[e]),n}function iHe(t){let e=0,i=t;if(eHe(t))return OSe(t);for(;Array.isArray(i)&&i.length===1&&typeof i[0]!="string"&&typeof i[0]!="number";)i=i[0],e++;const r=i;if(MSe(r))return e===0?nZ(r):Kk(nZ(r),e);if(e===1)return KGe(r);if(e>1)return QGe(r,e);const n=t;return n.from?n.from:$s(n)}function rHe(t,e){return i=>{let r=+t(i);return e.step!=null&&(r=Math.round(r/e.step)*e.step),e.min!=null&&(r=Math.max(e.min,r)),e.max!=null&&(r=Math.min(e.max,r)),r}}function nHe(t){if(t.json&&t.json.origins){const e=t.json.origins,i={"web-document":["web-scene","web-map"]};for(const r in i)if(e[r]){const n=e[r];i[r].forEach(s=>{e[s]=n}),delete e[r]}}}let Uf=class extends uSe{constructor(e,i,r){super(e,i,r)}};Uf.prototype.type="warning";function PSe(t){var e;return!!t&&((e=t.prototype)==null?void 0:e.declaredClass)&&t.prototype.declaredClass.indexOf("esri.core.Collection")===0}const aZ=Ce.getLogger("esri.core.accessorSupport.extensions.serializableProperty.reader");function mhe(t,e,i){var r,n;t&&(!i&&!e.read||(r=e.read)!=null&&r.reader||((n=e.read)==null?void 0:n.enabled)===!1||aHe(t)&&sE("read.reader",Z5(t),e))}function Z5(t){var i,r;const e=t.ndimArray??0;if(e>1)return oHe(t);if(e===1)return ghe(t);if("type"in t&&ISe(t.type)){const n=(r=(i=t.type.prototype)==null?void 0:i.itemType)==null?void 0:r.Type,s=ghe(typeof n=="function"?{type:n}:{types:n});return(o,l,c)=>{const f=s(o,l,c);return f&&new t.type(f)}}return ine(t)}function ine(t){return"type"in t?sHe(t.type):lHe(t.types)}function sHe(t){return t.prototype.read?(e,i,r)=>{if(e==null)return e;const n=typeof e;if(n!=="object")return void aZ.error(`Expected JSON value of type 'object' to deserialize type '${t.prototype.declaredClass}', but got '${n}'`);const s=new t;return s.read(e,r),s}:t.fromJSON}function RSe(t,e,i,r){return r!==0&&Array.isArray(e)?e.map(n=>RSe(t,n,i,r-1)):t(e,void 0,i)}function oHe(t){const e=ine(t),i=RSe.bind(null,e),r=t.ndimArray??0;return(n,s,o)=>{if(n==null)return n;n=i(n,o,r);let l=r,c=n;for(;l>0&&Array.isArray(c);)l--,c=c[0];if(c!==void 0)for(let f=0;f{if(i==null)return i;if(Array.isArray(i)){const o=[];for(const l of i){const c=e(l,void 0,n);c!==void 0&&o.push(c)}return o}const s=e(i,void 0,n);return s!==void 0?[s]:void 0}}function ISe(t){if(!PSe(t))return!1;const e=t.prototype.itemType;return!(!e||!e.Type)&&(typeof e.Type=="function"?rne(e.Type):$Se(e.Type))}function aHe(t){return"types"in t?$Se(t.types):rne(t.type)}function rne(t){return!Array.isArray(t)&&!!t&&t.prototype&&("read"in t.prototype||"fromJSON"in t||ISe(t))}function $Se(t){for(const e in t.typeMap)if(!rne(t.typeMap[e]))return!1;return!0}function lHe(t){let e=null;const i=t.errorContext??"type",r=t.validate;return(n,s,o)=>{if(n==null)return n;const l=typeof n;if(l!=="object")return void aZ.error(`Expected JSON value of type 'object' to deserialize, but got '${l}'`);e||(e=cHe(t));const c=t.key;if(typeof c!="string")return;const f=n[c],_=f?e[f]:t.defaultKeyValue?t.typeMap[t.defaultKeyValue]:void 0;if(!_){const T=`Type '${f||"unknown"}' is not supported`;return o!=null&&o.messages&&n&&o.messages.push(new Uf(`${i}:unsupported`,T,{definition:n,context:o})),void aZ.error(T)}const x=new _;return x.read(n,o),r?r(x):x}}function cHe(t){var i,r;const e={};for(const n in t.typeMap){const s=t.typeMap[n],o=p9(s.prototype);if(typeof t.key=="function")continue;const l=o[t.key];if(!l)continue;(i=l.json)!=null&&i.type&&Array.isArray(l.json.type)&&l.json.type.length===1&&typeof l.json.type[0]=="string"&&(e[l.json.type[0]]=s);const c=(r=l.json)==null?void 0:r.write;if(!(c!=null&&c.writer)){e[n]=s;continue}const f=c.target,_=typeof f=="string"?f:t.key,x={};c.writer(n,x,_),x[_]&&(e[x[_]]=s)}return e}function uHe(t){if(t.json||(t.json={}),vhe(t.json),_he(t.json),yhe(t.json),t.json.origins)for(const e in t.json.origins)vhe(t.json.origins[e]),_he(t.json.origins[e]),yhe(t.json.origins[e]);return!0}function yhe(t){t.name&&(t.read&&typeof t.read=="object"?t.read.source===void 0&&(t.read.source=t.name):t.read={source:t.name},t.write&&typeof t.write=="object"?t.write.target===void 0&&(t.write.target=t.name):t.write={target:t.name})}function vhe(t){typeof t.read=="boolean"?t.read={enabled:t.read}:typeof t.read=="function"?t.read={enabled:!0,reader:t.read}:t.read&&typeof t.read=="object"&&t.read.enabled===void 0&&(t.read.enabled=!0)}function _he(t){typeof t.write=="boolean"?t.write={enabled:t.write}:typeof t.write=="function"?t.write={enabled:!0,writer:t.write}:t.write&&typeof t.write=="object"&&t.write.enabled===void 0&&(t.write.enabled=!0)}function bhe(t,e){if(!e.write||e.write.writer||e.write.enabled===!1&&!e.write.overridePolicy)return;const i=(t==null?void 0:t.ndimArray)??0;t&&(i===1||"type"in t&&PSe(t.type))?e.write.writer=pHe:i>1?e.write.writer=fHe(i):e.types?Array.isArray(e.types)?e.write.writer=dHe(e.types[0]):e.write.writer=hHe(e.types):e.write.writer=iL}function hHe(t){return(e,i,r,n)=>e?LSe(e,t,n)?iL(e,i,r,n):void 0:iL(e,i,r,n)}function LSe(t,e,i){for(const r in e.typeMap)if(t instanceof e.typeMap[r])return!0;if(i!=null&&i.messages){const r=e.errorContext??"type",n=`Values of type '${(typeof e.key!="function"?t[e.key]:t.declaredClass)??"Unknown"}' cannot be written`;i&&i.messages&&t&&i.messages.push(new se(`${r}:unsupported`,n,{definition:t,context:i})),Ce.getLogger("esri.core.accessorSupport.extensions.serializableProperty.writer").error(n)}return!1}function dHe(t){return(e,i,r,n)=>!e||!Array.isArray(e)?iL(e,i,r,n):iL(e.filter(s=>LSe(s,t,n)),i,r,n)}function iL(t,e,i,r){sE(i,Qk(t,r),e)}function Qk(t,e){return t&&typeof t.write=="function"?t.write({},e):t&&typeof t.toJSON=="function"?t.toJSON():typeof t=="number"?ez(t):t}function ez(t){return t===-1/0?-Number.MAX_VALUE:t===1/0?Number.MAX_VALUE:isNaN(t)?null:t}function pHe(t,e,i,r){let n;t===null?n=null:t&&typeof t.map=="function"?(n=t.map(s=>Qk(s,r)),typeof n.toArray=="function"&&(n=n.toArray())):n=[Qk(t,r)],sE(i,n,e)}function DSe(t,e,i){return i!==0&&Array.isArray(t)?t.map(r=>DSe(r,e,i-1)):Qk(t,e)}function fHe(t){return(e,i,r,n)=>{let s;if(e===null)s=null;else{s=DSe(e,n,t);let o=t,l=s;for(;o>0&&Array.isArray(l);)o--,l=l[0];if(l!==void 0)for(let c=0;c{t??(t="esri.core.Accessor"),e.prototype.declaredClass=t,wHe(e);const i=[],r=[];let n=e.prototype;for(;n;)n.hasOwnProperty("initialize")&&!KG.has(n.initialize)&&(KG.add(n.initialize),i.push(n.initialize)),n.hasOwnProperty("destroy")&&!QG.has(n.destroy)&&(QG.add(n.destroy),r.push(n.destroy)),n=Object.getPrototypeOf(n);KG.clear(),QG.clear();const s=class extends e{constructor(...l){if(super(...l),this.constructor===s&&typeof this.postscript=="function"){if(i.length&&Object.defineProperty(this,"initialize",{enumerable:!1,configurable:!0,value(){for(let c=i.length-1;c>=0;c--)i[c].call(this)}}),r.length){let c=!1;const f=this[Q3e];Object.defineProperty(this,"destroy",{enumerable:!1,configurable:!0,value(){if(!c){c=!0,f.call(this);for(let _=0;_0&&this.normalizeCtorArgs&&(i.ctorArgs=this.normalizeCtorArgs.apply(this,e))}postscript(e){const i=this.__accessor__,r=i.ctorArgs||e;i.initialize(),r&&(this.set(r),i.ctorArgs=null),i.constructed(),this.initialize(),this[uZ]=!0}initialize(){}[Q3e](){this[kb]=et(this[kb])}destroy(){var e;this.destroyed||(kGe(this),this.__accessor__.destroy(),(e=mGe())==null||e.onInstanceDestroy(this))}[Symbol.dispose](){this.destroy()}get constructed(){return this.__accessor__&&this.__accessor__.initialized||!1}get initialized(){return this[uZ]}get destroyed(){return this.__accessor__&&this.__accessor__.destroyed||!1}commitProperty(e){au(this,e)}get(e){return R3e(Ce.getLogger(this),"`Accessor.get` is deprecated in favor of using optional chaining",{version:"4.28",see:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining"}),au(this,e)}hasOwnProperty(e){return this.__accessor__?this.__accessor__.has(e):Object.prototype.hasOwnProperty.call(this,e)}keys(){return this.__accessor__?this.__accessor__.keys():[]}set(e,i){return Gk(this,e,i),this}watch(e,i,r){return jGe(this,e,i,r)}addHandles(e,i){if(this.destroyed){const n=Array.isArray(e)?e:[e];for(const s of n)s.remove();return}let r=this[kb];r==null&&(r=this[kb]=new O_),r.add(e,i)}removeHandles(e){const i=this[kb];i!=null&&i.remove(e)}removeAllHandles(){const e=this[kb];e!=null&&e.removeAll()}hasHandles(e){const i=this[kb];return i!=null&&i.has(e)}_override(e,i){i===void 0?this.__accessor__.clearOverride(e):this.__accessor__.override(e,i)}_clearOverride(e){return this.__accessor__.clearOverride(e)}_overrideIfSome(e,i){i==null?this.__accessor__.clearOverride(e):this.__accessor__.override(e,i)}_isOverridden(e){return this.__accessor__.isOverridden(e)}notifyChange(e){this.__accessor__.notifyChange(e)}_get(e){return this.__accessor__.internalGet(e)}_set(e,i){return this.__accessor__.internalSet(e,i),this}};kSe=kb,zSe=uZ;let sA=class extends ze{constructor(e){super(e),this.format=null,this.position={coordinate:null,location:null}}get displayCoordinate(){var e,i;return(i=this.format)==null?void 0:i.getDisplayCoordinate((e=this.position)==null?void 0:e.coordinate)}};y([w({readOnly:!0})],sA.prototype,"displayCoordinate",null),y([w()],sA.prototype,"format",void 0),y([w()],sA.prototype,"position",void 0),sA=y([Z("esri.widgets.CoordinateConversion.support.Conversion")],sA);const BS=sA,SHe="modulepreload",THe=function(t){return"/elb-js-api/"+t},whe={},we=function(e,i,r){let n=Promise.resolve();if(i&&i.length>0){const s=document.getElementsByTagName("link");n=Promise.all(i.map(o=>{if(o=THe(o),o in whe)return;whe[o]=!0;const l=o.endsWith(".css"),c=l?'[rel="stylesheet"]':"";if(!!r)for(let x=s.length-1;x>=0;x--){const T=s[x];if(T.href===o&&(!l||T.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${c}`))return;const _=document.createElement("link");if(_.rel=l?"stylesheet":SHe,l||(_.as="script",_.crossOrigin=""),_.href=o,document.head.appendChild(_),l)return new Promise((x,T)=>{_.addEventListener("load",x),_.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${o}`)))})}))}return n.then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function JV(t,e,i){return Uv(t.map((r,n)=>e.apply(i,[r,n])))}async function EHe(t,e,i){return(await Uv(t.map((r,n)=>e.apply(i,[r,n])))).map(r=>r.value)}function sne(t){return{ok:!0,value:t}}function one(t){return{ok:!1,error:t}}function CHe(t){return t!=null&&t.ok===!0?t.value:null}function AHe(t){return t!=null&&t.ok===!1?t.error:null}async function Ju(t){if(t==null)return{ok:!1,error:new Error("no promise provided")};try{return sne(await t)}catch(e){return one(e)}}async function MHe(t){try{return sne(await t)}catch(e){return zo(e),one(e)}}function LYt(t){if(t.ok===!0)return t.value;throw t.error}function Cc(t,e){return new zb(t,e)}let zb=class extends ze{get value(){return CHe(this._result)}get error(){return AHe(this._result)}get finished(){return this._result!=null}constructor(e,i){super({}),this._result=null,this._abortHandle=null,this.abort=()=>{this._abortController=gn(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:r}=this._abortController;this.promise=e(r),this.promise.then(n=>{this._result=sne(n),this._cleanup()},n=>{this._result=one(n),this._cleanup()}),this._abortHandle=Yl(i,this.abort)}normalizeCtorArgs(){return{}}destroy(){this.abort()}_cleanup(){this._abortHandle=en(this._abortHandle),this._abortController=null}};y([w()],zb.prototype,"value",null),y([w()],zb.prototype,"error",null),y([w()],zb.prototype,"finished",null),y([w()],zb.prototype,"promise",void 0),y([w()],zb.prototype,"_result",void 0),zb=y([Z("esri.core.asyncUtils.ReactiveTask")],zb);let f7=class VSe{constructor(){this._emitter=new VSe.EventEmitter(this)}emit(e,i){return this._emitter.emit(e,i)}on(e,i){return this._emitter.on(e,i)}once(e,i){return this._emitter.once(e,i)}hasEventListener(e){return this._emitter.hasEventListener(e)}};(function(t){class e{constructor(n=null){this._target=n,this._listenersMap=null}clear(){var n;(n=this._listenersMap)==null||n.clear(),this._listenersMap=null}destroy(){this.clear()}emit(n,s){var f;let o=(f=this._listenersMap)==null?void 0:f.get(n);if(!o)return!1;const l=this._target||this;let c=!1;for(const _ of o.slice()){const x="deref"in _?_.deref():_;x?x==null||x.call(l,s):c=!0}return c&&(o=o.filter(_=>!("deref"in _)||_.deref()!=null),this._listenersMap.set(n,o)),o.length>0}on(n,s){if(Array.isArray(n)){const l=n.map(c=>this.on(c,s));return id(l)}if(n.includes(","))throw new TypeError("Evented.on() with a comma delimited string of event types is not supported");this._listenersMap??(this._listenersMap=new Map);const o=this._listenersMap.get(n)||[];return o.push(s),this._listenersMap.set(n,o),rr(()=>{var f;const l=(f=this._listenersMap)==null?void 0:f.get(n),c=(l==null?void 0:l.indexOf(s))??-1;c>=0&&l.splice(c,1)})}once(n,s){const o=this.on(n,l=>{o.remove();const c="deref"in s?s.deref():s;c==null||c.call(null,l)});return o}hasEventListener(n){var o;const s=(o=this._listenersMap)==null?void 0:o.get(n);return s!=null&&s.length>0}}t.EventEmitter=e,t.EventedMixin=r=>{let n=class extends r{constructor(){super(...arguments),this._emitter=new e}destroy(){this._emitter.clear()}emit(s,o){return this._emitter.emit(s,o)}on(s,o){return this._emitter.on(s,o)}once(s,o){return this._emitter.once(s,o)}hasEventListener(s){return this._emitter.hasEventListener(s)}};return n=y([Z("esri.core.Evented")],n),n};let i=class extends ze{constructor(){super(...arguments),this._emitter=new f7.EventEmitter(this)}destroy(){this._emitter.clear()}emit(r,n){return this._emitter.emit(r,n)}on(r,n){return this._emitter.on(r,n)}once(r,n){return this._emitter.once(r,n)}hasEventListener(r){return this._emitter.hasEventListener(r)}};i=y([Z("esri.core.Evented")],i),t.EventedAccessor=i})(f7||(f7={}));const Dn=f7;var wn;(function(t){t[t.ADD=1]="ADD",t[t.REMOVE=2]="REMOVE",t[t.MOVE=4]="MOVE"})(wn||(wn={}));function BSe(t){return(e,i)=>{e[i]=t}}let v9=class extends nSe{notify(){const e=this._observers;if(e&&e.length>0){const i=e.slice();for(const r of i)r.onInvalidated(),r.onCommitted()}}};var Ov;let OHe=class{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}},PHe=class{constructor(e,i,r,n,s){this.target=e,this.added=i,this.removed=r,this.start=n,this.deleteCount=s}};const Mp=new Ec(OHe,void 0,t=>{t.item=null,t.target=null,t.defaultPrevented=!1,t.cancellable=!1});function eH(t){return t?t instanceof wS?t.toArray():t.length?Array.prototype.slice.apply(t):[]:[]}function tH(t){if(t!=null&&t.length)return t[0]}function RHe(t,e,i,r){const n=Math.min(t.length-i,e.length-r);let s=0;for(;s{t.push(n),jSe(t,i.call(r,n,s,o),i,r)})}const J_=new Set,K_=new Set,Q_=new Set,iH=new Map;let IHe=0,wS=Ov=class extends Dn.EventedAccessor{static isCollection(t){return t!=null&&t instanceof Ov}constructor(t){super(t),this._chgListeners=[],this._notifications=null,this._timer=null,this._observable=new v9,this.length=0,this._items=[],Object.defineProperty(this,"uid",{value:IHe++})}normalizeCtorArgs(t){return t?Array.isArray(t)||t instanceof Ov?{items:t}:t:{}}destroy(){this._removeAllRaw()}*[Symbol.iterator](){yield*this.items}get items(){return wi(this._observable),this._items}set items(t){this._emitBeforeChanges(wn.ADD)||(this._splice(0,this.length,eH(t)),this._emitAfterChanges(wn.ADD))}hasEventListener(t){return t==="change"?this._chgListeners.length>0:this._emitter.hasEventListener(t)}on(t,e){if(t==="change"){const i=this._chgListeners,r={removed:!1,callback:e};return i.push(r),this._notifications&&this._notifications.push({listeners:i.slice(),items:this._items.slice(),changes:[]}),rr(()=>{r.removed=!0,i.splice(i.indexOf(r),1)})}return this._emitter.on(t,e)}once(t,e){const i="deref"in e?()=>e.deref():()=>e,r=this.on(t,n=>{var s;(s=i())==null||s.call(null,n),r.remove()});return r}add(t,e){if(wi(this._observable),this._emitBeforeChanges(wn.ADD))return this;const i=this.getNextIndex(e??null);return this._splice(i,0,[t]),this._emitAfterChanges(wn.ADD),this}addMany(t,e=this._items.length){if(wi(this._observable),!(t!=null&&t.length))return this;if(this._emitBeforeChanges(wn.ADD))return this;const i=this.getNextIndex(e);return this._splice(i,0,eH(t)),this._emitAfterChanges(wn.ADD),this}at(t){if(wi(this._observable),(t=Math.trunc(t)||0)<0&&(t+=this.length),!(t<0||t>=this.length))return this._items[t]}removeAll(){if(wi(this._observable),!this.length||this._emitBeforeChanges(wn.REMOVE))return[];const t=this._removeAllRaw();return this._emitAfterChanges(wn.REMOVE),t}_removeAllRaw(){return this.length===0?[]:this._splice(0,this.length)||[]}clone(){return wi(this._observable),this._createNewInstance({items:this._items.map(Re)})}concat(...t){wi(this._observable);const e=t.map(eH);return this._createNewInstance({items:this._items.concat(...e)})}drain(t,e){if(wi(this._observable),!this.length||this._emitBeforeChanges(wn.REMOVE))return;const i=this._splice(0,this.length),r=i.length;for(let n=0;ne&&(t=e),t}includes(t,e=0){return wi(this._observable),this._items.includes(t,e)}indexOf(t,e=0){return wi(this._observable),this._items.indexOf(t,e)}join(t=","){return wi(this._observable),this._items.join(t)}lastIndexOf(t,e=this.length-1){return wi(this._observable),this._items.lastIndexOf(t,e)}map(t,e){wi(this._observable);const i=this._items.map(t,e);return new Ov({items:i})}reorder(t,e=this.length-1){wi(this._observable);const i=this.indexOf(t);if(i!==-1){if(e<0?e=0:e>=this.length&&(e=this.length-1),i!==e){if(this._emitBeforeChanges(wn.MOVE))return t;this._splice(i,1),this._splice(e,0,[t]),this._emitAfterChanges(wn.MOVE)}return t}}pop(){if(wi(this._observable),!this.length||this._emitBeforeChanges(wn.REMOVE))return;const t=tH(this._splice(this.length-1,1));return this._emitAfterChanges(wn.REMOVE),t}push(...t){return wi(this._observable),this._emitBeforeChanges(wn.ADD)||(this._splice(this.length,0,t),this._emitAfterChanges(wn.ADD)),this.length}reduce(t,e){wi(this._observable);const i=this._items;return arguments.length===2?i.reduce(t,e):i.reduce(t)}reduceRight(t,e){wi(this._observable);const i=this._items;return arguments.length===2?i.reduceRight(t,e):i.reduceRight(t)}remove(t){return wi(this._observable),this.removeAt(this.indexOf(t))}removeAt(t){if(wi(this._observable),t<0||t>=this.length||this._emitBeforeChanges(wn.REMOVE))return;const e=tH(this._splice(t,1));return this._emitAfterChanges(wn.REMOVE),e}removeMany(t){if(wi(this._observable),!(t!=null&&t.length)||this._emitBeforeChanges(wn.REMOVE))return[];const e=t instanceof Ov?t.toArray():t,i=this._items,r=[],n=e.length;for(let s=0;s-1){const c=1+RHe(e,i,s+1,l+1),f=this._splice(l,c);f&&f.length>0&&r.push.apply(r,f),s+=c-1}}return this._emitAfterChanges(wn.REMOVE),r}reverse(){if(wi(this._observable),this._emitBeforeChanges(wn.MOVE))return this;const t=this._splice(0,this.length);return t&&(t.reverse(),this._splice(0,0,t)),this._emitAfterChanges(wn.MOVE),this}shift(){if(wi(this._observable),!this.length||this._emitBeforeChanges(wn.REMOVE))return;const t=tH(this._splice(0,1));return this._emitAfterChanges(wn.REMOVE),t}slice(t=0,e=this.length){return wi(this._observable),this._createNewInstance({items:this._items.slice(t,e)})}some(t,e){return wi(this._observable),this._items.some(t,e)}sort(t){if(wi(this._observable),!this.length||this._emitBeforeChanges(wn.MOVE))return this;const e=this._splice(0,this.length);return arguments.length?e.sort(t):e.sort(),this._splice(0,0,e),this._emitAfterChanges(wn.MOVE),this}splice(t,e,...i){wi(this._observable);const r=(e?wn.REMOVE:0)|(i.length?wn.ADD:0);if(this._emitBeforeChanges(r))return[];const n=this._splice(t,e,i)||[];return this._emitAfterChanges(r),n}toArray(){return wi(this._observable),this._items.slice()}toJSON(){return wi(this._observable),this.toArray()}toLocaleString(){return wi(this._observable),this._items.toLocaleString()}toString(){return wi(this._observable),this._items.toString()}unshift(...t){return wi(this._observable),!t.length||this._emitBeforeChanges(wn.ADD)||(this._splice(0,0,t),this._emitAfterChanges(wn.ADD)),this.length}_createNewInstance(t){return new this.constructor(t)}_splice(t,e,i){const r=this._items,n=this.itemType;let s,o;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._timer=tx(()=>this._dispatchChange())),t<0&&(t+=this.length),e){if(o=r.splice(t,e),this.hasEventListener("before-remove")){const l=Mp.acquire();l.target=this,l.cancellable=!0;for(let c=0,f=o.length;c{r.push(c)});const n=Uh.acquire();K_.forEach(c=>{n.push(c)});const s=this._items,o=e.items,l=Uh.acquire();if(Q_.forEach(c=>{o.indexOf(c)!==s.indexOf(c)&&l.push(c)}),e.listeners&&(r.length||n.length||l.length)){const c={target:this,added:r,removed:n,moved:l},f=e.listeners.length;for(let _=0;_{if(!t)return Ov;if(iH.has(t))return iH.get(t);let e=null;if(typeof t=="function")e=t.prototype.declaredClass;else if(t.base)e=t.base.prototype.declaredClass;else for(const r in t.typeMap){const n=t.typeMap[r].prototype.declaredClass;e?e+=` | ${n}`:e=n}let i=class extends Ov{};return y([BSe({Type:t,ensureType:typeof t=="function"?$s(t):zy(t)})],i.prototype,"itemType",void 0),i=y([Z(`esri.core.Collection<${e}>`)],i),iH.set(t,i),i},y([w()],wS.prototype,"length",void 0),y([w()],wS.prototype,"items",null),wS=Ov=y([Z("esri.core.Collection")],wS);const it=wS;function _e(t,e,i={}){return ane(t,e,i,GSe)}function Mo(t,e,i={}){return ane(t,e,i,HSe)}function ane(t,e,i={},r){let n=null;const s=i.once?(o,l)=>{r(o)&&(en(n),e(o,l))}:(o,l)=>{r(o)&&e(o,l)};if(n=qGe(t,s,i.sync,i.equals),i.initial){const o=t();s(o,o)}return n}function Jr(t,e,i,r={}){let n=null,s=null,o=null;function l(){var _;n&&s&&(s.remove(),(_=r.onListenerRemove)==null||_.call(r,n),n=null,s=null)}function c(_){r.once&&r.once&&en(o),i(_)}const f=_e(t,(_,x)=>{var T;l(),qV(_)&&(n=_,s=Y5(_,e,c),(T=r.onListenerAdd)==null||T.call(r,_))},{sync:r.sync,initial:!0});return o=rr(()=>{f.remove(),l()}),o}function rd(t,e){return $He(t,HSe,e)}function $He(t,e,i){if(xo(i))return Promise.reject(ur());const r=t();if(e!=null&&e(r))return Promise.resolve(r);let n=null;function s(){n=en(n)}return new Promise((o,l)=>{n=id([Yl(i,()=>{s(),l(ur())}),ane(t,c=>{s(),o(c)},{sync:!1,once:!0},e??GSe)])})}function GSe(t){return!0}function HSe(t){return!!t}function LHe(t,e,i={}){let r=!1;const n=_e(t,(s,o)=>{r||e(s,o)},i);return{remove(){n.remove()},pause(){r=!0},resume(){r=!1}}}function DHe(t,e){const i=new it,r=Jr(t,"after-splice",({added:n,start:s,deleteCount:o})=>{const l=i.splice(s,o);for(const c of l)c.remove();if(n!=null&&n.length){const c=n.map(e);i.addMany(c,s)}},{sync:!0,onListenerRemove:()=>i.drain(n=>n.remove()),onListenerAdd:n=>i.addMany(n.items.map(e))});return i.addHandles(r),i}function NHe(t,e){const i=new it,r=DHe(t,l=>Cc(async c=>{const f=await e(l,c);if(xo(c))throw f.remove(),ur();return f})),n=()=>null,s=async l=>{const c=await l.promise,f=r.indexOf(l);f<0||i.splice(f,1,c)};i.addMany(r.items.map(n));for(const l of r)$m(s(l));const o=r.on("after-splice",({added:l,start:c,deleteCount:f})=>{const _=i.splice(c,f);for(const x of _)x==null||x.remove();if(l!=null&&l.length){i.addMany(l.map(n),c);for(const x of l)$m(s(x))}});return i.addHandles([Jre(r),o]),i}const Li={sync:!0},ii={initial:!0},kt={sync:!0,initial:!0};let yn=class{constructor(e,i={ignoreUnknown:!1,useNumericKeys:!1}){this._jsonToAPI=e,this._options=i,this.apiValues=[],this.jsonValues=[],this._apiToJSON=this._invertMap(e),this.apiValues=this._getKeysSorted(this._apiToJSON),this.jsonValues=this._getKeysSorted(this._jsonToAPI),this.read=r=>this.fromJSON(r),this.write=(r,n,s)=>{const o=this.toJSON(r);o!==void 0&&sE(s,o,n)},this.write.isJSONMapWriter=!0}toJSON(e){if(e==null)return null;if(this._apiToJSON.hasOwnProperty(e)){const i=this._apiToJSON[e];return this._options.useNumericKeys?+i:i}return this._options.ignoreUnknown?void 0:e}fromJSON(e){return e!=null&&this._jsonToAPI.hasOwnProperty(e)?this._jsonToAPI[e]:this._options.ignoreUnknown?void 0:e}_invertMap(e){const i={};for(const r in e)i[e[r]]=r;return i}_getKeysSorted(e){const i=[];for(const r in e)i.push(r);return i.sort(),i}};function fu(){return function(t,e){return new yn(t,{ignoreUnknown:!0,...e})}}let BI;var M3e,O3e;const FHe=((M3e=globalThis.esriConfig)==null?void 0:M3e.locale)??((O3e=globalThis.dojoConfig)==null?void 0:O3e.locale);function qSe(){var t;return FHe??((t=globalThis.navigator)==null?void 0:t.language)??"en"}function fa(){return BI===void 0&&(BI=qSe()),BI}function lne(t=fa()){const e=/^([a-zA-Z]{2,3})(?:[_\-]\w+)*$/.exec(t);return e==null?void 0:e[1].toLowerCase()}const jI=[];function oE(t){return jI.push(t),rr(()=>jI.splice(jI.indexOf(t),1))}const hZ=[];function cne(t){return hZ.push(t),rr(()=>jI.splice(hZ.indexOf(t),1))}function kHe(){const t=qSe();BI!==t&&(BI=t,[...hZ].forEach(e=>{e.call(null,t)}),[...jI].forEach(e=>{e.call(null,t)}))}var P3e;(P3e=globalThis.addEventListener)==null||P3e.call(globalThis,"languagechange",kHe);const xhe=new Map([["AUS Central Standard Time","Australia/Darwin"],["AUS Eastern Standard Time","Australia/Sydney"],["Afghanistan Standard Time","Asia/Kabul"],["Alaskan Standard Time","America/Anchorage"],["Aleutian Standard Time","America/Adak"],["Altai Standard Time","Asia/Barnaul"],["Arab Standard Time","Asia/Riyadh"],["Arabian Standard Time","Asia/Dubai"],["Arabic Standard Time","Asia/Baghdad"],["Argentina Standard Time","America/Buenos_Aires"],["Astrakhan Standard Time","Europe/Astrakhan"],["Atlantic Standard Time","America/Halifax"],["Aus Central W. Standard Time","Australia/Eucla"],["Azerbaijan Standard Time","Asia/Baku"],["Azores Standard Time","Atlantic/Azores"],["Bahia Standard Time","America/Bahia"],["Bangladesh Standard Time","Asia/Dhaka"],["Belarus Standard Time","Europe/Minsk"],["Bougainville Standard Time","Pacific/Bougainville"],["Canada Central Standard Time","America/Regina"],["Cape Verde Standard Time","Atlantic/Cape_Verde"],["Caucasus Standard Time","Asia/Yerevan"],["Cen. Australia Standard Time","Australia/Adelaide"],["Central America Standard Time","America/Guatemala"],["Central Asia Standard Time","Asia/Almaty"],["Central Brazilian Standard Time","America/Cuiaba"],["Central Europe Standard Time","Europe/Budapest"],["Central European Standard Time","Europe/Warsaw"],["Central Pacific Standard Time","Pacific/Guadalcanal"],["Central Standard Time","America/Chicago"],["Central Standard Time (Mexico)","America/Mexico_City"],["Chatham Islands Standard Time","Pacific/Chatham"],["China Standard Time","Asia/Shanghai"],["Cuba Standard Time","America/Havana"],["Dateline Standard Time","Etc/GMT+12"],["E. Africa Standard Time","Africa/Nairobi"],["E. Australia Standard Time","Australia/Brisbane"],["E. Europe Standard Time","Europe/Chisinau"],["E. South America Standard Time","America/Sao_Paulo"],["Easter Island Standard Time","Pacific/Easter"],["Eastern Standard Time","America/New_York"],["Eastern Standard Time (Mexico)","America/Cancun"],["Egypt Standard Time","Africa/Cairo"],["Ekaterinburg Standard Time","Asia/Yekaterinburg"],["FLE Standard Time","Europe/Kiev"],["Fiji Standard Time","Pacific/Fiji"],["GMT Standard Time","Europe/London"],["GTB Standard Time","Europe/Bucharest"],["Georgian Standard Time","Asia/Tbilisi"],["Greenland Standard Time","America/Godthab"],["Greenwich Standard Time","Atlantic/Reykjavik"],["Haiti Standard Time","America/Port-au-Prince"],["Hawaiian Standard Time","Pacific/Honolulu"],["India Standard Time","Asia/Calcutta"],["Iran Standard Time","Asia/Tehran"],["Israel Standard Time","Asia/Jerusalem"],["Jordan Standard Time","Asia/Amman"],["Kaliningrad Standard Time","Europe/Kaliningrad"],["Korea Standard Time","Asia/Seoul"],["Libya Standard Time","Africa/Tripoli"],["Line Islands Standard Time","Pacific/Kiritimati"],["Lord Howe Standard Time","Australia/Lord_Howe"],["Magadan Standard Time","Asia/Magadan"],["Magallanes Standard Time","America/Punta_Arenas"],["Marquesas Standard Time","Pacific/Marquesas"],["Mauritius Standard Time","Indian/Mauritius"],["Middle East Standard Time","Asia/Beirut"],["Montevideo Standard Time","America/Montevideo"],["Morocco Standard Time","Africa/Casablanca"],["Mountain Standard Time","America/Denver"],["Mountain Standard Time (Mexico)","America/Mazatlan"],["Myanmar Standard Time","Asia/Rangoon"],["N. Central Asia Standard Time","Asia/Novosibirsk"],["Namibia Standard Time","Africa/Windhoek"],["Nepal Standard Time","Asia/Katmandu"],["New Zealand Standard Time","Pacific/Auckland"],["Newfoundland Standard Time","America/St_Johns"],["Norfolk Standard Time","Pacific/Norfolk"],["North Asia East Standard Time","Asia/Irkutsk"],["North Asia Standard Time","Asia/Krasnoyarsk"],["North Korea Standard Time","Asia/Pyongyang"],["Omsk Standard Time","Asia/Omsk"],["Pacific SA Standard Time","America/Santiago"],["Pacific Standard Time","America/Los_Angeles"],["Pacific Standard Time (Mexico)","America/Tijuana"],["Pakistan Standard Time","Asia/Karachi"],["Paraguay Standard Time","America/Asuncion"],["Qyzylorda Standard Time","Asia/Qyzylorda"],["Romance Standard Time","Europe/Paris"],["Russia Time Zone 10","Asia/Srednekolymsk"],["Russia Time Zone 11","Asia/Kamchatka"],["Russia Time Zone 3","Europe/Samara"],["Russian Standard Time","Europe/Moscow"],["SA Eastern Standard Time","America/Cayenne"],["SA Pacific Standard Time","America/Bogota"],["SA Western Standard Time","America/La_Paz"],["SE Asia Standard Time","Asia/Bangkok"],["Saint Pierre Standard Time","America/Miquelon"],["Sakhalin Standard Time","Asia/Sakhalin"],["Samoa Standard Time","Pacific/Apia"],["Sao Tome Standard Time","Africa/Sao_Tome"],["Saratov Standard Time","Europe/Saratov"],["Singapore Standard Time","Asia/Singapore"],["South Africa Standard Time","Africa/Johannesburg"],["South Sudan Standard Time","Africa/Juba"],["Sri Lanka Standard Time","Asia/Colombo"],["Sudan Standard Time","Africa/Khartoum"],["Syria Standard Time","Asia/Damascus"],["Taipei Standard Time","Asia/Taipei"],["Tasmania Standard Time","Australia/Hobart"],["Tocantins Standard Time","America/Araguaina"],["Tokyo Standard Time","Asia/Tokyo"],["Tomsk Standard Time","Asia/Tomsk"],["Tonga Standard Time","Pacific/Tongatapu"],["Transbaikal Standard Time","Asia/Chita"],["Turkey Standard Time","Europe/Istanbul"],["Turks And Caicos Standard Time","America/Grand_Turk"],["US Eastern Standard Time","America/Indianapolis"],["US Mountain Standard Time","America/Phoenix"],["UTC","Etc/GMT"],["UTC+01","Etc/GMT-1"],["UTC+02","Etc/GMT-2"],["UTC+03","Etc/GMT-3"],["UTC+04","Etc/GMT-4"],["UTC+05","Etc/GMT-5"],["UTC+06","Etc/GMT-6"],["UTC+07","Etc/GMT-7"],["UTC+08","Etc/GMT-8"],["UTC+09","Etc/GMT-9"],["UTC+10","Etc/GMT-10"],["UTC+11","Etc/GMT-11"],["UTC+12","Etc/GMT-12"],["UTC+13","Etc/GMT-13"],["UTC+14","Etc/GMT-14"],["UTC-01","Etc/GMT+1"],["UTC-02","Etc/GMT+2"],["UTC-03","Etc/GMT+3"],["UTC-04","Etc/GMT+4"],["UTC-05","Etc/GMT+5"],["UTC-06","Etc/GMT+6"],["UTC-07","Etc/GMT+7"],["UTC-08","Etc/GMT+8"],["UTC-09","Etc/GMT+9"],["UTC-10","Etc/GMT+10"],["UTC-11","Etc/GMT+11"],["UTC-12","Etc/GMT+12"],["Ulaanbaatar Standard Time","Asia/Ulaanbaatar"],["Venezuela Standard Time","America/Caracas"],["Vladivostok Standard Time","Asia/Vladivostok"],["Volgograd Standard Time","Europe/Volgograd"],["W. Australia Standard Time","Australia/Perth"],["W. Central Africa Standard Time","Africa/Lagos"],["W. Europe Standard Time","Europe/Berlin"],["W. Mongolia Standard Time","Asia/Hovd"],["West Asia Standard Time","Asia/Tashkent"],["West Bank Standard Time","Asia/Hebron"],["West Pacific Standard Time","Pacific/Port_Moresby"],["Yakutsk Standard Time","Asia/Yakutsk"],["Yukon Standard Time","America/Whitehorse"]]);class aE extends Error{}class zHe extends aE{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class UHe extends aE{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class VHe extends aE{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class _M extends aE{}class WSe extends aE{constructor(e){super(`Invalid unit ${e}`)}}class Bh extends aE{}class eb extends aE{constructor(){super("Zone is an abstract class")}}const Ut="numeric",Lm="short",dp="long",tz={year:Ut,month:Ut,day:Ut},YSe={year:Ut,month:Lm,day:Ut},BHe={year:Ut,month:Lm,day:Ut,weekday:Lm},XSe={year:Ut,month:dp,day:Ut},ZSe={year:Ut,month:dp,day:Ut,weekday:dp},JSe={hour:Ut,minute:Ut},KSe={hour:Ut,minute:Ut,second:Ut},QSe={hour:Ut,minute:Ut,second:Ut,timeZoneName:Lm},eTe={hour:Ut,minute:Ut,second:Ut,timeZoneName:dp},tTe={hour:Ut,minute:Ut,hourCycle:"h23"},iTe={hour:Ut,minute:Ut,second:Ut,hourCycle:"h23"},rTe={hour:Ut,minute:Ut,second:Ut,hourCycle:"h23",timeZoneName:Lm},nTe={hour:Ut,minute:Ut,second:Ut,hourCycle:"h23",timeZoneName:dp},sTe={year:Ut,month:Ut,day:Ut,hour:Ut,minute:Ut},oTe={year:Ut,month:Ut,day:Ut,hour:Ut,minute:Ut,second:Ut},aTe={year:Ut,month:Lm,day:Ut,hour:Ut,minute:Ut},lTe={year:Ut,month:Lm,day:Ut,hour:Ut,minute:Ut,second:Ut},jHe={year:Ut,month:Lm,day:Ut,weekday:Lm,hour:Ut,minute:Ut},cTe={year:Ut,month:dp,day:Ut,hour:Ut,minute:Ut,timeZoneName:Lm},uTe={year:Ut,month:dp,day:Ut,hour:Ut,minute:Ut,second:Ut,timeZoneName:Lm},hTe={year:Ut,month:dp,day:Ut,weekday:dp,hour:Ut,minute:Ut,timeZoneName:dp},dTe={year:Ut,month:dp,day:Ut,weekday:dp,hour:Ut,minute:Ut,second:Ut,timeZoneName:dp};class J5{get type(){throw new eb}get name(){throw new eb}get ianaName(){return this.name}get isUniversal(){throw new eb}offsetName(e,i){throw new eb}formatOffset(e,i){throw new eb}offset(e){throw new eb}equals(e){throw new eb}get isValid(){throw new eb}}let rH=null;class KV extends J5{static get instance(){return rH===null&&(rH=new KV),rH}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:i,locale:r}){return wTe(e,i,r)}formatOffset(e,i){return GI(this.offset(e),i)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let m7={};function GHe(t){return m7[t]||(m7[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),m7[t]}const HHe={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function qHe(t,e){const i=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(i),[,n,s,o,l,c,f,_]=r;return[o,n,s,l,c,f,_]}function WHe(t,e){const i=t.formatToParts(e),r=[];for(let n=0;n=0?M:1e3+M,(T-A)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let She={};function YHe(t,e={}){const i=JSON.stringify([t,e]);let r=She[i];return r||(r=new Intl.ListFormat(t,e),She[i]=r),r}let dZ={};function pZ(t,e={}){const i=JSON.stringify([t,e]);let r=dZ[i];return r||(r=new Intl.DateTimeFormat(t,e),dZ[i]=r),r}let fZ={};function XHe(t,e={}){const i=JSON.stringify([t,e]);let r=fZ[i];return r||(r=new Intl.NumberFormat(t,e),fZ[i]=r),r}let mZ={};function ZHe(t,e={}){const{base:i,...r}=e,n=JSON.stringify([t,r]);let s=mZ[n];return s||(s=new Intl.RelativeTimeFormat(t,e),mZ[n]=s),s}let JR=null;function JHe(){return JR||(JR=new Intl.DateTimeFormat().resolvedOptions().locale,JR)}let The={};function KHe(t){let e=The[t];if(!e){const i=new Intl.Locale(t);e="getWeekInfo"in i?i.getWeekInfo():i.weekInfo,The[t]=e}return e}function QHe(t){const e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));const i=t.indexOf("-u-");if(i===-1)return[t];{let r,n;try{r=pZ(t).resolvedOptions(),n=t}catch{const c=t.substring(0,i);r=pZ(c).resolvedOptions(),n=c}const{numberingSystem:s,calendar:o}=r;return[n,s,o]}}function eqe(t,e,i){return(i||e)&&(t.includes("-u-")||(t+="-u"),i&&(t+=`-ca-${i}`),e&&(t+=`-nu-${e}`)),t}function tqe(t){const e=[];for(let i=1;i<=12;i++){const r=$i.utc(2009,i,1);e.push(t(r))}return e}function iqe(t){const e=[];for(let i=1;i<=7;i++){const r=$i.utc(2016,11,13+i);e.push(t(r))}return e}function M6(t,e,i,r){const n=t.listingMode();return n==="error"?null:n==="en"?i(e):r(e)}function rqe(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}class nqe{constructor(e,i,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:n,floor:s,...o}=r;if(!i||Object.keys(o).length>0){const l={useGrouping:!1,...r};r.padTo>0&&(l.minimumIntegerDigits=r.padTo),this.inf=XHe(e,l)}}format(e){if(this.inf){const i=this.floor?Math.floor(e):e;return this.inf.format(i)}else{const i=this.floor?Math.floor(e):pne(e,3);return ja(i,this.padTo)}}}class sqe{constructor(e,i,r){this.opts=r,this.originalZone=void 0;let n;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),l=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&wp.create(l).valid?(n=l,this.dt=e):(n="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||n,this.dtf=pZ(i,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(i=>{if(i.type==="timeZoneName"){const r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...i,value:r}}else return i}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class oqe{constructor(e,i,r){this.opts={style:"long",...r},!i&&_Te()&&(this.rtf=ZHe(e,r))}format(e,i){return this.rtf?this.rtf.format(e,i):Cqe(i,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,i){return this.rtf?this.rtf.formatToParts(e,i):[]}}const aqe={firstDay:1,minimalDays:4,weekend:[6,7]};class As{static fromOpts(e){return As.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,i,r,n,s=!1){const o=e||xa.defaultLocale,l=o||(s?"en-US":JHe()),c=i||xa.defaultNumberingSystem,f=r||xa.defaultOutputCalendar,_=gZ(n)||xa.defaultWeekSettings;return new As(l,c,f,_,o)}static resetCache(){JR=null,dZ={},fZ={},mZ={}}static fromObject({locale:e,numberingSystem:i,outputCalendar:r,weekSettings:n}={}){return As.create(e,i,r,n)}constructor(e,i,r,n,s){const[o,l,c]=QHe(e);this.locale=o,this.numberingSystem=i||l||null,this.outputCalendar=r||c||null,this.weekSettings=n,this.intl=eqe(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=rqe(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),i=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&i?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:As.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,gZ(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,i=!1){return M6(this,e,TTe,()=>{const r=i?{month:e,day:"numeric"}:{month:e},n=i?"format":"standalone";return this.monthsCache[n][e]||(this.monthsCache[n][e]=tqe(s=>this.extract(s,r,"month"))),this.monthsCache[n][e]})}weekdays(e,i=!1){return M6(this,e,ATe,()=>{const r=i?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=i?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=iqe(s=>this.extract(s,r,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return M6(this,void 0,()=>MTe,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[$i.utc(2016,11,13,9),$i.utc(2016,11,13,19)].map(i=>this.extract(i,e,"dayperiod"))}return this.meridiemCache})}eras(e){return M6(this,e,OTe,()=>{const i={era:e};return this.eraCache[e]||(this.eraCache[e]=[$i.utc(-40,1,1),$i.utc(2017,1,1)].map(r=>this.extract(r,i,"era"))),this.eraCache[e]})}extract(e,i,r){const n=this.dtFormatter(e,i),s=n.formatToParts(),o=s.find(l=>l.type.toLowerCase()===r);return o?o.value:null}numberFormatter(e={}){return new nqe(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,i={}){return new sqe(e,this.intl,i)}relFormatter(e={}){return new oqe(this.intl,this.isEnglish(),e)}listFormatter(e={}){return YHe(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:bTe()?KHe(this.locale):aqe}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let nH=null;class bc extends J5{static get utcInstance(){return nH===null&&(nH=new bc(0)),nH}static instance(e){return e===0?bc.utcInstance:new bc(e)}static parseSpecifier(e){if(e){const i=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(i)return new bc(tB(i[1],i[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${GI(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${GI(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,i){return GI(this.fixed,i)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class lqe extends J5{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Vw(t,e){if(mr(t)||t===null)return e;if(t instanceof J5)return t;if(hqe(t)){const i=t.toLowerCase();return i==="default"?e:i==="local"||i==="system"?KV.instance:i==="utc"||i==="gmt"?bc.utcInstance:bc.parseSpecifier(i)||wp.create(t)}else return aT(t)?bc.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new lqe(t)}let Ehe=()=>Date.now(),Che="system",Ahe=null,Mhe=null,Ohe=null,Phe=60,Rhe,Ihe=null;class xa{static get now(){return Ehe}static set now(e){Ehe=e}static set defaultZone(e){Che=e}static get defaultZone(){return Vw(Che,KV.instance)}static get defaultLocale(){return Ahe}static set defaultLocale(e){Ahe=e}static get defaultNumberingSystem(){return Mhe}static set defaultNumberingSystem(e){Mhe=e}static get defaultOutputCalendar(){return Ohe}static set defaultOutputCalendar(e){Ohe=e}static get defaultWeekSettings(){return Ihe}static set defaultWeekSettings(e){Ihe=gZ(e)}static get twoDigitCutoffYear(){return Phe}static set twoDigitCutoffYear(e){Phe=e%100}static get throwOnInvalid(){return Rhe}static set throwOnInvalid(e){Rhe=e}static resetCaches(){As.resetCache(),wp.resetCache()}}class fm{constructor(e,i){this.reason=e,this.explanation=i}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const pTe=[0,31,59,90,120,151,181,212,243,273,304,334],fTe=[0,31,60,91,121,152,182,213,244,274,305,335];function Tf(t,e){return new fm("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function une(t,e,i){const r=new Date(Date.UTC(t,e-1,i));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const n=r.getUTCDay();return n===0?7:n}function mTe(t,e,i){return i+(_9(t)?fTe:pTe)[e-1]}function gTe(t,e){const i=_9(t)?fTe:pTe,r=i.findIndex(s=>srL(r,e,i)?(f=r+1,c=1):f=r,{weekYear:f,weekNumber:c,weekday:l,...iB(t)}}function $he(t,e=4,i=1){const{weekYear:r,weekNumber:n,weekday:s}=t,o=hne(une(r,1,e),i),l=KM(r);let c=n*7+s-o-7+e,f;c<1?(f=r-1,c+=KM(f)):c>l?(f=r+1,c-=KM(r)):f=r;const{month:_,day:x}=gTe(f,c);return{year:f,month:_,day:x,...iB(t)}}function sH(t){const{year:e,month:i,day:r}=t,n=mTe(e,i,r);return{year:e,ordinal:n,...iB(t)}}function Lhe(t){const{year:e,ordinal:i}=t,{month:r,day:n}=gTe(e,i);return{year:e,month:r,day:n,...iB(t)}}function Dhe(t,e){if(!mr(t.localWeekday)||!mr(t.localWeekNumber)||!mr(t.localWeekYear)){if(!mr(t.weekday)||!mr(t.weekNumber)||!mr(t.weekYear))throw new _M("Cannot mix locale-based week fields with ISO-based week fields");return mr(t.localWeekday)||(t.weekday=t.localWeekday),mr(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),mr(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function cqe(t,e=4,i=1){const r=QV(t.weekYear),n=Ef(t.weekNumber,1,rL(t.weekYear,e,i)),s=Ef(t.weekday,1,7);return r?n?s?!1:Tf("weekday",t.weekday):Tf("week",t.weekNumber):Tf("weekYear",t.weekYear)}function uqe(t){const e=QV(t.year),i=Ef(t.ordinal,1,KM(t.year));return e?i?!1:Tf("ordinal",t.ordinal):Tf("year",t.year)}function yTe(t){const e=QV(t.year),i=Ef(t.month,1,12),r=Ef(t.day,1,rz(t.year,t.month));return e?i?r?!1:Tf("day",t.day):Tf("month",t.month):Tf("year",t.year)}function vTe(t){const{hour:e,minute:i,second:r,millisecond:n}=t,s=Ef(e,0,23)||e===24&&i===0&&r===0&&n===0,o=Ef(i,0,59),l=Ef(r,0,59),c=Ef(n,0,999);return s?o?l?c?!1:Tf("millisecond",n):Tf("second",r):Tf("minute",i):Tf("hour",e)}function mr(t){return typeof t>"u"}function aT(t){return typeof t=="number"}function QV(t){return typeof t=="number"&&t%1===0}function hqe(t){return typeof t=="string"}function dqe(t){return Object.prototype.toString.call(t)==="[object Date]"}function _Te(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function bTe(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function pqe(t){return Array.isArray(t)?t:[t]}function Nhe(t,e,i){if(t.length!==0)return t.reduce((r,n)=>{const s=[e(n),n];return r&&i(r[0],s[0])===r[0]?r:s},null)[1]}function fqe(t,e){return e.reduce((i,r)=>(i[r]=t[r],i),{})}function zO(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function gZ(t){if(t==null)return null;if(typeof t!="object")throw new Bh("Week settings must be an object");if(!Ef(t.firstDay,1,7)||!Ef(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Ef(e,1,7)))throw new Bh("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Ef(t,e,i){return QV(t)&&t>=e&&t<=i}function mqe(t,e){return t-e*Math.floor(t/e)}function ja(t,e=2){const i=t<0;let r;return i?r="-"+(""+-t).padStart(e,"0"):r=(""+t).padStart(e,"0"),r}function Ow(t){if(!(mr(t)||t===null||t===""))return parseInt(t,10)}function vx(t){if(!(mr(t)||t===null||t===""))return parseFloat(t)}function dne(t){if(!(mr(t)||t===null||t==="")){const e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function pne(t,e,i=!1){const r=10**e;return(i?Math.trunc:Math.round)(t*r)/r}function _9(t){return t%4===0&&(t%100!==0||t%400===0)}function KM(t){return _9(t)?366:365}function rz(t,e){const i=mqe(e-1,12)+1,r=t+(e-i)/12;return i===2?_9(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][i-1]}function eB(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function Fhe(t,e,i){return-hne(une(t,1,e),i)+e-1}function rL(t,e=4,i=1){const r=Fhe(t,e,i),n=Fhe(t+1,e,i);return(KM(t)-r+n)/7}function yZ(t){return t>99?t:t>xa.twoDigitCutoffYear?1900+t:2e3+t}function wTe(t,e,i,r=null){const n=new Date(t),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(s.timeZone=r);const o={timeZoneName:e,...s},l=new Intl.DateTimeFormat(i,o).formatToParts(n).find(c=>c.type.toLowerCase()==="timezonename");return l?l.value:null}function tB(t,e){let i=parseInt(t,10);Number.isNaN(i)&&(i=0);const r=parseInt(e,10)||0,n=i<0||Object.is(i,-0)?-r:r;return i*60+n}function xTe(t){const e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Bh(`Invalid unit value ${t}`);return e}function nz(t,e){const i={};for(const r in t)if(zO(t,r)){const n=t[r];if(n==null)continue;i[e(r)]=xTe(n)}return i}function GI(t,e){const i=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),n=t>=0?"+":"-";switch(e){case"short":return`${n}${ja(i,2)}:${ja(r,2)}`;case"narrow":return`${n}${i}${r>0?`:${r}`:""}`;case"techie":return`${n}${ja(i,2)}${ja(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function iB(t){return fqe(t,["hour","minute","second","millisecond"])}const gqe=["January","February","March","April","May","June","July","August","September","October","November","December"],STe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],yqe=["J","F","M","A","M","J","J","A","S","O","N","D"];function TTe(t){switch(t){case"narrow":return[...yqe];case"short":return[...STe];case"long":return[...gqe];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const ETe=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],CTe=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],vqe=["M","T","W","T","F","S","S"];function ATe(t){switch(t){case"narrow":return[...vqe];case"short":return[...CTe];case"long":return[...ETe];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const MTe=["AM","PM"],_qe=["Before Christ","Anno Domini"],bqe=["BC","AD"],wqe=["B","A"];function OTe(t){switch(t){case"narrow":return[...wqe];case"short":return[...bqe];case"long":return[..._qe];default:return null}}function xqe(t){return MTe[t.hour<12?0:1]}function Sqe(t,e){return ATe(e)[t.weekday-1]}function Tqe(t,e){return TTe(e)[t.month-1]}function Eqe(t,e){return OTe(e)[t.year<0?0:1]}function Cqe(t,e,i="always",r=!1){const n={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(t)===-1;if(i==="auto"&&s){const x=t==="days";switch(e){case 1:return x?"tomorrow":`next ${n[t][0]}`;case-1:return x?"yesterday":`last ${n[t][0]}`;case 0:return x?"today":`this ${n[t][0]}`}}const o=Object.is(e,-0)||e<0,l=Math.abs(e),c=l===1,f=n[t],_=r?c?f[1]:f[2]||f[1]:c?n[t][0]:t;return o?`${l} ${_} ago`:`in ${l} ${_}`}function khe(t,e){let i="";for(const r of t)r.literal?i+=r.val:i+=e(r.val);return i}const Aqe={D:tz,DD:YSe,DDD:XSe,DDDD:ZSe,t:JSe,tt:KSe,ttt:QSe,tttt:eTe,T:tTe,TT:iTe,TTT:rTe,TTTT:nTe,f:sTe,ff:aTe,fff:cTe,ffff:hTe,F:oTe,FF:lTe,FFF:uTe,FFFF:dTe};class nu{static create(e,i={}){return new nu(e,i)}static parseFormat(e){let i=null,r="",n=!1;const s=[];for(let o=0;o0&&s.push({literal:n||/^\s+$/.test(r),val:r}),i=null,r="",n=!n):n||l===i?r+=l:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=l,i=l)}return r.length>0&&s.push({literal:n||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return Aqe[e]}constructor(e,i){this.opts=i,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,i){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...i}).format()}dtFormatter(e,i={}){return this.loc.dtFormatter(e,{...this.opts,...i})}formatDateTime(e,i){return this.dtFormatter(e,i).format()}formatDateTimeParts(e,i){return this.dtFormatter(e,i).formatToParts()}formatInterval(e,i){return this.dtFormatter(e.start,i).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,i){return this.dtFormatter(e,i).resolvedOptions()}num(e,i=0){if(this.opts.forceSimple)return ja(e,i);const r={...this.opts};return i>0&&(r.padTo=i),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,i){const r=this.loc.listingMode()==="en",n=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(A,M)=>this.loc.extract(e,A,M),o=A=>e.isOffsetFixed&&e.offset===0&&A.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,A.format):"",l=()=>r?xqe(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(A,M)=>r?Tqe(e,A):s(M?{month:A}:{month:A,day:"numeric"},"month"),f=(A,M)=>r?Sqe(e,A):s(M?{weekday:A}:{weekday:A,month:"long",day:"numeric"},"weekday"),_=A=>{const M=nu.macroTokenToFormatOpts(A);return M?this.formatWithSystemDefault(e,M):A},x=A=>r?Eqe(e,A):s({era:A},"era"),T=A=>{switch(A){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return l();case"d":return n?s({day:"numeric"},"day"):this.num(e.day);case"dd":return n?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return f("short",!0);case"cccc":return f("long",!0);case"ccccc":return f("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return f("short",!1);case"EEEE":return f("long",!1);case"EEEEE":return f("narrow",!1);case"L":return n?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return n?s({month:"numeric"},"month"):this.num(e.month);case"MM":return n?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return n?s({year:"numeric"},"year"):this.num(e.year);case"yy":return n?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return x("short");case"GG":return x("long");case"GGGGG":return x("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return _(A)}};return khe(nu.parseFormat(i),T)}formatDurationFromString(e,i){const r=c=>{switch(c[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},n=c=>f=>{const _=r(f);return _?this.num(c.get(_),f.length):f},s=nu.parseFormat(i),o=s.reduce((c,{literal:f,val:_})=>f?c:c.concat(_),[]),l=e.shiftTo(...o.map(r).filter(c=>c));return khe(s,n(l))}}const PTe=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function K5(...t){const e=t.reduce((i,r)=>i+r.source,"");return RegExp(`^${e}$`)}function Q5(...t){return e=>t.reduce(([i,r,n],s)=>{const[o,l,c]=s(e,n);return[{...i,...o},l||r,c]},[{},null,1]).slice(0,2)}function eP(t,...e){if(t==null)return[null,null];for(const[i,r]of e){const n=i.exec(t);if(n)return r(n)}return[null,null]}function RTe(...t){return(e,i)=>{const r={};let n;for(n=0;nA!==void 0&&(M||A&&_)?-A:A;return[{years:T(vx(i)),months:T(vx(r)),weeks:T(vx(n)),days:T(vx(s)),hours:T(vx(o)),minutes:T(vx(l)),seconds:T(vx(c),c==="-0"),milliseconds:T(dne(f),x)}]}const Uqe={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function gne(t,e,i,r,n,s,o){const l={year:e.length===2?yZ(Ow(e)):Ow(e),month:STe.indexOf(i)+1,day:Ow(r),hour:Ow(n),minute:Ow(s)};return o&&(l.second=Ow(o)),t&&(l.weekday=t.length>3?ETe.indexOf(t)+1:CTe.indexOf(t)+1),l}const Vqe=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Bqe(t){const[,e,i,r,n,s,o,l,c,f,_,x]=t,T=gne(e,n,r,i,s,o,l);let A;return c?A=Uqe[c]:f?A=0:A=tB(_,x),[T,new bc(A)]}function jqe(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const Gqe=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,Hqe=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,qqe=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function zhe(t){const[,e,i,r,n,s,o,l]=t;return[gne(e,n,r,i,s,o,l),bc.utcInstance]}function Wqe(t){const[,e,i,r,n,s,o,l]=t;return[gne(e,l,i,r,n,s,o),bc.utcInstance]}const Yqe=K5(Oqe,mne),Xqe=K5(Pqe,mne),Zqe=K5(Rqe,mne),Jqe=K5($Te),DTe=Q5(Nqe,tP,b9,w9),Kqe=Q5(Iqe,tP,b9,w9),Qqe=Q5($qe,tP,b9,w9),eWe=Q5(tP,b9,w9);function tWe(t){return eP(t,[Yqe,DTe],[Xqe,Kqe],[Zqe,Qqe],[Jqe,eWe])}function iWe(t){return eP(jqe(t),[Vqe,Bqe])}function rWe(t){return eP(t,[Gqe,zhe],[Hqe,zhe],[qqe,Wqe])}function nWe(t){return eP(t,[kqe,zqe])}const sWe=Q5(tP);function oWe(t){return eP(t,[Fqe,sWe])}const aWe=K5(Lqe,Dqe),lWe=K5(LTe),cWe=Q5(tP,b9,w9);function uWe(t){return eP(t,[aWe,DTe],[lWe,cWe])}const Uhe="Invalid Duration",NTe={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},hWe={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...NTe},Op=146097/400,IE=146097/4800,dWe={years:{quarters:4,months:12,weeks:Op/7,days:Op,hours:Op*24,minutes:Op*24*60,seconds:Op*24*60*60,milliseconds:Op*24*60*60*1e3},quarters:{months:3,weeks:Op/28,days:Op/4,hours:Op*24/4,minutes:Op*24*60/4,seconds:Op*24*60*60/4,milliseconds:Op*24*60*60*1e3/4},months:{weeks:IE/7,days:IE,hours:IE*24,minutes:IE*24*60,seconds:IE*24*60*60,milliseconds:IE*24*60*60*1e3},...NTe},jS=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],pWe=jS.slice(0).reverse();function tb(t,e,i=!1){const r={values:i?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new hn(r)}function FTe(t,e){let i=e.milliseconds??0;for(const r of pWe.slice(1))e[r]&&(i+=e[r]*t[r].milliseconds);return i}function Vhe(t,e){const i=FTe(t,e)<0?-1:1;jS.reduceRight((r,n)=>{if(mr(e[n]))return r;if(r){const s=e[r]*i,o=t[n][r],l=Math.floor(s/o);e[n]+=l*i,e[r]-=l*o*i}return n},null),jS.reduce((r,n)=>{if(mr(e[n]))return r;if(r){const s=e[r]%1;e[r]-=s,e[n]+=s*t[r][n]}return n},null)}function fWe(t){const e={};for(const[i,r]of Object.entries(t))r!==0&&(e[i]=r);return e}class hn{constructor(e){const i=e.conversionAccuracy==="longterm"||!1;let r=i?dWe:hWe;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||As.create(),this.conversionAccuracy=i?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,i){return hn.fromObject({milliseconds:e},i)}static fromObject(e,i={}){if(e==null||typeof e!="object")throw new Bh(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new hn({values:nz(e,hn.normalizeUnit),loc:As.fromObject(i),conversionAccuracy:i.conversionAccuracy,matrix:i.matrix})}static fromDurationLike(e){if(aT(e))return hn.fromMillis(e);if(hn.isDuration(e))return e;if(typeof e=="object")return hn.fromObject(e);throw new Bh(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,i){const[r]=nWe(e);return r?hn.fromObject(r,i):hn.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,i){const[r]=oWe(e);return r?hn.fromObject(r,i):hn.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,i=null){if(!e)throw new Bh("need to specify a reason the Duration is invalid");const r=e instanceof fm?e:new fm(e,i);if(xa.throwOnInvalid)throw new VHe(r);return new hn({invalid:r})}static normalizeUnit(e){const i={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!i)throw new WSe(e);return i}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,i={}){const r={...i,floor:i.round!==!1&&i.floor!==!1};return this.isValid?nu.create(this.loc,r).formatDurationFromString(this,e):Uhe}toHuman(e={}){if(!this.isValid)return Uhe;const i=jS.map(r=>{const n=this.values[r];return mr(n)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(n)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(i)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=pne(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const i=this.toMillis();return i<0||i>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},$i.fromMillis(i,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?FTe(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const i=hn.fromDurationLike(e),r={};for(const n of jS)(zO(i.values,n)||zO(this.values,n))&&(r[n]=i.get(n)+this.get(n));return tb(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const i=hn.fromDurationLike(e);return this.plus(i.negate())}mapUnits(e){if(!this.isValid)return this;const i={};for(const r of Object.keys(this.values))i[r]=xTe(e(this.values[r],r));return tb(this,{values:i},!0)}get(e){return this[hn.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const i={...this.values,...nz(e,hn.normalizeUnit)};return tb(this,{values:i})}reconfigure({locale:e,numberingSystem:i,conversionAccuracy:r,matrix:n}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:i}),matrix:n,conversionAccuracy:r};return tb(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return Vhe(this.matrix,e),tb(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=fWe(this.normalize().shiftToAll().toObject());return tb(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>hn.normalizeUnit(o));const i={},r={},n=this.toObject();let s;for(const o of jS)if(e.indexOf(o)>=0){s=o;let l=0;for(const f in r)l+=this.matrix[f][o]*r[f],r[f]=0;aT(n[o])&&(l+=n[o]);const c=Math.trunc(l);i[o]=c,r[o]=(l*1e3-c*1e3)/1e3}else aT(n[o])&&(r[o]=n[o]);for(const o in r)r[o]!==0&&(i[s]+=o===s?r[o]:r[o]/this.matrix[s][o]);return Vhe(this.matrix,i),tb(this,{values:i},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const i of Object.keys(this.values))e[i]=this.values[i]===0?0:-this.values[i];return tb(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function i(r,n){return r===void 0||r===0?n===void 0||n===0:r===n}for(const r of jS)if(!i(this.values[r],e.values[r]))return!1;return!0}}const $E="Invalid Interval";function mWe(t,e){return!t||!t.isValid?Xo.invalid("missing or invalid start"):!e||!e.isValid?Xo.invalid("missing or invalid end"):ee:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:i}={}){return this.isValid?Xo.fromDateTimes(e||this.s,i||this.e):this}splitAt(...e){if(!this.isValid)return[];const i=e.map(LP).filter(o=>this.contains(o)).sort((o,l)=>o.toMillis()-l.toMillis()),r=[];let{s:n}=this,s=0;for(;n+this.e?this.e:o;r.push(Xo.fromDateTimes(n,l)),n=l,s+=1}return r}splitBy(e){const i=hn.fromDurationLike(e);if(!this.isValid||!i.isValid||i.as("milliseconds")===0)return[];let{s:r}=this,n=1,s;const o=[];for(;rc*n));s=+l>+this.e?this.e:l,o.push(Xo.fromDateTimes(r,s)),r=s,n+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const i=this.s>e.s?this.s:e.s,r=this.e=r?null:Xo.fromDateTimes(i,r)}union(e){if(!this.isValid)return this;const i=this.se.e?this.e:e.e;return Xo.fromDateTimes(i,r)}static merge(e){const[i,r]=e.sort((n,s)=>n.s-s.s).reduce(([n,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[n,s.union(o)]:[n.concat([s]),o]:[n,o],[[],null]);return r&&i.push(r),i}static xor(e){let i=null,r=0;const n=[],s=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),o=Array.prototype.concat(...s),l=o.sort((c,f)=>c.time-f.time);for(const c of l)r+=c.type==="s"?1:-1,r===1?i=c.time:(i&&+i!=+c.time&&n.push(Xo.fromDateTimes(i,c.time)),i=null);return Xo.merge(n)}difference(...e){return Xo.xor([this].concat(e)).map(i=>this.intersection(i)).filter(i=>i&&!i.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:$E}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=tz,i={}){return this.isValid?nu.create(this.s.loc.clone(i),e).formatInterval(this):$E}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:$E}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:$E}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:$E}toFormat(e,{separator:i=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${i}${this.e.toFormat(e)}`:$E}toDuration(e,i){return this.isValid?this.e.diff(this.s,e,i):hn.invalid(this.invalidReason)}mapEndpoints(e){return Xo.fromDateTimes(e(this.s),e(this.e))}}class KR{static hasDST(e=xa.defaultZone){const i=$i.now().setZone(e).set({month:12});return!e.isUniversal&&i.offset!==i.set({month:6}).offset}static isValidIANAZone(e){return wp.isValidZone(e)}static normalizeZone(e){return Vw(e,xa.defaultZone)}static getStartOfWeek({locale:e=null,locObj:i=null}={}){return(i||As.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:i=null}={}){return(i||As.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:i=null}={}){return(i||As.create(e)).getWeekendDays().slice()}static months(e="long",{locale:i=null,numberingSystem:r=null,locObj:n=null,outputCalendar:s="gregory"}={}){return(n||As.create(i,r,s)).months(e)}static monthsFormat(e="long",{locale:i=null,numberingSystem:r=null,locObj:n=null,outputCalendar:s="gregory"}={}){return(n||As.create(i,r,s)).months(e,!0)}static weekdays(e="long",{locale:i=null,numberingSystem:r=null,locObj:n=null}={}){return(n||As.create(i,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:i=null,numberingSystem:r=null,locObj:n=null}={}){return(n||As.create(i,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return As.create(e).meridiems()}static eras(e="short",{locale:i=null}={}){return As.create(i,null,"gregory").eras(e)}static features(){return{relative:_Te(),localeWeek:bTe()}}}function Bhe(t,e){const i=n=>n.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=i(e)-i(t);return Math.floor(hn.fromMillis(r).as("days"))}function gWe(t,e,i){const r=[["years",(c,f)=>f.year-c.year],["quarters",(c,f)=>f.quarter-c.quarter+(f.year-c.year)*4],["months",(c,f)=>f.month-c.month+(f.year-c.year)*12],["weeks",(c,f)=>{const _=Bhe(c,f);return(_-_%7)/7}],["days",Bhe]],n={},s=t;let o,l;for(const[c,f]of r)i.indexOf(c)>=0&&(o=c,n[c]=f(t,e),l=s.plus(n),l>e?(n[c]--,t=s.plus(n),t>e&&(l=t,n[c]--,t=s.plus(n))):t=l);return[t,n,l,o]}function yWe(t,e,i,r){let[n,s,o,l]=gWe(t,e,i);const c=e-n,f=i.filter(x=>["hours","minutes","seconds","milliseconds"].indexOf(x)>=0);f.length===0&&(o0?hn.fromMillis(c,r).shiftTo(...f).plus(_):_}const yne={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},jhe={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},vWe=yne.hanidec.replace(/[\[|\]]/g,"").split("");function _We(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let i=0;i=s&&r<=o&&(e+=r-s)}}return parseInt(e,10)}else return e}function u0({numberingSystem:t},e=""){return new RegExp(`${yne[t||"latn"]}${e}`)}const bWe="missing Intl.DateTimeFormat.formatToParts support";function jn(t,e=i=>i){return{regex:t,deser:([i])=>e(_We(i))}}const wWe=" ",kTe=`[ ${wWe}]`,zTe=new RegExp(kTe,"g");function xWe(t){return t.replace(/\./g,"\\.?").replace(zTe,kTe)}function Ghe(t){return t.replace(/\./g,"").replace(zTe," ").toLowerCase()}function h0(t,e){return t===null?null:{regex:RegExp(t.map(xWe).join("|")),deser:([i])=>t.findIndex(r=>Ghe(i)===Ghe(r))+e}}function Hhe(t,e){return{regex:t,deser:([,i,r])=>tB(i,r),groups:e}}function O6(t){return{regex:t,deser:([e])=>e}}function SWe(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function TWe(t,e){const i=u0(e),r=u0(e,"{2}"),n=u0(e,"{3}"),s=u0(e,"{4}"),o=u0(e,"{6}"),l=u0(e,"{1,2}"),c=u0(e,"{1,3}"),f=u0(e,"{1,6}"),_=u0(e,"{1,9}"),x=u0(e,"{2,4}"),T=u0(e,"{4,6}"),A=L=>({regex:RegExp(SWe(L.val)),deser:([F])=>F,literal:!0}),I=(L=>{if(t.literal)return A(L);switch(L.val){case"G":return h0(e.eras("short"),0);case"GG":return h0(e.eras("long"),0);case"y":return jn(f);case"yy":return jn(x,yZ);case"yyyy":return jn(s);case"yyyyy":return jn(T);case"yyyyyy":return jn(o);case"M":return jn(l);case"MM":return jn(r);case"MMM":return h0(e.months("short",!0),1);case"MMMM":return h0(e.months("long",!0),1);case"L":return jn(l);case"LL":return jn(r);case"LLL":return h0(e.months("short",!1),1);case"LLLL":return h0(e.months("long",!1),1);case"d":return jn(l);case"dd":return jn(r);case"o":return jn(c);case"ooo":return jn(n);case"HH":return jn(r);case"H":return jn(l);case"hh":return jn(r);case"h":return jn(l);case"mm":return jn(r);case"m":return jn(l);case"q":return jn(l);case"qq":return jn(r);case"s":return jn(l);case"ss":return jn(r);case"S":return jn(c);case"SSS":return jn(n);case"u":return O6(_);case"uu":return O6(l);case"uuu":return jn(i);case"a":return h0(e.meridiems(),0);case"kkkk":return jn(s);case"kk":return jn(x,yZ);case"W":return jn(l);case"WW":return jn(r);case"E":case"c":return jn(i);case"EEE":return h0(e.weekdays("short",!1),1);case"EEEE":return h0(e.weekdays("long",!1),1);case"ccc":return h0(e.weekdays("short",!0),1);case"cccc":return h0(e.weekdays("long",!0),1);case"Z":case"ZZ":return Hhe(new RegExp(`([+-]${l.source})(?::(${r.source}))?`),2);case"ZZZ":return Hhe(new RegExp(`([+-]${l.source})(${r.source})?`),2);case"z":return O6(/[a-z_+-/]{1,256}?/i);case" ":return O6(/[^\S\n\r]/);default:return A(L)}})(t)||{invalidReason:bWe};return I.token=t,I}const EWe={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function CWe(t,e,i){const{type:r,value:n}=t;if(r==="literal"){const c=/^\s+$/.test(n);return{literal:!c,val:c?" ":n}}const s=e[r];let o=r;r==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=i.hour12?"hour12":"hour24");let l=EWe[o];if(typeof l=="object"&&(l=l[s]),l)return{literal:!1,val:l}}function AWe(t){return[`^${t.map(i=>i.regex).reduce((i,r)=>`${i}(${r.source})`,"")}$`,t]}function MWe(t,e,i){const r=t.match(e);if(r){const n={};let s=1;for(const o in i)if(zO(i,o)){const l=i[o],c=l.groups?l.groups+1:1;!l.literal&&l.token&&(n[l.token.val[0]]=l.deser(r.slice(s,s+c))),s+=c}return[r,n]}else return[r,{}]}function OWe(t){const e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let i=null,r;return mr(t.z)||(i=wp.create(t.z)),mr(t.Z)||(i||(i=new bc(t.Z)),r=t.Z),mr(t.q)||(t.M=(t.q-1)*3+1),mr(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),mr(t.u)||(t.S=dne(t.u)),[Object.keys(t).reduce((s,o)=>{const l=e(o);return l&&(s[l]=t[o]),s},{}),i,r]}let oH=null;function PWe(){return oH||(oH=$i.fromMillis(1555555555555)),oH}function RWe(t,e){if(t.literal)return t;const i=nu.macroTokenToFormatOpts(t.val),r=BTe(i,e);return r==null||r.includes(void 0)?t:r}function UTe(t,e){return Array.prototype.concat(...t.map(i=>RWe(i,e)))}function VTe(t,e,i){const r=UTe(nu.parseFormat(i),t),n=r.map(o=>TWe(o,t)),s=n.find(o=>o.invalidReason);if(s)return{input:e,tokens:r,invalidReason:s.invalidReason};{const[o,l]=AWe(n),c=RegExp(o,"i"),[f,_]=MWe(e,c,l),[x,T,A]=_?OWe(_):[null,null,void 0];if(zO(_,"a")&&zO(_,"H"))throw new _M("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:r,regex:c,rawMatches:f,matches:_,result:x,zone:T,specificOffset:A}}}function IWe(t,e,i){const{result:r,zone:n,specificOffset:s,invalidReason:o}=VTe(t,e,i);return[r,n,s,o]}function BTe(t,e){if(!t)return null;const r=nu.create(e,t).dtFormatter(PWe()),n=r.formatToParts(),s=r.resolvedOptions();return n.map(o=>CWe(o,t,s))}const aH="Invalid DateTime",qhe=864e13;function P6(t){return new fm("unsupported zone",`the zone "${t.name}" is not supported`)}function lH(t){return t.weekData===null&&(t.weekData=iz(t.c)),t.weekData}function cH(t){return t.localWeekData===null&&(t.localWeekData=iz(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function _x(t,e){const i={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new $i({...i,...e,old:i})}function jTe(t,e,i){let r=t-e*60*1e3;const n=i.offset(r);if(e===n)return[r,e];r-=(n-e)*60*1e3;const s=i.offset(r);return n===s?[r,n]:[t-Math.min(n,s)*60*1e3,Math.max(n,s)]}function R6(t,e){t+=e*60*1e3;const i=new Date(t);return{year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate(),hour:i.getUTCHours(),minute:i.getUTCMinutes(),second:i.getUTCSeconds(),millisecond:i.getUTCMilliseconds()}}function g7(t,e,i){return jTe(eB(t),e,i)}function Whe(t,e){const i=t.o,r=t.c.year+Math.trunc(e.years),n=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...t.c,year:r,month:n,day:Math.min(t.c.day,rz(r,n))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=hn.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),l=eB(s);let[c,f]=jTe(l,i,t.zone);return o!==0&&(c+=o,f=t.zone.offset(c)),{ts:c,o:f}}function $P(t,e,i,r,n,s){const{setZone:o,zone:l}=i;if(t&&Object.keys(t).length!==0||e){const c=e||l,f=$i.fromObject(t,{...i,zone:c,specificOffset:s});return o?f:f.setZone(l)}else return $i.invalid(new fm("unparsable",`the input "${n}" can't be parsed as ${r}`))}function I6(t,e,i=!0){return t.isValid?nu.create(As.create("en-US"),{allowZ:i,forceSimple:!0}).formatDateTimeFromString(t,e):null}function uH(t,e){const i=t.c.year>9999||t.c.year<0;let r="";return i&&t.c.year>=0&&(r+="+"),r+=ja(t.c.year,i?6:4),e?(r+="-",r+=ja(t.c.month),r+="-",r+=ja(t.c.day)):(r+=ja(t.c.month),r+=ja(t.c.day)),r}function Yhe(t,e,i,r,n,s){let o=ja(t.c.hour);return e?(o+=":",o+=ja(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!i)&&(o+=":")):o+=ja(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!i)&&(o+=ja(t.c.second),(t.c.millisecond!==0||!r)&&(o+=".",o+=ja(t.c.millisecond,3))),n&&(t.isOffsetFixed&&t.offset===0&&!s?o+="Z":t.o<0?(o+="-",o+=ja(Math.trunc(-t.o/60)),o+=":",o+=ja(Math.trunc(-t.o%60))):(o+="+",o+=ja(Math.trunc(t.o/60)),o+=":",o+=ja(Math.trunc(t.o%60)))),s&&(o+="["+t.zone.ianaName+"]"),o}const GTe={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},$We={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},LWe={ordinal:1,hour:0,minute:0,second:0,millisecond:0},HTe=["year","month","day","hour","minute","second","millisecond"],DWe=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],NWe=["year","ordinal","hour","minute","second","millisecond"];function FWe(t){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new WSe(t);return e}function Xhe(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return FWe(t)}}function Zhe(t,e){const i=Vw(e.zone,xa.defaultZone),r=As.fromObject(e),n=xa.now();let s,o;if(mr(t.year))s=n;else{for(const f of HTe)mr(t[f])&&(t[f]=GTe[f]);const l=yTe(t)||vTe(t);if(l)return $i.invalid(l);const c=i.offset(n);[s,o]=g7(t,c,i)}return new $i({ts:s,zone:i,loc:r,o})}function Jhe(t,e,i){const r=mr(i.round)?!0:i.round,n=(o,l)=>(o=pne(o,r||i.calendary?0:2,!0),e.loc.clone(i).relFormatter(i).format(o,l)),s=o=>i.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(i.unit)return n(s(i.unit),i.unit);for(const o of i.units){const l=s(o);if(Math.abs(l)>=1)return n(l,o)}return n(t>e?-0:0,i.units[i.units.length-1])}function Khe(t){let e={},i;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],i=Array.from(t).slice(0,t.length-1)):i=Array.from(t),[e,i]}class $i{constructor(e){const i=e.zone||xa.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new fm("invalid input"):null)||(i.isValid?null:P6(i));this.ts=mr(e.ts)?xa.now():e.ts;let n=null,s=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(i))[n,s]=[e.old.c,e.old.o];else{const l=i.offset(this.ts);n=R6(this.ts,l),r=Number.isNaN(n.year)?new fm("invalid input"):null,n=r?null:n,s=r?null:l}this._zone=i,this.loc=e.loc||As.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=n,this.o=s,this.isLuxonDateTime=!0}static now(){return new $i({})}static local(){const[e,i]=Khe(arguments),[r,n,s,o,l,c,f]=i;return Zhe({year:r,month:n,day:s,hour:o,minute:l,second:c,millisecond:f},e)}static utc(){const[e,i]=Khe(arguments),[r,n,s,o,l,c,f]=i;return e.zone=bc.utcInstance,Zhe({year:r,month:n,day:s,hour:o,minute:l,second:c,millisecond:f},e)}static fromJSDate(e,i={}){const r=dqe(e)?e.valueOf():NaN;if(Number.isNaN(r))return $i.invalid("invalid input");const n=Vw(i.zone,xa.defaultZone);return n.isValid?new $i({ts:r,zone:n,loc:As.fromObject(i)}):$i.invalid(P6(n))}static fromMillis(e,i={}){if(aT(e))return e<-qhe||e>qhe?$i.invalid("Timestamp out of range"):new $i({ts:e,zone:Vw(i.zone,xa.defaultZone),loc:As.fromObject(i)});throw new Bh(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,i={}){if(aT(e))return new $i({ts:e*1e3,zone:Vw(i.zone,xa.defaultZone),loc:As.fromObject(i)});throw new Bh("fromSeconds requires a numerical input")}static fromObject(e,i={}){e=e||{};const r=Vw(i.zone,xa.defaultZone);if(!r.isValid)return $i.invalid(P6(r));const n=As.fromObject(i),s=nz(e,Xhe),{minDaysInFirstWeek:o,startOfWeek:l}=Dhe(s,n),c=xa.now(),f=mr(i.specificOffset)?r.offset(c):i.specificOffset,_=!mr(s.ordinal),x=!mr(s.year),T=!mr(s.month)||!mr(s.day),A=x||T,M=s.weekYear||s.weekNumber;if((A||_)&&M)throw new _M("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(T&&_)throw new _M("Can't mix ordinal dates with month/day");const I=M||s.weekday&&!A;let L,F,z=R6(c,f);I?(L=DWe,F=$We,z=iz(z,o,l)):_?(L=NWe,F=LWe,z=sH(z)):(L=HTe,F=GTe);let k=!1;for(const re of L){const he=s[re];mr(he)?k?s[re]=F[re]:s[re]=z[re]:k=!0}const U=I?cqe(s,o,l):_?uqe(s):yTe(s),j=U||vTe(s);if(j)return $i.invalid(j);const H=I?$he(s,o,l):_?Lhe(s):s,[Y,Q]=g7(H,f,r),ne=new $i({ts:Y,zone:r,o:Q,loc:n});return s.weekday&&A&&e.weekday!==ne.weekday?$i.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${ne.toISO()}`):ne}static fromISO(e,i={}){const[r,n]=tWe(e);return $P(r,n,i,"ISO 8601",e)}static fromRFC2822(e,i={}){const[r,n]=iWe(e);return $P(r,n,i,"RFC 2822",e)}static fromHTTP(e,i={}){const[r,n]=rWe(e);return $P(r,n,i,"HTTP",i)}static fromFormat(e,i,r={}){if(mr(e)||mr(i))throw new Bh("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:s=null}=r,o=As.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0}),[l,c,f,_]=IWe(o,e,i);return _?$i.invalid(_):$P(l,c,r,`format ${i}`,e,f)}static fromString(e,i,r={}){return $i.fromFormat(e,i,r)}static fromSQL(e,i={}){const[r,n]=uWe(e);return $P(r,n,i,"SQL",e)}static invalid(e,i=null){if(!e)throw new Bh("need to specify a reason the DateTime is invalid");const r=e instanceof fm?e:new fm(e,i);if(xa.throwOnInvalid)throw new zHe(r);return new $i({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,i={}){const r=BTe(e,As.fromObject(i));return r?r.map(n=>n?n.val:null).join(""):null}static expandFormat(e,i={}){return UTe(nu.parseFormat(e),As.fromObject(i)).map(n=>n.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?lH(this).weekYear:NaN}get weekNumber(){return this.isValid?lH(this).weekNumber:NaN}get weekday(){return this.isValid?lH(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?cH(this).weekday:NaN}get localWeekNumber(){return this.isValid?cH(this).weekNumber:NaN}get localWeekYear(){return this.isValid?cH(this).weekYear:NaN}get ordinal(){return this.isValid?sH(this.c).ordinal:NaN}get monthShort(){return this.isValid?KR.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?KR.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?KR.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?KR.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,i=6e4,r=eB(this.c),n=this.zone.offset(r-e),s=this.zone.offset(r+e),o=this.zone.offset(r-n*i),l=this.zone.offset(r-s*i);if(o===l)return[this];const c=r-o*i,f=r-l*i,_=R6(c,o),x=R6(f,l);return _.hour===x.hour&&_.minute===x.minute&&_.second===x.second&&_.millisecond===x.millisecond?[_x(this,{ts:c}),_x(this,{ts:f})]:[this]}get isInLeapYear(){return _9(this.year)}get daysInMonth(){return rz(this.year,this.month)}get daysInYear(){return this.isValid?KM(this.year):NaN}get weeksInWeekYear(){return this.isValid?rL(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?rL(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:i,numberingSystem:r,calendar:n}=nu.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:i,numberingSystem:r,outputCalendar:n}}toUTC(e=0,i={}){return this.setZone(bc.instance(e),i)}toLocal(){return this.setZone(xa.defaultZone)}setZone(e,{keepLocalTime:i=!1,keepCalendarTime:r=!1}={}){if(e=Vw(e,xa.defaultZone),e.equals(this.zone))return this;if(e.isValid){let n=this.ts;if(i||r){const s=e.offset(this.ts),o=this.toObject();[n]=g7(o,s,e)}return _x(this,{ts:n,zone:e})}else return $i.invalid(P6(e))}reconfigure({locale:e,numberingSystem:i,outputCalendar:r}={}){const n=this.loc.clone({locale:e,numberingSystem:i,outputCalendar:r});return _x(this,{loc:n})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const i=nz(e,Xhe),{minDaysInFirstWeek:r,startOfWeek:n}=Dhe(i,this.loc),s=!mr(i.weekYear)||!mr(i.weekNumber)||!mr(i.weekday),o=!mr(i.ordinal),l=!mr(i.year),c=!mr(i.month)||!mr(i.day),f=l||c,_=i.weekYear||i.weekNumber;if((f||o)&&_)throw new _M("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&o)throw new _M("Can't mix ordinal dates with month/day");let x;s?x=$he({...iz(this.c,r,n),...i},r,n):mr(i.ordinal)?(x={...this.toObject(),...i},mr(i.day)&&(x.day=Math.min(rz(x.year,x.month),x.day))):x=Lhe({...sH(this.c),...i});const[T,A]=g7(x,this.o,this.zone);return _x(this,{ts:T,o:A})}plus(e){if(!this.isValid)return this;const i=hn.fromDurationLike(e);return _x(this,Whe(this,i))}minus(e){if(!this.isValid)return this;const i=hn.fromDurationLike(e).negate();return _x(this,Whe(this,i))}startOf(e,{useLocaleWeeks:i=!1}={}){if(!this.isValid)return this;const r={},n=hn.normalizeUnit(e);switch(n){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(n==="weeks")if(i){const s=this.loc.getStartOfWeek(),{weekday:o}=this;othis.valueOf(),l=o?this:e,c=o?e:this,f=yWe(l,c,s,n);return o?f.negate():f}diffNow(e="milliseconds",i={}){return this.diff($i.now(),e,i)}until(e){return this.isValid?Xo.fromDateTimes(this,e):this}hasSame(e,i,r){if(!this.isValid)return!1;const n=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(i,r)<=n&&n<=s.endOf(i,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const i=e.base||$i.fromObject({},{zone:this.zone}),r=e.padding?thisi.valueOf(),Math.min)}static max(...e){if(!e.every($i.isDateTime))throw new Bh("max requires all arguments be DateTimes");return Nhe(e,i=>i.valueOf(),Math.max)}static fromFormatExplain(e,i,r={}){const{locale:n=null,numberingSystem:s=null}=r,o=As.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0});return VTe(o,e,i)}static fromStringExplain(e,i,r={}){return $i.fromFormatExplain(e,i,r)}static get DATE_SHORT(){return tz}static get DATE_MED(){return YSe}static get DATE_MED_WITH_WEEKDAY(){return BHe}static get DATE_FULL(){return XSe}static get DATE_HUGE(){return ZSe}static get TIME_SIMPLE(){return JSe}static get TIME_WITH_SECONDS(){return KSe}static get TIME_WITH_SHORT_OFFSET(){return QSe}static get TIME_WITH_LONG_OFFSET(){return eTe}static get TIME_24_SIMPLE(){return tTe}static get TIME_24_WITH_SECONDS(){return iTe}static get TIME_24_WITH_SHORT_OFFSET(){return rTe}static get TIME_24_WITH_LONG_OFFSET(){return nTe}static get DATETIME_SHORT(){return sTe}static get DATETIME_SHORT_WITH_SECONDS(){return oTe}static get DATETIME_MED(){return aTe}static get DATETIME_MED_WITH_SECONDS(){return lTe}static get DATETIME_MED_WITH_WEEKDAY(){return jHe}static get DATETIME_FULL(){return cTe}static get DATETIME_FULL_WITH_SECONDS(){return uTe}static get DATETIME_HUGE(){return hTe}static get DATETIME_HUGE_WITH_SECONDS(){return dTe}}function LP(t){if($i.isDateTime(t))return t;if(t&&t.valueOf&&aT(t.valueOf()))return $i.fromJSDate(t);if(t&&typeof t=="object")return $i.fromObject(t);throw new Bh(`Unknown datetime argument: ${t}, of type ${typeof t}`)}const Uy="system",OT="unknown",Vy="UTC",kWe=Intl.DateTimeFormat().resolvedOptions().timeZone,zWe="shortOffset";function UWe(t){return"timeZoneIANA"in t}function VWe(t){return t.startsWith("UTC")}function BWe(t,e=!1){return{json:{read:{source:t,reader:(i,r)=>r[t]?y7(r[t]):null},write:!!e&&{allowNull:!0,writer(i,r){r[t]=i?jWe(i):null}}}}}function y7(t,e=Uy){return t?UWe(t)?t.timeZoneIANA:GWe(t,e):e}function jWe(t){return{timeZoneIANA:t}}function GWe(t,e=Uy){if(!t||!xhe.has(t.timeZone))return e;const i=xhe.get(t.timeZone);return VWe(t.timeZone)||t.respectsDaylightSaving?i:HWe(i)}function HWe(t){const e=$i.local().setZone(t),i=Math.min(e.set({month:1,day:1}).offset,e.set({month:5}).offset);return i===0?"Etc/UTC":`Etc/GMT${bc.instance(-i).formatOffset(0,"narrow")}`}function qWe(t,e,i,r,n){if(e&&n==="date")return{timeZone:Vy,timeZoneName:void 0};const s=r.timeStyle||r.hour,o=i===OT;return{timeZone:o?n==="timestamp-offset"?void 0:t??Vy:i,timeZoneName:o&&s?zWe:void 0}}const WWe={year:void 0,month:void 0,day:void 0,weekday:void 0},YWe={hour:void 0,minute:void 0,second:void 0},qTe={timeZone:Vy},Xm={year:"numeric",month:"numeric",day:"numeric"},DP={year:"numeric",month:"long",day:"numeric"},NP={year:"numeric",month:"short",day:"numeric"},FP={year:"numeric",month:"long",weekday:"long",day:"numeric"},Pw={hour:"numeric",minute:"numeric"},h3={...Pw,second:"numeric"},WTe={hourCycle:"h23"},kP={...Pw,...WTe},zP={...h3,...WTe},YTe={"short-date":Xm,"short-date-short-time":{...Xm,...Pw},"short-date-short-time-24":{...Xm,...kP},"short-date-long-time":{...Xm,...h3},"short-date-long-time-24":{...Xm,...zP},"short-date-le":Xm,"short-date-le-short-time":{...Xm,...Pw},"short-date-le-short-time-24":{...Xm,...kP},"short-date-le-long-time":{...Xm,...h3},"short-date-le-long-time-24":{...Xm,...zP},"long-month-day-year":DP,"long-month-day-year-short-time":{...DP,...Pw},"long-month-day-year-short-time-24":{...DP,...kP},"long-month-day-year-long-time":{...DP,...h3},"long-month-day-year-long-time-24":{...DP,...zP},"day-short-month-year":NP,"day-short-month-year-short-time":{...NP,...Pw},"day-short-month-year-short-time-24":{...NP,...kP},"day-short-month-year-long-time":{...NP,...h3},"day-short-month-year-long-time-24":{...NP,...zP},"long-date":FP,"long-date-short-time":{...FP,...Pw},"long-date-short-time-24":{...FP,...kP},"long-date-long-time":{...FP,...h3},"long-date-long-time-24":{...FP,...zP},"long-month-year":{month:"long",year:"numeric"},"short-month-year":{month:"short",year:"numeric"},year:{year:"numeric"},"short-time":Pw,"long-time":h3},XWe=fu()({shortDate:"short-date",shortDateShortTime:"short-date-short-time",shortDateShortTime24:"short-date-short-time-24",shortDateLongTime:"short-date-long-time",shortDateLongTime24:"short-date-long-time-24",shortDateLE:"short-date-le",shortDateLEShortTime:"short-date-le-short-time",shortDateLEShortTime24:"short-date-le-short-time-24",shortDateLELongTime:"short-date-le-long-time",shortDateLELongTime24:"short-date-le-long-time-24",longMonthDayYear:"long-month-day-year",longMonthDayYearShortTime:"long-month-day-year-short-time",longMonthDayYearShortTime24:"long-month-day-year-short-time-24",longMonthDayYearLongTime:"long-month-day-year-long-time",longMonthDayYearLongTime24:"long-month-day-year-long-time-24",dayShortMonthYear:"day-short-month-year",dayShortMonthYearShortTime:"day-short-month-year-short-time",dayShortMonthYearShortTime24:"day-short-month-year-short-time-24",dayShortMonthYearLongTime:"day-short-month-year-long-time",dayShortMonthYearLongTime24:"day-short-month-year-long-time-24",longDate:"long-date",longDateShortTime:"long-date-short-time",longDateShortTime24:"long-date-short-time-24",longDateLongTime:"long-date-long-time",longDateLongTime24:"long-date-long-time-24",longMonthYear:"long-month-year",shortMonthYear:"short-month-year",year:"year"}),XTe={ar:"ar-u-nu-latn-ca-gregory"};let vZ=new WeakMap;const rB=YTe["short-date-short-time"];function ZTe(t){let e=vZ.get(t);if(!e){const i=fa(),r=XTe[i]||i,n=vne(t.timeZone??Uy),s={...t,timeZone:n};e=new Intl.DateTimeFormat(r,s),vZ.set(t,e)}return e}function oA(t){return YTe[t]}function js(t,e=rB){return ZTe(e).format(t)}function ZWe(t,e=rB){return js(new Date(t),{...e,...qTe,...YWe})}function JWe(t,e=rB){return js(new Date(`1970-01-01T${t}Z`),{...e,...qTe,...WWe})}function KWe(t,e=rB){if(e.timeZone)return js(new Date(t),e);const i=$i.fromISO(t,{setZone:!0}),r=fa(),n=XTe[r]??r,s=i.offset===0?Vy:e.timeZone,o={...e,timeZone:s};return i.toLocaleString(o,{locale:n})}function vne(t){switch(t){case Uy:return kWe;case OT:return Vy;default:return t}}cne(()=>{vZ=new WeakMap});const QWe={ar:"ar-u-nu-latn"};let v7=new WeakMap,JTe={};function eYe(t){const e=t||JTe;if(!v7.has(e)){const i=fa(),r=QWe[fa()]||i;v7.set(e,new Intl.NumberFormat(r,t))}return v7.get(e)}function UYt(t={}){const e={};return t.digitSeparator!=null&&(e.useGrouping=t.digitSeparator),t.places!=null&&(e.minimumFractionDigits=e.maximumFractionDigits=t.places),e}function nd(t,e){return Object.is(t,-0)&&(t=0),eYe(e).format(t)}cne(()=>{v7=new WeakMap,JTe={}});const KTe=Ce.getLogger("esri.intl.substitute");function By(t,e,i={}){const{format:r={}}=i;return h9(t,n=>tYe(n,e,r))}function tYe(t,e,i){let r,n;const s=t.indexOf(":");if(s===-1?r=t.trim():(r=t.slice(0,s).trim(),n=t.slice(s+1).trim()),!r)return"";const o=u9(r,e);if(o==null)return"";const l=(n?i==null?void 0:i[n]:null)??(i==null?void 0:i[r]);return l?iYe(o,l):n?rYe(o,n):_ne(o)}function iYe(t,e){switch(e.type){case"date":return js(t,e.intlOptions);case"number":return nd(t,e.intlOptions);default:return KTe.warn("missing format descriptor for key {key}"),_ne(t)}}function rYe(t,e){switch(e.toLowerCase()){case"dateformat":return js(t);case"numberformat":return nd(t);default:return KTe.warn(`inline format is unsupported since 4.12: ${e}`),/^(dateformat|datestring)/i.test(e)?js(t):/^numberformat/i.test(e)?nd(t):_ne(t)}}function _ne(t){switch(typeof t){case"string":return t;case"number":return nd(t);case"boolean":return""+t;default:return t instanceof Date?js(t):""}}const Qhe=/^([a-z]{2})(?:[-_]([A-Za-z]{2}))?$/,nYe={ar:!0,bg:!0,bs:!0,ca:!0,cs:!0,da:!0,de:!0,el:!0,en:!0,es:!0,et:!0,fi:!0,fr:!0,he:!0,hr:!0,hu:!0,id:!0,it:!0,ja:!0,ko:!0,lt:!0,lv:!0,nb:!0,nl:!0,pl:!0,"pt-BR":!0,"pt-PT":!0,ro:!0,ru:!0,sk:!0,sl:!0,sr:!0,sv:!0,th:!0,tr:!0,uk:!0,vi:!0,"zh-CN":!0,"zh-HK":!0,"zh-TW":!0};function ede(t){return t in nYe}const QR=[],eO=new Map;function tde(t){for(const e of eO.keys())QTe(t.pattern,e)&&eO.delete(e)}function sYe(t){return QR.includes(t)||(tde(t),QR.unshift(t)),rr(()=>{const e=QR.indexOf(t);e>-1&&(QR.splice(e,1),tde(t))})}async function lE(t){const e=fa();eO.has(t)||eO.set(t,aYe(t,e));const i=eO.get(t);return i&&await lYe.add(i),i}function oYe(t){if(!Qhe.test(t))return null;const e=Qhe.exec(t);if(e===null)return null;const[,i,r]=e,n=i+(r?"-"+r.toUpperCase():"");return ede(n)?n:ede(i)?i:null}async function aYe(t,e){const i=[];for(const r of QR)if(QTe(r.pattern,t))try{return await r.fetchMessageBundle(t,e)}catch(n){i.push(n)}throw i.length?new se("intl:message-bundle-error",`Errors occurred while loading "${t}"`,{errors:i}):new se("intl:no-message-bundle-loader",`No loader found for message bundle "${t}"`)}function QTe(t,e){return typeof t=="string"?e.startsWith(t):t.test(e)}cne(()=>{eO.clear()});const lYe=new class{constructor(){this._numLoading=0,this._dfd=null}async waitForAll(){this._dfd&&await this._dfd.promise}add(t){return this._increase(),t.then(()=>this._decrease(),()=>this._decrease()),this.waitForAll()}_increase(){this._numLoading++,this._dfd||(this._dfd=Jl())}_decrease(){this._numLoading=Math.max(this._numLoading-1,0),this._dfd&&this._numLoading===0&&(this._dfd.resolve(),this._dfd=null)}};let cYe=class eEe{constructor(){this._values=new Map,this.multipleOriginsSupported=!1}clone(e){const i=new eEe;return this._values.forEach((r,n)=>{e&&e.has(n)||i.set(n,Re(r.value),r.origin)}),i}get(e,i){i=this._normalizeOrigin(i);const r=this._values.get(e);return i==null||(r==null?void 0:r.origin)===i?r==null?void 0:r.value:void 0}originOf(e){var i;return((i=this._values.get(e))==null?void 0:i.origin)??Di.USER}keys(e){e=this._normalizeOrigin(e);const i=[...this._values.keys()];return e==null?i:i.filter(r=>{var n;return((n=this._values.get(r))==null?void 0:n.origin)===e})}set(e,i,r){if((r=this._normalizeOrigin(r))===Di.DEFAULTS){const n=this._values.get(e);if((n==null?void 0:n.origin)!=null&&n.origin>r)return}this._values.set(e,new uYe(i,r))}delete(e,i){var r;(i=this._normalizeOrigin(i))!=null&&((r=this._values.get(e))==null?void 0:r.origin)!==i||this._values.delete(e)}has(e,i){var r;return(i=this._normalizeOrigin(i))!=null?((r=this._values.get(e))==null?void 0:r.origin)===i:this._values.has(e)}forEach(e){this._values.forEach(({value:i},r)=>e(i,r))}_normalizeOrigin(e){if(e!=null)return e===Di.DEFAULTS?e:Di.USER}},uYe=class{constructor(e,i){this.value=e,this.origin=i}};function tEe(t,e,i){e.keys().forEach(n=>{i.set(n,e.get(n),Di.DEFAULTS)});const r=t.metadatas;Object.keys(r).forEach(n=>{t.internalGet(n)&&i.set(n,t.internalGet(n),Di.DEFAULTS)})}function hYe(t,e,i){if(!(t!=null&&t.read)||t.read.enabled===!1||!t.read.source)return!1;const r=t.read.source;if(typeof r=="string"){if(r===e||r.includes(".")&&r.indexOf(e)===0&&nhe(r,i))return!0}else for(const n of r)if(n===e||n.includes(".")&&n.indexOf(e)===0&&nhe(n,i))return!0;return!1}function dYe(t){return t&&(!t.read||t.read.enabled!==!1&&!t.read.source)}function pYe(t,e,i,r,n){let s=lZ(e[i],n);dYe(s)&&(t[i]=!0);for(const o of Object.getOwnPropertyNames(e))s=lZ(e[o],n),hYe(s,i,r)&&(t[o]=!0)}function fYe(t,e,i,r){const n=i.metadatas,s=mHe(n[e],r),o=s==null?void 0:s.default;if(o===void 0)return;const l=typeof o=="function"?o.call(t,e,r):o;l!==void 0&&i.set(e,l)}const iEe={origin:"service"};function rEe(t,e,i=iEe){if(!e||typeof e!="object")return;const r=Zl(t),n=r.metadatas,s={};for(const o of Object.getOwnPropertyNames(e))pYe(s,n,o,e,i);r.setDefaultOrigin(i.origin);for(const o of Object.getOwnPropertyNames(s)){const l=lZ(n[o],i).read,c=l==null?void 0:l.source;let f;f=c&&typeof c=="string"?d9(e,c):e[o],l!=null&&l.reader&&(f=l.reader.call(t,f,e,i)),f!==void 0&&r.set(o,f)}if(!i||!i.ignoreDefaults){r.setDefaultOrigin("defaults");for(const o of Object.getOwnPropertyNames(n))s[o]||fYe(t,o,r,i)}r.setDefaultOrigin("user")}function nEe(t,e,i,r=iEe){var s;const n={...r,messages:[]};i(n),(s=n.messages)==null||s.forEach(o=>{o.type!=="warning"||t.loaded?r!=null&&r.messages&&r.messages.push(o):t.loadWarnings.push(o)})}function mYe(t,e,i,r,n){var o,l;const s={};return(l=(o=e.write)==null?void 0:o.writer)==null||l.call(t,r,s,i,n),s}function sEe(t,e,i,r,n,s){if(!(r!=null&&r.write))return!1;const o=au(t,i);if(!n&&r.write.overridePolicy){const l=r.write.overridePolicy.call(t,o,i,s??void 0);l!==void 0&&(n=l)}if(n||(n=r.write),!n||n.enabled===!1||n.layerContainerTypes&&(s!=null&&s.layerContainerType)&&!n.layerContainerTypes.includes(s.layerContainerType))return!1;if((o===null&&!n.allowNull&&!n.writerEnsuresNonNull||o===void 0)&&n.isRequired){const l=new se("web-document-write:property-required",`Missing value for required property '${i}' on '${t.declaredClass}'`,{propertyName:i,target:t});return l&&(s!=null&&s.messages)?s.messages.push(l):l&&!s&&Ce.getLogger("esri.core.accessorSupport.write").error(l.name,l.message),!1}return!(o===void 0||o===null&&!n.allowNull&&!n.writerEnsuresNonNull||!n.alwaysWriteDefaults&&(!e.store.multipleOriginsSupported||e.store.originOf(i)===Di.DEFAULTS)&&gYe(t,i,s,r,o)||!n.ignoreOrigin&&(s!=null&&s.origin)&&e.store.multipleOriginsSupported&&e.store.originOf(i)0&&(e=c7(e,_),(o=(s=i==null?void 0:i.resources)==null?void 0:s.pendingOperations)!=null&&o.length&&i.resources.pendingOperations.push(Promise.all(i.resources.pendingOperations).then(()=>c7(e,_,()=>"replace-arrays"))),i!=null&&i.writtenProperties&&i.writtenProperties.push({target:t,propName:l,oldOrigin:rGe(r.store.originOf(l)),newOrigin:i.origin}))}return e}const P_=t=>{let e=class extends t{constructor(...i){super(...i);const r=Zl(this),n=r.store,s=new cYe;r.store=s,tEe(r,n,s)}read(i,r){rEe(this,i,r)}write(i,r){return aEe(this,i??{},r)}toJSON(i){return this.write({},i)}static fromJSON(i,r){return yYe.call(this,i,r)}};return e=y([Z("esri.core.JSONSupport")],e),e.prototype.toJSON.isDefaultToJSON=!0,e};function yYe(t,e){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const i=new this;return i.read(t,e),i}function sz(t){return t&&typeof t=="object"&&"toJSON"in t&&typeof t.toJSON=="function"}let Ue=class extends P_(ze){};Ue=y([Z("esri.core.JSONSupport")],Ue);const vYe=/^https:\/\/([a-z\d-]+)(\.maps([^.]*))?\.arcgis\.com/i,_Ye={devext:{customBaseUrl:"mapsdevext.arcgis.com",portalHostname:"devext.arcgis.com"},qaext:{customBaseUrl:"mapsqa.arcgis.com",portalHostname:"qaext.arcgis.com"},www:{customBaseUrl:"maps.arcgis.com",portalHostname:"www.arcgis.com"}};function ide(t){const e=t==null?void 0:t.match(vYe);if(!e)return null;const[,i,r,n]=e;if(!i)return null;let s=null,o=null,l=null;const{devext:c,qaext:f,www:_}=_Ye;if(r)if(s=i,n)switch(n.toLowerCase()){case"devext":({customBaseUrl:o,portalHostname:l}=c);break;case"qa":({customBaseUrl:o,portalHostname:l}=f);break;default:return null}else({customBaseUrl:o,portalHostname:l}=_);else switch(i.toLowerCase()){case"devext":({customBaseUrl:o,portalHostname:l}=c);break;case"qaext":({customBaseUrl:o,portalHostname:l}=f);break;case"www":({customBaseUrl:o,portalHostname:l}=_);break;default:return null}return{customBaseUrl:o,isPortal:!1,portalHostname:l,urlKey:s}}function bYe(t){return/\/(sharing|usrsvcs)\/(appservices|servers)\//i.test(t)}function lEe(t){const e=atob(t),i=new Uint8Array(e.length);for(let r=0;rsu,GYt=()=>bne;function RYe(){const t=su.path,e=t.substring(0,t.lastIndexOf(t.split("/")[t.split("/").length-1]));return`${`${su.scheme}://${su.host}${su.port!=null?`:${su.port}`:""}`}${e}`}function qs(t){if(!t)return null;const e={path:null,query:null},i=new m2(t),r=t.indexOf("?");return i.query===null?e.path=t:(e.path=t.substring(0,r),e.query=xne(i.query)),i.fragment&&(e.hash=i.fragment,i.query===null&&(e.path=e.path.substring(0,e.path.length-(i.fragment.length+1)))),e}function xne(t){const e=t.split("&"),i={};for(const r of e){if(!r)continue;const n=r.indexOf("=");let s,o;n<0?(s=decodeURIComponent(r),o=""):(s=decodeURIComponent(r.slice(0,n)),o=decodeURIComponent(r.slice(n+1)));let l=i[s];typeof l=="string"&&(l=i[s]=[l]),Array.isArray(l)?l.push(o):i[s]=o}return i}function PT(t,e){return t?e&&typeof e=="function"?Object.keys(t).map(i=>encodeURIComponent(i)+"="+encodeURIComponent(e(i,t[i]))).join("&"):Object.keys(t).map(i=>{const r=t[i];if(r==null)return"";const n=encodeURIComponent(i)+"=",s=e==null?void 0:e[i];return s?n+encodeURIComponent(s(r)):Array.isArray(r)?r.map(o=>sz(o)?n+encodeURIComponent(JSON.stringify(o)):n+encodeURIComponent(o)).join("&"):sz(r)?n+encodeURIComponent(JSON.stringify(r)):n+encodeURIComponent(r)}).filter(i=>i).join("&"):""}function IYe(t=!1){let e,i=iP.proxyUrl;if(typeof t=="string"){e=UYe(t);const r=nB(t);r&&(i=r.proxyUrl)}else e=!!t;if(!i)throw xYe.warn(rde),new se("urlutils:proxy-not-set",rde);return e&&_Z()&&(i=Mne(i)),qs(i)}function $Ye(t){const e=nB(t);let i,r;if(e){const n=Sne(e.proxyUrl);i=n.path,r=n.query?xne(n.query):null}if(i){const n=qs(t);t=i+"?"+n.path;const s=PT({...r,...n.query});s&&(t=`${t}?${s}`)}return t}const UP={path:"",query:""};function Sne(t){const e=t.indexOf("?");return e!==-1?(UP.path=t.slice(0,e),UP.query=t.slice(e+1)):(UP.path=t,UP.query=null),UP}function hEe(t){return t=(t=az(t=HYe(t=Sne(t).path),!0)).toLowerCase()}function LYe(t){const e={proxyUrl:t.proxyUrl,urlPrefix:hEe(t.urlPrefix)},i=iP.proxyRules,r=e.urlPrefix;let n=i.length;for(let s=0;s0?t.substring(0,e):t.replace(/\/+$/,"")}function pEe(t){const e=r=>r==null||r instanceof RegExp&&r.test(t)||typeof r=="string"&&t.startsWith(r),i=iP.interceptors;if(i){for(const r of i)if(Array.isArray(r.urls)){if(r.urls.some(e))return r}else if(e(r.urls))return r}return null}function UO(t,e,i=!1){if(!t||!e)return!1;const r=wZ(t),n=wZ(e);return!(!i&&r.scheme!==n.scheme)&&r.host!=null&&n.host!=null&&r.host.toLowerCase()===n.host.toLowerCase()&&r.port===n.port}function Tne(t){if(typeof t=="string"){if(!Zh(t))return!0;t=wZ(t)}if(UO(t,su))return!0;const e=iP.trustedServers||[];for(let i=0;i(A=x.indexOf(T,A))===-1?x.length:A;let c=l(n,"/",n.indexOf("//")+2),f=-1;for(;n.slice(0,c+1)===s.slice(0,c)+"/"&&(f=c+1,c!==n.length);)c=l(n,"/",c+1);if(f===-1||o&&f0)for(let x=0;x<_;x++)t=`../${t}`;else t=`./${t}`;return t}function Mf(t){return t=YYe(t=WYe(t=qYe(t=Gh(t=t.trim()))))}function s0(...t){const e=t.filter(ys);if(!(e!=null&&e.length))return;const i=[];if(Zh(e[0])){const n=e[0],s=n.indexOf("//");s!==-1&&(i.push(n.slice(0,s+1)),BYe(e[0])&&(i[0]+="/"),e[0]=n.slice(s+2))}else e[0][0]==="/"&&i.push("");const r=e.reduce((n,s)=>s?n.concat(s.split("/")):n,[]);for(let n=0;n0&&i[i.length-1]!==".."?i.pop():(!s&&n===r.length-1||s&&(s!=="."||i.length===0))&&i.push(s)}return i.join("/")}function Tm(t,e=!1){if(t==null||E2(t)||i1(t))return null;let i=t.indexOf("://");if(i===-1&&jy(t))i=2;else{if(i===-1)return null;i+=3}const r=t.indexOf("/",i);return r!==-1&&(t=t.slice(0,r)),e&&(t=az(t,!0)),t}function Zh(t){return jy(t)||Ane(t)}function E2(t){return t!=null&&t.slice(0,5)==="blob:"}function i1(t){return t!=null&&t.slice(0,5)==="data:"}function Cne(t){const e=C2(t);return e&&e.isBase64?lEe(e.data):null}function HYt(t){return wYe(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}const FYe=/^data:(.*?)(;base64)?,(.*)$/;function C2(t){const e=t.match(FYe);if(!e)return null;const[,i,r,n]=e;return{mediaType:i,isBase64:!!r,data:n}}function fEe(t){return t.isBase64?`data:${t.mediaType};base64,${t.data}`:`data:${t.mediaType},${t.data}`}async function kYe(t){return(await fetch(t)).blob()}function qYt(t){const e=Cne(t);if(!e)return null;const i=C2(t);return new Blob([e],{type:i.mediaType})}function WYt(t,e){zYe(t,e)}function zYe(t,e){if(!t)return!1;const i=document.createElement("a");if(!("download"in i))return!1;const r=URL.createObjectURL(t);return i.download=e,i.href=r,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r),!0}function jy(t){return t!=null&&t[0]==="/"&&t[1]==="/"}function Ane(t){return t!=null&&cEe.test(t)}function UYe(t){return t!=null&&SYe.test(t)||su.scheme==="https"&&jy(t)}function VYe(t){return t!=null&&uEe.test(t)||su.scheme==="http"&&jy(t)}function BYe(t){return t!=null&&TYe.test(t)}function Mne(t){return jy(t)?`https:${t}`:t.replace(uEe,"https:")}function jYe(){return su.scheme==="http"}function _Z(){return su.scheme==="https"}function az(t,e=!1){return jy(t)?t.slice(2):(t=t.replace(cEe,""),e&&t.length>1&&t[0]==="/"&&t[1]==="/"&&(t=t.slice(2)),t)}function GYe(t){const e=t.indexOf("//"),i=t.indexOf("/",e+2);return i===-1?t:t.slice(0,i)}function One(t){let e=0;if(Zh(t)){const r=t.indexOf("//");r!==-1&&(e=r+2)}const i=t.lastIndexOf("/");return ir===n||r.endsWith(`.${n}`))||_Z()&&!nB(t))&&(t=Mne(t)),t}function bZ(t,e,i){if(!(e&&i&&t&&Zh(t)))return t;const r=t.indexOf("//"),n=t.indexOf("/",r+2),s=t.indexOf(":",r+2),o=Math.min(n<0?t.length:n,s<0?t.length:s);return t.slice(r+2,o).toLowerCase()!==e.toLowerCase()?t:`${t.slice(0,r+2)}${i}${t.slice(o)}`}function wZ(t){return typeof t=="string"?new m2(Gh(t)):(t.scheme||(t.scheme=su.scheme),t)}function gEe(t){return XYe.test(t)}function yEe(t,e){const i=qs(t),r=Object.keys(i.query||{});return r.length>0&&e&&e.warn("removeQueryParameters()",`Url query parameters are not supported, the following parameters have been removed: ${r.join(", ")}.`),i.path}function Pne(t,e,i){const r=qs(t),n=r.query||{};return n[e]=String(i),`${r.path}?${PT(n)}`}function tO(t,e){if(!e)return t;const i=qs(t),r=i.query||{};for(const[s,o]of Object.entries(e))o!=null&&(r[s]=o);const n=PT(r);return n?`${i.path}?${n}`:i.path}function Rne(t){if(t==null)return null;const e=t.match(vEe);return e?e[2]:null}function nde(t){if(t==null)return null;const e=t.match(vEe);return e?{path:e[1],extension:e[2]}:{path:t,extension:null}}async function XYt(t){return typeof t=="string"?C2(t)??{data:t}:new Promise((e,i)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>e(C2(r.result)),r.onerror=n=>i(n)})}const vEe=/([^.]*)\.([^\/]*)$/,XYe=/(^data:image\/svg|\.svg$)/i,_Ee="20231115",bEe="a6fcf2901ef678ef17a528e11b93ffe09e3ec267";Symbol.dispose??(Symbol.dispose=Symbol("Symbol.dispose")),Symbol.asyncDispose??(Symbol.asyncDispose=Symbol("Symbol.asyncDispose"));const wEe="4.28";let yr,Ine=wEe;Ine="4.28.10";function ZYt(t){yr=t}function ZYe(t){const e=yr==null?void 0:yr.findCredential(t);return e!=null&&e.token?Pne(t,"token",e.token):t}Le("host-webworker");const JYe=new Set(["elevation3d.arcgis.com","js.arcgis.com","jsdev.arcgis.com","jsqa.arcgis.com","static.arcgis.com"]);function $ne(t){const e=Tm(t,!0);return!!e&&e.endsWith(".arcgis.com")&&!JYe.has(e)&&!t.endsWith("/sharing/rest/generateToken")}function xEe(t,e,i=!1,r){return new Promise((n,s)=>{if(xo(r))return void s(sde());let o=()=>{f(),s(new Error(`Unable to load ${e}`))},l=()=>{const _=t;f(),n(_)},c=()=>{if(!t)return;const _=t;f(),_.src="",s(sde())};const f=()=>{Le("esri-image-decode")||(t.removeEventListener("error",o),t.removeEventListener("load",l)),o=null,l=null,t=null,r!=null&&r.removeEventListener("abort",c),c=null,i&&URL.revokeObjectURL(e)};r!=null&&r.addEventListener("abort",c),Le("esri-image-decode")?t.decode().then(l,o):(t.addEventListener("error",o),t.addEventListener("load",l))})}function sde(){try{return new DOMException("Aborted","AbortError")}catch{const t=new Error;return t.name="AbortError",t}}const SEe="Timeout exceeded";function KYe(){return new Error(SEe)}function JYt(t){return typeof t=="object"&&!!t&&"message"in t&&t.message===SEe}function QYe(t){Ar.request.crossOriginNoCorsDomains||(Ar.request.crossOriginNoCorsDomains={});const e=Ar.request.crossOriginNoCorsDomains;for(let i of t)i=i.toLowerCase(),/^https?:\/\//.test(i)?e[Tm(i)??""]=0:(e[Tm("http://"+i)??""]=0,e[Tm("https://"+i)??""]=0)}function eXe(t){const e=Ar.request.crossOriginNoCorsDomains;if(e){let i=Tm(t);if(i)return i=i.toLowerCase(),!UO(i,wne())&&e[i]o.abort());const l={controller:o,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:s,params:n,redoRequest:!1,useIdentity:im.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},c=await hXe(l);return(f=s==null?void 0:s.after)==null||f.call(s,c),c}let lz;const im=Ar.request,TEe="FormData"in globalThis,iXe=new Set([499,498,403,401]),rXe=new Set(["COM_0056","COM_0057","SB_0008"]),nXe=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],Lne=()=>null,cz=Symbol();function sXe(t){const e=Tm(t);e&&!bi._corsServers.includes(e)&&bi._corsServers.push(e)}function ode(t){const e=Tm(t);return!e||e.endsWith(".arcgis.com")||bi._corsServers.includes(e)||Tne(e)}function xy(t,e,i,r){let n="Error";const s={url:i.url,requestOptions:i.requestOptions,getHeader:Lne,ssl:!1};if(e instanceof se)return e.details?(e.details=Re(e.details),e.details.url=i.url,e.details.requestOptions=i.requestOptions):e.details=s,e;if(e){const o=r&&(f=>r.headers.get(f)),l=r==null?void 0:r.status,c=e.message;c&&(n=c),o&&(s.getHeader=o),s.httpStatus=(e.httpCode!=null?e.httpCode:e.code)||l||0,s.subCode=e.subcode,s.messageCode=e.messageCode,typeof e.details=="string"?s.messages=[e.details]:s.messages=e.details,s.raw=cz in e?e[cz]:e}return sn(e)?ur():new se(t,n,s)}async function oXe(){Le("host-webworker")?lz||(lz=await we(()=>import("./request-VBZq5-ns.js"),__vite__mapDeps([]))):bi._abortableFetch||(bi._abortableFetch=globalThis.fetch.bind(globalThis))}async function xZ(){yr||await we(()=>import("./IdentityManager-DTERQ1-w.js"),__vite__mapDeps([]))}async function aXe(t){var l;const e=t.params.url,i=t.params.requestOptions,r=t.controller.signal,n=i.body;let s=null,o=null;if(TEe&&"HTMLFormElement"in globalThis&&(n instanceof FormData?s=n:n instanceof HTMLFormElement&&(s=new FormData(n))),typeof n=="string"&&(o=n),t.fetchOptions={cache:i.cacheBust&&!("polyfill"in bi._abortableFetch)?"no-cache":"default",credentials:"same-origin",headers:i.headers||{},method:i.method==="head"?"HEAD":"GET",mode:"cors",priority:im.priority,redirect:"follow",signal:r},(s||o)&&(t.fetchOptions.body=s||o),i.authMode==="anonymous"&&(t.useIdentity=!1),t.hasToken=!!(/token=/i.test(e)||(l=i.query)!=null&&l.token||s!=null&&s.get("token")),!t.hasToken&&Ar.apiKey&&$ne(e)&&(i.query||(i.query={}),i.query.token=Ar.apiKey,t.hasToken=!0),t.useIdentity&&!t.hasToken&&!t.credentialToken&&!EEe(e)&&!xo(r)){let c;i.authMode==="immediate"?(await xZ(),c=await yr.getCredential(e,{signal:r}),t.credential=c):i.authMode==="no-prompt"?(await xZ(),c=await yr.getCredential(e,{prompt:!1,signal:r}).catch(()=>{}),t.credential=c):yr&&(c=yr.findCredential(e)),c&&(t.credentialToken=c.token,t.useSSL=!!c.ssl)}}function EEe(t){return nXe.some(e=>e.test(t))}async function lXe(t){let e=t.params.url;const i=t.params.requestOptions,r=t.fetchOptions??{},n=E2(e)||i1(e),s=i.responseType||"json",o=n?0:i.timeout!=null?i.timeout:im.timeout;let l=!1;if(!n){t.useSSL&&(e=Mne(e)),i.cacheBust&&r.cache==="default"&&(e=Pne(e,"request.preventCache",Date.now()));let T={...i.query};t.credentialToken&&(T.token=t.credentialToken);let A=PT(T);Le("esri-url-encodes-apostrophe")&&(A=A.replaceAll("'","%27"));const M=e.length+1+A.length;let I;l=i.method==="delete"||i.method==="post"||i.method==="put"||!!i.body||M>im.maxUrlLength;const L=i.useProxy||!!nB(e);if(L){const F=IYe(e);I=F.path,!l&&I.length+1+M>im.maxUrlLength&&(l=!0),F.query&&(T={...F.query,...T})}if(r.method==="HEAD"&&(l||L)){if(l)throw M>im.maxUrlLength?xy("request:invalid-parameters",new Error("URL exceeds maximum length"),t.params):xy("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),t.params);if(L)throw xy("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),t.params)}if(l?(r.method=i.method==="delete"?"DELETE":i.method==="put"?"PUT":"POST",i.body?e=tO(e,T):(r.body=PT(T),r.headers||(r.headers={}),r.headers["Content-Type"]="application/x-www-form-urlencoded")):e=tO(e,T),L&&(t.useProxy=!0,e=`${I}?${e}`),T.token&&TEe&&r.body instanceof FormData&&!bYe(e)&&r.body.set("token",T.token),i.hasOwnProperty("withCredentials"))t.withCredentials=i.withCredentials;else if(!UO(e,wne())){if(Tne(e))t.withCredentials=!0;else if(yr){const F=yr.findServerInfo(e);F!=null&&F.webTierAuth&&(t.withCredentials=!0)}}t.withCredentials&&(r.credentials="include",eXe(e)&&await tXe(l?tO(e,T):e))}let c,f,_=0,x=!1;o>0&&(_=setTimeout(()=>{x=!0,t.controller.abort()},o));try{if(i.responseType==="native-request-init")f=r,f.url=e;else if(i.responseType!=="image"||r.cache!=="default"||r.method!=="GET"||l||uXe(i.headers)||!n&&!t.useProxy&&im.proxyUrl&&!ode(e)){if(c=await bi._abortableFetch(e,r),t.useProxy||sXe(e),i.responseType==="native")f=c;else if(r.method!=="HEAD")if(c.ok){switch(s){case"array-buffer":f=await c.arrayBuffer();break;case"blob":case"image":f=await c.blob();break;default:f=await c.text()}if(_&&(clearTimeout(_),_=0),s==="json"||s==="xml"||s==="document")if(f)switch(s){case"json":f=JSON.parse(f);break;case"xml":f=ade(f,"application/xml");break;case"document":f=ade(f,"text/html")}else f=null;if(f){if(s==="array-buffer"||s==="blob"){const T=c.headers.get("Content-Type");if(T&&/application\/json|text\/plain/i.test(T)&&f[s==="blob"?"size":"byteLength"]<=750)try{const A=await new Response(f).json();A.error&&(f=A)}catch{}}s==="image"&&f instanceof Blob&&(f=await lde(URL.createObjectURL(f),t,!0))}}else{f=await c.text();try{f=JSON.parse(f)}catch{}}}else f=await lde(e,t)}catch(T){if(T.name==="AbortError")throw x?KYe():ur("Request canceled");if(!(!c&&T instanceof TypeError&&im.proxyUrl)||i.body||i.method==="delete"||i.method==="head"||i.method==="post"||i.method==="put"||t.useProxy||ode(e))throw T;t.redoRequest=!0,LYe({proxyUrl:im.proxyUrl,urlPrefix:Tm(e)??""})}finally{_&&clearTimeout(_)}return[c,f]}async function cXe(t,e){if(t.responseData!=null)return t.responseData;if(t.headers&&(e.requestOptions.headers={...e.requestOptions.headers,...t.headers}),t.query&&(e.requestOptions.query={...e.requestOptions.query,...t.query}),t.before){let i,r;try{r=await t.before(e)}catch(n){i=xy("request:interceptor",n,e)}if((r instanceof Error||r instanceof se)&&(i=xy("request:interceptor",r,e)),i)throw t.error&&t.error(i),i;return r}}function uXe(t){if(t){for(const e of Object.getOwnPropertyNames(t))if(t[e])return!0}return!1}function ade(t,e){let i;try{i=new DOMParser().parseFromString(t,e)}catch{}if(!i||i.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return i}async function hXe(t){var s,o;let e,i;await aXe(t);try{do[e,i]=await lXe(t);while(!await dXe(t,e,i))}catch(l){const c=xy("request:server",l,t.params,e);throw c.details.ssl=t.useSSL,(s=t.interceptor)!=null&&s.error&&t.interceptor.error(c),c}const r=t.params.url;if(i&&/\/sharing\/rest\/(accounts|portals)\/self/i.test(r)){if(!t.hasToken&&!t.credentialToken&&((o=i.user)!=null&&o.username)&&!Tne(r)){const l=Tm(r,!0);l&&im.trustedServers.push(l)}Array.isArray(i.authorizedCrossOriginNoCorsDomains)&&QYe(i.authorizedCrossOriginNoCorsDomains)}const n=t.credential;if(n&&yr){const l=yr.findServerInfo(n.server);let c=l==null?void 0:l.owningSystemUrl;if(c){c=c.replace(/\/?$/,"/sharing");const f=yr.findCredential(c,n.userId);f&&yr._getIdenticalSvcIdx(c,f)===-1&&f.resources.unshift(c)}}return{data:i,getHeader:e?l=>e==null?void 0:e.headers.get(l):Lne,httpStatus:(e==null?void 0:e.status)??200,requestOptions:t.params.requestOptions,ssl:t.useSSL,url:t.params.url}}async function dXe(t,e,i){var f;if(t.redoRequest)return t.redoRequest=!1,!1;const r=t.params.requestOptions;if(!e||r.responseType==="native"||r.responseType==="native-request-init")return!0;let n,s;if(i&&(i.error?n=i.error:i.status==="error"&&Array.isArray(i.messages)&&(n={...i},n[cz]=i,n.details=i.messages)),!n&&!e.ok)throw n=new Error(`Unable to load ${e.url} status: ${e.status}`),n[cz]=i,n;let o,l=null;n&&(s=Number(n.code),l=n.hasOwnProperty("subcode")?Number(n.subcode):null,o=n.messageCode,o=o==null?void 0:o.toUpperCase());const c=r.authMode;if(s===403&&(l===4||(f=n.message)!=null&&f.toLowerCase().includes("ssl")&&!n.message.toLowerCase().includes("permission"))){if(!t.useSSL)return t.useSSL=!0,!1}else if(!t.hasToken&&t.useIdentity&&(c!=="no-prompt"||s===498)&&s!==void 0&&iXe.has(s)&&!EEe(t.params.url)&&(s!==403||(!o||!rXe.has(o))&&(l==null||l===2&&t.credentialToken))){await xZ();try{const _=await yr.getCredential(t.params.url,{error:xy("request:server",n,t.params),prompt:c!=="no-prompt",signal:t.controller.signal,token:t.credentialToken});return t.credential=_,t.credentialToken=_.token,t.useSSL=t.useSSL||_.ssl,!1}catch(_){if(c==="no-prompt")return t.credential=void 0,t.credentialToken=void 0,!1;n=_}}if(n)throw n;return!0}function lde(t,e,i=!1){const r=e.controller.signal,n=new Image;return e.withCredentials?n.crossOrigin="use-credentials":n.crossOrigin="anonymous",n.alt="",n.fetchPriority=im.priority,n.src=t,xEe(n,t,i,r)}bi._abortableFetch=null,bi._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"];async function pXe(t,e,i,r){const n=e.exec(i);if(!n)throw new se("esri-intl:invalid-bundle",`Bundle id "${i}" is not compatible with the pattern "${e}"`);const s=n[1]?`${n[1]}/`:"",o=n[2],l=oYe(r),c=`${s}${o}.json`,f=l?`${s}${o}_${l}.json`:c;let _;try{_=await cde(t(f))}catch(x){if(f===c)throw new se("intl:unknown-bundle",`Bundle "${i}" cannot be loaded`,{error:x});try{_=await cde(t(c))}catch(T){throw new se("intl:unknown-bundle",`Bundle "${i}" cannot be loaded`,{error:T})}}return _}async function cde(t){if(ude.fetchBundleAsset!=null)return ude.fetchBundleAsset(t);const e=await bi(t,{responseType:"text"});return JSON.parse(e.data)}let fXe=class{constructor({base:e="",pattern:i,location:r=new URL(window.location.href)}){let n;n=typeof r=="string"?s=>new URL(s,new URL(r,window.location.href)).href:r instanceof URL?s=>new URL(s,r).href:r,this.pattern=typeof i=="string"?new RegExp(`^${i}`):i,this.getAssetUrl=n,e=e?e.endsWith("/")?e:e+"/":"",this.matcher=new RegExp(`^${e}(?:(.*)/)?(.*)$`)}fetchMessageBundle(e,i){return pXe(this.getAssetUrl,this.matcher,e,i)}};function mXe(t){return new fXe(t)}const ude={},gXe=Ce.getLogger("esri.assets");function yXe(t,e){return bi(Wr(t),e)}function Wr(t){if(!Ar.assetsPath)throw gXe.errorOnce("The API assets location needs to be set using config.assetsPath. More information: https://arcg.is/1OzLe50"),new se("assets:path-not-set","config.assetsPath is not set");return s0(Ar.assetsPath,t)}sYe(mXe({pattern:"esri/",location:Wr}));function x9(t){return typeof t=="string"?document.getElementById(t):t??null}function CEe(t){for(;t.hasChildNodes();)t.removeChild(t.firstChild)}function hde(t,e){const i=e.parentNode;i&&i.insertBefore(t,e)}function dde(t,e){for(;;){const i=t.firstChild;if(!i)break;e.appendChild(i)}}function vXe(t){t.parentNode&&t.parentNode.removeChild(t)}var Rw;(function(t){t[t.PENDING=0]="PENDING",t[t.RESOLVED=1]="RESOLVED",t[t.REJECTED=2]="REJECTED"})(Rw||(Rw={}));let _Xe=class{constructor(){this._resolver=Jl(),this._status=Rw.PENDING,this._resolvingPromises=[],this._resolver.promise.then(()=>{this._status=Rw.RESOLVED,this._cleanUp()},()=>{this._status=Rw.REJECTED,this._cleanUp()}),this.promise=this._resolver.promise}destroy(){this._cleanUp()}addResolvingPromise(e){this._resolvingPromises.push(e),this._tryResolve()}isResolved(){return this._status===Rw.RESOLVED}isRejected(){return this._status===Rw.REJECTED}isFulfilled(){return this._status!==Rw.PENDING}abort(){this._resolver.reject(ur())}_cleanUp(){this._allPromise=null,this._resolvingPromises=null}_tryResolve(){if(this.isFulfilled())return;const e=Jl(),i=[...this._resolvingPromises,e.promise],r=this._allPromise=Promise.all(i);r.then(()=>{this.isFulfilled()||this._allPromise!==r||this._resolver.resolve()},n=>{this.isFulfilled()||this._allPromise!==r||sn(n)||this._resolver.reject(n)}),e.resolve()}};const S9=t=>{let e=class extends t{constructor(...i){super(...i),this._promiseProps=new _Xe,this.addResolvingPromise(Promise.resolve())}destroy(){this._promiseProps.destroy()}isResolved(){return this._promiseProps.isResolved()}isRejected(){return this._promiseProps.isRejected()}isFulfilled(){return this._promiseProps.isFulfilled()}when(i,r){return this._promiseProps.promise.then(()=>this).then(i,r)}catch(i){return this.when(null,i)}addResolvingPromise(i){i&&!this._promiseProps.isFulfilled()&&this._promiseProps.addResolvingPromise("_promiseProps"in i?i.when():i)}};return e=y([Z("esri.core.Promise")],e),e};let uz=class extends S9(ze){};uz=y([Z("esri.core.Promise")],uz);const bXe="randomUUID"in crypto;function Vf(){if(bXe)return crypto.randomUUID();const t=crypto.getRandomValues(new Uint16Array(8));t[3]=4095&t[3]|16384,t[4]=16383&t[4]|32768;const e=i=>t[i].toString(16).padStart(4,"0");return e(0)+e(1)+"-"+e(2)+"-"+e(3)+"-"+e(4)+"-"+e(5)+e(6)+e(7)}function tXt(){return`{${Vf().toUpperCase()}}`}function wXe(){return`{${Vf()}}`}const xXe=Object.prototype.toString;function SXe(t){const e="__accessorMetadata__"in t?$s(t):t;return function(...i){if(i.push(e),typeof i[2]=="number")throw new Error("Using @cast has parameter decorator is not supported since 4.16");return TXe.apply(this,i)}}function TXe(t,e,i,r){f9(t,e).cast=r}function EXe(t){return(e,i)=>{f9(e,t).cast=e[i]}}function Ci(...t){if(t.length!==3||typeof t[1]!="string")return t.length===1&&xXe.call(t[0])==="[object Function]"?SXe(t[0]):t.length===1&&typeof t[0]=="string"?EXe(t[0]):void 0}/*! - * @esri/arcgis-html-sanitizer - v3.0.1 - Tue Nov 15 2022 09:46:54 GMT-0800 (Pacific Standard Time) - * Copyright (c) 2022 - Environmental Systems Research Institute, Inc. - * Apache-2.0 - * - * js-xss - * Copyright (c) 2012-2018 Zongmin Lei(雷宗民) - * http://ucdok.com - * MIT License, see https://github.com/leizongmin/js-xss/blob/master/LICENSE for details - */var CXe=function(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);if(e===null)return!0;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},xS={exports:{}},ea={},nL={exports:{}},cE={};function AEe(){var t={};return t["align-content"]=!1,t["align-items"]=!1,t["align-self"]=!1,t["alignment-adjust"]=!1,t["alignment-baseline"]=!1,t.all=!1,t["anchor-point"]=!1,t.animation=!1,t["animation-delay"]=!1,t["animation-direction"]=!1,t["animation-duration"]=!1,t["animation-fill-mode"]=!1,t["animation-iteration-count"]=!1,t["animation-name"]=!1,t["animation-play-state"]=!1,t["animation-timing-function"]=!1,t.azimuth=!1,t["backface-visibility"]=!1,t.background=!0,t["background-attachment"]=!0,t["background-clip"]=!0,t["background-color"]=!0,t["background-image"]=!0,t["background-origin"]=!0,t["background-position"]=!0,t["background-repeat"]=!0,t["background-size"]=!0,t["baseline-shift"]=!1,t.binding=!1,t.bleed=!1,t["bookmark-label"]=!1,t["bookmark-level"]=!1,t["bookmark-state"]=!1,t.border=!0,t["border-bottom"]=!0,t["border-bottom-color"]=!0,t["border-bottom-left-radius"]=!0,t["border-bottom-right-radius"]=!0,t["border-bottom-style"]=!0,t["border-bottom-width"]=!0,t["border-collapse"]=!0,t["border-color"]=!0,t["border-image"]=!0,t["border-image-outset"]=!0,t["border-image-repeat"]=!0,t["border-image-slice"]=!0,t["border-image-source"]=!0,t["border-image-width"]=!0,t["border-left"]=!0,t["border-left-color"]=!0,t["border-left-style"]=!0,t["border-left-width"]=!0,t["border-radius"]=!0,t["border-right"]=!0,t["border-right-color"]=!0,t["border-right-style"]=!0,t["border-right-width"]=!0,t["border-spacing"]=!0,t["border-style"]=!0,t["border-top"]=!0,t["border-top-color"]=!0,t["border-top-left-radius"]=!0,t["border-top-right-radius"]=!0,t["border-top-style"]=!0,t["border-top-width"]=!0,t["border-width"]=!0,t.bottom=!1,t["box-decoration-break"]=!0,t["box-shadow"]=!0,t["box-sizing"]=!0,t["box-snap"]=!0,t["box-suppress"]=!0,t["break-after"]=!0,t["break-before"]=!0,t["break-inside"]=!0,t["caption-side"]=!1,t.chains=!1,t.clear=!0,t.clip=!1,t["clip-path"]=!1,t["clip-rule"]=!1,t.color=!0,t["color-interpolation-filters"]=!0,t["column-count"]=!1,t["column-fill"]=!1,t["column-gap"]=!1,t["column-rule"]=!1,t["column-rule-color"]=!1,t["column-rule-style"]=!1,t["column-rule-width"]=!1,t["column-span"]=!1,t["column-width"]=!1,t.columns=!1,t.contain=!1,t.content=!1,t["counter-increment"]=!1,t["counter-reset"]=!1,t["counter-set"]=!1,t.crop=!1,t.cue=!1,t["cue-after"]=!1,t["cue-before"]=!1,t.cursor=!1,t.direction=!1,t.display=!0,t["display-inside"]=!0,t["display-list"]=!0,t["display-outside"]=!0,t["dominant-baseline"]=!1,t.elevation=!1,t["empty-cells"]=!1,t.filter=!1,t.flex=!1,t["flex-basis"]=!1,t["flex-direction"]=!1,t["flex-flow"]=!1,t["flex-grow"]=!1,t["flex-shrink"]=!1,t["flex-wrap"]=!1,t.float=!1,t["float-offset"]=!1,t["flood-color"]=!1,t["flood-opacity"]=!1,t["flow-from"]=!1,t["flow-into"]=!1,t.font=!0,t["font-family"]=!0,t["font-feature-settings"]=!0,t["font-kerning"]=!0,t["font-language-override"]=!0,t["font-size"]=!0,t["font-size-adjust"]=!0,t["font-stretch"]=!0,t["font-style"]=!0,t["font-synthesis"]=!0,t["font-variant"]=!0,t["font-variant-alternates"]=!0,t["font-variant-caps"]=!0,t["font-variant-east-asian"]=!0,t["font-variant-ligatures"]=!0,t["font-variant-numeric"]=!0,t["font-variant-position"]=!0,t["font-weight"]=!0,t.grid=!1,t["grid-area"]=!1,t["grid-auto-columns"]=!1,t["grid-auto-flow"]=!1,t["grid-auto-rows"]=!1,t["grid-column"]=!1,t["grid-column-end"]=!1,t["grid-column-start"]=!1,t["grid-row"]=!1,t["grid-row-end"]=!1,t["grid-row-start"]=!1,t["grid-template"]=!1,t["grid-template-areas"]=!1,t["grid-template-columns"]=!1,t["grid-template-rows"]=!1,t["hanging-punctuation"]=!1,t.height=!0,t.hyphens=!1,t.icon=!1,t["image-orientation"]=!1,t["image-resolution"]=!1,t["ime-mode"]=!1,t["initial-letters"]=!1,t["inline-box-align"]=!1,t["justify-content"]=!1,t["justify-items"]=!1,t["justify-self"]=!1,t.left=!1,t["letter-spacing"]=!0,t["lighting-color"]=!0,t["line-box-contain"]=!1,t["line-break"]=!1,t["line-grid"]=!1,t["line-height"]=!1,t["line-snap"]=!1,t["line-stacking"]=!1,t["line-stacking-ruby"]=!1,t["line-stacking-shift"]=!1,t["line-stacking-strategy"]=!1,t["list-style"]=!0,t["list-style-image"]=!0,t["list-style-position"]=!0,t["list-style-type"]=!0,t.margin=!0,t["margin-bottom"]=!0,t["margin-left"]=!0,t["margin-right"]=!0,t["margin-top"]=!0,t["marker-offset"]=!1,t["marker-side"]=!1,t.marks=!1,t.mask=!1,t["mask-box"]=!1,t["mask-box-outset"]=!1,t["mask-box-repeat"]=!1,t["mask-box-slice"]=!1,t["mask-box-source"]=!1,t["mask-box-width"]=!1,t["mask-clip"]=!1,t["mask-image"]=!1,t["mask-origin"]=!1,t["mask-position"]=!1,t["mask-repeat"]=!1,t["mask-size"]=!1,t["mask-source-type"]=!1,t["mask-type"]=!1,t["max-height"]=!0,t["max-lines"]=!1,t["max-width"]=!0,t["min-height"]=!0,t["min-width"]=!0,t["move-to"]=!1,t["nav-down"]=!1,t["nav-index"]=!1,t["nav-left"]=!1,t["nav-right"]=!1,t["nav-up"]=!1,t["object-fit"]=!1,t["object-position"]=!1,t.opacity=!1,t.order=!1,t.orphans=!1,t.outline=!1,t["outline-color"]=!1,t["outline-offset"]=!1,t["outline-style"]=!1,t["outline-width"]=!1,t.overflow=!1,t["overflow-wrap"]=!1,t["overflow-x"]=!1,t["overflow-y"]=!1,t.padding=!0,t["padding-bottom"]=!0,t["padding-left"]=!0,t["padding-right"]=!0,t["padding-top"]=!0,t.page=!1,t["page-break-after"]=!1,t["page-break-before"]=!1,t["page-break-inside"]=!1,t["page-policy"]=!1,t.pause=!1,t["pause-after"]=!1,t["pause-before"]=!1,t.perspective=!1,t["perspective-origin"]=!1,t.pitch=!1,t["pitch-range"]=!1,t["play-during"]=!1,t.position=!1,t["presentation-level"]=!1,t.quotes=!1,t["region-fragment"]=!1,t.resize=!1,t.rest=!1,t["rest-after"]=!1,t["rest-before"]=!1,t.richness=!1,t.right=!1,t.rotation=!1,t["rotation-point"]=!1,t["ruby-align"]=!1,t["ruby-merge"]=!1,t["ruby-position"]=!1,t["shape-image-threshold"]=!1,t["shape-outside"]=!1,t["shape-margin"]=!1,t.size=!1,t.speak=!1,t["speak-as"]=!1,t["speak-header"]=!1,t["speak-numeral"]=!1,t["speak-punctuation"]=!1,t["speech-rate"]=!1,t.stress=!1,t["string-set"]=!1,t["tab-size"]=!1,t["table-layout"]=!1,t["text-align"]=!0,t["text-align-last"]=!0,t["text-combine-upright"]=!0,t["text-decoration"]=!0,t["text-decoration-color"]=!0,t["text-decoration-line"]=!0,t["text-decoration-skip"]=!0,t["text-decoration-style"]=!0,t["text-emphasis"]=!0,t["text-emphasis-color"]=!0,t["text-emphasis-position"]=!0,t["text-emphasis-style"]=!0,t["text-height"]=!0,t["text-indent"]=!0,t["text-justify"]=!0,t["text-orientation"]=!0,t["text-overflow"]=!0,t["text-shadow"]=!0,t["text-space-collapse"]=!0,t["text-transform"]=!0,t["text-underline-position"]=!0,t["text-wrap"]=!0,t.top=!1,t.transform=!1,t["transform-origin"]=!1,t["transform-style"]=!1,t.transition=!1,t["transition-delay"]=!1,t["transition-duration"]=!1,t["transition-property"]=!1,t["transition-timing-function"]=!1,t["unicode-bidi"]=!1,t["vertical-align"]=!1,t.visibility=!1,t["voice-balance"]=!1,t["voice-duration"]=!1,t["voice-family"]=!1,t["voice-pitch"]=!1,t["voice-range"]=!1,t["voice-rate"]=!1,t["voice-stress"]=!1,t["voice-volume"]=!1,t.volume=!1,t["white-space"]=!1,t.widows=!1,t.width=!0,t["will-change"]=!1,t["word-break"]=!0,t["word-spacing"]=!0,t["word-wrap"]=!0,t["wrap-flow"]=!1,t["wrap-through"]=!1,t["writing-mode"]=!1,t["z-index"]=!1,t}function AXe(t,e,i){}function MXe(t,e,i){}var OXe=/javascript\s*\:/img;function PXe(t,e){return OXe.test(e)?"":e}cE.whiteList=AEe();cE.getDefaultWhiteList=AEe;cE.onAttr=AXe;cE.onIgnoreAttr=MXe;cE.safeAttrValue=PXe;var RXe={indexOf:function(t,e){var i,r;if(Array.prototype.indexOf)return t.indexOf(e);for(i=0,r=t.length;i/g,qXe=/"/g,WXe=/"/g,YXe=/&#([a-zA-Z0-9]*);?/gim,XXe=/:?/gim,ZXe=/&newline;?/gim,D6=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,fde=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,mde=/u\s*r\s*l\s*\(.*/gi;function IEe(t){return t.replace(qXe,""")}function $Ee(t){return t.replace(WXe,'"')}function LEe(t){return t.replace(YXe,function(i,r){return r[0]==="x"||r[0]==="X"?String.fromCharCode(parseInt(r.substr(1),16)):String.fromCharCode(parseInt(r,10))})}function DEe(t){return t.replace(XXe,":").replace(ZXe," ")}function NEe(t){for(var e="",i=0,r=t.length;i",r);if(n===-1)break;i=n+3}return e}function eZe(t){var e=t.split("");return e=e.filter(function(i){var r=i.charCodeAt(0);return r===127?!1:r<=31?r===10||r===13:!0}),e.join("")}ea.whiteList=OEe();ea.getDefaultWhiteList=OEe;ea.onTag=zXe;ea.onIgnoreTag=UXe;ea.onTagAttr=VXe;ea.onIgnoreTagAttr=BXe;ea.safeAttrValue=jXe;ea.escapeHtml=REe;ea.escapeQuote=IEe;ea.unescapeQuote=$Ee;ea.escapeHtmlEntities=LEe;ea.escapeDangerHtml5Entities=DEe;ea.clearNonPrintableCharacter=NEe;ea.friendlyAttrValue=FEe;ea.escapeAttrValue=kEe;ea.onIgnoreTagStripAll=JXe;ea.StripTagBody=KXe;ea.stripCommentTag=QXe;ea.stripBlankChar=eZe;ea.cssFilter=PEe;ea.getDefaultCSSWhiteList=kXe;var sB={},Iw=Dne;function tZe(t){var e=Iw.spaceIndex(t),i;return e===-1?i=t.slice(1,-1):i=t.slice(1,e+1),i=Iw.trim(i).toLowerCase(),i.slice(0,1)==="/"&&(i=i.slice(1)),i.slice(-1)==="/"&&(i=i.slice(0,-1)),i}function iZe(t){return t.slice(0,2)===""){r+=i(t.slice(n,s)),_=t.slice(s,l+1),f=tZe(_),r+=e(s,r.length,f,_,iZe(_)),n=l+1,s=!1;continue}if(x==='"'||x==="'")for(var T=1,A=t.charAt(l-T);A.trim()===""||A==="=";){if(A==="="){o=x;continue e}A=t.charAt(l-++T)}}else if(x===o){o=!1;continue}}return n0;e--){var i=t[e];if(i!==" ")return i==="="?e:-1}}function cZe(t){return t[0]==='"'&&t[t.length-1]==='"'||t[0]==="'"&&t[t.length-1]==="'"}function gde(t){return cZe(t)?t.substr(1,t.length-2):t}sB.parseTag=rZe;sB.parseAttr=sZe;var uZe=nL.exports.FilterCSS,em=ea,zEe=sB,hZe=zEe.parseTag,dZe=zEe.parseAttr,_7=Dne;function N6(t){return t==null}function pZe(t){var e=_7.spaceIndex(t);if(e===-1)return{html:"",closing:t[t.length-2]==="/"};t=_7.trim(t.slice(e+1,-1));var i=t[t.length-1]==="/";return i&&(t=_7.trim(t.slice(0,-1))),{html:t,closing:i}}function fZe(t){var e={};for(var i in t)e[i]=t[i];return e}function mZe(t){var e={};for(var i in t)Array.isArray(t[i])?e[i.toLowerCase()]=t[i].map(function(r){return r.toLowerCase()}):e[i.toLowerCase()]=t[i];return e}function UEe(t){t=fZe(t||{}),t.stripIgnoreTag&&(t.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),t.onIgnoreTag=em.onIgnoreTagStripAll),t.whiteList||t.allowList?t.whiteList=mZe(t.whiteList||t.allowList):t.whiteList=em.whiteList,t.onTag=t.onTag||em.onTag,t.onTagAttr=t.onTagAttr||em.onTagAttr,t.onIgnoreTag=t.onIgnoreTag||em.onIgnoreTag,t.onIgnoreTagAttr=t.onIgnoreTagAttr||em.onIgnoreTagAttr,t.safeAttrValue=t.safeAttrValue||em.safeAttrValue,t.escapeHtml=t.escapeHtml||em.escapeHtml,this.options=t,t.css===!1?this.cssFilter=!1:(t.css=t.css||{},this.cssFilter=new uZe(t.css))}UEe.prototype.process=function(t){if(t=t||"",t=t.toString(),!t)return"";var e=this,i=e.options,r=i.whiteList,n=i.onTag,s=i.onIgnoreTag,o=i.onTagAttr,l=i.onIgnoreTagAttr,c=i.safeAttrValue,f=i.escapeHtml,_=e.cssFilter;i.stripBlankChar&&(t=em.stripBlankChar(t)),i.allowCommentTag||(t=em.stripCommentTag(t));var x=!1;i.stripIgnoreTagBody&&(x=em.StripTagBody(i.stripIgnoreTagBody,s),s=x.onIgnoreTag);var T=hZe(t,function(A,M,I,L,F){var z={sourcePosition:A,position:M,isClosing:F,isWhite:Object.prototype.hasOwnProperty.call(r,I)},k=n(I,L,z);if(!N6(k))return k;if(z.isWhite){if(z.isClosing)return"";var U=pZe(L),j=r[I],H=dZe(U.html,function(Y,Q){var ne=_7.indexOf(j,Y)!==-1,re=o(I,Y,Q,ne);return N6(re)?ne?(Q=c(I,Y,Q,_),Q?Y+'="'+Q+'"':Y):(re=l(I,Y,Q,ne),N6(re)?void 0:re):re});return L="<"+I,H&&(L+=" "+H),U.closing&&(L+=" /"),L+=">",L}else return k=s(I,L,z),N6(k)?f(L):k},f);return x&&(T=x.remove(T)),T};var gZe=UEe;(function(t,e){var i=ea,r=sB,n=gZe;function s(l,c){var f=new n(c);return f.process(l)}e=t.exports=s,e.filterXSS=s,e.FilterXSS=n,function(){for(var l in i)e[l]=i[l];for(var c in r)e[c]=r[c]}();function o(){return typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope}o()&&(self.filterXSS=t.exports)})(xS,xS.exports);var yZe=function(){function t(e,i){var r=this;this.arcgisWhiteList={a:["href","style","target"],abbr:["title"],audio:["autoplay","controls","loop","muted","preload"],b:[],br:[],dd:["style"],div:["align","style"],dl:["style"],dt:["style"],em:[],figcaption:["style"],figure:["style"],font:["color","face","size","style"],h1:["style"],h2:["style"],h3:["style"],h4:["style"],h5:["style"],h6:["style"],hr:[],i:[],img:["alt","border","height","src","style","width"],li:[],ol:[],p:["style"],source:["media","src","type"],span:["style"],strong:[],sub:["style"],sup:["style"],table:["border","cellpadding","cellspacing","height","style","width"],tbody:[],tr:["align","height","style","valign"],td:["align","colspan","height","nowrap","rowspan","style","valign","width"],th:["align","colspan","height","nowrap","rowspan","style","valign","width"],u:[],ul:[],video:["autoplay","controls","height","loop","muted","poster","preload","width"]},this.allowedProtocols=["http","https","mailto","iform","tel","flow","lfmobile","arcgis-navigator","arcgis-appstudio-player","arcgis-survey123","arcgis-collector","arcgis-workforce","arcgis-explorer","arcgis-trek2there","arcgis-quickcapture","mspbi","comgooglemaps","pdfefile","pdfehttp","pdfehttps","boxapp","boxemm","awb","awbs","gropen","radarscope"],this.arcgisFilterOptions={allowCommentTag:!0,safeAttrValue:function(s,o,l,c){return s==="a"&&o==="href"||(s==="img"||s==="source")&&o==="src"?r.sanitizeUrl(l):xS.exports.safeAttrValue(s,o,l,c)}},this._entityMap={"&":"8","<":"<",">":">",'"':""","'":"'","/":"/"};var n;e&&!i?n=e:e&&i?(n=Object.create(this.arcgisFilterOptions),Object.keys(e).forEach(function(s){s==="whiteList"?n.whiteList=r._extendObjectOfArrays([r.arcgisWhiteList,e.whiteList||{}]):n[s]=e[s]})):(n=Object.create(this.arcgisFilterOptions),n.whiteList=this.arcgisWhiteList),this.xssFilterOptions=n,this._xssFilter=new xS.exports.FilterXSS(n)}return t.prototype.sanitize=function(e,i){switch(i===void 0&&(i={}),typeof e){case"number":return isNaN(e)||!isFinite(e)?null:e;case"boolean":return e;case"string":return this._xssFilter.process(e);case"object":return this._iterateOverObject(e,i);default:return i.allowUndefined&&typeof e>"u"?void 0:null}},t.prototype.sanitizeUrl=function(e,i){var r=(i??{}).isProtocolRequired,n=r===void 0?!0:r,s=this._trim(e.substring(0,e.indexOf(":"))),o=e==="/",l=/^#/.test(e),c=s&&this.allowedProtocols.indexOf(s.toLowerCase())>-1;return o||l||c?xS.exports.escapeAttrValue(e):!s&&!n?xS.exports.escapeAttrValue("https://".concat(e)):""},t.prototype.sanitizeHTMLAttribute=function(e,i,r,n){return typeof this.xssFilterOptions.safeAttrValue=="function"?this.xssFilterOptions.safeAttrValue(e,i,r,n):xS.exports.safeAttrValue(e,i,r,n)},t.prototype.validate=function(e,i){i===void 0&&(i={});var r=this.sanitize(e,i);return{isValid:e===r,sanitized:r}},t.prototype.encodeHTML=function(e){var i=this;return String(e).replace(/[&<>"'\/]/g,function(r){return i._entityMap[r]})},t.prototype.encodeAttrValue=function(e){var i=/^[a-zA-Z0-9]$/;return String(e).replace(/[\x00-\xFF]/g,function(r,n){return i.test(r)?r:"&#x".concat(Number(e.charCodeAt(n)).toString(16),";")})},t.prototype._extendObjectOfArrays=function(e){var i={};return e.forEach(function(r){Object.keys(r).forEach(function(n){Array.isArray(r[n])&&Array.isArray(i[n])?i[n]=i[n].concat(r[n]):i[n]=r[n]})}),i},t.prototype._iterateOverObject=function(e,i){var r=this;i===void 0&&(i={});try{var n=!1,s=void 0;if(Array.isArray(e))s=e.reduce(function(l,c){var f=r.validate(c,i);return f.isValid?l.concat([c]):(n=!0,l.concat([f.sanitized]))},[]);else if(CXe(e)){var o=Object.keys(e);s=o.reduce(function(l,c){var f=e[c],_=r.validate(f,i);return _.isValid?l[c]=f:(n=!0,l[c]=_.sanitized),l},{})}else return i.allowUndefined&&typeof e>"u"?void 0:null;return n?s:e}catch{return null}},t.prototype._trim=function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},t}();const oB=new Map;function VEe(){oB.clear()}function vZe(t){return oB.get(t)}function _Ze(t,e){oB.set(t,e)}function hH(t){oB.delete(t)}const bZe=Ce.getLogger("esri.widgets.support.widgetUtils");function GS(t){const e=Uh.acquire();for(let r=0;r{const t=new Map,e=new ResizeObserver(r=>{var n;VEe();for(const s of r)(n=t.get(s.target))==null||n(s)}),i=(r,n,s)=>(t.has(r)&&bZe.error("Already observing element",r),t.set(r,n),e.observe(r,s),rr(()=>{e.unobserve(r),t.delete(r)}));return(r,n,s)=>{let o=null;return id([_e(()=>typeof r=="function"?r():r,l=>{o==null||o.remove(),l&&(o=i(l,n,s))},kt),rr(()=>o==null?void 0:o.remove())])}})();function RT(t){const e=t==null?void 0:t.closest("[dir]");return e!==null&&e instanceof HTMLElement&&e.dir==="rtl"||document.dir==="rtl"}function wZe(t){return RT(t)?"rtl":"ltr"}function iXt(t){const e="data-node-ref";this[t.getAttribute(e)]=null}function Vv(t){const e="data-node-ref";this[t.getAttribute(e)]=t}const xZe=["dd","dl","dt","h1","h2","h3","h4","h5","h6","sub","sup","animate","animatetransform","circle","clippath","defs","ellipse","g","image","line","lineargradient","marker","mask","path","pattern","polygon","polyline","radialgradient","rect","stop","svg","switch","symbol","text","textpath","tspan","use"],SZe=xZe.reduce((t,e)=>(t[e]=[],t),{}),TZe=["align","alink","alt","bgcolor","border","cellpadding","cellspacing","class","color","cols","colspan","coords","d","dir","face","height","hspace","ismap","lang","marginheight","marginwidth","multiple","nohref","noresize","noshade","nowrap","ref","rel","rev","rows","rowspan","scrolling","shape","span","summary","tabindex","title","usemap","valign","value","vlink","vspace","width"],BEe=new yZe({whiteList:SZe,onTagAttr:(t,e,i)=>{const r=`${e}="${i}"`;if(TZe.includes(e))return r},stripIgnoreTag:!0,stripIgnoreTagBody:["script","style"]},!0);function EZe(t,e){const i=t.getBoundingClientRect(),r=e.getBoundingClientRect(),n=i.top+i.height,s=r.top+r.height,o=i.top,l=r.top;(n>s||o{let i={};return Object.keys(t).forEach(r=>{i[r]=t[r]}),e&&Object.keys(e).forEach(r=>{i[r]=e[r]}),i},Fne=(t,e)=>t.vnodeSelector===e.vnodeSelector&&(t.properties&&e.properties?t.properties.key===e.properties.key&&t.properties.bind===e.properties.bind:!t.properties&&!e.properties),HEe=t=>{if(typeof t!="string")throw new Error("Style values must be strings")},CZe=(t,e,i)=>{if(e.vnodeSelector!==""){for(let r=i;r{let n=t[e];if(n.vnodeSelector==="")return;let s=n.properties;if(!(s&&(s.key===void 0?s.bind:s.key))){for(let o=0;o{if(t.properties){let e=t.properties.enterAnimation;e&&e(t.domNode,t.properties)}},SZ=[],TZ=!1,qEe=t=>{(t.children||[]).forEach(qEe),t.properties&&t.properties.afterRemoved&&t.properties.afterRemoved.apply(t.properties.bind||t.properties,[t.domNode])},vde=()=>{TZ=!1,SZ.forEach(qEe),SZ.length=0},_de=t=>{SZ.push(t),TZ||(TZ=!0,typeof window<"u"&&"requestIdleCallback"in window?window.requestIdleCallback(vde,{timeout:16}):setTimeout(vde,16))},bde=t=>{let e=t.domNode;if(t.properties){let i=t.properties.exitAnimation;if(i)return e.style.pointerEvents="none",void i(e,()=>{e.parentNode&&(e.parentNode.removeChild(e),_de(t))},t.properties)}e.parentNode&&(e.parentNode.removeChild(e),_de(t))},MZe=(t,e,i)=>{if(!e)return;let r=i.eventHandlerInterceptor,n=Object.keys(e),s=n.length;for(let o=0;o{if(e)for(let r of e)wM(r,t,void 0,i)},WEe=(t,e,i)=>{OZe(t,e.children,i),e.text&&(t.textContent=e.text),MZe(t,e.properties,i),e.properties&&e.properties.afterCreate&&e.properties.afterCreate.apply(e.properties.bind||e.properties,[t,i,e.vnodeSelector,e.properties,e.children])},wM=(t,e,i,r)=>{let n,s=0,o=t.vnodeSelector,l=e.ownerDocument;if(o==="")n=t.domNode=l.createTextNode(t.text),i!==void 0?e.insertBefore(n,i):e.appendChild(n);else{for(let c=0;c<=o.length;++c){let f=o.charAt(c);if(c===o.length||f==="."||f==="#"){let _=o.charAt(s-1),x=o.slice(s,c);_==="."?n.classList.add(x):_==="#"?n.id=x:(x==="svg"&&(r=Nne(r,{namespace:lB})),r.namespace!==void 0?n=t.domNode=l.createElementNS(r.namespace,x):(n=t.domNode=t.domNode||l.createElement(x),x==="input"&&t.properties&&t.properties.type!==void 0&&n.setAttribute("type",t.properties.type)),i!==void 0?e.insertBefore(n,i):n.parentNode!==e&&e.appendChild(n)),s=c+1}}WEe(n,t,r)}},CZ=(t,e,i)=>{e&&e.split(" ").forEach(r=>{r&&t.classList.toggle(r,i)})},PZe=(t,e,i,r)=>{if(!i)return;let n=!1,s=Object.keys(i),o=s.length;for(let l=0;l{if(i===r)return!1;r=r||yde;let s,o=(i=i||yde).length,l=r.length,c=0,f=0,_=!1;for(;f=0){for(s=c;sc)for(s=c;s{let r=t.domNode,n=!1;if(t===e)return!1;let s=!1;if(e.vnodeSelector===""){if(e.text!==t.text){let o=r.ownerDocument.createTextNode(e.text);return r.parentNode.replaceChild(o,r),e.domNode=o,n=!0,n}e.domNode=r}else e.vnodeSelector.lastIndexOf("svg",0)===0&&(i=Nne(i,{namespace:lB})),t.text!==e.text&&(s=!0,e.text===void 0?r.removeChild(r.firstChild):r.textContent=e.text),e.domNode=r,s=RZe(e,r,t.children,e.children,i)||s,s=PZe(r,t.properties,e.properties,i)||s,e.properties&&e.properties.afterUpdate&&e.properties.afterUpdate.apply(e.properties.bind||e.properties,[r,i,e.vnodeSelector,e.properties,e.children]);return s&&e.properties&&e.properties.updateAnimation&&e.properties.updateAnimation(r,e.properties,t.properties),n};let BP=(t,e)=>({getLastRender:()=>t,update:i=>{if(t.vnodeSelector!==i.vnodeSelector)throw new Error("The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)");let r=t;t=i,dz(r,i,e)},domNode:t.domNode});const IZe={namespace:void 0,performanceLogger:()=>{},eventHandlerInterceptor:void 0,styleApplyer:(t,e,i)=>{e.charAt(0)==="-"?t.style.setProperty(e,i):t.style[e]=i}};let aA=t=>Nne(IZe,t),Jw={create:(t,e)=>(e=aA(e),wM(t,document.createElement("div"),void 0,e),BP(t,e)),append:(t,e,i)=>(i=aA(i),wM(e,t,void 0,i),BP(e,i)),insertBefore:(t,e,i)=>(i=aA(i),wM(e,t.parentNode,t,i),BP(e,i)),merge:(t,e,i)=>(i=aA(i),e.domNode=t,WEe(t,e,i),BP(e,i)),replace:(t,e,i)=>(i=aA(i),wM(e,t.parentNode,t,i),t.parentNode.removeChild(t),BP(e,i))},YEe,$Ze=(t,e)=>{let i=[];for(;t&&t!==e;)i.push(t),t=t.parentNode;return i};YEe=Array.prototype.find?(t,e)=>t.find(e):(t,e)=>t.filter(e)[0];let LZe=(t,e)=>{let i=t;return e.forEach(r=>{i=i&&i.children?YEe(i.children,n=>n.domNode===r):void 0}),i},DZe=(t,e,i)=>{let r=function(n){i("domEvent",n);let s=e(),o=$Ze(n.currentTarget,s.domNode);o.reverse();let l,c=LZe(s.getLastRender(),o);return t.scheduleRender(),c&&(l=c.properties[`on${n.type}`].apply(c.properties.bind||this,arguments)),i("domEventProcessed",n),l};return(n,s,o,l)=>r},pz=t=>{let e,i,r=aA(t),n=r.performanceLogger,s=!0,o=!1,l=[],c=[],f=(x,T,A)=>{let M,I=()=>M;r.eventHandlerInterceptor=DZe(e,I,n),M=x(T,A(),r),l.push(M),c.push(A)},_=()=>{if(i=void 0,s){s=!1,n("renderStart",void 0);for(let x=0;x{i||o||(i=requestAnimationFrame(_))},stop:()=>{i&&(cancelAnimationFrame(i),i=void 0),o=!0},resume:()=>{o=!1,s=!0,e.scheduleRender()},append:(x,T)=>{f(Jw.append,x,T)},insertBefore:(x,T)=>{f(Jw.insertBefore,x,T)},merge:(x,T)=>{f(Jw.merge,x,T)},replace:(x,T)=>{f(Jw.replace,x,T)},detach:x=>{for(let T=0;T(t.scheduleRender(),e.properties[`on${r.type}`].apply(e.properties.bind||i,[r]))},FZe={namespace:void 0,performanceLogger:()=>{},eventHandlerInterceptor:void 0,styleApplyer:(t,e,i)=>{e.charAt(0)==="-"?t.style.setProperty(e,i):t.style[e]=i}},kZe=t=>({...FZe,...t}),zZe=(t,e)=>{const i=[];for(;t&&t!==e;)i.push(t),t=t.parentNode;return i},UZe=(t,e)=>t.find(e),wde=(t,e,i=!1)=>{let r=t;return e.forEach((n,s)=>{const o=r!=null&&r.children?UZe(r.children,l=>l.domNode===n):void 0;i&&!o&&s!==e.length-1||(r=o)}),r},VZe=t=>{let e;const i={...NZe,...t},r=kZe(i),n=r.performanceLogger;let s,o=!0,l=!1;const c=[],f=[],_=(T,A,M)=>{var F;let I;r.eventHandlerInterceptor=(z,k,U,j)=>function(H){let Y;n("domEvent",H);const Q=zZe(H.currentTarget,I.domNode),ne=Q.some(he=>{var ce;return customElements.get((ce=he==null?void 0:he.tagName)==null?void 0:ce.toLowerCase())});if(H.eventPhase===Event.CAPTURING_PHASE||!ne)Q.reverse(),Y=wde(I.getLastRender(),Q);else{const he=H.composedPath(),ce=he.slice(he.indexOf(H.currentTarget),he.indexOf(I.domNode)).reverse();Y=wde(I.getLastRender(),ce,!0)}let re;return Y&&(re=i.handleInterceptedEvent(e,Y,this,H)),n("domEventProcessed",H),re},(F=i.postProcessProjectionOptions)==null||F.call(i,r);const L=M();I=T(A,L,r),r.eventHandlerInterceptor=void 0,c.push(I),f.push(M),i.afterFirstVNodeRendered&&i.afterFirstVNodeRendered(I,L)};let x=()=>{if(s=void 0,o){o=!1,n("renderStart",void 0);for(let T=0;T{s||l||(s=requestAnimationFrame(x))},stop:()=>{s&&(cancelAnimationFrame(s),s=void 0),l=!0},resume:()=>{l=!1,o=!0,e.scheduleRender()},append:(T,A)=>{_(Jw.append,T,A)},insertBefore:(T,A)=>{_(Jw.insertBefore,T,A)},merge:(T,A)=>{_(Jw.merge,T,A)},replace:(T,A)=>{_(Jw.replace,T,A)},detach:T=>{for(let A=0;A{const e=new URL(t,Kl.$resourcesUrl$);return e.origin!==C9.location.origin?e.href:e.pathname},jZe=t=>Kl.$resourcesUrl$=t,IT=(t,e="")=>()=>{},Sde="http://www.w3.org/1999/xlink",Tde={},GZe="http://www.w3.org/2000/svg",HZe="http://www.w3.org/1999/xhtml",qZe=t=>t!=null,zne=t=>(t=typeof t,t==="object"||t==="function");function WZe(t){var e,i,r;return(r=(i=(e=t.head)===null||e===void 0?void 0:e.querySelector('meta[name="csp-nonce"]'))===null||i===void 0?void 0:i.getAttribute("content"))!==null&&r!==void 0?r:void 0}const JEe=(t,e,...i)=>{let r=null,n=null,s=null,o=!1,l=!1;const c=[],f=x=>{for(let T=0;Tx[T]).join(" "))}}if(typeof t=="function")return t(e===null?{}:e,c,ZZe);const _=mz(t,null);return _.$attrs$=e,c.length>0&&(_.$children$=c),_.$key$=n,_.$name$=s,_},mz=(t,e)=>{const i={$flags$:0,$tag$:t,$text$:e,$elm$:null,$children$:null};return i.$attrs$=null,i.$key$=null,i.$name$=null,i},YZe={},XZe=t=>t&&t.$tag$===YZe,ZZe={forEach:(t,e)=>t.map(Ede).forEach(e),map:(t,e)=>t.map(Ede).map(e).map(JZe)},Ede=t=>({vattrs:t.$attrs$,vchildren:t.$children$,vkey:t.$key$,vname:t.$name$,vtag:t.$tag$,vtext:t.$text$}),JZe=t=>{if(typeof t.vtag=="function"){const i=Object.assign({},t.vattrs);return t.vkey&&(i.key=t.vkey),t.vname&&(i.name=t.vname),JEe(t.vtag,i,...t.vchildren||[])}const e=mz(t.vtag,t.vtext);return e.$attrs$=t.vattrs,e.$children$=t.vchildren,e.$key$=t.vkey,e.$name$=t.vname,e},KZe=t=>EJe.map(e=>e(t)).find(e=>!!e),QZe=(t,e)=>t!=null&&!zne(t)?e&4?t==="false"?!1:t===""||!!t:e&2?parseFloat(t):e&1?String(t):t:t,eJe=t=>t,rXt=(t,e,i)=>{const r=eJe(t);return{emit:n=>tJe(r,e,{bubbles:!!(i&4),composed:!!(i&2),cancelable:!!(i&1),detail:n})}},tJe=(t,e,i)=>{const r=Kl.ce(e,i);return t.dispatchEvent(r),r},Cde=new WeakMap,iJe=(t,e,i)=>{let r=yz.get(t);MJe&&i?(r=r||new CSSStyleSheet,typeof r=="string"?r=e:r.replaceSync(e)):r=e,yz.set(t,r)},rJe=(t,e,i,r)=>{var n;let s=KEe(e,i);const o=yz.get(s);if(t=t.nodeType===11?t:Em,o)if(typeof o=="string"){t=t.head||t;let l=Cde.get(t),c;if(l||Cde.set(t,l=new Set),!l.has(s)){{c=Em.createElement("style"),c.innerHTML=o;const f=(n=Kl.$nonce$)!==null&&n!==void 0?n:WZe(Em);f!=null&&c.setAttribute("nonce",f),t.insertBefore(c,t.querySelector("link"))}l&&l.add(s)}}else t.adoptedStyleSheets.includes(o)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,o]);return s},nJe=t=>{const e=t.$cmpMeta$,i=t.$hostElement$,r=e.$flags$,n=IT("attachStyles",e.$tagName$),s=rJe(i.shadowRoot?i.shadowRoot:i.getRootNode(),e,t.$modeName$);r&10&&(i["s-sc"]=s,i.classList.add(s+"-h"),r&2&&i.classList.add(s+"-s")),n()},KEe=(t,e)=>"sc-"+(e&&t.$flags$&32?t.$tagName$+"-"+e:t.$tagName$),Ade=(t,e,i,r,n,s)=>{if(i!==r){let o=Rde(t,e),l=e.toLowerCase();if(e==="class"){const c=t.classList,f=Mde(i),_=Mde(r);c.remove(...f.filter(x=>x&&!_.includes(x))),c.add(..._.filter(x=>x&&!f.includes(x)))}else if(e==="style"){for(const c in i)(!r||r[c]==null)&&(c.includes("-")?t.style.removeProperty(c):t.style[c]="");for(const c in r)(!i||r[c]!==i[c])&&(c.includes("-")?t.style.setProperty(c,r[c]):t.style[c]=r[c])}else if(e!=="key")if(e==="ref")r&&r(t);else if(!t.__lookupSetter__(e)&&e[0]==="o"&&e[1]==="n")e[2]==="-"?e=e.slice(3):Rde(C9,l)?e=l.slice(2):e=l[2]+e.slice(3),i&&Kl.rel(t,e,i,!1),r&&Kl.ael(t,e,r,!1);else{const c=zne(r);if((o||c&&r!==null)&&!n)try{if(t.tagName.includes("-"))t[e]=r;else{const _=r??"";e==="list"?o=!1:(i==null||t[e]!=_)&&(t[e]=_)}}catch{}let f=!1;l!==(l=l.replace(/^xlink\:?/,""))&&(e=l,f=!0),r==null||r===!1?(r!==!1||t.getAttribute(e)==="")&&(f?t.removeAttributeNS(Sde,e):t.removeAttribute(e)):(!o||s&4||n)&&!c&&(r=r===!0?"":r,f?t.setAttributeNS(Sde,e,r):t.setAttribute(e,r))}}},sJe=/\s/,Mde=t=>t?t.split(sJe):[],QEe=(t,e,i,r)=>{const n=e.$elm$.nodeType===11&&e.$elm$.host?e.$elm$.host:e.$elm$,s=t&&t.$attrs$||Tde,o=e.$attrs$||Tde;for(r in s)r in o||Ade(n,r,s[r],void 0,i,e.$flags$);for(r in o)Ade(n,r,s[r],o[r],i,e.$flags$)},gz=(t,e,i,r)=>{const n=e.$children$[i];let s=0,o,l,c;if(ZEe||(kne=!0,n.$tag$==="slot"&&(cA&&r.classList.add(cA+"-s"),n.$flags$|=n.$children$?2:1)),n.$text$!==null)o=n.$elm$=Em.createTextNode(n.$text$);else if(n.$flags$&1)o=n.$elm$=Em.createTextNode("");else{if(Xd||(Xd=n.$tag$==="svg"),o=n.$elm$=Em.createElementNS(Xd?GZe:HZe,n.$flags$&2?"slot-fb":n.$tag$),Xd&&n.$tag$==="foreignObject"&&(Xd=!1),QEe(null,n,Xd),qZe(cA)&&o["s-si"]!==cA&&o.classList.add(o["s-si"]=cA),n.$children$)for(s=0;s{Kl.$flags$|=1;const i=t.childNodes;for(let r=i.length-1;r>=0;r--){const n=i[r];n["s-hn"]!==cB&&n["s-ol"]&&(iCe(n).insertBefore(n,Une(n)),n["s-ol"].remove(),n["s-ol"]=void 0,kne=!0),e&&sL(n,e)}Kl.$flags$&=-2},eCe=(t,e,i,r,n,s)=>{let o=t["s-cr"]&&t["s-cr"].parentNode||t,l;for(o.shadowRoot&&o.tagName===cB&&(o=o.shadowRoot);n<=s;++n)r[n]&&(l=gz(null,i,n,t),l&&(r[n].$elm$=l,o.insertBefore(l,Une(e))))},tCe=(t,e,i,r,n)=>{for(;e<=i;++e)(r=t[e])&&(n=r.$elm$,sCe(r),fz=!0,n["s-ol"]?n["s-ol"].remove():sL(n,!0),n.remove())},oJe=(t,e,i,r)=>{let n=0,s=0,o=0,l=0,c=e.length-1,f=e[0],_=e[c],x=r.length-1,T=r[0],A=r[x],M,I;for(;n<=c&&s<=x;)if(f==null)f=e[++n];else if(_==null)_=e[--c];else if(T==null)T=r[++s];else if(A==null)A=r[--x];else if(F6(f,T))uA(f,T),f=e[++n],T=r[++s];else if(F6(_,A))uA(_,A),_=e[--c],A=r[--x];else if(F6(f,A))(f.$tag$==="slot"||A.$tag$==="slot")&&sL(f.$elm$.parentNode,!1),uA(f,A),t.insertBefore(f.$elm$,_.$elm$.nextSibling),f=e[++n],A=r[--x];else if(F6(_,T))(f.$tag$==="slot"||A.$tag$==="slot")&&sL(_.$elm$.parentNode,!1),uA(_,T),t.insertBefore(_.$elm$,f.$elm$),_=e[--c],T=r[++s];else{for(o=-1,l=n;l<=c;++l)if(e[l]&&e[l].$key$!==null&&e[l].$key$===T.$key$){o=l;break}o>=0?(I=e[o],I.$tag$!==T.$tag$?M=gz(e&&e[s],i,o,t):(uA(I,T),e[o]=void 0,M=I.$elm$),T=r[++s]):(M=gz(e&&e[s],i,s,t),T=r[++s]),M&&iCe(f.$elm$).insertBefore(M,Une(f.$elm$))}n>c?eCe(t,r[x+1]==null?null:r[x+1].$elm$,i,r,s,x):s>x&&tCe(e,n,c)},F6=(t,e)=>t.$tag$===e.$tag$?t.$tag$==="slot"?t.$name$===e.$name$:t.$key$===e.$key$:!1,Une=t=>t&&t["s-ol"]||t,iCe=t=>(t["s-ol"]?t["s-ol"]:t).parentNode,uA=(t,e)=>{const i=e.$elm$=t.$elm$,r=t.$children$,n=e.$children$,s=e.$tag$,o=e.$text$;let l;o===null?(Xd=s==="svg"?!0:s==="foreignObject"?!1:Xd,s==="slot"||QEe(t,e,Xd),r!==null&&n!==null?oJe(i,r,e,n):n!==null?(t.$text$!==null&&(i.textContent=""),eCe(i,null,e,n,0,n.length-1)):r!==null&&tCe(r,0,r.length-1),Xd&&s==="svg"&&(Xd=!1)):(l=i["s-cr"])?l.parentNode.textContent=o:t.$text$!==o&&(i.data=o)},rCe=t=>{const e=t.childNodes;let i,r,n,s,o,l;for(r=0,n=e.length;r{let e,i,r,n,s,o,l=0;const c=t.childNodes,f=c.length;for(;l=0;o--)i=r[o],!i["s-cn"]&&!i["s-nr"]&&i["s-hn"]!==e["s-hn"]&&(Ode(i,n)?(s=lm.find(_=>_.$nodeToRelocate$===i),fz=!0,i["s-sn"]=i["s-sn"]||n,s?s.$slotRefNode$=e:lm.push({$slotRefNode$:e,$nodeToRelocate$:i}),i["s-sr"]&&lm.map(_=>{Ode(_.$nodeToRelocate$,i["s-sn"])&&(s=lm.find(x=>x.$nodeToRelocate$===i),s&&!_.$slotRefNode$&&(_.$slotRefNode$=s.$slotRefNode$))})):lm.some(_=>_.$nodeToRelocate$===i)||lm.push({$nodeToRelocate$:i}));e.nodeType===1&&nCe(e)}},Ode=(t,e)=>t.nodeType===1?t.getAttribute("slot")===null&&e===""||t.getAttribute("slot")===e:t["s-sn"]===e?!0:e==="",sCe=t=>{t.$attrs$&&t.$attrs$.ref&&t.$attrs$.ref(null),t.$children$&&t.$children$.map(sCe)},aJe=(t,e)=>{const i=t.$hostElement$,r=t.$cmpMeta$,n=t.$vnode$||mz(null,null),s=XZe(e)?e:JEe(null,null,e);cB=i.tagName,r.$attrsToReflect$&&(s.$attrs$=s.$attrs$||{},r.$attrsToReflect$.map(([o,l])=>s.$attrs$[l]=i[o])),s.$tag$=null,s.$flags$|=4,t.$vnode$=s,s.$elm$=n.$elm$=i.shadowRoot||i,cA=i["s-sc"],XEe=i["s-cr"],ZEe=(r.$flags$&1)!==0,fz=!1,uA(n,s);{if(Kl.$flags$|=1,kne){nCe(s.$elm$);let o,l,c,f,_,x,T=0;for(;T{},Vne=(t,e)=>(t.$flags$|=16,lJe(t,t.$ancestorComponent$),PJe(()=>cJe(t,e))),cJe=(t,e)=>{const i=t.$hostElement$,r=IT("scheduleUpdate",t.$cmpMeta$.$tagName$),n=i;let s;return e?s=iO(n,"componentWillLoad"):s=iO(n,"componentWillUpdate"),s=Pde(s,()=>iO(n,"componentWillRender")),r(),Pde(s,()=>uJe(t,n,e))},uJe=async(t,e,i)=>{const r=t.$hostElement$,n=IT("update",t.$cmpMeta$.$tagName$);r["s-rc"],i&&nJe(t);const s=IT("render",t.$cmpMeta$.$tagName$);hJe(t,e,r),s(),n(),dJe(t)},hJe=(t,e,i)=>{try{xde=e,e=e.render&&e.render(),t.$flags$&=-17,t.$flags$|=2,(lA.hasRenderFn||lA.reflect)&&(lA.vdomRender||lA.reflect)&&(lA.hydrateServerSide||aJe(t,e))}catch(l){E9(l,t.$hostElement$)}return xde=null,null},dJe=t=>{const e=t.$cmpMeta$.$tagName$,i=t.$hostElement$,r=IT("postUpdate",e),n=i;t.$ancestorComponent$,iO(n,"componentDidRender"),t.$flags$&64?(iO(n,"componentDidUpdate"),r()):(t.$flags$|=64,iO(n,"componentDidLoad"),r())},nXt=t=>{{const e=T9(t),i=e.$hostElement$.isConnected;return i&&(e.$flags$&18)===2&&Vne(e,!1),i}},iO=(t,e,i)=>{if(t&&t[e])try{return t[e](i)}catch(r){E9(r)}},Pde=(t,e)=>t&&t.then?t.then(e):e(),pJe=(t,e)=>T9(t).$instanceValues$.get(e),fJe=(t,e,i,r)=>{const n=T9(t),s=t,o=n.$instanceValues$.get(e),l=n.$flags$,c=s;i=QZe(i,r.$members$[e][0]);const f=Number.isNaN(o)&&Number.isNaN(i);if(i!==o&&!f){n.$instanceValues$.set(e,i);{if(r.$watchers$&&l&128){const x=r.$watchers$[e];x&&x.map(T=>{try{c[T](i,o,e)}catch(A){E9(A,s)}})}if((l&18)===2){if(c.componentShouldUpdate&&c.componentShouldUpdate(i,o,e)===!1)return;Vne(n,!1)}}}},mJe=(t,e,i)=>{if(e.$members$){t.watchers&&(e.$watchers$=t.watchers);const r=Object.entries(e.$members$),n=t.prototype;r.map(([s,[o]])=>{(o&31||o&32)&&Object.defineProperty(n,s,{get(){return pJe(this,s)},set(l){fJe(this,s,l,e)},configurable:!0,enumerable:!0})});{const s=new Map;n.attributeChangedCallback=function(o,l,c){Kl.jmp(()=>{const f=s.get(o);if(this.hasOwnProperty(f))c=this[f],delete this[f];else if(n.hasOwnProperty(f)&&typeof this[f]=="number"&&this[f]==c)return;this[f]=c===null&&typeof this[f]=="boolean"?!1:c})},t.observedAttributes=r.filter(([o,l])=>l[0]&15).map(([o,l])=>{const c=l[1]||o;return s.set(c,o),l[0]&512&&e.$attrsToReflect$.push([o,c]),c})}}return t},gJe=async(t,e,i,r,n)=>{if(!(e.$flags$&32)&&(n=t.constructor,e.$flags$|=32,customElements.whenDefined(i.$tagName$).then(()=>e.$flags$|=128),n.style)){let o=n.style;typeof o!="string"&&(o=o[e.$modeName$=KZe(t)]);const l=KEe(i,e.$modeName$);if(!yz.has(l)){const c=IT("registerStyles",i.$tagName$);iJe(l,o,!!(i.$flags$&1)),c()}}e.$ancestorComponent$,Vne(e,!0)},yJe=t=>{},vJe=t=>{if(!(Kl.$flags$&1)){const e=T9(t),i=e.$cmpMeta$,r=IT("connectedCallback",i.$tagName$);e.$flags$&1?(oCe(t,e,i.$listeners$),yJe(e.$lazyInstance$)):(e.$flags$|=1,i.$flags$&12&&_Je(t),i.$members$&&Object.entries(i.$members$).map(([n,[s]])=>{if(s&31&&t.hasOwnProperty(n)){const o=t[n];delete t[n],t[n]=o}}),gJe(t,e,i)),r()}},_Je=t=>{const e=t["s-cr"]=Em.createComment("");e["s-cn"]=!0,t.insertBefore(e,t.firstChild)},bJe=t=>{if(!(Kl.$flags$&1)){const e=T9(t);e.$rmListeners$&&(e.$rmListeners$.map(i=>i()),e.$rmListeners$=void 0)}},sXt=(t,e)=>{const i={$flags$:e[0],$tagName$:e[1]};i.$members$=e[2],i.$listeners$=e[3],i.$watchers$=t.$watchers$,i.$attrsToReflect$=[];const r=t.prototype.connectedCallback,n=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__registerHost(){TJe(this,i)},connectedCallback(){vJe(this),r&&r.call(this)},disconnectedCallback(){bJe(this),n&&n.call(this)},__attachShadow(){this.attachShadow({mode:"open",delegatesFocus:!!(i.$flags$&16)})}}),t.is=i.$tagName$,mJe(t,i)},oXt=(t,e)=>e,oCe=(t,e,i,r)=>{i&&i.map(([n,s,o])=>{const l=xJe(t,n),c=wJe(e,o),f=SJe(n);Kl.ael(l,s,c,f),(e.$rmListeners$=e.$rmListeners$||[]).push(()=>Kl.rel(l,s,c,f))})},wJe=(t,e)=>i=>{try{lA.lazyLoad||t.$hostElement$[e](i)}catch(r){E9(r)}},xJe=(t,e)=>e&4?Em:e&8?C9:e&16?Em.body:t,SJe=t=>CJe?{passive:(t&1)!==0,capture:(t&2)!==0}:(t&2)!==0,aCe=new WeakMap,T9=t=>aCe.get(t),TJe=(t,e)=>{const i={$flags$:0,$hostElement$:t,$cmpMeta$:e,$instanceValues$:new Map};return oCe(t,i,e.$listeners$),aCe.set(t,i)},Rde=(t,e)=>e in t,E9=(t,e)=>(0,console.error)(t,e),yz=new Map,EJe=[],C9=typeof window<"u"?window:{},Em=C9.document||{head:{}},aXt=C9.HTMLElement||class{},Kl={$flags$:0,$resourcesUrl$:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,i,r)=>t.addEventListener(e,i,r),rel:(t,e,i,r)=>t.removeEventListener(e,i,r),ce:(t,e)=>new CustomEvent(t,e)},CJe=(()=>{let t=!1;try{Em.addEventListener("e",null,Object.defineProperty({},"passive",{get(){t=!0}}))}catch{}return t})(),AJe=t=>Promise.resolve(t),MJe=(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})(),MZ=[],lCe=[],cCe=(t,e)=>i=>{t.push(i),AZ||(AZ=!0,e&&Kl.$flags$&4?OJe(OZ):Kl.raf(OZ))},Ide=t=>{for(let e=0;e{Ide(MZ),Ide(lCe),(AZ=MZ.length>0)&&Kl.raf(OZ)},OJe=t=>AJe().then(t),lXt=cCe(MZ,!1),PJe=cCe(lCe,!0);/*! - * All material copyright ESRI, All Rights Reserved, unless otherwise specified. - * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. - * v1.11.0 - */const uCe="calcite-mode-auto",hCe="calcite-mode-dark",RJe="calcite-mode-light",$de={autoMode:uCe,darkMode:hCe,lightMode:RJe,rtl:"calcite--rtl",calciteAnimate:"calcite-animate",calciteAnimateIn:"calcite-animate__in",calciteAnimateInUp:"calcite-animate__in-up",calciteAnimateInDown:"calcite-animate__in-down",calciteAnimateInRight:"calcite-animate__in-right",calciteAnimateInLeft:"calcite-animate__in-left",calciteAnimateInScale:"calcite-animate__in-scale"};/*! -* tabbable 6.2.0 -* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE -*/var dCe=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],vz=dCe.join(","),pCe=typeof Element>"u",$T=pCe?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,_z=!pCe&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t==null?void 0:t.ownerDocument},bz=function t(e,i){var r;i===void 0&&(i=!0);var n=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=n===""||n==="true",o=s||i&&e&&t(e.parentNode);return o},IJe=function(e){var i,r=e==null||(i=e.getAttribute)===null||i===void 0?void 0:i.call(e,"contenteditable");return r===""||r==="true"},fCe=function(e,i,r){if(bz(e))return[];var n=Array.prototype.slice.apply(e.querySelectorAll(vz));return i&&$T.call(e,vz)&&n.unshift(e),n=n.filter(r),n},mCe=function t(e,i,r){for(var n=[],s=Array.from(e);s.length;){var o=s.shift();if(!bz(o,!1))if(o.tagName==="SLOT"){var l=o.assignedElements(),c=l.length?l:o.children,f=t(c,!0,r);r.flatten?n.push.apply(n,f):n.push({scopeParent:o,candidates:f})}else{var _=$T.call(o,vz);_&&r.filter(o)&&(i||!e.includes(o))&&n.push(o);var x=o.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(o),T=!bz(x,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(x&&T){var A=t(x===!0?o.children:x.children,!0,r);r.flatten?n.push.apply(n,A):n.push({scopeParent:o,candidates:A})}else s.unshift.apply(s,o.children)}}return n},gCe=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},yCe=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||IJe(e))&&!gCe(e)?0:e.tabIndex},$Je=function(e,i){var r=yCe(e);return r<0&&i&&!gCe(e)?0:r},LJe=function(e,i){return e.tabIndex===i.tabIndex?e.documentOrder-i.documentOrder:e.tabIndex-i.tabIndex},vCe=function(e){return e.tagName==="INPUT"},DJe=function(e){return vCe(e)&&e.type==="hidden"},NJe=function(e){var i=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return i},FJe=function(e,i){for(var r=0;rsummary:first-of-type"),o=s?e.parentElement:e;if($T.call(o,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof n=="function"){for(var l=e;e;){var c=e.parentElement,f=_z(e);if(c&&!c.shadowRoot&&n(c)===!0)return Lde(e);e.assignedSlot?e=e.assignedSlot:!c&&f!==e.ownerDocument?e=f.host:e=c}e=l}if(VJe(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Lde(e);return!1},jJe=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var i=e.parentElement;i;){if(i.tagName==="FIELDSET"&&i.disabled){for(var r=0;r=0)},HJe=function t(e){var i=[],r=[];return e.forEach(function(n,s){var o=!!n.scopeParent,l=o?n.scopeParent:n,c=$Je(l,o),f=o?t(n.candidates):l;c===0?o?i.push.apply(i,f):i.push(l):r.push({documentOrder:s,tabIndex:c,item:n,isScope:o,content:f})}),r.sort(LJe).reduce(function(n,s){return s.isScope?n.push.apply(n,s.content):n.push(s.content),n},[]).concat(i)},qJe=function(e,i){i=i||{};var r;return i.getShadowRoot?r=mCe([e],i.includeContainer,{filter:PZ.bind(null,i),flatten:!1,getShadowRoot:i.getShadowRoot,shadowRootFilter:GJe}):r=fCe(e,i.includeContainer,PZ.bind(null,i)),HJe(r)},cXt=function(e,i){i=i||{};var r;return i.getShadowRoot?r=mCe([e],i.includeContainer,{filter:wz.bind(null,i),flatten:!0,getShadowRoot:i.getShadowRoot}):r=fCe(e,i.includeContainer,wz.bind(null,i)),r},uXt=function(e,i){if(i=i||{},!e)throw new Error("No node provided");return $T.call(e,vz)===!1?!1:PZ(i,e)},WJe=dCe.concat("iframe").join(","),hXt=function(e,i){if(i=i||{},!e)throw new Error("No node provided");return $T.call(e,WJe)===!1?!1:wz(i,e)};const YJe={getShadowRoot:!0};function dXt(t){return Array.isArray(t)?t:Array.from(t)}function pXt(t){const e=bCe(t,`.${$de.darkMode}, .${$de.lightMode}`);return e!=null&&e.classList.contains("calcite-mode-dark")?"dark":"light"}function fXt(t){const e="dir",i=`[${e}]`,r=bCe(t,i);return r?r.getAttribute(e):"ltr"}function Bne(t){return t.getRootNode()}function mXt(t){const e=Bne(t);return"host"in e?e:null}function _Ce(t){return t.host||null}function gXt(t,{selector:e,id:i}){function r(n){if(!n)return null;n.assignedSlot&&(n=n.assignedSlot);const s=Bne(n),o=i?"getElementById"in s?s.getElementById(i):null:e?s.querySelector(e):null,l=_Ce(s);return o||(l?r(l):null)}return r(t)}function bCe(t,e){function i(r){return r?r.closest(e)||i(_Ce(Bne(r))):null}return i(t)}function XJe(t,e){return wCe(t,e)}function wCe(t,e){if(!t)return;const i=e(t);if(i!==void 0)return i;const{parentNode:r}=t;return wCe(r instanceof ShadowRoot?r.host:r,e)}function yXt(t,e){return!!XJe(e,i=>i===t?!0:void 0)}function ZJe(t){return typeof(t==null?void 0:t.setFocus)=="function"}async function JJe(t){if(t)return ZJe(t)?t.setFocus():t.focus()}function vXt(t){t&&(qJe(t,YJe)[0]||t).focus()}const oL=":not([slot])";function _Xt(t,e,i){e&&!Array.isArray(e)&&typeof e!="string"&&(i=e,e=null);const r=e?Array.isArray(e)?e.map(n=>`[slot="${n}"]`).join(","):`[slot="${e}"]`:oL;return i!=null&&i.all?KJe(t,r,i):QJe(t,r,i)}function xCe(t,e){return t?Array.from(t.children||[]).filter(i=>i==null?void 0:i.matches(e)):[]}function KJe(t,e,i){let r=e===oL?xCe(t,oL):Array.from(t.querySelectorAll(e));r=i&&i.direct===!1?r:r.filter(s=>s.parentElement===t),r=i!=null&&i.matches?r.filter(s=>s==null?void 0:s.matches(i.matches)):r;const n=i==null?void 0:i.selector;return n?r.map(s=>Array.from(s.querySelectorAll(n))).reduce((s,o)=>[...s,...o],[]).filter(s=>!!s):r}function QJe(t,e,i){let r=e===oL?xCe(t,oL)[0]||null:t.querySelector(e);r=i&&i.direct===!1||(r==null?void 0:r.parentElement)===t?r:null,r=i!=null&&i.matches?r!=null&&r.matches(i.matches)?r:null:r;const n=i==null?void 0:i.selector;return n?r==null?void 0:r.querySelector(n):r}function bXt(t,e){return Array.from(t.children).filter(i=>i.matches(e))}function wXt(t,e,i){if(typeof e=="string"&&e!=="")return e;if(e==="")return t[i]}function xXt(t,e){return!(e.left>t.right||e.rightt.bottom||e.bottome.nodeType===Node.TEXT_NODE).map(e=>e.textContent).join("").trim()}function tKe(t){return!!eKe(t)}function iKe(t){return t.target.assignedNodes({flatten:!0})}function rKe(t){return!!nKe(t).length}function nKe(t){return t.target.assignedElements({flatten:!0})}function EXt(t){return!!(t.isPrimary&&t.button===0)}const CXt=(t,e,i,r=!0)=>{const n=t.indexOf(e),s=n===0,o=n===t.length-1;r&&(i=i==="previous"&&s?"last":i==="next"&&o?"first":i);let l;return i==="previous"?l=t[n-1]||t[r?t.length-1:n]:i==="next"?l=t[n+1]||t[r?0:n]:i==="last"?l=t[t.length-1]:l=t[0],JJe(l),l};function AXt(t,e){if(t.parentNode!==e.parentNode)return!1;const i=Array.from(t.parentNode.children);return i.indexOf(t)t.contains(hCe)||t.contains(uCe)&&e?"dark":"light",r=o=>document.body.dispatchEvent(new CustomEvent("calciteModeChange",{bubbles:!0,detail:{mode:o}})),n=o=>{s!==o&&r(o),s=o};let s=i();r(s),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",o=>n(o.matches?"dark":"light")),new MutationObserver(()=>n(i())).observe(document.body,{attributes:!0,attributeFilter:["class"]})}function sKe(){typeof window<"u"&&typeof location<"u"&&typeof document<"u"&&window.location===location&&window.document===document&&(document.readyState==="interactive"?Dde():document.addEventListener("DOMContentLoaded",()=>Dde(),{once:!0}))}const oKe=sKe;oKe();let SCe;function aKe(){try{BZe(".")}catch{jZe(Gh(Wr(SCe)))}}function Pl(t){var i;const e=[];for(const r of Object.keys(t))customElements.get(`calcite-${r}`)||e.push((i=t[r])==null?void 0:i.call(t));return e.length>0?Promise.all(e):null}SCe="components/assets";const TCe=Symbol("widget"),ECe=Symbol("widget-test-data"),lKe=[],cKe={},xz=new WeakMap;function CCe(t,e){let i=e.children;if(i!=null&&i.length)for(let n=0;nACe(t))),queueMicrotask(()=>{o[ECe].projector.renderNow()})}function hKe(t,e,i,{widgetProperties:r}){var s;const n=xz.get(t);n&&(n.set(r),(s=n.afterUpdate)==null||s.call(n,n,t))}function ACe(t){var i;const e=xz.get(t);e&&((i=e.afterRemoved)==null||i.call(e,e,t),e.destroy(),xz.delete(t))}function Sz(t){return typeof t=="function"&&t[TCe]}const si={arrowDown:"esri-icon-arrow-down",arrowUp:"esri-icon-arrow-up",basemap:"esri-icon-basemap",bookmark:"esri-icon-bookmark",calendar:"esri-icon-calendar",checkMark:"esri-icon-check-mark",checkboxUnchecked:"esri-icon-checkbox-unchecked",close:"esri-icon-close",collapse:"esri-icon-collapse",defaultAction:"esri-icon-default-action",description:"esri-icon-description",directions:"esri-icon-directions",dockBottom:"esri-icon-dock-bottom",dockLeft:"esri-icon-dock-left",dockRight:"esri-icon-dock-right",down:"esri-icon-down",downArrow:"esri-icon-down-arrow",download:"esri-icon-download",dragHorizontal:"esri-icon-drag-horizontal",dragVertical:"esri-icon-drag-vertical",duplicate:"esri-icon-duplicate",edit:"esri-icon-edit",elevationProfile:"esri-icon-elevation-profile",environmentSettings:"esri-icon-environment-settings",erase:"esri-icon-erase",error:"esri-icon-error",expand:"esri-icon-expand",fontFallbackText:"esri-icon-font-fallback-text",forward:"esri-icon-forward",gear:"esri-icon-gear",handleHorizontal:"esri-icon-handle-horizontal",handleVertical:"esri-icon-handle-vertical",home:"esri-icon-home",icon:"esri-icon",launchLinkExternal:"esri-icon-launch-link-external",layerList:"esri-icon-layer-list",layers:"esri-icon-layers",left:"esri-icon-left",leftArrows:"esri-icon-left-arrow",leftTriangleArrow:"esri-icon-left-triangle-arrow",lineOfSight:"esri-icon-line-of-sight",link:"esri-icon-link",linkExternal:"esri-icon-link-external",linkHorizontal:"esri-icon-link-horizontal",loadingIndicator:"esri-icon-loading-indicator",locate:"esri-icon-locate",locateCircled:"esri-icon-locate-circled",locked:"esri-icon-locked",mapPin:"esri-icon-map-pin",maximize:"esri-icon-maximize",measure:"esri-icon-measure",measureArea:"esri-icon-measure-area",measureBuildingHeightShadow:"esri-icon-measure-building-height-shadow",measureLine:"esri-icon-measure-line",menu:"esri-icon-menu",minimize:"esri-icon-minimize",minus:"esri-icon-minus",nonVisible:"esri-icon-non-visible",northNavigation:"esri-icon-north-navigation",noticeTriangle:"esri-icon-notice-triangle",organization:"esri-icon-organization",pan:"esri-icon-pan",pan2:"esri-icon-pan2",partlyCloudy:"esri-icon-partly-cloudy",pause:"esri-icon-pause",play:"esri-icon-play",playCircled:"esri-icon-play-circled",plus:"esri-icon-plus",polyline:"esri-icon-polyline",printer:"esri-icon-printer",radioChecked:"esri-icon-radio-checked",radioUnchecked:"esri-icon-radio-unchecked",refresh:"esri-icon-refresh",reverse:"esri-icon-reverse",right:"esri-icon-right",rightArrow:"esri-icon-right-arrow",rightTriangleArrow:"esri-icon-right-triangle-arrow",rotate:"esri-icon-rotate",save:"esri-icon-save",search:"esri-icon-search",settings2:"esri-icon-settings2",slice:"esri-icon-slice",swap:"esri-icon-swap",table:"esri-icon-table",timeClock:"esri-icon-time-clock",tracking:"esri-icon-tracking",trash:"esri-icon-trash",unlockedLinkHorizontal:"esri-icon-unlocked-link-horizontal",up:"esri-icon-up",upArrow:"esri-icon-up-arrow",upDownArrows:"esri-icon-up-down-arrows",urbanModel:"esri-icon-urban-model",vertexGps:"esri-icon-vertex-gps",visible:"esri-icon-visible",zoomInFixed:"esri-icon-zoom-in-fixed",zoomInMagnifyingGlass:"esri-icon-zoom-in-magnifying-glass",zoomOutFixed:"esri-icon-zoom-out-fixed",zoomToObject:"esri-icon-zoom-to-object"},Nde=new Set;function dKe(t){Nde.add(t),t.finally(()=>Nde.delete(t))}var MCe;const pKe="esri.widgets.Widget";let fKe=0;const mKe={widgetIcon:si.checkboxUnchecked};function OCe(t,e){for(const i in e)t[i]!=null&&(typeof t[i]=="object"&&typeof e[i]=="object"?OCe(t[i],e==null?void 0:e[i]):t[i]=e[i]);return t}const gKe=VZe({postProcessProjectionOptions(t){const e=t.eventHandlerInterceptor,i=/capture$/i;t.eventHandlerInterceptor=(r,n,s,o)=>{const l=e==null?void 0:e(r,n,s,o),c=i.test(r);if(!((r=r.replace(i,"")).toLowerCase()in s)||c){const f=r[2].toLowerCase()+r.slice(3),_=A=>l==null?void 0:l.call(s,A);s.addEventListener(f,_,c);const x=()=>s.removeEventListener(f,_,c),T=o.afterRemoved;o.afterRemoved=A=>{T==null||T(A),x()}}return l}},handleInterceptedEvent(t,e,i,r){const{eventPhase:n,type:s}=r,o=n===Event.CAPTURING_PHASE;let l=`on${s}${o?"capture":""}`;const c=e.properties;(c&&l in c||(l=`on${s[0].toUpperCase()}${s.slice(1)}${o?"Capture":""}`,c&&l in c))&&(VEe(),t.scheduleRender(),c[l].call(c.bind||i,r))}});let pH=!1,Ia=class extends S9(Dn.EventedAccessor){constructor(e,i){super(e,i),this._attached=!1,this._projector=gKe,this._readyForTrueRender=!1,this.iconClass=mKe.widgetIcon,this.icon=null,this.key=this,this._loadLocale=X5(async()=>{var l;if((l=this._messageBundleProps)!=null&&l.length){const c=await Promise.allSettled(this._messageBundleProps.map(async({bundlePath:f,propertyName:_})=>{if(this.destroyed)return;let x=await lE(f);this.uiStrings&&Object.keys(this.uiStrings)&&(x=OCe(Re(x),this.uiStrings)),this[_]=x}));if(this.destroyed)return;for(const f of c)f.status==="rejected"&&Ce.getLogger(this).error("widget-intl:locale-error",this.declaredClass,f.reason)}await this.loadLocale()}),aKe();const r="esri-widget-uid-"+Vf(),n=this.render.bind(this);this._trackingTarget=new YV(()=>this.scheduleRender());const s=()=>{var x;if(!this._readyForTrueRender||this.destroyed)return null;const l=n();let{properties:c}=l;c||(l.properties=c={});const{key:f}=c;if(f||(c.key=r),Sz(l.vnodeSelector)){if(!this.visible)return{vnodeSelector:"div",properties:{key:`${r}-hidden`,class:"",styles:{display:"none"}},domNode:null,children:void 0,text:void 0}}else this.visible?c.styles||(c.styles={}):(c.class="",c.styles={display:"none"}),c.styles.display||(c.styles.display="");let _=0;return(x=l.children)==null||x.forEach(T=>{if(Sz(T.vnodeSelector))return;let{properties:A}=T;A||(T.properties=A={}),A.key||(A.key=`${this.id}--${_++}`)}),CCe(this,l)};this.render=()=>{if(pH)return s();let l=vZe(this)??null;if(l)return l;this._trackingTarget.clear(),pH=!0;try{l=c_(this._trackingTarget,s)}catch(c){throw console.error(c),c}finally{pH=!1}return l&&_Ze(this,l),l};const o=this.beforeFirstRender();o?this._resourcesFetch=o.then(()=>{this._readyForTrueRender=!0,this._postInitialize()}):(this._resourcesFetch=Promise.resolve().then(()=>{this._postInitialize()}),this._readyForTrueRender=!0),this.addResolvingPromise(this._resourcesFetch),dKe(this._resourcesFetch)}normalizeCtorArgs(e,i){const r={...e};return i&&(r.container=i),r}postInitialize(){}beforeFirstRender(){var i;const e=this.loadDependencies();return(i=this._messageBundleProps)!=null&&i.length||e?Promise.all([e,this._loadLocale()]).then(()=>{}).catch(XX):null}loadDependencies(){return null}loadLocale(){return null}destroy(){this.destroyed||(et(this._trackingTarget),et(this.viewModel),this._detach(this.container),this._set("container",null),this._emitter.clear(),this.render=()=>null,this._projector=null,hH(this))}set container(e){this._get("container")||this._set("container",e)}castContainer(e){return x9(e)}get domNode(){return this.container}set domNode(e){this.container=e}get id(){var e;return this._get("id")||((e=this.container)==null?void 0:e.id)||Date.now().toString(16)+"-widget-"+fKe++}set id(e){e&&this._set("id",e)}get label(){return this.declaredClass.split(".").pop()}set label(e){this._overrideIfSome("label",e)}get renderable(){return this._resourcesFetch}get visible(){return this._get("visible")}set visible(e){this._set("visible",e)}get[(MCe=TCe,ECe)](){return{projector:this._projector}}render(){throw new Error("not implemented")}scheduleRender(){this.destroyed||(hH(this),this._projector.scheduleRender())}own(e){R3e(Ce.getLogger(this.declaredClass),"`Widget.own()` is deprecated in favor of Widget.addHandles()'",{replacement:"Widget.addHandles()",version:"4.28"}),this.addHandles(e)}classes(...e){return GS.apply(this,e)}renderNow(){hH(this),this._projector.renderNow()}_postInitialize(){var i;if(this.destroyed)return;this.scheduleRender(),(i=this._delegatedEventNames)!=null&&i.length&&this.addHandles(_e(()=>this.viewModel,(r,n)=>{n&&this.removeHandles("delegated-events"),r&&qV(r)&&this.addHandles(this._delegatedEventNames.map(s=>Y5(r,s,o=>{this.emit(s,o)})),"delegated-events")},kt)),this.postInitialize();const e=async()=>{await this._loadLocale().catch(XX),this.scheduleRender()};this.addHandles([oE(e),_e(()=>this.uiStrings,e),Mo(()=>this.container,r=>{this.destroyed||this._attach(r)},{initial:!0,once:!0})])}_attach(e){e&&(this._projector.merge(e,this.render),this._attached=!0)}_detach(e){var i;this._attached&&(this._projector.detach(this.render),this._attached=!1),(i=e==null?void 0:e.parentNode)==null||i.removeChild(e)}};Ia[MCe]=!0,y([w()],Ia.prototype,"_readyForTrueRender",void 0),y([w({value:null})],Ia.prototype,"container",null),y([Ci("container")],Ia.prototype,"castContainer",null),y([w()],Ia.prototype,"iconClass",void 0),y([w()],Ia.prototype,"icon",void 0),y([w()],Ia.prototype,"id",null),y([w()],Ia.prototype,"label",null),y([w()],Ia.prototype,"renderable",null),y([w()],Ia.prototype,"uiStrings",void 0),y([w()],Ia.prototype,"viewModel",void 0),y([w({value:!0})],Ia.prototype,"visible",null),y([w()],Ia.prototype,"key",void 0),y([w()],Ia.prototype,"children",void 0),y([w()],Ia.prototype,"afterCreate",void 0),y([w()],Ia.prototype,"afterUpdate",void 0),y([w()],Ia.prototype,"afterRemoved",void 0),Ia=y([Z(pKe)],Ia);const cn=Ia;let jne=class{constructor(e,i,r,n){this.semiMajorAxis=e,this.flattening=i,this.outerAtmosphereRimWidth=r;const s=1-this.flattening;this.semiMinorAxis=this.semiMajorAxis*s,this.halfSemiMajorAxis=this.semiMajorAxis/2,this.halfCircumference=Math.PI*this.semiMajorAxis,this.metersPerDegree=this.halfCircumference/180,this.inverseFlattening=1/(1-this.flattening)-1,this.eccentricitySquared=n||2*this.flattening-this.flattening*this.flattening,this.meanRadiusSemiAxes=(2*this.semiMajorAxis+this.semiMinorAxis)/3}get radius(){return this.semiMajorAxis}};const Mr=new jne(6378137,1/298.257223563,3e5,.006694379990137799),Sy=new jne(3396190,1/169.8944472236118,23e4),u_=new jne(1737400,0,0);let fH,$e=null;function PCe(){return!!$e}function yKe(){return!!Le("esri-wasm")}function RCe(){return fH||(fH=we(()=>import("./pe-wasm-Rr_waIie.js"),__vite__mapDeps([])).then(t=>t.p).then(({default:t})=>t({locateFile:e=>Wr(`esri/geometry/support/${e}`)})).then(t=>{$Ce(t)}),fH)}var RZ,to,aL;(function(t){function e(s,o,l){$e.ensureCache.prepare();const c=SS(l),f=l===c,_=$e.ensureFloat64(c),x=$e._pe_geog_to_proj($e.getPointer(s),o,_);return x&&Bw(l,o,_,f),x}function i(s,o,l,c){switch(c){case to.PE_TRANSFORM_P_TO_G:return r(s,o,l);case to.PE_TRANSFORM_G_TO_P:return e(s,o,l)}return 0}function r(s,o,l){return n(s,o,l,0)}function n(s,o,l,c){$e.ensureCache.prepare();const f=SS(l),_=l===f,x=$e.ensureFloat64(f),T=$e._pe_proj_to_geog_center($e.getPointer(s),o,x,c);return T&&Bw(l,o,x,_),T}t.geogToProj=e,t.projGeog=i,t.projToGeog=r,t.projToGeogCenter=n})(RZ||(RZ={})),function(t){function e(){t.PE_BUFFER_MAX=$e.PeDefs.prototype.PE_BUFFER_MAX,t.PE_NAME_MAX=$e.PeDefs.prototype.PE_NAME_MAX,t.PE_MGRS_MAX=$e.PeDefs.prototype.PE_MGRS_MAX,t.PE_USNG_MAX=$e.PeDefs.prototype.PE_USNG_MAX,t.PE_DD_MAX=$e.PeDefs.prototype.PE_DD_MAX,t.PE_DDM_MAX=$e.PeDefs.prototype.PE_DDM_MAX,t.PE_DMS_MAX=$e.PeDefs.prototype.PE_DMS_MAX,t.PE_UTM_MAX=$e.PeDefs.prototype.PE_UTM_MAX,t.PE_PARM_MAX=$e.PeDefs.prototype.PE_PARM_MAX,t.PE_TYPE_NONE=$e.PeDefs.prototype.PE_TYPE_NONE,t.PE_TYPE_GEOGCS=$e.PeDefs.prototype.PE_TYPE_GEOGCS,t.PE_TYPE_PROJCS=$e.PeDefs.prototype.PE_TYPE_PROJCS,t.PE_TYPE_GEOGTRAN=$e.PeDefs.prototype.PE_TYPE_GEOGTRAN,t.PE_TYPE_COORDSYS=$e.PeDefs.prototype.PE_TYPE_COORDSYS,t.PE_TYPE_UNIT=$e.PeDefs.prototype.PE_TYPE_UNIT,t.PE_TYPE_LINUNIT=$e.PeDefs.prototype.PE_TYPE_LINUNIT,t.PE_STR_OPTS_NONE=$e.PeDefs.prototype.PE_STR_OPTS_NONE,t.PE_STR_AUTH_NONE=$e.PeDefs.prototype.PE_STR_AUTH_NONE,t.PE_STR_AUTH_TOP=$e.PeDefs.prototype.PE_STR_AUTH_TOP,t.PE_STR_NAME_CANON=$e.PeDefs.prototype.PE_STR_NAME_CANON,t.PE_STR_FMT_WKT=$e.PeDefs.prototype.PE_STR_FMT_WKT,t.PE_STR_FMT_WKT2=$e.PeDefs.prototype.PE_STR_FMT_WKT2,t.PE_PARM_X0=$e.PeDefs.prototype.PE_PARM_X0,t.PE_PARM_ND=$e.PeDefs.prototype.PE_PARM_ND,t.PE_TRANSFORM_1_TO_2=$e.PeDefs.prototype.PE_TRANSFORM_1_TO_2,t.PE_TRANSFORM_2_TO_1=$e.PeDefs.prototype.PE_TRANSFORM_2_TO_1,t.PE_TRANSFORM_P_TO_G=$e.PeDefs.prototype.PE_TRANSFORM_P_TO_G,t.PE_TRANSFORM_G_TO_P=$e.PeDefs.prototype.PE_TRANSFORM_G_TO_P,t.PE_HORIZON_RECT=$e.PeDefs.prototype.PE_HORIZON_RECT,t.PE_HORIZON_POLY=$e.PeDefs.prototype.PE_HORIZON_POLY,t.PE_HORIZON_LINE=$e.PeDefs.prototype.PE_HORIZON_LINE,t.PE_HORIZON_DELTA=$e.PeDefs.prototype.PE_HORIZON_DELTA}t.init=e}(to||(to={})),function(t){const e={},i={},r=A=>{if(A){const M=A.getType();switch(M){case to.PE_TYPE_GEOGCS:A=$e.castObject(A,$e.PeGeogcs);break;case to.PE_TYPE_PROJCS:A=$e.castObject(A,$e.PeProjcs);break;case to.PE_TYPE_GEOGTRAN:A=$e.castObject(A,$e.PeGeogtran);break;default:M&to.PE_TYPE_UNIT&&(A=$e.castObject(A,$e.PeUnit))}}return A};function n(){$e.PeFactory.prototype.initialize(null)}function s(A){return o(to.PE_TYPE_COORDSYS,A)}function o(A,M){let I=null,L=e[A];if(L||(L={},e[A]=L),L.hasOwnProperty(String(M)))I=L[M];else{const F=$e.PeFactory.prototype.factoryByType(A,M);$e.compare(F,$e.NULL)||(I=F,L[M]=I)}return I=r(I),I}function l(A,M){let I=null,L=i[A];if(L||(L={},i[A]=L),L.hasOwnProperty(M))I=L[M];else{const F=$e.PeFactory.prototype.fromString(A,M);$e.compare(F,$e.NULL)||(I=F,L[M]=I)}return I=r(I),I}function c(A){return o(to.PE_TYPE_GEOGCS,A)}function f(A){return o(to.PE_TYPE_GEOGTRAN,A)}function _(A){return $e.PeFactory.prototype.getCode(A)}function x(A){return o(to.PE_TYPE_PROJCS,A)}function T(A){return o(to.PE_TYPE_UNIT,A)}t.initialize=n,t.coordsys=s,t.factoryByType=o,t.fromString=l,t.geogcs=c,t.geogtran=f,t.getCode=_,t.projcs=x,t.unit=T}(aL||(aL={}));let ICe=null;var Tz,IZ,$Z,lT,Nh,lL,h_,Ez,LZ;function $Ce(t){function e(s,o,l){s[o]=l(s[o])}$e=t,to.init(),Tz.init(),Nh.init(),h_.init(),Ez.init(),ICe=class extends $e.PeGCSExtent{destroy(){$e.destroy(this)}};const i=[$e.PeDatum,$e.PeGeogcs,$e.PeGeogtran,$e.PeObject,$e.PeParameter,$e.PePrimem,$e.PeProjcs,$e.PeSpheroid,$e.PeUnit];for(const s of i)e(s.prototype,"getName",o=>function(){return o.call(this,new Array(to.PE_NAME_MAX))});for(const s of[$e.PeGeogtran,$e.PeProjcs])e(s.prototype,"getParameters",o=>function(){const l=new Array(to.PE_PARM_MAX);let c=o.call(this);for(let f=0;ffunction(){const o=this.getSize();if(!o)return null;const l=[];return Bw(l,o,s.call(this)),l}),e($e.PeGTlistExtendedEntry.prototype,"getEntries",s=>{const o=$e._pe_getPeGTlistExtendedGTsSize();return function(){let l=null;const c=s.call(this);if(!$e.compare(c,$e.NULL)){l=[c];const f=this.getSteps();if(f>1){const _=$e.getPointer(c);for(let x=1;xfunction(){let o=this._cache;if(o||(o=new Map,this._cache=o),o.has(s))return o.get(s);let l=null;const c=s.call(this);if(!$e.compare(c,$e.NULL)){l=[c];const f=c.getNump();if(f>1){const _=$e.getPointer(c);for(let x=1;x{e.push(i[0],i[1])})):e=t,e}function Bw(t,e,i,r=!1){if(r)for(let n=0;n<2*e;n++)t[n]=$e.getValue(i+n*Float64Array.BYTES_PER_ELEMENT,"double");else{const n=t.length===0;for(let s=0;s1)){const A=$e.getPointer(T);for(let M=1;M{g1(n);const s=n.getGeogtran();g1(s),s.getParameters().forEach(g1),[s.getGeogcs1(),s.getGeogcs2()].forEach(o=>{g1(o);const l=o.getDatum();g1(l),g1(l.getSpheroid()),g1(o.getPrimem()),g1(o.getUnit())})});$e.PeGTlistExtendedEntry.prototype.Delete(i[0])}}t.destroy=e}(IZ||(IZ={})),function(t){function e(i,r,n,s,o){$e.ensureCache.prepare();const l=SS(n),c=n===l,f=$e.ensureFloat64(l);let _=0;s&&(_=$e.ensureFloat64(s));const x=$e._pe_geog_to_geog($e.getPointer(i),r,f,_,o);return x&&Bw(n,r,f,c),x}t.geogToGeog=e}($Z||($Z={})),function(t){const e=(f,_,x,T,A,M)=>{let I,L;switch($e.ensureCache.prepare(),f){case"dd":I=$e._pe_geog_to_dd,L=to.PE_DD_MAX;break;case"ddm":I=$e._pe_geog_to_ddm,L=to.PE_DDM_MAX;break;case"dms":I=$e._pe_geog_to_dms,L=to.PE_DMS_MAX}let F=0;_&&(F=$e.getPointer(_));const z=SS(T),k=$e.ensureFloat64(z),U=k6(x,L),j=I(F,x,k,A,$e.ensureInt32(U));if(j)for(let H=0;H{let M;switch($e.ensureCache.prepare(),f){case"dd":M=$e._pe_dd_to_geog;break;case"ddm":M=$e._pe_ddm_to_geog;break;case"dms":M=$e._pe_dms_to_geog}let I=0;_&&(I=$e.getPointer(_));const L=T.map(U=>$e.ensureString(U)),F=$e.ensureInt32(L),z=$e.ensureFloat64(new Array(2*x)),k=M(I,x,F,z);return k&&Bw(A,x,z),k};function r(f,_,x,T,A){return e("dms",f,_,x,T,A)}function n(f,_,x,T){return i("dms",f,_,x,T)}function s(f,_,x,T,A){return e("ddm",f,_,x,T,A)}function o(f,_,x,T){return i("ddm",f,_,x,T)}function l(f,_,x,T,A){return e("dd",f,_,x,T,A)}function c(f,_,x,T){return i("dd",f,_,x,T)}t.geogToDms=r,t.dmsToGeog=n,t.geogToDdm=s,t.ddmToGeog=o,t.geogToDd=l,t.ddToGeog=c}(lT||(lT={})),function(t){function e(){t.PE_MGRS_STYLE_NEW=$e.PeNotationMgrs.prototype.PE_MGRS_STYLE_NEW,t.PE_MGRS_STYLE_OLD=$e.PeNotationMgrs.prototype.PE_MGRS_STYLE_OLD,t.PE_MGRS_STYLE_AUTO=$e.PeNotationMgrs.prototype.PE_MGRS_STYLE_AUTO,t.PE_MGRS_180_ZONE_1_PLUS=$e.PeNotationMgrs.prototype.PE_MGRS_180_ZONE_1_PLUS,t.PE_MGRS_ADD_SPACES=$e.PeNotationMgrs.prototype.PE_MGRS_ADD_SPACES}function i(n,s,o,l,c,f,_){$e.ensureCache.prepare();let x=0;n&&(x=$e.getPointer(n));const T=SS(o),A=$e.ensureFloat64(T),M=k6(s,to.PE_MGRS_MAX),I=$e.ensureInt32(M),L=$e._pe_geog_to_mgrs_extended(x,s,A,l,c,f,I);if(L)for(let F=0;F$e.ensureString(M)),x=$e.ensureInt32(_),T=$e.ensureFloat64(new Array(2*s)),A=$e._pe_mgrs_to_geog_extended(f,s,x,l,T);return A&&Bw(c,s,T),A}t.init=e,t.geogToMgrsExtended=i,t.mgrsToGeogExtended=r}(Nh||(Nh={})),function(t){function e(r,n,s,o,l,c,f){$e.ensureCache.prepare();let _=0;r&&(_=$e.getPointer(r));const x=SS(s),T=$e.ensureFloat64(x),A=k6(n,to.PE_MGRS_MAX),M=$e.ensureInt32(A),I=$e._pe_geog_to_usng(_,n,T,o,l,c,M);if(I)for(let L=0;L$e.ensureString(T)),f=$e.ensureInt32(c),_=$e.ensureFloat64(new Array(2*n)),x=$e._pe_usng_to_geog(l,n,f,_);return x&&Bw(o,n,_),x}t.geogToUsng=e,t.usngToGeog=i}(lL||(lL={})),function(t){function e(){t.PE_UTM_OPTS_NONE=$e.PeNotationUtm.prototype.PE_UTM_OPTS_NONE,t.PE_UTM_OPTS_ADD_SPACES=$e.PeNotationUtm.prototype.PE_UTM_OPTS_ADD_SPACES,t.PE_UTM_OPTS_NS=$e.PeNotationUtm.prototype.PE_UTM_OPTS_NS}function i(n,s,o,l,c){$e.ensureCache.prepare();let f=0;n&&(f=$e.getPointer(n));const _=SS(o),x=$e.ensureFloat64(_),T=k6(s,to.PE_UTM_MAX),A=$e.ensureInt32(T),M=$e._pe_geog_to_utm(f,s,x,l,A);if(M)for(let I=0;I$e.ensureString(M)),x=$e.ensureInt32(_),T=$e.ensureFloat64(new Array(2*s)),A=$e._pe_utm_to_geog(f,s,x,l,T);return A&&Bw(c,s,T),A}t.init=e,t.geogToUtm=i,t.utmToGeog=r}(h_||(h_={})),function(t){const e=new Map;function i(){t.PE_PCSINFO_OPTION_NONE=$e.PePCSInfo.prototype.PE_PCSINFO_OPTION_NONE,t.PE_PCSINFO_OPTION_DOMAIN=$e.PePCSInfo.prototype.PE_PCSINFO_OPTION_DOMAIN,t.PE_POLE_OUTSIDE_BOUNDARY=$e.PePCSInfo.prototype.PE_POLE_OUTSIDE_BOUNDARY,t.PE_POLE_POINT=$e.PePCSInfo.prototype.PE_POLE_POINT}function r(n,s=t.PE_PCSINFO_OPTION_DOMAIN){let o=null,l=null;return e.has(n)&&(l=e.get(n),l[s]&&(o=l[s])),o||(o=$e.PePCSInfo.prototype.generate(n,s),l||(l=[],e.set(n,l)),l[s]=o),o}t.init=i,t.generate=r}(Ez||(Ez={})),function(t){function e(){return $e.PeVersion.prototype.version_string()}t.versionString=e}(LZ||(LZ={}));const vKe=Object.freeze(Object.defineProperty({__proto__:null,get PeCSTransformations(){return RZ},get PeDefs(){return to},get PeFactory(){return aL},get PeGCSExtent(){return ICe},get PeGTTransformations(){return $Z},get PeGTlistExtended(){return Tz},get PeGTlistExtendedEntry(){return IZ},get PeNotationDms(){return lT},get PeNotationMgrs(){return Nh},get PeNotationUsng(){return lL},get PeNotationUtm(){return h_},get PePCSInfo(){return Ez},get PeVersion(){return LZ},_init:$Ce,get _pe(){return $e},isLoaded:PCe,isSupported:yKe,load:RCe},Symbol.toStringTag,{value:"Module"}));var wf;(function(t){t[t.CGCS2000=4490]="CGCS2000",t[t.GCSMARS2000=104971]="GCSMARS2000",t[t.GCSMARS2000_SPHERE=104905]="GCSMARS2000_SPHERE",t[t.GCSMOON2000=104903]="GCSMOON2000"})(wf||(wf={}));let P;const ae={values:[1,.3048,.3048006096012192,.3047972654,.9143917962,.201166195164,.9143984146160287,.3047994715386762,20.11676512155263,20.11678249437587,.9143985307444408,.91439523,.3047997101815088,20.1168,20.116756,5e4,15e4],units:["Meter","Foot","Foot_US","Foot_Clarke","Yard_Clarke","Link_Clarke","Yard_Sears","Foot_Sears","Chain_Sears","Chain_Benoit_1895_B","Yard_Indian","Yard_Indian_1937","Foot_Gold_Coast","Chain","Chain_Sears_1922_Truncated","50_Kilometers","150_Kilometers"],2066:5,2136:12,2155:2,2157:0,2158:0,2159:12,2160:12,2204:2,2219:0,2220:0,2254:2,2255:2,2256:1,2265:1,2266:1,2267:2,2268:2,2269:1,2270:1,2271:2,2272:2,2273:1,2294:0,2295:0,2314:3,2899:2,2900:2,2901:1,2909:1,2910:1,2911:2,2912:2,2913:1,2914:1,2992:1,2993:0,2994:1,3080:1,3089:2,3090:0,3091:2,3102:2,3141:0,3142:0,3167:14,3359:2,3360:0,3361:1,3362:0,3363:2,3364:0,3365:2,3366:3,3404:2,3405:0,3406:0,3407:3,3439:0,3440:0,3479:1,3480:0,3481:1,3482:0,3483:1,3484:0,3485:2,3486:0,3487:2,3488:0,3489:0,3490:2,3491:0,3492:2,3493:0,3494:2,3495:0,3496:2,3497:0,3498:2,3499:0,3500:2,3501:0,3502:2,3503:0,3504:2,3505:0,3506:2,3507:0,3508:2,3509:0,3510:2,3511:0,3512:2,3513:0,3514:0,3515:2,3516:0,3517:2,3518:0,3519:2,3520:0,3521:2,3522:0,3523:2,3524:0,3525:2,3526:0,3527:2,3528:0,3529:2,3530:0,3531:2,3532:0,3533:2,3534:0,3535:2,3536:0,3537:2,3538:0,3539:2,3540:0,3541:2,3542:0,3543:2,3544:0,3545:2,3546:0,3547:2,3548:0,3549:2,3550:0,3551:2,3552:0,3553:2,3582:2,3583:0,3584:2,3585:0,3586:2,3587:0,3588:1,3589:0,3590:1,3591:0,3592:0,3593:1,3598:2,3599:0,3600:2,3605:1,3606:0,3607:0,3608:2,3609:0,3610:2,3611:0,3612:2,3613:0,3614:2,3615:0,3616:2,3617:0,3618:2,3619:0,3620:2,3621:0,3622:2,3623:0,3624:2,3625:0,3626:2,3627:0,3628:2,3629:0,3630:2,3631:0,3632:2,3633:0,3634:1,3635:0,3636:1,3640:2,3641:0,3642:2,3643:0,3644:1,3645:0,3646:1,3647:0,3648:1,3649:0,3650:2,3651:0,3652:2,3653:0,3654:2,3655:0,3656:1,3657:0,3658:2,3659:0,3660:2,3661:0,3662:2,3663:0,3664:2,3668:2,3669:0,3670:2,3671:0,3672:2,3673:0,3674:2,3675:0,3676:1,3677:2,3678:0,3679:1,3680:2,3681:0,3682:1,3683:2,3684:0,3685:0,3686:2,3687:0,3688:2,3689:0,3690:2,3691:0,3692:2,3696:2,3697:0,3698:2,3699:0,3700:2,3793:0,3794:0,3812:0,3854:0,3857:0,3920:0,3978:0,3979:0,3991:2,3992:2,4026:0,4037:0,4038:0,4071:0,4082:0,4083:0,4087:0,4088:0,4217:2,4414:0,4415:0,4417:0,4434:0,4437:0,4438:2,4439:2,4462:0,4467:0,4471:0,4474:0,4559:0,4647:0,4822:0,4826:0,4839:0,5018:0,5041:0,5042:0,5048:0,5221:0,5223:0,5234:0,5235:0,5243:0,5247:0,5266:0,5316:0,5320:0,5321:0,5325:0,5337:0,5361:0,5362:0,5367:0,5382:0,5383:0,5396:0,5456:0,5457:0,5469:0,5472:4,5490:0,5513:0,5514:0,5523:0,5559:0,5588:1,5589:3,5596:0,5627:0,5629:0,5641:0,5643:0,5644:0,5646:2,5654:2,5655:2,5659:0,5700:0,5825:0,5836:0,5837:0,5839:0,5842:0,5844:0,5858:0,5879:0,5880:0,5887:0,5890:0,6128:1,6129:1,6141:1,6204:0,6210:0,6211:0,6307:0,6312:0,6316:0,6362:0,6391:1,6405:1,6406:0,6407:1,6408:0,6409:1,6410:0,6411:2,6412:0,6413:2,6414:0,6415:0,6416:2,6417:0,6418:2,6419:0,6420:2,6421:0,6422:2,6423:0,6424:2,6425:0,6426:2,6427:0,6428:2,6429:0,6430:2,6431:0,6432:2,6433:0,6434:2,6435:0,6436:2,6437:0,6438:2,6439:0,6440:0,6441:2,6442:0,6443:2,6444:0,6445:2,6446:0,6447:2,6448:0,6449:2,6450:0,6451:2,6452:0,6453:2,6454:0,6455:2,6456:0,6457:2,6458:0,6459:2,6460:0,6461:2,6462:0,6463:2,6464:0,6465:2,6466:0,6467:2,6468:0,6469:2,6470:0,6471:2,6472:0,6473:2,6474:0,6475:2,6476:0,6477:2,6478:0,6479:2,6484:2,6485:0,6486:2,6487:0,6488:2,6489:0,6490:2,6491:0,6492:2,6493:0,6494:1,6495:0,6496:1,6497:0,6498:0,6499:1,6500:0,6501:2,6502:0,6503:2,6504:0,6505:2,6506:0,6507:2,6508:0,6509:0,6510:2,6515:1,6516:0,6518:0,6519:2,6520:0,6521:2,6522:0,6523:2,6524:0,6525:2,6526:0,6527:2,6528:0,6529:2,6530:0,6531:2,6532:0,6533:2,6534:0,6535:2,6536:0,6537:2,6538:0,6539:2,6540:0,6541:2,6542:0,6543:2,6544:0,6545:1,6546:0,6547:1,6548:0,6549:2,6550:0,6551:2,6552:0,6553:2,6554:0,6555:2,6556:0,6557:1,6558:0,6559:1,6560:0,6561:1,6562:0,6563:2,6564:0,6565:2,6566:0,6567:0,6568:2,6569:0,6570:1,6571:0,6572:2,6573:0,6574:2,6575:0,6576:2,6577:0,6578:2,6582:2,6583:0,6584:2,6585:0,6586:2,6587:0,6588:2,6589:0,6590:2,6591:0,6592:0,6593:2,6594:0,6595:2,6596:0,6597:2,6598:0,6599:2,6600:0,6601:2,6602:0,6603:2,6605:2,6606:0,6607:2,6608:0,6609:2,6610:0,6611:0,6612:2,6613:0,6614:2,6615:0,6616:2,6617:0,6618:2,6633:2,6646:0,6703:0,6784:0,6785:1,6786:0,6787:1,6788:0,6789:1,6790:0,6791:1,6792:0,6793:1,6794:0,6795:1,6796:0,6797:1,6798:0,6799:1,6800:0,6801:1,6802:0,6803:1,6804:0,6805:1,6806:0,6807:1,6808:0,6809:1,6810:0,6811:1,6812:0,6813:1,6814:0,6815:1,6816:0,6817:1,6818:0,6819:1,6820:0,6821:1,6822:0,6823:1,6824:0,6825:1,6826:0,6827:1,6828:0,6829:1,6830:0,6831:1,6832:0,6833:1,6834:0,6835:1,6836:0,6837:1,6838:0,6839:1,6840:0,6841:1,6842:0,6843:1,6844:0,6845:1,6846:0,6847:1,6848:0,6849:1,6850:0,6851:1,6852:0,6853:1,6854:0,6855:1,6856:0,6857:1,6858:0,6859:1,6860:0,6861:1,6862:0,6863:1,6867:0,6868:1,6870:0,6875:0,6876:0,6879:0,6880:2,6884:0,6885:1,6886:0,6887:1,6915:0,6922:0,6923:2,6924:0,6925:2,6962:0,6984:0,6991:0,7128:2,7131:0,7132:2,7142:0,7257:0,7258:2,7259:0,7260:2,7261:0,7262:2,7263:0,7264:2,7265:0,7266:2,7267:0,7268:2,7269:0,7270:2,7271:0,7272:2,7273:0,7274:2,7275:0,7276:2,7277:0,7278:2,7279:0,7280:2,7281:0,7282:2,7283:0,7284:2,7285:0,7286:2,7287:0,7288:2,7289:0,7290:2,7291:0,7292:2,7293:0,7294:2,7295:0,7296:2,7297:0,7298:2,7299:0,7300:2,7301:0,7302:2,7303:0,7304:2,7305:0,7306:2,7307:0,7308:2,7309:0,7310:2,7311:0,7312:2,7313:0,7314:2,7315:0,7316:2,7317:0,7318:2,7319:0,7320:2,7321:0,7322:2,7323:0,7324:2,7325:0,7326:2,7327:0,7328:2,7329:0,7330:2,7331:0,7332:2,7333:0,7334:2,7335:0,7336:2,7337:0,7338:2,7339:0,7340:2,7341:0,7342:2,7343:0,7344:2,7345:0,7346:2,7347:0,7348:2,7349:0,7350:2,7351:0,7352:2,7353:0,7354:2,7355:0,7356:2,7357:0,7358:2,7359:0,7360:2,7361:0,7362:2,7363:0,7364:2,7365:0,7366:2,7367:0,7368:2,7369:0,7370:2,7877:0,7878:0,7882:0,7883:0,7887:0,7899:0,7991:0,7992:0,8035:2,8036:2,8058:0,8059:0,8082:0,8083:0,8088:0,8090:0,8091:2,8092:0,8093:2,8095:0,8096:2,8097:0,8098:2,8099:0,8100:2,8101:0,8102:2,8103:0,8104:2,8105:0,8106:2,8107:0,8108:2,8109:0,8110:2,8111:0,8112:2,8113:0,8114:2,8115:0,8116:2,8117:0,8118:2,8119:0,8120:2,8121:0,8122:2,8123:0,8124:2,8125:0,8126:2,8127:0,8128:2,8129:0,8130:2,8131:0,8132:2,8133:0,8134:2,8135:0,8136:2,8137:0,8138:2,8139:0,8140:2,8141:0,8142:2,8143:0,8144:2,8145:0,8146:2,8147:0,8148:2,8149:0,8150:2,8151:0,8152:2,8153:0,8154:2,8155:0,8156:2,8157:0,8158:2,8159:0,8160:2,8161:0,8162:2,8163:0,8164:2,8165:0,8166:2,8167:0,8168:2,8169:0,8170:2,8171:0,8172:2,8173:0,8177:2,8179:0,8180:2,8181:0,8182:2,8184:0,8185:2,8187:0,8189:2,8191:0,8193:2,8196:0,8197:2,8198:0,8200:2,8201:0,8202:2,8203:0,8204:2,8205:0,8206:2,8207:0,8208:2,8209:0,8210:2,8212:0,8213:2,8214:0,8216:2,8218:0,8220:2,8222:0,8224:2,8225:0,8226:2,8311:0,8312:1,8313:0,8314:1,8315:0,8316:1,8317:0,8318:1,8319:0,8320:1,8321:0,8322:1,8323:0,8324:1,8325:0,8326:1,8327:0,8328:1,8329:0,8330:1,8331:0,8332:1,8333:0,8334:1,8335:0,8336:1,8337:0,8338:1,8339:0,8340:1,8341:0,8342:1,8343:0,8344:1,8345:0,8346:1,8347:0,8348:1,8352:0,8353:0,8379:0,8380:2,8381:0,8382:2,8383:0,8384:2,8385:0,8387:2,8391:0,8395:0,8433:0,8441:0,8455:0,8456:0,8531:2,8682:0,8686:0,8687:0,8692:0,8693:0,8826:0,8903:0,8950:0,8951:0,9039:0,9040:0,9141:0,9149:0,9150:0,9191:0,9221:0,9222:0,9249:0,9250:0,9252:0,9254:0,9265:0,9284:0,9285:0,9300:0,9354:0,9367:0,9373:0,9377:0,9387:0,9391:0,9456:0,9473:0,9498:0,9674:0,9678:0,9680:0,9709:0,9712:0,9713:0,9716:0,9741:0,9748:2,9749:2,9761:0,9766:0,9793:0,9794:0,9869:0,9874:0,9875:0,9880:0,9895:0,9943:0,9945:0,9947:0,9967:0,9972:0,9977:0,10160:0,10183:0,10188:0,10194:0,10199:0,10207:0,10212:0,10217:0,10222:0,10227:0,10235:0,10240:0,10250:0,10254:0,10270:0,10275:0,10280:0,10306:0,10329:0,10471:0,20002:0,20042:0,20050:1,20499:0,20538:0,20539:0,20790:0,20791:0,21291:0,21292:0,21500:0,21817:0,21818:0,22032:0,22033:0,22091:0,22092:0,22239:0,22240:0,22332:0,22337:0,22338:0,22391:0,22392:0,22639:0,22700:0,22739:0,22770:0,22780:0,22832:0,23090:0,23095:0,23239:0,23240:0,23433:0,23700:0,24047:0,24048:0,24100:3,24200:0,24305:0,24306:0,24382:10,24383:0,24500:0,24547:0,24548:0,24571:9,24600:0,25e3:0,25231:0,25884:0,25932:0,26237:0,26331:0,26332:0,26432:0,26591:0,26592:0,26632:0,26692:0,27120:0,27200:0,27291:6,27292:6,27429:0,27492:0,27493:0,27500:0,27700:0,28232:0,28600:0,28991:0,28992:0,29100:0,29101:0,29220:0,29221:0,29333:0,29635:0,29636:0,29701:0,29738:0,29739:0,29849:0,29850:0,29871:8,29872:7,29873:0,29874:0,30200:5,30339:0,30340:0,30591:0,30592:0,30791:0,30792:0,30800:0,31028:0,31121:0,31154:0,31170:0,31171:0,31370:0,31528:0,31529:0,31600:0,31700:0,31838:0,31839:0,31900:0,31901:0,32061:0,32062:0,32098:0,32099:2,32100:0,32104:0,32161:0,32766:0,53048:0,53049:0,54090:0,54091:0,65061:2,65062:2,65161:0,65163:0,102041:2,102064:11,102068:15,102069:16,102118:2,102119:1,102120:2,102121:2,102217:2,102218:0,102219:2,102220:2,102378:1,102379:1,102380:0,102381:1,102589:2,102599:2,102600:2,102604:2,102647:0,102704:2,102705:2,102706:0,102731:0,102732:0,102759:1,102760:1,102761:2,102762:0,102763:2,102764:0,102765:0,102766:2,102970:1,102974:2,102993:0,102994:0,102995:2,102996:2,103015:0,103016:2,103017:0,103018:2,103025:0,103026:0,103027:2,103028:2,103035:0,103036:0,103037:2,103038:2,103039:0,103040:0,103041:2,103042:2,103043:0,103044:0,103045:2,103046:2,103047:0,103048:0,103049:2,103050:2,103051:0,103052:2,103053:0,103054:2,103055:0,103056:2,103057:0,103058:0,103059:2,103060:2,103061:0,103062:0,103063:2,103064:2,103069:2,103070:0,103071:0,103072:2,103073:2,103086:0,103087:0,103088:2,103089:2,103094:1,103095:0,103096:2,103103:0,103104:2,103105:0,103106:2,103121:0,103122:2,103123:0,103124:0,103125:1,103126:1,103127:0,103128:0,103129:2,103130:2,103131:0,103132:0,103133:2,103134:2,103135:0,103136:0,103137:1,103138:1,103139:0,103140:2,103141:0,103142:2,103143:0,103144:2,103145:0,103146:1,103147:0,103148:0,103149:2,103150:2,103151:0,103152:2,103172:0,103173:2,103174:0,103175:0,103176:2,103177:2,103178:0,103179:0,103180:2,103181:2,103182:0,103183:0,103184:2,103185:2,103228:0,103229:0,103230:2,103231:2,103250:0,103251:2,103252:0,103253:2,103260:0,103261:0,103262:2,103263:2,103270:0,103271:0,103272:2,103273:2,103274:0,103275:0,103276:2,103277:2,103278:0,103279:0,103280:2,103281:2,103282:0,103283:0,103284:2,103285:2,103286:0,103287:2,103288:0,103289:2,103290:0,103291:2,103292:0,103293:0,103294:2,103295:2,103296:0,103297:0,103298:2,103299:2,103376:2,103377:0,103378:0,103379:2,103380:2,103393:0,103394:0,103395:2,103396:2,103472:0,103473:1,103474:0,103475:2,103482:0,103483:2,103484:0,103485:2,103500:0,103501:2,103502:0,103503:0,103504:1,103505:1,103506:0,103507:0,103508:2,103509:2,103510:0,103511:0,103512:2,103513:2,103514:0,103515:2,103516:0,103517:2,103518:0,103519:2,103520:0,103521:1,103522:0,103523:0,103524:2,103525:2,103526:0,103527:2,103561:2,103562:2,103563:0,103564:0,103565:2,103566:2,103567:0,103568:0,103569:2,103570:2,103584:0,103585:2,103586:0,103587:2,103588:1,103589:0,103590:2,103591:1,103592:0,103593:2,103594:1,103695:2,103897:1};for(P=2e3;P<=2045;P++)ae[P]=0;for(P=2056;P<=2065;P++)ae[P]=0;for(P=2067;P<=2135;P++)ae[P]=0;for(P=2137;P<=2154;P++)ae[P]=0;for(P=2161;P<=2170;P++)ae[P]=0;for(P=2172;P<=2193;P++)ae[P]=0;for(P=2195;P<=2198;P++)ae[P]=0;for(P=2200;P<=2203;P++)ae[P]=0;for(P=2205;P<=2217;P++)ae[P]=0;for(P=2222;P<=2224;P++)ae[P]=1;for(P=2225;P<=2250;P++)ae[P]=2;for(P=2251;P<=2253;P++)ae[P]=1;for(P=2257;P<=2264;P++)ae[P]=2;for(P=2274;P<=2279;P++)ae[P]=2;for(P=2280;P<=2282;P++)ae[P]=1;for(P=2283;P<=2289;P++)ae[P]=2;for(P=2290;P<=2292;P++)ae[P]=0;for(P=2308;P<=2313;P++)ae[P]=0;for(P=2315;P<=2491;P++)ae[P]=0;for(P=2494;P<=2866;P++)ae[P]=0;for(P=2867;P<=2869;P++)ae[P]=1;for(P=2870;P<=2888;P++)ae[P]=2;for(P=2891;P<=2895;P++)ae[P]=2;for(P=2896;P<=2898;P++)ae[P]=1;for(P=2902;P<=2908;P++)ae[P]=2;for(P=2915;P<=2920;P++)ae[P]=2;for(P=2921;P<=2923;P++)ae[P]=1;for(P=2924;P<=2930;P++)ae[P]=2;for(P=2931;P<=2962;P++)ae[P]=0;for(P=2964;P<=2968;P++)ae[P]=2;for(P=2969;P<=2973;P++)ae[P]=0;for(P=2975;P<=2991;P++)ae[P]=0;for(P=2995;P<=3051;P++)ae[P]=0;for(P=3054;P<=3079;P++)ae[P]=0;for(P=3081;P<=3088;P++)ae[P]=0;for(P=3092;P<=3101;P++)ae[P]=0;for(P=3106;P<=3138;P++)ae[P]=0;for(P=3146;P<=3151;P++)ae[P]=0;for(P=3153;P<=3166;P++)ae[P]=0;for(P=3168;P<=3172;P++)ae[P]=0;for(P=3174;P<=3203;P++)ae[P]=0;for(P=3294;P<=3358;P++)ae[P]=0;for(P=3367;P<=3403;P++)ae[P]=0;for(P=3408;P<=3416;P++)ae[P]=0;for(P=3417;P<=3438;P++)ae[P]=2;for(P=3441;P<=3446;P++)ae[P]=2;for(P=3447;P<=3450;P++)ae[P]=0;for(P=3451;P<=3459;P++)ae[P]=2;for(P=3460;P<=3478;P++)ae[P]=0;for(P=3554;P<=3559;P++)ae[P]=0;for(P=3560;P<=3570;P++)ae[P]=2;for(P=3571;P<=3581;P++)ae[P]=0;for(P=3594;P<=3597;P++)ae[P]=0;for(P=3601;P<=3604;P++)ae[P]=0;for(P=3637;P<=3639;P++)ae[P]=0;for(P=3665;P<=3667;P++)ae[P]=0;for(P=3693;P<=3695;P++)ae[P]=0;for(P=3701;P<=3727;P++)ae[P]=0;for(P=3728;P<=3739;P++)ae[P]=2;for(P=3740;P<=3751;P++)ae[P]=0;for(P=3753;P<=3760;P++)ae[P]=2;for(P=3761;P<=3773;P++)ae[P]=0;for(P=3775;P<=3777;P++)ae[P]=0;for(P=3779;P<=3781;P++)ae[P]=0;for(P=3783;P<=3785;P++)ae[P]=0;for(P=3788;P<=3791;P++)ae[P]=0;for(P=3797;P<=3802;P++)ae[P]=0;for(P=3814;P<=3816;P++)ae[P]=0;for(P=3825;P<=3829;P++)ae[P]=0;for(P=3832;P<=3841;P++)ae[P]=0;for(P=3844;P<=3852;P++)ae[P]=0;for(P=3873;P<=3885;P++)ae[P]=0;for(P=3890;P<=3893;P++)ae[P]=0;for(P=3907;P<=3912;P++)ae[P]=0;for(P=3942;P<=3950;P++)ae[P]=0;for(P=3968;P<=3970;P++)ae[P]=0;for(P=3973;P<=3976;P++)ae[P]=0;for(P=3986;P<=3989;P++)ae[P]=0;for(P=3994;P<=3997;P++)ae[P]=0;for(P=4048;P<=4051;P++)ae[P]=0;for(P=4056;P<=4063;P++)ae[P]=0;for(P=4093;P<=4096;P++)ae[P]=0;for(P=4390;P<=4398;P++)ae[P]=0;for(P=4399;P<=4413;P++)ae[P]=2;for(P=4418;P<=4433;P++)ae[P]=2;for(P=4455;P<=4457;P++)ae[P]=2;for(P=4484;P<=4489;P++)ae[P]=0;for(P=4491;P<=4554;P++)ae[P]=0;for(P=4568;P<=4589;P++)ae[P]=0;for(P=4652;P<=4656;P++)ae[P]=0;for(P=4766;P<=4800;P++)ae[P]=0;for(P=5014;P<=5016;P++)ae[P]=0;for(P=5069;P<=5072;P++)ae[P]=0;for(P=5105;P<=5130;P++)ae[P]=0;for(P=5167;P<=5188;P++)ae[P]=0;for(P=5253;P<=5259;P++)ae[P]=0;for(P=5269;P<=5275;P++)ae[P]=0;for(P=5292;P<=5311;P++)ae[P]=0;for(P=5329;P<=5331;P++)ae[P]=0;for(P=5343;P<=5349;P++)ae[P]=0;for(P=5355;P<=5357;P++)ae[P]=0;for(P=5387;P<=5389;P++)ae[P]=0;for(P=5459;P<=5463;P++)ae[P]=0;for(P=5479;P<=5482;P++)ae[P]=0;for(P=5518;P<=5520;P++)ae[P]=0;for(P=5530;P<=5539;P++)ae[P]=0;for(P=5550;P<=5552;P++)ae[P]=0;for(P=5562;P<=5583;P++)ae[P]=0;for(P=5623;P<=5625;P++)ae[P]=2;for(P=5631;P<=5639;P++)ae[P]=0;for(P=5649;P<=5653;P++)ae[P]=0;for(P=5663;P<=5680;P++)ae[P]=0;for(P=5682;P<=5685;P++)ae[P]=0;for(P=5875;P<=5877;P++)ae[P]=0;for(P=5896;P<=5899;P++)ae[P]=0;for(P=5921;P<=5940;P++)ae[P]=0;for(P=6050;P<=6125;P++)ae[P]=0;for(P=6244;P<=6275;P++)ae[P]=0;for(P=6328;P<=6348;P++)ae[P]=0;for(P=6350;P<=6356;P++)ae[P]=0;for(P=6366;P<=6372;P++)ae[P]=0;for(P=6381;P<=6387;P++)ae[P]=0;for(P=6393;P<=6404;P++)ae[P]=0;for(P=6480;P<=6483;P++)ae[P]=0;for(P=6511;P<=6514;P++)ae[P]=0;for(P=6579;P<=6581;P++)ae[P]=0;for(P=6619;P<=6624;P++)ae[P]=0;for(P=6625;P<=6627;P++)ae[P]=2;for(P=6628;P<=6632;P++)ae[P]=0;for(P=6634;P<=6637;P++)ae[P]=0;for(P=6669;P<=6692;P++)ae[P]=0;for(P=6707;P<=6709;P++)ae[P]=0;for(P=6720;P<=6723;P++)ae[P]=0;for(P=6732;P<=6738;P++)ae[P]=0;for(P=6931;P<=6933;P++)ae[P]=0;for(P=6956;P<=6959;P++)ae[P]=0;for(P=7005;P<=7007;P++)ae[P]=0;for(P=7057;P<=7070;P++)ae[P]=2;for(P=7074;P<=7082;P++)ae[P]=0;for(P=7109;P<=7118;P++)ae[P]=0;for(P=7119;P<=7127;P++)ae[P]=1;for(P=7374;P<=7376;P++)ae[P]=0;for(P=7528;P<=7586;P++)ae[P]=0;for(P=7587;P<=7645;P++)ae[P]=2;for(P=7692;P<=7696;P++)ae[P]=0;for(P=7755;P<=7787;P++)ae[P]=0;for(P=7791;P<=7795;P++)ae[P]=0;for(P=7799;P<=7801;P++)ae[P]=0;for(P=7803;P<=7805;P++)ae[P]=0;for(P=7825;P<=7831;P++)ae[P]=0;for(P=7845;P<=7859;P++)ae[P]=0;for(P=8013;P<=8032;P++)ae[P]=0;for(P=8065;P<=8068;P++)ae[P]=1;for(P=8518;P<=8529;P++)ae[P]=2;for(P=8533;P<=8536;P++)ae[P]=2;for(P=8538;P<=8540;P++)ae[P]=2;for(P=8677;P<=8679;P++)ae[P]=0;for(P=8836;P<=8840;P++)ae[P]=0;for(P=8857;P<=8859;P++)ae[P]=0;for(P=8908;P<=8910;P++)ae[P]=0;for(P=9154;P<=9159;P++)ae[P]=0;for(P=9205;P<=9218;P++)ae[P]=0;for(P=9271;P<=9273;P++)ae[P]=0;for(P=9295;P<=9297;P++)ae[P]=0;for(P=9356;P<=9360;P++)ae[P]=0;for(P=9404;P<=9407;P++)ae[P]=0;for(P=9476;P<=9482;P++)ae[P]=0;for(P=9487;P<=9494;P++)ae[P]=0;for(P=9697;P<=9699;P++)ae[P]=0;for(P=9821;P<=9865;P++)ae[P]=0;for(P=10285;P<=10291;P++)ae[P]=0;for(P=10314;P<=10317;P++)ae[P]=0;for(P=10448;P<=10465;P++)ae[P]=0;for(P=11114;P<=11118;P++)ae[P]=0;for(P=20004;P<=20032;P++)ae[P]=0;for(P=20047;P<=20049;P++)ae[P]=0;for(P=20062;P<=20092;P++)ae[P]=0;for(P=20135;P<=20138;P++)ae[P]=0;for(P=20248;P<=20258;P++)ae[P]=0;for(P=20348;P<=20358;P++)ae[P]=0;for(P=20436;P<=20440;P++)ae[P]=0;for(P=20822;P<=20824;P++)ae[P]=0;for(P=20904;P<=20932;P++)ae[P]=0;for(P=20934;P<=20936;P++)ae[P]=0;for(P=21004;P<=21032;P++)ae[P]=0;for(P=21035;P<=21037;P++)ae[P]=0;for(P=21095;P<=21097;P++)ae[P]=0;for(P=21148;P<=21150;P++)ae[P]=0;for(P=21207;P<=21264;P++)ae[P]=0;for(P=21307;P<=21364;P++)ae[P]=0;for(P=21413;P<=21423;P++)ae[P]=0;for(P=21453;P<=21463;P++)ae[P]=0;for(P=21473;P<=21483;P++)ae[P]=0;for(P=21780;P<=21782;P++)ae[P]=0;for(P=21891;P<=21894;P++)ae[P]=0;for(P=21896;P<=21899;P++)ae[P]=0;for(P=22171;P<=22177;P++)ae[P]=0;for(P=22181;P<=22187;P++)ae[P]=0;for(P=22191;P<=22197;P++)ae[P]=0;for(P=22207;P<=22222;P++)ae[P]=0;for(P=22229;P<=22232;P++)ae[P]=0;for(P=22234;P<=22236;P++)ae[P]=0;for(P=22243;P<=22250;P++)ae[P]=0;for(P=22262;P<=22265;P++)ae[P]=0;for(P=22307;P<=22322;P++)ae[P]=0;for(P=22348;P<=22357;P++)ae[P]=0;for(P=22407;P<=22422;P++)ae[P]=0;for(P=22462;P<=22465;P++)ae[P]=0;for(P=22521;P<=22525;P++)ae[P]=0;for(P=22607;P<=22622;P++)ae[P]=0;for(P=22641;P<=22646;P++)ae[P]=0;for(P=22648;P<=22657;P++)ae[P]=0;for(P=22707;P<=22722;P++)ae[P]=0;for(P=22762;P<=22765;P++)ae[P]=0;for(P=22807;P<=22822;P++)ae[P]=0;for(P=22991;P<=22994;P++)ae[P]=0;for(P=23028;P<=23038;P++)ae[P]=0;for(P=23301;P<=23333;P++)ae[P]=2;for(P=23830;P<=23853;P++)ae[P]=0;for(P=23866;P<=23872;P++)ae[P]=0;for(P=23877;P<=23884;P++)ae[P]=0;for(P=23886;P<=23894;P++)ae[P]=0;for(P=23946;P<=23948;P++)ae[P]=0;for(P=24311;P<=24313;P++)ae[P]=0;for(P=24342;P<=24347;P++)ae[P]=0;for(P=24370;P<=24374;P++)ae[P]=10;for(P=24375;P<=24381;P++)ae[P]=0;for(P=24718;P<=24721;P++)ae[P]=0;for(P=24817;P<=24821;P++)ae[P]=0;for(P=24877;P<=24882;P++)ae[P]=0;for(P=24891;P<=24893;P++)ae[P]=0;for(P=25391;P<=25395;P++)ae[P]=0;for(P=25828;P<=25838;P++)ae[P]=0;for(P=26191;P<=26195;P++)ae[P]=0;for(P=26391;P<=26393;P++)ae[P]=0;for(P=26701;P<=26722;P++)ae[P]=0;for(P=26729;P<=26799;P++)ae[P]=2;for(P=26801;P<=26803;P++)ae[P]=2;for(P=26811;P<=26813;P++)ae[P]=2;for(P=26847;P<=26870;P++)ae[P]=2;for(P=26891;P<=26899;P++)ae[P]=0;for(P=26901;P<=26923;P++)ae[P]=0;for(P=26929;P<=26946;P++)ae[P]=0;for(P=26948;P<=26998;P++)ae[P]=0;for(P=27037;P<=27040;P++)ae[P]=0;for(P=27205;P<=27232;P++)ae[P]=0;for(P=27258;P<=27260;P++)ae[P]=0;for(P=27391;P<=27398;P++)ae[P]=0;for(P=27561;P<=27564;P++)ae[P]=0;for(P=27571;P<=27574;P++)ae[P]=0;for(P=27581;P<=27584;P++)ae[P]=0;for(P=27591;P<=27594;P++)ae[P]=0;for(P=28191;P<=28193;P++)ae[P]=0;for(P=28348;P<=28358;P++)ae[P]=0;for(P=28402;P<=28432;P++)ae[P]=0;for(P=28462;P<=28492;P++)ae[P]=0;for(P=29118;P<=29122;P++)ae[P]=0;for(P=29168;P<=29172;P++)ae[P]=0;for(P=29177;P<=29185;P++)ae[P]=0;for(P=29187;P<=29195;P++)ae[P]=0;for(P=29900;P<=29903;P++)ae[P]=0;for(P=30161;P<=30179;P++)ae[P]=0;for(P=30491;P<=30494;P++)ae[P]=0;for(P=30729;P<=30732;P++)ae[P]=0;for(P=31251;P<=31259;P++)ae[P]=0;for(P=31265;P<=31268;P++)ae[P]=0;for(P=31275;P<=31279;P++)ae[P]=0;for(P=31281;P<=31297;P++)ae[P]=0;for(P=31461;P<=31469;P++)ae[P]=0;for(P=31491;P<=31495;P++)ae[P]=0;for(P=31917;P<=31922;P++)ae[P]=0;for(P=31965;P<=32e3;P++)ae[P]=0;for(P=32001;P<=32003;P++)ae[P]=2;for(P=32005;P<=32031;P++)ae[P]=2;for(P=32033;P<=32060;P++)ae[P]=2;for(P=32064;P<=32067;P++)ae[P]=2;for(P=32074;P<=32077;P++)ae[P]=2;for(P=32081;P<=32086;P++)ae[P]=0;for(P=32107;P<=32130;P++)ae[P]=0;for(P=32133;P<=32159;P++)ae[P]=0;for(P=32164;P<=32167;P++)ae[P]=2;for(P=32180;P<=32199;P++)ae[P]=0;for(P=32201;P<=32260;P++)ae[P]=0;for(P=32301;P<=32360;P++)ae[P]=0;for(P=32401;P<=32460;P++)ae[P]=0;for(P=32501;P<=32560;P++)ae[P]=0;for(P=32601;P<=32662;P++)ae[P]=0;for(P=32664;P<=32667;P++)ae[P]=2;for(P=32701;P<=32761;P++)ae[P]=0;for(P=53001;P<=53004;P++)ae[P]=0;for(P=53008;P<=53019;P++)ae[P]=0;for(P=53021;P<=53032;P++)ae[P]=0;for(P=53034;P<=53037;P++)ae[P]=0;for(P=53042;P<=53046;P++)ae[P]=0;for(P=53074;P<=53080;P++)ae[P]=0;for(P=54001;P<=54004;P++)ae[P]=0;for(P=54008;P<=54019;P++)ae[P]=0;for(P=54021;P<=54032;P++)ae[P]=0;for(P=54034;P<=54037;P++)ae[P]=0;for(P=54042;P<=54046;P++)ae[P]=0;for(P=54048;P<=54053;P++)ae[P]=0;for(P=54074;P<=54080;P++)ae[P]=0;for(P=54098;P<=54101;P++)ae[P]=0;for(P=102001;P<=102040;P++)ae[P]=0;for(P=102042;P<=102063;P++)ae[P]=0;for(P=102065;P<=102067;P++)ae[P]=0;for(P=102070;P<=102117;P++)ae[P]=0;for(P=102122;P<=102216;P++)ae[P]=0;for(P=102221;P<=102377;P++)ae[P]=0;for(P=102382;P<=102388;P++)ae[P]=0;for(P=102389;P<=102398;P++)ae[P]=2;for(P=102399;P<=102444;P++)ae[P]=0;for(P=102445;P<=102447;P++)ae[P]=2;for(P=102448;P<=102458;P++)ae[P]=0;for(P=102459;P<=102468;P++)ae[P]=2;for(P=102469;P<=102499;P++)ae[P]=0;for(P=102500;P<=102519;P++)ae[P]=1;for(P=102520;P<=102524;P++)ae[P]=0;for(P=102525;P<=102529;P++)ae[P]=2;for(P=102530;P<=102588;P++)ae[P]=0;for(P=102590;P<=102598;P++)ae[P]=0;for(P=102601;P<=102603;P++)ae[P]=0;for(P=102605;P<=102628;P++)ae[P]=0;for(P=102629;P<=102646;P++)ae[P]=2;for(P=102648;P<=102700;P++)ae[P]=2;for(P=102701;P<=102703;P++)ae[P]=0;for(P=102707;P<=102730;P++)ae[P]=2;for(P=102733;P<=102758;P++)ae[P]=2;for(P=102767;P<=102900;P++)ae[P]=0;for(P=102901;P<=102933;P++)ae[P]=2;for(P=102934;P<=102950;P++)ae[P]=13;for(P=102951;P<=102955;P++)ae[P]=0;for(P=102961;P<=102963;P++)ae[P]=0;for(P=102965;P<=102969;P++)ae[P]=0;for(P=102971;P<=102973;P++)ae[P]=0;for(P=102975;P<=102989;P++)ae[P]=0;for(P=102990;P<=102992;P++)ae[P]=1;for(P=102997;P<=103002;P++)ae[P]=0;for(P=103003;P<=103008;P++)ae[P]=2;for(P=103009;P<=103011;P++)ae[P]=0;for(P=103012;P<=103014;P++)ae[P]=2;for(P=103019;P<=103021;P++)ae[P]=0;for(P=103022;P<=103024;P++)ae[P]=2;for(P=103029;P<=103031;P++)ae[P]=0;for(P=103032;P<=103034;P++)ae[P]=2;for(P=103065;P<=103068;P++)ae[P]=0;for(P=103074;P<=103076;P++)ae[P]=0;for(P=103077;P<=103079;P++)ae[P]=1;for(P=103080;P<=103082;P++)ae[P]=0;for(P=103083;P<=103085;P++)ae[P]=2;for(P=103090;P<=103093;P++)ae[P]=0;for(P=103097;P<=103099;P++)ae[P]=0;for(P=103100;P<=103102;P++)ae[P]=2;for(P=103107;P<=103109;P++)ae[P]=0;for(P=103110;P<=103112;P++)ae[P]=2;for(P=103113;P<=103116;P++)ae[P]=0;for(P=103117;P<=103120;P++)ae[P]=2;for(P=103153;P<=103157;P++)ae[P]=0;for(P=103158;P<=103162;P++)ae[P]=2;for(P=103163;P<=103165;P++)ae[P]=0;for(P=103166;P<=103168;P++)ae[P]=1;for(P=103169;P<=103171;P++)ae[P]=2;for(P=103186;P<=103188;P++)ae[P]=0;for(P=103189;P<=103191;P++)ae[P]=2;for(P=103192;P<=103195;P++)ae[P]=0;for(P=103196;P<=103199;P++)ae[P]=2;for(P=103200;P<=103224;P++)ae[P]=0;for(P=103225;P<=103227;P++)ae[P]=1;for(P=103232;P<=103237;P++)ae[P]=0;for(P=103238;P<=103243;P++)ae[P]=2;for(P=103244;P<=103246;P++)ae[P]=0;for(P=103247;P<=103249;P++)ae[P]=2;for(P=103254;P<=103256;P++)ae[P]=0;for(P=103257;P<=103259;P++)ae[P]=2;for(P=103264;P<=103266;P++)ae[P]=0;for(P=103267;P<=103269;P++)ae[P]=2;for(P=103300;P<=103375;P++)ae[P]=0;for(P=103381;P<=103383;P++)ae[P]=0;for(P=103384;P<=103386;P++)ae[P]=1;for(P=103387;P<=103389;P++)ae[P]=0;for(P=103390;P<=103392;P++)ae[P]=2;for(P=103397;P<=103399;P++)ae[P]=0;for(P=103400;P<=103471;P++)ae[P]=2;for(P=103476;P<=103478;P++)ae[P]=0;for(P=103479;P<=103481;P++)ae[P]=2;for(P=103486;P<=103488;P++)ae[P]=0;for(P=103489;P<=103491;P++)ae[P]=2;for(P=103492;P<=103495;P++)ae[P]=0;for(P=103496;P<=103499;P++)ae[P]=2;for(P=103528;P<=103543;P++)ae[P]=0;for(P=103544;P<=103548;P++)ae[P]=2;for(P=103549;P<=103551;P++)ae[P]=0;for(P=103552;P<=103554;P++)ae[P]=1;for(P=103555;P<=103557;P++)ae[P]=2;for(P=103558;P<=103560;P++)ae[P]=0;for(P=103571;P<=103573;P++)ae[P]=0;for(P=103574;P<=103576;P++)ae[P]=2;for(P=103577;P<=103580;P++)ae[P]=0;for(P=103581;P<=103583;P++)ae[P]=2;for(P=103595;P<=103694;P++)ae[P]=0;for(P=103696;P<=103699;P++)ae[P]=0;for(P=103700;P<=103793;P++)ae[P]=2;for(P=103794;P<=103890;P++)ae[P]=0;for(P=103891;P<=103896;P++)ae[P]=2;for(P=103900;P<=103971;P++)ae[P]=2;for(P=103972;P<=103977;P++)ae[P]=0;for(P=112e3;P<=112101;P++)ae[P]=0;const _Ke={102113:!0,102100:!0,3857:!0,3785:!0},bKe={4326:!0,3785:!0,3857:!0,102113:!0,102100:!0,104905:!0,104971:!0},Fde='PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]',z6=[-20037508342788905e-9,20037508342788905e-9],U6=[-20037508342787e-6,20037508342787e-6],LCe={102113:{wkTemplate:'PROJCS["WGS_1984_Web_Mercator",GEOGCS["GCS_WGS_1984_Major_Auxiliary_Sphere",DATUM["D_WGS_1984_Major_Auxiliary_Sphere",SPHEROID["WGS_1984_Major_Auxiliary_Sphere",6378137.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]',valid:z6,origin:U6,dx:1e-5},102100:{wkTemplate:Fde,valid:z6,origin:U6,dx:1e-5},3785:{wkTemplate:'PROJCS["WGS_1984_Web_Mercator",GEOGCS["GCS_WGS_1984_Major_Auxiliary_Sphere",DATUM["D_WGS_1984_Major_Auxiliary_Sphere",SPHEROID["WGS_1984_Major_Auxiliary_Sphere",6378137.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]',valid:z6,origin:U6,dx:1e-5},3857:{wkTemplate:Fde,valid:z6,origin:U6,dx:1e-5},4326:{wkTemplate:'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",{Central_Meridian}],UNIT["Degree",0.0174532925199433]]',altTemplate:'PROJCS["WGS_1984_Plate_Carree",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Plate_Carree"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],UNIT["Degrees",111319.491]]',valid:[-180,180],origin:[-180,90],dx:1e-5},104971:{wkTemplate:'GEOGCS["Mars_2000_(Sphere)",DATUM["Mars_2000_(Sphere)",SPHEROID["Mars_2000_(Sphere)",3396190.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]',valid:[-180,180],origin:[-180,90],dx:1e-5},104905:{wkTemplate:'GEOGCS["GCS_Mars_2000",DATUM["D_Mars_2000",SPHEROID["Mars_2000_IAU_IAG",3396190.0,169.8944472236118]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]',valid:[-180,180],origin:[-180,90],dx:1e-5}};function Zn(t,e){if(t===e)return!0;if(t==null||e==null)return!1;if(t.wkid!=null||e.wkid!=null)return t.wkid===e.wkid||LT(t)&<(e)||e.latestWkid!=null&&t.wkid===e.latestWkid||t.latestWkid!=null&&e.wkid===t.latestWkid;const i=t.wkt2??t.wkt,r=e.wkt2??e.wkt;return!(!i||!r)&&i.toUpperCase()===r.toUpperCase()}function pp(t){return wc(t)&&t.wkid&&LCe[t.wkid]||null}function Cz(t){if(!t)return;if(t.wkid)return String(t.wkid);const e=t.wkt||t.wkt2;return JSON.stringify(e?{wkt:e}:{})}function uB(t){if(!wc(t))return!1;if(t.wkid)return ae[t.wkid]==null;const e=t.wkt2||t.wkt;return!!e&&/^\s*(?:GEOGCS|GEOGCRS|GEOGRAPHICCRS)/i.test(e)}function VO(t){return!(r1(t)||n1(t))}function cL(t){return wc(t)&&t.wkid===4326}function PXt(t){return/^\s*(?:GEOD|GEODETIC|GEOG|GEOGRAPHIC|PROJ|PROJECTED|VERT|VERTICAL|ENG|ENGINEERING|PARAMETRIC|TIME|DERIVEDPROJ|COMPOUND|BOUND)CRS/i.test(t)}function DCe(t){return wc(t)&&t.wkid===wf.CGCS2000}function LT(t){return wc(t)&&t.wkid!=null&&_Ke[t.wkid]===!0}function uL(t){return wc(t)&&t.wkid===32662}function Gne(t){return t===wf.GCSMARS2000||t===wf.GCSMARS2000_SPHERE}function r1(t){return wc(t)&&t.wkid!=null&&Gne(t.wkid)}function Hne(t){return t===wf.GCSMOON2000}function n1(t){return wc(t)&&t.wkid!=null&&Hne(t.wkid)}function wKe(t){return wc(t)&&t.wkid!=null&&bKe[t.wkid]===!0}function wc(t){return t!=null&&(t.wkid!=null&&t.wkid>=2e3||t.wkt2!=null||t.wkt!=null)}const xKe={wkid:4326,wkt:h9(LCe[4326].wkTemplate,{Central_Meridian:"0.0"})},SKe={wkid:102100,latestWkid:3857},TKe={wkid:32662};function qne(t){return{wkt:`GEOCCS["Spherical geocentric", +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const s of n)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function i(n){const s={};return n.integrity&&(s.integrity=n.integrity),n.referrerPolicy&&(s.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?s.credentials="include":n.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(n){if(n.ep)return;n.ep=!0;const s=i(n);fetch(n.href,s)}})();function y(t,e,i,r){var n,s=arguments.length,o=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,i):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(o=(s<3?n(o):s>3?n(e,i,o):n(e,i))||o);return s>3&&o&&Object.defineProperty(e,i,o),o}function DXt(t,e,i,r){function n(s){return s instanceof i?s:new i(function(o){o(s)})}return new(i||(i=Promise))(function(s,o){function a(_){try{p(r.next(_))}catch(x){o(x)}}function c(_){try{p(r.throw(_))}catch(x){o(x)}}function p(_){_.done?s(_.value):n(_.value).then(a,c)}p((r=r.apply(t,e||[])).next())})}let t2;function $e(t){return typeof t2[t]=="function"?t2[t]=t2[t](globalThis):t2[t]}var iSe,rSe,nSe,sSe;t2=(iSe=globalThis.dojoConfig)!=null&&iSe.has||(rSe=globalThis.esriConfig)!=null&&rSe.has?{...(nSe=globalThis.dojoConfig)==null?void 0:nSe.has,...(sSe=globalThis.esriConfig)==null?void 0:sSe.has}:{},$e.add=(t,e,i,r)=>((r||t2[t]===void 0)&&(t2[t]=e),i&&$e(t)),$e.cache=t2,$e.add("big-integer-warning-enabled",!0),$e.add("esri-deprecation-warnings",!0),$e.add("esri-tests-disable-screenshots",!1),$e.add("esri-tests-use-full-window",!1),$e.add("esri-tests-post-to-influx",!0),(()=>{var e;$e.add("host-webworker",globalThis.WorkerGlobalScope!==void 0&&self instanceof globalThis.WorkerGlobalScope);const t=typeof window<"u"&&typeof location<"u"&&typeof document<"u"&&window.location===location&&window.document===document;if($e.add("host-browser",t),$e.add("host-node",typeof globalThis.process=="object"&&((e=globalThis.process.versions)==null?void 0:e.node)&&globalThis.process.versions.v8),$e.add("dom",t),$e("host-browser")){const i=navigator,r=i.userAgent,n=i.appVersion,s=parseFloat(n);if($e.add("wp",parseFloat(r.split("Windows Phone")[1])||void 0),$e.add("msapp",parseFloat(r.split("MSAppHost/")[1])||void 0),$e.add("khtml",n.includes("Konqueror")?s:void 0),$e.add("edge",parseFloat(r.split("Edge/")[1])||void 0),$e.add("opr",parseFloat(r.split("OPR/")[1])||void 0),$e.add("webkit",!$e("wp")&&!$e("edge")&&parseFloat(r.split("WebKit/")[1])||void 0),$e.add("chrome",!$e("edge")&&!$e("opr")&&parseFloat(r.split("Chrome/")[1])||void 0),$e.add("android",!$e("wp")&&parseFloat(r.split("Android ")[1])||void 0),$e.add("safari",!n.includes("Safari")||$e("wp")||$e("chrome")||$e("android")||$e("edge")||$e("opr")?void 0:parseFloat(n.split("Version/")[1])),$e.add("mac",n.includes("Macintosh")),!$e("wp")&&/(iPhone|iPod|iPad)/.test(r)){const o=RegExp.$1.replace(/P/,"p"),a=/OS ([\d_]+)/.test(r)?RegExp.$1:"1",c=parseFloat(a.replace(/_/,".").replaceAll("_",""));$e.add(o,c),$e.add("ios",c)}$e("webkit")||(!r.includes("Gecko")||$e("wp")||$e("khtml")||$e("edge")||$e.add("mozilla",s),$e("mozilla")&&$e.add("ff",parseFloat(r.split("Firefox/")[1]||r.split("Minefield/")[1])||void 0))}})(),(()=>{if(globalThis.navigator){const t=navigator.userAgent,e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(t),i=/iPhone/i.test(t);e&&$e.add("esri-mobile",e),i&&$e.add("esri-iPhone",i),$e.add("esri-geolocation",!!navigator.geolocation)}$e.add("esri-wasm","WebAssembly"in globalThis),$e.add("esri-performance-mode-frames-between-render",20),$e.add("esri-force-performance-mode",!1),$e.add("esri-shared-array-buffer",()=>{const t="SharedArrayBuffer"in globalThis,e=globalThis.crossOriginIsolated===!1;return t&&!e}),$e.add("wasm-simd",()=>{const t=[0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11];return WebAssembly.validate(new Uint8Array(t))}),$e.add("esri-atomics","Atomics"in globalThis),$e.add("esri-workers","Worker"in globalThis),$e.add("web-feat:cache","caches"in globalThis),$e.add("esri-workers-arraybuffer-transfer",!$e("safari")||Number($e("safari"))>=12),$e.add("workers-pool-size",8),$e.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),$e.add("featurelayer-simplify-payload-size-factors",[1,1,4]),$e.add("featurelayer-animation-enabled",!0),$e.add("featurelayer-snapshot-enabled",!0),$e.add("featurelayer-snapshot-point-min-threshold",8e4),$e.add("featurelayer-snapshot-point-max-threshold",4e5),$e.add("featurelayer-snapshot-point-coverage",.1),$e.add("featurelayer-advanced-symbols",!1),$e.add("featurelayer-pbf",!0),$e.add("featurelayer-pbf-statistics",!1),$e.add("feature-layers-workers",!0),$e.add("feature-polyline-generalization-factor",1),$e.add("mapview-transitions-duration",200),$e.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),$e.add("mapserver-pbf-version-support",10.81),$e.add("mapservice-popup-identify-max-tolerance",20),$e.add("heatmap-allow-raster-fallback",!1),$e.add("heatmap-force-raster",!1),$e("host-webworker")||$e("host-browser")&&($e.add("esri-csp-restrictions",()=>{try{new Function}catch{return!0}return!1}),$e.add("esri-image-decode",()=>{if("decode"in new Image){const t=new Image;return t.src='data:image/svg+xml;charset=UTF-8,',void t.decode().then(()=>{$e.add("esri-image-decode",!0,!0,!0)}).catch(()=>{$e.add("esri-image-decode",!1,!0,!0)})}return!1}),$e.add("esri-url-encodes-apostrophe",()=>{const t=window.document.createElement("a");return t.href="?'",t.href.includes("?%27")}))})();const mhe=new Set;function nGe(t,e,i=!1){i&&mhe.has(e)||(i&&mhe.add(e),t.warn(`🛑 DEPRECATED - ${e}`))}function uSe(t,e,i={}){if($e("esri-deprecation-warnings")){const{moduleName:r}=i;GO(t,`Function: ${(r?r+"::":"")+e+"()"}`,i)}}function gm(t,e,i={}){if($e("esri-deprecation-warnings")){const{moduleName:r}=i;GO(t,`Property: ${(r?r+"::":"")+e}`,i)}}function GO(t,e,i={}){if($e("esri-deprecation-warnings")){const{replacement:r,version:n,see:s,warnOnce:o}=i;let a=e;r&&(a+=` + 🛠️ Replacement: ${r}`),n&&(a+=` + ⚙️ Version: ${n}`),s&&(a+=` + 🔗 See ${s} for more details.`),nGe(t,a,o)}}function NXt(t){const e=[];return function*(){yield*e;for(const i of t)e.push(i),yield i}}function sGe(t,e){for(const i of t)if(i!=null&&e(i))return i}function eZ(t){return t!=null&&typeof t[Symbol.iterator]=="function"}let N_=class tZ{constructor(){this._groups=new Map}destroy(){this.removeAll()}get size(){let e=0;return this._groups.forEach(i=>{e+=i.length}),e}add(e,i){if(eZ(e)){const r=this._getOrCreateGroup(i);for(const n of e)this._isHandle(n)&&r.push(n)}else this._isHandle(e)&&this._getOrCreateGroup(i).push(e);return this}forEach(e,i){if(typeof e=="function")this._groups.forEach(r=>r.forEach(e));else{const r=this._getGroup(e);r&&i&&r.forEach(i)}}has(e){return this._groups.has(this._ensureGroupKey(e))}remove(e){if(typeof e!="string"&&eZ(e)){for(const i of e)this.remove(i);return this}return this.has(e)?(this._removeAllFromGroup(this._getGroup(e)),this._groups.delete(this._ensureGroupKey(e)),this):this}removeAll(){return this._groups.forEach(e=>this._removeAllFromGroup(e)),this._groups.clear(),this}_isHandle(e){return e&&(!!e.remove||e instanceof tZ)}_getOrCreateGroup(e){if(this.has(e))return this._getGroup(e);const i=[];return this._groups.set(this._ensureGroupKey(e),i),i}_getGroup(e){return this._groups.get(this._ensureGroupKey(e))}_ensureGroupKey(e){return e||"_default_"}_removeAllFromGroup(e){for(const i of e)i instanceof tZ?i.removeAll():i.remove()}},Z4=class g3{constructor(e=1){this._seed=e}set seed(e){this._seed=e??Math.random()*g3._m}getInt(){return this._seed=(g3._a*this._seed+g3._c)%g3._m,this._seed}getFloat(){return this.getInt()/(g3._m-1)}getIntRange(e,i){return Math.round(this.getFloatRange(e,i))}getFloatRange(e,i){const r=i-e;return e+this.getInt()/g3._m*r}};Z4._m=2147483647,Z4._a=48271,Z4._c=0;const KV=1.5,oGe=1/KV,aGe=.5;function lGe(t){if(!t)return;const e=t.length;return e>0?t[e-1]:void 0}function hSe(t){return t}function cGe(t,e=hSe){if(!t||t.length===0)return;let i=t[0],r=e(i);for(let n=1;nr&&(r=o,i=s)}return i}function dSe(t,e=hSe){return cGe(t,i=>-e(i))}function _9(t,e){return e?t.filter((i,r,n)=>n.findIndex(e.bind(null,i))===r):Array.from(new Set(t))}function jy(t,e,i){if(t==null&&e==null)return!0;if(t==null||e==null||t.length!==e.length)return!1;if(i){for(let r=0;r!t.some(o=>i(o,s))),n=t.filter(s=>!e.some(o=>i(o,s)))):(r=e.filter(s=>!t.includes(s)),n=t.filter(s=>!e.includes(s))),{added:r,removed:n}}function hGe(t){return t&&typeof t.length=="number"}function pSe(t,e){const i=t.length;if(i===0)return[];const r=[];for(let n=0;nt[a]?n=a+1:s=a}const o=t[n];return i?e>=t[r-1]?-1:o===e?n:n-1:o===e?n:-1}function mGe(t,e,i){if(!t||t.length===0)return;const r=t.length-1,n=t[0];if(e<=i(n))return n;const s=t[r];if(e>=i(s))return s;let o=0,a=0,c=r;for(;o0){const x=t[a-1],S=i(x);if(e>S)return e-S>=_-e?p:x}c=a}else{if(a=S-e?x:p}o=a+1}}return t[a]}let mSe=class{constructor(){this.last=0}};const gSe=new mSe;function iZ(t,e,i,r){r=r||gSe;const n=Math.max(0,r.last-10);for(let o=n;oghe.getFloat()):Math.random}function kXt(t,e){const i=vGe(e);for(let r=t.length-1;r>0;r--){const n=Math.floor(i()*(r+1)),s=t[r];t[r]=t[n],t[n]=s}return t}const ghe=new Z4;function cne(t,e){const i=t.indexOf(e);return i!==-1?(t.splice(i,1),e):null}function zXt(t,e){const i=new Map,r=t.length;for(let n=0;ne+(i?Gf(i)?wGe(i,une()):i.byteLength+TSe:0),0)}const TSe=145,nd=1024;function xGe(t){return i5(t)||t5(t)||tB(t)||QV(t)||hne(t)}function SGe(t){return i5(t)||t5(t)}function TGe(t){return i5(t)?179769e303:t5(t)?3402823e32:iB(t)?4294967295:eB(t)?65535:i2(t)||SSe(t)?255:tB(t)?2147483647:QV(t)?32767:hne(t)?127:256}function ESe(t,e){let i;if(e)for(i in t)t.hasOwnProperty(i)&&(t[i]===void 0?delete t[i]:t[i]instanceof Object&&ESe(t[i],!0));else for(i in t)t.hasOwnProperty(i)&&t[i]===void 0&&delete t[i];return t}function Pe(t){if(!t||typeof t!="object"||typeof t=="function")return t;const e=MSe(t);if(e!=null)return e;if(Kk(t))return t.clone();if(CSe(t))return t.map(Pe);if(ASe(t))return t.clone();const i={};for(const r of Object.getOwnPropertyNames(t))i[r]=Pe(t[r]);return i}function rZ(t){if(!t||typeof t!="object"||typeof t=="function"||"HTMLElement"in globalThis&&t instanceof HTMLElement)return t;const e=MSe(t);if(e!=null)return e;if(CSe(t)){let i=!0;const r=t.map(n=>{const s=rZ(n);return n!=null&&s==null&&(i=!1),s});return i?r:null}if(Kk(t))return t.clone();if(t instanceof File||t instanceof Blob)return t;if(!ASe(t)){const i=new(Object.getPrototypeOf(t)).constructor;for(const r of Object.getOwnPropertyNames(t)){const n=t[r],s=rZ(n);if(n!=null&&s==null)return null;i[r]=s}return i}return null}function Kk(t){return typeof t.clone=="function"}function CSe(t){return typeof t.map=="function"&&typeof t.forEach=="function"}function ASe(t){return typeof t.notifyChange=="function"&&typeof t.watch=="function"}function yhe(t){if(Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function MSe(t){if(hne(t)||i2(t)||SSe(t)||QV(t)||eB(t)||tB(t)||iB(t)||t5(t)||i5(t))return t.slice();if(t instanceof Date)return new Date(t.getTime());if(t instanceof ArrayBuffer)return t.slice(0,t.byteLength);if(t instanceof Map){const e=new Map;for(const[i,r]of t)e.set(i,Pe(r));return e}if(t instanceof Set){const e=new Set;for(const i of t)e.add(Pe(i));return e}return null}function dne(t,e){return t===e||typeof t=="number"&&isNaN(t)&&typeof e=="number"&&isNaN(e)||typeof(t==null?void 0:t.getTime)=="function"&&typeof(e==null?void 0:e.getTime)=="function"&&t.getTime()===e.getTime()||!1}function OSe(t,e){return t===e||(t==null||typeof t=="string"?t===e:typeof t=="number"?t===e||typeof e=="number"&&isNaN(t)&&isNaN(e):t instanceof Date?e instanceof Date&&t.getTime()===e.getTime():Array.isArray(t)?Array.isArray(e)&&jy(t,e):t instanceof Set?e instanceof Set&&CGe(t,e):t instanceof Map?e instanceof Map&&AGe(t,e):!!yhe(t)&&yhe(e)&&EGe(t,e))}function EGe(t,e){if(t===null||e===null)return!1;const i=Object.keys(t);if(e===null||Object.keys(e).length!==i.length)return!1;for(const r of i)if(t[r]!==e[r]||!Object.prototype.hasOwnProperty.call(e,r))return!1;return!0}function CGe(t,e){if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}function AGe(t,e){if(t.size!==e.size)return!1;for(const[i,r]of t){const n=e.get(i);if(n!==r||n===void 0&&!e.has(i))return!1}return!0}function pne(t,e,i=!1){return RSe(t,e,i)}function b9(t,e){if(e!=null)return e[t]||PSe(t.split("."),!1,e)}function hE(t,e,i){const r=t.split("."),n=r.pop(),s=PSe(r,!0,i);s&&n&&(s[n]=e)}function PSe(t,e,i){let r=i;for(const n of t){if(r==null)return;if(!(n in r)){if(!e)return;r[n]={}}r=r[n]}return r}function RSe(t,e,i){return e?Object.keys(e).reduce((r,n)=>{let s=r[n],o=e[n];return s===o?r:s===void 0?(r[n]=Pe(o),r):(Array.isArray(o)||Array.isArray(r)?(s=s?Array.isArray(s)?r[n]=s.concat():r[n]=[s]:r[n]=[],o&&(Array.isArray(o)||(o=[o]),i?o.forEach(a=>{s.includes(a)||s.push(a)}):r[n]=o.concat())):o&&typeof o=="object"?r[n]=RSe(s,o,i):r.hasOwnProperty(n)&&!e.hasOwnProperty(n)||(r[n]=o),r)},t||{}):t}var oSe;const Mr={apiKey:void 0,applicationName:"",applicationUrl:(oSe=globalThis.location)==null?void 0:oSe.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(pne(Mr,globalThis.esriConfig,!0),delete Mr.has),!Mr.assetsPath){{const t="4.28";Mr.assetsPath=`https://js.arcgis.com/${t}/@arcgis/core/assets`}Mr.defaultAssetsPath=Mr.assetsPath}const MGe=/\{([^\}]+)\}/g;function vhe(t){return t??""}function w9(t,e){return e?t.replaceAll(MGe,typeof e=="object"?(i,r)=>vhe(b9(r,e)):(i,r)=>vhe(e(r))):t}function fne(t,e){return t.replaceAll(/([\.$?*|{}\(\)\[\]\\\/\+\-^])/g,i=>e&&e.includes(i)?i:`\\${i}`)}function mne(t){let e=0;for(let i=0;ie._loggedMessages.warn.clear()}}static get test(){return{resetLoggers(e=new Map){const i=qc._loggers;return qc._loggers=e,i},set throttlingDisabled(e){qc._throttlingDisabled=e}}}static getLogger(e){return e=typeof e!="string"?e.declaredClass:e,qc._loggers.get(e)||new qc({module:e})}_log(e,i,...r){if(this._matchLevel(e)){if(i!=="always"&&!qc._throttlingDisabled){const n=this._argsToKey(r),s=this._loggedMessages[e].get(n);if(i==="once"&&s!=null||i==="oncePerTick"&&s&&s>=qc._tickCounter)return;this._loggedMessages[e].set(n,qc._tickCounter),qc._scheduleTickCounterIncrement()}for(const n of Mr.log.interceptors)if(n(e,this.module,...r))return;this._inheritedWriter()(e,this.module,...r)}}_parentWithMember(e,i){let r=this;for(;r!=null;){const n=r[e];if(n!=null)return n;r=r.parent}return i}_inheritedWriter(){return this._parentWithMember("writer",this._consoleWriter)}_consoleWriter(e,i,...r){console[e](`[${i}]`,...r)}_matchLevel(e){const i=Mr.log.level||"warn";return _he[this._parentWithMember("level",i)]<=_he[e]}_argsToKey(...e){return mne(JSON.stringify(e,(r,n)=>typeof n!="object"||Array.isArray(n)?n:"[Object]"))}static _scheduleTickCounterIncrement(){qc._tickCounterScheduled||(qc._tickCounterScheduled=!0,Promise.resolve().then(()=>{qc._tickCounter++,qc._tickCounterScheduled=!1}))}};Ce._loggers=new Map,Ce._tickCounter=0,Ce._tickCounterScheduled=!1,Ce._throttlingDisabled=!1;function Gy(t,e){if(t==null)throw new Error(e??"value is None")}function et(t){return t==null||t.destroy(),null}function Kt(t){return t==null||t.dispose(),null}function en(t){return t==null||t.remove(),null}function vn(t){return t==null||t.abort(),null}function ir(t){return t==null||t.release(),null}function HO(t,e,i){return t!=null&&e!=null?i!=null?i(t,e):t.equals(e):t===e}function bhe(t,e){return t==null?void 0:t[e]}function PGe(t,e){let i;return t.some((r,n)=>(i=e(r,n),i!=null)),i??void 0}const ISe=Symbol("Accessor-beforeDestroy"),RGe={remove:()=>{}};function rr(t){return t?{remove(){t&&(t(),t=void 0)}}:RGe}function IGe(t){t.forEach(e=>e==null?void 0:e.remove())}function sd(t){return rr(()=>IGe(t))}function VXt(t){return rr(()=>{var e;return(e=t())==null?void 0:e.remove()})}function gne(t){return rr(t!=null?()=>t.destroy():void 0)}function Kl(t){return t.__accessor__??null}function $Ge(t,e){var i;return((i=t==null?void 0:t.metadatas)==null?void 0:i[e])!=null}function _7(t,e,i){return i?Qk(t,e,{policy:i,path:""}):Qk(t,e,null)}function Qk(t,e,i){return e?Object.keys(e).reduce((r,n)=>{const s=n;let o=null,a="merge";if(i&&(o=i.path?`${i.path}.${n}`:n,a=i.policy(o)),a==="replace"||a==="replace-arrays"&&Array.isArray(r[s]))return r[s]=e[s],r;if(r[s]===void 0)return r[s]=Pe(e[s]),r;let c=r[s],p=e[s];if(c===p)return r;if(Array.isArray(p)||Array.isArray(r))c=c?Array.isArray(c)?r[s]=c.concat():r[s]=[c]:r[s]=[],p&&(Array.isArray(p)||(p=[p]),p.forEach(_=>{c.includes(_)||c.push(_)}));else if(p&&typeof p=="object")if(i){const _=i.path;i.path=o,r[s]=Qk(c,p,i),i.path=_}else r[s]=Qk(c,p,null);else r.hasOwnProperty(n)&&!e.hasOwnProperty(n)||(r[s]=p);return r},t||{}):t}function $Se(t){return Array.isArray(t)?t:t.split(".")}function whe(t){return t.includes(",")?t.split(",").map(e=>e.trim()):[t.trim()]}function LGe(t){if(Array.isArray(t)){const e=[];for(const i of t)e.push(...whe(i));return e}return whe(t)}function LSe(t,e,i,r){const n=LGe(e);if(n.length!==1){const s=n.map(o=>r(t,o,i));return sd(s)}return r(t,n[0],i)}function DSe(t,e){const i=t[t.length-1]==="?"?t.slice(0,-1):t;if(e.getItemAt!=null||Array.isArray(e)){const n=parseInt(i,10);if(!isNaN(n))return Array.isArray(e)?e[n]:e.at(n)}const r=Kl(e);return $Ge(r,i)?r.get(i):e[i]}function NSe(t,e,i){if(t==null)return t;const r=DSe(e[i],t);return!r&&i=this._pool.length)){for(let i=e;i0){if(!(n+r{},onTrackingEnd:()=>{}},aI=[];let J4=tz;function wi(t){J4.onObservableAccessed(t)}let b7=!1,w7=!1;function g_(t,e,i){if(b7)return yne(t,e,i);kSe(t);const r=e.call(i);return zSe(),r}function jGe(t,e){return g_(tz,t,e)}function yne(t,e,i){const r=b7;b7=!0,kSe(t);let n=null;try{n=e.call(i)}catch(s){w7&&Ce.getLogger("esri.core.accessorSupport.tracking").error(s)}return zSe(),b7=r,n}function kSe(t){J4=t,aI.push(t)}function zSe(){const t=aI.length;if(t>1){const e=aI.pop();J4=aI[t-2],e.onTrackingEnd()}else if(t===1){const e=aI.pop();J4=tz,e.onTrackingEnd()}else J4=tz}function USe(t,e){if(e.flags&Wn.DepTrackingInitialized)return;const i=w7;w7=!1,e.flags&Wn.AutoTracked?yne(e,e.metadata.get,t):VSe(t,e),w7=i}const GGe=[];function VSe(t,e){e.flags&Wn.ExplicitlyTracking||(e.flags|=Wn.ExplicitlyTracking,yne(e,()=>{const i=e.metadata.dependsOn||GGe;for(const r of i)if(typeof r!="string"||r.includes(".")){const n=$Se(r);for(let s=0,o=t;s0)for(const i of e)i.onInvalidated()}onCommitted(){const e=this._observers;if(e&&e.length>0){const i=e.slice();for(const r of i)r.onCommitted()}}},HGe=class BSe{constructor(){this._values=new Map,this.multipleOriginsSupported=!1}clone(e){const i=new BSe;return this._values.forEach((r,n)=>{e&&e.has(n)||i.set(n,Pe(r))}),i}get(e){return this._values.get(e)}originOf(){return Di.USER}keys(){return[...this._values.keys()]}set(e,i){this._values.set(e,i)}delete(e){this._values.delete(e)}has(e){return this._values.has(e)}forEach(e){this._values.forEach(e)}};function I6(t,e,i){return t!==void 0}function Ehe(t,e,i,r){return t!==void 0&&(!(i==null&&t.flags&Wn.NonNullable)||(r.lifecycle,Bv.INITIALIZING,!1))}function qGe(t){return t&&typeof t.destroy=="function"}Ce.getLogger("esri.core.accessorSupport.Properties");let WGe=class{constructor(e){this.host=e,this.propertiesByName=new Map,this.ctorArgs=null,this.destroyed=!1,this.lifecycle=Bv.INITIALIZING,this.store=new HGe,this._origin=Di.USER;const i=this.host.constructor.__accessorMetadata__;for(const r in i){const n=new The(r,i[r]);this.propertiesByName.set(r,n)}this.metadatas=i}initialize(){this.lifecycle=Bv.CONSTRUCTING}constructed(){this.lifecycle=Bv.CONSTRUCTED}destroy(){this.destroyed=!0;for(const[e,i]of this.propertiesByName){if(i.metadata.autoDestroy){const r=this.internalGet(e);r&&qGe(r)&&(r.destroy(),~i.flags&Wn.NonNullable&&this._internalSet(i,null))}i.destroy()}}get initialized(){return this.lifecycle!==Bv.INITIALIZING}get(e){const i=this.propertiesByName.get(e);if(i.metadata.get)return i.getComputed(this);wi(i);const r=this.store;return r.has(e)?r.get(e):i.metadata.value}originOf(e){const i=this.store.originOf(e);if(i===void 0){const r=this.propertiesByName.get(e);if(r!==void 0&&r.flags&Wn.HasDefaultValue)return"defaults"}return ez(i)}has(e){return!!this.propertiesByName.has(e)&&this.store.has(e)}keys(){return[...this.propertiesByName.keys()]}internalGet(e){const i=this.propertiesByName.get(e);if(I6(i))return this.store.has(e)?this.store.get(e):i.metadata.value}internalSet(e,i){const r=this.propertiesByName.get(e);I6(r)&&this._internalSet(r,i)}getDependsInfo(e,i,r){const n=this.propertiesByName.get(i);if(!I6(n))return"";const s=new Set,o=g_({onObservableAccessed:c=>s.add(c),onTrackingEnd:()=>{}},()=>{var c;return(c=n.metadata.get)==null?void 0:c.call(e)});let a=`${r}${e.declaredClass.split(".").pop()}.${i}: ${o} +`;if(s.size===0)return a;r+=" ";for(const c of s)c instanceof The&&(a+=`${r}${c.propertyName}: undefined +`);return a}setAtOrigin(e,i,r){const n=this.propertiesByName.get(e);if(I6(n))return this._setAtOrigin(n,i,r)}isOverridden(e){const i=this.propertiesByName.get(e);return i!==void 0&&!!(i.flags&Wn.Overriden)}clearOverride(e){const i=this.propertiesByName.get(e);i&&i.flags&Wn.Overriden&&(i.flags&=~Wn.Overriden,i.notifyChange())}override(e,i){const r=this.propertiesByName.get(e);if(!Ehe(r,e,i,this))return;const n=r.metadata.cast;if(n){const s=this._cast(n,i),{valid:o,value:a}=s;if(aH.release(s),!o)return;i=a}r.flags|=Wn.Overriden,this._internalSet(r,i)}set(e,i){const r=this.propertiesByName.get(e);if(!Ehe(r,e,i,this))return;const n=r.metadata.cast;if(n){const o=this._cast(n,i),{valid:a,value:c}=o;if(aH.release(o),!a)return;i=c}const s=r.metadata.set;s?s.call(this.host,i):this._internalSet(r,i)}setDefaultOrigin(e){this._origin=qv(e)}getDefaultOrigin(){return ez(this._origin)}notifyChange(e){const i=this.propertiesByName.get(e);i!==void 0&&i.notifyChange()}invalidate(e){const i=this.propertiesByName.get(e);i!==void 0&&i.invalidate()}commit(e){const i=this.propertiesByName.get(e);i!==void 0&&i.commit()}_internalSet(e,i){const r=this.lifecycle!==Bv.INITIALIZING?this._origin:Di.DEFAULTS;this._setAtOrigin(e,i,r)}_setAtOrigin(e,i,r){const n=this.store,s=e.propertyName;n.has(s,r)&&dne(i,n.get(s))&&~e.flags&Wn.Overriden&&r===n.originOf(s)||(e.invalidate(),n.set(s,i,r),e.commit(),USe(this.host,e))}_cast(e,i){const r=aH.acquire();return r.valid=!0,r.value=i,e&&(r.value=e.call(this.host,i,r)),r}},YGe=class{constructor(){this.value=null,this.valid=!0}acquire(){this.valid=!0}release(){this.value=null}};const aH=new Ql(YGe);function XGe(t,e){return t.replaceAll(/\$\{([^\s\:\}]*)(?:\:([^\s\:\}]+))?\}/g,(i,r)=>r===""?"$":(b9(r,e)??"").toString())}let jSe=class{constructor(e,i,r){this.name=e,this.details=r,this.message=(i&&XGe(i,r))??""}toString(){return"["+this.name+"]: "+this.message}},se=class GSe extends jSe{constructor(e,i,r){super(e,i,r)}toJSON(){if(this.details!=null)try{return{name:this.name,message:this.message,details:JSON.parse(JSON.stringify(this.details,(e,i)=>{if(i&&typeof i=="object"&&typeof i.toJSON=="function")return i;try{return Pe(i)}catch{return"[object]"}}))}}catch(e){throw Ce.getLogger("esri.core.Error").error(e),e}return{name:this.name,message:this.message,details:this.details}}static fromJSON(e){return new GSe(e.name,e.message,e.details)}};se.prototype.type="error";function iz(t,e,i){if(t&&e)if(typeof e=="object")for(const r of Object.getOwnPropertyNames(e))iz(t,r,e[r]);else{if(e.includes(".")){const n=e.split("."),s=n.splice(-1,1)[0];return void iz(uu(t,n),s,i)}const r=t.__accessor__;r!=null&&ZGe(e,r),t[e]=i}}function ZGe(t,e){if($e("esri-unknown-property-errors")&&!JGe(t,e))throw new se("set:unknown-property",KGe(t,e))}function JGe(t,e){return e.metadatas[t]!=null}function KGe(t,e){return"setting unknown property '"+t+"' on instance of "+e.host.declaredClass}let QGe;function eHe(){return QGe}var Che;(function(t){t[t.Ignore=0]="Ignore",t[t.Destroy=1]="Destroy",t[t.ThrowError=2]="ThrowError"})(Che||(Che={}));function tHe(t){t.length=0}let jh=class{constructor(e=50,i=50){this._pool=new Ql(Array,void 0,tHe,i,e)}acquire(){return this._pool.acquire()}release(e){this._pool.release(e)}prune(){this._pool.prune(0)}static acquire(){return lH.acquire()}static release(e){return lH.release(e)}static prune(){lH.prune()}};const lH=new jh(100);let HSe=class extends Ql{constructor(){super(...arguments),this._set=new Set}destroy(){super.destroy(),this._set=null}acquire(...e){const i=super.acquire(...e);return this._set.delete(i),i}release(e){e&&!this._set.has(e)&&(super.release(e),this._set.add(e))}_dispose(e){this._set.delete(e),super._dispose(e)}};const $6=[];function qO(t){$6.push(t),$6.length===1&&queueMicrotask(()=>{const e=$6.slice();$6.length=0;for(const i of e)i()})}let Wv=class{constructor(e,i=30){this.name=e,this._counter=0,this._samples=new Array(i)}record(e){e!=null&&(this._samples[++this._counter%this._samples.length]=e)}get median(){return this._samples.slice().sort((e,i)=>e-i)[Math.floor(this._samples.length/2)]}get average(){return this._samples.reduce((e,i)=>e+i,0)/this._samples.length}get last(){return this._samples[this._counter%this._samples.length]}};var oZ;(function(t){const e=(s,o,a,c)=>{let p=o,_=o;const x=a>>>1,S=s[p-1];for(;_<=x;){_=p<<1,_so?1:0;function r(s,o,a,c){o===void 0&&(o=0),a===void 0&&(a=s.length),c===void 0&&(c=i);for(let _=a>>>1;_>o;_--)e(s,_,a,c);const p=o+1;for(let _=a-1;_>o;_--){const x=s[o];s[o]=s[_],s[_]=x,e(s,p,_,c)}}function*n(s,o,a,c){o===void 0&&(o=0),a===void 0&&(a=s.length),c===void 0&&(c=i);for(let _=a>>>1;_>o;_--)e(s,_,a,c),yield;const p=o+1;for(let _=a-1;_>o;_--){const x=s[o];s[o]=s[_],s[_]=x,e(s,p,_,c),yield}}t.sort=r,t.iterableSort=n})(oZ||(oZ={}));const Ahe=oZ,iHe=1.5,rHe=1.1;let Pi=class{constructor(e){this.data=[],this._length=0,this._allocator=void 0,this._deallocator=()=>null,this._shrink=()=>{},this._hint=new mSe,e&&(e.initialSize&&(this.data=new Array(e.initialSize)),e.allocator&&(this._allocator=e.allocator),e.deallocator!==void 0&&(this._deallocator=e.deallocator),e.shrink&&(this._shrink=()=>Mhe(this)))}toArray(){return this.data.slice(0,this.length)}filter(e){const i=new Array;for(let r=0;r=this._length))return this.data[e]}includes(e,i){const r=this.data.indexOf(e,i);return r!==-1&&rthis._length){if(this._allocator){for(;this._length=this.length||e<0))return this.swapElements(e,this.length-1),this.pop()}removeUnorderedMany(e,i=e.length,r){this.length=gGe(this.data,e,this.length,i,this._hint,r),this._shrink()}front(){if(this.length!==0)return this.data[0]}back(){if(this.length!==0)return this.data[this.length-1]}swapElements(e,i){if(e>=this.length||i>=this.length||e===i)return;const r=this.data[e];this.data[e]=this.data[i],this.data[i]=r}sort(e){Ahe.sort(this.data,0,this.length,e)}iterableSort(e){return Ahe.iterableSort(this.data,0,this.length,e)}some(e,i){for(let r=0;riHe*t.length&&(t.data.length=Math.floor(t.length*rHe))}function nHe(t){return{setTimeout:(e,i)=>{const r=t.setTimeout(e,i);return rr(()=>t.clearTimeout(r))}}}const E9=nHe(globalThis);function rB(t){return t&&(typeof t.on=="function"||typeof t.addEventListener=="function")}function r5(t,e,i){if(!rB(t))throw new TypeError("target is not a Evented or EventTarget object");if("on"in t)return t.on(e,i);if(Array.isArray(e)){const r=e.slice();for(const n of r)t.addEventListener(n,i);return rr(()=>{for(const n of r)t.removeEventListener(n,i)})}return t.addEventListener(e,i),rr(()=>t.removeEventListener(e,i))}function qSe(t,e,i){if(!rB(t))throw new TypeError("target is not a Evented or EventTarget object");if("once"in t)return t.once(e,i);const r=r5(t,e,n=>{r.remove(),i.call(t,n)});return r}const sHe={Win:"Meta",Scroll:"ScrollLock",Spacebar:" ",Down:"ArrowDown",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Del:"Delete",Apps:"ContextMenu",Esc:"Escape",Multiply:"*",Add:"+",Subtract:"-",Decimal:".",Divide:"/"};function Mf({key:t}){return sHe[t]||t}function ur(t="Aborted"){return new se("AbortError",t)}function St(t,e="Aborted"){if(So(t))throw ur(e)}function nB(t){return t!=null?"aborted"in t?t:t.signal:t}function So(t){const e=nB(t);return e!=null&&e.aborted}function Uo(t){if(on(t))throw t}function aZ(t){if(!on(t))throw t}function Zl(t,e){const i=nB(t);if(i!=null){if(!i.aborted)return qSe(i,"abort",()=>e());e()}}function C9(t,e){const i=nB(t);if(i!=null)return St(i),qSe(i,"abort",()=>e(ur()))}function dT(t,e){return nB(e)==null?t:new Promise((i,r)=>{let n=Zl(e,()=>r(ur()));const s=()=>{n=en(n)};t.then(s,s),t.then(i,r)})}function on(t){return(t==null?void 0:t.name)==="AbortError"}async function Nm(t){try{return await t}catch(e){if(!on(e))throw e;return}}async function KXt(t,e=Ce.getLogger("esri")){try{return await t}catch(i){on(i)||e.error(i)}}async function vy(t){if(!t)return;if(typeof t.forEach!="function"){const i=Object.keys(t),r=i.map(o=>t[o]),n=await vy(r),s={};return i.map((o,a)=>s[o]=n[a]),s}const e=t;return Promise.allSettled(e).then(i=>Array.from(e,(r,n)=>{const s=i[n];return s.status==="fulfilled"?{promise:r,value:s.value}:{promise:r,error:s.reason}}))}async function oHe(t){return(await vy(t)).filter(e=>!!e.value).map(e=>e.value)}async function lZ(t){return(await Promise.allSettled(t)).filter(e=>e.status==="fulfilled").map(e=>e.value)}async function aHe(t){return(await Promise.allSettled(t)).filter(e=>e.status==="rejected").map(e=>e.reason)}function P2(t,e=void 0,i){const r=new AbortController;return Zl(i,()=>r.abort()),new Promise((n,s)=>{let o=setTimeout(()=>{o=0,n(e)},t);Zl(r,()=>{o&&(clearTimeout(o),s(ur()))})})}function yd(t){return t&&typeof t.then=="function"}function cZ(t){return yd(t)?t:Promise.resolve(t)}function n5(t,e=-1){let i,r,n,s,o=null;const a=(...c)=>{if(i){r=c,s&&s.reject(ur()),s=ec();const S=s.promise;if(o){const C=o;o=null,C.abort()}return S}if(n=s||ec(),s=null,e>0){const S=new AbortController;i=cZ(t(...c,S.signal));const C=i;P2(e).then(()=>{i===C&&(s?S.abort():o=S)})}else i=1,i=cZ(t(...c));const p=()=>{const S=r;r=n=i=o=null,S!=null&&a(...S)},_=i,x=n;return _.then(p,p),_.then(x.resolve,x.reject),x.promise};return a}function ec(){let t,e;const i=new Promise((n,s)=>{t=n,e=s}),r=n=>{t(n)};return r.resolve=n=>t(n),r.reject=n=>e(n),r.timeout=(n,s)=>E9.setTimeout(()=>r.reject(s),n),r.promise=i,r}function QXt(t,e){return t.then(e,e)}async function rz(t){await Promise.resolve(),St(t)}function eZt(t){return t}function WSe(t){return 1e3*t}function tZt(t){return t}function vne(t){return .001*t}let lHe=class{constructor(e){this.phases=e,this.paused=!1,this.ticks=-1,this.removed=!1}},cHe=class{constructor(e){this.callback=e,this.isActive=!0}remove(){this.isActive=!1}},uZ=0,hZ=0;const j5={time:0,deltaTime:0,elapsedFrameTime:0,frameDuration:0},dZ=["prepare","preRender","render","postRender","update","finish"],pZ=[],$T=new Pi;let uHe=class{constructor(e){this._task=e}remove(){this._task.removed=!0}pause(){this._task.paused=!0}resume(){this._task.paused=!1}};const nz={frameTasks:$T,willDispatch:!1,clearFrameTasks:hHe,dispatch:ZSe,executeFrameTasks:pHe};function ox(t){const e=new cHe(t);return pZ.push(e),nz.willDispatch||(nz.willDispatch=!0,qO(ZSe)),e}function LT(t){const e=new lHe(t);return $T.push(e),sz==null&&(uZ=performance.now(),sz=requestAnimationFrame(YSe)),new uHe(e)}let sz=null;function hHe(t=!1){$T.forAll(e=>{e.removed=!0}),t&&XSe()}function dHe(t){hZ=Math.max(0,t)}function YSe(){const t=performance.now();sz=null,sz=$T.length>0?requestAnimationFrame(YSe):null,nz.executeFrameTasks(t)}function pHe(t){const e=t-uZ;uZ=t;const i=hZ>0?hZ:1e3/60,r=Math.max(0,e-i);j5.time=t,j5.frameDuration=i-r;for(let n=0;n{var c;a.paused||a.removed||(n===0&&a.ticks++,a.phases[o]&&(j5.elapsedFrameTime=performance.now()-t,j5.deltaTime=a.ticks===0?0:e,(c=a.phases[o])==null||c.call(a,j5)))}),mHe[n].record(performance.now()-s)}XSe(),gHe.record(performance.now()-t)}const L6=new Pi;function XSe(){$T.forAll(t=>{t.removed&&L6.push(t)}),$T.removeUnorderedMany(L6.data,L6.length),L6.clear()}function ZSe(){for(;pZ.length;){const t=pZ.shift();t.isActive&&t.callback()}nz.willDispatch=!1}function fHe(t=1,e){const i=ec(),r=()=>{So(e)?i.reject(ur()):t===0?i():(--t,qO(()=>r()))};return r(),i.promise}const mHe=dZ.map(t=>new Wv(t)),gHe=new Wv("total");function x7(t,e){for(const i of t.entries())if(e(i[0]))return!0;return!1}function Ohe(t,e){if(!e)return t;for(const i of e)t.add(i);return t}function JSe(t,e){const i=new Set;return Ohe(i,t),Ohe(i,e),i}function yHe(t,e){const i=new Set;for(const r of e)t.has(r)&&i.add(r);return i}function sZt(t,e){if(!t||!e)return!1;if(t===e)return!0;for(const i of t)if(!e.has(i))return!1;return!0}function oZt(t,e){if(t==null&&e==null)return!0;if(t==null||e==null||t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}function aZt(t,e){const i=new Set(t);for(const r of e)i.delete(r);return i}let vHe=0;const _He=0;function mp(){return++vHe}let sB=class{constructor(e){this._accessed=[],this._handles=[],this._observerObject=new bHe(e),Phe.register(this,new WeakRef(this._observerObject),this)}destroy(){var e;Phe.unregister(this._observerObject),this._accessed.length=0,(e=this._observerObject)==null||e.destroy(),this.clear()}onObservableAccessed(e){const i=this._accessed;i.includes(e)||i.push(e)}onTrackingEnd(){const e=this._handles,i=this._accessed,r=this._observerObject;for(let n=0;n0?e-1:0}destroy(){this.destroyed=!0,this._notify=wHe}};const Phe=new FinalizationRegistry(t=>{var e;(e=t.deref())==null||e.destroy()});function wHe(){}let nO=!1;const oz=[];function KSe(t,e){let i=new sB(s),r=null,n=!1;function s(){if(!i||n)return;if(nO)return void tTe(s);const a=r;i.clear(),nO=!0,n=!0,r=g_(i,t),n=!1,nO=!1,e(r,a),iTe()}function o(){i&&(i.destroy(),i=null,r=null)}return n=!0,r=g_(i,t),n=!1,rr(o)}function QSe(t,e){let i=new sB(n),r=null;function n(){e(r,o)}function s(){i&&(i.destroy(),i=null),r=null}function o(){return i?(i.clear(),r=g_(i,t),r):null}return o(),rr(s)}function eTe(t){let e=new sB(r),i=!1;function r(){e&&!i&&(nO?tTe(r):(e.clear(),nO=!0,i=!0,g_(e,t),i=!1,nO=!1,iTe()))}function n(){e&&(e.destroy(),e=null)}return i=!0,g_(e,t),i=!1,rr(n)}function tTe(t){oz.includes(t)||oz.unshift(t)}function iTe(){for(;oz.length;)oz.pop()()}var K4;(function(t){t[t.Untracked=0]="Untracked",t[t.Tracked=1]="Tracked"})(K4||(K4={}));let hL=class{constructor(){this.uid=mp(),this.removed=!1,this.type=null,this.oldValue=null,this.callback=null,this.getValue=null,this.target=null,this.path=null,this.equals=null}static acquireUntracked(e,i,r,n,s){return this.pool.acquire(K4.Untracked,e,i,r,n,s,dne)}static acquireTracked(e,i,r,n){return this.pool.acquire(K4.Tracked,e,i,r,null,null,n)}notify(e,i){this.type===K4.Untracked?this.callback.call(this.target,e,i,this.path,this.target):this.callback.call(null,e,i,void 0,void 0)}acquire(e,i,r,n,s,o,a){this.uid=mp(),this.removed=!1,this.type=e,this.oldValue=i,this.callback=r,this.getValue=n,this.target=s,this.path=o,this.equals=a}release(){this.target=this.path=this.oldValue=this.callback=this.getValue=null,this.uid=mp(),this.removed=!0}};hL.pool=new HSe(hL);const S7=new jh,t_=new Set;let az;function lz(t){t_.delete(t),t_.add(t),az||(az=ox(THe))}function xHe(t){if(t.removed)return;const e=t.oldValue,i=t.getValue();t.equals(e,i)||(t.oldValue=i,t.notify(i,e))}function SHe(t){for(const e of t_.values())e.target===t&&(e.removed=!0)}function THe(){let t=10;for(;az&&t--;){az=null;const e=EHe(),i=S7.acquire();for(const r of e){const n=r.uid;xHe(r),n===r.uid&&r.removed&&i.push(r)}for(const r of t_)r.removed&&(i.push(r),t_.delete(r));for(const r of i)hL.pool.release(r);S7.release(i),S7.release(e),fZ.forEach(r=>r())}}function EHe(){const t=S7.acquire();t.length=t_.size;let e=0;for(const i of t_)t[e]=i,++e;return t_.clear(),t}const fZ=new Set;function rTe(t){return fZ.add(t),rr(()=>fZ.delete(t))}function CHe(t,e,i){let r=LSe(t,e,i,(n,s,o)=>{let a,c,p=QSe(()=>x9(n,s),(_,x)=>{n.__accessor__.destroyed||a&&a.uid!==c?r.remove():(a||(a=hL.acquireUntracked(_,o,x,n,s),c=a.uid),lz(a))});return rr(()=>{p.remove(),a&&(a.uid!==c||a.removed||(a.removed=!0,lz(a)),a=null),r=p=null})});return r}function AHe(t,e,i){const r=LSe(t,e,i,(n,s,o)=>{let a=!1;return KSe(()=>x9(n,s),(c,p)=>{n.__accessor__.destroyed?r.remove():a||(a=!0,dne(p,c)||o.call(n,c,p,s,n),a=!1)})});return r}function MHe(t,e,i,r=!1){return!t.__accessor__||t.__accessor__.destroyed?rr():r?AHe(t,e,i):CHe(t,e,i)}function OHe(t,e,i){let r,n,s=QSe(t,(o,a)=>{r&&r.uid!==n?s.remove():(r||(r=hL.acquireTracked(o,e,a,i),n=r.uid),lz(r))});return rr(()=>{s.remove(),r&&(r.uid!==n||r.removed||(r.removed=!0,lz(r)),r=null),s=null})}function PHe(t,e,i){let r=!1;return KSe(t,(n,s)=>{r||(r=!0,i(s,n)||e(n,s),r=!1)})}function RHe(t,e,i=!1,r=OSe){return i?PHe(t,e,r):OHe(t,e,r)}function Rhe(t){return x7(t_,e=>e.oldValue===t)}function ap(t,e){for(const[i,r]of t)if(e(r,i))return!0;return!1}function hZt(t,e){for(const[i,r]of t)if(e(r,i))return r;return null}function oB(t,e,i){const r=t.get(e);if(r!==void 0)return r;const n=i();return t.set(e,n),n}const sO=Ce.getLogger("esri.core.accessorSupport.ensureTypes");function IHe(t){return t==null?t:new Date(t)}function $He(t){return t==null?t:!!t}function A9(t){return t==null?t:t.toString()}function Gh(t){return t==null?t:(t=parseFloat(t),isNaN(t)?0:t)}function _ne(t){return t==null?t:Math.round(parseFloat(t))}function nTe(t){return(t==null?void 0:t.constructor)&&t.constructor.__accessorMetadata__!==void 0}function cz(t,e){return e!=null&&t&&!(e instanceof t)}function sTe(t){return t&&"isCollection"in t}function Ihe(t){return t!=null&&t.Type?typeof t.Type=="function"?t.Type:t.Type.base:null}function LHe(t,e){if(!(e!=null&&e.constructor)||!sTe(e.constructor))return mZ(t,e)?e:new t(e);const i=Ihe(t.prototype.itemType),r=Ihe(e.constructor.prototype.itemType);return i?r?i===r?e:i.prototype.isPrototypeOf(r.prototype)?new t(e):(mZ(t,e),e):new t(e):e}function mZ(t,e){return!!nTe(e)&&(sO.error("Accessor#set","Assigning an instance of '"+(e.declaredClass||"unknown")+"' which is not a subclass of '"+aB(t)+"'"),!0)}function DT(t,e){return e==null?e:sTe(t)?LHe(t,e):cz(t,e)?mZ(t,e)?e:new t(e):e}function aB(t){var e;return((e=t==null?void 0:t.prototype)==null?void 0:e.declaredClass)||"unknown"}const DHe=new WeakMap;function NHe(t){switch(t){case Number:return Gh;case _n:return _ne;case Boolean:return $He;case String:return A9;case Date:return IHe;default:return oB(DHe,t,()=>DT.bind(null,t))}}function _s(t,e){const i=NHe(t);return arguments.length===1?i:i(e)}function dL(t,e,i){return arguments.length===1?dL.bind(null,t):e&&(Array.isArray(e)?e.map(r=>t(r,i)):[t(e,i)])}function FHe(t,e){return arguments.length===1?dL(i=>_s(t,i)):dL(i=>_s(t,i),e)}function oTe(t,e,i){return e!==0&&Array.isArray(i)?i.map(r=>oTe(t,e-1,r)):t(i)}function uz(t,e,i){if(arguments.length===2)return s=>uz(t,e,s);if(!i)return i;i=oTe(t,e,i);let r=e,n=i;for(;r>0&&Array.isArray(n);)r--,n=n[0];if(n!==void 0)for(let s=0;s_s(t,r),e):uz(r=>_s(t,r),e,i)}function aTe(t){return!!Array.isArray(t)&&!t.some(e=>{const i=typeof e;return!(i==="string"||i==="number"||i==="function"&&t.length>1)})}function gZ(t,e){if(arguments.length===2)return gZ(t).call(null,e);const i=new Set,r=t.filter(a=>typeof a!="function"),n=t.filter(a=>typeof a=="function");for(const a of t)typeof a!="string"&&typeof a!="number"||i.add(a);let s=null,o=null;return(a,c)=>{if(a==null)return a;const p=typeof a,_=p==="string"||p==="number";return _&&(i.has(a)||n.some(x=>p==="string"&&x===String||p==="number"&&x===Number))||p==="object"&&n.some(x=>!cz(a,x))?a:(_&&r.length?(s||(s=r.map(x=>typeof x=="string"?`'${x}'`:`${x}`).join(", ")),sO.error("Accessor#set",`'${a}' is not a valid value for this property, only the following values are valid: ${s}`)):typeof a=="object"&&n.length?(o||(o=n.map(x=>aB(x)).join(", ")),sO.error("Accessor#set",`'${a}' is not a valid value for this property, value must be one of ${o}`)):sO.error("Accessor#set",`'${a}' is not a valid value for this property`),c&&(c.valid=!1),null)}}function Hy(t,e){if(arguments.length===2)return Hy(t).call(null,e);const i={},r=[],n=[];for(const c in t.typeMap){const p=t.typeMap[c];i[c]=_s(p),r.push(aB(p)),n.push(c)}const s=()=>`'${r.join("', '")}'`,o=()=>`'${n.join("', '")}'`,a=typeof t.key=="string"?c=>c[t.key]:t.key;return c=>{if(t.base&&!cz(t.base,c)||c==null)return c;const p=a(c)||t.defaultKeyValue,_=i[p];if(!_)return sO.error("Accessor#set",`Invalid property value, value needs to be one of ${s()}, or a plain object that can autocast (having .type = ${o()})`),null;if(!cz(t.typeMap[p],c))return c;if(typeof t.key=="string"&&!nTe(c)){const x={};for(const S in c)S!==t.key&&(x[S]=c[S]);return _(x)}return _(c)}}let _n=class{};const pZt={native:t=>({type:"native",value:t}),array:t=>({type:"array",value:t}),oneOf:t=>({type:"one-of",values:t})};function zHe(t){if(!t||!("type"in t))return!1;switch(t.type){case"native":case"array":case"one-of":return!0}return!1}function lTe(t){switch(t.type){case"native":return _s(t.value);case"array":return dL(lTe(t.value));case"one-of":return UHe(t);default:return null}}function UHe(t){let e=null;return(i,r)=>vZ(i,t)?i:(e==null&&(e=yZ(t)),sO.error("Accessor#set",`Invalid property value, value needs to be of type ${e}`),r&&(r.valid=!1),null)}function yZ(t){switch(t.type){case"native":switch(t.value){case Number:return"number";case String:return"string";case Boolean:return"boolean";case _n:return"integer";case Date:return"date";default:return aB(t.value)}case"array":return`array of ${yZ(t.value)}`;case"one-of":{const e=t.values.map(i=>yZ(i));return`one of ${e.slice(0,-1)} or ${e[e.length-1]}`}}return"unknown"}function vZ(t,e){if(t==null)return!0;switch(e.type){case"native":switch(e.value){case Number:case _n:return typeof t=="number";case Boolean:return typeof t=="boolean";case String:return typeof t=="string"}return t instanceof e.value;case"array":return!!Array.isArray(t)&&!t.some(i=>!vZ(i,e.value));case"one-of":return e.values.some(i=>vZ(t,i))}}function w(t={}){return(e,i)=>{if(e===Function.prototype)throw new Error(`Inappropriate use of @property() on a static field: ${e.name}.${i}. Accessor does not support static properties.`);const r=Object.getOwnPropertyDescriptor(e,i),n=T9(e,i);r&&(r.get||r.set?(n.get=r.get||n.get,n.set=r.set||n.set):"value"in r&&("value"in t&&Ce.getLogger("esri.core.accessorSupport.decorators.property").warn(`@property() will redefine the value of "${i}" on "${e.constructor.name}" already defined in the metadata`,t),n.value=t.value=r.value)),t.readOnly!=null&&(n.readOnly=t.readOnly);const s=t.aliasOf;if(s){const c=typeof s=="string"?s:s.source,p=typeof s=="string"?null:s.overridable===!0;let _;n.dependsOn=[c],n.get=function(){let x=uu(this,c);if(typeof x=="function"){_||(_=c.split(".").slice(0,-1).join("."));const S=uu(this,_);S&&(x=x.bind(S))}return x},n.readOnly||(n.set=p?function(x){this._override(i,x)}:function(x){iz(this,c,x)})}const o=t.type,a=t.types;n.cast||(o?n.cast=VHe(o):a&&(Array.isArray(a)?n.cast=dL(Hy(a[0])):n.cast=Hy(a))),DGe(n,t),t.range&&(n.cast=BHe(n.cast,t.range))}}function bne(t,e,i){const r=T9(t,i);r.json||(r.json={});let n=r.json;return e!==void 0&&(n.origins||(n.origins={}),n.origins[e]||(n.origins[e]={}),n=n.origins[e]),n}function VHe(t){let e=0,i=t;if(zHe(t))return lTe(t);for(;Array.isArray(i)&&i.length===1&&typeof i[0]!="string"&&typeof i[0]!="number";)i=i[0],e++;const r=i;if(aTe(r))return e===0?gZ(r):uz(gZ(r),e);if(e===1)return FHe(r);if(e>1)return kHe(r,e);const n=t;return n.from?n.from:_s(n)}function BHe(t,e){return i=>{let r=+t(i);return e.step!=null&&(r=Math.round(r/e.step)*e.step),e.min!=null&&(r=Math.max(e.min,r)),e.max!=null&&(r=Math.min(e.max,r)),r}}function jHe(t){if(t.json&&t.json.origins){const e=t.json.origins,i={"web-document":["web-scene","web-map"]};for(const r in i)if(e[r]){const n=e[r];i[r].forEach(s=>{e[s]=n}),delete e[r]}}}let Hf=class extends jSe{constructor(e,i,r){super(e,i,r)}};Hf.prototype.type="warning";function cTe(t){var e;return!!t&&((e=t.prototype)==null?void 0:e.declaredClass)&&t.prototype.declaredClass.indexOf("esri.core.Collection")===0}const _Z=Ce.getLogger("esri.core.accessorSupport.extensions.serializableProperty.reader");function $he(t,e,i){var r,n;t&&(!i&&!e.read||(r=e.read)!=null&&r.reader||((n=e.read)==null?void 0:n.enabled)===!1||qHe(t)&&hE("read.reader",s5(t),e))}function s5(t){var i,r;const e=t.ndimArray??0;if(e>1)return HHe(t);if(e===1)return Lhe(t);if("type"in t&&hTe(t.type)){const n=(r=(i=t.type.prototype)==null?void 0:i.itemType)==null?void 0:r.Type,s=Lhe(typeof n=="function"?{type:n}:{types:n});return(o,a,c)=>{const p=s(o,a,c);return p&&new t.type(p)}}return wne(t)}function wne(t){return"type"in t?GHe(t.type):WHe(t.types)}function GHe(t){return t.prototype.read?(e,i,r)=>{if(e==null)return e;const n=typeof e;if(n!=="object")return void _Z.error(`Expected JSON value of type 'object' to deserialize type '${t.prototype.declaredClass}', but got '${n}'`);const s=new t;return s.read(e,r),s}:t.fromJSON}function uTe(t,e,i,r){return r!==0&&Array.isArray(e)?e.map(n=>uTe(t,n,i,r-1)):t(e,void 0,i)}function HHe(t){const e=wne(t),i=uTe.bind(null,e),r=t.ndimArray??0;return(n,s,o)=>{if(n==null)return n;n=i(n,o,r);let a=r,c=n;for(;a>0&&Array.isArray(c);)a--,c=c[0];if(c!==void 0)for(let p=0;p{if(i==null)return i;if(Array.isArray(i)){const o=[];for(const a of i){const c=e(a,void 0,n);c!==void 0&&o.push(c)}return o}const s=e(i,void 0,n);return s!==void 0?[s]:void 0}}function hTe(t){if(!cTe(t))return!1;const e=t.prototype.itemType;return!(!e||!e.Type)&&(typeof e.Type=="function"?xne(e.Type):dTe(e.Type))}function qHe(t){return"types"in t?dTe(t.types):xne(t.type)}function xne(t){return!Array.isArray(t)&&!!t&&t.prototype&&("read"in t.prototype||"fromJSON"in t||hTe(t))}function dTe(t){for(const e in t.typeMap)if(!xne(t.typeMap[e]))return!1;return!0}function WHe(t){let e=null;const i=t.errorContext??"type",r=t.validate;return(n,s,o)=>{if(n==null)return n;const a=typeof n;if(a!=="object")return void _Z.error(`Expected JSON value of type 'object' to deserialize, but got '${a}'`);e||(e=YHe(t));const c=t.key;if(typeof c!="string")return;const p=n[c],_=p?e[p]:t.defaultKeyValue?t.typeMap[t.defaultKeyValue]:void 0;if(!_){const S=`Type '${p||"unknown"}' is not supported`;return o!=null&&o.messages&&n&&o.messages.push(new Hf(`${i}:unsupported`,S,{definition:n,context:o})),void _Z.error(S)}const x=new _;return x.read(n,o),r?r(x):x}}function YHe(t){var i,r;const e={};for(const n in t.typeMap){const s=t.typeMap[n],o=S9(s.prototype);if(typeof t.key=="function")continue;const a=o[t.key];if(!a)continue;(i=a.json)!=null&&i.type&&Array.isArray(a.json.type)&&a.json.type.length===1&&typeof a.json.type[0]=="string"&&(e[a.json.type[0]]=s);const c=(r=a.json)==null?void 0:r.write;if(!(c!=null&&c.writer)){e[n]=s;continue}const p=c.target,_=typeof p=="string"?p:t.key,x={};c.writer(n,x,_),x[_]&&(e[x[_]]=s)}return e}function XHe(t){if(t.json||(t.json={}),Nhe(t.json),Fhe(t.json),Dhe(t.json),t.json.origins)for(const e in t.json.origins)Nhe(t.json.origins[e]),Fhe(t.json.origins[e]),Dhe(t.json.origins[e]);return!0}function Dhe(t){t.name&&(t.read&&typeof t.read=="object"?t.read.source===void 0&&(t.read.source=t.name):t.read={source:t.name},t.write&&typeof t.write=="object"?t.write.target===void 0&&(t.write.target=t.name):t.write={target:t.name})}function Nhe(t){typeof t.read=="boolean"?t.read={enabled:t.read}:typeof t.read=="function"?t.read={enabled:!0,reader:t.read}:t.read&&typeof t.read=="object"&&t.read.enabled===void 0&&(t.read.enabled=!0)}function Fhe(t){typeof t.write=="boolean"?t.write={enabled:t.write}:typeof t.write=="function"?t.write={enabled:!0,writer:t.write}:t.write&&typeof t.write=="object"&&t.write.enabled===void 0&&(t.write.enabled=!0)}function khe(t,e){if(!e.write||e.write.writer||e.write.enabled===!1&&!e.write.overridePolicy)return;const i=(t==null?void 0:t.ndimArray)??0;t&&(i===1||"type"in t&&cTe(t.type))?e.write.writer=KHe:i>1?e.write.writer=QHe(i):e.types?Array.isArray(e.types)?e.write.writer=JHe(e.types[0]):e.write.writer=ZHe(e.types):e.write.writer=pL}function ZHe(t){return(e,i,r,n)=>e?pTe(e,t,n)?pL(e,i,r,n):void 0:pL(e,i,r,n)}function pTe(t,e,i){for(const r in e.typeMap)if(t instanceof e.typeMap[r])return!0;if(i!=null&&i.messages){const r=e.errorContext??"type",n=`Values of type '${(typeof e.key!="function"?t[e.key]:t.declaredClass)??"Unknown"}' cannot be written`;i&&i.messages&&t&&i.messages.push(new se(`${r}:unsupported`,n,{definition:t,context:i})),Ce.getLogger("esri.core.accessorSupport.extensions.serializableProperty.writer").error(n)}return!1}function JHe(t){return(e,i,r,n)=>!e||!Array.isArray(e)?pL(e,i,r,n):pL(e.filter(s=>pTe(s,t,n)),i,r,n)}function pL(t,e,i,r){hE(i,hz(t,r),e)}function hz(t,e){return t&&typeof t.write=="function"?t.write({},e):t&&typeof t.toJSON=="function"?t.toJSON():typeof t=="number"?dz(t):t}function dz(t){return t===-1/0?-Number.MAX_VALUE:t===1/0?Number.MAX_VALUE:isNaN(t)?null:t}function KHe(t,e,i,r){let n;t===null?n=null:t&&typeof t.map=="function"?(n=t.map(s=>hz(s,r)),typeof n.toArray=="function"&&(n=n.toArray())):n=[hz(t,r)],hE(i,n,e)}function fTe(t,e,i){return i!==0&&Array.isArray(t)?t.map(r=>fTe(r,e,i-1)):hz(t,e)}function QHe(t){return(e,i,r,n)=>{let s;if(e===null)s=null;else{s=fTe(e,n,t);let o=t,a=s;for(;o>0&&Array.isArray(a);)o--,a=a[0];if(a!==void 0)for(let c=0;c{t??(t="esri.core.Accessor"),e.prototype.declaredClass=t,oqe(e);const i=[],r=[];let n=e.prototype;for(;n;)n.hasOwnProperty("initialize")&&!cH.has(n.initialize)&&(cH.add(n.initialize),i.push(n.initialize)),n.hasOwnProperty("destroy")&&!uH.has(n.destroy)&&(uH.add(n.destroy),r.push(n.destroy)),n=Object.getPrototypeOf(n);cH.clear(),uH.clear();const s=class extends e{constructor(...a){if(super(...a),this.constructor===s&&typeof this.postscript=="function"){if(i.length&&Object.defineProperty(this,"initialize",{enumerable:!1,configurable:!0,value(){for(let c=i.length-1;c>=0;c--)i[c].call(this)}}),r.length){let c=!1;const p=this[ISe];Object.defineProperty(this,"destroy",{enumerable:!1,configurable:!0,value(){if(!c){c=!0,p.call(this);for(let _=0;_0&&this.normalizeCtorArgs&&(i.ctorArgs=this.normalizeCtorArgs.apply(this,e))}postscript(e){const i=this.__accessor__,r=i.ctorArgs||e;i.initialize(),r&&(this.set(r),i.ctorArgs=null),i.constructed(),this.initialize(),this[xZ]=!0}initialize(){}[ISe](){this[jb]=et(this[jb])}destroy(){var e;this.destroyed||(SHe(this),this.__accessor__.destroy(),(e=eHe())==null||e.onInstanceDestroy(this))}[Symbol.dispose](){this.destroy()}get constructed(){return this.__accessor__&&this.__accessor__.initialized||!1}get initialized(){return this[xZ]}get destroyed(){return this.__accessor__&&this.__accessor__.destroyed||!1}commitProperty(e){uu(this,e)}get(e){return uSe(Ce.getLogger(this),"`Accessor.get` is deprecated in favor of using optional chaining",{version:"4.28",see:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining"}),uu(this,e)}hasOwnProperty(e){return this.__accessor__?this.__accessor__.has(e):Object.prototype.hasOwnProperty.call(this,e)}keys(){return this.__accessor__?this.__accessor__.keys():[]}set(e,i){return iz(this,e,i),this}watch(e,i,r){return MHe(this,e,i,r)}addHandles(e,i){if(this.destroyed){const n=Array.isArray(e)?e:[e];for(const s of n)s.remove();return}let r=this[jb];r==null&&(r=this[jb]=new N_),r.add(e,i)}removeHandles(e){const i=this[jb];i!=null&&i.remove(e)}removeAllHandles(){const e=this[jb];e!=null&&e.removeAll()}hasHandles(e){const i=this[jb];return i!=null&&i.has(e)}_override(e,i){i===void 0?this.__accessor__.clearOverride(e):this.__accessor__.override(e,i)}_clearOverride(e){return this.__accessor__.clearOverride(e)}_overrideIfSome(e,i){i==null?this.__accessor__.clearOverride(e):this.__accessor__.override(e,i)}_isOverridden(e){return this.__accessor__.isOverridden(e)}notifyChange(e){this.__accessor__.notifyChange(e)}_get(e){return this.__accessor__.internalGet(e)}_set(e,i){return this.__accessor__.internalSet(e,i),this}};yTe=jb,vTe=xZ;let dA=class extends ze{constructor(e){super(e),this.format=null,this.position={coordinate:null,location:null}}get displayCoordinate(){var e,i;return(i=this.format)==null?void 0:i.getDisplayCoordinate((e=this.position)==null?void 0:e.coordinate)}};y([w({readOnly:!0})],dA.prototype,"displayCoordinate",null),y([w()],dA.prototype,"format",void 0),y([w()],dA.prototype,"position",void 0),dA=y([Z("esri.widgets.CoordinateConversion.support.Conversion")],dA);const YS=dA;let T7=class bTe{constructor(){this._emitter=new bTe.EventEmitter(this)}emit(e,i){return this._emitter.emit(e,i)}on(e,i){return this._emitter.on(e,i)}once(e,i){return this._emitter.once(e,i)}hasEventListener(e){return this._emitter.hasEventListener(e)}};(function(t){class e{constructor(n=null){this._target=n,this._listenersMap=null}clear(){var n;(n=this._listenersMap)==null||n.clear(),this._listenersMap=null}destroy(){this.clear()}emit(n,s){var p;let o=(p=this._listenersMap)==null?void 0:p.get(n);if(!o)return!1;const a=this._target||this;let c=!1;for(const _ of o.slice()){const x="deref"in _?_.deref():_;x?x==null||x.call(a,s):c=!0}return c&&(o=o.filter(_=>!("deref"in _)||_.deref()!=null),this._listenersMap.set(n,o)),o.length>0}on(n,s){if(Array.isArray(n)){const a=n.map(c=>this.on(c,s));return sd(a)}if(n.includes(","))throw new TypeError("Evented.on() with a comma delimited string of event types is not supported");this._listenersMap??(this._listenersMap=new Map);const o=this._listenersMap.get(n)||[];return o.push(s),this._listenersMap.set(n,o),rr(()=>{var p;const a=(p=this._listenersMap)==null?void 0:p.get(n),c=(a==null?void 0:a.indexOf(s))??-1;c>=0&&a.splice(c,1)})}once(n,s){const o=this.on(n,a=>{o.remove();const c="deref"in s?s.deref():s;c==null||c.call(null,a)});return o}hasEventListener(n){var o;const s=(o=this._listenersMap)==null?void 0:o.get(n);return s!=null&&s.length>0}}t.EventEmitter=e,t.EventedMixin=r=>{let n=class extends r{constructor(){super(...arguments),this._emitter=new e}destroy(){this._emitter.clear()}emit(s,o){return this._emitter.emit(s,o)}on(s,o){return this._emitter.on(s,o)}once(s,o){return this._emitter.once(s,o)}hasEventListener(s){return this._emitter.hasEventListener(s)}};return n=y([Z("esri.core.Evented")],n),n};let i=class extends ze{constructor(){super(...arguments),this._emitter=new T7.EventEmitter(this)}destroy(){this._emitter.clear()}emit(r,n){return this._emitter.emit(r,n)}on(r,n){return this._emitter.on(r,n)}once(r,n){return this._emitter.once(r,n)}hasEventListener(r){return this._emitter.hasEventListener(r)}};i=y([Z("esri.core.Evented")],i),t.EventedAccessor=i})(T7||(T7={}));const Dn=T7;var xn;(function(t){t[t.ADD=1]="ADD",t[t.REMOVE=2]="REMOVE",t[t.MOVE=4]="MOVE"})(xn||(xn={}));function wTe(t){return(e,i)=>{e[i]=t}}let M9=class extends FSe{notify(){const e=this._observers;if(e&&e.length>0){const i=e.slice();for(const r of i)r.onInvalidated(),r.onCommitted()}}};var Fv;let lqe=class{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}},cqe=class{constructor(e,i,r,n,s){this.target=e,this.added=i,this.removed=r,this.start=n,this.deleteCount=s}};const $p=new Ql(lqe,void 0,t=>{t.item=null,t.target=null,t.defaultPrevented=!1,t.cancellable=!1});function hH(t){return t?t instanceof AS?t.toArray():t.length?Array.prototype.slice.apply(t):[]:[]}function dH(t){if(t!=null&&t.length)return t[0]}function uqe(t,e,i,r){const n=Math.min(t.length-i,e.length-r);let s=0;for(;s{t.push(n),xTe(t,i.call(r,n,s,o),i,r)})}const ib=new Set,rb=new Set,nb=new Set,pH=new Map;let hqe=0,AS=Fv=class extends Dn.EventedAccessor{static isCollection(t){return t!=null&&t instanceof Fv}constructor(t){super(t),this._chgListeners=[],this._notifications=null,this._timer=null,this._observable=new M9,this.length=0,this._items=[],Object.defineProperty(this,"uid",{value:hqe++})}normalizeCtorArgs(t){return t?Array.isArray(t)||t instanceof Fv?{items:t}:t:{}}destroy(){this._removeAllRaw()}*[Symbol.iterator](){yield*this.items}get items(){return wi(this._observable),this._items}set items(t){this._emitBeforeChanges(xn.ADD)||(this._splice(0,this.length,hH(t)),this._emitAfterChanges(xn.ADD))}hasEventListener(t){return t==="change"?this._chgListeners.length>0:this._emitter.hasEventListener(t)}on(t,e){if(t==="change"){const i=this._chgListeners,r={removed:!1,callback:e};return i.push(r),this._notifications&&this._notifications.push({listeners:i.slice(),items:this._items.slice(),changes:[]}),rr(()=>{r.removed=!0,i.splice(i.indexOf(r),1)})}return this._emitter.on(t,e)}once(t,e){const i="deref"in e?()=>e.deref():()=>e,r=this.on(t,n=>{var s;(s=i())==null||s.call(null,n),r.remove()});return r}add(t,e){if(wi(this._observable),this._emitBeforeChanges(xn.ADD))return this;const i=this.getNextIndex(e??null);return this._splice(i,0,[t]),this._emitAfterChanges(xn.ADD),this}addMany(t,e=this._items.length){if(wi(this._observable),!(t!=null&&t.length))return this;if(this._emitBeforeChanges(xn.ADD))return this;const i=this.getNextIndex(e);return this._splice(i,0,hH(t)),this._emitAfterChanges(xn.ADD),this}at(t){if(wi(this._observable),(t=Math.trunc(t)||0)<0&&(t+=this.length),!(t<0||t>=this.length))return this._items[t]}removeAll(){if(wi(this._observable),!this.length||this._emitBeforeChanges(xn.REMOVE))return[];const t=this._removeAllRaw();return this._emitAfterChanges(xn.REMOVE),t}_removeAllRaw(){return this.length===0?[]:this._splice(0,this.length)||[]}clone(){return wi(this._observable),this._createNewInstance({items:this._items.map(Pe)})}concat(...t){wi(this._observable);const e=t.map(hH);return this._createNewInstance({items:this._items.concat(...e)})}drain(t,e){if(wi(this._observable),!this.length||this._emitBeforeChanges(xn.REMOVE))return;const i=this._splice(0,this.length),r=i.length;for(let n=0;ne&&(t=e),t}includes(t,e=0){return wi(this._observable),this._items.includes(t,e)}indexOf(t,e=0){return wi(this._observable),this._items.indexOf(t,e)}join(t=","){return wi(this._observable),this._items.join(t)}lastIndexOf(t,e=this.length-1){return wi(this._observable),this._items.lastIndexOf(t,e)}map(t,e){wi(this._observable);const i=this._items.map(t,e);return new Fv({items:i})}reorder(t,e=this.length-1){wi(this._observable);const i=this.indexOf(t);if(i!==-1){if(e<0?e=0:e>=this.length&&(e=this.length-1),i!==e){if(this._emitBeforeChanges(xn.MOVE))return t;this._splice(i,1),this._splice(e,0,[t]),this._emitAfterChanges(xn.MOVE)}return t}}pop(){if(wi(this._observable),!this.length||this._emitBeforeChanges(xn.REMOVE))return;const t=dH(this._splice(this.length-1,1));return this._emitAfterChanges(xn.REMOVE),t}push(...t){return wi(this._observable),this._emitBeforeChanges(xn.ADD)||(this._splice(this.length,0,t),this._emitAfterChanges(xn.ADD)),this.length}reduce(t,e){wi(this._observable);const i=this._items;return arguments.length===2?i.reduce(t,e):i.reduce(t)}reduceRight(t,e){wi(this._observable);const i=this._items;return arguments.length===2?i.reduceRight(t,e):i.reduceRight(t)}remove(t){return wi(this._observable),this.removeAt(this.indexOf(t))}removeAt(t){if(wi(this._observable),t<0||t>=this.length||this._emitBeforeChanges(xn.REMOVE))return;const e=dH(this._splice(t,1));return this._emitAfterChanges(xn.REMOVE),e}removeMany(t){if(wi(this._observable),!(t!=null&&t.length)||this._emitBeforeChanges(xn.REMOVE))return[];const e=t instanceof Fv?t.toArray():t,i=this._items,r=[],n=e.length;for(let s=0;s-1){const c=1+uqe(e,i,s+1,a+1),p=this._splice(a,c);p&&p.length>0&&r.push.apply(r,p),s+=c-1}}return this._emitAfterChanges(xn.REMOVE),r}reverse(){if(wi(this._observable),this._emitBeforeChanges(xn.MOVE))return this;const t=this._splice(0,this.length);return t&&(t.reverse(),this._splice(0,0,t)),this._emitAfterChanges(xn.MOVE),this}shift(){if(wi(this._observable),!this.length||this._emitBeforeChanges(xn.REMOVE))return;const t=dH(this._splice(0,1));return this._emitAfterChanges(xn.REMOVE),t}slice(t=0,e=this.length){return wi(this._observable),this._createNewInstance({items:this._items.slice(t,e)})}some(t,e){return wi(this._observable),this._items.some(t,e)}sort(t){if(wi(this._observable),!this.length||this._emitBeforeChanges(xn.MOVE))return this;const e=this._splice(0,this.length);return arguments.length?e.sort(t):e.sort(),this._splice(0,0,e),this._emitAfterChanges(xn.MOVE),this}splice(t,e,...i){wi(this._observable);const r=(e?xn.REMOVE:0)|(i.length?xn.ADD:0);if(this._emitBeforeChanges(r))return[];const n=this._splice(t,e,i)||[];return this._emitAfterChanges(r),n}toArray(){return wi(this._observable),this._items.slice()}toJSON(){return wi(this._observable),this.toArray()}toLocaleString(){return wi(this._observable),this._items.toLocaleString()}toString(){return wi(this._observable),this._items.toString()}unshift(...t){return wi(this._observable),!t.length||this._emitBeforeChanges(xn.ADD)||(this._splice(0,0,t),this._emitAfterChanges(xn.ADD)),this.length}_createNewInstance(t){return new this.constructor(t)}_splice(t,e,i){const r=this._items,n=this.itemType;let s,o;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._timer=ox(()=>this._dispatchChange())),t<0&&(t+=this.length),e){if(o=r.splice(t,e),this.hasEventListener("before-remove")){const a=$p.acquire();a.target=this,a.cancellable=!0;for(let c=0,p=o.length;c{r.push(c)});const n=jh.acquire();rb.forEach(c=>{n.push(c)});const s=this._items,o=e.items,a=jh.acquire();if(nb.forEach(c=>{o.indexOf(c)!==s.indexOf(c)&&a.push(c)}),e.listeners&&(r.length||n.length||a.length)){const c={target:this,added:r,removed:n,moved:a},p=e.listeners.length;for(let _=0;_{if(!t)return Fv;if(pH.has(t))return pH.get(t);let e=null;if(typeof t=="function")e=t.prototype.declaredClass;else if(t.base)e=t.base.prototype.declaredClass;else for(const r in t.typeMap){const n=t.typeMap[r].prototype.declaredClass;e?e+=` | ${n}`:e=n}let i=class extends Fv{};return y([wTe({Type:t,ensureType:typeof t=="function"?_s(t):Hy(t)})],i.prototype,"itemType",void 0),i=y([Z(`esri.core.Collection<${e}>`)],i),pH.set(t,i),i},y([w()],AS.prototype,"length",void 0),y([w()],AS.prototype,"items",null),AS=Fv=y([Z("esri.core.Collection")],AS);const tt=AS;function od(t,e,i=tt){return e||(e=new i),e===t||(e.removeAll(),dqe(t)?e.addMany(t):t&&e.add(t)),e}function o5(t){return t}function dqe(t){return t&&(Array.isArray(t)||"items"in t&&Array.isArray(t.items))}let Q4=class extends tt{constructor(e){super(e),this.addHandles([this.on("before-add",i=>{i.item==null&&i.preventDefault()}),this.on("after-add",i=>this._own(i.item)),this.on("after-remove",i=>this._release(i.item))])}get owner(){return this._get("owner")}set owner(e){e!==this._get("owner")&&(this._releaseAll(),this._set("owner",e),this._ownAll())}_ownAll(){for(const e of this.items)this._own(e)}_releaseAll(){for(const e of this.items)this._release(e)}_createNewInstance(e){return this.itemType?new(tt.ofType(this.itemType.Type))(e):new tt(e)}};function pz(t,e){return{type:t,cast:o5,set(i){const r=od(i,this._get(e),t);r.owner=this,this._set(e,r)}}}y([w()],Q4.prototype,"owner",null),Q4=y([Z("esri.core.support.OwningCollection")],Q4);const pqe="modulepreload",fqe=function(t){return"/elb-js-api/"+t},zhe={},we=function(e,i,r){let n=Promise.resolve();if(i&&i.length>0){const s=document.getElementsByTagName("link");n=Promise.all(i.map(o=>{if(o=fqe(o),o in zhe)return;zhe[o]=!0;const a=o.endsWith(".css"),c=a?'[rel="stylesheet"]':"";if(!!r)for(let x=s.length-1;x>=0;x--){const S=s[x];if(S.href===o&&(!a||S.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${c}`))return;const _=document.createElement("link");if(_.rel=a?"stylesheet":pqe,a||(_.as="script",_.crossOrigin=""),_.href=o,document.head.appendChild(_),a)return new Promise((x,S)=>{_.addEventListener("load",x),_.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${o}`)))})}))}return n.then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};let mqe=class STe{constructor(){this._values=new Map,this.multipleOriginsSupported=!1}clone(e){const i=new STe;return this._values.forEach((r,n)=>{e&&e.has(n)||i.set(n,Pe(r.value),r.origin)}),i}get(e,i){i=this._normalizeOrigin(i);const r=this._values.get(e);return i==null||(r==null?void 0:r.origin)===i?r==null?void 0:r.value:void 0}originOf(e){var i;return((i=this._values.get(e))==null?void 0:i.origin)??Di.USER}keys(e){e=this._normalizeOrigin(e);const i=[...this._values.keys()];return e==null?i:i.filter(r=>{var n;return((n=this._values.get(r))==null?void 0:n.origin)===e})}set(e,i,r){if((r=this._normalizeOrigin(r))===Di.DEFAULTS){const n=this._values.get(e);if((n==null?void 0:n.origin)!=null&&n.origin>r)return}this._values.set(e,new gqe(i,r))}delete(e,i){var r;(i=this._normalizeOrigin(i))!=null&&((r=this._values.get(e))==null?void 0:r.origin)!==i||this._values.delete(e)}has(e,i){var r;return(i=this._normalizeOrigin(i))!=null?((r=this._values.get(e))==null?void 0:r.origin)===i:this._values.has(e)}forEach(e){this._values.forEach(({value:i},r)=>e(i,r))}_normalizeOrigin(e){if(e!=null)return e===Di.DEFAULTS?e:Di.USER}},gqe=class{constructor(e,i){this.value=e,this.origin=i}};function TTe(t,e,i){e.keys().forEach(n=>{i.set(n,e.get(n),Di.DEFAULTS)});const r=t.metadatas;Object.keys(r).forEach(n=>{t.internalGet(n)&&i.set(n,t.internalGet(n),Di.DEFAULTS)})}function yqe(t,e,i){if(!(t!=null&&t.read)||t.read.enabled===!1||!t.read.source)return!1;const r=t.read.source;if(typeof r=="string"){if(r===e||r.includes(".")&&r.indexOf(e)===0&&xhe(r,i))return!0}else for(const n of r)if(n===e||n.includes(".")&&n.indexOf(e)===0&&xhe(n,i))return!0;return!1}function vqe(t){return t&&(!t.read||t.read.enabled!==!1&&!t.read.source)}function _qe(t,e,i,r,n){let s=bZ(e[i],n);vqe(s)&&(t[i]=!0);for(const o of Object.getOwnPropertyNames(e))s=bZ(e[o],n),yqe(s,i,r)&&(t[o]=!0)}function bqe(t,e,i,r){const n=i.metadatas,s=eqe(n[e],r),o=s==null?void 0:s.default;if(o===void 0)return;const a=typeof o=="function"?o.call(t,e,r):o;a!==void 0&&i.set(e,a)}const ETe={origin:"service"};function CTe(t,e,i=ETe){if(!e||typeof e!="object")return;const r=Kl(t),n=r.metadatas,s={};for(const o of Object.getOwnPropertyNames(e))_qe(s,n,o,e,i);r.setDefaultOrigin(i.origin);for(const o of Object.getOwnPropertyNames(s)){const a=bZ(n[o],i).read,c=a==null?void 0:a.source;let p;p=c&&typeof c=="string"?x9(e,c):e[o],a!=null&&a.reader&&(p=a.reader.call(t,p,e,i)),p!==void 0&&r.set(o,p)}if(!i||!i.ignoreDefaults){r.setDefaultOrigin("defaults");for(const o of Object.getOwnPropertyNames(n))s[o]||bqe(t,o,r,i)}r.setDefaultOrigin("user")}function ATe(t,e,i,r=ETe){var s;const n={...r,messages:[]};i(n),(s=n.messages)==null||s.forEach(o=>{o.type!=="warning"||t.loaded?r!=null&&r.messages&&r.messages.push(o):t.loadWarnings.push(o)})}function wqe(t,e,i,r,n){var o,a;const s={};return(a=(o=e.write)==null?void 0:o.writer)==null||a.call(t,r,s,i,n),s}function MTe(t,e,i,r,n,s){if(!(r!=null&&r.write))return!1;const o=uu(t,i);if(!n&&r.write.overridePolicy){const a=r.write.overridePolicy.call(t,o,i,s??void 0);a!==void 0&&(n=a)}if(n||(n=r.write),!n||n.enabled===!1||n.layerContainerTypes&&(s!=null&&s.layerContainerType)&&!n.layerContainerTypes.includes(s.layerContainerType))return!1;if((o===null&&!n.allowNull&&!n.writerEnsuresNonNull||o===void 0)&&n.isRequired){const a=new se("web-document-write:property-required",`Missing value for required property '${i}' on '${t.declaredClass}'`,{propertyName:i,target:t});return a&&(s!=null&&s.messages)?s.messages.push(a):a&&!s&&Ce.getLogger("esri.core.accessorSupport.write").error(a.name,a.message),!1}return!(o===void 0||o===null&&!n.allowNull&&!n.writerEnsuresNonNull||!n.alwaysWriteDefaults&&(!e.store.multipleOriginsSupported||e.store.originOf(i)===Di.DEFAULTS)&&xqe(t,i,s,r,o)||!n.ignoreOrigin&&(s!=null&&s.origin)&&e.store.multipleOriginsSupported&&e.store.originOf(i)0&&(e=_7(e,_),(o=(s=i==null?void 0:i.resources)==null?void 0:s.pendingOperations)!=null&&o.length&&i.resources.pendingOperations.push(Promise.all(i.resources.pendingOperations).then(()=>_7(e,_,()=>"replace-arrays"))),i!=null&&i.writtenProperties&&i.writtenProperties.push({target:t,propName:a,oldOrigin:BGe(r.store.originOf(a)),newOrigin:i.origin}))}return e}const F_=t=>{let e=class extends t{constructor(...i){super(...i);const r=Kl(this),n=r.store,s=new mqe;r.store=s,TTe(r,n,s)}read(i,r){CTe(this,i,r)}write(i,r){return PTe(this,i??{},r)}toJSON(i){return this.write({},i)}static fromJSON(i,r){return Sqe.call(this,i,r)}};return e=y([Z("esri.core.JSONSupport")],e),e.prototype.toJSON.isDefaultToJSON=!0,e};function Sqe(t,e){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const i=new this;return i.read(t,e),i}function fz(t){return t&&typeof t=="object"&&"toJSON"in t&&typeof t.toJSON=="function"}let Ue=class extends F_(ze){};Ue=y([Z("esri.core.JSONSupport")],Ue);function Rt(t,e,i){let r,n;return e===void 0||Array.isArray(e)?(n=t,i=e,r=[void 0]):(n=e,r=Array.isArray(t)?t:[t]),(s,o)=>{const a=s.constructor.prototype;r.forEach(c=>{const p=bne(s,c,n);p.read&&typeof p.read=="object"||(p.read={}),p.read.reader=a[o],i&&(p.read.source=(p.read.source||[]).concat(i))})}}let tn=class{constructor(e,i={ignoreUnknown:!1,useNumericKeys:!1}){this._jsonToAPI=e,this._options=i,this.apiValues=[],this.jsonValues=[],this._apiToJSON=this._invertMap(e),this.apiValues=this._getKeysSorted(this._apiToJSON),this.jsonValues=this._getKeysSorted(this._jsonToAPI),this.read=r=>this.fromJSON(r),this.write=(r,n,s)=>{const o=this.toJSON(r);o!==void 0&&hE(s,o,n)},this.write.isJSONMapWriter=!0}toJSON(e){if(e==null)return null;if(this._apiToJSON.hasOwnProperty(e)){const i=this._apiToJSON[e];return this._options.useNumericKeys?+i:i}return this._options.ignoreUnknown?void 0:e}fromJSON(e){return e!=null&&this._jsonToAPI.hasOwnProperty(e)?this._jsonToAPI[e]:this._options.ignoreUnknown?void 0:e}_invertMap(e){const i={};for(const r in e)i[e[r]]=r;return i}_getKeysSorted(e){const i=[];for(const r in e)i.push(r);return i.sort(),i}};function gu(){return function(t,e){return new tn(t,{ignoreUnknown:!0,...e})}}let Tne=class{constructor(e,i,r,n){this.semiMajorAxis=e,this.flattening=i,this.outerAtmosphereRimWidth=r;const s=1-this.flattening;this.semiMinorAxis=this.semiMajorAxis*s,this.halfSemiMajorAxis=this.semiMajorAxis/2,this.halfCircumference=Math.PI*this.semiMajorAxis,this.metersPerDegree=this.halfCircumference/180,this.inverseFlattening=1/(1-this.flattening)-1,this.eccentricitySquared=n||2*this.flattening-this.flattening*this.flattening,this.meanRadiusSemiAxes=(2*this.semiMajorAxis+this.semiMinorAxis)/3}get radius(){return this.semiMajorAxis}};const Or=new Tne(6378137,1/298.257223563,3e5,.006694379990137799),My=new Tne(3396190,1/169.8944472236118,23e4),y_=new Tne(1737400,0,0),Tqe=/^https:\/\/([a-z\d-]+)(\.maps([^.]*))?\.arcgis\.com/i,Eqe={devext:{customBaseUrl:"mapsdevext.arcgis.com",portalHostname:"devext.arcgis.com"},qaext:{customBaseUrl:"mapsqa.arcgis.com",portalHostname:"qaext.arcgis.com"},www:{customBaseUrl:"maps.arcgis.com",portalHostname:"www.arcgis.com"}};function Uhe(t){const e=t==null?void 0:t.match(Tqe);if(!e)return null;const[,i,r,n]=e;if(!i)return null;let s=null,o=null,a=null;const{devext:c,qaext:p,www:_}=Eqe;if(r)if(s=i,n)switch(n.toLowerCase()){case"devext":({customBaseUrl:o,portalHostname:a}=c);break;case"qa":({customBaseUrl:o,portalHostname:a}=p);break;default:return null}else({customBaseUrl:o,portalHostname:a}=_);else switch(i.toLowerCase()){case"devext":({customBaseUrl:o,portalHostname:a}=c);break;case"qaext":({customBaseUrl:o,portalHostname:a}=p);break;case"www":({customBaseUrl:o,portalHostname:a}=_);break;default:return null}return{customBaseUrl:o,isPortal:!1,portalHostname:a,urlKey:s}}function Cqe(t){return/\/(sharing|usrsvcs)\/(appservices|servers)\//i.test(t)}function RTe(t){const e=atob(t),i=new Uint8Array(e.length);for(let r=0;rau,EZt=()=>Ene;function Fqe(){const t=au.path,e=t.substring(0,t.lastIndexOf(t.split("/")[t.split("/").length-1]));return`${`${au.scheme}://${au.host}${au.port!=null?`:${au.port}`:""}`}${e}`}function Is(t){if(!t)return null;const e={path:null,query:null},i=new w2(t),r=t.indexOf("?");return i.query===null?e.path=t:(e.path=t.substring(0,r),e.query=Ane(i.query)),i.fragment&&(e.hash=i.fragment,i.query===null&&(e.path=e.path.substring(0,e.path.length-(i.fragment.length+1)))),e}function Ane(t){const e=t.split("&"),i={};for(const r of e){if(!r)continue;const n=r.indexOf("=");let s,o;n<0?(s=decodeURIComponent(r),o=""):(s=decodeURIComponent(r.slice(0,n)),o=decodeURIComponent(r.slice(n+1)));let a=i[s];typeof a=="string"&&(a=i[s]=[a]),Array.isArray(a)?a.push(o):i[s]=o}return i}function NT(t,e){return t?e&&typeof e=="function"?Object.keys(t).map(i=>encodeURIComponent(i)+"="+encodeURIComponent(e(i,t[i]))).join("&"):Object.keys(t).map(i=>{const r=t[i];if(r==null)return"";const n=encodeURIComponent(i)+"=",s=e==null?void 0:e[i];return s?n+encodeURIComponent(s(r)):Array.isArray(r)?r.map(o=>fz(o)?n+encodeURIComponent(JSON.stringify(o)):n+encodeURIComponent(o)).join("&"):fz(r)?n+encodeURIComponent(JSON.stringify(r)):n+encodeURIComponent(r)}).filter(i=>i).join("&"):""}function kqe(t=!1){let e,i=a5.proxyUrl;if(typeof t=="string"){e=qqe(t);const r=lB(t);r&&(i=r.proxyUrl)}else e=!!t;if(!i)throw Mqe.warn(Vhe),new se("urlutils:proxy-not-set",Vhe);return e&&SZ()&&(i=$ne(i)),Is(i)}function zqe(t){const e=lB(t);let i,r;if(e){const n=Mne(e.proxyUrl);i=n.path,r=n.query?Ane(n.query):null}if(i){const n=Is(t);t=i+"?"+n.path;const s=NT({...r,...n.query});s&&(t=`${t}?${s}`)}return t}const G5={path:"",query:""};function Mne(t){const e=t.indexOf("?");return e!==-1?(G5.path=t.slice(0,e),G5.query=t.slice(e+1)):(G5.path=t,G5.query=null),G5}function LTe(t){return t=(t=gz(t=Jqe(t=Mne(t).path),!0)).toLowerCase()}function Uqe(t){const e={proxyUrl:t.proxyUrl,urlPrefix:LTe(t.urlPrefix)},i=a5.proxyRules,r=e.urlPrefix;let n=i.length;for(let s=0;s0?t.substring(0,e):t.replace(/\/+$/,"")}function NTe(t){const e=r=>r==null||r instanceof RegExp&&r.test(t)||typeof r=="string"&&t.startsWith(r),i=a5.interceptors;if(i){for(const r of i)if(Array.isArray(r.urls)){if(r.urls.some(e))return r}else if(e(r.urls))return r}return null}function WO(t,e,i=!1){if(!t||!e)return!1;const r=EZ(t),n=EZ(e);return!(!i&&r.scheme!==n.scheme)&&r.host!=null&&n.host!=null&&r.host.toLowerCase()===n.host.toLowerCase()&&r.port===n.port}function One(t){if(typeof t=="string"){if(!Qh(t))return!0;t=EZ(t)}if(WO(t,au))return!0;const e=a5.trustedServers||[];for(let i=0;i(C=x.indexOf(S,C))===-1?x.length:C;let c=a(n,"/",n.indexOf("//")+2),p=-1;for(;n.slice(0,c+1)===s.slice(0,c)+"/"&&(p=c+1,c!==n.length);)c=a(n,"/",c+1);if(p===-1||o&&p0)for(let x=0;x<_;x++)t=`../${t}`;else t=`./${t}`;return t}function $f(t){return t=eWe(t=Qqe(t=Kqe(t=Wh(t=t.trim()))))}function Pp(...t){const e=t.filter(ys);if(!(e!=null&&e.length))return;const i=[];if(Qh(e[0])){const n=e[0],s=n.indexOf("//");s!==-1&&(i.push(n.slice(0,s+1)),Yqe(e[0])&&(i[0]+="/"),e[0]=n.slice(s+2))}else e[0][0]==="/"&&i.push("");const r=e.reduce((n,s)=>s?n.concat(s.split("/")):n,[]);for(let n=0;n0&&i[i.length-1]!==".."?i.pop():(!s&&n===r.length-1||s&&(s!=="."||i.length===0))&&i.push(s)}return i.join("/")}function Am(t,e=!1){if(t==null||R2(t)||c1(t))return null;let i=t.indexOf("://");if(i===-1&&qy(t))i=2;else{if(i===-1)return null;i+=3}const r=t.indexOf("/",i);return r!==-1&&(t=t.slice(0,r)),e&&(t=gz(t,!0)),t}function Qh(t){return qy(t)||Ine(t)}function R2(t){return t!=null&&t.slice(0,5)==="blob:"}function c1(t){return t!=null&&t.slice(0,5)==="data:"}function Rne(t){const e=I2(t);return e&&e.isBase64?RTe(e.data):null}function CZt(t){return Aqe(t).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}const jqe=/^data:(.*?)(;base64)?,(.*)$/;function I2(t){const e=t.match(jqe);if(!e)return null;const[,i,r,n]=e;return{mediaType:i,isBase64:!!r,data:n}}function FTe(t){return t.isBase64?`data:${t.mediaType};base64,${t.data}`:`data:${t.mediaType},${t.data}`}async function Gqe(t){return(await fetch(t)).blob()}function AZt(t){const e=Rne(t);if(!e)return null;const i=I2(t);return new Blob([e],{type:i.mediaType})}function MZt(t,e){Hqe(t,e)}function Hqe(t,e){if(!t)return!1;const i=document.createElement("a");if(!("download"in i))return!1;const r=URL.createObjectURL(t);return i.download=e,i.href=r,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r),!0}function qy(t){return t!=null&&t[0]==="/"&&t[1]==="/"}function Ine(t){return t!=null&&ITe.test(t)}function qqe(t){return t!=null&&Oqe.test(t)||au.scheme==="https"&&qy(t)}function Wqe(t){return t!=null&&$Te.test(t)||au.scheme==="http"&&qy(t)}function Yqe(t){return t!=null&&Pqe.test(t)}function $ne(t){return qy(t)?`https:${t}`:t.replace($Te,"https:")}function Xqe(){return au.scheme==="http"}function SZ(){return au.scheme==="https"}function gz(t,e=!1){return qy(t)?t.slice(2):(t=t.replace(ITe,""),e&&t.length>1&&t[0]==="/"&&t[1]==="/"&&(t=t.slice(2)),t)}function Zqe(t){const e=t.indexOf("//"),i=t.indexOf("/",e+2);return i===-1?t:t.slice(0,i)}function Lne(t){let e=0;if(Qh(t)){const r=t.indexOf("//");r!==-1&&(e=r+2)}const i=t.lastIndexOf("/");return ir===n||r.endsWith(`.${n}`))||SZ()&&!lB(t))&&(t=$ne(t)),t}function TZ(t,e,i){if(!(e&&i&&t&&Qh(t)))return t;const r=t.indexOf("//"),n=t.indexOf("/",r+2),s=t.indexOf(":",r+2),o=Math.min(n<0?t.length:n,s<0?t.length:s);return t.slice(r+2,o).toLowerCase()!==e.toLowerCase()?t:`${t.slice(0,r+2)}${i}${t.slice(o)}`}function EZ(t){return typeof t=="string"?new w2(Wh(t)):(t.scheme||(t.scheme=au.scheme),t)}function zTe(t){return tWe.test(t)}function UTe(t,e){const i=Is(t),r=Object.keys(i.query||{});return r.length>0&&e&&e.warn("removeQueryParameters()",`Url query parameters are not supported, the following parameters have been removed: ${r.join(", ")}.`),i.path}function Dne(t,e,i){const r=Is(t),n=r.query||{};return n[e]=String(i),`${r.path}?${NT(n)}`}function oO(t,e){if(!e)return t;const i=Is(t),r=i.query||{};for(const[s,o]of Object.entries(e))o!=null&&(r[s]=o);const n=NT(r);return n?`${i.path}?${n}`:i.path}function Nne(t){if(t==null)return null;const e=t.match(VTe);return e?e[2]:null}function Bhe(t){if(t==null)return null;const e=t.match(VTe);return e?{path:e[1],extension:e[2]}:{path:t,extension:null}}async function PZt(t){return typeof t=="string"?I2(t)??{data:t}:new Promise((e,i)=>{const r=new FileReader;r.readAsDataURL(t),r.onload=()=>e(I2(r.result)),r.onerror=n=>i(n)})}const VTe=/([^.]*)\.([^\/]*)$/,tWe=/(^data:image\/svg|\.svg$)/i,BTe="20231115",jTe="a6fcf2901ef678ef17a528e11b93ffe09e3ec267";Symbol.dispose??(Symbol.dispose=Symbol("Symbol.dispose")),Symbol.asyncDispose??(Symbol.asyncDispose=Symbol("Symbol.asyncDispose"));const GTe="4.28";let yr,Fne=GTe;Fne="4.28.10";function RZt(t){yr=t}function iWe(t){const e=yr==null?void 0:yr.findCredential(t);return e!=null&&e.token?Dne(t,"token",e.token):t}$e("host-webworker");const rWe=new Set(["elevation3d.arcgis.com","js.arcgis.com","jsdev.arcgis.com","jsqa.arcgis.com","static.arcgis.com"]);function kne(t){const e=Am(t,!0);return!!e&&e.endsWith(".arcgis.com")&&!rWe.has(e)&&!t.endsWith("/sharing/rest/generateToken")}function HTe(t,e,i=!1,r){return new Promise((n,s)=>{if(So(r))return void s(jhe());let o=()=>{p(),s(new Error(`Unable to load ${e}`))},a=()=>{const _=t;p(),n(_)},c=()=>{if(!t)return;const _=t;p(),_.src="",s(jhe())};const p=()=>{$e("esri-image-decode")||(t.removeEventListener("error",o),t.removeEventListener("load",a)),o=null,a=null,t=null,r!=null&&r.removeEventListener("abort",c),c=null,i&&URL.revokeObjectURL(e)};r!=null&&r.addEventListener("abort",c),$e("esri-image-decode")?t.decode().then(a,o):(t.addEventListener("error",o),t.addEventListener("load",a))})}function jhe(){try{return new DOMException("Aborted","AbortError")}catch{const t=new Error;return t.name="AbortError",t}}const qTe="Timeout exceeded";function nWe(){return new Error(qTe)}function IZt(t){return typeof t=="object"&&!!t&&"message"in t&&t.message===qTe}function sWe(t){Mr.request.crossOriginNoCorsDomains||(Mr.request.crossOriginNoCorsDomains={});const e=Mr.request.crossOriginNoCorsDomains;for(let i of t)i=i.toLowerCase(),/^https?:\/\//.test(i)?e[Am(i)??""]=0:(e[Am("http://"+i)??""]=0,e[Am("https://"+i)??""]=0)}function oWe(t){const e=Mr.request.crossOriginNoCorsDomains;if(e){let i=Am(t);if(i)return i=i.toLowerCase(),!WO(i,Cne())&&e[i]o.abort());const a={controller:o,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:s,params:n,redoRequest:!1,useIdentity:sm.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},c=await yWe(a);return(p=s==null?void 0:s.after)==null||p.call(s,c),c}let yz;const sm=Mr.request,WTe="FormData"in globalThis,lWe=new Set([499,498,403,401]),cWe=new Set(["COM_0056","COM_0057","SB_0008"]),uWe=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],zne=()=>null,vz=Symbol();function hWe(t){const e=Am(t);e&&!yi._corsServers.includes(e)&&yi._corsServers.push(e)}function Ghe(t){const e=Am(t);return!e||e.endsWith(".arcgis.com")||yi._corsServers.includes(e)||One(e)}function Oy(t,e,i,r){let n="Error";const s={url:i.url,requestOptions:i.requestOptions,getHeader:zne,ssl:!1};if(e instanceof se)return e.details?(e.details=Pe(e.details),e.details.url=i.url,e.details.requestOptions=i.requestOptions):e.details=s,e;if(e){const o=r&&(p=>r.headers.get(p)),a=r==null?void 0:r.status,c=e.message;c&&(n=c),o&&(s.getHeader=o),s.httpStatus=(e.httpCode!=null?e.httpCode:e.code)||a||0,s.subCode=e.subcode,s.messageCode=e.messageCode,typeof e.details=="string"?s.messages=[e.details]:s.messages=e.details,s.raw=vz in e?e[vz]:e}return on(e)?ur():new se(t,n,s)}async function dWe(){$e("host-webworker")?yz||(yz=await we(()=>import("./request-94B0_41T.js"),__vite__mapDeps([]))):yi._abortableFetch||(yi._abortableFetch=globalThis.fetch.bind(globalThis))}async function CZ(){yr||await we(()=>import("./IdentityManager-YS7SZXzi.js"),__vite__mapDeps([]))}async function pWe(t){var a;const e=t.params.url,i=t.params.requestOptions,r=t.controller.signal,n=i.body;let s=null,o=null;if(WTe&&"HTMLFormElement"in globalThis&&(n instanceof FormData?s=n:n instanceof HTMLFormElement&&(s=new FormData(n))),typeof n=="string"&&(o=n),t.fetchOptions={cache:i.cacheBust&&!("polyfill"in yi._abortableFetch)?"no-cache":"default",credentials:"same-origin",headers:i.headers||{},method:i.method==="head"?"HEAD":"GET",mode:"cors",priority:sm.priority,redirect:"follow",signal:r},(s||o)&&(t.fetchOptions.body=s||o),i.authMode==="anonymous"&&(t.useIdentity=!1),t.hasToken=!!(/token=/i.test(e)||(a=i.query)!=null&&a.token||s!=null&&s.get("token")),!t.hasToken&&Mr.apiKey&&kne(e)&&(i.query||(i.query={}),i.query.token=Mr.apiKey,t.hasToken=!0),t.useIdentity&&!t.hasToken&&!t.credentialToken&&!YTe(e)&&!So(r)){let c;i.authMode==="immediate"?(await CZ(),c=await yr.getCredential(e,{signal:r}),t.credential=c):i.authMode==="no-prompt"?(await CZ(),c=await yr.getCredential(e,{prompt:!1,signal:r}).catch(()=>{}),t.credential=c):yr&&(c=yr.findCredential(e)),c&&(t.credentialToken=c.token,t.useSSL=!!c.ssl)}}function YTe(t){return uWe.some(e=>e.test(t))}async function fWe(t){let e=t.params.url;const i=t.params.requestOptions,r=t.fetchOptions??{},n=R2(e)||c1(e),s=i.responseType||"json",o=n?0:i.timeout!=null?i.timeout:sm.timeout;let a=!1;if(!n){t.useSSL&&(e=$ne(e)),i.cacheBust&&r.cache==="default"&&(e=Dne(e,"request.preventCache",Date.now()));let S={...i.query};t.credentialToken&&(S.token=t.credentialToken);let C=NT(S);$e("esri-url-encodes-apostrophe")&&(C=C.replaceAll("'","%27"));const M=e.length+1+C.length;let P;a=i.method==="delete"||i.method==="post"||i.method==="put"||!!i.body||M>sm.maxUrlLength;const $=i.useProxy||!!lB(e);if($){const F=kqe(e);P=F.path,!a&&P.length+1+M>sm.maxUrlLength&&(a=!0),F.query&&(S={...F.query,...S})}if(r.method==="HEAD"&&(a||$)){if(a)throw M>sm.maxUrlLength?Oy("request:invalid-parameters",new Error("URL exceeds maximum length"),t.params):Oy("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),t.params);if($)throw Oy("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),t.params)}if(a?(r.method=i.method==="delete"?"DELETE":i.method==="put"?"PUT":"POST",i.body?e=oO(e,S):(r.body=NT(S),r.headers||(r.headers={}),r.headers["Content-Type"]="application/x-www-form-urlencoded")):e=oO(e,S),$&&(t.useProxy=!0,e=`${P}?${e}`),S.token&&WTe&&r.body instanceof FormData&&!Cqe(e)&&r.body.set("token",S.token),i.hasOwnProperty("withCredentials"))t.withCredentials=i.withCredentials;else if(!WO(e,Cne())){if(One(e))t.withCredentials=!0;else if(yr){const F=yr.findServerInfo(e);F!=null&&F.webTierAuth&&(t.withCredentials=!0)}}t.withCredentials&&(r.credentials="include",oWe(e)&&await aWe(a?oO(e,S):e))}let c,p,_=0,x=!1;o>0&&(_=setTimeout(()=>{x=!0,t.controller.abort()},o));try{if(i.responseType==="native-request-init")p=r,p.url=e;else if(i.responseType!=="image"||r.cache!=="default"||r.method!=="GET"||a||gWe(i.headers)||!n&&!t.useProxy&&sm.proxyUrl&&!Ghe(e)){if(c=await yi._abortableFetch(e,r),t.useProxy||hWe(e),i.responseType==="native")p=c;else if(r.method!=="HEAD")if(c.ok){switch(s){case"array-buffer":p=await c.arrayBuffer();break;case"blob":case"image":p=await c.blob();break;default:p=await c.text()}if(_&&(clearTimeout(_),_=0),s==="json"||s==="xml"||s==="document")if(p)switch(s){case"json":p=JSON.parse(p);break;case"xml":p=Hhe(p,"application/xml");break;case"document":p=Hhe(p,"text/html")}else p=null;if(p){if(s==="array-buffer"||s==="blob"){const S=c.headers.get("Content-Type");if(S&&/application\/json|text\/plain/i.test(S)&&p[s==="blob"?"size":"byteLength"]<=750)try{const C=await new Response(p).json();C.error&&(p=C)}catch{}}s==="image"&&p instanceof Blob&&(p=await qhe(URL.createObjectURL(p),t,!0))}}else{p=await c.text();try{p=JSON.parse(p)}catch{}}}else p=await qhe(e,t)}catch(S){if(S.name==="AbortError")throw x?nWe():ur("Request canceled");if(!(!c&&S instanceof TypeError&&sm.proxyUrl)||i.body||i.method==="delete"||i.method==="head"||i.method==="post"||i.method==="put"||t.useProxy||Ghe(e))throw S;t.redoRequest=!0,Uqe({proxyUrl:sm.proxyUrl,urlPrefix:Am(e)??""})}finally{_&&clearTimeout(_)}return[c,p]}async function mWe(t,e){if(t.responseData!=null)return t.responseData;if(t.headers&&(e.requestOptions.headers={...e.requestOptions.headers,...t.headers}),t.query&&(e.requestOptions.query={...e.requestOptions.query,...t.query}),t.before){let i,r;try{r=await t.before(e)}catch(n){i=Oy("request:interceptor",n,e)}if((r instanceof Error||r instanceof se)&&(i=Oy("request:interceptor",r,e)),i)throw t.error&&t.error(i),i;return r}}function gWe(t){if(t){for(const e of Object.getOwnPropertyNames(t))if(t[e])return!0}return!1}function Hhe(t,e){let i;try{i=new DOMParser().parseFromString(t,e)}catch{}if(!i||i.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return i}async function yWe(t){var s,o;let e,i;await pWe(t);try{do[e,i]=await fWe(t);while(!await vWe(t,e,i))}catch(a){const c=Oy("request:server",a,t.params,e);throw c.details.ssl=t.useSSL,(s=t.interceptor)!=null&&s.error&&t.interceptor.error(c),c}const r=t.params.url;if(i&&/\/sharing\/rest\/(accounts|portals)\/self/i.test(r)){if(!t.hasToken&&!t.credentialToken&&((o=i.user)!=null&&o.username)&&!One(r)){const a=Am(r,!0);a&&sm.trustedServers.push(a)}Array.isArray(i.authorizedCrossOriginNoCorsDomains)&&sWe(i.authorizedCrossOriginNoCorsDomains)}const n=t.credential;if(n&&yr){const a=yr.findServerInfo(n.server);let c=a==null?void 0:a.owningSystemUrl;if(c){c=c.replace(/\/?$/,"/sharing");const p=yr.findCredential(c,n.userId);p&&yr._getIdenticalSvcIdx(c,p)===-1&&p.resources.unshift(c)}}return{data:i,getHeader:e?a=>e==null?void 0:e.headers.get(a):zne,httpStatus:(e==null?void 0:e.status)??200,requestOptions:t.params.requestOptions,ssl:t.useSSL,url:t.params.url}}async function vWe(t,e,i){var p;if(t.redoRequest)return t.redoRequest=!1,!1;const r=t.params.requestOptions;if(!e||r.responseType==="native"||r.responseType==="native-request-init")return!0;let n,s;if(i&&(i.error?n=i.error:i.status==="error"&&Array.isArray(i.messages)&&(n={...i},n[vz]=i,n.details=i.messages)),!n&&!e.ok)throw n=new Error(`Unable to load ${e.url} status: ${e.status}`),n[vz]=i,n;let o,a=null;n&&(s=Number(n.code),a=n.hasOwnProperty("subcode")?Number(n.subcode):null,o=n.messageCode,o=o==null?void 0:o.toUpperCase());const c=r.authMode;if(s===403&&(a===4||(p=n.message)!=null&&p.toLowerCase().includes("ssl")&&!n.message.toLowerCase().includes("permission"))){if(!t.useSSL)return t.useSSL=!0,!1}else if(!t.hasToken&&t.useIdentity&&(c!=="no-prompt"||s===498)&&s!==void 0&&lWe.has(s)&&!YTe(t.params.url)&&(s!==403||(!o||!cWe.has(o))&&(a==null||a===2&&t.credentialToken))){await CZ();try{const _=await yr.getCredential(t.params.url,{error:Oy("request:server",n,t.params),prompt:c!=="no-prompt",signal:t.controller.signal,token:t.credentialToken});return t.credential=_,t.credentialToken=_.token,t.useSSL=t.useSSL||_.ssl,!1}catch(_){if(c==="no-prompt")return t.credential=void 0,t.credentialToken=void 0,!1;n=_}}if(n)throw n;return!0}function qhe(t,e,i=!1){const r=e.controller.signal,n=new Image;return e.withCredentials?n.crossOrigin="use-credentials":n.crossOrigin="anonymous",n.alt="",n.fetchPriority=sm.priority,n.src=t,HTe(n,t,i,r)}yi._abortableFetch=null,yi._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"];const _We=Ce.getLogger("esri.assets");function bWe(t,e){return yi(Wr(t),e)}function Wr(t){if(!Mr.assetsPath)throw _We.errorOnce("The API assets location needs to be set using config.assetsPath. More information: https://arcg.is/1OzLe50"),new se("assets:path-not-set","config.assetsPath is not set");return Pp(Mr.assetsPath,t)}let fH,Le=null;function XTe(){return!!Le}function wWe(){return!!$e("esri-wasm")}function ZTe(){return fH||(fH=we(()=>import("./pe-wasm--uz9mK5K.js"),__vite__mapDeps([])).then(t=>t.p).then(({default:t})=>t({locateFile:e=>Wr(`esri/geometry/support/${e}`)})).then(t=>{KTe(t)}),fH)}var AZ,io,fL;(function(t){function e(s,o,a){Le.ensureCache.prepare();const c=MS(a),p=a===c,_=Le.ensureFloat64(c),x=Le._pe_geog_to_proj(Le.getPointer(s),o,_);return x&&Ww(a,o,_,p),x}function i(s,o,a,c){switch(c){case io.PE_TRANSFORM_P_TO_G:return r(s,o,a);case io.PE_TRANSFORM_G_TO_P:return e(s,o,a)}return 0}function r(s,o,a){return n(s,o,a,0)}function n(s,o,a,c){Le.ensureCache.prepare();const p=MS(a),_=a===p,x=Le.ensureFloat64(p),S=Le._pe_proj_to_geog_center(Le.getPointer(s),o,x,c);return S&&Ww(a,o,x,_),S}t.geogToProj=e,t.projGeog=i,t.projToGeog=r,t.projToGeogCenter=n})(AZ||(AZ={})),function(t){function e(){t.PE_BUFFER_MAX=Le.PeDefs.prototype.PE_BUFFER_MAX,t.PE_NAME_MAX=Le.PeDefs.prototype.PE_NAME_MAX,t.PE_MGRS_MAX=Le.PeDefs.prototype.PE_MGRS_MAX,t.PE_USNG_MAX=Le.PeDefs.prototype.PE_USNG_MAX,t.PE_DD_MAX=Le.PeDefs.prototype.PE_DD_MAX,t.PE_DDM_MAX=Le.PeDefs.prototype.PE_DDM_MAX,t.PE_DMS_MAX=Le.PeDefs.prototype.PE_DMS_MAX,t.PE_UTM_MAX=Le.PeDefs.prototype.PE_UTM_MAX,t.PE_PARM_MAX=Le.PeDefs.prototype.PE_PARM_MAX,t.PE_TYPE_NONE=Le.PeDefs.prototype.PE_TYPE_NONE,t.PE_TYPE_GEOGCS=Le.PeDefs.prototype.PE_TYPE_GEOGCS,t.PE_TYPE_PROJCS=Le.PeDefs.prototype.PE_TYPE_PROJCS,t.PE_TYPE_GEOGTRAN=Le.PeDefs.prototype.PE_TYPE_GEOGTRAN,t.PE_TYPE_COORDSYS=Le.PeDefs.prototype.PE_TYPE_COORDSYS,t.PE_TYPE_UNIT=Le.PeDefs.prototype.PE_TYPE_UNIT,t.PE_TYPE_LINUNIT=Le.PeDefs.prototype.PE_TYPE_LINUNIT,t.PE_STR_OPTS_NONE=Le.PeDefs.prototype.PE_STR_OPTS_NONE,t.PE_STR_AUTH_NONE=Le.PeDefs.prototype.PE_STR_AUTH_NONE,t.PE_STR_AUTH_TOP=Le.PeDefs.prototype.PE_STR_AUTH_TOP,t.PE_STR_NAME_CANON=Le.PeDefs.prototype.PE_STR_NAME_CANON,t.PE_STR_FMT_WKT=Le.PeDefs.prototype.PE_STR_FMT_WKT,t.PE_STR_FMT_WKT2=Le.PeDefs.prototype.PE_STR_FMT_WKT2,t.PE_PARM_X0=Le.PeDefs.prototype.PE_PARM_X0,t.PE_PARM_ND=Le.PeDefs.prototype.PE_PARM_ND,t.PE_TRANSFORM_1_TO_2=Le.PeDefs.prototype.PE_TRANSFORM_1_TO_2,t.PE_TRANSFORM_2_TO_1=Le.PeDefs.prototype.PE_TRANSFORM_2_TO_1,t.PE_TRANSFORM_P_TO_G=Le.PeDefs.prototype.PE_TRANSFORM_P_TO_G,t.PE_TRANSFORM_G_TO_P=Le.PeDefs.prototype.PE_TRANSFORM_G_TO_P,t.PE_HORIZON_RECT=Le.PeDefs.prototype.PE_HORIZON_RECT,t.PE_HORIZON_POLY=Le.PeDefs.prototype.PE_HORIZON_POLY,t.PE_HORIZON_LINE=Le.PeDefs.prototype.PE_HORIZON_LINE,t.PE_HORIZON_DELTA=Le.PeDefs.prototype.PE_HORIZON_DELTA}t.init=e}(io||(io={})),function(t){const e={},i={},r=C=>{if(C){const M=C.getType();switch(M){case io.PE_TYPE_GEOGCS:C=Le.castObject(C,Le.PeGeogcs);break;case io.PE_TYPE_PROJCS:C=Le.castObject(C,Le.PeProjcs);break;case io.PE_TYPE_GEOGTRAN:C=Le.castObject(C,Le.PeGeogtran);break;default:M&io.PE_TYPE_UNIT&&(C=Le.castObject(C,Le.PeUnit))}}return C};function n(){Le.PeFactory.prototype.initialize(null)}function s(C){return o(io.PE_TYPE_COORDSYS,C)}function o(C,M){let P=null,$=e[C];if($||($={},e[C]=$),$.hasOwnProperty(String(M)))P=$[M];else{const F=Le.PeFactory.prototype.factoryByType(C,M);Le.compare(F,Le.NULL)||(P=F,$[M]=P)}return P=r(P),P}function a(C,M){let P=null,$=i[C];if($||($={},i[C]=$),$.hasOwnProperty(M))P=$[M];else{const F=Le.PeFactory.prototype.fromString(C,M);Le.compare(F,Le.NULL)||(P=F,$[M]=P)}return P=r(P),P}function c(C){return o(io.PE_TYPE_GEOGCS,C)}function p(C){return o(io.PE_TYPE_GEOGTRAN,C)}function _(C){return Le.PeFactory.prototype.getCode(C)}function x(C){return o(io.PE_TYPE_PROJCS,C)}function S(C){return o(io.PE_TYPE_UNIT,C)}t.initialize=n,t.coordsys=s,t.factoryByType=o,t.fromString=a,t.geogcs=c,t.geogtran=p,t.getCode=_,t.projcs=x,t.unit=S}(fL||(fL={}));let JTe=null;var _z,MZ,OZ,pT,zh,mL,v_,bz,PZ;function KTe(t){function e(s,o,a){s[o]=a(s[o])}Le=t,io.init(),_z.init(),zh.init(),v_.init(),bz.init(),JTe=class extends Le.PeGCSExtent{destroy(){Le.destroy(this)}};const i=[Le.PeDatum,Le.PeGeogcs,Le.PeGeogtran,Le.PeObject,Le.PeParameter,Le.PePrimem,Le.PeProjcs,Le.PeSpheroid,Le.PeUnit];for(const s of i)e(s.prototype,"getName",o=>function(){return o.call(this,new Array(io.PE_NAME_MAX))});for(const s of[Le.PeGeogtran,Le.PeProjcs])e(s.prototype,"getParameters",o=>function(){const a=new Array(io.PE_PARM_MAX);let c=o.call(this);for(let p=0;pfunction(){const o=this.getSize();if(!o)return null;const a=[];return Ww(a,o,s.call(this)),a}),e(Le.PeGTlistExtendedEntry.prototype,"getEntries",s=>{const o=Le._pe_getPeGTlistExtendedGTsSize();return function(){let a=null;const c=s.call(this);if(!Le.compare(c,Le.NULL)){a=[c];const p=this.getSteps();if(p>1){const _=Le.getPointer(c);for(let x=1;xfunction(){let o=this._cache;if(o||(o=new Map,this._cache=o),o.has(s))return o.get(s);let a=null;const c=s.call(this);if(!Le.compare(c,Le.NULL)){a=[c];const p=c.getNump();if(p>1){const _=Le.getPointer(c);for(let x=1;x{e.push(i[0],i[1])})):e=t,e}function Ww(t,e,i,r=!1){if(r)for(let n=0;n<2*e;n++)t[n]=Le.getValue(i+n*Float64Array.BYTES_PER_ELEMENT,"double");else{const n=t.length===0;for(let s=0;s1)){const C=Le.getPointer(S);for(let M=1;M{T1(n);const s=n.getGeogtran();T1(s),s.getParameters().forEach(T1),[s.getGeogcs1(),s.getGeogcs2()].forEach(o=>{T1(o);const a=o.getDatum();T1(a),T1(a.getSpheroid()),T1(o.getPrimem()),T1(o.getUnit())})});Le.PeGTlistExtendedEntry.prototype.Delete(i[0])}}t.destroy=e}(MZ||(MZ={})),function(t){function e(i,r,n,s,o){Le.ensureCache.prepare();const a=MS(n),c=n===a,p=Le.ensureFloat64(a);let _=0;s&&(_=Le.ensureFloat64(s));const x=Le._pe_geog_to_geog(Le.getPointer(i),r,p,_,o);return x&&Ww(n,r,p,c),x}t.geogToGeog=e}(OZ||(OZ={})),function(t){const e=(p,_,x,S,C,M)=>{let P,$;switch(Le.ensureCache.prepare(),p){case"dd":P=Le._pe_geog_to_dd,$=io.PE_DD_MAX;break;case"ddm":P=Le._pe_geog_to_ddm,$=io.PE_DDM_MAX;break;case"dms":P=Le._pe_geog_to_dms,$=io.PE_DMS_MAX}let F=0;_&&(F=Le.getPointer(_));const z=MS(S),k=Le.ensureFloat64(z),U=N6(x,$),j=P(F,x,k,C,Le.ensureInt32(U));if(j)for(let G=0;G{let M;switch(Le.ensureCache.prepare(),p){case"dd":M=Le._pe_dd_to_geog;break;case"ddm":M=Le._pe_ddm_to_geog;break;case"dms":M=Le._pe_dms_to_geog}let P=0;_&&(P=Le.getPointer(_));const $=S.map(U=>Le.ensureString(U)),F=Le.ensureInt32($),z=Le.ensureFloat64(new Array(2*x)),k=M(P,x,F,z);return k&&Ww(C,x,z),k};function r(p,_,x,S,C){return e("dms",p,_,x,S,C)}function n(p,_,x,S){return i("dms",p,_,x,S)}function s(p,_,x,S,C){return e("ddm",p,_,x,S,C)}function o(p,_,x,S){return i("ddm",p,_,x,S)}function a(p,_,x,S,C){return e("dd",p,_,x,S,C)}function c(p,_,x,S){return i("dd",p,_,x,S)}t.geogToDms=r,t.dmsToGeog=n,t.geogToDdm=s,t.ddmToGeog=o,t.geogToDd=a,t.ddToGeog=c}(pT||(pT={})),function(t){function e(){t.PE_MGRS_STYLE_NEW=Le.PeNotationMgrs.prototype.PE_MGRS_STYLE_NEW,t.PE_MGRS_STYLE_OLD=Le.PeNotationMgrs.prototype.PE_MGRS_STYLE_OLD,t.PE_MGRS_STYLE_AUTO=Le.PeNotationMgrs.prototype.PE_MGRS_STYLE_AUTO,t.PE_MGRS_180_ZONE_1_PLUS=Le.PeNotationMgrs.prototype.PE_MGRS_180_ZONE_1_PLUS,t.PE_MGRS_ADD_SPACES=Le.PeNotationMgrs.prototype.PE_MGRS_ADD_SPACES}function i(n,s,o,a,c,p,_){Le.ensureCache.prepare();let x=0;n&&(x=Le.getPointer(n));const S=MS(o),C=Le.ensureFloat64(S),M=N6(s,io.PE_MGRS_MAX),P=Le.ensureInt32(M),$=Le._pe_geog_to_mgrs_extended(x,s,C,a,c,p,P);if($)for(let F=0;FLe.ensureString(M)),x=Le.ensureInt32(_),S=Le.ensureFloat64(new Array(2*s)),C=Le._pe_mgrs_to_geog_extended(p,s,x,a,S);return C&&Ww(c,s,S),C}t.init=e,t.geogToMgrsExtended=i,t.mgrsToGeogExtended=r}(zh||(zh={})),function(t){function e(r,n,s,o,a,c,p){Le.ensureCache.prepare();let _=0;r&&(_=Le.getPointer(r));const x=MS(s),S=Le.ensureFloat64(x),C=N6(n,io.PE_MGRS_MAX),M=Le.ensureInt32(C),P=Le._pe_geog_to_usng(_,n,S,o,a,c,M);if(P)for(let $=0;$Le.ensureString(S)),p=Le.ensureInt32(c),_=Le.ensureFloat64(new Array(2*n)),x=Le._pe_usng_to_geog(a,n,p,_);return x&&Ww(o,n,_),x}t.geogToUsng=e,t.usngToGeog=i}(mL||(mL={})),function(t){function e(){t.PE_UTM_OPTS_NONE=Le.PeNotationUtm.prototype.PE_UTM_OPTS_NONE,t.PE_UTM_OPTS_ADD_SPACES=Le.PeNotationUtm.prototype.PE_UTM_OPTS_ADD_SPACES,t.PE_UTM_OPTS_NS=Le.PeNotationUtm.prototype.PE_UTM_OPTS_NS}function i(n,s,o,a,c){Le.ensureCache.prepare();let p=0;n&&(p=Le.getPointer(n));const _=MS(o),x=Le.ensureFloat64(_),S=N6(s,io.PE_UTM_MAX),C=Le.ensureInt32(S),M=Le._pe_geog_to_utm(p,s,x,a,C);if(M)for(let P=0;PLe.ensureString(M)),x=Le.ensureInt32(_),S=Le.ensureFloat64(new Array(2*s)),C=Le._pe_utm_to_geog(p,s,x,a,S);return C&&Ww(c,s,S),C}t.init=e,t.geogToUtm=i,t.utmToGeog=r}(v_||(v_={})),function(t){const e=new Map;function i(){t.PE_PCSINFO_OPTION_NONE=Le.PePCSInfo.prototype.PE_PCSINFO_OPTION_NONE,t.PE_PCSINFO_OPTION_DOMAIN=Le.PePCSInfo.prototype.PE_PCSINFO_OPTION_DOMAIN,t.PE_POLE_OUTSIDE_BOUNDARY=Le.PePCSInfo.prototype.PE_POLE_OUTSIDE_BOUNDARY,t.PE_POLE_POINT=Le.PePCSInfo.prototype.PE_POLE_POINT}function r(n,s=t.PE_PCSINFO_OPTION_DOMAIN){let o=null,a=null;return e.has(n)&&(a=e.get(n),a[s]&&(o=a[s])),o||(o=Le.PePCSInfo.prototype.generate(n,s),a||(a=[],e.set(n,a)),a[s]=o),o}t.init=i,t.generate=r}(bz||(bz={})),function(t){function e(){return Le.PeVersion.prototype.version_string()}t.versionString=e}(PZ||(PZ={}));const xWe=Object.freeze(Object.defineProperty({__proto__:null,get PeCSTransformations(){return AZ},get PeDefs(){return io},get PeFactory(){return fL},get PeGCSExtent(){return JTe},get PeGTTransformations(){return OZ},get PeGTlistExtended(){return _z},get PeGTlistExtendedEntry(){return MZ},get PeNotationDms(){return pT},get PeNotationMgrs(){return zh},get PeNotationUsng(){return mL},get PeNotationUtm(){return v_},get PePCSInfo(){return bz},get PeVersion(){return PZ},_init:KTe,get _pe(){return Le},isLoaded:XTe,isSupported:wWe,load:ZTe},Symbol.toStringTag,{value:"Module"}));var Cf;(function(t){t[t.CGCS2000=4490]="CGCS2000",t[t.GCSMARS2000=104971]="GCSMARS2000",t[t.GCSMARS2000_SPHERE=104905]="GCSMARS2000_SPHERE",t[t.GCSMOON2000=104903]="GCSMOON2000"})(Cf||(Cf={}));let R;const ae={values:[1,.3048,.3048006096012192,.3047972654,.9143917962,.201166195164,.9143984146160287,.3047994715386762,20.11676512155263,20.11678249437587,.9143985307444408,.91439523,.3047997101815088,20.1168,20.116756,5e4,15e4],units:["Meter","Foot","Foot_US","Foot_Clarke","Yard_Clarke","Link_Clarke","Yard_Sears","Foot_Sears","Chain_Sears","Chain_Benoit_1895_B","Yard_Indian","Yard_Indian_1937","Foot_Gold_Coast","Chain","Chain_Sears_1922_Truncated","50_Kilometers","150_Kilometers"],2066:5,2136:12,2155:2,2157:0,2158:0,2159:12,2160:12,2204:2,2219:0,2220:0,2254:2,2255:2,2256:1,2265:1,2266:1,2267:2,2268:2,2269:1,2270:1,2271:2,2272:2,2273:1,2294:0,2295:0,2314:3,2899:2,2900:2,2901:1,2909:1,2910:1,2911:2,2912:2,2913:1,2914:1,2992:1,2993:0,2994:1,3080:1,3089:2,3090:0,3091:2,3102:2,3141:0,3142:0,3167:14,3359:2,3360:0,3361:1,3362:0,3363:2,3364:0,3365:2,3366:3,3404:2,3405:0,3406:0,3407:3,3439:0,3440:0,3479:1,3480:0,3481:1,3482:0,3483:1,3484:0,3485:2,3486:0,3487:2,3488:0,3489:0,3490:2,3491:0,3492:2,3493:0,3494:2,3495:0,3496:2,3497:0,3498:2,3499:0,3500:2,3501:0,3502:2,3503:0,3504:2,3505:0,3506:2,3507:0,3508:2,3509:0,3510:2,3511:0,3512:2,3513:0,3514:0,3515:2,3516:0,3517:2,3518:0,3519:2,3520:0,3521:2,3522:0,3523:2,3524:0,3525:2,3526:0,3527:2,3528:0,3529:2,3530:0,3531:2,3532:0,3533:2,3534:0,3535:2,3536:0,3537:2,3538:0,3539:2,3540:0,3541:2,3542:0,3543:2,3544:0,3545:2,3546:0,3547:2,3548:0,3549:2,3550:0,3551:2,3552:0,3553:2,3582:2,3583:0,3584:2,3585:0,3586:2,3587:0,3588:1,3589:0,3590:1,3591:0,3592:0,3593:1,3598:2,3599:0,3600:2,3605:1,3606:0,3607:0,3608:2,3609:0,3610:2,3611:0,3612:2,3613:0,3614:2,3615:0,3616:2,3617:0,3618:2,3619:0,3620:2,3621:0,3622:2,3623:0,3624:2,3625:0,3626:2,3627:0,3628:2,3629:0,3630:2,3631:0,3632:2,3633:0,3634:1,3635:0,3636:1,3640:2,3641:0,3642:2,3643:0,3644:1,3645:0,3646:1,3647:0,3648:1,3649:0,3650:2,3651:0,3652:2,3653:0,3654:2,3655:0,3656:1,3657:0,3658:2,3659:0,3660:2,3661:0,3662:2,3663:0,3664:2,3668:2,3669:0,3670:2,3671:0,3672:2,3673:0,3674:2,3675:0,3676:1,3677:2,3678:0,3679:1,3680:2,3681:0,3682:1,3683:2,3684:0,3685:0,3686:2,3687:0,3688:2,3689:0,3690:2,3691:0,3692:2,3696:2,3697:0,3698:2,3699:0,3700:2,3793:0,3794:0,3812:0,3854:0,3857:0,3920:0,3978:0,3979:0,3991:2,3992:2,4026:0,4037:0,4038:0,4071:0,4082:0,4083:0,4087:0,4088:0,4217:2,4414:0,4415:0,4417:0,4434:0,4437:0,4438:2,4439:2,4462:0,4467:0,4471:0,4474:0,4559:0,4647:0,4822:0,4826:0,4839:0,5018:0,5041:0,5042:0,5048:0,5221:0,5223:0,5234:0,5235:0,5243:0,5247:0,5266:0,5316:0,5320:0,5321:0,5325:0,5337:0,5361:0,5362:0,5367:0,5382:0,5383:0,5396:0,5456:0,5457:0,5469:0,5472:4,5490:0,5513:0,5514:0,5523:0,5559:0,5588:1,5589:3,5596:0,5627:0,5629:0,5641:0,5643:0,5644:0,5646:2,5654:2,5655:2,5659:0,5700:0,5825:0,5836:0,5837:0,5839:0,5842:0,5844:0,5858:0,5879:0,5880:0,5887:0,5890:0,6128:1,6129:1,6141:1,6204:0,6210:0,6211:0,6307:0,6312:0,6316:0,6362:0,6391:1,6405:1,6406:0,6407:1,6408:0,6409:1,6410:0,6411:2,6412:0,6413:2,6414:0,6415:0,6416:2,6417:0,6418:2,6419:0,6420:2,6421:0,6422:2,6423:0,6424:2,6425:0,6426:2,6427:0,6428:2,6429:0,6430:2,6431:0,6432:2,6433:0,6434:2,6435:0,6436:2,6437:0,6438:2,6439:0,6440:0,6441:2,6442:0,6443:2,6444:0,6445:2,6446:0,6447:2,6448:0,6449:2,6450:0,6451:2,6452:0,6453:2,6454:0,6455:2,6456:0,6457:2,6458:0,6459:2,6460:0,6461:2,6462:0,6463:2,6464:0,6465:2,6466:0,6467:2,6468:0,6469:2,6470:0,6471:2,6472:0,6473:2,6474:0,6475:2,6476:0,6477:2,6478:0,6479:2,6484:2,6485:0,6486:2,6487:0,6488:2,6489:0,6490:2,6491:0,6492:2,6493:0,6494:1,6495:0,6496:1,6497:0,6498:0,6499:1,6500:0,6501:2,6502:0,6503:2,6504:0,6505:2,6506:0,6507:2,6508:0,6509:0,6510:2,6515:1,6516:0,6518:0,6519:2,6520:0,6521:2,6522:0,6523:2,6524:0,6525:2,6526:0,6527:2,6528:0,6529:2,6530:0,6531:2,6532:0,6533:2,6534:0,6535:2,6536:0,6537:2,6538:0,6539:2,6540:0,6541:2,6542:0,6543:2,6544:0,6545:1,6546:0,6547:1,6548:0,6549:2,6550:0,6551:2,6552:0,6553:2,6554:0,6555:2,6556:0,6557:1,6558:0,6559:1,6560:0,6561:1,6562:0,6563:2,6564:0,6565:2,6566:0,6567:0,6568:2,6569:0,6570:1,6571:0,6572:2,6573:0,6574:2,6575:0,6576:2,6577:0,6578:2,6582:2,6583:0,6584:2,6585:0,6586:2,6587:0,6588:2,6589:0,6590:2,6591:0,6592:0,6593:2,6594:0,6595:2,6596:0,6597:2,6598:0,6599:2,6600:0,6601:2,6602:0,6603:2,6605:2,6606:0,6607:2,6608:0,6609:2,6610:0,6611:0,6612:2,6613:0,6614:2,6615:0,6616:2,6617:0,6618:2,6633:2,6646:0,6703:0,6784:0,6785:1,6786:0,6787:1,6788:0,6789:1,6790:0,6791:1,6792:0,6793:1,6794:0,6795:1,6796:0,6797:1,6798:0,6799:1,6800:0,6801:1,6802:0,6803:1,6804:0,6805:1,6806:0,6807:1,6808:0,6809:1,6810:0,6811:1,6812:0,6813:1,6814:0,6815:1,6816:0,6817:1,6818:0,6819:1,6820:0,6821:1,6822:0,6823:1,6824:0,6825:1,6826:0,6827:1,6828:0,6829:1,6830:0,6831:1,6832:0,6833:1,6834:0,6835:1,6836:0,6837:1,6838:0,6839:1,6840:0,6841:1,6842:0,6843:1,6844:0,6845:1,6846:0,6847:1,6848:0,6849:1,6850:0,6851:1,6852:0,6853:1,6854:0,6855:1,6856:0,6857:1,6858:0,6859:1,6860:0,6861:1,6862:0,6863:1,6867:0,6868:1,6870:0,6875:0,6876:0,6879:0,6880:2,6884:0,6885:1,6886:0,6887:1,6915:0,6922:0,6923:2,6924:0,6925:2,6962:0,6984:0,6991:0,7128:2,7131:0,7132:2,7142:0,7257:0,7258:2,7259:0,7260:2,7261:0,7262:2,7263:0,7264:2,7265:0,7266:2,7267:0,7268:2,7269:0,7270:2,7271:0,7272:2,7273:0,7274:2,7275:0,7276:2,7277:0,7278:2,7279:0,7280:2,7281:0,7282:2,7283:0,7284:2,7285:0,7286:2,7287:0,7288:2,7289:0,7290:2,7291:0,7292:2,7293:0,7294:2,7295:0,7296:2,7297:0,7298:2,7299:0,7300:2,7301:0,7302:2,7303:0,7304:2,7305:0,7306:2,7307:0,7308:2,7309:0,7310:2,7311:0,7312:2,7313:0,7314:2,7315:0,7316:2,7317:0,7318:2,7319:0,7320:2,7321:0,7322:2,7323:0,7324:2,7325:0,7326:2,7327:0,7328:2,7329:0,7330:2,7331:0,7332:2,7333:0,7334:2,7335:0,7336:2,7337:0,7338:2,7339:0,7340:2,7341:0,7342:2,7343:0,7344:2,7345:0,7346:2,7347:0,7348:2,7349:0,7350:2,7351:0,7352:2,7353:0,7354:2,7355:0,7356:2,7357:0,7358:2,7359:0,7360:2,7361:0,7362:2,7363:0,7364:2,7365:0,7366:2,7367:0,7368:2,7369:0,7370:2,7877:0,7878:0,7882:0,7883:0,7887:0,7899:0,7991:0,7992:0,8035:2,8036:2,8058:0,8059:0,8082:0,8083:0,8088:0,8090:0,8091:2,8092:0,8093:2,8095:0,8096:2,8097:0,8098:2,8099:0,8100:2,8101:0,8102:2,8103:0,8104:2,8105:0,8106:2,8107:0,8108:2,8109:0,8110:2,8111:0,8112:2,8113:0,8114:2,8115:0,8116:2,8117:0,8118:2,8119:0,8120:2,8121:0,8122:2,8123:0,8124:2,8125:0,8126:2,8127:0,8128:2,8129:0,8130:2,8131:0,8132:2,8133:0,8134:2,8135:0,8136:2,8137:0,8138:2,8139:0,8140:2,8141:0,8142:2,8143:0,8144:2,8145:0,8146:2,8147:0,8148:2,8149:0,8150:2,8151:0,8152:2,8153:0,8154:2,8155:0,8156:2,8157:0,8158:2,8159:0,8160:2,8161:0,8162:2,8163:0,8164:2,8165:0,8166:2,8167:0,8168:2,8169:0,8170:2,8171:0,8172:2,8173:0,8177:2,8179:0,8180:2,8181:0,8182:2,8184:0,8185:2,8187:0,8189:2,8191:0,8193:2,8196:0,8197:2,8198:0,8200:2,8201:0,8202:2,8203:0,8204:2,8205:0,8206:2,8207:0,8208:2,8209:0,8210:2,8212:0,8213:2,8214:0,8216:2,8218:0,8220:2,8222:0,8224:2,8225:0,8226:2,8311:0,8312:1,8313:0,8314:1,8315:0,8316:1,8317:0,8318:1,8319:0,8320:1,8321:0,8322:1,8323:0,8324:1,8325:0,8326:1,8327:0,8328:1,8329:0,8330:1,8331:0,8332:1,8333:0,8334:1,8335:0,8336:1,8337:0,8338:1,8339:0,8340:1,8341:0,8342:1,8343:0,8344:1,8345:0,8346:1,8347:0,8348:1,8352:0,8353:0,8379:0,8380:2,8381:0,8382:2,8383:0,8384:2,8385:0,8387:2,8391:0,8395:0,8433:0,8441:0,8455:0,8456:0,8531:2,8682:0,8686:0,8687:0,8692:0,8693:0,8826:0,8903:0,8950:0,8951:0,9039:0,9040:0,9141:0,9149:0,9150:0,9191:0,9221:0,9222:0,9249:0,9250:0,9252:0,9254:0,9265:0,9284:0,9285:0,9300:0,9354:0,9367:0,9373:0,9377:0,9387:0,9391:0,9456:0,9473:0,9498:0,9674:0,9678:0,9680:0,9709:0,9712:0,9713:0,9716:0,9741:0,9748:2,9749:2,9761:0,9766:0,9793:0,9794:0,9869:0,9874:0,9875:0,9880:0,9895:0,9943:0,9945:0,9947:0,9967:0,9972:0,9977:0,10160:0,10183:0,10188:0,10194:0,10199:0,10207:0,10212:0,10217:0,10222:0,10227:0,10235:0,10240:0,10250:0,10254:0,10270:0,10275:0,10280:0,10306:0,10329:0,10471:0,20002:0,20042:0,20050:1,20499:0,20538:0,20539:0,20790:0,20791:0,21291:0,21292:0,21500:0,21817:0,21818:0,22032:0,22033:0,22091:0,22092:0,22239:0,22240:0,22332:0,22337:0,22338:0,22391:0,22392:0,22639:0,22700:0,22739:0,22770:0,22780:0,22832:0,23090:0,23095:0,23239:0,23240:0,23433:0,23700:0,24047:0,24048:0,24100:3,24200:0,24305:0,24306:0,24382:10,24383:0,24500:0,24547:0,24548:0,24571:9,24600:0,25e3:0,25231:0,25884:0,25932:0,26237:0,26331:0,26332:0,26432:0,26591:0,26592:0,26632:0,26692:0,27120:0,27200:0,27291:6,27292:6,27429:0,27492:0,27493:0,27500:0,27700:0,28232:0,28600:0,28991:0,28992:0,29100:0,29101:0,29220:0,29221:0,29333:0,29635:0,29636:0,29701:0,29738:0,29739:0,29849:0,29850:0,29871:8,29872:7,29873:0,29874:0,30200:5,30339:0,30340:0,30591:0,30592:0,30791:0,30792:0,30800:0,31028:0,31121:0,31154:0,31170:0,31171:0,31370:0,31528:0,31529:0,31600:0,31700:0,31838:0,31839:0,31900:0,31901:0,32061:0,32062:0,32098:0,32099:2,32100:0,32104:0,32161:0,32766:0,53048:0,53049:0,54090:0,54091:0,65061:2,65062:2,65161:0,65163:0,102041:2,102064:11,102068:15,102069:16,102118:2,102119:1,102120:2,102121:2,102217:2,102218:0,102219:2,102220:2,102378:1,102379:1,102380:0,102381:1,102589:2,102599:2,102600:2,102604:2,102647:0,102704:2,102705:2,102706:0,102731:0,102732:0,102759:1,102760:1,102761:2,102762:0,102763:2,102764:0,102765:0,102766:2,102970:1,102974:2,102993:0,102994:0,102995:2,102996:2,103015:0,103016:2,103017:0,103018:2,103025:0,103026:0,103027:2,103028:2,103035:0,103036:0,103037:2,103038:2,103039:0,103040:0,103041:2,103042:2,103043:0,103044:0,103045:2,103046:2,103047:0,103048:0,103049:2,103050:2,103051:0,103052:2,103053:0,103054:2,103055:0,103056:2,103057:0,103058:0,103059:2,103060:2,103061:0,103062:0,103063:2,103064:2,103069:2,103070:0,103071:0,103072:2,103073:2,103086:0,103087:0,103088:2,103089:2,103094:1,103095:0,103096:2,103103:0,103104:2,103105:0,103106:2,103121:0,103122:2,103123:0,103124:0,103125:1,103126:1,103127:0,103128:0,103129:2,103130:2,103131:0,103132:0,103133:2,103134:2,103135:0,103136:0,103137:1,103138:1,103139:0,103140:2,103141:0,103142:2,103143:0,103144:2,103145:0,103146:1,103147:0,103148:0,103149:2,103150:2,103151:0,103152:2,103172:0,103173:2,103174:0,103175:0,103176:2,103177:2,103178:0,103179:0,103180:2,103181:2,103182:0,103183:0,103184:2,103185:2,103228:0,103229:0,103230:2,103231:2,103250:0,103251:2,103252:0,103253:2,103260:0,103261:0,103262:2,103263:2,103270:0,103271:0,103272:2,103273:2,103274:0,103275:0,103276:2,103277:2,103278:0,103279:0,103280:2,103281:2,103282:0,103283:0,103284:2,103285:2,103286:0,103287:2,103288:0,103289:2,103290:0,103291:2,103292:0,103293:0,103294:2,103295:2,103296:0,103297:0,103298:2,103299:2,103376:2,103377:0,103378:0,103379:2,103380:2,103393:0,103394:0,103395:2,103396:2,103472:0,103473:1,103474:0,103475:2,103482:0,103483:2,103484:0,103485:2,103500:0,103501:2,103502:0,103503:0,103504:1,103505:1,103506:0,103507:0,103508:2,103509:2,103510:0,103511:0,103512:2,103513:2,103514:0,103515:2,103516:0,103517:2,103518:0,103519:2,103520:0,103521:1,103522:0,103523:0,103524:2,103525:2,103526:0,103527:2,103561:2,103562:2,103563:0,103564:0,103565:2,103566:2,103567:0,103568:0,103569:2,103570:2,103584:0,103585:2,103586:0,103587:2,103588:1,103589:0,103590:2,103591:1,103592:0,103593:2,103594:1,103695:2,103897:1};for(R=2e3;R<=2045;R++)ae[R]=0;for(R=2056;R<=2065;R++)ae[R]=0;for(R=2067;R<=2135;R++)ae[R]=0;for(R=2137;R<=2154;R++)ae[R]=0;for(R=2161;R<=2170;R++)ae[R]=0;for(R=2172;R<=2193;R++)ae[R]=0;for(R=2195;R<=2198;R++)ae[R]=0;for(R=2200;R<=2203;R++)ae[R]=0;for(R=2205;R<=2217;R++)ae[R]=0;for(R=2222;R<=2224;R++)ae[R]=1;for(R=2225;R<=2250;R++)ae[R]=2;for(R=2251;R<=2253;R++)ae[R]=1;for(R=2257;R<=2264;R++)ae[R]=2;for(R=2274;R<=2279;R++)ae[R]=2;for(R=2280;R<=2282;R++)ae[R]=1;for(R=2283;R<=2289;R++)ae[R]=2;for(R=2290;R<=2292;R++)ae[R]=0;for(R=2308;R<=2313;R++)ae[R]=0;for(R=2315;R<=2491;R++)ae[R]=0;for(R=2494;R<=2866;R++)ae[R]=0;for(R=2867;R<=2869;R++)ae[R]=1;for(R=2870;R<=2888;R++)ae[R]=2;for(R=2891;R<=2895;R++)ae[R]=2;for(R=2896;R<=2898;R++)ae[R]=1;for(R=2902;R<=2908;R++)ae[R]=2;for(R=2915;R<=2920;R++)ae[R]=2;for(R=2921;R<=2923;R++)ae[R]=1;for(R=2924;R<=2930;R++)ae[R]=2;for(R=2931;R<=2962;R++)ae[R]=0;for(R=2964;R<=2968;R++)ae[R]=2;for(R=2969;R<=2973;R++)ae[R]=0;for(R=2975;R<=2991;R++)ae[R]=0;for(R=2995;R<=3051;R++)ae[R]=0;for(R=3054;R<=3079;R++)ae[R]=0;for(R=3081;R<=3088;R++)ae[R]=0;for(R=3092;R<=3101;R++)ae[R]=0;for(R=3106;R<=3138;R++)ae[R]=0;for(R=3146;R<=3151;R++)ae[R]=0;for(R=3153;R<=3166;R++)ae[R]=0;for(R=3168;R<=3172;R++)ae[R]=0;for(R=3174;R<=3203;R++)ae[R]=0;for(R=3294;R<=3358;R++)ae[R]=0;for(R=3367;R<=3403;R++)ae[R]=0;for(R=3408;R<=3416;R++)ae[R]=0;for(R=3417;R<=3438;R++)ae[R]=2;for(R=3441;R<=3446;R++)ae[R]=2;for(R=3447;R<=3450;R++)ae[R]=0;for(R=3451;R<=3459;R++)ae[R]=2;for(R=3460;R<=3478;R++)ae[R]=0;for(R=3554;R<=3559;R++)ae[R]=0;for(R=3560;R<=3570;R++)ae[R]=2;for(R=3571;R<=3581;R++)ae[R]=0;for(R=3594;R<=3597;R++)ae[R]=0;for(R=3601;R<=3604;R++)ae[R]=0;for(R=3637;R<=3639;R++)ae[R]=0;for(R=3665;R<=3667;R++)ae[R]=0;for(R=3693;R<=3695;R++)ae[R]=0;for(R=3701;R<=3727;R++)ae[R]=0;for(R=3728;R<=3739;R++)ae[R]=2;for(R=3740;R<=3751;R++)ae[R]=0;for(R=3753;R<=3760;R++)ae[R]=2;for(R=3761;R<=3773;R++)ae[R]=0;for(R=3775;R<=3777;R++)ae[R]=0;for(R=3779;R<=3781;R++)ae[R]=0;for(R=3783;R<=3785;R++)ae[R]=0;for(R=3788;R<=3791;R++)ae[R]=0;for(R=3797;R<=3802;R++)ae[R]=0;for(R=3814;R<=3816;R++)ae[R]=0;for(R=3825;R<=3829;R++)ae[R]=0;for(R=3832;R<=3841;R++)ae[R]=0;for(R=3844;R<=3852;R++)ae[R]=0;for(R=3873;R<=3885;R++)ae[R]=0;for(R=3890;R<=3893;R++)ae[R]=0;for(R=3907;R<=3912;R++)ae[R]=0;for(R=3942;R<=3950;R++)ae[R]=0;for(R=3968;R<=3970;R++)ae[R]=0;for(R=3973;R<=3976;R++)ae[R]=0;for(R=3986;R<=3989;R++)ae[R]=0;for(R=3994;R<=3997;R++)ae[R]=0;for(R=4048;R<=4051;R++)ae[R]=0;for(R=4056;R<=4063;R++)ae[R]=0;for(R=4093;R<=4096;R++)ae[R]=0;for(R=4390;R<=4398;R++)ae[R]=0;for(R=4399;R<=4413;R++)ae[R]=2;for(R=4418;R<=4433;R++)ae[R]=2;for(R=4455;R<=4457;R++)ae[R]=2;for(R=4484;R<=4489;R++)ae[R]=0;for(R=4491;R<=4554;R++)ae[R]=0;for(R=4568;R<=4589;R++)ae[R]=0;for(R=4652;R<=4656;R++)ae[R]=0;for(R=4766;R<=4800;R++)ae[R]=0;for(R=5014;R<=5016;R++)ae[R]=0;for(R=5069;R<=5072;R++)ae[R]=0;for(R=5105;R<=5130;R++)ae[R]=0;for(R=5167;R<=5188;R++)ae[R]=0;for(R=5253;R<=5259;R++)ae[R]=0;for(R=5269;R<=5275;R++)ae[R]=0;for(R=5292;R<=5311;R++)ae[R]=0;for(R=5329;R<=5331;R++)ae[R]=0;for(R=5343;R<=5349;R++)ae[R]=0;for(R=5355;R<=5357;R++)ae[R]=0;for(R=5387;R<=5389;R++)ae[R]=0;for(R=5459;R<=5463;R++)ae[R]=0;for(R=5479;R<=5482;R++)ae[R]=0;for(R=5518;R<=5520;R++)ae[R]=0;for(R=5530;R<=5539;R++)ae[R]=0;for(R=5550;R<=5552;R++)ae[R]=0;for(R=5562;R<=5583;R++)ae[R]=0;for(R=5623;R<=5625;R++)ae[R]=2;for(R=5631;R<=5639;R++)ae[R]=0;for(R=5649;R<=5653;R++)ae[R]=0;for(R=5663;R<=5680;R++)ae[R]=0;for(R=5682;R<=5685;R++)ae[R]=0;for(R=5875;R<=5877;R++)ae[R]=0;for(R=5896;R<=5899;R++)ae[R]=0;for(R=5921;R<=5940;R++)ae[R]=0;for(R=6050;R<=6125;R++)ae[R]=0;for(R=6244;R<=6275;R++)ae[R]=0;for(R=6328;R<=6348;R++)ae[R]=0;for(R=6350;R<=6356;R++)ae[R]=0;for(R=6366;R<=6372;R++)ae[R]=0;for(R=6381;R<=6387;R++)ae[R]=0;for(R=6393;R<=6404;R++)ae[R]=0;for(R=6480;R<=6483;R++)ae[R]=0;for(R=6511;R<=6514;R++)ae[R]=0;for(R=6579;R<=6581;R++)ae[R]=0;for(R=6619;R<=6624;R++)ae[R]=0;for(R=6625;R<=6627;R++)ae[R]=2;for(R=6628;R<=6632;R++)ae[R]=0;for(R=6634;R<=6637;R++)ae[R]=0;for(R=6669;R<=6692;R++)ae[R]=0;for(R=6707;R<=6709;R++)ae[R]=0;for(R=6720;R<=6723;R++)ae[R]=0;for(R=6732;R<=6738;R++)ae[R]=0;for(R=6931;R<=6933;R++)ae[R]=0;for(R=6956;R<=6959;R++)ae[R]=0;for(R=7005;R<=7007;R++)ae[R]=0;for(R=7057;R<=7070;R++)ae[R]=2;for(R=7074;R<=7082;R++)ae[R]=0;for(R=7109;R<=7118;R++)ae[R]=0;for(R=7119;R<=7127;R++)ae[R]=1;for(R=7374;R<=7376;R++)ae[R]=0;for(R=7528;R<=7586;R++)ae[R]=0;for(R=7587;R<=7645;R++)ae[R]=2;for(R=7692;R<=7696;R++)ae[R]=0;for(R=7755;R<=7787;R++)ae[R]=0;for(R=7791;R<=7795;R++)ae[R]=0;for(R=7799;R<=7801;R++)ae[R]=0;for(R=7803;R<=7805;R++)ae[R]=0;for(R=7825;R<=7831;R++)ae[R]=0;for(R=7845;R<=7859;R++)ae[R]=0;for(R=8013;R<=8032;R++)ae[R]=0;for(R=8065;R<=8068;R++)ae[R]=1;for(R=8518;R<=8529;R++)ae[R]=2;for(R=8533;R<=8536;R++)ae[R]=2;for(R=8538;R<=8540;R++)ae[R]=2;for(R=8677;R<=8679;R++)ae[R]=0;for(R=8836;R<=8840;R++)ae[R]=0;for(R=8857;R<=8859;R++)ae[R]=0;for(R=8908;R<=8910;R++)ae[R]=0;for(R=9154;R<=9159;R++)ae[R]=0;for(R=9205;R<=9218;R++)ae[R]=0;for(R=9271;R<=9273;R++)ae[R]=0;for(R=9295;R<=9297;R++)ae[R]=0;for(R=9356;R<=9360;R++)ae[R]=0;for(R=9404;R<=9407;R++)ae[R]=0;for(R=9476;R<=9482;R++)ae[R]=0;for(R=9487;R<=9494;R++)ae[R]=0;for(R=9697;R<=9699;R++)ae[R]=0;for(R=9821;R<=9865;R++)ae[R]=0;for(R=10285;R<=10291;R++)ae[R]=0;for(R=10314;R<=10317;R++)ae[R]=0;for(R=10448;R<=10465;R++)ae[R]=0;for(R=11114;R<=11118;R++)ae[R]=0;for(R=20004;R<=20032;R++)ae[R]=0;for(R=20047;R<=20049;R++)ae[R]=0;for(R=20062;R<=20092;R++)ae[R]=0;for(R=20135;R<=20138;R++)ae[R]=0;for(R=20248;R<=20258;R++)ae[R]=0;for(R=20348;R<=20358;R++)ae[R]=0;for(R=20436;R<=20440;R++)ae[R]=0;for(R=20822;R<=20824;R++)ae[R]=0;for(R=20904;R<=20932;R++)ae[R]=0;for(R=20934;R<=20936;R++)ae[R]=0;for(R=21004;R<=21032;R++)ae[R]=0;for(R=21035;R<=21037;R++)ae[R]=0;for(R=21095;R<=21097;R++)ae[R]=0;for(R=21148;R<=21150;R++)ae[R]=0;for(R=21207;R<=21264;R++)ae[R]=0;for(R=21307;R<=21364;R++)ae[R]=0;for(R=21413;R<=21423;R++)ae[R]=0;for(R=21453;R<=21463;R++)ae[R]=0;for(R=21473;R<=21483;R++)ae[R]=0;for(R=21780;R<=21782;R++)ae[R]=0;for(R=21891;R<=21894;R++)ae[R]=0;for(R=21896;R<=21899;R++)ae[R]=0;for(R=22171;R<=22177;R++)ae[R]=0;for(R=22181;R<=22187;R++)ae[R]=0;for(R=22191;R<=22197;R++)ae[R]=0;for(R=22207;R<=22222;R++)ae[R]=0;for(R=22229;R<=22232;R++)ae[R]=0;for(R=22234;R<=22236;R++)ae[R]=0;for(R=22243;R<=22250;R++)ae[R]=0;for(R=22262;R<=22265;R++)ae[R]=0;for(R=22307;R<=22322;R++)ae[R]=0;for(R=22348;R<=22357;R++)ae[R]=0;for(R=22407;R<=22422;R++)ae[R]=0;for(R=22462;R<=22465;R++)ae[R]=0;for(R=22521;R<=22525;R++)ae[R]=0;for(R=22607;R<=22622;R++)ae[R]=0;for(R=22641;R<=22646;R++)ae[R]=0;for(R=22648;R<=22657;R++)ae[R]=0;for(R=22707;R<=22722;R++)ae[R]=0;for(R=22762;R<=22765;R++)ae[R]=0;for(R=22807;R<=22822;R++)ae[R]=0;for(R=22991;R<=22994;R++)ae[R]=0;for(R=23028;R<=23038;R++)ae[R]=0;for(R=23301;R<=23333;R++)ae[R]=2;for(R=23830;R<=23853;R++)ae[R]=0;for(R=23866;R<=23872;R++)ae[R]=0;for(R=23877;R<=23884;R++)ae[R]=0;for(R=23886;R<=23894;R++)ae[R]=0;for(R=23946;R<=23948;R++)ae[R]=0;for(R=24311;R<=24313;R++)ae[R]=0;for(R=24342;R<=24347;R++)ae[R]=0;for(R=24370;R<=24374;R++)ae[R]=10;for(R=24375;R<=24381;R++)ae[R]=0;for(R=24718;R<=24721;R++)ae[R]=0;for(R=24817;R<=24821;R++)ae[R]=0;for(R=24877;R<=24882;R++)ae[R]=0;for(R=24891;R<=24893;R++)ae[R]=0;for(R=25391;R<=25395;R++)ae[R]=0;for(R=25828;R<=25838;R++)ae[R]=0;for(R=26191;R<=26195;R++)ae[R]=0;for(R=26391;R<=26393;R++)ae[R]=0;for(R=26701;R<=26722;R++)ae[R]=0;for(R=26729;R<=26799;R++)ae[R]=2;for(R=26801;R<=26803;R++)ae[R]=2;for(R=26811;R<=26813;R++)ae[R]=2;for(R=26847;R<=26870;R++)ae[R]=2;for(R=26891;R<=26899;R++)ae[R]=0;for(R=26901;R<=26923;R++)ae[R]=0;for(R=26929;R<=26946;R++)ae[R]=0;for(R=26948;R<=26998;R++)ae[R]=0;for(R=27037;R<=27040;R++)ae[R]=0;for(R=27205;R<=27232;R++)ae[R]=0;for(R=27258;R<=27260;R++)ae[R]=0;for(R=27391;R<=27398;R++)ae[R]=0;for(R=27561;R<=27564;R++)ae[R]=0;for(R=27571;R<=27574;R++)ae[R]=0;for(R=27581;R<=27584;R++)ae[R]=0;for(R=27591;R<=27594;R++)ae[R]=0;for(R=28191;R<=28193;R++)ae[R]=0;for(R=28348;R<=28358;R++)ae[R]=0;for(R=28402;R<=28432;R++)ae[R]=0;for(R=28462;R<=28492;R++)ae[R]=0;for(R=29118;R<=29122;R++)ae[R]=0;for(R=29168;R<=29172;R++)ae[R]=0;for(R=29177;R<=29185;R++)ae[R]=0;for(R=29187;R<=29195;R++)ae[R]=0;for(R=29900;R<=29903;R++)ae[R]=0;for(R=30161;R<=30179;R++)ae[R]=0;for(R=30491;R<=30494;R++)ae[R]=0;for(R=30729;R<=30732;R++)ae[R]=0;for(R=31251;R<=31259;R++)ae[R]=0;for(R=31265;R<=31268;R++)ae[R]=0;for(R=31275;R<=31279;R++)ae[R]=0;for(R=31281;R<=31297;R++)ae[R]=0;for(R=31461;R<=31469;R++)ae[R]=0;for(R=31491;R<=31495;R++)ae[R]=0;for(R=31917;R<=31922;R++)ae[R]=0;for(R=31965;R<=32e3;R++)ae[R]=0;for(R=32001;R<=32003;R++)ae[R]=2;for(R=32005;R<=32031;R++)ae[R]=2;for(R=32033;R<=32060;R++)ae[R]=2;for(R=32064;R<=32067;R++)ae[R]=2;for(R=32074;R<=32077;R++)ae[R]=2;for(R=32081;R<=32086;R++)ae[R]=0;for(R=32107;R<=32130;R++)ae[R]=0;for(R=32133;R<=32159;R++)ae[R]=0;for(R=32164;R<=32167;R++)ae[R]=2;for(R=32180;R<=32199;R++)ae[R]=0;for(R=32201;R<=32260;R++)ae[R]=0;for(R=32301;R<=32360;R++)ae[R]=0;for(R=32401;R<=32460;R++)ae[R]=0;for(R=32501;R<=32560;R++)ae[R]=0;for(R=32601;R<=32662;R++)ae[R]=0;for(R=32664;R<=32667;R++)ae[R]=2;for(R=32701;R<=32761;R++)ae[R]=0;for(R=53001;R<=53004;R++)ae[R]=0;for(R=53008;R<=53019;R++)ae[R]=0;for(R=53021;R<=53032;R++)ae[R]=0;for(R=53034;R<=53037;R++)ae[R]=0;for(R=53042;R<=53046;R++)ae[R]=0;for(R=53074;R<=53080;R++)ae[R]=0;for(R=54001;R<=54004;R++)ae[R]=0;for(R=54008;R<=54019;R++)ae[R]=0;for(R=54021;R<=54032;R++)ae[R]=0;for(R=54034;R<=54037;R++)ae[R]=0;for(R=54042;R<=54046;R++)ae[R]=0;for(R=54048;R<=54053;R++)ae[R]=0;for(R=54074;R<=54080;R++)ae[R]=0;for(R=54098;R<=54101;R++)ae[R]=0;for(R=102001;R<=102040;R++)ae[R]=0;for(R=102042;R<=102063;R++)ae[R]=0;for(R=102065;R<=102067;R++)ae[R]=0;for(R=102070;R<=102117;R++)ae[R]=0;for(R=102122;R<=102216;R++)ae[R]=0;for(R=102221;R<=102377;R++)ae[R]=0;for(R=102382;R<=102388;R++)ae[R]=0;for(R=102389;R<=102398;R++)ae[R]=2;for(R=102399;R<=102444;R++)ae[R]=0;for(R=102445;R<=102447;R++)ae[R]=2;for(R=102448;R<=102458;R++)ae[R]=0;for(R=102459;R<=102468;R++)ae[R]=2;for(R=102469;R<=102499;R++)ae[R]=0;for(R=102500;R<=102519;R++)ae[R]=1;for(R=102520;R<=102524;R++)ae[R]=0;for(R=102525;R<=102529;R++)ae[R]=2;for(R=102530;R<=102588;R++)ae[R]=0;for(R=102590;R<=102598;R++)ae[R]=0;for(R=102601;R<=102603;R++)ae[R]=0;for(R=102605;R<=102628;R++)ae[R]=0;for(R=102629;R<=102646;R++)ae[R]=2;for(R=102648;R<=102700;R++)ae[R]=2;for(R=102701;R<=102703;R++)ae[R]=0;for(R=102707;R<=102730;R++)ae[R]=2;for(R=102733;R<=102758;R++)ae[R]=2;for(R=102767;R<=102900;R++)ae[R]=0;for(R=102901;R<=102933;R++)ae[R]=2;for(R=102934;R<=102950;R++)ae[R]=13;for(R=102951;R<=102955;R++)ae[R]=0;for(R=102961;R<=102963;R++)ae[R]=0;for(R=102965;R<=102969;R++)ae[R]=0;for(R=102971;R<=102973;R++)ae[R]=0;for(R=102975;R<=102989;R++)ae[R]=0;for(R=102990;R<=102992;R++)ae[R]=1;for(R=102997;R<=103002;R++)ae[R]=0;for(R=103003;R<=103008;R++)ae[R]=2;for(R=103009;R<=103011;R++)ae[R]=0;for(R=103012;R<=103014;R++)ae[R]=2;for(R=103019;R<=103021;R++)ae[R]=0;for(R=103022;R<=103024;R++)ae[R]=2;for(R=103029;R<=103031;R++)ae[R]=0;for(R=103032;R<=103034;R++)ae[R]=2;for(R=103065;R<=103068;R++)ae[R]=0;for(R=103074;R<=103076;R++)ae[R]=0;for(R=103077;R<=103079;R++)ae[R]=1;for(R=103080;R<=103082;R++)ae[R]=0;for(R=103083;R<=103085;R++)ae[R]=2;for(R=103090;R<=103093;R++)ae[R]=0;for(R=103097;R<=103099;R++)ae[R]=0;for(R=103100;R<=103102;R++)ae[R]=2;for(R=103107;R<=103109;R++)ae[R]=0;for(R=103110;R<=103112;R++)ae[R]=2;for(R=103113;R<=103116;R++)ae[R]=0;for(R=103117;R<=103120;R++)ae[R]=2;for(R=103153;R<=103157;R++)ae[R]=0;for(R=103158;R<=103162;R++)ae[R]=2;for(R=103163;R<=103165;R++)ae[R]=0;for(R=103166;R<=103168;R++)ae[R]=1;for(R=103169;R<=103171;R++)ae[R]=2;for(R=103186;R<=103188;R++)ae[R]=0;for(R=103189;R<=103191;R++)ae[R]=2;for(R=103192;R<=103195;R++)ae[R]=0;for(R=103196;R<=103199;R++)ae[R]=2;for(R=103200;R<=103224;R++)ae[R]=0;for(R=103225;R<=103227;R++)ae[R]=1;for(R=103232;R<=103237;R++)ae[R]=0;for(R=103238;R<=103243;R++)ae[R]=2;for(R=103244;R<=103246;R++)ae[R]=0;for(R=103247;R<=103249;R++)ae[R]=2;for(R=103254;R<=103256;R++)ae[R]=0;for(R=103257;R<=103259;R++)ae[R]=2;for(R=103264;R<=103266;R++)ae[R]=0;for(R=103267;R<=103269;R++)ae[R]=2;for(R=103300;R<=103375;R++)ae[R]=0;for(R=103381;R<=103383;R++)ae[R]=0;for(R=103384;R<=103386;R++)ae[R]=1;for(R=103387;R<=103389;R++)ae[R]=0;for(R=103390;R<=103392;R++)ae[R]=2;for(R=103397;R<=103399;R++)ae[R]=0;for(R=103400;R<=103471;R++)ae[R]=2;for(R=103476;R<=103478;R++)ae[R]=0;for(R=103479;R<=103481;R++)ae[R]=2;for(R=103486;R<=103488;R++)ae[R]=0;for(R=103489;R<=103491;R++)ae[R]=2;for(R=103492;R<=103495;R++)ae[R]=0;for(R=103496;R<=103499;R++)ae[R]=2;for(R=103528;R<=103543;R++)ae[R]=0;for(R=103544;R<=103548;R++)ae[R]=2;for(R=103549;R<=103551;R++)ae[R]=0;for(R=103552;R<=103554;R++)ae[R]=1;for(R=103555;R<=103557;R++)ae[R]=2;for(R=103558;R<=103560;R++)ae[R]=0;for(R=103571;R<=103573;R++)ae[R]=0;for(R=103574;R<=103576;R++)ae[R]=2;for(R=103577;R<=103580;R++)ae[R]=0;for(R=103581;R<=103583;R++)ae[R]=2;for(R=103595;R<=103694;R++)ae[R]=0;for(R=103696;R<=103699;R++)ae[R]=0;for(R=103700;R<=103793;R++)ae[R]=2;for(R=103794;R<=103890;R++)ae[R]=0;for(R=103891;R<=103896;R++)ae[R]=2;for(R=103900;R<=103971;R++)ae[R]=2;for(R=103972;R<=103977;R++)ae[R]=0;for(R=112e3;R<=112101;R++)ae[R]=0;const SWe={102113:!0,102100:!0,3857:!0,3785:!0},TWe={4326:!0,3785:!0,3857:!0,102113:!0,102100:!0,104905:!0,104971:!0},Whe='PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]',F6=[-20037508342788905e-9,20037508342788905e-9],k6=[-20037508342787e-6,20037508342787e-6],QTe={102113:{wkTemplate:'PROJCS["WGS_1984_Web_Mercator",GEOGCS["GCS_WGS_1984_Major_Auxiliary_Sphere",DATUM["D_WGS_1984_Major_Auxiliary_Sphere",SPHEROID["WGS_1984_Major_Auxiliary_Sphere",6378137.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]',valid:F6,origin:k6,dx:1e-5},102100:{wkTemplate:Whe,valid:F6,origin:k6,dx:1e-5},3785:{wkTemplate:'PROJCS["WGS_1984_Web_Mercator",GEOGCS["GCS_WGS_1984_Major_Auxiliary_Sphere",DATUM["D_WGS_1984_Major_Auxiliary_Sphere",SPHEROID["WGS_1984_Major_Auxiliary_Sphere",6378137.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]',valid:F6,origin:k6,dx:1e-5},3857:{wkTemplate:Whe,valid:F6,origin:k6,dx:1e-5},4326:{wkTemplate:'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",{Central_Meridian}],UNIT["Degree",0.0174532925199433]]',altTemplate:'PROJCS["WGS_1984_Plate_Carree",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Plate_Carree"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],UNIT["Degrees",111319.491]]',valid:[-180,180],origin:[-180,90],dx:1e-5},104971:{wkTemplate:'GEOGCS["Mars_2000_(Sphere)",DATUM["Mars_2000_(Sphere)",SPHEROID["Mars_2000_(Sphere)",3396190.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]',valid:[-180,180],origin:[-180,90],dx:1e-5},104905:{wkTemplate:'GEOGCS["GCS_Mars_2000",DATUM["D_Mars_2000",SPHEROID["Mars_2000_IAU_IAG",3396190.0,169.8944472236118]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]',valid:[-180,180],origin:[-180,90],dx:1e-5}};function jn(t,e){if(t===e)return!0;if(t==null||e==null)return!1;if(t.wkid!=null||e.wkid!=null)return t.wkid===e.wkid||FT(t)&&FT(e)||e.latestWkid!=null&&t.wkid===e.latestWkid||t.latestWkid!=null&&e.wkid===t.latestWkid;const i=t.wkt2??t.wkt,r=e.wkt2??e.wkt;return!(!i||!r)&&i.toUpperCase()===r.toUpperCase()}function gp(t){return Sc(t)&&t.wkid&&QTe[t.wkid]||null}function YO(t){if(!t)return;if(t.wkid)return String(t.wkid);const e=t.wkt||t.wkt2;return JSON.stringify(e?{wkt:e}:{})}function cB(t){if(!Sc(t))return!1;if(t.wkid)return ae[t.wkid]==null;const e=t.wkt2||t.wkt;return!!e&&/^\s*(?:GEOGCS|GEOGCRS|GEOGRAPHICCRS)/i.test(e)}function XO(t){return!(u1(t)||h1(t))}function gL(t){return Sc(t)&&t.wkid===4326}function $Zt(t){return/^\s*(?:GEOD|GEODETIC|GEOG|GEOGRAPHIC|PROJ|PROJECTED|VERT|VERTICAL|ENG|ENGINEERING|PARAMETRIC|TIME|DERIVEDPROJ|COMPOUND|BOUND)CRS/i.test(t)}function eEe(t){return Sc(t)&&t.wkid===Cf.CGCS2000}function FT(t){return Sc(t)&&t.wkid!=null&&SWe[t.wkid]===!0}function yL(t){return Sc(t)&&t.wkid===32662}function Une(t){return t===Cf.GCSMARS2000||t===Cf.GCSMARS2000_SPHERE}function u1(t){return Sc(t)&&t.wkid!=null&&Une(t.wkid)}function Vne(t){return t===Cf.GCSMOON2000}function h1(t){return Sc(t)&&t.wkid!=null&&Vne(t.wkid)}function EWe(t){return Sc(t)&&t.wkid!=null&&TWe[t.wkid]===!0}function Sc(t){return t!=null&&(t.wkid!=null&&t.wkid>=2e3||t.wkt2!=null||t.wkt!=null)}const CWe={wkid:4326,wkt:w9(QTe[4326].wkTemplate,{Central_Meridian:"0.0"})},AWe={wkid:102100,latestWkid:3857},MWe={wkid:32662};function Bne(t){return{wkt:`GEOCCS["Spherical geocentric", DATUM["Not specified", SPHEROID["Sphere",${t.radius},0]], PRIMEM["Greenwich",0.0, @@ -33,9 +12,9 @@ AXIS["Geocentric X",OTHER], AXIS["Geocentric Y",EAST], AXIS["Geocentric Z",NORTH] - ]`}}const NCe=qne(Mr),hB=qne(Sy),dB=qne(u_),FCe={wkt:`GEOCCS["WGS 84", + ]`}}const tEe=Bne(Or),uB=Bne(My),hB=Bne(y_),iEe={wkt:`GEOCCS["WGS 84", DATUM["WGS_1984", - SPHEROID["WGS 84",${Mr.radius},298.257223563, + SPHEROID["WGS 84",${Or.radius},298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0, @@ -46,30 +25,40 @@ AXIS["Geocentric Y",OTHER], AXIS["Geocentric Z",NORTH], AUTHORITY["EPSG","4978"] -]`};function Sr(t){return t!=null&&(r1(t)||Zn(t,hB))?Sy:t!=null&&(n1(t)||Zn(t,dB))?u_:Mr}function RXt(t){return Gne(t)?Sy:Hne(t)?u_:Mr}function Az(t){return Zn(t,NCe)}function A2(t){return Az(t)||Zn(t,hB)||Zn(t,dB)}const Wne=39.37,EKe=Mr.radius*Math.PI/200,kCe=/(?:LENGTH)?UNIT\[([^\]]+)]]$/i,cT=ae,zCe=/UNIT\[([^\]]+)]/i,CKe=new Set([4261,4305,4807,4810,4811,4812,4816,4819,4821,4901,4902,37225,104139,104140]),AKe=fu()({meter:"meters",foot:"feet",foot_us:"us-feet",foot_clarke:"clarke-feet",yard_clarke:"clarke-yards",link_clarke:"clarke-links",yard_sears:"sears-yards",foot_sears:"sears-feet",chain_sears:"sears-chains",chain_benoit_1895_b:"benoit-1895-b-chains",yard_indian:"indian-yards",yard_indian_1937:"indian-1937-yards",foot_gold_coast:"gold-coast-feet",chain_sears_1922_truncated:"sears-1922-truncated-chains","50_kilometers":"50-kilometers","150_kilometers":"150-kilometers"}),Zm=t=>t*t,ib=t=>t*t*t,hL={length:{baseUnit:"meters",units:{millimeters:{inBaseUnits:.001},centimeters:{inBaseUnits:.01},decimeters:{inBaseUnits:.1},meters:{inBaseUnits:1},kilometers:{inBaseUnits:1e3},inches:{inBaseUnits:.0254},feet:{inBaseUnits:.3048},yards:{inBaseUnits:.9144},miles:{inBaseUnits:1609.344},"nautical-miles":{inBaseUnits:1852},"us-feet":{inBaseUnits:1200/3937}}},area:{baseUnit:"square-meters",units:{"square-millimeters":{inBaseUnits:Zm(.001)},"square-centimeters":{inBaseUnits:Zm(.01)},"square-decimeters":{inBaseUnits:Zm(.1)},"square-meters":{inBaseUnits:1},"square-kilometers":{inBaseUnits:Zm(1e3)},"square-inches":{inBaseUnits:Zm(.0254)},"square-feet":{inBaseUnits:Zm(.3048)},"square-yards":{inBaseUnits:Zm(.9144)},"square-miles":{inBaseUnits:Zm(1609.344)},"square-us-feet":{inBaseUnits:Zm(1200/3937)},acres:{inBaseUnits:.0015625*Zm(1609.344)},ares:{inBaseUnits:100},hectares:{inBaseUnits:1e4}}},volume:{baseUnit:"liters",units:{liters:{inBaseUnits:1},"cubic-millimeters":{inBaseUnits:1e3*ib(.001)},"cubic-centimeters":{inBaseUnits:1e3*ib(.01)},"cubic-decimeters":{inBaseUnits:1e3*ib(.1)},"cubic-meters":{inBaseUnits:1e3},"cubic-kilometers":{inBaseUnits:1e3*ib(1e3)},"cubic-inches":{inBaseUnits:1e3*ib(.0254)},"cubic-feet":{inBaseUnits:1e3*ib(.3048)},"cubic-yards":{inBaseUnits:1e3*ib(.9144)},"cubic-miles":{inBaseUnits:1e3*ib(1609.344)}}},angle:{baseUnit:"radians",units:{radians:{inBaseUnits:1},degrees:{inBaseUnits:Math.PI/180}}}},MKe=(()=>{const t={};for(const e in hL)for(const i in hL[e].units)t[i]=e;return t})();function OKe(t,e,i){return t*hL[i].units[e].inBaseUnits}function PKe(t,e,i){return t/hL[i].units[e].inBaseUnits}const RKe=["metric","imperial","square-inches","square-feet","square-yards","square-miles","square-us-feet","square-meters","square-kilometers","acres","ares","hectares"],dL=["metric","imperial","inches","feet","yards","miles","nautical-miles","us-feet","meters","kilometers"],IKe=new Map([["meters","square-meters"],["feet","square-feet"],["us-feet","square-us-feet"]]);function $Ke(t){return t==="imperial"||t==="metric"}function DT(t){const e=MKe[t];if(!e)throw new Error("unknown type");return e}function kde(t,e=null){return e=e||DT(t),hL[e].baseUnit===t}function Ur(t,e,i){if(e===i)return t;const r=DT(e);if(r!==DT(i))throw new Error("incompatible units");const n=kde(e,r)?t:OKe(t,e,r);return kde(i,r)?n:PKe(n,i,r)}function LKe(t){switch(t){case"metric":return"meters";case"imperial":return"feet";default:return t}}function IXt(t){return LKe(t)}function $Xt(t){switch(t){case"metric":return"square-meters";case"imperial":return"square-feet";default:return t}}function DKe(t,e,i){switch(i){case"metric":return Yne(t,e);case"imperial":return Zne(t,e);default:return i}}function NKe(t,e,i){switch(i){case"metric":return Xne(t,e);case"imperial":return Jne(t,e);default:return i}}function Yne(t,e){const i=Ur(t,e,"meters");return Math.abs(i)<3e3?"meters":"kilometers"}function Xne(t,e){const i=Ur(t,e,"meters");return Math.abs(i)<1e5?"meters":"kilometers"}function Zne(t,e){const i=Ur(t,e,"feet");return Math.abs(i)<1e3?"feet":"miles"}function Jne(t,e){const i=Ur(t,e,"feet");return Math.abs(i)<1e5?"feet":"miles"}function FKe(t,e){const i=Ur(t,e,"square-meters");return Math.abs(i)<3e6?"square-meters":"square-kilometers"}function kKe(t,e){const i=Ur(t,e,"square-feet");return Math.abs(i)<1e6?"square-feet":"square-miles"}function UCe(t,e,i){return Ur(t,e,"meters")/(i*Math.PI/180)}function VCe(t){return AKe.fromJSON(t.toLowerCase())||null}function Bf(t){if(t!=null&&!VO(t))return 1;const e=ws(t);return e>1e5?1:e}function BCe(t){return ws(t)>=Sr(t).metersPerDegree?"meters":A9(t)}function ws(t,e=Mr.metersPerDegree){return jCe(t,!0)??e}function jCe(t,e=!1){const i=(t==null?void 0:t.wkid)??null,r=(t==null?void 0:t.wkt2)??(t==null?void 0:t.wkt)??null;let n=null;if(i){if(Gne(i))return Sy.metersPerDegree;if(Hne(i))return u_.metersPerDegree;n=cT.values[cT[i]],!n&&e&&CKe.has(i)&&(n=EKe)}else r&&(Kne(r)?n=zde(kCe.exec(r),n):HCe(r)&&(n=zde(zCe.exec(r),n)));return n}function DZ(t){return uB(t)?1:ws(t)}function zde(t,e){return t!=null&&t[1]?GCe(t[1]):e}function GCe(t){return parseFloat(t.split(",")[1])}function A9(t){const e=(t==null?void 0:t.wkid)??null,i=(t==null?void 0:t.wkt2)??(t==null?void 0:t.wkt)??null;let r=null;if(e)r=cT.units[cT[e]];else if(i){const n=Kne(i)?kCe:HCe(i)?zCe:null;if(n){const s=n.exec(i);s!=null&&s[1]&&(r=UKe(s[1]))}}return r!=null?VCe(r):null}function LXt(t){const e=A9(t);return e!=null&&dL.includes(e)?e:null}function DXt(t){const e=BCe(t);return e!=null&&dL.includes(e)?e:null}function NXt(t){const e=A9(t);return e==null?null:IKe.get(e)}function HCe(t){return/^GEOCCS/i.test(t)}function Kne(t){return/^\s*(?:PROJCS|PROJCRS|PROJECTEDCRS)/i.test(t)}const zKe=1e-7;function UKe(t){const e=/[\\"']{1}([^\\"']+)/.exec(t);let i=e==null?void 0:e[1];if(!i||!cT.units.includes(i)){const r=GCe(t);i=null;const n=cT.values;for(let s=0;s{let e=class extends t{constructor(...i){super(...i),this._loadController=null,this.loadError=null,this.loadStatus="not-loaded",this._set("loadWarnings",[]),this.addResolvingPromise(new Promise(r=>{const n=this.load.bind(this);this.load=s=>{const o=new Promise((l,c)=>{const f=g9(s,c);this.destroyed&&c(new se("load:instance-destroyed",`Instance of '${this.declaredClass||this.constructor.name}' is already destroyed`,{instance:this})),this.when(l,c).finally(()=>{f&&f.remove()})});if(this.loadStatus===HKe){this._set("loadStatus",qKe);const l=this._loadController=new AbortController;n({signal:l.signal})}return r(),o}})),this.when(()=>{this._set("loadStatus",Ude),this._loadController=null},r=>{this._set("loadStatus",WKe),this._set("loadError",r),this._loadController=null})}destroy(){this._loadController&&(this._loadController=gn(this._loadController),this._promiseProps.abort()),this._set("loadError",null),this._set("loadWarnings",[])}get loaded(){return this.loadStatus===Ude}get loadWarnings(){return this._get("loadWarnings")}load(){return null}cancelLoad(){var i;return this.isFulfilled()||(this._set("loadError",new se("load:cancelled","Cancelled")),(i=this._loadController)==null||i.abort(),this._promiseProps.abort()),this}};return y([w({readOnly:!0})],e.prototype,"loaded",null),y([w({readOnly:!0})],e.prototype,"loadError",void 0),y([w({clonable:!1})],e.prototype,"loadStatus",void 0),y([w({type:[Uf],readOnly:!0})],e.prototype,"loadWarnings",null),e=y([Z("esri.core.Loadable")],e),e};let e4=class extends qCe(uz){};e4=y([Z("esri.core.Loadable")],e4),function(t){function e(i){return!(!i||!i.load)}t.LoadableMixin=qCe,t.isLoadable=e}(e4||(e4={}));const jf=e4;function $t(t,e,i){let r,n;return e===void 0||Array.isArray(e)?(n=t,i=e,r=[void 0]):(n=e,r=Array.isArray(t)?t:[t]),(s,o)=>{const l=s.constructor.prototype;r.forEach(c=>{const f=tne(s,c,n);f.read&&typeof f.read=="object"||(f.read={}),f.read.reader=l[o],i&&(f.read.source=(f.read.source||[]).concat(i))})}}function Pt(t,e,i){let r,n;return e===void 0?(n=t,r=[void 0]):typeof e!="string"?(n=t,r=[void 0],i=e):(n=e,r=Array.isArray(t)?t:[t]),(s,o)=>{const l=s.constructor.prototype;for(const c of r){const f=tne(s,c,n);f.write&&typeof f.write=="object"||(f.write={}),i&&(f.write.target=i),f.write.writer=l[o]}}}var yg;let An=yg=class extends Ue{static fromJSON(t){if(!t)return null;if(t.wkid){if(t.wkid===102100)return yg.WebMercator;if(t.wkid===4326)return yg.WGS84}const e=new yg;return e.read(t),e}constructor(t){super(t),this.latestWkid=null,this.wkid=null,this.wkt=null,this.wkt2=null,this.vcsWkid=null,this.latestVcsWkid=null,this.imageCoordinateSystem=null}normalizeCtorArgs(t){return t&&typeof t=="object"?t:{[typeof t=="string"?"wkt":"wkid"]:t}}get isWGS84(){return cL(this)}get isWebMercator(){return LT(this)}get isGeographic(){return uB(this)}get isWrappable(){return wKe(this)}get metersPerUnit(){return ws(this)}get unit(){return A9(this)||(this.isGeographic?"degrees":null)}writeWkt(t,e){this.wkid||(e.wkt=t)}clone(){if(this===yg.WGS84)return yg.WGS84;if(this===yg.WebMercator)return yg.WebMercator;const t=new yg;return this.wkid!=null?(t.wkid=this.wkid,this.latestWkid!=null&&(t.latestWkid=this.latestWkid),this.vcsWkid!=null&&(t.vcsWkid=this.vcsWkid),this.latestVcsWkid!=null&&(t.latestVcsWkid=this.latestVcsWkid)):(this.wkt!=null&&(t.wkt=this.wkt),this.wkt2!=null&&(t.wkt2=this.wkt2)),this.imageCoordinateSystem&&(t.imageCoordinateSystem=Re(this.imageCoordinateSystem)),t}equals(t){if(t==null)return!1;if(this.imageCoordinateSystem||t.imageCoordinateSystem){if(this.imageCoordinateSystem==null||t.imageCoordinateSystem==null)return!1;const{id:e,referenceServiceName:i}=t.imageCoordinateSystem,{geodataXform:r}=t.imageCoordinateSystem,n=this.imageCoordinateSystem;return e==null||r?JSON.stringify(n)===JSON.stringify(t.imageCoordinateSystem):i?n.id===e&&n.referenceServiceName===i:n.id===e}return Zn(this,t)}toJSON(t){return this.write(void 0,t)}};An.GCS_NAD_1927=null,An.WGS84=null,An.WebMercator=null,An.PlateCarree=null,y([w({readOnly:!0})],An.prototype,"isWGS84",null),y([w({readOnly:!0})],An.prototype,"isWebMercator",null),y([w({readOnly:!0})],An.prototype,"isGeographic",null),y([w({readOnly:!0})],An.prototype,"isWrappable",null),y([w({type:$n,json:{write:!0}})],An.prototype,"latestWkid",void 0),y([w({readOnly:!0})],An.prototype,"metersPerUnit",null),y([w({readOnly:!0})],An.prototype,"unit",null),y([w({type:$n,json:{write:!0,origins:{"web-scene":{write:{overridePolicy(){return{isRequired:this.wkt==null}}}}}}})],An.prototype,"wkid",void 0),y([w({type:String,json:{origins:{"web-scene":{write:{overridePolicy(){return{isRequired:this.wkid==null}}}}}}})],An.prototype,"wkt",void 0),y([Pt("wkt"),Pt("web-scene","wkt")],An.prototype,"writeWkt",null),y([w({type:String,json:{write:!1}})],An.prototype,"wkt2",void 0),y([w({type:$n,json:{write:!0}})],An.prototype,"vcsWkid",void 0),y([w({type:$n,json:{write:!0}})],An.prototype,"latestVcsWkid",void 0),y([w()],An.prototype,"imageCoordinateSystem",void 0),An=yg=y([Z("esri.geometry.SpatialReference")],An),An.prototype.toJSON.isDefaultToJSON=!0,An.GCS_NAD_1927=new An({wkid:4267,wkt:'GEOGCS["GCS_North_American_1927",DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]'}),An.WGS84=new An(xKe),An.WebMercator=new An(SKe),An.PlateCarree=new An(TKe),Object.freeze&&(Object.freeze(An.GCS_NAD_1927),Object.freeze(An.WGS84),Object.freeze(An.WebMercator));const at=An;let vg=class extends Ue{constructor(...e){super(...e),this.type=null,this.hasM=!1,this.hasZ=!1,this.spatialReference=at.WGS84}get cache(){return this.commitProperty("spatialReference"),{}}get extent(){return null}readSpatialReference(e,i){if(e instanceof at)return e;if(e!=null){const r=new at;return r.read(e,i),r}return e}clone(){return console.warn(".clone() is not implemented for "+this.declaredClass),null}clearCache(){this.notifyChange("cache")}getCacheValue(e){return this.cache[e]}setCacheValue(e,i){this.cache[e]=i}};y([w()],vg.prototype,"type",void 0),y([w({readOnly:!0})],vg.prototype,"cache",null),y([w({readOnly:!0})],vg.prototype,"extent",null),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],vg.prototype,"hasM",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],vg.prototype,"hasZ",void 0),y([w({type:at,json:{write:!0},value:at.WGS84})],vg.prototype,"spatialReference",void 0),y([$t("spatialReference")],vg.prototype,"readSpatialReference",null),vg=y([Z("esri.geometry.Geometry")],vg);const ix=vg;function YKe(t,e){const i=t.x-e.x,r=t.y-e.y,n=t.hasZ&&e.hasZ?t.z-e.z:0;return Math.sqrt(i*i+r*r+n*n)}const XKe=57.29577951308232,ZKe=.017453292519943;function Vde(t){return t*XKe}function Bde(t){return t*ZKe}function jde(t){return t/Mr.radius}function Mz(t){return Math.PI/2-2*Math.atan(Math.exp(-t/Mr.radius))}function NZ(t){return t.wkid!=null||t.wkt!=null}const mH=[0,0];function Oz(t,e,i,r,n){const s=t,o=n;if(o.spatialReference=i,"x"in s&&"x"in o)[o.x,o.y]=e(s.x,s.y,mH,r);else if("xmin"in s&&"xmin"in o)[o.xmin,o.ymin]=e(s.xmin,s.ymin,mH,r),[o.xmax,o.ymax]=e(s.xmax,s.ymax,mH,r);else if("paths"in s&&"paths"in o||"rings"in s&&"rings"in o){const l="paths"in s?s.paths:s.rings,c=[];let f;for(let _=0;_2&&f[T].push(x[T][2]),x[T].length>3&&f[T].push(x[T][3])}"paths"in o?o.paths=c:o.rings=c}else if("points"in s&&"points"in o){const l=s.points,c=[];for(let f=0;f2&&c[f].push(l[f][2]),l[f].length>3&&c[f].push(l[f][3]);o.points=c}return n}function HI(t,e){const i=t&&(NZ(t)?t:t.spatialReference),r=e&&(NZ(e)?e:e.spatialReference);return!(t&&"type"in t&&t.type==="mesh"||e&&"type"in e&&e.type==="mesh"||!i||!r)&&(!!Zn(r,i)||LT(r)&&cL(i)||LT(i)&&cL(r))}function rP(t,e){if(t==null)return null;const i=t.spatialReference,r=e&&(NZ(e)?e:e.spatialReference);return HI(i,r)?Zn(i,r)?Re(t):LT(r)?Oz(t,xM,at.WebMercator,!1,Re(t)):cL(r)?Oz(t,qI,at.WGS84,!1,Re(t)):null:null}function xM(t,e,i=[0,0]){e>89.99999?e=89.99999:e<-89.99999&&(e=-89.99999);const r=Bde(e);return i[0]=Bde(t)*Mr.radius,i[1]=Mr.halfSemiMajorAxis*Math.log((1+Math.sin(r))/(1-Math.sin(r))),i}function qI(t,e,i=[0,0],r=!1){const n=Vde(t/Mr.radius);return i[0]=r?n:n-360*Math.floor((n+180)/360),i[1]=Vde(Math.PI/2-2*Math.atan(Math.exp(-e/Mr.radius))),i}function Ty(t,e=!1,i=Re(t)){return Oz(t,xM,at.WebMercator,e,i)}function HS(t,e=!1,i=Re(t)){return Oz(t,qI,at.WGS84,e,i)}var b7;const jP=[0,0];function Gde(t){return t&&(t.declaredClass==="esri.geometry.SpatialReference"||t.wkid!=null)}let Eu=b7=class extends ix{static copy(t,e){e._set("x",t._get("x")),e._set("y",t._get("y")),e._set("z",t._get("z")),e._set("m",t._get("m"));const i=t._get("spatialReference");e._set("spatialReference",Object.isFrozen(i)?i:i.clone())}constructor(...t){super(...t),this.x=0,this.y=0,this.z=void 0,this.m=void 0,this.type="point"}normalizeCtorArgs(t,e,i,r,n){let s;if(Array.isArray(t))s=t,n=e,t=s[0],e=s[1],i=s[2],r=s[3];else if(t&&typeof t=="object"){if(s=t,t=s.x!=null?s.x:s.longitude,e=s.y!=null?s.y:s.latitude,i=s.z,r=s.m,(n=s.spatialReference)&&n.declaredClass!=="esri.geometry.SpatialReference"&&(n=new at(n)),s.longitude!=null||s.latitude!=null){if(s.longitude==null)Ce.getLogger(this).warn(".longitude=","Latitude was defined without longitude");else if(s.latitude==null)Ce.getLogger(this).warn(".latitude=","Longitude was defined without latitude");else if(!s.declaredClass&&n&&n.isWebMercator){const l=xM(s.longitude,s.latitude,jP);t=l[0],e=l[1]}}}else Gde(i)?(n=i,i=null):Gde(r)&&(n=r,r=null);const o={x:t,y:e};return o.x==null&&o.y!=null?Ce.getLogger(this).warn(".y=","Y coordinate was defined without an X coordinate"):o.y==null&&o.x!=null&&Ce.getLogger(this).warn(".x=","X coordinate was defined without a Y coordinate"),n!=null&&(o.spatialReference=n),i!=null&&(o.z=i),r!=null&&(o.m=r),o}get cache(){return this.commitProperty("x"),this.commitProperty("y"),this.commitProperty("z"),this.commitProperty("m"),this.commitProperty("spatialReference"),{}}get hasM(){return this.m!==void 0}set hasM(t){t!==(this._get("m")!==void 0)&&(this._set("m",t?0:void 0),this._set("hasM",t))}get hasZ(){return this.z!==void 0}set hasZ(t){t!==(this._get("z")!==void 0)&&(this._set("z",t?0:void 0),this._set("hasZ",t))}get latitude(){const{spatialReference:t,x:e,y:i}=this;if(t){if(t.isWebMercator)return qI(e,i,jP)[1];if(t.isGeographic)return i}return null}set latitude(t){const{spatialReference:e,x:i}=this;t!=null&&e&&(e.isWebMercator?this._set("y",xM(i,t,jP)[1]):e.isGeographic&&this._set("y",t),this._set("latitude",t))}get longitude(){const{x:t,y:e,spatialReference:i}=this;if(i){if(i.isWebMercator)return qI(t,e,jP)[0];if(i.isGeographic)return t}return null}set longitude(t){const{y:e,spatialReference:i}=this;t!=null&&i&&(i.isWebMercator?this._set("x",xM(t,e,jP)[0]):i.isGeographic&&this._set("x",t),this._set("longitude",t))}writeX(t,e,i){e[i]=isNaN(t)?"NaN":t}readX(t){return typeof t=="string"?NaN:t}clone(){const t=new b7;return t.x=this.x,t.y=this.y,t.z=this.z,t.m=this.m,t.spatialReference=this.spatialReference,t}copy(t){return b7.copy(t,this),this}equals(t){if(t==null)return!1;const{x:e,y:i,z:r,m:n,spatialReference:s}=this,{z:o,m:l}=t;let{x:c,y:f,spatialReference:_}=t;if(!s.equals(_))if(s.isWebMercator&&_.isWGS84)[c,f]=xM(c,f),_=s;else{if(!s.isWGS84||!_.isWebMercator)return!1;[c,f]=qI(c,f),_=s}return e===c&&i===f&&r===o&&n===l&&s.wkid===_.wkid}offset(t,e,i){return this.x+=t,this.y+=e,i!=null&&(this.z=(this.z??0)+i),this}normalize(){if(!this.spatialReference)return this;const t=pp(this.spatialReference);if(!t)return this;let e=this.x;const[i,r]=t.valid,n=2*r;let s;return e>r?(s=Math.ceil(Math.abs(e-r)/n),e-=s*n):eisNaN(t)?t:Vh(t))],Eu.prototype,"x",void 0),y([Pt("x")],Eu.prototype,"writeX",null),y([$t("x")],Eu.prototype,"readX",null),y([w({type:Number,json:{write:!0}})],Eu.prototype,"y",void 0),y([w({type:Number,json:{write:{overridePolicy(){return{enabled:this.hasZ}}}}})],Eu.prototype,"z",void 0),y([w({type:Number,json:{write:{overridePolicy(){return{enabled:this.hasM}}}}})],Eu.prototype,"m",void 0),Eu=b7=y([Z("esri.geometry.Point")],Eu),Eu.prototype.toJSON.isDefaultToJSON=!0;const mt=Eu,gH=[0,0];function Qne(t,e){return e!=null&&Kc(t,e.x,e.y,e.z)}function BXt(t,e){if(!e.points||e.points.length)return!1;for(const i of e.points)if(!BO(t,i))return!1;return!0}function JKe(t,e){const{xmin:i,ymin:r,zmin:n,xmax:s,ymax:o,zmax:l}=e;return t.hasZ&&e.hasZ?Kc(t,i,r,n)&&Kc(t,i,o,n)&&Kc(t,s,o,n)&&Kc(t,s,r,n)&&Kc(t,i,r,l)&&Kc(t,i,o,l)&&Kc(t,s,o,l)&&Kc(t,s,r,l):Kc(t,i,r)&&Kc(t,i,o)&&Kc(t,s,o)&&Kc(t,s,r)}function BO(t,e){return Kc(t,e[0],e[1])}function KKe(t,e){return Kc(t,e[0],e[1],e[2])}function Kc(t,e,i,r){return e>=t.xmin&&e<=t.xmax&&i>=t.ymin&&i<=t.ymax&&(r==null||!t.hasZ||r>=t.zmin&&r<=t.zmax)}function QKe(t,e){return gH[1]=e.y,gH[0]=e.x,eQe(t,gH)}function eQe(t,e){return WCe(t.rings,e)}function WCe(t,e){if(!t)return!1;if(tQe(t))return Hde(!1,t,e);let i=!1;for(let r=0,n=t.length;r=n||T=n)&&f+(n-_)/(T-_)*(x-f)=0&&U<=1&&j>=0&&j<=1&&(n&&(n[0]=s+U*(l-s),n[1]=o+U*(c-o)),!0)}function uQe(t){switch(t){case"esriGeometryEnvelope":case"extent":return rQe;case"esriGeometryMultipoint":case"multipoint":return nQe;case"esriGeometryPoint":case"point":return iQe;case"esriGeometryPolygon":case"polygon":return oQe;case"esriGeometryPolyline":case"polyline":return lQe}}var Vp;function hQe(t){return t&&(t.declaredClass==="esri.geometry.SpatialReference"||t.wkid!=null)}function rb(t,e,i){return e==null?i:i==null?e:t(e,i)}let ul=Vp=class extends ix{constructor(...t){super(...t),this.type="extent",this.xmin=0,this.ymin=0,this.mmin=void 0,this.zmin=void 0,this.xmax=0,this.ymax=0,this.mmax=void 0,this.zmax=void 0}normalizeCtorArgs(t,e,i,r,n){return hQe(t)?{spatialReference:t,xmin:0,ymin:0,xmax:0,ymax:0}:typeof t=="object"?(t.spatialReference=t.spatialReference==null?at.WGS84:t.spatialReference,t):{xmin:t,ymin:e,xmax:i,ymax:r,spatialReference:n??at.WGS84}}static fromBounds(t,e){return new Vp({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3],spatialReference:e})}static fromPoint(t){return new Vp({xmin:t.x,ymin:t.y,zmin:t.z,xmax:t.x,ymax:t.y,zmax:t.z,spatialReference:t.spatialReference})}get cache(){return this.commitProperty("xmin"),this.commitProperty("ymin"),this.commitProperty("zmin"),this.commitProperty("mmin"),this.commitProperty("xmax"),this.commitProperty("ymax"),this.commitProperty("zmax"),this.commitProperty("mmax"),this.commitProperty("spatialReference"),{}}get center(){const t=new mt({x:.5*(this.xmin+this.xmax),y:.5*(this.ymin+this.ymax),spatialReference:this.spatialReference});return this.hasZ&&(t.z=.5*(this.zmin+this.zmax)),this.hasM&&(t.m=.5*(this.mmin+this.mmax)),t}get extent(){return this.clone()}get hasM(){return this.mmin!=null&&this.mmax!=null}get hasZ(){return this.zmin!=null&&this.zmax!=null}get height(){return Math.abs(this.ymax-this.ymin)}get width(){return Math.abs(this.xmax-this.xmin)}centerAt(t){const e=this.center;return t.z!=null&&this.hasZ?this.offset(t.x-e.x,t.y-e.y,t.z-e.z):this.offset(t.x-e.x,t.y-e.y)}clone(){const t=new Vp;return t.xmin=this.xmin,t.ymin=this.ymin,t.xmax=this.xmax,t.ymax=this.ymax,t.spatialReference=this.spatialReference,this.zmin!=null&&(t.zmin=this.zmin,t.zmax=this.zmax),this.mmin!=null&&(t.mmin=this.mmin,t.mmax=this.mmax),t}contains(t){if(!t)return!1;const e=this.spatialReference,i=t.spatialReference;return e&&i&&!e.equals(i)&&HI(e,i)&&(t=e.isWebMercator?Ty(t):HS(t,!0)),t.type==="point"?Qne(this,t):t.type==="extent"&&JKe(this,t)}equals(t){if(this===t)return!0;if(t==null)return!1;const e=this.spatialReference,i=t.spatialReference;return e&&i&&!e.equals(i)&&HI(e,i)&&(t=e.isWebMercator?Ty(t):HS(t,!0)),this.xmin===t.xmin&&this.ymin===t.ymin&&this.zmin===t.zmin&&this.mmin===t.mmin&&this.xmax===t.xmax&&this.ymax===t.ymax&&this.zmax===t.zmax&&this.mmax===t.mmax}expand(t){const e=.5*(1-t),i=this.width*e,r=this.height*e;if(this.xmin+=i,this.ymin+=r,this.xmax-=i,this.ymax-=r,this.hasZ){const n=(this.zmax-this.zmin)*e;this.zmin+=n,this.zmax-=n}if(this.hasM){const n=(this.mmax-this.mmin)*e;this.mmin+=n,this.mmax-=n}return this}intersects(t){if(t==null)return!1;t.type==="mesh"&&(t=t.extent);const e=this.spatialReference,i=t.spatialReference;return e&&i&&!Zn(e,i)&&HI(e,i)&&(t=e.isWebMercator?Ty(t):HS(t,!0)),uQe(t.type)(this,t)}normalize(){const t=this._normalize(!1,!0);return Array.isArray(t)?t:[t]}offset(t,e,i){return this.xmin+=t,this.ymin+=e,this.xmax+=t,this.ymax+=e,i!=null&&(this.zmin+=i,this.zmax+=i),this}shiftCentralMeridian(){return this._normalize(!0)}union(t){return this===t||(this.xmin=Math.min(this.xmin,t.xmin),this.ymin=Math.min(this.ymin,t.ymin),this.xmax=Math.max(this.xmax,t.xmax),this.ymax=Math.max(this.ymax,t.ymax),(this.hasZ||t.hasZ)&&(this.zmin=rb(Math.min,this.zmin,t.zmin),this.zmax=rb(Math.max,this.zmax,t.zmax)),(this.hasM||t.hasM)&&(this.mmin=rb(Math.min,this.mmin,t.mmin),this.mmax=rb(Math.max,this.mmax,t.mmax))),this}intersection(t){return this===t?this:t!=null&&this.intersects(t)?(this.xmin=Math.max(this.xmin,t.xmin),this.ymin=Math.max(this.ymin,t.ymin),this.xmax=Math.min(this.xmax,t.xmax),this.ymax=Math.min(this.ymax,t.ymax),(this.hasZ||t.hasZ)&&(this.zmin=rb(Math.max,this.zmin,t.zmin),this.zmax=rb(Math.min,this.zmax,t.zmax)),(this.hasM||t.hasM)&&(this.mmin=rb(Math.max,this.mmin,t.mmin),this.mmax=rb(Math.min,this.mmax,t.mmax)),this):null}toJSON(t){return this.write({},t)}_shiftCM(t=pp(this.spatialReference)){if(!t||!this.spatialReference)return this;const e=this.spatialReference,i=this._getCM(t);if(i){const r=e.isWebMercator?HS(i):i;this.xmin-=i.x,this.xmax-=i.x,e.isWebMercator||(r.x=this._normalizeX(r.x,t).x),this.spatialReference=new at(h9((e.isWGS84?t.altTemplate:null)??t.wkTemplate,{Central_Meridian:r.x}))}return this}_getCM(t){let e=null;const[i,r]=t.valid,n=this.xmin,s=this.xmax;return n>=i&&n<=r&&s>=i&&s<=r||(e=this.center),e}_normalize(t,e,i){const r=this.spatialReference;if(!r)return this;const n=i??pp(r);if(n==null)return this;const s=this._getParts(n).map(c=>c.extent);if(s.length<2)return s[0]||this;if(s.length>2)return t?this._shiftCM(n):this.set({xmin:n.valid[0],xmax:n.valid[1]});if(t)return this._shiftCM(n);if(e)return s;let o=!0,l=!0;return s.forEach(c=>{c.hasZ||(o=!1),c.hasM||(l=!1)}),{rings:s.map(c=>{const f=[[c.xmin,c.ymin],[c.xmin,c.ymax],[c.xmax,c.ymax],[c.xmax,c.ymin],[c.xmin,c.ymin]];if(o){const _=(c.zmax-c.zmin)/2;for(let x=0;x0;if(l>2*T){const z=new Vp(cI||F?e.push({extent:new Vp(A,n,T,s,o),frameIds:[M]},{extent:new Vp(x,n,I,s,o),frameIds:[L]}):e.push({extent:new Vp(A,n,I,s,o),frameIds:[M]});this.cache._parts=e}const i=this.hasZ,r=this.hasM;if(i||r){const n={};i&&(n.zmin=this.zmin,n.zmax=this.zmax),r&&(n.mmin=this.mmin,n.mmax=this.mmax);for(let s=0;sr?(s=Math.ceil(Math.abs(t-r)/n),t-=s*n,o=s):tArray.isArray(o)?JSON.stringify(o):o));let r="";if(this.extent){const o=rP(this.extent,at.WGS84);o!=null&&(r=`${o.xmin},${o.ymin},${o.xmax},${o.ymax}`)}let n=this.query;!this.disableExtraQuery&&t.extraQuery&&(n="("+n+")"+t.extraQuery);const s={categories:i,bbox:r,q:n,filter:this.filter,num:this.num,sortField:null,sortOrder:null,start:this.start};return this.sortField&&(s.sortField=this.sortField.split(",").map(o=>pQe.toJSON(o.trim())).join(","),s.sortOrder=this.sortOrder),{query:{...e,...s}}}};y([w()],Bp.prototype,"categories",void 0),y([w()],Bp.prototype,"disableExtraQuery",void 0),y([w({type:Vi})],Bp.prototype,"extent",void 0),y([w()],Bp.prototype,"filter",void 0),y([w()],Bp.prototype,"num",void 0),y([w()],Bp.prototype,"query",void 0),y([w()],Bp.prototype,"sortField",void 0),y([w()],Bp.prototype,"sortOrder",null),y([w()],Bp.prototype,"start",void 0),Bp=kZ=y([Z("esri.portal.PortalQueryParams")],Bp);const ay=Bp;var zZ;let $a=zZ=class extends Ue{constructor(t){super(t),this.access=null,this.created=null,this.description=null,this.id=null,this.isInvitationOnly=!1,this.modified=null,this.owner=null,this.portal=null,this.snippet=null,this.sortField=null,this.sortOrder=null,this.sourceJSON=null,this.tags=null,this.title=null}get thumbnailUrl(){var i;const t=this.url,e=this.thumbnail;return t&&e&&this.portal?(i=this.portal)==null?void 0:i.normalizeUrl(`${t}/info/${e}?f=json`):null}get url(){var e;const t=(e=this.portal)==null?void 0:e.restUrl;return t?t+"/community/groups/"+this.id:null}fetchCategorySchema(t){return this.portal.request(this.url+"/categorySchema",t).then(e=>{const i=e.categorySchema||[];return i.some(r=>r.source==="contentCategorySetsGroupQuery.LivingAtlas")?this._fetchCategorySchemaSet("LivingAtlas",t):i})}fetchMembers(t){return this.portal.request(this.url+"/users",t)}getThumbnailUrl(t){let e=this.thumbnailUrl;return e&&t&&(e+=`&w=${t}`),e}toJSON(){throw new se("internal:not-yet-implemented","PortalGroup.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const e=new zZ;return e.sourceJSON=t,e.read(t),e}queryItems(t,e){let i=$s(ay,t);const r=this.portal;return parseFloat(r.currentVersion)>5?(i=i||new ay,r.queryPortal(`/content/groups/${this.id}/search`,i,"PortalItem",e)):(i=i?i.clone():new ay,i.query="group:"+this.id+(i.query?" "+i.query:""),r.queryItems(i,e))}_fetchCategorySchemaSet(t,e){const i=this.portal;return i.fetchSelf(i.authMode,!0,e).then(r=>{const n=r.contentCategorySetsGroupQuery;if(n){const s=new ay;return s.disableExtraQuery=!0,s.num=1,s.query=n,i.queryGroups(s,e)}throw new se("portal-group:fetchCategorySchema","contentCategorySetsGroupQuery value not found")}).then(r=>{if(r.total){const n=r.results[0],s=new ay;return s.num=1,s.query=`typekeywords:"${t}"`,n.queryItems(s,e)}throw new se("portal-group:fetchCategorySchema","contentCategorySetsGroupQuery group not found")}).then(r=>r.total?r.results[0].fetchData("json",e).then(n=>{const s=n==null?void 0:n.categorySchema;return s!=null&&s.length?s:[]}):[])}};y([w()],$a.prototype,"access",void 0),y([w({type:Date})],$a.prototype,"created",void 0),y([w()],$a.prototype,"description",void 0),y([w()],$a.prototype,"id",void 0),y([w()],$a.prototype,"isInvitationOnly",void 0),y([w({type:Date})],$a.prototype,"modified",void 0),y([w()],$a.prototype,"owner",void 0),y([w()],$a.prototype,"portal",void 0),y([w()],$a.prototype,"snippet",void 0),y([w()],$a.prototype,"sortField",void 0),y([w()],$a.prototype,"sortOrder",void 0),y([w()],$a.prototype,"sourceJSON",void 0),y([w()],$a.prototype,"tags",void 0),y([w()],$a.prototype,"thumbnail",void 0),y([w({readOnly:!0})],$a.prototype,"thumbnailUrl",null),y([w()],$a.prototype,"title",void 0),y([w({readOnly:!0})],$a.prototype,"url",null),$a=zZ=y([Z("esri.portal.PortalGroup")],$a);const UZ=$a;let d3=class extends ze{constructor(e){super(e),this.nextQueryParams=null,this.queryParams=null,this.results=null,this.total=null}};y([w()],d3.prototype,"nextQueryParams",void 0),y([w()],d3.prototype,"queryParams",void 0),y([w()],d3.prototype,"results",void 0),y([w()],d3.prototype,"total",void 0),d3=y([Z("esri.portal.PortalQueryResult")],d3);const fQe=d3;let z1=class extends Ue{constructor(e){super(e),this.created=null,this.id=null,this.portal=null,this.title=null,this.username=null}get url(){var i;const e=(i=this.portal)==null?void 0:i.restUrl;return e?`${e}/content/users/${this.username}/${this.id}`:null}toJSON(){throw new se("internal:not-yet-implemented","PortalFolder.toJSON is not yet implemented")}};y([w({type:Date})],z1.prototype,"created",void 0),y([w()],z1.prototype,"id",void 0),y([w()],z1.prototype,"portal",void 0),y([w()],z1.prototype,"title",void 0),y([w({readOnly:!0})],z1.prototype,"url",null),y([w()],z1.prototype,"username",void 0),z1=y([Z("esri.portal.PortalFolder")],z1);const mQe=z1;var VZ;let Zs=VZ=class extends Ue{constructor(...t){super(...t),this.access=null,this.created=null,this.culture=null,this.description=null,this.email=null,this.fullName=null,this.modified=null,this.orgId=null,this.portal=null,this.preferredView=null,this.privileges=null,this.region=null,this.role=null,this.roleId=null,this.sourceJSON=null,this.units=null,this.username=null,this.userType=null}get thumbnailUrl(){const t=this.url,e=this.thumbnail;return t&&e?this.portal.normalizeUrl(`${t}/info/${e}?f=json`):null}get userContentUrl(){var e;const t=(e=this.portal)==null?void 0:e.restUrl;return t?`${t}/content/users/${this.username}`:null}get url(){var e;const t=(e=this.portal)==null?void 0:e.restUrl;return t?`${t}/community/users/${this.username}`:null}addItem(t){const e=t&&t.item,i=t==null?void 0:t.data,r=t==null?void 0:t.folder,n={method:"post"};e&&(n.query=e.createPostQuery(),i!=null&&(typeof i=="string"?n.query.text=i:typeof i=="object"&&(n.query.text=JSON.stringify(i))));let s=this.userContentUrl;return r&&(s+="/"+(typeof r=="string"?r:r.id)),this.portal.request(s+"/addItem",n).then(o=>(e.id=o.id,e.portal=this.portal,e.loaded?e.reload():e.load()))}deleteItem(t){let e=this.userContentUrl;return t.ownerFolder&&(e+="/"+t.ownerFolder),this.portal.request(e+`/items/${t.id}/delete`,{method:"post"}).then(()=>{t.id=null,t.portal=null})}deleteItems(t){const e=this.userContentUrl+"/deleteItems",i=t.map(r=>r.id);if(i.length){const r={method:"post",query:{items:i.join(",")}};return this.portal.request(e,r).then(()=>{t.forEach(n=>{n.id=null,n.portal=null})})}return Promise.resolve(void 0)}fetchFolders(){const t={query:{num:1}};return this.portal.request(this.userContentUrl??"",t).then(e=>{let i;return i=e&&e.folders?e.folders.map(r=>{const n=mQe.fromJSON(r);return n.portal=this.portal,n}):[],i})}fetchGroups(){return this.portal.request(this.url??"").then(t=>{let e;return e=t&&t.groups?t.groups.map(i=>{const r=UZ.fromJSON(i);return r.portal=this.portal,r}):[],e})}fetchItems(t){const e=t??{};let i,r=this.userContentUrl??"";return e.folder&&(r+="/"+e.folder.id),we(()=>Promise.resolve().then(()=>x5e),void 0).then(({default:n})=>{i=n;const s={folders:!1,num:e.num||10,start:e.start||1,sortField:e.sortField||"created",sortOrder:e.sortOrder||"asc"};return this.portal.request(r,{query:s})}).then(n=>{let s;return n!=null&&n.items?(s=n.items.map(o=>{const l=i.fromJSON(o);return l.portal=this.portal,l}),Promise.all(s.map(o=>o.load())).catch(o=>o).then(()=>({items:s,nextStart:n.nextStart,total:n.total}))):{items:[],nextStart:-1,total:0}})}fetchTags(){return this.portal.request(this.url+"/tags").then(t=>t.tags)}getThumbnailUrl(t){let e=this.thumbnailUrl;return e&&t&&(e+=`&w=${t}`),e}queryFavorites(t){return this.favGroupId?(this._favGroup||(this._favGroup=new UZ({id:this.favGroupId,portal:this.portal})),this._favGroup.queryItems(t)):Promise.reject(new se("internal:unknown","Unknown internal error",{internalError:"Unknown favGroupId"}))}toJSON(){throw new se("internal:not-yet-implemented","PortalUser.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const e=new VZ;return e.sourceJSON=t,e.read(t),e}};y([w()],Zs.prototype,"access",void 0),y([w({type:Date})],Zs.prototype,"created",void 0),y([w()],Zs.prototype,"culture",void 0),y([w()],Zs.prototype,"description",void 0),y([w()],Zs.prototype,"email",void 0),y([w()],Zs.prototype,"favGroupId",void 0),y([w()],Zs.prototype,"fullName",void 0),y([w({type:Date})],Zs.prototype,"modified",void 0),y([w()],Zs.prototype,"orgId",void 0),y([w()],Zs.prototype,"portal",void 0),y([w()],Zs.prototype,"preferredView",void 0),y([w()],Zs.prototype,"privileges",void 0),y([w()],Zs.prototype,"region",void 0),y([w()],Zs.prototype,"role",void 0),y([w()],Zs.prototype,"roleId",void 0),y([w()],Zs.prototype,"sourceJSON",void 0),y([w()],Zs.prototype,"thumbnail",void 0),y([w({readOnly:!0})],Zs.prototype,"thumbnailUrl",null),y([w()],Zs.prototype,"units",void 0),y([w({readOnly:!0})],Zs.prototype,"userContentUrl",null),y([w({readOnly:!0})],Zs.prototype,"url",null),y([w()],Zs.prototype,"username",void 0),y([w()],Zs.prototype,"userType",void 0),Zs=VZ=y([Z("esri.portal.PortalUser")],Zs);const ese=Zs;var U1;let B6;const qde={PortalGroup:()=>Promise.resolve({default:UZ}),PortalItem:()=>we(()=>Promise.resolve().then(()=>x5e),void 0),PortalUser:()=>Promise.resolve({default:ese})};let wt=U1=class extends P_(jf){constructor(t){super(t),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=Ar.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(t){return typeof t=="string"?{url:t}:t}destroy(){Wde.unregister(this),this.defaultBasemap=et(this.defaultBasemap),this.defaultDevBasemap=et(this.defaultDevBasemap),this.defaultVectorBasemap=et(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=en(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(t){if(t)for(const e of t)Ar.request.trustedServers.includes(e)||Ar.request.trustedServers.push(e);return t}readDefaultBasemap(t){return this._readBasemap(t)}readDefaultDevBasemap(t){return this._readBasemap(t)}readDefaultVectorBasemap(t){return this._readBasemap(t)}get extraQuery(){var i;const t=(i=this.user)==null?void 0:i.orgId,e=!t||this.canSearchPublic;return this.id&&!e?` AND orgid:${this.id}`:null}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let t=this.url;if(t){const e=t.indexOf("/sharing");t=e>0?t.substring(0,e):this.url.replace(/\/+$/,""),t+="/sharing/rest"}return t}get thumbnailUrl(){const t=this.restUrl,e=this.thumbnail;return t&&e?this._normalizeSSL(t+"/portals/self/resources/"+e):null}readUrlKey(t){return t&&t.toLowerCase()}readUser(t){let e=null;return t&&(e=ese.fromJSON(t),e.portal=this),e}load(t){const e=we(()=>Promise.resolve().then(()=>Edt),void 0).then(({default:i})=>{St(t),B6=i}).then(()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,t)).then(i=>{var r;if(yr){const n=yr;this.credential=n.findCredential(this.restUrl),this.credential||this.authMode!==U1.AUTH_MODE_AUTO||((r=this._esriIdCredentialCreateHandle)==null||r.remove(),this._esriIdCredentialCreateHandle=n.on("credential-create",gQe(new WeakRef(this))),Wde.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=i,this.read(i)});return this.addResolvingPromise(e),Promise.resolve(this)}async createElevationLayers(){await this.load();const t=this._getHelperService("defaultElevationLayers"),e=(await we(()=>Promise.resolve().then(()=>mje),void 0)).default;return t?t.map(i=>new e({id:i.id,url:i.url})):[]}async fetchBasemaps(t,e){const i=await this._fetchBasemaps(t,e);if((e==null?void 0:e.include3d)===!0&&this.use3dBasemaps!==!1){const r=await this._fetchBasemaps3D(t,e);i.unshift(...r)}return i}fetchCategorySchema(t){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",t).then(e=>e.categorySchema):xo(t)?Promise.reject(ur()):Promise.resolve([])}fetchFeaturedGroups(t){const e=this.featuredGroups,i=new ay;if(i.num=100,i.sortField="title",e&&e.length){const r=[];for(const n of e)r.push(`(title:"${n.title}" AND owner:${n.owner})`);return i.query=r.join(" OR "),this.queryGroups(i,t).then(n=>n.results)}return xo(t)?Promise.reject(ur()):Promise.resolve([])}fetchRegions(t){var i;const e=((i=this.user)==null?void 0:i.culture)||this.culture||fa();return this.request(this.restUrl+"/portals/regions",{...t,query:{culture:e}})}fetchSettings(t){var i;const e=((i=this.user)==null?void 0:i.culture)||this.culture||fa();return this.request(this.restUrl+"/portals/self/settings",{...t,query:{culture:e}})}static getDefault(){return dQe(()=>new U1)}queryGroups(t,e){return this.queryPortal("/community/groups",t,"PortalGroup",e)}queryItems(t,e){return this.queryPortal("/search",t,"PortalItem",e)}queryUsers(t,e){return t.sortField||(t.sortField="username"),this.queryPortal("/community/users",t,"PortalUser",e)}fetchSelf(t=this.authMode,e=!1,i){const r=this.restUrl+"/portals/self",n={authMode:t,query:{culture:fa().toLowerCase()},...i};return n.authMode==="auto"&&(n.authMode="no-prompt"),e&&(n.query.default=!0),this.request(r,n)}queryPortal(t,e,i,r){const n=$s(ay,e),s=o=>this.request(this.restUrl+t,{...n.toRequestOptions(this),...r}).then(l=>{const c=n.clone();return c.start=l.nextStart,new fQe({nextQueryParams:c,queryParams:n,total:l.total,results:U1._resultsToTypedArray(o,{portal:this},l,r)})}).then(l=>Promise.all(l.results.map(c=>typeof c.when=="function"?c.when():l)).then(()=>l,c=>(zo(c),l)));return i&&qde[i]?qde[i]().then(({default:o})=>(St(r),s(o))):s()}signIn(){if(this.authMode===U1.AUTH_MODE_ANONYMOUS)return Promise.reject(new se("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if(this.loadStatus==="failed")return Promise.reject(this.loadError);const t=e=>Promise.resolve().then(()=>this.loadStatus==="not-loaded"?(e||(this.authMode="immediate"),this.load().then(()=>null)):this.loadStatus==="loading"?this.load().then(()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate"))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate"))).then(i=>{i&&(this.sourceJSON=i,this.read(i))});return yr?yr.getCredential(this.restUrl).then(e=>t(e)):t(this.credential)}normalizeUrl(t){var i;const e=(i=this.credential)==null?void 0:i.token;return this._normalizeSSL(e?t+(t.includes("?")?"&":"?")+"token="+e:t)}requestToTypedArray(t,e,i){return this.request(t,e).then(r=>{const n=U1._resultsToTypedArray(i,{portal:this},r);return Promise.all(n.map(s=>typeof s.when=="function"?s.when():r)).then(()=>n,()=>n)})}request(t,e={}){const i={f:"json",...e.query},{authMode:r=this.authMode===U1.AUTH_MODE_ANONYMOUS?"anonymous":"auto",body:n=null,cacheBust:s=!1,method:o="auto",responseType:l="json",signal:c}=e,f={authMode:r,body:n,cacheBust:s,method:o,query:i,responseType:l,timeout:0,signal:c};return bi(this._normalizeSSL(t),f).then(_=>_.data)}toJSON(){throw new se("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");return new U1({sourceJSON:t})}_getHelperService(t){const e=this.helperServices&&this.helperServices[t];if(!e)throw new se("portal:service-not-found",`The \`helperServices\` do not include an entry named "${t}"`);return e}async _fetchBasemaps(t,e){const i=new ay;i.query=t||(Ar.apiKey&&$ne(this.url)?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),i.disableExtraQuery=!0;const r=await this.queryGroups(i,e);if(!r.total)return[];const n=r.results[0];i.num=100,i.query='type:"Web Map" -type:"Web Application"',i.sortField=n.sortField||"name",i.sortOrder=n.sortOrder||"desc";const s=await n.queryItems(i,e);return s.total?s.results.filter(o=>o.type==="Web Map").map(o=>new B6({portalItem:o})):[]}async _fetchBasemaps3D(t,e){const i=t||this.basemapGalleryGroupQuery3D;if(!i)return[];const r=new ay({query:i,disableExtraQuery:!0}),n=await this.queryGroups(r,e);if(!n.total)return[];const s=n.results[0];r.num=100,r.query='type:"Web Scene"',r.sortField=s.sortField||"name",r.sortOrder=s.sortOrder||"desc";const o=await s.queryItems(r,e);return o.total?o.results.filter(l=>l.type==="Web Scene").map(l=>new B6({portalItem:l})):[]}_normalizeSSL(t){return t.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(t){if(t){const e=B6.fromJSON(t);return e.portalItem={portal:this},e}return null}static _resultsToTypedArray(t,e,i,r){let n=[];if(i){const s=r!=null?r.signal:null;n=i.listings||i.notifications||i.userInvitations||i.tags||i.items||i.groups||i.comments||i.provisions||i.results||i.relatedItems||i,(t||e)&&(n=n.map(o=>{const l=Object.assign(t?t.fromJSON(o):o,e);return typeof l.load=="function"&&l.load(s),l}))}else n=[];return n}};wt.AUTH_MODE_ANONYMOUS="anonymous",wt.AUTH_MODE_AUTO="auto",wt.AUTH_MODE_IMMEDIATE="immediate",y([w()],wt.prototype,"access",void 0),y([w()],wt.prototype,"allSSL",void 0),y([w()],wt.prototype,"authMode",void 0),y([w()],wt.prototype,"authorizedCrossOriginDomains",void 0),y([$t("authorizedCrossOriginDomains")],wt.prototype,"readAuthorizedCrossOriginDomains",null),y([w()],wt.prototype,"basemapGalleryGroupQuery",void 0),y([w({json:{name:"3DBasemapGalleryGroupQuery"}})],wt.prototype,"basemapGalleryGroupQuery3D",void 0),y([w()],wt.prototype,"bingKey",void 0),y([w()],wt.prototype,"canListApps",void 0),y([w()],wt.prototype,"canListData",void 0),y([w()],wt.prototype,"canListPreProvisionedItems",void 0),y([w()],wt.prototype,"canProvisionDirectPurchase",void 0),y([w()],wt.prototype,"canSearchPublic",void 0),y([w()],wt.prototype,"canShareBingPublic",void 0),y([w()],wt.prototype,"canSharePublic",void 0),y([w()],wt.prototype,"canSignInArcGIS",void 0),y([w()],wt.prototype,"canSignInIDP",void 0),y([w()],wt.prototype,"colorSetsGroupQuery",void 0),y([w()],wt.prototype,"commentsEnabled",void 0),y([w({type:Date})],wt.prototype,"created",void 0),y([w()],wt.prototype,"credential",void 0),y([w()],wt.prototype,"culture",void 0),y([w()],wt.prototype,"currentVersion",void 0),y([w()],wt.prototype,"customBaseUrl",void 0),y([w()],wt.prototype,"defaultBasemap",void 0),y([$t("defaultBasemap")],wt.prototype,"readDefaultBasemap",null),y([w()],wt.prototype,"defaultDevBasemap",void 0),y([$t("defaultDevBasemap")],wt.prototype,"readDefaultDevBasemap",null),y([w({type:Vi})],wt.prototype,"defaultExtent",void 0),y([w()],wt.prototype,"defaultVectorBasemap",void 0),y([$t("defaultVectorBasemap")],wt.prototype,"readDefaultVectorBasemap",null),y([w()],wt.prototype,"description",void 0),y([w()],wt.prototype,"devBasemapGalleryGroupQuery",void 0),y([w()],wt.prototype,"eueiEnabled",void 0),y([w({readOnly:!0})],wt.prototype,"extraQuery",null),y([w()],wt.prototype,"featuredGroups",void 0),y([w()],wt.prototype,"featuredItemsGroupQuery",void 0),y([w()],wt.prototype,"galleryTemplatesGroupQuery",void 0),y([w()],wt.prototype,"livingAtlasGroupQuery",void 0),y([w()],wt.prototype,"hasCategorySchema",void 0),y([w()],wt.prototype,"helpBase",void 0),y([w()],wt.prototype,"helperServices",void 0),y([w()],wt.prototype,"helpMap",void 0),y([w()],wt.prototype,"homePageFeaturedContent",void 0),y([w()],wt.prototype,"homePageFeaturedContentCount",void 0),y([w()],wt.prototype,"httpPort",void 0),y([w()],wt.prototype,"httpsPort",void 0),y([w()],wt.prototype,"id",void 0),y([w()],wt.prototype,"ipCntryCode",void 0),y([w({readOnly:!0})],wt.prototype,"isOrganization",null),y([w()],wt.prototype,"isPortal",void 0),y([w()],wt.prototype,"isReadOnly",void 0),y([w({readOnly:!0})],wt.prototype,"itemPageUrl",null),y([w()],wt.prototype,"layerTemplatesGroupQuery",void 0),y([w()],wt.prototype,"maxTokenExpirationMinutes",void 0),y([w({type:Date})],wt.prototype,"modified",void 0),y([w()],wt.prototype,"name",void 0),y([w()],wt.prototype,"portalHostname",void 0),y([w()],wt.prototype,"portalMode",void 0),y([w()],wt.prototype,"portalProperties",void 0),y([w()],wt.prototype,"region",void 0),y([w({readOnly:!0})],wt.prototype,"restUrl",null),y([w()],wt.prototype,"rotatorPanels",void 0),y([w()],wt.prototype,"showHomePageDescription",void 0),y([w()],wt.prototype,"sourceJSON",void 0),y([w()],wt.prototype,"staticImagesUrl",void 0),y([w({json:{name:"2DStylesGroupQuery"}})],wt.prototype,"stylesGroupQuery2d",void 0),y([w({json:{name:"stylesGroupQuery"}})],wt.prototype,"stylesGroupQuery3d",void 0),y([w()],wt.prototype,"supportsHostedServices",void 0),y([w()],wt.prototype,"symbolSetsGroupQuery",void 0),y([w()],wt.prototype,"templatesGroupQuery",void 0),y([w()],wt.prototype,"thumbnail",void 0),y([w({readOnly:!0})],wt.prototype,"thumbnailUrl",null),y([w()],wt.prototype,"units",void 0),y([w()],wt.prototype,"url",void 0),y([w()],wt.prototype,"urlKey",void 0),y([$t("urlKey")],wt.prototype,"readUrlKey",null),y([w()],wt.prototype,"user",void 0),y([$t("user")],wt.prototype,"readUser",null),y([w()],wt.prototype,"use3dBasemaps",void 0),y([w()],wt.prototype,"useStandardizedQuery",void 0),y([w()],wt.prototype,"useVectorBasemaps",void 0),y([w()],wt.prototype,"vectorBasemapGalleryGroupQuery",void 0),wt=U1=y([Z("esri.portal.Portal")],wt);const os=wt,Wde=new FinalizationRegistry(t=>{t.remove()});function gQe(t){const e=yr;return()=>{const i=t.deref();i&&e.findCredential(i.restUrl)&&i.signIn().catch(()=>{})}}function yQe(t){var n,s;const e="metric";if(t==null)return e;const i=t.map,r=(i&&"portalItem"in i?(n=i.portalItem)==null?void 0:n.portal:null)??os.getDefault();switch(((s=r.user)==null?void 0:s.units)??r.units){case e:return e;case"english":return"imperial"}return VKe(t.spatialReference)??e}const ZCe={readOnly:!0,get(){return yQe(this.view)}};let _g=class extends ze{constructor(e){super(e),this.activeTool=null,this.activeViewModel=null,this.view=null}get areaUnit(){return this.defaultUnit}set areaUnit(e){this._overrideIfSome("areaUnit",e)}get linearUnit(){return this.defaultUnit}set linearUnit(e){this._overrideIfSome("linearUnit",e)}get state(){const{activeViewModel:e}=this;return e?e.state:"disabled"}};y([w({type:["area","distance","direct-line"]})],_g.prototype,"activeTool",void 0),y([w()],_g.prototype,"activeViewModel",void 0),y([w({type:RKe})],_g.prototype,"areaUnit",null),y([w(ZCe)],_g.prototype,"defaultUnit",void 0),y([w({type:dL})],_g.prototype,"linearUnit",null),y([w({readOnly:!0})],_g.prototype,"state",null),y([w()],_g.prototype,"view",void 0),_g=y([Z("esri.widgets.Measurement.MeasurementViewModel")],_g);const JCe=_g;function Gr(t){return(e,i)=>{e.hasOwnProperty("_messageBundleProps")||(e._messageBundleProps=e._messageBundleProps?e._messageBundleProps.slice():[]),e._messageBundleProps.push({bundlePath:t,propertyName:i})}}var vQe=function(t){return{vnodeSelector:"",properties:void 0,children:void 0,text:t.toString(),domNode:null}},KCe=function(t,e){for(var i=0,r=t.length;i{this._set("activeWidget",e)}),this.addHandles([_e(()=>[this.view,this.activeTool],async()=>{this._set("activeWidget",await this._getActiveWidget())}),_e(()=>this.activeWidget,(e,i)=>{this.viewModel.set("activeViewModel",e?e.viewModel:null),i&&(i.visible=!1)}),_e(()=>[this.areaUnit,this.linearUnit,this.uiStrings],()=>this._updateSubWidgetProperties())])}destroy(){this._destroyWidgets()}get activeTool(){return this.viewModel.activeTool}set activeTool(e){this.viewModel.activeTool=e}get areaUnit(){return this.viewModel.areaUnit}set areaUnit(e){this.viewModel.areaUnit=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get linearUnit(){return this.viewModel.linearUnit}set linearUnit(e){this.viewModel.linearUnit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{activeWidget:e}=this,i=e&&!e.destroyed?e.render():null;return X("div",{class:Yde.base},i)}clear(){this.activeTool=null,this._destroyWidgets()}startMeasurement(){const{activeViewModel:e}=this.viewModel;e&&$m(e.start())}async _createWidget(e){const{areaUnit:i,linearUnit:r,view:n}=this;if(!n)return null;switch(e){case"area":{const{type:s}=n;switch(s){case"2d":return new(await we(()=>import("./AreaMeasurement2D-5lnD5-Sk.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))).default({view:n,unit:i,uiStrings:this._createUIStringsForWidget(e)});case"3d":return new(await we(()=>import("./AreaMeasurement3D-GOBHGg9B.js"),__vite__mapDeps([15,16,17,18,19,20,21,22,23,24,25,3,4,26,9,10,27,28,5,29,11,8,6,30,14]))).default({view:n,unit:i,uiStrings:this._createUIStringsForWidget(e)});default:return null}}case"distance":{const{type:s}=n;return s==="2d"?new(await we(()=>import("./DistanceMeasurement2D-0EP_w-h3.js"),__vite__mapDeps([31,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))).default({view:n,unit:r,uiStrings:this._createUIStringsForWidget(e)}):null}case"direct-line":{const{type:s}=n;return s==="3d"?new(await we(()=>import("./DirectLineMeasurement3D-3Pkkgamv.js"),__vite__mapDeps([32,16,17,18,19,20,21,22,23,24,25,3,4,26,9,10,33,34,27,28,5,29,11,8,30,14]))).default({view:n,unit:r,uiStrings:this._createUIStringsForWidget(e)}):null}default:return null}}_destroyWidgets(){this._widgets.forEach(e=>e.destroy()),this._widgets.clear()}async _getActiveWidget(){const{activeTool:e,view:i}=this;if(!i||!e)return null;let r=null;if(this._widgets.has(e))r=this._widgets.get(e),r.visible=!0;else{if(r=await this._createWidget(e),!r)return null;await r.viewModel.start(),this._widgets.set(e,r)}return r}_createUIStringsForWidget(e){var r;if(!this.uiStrings)return;const i=e+"-"+((r=this.view)==null?void 0:r.type);return this.uiStrings[i]}_updateSubWidgetProperties(){this._widgets.forEach((e,i)=>{const{areaUnit:r,linearUnit:n}=this;e.unit=bQe(e)?r:n,e.uiStrings=this._createUIStringsForWidget(i)})}};y([w()],_h.prototype,"activeTool",null),y([w({readOnly:!0})],_h.prototype,"activeWidget",void 0),y([w()],_h.prototype,"areaUnit",null),y([w()],_h.prototype,"iconClass",void 0),y([w()],_h.prototype,"icon",void 0),y([w()],_h.prototype,"label",null),y([w()],_h.prototype,"linearUnit",null),y([w(),Gr("esri/widgets/Measurement/t9n/Measurement")],_h.prototype,"messages",void 0),y([w()],_h.prototype,"uiStrings",void 0),y([w()],_h.prototype,"view",null),y([w({type:JCe})],_h.prototype,"viewModel",void 0),_h=y([Z("esri.widgets.Measurement")],_h);const wQe=_h;function sd(t,e,i=it){return e||(e=new i),e===t||(e.removeAll(),xQe(t)?e.addMany(t):t&&e.add(t)),e}function nP(t){return t}function xQe(t){return t&&(Array.isArray(t)||"items"in t&&Array.isArray(t.items))}let YI=class extends it{constructor(e){super(e),this.addHandles([this.on("before-add",i=>{i.item==null&&i.preventDefault()}),this.on("after-add",i=>this._own(i.item)),this.on("after-remove",i=>this._release(i.item))])}get owner(){return this._get("owner")}set owner(e){e!==this._get("owner")&&(this._releaseAll(),this._set("owner",e),this._ownAll())}_ownAll(){for(const e of this.items)this._own(e)}_releaseAll(){for(const e of this.items)this._release(e)}_createNewInstance(e){return this.itemType?new(it.ofType(this.itemType.Type))(e):new it(e)}};function Pz(t,e){return{type:t,cast:nP,set(i){const r=sd(i,this._get(e),t);r.owner=this,this._set(e,r)}}}y([w()],YI.prototype,"owner",null),YI=y([Z("esri.core.support.OwningCollection")],YI);function jO(t,e,i=!1){let{hasM:r,hasZ:n}=t;Array.isArray(e)?e.length!==4||r||n?e.length===3&&i&&!r?(n=!0,r=!1):e.length===3&&r&&n&&(r=!1,n=!1):(r=!0,n=!0):(n=!n&&e.hasZ&&(!r||e.hasM),r=!r&&e.hasM&&(!n||e.hasZ)),t.hasZ=n,t.hasM=r}var BZ;function Xde(t){return(e,i)=>e==null?i:i==null?e:t(e,i)}function SQe(t){return t&&(t.declaredClass==="esri.geometry.SpatialReference"||t.wkid!=null)}let Ub=BZ=class extends ix{constructor(...t){super(...t),this.points=[],this.type="multipoint"}normalizeCtorArgs(t,e){var n;if(!t&&!e)return{};const i={};Array.isArray(t)?(i.points=t,i.spatialReference=e):SQe(t)?i.spatialReference=t:(t.points&&(i.points=t.points),t.spatialReference&&(i.spatialReference=t.spatialReference),t.hasZ&&(i.hasZ=t.hasZ),t.hasM&&(i.hasM=t.hasM));const r=(n=i.points)==null?void 0:n[0];return r&&(i.hasZ===void 0&&i.hasM===void 0?(i.hasZ=r.length>2,i.hasM=!1):i.hasZ===void 0?i.hasZ=r.length>3:i.hasM===void 0&&(i.hasM=r.length>3)),i}get cache(){return this.commitProperty("points"),this.commitProperty("hasZ"),this.commitProperty("hasM"),this.commitProperty("spatialReference"),{}}get extent(){const t=this.points;if(!t.length)return null;const e=new Vi,i=this.hasZ,r=this.hasM,n=i?3:2,s=t[0],o=Xde(Math.min),l=Xde(Math.max);let c,f,_,x,[T,A]=s,[M,I]=s;for(let L=0,F=t.length;L2){const j=z[2];c=o(c,j),_=l(_,j)}if(r&&z.length>n){const j=z[n];f=o(f,j),x=l(x,j)}}return e.xmin=T,e.ymin=A,e.xmax=M,e.ymax=I,e.spatialReference=this.spatialReference,i?(e.zmin=c,e.zmax=_):(e.zmin=void 0,e.zmax=void 0),r?(e.mmin=f,e.mmax=x):(e.mmin=void 0,e.mmax=void 0),e}writePoints(t,e){e.points=Re(this.points)}addPoint(t){return jO(this,t),Array.isArray(t)?this.points.push(t):this.points.push(t.toArray()),this.notifyChange("points"),this}clone(){const t={points:Re(this.points),spatialReference:this.spatialReference};return this.hasZ&&(t.hasZ=!0),this.hasM&&(t.hasM=!0),new BZ(t)}getPoint(t){if(!this._validateInputs(t))return null;const e=this.points[t],i={x:e[0],y:e[1],spatialReference:this.spatialReference};let r=2;return this.hasZ&&(i.z=e[2],r=3),this.hasM&&(i.m=e[r]),new mt(i)}removePoint(t){if(!this._validateInputs(t))return null;const e=new mt(this.points.splice(t,1)[0],this.spatialReference);return this.notifyChange("points"),e}setPoint(t,e){return this._validateInputs(t)?(jO(this,e),Array.isArray(e)||(e=e.toArray()),this.points[t]=e,this.notifyChange("points"),this):this}toJSON(t){return this.write({},t)}_validateInputs(t){return t!=null&&t>=0&&t{o.hasZ&&(n=!0),o.hasM&&(s=!0)}),r.map(o=>{const l=[[o.xmin,o.ymin],[o.xmin,o.ymax],[o.xmax,o.ymax],[o.xmax,o.ymin],[o.xmin,o.ymin]];if(n&&o.hasZ){const c=.5*(o.zmax-o.zmin);for(let f=0;f2&&e.length>2){const n=t[2]-e[2];return Math.sqrt(i*i+r*r+n*n)}return Math.sqrt(i*i+r*r)}function QCe(t,e,i){const r=t[0]+i*(e[0]-t[0]),n=t[1]+i*(e[1]-t[1]);return t.length>2&&e.length>2?[r,n,t[2]+i*(e[2]-t[2])]:[r,n]}function XXt(t,e,i,r){const[n,s]=e,[o,l]=i,[c,f]=r,_=c-o,x=f-l,T=_*_+x*x,A=(n-o)*_+(s-l)*x,M=Math.min(1,Math.max(0,A/T));return t[0]=o+_*M,t[1]=l+x*M,t}function eAe(t,e){return QCe(t,e,.5)}function tAe(t){const e=t.length;let i=0;for(let r=0;r=0}function EQe(t){const e=t.length;return e>2&&Fy(t[0],t[e-1])}function ZXt(t){if("rings"in t&&(CQe(t),t.rings.length>0&&!XI(t.rings[0])))for(const e of t.rings)e.reverse()}function CQe(t){if("rings"in t)for(const e of t.rings)EQe(e)||e.push(e[0].slice())}function JXt(t){return t.type!=="polygon"&&t.type!=="polyline"||AQe(t.type==="polygon"?t.rings:t.paths,t.spatialReference),t}function AQe(t,e){const i=pp(e);if(!i)return;const r=i.valid[0],n=i.valid[1],s=n-r;for(const o of t){let l=1/0,c=-1/0;for(const _ of o){const x=rAe(_[0],r,n);l=Math.min(l,x),c=Math.max(c,x),_[0]=x}const f=c-l;s-f{_[0]<0&&(_[0]+=s)})}}function rAe(t,e,i){const r=i-e;return ti?e+(t-e)%r:t}function KXt(t,e){if(t===e)return!0;if(t.type!==e.type)return!1;if(t.type==="point"||t.type==="mesh"||t.type==="extent")return!0;if(t.type==="multipoint")return t.points.length===e.points.length;const[i,r]=t.type==="polyline"?[t.paths,e.paths]:[t.rings,e.rings];return i.length===r.length&&i.every((n,s)=>n.length===r[s].length)}function QXt(t){return t?t.hasZ?[t.xmax-t.xmin/2,t.ymax-t.ymin/2,t.zmax-t.zmin/2]:[t.xmax-t.xmin/2,t.ymax-t.ymin/2]:null}function MQe(t){return t?nAe(t.rings,t.hasZ??!1):null}function nAe(t,e){if(!(t!=null&&t.length))return null;const i=[],r=[],n=e?[1/0,-1/0,1/0,-1/0,1/0,-1/0]:[1/0,-1/0,1/0,-1/0];for(let s=0,o=t.length;s{let l=s[2]-o[2];return l===0&&e&&(l=s[4]-o[4]),l}),r.length&&(i[0]=r[0][0],i[1]=r[0][1],e&&(i[2]=r[0][3]),(i[0]n[1]||i[1]n[3]||e&&(i[2]n[5]))&&(i.length=0)),!i.length){const s=t[0]&&t[0].length?OQe(t[0],e):null;if(!s)return null;i[0]=s[0],i[1]=s[1],e&&s.length>2&&(i[2]=s[2])}return i}function sAe(t,e,i){let r=0,n=0,s=0,o=0,l=0;const c=t.length?t[0][0]:0,f=t.length?t[0][1]:0,_=t.length&&e?t[0][2]:0;for(let T=0;T2&&M.length>2){const re=F-_,he=H-_,ce=z*he-Y*re;s+=(re+he)*ce,l+=ce}Ii[1]&&(i[1]=I),Li[3]&&(i[3]=L),e&&(Fi[5]&&(i[5]=F))}if(o>0&&(o*=-1),l>0&&(l*=-1),!o)return null;o*=.5,l*=.5;const x=[r/(6*o)+c,n/(6*o)+f,o];return e&&(i[4]===i[5]||l===0?(x[3]=(i[4]+i[5])/2,x[4]=0):(x[3]=s/(6*l)+_,x[4]=l)),x}function eZt(t,e){let i=0,r=0,n=0;t.nextPoint();const s=t.pathSize?t.x:0,o=t.pathSize?t.y:0;for(let l=0;le[1]&&(e[1]=_),xe[3]&&(e[3]=x)}return n>0&&(n*=-1),n?(n*=.5,[i/(6*n)+s,r/(6*n)+o,n]):null}function OQe(t,e){const i=e?[0,0,0]:[0,0],r=e?[0,0,0]:[0,0];let n=0,s=0,o=0,l=0;for(let c=0,f=t.length;c2&&x.length>2&&(i[2]=_[2],r[2]=x[2]);const T=pB(i,r);if(T){n+=T;const A=eAe(_,x);s+=T*A[0],o+=T*A[1],e&&A.length>2&&(l+=T*A[2])}}}return n>0?e?[s/n,o/n,l/n]:[s/n,o/n]:t.length?t[0]:null}function PQe(t){const{hasZ:e,totalSize:i}=t;if(i===0)return null;const r=[],n=[],s=e?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY];for(t.reset();t.nextPath();){const o=sAe(TQe(t),t.hasZ,s);o&&n.push(o)}if(n.sort((o,l)=>{let c=o[2]-l[2];return c===0&&e&&(c=o[4]-l[4]),c}),n.length&&(r[0]=n[0][0],r[1]=n[0][1],e&&(r[2]=n[0][3]),(r[0]s[1]||r[1]s[3]||e&&(r[2]s[5]))&&(r.length=0)),!r.length){t.reset(),t.nextPath();const o=t.pathSize?RQe(t):null;if(!o)return null;r[0]=o[0],r[1]=o[1],e&&o.length>2&&(r[2]=o[2])}return r}function RQe(t){const{hasZ:e}=t,i=e?[0,0,0]:[0,0],r=e?[0,0,0]:[0,0];let n=0,s=0,o=0,l=0;if(t.nextPoint()){let c=t.x,f=t.y,_=t.z;for(;t.nextPoint();){const x=t.x,T=t.y,A=t.z;i[0]=c,i[1]=f,r[0]=x,r[1]=T,e&&(i[2]=_,r[2]=A);const M=pB(i,r);if(M){n+=M;const I=eAe(i,r);s+=M*I[0],o+=M*I[1],e&&I.length>2&&(l+=M*I[2])}c=x,f=T,_=A}}return n>0?e?[s/n,o/n,l/n]:[s/n,o/n]:t.pathSize?(t.seekPathStart(),t.nextPoint(),[t.x,t.y]):null}const IQe=1e-6;function tZt(t){let e=0;for(t.reset();t.nextPath();)e+=t.getCurrentRingArea();if(e0&&(s=1/Math.sqrt(s),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s),t}function Ve(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Wt(t,e,i){const r=e[0],n=e[1],s=e[2],o=i[0],l=i[1],c=i[2];return t[0]=n*c-s*l,t[1]=s*o-r*c,t[2]=r*l-n*o,t}function Qr(t,e,i,r){const n=e[0],s=e[1],o=e[2];return t[0]=n+r*(i[0]-n),t[1]=s+r*(i[1]-s),t[2]=o+r*(i[2]-o),t}function jQe(t,e,i,r,n,s){const o=s*s,l=o*(2*s-3)+1,c=o*(s-2)+s,f=o*(s-1),_=o*(3-2*s);return t[0]=e[0]*l+i[0]*c+r[0]*f+n[0]*_,t[1]=e[1]*l+i[1]*c+r[1]*f+n[1]*_,t[2]=e[2]*l+i[2]*c+r[2]*f+n[2]*_,t}function GQe(t,e,i,r,n,s){const o=1-s,l=o*o,c=s*s,f=l*o,_=3*s*l,x=3*c*o,T=c*s;return t[0]=e[0]*f+i[0]*_+r[0]*x+n[0]*T,t[1]=e[1]*f+i[1]*_+r[1]*x+n[1]*T,t[2]=e[2]*f+i[2]*_+r[2]*x+n[2]*T,t}function HQe(t,e){e=e||1;const i=M9,r=2*i()*Math.PI,n=2*i()-1,s=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*s,t[1]=Math.sin(r)*s,t[2]=n*e,t}function bt(t,e,i){const r=e[0],n=e[1],s=e[2];return t[0]=i[0]*r+i[4]*n+i[8]*s+i[12],t[1]=i[1]*r+i[5]*n+i[9]*s+i[13],t[2]=i[2]*r+i[6]*n+i[10]*s+i[14],t}function qh(t,e,i){const r=e[0],n=e[1],s=e[2];return t[0]=r*i[0]+n*i[3]+s*i[6],t[1]=r*i[1]+n*i[4]+s*i[7],t[2]=r*i[2]+n*i[5]+s*i[8],t}function Of(t,e,i){const r=i[0],n=i[1],s=i[2],o=i[3],l=e[0],c=e[1],f=e[2];let _=n*f-s*c,x=s*l-r*f,T=r*c-n*l,A=n*T-s*x,M=s*_-r*T,I=r*x-n*_;const L=2*o;return _*=L,x*=L,T*=L,A*=2,M*=2,I*=2,t[0]=l+_+A,t[1]=c+x+M,t[2]=f+T+I,t}function qQe(t,e,i,r){const n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[0],s[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),s[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t}function WQe(t,e,i,r){const n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),s[1]=n[1],s[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t}function YQe(t,e,i,r){const n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),s[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),s[2]=n[2],t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t}function mAe(t,e){Ne(j6,t),Ne(G6,e),Ye(j6,j6),Ye(G6,G6);const i=Ve(j6,G6);return i>1?0:i<-1?Math.PI:Math.acos(i)}const j6=W(),G6=W();function XQe(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function jr(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function M2(t,e){if(t===e)return!0;const i=t[0],r=t[1],n=t[2],s=e[0],o=e[1],l=e[2],c=sl();return Math.abs(i-s)<=c*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(r-o)<=c*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-l)<=c*Math.max(1,Math.abs(n),Math.abs(l))}function R_(t,e,i){const r=i[0]-e[0],n=i[1]-e[1],s=i[2]-e[2];let o=r*r+n*n+s*s;return o>0?(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=s*o,t):(t[0]=0,t[1]=0,t[2]=0,t)}const xn=je,ZQe=gB,JQe=Rz,O9=Sn,vB=Co,$h=rt,HO=El,Jde=Object.freeze(Object.defineProperty({__proto__:null,abs:GO,add:Be,angle:mAe,bezier:GQe,ceil:UQe,copy:Ne,cross:Wt,direction:R_,dist:O9,distance:Sn,div:JQe,divide:Rz,dot:Ve,equals:M2,exactEquals:jr,floor:pAe,hermite:jQe,inverse:BQe,len:$h,length:rt,lerp:Qr,max:fAe,min:yB,mul:ZQe,multiply:gB,negate:Sc,normalize:Ye,random:HQe,rotateX:qQe,rotateY:WQe,rotateZ:YQe,round:VQe,scale:De,scaleAndAdd:ao,set:Ie,sign:Iz,sqrDist:vB,sqrLen:HO,squaredDistance:Co,squaredLength:El,str:XQe,sub:xn,subtract:je,transformMat3:qh,transformMat4:bt,transformQuat:Of},Symbol.toStringTag,{value:"Module"}));function mm(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function rs(t,e,i,r,n){return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}function rse(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t}function gAe(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}function yAe(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t}function vAe(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t[3]=e[3]/i[3],t}function KQe(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function QQe(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function eet(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t[3]=Math.min(e[3],i[3]),t}function tet(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t[3]=Math.max(e[3],i[3]),t}function iet(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function UT(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t}function ret(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t[2]=e[2]+i[2]*r,t[3]=e[3]+i[3]*r,t}function _Ae(t,e){const i=e[0]-t[0],r=e[1]-t[1],n=e[2]-t[2],s=e[3]-t[3];return Math.sqrt(i*i+r*r+n*n+s*s)}function $z(t,e){const i=e[0]-t[0],r=e[1]-t[1],n=e[2]-t[2],s=e[3]-t[3];return i*i+r*r+n*n+s*s}function nse(t){const e=t[0],i=t[1],r=t[2],n=t[3];return Math.sqrt(e*e+i*i+r*r+n*n)}function sse(t){const e=t[0],i=t[1],r=t[2],n=t[3];return e*e+i*i+r*r+n*n}function net(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function set(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function bAe(t,e){const i=e[0],r=e[1],n=e[2],s=e[3];let o=i*i+r*r+n*n+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=i*o,t[1]=r*o,t[2]=n*o,t[3]=s*o),t}function wAe(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function _B(t,e,i,r){const n=e[0],s=e[1],o=e[2],l=e[3];return t[0]=n+r*(i[0]-n),t[1]=s+r*(i[1]-s),t[2]=o+r*(i[2]-o),t[3]=l+r*(i[3]-l),t}function oet(t,e){const i=M9;let r,n,s,o,l,c;e=e||1;do r=2*i()-1,n=2*i()-1,l=r*r+n*n;while(l>=1);do s=2*i()-1,o=2*i()-1,c=s*s+o*o;while(c>=1);const f=Math.sqrt((1-l)/c);return t[0]=e*r,t[1]=e*n,t[2]=e*s*f,t[3]=e*o*f,t}function lp(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*s+i[12]*o,t[1]=i[1]*r+i[5]*n+i[9]*s+i[13]*o,t[2]=i[2]*r+i[6]*n+i[10]*s+i[14]*o,t[3]=i[3]*r+i[7]*n+i[11]*s+i[15]*o,t}function aet(t,e,i){const r=e[0],n=e[1],s=e[2],o=i[0],l=i[1],c=i[2],f=i[3],_=f*r+l*s-c*n,x=f*n+c*r-o*s,T=f*s+o*n-l*r,A=-o*r-l*n-c*s;return t[0]=_*f+A*-o+x*-c-T*-l,t[1]=x*f+A*-l+T*-o-_*-c,t[2]=T*f+A*-c+_*-l-x*-o,t[3]=e[3],t}function cet(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function rO(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function VT(t,e){const i=t[0],r=t[1],n=t[2],s=t[3],o=e[0],l=e[1],c=e[2],f=e[3],_=sl();return Math.abs(i-o)<=_*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-l)<=_*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(n-c)<=_*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(s-f)<=_*Math.max(1,Math.abs(s),Math.abs(f))}const uet=gAe,het=yAe,det=vAe,pet=_Ae,fet=$z,met=nse,get=sse,xAe=Object.freeze(Object.defineProperty({__proto__:null,add:rse,ceil:KQe,copy:mm,dist:pet,distance:_Ae,div:det,divide:vAe,dot:wAe,equals:VT,exactEquals:rO,floor:QQe,inverse:set,len:met,length:nse,lerp:_B,max:tet,min:eet,mul:het,multiply:yAe,negate:net,normalize:bAe,random:oet,round:iet,scale:UT,scaleAndAdd:ret,set:rs,sqrDist:fet,sqrLen:get,squaredDistance:$z,squaredLength:sse,str:cet,sub:uet,subtract:gAe,transformMat4:lp,transformQuat:aet},Symbol.toStringTag,{value:"Module"})),Kde=new Float32Array(1);function SAe(t){--t;for(let e=1;e<32;e<<=1)t|=t>>e;return t+1}function Je(t,e,i){return Math.min(Math.max(t,e),i)}function yet(t,e){return e===0?0:Math.round(t/e)*e}function BT(t){return(t&t-1)==0}function iZt(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}function rZt(t){return 10**Math.ceil(Math.LOG10E*Math.log(t))}function ui(t,e,i){return t+(e-t)*i}function nZt(t,e,i,r,n){return ui(r,n,(t-e)/(i-e))}function Ei(t){return t*Math.PI/180}function pu(t){return 180*t/Math.PI}function jZ(t,e=1e-6){return(t<0?-1:1)/Math.max(Math.abs(t),e)}function Ca(t){return Math.acos(Je(t,-1,1))}function Gf(t){return Math.asin(Je(t,-1,1))}function Ey(t,e,i=1e-6){return t===e?!0:!Number.isFinite(t)||!Number.isFinite(e)?!1:(t>e?t-e:e-t)<=i}const Lz=new DataView(new ArrayBuffer(Float64Array.BYTES_PER_ELEMENT));function GZ(t){return Lz.setFloat64(0,t),Lz.getBigInt64(0)}function vet(t){return Lz.setBigInt64(0,t),Lz.getFloat64(0)}const w7=BigInt("1000000"),_et=TAe(1);function TAe(t){const e=GZ(t=Math.abs(t)),i=vet(e<=w7?w7:e-w7);return Math.abs(t-i)}function sZt(t,e,i=_et){if(t===e)return!0;if(!Number.isFinite(t)||!Number.isFinite(e))return!1;if(i!=null&&TAe(Math.min(Math.abs(t),Math.abs(e)))w7)}function bet(t,e,i=1e-6){if(t===e)return!0;if(!Number.isFinite(t)||!Number.isFinite(e))return!1;const r=Math.abs(t-e),n=Math.abs(t),s=Math.abs(e);if(t===0||e===0||n<1e-12&&s<1e-12){if(r>.01*i)return!1}else if(r/(n+s)>i)return!1;return!0}function wet(t){return EAe(Math.max(-HZ,Math.min(t,HZ)))}function EAe(t){return Kde[0]=t,Kde[0]}function pL(t,e,i){const r=Je((i-t)/(e-t),0,1);return r*r*(3-2*r)}function Qde(t,e){const i=rt(t),r=Gf(t[2]/i),n=Math.atan2(t[1]/i,t[0]/i);return Ie(e,i,r,n),e}function oZt(t){const e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[3]*t[3]+t[4]*t[4]+t[5]*t[5],r=t[6]*t[6]+t[7]*t[7]+t[8]*t[8];return!(Ey(e,1)&&Ey(i,1)&&Ey(r,1))}function xet(t,e){return(t%e+e)%e}const HZ=EAe(34028234663852886e22);function Ni(t=Aet){return[t[0],t[1],t[2],t[3]]}function aZt(t){return[t[0],t[1],t[2],t[3]]}function d_(t,e){return t!==e&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3]),t}function ose(t,e,i,r,n=Ni()){return n[0]=t,n[1]=e,n[2]=i,n[3]=r,n}function ase(t,e=Ni()){return e[0]=t.xmin,e[1]=t.ymin,e[2]=t.xmax,e[3]=t.ymax,e}function bB(t,e){return new Vi({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3],spatialReference:e})}function nO(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function g2(t,e,i){if(e!=null)if("length"in e)YZ(e)?(i[0]=Math.min(t[0],e[0]),i[1]=Math.min(t[1],e[1]),i[2]=Math.max(t[2],e[2]),i[3]=Math.max(t[3],e[3])):e.length!==2&&e.length!==3||(i[0]=Math.min(t[0],e[0]),i[1]=Math.min(t[1],e[1]),i[2]=Math.max(t[2],e[0]),i[3]=Math.max(t[3],e[1]));else switch(e.type){case"extent":i[0]=Math.min(t[0],e.xmin),i[1]=Math.min(t[1],e.ymin),i[2]=Math.max(t[2],e.xmax),i[3]=Math.max(t[3],e.ymax);break;case"point":i[0]=Math.min(t[0],e.x),i[1]=Math.min(t[1],e.y),i[2]=Math.max(t[2],e.x),i[3]=Math.max(t[3],e.y)}else d_(i,t)}function yH(t,e,i=t){const r=e.length;let n=t[0],s=t[1],o=t[2],l=t[3];for(let c=0;c=t[2]?0:t[2]-t[0]}function qu(t){return t==null||t[1]>=t[3]?0:t[3]-t[1]}function lZt(t){return _c(t)*qu(t)}function Dz(t){return _c(t)>0&&qu(t)>0}function lse(t,e=[0,0]){return e[0]=(t[0]+t[2])/2,e[1]=(t[1]+t[3])/2,e}function CAe(t,e){return wB(t,e[0],e[1])}function epe(t,e){const i=e[3],r=.5*(t[0]+t[2]),n=Math.abs(e[0]-r),s=.5*(t[2]-t[0]);if(n>i+s)return!1;const o=.5*(t[1]+t[3]),l=.5*(t[3]-t[1]),c=Math.abs(e[1]-o);if(c>i+l)return!1;if(n(_-c)*L+(l-f)*F+(f*c-l*_)<0,T=x(r,o),A=x(s,o),M=x(s,n),I=x(r,n);return!(T===A&&A===M&&M===I&&I===T||ls&&f>s||c>o&&_>o||c=t[0]&&i>=t[1]&&e<=t[2]&&i<=t[3]}function Tet(t,e,i){return e[0]>=t[0]-i&&e[1]>=t[1]-i&&e[0]<=t[2]+i&&e[1]<=t[3]+i}function P9(t,e){return Math.max(e[0],t[0])<=Math.min(e[2],t[2])&&Math.max(e[1],t[1])<=Math.min(e[3],t[3])}function Nz(t,e){return e[0]>=t[0]&&e[2]<=t[2]&&e[1]>=t[1]&&e[3]<=t[3]}function WZ(t,e,i){if(e==null)return d_(i,t);const r=e[0],n=e[1],s=e[2],o=e[3];return i[0]=Je(t[0],r,s),i[1]=Je(t[1],n,o),i[2]=Je(t[2],r,s),i[3]=Je(t[3],n,o),i}function Eet(t,e){const i=(t[0]+t[2])/2,r=(t[1]+t[3])/2,n=Math.max(Math.abs(e[0]-i)-_c(t)/2,0),s=Math.max(Math.abs(e[1]-r)-qu(t)/2,0);return Math.sqrt(n*n+s*s)}function Fz(t,e,i,r=t){return r[0]=t[0]+e,r[1]=t[1]+i,r[2]=t[2]+e,r[3]=t[3]+i,r}function od(t){return t?d_(t,XZ):Ni(XZ)}function YZ(t){return t!=null&&t.length===4}function Cet(t){return!(_c(t)!==0&&isFinite(t[0])||qu(t)!==0&&isFinite(t[1]))}function uT(t,e){return YZ(t)&&YZ(e)?t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]:t===e}const hZt=[-1/0,-1/0,1/0,1/0],XZ=[1/0,1/0,-1/0,-1/0],Aet=[0,0,0,0];function AAe(t){return t.xmin!==void 0&&t.ymin!==void 0&&t.xmax!==void 0&&t.ymax!==void 0}function MAe(t){return t.points!==void 0}function OAe(t){return t.x!==void 0&&t.y!==void 0}function PAe(t){return t.paths!==void 0}function RAe(t){return t.rings!==void 0}function IAe(t){function e(i,r){return i==null?r:r==null?i:t(i,r)}return e}const Kw=IAe(Math.min),Qw=IAe(Math.max);function dZt(t,e){return PAe(e)?qO(t,e.paths,!1,!1):RAe(e)?qO(t,e.rings,!1,!1):MAe(e)?cse(t,e.points,!1,!1,!1,!1):AAe(e)?$Ae(t,e):(OAe(e)&&(t[0]=e.x,t[1]=e.y,t[2]=e.x,t[3]=e.y),t)}function pZt(t){let e,i,r,n;for(t.reset(),e=r=1/0,i=n=-1/0;t.nextPath();){const s=Met(t);e=Math.min(s[0],e),r=Math.min(s[1],r),i=Math.max(s[2],i),n=Math.max(s[3],n)}return Ni([e,r,i,n])}function Met(t){let e,i,r,n;for(e=r=1/0,i=n=-1/0;t.nextPoint();)e=Math.min(t.x,e),r=Math.min(t.y,r),i=Math.max(t.x,i),n=Math.max(t.y,n);return Ni([e,r,i,n])}function fZt(t,e){return PAe(e)?qO(t,e.paths,!0,!1):RAe(e)?qO(t,e.rings,!0,!1):MAe(e)?cse(t,e.points,!0,!1,!0,!1):AAe(e)?$Ae(t,e,!0,!1,!0,!1):(OAe(e)&&(t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.x,t[4]=e.y,t[5]=e.z),t)}function qO(t,e,i,r){const n=i?3:2;if(!e.length||!e[0].length)return null;let s,o,l,c,[f,_]=e[0][0],[x,T]=e[0][0];for(let A=0;A2){const k=L[2];s=Kw(s,k),o=Qw(o,k)}if(r&&L.length>n){const k=L[n];l=Kw(s,k),c=Qw(o,k)}}}return i?r?(t[0]=f,t[1]=_,t[2]=s,t[3]=l,t[4]=x,t[5]=T,t[6]=o,t[7]=c,t.length=8,t):(t[0]=f,t[1]=_,t[2]=s,t[3]=x,t[4]=T,t[5]=o,t.length=6,t):r?(t[0]=f,t[1]=_,t[2]=l,t[3]=x,t[4]=T,t[5]=c,t.length=6,t):(t[0]=f,t[1]=_,t[2]=x,t[3]=T,t.length=4,t)}function $Ae(t,e,i,r,n,s){const o=e.xmin,l=e.xmax,c=e.ymin,f=e.ymax;let _=e.zmin,x=e.zmax,T=e.mmin,A=e.mmax;return n?(_=_||0,x=x||0,s?(T=T||0,A=A||0,t[0]=o,t[1]=c,t[2]=_,t[3]=T,t[4]=l,t[5]=f,t[6]=x,t[7]=A,t):(t[0]=o,t[1]=c,t[2]=_,t[3]=l,t[4]=f,t[5]=x,t)):s?(T=T||0,A=A||0,t[0]=o,t[1]=c,t[2]=T,t[3]=l,t[4]=f,t[5]=A,t):(t[0]=o,t[1]=c,t[2]=l,t[3]=f,t)}function cse(t,e,i,r,n,s){const o=i?3:2,l=r&&s,c=i&&n;if(!e.length||!e[0].length)return null;let f,_,x,T,[A,M]=e[0],[I,L]=e[0];for(let F=0;F2){const j=z[2];f=Kw(f,j),_=Qw(_,j)}if(l&&z.length>o){const j=z[o];x=Kw(f,j),T=Qw(_,j)}}return n?(f=f||0,_=_||0,s?(x=x||0,T=T||0,t[0]=A,t[1]=M,t[2]=f,t[3]=x,t[4]=I,t[5]=L,t[6]=_,t[7]=T,t):(t[0]=A,t[1]=M,t[2]=f,t[3]=I,t[4]=L,t[5]=_,t)):s?(x=x||0,T=T||0,t[0]=A,t[1]=M,t[2]=x,t[3]=I,t[4]=L,t[5]=T,t):(t[0]=A,t[1]=M,t[2]=I,t[3]=L,t)}function Oet(t){return t.xmin!==void 0&&t.ymin!==void 0&&t.xmax!==void 0&&t.ymax!==void 0}function Pet(t){return t.points!==void 0}function Ret(t){return t.x!==void 0&&t.y!==void 0}function Iet(t){return t.paths!==void 0}function $et(t){return t.rings!==void 0}const use=[];function LAe(t,e,i,r){return{xmin:t,ymin:e,xmax:i,ymax:r}}function DAe(t,e,i,r,n,s){return{xmin:t,ymin:e,zmin:i,xmax:r,ymax:n,zmax:s}}function NAe(t,e,i,r,n,s){return{xmin:t,ymin:e,mmin:i,xmax:r,ymax:n,mmax:s}}function FAe(t,e,i,r,n,s,o,l){return{xmin:t,ymin:e,zmin:i,mmin:r,xmax:n,ymax:s,zmax:o,mmax:l}}function hse(t,e=!1,i=!1){return e?i?FAe(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]):DAe(t[0],t[1],t[2],t[3],t[4],t[5]):i?NAe(t[0],t[1],t[2],t[3],t[4],t[5]):LAe(t[0],t[1],t[2],t[3])}function mZt(t){return t?Oet(t)?t:Ret(t)?Det(t):$et(t)?kAe(t):Iet(t)?zAe(t):Pet(t)?Let(t):null:null}function Let(t){const{hasZ:e,hasM:i,points:r}=t;return hse(cse(use,r,e??!1,i??!1),e,i)}function Det(t){const{x:e,y:i,z:r,m:n}=t,s=n!=null;return r!=null?s?FAe(e,i,r,n,e,i,r,n):DAe(e,i,r,e,i,r):s?NAe(e,i,n,e,i,n):LAe(e,i,e,i)}function kAe(t){const{hasZ:e,hasM:i,rings:r}=t,n=qO(use,r,e??!1,i??!1);return n?hse(n,e,i):null}function zAe(t){const{hasZ:e,hasM:i,paths:r}=t,n=qO(use,r,e??!1,i??!1);return n?hse(n,e,i):null}var x7;function tpe(t){return!Array.isArray(t[0])}let bg=x7=class extends ix{static fromExtent(t){const e=t.clone().normalize(),i=t.spatialReference;let r=!1,n=!1;for(const o of e)o.hasZ&&(r=!0),o.hasM&&(n=!0);const s={rings:e.map(o=>{const l=[[o.xmin,o.ymin],[o.xmin,o.ymax],[o.xmax,o.ymax],[o.xmax,o.ymin],[o.xmin,o.ymin]];if(r&&o.hasZ){const c=o.zmin+.5*(o.zmax-o.zmin);for(let f=0;f2,r=s.length>3):i===void 0?i=r?s.length>3:s.length>2:r===void 0&&(r=i?s.length>3:s.length>2)),{rings:n,spatialReference:e,hasZ:i,hasM:r}}get cache(){return this.commitProperty("rings"),this.commitProperty("hasZ"),this.commitProperty("hasM"),this.commitProperty("spatialReference"),{}}get centroid(){const t=MQe(this);if(!t||isNaN(t[0])||isNaN(t[1])||this.hasZ&&isNaN(t[2]))return null;const e=new mt;return e.x=t[0],e.y=t[1],e.spatialReference=this.spatialReference,this.hasZ&&(e.z=t[2]),e}get extent(){const{spatialReference:t}=this,e=kAe(this);if(!e)return null;const i=new Vi(e);return i.spatialReference=t,i}get isSelfIntersecting(){return cQe(this.rings)}writeRings(t,e){e.rings=Re(this.rings)}addRing(t){if(!t)return;const e=this.rings,i=e.length;if(tpe(t)){const r=[];for(let n=0,s=t.length;nn===c&&s===f&&(o==null&&_==null||o===_)&&(l==null&&x==null||l===x);for(let n=0;nthis.hasZ?this.hasM?[i.x,i.y,i.z,i.m]:[i.x,i.y,i.z]:[i.x,i.y]):t,XI(e)}getPoint(t,e){if(!this._validateInputs(t,e))return null;const i=this.rings[t][e],r=this.hasZ,n=this.hasM;return r&&!n?new mt(i[0],i[1],i[2],void 0,this.spatialReference):n&&!r?new mt(i[0],i[1],void 0,i[2],this.spatialReference):r&&n?new mt(i[0],i[1],i[2],i[3],this.spatialReference):new mt(i[0],i[1],this.spatialReference)}insertPoint(t,e,i){return this._validateInputs(t,e,!0)?(jO(this,i),Array.isArray(i)||(i=i.toArray()),this.rings[t].splice(e,0,i),this.notifyChange("rings"),this):this}removePoint(t,e){if(!this._validateInputs(t,e))return null;const i=new mt(this.rings[t].splice(e,1)[0],this.spatialReference);return this.notifyChange("rings"),i}removeRing(t){if(!this._validateInputs(t,null))return null;const e=this.rings.splice(t,1)[0],i=this.spatialReference,r=e.map(n=>new mt(n,i));return this.notifyChange("rings"),r}setPoint(t,e,i){return this._validateInputs(t,e)?(jO(this,i),Array.isArray(i)||(i=i.toArray()),this.rings[t][e]=i,this.notifyChange("rings"),this):this}_validateInputs(t,e,i=!1){if(t==null||t<0||t>=this.rings.length)return!1;if(e!=null){const r=this.rings[t];if(i&&(e<0||e>r.length)||!i&&(e<0||e>=r.length))return!1}return!0}toJSON(t){return this.write({},t)}};y([w({readOnly:!0})],bg.prototype,"cache",null),y([w({readOnly:!0})],bg.prototype,"centroid",null),y([w({readOnly:!0})],bg.prototype,"extent",null),y([w({readOnly:!0})],bg.prototype,"isSelfIntersecting",null),y([w({type:[[[Number]]],json:{write:{isRequired:!0}}})],bg.prototype,"rings",void 0),y([Pt("rings")],bg.prototype,"writeRings",null),bg=x7=y([Z("esri.geometry.Polygon")],bg),bg.prototype.toJSON.isDefaultToJSON=!0;const Qa=bg;var ZZ;function Net(t){return!Array.isArray(t[0])}let Vb=ZZ=class extends ix{constructor(...t){super(...t),this.paths=[],this.type="polyline"}normalizeCtorArgs(t,e){var o,l;let i,r,n=null,s=null;return t&&!Array.isArray(t)?(n=t.paths??null,e||(t.spatialReference?e=t.spatialReference:t.paths||(e=t)),i=t.hasZ,r=t.hasM):n=t,n=n||[],e=e||at.WGS84,n.length&&((o=n[0])==null?void 0:o[0])!=null&&typeof n[0][0]=="number"&&(n=[n]),s=(l=n[0])==null?void 0:l[0],s&&(i===void 0&&r===void 0?(i=s.length>2,r=!1):i===void 0?i=!r&&s.length>3:r===void 0&&(r=!i&&s.length>3)),{paths:n,spatialReference:e,hasZ:i,hasM:r}}get cache(){return this.commitProperty("paths"),this.commitProperty("hasZ"),this.commitProperty("hasM"),this.commitProperty("spatialReference"),{}}get extent(){const{spatialReference:t}=this,e=zAe(this);if(!e)return null;const i=new Vi(e);return i.spatialReference=t,i}writePaths(t,e){e.paths=Re(this.paths)}addPath(t){if(!t)return;const e=this.paths,i=e.length;if(Net(t)){const r=[];for(let n=0,s=t.length;nnew mt(n,i));return this.notifyChange("paths"),r}removePoint(t,e){if(!this._validateInputs(t,e))return null;const i=new mt(this.paths[t].splice(e,1)[0],this.spatialReference);return this.notifyChange("paths"),i}setPoint(t,e,i){return this._validateInputs(t,e)?(jO(this,i),Array.isArray(i)||(i=i.toArray()),this.paths[t][e]=i,this.notifyChange("paths"),this):this}_validateInputs(t,e,i=!1){if(t==null||t<0||t>=this.paths.length)return!1;if(e!=null){const r=this.paths[t];if(i&&(e<0||e>r.length)||!i&&(e<0||e>=r.length))return!1}return!0}toJSON(t){return this.write({},t)}};y([w({readOnly:!0})],Vb.prototype,"cache",null),y([w({readOnly:!0})],Vb.prototype,"extent",null),y([w({type:[[[Number]]],json:{write:{isRequired:!0}}})],Vb.prototype,"paths",void 0),y([Pt("paths")],Vb.prototype,"writePaths",null),Vb=ZZ=y([Z("esri.geometry.Polyline")],Vb),Vb.prototype.toJSON.isDefaultToJSON=!0;const xc=Vb,UAe=fu()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon"}),gZt=fu()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh"});function VAe(t){return t.xmin!==void 0&&t.ymin!==void 0&&t.xmax!==void 0&&t.ymax!==void 0}function dse(t){return t.points!==void 0}function pse(t){return t.x!==void 0&&t.y!==void 0}function fse(t){return t.paths!==void 0}function xB(t){return t.rings!==void 0}function O2(t){return t==null?null:t instanceof ix?t:pse(t)?mt.fromJSON(t):fse(t)?xc.fromJSON(t):xB(t)?Qa.fromJSON(t):dse(t)?Cm.fromJSON(t):VAe(t)?Vi.fromJSON(t):null}function R9(t){return t?pse(t)?"esriGeometryPoint":fse(t)?"esriGeometryPolyline":xB(t)?"esriGeometryPolygon":VAe(t)?"esriGeometryEnvelope":dse(t)?"esriGeometryMultipoint":null:null}const Fet={esriGeometryPoint:mt,esriGeometryPolyline:xc,esriGeometryPolygon:Qa,esriGeometryEnvelope:Vi,esriGeometryMultipoint:Cm};function ket(t){return t&&Fet[t]||null}const I9={base:ix,key:"type",typeMap:{extent:Vi,multipoint:Cm,point:mt,polyline:xc,polygon:Qa}};zy(I9);let BAe=0;const I_=t=>{let e=class extends t{constructor(...i){super(...i),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:Date.now().toString(16)+"-object-"+BAe++})}};return e=y([Z("esri.core.Identifiable")],e),e},yZt=t=>{let e=class extends t{constructor(...i){super(...i),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:BAe++})}};return e=y([Z("esri.core.NumericIdentifiable")],e),e};let ipe=class extends I_(class{}){};ipe=y([Z("esri.core.Identifiable")],ipe);async function zet(t){const e="portalItem"in t?t:{portalItem:t},{fromItem:i}=await we(()=>import("./portalLayers-AqjAd9kT.js").then(r=>r.p),__vite__mapDeps([35,36]));try{return await i(e)}catch(r){const n=e&&e.portalItem,s=(n==null?void 0:n.id)||"unset",o=n&&n.portal&&n.portal.url||Ar.portalUrl;throw Ce.getLogger("esri.layers.support.fromPortalItem").error("#fromPortalItem()","Failed to create layer from portal item (portal: '"+o+"', id: '"+s+"')",r),r}}let Uet=0,La=class extends Dn.EventedMixin(I_(jf)){constructor(){super(...arguments),this.attributionDataUrl=null,this.fullExtent=new Vi(-180,-90,180,90,at.WGS84),this.id=Date.now().toString(16)+"-layer-"+Uet++,this.legendEnabled=!0,this.listMode="show",this.opacity=1,this.parent=null,this.persistenceEnabled=!1,this.popupEnabled=!0,this.attributionVisible=!0,this.spatialReference=at.WGS84,this.title=null,this.type=null,this.url=null,this.visible=!0}static async fromArcGISServerUrl(e){const i=typeof e=="string"?{url:e}:e;return(await we(()=>import("./arcgisLayers-Ja4-CB3n.js"),__vite__mapDeps([37,38,36]))).fromUrl(i)}static fromPortalItem(e){return zet(e)}initialize(){this.when().catch(e=>{sn(e)||Ce.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})})}destroy(){const e=this.parent;if(e){const i=this;"layers"in e&&e.layers.includes(i)?e.layers.remove(i):"tables"in e&&e.tables.includes(i)?e.tables.remove(i):"baseLayers"in e&&e.baseLayers.includes(i)?e.baseLayers.remove(i):"referenceLayers"in e&&e.referenceLayers.includes(i)&&e.referenceLayers.remove(i),this._set("parent",null)}}get hasAttributionData(){return this.attributionDataUrl!=null}get parsedUrl(){return qs(this.url)}async fetchAttributionData(){const e=this.attributionDataUrl;if(this.hasAttributionData&&e)return(await bi(e,{query:{f:"json"},responseType:"json"})).data;throw new se("layer:no-attribution-data","Layer does not have attribution data")}};y([w({type:String})],La.prototype,"attributionDataUrl",void 0),y([w({type:Vi})],La.prototype,"fullExtent",void 0),y([w({readOnly:!0})],La.prototype,"hasAttributionData",null),y([w({type:String,clonable:!1})],La.prototype,"id",void 0),y([w({type:Boolean,nonNullable:!0})],La.prototype,"legendEnabled",void 0),y([w({type:["show","hide","hide-children"]})],La.prototype,"listMode",void 0),y([w({type:Number,range:{min:0,max:1},nonNullable:!0})],La.prototype,"opacity",void 0),y([w({clonable:!1})],La.prototype,"parent",void 0),y([w({readOnly:!0})],La.prototype,"parsedUrl",null),y([w({type:Boolean,readOnly:!0})],La.prototype,"persistenceEnabled",void 0),y([w({type:Boolean})],La.prototype,"popupEnabled",void 0),y([w({type:Boolean})],La.prototype,"attributionVisible",void 0),y([w({type:at})],La.prototype,"spatialReference",void 0),y([w({type:String})],La.prototype,"title",void 0),y([w({readOnly:!0,json:{read:!1}})],La.prototype,"type",void 0),y([w()],La.prototype,"url",void 0),y([w({type:Boolean,nonNullable:!0})],La.prototype,"visible",void 0),La=y([Z("esri.layers.Layer")],La);const uE=La,kz={transparent:[0,0,0,0],black:[0,0,0,1],silver:[192,192,192,1],gray:[128,128,128,1],white:[255,255,255,1],maroon:[128,0,0,1],red:[255,0,0,1],purple:[128,0,128,1],fuchsia:[255,0,255,1],green:[0,128,0,1],lime:[0,255,0,1],olive:[128,128,0,1],yellow:[255,255,0,1],navy:[0,0,128,1],blue:[0,0,255,1],teal:[0,128,128,1],aqua:[0,255,255,1],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],blanchedalmond:[255,235,205,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],oldlace:[253,245,230,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],rebeccapurple:[102,51,153,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],whitesmoke:[245,245,245,1],yellowgreen:[154,205,50,1]};function jAe(t){return!!kz[t]||!!kz[t.toLowerCase()]}function mse(t){return kz[t]??kz[t.toLowerCase()]}function Vet(t){return[...mse(t)]}function vH(t,e,i){i<0&&++i,i>1&&--i;const r=6*i;return r<1?t+(e-t)*r:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function GAe(t,e,i,r=1){const n=(t%360+360)%360/360,s=i<=.5?i*(e+1):i+e-i*e,o=2*i-s;return[Math.round(255*vH(o,s,n+1/3)),Math.round(255*vH(o,s,n)),Math.round(255*vH(o,s,n-1/3)),r]}function Bet(t){const e=t.length>5,i=e?8:4,r=(1<>=i,l[3]=n*c/255),c=o&r,o>>=i,l[2]=n*c,c=o&r,o>>=i,l[1]=n*c,c=o&r,o>>=i,l[0]=n*c,l}const jet=/^-?(\d+(\.\d+)?)\s*((px)|(pt))?$/i,Get="screenUtils.toPt: input not recognized!",HAe=96;function Tr(t){return t?t/72*HAe:0}function ad(t){return t?72*t/HAe:0}function vs(t){if(typeof t=="string"){const e=t.match(jet);if(e){const i=Number(e[1]),r=e[3]&&e[3].toLowerCase(),n=t.charAt(0)==="-",s=r==="px"?ad(i):i;return n?-s:s}return console.warn(Get),null}return t}function Ku(t=0,e=0){return{x:t,y:e}}function ss(t=0,e=0){return[t,e]}function gse(t=0,e=0){return[t,e]}function Za(t=0,e=0,i=0){return[t,e,i]}function bZt(t){return t}function wZt(t){return t}function xZt(t){return t}function dm(t,e){return e?(e[0]=t.x,e[1]=t.y,e.length>2&&(e[2]=0),e):[t.x,t.y]}function SB(){const t=new Float32Array(16);return t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function Het(t){const e=new Float32Array(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function qet(t,e,i,r,n,s,o,l,c,f,_,x,T,A,M,I){const L=new Float32Array(16);return L[0]=t,L[1]=e,L[2]=i,L[3]=r,L[4]=n,L[5]=s,L[6]=o,L[7]=l,L[8]=c,L[9]=f,L[10]=_,L[11]=x,L[12]=T,L[13]=A,L[14]=M,L[15]=I,L}function Wet(t,e){return new Float32Array(t,e,16)}const Yet=SB();Object.freeze(Object.defineProperty({__proto__:null,IDENTITY:Yet,clone:Het,create:SB,createView:Wet,fromValues:qet},Symbol.toStringTag,{value:"Module"}));function Ao(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function s1(t,e,i,r,n,s,o,l,c,f,_,x,T,A,M,I,L){return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t[4]=s,t[5]=o,t[6]=l,t[7]=c,t[8]=f,t[9]=_,t[10]=x,t[11]=T,t[12]=A,t[13]=M,t[14]=I,t[15]=L,t}function Hf(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ld(t,e){if(t===e){const i=e[1],r=e[2],n=e[3],s=e[6],o=e[7],l=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=s,t[11]=e[14],t[12]=n,t[13]=o,t[14]=l}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function sP(t,e){return Vo(t,e)||Hf(t),t}function Vo(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],l=e[5],c=e[6],f=e[7],_=e[8],x=e[9],T=e[10],A=e[11],M=e[12],I=e[13],L=e[14],F=e[15],z=i*l-r*o,k=i*c-n*o,U=i*f-s*o,j=r*c-n*l,H=r*f-s*l,Y=n*f-s*c,Q=_*I-x*M,ne=_*L-T*M,re=_*F-A*M,he=x*L-T*I,ce=x*F-A*I,be=T*F-A*L;let ye=z*be-k*ce+U*he+j*re-H*ne+Y*Q;return ye?(ye=1/ye,t[0]=(l*be-c*ce+f*he)*ye,t[1]=(n*ce-r*be-s*he)*ye,t[2]=(I*Y-L*H+F*j)*ye,t[3]=(T*H-x*Y-A*j)*ye,t[4]=(c*re-o*be-f*ne)*ye,t[5]=(i*be-n*re+s*ne)*ye,t[6]=(L*U-M*Y-F*k)*ye,t[7]=(_*Y-T*U+A*k)*ye,t[8]=(o*ce-l*re+f*Q)*ye,t[9]=(r*re-i*ce-s*Q)*ye,t[10]=(M*H-I*U+F*z)*ye,t[11]=(x*U-_*H-A*z)*ye,t[12]=(l*ne-o*he-c*Q)*ye,t[13]=(i*he-r*ne+n*Q)*ye,t[14]=(I*k-M*j-L*z)*ye,t[15]=(_*j-x*k+T*z)*ye,t):null}function Xet(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],l=e[5],c=e[6],f=e[7],_=e[8],x=e[9],T=e[10],A=e[11],M=e[12],I=e[13],L=e[14],F=e[15];return t[0]=l*(T*F-A*L)-x*(c*F-f*L)+I*(c*A-f*T),t[1]=-(r*(T*F-A*L)-x*(n*F-s*L)+I*(n*A-s*T)),t[2]=r*(c*F-f*L)-l*(n*F-s*L)+I*(n*f-s*c),t[3]=-(r*(c*A-f*T)-l*(n*A-s*T)+x*(n*f-s*c)),t[4]=-(o*(T*F-A*L)-_*(c*F-f*L)+M*(c*A-f*T)),t[5]=i*(T*F-A*L)-_*(n*F-s*L)+M*(n*A-s*T),t[6]=-(i*(c*F-f*L)-o*(n*F-s*L)+M*(n*f-s*c)),t[7]=i*(c*A-f*T)-o*(n*A-s*T)+_*(n*f-s*c),t[8]=o*(x*F-A*I)-_*(l*F-f*I)+M*(l*A-f*x),t[9]=-(i*(x*F-A*I)-_*(r*F-s*I)+M*(r*A-s*x)),t[10]=i*(l*F-f*I)-o*(r*F-s*I)+M*(r*f-s*l),t[11]=-(i*(l*A-f*x)-o*(r*A-s*x)+_*(r*f-s*l)),t[12]=-(o*(x*L-T*I)-_*(l*L-c*I)+M*(l*T-c*x)),t[13]=i*(x*L-T*I)-_*(r*L-n*I)+M*(r*T-n*x),t[14]=-(i*(l*L-c*I)-o*(r*L-n*I)+M*(r*c-n*l)),t[15]=i*(l*T-c*x)-o*(r*T-n*x)+_*(r*c-n*l),t}function Zet(t){const e=t[0],i=t[1],r=t[2],n=t[3],s=t[4],o=t[5],l=t[6],c=t[7],f=t[8],_=t[9],x=t[10],T=t[11],A=t[12],M=t[13],I=t[14],L=t[15];return(e*o-i*s)*(x*L-T*I)-(e*l-r*s)*(_*L-T*M)+(e*c-n*s)*(_*I-x*M)+(i*l-r*o)*(f*L-T*A)-(i*c-n*o)*(f*I-x*A)+(r*c-n*l)*(f*M-_*A)}function nn(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3],l=e[4],c=e[5],f=e[6],_=e[7],x=e[8],T=e[9],A=e[10],M=e[11],I=e[12],L=e[13],F=e[14],z=e[15];let k=i[0],U=i[1],j=i[2],H=i[3];return t[0]=k*r+U*l+j*x+H*I,t[1]=k*n+U*c+j*T+H*L,t[2]=k*s+U*f+j*A+H*F,t[3]=k*o+U*_+j*M+H*z,k=i[4],U=i[5],j=i[6],H=i[7],t[4]=k*r+U*l+j*x+H*I,t[5]=k*n+U*c+j*T+H*L,t[6]=k*s+U*f+j*A+H*F,t[7]=k*o+U*_+j*M+H*z,k=i[8],U=i[9],j=i[10],H=i[11],t[8]=k*r+U*l+j*x+H*I,t[9]=k*n+U*c+j*T+H*L,t[10]=k*s+U*f+j*A+H*F,t[11]=k*o+U*_+j*M+H*z,k=i[12],U=i[13],j=i[14],H=i[15],t[12]=k*r+U*l+j*x+H*I,t[13]=k*n+U*c+j*T+H*L,t[14]=k*s+U*f+j*A+H*F,t[15]=k*o+U*_+j*M+H*z,t}function Qu(t,e,i){const r=i[0],n=i[1],s=i[2];if(e===t)t[12]=e[0]*r+e[4]*n+e[8]*s+e[12],t[13]=e[1]*r+e[5]*n+e[9]*s+e[13],t[14]=e[2]*r+e[6]*n+e[10]*s+e[14],t[15]=e[3]*r+e[7]*n+e[11]*s+e[15];else{const o=e[0],l=e[1],c=e[2],f=e[3],_=e[4],x=e[5],T=e[6],A=e[7],M=e[8],I=e[9],L=e[10],F=e[11];t[0]=o,t[1]=l,t[2]=c,t[3]=f,t[4]=_,t[5]=x,t[6]=T,t[7]=A,t[8]=M,t[9]=I,t[10]=L,t[11]=F,t[12]=o*r+_*n+M*s+e[12],t[13]=l*r+x*n+I*s+e[13],t[14]=c*r+T*n+L*s+e[14],t[15]=f*r+A*n+F*s+e[15]}return t}function $9(t,e,i){const r=i[0],n=i[1],s=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Wh(t,e,i,r){let n,s,o,l,c,f,_,x,T,A,M,I,L,F,z,k,U,j,H,Y,Q,ne,re,he,ce=r[0],be=r[1],ye=r[2],pe=Math.sqrt(ce*ce+be*be+ye*ye);return pe0?(i[0]=2*(l*o+_*r+c*s-f*n)/x,i[1]=2*(c*o+_*n+f*r-l*s)/x,i[2]=2*(f*o+_*s+l*n-c*r)/x):(i[0]=2*(l*o+_*r+c*s-f*n),i[1]=2*(c*o+_*n+f*r-l*s),i[2]=2*(f*o+_*s+l*n-c*r)),YAe(t,e,i),t}const ett=W();function zz(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function XAe(t,e){const i=e[0],r=e[1],n=e[2],s=e[4],o=e[5],l=e[6],c=e[8],f=e[9],_=e[10];return t[0]=Math.sqrt(i*i+r*r+n*n),t[1]=Math.sqrt(s*s+o*o+l*l),t[2]=Math.sqrt(c*c+f*f+_*_),t}function ttt(t,e){const i=e[0]+e[5]+e[10];let r=0;return i>0?(r=2*Math.sqrt(i+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t}function ZAe(t,e,i,r){const n=e[0],s=e[1],o=e[2],l=e[3],c=n+n,f=s+s,_=o+o,x=n*c,T=n*f,A=n*_,M=s*f,I=s*_,L=o*_,F=l*c,z=l*f,k=l*_,U=r[0],j=r[1],H=r[2];return t[0]=(1-(M+L))*U,t[1]=(T+k)*U,t[2]=(A-z)*U,t[3]=0,t[4]=(T-k)*j,t[5]=(1-(x+L))*j,t[6]=(I+F)*j,t[7]=0,t[8]=(A+z)*H,t[9]=(I-F)*H,t[10]=(1-(x+M))*H,t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t}function itt(t,e,i,r,n){const s=e[0],o=e[1],l=e[2],c=e[3],f=s+s,_=o+o,x=l+l,T=s*f,A=s*_,M=s*x,I=o*_,L=o*x,F=l*x,z=c*f,k=c*_,U=c*x,j=r[0],H=r[1],Y=r[2],Q=n[0],ne=n[1],re=n[2],he=(1-(I+F))*j,ce=(A+U)*j,be=(M-k)*j,ye=(A-U)*H,pe=(1-(T+F))*H,Ee=(L+z)*H,te=(M+k)*Y,le=(L-z)*Y,de=(1-(T+I))*Y;return t[0]=he,t[1]=ce,t[2]=be,t[3]=0,t[4]=ye,t[5]=pe,t[6]=Ee,t[7]=0,t[8]=te,t[9]=le,t[10]=de,t[11]=0,t[12]=i[0]+Q-(he*Q+ye*ne+te*re),t[13]=i[1]+ne-(ce*Q+pe*ne+le*re),t[14]=i[2]+re-(be*Q+Ee*ne+de*re),t[15]=1,t}function rtt(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=i+i,l=r+r,c=n+n,f=i*o,_=r*o,x=r*l,T=n*o,A=n*l,M=n*c,I=s*o,L=s*l,F=s*c;return t[0]=1-x-M,t[1]=_+F,t[2]=T-L,t[3]=0,t[4]=_-F,t[5]=1-f-M,t[6]=A+I,t[7]=0,t[8]=T+L,t[9]=A-I,t[10]=1-f-x,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function JAe(t,e,i,r,n,s,o){const l=1/(i-e),c=1/(n-r),f=1/(s-o);return t[0]=2*s*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*s*c,t[6]=0,t[7]=0,t[8]=(i+e)*l,t[9]=(n+r)*c,t[10]=(o+s)*f,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*s*2*f,t[15]=0,t}function ntt(t,e,i,r,n){const s=1/Math.tan(e/2);let o;return t[0]=s/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,n!=null&&n!==1/0?(o=1/(r-n),t[10]=(n+r)*o,t[14]=2*n*r*o):(t[10]=-1,t[14]=-2*r),t}function stt(t,e,i,r){const n=Math.tan(e.upDegrees*Math.PI/180),s=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),l=Math.tan(e.rightDegrees*Math.PI/180),c=2/(o+l),f=2/(n+s);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=f,t[6]=0,t[7]=0,t[8]=-(o-l)*c*.5,t[9]=(n-s)*f*.5,t[10]=r/(i-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*i/(i-r),t[15]=0,t}function KAe(t,e,i,r,n,s,o){const l=1/(e-i),c=1/(r-n),f=1/(s-o);return t[0]=-2*l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*f,t[11]=0,t[12]=(e+i)*l,t[13]=(n+r)*c,t[14]=(o+s)*f,t[15]=1,t}function EB(t,e,i,r){const n=e[0],s=e[1],o=e[2];let l=n-i[0],c=s-i[1],f=o-i[2];const _=sl();if(Math.abs(l)<_&&Math.abs(c)<_&&Math.abs(f)<_)return void Hf(t);let x=1/Math.sqrt(l*l+c*c+f*f);l*=x,c*=x,f*=x;const T=r[0],A=r[1],M=r[2];let I=A*f-M*c,L=M*l-T*f,F=T*c-A*l;x=Math.sqrt(I*I+L*L+F*F),x?(x=1/x,I*=x,L*=x,F*=x):(I=0,L=0,F=0);let z=c*F-f*L,k=f*I-l*F,U=l*L-c*I;x=Math.sqrt(z*z+k*k+U*U),x?(x=1/x,z*=x,k*=x,U*=x):(z=0,k=0,U=0),t[0]=I,t[1]=z,t[2]=l,t[3]=0,t[4]=L,t[5]=k,t[6]=c,t[7]=0,t[8]=F,t[9]=U,t[10]=f,t[11]=0,t[12]=-(I*n+L*s+F*o),t[13]=-(z*n+k*s+U*o),t[14]=-(l*n+c*s+f*o),t[15]=1}function QAe(t,e,i,r){const n=e[0],s=e[1],o=e[2],l=r[0],c=r[1],f=r[2];let _=n-i[0],x=s-i[1],T=o-i[2],A=_*_+x*x+T*T;A>0&&(A=1/Math.sqrt(A),_*=A,x*=A,T*=A);let M=c*T-f*x,I=f*_-l*T,L=l*x-c*_;return A=M*M+I*I+L*L,A>0&&(A=1/Math.sqrt(A),M*=A,I*=A,L*=A),t[0]=M,t[1]=I,t[2]=L,t[3]=0,t[4]=x*L-T*I,t[5]=T*M-_*L,t[6]=_*I-x*M,t[7]=0,t[8]=_,t[9]=x,t[10]=T,t[11]=0,t[12]=n,t[13]=s,t[14]=o,t[15]=1,t}function ott(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function att(t){return Math.sqrt(t[0]**2+t[1]**2+t[2]**2+t[3]**2+t[4]**2+t[5]**2+t[6]**2+t[7]**2+t[8]**2+t[9]**2+t[10]**2+t[11]**2+t[12]**2+t[13]**2+t[14]**2+t[15]**2)}function ltt(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t[9]=e[9]+i[9],t[10]=e[10]+i[10],t[11]=e[11]+i[11],t[12]=e[12]+i[12],t[13]=e[13]+i[13],t[14]=e[14]+i[14],t[15]=e[15]+i[15],t}function eMe(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t[9]=e[9]-i[9],t[10]=e[10]-i[10],t[11]=e[11]-i[11],t[12]=e[12]-i[12],t[13]=e[13]-i[13],t[14]=e[14]-i[14],t[15]=e[15]-i[15],t}function ctt(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12]*i,t[13]=e[13]*i,t[14]=e[14]*i,t[15]=e[15]*i,t}function utt(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t[2]=e[2]+i[2]*r,t[3]=e[3]+i[3]*r,t[4]=e[4]+i[4]*r,t[5]=e[5]+i[5]*r,t[6]=e[6]+i[6]*r,t[7]=e[7]+i[7]*r,t[8]=e[8]+i[8]*r,t[9]=e[9]+i[9]*r,t[10]=e[10]+i[10]*r,t[11]=e[11]+i[11]*r,t[12]=e[12]+i[12]*r,t[13]=e[13]+i[13]*r,t[14]=e[14]+i[14]*r,t[15]=e[15]+i[15]*r,t}function yse(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function CB(t,e){if(t===e)return!0;const i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],l=t[5],c=t[6],f=t[7],_=t[8],x=t[9],T=t[10],A=t[11],M=t[12],I=t[13],L=t[14],F=t[15],z=e[0],k=e[1],U=e[2],j=e[3],H=e[4],Y=e[5],Q=e[6],ne=e[7],re=e[8],he=e[9],ce=e[10],be=e[11],ye=e[12],pe=e[13],Ee=e[14],te=e[15],le=sl();return Math.abs(i-z)<=le*Math.max(1,Math.abs(i),Math.abs(z))&&Math.abs(r-k)<=le*Math.max(1,Math.abs(r),Math.abs(k))&&Math.abs(n-U)<=le*Math.max(1,Math.abs(n),Math.abs(U))&&Math.abs(s-j)<=le*Math.max(1,Math.abs(s),Math.abs(j))&&Math.abs(o-H)<=le*Math.max(1,Math.abs(o),Math.abs(H))&&Math.abs(l-Y)<=le*Math.max(1,Math.abs(l),Math.abs(Y))&&Math.abs(c-Q)<=le*Math.max(1,Math.abs(c),Math.abs(Q))&&Math.abs(f-ne)<=le*Math.max(1,Math.abs(f),Math.abs(ne))&&Math.abs(_-re)<=le*Math.max(1,Math.abs(_),Math.abs(re))&&Math.abs(x-he)<=le*Math.max(1,Math.abs(x),Math.abs(he))&&Math.abs(T-ce)<=le*Math.max(1,Math.abs(T),Math.abs(ce))&&Math.abs(A-be)<=le*Math.max(1,Math.abs(A),Math.abs(be))&&Math.abs(M-ye)<=le*Math.max(1,Math.abs(M),Math.abs(ye))&&Math.abs(I-pe)<=le*Math.max(1,Math.abs(I),Math.abs(pe))&&Math.abs(L-Ee)<=le*Math.max(1,Math.abs(L),Math.abs(Ee))&&Math.abs(F-te)<=le*Math.max(1,Math.abs(F),Math.abs(te))}function vse(t){const e=sl(),i=t[0],r=t[1],n=t[2],s=t[4],o=t[5],l=t[6],c=t[8],f=t[9],_=t[10];return Math.abs(1-(i*i+s*s+c*c))<=e&&Math.abs(1-(r*r+o*o+f*f))<=e&&Math.abs(1-(n*n+l*l+_*_))<=e}function AB(t){return t[0]===1&&t[1]===0&&t[2]===0&&t[4]===0&&t[5]===1&&t[6]===0&&t[8]===0&&t[9]===0&&t[10]===1}const htt=nn,dtt=eMe;Object.freeze(Object.defineProperty({__proto__:null,add:ltt,adjoint:Xet,copy:Ao,determinant:Zet,equals:CB,exactEquals:yse,frob:att,fromQuat:rtt,fromQuat2:Qet,fromRotation:xp,fromRotationTranslation:YAe,fromRotationTranslationScale:ZAe,fromRotationTranslationScaleOrigin:itt,fromScaling:Jet,fromTranslation:L9,fromXRotation:qAe,fromYRotation:Ket,fromZRotation:WAe,frustum:JAe,getRotation:ttt,getScaling:XAe,getTranslation:zz,hasIdentityRotation:AB,identity:Hf,invert:Vo,invertOrIdentity:sP,isOrthoNormal:vse,lookAt:EB,mul:htt,multiply:nn,multiplyScalar:ctt,multiplyScalarAndAdd:utt,ortho:KAe,perspective:ntt,perspectiveFromFieldOfView:stt,rotate:Wh,rotateX:WO,rotateY:TB,rotateZ:YO,scale:$9,set:s1,str:ott,sub:dtt,subtract:eMe,targetTo:QAe,translate:Qu,transpose:ld},Symbol.toStringTag,{value:"Module"}));const ptt=(t,e)=>{const i=s1(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1);return ld(i,i)},ftt=(t,e)=>{const i=s1(t,e,0,0,.5-.5*e,0,e,0,.5-.5*e,0,0,e,.5-.5*e,0,0,0,1);return ld(i,i)},mtt=(t,e)=>{const i=1-e,r=s1(t,.2126+.7874*i,.7152-.7152*i,.0722-.0722*i,0,.2126-.2126*i,.7152+.2848*i,.0722-.0722*i,0,.2126-.2126*i,.7152-.7152*i,.0722+.9278*i,0,0,0,0,1);return ld(r,r)},gtt=(t,e)=>{const i=Math.sin(e*Math.PI/180),r=Math.cos(e*Math.PI/180),n=s1(t,.213+.787*r-.213*i,.715-.715*r-.715*i,.072-.072*r+.928*i,0,.213-.213*r+.143*i,.715+.285*r+.14*i,.072-.072*r-.283*i,0,.213-.213*r-.787*i,.715-.715*r+.715*i,.072+.928*r+.072*i,0,0,0,0,1);return ld(n,n)},ytt=(t,e)=>{const i=1-2*e,r=s1(t,i,0,0,e,0,i,0,e,0,0,i,e,0,0,0,1);return ld(r,r)},vtt=(t,e)=>{const i=s1(t,.213+.787*e,.715-.715*e,.072-.072*e,0,.213-.213*e,.715+.285*e,.072-.072*e,0,.213-.213*e,.715-.715*e,.072+.928*e,0,0,0,0,1);return ld(i,i)},_tt=(t,e)=>{const i=1-e,r=s1(t,.393+.607*i,.769-.769*i,.189-.189*i,0,.349-.349*i,.686+.314*i,.168-.168*i,0,.272-.272*i,.534-.534*i,.131+.869*i,0,0,0,0,1);return ld(r,r)};let tMe=class iMe{constructor(e,i,r){this.strength=e,this.radius=i,this.threshold=r,this.type="bloom"}interpolate(e,i,r){this.strength=Fh(e.strength,i.strength,r),this.radius=Fh(e.radius,i.radius,r),this.threshold=Fh(e.threshold,i.threshold,r)}clone(){return new iMe(this.strength,this.radius,this.threshold)}toJSON(){return{type:"bloom",radius:ZI(this.radius),strength:this.strength,threshold:this.threshold}}},rMe=class nMe{constructor(e){this.radius=e,this.type="blur"}interpolate(e,i,r){this.radius=Math.round(Fh(e.radius,i.radius,r))}clone(){return new nMe(this.radius)}toJSON(){return{type:"blur",radius:ZI(this.radius)}}},JZ=class sMe{constructor(e,i){this.type=e,this.amount=i,this.type!=="invert"&&this.type!=="grayscale"&&this.type!=="sepia"||(this.amount=Math.min(this.amount,1))}get colorMatrix(){return this._colorMatrix||this._updateMatrix(),this._colorMatrix}interpolate(e,i,r){this.amount=Fh(e.amount,i.amount,r),this._updateMatrix()}clone(){return new sMe(this.type,this.amount)}toJSON(){return{type:this.type,amount:this.amount}}_updateMatrix(){const e=this._colorMatrix||SB();switch(this.type){case"brightness":this._colorMatrix=ptt(e,this.amount);break;case"contrast":this._colorMatrix=ftt(e,this.amount);break;case"grayscale":this._colorMatrix=mtt(e,this.amount);break;case"invert":this._colorMatrix=ytt(e,this.amount);break;case"saturate":this._colorMatrix=vtt(e,this.amount);break;case"sepia":this._colorMatrix=_tt(e,this.amount)}}},oMe=class aMe{constructor(e,i,r,n){this.offsetX=e,this.offsetY=i,this.blurRadius=r,this.color=n,this.type="drop-shadow"}interpolate(e,i,r){this.offsetX=Fh(e.offsetX,i.offsetX,r),this.offsetY=Fh(e.offsetY,i.offsetY,r),this.blurRadius=Fh(e.blurRadius,i.blurRadius,r),this.color[0]=Math.round(Fh(e.color[0],i.color[0],r)),this.color[1]=Math.round(Fh(e.color[1],i.color[1],r)),this.color[2]=Math.round(Fh(e.color[2],i.color[2],r)),this.color[3]=Fh(e.color[3],i.color[3],r)}clone(){return new aMe(this.offsetX,this.offsetY,this.blurRadius,[...this.color])}toJSON(){const e=[...this.color];return e[3]*=255,{type:"drop-shadow",xoffset:ZI(this.offsetX),yoffset:ZI(this.offsetY),blurRadius:ZI(this.blurRadius),color:e}}},lMe=class cMe{constructor(e){this.angle=e,this.type="hue-rotate"}get colorMatrix(){return this._colorMatrix||this._updateMatrix(),this._colorMatrix}interpolate(e,i,r){this.angle=Fh(e.angle,i.angle,r),this._updateMatrix()}clone(){return new cMe(this.angle)}toJSON(){return{type:"hue-rotate",angle:this.angle}}_updateMatrix(){const e=this._colorMatrix||SB();this._colorMatrix=gtt(e,this.angle)}},uMe=class hMe{constructor(e){this.amount=e,this.type="opacity",this.amount=Math.min(this.amount,1)}interpolate(e,i,r){this.amount=Fh(e.amount,i.amount,r)}clone(){return new hMe(this.amount)}toJSON(){return{type:"opacity",amount:this.amount}}};function Fh(t,e,i){return t+(e-t)*i}function ZI(t){return Math.round(1e3*ad(t))/1e3}function btt(t){switch(t.type){case"grayscale":case"sepia":case"invert":return new JZ(t.type,0);case"saturate":case"brightness":case"contrast":return new JZ(t.type,1);case"opacity":return new uMe(1);case"hue-rotate":return new lMe(0);case"blur":return new rMe(0);case"drop-shadow":return new oMe(0,0,0,[...mse("transparent")]);case"bloom":return new tMe(0,0,1)}}var SZt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oP(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function dMe(t,e){const i=t.length>e.length?t:e;return(t.length>e.length?e:t).every((r,n)=>r.type===i[n].type)}function pMe(t,e){const i=t.length>e.length?t:e,r=t.length>e.length?e:t;for(let n=r.length;ns?n:(s-=n.length,n+(o+=o.repeat(s)).slice(0,s))}function r(n,s){var o,l={},c=(s=s!==void 0?s:{}).grammarSource,f={start:cs},_=cs,x="none",T=")",A=",",M="(",I="%",L="px",F="cm",z="mm",k="in",U="pt",j="pc",H="deg",Y="rad",Q="grad",ne="turn",re="#",he=".",ce="e",be=/^[ \t\n\r]/,ye=/^[a-z\-]/,pe=/^[0-9a-fA-F]/,Ee=/^[+\-]/,te=/^[0-9]/,le=lt("none"),de=Xe("none",!1),ve=Xe(")",!1),Se=Xe(",",!1),Ae=lt("whitespace"),Pe=We([" "," ",` -`,"\r"],!1,!1),Ge=lt("function"),ut=Xe("(",!1),Ft=lt("identifier"),Qt=We([["a","z"],"-"],!1,!1),At=lt("percentage"),ri=Xe("%",!1),Rt=lt("length"),dt=Xe("px",!1),pt=Xe("cm",!1),oi=Xe("mm",!1),ht=Xe("in",!1),Et=Xe("pt",!1),Dt=Xe("pc",!1),Tt=lt("angle"),ie=Xe("deg",!1),Ht=Xe("rad",!1),hr=Xe("grad",!1),Ke=Xe("turn",!1),Lt=lt("number"),vt=lt("color"),Bt=Xe("#",!1),qt=We([["0","9"],["a","f"],["A","F"]],!1,!1),li=We(["+","-"],!1,!1),mi=We([["0","9"]],!1,!1),Lr=Xe(".",!1),Dr=Xe("e",!1),Ze=function(){return[]},xi=function(xe,He){return{type:"function",name:xe,parameters:He||[]}},m=function(xe,He){return He.length>0?RP(xe,He,3):[xe]},D=function(xe){return{type:"quantity",value:xe.value,unit:xe.unit}},E=function(xe){return{type:"color",colorType:xe.type,value:xe.value}},p=function(xe){return xe},h=function(){return Fe()},a=function(xe){return{value:xe,unit:"%"}},u=function(xe){return{value:xe,unit:"px"}},d=function(xe){return{value:xe,unit:"cm"}},g=function(xe){return{value:xe,unit:"mm"}},v=function(xe){return{value:xe,unit:"in"}},b=function(xe){return{value:xe,unit:"pt"}},S=function(xe){return{value:xe,unit:"pc"}},C=function(xe){return{value:xe,unit:"deg"}},O=function(xe){return{value:xe,unit:"rad"}},R=function(xe){return{value:xe,unit:"grad"}},$=function(xe){return{value:xe,unit:"turn"}},N=function(xe){return{value:xe,unit:null}},B=function(){return{type:"hex",value:Fe()}},G=function(xe){return{type:"function",value:xe}},K=function(){return{type:"named",value:Fe()}},ee=function(){return parseFloat(Fe())},q=0,oe=0,ge=[{line:1,column:1}],me=0,Me=[],Te=0;if("startRule"in s){if(!(s.startRule in f))throw new Error(`Can't start parsing from rule "`+s.startRule+'".');_=f[s.startRule]}function Fe(){return n.substring(oe,q)}function Xe(xe,He){return{type:"literal",text:xe,ignoreCase:He}}function We(xe,He,ct){return{type:"class",parts:xe,inverted:He,ignoreCase:ct}}function Mt(){return{type:"end"}}function lt(xe){return{type:"other",description:xe}}function yi(xe){var He,ct=ge[xe];if(ct)return ct;for(He=xe-1;!ge[He];)He--;for(ct={line:(ct=ge[He]).line,column:ct.column};Heme&&(me=q,Me=[]),Me.push(xe))}function rn(xe,He,ct){return new e(e.buildMessage(xe,He),xe,He,ct)}function cs(){var xe;return(xe=on())===l&&(xe=Gi()),xe}function on(){var xe,He;return Te++,xe=q,Ri(),n.substr(q,4)===x?(He=x,q+=4):(He=l,Te===0&&Ct(de)),He!==l?(Ri(),oe=xe,xe=Ze()):(q=xe,xe=l),Te--,xe===l&&Te===0&&Ct(le),xe}function Gi(){var xe,He;if(xe=[],(He=nr())!==l)for(;He!==l;)xe.push(He),He=nr();else xe=l;return xe}function nr(){var xe,He,ct,fr;return xe=q,Ri(),(He=Aa())!==l?(Ri(),(ct=zi())===l&&(ct=null),Ri(),n.charCodeAt(q)===41?(fr=T,q++):(fr=l,Te===0&&Ct(ve)),fr!==l?(Ri(),oe=xe,xe=xi(He,ct)):(q=xe,xe=l)):(q=xe,xe=l),xe}function zi(){var xe,He,ct,fr,Go,Fn,Rc,yx;if(xe=q,(He=pr())!==l){for(ct=[],fr=q,Go=Ri(),n.charCodeAt(q)===44?(Fn=A,q++):(Fn=l,Te===0&&Ct(Se)),Fn===l&&(Fn=null),Rc=Ri(),(yx=pr())!==l?fr=Go=[Go,Fn,Rc,yx]:(q=fr,fr=l);fr!==l;)ct.push(fr),fr=q,Go=Ri(),n.charCodeAt(q)===44?(Fn=A,q++):(Fn=l,Te===0&&Ct(Se)),Fn===l&&(Fn=null),Rc=Ri(),(yx=pr())!==l?fr=Go=[Go,Fn,Rc,yx]:(q=fr,fr=l);oe=xe,xe=m(He,ct)}else q=xe,xe=l;return xe}function pr(){var xe,He;return xe=q,(He=jo())===l&&(He=Kr())===l&&(He=Ap())===l&&(He=gd()),He!==l&&(oe=xe,He=D(He)),(xe=He)===l&&(xe=q,(He=m1())!==l&&(oe=xe,He=E(He)),xe=He),xe}function Ri(){var xe,He;for(Te++,xe=[],be.test(n.charAt(q))?(He=n.charAt(q),q++):(He=l,Te===0&&Ct(Pe));He!==l;)xe.push(He),be.test(n.charAt(q))?(He=n.charAt(q),q++):(He=l,Te===0&&Ct(Pe));return Te--,He=l,Te===0&&Ct(Ae),xe}function Aa(){var xe,He,ct;return Te++,xe=q,(He=dr())!==l?(n.charCodeAt(q)===40?(ct=M,q++):(ct=l,Te===0&&Ct(ut)),ct!==l?(oe=xe,xe=p(He)):(q=xe,xe=l)):(q=xe,xe=l),Te--,xe===l&&(He=l,Te===0&&Ct(Ge)),xe}function dr(){var xe,He,ct;if(Te++,xe=q,He=[],ye.test(n.charAt(q))?(ct=n.charAt(q),q++):(ct=l,Te===0&&Ct(Qt)),ct!==l)for(;ct!==l;)He.push(ct),ye.test(n.charAt(q))?(ct=n.charAt(q),q++):(ct=l,Te===0&&Ct(Qt));else He=l;return He!==l&&(oe=xe,He=h()),Te--,(xe=He)===l&&(He=l,Te===0&&Ct(Ft)),xe}function jo(){var xe,He,ct;return Te++,xe=q,Ri(),(He=ol())!==l?(n.charCodeAt(q)===37?(ct=I,q++):(ct=l,Te===0&&Ct(ri)),ct!==l?(oe=xe,xe=a(He)):(q=xe,xe=l)):(q=xe,xe=l),Te--,xe===l&&Te===0&&Ct(At),xe}function Kr(){var xe,He,ct;return Te++,xe=q,Ri(),(He=ol())!==l?(n.substr(q,2)===L?(ct=L,q+=2):(ct=l,Te===0&&Ct(dt)),ct!==l?(oe=xe,xe=u(He)):(q=xe,xe=l)):(q=xe,xe=l),xe===l&&(xe=q,Ri(),(He=ol())!==l?(n.substr(q,2)===F?(ct=F,q+=2):(ct=l,Te===0&&Ct(pt)),ct!==l?(oe=xe,xe=d(He)):(q=xe,xe=l)):(q=xe,xe=l),xe===l&&(xe=q,Ri(),(He=ol())!==l?(n.substr(q,2)===z?(ct=z,q+=2):(ct=l,Te===0&&Ct(oi)),ct!==l?(oe=xe,xe=g(He)):(q=xe,xe=l)):(q=xe,xe=l),xe===l&&(xe=q,Ri(),(He=ol())!==l?(n.substr(q,2)===k?(ct=k,q+=2):(ct=l,Te===0&&Ct(ht)),ct!==l?(oe=xe,xe=v(He)):(q=xe,xe=l)):(q=xe,xe=l),xe===l&&(xe=q,Ri(),(He=ol())!==l?(n.substr(q,2)===U?(ct=U,q+=2):(ct=l,Te===0&&Ct(Et)),ct!==l?(oe=xe,xe=b(He)):(q=xe,xe=l)):(q=xe,xe=l),xe===l&&(xe=q,Ri(),(He=ol())!==l?(n.substr(q,2)===j?(ct=j,q+=2):(ct=l,Te===0&&Ct(Dt)),ct!==l?(oe=xe,xe=S(He)):(q=xe,xe=l)):(q=xe,xe=l)))))),Te--,xe===l&&Te===0&&Ct(Rt),xe}function Ap(){var xe,He,ct;return Te++,xe=q,(He=ol())!==l?(n.substr(q,3)===H?(ct=H,q+=3):(ct=l,Te===0&&Ct(ie)),ct!==l?(oe=xe,xe=C(He)):(q=xe,xe=l)):(q=xe,xe=l),xe===l&&(xe=q,(He=ol())!==l?(n.substr(q,3)===Y?(ct=Y,q+=3):(ct=l,Te===0&&Ct(Ht)),ct!==l?(oe=xe,xe=O(He)):(q=xe,xe=l)):(q=xe,xe=l),xe===l&&(xe=q,(He=ol())!==l?(n.substr(q,4)===Q?(ct=Q,q+=4):(ct=l,Te===0&&Ct(hr)),ct!==l?(oe=xe,xe=R(He)):(q=xe,xe=l)):(q=xe,xe=l),xe===l&&(xe=q,(He=ol())!==l?(n.substr(q,4)===ne?(ct=ne,q+=4):(ct=l,Te===0&&Ct(Ke)),ct!==l?(oe=xe,xe=$(He)):(q=xe,xe=l)):(q=xe,xe=l)))),Te--,xe===l&&(He=l,Te===0&&Ct(Tt)),xe}function gd(){var xe,He;return Te++,xe=q,Ri(),(He=ol())!==l?(oe=xe,xe=N(He)):(q=xe,xe=l),Te--,xe===l&&Te===0&&Ct(Lt),xe}function m1(){var xe,He,ct,fr;if(Te++,xe=q,n.charCodeAt(q)===35?(He=re,q++):(He=l,Te===0&&Ct(Bt)),He!==l){if(ct=[],pe.test(n.charAt(q))?(fr=n.charAt(q),q++):(fr=l,Te===0&&Ct(qt)),fr!==l)for(;fr!==l;)ct.push(fr),pe.test(n.charAt(q))?(fr=n.charAt(q),q++):(fr=l,Te===0&&Ct(qt));else ct=l;ct!==l?(oe=xe,xe=B()):(q=xe,xe=l)}else q=xe,xe=l;return xe===l&&(xe=q,(He=nr())!==l&&(oe=xe,He=G(He)),(xe=He)===l&&(xe=q,(He=dr())!==l&&(oe=xe,He=K()),xe=He)),Te--,xe===l&&(He=l,Te===0&&Ct(vt)),xe}function ol(){var xe,He,ct,fr,Go,Fn,Rc;for(xe=q,Ee.test(n.charAt(q))?(n.charAt(q),q++):Te===0&&Ct(li),He=q,ct=[],te.test(n.charAt(q))?(fr=n.charAt(q),q++):(fr=l,Te===0&&Ct(mi));fr!==l;)ct.push(fr),te.test(n.charAt(q))?(fr=n.charAt(q),q++):(fr=l,Te===0&&Ct(mi));if(n.charCodeAt(q)===46?(fr=he,q++):(fr=l,Te===0&&Ct(Lr)),fr!==l){if(Go=[],te.test(n.charAt(q))?(Fn=n.charAt(q),q++):(Fn=l,Te===0&&Ct(mi)),Fn!==l)for(;Fn!==l;)Go.push(Fn),te.test(n.charAt(q))?(Fn=n.charAt(q),q++):(Fn=l,Te===0&&Ct(mi));else Go=l;Go!==l?He=ct=[ct,fr,Go]:(q=He,He=l)}else q=He,He=l;if(He===l)if(He=[],te.test(n.charAt(q))?(ct=n.charAt(q),q++):(ct=l,Te===0&&Ct(mi)),ct!==l)for(;ct!==l;)He.push(ct),te.test(n.charAt(q))?(ct=n.charAt(q),q++):(ct=l,Te===0&&Ct(mi));else He=l;if(He!==l){if(ct=q,n.charCodeAt(q)===101?(fr=ce,q++):(fr=l,Te===0&&Ct(Dr)),fr!==l){if(Ee.test(n.charAt(q))?(Go=n.charAt(q),q++):(Go=l,Te===0&&Ct(li)),Go===l&&(Go=null),Fn=[],te.test(n.charAt(q))?(Rc=n.charAt(q),q++):(Rc=l,Te===0&&Ct(mi)),Rc!==l)for(;Rc!==l;)Fn.push(Rc),te.test(n.charAt(q))?(Rc=n.charAt(q),q++):(Rc=l,Te===0&&Ct(mi));else Fn=l;Fn!==l?ct=fr=[fr,Go,Fn]:(q=ct,ct=l)}else q=ct,ct=l;ct===l&&(ct=null),oe=xe,xe=ee()}else q=xe,xe=l;return xe}function PP(xe,He){return xe.map(function(ct){return ct[He]})}function RP(xe,He,ct){return[xe].concat(PP(He,ct))}if((o=_())!==l&&q===n.length)return o;throw o!==l&&qt*t,sb=t=>t*t*t,vL={length:{baseUnit:"meters",units:{millimeters:{inBaseUnits:.001},centimeters:{inBaseUnits:.01},decimeters:{inBaseUnits:.1},meters:{inBaseUnits:1},kilometers:{inBaseUnits:1e3},inches:{inBaseUnits:.0254},feet:{inBaseUnits:.3048},yards:{inBaseUnits:.9144},miles:{inBaseUnits:1609.344},"nautical-miles":{inBaseUnits:1852},"us-feet":{inBaseUnits:1200/3937}}},area:{baseUnit:"square-meters",units:{"square-millimeters":{inBaseUnits:eg(.001)},"square-centimeters":{inBaseUnits:eg(.01)},"square-decimeters":{inBaseUnits:eg(.1)},"square-meters":{inBaseUnits:1},"square-kilometers":{inBaseUnits:eg(1e3)},"square-inches":{inBaseUnits:eg(.0254)},"square-feet":{inBaseUnits:eg(.3048)},"square-yards":{inBaseUnits:eg(.9144)},"square-miles":{inBaseUnits:eg(1609.344)},"square-us-feet":{inBaseUnits:eg(1200/3937)},acres:{inBaseUnits:.0015625*eg(1609.344)},ares:{inBaseUnits:100},hectares:{inBaseUnits:1e4}}},volume:{baseUnit:"liters",units:{liters:{inBaseUnits:1},"cubic-millimeters":{inBaseUnits:1e3*sb(.001)},"cubic-centimeters":{inBaseUnits:1e3*sb(.01)},"cubic-decimeters":{inBaseUnits:1e3*sb(.1)},"cubic-meters":{inBaseUnits:1e3},"cubic-kilometers":{inBaseUnits:1e3*sb(1e3)},"cubic-inches":{inBaseUnits:1e3*sb(.0254)},"cubic-feet":{inBaseUnits:1e3*sb(.3048)},"cubic-yards":{inBaseUnits:1e3*sb(.9144)},"cubic-miles":{inBaseUnits:1e3*sb(1609.344)}}},angle:{baseUnit:"radians",units:{radians:{inBaseUnits:1},degrees:{inBaseUnits:Math.PI/180}}}},IWe=(()=>{const t={};for(const e in vL)for(const i in vL[e].units)t[i]=e;return t})();function $We(t,e,i){return t*vL[i].units[e].inBaseUnits}function LWe(t,e,i){return t/vL[i].units[e].inBaseUnits}const DWe=["metric","imperial","square-inches","square-feet","square-yards","square-miles","square-us-feet","square-meters","square-kilometers","acres","ares","hectares"],_L=["metric","imperial","inches","feet","yards","miles","nautical-miles","us-feet","meters","kilometers"],NWe=new Map([["meters","square-meters"],["feet","square-feet"],["us-feet","square-us-feet"]]);function FWe(t){return t==="imperial"||t==="metric"}function kT(t){const e=IWe[t];if(!e)throw new Error("unknown type");return e}function Yhe(t,e=null){return e=e||kT(t),vL[e].baseUnit===t}function Ur(t,e,i){if(e===i)return t;const r=kT(e);if(r!==kT(i))throw new Error("incompatible units");const n=Yhe(e,r)?t:$We(t,e,r);return Yhe(i,r)?n:LWe(n,i,r)}function kWe(t){switch(t){case"metric":return"meters";case"imperial":return"feet";default:return t}}function DZt(t){return kWe(t)}function NZt(t){switch(t){case"metric":return"square-meters";case"imperial":return"square-feet";default:return t}}function zWe(t,e,i){switch(i){case"metric":return Gne(t,e);case"imperial":return qne(t,e);default:return i}}function UWe(t,e,i){switch(i){case"metric":return Hne(t,e);case"imperial":return Wne(t,e);default:return i}}function Gne(t,e){const i=Ur(t,e,"meters");return Math.abs(i)<3e3?"meters":"kilometers"}function Hne(t,e){const i=Ur(t,e,"meters");return Math.abs(i)<1e5?"meters":"kilometers"}function qne(t,e){const i=Ur(t,e,"feet");return Math.abs(i)<1e3?"feet":"miles"}function Wne(t,e){const i=Ur(t,e,"feet");return Math.abs(i)<1e5?"feet":"miles"}function VWe(t,e){const i=Ur(t,e,"square-meters");return Math.abs(i)<3e6?"square-meters":"square-kilometers"}function BWe(t,e){const i=Ur(t,e,"square-feet");return Math.abs(i)<1e6?"square-feet":"square-miles"}function sEe(t,e,i){return Ur(t,e,"meters")/(i*Math.PI/180)}function oEe(t){return RWe.fromJSON(t.toLowerCase())||null}function ad(t){if(t!=null&&!XO(t))return 1;const e=xs(t);return e>1e5?1:e}function aEe(t){return xs(t)>=Tr(t).metersPerDegree?"meters":O9(t)}function xs(t,e=Or.metersPerDegree){return lEe(t,!0)??e}function lEe(t,e=!1){const i=(t==null?void 0:t.wkid)??null,r=(t==null?void 0:t.wkt2)??(t==null?void 0:t.wkt)??null;let n=null;if(i){if(Une(i))return My.metersPerDegree;if(Vne(i))return y_.metersPerDegree;n=fT.values[fT[i]],!n&&e&&PWe.has(i)&&(n=OWe)}else r&&(Yne(r)?n=Xhe(rEe.exec(r),n):uEe(r)&&(n=Xhe(nEe.exec(r),n)));return n}function RZ(t){return cB(t)?1:xs(t)}function Xhe(t,e){return t!=null&&t[1]?cEe(t[1]):e}function cEe(t){return parseFloat(t.split(",")[1])}function O9(t){const e=(t==null?void 0:t.wkid)??null,i=(t==null?void 0:t.wkt2)??(t==null?void 0:t.wkt)??null;let r=null;if(e)r=fT.units[fT[e]];else if(i){const n=Yne(i)?rEe:uEe(i)?nEe:null;if(n){const s=n.exec(i);s!=null&&s[1]&&(r=GWe(s[1]))}}return r!=null?oEe(r):null}function FZt(t){const e=O9(t);return e!=null&&_L.includes(e)?e:null}function kZt(t){const e=aEe(t);return e!=null&&_L.includes(e)?e:null}function zZt(t){const e=O9(t);return e==null?null:NWe.get(e)}function uEe(t){return/^GEOCCS/i.test(t)}function Yne(t){return/^\s*(?:PROJCS|PROJCRS|PROJECTEDCRS)/i.test(t)}const jWe=1e-7;function GWe(t){const e=/[\\"']{1}([^\\"']+)/.exec(t);let i=e==null?void 0:e[1];if(!i||!fT.units.includes(i)){const r=cEe(t);i=null;const n=fT.values;for(let s=0;s{const a=s.constructor.prototype;for(const c of r){const p=bne(s,c,n);p.write&&typeof p.write=="object"||(p.write={}),i&&(p.write.target=i),p.write.writer=a[o]}}}var xg;let Mn=xg=class extends Ue{static fromJSON(t){if(!t)return null;if(t.wkid){if(t.wkid===102100)return xg.WebMercator;if(t.wkid===4326)return xg.WGS84}const e=new xg;return e.read(t),e}constructor(t){super(t),this.latestWkid=null,this.wkid=null,this.wkt=null,this.wkt2=null,this.vcsWkid=null,this.latestVcsWkid=null,this.imageCoordinateSystem=null}normalizeCtorArgs(t){return t&&typeof t=="object"?t:{[typeof t=="string"?"wkt":"wkid"]:t}}get isWGS84(){return gL(this)}get isWebMercator(){return FT(this)}get isGeographic(){return cB(this)}get isWrappable(){return EWe(this)}get metersPerUnit(){return xs(this)}get unit(){return O9(this)||(this.isGeographic?"degrees":null)}writeWkt(t,e){this.wkid||(e.wkt=t)}clone(){if(this===xg.WGS84)return xg.WGS84;if(this===xg.WebMercator)return xg.WebMercator;const t=new xg;return this.wkid!=null?(t.wkid=this.wkid,this.latestWkid!=null&&(t.latestWkid=this.latestWkid),this.vcsWkid!=null&&(t.vcsWkid=this.vcsWkid),this.latestVcsWkid!=null&&(t.latestVcsWkid=this.latestVcsWkid)):(this.wkt!=null&&(t.wkt=this.wkt),this.wkt2!=null&&(t.wkt2=this.wkt2)),this.imageCoordinateSystem&&(t.imageCoordinateSystem=Pe(this.imageCoordinateSystem)),t}equals(t){if(t==null)return!1;if(this.imageCoordinateSystem||t.imageCoordinateSystem){if(this.imageCoordinateSystem==null||t.imageCoordinateSystem==null)return!1;const{id:e,referenceServiceName:i}=t.imageCoordinateSystem,{geodataXform:r}=t.imageCoordinateSystem,n=this.imageCoordinateSystem;return e==null||r?JSON.stringify(n)===JSON.stringify(t.imageCoordinateSystem):i?n.id===e&&n.referenceServiceName===i:n.id===e}return jn(this,t)}toJSON(t){return this.write(void 0,t)}};Mn.GCS_NAD_1927=null,Mn.WGS84=null,Mn.WebMercator=null,Mn.PlateCarree=null,y([w({readOnly:!0})],Mn.prototype,"isWGS84",null),y([w({readOnly:!0})],Mn.prototype,"isWebMercator",null),y([w({readOnly:!0})],Mn.prototype,"isGeographic",null),y([w({readOnly:!0})],Mn.prototype,"isWrappable",null),y([w({type:_n,json:{write:!0}})],Mn.prototype,"latestWkid",void 0),y([w({readOnly:!0})],Mn.prototype,"metersPerUnit",null),y([w({readOnly:!0})],Mn.prototype,"unit",null),y([w({type:_n,json:{write:!0,origins:{"web-scene":{write:{overridePolicy(){return{isRequired:this.wkt==null}}}}}}})],Mn.prototype,"wkid",void 0),y([w({type:String,json:{origins:{"web-scene":{write:{overridePolicy(){return{isRequired:this.wkid==null}}}}}}})],Mn.prototype,"wkt",void 0),y([Et("wkt"),Et("web-scene","wkt")],Mn.prototype,"writeWkt",null),y([w({type:String,json:{write:!1}})],Mn.prototype,"wkt2",void 0),y([w({type:_n,json:{write:!0}})],Mn.prototype,"vcsWkid",void 0),y([w({type:_n,json:{write:!0}})],Mn.prototype,"latestVcsWkid",void 0),y([w()],Mn.prototype,"imageCoordinateSystem",void 0),Mn=xg=y([Z("esri.geometry.SpatialReference")],Mn),Mn.prototype.toJSON.isDefaultToJSON=!0,Mn.GCS_NAD_1927=new Mn({wkid:4267,wkt:'GEOGCS["GCS_North_American_1927",DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]'}),Mn.WGS84=new Mn(CWe),Mn.WebMercator=new Mn(AWe),Mn.PlateCarree=new Mn(MWe),Object.freeze&&(Object.freeze(Mn.GCS_NAD_1927),Object.freeze(Mn.WGS84),Object.freeze(Mn.WebMercator));const rt=Mn;let Sg=class extends Ue{constructor(...e){super(...e),this.type=null,this.hasM=!1,this.hasZ=!1,this.spatialReference=rt.WGS84}get cache(){return this.commitProperty("spatialReference"),{}}get extent(){return null}readSpatialReference(e,i){if(e instanceof rt)return e;if(e!=null){const r=new rt;return r.read(e,i),r}return e}clone(){return console.warn(".clone() is not implemented for "+this.declaredClass),null}clearCache(){this.notifyChange("cache")}getCacheValue(e){return this.cache[e]}setCacheValue(e,i){this.cache[e]=i}};y([w()],Sg.prototype,"type",void 0),y([w({readOnly:!0})],Sg.prototype,"cache",null),y([w({readOnly:!0})],Sg.prototype,"extent",null),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Sg.prototype,"hasM",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Sg.prototype,"hasZ",void 0),y([w({type:rt,json:{write:!0},value:rt.WGS84})],Sg.prototype,"spatialReference",void 0),y([Rt("spatialReference")],Sg.prototype,"readSpatialReference",null),Sg=y([Z("esri.geometry.Geometry")],Sg);const ax=Sg,XWe=Object.prototype.toString;function ZWe(t){const e="__accessorMetadata__"in t?_s(t):t;return function(...i){if(i.push(e),typeof i[2]=="number")throw new Error("Using @cast has parameter decorator is not supported since 4.16");return JWe.apply(this,i)}}function JWe(t,e,i,r){T9(t,e).cast=r}function KWe(t){return(e,i)=>{T9(e,t).cast=e[i]}}function Ci(...t){if(t.length!==3||typeof t[1]!="string")return t.length===1&&XWe.call(t[0])==="[object Function]"?ZWe(t[0]):t.length===1&&typeof t[0]=="string"?KWe(t[0]):void 0}function QWe(t,e){const i=t.x-e.x,r=t.y-e.y,n=t.hasZ&&e.hasZ?t.z-e.z:0;return Math.sqrt(i*i+r*r+n*n)}const eYe=57.29577951308232,tYe=.017453292519943;function Zhe(t){return t*eYe}function Jhe(t){return t*tYe}function Khe(t){return t/Or.radius}function xz(t){return Math.PI/2-2*Math.atan(Math.exp(-t/Or.radius))}function IZ(t){return t.wkid!=null||t.wkt!=null}const mH=[0,0];function Sz(t,e,i,r,n){const s=t,o=n;if(o.spatialReference=i,"x"in s&&"x"in o)[o.x,o.y]=e(s.x,s.y,mH,r);else if("xmin"in s&&"xmin"in o)[o.xmin,o.ymin]=e(s.xmin,s.ymin,mH,r),[o.xmax,o.ymax]=e(s.xmax,s.ymax,mH,r);else if("paths"in s&&"paths"in o||"rings"in s&&"rings"in o){const a="paths"in s?s.paths:s.rings,c=[];let p;for(let _=0;_2&&p[S].push(x[S][2]),x[S].length>3&&p[S].push(x[S][3])}"paths"in o?o.paths=c:o.rings=c}else if("points"in s&&"points"in o){const a=s.points,c=[];for(let p=0;p2&&c[p].push(a[p][2]),a[p].length>3&&c[p].push(a[p][3]);o.points=c}return n}function e$(t,e){const i=t&&(IZ(t)?t:t.spatialReference),r=e&&(IZ(e)?e:e.spatialReference);return!(t&&"type"in t&&t.type==="mesh"||e&&"type"in e&&e.type==="mesh"||!i||!r)&&(!!jn(r,i)||FT(r)&&gL(i)||FT(i)&&gL(r))}function l5(t,e){if(t==null)return null;const i=t.spatialReference,r=e&&(IZ(e)?e:e.spatialReference);return e$(i,r)?jn(i,r)?Pe(t):FT(r)?Sz(t,AM,rt.WebMercator,!1,Pe(t)):gL(r)?Sz(t,t$,rt.WGS84,!1,Pe(t)):null:null}function AM(t,e,i=[0,0]){e>89.99999?e=89.99999:e<-89.99999&&(e=-89.99999);const r=Jhe(e);return i[0]=Jhe(t)*Or.radius,i[1]=Or.halfSemiMajorAxis*Math.log((1+Math.sin(r))/(1-Math.sin(r))),i}function t$(t,e,i=[0,0],r=!1){const n=Zhe(t/Or.radius);return i[0]=r?n:n-360*Math.floor((n+180)/360),i[1]=Zhe(Math.PI/2-2*Math.atan(Math.exp(-e/Or.radius))),i}function Py(t,e=!1,i=Pe(t)){return Sz(t,AM,rt.WebMercator,e,i)}function XS(t,e=!1,i=Pe(t)){return Sz(t,t$,rt.WGS84,e,i)}var E7;const H5=[0,0];function Qhe(t){return t&&(t.declaredClass==="esri.geometry.SpatialReference"||t.wkid!=null)}let Au=E7=class extends ax{static copy(t,e){e._set("x",t._get("x")),e._set("y",t._get("y")),e._set("z",t._get("z")),e._set("m",t._get("m"));const i=t._get("spatialReference");e._set("spatialReference",Object.isFrozen(i)?i:i.clone())}constructor(...t){super(...t),this.x=0,this.y=0,this.z=void 0,this.m=void 0,this.type="point"}normalizeCtorArgs(t,e,i,r,n){let s;if(Array.isArray(t))s=t,n=e,t=s[0],e=s[1],i=s[2],r=s[3];else if(t&&typeof t=="object"){if(s=t,t=s.x!=null?s.x:s.longitude,e=s.y!=null?s.y:s.latitude,i=s.z,r=s.m,(n=s.spatialReference)&&n.declaredClass!=="esri.geometry.SpatialReference"&&(n=new rt(n)),s.longitude!=null||s.latitude!=null){if(s.longitude==null)Ce.getLogger(this).warn(".longitude=","Latitude was defined without longitude");else if(s.latitude==null)Ce.getLogger(this).warn(".latitude=","Longitude was defined without latitude");else if(!s.declaredClass&&n&&n.isWebMercator){const a=AM(s.longitude,s.latitude,H5);t=a[0],e=a[1]}}}else Qhe(i)?(n=i,i=null):Qhe(r)&&(n=r,r=null);const o={x:t,y:e};return o.x==null&&o.y!=null?Ce.getLogger(this).warn(".y=","Y coordinate was defined without an X coordinate"):o.y==null&&o.x!=null&&Ce.getLogger(this).warn(".x=","X coordinate was defined without a Y coordinate"),n!=null&&(o.spatialReference=n),i!=null&&(o.z=i),r!=null&&(o.m=r),o}get cache(){return this.commitProperty("x"),this.commitProperty("y"),this.commitProperty("z"),this.commitProperty("m"),this.commitProperty("spatialReference"),{}}get hasM(){return this.m!==void 0}set hasM(t){t!==(this._get("m")!==void 0)&&(this._set("m",t?0:void 0),this._set("hasM",t))}get hasZ(){return this.z!==void 0}set hasZ(t){t!==(this._get("z")!==void 0)&&(this._set("z",t?0:void 0),this._set("hasZ",t))}get latitude(){const{spatialReference:t,x:e,y:i}=this;if(t){if(t.isWebMercator)return t$(e,i,H5)[1];if(t.isGeographic)return i}return null}set latitude(t){const{spatialReference:e,x:i}=this;t!=null&&e&&(e.isWebMercator?this._set("y",AM(i,t,H5)[1]):e.isGeographic&&this._set("y",t),this._set("latitude",t))}get longitude(){const{x:t,y:e,spatialReference:i}=this;if(i){if(i.isWebMercator)return t$(t,e,H5)[0];if(i.isGeographic)return t}return null}set longitude(t){const{y:e,spatialReference:i}=this;t!=null&&i&&(i.isWebMercator?this._set("x",AM(t,e,H5)[0]):i.isGeographic&&this._set("x",t),this._set("longitude",t))}writeX(t,e,i){e[i]=isNaN(t)?"NaN":t}readX(t){return typeof t=="string"?NaN:t}clone(){const t=new E7;return t.x=this.x,t.y=this.y,t.z=this.z,t.m=this.m,t.spatialReference=this.spatialReference,t}copy(t){return E7.copy(t,this),this}equals(t){if(t==null)return!1;const{x:e,y:i,z:r,m:n,spatialReference:s}=this,{z:o,m:a}=t;let{x:c,y:p,spatialReference:_}=t;if(!s.equals(_))if(s.isWebMercator&&_.isWGS84)[c,p]=AM(c,p),_=s;else{if(!s.isWGS84||!_.isWebMercator)return!1;[c,p]=t$(c,p),_=s}return e===c&&i===p&&r===o&&n===a&&s.wkid===_.wkid}offset(t,e,i){return this.x+=t,this.y+=e,i!=null&&(this.z=(this.z??0)+i),this}normalize(){if(!this.spatialReference)return this;const t=gp(this.spatialReference);if(!t)return this;let e=this.x;const[i,r]=t.valid,n=2*r;let s;return e>r?(s=Math.ceil(Math.abs(e-r)/n),e-=s*n):eisNaN(t)?t:Gh(t))],Au.prototype,"x",void 0),y([Et("x")],Au.prototype,"writeX",null),y([Rt("x")],Au.prototype,"readX",null),y([w({type:Number,json:{write:!0}})],Au.prototype,"y",void 0),y([w({type:Number,json:{write:{overridePolicy(){return{enabled:this.hasZ}}}}})],Au.prototype,"z",void 0),y([w({type:Number,json:{write:{overridePolicy(){return{enabled:this.hasM}}}}})],Au.prototype,"m",void 0),Au=E7=y([Z("esri.geometry.Point")],Au),Au.prototype.toJSON.isDefaultToJSON=!0;const mt=Au,gH=[0,0];function Xne(t,e){return e!=null&&tu(t,e.x,e.y,e.z)}function GZt(t,e){if(!e.points||e.points.length)return!1;for(const i of e.points)if(!ZO(t,i))return!1;return!0}function iYe(t,e){const{xmin:i,ymin:r,zmin:n,xmax:s,ymax:o,zmax:a}=e;return t.hasZ&&e.hasZ?tu(t,i,r,n)&&tu(t,i,o,n)&&tu(t,s,o,n)&&tu(t,s,r,n)&&tu(t,i,r,a)&&tu(t,i,o,a)&&tu(t,s,o,a)&&tu(t,s,r,a):tu(t,i,r)&&tu(t,i,o)&&tu(t,s,o)&&tu(t,s,r)}function ZO(t,e){return tu(t,e[0],e[1])}function rYe(t,e){return tu(t,e[0],e[1],e[2])}function tu(t,e,i,r){return e>=t.xmin&&e<=t.xmax&&i>=t.ymin&&i<=t.ymax&&(r==null||!t.hasZ||r>=t.zmin&&r<=t.zmax)}function nYe(t,e){return gH[1]=e.y,gH[0]=e.x,sYe(t,gH)}function sYe(t,e){return hEe(t.rings,e)}function hEe(t,e){if(!t)return!1;if(oYe(t))return ede(!1,t,e);let i=!1;for(let r=0,n=t.length;r=n||S=n)&&p+(n-_)/(S-_)*(x-p)=0&&U<=1&&j>=0&&j<=1&&(n&&(n[0]=s+U*(a-s),n[1]=o+U*(c-o)),!0)}function mYe(t){switch(t){case"esriGeometryEnvelope":case"extent":return lYe;case"esriGeometryMultipoint":case"multipoint":return cYe;case"esriGeometryPoint":case"point":return aYe;case"esriGeometryPolygon":case"polygon":return hYe;case"esriGeometryPolyline":case"polyline":return pYe}}var qp;function gYe(t){return t&&(t.declaredClass==="esri.geometry.SpatialReference"||t.wkid!=null)}function ob(t,e,i){return e==null?i:i==null?e:t(e,i)}let dl=qp=class extends ax{constructor(...t){super(...t),this.type="extent",this.xmin=0,this.ymin=0,this.mmin=void 0,this.zmin=void 0,this.xmax=0,this.ymax=0,this.mmax=void 0,this.zmax=void 0}normalizeCtorArgs(t,e,i,r,n){return gYe(t)?{spatialReference:t,xmin:0,ymin:0,xmax:0,ymax:0}:typeof t=="object"?(t.spatialReference=t.spatialReference==null?rt.WGS84:t.spatialReference,t):{xmin:t,ymin:e,xmax:i,ymax:r,spatialReference:n??rt.WGS84}}static fromBounds(t,e){return new qp({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3],spatialReference:e})}static fromPoint(t){return new qp({xmin:t.x,ymin:t.y,zmin:t.z,xmax:t.x,ymax:t.y,zmax:t.z,spatialReference:t.spatialReference})}get cache(){return this.commitProperty("xmin"),this.commitProperty("ymin"),this.commitProperty("zmin"),this.commitProperty("mmin"),this.commitProperty("xmax"),this.commitProperty("ymax"),this.commitProperty("zmax"),this.commitProperty("mmax"),this.commitProperty("spatialReference"),{}}get center(){const t=new mt({x:.5*(this.xmin+this.xmax),y:.5*(this.ymin+this.ymax),spatialReference:this.spatialReference});return this.hasZ&&(t.z=.5*(this.zmin+this.zmax)),this.hasM&&(t.m=.5*(this.mmin+this.mmax)),t}get extent(){return this.clone()}get hasM(){return this.mmin!=null&&this.mmax!=null}get hasZ(){return this.zmin!=null&&this.zmax!=null}get height(){return Math.abs(this.ymax-this.ymin)}get width(){return Math.abs(this.xmax-this.xmin)}centerAt(t){const e=this.center;return t.z!=null&&this.hasZ?this.offset(t.x-e.x,t.y-e.y,t.z-e.z):this.offset(t.x-e.x,t.y-e.y)}clone(){const t=new qp;return t.xmin=this.xmin,t.ymin=this.ymin,t.xmax=this.xmax,t.ymax=this.ymax,t.spatialReference=this.spatialReference,this.zmin!=null&&(t.zmin=this.zmin,t.zmax=this.zmax),this.mmin!=null&&(t.mmin=this.mmin,t.mmax=this.mmax),t}contains(t){if(!t)return!1;const e=this.spatialReference,i=t.spatialReference;return e&&i&&!e.equals(i)&&e$(e,i)&&(t=e.isWebMercator?Py(t):XS(t,!0)),t.type==="point"?Xne(this,t):t.type==="extent"&&iYe(this,t)}equals(t){if(this===t)return!0;if(t==null)return!1;const e=this.spatialReference,i=t.spatialReference;return e&&i&&!e.equals(i)&&e$(e,i)&&(t=e.isWebMercator?Py(t):XS(t,!0)),this.xmin===t.xmin&&this.ymin===t.ymin&&this.zmin===t.zmin&&this.mmin===t.mmin&&this.xmax===t.xmax&&this.ymax===t.ymax&&this.zmax===t.zmax&&this.mmax===t.mmax}expand(t){const e=.5*(1-t),i=this.width*e,r=this.height*e;if(this.xmin+=i,this.ymin+=r,this.xmax-=i,this.ymax-=r,this.hasZ){const n=(this.zmax-this.zmin)*e;this.zmin+=n,this.zmax-=n}if(this.hasM){const n=(this.mmax-this.mmin)*e;this.mmin+=n,this.mmax-=n}return this}intersects(t){if(t==null)return!1;t.type==="mesh"&&(t=t.extent);const e=this.spatialReference,i=t.spatialReference;return e&&i&&!jn(e,i)&&e$(e,i)&&(t=e.isWebMercator?Py(t):XS(t,!0)),mYe(t.type)(this,t)}normalize(){const t=this._normalize(!1,!0);return Array.isArray(t)?t:[t]}offset(t,e,i){return this.xmin+=t,this.ymin+=e,this.xmax+=t,this.ymax+=e,i!=null&&(this.zmin+=i,this.zmax+=i),this}shiftCentralMeridian(){return this._normalize(!0)}union(t){return this===t||(this.xmin=Math.min(this.xmin,t.xmin),this.ymin=Math.min(this.ymin,t.ymin),this.xmax=Math.max(this.xmax,t.xmax),this.ymax=Math.max(this.ymax,t.ymax),(this.hasZ||t.hasZ)&&(this.zmin=ob(Math.min,this.zmin,t.zmin),this.zmax=ob(Math.max,this.zmax,t.zmax)),(this.hasM||t.hasM)&&(this.mmin=ob(Math.min,this.mmin,t.mmin),this.mmax=ob(Math.max,this.mmax,t.mmax))),this}intersection(t){return this===t?this:t!=null&&this.intersects(t)?(this.xmin=Math.max(this.xmin,t.xmin),this.ymin=Math.max(this.ymin,t.ymin),this.xmax=Math.min(this.xmax,t.xmax),this.ymax=Math.min(this.ymax,t.ymax),(this.hasZ||t.hasZ)&&(this.zmin=ob(Math.max,this.zmin,t.zmin),this.zmax=ob(Math.min,this.zmax,t.zmax)),(this.hasM||t.hasM)&&(this.mmin=ob(Math.max,this.mmin,t.mmin),this.mmax=ob(Math.min,this.mmax,t.mmax)),this):null}toJSON(t){return this.write({},t)}_shiftCM(t=gp(this.spatialReference)){if(!t||!this.spatialReference)return this;const e=this.spatialReference,i=this._getCM(t);if(i){const r=e.isWebMercator?XS(i):i;this.xmin-=i.x,this.xmax-=i.x,e.isWebMercator||(r.x=this._normalizeX(r.x,t).x),this.spatialReference=new rt(w9((e.isWGS84?t.altTemplate:null)??t.wkTemplate,{Central_Meridian:r.x}))}return this}_getCM(t){let e=null;const[i,r]=t.valid,n=this.xmin,s=this.xmax;return n>=i&&n<=r&&s>=i&&s<=r||(e=this.center),e}_normalize(t,e,i){const r=this.spatialReference;if(!r)return this;const n=i??gp(r);if(n==null)return this;const s=this._getParts(n).map(c=>c.extent);if(s.length<2)return s[0]||this;if(s.length>2)return t?this._shiftCM(n):this.set({xmin:n.valid[0],xmax:n.valid[1]});if(t)return this._shiftCM(n);if(e)return s;let o=!0,a=!0;return s.forEach(c=>{c.hasZ||(o=!1),c.hasM||(a=!1)}),{rings:s.map(c=>{const p=[[c.xmin,c.ymin],[c.xmin,c.ymax],[c.xmax,c.ymax],[c.xmax,c.ymin],[c.xmin,c.ymin]];if(o){const _=(c.zmax-c.zmin)/2;for(let x=0;x0;if(a>2*S){const z=new qp(cP||F?e.push({extent:new qp(C,n,S,s,o),frameIds:[M]},{extent:new qp(x,n,P,s,o),frameIds:[$]}):e.push({extent:new qp(C,n,P,s,o),frameIds:[M]});this.cache._parts=e}const i=this.hasZ,r=this.hasM;if(i||r){const n={};i&&(n.zmin=this.zmin,n.zmax=this.zmax),r&&(n.mmin=this.mmin,n.mmax=this.mmax);for(let s=0;sr?(s=Math.ceil(Math.abs(t-r)/n),t-=s*n,o=s):te==null?i:i==null?e:t(e,i)}function yYe(t){return t&&(t.declaredClass==="esri.geometry.SpatialReference"||t.wkid!=null)}let Gb=LZ=class extends ax{constructor(...t){super(...t),this.points=[],this.type="multipoint"}normalizeCtorArgs(t,e){var n;if(!t&&!e)return{};const i={};Array.isArray(t)?(i.points=t,i.spatialReference=e):yYe(t)?i.spatialReference=t:(t.points&&(i.points=t.points),t.spatialReference&&(i.spatialReference=t.spatialReference),t.hasZ&&(i.hasZ=t.hasZ),t.hasM&&(i.hasM=t.hasM));const r=(n=i.points)==null?void 0:n[0];return r&&(i.hasZ===void 0&&i.hasM===void 0?(i.hasZ=r.length>2,i.hasM=!1):i.hasZ===void 0?i.hasZ=r.length>3:i.hasM===void 0&&(i.hasM=r.length>3)),i}get cache(){return this.commitProperty("points"),this.commitProperty("hasZ"),this.commitProperty("hasM"),this.commitProperty("spatialReference"),{}}get extent(){const t=this.points;if(!t.length)return null;const e=new Vi,i=this.hasZ,r=this.hasM,n=i?3:2,s=t[0],o=tde(Math.min),a=tde(Math.max);let c,p,_,x,[S,C]=s,[M,P]=s;for(let $=0,F=t.length;$2){const j=z[2];c=o(c,j),_=a(_,j)}if(r&&z.length>n){const j=z[n];p=o(p,j),x=a(x,j)}}return e.xmin=S,e.ymin=C,e.xmax=M,e.ymax=P,e.spatialReference=this.spatialReference,i?(e.zmin=c,e.zmax=_):(e.zmin=void 0,e.zmax=void 0),r?(e.mmin=p,e.mmax=x):(e.mmin=void 0,e.mmax=void 0),e}writePoints(t,e){e.points=Pe(this.points)}addPoint(t){return JO(this,t),Array.isArray(t)?this.points.push(t):this.points.push(t.toArray()),this.notifyChange("points"),this}clone(){const t={points:Pe(this.points),spatialReference:this.spatialReference};return this.hasZ&&(t.hasZ=!0),this.hasM&&(t.hasM=!0),new LZ(t)}getPoint(t){if(!this._validateInputs(t))return null;const e=this.points[t],i={x:e[0],y:e[1],spatialReference:this.spatialReference};let r=2;return this.hasZ&&(i.z=e[2],r=3),this.hasM&&(i.m=e[r]),new mt(i)}removePoint(t){if(!this._validateInputs(t))return null;const e=new mt(this.points.splice(t,1)[0],this.spatialReference);return this.notifyChange("points"),e}setPoint(t,e){return this._validateInputs(t)?(JO(this,e),Array.isArray(e)||(e=e.toArray()),this.points[t]=e,this.notifyChange("points"),this):this}toJSON(t){return this.write({},t)}_validateInputs(t){return t!=null&&t>=0&&t{o.hasZ&&(n=!0),o.hasM&&(s=!0)}),r.map(o=>{const a=[[o.xmin,o.ymin],[o.xmin,o.ymax],[o.xmax,o.ymax],[o.xmax,o.ymin],[o.xmin,o.ymin]];if(n&&o.hasZ){const c=.5*(o.zmax-o.zmin);for(let p=0;p2&&e.length>2){const n=t[2]-e[2];return Math.sqrt(i*i+r*r+n*n)}return Math.sqrt(i*i+r*r)}function fEe(t,e,i){const r=t[0]+i*(e[0]-t[0]),n=t[1]+i*(e[1]-t[1]);return t.length>2&&e.length>2?[r,n,t[2]+i*(e[2]-t[2])]:[r,n]}function qZt(t,e,i,r){const[n,s]=e,[o,a]=i,[c,p]=r,_=c-o,x=p-a,S=_*_+x*x,C=(n-o)*_+(s-a)*x,M=Math.min(1,Math.max(0,C/S));return t[0]=o+_*M,t[1]=a+x*M,t}function mEe(t,e){return fEe(t,e,.5)}function gEe(t){const e=t.length;let i=0;for(let r=0;r=0}function _Ye(t){const e=t.length;return e>2&&jy(t[0],t[e-1])}function WZt(t){if("rings"in t&&(bYe(t),t.rings.length>0&&!i$(t.rings[0])))for(const e of t.rings)e.reverse()}function bYe(t){if("rings"in t)for(const e of t.rings)_Ye(e)||e.push(e[0].slice())}function YZt(t){return t.type!=="polygon"&&t.type!=="polyline"||wYe(t.type==="polygon"?t.rings:t.paths,t.spatialReference),t}function wYe(t,e){const i=gp(e);if(!i)return;const r=i.valid[0],n=i.valid[1],s=n-r;for(const o of t){let a=1/0,c=-1/0;for(const _ of o){const x=vEe(_[0],r,n);a=Math.min(a,x),c=Math.max(c,x),_[0]=x}const p=c-a;s-p{_[0]<0&&(_[0]+=s)})}}function vEe(t,e,i){const r=i-e;return ti?e+(t-e)%r:t}function XZt(t,e){if(t===e)return!0;if(t.type!==e.type)return!1;if(t.type==="point"||t.type==="mesh"||t.type==="extent")return!0;if(t.type==="multipoint")return t.points.length===e.points.length;const[i,r]=t.type==="polyline"?[t.paths,e.paths]:[t.rings,e.rings];return i.length===r.length&&i.every((n,s)=>n.length===r[s].length)}function ZZt(t){return t?t.hasZ?[t.xmax-t.xmin/2,t.ymax-t.ymin/2,t.zmax-t.zmin/2]:[t.xmax-t.xmin/2,t.ymax-t.ymin/2]:null}function xYe(t){return t?_Ee(t.rings,t.hasZ??!1):null}function _Ee(t,e){if(!(t!=null&&t.length))return null;const i=[],r=[],n=e?[1/0,-1/0,1/0,-1/0,1/0,-1/0]:[1/0,-1/0,1/0,-1/0];for(let s=0,o=t.length;s{let a=s[2]-o[2];return a===0&&e&&(a=s[4]-o[4]),a}),r.length&&(i[0]=r[0][0],i[1]=r[0][1],e&&(i[2]=r[0][3]),(i[0]n[1]||i[1]n[3]||e&&(i[2]n[5]))&&(i.length=0)),!i.length){const s=t[0]&&t[0].length?SYe(t[0],e):null;if(!s)return null;i[0]=s[0],i[1]=s[1],e&&s.length>2&&(i[2]=s[2])}return i}function bEe(t,e,i){let r=0,n=0,s=0,o=0,a=0;const c=t.length?t[0][0]:0,p=t.length?t[0][1]:0,_=t.length&&e?t[0][2]:0;for(let S=0;S2&&M.length>2){const ie=F-_,he=G-_,ce=z*he-Y*ie;s+=(ie+he)*ce,a+=ce}Pi[1]&&(i[1]=P),$i[3]&&(i[3]=$),e&&(Fi[5]&&(i[5]=F))}if(o>0&&(o*=-1),a>0&&(a*=-1),!o)return null;o*=.5,a*=.5;const x=[r/(6*o)+c,n/(6*o)+p,o];return e&&(i[4]===i[5]||a===0?(x[3]=(i[4]+i[5])/2,x[4]=0):(x[3]=s/(6*a)+_,x[4]=a)),x}function JZt(t,e){let i=0,r=0,n=0;t.nextPoint();const s=t.pathSize?t.x:0,o=t.pathSize?t.y:0;for(let a=0;ae[1]&&(e[1]=_),xe[3]&&(e[3]=x)}return n>0&&(n*=-1),n?(n*=.5,[i/(6*n)+s,r/(6*n)+o,n]):null}function SYe(t,e){const i=e?[0,0,0]:[0,0],r=e?[0,0,0]:[0,0];let n=0,s=0,o=0,a=0;for(let c=0,p=t.length;c2&&x.length>2&&(i[2]=_[2],r[2]=x[2]);const S=dB(i,r);if(S){n+=S;const C=mEe(_,x);s+=S*C[0],o+=S*C[1],e&&C.length>2&&(a+=S*C[2])}}}return n>0?e?[s/n,o/n,a/n]:[s/n,o/n]:t.length?t[0]:null}function TYe(t){const{hasZ:e,totalSize:i}=t;if(i===0)return null;const r=[],n=[],s=e?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY];for(t.reset();t.nextPath();){const o=bEe(vYe(t),t.hasZ,s);o&&n.push(o)}if(n.sort((o,a)=>{let c=o[2]-a[2];return c===0&&e&&(c=o[4]-a[4]),c}),n.length&&(r[0]=n[0][0],r[1]=n[0][1],e&&(r[2]=n[0][3]),(r[0]s[1]||r[1]s[3]||e&&(r[2]s[5]))&&(r.length=0)),!r.length){t.reset(),t.nextPath();const o=t.pathSize?EYe(t):null;if(!o)return null;r[0]=o[0],r[1]=o[1],e&&o.length>2&&(r[2]=o[2])}return r}function EYe(t){const{hasZ:e}=t,i=e?[0,0,0]:[0,0],r=e?[0,0,0]:[0,0];let n=0,s=0,o=0,a=0;if(t.nextPoint()){let c=t.x,p=t.y,_=t.z;for(;t.nextPoint();){const x=t.x,S=t.y,C=t.z;i[0]=c,i[1]=p,r[0]=x,r[1]=S,e&&(i[2]=_,r[2]=C);const M=dB(i,r);if(M){n+=M;const P=mEe(i,r);s+=M*P[0],o+=M*P[1],e&&P.length>2&&(a+=M*P[2])}c=x,p=S,_=C}}return n>0?e?[s/n,o/n,a/n]:[s/n,o/n]:t.pathSize?(t.seekPathStart(),t.nextPoint(),[t.x,t.y]):null}const CYe=1e-6;function KZt(t){let e=0;for(t.reset();t.nextPath();)e+=t.getCurrentRingArea();if(e0&&(s=1/Math.sqrt(s),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s),t}function Ve(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Wt(t,e,i){const r=e[0],n=e[1],s=e[2],o=i[0],a=i[1],c=i[2];return t[0]=n*c-s*a,t[1]=s*o-r*c,t[2]=r*a-n*o,t}function Qr(t,e,i,r){const n=e[0],s=e[1],o=e[2];return t[0]=n+r*(i[0]-n),t[1]=s+r*(i[1]-s),t[2]=o+r*(i[2]-o),t}function FYe(t,e,i,r,n,s){const o=s*s,a=o*(2*s-3)+1,c=o*(s-2)+s,p=o*(s-1),_=o*(3-2*s);return t[0]=e[0]*a+i[0]*c+r[0]*p+n[0]*_,t[1]=e[1]*a+i[1]*c+r[1]*p+n[1]*_,t[2]=e[2]*a+i[2]*c+r[2]*p+n[2]*_,t}function kYe(t,e,i,r,n,s){const o=1-s,a=o*o,c=s*s,p=a*o,_=3*s*a,x=3*c*o,S=c*s;return t[0]=e[0]*p+i[0]*_+r[0]*x+n[0]*S,t[1]=e[1]*p+i[1]*_+r[1]*x+n[1]*S,t[2]=e[2]*p+i[2]*_+r[2]*x+n[2]*S,t}function zYe(t,e){e=e||1;const i=P9,r=2*i()*Math.PI,n=2*i()-1,s=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*s,t[1]=Math.sin(r)*s,t[2]=n*e,t}function bt(t,e,i){const r=e[0],n=e[1],s=e[2];return t[0]=i[0]*r+i[4]*n+i[8]*s+i[12],t[1]=i[1]*r+i[5]*n+i[9]*s+i[13],t[2]=i[2]*r+i[6]*n+i[10]*s+i[14],t}function Xh(t,e,i){const r=e[0],n=e[1],s=e[2];return t[0]=r*i[0]+n*i[3]+s*i[6],t[1]=r*i[1]+n*i[4]+s*i[7],t[2]=r*i[2]+n*i[5]+s*i[8],t}function Lf(t,e,i){const r=i[0],n=i[1],s=i[2],o=i[3],a=e[0],c=e[1],p=e[2];let _=n*p-s*c,x=s*a-r*p,S=r*c-n*a,C=n*S-s*x,M=s*_-r*S,P=r*x-n*_;const $=2*o;return _*=$,x*=$,S*=$,C*=2,M*=2,P*=2,t[0]=a+_+C,t[1]=c+x+M,t[2]=p+S+P,t}function UYe(t,e,i,r){const n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[0],s[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),s[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t}function VYe(t,e,i,r){const n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),s[1]=n[1],s[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t}function BYe(t,e,i,r){const n=[],s=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],s[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),s[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),s[2]=n[2],t[0]=s[0]+i[0],t[1]=s[1]+i[1],t[2]=s[2]+i[2],t}function PEe(t,e){Ne(z6,t),Ne(U6,e),Ye(z6,z6),Ye(U6,U6);const i=Ve(z6,U6);return i>1?0:i<-1?Math.PI:Math.acos(i)}const z6=W(),U6=W();function jYe(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function jr(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function L2(t,e){if(t===e)return!0;const i=t[0],r=t[1],n=t[2],s=e[0],o=e[1],a=e[2],c=al();return Math.abs(i-s)<=c*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(r-o)<=c*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-a)<=c*Math.max(1,Math.abs(n),Math.abs(a))}function k_(t,e,i){const r=i[0]-e[0],n=i[1]-e[1],s=i[2]-e[2];let o=r*r+n*n+s*s;return o>0?(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=s*o,t):(t[0]=0,t[1]=0,t[2]=0,t)}const Sn=je,GYe=mB,HYe=Tz,R9=Tn,yB=Ao,Nh=nt,QO=Al,rde=Object.freeze(Object.defineProperty({__proto__:null,abs:KO,add:Be,angle:PEe,bezier:kYe,ceil:LYe,copy:Ne,cross:Wt,direction:k_,dist:R9,distance:Tn,div:HYe,divide:Tz,dot:Ve,equals:L2,exactEquals:jr,floor:MEe,hermite:FYe,inverse:NYe,len:Nh,length:nt,lerp:Qr,max:OEe,min:gB,mul:GYe,multiply:mB,negate:Cc,normalize:Ye,random:zYe,rotateX:UYe,rotateY:VYe,rotateZ:BYe,round:DYe,scale:De,scaleAndAdd:lo,set:Ie,sign:Ez,sqrDist:yB,sqrLen:QO,squaredDistance:Ao,squaredLength:Al,str:jYe,sub:Sn,subtract:je,transformMat3:Xh,transformMat4:bt,transformQuat:Lf},Symbol.toStringTag,{value:"Module"}));function ym(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function rs(t,e,i,r,n){return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}function Kne(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t}function REe(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}function IEe(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t}function $Ee(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t[3]=e[3]/i[3],t}function qYe(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t}function WYe(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t}function YYe(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t[3]=Math.min(e[3],i[3]),t}function XYe(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t[3]=Math.max(e[3],i[3]),t}function ZYe(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t}function jT(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t}function JYe(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t[2]=e[2]+i[2]*r,t[3]=e[3]+i[3]*r,t}function LEe(t,e){const i=e[0]-t[0],r=e[1]-t[1],n=e[2]-t[2],s=e[3]-t[3];return Math.sqrt(i*i+r*r+n*n+s*s)}function Cz(t,e){const i=e[0]-t[0],r=e[1]-t[1],n=e[2]-t[2],s=e[3]-t[3];return i*i+r*r+n*n+s*s}function Qne(t){const e=t[0],i=t[1],r=t[2],n=t[3];return Math.sqrt(e*e+i*i+r*r+n*n)}function ese(t){const e=t[0],i=t[1],r=t[2],n=t[3];return e*e+i*i+r*r+n*n}function KYe(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function QYe(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}function DEe(t,e){const i=e[0],r=e[1],n=e[2],s=e[3];let o=i*i+r*r+n*n+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=i*o,t[1]=r*o,t[2]=n*o,t[3]=s*o),t}function NEe(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function vB(t,e,i,r){const n=e[0],s=e[1],o=e[2],a=e[3];return t[0]=n+r*(i[0]-n),t[1]=s+r*(i[1]-s),t[2]=o+r*(i[2]-o),t[3]=a+r*(i[3]-a),t}function eXe(t,e){const i=P9;let r,n,s,o,a,c;e=e||1;do r=2*i()-1,n=2*i()-1,a=r*r+n*n;while(a>=1);do s=2*i()-1,o=2*i()-1,c=s*s+o*o;while(c>=1);const p=Math.sqrt((1-a)/c);return t[0]=e*r,t[1]=e*n,t[2]=e*s*p,t[3]=e*o*p,t}function dp(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*s+i[12]*o,t[1]=i[1]*r+i[5]*n+i[9]*s+i[13]*o,t[2]=i[2]*r+i[6]*n+i[10]*s+i[14]*o,t[3]=i[3]*r+i[7]*n+i[11]*s+i[15]*o,t}function tXe(t,e,i){const r=e[0],n=e[1],s=e[2],o=i[0],a=i[1],c=i[2],p=i[3],_=p*r+a*s-c*n,x=p*n+c*r-o*s,S=p*s+o*n-a*r,C=-o*r-a*n-c*s;return t[0]=_*p+C*-o+x*-c-S*-a,t[1]=x*p+C*-a+S*-o-_*-c,t[2]=S*p+C*-c+_*-a-x*-o,t[3]=e[3],t}function iXe(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function aO(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function GT(t,e){const i=t[0],r=t[1],n=t[2],s=t[3],o=e[0],a=e[1],c=e[2],p=e[3],_=al();return Math.abs(i-o)<=_*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(r-a)<=_*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-c)<=_*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(s-p)<=_*Math.max(1,Math.abs(s),Math.abs(p))}const rXe=REe,nXe=IEe,sXe=$Ee,oXe=LEe,aXe=Cz,lXe=Qne,cXe=ese,FEe=Object.freeze(Object.defineProperty({__proto__:null,add:Kne,ceil:qYe,copy:ym,dist:oXe,distance:LEe,div:sXe,divide:$Ee,dot:NEe,equals:GT,exactEquals:aO,floor:WYe,inverse:QYe,len:lXe,length:Qne,lerp:vB,max:XYe,min:YYe,mul:nXe,multiply:IEe,negate:KYe,normalize:DEe,random:eXe,round:ZYe,scale:jT,scaleAndAdd:JYe,set:rs,sqrDist:aXe,sqrLen:cXe,squaredDistance:Cz,squaredLength:ese,str:iXe,sub:rXe,subtract:REe,transformMat4:dp,transformQuat:tXe},Symbol.toStringTag,{value:"Module"})),nde=new Float32Array(1);function kEe(t){--t;for(let e=1;e<32;e<<=1)t|=t>>e;return t+1}function Je(t,e,i){return Math.min(Math.max(t,e),i)}function uXe(t,e){return e===0?0:Math.round(t/e)*e}function HT(t){return(t&t-1)==0}function QZt(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}function eJt(t){return 10**Math.ceil(Math.LOG10E*Math.log(t))}function ui(t,e,i){return t+(e-t)*i}function tJt(t,e,i,r,n){return ui(r,n,(t-e)/(i-e))}function Ei(t){return t*Math.PI/180}function mu(t){return 180*t/Math.PI}function DZ(t,e=1e-6){return(t<0?-1:1)/Math.max(Math.abs(t),e)}function Aa(t){return Math.acos(Je(t,-1,1))}function qf(t){return Math.asin(Je(t,-1,1))}function Ry(t,e,i=1e-6){return t===e?!0:!Number.isFinite(t)||!Number.isFinite(e)?!1:(t>e?t-e:e-t)<=i}const Az=new DataView(new ArrayBuffer(Float64Array.BYTES_PER_ELEMENT));function NZ(t){return Az.setFloat64(0,t),Az.getBigInt64(0)}function hXe(t){return Az.setBigInt64(0,t),Az.getFloat64(0)}const C7=BigInt("1000000"),dXe=zEe(1);function zEe(t){const e=NZ(t=Math.abs(t)),i=hXe(e<=C7?C7:e-C7);return Math.abs(t-i)}function iJt(t,e,i=dXe){if(t===e)return!0;if(!Number.isFinite(t)||!Number.isFinite(e))return!1;if(i!=null&&zEe(Math.min(Math.abs(t),Math.abs(e)))C7)}function pXe(t,e,i=1e-6){if(t===e)return!0;if(!Number.isFinite(t)||!Number.isFinite(e))return!1;const r=Math.abs(t-e),n=Math.abs(t),s=Math.abs(e);if(t===0||e===0||n<1e-12&&s<1e-12){if(r>.01*i)return!1}else if(r/(n+s)>i)return!1;return!0}function fXe(t){return UEe(Math.max(-FZ,Math.min(t,FZ)))}function UEe(t){return nde[0]=t,nde[0]}function bL(t,e,i){const r=Je((i-t)/(e-t),0,1);return r*r*(3-2*r)}function sde(t,e){const i=nt(t),r=qf(t[2]/i),n=Math.atan2(t[1]/i,t[0]/i);return Ie(e,i,r,n),e}function rJt(t){const e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[3]*t[3]+t[4]*t[4]+t[5]*t[5],r=t[6]*t[6]+t[7]*t[7]+t[8]*t[8];return!(Ry(e,1)&&Ry(i,1)&&Ry(r,1))}function mXe(t,e){return(t%e+e)%e}const FZ=UEe(34028234663852886e22);function Ni(t=_Xe){return[t[0],t[1],t[2],t[3]]}function nJt(t){return[t[0],t[1],t[2],t[3]]}function __(t,e){return t!==e&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3]),t}function tse(t,e,i,r,n=Ni()){return n[0]=t,n[1]=e,n[2]=i,n[3]=r,n}function ise(t,e=Ni()){return e[0]=t.xmin,e[1]=t.ymin,e[2]=t.xmax,e[3]=t.ymax,e}function _B(t,e){return new Vi({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3],spatialReference:e})}function lO(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function x2(t,e,i){if(e!=null)if("length"in e)UZ(e)?(i[0]=Math.min(t[0],e[0]),i[1]=Math.min(t[1],e[1]),i[2]=Math.max(t[2],e[2]),i[3]=Math.max(t[3],e[3])):e.length!==2&&e.length!==3||(i[0]=Math.min(t[0],e[0]),i[1]=Math.min(t[1],e[1]),i[2]=Math.max(t[2],e[0]),i[3]=Math.max(t[3],e[1]));else switch(e.type){case"extent":i[0]=Math.min(t[0],e.xmin),i[1]=Math.min(t[1],e.ymin),i[2]=Math.max(t[2],e.xmax),i[3]=Math.max(t[3],e.ymax);break;case"point":i[0]=Math.min(t[0],e.x),i[1]=Math.min(t[1],e.y),i[2]=Math.max(t[2],e.x),i[3]=Math.max(t[3],e.y)}else __(i,t)}function yH(t,e,i=t){const r=e.length;let n=t[0],s=t[1],o=t[2],a=t[3];for(let c=0;c=t[2]?0:t[2]-t[0]}function Yu(t){return t==null||t[1]>=t[3]?0:t[3]-t[1]}function sJt(t){return xc(t)*Yu(t)}function Mz(t){return xc(t)>0&&Yu(t)>0}function rse(t,e=[0,0]){return e[0]=(t[0]+t[2])/2,e[1]=(t[1]+t[3])/2,e}function VEe(t,e){return bB(t,e[0],e[1])}function ode(t,e){const i=e[3],r=.5*(t[0]+t[2]),n=Math.abs(e[0]-r),s=.5*(t[2]-t[0]);if(n>i+s)return!1;const o=.5*(t[1]+t[3]),a=.5*(t[3]-t[1]),c=Math.abs(e[1]-o);if(c>i+a)return!1;if(n(_-c)*$+(a-p)*F+(p*c-a*_)<0,S=x(r,o),C=x(s,o),M=x(s,n),P=x(r,n);return!(S===C&&C===M&&M===P&&P===S||as&&p>s||c>o&&_>o||c=t[0]&&i>=t[1]&&e<=t[2]&&i<=t[3]}function gXe(t,e,i){return e[0]>=t[0]-i&&e[1]>=t[1]-i&&e[0]<=t[2]+i&&e[1]<=t[3]+i}function I9(t,e){return Math.max(e[0],t[0])<=Math.min(e[2],t[2])&&Math.max(e[1],t[1])<=Math.min(e[3],t[3])}function Oz(t,e){return e[0]>=t[0]&&e[2]<=t[2]&&e[1]>=t[1]&&e[3]<=t[3]}function zZ(t,e,i){if(e==null)return __(i,t);const r=e[0],n=e[1],s=e[2],o=e[3];return i[0]=Je(t[0],r,s),i[1]=Je(t[1],n,o),i[2]=Je(t[2],r,s),i[3]=Je(t[3],n,o),i}function yXe(t,e){const i=(t[0]+t[2])/2,r=(t[1]+t[3])/2,n=Math.max(Math.abs(e[0]-i)-xc(t)/2,0),s=Math.max(Math.abs(e[1]-r)-Yu(t)/2,0);return Math.sqrt(n*n+s*s)}function Pz(t,e,i,r=t){return r[0]=t[0]+e,r[1]=t[1]+i,r[2]=t[2]+e,r[3]=t[3]+i,r}function ld(t){return t?__(t,VZ):Ni(VZ)}function UZ(t){return t!=null&&t.length===4}function vXe(t){return!(xc(t)!==0&&isFinite(t[0])||Yu(t)!==0&&isFinite(t[1]))}function mT(t,e){return UZ(t)&&UZ(e)?t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]:t===e}const lJt=[-1/0,-1/0,1/0,1/0],VZ=[1/0,1/0,-1/0,-1/0],_Xe=[0,0,0,0];function BEe(t){return t.xmin!==void 0&&t.ymin!==void 0&&t.xmax!==void 0&&t.ymax!==void 0}function jEe(t){return t.points!==void 0}function GEe(t){return t.x!==void 0&&t.y!==void 0}function HEe(t){return t.paths!==void 0}function qEe(t){return t.rings!==void 0}function WEe(t){function e(i,r){return i==null?r:r==null?i:t(i,r)}return e}const r2=WEe(Math.min),n2=WEe(Math.max);function cJt(t,e){return HEe(e)?eP(t,e.paths,!1,!1):qEe(e)?eP(t,e.rings,!1,!1):jEe(e)?nse(t,e.points,!1,!1,!1,!1):BEe(e)?YEe(t,e):(GEe(e)&&(t[0]=e.x,t[1]=e.y,t[2]=e.x,t[3]=e.y),t)}function uJt(t){let e,i,r,n;for(t.reset(),e=r=1/0,i=n=-1/0;t.nextPath();){const s=bXe(t);e=Math.min(s[0],e),r=Math.min(s[1],r),i=Math.max(s[2],i),n=Math.max(s[3],n)}return Ni([e,r,i,n])}function bXe(t){let e,i,r,n;for(e=r=1/0,i=n=-1/0;t.nextPoint();)e=Math.min(t.x,e),r=Math.min(t.y,r),i=Math.max(t.x,i),n=Math.max(t.y,n);return Ni([e,r,i,n])}function hJt(t,e){return HEe(e)?eP(t,e.paths,!0,!1):qEe(e)?eP(t,e.rings,!0,!1):jEe(e)?nse(t,e.points,!0,!1,!0,!1):BEe(e)?YEe(t,e,!0,!1,!0,!1):(GEe(e)&&(t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.x,t[4]=e.y,t[5]=e.z),t)}function eP(t,e,i,r){const n=i?3:2;if(!e.length||!e[0].length)return null;let s,o,a,c,[p,_]=e[0][0],[x,S]=e[0][0];for(let C=0;C2){const k=$[2];s=r2(s,k),o=n2(o,k)}if(r&&$.length>n){const k=$[n];a=r2(s,k),c=n2(o,k)}}}return i?r?(t[0]=p,t[1]=_,t[2]=s,t[3]=a,t[4]=x,t[5]=S,t[6]=o,t[7]=c,t.length=8,t):(t[0]=p,t[1]=_,t[2]=s,t[3]=x,t[4]=S,t[5]=o,t.length=6,t):r?(t[0]=p,t[1]=_,t[2]=a,t[3]=x,t[4]=S,t[5]=c,t.length=6,t):(t[0]=p,t[1]=_,t[2]=x,t[3]=S,t.length=4,t)}function YEe(t,e,i,r,n,s){const o=e.xmin,a=e.xmax,c=e.ymin,p=e.ymax;let _=e.zmin,x=e.zmax,S=e.mmin,C=e.mmax;return n?(_=_||0,x=x||0,s?(S=S||0,C=C||0,t[0]=o,t[1]=c,t[2]=_,t[3]=S,t[4]=a,t[5]=p,t[6]=x,t[7]=C,t):(t[0]=o,t[1]=c,t[2]=_,t[3]=a,t[4]=p,t[5]=x,t)):s?(S=S||0,C=C||0,t[0]=o,t[1]=c,t[2]=S,t[3]=a,t[4]=p,t[5]=C,t):(t[0]=o,t[1]=c,t[2]=a,t[3]=p,t)}function nse(t,e,i,r,n,s){const o=i?3:2,a=r&&s,c=i&&n;if(!e.length||!e[0].length)return null;let p,_,x,S,[C,M]=e[0],[P,$]=e[0];for(let F=0;F2){const j=z[2];p=r2(p,j),_=n2(_,j)}if(a&&z.length>o){const j=z[o];x=r2(p,j),S=n2(_,j)}}return n?(p=p||0,_=_||0,s?(x=x||0,S=S||0,t[0]=C,t[1]=M,t[2]=p,t[3]=x,t[4]=P,t[5]=$,t[6]=_,t[7]=S,t):(t[0]=C,t[1]=M,t[2]=p,t[3]=P,t[4]=$,t[5]=_,t)):s?(x=x||0,S=S||0,t[0]=C,t[1]=M,t[2]=x,t[3]=P,t[4]=$,t[5]=S,t):(t[0]=C,t[1]=M,t[2]=P,t[3]=$,t)}function wXe(t){return t.xmin!==void 0&&t.ymin!==void 0&&t.xmax!==void 0&&t.ymax!==void 0}function xXe(t){return t.points!==void 0}function SXe(t){return t.x!==void 0&&t.y!==void 0}function TXe(t){return t.paths!==void 0}function EXe(t){return t.rings!==void 0}const sse=[];function XEe(t,e,i,r){return{xmin:t,ymin:e,xmax:i,ymax:r}}function ZEe(t,e,i,r,n,s){return{xmin:t,ymin:e,zmin:i,xmax:r,ymax:n,zmax:s}}function JEe(t,e,i,r,n,s){return{xmin:t,ymin:e,mmin:i,xmax:r,ymax:n,mmax:s}}function KEe(t,e,i,r,n,s,o,a){return{xmin:t,ymin:e,zmin:i,mmin:r,xmax:n,ymax:s,zmax:o,mmax:a}}function ose(t,e=!1,i=!1){return e?i?KEe(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]):ZEe(t[0],t[1],t[2],t[3],t[4],t[5]):i?JEe(t[0],t[1],t[2],t[3],t[4],t[5]):XEe(t[0],t[1],t[2],t[3])}function dJt(t){return t?wXe(t)?t:SXe(t)?AXe(t):EXe(t)?QEe(t):TXe(t)?eCe(t):xXe(t)?CXe(t):null:null}function CXe(t){const{hasZ:e,hasM:i,points:r}=t;return ose(nse(sse,r,e??!1,i??!1),e,i)}function AXe(t){const{x:e,y:i,z:r,m:n}=t,s=n!=null;return r!=null?s?KEe(e,i,r,n,e,i,r,n):ZEe(e,i,r,e,i,r):s?JEe(e,i,n,e,i,n):XEe(e,i,e,i)}function QEe(t){const{hasZ:e,hasM:i,rings:r}=t,n=eP(sse,r,e??!1,i??!1);return n?ose(n,e,i):null}function eCe(t){const{hasZ:e,hasM:i,paths:r}=t,n=eP(sse,r,e??!1,i??!1);return n?ose(n,e,i):null}var A7;function ade(t){return!Array.isArray(t[0])}let Tg=A7=class extends ax{static fromExtent(t){const e=t.clone().normalize(),i=t.spatialReference;let r=!1,n=!1;for(const o of e)o.hasZ&&(r=!0),o.hasM&&(n=!0);const s={rings:e.map(o=>{const a=[[o.xmin,o.ymin],[o.xmin,o.ymax],[o.xmax,o.ymax],[o.xmax,o.ymin],[o.xmin,o.ymin]];if(r&&o.hasZ){const c=o.zmin+.5*(o.zmax-o.zmin);for(let p=0;p2,r=s.length>3):i===void 0?i=r?s.length>3:s.length>2:r===void 0&&(r=i?s.length>3:s.length>2)),{rings:n,spatialReference:e,hasZ:i,hasM:r}}get cache(){return this.commitProperty("rings"),this.commitProperty("hasZ"),this.commitProperty("hasM"),this.commitProperty("spatialReference"),{}}get centroid(){const t=xYe(this);if(!t||isNaN(t[0])||isNaN(t[1])||this.hasZ&&isNaN(t[2]))return null;const e=new mt;return e.x=t[0],e.y=t[1],e.spatialReference=this.spatialReference,this.hasZ&&(e.z=t[2]),e}get extent(){const{spatialReference:t}=this,e=QEe(this);if(!e)return null;const i=new Vi(e);return i.spatialReference=t,i}get isSelfIntersecting(){return fYe(this.rings)}writeRings(t,e){e.rings=Pe(this.rings)}addRing(t){if(!t)return;const e=this.rings,i=e.length;if(ade(t)){const r=[];for(let n=0,s=t.length;nn===c&&s===p&&(o==null&&_==null||o===_)&&(a==null&&x==null||a===x);for(let n=0;nthis.hasZ?this.hasM?[i.x,i.y,i.z,i.m]:[i.x,i.y,i.z]:[i.x,i.y]):t,i$(e)}getPoint(t,e){if(!this._validateInputs(t,e))return null;const i=this.rings[t][e],r=this.hasZ,n=this.hasM;return r&&!n?new mt(i[0],i[1],i[2],void 0,this.spatialReference):n&&!r?new mt(i[0],i[1],void 0,i[2],this.spatialReference):r&&n?new mt(i[0],i[1],i[2],i[3],this.spatialReference):new mt(i[0],i[1],this.spatialReference)}insertPoint(t,e,i){return this._validateInputs(t,e,!0)?(JO(this,i),Array.isArray(i)||(i=i.toArray()),this.rings[t].splice(e,0,i),this.notifyChange("rings"),this):this}removePoint(t,e){if(!this._validateInputs(t,e))return null;const i=new mt(this.rings[t].splice(e,1)[0],this.spatialReference);return this.notifyChange("rings"),i}removeRing(t){if(!this._validateInputs(t,null))return null;const e=this.rings.splice(t,1)[0],i=this.spatialReference,r=e.map(n=>new mt(n,i));return this.notifyChange("rings"),r}setPoint(t,e,i){return this._validateInputs(t,e)?(JO(this,i),Array.isArray(i)||(i=i.toArray()),this.rings[t][e]=i,this.notifyChange("rings"),this):this}_validateInputs(t,e,i=!1){if(t==null||t<0||t>=this.rings.length)return!1;if(e!=null){const r=this.rings[t];if(i&&(e<0||e>r.length)||!i&&(e<0||e>=r.length))return!1}return!0}toJSON(t){return this.write({},t)}};y([w({readOnly:!0})],Tg.prototype,"cache",null),y([w({readOnly:!0})],Tg.prototype,"centroid",null),y([w({readOnly:!0})],Tg.prototype,"extent",null),y([w({readOnly:!0})],Tg.prototype,"isSelfIntersecting",null),y([w({type:[[[Number]]],json:{write:{isRequired:!0}}})],Tg.prototype,"rings",void 0),y([Et("rings")],Tg.prototype,"writeRings",null),Tg=A7=y([Z("esri.geometry.Polygon")],Tg),Tg.prototype.toJSON.isDefaultToJSON=!0;const tl=Tg;var BZ;function MXe(t){return!Array.isArray(t[0])}let Hb=BZ=class extends ax{constructor(...t){super(...t),this.paths=[],this.type="polyline"}normalizeCtorArgs(t,e){var o,a;let i,r,n=null,s=null;return t&&!Array.isArray(t)?(n=t.paths??null,e||(t.spatialReference?e=t.spatialReference:t.paths||(e=t)),i=t.hasZ,r=t.hasM):n=t,n=n||[],e=e||rt.WGS84,n.length&&((o=n[0])==null?void 0:o[0])!=null&&typeof n[0][0]=="number"&&(n=[n]),s=(a=n[0])==null?void 0:a[0],s&&(i===void 0&&r===void 0?(i=s.length>2,r=!1):i===void 0?i=!r&&s.length>3:r===void 0&&(r=!i&&s.length>3)),{paths:n,spatialReference:e,hasZ:i,hasM:r}}get cache(){return this.commitProperty("paths"),this.commitProperty("hasZ"),this.commitProperty("hasM"),this.commitProperty("spatialReference"),{}}get extent(){const{spatialReference:t}=this,e=eCe(this);if(!e)return null;const i=new Vi(e);return i.spatialReference=t,i}writePaths(t,e){e.paths=Pe(this.paths)}addPath(t){if(!t)return;const e=this.paths,i=e.length;if(MXe(t)){const r=[];for(let n=0,s=t.length;nnew mt(n,i));return this.notifyChange("paths"),r}removePoint(t,e){if(!this._validateInputs(t,e))return null;const i=new mt(this.paths[t].splice(e,1)[0],this.spatialReference);return this.notifyChange("paths"),i}setPoint(t,e,i){return this._validateInputs(t,e)?(JO(this,i),Array.isArray(i)||(i=i.toArray()),this.paths[t][e]=i,this.notifyChange("paths"),this):this}_validateInputs(t,e,i=!1){if(t==null||t<0||t>=this.paths.length)return!1;if(e!=null){const r=this.paths[t];if(i&&(e<0||e>r.length)||!i&&(e<0||e>=r.length))return!1}return!0}toJSON(t){return this.write({},t)}};y([w({readOnly:!0})],Hb.prototype,"cache",null),y([w({readOnly:!0})],Hb.prototype,"extent",null),y([w({type:[[[Number]]],json:{write:{isRequired:!0}}})],Hb.prototype,"paths",void 0),y([Et("paths")],Hb.prototype,"writePaths",null),Hb=BZ=y([Z("esri.geometry.Polyline")],Hb),Hb.prototype.toJSON.isDefaultToJSON=!0;const Tc=Hb,tCe=gu()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon"}),pJt=gu()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh"});function iCe(t){return t.xmin!==void 0&&t.ymin!==void 0&&t.xmax!==void 0&&t.ymax!==void 0}function ase(t){return t.points!==void 0}function lse(t){return t.x!==void 0&&t.y!==void 0}function cse(t){return t.paths!==void 0}function gT(t){return t.rings!==void 0}function Wy(t){return t==null?null:t instanceof ax?t:lse(t)?mt.fromJSON(t):cse(t)?Tc.fromJSON(t):gT(t)?tl.fromJSON(t):ase(t)?Mm.fromJSON(t):iCe(t)?Vi.fromJSON(t):null}function c5(t){return t?lse(t)?"esriGeometryPoint":cse(t)?"esriGeometryPolyline":gT(t)?"esriGeometryPolygon":iCe(t)?"esriGeometryEnvelope":ase(t)?"esriGeometryMultipoint":null:null}const OXe={esriGeometryPoint:mt,esriGeometryPolyline:Tc,esriGeometryPolygon:tl,esriGeometryEnvelope:Vi,esriGeometryMultipoint:Mm};function PXe(t){return t&&OXe[t]||null}const dE={base:ax,key:"type",typeMap:{extent:Vi,multipoint:Mm,point:mt,polyline:Tc,polygon:tl}};Hy(dE);let rCe=0;const z_=t=>{let e=class extends t{constructor(...i){super(...i),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:Date.now().toString(16)+"-object-"+rCe++})}};return e=y([Z("esri.core.Identifiable")],e),e},fJt=t=>{let e=class extends t{constructor(...i){super(...i),Object.defineProperty(this,"uid",{writable:!1,configurable:!1,value:rCe++})}};return e=y([Z("esri.core.NumericIdentifiable")],e),e};let lde=class extends z_(class{}){};lde=y([Z("esri.core.Identifiable")],lde);var Lw;(function(t){t[t.PENDING=0]="PENDING",t[t.RESOLVED=1]="RESOLVED",t[t.REJECTED=2]="REJECTED"})(Lw||(Lw={}));let RXe=class{constructor(){this._resolver=ec(),this._status=Lw.PENDING,this._resolvingPromises=[],this._resolver.promise.then(()=>{this._status=Lw.RESOLVED,this._cleanUp()},()=>{this._status=Lw.REJECTED,this._cleanUp()}),this.promise=this._resolver.promise}destroy(){this._cleanUp()}addResolvingPromise(e){this._resolvingPromises.push(e),this._tryResolve()}isResolved(){return this._status===Lw.RESOLVED}isRejected(){return this._status===Lw.REJECTED}isFulfilled(){return this._status!==Lw.PENDING}abort(){this._resolver.reject(ur())}_cleanUp(){this._allPromise=null,this._resolvingPromises=null}_tryResolve(){if(this.isFulfilled())return;const e=ec(),i=[...this._resolvingPromises,e.promise],r=this._allPromise=Promise.all(i);r.then(()=>{this.isFulfilled()||this._allPromise!==r||this._resolver.resolve()},n=>{this.isFulfilled()||this._allPromise!==r||on(n)||this._resolver.reject(n)}),e.resolve()}};const $9=t=>{let e=class extends t{constructor(...i){super(...i),this._promiseProps=new RXe,this.addResolvingPromise(Promise.resolve())}destroy(){this._promiseProps.destroy()}isResolved(){return this._promiseProps.isResolved()}isRejected(){return this._promiseProps.isRejected()}isFulfilled(){return this._promiseProps.isFulfilled()}when(i,r){return this._promiseProps.promise.then(()=>this).then(i,r)}catch(i){return this.when(null,i)}addResolvingPromise(i){i&&!this._promiseProps.isFulfilled()&&this._promiseProps.addResolvingPromise("_promiseProps"in i?i.when():i)}};return e=y([Z("esri.core.Promise")],e),e};let Rz=class extends $9(ze){};Rz=y([Z("esri.core.Promise")],Rz);const IXe="not-loaded",$Xe="loading",LXe="failed",cde="loaded",nCe=t=>{let e=class extends t{constructor(...i){super(...i),this._loadController=null,this.loadError=null,this.loadStatus="not-loaded",this._set("loadWarnings",[]),this.addResolvingPromise(new Promise(r=>{const n=this.load.bind(this);this.load=s=>{const o=new Promise((a,c)=>{const p=C9(s,c);this.destroyed&&c(new se("load:instance-destroyed",`Instance of '${this.declaredClass||this.constructor.name}' is already destroyed`,{instance:this})),this.when(a,c).finally(()=>{p&&p.remove()})});if(this.loadStatus===IXe){this._set("loadStatus",$Xe);const a=this._loadController=new AbortController;n({signal:a.signal})}return r(),o}})),this.when(()=>{this._set("loadStatus",cde),this._loadController=null},r=>{this._set("loadStatus",LXe),this._set("loadError",r),this._loadController=null})}destroy(){this._loadController&&(this._loadController=vn(this._loadController),this._promiseProps.abort()),this._set("loadError",null),this._set("loadWarnings",[])}get loaded(){return this.loadStatus===cde}get loadWarnings(){return this._get("loadWarnings")}load(){return null}cancelLoad(){var i;return this.isFulfilled()||(this._set("loadError",new se("load:cancelled","Cancelled")),(i=this._loadController)==null||i.abort(),this._promiseProps.abort()),this}};return y([w({readOnly:!0})],e.prototype,"loaded",null),y([w({readOnly:!0})],e.prototype,"loadError",void 0),y([w({clonable:!1})],e.prototype,"loadStatus",void 0),y([w({type:[Hf],readOnly:!0})],e.prototype,"loadWarnings",null),e=y([Z("esri.core.Loadable")],e),e};let lI=class extends nCe(Rz){};lI=y([Z("esri.core.Loadable")],lI),function(t){function e(i){return!(!i||!i.load)}t.LoadableMixin=nCe,t.isLoadable=e}(lI||(lI={}));const Wf=lI;async function DXe(t){const e="portalItem"in t?t:{portalItem:t},{fromItem:i}=await we(()=>import("./portalLayers-Au1cdQPl.js").then(r=>r.p),__vite__mapDeps([0,1]));try{return await i(e)}catch(r){const n=e&&e.portalItem,s=(n==null?void 0:n.id)||"unset",o=n&&n.portal&&n.portal.url||Mr.portalUrl;throw Ce.getLogger("esri.layers.support.fromPortalItem").error("#fromPortalItem()","Failed to create layer from portal item (portal: '"+o+"', id: '"+s+"')",r),r}}let NXe=0,La=class extends Dn.EventedMixin(z_(Wf)){constructor(){super(...arguments),this.attributionDataUrl=null,this.fullExtent=new Vi(-180,-90,180,90,rt.WGS84),this.id=Date.now().toString(16)+"-layer-"+NXe++,this.legendEnabled=!0,this.listMode="show",this.opacity=1,this.parent=null,this.persistenceEnabled=!1,this.popupEnabled=!0,this.attributionVisible=!0,this.spatialReference=rt.WGS84,this.title=null,this.type=null,this.url=null,this.visible=!0}static async fromArcGISServerUrl(e){const i=typeof e=="string"?{url:e}:e;return(await we(()=>import("./arcgisLayers-SSMNCJNX.js"),__vite__mapDeps([2,3,1]))).fromUrl(i)}static fromPortalItem(e){return DXe(e)}initialize(){this.when().catch(e=>{on(e)||Ce.getLogger(this).error("#load()",`Failed to load layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}')`,{error:e})})}destroy(){const e=this.parent;if(e){const i=this;"layers"in e&&e.layers.includes(i)?e.layers.remove(i):"tables"in e&&e.tables.includes(i)?e.tables.remove(i):"baseLayers"in e&&e.baseLayers.includes(i)?e.baseLayers.remove(i):"referenceLayers"in e&&e.referenceLayers.includes(i)&&e.referenceLayers.remove(i),this._set("parent",null)}}get hasAttributionData(){return this.attributionDataUrl!=null}get parsedUrl(){return Is(this.url)}async fetchAttributionData(){const e=this.attributionDataUrl;if(this.hasAttributionData&&e)return(await yi(e,{query:{f:"json"},responseType:"json"})).data;throw new se("layer:no-attribution-data","Layer does not have attribution data")}};y([w({type:String})],La.prototype,"attributionDataUrl",void 0),y([w({type:Vi})],La.prototype,"fullExtent",void 0),y([w({readOnly:!0})],La.prototype,"hasAttributionData",null),y([w({type:String,clonable:!1})],La.prototype,"id",void 0),y([w({type:Boolean,nonNullable:!0})],La.prototype,"legendEnabled",void 0),y([w({type:["show","hide","hide-children"]})],La.prototype,"listMode",void 0),y([w({type:Number,range:{min:0,max:1},nonNullable:!0})],La.prototype,"opacity",void 0),y([w({clonable:!1})],La.prototype,"parent",void 0),y([w({readOnly:!0})],La.prototype,"parsedUrl",null),y([w({type:Boolean,readOnly:!0})],La.prototype,"persistenceEnabled",void 0),y([w({type:Boolean})],La.prototype,"popupEnabled",void 0),y([w({type:Boolean})],La.prototype,"attributionVisible",void 0),y([w({type:rt})],La.prototype,"spatialReference",void 0),y([w({type:String})],La.prototype,"title",void 0),y([w({readOnly:!0,json:{read:!1}})],La.prototype,"type",void 0),y([w()],La.prototype,"url",void 0),y([w({type:Boolean,nonNullable:!0})],La.prototype,"visible",void 0),La=y([Z("esri.layers.Layer")],La);const pE=La,Iz={transparent:[0,0,0,0],black:[0,0,0,1],silver:[192,192,192,1],gray:[128,128,128,1],white:[255,255,255,1],maroon:[128,0,0,1],red:[255,0,0,1],purple:[128,0,128,1],fuchsia:[255,0,255,1],green:[0,128,0,1],lime:[0,255,0,1],olive:[128,128,0,1],yellow:[255,255,0,1],navy:[0,0,128,1],blue:[0,0,255,1],teal:[0,128,128,1],aqua:[0,255,255,1],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],blanchedalmond:[255,235,205,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],oldlace:[253,245,230,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],rebeccapurple:[102,51,153,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],whitesmoke:[245,245,245,1],yellowgreen:[154,205,50,1]};function sCe(t){return!!Iz[t]||!!Iz[t.toLowerCase()]}function use(t){return Iz[t]??Iz[t.toLowerCase()]}function FXe(t){return[...use(t)]}function vH(t,e,i){i<0&&++i,i>1&&--i;const r=6*i;return r<1?t+(e-t)*r:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function oCe(t,e,i,r=1){const n=(t%360+360)%360/360,s=i<=.5?i*(e+1):i+e-i*e,o=2*i-s;return[Math.round(255*vH(o,s,n+1/3)),Math.round(255*vH(o,s,n)),Math.round(255*vH(o,s,n-1/3)),r]}function kXe(t){const e=t.length>5,i=e?8:4,r=(1<>=i,a[3]=n*c/255),c=o&r,o>>=i,a[2]=n*c,c=o&r,o>>=i,a[1]=n*c,c=o&r,o>>=i,a[0]=n*c,a}const zXe=/^-?(\d+(\.\d+)?)\s*((px)|(pt))?$/i,UXe="screenUtils.toPt: input not recognized!",aCe=96;function Er(t){return t?t/72*aCe:0}function cd(t){return t?72*t/aCe:0}function vs(t){if(typeof t=="string"){const e=t.match(zXe);if(e){const i=Number(e[1]),r=e[3]&&e[3].toLowerCase(),n=t.charAt(0)==="-",s=r==="px"?cd(i):i;return n?-s:s}return console.warn(UXe),null}return t}function Qu(t=0,e=0){return{x:t,y:e}}function ss(t=0,e=0){return[t,e]}function hse(t=0,e=0){return[t,e]}function Ka(t=0,e=0,i=0){return[t,e,i]}function bJt(t){return t}function wJt(t){return t}function xJt(t){return t}function mm(t,e){return e?(e[0]=t.x,e[1]=t.y,e.length>2&&(e[2]=0),e):[t.x,t.y]}function wB(){const t=new Float32Array(16);return t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function VXe(t){const e=new Float32Array(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function BXe(t,e,i,r,n,s,o,a,c,p,_,x,S,C,M,P){const $=new Float32Array(16);return $[0]=t,$[1]=e,$[2]=i,$[3]=r,$[4]=n,$[5]=s,$[6]=o,$[7]=a,$[8]=c,$[9]=p,$[10]=_,$[11]=x,$[12]=S,$[13]=C,$[14]=M,$[15]=P,$}function jXe(t,e){return new Float32Array(t,e,16)}const GXe=wB();Object.freeze(Object.defineProperty({__proto__:null,IDENTITY:GXe,clone:VXe,create:wB,createView:jXe,fromValues:BXe},Symbol.toStringTag,{value:"Module"}));function Mo(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function d1(t,e,i,r,n,s,o,a,c,p,_,x,S,C,M,P,$){return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t[4]=s,t[5]=o,t[6]=a,t[7]=c,t[8]=p,t[9]=_,t[10]=x,t[11]=S,t[12]=C,t[13]=M,t[14]=P,t[15]=$,t}function Yf(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ud(t,e){if(t===e){const i=e[1],r=e[2],n=e[3],s=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=s,t[11]=e[14],t[12]=n,t[13]=o,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function u5(t,e){return Bo(t,e)||Yf(t),t}function Bo(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],a=e[5],c=e[6],p=e[7],_=e[8],x=e[9],S=e[10],C=e[11],M=e[12],P=e[13],$=e[14],F=e[15],z=i*a-r*o,k=i*c-n*o,U=i*p-s*o,j=r*c-n*a,G=r*p-s*a,Y=n*p-s*c,Q=_*P-x*M,ne=_*$-S*M,ie=_*F-C*M,he=x*$-S*P,ce=x*F-C*P,ve=S*F-C*$;let ge=z*ve-k*ce+U*he+j*ie-G*ne+Y*Q;return ge?(ge=1/ge,t[0]=(a*ve-c*ce+p*he)*ge,t[1]=(n*ce-r*ve-s*he)*ge,t[2]=(P*Y-$*G+F*j)*ge,t[3]=(S*G-x*Y-C*j)*ge,t[4]=(c*ie-o*ve-p*ne)*ge,t[5]=(i*ve-n*ie+s*ne)*ge,t[6]=($*U-M*Y-F*k)*ge,t[7]=(_*Y-S*U+C*k)*ge,t[8]=(o*ce-a*ie+p*Q)*ge,t[9]=(r*ie-i*ce-s*Q)*ge,t[10]=(M*G-P*U+F*z)*ge,t[11]=(x*U-_*G-C*z)*ge,t[12]=(a*ne-o*he-c*Q)*ge,t[13]=(i*he-r*ne+n*Q)*ge,t[14]=(P*k-M*j-$*z)*ge,t[15]=(_*j-x*k+S*z)*ge,t):null}function HXe(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],a=e[5],c=e[6],p=e[7],_=e[8],x=e[9],S=e[10],C=e[11],M=e[12],P=e[13],$=e[14],F=e[15];return t[0]=a*(S*F-C*$)-x*(c*F-p*$)+P*(c*C-p*S),t[1]=-(r*(S*F-C*$)-x*(n*F-s*$)+P*(n*C-s*S)),t[2]=r*(c*F-p*$)-a*(n*F-s*$)+P*(n*p-s*c),t[3]=-(r*(c*C-p*S)-a*(n*C-s*S)+x*(n*p-s*c)),t[4]=-(o*(S*F-C*$)-_*(c*F-p*$)+M*(c*C-p*S)),t[5]=i*(S*F-C*$)-_*(n*F-s*$)+M*(n*C-s*S),t[6]=-(i*(c*F-p*$)-o*(n*F-s*$)+M*(n*p-s*c)),t[7]=i*(c*C-p*S)-o*(n*C-s*S)+_*(n*p-s*c),t[8]=o*(x*F-C*P)-_*(a*F-p*P)+M*(a*C-p*x),t[9]=-(i*(x*F-C*P)-_*(r*F-s*P)+M*(r*C-s*x)),t[10]=i*(a*F-p*P)-o*(r*F-s*P)+M*(r*p-s*a),t[11]=-(i*(a*C-p*x)-o*(r*C-s*x)+_*(r*p-s*a)),t[12]=-(o*(x*$-S*P)-_*(a*$-c*P)+M*(a*S-c*x)),t[13]=i*(x*$-S*P)-_*(r*$-n*P)+M*(r*S-n*x),t[14]=-(i*(a*$-c*P)-o*(r*$-n*P)+M*(r*c-n*a)),t[15]=i*(a*S-c*x)-o*(r*S-n*x)+_*(r*c-n*a),t}function qXe(t){const e=t[0],i=t[1],r=t[2],n=t[3],s=t[4],o=t[5],a=t[6],c=t[7],p=t[8],_=t[9],x=t[10],S=t[11],C=t[12],M=t[13],P=t[14],$=t[15];return(e*o-i*s)*(x*$-S*P)-(e*a-r*s)*(_*$-S*M)+(e*c-n*s)*(_*P-x*M)+(i*a-r*o)*(p*$-S*C)-(i*c-n*o)*(p*P-x*C)+(r*c-n*a)*(p*M-_*C)}function sn(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3],a=e[4],c=e[5],p=e[6],_=e[7],x=e[8],S=e[9],C=e[10],M=e[11],P=e[12],$=e[13],F=e[14],z=e[15];let k=i[0],U=i[1],j=i[2],G=i[3];return t[0]=k*r+U*a+j*x+G*P,t[1]=k*n+U*c+j*S+G*$,t[2]=k*s+U*p+j*C+G*F,t[3]=k*o+U*_+j*M+G*z,k=i[4],U=i[5],j=i[6],G=i[7],t[4]=k*r+U*a+j*x+G*P,t[5]=k*n+U*c+j*S+G*$,t[6]=k*s+U*p+j*C+G*F,t[7]=k*o+U*_+j*M+G*z,k=i[8],U=i[9],j=i[10],G=i[11],t[8]=k*r+U*a+j*x+G*P,t[9]=k*n+U*c+j*S+G*$,t[10]=k*s+U*p+j*C+G*F,t[11]=k*o+U*_+j*M+G*z,k=i[12],U=i[13],j=i[14],G=i[15],t[12]=k*r+U*a+j*x+G*P,t[13]=k*n+U*c+j*S+G*$,t[14]=k*s+U*p+j*C+G*F,t[15]=k*o+U*_+j*M+G*z,t}function eh(t,e,i){const r=i[0],n=i[1],s=i[2];if(e===t)t[12]=e[0]*r+e[4]*n+e[8]*s+e[12],t[13]=e[1]*r+e[5]*n+e[9]*s+e[13],t[14]=e[2]*r+e[6]*n+e[10]*s+e[14],t[15]=e[3]*r+e[7]*n+e[11]*s+e[15];else{const o=e[0],a=e[1],c=e[2],p=e[3],_=e[4],x=e[5],S=e[6],C=e[7],M=e[8],P=e[9],$=e[10],F=e[11];t[0]=o,t[1]=a,t[2]=c,t[3]=p,t[4]=_,t[5]=x,t[6]=S,t[7]=C,t[8]=M,t[9]=P,t[10]=$,t[11]=F,t[12]=o*r+_*n+M*s+e[12],t[13]=a*r+x*n+P*s+e[13],t[14]=c*r+S*n+$*s+e[14],t[15]=p*r+C*n+F*s+e[15]}return t}function L9(t,e,i){const r=i[0],n=i[1],s=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Zh(t,e,i,r){let n,s,o,a,c,p,_,x,S,C,M,P,$,F,z,k,U,j,G,Y,Q,ne,ie,he,ce=r[0],ve=r[1],ge=r[2],pe=Math.sqrt(ce*ce+ve*ve+ge*ge);return pe0?(i[0]=2*(a*o+_*r+c*s-p*n)/x,i[1]=2*(c*o+_*n+p*r-a*s)/x,i[2]=2*(p*o+_*s+a*n-c*r)/x):(i[0]=2*(a*o+_*r+c*s-p*n),i[1]=2*(c*o+_*n+p*r-a*s),i[2]=2*(p*o+_*s+a*n-c*r)),uCe(t,e,i),t}const ZXe=W();function $z(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function hCe(t,e){const i=e[0],r=e[1],n=e[2],s=e[4],o=e[5],a=e[6],c=e[8],p=e[9],_=e[10];return t[0]=Math.sqrt(i*i+r*r+n*n),t[1]=Math.sqrt(s*s+o*o+a*a),t[2]=Math.sqrt(c*c+p*p+_*_),t}function JXe(t,e){const i=e[0]+e[5]+e[10];let r=0;return i>0?(r=2*Math.sqrt(i+1),t[3]=.25*r,t[0]=(e[6]-e[9])/r,t[1]=(e[8]-e[2])/r,t[2]=(e[1]-e[4])/r):e[0]>e[5]&&e[0]>e[10]?(r=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/r,t[0]=.25*r,t[1]=(e[1]+e[4])/r,t[2]=(e[8]+e[2])/r):e[5]>e[10]?(r=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/r,t[0]=(e[1]+e[4])/r,t[1]=.25*r,t[2]=(e[6]+e[9])/r):(r=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/r,t[0]=(e[8]+e[2])/r,t[1]=(e[6]+e[9])/r,t[2]=.25*r),t}function dCe(t,e,i,r){const n=e[0],s=e[1],o=e[2],a=e[3],c=n+n,p=s+s,_=o+o,x=n*c,S=n*p,C=n*_,M=s*p,P=s*_,$=o*_,F=a*c,z=a*p,k=a*_,U=r[0],j=r[1],G=r[2];return t[0]=(1-(M+$))*U,t[1]=(S+k)*U,t[2]=(C-z)*U,t[3]=0,t[4]=(S-k)*j,t[5]=(1-(x+$))*j,t[6]=(P+F)*j,t[7]=0,t[8]=(C+z)*G,t[9]=(P-F)*G,t[10]=(1-(x+M))*G,t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t}function KXe(t,e,i,r,n){const s=e[0],o=e[1],a=e[2],c=e[3],p=s+s,_=o+o,x=a+a,S=s*p,C=s*_,M=s*x,P=o*_,$=o*x,F=a*x,z=c*p,k=c*_,U=c*x,j=r[0],G=r[1],Y=r[2],Q=n[0],ne=n[1],ie=n[2],he=(1-(P+F))*j,ce=(C+U)*j,ve=(M-k)*j,ge=(C-U)*G,pe=(1-(S+F))*G,Ee=($+z)*G,te=(M+k)*Y,le=($-z)*Y,de=(1-(S+P))*Y;return t[0]=he,t[1]=ce,t[2]=ve,t[3]=0,t[4]=ge,t[5]=pe,t[6]=Ee,t[7]=0,t[8]=te,t[9]=le,t[10]=de,t[11]=0,t[12]=i[0]+Q-(he*Q+ge*ne+te*ie),t[13]=i[1]+ne-(ce*Q+pe*ne+le*ie),t[14]=i[2]+ie-(ve*Q+Ee*ne+de*ie),t[15]=1,t}function QXe(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=i+i,a=r+r,c=n+n,p=i*o,_=r*o,x=r*a,S=n*o,C=n*a,M=n*c,P=s*o,$=s*a,F=s*c;return t[0]=1-x-M,t[1]=_+F,t[2]=S-$,t[3]=0,t[4]=_-F,t[5]=1-p-M,t[6]=C+P,t[7]=0,t[8]=S+$,t[9]=C-P,t[10]=1-p-x,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function pCe(t,e,i,r,n,s,o){const a=1/(i-e),c=1/(n-r),p=1/(s-o);return t[0]=2*s*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*s*c,t[6]=0,t[7]=0,t[8]=(i+e)*a,t[9]=(n+r)*c,t[10]=(o+s)*p,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*s*2*p,t[15]=0,t}function eZe(t,e,i,r,n){const s=1/Math.tan(e/2);let o;return t[0]=s/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,n!=null&&n!==1/0?(o=1/(r-n),t[10]=(n+r)*o,t[14]=2*n*r*o):(t[10]=-1,t[14]=-2*r),t}function tZe(t,e,i,r){const n=Math.tan(e.upDegrees*Math.PI/180),s=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),a=Math.tan(e.rightDegrees*Math.PI/180),c=2/(o+a),p=2/(n+s);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=p,t[6]=0,t[7]=0,t[8]=-(o-a)*c*.5,t[9]=(n-s)*p*.5,t[10]=r/(i-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*i/(i-r),t[15]=0,t}function fCe(t,e,i,r,n,s,o){const a=1/(e-i),c=1/(r-n),p=1/(s-o);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*p,t[11]=0,t[12]=(e+i)*a,t[13]=(n+r)*c,t[14]=(o+s)*p,t[15]=1,t}function SB(t,e,i,r){const n=e[0],s=e[1],o=e[2];let a=n-i[0],c=s-i[1],p=o-i[2];const _=al();if(Math.abs(a)<_&&Math.abs(c)<_&&Math.abs(p)<_)return void Yf(t);let x=1/Math.sqrt(a*a+c*c+p*p);a*=x,c*=x,p*=x;const S=r[0],C=r[1],M=r[2];let P=C*p-M*c,$=M*a-S*p,F=S*c-C*a;x=Math.sqrt(P*P+$*$+F*F),x?(x=1/x,P*=x,$*=x,F*=x):(P=0,$=0,F=0);let z=c*F-p*$,k=p*P-a*F,U=a*$-c*P;x=Math.sqrt(z*z+k*k+U*U),x?(x=1/x,z*=x,k*=x,U*=x):(z=0,k=0,U=0),t[0]=P,t[1]=z,t[2]=a,t[3]=0,t[4]=$,t[5]=k,t[6]=c,t[7]=0,t[8]=F,t[9]=U,t[10]=p,t[11]=0,t[12]=-(P*n+$*s+F*o),t[13]=-(z*n+k*s+U*o),t[14]=-(a*n+c*s+p*o),t[15]=1}function mCe(t,e,i,r){const n=e[0],s=e[1],o=e[2],a=r[0],c=r[1],p=r[2];let _=n-i[0],x=s-i[1],S=o-i[2],C=_*_+x*x+S*S;C>0&&(C=1/Math.sqrt(C),_*=C,x*=C,S*=C);let M=c*S-p*x,P=p*_-a*S,$=a*x-c*_;return C=M*M+P*P+$*$,C>0&&(C=1/Math.sqrt(C),M*=C,P*=C,$*=C),t[0]=M,t[1]=P,t[2]=$,t[3]=0,t[4]=x*$-S*P,t[5]=S*M-_*$,t[6]=_*P-x*M,t[7]=0,t[8]=_,t[9]=x,t[10]=S,t[11]=0,t[12]=n,t[13]=s,t[14]=o,t[15]=1,t}function iZe(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function rZe(t){return Math.sqrt(t[0]**2+t[1]**2+t[2]**2+t[3]**2+t[4]**2+t[5]**2+t[6]**2+t[7]**2+t[8]**2+t[9]**2+t[10]**2+t[11]**2+t[12]**2+t[13]**2+t[14]**2+t[15]**2)}function nZe(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t[9]=e[9]+i[9],t[10]=e[10]+i[10],t[11]=e[11]+i[11],t[12]=e[12]+i[12],t[13]=e[13]+i[13],t[14]=e[14]+i[14],t[15]=e[15]+i[15],t}function gCe(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t[9]=e[9]-i[9],t[10]=e[10]-i[10],t[11]=e[11]-i[11],t[12]=e[12]-i[12],t[13]=e[13]-i[13],t[14]=e[14]-i[14],t[15]=e[15]-i[15],t}function sZe(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12]*i,t[13]=e[13]*i,t[14]=e[14]*i,t[15]=e[15]*i,t}function oZe(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t[2]=e[2]+i[2]*r,t[3]=e[3]+i[3]*r,t[4]=e[4]+i[4]*r,t[5]=e[5]+i[5]*r,t[6]=e[6]+i[6]*r,t[7]=e[7]+i[7]*r,t[8]=e[8]+i[8]*r,t[9]=e[9]+i[9]*r,t[10]=e[10]+i[10]*r,t[11]=e[11]+i[11]*r,t[12]=e[12]+i[12]*r,t[13]=e[13]+i[13]*r,t[14]=e[14]+i[14]*r,t[15]=e[15]+i[15]*r,t}function dse(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function TB(t,e){if(t===e)return!0;const i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],c=t[6],p=t[7],_=t[8],x=t[9],S=t[10],C=t[11],M=t[12],P=t[13],$=t[14],F=t[15],z=e[0],k=e[1],U=e[2],j=e[3],G=e[4],Y=e[5],Q=e[6],ne=e[7],ie=e[8],he=e[9],ce=e[10],ve=e[11],ge=e[12],pe=e[13],Ee=e[14],te=e[15],le=al();return Math.abs(i-z)<=le*Math.max(1,Math.abs(i),Math.abs(z))&&Math.abs(r-k)<=le*Math.max(1,Math.abs(r),Math.abs(k))&&Math.abs(n-U)<=le*Math.max(1,Math.abs(n),Math.abs(U))&&Math.abs(s-j)<=le*Math.max(1,Math.abs(s),Math.abs(j))&&Math.abs(o-G)<=le*Math.max(1,Math.abs(o),Math.abs(G))&&Math.abs(a-Y)<=le*Math.max(1,Math.abs(a),Math.abs(Y))&&Math.abs(c-Q)<=le*Math.max(1,Math.abs(c),Math.abs(Q))&&Math.abs(p-ne)<=le*Math.max(1,Math.abs(p),Math.abs(ne))&&Math.abs(_-ie)<=le*Math.max(1,Math.abs(_),Math.abs(ie))&&Math.abs(x-he)<=le*Math.max(1,Math.abs(x),Math.abs(he))&&Math.abs(S-ce)<=le*Math.max(1,Math.abs(S),Math.abs(ce))&&Math.abs(C-ve)<=le*Math.max(1,Math.abs(C),Math.abs(ve))&&Math.abs(M-ge)<=le*Math.max(1,Math.abs(M),Math.abs(ge))&&Math.abs(P-pe)<=le*Math.max(1,Math.abs(P),Math.abs(pe))&&Math.abs($-Ee)<=le*Math.max(1,Math.abs($),Math.abs(Ee))&&Math.abs(F-te)<=le*Math.max(1,Math.abs(F),Math.abs(te))}function pse(t){const e=al(),i=t[0],r=t[1],n=t[2],s=t[4],o=t[5],a=t[6],c=t[8],p=t[9],_=t[10];return Math.abs(1-(i*i+s*s+c*c))<=e&&Math.abs(1-(r*r+o*o+p*p))<=e&&Math.abs(1-(n*n+a*a+_*_))<=e}function EB(t){return t[0]===1&&t[1]===0&&t[2]===0&&t[4]===0&&t[5]===1&&t[6]===0&&t[8]===0&&t[9]===0&&t[10]===1}const aZe=sn,lZe=gCe;Object.freeze(Object.defineProperty({__proto__:null,add:nZe,adjoint:HXe,copy:Mo,determinant:qXe,equals:TB,exactEquals:dse,frob:rZe,fromQuat:QXe,fromQuat2:XXe,fromRotation:Ep,fromRotationTranslation:uCe,fromRotationTranslationScale:dCe,fromRotationTranslationScaleOrigin:KXe,fromScaling:WXe,fromTranslation:D9,fromXRotation:lCe,fromYRotation:YXe,fromZRotation:cCe,frustum:pCe,getRotation:JXe,getScaling:hCe,getTranslation:$z,hasIdentityRotation:EB,identity:Yf,invert:Bo,invertOrIdentity:u5,isOrthoNormal:pse,lookAt:SB,mul:aZe,multiply:sn,multiplyScalar:sZe,multiplyScalarAndAdd:oZe,ortho:fCe,perspective:eZe,perspectiveFromFieldOfView:tZe,rotate:Zh,rotateX:tP,rotateY:xB,rotateZ:iP,scale:L9,set:d1,str:iZe,sub:lZe,subtract:gCe,targetTo:mCe,translate:eh,transpose:ud},Symbol.toStringTag,{value:"Module"}));const cZe=(t,e)=>{const i=d1(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1);return ud(i,i)},uZe=(t,e)=>{const i=d1(t,e,0,0,.5-.5*e,0,e,0,.5-.5*e,0,0,e,.5-.5*e,0,0,0,1);return ud(i,i)},hZe=(t,e)=>{const i=1-e,r=d1(t,.2126+.7874*i,.7152-.7152*i,.0722-.0722*i,0,.2126-.2126*i,.7152+.2848*i,.0722-.0722*i,0,.2126-.2126*i,.7152-.7152*i,.0722+.9278*i,0,0,0,0,1);return ud(r,r)},dZe=(t,e)=>{const i=Math.sin(e*Math.PI/180),r=Math.cos(e*Math.PI/180),n=d1(t,.213+.787*r-.213*i,.715-.715*r-.715*i,.072-.072*r+.928*i,0,.213-.213*r+.143*i,.715+.285*r+.14*i,.072-.072*r-.283*i,0,.213-.213*r-.787*i,.715-.715*r+.715*i,.072+.928*r+.072*i,0,0,0,0,1);return ud(n,n)},pZe=(t,e)=>{const i=1-2*e,r=d1(t,i,0,0,e,0,i,0,e,0,0,i,e,0,0,0,1);return ud(r,r)},fZe=(t,e)=>{const i=d1(t,.213+.787*e,.715-.715*e,.072-.072*e,0,.213-.213*e,.715+.285*e,.072-.072*e,0,.213-.213*e,.715-.715*e,.072+.928*e,0,0,0,0,1);return ud(i,i)},mZe=(t,e)=>{const i=1-e,r=d1(t,.393+.607*i,.769-.769*i,.189-.189*i,0,.349-.349*i,.686+.314*i,.168-.168*i,0,.272-.272*i,.534-.534*i,.131+.869*i,0,0,0,0,1);return ud(r,r)};let yCe=class vCe{constructor(e,i,r){this.strength=e,this.radius=i,this.threshold=r,this.type="bloom"}interpolate(e,i,r){this.strength=Uh(e.strength,i.strength,r),this.radius=Uh(e.radius,i.radius,r),this.threshold=Uh(e.threshold,i.threshold,r)}clone(){return new vCe(this.strength,this.radius,this.threshold)}toJSON(){return{type:"bloom",radius:r$(this.radius),strength:this.strength,threshold:this.threshold}}},_Ce=class bCe{constructor(e){this.radius=e,this.type="blur"}interpolate(e,i,r){this.radius=Math.round(Uh(e.radius,i.radius,r))}clone(){return new bCe(this.radius)}toJSON(){return{type:"blur",radius:r$(this.radius)}}},jZ=class wCe{constructor(e,i){this.type=e,this.amount=i,this.type!=="invert"&&this.type!=="grayscale"&&this.type!=="sepia"||(this.amount=Math.min(this.amount,1))}get colorMatrix(){return this._colorMatrix||this._updateMatrix(),this._colorMatrix}interpolate(e,i,r){this.amount=Uh(e.amount,i.amount,r),this._updateMatrix()}clone(){return new wCe(this.type,this.amount)}toJSON(){return{type:this.type,amount:this.amount}}_updateMatrix(){const e=this._colorMatrix||wB();switch(this.type){case"brightness":this._colorMatrix=cZe(e,this.amount);break;case"contrast":this._colorMatrix=uZe(e,this.amount);break;case"grayscale":this._colorMatrix=hZe(e,this.amount);break;case"invert":this._colorMatrix=pZe(e,this.amount);break;case"saturate":this._colorMatrix=fZe(e,this.amount);break;case"sepia":this._colorMatrix=mZe(e,this.amount)}}},xCe=class SCe{constructor(e,i,r,n){this.offsetX=e,this.offsetY=i,this.blurRadius=r,this.color=n,this.type="drop-shadow"}interpolate(e,i,r){this.offsetX=Uh(e.offsetX,i.offsetX,r),this.offsetY=Uh(e.offsetY,i.offsetY,r),this.blurRadius=Uh(e.blurRadius,i.blurRadius,r),this.color[0]=Math.round(Uh(e.color[0],i.color[0],r)),this.color[1]=Math.round(Uh(e.color[1],i.color[1],r)),this.color[2]=Math.round(Uh(e.color[2],i.color[2],r)),this.color[3]=Uh(e.color[3],i.color[3],r)}clone(){return new SCe(this.offsetX,this.offsetY,this.blurRadius,[...this.color])}toJSON(){const e=[...this.color];return e[3]*=255,{type:"drop-shadow",xoffset:r$(this.offsetX),yoffset:r$(this.offsetY),blurRadius:r$(this.blurRadius),color:e}}},TCe=class ECe{constructor(e){this.angle=e,this.type="hue-rotate"}get colorMatrix(){return this._colorMatrix||this._updateMatrix(),this._colorMatrix}interpolate(e,i,r){this.angle=Uh(e.angle,i.angle,r),this._updateMatrix()}clone(){return new ECe(this.angle)}toJSON(){return{type:"hue-rotate",angle:this.angle}}_updateMatrix(){const e=this._colorMatrix||wB();this._colorMatrix=dZe(e,this.angle)}},CCe=class ACe{constructor(e){this.amount=e,this.type="opacity",this.amount=Math.min(this.amount,1)}interpolate(e,i,r){this.amount=Uh(e.amount,i.amount,r)}clone(){return new ACe(this.amount)}toJSON(){return{type:"opacity",amount:this.amount}}};function Uh(t,e,i){return t+(e-t)*i}function r$(t){return Math.round(1e3*cd(t))/1e3}function gZe(t){switch(t.type){case"grayscale":case"sepia":case"invert":return new jZ(t.type,0);case"saturate":case"brightness":case"contrast":return new jZ(t.type,1);case"opacity":return new CCe(1);case"hue-rotate":return new TCe(0);case"blur":return new _Ce(0);case"drop-shadow":return new xCe(0,0,0,[...use("transparent")]);case"bloom":return new yCe(0,0,1)}}var SJt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function h5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function MCe(t,e){const i=t.length>e.length?t:e;return(t.length>e.length?e:t).every((r,n)=>r.type===i[n].type)}function OCe(t,e){const i=t.length>e.length?t:e,r=t.length>e.length?e:t;for(let n=r.length;ns?n:(s-=n.length,n+(o+=o.repeat(s)).slice(0,s))}function r(n,s){var o,a={},c=(s=s!==void 0?s:{}).grammarSource,p={start:cs},_=cs,x="none",S=")",C=",",M="(",P="%",$="px",F="cm",z="mm",k="in",U="pt",j="pc",G="deg",Y="rad",Q="grad",ne="turn",ie="#",he=".",ce="e",ve=/^[ \t\n\r]/,ge=/^[a-z\-]/,pe=/^[0-9a-fA-F]/,Ee=/^[+\-]/,te=/^[0-9]/,le=lt("none"),de=Xe("none",!1),be=Xe(")",!1),Se=Xe(",",!1),Ae=lt("whitespace"),Re=We([" "," ",` +`,"\r"],!1,!1),Ge=lt("function"),ut=Xe("(",!1),Ft=lt("identifier"),ei=We([["a","z"],"-"],!1,!1),Mt=lt("percentage"),ri=Xe("%",!1),It=lt("length"),dt=Xe("px",!1),pt=Xe("cm",!1),ai=Xe("mm",!1),ht=Xe("in",!1),Ct=Xe("pt",!1),Dt=Xe("pc",!1),Tt=lt("angle"),re=Xe("deg",!1),Ht=Xe("rad",!1),hr=Xe("grad",!1),Ke=Xe("turn",!1),Lt=lt("number"),vt=lt("color"),Bt=Xe("#",!1),qt=We([["0","9"],["a","f"],["A","F"]],!1,!1),li=We(["+","-"],!1,!1),mi=We([["0","9"]],!1,!1),Dr=Xe(".",!1),Nr=Xe("e",!1),Ze=function(){return[]},xi=function(xe,He){return{type:"function",name:xe,parameters:He||[]}},m=function(xe,He){return He.length>0?B5(xe,He,3):[xe]},D=function(xe){return{type:"quantity",value:xe.value,unit:xe.unit}},E=function(xe){return{type:"color",colorType:xe.type,value:xe.value}},f=function(xe){return xe},h=function(){return Fe()},l=function(xe){return{value:xe,unit:"%"}},u=function(xe){return{value:xe,unit:"px"}},d=function(xe){return{value:xe,unit:"cm"}},g=function(xe){return{value:xe,unit:"mm"}},v=function(xe){return{value:xe,unit:"in"}},b=function(xe){return{value:xe,unit:"pt"}},T=function(xe){return{value:xe,unit:"pc"}},A=function(xe){return{value:xe,unit:"deg"}},O=function(xe){return{value:xe,unit:"rad"}},I=function(xe){return{value:xe,unit:"grad"}},L=function(xe){return{value:xe,unit:"turn"}},N=function(xe){return{value:xe,unit:null}},B=function(){return{type:"hex",value:Fe()}},H=function(xe){return{type:"function",value:xe}},K=function(){return{type:"named",value:Fe()}},ee=function(){return parseFloat(Fe())},q=0,oe=0,ye=[{line:1,column:1}],me=0,Me=[],Te=0;if("startRule"in s){if(!(s.startRule in p))throw new Error(`Can't start parsing from rule "`+s.startRule+'".');_=p[s.startRule]}function Fe(){return n.substring(oe,q)}function Xe(xe,He){return{type:"literal",text:xe,ignoreCase:He}}function We(xe,He,ct){return{type:"class",parts:xe,inverted:He,ignoreCase:ct}}function Ot(){return{type:"end"}}function lt(xe){return{type:"other",description:xe}}function vi(xe){var He,ct=ye[xe];if(ct)return ct;for(He=xe-1;!ye[He];)He--;for(ct={line:(ct=ye[He]).line,column:ct.column};Heme&&(me=q,Me=[]),Me.push(xe))}function nn(xe,He,ct){return new e(e.buildMessage(xe,He),xe,He,ct)}function cs(){var xe;return(xe=an())===a&&(xe=Gi()),xe}function an(){var xe,He;return Te++,xe=q,Ri(),n.substr(q,4)===x?(He=x,q+=4):(He=a,Te===0&&At(de)),He!==a?(Ri(),oe=xe,xe=Ze()):(q=xe,xe=a),Te--,xe===a&&Te===0&&At(le),xe}function Gi(){var xe,He;if(xe=[],(He=nr())!==a)for(;He!==a;)xe.push(He),He=nr();else xe=a;return xe}function nr(){var xe,He,ct,fr;return xe=q,Ri(),(He=Oa())!==a?(Ri(),(ct=zi())===a&&(ct=null),Ri(),n.charCodeAt(q)===41?(fr=S,q++):(fr=a,Te===0&&At(be)),fr!==a?(Ri(),oe=xe,xe=xi(He,ct)):(q=xe,xe=a)):(q=xe,xe=a),xe}function zi(){var xe,He,ct,fr,Ho,Fn,Lc,Sx;if(xe=q,(He=pr())!==a){for(ct=[],fr=q,Ho=Ri(),n.charCodeAt(q)===44?(Fn=C,q++):(Fn=a,Te===0&&At(Se)),Fn===a&&(Fn=null),Lc=Ri(),(Sx=pr())!==a?fr=Ho=[Ho,Fn,Lc,Sx]:(q=fr,fr=a);fr!==a;)ct.push(fr),fr=q,Ho=Ri(),n.charCodeAt(q)===44?(Fn=C,q++):(Fn=a,Te===0&&At(Se)),Fn===a&&(Fn=null),Lc=Ri(),(Sx=pr())!==a?fr=Ho=[Ho,Fn,Lc,Sx]:(q=fr,fr=a);oe=xe,xe=m(He,ct)}else q=xe,xe=a;return xe}function pr(){var xe,He;return xe=q,(He=Go())===a&&(He=Kr())===a&&(He=Ip())===a&&(He=bd()),He!==a&&(oe=xe,He=D(He)),(xe=He)===a&&(xe=q,(He=S1())!==a&&(oe=xe,He=E(He)),xe=He),xe}function Ri(){var xe,He;for(Te++,xe=[],ve.test(n.charAt(q))?(He=n.charAt(q),q++):(He=a,Te===0&&At(Re));He!==a;)xe.push(He),ve.test(n.charAt(q))?(He=n.charAt(q),q++):(He=a,Te===0&&At(Re));return Te--,He=a,Te===0&&At(Ae),xe}function Oa(){var xe,He,ct;return Te++,xe=q,(He=dr())!==a?(n.charCodeAt(q)===40?(ct=M,q++):(ct=a,Te===0&&At(ut)),ct!==a?(oe=xe,xe=f(He)):(q=xe,xe=a)):(q=xe,xe=a),Te--,xe===a&&(He=a,Te===0&&At(Ge)),xe}function dr(){var xe,He,ct;if(Te++,xe=q,He=[],ge.test(n.charAt(q))?(ct=n.charAt(q),q++):(ct=a,Te===0&&At(ei)),ct!==a)for(;ct!==a;)He.push(ct),ge.test(n.charAt(q))?(ct=n.charAt(q),q++):(ct=a,Te===0&&At(ei));else He=a;return He!==a&&(oe=xe,He=h()),Te--,(xe=He)===a&&(He=a,Te===0&&At(Ft)),xe}function Go(){var xe,He,ct;return Te++,xe=q,Ri(),(He=ll())!==a?(n.charCodeAt(q)===37?(ct=P,q++):(ct=a,Te===0&&At(ri)),ct!==a?(oe=xe,xe=l(He)):(q=xe,xe=a)):(q=xe,xe=a),Te--,xe===a&&Te===0&&At(Mt),xe}function Kr(){var xe,He,ct;return Te++,xe=q,Ri(),(He=ll())!==a?(n.substr(q,2)===$?(ct=$,q+=2):(ct=a,Te===0&&At(dt)),ct!==a?(oe=xe,xe=u(He)):(q=xe,xe=a)):(q=xe,xe=a),xe===a&&(xe=q,Ri(),(He=ll())!==a?(n.substr(q,2)===F?(ct=F,q+=2):(ct=a,Te===0&&At(pt)),ct!==a?(oe=xe,xe=d(He)):(q=xe,xe=a)):(q=xe,xe=a),xe===a&&(xe=q,Ri(),(He=ll())!==a?(n.substr(q,2)===z?(ct=z,q+=2):(ct=a,Te===0&&At(ai)),ct!==a?(oe=xe,xe=g(He)):(q=xe,xe=a)):(q=xe,xe=a),xe===a&&(xe=q,Ri(),(He=ll())!==a?(n.substr(q,2)===k?(ct=k,q+=2):(ct=a,Te===0&&At(ht)),ct!==a?(oe=xe,xe=v(He)):(q=xe,xe=a)):(q=xe,xe=a),xe===a&&(xe=q,Ri(),(He=ll())!==a?(n.substr(q,2)===U?(ct=U,q+=2):(ct=a,Te===0&&At(Ct)),ct!==a?(oe=xe,xe=b(He)):(q=xe,xe=a)):(q=xe,xe=a),xe===a&&(xe=q,Ri(),(He=ll())!==a?(n.substr(q,2)===j?(ct=j,q+=2):(ct=a,Te===0&&At(Dt)),ct!==a?(oe=xe,xe=T(He)):(q=xe,xe=a)):(q=xe,xe=a)))))),Te--,xe===a&&Te===0&&At(It),xe}function Ip(){var xe,He,ct;return Te++,xe=q,(He=ll())!==a?(n.substr(q,3)===G?(ct=G,q+=3):(ct=a,Te===0&&At(re)),ct!==a?(oe=xe,xe=A(He)):(q=xe,xe=a)):(q=xe,xe=a),xe===a&&(xe=q,(He=ll())!==a?(n.substr(q,3)===Y?(ct=Y,q+=3):(ct=a,Te===0&&At(Ht)),ct!==a?(oe=xe,xe=O(He)):(q=xe,xe=a)):(q=xe,xe=a),xe===a&&(xe=q,(He=ll())!==a?(n.substr(q,4)===Q?(ct=Q,q+=4):(ct=a,Te===0&&At(hr)),ct!==a?(oe=xe,xe=I(He)):(q=xe,xe=a)):(q=xe,xe=a),xe===a&&(xe=q,(He=ll())!==a?(n.substr(q,4)===ne?(ct=ne,q+=4):(ct=a,Te===0&&At(Ke)),ct!==a?(oe=xe,xe=L(He)):(q=xe,xe=a)):(q=xe,xe=a)))),Te--,xe===a&&(He=a,Te===0&&At(Tt)),xe}function bd(){var xe,He;return Te++,xe=q,Ri(),(He=ll())!==a?(oe=xe,xe=N(He)):(q=xe,xe=a),Te--,xe===a&&Te===0&&At(Lt),xe}function S1(){var xe,He,ct,fr;if(Te++,xe=q,n.charCodeAt(q)===35?(He=ie,q++):(He=a,Te===0&&At(Bt)),He!==a){if(ct=[],pe.test(n.charAt(q))?(fr=n.charAt(q),q++):(fr=a,Te===0&&At(qt)),fr!==a)for(;fr!==a;)ct.push(fr),pe.test(n.charAt(q))?(fr=n.charAt(q),q++):(fr=a,Te===0&&At(qt));else ct=a;ct!==a?(oe=xe,xe=B()):(q=xe,xe=a)}else q=xe,xe=a;return xe===a&&(xe=q,(He=nr())!==a&&(oe=xe,He=H(He)),(xe=He)===a&&(xe=q,(He=dr())!==a&&(oe=xe,He=K()),xe=He)),Te--,xe===a&&(He=a,Te===0&&At(vt)),xe}function ll(){var xe,He,ct,fr,Ho,Fn,Lc;for(xe=q,Ee.test(n.charAt(q))?(n.charAt(q),q++):Te===0&&At(li),He=q,ct=[],te.test(n.charAt(q))?(fr=n.charAt(q),q++):(fr=a,Te===0&&At(mi));fr!==a;)ct.push(fr),te.test(n.charAt(q))?(fr=n.charAt(q),q++):(fr=a,Te===0&&At(mi));if(n.charCodeAt(q)===46?(fr=he,q++):(fr=a,Te===0&&At(Dr)),fr!==a){if(Ho=[],te.test(n.charAt(q))?(Fn=n.charAt(q),q++):(Fn=a,Te===0&&At(mi)),Fn!==a)for(;Fn!==a;)Ho.push(Fn),te.test(n.charAt(q))?(Fn=n.charAt(q),q++):(Fn=a,Te===0&&At(mi));else Ho=a;Ho!==a?He=ct=[ct,fr,Ho]:(q=He,He=a)}else q=He,He=a;if(He===a)if(He=[],te.test(n.charAt(q))?(ct=n.charAt(q),q++):(ct=a,Te===0&&At(mi)),ct!==a)for(;ct!==a;)He.push(ct),te.test(n.charAt(q))?(ct=n.charAt(q),q++):(ct=a,Te===0&&At(mi));else He=a;if(He!==a){if(ct=q,n.charCodeAt(q)===101?(fr=ce,q++):(fr=a,Te===0&&At(Nr)),fr!==a){if(Ee.test(n.charAt(q))?(Ho=n.charAt(q),q++):(Ho=a,Te===0&&At(li)),Ho===a&&(Ho=null),Fn=[],te.test(n.charAt(q))?(Lc=n.charAt(q),q++):(Lc=a,Te===0&&At(mi)),Lc!==a)for(;Lc!==a;)Fn.push(Lc),te.test(n.charAt(q))?(Lc=n.charAt(q),q++):(Lc=a,Te===0&&At(mi));else Fn=a;Fn!==a?ct=fr=[fr,Ho,Fn]:(q=ct,ct=a)}else q=ct,ct=a;ct===a&&(ct=null),oe=xe,xe=ee()}else q=xe,xe=a;return xe}function V5(xe,He){return xe.map(function(ct){return ct[He]})}function B5(xe,He,ct){return[xe].concat(V5(He,ct))}if((o=_())!==a&&q===n.length)return o;throw o!==a&&q `+_+` -`+T+` | -`+f.line+" | "+A+` -`+T+" | "+i("",c.column-1," ")+i("",M,"^")}else s+=` - at `+_}return s},e.buildMessage=function(n,s){var o={literal:function(A){return'"'+c(A.text)+'"'},class:function(A){var M=A.parts.map(function(I){return Array.isArray(I)?f(I[0])+"-"+f(I[1]):f(I)});return"["+(A.inverted?"^":"")+M.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(A){return A.description}};function l(A){return A.charCodeAt(0).toString(16).toUpperCase()}function c(A){return A.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(M){return"\\x0"+l(M)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(M){return"\\x"+l(M)})}function f(A){return A.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(M){return"\\x0"+l(M)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(M){return"\\x"+l(M)})}function _(A){return o[A.type](A)}function x(A){var M,I,L=A.map(_);if(L.sort(),L.length>0){for(M=1,I=1;M{if(!Number.isFinite(i.scale)||i.scale<=0)throw new se("effect:invalid-scale","scale must be finite and greater than 0",{stop:i});return{scale:i.scale,effects:spe(i.value)}});e.sort((i,r)=>r.effects.length-i.effects.length);for(let i=0;ir.scale-i.scale),e}function spe(t){let e;if(!t)return[];try{e=Stt.parse(t)}catch(i){throw new se("effect:invalid-syntax","Invalid effect syntax",{value:t,error:i})}return e.map(i=>Ttt(i))}function Ttt(t){try{switch(t.name){case"grayscale":case"sepia":case"saturate":case"invert":case"brightness":case"contrast":return Ett(t);case"opacity":return Ctt(t);case"hue-rotate":return Att(t);case"blur":return Mtt(t);case"drop-shadow":return Ott(t);case"bloom":return Ptt(t)}}catch(e){throw e.details.filter=t,e}throw new se("effect:unknown-effect",`Effect '${t.name}' is not supported`,{effect:t})}function Ett(t){let e=1;return aP(t.parameters,1),t.parameters.length===1&&(e=rm(t.parameters[0])),new JZ(t.name,e)}function Ctt(t){let e=1;return aP(t.parameters,1),t.parameters.length===1&&(e=rm(t.parameters[0])),new uMe(e)}function Att(t){let e=0;return aP(t.parameters,1),t.parameters.length===1&&(e=Ntt(t.parameters[0])),new lMe(e)}function Mtt(t){let e=0;return aP(t.parameters,1),t.parameters.length===1&&(e=xse(t.parameters[0]),D9(e,t.parameters[0])),new rMe(e)}function Ott(t){const e=[];let i=null;for(const r of t.parameters)if(r.type==="color"){if(e.length&&Object.freeze(e),i)throw new se("effect:type-error","Accepts only one color",{});i=Ftt(r)}else{const n=xse(r);if(Object.isFrozen(e))throw new se("effect:type-error"," parameters not consecutive",{lengths:e});e.push(n),e.length===3&&D9(n,r)}if(e.length<2||e.length>3)throw new se("effect:type-error",`Expected {2,3}, Actual: {${e.length}}`,{lengths:e});return new oMe(e[0],e[1],e[2]||0,i||fMe("black"))}function Ptt(t){let e=1,i=0,r=0;return aP(t.parameters,3),t.parameters[0]&&(e=rm(t.parameters[0])),t.parameters[1]&&(i=xse(t.parameters[1]),D9(i,t.parameters[1])),t.parameters[2]&&(r=rm(t.parameters[2])),new tMe(e,i,r)}function aP(t,e){if(t.length>e)throw new se("effect:type-error",`Function supports up to ${e} parameters, Actual: ${t.length}`,{parameters:t})}function MB(t){if(t.type==="color")return"";if(t.unit){if(t.unit in wse)return"";if(t.unit in bse)return"";if(t.unit==="%")return""}return""}function D9(t,e){if(t<0)throw new se("effect:type-error",`Negative values are not allowed, Actual: ${t}`,{term:e})}function Rtt(t){if(t.type!=="quantity"||t.unit!==null)throw new se("effect:type-error",`Expected , Actual: ${MB(t)}`,{term:t})}function Itt(t){if(t.type!=="quantity"||t.unit!==null&&t.unit!=="%")throw new se("effect:type-error",`Expected or , Actual: ${MB(t)}`,{term:t})}const bse={deg:1,grad:.9,rad:180/Math.PI,turn:360};function $tt(t){if(t.type!=="quantity"||!(t.value===0&&t.unit===null||t.unit&&bse[t.unit]!=null))throw new se("effect:type-error",`Expected , Actual: ${MB(t)}`,{term:t})}const wse={px:1,cm:96/2.54,mm:96/2.54/10,in:96,pc:16,pt:96/72};function Ltt(t){if(t.type!=="quantity"||!(t.value===0&&t.unit===null||t.unit&&wse[t.unit]!=null))throw new se("effect:type-error",`Expected , Actual: ${MB(t)}`,{term:t})}function rm(t){Itt(t);const e=t.value;return D9(e,t),t.unit==="%"?.01*e:e}function Dtt(t){return Rtt(t),D9(t.value,t),t.value}function Ntt(t){return $tt(t),t.value*bse[t.unit]||0}function xse(t){return Ltt(t),t.value*wse[t.unit]||0}function Ftt(t){switch(t.colorType){case"hex":return Bet(t.value);case"named":return fMe(t.value);case"function":return Utt(t.value)}}function fMe(t){if(!jAe(t))throw new se("effect:unknown-color",`color '${t}' isn't valid`,{namedColor:t});return Vet(t)}const ktt=/^rgba?/i,ztt=/^hsla?/i;function Utt(t){if(aP(t.parameters,4),ktt.test(t.name))return[rm(t.parameters[0]),rm(t.parameters[1]),rm(t.parameters[2]),t.parameters[3]?rm(t.parameters[3]):1];if(ztt.test(t.name))return GAe(Dtt(t.parameters[0]),rm(t.parameters[1]),rm(t.parameters[2]),t.parameters[3]?rm(t.parameters[3]):1);throw new se("effect:syntax-error",`Invalid color function '${t.name}'`,{colorFunction:t})}function Vtt(t,e,i){var r;try{return Gtt(t)}catch(n){(r=i==null?void 0:i.messages)==null||r.push(n)}return null}function Btt(t,e,i,r){try{const n=jtt(t);sE(i,n,e)}catch(n){r.messages&&r.messages.push(n)}}function jtt(t){const e=_se(t);return e?wtt(e)?e.map(i=>i.toJSON()):e.map(({scale:i,effects:r})=>({scale:i,value:r.map(n=>n.toJSON())})):null}function Gtt(t){if(!t||t.length===0)return null;if(Htt(t)){const e=[];for(const i of t)e.push({scale:i.scale,value:Uz(i.value)});return e}return Uz(t)}function Htt(t){const e=t[0];return!!e&&"scale"in e}function Uz(t){if(!(t!=null&&t.length))return"";const e=[];for(const i of t){let r=[];switch(i.type){case"grayscale":case"sepia":case"saturate":case"invert":case"brightness":case"contrast":case"opacity":r=[y1(i,"amount")];break;case"blur":r=[y1(i,"radius","pt")];break;case"hue-rotate":r=[y1(i,"angle","deg")];break;case"drop-shadow":r=[y1(i,"xoffset","pt"),y1(i,"yoffset","pt"),y1(i,"blurRadius","pt"),qtt(i,"color")];break;case"bloom":r=[y1(i,"strength"),y1(i,"radius","pt"),y1(i,"threshold")]}const n=`${i.type}(${r.filter(Boolean).join(" ")})`;_se(n),e.push(n)}return e.join(" ")}function y1(t,e,i){if(t[e]==null)throw new se("effect:missing-parameter",`Missing parameter '${e}' in ${t.type} effect`,{effect:t});return i?t[e]+i:""+t[e]}function qtt(t,e){if(t[e]==null)throw new se("effect:missing-parameter",`Missing parameter '${e}' in ${t.type} effect`,{effect:t});const i=t[e];return`rgba(${i[0]||0}, ${i[1]||0}, ${i[2]||0}, ${i[3]/255||0})`}const ope={read:{reader:Vtt},write:{allowNull:!0,writer:Btt}},Sse=t=>{let e=class extends t{constructor(){super(...arguments),this.blendMode="normal",this.effect=null}};return y([w({type:["average","color-burn","color-dodge","color","darken","destination-atop","destination-in","destination-out","destination-over","difference","exclusion","hard-light","hue","invert","lighten","lighter","luminosity","minus","multiply","normal","overlay","plus","reflect","saturation","screen","soft-light","source-atop","source-in","source-out","vivid-light","xor"],nonNullable:!0,json:{read:!1,write:!1,origins:{"web-map":{read:!0,write:!0},"portal-item":{read:!0,write:!0}}}})],e.prototype,"blendMode",void 0),y([w({json:{read:!1,write:!1,origins:{"web-map":ope,"portal-item":ope}}})],e.prototype,"effect",void 0),e=y([Z("esri.layers.mixins.BlendLayer")],e),e},OB=t=>{let e=class extends t{constructor(){super(...arguments),this.minScale=0,this.maxScale=0}get effectiveScaleRange(){const i={minScale:this.minScale,maxScale:this.maxScale},r=this.parent;r&&"effectiveScaleRange"in r&&Wtt(i,r.effectiveScaleRange);const n=this._get("effectiveScaleRange");return n&&n.minScale===i.minScale&&n.maxScale===i.maxScale?n:i}};return y([w({type:Number,nonNullable:!0,json:{write:!0}})],e.prototype,"minScale",void 0),y([w({type:Number,nonNullable:!0,json:{write:!0}})],e.prototype,"maxScale",void 0),y([w({readOnly:!0})],e.prototype,"effectiveScaleRange",null),e=y([Z("esri.layers.mixins.ScaleRangeLayer")],e),e};function Wtt(t,e){return t.minScale=t.minScale>0?e.minScale>0?Math.min(t.minScale,e.minScale):t.minScale:e.minScale,t.maxScale=t.maxScale>0?e.maxScale>0?Math.max(t.maxScale,e.maxScale):t.maxScale:e.maxScale,t}const Xs=t=>{let e=class extends t{clone(){var c;const i=Zl(this);ky(i,"unable to clone instance of non-accessor class");const r=i.metadatas,n=i.store,s={},o=new Map;for(const f in r){const _=r[f],x=n==null?void 0:n.originOf(f),T=_.clonable;if(_.readOnly||T===!1||x!==Di.USER&&x!==Di.DEFAULTS&&x!==Di.WEB_MAP&&x!==Di.WEB_SCENE)continue;const A=this[f];let M=null;M=typeof T=="function"?T(A):T==="reference"?A:HX(A),A!=null&&M==null||(x===Di.DEFAULTS?o.set(f,M):s[f]=M)}const l=new(Object.getPrototypeOf(this)).constructor(s);if(o.size){const f=(c=Zl(l))==null?void 0:c.store;if(f)for(const[_,x]of o)f.set(_,x,Di.DEFAULTS)}return l}};return e=y([Z("esri.core.Clonable")],e),e};let QZ=class extends Xs(ze){};QZ=y([Z("esri.core.Clonable")],QZ);async function Tse(t,e){const{WhereClause:i}=await we(()=>import("./WhereClause-XAMIZ4-B.js").then(r=>r.W),__vite__mapDeps([39,40]));return i.create(t,e)}function PB(t,e){return t!=null?e!=null?`(${t}) AND (${e})`:t:e}function LE(t){return typeof t=="string"||t instanceof String}const Ytt="yyyy-MM-dd",Xtt="TT";var JI;(function(t){t.HM="HH:mm",t.HMS="HH:mm:ss",t.HMS_MS="HH:mm:ss.SSS"})(JI||(JI={}));const Ztt=[JI.HMS_MS,JI.HMS,JI.HM,Xtt];function ape(t){return $i.fromFormat(t,Ytt)}function lpe(t){let e=null;return Ztt.find(i=>(e=$i.fromFormat(t,i),e.isValid)),e}function cpe(t){return $i.fromISO(t)}var XO;(function(t){t.VALUE_OUT_OF_RANGE="domain-validation-error::value-out-of-range",t.INVALID_CODED_VALUE="domain-validation-error::invalid-coded-value"})(XO||(XO={}));const Jtt=new Set(["integer","small-integer","big-integer","esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeBigInteger"]);function Ktt(t){return t!=null&&Jtt.has(t.type)}function mMe(t){return t!=null&&(t.type==="date-only"||t.type==="esriFieldTypeDateOnly")}function gMe(t){return t!=null&&(t.type==="timestamp-offset"||t.type==="esriFieldTypeTimestampOffset")}function yMe(t){return t!=null&&(t.type==="time-only"||t.type==="esriFieldTypeTimeOnly")}function Qtt(t,e){const i=t==null?void 0:t.domain;if(!i)return null;switch(i.type){case"range":{const{min:r,max:n}=vMe(t);if(r!=null&&+en)return XO.VALUE_OUT_OF_RANGE;break}case"coded-value":case"codedValue":if(i.codedValues==null||i.codedValues.every(r=>r==null||r.code!==e))return XO.INVALID_CODED_VALUE}return null}function vMe(t,e){const i=e??(t==null?void 0:t.domain);if(!i||i.type!=="range")return;const r="range"in i?i.range[0]:i.minValue,n="range"in i?i.range[1]:i.maxValue,s=Ktt(t);return mMe(t)||yMe(t)||gMe(t)?{...eit(t,n,r),isInteger:s}:{min:r!=null&&typeof r=="number"?r:null,max:n!=null&&typeof n=="number"?n:null,rawMin:r,rawMax:n,isInteger:s}}function eit(t,e,i){return mMe(t)?{min:i!=null&&LE(i)?ape(i).toMillis():null,max:e!=null&&LE(e)?ape(e).toMillis():null,rawMin:i,rawMax:e}:yMe(t)?{min:i!=null&&LE(i)?lpe(i).toMillis():null,max:e!=null&&LE(e)?lpe(e).toMillis():null,rawMin:i,rawMax:e}:gMe(t)?{min:i!=null&&LE(i)?cpe(i).toMillis():null,max:e!=null&&LE(e)?cpe(e).toMillis():null,rawMin:i,rawMax:e}:{max:null,min:null}}const tit=Ce.getLogger("esri.support.arcadeOnDemand");let _H;function p_(){return _H||(_H=(async()=>{const t=await we(()=>import("./arcadeUtils-OUqwHs4P.js").then(e=>e.aD),__vite__mapDeps([41,40,42]));return{arcade:t.arcade,arcadeUtils:t,Dictionary:t.Dictionary,Feature:t.arcadeFeature}})()),_H}const iit=(t,e,i)=>Ese.create(t,e,i,null,["$feature","$view"],[]),rit=(t,e,i)=>Ese.create(t,e,i,null,["$feature","$view"],[]),nit=(t,e,i,r)=>Ese.create(t,e,i,r,["$feature","$view"],[]);let Ese=class _Me{constructor(e,i,r,n,s,o,l){this.services=null,this.script=e,this.evaluate=n;const c=Array.isArray(o)?o:o.fields;this.fields=c,this._syntaxTree=r,this._arcade=i,this._arcadeFeature=s,this._spatialReference=l,this._referencesGeometry=i.scriptTouchesGeometry(this._syntaxTree),this._referencesScale=this._arcade.referencesMember(this._syntaxTree,"scale")}static async create(e,i,r,n,s,o){const{arcade:l,Feature:c,Dictionary:f}=await p_(),_=at.fromJSON(i);let x;try{x=l.parseScript(e,o)}catch(Q){return tit.error(new se("arcade-bad-expression","Failed to parse arcade script",{script:e,error:Q})),null}const T=s.reduce((Q,ne)=>({...Q,[ne]:null}),{});let A=null;n!=null&&(A=new f(n),A.immutable=!0,T.$config=null);const M=l.scriptUsesGeometryEngine(x),I=M&&l.enableGeometrySupport(),L=l.scriptUsesFeatureSet(x)&&l.enableFeatureSetSupport(),F=l.scriptIsAsync(x),z=F&&l.enableAsyncSupport(),k={vars:T,spatialReference:_,useAsync:!!z};await Promise.all([I,L,z]);const U=new Set;await l.loadDependentModules(U,x,null,F,M);const j=new f;j.immutable=!1,j.setField("scale",0);const H=l.compileScript(x,k),Y=(Q,ne)=>{var he;const re=(he=Q.$view)==null?void 0:he.timeZone;return"$view"in Q&&Q.$view&&(j.setField("scale",typeof Q.$view=="object"&&"scale"in Q.$view?Q.$view.scale:void 0),Q.$view=j),A&&(Q.$config=A),H({vars:Q,spatialReference:_,services:ne,timeZone:re})};return new _Me(e,l,x,Y,new c,r,_)}repurposeFeature(e){return e.geometry&&!e.geometry.spatialReference&&(e.geometry.spatialReference=this._spatialReference),this._arcadeFeature.repurposeFromGraphicLikeObject(e.geometry,e.attributes,{fields:this.fields}),this._arcadeFeature}referencesGeometry(){return this._referencesGeometry}referencesScale(){return this._referencesScale}};const sit=/^([0-9_])/,oit=/[^a-z0-9_\u0080-\uffff]+/gi;function ait(t){return t==null?null:t.trim().replaceAll(oit,"_").replace(sit,"F$1")||null}const lit=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],cit=["field","normalizationField"];function upe(t,e){if(t!=null&&e!=null){for(const i of Array.isArray(t)?t:[t])if(hpe(lit,i,e),"visualVariables"in i&&i.visualVariables)for(const r of i.visualVariables)hpe(cit,r,e)}}function hpe(t,e,i){if(t)for(const r of t){const n=u9(r,e),s=n&&typeof n!="function"&&i.get(n);s&&sE(r,s.name,e)}}function uit(t,e){var i;if(t!=null&&((i=e==null?void 0:e.fields)!=null&&i.length))if("startField"in t){const r=e.get(t.startField),n=e.get(t.endField);t.startField=(r==null?void 0:r.name)??null,t.endField=(n==null?void 0:n.name)??null}else{const r=e.get(t.startTimeField),n=e.get(t.endTimeField);t.startTimeField=(r==null?void 0:r.name)??null,t.endTimeField=(n==null?void 0:n.name)??null}}const bH=new Set;function RB(t,e){return t&&e?(bH.clear(),fL(bH,t,e),Array.from(bH).sort()):[]}function fL(t,e,i){var r;if(i)if((r=e==null?void 0:e.fields)!=null&&r.length)if(i.includes("*"))for(const{name:n}of e.fields)t.add(n);else for(const n of i)fp(t,e,n);else{if(i.includes("*"))return t.clear(),void t.add("*");for(const n of i)n!=null&&t.add(n)}}function fp(t,e,i){if(typeof i=="string")if(e){const r=e.get(i);r&&t.add(r.name)}else t.add(i)}function hit(t,e){return e==null||t==null?[]:e.includes("*")?(t.fields??[]).map(i=>i.name):e}async function eh(t,e,i){var s;if(!i)return;const{arcadeUtils:r}=await p_(),n=r.extractFieldNames(i,(s=e==null?void 0:e.fields)==null?void 0:s.map(o=>o.name));for(const o of n)fp(t,e,o)}async function bMe(t,e,i){if(i&&i!=="1=1"){const r=await Tse(i,e);if(!r.isStandardized)throw new se("fieldUtils:collectFilterFields","Where clause is not standardized",{where:i});fL(t,e,r.fieldNames)}}function dit({displayField:t,fields:e}){return t||(e!=null&&e.length?wH(e,"name-or-title")||wH(e,"unique-identifier")||wH(e,"type-or-category")||pit(e):null)}function pit(t){for(const e of t){if(!(e!=null&&e.name))continue;const i=e.name.toLowerCase();if(i.includes("name")||i.includes("title"))return e.name}return null}function wH(t,e){for(const i of t)if(i!=null&&i.valueType&&i.valueType===e)return i.name;return null}async function EZt(t,e){var r;if(!e)return;const i=(r=e.elevationInfo)==null?void 0:r.featureExpressionInfo;return i?i.collectRequiredFields(t,e.fieldsIndex):void 0}function fit(t,e,i){i.onStatisticExpression?eh(t,e,i.onStatisticExpression.expression):t.add(i.onStatisticField)}async function CZt(t,e,i){if(!e||!i||!("fields"in i))return;const r=[],n=i.popupTemplate;r.push(mit(t,e,n)),i.fields&&r.push(...i.fields.map(async s=>fit(t,e.fieldsIndex,s))),await Promise.all(r)}async function mit(t,e,i){const r=[];i!=null&&i.expressionInfos&&r.push(...i.expressionInfos.map(s=>eh(t,e.fieldsIndex,s.expression)));const n=i==null?void 0:i.content;if(Array.isArray(n))for(const s of n)s.type==="expression"&&s.expressionInfo&&r.push(eh(t,e.fieldsIndex,s.expressionInfo.expression));await Promise.all(r)}async function AZt(t,e,i){e&&(e.timeInfo&&(i!=null&&i.timeExtent)&&fL(t,e.fieldsIndex,[e.timeInfo.startField,e.timeInfo.endField]),e.floorInfo&&fL(t,e.fieldsIndex,[e.floorInfo.floorField]),(i==null?void 0:i.where)!=null&&await bMe(t,e.fieldsIndex,i.where))}async function MZt(t,e,i){e&&i&&await Promise.all(i.map(r=>git(t,e,r)))}async function git(t,e,i){e&&i&&(i.valueExpression?await eh(t,e.fieldsIndex,i.valueExpression):i.field&&fp(t,e.fieldsIndex,i.field))}function yit(t){return t?RB(t.fieldsIndex,wMe(t)):[]}function vit(t){if(!t)return[];const e=t.geometryFieldsInfo;return e?RB(t.fieldsIndex,[e.shapeAreaField,e.shapeLengthField]):[]}const _it=new Set(["oid","global-id","guid"]),bit=new Set(["oid","global-id"]),wit=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/shape/i,/perimeter/i,/objectid/i,/_i$/i];function xit(t){const e=new Set;xMe(t).forEach(r=>e.add(r)),vit(t).forEach(r=>e.add(r.toLowerCase()));const i=t&&"infoFor3D"in t?t.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach(r=>e.add(r.toLowerCase())),Object.values(i.transformFieldRoles).forEach(r=>e.add(r.toLowerCase()))),Array.from(e)}function wMe(t){if(!t)return[];const e="editFieldsInfo"in t&&t.editFieldsInfo;if(!e)return[];const{creationDateField:i,creatorField:r,editDateField:n,editorField:s}=e;return[i,r,n,s].filter(Boolean)}function xMe(t){return wMe(t).map(e=>e.toLowerCase())}function Sit(t,e){var i;return t.editable&&!_it.has(t.type)&&!xMe(e).includes(((i=t.name)==null?void 0:i.toLowerCase())??"")}function Tit(t,e){var r;const i=((r=t.name)==null?void 0:r.toLowerCase())??"";return!((e==null?void 0:e.objectIdField)!=null&&i===e.objectIdField.toLowerCase()||(e==null?void 0:e.globalIdField)!=null&&i===e.globalIdField.toLowerCase()||xit(e).includes(i)||bit.has(t.type)||wit.some(n=>n.test(i)))}async function OZt(t,e){const{labelingInfo:i,fieldsIndex:r}=e;i!=null&&i.length&&await Promise.all(i.map(n=>Eit(t,r,n)))}async function Eit(t,e,i){if(!i)return;const r=i.getLabelExpression(),n=i.where;if(r.type==="arcade")await eh(t,e,r.expression);else{const s=r.expression.match(/{[^}]*}/g);s&&s.forEach(o=>{fp(t,e,o.slice(1,-1))})}await bMe(t,e,n)}function Cit(t){const e=t.defaultValue;return e!==void 0&&EMe(t,e)?e:t.nullable?null:void 0}function PZt(t){const e=typeof t=="string"?{type:t}:t;return kit(e)?255:e.type==="esriFieldTypeDate"||e.type==="date"?8:void 0}function SMe(t){return typeof t=="number"&&!isNaN(t)&&isFinite(t)}function Ait(t){return t===null||SMe(t)}function Mit(t){return t===null||Number.isInteger(t)}function TMe(t){return t!=null&&typeof t=="string"}function Oit(t){return t===null||TMe(t)}function Pit(){return!0}function EMe(t,e){let i;switch(t.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=t.nullable?Mit:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=t.nullable?Ait:SMe;break;case"string":case"esriFieldTypeString":i=t.nullable?Oit:TMe;break;default:i=Pit}return arguments.length===1?i:i(e)}const Rit=["integer","small-integer","big-integer"],Iit=["single","double"],$it=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeBigInteger"],Lit=["esriFieldTypeSingle","esriFieldTypeDouble"],Dit=new Set([...Rit,...$it]),Nit=new Set([...Iit,...Lit]),Fit=vSe(Dit,Nit);function Cse(t){return t!=null&&Fit.has(t.type)}function kit(t){return t!=null&&(t.type==="string"||t.type==="esriFieldTypeString")}function Ase(t){return t!=null&&(t.type==="date"||t.type==="esriFieldTypeDate")}function zit(t){return t!=null&&(t.type==="date-only"||t.type==="esriFieldTypeDateOnly")}function Uit(t){return t!=null&&(t.type==="timestamp-offset"||t.type==="esriFieldTypeTimestampOffset")}function CMe(t){return t!=null&&(t.type==="time-only"||t.type==="esriFieldTypeTimeOnly")}function dpe(t){return t!=null&&(t.type==="oid"||t.type==="esriFieldTypeOID")}function ppe(t){return t!=null&&(t.type==="global-id"||t.type==="esriFieldTypeGlobalID")}function RZt(t,e){return Vit(t,e)===null}var Vz,Bz;function IZt(t){return t==null||typeof t=="number"&&isNaN(t)?null:t}function Vit(t,e){return t==null||t.nullable&&e===null?null:Cse(t)&&!Bit(t.type,Number(e))?Vz.OUT_OF_RANGE:EMe(t,e)?t.domain?Qtt(t,e):null:Bz.INVALID_TYPE}function Bit(t,e){const i=typeof t=="string"?AMe(t):t;if(!i)return!1;const r=i.min,n=i.max;return i.isInteger?Number.isInteger(e)&&e>=r&&e<=n:e>=r&&e<=n}function AMe(t){switch(t){case"esriFieldTypeSmallInteger":case"small-integer":return jit;case"esriFieldTypeInteger":case"integer":return Git;case"esriFieldTypeBigInteger":case"big-integer":return Hit;case"esriFieldTypeSingle":case"single":return qit;case"esriFieldTypeDouble":case"double":return Wit}}(function(t){t.OUT_OF_RANGE="numeric-range-validation-error::out-of-range"})(Vz||(Vz={})),function(t){t.INVALID_TYPE="type-validation-error::invalid-type"}(Bz||(Bz={}));const jit={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},Git={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Hit={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},qit={min:-34e37,max:12e37,isInteger:!1,rawMin:-34e37,rawMax:12e37},Wit={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function $Zt(t,e,i){switch(t){case XO.INVALID_CODED_VALUE:return`Value ${i} is not in the coded domain - field: ${e.name}, domain: ${JSON.stringify(e.domain)}`;case XO.VALUE_OUT_OF_RANGE:return`Value ${i} is out of the range of valid values - field: ${e.name}, domain: ${JSON.stringify(e.domain)}`;case Bz.INVALID_TYPE:return`Value ${i} is not a valid value for the field type - field: ${e.name}, type: ${e.type}, nullable: ${e.nullable}`;case Vz.OUT_OF_RANGE:{const{min:r,max:n}=AMe(e.type);return`Value ${i} is out of range for the number type - field: ${e.name}, type: ${e.type}, value range is ${r} to ${n}`}}}function LZt(t,e){return!Yit(t,e,null)}function Yit(t,e,i){if(!(e!=null&&e.attributes)||!t){if(i!=null)for(const s of t??[])i.add(s);return!0}const r=new Set(Object.keys(e.attributes));let n=!1;for(const s of t)if(!r.has(s)){if(n=!0,i==null)break;i.add(s)}return n}function Xit(t){return!!t&&["raster.itempixelvalue","raster.servicepixelvalue"].some(e=>t.toLowerCase().startsWith(e))}let S7=class extends Ue{constructor(e){super(e),this.type=null}};y([w({type:["attachments","custom","fields","media","text","expression","relationship"],readOnly:!0,json:{read:!1,write:!0}})],S7.prototype,"type",void 0),S7=y([Z("esri.popup.content.Content")],S7);const rx=S7;var eJ;let p3=eJ=class extends rx{constructor(t){super(t),this.description=null,this.displayType="auto",this.title=null,this.type="attachments"}clone(){return new eJ({description:this.description,displayType:this.displayType,title:this.title})}};y([w({type:String,json:{write:!0}})],p3.prototype,"description",void 0),y([w({type:["auto","preview","list"],json:{write:!0}})],p3.prototype,"displayType",void 0),y([w({type:String,json:{write:!0}})],p3.prototype,"title",void 0),y([w({type:["attachments"],readOnly:!0,json:{read:!1,write:!0}})],p3.prototype,"type",void 0),p3=eJ=y([Z("esri.popup.content.AttachmentsContent")],p3);const mL=p3;var tJ;let f3=tJ=class extends rx{constructor(t){super(t),this.creator=null,this.destroyer=null,this.outFields=null,this.type="custom"}clone(){return new tJ({creator:this.creator,destroyer:this.destroyer,outFields:Array.isArray(this.outFields)?Re(this.outFields):null})}};y([w()],f3.prototype,"creator",void 0),y([w()],f3.prototype,"destroyer",void 0),y([w()],f3.prototype,"outFields",void 0),y([w({type:["custom"],readOnly:!0})],f3.prototype,"type",void 0),f3=tJ=y([Z("esri.popup.content.CustomContent")],f3);const Zit=f3;var iJ;let hA=iJ=class extends Ue{constructor(t){super(t),this.title=null,this.expression=null,this.returnType="dictionary"}clone(){return new iJ({title:this.title,expression:this.expression})}};y([w({type:String,json:{write:!0}})],hA.prototype,"title",void 0),y([w({type:String,json:{write:!0}})],hA.prototype,"expression",void 0),y([w({type:["dictionary"],readOnly:!0,json:{read:!1,write:!0}})],hA.prototype,"returnType",void 0),hA=iJ=y([Z("esri.popup.ElementExpressionInfo")],hA);const Jit=hA;var rJ;let t4=rJ=class extends rx{constructor(t){super(t),this.expressionInfo=null,this.type="expression"}clone(){var t;return new rJ({expressionInfo:(t=this.expressionInfo)==null?void 0:t.clone()})}};y([w({type:Jit,json:{write:!0}})],t4.prototype,"expressionInfo",void 0),y([w({type:["expression"],readOnly:!0,json:{read:!1,write:!0}})],t4.prototype,"type",void 0),t4=rJ=y([Z("esri.popup.content.ExpressionContent")],t4);const Mse=t4;function Vt(t,e={}){const i=t instanceof yn?t:new yn(t,e),r={type:(e==null?void 0:e.ignoreUnknown)??1?i.apiValues:String,json:{type:i.jsonValues,read:!(e!=null&&e.readOnly)&&{reader:i.read},write:{writer:i.write}}};return(e==null?void 0:e.readOnly)!==void 0&&(r.readOnly=!!e.readOnly),(e==null?void 0:e.default)!==void 0&&(r.json.default=e.default),(e==null?void 0:e.name)!==void 0&&(r.json.name=e.name),(e==null?void 0:e.nonNullable)!==void 0&&(r.nonNullable=e.nonNullable),w(r)}let dA=class extends Xs(Ue){constructor(e){super(e),this.dateFormat=null,this.digitSeparator=!1,this.places=null}};y([Vt(XWe)],dA.prototype,"dateFormat",void 0),y([w({type:Boolean,json:{write:!0}})],dA.prototype,"digitSeparator",void 0),y([w({type:$n,json:{write:!0}})],dA.prototype,"places",void 0),dA=y([Z("esri.popup.support.FieldInfoFormat")],dA);const T7=dA;var nJ;let C0=nJ=class extends Ue{constructor(t){super(t),this.fieldName=null,this.format=null,this.isEditable=!0,this.label=null,this.stringFieldOption="text-box",this.statisticType=null,this.tooltip=null,this.visible=!0}clone(){return new nJ({fieldName:this.fieldName,format:this.format?Re(this.format):null,isEditable:this.isEditable,label:this.label,stringFieldOption:this.stringFieldOption,statisticType:this.statisticType,tooltip:this.tooltip,visible:this.visible})}};y([w({type:String,json:{write:!0}})],C0.prototype,"fieldName",void 0),y([w({type:T7,json:{write:!0}})],C0.prototype,"format",void 0),y([w({type:Boolean,json:{write:{alwaysWriteDefaults:!0},default:!0}})],C0.prototype,"isEditable",void 0),y([w({type:String,json:{write:!0}})],C0.prototype,"label",void 0),y([Vt(new yn({richtext:"rich-text",textarea:"text-area",textbox:"text-box"}),{default:"text-box"})],C0.prototype,"stringFieldOption",void 0),y([w({type:["count","sum","min","max","avg","stddev","var"],json:{write:!0}})],C0.prototype,"statisticType",void 0),y([w({type:String,json:{write:!0}})],C0.prototype,"tooltip",void 0),y([w({type:Boolean,json:{write:!0}})],C0.prototype,"visible",void 0),C0=nJ=y([Z("esri.popup.FieldInfo")],C0);const Ose=C0;var sJ;let V1=sJ=class extends rx{constructor(t){super(t),this.attributes=null,this.description=null,this.fieldInfos=null,this.title=null,this.type="fields"}writeFieldInfos(t,e){e.fieldInfos=t&&t.map(i=>i.toJSON())}clone(){return new sJ(Re({attributes:this.attributes,description:this.description,fieldInfos:this.fieldInfos,title:this.title}))}};y([w({type:Object,json:{write:!0}})],V1.prototype,"attributes",void 0),y([w({type:String,json:{write:!0}})],V1.prototype,"description",void 0),y([w({type:[Ose]})],V1.prototype,"fieldInfos",void 0),y([Pt("fieldInfos")],V1.prototype,"writeFieldInfos",null),y([w({type:String,json:{write:!0}})],V1.prototype,"title",void 0),y([w({type:["fields"],readOnly:!0,json:{read:!1,write:!0}})],V1.prototype,"type",void 0),V1=sJ=y([Z("esri.popup.content.FieldsContent")],V1);const gL=V1;let m3=class extends Ue{constructor(e){super(e),this.altText=null,this.caption="",this.title="",this.type=null}};y([w({type:String,json:{write:!0}})],m3.prototype,"altText",void 0),y([w({type:String,json:{write:!0}})],m3.prototype,"caption",void 0),y([w({type:String,json:{write:!0}})],m3.prototype,"title",void 0),y([w({type:["image","bar-chart","column-chart","line-chart","pie-chart"],readOnly:!0,json:{read:!1,write:!0}})],m3.prototype,"type",void 0),m3=y([Z("esri.popup.content.mixins.MediaInfo")],m3);const Pse=m3;function H6(t){return Je(ene(t),0,255)}function q6(t,e,i){return t=Number(t),isNaN(t)?i:ti?i:t}function W6(t,e){const i=t.toString(16).padStart(2,"0");return e?i.substring(0,1):i}let E7=class hl{static blendColors(e,i,r,n=new hl){return n.r=Math.round(e.r+(i.r-e.r)*r),n.g=Math.round(e.g+(i.g-e.g)*r),n.b=Math.round(e.b+(i.b-e.b)*r),n.a=e.a+(i.a-e.a)*r,n._sanitize()}static fromRgb(e,i){const r=e.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/);if(r){const n=r[2].split(/\s*,\s*/),s=r[1];if(s==="rgb"&&n.length===3||s==="rgba"&&n.length===4){const o=n[0];if(o.charAt(o.length-1)==="%"){const l=n.map(c=>2.56*parseFloat(c));return n.length===4&&(l[3]=parseFloat(n[3])),hl.fromArray(l,i)}return hl.fromArray(n.map(l=>parseFloat(l)),i)}if(s==="hsl"&&n.length===3||s==="hsla"&&n.length===4)return hl.fromArray(GAe(parseFloat(n[0]),parseFloat(n[1])/100,parseFloat(n[2])/100,parseFloat(n[3])),i)}return null}static fromHex(e,i=new hl){if(e[0]!=="#"||isNaN(+`0x${e.substring(1)}`))return null;switch(e.length){case 4:case 5:{const r=parseInt(e.substring(1,2),16),n=parseInt(e.substring(2,3),16),s=parseInt(e.substring(3,4),16),o=e.length===5?15:parseInt(e.substring(4),16);return hl.fromArray([r+16*r,n+16*n,s+16*s,(o+16*o)/255],i)}case 7:case 9:{const r=parseInt(e.substring(1,3),16),n=parseInt(e.substring(3,5),16),s=parseInt(e.substring(5,7),16),o=e.length===7?255:parseInt(e.substring(7),16);return hl.fromArray([r,n,s,o/255],i)}default:return null}}static fromArray(e,i=new hl){return i._set(Number(e[0]),Number(e[1]),Number(e[2]),Number(e[3])),isNaN(i.a)&&(i.a=1),i._sanitize()}static fromString(e,i){const r=jAe(e)?mse(e):null;return r&&hl.fromArray(r,i)||hl.fromRgb(e,i)||hl.fromHex(e,i)}static fromJSON(e){return e!=null?new hl([e[0],e[1],e[2],(e[3]??255)/255]):void 0}static toUnitRGB(e){return e!=null?[e.r/255,e.g/255,e.b/255]:null}static toUnitRGBA(e){return e!=null?[e.r/255,e.g/255,e.b/255,e.a!=null?e.a:1]:null}constructor(e){this.r=255,this.g=255,this.b=255,this.a=1,e&&this.setColor(e)}get isBright(){return .299*this.r+.587*this.g+.114*this.b>=127}setColor(e){return typeof e=="string"?hl.fromString(e,this):Array.isArray(e)?hl.fromArray(e,this):(this._set(e.r??0,e.g??0,e.b??0,e.a??1),e instanceof hl||this._sanitize()),this}toRgb(){return[this.r,this.g,this.b]}toRgba(){return[this.r,this.g,this.b,this.a]}toHex(e){const i=(e==null?void 0:e.capitalize)??!1,r=(e==null?void 0:e.digits)??6,n=r===3||r===4,s=r===4||r===8,o=`#${W6(this.r,n)}${W6(this.g,n)}${W6(this.b,n)}${s?W6(Math.round(255*this.a),n):""}`;return i?o.toUpperCase():o}toCss(e=!1){const i=this.r+", "+this.g+", "+this.b;return e?`rgba(${i}, ${this.a})`:`rgb(${i})`}toString(){return this.toCss(!0)}toJSON(){return this.toArray()}toArray(e=hl.AlphaMode.ALWAYS){const i=H6(this.r),r=H6(this.g),n=H6(this.b);return e===hl.AlphaMode.ALWAYS||this.a!==1?[i,r,n,H6(255*this.a)]:[i,r,n]}clone(){return new hl(this.toRgba())}hash(){return this.r<<24|this.g<<16|this.b<<8|255*this.a}equals(e){return e!=null&&e.r===this.r&&e.g===this.g&&e.b===this.b&&e.a===this.a}_sanitize(){return this.r=Math.round(q6(this.r,0,255)),this.g=Math.round(q6(this.g,0,255)),this.b=Math.round(q6(this.b,0,255)),this.a=q6(this.a,0,1),this}_set(e,i,r,n){this.r=e,this.g=i,this.b=r,this.a=n}};E7.prototype.declaredClass="esri.Color",function(t){var e;(e=t.AlphaMode||(t.AlphaMode={}))[e.ALWAYS=0]="ALWAYS",e[e.UNLESS_OPAQUE=1]="UNLESS_OPAQUE"}(E7||(E7={}));const qe=E7;var oJ;let g3=oJ=class extends ze{constructor(t){super(t),this.color=null,this.fieldName=null,this.tooltip=null,this.value=null}clone(){return new oJ({fieldName:this.fieldName,tooltip:this.tooltip,value:this.value})}};y([w()],g3.prototype,"color",void 0),y([w()],g3.prototype,"fieldName",void 0),y([w()],g3.prototype,"tooltip",void 0),y([w()],g3.prototype,"value",void 0),g3=oJ=y([Z("esri.popup.content.support.ChartMediaInfoValueSeries")],g3);const Kit=g3;var aJ;let Bb=aJ=class extends Ue{constructor(t){super(t),this.colors=null,this.fields=[],this.normalizeField=null,this.series=[],this.tooltipField=null}clone(){return new aJ({colors:Re(this.colors),fields:Re(this.fields),normalizeField:this.normalizeField,tooltipField:this.tooltipField})}};y([w({type:[qe],json:{type:[[$n]],write:!0}})],Bb.prototype,"colors",void 0),y([w({type:[String],json:{write:!0}})],Bb.prototype,"fields",void 0),y([w({type:String,json:{write:!0}})],Bb.prototype,"normalizeField",void 0),y([w({type:[Kit],json:{read:!1}})],Bb.prototype,"series",void 0),y([w({type:String,json:{write:!0}})],Bb.prototype,"tooltipField",void 0),Bb=aJ=y([Z("esri.popup.content.support.ChartMediaInfoValue")],Bb);const Qit=Bb;let i4=class extends Pse{constructor(e){super(e),this.type=null,this.value=null}};y([w({type:["bar-chart","column-chart","line-chart","pie-chart"],readOnly:!0,json:{read:!1,write:!0}})],i4.prototype,"type",void 0),y([w({type:Qit,json:{write:!0}})],i4.prototype,"value",void 0),i4=y([Z("esri.popup.content.mixins.ChartMediaInfo")],i4);const IB=i4,$B=fu()({barchart:"bar-chart",columnchart:"column-chart",linechart:"line-chart",piechart:"pie-chart"});var lJ;let C7=lJ=class extends IB{constructor(t){super(t),this.type="bar-chart"}clone(){return new lJ({altText:this.altText,title:this.title,caption:this.caption,value:this.value?this.value.clone():null})}};y([w({type:["bar-chart"],readOnly:!0,json:{type:["barchart"],read:!1,write:$B.write}})],C7.prototype,"type",void 0),C7=lJ=y([Z("esri.popup.content.BarChartMediaInfo")],C7);const MMe=C7;var cJ;let A7=cJ=class extends IB{constructor(t){super(t),this.type="column-chart"}clone(){return new cJ({altText:this.altText,title:this.title,caption:this.caption,value:this.value?this.value.clone():null})}};y([w({type:["column-chart"],readOnly:!0,json:{type:["columnchart"],read:!1,write:$B.write}})],A7.prototype,"type",void 0),A7=cJ=y([Z("esri.popup.content.ColumnChartMediaInfo")],A7);const OMe=A7;var uJ;let r4=uJ=class extends Ue{constructor(t){super(t),this.linkURL=null,this.sourceURL=null}clone(){return new uJ({linkURL:this.linkURL,sourceURL:this.sourceURL})}};y([w({type:String,json:{write:!0}})],r4.prototype,"linkURL",void 0),y([w({type:String,json:{write:!0}})],r4.prototype,"sourceURL",void 0),r4=uJ=y([Z("esri.popup.content.support.ImageMediaInfoValue")],r4);const ert=r4;var hJ;let pA=hJ=class extends Pse{constructor(t){super(t),this.refreshInterval=null,this.type="image",this.value=null}clone(){return new hJ({altText:this.altText,title:this.title,caption:this.caption,refreshInterval:this.refreshInterval,value:this.value?this.value.clone():null})}};y([w({type:Number,json:{write:!0}})],pA.prototype,"refreshInterval",void 0),y([w({type:["image"],readOnly:!0,json:{read:!1,write:!0}})],pA.prototype,"type",void 0),y([w({type:ert,json:{write:!0}})],pA.prototype,"value",void 0),pA=hJ=y([Z("esri.popup.content.ImageMediaInfo")],pA);const PMe=pA;var dJ;let M7=dJ=class extends IB{constructor(t){super(t),this.type="line-chart"}clone(){return new dJ({altText:this.altText,title:this.title,caption:this.caption,value:this.value?this.value.clone():null})}};y([w({type:["line-chart"],readOnly:!0,json:{type:["linechart"],read:!1,write:$B.write}})],M7.prototype,"type",void 0),M7=dJ=y([Z("esri.popup.content.LineChartMediaInfo")],M7);const RMe=M7;var pJ;let O7=pJ=class extends IB{constructor(t){super(t),this.type="pie-chart"}clone(){return new pJ({altText:this.altText,title:this.title,caption:this.caption,value:this.value?this.value.clone():null})}};y([w({type:["pie-chart"],readOnly:!0,json:{type:["piechart"],read:!1,write:$B.write}})],O7.prototype,"type",void 0),O7=pJ=y([Z("esri.popup.content.PieChartMediaInfo")],O7);const IMe=O7,$Me={base:Pse,key:"type",defaultKeyValue:"image",typeMap:{"bar-chart":MMe,"column-chart":OMe,"line-chart":RMe,"pie-chart":IMe,image:PMe}};var fJ;let A0=fJ=class extends rx{constructor(t){super(t),this.activeMediaInfoIndex=null,this.attributes=null,this.description=null,this.mediaInfos=null,this.title=null,this.type="media"}readMediaInfos(t){return t&&t.map(e=>e.type==="image"?PMe.fromJSON(e):e.type==="barchart"?MMe.fromJSON(e):e.type==="columnchart"?OMe.fromJSON(e):e.type==="linechart"?RMe.fromJSON(e):e.type==="piechart"?IMe.fromJSON(e):void 0).filter(Boolean)}writeMediaInfos(t,e){e.mediaInfos=t&&t.map(i=>i.toJSON())}clone(){return new fJ(Re({activeMediaInfoIndex:this.activeMediaInfoIndex,attributes:this.attributes,description:this.description,mediaInfos:this.mediaInfos,title:this.title}))}};y([w()],A0.prototype,"activeMediaInfoIndex",void 0),y([w({type:Object,json:{write:!0}})],A0.prototype,"attributes",void 0),y([w({type:String,json:{write:!0}})],A0.prototype,"description",void 0),y([w({types:[$Me]})],A0.prototype,"mediaInfos",void 0),y([$t("mediaInfos")],A0.prototype,"readMediaInfos",null),y([Pt("mediaInfos")],A0.prototype,"writeMediaInfos",null),y([w({type:String,json:{write:!0}})],A0.prototype,"title",void 0),y([w({type:["media"],readOnly:!0,json:{read:!1,write:!0}})],A0.prototype,"type",void 0),A0=fJ=y([Z("esri.popup.content.MediaContent")],A0);const jz=A0;var mJ;let n4=mJ=class extends Ue{constructor(t){super(t),this.field=null,this.order=null}clone(){return new mJ({field:this.field,order:this.order})}};y([w({type:String,json:{write:!0}})],n4.prototype,"field",void 0),y([w({type:["asc","desc"],json:{write:!0}})],n4.prototype,"order",void 0),n4=mJ=y([Z("esri.popup.support.RelatedRecordsInfoFieldOrder")],n4);const LMe=n4;let wg=class extends Xs(rx){constructor(e){super(e),this.description=null,this.displayCount=null,this.displayType="list",this.orderByFields=null,this.relationshipId=null,this.title=null,this.type="relationship"}};y([w({type:String,json:{write:!0}})],wg.prototype,"description",void 0),y([w({type:Number,json:{type:$n,write:!0}})],wg.prototype,"displayCount",void 0),y([w({type:["list"],json:{write:!0}})],wg.prototype,"displayType",void 0),y([w({type:[LMe],json:{write:!0}})],wg.prototype,"orderByFields",void 0),y([w({type:Number,json:{type:$n,write:!0}})],wg.prototype,"relationshipId",void 0),y([w({type:String,json:{write:!0}})],wg.prototype,"title",void 0),y([w({type:["relationship"],readOnly:!0,json:{read:!1,write:!0}})],wg.prototype,"type",void 0),wg=y([Z("esri.popup.content.RelationshipContent")],wg);const Gz=wg;var gJ;let s4=gJ=class extends rx{constructor(t){super(t),this.text=null,this.type="text"}clone(){return new gJ({text:this.text})}};y([w({type:String,json:{write:!0}})],s4.prototype,"text",void 0),y([w({type:["text"],readOnly:!0,json:{read:!1,write:!0}})],s4.prototype,"type",void 0),s4=gJ=y([Z("esri.popup.content.TextContent")],s4);const Hz=s4,trt={base:null,key:"type",typeMap:{attachment:mL,media:jz,text:Hz,expression:Mse,field:gL,relationship:Gz}};var yJ;let y3=yJ=class extends Ue{constructor(t){super(t),this.name=null,this.title=null,this.expression=null,this.returnType=null}clone(){return new yJ({name:this.name,title:this.title,expression:this.expression,returnType:this.returnType})}};y([w({type:String,json:{write:!0}})],y3.prototype,"name",void 0),y([w({type:String,json:{write:!0}})],y3.prototype,"title",void 0),y([w({type:String,json:{write:!0}})],y3.prototype,"expression",void 0),y([w({type:["string","number"],json:{write:!0}})],y3.prototype,"returnType",void 0),y3=yJ=y([Z("esri.popup.ExpressionInfo")],y3);const irt=y3;var vJ;let o4=vJ=class extends Ue{constructor(t){super(t),this.returnTopmostRaster=null,this.showNoDataRecords=null}clone(){return new vJ({showNoDataRecords:this.showNoDataRecords,returnTopmostRaster:this.returnTopmostRaster})}};y([w({type:Boolean,json:{write:!0}})],o4.prototype,"returnTopmostRaster",void 0),y([w({type:Boolean,json:{write:!0}})],o4.prototype,"showNoDataRecords",void 0),o4=vJ=y([Z("esri.popup.LayerOptions")],o4);const rrt=o4;var _J;let a4=_J=class extends Ue{constructor(t){super(t),this.showRelatedRecords=null,this.orderByFields=null}clone(){return new _J({showRelatedRecords:this.showRelatedRecords,orderByFields:this.orderByFields?Re(this.orderByFields):null})}};y([w({type:Boolean,json:{write:!0}})],a4.prototype,"showRelatedRecords",void 0),y([w({type:[LMe],json:{write:!0}})],a4.prototype,"orderByFields",void 0),a4=_J=y([Z("esri.popup.RelatedRecordsInfo")],a4);const nrt=a4;var bJ;let jp=bJ=class extends I_(ze){constructor(t){super(t),this.active=!1,this.className=null,this.disabled=!1,this.icon=null,this.id=null,this.indicator=!1,this.title=null,this.type=null,this.visible=!0}clone(){return new bJ({active:this.active,className:this.className,disabled:this.disabled,icon:this.icon,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible})}};y([w()],jp.prototype,"active",void 0),y([w()],jp.prototype,"className",void 0),y([w()],jp.prototype,"disabled",void 0),y([w()],jp.prototype,"icon",void 0),y([w()],jp.prototype,"id",void 0),y([w()],jp.prototype,"indicator",void 0),y([w()],jp.prototype,"title",void 0),y([w()],jp.prototype,"type",void 0),y([w()],jp.prototype,"visible",void 0),jp=bJ=y([Z("esri.support.actions.ActionBase")],jp);const lP=jp;var wJ;let P7=wJ=class extends lP{constructor(t){super(t),this.image=null,this.type="button"}clone(){return new wJ({active:this.active,className:this.className,disabled:this.disabled,icon:this.icon,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible,image:this.image})}};y([w()],P7.prototype,"image",void 0),P7=wJ=y([Z("esri.support.Action.ActionButton")],P7);const cP=P7;var xJ;let l4=xJ=class extends lP{constructor(t){super(t),this.image=null,this.type="toggle",this.value=!1}clone(){return new xJ({active:this.active,className:this.className,disabled:this.disabled,icon:this.icon,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible,image:this.image,value:this.value})}};y([w()],l4.prototype,"image",void 0),y([w()],l4.prototype,"value",void 0),l4=xJ=y([Z("esri.support.Action.ActionToggle")],l4);const LB=l4,srt="esri.PopupTemplate",ort=Ce.getLogger(srt),GP="relationships/",fpe="expression/",art=it.ofType({key:"type",defaultKeyValue:"button",base:lP,typeMap:{button:cP,toggle:LB}}),lrt={base:rx,key:"type",typeMap:{media:jz,custom:Zit,text:Hz,attachments:mL,fields:gL,expression:Mse,relationship:Gz}},crt=new Set(["attachments","fields","media","text","expression","relationship"]);let dl=class extends Xs(Ue){constructor(){super(...arguments),this.actions=null,this.content="",this.expressionInfos=null,this.fieldInfos=null,this.layerOptions=null,this.lastEditInfoEnabled=!0,this.outFields=null,this.overwriteActions=!1,this.returnGeometry=!1,this.title=""}castContent(e){return Array.isArray(e)?e.map(i=>zy(lrt,i)):typeof e=="string"||typeof e=="function"||e instanceof HTMLElement||pd(e)?e:(ort.error("content error","unsupported content value",{value:e}),null)}readContent(e,i){const{popupElements:r}=i;return Array.isArray(r)&&r.length>0?this._readPopupInfoElements(i.description,i.mediaInfos,r):this._readPopupInfo(i)}writeContent(e,i,r,n){typeof e!="string"?Array.isArray(e)&&(i.popupElements=e.filter(s=>crt.has(s.type)).map(s=>s==null?void 0:s.toJSON(n)),i.popupElements.forEach(s=>{s.type==="attachments"?this._writeAttachmentContent(i):s.type==="media"?this._writeMediaContent(s,i):s.type==="text"?this._writeTextContent(s,i):s.type==="relationship"&&this._writeRelationshipContent(s,i)})):i.description=e}writeFieldInfos(e,i,r,n){const{content:s}=this,o=Array.isArray(s)?s:null;if(e){const l=o?o.filter(f=>f.type==="fields"):[],c=l.length&&l.every(f=>{var _;return(_=f.fieldInfos)==null?void 0:_.length});i.fieldInfos=e.filter(Boolean).map(f=>{const _=f.toJSON(n);return c&&(_.visible=!1),_})}if(o)for(const l of o)l.type==="fields"&&this._writeFieldsContent(l,i)}writeLayerOptions(e,i,r,n){i[r]=!e||e.showNoDataRecords===null&&e.returnTopmostRaster===null?null:e.toJSON(n)}writeTitle(e,i){i.title=e||""}async collectRequiredFields(e,i){const r=this.expressionInfos||[];await this._collectExpressionInfoFields(e,i,[...r,...this._getContentExpressionInfos(this.content,r)]),fL(e,i,[...this.outFields||[],...this._getActionsFields(this.actions),...this._getTitleFields(this.title),...this._getContentFields(this.content)])}async getRequiredFields(e){const i=new Set;return await this.collectRequiredFields(i,e),[...i].sort()}_writeFieldsContent(e,i){if(!Array.isArray(e.fieldInfos)||!e.fieldInfos.length)return;const r=Re(e.fieldInfos);Array.isArray(i.fieldInfos)?r.forEach(n=>{const s=i.fieldInfos.find(o=>o.fieldName.toLowerCase()===n.fieldName.toLowerCase());s?s.visible=!0:i.fieldInfos.push(n)}):i.fieldInfos=r}_writeAttachmentContent(e){e.showAttachments||(e.showAttachments=!0)}_writeRelationshipContent(e,i){var s,o;const r=((s=e.orderByFields)==null?void 0:s.map(l=>this._toFieldOrderJSON(l,e.relationshipId)))||[],n=[...((o=i.relatedRecordsInfo)==null?void 0:o.orderByFields)||[],...r];i.relatedRecordsInfo={showRelatedRecords:!0,...(n==null?void 0:n.length)&&{orderByFields:n}}}_writeTextContent(e,i){!i.description&&e.text&&(i.description=e.text)}_writeMediaContent(e,i){if(!Array.isArray(e.mediaInfos)||!e.mediaInfos.length)return;const r=Re(e.mediaInfos);Array.isArray(i.mediaInfos)?i.mediaInfos=[...i.mediaInfos,...r]:i.mediaInfos=r}_readPopupInfoElements(e,i,r){const n={description:!1,mediaInfos:!1};return r.map(s=>s.type==="media"?(s.mediaInfos||!i||n.mediaInfos||(s.mediaInfos=i,n.mediaInfos=!0),jz.fromJSON(s)):s.type==="text"?(s.text||!e||n.description||(s.text=e,n.description=!0),Hz.fromJSON(s)):s.type==="attachments"?mL.fromJSON(s):s.type==="fields"?gL.fromJSON(s):s.type==="expression"?Mse.fromJSON(s):s.type==="relationship"?Gz.fromJSON(s):void 0).filter(Boolean)}_toRelationshipContent(e){const{field:i,order:r}=e;if(!(i!=null&&i.startsWith(GP)))return null;const n=i.replace(GP,"").split("/");if(n.length!==2)return null;const s=parseInt(n[0],10),o=n[1];return typeof s=="number"&&o?Gz.fromJSON({relationshipId:s,orderByFields:[{field:o,order:r}]}):null}_toFieldOrderJSON(e,i){const{order:r,field:n}=e;return{field:`${GP}${i}/${n}`,order:r}}_readPopupInfo({description:e,mediaInfos:i,showAttachments:r,relatedRecordsInfo:n={showRelatedRecords:!1}}){const s=[];e?s.push(new Hz({text:e})):s.push(new gL),Array.isArray(i)&&i.length&&s.push(jz.fromJSON({mediaInfos:i})),r&&s.push(mL.fromJSON({displayType:"auto"}));const{showRelatedRecords:o,orderByFields:l}=n;return o&&(l!=null&&l.length)&&l.forEach(c=>{const f=this._toRelationshipContent(c);f&&s.push(f)}),s.length?s:e}_getContentElementFields(e){const i=e==null?void 0:e.type;if(i==="attachments")return[...this._extractFieldNames(e.title),...this._extractFieldNames(e.description)];if(i==="custom")return e.outFields||[];if(i==="fields")return[...this._extractFieldNames(e.title),...this._extractFieldNames(e.description),...this._getFieldInfoFields(e.fieldInfos??this.fieldInfos)];if(i==="media"){const r=e.mediaInfos||[];return[...this._extractFieldNames(e.title),...this._extractFieldNames(e.description),...r.reduce((n,s)=>[...n,...this._getMediaInfoFields(s)],[])]}return i==="text"?this._extractFieldNames(e.text):[]}_getMediaInfoFields(e){const{caption:i,title:r,value:n}=e,s=n||{},{fields:o,normalizeField:l,tooltipField:c,sourceURL:f,linkURL:_}=s,x=[...this._extractFieldNames(r),...this._extractFieldNames(i),...this._extractFieldNames(f),...this._extractFieldNames(_),...o??[]];return l&&x.push(l),c&&x.push(c),x}_getContentExpressionInfos(e,i){return Array.isArray(e)?e.reduce((r,n)=>[...r,...n.type==="expression"&&n.expressionInfo?[n.expressionInfo]:[]],i):[]}_getContentFields(e){return typeof e=="string"?this._extractFieldNames(e):Array.isArray(e)?e.reduce((i,r)=>[...i,...this._getContentElementFields(r)],[]):[]}async _collectExpressionInfoFields(e,i,r){r&&await Promise.all(r.map(n=>eh(e,i,n.expression)))}_getFieldInfoFields(e){return e?e.filter(i=>i.visible===void 0||!!i.visible).map(i=>i.fieldName).filter(i=>!i.startsWith(GP)&&!i.startsWith(fpe)):[]}_getActionsFields(e){return e?e.toArray().reduce((i,r)=>[...i,...this._getActionFields(r)],[]):[]}_getActionFields(e){const{className:i,title:r,type:n}=e,s=n==="button"||n==="toggle"?e.image:"";return[...this._extractFieldNames(r),...this._extractFieldNames(i),...this._extractFieldNames(s)]}_getTitleFields(e){return typeof e=="string"?this._extractFieldNames(e):[]}_extractFieldNames(e){if(!e||typeof e!="string")return[];const i=/{[^}]*}/g,r=e.match(i);if(!r)return[];const n=/\{(\w+):.+\}/,s=r.filter(o=>!(o.indexOf(`{${GP}`)===0||o.indexOf(`{${fpe}`)===0)).map(o=>o.replace(n,"{$1}"));return s?s.map(o=>o.slice(1,-1)):[]}};y([w({type:art})],dl.prototype,"actions",void 0),y([w()],dl.prototype,"content",void 0),y([Ci("content")],dl.prototype,"castContent",null),y([$t("content",["description","fieldInfos","popupElements","mediaInfos","showAttachments","relatedRecordsInfo"])],dl.prototype,"readContent",null),y([Pt("content",{popupElements:{type:it.ofType(trt)},showAttachments:{type:Boolean},mediaInfos:{type:it.ofType($Me)},description:{type:String},relatedRecordsInfo:{type:nrt}})],dl.prototype,"writeContent",null),y([w({type:[irt],json:{write:!0}})],dl.prototype,"expressionInfos",void 0),y([w({type:[Ose]})],dl.prototype,"fieldInfos",void 0),y([Pt("fieldInfos")],dl.prototype,"writeFieldInfos",null),y([w({type:rrt})],dl.prototype,"layerOptions",void 0),y([Pt("layerOptions")],dl.prototype,"writeLayerOptions",null),y([w({type:Boolean,json:{read:{source:"showLastEditInfo"},write:{target:"showLastEditInfo"},default:!0}})],dl.prototype,"lastEditInfoEnabled",void 0),y([w()],dl.prototype,"outFields",void 0),y([w()],dl.prototype,"overwriteActions",void 0),y([w()],dl.prototype,"returnGeometry",void 0),y([w({json:{type:String}})],dl.prototype,"title",void 0),y([Pt("title")],dl.prototype,"writeTitle",null),dl=y([Z("esri.PopupTemplate")],dl);const hE=dl,mpe=new yn({esriSMS:"simple-marker",esriPMS:"picture-marker",esriSLS:"simple-line",esriSFS:"simple-fill",esriPFS:"picture-fill",esriTS:"text",esriSHD:"shield-label-symbol",PointSymbol3D:"point-3d",LineSymbol3D:"line-3d",PolygonSymbol3D:"polygon-3d",WebStyleSymbol:"web-style",MeshSymbol3D:"mesh-3d",LabelSymbol3D:"label-3d",CIMSymbolReference:"cim"});let urt=0,fA=class extends Ue{constructor(e){super(e),this.id="sym"+urt++,this.type=null,this.color=new qe([0,0,0,1])}readColor(e){return(e==null?void 0:e[0])!=null?[e[0],e[1],e[2],e[3]/255]:e}async collectRequiredFields(e,i){}hash(){return JSON.stringify(this.toJSON())}clone(){}};y([w({type:mpe.apiValues,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:mpe.write}}})],fA.prototype,"type",void 0),y([w({type:qe,json:{write:{allowNull:!0}}})],fA.prototype,"color",void 0),y([$t("color")],fA.prototype,"readColor",null),fA=y([Z("esri.symbols.Symbol")],fA);const fd=fA;var SJ;let jb=SJ=class extends fd{constructor(t){super(t),this.data=null,this.type="cim"}readData(t,e){return e}writeData(t,e){Object.assign(e,t)}async collectRequiredFields(t,e){var i;if(((i=this.data)==null?void 0:i.type)==="CIMSymbolReference"){const r=this.data.primitiveOverrides;if(r){const n=r.map(s=>{const o=s.valueExpressionInfo;return eh(t,e,o.expression)});await Promise.all(n)}}}clone(){return new SJ({data:Re(this.data)})}hash(){return Zre(JSON.stringify(this.data)).toString()}};y([w({json:{write:!1}})],jb.prototype,"color",void 0),y([w({json:{write:!0}})],jb.prototype,"data",void 0),y([$t("data",["symbol"])],jb.prototype,"readData",null),y([Pt("data",{})],jb.prototype,"writeData",null),y([Vt({CIMSymbolReference:"cim"},{readOnly:!0})],jb.prototype,"type",void 0),jb=SJ=y([Z("esri.symbols.CIMSymbol")],jb);const nx=jb;let mA=class extends Ue{constructor(e){super(e),this.enabled=!0,this.type=null,this.ignoreDrivers=!1}writeEnabled(e,i,r){e||(i[r]=e)}};y([w({type:Boolean,json:{read:{source:"enable"},write:{target:"enable"}}})],mA.prototype,"enabled",void 0),y([Pt("enabled")],mA.prototype,"writeEnabled",null),y([w({type:["icon","object","line","path","fill","water","extrude","text"],readOnly:!0})],mA.prototype,"type",void 0),mA=y([Z("esri.symbols.Symbol3DLayer")],mA);const o1=mA;function DB(t){const e=ene(100*(1-t));return Math.max(0,Math.min(e,100))}function jT(t){const e=1-t/100;return Math.max(0,Math.min(e,1))}function hrt(t,e){const i=e.transparency!=null?jT(e.transparency):1,r=e.color;return r&&Array.isArray(r)?new qe([r[0]||0,r[1]||0,r[2]||0,i]):null}function drt(t,e){e.color=t.toJSON().slice(0,3);const i=DB(t.a);i!==0&&(e.transparency=i)}const $_={type:qe,json:{type:[$n],default:null,read:{source:["color","transparency"],reader:hrt},write:{target:{color:{type:[$n]},transparency:{type:$n}},writer:drt}}},Gy={type:Number,cast:vs,json:{write:!0}};let v3=class extends Ue{constructor(e){super(e),this.color=new qe([0,0,0,1]),this.extensionLength=0,this.size=ad(1)}clone(){}cloneProperties(){return{color:Re(this.color),size:this.size,extensionLength:this.extensionLength}}};y([w({type:["solid","sketch"],readOnly:!0,json:{read:!0,write:{ignoreOrigin:!0}}})],v3.prototype,"type",void 0),y([w($_)],v3.prototype,"color",void 0),y([w({...Gy,json:{write:{overridePolicy:t=>({enabled:!!t})}}})],v3.prototype,"extensionLength",void 0),y([w(Gy)],v3.prototype,"size",void 0),v3=y([Z("esri.symbols.edges.Edges3D")],v3);const Rse=v3;var TJ;let R7=TJ=class extends Rse{constructor(t){super(t),this.type="sketch"}clone(){return new TJ(this.cloneProperties())}};y([Vt({sketch:"sketch"},{readOnly:!0})],R7.prototype,"type",void 0),R7=TJ=y([Z("esri.symbols.edges.SketchEdges3D")],R7);const prt=R7;var EJ;let I7=EJ=class extends Rse{constructor(t){super(t),this.type="solid"}clone(){return new EJ(this.cloneProperties())}};y([Vt({solid:"solid"},{readOnly:!0})],I7.prototype,"type",void 0),I7=EJ=y([Z("esri.symbols.support.SolidEdges3D")],I7);const frt=I7,DMe={types:{key:"type",base:Rse,typeMap:{solid:frt,sketch:prt}},json:{write:!0}};var CJ;let mp=CJ=class extends Ue{constructor(t){super(t),this.color=null}clone(){const t={color:this.color!=null?this.color.clone():null};return new CJ(t)}};y([w($_)],mp.prototype,"color",void 0),mp=CJ=y([Z("esri.symbols.support.Symbol3DMaterial")],mp);var AJ;let Gb=AJ=class extends o1{constructor(t){super(t),this.type="extrude",this.size=1,this.material=null,this.castShadows=!0,this.edges=null}clone(){return new AJ({edges:this.edges&&this.edges.clone(),enabled:this.enabled,material:this.material!=null?this.material.clone():null,castShadows:this.castShadows,size:this.size})}};y([Vt({Extrude:"extrude"},{readOnly:!0})],Gb.prototype,"type",void 0),y([w({type:Number,json:{write:{enabled:!0,isRequired:!0}},nonNullable:!0})],Gb.prototype,"size",void 0),y([w({type:mp,json:{write:!0}})],Gb.prototype,"material",void 0),y([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!0}})],Gb.prototype,"castShadows",void 0),y([w(DMe)],Gb.prototype,"edges",void 0),Gb=AJ=y([Z("esri.symbols.ExtrudeSymbol3DLayer")],Gb);const NMe=Gb;let c4=class extends fd{constructor(e){super(e),this.type="simple-line",this.width=.75}hash(){return`${this.type}.${this.width}`}};y([Vt({esriSLS:"simple-line"},{readOnly:!0})],c4.prototype,"type",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],c4.prototype,"width",void 0),c4=y([Z("esri.symbols.LineSymbol")],c4);const mrt=c4,grt=["begin","end","begin-end"],FMe=["arrow","circle","square","diamond","cross","x"];var MJ;let xg=MJ=class extends Ue{constructor(t){super(t),this.placement="begin-end",this.type="line-marker",this.style="arrow"}writeStyle(t,e,i,r){e[i]=(r==null?void 0:r.origin)==="web-map"?"arrow":t}set color(t){this._set("color",t)}readColor(t){return(t==null?void 0:t[0])!=null?[t[0],t[1],t[2],t[3]/255]:t}writeColor(t,e,i,r){(r==null?void 0:r.origin)==="web-map"||(e[i]=t)}clone(){return new MJ({color:Re(this.color),placement:this.placement,style:this.style})}hash(){var t;return`${this.placement}.${(t=this.color)==null?void 0:t.hash()}.${this.style}`}};y([w({type:["begin","end","begin-end"],json:{write:!0}})],xg.prototype,"placement",void 0),y([Vt({"line-marker":"line-marker"},{readOnly:!0}),w({json:{origins:{"web-map":{write:!1}}}})],xg.prototype,"type",void 0),y([w({type:FMe})],xg.prototype,"style",void 0),y([Pt("style")],xg.prototype,"writeStyle",null),y([w({type:qe,value:null,json:{write:{allowNull:!0}}})],xg.prototype,"color",null),y([$t("color")],xg.prototype,"readColor",null),y([Pt("color")],xg.prototype,"writeColor",null),xg=MJ=y([Z("esri.symbols.LineSymbolMarker")],xg);const yrt=xg;var OJ;const xH=new yn({esriSLSSolid:"solid",esriSLSDash:"dash",esriSLSDot:"dot",esriSLSDashDot:"dash-dot",esriSLSDashDotDot:"long-dash-dot-dot",esriSLSNull:"none",esriSLSInsideFrame:"inside-frame",esriSLSShortDash:"short-dash",esriSLSShortDot:"short-dot",esriSLSShortDashDot:"short-dash-dot",esriSLSShortDashDotDot:"short-dash-dot-dot",esriSLSLongDash:"long-dash",esriSLSLongDashDot:"long-dash-dot"});let B1=OJ=class extends mrt{constructor(...t){super(...t),this.type="simple-line",this.style="solid",this.cap="round",this.join="round",this.marker=null,this.miterLimit=2}normalizeCtorArgs(t,e,i,r,n,s){if(t&&typeof t!="string")return t;const o={};return t!=null&&(o.style=t),e!=null&&(o.color=e),i!=null&&(o.width=vs(i)),r!=null&&(o.cap=r),n!=null&&(o.join=n),s!=null&&(o.miterLimit=vs(s)),o}clone(){var t;return new OJ({color:Re(this.color),style:this.style,width:this.width,cap:this.cap,join:this.join,miterLimit:this.miterLimit,marker:(t=this.marker)==null?void 0:t.clone()})}hash(){var t,e;return`${super.hash()}.${(t=this.color)==null?void 0:t.hash()}.${this.style}.${this.cap}.${this.join}.${this.miterLimit}.${(e=this.marker)==null?void 0:e.hash()}`}};y([Vt({esriSLS:"simple-line"},{readOnly:!0})],B1.prototype,"type",void 0),y([w({type:xH.apiValues,json:{read:xH.read,write:xH.write}})],B1.prototype,"style",void 0),y([w({type:["butt","round","square"],json:{write:{overridePolicy:(t,e,i)=>({enabled:t!=="round"&&(i==null?void 0:i.origin)==null})}}})],B1.prototype,"cap",void 0),y([w({type:["miter","round","bevel"],json:{write:{overridePolicy:(t,e,i)=>({enabled:t!=="round"&&(i==null?void 0:i.origin)==null})}}})],B1.prototype,"join",void 0),y([w({types:{key:"type",base:null,defaultKeyValue:"line-marker",typeMap:{"line-marker":yrt}},json:{write:!0,origins:{"web-scene":{write:!1}}}})],B1.prototype,"marker",void 0),y([w({type:Number,json:{read:!1,write:!1}})],B1.prototype,"miterLimit",void 0),B1=OJ=y([Z("esri.symbols.SimpleLineSymbol")],B1);const Oc=B1;let u4=class extends fd{constructor(e){super(e),this.outline=null,this.type=null}hash(){return`${this.type}.${this.outline&&this.outline.hash()}`}};y([w({types:{key:"type",base:null,defaultKeyValue:"simple-line",typeMap:{"simple-line":Oc}},json:{default:null,write:!0}})],u4.prototype,"outline",void 0),y([w({type:["simple-fill","picture-fill"],readOnly:!0})],u4.prototype,"type",void 0),u4=y([Z("esri.symbols.FillSymbol")],u4);const kMe=u4;let $7=class extends Ue{constructor(e){super(e)}clone(){}};y([w({type:["style"],readOnly:!0,json:{read:!0,write:{ignoreOrigin:!0}}})],$7.prototype,"type",void 0),$7=y([Z("esri.symbols.patterns.LinePattern3D")],$7);const zMe=$7,vrt=["dash","dash-dot","dot","long-dash","long-dash-dot","long-dash-dot-dot","none","short-dash","short-dash-dot","short-dash-dot-dot","short-dot","solid"];var PJ;const _rt=fu()({dash:"dash","dash-dot":"dash-dot","dash-dot-dot":"long-dash-dot-dot",dot:"dot","long-dash":"long-dash","long-dash-dot":"long-dash-dot",null:"none","short-dash":"short-dash","short-dash-dot":"short-dash-dot","short-dash-dot-dot":"short-dash-dot-dot","short-dot":"short-dot",solid:"solid"});let h4=PJ=class extends zMe{constructor(t){super(t),this.type="style",this.style="solid"}clone(){const t={style:this.style};return new PJ(t)}};y([w({type:["style"]})],h4.prototype,"type",void 0),y([Vt(_rt),w({type:vrt})],h4.prototype,"style",void 0),h4=PJ=y([Z("esri.symbols.patterns.LineStylePattern3D")],h4);const Ise=h4;let L7=class extends Ue{constructor(e){super(e)}clone(){}};y([w({type:["style"],readOnly:!0,json:{read:!0,write:{ignoreOrigin:!0}}})],L7.prototype,"type",void 0),L7=y([Z("esri.symbols.patterns.Pattern3D")],L7);const UMe=L7,brt=["backward-diagonal","cross","diagonal-cross","forward-diagonal","horizontal","none","solid","vertical"];var RJ;let d4=RJ=class extends UMe{constructor(t){super(t),this.type="style",this.style="solid"}clone(){const t={style:this.style};return new RJ(t)}};y([w({type:["style"]})],d4.prototype,"type",void 0),y([w({type:brt,json:{read:!0,write:!0}})],d4.prototype,"style",void 0),d4=RJ=y([Z("esri.symbols.patterns.StylePattern3D")],d4);const VMe=d4,wrt={types:{key:"type",base:UMe,typeMap:{style:VMe}},json:{write:!0}},BMe={types:{key:"type",base:zMe,typeMap:{style:Ise}},json:{write:!0}},KI=new qe("white");new qe("black");const xrt=new qe([255,255,255,0]);function Srt(t){return t.r===0&&t.g===0&&t.b===0}var IJ;let QI=IJ=class extends mp{constructor(t){super(t),this.colorMixMode=null}clone(){const t={color:this.color!=null?this.color.clone():null,colorMixMode:this.colorMixMode};return new IJ(t)}};y([Vt({multiply:"multiply",replace:"replace",tint:"tint"})],QI.prototype,"colorMixMode",void 0),QI=IJ=y([Z("esri.symbols.support.Symbol3DFillMaterial")],QI);function ya(t=WMe){return[t[0],t[1],t[2],t[3],t[4],t[5]]}function P2(t,e,i,r,n,s,o=ya()){return o[0]=t,o[1]=e,o[2]=i,o[3]=r,o[4]=n,o[5]=s,o}function Trt(t,e){const i=isFinite(t[2])||isFinite(t[5]);return new Vi(i?{xmin:t[0],xmax:t[3],ymin:t[1],ymax:t[4],zmin:t[2],zmax:t[5],spatialReference:e}:{xmin:t[0],xmax:t[3],ymin:t[1],ymax:t[4],spatialReference:e})}function ZO(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.min(t[2],e[2]),t[3]=Math.max(t[3],e[3]),t[4]=Math.max(t[4],e[4]),t[5]=Math.max(t[5],e[5])}function Ert(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[3]=Math.max(t[3],e[2]),t[4]=Math.max(t[4],e[3])}function qf(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.min(t[2],e[2]),t[3]=Math.max(t[3],e[0]),t[4]=Math.max(t[4],e[1]),t[5]=Math.max(t[5],e[2])}function cp(t,e,i=0,r=e.length/3){let n=t[0],s=t[1],o=t[2],l=t[3],c=t[4],f=t[5];for(let _=0;_=t[3]?0:t[3]-t[0]}function pE(t){return t[1]>=t[4]?0:t[4]-t[1]}function sx(t){return t[2]>=t[5]?0:t[5]-t[2]}function jMe(t){const e=dE(t),i=sx(t),r=pE(t);return Math.sqrt(e*e+i*i+r*r)}function gm(t,e=[0,0,0]){return e[0]=t[0]+dE(t)/2,e[1]=t[1]+pE(t)/2,e[2]=t[2]+sx(t)/2,e}function Y6(t,e=[0,0,0]){return e[0]=dE(t),e[1]=pE(t),e[2]=sx(t),e}function $se(t,e){return e[0]>=t[0]&&e[1]>=t[1]&&e[2]>=t[2]&&e[0]<=t[3]&&e[1]<=t[4]&&e[2]<=t[5]}function YZt(t,e){return e[0]>=t[0]&&e[1]>=t[1]&&e[2]>=t[2]&&e[3]<=t[3]&&e[4]<=t[4]&&e[5]<=t[5]}function Art(t,e){return Math.max(e[0],t[0])<=Math.min(e[3],t[3])&&Math.max(e[1],t[1])<=Math.min(e[4],t[4])&&Math.max(e[2],t[2])<=Math.min(e[5],t[5])}function ym(t,e){return e==null||Art(t,e)}function GMe(t,e,i,r,n=t){return n[0]=t[0]+e,n[1]=t[1]+i,n[2]=t[2]+r,n[3]=t[3]+e,n[4]=t[4]+i,n[5]=t[5]+r,n}function XZt(t,e,i=t){const r=t[0]+dE(t)/2,n=t[1]+pE(t)/2,s=t[2]+sx(t)/2;return i[0]=r+(t[0]-r)*e,i[1]=n+(t[1]-n)*e,i[2]=s+(t[2]-s)*e,i[3]=r+(t[3]-r)*e,i[4]=n+(t[4]-n)*e,i[5]=s+(t[5]-s)*e,i}function ZZt(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function HMe(t,e,i=t){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i!==t&&(i[3]=t[3],i[4]=t[4],i[5]=t[5]),i}function qMe(t,e,i=t){return i[3]=e[0],i[4]=e[1],i[5]=e[2],i!==t&&(i[0]=t[0],i[1]=t[1],i[2]=t[2]),t}function NB(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function Bn(t){return t?NB(t,gpe):ya(gpe)}function Lse(t,e){return e||(e=Ni()),e[0]=t[0],e[1]=t[1],e[2]=t[3],e[3]=t[4],e}function JZt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=Number.NEGATIVE_INFINITY,t[3]=e[2],t[4]=e[3],t[5]=Number.POSITIVE_INFINITY,t}function Mrt(t,e,i,r,n){return t[0]=e,t[1]=i,t[2]=Number.NEGATIVE_INFINITY,t[3]=r,t[4]=n,t[5]=Number.POSITIVE_INFINITY,t}function $J(t){return t.length===6}function Dse(t){return dE(t)===0&&pE(t)===0&&sx(t)===0}function KZt(t,e,i){if(t==null||e==null)return t===e;if(!$J(t)||!$J(e))return!1;if(i){for(let r=0;r{const e=Vh(t);return e===0?1:Je(e,.1,4)},nonNullable:!0},zrt=["left","right","center"],Urt=["baseline","top","middle","bottom"],ZMe={type:zrt,nonNullable:!0},JMe={type:Urt,nonNullable:!0},eJt=8;var DJ;let G1=DJ=class extends Ue{constructor(t){super(t),this.decoration="none",this.family="sans-serif",this.size=9,this.style="normal",this.weight="normal"}castSize(t){return vs(t)}clone(){return new DJ({decoration:this.decoration,family:this.family,size:this.size,style:this.style,weight:this.weight})}hash(){return`${this.decoration}.${this.family}.${this.size}.${this.style}.${this.weight}`}};y([w({type:Nrt,json:{default:"none",write:!0}})],G1.prototype,"decoration",void 0),y([w({type:String,json:{write:!0}})],G1.prototype,"family",void 0),y([w({type:Number,json:{write:{overridePolicy:(t,e,i)=>({enabled:!i||!i.textSymbol3D})}}})],G1.prototype,"size",void 0),y([Ci("size")],G1.prototype,"castSize",null),y([w({type:Frt,json:{default:"normal",write:!0}})],G1.prototype,"style",void 0),y([w({type:krt,json:{default:"normal",write:!0}})],G1.prototype,"weight",void 0),G1=DJ=y([Z("esri.symbols.Font")],G1);const FB=G1;function f_(t,e){var r;const i=(r=e==null?void 0:e.url)==null?void 0:r.path;if(t&&i&&(t=Gh(t,i,{preserveProtocolRelative:!0}),e.portalItem&&e.readResourcePaths)){const n=Ene(t,e.portalItem.itemUrl);n!=null&&Vrt.test(n)&&e.readResourcePaths.push(e.portalItem.resourceFromPath(n).path)}return NJ(t,e==null?void 0:e.portal)}function m_(t,e,i=JO.YES){var n,s;if(t==null)return t;!Zh(t)&&(e!=null&&e.blockedRelativeUrls)&&e.blockedRelativeUrls.push(t);let r=Gh(t);if(e){const o=((n=e.verifyItemRelativeUrls)==null?void 0:n.rootPath)||((s=e.url)==null?void 0:s.path);if(o){const l=NJ(o,e.portal),c=NJ(r,e.portal);r=Ene(c,l,l),r!=null&&r!==c&&r!==t&&e.verifyItemRelativeUrls&&e.verifyItemRelativeUrls.writtenUrls.push(r)}}return r=tOe(r,e==null?void 0:e.portal),Zh(r)&&(r=Mf(r)),e!=null&&e.resources&&(e!=null&&e.portalItem)&&!Zh(r)&&!i1(r)&&i===JO.YES&&e.resources.toKeep.push({resource:e.portalItem.resourceFromPath(r),compress:!1}),r}function kB(t,e,i){return f_(t,i)}function R2(t,e,i,r){const n=m_(t,r);n!==void 0&&(e[i]=n)}const KMe=/\/items\/([^\/]+)\/resources\/(.*)/,Vrt=/^\.\/resources\//;function QMe(t){const e=(t==null?void 0:t.match(KMe))??null;return(e==null?void 0:e[1])??null}function eOe(t){const e=(t==null?void 0:t.match(KMe))??null;if(e==null)return null;const i=e[2],r=i.lastIndexOf("/");if(r===-1){const{path:o,extension:l}=nde(i);return{prefix:null,filename:o,extension:l}}const{path:n,extension:s}=nde(i.slice(r+1));return{prefix:i.slice(0,r),filename:n,extension:s}}function tOe(t,e){return e&&!e.isPortal&&e.urlKey&&e.customBaseUrl?bZ(t,`${e.urlKey}.${e.customBaseUrl}`,e.portalHostname):t}function NJ(t,e){if(!e||e.isPortal||!e.urlKey||!e.customBaseUrl)return t;const i=`${e.urlKey}.${e.customBaseUrl}`,r=wne();return UO(r,`${r.scheme}://${i}`)?bZ(t,e.portalHostname,i):bZ(t,i,e.portalHostname)}var JO;(function(t){t[t.YES=0]="YES",t[t.NO=1]="NO"})(JO||(JO={}));const Brt=Object.freeze(Object.defineProperty({__proto__:null,get MarkKeep(){return JO},ensureMainOnlineDomain:tOe,fromJSON:f_,itemIdFromResourceUrl:QMe,prefixAndFilenameFromResourceUrl:eOe,read:kB,toJSON:m_,write:R2},Symbol.toStringTag,{value:"Module"}));var FJ;const jrt=fu()({circle:"circle",square:"square",cross:"cross",x:"x",kite:"kite",triangle:"triangle"});let b3=FJ=class extends Ue{constructor(t){super(t)}readHref(t,e,i){return t?f_(t,i):e.dataURI}writeHref(t,e,i,r){t&&(i1(t)?e.dataURI=t:(e.href=m_(t,r),Zh(e.href)&&(e.href=Mf(e.href))))}clone(){return new FJ({href:this.href,primitive:this.primitive})}};y([w({type:String,json:{write:!0,read:{source:["href","dataURI"]}}})],b3.prototype,"href",void 0),y([$t("href")],b3.prototype,"readHref",null),y([Pt("href",{href:{type:String},dataURI:{type:String}})],b3.prototype,"writeHref",null),y([Vt(jrt)],b3.prototype,"primitive",void 0),b3=FJ=y([Z("esri.symbols.support.IconSymbol3DLayerResource")],b3);const iOe="circle";var kJ;let SM=kJ=class extends ze{constructor(){super(...arguments),this.x=0,this.y=0}clone(){return new kJ({x:this.x,y:this.y})}};y([w({type:Number})],SM.prototype,"x",void 0),y([w({type:Number})],SM.prototype,"y",void 0),SM=kJ=y([Z("esri.symbols.support.Symbol3DAnchorPosition2D")],SM);var zJ;let p4=zJ=class extends Ue{constructor(t){super(t),this.color=new qe([0,0,0,1]),this.size=ad(1)}clone(){const t={color:this.color!=null?this.color.clone():null,size:this.size};return new zJ(t)}};y([w($_)],p4.prototype,"color",void 0),y([w(Gy)],p4.prototype,"size",void 0),p4=zJ=y([Z("esri.symbols.support.Symbol3DIconOutline")],p4);var gA;const rOe="esri.symbols.IconSymbol3DLayer";let Sg=gA=class extends o1{constructor(t){super(t),this.material=null,this.resource=null,this.type="icon",this.size=12,this.anchor="center",this.anchorPosition=null,this.outline=null}clone(){return new gA({anchor:this.anchor,anchorPosition:this.anchorPosition&&this.anchorPosition.clone(),enabled:this.enabled,material:this.material!=null?this.material.clone():null,outline:this.outline!=null?this.outline.clone():null,resource:this.resource&&this.resource.clone(),size:this.size})}static fromSimpleMarkerSymbol(t){const e=t.color||KI,i=ype(t),r=t.outline&&t.outline.width>0?{size:t.outline.width,color:(t.outline.color||KI).clone()}:null;return new gA({size:t.size,resource:{primitive:Hrt(t.style)},material:{color:e},outline:r,anchor:i?"relative":void 0,anchorPosition:i})}static fromPictureMarkerSymbol(t){const e=!t.color||Srt(t.color)?KI:t.color,i=ype(t);return new gA({size:t.width<=t.height?t.height:t.width,resource:{href:t.url},material:{color:e.clone()},anchor:i?"relative":void 0,anchorPosition:i})}static fromCIMSymbol(t){return new gA({resource:{href:fEe({mediaType:"application/json",data:JSON.stringify(t.data)})}})}};function ype(t){const e="width"in t?t.width:t.size,i="height"in t?t.height:t.size,r=vpe(t.xoffset),n=vpe(t.yoffset);return(r||n)&&e&&i?{x:-r/e,y:n/i}:null}function vpe(t){return isFinite(t)?t:0}y([w({type:mp,json:{write:!0}})],Sg.prototype,"material",void 0),y([w({type:b3,json:{write:!0}})],Sg.prototype,"resource",void 0),y([Vt({Icon:"icon"},{readOnly:!0})],Sg.prototype,"type",void 0),y([w(Gy)],Sg.prototype,"size",void 0),y([Vt({center:"center",left:"left",right:"right",top:"top",bottom:"bottom",topLeft:"top-left",topRight:"top-right",bottomLeft:"bottom-left",bottomRight:"bottom-right",relative:"relative"}),w({json:{default:"center"}})],Sg.prototype,"anchor",void 0),y([w({type:SM,json:{type:[Number],read:{reader:t=>new SM({x:t[0],y:t[1]})},write:{writer:(t,e)=>{e.anchorPosition=[t.x,t.y]},overridePolicy(){return{enabled:this.anchor==="relative"}}}}})],Sg.prototype,"anchorPosition",void 0),y([w({type:p4,json:{write:!0}})],Sg.prototype,"outline",void 0),Sg=gA=y([Z(rOe)],Sg);const Grt={circle:"circle",cross:"cross",diamond:"kite",square:"square",x:"x",triangle:"triangle",path:null};function Hrt(t){return Grt[t]||(Ce.getLogger(rOe).warn(`${t} cannot be mapped to Icon symbol. Fallback to "circle"`),"circle")}const e2=Sg;let w3=class extends Xs(Ue){constructor(e){super(e),this.type="style",this.placement="begin-end",this.style="arrow",this.color=null}equals(e){return e!=null&&e.placement===this.placement&&e.style===this.style&&(this.color==null&&e.color==null||this.color!=null&&e.color!=null&&this.color.toJSON()===e.color.toJSON())}};y([w({type:["style"],readOnly:!0,json:{read:!0,write:{ignoreOrigin:!0}}})],w3.prototype,"type",void 0),y([w({type:grt,json:{default:"begin-end",write:!0}})],w3.prototype,"placement",void 0),y([w({type:FMe,json:{default:"arrow",write:!0}})],w3.prototype,"style",void 0),y([w({type:qe,json:{type:[$n],default:null,write:!0}})],w3.prototype,"color",void 0),w3=y([Z("esri.symbols.LineStyleMarker3D")],w3);const UJ=w3;var N7;let Tg=N7=class extends o1{constructor(t){super(t),this.material=null,this.type="line",this.join="miter",this.cap="butt",this.size=ad(1),this.pattern=null,this.marker=null}clone(){const t={enabled:this.enabled,material:this.material!=null?this.material.clone():null,size:this.size,join:this.join,cap:this.cap,pattern:this.pattern!=null?this.pattern.clone():null,marker:this.marker!=null?this.marker.clone():null};return new N7(t)}static fromSimpleLineSymbol(t){var i;const e={enabled:!0,size:t.width??ad(1),cap:t.cap||"butt",join:t.join||"miter",pattern:t.style&&t.style!=="inside-frame"?new Ise({style:t.style}):null,material:new mp({color:(t.color||KI).clone()}),marker:t.marker?new UJ({placement:t.marker.placement,style:t.marker.style,color:((i=t.marker.color)==null?void 0:i.clone())??null}):null};return new N7(e)}};y([w({type:mp,json:{write:!0}})],Tg.prototype,"material",void 0),y([Vt({Line:"line"},{readOnly:!0})],Tg.prototype,"type",void 0),y([w({type:YMe,json:{write:!0,default:"miter"}})],Tg.prototype,"join",void 0),y([w({type:Nse,json:{write:!0,default:"butt"}})],Tg.prototype,"cap",void 0),y([w(Gy)],Tg.prototype,"size",void 0),y([w(BMe)],Tg.prototype,"pattern",void 0),y([w({types:{key:"type",base:UJ,typeMap:{style:UJ}},json:{write:!0}})],Tg.prototype,"marker",void 0),Tg=N7=y([Z("esri.symbols.LineSymbol3DLayer")],Tg);const N9=Tg;var VJ;const qrt=fu()({sphere:"sphere",cylinder:"cylinder",cube:"cube",cone:"cone",diamond:"diamond",tetrahedron:"tetrahedron",invertedCone:"inverted-cone"});let f4=VJ=class extends Ue{clone(){return new VJ({href:this.href,primitive:this.primitive})}};y([w({type:String,json:{read:kB,write:R2}})],f4.prototype,"href",void 0),y([Vt(qrt)],f4.prototype,"primitive",void 0),f4=VJ=y([Z("esri.symbols.support.ObjectSymbol3DLayerResource")],f4);const Fse="sphere";var BJ;let TS=BJ=class extends ze{constructor(){super(...arguments),this.x=0,this.y=0,this.z=0}clone(){return new BJ({x:this.x,y:this.y,z:this.z})}};y([w({type:Number})],TS.prototype,"x",void 0),y([w({type:Number})],TS.prototype,"y",void 0),y([w({type:Number})],TS.prototype,"z",void 0),TS=BJ=y([Z("esri.symbols.support.Symbol3DAnchorPosition3D")],TS);var jJ;let Gc=jJ=class extends o1{constructor(t){super(t),this.material=null,this.castShadows=!0,this.resource=null,this.type="object",this.width=void 0,this.height=void 0,this.depth=void 0,this.anchor=void 0,this.anchorPosition=void 0,this.heading=void 0,this.tilt=void 0,this.roll=void 0}clone(){var t,e,i;return new jJ({heading:this.heading,tilt:this.tilt,roll:this.roll,anchor:this.anchor,anchorPosition:(t=this.anchorPosition)==null?void 0:t.clone(),depth:this.depth,enabled:this.enabled,height:this.height,material:((e=this.material)==null?void 0:e.clone())??null,castShadows:this.castShadows,resource:(i=this.resource)==null?void 0:i.clone(),width:this.width})}get isPrimitive(){return!this.resource||typeof this.resource.href!="string"}};y([w({type:mp,json:{write:!0}})],Gc.prototype,"material",void 0),y([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!0}})],Gc.prototype,"castShadows",void 0),y([w({type:f4,json:{write:!0}})],Gc.prototype,"resource",void 0),y([Vt({Object:"object"},{readOnly:!0})],Gc.prototype,"type",void 0),y([w({type:Number,json:{write:!0}})],Gc.prototype,"width",void 0),y([w({type:Number,json:{write:!0}})],Gc.prototype,"height",void 0),y([w({type:Number,json:{write:!0}})],Gc.prototype,"depth",void 0),y([Vt({center:"center",top:"top",bottom:"bottom",origin:"origin",relative:"relative"}),w({json:{default:"origin"}})],Gc.prototype,"anchor",void 0),y([w({type:TS,json:{type:[Number],read:{reader:t=>new TS({x:t[0],y:t[1],z:t[2]})},write:{writer:(t,e)=>{e.anchorPosition=[t.x,t.y,t.z]},overridePolicy(){return{enabled:this.anchor==="relative"}}}}})],Gc.prototype,"anchorPosition",void 0),y([w({type:Number,json:{write:!0}})],Gc.prototype,"heading",void 0),y([w({type:Number,json:{write:!0}})],Gc.prototype,"tilt",void 0),y([w({type:Number,json:{write:!0}})],Gc.prototype,"roll",void 0),y([w({readOnly:!0})],Gc.prototype,"isPrimitive",null),Gc=jJ=y([Z("esri.symbols.ObjectSymbol3DLayer")],Gc);const kse=Gc;var GJ;let Cu=GJ=class extends o1{constructor(t){super(t),this.material=null,this.castShadows=!0,this.type="path",this.profile="circle",this.join="miter",this.cap="butt",this.width=void 0,this.height=void 0,this.anchor="center",this.profileRotation="all"}readWidth(t,e){return t??(e.height==null&&e.size!=null?e.size:void 0)}readHeight(t,e){return t??(e.width==null&&e.size!=null?e.size:void 0)}clone(){return new GJ({enabled:this.enabled,material:this.material!=null?this.material.clone():null,castShadows:this.castShadows,profile:this.profile,join:this.join,cap:this.cap,width:this.width,height:this.height,profileRotation:this.profileRotation,anchor:this.anchor})}};y([w({type:mp,json:{write:!0}})],Cu.prototype,"material",void 0),y([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!0}})],Cu.prototype,"castShadows",void 0),y([Vt({Path:"path"},{readOnly:!0})],Cu.prototype,"type",void 0),y([w({type:["circle","quad"],json:{write:!0,default:"circle"}})],Cu.prototype,"profile",void 0),y([w({type:YMe,json:{write:!0,default:"miter"}})],Cu.prototype,"join",void 0),y([w({type:Drt,json:{write:!0,default:"butt"}})],Cu.prototype,"cap",void 0),y([w({type:Number,json:{write:{enabled:!0,target:{width:{type:Number},size:{type:Number}}}}})],Cu.prototype,"width",void 0),y([$t("width",["width","size","height"])],Cu.prototype,"readWidth",null),y([w({type:Number,json:{write:!0}})],Cu.prototype,"height",void 0),y([$t("height",["height","size","width"])],Cu.prototype,"readHeight",null),y([w({type:["center","bottom","top"],json:{write:!0,default:"center"}})],Cu.prototype,"anchor",void 0),y([w({type:["heading","all"],json:{write:!0,default:"all"}})],Cu.prototype,"profileRotation",void 0),Cu=GJ=y([Z("esri.symbols.PathSymbol3DLayer")],Cu);const zse=Cu;var HJ;let TM=HJ=class extends Ue{constructor(){super(...arguments),this.color=new qe([0,0,0,1]),this.size=0}clone(){const t={color:Re(this.color),size:this.size};return new HJ(t)}};y([w($_)],TM.prototype,"color",void 0),y([w(Gy)],TM.prototype,"size",void 0),TM=HJ=y([Z("esri.symbols.support.Symbol3DHalo")],TM);let e$=class extends Xs(Ue){constructor(e){super(e),this.color=null}};y([w($_)],e$.prototype,"color",void 0),e$=y([Z("esri.symbols.support.Symbol3DTextBackground")],e$);var F7;let bh=F7=class extends o1{constructor(t){super(t),this._userSize=void 0,this.halo=null,this.horizontalAlignment="center",this.lineHeight=1,this.material=null,this.background=null,this.text=null,this.type="text",this.verticalAlignment="baseline"}get font(){return this._get("font")||null}set font(t){t!=null&&this._userSize!=null&&(t.size=this._userSize),this._set("font",t)}writeFont(t,e,i,r){const n={...r,textSymbol3D:!0};e.font=t.write({},n),delete e.font.size}get size(){var t;return this._userSize!=null?this._userSize:((t=this.font)==null?void 0:t.size)!=null?this.font.size:9}set size(t){this._userSize=t,this.font!=null&&(this.font.size=this._userSize),this.notifyChange("size")}clone(){const t=new F7({enabled:this.enabled,font:this.font&&Re(this.font),halo:this.halo&&Re(this.halo),horizontalAlignment:this.horizontalAlignment,lineHeight:this.lineHeight,material:this.material!=null?this.material.clone():null,text:this.text,verticalAlignment:this.verticalAlignment,background:Re(this.background)});return t._userSize=this._userSize,t}static fromTextSymbol(t){return new F7({font:t.font!=null?t.font.clone():new FB,halo:Wrt(t.haloColor,t.haloSize),horizontalAlignment:t.horizontalAlignment,lineHeight:t.lineHeight,material:t.color?new mp({color:t.color.clone()}):null,text:t.text,verticalAlignment:t.verticalAlignment,background:t.backgroundColor?new e$({color:t.backgroundColor.clone()}):null})}};function Wrt(t,e){return t&&e!=null&&e>0?new TM({color:Re(t),size:e}):null}y([w({type:FB,json:{write:!0}})],bh.prototype,"font",null),y([Pt("font")],bh.prototype,"writeFont",null),y([w({type:TM,json:{write:!0}})],bh.prototype,"halo",void 0),y([w({...ZMe,json:{default:"center",write:!0}})],bh.prototype,"horizontalAlignment",void 0),y([w({...XMe,json:{default:1,write:!0}})],bh.prototype,"lineHeight",void 0),y([w({type:mp,json:{write:!0}})],bh.prototype,"material",void 0),y([w({type:e$,json:{write:!0}})],bh.prototype,"background",void 0),y([w(Gy)],bh.prototype,"size",null),y([w({type:String,json:{write:!0}})],bh.prototype,"text",void 0),y([Vt({Text:"text"},{readOnly:!0})],bh.prototype,"type",void 0),y([w({...JMe,json:{default:"baseline",write:!0}})],bh.prototype,"verticalAlignment",void 0),bh=F7=y([Z("esri.symbols.TextSymbol3DLayer")],bh);const fE=bh;var qJ;let Hb=qJ=class extends o1{constructor(t){super(t),this.color=WJ.clone(),this.type="water",this.waterbodySize="medium",this.waveDirection=null,this.waveStrength="moderate"}clone(){return new qJ({color:Re(this.color),waterbodySize:this.waterbodySize,waveDirection:this.waveDirection,waveStrength:this.waveStrength})}};y([w({type:qe,nonNullable:!0,json:{type:[$n],write:(t,e,i)=>e[i]=t.toArray(qe.AlphaMode.UNLESS_OPAQUE),default:()=>WJ.clone(),defaultEquals:t=>t.toCss(!0)===WJ.toCss(!0)}})],Hb.prototype,"color",void 0),y([Vt({Water:"water"},{readOnly:!0})],Hb.prototype,"type",void 0),y([w({type:["small","medium","large"],json:{write:!0,default:"medium"}})],Hb.prototype,"waterbodySize",void 0),y([w({type:Number,json:{write:!0,default:null}})],Hb.prototype,"waveDirection",void 0),y([w({type:["calm","rippled","slight","moderate"],json:{write:!0,default:"moderate"}})],Hb.prototype,"waveStrength",void 0),Hb=qJ=y([Z("esri.symbols.WaterSymbol3DLayer")],Hb);const WJ=new qe([0,119,190]),nOe=Hb;var YJ;let x3=YJ=class extends ze{constructor(t){super(t),this.name=null,this.styleUrl=null,this.styleName=null,this.portal=null}clone(){return new YJ({name:this.name,styleUrl:this.styleUrl,styleName:this.styleName,portal:this.portal})}};y([w({type:String})],x3.prototype,"name",void 0),y([w({type:String})],x3.prototype,"styleUrl",void 0),y([w({type:String})],x3.prototype,"styleName",void 0),y([w({type:os})],x3.prototype,"portal",void 0),x3=YJ=y([Z("esri.symbols.support.StyleOrigin")],x3);const yL=x3;var XJ;let hT=XJ=class extends ze{constructor(){super(...arguments),this.url=""}clone(){return new XJ({url:this.url})}};y([w({type:String})],hT.prototype,"url",void 0),hT=XJ=y([Z("esri.symbols.support.Thumbnail")],hT);const sOe={icon:e2,object:kse,line:N9,path:zse,fill:uP,extrude:NMe,text:fE,water:nOe},Yrt=it.ofType({base:o1,key:"type",typeMap:sOe,errorContext:"symbol-layer"});let Eg=class extends fd{constructor(e){super(e),this.styleOrigin=null,this.thumbnail=null,this.type=null;const i=this.__accessor__&&this.__accessor__.metadatas&&this.__accessor__.metadatas.symbolLayers,r=i==null?void 0:i.type,n=r||it;this._set("symbolLayers",new n)}get color(){return null}set color(e){this.constructed&&Ce.getLogger(this).error("Symbol3D does not support colors on the symbol level. Colors may be set on individual symbol layer materials instead.")}set symbolLayers(e){sd(e,this._get("symbolLayers"))}readStyleOrigin(e,i,r){if(e.styleUrl&&e.name){const n=f_(e.styleUrl,r);return new yL({styleUrl:n,name:e.name})}if(e.styleName&&e.name)return new yL({portal:(r==null?void 0:r.portal)||os.getDefault(),styleName:e.styleName,name:e.name});r!=null&&r.messages&&r.messages.push(new Uf("symbol3d:incomplete-style-origin","Style origin requires either a 'styleUrl' or 'styleName' and a 'name' property",{context:r,definition:e}))}writeStyleOrigin(e,i,r,n){if(e.styleUrl&&e.name){let s=m_(e.styleUrl,n);Zh(s)&&(s=Mf(s)),i.styleOrigin={styleUrl:s,name:e.name}}else e.styleName&&e.name&&(e.portal&&(n!=null&&n.portal)&&!dEe(e.portal.restUrl,n.portal.restUrl)?n!=null&&n.messages&&n.messages.push(new Uf("symbol:cross-portal","The symbol style origin cannot be persisted because it refers to an item on a different portal than the one being saved to.",{symbol:this})):i.styleOrigin={styleName:e.styleName,name:e.name})}normalizeCtorArgs(e){return e instanceof o1||e&&sOe[e.type]?{symbolLayers:[e]}:Array.isArray(e)?{symbolLayers:e}:e}};y([w({json:{read:!1,write:!1}})],Eg.prototype,"color",null),y([w({type:Yrt,nonNullable:!0,json:{write:!0}}),Ci(nP)],Eg.prototype,"symbolLayers",null),y([w({type:yL})],Eg.prototype,"styleOrigin",void 0),y([$t("styleOrigin")],Eg.prototype,"readStyleOrigin",null),y([Pt("styleOrigin",{"styleOrigin.styleUrl":{type:String},"styleOrigin.styleName":{type:String},"styleOrigin.name":{type:String}})],Eg.prototype,"writeStyleOrigin",null),y([w({type:hT,json:{read:!1}})],Eg.prototype,"thumbnail",void 0),y([w({type:["point-3d","line-3d","polygon-3d","mesh-3d","label-3d"],readOnly:!0})],Eg.prototype,"type",void 0),Eg=y([Z("esri.symbols.Symbol3D")],Eg);const hP=Eg;let m4=class extends Ue{constructor(e){super(e),this.visible=!0}clone(){}};y([w({type:["line"],constructOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],m4.prototype,"type",void 0),y([w({readOnly:!0})],m4.prototype,"visible",void 0),m4=y([Z("esri.symbols.callouts.Callout3D")],m4);const oOe=m4;var ZJ;let k7=ZJ=class extends Ue{constructor(t){super(t),this.color=new qe("white")}clone(){return new ZJ({color:Re(this.color)})}};y([w($_)],k7.prototype,"color",void 0),k7=ZJ=y([Z("esri.symbols.callouts.LineCallout3DBorder")],k7);const Xrt=k7;var JJ;let qb=JJ=class extends oOe{constructor(t){super(t),this.type="line",this.color=new qe([0,0,0,1]),this.size=ad(1),this.border=null}get visible(){return this.size>0&&this.color!=null&&this.color.a>0}clone(){return new JJ({color:Re(this.color),size:this.size,border:Re(this.border)})}};y([Vt({line:"line"})],qb.prototype,"type",void 0),y([w($_)],qb.prototype,"color",void 0),y([w(Gy)],qb.prototype,"size",void 0),y([w({type:Xrt,json:{write:!0}})],qb.prototype,"border",void 0),y([w({readOnly:!0})],qb.prototype,"visible",null),qb=JJ=y([Z("esri.symbols.callouts.LineCallout3D")],qb);const aOe=qb;function Use(t){if(!t)return!1;const e=t.verticalOffset;return!!e&&!(e.screenLength<=0||e.maxWorldLength!=null&&e.maxWorldLength<=0)}function lOe(t){if(!t||!t.supportsCallout||!t.supportsCallout())return!1;const e=t.callout;return!!e&&!!e.visible&&!!Use(t)}function Vse(t){return t.type==="point-3d"||t.type==="label-3d"}function cOe(t){return t.horizontalAlignment==="center"}const uOe={types:{key:"type",base:oOe,typeMap:{line:aOe}},json:{write:!0}};var KJ;let yA=KJ=class extends Ue{constructor(t){super(t),this.screenLength=0,this.minWorldLength=0,this.maxWorldLength=null}clone(){return new KJ({screenLength:this.screenLength,minWorldLength:this.minWorldLength,maxWorldLength:this.maxWorldLength})}};y([w(Gy)],yA.prototype,"screenLength",void 0),y([w({type:Number,nonNullable:!0,json:{write:!0,default:0}})],yA.prototype,"minWorldLength",void 0),y([w({type:Number,json:{write:!0}})],yA.prototype,"maxWorldLength",void 0),yA=KJ=y([Z("esri.symbols.support.Symbol3DVerticalOffset")],yA);const Bse=yA;var z7;const hOe=it.ofType({base:null,key:"type",typeMap:{text:fE}});let Wb=z7=class extends hP{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.styleOrigin=null,this.symbolLayers=new hOe,this.type="label-3d"}supportsCallout(){return!0}hasVisibleCallout(){return lOe(this)}hasVisibleVerticalOffset(){return Use(this)}clone(){return new z7({styleOrigin:Re(this.styleOrigin),symbolLayers:Re(this.symbolLayers),thumbnail:Re(this.thumbnail),callout:Re(this.callout),verticalOffset:Re(this.verticalOffset)})}static fromTextSymbol(t){return new z7({symbolLayers:new it([fE.fromTextSymbol(t)])})}};y([w({type:Bse,json:{write:!0}})],Wb.prototype,"verticalOffset",void 0),y([w(uOe)],Wb.prototype,"callout",void 0),y([w({json:{read:!1,write:!1}})],Wb.prototype,"styleOrigin",void 0),y([w({type:hOe})],Wb.prototype,"symbolLayers",void 0),y([Vt({LabelSymbol3D:"label-3d"},{readOnly:!0})],Wb.prototype,"type",void 0),Wb=z7=y([Z("esri.symbols.LabelSymbol3D")],Wb);const zB=Wb;var U7;const dOe=it.ofType({base:null,key:"type",typeMap:{line:N9,path:zse}}),Zrt=it.ofType({base:null,key:"type",typeMap:{line:N9,path:zse}});let g4=U7=class extends hP{constructor(t){super(t),this.symbolLayers=new dOe,this.type="line-3d"}clone(){return new U7({styleOrigin:Re(this.styleOrigin),symbolLayers:Re(this.symbolLayers),thumbnail:Re(this.thumbnail)})}static fromSimpleLineSymbol(t){return new U7({symbolLayers:new it([N9.fromSimpleLineSymbol(t)])})}};y([w({type:dOe,json:{type:Zrt}})],g4.prototype,"symbolLayers",void 0),y([Vt({LineSymbol3D:"line-3d"},{readOnly:!0})],g4.prototype,"type",void 0),g4=U7=y([Z("esri.symbols.LineSymbol3D")],g4);const UB=g4;let Yb=class extends fd{constructor(e){super(e),this.angle=0,this.type=null,this.xoffset=0,this.yoffset=0,this.size=9}hash(){return`${this.type}.${this.angle}.${this.size}.${this.xoffset}.${this.yoffset}`}};y([w({type:Number,json:{read:t=>t&&-1*t,write:(t,e)=>e.angle=t&&-1*t}})],Yb.prototype,"angle",void 0),y([w({type:["simple-marker","picture-marker"],readOnly:!0})],Yb.prototype,"type",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Yb.prototype,"xoffset",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Yb.prototype,"yoffset",void 0),y([w({type:Number,cast:t=>t==="auto"?t:vs(t),json:{write:!0}})],Yb.prototype,"size",void 0),Yb=y([Z("esri.symbols.MarkerSymbol")],Yb);const pOe=Yb;var V7;const fOe=it.ofType({base:null,key:"type",typeMap:{fill:uP}});let y4=V7=class extends hP{constructor(t){super(t),this.symbolLayers=new fOe,this.type="mesh-3d"}clone(){return new V7({styleOrigin:Re(this.styleOrigin),symbolLayers:Re(this.symbolLayers),thumbnail:Re(this.thumbnail)})}static fromSimpleFillSymbol(t){return new V7({symbolLayers:new it([uP.fromSimpleFillSymbol(t)])})}};y([w({type:fOe})],y4.prototype,"symbolLayers",void 0),y([Vt({MeshSymbol3D:"mesh-3d"},{readOnly:!0})],y4.prototype,"type",void 0),y4=V7=y([Z("esri.symbols.MeshSymbol3D")],y4);const F9=y4;function Jrt(t,e,i){return e.imageData?fEe({mediaType:e.contentType||"image/png",isBase64:!0,data:e.imageData}):mOe(e.url,i)}function mOe(t,e){var i;return Qrt(e)&&!Zh(t)&&((i=e==null?void 0:e.layer)!=null&&i.parsedUrl)?s0(e.layer.parsedUrl.path,"images",t):f_(t,e)}function Krt(t,e,i,r){if(i1(t)){const n=C2(t);if(!n)return;e.contentType=n.mediaType,e.imageData=n.data,i&&i.imageData===e.imageData&&i.url&&R2(i.url,e,"url",r)}else R2(t,e,"url",r)}const gOe={json:{read:{source:["imageData","url"],reader:Jrt},write:{writer(t,e,i,r){Krt(t,e,this.source,r)}}}},yOe={readOnly:!0,json:{read:{source:["imageData","url"],reader(t,e,i){const r={};return e.imageData&&(r.imageData=e.imageData),e.contentType&&(r.contentType=e.contentType),e.url&&(r.url=mOe(e.url,i)),r}}}};function Qrt(t){var e,i;return!(t==null||t.origin!=="service"&&t.origin!=="portal-item"||((e=t.layer)==null?void 0:e.type)!=="feature"&&((i=t.layer)==null?void 0:i.type)!=="stream")}var QJ;let Gp=QJ=class extends kMe{constructor(...t){super(...t),this.type="picture-fill",this.url=null,this.xscale=1,this.yscale=1,this.width=12,this.height=12,this.xoffset=0,this.yoffset=0,this.source=null}normalizeCtorArgs(t,e,i,r){if(t&&typeof t!="string"&&t.imageData==null)return t;const n={};return t&&(n.url=t),e&&(n.outline=e),i!=null&&(n.width=vs(i)),r!=null&&(n.height=vs(r)),n}clone(){const t=new QJ({color:Re(this.color),height:this.height,outline:this.outline&&this.outline.clone(),url:this.url,width:this.width,xoffset:this.xoffset,xscale:this.xscale,yoffset:this.yoffset,yscale:this.yscale});return t._set("source",Re(this.source)),t}hash(){var t;return`${super.hash()}.${(t=this.color)==null?void 0:t.hash()}.${this.height}.${this.url}.${this.width}.${this.xoffset}.${this.xscale}.${this.yoffset}.${this.yscale}`}};y([Vt({esriPFS:"picture-fill"},{readOnly:!0})],Gp.prototype,"type",void 0),y([w(gOe)],Gp.prototype,"url",void 0),y([w({type:Number,json:{write:!0}})],Gp.prototype,"xscale",void 0),y([w({type:Number,json:{write:!0}})],Gp.prototype,"yscale",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Gp.prototype,"width",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Gp.prototype,"height",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Gp.prototype,"xoffset",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Gp.prototype,"yoffset",void 0),y([w(yOe)],Gp.prototype,"source",void 0),Gp=QJ=y([Z("esri.symbols.PictureFillSymbol")],Gp);const vOe=Gp;var eK;let M0=eK=class extends pOe{constructor(...t){super(...t),this.color=null,this.type="picture-marker",this.url=null,this.source=null,this.height=12,this.width=12,this.size=null}normalizeCtorArgs(t,e,i){if(t&&typeof t!="string"&&t.imageData==null)return t;const r={};return t&&(r.url=t),e!=null&&(r.width=vs(e)),i!=null&&(r.height=vs(i)),r}readHeight(t,e){return e.size||t}readWidth(t,e){return e.size||t}clone(){const t=new eK({angle:this.angle,height:this.height,url:this.url,width:this.width,xoffset:this.xoffset,yoffset:this.yoffset});return t._set("source",Re(this.source)),t}hash(){return`${super.hash()}.${this.height}.${this.url}.${this.width}`}};y([w({json:{write:!1}})],M0.prototype,"color",void 0),y([Vt({esriPMS:"picture-marker"},{readOnly:!0})],M0.prototype,"type",void 0),y([w(gOe)],M0.prototype,"url",void 0),y([w(yOe)],M0.prototype,"source",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],M0.prototype,"height",void 0),y([$t("height",["height","size"])],M0.prototype,"readHeight",null),y([w({type:Number,cast:vs,json:{write:!0}})],M0.prototype,"width",void 0),y([w({json:{write:!1}})],M0.prototype,"size",void 0),M0=eK=y([Z("esri.symbols.PictureMarkerSymbol")],M0);const dP=M0;var S3;const _Oe=it.ofType({base:null,key:"type",typeMap:{icon:e2,object:kse,text:fE}});let T3=S3=class extends hP{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.symbolLayers=new _Oe,this.type="point-3d"}supportsCallout(){if((this.symbolLayers?this.symbolLayers.length:0)<1)return!1;for(const t of this.symbolLayers.items)switch(t.type){case"icon":case"text":case"object":continue;default:return!1}return!0}hasVisibleCallout(){return lOe(this)}hasVisibleVerticalOffset(){return Use(this)}clone(){return new S3({verticalOffset:Re(this.verticalOffset),callout:Re(this.callout),styleOrigin:Re(this.styleOrigin),symbolLayers:Re(this.symbolLayers),thumbnail:Re(this.thumbnail)})}static fromSimpleMarkerSymbol(t){return new S3({symbolLayers:new it([e2.fromSimpleMarkerSymbol(t)])})}static fromPictureMarkerSymbol(t){return new S3({symbolLayers:new it([e2.fromPictureMarkerSymbol(t)])})}static fromCIMSymbol(t){var r,n;if(((n=(r=t.data)==null?void 0:r.symbol)==null?void 0:n.type)!=="CIMPointSymbol")return null;const i=t.data.symbol;return new S3(i!=null&&i.callout?{symbolLayers:new it([e2.fromCIMSymbol(t)]),callout:new aOe({size:.5,color:new qe([0,0,0])}),verticalOffset:new Bse({screenLength:40})}:{symbolLayers:new it([e2.fromCIMSymbol(t)])})}static fromTextSymbol(t){return new S3({symbolLayers:new it([fE.fromTextSymbol(t)])})}};y([w({type:Bse,json:{write:!0}})],T3.prototype,"verticalOffset",void 0),y([w(uOe)],T3.prototype,"callout",void 0),y([w({type:_Oe,json:{origins:{"web-scene":{write:!0}}}})],T3.prototype,"symbolLayers",void 0),y([Vt({PointSymbol3D:"point-3d"},{readOnly:!0})],T3.prototype,"type",void 0),T3=S3=y([Z("esri.symbols.PointSymbol3D")],T3);const t2=T3;var v4;const bOe=it.ofType({base:null,key:"type",typeMap:{extrude:NMe,fill:uP,icon:e2,line:N9,object:kse,text:fE,water:nOe}});let _4=v4=class extends hP{constructor(t){super(t),this.symbolLayers=new bOe,this.type="polygon-3d"}initialize(){const t=e=>{e.type==="line"&&NO(Ce.getLogger(this),"LineSymbol3DLayer can not be used as a SymbolLayer with a PolygonSymbol3D symbol anymore.",{replacement:"Use FillSymbol3DLayer.outline instead.",version:"4.28"}),e.type==="text"&&NO(Ce.getLogger(this),"TextSymbol3DLayer can not be used as a SymbolLayer with a PolygonSymbol3D symbol anymore.",{replacement:"Use Labels instead.",version:"4.28"})};for(const e of this.symbolLayers)t(e);this.addHandles(Jr(()=>this.symbolLayers,"after-add",({item:e})=>t(e),Li))}clone(){return new v4({styleOrigin:Re(this.styleOrigin),symbolLayers:Re(this.symbolLayers),thumbnail:Re(this.thumbnail)})}static fromJSON(t){var i;const e=new v4;if(e.read(t),e.symbolLayers.length===2&&e.symbolLayers.at(0).type==="fill"&&e.symbolLayers.at(1).type==="line"){const r=e.symbolLayers.at(0),n=e.symbolLayers.at(1);!n.enabled||(i=t.symbolLayers)!=null&&i[1]&&t.symbolLayers[1].enable===!1||(r.outline={size:n.size,color:n.material!=null?n.material.color:null}),e.symbolLayers.removeAt(1)}return e}static fromSimpleFillSymbol(t){return new v4({symbolLayers:new it([uP.fromSimpleFillSymbol(t)])})}};y([w({type:bOe,json:{write:!0}})],_4.prototype,"symbolLayers",void 0),y([Vt({PolygonSymbol3D:"polygon-3d"},{readOnly:!0})],_4.prototype,"type",void 0),_4=v4=y([Z("esri.symbols.PolygonSymbol3D")],_4);const k9=_4;var tK;const EH=new yn({esriSFSSolid:"solid",esriSFSNull:"none",esriSFSHorizontal:"horizontal",esriSFSVertical:"vertical",esriSFSForwardDiagonal:"forward-diagonal",esriSFSBackwardDiagonal:"backward-diagonal",esriSFSCross:"cross",esriSFSDiagonalCross:"diagonal-cross"});let E3=tK=class extends kMe{constructor(...t){super(...t),this.color=new qe([0,0,0,.25]),this.outline=new Oc,this.type="simple-fill",this.style="solid"}normalizeCtorArgs(t,e,i){if(t&&typeof t!="string")return t;const r={};return t&&(r.style=t),e&&(r.outline=e),i&&(r.color=i),r}clone(){return new tK({color:Re(this.color),outline:this.outline&&this.outline.clone(),style:this.style})}hash(){return`${super.hash()}${this.style}.${this.color&&this.color.hash()}`}};y([w()],E3.prototype,"color",void 0),y([w()],E3.prototype,"outline",void 0),y([Vt({esriSFS:"simple-fill"},{readOnly:!0})],E3.prototype,"type",void 0),y([w({type:EH.apiValues,json:{read:EH.read,write:EH.write}})],E3.prototype,"style",void 0),E3=tK=y([Z("esri.symbols.SimpleFillSymbol")],E3);const Bm=E3;var iK;const CH=new yn({esriSMSCircle:"circle",esriSMSSquare:"square",esriSMSCross:"cross",esriSMSX:"x",esriSMSDiamond:"diamond",esriSMSTriangle:"triangle",esriSMSPath:"path"});let Cg=iK=class extends pOe{constructor(...t){super(...t),this.color=new qe([255,255,255,.25]),this.type="simple-marker",this.size=12,this.style="circle",this.outline=new Oc}normalizeCtorArgs(t,e,i,r){if(t&&typeof t!="string")return t;const n={};return t&&(n.style=t),e!=null&&(n.size=vs(e)),i&&(n.outline=i),r&&(n.color=r),n}writeColor(t,e){t&&this.style!=="x"&&this.style!=="cross"&&(e.color=t.toJSON()),t===null&&(e.color=null)}set path(t){this.style="path",this._set("path",t)}clone(){return new iK({angle:this.angle,color:Re(this.color),outline:this.outline&&this.outline.clone(),path:this.path,size:this.size,style:this.style,xoffset:this.xoffset,yoffset:this.yoffset})}hash(){var t;return`${super.hash()}.${this.color&&this.color.hash()}.${this.path}.${this.style}.${(t=this.outline)==null?void 0:t.hash()}`}};y([w()],Cg.prototype,"color",void 0),y([Pt("color")],Cg.prototype,"writeColor",null),y([Vt({esriSMS:"simple-marker"},{readOnly:!0})],Cg.prototype,"type",void 0),y([w()],Cg.prototype,"size",void 0),y([w({type:CH.apiValues,json:{read:CH.read,write:CH.write}})],Cg.prototype,"style",void 0),y([w({type:String,json:{write:!0}})],Cg.prototype,"path",null),y([w({types:{key:"type",base:null,defaultKeyValue:"simple-line",typeMap:{"simple-line":Oc}},json:{default:null,write:!0}})],Cg.prototype,"outline",void 0),Cg=iK=y([Z("esri.symbols.SimpleMarkerSymbol")],Cg);const cu=Cg;var rK;let po=rK=class extends fd{constructor(...t){super(...t),this.backgroundColor=null,this.borderLineColor=null,this.borderLineSize=null,this.font=new FB,this.horizontalAlignment="center",this.kerning=!0,this.haloColor=null,this.haloSize=null,this.rightToLeft=null,this.rotated=!1,this.text="",this.type="text",this.verticalAlignment="baseline",this.xoffset=0,this.yoffset=0,this.angle=0,this.width=null,this.lineWidth=192,this.lineHeight=1}normalizeCtorArgs(t,e,i){if(t&&typeof t!="string")return t;const r={};return t&&(r.text=t),e&&(r.font=e),i&&(r.color=i),r}writeLineWidth(t,e,i,r){r&&typeof r!="string"?r.origin:e[i]=t}castLineWidth(t){return vs(t)}writeLineHeight(t,e,i,r){r&&typeof r!="string"?r.origin:e[i]=t}clone(){return new rK({angle:this.angle,backgroundColor:Re(this.backgroundColor),borderLineColor:Re(this.borderLineColor),borderLineSize:this.borderLineSize,color:Re(this.color),font:this.font&&this.font.clone(),haloColor:Re(this.haloColor),haloSize:this.haloSize,horizontalAlignment:this.horizontalAlignment,kerning:this.kerning,lineHeight:this.lineHeight,lineWidth:this.lineWidth,rightToLeft:this.rightToLeft,rotated:this.rotated,text:this.text,verticalAlignment:this.verticalAlignment,width:this.width,xoffset:this.xoffset,yoffset:this.yoffset})}hash(){var t,e,i;return`${(t=this.backgroundColor)==null?void 0:t.hash()}.${this.borderLineColor}.${this.borderLineSize}.${(e=this.color)==null?void 0:e.hash()}.${this.font&&this.font.hash()}.${(i=this.haloColor)==null?void 0:i.hash()}.${this.haloSize}.${this.horizontalAlignment}.${this.kerning}.${this.rightToLeft}.${this.rotated}.${this.text}.${this.verticalAlignment}.${this.width}.${this.xoffset}.${this.yoffset}.${this.lineHeight}.${this.lineWidth}.${this.angle}`}};y([w({type:qe,json:{write:!0}})],po.prototype,"backgroundColor",void 0),y([w({type:qe,json:{write:!0}})],po.prototype,"borderLineColor",void 0),y([w({type:Number,json:{write:!0},cast:vs})],po.prototype,"borderLineSize",void 0),y([w({type:FB,json:{write:!0}})],po.prototype,"font",void 0),y([w({...ZMe,json:{write:!0}})],po.prototype,"horizontalAlignment",void 0),y([w({type:Boolean,json:{write:!0}})],po.prototype,"kerning",void 0),y([w({type:qe,json:{write:!0}})],po.prototype,"haloColor",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],po.prototype,"haloSize",void 0),y([w({type:Boolean,json:{write:!0}})],po.prototype,"rightToLeft",void 0),y([w({type:Boolean,json:{write:!0}})],po.prototype,"rotated",void 0),y([w({type:String,json:{write:!0}})],po.prototype,"text",void 0),y([Vt({esriTS:"text"},{readOnly:!0})],po.prototype,"type",void 0),y([w({...JMe,json:{write:!0}})],po.prototype,"verticalAlignment",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],po.prototype,"xoffset",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],po.prototype,"yoffset",void 0),y([w({type:Number,json:{read:t=>t&&-1*t,write:(t,e)=>e.angle=t&&-1*t}})],po.prototype,"angle",void 0),y([w({type:Number,json:{write:!0}})],po.prototype,"width",void 0),y([w({type:Number})],po.prototype,"lineWidth",void 0),y([Pt("lineWidth")],po.prototype,"writeLineWidth",null),y([Ci("lineWidth")],po.prototype,"castLineWidth",null),y([w(XMe)],po.prototype,"lineHeight",void 0),y([Pt("lineHeight")],po.prototype,"writeLineHeight",null),po=rK=y([Z("esri.symbols.TextSymbol")],po);const mE=po;var nK;let O0=nK=class extends fd{constructor(t){super(t),this.color=null,this.styleName=null,this.portal=null,this.styleUrl=null,this.thumbnail=null,this.name=null,this.type="web-style"}get _fetchCacheKey(){const t=this.portal!=null?this.portal:os.getDefault(),e=t.user?t.user.username:null;return`${this.styleName}:${this.styleUrl}:${this.name}:${e}:${t.url}`}read(t,e){this.portal=e==null?void 0:e.portal,super.read(t,e)}clone(){return new nK({name:this.name,styleUrl:this.styleUrl,styleName:this.styleName,portal:this.portal})}fetchSymbol(t){return this._fetchSymbol("webRef",t)}fetchCIMSymbol(t){return this._fetchSymbol("cimRef",t)}async _fetchSymbol(t,e){const i=e!=null?e.cache:null,r=i?this._fetchCacheKey:null;if(i!=null){const l=r&&i.get(r);if(l)return l.clone()}const{resolveWebStyleSymbol:n}=await we(()=>Promise.resolve().then(()=>u5t),void 0);St(e);const s=n(this,{portal:this.portal},t,e);s.catch(l=>{Ce.getLogger(this).error("#fetchSymbol()","Failed to create symbol from style",l)});const o=await s;return t==="webRef"&&o.type==="point-3d"||t==="cimRef"&&o.type==="cim"?(i!=null&&i.set(r,o.clone()),o):null}};y([w({json:{write:!1}})],O0.prototype,"color",void 0),y([w({type:String,json:{write:!0}})],O0.prototype,"styleName",void 0),y([w({type:os,json:{write:!1}})],O0.prototype,"portal",void 0),y([w({type:String,json:{read:kB,write:R2}})],O0.prototype,"styleUrl",void 0),y([w({type:hT,json:{read:!1}})],O0.prototype,"thumbnail",void 0),y([w({type:String,json:{write:!0}})],O0.prototype,"name",void 0),y([Vt({styleSymbolReference:"web-style"},{readOnly:!0})],O0.prototype,"type",void 0),y([w()],O0.prototype,"_fetchCacheKey",null),O0=nK=y([Z("esri.symbols.WebStyleSymbol")],O0);const gE=O0;function VB(t){if(!t)return!1;switch(t.type){case"picture-fill":case"picture-marker":case"simple-fill":case"simple-line":case"simple-marker":case"text":case"cim":return!0;default:return!1}}function Hy(t){if(!t)return!1;switch(t.type){case"label-3d":case"line-3d":case"mesh-3d":case"point-3d":case"polygon-3d":return!0;default:return!1}}const py={base:fd,key:"type",typeMap:{"simple-fill":Bm,"picture-fill":vOe,"picture-marker":dP,"simple-line":Oc,"simple-marker":cu,text:mE,"label-3d":zB,"line-3d":UB,"mesh-3d":F9,"point-3d":t2,"polygon-3d":k9,"web-style":gE,cim:nx},errorContext:"symbol"},oJt={base:fd,key:"type",typeMap:{"picture-marker":dP,"simple-marker":cu,text:mE,"web-style":gE,cim:nx},errorContext:"symbol"},ent=Z5({types:py}),wOe={base:fd,key:"type",typeMap:{"simple-fill":Bm,"picture-fill":vOe,"picture-marker":dP,"simple-line":Oc,"simple-marker":cu,text:mE,"line-3d":UB,"mesh-3d":F9,"point-3d":t2,"polygon-3d":k9,"web-style":gE,cim:nx},errorContext:"symbol"},tnt={base:fd,key:"type",typeMap:{text:mE,"label-3d":zB},errorContext:"symbol"},_pe={base:fd,key:"type",typeMap:{"line-3d":UB,"mesh-3d":F9,"point-3d":t2,"polygon-3d":k9,"web-style":gE,cim:nx},errorContext:"symbol"},int={base:fd,key:"type",typeMap:{"label-3d":zB},errorContext:"symbol"},xOe=zy(py);var sK;function rnt(t){if(!t)return null;const e={};for(const i in t){const r=O2(t[i]);r&&(e[i]=r)}return Object.keys(e).length!==0?e:null}function nnt(t){if(t==null)return null;const e={};for(const i in t){const r=t[i];r&&(e[i]=r.toJSON())}return Object.keys(e).length!==0?e:null}let wh=sK=class extends Xs(Ue){constructor(...t){super(...t),this.isAggregate=!1,this.layer=null,this.popupTemplate=null,this.sourceLayer=null,Object.defineProperty(this,"uid",{value:hp(),configurable:!0})}normalizeCtorArgs(t,e,i,r){return t&&!t.declaredClass?t:{geometry:t,symbol:e,attributes:i,popupTemplate:r}}set aggregateGeometries(t){const e=this._get("aggregateGeometries");JSON.stringify(e)!==JSON.stringify(t)&&this._set("aggregateGeometries",t)}set attributes(t){const e=this._get("attributes");e!==t&&(this._set("attributes",t),this._notifyLayer("attributes",e,t))}set geometry(t){const e=this._get("geometry");e!==t&&(this._set("geometry",t),this._notifyLayer("geometry",e,t))}set symbol(t){const e=this._get("symbol");e!==t&&(this._set("symbol",t),this._notifyLayer("symbol",e,t))}set visible(t){const e=this._get("visible");e!==t&&(this._set("visible",t),this._notifyLayer("visible",e,t))}cloneShallow(){return new sK({aggregateGeometries:this.aggregateGeometries,attributes:this.attributes,geometry:this.geometry,isAggregate:this.isAggregate,layer:this.layer,popupTemplate:this.popupTemplate,sourceLayer:this.sourceLayer,symbol:this.symbol,visible:this.visible})}getEffectivePopupTemplate(t=!1){if(this.popupTemplate)return this.popupTemplate;for(const e of[this.sourceLayer,this.layer])if(e){if("popupTemplate"in e&&e.popupTemplate)return e.popupTemplate;if(t&&"defaultPopupTemplate"in e&&e.defaultPopupTemplate!=null)return e.defaultPopupTemplate}return null}getAttribute(t){var e;return(e=this.attributes)==null?void 0:e[t]}setAttribute(t,e){if(this.attributes){const i=this.getAttribute(t);this.attributes[t]=e,this._notifyLayer("attributes",i,e,t)}else this.attributes={[t]:e},this._notifyLayer("attributes",void 0,e,t)}getObjectId(){return this.sourceLayer&&"objectIdField"in this.sourceLayer&&this.sourceLayer.objectIdField?this.getAttribute(this.sourceLayer.objectIdField):null}toJSON(){var t;return{aggregateGeometries:nnt(this.aggregateGeometries),geometry:this.geometry!=null?this.geometry.toJSON():null,symbol:this.symbol!=null?this.symbol.toJSON():null,attributes:sz(this.attributes)?this.attributes.toJSON():{...this.attributes},popupTemplate:((t=this.popupTemplate)==null?void 0:t.toJSON())??null}}notifyGeometryChanged(){this._notifyLayer("geometry",this.geometry,this.geometry)}notifyMeshTransformChanged(t={}){const{geometry:e}=this;if((e==null?void 0:e.type)==="mesh"){const i={origin:e.origin,transform:e.transform};this._notifyLayer("origin-transform",i,i,t.action)}}_notifyLayer(t,e,i,r){if(!this.layer||!("graphicChanged"in this.layer))return;const n={graphic:this,property:t,oldValue:e,newValue:i};t==="origin-transform"&&(n.action=r),t==="attributes"&&(n.attributeName=r),this.layer.graphicChanged(n)}};y([w({value:null,json:{read:rnt}})],wh.prototype,"aggregateGeometries",null),y([w({value:null})],wh.prototype,"attributes",null),y([w({value:null,types:I9,json:{read:O2}})],wh.prototype,"geometry",null),y([w({type:Boolean})],wh.prototype,"isAggregate",void 0),y([w({clonable:"reference"})],wh.prototype,"layer",void 0),y([w({type:hE})],wh.prototype,"popupTemplate",void 0),y([w({clonable:"reference"})],wh.prototype,"sourceLayer",void 0),y([w({value:null,types:py})],wh.prototype,"symbol",null),y([w({type:Boolean,value:!0})],wh.prototype,"visible",null),wh=sK=y([Z("esri.Graphic")],wh),function(t){t.generateUID=hp}(wh||(wh={}));const Ml=wh;let dT=class extends YI{_own(e){e.layer&&"remove"in e.layer&&e.layer!==this.owner&&e.layer.remove(e),e.layer=this.owner}_release(e){e.layer===this.owner&&(e.layer=null)}};y([BSe({Type:Ml,ensureType:$s(Ml)})],dT.prototype,"itemType",void 0),dT=y([Z("esri.support.GraphicsCollection")],dT);var oK;let b4=oK=class extends Ue{constructor(t){super(t)}async collectRequiredFields(t,e){return eh(t,e,this.expression)}clone(){return new oK({expression:this.expression,title:this.title})}equals(t){return this.expression===t.expression&&this.title===t.title}};y([w({type:String,json:{write:!0}})],b4.prototype,"expression",void 0),y([w({type:String,json:{write:!0}})],b4.prototype,"title",void 0),b4=oK=y([Z("esri.layers.support.FeatureExpressionInfo")],b4);const bpe=b4,KO={unknown:1,inches:Ur(1,"meters","inches"),feet:Ur(1,"meters","feet"),"us-feet":Ur(1,"meters","us-feet"),yards:Ur(1,"meters","yards"),miles:Ur(1,"meters","miles"),"nautical-miles":Ur(1,"meters","nautical-miles"),millimeters:Ur(1,"meters","millimeters"),centimeters:Ur(1,"meters","centimeters"),decimeters:Ur(1,"meters","decimeters"),meters:Ur(1,"meters","meters"),kilometers:Ur(1,"meters","kilometers"),"decimal-degrees":1/UCe(1,"meters",Mr.radius)};function snt(t){return!!t&&KO[t]!=null}function SOe(t){return 1/(KO[t]||1)}function ont(){const t=Object.keys(KO);return t.sort(),t}const ant=ont();var aK;const X6=fu()({onTheGround:"on-the-ground",relativeToGround:"relative-to-ground",relativeToScene:"relative-to-scene",absoluteHeight:"absolute-height"}),wpe=new yn({foot:"feet",kilometer:"kilometers",meter:"meters",mile:"miles","us-foot":"us-feet",yard:"yards"});let H1=aK=class extends Ue{constructor(t){super(t),this.offset=null}readFeatureExpressionInfo(t,e){return t??(e.featureExpression&&e.featureExpression.value===0?{expression:"0"}:void 0)}writeFeatureExpressionInfo(t,e,i,r){e[i]=t.write({},r),t.expression==="0"&&(e.featureExpression={value:0})}get mode(){const{offset:t,featureExpressionInfo:e}=this;return this._isOverridden("mode")?this._get("mode"):t!=null||e?"relative-to-ground":"on-the-ground"}set mode(t){this._override("mode",t)}set unit(t){this._set("unit",t)}write(t,e){return this.offset||this.mode||this.featureExpressionInfo||this.unit?super.write(t,e):null}clone(){return new aK({mode:this.mode,offset:this.offset,featureExpressionInfo:this.featureExpressionInfo?this.featureExpressionInfo.clone():void 0,unit:this.unit})}equals(t){return this.mode===t.mode&&this.offset===t.offset&&this.unit===t.unit&&FO(this.featureExpressionInfo,t.featureExpressionInfo)}};y([w({type:bpe,json:{write:!0}})],H1.prototype,"featureExpressionInfo",void 0),y([$t("featureExpressionInfo",["featureExpressionInfo","featureExpression"])],H1.prototype,"readFeatureExpressionInfo",null),y([Pt("featureExpressionInfo",{featureExpressionInfo:{type:bpe},"featureExpression.value":{type:[0]}})],H1.prototype,"writeFeatureExpressionInfo",null),y([w({type:X6.apiValues,nonNullable:!0,json:{type:X6.jsonValues,read:X6.read,write:{writer:X6.write,isRequired:!0}}})],H1.prototype,"mode",null),y([w({type:Number,json:{write:!0}})],H1.prototype,"offset",void 0),y([w({type:ant,json:{type:String,read:wpe.read,write:wpe.write}})],H1.prototype,"unit",null),H1=aK=y([Z("esri.layers.support.ElevationInfo")],H1);const BB=H1;let q1=class extends Sse(OB(uE)){constructor(e){super(e),this.elevationInfo=null,this.graphics=new dT,this.screenSizePerspectiveEnabled=!0,this.type="graphics",this.internal=!1}destroy(){this.removeAll(),this.graphics.destroy()}add(e){return this.graphics.add(e),this}addMany(e){return this.graphics.addMany(e),this}removeAll(){return this.graphics.removeAll(),this}remove(e){this.graphics.remove(e)}removeMany(e){this.graphics.removeMany(e)}on(e,i){return super.on(e,i)}graphicChanged(e){this.emit("graphic-update",e)}};y([w({type:BB})],q1.prototype,"elevationInfo",void 0),y([w(Pz(dT,"graphics"))],q1.prototype,"graphics",void 0),y([w({type:["show","hide"]})],q1.prototype,"listMode",void 0),y([w()],q1.prototype,"screenSizePerspectiveEnabled",void 0),y([w({readOnly:!0})],q1.prototype,"type",void 0),y([w({constructOnly:!0})],q1.prototype,"internal",void 0),q1=y([Z("esri.layers.GraphicsLayer")],q1);const jse=q1;var lK;let w4=lK=class extends Ue{constructor(t){super(t),this.minValue=0,this.maxValue=0}clone(){return new lK({minValue:this.minValue,maxValue:this.maxValue})}};y([w({type:Number,json:{write:!0}})],w4.prototype,"minValue",void 0),y([w({type:Number,json:{write:!0}})],w4.prototype,"maxValue",void 0),w4=lK=y([Z("esri.renderer.support.AuthoringInfoClassBreakInfo")],w4);var cK;let $w=cK=class extends Ue{constructor(t){super(t),this.field="",this.normalizationField="",this.label="",this.classBreakInfos=[]}clone(){return new cK({field:this.field,normalizationField:this.normalizationField,label:this.label,classBreakInfos:Re(this.classBreakInfos)})}};y([w({type:String,json:{write:!0}})],$w.prototype,"field",void 0),y([w({type:String,json:{write:!0}})],$w.prototype,"normalizationField",void 0),y([w({type:String,json:{write:!0}})],$w.prototype,"label",void 0),y([w({type:[w4],json:{write:!0}})],$w.prototype,"classBreakInfos",void 0),$w=cK=y([Z("esri.renderers.support.AuthoringInfoFieldInfo")],$w);var uK;const Z6=new yn({percentTotal:"percent-of-total",ratio:"ratio",percent:"percent"}),J6=new yn({sizeInfo:"size",colorInfo:"color",transparencyInfo:"opacity",rotationInfo:"rotation"}),xpe={key:t=>typeof t=="number"?"number":"string",typeMap:{number:Number,string:String},base:null},Spe=["high-to-low","above-and-below","centered-on","extremes"],Tpe=[...new Set(["high-to-low","above-and-below","centered-on","extremes","90-10","above","below","high-to-low","above-and-below","90-10","above","below"])],Epe=["seconds","minutes","hours","days","months","years"];let xh=uK=class extends Ue{constructor(t){super(t),this.endTime=null,this.field=null,this.maxSliderValue=null,this.minSliderValue=null,this.startTime=null,this.type=null,this.units=null}castEndTime(t){return typeof t=="string"||typeof t=="number"?t:null}castStartTime(t){return typeof t=="string"||typeof t=="number"?t:null}get style(){return this.type==="color"?this._get("style"):null}set style(t){this._set("style",t)}get theme(){return this.type==="color"||this.type==="size"?this._get("theme")||"high-to-low":null}set theme(t){this._set("theme",t)}clone(){return new uK({endTime:this.endTime,field:this.field,maxSliderValue:this.maxSliderValue,minSliderValue:this.minSliderValue,startTime:this.startTime,style:this.style,theme:this.theme,type:this.type,units:this.units})}};y([w({types:xpe,json:{write:!0}})],xh.prototype,"endTime",void 0),y([Ci("endTime")],xh.prototype,"castEndTime",null),y([w({type:String,json:{write:!0}})],xh.prototype,"field",void 0),y([w({type:Number,json:{write:!0}})],xh.prototype,"maxSliderValue",void 0),y([w({type:Number,json:{write:!0}})],xh.prototype,"minSliderValue",void 0),y([w({types:xpe,json:{write:!0}})],xh.prototype,"startTime",void 0),y([Ci("startTime")],xh.prototype,"castStartTime",null),y([w({type:Z6.apiValues,value:null,json:{type:Z6.jsonValues,read:Z6.read,write:Z6.write}})],xh.prototype,"style",null),y([w({type:Tpe,value:null,json:{type:Tpe,origins:{"web-scene":{type:Spe,write:{writer:(t,e)=>{Spe.includes(t)&&(e.theme=t)}}}},write:!0}})],xh.prototype,"theme",null),y([w({type:J6.apiValues,json:{type:J6.jsonValues,read:J6.read,write:J6.write}})],xh.prototype,"type",void 0),y([w({type:Epe,json:{type:Epe,write:!0}})],xh.prototype,"units",void 0),xh=uK=y([Z("esri.renderers.support.AuthoringInfoVisualVariable")],xh);const lnt=xh;let B7=class extends Ue{constructor(e){super(e),this.type=null}};y([w({readOnly:!0,json:{read:!1,write:!0}})],B7.prototype,"type",void 0),B7=y([Z("esri.rest.support.ColorRamp")],B7);const Gse=B7;var hK;let C3=hK=class extends Gse{constructor(t){super(t),this.algorithm=null,this.fromColor=null,this.toColor=null,this.type="algorithmic"}clone(){return new hK({fromColor:Re(this.fromColor),toColor:Re(this.toColor),algorithm:this.algorithm})}};y([Vt({esriCIELabAlgorithm:"cie-lab",esriHSVAlgorithm:"hsv",esriLabLChAlgorithm:"lab-lch"})],C3.prototype,"algorithm",void 0),y([w({type:qe,json:{type:[$n],write:!0}})],C3.prototype,"fromColor",void 0),y([w({type:qe,json:{type:[$n],write:!0}})],C3.prototype,"toColor",void 0),y([w({type:["algorithmic"]})],C3.prototype,"type",void 0),C3=hK=y([Z("esri.rest.support.AlgorithmicColorRamp")],C3);const Hse=C3;var dK;let x4=dK=class extends Gse{constructor(t){super(t),this.colorRamps=null,this.type="multipart"}clone(){return new dK({colorRamps:Re(this.colorRamps)})}};y([w({type:[Hse],json:{write:!0}})],x4.prototype,"colorRamps",void 0),y([w({type:["multipart"]})],x4.prototype,"type",void 0),x4=dK=y([Z("esri.rest.support.MultipartColorRamp")],x4);const TOe=x4,cnt={key:"type",base:Gse,typeMap:{algorithmic:Hse,multipart:TOe}};function unt(t){return t!=null&&t.type?t.type==="algorithmic"?Hse.fromJSON(t):t.type==="multipart"?TOe.fromJSON(t):null:null}var pK;const bx=new yn({esriClassifyDefinedInterval:"defined-interval",esriClassifyEqualInterval:"equal-interval",esriClassifyManual:"manual",esriClassifyNaturalBreaks:"natural-breaks",esriClassifyQuantile:"quantile",esriClassifyStandardDeviation:"standard-deviation"}),K6=new yn({pieChart:"pie-chart",classedSize:"class-breaks-size",classedColor:"class-breaks-color",univariateColorSize:"univariate-color-size",relationship:"relationship",predominance:"predominance",dotDensity:"dot-density",flow:"flow"}),Cpe=new yn({classedSize:"class-breaks-size",classedColor:"class-breaks-color",univariateColorSize:"univariate-color-size",relationship:"relationship",predominance:"predominance",dotDensity:"dot-density"}),Ape=["inches","feet","yards","miles","nautical-miles","millimeters","centimeters","decimeters","meters","kilometers","decimal-degrees"],hnt=["high-to-low","above-and-below","above","below","90-10"],dnt=["flow-line","wave-front"],pnt=["caret","circle-caret","arrow","circle-arrow","plus-minus","circle-plus-minus","square","circle","triangle","happy-sad","thumb","custom"];let qo=pK=class extends Ue{constructor(t){super(t),this.colorRamp=null,this.fadeRatio=null,this.isAutoGenerated=!1,this.lengthUnit=null,this.maxSliderValue=null,this.minSliderValue=null,this.visualVariables=null}get classificationMethod(){const t=this._get("classificationMethod"),e=this.type;return e&&e!=="relationship"?e==="class-breaks-size"||e==="class-breaks-color"?t||"manual":null:t}set classificationMethod(t){this._set("classificationMethod",t)}readColorRamp(t){return t?unt(t):void 0}get fields(){return this.type&&this.type!=="predominance"?null:this._get("fields")}set fields(t){this._set("fields",t)}get field1(){return this.type&&this.type!=="relationship"?null:this._get("field1")}set field1(t){this._set("field1",t)}get field2(){return this.type&&this.type!=="relationship"?null:this._get("field2")}set field2(t){this._set("field2",t)}get flowTheme(){return this.type==="flow"?this._get("flowTheme"):null}set flowTheme(t){this._set("flowTheme",t)}get focus(){return this.type&&this.type!=="relationship"?null:this._get("focus")}set focus(t){this._set("focus",t)}get numClasses(){return this.type&&this.type!=="relationship"?null:this._get("numClasses")}set numClasses(t){this._set("numClasses",t)}get statistics(){return this.type==="univariate-color-size"&&this.univariateTheme==="above-and-below"?this._get("statistics"):null}set statistics(t){this._set("statistics",t)}get standardDeviationInterval(){const t=this.type;return t&&t!=="relationship"&&t!=="class-breaks-size"&&t!=="class-breaks-color"||this.classificationMethod&&this.classificationMethod!=="standard-deviation"?null:this._get("standardDeviationInterval")}set standardDeviationInterval(t){this._set("standardDeviationInterval",t)}get type(){return this._get("type")}set type(t){let e=t;t==="classed-size"?e="class-breaks-size":t==="classed-color"&&(e="class-breaks-color"),this._set("type",e)}get univariateSymbolStyle(){return this.type==="univariate-color-size"&&this.univariateTheme==="above-and-below"?this._get("univariateSymbolStyle"):null}set univariateSymbolStyle(t){this._set("univariateSymbolStyle",t)}get univariateTheme(){return this.type==="univariate-color-size"?this._get("univariateTheme"):null}set univariateTheme(t){this._set("univariateTheme",t)}clone(){var t;return new pK({classificationMethod:this.classificationMethod,colorRamp:Re(this.colorRamp),fadeRatio:Re(this.fadeRatio),fields:(t=this.fields)==null?void 0:t.slice(0),field1:Re(this.field1),field2:Re(this.field2),isAutoGenerated:this.isAutoGenerated,focus:this.focus,numClasses:this.numClasses,maxSliderValue:this.maxSliderValue,minSliderValue:this.minSliderValue,lengthUnit:this.lengthUnit,statistics:this.statistics,standardDeviationInterval:this.standardDeviationInterval,type:this.type,visualVariables:this.visualVariables&&this.visualVariables.map(e=>e.clone()),univariateSymbolStyle:this.univariateSymbolStyle,univariateTheme:this.univariateTheme,flowTheme:this.flowTheme})}};y([w({type:bx.apiValues,value:null,json:{type:bx.jsonValues,read:bx.read,write:bx.write,origins:{"web-document":{default:"manual",type:bx.jsonValues,read:bx.read,write:bx.write}}}})],qo.prototype,"classificationMethod",null),y([w({types:cnt,json:{write:!0}})],qo.prototype,"colorRamp",void 0),y([$t("colorRamp")],qo.prototype,"readColorRamp",null),y([w({json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],qo.prototype,"fadeRatio",void 0),y([w({type:[String],value:null,json:{write:!0}})],qo.prototype,"fields",null),y([w({type:$w,value:null,json:{write:!0}})],qo.prototype,"field1",null),y([w({type:$w,value:null,json:{write:!0}})],qo.prototype,"field2",null),y([w({type:dnt,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],qo.prototype,"flowTheme",null),y([w({type:["HH","HL","LH","LL"],value:null,json:{write:!0}})],qo.prototype,"focus",null),y([w({type:Boolean,json:{write:!0,default:!1,origins:{"web-scene":{write:!1}}}})],qo.prototype,"isAutoGenerated",void 0),y([w({type:Number,value:null,json:{type:$n,write:!0}})],qo.prototype,"numClasses",null),y([w({type:Ape,json:{type:Ape,read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],qo.prototype,"lengthUnit",void 0),y([w({type:Number,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],qo.prototype,"maxSliderValue",void 0),y([w({type:Number,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],qo.prototype,"minSliderValue",void 0),y([w({type:Object,value:null,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],qo.prototype,"statistics",null),y([w({type:[.25,.33,.5,1],value:null,json:{type:[.25,.33,.5,1],write:!0}})],qo.prototype,"standardDeviationInterval",null),y([w({type:K6.apiValues,value:null,json:{type:K6.jsonValues,read:K6.read,write:K6.write,origins:{"web-scene":{type:Cpe.jsonValues,write:{writer:Cpe.write,overridePolicy:t=>({enabled:t!=="flow"})}}}}})],qo.prototype,"type",null),y([w({type:[lnt],json:{write:!0}})],qo.prototype,"visualVariables",void 0),y([w({type:pnt,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],qo.prototype,"univariateSymbolStyle",null),y([w({type:hnt,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],qo.prototype,"univariateTheme",null),qo=pK=y([Z("esri.renderers.support.AuthoringInfo")],qo);const EOe=qo,AH=new yn({simple:"simple",uniqueValue:"unique-value",classBreaks:"class-breaks",heatmap:"heatmap",dotDensity:"dot-density",dictionary:"dictionary",pieChart:"pie-chart"},{ignoreUnknown:!0});let S4=class extends Ue{constructor(e){super(e),this.authoringInfo=null,this.type=null}async getRequiredFields(e){if(!this.collectRequiredFields)return[];const i=new Set;return await this.collectRequiredFields(i,e),Array.from(i).sort()}getSymbol(e,i){}async getSymbolAsync(e,i){}getSymbols(){return[]}getAttributeHash(){return JSON.stringify(this)}getMeshHash(){return JSON.stringify(this)}};y([w({type:EOe,json:{write:!0}})],S4.prototype,"authoringInfo",void 0),y([w({type:AH.apiValues,readOnly:!0,json:{type:AH.jsonValues,read:!1,write:{writer:AH.write,ignoreOrigin:!0}}})],S4.prototype,"type",void 0),S4=y([Z("esri.renderers.Renderer")],S4);const L_=S4;function fnt(t){var e,i;return((i=(e=t.match(mnt))==null?void 0:e[1])==null?void 0:i.replace(/\\'/g,"'"))??null}const mnt=/^hash\(\$feature\['((\\'|[^'])+)'\]\) \* 8\.381e-8$/;var fK;let sO=fK=class extends Ue{constructor(){super(...arguments),this.title=null}clone(){return new fK({title:this.title})}};y([w({type:String,json:{write:!0}})],sO.prototype,"title",void 0),sO=fK=y([Z("esri.renderers.support.LegendOptions")],sO);var mK;let j7=mK=class extends sO{constructor(){super(...arguments),this.showLegend=null}clone(){return new mK({title:this.title,showLegend:this.showLegend})}};y([w({type:Boolean,json:{write:!0}})],j7.prototype,"showLegend",void 0),j7=mK=y([Z("esri.renderers.visualVariables.support.VisualVariableLegendOptions")],j7);const COe=j7,MH=new yn({colorInfo:"color",transparencyInfo:"opacity",rotationInfo:"rotation",sizeInfo:"size"});let P0=class extends Ue{constructor(e){super(e),this.index=null,this.type=null,this.field=null,this.valueExpression=null,this.valueExpressionTitle=null,this.legendOptions=null}castField(e){return e==null?e:typeof e=="function"?(Ce.getLogger(this).error(".field: field must be a string value"),null):y9(e)}get arcadeRequired(){return!!this.valueExpression}clone(){}getAttributeHash(){return`${this.type}-${this.field}-${this.valueExpression}`}};y([w()],P0.prototype,"index",void 0),y([w({type:MH.apiValues,readOnly:!0,json:{read:MH.read,write:MH.write}})],P0.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],P0.prototype,"field",void 0),y([Ci("field")],P0.prototype,"castField",null),y([w({type:String,json:{write:!0}})],P0.prototype,"valueExpression",void 0),y([w({type:String,json:{write:!0}})],P0.prototype,"valueExpressionTitle",void 0),y([w({readOnly:!0})],P0.prototype,"arcadeRequired",null),y([w({type:COe,json:{write:!0}})],P0.prototype,"legendOptions",void 0),P0=y([Z("esri.renderers.visualVariables.VisualVariable")],P0);const z9=P0;var gK;let A3=gK=class extends Ue{constructor(t){super(t),this.color=null,this.label=null,this.value=null}writeValue(t,e,i){e[i]=t??0}clone(){return new gK({color:this.color&&this.color.clone(),label:this.label,value:this.value})}};y([w({type:qe,json:{type:[$n],write:!0}})],A3.prototype,"color",void 0),y([w({type:String,json:{write:!0}})],A3.prototype,"label",void 0),y([w({type:Number,json:{write:{writerEnsuresNonNull:!0}}})],A3.prototype,"value",void 0),y([Pt("value")],A3.prototype,"writeValue",null),A3=gK=y([Z("esri.renderers.visualVariables.support.ColorStop")],A3);const gnt=A3;var yK;let M3=yK=class extends z9{constructor(t){super(t),this.type="color",this.normalizationField=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null}}set stops(t){t&&Array.isArray(t)&&(t=t.filter(e=>!!e)).sort((e,i)=>e.value-i.value),this._set("stops",t)}clone(){var t;return new yK({field:this.field,normalizationField:this.normalizationField,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,stops:this.stops&&this.stops.map(e=>e.clone()),legendOptions:(t=this.legendOptions)==null?void 0:t.clone()})}getAttributeHash(){return`${super.getAttributeHash()}-${this.normalizationField}`}_interpolateData(){return this.stops&&this.stops.map(t=>t.value||0)}};y([w({readOnly:!0})],M3.prototype,"cache",null),y([w({type:["color"],json:{type:["colorInfo"]}})],M3.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],M3.prototype,"normalizationField",void 0),y([w({type:[gnt],json:{write:!0}})],M3.prototype,"stops",null),M3=yK=y([Z("esri.renderers.visualVariables.ColorVariable")],M3);const AOe=M3;var vK;let Xb=vK=class extends Ue{constructor(t){super(t),this.label=null,this.opacity=null,this.value=null}readOpacity(t,e){return jT(e.transparency)}writeOpacity(t,e,i){e[i]=DB(t)}clone(){return new vK({label:this.label,opacity:this.opacity,value:this.value})}};y([w({type:String,json:{write:!0}})],Xb.prototype,"label",void 0),y([w({type:Number,json:{type:$n,write:{target:"transparency"}}})],Xb.prototype,"opacity",void 0),y([$t("opacity",["transparency"])],Xb.prototype,"readOpacity",null),y([Pt("opacity")],Xb.prototype,"writeOpacity",null),y([w({type:Number,json:{write:!0}})],Xb.prototype,"value",void 0),Xb=vK=y([Z("esri.renderers.visualVariables.support.OpacityStop")],Xb);const ynt=Xb;var _K;let O3=_K=class extends z9{constructor(t){super(t),this.type="opacity",this.normalizationField=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null}}set stops(t){t&&Array.isArray(t)&&(t=t.filter(e=>!!e)).sort((e,i)=>e.value-i.value),this._set("stops",t)}clone(){var t;return new _K({field:this.field,normalizationField:this.normalizationField,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,stops:this.stops&&this.stops.map(e=>e.clone()),legendOptions:(t=this.legendOptions)==null?void 0:t.clone()})}getAttributeHash(){return`${super.getAttributeHash()}-${this.normalizationField}`}_interpolateData(){return this.stops&&this.stops.map(t=>t.value||0)}};y([w({readOnly:!0})],O3.prototype,"cache",null),y([w({type:["opacity"],json:{type:["transparencyInfo"]}})],O3.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],O3.prototype,"normalizationField",void 0),y([w({type:[ynt],json:{write:!0}})],O3.prototype,"stops",null),O3=_K=y([Z("esri.renderers.visualVariables.OpacityVariable")],O3);const MOe=O3;var bK;let W1=bK=class extends z9{constructor(t){super(t),this.axis=null,this.type="rotation",this.rotationType="geographic",this.valueExpressionTitle=null}get cache(){return{hasExpression:!!this.valueExpression,compiledFunc:null}}writeValueExpressionTitleWebScene(t,e,i,r){if(r!=null&&r.messages){const n=`visualVariables[${this.index}]`;r.messages.push(new se("property:unsupported",this.type+"VisualVariable.valueExpressionTitle is not supported in Web Scene. Please remove this property to save the Web Scene.",{instance:this,propertyName:n+".valueExpressionTitle",context:r}))}}clone(){var t;return new bK({axis:this.axis,rotationType:this.rotationType,field:this.field,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,legendOptions:(t=this.legendOptions)==null?void 0:t.clone()})}};y([w({readOnly:!0})],W1.prototype,"cache",null),y([w({type:["heading","tilt","roll"],json:{origins:{"web-scene":{default:"heading",write:!0}}}})],W1.prototype,"axis",void 0),y([w({type:["rotation"],json:{type:["rotationInfo"]}})],W1.prototype,"type",void 0),y([w({type:["geographic","arithmetic"],json:{write:!0,origins:{"web-document":{write:!0,default:"geographic"}}}})],W1.prototype,"rotationType",void 0),y([w({type:String,json:{write:!0}})],W1.prototype,"valueExpressionTitle",void 0),y([Pt("web-scene","valueExpressionTitle")],W1.prototype,"writeValueExpressionTitleWebScene",null),W1=bK=y([Z("esri.renderers.visualVariables.RotationVariable")],W1);const OOe=W1;var wK;let vA=wK=class extends Ue{constructor(t){super(t),this.label=null,this.size=null,this.value=null}clone(){return new wK({label:this.label,size:this.size,value:this.value})}};y([w({type:String,json:{write:!0}})],vA.prototype,"label",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],vA.prototype,"size",void 0),y([w({type:Number,json:{write:!0}})],vA.prototype,"value",void 0),vA=wK=y([Z("esri.renderers.visualVariables.support.SizeStop")],vA);const vnt=vA;var xK;let G7=xK=class extends COe{constructor(){super(...arguments),this.customValues=null}clone(){var t;return new xK({title:this.title,showLegend:this.showLegend,customValues:(t=this.customValues)==null?void 0:t.slice(0)})}};y([w({type:[Number],json:{write:!0}})],G7.prototype,"customValues",void 0),G7=xK=y([Z("esri.renderers.visualVariables.support.SizeVariableLegendOptions")],G7);const POe=G7;var Xv,Sl;function EM(t){return t&&t.declaredClass==="esri.renderers.visualVariables.SizeVariable"}function vL(t){return t!=null&&!isNaN(t)&&isFinite(t)}function ROe(t){return t.valueExpression?Xv.Expression:t.field&&typeof t.field=="string"?Xv.Field:Xv.Unknown}function _nt(t,e){const i=e||ROe(t),r=t.valueUnit||"unknown";return i===Xv.Unknown?Sl.Constant:t.stops?Sl.Stops:t.minSize!=null&&t.maxSize!=null&&t.minDataValue!=null&&t.maxDataValue!=null?Sl.ClampedLinear:r==="unknown"?t.minSize!=null&&t.minDataValue!=null?t.minSize&&t.minDataValue?Sl.Proportional:Sl.Additive:Sl.Identity:Sl.RealWorldSize}(function(t){t.Unknown="unknown",t.Expression="expression",t.Field="field"})(Xv||(Xv={})),function(t){t.Unknown="unknown",t.Stops="stops",t.ClampedLinear="clamped-linear",t.Proportional="proportional",t.Additive="additive",t.Constant="constant",t.Identity="identity",t.RealWorldSize="real-world-size"}(Sl||(Sl={}));function dJt(t){}function bnt(t){return()=>t}const I2=Ce.getLogger("esri.renderers.visualVariables.support.visualVariableUtils"),Mpe=new Ml,H7=Math.PI,IOe=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i;function $Oe(t,e,i){const r="visualVariables"in t&&t.visualVariables?t.visualVariables.find(M=>M.type==="color"):t;if(!r)return;if(r.declaredClass!=="esri.renderers.visualVariables.ColorVariable")return void I2.warn("The visualVariable should be an instance of esri.renderers.visualVariables.ColorVariable");const n=typeof e=="number",s=n?null:e,o=s==null?void 0:s.attributes;let l=n?e:null;const c=r.field,{ipData:f,hasExpression:_}=r.cache;let x=r.cache.compiledFunc;if(!c&&!_){const M=r.stops;return M&&M[0]&&M[0].color}if(typeof l!="number")if(_){if((i==null?void 0:i.arcade)==null)return void I2.error("Use of arcade expressions requires an arcade context");const M={viewingMode:i.viewingMode,scale:i.scale,spatialReference:i.spatialReference},I=i.arcade.arcadeUtils,L=I.getViewInfo(M),F=I.createExecContext(s,L,i.timeZone);if(!x){const z=I.createSyntaxTree(r.valueExpression);x=I.createFunction(z),r.cache.compiledFunc=x}l=I.executeFunction(x,F)}else o&&(l=o[c]);const T=r.normalizationField,A=o!=null&&T!=null?parseFloat(o[T]):void 0;if(l!=null&&(!T||n||!isNaN(A)&&A!==0)){isNaN(A)||n||(l/=A);const M=Wse(l,f);if(M){const I=M[0],L=M[1],F=I===L?r.stops[I].color:qe.blendColors(r.stops[I].color,r.stops[L].color,M[2],i!=null?i.color:void 0);return new qe(F)}}}function LOe(t,e,i){const r="visualVariables"in t&&t.visualVariables?t.visualVariables.find(M=>M.type==="opacity"):t;if(!r)return;if(r.declaredClass!=="esri.renderers.visualVariables.OpacityVariable")return void I2.warn("The visualVariable should be an instance of esri.renderers.visualVariables.OpacityVariable");const n=typeof e=="number",s=n?null:e,o=s==null?void 0:s.attributes;let l=n?e:null;const c=r.field,{ipData:f,hasExpression:_}=r.cache;let x=r.cache.compiledFunc;if(!c&&!_){const M=r.stops;return M&&M[0]&&M[0].opacity}if(typeof l!="number")if(_){if((i==null?void 0:i.arcade)==null)return void I2.error("Use of arcade expressions requires an arcade context");const M={viewingMode:i.viewingMode,scale:i.scale,spatialReference:i.spatialReference},I=i.arcade.arcadeUtils,L=I.getViewInfo(M),F=I.createExecContext(s,L,i.timeZone);if(!x){const z=I.createSyntaxTree(r.valueExpression);x=I.createFunction(z),r.cache.compiledFunc=x}l=I.executeFunction(x,F)}else o&&(l=o[c]);const T=r.normalizationField,A=o!=null&&T!=null?parseFloat(o[T]):void 0;if(l!=null&&(!T||n||!isNaN(A)&&A!==0)){isNaN(A)||n||(l/=A);const M=Wse(l,f);if(M){const I=M[0],L=M[1];if(I===L)return r.stops[I].opacity;{const F=r.stops[I].opacity;return F+(r.stops[L].opacity-F)*M[2]}}}}function DOe(t,e,i){const r="visualVariables"in t&&t.visualVariables?t.visualVariables.find(A=>A.type==="rotation"):t;if(!r)return;if(r.declaredClass!=="esri.renderers.visualVariables.RotationVariable")return void I2.warn("The visualVariable should be an instance of esri.renderers.visualVariables.RotationVariable");const n=r.axis||"heading",s=n==="heading"&&r.rotationType==="arithmetic"?90:0,o=n==="heading"&&r.rotationType==="arithmetic"?-1:1,l=typeof e=="number"?null:e,c=l==null?void 0:l.attributes,f=r.field,{hasExpression:_}=r.cache;let x=r.cache.compiledFunc,T=0;if(!f&&!_)return T;if(_){if((i==null?void 0:i.arcade)==null)return void I2.error("Use of arcade expressions requires an arcade context");const A={viewingMode:i.viewingMode,scale:i.scale,spatialReference:i.spatialReference},M=i.arcade.arcadeUtils,I=M.getViewInfo(A),L=M.createExecContext(l,I,i.timeZone);if(!x){const F=M.createSyntaxTree(r.valueExpression);x=M.createFunction(F),r.cache.compiledFunc=x}T=M.executeFunction(x,L)}else c&&(T=c[f]||0);return T=typeof T!="number"||isNaN(T)?null:s+o*T,T}function wnt(t,e,i){const r=typeof e=="number",n=r?null:e,s=n==null?void 0:n.attributes;let o=r?e:null;const{isScaleDriven:l}=t.cache;let c=t.cache.compiledFunc;if(l){const _=i!=null?i.scale:void 0,x=i!=null?i.view:void 0;o=_==null||x==="3d"?xnt(t):_}else if(!r)switch(t.inputValueType){case Xv.Expression:{if((i==null?void 0:i.arcade)==null)return void I2.error("Use of arcade expressions requires an arcade context");const _={viewingMode:i.viewingMode,scale:i.scale,spatialReference:i.spatialReference},x=i.arcade.arcadeUtils,T=x.getViewInfo(_),A=x.createExecContext(n,T,i.timeZone);if(!c){const M=x.createSyntaxTree(t.valueExpression);c=x.createFunction(M),t.cache.compiledFunc=c}o=x.executeFunction(c,A);break}case Xv.Field:s&&(o=s[t.field]);break;case Xv.Unknown:o=null}if(!vL(o))return null;if(r||!t.normalizationField)return o;const f=s?parseFloat(s[t.normalizationField]):null;return vL(f)&&f!==0?o/f:null}function xnt(t){let e=null,i=null;const r=t.stops;return r?(e=r[0].value,i=r[r.length-1].value):(e=t.minDataValue||0,i=t.maxDataValue||0),(e+i)/2}function jB(t,e,i){const r="visualVariables"in t&&t.visualVariables?t.visualVariables.find(s=>s.type==="size"):t;if(!r)return;if(r.declaredClass!=="esri.renderers.visualVariables.SizeVariable")return void I2.warn("The visualVariable should be an instance of esri.renderers.visualVariables.SizeVariable");const n=FOe(wnt(r,e,i),r,e,i,r.cache.ipData);return n==null||isNaN(n)?0:n}function Jh(t,e,i){return t==null?null:EM(t)?jB(t,e,i):vL(t)?t:null}function NOe(t,e,i){return vL(i)&&t>i?i:vL(e)&&t=e.maxDataValue)return o;if(s==null||o==null)return null;if(e.scaleBy==="area"&&l){const c=l==="circle",f=c?H7*(s/2)**2:s*s,_=f+n*((c?H7*(o/2)**2:o*o)-f);return c?2*Math.sqrt(_/H7):Math.sqrt(_)}return s+n*(o-s)}function Cnt(t,e,i,r){const n=r!=null?r.shape:void 0,s=t/e.minDataValue,o=Jh(e.minSize,i,r),l=Jh(e.maxSize,i,r);let c=null;return c=n==="circle"?2*Math.sqrt(s*(o/2)**2):n==="square"||n==="diamond"||n==="image"?Math.sqrt(s*o**2):s*o,NOe(c,o,l)}function Ant(t,e,i,r,n){var c,f,_;const[s,o,l]=Wse(t,n);if(s===o)return Jh((c=e.stops)==null?void 0:c[s].size,i,r);{const x=Jh((f=e.stops)==null?void 0:f[s].size,i,r);return x+(Jh((_=e.stops)==null?void 0:_[o].size,i,r)-x)*l}}function Mnt(t,e,i,r){const n=((r==null?void 0:r.resolution)??1)*KO[e.valueUnit],s=Jh(e.minSize,i,r),o=Jh(e.maxSize,i,r),{valueRepresentation:l}=e;let c=null;return c=l==="area"?2*Math.sqrt(t/H7)/n:l==="radius"||l==="distance"?2*t/n:t/n,NOe(c,s,o)}function FOe(t,e,i,r,n){switch(e.transformationType){case Sl.Additive:return Snt(t,e,i,r);case Sl.Constant:return Tnt(e,i,r);case Sl.ClampedLinear:return Ent(t,e,i,r);case Sl.Proportional:return Cnt(t,e,i,r);case Sl.Stops:return Ant(t,e,i,r,n);case Sl.RealWorldSize:return Mnt(t,e,i,r);case Sl.Identity:return t;case Sl.Unknown:return null}}function Ont(t,e,i){const{isScaleDriven:r}=t.cache;if(!(r&&i==="3d"||e))return null;const n={scale:e,view:i};let s=Jh(t.minSize,Mpe,n),o=Jh(t.maxSize,Mpe,n);if(s!=null||o!=null){if(s>o){const l=o;o=s,s=l}return{minSize:s,maxSize:o}}}function qse(t,e,i){if(!t.visualVariables)return;const r=[],n=[],s=[],o=[],l=[];for(const c of t.visualVariables)switch(c.type){case"color":n.push(c);break;case"opacity":s.push(c);break;case"rotation":l.push(c);break;case"size":o.push(c)}return n.forEach(c=>{const f=$Oe(c,e,i);r.push({variable:c,value:f})}),s.forEach(c=>{const f=LOe(c,e,i);r.push({variable:c,value:f})}),l.forEach(c=>{const f=DOe(c,e,i);r.push({variable:c,value:f})}),o.forEach(c=>{const f=jB(c,e,i);r.push({variable:c,value:f})}),r.filter(c=>c.value!=null)}function Wse(t,e){if(!e)return;let i=0,r=e.length-1;return e.some((n,s)=>t!!e)).sort((e,i)=>e.value-i.value):t&&(Ce.getLogger(this).warn("cannot set stops when one of minDataValue, maxDataValue, minSize or maxSize is not null."),t=null),this._set("stops",t)}get transformationType(){return _nt(this,this.inputValueType)}readValueExpression(t,e){return t||e.expression&&"$view.scale"}writeValueExpressionWebScene(t,e,i,r){if(t==="$view.scale"){if(r!=null&&r.messages){const n=this.index,s=typeof n=="string"?n:`visualVariables[${n}]`;r.messages.push(new se("property:unsupported",this.type+"VisualVariable.valueExpression = '$view.scale' is not supported in Web Scene. Please remove this property to save the Web Scene.",{instance:this,propertyName:s+".valueExpression",context:r}))}}else e[i]=t}readValueUnit(t){return t?TK.read(t):null}clone(){var t,e;return new SK({axis:this.axis,field:this.field,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,maxDataValue:this.maxDataValue,maxSize:EM(this.maxSize)?this.maxSize.clone():this.maxSize,minDataValue:this.minDataValue,minSize:EM(this.minSize)?this.minSize.clone():this.minSize,normalizationField:this.normalizationField,stops:(t=this.stops)==null?void 0:t.map(i=>i.clone()),target:this.target,useSymbolValue:this.useSymbolValue,valueRepresentation:this.valueRepresentation,valueUnit:this.valueUnit,legendOptions:(e=this.legendOptions)==null?void 0:e.clone()})}flipSizes(){if(this.transformationType===Sl.ClampedLinear){const{minSize:t,maxSize:e}=this;return this.minSize=e,this.maxSize=t,this}if(this.transformationType===Sl.Stops){const t=this.stops;if(!t)return this;const e=t.map(r=>r.size).reverse(),i=t.length;for(let r=0;re.value||0)}};y([w({readOnly:!0})],Mn.prototype,"cache",null),y([w({type:Q6.apiValues,json:{type:Q6.jsonValues,origins:{"web-map":{read:!1}},read:Q6.read,write:Q6.write}})],Mn.prototype,"axis",void 0),y([w({type:String,value:null,json:{read:!1}})],Mn.prototype,"expression",null),y([w()],Mn.prototype,"index",null),y([w({type:String,readOnly:!0})],Mn.prototype,"inputValueType",null),y([w({type:POe,json:{write:!0}})],Mn.prototype,"legendOptions",void 0),y([w({type:Number,value:null,json:{write:!0}})],Mn.prototype,"maxDataValue",null),y([w({type:Number,value:null,json:{write:!0}})],Mn.prototype,"maxSize",null),y([Ci("maxSize")],Mn.prototype,"castMaxSize",null),y([$t("maxSize")],Mn.prototype,"readMaxSize",null),y([w({type:Number,value:null,json:{write:!0}})],Mn.prototype,"minDataValue",null),y([w({type:Number,value:null,json:{write:!0}})],Mn.prototype,"minSize",null),y([Ci("minSize")],Mn.prototype,"castMinSize",null),y([$t("minSize")],Mn.prototype,"readMinSize",null),y([w({type:String,json:{write:!0}})],Mn.prototype,"normalizationField",void 0),y([w({readOnly:!0})],Mn.prototype,"arcadeRequired",null),y([w({type:String})],Mn.prototype,"scaleBy",void 0),y([w({type:[vnt],value:null,json:{write:!0}})],Mn.prototype,"stops",null),y([w({type:["outline"],json:{write:!0}})],Mn.prototype,"target",void 0),y([w({type:String,readOnly:!0})],Mn.prototype,"transformationType",null),y([w({type:["size"],json:{type:["sizeInfo"]}})],Mn.prototype,"type",void 0),y([w({type:Boolean,json:{write:!0,origins:{"web-map":{read:!1}}}})],Mn.prototype,"useSymbolValue",void 0),y([w({type:String,json:{write:!0}})],Mn.prototype,"valueExpression",void 0),y([$t("valueExpression",["valueExpression","expression"])],Mn.prototype,"readValueExpression",null),y([Pt("web-scene","valueExpression")],Mn.prototype,"writeValueExpressionWebScene",null),y([w({type:["radius","diameter","area","width","distance"],json:{write:!0}})],Mn.prototype,"valueRepresentation",void 0),y([w({type:TK.apiValues,json:{write:TK.write,origins:{"web-map":{read:!1},"web-scene":{write:!0},"portal-item":{write:!0}}}})],Mn.prototype,"valueUnit",void 0),y([$t("valueUnit")],Mn.prototype,"readValueUnit",null),Mn=SK=y([Z("esri.renderers.visualVariables.SizeVariable")],Mn);const Yse=Mn,Rnt={color:AOe,size:Yse,opacity:MOe,rotation:OOe},Int=new yn({colorInfo:"color",transparencyInfo:"opacity",rotationInfo:"rotation",sizeInfo:"size"}),$nt=/^\[([^\]]+)\]$/i;let q7=class extends ze{constructor(){super(...arguments),this.colorVariables=null,this.opacityVariables=null,this.rotationVariables=null,this.sizeVariables=null}set visualVariables(e){if(this._resetVariables(),e=e&&e.filter(i=>!!i),e==null?void 0:e.length){for(const i of e)switch(i.type){case"color":this.colorVariables.push(i);break;case"opacity":this.opacityVariables.push(i);break;case"rotation":this.rotationVariables.push(i);break;case"size":this.sizeVariables.push(i)}this.sizeVariables.length&&this.sizeVariables.some(i=>!!i.target)&&e.sort((i,r)=>{let n=null;return n=i.target===r.target?0:i.target?1:-1,n});for(let i=0;i{const f=Int.read(c.type),_=Rnt[f];_||(Ce.getLogger(this).warn(`Unknown variable type: ${f}`),r!=null&&r.messages&&r.messages.push(new Uf("visual-variable:unsupported",`visualVariable of type '${f}' is not supported`,{definition:c,context:r})));const x=new _;return x.read(c,r),x})}writeVariables(e,i){const r=[];for(const n of e){const s=n.toJSON(i);s&&r.push(s)}return r}_resetVariables(){this.colorVariables=[],this.opacityVariables=[],this.rotationVariables=[],this.sizeVariables=[]}};y([w()],q7.prototype,"visualVariables",null),q7=y([Z("esri.renderers.visualVariables.VisualVariableFactory")],q7);const Lnt=q7,Dnt={base:z9,key:"type",typeMap:{opacity:MOe,color:AOe,rotation:OOe,size:Yse}},pP=t=>{let e=class extends t{constructor(){super(...arguments),this._vvFactory=new Lnt}set visualVariables(i){this._vvFactory.visualVariables=i,this._set("visualVariables",this._vvFactory.visualVariables)}readVisualVariables(i,r,n){return this._vvFactory.readVariables(i,r,n)}writeVisualVariables(i,r,n,s){r[n]=this._vvFactory.writeVariables(i,s)}get arcadeRequiredForVisualVariables(){if(!this.visualVariables)return!1;for(const i of this.visualVariables)if(i.arcadeRequired)return!0;return!1}hasVisualVariables(i,r){return i?this.getVisualVariablesForType(i,r).length>0:this.getVisualVariablesForType("size",r).length>0||this.getVisualVariablesForType("color",r).length>0||this.getVisualVariablesForType("opacity",r).length>0||this.getVisualVariablesForType("rotation",r).length>0}getVisualVariablesForType(i,r){const n=this.visualVariables;return n?n.filter(s=>s.type===i&&(typeof r=="string"?s.target===r:r!==!1||!s.target)):[]}async collectVVRequiredFields(i,r){let n=[];this.visualVariables&&(n=n.concat(this.visualVariables));for(const s of n)s&&(s.field&&fp(i,r,s.field),s.normalizationField&&fp(i,r,s.normalizationField),s.valueExpression&&(Nnt(s.valueExpression,i,r)||await eh(i,r,s.valueExpression)))}};return y([w({types:[Dnt],value:null,json:{write:!0}})],e.prototype,"visualVariables",null),y([$t("visualVariables",["visualVariables","rotationType","rotationExpression"])],e.prototype,"readVisualVariables",null),y([Pt("visualVariables")],e.prototype,"writeVisualVariables",null),e=y([Z("esri.renderers.mixins.VisualVariablesMixin")],e),e};function Nnt(t,e,i){const r=fnt(t);return r!=null&&(fp(e,i,r),!0)}function Fnt(t){return kOe(t)||knt(t)}function W7(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type==="feature"}function knt(t){return(t==null?void 0:t.type)==="scene"}function znt(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type==="subtype-group"&&"sublayers"in t}function kOe(t){const e=t==null?void 0:t.type;return e==="imagery-tile"||e==="tile"||e==="open-street-map"||e==="vector-tile"||e==="web-tile"||e==="wmts"}function oO(t){const e=t==null?void 0:t.type;return e==="base-tile"||e==="tile"||e==="elevation"||e==="imagery-tile"||e==="base-elevation"||e==="open-street-map"||e==="wcs"||e==="web-tile"||e==="wmts"||e==="vector-tile"}function QO(t){return t!=null&&"type"in t&&t.type==="group"}const fJt={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function zOe(t){const e=t==null?void 0:t.type;return e==="building-scene"||e==="integrated-mesh"||e==="point-cloud"||e==="scene"}function Rpe(t){return(t==null?void 0:t.type)==="voxel"}function Ipe(t){return(t==null?void 0:t.type)==="imagery-tile"}function Y7(t){return(t==null?void 0:t.parent)!=null&&"declaredClass"in t.parent&&t.parent.declaredClass==="esri.Basemap"&&t.parent.baseLayers.includes(t)}function GB(t){var e;return(t==null?void 0:t.type)==="feature"&&!t.url&&((e=t.source)==null?void 0:e.type)==="memory"}function mJt(t){var e;return((t==null?void 0:t.type)==="feature"||(t==null?void 0:t.type)==="subtype-group")&&((e=t.source)==null?void 0:e.type)==="feature-layer"}function Unt(t){if(t.activeLayer){const e=t.activeLayer.tileMatrixSet;if(e)return e;const i=t.activeLayer.tileMatrixSets;if(i)return i}return null}async function UOe(t,e){const i=yr==null?void 0:yr.findServerInfo(t);if((i==null?void 0:i.currentVersion)!=null)return i.owningSystemUrl||null;const r=t.toLowerCase().indexOf("/rest/services");if(r===-1)return null;const n=`${t.substring(0,r)}/rest/info`,s=e!=null?e.signal:null,{data:o}=await bi(n,{query:{f:"json"},responseType:"json",signal:s});return(o==null?void 0:o.owningSystemUrl)||null}function Vnt(t){if(!("capabilities"in t))return!1;switch(t.type){case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function Bnt(t){return Vnt(t)?"effectiveCapabilities"in t?t.effectiveCapabilities:t.capabilities:null}function jnt(t){if(!("editingEnabled"in t))return!1;switch(t.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function Gnt(t){return!!jnt(t)&&("effectiveEditingEnabled"in t?t.effectiveEditingEnabled:t.editingEnabled)}const _A={retainId:!1,ignoreDrivers:!1,hasLabelingContext:!0};function e5(t,e=_A){var l,c;if(!t)return{symbol:null};const{retainId:i=_A.retainId,ignoreDrivers:r=_A.ignoreDrivers,hasLabelingContext:n=_A.hasLabelingContext,retainCIM:s=_A.retainCIM}=e;let o=null;if(Hy(t)||t instanceof gE)o=t.clone();else if(t.type==="cim"){const f=(c=(l=t.data)==null?void 0:l.symbol)==null?void 0:c.type;if(f!=="CIMPointSymbol")return{error:new se("symbol-conversion:unsupported-cim-symbol",`CIM symbol of type '${f||"unknown"}' is unsupported in 3D`,{symbol:t})};o=s?t.clone():t2.fromCIMSymbol(t)}else if(t instanceof Oc)o=UB.fromSimpleLineSymbol(t);else if(t instanceof cu)o=t2.fromSimpleMarkerSymbol(t);else if(t instanceof dP)o=t2.fromPictureMarkerSymbol(t);else if(t instanceof Bm)o=e.geometryType&&e.geometryType==="mesh"?F9.fromSimpleFillSymbol(t):k9.fromSimpleFillSymbol(t);else{if(!(t instanceof mE))return{error:new se("symbol-conversion:unsupported-2d-symbol",`2D symbol of type '${t.type||t.declaredClass}' is unsupported in 3D`,{symbol:t})};o=n?zB.fromTextSymbol(t):t2.fromTextSymbol(t)}return i&&o&&o.type!=="cim"&&(o.id=t.id),r&&Hy(o)&&o.symbolLayers.forEach(f=>f.ignoreDrivers=!0),{symbol:o}}function qz(t,e,i,r){const n=VOe(t,{},{context:r,isLabelSymbol:!1});n!=null&&(e[i]=n)}function $pe(t,e,i,r){const n=VOe(t,{},{context:r,isLabelSymbol:!0});n!=null&&(e[i]=n)}function Lpe(t){return t instanceof hP||t instanceof gE}function VOe(t,e,i){if(t==null)return null;const{context:r,isLabelSymbol:n}=i,s=r==null?void 0:r.origin,o=r==null?void 0:r.messages;if(s==="web-scene"&&!Lpe(t)){const l=e5(t,{retainCIM:!0,hasLabelingContext:n});return l.symbol!=null?l.symbol.write(e,r):(o==null||o.push(new se("symbol:unsupported",`Symbols of type '${t.declaredClass}' are not supported in scenes. Use 3D symbology instead when working with WebScene and SceneView`,{symbol:t,context:r,error:l.error})),null)}return(s==="web-map"||s==="portal-item"&&!zOe(r==null?void 0:r.layer))&&Lpe(t)?(o==null||o.push(new se("symbol:unsupported",`Symbols of type '${t.declaredClass}' are not supported in web maps and portal items. Use 2D symbology and CIMSymbol instead when working with MapView`,{symbol:t,context:r})),null):t.write(e,r)}function BOe(t,e){return ent(t,null,e)}const HB={types:wOe,json:{write:{writer:qz},origins:{"web-scene":{types:_pe,write:{writer:qz},read:{reader:Z5({types:_pe})}}}}},Xse=Yre({json:{origins:{"web-scene":{write:{isRequired:!0}}}}},HB),jOe={types:{base:fd,key:"type",typeMap:{"simple-fill":py.typeMap["simple-fill"],"picture-fill":py.typeMap["picture-fill"],"polygon-3d":py.typeMap["polygon-3d"]}},json:{write:{writer:qz},origins:{"web-scene":{type:k9,write:{writer:qz}}}}},X7={cast:t=>t==null||typeof t=="string"||typeof t=="number"?t:`${t}`,json:{type:String,write:{writer:(t,e)=>{e.value=t==null?void 0:t.toString()}}}};var EK;let Zb=EK=class extends Ue{constructor(t){super(t),this.description=null,this.label=null,this.minValue=null,this.maxValue=0,this.symbol=null}clone(){return new EK({description:this.description,label:this.label,minValue:this.minValue,maxValue:this.maxValue,symbol:this.symbol?this.symbol.clone():null})}getMeshHash(){const t=JSON.stringify(this.symbol);return`${this.minValue}.${this.maxValue}.${t}`}};y([w({type:String,json:{write:!0}})],Zb.prototype,"description",void 0),y([w({type:String,json:{write:!0}})],Zb.prototype,"label",void 0),y([w({type:Number,json:{read:{source:"classMinValue"},write:{target:"classMinValue"}}})],Zb.prototype,"minValue",void 0),y([w({type:Number,json:{read:{source:"classMaxValue"},write:{target:"classMaxValue"}}})],Zb.prototype,"maxValue",void 0),y([w(Xse)],Zb.prototype,"symbol",void 0),Zb=EK=y([Z("esri.renderers.support.ClassBreakInfo")],Zb);const Wz=Zb;var CK;const GOe="log",Z7="percent-of-total",J7="field",eD=new yn({esriNormalizeByLog:GOe,esriNormalizeByPercentOfTotal:Z7,esriNormalizeByField:J7}),Hnt=$s(Wz);let Da=CK=class extends pP(L_){constructor(t){super(t),this._compiledValueExpression={valueExpression:null,compiledFunction:null},this.backgroundFillSymbol=null,this.classBreakInfos=null,this.defaultLabel=null,this.defaultSymbol=null,this.field=null,this.isMaxInclusive=!0,this.legendOptions=null,this.normalizationField=null,this.normalizationTotal=null,this.type="class-breaks",this.valueExpression=null,this.valueExpressionTitle=null,this._set("classBreakInfos",[])}readClassBreakInfos(t,e,i){if(!Array.isArray(t))return;let r=e.minValue;return t.map(n=>{const s=new Wz;return s.read(n,i),s.minValue==null&&(s.minValue=r),s.maxValue==null&&(s.maxValue=s.minValue),r=s.maxValue,s})}writeClassBreakInfos(t,e,i,r){const n=t.map(s=>s.write({},r));this._areClassBreaksConsecutive()&&n.forEach(s=>delete s.classMinValue),e[i]=n}castField(t){return t==null?t:typeof t=="function"?(Ce.getLogger(this).error(".field: field must be a string value"),null):y9(t)}get minValue(){return this.classBreakInfos&&this.classBreakInfos[0]&&this.classBreakInfos[0].minValue||0}get normalizationType(){let t=this._get("normalizationType");const e=!!this.normalizationField,i=this.normalizationTotal!=null;return e||i?(t=e&&J7||i&&Z7||null,e&&i&&Ce.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):t!==J7&&t!==Z7||(t=null),t}set normalizationType(t){this._set("normalizationType",t)}addClassBreakInfo(t,e,i){let r=null;r=typeof t=="number"?new Wz({minValue:t,maxValue:e,symbol:xOe(i)}):Hnt(Re(t)),this.classBreakInfos.push(r),this.classBreakInfos.length===1&&this.notifyChange("minValue")}removeClassBreakInfo(t,e){const i=this.classBreakInfos.length;for(let r=0;r-1?this.classBreakInfos[i].symbol:this.defaultSymbol}async getSymbolAsync(t,e){let i=e;if(this.valueExpression&&(e==null?void 0:e.arcade)==null){const n=await p_(),{arcadeUtils:s}=n;s.hasGeometryOperations(this.valueExpression)&&await s.enableGeometryOperations(),i={...i,arcade:n}}const r=this.getBreakIndex(t,i);return r>-1?this.classBreakInfos[r].symbol:this.defaultSymbol}getSymbols(){const t=[];return this.classBreakInfos.forEach(e=>{e.symbol&&t.push(e.symbol)}),this.defaultSymbol&&t.push(this.defaultSymbol),t}getAttributeHash(){return this.visualVariables&&this.visualVariables.reduce((t,e)=>t+e.getAttributeHash(),"")}getMeshHash(){const t=JSON.stringify(this.backgroundFillSymbol),e=JSON.stringify(this.defaultSymbol),i=`${this.normalizationField}.${this.normalizationType}.${this.normalizationTotal}`;return`${t}.${e}.${this.classBreakInfos.reduce((r,n)=>r+n.getMeshHash(),"")}.${i}.${this.field}.${this.valueExpression}`}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}clone(){var t,e;return new CK({field:this.field,backgroundFillSymbol:(t=this.backgroundFillSymbol)==null?void 0:t.clone(),defaultLabel:this.defaultLabel,defaultSymbol:(e=this.defaultSymbol)==null?void 0:e.clone(),valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,classBreakInfos:Re(this.classBreakInfos),isMaxInclusive:this.isMaxInclusive,normalizationField:this.normalizationField,normalizationTotal:this.normalizationTotal,normalizationType:this.normalizationType,visualVariables:Re(this.visualVariables),legendOptions:Re(this.legendOptions),authoringInfo:this.authoringInfo&&this.authoringInfo.clone()})}async collectRequiredFields(t,e){const i=[this.collectVVRequiredFields(t,e),this.collectSymbolFields(t,e)];await Promise.all(i)}async collectSymbolFields(t,e){const i=[...this.getSymbols().map(r=>r.collectRequiredFields(t,e)),eh(t,e,this.valueExpression)];fp(t,e,this.field),fp(t,e,this.normalizationField),await Promise.all(i)}_getBreakIndexForExpression(t,e){const{viewingMode:i,scale:r,spatialReference:n,arcade:s,timeZone:o}=e??{},{valueExpression:l}=this;let c=this._compiledValueExpression.valueExpression===l?this._compiledValueExpression.compiledFunction:null;const f=s.arcadeUtils;if(!c){const x=f.createSyntaxTree(l);c=f.createFunction(x),this._compiledValueExpression.compiledFunction=c}this._compiledValueExpression.valueExpression=l;const _=f.executeFunction(c,f.createExecContext(t,f.getViewInfo({viewingMode:i,scale:r,spatialReference:n}),o));return this._getBreakIndexfromInfos(_)}_getBreakIndexForField(t){const e=this.field,i=t.attributes,r=this.normalizationType;let n=parseFloat(i[e]);if(r){const s=this.normalizationTotal,o=parseFloat(this.normalizationField?i[this.normalizationField]:void 0);if(r===GOe)n=Math.log(n)*Math.LOG10E;else if(r!==Z7||s==null||isNaN(s)){if(r===J7&&!isNaN(o)){if(isNaN(n)||isNaN(o))return-1;n/=o}}else n=n/s*100}return this._getBreakIndexfromInfos(n)}_getBreakIndexfromInfos(t){const e=this.isMaxInclusive;if(t!=null&&typeof t=="number"&&!isNaN(t))for(let i=0;iVh(t),json:{write:!0}})],Da.prototype,"normalizationTotal",void 0),y([w({type:eD.apiValues,value:null,json:{type:eD.jsonValues,read:eD.read,write:eD.write}})],Da.prototype,"normalizationType",null),y([Vt({classBreaks:"class-breaks"})],Da.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],Da.prototype,"valueExpression",void 0),y([w({type:String,json:{write:!0}})],Da.prototype,"valueExpressionTitle",void 0),Da=CK=y([Z("esri.renderers.ClassBreaksRenderer")],Da);const HOe=Da,t$=-3;var nm;(function(t){t[t.ALL=0]="ALL",t[t.SOME=1]="SOME"})(nm||(nm={}));let qnt=class{constructor(e,i,r){this.name=e,this._storage=i,this.id=Wnt+++":",this.size=0,this.maxSize=0,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),r&&(this._storage.registerRemoveFunc(this.id,r),this._removeFunc=!0)}destroy(){this._storage.clear(this),this._removeFunc&&this._storage.deregisterRemoveFunc(this.id),this._storage.deregister(this),this._storage=null}get hitRate(){return this._hit/(this._hit+this._miss)}get sizeAll(){return this._storage.size}resetHitRate(){this._hit=this._miss=0}put(e,i,r,n=0){this._storage.put(this,e,i,r,n)}get(e){const i=this._storage.get(this,e);return i===void 0?++this._miss:++this._hit,i}peek(e){return this._storage.peek(this,e)}pop(e){const i=this._storage.pop(this,e);return i===void 0?++this._miss:++this._hit,i}updateSize(e,i,r){this._storage.updateSize(this,e,i,r)}clear(){this._storage.clear(this)}clearAll(){this._storage.clearAll()}get performanceInfo(){return this._storage.performanceInfo}resetStats(){this._storage.resetStats()}},qOe=class{get size(){return this._size}constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new Pi,this._users=new Pi}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(e){this._users.push(e)}deregister(e){this._users.removeUnordered(e)}registerRemoveFunc(e,i){this._removeFuncs.push([e,i])}deregisterRemoveFunc(e){this._removeFuncs.filterInPlace(i=>i[0]!==e)}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=Math.max(e,0),this._checkSizeLimits()}put(e,i,r,n,s){i=e.id+i;const o=this._db.get(i);if(o&&(this._size-=o.size,e.size-=o.size,this._db.delete(i),o.entry!==r&&this._notifyRemove(i,o.entry,nm.ALL)),n>this._maxSize)return void this._notifyRemove(i,r,nm.ALL);if(r===void 0)return void console.warn("Refusing to cache undefined entry ");if(!n||n<0)return console.warn(`Refusing to cache entry with size ${n} for key ${i}`),void this._notifyRemove(i,r,nm.ALL);const l=1+Math.max(s,t$)-t$;this._db.set(i,{entry:r,size:n,lifetime:l,lives:l}),this._size+=n,e.size+=n,this._checkSizeLimits()}updateSize(e,i,r,n){i=e.id+i;const s=this._db.get(i);if(s&&s.entry===r){for(this._size-=s.size,e.size-=s.size;n>this._maxSize;){const o=this._notifyRemove(i,r,nm.SOME);if(!(o!=null&&o>0))return void this._db.delete(i);n=o}s.size=n,this._size+=n,e.size+=n,this._checkSizeLimits()}}pop(e,i){i=e.id+i;const r=this._db.get(i);if(r)return this._size-=r.size,e.size-=r.size,this._db.delete(i),++this._hit,r.entry;++this._miss}get(e,i){i=e.id+i;const r=this._db.get(i);if(r!==void 0)return this._db.delete(i),r.lives=r.lifetime,this._db.set(i,r),++this._hit,r.entry;++this._miss}peek(e,i){const r=this._db.get(e.id+i);return r?++this._hit:++this._miss,r==null?void 0:r.entry}get performanceInfo(){const e={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},i={},r=new Array;this._db.forEach((o,l)=>{const c=o.lifetime;r[c]=(r[c]||0)+o.size,this._users.forAll(f=>{const{id:_,name:x}=f;if(l.startsWith(_)){const T=i[x]||0;i[x]=T+o.size}})});const n={};this._users.forAll(o=>{const l=o.name;if("hitRate"in o&&typeof o.hitRate=="number"&&!isNaN(o.hitRate)&&o.hitRate>0){const c=i[l]||0;i[l]=c,n[l]=Math.round(100*o.hitRate)+"%"}else n[l]="0%"});const s=Object.keys(i);s.sort((o,l)=>i[l]-i[o]),s.forEach(o=>e[o]=Math.round(i[o]/2**20)+"MB / "+n[o]);for(let o=r.length-1;o>=0;--o){const l=r[o];l&&(e["Priority "+(o+t$-1)]=Math.round(l/this._size*100)+"%")}return e}resetStats(){this._hit=this._miss=0,this._users.forAll(e=>e.resetHitRate())}clear(e){const i=e.id;this._db.forEach((r,n)=>{n.startsWith(i)&&(this._size-=r.size,this._db.delete(n),this._notifyRemove(n,r.entry,nm.ALL))}),e.size=0}clearAll(){this._db.forEach((e,i)=>this._notifyRemove(i,e.entry,nm.ALL)),this._users.forEach(e=>e.size=0),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(e,i,r){let n;return this._removeFuncs.some(s=>{if(e.startsWith(s[0])){const o=s[1](i,r);return typeof o=="number"&&(n=o),!0}return!1}),n}_checkSizeLimits(){if(this._size>this._maxSize){for(const[e,i]of this._db)if(this._purgeItem(e,i),this._size<=.9*this.maxSize)return}this._users.forEach(e=>{if(e.maxSize>0&&e.size>e.maxSize){for(const[i,r]of this._db)if(i.startsWith(e.id)&&(this._purgeItem(i,r,e),e.size<=.9*e.maxSize))return}})}_purgeItem(e,i,r=this._users.find(n=>e.startsWith(n.id))){if(this._db.delete(e),i.lives<=1){this._size-=i.size,r&&(r.size-=i.size);const n=this._notifyRemove(e,i.entry,nm.SOME);n!=null&&n>0&&(this._size+=n,r&&(r.size+=n),i.lives=i.lifetime,i.size=n,this._db.set(e,i))}else--i.lives,this._db.set(e,i)}},Wnt=0,qB=class{constructor(e,i){this._storage=new qOe,this.id="",this.name="",this.size=0,this._storage.maxSize=e,this._storage.register(this),i&&this._storage.registerRemoveFunc("",i)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(e,i,r=1){this._storage.put(this,e,i,r,1)}pop(e){return this._storage.pop(this,e)}get(e){return this._storage.get(this,e)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(e){this._storage.maxSize=e}resetHitRate(){}},$2=class{constructor(e,i,r=""){this.major=e,this.minor=i,this._context=r}lessThan(e,i){return this.majorwp.create(i)):null}isDateField(e){return this._dateFieldsSet.has(this.get(e))}isTimeOnlyField(e){return CMe(this.get(e))}isNumericField(e){return this._numericFieldsSet.has(this.get(e))}normalizeFieldName(e){var i;return((i=this.get(e))==null?void 0:i.name)??void 0}toJSON(){return{fields:this.fields.map(e=>sz(e)?e.toJSON():e),timeZoneByFieldName:this._timeZoneByFieldName?Array.from(this._timeZoneByFieldName.entries()):null}}};function ES(t){return t.trim().toLowerCase()}function Dpe(t){var e;return((e=ait(t))==null?void 0:e.toLowerCase())??""}const WOe=new Set(["time-only","date-only","timestamp-offset","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]);function Npe(t){const e=new Map;if(!t.fields)return e;const i=t.datesInUnknownTimezone===!0,{timeInfo:r,editFieldsInfo:n}=t,s=(r?"startField"in r?r.startField:r.startTimeField:"")??"",o=(r?"endField"in r?r.endField:r.endTimeField:"")??"",l=Jnt(t)?t.dateFieldsTimeZone??null:t.dateFieldsTimeReference?y7(t.dateFieldsTimeReference):null,c=n?Xnt(n)?n.timeZone??l:n.dateFieldsTimeReference?y7(n.dateFieldsTimeReference):l??Vy:null,f=r?Znt(r)?r.timeZone??l:r.timeReference?y7(r.timeReference):l:null,_=new Map([[ES((n==null?void 0:n.creationDateField)??""),c],[ES((n==null?void 0:n.editDateField)??""),c],[ES(s),f],[ES(o),f]]);for(const{name:x,type:T}of t.fields)if(WOe.has(T))e.set(x,OT);else if(T!=="date"&&T!=="esriFieldTypeDate")e.set(x,null);else if(i)e.set(x,OT);else{const A=_.get(ES(x??""))??l;e.set(x,A)}return e}const Fpe="esri.renderers.support.DictionaryLoader",Qnt={type:"CIMSimpleLineCallout",lineSymbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",width:.5,color:[0,0,0,255]}]}};let Jse=class{constructor(e,i,r){this.config=null,this.fieldMap=null,this.url=null,this._ongoingRequests=new Map,this._symbolCache=new qB(100),this._dictionaryVersion=null,this._fieldIndex=null,this._dictionaryPromise=null,this.url=e,this.config=i,this.fieldMap=r}getSymbolFields(){return this._symbolFields}async getSymbolAsync(e,i){let r;this._dictionaryPromise||(this._dictionaryPromise=this.fetchResources(i));try{r=await this._dictionaryPromise}catch(M){if(sn(M))return this._dictionaryPromise=null,null}const n=this._dictionaryVersion&&this._dictionaryVersion.since(4,0),s={};if(this.fieldMap)for(const M of this._symbolFields){const I=this._getFieldName(this.fieldMap[M]);if(I){const L=e.attributes[I];s[M]=n?L:L!=null?""+e.attributes[I]:""}else s[M]=""}let o=null;try{o=r==null?void 0:r(s,i)}catch{return null}if(!o||typeof o!="string")return null;const l=Zre(o).toString(),c=this._symbolCache.get(l);if(c)return c.catch(()=>{this._symbolCache.pop(l)}),c;const f=o.split(";"),_=[],x=[];for(const M of f)if(M)if(M.includes("po:")){const I=M.substr(3).split("|");if(I.length===3){const L=I[0],F=I[1];let z=I[2];if(F==="DashTemplate")z=z.split(" ").map(k=>Number(k));else if(F==="Color"){const k=new qe(z).toRgba();z=[k[0],k[1],k[2],255*k[3]]}else z=Number(z);x.push({primitiveName:L,propertyName:F,value:z})}}else if(M.includes("|")){for(const I of M.split("|"))if(this._itemNames.has(I)){_.push(I);break}}else this._itemNames.has(M)&&_.push(M);const T=e.geometry==null||!e.geometry.hasZ&&e.geometry.type==="point",A=this._cimPartsToCIMSymbol(_,x,T,i);return this._symbolCache.put(l,A,1),A}async fetchResources(e){if(this._dictionaryPromise)return this._dictionaryPromise;if(!this.url)return void Ce.getLogger(Fpe).error("no valid URL!");const i=bi(this.url+"/resources/styles/dictionary-info.json",{responseType:"json",query:{f:"json"},signal:e!=null?e.signal:null}),[{data:r}]=await Promise.all([i,p_()]);if(!r)throw this._dictionaryPromise=null,new se("esri.renderers.DictionaryRenderer","Bad dictionary data!");const{authoringInfo:n,dictionary_version:s,expression:o,itemsNames:l}=r,c=o;let f=!1;s&&(this._dictionaryVersion=$2.parse(s),f=this._dictionaryVersion.since(4,0)),this._refSymbolUrlTemplate=this.url+"/"+r.cimRefTemplateUrl,this._itemNames=new Set(l),this._symbolFields=n.symbol;const _={};if(this.config){const A=this.config;for(const M in A)_[M]=A[M]}if(n.configuration)for(const A of n.configuration)_.hasOwnProperty(A.name)||(_[A.name]=A.value);const x=[];if(e!=null&&e.fields&&this.fieldMap)for(const A of this._symbolFields){const M=this.fieldMap[A],I=e.fields.filter(L=>L.name.toLowerCase()===(M==null?void 0:M.toLowerCase()));I.length>0&&x.push({...I[0],type:f?I[0].type:"esriFieldTypeString"})}x.length>0&&(this._fieldIndex=new Zse(x));const T=nit(c,e!=null?e.spatialReference:null,x,_).then(A=>{const M={scale:0};return(I,L)=>{if(A==null)return null;const F=A.repurposeFeature({geometry:null,attributes:I});return M.scale=L!=null?L.scale??void 0:void 0,A.evaluate({$feature:F,$view:M},A.services)}}).catch(A=>(Ce.getLogger(Fpe).error("Creating dictinoary expression failed:",A),null));return this._dictionaryPromise=T,T}async _cimPartsToCIMSymbol(e,i,r,n){const s=new Array(e.length);for(let c=0;cs.data);const r=this._refSymbolUrlTemplate.replaceAll(/\{itemName\}/gi,e),n=bi(r,{responseType:"json",query:{f:"json"},...i});this._ongoingRequests.set(e,n);try{return(await n).data}catch(s){throw this._ongoingRequests.delete(e),s}}_combineSymbolParts(e,i,r){if(!e||e.length===0)return null;const n={...e[0]};if(e.length>1){n.symbolLayers=[];for(const s of e){const o=s;n.symbolLayers.unshift(...o.symbolLayers)}}return r&&(n.callout=Qnt),{type:"CIMSymbolReference",symbol:n,primitiveOverrides:i}}_getFieldName(e){if(this._fieldIndex!==null){const i=this._fieldIndex.get(e);return i?i.name:e}return e}};function YOe(t,e){if(!t)return;const i=t.symbolLayers;if(!i)return;let r=i.length;for(;r--;){const n=i[r];n&&n.enable!==!1&&n.type==="CIMVectorMarker"&&est(n,e)}}function est(t,e){const i=t.markerGraphics;if(i)for(const r of i){if(!r)continue;const n=r.symbol;if(n)switch(n.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":YOe(n,e);break;case"CIMTextSymbol":n.fieldMap=e}}}const SJt=Object.freeze(Object.defineProperty({__proto__:null,DictionaryLoader:Jse},Symbol.toStringTag,{value:"Module"}));var AK;let R0=AK=class extends pP(L_){constructor(t){super(t),this.config=null,this.fieldMap=null,this.scaleExpression=null,this.scaleExpressionTitle=null,this.url=null,this.type="dictionary"}get _loader(){return new Jse(this.url,this.config,this.fieldMap)}writeData(t,e){t&&(e.scalingExpressionInfo={expression:t,returnType:"number"})}writeVisualVariables(t,e,i,r){r!=null&&r.origin||super.writeVisualVariables(t,e,i,r)}clone(){return new AK({config:Re(this.config),scaleExpression:this.scaleExpression,scaleExpressionTitle:this.scaleExpressionTitle,fieldMap:Re(this.fieldMap),url:Re(this.url),visualVariables:Re(this.visualVariables)})}async getSymbolAsync(t,e){return this._loader.getSymbolAsync(t,e)}async collectRequiredFields(t,e){await this.collectVVRequiredFields(t,e),this.scaleExpression&&await eh(t,e,this.scaleExpression);for(const i in this.fieldMap){const r=this.fieldMap[i];e.has(r)&&t.add(r)}}get arcadeRequired(){return!0}getSymbol(){return null}getSymbols(){return[]}getAttributeHash(){return this.visualVariables&&this.visualVariables.reduce((t,e)=>t+e.getAttributeHash(),"")}getMeshHash(){return`${this.url}-${JSON.stringify(this.fieldMap)}`}getSymbolFields(){return this._loader.getSymbolFields()}};y([w({type:Jse})],R0.prototype,"_loader",null),y([w({type:Object,json:{read:{source:"configuration"},write:{target:"configuration"}}})],R0.prototype,"config",void 0),y([w({type:Object,json:{write:!0}})],R0.prototype,"fieldMap",void 0),y([w({type:String,json:{read:{source:"scalingExpressionInfo.expression"},write:!0}})],R0.prototype,"scaleExpression",void 0),y([Pt("scaleExpression")],R0.prototype,"writeData",null),y([w({type:String,json:{read:{source:"scalingExpressionInfo.title"},write:{target:"scalingExpressionInfo.title",overridePolicy(t){return{enabled:!!t&&!!this.scaleExpression}}}}})],R0.prototype,"scaleExpressionTitle",void 0),y([w({type:String,json:{write:!0}})],R0.prototype,"url",void 0),y([Pt("visualVariables")],R0.prototype,"writeVisualVariables",null),R0=AK=y([Z("esri.renderers.DictionaryRenderer")],R0);const tst=R0;var MK;let Y1=MK=class extends Ue{constructor(t){super(t),this.color=null,this.field=null,this.label=null,this.valueExpression=null,this.valueExpressionTitle=null}castField(t){return t==null?t:typeof t=="function"?(Ce.getLogger(this).error(".field: field must be a string value"),null):y9(t)}getAttributeHash(){return`${this.field}-${this.valueExpression}`}clone(){var t;return new MK({color:(t=this.color)==null?void 0:t.clone(),field:this.field,label:this.label,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle})}};y([w({type:qe,json:{type:[Number],write:!0}})],Y1.prototype,"color",void 0),y([w({type:String,json:{write:!0}})],Y1.prototype,"field",void 0),y([Ci("field")],Y1.prototype,"castField",null),y([w({type:String,json:{write:!0}})],Y1.prototype,"label",void 0),y([w({type:String,json:{write:!0}})],Y1.prototype,"valueExpression",void 0),y([w({type:String,json:{write:!0}})],Y1.prototype,"valueExpressionTitle",void 0),Y1=MK=y([Z("esri.renderers.support.AttributeColorInfo")],Y1);const XOe=Y1;var OK;let Q7=OK=class extends Ue{constructor(){super(...arguments),this.unit=null}clone(){return new OK({unit:this.unit})}};y([w({type:String,json:{write:!0}})],Q7.prototype,"unit",void 0),Q7=OK=y([Z("esri.renderers.support.DotDensityLegendOptions")],Q7);const ist=Q7;var PK;let Sh=PK=class extends pP(L_){constructor(t){super(t),this.attributes=null,this.backgroundColor=new qe([0,0,0,0]),this.dotBlendingEnabled=!0,this.dotShape="square",this.dotSize=1,this.legendOptions=null,this.outline=new Oc,this.dotValue=null,this.referenceScale=null,this.seed=1,this.type="dot-density"}calculateDotValue(t){if(this.referenceScale==null)return this.dotValue;const e=t/this.referenceScale*this.dotValue;return e<1?1:e}getSymbol(){return new Bm({outline:this.outline})}async getSymbolAsync(){return this.getSymbol()}getSymbols(){return[this.getSymbol()]}getAttributeHash(){var t;return((t=this.attributes)==null?void 0:t.reduce((e,i)=>e+i.getAttributeHash(),""))??""}getMeshHash(){return JSON.stringify(this.outline)}clone(){return new PK({attributes:Re(this.attributes),backgroundColor:Re(this.backgroundColor),dotBlendingEnabled:Re(this.dotBlendingEnabled),dotShape:Re(this.dotShape),dotSize:Re(this.dotSize),dotValue:Re(this.dotValue),legendOptions:Re(this.legendOptions),outline:Re(this.outline),referenceScale:Re(this.referenceScale),visualVariables:Re(this.visualVariables),authoringInfo:this.authoringInfo&&this.authoringInfo.clone()})}getControllerHash(){var e;return`${(e=this.attributes)==null?void 0:e.map(i=>i.field||i.valueExpression||"")}-${this.outline&&JSON.stringify(this.outline.toJSON())||""}`}async collectRequiredFields(t,e){await this.collectVVRequiredFields(t,e);for(const i of this.attributes??[])i.valueExpression&&await eh(t,e,i.valueExpression),i.field&&t.add(i.field)}};y([w({type:[XOe],json:{write:!0}})],Sh.prototype,"attributes",void 0),y([w({type:qe,json:{write:!0}})],Sh.prototype,"backgroundColor",void 0),y([w({type:Boolean,json:{write:!0}})],Sh.prototype,"dotBlendingEnabled",void 0),y([w({type:String,json:{write:!1}})],Sh.prototype,"dotShape",void 0),y([w({type:Number,json:{write:!0}})],Sh.prototype,"dotSize",void 0),y([w({type:ist,json:{write:!0}})],Sh.prototype,"legendOptions",void 0),y([w({type:Oc,json:{default:null,write:!0}})],Sh.prototype,"outline",void 0),y([w({type:Number,json:{write:!0}})],Sh.prototype,"dotValue",void 0),y([w({type:Number,json:{write:!0}})],Sh.prototype,"referenceScale",void 0),y([w({type:Number,json:{write:!0}})],Sh.prototype,"seed",void 0),y([Vt({dotDensity:"dot-density"})],Sh.prototype,"type",void 0),Sh=PK=y([Z("esri.renderers.DotDensityRenderer")],Sh);const rst=Sh;var RK;let T4=RK=class extends Ue{constructor(t){super(t),this.color=null,this.ratio=null}clone(){return new RK({color:this.color,ratio:this.ratio})}};y([w({type:qe,json:{type:[$n],default:null,write:!0}})],T4.prototype,"color",void 0),y([w({type:Number,json:{write:!0}})],T4.prototype,"ratio",void 0),T4=RK=y([Z("esri.renderers.support.HeatmapColorStop")],T4);const i$=T4;let bA=class extends Xs(Ue){constructor(){super(...arguments),this.minLabel=null,this.maxLabel=null,this.title=null}};y([w({type:String,json:{write:!0}})],bA.prototype,"minLabel",void 0),y([w({type:String,json:{write:!0}})],bA.prototype,"maxLabel",void 0),y([w({type:String,json:{write:!0}})],bA.prototype,"title",void 0),bA=y([Z("esri.renderers.support.HeatmapLegendOptions")],bA);function Xi(){return[0,0,0,0]}function U9(t){return[t[0],t[1],t[2],t[3]]}function Mi(t,e,i,r){return[t,e,i,r]}function YB(t,e=Xi()){const i=Math.min(4,t.length);for(let r=0;rl>=0&&l<=1).sort((l,c)=>l.ratio-c.ratio).map(({color:l,ratio:c})=>({color:l,ratio:Math.max(c,.001)})),t.length<1)return i;let r=t[0],n=t[0],s=1;const o=Xi();for(let l=0;l<512;l++){const c=(l+.5)/512;for(;c>n.ratio&&s=i+F||L.y<-F||L.y>r+F)continue;const z=+x(M),k=Math.max(0,Math.round(L.x)-l),U=Math.max(0,Math.round(L.y)-l),j=Math.min(r,Math.round(L.y)+l),H=Math.min(i,Math.round(L.x)+l);for(let Y=U;Y_&&(_=f)}}}return{matrix:c.buffer,max:_}}function hst(t,e,i){const r=Math.sqrt(t**2+e**2)/i;return r>1?0:3/(Math.PI*i**2)*(1-r**2)**2}function AJt(t,e){return typeof t=="function"?t:t?typeof e=="string"?i=>-1*+i[t]:i=>+i[t]+e:()=>1}function dst(t,e){return t!=null?typeof e=="string"?i=>-1*+i.readAttribute(t):i=>+i.readAttribute(t)+e:i=>1}var IK;const r5e="esri.renderers.HeatmapRenderer",pst=Ce.getLogger(r5e);function kpe(t){if(t!=null){const{maxDensity:e,minDensity:i,radius:r}=t;if(e!=null||i!=null||r!=null){const{blurRadius:n,maxPixelIntensity:s,minPixelIntensity:o,...l}=t;return l}}return t}let pl=IK=class extends L_{constructor(t){super(t),this.authoringInfo=null,this.colorStops=[new i$({ratio:0,color:new qe("rgba(255, 140, 0, 0)")}),new i$({ratio:.75,color:new qe("rgba(255, 140, 0, 1)")}),new i$({ratio:.9,color:new qe("rgba(255, 0, 0, 1)")})],this.field=null,this.fieldOffset=0,this.legendOptions=null,this.maxDensity=.04,this.minDensity=0,this.radius=18,this.referenceScale=0,this.type="heatmap",this.valueExpression=null,this.valueExpressionTitle=null,this._warnedProps={blurRadius:!1,maxPixelIntensity:!1,minPixelIntensity:!1}}normalizeCtorArgs(t){return kpe(t)}get blurRadius(){return cst(this.radius)}set blurRadius(t){const e=this.maxPixelIntensity,i=this.minPixelIntensity;this._set("radius",lst(t)),this._warnAboutDeprecatedGaussianBlurProp("blurRadius","radius"),this._set("maxDensity",e*this._pixelIntensityToDensity),this._set("minDensity",i*this._pixelIntensityToDensity)}get maxPixelIntensity(){return this.maxDensity/this._pixelIntensityToDensity}set maxPixelIntensity(t){this._set("maxDensity",t*this._pixelIntensityToDensity),this._warnAboutDeprecatedGaussianBlurProp("maxPixelIntensity","maxDensity")}get minPixelIntensity(){return this.minDensity/this._pixelIntensityToDensity}set minPixelIntensity(t){this._set("minDensity",t*this._pixelIntensityToDensity),this._warnAboutDeprecatedGaussianBlurProp("minPixelIntensity","minDensity")}get _pixelIntensityToDensity(){return 24/(Kse**2*this.blurRadius**4)}_warnAboutDeprecatedGaussianBlurProp(t,e){this._warnedProps[t]||Zl(this).getDefaultOrigin()==="user"&&(this._warnedProps[t]=!0,tx(()=>{pm(pst,t,{replacement:`${String(e)} (suggested value: ${this._get(e)})`,version:"4.24"})}))}read(t,e){t=kpe(t),super.read(t,e)}getSymbol(){return new cu}async getSymbolAsync(){return this.getSymbol()}getSymbols(){return[this.getSymbol()]}async collectRequiredFields(t,e){const i=this.field,r=this.valueExpression;i&&typeof i=="string"&&fp(t,e,i),r&&typeof r=="string"&&await eh(t,e,r)}getAttributeHash(){return null}getMeshHash(){return`${JSON.stringify(this.colorStops)}.${this.blurRadius}.${this.field}`}clone(){return new IK({authoringInfo:this.authoringInfo&&this.authoringInfo.clone(),colorStops:Re(this.colorStops),field:this.field,legendOptions:Re(this.legendOptions),maxDensity:this.maxDensity,minDensity:this.minDensity,radius:this.radius,referenceScale:this.referenceScale,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle})}};y([w({type:EOe,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],pl.prototype,"authoringInfo",void 0),y([w({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],pl.prototype,"blurRadius",null),y([w({type:[i$],json:{write:!0}})],pl.prototype,"colorStops",void 0),y([w({type:String,json:{write:!0}})],pl.prototype,"field",void 0),y([w({type:Number,json:{write:{overridePolicy:(t,e,i)=>({enabled:i==null})},origins:{"web-scene":{write:!1}}}})],pl.prototype,"fieldOffset",void 0),y([w({type:bA,json:{write:!0}})],pl.prototype,"legendOptions",void 0),y([w({type:Number,json:{write:!0}})],pl.prototype,"maxDensity",void 0),y([w({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],pl.prototype,"maxPixelIntensity",null),y([w({type:Number,json:{write:!0}})],pl.prototype,"minDensity",void 0),y([w({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],pl.prototype,"minPixelIntensity",null),y([w({type:Number,cast:vs,json:{write:!0}})],pl.prototype,"radius",void 0),y([w({type:Number,range:{min:0},json:{default:0,write:!0}})],pl.prototype,"referenceScale",void 0),y([Vt({heatmap:"heatmap"})],pl.prototype,"type",void 0),y([w({type:String,json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],pl.prototype,"valueExpression",void 0),y([w({type:String})],pl.prototype,"valueExpressionTitle",void 0),y([w({readOnly:!0})],pl.prototype,"_pixelIntensityToDensity",null),pl=IK=y([Z(r5e)],pl);const n5e=pl;let CS=class extends Xs(Ue){constructor(){super(...arguments),this.color=new qe([0,0,0,0]),this.label=null,this.threshold=0}};y([w({type:qe,json:{write:!0}})],CS.prototype,"color",void 0),y([w({type:String,json:{write:!0}})],CS.prototype,"label",void 0),y([w({type:Number,range:{min:0,max:1},json:{write:!0}})],CS.prototype,"threshold",void 0),CS=y([Z("esri.renderers.support.OthersCategory")],CS);let eF=class extends Xs(Ue){constructor(){super(...arguments),this.title=null}};y([w({type:String,json:{write:!0}})],eF.prototype,"title",void 0),eF=y([Z("esri.renderers.support.PieChartLegendOptions")],eF);let Od=class extends pP(Xs(L_)){constructor(e){super(e),this.attributes=null,this.backgroundFillSymbol=null,this.defaultColor=new qe([0,0,0,0]),this.defaultLabel=null,this.holePercentage=0,this.othersCategory=new CS,this.legendOptions=null,this.outline=null,this.size=12,this.type="pie-chart"}getSymbol(){var e;return new cu({size:this.size?this.size/2+(((e=this.outline)==null?void 0:e.width)||0):0})}async getSymbolAsync(){return this.getSymbol()}getSymbols(){return[this.getSymbol(),this.backgroundFillSymbol].filter(ys)}getAttributeHash(){return this.visualVariables&&this.visualVariables.reduce((e,i)=>e+i.getAttributeHash(),"")}getMeshHash(){return this.getSymbols().reduce((e,i)=>e+JSON.stringify(i),"")}async collectRequiredFields(e,i){await this.collectVVRequiredFields(e,i);for(const r of this.attributes)r.valueExpression&&await eh(e,i,r.valueExpression),r.field&&e.add(r.field)}};y([w({type:[XOe],json:{write:!0}})],Od.prototype,"attributes",void 0),y([w({type:Bm,json:{default:null,write:!0}})],Od.prototype,"backgroundFillSymbol",void 0),y([w({type:qe,json:{write:!0}})],Od.prototype,"defaultColor",void 0),y([w({type:String,json:{write:!0}})],Od.prototype,"defaultLabel",void 0),y([w({type:Number,range:{min:0,max:1},json:{write:!0}})],Od.prototype,"holePercentage",void 0),y([w({type:CS,json:{write:!0}})],Od.prototype,"othersCategory",void 0),y([w({type:eF,json:{write:!0}})],Od.prototype,"legendOptions",void 0),y([w({type:Oc,json:{default:null,write:!0}})],Od.prototype,"outline",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Od.prototype,"size",void 0),y([Vt({pieChart:"pie-chart"})],Od.prototype,"type",void 0),Od=y([Z("esri.renderers.PieChartRenderer")],Od);const fst=Od;var $K;let P3=$K=class extends pP(L_){constructor(t){super(t),this.description=null,this.label=null,this.symbol=null,this.type="simple"}async collectRequiredFields(t,e){await Promise.all([this.collectSymbolFields(t,e),this.collectVVRequiredFields(t,e)])}async collectSymbolFields(t,e){await Promise.all(this.getSymbols().map(i=>i.collectRequiredFields(t,e)))}getSymbol(t,e){return this.symbol}async getSymbolAsync(t,e){return this.symbol}getSymbols(){return this.symbol?[this.symbol]:[]}getAttributeHash(){return this.visualVariables&&this.visualVariables.reduce((t,e)=>t+e.getAttributeHash(),"")}getMeshHash(){return this.getSymbols().reduce((t,e)=>t+JSON.stringify(e),"")}get arcadeRequired(){return this.arcadeRequiredForVisualVariables}clone(){return new $K({description:this.description,label:this.label,symbol:this.symbol&&this.symbol.clone(),visualVariables:Re(this.visualVariables),authoringInfo:this.authoringInfo&&this.authoringInfo.clone()})}};y([w({type:String,json:{write:!0}})],P3.prototype,"description",void 0),y([w({type:String,json:{write:!0}})],P3.prototype,"label",void 0),y([w(Xse)],P3.prototype,"symbol",void 0),y([Vt({simple:"simple"})],P3.prototype,"type",void 0),P3=$K=y([Z("esri.renderers.SimpleRenderer")],P3);const Qse=P3,mst=new Set(["esri.Color","esri.portal.Portal","esri.symbols.support.Symbol3DAnchorPosition2D","esri.symbols.support.Symbol3DAnchorPosition3D"]);function LK(t){return t instanceof ze}function zpe(t){return t instanceof it?Object.keys(t.items):LK(t)?Zl(t).keys():t?Object.keys(t):[]}function tD(t,e){return t instanceof it?t.items[e]:t[e]}function gst(t,e){return!(!Array.isArray(t)||!Array.isArray(e))&&t.length!==e.length}function r$(t){return t?t.declaredClass:null}function s5e(t,e){var x;const i=t.diff;if(i&&typeof i=="function")return i(t,e);const r=zpe(t),n=zpe(e);if(r.length===0&&n.length===0)return;if(!r.length||!n.length||gst(t,e))return{type:"complete",oldValue:t,newValue:e};const s=n.filter(T=>!r.includes(T)),o=r.filter(T=>!n.includes(T)),l=r.filter(T=>n.includes(T)&&tD(t,T)!==tD(e,T)).concat(s,o).sort(),c=r$(t);if(c&&mst.has(c)&&l.length)return{type:"complete",oldValue:t,newValue:e};let f;const _=LK(t)&&LK(e);for(const T of l){const A=tD(t,T),M=tD(e,T);let I;if((_||typeof A!="function"&&typeof M!="function")&&A!==M&&(A!=null||M!=null)){if(i&&i[T]&&typeof i[T]=="function")I=(x=i[T])==null?void 0:x.call(i,A,M);else if(A instanceof Date&&M instanceof Date){if(A.getTime()===M.getTime())continue;I={type:"complete",oldValue:A,newValue:M}}else I=typeof A=="object"&&typeof M=="object"&&r$(A)===r$(M)?s5e(A,M):{type:"complete",oldValue:A,newValue:M};I!=null&&(f!=null?f.diff[T]=I:f={type:"partial",diff:{[T]:I}})}}return f}function yst(t,e){if(t==null)return!1;const i=e.split(".");let r=t;for(const n of i){if(r.type==="complete")return!0;if(r.type!=="partial")return!1;{const s=r.diff[n];if(!s)return!1;r=s}}return!0}function RJt(t,e){for(const i of e)if(yst(t,i))return!0;return!1}function vst(t,e){if(typeof t!="function"&&typeof e!="function"&&(t!=null||e!=null))return t==null||e==null||typeof t=="object"&&typeof e=="object"&&r$(t)!==r$(e)?{type:"complete",oldValue:t,newValue:e}:s5e(t,e)}function iD(t){if(t==null)return!0;switch(t.type){case"complete":return!1;case"collection":{const e=t;for(const i of e.added)if(!iD(i))return!1;for(const i of e.removed)if(!iD(i))return!1;for(const i of e.changed)if(!iD(i))return!1;return!0}case"partial":for(const e in t.diff)if(!iD(t.diff[e]))return!1;return!0}}let wA=class extends Xs(Ue){constructor(e){super(e),this.value=null,this.value2=null,this.value3=null}};y([w(X7)],wA.prototype,"value",void 0),y([w(X7)],wA.prototype,"value2",void 0),y([w(X7)],wA.prototype,"value3",void 0),wA=y([Z("esri.renderers.support.UniqueValue")],wA);const aO=wA;let Jb=class extends Xs(Ue){constructor(e){super(e),this.description=null,this.label=null,this.symbol=null,this.values=null}castValues(e){if(e==null)return null;const i=typeof(e=Array.isArray(e)?e:[e])[0];return i==="string"||i==="number"?e.map(r=>new aO({value:r})):i==="object"?e[0]instanceof aO?e:e.map(r=>new aO(r)):null}};y([w({type:String,json:{write:!0}})],Jb.prototype,"description",void 0),y([w({type:String,json:{write:!0}})],Jb.prototype,"label",void 0),y([w(HB)],Jb.prototype,"symbol",void 0),y([w({type:[aO],json:{type:[[String]],read:{reader:t=>t?t.map(e=>new aO({value:e[0],value2:e[1],value3:e[2]})):null},write:{writer:(t,e)=>{const i=[];for(const r of t){const n=[r.value,r.value2,r.value3].filter(ys).map(s=>s.toString());i.push(n)}e.values=i}}}})],Jb.prototype,"values",void 0),y([Ci("values")],Jb.prototype,"castValues",null),Jb=y([Z("esri.renderers.support.UniqueValueClass")],Jb);const o5e=Jb;let E4=class extends Xs(Ue){constructor(e){super(e),this.heading=null,this.classes=null}};y([w({type:String,json:{write:!0}})],E4.prototype,"heading",void 0),y([w({type:[o5e],json:{write:!0}})],E4.prototype,"classes",void 0),E4=y([Z("esri.renderers.support.UniqueValueGroup")],E4);const DK=E4;var NK;let R3=NK=class extends Ue{constructor(t){super(t),this.description=null,this.label=null,this.symbol=null,this.value=null}clone(){return new NK({value:this.value,description:this.description,label:this.label,symbol:this.symbol?this.symbol.clone():null})}getMeshHash(){var e;const t=JSON.stringify((e=this.symbol)==null?void 0:e.toJSON());return`${this.value}.${t}`}};y([w({type:String,json:{write:!0}})],R3.prototype,"description",void 0),y([w({type:String,json:{write:!0}})],R3.prototype,"label",void 0),y([w(Xse)],R3.prototype,"symbol",void 0),y([w(X7)],R3.prototype,"value",void 0),R3=NK=y([Z("esri.renderers.support.UniqueValueInfo")],R3);const n$=R3,_st=()=>!!Le("enable-feature:force-wosr"),DJt=()=>!!Le("enable-feature:direct-3d-object-feature-layer-display"),bst=()=>Le.add("enable-feature:direct-3d-object-feature-layer-display",!0,!0,!0),wst=()=>Le.add("enable-feature:direct-3d-object-feature-layer-display",!1,!0,!0),NJt=()=>!!Le("enable-i3s-patching"),xst=()=>Le.add("enable-i3s-patching",!0,!0,!0),Sst=()=>Le.add("enable-i3s-patching",!1,!0,!0),Upe=()=>!!Le("enable-feature:SceneLayer-editing"),Tst=(t="i3s-patching")=>{switch(Sst(),wst(),Le.add("enable-feature:SceneLayer-editing",!0,!0,!0),t){case"feature-layer-view":bst();break;case"i3s-patching":xst()}};Tst("i3s-patching");let OH={};async function Est(t,e){try{return{data:(await toe(t,e)).data,baseUrl:One(t),styleUrl:t}}catch(i){return zo(i),null}}function Cst(t,e,i){const r=e.portal!=null?e.portal:os.getDefault();let n;const s=`${r.url} - ${r.user&&r.user.username} - ${t}`;return OH[s]||(OH[s]=Ast(t,r,i).then(o=>(n=o,o.fetchData())).then(o=>({data:o,baseUrl:n.itemUrl??"",styleName:t}))),OH[s]}function Ast(t,e,i){return e.load(i).then(()=>{const r=new ay({disableExtraQuery:!0,query:`owner:${Vpe} AND type:${Bpe} AND typekeywords:"${t}"`});return e.queryItems(r,i)}).then(({results:r})=>{var o;let n=null;const s=t.toLowerCase();if(r&&Array.isArray(r)){for(const l of r)if(((o=l.typeKeywords)==null?void 0:o.some(f=>f.toLowerCase()===s))&&l.type===Bpe&&l.owner===Vpe){n=l;break}}if(!n)throw new se("symbolstyleutils:style-not-found",`The style '${t}' could not be found`,{styleName:t});return n.load(i)})}function eoe(t,e,i){return(t==null?void 0:t.styleUrl)!=null?Est(t.styleUrl,i):(t==null?void 0:t.styleName)!=null?Cst(t.styleName,e,i):Promise.reject(new se("symbolstyleutils:style-url-and-name-missing","Either styleUrl or styleName is required to resolve a style"))}function a5e(t){return t===null||t.type==="CIMSymbolReference"?t:{type:"CIMSymbolReference",symbol:t}}function l5e(t,e,i=["gltf"]){if(e==="cimRef")return t.cimRef;if(t.formatInfos&&!_st())for(const r of i){const n=t.formatInfos.find(s=>s.type===r);if(n)return n.href}return t.webRef}function toe(t,e){const i={responseType:"json",query:{f:"json"},...e};return bi(Mf(t),i)}const Vpe="esri_en",Bpe="Style",Mst="https://cdn.arcgis.com/sharing/rest/content/items/220936cc6ed342c9937abd8f180e7d1e/resources/styles/cim/{SymbolName}.json?f=json";var C4;const c5e="esri.renderers.UniqueValueRenderer",nb=Ce.getLogger(c5e),jpe="uvInfos-watcher",Gpe="uvGroups-watcher",Ost=",",Pst=$s(n$);function Rst(t){const{field1:e,field2:i,field3:r,fieldDelimiter:n,uniqueValueInfos:s,valueExpression:o}=t,l=!(!e||!i);return[{classes:(s??[]).map(c=>{var F;const{symbol:f,label:_,value:x,description:T}=c,[A,M,I]=l?((F=x==null?void 0:x.toString())==null?void 0:F.split(n||""))||[]:[x],L=[];return(e||o)&&L.push(A),i&&L.push(M),r&&L.push(I),{symbol:f,label:_,values:[L],description:T}})}]}let fo=C4=class extends pP(L_){constructor(t){super(t),this._valueInfoMap={},this._isDefaultSymbolDerived=!1,this._isInfosSource=null,this.type="unique-value",this.backgroundFillSymbol=null,this.orderByClassesEnabled=!1,this.valueExpressionTitle=null,this.legendOptions=null,this.defaultLabel=null,this.portal=null,this.styleOrigin=null,this.diff={uniqueValueInfos(e,i){if(!e&&!i)return;if(!e||!i)return{type:"complete",oldValue:e,newValue:i};let r=!1;const n={type:"collection",added:[],removed:[],changed:[],unchanged:[]};for(let s=0;sl.value===i[s].value);o?vst(o,i[s])?(n.changed.push({type:"complete",oldValue:o,newValue:i[s]}),r=!0):n.unchanged.push({oldValue:o,newValue:i[s]}):(n.added.push(i[s]),r=!0)}for(let s=0;so.value===e[s].value)||(n.removed.push(e[s]),r=!0);return r?n:void 0}},this._set("uniqueValueInfos",[]),this._set("uniqueValueGroups",[])}get _cache(){return{compiledFunc:null}}set field(t){this._set("field",t),this._updateFieldDelimiter(),this._updateUniqueValues()}castField(t){return t==null||typeof t=="function"?t:y9(t)}writeField(t,e,i,r){typeof t=="string"?e[i]=t:r!=null&&r.messages?r.messages.push(new se("property:unsupported","UniqueValueRenderer.field set to a function cannot be written to JSON")):nb.error(".field: cannot write field to JSON since it's not a string value")}set field2(t){this._set("field2",t),this._updateFieldDelimiter(),this._updateUniqueValues()}set field3(t){this._set("field3",t),this._updateUniqueValues()}set valueExpression(t){this._set("valueExpression",t),this._updateUniqueValues()}set defaultSymbol(t){this._isDefaultSymbolDerived=!1,this._set("defaultSymbol",t)}set fieldDelimiter(t){this._set("fieldDelimiter",t),this._updateUniqueValues()}readPortal(t,e,i){return i.portal||os.getDefault()}readStyleOrigin(t,e,i){if(e.styleName)return Object.freeze({styleName:e.styleName});if(e.styleUrl){const r=f_(e.styleUrl,i);return Object.freeze({styleUrl:r})}}writeStyleOrigin(t,e,i,r){t.styleName?e.styleName=t.styleName:t.styleUrl&&(e.styleUrl=m_(t.styleUrl,r))}set uniqueValueGroups(t){this.styleOrigin?nb.error("#uniqueValueGroups=","Cannot modify unique value groups of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueGroups",t),this._updateInfosFromGroups(),this._isInfosSource=!1,this._watchUniqueValueGroups())}set uniqueValueInfos(t){this.styleOrigin?nb.error("#uniqueValueInfos=","Cannot modify unique value infos of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueInfos",t),this._updateValueInfoMap(),this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos())}addUniqueValueInfo(t,e){var r;if(this.styleOrigin)return void nb.error("#addUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");let i;i=typeof t=="object"?Pst(t):new n$({value:t,symbol:xOe(e)}),(r=this.uniqueValueInfos)==null||r.push(i),this._valueInfoMap[i.value]=i,this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}removeUniqueValueInfo(t){if(this.styleOrigin)return void nb.error("#removeUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");const e=this.uniqueValueInfos;if(e)for(let i=0;it+e.getAttributeHash(),"")}getMeshHash(){var r;const t=JSON.stringify(this.backgroundFillSymbol),e=JSON.stringify(this.defaultSymbol),i=(r=this.uniqueValueInfos)==null?void 0:r.reduce((n,s)=>n+s.getMeshHash(),"");return`${t}.${e}.${i}.${`${this.field}.${this.field2}.${this.field3}.${this.fieldDelimiter}`}.${this.valueExpression}`}clone(){const t=new C4({field:this.field,field2:this.field2,field3:this.field3,defaultLabel:this.defaultLabel,defaultSymbol:Re(this.defaultSymbol),orderByClassesEnabled:this.orderByClassesEnabled,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,fieldDelimiter:this.fieldDelimiter,visualVariables:Re(this.visualVariables),legendOptions:Re(this.legendOptions),authoringInfo:this.authoringInfo&&this.authoringInfo.clone(),backgroundFillSymbol:Re(this.backgroundFillSymbol)});this._isDefaultSymbolDerived&&(t._isDefaultSymbolDerived=!0),t._set("portal",this.portal);const e=Re(this.uniqueValueInfos),i=Re(this.uniqueValueGroups);return this.styleOrigin&&(t._set("styleOrigin",Object.freeze(Re(this.styleOrigin))),Object.freeze(e),Object.freeze(i)),t._set("uniqueValueInfos",e),t._updateValueInfoMap(),t._set("uniqueValueGroups",i),t._isInfosSource=this._isInfosSource,t._watchUniqueValueInfosAndGroups(),t}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}async collectRequiredFields(t,e){const i=[this.collectVVRequiredFields(t,e),this.collectSymbolFields(t,e)];await Promise.all(i)}async collectSymbolFields(t,e){const i=[...this.getSymbols().map(r=>r.collectRequiredFields(t,e)),eh(t,e,this.valueExpression)];fp(t,e,this.field),fp(t,e,this.field2),fp(t,e,this.field3),await Promise.all(i)}populateFromStyle(){return eoe(this.styleOrigin,{portal:this.portal}).then(t=>{var i;const e=[];return this._valueInfoMap={},t&&t.data&&Array.isArray(t.data.items)&&t.data.items.forEach(r=>{const n=new gE({styleUrl:t.styleUrl,styleName:t.styleName,portal:this.portal,name:r.name});this.defaultSymbol||r.name!==t.data.defaultItem||(this.defaultSymbol=n,this._isDefaultSymbolDerived=!0);const s=new n$({value:r.name,symbol:n});e.push(s),this._valueInfoMap[r.name]=s}),this._set("uniqueValueInfos",Object.freeze(e)),this._updateGroupsFromInfos(!0),this._isInfosSource=null,this._watchUniqueValueInfos(),!this.defaultSymbol&&((i=this.uniqueValueInfos)!=null&&i.length)&&(this.defaultSymbol=this.uniqueValueInfos[0].symbol,this._isDefaultSymbolDerived=!0),this})}_updateFieldDelimiter(){this.field&&this.field2&&!this.fieldDelimiter&&this._set("fieldDelimiter",Ost)}_updateUniqueValues(){this._isInfosSource!=null&&(this._isInfosSource?this._updateGroupsFromInfos():this._updateInfosFromGroups())}_updateValueInfoMap(){this._valueInfoMap={};const{uniqueValueInfos:t}=this;if(t)for(const e of t)this._valueInfoMap[e.value+""]=e}_watchUniqueValueInfosAndGroups(){this._watchUniqueValueInfos(),this._watchUniqueValueGroups()}_watchUniqueValueInfos(){this.removeHandles(jpe);const{uniqueValueInfos:t}=this;if(t){const e=[];for(const i of t)e.push(_e(()=>({symbol:i.symbol,value:i.value,label:i.label,description:i.description}),(r,n)=>{r!==n&&(this._updateGroupsFromInfos(),this._isInfosSource=!0)},{sync:!0}));this.addHandles(e,jpe)}}_watchUniqueValueGroups(){this.removeHandles(Gpe);const{uniqueValueGroups:t}=this;if(t){const e=[];for(const i of t){e.push(_e(()=>({classes:i.classes}),(r,n)=>{r!==n&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}));for(const r of i.classes??[])e.push(_e(()=>({symbol:r.symbol,values:r.values,label:r.label,description:r.description}),(n,s)=>{n!==s&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}))}this.addHandles(e,Gpe)}}_updateInfosFromGroups(){if(!this.uniqueValueGroups)return this._set("uniqueValueInfos",null),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const t=[],{field:e,field2:i,field3:r,fieldDelimiter:n,uniqueValueGroups:s,valueExpression:o}=this;if(!e&&!o)return this._set("uniqueValueInfos",t),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const l=!(!e||!i);for(const c of s)for(const f of c.classes??[]){const{symbol:_,label:x,values:T,description:A}=f;for(const M of T??[]){const{value:I,value2:L,value3:F}=M,z=[I];i&&z.push(L),r&&z.push(F);const k=l?z.join(n||""):z[0];t.push(new n$({symbol:_,label:x,value:k,description:A}))}}this._set("uniqueValueInfos",t),this._updateValueInfoMap(),this._watchUniqueValueInfos()}_updateGroupsFromInfos(t=!1){if(!this.uniqueValueInfos)return this._set("uniqueValueGroups",null),void this._watchUniqueValueGroups();const{field:e,field2:i,valueExpression:r,fieldDelimiter:n,uniqueValueInfos:s}=this;if(!e&&!r||!s.length)return this._set("uniqueValueGroups",[]),void this._watchUniqueValueGroups();const o=!(!e||!i),l=s.map(f=>{var F;const{symbol:_,label:x,value:T,description:A}=f,[M,I,L]=o?((F=T==null?void 0:T.toString())==null?void 0:F.split(n||""))||[]:[T];return new o5e({symbol:_,label:x,description:A,values:[new aO({value:M,value2:I,value3:L})]})}),c=[new DK({classes:l})];t&&Object.freeze(c),this._set("uniqueValueGroups",c),this._watchUniqueValueGroups()}_getUniqueValueInfo(t,e){return this.valueExpression?this._getUnqiueValueInfoForExpression(t,e):this._getUnqiueValueInfoForFields(t)}_getUnqiueValueInfoForExpression(t,e){const{viewingMode:i,scale:r,spatialReference:n,arcade:s,timeZone:o}=e??{};let l=this._cache.compiledFunc;const c=s.arcadeUtils;if(!l){const _=c.createSyntaxTree(this.valueExpression);l=c.createFunction(_),this._cache.compiledFunc=l}const f=c.executeFunction(l,c.createExecContext(t,c.getViewInfo({viewingMode:i,scale:r,spatialReference:n}),o));return this._valueInfoMap[f+""]}_getUnqiueValueInfoForFields(t){const e=this.field,i=t.attributes;let r;if(typeof e!="function"&&this.field2){const n=this.field2,s=this.field3,o=[];e&&o.push(i[e]),n&&o.push(i[n]),s&&o.push(i[s]),r=o.join(this.fieldDelimiter||"")}else typeof e=="function"?r=e(t):e&&(r=i[e]);return this._valueInfoMap[r+""]}static fromPortalStyle(t,e){const i=new C4(e==null?void 0:e.properties);i._set("styleOrigin",Object.freeze({styleName:t})),i._set("portal",(e==null?void 0:e.portal)||os.getDefault());const r=i.populateFromStyle();return r.catch(n=>{nb.error(`#fromPortalStyle('${t}'[, ...])`,"Failed to create unique value renderer from style name",n)}),r}static fromStyleUrl(t,e){const i=new C4(e==null?void 0:e.properties);i._set("styleOrigin",Object.freeze({styleUrl:t}));const r=i.populateFromStyle();return r.catch(n=>{nb.error(`#fromStyleUrl('${t}'[, ...])`,"Failed to create unique value renderer from style URL",n)}),r}};y([w({readOnly:!0})],fo.prototype,"_cache",null),y([Vt({uniqueValue:"unique-value"})],fo.prototype,"type",void 0),y([w(jOe)],fo.prototype,"backgroundFillSymbol",void 0),y([w({value:null,json:{type:String,read:{source:"field1"},write:{target:"field1"}}})],fo.prototype,"field",null),y([Ci("field")],fo.prototype,"castField",null),y([Pt("field")],fo.prototype,"writeField",null),y([w({type:String,value:null,json:{write:!0}})],fo.prototype,"field2",null),y([w({type:String,value:null,json:{write:!0}})],fo.prototype,"field3",null),y([w({type:Boolean,json:{name:"drawInClassOrder",default:!1,write:!0,origins:{"web-scene":{write:!1}}}})],fo.prototype,"orderByClassesEnabled",void 0),y([w({type:String,value:null,json:{write:!0}})],fo.prototype,"valueExpression",null),y([w({type:String,json:{write:!0}})],fo.prototype,"valueExpressionTitle",void 0),y([w({type:sO,json:{write:!0}})],fo.prototype,"legendOptions",void 0),y([w({type:String,json:{write:!0}})],fo.prototype,"defaultLabel",void 0),y([w(Yre({...HB},{json:{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}},origins:{"web-scene":{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}}}}}}))],fo.prototype,"defaultSymbol",null),y([w({type:String,value:null,json:{write:!0}})],fo.prototype,"fieldDelimiter",null),y([w({type:os,readOnly:!0})],fo.prototype,"portal",void 0),y([$t("portal",["styleName"])],fo.prototype,"readPortal",null),y([w({readOnly:!0,json:{write:{enabled:!1,overridePolicy:()=>({enabled:!0})}}})],fo.prototype,"styleOrigin",void 0),y([$t("styleOrigin",["styleName","styleUrl"])],fo.prototype,"readStyleOrigin",null),y([Pt("styleOrigin",{styleName:{type:String},styleUrl:{type:String}})],fo.prototype,"writeStyleOrigin",null),y([w({type:[DK],json:{read:{source:["uniqueValueGroups","uniqueValueInfos"],reader:(t,e,i)=>(e.uniqueValueGroups||Rst(e)).map(r=>DK.fromJSON(r,i))},write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],fo.prototype,"uniqueValueGroups",null),y([w({type:[n$],json:{read:!1,write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],fo.prototype,"uniqueValueInfos",null),fo=C4=y([Z(c5e)],fo);const ioe=fo,Ist={key:"type",base:L_,typeMap:{heatmap:n5e,simple:Qse,"unique-value":ioe,"class-breaks":HOe,"dot-density":rst,dictionary:tst,"pie-chart":fst},errorContext:"renderer"},$st={key:"type",base:L_,typeMap:{simple:Qse,"unique-value":ioe,"class-breaks":HOe,heatmap:n5e},errorContext:"renderer",validate:Lst};function Lst(t){switch(t.type){case"simple":return Dst(t);case"unique-value":return Nst(t);case"class-breaks":return Fst(t);case"heatmap":return t}}function Dst(t){if(t.symbol)return t;Ce.getLogger("esri.renderers.support.types").error("Removed invalid 'simple' renderer without a symbol from web scene.")}function Nst(t){const e=t.uniqueValueInfos,i=e==null?void 0:e.filter(({symbol:r,label:n},s)=>(r||Ce.getLogger("esri.renderers.support.types").error(`Removed invalid unique value info ([${s}] ${n}) without a symbol from web scene.`),!!r));return(i==null?void 0:i.length)!==(e==null?void 0:e.length)&&(t.uniqueValueInfos=i),t}function Fst(t){const e=t.classBreakInfos,i=e==null?void 0:e.filter(({symbol:r,label:n},s)=>(r||Ce.getLogger("esri.renderers.support.types").error(`Removed invalid class break info ([${s}] ${n}) without a symbol from web scene.`),!!r));return(i==null?void 0:i.length)!==(e==null?void 0:e.length)&&(t.classBreakInfos=i),t}function kst(t,e){return Ust(t,null,e)}const zst=Z5({types:Ist});function Ust(t,e,i){return t?t&&(t.styleName||t.styleUrl)&&t.type!=="uniqueValue"?(i!=null&&i.messages&&i.messages.push(new Uf("renderer:unsupported","Only UniqueValueRenderer can be referenced from a web style, but found '"+t.type+"'",{definition:t,context:i})),null):zst(t,e,i):null}let Vst=class u5e{constructor(){this._propertyOriginMap=new Map,this._originStores=new Array(WX),this._values=new Map,this.multipleOriginsSupported=!0}clone(e){const i=new u5e,r=this._originStores[Di.DEFAULTS];r&&r.forEach((n,s)=>{i.set(s,Re(n),Di.DEFAULTS)});for(let n=Di.SERVICE;n{e&&e.has(l)||i.set(l,Re(o),n)})}return i}get(e,i){const r=i===void 0?this._values:this._originStores[i];return r?r.get(e):void 0}keys(e){const i=e==null?this._values:this._originStores[e];return i?[...i.keys()]:[]}set(e,i,r=Di.USER){let n=this._originStores[r];if(n||(n=new Map,this._originStores[r]=n),n.set(e,i),!this._values.has(e)||this._propertyOriginMap.get(e)<=r){const s=this._values.get(e);return this._values.set(e,i),this._propertyOriginMap.set(e,r),s!==i}return!1}delete(e,i=Di.USER){const r=this._originStores[i];if(!r)return;const n=r.get(e);if(r.delete(e),this._values.has(e)&&this._propertyOriginMap.get(e)===i){this._values.delete(e);for(let s=i-1;s>=0;s--){const o=this._originStores[s];if(o&&o.has(e)){this._values.set(e,o.get(e)),this._propertyOriginMap.set(e,s);break}}}return n}has(e,i){const r=i===void 0?this._values:this._originStores[i];return!!r&&r.has(e)}revert(e,i){for(;i>0&&!this.has(e,i);)--i;const r=this._originStores[i],n=r==null?void 0:r.get(e),s=this._values.get(e);return this._values.set(e,n),this._propertyOriginMap.set(e,i),s!==n}originOf(e){return this._propertyOriginMap.get(e)||Di.DEFAULTS}forEach(e){this._values.forEach(e)}};const h5e=t=>{let e=class extends t{constructor(...i){super(...i);const r=Zl(this),n=r.store,s=new Vst;r.store=s,tEe(r,n,s)}read(i,r){rEe(this,i,r)}getAtOrigin(i,r){const n=PH(this),s=kv(r);if(typeof i=="string")return n.get(i,s);const o={};return i.forEach(l=>{o[l]=n.get(l,s)}),o}originOf(i){return Bk(this.originIdOf(i))}originIdOf(i){return PH(this).originOf(i)}revert(i,r){const n=PH(this),s=kv(r),o=Zl(this);let l;l=typeof i=="string"?i==="*"?n.keys(s):[i]:i,l.forEach(c=>{o.invalidate(c),n.revert(c,s),o.commit(c)})}};return e=y([Z("esri.core.ReadOnlyMultiOriginJSONSupport")],e),e};function PH(t){return Zl(t).store}let Hpe=class extends h5e(ze){};Hpe=y([Z("esri.core.ReadOnlyMultiOriginJSONSupport")],Hpe);const Bst=t=>{let e=class extends t{constructor(...i){super(...i)}clear(i,r="user"){return RH(this).delete(i,kv(r))}write(i,r){return aEe(this,i=i||{},r),i}setAtOrigin(i,r,n){Zl(this).setAtOrigin(i,r,kv(n))}removeOrigin(i){const r=RH(this),n=kv(i),s=r.keys(n);for(const o of s)r.originOf(o)===n&&r.set(o,r.get(o,n),Di.USER)}updateOrigin(i,r){const n=RH(this),s=kv(r),o=au(this,i);for(let l=s+1;l{let e=class extends Bst(h5e(t)){constructor(...i){super(...i)}};return e=y([Z("esri.core.MultiOriginJSONSupport")],e),e};let Yz=class extends fP(ze){};Yz=y([Z("esri.core.MultiOriginJSONSupport")],Yz);function jst(t){return"portalItem"in t}const Gst=t=>{let e=class extends t{get apiKey(){var i;return this._isOverridden("apiKey")?this._get("apiKey"):jst(this)?(i=this.portalItem)==null?void 0:i.apiKey:null}set apiKey(i){i!=null?this._override("apiKey",i):(this._clearOverride("apiKey"),this.clear("apiKey","user"))}};return y([w({type:String})],e.prototype,"apiKey",null),e=y([Z("esri.layers.mixins.APIKeyMixin")],e),e},d5e={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer"},p5e=Object.values(d5e),f5e=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${p5e.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),Hst=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${p5e.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),qst=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function zJt(t){return!!f5e.test(t)}function vE(t){if(t==null)return null;const e=qs(t),i=(e==null?void 0:e.path.match(f5e))||(e==null?void 0:e.path.match(Hst));if(!i)return null;const[,r,n,s,o]=i,l=n.indexOf("/");return{title:roe(l!==-1?n.slice(l+1):n),serverType:d5e[s.toLowerCase()],sublayer:o!=null&&o!==""?parseInt(o,10):null,url:{path:r}}}function Wst(t){const e=qs(t).path.match(qst);return e?{serviceUrl:e[1],sublayerId:Number(e[2])}:null}function roe(t){return(t=t.replaceAll(/\s*[/_]+\s*/g," "))[0].toUpperCase()+t.slice(1)}function Yst(t,e){const i=[];if(t){const r=vE(t);r!=null&&r.title&&i.push(r.title)}if(e){const r=roe(e);i.push(r)}if(i.length===2){if(i[0].toLowerCase().includes(i[1].toLowerCase()))return i[0];if(i[1].toLowerCase().includes(i[0].toLowerCase()))return i[1]}return i.join(" - ")}function qpe(t){if(!t)return!1;const e=".arcgis.com/",i="//services",r="//tiles",n="//features",s=(t=t.toLowerCase()).includes(e),o=t.includes(i)||t.includes(r)||t.includes(n);return s&&o}function Xst(t,e){return t&&mEe(yEe(t,e))}function Zst(t){let{url:e}=t;if(!e)return{url:e};e=yEe(e,t.logger);const i=qs(e),r=vE(i.path);let n;if(r!=null)r.sublayer!=null&&t.layer.layerId==null&&(n=r.sublayer),e=r.url.path;else if(t.nonStandardUrlAllowed){const s=Wst(i.path);s!=null&&(e=s.serviceUrl,n=s.sublayerId)}return{url:mEe(e),layerId:n}}function Jst(t,e,i,r,n){R2(e,r,"url",n),r.url&&t.layerId!=null&&(r.url=s0(r.url,i,t.layerId.toString()))}function Kst(t){if(!t)return!1;const e=t.toLowerCase(),i=e.includes("/services/"),r=e.includes("/mapserver/wmsserver"),n=e.includes("/imageserver/wmsserver"),s=e.includes("/wmsserver");return i&&(r||n||s)}const m5e=t=>{let e=class extends t{get title(){if(this._get("title")&&this.originOf("title")!=="defaults")return this._get("title");if(this.url){const i=vE(this.url);if(i!=null&&i.title)return i.title}return this._get("title")||""}set title(i){this._set("title",i)}set url(i){this._set("url",Xst(i,Ce.getLogger(this)))}};return y([w()],e.prototype,"title",null),y([w({type:String})],e.prototype,"url",null),e=y([Z("esri.layers.mixins.ArcGISService")],e),e},Qst=wXe(),eot=new Map,g5e=new Map;async function UJt(t,e,i=!1){var s,o;if(!t||!e)return!0;const r=t.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),n=(s=g5e.get(r))==null?void 0:s.entries();if(n){for(const[l,c]of n)if(c.name===e){const f=!((o=c.stack)!=null&&o.hasForwardEdits());if(!f&&i){const[{deleteForwardEdits:_},{default:x}]=await Promise.all([we(()=>import("./deleteForwardEdits-Pq-0h4Vp.js"),__vite__mapDeps([])),we(()=>import("./DeleteForwardEditsParameters-DGoRlX6R.js"),__vite__mapDeps([]))]);return _(r,l,new x({sessionId:Qst,moment:c.moment}))}return f}}return!0}function tot(t,e){var n;if(!t)return!1;const i=t.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),r=(n=g5e.get(i))==null?void 0:n.entries();if(r){for(const[s,o]of r)if(o.name===e)return o.lockType==="edit"}return!1}const noe=new Dn.EventEmitter;function iot(t){return noe.on("apply-edits",new WeakRef(t))}function rot(t){return noe.on("update-moment",new WeakRef(t))}function VJt(t,e,i=null,r=!1){const n=Jl();return r=e==null||r,noe.emit("apply-edits",{serviceUrl:t,layerId:e,gdbVersion:i,mayReceiveServiceEdits:r,result:n.promise}),n}const y5e="esri.layers.mixins.EditBusLayer",v5e=Symbol(y5e);function BJt(t){return t!=null&&typeof t=="object"&&v5e in t}function HP(t){return t!=null&&typeof t=="object"&&"gdbVersion"in t}function IH(t,e,i){const r=new URL(t).host,n=eot.get(r),s=o=>!o||o===n;return s(e)&&s(i)||e===i}const not=t=>{var e;let i=class extends t{constructor(...r){super(...r),this[e]=!0,this._applyEditsHandler=n=>{const{serviceUrl:s,layerId:o,gdbVersion:l,mayReceiveServiceEdits:c,result:f}=n,_=s===this.url,x=o!=null&&this.layerId!=null&&o===this.layerId,T=HP(this),A=HP(this)&&IH(s,l,this.gdbVersion);if(!_||T&&!A||!x&&!c)return;const M=f.then(I=>{var F;if(x&&(I.addedFeatures.length||I.updatedFeatures.length||I.deletedFeatures.length||I.addedAttachments.length||I.updatedAttachments.length||I.deletedAttachments.length))return this.emit("edits",Re(I)),I;const L=(F=I.editedFeatures)==null?void 0:F.find(({layerId:z})=>z===this.layerId);if(L){const{adds:z,updates:k,deletes:U}=L.editedFeatures,j={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:z?z.map(({attributes:H})=>({objectId:this.objectIdField&&H[this.objectIdField],globalId:this.globalIdField&&H[this.globalIdField]})):[],deletedFeatures:U?U.map(({attributes:H})=>({objectId:this.objectIdField&&H[this.objectIdField],globalId:this.globalIdField&&H[this.globalIdField]})):[],updatedFeatures:k?k.map(({current:{attributes:H}})=>({objectId:this.objectIdField&&H[this.objectIdField],globalId:this.globalIdField&&H[this.globalIdField]})):[],editedFeatures:Re(I.editedFeatures),exceededTransferLimit:!1,historicMoment:Re(I.historicMoment)};return this.emit("edits",j),j}return{edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:[],deletedFeatures:[],updatedFeatures:[],editedFeatures:Re(I.editedFeatures),exceededTransferLimit:!1,historicMoment:Re(I.historicMoment)}}).then(I=>("historicMoment"in this&&this.historicMoment!==I.historicMoment&&tot(s,l)&&(this.historicMoment=I.historicMoment),I));this.emit("apply-edits",{result:M})},this._updateMomentHandler=n=>{const{serviceUrl:s,gdbVersion:o,moment:l}=n,c=s===this.url,f=HP(this),_=HP(this)&&IH(s,o,this.gdbVersion),x=HP(this)&&!IH(s,this.gdbVersion,null);c&&f&&_&&x&&"historicMoment"in this&&this.historicMoment!==l&&(this.historicMoment=l)},this.when().then(()=>{this.addHandles(iot(this._applyEditsHandler)),"historicMoment"in this&&this.addHandles(rot(this._updateMomentHandler))},()=>{})}};return e=v5e,i=y([Z(y5e)],i),i},Wf=(t=>t)(["operational-layers","basemap","ground"]),Wpe={ArcGISAnnotationLayer:!0,ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BingMapsAerial:!0,BingMapsHybrid:!0,BingMapsRoad:!0,CSV:!0,GeoRSS:!0,GeoJSON:!0,GroupLayer:!0,KML:!0,MediaLayer:!0,OGCFeatureLayer:!0,OrientedImageryLayer:!0,SubtypeGroupLayer:!0,VectorTileLayer:!0,WFS:!0,WMS:!0,WebTiledLayer:!0},Ype={ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,OpenStreetMap:!0,VectorTileLayer:!0,WMS:!0,WebTiledLayer:!0,BingMapsAerial:!0,BingMapsRoad:!0,BingMapsHybrid:!0},Xpe={ArcGISFeatureLayer:!0},sot={"web-scene/operational-layers":{ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISTiledElevationServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BuildingSceneLayer:!0,GroupLayer:!0,IntegratedMeshLayer:!0,OGCFeatureLayer:!0,PointCloudLayer:!0,WebTiledLayer:!0,CSV:!0,GeoJSON:!0,VectorTileLayer:!0,WFS:!0,WMS:!0,KML:!0,RasterDataLayer:!0,Voxel:!0,LineOfSightLayer:!0},"web-scene/basemap":{ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,WebTiledLayer:!0,OpenStreetMap:!0,VectorTileLayer:!0,ArcGISImageServiceLayer:!0,WMS:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0},"web-scene/ground":{ArcGISTiledElevationServiceLayer:!0,RasterDataElevationLayer:!0},"web-scene/tables":{ArcGISFeatureLayer:!0},"web-map/operational-layers":Wpe,"web-map/basemap":Ype,"web-map/tables":Xpe,"link-chart/operational-layers":{...Wpe,LinkChartLayer:!0},"link-chart/basemap":Ype,"link-chart/tables":Xpe,"portal-item/operational-layers":{ArcGISFeatureLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISImageServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,PointCloudLayer:!0,BuildingSceneLayer:!0,IntegratedMeshLayer:!0,OrientedImageryLayer:!0,SubtypeGroupLayer:!0}},FK={milliseconds:1,seconds:1e3,minutes:6e4,hours:36e5,days:864e5,weeks:6048e5,months:26784e5,years:31536e6,decades:31536e7,centuries:31536e8};function Pf(t,e,i,r=Uy){const n=new wp(vne(r)),s=$i.fromJSDate(t,{zone:n}),o=i==="decades"||i==="centuries"?"year":_5e(i);return i==="decades"&&(e*=10),i==="centuries"&&(e*=100),s.plus({[o]:e}).toJSDate()}function rD(t,e,i="milliseconds"){const r=t.getTime(),n=Gs(e,i,"milliseconds");return new Date(r+n)}function Zpe(t,e,i=Uy){const r=new wp(vne(i)),n=$i.fromJSDate(t,{zone:r});if(e==="decades"||e==="centuries"){const o=n.startOf("year"),{year:l}=o,c=l-l%(e==="decades"?10:100);return o.set({year:c}).toJSDate()}const s=_5e(e);return n.startOf(s).toJSDate()}function oot(t,e,i="milliseconds"){const r=new Date(Gs(e,i,"milliseconds"));return r.setUTCFullYear(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()),r}function aot(t,e="milliseconds"){const i=Gs(t.getUTCHours(),"hours","milliseconds"),r=Gs(t.getUTCMinutes(),"minutes","milliseconds"),n=Gs(t.getUTCSeconds(),"seconds","milliseconds");return Gs(i+r+n+t.getUTCMilliseconds(),"milliseconds",e)}function lot(t,e){const i=new Date(t.getTime());return i.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),i}function cot(t){const e=new Date(0);return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setFullYear(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()),e}function Gs(t,e,i){return t===0?0:t*FK[e]/FK[i]}function tF(t){return t instanceof Date&&!isNaN(t.getTime())}function uot(t,e){return t&&e?t.intersection(e):t||e}function _5e(t){switch(t){case"milliseconds":return"millisecond";case"seconds":return"second";case"minutes":return"minute";case"hours":return"hour";case"days":return"day";case"weeks":return"week";case"months":return"month";case"years":return"year"}}var I0;let Yd=I0=class extends Ue{static get allTime(){return Jpe}static get empty(){return hot}constructor(t){super(t),this.end=null,this.start=null}readEnd(t,e){return e.end!=null?new Date(e.end):null}writeEnd(t,e){e.end=(t==null?void 0:t.getTime())??null}get isAllTime(){return this.equals(I0.allTime)}get isEmpty(){return this.equals(I0.empty)}readStart(t,e){return e.start!=null?new Date(e.start):null}writeStart(t,e){e.start=(t==null?void 0:t.getTime())??null}clone(){return new I0({end:this.end,start:this.start})}equals(t){var s,o,l,c;if(!t)return!1;const e=((s=this.start)==null?void 0:s.getTime())??this.start,i=((o=this.end)==null?void 0:o.getTime())??this.end,r=((l=t.start)==null?void 0:l.getTime())??t.start,n=((c=t.end)==null?void 0:c.getTime())??t.end;return e===r&&i===n}expandTo(t,e=Uy){if(this.isEmpty||this.isAllTime)return this.clone();let i=this.start;i&&(i=Zpe(i,t,e));let r=this.end;if(r){const n=Zpe(r,t,e);r=r.getTime()===n.getTime()?n:Pf(n,1,t,e)}return new I0({start:i,end:r})}intersection(t){var l,c,f,_;if(!t)return this.clone();if(this.isEmpty||t.isEmpty)return I0.empty;if(this.isAllTime)return t.clone();if(t.isAllTime)return this.clone();const e=((l=this.start)==null?void 0:l.getTime())??-1/0,i=((c=this.end)==null?void 0:c.getTime())??1/0,r=((f=t.start)==null?void 0:f.getTime())??-1/0,n=((_=t.end)==null?void 0:_.getTime())??1/0;let s,o;if(r>=e&&r<=i?s=r:e>=r&&e<=n&&(s=e),i>=r&&i<=n?o=i:n>=e&&n<=i&&(o=n),s!=null&&o!=null&&!isNaN(s)&&!isNaN(o)){const x=new I0;return x.start=s===-1/0?null:new Date(s),x.end=o===1/0?null:new Date(o),x}return I0.empty}offset(t,e,i=Uy){if(this.isEmpty||this.isAllTime)return this.clone();const r=new I0,{start:n,end:s}=this;return n!=null&&(r.start=Pf(n,t,e,i)),s!=null&&(r.end=Pf(s,t,e,i)),r}union(t){if(!t||t.isEmpty)return this.clone();if(this.isEmpty)return t.clone();if(this.isAllTime||t.isAllTime)return Jpe.clone();const e=this.start!=null&&t.start!=null?new Date(Math.min(this.start.getTime(),t.start.getTime())):null,i=this.end!=null&&t.end!=null?new Date(Math.max(this.end.getTime(),t.end.getTime())):null;return new I0({start:e,end:i})}};y([w({type:Date,json:{write:{allowNull:!0}}})],Yd.prototype,"end",void 0),y([$t("end")],Yd.prototype,"readEnd",null),y([Pt("end")],Yd.prototype,"writeEnd",null),y([w({readOnly:!0,json:{read:!1}})],Yd.prototype,"isAllTime",null),y([w({readOnly:!0,json:{read:!1}})],Yd.prototype,"isEmpty",null),y([w({type:Date,json:{write:{allowNull:!0}}})],Yd.prototype,"start",void 0),y([$t("start")],Yd.prototype,"readStart",null),y([Pt("start")],Yd.prototype,"writeStart",null),Yd=I0=y([Z("esri.TimeExtent")],Yd);const Jpe=new Yd,hot=new Yd({start:void 0,end:void 0}),D_=Yd;function dot(t){if(!t)return t;const{start:e,end:i}=t;return new D_({start:e!=null?Pf(e,-e.getTimezoneOffset(),"minutes"):e,end:i!=null?Pf(i,-i.getTimezoneOffset(),"minutes"):i})}function pot(t){if(!t)return t;const{start:e,end:i}=t;return new D_({start:e!=null?Pf(e,e.getTimezoneOffset(),"minutes"):e,end:i!=null?Pf(i,i.getTimezoneOffset(),"minutes"):i})}const fot={type:Boolean,value:!0,json:{origins:{service:{read:!1,write:!1},"web-map":{read:!1,write:!1}},name:"screenSizePerspective",write:{enabled:!0,layerContainerTypes:Wf}}},mot={type:Boolean,value:!0,json:{name:"disablePopup",read:{reader:(t,e)=>!e.disablePopup},write:{enabled:!0,writer(t,e,i){e[i]=!t}}}},got={type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",write:{enabled:!0,layerContainerTypes:Wf}}},soe={type:String,json:{origins:{"portal-item":{write:!1}},write:{isRequired:!0,ignoreOrigin:!0,writer:R2}}},b5e={type:Boolean,value:!0,nonNullable:!0,json:{origins:{service:{read:{enabled:!1}}},name:"showLegend",write:{enabled:!0,layerContainerTypes:Wf}}},yot={value:null,type:BB,json:{origins:{service:{name:"elevationInfo",write:!0}},name:"layerDefinition.elevationInfo",write:{enabled:!0,layerContainerTypes:Wf}}};function jJt(t){return{type:t,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}}}const w5e={write:{enabled:!0,layerContainerTypes:Wf},read:!0},kK={type:Number,json:{origins:{"web-document":w5e,"portal-item":{write:!0}}}},GJt={...kK,json:{...kK.json,origins:{"web-document":{...w5e,write:{enabled:!0,layerContainerTypes:Wf,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}}}},read:{source:["layerDefinition.drawingInfo.transparency","drawingInfo.transparency"],reader:(t,e,i)=>{var r;return i&&i.origin!=="service"||!e.drawingInfo||e.drawingInfo.transparency===void 0?(r=e.layerDefinition)!=null&&r.drawingInfo&&e.layerDefinition.drawingInfo.transparency!==void 0?jT(e.layerDefinition.drawingInfo.transparency):void 0:jT(e.drawingInfo.transparency)}}}},vot={type:D_,readOnly:!0,get(){var l,c;if(!((l=this.layer)!=null&&l.timeInfo))return null;const{datesInUnknownTimezone:t,timeOffset:e,useViewTime:i}=this.layer,r=(c=this.view)==null?void 0:c.timeExtent;let n=this.layer.timeExtent;t&&(n=pot(n));let s=i?r&&n?r.intersection(n):r||n:n;if(!s||s.isEmpty||s.isAllTime)return s;e&&(s=s.offset(-e.value,e.unit)),t&&(s=dot(s));const o=this._get("timeExtent");return s.equals(o)?o:s}},HJt={type:Vi,readOnly:!0,json:{origins:{service:{read:{source:["fullExtent","spatialReference"],reader:(t,e)=>{const i=Vi.fromJSON(t);return e.spatialReference!=null&&typeof e.spatialReference=="object"&&(i.spatialReference=at.fromJSON(e.spatialReference)),i}}}},read:!1}},_ot={type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}}}},qJt={type:Number,json:{origins:{service:{write:{enabled:!1}},"web-scene":{name:"layerDefinition.minScale",write:{enabled:!0,layerContainerTypes:Wf}}},name:"layerDefinition.minScale",write:!0}},WJt={type:Number,json:{origins:{service:{write:{enabled:!1}},"web-scene":{name:"layerDefinition.maxScale",write:{enabled:!0,layerContainerTypes:Wf}}},name:"layerDefinition.maxScale",write:!0}},bot={json:{write:{ignoreOrigin:!0,layerContainerTypes:Wf},origins:{"web-map":{read:!1,write:!1}}}},XB=t=>{let e=class extends t{constructor(){super(...arguments),this.persistenceEnabled=!0,this.title=null}readId(i,r,n){var s;return((s=n==null?void 0:n.portalItem)==null?void 0:s.type)==="Group Layer"?void 0:i}writeListMode(i,r,n,s){(s&&s.layerContainerType==="ground"||i&&oEe(this,n,{},s))&&(r[n]=i)}writeOperationalLayerType(i,r,n,s){i&&(s==null?void 0:s.layerContainerType)!=="tables"&&(r.layerType=i)}writeTitle(i,r){r.title=i??"Layer"}read(i,r){r&&(r.layer=this),nEe(this,i,n=>super.read(i,n),r)}write(i,r){var o,l;if(!this.persistenceEnabled)return null;if(r!=null&&r.origin){const c=`${r.origin}/${r.layerContainerType||"operational-layers"}`,f=sot[c];let _=!!(f!=null&&f[this.operationalLayerType]);if(this.operationalLayerType==="ArcGISTiledElevationServiceLayer"&&c==="web-scene/operational-layers"&&(_=!1),this.operationalLayerType==="ArcGISDimensionLayer"&&c==="web-map/operational-layers"&&(_=!1),!_)return(o=r.messages)==null||o.push(new se("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${c}'`,{layer:this})),null}const n=super.write(i,{...r,layer:this}),s=!!r&&!!r.messages&&!!r.messages.filter(c=>c instanceof se&&c.name==="web-document-write:property-required").length;return E2(n==null?void 0:n.url)?((l=r==null?void 0:r.messages)==null||l.push(new se("layer:invalid-url",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' using a Blob URL cannot be written to web scenes and web maps`,{layer:this})),null):!this.url&&s?null:n}beforeSave(){}};return y([w({type:String,json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0}},"portal-item":{write:!1}}}})],e.prototype,"id",void 0),y([$t("id",["id"])],e.prototype,"readId",null),y([w(bot)],e.prototype,"listMode",void 0),y([Pt("listMode")],e.prototype,"writeListMode",null),y([w({type:String,readOnly:!0,json:{read:!1,write:{target:"layerType",ignoreOrigin:!0},origins:{"portal-item":{write:!1},"web-scene":{name:"layerType",read:!1,write:{enabled:!0,ignoreOrigin:!0,layerContainerTypes:Wf}}}}})],e.prototype,"operationalLayerType",void 0),y([Pt("operationalLayerType")],e.prototype,"writeOperationalLayerType",null),y([w(kK)],e.prototype,"opacity",void 0),y([w({type:Boolean,readOnly:!1})],e.prototype,"persistenceEnabled",void 0),y([w({type:String,json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}},"portal-item":{write:!1}}},value:"Layer"})],e.prototype,"title",void 0),y([Pt("title"),Pt(["web-scene"],"title")],e.prototype,"writeTitle",null),y([w({type:Boolean,json:{origins:{"web-scene":{name:"visibility",write:{enabled:!0,layerContainerTypes:Wf}}},name:"visibility",write:!0}})],e.prototype,"visible",void 0),e=y([Z("esri.layers.mixins.OperationalLayer")],e),e};let X1=class extends ze{constructor(e){super(e),this.portalItem=null}normalizeCtorArgs(e){return e!=null&&e.portalItem&&e.path?{...e,path:this._normalizePath(e.path,e.portalItem)}:e}set path(e){e!=null&&Zh(e)?Ce.getLogger(this).error("portalitemresource:invalid-path","A portal item resource path must be relative"):this._set("path",e)}_castPath(e){return this._normalizePath(e,this.portalItem)}get url(){return this.portalItem&&this.path?`${this.portalItem.itemUrl}/resources/${this.path}`:null}get cdnUrl(){return this.portalItem&&this.path?`${this.portalItem.itemCdnUrl}/resources/${this.path}`:null}get itemRelativeUrl(){return this.portalItem&&this.path?`./resources/${this.path}`:null}fetch(e="json",i){const r=this.cdnUrl;if(r==null)throw new se("portal-item-resource:fetch","Portal item resource does not refer to a valid item or path");return this.portalItem.portal.request(r,{responseType:e,query:{token:this.portalItem.apiKey},signal:i==null?void 0:i.signal})}async update(e,i){const{addOrUpdateResource:r}=await we(()=>Promise.resolve().then(()=>P4),void 0);return r(this,"update",e,i)}hasPath(){return this.path!=null}_normalizePath(e,i){return e==null?e:(e=e.replace(/^\/+/,""),i!=null&&Zh(e)&&(e=Ene(e,i.itemUrl)),e==null?void 0:e.replace(/^\/+/,"").replace(/^(\.\/)?resources\//,""))}};y([w()],X1.prototype,"portalItem",void 0),y([w({type:String,value:null})],X1.prototype,"path",null),y([Ci("path")],X1.prototype,"_castPath",null),y([w({type:String,readOnly:!0})],X1.prototype,"url",null),y([w({type:String,readOnly:!0})],X1.prototype,"cdnUrl",null),y([w({type:String,readOnly:!0})],X1.prototype,"itemRelativeUrl",null),X1=y([Z("esri.portal.PortalItemResource")],X1);const wot=X1;let A4=class extends ze{constructor(e){super(e),this.created=null,this.rating=null}};y([w()],A4.prototype,"created",void 0),y([w()],A4.prototype,"rating",void 0),A4=y([Z("esri.portal.PortalRating")],A4);const $H=A4;var I3;const xot=new Set(["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","GeoJson","CSV","KML","WFS","WMTS","WMS","Feed"]),Sot=new Set(["KML","GeoJson","CSV"]);let ar=I3=class extends P_(jf){static from(t){return MT(I3,t)}constructor(t){super(t),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const t=this.type,e=this.typeKeywords||[];let i=t;return t==="Feature Service"||t==="Feature Collection"?i=e.includes("Table")?"Table":e.includes("Route Layer")?"Route Layer":e.includes("Markup")?"Markup":"Feature Layer":t==="Image Service"?i=e.includes("Elevation 3D Layer")?"Elevation Layer":e.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":t==="Scene Service"?i="Scene Layer":t==="Video Service"?i="Video Layer":t==="Scene Package"?i="Scene Layer Package":t==="Stream Service"?i="Feature Layer":t==="Geoprocessing Service"?i=e.includes("Web Tool")?"Tool":"Geoprocessing Service":t==="Geocoding Service"?i="Locator":t==="Geoenrichment Service"?i="GeoEnrichment Service":t==="Microsoft Powerpoint"?i="Microsoft PowerPoint":t==="GeoJson"?i="GeoJSON":t==="Globe Service"?i="Globe Layer":t==="Vector Tile Service"?i="Tile Layer":t==="netCDF"?i="NetCDF":t==="Map Service"?i=e.includes("Spatiotemporal")||!e.includes("Hosted Service")&&!e.includes("Tiled")||e.includes("Relational")?"Map Image Layer":"Tile Layer":t&&t.toLowerCase().includes("add in")?i=t.replaceAll(/(add in)/gi,"Add-In"):t==="datastore catalog service"?i="Big Data File Share":t==="Compact Tile Package"?i="Tile Package (tpkx)":t==="OGCFeatureServer"?i="OGC Feature Layer":t==="web mapping application"&&e.includes("configurableApp")?i="Instant App":t==="Insights Page"?i="Insights Report":t==="Excalibur Imagery Project"&&(i="Excalibur Project"),i}readExtent(t){return t&&t.length?new Vi(t[0][0],t[0][1],t[1][0],t[1][1]):null}get iconUrl(){var T;const t=((T=this.type)==null?void 0:T.toLowerCase())||"",e=this.typeKeywords||[],i="esri/images/portal/",r="16";let n,s=!1,o=!1,l=!1,c=!1,f=!1,_=!1,x=!1;return t.indexOf("service")>0||t==="feature collection"||t==="kml"||t==="wms"||t==="wmts"||t==="wfs"?(s=e.includes("Hosted Service"),t==="feature service"||t==="feature collection"||t==="kml"||t==="wfs"?(o=e.includes("Table"),l=e.includes("Route Layer"),c=e.includes("Markup"),f=e.includes("Spatiotemporal"),_=e.includes("UtilityNetwork"),n=f&&o?"spatiotemporaltable":o?"table":l?"routelayer":c?"markup":f?"spatiotemporal":s?"featureshosted":_?"utilitynetwork":"features"):n=t==="map service"||t==="wms"||t==="wmts"?s||e.includes("Tiled")||t==="wmts"?"maptiles":"mapimages":t==="scene service"?e.includes("Line")?"sceneweblayerline":e.includes("3DObject")?"sceneweblayermultipatch":e.includes("Point")?"sceneweblayerpoint":e.includes("IntegratedMesh")?"sceneweblayermesh":e.includes("PointCloud")?"sceneweblayerpointcloud":e.includes("Polygon")?"sceneweblayerpolygon":e.includes("Building")?"sceneweblayerbuilding":e.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":t==="image service"?e.includes("Elevation 3D Layer")?"elevationlayer":e.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":t==="stream service"?"streamlayer":t==="video service"?e.includes("Live Stream")?"livestreamvideolayer":"videolayer":t==="vector tile service"?"vectortile":t==="datastore catalog service"?"datastorecollection":t==="geocoding service"?"geocodeservice":t==="geoprocessing service"?e.includes("Web Tool")?"tool":"layers":t==="geodata service"?"geodataservice":t==="3dtiles service"?"3dtileslayer":"layers"):t==="web map"||t==="cityengine web scene"?n="maps":t==="web scene"?n=e.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":t==="web mapping application"&&e.includes("configurableApp")?n="instantapps":t==="web mapping application"||t==="mobile application"||t==="application"||t==="operation view"||t==="desktop application"?n="apps":t==="map document"||t==="map package"||t==="published map"||t==="scene document"||t==="globe document"||t==="basemap package"||t==="mobile basemap package"||t==="mobile map package"||t==="project package"||t==="project template"||t==="pro map"||t==="layout"||t==="layer"&&e.includes("ArcGIS Pro")||t==="explorer map"&&e.indexOf("Explorer Document")?n="mapsgray":t==="service definition"||t==="csv"||t==="shapefile"||t==="cad drawing"||t==="geojson"||t==="netcdf"||t==="administrative report"?n="datafiles":t==="explorer add in"||t==="desktop add in"||t==="windows viewer add in"||t==="windows viewer configuration"?n="appsgray":t==="360 vr experience"?n="360vr":t==="arcgis pro add in"||t==="arcgis pro configuration"?n="addindesktop":t==="rule package"||t==="file geodatabase"||t==="sqlite geodatabase"||t==="csv collection"||t==="kml collection"||t==="windows mobile package"||t==="map template"||t==="desktop application template"||t==="gml"||t==="arcpad package"||t==="code sample"||t==="document link"||t==="earth configuration"||t==="operations dashboard add in"||t==="rules package"||t==="image"||t==="workflow manager package"||t==="explorer map"&&e.includes("Explorer Mapping Application")||e.includes("Document")?n="datafilesgray":t==="network analysis service"||t==="geoprocessing service"||t==="geodata service"||t==="geometry service"||t==="geoprocessing package"||t==="locator package"||t==="geoprocessing sample"||t==="workflow manager service"?n="toolsgray":t==="layer"||t==="layer package"||t==="explorer layer"?n="layersgray":t==="scene package"?n="scenepackage":t==="3dtiles package"?n="3dtileslayerpackage":t==="mobile scene package"?n="mobilescenepackage":t==="tile package"||t==="compact tile package"?n="tilepackage":t==="task file"?n="taskfile":t==="report template"?n="report-template":t==="statistical data collection"?n="statisticaldatacollection":t==="insights workbook"?n="workbook":t==="insights model"?n="insightsmodel":t==="insights page"?n="insightspage":t==="insights theme"?n="insightstheme":t==="hub initiative"?n="hubinitiative":t==="hubpage"?n="hubpage":t==="hub event"?n="hubevent":t==="hub site application"?n="hubsite":t==="hub project"?n="hubproject":t==="relational database connection"?n="relationaldatabaseconnection":t==="big data file share"?n="datastorecollection":t==="image collection"?n="imagecollection":t==="style"?n="style":t==="desktop style"?n="desktopstyle":t==="dashboard"?n="dashboard":t==="raster function template"?n="rasterprocessingtemplate":t==="vector tile package"?n="vectortilepackage":t==="ortho mapping project"?n="orthomappingproject":t==="ortho mapping template"?n="orthomappingtemplate":t==="solution"?n="solutions":t==="geopackage"?n="geopackage":t==="deep learning package"?n="deeplearningpackage":t==="real time analytic"?n="realtimeanalytics":t==="big data analytic"?n="bigdataanalytics":t==="feed"?n="feed":t==="excalibur imagery project"?n="excaliburimageryproject":t==="notebook"?n="notebook":t==="storymap"?n="storymap":t==="survey123 add in"?n="survey123addin":t==="mission"?n="mission":t==="mission report"?n="missionreport":t==="mission template"?n="missiontemplate":t==="quickcapture project"?n="quickcaptureproject":t==="pro report"?n="proreport":t==="pro report template"?n="proreporttemplate":t==="urban model"?n="urbanmodel":t==="web experience"?n="experiencebuilder":t==="web experience template"?n="webexperiencetemplate":t==="experience builder widget"?n="experiencebuilderwidget":t==="experience builder widget package"?n="experiencebuilderwidgetpackage":t==="workflow"?n="workflow":t==="insights script"?n="insightsscript":t==="kernel gateway connection"?n="kernelgatewayconnection":t==="hub initiative template"?n="hubinitiativetemplate":t==="storymap theme"?n="storymaptheme":t==="knowledge graph"?n="knowledgegraph":t==="knowledge studio project"?n="knowledgestudio":t==="native application"?n="nativeapp":t==="native application installer"?n="nativeappinstaller":t==="link chart"?n="linkchart":t==="investigation"?n="investigation":t==="ogcfeatureserver"?n="features":t==="pro project"?n="proproject":t==="insights workbook package"?n="insightsworkbookpackage":t==="apache parquet"?n="apacheparquet":t==="notebook code snippets"||t==="notebook code snippet library"?n="notebookcodesnippets":t==="suitability model"?n="suitabilitymodel":t==="esri classifier definition"?n="classifierdefinition":t==="esri classification schema"?n="classificationschema":t==="insights data engineering workbook"?n="dataengineeringworkbook":t==="insights data engineering model"?n="dataengineeringmodel":t==="deep learning studio project"?n="deeplearningproject":t==="discussion"?n="discussion":t==="allsource project"?n="allsourceproject":t==="api key"?n="apikey":t==="data pipeline"?n="datapipelines":t==="group layer"?(x=e.includes("Map"),n=x?"layergroup2d":"layergroup"):n=t==="media layer"?"onlinemedialayer":t==="form"?e.includes("Survey123")?"survey":"datafilesgray":"maps",n?Wr(i+n+r+".png"):null}get isLayer(){return this.type!=null&&xot.has(this.type)}get itemCdnUrl(){let t=this.itemUrl;return t&&yr&&!yr.findCredential(t)&&(t=yr._normalizeAGOLorgDomain(t),t=t.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),t=t.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),t=t.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),t}get itemPageUrl(){var e;const t=(e=this.portal)==null?void 0:e.itemPageUrl;return t&&this.id?`${t}?id=${this.id}`:null}get itemUrl(){var e;const t=(e=this.portal)==null?void 0:e.restUrl;return t&&this.id?`${t}/content/items/${this.id}`:null}get thumbnailUrl(){var i;const t=this.itemUrl,e=this.thumbnail;return t&&e?((i=this.portal)==null?void 0:i.normalizeUrl(`${t}/info/${e}?f=json`))??null:null}get userItemUrl(){var i,r,n;const t=(i=this.portal)==null?void 0:i.restUrl;if(!t)return null;const e=this.owner||((n=(r=this.portal)==null?void 0:r.user)==null?void 0:n.username);return e?`${t}/content/users/${this.ownerFolder?`${e}/${this.ownerFolder}`:e}/items/${this.id}`:null}load(t){const e=this.portal??(this.portal=os.getDefault()),i=e.load(t).then(()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?e.request(this.itemUrl,{signal:t!=null?t.signal:null,query:{token:this.apiKey}}):{}).then(r=>{this.sourceJSON=r,this.read(r)});return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(t){const e={method:"post",query:{}};return t instanceof $H&&(t=t.rating),t==null||isNaN(t)||typeof t!="number"||(e.query.rating=t),this.portal?(await this.portal.request(this.itemUrl+"/addRating",e),new $H({rating:t,created:new Date})):null}clone(){const t={access:this.access,accessInformation:this.accessInformation,applicationProxies:Re(this.applicationProxies),avgRating:this.avgRating,categories:Re(this.categories),created:Re(this.created),culture:this.culture,description:this.description,extent:Re(this.extent),groupCategories:Re(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:Re(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:Re(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:Re(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:Re(this.typeKeywords),url:this.url};this.loaded&&(t.loadStatus="loaded");const e=new I3({sourceJSON:this.sourceJSON}).set(t);return e._set("isOrgItem",this.isOrgItem),e}createPostQuery(){var i;const t=this.toJSON();for(const r of["tags","typeKeywords","categories"])t[r]=(i=t[r])==null?void 0:i.join(", ");const{extent:e}=t;return e&&(t.extent=JSON.stringify(e)),t}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(t="json",e){return this.portal.request(this.itemUrl+"/data",{responseType:t,...e,query:{token:this.apiKey}})}async fetchRating(t){const e=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...t});return e.rating!=null?(e.created=new Date(e.created),new $H(e)):null}fetchRelatedItems(t,e){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...t,token:this.apiKey},...e},I3)}getThumbnailUrl(t){let e=this.thumbnailUrl;return e&&t&&(e+=`&w=${t}`),e}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then(t=>(this.sourceJSON=t,this.read(t),this))}update(t){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const e=t==null?void 0:t.data,i={method:"post"};i.query=this.createPostQuery();for(const r in i.query)i.query[r]===null&&(i.query[r]="");return i.query.clearEmptyFields=!0,e!=null&&(typeof e=="string"?i.query.text=e:typeof e=="object"&&(i.query.text=JSON.stringify(e))),this.portal.request(`${this.userItemUrl}/update`,i).then(()=>this.reload())}):Promise.reject(new se("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(t){if(!this.id)throw new se("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:e,itemUrl:i}=this;await e.signIn();const{copyResources:r,folder:n,tags:s,title:o}=t||{},l={method:"post",query:{copyPrivateResources:r==="all",folder:typeof n=="string"?n:n==null?void 0:n.id,includeResources:!!r,tags:s==null?void 0:s.join(","),title:o}},{itemId:c}=await e.request(`${i}/copy`,l);return new I3({id:c,portal:e})}updateThumbnail(t){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const e=t.thumbnail,i=t.filename,r={method:"post"};if(typeof e=="string")i1(e)?r.query={data:e}:r.query={url:Gh(e)},i!=null&&(r.query.filename=i);else{const n=new FormData;i!=null?n.append("file",e,i):n.append("file",e),r.body=n}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then(()=>this.reload())}):Promise.reject(new se("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(t={},e){const{fetchResources:i}=await we(()=>Promise.resolve().then(()=>P4),void 0);return i(this,t,e)}async addResource(t,e,i){const{addOrUpdateResource:r}=await we(()=>Promise.resolve().then(()=>P4),void 0);return t.portalItem=this,r(t,"add",e,i)}async removeResource(t,e){const{removeResource:i}=await we(()=>Promise.resolve().then(()=>P4),void 0);if(t.portalItem&&t.portalItem.itemUrl!==this.itemUrl)throw new se("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return i(this,t,e)}async removeAllResources(t){const{removeAllResources:e}=await we(()=>Promise.resolve().then(()=>P4),void 0);return e(this,t)}resourceFromPath(t){return new wot({portalItem:this,path:t})}toJSON(){var i,r;const t=this.extent,e={accessInformation:this.accessInformation,categories:Re(this.categories),created:(i=this.created)==null?void 0:i.getTime(),description:this.description,extent:t&&[[t.xmin,t.ymin],[t.xmax,t.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:(r=this.modified)==null?void 0:r.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:Re(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:Re(this.typeKeywords),url:this.url};return q3e(e)}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");return new I3({sourceJSON:t})}_getPostQuery(){const t=this.toJSON();for(const e in t)e==="tags"&&t[e]!==null&&(t[e]=t[e].join(", ")),e==="typeKeywords"&&t[e]!==null&&(t[e]=t[e].join(", ")),e==="extent"&&t[e]&&(t[e]=JSON.stringify(t[e]));return t}};y([w({type:["private","shared","org","public"]})],ar.prototype,"access",void 0),y([w()],ar.prototype,"accessInformation",void 0),y([w({type:String})],ar.prototype,"apiKey",void 0),y([w({json:{read:{source:"appProxies"}}})],ar.prototype,"applicationProxies",void 0),y([w()],ar.prototype,"avgRating",void 0),y([w()],ar.prototype,"categories",void 0),y([w({type:Date})],ar.prototype,"created",void 0),y([w()],ar.prototype,"culture",void 0),y([w()],ar.prototype,"description",void 0),y([w({readOnly:!0})],ar.prototype,"displayName",null),y([w({type:Vi})],ar.prototype,"extent",void 0),y([$t("extent")],ar.prototype,"readExtent",null),y([w()],ar.prototype,"groupCategories",void 0),y([w({readOnly:!0})],ar.prototype,"iconUrl",null),y([w()],ar.prototype,"id",void 0),y([w({readOnly:!0})],ar.prototype,"isLayer",null),y([w({type:Boolean,readOnly:!0})],ar.prototype,"isOrgItem",void 0),y([w()],ar.prototype,"itemControl",void 0),y([w({readOnly:!0})],ar.prototype,"itemPageUrl",null),y([w({readOnly:!0})],ar.prototype,"itemUrl",null),y([w()],ar.prototype,"licenseInfo",void 0),y([w({type:Date})],ar.prototype,"modified",void 0),y([w()],ar.prototype,"name",void 0),y([w()],ar.prototype,"numComments",void 0),y([w()],ar.prototype,"numRatings",void 0),y([w()],ar.prototype,"numViews",void 0),y([w()],ar.prototype,"owner",void 0),y([w()],ar.prototype,"ownerFolder",void 0),y([w({type:os})],ar.prototype,"portal",void 0),y([w()],ar.prototype,"screenshots",void 0),y([w()],ar.prototype,"size",void 0),y([w()],ar.prototype,"snippet",void 0),y([w()],ar.prototype,"sourceJSON",void 0),y([w({type:String})],ar.prototype,"sourceUrl",void 0),y([w({type:String})],ar.prototype,"spatialReference",void 0),y([w()],ar.prototype,"tags",void 0),y([w()],ar.prototype,"thumbnail",void 0),y([w({readOnly:!0})],ar.prototype,"thumbnailUrl",null),y([w()],ar.prototype,"title",void 0),y([w()],ar.prototype,"type",void 0),y([w()],ar.prototype,"typeKeywords",void 0),y([w({type:String,json:{read(t,e){var i;if(Sot.has(e.type)){const r=(i=this.portal)==null?void 0:i.restUrl;t||(t=r&&this.id?`${r}/content/items/${this.id}/data`:null)}return t}}})],ar.prototype,"url",void 0),y([w({readOnly:!0})],ar.prototype,"userItemUrl",null),ar=I3=y([Z("esri.portal.PortalItem")],ar);const Am=ar,x5e=Object.freeze(Object.defineProperty({__proto__:null,default:Am},Symbol.toStringTag,{value:"Module"})),kh=Math.PI/180,Tot=/(?:SPHEROID|ELLIPSOID)\[([^\]]+)]/i,sb=Mr.radius,d0=Mr.eccentricitySquared,Eot={a1:sb*d0,a2:sb*d0*sb*d0,a3:sb*d0*d0/2,a4:sb*d0*sb*d0*2.5,a5:sb*d0+sb*d0*d0/2,a6:1-d0},Cot={4267:{a:63782064e-1,f:1/294.9786982},4269:{a:6378137,f:1/298.257222101},4326:{a:Mr.radius,f:Mr.flattening},104900:{a:2439700,f:0},104901:{a:6051e3,f:0},104902:{a:6051800,f:0},104903:{a:u_.radius,f:u_.flattening},104904:{a:3393400,f:1/192.0430107526882},104905:{a:Sy.radius,f:Sy.flattening},104906:{a:6200,f:0},104907:{a:11100,f:0},104908:{a:71492e3,f:.06487439154031222},104909:{a:8200,f:0},104910:{a:83500,f:0},104911:{a:1e4,f:0},104912:{a:2409300,f:0},104913:{a:15e3,f:0},104914:{a:4e4,f:0},104915:{a:1562090,f:0},104916:{a:2632345,f:0},104917:{a:85e3,f:0},104918:{a:1821460,f:0},104919:{a:5e3,f:0},104920:{a:12e3,f:0},104921:{a:3e4,f:3},104922:{a:18e3,f:0},104923:{a:14e3,f:0},104924:{a:49300,f:0},104925:{a:60268e3,f:1/10.2079945799458},104926:{a:16e3,f:0},104927:{a:9500,f:0},104928:{a:56e4,f:0},104929:{a:249400,f:0},104930:{a:59500,f:0},104931:{a:16e3,f:0},104932:{a:133e3,f:0},104933:{a:718e3,f:0},104934:{a:888e3,f:0},104935:{a:1986300,f:0},104936:{a:1e4,f:0},104937:{a:41900,f:0},104938:{a:11e4,f:0},104939:{a:50100,f:0},104940:{a:764e3,f:0},104941:{a:11e3,f:0},104942:{a:529800,f:0},104943:{a:2575e3,f:0},104944:{a:25559e3,f:1/43.61604095563141},104945:{a:578900,f:0},104946:{a:33e3,f:0},104947:{a:21e3,f:0},104948:{a:13e3,f:0},104949:{a:31e3,f:0},104950:{a:27e3,f:0},104951:{a:42e3,f:0},104952:{a:235800,f:0},104953:{a:761400,f:0},104954:{a:15e3,f:0},104955:{a:54e3,f:0},104956:{a:77e3,f:0},104957:{a:27e3,f:0},104958:{a:788900,f:0},104959:{a:584700,f:0},104960:{a:24764e3,f:.01708124697141011},104961:{a:74e3,f:0},104962:{a:79e3,f:0},104963:{a:104e3,f:.14423076923076922},104964:{a:29e3,f:0},104965:{a:17e4,f:0},104966:{a:208e3,f:0},104967:{a:4e4,f:0},104968:{a:1352600,f:0},104969:{a:1195e3,f:0},104970:{a:593e3,f:0},104971:{a:Sy.radius,f:0},104972:{a:47e4,f:0},104973:{a:255e3,f:0},104974:{a:2439400,f:0}};var Oe;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.SPHERICAL_ECEF=1]="SPHERICAL_ECEF",t[t.WGS84=2]="WGS84",t[t.WEB_MERCATOR=3]="WEB_MERCATOR",t[t.WGS84_ECEF=4]="WGS84_ECEF",t[t.CGCS2000=5]="CGCS2000",t[t.WGS84_COMPARABLE_LON_LAT=6]="WGS84_COMPARABLE_LON_LAT",t[t.SPHERICAL_MARS_PCPF=7]="SPHERICAL_MARS_PCPF",t[t.GCSMARS2000=8]="GCSMARS2000",t[t.SPHERICAL_MOON_PCPF=9]="SPHERICAL_MOON_PCPF",t[t.GCSMOON2000=10]="GCSMOON2000",t[t.LON_LAT=11]="LON_LAT",t[t.PLATE_CARREE=12]="PLATE_CARREE"})(Oe||(Oe={}));const CM={[Oe.WGS84]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:Qn,[Oe.SPHERICAL_ECEF]:r2,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:t5,[Oe.PLATE_CARREE]:i2,[Oe.WGS84]:Qn,[Oe.WGS84_ECEF]:s2},[Oe.CGCS2000]:{[Oe.CGCS2000]:Qn,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:Qn,[Oe.SPHERICAL_ECEF]:r2,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:i2,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:s2},[Oe.GCSMARS2000]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:Qn,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:null,[Oe.SPHERICAL_ECEF]:null,[Oe.SPHERICAL_MARS_PCPF]:UK,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:null,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:null},[Oe.GCSMOON2000]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:Qn,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:null,[Oe.SPHERICAL_ECEF]:null,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:zK,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:null,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:null},[Oe.WEB_MERCATOR]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:pT,[Oe.WGS84_COMPARABLE_LON_LAT]:pT,[Oe.SPHERICAL_ECEF]:T5e,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:Qn,[Oe.PLATE_CARREE]:C5e,[Oe.WGS84]:pT,[Oe.WGS84_ECEF]:E5e},[Oe.WGS84_ECEF]:{[Oe.CGCS2000]:o2,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:o2,[Oe.WGS84_COMPARABLE_LON_LAT]:o2,[Oe.SPHERICAL_ECEF]:O5e,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:P5e,[Oe.PLATE_CARREE]:Aot,[Oe.WGS84]:o2,[Oe.WGS84_ECEF]:Qn},[Oe.SPHERICAL_ECEF]:{[Oe.CGCS2000]:n2,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:n2,[Oe.WGS84_COMPARABLE_LON_LAT]:n2,[Oe.SPHERICAL_ECEF]:Qn,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:A5e,[Oe.PLATE_CARREE]:Mot,[Oe.WGS84]:n2,[Oe.WGS84_ECEF]:M5e},[Oe.SPHERICAL_MARS_PCPF]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:BK,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:BK,[Oe.WGS84_COMPARABLE_LON_LAT]:null,[Oe.SPHERICAL_ECEF]:null,[Oe.SPHERICAL_MARS_PCPF]:Qn,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:null,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:null},[Oe.SPHERICAL_MOON_PCPF]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:VK,[Oe.LON_LAT]:VK,[Oe.WGS84_COMPARABLE_LON_LAT]:null,[Oe.SPHERICAL_ECEF]:null,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:Qn,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:null,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:null},[Oe.UNKNOWN]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:null,[Oe.WGS84_COMPARABLE_LON_LAT]:null,[Oe.SPHERICAL_ECEF]:null,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:Qn,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:null,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:null},[Oe.LON_LAT]:{[Oe.CGCS2000]:Qn,[Oe.GCSMARS2000]:Qn,[Oe.GCSMOON2000]:Qn,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:Qn,[Oe.SPHERICAL_ECEF]:r2,[Oe.SPHERICAL_MARS_PCPF]:UK,[Oe.SPHERICAL_MOON_PCPF]:zK,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:t5,[Oe.PLATE_CARREE]:i2,[Oe.WGS84]:Qn,[Oe.WGS84_ECEF]:s2},[Oe.WGS84_COMPARABLE_LON_LAT]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:Qn,[Oe.SPHERICAL_ECEF]:r2,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:i2,[Oe.WGS84]:Qn,[Oe.WGS84_ECEF]:s2},[Oe.PLATE_CARREE]:{[Oe.CGCS2000]:qS,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:qS,[Oe.WGS84_COMPARABLE_LON_LAT]:qS,[Oe.SPHERICAL_ECEF]:Oot,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:Pot,[Oe.PLATE_CARREE]:Qn,[Oe.WGS84]:qS,[Oe.WGS84_ECEF]:Rot}};function S5e(t){const e=_L(t,I5e);return CM[e][Oe.WGS84_COMPARABLE_LON_LAT]}function ooe(t,e,i=R5e()){return t==null||e==null?null:$ot(t,e,i).projector}function ZJt(t,e){switch(ooe(t,e,uoe)){case Qn:return"copy3";case r2:return"wgs84ToSphericalECEF";case t5:return"wgs84ToWebMercator";case i2:return"wgs84ToPlateCarree";case s2:return"wgs84ToWGS84ECEF";case pT:return"webMercatorToWGS84";case T5e:return"webMercatorToSphericalECEF";case E5e:return"webMercatorToWGS84ECEF";case C5e:return"webMercatorToPlateCarree";case o2:return"wgs84ECEFToWGS84";case O5e:return"wgs84ECEFToSphericalECEF";case P5e:return"wgs84ECEFToWebMercator";case n2:return"sphericalECEFToWGS84";case A5e:return"sphericalECEFToWebMercator";case BK:return"sphericalMarsPCPFToMars2000";case VK:return"sphericalMoonPCPFToMoon2000";case M5e:return"sphericalECEFToWGS84ECEF";case UK:return"mars2000ToSphericalPCPF";case zK:return"moon2000ToSphericalPCPF";default:return null}}function _L(t,e){return t?e.spatialReference===t?e.spatialReferenceId:(e.spatialReference=t,"metersPerUnit"in e&&(e.metersPerUnit=ws(t,1)),Az(t)?e.spatialReferenceId=Oe.SPHERICAL_ECEF:cL(t)?e.spatialReferenceId=Oe.WGS84:LT(t)?e.spatialReferenceId=Oe.WEB_MERCATOR:uL(t)?e.spatialReferenceId=Oe.PLATE_CARREE:t.wkt===FCe.wkt?e.spatialReferenceId=Oe.WGS84_ECEF:t.wkid===wf.CGCS2000?e.spatialReferenceId=Oe.CGCS2000:t.wkt===hB.wkt?e.spatialReferenceId=Oe.SPHERICAL_MARS_PCPF:t.wkt===dB.wkt?e.spatialReferenceId=Oe.SPHERICAL_MOON_PCPF:r1(t)?e.spatialReferenceId=Oe.GCSMARS2000:n1(t)?e.spatialReferenceId=Oe.GCSMOON2000:e.spatialReferenceId=Oe.UNKNOWN):Oe.UNKNOWN}function Qn(t,e,i,r){t!==i&&(i[r++]=t[e++],i[r++]=t[e++],i[r]=t[e])}function pT(t,e,i,r){i[r++]=r5*(t[e++]/Mr.radius),i[r++]=r5*(Math.PI/2-2*Math.atan(Math.exp(-t[e++]/Mr.radius))),i[r]=t[e]}function T5e(t,e,i,r){pT(t,e,i,r),r2(i,r,i,r)}function E5e(t,e,i,r){pT(t,e,i,r),s2(i,r,i,r)}function aoe(t,e,i,r,n){const s=.4999999*Math.PI,o=Je(i5*t[e+1],-s,s),l=Math.sin(o);i[r++]=i5*t[e]*n.radius,i[r++]=n.halfSemiMajorAxis*Math.log((1+l)/(1-l)),i[r]=t[e+2]}function t5(t,e,i,r){aoe(t,e,i,r,Mr)}const Kpe=Mr.radius*Math.PI/180,Qpe=180/(Mr.radius*Math.PI);function i2(t,e,i,r){i[r]=t[e]*Kpe,i[r+1]=t[e+1]*Kpe,i[r+2]=t[e+2]}function qS(t,e,i,r){i[r]=t[e]*Qpe,i[r+1]=t[e+1]*Qpe,i[r+2]=t[e+2]}function C5e(t,e,i,r){pT(t,e,i,r),i2(i,r,i,r)}function Aot(t,e,i,r){o2(t,e,i,r),i2(i,r,i,r)}function Mot(t,e,i,r){n2(t,e,i,r),i2(i,r,i,r)}function Oot(t,e,i,r){qS(t,e,i,r),r2(i,r,i,r)}function Pot(t,e,i,r){qS(t,e,i,r),t5(i,r,i,r)}function Rot(t,e,i,r){qS(t,e,i,r),s2(i,r,i,r)}function loe(t,e,i,r,n){const s=n+t[e+2],o=i5*t[e+1],l=i5*t[e],c=Math.cos(o);i[r++]=Math.cos(l)*c*s,i[r++]=Math.sin(l)*c*s,i[r]=Math.sin(o)*s}function zK(t,e,i,r){loe(t,e,i,r,u_.radius)}function UK(t,e,i,r){loe(t,e,i,r,Sy.radius)}function r2(t,e,i,r){loe(t,e,i,r,Mr.radius)}function coe(t,e,i,r,n){const s=t[e],o=t[e+1],l=t[e+2],c=Math.sqrt(s*s+o*o+l*l),f=Gf(l/(c===0?1:c)),_=Math.atan2(o,s);i[r++]=r5*_,i[r++]=r5*f,i[r]=c-n}function VK(t,e,i,r){coe(t,e,i,r,u_.radius)}function BK(t,e,i,r){coe(t,e,i,r,Sy.radius)}function n2(t,e,i,r){coe(t,e,i,r,Mr.radius)}function A5e(t,e,i,r){n2(t,e,i,r),t5(i,r,i,r)}function M5e(t,e,i,r){n2(t,e,i,r),s2(i,r,i,r)}function Iot(t,e,i,r,n){const s=i5*t[e],o=i5*t[e+1],l=t[e+2],c=Math.sin(o),f=Math.cos(o),_=n.radius/Math.sqrt(1-n.eccentricitySquared*c*c);i[r++]=(_+l)*f*Math.cos(s),i[r++]=(_+l)*f*Math.sin(s),i[r++]=(_*(1-n.eccentricitySquared)+l)*c}function s2(t,e,i,r){Iot(t,e,i,r,Mr)}function o2(t,e,i,r){const n=Eot,s=t[e],o=t[e+1],l=t[e+2];let c,f,_,x,T,A,M,I,L,F,z,k,U,j,H,Y,Q,ne,re,he,ce;c=Math.abs(l),f=s*s+o*o,_=Math.sqrt(f),x=f+l*l,T=Math.sqrt(x),he=Math.atan2(o,s),A=l*l/x,M=f/x,j=n.a2/T,H=n.a3-n.a4/T,M>.3?(I=c/T*(1+M*(n.a1+j+A*H)/T),re=Math.asin(I),F=I*I,L=Math.sqrt(1-F)):(L=_/T*(1-A*(n.a5-j-M*H)/T),re=Math.acos(L),F=1-L*L,I=Math.sqrt(F)),z=1-Mr.eccentricitySquared*F,k=Mr.radius/Math.sqrt(z),U=n.a6*k,j=_-k*L,H=c-U*I,Q=L*j+I*H,Y=L*H-I*j,ne=Y/(U/z+Q),re+=ne,ce=Q+Y*ne/2,l<0&&(re=-re),i[r++]=r5*he,i[r++]=r5*re,i[r]=ce}function O5e(t,e,i,r){o2(t,e,i,r),r2(i,r,i,r)}function P5e(t,e,i,r){o2(t,e,i,r),t5(i,r,i,r)}function $ot(t,e,i){if(t==null||e==null||i.source.spatialReference===t&&i.dest.spatialReference===e)return i;const r=_L(t,i.source),n=_L(e,i.dest);return r===Oe.UNKNOWN&&n===Oe.UNKNOWN?Zn(t,e)?i.projector=Qn:i.projector=null:i.projector=CM[r][n],i}function R5e(){return{source:{spatialReference:null,spatialReferenceId:Oe.UNKNOWN,metersPerUnit:1},dest:{spatialReference:null,spatialReferenceId:Oe.UNKNOWN,metersPerUnit:1},projector:Qn}}const I5e={spatialReference:null,spatialReferenceId:Oe.UNKNOWN},Lot={spatialReference:null,spatialReferenceId:Oe.UNKNOWN},uoe=R5e(),i5=Ei(1),r5=pu(1);function vn(t,e,i,r,n,s,o=1){const l=ooe(e,n,uoe);if(l==null)return!1;if(l===Qn){if(t===r&&i===s)return!0;const f=i+3*o;for(let _=i,x=s;_=0;i--){const r=this.steps[i];e.steps.push(r.getInverse())}return e}getGTListEntry(){let e="";for(const i of this.steps)e+=i.uid.toString()+",";return e!==this._chain&&(this._gtlistentry=null,this._cachedProjection={},this._chain=e),this._gtlistentry}assignCachedGe(e,i,r){this._cachedProjection[M4.cacheKey(e,i)]=r}getCachedGeTransformation(e,i){let r="";for(const s of this.steps)r+=s.uid.toString()+",";r!==this._chain&&(this._gtlistentry=null,this._cachedProjection={},this._chain=r);const n=this._cachedProjection[M4.cacheKey(e,i)];return n===void 0?null:n}};function Dot(t,e,i){if(e==null||i==null||i.vcsWkid||Zn(e,i)||A2(e)||A2(i))return null;const r=Bf(e)/Bf(i);if(r===1)return null;switch(t){case"point":case"esriGeometryPoint":return n=>Not(n,r);case"polyline":case"esriGeometryPolyline":return n=>kot(n,r);case"polygon":case"esriGeometryPolygon":return n=>Fot(n,r);case"multipoint":case"esriGeometryMultipoint":return n=>zot(n,r);case"extent":case"esriGeometryEnvelope":return n=>Uot(n,r);default:return null}}function Not(t,e){(t==null?void 0:t.z)!=null&&(t.z*=e)}function Fot(t,e){if(t)for(const i of t.rings)for(const r of i)r.length>2&&(r[2]*=e)}function kot(t,e){if(t)for(const i of t.paths)for(const r of i)r.length>2&&(r[2]*=e)}function zot(t,e){if(t)for(const i of t.points)i.length>2&&(i[2]*=e)}function Uot(t,e){t&&t.zmin!=null&&t.zmax!=null&&(t.zmin*=e,t.zmax*=e)}let Mm=null,L2=null,s$=null,iF={};const hoe=new v9;function ox(){return!!Mm&&PCe()}function Vot(){return!!ox()||(wi(hoe),g_(),!1)}function g_(t){return s$==null&&(s$=Promise.all([RCe(),we(()=>Promise.resolve().then(()=>LVt),void 0).then(e=>e.g),we(()=>Promise.resolve().then(()=>VVt),void 0)])),s$.then(([,e,{hydratedAdapter:i}])=>{St(t),L2=i,Mm=e.default,Mm._enableProjection(vKe),hoe.notify()})}function rl(t,e,i=null,r=null){return Array.isArray(t)?t.length===0?[]:GK(L2,t,t[0].spatialReference,e,i,r):GK(L2,[t],t.spatialReference,e,i,r)[0]}function GK(t,e,i,r,n=null,s=null){if(i==null||r==null)return e;if(th(i,r,n))return e.map(o=>o$(o,i,r));if(n==null&&Az(i))return e.map(o=>o$(o,i,at.WGS84)).map(o=>bL(o,r));if(n==null&&Az(r))return e.map(o=>bL(o,at.WGS84)).map(o=>o$(o,at.WGS84,r));if(n==null){const o=Xz.cacheKey(i,r);iF[o]!==void 0?n=iF[o]:((n=D5e(i,r,void 0))==null&&(n=new Xz),iF[o]=n)}if(Mm==null||t==null)throw new ZB;return s!=null?Mm._project(t,e,i,r,n,s):Mm._project(t,e,i,r,n)}function $5e(t,e){const i=L5e([t],e);return i.pending!=null?{pending:i.pending,geometry:null}:i.geometries!=null?{pending:null,geometry:i.geometries[0]}:{pending:null,geometry:null}}function L5e(t,e){if(!ox()){for(const i of t)if(i!=null&&!Zn(i.spatialReference,e)&&wc(i.spatialReference)&&wc(e)&&!th(i.spatialReference,e))return wi(hoe),{pending:g_(),geometries:null}}return{pending:null,geometries:t.map(i=>i==null?null:Zn(i.spatialReference,e)?i:wc(i.spatialReference)&&wc(e)?bL(i,e):null)}}function D5e(t,e,i=null){if(t==null||e==null)return null;if(Mm==null||L2==null)throw new ZB;const r=Mm._getTransformation(L2,t,e,i,i==null?void 0:i.spatialReference);return r!==null?Xz.fromGE(r):null}function Bot(t,e,i=null){if(Mm==null||L2==null)throw new ZB;const r=Mm._getTransformationBySuitability(L2,t,e,i,i==null?void 0:i.spatialReference);if(r!==null){const n=[];for(const s of r)n.push(Xz.fromGE(s));return n}return[]}let ZB=class extends se{constructor(){super("projection:not-loaded","projection engine not fully loaded yet, please call load()")}};function jot(){Mm=null,L2=null,s$=null,iF={}}const Got={get loadPromise(){return s$}};function bL(t,e){try{const i=rl(t,e);if(i==null)return null;"xmin"in t&&"xmin"in i&&(i.zmin=t.zmin,i.zmax=t.zmax);const r=Dot(i.type,t.spatialReference,e);return r!=null&&r(i),i}catch(i){if(!(i instanceof ZB))throw i;return null}}async function qy(t,e,i){const r=t.spatialReference;return r!=null&&e!=null&&await y_(r,e,null,i),bL(t,e)}function th(t,e,i){return!i&&(!!Zn(t,e)||wc(t)&&wc(e)&&!!ooe(t,e,uoe))}async function y_(t,e,i,r){if(ox())return Hk(r);if(Array.isArray(t)){for(const{source:n,dest:s,geographicTransformation:o}of t)if(!th(n,s,o))return g_(r)}else if(!th(t,e,i))return g_(r);return Hk(r)}function o$(t,e,i){return t?"x"in t?F5e(t,e,new mt,i,0):"xmin"in t?B5e(t,e,new Vi,i,0):"rings"in t?V5e(t,e,new Qa,i,0):"paths"in t?z5e(t,e,new xc,i,0):"points"in t?k5e(t,e,new Cm,i,0):null:null}function N5e(t,e,i=e.spatialReference,r=0){return i!=null&&t.spatialReference!=null&&F5e(t,t.spatialReference,e,i,r)!=null}function F5e(t,e,i,r,n){eu[0]=t.x,eu[1]=t.y;const s=t.z;return eu[2]=s!==void 0?s:n,vn(eu,e,0,eu,r,0,1)?(i.x=eu[0],i.y=eu[1],i.spatialReference=r,s!==void 0||A2(r)?(i.z=eu[2],i.hasZ=!0):(i.z=void 0,i.hasZ=!1),t.m===void 0?(i.m=void 0,i.hasM=!1):(i.m=t.m,i.hasM=!0),i):null}function Hot(t,e,i=e.spatialReference,r=0){return t.spatialReference!=null&&i!=null&&k5e(t,t.spatialReference,e,i,r)!=null}function k5e(t,e,i,r,n){const{points:s,hasZ:o,hasM:l}=t,c=[],f=s.length,_=[];for(const T of s)_.push(T[0],T[1],o?T[2]:n);if(!vn(_,e,0,_,r,0,f))return null;const x=o||A2(r);for(let T=0;T-1&&i.splice(r,1)}}function tfe(t,e,i){i?Xot(t,e):Zot(t,e)}async function tKt(t){const e=t.clone().normalize();let i;if(e.length>1)for(const r of e)i?r.width>i.width&&(i=r):i=r;else i=e[0];return Yot(i)}const HK={DEVELOPER_BASEMAP:"DeveloperBasemap",JSAPI:"ArcGIS API for JavaScript",METADATA:"Metadata",MULTI_LAYER:"Multilayer",SINGLE_LAYER:"Singlelayer",TABLE:"Table",HOSTED_SERVICE:"Hosted Service",LOCAL_SCENE:"ViewingMode-Local",TILED_IMAGERY:"Tiled Imagery",GROUP_LAYER_MAP:"Map"};function ife(t){var c;const{portal:e,isOrgItem:i,itemControl:r}=t,n=(c=e.user)==null?void 0:c.privileges;let s=!n||n.includes("features:user:edit"),o=!!i&&!!(n!=null&&n.includes("features:user:fullEdit"));const l=r==="update"||r==="admin";return l?o=s=!0:o&&(s=!0),{features:{edit:s,fullEdit:o},content:{updateItem:l}}}const JB=t=>{let e=class extends t{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=et(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(i){i!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",i))}readPortalItem(i,r,n){if(r.itemId)return new Am({id:r.itemId,portal:n==null?void 0:n.portal})}writePortalItem(i,r){i!=null&&i.id&&(r.itemId=i.id)}async loadFromPortal(i,r){var n;if((n=this.portalItem)!=null&&n.id)try{const{load:s}=await we(()=>import("./layersLoader-5063dwjn.js"),__vite__mapDeps([43,38,36,35,44,45]));return St(r),await s({instance:this,supportedTypes:i.supportedTypes,validateItem:i.validateItem,supportsData:i.supportsData,layerModuleTypeMap:i.layerModuleTypeMap},r)}catch(s){throw sn(s)||Ce.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id}) - ${s}`),s}}async finishLoadEditablePortalLayer(i){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(i).catch(r=>(zo(r),!0)))}async setUserPrivileges(i,r){if(!Ar.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(r);if(this.url)try{const{features:{edit:n,fullEdit:s},content:{updateItem:o}}=await this._fetchUserPrivileges(i,r);this._set("userHasEditingPrivileges",n),this._set("userHasFullEditingPrivileges",s),this._set("userHasUpdateItemPrivileges",o)}catch(n){zo(n)}}async _fetchUserPrivileges(i,r){let n=this.portalItem;if(!i||!n||!n.loaded||n.sourceUrl)return this._fetchFallbackUserPrivileges(r);const s=i===n.id;if(s&&n.portal.user)return ife(n);let o,l;if(s)o=n.portal.url;else try{o=await UOe(this.url,r)}catch(x){zo(x)}if(!o||!DYe(o,n.portal.url))return this._fetchFallbackUserPrivileges(r);try{const x=r!=null?r.signal:null;l=await(yr==null?void 0:yr.getCredential(`${o}/sharing`,{prompt:!1,signal:x}))}catch(x){zo(x)}const c=!0,f=!1,_=!1;if(!l)return{features:{edit:c,fullEdit:f},content:{updateItem:_}};try{if(s?await n.reload():(n=new Am({id:i,portal:{url:o}}),await n.load(r)),n.portal.user)return ife(n)}catch(x){zo(x)}return{features:{edit:c,fullEdit:f},content:{updateItem:_}}}async _fetchFallbackUserPrivileges(i){let r=!0;try{r=await this._fetchUserHasEditingPrivileges(i)}catch(n){zo(n)}return{features:{edit:r,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(i){const r=this.url?yr==null?void 0:yr.findCredential(this.url):null;if(!r)return!0;const n=oD.credential===r?oD.user:await this._fetchEditingUser(i);return oD.credential=r,oD.user=n,(n==null?void 0:n.privileges)==null||n.privileges.includes("features:user:edit")}async _fetchEditingUser(i){var _,x;const r=(x=(_=this.portalItem)==null?void 0:_.portal)==null?void 0:x.user;if(r)return r;const n=yr.findServerInfo(this.url??"");if(!(n!=null&&n.owningSystemUrl))return null;const s=`${n.owningSystemUrl}/sharing/rest`,o=os.getDefault();if(o&&o.loaded&&Mf(o.restUrl)===Mf(s))return o.user;const l=`${s}/community/self`,c=i!=null?i.signal:null,f=await Ju(bi(l,{authMode:"no-prompt",query:{f:"json"},signal:c}));return f.ok?ese.fromJSON(f.value.data):null}read(i,r){r&&(r.layer=this),super.read(i,r)}write(i,r){var o;const n=r==null?void 0:r.portal,s=((o=this.portalItem)==null?void 0:o.id)&&(this.portalItem.portal||os.getDefault());return n&&s&&!dEe(s.restUrl,n.restUrl)?(r.messages&&r.messages.push(new se("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(i,{...r,layer:this})}};return y([w({type:Am})],e.prototype,"portalItem",null),y([$t("web-document","portalItem",["itemId"])],e.prototype,"readPortalItem",null),y([Pt("web-document","portalItem",{itemId:{type:String}})],e.prototype,"writePortalItem",null),y([w({clonable:!1})],e.prototype,"resourceReferences",void 0),y([w({type:Boolean,readOnly:!0})],e.prototype,"userHasEditingPrivileges",void 0),y([w({type:Boolean,readOnly:!0})],e.prototype,"userHasFullEditingPrivileges",void 0),y([w({type:Boolean,readOnly:!0})],e.prototype,"userHasUpdateItemPrivileges",void 0),e=y([Z("esri.layers.mixins.PortalLayer")],e),e},oD={credential:null,user:null};function H5e(t){return t&&"getAtOrigin"in t&&"originOf"in t}function Zz(t){t!=null&&t.writtenProperties&&t.writtenProperties.forEach(({target:e,propName:i,newOrigin:r})=>{H5e(e)&&r&&e.originOf(i)!==r&&e.updateOrigin(i,r)})}var O4;const Jz=fu()({orthometric:"gravity-related-height",gravity_related_height:"gravity-related-height",ellipsoidal:"ellipsoidal"}),q5e=Jz.jsonValues.slice();Q$(q5e,"orthometric");const a$=fu()({meter:"meters",foot:"feet","us-foot":"us-feet","clarke-foot":"clarke-feet","clarke-yard":"clarke-yards","clarke-link":"clarke-links","sears-yard":"sears-yards","sears-foot":"sears-feet","sears-chain":"sears-chains","benoit-1895-b-chain":"benoit-1895-b-chains","indian-yard":"indian-yards","indian-1937-yard":"indian-1937-yards","gold-coast-foot":"gold-coast-feet","sears-1922-truncated-chain":"sears-1922-truncated-chains","50-kilometers":"50-kilometers","150-kilometers":"150-kilometers"});let $0=O4=class extends Ue{constructor(t){super(t),this.heightModel="gravity-related-height",this.heightUnit="meters",this.vertCRS=null}writeHeightModel(t,e,i){return Jz.write(t,e,i)}readHeightModel(t,e,i){return Jz.read(t)||(i!=null&&i.messages&&i.messages.push(Jot(t,{context:i})),null)}readHeightUnit(t,e,i){return a$.read(t)||(i!=null&&i.messages&&i.messages.push(rfe(t,{context:i})),null)}readHeightUnitService(t,e,i){return VCe(t)||a$.read(t)||(i!=null&&i.messages&&i.messages.push(rfe(t,{context:i})),null)}readVertCRS(t,e){return e.vertCRS||e.ellipsoid||e.geoid}clone(){return new O4({heightModel:this.heightModel,heightUnit:this.heightUnit,vertCRS:this.vertCRS})}equals(t){return!!t&&(this===t||this.heightModel===t.heightModel&&this.heightUnit===t.heightUnit&&this.vertCRS===t.vertCRS)}static deriveUnitFromSR(t,e){const i=BCe(e);return new O4({heightModel:t.heightModel,heightUnit:i,vertCRS:t.vertCRS})}write(t,e){return e={origin:"web-scene",...e},super.write(t,e)}static fromJSON(t){if(!t)return null;const e=new O4;return e.read(t,{origin:"web-scene"}),e}};function rfe(t,e){return new Uf("height-unit:unsupported",`Height unit of value '${t}' is not supported`,e)}function Jot(t,e){return new Uf("height-model:unsupported",`Height model of value '${t}' is not supported`,e)}y([w({type:Jz.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:q5e,default:"ellipsoidal"}}}})],$0.prototype,"heightModel",void 0),y([Pt("web-scene","heightModel")],$0.prototype,"writeHeightModel",null),y([$t(["web-scene","service"],"heightModel")],$0.prototype,"readHeightModel",null),y([w({type:a$.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:a$.jsonValues,write:a$.write}}}})],$0.prototype,"heightUnit",void 0),y([$t("web-scene","heightUnit")],$0.prototype,"readHeightUnit",null),y([$t("service","heightUnit")],$0.prototype,"readHeightUnitService",null),y([w({type:String,constructOnly:!0,json:{origins:{"web-scene":{write:!0}}}})],$0.prototype,"vertCRS",void 0),y([$t("service","vertCRS",["vertCRS","ellipsoid","geoid"])],$0.prototype,"readVertCRS",null),$0=O4=y([Z("esri.geometry.HeightModelInfo")],$0);const N_=$0;async function Kot(t,e,i,r,n,s){let o=null;if(i!=null){const _=`${t}/nodepages/`,x=_+Math.floor(i.rootIndex/i.nodesPerPage);try{return{type:"page",rootPage:(await bi(x,{query:{f:"json",token:r},responseType:"json",signal:s})).data,rootIndex:i.rootIndex,pageSize:i.nodesPerPage,lodMetric:i.lodSelectionMetricType,urlPrefix:_}}catch(T){n!=null&&n.warn("#fetchIndexInfo()","Failed to load root node page. Falling back to node documents.",x,T),o=T}}if(!e)return null;const l=e==null?void 0:e.split("/").pop(),c=`${t}/nodes/`,f=c+l;try{return{type:"node",rootNode:(await bi(f,{query:{f:"json",token:r},responseType:"json",signal:s})).data,urlPrefix:c}}catch(_){throw new se("sceneservice:root-node-missing","Root node missing.",{pageError:o,nodeError:_,url:f})}}let Qot=null;function eat(){return Qot}function Kz(t){if(Ar.apiKey&&$ne(t.portal.url))throw new se("save-api-key-utils:api-key-not-supported",`Saving is not supported on ${t.portal.url} when using an api key`)}async function tat(t,e={},i){await t.load(i);const r=s0(t.itemUrl,"resources"),{start:n=1,num:s=10,sortOrder:o="asc",sortField:l="created"}=e,c={query:{start:n,num:s,sortOrder:o,sortField:l,token:t.apiKey},signal:i==null?void 0:i.signal},f=await t.portal.request(r,c);return{total:f.total,nextStart:f.nextStart,resources:f.resources.map(({created:_,size:x,resource:T})=>({created:new Date(_),size:x,resource:t.resourceFromPath(T)}))}}async function iat(t,e,i,r){if(!t.hasPath())throw new se(`portal-item-resource-${e}:invalid-path`,"Resource does not have a valid path");const n=t.portalItem;await n.load(r);const s=s0(n.userItemUrl,e==="add"?"addResources":"updateResources"),[o,l]=W5e(t.path),c=new FormData;return o&&o!=="."&&c.append("resourcesPrefix",o),r!=null&&r.compress&&c.append("compress","true"),c.append("fileName",l),c.append("file",i,l),c.append("f","json"),r!=null&&r.access&&c.append("access",r.access),await n.portal.request(s,{method:"post",body:c,signal:r==null?void 0:r.signal}),t}async function rat(t,e,i){if(!e.hasPath())throw new se("portal-item-resources-remove:invalid-path","Resource does not have a valid path");await t.load(i);const r=s0(t.userItemUrl,"removeResources");await t.portal.request(r,{method:"post",query:{resource:e.path},signal:i==null?void 0:i.signal}),e.portalItem=null}async function nat(t,e){await t.load(e);const i=s0(t.userItemUrl,"removeResources");return t.portal.request(i,{method:"post",query:{deleteAll:!0},signal:e==null?void 0:e.signal})}function W5e(t){const e=t.lastIndexOf("/");return e===-1?[".",t]:[t.slice(0,e),t.slice(e+1)]}function doe(t){const[e,i]=sat(t),[r,n]=W5e(e);return[r,n,i]}function sat(t){const e=Rne(t);return e==null?[t,""]:[t.slice(0,t.length-e.length-1),`.${e}`]}async function poe(t){return t.type==="blob"?t.blob:t.type==="json"?new Blob([t.jsonString],{type:"application/json"}):(await bi(t.url,{responseType:"blob"})).data}function oat(t,e){if(!t.hasPath())return null;const[i,,r]=doe(t.path);return t.portalItem.resourceFromPath(s0(i,e+r))}function Y5e(t,e){if(!t.hasPath())return null;const[i,,r]=doe(t.path);return t.portalItem.resourceFromPath(s0(i,e+r))}const P4=Object.freeze(Object.defineProperty({__proto__:null,addOrUpdateResource:iat,contentToBlob:poe,fetchResources:tat,getSiblingOfSameType:oat,getSiblingOfSameTypeI:Y5e,removeAllResources:nat,removeResource:rat,splitPrefixFileNameAndExtension:doe},Symbol.toStringTag,{value:"Module"}));async function X5e(t,e,i=null){const r=await J5e(t,e,i);await K5e(r,e,i)}async function Z5e(t,e,i,r,n=null){const s=await J5e(i,r,n);await t.update({data:e}),await K5e(s,r,n)}async function J5e(t,e,i=null){if(!(e!=null&&e.resources))return;const r=e.portalItem===t.portalItem?new Set(t.paths):new Set;t.paths.length=0,t.portalItem=e.portalItem;const n=new Set(e.resources.toKeep.map(c=>c.resource.path)),s=new Set,o=[];n.forEach(c=>{r.delete(c),t.paths.push(c)});for(const c of e.resources.toUpdate)if(r.delete(c.resource.path),n.has(c.resource.path)||s.has(c.resource.path)){const{resource:f,content:_,finish:x,error:T}=c,A=Y5e(f,Vf());t.paths.push(A.path),o.push(nfe({resource:A,content:_,compress:c.compress,finish:x,error:T},i))}else t.paths.push(c.resource.path),o.push(aat(c,i)),s.add(c.resource.path);for(const c of e.resources.toAdd)t.paths.push(c.resource.path),r.has(c.resource.path)?r.delete(c.resource.path):o.push(nfe(c,i));if(o.length===0)return r;const l=await xGe(o);if(St(i),l.length>0)throw new se("save:resources","Failed to save one or more resources",{errors:l});return r}async function K5e(t,e,i=null){if(!t||!e.portalItem)return;const r=[];for(const n of t){const s=e.portalItem.resourceFromPath(n);r.push(s.portalItem.removeResource(s,i))}await Uv(r)}async function nfe(t,e){var n,s;const i={...e??{},compress:t.compress},r=await Ju(t.resource.portalItem.addResource(t.resource,await poe(t.content),i));if(r.ok!==!0)throw(n=t.error)==null||n.call(t,r.error),r.error;(s=t.finish)==null||s.call(t,t.resource)}async function aat(t,e){var r,n;const i=await Ju(t.resource.update(await poe(t.content),e));if(i.ok!==!0)throw(r=t.error)==null||r.call(t,i.error),i.error;(n=t.finish)==null||n.call(t,t.resource)}async function lat(t){const e=[];for(const i of t.allLayers)if("beforeSave"in i&&typeof i.beforeSave=="function"){const r=i.beforeSave();r&&e.push(r)}await Promise.allSettled(e)}const Q5e="esri.layers.mixins.SceneService",DH=Ce.getLogger(Q5e),cat=t=>{let e=class extends t{constructor(){super(...arguments),this.spatialReference=null,this.fullExtent=null,this.heightModelInfo=null,this.minScale=0,this.maxScale=0,this.version={major:Number.NaN,minor:Number.NaN,versionString:""},this.copyright=null,this.sublayerTitleMode="item-title",this.title=null,this.layerId=null,this.indexInfo=null,this._debouncedSaveOperations=X5(async(i,r,n)=>{switch(i){case n5.SAVE:return this._save(r);case n5.SAVE_AS:return this._saveAs(n,r)}})}readSpatialReference(i,r){return this._readSpatialReference(r)}_readSpatialReference(i){if(i.spatialReference!=null)return at.fromJSON(i.spatialReference);{const r=i.store,n=r.indexCRS||r.geographicCRS,s=n&&parseInt(n.substring(n.lastIndexOf("/")+1,n.length),10);return s!=null?new at(s):null}}readFullExtent(i,r,n){if(i!=null&&typeof i=="object"){const l=i.spatialReference==null?{...i,spatialReference:this._readSpatialReference(r)}:i;return Vi.fromJSON(l,n)}const s=r.store,o=this._readSpatialReference(r);return o==null||(s==null?void 0:s.extent)==null||!Array.isArray(s.extent)||s.extent.some(l=>l=2&&(r.major=parseInt(n[0],10),r.minor=parseInt(n[1],10)),r}readVersion(i,r){const n=r.store,s=n.version!=null?n.version.toString():"";return this.parseVersionString(s)}readTitlePortalItem(i){return this.sublayerTitleMode!=="item-title"?void 0:i}readTitleService(i,r){var o;const n=(o=this.portalItem)==null?void 0:o.title;if(this.sublayerTitleMode==="item-title")return Yst(this.url,r.name);let s=r.name;if(!s&&this.url){const l=vE(this.url);l!=null&&(s=l.title)}return this.sublayerTitleMode==="item-title-and-service-name"&&n&&(s=n+" - "+s),roe(s)}set url(i){const r=Zst({layer:this,url:i,nonStandardUrlAllowed:!1,logger:DH});this._set("url",r.url),r.layerId!=null&&this._set("layerId",r.layerId)}writeUrl(i,r,n,s){Jst(this,i,"layers",r,s)}get parsedUrl(){const i=this._get("url"),r=qs(i);return this.layerId!=null&&(r.path=`${r.path}/layers/${this.layerId}`),r}async _fetchIndexAndUpdateExtent(i,r){this.indexInfo=Kot(this.parsedUrl.path,this.rootNode,i,this.apiKey,DH,r),this.fullExtent==null||this.fullExtent.hasZ||this._updateExtent(await this.indexInfo)}_updateExtent(i){var r,n,s,o;if((i==null?void 0:i.type)==="page"){const l=i.rootIndex%i.pageSize,c=(n=(r=i.rootPage)==null?void 0:r.nodes)==null?void 0:n[l];if(((s=c==null?void 0:c.obb)==null?void 0:s.center)==null||c.obb.halfSize==null)throw new se("sceneservice:invalid-node-page","Invalid node page.");if(c.obb.center[0]0)return r.data.layers[0].id}async _fetchServiceLayer(i){var o;const r=await bi(((o=this.parsedUrl)==null?void 0:o.path)??"",{query:{f:"json",token:this.apiKey},responseType:"json",signal:i});r.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));let n=!1;if(r.data.layerType&&r.data.layerType==="Voxel"&&(n=!0),n)return this._fetchVoxelServiceLayer();const s=r.data;this.read(s,this._getServiceContext()),this.validateLayer(s)}async _fetchVoxelServiceLayer(i){var n;const r=(await bi(((n=this.parsedUrl)==null?void 0:n.path)+"/layer",{query:{f:"json",token:this.apiKey},responseType:"json",signal:i})).data;this.read(r,this._getServiceContext()),this.validateLayer(r)}_getServiceContext(){var i;return{origin:"service",portalItem:this.portalItem,portal:(i=this.portalItem)==null?void 0:i.portal,url:this.parsedUrl}}async _ensureLoadBeforeSave(){await this.load(),"beforeSave"in this&&typeof this.beforeSave=="function"&&await this.beforeSave()}validateLayer(i){}_updateTypeKeywords(i,r,n){i.typeKeywords||(i.typeKeywords=[]);const s=r.getTypeKeywords();for(const o of s)i.typeKeywords.push(o);i.typeKeywords&&(i.typeKeywords=i.typeKeywords.filter((o,l,c)=>c.indexOf(o)===l),n===l$.newItem&&(i.typeKeywords=i.typeKeywords.filter(o=>o!=="Hosted Service")))}async _saveAs(i,r){var f;const n={...sfe,...r};let s=Am.from(i);if(!s)throw new se("sceneservice:portal-item-required","_saveAs() requires a portal item to save to");Kz(s),s.id&&(s=s.clone(),s.id=null);const o=s.portal||os.getDefault();await this._ensureLoadBeforeSave(),s.type=FH,s.portal=o;const l={origin:"portal-item",url:null,messages:[],portal:o,portalItem:s,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},c={layers:[this.write({},l)]};return await Promise.all(l.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(c,l,n),s.url=this.url,s.title||(s.title=this.title),this._updateTypeKeywords(s,n,l$.newItem),await o.signIn(),await((f=o.user)==null?void 0:f.addItem({item:s,folder:n==null?void 0:n.folder,data:c})),await X5e(this.resourceReferences,l,null),this.portalItem=s,Zz(l),l.portalItem=s,s}async _save(i){const r={...sfe,...i};if(!this.portalItem)throw new se("sceneservice:portal-item-not-set","Portal item to save to has not been set on this SceneService");if(Kz(this.portalItem),this.portalItem.type!==FH)throw new se("sceneservice:portal-item-wrong-type",`Portal item needs to have type "${FH}"`);await this._ensureLoadBeforeSave();const n={origin:"portal-item",url:this.portalItem.itemUrl&&qs(this.portalItem.itemUrl),messages:[],portal:this.portalItem.portal||os.getDefault(),portalItem:this.portalItem,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},s={layers:[this.write({},n)]};return await Promise.all(n.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(s,n,r),this.portalItem.url=this.url,this.portalItem.title||(this.portalItem.title=this.title),this._updateTypeKeywords(this.portalItem,r,l$.existingItem),await Z5e(this.portalItem,s,this.resourceReferences,n,null),Zz(n),this.portalItem}async _validateAgainstJSONSchema(i,r,n){var f,_;let s=((f=r.messages)==null?void 0:f.filter(x=>x.type==="error").map(x=>new se(x.name,x.message,x.details)))??[];(_=n==null?void 0:n.validationOptions)!=null&&_.ignoreUnsupported&&(s=s.filter(x=>x.name!=="layer:unsupported"&&x.name!=="symbol:unsupported"&&x.name!=="symbol-layer:unsupported"&&x.name!=="property:unsupported"&&x.name!=="url:unsupported"&&x.name!=="scenemodification:unsupported"));const o=n==null?void 0:n.validationOptions,l=o==null?void 0:o.enabled,c=eat();if(l&&c){const x=(await c()).validate(i,n.portalItemLayerType);if(x.length>0){const T=`Layer item did not validate: +`+S+` | +`+p.line+" | "+C+` +`+S+" | "+i("",c.column-1," ")+i("",M,"^")}else s+=` + at `+_}return s},e.buildMessage=function(n,s){var o={literal:function(C){return'"'+c(C.text)+'"'},class:function(C){var M=C.parts.map(function(P){return Array.isArray(P)?p(P[0])+"-"+p(P[1]):p(P)});return"["+(C.inverted?"^":"")+M.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(C){return C.description}};function a(C){return C.charCodeAt(0).toString(16).toUpperCase()}function c(C){return C.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(M){return"\\x0"+a(M)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(M){return"\\x"+a(M)})}function p(C){return C.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(M){return"\\x0"+a(M)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(M){return"\\x"+a(M)})}function _(C){return o[C.type](C)}function x(C){var M,P,$=C.map(_);if($.sort(),$.length>0){for(M=1,P=1;M<$.length;M++)$[M-1]!==$[M]&&($[P]=$[M],P++);$.length=P}switch($.length){case 1:return $[0];case 2:return $[0]+" or "+$[1];default:return $.slice(0,-1).join(", ")+", or "+$[$.length-1]}}function S(C){return C?'"'+c(C)+'"':"end of input"}return"Expected "+x(n)+" but "+S(s)+" found."},{SyntaxError:e,parse:r}},(ude=GZ).exports&&(ude.exports=hde());var _Ze=GZ.exports;function fse(t){if(!t||t.length===0)return null;if(typeof t=="string"){const i=dde(t);return i&&i.length!==0?i:null}const e=t.map(i=>{if(!Number.isFinite(i.scale)||i.scale<=0)throw new se("effect:invalid-scale","scale must be finite and greater than 0",{stop:i});return{scale:i.scale,effects:dde(i.value)}});e.sort((i,r)=>r.effects.length-i.effects.length);for(let i=0;ir.scale-i.scale),e}function dde(t){let e;if(!t)return[];try{e=_Ze.parse(t)}catch(i){throw new se("effect:invalid-syntax","Invalid effect syntax",{value:t,error:i})}return e.map(i=>bZe(i))}function bZe(t){try{switch(t.name){case"grayscale":case"sepia":case"saturate":case"invert":case"brightness":case"contrast":return wZe(t);case"opacity":return xZe(t);case"hue-rotate":return SZe(t);case"blur":return TZe(t);case"drop-shadow":return EZe(t);case"bloom":return CZe(t)}}catch(e){throw e.details.filter=t,e}throw new se("effect:unknown-effect",`Effect '${t.name}' is not supported`,{effect:t})}function wZe(t){let e=1;return d5(t.parameters,1),t.parameters.length===1&&(e=om(t.parameters[0])),new jZ(t.name,e)}function xZe(t){let e=1;return d5(t.parameters,1),t.parameters.length===1&&(e=om(t.parameters[0])),new CCe(e)}function SZe(t){let e=0;return d5(t.parameters,1),t.parameters.length===1&&(e=IZe(t.parameters[0])),new TCe(e)}function TZe(t){let e=0;return d5(t.parameters,1),t.parameters.length===1&&(e=yse(t.parameters[0]),N9(e,t.parameters[0])),new _Ce(e)}function EZe(t){const e=[];let i=null;for(const r of t.parameters)if(r.type==="color"){if(e.length&&Object.freeze(e),i)throw new se("effect:type-error","Accepts only one color",{});i=$Ze(r)}else{const n=yse(r);if(Object.isFrozen(e))throw new se("effect:type-error"," parameters not consecutive",{lengths:e});e.push(n),e.length===3&&N9(n,r)}if(e.length<2||e.length>3)throw new se("effect:type-error",`Expected {2,3}, Actual: {${e.length}}`,{lengths:e});return new xCe(e[0],e[1],e[2]||0,i||PCe("black"))}function CZe(t){let e=1,i=0,r=0;return d5(t.parameters,3),t.parameters[0]&&(e=om(t.parameters[0])),t.parameters[1]&&(i=yse(t.parameters[1]),N9(i,t.parameters[1])),t.parameters[2]&&(r=om(t.parameters[2])),new yCe(e,i,r)}function d5(t,e){if(t.length>e)throw new se("effect:type-error",`Function supports up to ${e} parameters, Actual: ${t.length}`,{parameters:t})}function CB(t){if(t.type==="color")return"";if(t.unit){if(t.unit in gse)return"";if(t.unit in mse)return"";if(t.unit==="%")return""}return""}function N9(t,e){if(t<0)throw new se("effect:type-error",`Negative values are not allowed, Actual: ${t}`,{term:e})}function AZe(t){if(t.type!=="quantity"||t.unit!==null)throw new se("effect:type-error",`Expected , Actual: ${CB(t)}`,{term:t})}function MZe(t){if(t.type!=="quantity"||t.unit!==null&&t.unit!=="%")throw new se("effect:type-error",`Expected or , Actual: ${CB(t)}`,{term:t})}const mse={deg:1,grad:.9,rad:180/Math.PI,turn:360};function OZe(t){if(t.type!=="quantity"||!(t.value===0&&t.unit===null||t.unit&&mse[t.unit]!=null))throw new se("effect:type-error",`Expected , Actual: ${CB(t)}`,{term:t})}const gse={px:1,cm:96/2.54,mm:96/2.54/10,in:96,pc:16,pt:96/72};function PZe(t){if(t.type!=="quantity"||!(t.value===0&&t.unit===null||t.unit&&gse[t.unit]!=null))throw new se("effect:type-error",`Expected , Actual: ${CB(t)}`,{term:t})}function om(t){MZe(t);const e=t.value;return N9(e,t),t.unit==="%"?.01*e:e}function RZe(t){return AZe(t),N9(t.value,t),t.value}function IZe(t){return OZe(t),t.value*mse[t.unit]||0}function yse(t){return PZe(t),t.value*gse[t.unit]||0}function $Ze(t){switch(t.colorType){case"hex":return kXe(t.value);case"named":return PCe(t.value);case"function":return NZe(t.value)}}function PCe(t){if(!sCe(t))throw new se("effect:unknown-color",`color '${t}' isn't valid`,{namedColor:t});return FXe(t)}const LZe=/^rgba?/i,DZe=/^hsla?/i;function NZe(t){if(d5(t.parameters,4),LZe.test(t.name))return[om(t.parameters[0]),om(t.parameters[1]),om(t.parameters[2]),t.parameters[3]?om(t.parameters[3]):1];if(DZe.test(t.name))return oCe(RZe(t.parameters[0]),om(t.parameters[1]),om(t.parameters[2]),t.parameters[3]?om(t.parameters[3]):1);throw new se("effect:syntax-error",`Invalid color function '${t.name}'`,{colorFunction:t})}function FZe(t,e,i){var r;try{return UZe(t)}catch(n){(r=i==null?void 0:i.messages)==null||r.push(n)}return null}function kZe(t,e,i,r){try{const n=zZe(t);hE(i,n,e)}catch(n){r.messages&&r.messages.push(n)}}function zZe(t){const e=fse(t);return e?yZe(e)?e.map(i=>i.toJSON()):e.map(({scale:i,effects:r})=>({scale:i,value:r.map(n=>n.toJSON())})):null}function UZe(t){if(!t||t.length===0)return null;if(VZe(t)){const e=[];for(const i of t)e.push({scale:i.scale,value:Lz(i.value)});return e}return Lz(t)}function VZe(t){const e=t[0];return!!e&&"scale"in e}function Lz(t){if(!(t!=null&&t.length))return"";const e=[];for(const i of t){let r=[];switch(i.type){case"grayscale":case"sepia":case"saturate":case"invert":case"brightness":case"contrast":case"opacity":r=[E1(i,"amount")];break;case"blur":r=[E1(i,"radius","pt")];break;case"hue-rotate":r=[E1(i,"angle","deg")];break;case"drop-shadow":r=[E1(i,"xoffset","pt"),E1(i,"yoffset","pt"),E1(i,"blurRadius","pt"),BZe(i,"color")];break;case"bloom":r=[E1(i,"strength"),E1(i,"radius","pt"),E1(i,"threshold")]}const n=`${i.type}(${r.filter(Boolean).join(" ")})`;fse(n),e.push(n)}return e.join(" ")}function E1(t,e,i){if(t[e]==null)throw new se("effect:missing-parameter",`Missing parameter '${e}' in ${t.type} effect`,{effect:t});return i?t[e]+i:""+t[e]}function BZe(t,e){if(t[e]==null)throw new se("effect:missing-parameter",`Missing parameter '${e}' in ${t.type} effect`,{effect:t});const i=t[e];return`rgba(${i[0]||0}, ${i[1]||0}, ${i[2]||0}, ${i[3]/255||0})`}const pde={read:{reader:FZe},write:{allowNull:!0,writer:kZe}},vse=t=>{let e=class extends t{constructor(){super(...arguments),this.blendMode="normal",this.effect=null}};return y([w({type:["average","color-burn","color-dodge","color","darken","destination-atop","destination-in","destination-out","destination-over","difference","exclusion","hard-light","hue","invert","lighten","lighter","luminosity","minus","multiply","normal","overlay","plus","reflect","saturation","screen","soft-light","source-atop","source-in","source-out","vivid-light","xor"],nonNullable:!0,json:{read:!1,write:!1,origins:{"web-map":{read:!0,write:!0},"portal-item":{read:!0,write:!0}}}})],e.prototype,"blendMode",void 0),y([w({json:{read:!1,write:!1,origins:{"web-map":pde,"portal-item":pde}}})],e.prototype,"effect",void 0),e=y([Z("esri.layers.mixins.BlendLayer")],e),e},AB=t=>{let e=class extends t{constructor(){super(...arguments),this.minScale=0,this.maxScale=0}get effectiveScaleRange(){const i={minScale:this.minScale,maxScale:this.maxScale},r=this.parent;r&&"effectiveScaleRange"in r&&jZe(i,r.effectiveScaleRange);const n=this._get("effectiveScaleRange");return n&&n.minScale===i.minScale&&n.maxScale===i.maxScale?n:i}};return y([w({type:Number,nonNullable:!0,json:{write:!0}})],e.prototype,"minScale",void 0),y([w({type:Number,nonNullable:!0,json:{write:!0}})],e.prototype,"maxScale",void 0),y([w({readOnly:!0})],e.prototype,"effectiveScaleRange",null),e=y([Z("esri.layers.mixins.ScaleRangeLayer")],e),e};function jZe(t,e){return t.minScale=t.minScale>0?e.minScale>0?Math.min(t.minScale,e.minScale):t.minScale:e.minScale,t.maxScale=t.maxScale>0?e.maxScale>0?Math.max(t.maxScale,e.maxScale):t.maxScale:e.maxScale,t}const Xs=t=>{let e=class extends t{clone(){var c;const i=Kl(this);Gy(i,"unable to clone instance of non-accessor class");const r=i.metadatas,n=i.store,s={},o=new Map;for(const p in r){const _=r[p],x=n==null?void 0:n.originOf(p),S=_.clonable;if(_.readOnly||S===!1||x!==Di.USER&&x!==Di.DEFAULTS&&x!==Di.WEB_MAP&&x!==Di.WEB_SCENE)continue;const C=this[p];let M=null;M=typeof S=="function"?S(C):S==="reference"?C:rZ(C),C!=null&&M==null||(x===Di.DEFAULTS?o.set(p,M):s[p]=M)}const a=new(Object.getPrototypeOf(this)).constructor(s);if(o.size){const p=(c=Kl(a))==null?void 0:c.store;if(p)for(const[_,x]of o)p.set(_,x,Di.DEFAULTS)}return a}};return e=y([Z("esri.core.Clonable")],e),e};let HZ=class extends Xs(ze){};HZ=y([Z("esri.core.Clonable")],HZ);async function _se(t,e){const{WhereClause:i}=await we(()=>import("./WhereClause-FOYoIAAW.js").then(r=>r.W),__vite__mapDeps([4,5]));return i.create(t,e)}function MB(t,e){return t!=null?e!=null?`(${t}) AND (${e})`:t:e}function kE(t){return typeof t=="string"||t instanceof String}let n$;var aSe,lSe;const GZe=((aSe=globalThis.esriConfig)==null?void 0:aSe.locale)??((lSe=globalThis.dojoConfig)==null?void 0:lSe.locale);function RCe(){var t;return GZe??((t=globalThis.navigator)==null?void 0:t.language)??"en"}function ma(){return n$===void 0&&(n$=RCe()),n$}function bse(t=ma()){const e=/^([a-zA-Z]{2,3})(?:[_\-]\w+)*$/.exec(t);return e==null?void 0:e[1].toLowerCase()}const s$=[];function fE(t){return s$.push(t),rr(()=>s$.splice(s$.indexOf(t),1))}const qZ=[];function wse(t){return qZ.push(t),rr(()=>s$.splice(qZ.indexOf(t),1))}function HZe(){const t=RCe();n$!==t&&(n$=t,[...qZ].forEach(e=>{e.call(null,t)}),[...s$].forEach(e=>{e.call(null,t)}))}var cSe;(cSe=globalThis.addEventListener)==null||cSe.call(globalThis,"languagechange",HZe);const fde=new Map([["AUS Central Standard Time","Australia/Darwin"],["AUS Eastern Standard Time","Australia/Sydney"],["Afghanistan Standard Time","Asia/Kabul"],["Alaskan Standard Time","America/Anchorage"],["Aleutian Standard Time","America/Adak"],["Altai Standard Time","Asia/Barnaul"],["Arab Standard Time","Asia/Riyadh"],["Arabian Standard Time","Asia/Dubai"],["Arabic Standard Time","Asia/Baghdad"],["Argentina Standard Time","America/Buenos_Aires"],["Astrakhan Standard Time","Europe/Astrakhan"],["Atlantic Standard Time","America/Halifax"],["Aus Central W. Standard Time","Australia/Eucla"],["Azerbaijan Standard Time","Asia/Baku"],["Azores Standard Time","Atlantic/Azores"],["Bahia Standard Time","America/Bahia"],["Bangladesh Standard Time","Asia/Dhaka"],["Belarus Standard Time","Europe/Minsk"],["Bougainville Standard Time","Pacific/Bougainville"],["Canada Central Standard Time","America/Regina"],["Cape Verde Standard Time","Atlantic/Cape_Verde"],["Caucasus Standard Time","Asia/Yerevan"],["Cen. Australia Standard Time","Australia/Adelaide"],["Central America Standard Time","America/Guatemala"],["Central Asia Standard Time","Asia/Almaty"],["Central Brazilian Standard Time","America/Cuiaba"],["Central Europe Standard Time","Europe/Budapest"],["Central European Standard Time","Europe/Warsaw"],["Central Pacific Standard Time","Pacific/Guadalcanal"],["Central Standard Time","America/Chicago"],["Central Standard Time (Mexico)","America/Mexico_City"],["Chatham Islands Standard Time","Pacific/Chatham"],["China Standard Time","Asia/Shanghai"],["Cuba Standard Time","America/Havana"],["Dateline Standard Time","Etc/GMT+12"],["E. Africa Standard Time","Africa/Nairobi"],["E. Australia Standard Time","Australia/Brisbane"],["E. Europe Standard Time","Europe/Chisinau"],["E. South America Standard Time","America/Sao_Paulo"],["Easter Island Standard Time","Pacific/Easter"],["Eastern Standard Time","America/New_York"],["Eastern Standard Time (Mexico)","America/Cancun"],["Egypt Standard Time","Africa/Cairo"],["Ekaterinburg Standard Time","Asia/Yekaterinburg"],["FLE Standard Time","Europe/Kiev"],["Fiji Standard Time","Pacific/Fiji"],["GMT Standard Time","Europe/London"],["GTB Standard Time","Europe/Bucharest"],["Georgian Standard Time","Asia/Tbilisi"],["Greenland Standard Time","America/Godthab"],["Greenwich Standard Time","Atlantic/Reykjavik"],["Haiti Standard Time","America/Port-au-Prince"],["Hawaiian Standard Time","Pacific/Honolulu"],["India Standard Time","Asia/Calcutta"],["Iran Standard Time","Asia/Tehran"],["Israel Standard Time","Asia/Jerusalem"],["Jordan Standard Time","Asia/Amman"],["Kaliningrad Standard Time","Europe/Kaliningrad"],["Korea Standard Time","Asia/Seoul"],["Libya Standard Time","Africa/Tripoli"],["Line Islands Standard Time","Pacific/Kiritimati"],["Lord Howe Standard Time","Australia/Lord_Howe"],["Magadan Standard Time","Asia/Magadan"],["Magallanes Standard Time","America/Punta_Arenas"],["Marquesas Standard Time","Pacific/Marquesas"],["Mauritius Standard Time","Indian/Mauritius"],["Middle East Standard Time","Asia/Beirut"],["Montevideo Standard Time","America/Montevideo"],["Morocco Standard Time","Africa/Casablanca"],["Mountain Standard Time","America/Denver"],["Mountain Standard Time (Mexico)","America/Mazatlan"],["Myanmar Standard Time","Asia/Rangoon"],["N. Central Asia Standard Time","Asia/Novosibirsk"],["Namibia Standard Time","Africa/Windhoek"],["Nepal Standard Time","Asia/Katmandu"],["New Zealand Standard Time","Pacific/Auckland"],["Newfoundland Standard Time","America/St_Johns"],["Norfolk Standard Time","Pacific/Norfolk"],["North Asia East Standard Time","Asia/Irkutsk"],["North Asia Standard Time","Asia/Krasnoyarsk"],["North Korea Standard Time","Asia/Pyongyang"],["Omsk Standard Time","Asia/Omsk"],["Pacific SA Standard Time","America/Santiago"],["Pacific Standard Time","America/Los_Angeles"],["Pacific Standard Time (Mexico)","America/Tijuana"],["Pakistan Standard Time","Asia/Karachi"],["Paraguay Standard Time","America/Asuncion"],["Qyzylorda Standard Time","Asia/Qyzylorda"],["Romance Standard Time","Europe/Paris"],["Russia Time Zone 10","Asia/Srednekolymsk"],["Russia Time Zone 11","Asia/Kamchatka"],["Russia Time Zone 3","Europe/Samara"],["Russian Standard Time","Europe/Moscow"],["SA Eastern Standard Time","America/Cayenne"],["SA Pacific Standard Time","America/Bogota"],["SA Western Standard Time","America/La_Paz"],["SE Asia Standard Time","Asia/Bangkok"],["Saint Pierre Standard Time","America/Miquelon"],["Sakhalin Standard Time","Asia/Sakhalin"],["Samoa Standard Time","Pacific/Apia"],["Sao Tome Standard Time","Africa/Sao_Tome"],["Saratov Standard Time","Europe/Saratov"],["Singapore Standard Time","Asia/Singapore"],["South Africa Standard Time","Africa/Johannesburg"],["South Sudan Standard Time","Africa/Juba"],["Sri Lanka Standard Time","Asia/Colombo"],["Sudan Standard Time","Africa/Khartoum"],["Syria Standard Time","Asia/Damascus"],["Taipei Standard Time","Asia/Taipei"],["Tasmania Standard Time","Australia/Hobart"],["Tocantins Standard Time","America/Araguaina"],["Tokyo Standard Time","Asia/Tokyo"],["Tomsk Standard Time","Asia/Tomsk"],["Tonga Standard Time","Pacific/Tongatapu"],["Transbaikal Standard Time","Asia/Chita"],["Turkey Standard Time","Europe/Istanbul"],["Turks And Caicos Standard Time","America/Grand_Turk"],["US Eastern Standard Time","America/Indianapolis"],["US Mountain Standard Time","America/Phoenix"],["UTC","Etc/GMT"],["UTC+01","Etc/GMT-1"],["UTC+02","Etc/GMT-2"],["UTC+03","Etc/GMT-3"],["UTC+04","Etc/GMT-4"],["UTC+05","Etc/GMT-5"],["UTC+06","Etc/GMT-6"],["UTC+07","Etc/GMT-7"],["UTC+08","Etc/GMT-8"],["UTC+09","Etc/GMT-9"],["UTC+10","Etc/GMT-10"],["UTC+11","Etc/GMT-11"],["UTC+12","Etc/GMT-12"],["UTC+13","Etc/GMT-13"],["UTC+14","Etc/GMT-14"],["UTC-01","Etc/GMT+1"],["UTC-02","Etc/GMT+2"],["UTC-03","Etc/GMT+3"],["UTC-04","Etc/GMT+4"],["UTC-05","Etc/GMT+5"],["UTC-06","Etc/GMT+6"],["UTC-07","Etc/GMT+7"],["UTC-08","Etc/GMT+8"],["UTC-09","Etc/GMT+9"],["UTC-10","Etc/GMT+10"],["UTC-11","Etc/GMT+11"],["UTC-12","Etc/GMT+12"],["Ulaanbaatar Standard Time","Asia/Ulaanbaatar"],["Venezuela Standard Time","America/Caracas"],["Vladivostok Standard Time","Asia/Vladivostok"],["Volgograd Standard Time","Europe/Volgograd"],["W. Australia Standard Time","Australia/Perth"],["W. Central Africa Standard Time","Africa/Lagos"],["W. Europe Standard Time","Europe/Berlin"],["W. Mongolia Standard Time","Asia/Hovd"],["West Asia Standard Time","Asia/Tashkent"],["West Bank Standard Time","Asia/Hebron"],["West Pacific Standard Time","Pacific/Port_Moresby"],["Yakutsk Standard Time","Asia/Yakutsk"],["Yukon Standard Time","America/Whitehorse"]]);class mE extends Error{}class qZe extends mE{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class WZe extends mE{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class YZe extends mE{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class MM extends mE{}class ICe extends mE{constructor(e){super(`Invalid unit ${e}`)}}class Hh extends mE{}class ab extends mE{constructor(){super("Zone is an abstract class")}}const Ut="numeric",Fm="short",yp="long",Dz={year:Ut,month:Ut,day:Ut},$Ce={year:Ut,month:Fm,day:Ut},XZe={year:Ut,month:Fm,day:Ut,weekday:Fm},LCe={year:Ut,month:yp,day:Ut},DCe={year:Ut,month:yp,day:Ut,weekday:yp},NCe={hour:Ut,minute:Ut},FCe={hour:Ut,minute:Ut,second:Ut},kCe={hour:Ut,minute:Ut,second:Ut,timeZoneName:Fm},zCe={hour:Ut,minute:Ut,second:Ut,timeZoneName:yp},UCe={hour:Ut,minute:Ut,hourCycle:"h23"},VCe={hour:Ut,minute:Ut,second:Ut,hourCycle:"h23"},BCe={hour:Ut,minute:Ut,second:Ut,hourCycle:"h23",timeZoneName:Fm},jCe={hour:Ut,minute:Ut,second:Ut,hourCycle:"h23",timeZoneName:yp},GCe={year:Ut,month:Ut,day:Ut,hour:Ut,minute:Ut},HCe={year:Ut,month:Ut,day:Ut,hour:Ut,minute:Ut,second:Ut},qCe={year:Ut,month:Fm,day:Ut,hour:Ut,minute:Ut},WCe={year:Ut,month:Fm,day:Ut,hour:Ut,minute:Ut,second:Ut},ZZe={year:Ut,month:Fm,day:Ut,weekday:Fm,hour:Ut,minute:Ut},YCe={year:Ut,month:yp,day:Ut,hour:Ut,minute:Ut,timeZoneName:Fm},XCe={year:Ut,month:yp,day:Ut,hour:Ut,minute:Ut,second:Ut,timeZoneName:Fm},ZCe={year:Ut,month:yp,day:Ut,weekday:yp,hour:Ut,minute:Ut,timeZoneName:yp},JCe={year:Ut,month:yp,day:Ut,weekday:yp,hour:Ut,minute:Ut,second:Ut,timeZoneName:yp};class p5{get type(){throw new ab}get name(){throw new ab}get ianaName(){return this.name}get isUniversal(){throw new ab}offsetName(e,i){throw new ab}formatOffset(e,i){throw new ab}offset(e){throw new ab}equals(e){throw new ab}get isValid(){throw new ab}}let _H=null;class OB extends p5{static get instance(){return _H===null&&(_H=new OB),_H}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:i,locale:r}){return oAe(e,i,r)}formatOffset(e,i){return o$(this.offset(e),i)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}let M7={};function JZe(t){return M7[t]||(M7[t]=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"})),M7[t]}const KZe={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function QZe(t,e){const i=t.format(e).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(i),[,n,s,o,a,c,p,_]=r;return[o,n,s,a,c,p,_]}function eJe(t,e){const i=t.formatToParts(e),r=[];for(let n=0;n=0?M:1e3+M,(S-C)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let mde={};function tJe(t,e={}){const i=JSON.stringify([t,e]);let r=mde[i];return r||(r=new Intl.ListFormat(t,e),mde[i]=r),r}let WZ={};function YZ(t,e={}){const i=JSON.stringify([t,e]);let r=WZ[i];return r||(r=new Intl.DateTimeFormat(t,e),WZ[i]=r),r}let XZ={};function iJe(t,e={}){const i=JSON.stringify([t,e]);let r=XZ[i];return r||(r=new Intl.NumberFormat(t,e),XZ[i]=r),r}let ZZ={};function rJe(t,e={}){const{base:i,...r}=e,n=JSON.stringify([t,r]);let s=ZZ[n];return s||(s=new Intl.RelativeTimeFormat(t,e),ZZ[n]=s),s}let cI=null;function nJe(){return cI||(cI=new Intl.DateTimeFormat().resolvedOptions().locale,cI)}let gde={};function sJe(t){let e=gde[t];if(!e){const i=new Intl.Locale(t);e="getWeekInfo"in i?i.getWeekInfo():i.weekInfo,gde[t]=e}return e}function oJe(t){const e=t.indexOf("-x-");e!==-1&&(t=t.substring(0,e));const i=t.indexOf("-u-");if(i===-1)return[t];{let r,n;try{r=YZ(t).resolvedOptions(),n=t}catch{const c=t.substring(0,i);r=YZ(c).resolvedOptions(),n=c}const{numberingSystem:s,calendar:o}=r;return[n,s,o]}}function aJe(t,e,i){return(i||e)&&(t.includes("-u-")||(t+="-u"),i&&(t+=`-ca-${i}`),e&&(t+=`-nu-${e}`)),t}function lJe(t){const e=[];for(let i=1;i<=12;i++){const r=$i.utc(2009,i,1);e.push(t(r))}return e}function cJe(t){const e=[];for(let i=1;i<=7;i++){const r=$i.utc(2016,11,13+i);e.push(t(r))}return e}function B6(t,e,i,r){const n=t.listingMode();return n==="error"?null:n==="en"?i(e):r(e)}function uJe(t){return t.numberingSystem&&t.numberingSystem!=="latn"?!1:t.numberingSystem==="latn"||!t.locale||t.locale.startsWith("en")||new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem==="latn"}class hJe{constructor(e,i,r){this.padTo=r.padTo||0,this.floor=r.floor||!1;const{padTo:n,floor:s,...o}=r;if(!i||Object.keys(o).length>0){const a={useGrouping:!1,...r};r.padTo>0&&(a.minimumIntegerDigits=r.padTo),this.inf=iJe(e,a)}}format(e){if(this.inf){const i=this.floor?Math.floor(e):e;return this.inf.format(i)}else{const i=this.floor?Math.floor(e):Ese(e,3);return Ha(i,this.padTo)}}}class dJe{constructor(e,i,r){this.opts=r,this.originalZone=void 0;let n;if(this.opts.timeZone)this.dt=e;else if(e.zone.type==="fixed"){const o=-1*(e.offset/60),a=o>=0?`Etc/GMT+${o}`:`Etc/GMT${o}`;e.offset!==0&&Cp.create(a).valid?(n=a,this.dt=e):(n="UTC",this.dt=e.offset===0?e:e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type==="system"?this.dt=e:e.zone.type==="iana"?(this.dt=e,n=e.zone.name):(n="UTC",this.dt=e.setZone("UTC").plus({minutes:e.offset}),this.originalZone=e.zone);const s={...this.opts};s.timeZone=s.timeZone||n,this.dtf=YZ(i,s)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(""):this.dtf.format(this.dt.toJSDate())}formatToParts(){const e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(i=>{if(i.type==="timeZoneName"){const r=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...i,value:r}}else return i}):e}resolvedOptions(){return this.dtf.resolvedOptions()}}class pJe{constructor(e,i,r){this.opts={style:"long",...r},!i&&nAe()&&(this.rtf=rJe(e,r))}format(e,i){return this.rtf?this.rtf.format(e,i):$Je(i,e,this.opts.numeric,this.opts.style!=="long")}formatToParts(e,i){return this.rtf?this.rtf.formatToParts(e,i):[]}}const fJe={firstDay:1,minimalDays:4,weekend:[6,7]};class Ms{static fromOpts(e){return Ms.create(e.locale,e.numberingSystem,e.outputCalendar,e.weekSettings,e.defaultToEN)}static create(e,i,r,n,s=!1){const o=e||Sa.defaultLocale,a=o||(s?"en-US":nJe()),c=i||Sa.defaultNumberingSystem,p=r||Sa.defaultOutputCalendar,_=JZ(n)||Sa.defaultWeekSettings;return new Ms(a,c,p,_,o)}static resetCache(){cI=null,WZ={},XZ={},ZZ={}}static fromObject({locale:e,numberingSystem:i,outputCalendar:r,weekSettings:n}={}){return Ms.create(e,i,r,n)}constructor(e,i,r,n,s){const[o,a,c]=oJe(e);this.locale=o,this.numberingSystem=i||a||null,this.outputCalendar=r||c||null,this.weekSettings=n,this.intl=aJe(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=s,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached==null&&(this.fastNumbersCached=uJe(this)),this.fastNumbersCached}listingMode(){const e=this.isEnglish(),i=(this.numberingSystem===null||this.numberingSystem==="latn")&&(this.outputCalendar===null||this.outputCalendar==="gregory");return e&&i?"en":"intl"}clone(e){return!e||Object.getOwnPropertyNames(e).length===0?this:Ms.create(e.locale||this.specifiedLocale,e.numberingSystem||this.numberingSystem,e.outputCalendar||this.outputCalendar,JZ(e.weekSettings)||this.weekSettings,e.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,i=!1){return B6(this,e,cAe,()=>{const r=i?{month:e,day:"numeric"}:{month:e},n=i?"format":"standalone";return this.monthsCache[n][e]||(this.monthsCache[n][e]=lJe(s=>this.extract(s,r,"month"))),this.monthsCache[n][e]})}weekdays(e,i=!1){return B6(this,e,dAe,()=>{const r=i?{weekday:e,year:"numeric",month:"long",day:"numeric"}:{weekday:e},n=i?"format":"standalone";return this.weekdaysCache[n][e]||(this.weekdaysCache[n][e]=cJe(s=>this.extract(s,r,"weekday"))),this.weekdaysCache[n][e]})}meridiems(){return B6(this,void 0,()=>pAe,()=>{if(!this.meridiemCache){const e={hour:"numeric",hourCycle:"h12"};this.meridiemCache=[$i.utc(2016,11,13,9),$i.utc(2016,11,13,19)].map(i=>this.extract(i,e,"dayperiod"))}return this.meridiemCache})}eras(e){return B6(this,e,fAe,()=>{const i={era:e};return this.eraCache[e]||(this.eraCache[e]=[$i.utc(-40,1,1),$i.utc(2017,1,1)].map(r=>this.extract(r,i,"era"))),this.eraCache[e]})}extract(e,i,r){const n=this.dtFormatter(e,i),s=n.formatToParts(),o=s.find(a=>a.type.toLowerCase()===r);return o?o.value:null}numberFormatter(e={}){return new hJe(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,i={}){return new dJe(e,this.intl,i)}relFormatter(e={}){return new pJe(this.intl,this.isEnglish(),e)}listFormatter(e={}){return tJe(this.intl,e)}isEnglish(){return this.locale==="en"||this.locale.toLowerCase()==="en-us"||new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us")}getWeekSettings(){return this.weekSettings?this.weekSettings:sAe()?sJe(this.locale):fJe}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}}let bH=null;class Ec extends p5{static get utcInstance(){return bH===null&&(bH=new Ec(0)),bH}static instance(e){return e===0?Ec.utcInstance:new Ec(e)}static parseSpecifier(e){if(e){const i=e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(i)return new Ec(IB(i[1],i[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return"fixed"}get name(){return this.fixed===0?"UTC":`UTC${o$(this.fixed,"narrow")}`}get ianaName(){return this.fixed===0?"Etc/UTC":`Etc/GMT${o$(-this.fixed,"narrow")}`}offsetName(){return this.name}formatOffset(e,i){return o$(this.fixed,i)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type==="fixed"&&e.fixed===this.fixed}get isValid(){return!0}}class mJe extends p5{constructor(e){super(),this.zoneName=e}get type(){return"invalid"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return""}offset(){return NaN}equals(){return!1}get isValid(){return!1}}function Yw(t,e){if(mr(t)||t===null)return e;if(t instanceof p5)return t;if(vJe(t)){const i=t.toLowerCase();return i==="default"?e:i==="local"||i==="system"?OB.instance:i==="utc"||i==="gmt"?Ec.utcInstance:Ec.parseSpecifier(i)||Cp.create(t)}else return yT(t)?Ec.instance(t):typeof t=="object"&&"offset"in t&&typeof t.offset=="function"?t:new mJe(t)}let yde=()=>Date.now(),vde="system",_de=null,bde=null,wde=null,xde=60,Sde,Tde=null;class Sa{static get now(){return yde}static set now(e){yde=e}static set defaultZone(e){vde=e}static get defaultZone(){return Yw(vde,OB.instance)}static get defaultLocale(){return _de}static set defaultLocale(e){_de=e}static get defaultNumberingSystem(){return bde}static set defaultNumberingSystem(e){bde=e}static get defaultOutputCalendar(){return wde}static set defaultOutputCalendar(e){wde=e}static get defaultWeekSettings(){return Tde}static set defaultWeekSettings(e){Tde=JZ(e)}static get twoDigitCutoffYear(){return xde}static set twoDigitCutoffYear(e){xde=e%100}static get throwOnInvalid(){return Sde}static set throwOnInvalid(e){Sde=e}static resetCaches(){Ms.resetCache(),Cp.resetCache()}}class vm{constructor(e,i){this.reason=e,this.explanation=i}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}}const KCe=[0,31,59,90,120,151,181,212,243,273,304,334],QCe=[0,31,60,91,121,152,182,213,244,274,305,335];function Of(t,e){return new vm("unit out of range",`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`)}function xse(t,e,i){const r=new Date(Date.UTC(t,e-1,i));t<100&&t>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);const n=r.getUTCDay();return n===0?7:n}function eAe(t,e,i){return i+(F9(t)?QCe:KCe)[e-1]}function tAe(t,e){const i=F9(t)?QCe:KCe,r=i.findIndex(s=>swL(r,e,i)?(p=r+1,c=1):p=r,{weekYear:p,weekNumber:c,weekday:a,...$B(t)}}function Ede(t,e=4,i=1){const{weekYear:r,weekNumber:n,weekday:s}=t,o=Sse(xse(r,1,e),i),a=cO(r);let c=n*7+s-o-7+e,p;c<1?(p=r-1,c+=cO(p)):c>a?(p=r+1,c-=cO(r)):p=r;const{month:_,day:x}=tAe(p,c);return{year:p,month:_,day:x,...$B(t)}}function wH(t){const{year:e,month:i,day:r}=t,n=eAe(e,i,r);return{year:e,ordinal:n,...$B(t)}}function Cde(t){const{year:e,ordinal:i}=t,{month:r,day:n}=tAe(e,i);return{year:e,month:r,day:n,...$B(t)}}function Ade(t,e){if(!mr(t.localWeekday)||!mr(t.localWeekNumber)||!mr(t.localWeekYear)){if(!mr(t.weekday)||!mr(t.weekNumber)||!mr(t.weekYear))throw new MM("Cannot mix locale-based week fields with ISO-based week fields");return mr(t.localWeekday)||(t.weekday=t.localWeekday),mr(t.localWeekNumber)||(t.weekNumber=t.localWeekNumber),mr(t.localWeekYear)||(t.weekYear=t.localWeekYear),delete t.localWeekday,delete t.localWeekNumber,delete t.localWeekYear,{minDaysInFirstWeek:e.getMinDaysInFirstWeek(),startOfWeek:e.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function gJe(t,e=4,i=1){const r=PB(t.weekYear),n=Pf(t.weekNumber,1,wL(t.weekYear,e,i)),s=Pf(t.weekday,1,7);return r?n?s?!1:Of("weekday",t.weekday):Of("week",t.weekNumber):Of("weekYear",t.weekYear)}function yJe(t){const e=PB(t.year),i=Pf(t.ordinal,1,cO(t.year));return e?i?!1:Of("ordinal",t.ordinal):Of("year",t.year)}function iAe(t){const e=PB(t.year),i=Pf(t.month,1,12),r=Pf(t.day,1,Fz(t.year,t.month));return e?i?r?!1:Of("day",t.day):Of("month",t.month):Of("year",t.year)}function rAe(t){const{hour:e,minute:i,second:r,millisecond:n}=t,s=Pf(e,0,23)||e===24&&i===0&&r===0&&n===0,o=Pf(i,0,59),a=Pf(r,0,59),c=Pf(n,0,999);return s?o?a?c?!1:Of("millisecond",n):Of("second",r):Of("minute",i):Of("hour",e)}function mr(t){return typeof t>"u"}function yT(t){return typeof t=="number"}function PB(t){return typeof t=="number"&&t%1===0}function vJe(t){return typeof t=="string"}function _Je(t){return Object.prototype.toString.call(t)==="[object Date]"}function nAe(){try{return typeof Intl<"u"&&!!Intl.RelativeTimeFormat}catch{return!1}}function sAe(){try{return typeof Intl<"u"&&!!Intl.Locale&&("weekInfo"in Intl.Locale.prototype||"getWeekInfo"in Intl.Locale.prototype)}catch{return!1}}function bJe(t){return Array.isArray(t)?t:[t]}function Mde(t,e,i){if(t.length!==0)return t.reduce((r,n)=>{const s=[e(n),n];return r&&i(r[0],s[0])===r[0]?r:s},null)[1]}function wJe(t,e){return e.reduce((i,r)=>(i[r]=t[r],i),{})}function rP(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function JZ(t){if(t==null)return null;if(typeof t!="object")throw new Hh("Week settings must be an object");if(!Pf(t.firstDay,1,7)||!Pf(t.minimalDays,1,7)||!Array.isArray(t.weekend)||t.weekend.some(e=>!Pf(e,1,7)))throw new Hh("Invalid week settings");return{firstDay:t.firstDay,minimalDays:t.minimalDays,weekend:Array.from(t.weekend)}}function Pf(t,e,i){return PB(t)&&t>=e&&t<=i}function xJe(t,e){return t-e*Math.floor(t/e)}function Ha(t,e=2){const i=t<0;let r;return i?r="-"+(""+-t).padStart(e,"0"):r=(""+t).padStart(e,"0"),r}function Dw(t){if(!(mr(t)||t===null||t===""))return parseInt(t,10)}function Tx(t){if(!(mr(t)||t===null||t===""))return parseFloat(t)}function Tse(t){if(!(mr(t)||t===null||t==="")){const e=parseFloat("0."+t)*1e3;return Math.floor(e)}}function Ese(t,e,i=!1){const r=10**e;return(i?Math.trunc:Math.round)(t*r)/r}function F9(t){return t%4===0&&(t%100!==0||t%400===0)}function cO(t){return F9(t)?366:365}function Fz(t,e){const i=xJe(e-1,12)+1,r=t+(e-i)/12;return i===2?F9(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][i-1]}function RB(t){let e=Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond);return t.year<100&&t.year>=0&&(e=new Date(e),e.setUTCFullYear(t.year,t.month-1,t.day)),+e}function Ode(t,e,i){return-Sse(xse(t,1,e),i)+e-1}function wL(t,e=4,i=1){const r=Ode(t,e,i),n=Ode(t+1,e,i);return(cO(t)-r+n)/7}function KZ(t){return t>99?t:t>Sa.twoDigitCutoffYear?1900+t:2e3+t}function oAe(t,e,i,r=null){const n=new Date(t),s={hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"};r&&(s.timeZone=r);const o={timeZoneName:e,...s},a=new Intl.DateTimeFormat(i,o).formatToParts(n).find(c=>c.type.toLowerCase()==="timezonename");return a?a.value:null}function IB(t,e){let i=parseInt(t,10);Number.isNaN(i)&&(i=0);const r=parseInt(e,10)||0,n=i<0||Object.is(i,-0)?-r:r;return i*60+n}function aAe(t){const e=Number(t);if(typeof t=="boolean"||t===""||Number.isNaN(e))throw new Hh(`Invalid unit value ${t}`);return e}function kz(t,e){const i={};for(const r in t)if(rP(t,r)){const n=t[r];if(n==null)continue;i[e(r)]=aAe(n)}return i}function o$(t,e){const i=Math.trunc(Math.abs(t/60)),r=Math.trunc(Math.abs(t%60)),n=t>=0?"+":"-";switch(e){case"short":return`${n}${Ha(i,2)}:${Ha(r,2)}`;case"narrow":return`${n}${i}${r>0?`:${r}`:""}`;case"techie":return`${n}${Ha(i,2)}${Ha(r,2)}`;default:throw new RangeError(`Value format ${e} is out of range for property format`)}}function $B(t){return wJe(t,["hour","minute","second","millisecond"])}const SJe=["January","February","March","April","May","June","July","August","September","October","November","December"],lAe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],TJe=["J","F","M","A","M","J","J","A","S","O","N","D"];function cAe(t){switch(t){case"narrow":return[...TJe];case"short":return[...lAe];case"long":return[...SJe];case"numeric":return["1","2","3","4","5","6","7","8","9","10","11","12"];case"2-digit":return["01","02","03","04","05","06","07","08","09","10","11","12"];default:return null}}const uAe=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],hAe=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],EJe=["M","T","W","T","F","S","S"];function dAe(t){switch(t){case"narrow":return[...EJe];case"short":return[...hAe];case"long":return[...uAe];case"numeric":return["1","2","3","4","5","6","7"];default:return null}}const pAe=["AM","PM"],CJe=["Before Christ","Anno Domini"],AJe=["BC","AD"],MJe=["B","A"];function fAe(t){switch(t){case"narrow":return[...MJe];case"short":return[...AJe];case"long":return[...CJe];default:return null}}function OJe(t){return pAe[t.hour<12?0:1]}function PJe(t,e){return dAe(e)[t.weekday-1]}function RJe(t,e){return cAe(e)[t.month-1]}function IJe(t,e){return fAe(e)[t.year<0?0:1]}function $Je(t,e,i="always",r=!1){const n={years:["year","yr."],quarters:["quarter","qtr."],months:["month","mo."],weeks:["week","wk."],days:["day","day","days"],hours:["hour","hr."],minutes:["minute","min."],seconds:["second","sec."]},s=["hours","minutes","seconds"].indexOf(t)===-1;if(i==="auto"&&s){const x=t==="days";switch(e){case 1:return x?"tomorrow":`next ${n[t][0]}`;case-1:return x?"yesterday":`last ${n[t][0]}`;case 0:return x?"today":`this ${n[t][0]}`}}const o=Object.is(e,-0)||e<0,a=Math.abs(e),c=a===1,p=n[t],_=r?c?p[1]:p[2]||p[1]:c?n[t][0]:t;return o?`${a} ${_} ago`:`in ${a} ${_}`}function Pde(t,e){let i="";for(const r of t)r.literal?i+=r.val:i+=e(r.val);return i}const LJe={D:Dz,DD:$Ce,DDD:LCe,DDDD:DCe,t:NCe,tt:FCe,ttt:kCe,tttt:zCe,T:UCe,TT:VCe,TTT:BCe,TTTT:jCe,f:GCe,ff:qCe,fff:YCe,ffff:ZCe,F:HCe,FF:WCe,FFF:XCe,FFFF:JCe};class lu{static create(e,i={}){return new lu(e,i)}static parseFormat(e){let i=null,r="",n=!1;const s=[];for(let o=0;o0&&s.push({literal:n||/^\s+$/.test(r),val:r}),i=null,r="",n=!n):n||a===i?r+=a:(r.length>0&&s.push({literal:/^\s+$/.test(r),val:r}),r=a,i=a)}return r.length>0&&s.push({literal:n||/^\s+$/.test(r),val:r}),s}static macroTokenToFormatOpts(e){return LJe[e]}constructor(e,i){this.opts=i,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,i){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...i}).format()}dtFormatter(e,i={}){return this.loc.dtFormatter(e,{...this.opts,...i})}formatDateTime(e,i){return this.dtFormatter(e,i).format()}formatDateTimeParts(e,i){return this.dtFormatter(e,i).formatToParts()}formatInterval(e,i){return this.dtFormatter(e.start,i).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,i){return this.dtFormatter(e,i).resolvedOptions()}num(e,i=0){if(this.opts.forceSimple)return Ha(e,i);const r={...this.opts};return i>0&&(r.padTo=i),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(e,i){const r=this.loc.listingMode()==="en",n=this.loc.outputCalendar&&this.loc.outputCalendar!=="gregory",s=(C,M)=>this.loc.extract(e,C,M),o=C=>e.isOffsetFixed&&e.offset===0&&C.allowZ?"Z":e.isValid?e.zone.formatOffset(e.ts,C.format):"",a=()=>r?OJe(e):s({hour:"numeric",hourCycle:"h12"},"dayperiod"),c=(C,M)=>r?RJe(e,C):s(M?{month:C}:{month:C,day:"numeric"},"month"),p=(C,M)=>r?PJe(e,C):s(M?{weekday:C}:{weekday:C,month:"long",day:"numeric"},"weekday"),_=C=>{const M=lu.macroTokenToFormatOpts(C);return M?this.formatWithSystemDefault(e,M):C},x=C=>r?IJe(e,C):s({era:C},"era"),S=C=>{switch(C){case"S":return this.num(e.millisecond);case"u":case"SSS":return this.num(e.millisecond,3);case"s":return this.num(e.second);case"ss":return this.num(e.second,2);case"uu":return this.num(Math.floor(e.millisecond/10),2);case"uuu":return this.num(Math.floor(e.millisecond/100));case"m":return this.num(e.minute);case"mm":return this.num(e.minute,2);case"h":return this.num(e.hour%12===0?12:e.hour%12);case"hh":return this.num(e.hour%12===0?12:e.hour%12,2);case"H":return this.num(e.hour);case"HH":return this.num(e.hour,2);case"Z":return o({format:"narrow",allowZ:this.opts.allowZ});case"ZZ":return o({format:"short",allowZ:this.opts.allowZ});case"ZZZ":return o({format:"techie",allowZ:this.opts.allowZ});case"ZZZZ":return e.zone.offsetName(e.ts,{format:"short",locale:this.loc.locale});case"ZZZZZ":return e.zone.offsetName(e.ts,{format:"long",locale:this.loc.locale});case"z":return e.zoneName;case"a":return a();case"d":return n?s({day:"numeric"},"day"):this.num(e.day);case"dd":return n?s({day:"2-digit"},"day"):this.num(e.day,2);case"c":return this.num(e.weekday);case"ccc":return p("short",!0);case"cccc":return p("long",!0);case"ccccc":return p("narrow",!0);case"E":return this.num(e.weekday);case"EEE":return p("short",!1);case"EEEE":return p("long",!1);case"EEEEE":return p("narrow",!1);case"L":return n?s({month:"numeric",day:"numeric"},"month"):this.num(e.month);case"LL":return n?s({month:"2-digit",day:"numeric"},"month"):this.num(e.month,2);case"LLL":return c("short",!0);case"LLLL":return c("long",!0);case"LLLLL":return c("narrow",!0);case"M":return n?s({month:"numeric"},"month"):this.num(e.month);case"MM":return n?s({month:"2-digit"},"month"):this.num(e.month,2);case"MMM":return c("short",!1);case"MMMM":return c("long",!1);case"MMMMM":return c("narrow",!1);case"y":return n?s({year:"numeric"},"year"):this.num(e.year);case"yy":return n?s({year:"2-digit"},"year"):this.num(e.year.toString().slice(-2),2);case"yyyy":return n?s({year:"numeric"},"year"):this.num(e.year,4);case"yyyyyy":return n?s({year:"numeric"},"year"):this.num(e.year,6);case"G":return x("short");case"GG":return x("long");case"GGGGG":return x("narrow");case"kk":return this.num(e.weekYear.toString().slice(-2),2);case"kkkk":return this.num(e.weekYear,4);case"W":return this.num(e.weekNumber);case"WW":return this.num(e.weekNumber,2);case"n":return this.num(e.localWeekNumber);case"nn":return this.num(e.localWeekNumber,2);case"ii":return this.num(e.localWeekYear.toString().slice(-2),2);case"iiii":return this.num(e.localWeekYear,4);case"o":return this.num(e.ordinal);case"ooo":return this.num(e.ordinal,3);case"q":return this.num(e.quarter);case"qq":return this.num(e.quarter,2);case"X":return this.num(Math.floor(e.ts/1e3));case"x":return this.num(e.ts);default:return _(C)}};return Pde(lu.parseFormat(i),S)}formatDurationFromString(e,i){const r=c=>{switch(c[0]){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":return"hour";case"d":return"day";case"w":return"week";case"M":return"month";case"y":return"year";default:return null}},n=c=>p=>{const _=r(p);return _?this.num(c.get(_),p.length):p},s=lu.parseFormat(i),o=s.reduce((c,{literal:p,val:_})=>p?c:c.concat(_),[]),a=e.shiftTo(...o.map(r).filter(c=>c));return Pde(s,n(a))}}const mAe=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function f5(...t){const e=t.reduce((i,r)=>i+r.source,"");return RegExp(`^${e}$`)}function m5(...t){return e=>t.reduce(([i,r,n],s)=>{const[o,a,c]=s(e,n);return[{...i,...o},a||r,c]},[{},null,1]).slice(0,2)}function g5(t,...e){if(t==null)return[null,null];for(const[i,r]of e){const n=i.exec(t);if(n)return r(n)}return[null,null]}function gAe(...t){return(e,i)=>{const r={};let n;for(n=0;nC!==void 0&&(M||C&&_)?-C:C;return[{years:S(Tx(i)),months:S(Tx(r)),weeks:S(Tx(n)),days:S(Tx(s)),hours:S(Tx(o)),minutes:S(Tx(a)),seconds:S(Tx(c),c==="-0"),milliseconds:S(Tse(p),x)}]}const WJe={GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Mse(t,e,i,r,n,s,o){const a={year:e.length===2?KZ(Dw(e)):Dw(e),month:lAe.indexOf(i)+1,day:Dw(r),hour:Dw(n),minute:Dw(s)};return o&&(a.second=Dw(o)),t&&(a.weekday=t.length>3?uAe.indexOf(t)+1:hAe.indexOf(t)+1),a}const YJe=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function XJe(t){const[,e,i,r,n,s,o,a,c,p,_,x]=t,S=Mse(e,n,r,i,s,o,a);let C;return c?C=WJe[c]:p?C=0:C=IB(_,x),[S,new Ec(C)]}function ZJe(t){return t.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").trim()}const JJe=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,KJe=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,QJe=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Rde(t){const[,e,i,r,n,s,o,a]=t;return[Mse(e,n,r,i,s,o,a),Ec.utcInstance]}function eKe(t){const[,e,i,r,n,s,o,a]=t;return[Mse(e,a,i,r,n,s,o),Ec.utcInstance]}const tKe=f5(NJe,Ase),iKe=f5(FJe,Ase),rKe=f5(kJe,Ase),nKe=f5(vAe),bAe=m5(jJe,y5,k9,z9),sKe=m5(zJe,y5,k9,z9),oKe=m5(UJe,y5,k9,z9),aKe=m5(y5,k9,z9);function lKe(t){return g5(t,[tKe,bAe],[iKe,sKe],[rKe,oKe],[nKe,aKe])}function cKe(t){return g5(ZJe(t),[YJe,XJe])}function uKe(t){return g5(t,[JJe,Rde],[KJe,Rde],[QJe,eKe])}function hKe(t){return g5(t,[HJe,qJe])}const dKe=m5(y5);function pKe(t){return g5(t,[GJe,dKe])}const fKe=f5(VJe,BJe),mKe=f5(_Ae),gKe=m5(y5,k9,z9);function yKe(t){return g5(t,[fKe,bAe],[mKe,gKe])}const Ide="Invalid Duration",wAe={weeks:{days:7,hours:7*24,minutes:7*24*60,seconds:7*24*60*60,milliseconds:7*24*60*60*1e3},days:{hours:24,minutes:24*60,seconds:24*60*60,milliseconds:24*60*60*1e3},hours:{minutes:60,seconds:60*60,milliseconds:60*60*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},vKe={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:91*24,minutes:91*24*60,seconds:91*24*60*60,milliseconds:91*24*60*60*1e3},months:{weeks:4,days:30,hours:30*24,minutes:30*24*60,seconds:30*24*60*60,milliseconds:30*24*60*60*1e3},...wAe},Lp=146097/400,zE=146097/4800,_Ke={years:{quarters:4,months:12,weeks:Lp/7,days:Lp,hours:Lp*24,minutes:Lp*24*60,seconds:Lp*24*60*60,milliseconds:Lp*24*60*60*1e3},quarters:{months:3,weeks:Lp/28,days:Lp/4,hours:Lp*24/4,minutes:Lp*24*60/4,seconds:Lp*24*60*60/4,milliseconds:Lp*24*60*60*1e3/4},months:{weeks:zE/7,days:zE,hours:zE*24,minutes:zE*24*60,seconds:zE*24*60*60,milliseconds:zE*24*60*60*1e3},...wAe},ZS=["years","quarters","months","weeks","days","hours","minutes","seconds","milliseconds"],bKe=ZS.slice(0).reverse();function lb(t,e,i=!1){const r={values:i?e.values:{...t.values,...e.values||{}},loc:t.loc.clone(e.loc),conversionAccuracy:e.conversionAccuracy||t.conversionAccuracy,matrix:e.matrix||t.matrix};return new pn(r)}function xAe(t,e){let i=e.milliseconds??0;for(const r of bKe.slice(1))e[r]&&(i+=e[r]*t[r].milliseconds);return i}function $de(t,e){const i=xAe(t,e)<0?-1:1;ZS.reduceRight((r,n)=>{if(mr(e[n]))return r;if(r){const s=e[r]*i,o=t[n][r],a=Math.floor(s/o);e[n]+=a*i,e[r]-=a*o*i}return n},null),ZS.reduce((r,n)=>{if(mr(e[n]))return r;if(r){const s=e[r]%1;e[r]-=s,e[n]+=s*t[r][n]}return n},null)}function wKe(t){const e={};for(const[i,r]of Object.entries(t))r!==0&&(e[i]=r);return e}class pn{constructor(e){const i=e.conversionAccuracy==="longterm"||!1;let r=i?_Ke:vKe;e.matrix&&(r=e.matrix),this.values=e.values,this.loc=e.loc||Ms.create(),this.conversionAccuracy=i?"longterm":"casual",this.invalid=e.invalid||null,this.matrix=r,this.isLuxonDuration=!0}static fromMillis(e,i){return pn.fromObject({milliseconds:e},i)}static fromObject(e,i={}){if(e==null||typeof e!="object")throw new Hh(`Duration.fromObject: argument expected to be an object, got ${e===null?"null":typeof e}`);return new pn({values:kz(e,pn.normalizeUnit),loc:Ms.fromObject(i),conversionAccuracy:i.conversionAccuracy,matrix:i.matrix})}static fromDurationLike(e){if(yT(e))return pn.fromMillis(e);if(pn.isDuration(e))return e;if(typeof e=="object")return pn.fromObject(e);throw new Hh(`Unknown duration argument ${e} of type ${typeof e}`)}static fromISO(e,i){const[r]=hKe(e);return r?pn.fromObject(r,i):pn.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static fromISOTime(e,i){const[r]=pKe(e);return r?pn.fromObject(r,i):pn.invalid("unparsable",`the input "${e}" can't be parsed as ISO 8601`)}static invalid(e,i=null){if(!e)throw new Hh("need to specify a reason the Duration is invalid");const r=e instanceof vm?e:new vm(e,i);if(Sa.throwOnInvalid)throw new YZe(r);return new pn({invalid:r})}static normalizeUnit(e){const i={year:"years",years:"years",quarter:"quarters",quarters:"quarters",month:"months",months:"months",week:"weeks",weeks:"weeks",day:"days",days:"days",hour:"hours",hours:"hours",minute:"minutes",minutes:"minutes",second:"seconds",seconds:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds"}[e&&e.toLowerCase()];if(!i)throw new ICe(e);return i}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,i={}){const r={...i,floor:i.round!==!1&&i.floor!==!1};return this.isValid?lu.create(this.loc,r).formatDurationFromString(this,e):Ide}toHuman(e={}){if(!this.isValid)return Ide;const i=ZS.map(r=>{const n=this.values[r];return mr(n)?null:this.loc.numberFormatter({style:"unit",unitDisplay:"long",...e,unit:r.slice(0,-1)}).format(n)}).filter(r=>r);return this.loc.listFormatter({type:"conjunction",style:e.listStyle||"narrow",...e}).format(i)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e="P";return this.years!==0&&(e+=this.years+"Y"),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+"M"),this.weeks!==0&&(e+=this.weeks+"W"),this.days!==0&&(e+=this.days+"D"),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+="T"),this.hours!==0&&(e+=this.hours+"H"),this.minutes!==0&&(e+=this.minutes+"M"),(this.seconds!==0||this.milliseconds!==0)&&(e+=Ese(this.seconds+this.milliseconds/1e3,3)+"S"),e==="P"&&(e+="T0S"),e}toISOTime(e={}){if(!this.isValid)return null;const i=this.toMillis();return i<0||i>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:"extended",...e,includeOffset:!1},$i.fromMillis(i,{zone:"UTC"}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?xAe(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(e){if(!this.isValid)return this;const i=pn.fromDurationLike(e),r={};for(const n of ZS)(rP(i.values,n)||rP(this.values,n))&&(r[n]=i.get(n)+this.get(n));return lb(this,{values:r},!0)}minus(e){if(!this.isValid)return this;const i=pn.fromDurationLike(e);return this.plus(i.negate())}mapUnits(e){if(!this.isValid)return this;const i={};for(const r of Object.keys(this.values))i[r]=aAe(e(this.values[r],r));return lb(this,{values:i},!0)}get(e){return this[pn.normalizeUnit(e)]}set(e){if(!this.isValid)return this;const i={...this.values,...kz(e,pn.normalizeUnit)};return lb(this,{values:i})}reconfigure({locale:e,numberingSystem:i,conversionAccuracy:r,matrix:n}={}){const o={loc:this.loc.clone({locale:e,numberingSystem:i}),matrix:n,conversionAccuracy:r};return lb(this,o)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;const e=this.toObject();return $de(this.matrix,e),lb(this,{values:e},!0)}rescale(){if(!this.isValid)return this;const e=wKe(this.normalize().shiftToAll().toObject());return lb(this,{values:e},!0)}shiftTo(...e){if(!this.isValid)return this;if(e.length===0)return this;e=e.map(o=>pn.normalizeUnit(o));const i={},r={},n=this.toObject();let s;for(const o of ZS)if(e.indexOf(o)>=0){s=o;let a=0;for(const p in r)a+=this.matrix[p][o]*r[p],r[p]=0;yT(n[o])&&(a+=n[o]);const c=Math.trunc(a);i[o]=c,r[o]=(a*1e3-c*1e3)/1e3}else yT(n[o])&&(r[o]=n[o]);for(const o in r)r[o]!==0&&(i[s]+=o===s?r[o]:r[o]/this.matrix[s][o]);return $de(this.matrix,i),lb(this,{values:i},!0)}shiftToAll(){return this.isValid?this.shiftTo("years","months","weeks","days","hours","minutes","seconds","milliseconds"):this}negate(){if(!this.isValid)return this;const e={};for(const i of Object.keys(this.values))e[i]=this.values[i]===0?0:-this.values[i];return lb(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function i(r,n){return r===void 0||r===0?n===void 0||n===0:r===n}for(const r of ZS)if(!i(this.values[r],e.values[r]))return!1;return!0}}const UE="Invalid Interval";function xKe(t,e){return!t||!t.isValid?Zo.invalid("missing or invalid start"):!e||!e.isValid?Zo.invalid("missing or invalid end"):ee:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:e,end:i}={}){return this.isValid?Zo.fromDateTimes(e||this.s,i||this.e):this}splitAt(...e){if(!this.isValid)return[];const i=e.map(W5).filter(o=>this.contains(o)).sort((o,a)=>o.toMillis()-a.toMillis()),r=[];let{s:n}=this,s=0;for(;n+this.e?this.e:o;r.push(Zo.fromDateTimes(n,a)),n=a,s+=1}return r}splitBy(e){const i=pn.fromDurationLike(e);if(!this.isValid||!i.isValid||i.as("milliseconds")===0)return[];let{s:r}=this,n=1,s;const o=[];for(;rc*n));s=+a>+this.e?this.e:a,o.push(Zo.fromDateTimes(r,s)),r=s,n+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(e){if(!this.isValid)return this;const i=this.s>e.s?this.s:e.s,r=this.e=r?null:Zo.fromDateTimes(i,r)}union(e){if(!this.isValid)return this;const i=this.se.e?this.e:e.e;return Zo.fromDateTimes(i,r)}static merge(e){const[i,r]=e.sort((n,s)=>n.s-s.s).reduce(([n,s],o)=>s?s.overlaps(o)||s.abutsStart(o)?[n,s.union(o)]:[n.concat([s]),o]:[n,o],[[],null]);return r&&i.push(r),i}static xor(e){let i=null,r=0;const n=[],s=e.map(c=>[{time:c.s,type:"s"},{time:c.e,type:"e"}]),o=Array.prototype.concat(...s),a=o.sort((c,p)=>c.time-p.time);for(const c of a)r+=c.type==="s"?1:-1,r===1?i=c.time:(i&&+i!=+c.time&&n.push(Zo.fromDateTimes(i,c.time)),i=null);return Zo.merge(n)}difference(...e){return Zo.xor([this].concat(e)).map(i=>this.intersection(i)).filter(i=>i&&!i.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:UE}[Symbol.for("nodejs.util.inspect.custom")](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=Dz,i={}){return this.isValid?lu.create(this.s.loc.clone(i),e).formatInterval(this):UE}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:UE}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:UE}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:UE}toFormat(e,{separator:i=" – "}={}){return this.isValid?`${this.s.toFormat(e)}${i}${this.e.toFormat(e)}`:UE}toDuration(e,i){return this.isValid?this.e.diff(this.s,e,i):pn.invalid(this.invalidReason)}mapEndpoints(e){return Zo.fromDateTimes(e(this.s),e(this.e))}}class uI{static hasDST(e=Sa.defaultZone){const i=$i.now().setZone(e).set({month:12});return!e.isUniversal&&i.offset!==i.set({month:6}).offset}static isValidIANAZone(e){return Cp.isValidZone(e)}static normalizeZone(e){return Yw(e,Sa.defaultZone)}static getStartOfWeek({locale:e=null,locObj:i=null}={}){return(i||Ms.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:i=null}={}){return(i||Ms.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:i=null}={}){return(i||Ms.create(e)).getWeekendDays().slice()}static months(e="long",{locale:i=null,numberingSystem:r=null,locObj:n=null,outputCalendar:s="gregory"}={}){return(n||Ms.create(i,r,s)).months(e)}static monthsFormat(e="long",{locale:i=null,numberingSystem:r=null,locObj:n=null,outputCalendar:s="gregory"}={}){return(n||Ms.create(i,r,s)).months(e,!0)}static weekdays(e="long",{locale:i=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Ms.create(i,r,null)).weekdays(e)}static weekdaysFormat(e="long",{locale:i=null,numberingSystem:r=null,locObj:n=null}={}){return(n||Ms.create(i,r,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return Ms.create(e).meridiems()}static eras(e="short",{locale:i=null}={}){return Ms.create(i,null,"gregory").eras(e)}static features(){return{relative:nAe(),localeWeek:sAe()}}}function Lde(t,e){const i=n=>n.toUTC(0,{keepLocalTime:!0}).startOf("day").valueOf(),r=i(e)-i(t);return Math.floor(pn.fromMillis(r).as("days"))}function SKe(t,e,i){const r=[["years",(c,p)=>p.year-c.year],["quarters",(c,p)=>p.quarter-c.quarter+(p.year-c.year)*4],["months",(c,p)=>p.month-c.month+(p.year-c.year)*12],["weeks",(c,p)=>{const _=Lde(c,p);return(_-_%7)/7}],["days",Lde]],n={},s=t;let o,a;for(const[c,p]of r)i.indexOf(c)>=0&&(o=c,n[c]=p(t,e),a=s.plus(n),a>e?(n[c]--,t=s.plus(n),t>e&&(a=t,n[c]--,t=s.plus(n))):t=a);return[t,n,a,o]}function TKe(t,e,i,r){let[n,s,o,a]=SKe(t,e,i);const c=e-n,p=i.filter(x=>["hours","minutes","seconds","milliseconds"].indexOf(x)>=0);p.length===0&&(o0?pn.fromMillis(c,r).shiftTo(...p).plus(_):_}const Ose={arab:"[٠-٩]",arabext:"[۰-۹]",bali:"[᭐-᭙]",beng:"[০-৯]",deva:"[०-९]",fullwide:"[0-9]",gujr:"[૦-૯]",hanidec:"[〇|一|二|三|四|五|六|七|八|九]",khmr:"[០-៩]",knda:"[೦-೯]",laoo:"[໐-໙]",limb:"[᥆-᥏]",mlym:"[൦-൯]",mong:"[᠐-᠙]",mymr:"[၀-၉]",orya:"[୦-୯]",tamldec:"[௦-௯]",telu:"[౦-౯]",thai:"[๐-๙]",tibt:"[༠-༩]",latn:"\\d"},Dde={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},EKe=Ose.hanidec.replace(/[\[|\]]/g,"").split("");function CKe(t){let e=parseInt(t,10);if(isNaN(e)){e="";for(let i=0;i=s&&r<=o&&(e+=r-s)}}return parseInt(e,10)}else return e}function p0({numberingSystem:t},e=""){return new RegExp(`${Ose[t||"latn"]}${e}`)}const AKe="missing Intl.DateTimeFormat.formatToParts support";function Gn(t,e=i=>i){return{regex:t,deser:([i])=>e(CKe(i))}}const MKe=" ",SAe=`[ ${MKe}]`,TAe=new RegExp(SAe,"g");function OKe(t){return t.replace(/\./g,"\\.?").replace(TAe,SAe)}function Nde(t){return t.replace(/\./g,"").replace(TAe," ").toLowerCase()}function f0(t,e){return t===null?null:{regex:RegExp(t.map(OKe).join("|")),deser:([i])=>t.findIndex(r=>Nde(i)===Nde(r))+e}}function Fde(t,e){return{regex:t,deser:([,i,r])=>IB(i,r),groups:e}}function j6(t){return{regex:t,deser:([e])=>e}}function PKe(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function RKe(t,e){const i=p0(e),r=p0(e,"{2}"),n=p0(e,"{3}"),s=p0(e,"{4}"),o=p0(e,"{6}"),a=p0(e,"{1,2}"),c=p0(e,"{1,3}"),p=p0(e,"{1,6}"),_=p0(e,"{1,9}"),x=p0(e,"{2,4}"),S=p0(e,"{4,6}"),C=$=>({regex:RegExp(PKe($.val)),deser:([F])=>F,literal:!0}),P=($=>{if(t.literal)return C($);switch($.val){case"G":return f0(e.eras("short"),0);case"GG":return f0(e.eras("long"),0);case"y":return Gn(p);case"yy":return Gn(x,KZ);case"yyyy":return Gn(s);case"yyyyy":return Gn(S);case"yyyyyy":return Gn(o);case"M":return Gn(a);case"MM":return Gn(r);case"MMM":return f0(e.months("short",!0),1);case"MMMM":return f0(e.months("long",!0),1);case"L":return Gn(a);case"LL":return Gn(r);case"LLL":return f0(e.months("short",!1),1);case"LLLL":return f0(e.months("long",!1),1);case"d":return Gn(a);case"dd":return Gn(r);case"o":return Gn(c);case"ooo":return Gn(n);case"HH":return Gn(r);case"H":return Gn(a);case"hh":return Gn(r);case"h":return Gn(a);case"mm":return Gn(r);case"m":return Gn(a);case"q":return Gn(a);case"qq":return Gn(r);case"s":return Gn(a);case"ss":return Gn(r);case"S":return Gn(c);case"SSS":return Gn(n);case"u":return j6(_);case"uu":return j6(a);case"uuu":return Gn(i);case"a":return f0(e.meridiems(),0);case"kkkk":return Gn(s);case"kk":return Gn(x,KZ);case"W":return Gn(a);case"WW":return Gn(r);case"E":case"c":return Gn(i);case"EEE":return f0(e.weekdays("short",!1),1);case"EEEE":return f0(e.weekdays("long",!1),1);case"ccc":return f0(e.weekdays("short",!0),1);case"cccc":return f0(e.weekdays("long",!0),1);case"Z":case"ZZ":return Fde(new RegExp(`([+-]${a.source})(?::(${r.source}))?`),2);case"ZZZ":return Fde(new RegExp(`([+-]${a.source})(${r.source})?`),2);case"z":return j6(/[a-z_+-/]{1,256}?/i);case" ":return j6(/[^\S\n\r]/);default:return C($)}})(t)||{invalidReason:AKe};return P.token=t,P}const IKe={year:{"2-digit":"yy",numeric:"yyyyy"},month:{numeric:"M","2-digit":"MM",short:"MMM",long:"MMMM"},day:{numeric:"d","2-digit":"dd"},weekday:{short:"EEE",long:"EEEE"},dayperiod:"a",dayPeriod:"a",hour12:{numeric:"h","2-digit":"hh"},hour24:{numeric:"H","2-digit":"HH"},minute:{numeric:"m","2-digit":"mm"},second:{numeric:"s","2-digit":"ss"},timeZoneName:{long:"ZZZZZ",short:"ZZZ"}};function $Ke(t,e,i){const{type:r,value:n}=t;if(r==="literal"){const c=/^\s+$/.test(n);return{literal:!c,val:c?" ":n}}const s=e[r];let o=r;r==="hour"&&(e.hour12!=null?o=e.hour12?"hour12":"hour24":e.hourCycle!=null?e.hourCycle==="h11"||e.hourCycle==="h12"?o="hour12":o="hour24":o=i.hour12?"hour12":"hour24");let a=IKe[o];if(typeof a=="object"&&(a=a[s]),a)return{literal:!1,val:a}}function LKe(t){return[`^${t.map(i=>i.regex).reduce((i,r)=>`${i}(${r.source})`,"")}$`,t]}function DKe(t,e,i){const r=t.match(e);if(r){const n={};let s=1;for(const o in i)if(rP(i,o)){const a=i[o],c=a.groups?a.groups+1:1;!a.literal&&a.token&&(n[a.token.val[0]]=a.deser(r.slice(s,s+c))),s+=c}return[r,n]}else return[r,{}]}function NKe(t){const e=s=>{switch(s){case"S":return"millisecond";case"s":return"second";case"m":return"minute";case"h":case"H":return"hour";case"d":return"day";case"o":return"ordinal";case"L":case"M":return"month";case"y":return"year";case"E":case"c":return"weekday";case"W":return"weekNumber";case"k":return"weekYear";case"q":return"quarter";default:return null}};let i=null,r;return mr(t.z)||(i=Cp.create(t.z)),mr(t.Z)||(i||(i=new Ec(t.Z)),r=t.Z),mr(t.q)||(t.M=(t.q-1)*3+1),mr(t.h)||(t.h<12&&t.a===1?t.h+=12:t.h===12&&t.a===0&&(t.h=0)),t.G===0&&t.y&&(t.y=-t.y),mr(t.u)||(t.S=Tse(t.u)),[Object.keys(t).reduce((s,o)=>{const a=e(o);return a&&(s[a]=t[o]),s},{}),i,r]}let xH=null;function FKe(){return xH||(xH=$i.fromMillis(1555555555555)),xH}function kKe(t,e){if(t.literal)return t;const i=lu.macroTokenToFormatOpts(t.val),r=AAe(i,e);return r==null||r.includes(void 0)?t:r}function EAe(t,e){return Array.prototype.concat(...t.map(i=>kKe(i,e)))}function CAe(t,e,i){const r=EAe(lu.parseFormat(i),t),n=r.map(o=>RKe(o,t)),s=n.find(o=>o.invalidReason);if(s)return{input:e,tokens:r,invalidReason:s.invalidReason};{const[o,a]=LKe(n),c=RegExp(o,"i"),[p,_]=DKe(e,c,a),[x,S,C]=_?NKe(_):[null,null,void 0];if(rP(_,"a")&&rP(_,"H"))throw new MM("Can't include meridiem when specifying 24-hour format");return{input:e,tokens:r,regex:c,rawMatches:p,matches:_,result:x,zone:S,specificOffset:C}}}function zKe(t,e,i){const{result:r,zone:n,specificOffset:s,invalidReason:o}=CAe(t,e,i);return[r,n,s,o]}function AAe(t,e){if(!t)return null;const r=lu.create(e,t).dtFormatter(FKe()),n=r.formatToParts(),s=r.resolvedOptions();return n.map(o=>$Ke(o,t,s))}const SH="Invalid DateTime",kde=864e13;function G6(t){return new vm("unsupported zone",`the zone "${t.name}" is not supported`)}function TH(t){return t.weekData===null&&(t.weekData=Nz(t.c)),t.weekData}function EH(t){return t.localWeekData===null&&(t.localWeekData=Nz(t.c,t.loc.getMinDaysInFirstWeek(),t.loc.getStartOfWeek())),t.localWeekData}function Ex(t,e){const i={ts:t.ts,zone:t.zone,c:t.c,o:t.o,loc:t.loc,invalid:t.invalid};return new $i({...i,...e,old:i})}function MAe(t,e,i){let r=t-e*60*1e3;const n=i.offset(r);if(e===n)return[r,e];r-=(n-e)*60*1e3;const s=i.offset(r);return n===s?[r,n]:[t-Math.min(n,s)*60*1e3,Math.max(n,s)]}function H6(t,e){t+=e*60*1e3;const i=new Date(t);return{year:i.getUTCFullYear(),month:i.getUTCMonth()+1,day:i.getUTCDate(),hour:i.getUTCHours(),minute:i.getUTCMinutes(),second:i.getUTCSeconds(),millisecond:i.getUTCMilliseconds()}}function O7(t,e,i){return MAe(RB(t),e,i)}function zde(t,e){const i=t.o,r=t.c.year+Math.trunc(e.years),n=t.c.month+Math.trunc(e.months)+Math.trunc(e.quarters)*3,s={...t.c,year:r,month:n,day:Math.min(t.c.day,Fz(r,n))+Math.trunc(e.days)+Math.trunc(e.weeks)*7},o=pn.fromObject({years:e.years-Math.trunc(e.years),quarters:e.quarters-Math.trunc(e.quarters),months:e.months-Math.trunc(e.months),weeks:e.weeks-Math.trunc(e.weeks),days:e.days-Math.trunc(e.days),hours:e.hours,minutes:e.minutes,seconds:e.seconds,milliseconds:e.milliseconds}).as("milliseconds"),a=RB(s);let[c,p]=MAe(a,i,t.zone);return o!==0&&(c+=o,p=t.zone.offset(c)),{ts:c,o:p}}function q5(t,e,i,r,n,s){const{setZone:o,zone:a}=i;if(t&&Object.keys(t).length!==0||e){const c=e||a,p=$i.fromObject(t,{...i,zone:c,specificOffset:s});return o?p:p.setZone(a)}else return $i.invalid(new vm("unparsable",`the input "${n}" can't be parsed as ${r}`))}function q6(t,e,i=!0){return t.isValid?lu.create(Ms.create("en-US"),{allowZ:i,forceSimple:!0}).formatDateTimeFromString(t,e):null}function CH(t,e){const i=t.c.year>9999||t.c.year<0;let r="";return i&&t.c.year>=0&&(r+="+"),r+=Ha(t.c.year,i?6:4),e?(r+="-",r+=Ha(t.c.month),r+="-",r+=Ha(t.c.day)):(r+=Ha(t.c.month),r+=Ha(t.c.day)),r}function Ude(t,e,i,r,n,s){let o=Ha(t.c.hour);return e?(o+=":",o+=Ha(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!i)&&(o+=":")):o+=Ha(t.c.minute),(t.c.millisecond!==0||t.c.second!==0||!i)&&(o+=Ha(t.c.second),(t.c.millisecond!==0||!r)&&(o+=".",o+=Ha(t.c.millisecond,3))),n&&(t.isOffsetFixed&&t.offset===0&&!s?o+="Z":t.o<0?(o+="-",o+=Ha(Math.trunc(-t.o/60)),o+=":",o+=Ha(Math.trunc(-t.o%60))):(o+="+",o+=Ha(Math.trunc(t.o/60)),o+=":",o+=Ha(Math.trunc(t.o%60)))),s&&(o+="["+t.zone.ianaName+"]"),o}const OAe={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},UKe={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},VKe={ordinal:1,hour:0,minute:0,second:0,millisecond:0},PAe=["year","month","day","hour","minute","second","millisecond"],BKe=["weekYear","weekNumber","weekday","hour","minute","second","millisecond"],jKe=["year","ordinal","hour","minute","second","millisecond"];function GKe(t){const e={year:"year",years:"year",month:"month",months:"month",day:"day",days:"day",hour:"hour",hours:"hour",minute:"minute",minutes:"minute",quarter:"quarter",quarters:"quarter",second:"second",seconds:"second",millisecond:"millisecond",milliseconds:"millisecond",weekday:"weekday",weekdays:"weekday",weeknumber:"weekNumber",weeksnumber:"weekNumber",weeknumbers:"weekNumber",weekyear:"weekYear",weekyears:"weekYear",ordinal:"ordinal"}[t.toLowerCase()];if(!e)throw new ICe(t);return e}function Vde(t){switch(t.toLowerCase()){case"localweekday":case"localweekdays":return"localWeekday";case"localweeknumber":case"localweeknumbers":return"localWeekNumber";case"localweekyear":case"localweekyears":return"localWeekYear";default:return GKe(t)}}function Bde(t,e){const i=Yw(e.zone,Sa.defaultZone),r=Ms.fromObject(e),n=Sa.now();let s,o;if(mr(t.year))s=n;else{for(const p of PAe)mr(t[p])&&(t[p]=OAe[p]);const a=iAe(t)||rAe(t);if(a)return $i.invalid(a);const c=i.offset(n);[s,o]=O7(t,c,i)}return new $i({ts:s,zone:i,loc:r,o})}function jde(t,e,i){const r=mr(i.round)?!0:i.round,n=(o,a)=>(o=Ese(o,r||i.calendary?0:2,!0),e.loc.clone(i).relFormatter(i).format(o,a)),s=o=>i.calendary?e.hasSame(t,o)?0:e.startOf(o).diff(t.startOf(o),o).get(o):e.diff(t,o).get(o);if(i.unit)return n(s(i.unit),i.unit);for(const o of i.units){const a=s(o);if(Math.abs(a)>=1)return n(a,o)}return n(t>e?-0:0,i.units[i.units.length-1])}function Gde(t){let e={},i;return t.length>0&&typeof t[t.length-1]=="object"?(e=t[t.length-1],i=Array.from(t).slice(0,t.length-1)):i=Array.from(t),[e,i]}class $i{constructor(e){const i=e.zone||Sa.defaultZone;let r=e.invalid||(Number.isNaN(e.ts)?new vm("invalid input"):null)||(i.isValid?null:G6(i));this.ts=mr(e.ts)?Sa.now():e.ts;let n=null,s=null;if(!r)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(i))[n,s]=[e.old.c,e.old.o];else{const a=i.offset(this.ts);n=H6(this.ts,a),r=Number.isNaN(n.year)?new vm("invalid input"):null,n=r?null:n,s=r?null:a}this._zone=i,this.loc=e.loc||Ms.create(),this.invalid=r,this.weekData=null,this.localWeekData=null,this.c=n,this.o=s,this.isLuxonDateTime=!0}static now(){return new $i({})}static local(){const[e,i]=Gde(arguments),[r,n,s,o,a,c,p]=i;return Bde({year:r,month:n,day:s,hour:o,minute:a,second:c,millisecond:p},e)}static utc(){const[e,i]=Gde(arguments),[r,n,s,o,a,c,p]=i;return e.zone=Ec.utcInstance,Bde({year:r,month:n,day:s,hour:o,minute:a,second:c,millisecond:p},e)}static fromJSDate(e,i={}){const r=_Je(e)?e.valueOf():NaN;if(Number.isNaN(r))return $i.invalid("invalid input");const n=Yw(i.zone,Sa.defaultZone);return n.isValid?new $i({ts:r,zone:n,loc:Ms.fromObject(i)}):$i.invalid(G6(n))}static fromMillis(e,i={}){if(yT(e))return e<-kde||e>kde?$i.invalid("Timestamp out of range"):new $i({ts:e,zone:Yw(i.zone,Sa.defaultZone),loc:Ms.fromObject(i)});throw new Hh(`fromMillis requires a numerical input, but received a ${typeof e} with value ${e}`)}static fromSeconds(e,i={}){if(yT(e))return new $i({ts:e*1e3,zone:Yw(i.zone,Sa.defaultZone),loc:Ms.fromObject(i)});throw new Hh("fromSeconds requires a numerical input")}static fromObject(e,i={}){e=e||{};const r=Yw(i.zone,Sa.defaultZone);if(!r.isValid)return $i.invalid(G6(r));const n=Ms.fromObject(i),s=kz(e,Vde),{minDaysInFirstWeek:o,startOfWeek:a}=Ade(s,n),c=Sa.now(),p=mr(i.specificOffset)?r.offset(c):i.specificOffset,_=!mr(s.ordinal),x=!mr(s.year),S=!mr(s.month)||!mr(s.day),C=x||S,M=s.weekYear||s.weekNumber;if((C||_)&&M)throw new MM("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(S&&_)throw new MM("Can't mix ordinal dates with month/day");const P=M||s.weekday&&!C;let $,F,z=H6(c,p);P?($=BKe,F=UKe,z=Nz(z,o,a)):_?($=jKe,F=VKe,z=wH(z)):($=PAe,F=OAe);let k=!1;for(const ie of $){const he=s[ie];mr(he)?k?s[ie]=F[ie]:s[ie]=z[ie]:k=!0}const U=P?gJe(s,o,a):_?yJe(s):iAe(s),j=U||rAe(s);if(j)return $i.invalid(j);const G=P?Ede(s,o,a):_?Cde(s):s,[Y,Q]=O7(G,p,r),ne=new $i({ts:Y,zone:r,o:Q,loc:n});return s.weekday&&C&&e.weekday!==ne.weekday?$i.invalid("mismatched weekday",`you can't specify both a weekday of ${s.weekday} and a date of ${ne.toISO()}`):ne}static fromISO(e,i={}){const[r,n]=lKe(e);return q5(r,n,i,"ISO 8601",e)}static fromRFC2822(e,i={}){const[r,n]=cKe(e);return q5(r,n,i,"RFC 2822",e)}static fromHTTP(e,i={}){const[r,n]=uKe(e);return q5(r,n,i,"HTTP",i)}static fromFormat(e,i,r={}){if(mr(e)||mr(i))throw new Hh("fromFormat requires an input string and a format");const{locale:n=null,numberingSystem:s=null}=r,o=Ms.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0}),[a,c,p,_]=zKe(o,e,i);return _?$i.invalid(_):q5(a,c,r,`format ${i}`,e,p)}static fromString(e,i,r={}){return $i.fromFormat(e,i,r)}static fromSQL(e,i={}){const[r,n]=yKe(e);return q5(r,n,i,"SQL",e)}static invalid(e,i=null){if(!e)throw new Hh("need to specify a reason the DateTime is invalid");const r=e instanceof vm?e:new vm(e,i);if(Sa.throwOnInvalid)throw new qZe(r);return new $i({invalid:r})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,i={}){const r=AAe(e,Ms.fromObject(i));return r?r.map(n=>n?n.val:null).join(""):null}static expandFormat(e,i={}){return EAe(lu.parseFormat(e),Ms.fromObject(i)).map(n=>n.val).join("")}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?TH(this).weekYear:NaN}get weekNumber(){return this.isValid?TH(this).weekNumber:NaN}get weekday(){return this.isValid?TH(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?EH(this).weekday:NaN}get localWeekNumber(){return this.isValid?EH(this).weekNumber:NaN}get localWeekYear(){return this.isValid?EH(this).weekYear:NaN}get ordinal(){return this.isValid?wH(this.c).ordinal:NaN}get monthShort(){return this.isValid?uI.months("short",{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?uI.months("long",{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?uI.weekdays("short",{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?uI.weekdays("long",{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:"short",locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:"long",locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];const e=864e5,i=6e4,r=RB(this.c),n=this.zone.offset(r-e),s=this.zone.offset(r+e),o=this.zone.offset(r-n*i),a=this.zone.offset(r-s*i);if(o===a)return[this];const c=r-o*i,p=r-a*i,_=H6(c,o),x=H6(p,a);return _.hour===x.hour&&_.minute===x.minute&&_.second===x.second&&_.millisecond===x.millisecond?[Ex(this,{ts:c}),Ex(this,{ts:p})]:[this]}get isInLeapYear(){return F9(this.year)}get daysInMonth(){return Fz(this.year,this.month)}get daysInYear(){return this.isValid?cO(this.year):NaN}get weeksInWeekYear(){return this.isValid?wL(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?wL(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){const{locale:i,numberingSystem:r,calendar:n}=lu.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:i,numberingSystem:r,outputCalendar:n}}toUTC(e=0,i={}){return this.setZone(Ec.instance(e),i)}toLocal(){return this.setZone(Sa.defaultZone)}setZone(e,{keepLocalTime:i=!1,keepCalendarTime:r=!1}={}){if(e=Yw(e,Sa.defaultZone),e.equals(this.zone))return this;if(e.isValid){let n=this.ts;if(i||r){const s=e.offset(this.ts),o=this.toObject();[n]=O7(o,s,e)}return Ex(this,{ts:n,zone:e})}else return $i.invalid(G6(e))}reconfigure({locale:e,numberingSystem:i,outputCalendar:r}={}){const n=this.loc.clone({locale:e,numberingSystem:i,outputCalendar:r});return Ex(this,{loc:n})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;const i=kz(e,Vde),{minDaysInFirstWeek:r,startOfWeek:n}=Ade(i,this.loc),s=!mr(i.weekYear)||!mr(i.weekNumber)||!mr(i.weekday),o=!mr(i.ordinal),a=!mr(i.year),c=!mr(i.month)||!mr(i.day),p=a||c,_=i.weekYear||i.weekNumber;if((p||o)&&_)throw new MM("Can't mix weekYear/weekNumber units with year/month/day or ordinals");if(c&&o)throw new MM("Can't mix ordinal dates with month/day");let x;s?x=Ede({...Nz(this.c,r,n),...i},r,n):mr(i.ordinal)?(x={...this.toObject(),...i},mr(i.day)&&(x.day=Math.min(Fz(x.year,x.month),x.day))):x=Cde({...wH(this.c),...i});const[S,C]=O7(x,this.o,this.zone);return Ex(this,{ts:S,o:C})}plus(e){if(!this.isValid)return this;const i=pn.fromDurationLike(e);return Ex(this,zde(this,i))}minus(e){if(!this.isValid)return this;const i=pn.fromDurationLike(e).negate();return Ex(this,zde(this,i))}startOf(e,{useLocaleWeeks:i=!1}={}){if(!this.isValid)return this;const r={},n=pn.normalizeUnit(e);switch(n){case"years":r.month=1;case"quarters":case"months":r.day=1;case"weeks":case"days":r.hour=0;case"hours":r.minute=0;case"minutes":r.second=0;case"seconds":r.millisecond=0;break}if(n==="weeks")if(i){const s=this.loc.getStartOfWeek(),{weekday:o}=this;othis.valueOf(),a=o?this:e,c=o?e:this,p=TKe(a,c,s,n);return o?p.negate():p}diffNow(e="milliseconds",i={}){return this.diff($i.now(),e,i)}until(e){return this.isValid?Zo.fromDateTimes(this,e):this}hasSame(e,i,r){if(!this.isValid)return!1;const n=e.valueOf(),s=this.setZone(e.zone,{keepLocalTime:!0});return s.startOf(i,r)<=n&&n<=s.endOf(i,r)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(e={}){if(!this.isValid)return null;const i=e.base||$i.fromObject({},{zone:this.zone}),r=e.padding?thisi.valueOf(),Math.min)}static max(...e){if(!e.every($i.isDateTime))throw new Hh("max requires all arguments be DateTimes");return Mde(e,i=>i.valueOf(),Math.max)}static fromFormatExplain(e,i,r={}){const{locale:n=null,numberingSystem:s=null}=r,o=Ms.fromOpts({locale:n,numberingSystem:s,defaultToEN:!0});return CAe(o,e,i)}static fromStringExplain(e,i,r={}){return $i.fromFormatExplain(e,i,r)}static get DATE_SHORT(){return Dz}static get DATE_MED(){return $Ce}static get DATE_MED_WITH_WEEKDAY(){return XZe}static get DATE_FULL(){return LCe}static get DATE_HUGE(){return DCe}static get TIME_SIMPLE(){return NCe}static get TIME_WITH_SECONDS(){return FCe}static get TIME_WITH_SHORT_OFFSET(){return kCe}static get TIME_WITH_LONG_OFFSET(){return zCe}static get TIME_24_SIMPLE(){return UCe}static get TIME_24_WITH_SECONDS(){return VCe}static get TIME_24_WITH_SHORT_OFFSET(){return BCe}static get TIME_24_WITH_LONG_OFFSET(){return jCe}static get DATETIME_SHORT(){return GCe}static get DATETIME_SHORT_WITH_SECONDS(){return HCe}static get DATETIME_MED(){return qCe}static get DATETIME_MED_WITH_SECONDS(){return WCe}static get DATETIME_MED_WITH_WEEKDAY(){return ZZe}static get DATETIME_FULL(){return YCe}static get DATETIME_FULL_WITH_SECONDS(){return XCe}static get DATETIME_HUGE(){return ZCe}static get DATETIME_HUGE_WITH_SECONDS(){return JCe}}function W5(t){if($i.isDateTime(t))return t;if(t&&t.valueOf&&yT(t.valueOf()))return $i.fromJSDate(t);if(t&&typeof t=="object")return $i.fromObject(t);throw new Hh(`Unknown datetime argument: ${t}, of type ${typeof t}`)}const Yy="system",qT="unknown",Xy="UTC",HKe=Intl.DateTimeFormat().resolvedOptions().timeZone,qKe="shortOffset";function WKe(t){return"timeZoneIANA"in t}function YKe(t){return t.startsWith("UTC")}function XKe(t,e=!1){return{json:{read:{source:t,reader:(i,r)=>r[t]?P7(r[t]):null},write:!!e&&{allowNull:!0,writer(i,r){r[t]=i?ZKe(i):null}}}}}function P7(t,e=Yy){return t?WKe(t)?t.timeZoneIANA:JKe(t,e):e}function ZKe(t){return{timeZoneIANA:t}}function JKe(t,e=Yy){if(!t||!fde.has(t.timeZone))return e;const i=fde.get(t.timeZone);return YKe(t.timeZone)||t.respectsDaylightSaving?i:KKe(i)}function KKe(t){const e=$i.local().setZone(t),i=Math.min(e.set({month:1,day:1}).offset,e.set({month:5}).offset);return i===0?"Etc/UTC":`Etc/GMT${Ec.instance(-i).formatOffset(0,"narrow")}`}function QKe(t,e,i,r,n){if(e&&n==="date")return{timeZone:Xy,timeZoneName:void 0};const s=r.timeStyle||r.hour,o=i===qT;return{timeZone:o?n==="timestamp-offset"?void 0:t??Xy:i,timeZoneName:o&&s?qKe:void 0}}const eQe={year:void 0,month:void 0,day:void 0,weekday:void 0},tQe={hour:void 0,minute:void 0,second:void 0},RAe={timeZone:Xy},tg={year:"numeric",month:"numeric",day:"numeric"},Y5={year:"numeric",month:"long",day:"numeric"},X5={year:"numeric",month:"short",day:"numeric"},Z5={year:"numeric",month:"long",weekday:"long",day:"numeric"},Nw={hour:"numeric",minute:"numeric"},y3={...Nw,second:"numeric"},IAe={hourCycle:"h23"},J5={...Nw,...IAe},K5={...y3,...IAe},$Ae={"short-date":tg,"short-date-short-time":{...tg,...Nw},"short-date-short-time-24":{...tg,...J5},"short-date-long-time":{...tg,...y3},"short-date-long-time-24":{...tg,...K5},"short-date-le":tg,"short-date-le-short-time":{...tg,...Nw},"short-date-le-short-time-24":{...tg,...J5},"short-date-le-long-time":{...tg,...y3},"short-date-le-long-time-24":{...tg,...K5},"long-month-day-year":Y5,"long-month-day-year-short-time":{...Y5,...Nw},"long-month-day-year-short-time-24":{...Y5,...J5},"long-month-day-year-long-time":{...Y5,...y3},"long-month-day-year-long-time-24":{...Y5,...K5},"day-short-month-year":X5,"day-short-month-year-short-time":{...X5,...Nw},"day-short-month-year-short-time-24":{...X5,...J5},"day-short-month-year-long-time":{...X5,...y3},"day-short-month-year-long-time-24":{...X5,...K5},"long-date":Z5,"long-date-short-time":{...Z5,...Nw},"long-date-short-time-24":{...Z5,...J5},"long-date-long-time":{...Z5,...y3},"long-date-long-time-24":{...Z5,...K5},"long-month-year":{month:"long",year:"numeric"},"short-month-year":{month:"short",year:"numeric"},year:{year:"numeric"},"short-time":Nw,"long-time":y3},iQe=gu()({shortDate:"short-date",shortDateShortTime:"short-date-short-time",shortDateShortTime24:"short-date-short-time-24",shortDateLongTime:"short-date-long-time",shortDateLongTime24:"short-date-long-time-24",shortDateLE:"short-date-le",shortDateLEShortTime:"short-date-le-short-time",shortDateLEShortTime24:"short-date-le-short-time-24",shortDateLELongTime:"short-date-le-long-time",shortDateLELongTime24:"short-date-le-long-time-24",longMonthDayYear:"long-month-day-year",longMonthDayYearShortTime:"long-month-day-year-short-time",longMonthDayYearShortTime24:"long-month-day-year-short-time-24",longMonthDayYearLongTime:"long-month-day-year-long-time",longMonthDayYearLongTime24:"long-month-day-year-long-time-24",dayShortMonthYear:"day-short-month-year",dayShortMonthYearShortTime:"day-short-month-year-short-time",dayShortMonthYearShortTime24:"day-short-month-year-short-time-24",dayShortMonthYearLongTime:"day-short-month-year-long-time",dayShortMonthYearLongTime24:"day-short-month-year-long-time-24",longDate:"long-date",longDateShortTime:"long-date-short-time",longDateShortTime24:"long-date-short-time-24",longDateLongTime:"long-date-long-time",longDateLongTime24:"long-date-long-time-24",longMonthYear:"long-month-year",shortMonthYear:"short-month-year",year:"year"}),LAe={ar:"ar-u-nu-latn-ca-gregory"};let QZ=new WeakMap;const LB=$Ae["short-date-short-time"];function DAe(t){let e=QZ.get(t);if(!e){const i=ma(),r=LAe[i]||i,n=Pse(t.timeZone??Yy),s={...t,timeZone:n};e=new Intl.DateTimeFormat(r,s),QZ.set(t,e)}return e}function pA(t){return $Ae[t]}function Gs(t,e=LB){return DAe(e).format(t)}function rQe(t,e=LB){return Gs(new Date(t),{...e,...RAe,...tQe})}function nQe(t,e=LB){return Gs(new Date(`1970-01-01T${t}Z`),{...e,...RAe,...eQe})}function sQe(t,e=LB){if(e.timeZone)return Gs(new Date(t),e);const i=$i.fromISO(t,{setZone:!0}),r=ma(),n=LAe[r]??r,s=i.offset===0?Xy:e.timeZone,o={...e,timeZone:s};return i.toLocaleString(o,{locale:n})}function Pse(t){switch(t){case Yy:return HKe;case qT:return Xy;default:return t}}wse(()=>{QZ=new WeakMap});const oQe={ar:"ar-u-nu-latn"};let R7=new WeakMap,NAe={};function aQe(t){const e=t||NAe;if(!R7.has(e)){const i=ma(),r=oQe[ma()]||i;R7.set(e,new Intl.NumberFormat(r,t))}return R7.get(e)}function EJt(t={}){const e={};return t.digitSeparator!=null&&(e.useGrouping=t.digitSeparator),t.places!=null&&(e.minimumFractionDigits=e.maximumFractionDigits=t.places),e}function hd(t,e){return Object.is(t,-0)&&(t=0),aQe(e).format(t)}wse(()=>{R7=new WeakMap,NAe={}});const FAe=Ce.getLogger("esri.intl.substitute");function Zy(t,e,i={}){const{format:r={}}=i;return w9(t,n=>lQe(n,e,r))}function lQe(t,e,i){let r,n;const s=t.indexOf(":");if(s===-1?r=t.trim():(r=t.slice(0,s).trim(),n=t.slice(s+1).trim()),!r)return"";const o=b9(r,e);if(o==null)return"";const a=(n?i==null?void 0:i[n]:null)??(i==null?void 0:i[r]);return a?cQe(o,a):n?uQe(o,n):Rse(o)}function cQe(t,e){switch(e.type){case"date":return Gs(t,e.intlOptions);case"number":return hd(t,e.intlOptions);default:return FAe.warn("missing format descriptor for key {key}"),Rse(t)}}function uQe(t,e){switch(e.toLowerCase()){case"dateformat":return Gs(t);case"numberformat":return hd(t);default:return FAe.warn(`inline format is unsupported since 4.12: ${e}`),/^(dateformat|datestring)/i.test(e)?Gs(t):/^numberformat/i.test(e)?hd(t):Rse(t)}}function Rse(t){switch(typeof t){case"string":return t;case"number":return hd(t);case"boolean":return""+t;default:return t instanceof Date?Gs(t):""}}const Hde=/^([a-z]{2})(?:[-_]([A-Za-z]{2}))?$/,hQe={ar:!0,bg:!0,bs:!0,ca:!0,cs:!0,da:!0,de:!0,el:!0,en:!0,es:!0,et:!0,fi:!0,fr:!0,he:!0,hr:!0,hu:!0,id:!0,it:!0,ja:!0,ko:!0,lt:!0,lv:!0,nb:!0,nl:!0,pl:!0,"pt-BR":!0,"pt-PT":!0,ro:!0,ru:!0,sk:!0,sl:!0,sr:!0,sv:!0,th:!0,tr:!0,uk:!0,vi:!0,"zh-CN":!0,"zh-HK":!0,"zh-TW":!0};function qde(t){return t in hQe}const hI=[],hO=new Map;function Wde(t){for(const e of hO.keys())kAe(t.pattern,e)&&hO.delete(e)}function dQe(t){return hI.includes(t)||(Wde(t),hI.unshift(t)),rr(()=>{const e=hI.indexOf(t);e>-1&&(hI.splice(e,1),Wde(t))})}async function gE(t){const e=ma();hO.has(t)||hO.set(t,fQe(t,e));const i=hO.get(t);return i&&await mQe.add(i),i}function pQe(t){if(!Hde.test(t))return null;const e=Hde.exec(t);if(e===null)return null;const[,i,r]=e,n=i+(r?"-"+r.toUpperCase():"");return qde(n)?n:qde(i)?i:null}async function fQe(t,e){const i=[];for(const r of hI)if(kAe(r.pattern,t))try{return await r.fetchMessageBundle(t,e)}catch(n){i.push(n)}throw i.length?new se("intl:message-bundle-error",`Errors occurred while loading "${t}"`,{errors:i}):new se("intl:no-message-bundle-loader",`No loader found for message bundle "${t}"`)}function kAe(t,e){return typeof t=="string"?e.startsWith(t):t.test(e)}wse(()=>{hO.clear()});const mQe=new class{constructor(){this._numLoading=0,this._dfd=null}async waitForAll(){this._dfd&&await this._dfd.promise}add(t){return this._increase(),t.then(()=>this._decrease(),()=>this._decrease()),this.waitForAll()}_increase(){this._numLoading++,this._dfd||(this._dfd=ec())}_decrease(){this._numLoading=Math.max(this._numLoading-1,0),this._dfd&&this._numLoading===0&&(this._dfd.resolve(),this._dfd=null)}};async function gQe(t,e,i,r){const n=e.exec(i);if(!n)throw new se("esri-intl:invalid-bundle",`Bundle id "${i}" is not compatible with the pattern "${e}"`);const s=n[1]?`${n[1]}/`:"",o=n[2],a=pQe(r),c=`${s}${o}.json`,p=a?`${s}${o}_${a}.json`:c;let _;try{_=await Yde(t(p))}catch(x){if(p===c)throw new se("intl:unknown-bundle",`Bundle "${i}" cannot be loaded`,{error:x});try{_=await Yde(t(c))}catch(S){throw new se("intl:unknown-bundle",`Bundle "${i}" cannot be loaded`,{error:S})}}return _}async function Yde(t){if(Xde.fetchBundleAsset!=null)return Xde.fetchBundleAsset(t);const e=await yi(t,{responseType:"text"});return JSON.parse(e.data)}let yQe=class{constructor({base:e="",pattern:i,location:r=new URL(window.location.href)}){let n;n=typeof r=="string"?s=>new URL(s,new URL(r,window.location.href)).href:r instanceof URL?s=>new URL(s,r).href:r,this.pattern=typeof i=="string"?new RegExp(`^${i}`):i,this.getAssetUrl=n,e=e?e.endsWith("/")?e:e+"/":"",this.matcher=new RegExp(`^${e}(?:(.*)/)?(.*)$`)}fetchMessageBundle(e,i){return gQe(this.getAssetUrl,this.matcher,e,i)}};function vQe(t){return new yQe(t)}const Xde={};dQe(vQe({pattern:"esri/",location:Wr}));const _Qe="yyyy-MM-dd",bQe="TT";var a$;(function(t){t.HM="HH:mm",t.HMS="HH:mm:ss",t.HMS_MS="HH:mm:ss.SSS"})(a$||(a$={}));const wQe=[a$.HMS_MS,a$.HMS,a$.HM,bQe];function Zde(t){return $i.fromFormat(t,_Qe)}function Jde(t){let e=null;return wQe.find(i=>(e=$i.fromFormat(t,i),e.isValid)),e}function Kde(t){return $i.fromISO(t)}var nP;(function(t){t.VALUE_OUT_OF_RANGE="domain-validation-error::value-out-of-range",t.INVALID_CODED_VALUE="domain-validation-error::invalid-coded-value"})(nP||(nP={}));const xQe=new Set(["integer","small-integer","big-integer","esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeBigInteger"]);function SQe(t){return t!=null&&xQe.has(t.type)}function zAe(t){return t!=null&&(t.type==="date-only"||t.type==="esriFieldTypeDateOnly")}function UAe(t){return t!=null&&(t.type==="timestamp-offset"||t.type==="esriFieldTypeTimestampOffset")}function VAe(t){return t!=null&&(t.type==="time-only"||t.type==="esriFieldTypeTimeOnly")}function TQe(t,e){const i=t==null?void 0:t.domain;if(!i)return null;switch(i.type){case"range":{const{min:r,max:n}=BAe(t);if(r!=null&&+en)return nP.VALUE_OUT_OF_RANGE;break}case"coded-value":case"codedValue":if(i.codedValues==null||i.codedValues.every(r=>r==null||r.code!==e))return nP.INVALID_CODED_VALUE}return null}function BAe(t,e){const i=e??(t==null?void 0:t.domain);if(!i||i.type!=="range")return;const r="range"in i?i.range[0]:i.minValue,n="range"in i?i.range[1]:i.maxValue,s=SQe(t);return zAe(t)||VAe(t)||UAe(t)?{...EQe(t,n,r),isInteger:s}:{min:r!=null&&typeof r=="number"?r:null,max:n!=null&&typeof n=="number"?n:null,rawMin:r,rawMax:n,isInteger:s}}function EQe(t,e,i){return zAe(t)?{min:i!=null&&kE(i)?Zde(i).toMillis():null,max:e!=null&&kE(e)?Zde(e).toMillis():null,rawMin:i,rawMax:e}:VAe(t)?{min:i!=null&&kE(i)?Jde(i).toMillis():null,max:e!=null&&kE(e)?Jde(e).toMillis():null,rawMin:i,rawMax:e}:UAe(t)?{min:i!=null&&kE(i)?Kde(i).toMillis():null,max:e!=null&&kE(e)?Kde(e).toMillis():null,rawMin:i,rawMax:e}:{max:null,min:null}}const CQe=Ce.getLogger("esri.support.arcadeOnDemand");let AH;function b_(){return AH||(AH=(async()=>{const t=await we(()=>import("./arcadeUtils-vGyJZHQt.js").then(e=>e.aD),__vite__mapDeps([6,5,7]));return{arcade:t.arcade,arcadeUtils:t,Dictionary:t.Dictionary,Feature:t.arcadeFeature}})()),AH}const AQe=(t,e,i)=>Ise.create(t,e,i,null,["$feature","$view"],[]),MQe=(t,e,i)=>Ise.create(t,e,i,null,["$feature","$view"],[]),OQe=(t,e,i,r)=>Ise.create(t,e,i,r,["$feature","$view"],[]);let Ise=class jAe{constructor(e,i,r,n,s,o,a){this.services=null,this.script=e,this.evaluate=n;const c=Array.isArray(o)?o:o.fields;this.fields=c,this._syntaxTree=r,this._arcade=i,this._arcadeFeature=s,this._spatialReference=a,this._referencesGeometry=i.scriptTouchesGeometry(this._syntaxTree),this._referencesScale=this._arcade.referencesMember(this._syntaxTree,"scale")}static async create(e,i,r,n,s,o){const{arcade:a,Feature:c,Dictionary:p}=await b_(),_=rt.fromJSON(i);let x;try{x=a.parseScript(e,o)}catch(Q){return CQe.error(new se("arcade-bad-expression","Failed to parse arcade script",{script:e,error:Q})),null}const S=s.reduce((Q,ne)=>({...Q,[ne]:null}),{});let C=null;n!=null&&(C=new p(n),C.immutable=!0,S.$config=null);const M=a.scriptUsesGeometryEngine(x),P=M&&a.enableGeometrySupport(),$=a.scriptUsesFeatureSet(x)&&a.enableFeatureSetSupport(),F=a.scriptIsAsync(x),z=F&&a.enableAsyncSupport(),k={vars:S,spatialReference:_,useAsync:!!z};await Promise.all([P,$,z]);const U=new Set;await a.loadDependentModules(U,x,null,F,M);const j=new p;j.immutable=!1,j.setField("scale",0);const G=a.compileScript(x,k),Y=(Q,ne)=>{var he;const ie=(he=Q.$view)==null?void 0:he.timeZone;return"$view"in Q&&Q.$view&&(j.setField("scale",typeof Q.$view=="object"&&"scale"in Q.$view?Q.$view.scale:void 0),Q.$view=j),C&&(Q.$config=C),G({vars:Q,spatialReference:_,services:ne,timeZone:ie})};return new jAe(e,a,x,Y,new c,r,_)}repurposeFeature(e){return e.geometry&&!e.geometry.spatialReference&&(e.geometry.spatialReference=this._spatialReference),this._arcadeFeature.repurposeFromGraphicLikeObject(e.geometry,e.attributes,{fields:this.fields}),this._arcadeFeature}referencesGeometry(){return this._referencesGeometry}referencesScale(){return this._referencesScale}};const PQe=/^([0-9_])/,RQe=/[^a-z0-9_\u0080-\uffff]+/gi;function IQe(t){return t==null?null:t.trim().replaceAll(RQe,"_").replace(PQe,"F$1")||null}const $Qe=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],LQe=["field","normalizationField"];function Qde(t,e){if(t!=null&&e!=null){for(const i of Array.isArray(t)?t:[t])if(epe($Qe,i,e),"visualVariables"in i&&i.visualVariables)for(const r of i.visualVariables)epe(LQe,r,e)}}function epe(t,e,i){if(t)for(const r of t){const n=b9(r,e),s=n&&typeof n!="function"&&i.get(n);s&&hE(r,s.name,e)}}function DQe(t,e){var i;if(t!=null&&((i=e==null?void 0:e.fields)!=null&&i.length))if("startField"in t){const r=e.get(t.startField),n=e.get(t.endField);t.startField=(r==null?void 0:r.name)??null,t.endField=(n==null?void 0:n.name)??null}else{const r=e.get(t.startTimeField),n=e.get(t.endTimeField);t.startTimeField=(r==null?void 0:r.name)??null,t.endTimeField=(n==null?void 0:n.name)??null}}const MH=new Set;function DB(t,e){return t&&e?(MH.clear(),xL(MH,t,e),Array.from(MH).sort()):[]}function xL(t,e,i){var r;if(i)if((r=e==null?void 0:e.fields)!=null&&r.length)if(i.includes("*"))for(const{name:n}of e.fields)t.add(n);else for(const n of i)vp(t,e,n);else{if(i.includes("*"))return t.clear(),void t.add("*");for(const n of i)n!=null&&t.add(n)}}function vp(t,e,i){if(typeof i=="string")if(e){const r=e.get(i);r&&t.add(r.name)}else t.add(i)}function NQe(t,e){return e==null||t==null?[]:e.includes("*")?(t.fields??[]).map(i=>i.name):e}async function th(t,e,i){var s;if(!i)return;const{arcadeUtils:r}=await b_(),n=r.extractFieldNames(i,(s=e==null?void 0:e.fields)==null?void 0:s.map(o=>o.name));for(const o of n)vp(t,e,o)}async function GAe(t,e,i){if(i&&i!=="1=1"){const r=await _se(i,e);if(!r.isStandardized)throw new se("fieldUtils:collectFilterFields","Where clause is not standardized",{where:i});xL(t,e,r.fieldNames)}}function FQe({displayField:t,fields:e}){return t||(e!=null&&e.length?OH(e,"name-or-title")||OH(e,"unique-identifier")||OH(e,"type-or-category")||kQe(e):null)}function kQe(t){for(const e of t){if(!(e!=null&&e.name))continue;const i=e.name.toLowerCase();if(i.includes("name")||i.includes("title"))return e.name}return null}function OH(t,e){for(const i of t)if(i!=null&&i.valueType&&i.valueType===e)return i.name;return null}async function AJt(t,e){var r;if(!e)return;const i=(r=e.elevationInfo)==null?void 0:r.featureExpressionInfo;return i?i.collectRequiredFields(t,e.fieldsIndex):void 0}function zQe(t,e,i){i.onStatisticExpression?th(t,e,i.onStatisticExpression.expression):t.add(i.onStatisticField)}async function MJt(t,e,i){if(!e||!i||!("fields"in i))return;const r=[],n=i.popupTemplate;r.push(UQe(t,e,n)),i.fields&&r.push(...i.fields.map(async s=>zQe(t,e.fieldsIndex,s))),await Promise.all(r)}async function UQe(t,e,i){const r=[];i!=null&&i.expressionInfos&&r.push(...i.expressionInfos.map(s=>th(t,e.fieldsIndex,s.expression)));const n=i==null?void 0:i.content;if(Array.isArray(n))for(const s of n)s.type==="expression"&&s.expressionInfo&&r.push(th(t,e.fieldsIndex,s.expressionInfo.expression));await Promise.all(r)}async function OJt(t,e,i){e&&(e.timeInfo&&(i!=null&&i.timeExtent)&&xL(t,e.fieldsIndex,[e.timeInfo.startField,e.timeInfo.endField]),e.floorInfo&&xL(t,e.fieldsIndex,[e.floorInfo.floorField]),(i==null?void 0:i.where)!=null&&await GAe(t,e.fieldsIndex,i.where))}async function PJt(t,e,i){e&&i&&await Promise.all(i.map(r=>VQe(t,e,r)))}async function VQe(t,e,i){e&&i&&(i.valueExpression?await th(t,e.fieldsIndex,i.valueExpression):i.field&&vp(t,e.fieldsIndex,i.field))}function BQe(t){return t?DB(t.fieldsIndex,HAe(t)):[]}function jQe(t){if(!t)return[];const e=t.geometryFieldsInfo;return e?DB(t.fieldsIndex,[e.shapeAreaField,e.shapeLengthField]):[]}const GQe=new Set(["oid","global-id","guid"]),HQe=new Set(["oid","global-id"]),qQe=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/shape/i,/perimeter/i,/objectid/i,/_i$/i];function WQe(t){const e=new Set;qAe(t).forEach(r=>e.add(r)),jQe(t).forEach(r=>e.add(r.toLowerCase()));const i=t&&"infoFor3D"in t?t.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach(r=>e.add(r.toLowerCase())),Object.values(i.transformFieldRoles).forEach(r=>e.add(r.toLowerCase()))),Array.from(e)}function HAe(t){if(!t)return[];const e="editFieldsInfo"in t&&t.editFieldsInfo;if(!e)return[];const{creationDateField:i,creatorField:r,editDateField:n,editorField:s}=e;return[i,r,n,s].filter(Boolean)}function qAe(t){return HAe(t).map(e=>e.toLowerCase())}function YQe(t,e){var i;return t.editable&&!GQe.has(t.type)&&!qAe(e).includes(((i=t.name)==null?void 0:i.toLowerCase())??"")}function XQe(t,e){var r;const i=((r=t.name)==null?void 0:r.toLowerCase())??"";return!((e==null?void 0:e.objectIdField)!=null&&i===e.objectIdField.toLowerCase()||(e==null?void 0:e.globalIdField)!=null&&i===e.globalIdField.toLowerCase()||WQe(e).includes(i)||HQe.has(t.type)||qQe.some(n=>n.test(i)))}async function RJt(t,e){const{labelingInfo:i,fieldsIndex:r}=e;i!=null&&i.length&&await Promise.all(i.map(n=>ZQe(t,r,n)))}async function ZQe(t,e,i){if(!i)return;const r=i.getLabelExpression(),n=i.where;if(r.type==="arcade")await th(t,e,r.expression);else{const s=r.expression.match(/{[^}]*}/g);s&&s.forEach(o=>{vp(t,e,o.slice(1,-1))})}await GAe(t,e,n)}function JQe(t){const e=t.defaultValue;return e!==void 0&&XAe(t,e)?e:t.nullable?null:void 0}function IJt(t){const e=typeof t=="string"?{type:t}:t;return uet(e)?255:e.type==="esriFieldTypeDate"||e.type==="date"?8:void 0}function WAe(t){return typeof t=="number"&&!isNaN(t)&&isFinite(t)}function KQe(t){return t===null||WAe(t)}function QQe(t){return t===null||Number.isInteger(t)}function YAe(t){return t!=null&&typeof t=="string"}function eet(t){return t===null||YAe(t)}function tet(){return!0}function XAe(t,e){let i;switch(t.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=t.nullable?QQe:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=t.nullable?KQe:WAe;break;case"string":case"esriFieldTypeString":i=t.nullable?eet:YAe;break;default:i=tet}return arguments.length===1?i:i(e)}const iet=["integer","small-integer","big-integer"],ret=["single","double"],net=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeBigInteger"],set=["esriFieldTypeSingle","esriFieldTypeDouble"],oet=new Set([...iet,...net]),aet=new Set([...ret,...set]),cet=JSe(oet,aet);function $se(t){return t!=null&&cet.has(t.type)}function uet(t){return t!=null&&(t.type==="string"||t.type==="esriFieldTypeString")}function Lse(t){return t!=null&&(t.type==="date"||t.type==="esriFieldTypeDate")}function het(t){return t!=null&&(t.type==="date-only"||t.type==="esriFieldTypeDateOnly")}function det(t){return t!=null&&(t.type==="timestamp-offset"||t.type==="esriFieldTypeTimestampOffset")}function ZAe(t){return t!=null&&(t.type==="time-only"||t.type==="esriFieldTypeTimeOnly")}function tpe(t){return t!=null&&(t.type==="oid"||t.type==="esriFieldTypeOID")}function ipe(t){return t!=null&&(t.type==="global-id"||t.type==="esriFieldTypeGlobalID")}function $Jt(t,e){return pet(t,e)===null}var zz,Uz;function LJt(t){return t==null||typeof t=="number"&&isNaN(t)?null:t}function pet(t,e){return t==null||t.nullable&&e===null?null:$se(t)&&!fet(t.type,Number(e))?zz.OUT_OF_RANGE:XAe(t,e)?t.domain?TQe(t,e):null:Uz.INVALID_TYPE}function fet(t,e){const i=typeof t=="string"?JAe(t):t;if(!i)return!1;const r=i.min,n=i.max;return i.isInteger?Number.isInteger(e)&&e>=r&&e<=n:e>=r&&e<=n}function JAe(t){switch(t){case"esriFieldTypeSmallInteger":case"small-integer":return met;case"esriFieldTypeInteger":case"integer":return get;case"esriFieldTypeBigInteger":case"big-integer":return yet;case"esriFieldTypeSingle":case"single":return vet;case"esriFieldTypeDouble":case"double":return _et}}(function(t){t.OUT_OF_RANGE="numeric-range-validation-error::out-of-range"})(zz||(zz={})),function(t){t.INVALID_TYPE="type-validation-error::invalid-type"}(Uz||(Uz={}));const met={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},get={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},yet={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},vet={min:-34e37,max:12e37,isInteger:!1,rawMin:-34e37,rawMax:12e37},_et={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function DJt(t,e,i){switch(t){case nP.INVALID_CODED_VALUE:return`Value ${i} is not in the coded domain - field: ${e.name}, domain: ${JSON.stringify(e.domain)}`;case nP.VALUE_OUT_OF_RANGE:return`Value ${i} is out of the range of valid values - field: ${e.name}, domain: ${JSON.stringify(e.domain)}`;case Uz.INVALID_TYPE:return`Value ${i} is not a valid value for the field type - field: ${e.name}, type: ${e.type}, nullable: ${e.nullable}`;case zz.OUT_OF_RANGE:{const{min:r,max:n}=JAe(e.type);return`Value ${i} is out of range for the number type - field: ${e.name}, type: ${e.type}, value range is ${r} to ${n}`}}}function NJt(t,e){return!bet(t,e,null)}function bet(t,e,i){if(!(e!=null&&e.attributes)||!t){if(i!=null)for(const s of t??[])i.add(s);return!0}const r=new Set(Object.keys(e.attributes));let n=!1;for(const s of t)if(!r.has(s)){if(n=!0,i==null)break;i.add(s)}return n}function wet(t){return!!t&&["raster.itempixelvalue","raster.servicepixelvalue"].some(e=>t.toLowerCase().startsWith(e))}let I7=class extends Ue{constructor(e){super(e),this.type=null}};y([w({type:["attachments","custom","fields","media","text","expression","relationship"],readOnly:!0,json:{read:!1,write:!0}})],I7.prototype,"type",void 0),I7=y([Z("esri.popup.content.Content")],I7);const lx=I7;var eJ;let v3=eJ=class extends lx{constructor(t){super(t),this.description=null,this.displayType="auto",this.title=null,this.type="attachments"}clone(){return new eJ({description:this.description,displayType:this.displayType,title:this.title})}};y([w({type:String,json:{write:!0}})],v3.prototype,"description",void 0),y([w({type:["auto","preview","list"],json:{write:!0}})],v3.prototype,"displayType",void 0),y([w({type:String,json:{write:!0}})],v3.prototype,"title",void 0),y([w({type:["attachments"],readOnly:!0,json:{read:!1,write:!0}})],v3.prototype,"type",void 0),v3=eJ=y([Z("esri.popup.content.AttachmentsContent")],v3);const SL=v3;var tJ;let _3=tJ=class extends lx{constructor(t){super(t),this.creator=null,this.destroyer=null,this.outFields=null,this.type="custom"}clone(){return new tJ({creator:this.creator,destroyer:this.destroyer,outFields:Array.isArray(this.outFields)?Pe(this.outFields):null})}};y([w()],_3.prototype,"creator",void 0),y([w()],_3.prototype,"destroyer",void 0),y([w()],_3.prototype,"outFields",void 0),y([w({type:["custom"],readOnly:!0})],_3.prototype,"type",void 0),_3=tJ=y([Z("esri.popup.content.CustomContent")],_3);const xet=_3;var iJ;let fA=iJ=class extends Ue{constructor(t){super(t),this.title=null,this.expression=null,this.returnType="dictionary"}clone(){return new iJ({title:this.title,expression:this.expression})}};y([w({type:String,json:{write:!0}})],fA.prototype,"title",void 0),y([w({type:String,json:{write:!0}})],fA.prototype,"expression",void 0),y([w({type:["dictionary"],readOnly:!0,json:{read:!1,write:!0}})],fA.prototype,"returnType",void 0),fA=iJ=y([Z("esri.popup.ElementExpressionInfo")],fA);const Tet=fA;var rJ;let dI=rJ=class extends lx{constructor(t){super(t),this.expressionInfo=null,this.type="expression"}clone(){var t;return new rJ({expressionInfo:(t=this.expressionInfo)==null?void 0:t.clone()})}};y([w({type:Tet,json:{write:!0}})],dI.prototype,"expressionInfo",void 0),y([w({type:["expression"],readOnly:!0,json:{read:!1,write:!0}})],dI.prototype,"type",void 0),dI=rJ=y([Z("esri.popup.content.ExpressionContent")],dI);const Dse=dI;function Vt(t,e={}){const i=t instanceof tn?t:new tn(t,e),r={type:(e==null?void 0:e.ignoreUnknown)??1?i.apiValues:String,json:{type:i.jsonValues,read:!(e!=null&&e.readOnly)&&{reader:i.read},write:{writer:i.write}}};return(e==null?void 0:e.readOnly)!==void 0&&(r.readOnly=!!e.readOnly),(e==null?void 0:e.default)!==void 0&&(r.json.default=e.default),(e==null?void 0:e.name)!==void 0&&(r.json.name=e.name),(e==null?void 0:e.nonNullable)!==void 0&&(r.nonNullable=e.nonNullable),w(r)}let mA=class extends Xs(Ue){constructor(e){super(e),this.dateFormat=null,this.digitSeparator=!1,this.places=null}};y([Vt(iQe)],mA.prototype,"dateFormat",void 0),y([w({type:Boolean,json:{write:!0}})],mA.prototype,"digitSeparator",void 0),y([w({type:_n,json:{write:!0}})],mA.prototype,"places",void 0),mA=y([Z("esri.popup.support.FieldInfoFormat")],mA);const $7=mA;var nJ;let O0=nJ=class extends Ue{constructor(t){super(t),this.fieldName=null,this.format=null,this.isEditable=!0,this.label=null,this.stringFieldOption="text-box",this.statisticType=null,this.tooltip=null,this.visible=!0}clone(){return new nJ({fieldName:this.fieldName,format:this.format?Pe(this.format):null,isEditable:this.isEditable,label:this.label,stringFieldOption:this.stringFieldOption,statisticType:this.statisticType,tooltip:this.tooltip,visible:this.visible})}};y([w({type:String,json:{write:!0}})],O0.prototype,"fieldName",void 0),y([w({type:$7,json:{write:!0}})],O0.prototype,"format",void 0),y([w({type:Boolean,json:{write:{alwaysWriteDefaults:!0},default:!0}})],O0.prototype,"isEditable",void 0),y([w({type:String,json:{write:!0}})],O0.prototype,"label",void 0),y([Vt(new tn({richtext:"rich-text",textarea:"text-area",textbox:"text-box"}),{default:"text-box"})],O0.prototype,"stringFieldOption",void 0),y([w({type:["count","sum","min","max","avg","stddev","var"],json:{write:!0}})],O0.prototype,"statisticType",void 0),y([w({type:String,json:{write:!0}})],O0.prototype,"tooltip",void 0),y([w({type:Boolean,json:{write:!0}})],O0.prototype,"visible",void 0),O0=nJ=y([Z("esri.popup.FieldInfo")],O0);const Nse=O0;var sJ;let W1=sJ=class extends lx{constructor(t){super(t),this.attributes=null,this.description=null,this.fieldInfos=null,this.title=null,this.type="fields"}writeFieldInfos(t,e){e.fieldInfos=t&&t.map(i=>i.toJSON())}clone(){return new sJ(Pe({attributes:this.attributes,description:this.description,fieldInfos:this.fieldInfos,title:this.title}))}};y([w({type:Object,json:{write:!0}})],W1.prototype,"attributes",void 0),y([w({type:String,json:{write:!0}})],W1.prototype,"description",void 0),y([w({type:[Nse]})],W1.prototype,"fieldInfos",void 0),y([Et("fieldInfos")],W1.prototype,"writeFieldInfos",null),y([w({type:String,json:{write:!0}})],W1.prototype,"title",void 0),y([w({type:["fields"],readOnly:!0,json:{read:!1,write:!0}})],W1.prototype,"type",void 0),W1=sJ=y([Z("esri.popup.content.FieldsContent")],W1);const TL=W1;let b3=class extends Ue{constructor(e){super(e),this.altText=null,this.caption="",this.title="",this.type=null}};y([w({type:String,json:{write:!0}})],b3.prototype,"altText",void 0),y([w({type:String,json:{write:!0}})],b3.prototype,"caption",void 0),y([w({type:String,json:{write:!0}})],b3.prototype,"title",void 0),y([w({type:["image","bar-chart","column-chart","line-chart","pie-chart"],readOnly:!0,json:{read:!1,write:!0}})],b3.prototype,"type",void 0),b3=y([Z("esri.popup.content.mixins.MediaInfo")],b3);const Fse=b3;function W6(t){return Je(_ne(t),0,255)}function Y6(t,e,i){return t=Number(t),isNaN(t)?i:ti?i:t}function X6(t,e){const i=t.toString(16).padStart(2,"0");return e?i.substring(0,1):i}let L7=class pl{static blendColors(e,i,r,n=new pl){return n.r=Math.round(e.r+(i.r-e.r)*r),n.g=Math.round(e.g+(i.g-e.g)*r),n.b=Math.round(e.b+(i.b-e.b)*r),n.a=e.a+(i.a-e.a)*r,n._sanitize()}static fromRgb(e,i){const r=e.toLowerCase().match(/^(rgba?|hsla?)\(([\s\.\-,%0-9]+)\)/);if(r){const n=r[2].split(/\s*,\s*/),s=r[1];if(s==="rgb"&&n.length===3||s==="rgba"&&n.length===4){const o=n[0];if(o.charAt(o.length-1)==="%"){const a=n.map(c=>2.56*parseFloat(c));return n.length===4&&(a[3]=parseFloat(n[3])),pl.fromArray(a,i)}return pl.fromArray(n.map(a=>parseFloat(a)),i)}if(s==="hsl"&&n.length===3||s==="hsla"&&n.length===4)return pl.fromArray(oCe(parseFloat(n[0]),parseFloat(n[1])/100,parseFloat(n[2])/100,parseFloat(n[3])),i)}return null}static fromHex(e,i=new pl){if(e[0]!=="#"||isNaN(+`0x${e.substring(1)}`))return null;switch(e.length){case 4:case 5:{const r=parseInt(e.substring(1,2),16),n=parseInt(e.substring(2,3),16),s=parseInt(e.substring(3,4),16),o=e.length===5?15:parseInt(e.substring(4),16);return pl.fromArray([r+16*r,n+16*n,s+16*s,(o+16*o)/255],i)}case 7:case 9:{const r=parseInt(e.substring(1,3),16),n=parseInt(e.substring(3,5),16),s=parseInt(e.substring(5,7),16),o=e.length===7?255:parseInt(e.substring(7),16);return pl.fromArray([r,n,s,o/255],i)}default:return null}}static fromArray(e,i=new pl){return i._set(Number(e[0]),Number(e[1]),Number(e[2]),Number(e[3])),isNaN(i.a)&&(i.a=1),i._sanitize()}static fromString(e,i){const r=sCe(e)?use(e):null;return r&&pl.fromArray(r,i)||pl.fromRgb(e,i)||pl.fromHex(e,i)}static fromJSON(e){return e!=null?new pl([e[0],e[1],e[2],(e[3]??255)/255]):void 0}static toUnitRGB(e){return e!=null?[e.r/255,e.g/255,e.b/255]:null}static toUnitRGBA(e){return e!=null?[e.r/255,e.g/255,e.b/255,e.a!=null?e.a:1]:null}constructor(e){this.r=255,this.g=255,this.b=255,this.a=1,e&&this.setColor(e)}get isBright(){return .299*this.r+.587*this.g+.114*this.b>=127}setColor(e){return typeof e=="string"?pl.fromString(e,this):Array.isArray(e)?pl.fromArray(e,this):(this._set(e.r??0,e.g??0,e.b??0,e.a??1),e instanceof pl||this._sanitize()),this}toRgb(){return[this.r,this.g,this.b]}toRgba(){return[this.r,this.g,this.b,this.a]}toHex(e){const i=(e==null?void 0:e.capitalize)??!1,r=(e==null?void 0:e.digits)??6,n=r===3||r===4,s=r===4||r===8,o=`#${X6(this.r,n)}${X6(this.g,n)}${X6(this.b,n)}${s?X6(Math.round(255*this.a),n):""}`;return i?o.toUpperCase():o}toCss(e=!1){const i=this.r+", "+this.g+", "+this.b;return e?`rgba(${i}, ${this.a})`:`rgb(${i})`}toString(){return this.toCss(!0)}toJSON(){return this.toArray()}toArray(e=pl.AlphaMode.ALWAYS){const i=W6(this.r),r=W6(this.g),n=W6(this.b);return e===pl.AlphaMode.ALWAYS||this.a!==1?[i,r,n,W6(255*this.a)]:[i,r,n]}clone(){return new pl(this.toRgba())}hash(){return this.r<<24|this.g<<16|this.b<<8|255*this.a}equals(e){return e!=null&&e.r===this.r&&e.g===this.g&&e.b===this.b&&e.a===this.a}_sanitize(){return this.r=Math.round(Y6(this.r,0,255)),this.g=Math.round(Y6(this.g,0,255)),this.b=Math.round(Y6(this.b,0,255)),this.a=Y6(this.a,0,1),this}_set(e,i,r,n){this.r=e,this.g=i,this.b=r,this.a=n}};L7.prototype.declaredClass="esri.Color",function(t){var e;(e=t.AlphaMode||(t.AlphaMode={}))[e.ALWAYS=0]="ALWAYS",e[e.UNLESS_OPAQUE=1]="UNLESS_OPAQUE"}(L7||(L7={}));const qe=L7;var oJ;let w3=oJ=class extends ze{constructor(t){super(t),this.color=null,this.fieldName=null,this.tooltip=null,this.value=null}clone(){return new oJ({fieldName:this.fieldName,tooltip:this.tooltip,value:this.value})}};y([w()],w3.prototype,"color",void 0),y([w()],w3.prototype,"fieldName",void 0),y([w()],w3.prototype,"tooltip",void 0),y([w()],w3.prototype,"value",void 0),w3=oJ=y([Z("esri.popup.content.support.ChartMediaInfoValueSeries")],w3);const Eet=w3;var aJ;let qb=aJ=class extends Ue{constructor(t){super(t),this.colors=null,this.fields=[],this.normalizeField=null,this.series=[],this.tooltipField=null}clone(){return new aJ({colors:Pe(this.colors),fields:Pe(this.fields),normalizeField:this.normalizeField,tooltipField:this.tooltipField})}};y([w({type:[qe],json:{type:[[_n]],write:!0}})],qb.prototype,"colors",void 0),y([w({type:[String],json:{write:!0}})],qb.prototype,"fields",void 0),y([w({type:String,json:{write:!0}})],qb.prototype,"normalizeField",void 0),y([w({type:[Eet],json:{read:!1}})],qb.prototype,"series",void 0),y([w({type:String,json:{write:!0}})],qb.prototype,"tooltipField",void 0),qb=aJ=y([Z("esri.popup.content.support.ChartMediaInfoValue")],qb);const Cet=qb;let pI=class extends Fse{constructor(e){super(e),this.type=null,this.value=null}};y([w({type:["bar-chart","column-chart","line-chart","pie-chart"],readOnly:!0,json:{read:!1,write:!0}})],pI.prototype,"type",void 0),y([w({type:Cet,json:{write:!0}})],pI.prototype,"value",void 0),pI=y([Z("esri.popup.content.mixins.ChartMediaInfo")],pI);const NB=pI,FB=gu()({barchart:"bar-chart",columnchart:"column-chart",linechart:"line-chart",piechart:"pie-chart"});var lJ;let D7=lJ=class extends NB{constructor(t){super(t),this.type="bar-chart"}clone(){return new lJ({altText:this.altText,title:this.title,caption:this.caption,value:this.value?this.value.clone():null})}};y([w({type:["bar-chart"],readOnly:!0,json:{type:["barchart"],read:!1,write:FB.write}})],D7.prototype,"type",void 0),D7=lJ=y([Z("esri.popup.content.BarChartMediaInfo")],D7);const KAe=D7;var cJ;let N7=cJ=class extends NB{constructor(t){super(t),this.type="column-chart"}clone(){return new cJ({altText:this.altText,title:this.title,caption:this.caption,value:this.value?this.value.clone():null})}};y([w({type:["column-chart"],readOnly:!0,json:{type:["columnchart"],read:!1,write:FB.write}})],N7.prototype,"type",void 0),N7=cJ=y([Z("esri.popup.content.ColumnChartMediaInfo")],N7);const QAe=N7;var uJ;let fI=uJ=class extends Ue{constructor(t){super(t),this.linkURL=null,this.sourceURL=null}clone(){return new uJ({linkURL:this.linkURL,sourceURL:this.sourceURL})}};y([w({type:String,json:{write:!0}})],fI.prototype,"linkURL",void 0),y([w({type:String,json:{write:!0}})],fI.prototype,"sourceURL",void 0),fI=uJ=y([Z("esri.popup.content.support.ImageMediaInfoValue")],fI);const Aet=fI;var hJ;let gA=hJ=class extends Fse{constructor(t){super(t),this.refreshInterval=null,this.type="image",this.value=null}clone(){return new hJ({altText:this.altText,title:this.title,caption:this.caption,refreshInterval:this.refreshInterval,value:this.value?this.value.clone():null})}};y([w({type:Number,json:{write:!0}})],gA.prototype,"refreshInterval",void 0),y([w({type:["image"],readOnly:!0,json:{read:!1,write:!0}})],gA.prototype,"type",void 0),y([w({type:Aet,json:{write:!0}})],gA.prototype,"value",void 0),gA=hJ=y([Z("esri.popup.content.ImageMediaInfo")],gA);const eMe=gA;var dJ;let F7=dJ=class extends NB{constructor(t){super(t),this.type="line-chart"}clone(){return new dJ({altText:this.altText,title:this.title,caption:this.caption,value:this.value?this.value.clone():null})}};y([w({type:["line-chart"],readOnly:!0,json:{type:["linechart"],read:!1,write:FB.write}})],F7.prototype,"type",void 0),F7=dJ=y([Z("esri.popup.content.LineChartMediaInfo")],F7);const tMe=F7;var pJ;let k7=pJ=class extends NB{constructor(t){super(t),this.type="pie-chart"}clone(){return new pJ({altText:this.altText,title:this.title,caption:this.caption,value:this.value?this.value.clone():null})}};y([w({type:["pie-chart"],readOnly:!0,json:{type:["piechart"],read:!1,write:FB.write}})],k7.prototype,"type",void 0),k7=pJ=y([Z("esri.popup.content.PieChartMediaInfo")],k7);const iMe=k7,rMe={base:Fse,key:"type",defaultKeyValue:"image",typeMap:{"bar-chart":KAe,"column-chart":QAe,"line-chart":tMe,"pie-chart":iMe,image:eMe}};var fJ;let P0=fJ=class extends lx{constructor(t){super(t),this.activeMediaInfoIndex=null,this.attributes=null,this.description=null,this.mediaInfos=null,this.title=null,this.type="media"}readMediaInfos(t){return t&&t.map(e=>e.type==="image"?eMe.fromJSON(e):e.type==="barchart"?KAe.fromJSON(e):e.type==="columnchart"?QAe.fromJSON(e):e.type==="linechart"?tMe.fromJSON(e):e.type==="piechart"?iMe.fromJSON(e):void 0).filter(Boolean)}writeMediaInfos(t,e){e.mediaInfos=t&&t.map(i=>i.toJSON())}clone(){return new fJ(Pe({activeMediaInfoIndex:this.activeMediaInfoIndex,attributes:this.attributes,description:this.description,mediaInfos:this.mediaInfos,title:this.title}))}};y([w()],P0.prototype,"activeMediaInfoIndex",void 0),y([w({type:Object,json:{write:!0}})],P0.prototype,"attributes",void 0),y([w({type:String,json:{write:!0}})],P0.prototype,"description",void 0),y([w({types:[rMe]})],P0.prototype,"mediaInfos",void 0),y([Rt("mediaInfos")],P0.prototype,"readMediaInfos",null),y([Et("mediaInfos")],P0.prototype,"writeMediaInfos",null),y([w({type:String,json:{write:!0}})],P0.prototype,"title",void 0),y([w({type:["media"],readOnly:!0,json:{read:!1,write:!0}})],P0.prototype,"type",void 0),P0=fJ=y([Z("esri.popup.content.MediaContent")],P0);const Vz=P0;var mJ;let mI=mJ=class extends Ue{constructor(t){super(t),this.field=null,this.order=null}clone(){return new mJ({field:this.field,order:this.order})}};y([w({type:String,json:{write:!0}})],mI.prototype,"field",void 0),y([w({type:["asc","desc"],json:{write:!0}})],mI.prototype,"order",void 0),mI=mJ=y([Z("esri.popup.support.RelatedRecordsInfoFieldOrder")],mI);const nMe=mI;let Eg=class extends Xs(lx){constructor(e){super(e),this.description=null,this.displayCount=null,this.displayType="list",this.orderByFields=null,this.relationshipId=null,this.title=null,this.type="relationship"}};y([w({type:String,json:{write:!0}})],Eg.prototype,"description",void 0),y([w({type:Number,json:{type:_n,write:!0}})],Eg.prototype,"displayCount",void 0),y([w({type:["list"],json:{write:!0}})],Eg.prototype,"displayType",void 0),y([w({type:[nMe],json:{write:!0}})],Eg.prototype,"orderByFields",void 0),y([w({type:Number,json:{type:_n,write:!0}})],Eg.prototype,"relationshipId",void 0),y([w({type:String,json:{write:!0}})],Eg.prototype,"title",void 0),y([w({type:["relationship"],readOnly:!0,json:{read:!1,write:!0}})],Eg.prototype,"type",void 0),Eg=y([Z("esri.popup.content.RelationshipContent")],Eg);const Bz=Eg;var gJ;let gI=gJ=class extends lx{constructor(t){super(t),this.text=null,this.type="text"}clone(){return new gJ({text:this.text})}};y([w({type:String,json:{write:!0}})],gI.prototype,"text",void 0),y([w({type:["text"],readOnly:!0,json:{read:!1,write:!0}})],gI.prototype,"type",void 0),gI=gJ=y([Z("esri.popup.content.TextContent")],gI);const jz=gI,Met={base:null,key:"type",typeMap:{attachment:SL,media:Vz,text:jz,expression:Dse,field:TL,relationship:Bz}};var yJ;let x3=yJ=class extends Ue{constructor(t){super(t),this.name=null,this.title=null,this.expression=null,this.returnType=null}clone(){return new yJ({name:this.name,title:this.title,expression:this.expression,returnType:this.returnType})}};y([w({type:String,json:{write:!0}})],x3.prototype,"name",void 0),y([w({type:String,json:{write:!0}})],x3.prototype,"title",void 0),y([w({type:String,json:{write:!0}})],x3.prototype,"expression",void 0),y([w({type:["string","number"],json:{write:!0}})],x3.prototype,"returnType",void 0),x3=yJ=y([Z("esri.popup.ExpressionInfo")],x3);const Oet=x3;var vJ;let yI=vJ=class extends Ue{constructor(t){super(t),this.returnTopmostRaster=null,this.showNoDataRecords=null}clone(){return new vJ({showNoDataRecords:this.showNoDataRecords,returnTopmostRaster:this.returnTopmostRaster})}};y([w({type:Boolean,json:{write:!0}})],yI.prototype,"returnTopmostRaster",void 0),y([w({type:Boolean,json:{write:!0}})],yI.prototype,"showNoDataRecords",void 0),yI=vJ=y([Z("esri.popup.LayerOptions")],yI);const Pet=yI;var _J;let vI=_J=class extends Ue{constructor(t){super(t),this.showRelatedRecords=null,this.orderByFields=null}clone(){return new _J({showRelatedRecords:this.showRelatedRecords,orderByFields:this.orderByFields?Pe(this.orderByFields):null})}};y([w({type:Boolean,json:{write:!0}})],vI.prototype,"showRelatedRecords",void 0),y([w({type:[nMe],json:{write:!0}})],vI.prototype,"orderByFields",void 0),vI=_J=y([Z("esri.popup.RelatedRecordsInfo")],vI);const Ret=vI;var bJ;let Wp=bJ=class extends z_(ze){constructor(t){super(t),this.active=!1,this.className=null,this.disabled=!1,this.icon=null,this.id=null,this.indicator=!1,this.title=null,this.type=null,this.visible=!0}clone(){return new bJ({active:this.active,className:this.className,disabled:this.disabled,icon:this.icon,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible})}};y([w()],Wp.prototype,"active",void 0),y([w()],Wp.prototype,"className",void 0),y([w()],Wp.prototype,"disabled",void 0),y([w()],Wp.prototype,"icon",void 0),y([w()],Wp.prototype,"id",void 0),y([w()],Wp.prototype,"indicator",void 0),y([w()],Wp.prototype,"title",void 0),y([w()],Wp.prototype,"type",void 0),y([w()],Wp.prototype,"visible",void 0),Wp=bJ=y([Z("esri.support.actions.ActionBase")],Wp);const v5=Wp;var wJ;let z7=wJ=class extends v5{constructor(t){super(t),this.image=null,this.type="button"}clone(){return new wJ({active:this.active,className:this.className,disabled:this.disabled,icon:this.icon,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible,image:this.image})}};y([w()],z7.prototype,"image",void 0),z7=wJ=y([Z("esri.support.Action.ActionButton")],z7);const _5=z7;var xJ;let _I=xJ=class extends v5{constructor(t){super(t),this.image=null,this.type="toggle",this.value=!1}clone(){return new xJ({active:this.active,className:this.className,disabled:this.disabled,icon:this.icon,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible,image:this.image,value:this.value})}};y([w()],_I.prototype,"image",void 0),y([w()],_I.prototype,"value",void 0),_I=xJ=y([Z("esri.support.Action.ActionToggle")],_I);const kB=_I,Iet="esri.PopupTemplate",$et=Ce.getLogger(Iet),Q5="relationships/",rpe="expression/",Let=tt.ofType({key:"type",defaultKeyValue:"button",base:v5,typeMap:{button:_5,toggle:kB}}),Det={base:lx,key:"type",typeMap:{media:Vz,custom:xet,text:jz,attachments:SL,fields:TL,expression:Dse,relationship:Bz}},Net=new Set(["attachments","fields","media","text","expression","relationship"]);let fl=class extends Xs(Ue){constructor(){super(...arguments),this.actions=null,this.content="",this.expressionInfos=null,this.fieldInfos=null,this.layerOptions=null,this.lastEditInfoEnabled=!0,this.outFields=null,this.overwriteActions=!1,this.returnGeometry=!1,this.title=""}castContent(e){return Array.isArray(e)?e.map(i=>Hy(Det,i)):typeof e=="string"||typeof e=="function"||e instanceof HTMLElement||yd(e)?e:($et.error("content error","unsupported content value",{value:e}),null)}readContent(e,i){const{popupElements:r}=i;return Array.isArray(r)&&r.length>0?this._readPopupInfoElements(i.description,i.mediaInfos,r):this._readPopupInfo(i)}writeContent(e,i,r,n){typeof e!="string"?Array.isArray(e)&&(i.popupElements=e.filter(s=>Net.has(s.type)).map(s=>s==null?void 0:s.toJSON(n)),i.popupElements.forEach(s=>{s.type==="attachments"?this._writeAttachmentContent(i):s.type==="media"?this._writeMediaContent(s,i):s.type==="text"?this._writeTextContent(s,i):s.type==="relationship"&&this._writeRelationshipContent(s,i)})):i.description=e}writeFieldInfos(e,i,r,n){const{content:s}=this,o=Array.isArray(s)?s:null;if(e){const a=o?o.filter(p=>p.type==="fields"):[],c=a.length&&a.every(p=>{var _;return(_=p.fieldInfos)==null?void 0:_.length});i.fieldInfos=e.filter(Boolean).map(p=>{const _=p.toJSON(n);return c&&(_.visible=!1),_})}if(o)for(const a of o)a.type==="fields"&&this._writeFieldsContent(a,i)}writeLayerOptions(e,i,r,n){i[r]=!e||e.showNoDataRecords===null&&e.returnTopmostRaster===null?null:e.toJSON(n)}writeTitle(e,i){i.title=e||""}async collectRequiredFields(e,i){const r=this.expressionInfos||[];await this._collectExpressionInfoFields(e,i,[...r,...this._getContentExpressionInfos(this.content,r)]),xL(e,i,[...this.outFields||[],...this._getActionsFields(this.actions),...this._getTitleFields(this.title),...this._getContentFields(this.content)])}async getRequiredFields(e){const i=new Set;return await this.collectRequiredFields(i,e),[...i].sort()}_writeFieldsContent(e,i){if(!Array.isArray(e.fieldInfos)||!e.fieldInfos.length)return;const r=Pe(e.fieldInfos);Array.isArray(i.fieldInfos)?r.forEach(n=>{const s=i.fieldInfos.find(o=>o.fieldName.toLowerCase()===n.fieldName.toLowerCase());s?s.visible=!0:i.fieldInfos.push(n)}):i.fieldInfos=r}_writeAttachmentContent(e){e.showAttachments||(e.showAttachments=!0)}_writeRelationshipContent(e,i){var s,o;const r=((s=e.orderByFields)==null?void 0:s.map(a=>this._toFieldOrderJSON(a,e.relationshipId)))||[],n=[...((o=i.relatedRecordsInfo)==null?void 0:o.orderByFields)||[],...r];i.relatedRecordsInfo={showRelatedRecords:!0,...(n==null?void 0:n.length)&&{orderByFields:n}}}_writeTextContent(e,i){!i.description&&e.text&&(i.description=e.text)}_writeMediaContent(e,i){if(!Array.isArray(e.mediaInfos)||!e.mediaInfos.length)return;const r=Pe(e.mediaInfos);Array.isArray(i.mediaInfos)?i.mediaInfos=[...i.mediaInfos,...r]:i.mediaInfos=r}_readPopupInfoElements(e,i,r){const n={description:!1,mediaInfos:!1};return r.map(s=>s.type==="media"?(s.mediaInfos||!i||n.mediaInfos||(s.mediaInfos=i,n.mediaInfos=!0),Vz.fromJSON(s)):s.type==="text"?(s.text||!e||n.description||(s.text=e,n.description=!0),jz.fromJSON(s)):s.type==="attachments"?SL.fromJSON(s):s.type==="fields"?TL.fromJSON(s):s.type==="expression"?Dse.fromJSON(s):s.type==="relationship"?Bz.fromJSON(s):void 0).filter(Boolean)}_toRelationshipContent(e){const{field:i,order:r}=e;if(!(i!=null&&i.startsWith(Q5)))return null;const n=i.replace(Q5,"").split("/");if(n.length!==2)return null;const s=parseInt(n[0],10),o=n[1];return typeof s=="number"&&o?Bz.fromJSON({relationshipId:s,orderByFields:[{field:o,order:r}]}):null}_toFieldOrderJSON(e,i){const{order:r,field:n}=e;return{field:`${Q5}${i}/${n}`,order:r}}_readPopupInfo({description:e,mediaInfos:i,showAttachments:r,relatedRecordsInfo:n={showRelatedRecords:!1}}){const s=[];e?s.push(new jz({text:e})):s.push(new TL),Array.isArray(i)&&i.length&&s.push(Vz.fromJSON({mediaInfos:i})),r&&s.push(SL.fromJSON({displayType:"auto"}));const{showRelatedRecords:o,orderByFields:a}=n;return o&&(a!=null&&a.length)&&a.forEach(c=>{const p=this._toRelationshipContent(c);p&&s.push(p)}),s.length?s:e}_getContentElementFields(e){const i=e==null?void 0:e.type;if(i==="attachments")return[...this._extractFieldNames(e.title),...this._extractFieldNames(e.description)];if(i==="custom")return e.outFields||[];if(i==="fields")return[...this._extractFieldNames(e.title),...this._extractFieldNames(e.description),...this._getFieldInfoFields(e.fieldInfos??this.fieldInfos)];if(i==="media"){const r=e.mediaInfos||[];return[...this._extractFieldNames(e.title),...this._extractFieldNames(e.description),...r.reduce((n,s)=>[...n,...this._getMediaInfoFields(s)],[])]}return i==="text"?this._extractFieldNames(e.text):[]}_getMediaInfoFields(e){const{caption:i,title:r,value:n}=e,s=n||{},{fields:o,normalizeField:a,tooltipField:c,sourceURL:p,linkURL:_}=s,x=[...this._extractFieldNames(r),...this._extractFieldNames(i),...this._extractFieldNames(p),...this._extractFieldNames(_),...o??[]];return a&&x.push(a),c&&x.push(c),x}_getContentExpressionInfos(e,i){return Array.isArray(e)?e.reduce((r,n)=>[...r,...n.type==="expression"&&n.expressionInfo?[n.expressionInfo]:[]],i):[]}_getContentFields(e){return typeof e=="string"?this._extractFieldNames(e):Array.isArray(e)?e.reduce((i,r)=>[...i,...this._getContentElementFields(r)],[]):[]}async _collectExpressionInfoFields(e,i,r){r&&await Promise.all(r.map(n=>th(e,i,n.expression)))}_getFieldInfoFields(e){return e?e.filter(i=>i.visible===void 0||!!i.visible).map(i=>i.fieldName).filter(i=>!i.startsWith(Q5)&&!i.startsWith(rpe)):[]}_getActionsFields(e){return e?e.toArray().reduce((i,r)=>[...i,...this._getActionFields(r)],[]):[]}_getActionFields(e){const{className:i,title:r,type:n}=e,s=n==="button"||n==="toggle"?e.image:"";return[...this._extractFieldNames(r),...this._extractFieldNames(i),...this._extractFieldNames(s)]}_getTitleFields(e){return typeof e=="string"?this._extractFieldNames(e):[]}_extractFieldNames(e){if(!e||typeof e!="string")return[];const i=/{[^}]*}/g,r=e.match(i);if(!r)return[];const n=/\{(\w+):.+\}/,s=r.filter(o=>!(o.indexOf(`{${Q5}`)===0||o.indexOf(`{${rpe}`)===0)).map(o=>o.replace(n,"{$1}"));return s?s.map(o=>o.slice(1,-1)):[]}};y([w({type:Let})],fl.prototype,"actions",void 0),y([w()],fl.prototype,"content",void 0),y([Ci("content")],fl.prototype,"castContent",null),y([Rt("content",["description","fieldInfos","popupElements","mediaInfos","showAttachments","relatedRecordsInfo"])],fl.prototype,"readContent",null),y([Et("content",{popupElements:{type:tt.ofType(Met)},showAttachments:{type:Boolean},mediaInfos:{type:tt.ofType(rMe)},description:{type:String},relatedRecordsInfo:{type:Ret}})],fl.prototype,"writeContent",null),y([w({type:[Oet],json:{write:!0}})],fl.prototype,"expressionInfos",void 0),y([w({type:[Nse]})],fl.prototype,"fieldInfos",void 0),y([Et("fieldInfos")],fl.prototype,"writeFieldInfos",null),y([w({type:Pet})],fl.prototype,"layerOptions",void 0),y([Et("layerOptions")],fl.prototype,"writeLayerOptions",null),y([w({type:Boolean,json:{read:{source:"showLastEditInfo"},write:{target:"showLastEditInfo"},default:!0}})],fl.prototype,"lastEditInfoEnabled",void 0),y([w()],fl.prototype,"outFields",void 0),y([w()],fl.prototype,"overwriteActions",void 0),y([w()],fl.prototype,"returnGeometry",void 0),y([w({json:{type:String}})],fl.prototype,"title",void 0),y([Et("title")],fl.prototype,"writeTitle",null),fl=y([Z("esri.PopupTemplate")],fl);const yE=fl,npe=new tn({esriSMS:"simple-marker",esriPMS:"picture-marker",esriSLS:"simple-line",esriSFS:"simple-fill",esriPFS:"picture-fill",esriTS:"text",esriSHD:"shield-label-symbol",PointSymbol3D:"point-3d",LineSymbol3D:"line-3d",PolygonSymbol3D:"polygon-3d",WebStyleSymbol:"web-style",MeshSymbol3D:"mesh-3d",LabelSymbol3D:"label-3d",CIMSymbolReference:"cim"});let Fet=0,yA=class extends Ue{constructor(e){super(e),this.id="sym"+Fet++,this.type=null,this.color=new qe([0,0,0,1])}readColor(e){return(e==null?void 0:e[0])!=null?[e[0],e[1],e[2],e[3]/255]:e}async collectRequiredFields(e,i){}hash(){return JSON.stringify(this.toJSON())}clone(){}};y([w({type:npe.apiValues,readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,writer:npe.write}}})],yA.prototype,"type",void 0),y([w({type:qe,json:{write:{allowNull:!0}}})],yA.prototype,"color",void 0),y([Rt("color")],yA.prototype,"readColor",null),yA=y([Z("esri.symbols.Symbol")],yA);const vd=yA;var SJ;let Wb=SJ=class extends vd{constructor(t){super(t),this.data=null,this.type="cim"}readData(t,e){return e}writeData(t,e){Object.assign(e,t)}async collectRequiredFields(t,e){var i;if(((i=this.data)==null?void 0:i.type)==="CIMSymbolReference"){const r=this.data.primitiveOverrides;if(r){const n=r.map(s=>{const o=s.valueExpressionInfo;return th(t,e,o.expression)});await Promise.all(n)}}}clone(){return new SJ({data:Pe(this.data)})}hash(){return mne(JSON.stringify(this.data)).toString()}};y([w({json:{write:!1}})],Wb.prototype,"color",void 0),y([w({json:{write:!0}})],Wb.prototype,"data",void 0),y([Rt("data",["symbol"])],Wb.prototype,"readData",null),y([Et("data",{})],Wb.prototype,"writeData",null),y([Vt({CIMSymbolReference:"cim"},{readOnly:!0})],Wb.prototype,"type",void 0),Wb=SJ=y([Z("esri.symbols.CIMSymbol")],Wb);const cx=Wb;let vA=class extends Ue{constructor(e){super(e),this.enabled=!0,this.type=null,this.ignoreDrivers=!1}writeEnabled(e,i,r){e||(i[r]=e)}};y([w({type:Boolean,json:{read:{source:"enable"},write:{target:"enable"}}})],vA.prototype,"enabled",void 0),y([Et("enabled")],vA.prototype,"writeEnabled",null),y([w({type:["icon","object","line","path","fill","water","extrude","text"],readOnly:!0})],vA.prototype,"type",void 0),vA=y([Z("esri.symbols.Symbol3DLayer")],vA);const p1=vA;function zB(t){const e=_ne(100*(1-t));return Math.max(0,Math.min(e,100))}function WT(t){const e=1-t/100;return Math.max(0,Math.min(e,1))}function ket(t,e){const i=e.transparency!=null?WT(e.transparency):1,r=e.color;return r&&Array.isArray(r)?new qe([r[0]||0,r[1]||0,r[2]||0,i]):null}function zet(t,e){e.color=t.toJSON().slice(0,3);const i=zB(t.a);i!==0&&(e.transparency=i)}const U_={type:qe,json:{type:[_n],default:null,read:{source:["color","transparency"],reader:ket},write:{target:{color:{type:[_n]},transparency:{type:_n}},writer:zet}}},Jy={type:Number,cast:vs,json:{write:!0}};let S3=class extends Ue{constructor(e){super(e),this.color=new qe([0,0,0,1]),this.extensionLength=0,this.size=cd(1)}clone(){}cloneProperties(){return{color:Pe(this.color),size:this.size,extensionLength:this.extensionLength}}};y([w({type:["solid","sketch"],readOnly:!0,json:{read:!0,write:{ignoreOrigin:!0}}})],S3.prototype,"type",void 0),y([w(U_)],S3.prototype,"color",void 0),y([w({...Jy,json:{write:{overridePolicy:t=>({enabled:!!t})}}})],S3.prototype,"extensionLength",void 0),y([w(Jy)],S3.prototype,"size",void 0),S3=y([Z("esri.symbols.edges.Edges3D")],S3);const kse=S3;var TJ;let U7=TJ=class extends kse{constructor(t){super(t),this.type="sketch"}clone(){return new TJ(this.cloneProperties())}};y([Vt({sketch:"sketch"},{readOnly:!0})],U7.prototype,"type",void 0),U7=TJ=y([Z("esri.symbols.edges.SketchEdges3D")],U7);const Uet=U7;var EJ;let V7=EJ=class extends kse{constructor(t){super(t),this.type="solid"}clone(){return new EJ(this.cloneProperties())}};y([Vt({solid:"solid"},{readOnly:!0})],V7.prototype,"type",void 0),V7=EJ=y([Z("esri.symbols.support.SolidEdges3D")],V7);const Vet=V7,sMe={types:{key:"type",base:kse,typeMap:{solid:Vet,sketch:Uet}},json:{write:!0}};var CJ;let _p=CJ=class extends Ue{constructor(t){super(t),this.color=null}clone(){const t={color:this.color!=null?this.color.clone():null};return new CJ(t)}};y([w(U_)],_p.prototype,"color",void 0),_p=CJ=y([Z("esri.symbols.support.Symbol3DMaterial")],_p);var AJ;let Yb=AJ=class extends p1{constructor(t){super(t),this.type="extrude",this.size=1,this.material=null,this.castShadows=!0,this.edges=null}clone(){return new AJ({edges:this.edges&&this.edges.clone(),enabled:this.enabled,material:this.material!=null?this.material.clone():null,castShadows:this.castShadows,size:this.size})}};y([Vt({Extrude:"extrude"},{readOnly:!0})],Yb.prototype,"type",void 0),y([w({type:Number,json:{write:{enabled:!0,isRequired:!0}},nonNullable:!0})],Yb.prototype,"size",void 0),y([w({type:_p,json:{write:!0}})],Yb.prototype,"material",void 0),y([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!0}})],Yb.prototype,"castShadows",void 0),y([w(sMe)],Yb.prototype,"edges",void 0),Yb=AJ=y([Z("esri.symbols.ExtrudeSymbol3DLayer")],Yb);const oMe=Yb;let bI=class extends vd{constructor(e){super(e),this.type="simple-line",this.width=.75}hash(){return`${this.type}.${this.width}`}};y([Vt({esriSLS:"simple-line"},{readOnly:!0})],bI.prototype,"type",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],bI.prototype,"width",void 0),bI=y([Z("esri.symbols.LineSymbol")],bI);const Bet=bI,jet=["begin","end","begin-end"],aMe=["arrow","circle","square","diamond","cross","x"];var MJ;let Cg=MJ=class extends Ue{constructor(t){super(t),this.placement="begin-end",this.type="line-marker",this.style="arrow"}writeStyle(t,e,i,r){e[i]=(r==null?void 0:r.origin)==="web-map"?"arrow":t}set color(t){this._set("color",t)}readColor(t){return(t==null?void 0:t[0])!=null?[t[0],t[1],t[2],t[3]/255]:t}writeColor(t,e,i,r){(r==null?void 0:r.origin)==="web-map"||(e[i]=t)}clone(){return new MJ({color:Pe(this.color),placement:this.placement,style:this.style})}hash(){var t;return`${this.placement}.${(t=this.color)==null?void 0:t.hash()}.${this.style}`}};y([w({type:["begin","end","begin-end"],json:{write:!0}})],Cg.prototype,"placement",void 0),y([Vt({"line-marker":"line-marker"},{readOnly:!0}),w({json:{origins:{"web-map":{write:!1}}}})],Cg.prototype,"type",void 0),y([w({type:aMe})],Cg.prototype,"style",void 0),y([Et("style")],Cg.prototype,"writeStyle",null),y([w({type:qe,value:null,json:{write:{allowNull:!0}}})],Cg.prototype,"color",null),y([Rt("color")],Cg.prototype,"readColor",null),y([Et("color")],Cg.prototype,"writeColor",null),Cg=MJ=y([Z("esri.symbols.LineSymbolMarker")],Cg);const Get=Cg;var OJ;const PH=new tn({esriSLSSolid:"solid",esriSLSDash:"dash",esriSLSDot:"dot",esriSLSDashDot:"dash-dot",esriSLSDashDotDot:"long-dash-dot-dot",esriSLSNull:"none",esriSLSInsideFrame:"inside-frame",esriSLSShortDash:"short-dash",esriSLSShortDot:"short-dot",esriSLSShortDashDot:"short-dash-dot",esriSLSShortDashDotDot:"short-dash-dot-dot",esriSLSLongDash:"long-dash",esriSLSLongDashDot:"long-dash-dot"});let Y1=OJ=class extends Bet{constructor(...t){super(...t),this.type="simple-line",this.style="solid",this.cap="round",this.join="round",this.marker=null,this.miterLimit=2}normalizeCtorArgs(t,e,i,r,n,s){if(t&&typeof t!="string")return t;const o={};return t!=null&&(o.style=t),e!=null&&(o.color=e),i!=null&&(o.width=vs(i)),r!=null&&(o.cap=r),n!=null&&(o.join=n),s!=null&&(o.miterLimit=vs(s)),o}clone(){var t;return new OJ({color:Pe(this.color),style:this.style,width:this.width,cap:this.cap,join:this.join,miterLimit:this.miterLimit,marker:(t=this.marker)==null?void 0:t.clone()})}hash(){var t,e;return`${super.hash()}.${(t=this.color)==null?void 0:t.hash()}.${this.style}.${this.cap}.${this.join}.${this.miterLimit}.${(e=this.marker)==null?void 0:e.hash()}`}};y([Vt({esriSLS:"simple-line"},{readOnly:!0})],Y1.prototype,"type",void 0),y([w({type:PH.apiValues,json:{read:PH.read,write:PH.write}})],Y1.prototype,"style",void 0),y([w({type:["butt","round","square"],json:{write:{overridePolicy:(t,e,i)=>({enabled:t!=="round"&&(i==null?void 0:i.origin)==null})}}})],Y1.prototype,"cap",void 0),y([w({type:["miter","round","bevel"],json:{write:{overridePolicy:(t,e,i)=>({enabled:t!=="round"&&(i==null?void 0:i.origin)==null})}}})],Y1.prototype,"join",void 0),y([w({types:{key:"type",base:null,defaultKeyValue:"line-marker",typeMap:{"line-marker":Get}},json:{write:!0,origins:{"web-scene":{write:!1}}}})],Y1.prototype,"marker",void 0),y([w({type:Number,json:{read:!1,write:!1}})],Y1.prototype,"miterLimit",void 0),Y1=OJ=y([Z("esri.symbols.SimpleLineSymbol")],Y1);const Ic=Y1;let wI=class extends vd{constructor(e){super(e),this.outline=null,this.type=null}hash(){return`${this.type}.${this.outline&&this.outline.hash()}`}};y([w({types:{key:"type",base:null,defaultKeyValue:"simple-line",typeMap:{"simple-line":Ic}},json:{default:null,write:!0}})],wI.prototype,"outline",void 0),y([w({type:["simple-fill","picture-fill"],readOnly:!0})],wI.prototype,"type",void 0),wI=y([Z("esri.symbols.FillSymbol")],wI);const lMe=wI;let B7=class extends Ue{constructor(e){super(e)}clone(){}};y([w({type:["style"],readOnly:!0,json:{read:!0,write:{ignoreOrigin:!0}}})],B7.prototype,"type",void 0),B7=y([Z("esri.symbols.patterns.LinePattern3D")],B7);const cMe=B7,Het=["dash","dash-dot","dot","long-dash","long-dash-dot","long-dash-dot-dot","none","short-dash","short-dash-dot","short-dash-dot-dot","short-dot","solid"];var PJ;const qet=gu()({dash:"dash","dash-dot":"dash-dot","dash-dot-dot":"long-dash-dot-dot",dot:"dot","long-dash":"long-dash","long-dash-dot":"long-dash-dot",null:"none","short-dash":"short-dash","short-dash-dot":"short-dash-dot","short-dash-dot-dot":"short-dash-dot-dot","short-dot":"short-dot",solid:"solid"});let xI=PJ=class extends cMe{constructor(t){super(t),this.type="style",this.style="solid"}clone(){const t={style:this.style};return new PJ(t)}};y([w({type:["style"]})],xI.prototype,"type",void 0),y([Vt(qet),w({type:Het})],xI.prototype,"style",void 0),xI=PJ=y([Z("esri.symbols.patterns.LineStylePattern3D")],xI);const zse=xI;let j7=class extends Ue{constructor(e){super(e)}clone(){}};y([w({type:["style"],readOnly:!0,json:{read:!0,write:{ignoreOrigin:!0}}})],j7.prototype,"type",void 0),j7=y([Z("esri.symbols.patterns.Pattern3D")],j7);const uMe=j7,Wet=["backward-diagonal","cross","diagonal-cross","forward-diagonal","horizontal","none","solid","vertical"];var RJ;let SI=RJ=class extends uMe{constructor(t){super(t),this.type="style",this.style="solid"}clone(){const t={style:this.style};return new RJ(t)}};y([w({type:["style"]})],SI.prototype,"type",void 0),y([w({type:Wet,json:{read:!0,write:!0}})],SI.prototype,"style",void 0),SI=RJ=y([Z("esri.symbols.patterns.StylePattern3D")],SI);const hMe=SI,Yet={types:{key:"type",base:uMe,typeMap:{style:hMe}},json:{write:!0}},dMe={types:{key:"type",base:cMe,typeMap:{style:zse}},json:{write:!0}},l$=new qe("white");new qe("black");const Xet=new qe([255,255,255,0]);function Zet(t){return t.r===0&&t.g===0&&t.b===0}var IJ;let c$=IJ=class extends _p{constructor(t){super(t),this.colorMixMode=null}clone(){const t={color:this.color!=null?this.color.clone():null,colorMixMode:this.colorMixMode};return new IJ(t)}};y([Vt({multiply:"multiply",replace:"replace",tint:"tint"})],c$.prototype,"colorMixMode",void 0),c$=IJ=y([Z("esri.symbols.support.Symbol3DFillMaterial")],c$);function va(t=yMe){return[t[0],t[1],t[2],t[3],t[4],t[5]]}function D2(t,e,i,r,n,s,o=va()){return o[0]=t,o[1]=e,o[2]=i,o[3]=r,o[4]=n,o[5]=s,o}function Jet(t,e){const i=isFinite(t[2])||isFinite(t[5]);return new Vi(i?{xmin:t[0],xmax:t[3],ymin:t[1],ymax:t[4],zmin:t[2],zmax:t[5],spatialReference:e}:{xmin:t[0],xmax:t[3],ymin:t[1],ymax:t[4],spatialReference:e})}function sP(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.min(t[2],e[2]),t[3]=Math.max(t[3],e[3]),t[4]=Math.max(t[4],e[4]),t[5]=Math.max(t[5],e[5])}function Ket(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[3]=Math.max(t[3],e[2]),t[4]=Math.max(t[4],e[3])}function Xf(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.min(t[2],e[2]),t[3]=Math.max(t[3],e[0]),t[4]=Math.max(t[4],e[1]),t[5]=Math.max(t[5],e[2])}function pp(t,e,i=0,r=e.length/3){let n=t[0],s=t[1],o=t[2],a=t[3],c=t[4],p=t[5];for(let _=0;_=t[3]?0:t[3]-t[0]}function _E(t){return t[1]>=t[4]?0:t[4]-t[1]}function ux(t){return t[2]>=t[5]?0:t[5]-t[2]}function pMe(t){const e=vE(t),i=ux(t),r=_E(t);return Math.sqrt(e*e+i*i+r*r)}function _m(t,e=[0,0,0]){return e[0]=t[0]+vE(t)/2,e[1]=t[1]+_E(t)/2,e[2]=t[2]+ux(t)/2,e}function Z6(t,e=[0,0,0]){return e[0]=vE(t),e[1]=_E(t),e[2]=ux(t),e}function Use(t,e){return e[0]>=t[0]&&e[1]>=t[1]&&e[2]>=t[2]&&e[0]<=t[3]&&e[1]<=t[4]&&e[2]<=t[5]}function ZJt(t,e){return e[0]>=t[0]&&e[1]>=t[1]&&e[2]>=t[2]&&e[3]<=t[3]&&e[4]<=t[4]&&e[5]<=t[5]}function ett(t,e){return Math.max(e[0],t[0])<=Math.min(e[3],t[3])&&Math.max(e[1],t[1])<=Math.min(e[4],t[4])&&Math.max(e[2],t[2])<=Math.min(e[5],t[5])}function bm(t,e){return e==null||ett(t,e)}function fMe(t,e,i,r,n=t){return n[0]=t[0]+e,n[1]=t[1]+i,n[2]=t[2]+r,n[3]=t[3]+e,n[4]=t[4]+i,n[5]=t[5]+r,n}function JJt(t,e,i=t){const r=t[0]+vE(t)/2,n=t[1]+_E(t)/2,s=t[2]+ux(t)/2;return i[0]=r+(t[0]-r)*e,i[1]=n+(t[1]-n)*e,i[2]=s+(t[2]-s)*e,i[3]=r+(t[3]-r)*e,i[4]=n+(t[4]-n)*e,i[5]=s+(t[5]-s)*e,i}function KJt(t,e){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function mMe(t,e,i=t){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i!==t&&(i[3]=t[3],i[4]=t[4],i[5]=t[5]),i}function gMe(t,e,i=t){return i[3]=e[0],i[4]=e[1],i[5]=e[2],i!==t&&(i[0]=t[0],i[1]=t[1],i[2]=t[2]),t}function UB(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function Bn(t){return t?UB(t,spe):va(spe)}function Vse(t,e){return e||(e=Ni()),e[0]=t[0],e[1]=t[1],e[2]=t[3],e[3]=t[4],e}function QJt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=Number.NEGATIVE_INFINITY,t[3]=e[2],t[4]=e[3],t[5]=Number.POSITIVE_INFINITY,t}function ttt(t,e,i,r,n){return t[0]=e,t[1]=i,t[2]=Number.NEGATIVE_INFINITY,t[3]=r,t[4]=n,t[5]=Number.POSITIVE_INFINITY,t}function $J(t){return t.length===6}function Bse(t){return vE(t)===0&&_E(t)===0&&ux(t)===0}function eKt(t,e,i){if(t==null||e==null)return t===e;if(!$J(t)||!$J(e))return!1;if(i){for(let r=0;r{const e=Gh(t);return e===0?1:Je(e,.1,4)},nonNullable:!0},dtt=["left","right","center"],ptt=["baseline","top","middle","bottom"],bMe={type:dtt,nonNullable:!0},wMe={type:ptt,nonNullable:!0},iKt=8;var DJ;let Z1=DJ=class extends Ue{constructor(t){super(t),this.decoration="none",this.family="sans-serif",this.size=9,this.style="normal",this.weight="normal"}castSize(t){return vs(t)}clone(){return new DJ({decoration:this.decoration,family:this.family,size:this.size,style:this.style,weight:this.weight})}hash(){return`${this.decoration}.${this.family}.${this.size}.${this.style}.${this.weight}`}};y([w({type:ctt,json:{default:"none",write:!0}})],Z1.prototype,"decoration",void 0),y([w({type:String,json:{write:!0}})],Z1.prototype,"family",void 0),y([w({type:Number,json:{write:{overridePolicy:(t,e,i)=>({enabled:!i||!i.textSymbol3D})}}})],Z1.prototype,"size",void 0),y([Ci("size")],Z1.prototype,"castSize",null),y([w({type:utt,json:{default:"normal",write:!0}})],Z1.prototype,"style",void 0),y([w({type:htt,json:{default:"normal",write:!0}})],Z1.prototype,"weight",void 0),Z1=DJ=y([Z("esri.symbols.Font")],Z1);const VB=Z1;function w_(t,e){var r;const i=(r=e==null?void 0:e.url)==null?void 0:r.path;if(t&&i&&(t=Wh(t,i,{preserveProtocolRelative:!0}),e.portalItem&&e.readResourcePaths)){const n=Pne(t,e.portalItem.itemUrl);n!=null&&ftt.test(n)&&e.readResourcePaths.push(e.portalItem.resourceFromPath(n).path)}return NJ(t,e==null?void 0:e.portal)}function x_(t,e,i=oP.YES){var n,s;if(t==null)return t;!Qh(t)&&(e!=null&&e.blockedRelativeUrls)&&e.blockedRelativeUrls.push(t);let r=Wh(t);if(e){const o=((n=e.verifyItemRelativeUrls)==null?void 0:n.rootPath)||((s=e.url)==null?void 0:s.path);if(o){const a=NJ(o,e.portal),c=NJ(r,e.portal);r=Pne(c,a,a),r!=null&&r!==c&&r!==t&&e.verifyItemRelativeUrls&&e.verifyItemRelativeUrls.writtenUrls.push(r)}}return r=EMe(r,e==null?void 0:e.portal),Qh(r)&&(r=$f(r)),e!=null&&e.resources&&(e!=null&&e.portalItem)&&!Qh(r)&&!c1(r)&&i===oP.YES&&e.resources.toKeep.push({resource:e.portalItem.resourceFromPath(r),compress:!1}),r}function BB(t,e,i){return w_(t,i)}function N2(t,e,i,r){const n=x_(t,r);n!==void 0&&(e[i]=n)}const xMe=/\/items\/([^\/]+)\/resources\/(.*)/,ftt=/^\.\/resources\//;function SMe(t){const e=(t==null?void 0:t.match(xMe))??null;return(e==null?void 0:e[1])??null}function TMe(t){const e=(t==null?void 0:t.match(xMe))??null;if(e==null)return null;const i=e[2],r=i.lastIndexOf("/");if(r===-1){const{path:o,extension:a}=Bhe(i);return{prefix:null,filename:o,extension:a}}const{path:n,extension:s}=Bhe(i.slice(r+1));return{prefix:i.slice(0,r),filename:n,extension:s}}function EMe(t,e){return e&&!e.isPortal&&e.urlKey&&e.customBaseUrl?TZ(t,`${e.urlKey}.${e.customBaseUrl}`,e.portalHostname):t}function NJ(t,e){if(!e||e.isPortal||!e.urlKey||!e.customBaseUrl)return t;const i=`${e.urlKey}.${e.customBaseUrl}`,r=Cne();return WO(r,`${r.scheme}://${i}`)?TZ(t,e.portalHostname,i):TZ(t,i,e.portalHostname)}var oP;(function(t){t[t.YES=0]="YES",t[t.NO=1]="NO"})(oP||(oP={}));const mtt=Object.freeze(Object.defineProperty({__proto__:null,get MarkKeep(){return oP},ensureMainOnlineDomain:EMe,fromJSON:w_,itemIdFromResourceUrl:SMe,prefixAndFilenameFromResourceUrl:TMe,read:BB,toJSON:x_,write:N2},Symbol.toStringTag,{value:"Module"}));var FJ;const gtt=gu()({circle:"circle",square:"square",cross:"cross",x:"x",kite:"kite",triangle:"triangle"});let E3=FJ=class extends Ue{constructor(t){super(t)}readHref(t,e,i){return t?w_(t,i):e.dataURI}writeHref(t,e,i,r){t&&(c1(t)?e.dataURI=t:(e.href=x_(t,r),Qh(e.href)&&(e.href=$f(e.href))))}clone(){return new FJ({href:this.href,primitive:this.primitive})}};y([w({type:String,json:{write:!0,read:{source:["href","dataURI"]}}})],E3.prototype,"href",void 0),y([Rt("href")],E3.prototype,"readHref",null),y([Et("href",{href:{type:String},dataURI:{type:String}})],E3.prototype,"writeHref",null),y([Vt(gtt)],E3.prototype,"primitive",void 0),E3=FJ=y([Z("esri.symbols.support.IconSymbol3DLayerResource")],E3);const CMe="circle";var kJ;let OM=kJ=class extends ze{constructor(){super(...arguments),this.x=0,this.y=0}clone(){return new kJ({x:this.x,y:this.y})}};y([w({type:Number})],OM.prototype,"x",void 0),y([w({type:Number})],OM.prototype,"y",void 0),OM=kJ=y([Z("esri.symbols.support.Symbol3DAnchorPosition2D")],OM);var zJ;let TI=zJ=class extends Ue{constructor(t){super(t),this.color=new qe([0,0,0,1]),this.size=cd(1)}clone(){const t={color:this.color!=null?this.color.clone():null,size:this.size};return new zJ(t)}};y([w(U_)],TI.prototype,"color",void 0),y([w(Jy)],TI.prototype,"size",void 0),TI=zJ=y([Z("esri.symbols.support.Symbol3DIconOutline")],TI);var _A;const AMe="esri.symbols.IconSymbol3DLayer";let Ag=_A=class extends p1{constructor(t){super(t),this.material=null,this.resource=null,this.type="icon",this.size=12,this.anchor="center",this.anchorPosition=null,this.outline=null}clone(){return new _A({anchor:this.anchor,anchorPosition:this.anchorPosition&&this.anchorPosition.clone(),enabled:this.enabled,material:this.material!=null?this.material.clone():null,outline:this.outline!=null?this.outline.clone():null,resource:this.resource&&this.resource.clone(),size:this.size})}static fromSimpleMarkerSymbol(t){const e=t.color||l$,i=ope(t),r=t.outline&&t.outline.width>0?{size:t.outline.width,color:(t.outline.color||l$).clone()}:null;return new _A({size:t.size,resource:{primitive:vtt(t.style)},material:{color:e},outline:r,anchor:i?"relative":void 0,anchorPosition:i})}static fromPictureMarkerSymbol(t){const e=!t.color||Zet(t.color)?l$:t.color,i=ope(t);return new _A({size:t.width<=t.height?t.height:t.width,resource:{href:t.url},material:{color:e.clone()},anchor:i?"relative":void 0,anchorPosition:i})}static fromCIMSymbol(t){return new _A({resource:{href:FTe({mediaType:"application/json",data:JSON.stringify(t.data)})}})}};function ope(t){const e="width"in t?t.width:t.size,i="height"in t?t.height:t.size,r=ape(t.xoffset),n=ape(t.yoffset);return(r||n)&&e&&i?{x:-r/e,y:n/i}:null}function ape(t){return isFinite(t)?t:0}y([w({type:_p,json:{write:!0}})],Ag.prototype,"material",void 0),y([w({type:E3,json:{write:!0}})],Ag.prototype,"resource",void 0),y([Vt({Icon:"icon"},{readOnly:!0})],Ag.prototype,"type",void 0),y([w(Jy)],Ag.prototype,"size",void 0),y([Vt({center:"center",left:"left",right:"right",top:"top",bottom:"bottom",topLeft:"top-left",topRight:"top-right",bottomLeft:"bottom-left",bottomRight:"bottom-right",relative:"relative"}),w({json:{default:"center"}})],Ag.prototype,"anchor",void 0),y([w({type:OM,json:{type:[Number],read:{reader:t=>new OM({x:t[0],y:t[1]})},write:{writer:(t,e)=>{e.anchorPosition=[t.x,t.y]},overridePolicy(){return{enabled:this.anchor==="relative"}}}}})],Ag.prototype,"anchorPosition",void 0),y([w({type:TI,json:{write:!0}})],Ag.prototype,"outline",void 0),Ag=_A=y([Z(AMe)],Ag);const ytt={circle:"circle",cross:"cross",diamond:"kite",square:"square",x:"x",triangle:"triangle",path:null};function vtt(t){return ytt[t]||(Ce.getLogger(AMe).warn(`${t} cannot be mapped to Icon symbol. Fallback to "circle"`),"circle")}const s2=Ag;let J6;function _tt(t){return J6&&!J6.destroyed||(J6=t()),J6}var UJ;const btt=new tn({avgRating:"avg-rating",numRatings:"num-ratings",numComments:"num-comments",numViews:"num-views"});let Yp=UJ=class extends ze{constructor(t){super(t),this.categories=null,this.disableExtraQuery=!1,this.extent=null,this.filter=null,this.num=10,this.query=null,this.sortField=null,this.start=1}get sortOrder(){return this._get("sortOrder")||"asc"}set sortOrder(t){t!=="asc"&&t!=="desc"||this._set("sortOrder",t)}clone(){return new UJ({categories:this.categories?Pe(this.categories):null,disableExtraQuery:this.disableExtraQuery,extent:this.extent?this.extent.clone():null,filter:this.filter,num:this.num,query:this.query,sortField:this.sortField,sortOrder:this.sortOrder,start:this.start})}toRequestOptions(t,e){let i=[];this.categories&&(i=this.categories.map(o=>Array.isArray(o)?JSON.stringify(o):o));let r="";if(this.extent){const o=l5(this.extent,rt.WGS84);o!=null&&(r=`${o.xmin},${o.ymin},${o.xmax},${o.ymax}`)}let n=this.query;!this.disableExtraQuery&&t.extraQuery&&(n="("+n+")"+t.extraQuery);const s={categories:i,bbox:r,q:n,filter:this.filter,num:this.num,sortField:null,sortOrder:null,start:this.start};return this.sortField&&(s.sortField=this.sortField.split(",").map(o=>btt.toJSON(o.trim())).join(","),s.sortOrder=this.sortOrder),{query:{...e,...s}}}};y([w()],Yp.prototype,"categories",void 0),y([w()],Yp.prototype,"disableExtraQuery",void 0),y([w({type:Vi})],Yp.prototype,"extent",void 0),y([w()],Yp.prototype,"filter",void 0),y([w()],Yp.prototype,"num",void 0),y([w()],Yp.prototype,"query",void 0),y([w()],Yp.prototype,"sortField",void 0),y([w()],Yp.prototype,"sortOrder",null),y([w()],Yp.prototype,"start",void 0),Yp=UJ=y([Z("esri.portal.PortalQueryParams")],Yp);const dy=Yp;var VJ;let Da=VJ=class extends Ue{constructor(t){super(t),this.access=null,this.created=null,this.description=null,this.id=null,this.isInvitationOnly=!1,this.modified=null,this.owner=null,this.portal=null,this.snippet=null,this.sortField=null,this.sortOrder=null,this.sourceJSON=null,this.tags=null,this.title=null}get thumbnailUrl(){var i;const t=this.url,e=this.thumbnail;return t&&e&&this.portal?(i=this.portal)==null?void 0:i.normalizeUrl(`${t}/info/${e}?f=json`):null}get url(){var e;const t=(e=this.portal)==null?void 0:e.restUrl;return t?t+"/community/groups/"+this.id:null}fetchCategorySchema(t){return this.portal.request(this.url+"/categorySchema",t).then(e=>{const i=e.categorySchema||[];return i.some(r=>r.source==="contentCategorySetsGroupQuery.LivingAtlas")?this._fetchCategorySchemaSet("LivingAtlas",t):i})}fetchMembers(t){return this.portal.request(this.url+"/users",t)}getThumbnailUrl(t){let e=this.thumbnailUrl;return e&&t&&(e+=`&w=${t}`),e}toJSON(){throw new se("internal:not-yet-implemented","PortalGroup.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const e=new VJ;return e.sourceJSON=t,e.read(t),e}queryItems(t,e){let i=_s(dy,t);const r=this.portal;return parseFloat(r.currentVersion)>5?(i=i||new dy,r.queryPortal(`/content/groups/${this.id}/search`,i,"PortalItem",e)):(i=i?i.clone():new dy,i.query="group:"+this.id+(i.query?" "+i.query:""),r.queryItems(i,e))}_fetchCategorySchemaSet(t,e){const i=this.portal;return i.fetchSelf(i.authMode,!0,e).then(r=>{const n=r.contentCategorySetsGroupQuery;if(n){const s=new dy;return s.disableExtraQuery=!0,s.num=1,s.query=n,i.queryGroups(s,e)}throw new se("portal-group:fetchCategorySchema","contentCategorySetsGroupQuery value not found")}).then(r=>{if(r.total){const n=r.results[0],s=new dy;return s.num=1,s.query=`typekeywords:"${t}"`,n.queryItems(s,e)}throw new se("portal-group:fetchCategorySchema","contentCategorySetsGroupQuery group not found")}).then(r=>r.total?r.results[0].fetchData("json",e).then(n=>{const s=n==null?void 0:n.categorySchema;return s!=null&&s.length?s:[]}):[])}};y([w()],Da.prototype,"access",void 0),y([w({type:Date})],Da.prototype,"created",void 0),y([w()],Da.prototype,"description",void 0),y([w()],Da.prototype,"id",void 0),y([w()],Da.prototype,"isInvitationOnly",void 0),y([w({type:Date})],Da.prototype,"modified",void 0),y([w()],Da.prototype,"owner",void 0),y([w()],Da.prototype,"portal",void 0),y([w()],Da.prototype,"snippet",void 0),y([w()],Da.prototype,"sortField",void 0),y([w()],Da.prototype,"sortOrder",void 0),y([w()],Da.prototype,"sourceJSON",void 0),y([w()],Da.prototype,"tags",void 0),y([w()],Da.prototype,"thumbnail",void 0),y([w({readOnly:!0})],Da.prototype,"thumbnailUrl",null),y([w()],Da.prototype,"title",void 0),y([w({readOnly:!0})],Da.prototype,"url",null),Da=VJ=y([Z("esri.portal.PortalGroup")],Da);const BJ=Da;let C3=class extends ze{constructor(e){super(e),this.nextQueryParams=null,this.queryParams=null,this.results=null,this.total=null}};y([w()],C3.prototype,"nextQueryParams",void 0),y([w()],C3.prototype,"queryParams",void 0),y([w()],C3.prototype,"results",void 0),y([w()],C3.prototype,"total",void 0),C3=y([Z("esri.portal.PortalQueryResult")],C3);const wtt=C3;let J1=class extends Ue{constructor(e){super(e),this.created=null,this.id=null,this.portal=null,this.title=null,this.username=null}get url(){var i;const e=(i=this.portal)==null?void 0:i.restUrl;return e?`${e}/content/users/${this.username}/${this.id}`:null}toJSON(){throw new se("internal:not-yet-implemented","PortalFolder.toJSON is not yet implemented")}};y([w({type:Date})],J1.prototype,"created",void 0),y([w()],J1.prototype,"id",void 0),y([w()],J1.prototype,"portal",void 0),y([w()],J1.prototype,"title",void 0),y([w({readOnly:!0})],J1.prototype,"url",null),y([w()],J1.prototype,"username",void 0),J1=y([Z("esri.portal.PortalFolder")],J1);const xtt=J1;var jJ;let Zs=jJ=class extends Ue{constructor(...t){super(...t),this.access=null,this.created=null,this.culture=null,this.description=null,this.email=null,this.fullName=null,this.modified=null,this.orgId=null,this.portal=null,this.preferredView=null,this.privileges=null,this.region=null,this.role=null,this.roleId=null,this.sourceJSON=null,this.units=null,this.username=null,this.userType=null}get thumbnailUrl(){const t=this.url,e=this.thumbnail;return t&&e?this.portal.normalizeUrl(`${t}/info/${e}?f=json`):null}get userContentUrl(){var e;const t=(e=this.portal)==null?void 0:e.restUrl;return t?`${t}/content/users/${this.username}`:null}get url(){var e;const t=(e=this.portal)==null?void 0:e.restUrl;return t?`${t}/community/users/${this.username}`:null}addItem(t){const e=t&&t.item,i=t==null?void 0:t.data,r=t==null?void 0:t.folder,n={method:"post"};e&&(n.query=e.createPostQuery(),i!=null&&(typeof i=="string"?n.query.text=i:typeof i=="object"&&(n.query.text=JSON.stringify(i))));let s=this.userContentUrl;return r&&(s+="/"+(typeof r=="string"?r:r.id)),this.portal.request(s+"/addItem",n).then(o=>(e.id=o.id,e.portal=this.portal,e.loaded?e.reload():e.load()))}deleteItem(t){let e=this.userContentUrl;return t.ownerFolder&&(e+="/"+t.ownerFolder),this.portal.request(e+`/items/${t.id}/delete`,{method:"post"}).then(()=>{t.id=null,t.portal=null})}deleteItems(t){const e=this.userContentUrl+"/deleteItems",i=t.map(r=>r.id);if(i.length){const r={method:"post",query:{items:i.join(",")}};return this.portal.request(e,r).then(()=>{t.forEach(n=>{n.id=null,n.portal=null})})}return Promise.resolve(void 0)}fetchFolders(){const t={query:{num:1}};return this.portal.request(this.userContentUrl??"",t).then(e=>{let i;return i=e&&e.folders?e.folders.map(r=>{const n=xtt.fromJSON(r);return n.portal=this.portal,n}):[],i})}fetchGroups(){return this.portal.request(this.url??"").then(t=>{let e;return e=t&&t.groups?t.groups.map(i=>{const r=BJ.fromJSON(i);return r.portal=this.portal,r}):[],e})}fetchItems(t){const e=t??{};let i,r=this.userContentUrl??"";return e.folder&&(r+="/"+e.folder.id),we(()=>Promise.resolve().then(()=>YOe),void 0).then(({default:n})=>{i=n;const s={folders:!1,num:e.num||10,start:e.start||1,sortField:e.sortField||"created",sortOrder:e.sortOrder||"asc"};return this.portal.request(r,{query:s})}).then(n=>{let s;return n!=null&&n.items?(s=n.items.map(o=>{const a=i.fromJSON(o);return a.portal=this.portal,a}),Promise.all(s.map(o=>o.load())).catch(o=>o).then(()=>({items:s,nextStart:n.nextStart,total:n.total}))):{items:[],nextStart:-1,total:0}})}fetchTags(){return this.portal.request(this.url+"/tags").then(t=>t.tags)}getThumbnailUrl(t){let e=this.thumbnailUrl;return e&&t&&(e+=`&w=${t}`),e}queryFavorites(t){return this.favGroupId?(this._favGroup||(this._favGroup=new BJ({id:this.favGroupId,portal:this.portal})),this._favGroup.queryItems(t)):Promise.reject(new se("internal:unknown","Unknown internal error",{internalError:"Unknown favGroupId"}))}toJSON(){throw new se("internal:not-yet-implemented","PortalUser.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const e=new jJ;return e.sourceJSON=t,e.read(t),e}};y([w()],Zs.prototype,"access",void 0),y([w({type:Date})],Zs.prototype,"created",void 0),y([w()],Zs.prototype,"culture",void 0),y([w()],Zs.prototype,"description",void 0),y([w()],Zs.prototype,"email",void 0),y([w()],Zs.prototype,"favGroupId",void 0),y([w()],Zs.prototype,"fullName",void 0),y([w({type:Date})],Zs.prototype,"modified",void 0),y([w()],Zs.prototype,"orgId",void 0),y([w()],Zs.prototype,"portal",void 0),y([w()],Zs.prototype,"preferredView",void 0),y([w()],Zs.prototype,"privileges",void 0),y([w()],Zs.prototype,"region",void 0),y([w()],Zs.prototype,"role",void 0),y([w()],Zs.prototype,"roleId",void 0),y([w()],Zs.prototype,"sourceJSON",void 0),y([w()],Zs.prototype,"thumbnail",void 0),y([w({readOnly:!0})],Zs.prototype,"thumbnailUrl",null),y([w()],Zs.prototype,"units",void 0),y([w({readOnly:!0})],Zs.prototype,"userContentUrl",null),y([w({readOnly:!0})],Zs.prototype,"url",null),y([w()],Zs.prototype,"username",void 0),y([w()],Zs.prototype,"userType",void 0),Zs=jJ=y([Z("esri.portal.PortalUser")],Zs);const Gse=Zs;var K1;let K6;const lpe={PortalGroup:()=>Promise.resolve({default:BJ}),PortalItem:()=>we(()=>Promise.resolve().then(()=>YOe),void 0),PortalUser:()=>Promise.resolve({default:Gse})};let wt=K1=class extends F_(Wf){constructor(t){super(t),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=Mr.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(t){return typeof t=="string"?{url:t}:t}destroy(){cpe.unregister(this),this.defaultBasemap=et(this.defaultBasemap),this.defaultDevBasemap=et(this.defaultDevBasemap),this.defaultVectorBasemap=et(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=en(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(t){if(t)for(const e of t)Mr.request.trustedServers.includes(e)||Mr.request.trustedServers.push(e);return t}readDefaultBasemap(t){return this._readBasemap(t)}readDefaultDevBasemap(t){return this._readBasemap(t)}readDefaultVectorBasemap(t){return this._readBasemap(t)}get extraQuery(){var i;const t=(i=this.user)==null?void 0:i.orgId,e=!t||this.canSearchPublic;return this.id&&!e?` AND orgid:${this.id}`:null}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let t=this.url;if(t){const e=t.indexOf("/sharing");t=e>0?t.substring(0,e):this.url.replace(/\/+$/,""),t+="/sharing/rest"}return t}get thumbnailUrl(){const t=this.restUrl,e=this.thumbnail;return t&&e?this._normalizeSSL(t+"/portals/self/resources/"+e):null}readUrlKey(t){return t&&t.toLowerCase()}readUser(t){let e=null;return t&&(e=Gse.fromJSON(t),e.portal=this),e}load(t){const e=we(()=>Promise.resolve().then(()=>put),void 0).then(({default:i})=>{St(t),K6=i}).then(()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,t)).then(i=>{var r;if(yr){const n=yr;this.credential=n.findCredential(this.restUrl),this.credential||this.authMode!==K1.AUTH_MODE_AUTO||((r=this._esriIdCredentialCreateHandle)==null||r.remove(),this._esriIdCredentialCreateHandle=n.on("credential-create",Stt(new WeakRef(this))),cpe.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=i,this.read(i)});return this.addResolvingPromise(e),Promise.resolve(this)}async createElevationLayers(){await this.load();const t=this._getHelperService("defaultElevationLayers"),e=(await we(()=>Promise.resolve().then(()=>Jje),void 0)).default;return t?t.map(i=>new e({id:i.id,url:i.url})):[]}async fetchBasemaps(t,e){const i=await this._fetchBasemaps(t,e);if((e==null?void 0:e.include3d)===!0&&this.use3dBasemaps!==!1){const r=await this._fetchBasemaps3D(t,e);i.unshift(...r)}return i}fetchCategorySchema(t){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",t).then(e=>e.categorySchema):So(t)?Promise.reject(ur()):Promise.resolve([])}fetchFeaturedGroups(t){const e=this.featuredGroups,i=new dy;if(i.num=100,i.sortField="title",e&&e.length){const r=[];for(const n of e)r.push(`(title:"${n.title}" AND owner:${n.owner})`);return i.query=r.join(" OR "),this.queryGroups(i,t).then(n=>n.results)}return So(t)?Promise.reject(ur()):Promise.resolve([])}fetchRegions(t){var i;const e=((i=this.user)==null?void 0:i.culture)||this.culture||ma();return this.request(this.restUrl+"/portals/regions",{...t,query:{culture:e}})}fetchSettings(t){var i;const e=((i=this.user)==null?void 0:i.culture)||this.culture||ma();return this.request(this.restUrl+"/portals/self/settings",{...t,query:{culture:e}})}static getDefault(){return _tt(()=>new K1)}queryGroups(t,e){return this.queryPortal("/community/groups",t,"PortalGroup",e)}queryItems(t,e){return this.queryPortal("/search",t,"PortalItem",e)}queryUsers(t,e){return t.sortField||(t.sortField="username"),this.queryPortal("/community/users",t,"PortalUser",e)}fetchSelf(t=this.authMode,e=!1,i){const r=this.restUrl+"/portals/self",n={authMode:t,query:{culture:ma().toLowerCase()},...i};return n.authMode==="auto"&&(n.authMode="no-prompt"),e&&(n.query.default=!0),this.request(r,n)}queryPortal(t,e,i,r){const n=_s(dy,e),s=o=>this.request(this.restUrl+t,{...n.toRequestOptions(this),...r}).then(a=>{const c=n.clone();return c.start=a.nextStart,new wtt({nextQueryParams:c,queryParams:n,total:a.total,results:K1._resultsToTypedArray(o,{portal:this},a,r)})}).then(a=>Promise.all(a.results.map(c=>typeof c.when=="function"?c.when():a)).then(()=>a,c=>(Uo(c),a)));return i&&lpe[i]?lpe[i]().then(({default:o})=>(St(r),s(o))):s()}signIn(){if(this.authMode===K1.AUTH_MODE_ANONYMOUS)return Promise.reject(new se("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if(this.loadStatus==="failed")return Promise.reject(this.loadError);const t=e=>Promise.resolve().then(()=>this.loadStatus==="not-loaded"?(e||(this.authMode="immediate"),this.load().then(()=>null)):this.loadStatus==="loading"?this.load().then(()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate"))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate"))).then(i=>{i&&(this.sourceJSON=i,this.read(i))});return yr?yr.getCredential(this.restUrl).then(e=>t(e)):t(this.credential)}normalizeUrl(t){var i;const e=(i=this.credential)==null?void 0:i.token;return this._normalizeSSL(e?t+(t.includes("?")?"&":"?")+"token="+e:t)}requestToTypedArray(t,e,i){return this.request(t,e).then(r=>{const n=K1._resultsToTypedArray(i,{portal:this},r);return Promise.all(n.map(s=>typeof s.when=="function"?s.when():r)).then(()=>n,()=>n)})}request(t,e={}){const i={f:"json",...e.query},{authMode:r=this.authMode===K1.AUTH_MODE_ANONYMOUS?"anonymous":"auto",body:n=null,cacheBust:s=!1,method:o="auto",responseType:a="json",signal:c}=e,p={authMode:r,body:n,cacheBust:s,method:o,query:i,responseType:a,timeout:0,signal:c};return yi(this._normalizeSSL(t),p).then(_=>_.data)}toJSON(){throw new se("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");return new K1({sourceJSON:t})}_getHelperService(t){const e=this.helperServices&&this.helperServices[t];if(!e)throw new se("portal:service-not-found",`The \`helperServices\` do not include an entry named "${t}"`);return e}async _fetchBasemaps(t,e){const i=new dy;i.query=t||(Mr.apiKey&&kne(this.url)?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),i.disableExtraQuery=!0;const r=await this.queryGroups(i,e);if(!r.total)return[];const n=r.results[0];i.num=100,i.query='type:"Web Map" -type:"Web Application"',i.sortField=n.sortField||"name",i.sortOrder=n.sortOrder||"desc";const s=await n.queryItems(i,e);return s.total?s.results.filter(o=>o.type==="Web Map").map(o=>new K6({portalItem:o})):[]}async _fetchBasemaps3D(t,e){const i=t||this.basemapGalleryGroupQuery3D;if(!i)return[];const r=new dy({query:i,disableExtraQuery:!0}),n=await this.queryGroups(r,e);if(!n.total)return[];const s=n.results[0];r.num=100,r.query='type:"Web Scene"',r.sortField=s.sortField||"name",r.sortOrder=s.sortOrder||"desc";const o=await s.queryItems(r,e);return o.total?o.results.filter(a=>a.type==="Web Scene").map(a=>new K6({portalItem:a})):[]}_normalizeSSL(t){return t.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(t){if(t){const e=K6.fromJSON(t);return e.portalItem={portal:this},e}return null}static _resultsToTypedArray(t,e,i,r){let n=[];if(i){const s=r!=null?r.signal:null;n=i.listings||i.notifications||i.userInvitations||i.tags||i.items||i.groups||i.comments||i.provisions||i.results||i.relatedItems||i,(t||e)&&(n=n.map(o=>{const a=Object.assign(t?t.fromJSON(o):o,e);return typeof a.load=="function"&&a.load(s),a}))}else n=[];return n}};wt.AUTH_MODE_ANONYMOUS="anonymous",wt.AUTH_MODE_AUTO="auto",wt.AUTH_MODE_IMMEDIATE="immediate",y([w()],wt.prototype,"access",void 0),y([w()],wt.prototype,"allSSL",void 0),y([w()],wt.prototype,"authMode",void 0),y([w()],wt.prototype,"authorizedCrossOriginDomains",void 0),y([Rt("authorizedCrossOriginDomains")],wt.prototype,"readAuthorizedCrossOriginDomains",null),y([w()],wt.prototype,"basemapGalleryGroupQuery",void 0),y([w({json:{name:"3DBasemapGalleryGroupQuery"}})],wt.prototype,"basemapGalleryGroupQuery3D",void 0),y([w()],wt.prototype,"bingKey",void 0),y([w()],wt.prototype,"canListApps",void 0),y([w()],wt.prototype,"canListData",void 0),y([w()],wt.prototype,"canListPreProvisionedItems",void 0),y([w()],wt.prototype,"canProvisionDirectPurchase",void 0),y([w()],wt.prototype,"canSearchPublic",void 0),y([w()],wt.prototype,"canShareBingPublic",void 0),y([w()],wt.prototype,"canSharePublic",void 0),y([w()],wt.prototype,"canSignInArcGIS",void 0),y([w()],wt.prototype,"canSignInIDP",void 0),y([w()],wt.prototype,"colorSetsGroupQuery",void 0),y([w()],wt.prototype,"commentsEnabled",void 0),y([w({type:Date})],wt.prototype,"created",void 0),y([w()],wt.prototype,"credential",void 0),y([w()],wt.prototype,"culture",void 0),y([w()],wt.prototype,"currentVersion",void 0),y([w()],wt.prototype,"customBaseUrl",void 0),y([w()],wt.prototype,"defaultBasemap",void 0),y([Rt("defaultBasemap")],wt.prototype,"readDefaultBasemap",null),y([w()],wt.prototype,"defaultDevBasemap",void 0),y([Rt("defaultDevBasemap")],wt.prototype,"readDefaultDevBasemap",null),y([w({type:Vi})],wt.prototype,"defaultExtent",void 0),y([w()],wt.prototype,"defaultVectorBasemap",void 0),y([Rt("defaultVectorBasemap")],wt.prototype,"readDefaultVectorBasemap",null),y([w()],wt.prototype,"description",void 0),y([w()],wt.prototype,"devBasemapGalleryGroupQuery",void 0),y([w()],wt.prototype,"eueiEnabled",void 0),y([w({readOnly:!0})],wt.prototype,"extraQuery",null),y([w()],wt.prototype,"featuredGroups",void 0),y([w()],wt.prototype,"featuredItemsGroupQuery",void 0),y([w()],wt.prototype,"galleryTemplatesGroupQuery",void 0),y([w()],wt.prototype,"livingAtlasGroupQuery",void 0),y([w()],wt.prototype,"hasCategorySchema",void 0),y([w()],wt.prototype,"helpBase",void 0),y([w()],wt.prototype,"helperServices",void 0),y([w()],wt.prototype,"helpMap",void 0),y([w()],wt.prototype,"homePageFeaturedContent",void 0),y([w()],wt.prototype,"homePageFeaturedContentCount",void 0),y([w()],wt.prototype,"httpPort",void 0),y([w()],wt.prototype,"httpsPort",void 0),y([w()],wt.prototype,"id",void 0),y([w()],wt.prototype,"ipCntryCode",void 0),y([w({readOnly:!0})],wt.prototype,"isOrganization",null),y([w()],wt.prototype,"isPortal",void 0),y([w()],wt.prototype,"isReadOnly",void 0),y([w({readOnly:!0})],wt.prototype,"itemPageUrl",null),y([w()],wt.prototype,"layerTemplatesGroupQuery",void 0),y([w()],wt.prototype,"maxTokenExpirationMinutes",void 0),y([w({type:Date})],wt.prototype,"modified",void 0),y([w()],wt.prototype,"name",void 0),y([w()],wt.prototype,"portalHostname",void 0),y([w()],wt.prototype,"portalMode",void 0),y([w()],wt.prototype,"portalProperties",void 0),y([w()],wt.prototype,"region",void 0),y([w({readOnly:!0})],wt.prototype,"restUrl",null),y([w()],wt.prototype,"rotatorPanels",void 0),y([w()],wt.prototype,"showHomePageDescription",void 0),y([w()],wt.prototype,"sourceJSON",void 0),y([w()],wt.prototype,"staticImagesUrl",void 0),y([w({json:{name:"2DStylesGroupQuery"}})],wt.prototype,"stylesGroupQuery2d",void 0),y([w({json:{name:"stylesGroupQuery"}})],wt.prototype,"stylesGroupQuery3d",void 0),y([w()],wt.prototype,"supportsHostedServices",void 0),y([w()],wt.prototype,"symbolSetsGroupQuery",void 0),y([w()],wt.prototype,"templatesGroupQuery",void 0),y([w()],wt.prototype,"thumbnail",void 0),y([w({readOnly:!0})],wt.prototype,"thumbnailUrl",null),y([w()],wt.prototype,"units",void 0),y([w()],wt.prototype,"url",void 0),y([w()],wt.prototype,"urlKey",void 0),y([Rt("urlKey")],wt.prototype,"readUrlKey",null),y([w()],wt.prototype,"user",void 0),y([Rt("user")],wt.prototype,"readUser",null),y([w()],wt.prototype,"use3dBasemaps",void 0),y([w()],wt.prototype,"useStandardizedQuery",void 0),y([w()],wt.prototype,"useVectorBasemaps",void 0),y([w()],wt.prototype,"vectorBasemapGalleryGroupQuery",void 0),wt=K1=y([Z("esri.portal.Portal")],wt);const os=wt,cpe=new FinalizationRegistry(t=>{t.remove()});function Stt(t){const e=yr;return()=>{const i=t.deref();i&&e.findCredential(i.restUrl)&&i.signIn().catch(()=>{})}}let A3=class extends Xs(Ue){constructor(e){super(e),this.type="style",this.placement="begin-end",this.style="arrow",this.color=null}equals(e){return e!=null&&e.placement===this.placement&&e.style===this.style&&(this.color==null&&e.color==null||this.color!=null&&e.color!=null&&this.color.toJSON()===e.color.toJSON())}};y([w({type:["style"],readOnly:!0,json:{read:!0,write:{ignoreOrigin:!0}}})],A3.prototype,"type",void 0),y([w({type:jet,json:{default:"begin-end",write:!0}})],A3.prototype,"placement",void 0),y([w({type:aMe,json:{default:"arrow",write:!0}})],A3.prototype,"style",void 0),y([w({type:qe,json:{type:[_n],default:null,write:!0}})],A3.prototype,"color",void 0),A3=y([Z("esri.symbols.LineStyleMarker3D")],A3);const GJ=A3;var H7;let Mg=H7=class extends p1{constructor(t){super(t),this.material=null,this.type="line",this.join="miter",this.cap="butt",this.size=cd(1),this.pattern=null,this.marker=null}clone(){const t={enabled:this.enabled,material:this.material!=null?this.material.clone():null,size:this.size,join:this.join,cap:this.cap,pattern:this.pattern!=null?this.pattern.clone():null,marker:this.marker!=null?this.marker.clone():null};return new H7(t)}static fromSimpleLineSymbol(t){var i;const e={enabled:!0,size:t.width??cd(1),cap:t.cap||"butt",join:t.join||"miter",pattern:t.style&&t.style!=="inside-frame"?new zse({style:t.style}):null,material:new _p({color:(t.color||l$).clone()}),marker:t.marker?new GJ({placement:t.marker.placement,style:t.marker.style,color:((i=t.marker.color)==null?void 0:i.clone())??null}):null};return new H7(e)}};y([w({type:_p,json:{write:!0}})],Mg.prototype,"material",void 0),y([Vt({Line:"line"},{readOnly:!0})],Mg.prototype,"type",void 0),y([w({type:vMe,json:{write:!0,default:"miter"}})],Mg.prototype,"join",void 0),y([w({type:jse,json:{write:!0,default:"butt"}})],Mg.prototype,"cap",void 0),y([w(Jy)],Mg.prototype,"size",void 0),y([w(dMe)],Mg.prototype,"pattern",void 0),y([w({types:{key:"type",base:GJ,typeMap:{style:GJ}},json:{write:!0}})],Mg.prototype,"marker",void 0),Mg=H7=y([Z("esri.symbols.LineSymbol3DLayer")],Mg);const U9=Mg;var HJ;const Ttt=gu()({sphere:"sphere",cylinder:"cylinder",cube:"cube",cone:"cone",diamond:"diamond",tetrahedron:"tetrahedron",invertedCone:"inverted-cone"});let EI=HJ=class extends Ue{clone(){return new HJ({href:this.href,primitive:this.primitive})}};y([w({type:String,json:{read:BB,write:N2}})],EI.prototype,"href",void 0),y([Vt(Ttt)],EI.prototype,"primitive",void 0),EI=HJ=y([Z("esri.symbols.support.ObjectSymbol3DLayerResource")],EI);const Hse="sphere";var qJ;let OS=qJ=class extends ze{constructor(){super(...arguments),this.x=0,this.y=0,this.z=0}clone(){return new qJ({x:this.x,y:this.y,z:this.z})}};y([w({type:Number})],OS.prototype,"x",void 0),y([w({type:Number})],OS.prototype,"y",void 0),y([w({type:Number})],OS.prototype,"z",void 0),OS=qJ=y([Z("esri.symbols.support.Symbol3DAnchorPosition3D")],OS);var WJ;let Wc=WJ=class extends p1{constructor(t){super(t),this.material=null,this.castShadows=!0,this.resource=null,this.type="object",this.width=void 0,this.height=void 0,this.depth=void 0,this.anchor=void 0,this.anchorPosition=void 0,this.heading=void 0,this.tilt=void 0,this.roll=void 0}clone(){var t,e,i;return new WJ({heading:this.heading,tilt:this.tilt,roll:this.roll,anchor:this.anchor,anchorPosition:(t=this.anchorPosition)==null?void 0:t.clone(),depth:this.depth,enabled:this.enabled,height:this.height,material:((e=this.material)==null?void 0:e.clone())??null,castShadows:this.castShadows,resource:(i=this.resource)==null?void 0:i.clone(),width:this.width})}get isPrimitive(){return!this.resource||typeof this.resource.href!="string"}};y([w({type:_p,json:{write:!0}})],Wc.prototype,"material",void 0),y([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!0}})],Wc.prototype,"castShadows",void 0),y([w({type:EI,json:{write:!0}})],Wc.prototype,"resource",void 0),y([Vt({Object:"object"},{readOnly:!0})],Wc.prototype,"type",void 0),y([w({type:Number,json:{write:!0}})],Wc.prototype,"width",void 0),y([w({type:Number,json:{write:!0}})],Wc.prototype,"height",void 0),y([w({type:Number,json:{write:!0}})],Wc.prototype,"depth",void 0),y([Vt({center:"center",top:"top",bottom:"bottom",origin:"origin",relative:"relative"}),w({json:{default:"origin"}})],Wc.prototype,"anchor",void 0),y([w({type:OS,json:{type:[Number],read:{reader:t=>new OS({x:t[0],y:t[1],z:t[2]})},write:{writer:(t,e)=>{e.anchorPosition=[t.x,t.y,t.z]},overridePolicy(){return{enabled:this.anchor==="relative"}}}}})],Wc.prototype,"anchorPosition",void 0),y([w({type:Number,json:{write:!0}})],Wc.prototype,"heading",void 0),y([w({type:Number,json:{write:!0}})],Wc.prototype,"tilt",void 0),y([w({type:Number,json:{write:!0}})],Wc.prototype,"roll",void 0),y([w({readOnly:!0})],Wc.prototype,"isPrimitive",null),Wc=WJ=y([Z("esri.symbols.ObjectSymbol3DLayer")],Wc);const qse=Wc;var YJ;let Mu=YJ=class extends p1{constructor(t){super(t),this.material=null,this.castShadows=!0,this.type="path",this.profile="circle",this.join="miter",this.cap="butt",this.width=void 0,this.height=void 0,this.anchor="center",this.profileRotation="all"}readWidth(t,e){return t??(e.height==null&&e.size!=null?e.size:void 0)}readHeight(t,e){return t??(e.width==null&&e.size!=null?e.size:void 0)}clone(){return new YJ({enabled:this.enabled,material:this.material!=null?this.material.clone():null,castShadows:this.castShadows,profile:this.profile,join:this.join,cap:this.cap,width:this.width,height:this.height,profileRotation:this.profileRotation,anchor:this.anchor})}};y([w({type:_p,json:{write:!0}})],Mu.prototype,"material",void 0),y([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!0}})],Mu.prototype,"castShadows",void 0),y([Vt({Path:"path"},{readOnly:!0})],Mu.prototype,"type",void 0),y([w({type:["circle","quad"],json:{write:!0,default:"circle"}})],Mu.prototype,"profile",void 0),y([w({type:vMe,json:{write:!0,default:"miter"}})],Mu.prototype,"join",void 0),y([w({type:ltt,json:{write:!0,default:"butt"}})],Mu.prototype,"cap",void 0),y([w({type:Number,json:{write:{enabled:!0,target:{width:{type:Number},size:{type:Number}}}}})],Mu.prototype,"width",void 0),y([Rt("width",["width","size","height"])],Mu.prototype,"readWidth",null),y([w({type:Number,json:{write:!0}})],Mu.prototype,"height",void 0),y([Rt("height",["height","size","width"])],Mu.prototype,"readHeight",null),y([w({type:["center","bottom","top"],json:{write:!0,default:"center"}})],Mu.prototype,"anchor",void 0),y([w({type:["heading","all"],json:{write:!0,default:"all"}})],Mu.prototype,"profileRotation",void 0),Mu=YJ=y([Z("esri.symbols.PathSymbol3DLayer")],Mu);const Wse=Mu;var XJ;let PM=XJ=class extends Ue{constructor(){super(...arguments),this.color=new qe([0,0,0,1]),this.size=0}clone(){const t={color:Pe(this.color),size:this.size};return new XJ(t)}};y([w(U_)],PM.prototype,"color",void 0),y([w(Jy)],PM.prototype,"size",void 0),PM=XJ=y([Z("esri.symbols.support.Symbol3DHalo")],PM);let u$=class extends Xs(Ue){constructor(e){super(e),this.color=null}};y([w(U_)],u$.prototype,"color",void 0),u$=y([Z("esri.symbols.support.Symbol3DTextBackground")],u$);var q7;let wh=q7=class extends p1{constructor(t){super(t),this._userSize=void 0,this.halo=null,this.horizontalAlignment="center",this.lineHeight=1,this.material=null,this.background=null,this.text=null,this.type="text",this.verticalAlignment="baseline"}get font(){return this._get("font")||null}set font(t){t!=null&&this._userSize!=null&&(t.size=this._userSize),this._set("font",t)}writeFont(t,e,i,r){const n={...r,textSymbol3D:!0};e.font=t.write({},n),delete e.font.size}get size(){var t;return this._userSize!=null?this._userSize:((t=this.font)==null?void 0:t.size)!=null?this.font.size:9}set size(t){this._userSize=t,this.font!=null&&(this.font.size=this._userSize),this.notifyChange("size")}clone(){const t=new q7({enabled:this.enabled,font:this.font&&Pe(this.font),halo:this.halo&&Pe(this.halo),horizontalAlignment:this.horizontalAlignment,lineHeight:this.lineHeight,material:this.material!=null?this.material.clone():null,text:this.text,verticalAlignment:this.verticalAlignment,background:Pe(this.background)});return t._userSize=this._userSize,t}static fromTextSymbol(t){return new q7({font:t.font!=null?t.font.clone():new VB,halo:Ett(t.haloColor,t.haloSize),horizontalAlignment:t.horizontalAlignment,lineHeight:t.lineHeight,material:t.color?new _p({color:t.color.clone()}):null,text:t.text,verticalAlignment:t.verticalAlignment,background:t.backgroundColor?new u$({color:t.backgroundColor.clone()}):null})}};function Ett(t,e){return t&&e!=null&&e>0?new PM({color:Pe(t),size:e}):null}y([w({type:VB,json:{write:!0}})],wh.prototype,"font",null),y([Et("font")],wh.prototype,"writeFont",null),y([w({type:PM,json:{write:!0}})],wh.prototype,"halo",void 0),y([w({...bMe,json:{default:"center",write:!0}})],wh.prototype,"horizontalAlignment",void 0),y([w({..._Me,json:{default:1,write:!0}})],wh.prototype,"lineHeight",void 0),y([w({type:_p,json:{write:!0}})],wh.prototype,"material",void 0),y([w({type:u$,json:{write:!0}})],wh.prototype,"background",void 0),y([w(Jy)],wh.prototype,"size",null),y([w({type:String,json:{write:!0}})],wh.prototype,"text",void 0),y([Vt({Text:"text"},{readOnly:!0})],wh.prototype,"type",void 0),y([w({...wMe,json:{default:"baseline",write:!0}})],wh.prototype,"verticalAlignment",void 0),wh=q7=y([Z("esri.symbols.TextSymbol3DLayer")],wh);const bE=wh;var ZJ;let Xb=ZJ=class extends p1{constructor(t){super(t),this.color=JJ.clone(),this.type="water",this.waterbodySize="medium",this.waveDirection=null,this.waveStrength="moderate"}clone(){return new ZJ({color:Pe(this.color),waterbodySize:this.waterbodySize,waveDirection:this.waveDirection,waveStrength:this.waveStrength})}};y([w({type:qe,nonNullable:!0,json:{type:[_n],write:(t,e,i)=>e[i]=t.toArray(qe.AlphaMode.UNLESS_OPAQUE),default:()=>JJ.clone(),defaultEquals:t=>t.toCss(!0)===JJ.toCss(!0)}})],Xb.prototype,"color",void 0),y([Vt({Water:"water"},{readOnly:!0})],Xb.prototype,"type",void 0),y([w({type:["small","medium","large"],json:{write:!0,default:"medium"}})],Xb.prototype,"waterbodySize",void 0),y([w({type:Number,json:{write:!0,default:null}})],Xb.prototype,"waveDirection",void 0),y([w({type:["calm","rippled","slight","moderate"],json:{write:!0,default:"moderate"}})],Xb.prototype,"waveStrength",void 0),Xb=ZJ=y([Z("esri.symbols.WaterSymbol3DLayer")],Xb);const JJ=new qe([0,119,190]),MMe=Xb;var KJ;let M3=KJ=class extends ze{constructor(t){super(t),this.name=null,this.styleUrl=null,this.styleName=null,this.portal=null}clone(){return new KJ({name:this.name,styleUrl:this.styleUrl,styleName:this.styleName,portal:this.portal})}};y([w({type:String})],M3.prototype,"name",void 0),y([w({type:String})],M3.prototype,"styleUrl",void 0),y([w({type:String})],M3.prototype,"styleName",void 0),y([w({type:os})],M3.prototype,"portal",void 0),M3=KJ=y([Z("esri.symbols.support.StyleOrigin")],M3);const EL=M3;var QJ;let vT=QJ=class extends ze{constructor(){super(...arguments),this.url=""}clone(){return new QJ({url:this.url})}};y([w({type:String})],vT.prototype,"url",void 0),vT=QJ=y([Z("esri.symbols.support.Thumbnail")],vT);const OMe={icon:s2,object:qse,line:U9,path:Wse,fill:b5,extrude:oMe,text:bE,water:MMe},Ctt=tt.ofType({base:p1,key:"type",typeMap:OMe,errorContext:"symbol-layer"});let Og=class extends vd{constructor(e){super(e),this.styleOrigin=null,this.thumbnail=null,this.type=null;const i=this.__accessor__&&this.__accessor__.metadatas&&this.__accessor__.metadatas.symbolLayers,r=i==null?void 0:i.type,n=r||tt;this._set("symbolLayers",new n)}get color(){return null}set color(e){this.constructed&&Ce.getLogger(this).error("Symbol3D does not support colors on the symbol level. Colors may be set on individual symbol layer materials instead.")}set symbolLayers(e){od(e,this._get("symbolLayers"))}readStyleOrigin(e,i,r){if(e.styleUrl&&e.name){const n=w_(e.styleUrl,r);return new EL({styleUrl:n,name:e.name})}if(e.styleName&&e.name)return new EL({portal:(r==null?void 0:r.portal)||os.getDefault(),styleName:e.styleName,name:e.name});r!=null&&r.messages&&r.messages.push(new Hf("symbol3d:incomplete-style-origin","Style origin requires either a 'styleUrl' or 'styleName' and a 'name' property",{context:r,definition:e}))}writeStyleOrigin(e,i,r,n){if(e.styleUrl&&e.name){let s=x_(e.styleUrl,n);Qh(s)&&(s=$f(s)),i.styleOrigin={styleUrl:s,name:e.name}}else e.styleName&&e.name&&(e.portal&&(n!=null&&n.portal)&&!DTe(e.portal.restUrl,n.portal.restUrl)?n!=null&&n.messages&&n.messages.push(new Hf("symbol:cross-portal","The symbol style origin cannot be persisted because it refers to an item on a different portal than the one being saved to.",{symbol:this})):i.styleOrigin={styleName:e.styleName,name:e.name})}normalizeCtorArgs(e){return e instanceof p1||e&&OMe[e.type]?{symbolLayers:[e]}:Array.isArray(e)?{symbolLayers:e}:e}};y([w({json:{read:!1,write:!1}})],Og.prototype,"color",null),y([w({type:Ctt,nonNullable:!0,json:{write:!0}}),Ci(o5)],Og.prototype,"symbolLayers",null),y([w({type:EL})],Og.prototype,"styleOrigin",void 0),y([Rt("styleOrigin")],Og.prototype,"readStyleOrigin",null),y([Et("styleOrigin",{"styleOrigin.styleUrl":{type:String},"styleOrigin.styleName":{type:String},"styleOrigin.name":{type:String}})],Og.prototype,"writeStyleOrigin",null),y([w({type:vT,json:{read:!1}})],Og.prototype,"thumbnail",void 0),y([w({type:["point-3d","line-3d","polygon-3d","mesh-3d","label-3d"],readOnly:!0})],Og.prototype,"type",void 0),Og=y([Z("esri.symbols.Symbol3D")],Og);const w5=Og;let CI=class extends Ue{constructor(e){super(e),this.visible=!0}clone(){}};y([w({type:["line"],constructOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],CI.prototype,"type",void 0),y([w({readOnly:!0})],CI.prototype,"visible",void 0),CI=y([Z("esri.symbols.callouts.Callout3D")],CI);const PMe=CI;var eK;let W7=eK=class extends Ue{constructor(t){super(t),this.color=new qe("white")}clone(){return new eK({color:Pe(this.color)})}};y([w(U_)],W7.prototype,"color",void 0),W7=eK=y([Z("esri.symbols.callouts.LineCallout3DBorder")],W7);const Att=W7;var tK;let Zb=tK=class extends PMe{constructor(t){super(t),this.type="line",this.color=new qe([0,0,0,1]),this.size=cd(1),this.border=null}get visible(){return this.size>0&&this.color!=null&&this.color.a>0}clone(){return new tK({color:Pe(this.color),size:this.size,border:Pe(this.border)})}};y([Vt({line:"line"})],Zb.prototype,"type",void 0),y([w(U_)],Zb.prototype,"color",void 0),y([w(Jy)],Zb.prototype,"size",void 0),y([w({type:Att,json:{write:!0}})],Zb.prototype,"border",void 0),y([w({readOnly:!0})],Zb.prototype,"visible",null),Zb=tK=y([Z("esri.symbols.callouts.LineCallout3D")],Zb);const RMe=Zb;function Yse(t){if(!t)return!1;const e=t.verticalOffset;return!!e&&!(e.screenLength<=0||e.maxWorldLength!=null&&e.maxWorldLength<=0)}function IMe(t){if(!t||!t.supportsCallout||!t.supportsCallout())return!1;const e=t.callout;return!!e&&!!e.visible&&!!Yse(t)}function Xse(t){return t.type==="point-3d"||t.type==="label-3d"}function $Me(t){return t.horizontalAlignment==="center"}const LMe={types:{key:"type",base:PMe,typeMap:{line:RMe}},json:{write:!0}};var iK;let bA=iK=class extends Ue{constructor(t){super(t),this.screenLength=0,this.minWorldLength=0,this.maxWorldLength=null}clone(){return new iK({screenLength:this.screenLength,minWorldLength:this.minWorldLength,maxWorldLength:this.maxWorldLength})}};y([w(Jy)],bA.prototype,"screenLength",void 0),y([w({type:Number,nonNullable:!0,json:{write:!0,default:0}})],bA.prototype,"minWorldLength",void 0),y([w({type:Number,json:{write:!0}})],bA.prototype,"maxWorldLength",void 0),bA=iK=y([Z("esri.symbols.support.Symbol3DVerticalOffset")],bA);const Zse=bA;var Y7;const DMe=tt.ofType({base:null,key:"type",typeMap:{text:bE}});let Jb=Y7=class extends w5{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.styleOrigin=null,this.symbolLayers=new DMe,this.type="label-3d"}supportsCallout(){return!0}hasVisibleCallout(){return IMe(this)}hasVisibleVerticalOffset(){return Yse(this)}clone(){return new Y7({styleOrigin:Pe(this.styleOrigin),symbolLayers:Pe(this.symbolLayers),thumbnail:Pe(this.thumbnail),callout:Pe(this.callout),verticalOffset:Pe(this.verticalOffset)})}static fromTextSymbol(t){return new Y7({symbolLayers:new tt([bE.fromTextSymbol(t)])})}};y([w({type:Zse,json:{write:!0}})],Jb.prototype,"verticalOffset",void 0),y([w(LMe)],Jb.prototype,"callout",void 0),y([w({json:{read:!1,write:!1}})],Jb.prototype,"styleOrigin",void 0),y([w({type:DMe})],Jb.prototype,"symbolLayers",void 0),y([Vt({LabelSymbol3D:"label-3d"},{readOnly:!0})],Jb.prototype,"type",void 0),Jb=Y7=y([Z("esri.symbols.LabelSymbol3D")],Jb);const jB=Jb;var X7;const NMe=tt.ofType({base:null,key:"type",typeMap:{line:U9,path:Wse}}),Mtt=tt.ofType({base:null,key:"type",typeMap:{line:U9,path:Wse}});let AI=X7=class extends w5{constructor(t){super(t),this.symbolLayers=new NMe,this.type="line-3d"}clone(){return new X7({styleOrigin:Pe(this.styleOrigin),symbolLayers:Pe(this.symbolLayers),thumbnail:Pe(this.thumbnail)})}static fromSimpleLineSymbol(t){return new X7({symbolLayers:new tt([U9.fromSimpleLineSymbol(t)])})}};y([w({type:NMe,json:{type:Mtt}})],AI.prototype,"symbolLayers",void 0),y([Vt({LineSymbol3D:"line-3d"},{readOnly:!0})],AI.prototype,"type",void 0),AI=X7=y([Z("esri.symbols.LineSymbol3D")],AI);const GB=AI;let Kb=class extends vd{constructor(e){super(e),this.angle=0,this.type=null,this.xoffset=0,this.yoffset=0,this.size=9}hash(){return`${this.type}.${this.angle}.${this.size}.${this.xoffset}.${this.yoffset}`}};y([w({type:Number,json:{read:t=>t&&-1*t,write:(t,e)=>e.angle=t&&-1*t}})],Kb.prototype,"angle",void 0),y([w({type:["simple-marker","picture-marker"],readOnly:!0})],Kb.prototype,"type",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Kb.prototype,"xoffset",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Kb.prototype,"yoffset",void 0),y([w({type:Number,cast:t=>t==="auto"?t:vs(t),json:{write:!0}})],Kb.prototype,"size",void 0),Kb=y([Z("esri.symbols.MarkerSymbol")],Kb);const FMe=Kb;var Z7;const kMe=tt.ofType({base:null,key:"type",typeMap:{fill:b5}});let MI=Z7=class extends w5{constructor(t){super(t),this.symbolLayers=new kMe,this.type="mesh-3d"}clone(){return new Z7({styleOrigin:Pe(this.styleOrigin),symbolLayers:Pe(this.symbolLayers),thumbnail:Pe(this.thumbnail)})}static fromSimpleFillSymbol(t){return new Z7({symbolLayers:new tt([b5.fromSimpleFillSymbol(t)])})}};y([w({type:kMe})],MI.prototype,"symbolLayers",void 0),y([Vt({MeshSymbol3D:"mesh-3d"},{readOnly:!0})],MI.prototype,"type",void 0),MI=Z7=y([Z("esri.symbols.MeshSymbol3D")],MI);const V9=MI;function Ott(t,e,i){return e.imageData?FTe({mediaType:e.contentType||"image/png",isBase64:!0,data:e.imageData}):zMe(e.url,i)}function zMe(t,e){var i;return Rtt(e)&&!Qh(t)&&((i=e==null?void 0:e.layer)!=null&&i.parsedUrl)?Pp(e.layer.parsedUrl.path,"images",t):w_(t,e)}function Ptt(t,e,i,r){if(c1(t)){const n=I2(t);if(!n)return;e.contentType=n.mediaType,e.imageData=n.data,i&&i.imageData===e.imageData&&i.url&&N2(i.url,e,"url",r)}else N2(t,e,"url",r)}const UMe={json:{read:{source:["imageData","url"],reader:Ott},write:{writer(t,e,i,r){Ptt(t,e,this.source,r)}}}},VMe={readOnly:!0,json:{read:{source:["imageData","url"],reader(t,e,i){const r={};return e.imageData&&(r.imageData=e.imageData),e.contentType&&(r.contentType=e.contentType),e.url&&(r.url=zMe(e.url,i)),r}}}};function Rtt(t){var e,i;return!(t==null||t.origin!=="service"&&t.origin!=="portal-item"||((e=t.layer)==null?void 0:e.type)!=="feature"&&((i=t.layer)==null?void 0:i.type)!=="stream")}var rK;let Xp=rK=class extends lMe{constructor(...t){super(...t),this.type="picture-fill",this.url=null,this.xscale=1,this.yscale=1,this.width=12,this.height=12,this.xoffset=0,this.yoffset=0,this.source=null}normalizeCtorArgs(t,e,i,r){if(t&&typeof t!="string"&&t.imageData==null)return t;const n={};return t&&(n.url=t),e&&(n.outline=e),i!=null&&(n.width=vs(i)),r!=null&&(n.height=vs(r)),n}clone(){const t=new rK({color:Pe(this.color),height:this.height,outline:this.outline&&this.outline.clone(),url:this.url,width:this.width,xoffset:this.xoffset,xscale:this.xscale,yoffset:this.yoffset,yscale:this.yscale});return t._set("source",Pe(this.source)),t}hash(){var t;return`${super.hash()}.${(t=this.color)==null?void 0:t.hash()}.${this.height}.${this.url}.${this.width}.${this.xoffset}.${this.xscale}.${this.yoffset}.${this.yscale}`}};y([Vt({esriPFS:"picture-fill"},{readOnly:!0})],Xp.prototype,"type",void 0),y([w(UMe)],Xp.prototype,"url",void 0),y([w({type:Number,json:{write:!0}})],Xp.prototype,"xscale",void 0),y([w({type:Number,json:{write:!0}})],Xp.prototype,"yscale",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Xp.prototype,"width",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Xp.prototype,"height",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Xp.prototype,"xoffset",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],Xp.prototype,"yoffset",void 0),y([w(VMe)],Xp.prototype,"source",void 0),Xp=rK=y([Z("esri.symbols.PictureFillSymbol")],Xp);const BMe=Xp;var nK;let R0=nK=class extends FMe{constructor(...t){super(...t),this.color=null,this.type="picture-marker",this.url=null,this.source=null,this.height=12,this.width=12,this.size=null}normalizeCtorArgs(t,e,i){if(t&&typeof t!="string"&&t.imageData==null)return t;const r={};return t&&(r.url=t),e!=null&&(r.width=vs(e)),i!=null&&(r.height=vs(i)),r}readHeight(t,e){return e.size||t}readWidth(t,e){return e.size||t}clone(){const t=new nK({angle:this.angle,height:this.height,url:this.url,width:this.width,xoffset:this.xoffset,yoffset:this.yoffset});return t._set("source",Pe(this.source)),t}hash(){return`${super.hash()}.${this.height}.${this.url}.${this.width}`}};y([w({json:{write:!1}})],R0.prototype,"color",void 0),y([Vt({esriPMS:"picture-marker"},{readOnly:!0})],R0.prototype,"type",void 0),y([w(UMe)],R0.prototype,"url",void 0),y([w(VMe)],R0.prototype,"source",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],R0.prototype,"height",void 0),y([Rt("height",["height","size"])],R0.prototype,"readHeight",null),y([w({type:Number,cast:vs,json:{write:!0}})],R0.prototype,"width",void 0),y([w({json:{write:!1}})],R0.prototype,"size",void 0),R0=nK=y([Z("esri.symbols.PictureMarkerSymbol")],R0);const x5=R0;var O3;const jMe=tt.ofType({base:null,key:"type",typeMap:{icon:s2,object:qse,text:bE}});let P3=O3=class extends w5{constructor(t){super(t),this.verticalOffset=null,this.callout=null,this.symbolLayers=new jMe,this.type="point-3d"}supportsCallout(){if((this.symbolLayers?this.symbolLayers.length:0)<1)return!1;for(const t of this.symbolLayers.items)switch(t.type){case"icon":case"text":case"object":continue;default:return!1}return!0}hasVisibleCallout(){return IMe(this)}hasVisibleVerticalOffset(){return Yse(this)}clone(){return new O3({verticalOffset:Pe(this.verticalOffset),callout:Pe(this.callout),styleOrigin:Pe(this.styleOrigin),symbolLayers:Pe(this.symbolLayers),thumbnail:Pe(this.thumbnail)})}static fromSimpleMarkerSymbol(t){return new O3({symbolLayers:new tt([s2.fromSimpleMarkerSymbol(t)])})}static fromPictureMarkerSymbol(t){return new O3({symbolLayers:new tt([s2.fromPictureMarkerSymbol(t)])})}static fromCIMSymbol(t){var r,n;if(((n=(r=t.data)==null?void 0:r.symbol)==null?void 0:n.type)!=="CIMPointSymbol")return null;const i=t.data.symbol;return new O3(i!=null&&i.callout?{symbolLayers:new tt([s2.fromCIMSymbol(t)]),callout:new RMe({size:.5,color:new qe([0,0,0])}),verticalOffset:new Zse({screenLength:40})}:{symbolLayers:new tt([s2.fromCIMSymbol(t)])})}static fromTextSymbol(t){return new O3({symbolLayers:new tt([bE.fromTextSymbol(t)])})}};y([w({type:Zse,json:{write:!0}})],P3.prototype,"verticalOffset",void 0),y([w(LMe)],P3.prototype,"callout",void 0),y([w({type:jMe,json:{origins:{"web-scene":{write:!0}}}})],P3.prototype,"symbolLayers",void 0),y([Vt({PointSymbol3D:"point-3d"},{readOnly:!0})],P3.prototype,"type",void 0),P3=O3=y([Z("esri.symbols.PointSymbol3D")],P3);const o2=P3;function HB(t,e,i){return vy(t.map((r,n)=>e.apply(i,[r,n])))}async function Itt(t,e,i){return(await vy(t.map((r,n)=>e.apply(i,[r,n])))).map(r=>r.value)}function Jse(t){return{ok:!0,value:t}}function Kse(t){return{ok:!1,error:t}}function $tt(t){return t!=null&&t.ok===!0?t.value:null}function Ltt(t){return t!=null&&t.ok===!1?t.error:null}async function ih(t){if(t==null)return{ok:!1,error:new Error("no promise provided")};try{return Jse(await t)}catch(e){return Kse(e)}}async function Dtt(t){try{return Jse(await t)}catch(e){return Uo(e),Kse(e)}}function uKt(t){if(t.ok===!0)return t.value;throw t.error}function Oc(t,e){return new Qb(t,e)}let Qb=class extends ze{get value(){return $tt(this._result)}get error(){return Ltt(this._result)}get finished(){return this._result!=null}constructor(e,i){super({}),this._result=null,this._abortHandle=null,this.abort=()=>{this._abortController=vn(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:r}=this._abortController;this.promise=e(r),this.promise.then(n=>{this._result=Jse(n),this._cleanup()},n=>{this._result=Kse(n),this._cleanup()}),this._abortHandle=Zl(i,this.abort)}normalizeCtorArgs(){return{}}destroy(){this.abort()}_cleanup(){this._abortHandle=en(this._abortHandle),this._abortController=null}};y([w()],Qb.prototype,"value",null),y([w()],Qb.prototype,"error",null),y([w()],Qb.prototype,"finished",null),y([w()],Qb.prototype,"promise",void 0),y([w()],Qb.prototype,"_result",void 0),Qb=y([Z("esri.core.asyncUtils.ReactiveTask")],Qb);function _e(t,e,i={}){return Qse(t,e,i,GMe)}function Oo(t,e,i={}){return Qse(t,e,i,HMe)}function Qse(t,e,i={},r){let n=null;const s=i.once?(o,a)=>{r(o)&&(en(n),e(o,a))}:(o,a)=>{r(o)&&e(o,a)};if(n=RHe(t,s,i.sync,i.equals),i.initial){const o=t();s(o,o)}return n}function Jr(t,e,i,r={}){let n=null,s=null,o=null;function a(){var _;n&&s&&(s.remove(),(_=r.onListenerRemove)==null||_.call(r,n),n=null,s=null)}function c(_){r.once&&r.once&&en(o),i(_)}const p=_e(t,(_,x)=>{var S;a(),rB(_)&&(n=_,s=r5(_,e,c),(S=r.onListenerAdd)==null||S.call(r,_))},{sync:r.sync,initial:!0});return o=rr(()=>{p.remove(),a()}),o}function dd(t,e){return Ntt(t,HMe,e)}function Ntt(t,e,i){if(So(i))return Promise.reject(ur());const r=t();if(e!=null&&e(r))return Promise.resolve(r);let n=null;function s(){n=en(n)}return new Promise((o,a)=>{n=sd([Zl(i,()=>{s(),a(ur())}),Qse(t,c=>{s(),o(c)},{sync:!1,once:!0},e??GMe)])})}function GMe(t){return!0}function HMe(t){return!!t}function Ftt(t,e,i={}){let r=!1;const n=_e(t,(s,o)=>{r||e(s,o)},i);return{remove(){n.remove()},pause(){r=!0},resume(){r=!1}}}function ktt(t,e){const i=new tt,r=Jr(t,"after-splice",({added:n,start:s,deleteCount:o})=>{const a=i.splice(s,o);for(const c of a)c.remove();if(n!=null&&n.length){const c=n.map(e);i.addMany(c,s)}},{sync:!0,onListenerRemove:()=>i.drain(n=>n.remove()),onListenerAdd:n=>i.addMany(n.items.map(e))});return i.addHandles(r),i}function ztt(t,e){const i=new tt,r=ktt(t,a=>Oc(async c=>{const p=await e(a,c);if(So(c))throw p.remove(),ur();return p})),n=()=>null,s=async a=>{const c=await a.promise,p=r.indexOf(a);p<0||i.splice(p,1,c)};i.addMany(r.items.map(n));for(const a of r)Nm(s(a));const o=r.on("after-splice",({added:a,start:c,deleteCount:p})=>{const _=i.splice(c,p);for(const x of _)x==null||x.remove();if(a!=null&&a.length){i.addMany(a.map(n),c);for(const x of a)Nm(s(x))}});return i.addHandles([gne(r),o]),i}const Li={sync:!0},Qt={initial:!0},kt={sync:!0,initial:!0};var OI;const qMe=tt.ofType({base:null,key:"type",typeMap:{extrude:oMe,fill:b5,icon:s2,line:U9,object:qse,text:bE,water:MMe}});let PI=OI=class extends w5{constructor(t){super(t),this.symbolLayers=new qMe,this.type="polygon-3d"}initialize(){const t=e=>{e.type==="line"&&GO(Ce.getLogger(this),"LineSymbol3DLayer can not be used as a SymbolLayer with a PolygonSymbol3D symbol anymore.",{replacement:"Use FillSymbol3DLayer.outline instead.",version:"4.28"}),e.type==="text"&&GO(Ce.getLogger(this),"TextSymbol3DLayer can not be used as a SymbolLayer with a PolygonSymbol3D symbol anymore.",{replacement:"Use Labels instead.",version:"4.28"})};for(const e of this.symbolLayers)t(e);this.addHandles(Jr(()=>this.symbolLayers,"after-add",({item:e})=>t(e),Li))}clone(){return new OI({styleOrigin:Pe(this.styleOrigin),symbolLayers:Pe(this.symbolLayers),thumbnail:Pe(this.thumbnail)})}static fromJSON(t){var i;const e=new OI;if(e.read(t),e.symbolLayers.length===2&&e.symbolLayers.at(0).type==="fill"&&e.symbolLayers.at(1).type==="line"){const r=e.symbolLayers.at(0),n=e.symbolLayers.at(1);!n.enabled||(i=t.symbolLayers)!=null&&i[1]&&t.symbolLayers[1].enable===!1||(r.outline={size:n.size,color:n.material!=null?n.material.color:null}),e.symbolLayers.removeAt(1)}return e}static fromSimpleFillSymbol(t){return new OI({symbolLayers:new tt([b5.fromSimpleFillSymbol(t)])})}};y([w({type:qMe,json:{write:!0}})],PI.prototype,"symbolLayers",void 0),y([Vt({PolygonSymbol3D:"polygon-3d"},{readOnly:!0})],PI.prototype,"type",void 0),PI=OI=y([Z("esri.symbols.PolygonSymbol3D")],PI);const B9=PI;var sK;const $H=new tn({esriSFSSolid:"solid",esriSFSNull:"none",esriSFSHorizontal:"horizontal",esriSFSVertical:"vertical",esriSFSForwardDiagonal:"forward-diagonal",esriSFSBackwardDiagonal:"backward-diagonal",esriSFSCross:"cross",esriSFSDiagonalCross:"diagonal-cross"});let R3=sK=class extends lMe{constructor(...t){super(...t),this.color=new qe([0,0,0,.25]),this.outline=new Ic,this.type="simple-fill",this.style="solid"}normalizeCtorArgs(t,e,i){if(t&&typeof t!="string")return t;const r={};return t&&(r.style=t),e&&(r.outline=e),i&&(r.color=i),r}clone(){return new sK({color:Pe(this.color),outline:this.outline&&this.outline.clone(),style:this.style})}hash(){return`${super.hash()}${this.style}.${this.color&&this.color.hash()}`}};y([w()],R3.prototype,"color",void 0),y([w()],R3.prototype,"outline",void 0),y([Vt({esriSFS:"simple-fill"},{readOnly:!0})],R3.prototype,"type",void 0),y([w({type:$H.apiValues,json:{read:$H.read,write:$H.write}})],R3.prototype,"style",void 0),R3=sK=y([Z("esri.symbols.SimpleFillSymbol")],R3);const qm=R3;var oK;const LH=new tn({esriSMSCircle:"circle",esriSMSSquare:"square",esriSMSCross:"cross",esriSMSX:"x",esriSMSDiamond:"diamond",esriSMSTriangle:"triangle",esriSMSPath:"path"});let Pg=oK=class extends FMe{constructor(...t){super(...t),this.color=new qe([255,255,255,.25]),this.type="simple-marker",this.size=12,this.style="circle",this.outline=new Ic}normalizeCtorArgs(t,e,i,r){if(t&&typeof t!="string")return t;const n={};return t&&(n.style=t),e!=null&&(n.size=vs(e)),i&&(n.outline=i),r&&(n.color=r),n}writeColor(t,e){t&&this.style!=="x"&&this.style!=="cross"&&(e.color=t.toJSON()),t===null&&(e.color=null)}set path(t){this.style="path",this._set("path",t)}clone(){return new oK({angle:this.angle,color:Pe(this.color),outline:this.outline&&this.outline.clone(),path:this.path,size:this.size,style:this.style,xoffset:this.xoffset,yoffset:this.yoffset})}hash(){var t;return`${super.hash()}.${this.color&&this.color.hash()}.${this.path}.${this.style}.${(t=this.outline)==null?void 0:t.hash()}`}};y([w()],Pg.prototype,"color",void 0),y([Et("color")],Pg.prototype,"writeColor",null),y([Vt({esriSMS:"simple-marker"},{readOnly:!0})],Pg.prototype,"type",void 0),y([w()],Pg.prototype,"size",void 0),y([w({type:LH.apiValues,json:{read:LH.read,write:LH.write}})],Pg.prototype,"style",void 0),y([w({type:String,json:{write:!0}})],Pg.prototype,"path",null),y([w({types:{key:"type",base:null,defaultKeyValue:"simple-line",typeMap:{"simple-line":Ic}},json:{default:null,write:!0}})],Pg.prototype,"outline",void 0),Pg=oK=y([Z("esri.symbols.SimpleMarkerSymbol")],Pg);const du=Pg;var aK;let fo=aK=class extends vd{constructor(...t){super(...t),this.backgroundColor=null,this.borderLineColor=null,this.borderLineSize=null,this.font=new VB,this.horizontalAlignment="center",this.kerning=!0,this.haloColor=null,this.haloSize=null,this.rightToLeft=null,this.rotated=!1,this.text="",this.type="text",this.verticalAlignment="baseline",this.xoffset=0,this.yoffset=0,this.angle=0,this.width=null,this.lineWidth=192,this.lineHeight=1}normalizeCtorArgs(t,e,i){if(t&&typeof t!="string")return t;const r={};return t&&(r.text=t),e&&(r.font=e),i&&(r.color=i),r}writeLineWidth(t,e,i,r){r&&typeof r!="string"?r.origin:e[i]=t}castLineWidth(t){return vs(t)}writeLineHeight(t,e,i,r){r&&typeof r!="string"?r.origin:e[i]=t}clone(){return new aK({angle:this.angle,backgroundColor:Pe(this.backgroundColor),borderLineColor:Pe(this.borderLineColor),borderLineSize:this.borderLineSize,color:Pe(this.color),font:this.font&&this.font.clone(),haloColor:Pe(this.haloColor),haloSize:this.haloSize,horizontalAlignment:this.horizontalAlignment,kerning:this.kerning,lineHeight:this.lineHeight,lineWidth:this.lineWidth,rightToLeft:this.rightToLeft,rotated:this.rotated,text:this.text,verticalAlignment:this.verticalAlignment,width:this.width,xoffset:this.xoffset,yoffset:this.yoffset})}hash(){var t,e,i;return`${(t=this.backgroundColor)==null?void 0:t.hash()}.${this.borderLineColor}.${this.borderLineSize}.${(e=this.color)==null?void 0:e.hash()}.${this.font&&this.font.hash()}.${(i=this.haloColor)==null?void 0:i.hash()}.${this.haloSize}.${this.horizontalAlignment}.${this.kerning}.${this.rightToLeft}.${this.rotated}.${this.text}.${this.verticalAlignment}.${this.width}.${this.xoffset}.${this.yoffset}.${this.lineHeight}.${this.lineWidth}.${this.angle}`}};y([w({type:qe,json:{write:!0}})],fo.prototype,"backgroundColor",void 0),y([w({type:qe,json:{write:!0}})],fo.prototype,"borderLineColor",void 0),y([w({type:Number,json:{write:!0},cast:vs})],fo.prototype,"borderLineSize",void 0),y([w({type:VB,json:{write:!0}})],fo.prototype,"font",void 0),y([w({...bMe,json:{write:!0}})],fo.prototype,"horizontalAlignment",void 0),y([w({type:Boolean,json:{write:!0}})],fo.prototype,"kerning",void 0),y([w({type:qe,json:{write:!0}})],fo.prototype,"haloColor",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],fo.prototype,"haloSize",void 0),y([w({type:Boolean,json:{write:!0}})],fo.prototype,"rightToLeft",void 0),y([w({type:Boolean,json:{write:!0}})],fo.prototype,"rotated",void 0),y([w({type:String,json:{write:!0}})],fo.prototype,"text",void 0),y([Vt({esriTS:"text"},{readOnly:!0})],fo.prototype,"type",void 0),y([w({...wMe,json:{write:!0}})],fo.prototype,"verticalAlignment",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],fo.prototype,"xoffset",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],fo.prototype,"yoffset",void 0),y([w({type:Number,json:{read:t=>t&&-1*t,write:(t,e)=>e.angle=t&&-1*t}})],fo.prototype,"angle",void 0),y([w({type:Number,json:{write:!0}})],fo.prototype,"width",void 0),y([w({type:Number})],fo.prototype,"lineWidth",void 0),y([Et("lineWidth")],fo.prototype,"writeLineWidth",null),y([Ci("lineWidth")],fo.prototype,"castLineWidth",null),y([w(_Me)],fo.prototype,"lineHeight",void 0),y([Et("lineHeight")],fo.prototype,"writeLineHeight",null),fo=aK=y([Z("esri.symbols.TextSymbol")],fo);const wE=fo;var lK;let I0=lK=class extends vd{constructor(t){super(t),this.color=null,this.styleName=null,this.portal=null,this.styleUrl=null,this.thumbnail=null,this.name=null,this.type="web-style"}get _fetchCacheKey(){const t=this.portal!=null?this.portal:os.getDefault(),e=t.user?t.user.username:null;return`${this.styleName}:${this.styleUrl}:${this.name}:${e}:${t.url}`}read(t,e){this.portal=e==null?void 0:e.portal,super.read(t,e)}clone(){return new lK({name:this.name,styleUrl:this.styleUrl,styleName:this.styleName,portal:this.portal})}fetchSymbol(t){return this._fetchSymbol("webRef",t)}fetchCIMSymbol(t){return this._fetchSymbol("cimRef",t)}async _fetchSymbol(t,e){const i=e!=null?e.cache:null,r=i?this._fetchCacheKey:null;if(i!=null){const a=r&&i.get(r);if(a)return a.clone()}const{resolveWebStyleSymbol:n}=await we(()=>Promise.resolve().then(()=>cOt),void 0);St(e);const s=n(this,{portal:this.portal},t,e);s.catch(a=>{Ce.getLogger(this).error("#fetchSymbol()","Failed to create symbol from style",a)});const o=await s;return t==="webRef"&&o.type==="point-3d"||t==="cimRef"&&o.type==="cim"?(i!=null&&i.set(r,o.clone()),o):null}};y([w({json:{write:!1}})],I0.prototype,"color",void 0),y([w({type:String,json:{write:!0}})],I0.prototype,"styleName",void 0),y([w({type:os,json:{write:!1}})],I0.prototype,"portal",void 0),y([w({type:String,json:{read:BB,write:N2}})],I0.prototype,"styleUrl",void 0),y([w({type:vT,json:{read:!1}})],I0.prototype,"thumbnail",void 0),y([w({type:String,json:{write:!0}})],I0.prototype,"name",void 0),y([Vt({styleSymbolReference:"web-style"},{readOnly:!0})],I0.prototype,"type",void 0),y([w()],I0.prototype,"_fetchCacheKey",null),I0=lK=y([Z("esri.symbols.WebStyleSymbol")],I0);const xE=I0;function qB(t){if(!t)return!1;switch(t.type){case"picture-fill":case"picture-marker":case"simple-fill":case"simple-line":case"simple-marker":case"text":case"cim":return!0;default:return!1}}function Ky(t){if(!t)return!1;switch(t.type){case"label-3d":case"line-3d":case"mesh-3d":case"point-3d":case"polygon-3d":return!0;default:return!1}}const _y={base:vd,key:"type",typeMap:{"simple-fill":qm,"picture-fill":BMe,"picture-marker":x5,"simple-line":Ic,"simple-marker":du,text:wE,"label-3d":jB,"line-3d":GB,"mesh-3d":V9,"point-3d":o2,"polygon-3d":B9,"web-style":xE,cim:cx},errorContext:"symbol"},dKt={base:vd,key:"type",typeMap:{"picture-marker":x5,"simple-marker":du,text:wE,"web-style":xE,cim:cx},errorContext:"symbol"},Utt=s5({types:_y}),WMe={base:vd,key:"type",typeMap:{"simple-fill":qm,"picture-fill":BMe,"picture-marker":x5,"simple-line":Ic,"simple-marker":du,text:wE,"line-3d":GB,"mesh-3d":V9,"point-3d":o2,"polygon-3d":B9,"web-style":xE,cim:cx},errorContext:"symbol"},Vtt={base:vd,key:"type",typeMap:{text:wE,"label-3d":jB},errorContext:"symbol"},upe={base:vd,key:"type",typeMap:{"line-3d":GB,"mesh-3d":V9,"point-3d":o2,"polygon-3d":B9,"web-style":xE,cim:cx},errorContext:"symbol"},Btt={base:vd,key:"type",typeMap:{"label-3d":jB},errorContext:"symbol"},YMe=Hy(_y);var cK;function jtt(t){if(!t)return null;const e={};for(const i in t){const r=Wy(t[i]);r&&(e[i]=r)}return Object.keys(e).length!==0?e:null}function Gtt(t){if(t==null)return null;const e={};for(const i in t){const r=t[i];r&&(e[i]=r.toJSON())}return Object.keys(e).length!==0?e:null}let xh=cK=class extends Xs(Ue){constructor(...t){super(...t),this.isAggregate=!1,this.layer=null,this.popupTemplate=null,this.sourceLayer=null,Object.defineProperty(this,"uid",{value:mp(),configurable:!0})}normalizeCtorArgs(t,e,i,r){return t&&!t.declaredClass?t:{geometry:t,symbol:e,attributes:i,popupTemplate:r}}set aggregateGeometries(t){const e=this._get("aggregateGeometries");JSON.stringify(e)!==JSON.stringify(t)&&this._set("aggregateGeometries",t)}set attributes(t){const e=this._get("attributes");e!==t&&(this._set("attributes",t),this._notifyLayer("attributes",e,t))}set geometry(t){const e=this._get("geometry");e!==t&&(this._set("geometry",t),this._notifyLayer("geometry",e,t))}set symbol(t){const e=this._get("symbol");e!==t&&(this._set("symbol",t),this._notifyLayer("symbol",e,t))}set visible(t){const e=this._get("visible");e!==t&&(this._set("visible",t),this._notifyLayer("visible",e,t))}cloneShallow(){return new cK({aggregateGeometries:this.aggregateGeometries,attributes:this.attributes,geometry:this.geometry,isAggregate:this.isAggregate,layer:this.layer,popupTemplate:this.popupTemplate,sourceLayer:this.sourceLayer,symbol:this.symbol,visible:this.visible})}getEffectivePopupTemplate(t=!1){if(this.popupTemplate)return this.popupTemplate;for(const e of[this.sourceLayer,this.layer])if(e){if("popupTemplate"in e&&e.popupTemplate)return e.popupTemplate;if(t&&"defaultPopupTemplate"in e&&e.defaultPopupTemplate!=null)return e.defaultPopupTemplate}return null}getAttribute(t){var e;return(e=this.attributes)==null?void 0:e[t]}setAttribute(t,e){if(this.attributes){const i=this.getAttribute(t);this.attributes[t]=e,this._notifyLayer("attributes",i,e,t)}else this.attributes={[t]:e},this._notifyLayer("attributes",void 0,e,t)}getObjectId(){return this.sourceLayer&&"objectIdField"in this.sourceLayer&&this.sourceLayer.objectIdField?this.getAttribute(this.sourceLayer.objectIdField):null}toJSON(){var t;return{aggregateGeometries:Gtt(this.aggregateGeometries),geometry:this.geometry!=null?this.geometry.toJSON():null,symbol:this.symbol!=null?this.symbol.toJSON():null,attributes:fz(this.attributes)?this.attributes.toJSON():{...this.attributes},popupTemplate:((t=this.popupTemplate)==null?void 0:t.toJSON())??null}}notifyGeometryChanged(){this._notifyLayer("geometry",this.geometry,this.geometry)}notifyMeshTransformChanged(t={}){const{geometry:e}=this;if((e==null?void 0:e.type)==="mesh"){const i={origin:e.origin,transform:e.transform};this._notifyLayer("origin-transform",i,i,t.action)}}_notifyLayer(t,e,i,r){if(!this.layer||!("graphicChanged"in this.layer))return;const n={graphic:this,property:t,oldValue:e,newValue:i};t==="origin-transform"&&(n.action=r),t==="attributes"&&(n.attributeName=r),this.layer.graphicChanged(n)}};y([w({value:null,json:{read:jtt}})],xh.prototype,"aggregateGeometries",null),y([w({value:null})],xh.prototype,"attributes",null),y([w({value:null,types:dE,json:{read:Wy}})],xh.prototype,"geometry",null),y([w({type:Boolean})],xh.prototype,"isAggregate",void 0),y([w({clonable:"reference"})],xh.prototype,"layer",void 0),y([w({type:yE})],xh.prototype,"popupTemplate",void 0),y([w({clonable:"reference"})],xh.prototype,"sourceLayer",void 0),y([w({value:null,types:_y})],xh.prototype,"symbol",null),y([w({type:Boolean,value:!0})],xh.prototype,"visible",null),xh=cK=y([Z("esri.Graphic")],xh),function(t){t.generateUID=mp}(xh||(xh={}));const Ma=xh;let _T=class extends Q4{_own(e){e.layer&&"remove"in e.layer&&e.layer!==this.owner&&e.layer.remove(e),e.layer=this.owner}_release(e){e.layer===this.owner&&(e.layer=null)}};y([wTe({Type:Ma,ensureType:_s(Ma)})],_T.prototype,"itemType",void 0),_T=y([Z("esri.support.GraphicsCollection")],_T);var uK;let RI=uK=class extends Ue{constructor(t){super(t)}async collectRequiredFields(t,e){return th(t,e,this.expression)}clone(){return new uK({expression:this.expression,title:this.title})}equals(t){return this.expression===t.expression&&this.title===t.title}};y([w({type:String,json:{write:!0}})],RI.prototype,"expression",void 0),y([w({type:String,json:{write:!0}})],RI.prototype,"title",void 0),RI=uK=y([Z("esri.layers.support.FeatureExpressionInfo")],RI);const hpe=RI,aP={unknown:1,inches:Ur(1,"meters","inches"),feet:Ur(1,"meters","feet"),"us-feet":Ur(1,"meters","us-feet"),yards:Ur(1,"meters","yards"),miles:Ur(1,"meters","miles"),"nautical-miles":Ur(1,"meters","nautical-miles"),millimeters:Ur(1,"meters","millimeters"),centimeters:Ur(1,"meters","centimeters"),decimeters:Ur(1,"meters","decimeters"),meters:Ur(1,"meters","meters"),kilometers:Ur(1,"meters","kilometers"),"decimal-degrees":1/sEe(1,"meters",Or.radius)};function Htt(t){return!!t&&aP[t]!=null}function XMe(t){return 1/(aP[t]||1)}function qtt(){const t=Object.keys(aP);return t.sort(),t}const Wtt=qtt();var hK;const Q6=gu()({onTheGround:"on-the-ground",relativeToGround:"relative-to-ground",relativeToScene:"relative-to-scene",absoluteHeight:"absolute-height"}),dpe=new tn({foot:"feet",kilometer:"kilometers",meter:"meters",mile:"miles","us-foot":"us-feet",yard:"yards"});let Q1=hK=class extends Ue{constructor(t){super(t),this.offset=null}readFeatureExpressionInfo(t,e){return t??(e.featureExpression&&e.featureExpression.value===0?{expression:"0"}:void 0)}writeFeatureExpressionInfo(t,e,i,r){e[i]=t.write({},r),t.expression==="0"&&(e.featureExpression={value:0})}get mode(){const{offset:t,featureExpressionInfo:e}=this;return this._isOverridden("mode")?this._get("mode"):t!=null||e?"relative-to-ground":"on-the-ground"}set mode(t){this._override("mode",t)}set unit(t){this._set("unit",t)}write(t,e){return this.offset||this.mode||this.featureExpressionInfo||this.unit?super.write(t,e):null}clone(){return new hK({mode:this.mode,offset:this.offset,featureExpressionInfo:this.featureExpressionInfo?this.featureExpressionInfo.clone():void 0,unit:this.unit})}equals(t){return this.mode===t.mode&&this.offset===t.offset&&this.unit===t.unit&&HO(this.featureExpressionInfo,t.featureExpressionInfo)}};y([w({type:hpe,json:{write:!0}})],Q1.prototype,"featureExpressionInfo",void 0),y([Rt("featureExpressionInfo",["featureExpressionInfo","featureExpression"])],Q1.prototype,"readFeatureExpressionInfo",null),y([Et("featureExpressionInfo",{featureExpressionInfo:{type:hpe},"featureExpression.value":{type:[0]}})],Q1.prototype,"writeFeatureExpressionInfo",null),y([w({type:Q6.apiValues,nonNullable:!0,json:{type:Q6.jsonValues,read:Q6.read,write:{writer:Q6.write,isRequired:!0}}})],Q1.prototype,"mode",null),y([w({type:Number,json:{write:!0}})],Q1.prototype,"offset",void 0),y([w({type:Wtt,json:{type:String,read:dpe.read,write:dpe.write}})],Q1.prototype,"unit",null),Q1=hK=y([Z("esri.layers.support.ElevationInfo")],Q1);const WB=Q1;let ev=class extends vse(AB(pE)){constructor(e){super(e),this.elevationInfo=null,this.graphics=new _T,this.screenSizePerspectiveEnabled=!0,this.type="graphics",this.internal=!1}destroy(){this.removeAll(),this.graphics.destroy()}add(e){return this.graphics.add(e),this}addMany(e){return this.graphics.addMany(e),this}removeAll(){return this.graphics.removeAll(),this}remove(e){this.graphics.remove(e)}removeMany(e){this.graphics.removeMany(e)}on(e,i){return super.on(e,i)}graphicChanged(e){this.emit("graphic-update",e)}};y([w({type:WB})],ev.prototype,"elevationInfo",void 0),y([w(pz(_T,"graphics"))],ev.prototype,"graphics",void 0),y([w({type:["show","hide"]})],ev.prototype,"listMode",void 0),y([w()],ev.prototype,"screenSizePerspectiveEnabled",void 0),y([w({readOnly:!0})],ev.prototype,"type",void 0),y([w({constructOnly:!0})],ev.prototype,"internal",void 0),ev=y([Z("esri.layers.GraphicsLayer")],ev);const eoe=ev;var dK;let II=dK=class extends Ue{constructor(t){super(t),this.minValue=0,this.maxValue=0}clone(){return new dK({minValue:this.minValue,maxValue:this.maxValue})}};y([w({type:Number,json:{write:!0}})],II.prototype,"minValue",void 0),y([w({type:Number,json:{write:!0}})],II.prototype,"maxValue",void 0),II=dK=y([Z("esri.renderer.support.AuthoringInfoClassBreakInfo")],II);var pK;let Fw=pK=class extends Ue{constructor(t){super(t),this.field="",this.normalizationField="",this.label="",this.classBreakInfos=[]}clone(){return new pK({field:this.field,normalizationField:this.normalizationField,label:this.label,classBreakInfos:Pe(this.classBreakInfos)})}};y([w({type:String,json:{write:!0}})],Fw.prototype,"field",void 0),y([w({type:String,json:{write:!0}})],Fw.prototype,"normalizationField",void 0),y([w({type:String,json:{write:!0}})],Fw.prototype,"label",void 0),y([w({type:[II],json:{write:!0}})],Fw.prototype,"classBreakInfos",void 0),Fw=pK=y([Z("esri.renderers.support.AuthoringInfoFieldInfo")],Fw);var fK;const eD=new tn({percentTotal:"percent-of-total",ratio:"ratio",percent:"percent"}),tD=new tn({sizeInfo:"size",colorInfo:"color",transparencyInfo:"opacity",rotationInfo:"rotation"}),ppe={key:t=>typeof t=="number"?"number":"string",typeMap:{number:Number,string:String},base:null},fpe=["high-to-low","above-and-below","centered-on","extremes"],mpe=[...new Set(["high-to-low","above-and-below","centered-on","extremes","90-10","above","below","high-to-low","above-and-below","90-10","above","below"])],gpe=["seconds","minutes","hours","days","months","years"];let Sh=fK=class extends Ue{constructor(t){super(t),this.endTime=null,this.field=null,this.maxSliderValue=null,this.minSliderValue=null,this.startTime=null,this.type=null,this.units=null}castEndTime(t){return typeof t=="string"||typeof t=="number"?t:null}castStartTime(t){return typeof t=="string"||typeof t=="number"?t:null}get style(){return this.type==="color"?this._get("style"):null}set style(t){this._set("style",t)}get theme(){return this.type==="color"||this.type==="size"?this._get("theme")||"high-to-low":null}set theme(t){this._set("theme",t)}clone(){return new fK({endTime:this.endTime,field:this.field,maxSliderValue:this.maxSliderValue,minSliderValue:this.minSliderValue,startTime:this.startTime,style:this.style,theme:this.theme,type:this.type,units:this.units})}};y([w({types:ppe,json:{write:!0}})],Sh.prototype,"endTime",void 0),y([Ci("endTime")],Sh.prototype,"castEndTime",null),y([w({type:String,json:{write:!0}})],Sh.prototype,"field",void 0),y([w({type:Number,json:{write:!0}})],Sh.prototype,"maxSliderValue",void 0),y([w({type:Number,json:{write:!0}})],Sh.prototype,"minSliderValue",void 0),y([w({types:ppe,json:{write:!0}})],Sh.prototype,"startTime",void 0),y([Ci("startTime")],Sh.prototype,"castStartTime",null),y([w({type:eD.apiValues,value:null,json:{type:eD.jsonValues,read:eD.read,write:eD.write}})],Sh.prototype,"style",null),y([w({type:mpe,value:null,json:{type:mpe,origins:{"web-scene":{type:fpe,write:{writer:(t,e)=>{fpe.includes(t)&&(e.theme=t)}}}},write:!0}})],Sh.prototype,"theme",null),y([w({type:tD.apiValues,json:{type:tD.jsonValues,read:tD.read,write:tD.write}})],Sh.prototype,"type",void 0),y([w({type:gpe,json:{type:gpe,write:!0}})],Sh.prototype,"units",void 0),Sh=fK=y([Z("esri.renderers.support.AuthoringInfoVisualVariable")],Sh);const Ytt=Sh;let J7=class extends Ue{constructor(e){super(e),this.type=null}};y([w({readOnly:!0,json:{read:!1,write:!0}})],J7.prototype,"type",void 0),J7=y([Z("esri.rest.support.ColorRamp")],J7);const toe=J7;var mK;let I3=mK=class extends toe{constructor(t){super(t),this.algorithm=null,this.fromColor=null,this.toColor=null,this.type="algorithmic"}clone(){return new mK({fromColor:Pe(this.fromColor),toColor:Pe(this.toColor),algorithm:this.algorithm})}};y([Vt({esriCIELabAlgorithm:"cie-lab",esriHSVAlgorithm:"hsv",esriLabLChAlgorithm:"lab-lch"})],I3.prototype,"algorithm",void 0),y([w({type:qe,json:{type:[_n],write:!0}})],I3.prototype,"fromColor",void 0),y([w({type:qe,json:{type:[_n],write:!0}})],I3.prototype,"toColor",void 0),y([w({type:["algorithmic"]})],I3.prototype,"type",void 0),I3=mK=y([Z("esri.rest.support.AlgorithmicColorRamp")],I3);const ioe=I3;var gK;let $I=gK=class extends toe{constructor(t){super(t),this.colorRamps=null,this.type="multipart"}clone(){return new gK({colorRamps:Pe(this.colorRamps)})}};y([w({type:[ioe],json:{write:!0}})],$I.prototype,"colorRamps",void 0),y([w({type:["multipart"]})],$I.prototype,"type",void 0),$I=gK=y([Z("esri.rest.support.MultipartColorRamp")],$I);const ZMe=$I,Xtt={key:"type",base:toe,typeMap:{algorithmic:ioe,multipart:ZMe}};function Ztt(t){return t!=null&&t.type?t.type==="algorithmic"?ioe.fromJSON(t):t.type==="multipart"?ZMe.fromJSON(t):null:null}var yK;const Cx=new tn({esriClassifyDefinedInterval:"defined-interval",esriClassifyEqualInterval:"equal-interval",esriClassifyManual:"manual",esriClassifyNaturalBreaks:"natural-breaks",esriClassifyQuantile:"quantile",esriClassifyStandardDeviation:"standard-deviation"}),iD=new tn({pieChart:"pie-chart",classedSize:"class-breaks-size",classedColor:"class-breaks-color",univariateColorSize:"univariate-color-size",relationship:"relationship",predominance:"predominance",dotDensity:"dot-density",flow:"flow"}),ype=new tn({classedSize:"class-breaks-size",classedColor:"class-breaks-color",univariateColorSize:"univariate-color-size",relationship:"relationship",predominance:"predominance",dotDensity:"dot-density"}),vpe=["inches","feet","yards","miles","nautical-miles","millimeters","centimeters","decimeters","meters","kilometers","decimal-degrees"],Jtt=["high-to-low","above-and-below","above","below","90-10"],Ktt=["flow-line","wave-front"],Qtt=["caret","circle-caret","arrow","circle-arrow","plus-minus","circle-plus-minus","square","circle","triangle","happy-sad","thumb","custom"];let Wo=yK=class extends Ue{constructor(t){super(t),this.colorRamp=null,this.fadeRatio=null,this.isAutoGenerated=!1,this.lengthUnit=null,this.maxSliderValue=null,this.minSliderValue=null,this.visualVariables=null}get classificationMethod(){const t=this._get("classificationMethod"),e=this.type;return e&&e!=="relationship"?e==="class-breaks-size"||e==="class-breaks-color"?t||"manual":null:t}set classificationMethod(t){this._set("classificationMethod",t)}readColorRamp(t){return t?Ztt(t):void 0}get fields(){return this.type&&this.type!=="predominance"?null:this._get("fields")}set fields(t){this._set("fields",t)}get field1(){return this.type&&this.type!=="relationship"?null:this._get("field1")}set field1(t){this._set("field1",t)}get field2(){return this.type&&this.type!=="relationship"?null:this._get("field2")}set field2(t){this._set("field2",t)}get flowTheme(){return this.type==="flow"?this._get("flowTheme"):null}set flowTheme(t){this._set("flowTheme",t)}get focus(){return this.type&&this.type!=="relationship"?null:this._get("focus")}set focus(t){this._set("focus",t)}get numClasses(){return this.type&&this.type!=="relationship"?null:this._get("numClasses")}set numClasses(t){this._set("numClasses",t)}get statistics(){return this.type==="univariate-color-size"&&this.univariateTheme==="above-and-below"?this._get("statistics"):null}set statistics(t){this._set("statistics",t)}get standardDeviationInterval(){const t=this.type;return t&&t!=="relationship"&&t!=="class-breaks-size"&&t!=="class-breaks-color"||this.classificationMethod&&this.classificationMethod!=="standard-deviation"?null:this._get("standardDeviationInterval")}set standardDeviationInterval(t){this._set("standardDeviationInterval",t)}get type(){return this._get("type")}set type(t){let e=t;t==="classed-size"?e="class-breaks-size":t==="classed-color"&&(e="class-breaks-color"),this._set("type",e)}get univariateSymbolStyle(){return this.type==="univariate-color-size"&&this.univariateTheme==="above-and-below"?this._get("univariateSymbolStyle"):null}set univariateSymbolStyle(t){this._set("univariateSymbolStyle",t)}get univariateTheme(){return this.type==="univariate-color-size"?this._get("univariateTheme"):null}set univariateTheme(t){this._set("univariateTheme",t)}clone(){var t;return new yK({classificationMethod:this.classificationMethod,colorRamp:Pe(this.colorRamp),fadeRatio:Pe(this.fadeRatio),fields:(t=this.fields)==null?void 0:t.slice(0),field1:Pe(this.field1),field2:Pe(this.field2),isAutoGenerated:this.isAutoGenerated,focus:this.focus,numClasses:this.numClasses,maxSliderValue:this.maxSliderValue,minSliderValue:this.minSliderValue,lengthUnit:this.lengthUnit,statistics:this.statistics,standardDeviationInterval:this.standardDeviationInterval,type:this.type,visualVariables:this.visualVariables&&this.visualVariables.map(e=>e.clone()),univariateSymbolStyle:this.univariateSymbolStyle,univariateTheme:this.univariateTheme,flowTheme:this.flowTheme})}};y([w({type:Cx.apiValues,value:null,json:{type:Cx.jsonValues,read:Cx.read,write:Cx.write,origins:{"web-document":{default:"manual",type:Cx.jsonValues,read:Cx.read,write:Cx.write}}}})],Wo.prototype,"classificationMethod",null),y([w({types:Xtt,json:{write:!0}})],Wo.prototype,"colorRamp",void 0),y([Rt("colorRamp")],Wo.prototype,"readColorRamp",null),y([w({json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],Wo.prototype,"fadeRatio",void 0),y([w({type:[String],value:null,json:{write:!0}})],Wo.prototype,"fields",null),y([w({type:Fw,value:null,json:{write:!0}})],Wo.prototype,"field1",null),y([w({type:Fw,value:null,json:{write:!0}})],Wo.prototype,"field2",null),y([w({type:Ktt,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],Wo.prototype,"flowTheme",null),y([w({type:["HH","HL","LH","LL"],value:null,json:{write:!0}})],Wo.prototype,"focus",null),y([w({type:Boolean,json:{write:!0,default:!1,origins:{"web-scene":{write:!1}}}})],Wo.prototype,"isAutoGenerated",void 0),y([w({type:Number,value:null,json:{type:_n,write:!0}})],Wo.prototype,"numClasses",null),y([w({type:vpe,json:{type:vpe,read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],Wo.prototype,"lengthUnit",void 0),y([w({type:Number,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],Wo.prototype,"maxSliderValue",void 0),y([w({type:Number,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],Wo.prototype,"minSliderValue",void 0),y([w({type:Object,value:null,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],Wo.prototype,"statistics",null),y([w({type:[.25,.33,.5,1],value:null,json:{type:[.25,.33,.5,1],write:!0}})],Wo.prototype,"standardDeviationInterval",null),y([w({type:iD.apiValues,value:null,json:{type:iD.jsonValues,read:iD.read,write:iD.write,origins:{"web-scene":{type:ype.jsonValues,write:{writer:ype.write,overridePolicy:t=>({enabled:t!=="flow"})}}}}})],Wo.prototype,"type",null),y([w({type:[Ytt],json:{write:!0}})],Wo.prototype,"visualVariables",void 0),y([w({type:Qtt,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],Wo.prototype,"univariateSymbolStyle",null),y([w({type:Jtt,value:null,json:{write:!0,origins:{"web-scene":{write:!1}}}})],Wo.prototype,"univariateTheme",null),Wo=yK=y([Z("esri.renderers.support.AuthoringInfo")],Wo);const JMe=Wo,DH=new tn({simple:"simple",uniqueValue:"unique-value",classBreaks:"class-breaks",heatmap:"heatmap",dotDensity:"dot-density",dictionary:"dictionary",pieChart:"pie-chart"},{ignoreUnknown:!0});let LI=class extends Ue{constructor(e){super(e),this.authoringInfo=null,this.type=null}async getRequiredFields(e){if(!this.collectRequiredFields)return[];const i=new Set;return await this.collectRequiredFields(i,e),Array.from(i).sort()}getSymbol(e,i){}async getSymbolAsync(e,i){}getSymbols(){return[]}getAttributeHash(){return JSON.stringify(this)}getMeshHash(){return JSON.stringify(this)}};y([w({type:JMe,json:{write:!0}})],LI.prototype,"authoringInfo",void 0),y([w({type:DH.apiValues,readOnly:!0,json:{type:DH.jsonValues,read:!1,write:{writer:DH.write,ignoreOrigin:!0}}})],LI.prototype,"type",void 0),LI=y([Z("esri.renderers.Renderer")],LI);const V_=LI;function eit(t){var e,i;return((i=(e=t.match(tit))==null?void 0:e[1])==null?void 0:i.replace(/\\'/g,"'"))??null}const tit=/^hash\(\$feature\['((\\'|[^'])+)'\]\) \* 8\.381e-8$/;var vK;let dO=vK=class extends Ue{constructor(){super(...arguments),this.title=null}clone(){return new vK({title:this.title})}};y([w({type:String,json:{write:!0}})],dO.prototype,"title",void 0),dO=vK=y([Z("esri.renderers.support.LegendOptions")],dO);var _K;let K7=_K=class extends dO{constructor(){super(...arguments),this.showLegend=null}clone(){return new _K({title:this.title,showLegend:this.showLegend})}};y([w({type:Boolean,json:{write:!0}})],K7.prototype,"showLegend",void 0),K7=_K=y([Z("esri.renderers.visualVariables.support.VisualVariableLegendOptions")],K7);const KMe=K7,NH=new tn({colorInfo:"color",transparencyInfo:"opacity",rotationInfo:"rotation",sizeInfo:"size"});let $0=class extends Ue{constructor(e){super(e),this.index=null,this.type=null,this.field=null,this.valueExpression=null,this.valueExpressionTitle=null,this.legendOptions=null}castField(e){return e==null?e:typeof e=="function"?(Ce.getLogger(this).error(".field: field must be a string value"),null):A9(e)}get arcadeRequired(){return!!this.valueExpression}clone(){}getAttributeHash(){return`${this.type}-${this.field}-${this.valueExpression}`}};y([w()],$0.prototype,"index",void 0),y([w({type:NH.apiValues,readOnly:!0,json:{read:NH.read,write:NH.write}})],$0.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],$0.prototype,"field",void 0),y([Ci("field")],$0.prototype,"castField",null),y([w({type:String,json:{write:!0}})],$0.prototype,"valueExpression",void 0),y([w({type:String,json:{write:!0}})],$0.prototype,"valueExpressionTitle",void 0),y([w({readOnly:!0})],$0.prototype,"arcadeRequired",null),y([w({type:KMe,json:{write:!0}})],$0.prototype,"legendOptions",void 0),$0=y([Z("esri.renderers.visualVariables.VisualVariable")],$0);const j9=$0;var bK;let $3=bK=class extends Ue{constructor(t){super(t),this.color=null,this.label=null,this.value=null}writeValue(t,e,i){e[i]=t??0}clone(){return new bK({color:this.color&&this.color.clone(),label:this.label,value:this.value})}};y([w({type:qe,json:{type:[_n],write:!0}})],$3.prototype,"color",void 0),y([w({type:String,json:{write:!0}})],$3.prototype,"label",void 0),y([w({type:Number,json:{write:{writerEnsuresNonNull:!0}}})],$3.prototype,"value",void 0),y([Et("value")],$3.prototype,"writeValue",null),$3=bK=y([Z("esri.renderers.visualVariables.support.ColorStop")],$3);const iit=$3;var wK;let L3=wK=class extends j9{constructor(t){super(t),this.type="color",this.normalizationField=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null}}set stops(t){t&&Array.isArray(t)&&(t=t.filter(e=>!!e)).sort((e,i)=>e.value-i.value),this._set("stops",t)}clone(){var t;return new wK({field:this.field,normalizationField:this.normalizationField,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,stops:this.stops&&this.stops.map(e=>e.clone()),legendOptions:(t=this.legendOptions)==null?void 0:t.clone()})}getAttributeHash(){return`${super.getAttributeHash()}-${this.normalizationField}`}_interpolateData(){return this.stops&&this.stops.map(t=>t.value||0)}};y([w({readOnly:!0})],L3.prototype,"cache",null),y([w({type:["color"],json:{type:["colorInfo"]}})],L3.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],L3.prototype,"normalizationField",void 0),y([w({type:[iit],json:{write:!0}})],L3.prototype,"stops",null),L3=wK=y([Z("esri.renderers.visualVariables.ColorVariable")],L3);const QMe=L3;var xK;let ew=xK=class extends Ue{constructor(t){super(t),this.label=null,this.opacity=null,this.value=null}readOpacity(t,e){return WT(e.transparency)}writeOpacity(t,e,i){e[i]=zB(t)}clone(){return new xK({label:this.label,opacity:this.opacity,value:this.value})}};y([w({type:String,json:{write:!0}})],ew.prototype,"label",void 0),y([w({type:Number,json:{type:_n,write:{target:"transparency"}}})],ew.prototype,"opacity",void 0),y([Rt("opacity",["transparency"])],ew.prototype,"readOpacity",null),y([Et("opacity")],ew.prototype,"writeOpacity",null),y([w({type:Number,json:{write:!0}})],ew.prototype,"value",void 0),ew=xK=y([Z("esri.renderers.visualVariables.support.OpacityStop")],ew);const rit=ew;var SK;let D3=SK=class extends j9{constructor(t){super(t),this.type="opacity",this.normalizationField=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null}}set stops(t){t&&Array.isArray(t)&&(t=t.filter(e=>!!e)).sort((e,i)=>e.value-i.value),this._set("stops",t)}clone(){var t;return new SK({field:this.field,normalizationField:this.normalizationField,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,stops:this.stops&&this.stops.map(e=>e.clone()),legendOptions:(t=this.legendOptions)==null?void 0:t.clone()})}getAttributeHash(){return`${super.getAttributeHash()}-${this.normalizationField}`}_interpolateData(){return this.stops&&this.stops.map(t=>t.value||0)}};y([w({readOnly:!0})],D3.prototype,"cache",null),y([w({type:["opacity"],json:{type:["transparencyInfo"]}})],D3.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],D3.prototype,"normalizationField",void 0),y([w({type:[rit],json:{write:!0}})],D3.prototype,"stops",null),D3=SK=y([Z("esri.renderers.visualVariables.OpacityVariable")],D3);const eOe=D3;var TK;let tv=TK=class extends j9{constructor(t){super(t),this.axis=null,this.type="rotation",this.rotationType="geographic",this.valueExpressionTitle=null}get cache(){return{hasExpression:!!this.valueExpression,compiledFunc:null}}writeValueExpressionTitleWebScene(t,e,i,r){if(r!=null&&r.messages){const n=`visualVariables[${this.index}]`;r.messages.push(new se("property:unsupported",this.type+"VisualVariable.valueExpressionTitle is not supported in Web Scene. Please remove this property to save the Web Scene.",{instance:this,propertyName:n+".valueExpressionTitle",context:r}))}}clone(){var t;return new TK({axis:this.axis,rotationType:this.rotationType,field:this.field,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,legendOptions:(t=this.legendOptions)==null?void 0:t.clone()})}};y([w({readOnly:!0})],tv.prototype,"cache",null),y([w({type:["heading","tilt","roll"],json:{origins:{"web-scene":{default:"heading",write:!0}}}})],tv.prototype,"axis",void 0),y([w({type:["rotation"],json:{type:["rotationInfo"]}})],tv.prototype,"type",void 0),y([w({type:["geographic","arithmetic"],json:{write:!0,origins:{"web-document":{write:!0,default:"geographic"}}}})],tv.prototype,"rotationType",void 0),y([w({type:String,json:{write:!0}})],tv.prototype,"valueExpressionTitle",void 0),y([Et("web-scene","valueExpressionTitle")],tv.prototype,"writeValueExpressionTitleWebScene",null),tv=TK=y([Z("esri.renderers.visualVariables.RotationVariable")],tv);const tOe=tv;var EK;let wA=EK=class extends Ue{constructor(t){super(t),this.label=null,this.size=null,this.value=null}clone(){return new EK({label:this.label,size:this.size,value:this.value})}};y([w({type:String,json:{write:!0}})],wA.prototype,"label",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],wA.prototype,"size",void 0),y([w({type:Number,json:{write:!0}})],wA.prototype,"value",void 0),wA=EK=y([Z("esri.renderers.visualVariables.support.SizeStop")],wA);const nit=wA;var CK;let Q7=CK=class extends KMe{constructor(){super(...arguments),this.customValues=null}clone(){var t;return new CK({title:this.title,showLegend:this.showLegend,customValues:(t=this.customValues)==null?void 0:t.slice(0)})}};y([w({type:[Number],json:{write:!0}})],Q7.prototype,"customValues",void 0),Q7=CK=y([Z("esri.renderers.visualVariables.support.SizeVariableLegendOptions")],Q7);const iOe=Q7;var i_,El;function RM(t){return t&&t.declaredClass==="esri.renderers.visualVariables.SizeVariable"}function CL(t){return t!=null&&!isNaN(t)&&isFinite(t)}function rOe(t){return t.valueExpression?i_.Expression:t.field&&typeof t.field=="string"?i_.Field:i_.Unknown}function sit(t,e){const i=e||rOe(t),r=t.valueUnit||"unknown";return i===i_.Unknown?El.Constant:t.stops?El.Stops:t.minSize!=null&&t.maxSize!=null&&t.minDataValue!=null&&t.maxDataValue!=null?El.ClampedLinear:r==="unknown"?t.minSize!=null&&t.minDataValue!=null?t.minSize&&t.minDataValue?El.Proportional:El.Additive:El.Identity:El.RealWorldSize}(function(t){t.Unknown="unknown",t.Expression="expression",t.Field="field"})(i_||(i_={})),function(t){t.Unknown="unknown",t.Stops="stops",t.ClampedLinear="clamped-linear",t.Proportional="proportional",t.Additive="additive",t.Constant="constant",t.Identity="identity",t.RealWorldSize="real-world-size"}(El||(El={}));function vKt(t){}function oit(t){return()=>t}const F2=Ce.getLogger("esri.renderers.visualVariables.support.visualVariableUtils"),_pe=new Ma,eF=Math.PI,nOe=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i;function sOe(t,e,i){const r="visualVariables"in t&&t.visualVariables?t.visualVariables.find(M=>M.type==="color"):t;if(!r)return;if(r.declaredClass!=="esri.renderers.visualVariables.ColorVariable")return void F2.warn("The visualVariable should be an instance of esri.renderers.visualVariables.ColorVariable");const n=typeof e=="number",s=n?null:e,o=s==null?void 0:s.attributes;let a=n?e:null;const c=r.field,{ipData:p,hasExpression:_}=r.cache;let x=r.cache.compiledFunc;if(!c&&!_){const M=r.stops;return M&&M[0]&&M[0].color}if(typeof a!="number")if(_){if((i==null?void 0:i.arcade)==null)return void F2.error("Use of arcade expressions requires an arcade context");const M={viewingMode:i.viewingMode,scale:i.scale,spatialReference:i.spatialReference},P=i.arcade.arcadeUtils,$=P.getViewInfo(M),F=P.createExecContext(s,$,i.timeZone);if(!x){const z=P.createSyntaxTree(r.valueExpression);x=P.createFunction(z),r.cache.compiledFunc=x}a=P.executeFunction(x,F)}else o&&(a=o[c]);const S=r.normalizationField,C=o!=null&&S!=null?parseFloat(o[S]):void 0;if(a!=null&&(!S||n||!isNaN(C)&&C!==0)){isNaN(C)||n||(a/=C);const M=noe(a,p);if(M){const P=M[0],$=M[1],F=P===$?r.stops[P].color:qe.blendColors(r.stops[P].color,r.stops[$].color,M[2],i!=null?i.color:void 0);return new qe(F)}}}function oOe(t,e,i){const r="visualVariables"in t&&t.visualVariables?t.visualVariables.find(M=>M.type==="opacity"):t;if(!r)return;if(r.declaredClass!=="esri.renderers.visualVariables.OpacityVariable")return void F2.warn("The visualVariable should be an instance of esri.renderers.visualVariables.OpacityVariable");const n=typeof e=="number",s=n?null:e,o=s==null?void 0:s.attributes;let a=n?e:null;const c=r.field,{ipData:p,hasExpression:_}=r.cache;let x=r.cache.compiledFunc;if(!c&&!_){const M=r.stops;return M&&M[0]&&M[0].opacity}if(typeof a!="number")if(_){if((i==null?void 0:i.arcade)==null)return void F2.error("Use of arcade expressions requires an arcade context");const M={viewingMode:i.viewingMode,scale:i.scale,spatialReference:i.spatialReference},P=i.arcade.arcadeUtils,$=P.getViewInfo(M),F=P.createExecContext(s,$,i.timeZone);if(!x){const z=P.createSyntaxTree(r.valueExpression);x=P.createFunction(z),r.cache.compiledFunc=x}a=P.executeFunction(x,F)}else o&&(a=o[c]);const S=r.normalizationField,C=o!=null&&S!=null?parseFloat(o[S]):void 0;if(a!=null&&(!S||n||!isNaN(C)&&C!==0)){isNaN(C)||n||(a/=C);const M=noe(a,p);if(M){const P=M[0],$=M[1];if(P===$)return r.stops[P].opacity;{const F=r.stops[P].opacity;return F+(r.stops[$].opacity-F)*M[2]}}}}function aOe(t,e,i){const r="visualVariables"in t&&t.visualVariables?t.visualVariables.find(C=>C.type==="rotation"):t;if(!r)return;if(r.declaredClass!=="esri.renderers.visualVariables.RotationVariable")return void F2.warn("The visualVariable should be an instance of esri.renderers.visualVariables.RotationVariable");const n=r.axis||"heading",s=n==="heading"&&r.rotationType==="arithmetic"?90:0,o=n==="heading"&&r.rotationType==="arithmetic"?-1:1,a=typeof e=="number"?null:e,c=a==null?void 0:a.attributes,p=r.field,{hasExpression:_}=r.cache;let x=r.cache.compiledFunc,S=0;if(!p&&!_)return S;if(_){if((i==null?void 0:i.arcade)==null)return void F2.error("Use of arcade expressions requires an arcade context");const C={viewingMode:i.viewingMode,scale:i.scale,spatialReference:i.spatialReference},M=i.arcade.arcadeUtils,P=M.getViewInfo(C),$=M.createExecContext(a,P,i.timeZone);if(!x){const F=M.createSyntaxTree(r.valueExpression);x=M.createFunction(F),r.cache.compiledFunc=x}S=M.executeFunction(x,$)}else c&&(S=c[p]||0);return S=typeof S!="number"||isNaN(S)?null:s+o*S,S}function ait(t,e,i){const r=typeof e=="number",n=r?null:e,s=n==null?void 0:n.attributes;let o=r?e:null;const{isScaleDriven:a}=t.cache;let c=t.cache.compiledFunc;if(a){const _=i!=null?i.scale:void 0,x=i!=null?i.view:void 0;o=_==null||x==="3d"?lit(t):_}else if(!r)switch(t.inputValueType){case i_.Expression:{if((i==null?void 0:i.arcade)==null)return void F2.error("Use of arcade expressions requires an arcade context");const _={viewingMode:i.viewingMode,scale:i.scale,spatialReference:i.spatialReference},x=i.arcade.arcadeUtils,S=x.getViewInfo(_),C=x.createExecContext(n,S,i.timeZone);if(!c){const M=x.createSyntaxTree(t.valueExpression);c=x.createFunction(M),t.cache.compiledFunc=c}o=x.executeFunction(c,C);break}case i_.Field:s&&(o=s[t.field]);break;case i_.Unknown:o=null}if(!CL(o))return null;if(r||!t.normalizationField)return o;const p=s?parseFloat(s[t.normalizationField]):null;return CL(p)&&p!==0?o/p:null}function lit(t){let e=null,i=null;const r=t.stops;return r?(e=r[0].value,i=r[r.length-1].value):(e=t.minDataValue||0,i=t.maxDataValue||0),(e+i)/2}function YB(t,e,i){const r="visualVariables"in t&&t.visualVariables?t.visualVariables.find(s=>s.type==="size"):t;if(!r)return;if(r.declaredClass!=="esri.renderers.visualVariables.SizeVariable")return void F2.warn("The visualVariable should be an instance of esri.renderers.visualVariables.SizeVariable");const n=cOe(ait(r,e,i),r,e,i,r.cache.ipData);return n==null||isNaN(n)?0:n}function ed(t,e,i){return t==null?null:RM(t)?YB(t,e,i):CL(t)?t:null}function lOe(t,e,i){return CL(i)&&t>i?i:CL(e)&&t=e.maxDataValue)return o;if(s==null||o==null)return null;if(e.scaleBy==="area"&&a){const c=a==="circle",p=c?eF*(s/2)**2:s*s,_=p+n*((c?eF*(o/2)**2:o*o)-p);return c?2*Math.sqrt(_/eF):Math.sqrt(_)}return s+n*(o-s)}function dit(t,e,i,r){const n=r!=null?r.shape:void 0,s=t/e.minDataValue,o=ed(e.minSize,i,r),a=ed(e.maxSize,i,r);let c=null;return c=n==="circle"?2*Math.sqrt(s*(o/2)**2):n==="square"||n==="diamond"||n==="image"?Math.sqrt(s*o**2):s*o,lOe(c,o,a)}function pit(t,e,i,r,n){var c,p,_;const[s,o,a]=noe(t,n);if(s===o)return ed((c=e.stops)==null?void 0:c[s].size,i,r);{const x=ed((p=e.stops)==null?void 0:p[s].size,i,r);return x+(ed((_=e.stops)==null?void 0:_[o].size,i,r)-x)*a}}function fit(t,e,i,r){const n=((r==null?void 0:r.resolution)??1)*aP[e.valueUnit],s=ed(e.minSize,i,r),o=ed(e.maxSize,i,r),{valueRepresentation:a}=e;let c=null;return c=a==="area"?2*Math.sqrt(t/eF)/n:a==="radius"||a==="distance"?2*t/n:t/n,lOe(c,s,o)}function cOe(t,e,i,r,n){switch(e.transformationType){case El.Additive:return cit(t,e,i,r);case El.Constant:return uit(e,i,r);case El.ClampedLinear:return hit(t,e,i,r);case El.Proportional:return dit(t,e,i,r);case El.Stops:return pit(t,e,i,r,n);case El.RealWorldSize:return fit(t,e,i,r);case El.Identity:return t;case El.Unknown:return null}}function mit(t,e,i){const{isScaleDriven:r}=t.cache;if(!(r&&i==="3d"||e))return null;const n={scale:e,view:i};let s=ed(t.minSize,_pe,n),o=ed(t.maxSize,_pe,n);if(s!=null||o!=null){if(s>o){const a=o;o=s,s=a}return{minSize:s,maxSize:o}}}function roe(t,e,i){if(!t.visualVariables)return;const r=[],n=[],s=[],o=[],a=[];for(const c of t.visualVariables)switch(c.type){case"color":n.push(c);break;case"opacity":s.push(c);break;case"rotation":a.push(c);break;case"size":o.push(c)}return n.forEach(c=>{const p=sOe(c,e,i);r.push({variable:c,value:p})}),s.forEach(c=>{const p=oOe(c,e,i);r.push({variable:c,value:p})}),a.forEach(c=>{const p=aOe(c,e,i);r.push({variable:c,value:p})}),o.forEach(c=>{const p=YB(c,e,i);r.push({variable:c,value:p})}),r.filter(c=>c.value!=null)}function noe(t,e){if(!e)return;let i=0,r=e.length-1;return e.some((n,s)=>t!!e)).sort((e,i)=>e.value-i.value):t&&(Ce.getLogger(this).warn("cannot set stops when one of minDataValue, maxDataValue, minSize or maxSize is not null."),t=null),this._set("stops",t)}get transformationType(){return sit(this,this.inputValueType)}readValueExpression(t,e){return t||e.expression&&"$view.scale"}writeValueExpressionWebScene(t,e,i,r){if(t==="$view.scale"){if(r!=null&&r.messages){const n=this.index,s=typeof n=="string"?n:`visualVariables[${n}]`;r.messages.push(new se("property:unsupported",this.type+"VisualVariable.valueExpression = '$view.scale' is not supported in Web Scene. Please remove this property to save the Web Scene.",{instance:this,propertyName:s+".valueExpression",context:r}))}}else e[i]=t}readValueUnit(t){return t?MK.read(t):null}clone(){var t,e;return new AK({axis:this.axis,field:this.field,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,maxDataValue:this.maxDataValue,maxSize:RM(this.maxSize)?this.maxSize.clone():this.maxSize,minDataValue:this.minDataValue,minSize:RM(this.minSize)?this.minSize.clone():this.minSize,normalizationField:this.normalizationField,stops:(t=this.stops)==null?void 0:t.map(i=>i.clone()),target:this.target,useSymbolValue:this.useSymbolValue,valueRepresentation:this.valueRepresentation,valueUnit:this.valueUnit,legendOptions:(e=this.legendOptions)==null?void 0:e.clone()})}flipSizes(){if(this.transformationType===El.ClampedLinear){const{minSize:t,maxSize:e}=this;return this.minSize=e,this.maxSize=t,this}if(this.transformationType===El.Stops){const t=this.stops;if(!t)return this;const e=t.map(r=>r.size).reverse(),i=t.length;for(let r=0;re.value||0)}};y([w({readOnly:!0})],On.prototype,"cache",null),y([w({type:rD.apiValues,json:{type:rD.jsonValues,origins:{"web-map":{read:!1}},read:rD.read,write:rD.write}})],On.prototype,"axis",void 0),y([w({type:String,value:null,json:{read:!1}})],On.prototype,"expression",null),y([w()],On.prototype,"index",null),y([w({type:String,readOnly:!0})],On.prototype,"inputValueType",null),y([w({type:iOe,json:{write:!0}})],On.prototype,"legendOptions",void 0),y([w({type:Number,value:null,json:{write:!0}})],On.prototype,"maxDataValue",null),y([w({type:Number,value:null,json:{write:!0}})],On.prototype,"maxSize",null),y([Ci("maxSize")],On.prototype,"castMaxSize",null),y([Rt("maxSize")],On.prototype,"readMaxSize",null),y([w({type:Number,value:null,json:{write:!0}})],On.prototype,"minDataValue",null),y([w({type:Number,value:null,json:{write:!0}})],On.prototype,"minSize",null),y([Ci("minSize")],On.prototype,"castMinSize",null),y([Rt("minSize")],On.prototype,"readMinSize",null),y([w({type:String,json:{write:!0}})],On.prototype,"normalizationField",void 0),y([w({readOnly:!0})],On.prototype,"arcadeRequired",null),y([w({type:String})],On.prototype,"scaleBy",void 0),y([w({type:[nit],value:null,json:{write:!0}})],On.prototype,"stops",null),y([w({type:["outline"],json:{write:!0}})],On.prototype,"target",void 0),y([w({type:String,readOnly:!0})],On.prototype,"transformationType",null),y([w({type:["size"],json:{type:["sizeInfo"]}})],On.prototype,"type",void 0),y([w({type:Boolean,json:{write:!0,origins:{"web-map":{read:!1}}}})],On.prototype,"useSymbolValue",void 0),y([w({type:String,json:{write:!0}})],On.prototype,"valueExpression",void 0),y([Rt("valueExpression",["valueExpression","expression"])],On.prototype,"readValueExpression",null),y([Et("web-scene","valueExpression")],On.prototype,"writeValueExpressionWebScene",null),y([w({type:["radius","diameter","area","width","distance"],json:{write:!0}})],On.prototype,"valueRepresentation",void 0),y([w({type:MK.apiValues,json:{write:MK.write,origins:{"web-map":{read:!1},"web-scene":{write:!0},"portal-item":{write:!0}}}})],On.prototype,"valueUnit",void 0),y([Rt("valueUnit")],On.prototype,"readValueUnit",null),On=AK=y([Z("esri.renderers.visualVariables.SizeVariable")],On);const soe=On,yit={color:QMe,size:soe,opacity:eOe,rotation:tOe},vit=new tn({colorInfo:"color",transparencyInfo:"opacity",rotationInfo:"rotation",sizeInfo:"size"}),_it=/^\[([^\]]+)\]$/i;let tF=class extends ze{constructor(){super(...arguments),this.colorVariables=null,this.opacityVariables=null,this.rotationVariables=null,this.sizeVariables=null}set visualVariables(e){if(this._resetVariables(),e=e&&e.filter(i=>!!i),e==null?void 0:e.length){for(const i of e)switch(i.type){case"color":this.colorVariables.push(i);break;case"opacity":this.opacityVariables.push(i);break;case"rotation":this.rotationVariables.push(i);break;case"size":this.sizeVariables.push(i)}this.sizeVariables.length&&this.sizeVariables.some(i=>!!i.target)&&e.sort((i,r)=>{let n=null;return n=i.target===r.target?0:i.target?1:-1,n});for(let i=0;i{const p=vit.read(c.type),_=yit[p];_||(Ce.getLogger(this).warn(`Unknown variable type: ${p}`),r!=null&&r.messages&&r.messages.push(new Hf("visual-variable:unsupported",`visualVariable of type '${p}' is not supported`,{definition:c,context:r})));const x=new _;return x.read(c,r),x})}writeVariables(e,i){const r=[];for(const n of e){const s=n.toJSON(i);s&&r.push(s)}return r}_resetVariables(){this.colorVariables=[],this.opacityVariables=[],this.rotationVariables=[],this.sizeVariables=[]}};y([w()],tF.prototype,"visualVariables",null),tF=y([Z("esri.renderers.visualVariables.VisualVariableFactory")],tF);const bit=tF,wit={base:j9,key:"type",typeMap:{opacity:eOe,color:QMe,rotation:tOe,size:soe}},S5=t=>{let e=class extends t{constructor(){super(...arguments),this._vvFactory=new bit}set visualVariables(i){this._vvFactory.visualVariables=i,this._set("visualVariables",this._vvFactory.visualVariables)}readVisualVariables(i,r,n){return this._vvFactory.readVariables(i,r,n)}writeVisualVariables(i,r,n,s){r[n]=this._vvFactory.writeVariables(i,s)}get arcadeRequiredForVisualVariables(){if(!this.visualVariables)return!1;for(const i of this.visualVariables)if(i.arcadeRequired)return!0;return!1}hasVisualVariables(i,r){return i?this.getVisualVariablesForType(i,r).length>0:this.getVisualVariablesForType("size",r).length>0||this.getVisualVariablesForType("color",r).length>0||this.getVisualVariablesForType("opacity",r).length>0||this.getVisualVariablesForType("rotation",r).length>0}getVisualVariablesForType(i,r){const n=this.visualVariables;return n?n.filter(s=>s.type===i&&(typeof r=="string"?s.target===r:r!==!1||!s.target)):[]}async collectVVRequiredFields(i,r){let n=[];this.visualVariables&&(n=n.concat(this.visualVariables));for(const s of n)s&&(s.field&&vp(i,r,s.field),s.normalizationField&&vp(i,r,s.normalizationField),s.valueExpression&&(xit(s.valueExpression,i,r)||await th(i,r,s.valueExpression)))}};return y([w({types:[wit],value:null,json:{write:!0}})],e.prototype,"visualVariables",null),y([Rt("visualVariables",["visualVariables","rotationType","rotationExpression"])],e.prototype,"readVisualVariables",null),y([Et("visualVariables")],e.prototype,"writeVisualVariables",null),e=y([Z("esri.renderers.mixins.VisualVariablesMixin")],e),e};function xit(t,e,i){const r=eit(t);return r!=null&&(vp(e,i,r),!0)}function Sit(t){return uOe(t)||Tit(t)}function iF(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type==="feature"}function Tit(t){return(t==null?void 0:t.type)==="scene"}function Eit(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type==="subtype-group"&&"sublayers"in t}function uOe(t){const e=t==null?void 0:t.type;return e==="imagery-tile"||e==="tile"||e==="open-street-map"||e==="vector-tile"||e==="web-tile"||e==="wmts"}function pO(t){const e=t==null?void 0:t.type;return e==="base-tile"||e==="tile"||e==="elevation"||e==="imagery-tile"||e==="base-elevation"||e==="open-street-map"||e==="wcs"||e==="web-tile"||e==="wmts"||e==="vector-tile"}function lP(t){return t!=null&&"type"in t&&t.type==="group"}const bKt={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function hOe(t){const e=t==null?void 0:t.type;return e==="building-scene"||e==="integrated-mesh"||e==="point-cloud"||e==="scene"}function xpe(t){return(t==null?void 0:t.type)==="voxel"}function Spe(t){return(t==null?void 0:t.type)==="imagery-tile"}function rF(t){return(t==null?void 0:t.parent)!=null&&"declaredClass"in t.parent&&t.parent.declaredClass==="esri.Basemap"&&t.parent.baseLayers.includes(t)}function XB(t){var e;return(t==null?void 0:t.type)==="feature"&&!t.url&&((e=t.source)==null?void 0:e.type)==="memory"}function wKt(t){var e;return((t==null?void 0:t.type)==="feature"||(t==null?void 0:t.type)==="subtype-group")&&((e=t.source)==null?void 0:e.type)==="feature-layer"}function Cit(t){if(t.activeLayer){const e=t.activeLayer.tileMatrixSet;if(e)return e;const i=t.activeLayer.tileMatrixSets;if(i)return i}return null}async function dOe(t,e){const i=yr==null?void 0:yr.findServerInfo(t);if((i==null?void 0:i.currentVersion)!=null)return i.owningSystemUrl||null;const r=t.toLowerCase().indexOf("/rest/services");if(r===-1)return null;const n=`${t.substring(0,r)}/rest/info`,s=e!=null?e.signal:null,{data:o}=await yi(n,{query:{f:"json"},responseType:"json",signal:s});return(o==null?void 0:o.owningSystemUrl)||null}function Ait(t){if(!("capabilities"in t))return!1;switch(t.type){case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}function Mit(t){return Ait(t)?"effectiveCapabilities"in t?t.effectiveCapabilities:t.capabilities:null}function Oit(t){if(!("editingEnabled"in t))return!1;switch(t.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}function Pit(t){return!!Oit(t)&&("effectiveEditingEnabled"in t?t.effectiveEditingEnabled:t.editingEnabled)}const xA={retainId:!1,ignoreDrivers:!1,hasLabelingContext:!0};function cP(t,e=xA){var a,c;if(!t)return{symbol:null};const{retainId:i=xA.retainId,ignoreDrivers:r=xA.ignoreDrivers,hasLabelingContext:n=xA.hasLabelingContext,retainCIM:s=xA.retainCIM}=e;let o=null;if(Ky(t)||t instanceof xE)o=t.clone();else if(t.type==="cim"){const p=(c=(a=t.data)==null?void 0:a.symbol)==null?void 0:c.type;if(p!=="CIMPointSymbol")return{error:new se("symbol-conversion:unsupported-cim-symbol",`CIM symbol of type '${p||"unknown"}' is unsupported in 3D`,{symbol:t})};o=s?t.clone():o2.fromCIMSymbol(t)}else if(t instanceof Ic)o=GB.fromSimpleLineSymbol(t);else if(t instanceof du)o=o2.fromSimpleMarkerSymbol(t);else if(t instanceof x5)o=o2.fromPictureMarkerSymbol(t);else if(t instanceof qm)o=e.geometryType&&e.geometryType==="mesh"?V9.fromSimpleFillSymbol(t):B9.fromSimpleFillSymbol(t);else{if(!(t instanceof wE))return{error:new se("symbol-conversion:unsupported-2d-symbol",`2D symbol of type '${t.type||t.declaredClass}' is unsupported in 3D`,{symbol:t})};o=n?jB.fromTextSymbol(t):o2.fromTextSymbol(t)}return i&&o&&o.type!=="cim"&&(o.id=t.id),r&&Ky(o)&&o.symbolLayers.forEach(p=>p.ignoreDrivers=!0),{symbol:o}}function Gz(t,e,i,r){const n=pOe(t,{},{context:r,isLabelSymbol:!1});n!=null&&(e[i]=n)}function Tpe(t,e,i,r){const n=pOe(t,{},{context:r,isLabelSymbol:!0});n!=null&&(e[i]=n)}function Epe(t){return t instanceof w5||t instanceof xE}function pOe(t,e,i){if(t==null)return null;const{context:r,isLabelSymbol:n}=i,s=r==null?void 0:r.origin,o=r==null?void 0:r.messages;if(s==="web-scene"&&!Epe(t)){const a=cP(t,{retainCIM:!0,hasLabelingContext:n});return a.symbol!=null?a.symbol.write(e,r):(o==null||o.push(new se("symbol:unsupported",`Symbols of type '${t.declaredClass}' are not supported in scenes. Use 3D symbology instead when working with WebScene and SceneView`,{symbol:t,context:r,error:a.error})),null)}return(s==="web-map"||s==="portal-item"&&!hOe(r==null?void 0:r.layer))&&Epe(t)?(o==null||o.push(new se("symbol:unsupported",`Symbols of type '${t.declaredClass}' are not supported in web maps and portal items. Use 2D symbology and CIMSymbol instead when working with MapView`,{symbol:t,context:r})),null):t.write(e,r)}function fOe(t,e){return Utt(t,null,e)}const ZB={types:WMe,json:{write:{writer:Gz},origins:{"web-scene":{types:upe,write:{writer:Gz},read:{reader:s5({types:upe})}}}}},ooe=pne({json:{origins:{"web-scene":{write:{isRequired:!0}}}}},ZB),mOe={types:{base:vd,key:"type",typeMap:{"simple-fill":_y.typeMap["simple-fill"],"picture-fill":_y.typeMap["picture-fill"],"polygon-3d":_y.typeMap["polygon-3d"]}},json:{write:{writer:Gz},origins:{"web-scene":{type:B9,write:{writer:Gz}}}}},nF={cast:t=>t==null||typeof t=="string"||typeof t=="number"?t:`${t}`,json:{type:String,write:{writer:(t,e)=>{e.value=t==null?void 0:t.toString()}}}};var OK;let tw=OK=class extends Ue{constructor(t){super(t),this.description=null,this.label=null,this.minValue=null,this.maxValue=0,this.symbol=null}clone(){return new OK({description:this.description,label:this.label,minValue:this.minValue,maxValue:this.maxValue,symbol:this.symbol?this.symbol.clone():null})}getMeshHash(){const t=JSON.stringify(this.symbol);return`${this.minValue}.${this.maxValue}.${t}`}};y([w({type:String,json:{write:!0}})],tw.prototype,"description",void 0),y([w({type:String,json:{write:!0}})],tw.prototype,"label",void 0),y([w({type:Number,json:{read:{source:"classMinValue"},write:{target:"classMinValue"}}})],tw.prototype,"minValue",void 0),y([w({type:Number,json:{read:{source:"classMaxValue"},write:{target:"classMaxValue"}}})],tw.prototype,"maxValue",void 0),y([w(ooe)],tw.prototype,"symbol",void 0),tw=OK=y([Z("esri.renderers.support.ClassBreakInfo")],tw);const Hz=tw;var PK;const gOe="log",sF="percent-of-total",oF="field",nD=new tn({esriNormalizeByLog:gOe,esriNormalizeByPercentOfTotal:sF,esriNormalizeByField:oF}),Rit=_s(Hz);let Na=PK=class extends S5(V_){constructor(t){super(t),this._compiledValueExpression={valueExpression:null,compiledFunction:null},this.backgroundFillSymbol=null,this.classBreakInfos=null,this.defaultLabel=null,this.defaultSymbol=null,this.field=null,this.isMaxInclusive=!0,this.legendOptions=null,this.normalizationField=null,this.normalizationTotal=null,this.type="class-breaks",this.valueExpression=null,this.valueExpressionTitle=null,this._set("classBreakInfos",[])}readClassBreakInfos(t,e,i){if(!Array.isArray(t))return;let r=e.minValue;return t.map(n=>{const s=new Hz;return s.read(n,i),s.minValue==null&&(s.minValue=r),s.maxValue==null&&(s.maxValue=s.minValue),r=s.maxValue,s})}writeClassBreakInfos(t,e,i,r){const n=t.map(s=>s.write({},r));this._areClassBreaksConsecutive()&&n.forEach(s=>delete s.classMinValue),e[i]=n}castField(t){return t==null?t:typeof t=="function"?(Ce.getLogger(this).error(".field: field must be a string value"),null):A9(t)}get minValue(){return this.classBreakInfos&&this.classBreakInfos[0]&&this.classBreakInfos[0].minValue||0}get normalizationType(){let t=this._get("normalizationType");const e=!!this.normalizationField,i=this.normalizationTotal!=null;return e||i?(t=e&&oF||i&&sF||null,e&&i&&Ce.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):t!==oF&&t!==sF||(t=null),t}set normalizationType(t){this._set("normalizationType",t)}addClassBreakInfo(t,e,i){let r=null;r=typeof t=="number"?new Hz({minValue:t,maxValue:e,symbol:YMe(i)}):Rit(Pe(t)),this.classBreakInfos.push(r),this.classBreakInfos.length===1&&this.notifyChange("minValue")}removeClassBreakInfo(t,e){const i=this.classBreakInfos.length;for(let r=0;r-1?this.classBreakInfos[i].symbol:this.defaultSymbol}async getSymbolAsync(t,e){let i=e;if(this.valueExpression&&(e==null?void 0:e.arcade)==null){const n=await b_(),{arcadeUtils:s}=n;s.hasGeometryOperations(this.valueExpression)&&await s.enableGeometryOperations(),i={...i,arcade:n}}const r=this.getBreakIndex(t,i);return r>-1?this.classBreakInfos[r].symbol:this.defaultSymbol}getSymbols(){const t=[];return this.classBreakInfos.forEach(e=>{e.symbol&&t.push(e.symbol)}),this.defaultSymbol&&t.push(this.defaultSymbol),t}getAttributeHash(){return this.visualVariables&&this.visualVariables.reduce((t,e)=>t+e.getAttributeHash(),"")}getMeshHash(){const t=JSON.stringify(this.backgroundFillSymbol),e=JSON.stringify(this.defaultSymbol),i=`${this.normalizationField}.${this.normalizationType}.${this.normalizationTotal}`;return`${t}.${e}.${this.classBreakInfos.reduce((r,n)=>r+n.getMeshHash(),"")}.${i}.${this.field}.${this.valueExpression}`}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}clone(){var t,e;return new PK({field:this.field,backgroundFillSymbol:(t=this.backgroundFillSymbol)==null?void 0:t.clone(),defaultLabel:this.defaultLabel,defaultSymbol:(e=this.defaultSymbol)==null?void 0:e.clone(),valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,classBreakInfos:Pe(this.classBreakInfos),isMaxInclusive:this.isMaxInclusive,normalizationField:this.normalizationField,normalizationTotal:this.normalizationTotal,normalizationType:this.normalizationType,visualVariables:Pe(this.visualVariables),legendOptions:Pe(this.legendOptions),authoringInfo:this.authoringInfo&&this.authoringInfo.clone()})}async collectRequiredFields(t,e){const i=[this.collectVVRequiredFields(t,e),this.collectSymbolFields(t,e)];await Promise.all(i)}async collectSymbolFields(t,e){const i=[...this.getSymbols().map(r=>r.collectRequiredFields(t,e)),th(t,e,this.valueExpression)];vp(t,e,this.field),vp(t,e,this.normalizationField),await Promise.all(i)}_getBreakIndexForExpression(t,e){const{viewingMode:i,scale:r,spatialReference:n,arcade:s,timeZone:o}=e??{},{valueExpression:a}=this;let c=this._compiledValueExpression.valueExpression===a?this._compiledValueExpression.compiledFunction:null;const p=s.arcadeUtils;if(!c){const x=p.createSyntaxTree(a);c=p.createFunction(x),this._compiledValueExpression.compiledFunction=c}this._compiledValueExpression.valueExpression=a;const _=p.executeFunction(c,p.createExecContext(t,p.getViewInfo({viewingMode:i,scale:r,spatialReference:n}),o));return this._getBreakIndexfromInfos(_)}_getBreakIndexForField(t){const e=this.field,i=t.attributes,r=this.normalizationType;let n=parseFloat(i[e]);if(r){const s=this.normalizationTotal,o=parseFloat(this.normalizationField?i[this.normalizationField]:void 0);if(r===gOe)n=Math.log(n)*Math.LOG10E;else if(r!==sF||s==null||isNaN(s)){if(r===oF&&!isNaN(o)){if(isNaN(n)||isNaN(o))return-1;n/=o}}else n=n/s*100}return this._getBreakIndexfromInfos(n)}_getBreakIndexfromInfos(t){const e=this.isMaxInclusive;if(t!=null&&typeof t=="number"&&!isNaN(t))for(let i=0;iGh(t),json:{write:!0}})],Na.prototype,"normalizationTotal",void 0),y([w({type:nD.apiValues,value:null,json:{type:nD.jsonValues,read:nD.read,write:nD.write}})],Na.prototype,"normalizationType",null),y([Vt({classBreaks:"class-breaks"})],Na.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],Na.prototype,"valueExpression",void 0),y([w({type:String,json:{write:!0}})],Na.prototype,"valueExpressionTitle",void 0),Na=PK=y([Z("esri.renderers.ClassBreaksRenderer")],Na);const yOe=Na,h$=-3;var am;(function(t){t[t.ALL=0]="ALL",t[t.SOME=1]="SOME"})(am||(am={}));let Iit=class{constructor(e,i,r){this.name=e,this._storage=i,this.id=$it+++":",this.size=0,this.maxSize=0,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),r&&(this._storage.registerRemoveFunc(this.id,r),this._removeFunc=!0)}destroy(){this._storage.clear(this),this._removeFunc&&this._storage.deregisterRemoveFunc(this.id),this._storage.deregister(this),this._storage=null}get hitRate(){return this._hit/(this._hit+this._miss)}get sizeAll(){return this._storage.size}resetHitRate(){this._hit=this._miss=0}put(e,i,r,n=0){this._storage.put(this,e,i,r,n)}get(e){const i=this._storage.get(this,e);return i===void 0?++this._miss:++this._hit,i}peek(e){return this._storage.peek(this,e)}pop(e){const i=this._storage.pop(this,e);return i===void 0?++this._miss:++this._hit,i}updateSize(e,i,r){this._storage.updateSize(this,e,i,r)}clear(){this._storage.clear(this)}clearAll(){this._storage.clearAll()}get performanceInfo(){return this._storage.performanceInfo}resetStats(){this._storage.resetStats()}},vOe=class{get size(){return this._size}constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new Pi,this._users=new Pi}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(e){this._users.push(e)}deregister(e){this._users.removeUnordered(e)}registerRemoveFunc(e,i){this._removeFuncs.push([e,i])}deregisterRemoveFunc(e){this._removeFuncs.filterInPlace(i=>i[0]!==e)}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=Math.max(e,0),this._checkSizeLimits()}put(e,i,r,n,s){i=e.id+i;const o=this._db.get(i);if(o&&(this._size-=o.size,e.size-=o.size,this._db.delete(i),o.entry!==r&&this._notifyRemove(i,o.entry,am.ALL)),n>this._maxSize)return void this._notifyRemove(i,r,am.ALL);if(r===void 0)return void console.warn("Refusing to cache undefined entry ");if(!n||n<0)return console.warn(`Refusing to cache entry with size ${n} for key ${i}`),void this._notifyRemove(i,r,am.ALL);const a=1+Math.max(s,h$)-h$;this._db.set(i,{entry:r,size:n,lifetime:a,lives:a}),this._size+=n,e.size+=n,this._checkSizeLimits()}updateSize(e,i,r,n){i=e.id+i;const s=this._db.get(i);if(s&&s.entry===r){for(this._size-=s.size,e.size-=s.size;n>this._maxSize;){const o=this._notifyRemove(i,r,am.SOME);if(!(o!=null&&o>0))return void this._db.delete(i);n=o}s.size=n,this._size+=n,e.size+=n,this._checkSizeLimits()}}pop(e,i){i=e.id+i;const r=this._db.get(i);if(r)return this._size-=r.size,e.size-=r.size,this._db.delete(i),++this._hit,r.entry;++this._miss}get(e,i){i=e.id+i;const r=this._db.get(i);if(r!==void 0)return this._db.delete(i),r.lives=r.lifetime,this._db.set(i,r),++this._hit,r.entry;++this._miss}peek(e,i){const r=this._db.get(e.id+i);return r?++this._hit:++this._miss,r==null?void 0:r.entry}get performanceInfo(){const e={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},i={},r=new Array;this._db.forEach((o,a)=>{const c=o.lifetime;r[c]=(r[c]||0)+o.size,this._users.forAll(p=>{const{id:_,name:x}=p;if(a.startsWith(_)){const S=i[x]||0;i[x]=S+o.size}})});const n={};this._users.forAll(o=>{const a=o.name;if("hitRate"in o&&typeof o.hitRate=="number"&&!isNaN(o.hitRate)&&o.hitRate>0){const c=i[a]||0;i[a]=c,n[a]=Math.round(100*o.hitRate)+"%"}else n[a]="0%"});const s=Object.keys(i);s.sort((o,a)=>i[a]-i[o]),s.forEach(o=>e[o]=Math.round(i[o]/2**20)+"MB / "+n[o]);for(let o=r.length-1;o>=0;--o){const a=r[o];a&&(e["Priority "+(o+h$-1)]=Math.round(a/this._size*100)+"%")}return e}resetStats(){this._hit=this._miss=0,this._users.forAll(e=>e.resetHitRate())}clear(e){const i=e.id;this._db.forEach((r,n)=>{n.startsWith(i)&&(this._size-=r.size,this._db.delete(n),this._notifyRemove(n,r.entry,am.ALL))}),e.size=0}clearAll(){this._db.forEach((e,i)=>this._notifyRemove(i,e.entry,am.ALL)),this._users.forEach(e=>e.size=0),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(e,i,r){let n;return this._removeFuncs.some(s=>{if(e.startsWith(s[0])){const o=s[1](i,r);return typeof o=="number"&&(n=o),!0}return!1}),n}_checkSizeLimits(){if(this._size>this._maxSize){for(const[e,i]of this._db)if(this._purgeItem(e,i),this._size<=.9*this.maxSize)return}this._users.forEach(e=>{if(e.maxSize>0&&e.size>e.maxSize){for(const[i,r]of this._db)if(i.startsWith(e.id)&&(this._purgeItem(i,r,e),e.size<=.9*e.maxSize))return}})}_purgeItem(e,i,r=this._users.find(n=>e.startsWith(n.id))){if(this._db.delete(e),i.lives<=1){this._size-=i.size,r&&(r.size-=i.size);const n=this._notifyRemove(e,i.entry,am.SOME);n!=null&&n>0&&(this._size+=n,r&&(r.size+=n),i.lives=i.lifetime,i.size=n,this._db.set(e,i))}else--i.lives,this._db.set(e,i)}},$it=0,JB=class{constructor(e,i){this._storage=new vOe,this.id="",this.name="",this.size=0,this._storage.maxSize=e,this._storage.register(this),i&&this._storage.registerRemoveFunc("",i)}destroy(){this._storage.deregister(this),this._storage.destroy()}put(e,i,r=1){this._storage.put(this,e,i,r,1)}pop(e){return this._storage.pop(this,e)}get(e){return this._storage.get(this,e)}clear(){this._storage.clearAll()}get maxSize(){return this._storage.maxSize}set maxSize(e){this._storage.maxSize=e}resetHitRate(){}},k2=class{constructor(e,i,r=""){this.major=e,this.minor=i,this._context=r}lessThan(e,i){return this.majorCp.create(i)):null}isDateField(e){return this._dateFieldsSet.has(this.get(e))}isTimeOnlyField(e){return ZAe(this.get(e))}isNumericField(e){return this._numericFieldsSet.has(this.get(e))}normalizeFieldName(e){var i;return((i=this.get(e))==null?void 0:i.name)??void 0}toJSON(){return{fields:this.fields.map(e=>fz(e)?e.toJSON():e),timeZoneByFieldName:this._timeZoneByFieldName?Array.from(this._timeZoneByFieldName.entries()):null}}};function PS(t){return t.trim().toLowerCase()}function Cpe(t){var e;return((e=IQe(t))==null?void 0:e.toLowerCase())??""}const _Oe=new Set(["time-only","date-only","timestamp-offset","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"]);function Ape(t){const e=new Map;if(!t.fields)return e;const i=t.datesInUnknownTimezone===!0,{timeInfo:r,editFieldsInfo:n}=t,s=(r?"startField"in r?r.startField:r.startTimeField:"")??"",o=(r?"endField"in r?r.endField:r.endTimeField:"")??"",a=Fit(t)?t.dateFieldsTimeZone??null:t.dateFieldsTimeReference?P7(t.dateFieldsTimeReference):null,c=n?Dit(n)?n.timeZone??a:n.dateFieldsTimeReference?P7(n.dateFieldsTimeReference):a??Xy:null,p=r?Nit(r)?r.timeZone??a:r.timeReference?P7(r.timeReference):a:null,_=new Map([[PS((n==null?void 0:n.creationDateField)??""),c],[PS((n==null?void 0:n.editDateField)??""),c],[PS(s),p],[PS(o),p]]);for(const{name:x,type:S}of t.fields)if(_Oe.has(S))e.set(x,qT);else if(S!=="date"&&S!=="esriFieldTypeDate")e.set(x,null);else if(i)e.set(x,qT);else{const C=_.get(PS(x??""))??a;e.set(x,C)}return e}const Mpe="esri.renderers.support.DictionaryLoader",zit={type:"CIMSimpleLineCallout",lineSymbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",width:.5,color:[0,0,0,255]}]}};let loe=class{constructor(e,i,r){this.config=null,this.fieldMap=null,this.url=null,this._ongoingRequests=new Map,this._symbolCache=new JB(100),this._dictionaryVersion=null,this._fieldIndex=null,this._dictionaryPromise=null,this.url=e,this.config=i,this.fieldMap=r}getSymbolFields(){return this._symbolFields}async getSymbolAsync(e,i){let r;this._dictionaryPromise||(this._dictionaryPromise=this.fetchResources(i));try{r=await this._dictionaryPromise}catch(M){if(on(M))return this._dictionaryPromise=null,null}const n=this._dictionaryVersion&&this._dictionaryVersion.since(4,0),s={};if(this.fieldMap)for(const M of this._symbolFields){const P=this._getFieldName(this.fieldMap[M]);if(P){const $=e.attributes[P];s[M]=n?$:$!=null?""+e.attributes[P]:""}else s[M]=""}let o=null;try{o=r==null?void 0:r(s,i)}catch{return null}if(!o||typeof o!="string")return null;const a=mne(o).toString(),c=this._symbolCache.get(a);if(c)return c.catch(()=>{this._symbolCache.pop(a)}),c;const p=o.split(";"),_=[],x=[];for(const M of p)if(M)if(M.includes("po:")){const P=M.substr(3).split("|");if(P.length===3){const $=P[0],F=P[1];let z=P[2];if(F==="DashTemplate")z=z.split(" ").map(k=>Number(k));else if(F==="Color"){const k=new qe(z).toRgba();z=[k[0],k[1],k[2],255*k[3]]}else z=Number(z);x.push({primitiveName:$,propertyName:F,value:z})}}else if(M.includes("|")){for(const P of M.split("|"))if(this._itemNames.has(P)){_.push(P);break}}else this._itemNames.has(M)&&_.push(M);const S=e.geometry==null||!e.geometry.hasZ&&e.geometry.type==="point",C=this._cimPartsToCIMSymbol(_,x,S,i);return this._symbolCache.put(a,C,1),C}async fetchResources(e){if(this._dictionaryPromise)return this._dictionaryPromise;if(!this.url)return void Ce.getLogger(Mpe).error("no valid URL!");const i=yi(this.url+"/resources/styles/dictionary-info.json",{responseType:"json",query:{f:"json"},signal:e!=null?e.signal:null}),[{data:r}]=await Promise.all([i,b_()]);if(!r)throw this._dictionaryPromise=null,new se("esri.renderers.DictionaryRenderer","Bad dictionary data!");const{authoringInfo:n,dictionary_version:s,expression:o,itemsNames:a}=r,c=o;let p=!1;s&&(this._dictionaryVersion=k2.parse(s),p=this._dictionaryVersion.since(4,0)),this._refSymbolUrlTemplate=this.url+"/"+r.cimRefTemplateUrl,this._itemNames=new Set(a),this._symbolFields=n.symbol;const _={};if(this.config){const C=this.config;for(const M in C)_[M]=C[M]}if(n.configuration)for(const C of n.configuration)_.hasOwnProperty(C.name)||(_[C.name]=C.value);const x=[];if(e!=null&&e.fields&&this.fieldMap)for(const C of this._symbolFields){const M=this.fieldMap[C],P=e.fields.filter($=>$.name.toLowerCase()===(M==null?void 0:M.toLowerCase()));P.length>0&&x.push({...P[0],type:p?P[0].type:"esriFieldTypeString"})}x.length>0&&(this._fieldIndex=new aoe(x));const S=OQe(c,e!=null?e.spatialReference:null,x,_).then(C=>{const M={scale:0};return(P,$)=>{if(C==null)return null;const F=C.repurposeFeature({geometry:null,attributes:P});return M.scale=$!=null?$.scale??void 0:void 0,C.evaluate({$feature:F,$view:M},C.services)}}).catch(C=>(Ce.getLogger(Mpe).error("Creating dictinoary expression failed:",C),null));return this._dictionaryPromise=S,S}async _cimPartsToCIMSymbol(e,i,r,n){const s=new Array(e.length);for(let c=0;cs.data);const r=this._refSymbolUrlTemplate.replaceAll(/\{itemName\}/gi,e),n=yi(r,{responseType:"json",query:{f:"json"},...i});this._ongoingRequests.set(e,n);try{return(await n).data}catch(s){throw this._ongoingRequests.delete(e),s}}_combineSymbolParts(e,i,r){if(!e||e.length===0)return null;const n={...e[0]};if(e.length>1){n.symbolLayers=[];for(const s of e){const o=s;n.symbolLayers.unshift(...o.symbolLayers)}}return r&&(n.callout=zit),{type:"CIMSymbolReference",symbol:n,primitiveOverrides:i}}_getFieldName(e){if(this._fieldIndex!==null){const i=this._fieldIndex.get(e);return i?i.name:e}return e}};function bOe(t,e){if(!t)return;const i=t.symbolLayers;if(!i)return;let r=i.length;for(;r--;){const n=i[r];n&&n.enable!==!1&&n.type==="CIMVectorMarker"&&Uit(n,e)}}function Uit(t,e){const i=t.markerGraphics;if(i)for(const r of i){if(!r)continue;const n=r.symbol;if(n)switch(n.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":bOe(n,e);break;case"CIMTextSymbol":n.fieldMap=e}}}const OKt=Object.freeze(Object.defineProperty({__proto__:null,DictionaryLoader:loe},Symbol.toStringTag,{value:"Module"}));var RK;let L0=RK=class extends S5(V_){constructor(t){super(t),this.config=null,this.fieldMap=null,this.scaleExpression=null,this.scaleExpressionTitle=null,this.url=null,this.type="dictionary"}get _loader(){return new loe(this.url,this.config,this.fieldMap)}writeData(t,e){t&&(e.scalingExpressionInfo={expression:t,returnType:"number"})}writeVisualVariables(t,e,i,r){r!=null&&r.origin||super.writeVisualVariables(t,e,i,r)}clone(){return new RK({config:Pe(this.config),scaleExpression:this.scaleExpression,scaleExpressionTitle:this.scaleExpressionTitle,fieldMap:Pe(this.fieldMap),url:Pe(this.url),visualVariables:Pe(this.visualVariables)})}async getSymbolAsync(t,e){return this._loader.getSymbolAsync(t,e)}async collectRequiredFields(t,e){await this.collectVVRequiredFields(t,e),this.scaleExpression&&await th(t,e,this.scaleExpression);for(const i in this.fieldMap){const r=this.fieldMap[i];e.has(r)&&t.add(r)}}get arcadeRequired(){return!0}getSymbol(){return null}getSymbols(){return[]}getAttributeHash(){return this.visualVariables&&this.visualVariables.reduce((t,e)=>t+e.getAttributeHash(),"")}getMeshHash(){return`${this.url}-${JSON.stringify(this.fieldMap)}`}getSymbolFields(){return this._loader.getSymbolFields()}};y([w({type:loe})],L0.prototype,"_loader",null),y([w({type:Object,json:{read:{source:"configuration"},write:{target:"configuration"}}})],L0.prototype,"config",void 0),y([w({type:Object,json:{write:!0}})],L0.prototype,"fieldMap",void 0),y([w({type:String,json:{read:{source:"scalingExpressionInfo.expression"},write:!0}})],L0.prototype,"scaleExpression",void 0),y([Et("scaleExpression")],L0.prototype,"writeData",null),y([w({type:String,json:{read:{source:"scalingExpressionInfo.title"},write:{target:"scalingExpressionInfo.title",overridePolicy(t){return{enabled:!!t&&!!this.scaleExpression}}}}})],L0.prototype,"scaleExpressionTitle",void 0),y([w({type:String,json:{write:!0}})],L0.prototype,"url",void 0),y([Et("visualVariables")],L0.prototype,"writeVisualVariables",null),L0=RK=y([Z("esri.renderers.DictionaryRenderer")],L0);const Vit=L0;var IK;let iv=IK=class extends Ue{constructor(t){super(t),this.color=null,this.field=null,this.label=null,this.valueExpression=null,this.valueExpressionTitle=null}castField(t){return t==null?t:typeof t=="function"?(Ce.getLogger(this).error(".field: field must be a string value"),null):A9(t)}getAttributeHash(){return`${this.field}-${this.valueExpression}`}clone(){var t;return new IK({color:(t=this.color)==null?void 0:t.clone(),field:this.field,label:this.label,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle})}};y([w({type:qe,json:{type:[Number],write:!0}})],iv.prototype,"color",void 0),y([w({type:String,json:{write:!0}})],iv.prototype,"field",void 0),y([Ci("field")],iv.prototype,"castField",null),y([w({type:String,json:{write:!0}})],iv.prototype,"label",void 0),y([w({type:String,json:{write:!0}})],iv.prototype,"valueExpression",void 0),y([w({type:String,json:{write:!0}})],iv.prototype,"valueExpressionTitle",void 0),iv=IK=y([Z("esri.renderers.support.AttributeColorInfo")],iv);const wOe=iv;var $K;let lF=$K=class extends Ue{constructor(){super(...arguments),this.unit=null}clone(){return new $K({unit:this.unit})}};y([w({type:String,json:{write:!0}})],lF.prototype,"unit",void 0),lF=$K=y([Z("esri.renderers.support.DotDensityLegendOptions")],lF);const Bit=lF;var LK;let Th=LK=class extends S5(V_){constructor(t){super(t),this.attributes=null,this.backgroundColor=new qe([0,0,0,0]),this.dotBlendingEnabled=!0,this.dotShape="square",this.dotSize=1,this.legendOptions=null,this.outline=new Ic,this.dotValue=null,this.referenceScale=null,this.seed=1,this.type="dot-density"}calculateDotValue(t){if(this.referenceScale==null)return this.dotValue;const e=t/this.referenceScale*this.dotValue;return e<1?1:e}getSymbol(){return new qm({outline:this.outline})}async getSymbolAsync(){return this.getSymbol()}getSymbols(){return[this.getSymbol()]}getAttributeHash(){var t;return((t=this.attributes)==null?void 0:t.reduce((e,i)=>e+i.getAttributeHash(),""))??""}getMeshHash(){return JSON.stringify(this.outline)}clone(){return new LK({attributes:Pe(this.attributes),backgroundColor:Pe(this.backgroundColor),dotBlendingEnabled:Pe(this.dotBlendingEnabled),dotShape:Pe(this.dotShape),dotSize:Pe(this.dotSize),dotValue:Pe(this.dotValue),legendOptions:Pe(this.legendOptions),outline:Pe(this.outline),referenceScale:Pe(this.referenceScale),visualVariables:Pe(this.visualVariables),authoringInfo:this.authoringInfo&&this.authoringInfo.clone()})}getControllerHash(){var e;return`${(e=this.attributes)==null?void 0:e.map(i=>i.field||i.valueExpression||"")}-${this.outline&&JSON.stringify(this.outline.toJSON())||""}`}async collectRequiredFields(t,e){await this.collectVVRequiredFields(t,e);for(const i of this.attributes??[])i.valueExpression&&await th(t,e,i.valueExpression),i.field&&t.add(i.field)}};y([w({type:[wOe],json:{write:!0}})],Th.prototype,"attributes",void 0),y([w({type:qe,json:{write:!0}})],Th.prototype,"backgroundColor",void 0),y([w({type:Boolean,json:{write:!0}})],Th.prototype,"dotBlendingEnabled",void 0),y([w({type:String,json:{write:!1}})],Th.prototype,"dotShape",void 0),y([w({type:Number,json:{write:!0}})],Th.prototype,"dotSize",void 0),y([w({type:Bit,json:{write:!0}})],Th.prototype,"legendOptions",void 0),y([w({type:Ic,json:{default:null,write:!0}})],Th.prototype,"outline",void 0),y([w({type:Number,json:{write:!0}})],Th.prototype,"dotValue",void 0),y([w({type:Number,json:{write:!0}})],Th.prototype,"referenceScale",void 0),y([w({type:Number,json:{write:!0}})],Th.prototype,"seed",void 0),y([Vt({dotDensity:"dot-density"})],Th.prototype,"type",void 0),Th=LK=y([Z("esri.renderers.DotDensityRenderer")],Th);const jit=Th;var DK;let DI=DK=class extends Ue{constructor(t){super(t),this.color=null,this.ratio=null}clone(){return new DK({color:this.color,ratio:this.ratio})}};y([w({type:qe,json:{type:[_n],default:null,write:!0}})],DI.prototype,"color",void 0),y([w({type:Number,json:{write:!0}})],DI.prototype,"ratio",void 0),DI=DK=y([Z("esri.renderers.support.HeatmapColorStop")],DI);const d$=DI;let SA=class extends Xs(Ue){constructor(){super(...arguments),this.minLabel=null,this.maxLabel=null,this.title=null}};y([w({type:String,json:{write:!0}})],SA.prototype,"minLabel",void 0),y([w({type:String,json:{write:!0}})],SA.prototype,"maxLabel",void 0),y([w({type:String,json:{write:!0}})],SA.prototype,"title",void 0),SA=y([Z("esri.renderers.support.HeatmapLegendOptions")],SA);function Xi(){return[0,0,0,0]}function G9(t){return[t[0],t[1],t[2],t[3]]}function Mi(t,e,i,r){return[t,e,i,r]}function QB(t,e=Xi()){const i=Math.min(4,t.length);for(let r=0;ra>=0&&a<=1).sort((a,c)=>a.ratio-c.ratio).map(({color:a,ratio:c})=>({color:a,ratio:Math.max(c,.001)})),t.length<1)return i;let r=t[0],n=t[0],s=1;const o=Xi();for(let a=0;a<512;a++){const c=(a+.5)/512;for(;c>n.ratio&&s=i+F||$.y<-F||$.y>r+F)continue;const z=+x(M),k=Math.max(0,Math.round($.x)-a),U=Math.max(0,Math.round($.y)-a),j=Math.min(r,Math.round($.y)+a),G=Math.min(i,Math.round($.x)+a);for(let Y=U;Y_&&(_=p)}}}return{matrix:c.buffer,max:_}}function Jit(t,e,i){const r=Math.sqrt(t**2+e**2)/i;return r>1?0:3/(Math.PI*i**2)*(1-r**2)**2}function $Kt(t,e){return typeof t=="function"?t:t?typeof e=="string"?i=>-1*+i[t]:i=>+i[t]+e:()=>1}function Kit(t,e){return t!=null?typeof e=="string"?i=>-1*+i.readAttribute(t):i=>+i.readAttribute(t)+e:i=>1}var NK;const OOe="esri.renderers.HeatmapRenderer",Qit=Ce.getLogger(OOe);function Ope(t){if(t!=null){const{maxDensity:e,minDensity:i,radius:r}=t;if(e!=null||i!=null||r!=null){const{blurRadius:n,maxPixelIntensity:s,minPixelIntensity:o,...a}=t;return a}}return t}let ml=NK=class extends V_{constructor(t){super(t),this.authoringInfo=null,this.colorStops=[new d$({ratio:0,color:new qe("rgba(255, 140, 0, 0)")}),new d$({ratio:.75,color:new qe("rgba(255, 140, 0, 1)")}),new d$({ratio:.9,color:new qe("rgba(255, 0, 0, 1)")})],this.field=null,this.fieldOffset=0,this.legendOptions=null,this.maxDensity=.04,this.minDensity=0,this.radius=18,this.referenceScale=0,this.type="heatmap",this.valueExpression=null,this.valueExpressionTitle=null,this._warnedProps={blurRadius:!1,maxPixelIntensity:!1,minPixelIntensity:!1}}normalizeCtorArgs(t){return Ope(t)}get blurRadius(){return Xit(this.radius)}set blurRadius(t){const e=this.maxPixelIntensity,i=this.minPixelIntensity;this._set("radius",Yit(t)),this._warnAboutDeprecatedGaussianBlurProp("blurRadius","radius"),this._set("maxDensity",e*this._pixelIntensityToDensity),this._set("minDensity",i*this._pixelIntensityToDensity)}get maxPixelIntensity(){return this.maxDensity/this._pixelIntensityToDensity}set maxPixelIntensity(t){this._set("maxDensity",t*this._pixelIntensityToDensity),this._warnAboutDeprecatedGaussianBlurProp("maxPixelIntensity","maxDensity")}get minPixelIntensity(){return this.minDensity/this._pixelIntensityToDensity}set minPixelIntensity(t){this._set("minDensity",t*this._pixelIntensityToDensity),this._warnAboutDeprecatedGaussianBlurProp("minPixelIntensity","minDensity")}get _pixelIntensityToDensity(){return 24/(coe**2*this.blurRadius**4)}_warnAboutDeprecatedGaussianBlurProp(t,e){this._warnedProps[t]||Kl(this).getDefaultOrigin()==="user"&&(this._warnedProps[t]=!0,ox(()=>{gm(Qit,t,{replacement:`${String(e)} (suggested value: ${this._get(e)})`,version:"4.24"})}))}read(t,e){t=Ope(t),super.read(t,e)}getSymbol(){return new du}async getSymbolAsync(){return this.getSymbol()}getSymbols(){return[this.getSymbol()]}async collectRequiredFields(t,e){const i=this.field,r=this.valueExpression;i&&typeof i=="string"&&vp(t,e,i),r&&typeof r=="string"&&await th(t,e,r)}getAttributeHash(){return null}getMeshHash(){return`${JSON.stringify(this.colorStops)}.${this.blurRadius}.${this.field}`}clone(){return new NK({authoringInfo:this.authoringInfo&&this.authoringInfo.clone(),colorStops:Pe(this.colorStops),field:this.field,legendOptions:Pe(this.legendOptions),maxDensity:this.maxDensity,minDensity:this.minDensity,radius:this.radius,referenceScale:this.referenceScale,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle})}};y([w({type:JMe,json:{write:!0,origins:{"web-scene":{write:!1,read:!1}}}})],ml.prototype,"authoringInfo",void 0),y([w({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],ml.prototype,"blurRadius",null),y([w({type:[d$],json:{write:!0}})],ml.prototype,"colorStops",void 0),y([w({type:String,json:{write:!0}})],ml.prototype,"field",void 0),y([w({type:Number,json:{write:{overridePolicy:(t,e,i)=>({enabled:i==null})},origins:{"web-scene":{write:!1}}}})],ml.prototype,"fieldOffset",void 0),y([w({type:SA,json:{write:!0}})],ml.prototype,"legendOptions",void 0),y([w({type:Number,json:{write:!0}})],ml.prototype,"maxDensity",void 0),y([w({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],ml.prototype,"maxPixelIntensity",null),y([w({type:Number,json:{write:!0}})],ml.prototype,"minDensity",void 0),y([w({type:Number,json:{origins:{"portal-item":{write:!0},"web-map":{write:!0}}}})],ml.prototype,"minPixelIntensity",null),y([w({type:Number,cast:vs,json:{write:!0}})],ml.prototype,"radius",void 0),y([w({type:Number,range:{min:0},json:{default:0,write:!0}})],ml.prototype,"referenceScale",void 0),y([Vt({heatmap:"heatmap"})],ml.prototype,"type",void 0),y([w({type:String,json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],ml.prototype,"valueExpression",void 0),y([w({type:String})],ml.prototype,"valueExpressionTitle",void 0),y([w({readOnly:!0})],ml.prototype,"_pixelIntensityToDensity",null),ml=NK=y([Z(OOe)],ml);const POe=ml;let RS=class extends Xs(Ue){constructor(){super(...arguments),this.color=new qe([0,0,0,0]),this.label=null,this.threshold=0}};y([w({type:qe,json:{write:!0}})],RS.prototype,"color",void 0),y([w({type:String,json:{write:!0}})],RS.prototype,"label",void 0),y([w({type:Number,range:{min:0,max:1},json:{write:!0}})],RS.prototype,"threshold",void 0),RS=y([Z("esri.renderers.support.OthersCategory")],RS);let cF=class extends Xs(Ue){constructor(){super(...arguments),this.title=null}};y([w({type:String,json:{write:!0}})],cF.prototype,"title",void 0),cF=y([Z("esri.renderers.support.PieChartLegendOptions")],cF);let $d=class extends S5(Xs(V_)){constructor(e){super(e),this.attributes=null,this.backgroundFillSymbol=null,this.defaultColor=new qe([0,0,0,0]),this.defaultLabel=null,this.holePercentage=0,this.othersCategory=new RS,this.legendOptions=null,this.outline=null,this.size=12,this.type="pie-chart"}getSymbol(){var e;return new du({size:this.size?this.size/2+(((e=this.outline)==null?void 0:e.width)||0):0})}async getSymbolAsync(){return this.getSymbol()}getSymbols(){return[this.getSymbol(),this.backgroundFillSymbol].filter(ys)}getAttributeHash(){return this.visualVariables&&this.visualVariables.reduce((e,i)=>e+i.getAttributeHash(),"")}getMeshHash(){return this.getSymbols().reduce((e,i)=>e+JSON.stringify(i),"")}async collectRequiredFields(e,i){await this.collectVVRequiredFields(e,i);for(const r of this.attributes)r.valueExpression&&await th(e,i,r.valueExpression),r.field&&e.add(r.field)}};y([w({type:[wOe],json:{write:!0}})],$d.prototype,"attributes",void 0),y([w({type:qm,json:{default:null,write:!0}})],$d.prototype,"backgroundFillSymbol",void 0),y([w({type:qe,json:{write:!0}})],$d.prototype,"defaultColor",void 0),y([w({type:String,json:{write:!0}})],$d.prototype,"defaultLabel",void 0),y([w({type:Number,range:{min:0,max:1},json:{write:!0}})],$d.prototype,"holePercentage",void 0),y([w({type:RS,json:{write:!0}})],$d.prototype,"othersCategory",void 0),y([w({type:cF,json:{write:!0}})],$d.prototype,"legendOptions",void 0),y([w({type:Ic,json:{default:null,write:!0}})],$d.prototype,"outline",void 0),y([w({type:Number,cast:vs,json:{write:!0}})],$d.prototype,"size",void 0),y([Vt({pieChart:"pie-chart"})],$d.prototype,"type",void 0),$d=y([Z("esri.renderers.PieChartRenderer")],$d);const ert=$d;var FK;let N3=FK=class extends S5(V_){constructor(t){super(t),this.description=null,this.label=null,this.symbol=null,this.type="simple"}async collectRequiredFields(t,e){await Promise.all([this.collectSymbolFields(t,e),this.collectVVRequiredFields(t,e)])}async collectSymbolFields(t,e){await Promise.all(this.getSymbols().map(i=>i.collectRequiredFields(t,e)))}getSymbol(t,e){return this.symbol}async getSymbolAsync(t,e){return this.symbol}getSymbols(){return this.symbol?[this.symbol]:[]}getAttributeHash(){return this.visualVariables&&this.visualVariables.reduce((t,e)=>t+e.getAttributeHash(),"")}getMeshHash(){return this.getSymbols().reduce((t,e)=>t+JSON.stringify(e),"")}get arcadeRequired(){return this.arcadeRequiredForVisualVariables}clone(){return new FK({description:this.description,label:this.label,symbol:this.symbol&&this.symbol.clone(),visualVariables:Pe(this.visualVariables),authoringInfo:this.authoringInfo&&this.authoringInfo.clone()})}};y([w({type:String,json:{write:!0}})],N3.prototype,"description",void 0),y([w({type:String,json:{write:!0}})],N3.prototype,"label",void 0),y([w(ooe)],N3.prototype,"symbol",void 0),y([Vt({simple:"simple"})],N3.prototype,"type",void 0),N3=FK=y([Z("esri.renderers.SimpleRenderer")],N3);const uoe=N3,trt=new Set(["esri.Color","esri.portal.Portal","esri.symbols.support.Symbol3DAnchorPosition2D","esri.symbols.support.Symbol3DAnchorPosition3D"]);function kK(t){return t instanceof ze}function Ppe(t){return t instanceof tt?Object.keys(t.items):kK(t)?Kl(t).keys():t?Object.keys(t):[]}function sD(t,e){return t instanceof tt?t.items[e]:t[e]}function irt(t,e){return!(!Array.isArray(t)||!Array.isArray(e))&&t.length!==e.length}function p$(t){return t?t.declaredClass:null}function ROe(t,e){var x;const i=t.diff;if(i&&typeof i=="function")return i(t,e);const r=Ppe(t),n=Ppe(e);if(r.length===0&&n.length===0)return;if(!r.length||!n.length||irt(t,e))return{type:"complete",oldValue:t,newValue:e};const s=n.filter(S=>!r.includes(S)),o=r.filter(S=>!n.includes(S)),a=r.filter(S=>n.includes(S)&&sD(t,S)!==sD(e,S)).concat(s,o).sort(),c=p$(t);if(c&&trt.has(c)&&a.length)return{type:"complete",oldValue:t,newValue:e};let p;const _=kK(t)&&kK(e);for(const S of a){const C=sD(t,S),M=sD(e,S);let P;if((_||typeof C!="function"&&typeof M!="function")&&C!==M&&(C!=null||M!=null)){if(i&&i[S]&&typeof i[S]=="function")P=(x=i[S])==null?void 0:x.call(i,C,M);else if(C instanceof Date&&M instanceof Date){if(C.getTime()===M.getTime())continue;P={type:"complete",oldValue:C,newValue:M}}else P=typeof C=="object"&&typeof M=="object"&&p$(C)===p$(M)?ROe(C,M):{type:"complete",oldValue:C,newValue:M};P!=null&&(p!=null?p.diff[S]=P:p={type:"partial",diff:{[S]:P}})}}return p}function rrt(t,e){if(t==null)return!1;const i=e.split(".");let r=t;for(const n of i){if(r.type==="complete")return!0;if(r.type!=="partial")return!1;{const s=r.diff[n];if(!s)return!1;r=s}}return!0}function FKt(t,e){for(const i of e)if(rrt(t,i))return!0;return!1}function nrt(t,e){if(typeof t!="function"&&typeof e!="function"&&(t!=null||e!=null))return t==null||e==null||typeof t=="object"&&typeof e=="object"&&p$(t)!==p$(e)?{type:"complete",oldValue:t,newValue:e}:ROe(t,e)}function oD(t){if(t==null)return!0;switch(t.type){case"complete":return!1;case"collection":{const e=t;for(const i of e.added)if(!oD(i))return!1;for(const i of e.removed)if(!oD(i))return!1;for(const i of e.changed)if(!oD(i))return!1;return!0}case"partial":for(const e in t.diff)if(!oD(t.diff[e]))return!1;return!0}}let TA=class extends Xs(Ue){constructor(e){super(e),this.value=null,this.value2=null,this.value3=null}};y([w(nF)],TA.prototype,"value",void 0),y([w(nF)],TA.prototype,"value2",void 0),y([w(nF)],TA.prototype,"value3",void 0),TA=y([Z("esri.renderers.support.UniqueValue")],TA);const fO=TA;let iw=class extends Xs(Ue){constructor(e){super(e),this.description=null,this.label=null,this.symbol=null,this.values=null}castValues(e){if(e==null)return null;const i=typeof(e=Array.isArray(e)?e:[e])[0];return i==="string"||i==="number"?e.map(r=>new fO({value:r})):i==="object"?e[0]instanceof fO?e:e.map(r=>new fO(r)):null}};y([w({type:String,json:{write:!0}})],iw.prototype,"description",void 0),y([w({type:String,json:{write:!0}})],iw.prototype,"label",void 0),y([w(ZB)],iw.prototype,"symbol",void 0),y([w({type:[fO],json:{type:[[String]],read:{reader:t=>t?t.map(e=>new fO({value:e[0],value2:e[1],value3:e[2]})):null},write:{writer:(t,e)=>{const i=[];for(const r of t){const n=[r.value,r.value2,r.value3].filter(ys).map(s=>s.toString());i.push(n)}e.values=i}}}})],iw.prototype,"values",void 0),y([Ci("values")],iw.prototype,"castValues",null),iw=y([Z("esri.renderers.support.UniqueValueClass")],iw);const IOe=iw;let NI=class extends Xs(Ue){constructor(e){super(e),this.heading=null,this.classes=null}};y([w({type:String,json:{write:!0}})],NI.prototype,"heading",void 0),y([w({type:[IOe],json:{write:!0}})],NI.prototype,"classes",void 0),NI=y([Z("esri.renderers.support.UniqueValueGroup")],NI);const zK=NI;var UK;let F3=UK=class extends Ue{constructor(t){super(t),this.description=null,this.label=null,this.symbol=null,this.value=null}clone(){return new UK({value:this.value,description:this.description,label:this.label,symbol:this.symbol?this.symbol.clone():null})}getMeshHash(){var e;const t=JSON.stringify((e=this.symbol)==null?void 0:e.toJSON());return`${this.value}.${t}`}};y([w({type:String,json:{write:!0}})],F3.prototype,"description",void 0),y([w({type:String,json:{write:!0}})],F3.prototype,"label",void 0),y([w(ooe)],F3.prototype,"symbol",void 0),y([w(nF)],F3.prototype,"value",void 0),F3=UK=y([Z("esri.renderers.support.UniqueValueInfo")],F3);const f$=F3,srt=()=>!!$e("enable-feature:force-wosr"),VKt=()=>!!$e("enable-feature:direct-3d-object-feature-layer-display"),ort=()=>$e.add("enable-feature:direct-3d-object-feature-layer-display",!0,!0,!0),art=()=>$e.add("enable-feature:direct-3d-object-feature-layer-display",!1,!0,!0),BKt=()=>!!$e("enable-i3s-patching"),lrt=()=>$e.add("enable-i3s-patching",!0,!0,!0),crt=()=>$e.add("enable-i3s-patching",!1,!0,!0),Rpe=()=>!!$e("enable-feature:SceneLayer-editing"),urt=(t="i3s-patching")=>{switch(crt(),art(),$e.add("enable-feature:SceneLayer-editing",!0,!0,!0),t){case"feature-layer-view":ort();break;case"i3s-patching":lrt()}};urt("i3s-patching");let FH={};async function hrt(t,e){try{return{data:(await doe(t,e)).data,baseUrl:Lne(t),styleUrl:t}}catch(i){return Uo(i),null}}function drt(t,e,i){const r=e.portal!=null?e.portal:os.getDefault();let n;const s=`${r.url} - ${r.user&&r.user.username} - ${t}`;return FH[s]||(FH[s]=prt(t,r,i).then(o=>(n=o,o.fetchData())).then(o=>({data:o,baseUrl:n.itemUrl??"",styleName:t}))),FH[s]}function prt(t,e,i){return e.load(i).then(()=>{const r=new dy({disableExtraQuery:!0,query:`owner:${Ipe} AND type:${$pe} AND typekeywords:"${t}"`});return e.queryItems(r,i)}).then(({results:r})=>{var o;let n=null;const s=t.toLowerCase();if(r&&Array.isArray(r)){for(const a of r)if(((o=a.typeKeywords)==null?void 0:o.some(p=>p.toLowerCase()===s))&&a.type===$pe&&a.owner===Ipe){n=a;break}}if(!n)throw new se("symbolstyleutils:style-not-found",`The style '${t}' could not be found`,{styleName:t});return n.load(i)})}function hoe(t,e,i){return(t==null?void 0:t.styleUrl)!=null?hrt(t.styleUrl,i):(t==null?void 0:t.styleName)!=null?drt(t.styleName,e,i):Promise.reject(new se("symbolstyleutils:style-url-and-name-missing","Either styleUrl or styleName is required to resolve a style"))}function $Oe(t){return t===null||t.type==="CIMSymbolReference"?t:{type:"CIMSymbolReference",symbol:t}}function LOe(t,e,i=["gltf"]){if(e==="cimRef")return t.cimRef;if(t.formatInfos&&!srt())for(const r of i){const n=t.formatInfos.find(s=>s.type===r);if(n)return n.href}return t.webRef}function doe(t,e){const i={responseType:"json",query:{f:"json"},...e};return yi($f(t),i)}const Ipe="esri_en",$pe="Style",frt="https://cdn.arcgis.com/sharing/rest/content/items/220936cc6ed342c9937abd8f180e7d1e/resources/styles/cim/{SymbolName}.json?f=json";var FI;const DOe="esri.renderers.UniqueValueRenderer",cb=Ce.getLogger(DOe),Lpe="uvInfos-watcher",Dpe="uvGroups-watcher",mrt=",",grt=_s(f$);function yrt(t){const{field1:e,field2:i,field3:r,fieldDelimiter:n,uniqueValueInfos:s,valueExpression:o}=t,a=!(!e||!i);return[{classes:(s??[]).map(c=>{var F;const{symbol:p,label:_,value:x,description:S}=c,[C,M,P]=a?((F=x==null?void 0:x.toString())==null?void 0:F.split(n||""))||[]:[x],$=[];return(e||o)&&$.push(C),i&&$.push(M),r&&$.push(P),{symbol:p,label:_,values:[$],description:S}})}]}let mo=FI=class extends S5(V_){constructor(t){super(t),this._valueInfoMap={},this._isDefaultSymbolDerived=!1,this._isInfosSource=null,this.type="unique-value",this.backgroundFillSymbol=null,this.orderByClassesEnabled=!1,this.valueExpressionTitle=null,this.legendOptions=null,this.defaultLabel=null,this.portal=null,this.styleOrigin=null,this.diff={uniqueValueInfos(e,i){if(!e&&!i)return;if(!e||!i)return{type:"complete",oldValue:e,newValue:i};let r=!1;const n={type:"collection",added:[],removed:[],changed:[],unchanged:[]};for(let s=0;sa.value===i[s].value);o?nrt(o,i[s])?(n.changed.push({type:"complete",oldValue:o,newValue:i[s]}),r=!0):n.unchanged.push({oldValue:o,newValue:i[s]}):(n.added.push(i[s]),r=!0)}for(let s=0;so.value===e[s].value)||(n.removed.push(e[s]),r=!0);return r?n:void 0}},this._set("uniqueValueInfos",[]),this._set("uniqueValueGroups",[])}get _cache(){return{compiledFunc:null}}set field(t){this._set("field",t),this._updateFieldDelimiter(),this._updateUniqueValues()}castField(t){return t==null||typeof t=="function"?t:A9(t)}writeField(t,e,i,r){typeof t=="string"?e[i]=t:r!=null&&r.messages?r.messages.push(new se("property:unsupported","UniqueValueRenderer.field set to a function cannot be written to JSON")):cb.error(".field: cannot write field to JSON since it's not a string value")}set field2(t){this._set("field2",t),this._updateFieldDelimiter(),this._updateUniqueValues()}set field3(t){this._set("field3",t),this._updateUniqueValues()}set valueExpression(t){this._set("valueExpression",t),this._updateUniqueValues()}set defaultSymbol(t){this._isDefaultSymbolDerived=!1,this._set("defaultSymbol",t)}set fieldDelimiter(t){this._set("fieldDelimiter",t),this._updateUniqueValues()}readPortal(t,e,i){return i.portal||os.getDefault()}readStyleOrigin(t,e,i){if(e.styleName)return Object.freeze({styleName:e.styleName});if(e.styleUrl){const r=w_(e.styleUrl,i);return Object.freeze({styleUrl:r})}}writeStyleOrigin(t,e,i,r){t.styleName?e.styleName=t.styleName:t.styleUrl&&(e.styleUrl=x_(t.styleUrl,r))}set uniqueValueGroups(t){this.styleOrigin?cb.error("#uniqueValueGroups=","Cannot modify unique value groups of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueGroups",t),this._updateInfosFromGroups(),this._isInfosSource=!1,this._watchUniqueValueGroups())}set uniqueValueInfos(t){this.styleOrigin?cb.error("#uniqueValueInfos=","Cannot modify unique value infos of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueInfos",t),this._updateValueInfoMap(),this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos())}addUniqueValueInfo(t,e){var r;if(this.styleOrigin)return void cb.error("#addUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");let i;i=typeof t=="object"?grt(t):new f$({value:t,symbol:YMe(e)}),(r=this.uniqueValueInfos)==null||r.push(i),this._valueInfoMap[i.value]=i,this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}removeUniqueValueInfo(t){if(this.styleOrigin)return void cb.error("#removeUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");const e=this.uniqueValueInfos;if(e)for(let i=0;it+e.getAttributeHash(),"")}getMeshHash(){var r;const t=JSON.stringify(this.backgroundFillSymbol),e=JSON.stringify(this.defaultSymbol),i=(r=this.uniqueValueInfos)==null?void 0:r.reduce((n,s)=>n+s.getMeshHash(),"");return`${t}.${e}.${i}.${`${this.field}.${this.field2}.${this.field3}.${this.fieldDelimiter}`}.${this.valueExpression}`}clone(){const t=new FI({field:this.field,field2:this.field2,field3:this.field3,defaultLabel:this.defaultLabel,defaultSymbol:Pe(this.defaultSymbol),orderByClassesEnabled:this.orderByClassesEnabled,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,fieldDelimiter:this.fieldDelimiter,visualVariables:Pe(this.visualVariables),legendOptions:Pe(this.legendOptions),authoringInfo:this.authoringInfo&&this.authoringInfo.clone(),backgroundFillSymbol:Pe(this.backgroundFillSymbol)});this._isDefaultSymbolDerived&&(t._isDefaultSymbolDerived=!0),t._set("portal",this.portal);const e=Pe(this.uniqueValueInfos),i=Pe(this.uniqueValueGroups);return this.styleOrigin&&(t._set("styleOrigin",Object.freeze(Pe(this.styleOrigin))),Object.freeze(e),Object.freeze(i)),t._set("uniqueValueInfos",e),t._updateValueInfoMap(),t._set("uniqueValueGroups",i),t._isInfosSource=this._isInfosSource,t._watchUniqueValueInfosAndGroups(),t}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}async collectRequiredFields(t,e){const i=[this.collectVVRequiredFields(t,e),this.collectSymbolFields(t,e)];await Promise.all(i)}async collectSymbolFields(t,e){const i=[...this.getSymbols().map(r=>r.collectRequiredFields(t,e)),th(t,e,this.valueExpression)];vp(t,e,this.field),vp(t,e,this.field2),vp(t,e,this.field3),await Promise.all(i)}populateFromStyle(){return hoe(this.styleOrigin,{portal:this.portal}).then(t=>{var i;const e=[];return this._valueInfoMap={},t&&t.data&&Array.isArray(t.data.items)&&t.data.items.forEach(r=>{const n=new xE({styleUrl:t.styleUrl,styleName:t.styleName,portal:this.portal,name:r.name});this.defaultSymbol||r.name!==t.data.defaultItem||(this.defaultSymbol=n,this._isDefaultSymbolDerived=!0);const s=new f$({value:r.name,symbol:n});e.push(s),this._valueInfoMap[r.name]=s}),this._set("uniqueValueInfos",Object.freeze(e)),this._updateGroupsFromInfos(!0),this._isInfosSource=null,this._watchUniqueValueInfos(),!this.defaultSymbol&&((i=this.uniqueValueInfos)!=null&&i.length)&&(this.defaultSymbol=this.uniqueValueInfos[0].symbol,this._isDefaultSymbolDerived=!0),this})}_updateFieldDelimiter(){this.field&&this.field2&&!this.fieldDelimiter&&this._set("fieldDelimiter",mrt)}_updateUniqueValues(){this._isInfosSource!=null&&(this._isInfosSource?this._updateGroupsFromInfos():this._updateInfosFromGroups())}_updateValueInfoMap(){this._valueInfoMap={};const{uniqueValueInfos:t}=this;if(t)for(const e of t)this._valueInfoMap[e.value+""]=e}_watchUniqueValueInfosAndGroups(){this._watchUniqueValueInfos(),this._watchUniqueValueGroups()}_watchUniqueValueInfos(){this.removeHandles(Lpe);const{uniqueValueInfos:t}=this;if(t){const e=[];for(const i of t)e.push(_e(()=>({symbol:i.symbol,value:i.value,label:i.label,description:i.description}),(r,n)=>{r!==n&&(this._updateGroupsFromInfos(),this._isInfosSource=!0)},{sync:!0}));this.addHandles(e,Lpe)}}_watchUniqueValueGroups(){this.removeHandles(Dpe);const{uniqueValueGroups:t}=this;if(t){const e=[];for(const i of t){e.push(_e(()=>({classes:i.classes}),(r,n)=>{r!==n&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}));for(const r of i.classes??[])e.push(_e(()=>({symbol:r.symbol,values:r.values,label:r.label,description:r.description}),(n,s)=>{n!==s&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}))}this.addHandles(e,Dpe)}}_updateInfosFromGroups(){if(!this.uniqueValueGroups)return this._set("uniqueValueInfos",null),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const t=[],{field:e,field2:i,field3:r,fieldDelimiter:n,uniqueValueGroups:s,valueExpression:o}=this;if(!e&&!o)return this._set("uniqueValueInfos",t),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const a=!(!e||!i);for(const c of s)for(const p of c.classes??[]){const{symbol:_,label:x,values:S,description:C}=p;for(const M of S??[]){const{value:P,value2:$,value3:F}=M,z=[P];i&&z.push($),r&&z.push(F);const k=a?z.join(n||""):z[0];t.push(new f$({symbol:_,label:x,value:k,description:C}))}}this._set("uniqueValueInfos",t),this._updateValueInfoMap(),this._watchUniqueValueInfos()}_updateGroupsFromInfos(t=!1){if(!this.uniqueValueInfos)return this._set("uniqueValueGroups",null),void this._watchUniqueValueGroups();const{field:e,field2:i,valueExpression:r,fieldDelimiter:n,uniqueValueInfos:s}=this;if(!e&&!r||!s.length)return this._set("uniqueValueGroups",[]),void this._watchUniqueValueGroups();const o=!(!e||!i),a=s.map(p=>{var F;const{symbol:_,label:x,value:S,description:C}=p,[M,P,$]=o?((F=S==null?void 0:S.toString())==null?void 0:F.split(n||""))||[]:[S];return new IOe({symbol:_,label:x,description:C,values:[new fO({value:M,value2:P,value3:$})]})}),c=[new zK({classes:a})];t&&Object.freeze(c),this._set("uniqueValueGroups",c),this._watchUniqueValueGroups()}_getUniqueValueInfo(t,e){return this.valueExpression?this._getUnqiueValueInfoForExpression(t,e):this._getUnqiueValueInfoForFields(t)}_getUnqiueValueInfoForExpression(t,e){const{viewingMode:i,scale:r,spatialReference:n,arcade:s,timeZone:o}=e??{};let a=this._cache.compiledFunc;const c=s.arcadeUtils;if(!a){const _=c.createSyntaxTree(this.valueExpression);a=c.createFunction(_),this._cache.compiledFunc=a}const p=c.executeFunction(a,c.createExecContext(t,c.getViewInfo({viewingMode:i,scale:r,spatialReference:n}),o));return this._valueInfoMap[p+""]}_getUnqiueValueInfoForFields(t){const e=this.field,i=t.attributes;let r;if(typeof e!="function"&&this.field2){const n=this.field2,s=this.field3,o=[];e&&o.push(i[e]),n&&o.push(i[n]),s&&o.push(i[s]),r=o.join(this.fieldDelimiter||"")}else typeof e=="function"?r=e(t):e&&(r=i[e]);return this._valueInfoMap[r+""]}static fromPortalStyle(t,e){const i=new FI(e==null?void 0:e.properties);i._set("styleOrigin",Object.freeze({styleName:t})),i._set("portal",(e==null?void 0:e.portal)||os.getDefault());const r=i.populateFromStyle();return r.catch(n=>{cb.error(`#fromPortalStyle('${t}'[, ...])`,"Failed to create unique value renderer from style name",n)}),r}static fromStyleUrl(t,e){const i=new FI(e==null?void 0:e.properties);i._set("styleOrigin",Object.freeze({styleUrl:t}));const r=i.populateFromStyle();return r.catch(n=>{cb.error(`#fromStyleUrl('${t}'[, ...])`,"Failed to create unique value renderer from style URL",n)}),r}};y([w({readOnly:!0})],mo.prototype,"_cache",null),y([Vt({uniqueValue:"unique-value"})],mo.prototype,"type",void 0),y([w(mOe)],mo.prototype,"backgroundFillSymbol",void 0),y([w({value:null,json:{type:String,read:{source:"field1"},write:{target:"field1"}}})],mo.prototype,"field",null),y([Ci("field")],mo.prototype,"castField",null),y([Et("field")],mo.prototype,"writeField",null),y([w({type:String,value:null,json:{write:!0}})],mo.prototype,"field2",null),y([w({type:String,value:null,json:{write:!0}})],mo.prototype,"field3",null),y([w({type:Boolean,json:{name:"drawInClassOrder",default:!1,write:!0,origins:{"web-scene":{write:!1}}}})],mo.prototype,"orderByClassesEnabled",void 0),y([w({type:String,value:null,json:{write:!0}})],mo.prototype,"valueExpression",null),y([w({type:String,json:{write:!0}})],mo.prototype,"valueExpressionTitle",void 0),y([w({type:dO,json:{write:!0}})],mo.prototype,"legendOptions",void 0),y([w({type:String,json:{write:!0}})],mo.prototype,"defaultLabel",void 0),y([w(pne({...ZB},{json:{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}},origins:{"web-scene":{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}}}}}}))],mo.prototype,"defaultSymbol",null),y([w({type:String,value:null,json:{write:!0}})],mo.prototype,"fieldDelimiter",null),y([w({type:os,readOnly:!0})],mo.prototype,"portal",void 0),y([Rt("portal",["styleName"])],mo.prototype,"readPortal",null),y([w({readOnly:!0,json:{write:{enabled:!1,overridePolicy:()=>({enabled:!0})}}})],mo.prototype,"styleOrigin",void 0),y([Rt("styleOrigin",["styleName","styleUrl"])],mo.prototype,"readStyleOrigin",null),y([Et("styleOrigin",{styleName:{type:String},styleUrl:{type:String}})],mo.prototype,"writeStyleOrigin",null),y([w({type:[zK],json:{read:{source:["uniqueValueGroups","uniqueValueInfos"],reader:(t,e,i)=>(e.uniqueValueGroups||yrt(e)).map(r=>zK.fromJSON(r,i))},write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],mo.prototype,"uniqueValueGroups",null),y([w({type:[f$],json:{read:!1,write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],mo.prototype,"uniqueValueInfos",null),mo=FI=y([Z(DOe)],mo);const poe=mo,vrt={key:"type",base:V_,typeMap:{heatmap:POe,simple:uoe,"unique-value":poe,"class-breaks":yOe,"dot-density":jit,dictionary:Vit,"pie-chart":ert},errorContext:"renderer"},_rt={key:"type",base:V_,typeMap:{simple:uoe,"unique-value":poe,"class-breaks":yOe,heatmap:POe},errorContext:"renderer",validate:brt};function brt(t){switch(t.type){case"simple":return wrt(t);case"unique-value":return xrt(t);case"class-breaks":return Srt(t);case"heatmap":return t}}function wrt(t){if(t.symbol)return t;Ce.getLogger("esri.renderers.support.types").error("Removed invalid 'simple' renderer without a symbol from web scene.")}function xrt(t){const e=t.uniqueValueInfos,i=e==null?void 0:e.filter(({symbol:r,label:n},s)=>(r||Ce.getLogger("esri.renderers.support.types").error(`Removed invalid unique value info ([${s}] ${n}) without a symbol from web scene.`),!!r));return(i==null?void 0:i.length)!==(e==null?void 0:e.length)&&(t.uniqueValueInfos=i),t}function Srt(t){const e=t.classBreakInfos,i=e==null?void 0:e.filter(({symbol:r,label:n},s)=>(r||Ce.getLogger("esri.renderers.support.types").error(`Removed invalid class break info ([${s}] ${n}) without a symbol from web scene.`),!!r));return(i==null?void 0:i.length)!==(e==null?void 0:e.length)&&(t.classBreakInfos=i),t}function Trt(t,e){return Crt(t,null,e)}const Ert=s5({types:vrt});function Crt(t,e,i){return t?t&&(t.styleName||t.styleUrl)&&t.type!=="uniqueValue"?(i!=null&&i.messages&&i.messages.push(new Hf("renderer:unsupported","Only UniqueValueRenderer can be referenced from a web style, but found '"+t.type+"'",{definition:t,context:i})),null):Ert(t,e,i):null}let Art=class NOe{constructor(){this._propertyOriginMap=new Map,this._originStores=new Array(sZ),this._values=new Map,this.multipleOriginsSupported=!0}clone(e){const i=new NOe,r=this._originStores[Di.DEFAULTS];r&&r.forEach((n,s)=>{i.set(s,Pe(n),Di.DEFAULTS)});for(let n=Di.SERVICE;n{e&&e.has(a)||i.set(a,Pe(o),n)})}return i}get(e,i){const r=i===void 0?this._values:this._originStores[i];return r?r.get(e):void 0}keys(e){const i=e==null?this._values:this._originStores[e];return i?[...i.keys()]:[]}set(e,i,r=Di.USER){let n=this._originStores[r];if(n||(n=new Map,this._originStores[r]=n),n.set(e,i),!this._values.has(e)||this._propertyOriginMap.get(e)<=r){const s=this._values.get(e);return this._values.set(e,i),this._propertyOriginMap.set(e,r),s!==i}return!1}delete(e,i=Di.USER){const r=this._originStores[i];if(!r)return;const n=r.get(e);if(r.delete(e),this._values.has(e)&&this._propertyOriginMap.get(e)===i){this._values.delete(e);for(let s=i-1;s>=0;s--){const o=this._originStores[s];if(o&&o.has(e)){this._values.set(e,o.get(e)),this._propertyOriginMap.set(e,s);break}}}return n}has(e,i){const r=i===void 0?this._values:this._originStores[i];return!!r&&r.has(e)}revert(e,i){for(;i>0&&!this.has(e,i);)--i;const r=this._originStores[i],n=r==null?void 0:r.get(e),s=this._values.get(e);return this._values.set(e,n),this._propertyOriginMap.set(e,i),s!==n}originOf(e){return this._propertyOriginMap.get(e)||Di.DEFAULTS}forEach(e){this._values.forEach(e)}};const FOe=t=>{let e=class extends t{constructor(...i){super(...i);const r=Kl(this),n=r.store,s=new Art;r.store=s,TTe(r,n,s)}read(i,r){CTe(this,i,r)}getAtOrigin(i,r){const n=kH(this),s=qv(r);if(typeof i=="string")return n.get(i,s);const o={};return i.forEach(a=>{o[a]=n.get(a,s)}),o}originOf(i){return ez(this.originIdOf(i))}originIdOf(i){return kH(this).originOf(i)}revert(i,r){const n=kH(this),s=qv(r),o=Kl(this);let a;a=typeof i=="string"?i==="*"?n.keys(s):[i]:i,a.forEach(c=>{o.invalidate(c),n.revert(c,s),o.commit(c)})}};return e=y([Z("esri.core.ReadOnlyMultiOriginJSONSupport")],e),e};function kH(t){return Kl(t).store}let Npe=class extends FOe(ze){};Npe=y([Z("esri.core.ReadOnlyMultiOriginJSONSupport")],Npe);const Mrt=t=>{let e=class extends t{constructor(...i){super(...i)}clear(i,r="user"){return zH(this).delete(i,qv(r))}write(i,r){return PTe(this,i=i||{},r),i}setAtOrigin(i,r,n){Kl(this).setAtOrigin(i,r,qv(n))}removeOrigin(i){const r=zH(this),n=qv(i),s=r.keys(n);for(const o of s)r.originOf(o)===n&&r.set(o,r.get(o,n),Di.USER)}updateOrigin(i,r){const n=zH(this),s=qv(r),o=uu(this,i);for(let a=s+1;a{let e=class extends Mrt(FOe(t)){constructor(...i){super(...i)}};return e=y([Z("esri.core.MultiOriginJSONSupport")],e),e};let qz=class extends T5(ze){};qz=y([Z("esri.core.MultiOriginJSONSupport")],qz);function Ort(t){return"portalItem"in t}const Prt=t=>{let e=class extends t{get apiKey(){var i;return this._isOverridden("apiKey")?this._get("apiKey"):Ort(this)?(i=this.portalItem)==null?void 0:i.apiKey:null}set apiKey(i){i!=null?this._override("apiKey",i):(this._clearOverride("apiKey"),this.clear("apiKey","user"))}};return y([w({type:String})],e.prototype,"apiKey",null),e=y([Z("esri.layers.mixins.APIKeyMixin")],e),e},kOe={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer"},zOe=Object.values(kOe),UOe=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${zOe.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),Rrt=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${zOe.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),Irt=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function HKt(t){return!!UOe.test(t)}function TE(t){if(t==null)return null;const e=Is(t),i=(e==null?void 0:e.path.match(UOe))||(e==null?void 0:e.path.match(Rrt));if(!i)return null;const[,r,n,s,o]=i,a=n.indexOf("/");return{title:foe(a!==-1?n.slice(a+1):n),serverType:kOe[s.toLowerCase()],sublayer:o!=null&&o!==""?parseInt(o,10):null,url:{path:r}}}function $rt(t){const e=Is(t).path.match(Irt);return e?{serviceUrl:e[1],sublayerId:Number(e[2])}:null}function foe(t){return(t=t.replaceAll(/\s*[/_]+\s*/g," "))[0].toUpperCase()+t.slice(1)}function Lrt(t,e){const i=[];if(t){const r=TE(t);r!=null&&r.title&&i.push(r.title)}if(e){const r=foe(e);i.push(r)}if(i.length===2){if(i[0].toLowerCase().includes(i[1].toLowerCase()))return i[0];if(i[1].toLowerCase().includes(i[0].toLowerCase()))return i[1]}return i.join(" - ")}function Fpe(t){if(!t)return!1;const e=".arcgis.com/",i="//services",r="//tiles",n="//features",s=(t=t.toLowerCase()).includes(e),o=t.includes(i)||t.includes(r)||t.includes(n);return s&&o}function Drt(t,e){return t&&kTe(UTe(t,e))}function Nrt(t){let{url:e}=t;if(!e)return{url:e};e=UTe(e,t.logger);const i=Is(e),r=TE(i.path);let n;if(r!=null)r.sublayer!=null&&t.layer.layerId==null&&(n=r.sublayer),e=r.url.path;else if(t.nonStandardUrlAllowed){const s=$rt(i.path);s!=null&&(e=s.serviceUrl,n=s.sublayerId)}return{url:kTe(e),layerId:n}}function Frt(t,e,i,r,n){N2(e,r,"url",n),r.url&&t.layerId!=null&&(r.url=Pp(r.url,i,t.layerId.toString()))}function krt(t){if(!t)return!1;const e=t.toLowerCase(),i=e.includes("/services/"),r=e.includes("/mapserver/wmsserver"),n=e.includes("/imageserver/wmsserver"),s=e.includes("/wmsserver");return i&&(r||n||s)}const VOe=t=>{let e=class extends t{get title(){if(this._get("title")&&this.originOf("title")!=="defaults")return this._get("title");if(this.url){const i=TE(this.url);if(i!=null&&i.title)return i.title}return this._get("title")||""}set title(i){this._set("title",i)}set url(i){this._set("url",Drt(i,Ce.getLogger(this)))}};return y([w()],e.prototype,"title",null),y([w({type:String})],e.prototype,"url",null),e=y([Z("esri.layers.mixins.ArcGISService")],e),e},zrt="randomUUID"in crypto;function Zf(){if(zrt)return crypto.randomUUID();const t=crypto.getRandomValues(new Uint16Array(8));t[3]=4095&t[3]|16384,t[4]=16383&t[4]|32768;const e=i=>t[i].toString(16).padStart(4,"0");return e(0)+e(1)+"-"+e(2)+"-"+e(3)+"-"+e(4)+"-"+e(5)+e(6)+e(7)}function qKt(){return`{${Zf().toUpperCase()}}`}function Urt(){return`{${Zf()}}`}const Vrt=Urt(),Brt=new Map,BOe=new Map;async function WKt(t,e,i=!1){var s,o;if(!t||!e)return!0;const r=t.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),n=(s=BOe.get(r))==null?void 0:s.entries();if(n){for(const[a,c]of n)if(c.name===e){const p=!((o=c.stack)!=null&&o.hasForwardEdits());if(!p&&i){const[{deleteForwardEdits:_},{default:x}]=await Promise.all([we(()=>import("./deleteForwardEdits-kZj3bKFL.js"),__vite__mapDeps([])),we(()=>import("./DeleteForwardEditsParameters-ZTiTrFCh.js"),__vite__mapDeps([]))]);return _(r,a,new x({sessionId:Vrt,moment:c.moment}))}return p}}return!0}function jrt(t,e){var n;if(!t)return!1;const i=t.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),r=(n=BOe.get(i))==null?void 0:n.entries();if(r){for(const[s,o]of r)if(o.name===e)return o.lockType==="edit"}return!1}const moe=new Dn.EventEmitter;function Grt(t){return moe.on("apply-edits",new WeakRef(t))}function Hrt(t){return moe.on("update-moment",new WeakRef(t))}function YKt(t,e,i=null,r=!1){const n=ec();return r=e==null||r,moe.emit("apply-edits",{serviceUrl:t,layerId:e,gdbVersion:i,mayReceiveServiceEdits:r,result:n.promise}),n}const jOe="esri.layers.mixins.EditBusLayer",GOe=Symbol(jOe);function XKt(t){return t!=null&&typeof t=="object"&&GOe in t}function eR(t){return t!=null&&typeof t=="object"&&"gdbVersion"in t}function UH(t,e,i){const r=new URL(t).host,n=Brt.get(r),s=o=>!o||o===n;return s(e)&&s(i)||e===i}const qrt=t=>{var e;let i=class extends t{constructor(...r){super(...r),this[e]=!0,this._applyEditsHandler=n=>{const{serviceUrl:s,layerId:o,gdbVersion:a,mayReceiveServiceEdits:c,result:p}=n,_=s===this.url,x=o!=null&&this.layerId!=null&&o===this.layerId,S=eR(this),C=eR(this)&&UH(s,a,this.gdbVersion);if(!_||S&&!C||!x&&!c)return;const M=p.then(P=>{var F;if(x&&(P.addedFeatures.length||P.updatedFeatures.length||P.deletedFeatures.length||P.addedAttachments.length||P.updatedAttachments.length||P.deletedAttachments.length))return this.emit("edits",Pe(P)),P;const $=(F=P.editedFeatures)==null?void 0:F.find(({layerId:z})=>z===this.layerId);if($){const{adds:z,updates:k,deletes:U}=$.editedFeatures,j={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:z?z.map(({attributes:G})=>({objectId:this.objectIdField&&G[this.objectIdField],globalId:this.globalIdField&&G[this.globalIdField]})):[],deletedFeatures:U?U.map(({attributes:G})=>({objectId:this.objectIdField&&G[this.objectIdField],globalId:this.globalIdField&&G[this.globalIdField]})):[],updatedFeatures:k?k.map(({current:{attributes:G}})=>({objectId:this.objectIdField&&G[this.objectIdField],globalId:this.globalIdField&&G[this.globalIdField]})):[],editedFeatures:Pe(P.editedFeatures),exceededTransferLimit:!1,historicMoment:Pe(P.historicMoment)};return this.emit("edits",j),j}return{edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:[],deletedFeatures:[],updatedFeatures:[],editedFeatures:Pe(P.editedFeatures),exceededTransferLimit:!1,historicMoment:Pe(P.historicMoment)}}).then(P=>("historicMoment"in this&&this.historicMoment!==P.historicMoment&&jrt(s,a)&&(this.historicMoment=P.historicMoment),P));this.emit("apply-edits",{result:M})},this._updateMomentHandler=n=>{const{serviceUrl:s,gdbVersion:o,moment:a}=n,c=s===this.url,p=eR(this),_=eR(this)&&UH(s,o,this.gdbVersion),x=eR(this)&&!UH(s,this.gdbVersion,null);c&&p&&_&&x&&"historicMoment"in this&&this.historicMoment!==a&&(this.historicMoment=a)},this.when().then(()=>{this.addHandles(Grt(this._applyEditsHandler)),"historicMoment"in this&&this.addHandles(Hrt(this._updateMomentHandler))},()=>{})}};return e=GOe,i=y([Z(jOe)],i),i},Jf=(t=>t)(["operational-layers","basemap","ground"]),kpe={ArcGISAnnotationLayer:!0,ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BingMapsAerial:!0,BingMapsHybrid:!0,BingMapsRoad:!0,CSV:!0,GeoRSS:!0,GeoJSON:!0,GroupLayer:!0,KML:!0,MediaLayer:!0,OGCFeatureLayer:!0,OrientedImageryLayer:!0,SubtypeGroupLayer:!0,VectorTileLayer:!0,WFS:!0,WMS:!0,WebTiledLayer:!0},zpe={ArcGISImageServiceLayer:!0,ArcGISImageServiceVectorLayer:!0,ArcGISMapServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,OpenStreetMap:!0,VectorTileLayer:!0,WMS:!0,WebTiledLayer:!0,BingMapsAerial:!0,BingMapsRoad:!0,BingMapsHybrid:!0},Upe={ArcGISFeatureLayer:!0},Wrt={"web-scene/operational-layers":{ArcGISDimensionLayer:!0,ArcGISFeatureLayer:!0,ArcGISImageServiceLayer:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISTiledElevationServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,BuildingSceneLayer:!0,GroupLayer:!0,IntegratedMeshLayer:!0,OGCFeatureLayer:!0,PointCloudLayer:!0,WebTiledLayer:!0,CSV:!0,GeoJSON:!0,VectorTileLayer:!0,WFS:!0,WMS:!0,KML:!0,RasterDataLayer:!0,Voxel:!0,LineOfSightLayer:!0},"web-scene/basemap":{ArcGISTiledImageServiceLayer:!0,ArcGISTiledMapServiceLayer:!0,WebTiledLayer:!0,OpenStreetMap:!0,VectorTileLayer:!0,ArcGISImageServiceLayer:!0,WMS:!0,ArcGISMapServiceLayer:!0,ArcGISSceneServiceLayer:!0},"web-scene/ground":{ArcGISTiledElevationServiceLayer:!0,RasterDataElevationLayer:!0},"web-scene/tables":{ArcGISFeatureLayer:!0},"web-map/operational-layers":kpe,"web-map/basemap":zpe,"web-map/tables":Upe,"link-chart/operational-layers":{...kpe,LinkChartLayer:!0},"link-chart/basemap":zpe,"link-chart/tables":Upe,"portal-item/operational-layers":{ArcGISFeatureLayer:!0,ArcGISSceneServiceLayer:!0,ArcGISStreamLayer:!0,ArcGISImageServiceLayer:!0,ArcGISTiledImageServiceLayer:!0,PointCloudLayer:!0,BuildingSceneLayer:!0,IntegratedMeshLayer:!0,OrientedImageryLayer:!0,SubtypeGroupLayer:!0}},VK={milliseconds:1,seconds:1e3,minutes:6e4,hours:36e5,days:864e5,weeks:6048e5,months:26784e5,years:31536e6,decades:31536e7,centuries:31536e8};function Df(t,e,i,r=Yy){const n=new Cp(Pse(r)),s=$i.fromJSDate(t,{zone:n}),o=i==="decades"||i==="centuries"?"year":HOe(i);return i==="decades"&&(e*=10),i==="centuries"&&(e*=100),s.plus({[o]:e}).toJSDate()}function aD(t,e,i="milliseconds"){const r=t.getTime(),n=Hs(e,i,"milliseconds");return new Date(r+n)}function Vpe(t,e,i=Yy){const r=new Cp(Pse(i)),n=$i.fromJSDate(t,{zone:r});if(e==="decades"||e==="centuries"){const o=n.startOf("year"),{year:a}=o,c=a-a%(e==="decades"?10:100);return o.set({year:c}).toJSDate()}const s=HOe(e);return n.startOf(s).toJSDate()}function Yrt(t,e,i="milliseconds"){const r=new Date(Hs(e,i,"milliseconds"));return r.setUTCFullYear(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()),r}function Xrt(t,e="milliseconds"){const i=Hs(t.getUTCHours(),"hours","milliseconds"),r=Hs(t.getUTCMinutes(),"minutes","milliseconds"),n=Hs(t.getUTCSeconds(),"seconds","milliseconds");return Hs(i+r+n+t.getUTCMilliseconds(),"milliseconds",e)}function Zrt(t,e){const i=new Date(t.getTime());return i.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),i}function Jrt(t){const e=new Date(0);return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setFullYear(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()),e}function Hs(t,e,i){return t===0?0:t*VK[e]/VK[i]}function uF(t){return t instanceof Date&&!isNaN(t.getTime())}function Krt(t,e){return t&&e?t.intersection(e):t||e}function HOe(t){switch(t){case"milliseconds":return"millisecond";case"seconds":return"second";case"minutes":return"minute";case"hours":return"hour";case"days":return"day";case"weeks":return"week";case"months":return"month";case"years":return"year"}}var D0;let Kd=D0=class extends Ue{static get allTime(){return Bpe}static get empty(){return Qrt}constructor(t){super(t),this.end=null,this.start=null}readEnd(t,e){return e.end!=null?new Date(e.end):null}writeEnd(t,e){e.end=(t==null?void 0:t.getTime())??null}get isAllTime(){return this.equals(D0.allTime)}get isEmpty(){return this.equals(D0.empty)}readStart(t,e){return e.start!=null?new Date(e.start):null}writeStart(t,e){e.start=(t==null?void 0:t.getTime())??null}clone(){return new D0({end:this.end,start:this.start})}equals(t){var s,o,a,c;if(!t)return!1;const e=((s=this.start)==null?void 0:s.getTime())??this.start,i=((o=this.end)==null?void 0:o.getTime())??this.end,r=((a=t.start)==null?void 0:a.getTime())??t.start,n=((c=t.end)==null?void 0:c.getTime())??t.end;return e===r&&i===n}expandTo(t,e=Yy){if(this.isEmpty||this.isAllTime)return this.clone();let i=this.start;i&&(i=Vpe(i,t,e));let r=this.end;if(r){const n=Vpe(r,t,e);r=r.getTime()===n.getTime()?n:Df(n,1,t,e)}return new D0({start:i,end:r})}intersection(t){var a,c,p,_;if(!t)return this.clone();if(this.isEmpty||t.isEmpty)return D0.empty;if(this.isAllTime)return t.clone();if(t.isAllTime)return this.clone();const e=((a=this.start)==null?void 0:a.getTime())??-1/0,i=((c=this.end)==null?void 0:c.getTime())??1/0,r=((p=t.start)==null?void 0:p.getTime())??-1/0,n=((_=t.end)==null?void 0:_.getTime())??1/0;let s,o;if(r>=e&&r<=i?s=r:e>=r&&e<=n&&(s=e),i>=r&&i<=n?o=i:n>=e&&n<=i&&(o=n),s!=null&&o!=null&&!isNaN(s)&&!isNaN(o)){const x=new D0;return x.start=s===-1/0?null:new Date(s),x.end=o===1/0?null:new Date(o),x}return D0.empty}offset(t,e,i=Yy){if(this.isEmpty||this.isAllTime)return this.clone();const r=new D0,{start:n,end:s}=this;return n!=null&&(r.start=Df(n,t,e,i)),s!=null&&(r.end=Df(s,t,e,i)),r}union(t){if(!t||t.isEmpty)return this.clone();if(this.isEmpty)return t.clone();if(this.isAllTime||t.isAllTime)return Bpe.clone();const e=this.start!=null&&t.start!=null?new Date(Math.min(this.start.getTime(),t.start.getTime())):null,i=this.end!=null&&t.end!=null?new Date(Math.max(this.end.getTime(),t.end.getTime())):null;return new D0({start:e,end:i})}};y([w({type:Date,json:{write:{allowNull:!0}}})],Kd.prototype,"end",void 0),y([Rt("end")],Kd.prototype,"readEnd",null),y([Et("end")],Kd.prototype,"writeEnd",null),y([w({readOnly:!0,json:{read:!1}})],Kd.prototype,"isAllTime",null),y([w({readOnly:!0,json:{read:!1}})],Kd.prototype,"isEmpty",null),y([w({type:Date,json:{write:{allowNull:!0}}})],Kd.prototype,"start",void 0),y([Rt("start")],Kd.prototype,"readStart",null),y([Et("start")],Kd.prototype,"writeStart",null),Kd=D0=y([Z("esri.TimeExtent")],Kd);const Bpe=new Kd,Qrt=new Kd({start:void 0,end:void 0}),f1=Kd;function ent(t){if(!t)return t;const{start:e,end:i}=t;return new f1({start:e!=null?Df(e,-e.getTimezoneOffset(),"minutes"):e,end:i!=null?Df(i,-i.getTimezoneOffset(),"minutes"):i})}function tnt(t){if(!t)return t;const{start:e,end:i}=t;return new f1({start:e!=null?Df(e,e.getTimezoneOffset(),"minutes"):e,end:i!=null?Df(i,i.getTimezoneOffset(),"minutes"):i})}const int={type:Boolean,value:!0,json:{origins:{service:{read:!1,write:!1},"web-map":{read:!1,write:!1}},name:"screenSizePerspective",write:{enabled:!0,layerContainerTypes:Jf}}},rnt={type:Boolean,value:!0,json:{name:"disablePopup",read:{reader:(t,e)=>!e.disablePopup},write:{enabled:!0,writer(t,e,i){e[i]=!t}}}},nnt={type:Boolean,value:!0,nonNullable:!0,json:{name:"showLabels",write:{enabled:!0,layerContainerTypes:Jf}}},goe={type:String,json:{origins:{"portal-item":{write:!1}},write:{isRequired:!0,ignoreOrigin:!0,writer:N2}}},qOe={type:Boolean,value:!0,nonNullable:!0,json:{origins:{service:{read:{enabled:!1}}},name:"showLegend",write:{enabled:!0,layerContainerTypes:Jf}}},snt={value:null,type:WB,json:{origins:{service:{name:"elevationInfo",write:!0}},name:"layerDefinition.elevationInfo",write:{enabled:!0,layerContainerTypes:Jf}}};function ZKt(t){return{type:t,readOnly:!0,json:{origins:{service:{read:!0}},read:!1}}}const WOe={write:{enabled:!0,layerContainerTypes:Jf},read:!0},BK={type:Number,json:{origins:{"web-document":WOe,"portal-item":{write:!0}}}},JKt={...BK,json:{...BK.json,origins:{"web-document":{...WOe,write:{enabled:!0,layerContainerTypes:Jf,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}}}},read:{source:["layerDefinition.drawingInfo.transparency","drawingInfo.transparency"],reader:(t,e,i)=>{var r;return i&&i.origin!=="service"||!e.drawingInfo||e.drawingInfo.transparency===void 0?(r=e.layerDefinition)!=null&&r.drawingInfo&&e.layerDefinition.drawingInfo.transparency!==void 0?WT(e.layerDefinition.drawingInfo.transparency):void 0:WT(e.drawingInfo.transparency)}}}},ont={type:f1,readOnly:!0,get(){var a,c;if(!((a=this.layer)!=null&&a.timeInfo))return null;const{datesInUnknownTimezone:t,timeOffset:e,useViewTime:i}=this.layer,r=(c=this.view)==null?void 0:c.timeExtent;let n=this.layer.timeExtent;t&&(n=tnt(n));let s=i?r&&n?r.intersection(n):r||n:n;if(!s||s.isEmpty||s.isAllTime)return s;e&&(s=s.offset(-e.value,e.unit)),t&&(s=ent(s));const o=this._get("timeExtent");return s.equals(o)?o:s}},KKt={type:Vi,readOnly:!0,json:{origins:{service:{read:{source:["fullExtent","spatialReference"],reader:(t,e)=>{const i=Vi.fromJSON(t);return e.spatialReference!=null&&typeof e.spatialReference=="object"&&(i.spatialReference=rt.fromJSON(e.spatialReference)),i}}}},read:!1}},ant={type:String,json:{origins:{service:{read:!1},"portal-item":{read:!1}}}},QKt={type:Number,json:{origins:{service:{write:{enabled:!1}},"web-scene":{name:"layerDefinition.minScale",write:{enabled:!0,layerContainerTypes:Jf}}},name:"layerDefinition.minScale",write:!0}},eQt={type:Number,json:{origins:{service:{write:{enabled:!1}},"web-scene":{name:"layerDefinition.maxScale",write:{enabled:!0,layerContainerTypes:Jf}}},name:"layerDefinition.maxScale",write:!0}},lnt={json:{write:{ignoreOrigin:!0,layerContainerTypes:Jf},origins:{"web-map":{read:!1,write:!1}}}},ej=t=>{let e=class extends t{constructor(){super(...arguments),this.persistenceEnabled=!0,this.title=null}readId(i,r,n){var s;return((s=n==null?void 0:n.portalItem)==null?void 0:s.type)==="Group Layer"?void 0:i}writeListMode(i,r,n,s){(s&&s.layerContainerType==="ground"||i&&OTe(this,n,{},s))&&(r[n]=i)}writeOperationalLayerType(i,r,n,s){i&&(s==null?void 0:s.layerContainerType)!=="tables"&&(r.layerType=i)}writeTitle(i,r){r.title=i??"Layer"}read(i,r){r&&(r.layer=this),ATe(this,i,n=>super.read(i,n),r)}write(i,r){var o,a;if(!this.persistenceEnabled)return null;if(r!=null&&r.origin){const c=`${r.origin}/${r.layerContainerType||"operational-layers"}`,p=Wrt[c];let _=!!(p!=null&&p[this.operationalLayerType]);if(this.operationalLayerType==="ArcGISTiledElevationServiceLayer"&&c==="web-scene/operational-layers"&&(_=!1),this.operationalLayerType==="ArcGISDimensionLayer"&&c==="web-map/operational-layers"&&(_=!1),!_)return(o=r.messages)==null||o.push(new se("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${c}'`,{layer:this})),null}const n=super.write(i,{...r,layer:this}),s=!!r&&!!r.messages&&!!r.messages.filter(c=>c instanceof se&&c.name==="web-document-write:property-required").length;return R2(n==null?void 0:n.url)?((a=r==null?void 0:r.messages)==null||a.push(new se("layer:invalid-url",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' using a Blob URL cannot be written to web scenes and web maps`,{layer:this})),null):!this.url&&s?null:n}beforeSave(){}};return y([w({type:String,json:{write:{ignoreOrigin:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0}},"portal-item":{write:!1}}}})],e.prototype,"id",void 0),y([Rt("id",["id"])],e.prototype,"readId",null),y([w(lnt)],e.prototype,"listMode",void 0),y([Et("listMode")],e.prototype,"writeListMode",null),y([w({type:String,readOnly:!0,json:{read:!1,write:{target:"layerType",ignoreOrigin:!0},origins:{"portal-item":{write:!1},"web-scene":{name:"layerType",read:!1,write:{enabled:!0,ignoreOrigin:!0,layerContainerTypes:Jf}}}}})],e.prototype,"operationalLayerType",void 0),y([Et("operationalLayerType")],e.prototype,"writeOperationalLayerType",null),y([w(BK)],e.prototype,"opacity",void 0),y([w({type:Boolean,readOnly:!1})],e.prototype,"persistenceEnabled",void 0),y([w({type:String,json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0},origins:{"web-scene":{write:{isRequired:!0,ignoreOrigin:!0,writerEnsuresNonNull:!0}},"portal-item":{write:!1}}},value:"Layer"})],e.prototype,"title",void 0),y([Et("title"),Et(["web-scene"],"title")],e.prototype,"writeTitle",null),y([w({type:Boolean,json:{origins:{"web-scene":{name:"visibility",write:{enabled:!0,layerContainerTypes:Jf}}},name:"visibility",write:!0}})],e.prototype,"visible",void 0),e=y([Z("esri.layers.mixins.OperationalLayer")],e),e};let rv=class extends ze{constructor(e){super(e),this.portalItem=null}normalizeCtorArgs(e){return e!=null&&e.portalItem&&e.path?{...e,path:this._normalizePath(e.path,e.portalItem)}:e}set path(e){e!=null&&Qh(e)?Ce.getLogger(this).error("portalitemresource:invalid-path","A portal item resource path must be relative"):this._set("path",e)}_castPath(e){return this._normalizePath(e,this.portalItem)}get url(){return this.portalItem&&this.path?`${this.portalItem.itemUrl}/resources/${this.path}`:null}get cdnUrl(){return this.portalItem&&this.path?`${this.portalItem.itemCdnUrl}/resources/${this.path}`:null}get itemRelativeUrl(){return this.portalItem&&this.path?`./resources/${this.path}`:null}fetch(e="json",i){const r=this.cdnUrl;if(r==null)throw new se("portal-item-resource:fetch","Portal item resource does not refer to a valid item or path");return this.portalItem.portal.request(r,{responseType:e,query:{token:this.portalItem.apiKey},signal:i==null?void 0:i.signal})}async update(e,i){const{addOrUpdateResource:r}=await we(()=>Promise.resolve().then(()=>VI),void 0);return r(this,"update",e,i)}hasPath(){return this.path!=null}_normalizePath(e,i){return e==null?e:(e=e.replace(/^\/+/,""),i!=null&&Qh(e)&&(e=Pne(e,i.itemUrl)),e==null?void 0:e.replace(/^\/+/,"").replace(/^(\.\/)?resources\//,""))}};y([w()],rv.prototype,"portalItem",void 0),y([w({type:String,value:null})],rv.prototype,"path",null),y([Ci("path")],rv.prototype,"_castPath",null),y([w({type:String,readOnly:!0})],rv.prototype,"url",null),y([w({type:String,readOnly:!0})],rv.prototype,"cdnUrl",null),y([w({type:String,readOnly:!0})],rv.prototype,"itemRelativeUrl",null),rv=y([Z("esri.portal.PortalItemResource")],rv);const cnt=rv;let kI=class extends ze{constructor(e){super(e),this.created=null,this.rating=null}};y([w()],kI.prototype,"created",void 0),y([w()],kI.prototype,"rating",void 0),kI=y([Z("esri.portal.PortalRating")],kI);const VH=kI;var k3;const unt=new Set(["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","GeoJson","CSV","KML","WFS","WMTS","WMS","Feed"]),hnt=new Set(["KML","GeoJson","CSV"]);let ar=k3=class extends F_(Wf){static from(t){return DT(k3,t)}constructor(t){super(t),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.isOrgItem=!1,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.sourceUrl=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}destroy(){this.portal=null}get displayName(){const t=this.type,e=this.typeKeywords||[];let i=t;return t==="Feature Service"||t==="Feature Collection"?i=e.includes("Table")?"Table":e.includes("Route Layer")?"Route Layer":e.includes("Markup")?"Markup":"Feature Layer":t==="Image Service"?i=e.includes("Elevation 3D Layer")?"Elevation Layer":e.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":t==="Scene Service"?i="Scene Layer":t==="Video Service"?i="Video Layer":t==="Scene Package"?i="Scene Layer Package":t==="Stream Service"?i="Feature Layer":t==="Geoprocessing Service"?i=e.includes("Web Tool")?"Tool":"Geoprocessing Service":t==="Geocoding Service"?i="Locator":t==="Geoenrichment Service"?i="GeoEnrichment Service":t==="Microsoft Powerpoint"?i="Microsoft PowerPoint":t==="GeoJson"?i="GeoJSON":t==="Globe Service"?i="Globe Layer":t==="Vector Tile Service"?i="Tile Layer":t==="netCDF"?i="NetCDF":t==="Map Service"?i=e.includes("Spatiotemporal")||!e.includes("Hosted Service")&&!e.includes("Tiled")||e.includes("Relational")?"Map Image Layer":"Tile Layer":t&&t.toLowerCase().includes("add in")?i=t.replaceAll(/(add in)/gi,"Add-In"):t==="datastore catalog service"?i="Big Data File Share":t==="Compact Tile Package"?i="Tile Package (tpkx)":t==="OGCFeatureServer"?i="OGC Feature Layer":t==="web mapping application"&&e.includes("configurableApp")?i="Instant App":t==="Insights Page"?i="Insights Report":t==="Excalibur Imagery Project"&&(i="Excalibur Project"),i}readExtent(t){return t&&t.length?new Vi(t[0][0],t[0][1],t[1][0],t[1][1]):null}get iconUrl(){var S;const t=((S=this.type)==null?void 0:S.toLowerCase())||"",e=this.typeKeywords||[],i="esri/images/portal/",r="16";let n,s=!1,o=!1,a=!1,c=!1,p=!1,_=!1,x=!1;return t.indexOf("service")>0||t==="feature collection"||t==="kml"||t==="wms"||t==="wmts"||t==="wfs"?(s=e.includes("Hosted Service"),t==="feature service"||t==="feature collection"||t==="kml"||t==="wfs"?(o=e.includes("Table"),a=e.includes("Route Layer"),c=e.includes("Markup"),p=e.includes("Spatiotemporal"),_=e.includes("UtilityNetwork"),n=p&&o?"spatiotemporaltable":o?"table":a?"routelayer":c?"markup":p?"spatiotemporal":s?"featureshosted":_?"utilitynetwork":"features"):n=t==="map service"||t==="wms"||t==="wmts"?s||e.includes("Tiled")||t==="wmts"?"maptiles":"mapimages":t==="scene service"?e.includes("Line")?"sceneweblayerline":e.includes("3DObject")?"sceneweblayermultipatch":e.includes("Point")?"sceneweblayerpoint":e.includes("IntegratedMesh")?"sceneweblayermesh":e.includes("PointCloud")?"sceneweblayerpointcloud":e.includes("Polygon")?"sceneweblayerpolygon":e.includes("Building")?"sceneweblayerbuilding":e.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":t==="image service"?e.includes("Elevation 3D Layer")?"elevationlayer":e.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":t==="stream service"?"streamlayer":t==="video service"?e.includes("Live Stream")?"livestreamvideolayer":"videolayer":t==="vector tile service"?"vectortile":t==="datastore catalog service"?"datastorecollection":t==="geocoding service"?"geocodeservice":t==="geoprocessing service"?e.includes("Web Tool")?"tool":"layers":t==="geodata service"?"geodataservice":t==="3dtiles service"?"3dtileslayer":"layers"):t==="web map"||t==="cityengine web scene"?n="maps":t==="web scene"?n=e.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":t==="web mapping application"&&e.includes("configurableApp")?n="instantapps":t==="web mapping application"||t==="mobile application"||t==="application"||t==="operation view"||t==="desktop application"?n="apps":t==="map document"||t==="map package"||t==="published map"||t==="scene document"||t==="globe document"||t==="basemap package"||t==="mobile basemap package"||t==="mobile map package"||t==="project package"||t==="project template"||t==="pro map"||t==="layout"||t==="layer"&&e.includes("ArcGIS Pro")||t==="explorer map"&&e.indexOf("Explorer Document")?n="mapsgray":t==="service definition"||t==="csv"||t==="shapefile"||t==="cad drawing"||t==="geojson"||t==="netcdf"||t==="administrative report"?n="datafiles":t==="explorer add in"||t==="desktop add in"||t==="windows viewer add in"||t==="windows viewer configuration"?n="appsgray":t==="360 vr experience"?n="360vr":t==="arcgis pro add in"||t==="arcgis pro configuration"?n="addindesktop":t==="rule package"||t==="file geodatabase"||t==="sqlite geodatabase"||t==="csv collection"||t==="kml collection"||t==="windows mobile package"||t==="map template"||t==="desktop application template"||t==="gml"||t==="arcpad package"||t==="code sample"||t==="document link"||t==="earth configuration"||t==="operations dashboard add in"||t==="rules package"||t==="image"||t==="workflow manager package"||t==="explorer map"&&e.includes("Explorer Mapping Application")||e.includes("Document")?n="datafilesgray":t==="network analysis service"||t==="geoprocessing service"||t==="geodata service"||t==="geometry service"||t==="geoprocessing package"||t==="locator package"||t==="geoprocessing sample"||t==="workflow manager service"?n="toolsgray":t==="layer"||t==="layer package"||t==="explorer layer"?n="layersgray":t==="scene package"?n="scenepackage":t==="3dtiles package"?n="3dtileslayerpackage":t==="mobile scene package"?n="mobilescenepackage":t==="tile package"||t==="compact tile package"?n="tilepackage":t==="task file"?n="taskfile":t==="report template"?n="report-template":t==="statistical data collection"?n="statisticaldatacollection":t==="insights workbook"?n="workbook":t==="insights model"?n="insightsmodel":t==="insights page"?n="insightspage":t==="insights theme"?n="insightstheme":t==="hub initiative"?n="hubinitiative":t==="hubpage"?n="hubpage":t==="hub event"?n="hubevent":t==="hub site application"?n="hubsite":t==="hub project"?n="hubproject":t==="relational database connection"?n="relationaldatabaseconnection":t==="big data file share"?n="datastorecollection":t==="image collection"?n="imagecollection":t==="style"?n="style":t==="desktop style"?n="desktopstyle":t==="dashboard"?n="dashboard":t==="raster function template"?n="rasterprocessingtemplate":t==="vector tile package"?n="vectortilepackage":t==="ortho mapping project"?n="orthomappingproject":t==="ortho mapping template"?n="orthomappingtemplate":t==="solution"?n="solutions":t==="geopackage"?n="geopackage":t==="deep learning package"?n="deeplearningpackage":t==="real time analytic"?n="realtimeanalytics":t==="big data analytic"?n="bigdataanalytics":t==="feed"?n="feed":t==="excalibur imagery project"?n="excaliburimageryproject":t==="notebook"?n="notebook":t==="storymap"?n="storymap":t==="survey123 add in"?n="survey123addin":t==="mission"?n="mission":t==="mission report"?n="missionreport":t==="mission template"?n="missiontemplate":t==="quickcapture project"?n="quickcaptureproject":t==="pro report"?n="proreport":t==="pro report template"?n="proreporttemplate":t==="urban model"?n="urbanmodel":t==="web experience"?n="experiencebuilder":t==="web experience template"?n="webexperiencetemplate":t==="experience builder widget"?n="experiencebuilderwidget":t==="experience builder widget package"?n="experiencebuilderwidgetpackage":t==="workflow"?n="workflow":t==="insights script"?n="insightsscript":t==="kernel gateway connection"?n="kernelgatewayconnection":t==="hub initiative template"?n="hubinitiativetemplate":t==="storymap theme"?n="storymaptheme":t==="knowledge graph"?n="knowledgegraph":t==="knowledge studio project"?n="knowledgestudio":t==="native application"?n="nativeapp":t==="native application installer"?n="nativeappinstaller":t==="link chart"?n="linkchart":t==="investigation"?n="investigation":t==="ogcfeatureserver"?n="features":t==="pro project"?n="proproject":t==="insights workbook package"?n="insightsworkbookpackage":t==="apache parquet"?n="apacheparquet":t==="notebook code snippets"||t==="notebook code snippet library"?n="notebookcodesnippets":t==="suitability model"?n="suitabilitymodel":t==="esri classifier definition"?n="classifierdefinition":t==="esri classification schema"?n="classificationschema":t==="insights data engineering workbook"?n="dataengineeringworkbook":t==="insights data engineering model"?n="dataengineeringmodel":t==="deep learning studio project"?n="deeplearningproject":t==="discussion"?n="discussion":t==="allsource project"?n="allsourceproject":t==="api key"?n="apikey":t==="data pipeline"?n="datapipelines":t==="group layer"?(x=e.includes("Map"),n=x?"layergroup2d":"layergroup"):n=t==="media layer"?"onlinemedialayer":t==="form"?e.includes("Survey123")?"survey":"datafilesgray":"maps",n?Wr(i+n+r+".png"):null}get isLayer(){return this.type!=null&&unt.has(this.type)}get itemCdnUrl(){let t=this.itemUrl;return t&&yr&&!yr.findCredential(t)&&(t=yr._normalizeAGOLorgDomain(t),t=t.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),t=t.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),t=t.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),t}get itemPageUrl(){var e;const t=(e=this.portal)==null?void 0:e.itemPageUrl;return t&&this.id?`${t}?id=${this.id}`:null}get itemUrl(){var e;const t=(e=this.portal)==null?void 0:e.restUrl;return t&&this.id?`${t}/content/items/${this.id}`:null}get thumbnailUrl(){var i;const t=this.itemUrl,e=this.thumbnail;return t&&e?((i=this.portal)==null?void 0:i.normalizeUrl(`${t}/info/${e}?f=json`))??null:null}get userItemUrl(){var i,r,n;const t=(i=this.portal)==null?void 0:i.restUrl;if(!t)return null;const e=this.owner||((n=(r=this.portal)==null?void 0:r.user)==null?void 0:n.username);return e?`${t}/content/users/${this.ownerFolder?`${e}/${this.ownerFolder}`:e}/items/${this.id}`:null}load(t){const e=this.portal??(this.portal=os.getDefault()),i=e.load(t).then(()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?e.request(this.itemUrl,{signal:t!=null?t.signal:null,query:{token:this.apiKey}}):{}).then(r=>{this.sourceJSON=r,this.read(r)});return this.addResolvingPromise(i),Promise.resolve(this)}async addRating(t){const e={method:"post",query:{}};return t instanceof VH&&(t=t.rating),t==null||isNaN(t)||typeof t!="number"||(e.query.rating=t),this.portal?(await this.portal.request(this.itemUrl+"/addRating",e),new VH({rating:t,created:new Date})):null}clone(){const t={access:this.access,accessInformation:this.accessInformation,applicationProxies:Pe(this.applicationProxies),avgRating:this.avgRating,categories:Pe(this.categories),created:Pe(this.created),culture:this.culture,description:this.description,extent:Pe(this.extent),groupCategories:Pe(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:Pe(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:Pe(this.screenshots),size:this.size,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:Pe(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:Pe(this.typeKeywords),url:this.url};this.loaded&&(t.loadStatus="loaded");const e=new k3({sourceJSON:this.sourceJSON}).set(t);return e._set("isOrgItem",this.isOrgItem),e}createPostQuery(){var i;const t=this.toJSON();for(const r of["tags","typeKeywords","categories"])t[r]=(i=t[r])==null?void 0:i.join(", ");const{extent:e}=t;return e&&(t.extent=JSON.stringify(e)),t}async deleteRating(){await this.portal.request(this.itemUrl+"/deleteRating",{method:"post"})}fetchData(t="json",e){return this.portal.request(this.itemUrl+"/data",{responseType:t,...e,query:{token:this.apiKey}})}async fetchRating(t){const e=await this.portal.request(this.itemUrl+"/rating",{query:{token:this.apiKey},...t});return e.rating!=null?(e.created=new Date(e.created),new VH(e)):null}fetchRelatedItems(t,e){return this.portal.requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...t,token:this.apiKey},...e},k3)}getThumbnailUrl(t){let e=this.thumbnailUrl;return e&&t&&(e+=`&w=${t}`),e}reload(){return this.portal.request(this.itemUrl??"",{cacheBust:!0,query:{token:this.apiKey}}).then(t=>(this.sourceJSON=t,this.read(t),this))}update(t){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const e=t==null?void 0:t.data,i={method:"post"};i.query=this.createPostQuery();for(const r in i.query)i.query[r]===null&&(i.query[r]="");return i.query.clearEmptyFields=!0,e!=null&&(typeof e=="string"?i.query.text=e:typeof e=="object"&&(i.query.text=JSON.stringify(e))),this.portal.request(`${this.userItemUrl}/update`,i).then(()=>this.reload())}):Promise.reject(new se("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async copy(t){if(!this.id)throw new se("portal:item-does-not-exist","The item does not exist yet");await this.load();const{portal:e,itemUrl:i}=this;await e.signIn();const{copyResources:r,folder:n,tags:s,title:o}=t||{},a={method:"post",query:{copyPrivateResources:r==="all",folder:typeof n=="string"?n:n==null?void 0:n.id,includeResources:!!r,tags:s==null?void 0:s.join(","),title:o}},{itemId:c}=await e.request(`${i}/copy`,a);return new k3({id:c,portal:e})}updateThumbnail(t){return this.id?this.load().then(()=>this.portal.signIn()).then(()=>{const e=t.thumbnail,i=t.filename,r={method:"post"};if(typeof e=="string")c1(e)?r.query={data:e}:r.query={url:Wh(e)},i!=null&&(r.query.filename=i);else{const n=new FormData;i!=null?n.append("file",e,i):n.append("file",e),r.body=n}return this.portal.request(`${this.userItemUrl}/updateThumbnail`,r).then(()=>this.reload())}):Promise.reject(new se("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(t={},e){const{fetchResources:i}=await we(()=>Promise.resolve().then(()=>VI),void 0);return i(this,t,e)}async addResource(t,e,i){const{addOrUpdateResource:r}=await we(()=>Promise.resolve().then(()=>VI),void 0);return t.portalItem=this,r(t,"add",e,i)}async removeResource(t,e){const{removeResource:i}=await we(()=>Promise.resolve().then(()=>VI),void 0);if(t.portalItem&&t.portalItem.itemUrl!==this.itemUrl)throw new se("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return i(this,t,e)}async removeAllResources(t){const{removeAllResources:e}=await we(()=>Promise.resolve().then(()=>VI),void 0);return e(this,t)}resourceFromPath(t){return new cnt({portalItem:this,path:t})}toJSON(){var i,r;const t=this.extent,e={accessInformation:this.accessInformation,categories:Pe(this.categories),created:(i=this.created)==null?void 0:i.getTime(),description:this.description,extent:t&&[[t.xmin,t.ymin],[t.xmax,t.ymax]],id:this.id,isOrgItem:this.isOrgItem,licenseInfo:this.licenseInfo,modified:(r=this.modified)==null?void 0:r.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,sourceUrl:this.sourceUrl,spatialReference:this.spatialReference,tags:Pe(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:Pe(this.typeKeywords),url:this.url};return ESe(e)}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");return new k3({sourceJSON:t})}_getPostQuery(){const t=this.toJSON();for(const e in t)e==="tags"&&t[e]!==null&&(t[e]=t[e].join(", ")),e==="typeKeywords"&&t[e]!==null&&(t[e]=t[e].join(", ")),e==="extent"&&t[e]&&(t[e]=JSON.stringify(t[e]));return t}};y([w({type:["private","shared","org","public"]})],ar.prototype,"access",void 0),y([w()],ar.prototype,"accessInformation",void 0),y([w({type:String})],ar.prototype,"apiKey",void 0),y([w({json:{read:{source:"appProxies"}}})],ar.prototype,"applicationProxies",void 0),y([w()],ar.prototype,"avgRating",void 0),y([w()],ar.prototype,"categories",void 0),y([w({type:Date})],ar.prototype,"created",void 0),y([w()],ar.prototype,"culture",void 0),y([w()],ar.prototype,"description",void 0),y([w({readOnly:!0})],ar.prototype,"displayName",null),y([w({type:Vi})],ar.prototype,"extent",void 0),y([Rt("extent")],ar.prototype,"readExtent",null),y([w()],ar.prototype,"groupCategories",void 0),y([w({readOnly:!0})],ar.prototype,"iconUrl",null),y([w()],ar.prototype,"id",void 0),y([w({readOnly:!0})],ar.prototype,"isLayer",null),y([w({type:Boolean,readOnly:!0})],ar.prototype,"isOrgItem",void 0),y([w()],ar.prototype,"itemControl",void 0),y([w({readOnly:!0})],ar.prototype,"itemPageUrl",null),y([w({readOnly:!0})],ar.prototype,"itemUrl",null),y([w()],ar.prototype,"licenseInfo",void 0),y([w({type:Date})],ar.prototype,"modified",void 0),y([w()],ar.prototype,"name",void 0),y([w()],ar.prototype,"numComments",void 0),y([w()],ar.prototype,"numRatings",void 0),y([w()],ar.prototype,"numViews",void 0),y([w()],ar.prototype,"owner",void 0),y([w()],ar.prototype,"ownerFolder",void 0),y([w({type:os})],ar.prototype,"portal",void 0),y([w()],ar.prototype,"screenshots",void 0),y([w()],ar.prototype,"size",void 0),y([w()],ar.prototype,"snippet",void 0),y([w()],ar.prototype,"sourceJSON",void 0),y([w({type:String})],ar.prototype,"sourceUrl",void 0),y([w({type:String})],ar.prototype,"spatialReference",void 0),y([w()],ar.prototype,"tags",void 0),y([w()],ar.prototype,"thumbnail",void 0),y([w({readOnly:!0})],ar.prototype,"thumbnailUrl",null),y([w()],ar.prototype,"title",void 0),y([w()],ar.prototype,"type",void 0),y([w()],ar.prototype,"typeKeywords",void 0),y([w({type:String,json:{read(t,e){var i;if(hnt.has(e.type)){const r=(i=this.portal)==null?void 0:i.restUrl;t||(t=r&&this.id?`${r}/content/items/${this.id}/data`:null)}return t}}})],ar.prototype,"url",void 0),y([w({readOnly:!0})],ar.prototype,"userItemUrl",null),ar=k3=y([Z("esri.portal.PortalItem")],ar);const Om=ar,YOe=Object.freeze(Object.defineProperty({__proto__:null,default:Om},Symbol.toStringTag,{value:"Module"})),Vh=Math.PI/180,dnt=/(?:SPHEROID|ELLIPSOID)\[([^\]]+)]/i,ub=Or.radius,m0=Or.eccentricitySquared,pnt={a1:ub*m0,a2:ub*m0*ub*m0,a3:ub*m0*m0/2,a4:ub*m0*ub*m0*2.5,a5:ub*m0+ub*m0*m0/2,a6:1-m0},fnt={4267:{a:63782064e-1,f:1/294.9786982},4269:{a:6378137,f:1/298.257222101},4326:{a:Or.radius,f:Or.flattening},104900:{a:2439700,f:0},104901:{a:6051e3,f:0},104902:{a:6051800,f:0},104903:{a:y_.radius,f:y_.flattening},104904:{a:3393400,f:1/192.0430107526882},104905:{a:My.radius,f:My.flattening},104906:{a:6200,f:0},104907:{a:11100,f:0},104908:{a:71492e3,f:.06487439154031222},104909:{a:8200,f:0},104910:{a:83500,f:0},104911:{a:1e4,f:0},104912:{a:2409300,f:0},104913:{a:15e3,f:0},104914:{a:4e4,f:0},104915:{a:1562090,f:0},104916:{a:2632345,f:0},104917:{a:85e3,f:0},104918:{a:1821460,f:0},104919:{a:5e3,f:0},104920:{a:12e3,f:0},104921:{a:3e4,f:3},104922:{a:18e3,f:0},104923:{a:14e3,f:0},104924:{a:49300,f:0},104925:{a:60268e3,f:1/10.2079945799458},104926:{a:16e3,f:0},104927:{a:9500,f:0},104928:{a:56e4,f:0},104929:{a:249400,f:0},104930:{a:59500,f:0},104931:{a:16e3,f:0},104932:{a:133e3,f:0},104933:{a:718e3,f:0},104934:{a:888e3,f:0},104935:{a:1986300,f:0},104936:{a:1e4,f:0},104937:{a:41900,f:0},104938:{a:11e4,f:0},104939:{a:50100,f:0},104940:{a:764e3,f:0},104941:{a:11e3,f:0},104942:{a:529800,f:0},104943:{a:2575e3,f:0},104944:{a:25559e3,f:1/43.61604095563141},104945:{a:578900,f:0},104946:{a:33e3,f:0},104947:{a:21e3,f:0},104948:{a:13e3,f:0},104949:{a:31e3,f:0},104950:{a:27e3,f:0},104951:{a:42e3,f:0},104952:{a:235800,f:0},104953:{a:761400,f:0},104954:{a:15e3,f:0},104955:{a:54e3,f:0},104956:{a:77e3,f:0},104957:{a:27e3,f:0},104958:{a:788900,f:0},104959:{a:584700,f:0},104960:{a:24764e3,f:.01708124697141011},104961:{a:74e3,f:0},104962:{a:79e3,f:0},104963:{a:104e3,f:.14423076923076922},104964:{a:29e3,f:0},104965:{a:17e4,f:0},104966:{a:208e3,f:0},104967:{a:4e4,f:0},104968:{a:1352600,f:0},104969:{a:1195e3,f:0},104970:{a:593e3,f:0},104971:{a:My.radius,f:0},104972:{a:47e4,f:0},104973:{a:255e3,f:0},104974:{a:2439400,f:0}};var Oe;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.SPHERICAL_ECEF=1]="SPHERICAL_ECEF",t[t.WGS84=2]="WGS84",t[t.WEB_MERCATOR=3]="WEB_MERCATOR",t[t.WGS84_ECEF=4]="WGS84_ECEF",t[t.CGCS2000=5]="CGCS2000",t[t.WGS84_COMPARABLE_LON_LAT=6]="WGS84_COMPARABLE_LON_LAT",t[t.SPHERICAL_MARS_PCPF=7]="SPHERICAL_MARS_PCPF",t[t.GCSMARS2000=8]="GCSMARS2000",t[t.SPHERICAL_MOON_PCPF=9]="SPHERICAL_MOON_PCPF",t[t.GCSMOON2000=10]="GCSMOON2000",t[t.LON_LAT=11]="LON_LAT",t[t.PLATE_CARREE=12]="PLATE_CARREE"})(Oe||(Oe={}));const IM={[Oe.WGS84]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:Qn,[Oe.SPHERICAL_ECEF]:l2,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:uP,[Oe.PLATE_CARREE]:a2,[Oe.WGS84]:Qn,[Oe.WGS84_ECEF]:u2},[Oe.CGCS2000]:{[Oe.CGCS2000]:Qn,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:Qn,[Oe.SPHERICAL_ECEF]:l2,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:a2,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:u2},[Oe.GCSMARS2000]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:Qn,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:null,[Oe.SPHERICAL_ECEF]:null,[Oe.SPHERICAL_MARS_PCPF]:GK,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:null,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:null},[Oe.GCSMOON2000]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:Qn,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:null,[Oe.SPHERICAL_ECEF]:null,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:jK,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:null,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:null},[Oe.WEB_MERCATOR]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:bT,[Oe.WGS84_COMPARABLE_LON_LAT]:bT,[Oe.SPHERICAL_ECEF]:ZOe,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:Qn,[Oe.PLATE_CARREE]:KOe,[Oe.WGS84]:bT,[Oe.WGS84_ECEF]:JOe},[Oe.WGS84_ECEF]:{[Oe.CGCS2000]:h2,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:h2,[Oe.WGS84_COMPARABLE_LON_LAT]:h2,[Oe.SPHERICAL_ECEF]:tPe,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:iPe,[Oe.PLATE_CARREE]:mnt,[Oe.WGS84]:h2,[Oe.WGS84_ECEF]:Qn},[Oe.SPHERICAL_ECEF]:{[Oe.CGCS2000]:c2,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:c2,[Oe.WGS84_COMPARABLE_LON_LAT]:c2,[Oe.SPHERICAL_ECEF]:Qn,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:QOe,[Oe.PLATE_CARREE]:gnt,[Oe.WGS84]:c2,[Oe.WGS84_ECEF]:ePe},[Oe.SPHERICAL_MARS_PCPF]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:qK,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:qK,[Oe.WGS84_COMPARABLE_LON_LAT]:null,[Oe.SPHERICAL_ECEF]:null,[Oe.SPHERICAL_MARS_PCPF]:Qn,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:null,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:null},[Oe.SPHERICAL_MOON_PCPF]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:HK,[Oe.LON_LAT]:HK,[Oe.WGS84_COMPARABLE_LON_LAT]:null,[Oe.SPHERICAL_ECEF]:null,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:Qn,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:null,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:null},[Oe.UNKNOWN]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:null,[Oe.WGS84_COMPARABLE_LON_LAT]:null,[Oe.SPHERICAL_ECEF]:null,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:Qn,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:null,[Oe.WGS84]:null,[Oe.WGS84_ECEF]:null},[Oe.LON_LAT]:{[Oe.CGCS2000]:Qn,[Oe.GCSMARS2000]:Qn,[Oe.GCSMOON2000]:Qn,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:Qn,[Oe.SPHERICAL_ECEF]:l2,[Oe.SPHERICAL_MARS_PCPF]:GK,[Oe.SPHERICAL_MOON_PCPF]:jK,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:uP,[Oe.PLATE_CARREE]:a2,[Oe.WGS84]:Qn,[Oe.WGS84_ECEF]:u2},[Oe.WGS84_COMPARABLE_LON_LAT]:{[Oe.CGCS2000]:null,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:Qn,[Oe.WGS84_COMPARABLE_LON_LAT]:Qn,[Oe.SPHERICAL_ECEF]:l2,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:null,[Oe.PLATE_CARREE]:a2,[Oe.WGS84]:Qn,[Oe.WGS84_ECEF]:u2},[Oe.PLATE_CARREE]:{[Oe.CGCS2000]:JS,[Oe.GCSMARS2000]:null,[Oe.GCSMOON2000]:null,[Oe.LON_LAT]:JS,[Oe.WGS84_COMPARABLE_LON_LAT]:JS,[Oe.SPHERICAL_ECEF]:ynt,[Oe.SPHERICAL_MARS_PCPF]:null,[Oe.SPHERICAL_MOON_PCPF]:null,[Oe.UNKNOWN]:null,[Oe.WEB_MERCATOR]:vnt,[Oe.PLATE_CARREE]:Qn,[Oe.WGS84]:JS,[Oe.WGS84_ECEF]:_nt}};function XOe(t){const e=AL(t,nPe);return IM[e][Oe.WGS84_COMPARABLE_LON_LAT]}function yoe(t,e,i=rPe()){return t==null||e==null?null:wnt(t,e,i).projector}function rQt(t,e){switch(yoe(t,e,woe)){case Qn:return"copy3";case l2:return"wgs84ToSphericalECEF";case uP:return"wgs84ToWebMercator";case a2:return"wgs84ToPlateCarree";case u2:return"wgs84ToWGS84ECEF";case bT:return"webMercatorToWGS84";case ZOe:return"webMercatorToSphericalECEF";case JOe:return"webMercatorToWGS84ECEF";case KOe:return"webMercatorToPlateCarree";case h2:return"wgs84ECEFToWGS84";case tPe:return"wgs84ECEFToSphericalECEF";case iPe:return"wgs84ECEFToWebMercator";case c2:return"sphericalECEFToWGS84";case QOe:return"sphericalECEFToWebMercator";case qK:return"sphericalMarsPCPFToMars2000";case HK:return"sphericalMoonPCPFToMoon2000";case ePe:return"sphericalECEFToWGS84ECEF";case GK:return"mars2000ToSphericalPCPF";case jK:return"moon2000ToSphericalPCPF";default:return null}}function AL(t,e){return t?e.spatialReference===t?e.spatialReferenceId:(e.spatialReference=t,"metersPerUnit"in e&&(e.metersPerUnit=xs(t,1)),wz(t)?e.spatialReferenceId=Oe.SPHERICAL_ECEF:gL(t)?e.spatialReferenceId=Oe.WGS84:FT(t)?e.spatialReferenceId=Oe.WEB_MERCATOR:yL(t)?e.spatialReferenceId=Oe.PLATE_CARREE:t.wkt===iEe.wkt?e.spatialReferenceId=Oe.WGS84_ECEF:t.wkid===Cf.CGCS2000?e.spatialReferenceId=Oe.CGCS2000:t.wkt===uB.wkt?e.spatialReferenceId=Oe.SPHERICAL_MARS_PCPF:t.wkt===hB.wkt?e.spatialReferenceId=Oe.SPHERICAL_MOON_PCPF:u1(t)?e.spatialReferenceId=Oe.GCSMARS2000:h1(t)?e.spatialReferenceId=Oe.GCSMOON2000:e.spatialReferenceId=Oe.UNKNOWN):Oe.UNKNOWN}function Qn(t,e,i,r){t!==i&&(i[r++]=t[e++],i[r++]=t[e++],i[r]=t[e])}function bT(t,e,i,r){i[r++]=dP*(t[e++]/Or.radius),i[r++]=dP*(Math.PI/2-2*Math.atan(Math.exp(-t[e++]/Or.radius))),i[r]=t[e]}function ZOe(t,e,i,r){bT(t,e,i,r),l2(i,r,i,r)}function JOe(t,e,i,r){bT(t,e,i,r),u2(i,r,i,r)}function voe(t,e,i,r,n){const s=.4999999*Math.PI,o=Je(hP*t[e+1],-s,s),a=Math.sin(o);i[r++]=hP*t[e]*n.radius,i[r++]=n.halfSemiMajorAxis*Math.log((1+a)/(1-a)),i[r]=t[e+2]}function uP(t,e,i,r){voe(t,e,i,r,Or)}const jpe=Or.radius*Math.PI/180,Gpe=180/(Or.radius*Math.PI);function a2(t,e,i,r){i[r]=t[e]*jpe,i[r+1]=t[e+1]*jpe,i[r+2]=t[e+2]}function JS(t,e,i,r){i[r]=t[e]*Gpe,i[r+1]=t[e+1]*Gpe,i[r+2]=t[e+2]}function KOe(t,e,i,r){bT(t,e,i,r),a2(i,r,i,r)}function mnt(t,e,i,r){h2(t,e,i,r),a2(i,r,i,r)}function gnt(t,e,i,r){c2(t,e,i,r),a2(i,r,i,r)}function ynt(t,e,i,r){JS(t,e,i,r),l2(i,r,i,r)}function vnt(t,e,i,r){JS(t,e,i,r),uP(i,r,i,r)}function _nt(t,e,i,r){JS(t,e,i,r),u2(i,r,i,r)}function _oe(t,e,i,r,n){const s=n+t[e+2],o=hP*t[e+1],a=hP*t[e],c=Math.cos(o);i[r++]=Math.cos(a)*c*s,i[r++]=Math.sin(a)*c*s,i[r]=Math.sin(o)*s}function jK(t,e,i,r){_oe(t,e,i,r,y_.radius)}function GK(t,e,i,r){_oe(t,e,i,r,My.radius)}function l2(t,e,i,r){_oe(t,e,i,r,Or.radius)}function boe(t,e,i,r,n){const s=t[e],o=t[e+1],a=t[e+2],c=Math.sqrt(s*s+o*o+a*a),p=qf(a/(c===0?1:c)),_=Math.atan2(o,s);i[r++]=dP*_,i[r++]=dP*p,i[r]=c-n}function HK(t,e,i,r){boe(t,e,i,r,y_.radius)}function qK(t,e,i,r){boe(t,e,i,r,My.radius)}function c2(t,e,i,r){boe(t,e,i,r,Or.radius)}function QOe(t,e,i,r){c2(t,e,i,r),uP(i,r,i,r)}function ePe(t,e,i,r){c2(t,e,i,r),u2(i,r,i,r)}function bnt(t,e,i,r,n){const s=hP*t[e],o=hP*t[e+1],a=t[e+2],c=Math.sin(o),p=Math.cos(o),_=n.radius/Math.sqrt(1-n.eccentricitySquared*c*c);i[r++]=(_+a)*p*Math.cos(s),i[r++]=(_+a)*p*Math.sin(s),i[r++]=(_*(1-n.eccentricitySquared)+a)*c}function u2(t,e,i,r){bnt(t,e,i,r,Or)}function h2(t,e,i,r){const n=pnt,s=t[e],o=t[e+1],a=t[e+2];let c,p,_,x,S,C,M,P,$,F,z,k,U,j,G,Y,Q,ne,ie,he,ce;c=Math.abs(a),p=s*s+o*o,_=Math.sqrt(p),x=p+a*a,S=Math.sqrt(x),he=Math.atan2(o,s),C=a*a/x,M=p/x,j=n.a2/S,G=n.a3-n.a4/S,M>.3?(P=c/S*(1+M*(n.a1+j+C*G)/S),ie=Math.asin(P),F=P*P,$=Math.sqrt(1-F)):($=_/S*(1-C*(n.a5-j-M*G)/S),ie=Math.acos($),F=1-$*$,P=Math.sqrt(F)),z=1-Or.eccentricitySquared*F,k=Or.radius/Math.sqrt(z),U=n.a6*k,j=_-k*$,G=c-U*P,Q=$*j+P*G,Y=$*G-P*j,ne=Y/(U/z+Q),ie+=ne,ce=Q+Y*ne/2,a<0&&(ie=-ie),i[r++]=dP*he,i[r++]=dP*ie,i[r]=ce}function tPe(t,e,i,r){h2(t,e,i,r),l2(i,r,i,r)}function iPe(t,e,i,r){h2(t,e,i,r),uP(i,r,i,r)}function wnt(t,e,i){if(t==null||e==null||i.source.spatialReference===t&&i.dest.spatialReference===e)return i;const r=AL(t,i.source),n=AL(e,i.dest);return r===Oe.UNKNOWN&&n===Oe.UNKNOWN?jn(t,e)?i.projector=Qn:i.projector=null:i.projector=IM[r][n],i}function rPe(){return{source:{spatialReference:null,spatialReferenceId:Oe.UNKNOWN,metersPerUnit:1},dest:{spatialReference:null,spatialReferenceId:Oe.UNKNOWN,metersPerUnit:1},projector:Qn}}const nPe={spatialReference:null,spatialReferenceId:Oe.UNKNOWN},xnt={spatialReference:null,spatialReferenceId:Oe.UNKNOWN},woe=rPe(),hP=Ei(1),dP=mu(1);function un(t,e,i,r,n,s,o=1){const a=yoe(e,n,woe);if(a==null)return!1;if(a===Qn){if(t===r&&i===s)return!0;const p=i+3*o;for(let _=i,x=s;_=0;i--){const r=this.steps[i];e.steps.push(r.getInverse())}return e}getGTListEntry(){let e="";for(const i of this.steps)e+=i.uid.toString()+",";return e!==this._chain&&(this._gtlistentry=null,this._cachedProjection={},this._chain=e),this._gtlistentry}assignCachedGe(e,i,r){this._cachedProjection[zI.cacheKey(e,i)]=r}getCachedGeTransformation(e,i){let r="";for(const s of this.steps)r+=s.uid.toString()+",";r!==this._chain&&(this._gtlistentry=null,this._cachedProjection={},this._chain=r);const n=this._cachedProjection[zI.cacheKey(e,i)];return n===void 0?null:n}};function sPe(t,e,i){if(e==null||i==null||i.vcsWkid||jn(e,i)||$2(e)||$2(i))return null;const r=ad(e)/ad(i);if(r===1)return null;switch(t){case"point":case"esriGeometryPoint":return n=>Snt(n,r);case"polyline":case"esriGeometryPolyline":return n=>Ent(n,r);case"polygon":case"esriGeometryPolygon":return n=>Tnt(n,r);case"multipoint":case"esriGeometryMultipoint":return n=>Cnt(n,r);case"extent":case"esriGeometryEnvelope":return n=>Ant(n,r);default:return null}}function Snt(t,e){(t==null?void 0:t.z)!=null&&(t.z*=e)}function Tnt(t,e){if(t)for(const i of t.rings)for(const r of i)r.length>2&&(r[2]*=e)}function Ent(t,e){if(t)for(const i of t.paths)for(const r of i)r.length>2&&(r[2]*=e)}function Cnt(t,e){if(t)for(const i of t.points)i.length>2&&(i[2]*=e)}function Ant(t,e){t&&t.zmin!=null&&t.zmax!=null&&(t.zmin*=e,t.zmax*=e)}let Pm=null,z2=null,m$=null,hF={};const xoe=new M9;function hx(){return!!Pm&&XTe()}function Mnt(){return!!hx()||(wi(xoe),S_(),!1)}function S_(t){return m$==null&&(m$=Promise.all([ZTe(),we(()=>Promise.resolve().then(()=>mBt),void 0).then(e=>e.g),we(()=>Promise.resolve().then(()=>xBt),void 0)])),m$.then(([,e,{hydratedAdapter:i}])=>{St(t),z2=i,Pm=e.default,Pm._enableProjection(xWe),xoe.notify()})}function sl(t,e,i=null,r=null){return Array.isArray(t)?t.length===0?[]:YK(z2,t,t[0].spatialReference,e,i,r):YK(z2,[t],t.spatialReference,e,i,r)[0]}function YK(t,e,i,r,n=null,s=null){if(i==null||r==null)return e;if(rh(i,r,n))return e.map(o=>g$(o,i,r));if(n==null&&wz(i))return e.map(o=>g$(o,i,rt.WGS84)).map(o=>ML(o,r));if(n==null&&wz(r))return e.map(o=>ML(o,rt.WGS84)).map(o=>g$(o,rt.WGS84,r));if(n==null){const o=Wz.cacheKey(i,r);hF[o]!==void 0?n=hF[o]:((n=lPe(i,r,void 0))==null&&(n=new Wz),hF[o]=n)}if(Pm==null||t==null)throw new tj;return s!=null?Pm._project(t,e,i,r,n,s):Pm._project(t,e,i,r,n)}function oPe(t,e){const i=aPe([t],e);return i.pending!=null?{pending:i.pending,geometry:null}:i.geometries!=null?{pending:null,geometry:i.geometries[0]}:{pending:null,geometry:null}}function aPe(t,e){if(!hx()){for(const i of t)if(i!=null&&!jn(i.spatialReference,e)&&Sc(i.spatialReference)&&Sc(e)&&!rh(i.spatialReference,e))return wi(xoe),{pending:S_(),geometries:null}}return{pending:null,geometries:t.map(i=>i==null?null:jn(i.spatialReference,e)?i:Sc(i.spatialReference)&&Sc(e)?ML(i,e):null)}}function lPe(t,e,i=null){if(t==null||e==null)return null;if(Pm==null||z2==null)throw new tj;const r=Pm._getTransformation(z2,t,e,i,i==null?void 0:i.spatialReference);return r!==null?Wz.fromGE(r):null}function Ont(t,e,i=null){if(Pm==null||z2==null)throw new tj;const r=Pm._getTransformationBySuitability(z2,t,e,i,i==null?void 0:i.spatialReference);if(r!==null){const n=[];for(const s of r)n.push(Wz.fromGE(s));return n}return[]}let tj=class extends se{constructor(){super("projection:not-loaded","projection engine not fully loaded yet, please call load()")}};function Pnt(){Pm=null,z2=null,m$=null,hF={}}const Rnt={get loadPromise(){return m$}};function ML(t,e){try{const i=sl(t,e);if(i==null)return null;"xmin"in t&&"xmin"in i&&(i.zmin=t.zmin,i.zmax=t.zmax);const r=sPe(i.type,t.spatialReference,e);return r!=null&&r(i),i}catch(i){if(!(i instanceof tj))throw i;return null}}async function Qy(t,e,i){const r=t.spatialReference;return r!=null&&e!=null&&await T_(r,e,null,i),ML(t,e)}function rh(t,e,i){return!i&&(!!jn(t,e)||Sc(t)&&Sc(e)&&!!yoe(t,e,woe))}async function T_(t,e,i,r){if(hx())return rz(r);if(Array.isArray(t)){for(const{source:n,dest:s,geographicTransformation:o}of t)if(!rh(n,s,o))return S_(r)}else if(!rh(t,e,i))return S_(r);return rz(r)}function g$(t,e,i){return t?"x"in t?uPe(t,e,new mt,i,0):"xmin"in t?mPe(t,e,new Vi,i,0):"rings"in t?fPe(t,e,new tl,i,0):"paths"in t?dPe(t,e,new Tc,i,0):"points"in t?hPe(t,e,new Mm,i,0):null:null}function cPe(t,e,i=e.spatialReference,r=0){return i!=null&&t.spatialReference!=null&&uPe(t,t.spatialReference,e,i,r)!=null}function uPe(t,e,i,r,n){ru[0]=t.x,ru[1]=t.y;const s=t.z;return ru[2]=s!==void 0?s:n,un(ru,e,0,ru,r,0,1)?(i.x=ru[0],i.y=ru[1],i.spatialReference=r,s!==void 0||$2(r)?(i.z=ru[2],i.hasZ=!0):(i.z=void 0,i.hasZ=!1),t.m===void 0?(i.m=void 0,i.hasM=!1):(i.m=t.m,i.hasM=!0),i):null}function Int(t,e,i=e.spatialReference,r=0){return t.spatialReference!=null&&i!=null&&hPe(t,t.spatialReference,e,i,r)!=null}function hPe(t,e,i,r,n){const{points:s,hasZ:o,hasM:a}=t,c=[],p=s.length,_=[];for(const S of s)_.push(S[0],S[1],o?S[2]:n);if(!un(_,e,0,_,r,0,p))return null;const x=o||$2(r);for(let S=0;S-1&&i.splice(r,1)}}function qpe(t,e,i){i?Nnt(t,e):Fnt(t,e)}async function lQt(t){const e=t.clone().normalize();let i;if(e.length>1)for(const r of e)i?r.width>i.width&&(i=r):i=r;else i=e[0];return Dnt(i)}const XK={DEVELOPER_BASEMAP:"DeveloperBasemap",JSAPI:"ArcGIS API for JavaScript",METADATA:"Metadata",MULTI_LAYER:"Multilayer",SINGLE_LAYER:"Singlelayer",TABLE:"Table",HOSTED_SERVICE:"Hosted Service",LOCAL_SCENE:"ViewingMode-Local",TILED_IMAGERY:"Tiled Imagery",GROUP_LAYER_MAP:"Map"};function Wpe(t){var c;const{portal:e,isOrgItem:i,itemControl:r}=t,n=(c=e.user)==null?void 0:c.privileges;let s=!n||n.includes("features:user:edit"),o=!!i&&!!(n!=null&&n.includes("features:user:fullEdit"));const a=r==="update"||r==="admin";return a?o=s=!0:o&&(s=!0),{features:{edit:s,fullEdit:o},content:{updateItem:a}}}const ij=t=>{let e=class extends t{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0,this.userHasFullEditingPrivileges=!1,this.userHasUpdateItemPrivileges=!1}destroy(){this.portalItem=et(this.portalItem),this.resourceReferences.portalItem=null,this.resourceReferences.paths.length=0}set portalItem(i){i!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",i))}readPortalItem(i,r,n){if(r.itemId)return new Om({id:r.itemId,portal:n==null?void 0:n.portal})}writePortalItem(i,r){i!=null&&i.id&&(r.itemId=i.id)}async loadFromPortal(i,r){var n;if((n=this.portalItem)!=null&&n.id)try{const{load:s}=await we(()=>import("./layersLoader-zT5u6Dmk.js"),__vite__mapDeps([8,3,1,0,9,10]));return St(r),await s({instance:this,supportedTypes:i.supportedTypes,validateItem:i.validateItem,supportsData:i.supportsData,layerModuleTypeMap:i.layerModuleTypeMap},r)}catch(s){throw on(s)||Ce.getLogger(this).warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id}) + ${s}`),s}}async finishLoadEditablePortalLayer(i){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(i).catch(r=>(Uo(r),!0)))}async setUserPrivileges(i,r){if(!Mr.userPrivilegesApplied)return this.finishLoadEditablePortalLayer(r);if(this.url)try{const{features:{edit:n,fullEdit:s},content:{updateItem:o}}=await this._fetchUserPrivileges(i,r);this._set("userHasEditingPrivileges",n),this._set("userHasFullEditingPrivileges",s),this._set("userHasUpdateItemPrivileges",o)}catch(n){Uo(n)}}async _fetchUserPrivileges(i,r){let n=this.portalItem;if(!i||!n||!n.loaded||n.sourceUrl)return this._fetchFallbackUserPrivileges(r);const s=i===n.id;if(s&&n.portal.user)return Wpe(n);let o,a;if(s)o=n.portal.url;else try{o=await dOe(this.url,r)}catch(x){Uo(x)}if(!o||!Vqe(o,n.portal.url))return this._fetchFallbackUserPrivileges(r);try{const x=r!=null?r.signal:null;a=await(yr==null?void 0:yr.getCredential(`${o}/sharing`,{prompt:!1,signal:x}))}catch(x){Uo(x)}const c=!0,p=!1,_=!1;if(!a)return{features:{edit:c,fullEdit:p},content:{updateItem:_}};try{if(s?await n.reload():(n=new Om({id:i,portal:{url:o}}),await n.load(r)),n.portal.user)return Wpe(n)}catch(x){Uo(x)}return{features:{edit:c,fullEdit:p},content:{updateItem:_}}}async _fetchFallbackUserPrivileges(i){let r=!0;try{r=await this._fetchUserHasEditingPrivileges(i)}catch(n){Uo(n)}return{features:{edit:r,fullEdit:!1},content:{updateItem:!1}}}async _fetchUserHasEditingPrivileges(i){const r=this.url?yr==null?void 0:yr.findCredential(this.url):null;if(!r)return!0;const n=uD.credential===r?uD.user:await this._fetchEditingUser(i);return uD.credential=r,uD.user=n,(n==null?void 0:n.privileges)==null||n.privileges.includes("features:user:edit")}async _fetchEditingUser(i){var _,x;const r=(x=(_=this.portalItem)==null?void 0:_.portal)==null?void 0:x.user;if(r)return r;const n=yr.findServerInfo(this.url??"");if(!(n!=null&&n.owningSystemUrl))return null;const s=`${n.owningSystemUrl}/sharing/rest`,o=os.getDefault();if(o&&o.loaded&&$f(o.restUrl)===$f(s))return o.user;const a=`${s}/community/self`,c=i!=null?i.signal:null,p=await ih(yi(a,{authMode:"no-prompt",query:{f:"json"},signal:c}));return p.ok?Gse.fromJSON(p.value.data):null}read(i,r){r&&(r.layer=this),super.read(i,r)}write(i,r){var o;const n=r==null?void 0:r.portal,s=((o=this.portalItem)==null?void 0:o.id)&&(this.portalItem.portal||os.getDefault());return n&&s&&!DTe(s.restUrl,n.restUrl)?(r.messages&&r.messages.push(new se("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(i,{...r,layer:this})}};return y([w({type:Om})],e.prototype,"portalItem",null),y([Rt("web-document","portalItem",["itemId"])],e.prototype,"readPortalItem",null),y([Et("web-document","portalItem",{itemId:{type:String}})],e.prototype,"writePortalItem",null),y([w({clonable:!1})],e.prototype,"resourceReferences",void 0),y([w({type:Boolean,readOnly:!0})],e.prototype,"userHasEditingPrivileges",void 0),y([w({type:Boolean,readOnly:!0})],e.prototype,"userHasFullEditingPrivileges",void 0),y([w({type:Boolean,readOnly:!0})],e.prototype,"userHasUpdateItemPrivileges",void 0),e=y([Z("esri.layers.mixins.PortalLayer")],e),e},uD={credential:null,user:null};function vPe(t){return t&&"getAtOrigin"in t&&"originOf"in t}function Yz(t){t!=null&&t.writtenProperties&&t.writtenProperties.forEach(({target:e,propName:i,newOrigin:r})=>{vPe(e)&&r&&e.originOf(i)!==r&&e.updateOrigin(i,r)})}var UI;const Xz=gu()({orthometric:"gravity-related-height",gravity_related_height:"gravity-related-height",ellipsoidal:"ellipsoidal"}),_Pe=Xz.jsonValues.slice();uL(_Pe,"orthometric");const y$=gu()({meter:"meters",foot:"feet","us-foot":"us-feet","clarke-foot":"clarke-feet","clarke-yard":"clarke-yards","clarke-link":"clarke-links","sears-yard":"sears-yards","sears-foot":"sears-feet","sears-chain":"sears-chains","benoit-1895-b-chain":"benoit-1895-b-chains","indian-yard":"indian-yards","indian-1937-yard":"indian-1937-yards","gold-coast-foot":"gold-coast-feet","sears-1922-truncated-chain":"sears-1922-truncated-chains","50-kilometers":"50-kilometers","150-kilometers":"150-kilometers"});let N0=UI=class extends Ue{constructor(t){super(t),this.heightModel="gravity-related-height",this.heightUnit="meters",this.vertCRS=null}writeHeightModel(t,e,i){return Xz.write(t,e,i)}readHeightModel(t,e,i){return Xz.read(t)||(i!=null&&i.messages&&i.messages.push(knt(t,{context:i})),null)}readHeightUnit(t,e,i){return y$.read(t)||(i!=null&&i.messages&&i.messages.push(Ype(t,{context:i})),null)}readHeightUnitService(t,e,i){return oEe(t)||y$.read(t)||(i!=null&&i.messages&&i.messages.push(Ype(t,{context:i})),null)}readVertCRS(t,e){return e.vertCRS||e.ellipsoid||e.geoid}clone(){return new UI({heightModel:this.heightModel,heightUnit:this.heightUnit,vertCRS:this.vertCRS})}equals(t){return!!t&&(this===t||this.heightModel===t.heightModel&&this.heightUnit===t.heightUnit&&this.vertCRS===t.vertCRS)}static deriveUnitFromSR(t,e){const i=aEe(e);return new UI({heightModel:t.heightModel,heightUnit:i,vertCRS:t.vertCRS})}write(t,e){return e={origin:"web-scene",...e},super.write(t,e)}static fromJSON(t){if(!t)return null;const e=new UI;return e.read(t,{origin:"web-scene"}),e}};function Ype(t,e){return new Hf("height-unit:unsupported",`Height unit of value '${t}' is not supported`,e)}function knt(t,e){return new Hf("height-model:unsupported",`Height model of value '${t}' is not supported`,e)}y([w({type:Xz.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:_Pe,default:"ellipsoidal"}}}})],N0.prototype,"heightModel",void 0),y([Et("web-scene","heightModel")],N0.prototype,"writeHeightModel",null),y([Rt(["web-scene","service"],"heightModel")],N0.prototype,"readHeightModel",null),y([w({type:y$.apiValues,constructOnly:!0,json:{origins:{"web-scene":{type:y$.jsonValues,write:y$.write}}}})],N0.prototype,"heightUnit",void 0),y([Rt("web-scene","heightUnit")],N0.prototype,"readHeightUnit",null),y([Rt("service","heightUnit")],N0.prototype,"readHeightUnitService",null),y([w({type:String,constructOnly:!0,json:{origins:{"web-scene":{write:!0}}}})],N0.prototype,"vertCRS",void 0),y([Rt("service","vertCRS",["vertCRS","ellipsoid","geoid"])],N0.prototype,"readVertCRS",null),N0=UI=y([Z("esri.geometry.HeightModelInfo")],N0);const B_=N0;async function znt(t,e,i,r,n,s){let o=null;if(i!=null){const _=`${t}/nodepages/`,x=_+Math.floor(i.rootIndex/i.nodesPerPage);try{return{type:"page",rootPage:(await yi(x,{query:{f:"json",token:r},responseType:"json",signal:s})).data,rootIndex:i.rootIndex,pageSize:i.nodesPerPage,lodMetric:i.lodSelectionMetricType,urlPrefix:_}}catch(S){n!=null&&n.warn("#fetchIndexInfo()","Failed to load root node page. Falling back to node documents.",x,S),o=S}}if(!e)return null;const a=e==null?void 0:e.split("/").pop(),c=`${t}/nodes/`,p=c+a;try{return{type:"node",rootNode:(await yi(p,{query:{f:"json",token:r},responseType:"json",signal:s})).data,urlPrefix:c}}catch(_){throw new se("sceneservice:root-node-missing","Root node missing.",{pageError:o,nodeError:_,url:p})}}let Unt=null;function Vnt(){return Unt}function Zz(t){if(Mr.apiKey&&kne(t.portal.url))throw new se("save-api-key-utils:api-key-not-supported",`Saving is not supported on ${t.portal.url} when using an api key`)}async function Bnt(t,e={},i){await t.load(i);const r=Pp(t.itemUrl,"resources"),{start:n=1,num:s=10,sortOrder:o="asc",sortField:a="created"}=e,c={query:{start:n,num:s,sortOrder:o,sortField:a,token:t.apiKey},signal:i==null?void 0:i.signal},p=await t.portal.request(r,c);return{total:p.total,nextStart:p.nextStart,resources:p.resources.map(({created:_,size:x,resource:S})=>({created:new Date(_),size:x,resource:t.resourceFromPath(S)}))}}async function jnt(t,e,i,r){if(!t.hasPath())throw new se(`portal-item-resource-${e}:invalid-path`,"Resource does not have a valid path");const n=t.portalItem;await n.load(r);const s=Pp(n.userItemUrl,e==="add"?"addResources":"updateResources"),[o,a]=bPe(t.path),c=new FormData;return o&&o!=="."&&c.append("resourcesPrefix",o),r!=null&&r.compress&&c.append("compress","true"),c.append("fileName",a),c.append("file",i,a),c.append("f","json"),r!=null&&r.access&&c.append("access",r.access),await n.portal.request(s,{method:"post",body:c,signal:r==null?void 0:r.signal}),t}async function Gnt(t,e,i){if(!e.hasPath())throw new se("portal-item-resources-remove:invalid-path","Resource does not have a valid path");await t.load(i);const r=Pp(t.userItemUrl,"removeResources");await t.portal.request(r,{method:"post",query:{resource:e.path},signal:i==null?void 0:i.signal}),e.portalItem=null}async function Hnt(t,e){await t.load(e);const i=Pp(t.userItemUrl,"removeResources");return t.portal.request(i,{method:"post",query:{deleteAll:!0},signal:e==null?void 0:e.signal})}function bPe(t){const e=t.lastIndexOf("/");return e===-1?[".",t]:[t.slice(0,e),t.slice(e+1)]}function Soe(t){const[e,i]=qnt(t),[r,n]=bPe(e);return[r,n,i]}function qnt(t){const e=Nne(t);return e==null?[t,""]:[t.slice(0,t.length-e.length-1),`.${e}`]}async function Toe(t){return t.type==="blob"?t.blob:t.type==="json"?new Blob([t.jsonString],{type:"application/json"}):(await yi(t.url,{responseType:"blob"})).data}function Wnt(t,e){if(!t.hasPath())return null;const[i,,r]=Soe(t.path);return t.portalItem.resourceFromPath(Pp(i,e+r))}function wPe(t,e){if(!t.hasPath())return null;const[i,,r]=Soe(t.path);return t.portalItem.resourceFromPath(Pp(i,e+r))}const VI=Object.freeze(Object.defineProperty({__proto__:null,addOrUpdateResource:jnt,contentToBlob:Toe,fetchResources:Bnt,getSiblingOfSameType:Wnt,getSiblingOfSameTypeI:wPe,removeAllResources:Hnt,removeResource:Gnt,splitPrefixFileNameAndExtension:Soe},Symbol.toStringTag,{value:"Module"}));async function xPe(t,e,i=null){const r=await TPe(t,e,i);await EPe(r,e,i)}async function SPe(t,e,i,r,n=null){const s=await TPe(i,r,n);await t.update({data:e}),await EPe(s,r,n)}async function TPe(t,e,i=null){if(!(e!=null&&e.resources))return;const r=e.portalItem===t.portalItem?new Set(t.paths):new Set;t.paths.length=0,t.portalItem=e.portalItem;const n=new Set(e.resources.toKeep.map(c=>c.resource.path)),s=new Set,o=[];n.forEach(c=>{r.delete(c),t.paths.push(c)});for(const c of e.resources.toUpdate)if(r.delete(c.resource.path),n.has(c.resource.path)||s.has(c.resource.path)){const{resource:p,content:_,finish:x,error:S}=c,C=wPe(p,Zf());t.paths.push(C.path),o.push(Xpe({resource:C,content:_,compress:c.compress,finish:x,error:S},i))}else t.paths.push(c.resource.path),o.push(Ynt(c,i)),s.add(c.resource.path);for(const c of e.resources.toAdd)t.paths.push(c.resource.path),r.has(c.resource.path)?r.delete(c.resource.path):o.push(Xpe(c,i));if(o.length===0)return r;const a=await aHe(o);if(St(i),a.length>0)throw new se("save:resources","Failed to save one or more resources",{errors:a});return r}async function EPe(t,e,i=null){if(!t||!e.portalItem)return;const r=[];for(const n of t){const s=e.portalItem.resourceFromPath(n);r.push(s.portalItem.removeResource(s,i))}await vy(r)}async function Xpe(t,e){var n,s;const i={...e??{},compress:t.compress},r=await ih(t.resource.portalItem.addResource(t.resource,await Toe(t.content),i));if(r.ok!==!0)throw(n=t.error)==null||n.call(t,r.error),r.error;(s=t.finish)==null||s.call(t,t.resource)}async function Ynt(t,e){var r,n;const i=await ih(t.resource.update(await Toe(t.content),e));if(i.ok!==!0)throw(r=t.error)==null||r.call(t,i.error),i.error;(n=t.finish)==null||n.call(t,t.resource)}async function Xnt(t){const e=[];for(const i of t.allLayers)if("beforeSave"in i&&typeof i.beforeSave=="function"){const r=i.beforeSave();r&&e.push(r)}await Promise.allSettled(e)}const CPe="esri.layers.mixins.SceneService",jH=Ce.getLogger(CPe),Znt=t=>{let e=class extends t{constructor(){super(...arguments),this.spatialReference=null,this.fullExtent=null,this.heightModelInfo=null,this.minScale=0,this.maxScale=0,this.version={major:Number.NaN,minor:Number.NaN,versionString:""},this.copyright=null,this.sublayerTitleMode="item-title",this.title=null,this.layerId=null,this.indexInfo=null,this._debouncedSaveOperations=n5(async(i,r,n)=>{switch(i){case pP.SAVE:return this._save(r);case pP.SAVE_AS:return this._saveAs(n,r)}})}readSpatialReference(i,r){return this._readSpatialReference(r)}_readSpatialReference(i){if(i.spatialReference!=null)return rt.fromJSON(i.spatialReference);{const r=i.store,n=r.indexCRS||r.geographicCRS,s=n&&parseInt(n.substring(n.lastIndexOf("/")+1,n.length),10);return s!=null?new rt(s):null}}readFullExtent(i,r,n){if(i!=null&&typeof i=="object"){const a=i.spatialReference==null?{...i,spatialReference:this._readSpatialReference(r)}:i;return Vi.fromJSON(a,n)}const s=r.store,o=this._readSpatialReference(r);return o==null||(s==null?void 0:s.extent)==null||!Array.isArray(s.extent)||s.extent.some(a=>a=2&&(r.major=parseInt(n[0],10),r.minor=parseInt(n[1],10)),r}readVersion(i,r){const n=r.store,s=n.version!=null?n.version.toString():"";return this.parseVersionString(s)}readTitlePortalItem(i){return this.sublayerTitleMode!=="item-title"?void 0:i}readTitleService(i,r){var o;const n=(o=this.portalItem)==null?void 0:o.title;if(this.sublayerTitleMode==="item-title")return Lrt(this.url,r.name);let s=r.name;if(!s&&this.url){const a=TE(this.url);a!=null&&(s=a.title)}return this.sublayerTitleMode==="item-title-and-service-name"&&n&&(s=n+" - "+s),foe(s)}set url(i){const r=Nrt({layer:this,url:i,nonStandardUrlAllowed:!1,logger:jH});this._set("url",r.url),r.layerId!=null&&this._set("layerId",r.layerId)}writeUrl(i,r,n,s){Frt(this,i,"layers",r,s)}get parsedUrl(){const i=this._get("url"),r=Is(i);return this.layerId!=null&&(r.path=`${r.path}/layers/${this.layerId}`),r}async _fetchIndexAndUpdateExtent(i,r){this.indexInfo=znt(this.parsedUrl.path,this.rootNode,i,this.apiKey,jH,r),this.fullExtent==null||this.fullExtent.hasZ||this._updateExtent(await this.indexInfo)}_updateExtent(i){var r,n,s,o;if((i==null?void 0:i.type)==="page"){const a=i.rootIndex%i.pageSize,c=(n=(r=i.rootPage)==null?void 0:r.nodes)==null?void 0:n[a];if(((s=c==null?void 0:c.obb)==null?void 0:s.center)==null||c.obb.halfSize==null)throw new se("sceneservice:invalid-node-page","Invalid node page.");if(c.obb.center[0]0)return r.data.layers[0].id}async _fetchServiceLayer(i){var o;const r=await yi(((o=this.parsedUrl)==null?void 0:o.path)??"",{query:{f:"json",token:this.apiKey},responseType:"json",signal:i});r.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));let n=!1;if(r.data.layerType&&r.data.layerType==="Voxel"&&(n=!0),n)return this._fetchVoxelServiceLayer();const s=r.data;this.read(s,this._getServiceContext()),this.validateLayer(s)}async _fetchVoxelServiceLayer(i){var n;const r=(await yi(((n=this.parsedUrl)==null?void 0:n.path)+"/layer",{query:{f:"json",token:this.apiKey},responseType:"json",signal:i})).data;this.read(r,this._getServiceContext()),this.validateLayer(r)}_getServiceContext(){var i;return{origin:"service",portalItem:this.portalItem,portal:(i=this.portalItem)==null?void 0:i.portal,url:this.parsedUrl}}async _ensureLoadBeforeSave(){await this.load(),"beforeSave"in this&&typeof this.beforeSave=="function"&&await this.beforeSave()}validateLayer(i){}_updateTypeKeywords(i,r,n){i.typeKeywords||(i.typeKeywords=[]);const s=r.getTypeKeywords();for(const o of s)i.typeKeywords.push(o);i.typeKeywords&&(i.typeKeywords=i.typeKeywords.filter((o,a,c)=>c.indexOf(o)===a),n===v$.newItem&&(i.typeKeywords=i.typeKeywords.filter(o=>o!=="Hosted Service")))}async _saveAs(i,r){var p;const n={...Zpe,...r};let s=Om.from(i);if(!s)throw new se("sceneservice:portal-item-required","_saveAs() requires a portal item to save to");Zz(s),s.id&&(s=s.clone(),s.id=null);const o=s.portal||os.getDefault();await this._ensureLoadBeforeSave(),s.type=HH,s.portal=o;const a={origin:"portal-item",url:null,messages:[],portal:o,portalItem:s,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},c={layers:[this.write({},a)]};return await Promise.all(a.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(c,a,n),s.url=this.url,s.title||(s.title=this.title),this._updateTypeKeywords(s,n,v$.newItem),await o.signIn(),await((p=o.user)==null?void 0:p.addItem({item:s,folder:n==null?void 0:n.folder,data:c})),await xPe(this.resourceReferences,a,null),this.portalItem=s,Yz(a),a.portalItem=s,s}async _save(i){const r={...Zpe,...i};if(!this.portalItem)throw new se("sceneservice:portal-item-not-set","Portal item to save to has not been set on this SceneService");if(Zz(this.portalItem),this.portalItem.type!==HH)throw new se("sceneservice:portal-item-wrong-type",`Portal item needs to have type "${HH}"`);await this._ensureLoadBeforeSave();const n={origin:"portal-item",url:this.portalItem.itemUrl&&Is(this.portalItem.itemUrl),messages:[],portal:this.portalItem.portal||os.getDefault(),portalItem:this.portalItem,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}},s={layers:[this.write({},n)]};return await Promise.all(n.resources.pendingOperations??[]),await this._validateAgainstJSONSchema(s,n,r),this.portalItem.url=this.url,this.portalItem.title||(this.portalItem.title=this.title),this._updateTypeKeywords(this.portalItem,r,v$.existingItem),await SPe(this.portalItem,s,this.resourceReferences,n,null),Yz(n),this.portalItem}async _validateAgainstJSONSchema(i,r,n){var p,_;let s=((p=r.messages)==null?void 0:p.filter(x=>x.type==="error").map(x=>new se(x.name,x.message,x.details)))??[];(_=n==null?void 0:n.validationOptions)!=null&&_.ignoreUnsupported&&(s=s.filter(x=>x.name!=="layer:unsupported"&&x.name!=="symbol:unsupported"&&x.name!=="symbol-layer:unsupported"&&x.name!=="property:unsupported"&&x.name!=="url:unsupported"&&x.name!=="scenemodification:unsupported"));const o=n==null?void 0:n.validationOptions,a=o==null?void 0:o.enabled,c=Vnt();if(a&&c){const x=(await c()).validate(i,n.portalItemLayerType);if(x.length>0){const S=`Layer item did not validate: ${x.join(` -`)}`;if(DH.error(`_validateAgainstJSONSchema(): ${T}`),o.failPolicy==="throw"){const A=x.map(M=>new se("sceneservice:schema-validation",M)).concat(s);throw new se("sceneservice-validate:error","Failed to save layer item due to schema validation, see `details.errors`.",{combined:A})}}}if(s.length>0)throw new se("sceneservice:save","Failed to save SceneService due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:s})}};return y([w(_ot)],e.prototype,"id",void 0),y([w({type:at})],e.prototype,"spatialReference",void 0),y([$t("spatialReference",["spatialReference","store.indexCRS","store.geographicCRS"])],e.prototype,"readSpatialReference",null),y([w({type:Vi})],e.prototype,"fullExtent",void 0),y([$t("fullExtent",["fullExtent","store.extent","spatialReference","store.indexCRS","store.geographicCRS"])],e.prototype,"readFullExtent",null),y([w({readOnly:!0,type:N_})],e.prototype,"heightModelInfo",void 0),y([w({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:{source:"minScale"},write:!1}}}})],e.prototype,"minScale",void 0),y([w({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:{source:"maxScale"},write:!1}}}})],e.prototype,"maxScale",void 0),y([w({readOnly:!0})],e.prototype,"version",void 0),y([$t("version",["store.version"])],e.prototype,"readVersion",null),y([w({type:String,json:{read:{source:"copyrightText"}}})],e.prototype,"copyright",void 0),y([w({type:String,json:{read:!1}})],e.prototype,"sublayerTitleMode",void 0),y([w({type:String})],e.prototype,"title",void 0),y([$t("portal-item","title")],e.prototype,"readTitlePortalItem",null),y([$t("service","title",["name"])],e.prototype,"readTitleService",null),y([w({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{write:{target:"id",isRequired:!0,ignoreOrigin:!0},read:!1}}}})],e.prototype,"layerId",void 0),y([w(soe)],e.prototype,"url",null),y([Pt("url")],e.prototype,"writeUrl",null),y([w()],e.prototype,"parsedUrl",null),y([w({readOnly:!0})],e.prototype,"store",void 0),y([w({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],e.prototype,"rootNode",void 0),e=y([Z(Q5e)],e),e},NH=-1e38;var l$;(function(t){t[t.existingItem=0]="existingItem",t[t.newItem=1]="newItem"})(l$||(l$={}));const FH="Scene Service",sfe={getTypeKeywords:()=>[],portalItemLayerType:"unknown",validationOptions:{enabled:!0,ignoreUnsupported:!1,failPolicy:"throw"}};var n5;(function(t){t[t.SAVE=0]="SAVE",t[t.SAVE_AS=1]="SAVE_AS"})(n5||(n5={}));async function uat(t,e){const i=vE(t);if(!i)throw new se("invalid-url","Invalid scene service url");const r={...e,sceneServerUrl:i.url.path,layerId:i.sublayer??void 0};if(r.sceneLayerItem??(r.sceneLayerItem=await hat(r)),r.sceneLayerItem==null)return ofe(r.sceneServerUrl.replace("/SceneServer","/FeatureServer"),r);const n=await pat(r);if(!(n!=null&&n.url))throw new se("related-service-not-found","Could not find feature service through portal item relationship");const s=await ofe(n.url,r);return s.portalItem=n,s}async function hat(t){const e=(await ePe(t)).serviceItemId;if(!e)return null;const i=new Am({id:e,apiKey:t.apiKey}),r=await dat(t);r!=null&&(i.portal=new os({url:r}));try{return i.load({signal:t.signal})}catch(n){return zo(n),null}}async function ePe(t){if(t.rootDocument)return t.rootDocument;const e={query:{f:"json",token:t.apiKey},responseType:"json",signal:t.signal};try{const i=await bi(t.sceneServerUrl,e);t.rootDocument=i.data}catch{t.rootDocument={}}return t.rootDocument}async function dat(t){const e=yr==null?void 0:yr.findServerInfo(t.sceneServerUrl);if(e!=null&&e.owningSystemUrl)return e.owningSystemUrl;const i=t.sceneServerUrl.replace(/(.*\/rest)\/.*/i,"$1")+"/info";try{const r=(await bi(i,{query:{f:"json"},responseType:"json",signal:t.signal})).data.owningSystemUrl;if(r)return r}catch(r){zo(r)}return null}async function ofe(t,e){const i=vE(t);if(!i)throw new se("invalid-feature-service-url","Invalid feature service url");const r=i.url.path,n=e.layerId;if(n==null)return{serverUrl:r};const s=ePe(e),o=T=>{const A={query:{f:"json"},responseType:"json",authMode:T,signal:e.signal};return bi(r,A)},l=o("anonymous").catch(()=>o("no-prompt")),[c,f]=await Promise.all([l,s]),_=f==null?void 0:f.layers,x=c.data&&c.data.layers;if(!Array.isArray(x))throw new Error("expected layers array");if(Array.isArray(_)){for(let T=0;Tn.type==="Feature Service")||null;if(!i)return null;const r=new Am({portal:i.portal,id:i.id});return await r.load(),r}catch(i){return zo(i),null}}const fat={analytics:{supportsCacheHint:!1},attachment:{supportsContentType:!1,supportsExifInfo:!1,supportsKeywords:!1,supportsName:!1,supportsSize:!1,supportsCacheHint:!1,supportsResize:!1},data:{isVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsAsyncApplyEdits:!1,zDefault:void 0},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},query:{maxRecordCount:0,maxRecordCountFactor:0,standardMaxRecordCount:0,supportsCacheHint:!1,supportsCentroid:!1,supportsCompactGeometry:!1,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsSqlExpression:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsStatistics:!1,tileMaxRecordCount:0}};var qK;let R4=qK=class extends Ue{constructor(t){super(t),this.name=null,this.code=null}clone(){return new qK({name:this.name,code:this.code})}};y([w({type:String,json:{write:!0}})],R4.prototype,"name",void 0),y([w({type:[String,Number],json:{write:!0}})],R4.prototype,"code",void 0),R4=qK=y([Z("esri.layers.support.CodedValue")],R4);const mat=new yn({inherited:"inherited",codedValue:"coded-value",range:"range"});let I4=class extends Ue{constructor(e){super(e),this.name=null,this.type=null}};y([w({type:String,json:{write:!0}})],I4.prototype,"name",void 0),y([Vt(mat)],I4.prototype,"type",void 0),I4=y([Z("esri.layers.support.Domain")],I4);const KB=I4;var WK;let $4=WK=class extends KB{constructor(t){super(t),this.codedValues=null,this.type="coded-value"}getName(t){let e=null;if(this.codedValues){const i=String(t);this.codedValues.some(r=>(String(r.code)===i&&(e=r.name),!!e))}return e}clone(){return new WK({codedValues:Re(this.codedValues),name:this.name})}};y([w({type:[R4],json:{write:!0}})],$4.prototype,"codedValues",void 0),y([Vt({codedValue:"coded-value"})],$4.prototype,"type",void 0),$4=WK=y([Z("esri.layers.support.CodedValueDomain")],$4);const tPe=$4;var YK;let rF=YK=class extends KB{constructor(t){super(t),this.type="inherited"}clone(){return new YK}};y([Vt({inherited:"inherited"})],rF.prototype,"type",void 0),rF=YK=y([Z("esri.layers.support.InheritedDomain")],rF);const iPe=rF;var XK;let xA=XK=class extends KB{constructor(t){super(t),this.maxValue=null,this.minValue=null,this.type="range"}clone(){return new XK({maxValue:this.maxValue,minValue:this.minValue,name:this.name})}};y([w({json:{type:[Number],read:{source:"range",reader:(t,e)=>{var i;return(i=e.range)==null?void 0:i[1]}},write:{enabled:!1,overridePolicy(){return{enabled:this.maxValue!=null&&this.minValue==null}},target:"range",writer(t,e,i){e[i]=[this.minValue||0,t]}}}})],xA.prototype,"maxValue",void 0),y([w({json:{type:[Number],read:{source:"range",reader:(t,e)=>{var i;return(i=e.range)==null?void 0:i[0]}},write:{target:"range",writer(t,e,i){e[i]=[t,this.maxValue||0]}}}})],xA.prototype,"minValue",void 0),y([Vt({range:"range"})],xA.prototype,"type",void 0),xA=XK=y([Z("esri.layers.support.RangeDomain")],xA);const rPe=xA,gat={key:"type",base:KB,typeMap:{range:rPe,"coded-value":tPe,inherited:iPe}};function yat(t){if(!(t!=null&&t.type))return null;switch(t.type){case"range":return rPe.fromJSON(t);case"codedValue":return tPe.fromJSON(t);case"inherited":return iPe.fromJSON(t)}return null}const foe=new yn({esriFieldTypeSmallInteger:"small-integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"single",esriFieldTypeDouble:"double",esriFieldTypeLong:"long",esriFieldTypeString:"string",esriFieldTypeDate:"date",esriFieldTypeOID:"oid",esriFieldTypeGeometry:"geometry",esriFieldTypeBlob:"blob",esriFieldTypeRaster:"raster",esriFieldTypeGUID:"guid",esriFieldTypeGlobalID:"global-id",esriFieldTypeXML:"xml",esriFieldTypeBigInteger:"big-integer",esriFieldTypeDateOnly:"date-only",esriFieldTypeTimeOnly:"time-only",esriFieldTypeTimestampOffset:"timestamp-offset"});var ZK;const vat=new yn({binary:"binary",coordinate:"coordinate",countOrAmount:"count-or-amount",dateAndTime:"date-and-time",description:"description",locationOrPlaceName:"location-or-place-name",measurement:"measurement",nameOrTitle:"name-or-title",none:"none",orderedOrRanked:"ordered-or-ranked",percentageOrRatio:"percentage-or-ratio",typeOrCategory:"type-or-category",uniqueIdentifier:"unique-identifier"});let Hc=ZK=class extends Ue{constructor(t){super(t),this.alias=null,this.defaultValue=void 0,this.description=null,this.domain=null,this.editable=!0,this.length=void 0,this.name=null,this.nullable=!0,this.type=null,this.valueType=null,this.visible=!0}readDescription(t,{description:e}){let i=null;try{i=e?JSON.parse(e):null}catch{}return(i==null?void 0:i.value)??null}readValueType(t,{description:e}){let i=null;try{i=e?JSON.parse(e):null}catch{}return i?vat.fromJSON(i.fieldValueType):null}clone(){return new ZK({alias:this.alias,defaultValue:this.defaultValue,description:this.description,domain:this.domain&&this.domain.clone()||null,editable:this.editable,length:this.length,name:this.name,nullable:this.nullable,type:this.type,valueType:this.valueType,visible:this.visible})}};y([w({type:String,json:{write:!0}})],Hc.prototype,"alias",void 0),y([w({type:[String,Number],json:{write:{allowNull:!0}}})],Hc.prototype,"defaultValue",void 0),y([w()],Hc.prototype,"description",void 0),y([$t("description")],Hc.prototype,"readDescription",null),y([w({types:gat,json:{read:{reader:yat},write:!0}})],Hc.prototype,"domain",void 0),y([w({type:Boolean,json:{write:!0}})],Hc.prototype,"editable",void 0),y([w({type:$n,json:{write:{overridePolicy:t=>({enabled:Number.isFinite(t)})}}})],Hc.prototype,"length",void 0),y([w({type:String,json:{write:!0}})],Hc.prototype,"name",void 0),y([w({type:Boolean,json:{write:!0}})],Hc.prototype,"nullable",void 0),y([Vt(foe)],Hc.prototype,"type",void 0),y([w()],Hc.prototype,"valueType",void 0),y([$t("valueType",["description"])],Hc.prototype,"readValueType",null),y([w({type:Boolean,json:{read:!1}})],Hc.prototype,"visible",void 0),Hc=ZK=y([Z("esri.layers.support.Field")],Hc);const moe=Hc;var JK;let SA=JK=class extends Ue{constructor(t){super(t),this.type="map-layer"}clone(){const{mapLayerId:t,gdbVersion:e}=this;return new JK({mapLayerId:t,gdbVersion:e})}};y([Vt({mapLayer:"map-layer"})],SA.prototype,"type",void 0),y([w({type:$n,json:{write:!0}})],SA.prototype,"mapLayerId",void 0),y([w({type:String,json:{write:!0}})],SA.prototype,"gdbVersion",void 0),SA=JK=y([Z("esri.layers.support.source.MapLayerSource")],SA);var KK;let Z1=KK=class extends Ue{constructor(t){super(t),this.type="query-table"}clone(){const{workspaceId:t,query:e,oidFields:i,spatialReference:r,geometryType:n}=this,s={workspaceId:t,query:e,oidFields:i,spatialReference:(r==null?void 0:r.clone())??void 0,geometryType:n};return new KK(s)}};y([Vt({queryTable:"query-table"})],Z1.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],Z1.prototype,"workspaceId",void 0),y([w({type:String,json:{write:!0}})],Z1.prototype,"query",void 0),y([w({type:String,json:{write:!0}})],Z1.prototype,"oidFields",void 0),y([w({type:at,json:{write:!0}})],Z1.prototype,"spatialReference",void 0),y([Vt(UAe)],Z1.prototype,"geometryType",void 0),Z1=KK=y([Z("esri.layers.support.source.QueryTableDataSource")],Z1);var QK;let TA=QK=class extends Ue{constructor(t){super(t),this.type="raster"}clone(){const{workspaceId:t,dataSourceName:e}=this;return new QK({workspaceId:t,dataSourceName:e})}};y([Vt({raster:"raster"})],TA.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],TA.prototype,"dataSourceName",void 0),y([w({type:String,json:{write:!0}})],TA.prototype,"workspaceId",void 0),TA=QK=y([Z("esri.layers.support.source.RasterDataSource")],TA);var eQ;let $3=eQ=class extends Ue{constructor(t){super(t),this.type="table"}clone(){const{workspaceId:t,gdbVersion:e,dataSourceName:i}=this;return new eQ({workspaceId:t,gdbVersion:e,dataSourceName:i})}};y([Vt({table:"table"})],$3.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],$3.prototype,"workspaceId",void 0),y([w({type:String,json:{write:!0}})],$3.prototype,"gdbVersion",void 0),y([w({type:String,json:{write:!0}})],$3.prototype,"dataSourceName",void 0),$3=eQ=y([Z("esri.layers.support.source.TableDataSource")],$3);var tQ,iQ;const _at=fu()({esriLeftInnerJoin:"left-inner-join",esriLeftOuterJoin:"left-outer-join"});let Pd=tQ=class extends Ue{constructor(t){super(t),this.type="join-table"}readLeftTableSource(t,e,i){return afe()(t,e,i)}castLeftTableSource(t){return zy(rQ(),t)}readRightTableSource(t,e,i){return afe()(t,e,i)}castRightTableSource(t){return zy(rQ(),t)}clone(){const{leftTableKey:t,rightTableKey:e,leftTableSource:i,rightTableSource:r,joinType:n}=this,s={leftTableKey:t,rightTableKey:e,leftTableSource:(i==null?void 0:i.clone())??void 0,rightTableSource:(r==null?void 0:r.clone())??void 0,joinType:n};return new tQ(s)}};y([Vt({joinTable:"join-table"})],Pd.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],Pd.prototype,"leftTableKey",void 0),y([w({type:String,json:{write:!0}})],Pd.prototype,"rightTableKey",void 0),y([w({json:{write:!0}})],Pd.prototype,"leftTableSource",void 0),y([$t("leftTableSource")],Pd.prototype,"readLeftTableSource",null),y([Ci("leftTableSource")],Pd.prototype,"castLeftTableSource",null),y([w({json:{write:!0}})],Pd.prototype,"rightTableSource",void 0),y([$t("rightTableSource")],Pd.prototype,"readRightTableSource",null),y([Ci("rightTableSource")],Pd.prototype,"castRightTableSource",null),y([Vt(_at)],Pd.prototype,"joinType",void 0),Pd=tQ=y([Z("esri.layers.support.source.JoinTableDataSource")],Pd);let kH=null;function afe(){return kH||(kH=Z5({types:rQ()})),kH}let zH=null;function rQ(){return zH||(zH={key:"type",base:null,typeMap:{"data-layer":ty,"map-layer":SA}}),zH}const bat={key:"type",base:null,typeMap:{"join-table":Pd,"query-table":Z1,raster:TA,table:$3}};let ty=iQ=class extends Ue{constructor(t){super(t),this.type="data-layer"}clone(){const{fields:t,dataSource:e}=this;return new iQ({fields:t,dataSource:e})}};y([Vt({dataLayer:"data-layer"})],ty.prototype,"type",void 0),y([w({type:[moe],json:{write:!0}})],ty.prototype,"fields",void 0),y([w({types:bat,json:{write:!0}})],ty.prototype,"dataSource",void 0),ty=iQ=y([Z("esri.layers.support.source.DataLayerSource")],ty),ty.from=$s(ty);let L3=class extends Xs(Ue){constructor(e){super(e),this.onFields=null,this.operator=null,this.searchTerm=null,this.searchType=null}};y([w({type:[String],json:{write:{enabled:!0,overridePolicy(){return{enabled:this.onFields!=null&&this.onFields.length>0}}}}})],L3.prototype,"onFields",void 0),y([w({type:String,json:{write:!0}})],L3.prototype,"operator",void 0),y([w({type:String,json:{write:!0}})],L3.prototype,"searchTerm",void 0),y([w({type:String,json:{write:!0}})],L3.prototype,"searchType",void 0),L3=y([Z("esri.rest.support.FullTextSearch")],L3);const nPe=L3;var nQ;const lfe=new yn({upperLeft:"upper-left",lowerLeft:"lower-left"});let D3=nQ=class extends Ue{constructor(t){super(t),this.extent=null,this.mode="view",this.originPosition="upper-left",this.tolerance=1}clone(){return new nQ(Re({extent:this.extent,mode:this.mode,originPosition:this.originPosition,tolerance:this.tolerance}))}};y([w({type:Vi,json:{write:{overridePolicy(){return{enabled:this.mode==="view"}}}}})],D3.prototype,"extent",void 0),y([w({type:["view","edit"],json:{write:!0}})],D3.prototype,"mode",void 0),y([w({type:String,json:{read:lfe.read,write:lfe.write}})],D3.prototype,"originPosition",void 0),y([w({type:Number,json:{write:{overridePolicy(){return{enabled:this.mode==="view"}}}}})],D3.prototype,"tolerance",void 0),D3=nQ=y([Z("esri.rest.support.QuantizationParameters")],D3);const wat=D3;var sQ;const cfe=new yn({count:"count",sum:"sum",min:"min",max:"max",avg:"avg",stddev:"stddev",var:"var",exceedslimit:"exceedslimit",percentile_cont:"percentile-continuous",percentile_disc:"percentile-discrete",EnvelopeAggregate:"envelope-aggregate",CentroidAggregate:"centroid-aggregate",ConvexHullAggregate:"convex-hull-aggregate"});let L0=sQ=class extends Ue{constructor(t){super(t),this.maxPointCount=void 0,this.maxRecordCount=void 0,this.maxVertexCount=void 0,this.onStatisticField=null,this.outStatisticFieldName=null,this.statisticType=null,this.statisticParameters=null}writeStatisticParameters(t,e){this.statisticType!=="percentile-continuous"&&this.statisticType!=="percentile-discrete"||(e.statisticParameters=Re(t))}clone(){return new sQ({maxPointCount:this.maxPointCount,maxRecordCount:this.maxRecordCount,maxVertexCount:this.maxVertexCount,onStatisticField:this.onStatisticField,outStatisticFieldName:this.outStatisticFieldName,statisticType:this.statisticType,statisticParameters:Re(this.statisticParameters)})}};y([w({type:Number,json:{write:!0}})],L0.prototype,"maxPointCount",void 0),y([w({type:Number,json:{write:!0}})],L0.prototype,"maxRecordCount",void 0),y([w({type:Number,json:{write:!0}})],L0.prototype,"maxVertexCount",void 0),y([w({type:String,json:{write:!0}})],L0.prototype,"onStatisticField",void 0),y([w({type:String,json:{write:!0}})],L0.prototype,"outStatisticFieldName",void 0),y([w({type:String,json:{read:{source:"statisticType",reader:cfe.read},write:{target:"statisticType",writer:cfe.write}}})],L0.prototype,"statisticType",void 0),y([w({type:Object})],L0.prototype,"statisticParameters",void 0),y([Pt("statisticParameters")],L0.prototype,"writeStatisticParameters",null),L0=sQ=y([Z("esri.rest.support.StatisticDefinition")],L0);const xat=L0;var nF;const Sat=new yn({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),Tat=new yn({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let Si=nF=class extends Ue{static from(t){return MT(nF,t)}constructor(t){super(t),this.aggregateIds=null,this.cacheHint=void 0,this.compactGeometryEnabled=!1,this.datumTransformation=null,this.defaultSpatialReferenceEnabled=!1,this.distance=void 0,this.dynamicDataSource=void 0,this.formatOf3DObjects=null,this.fullText=null,this.gdbVersion=null,this.geometry=null,this.geometryPrecision=void 0,this.groupByFieldsForStatistics=null,this.having=null,this.historicMoment=null,this.maxAllowableOffset=void 0,this.maxRecordCountFactor=1,this.multipatchOption=null,this.num=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.outStatistics=null,this.parameterValues=null,this.pixelSize=null,this.quantizationParameters=null,this.rangeValues=null,this.relationParameter=null,this.resultType=null,this.returnCentroid=!1,this.returnDistinctValues=!1,this.returnExceededLimitFeatures=!0,this.returnGeometry=!1,this.returnQueryGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.sourceSpatialReference=null,this.spatialRelationship="intersects",this.start=void 0,this.sqlFormat=null,this.text=null,this.timeExtent=null,this.timeReferenceUnknownClient=!1,this.units=null,this.where=null}castDatumTransformation(t){return typeof t=="number"||typeof t=="object"?t:null}writeHistoricMoment(t,e){e.historicMoment=t&&t.getTime()}writeParameterValues(t,e){if(t){const i={};for(const r in t){const n=t[r];Array.isArray(n)?i[r]=n.map(s=>s instanceof Date?s.getTime():s):n instanceof Date?i[r]=n.getTime():i[r]=n}e.parameterValues=i}}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10,e.where="1=1"}writeWhere(t,e){e.where=t||"1=1"}clone(){return new nF(Re({aggregateIds:this.aggregateIds,cacheHint:this.cacheHint,compactGeometryEnabled:this.compactGeometryEnabled,datumTransformation:this.datumTransformation,defaultSpatialReferenceEnabled:this.defaultSpatialReferenceEnabled,distance:this.distance,fullText:this.fullText,formatOf3DObjects:this.formatOf3DObjects,gdbVersion:this.gdbVersion,geometry:this.geometry,geometryPrecision:this.geometryPrecision,groupByFieldsForStatistics:this.groupByFieldsForStatistics,having:this.having,historicMoment:this.historicMoment!=null?new Date(this.historicMoment.getTime()):null,maxAllowableOffset:this.maxAllowableOffset,maxRecordCountFactor:this.maxRecordCountFactor,multipatchOption:this.multipatchOption,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,outStatistics:this.outStatistics,parameterValues:this.parameterValues,pixelSize:this.pixelSize,quantizationParameters:this.quantizationParameters,rangeValues:this.rangeValues,relationParameter:this.relationParameter,resultType:this.resultType,returnDistinctValues:this.returnDistinctValues,returnGeometry:this.returnGeometry,returnCentroid:this.returnCentroid,returnExceededLimitFeatures:this.returnExceededLimitFeatures,returnQueryGeometry:this.returnQueryGeometry,returnM:this.returnM,returnZ:this.returnZ,dynamicDataSource:this.dynamicDataSource,sourceSpatialReference:this.sourceSpatialReference,spatialRelationship:this.spatialRelationship,start:this.start,sqlFormat:this.sqlFormat,text:this.text,timeExtent:this.timeExtent,timeReferenceUnknownClient:this.timeReferenceUnknownClient,units:this.units,where:this.where}))}};Si.MAX_MAX_RECORD_COUNT_FACTOR=5,y([w({json:{write:!0}})],Si.prototype,"aggregateIds",void 0),y([w({type:Boolean,json:{write:!0}})],Si.prototype,"cacheHint",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"compactGeometryEnabled",void 0),y([w({json:{write:!0}})],Si.prototype,"datumTransformation",void 0),y([Ci("datumTransformation")],Si.prototype,"castDatumTransformation",null),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"defaultSpatialReferenceEnabled",void 0),y([w({type:Number,json:{write:{overridePolicy:t=>({enabled:t>0})}}})],Si.prototype,"distance",void 0),y([w({type:ty,json:{write:!0}})],Si.prototype,"dynamicDataSource",void 0),y([w({type:String,json:{write:!0}})],Si.prototype,"formatOf3DObjects",void 0),y([w({type:[nPe],json:{write:{enabled:!0,overridePolicy(){return{enabled:this.fullText!=null&&this.fullText.length>0}}}}})],Si.prototype,"fullText",void 0),y([w({type:String,json:{write:!0}})],Si.prototype,"gdbVersion",void 0),y([w({types:I9,json:{read:O2,write:!0}})],Si.prototype,"geometry",void 0),y([w({type:Number,json:{write:!0}})],Si.prototype,"geometryPrecision",void 0),y([w({type:[String],json:{write:!0}})],Si.prototype,"groupByFieldsForStatistics",void 0),y([w({type:String,json:{write:!0}})],Si.prototype,"having",void 0),y([w({type:Date})],Si.prototype,"historicMoment",void 0),y([Pt("historicMoment")],Si.prototype,"writeHistoricMoment",null),y([w({type:Number,json:{write:!0}})],Si.prototype,"maxAllowableOffset",void 0),y([w({type:Number,cast:t=>t<1?1:t>Si.MAX_MAX_RECORD_COUNT_FACTOR?Si.MAX_MAX_RECORD_COUNT_FACTOR:t,json:{write:{overridePolicy:t=>({enabled:t>1})}}})],Si.prototype,"maxRecordCountFactor",void 0),y([w({type:["xyFootprint"],json:{write:!0}})],Si.prototype,"multipatchOption",void 0),y([w({type:Number,json:{read:{source:"resultRecordCount"}}})],Si.prototype,"num",void 0),y([w({json:{write:!0}})],Si.prototype,"objectIds",void 0),y([w({type:[String],json:{write:!0}})],Si.prototype,"orderByFields",void 0),y([w({type:[String],json:{write:!0}})],Si.prototype,"outFields",void 0),y([w({type:at,json:{name:"outSR",write:!0}})],Si.prototype,"outSpatialReference",void 0),y([w({type:[xat],json:{write:{enabled:!0,overridePolicy(){return{enabled:this.outStatistics!=null&&this.outStatistics.length>0}}}}})],Si.prototype,"outStatistics",void 0),y([w({json:{write:!0}})],Si.prototype,"parameterValues",void 0),y([Pt("parameterValues")],Si.prototype,"writeParameterValues",null),y([w({type:mt,json:{write:!0}})],Si.prototype,"pixelSize",void 0),y([w({type:wat,json:{write:!0}})],Si.prototype,"quantizationParameters",void 0),y([w({type:[Object],json:{write:!0}})],Si.prototype,"rangeValues",void 0),y([w({type:String,json:{read:{source:"relationParam"},write:{target:"relationParam",overridePolicy(){return{enabled:this.spatialRelationship==="relation"}}}}})],Si.prototype,"relationParameter",void 0),y([w({type:String,json:{write:!0}})],Si.prototype,"resultType",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"returnCentroid",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"returnDistinctValues",void 0),y([w({type:Boolean,json:{default:!0,write:!0}})],Si.prototype,"returnExceededLimitFeatures",void 0),y([w({type:Boolean,json:{write:!0}})],Si.prototype,"returnGeometry",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"returnQueryGeometry",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"returnM",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Si.prototype,"returnZ",void 0),y([w({type:at,json:{write:!0}})],Si.prototype,"sourceSpatialReference",void 0),y([Vt(Sat,{ignoreUnknown:!1,name:"spatialRel"})],Si.prototype,"spatialRelationship",void 0),y([w({type:Number,json:{read:{source:"resultOffset"}}})],Si.prototype,"start",void 0),y([Pt("start"),Pt("num")],Si.prototype,"writeStart",null),y([w({type:String,json:{write:!0}})],Si.prototype,"sqlFormat",void 0),y([w({type:String,json:{write:!0}})],Si.prototype,"text",void 0),y([w({type:D_,json:{write:!0}})],Si.prototype,"timeExtent",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"timeReferenceUnknownClient",void 0),y([Vt(Tat,{ignoreUnknown:!1}),w({json:{write:{overridePolicy(t){return{enabled:!!t&&this.distance!=null&&this.distance>0}}}}})],Si.prototype,"units",void 0),y([w({type:String,json:{write:{overridePolicy(t){return{enabled:t!=null||this.start!=null&&this.start>0}}}}})],Si.prototype,"where",void 0),y([Pt("where")],Si.prototype,"writeWhere",null),Si=nF=y([Z("esri.rest.support.Query")],Si);const F_=Si;async function Eat(t,e,i){e=e.clone(),t.capabilities.query.supportsMaxRecordCountFactor&&(e.maxRecordCountFactor=sPe(t));const r=Cat(t),n=t.capabilities.query.supportsPagination;e.start=0,e.num=r;let s=null;for(;;){const o=await t.source.queryFeaturesJSON(e,i);if(s==null?s=o:s.features=s.features.concat(o.features),s.exceededTransferLimit=o.exceededTransferLimit,!n||!o.exceededTransferLimit)break;e.start+=r}return s}function Cat(t){return sPe(t)*Aat(t)}function Aat(t){return t.capabilities.query.maxRecordCount||2e3}function sPe(t){return t.capabilities.query.supportsMaxRecordCountFactor?F_.MAX_MAX_RECORD_COUNT_FACTOR:1}var oQ;let Dl=oQ=class extends Ue{constructor(t){super(t),this.attachmentTypes=null,this.attachmentsWhere=null,this.cacheHint=void 0,this.keywords=null,this.globalIds=null,this.name=null,this.num=null,this.objectIds=null,this.returnMetadata=!1,this.size=null,this.start=null,this.where=null}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10}clone(){return new oQ(Re({attachmentTypes:this.attachmentTypes,attachmentsWhere:this.attachmentsWhere,cacheHint:this.cacheHint,keywords:this.keywords,where:this.where,globalIds:this.globalIds,name:this.name,num:this.num,objectIds:this.objectIds,returnMetadata:this.returnMetadata,size:this.size,start:this.start}))}};y([w({type:[String],json:{write:!0}})],Dl.prototype,"attachmentTypes",void 0),y([w({type:String,json:{read:{source:"attachmentsDefinitionExpression"},write:{target:"attachmentsDefinitionExpression"}}})],Dl.prototype,"attachmentsWhere",void 0),y([w({type:Boolean,json:{write:!0}})],Dl.prototype,"cacheHint",void 0),y([w({type:[String],json:{write:!0}})],Dl.prototype,"keywords",void 0),y([w({type:[Number],json:{write:!0}})],Dl.prototype,"globalIds",void 0),y([w({json:{write:!0}})],Dl.prototype,"name",void 0),y([w({type:Number,json:{read:{source:"resultRecordCount"}}})],Dl.prototype,"num",void 0),y([w({type:[Number],json:{write:!0}})],Dl.prototype,"objectIds",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Dl.prototype,"returnMetadata",void 0),y([w({type:[Number],json:{write:!0}})],Dl.prototype,"size",void 0),y([w({type:Number,json:{read:{source:"resultOffset"}}})],Dl.prototype,"start",void 0),y([Pt("start"),Pt("num")],Dl.prototype,"writeStart",null),y([w({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],Dl.prototype,"where",void 0),Dl=oQ=y([Z("esri.rest.support.AttachmentQuery")],Dl),Dl.from=$s(Dl);const Mat=Dl;var aQ;let Ro=aQ=class extends Ue{constructor(t){super(t),this.cacheHint=void 0,this.dynamicDataSource=void 0,this.gdbVersion=null,this.geometryPrecision=void 0,this.historicMoment=null,this.maxAllowableOffset=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.relationshipId=void 0,this.start=void 0,this.num=void 0,this.returnGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.where=null}_writeHistoricMoment(t,e){e.historicMoment=t&&t.getTime()}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10,this.start>0&&this.where==null&&(e.definitionExpression="1=1")}clone(){return new aQ(Re({cacheHint:this.cacheHint,dynamicDataSource:this.dynamicDataSource,gdbVersion:this.gdbVersion,geometryPrecision:this.geometryPrecision,historicMoment:this.historicMoment&&new Date(this.historicMoment.getTime()),maxAllowableOffset:this.maxAllowableOffset,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,relationshipId:this.relationshipId,start:this.start,num:this.num,returnGeometry:this.returnGeometry,where:this.where,returnZ:this.returnZ,returnM:this.returnM}))}};y([w({type:Boolean,json:{write:!0}})],Ro.prototype,"cacheHint",void 0),y([w({type:ty,json:{write:!0}})],Ro.prototype,"dynamicDataSource",void 0),y([w({type:String,json:{write:!0}})],Ro.prototype,"gdbVersion",void 0),y([w({type:Number,json:{write:!0}})],Ro.prototype,"geometryPrecision",void 0),y([w({type:Date})],Ro.prototype,"historicMoment",void 0),y([Pt("historicMoment")],Ro.prototype,"_writeHistoricMoment",null),y([w({type:Number,json:{write:!0}})],Ro.prototype,"maxAllowableOffset",void 0),y([w({type:[Number],json:{write:!0}})],Ro.prototype,"objectIds",void 0),y([w({type:[String],json:{write:!0}})],Ro.prototype,"orderByFields",void 0),y([w({type:[String],json:{write:!0}})],Ro.prototype,"outFields",void 0),y([w({type:at,json:{read:{source:"outSR"},write:{target:"outSR"}}})],Ro.prototype,"outSpatialReference",void 0),y([w({json:{write:!0}})],Ro.prototype,"relationshipId",void 0),y([w({type:Number,json:{read:{source:"resultOffset"}}})],Ro.prototype,"start",void 0),y([Pt("start"),Pt("num")],Ro.prototype,"writeStart",null),y([w({type:Number,json:{read:{source:"resultRecordCount"}}})],Ro.prototype,"num",void 0),y([w({json:{write:!0}})],Ro.prototype,"returnGeometry",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Ro.prototype,"returnM",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Ro.prototype,"returnZ",void 0),y([w({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],Ro.prototype,"where",void 0),Ro=aQ=y([Z("esri.rest.support.RelationshipQuery")],Ro),Ro.from=$s(Ro);const goe=Ro,nKt=Object.freeze(Object.defineProperty({__proto__:null,default:goe},Symbol.toStringTag,{value:"Module"})),sKt=new yn({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function oKt(t,e,i,r){const n=await ax(t);if(await yoe(t,e,r),!n.addAttachment)throw new se(r,"Layer source does not support addAttachment capability");return n.addAttachment(e,i)}function yoe(t,e,i){var s,o;const{attributes:r}=e,{objectIdField:n}=t;return(o=(s=t.capabilities)==null?void 0:s.data)!=null&&o.supportsAttachment?e?r?n&&r[n]?Promise.resolve():Promise.reject(new se(i,`feature is missing the identifying attribute ${n}`)):Promise.reject(new se(i,"'attributes' are required on a feature to query attachments")):Promise.reject(new se(i,"A feature is required to add/delete/update attachments")):Promise.reject(new se(i,"this layer doesn't support attachments"))}async function aKt(t,e,i,r,n){const s=await ax(t);if(await yoe(t,e,n),!s.updateAttachment)throw new se(n,"Layer source does not support updateAttachment capability");return s.updateAttachment(e,i,r)}async function lKt(t,e,i){const{applyEdits:r}=await we(()=>import("./editingSupport-EiPa9PKq.js"),__vite__mapDeps([])),n=await t.load(),{source:s,globalIdField:o}=n;let l=i;return n.type==="feature"&&n.infoFor3D&&e.deleteFeatures!=null&&o!=null&&(l={...l,globalIdToObjectId:await oPe(t,e.deleteFeatures,o)}),r(n,s,e,i)}async function cKt(t,e,i){const{uploadAssets:r}=await we(()=>import("./editingSupport-EiPa9PKq.js"),__vite__mapDeps([])),n=await t.load();return r(n,n.source,e,i)}async function uKt(t,e,i,r){const n=await ax(t);if(await yoe(t,e,r),!n.deleteAttachments)throw new se(r,"Layer source does not support deleteAttachments capability");return n.deleteAttachments(e,i)}async function hKt(t,e,i){const r=(await t.load({signal:e==null?void 0:e.signal})).source;if(!r.fetchRecomputedExtents)throw new se(i,"Layer source does not support fetchUpdates capability");return r.fetchRecomputedExtents(e)}async function dKt(t,e,i,r){var A,M;e=Mat.from(e),await t.load();const n=t.source,s=t.capabilities;if(!((A=s==null?void 0:s.data)!=null&&A.supportsAttachment))throw new se(r,"this layer doesn't support attachments");const{attachmentTypes:o,objectIds:l,globalIds:c,num:f,size:_,start:x,where:T}=e;if(!((M=s==null?void 0:s.operations)!=null&&M.supportsQueryAttachments)&&((o==null?void 0:o.length)>0||(c==null?void 0:c.length)>0||(_==null?void 0:_.length)>0||f||x||T))throw new se(r,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",e);if(!(l!=null&&l.length||c!=null&&c.length||T))throw new se(r,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",e);if(!n.queryAttachments)throw new se(r,"Layer source does not support queryAttachments capability",e);return n.queryAttachments(e)}async function pKt(t,e,i,r){const n=await ax(t);if(!n.queryObjectIds)throw new se(r,"Layer source does not support queryObjectIds capability");return n.queryObjectIds(F_.from(e)??t.createQuery(),i)}async function fKt(t,e,i,r){const n=await ax(t);if(!n.queryFeatureCount)throw new se(r,"Layer source does not support queryFeatureCount capability");return n.queryFeatureCount(F_.from(e)??t.createQuery(),i)}async function mKt(t,e,i,r){const n=await ax(t);if(!n.queryExtent)throw new se(r,"Layer source does not support queryExtent capability");return n.queryExtent(F_.from(e)??t.createQuery(),i)}async function gKt(t,e,i,r){const n=await ax(t);if(!n.queryRelatedFeatures)throw new se(r,"Layer source does not support queryRelatedFeatures capability");return n.queryRelatedFeatures(goe.from(e),i)}async function yKt(t,e,i,r){const n=await ax(t);if(!n.queryRelatedFeaturesCount)throw new se(r,"Layer source does not support queryRelatedFeaturesCount capability");return n.queryRelatedFeaturesCount(goe.from(e),i)}async function vKt(t){const e=t.source;if(e!=null&&e.refresh)try{const{dataChanged:i,updates:r}=await e.refresh();if(r!=null&&(t.sourceJSON={...t.sourceJSON,...r},t.read(r,{origin:"service",url:t.parsedUrl})),i)return!0}catch{}if(t.definitionExpression)try{return(await Tse(t.definitionExpression,t.fieldsIndex)).hasDateFunctions}catch{}return!1}function _Kt(t){var o,l;const e=new F_,i=(o=t.capabilities)==null?void 0:o.data,r=(l=t.capabilities)==null?void 0:l.query;e.historicMoment=t.historicMoment,e.gdbVersion=t.gdbVersion,e.returnGeometry=!0,r&&(e.compactGeometryEnabled=r.supportsCompactGeometry,e.defaultSpatialReferenceEnabled=r.supportsDefaultSpatialReference),i&&(i.supportsZ&&t.returnZ!=null&&(e.returnZ=t.returnZ),i.supportsM&&t.returnM!=null&&(e.returnM=t.returnM)),e.outFields=["*"];const{timeOffset:n,timeExtent:s}=t;return e.timeExtent=n!=null&&s!=null?s.offset(-n.value,n.unit):s||null,e.multipatchOption=t.geometryType==="multipatch"?"xyFootprint":null,e}function bKt(t){const{globalIdField:e,fields:i}=t;if(e)return e;if(i){for(const r of i)if(r.type==="esriFieldTypeGlobalID")return r.name}}function wKt(t){const{objectIdField:e,fields:i}=t;if(e)return e;if(i){for(const r of i)if(r.type==="esriFieldTypeOID")return r.name}}function xKt(t){return t.currentVersion?t.currentVersion:t.hasOwnProperty("capabilities")||t.hasOwnProperty("drawingInfo")||t.hasOwnProperty("hasAttachments")||t.hasOwnProperty("htmlPopupType")||t.hasOwnProperty("relationships")||t.hasOwnProperty("timeInfo")||t.hasOwnProperty("typeIdField")||t.hasOwnProperty("types")?10:9.3}async function ax(t){return(await t.load()).source}async function Oat(t,e){if(!yr||yr.findCredential(t))return;let i;try{const r=await UOe(t,e);r&&(i=await yr.checkSignInStatus(`${r}/sharing`))}catch{}if(i)try{const r=e!=null?e.signal:null;await yr.getCredential(t,{signal:r})}catch{}}async function SKt(t,e,i){var n;const r=(n=t.parsedUrl)==null?void 0:n.path;r&&t.authenticationTriggerEvent===e&&await Oat(r,i)}function Pat(t){var e;return!((e=t.sourceJSON)!=null&&e.isMultiServicesView)&&(t.userHasUpdateItemPrivileges||t.editingEnabled)}const UH=Z5({types:wOe});function TKt(t,e){var i;if(t.defaultSymbol)return(i=t.types)!=null&&i.length?new ioe({defaultSymbol:UH(t.defaultSymbol,t,e),field:t.typeIdField,uniqueValueInfos:t.types.map(r=>({id:r.id,symbol:UH(r.symbol,r,e)}))}):new Qse({symbol:UH(t.defaultSymbol,t,e)})}function EKt(t){var r,n,s;let e=(r=t.sourceJSON)==null?void 0:r.cacheMaxAge;if(!e)return!1;const i=(s=(n=t.editingInfo)==null?void 0:n.lastEditDate)==null?void 0:s.getTime();return i==null||(e*=1e3,Date.now()-i{let _=null;if("attributes"in f){const{attributes:x}=f;_={globalId:x[i],objectId:x[n]!=null&&x[n]!==-1?x[n]:null}}else _={globalId:f.globalId,objectId:f.objectId!=null&&f.objectId!==-1?f.objectId:null};_.globalId!=null&&(_.objectId!=null&&_.objectId!==-1||r.push(_.globalId))}),r.length===0)return null;const s=t.createQuery();s.where=r.map(f=>`${i}='${f}'`).join(" OR "),s.returnGeometry=!1,s.outFields=[n,i],s.cacheHint=!1;const o=await MHe(Eat(t,s));if(!o.ok)return null;const l=new Map,c=o.value.features;for(const f of c){const _=f.attributes[i],x=f.attributes[n];_!=null&&x!=null&&x!==-1&&l.set(_,x)}return l}let c$=class extends Ue{constructor(){super(...arguments),this.type=null}};y([w({type:["selection","cluster","binning"],readOnly:!0,json:{read:!1,write:!0}})],c$.prototype,"type",void 0),c$=y([Z("esri.layers.support.FeatureReduction")],c$);var lQ;let sF=lQ=class extends c${constructor(t){super(t),this.type="selection"}clone(){return new lQ}};y([w({type:["selection"]})],sF.prototype,"type",void 0),sF=lQ=y([Z("esri.layers.support.FeatureReductionSelection")],sF);const Rat=sF;function Iat(){return{fields:{type:[moe],value:null,set:function(t){if(t&&Le("big-integer-warning-enabled")){const e=t.filter(i=>i.type==="big-integer"||i.type==="oid"&&(i.length||0)>=8);if(e.length){const i=e.map(r=>`'${r.name}'`).join(", ");Ce.getLogger(this).warn("#fields",`Layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}') references big-integer field(s): ${i}, support for which is experimental. Only integers less than ${Number.MAX_SAFE_INTEGER} (Number.MAX_SAFE_INTEGER) are supported.`)}}this._set("fields",t)}},fieldsIndex:{readOnly:!0,get(){return Zse.fromLayer(this)}},outFields:{type:[String],json:{read:!1},set:function(t){this._userOutFields=t,this.notifyChange("outFields")},get:function(){var e;const t=this._userOutFields;if(!(t!=null&&t.length))return null;if(t.includes("*"))return["*"];if(!this.fields)return t;for(const i of t)((e=this.fieldsIndex)==null?void 0:e.has(i))||Ce.getLogger("esri.layers.support.fieldProperties").error("field-attributes-layer:invalid-field",`Invalid field ${i} found in outFields`,{layer:this,outFields:t});return RB(this.fieldsIndex,t)}}}}let AS=class extends Ue{constructor(){super(...arguments),this.nodesPerPage=null,this.rootIndex=0,this.lodSelectionMetricType=null}};y([w({type:Number})],AS.prototype,"nodesPerPage",void 0),y([w({type:Number})],AS.prototype,"rootIndex",void 0),y([w({type:String})],AS.prototype,"lodSelectionMetricType",void 0),AS=y([Z("esri.layer.support.I3SNodePageDefinition")],AS);let jv=class extends Ue{constructor(){super(...arguments),this.factor=1}};y([w({type:Number,json:{read:{source:"textureSetDefinitionId"}}})],jv.prototype,"id",void 0),y([w({type:Number})],jv.prototype,"factor",void 0),jv=y([Z("esri.layer.support.I3SMaterialTexture")],jv);let Kb=class extends Ue{constructor(){super(...arguments),this.baseColorFactor=[1,1,1,1],this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.metallicFactor=1,this.roughnessFactor=1}};y([w({type:[Number]})],Kb.prototype,"baseColorFactor",void 0),y([w({type:jv})],Kb.prototype,"baseColorTexture",void 0),y([w({type:jv})],Kb.prototype,"metallicRoughnessTexture",void 0),y([w({type:Number})],Kb.prototype,"metallicFactor",void 0),y([w({type:Number})],Kb.prototype,"roughnessFactor",void 0),Kb=y([Z("esri.layer.support.I3SMaterialPBRMetallicRoughness")],Kb);let Hp=class extends Ue{constructor(){super(...arguments),this.alphaMode="opaque",this.alphaCutoff=.25,this.doubleSided=!1,this.cullFace="none",this.normalTexture=null,this.occlusionTexture=null,this.emissiveTexture=null,this.emissiveFactor=null,this.pbrMetallicRoughness=null}};y([Vt({opaque:"opaque",mask:"mask",blend:"blend"})],Hp.prototype,"alphaMode",void 0),y([w({type:Number})],Hp.prototype,"alphaCutoff",void 0),y([w({type:Boolean})],Hp.prototype,"doubleSided",void 0),y([Vt({none:"none",back:"back",front:"front"})],Hp.prototype,"cullFace",void 0),y([w({type:jv})],Hp.prototype,"normalTexture",void 0),y([w({type:jv})],Hp.prototype,"occlusionTexture",void 0),y([w({type:jv})],Hp.prototype,"emissiveTexture",void 0),y([w({type:[Number]})],Hp.prototype,"emissiveFactor",void 0),y([w({type:Kb})],Hp.prototype,"pbrMetallicRoughness",void 0),Hp=y([Z("esri.layer.support.I3SMaterialDefinition")],Hp);let L4=class extends Ue{};y([w({type:String,json:{read:{source:["name","index"],reader:(t,e)=>t??`${e.index}`}}})],L4.prototype,"name",void 0),y([Vt({jpg:"jpg",png:"png",dds:"dds","ktx-etc2":"ktx-etc2",ktx2:"ktx2",basis:"basis"})],L4.prototype,"format",void 0),L4=y([Z("esri.layer.support.I3STextureFormat")],L4);let D4=class extends Ue{constructor(){super(...arguments),this.atlas=!1}};y([w({type:[L4]})],D4.prototype,"formats",void 0),y([w({type:Boolean})],D4.prototype,"atlas",void 0),D4=y([Z("esri.layer.support.I3STextureSetDefinition")],D4);let sm=class extends Ue{};y([Vt({Float32:"Float32",UInt64:"UInt64",UInt32:"UInt32",UInt16:"UInt16",UInt8:"UInt8"})],sm.prototype,"type",void 0),y([w({type:Number})],sm.prototype,"component",void 0),sm=y([Z("esri.layer.support.I3SGeometryAttribute")],sm);let N4=class extends Ue{};y([Vt({draco:"draco"})],N4.prototype,"encoding",void 0),y([w({type:[String]})],N4.prototype,"attributes",void 0),N4=y([Z("esri.layer.support.I3SGeometryCompressedAttributes")],N4);let p0=class extends Ue{constructor(){super(...arguments),this.offset=0}};y([w({type:Number})],p0.prototype,"offset",void 0),y([w({type:sm})],p0.prototype,"position",void 0),y([w({type:sm})],p0.prototype,"normal",void 0),y([w({type:sm})],p0.prototype,"uv0",void 0),y([w({type:sm})],p0.prototype,"color",void 0),y([w({type:sm})],p0.prototype,"uvRegion",void 0),y([w({type:sm})],p0.prototype,"featureId",void 0),y([w({type:sm})],p0.prototype,"faceRange",void 0),y([w({type:N4})],p0.prototype,"compressedAttributes",void 0),p0=y([Z("esri.layer.support.I3SGeometryBuffer")],p0);let F4=class extends Ue{};y([Vt({triangle:"triangle"})],F4.prototype,"topology",void 0),y([w()],F4.prototype,"geometryBuffers",void 0),F4=y([Z("esri.layer.support.I3SGeometryDefinition")],F4);const voe="__begin__",_oe="__end__",$at=new RegExp(voe,"ig"),Lat=new RegExp(_oe,"ig"),ufe=new RegExp("^"+voe,"i"),hfe=new RegExp(_oe+"$","i"),Qz='"',Dat=Qz+" + ",Nat=" + "+Qz;function Fat(t){return t.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function kat(t){return t.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function QB(t){const e={expression:"",type:"none"};return t.labelExpressionInfo?t.labelExpressionInfo.value?(e.expression=t.labelExpressionInfo.value,e.type="conventional"):t.labelExpressionInfo.expression&&(e.expression=t.labelExpressionInfo.expression,e.type="arcade"):t.labelExpression!=null&&(e.expression=Fat(t.labelExpression),e.type="conventional"),e}function zat(t){const e=QB(t);if(!e)return null;switch(e.type){case"conventional":return cQ(e.expression);case"arcade":return e.expression}return null}function Uat(t){const e=QB(t);if(!e)return null;switch(e.type){case"conventional":return Bat(e.expression);case"arcade":return boe(e.expression)}return null}function cQ(t){let e;return t?(e=h9(t,i=>voe+'$feature["'+i+'"]'+_oe),e=ufe.test(e)?e.replace(ufe,""):Qz+e,e=hfe.test(e)?e.replace(hfe,""):e+Qz,e=e.replaceAll($at,Dat).replaceAll(Lat,Nat)):e='""',e}const Vat=/^\s*\{([^}]+)\}\s*$/i;function Bat(t){const e=t==null?void 0:t.match(Vat);return(e==null?void 0:e[1].trim())||null}const jat=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])([\w\s]+)(\2)\]));?\s*$/i,Gat=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])([\w\s]+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,Hat=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])([\w\s]+)(\1)\s*\));?\s*$/i;function boe(t){if(!t)return null;let e=jat.exec(t)||Gat.exec(t);return e?e[1]||e[3]:(e=Hat.exec(t),e?e[2]:null)}var uQ;let Qb=uQ=class extends Ue{constructor(){super(...arguments),this.expression=null,this.title=null,this.value=null}readExpression(t,e){return e.value?cQ(e.value):t}writeExpression(t,e,i){this.value!=null&&(t=cQ(this.value)),t!=null&&(e[i]=t)}clone(){return new uQ({expression:this.expression,title:this.title,value:this.value})}};y([w({type:String,json:{write:{writerEnsuresNonNull:!0}}})],Qb.prototype,"expression",void 0),y([$t("expression",["expression","value"])],Qb.prototype,"readExpression",null),y([Pt("expression")],Qb.prototype,"writeExpression",null),y([w({type:String,json:{write:!0,origins:{"web-scene":{write:!1}}}})],Qb.prototype,"title",void 0),y([w({json:{read:!1,write:!1}})],Qb.prototype,"value",void 0),Qb=uQ=y([Z("esri.layers.support.LabelExpressionInfo")],Qb);const aPe=Qb,lPe=[252,146,31,255],FKt=[153,153,153,255],qat={type:"esriSMS",style:"esriSMSCircle",size:6,color:lPe,outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[153,153,153,255]}},Wat={type:"esriSLS",style:"esriSLSSolid",width:.75,color:lPe},Yat={type:"esriSFS",style:"esriSFSSolid",color:[252,146,31,196],outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[255,255,255,191]}},Xat={type:"esriTS",color:[255,255,255,255],font:{family:"arial-unicode-ms",size:10,weight:"bold"},horizontalAlignment:"center",kerning:!0,haloColor:[0,0,0,255],haloSize:1,rotated:!1,text:"",xoffset:0,yoffset:0,angle:0},Zat={type:"esriSMS",style:"esriSMSCircle",color:[0,0,0,255],outline:null,size:10.5},Jat={type:"esriSLS",style:"esriSLSSolid",color:[0,0,0,255],width:1.5},Kat={type:"esriSFS",style:"esriSFSSolid",color:[0,0,0,255],outline:null},Qat=cu.fromJSON(qat),elt=Oc.fromJSON(Wat),tlt=Bm.fromJSON(Yat),ilt=mE.fromJSON(Xat);function kKt(t){if(t==null)return null;switch(t.type){case"mesh":return null;case"point":case"multipoint":return Qat;case"polyline":return elt;case"polygon":case"extent":return tlt}return null}cu.fromJSON(Zat);Oc.fromJSON(Jat);Bm.fromJSON(Kat);var hQ;const aD=new yn({esriServerPointLabelPlacementAboveCenter:"above-center",esriServerPointLabelPlacementAboveLeft:"above-left",esriServerPointLabelPlacementAboveRight:"above-right",esriServerPointLabelPlacementBelowCenter:"below-center",esriServerPointLabelPlacementBelowLeft:"below-left",esriServerPointLabelPlacementBelowRight:"below-right",esriServerPointLabelPlacementCenterCenter:"center-center",esriServerPointLabelPlacementCenterLeft:"center-left",esriServerPointLabelPlacementCenterRight:"center-right",esriServerLinePlacementAboveAfter:"above-after",esriServerLinePlacementAboveAlong:"above-along",esriServerLinePlacementAboveBefore:"above-before",esriServerLinePlacementAboveStart:"above-start",esriServerLinePlacementAboveEnd:"above-end",esriServerLinePlacementBelowAfter:"below-after",esriServerLinePlacementBelowAlong:"below-along",esriServerLinePlacementBelowBefore:"below-before",esriServerLinePlacementBelowStart:"below-start",esriServerLinePlacementBelowEnd:"below-end",esriServerLinePlacementCenterAfter:"center-after",esriServerLinePlacementCenterAlong:"center-along",esriServerLinePlacementCenterBefore:"center-before",esriServerLinePlacementCenterStart:"center-start",esriServerLinePlacementCenterEnd:"center-end",esriServerPolygonPlacementAlwaysHorizontal:"always-horizontal"},{ignoreUnknown:!0});function lD(t,e,i){return{enabled:!zOe(i==null?void 0:i.layer)}}function cPe(t){var e;return!t||t.origin!=="service"&&((e=t.layer)==null?void 0:e.type)!=="map-image"}function rlt(t){return(t==null?void 0:t.type)==="map-image"}function uPe(t){var e,i;return!!rlt(t)&&!!((i=(e=t.capabilities)==null?void 0:e.exportMap)!=null&&i.supportsArcadeExpressionForLabeling)}function nlt(t){return cPe(t)||uPe(t==null?void 0:t.layer)}let ta=hQ=class extends Ue{static evaluateWhere(t,e){const i=(r,n,s)=>{switch(n){case"=":return r==s;case"<>":return r!=s;case">":return r>s;case">=":return r>=s;case"<":return rnlt(i)?{allowNull:!0}:{enabled:!1}}}})],ta.prototype,"labelExpressionInfo",void 0),y([Pt("labelExpressionInfo")],ta.prototype,"writeLabelExpressionInfo",null),y([w({type:aD.apiValues,json:{type:aD.jsonValues,read:aD.read,write:aD.write}})],ta.prototype,"labelPlacement",void 0),y([w({type:["curved","parallel"],json:{write:!0,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],ta.prototype,"labelPosition",void 0),y([w({type:Number})],ta.prototype,"maxScale",void 0),y([Pt("maxScale")],ta.prototype,"writeMaxScale",null),y([w({type:Number})],ta.prototype,"minScale",void 0),y([Pt("minScale")],ta.prototype,"writeMinScale",null),y([w({type:Boolean,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:lD}}}}})],ta.prototype,"repeatLabel",void 0),y([w({type:Number,cast:vs,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:lD}}}}})],ta.prototype,"repeatLabelDistance",void 0),y([w({types:tnt,json:{origins:{"web-scene":{types:int,write:$pe,default:null}},write:$pe,default:null}})],ta.prototype,"symbol",void 0),y([w({type:Boolean,json:{write:!0}})],ta.prototype,"useCodedValues",void 0),y([w({type:String,json:{write:!0}})],ta.prototype,"where",void 0),ta=hQ=y([Z("esri.layers.support.LabelClass")],ta);const hPe=ta,VH=Ce.getLogger("esri.layers.support.labelingInfo"),slt=/\[([^\[\]]+)\]/gi;function dfe(t,e,i){return t?t.map(r=>{var s;const n=new hPe;if(n.read(r,i),n.labelExpression){const o=e.fields||((s=e.layerDefinition)==null?void 0:s.fields)||this.fields;n.labelExpression=n.labelExpression.replaceAll(slt,(l,c)=>`[${olt(c,o)}]`)}return n}):null}function olt(t,e){if(!e)return t;const i=t.toLowerCase();for(let r=0;rllt(r,e))?[]:i}function llt(t,e){const i=t.labelPlacement,r=alt[e];if(!t.symbol)return VH.warn("No ILabelClass symbol specified."),!0;if(!r)return VH.error(new se("labeling:unsupported-geometry-type",`Unable to create labels for layer, geometry type '${e}' is not supported`)),!0;if(!r.includes(i)){const n=r[0];i&&VH.warn(`Found invalid label placement type ${i} for ${e}. Defaulting to ${n}`),t.labelPlacement=n}return!1}var dQ;let EA=dQ=class extends Ue{constructor(t){super(t),this.floorField=null,this.viewAllMode=!1,this.viewAllLevelIds=new it}clone(){return new dQ({floorField:this.floorField,viewAllMode:this.viewAllMode,viewAllLevelIds:this.viewAllLevelIds})}};y([w({type:String,json:{write:!0}})],EA.prototype,"floorField",void 0),y([w({json:{read:!1,write:!1}})],EA.prototype,"viewAllMode",void 0),y([w({json:{read:!1,write:!1}})],EA.prototype,"viewAllLevelIds",void 0),EA=dQ=y([Z("esri.layers.support.LayerFloorInfo")],EA);const clt=EA,dPe={BingMapsLayer:async()=>(await we(()=>import("./BingMapsLayer-d48O8tVq.js"),__vite__mapDeps([]))).default,BuildingSceneLayer:async()=>(await we(()=>import("./BuildingSceneLayer-YaRBOuhA.js"),__vite__mapDeps([46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63]))).default,CSVLayer:async()=>(await we(()=>import("./CSVLayer-tIBvmg-7.js"),__vite__mapDeps([64,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,65,66]))).default,DimensionLayer:async()=>(await we(()=>import("./DimensionLayer-WWUzEsQc.js"),__vite__mapDeps([67,68]))).default,ElevationLayer:async()=>(await we(()=>Promise.resolve().then(()=>mje),void 0)).default,FeatureLayer:async()=>(await we(()=>import("./FeatureLayer--S4epFk-.js"),__vite__mapDeps([48,49,50,51,52,53,54,55,56,57,58,59,60,61,62]))).default,GeoJSONLayer:async()=>(await we(()=>import("./GeoJSONLayer-T9kwyVNs.js"),__vite__mapDeps([69,65,66,53,54,55,56,57,58,59,60]))).default,GeoRSSLayer:async()=>(await we(()=>import("./GeoRSSLayer-hfhcgYql.js"),__vite__mapDeps([]))).default,GroupLayer:async()=>(await we(()=>Promise.resolve().then(()=>hdt),void 0)).default,ImageryLayer:async()=>(await we(()=>import("./ImageryLayer-G7gb-fJC.js"),__vite__mapDeps([70,71,72,73,53,74,75,76,77,52,78,79,62,54,61]))).default,ImageryTileLayer:async()=>(await we(()=>import("./ImageryTileLayer-ce5u7kmi.js"),__vite__mapDeps([80,54,71,72,73,53,81,82]))).default,IntegratedMeshLayer:async()=>(await we(()=>import("./IntegratedMeshLayer-T6vTIezB.js"),__vite__mapDeps([83,84]))).default,KMLLayer:async()=>(await we(()=>import("./KMLLayer-c7r_kLDp.js"),__vite__mapDeps([85,53]))).default,LineOfSightLayer:async()=>(await we(()=>import("./LineOfSightLayer-JMoACZan.js"),__vite__mapDeps([]))).default,LinkChartLayer:async()=>(await we(()=>import("./LinkChartLayer-uIn6uT3L.js"),__vite__mapDeps([86,87,88,89,90,91,92,39,40,93,66,94,73,95,65,57,53]))).default,MapImageLayer:async()=>(await we(()=>import("./MapImageLayer-qMOOMfH7.js"),__vite__mapDeps([96,97,98,79,75,76,77,52,74,53,99,60,59,50,54,61]))).default,MapNotesLayer:async()=>(await we(()=>import("./MapNotesLayer-CdG3vHcH.js"),__vite__mapDeps([100,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,101]))).default,MediaLayer:async()=>(await we(()=>import("./MediaLayer-39dmiD7K.js"),__vite__mapDeps([102,103,104,89,90,91]))).default,OGCFeatureLayer:async()=>(await we(()=>import("./OGCFeatureLayer--w0HTnNu.js"),__vite__mapDeps([105,106,107,108,65,66,53,54,55,56,57,58,60,59]))).default,OpenStreetMapLayer:async()=>(await we(()=>import("./OpenStreetMapLayer-6XrQQ-kN.js"),__vite__mapDeps([109,110]))).default,OrientedImageryLayer:async()=>(await we(()=>import("./OrientedImageryLayer-LKoItije.js"),__vite__mapDeps([111,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62]))).default,PointCloudLayer:async()=>(await we(()=>import("./PointCloudLayer-qVzMPRjJ.js"),__vite__mapDeps([112,113]))).default,RouteLayer:async()=>(await we(()=>import("./RouteLayer-GamYzZdr.js"),__vite__mapDeps([114,115,53]))).default,SceneLayer:async()=>(await we(()=>Promise.resolve().then(()=>Mht),void 0)).default,StreamLayer:async()=>(await we(()=>import("./StreamLayer-KHxHoWyI.js"),__vite__mapDeps([116,54,55,56,57]))).default,SubtypeGroupLayer:async()=>(await we(()=>import("./SubtypeGroupLayer-xK5RtU9X.js"),__vite__mapDeps([117,54,49,50,59,61]))).default,TileLayer:async()=>(await we(()=>import("./TileLayer-bPSfr5GU.js"),__vite__mapDeps([118,97,98,79,75,76,77,52,74,53,99,60,59,50,54]))).default,UnknownLayer:async()=>(await we(()=>import("./UnknownLayer-3OKGB96U.js"),__vite__mapDeps([]))).default,UnsupportedLayer:async()=>(await we(()=>import("./UnsupportedLayer-s0OShVnj.js"),__vite__mapDeps([]))).default,VectorTileLayer:async()=>(await we(()=>import("./VectorTileLayer-0SVRfneU.js"),__vite__mapDeps([119,54,45,120,121,122]))).default,VoxelLayer:async()=>(await we(()=>import("./VoxelLayer-NKOtejie.js"),__vite__mapDeps([]))).default,WFSLayer:async()=>(await we(()=>import("./WFSLayer-VPxAc_vg.js"),__vite__mapDeps([123,65,66,124,107,108,125,53,54,55,56,57,58]))).default,WMSLayer:async()=>(await we(()=>Promise.resolve().then(()=>idt),void 0)).default,WMTSLayer:async()=>(await we(()=>import("./WMTSLayer-Qx8zOTb2.js"),__vite__mapDeps([126,110,125]))).default,WebTileLayer:async()=>(await we(()=>import("./WebTileLayer-JxqArsF7.js").then(t=>t.W),__vite__mapDeps([]))).default};let ew=class extends Ue{constructor(){super(...arguments),this.name=null,this.field=null,this.currentRangeExtent=null,this.fullRangeExtent=null,this.type="rangeInfo"}};y([w({type:String,json:{read:!0,write:!0}})],ew.prototype,"name",void 0),y([w({type:String,json:{read:!0,write:!0}})],ew.prototype,"field",void 0),y([w({type:[Number],json:{read:!0,write:!0}})],ew.prototype,"currentRangeExtent",void 0),y([w({type:[Number],json:{read:!0,write:!0}})],ew.prototype,"fullRangeExtent",void 0),y([w({type:["rangeInfo"],readOnly:!0,json:{read:!1,write:!0}})],ew.prototype,"type",void 0),ew=y([Z("esri.layers.support.RangeInfo")],ew);const DE={Base64:0,Hex:1,String:2,Raw:3},lO=8,pPe=(1<>16)+(e>>16)+(i>>16)<<16|65535&i}function ult(t){const e=[];for(let i=0,r=t.length*lO;i>5]|=(t.charCodeAt(i/lO)&pPe)<>5]>>>i%32&pPe));return e.join("")}function dlt(t){const e="0123456789abcdef",i=[];for(let r=0,n=4*t.length;r>2]>>r%4*8+4&15)+e.charAt(t[r>>2]>>r%4*8&15));return i.join("")}function plt(t){const e="=",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=[];for(let n=0,s=4*t.length;n>2]>>n%4*8&255)<<16|(t[n+1>>2]>>(n+1)%4*8&255)<<8|t[n+2>>2]>>(n+2)%4*8&255;for(let l=0;l<4;l++)8*n+6*l>32*t.length?r.push(e):r.push(i.charAt(o>>6*(3-l)&63))}return r.join("")}function flt(t,e){return t<>>32-e}function ej(t,e,i,r,n,s){return a2(flt(a2(a2(e,t),a2(r,s)),n),i)}function Ic(t,e,i,r,n,s,o){return ej(e&i|~e&r,t,e,n,s,o)}function $c(t,e,i,r,n,s,o){return ej(e&r|i&~r,t,e,n,s,o)}function Lc(t,e,i,r,n,s,o){return ej(e^i^r,t,e,n,s,o)}function Dc(t,e,i,r,n,s,o){return ej(i^(e|~r),t,e,n,s,o)}function mlt(t,e){t[e>>5]|=128<>>9<<4)]=e;let i=1732584193,r=-271733879,n=-1732584194,s=271733878;for(let o=0;o{const n=blt(t,i,r);for(const s of e){const o=tne(i,s,r);for(const l in n)o[l]=n[l]}}}function blt(t,e,i){if((t==null?void 0:t.type)==="resource")return wlt(t,e,i);switch((t==null?void 0:t.type)??"other"){case"other":return{read:!0,write:!0};case"url":{const{read:r,write:n}=Brt;return{read:r,write:n}}}}function wlt(t,e,i){const r=f9(e,i);return{type:String,read:(n,s,o)=>{const l=kB(n,s,o);return r.type===String?l:typeof r.type=="function"?new r.type({url:l}):void 0},write:{writer(n,s,o,l){if(!(l!=null&&l.resources))return typeof n=="string"?void(s[o]=m_(n,l)):void(s[o]=n.write({},l));const c=Tlt(n),f=m_(c,{...l,verifyItemRelativeUrls:l!=null&&l.verifyItemRelativeUrls?{writtenUrls:l.verifyItemRelativeUrls.writtenUrls,rootPath:void 0}:void 0},JO.NO),_=r.type!==String&&(!H5e(this)||(l==null?void 0:l.origin)&&this.originIdOf(i)>kv(l.origin)),x={object:this,propertyName:i,value:n,targetUrl:f,dest:s,targetPropertyName:o,context:l,params:t};l!=null&&l.portalItem&&f&&!Zh(f)?_&&(t!=null&&t.contentAddressed)?mQ(x):_?xlt(x):Slt(x):l!=null&&l.portalItem&&(f==null||QMe(f)!=null||E2(f)||_)?mQ(x):s[o]=f}}}}function mQ(t){var M;const{targetUrl:e,params:i,value:r,context:n,dest:s,targetPropertyName:o}=t;if(!n.portalItem)return;const l=eOe(e),c=gPe(r,e,n);if(i!=null&&i.contentAddressed&&c.type!=="json")return void((M=n.messages)==null?void 0:M.push(new se("persistable:contentAddressingUnsupported",`Property "${o}" is trying to serializing a resource with content of type ${c.type} with content addressing. Content addressing is only supported for json resources.`,{content:c})));const f=i!=null&&i.contentAddressed&&c.type==="json"?glt(c.jsonString):(l==null?void 0:l.filename)??Vf(),_=s0((i==null?void 0:i.prefix)??(l==null?void 0:l.prefix),f),x=`${_}.${pQ(c)}`;if(i!=null&&i.contentAddressed&&n.resources&&c.type==="json"){const I=n.resources.toKeep.find(L=>L.resource.path===x)??n.resources.toAdd.find(L=>L.resource.path===x);if(I)return void(s[o]=I.resource.itemRelativeUrl)}const T=n.portalItem.resourceFromPath(x);E2(e)&&n.resources&&n.resources.pendingOperations.push(kYe(e).then(I=>{T.path=`${_}.${pQ({type:"blob",blob:I})}`,s[o]=T.itemRelativeUrl}).catch(()=>{}));const A=(i==null?void 0:i.compress)??!1;n.resources&&mPe({...t,resource:T,content:c,compress:A,updates:n.resources.toAdd}),s[o]=T.itemRelativeUrl}function xlt(t){const{context:e,targetUrl:i,params:r,value:n,dest:s,targetPropertyName:o}=t;if(!e.portalItem)return;const l=e.portalItem.resourceFromPath(i),c=gPe(n,i,e),f=pQ(c),_=Rne(l.path),x=(r==null?void 0:r.compress)??!1;f===_?(e.resources&&mPe({...t,resource:l,content:c,compress:x,updates:e.resources.toUpdate}),s[o]=i):mQ(t)}function Slt({context:t,targetUrl:e,dest:i,targetPropertyName:r}){t.portalItem&&t.resources&&(t.resources.toKeep.push({resource:t.portalItem.resourceFromPath(e),compress:!1}),i[r]=e)}function mPe({object:t,propertyName:e,updates:i,resource:r,content:n,compress:s}){i.push({resource:r,content:n,compress:s,finish:o=>{Elt(t,e,o)}})}function gPe(t,e,i){return typeof t=="string"?{type:"url",url:e}:{type:"json",jsonString:JSON.stringify(t.toJSON(i))}}function Tlt(t){return t==null?null:typeof t=="string"?t:t.url}function Elt(t,e,i){typeof t[e]=="string"?t[e]=i.url:t[e].url=i.url}var oF;let gQ=oF=class extends P_(it.ofType(Qa)){constructor(t){super(t)}clone(){return new oF(this.items.map(t=>t.clone()))}write(t,e){return this.toJSON(e)}toJSON(t){var i;const e=(i=t==null?void 0:t.layer)==null?void 0:i.spatialReference;return e?this.toArray().map(r=>{if(!e.equals(r.spatialReference)){if(!th(r.spatialReference,e))return t!=null&&t.messages&&t.messages.push(new Uf("scenefilter:unsupported","Scene filters with incompatible spatial references are not supported",{modification:this,spatialReference:t.layer.spatialReference,context:t})),null;const s=new Qa;U5e(r,s,e),r=s}const n=r.toJSON(t);return delete n.spatialReference,n}).filter(r=>r!=null):(t!=null&&t.messages&&t.messages.push(new Uf("scenefilter:unsupported","Writing Scene filters without context layer is not supported",{modification:this,spatialReference:t.layer.spatialReference,context:t})),this.toArray().map(r=>r.toJSON(t)))}static fromJSON(t,e){const i=new oF;return t.forEach(r=>i.add(Qa.fromJSON(r,e))),i}};gQ=oF=y([Z("esri.layers.support.PolygonCollection")],gQ);const aF=gQ;var yQ;let CA=yQ=class extends Ue{constructor(t){super(t),this.spatialRelationship="disjoint",this.geometries=new aF,this._geometriesSource=null}initialize(){this.addHandles(Jr(()=>this.geometries,"after-changes",()=>this.geometries=this.geometries,Li))}readGeometries(t,e,i){Array.isArray(t)?this.geometries=aF.fromJSON(t,i):this._geometriesSource={url:f_(t,i),context:i}}async loadGeometries(t,e){if(this._geometriesSource==null)return;const{url:i,context:r}=this._geometriesSource,n=await bi(i,{responseType:"json",signal:e==null?void 0:e.signal}),s=t.toJSON(),o=n.data.map(l=>({...l,spatialReference:s}));this.geometries=aF.fromJSON(o,r),this._geometriesSource=null}clone(){const t=new yQ({geometries:Re(this.geometries),spatialRelationship:this.spatialRelationship});return t._geometriesSource=this._geometriesSource,t}};y([w({type:["disjoint","contains"],nonNullable:!0,json:{write:!0}})],CA.prototype,"spatialRelationship",void 0),y([w({type:aF,nonNullable:!0,json:{write:!0}}),Dv({origins:["web-scene","portal-item"],type:"resource",prefix:"geometries",contentAddressed:!0})],CA.prototype,"geometries",void 0),y([$t(["web-scene","portal-item"],"geometries")],CA.prototype,"readGeometries",null),CA=yQ=y([Z("esri.layers.support.SceneFilter")],CA);const Clt=CA;async function Alt(t,e,i){const r=t&&t.getAtOrigin&&t.getAtOrigin("renderer",e.origin);if(r&&r.type==="unique-value"&&r.styleOrigin){const n=await Ju(r.populateFromStyle());if(St(i),n.ok===!1){const s=n.error;e!=null&&e.messages&&e.messages.push(new Uf("renderer:style-reference",`Failed to create unique value renderer from style reference: ${s.message}`,{error:s,context:e})),t.clear("renderer",e==null?void 0:e.origin)}}}function yPe(t){return t?ma:$lt}function Mlt(t,e){return e!=null&&e.mode?e.mode:yPe(t).mode}function vPe(t,e){return e??yPe(t)}function xoe(t,e){return Mlt(t!=null&&t.hasZ,e)}function VKt(t,e){return vPe(t!=null&&!!t.hasZ,e)}function tj(t){const e=Soe(t);return xoe(t.geometry,e)}function _Pe(t){const e=Soe(t),i=xoe(t.geometry,e);return{mode:i,offset:e!=null&&i!=="on-the-ground"?(e.offset??0)*SOe(e.unit??"meters"):0}}function ij(t){if(tj(t)==="on-the-ground")return!1;const e=Soe(t),i=e!=null&&e.featureExpressionInfo?e.featureExpressionInfo.expression:null;return!(!i||i==="0")}function Soe(t){return t.layer&&"elevationInfo"in t.layer?t.layer.elevationInfo:null}function BKt(t,e,i){if(!(i!=null&&i.mode))return;const r=t.hasZ?t.z:0,n=i.offset!=null?i.offset:0;switch(i.mode){case"absolute-height":return r-n;case"on-the-ground":return 0;case"relative-to-ground":return r-((e.elevationProvider.getElevation(t.x,t.y,r,t.spatialReference,"ground")??0)+n);case"relative-to-scene":return r-((e.elevationProvider.getElevation(t.x,t.y,r,t.spatialReference,"scene")??0)+n)}}function bPe(t,e,i,r=null){return xPe(t,e.x,e.y,e.hasZ?e.z:0,e.spatialReference,i,r)}function wPe(t,e,i,r,n=null){return xPe(t,e[0],e[1],e.length>2?e[2]:0,i,r,n)}function xPe(t,e,i,r,n,s,o=null){if(s==null)return;const l=o!=null?o.mode:"absolute-height";if(l==="on-the-ground")return 0;const{absoluteZ:c}=Olt(e,i,r,n,t,s);return Plt(c,e,i,r,n,t,o,l)}function Olt(t,e,i,r,n,s){const o=s.offset!=null?s.offset:0;switch(s.mode){case"absolute-height":return{absoluteZ:i+o,elevation:0};case"on-the-ground":{const l=n.elevationProvider.getElevation(t,e,0,r,"ground")??0;return{absoluteZ:l,elevation:l}}case"relative-to-ground":{const l=n.elevationProvider.getElevation(t,e,i,r,"ground")??0;return{absoluteZ:i+l+o,elevation:l}}case"relative-to-scene":{const l=n.elevationProvider.getElevation(t,e,i,r,"scene")??0;return{absoluteZ:i+l+o,elevation:l}}}}function Plt(t,e,i,r,n,s,o,l){const c=(o==null?void 0:o.offset)!=null?o.offset:0;switch(l){case"absolute-height":return t-c;case"relative-to-ground":return t-((s.elevationProvider.getElevation(e,i,r,n,"ground")??0)+c);case"relative-to-scene":return t-((s.elevationProvider.getElevation(e,i,r,n,"scene")??0)+c)}}function jKt(t,e){if(e==null)return!1;const{mode:i}=e;return i!=null&&(t==="scene"&&i==="relative-to-scene"||t==="ground"&&i!=="absolute-height")}function GKt(t,e,i){return i&&i.mode!==e?`${t} only support ${e} elevation mode`:null}function Rlt(t,e,i){return(i==null?void 0:i.mode)===e?`${t} do not support ${e} elevation mode`:null}function Ilt(t,e){return(e==null?void 0:e.featureExpressionInfo)!=null&&e.featureExpressionInfo.expression!=="0"?`${t} do not support featureExpressionInfo`:null}function pfe(t,e){e&&t.warn(".elevationInfo=",e)}const ma={mode:"absolute-height",offset:0},$lt={mode:"on-the-ground",offset:null};function Llt({displayField:t,editFieldsInfo:e,fields:i,objectIdField:r,title:n},s){if(!i)return null;const o=klt({editFieldsInfo:e,fields:i,objectIdField:r},s);if(!o.length)return null;const l=Vlt({titleBase:n,fields:i,displayField:t}),c=Ult();return new hE({title:l,content:c,fieldInfos:o})}const Dlt=(t,e)=>e.visibleFieldNames?e.visibleFieldNames.has(t.name):Tit(t,e);function Nlt(t,e){const i=t;return e&&(t=t.filter(r=>!e.includes(r.type))),t===i&&(t=t.slice()),t.sort(Flt),t}function Flt(t,e){return t.type==="oid"?-1:e.type==="oid"?1:ffe(t)?-1:ffe(e)?1:(t.alias||t.name).toLocaleLowerCase().localeCompare((e.alias||e.name).toLocaleLowerCase())}function klt(t,e){const i=e==null?void 0:e.visibleFieldNames;return Nlt(t.fields??[],(e==null?void 0:e.ignoreFieldTypes)||Blt).map(r=>new Ose({fieldName:r.name,isEditable:Sit(r,t),label:r.alias,format:zlt(r),visible:Dlt(r,{...t,visibleFieldNames:i})}))}function zlt(t){switch(t.type){case"small-integer":case"integer":case"single":return new T7({digitSeparator:!0,places:0});case"double":return new T7({digitSeparator:!0,places:2});case"string":return Xit(t.name)?new T7({digitSeparator:!0,places:0}):null;default:return null}}function Ult(){return[new gL,new mL]}function Vlt(t){const e=dit(t),{titleBase:i}=t;return e?`${i}: {${e.trim()}}`:i??""}function ffe(t){return(t.name&&t.name.toLowerCase())==="name"?!0:(t.alias&&t.alias.toLowerCase())==="name"}const Blt=["geometry","blob","raster","guid","xml"];function Yf(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function jlt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Toe(t,e,i,r,n,s,o,l,c,f){return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t[4]=s,t[5]=o,t[6]=l,t[7]=c,t[8]=f,t}function Eoe(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Xf(t,e){if(t===e){const i=e[1],r=e[2],n=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=r,t[7]=n}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function _E(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],l=e[5],c=e[6],f=e[7],_=e[8],x=_*o-l*f,T=-_*s+l*c,A=f*s-o*c;let M=i*x+r*T+n*A;return M?(M=1/M,t[0]=x*M,t[1]=(-_*r+n*f)*M,t[2]=(l*r-n*o)*M,t[3]=T*M,t[4]=(_*i-n*c)*M,t[5]=(-l*i+n*s)*M,t[6]=A*M,t[7]=(-f*i+r*c)*M,t[8]=(o*i-r*s)*M,t):null}function Glt(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],l=e[5],c=e[6],f=e[7],_=e[8];return t[0]=o*_-l*f,t[1]=n*f-r*_,t[2]=r*l-n*o,t[3]=l*c-s*_,t[4]=i*_-n*c,t[5]=n*s-i*l,t[6]=s*f-o*c,t[7]=r*c-i*f,t[8]=i*o-r*s,t}function Hlt(t){const e=t[0],i=t[1],r=t[2],n=t[3],s=t[4],o=t[5],l=t[6],c=t[7],f=t[8];return e*(f*s-o*c)+i*(-f*n+o*l)+r*(c*n-s*l)}function s5(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3],l=e[4],c=e[5],f=e[6],_=e[7],x=e[8],T=i[0],A=i[1],M=i[2],I=i[3],L=i[4],F=i[5],z=i[6],k=i[7],U=i[8];return t[0]=T*r+A*o+M*f,t[1]=T*n+A*l+M*_,t[2]=T*s+A*c+M*x,t[3]=I*r+L*o+F*f,t[4]=I*n+L*l+F*_,t[5]=I*s+L*c+F*x,t[6]=z*r+k*o+U*f,t[7]=z*n+k*l+U*_,t[8]=z*s+k*c+U*x,t}function eU(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3],l=e[4],c=e[5],f=e[6],_=e[7],x=e[8],T=i[0],A=i[1];return t[0]=r,t[1]=n,t[2]=s,t[3]=o,t[4]=l,t[5]=c,t[6]=T*r+A*o+f,t[7]=T*n+A*l+_,t[8]=T*s+A*c+x,t}function Coe(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3],l=e[4],c=e[5],f=e[6],_=e[7],x=e[8],T=Math.sin(i),A=Math.cos(i);return t[0]=A*r+T*o,t[1]=A*n+T*l,t[2]=A*s+T*c,t[3]=A*o-T*r,t[4]=A*l-T*n,t[5]=A*c-T*s,t[6]=f,t[7]=_,t[8]=x,t}function Aoe(t,e,i){const r=i[0],n=i[1],s=i[2];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t[6]=s*e[6],t[7]=s*e[7],t[8]=s*e[8],t}function qlt(t,e,i){const r=i[0],n=i[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t}function Wlt(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function Ylt(t,e){const i=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Xlt(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Zlt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function rj(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=i+i,l=r+r,c=n+n,f=i*o,_=r*o,x=r*l,T=n*o,A=n*l,M=n*c,I=s*o,L=s*l,F=s*c;return t[0]=1-x-M,t[3]=_-F,t[6]=T+L,t[1]=_+F,t[4]=1-f-M,t[7]=A-I,t[2]=T-L,t[5]=A+I,t[8]=1-f-x,t}function SPe(t,e){const i=e[0],r=e[1],n=e[2],s=e[4],o=e[5],l=e[6],c=e[8],f=e[9],_=e[10],x=_*o-l*f,T=-_*s+l*c,A=f*s-o*c,M=i*x+r*T+n*A;if(!M)return null;const I=1/M;return t[0]=x*I,t[1]=(-_*r+n*f)*I,t[2]=(l*r-n*o)*I,t[3]=T*I,t[4]=(_*i-n*c)*I,t[5]=(-l*i+n*s)*I,t[6]=A*I,t[7]=(-f*i+r*c)*I,t[8]=(o*i-r*s)*I,t}function v_(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],l=e[5],c=e[6],f=e[7],_=e[8],x=e[9],T=e[10],A=e[11],M=e[12],I=e[13],L=e[14],F=e[15],z=i*l-r*o,k=i*c-n*o,U=i*f-s*o,j=r*c-n*l,H=r*f-s*l,Y=n*f-s*c,Q=_*I-x*M,ne=_*L-T*M,re=_*F-A*M,he=x*L-T*I,ce=x*F-A*I,be=T*F-A*L;let ye=z*be-k*ce+U*he+j*re-H*ne+Y*Q;return ye?(ye=1/ye,t[0]=(l*be-c*ce+f*he)*ye,t[1]=(c*re-o*be-f*ne)*ye,t[2]=(o*ce-l*re+f*Q)*ye,t[3]=(n*ce-r*be-s*he)*ye,t[4]=(i*be-n*re+s*ne)*ye,t[5]=(r*re-i*ce-s*Q)*ye,t[6]=(I*Y-L*H+F*j)*ye,t[7]=(L*U-M*Y-F*k)*ye,t[8]=(M*H-I*U+F*z)*ye,t):null}function Jlt(t,e,i){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/i,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function Klt(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function Qlt(t){return Math.sqrt(t[0]**2+t[1]**2+t[2]**2+t[3]**2+t[4]**2+t[5]**2+t[6]**2+t[7]**2+t[8]**2)}function ect(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t}function TPe(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t}function tct(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t}function ict(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t[2]=e[2]+i[2]*r,t[3]=e[3]+i[3]*r,t[4]=e[4]+i[4]*r,t[5]=e[5]+i[5]*r,t[6]=e[6]+i[6]*r,t[7]=e[7]+i[7]*r,t[8]=e[8]+i[8]*r,t}function rct(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function nct(t,e){const i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],l=t[5],c=t[6],f=t[7],_=t[8],x=e[0],T=e[1],A=e[2],M=e[3],I=e[4],L=e[5],F=e[6],z=e[7],k=e[8],U=sl();return Math.abs(i-x)<=U*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(r-T)<=U*Math.max(1,Math.abs(r),Math.abs(T))&&Math.abs(n-A)<=U*Math.max(1,Math.abs(n),Math.abs(A))&&Math.abs(s-M)<=U*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(o-I)<=U*Math.max(1,Math.abs(o),Math.abs(I))&&Math.abs(l-L)<=U*Math.max(1,Math.abs(l),Math.abs(L))&&Math.abs(c-F)<=U*Math.max(1,Math.abs(c),Math.abs(F))&&Math.abs(f-z)<=U*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(_-k)<=U*Math.max(1,Math.abs(_),Math.abs(k))}function Moe(t){const e=sl(),i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],l=t[5],c=t[6],f=t[7],_=t[8];return Math.abs(1-(i*i+s*s+c*c))<=e&&Math.abs(1-(r*r+o*o+f*f))<=e&&Math.abs(1-(n*n+l*l+_*_))<=e}const sct=s5,oct=TPe;Object.freeze(Object.defineProperty({__proto__:null,add:ect,adjoint:Glt,copy:jlt,determinant:Hlt,equals:nct,exactEquals:rct,frob:Qlt,fromMat2d:Zlt,fromMat4:Yf,fromQuat:rj,fromRotation:Ylt,fromScaling:Xlt,fromTranslation:Wlt,identity:Eoe,invert:_E,isOrthoNormal:Moe,mul:sct,multiply:s5,multiplyScalar:tct,multiplyScalarAndAdd:ict,normalFromMat4:v_,normalFromMat4Legacy:SPe,projection:Jlt,rotate:Coe,scale:Aoe,scaleByVec2:qlt,set:Toe,str:Klt,sub:oct,subtract:TPe,translate:eU,transpose:Xf},Symbol.toStringTag,{value:"Module"}));function as(){return[1,0,0,0,1,0,0,0,1]}function EPe(t){return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]}function act(t,e,i,r,n,s,o,l,c){return[t,e,i,r,n,s,o,l,c]}function CPe(t,e){return new Float64Array(t,e,9)}Object.freeze(Object.defineProperty({__proto__:null,clone:EPe,create:as,createView:CPe,fromValues:act},Symbol.toStringTag,{value:"Module"}));function Qe(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function o5(t){return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]}function Ooe(t,e,i,r,n,s,o,l,c,f,_,x,T,A,M,I){return[t,e,i,r,n,s,o,l,c,f,_,x,T,A,M,I]}function APe(t,e){return new Float64Array(t,e,16)}const gs=Qe();Object.freeze(Object.defineProperty({__proto__:null,IDENTITY:gs,clone:o5,create:Qe,createView:APe,fromValues:Ooe},Symbol.toStringTag,{value:"Module"}));function Cp(){return[0,0,0,1]}function MPe(t){return[t[0],t[1],t[2],t[3]]}function lct(t,e,i,r){return[t,e,i,r]}function OPe(t,e){return new Float64Array(t,e,4)}const cct=Cp();Object.freeze(Object.defineProperty({__proto__:null,IDENTITY:cct,clone:MPe,create:Cp,createView:OPe,fromValues:lct},Symbol.toStringTag,{value:"Module"}));function uct(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function wL(t,e,i){i*=.5;const r=Math.sin(i);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(i),t}function Poe(t,e){const i=2*Math.acos(e[3]),r=Math.sin(i/2);return r>sl()?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),i}function nj(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3],l=i[0],c=i[1],f=i[2],_=i[3];return t[0]=r*_+o*l+n*f-s*c,t[1]=n*_+o*c+s*l-r*f,t[2]=s*_+o*f+r*c-n*l,t[3]=o*_-r*l-n*c-s*f,t}function hct(t,e,i){i*=.5;const r=e[0],n=e[1],s=e[2],o=e[3],l=Math.sin(i),c=Math.cos(i);return t[0]=r*c+o*l,t[1]=n*c+s*l,t[2]=s*c-n*l,t[3]=o*c-r*l,t}function dct(t,e,i){i*=.5;const r=e[0],n=e[1],s=e[2],o=e[3],l=Math.sin(i),c=Math.cos(i);return t[0]=r*c-s*l,t[1]=n*c+o*l,t[2]=s*c+r*l,t[3]=o*c-n*l,t}function pct(t,e,i){i*=.5;const r=e[0],n=e[1],s=e[2],o=e[3],l=Math.sin(i),c=Math.cos(i);return t[0]=r*c+n*l,t[1]=n*c-r*l,t[2]=s*c+o*l,t[3]=o*c-s*l,t}function fct(t,e){const i=e[0],r=e[1],n=e[2];return t[0]=i,t[1]=r,t[2]=n,t[3]=Math.sqrt(Math.abs(1-i*i-r*r-n*n)),t}function lF(t,e,i,r){const n=e[0],s=e[1],o=e[2],l=e[3];let c,f,_,x,T,A=i[0],M=i[1],I=i[2],L=i[3];return f=n*A+s*M+o*I+l*L,f<0&&(f=-f,A=-A,M=-M,I=-I,L=-L),1-f>sl()?(c=Math.acos(f),_=Math.sin(c),x=Math.sin((1-r)*c)/_,T=Math.sin(r*c)/_):(x=1-r,T=r),t[0]=x*n+T*A,t[1]=x*s+T*M,t[2]=x*o+T*I,t[3]=x*l+T*L,t}function mct(t){const e=M9,i=e(),r=e(),n=e(),s=Math.sqrt(1-i),o=Math.sqrt(i);return t[0]=s*Math.sin(2*Math.PI*r),t[1]=s*Math.cos(2*Math.PI*r),t[2]=o*Math.sin(2*Math.PI*n),t[3]=o*Math.cos(2*Math.PI*n),t}function gct(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=i*i+r*r+n*n+s*s,l=o?1/o:0;return t[0]=-i*l,t[1]=-r*l,t[2]=-n*l,t[3]=s*l,t}function __(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function PPe(t,e){const i=e[0]+e[4]+e[8];let r;if(i>0)r=Math.sqrt(i+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{let n=0;e[4]>e[0]&&(n=1),e[8]>e[3*n+n]&&(n=2);const s=(n+1)%3,o=(n+2)%3;r=Math.sqrt(e[3*n+n]-e[3*s+s]-e[3*o+o]+1),t[n]=.5*r,r=.5/r,t[3]=(e[3*s+o]-e[3*o+s])*r,t[s]=(e[3*s+n]+e[3*n+s])*r,t[o]=(e[3*o+n]+e[3*n+o])*r}return t}function yct(t,e,i,r){const n=.5*Math.PI/180;e*=n,i*=n,r*=n;const s=Math.sin(e),o=Math.cos(e),l=Math.sin(i),c=Math.cos(i),f=Math.sin(r),_=Math.cos(r);return t[0]=s*c*_-o*l*f,t[1]=o*l*_+s*c*f,t[2]=o*c*f-s*l*_,t[3]=o*c*_+s*l*f,t}function vct(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}const V9=mm,_ct=rs,bct=rse,wct=nj,xct=UT,Sct=wAe,Tct=_B,RPe=nse,Ect=RPe,IPe=sse,Cct=IPe,Roe=bAe,Act=rO,Mct=VT;function Oct(t,e,i){const r=Ve(e,i);return r<-.999999?(Wt(Jm,Pct,e),$h(Jm)<1e-6&&Wt(Jm,Rct,e),Ye(Jm,Jm),wL(t,Jm,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(Wt(Jm,e,i),t[0]=Jm[0],t[1]=Jm[1],t[2]=Jm[2],t[3]=1+r,Roe(t,t))}const Jm=W(),Pct=nt(1,0,0),Rct=nt(0,1,0);function Ict(t,e,i,r,n,s){return lF(mfe,e,n,s),lF(gfe,i,r,s),lF(t,mfe,gfe,2*s*(1-s)),t}const mfe=Cp(),gfe=Cp();function $ct(t,e,i,r){const n=Lct;return n[0]=i[0],n[3]=i[1],n[6]=i[2],n[1]=r[0],n[4]=r[1],n[7]=r[2],n[2]=-e[0],n[5]=-e[1],n[8]=-e[2],Roe(t,PPe(t,n))}const Lct=as();Object.freeze(Object.defineProperty({__proto__:null,add:bct,calculateW:fct,conjugate:__,copy:V9,dot:Sct,equals:Mct,exactEquals:Act,fromEuler:yct,fromMat3:PPe,getAxisAngle:Poe,identity:uct,invert:gct,len:Ect,length:RPe,lerp:Tct,mul:wct,multiply:nj,normalize:Roe,random:mct,rotateX:hct,rotateY:dct,rotateZ:pct,rotationTo:Oct,scale:xct,set:_ct,setAxes:$ct,setAxisAngle:wL,slerp:lF,sqlerp:Ict,sqrLen:Cct,squaredLength:IPe,str:vct},Symbol.toStringTag,{value:"Module"}));const Dct=new at(NCe),yfe=new at(hB),vfe=new at(dB),HKt=new at(FCe);function Zf(t){return t&&(r1(t)||Zn(t,yfe))?yfe:t&&(n1(t)||Zn(t,vfe))?vfe:Dct}function $Pe(t,e,i){const r=Math.sin(t),n=Math.cos(t),s=Math.sin(e),o=Math.cos(e),l=i;return l[0]=-r,l[4]=-s*n,l[8]=o*n,l[12]=0,l[1]=n,l[5]=-s*r,l[9]=o*r,l[13]=0,l[2]=0,l[6]=o,l[10]=s,l[14]=0,l[3]=0,l[7]=0,l[11]=0,l[15]=1,l}function Nct(t,e,i){return $Pe(t,e,i),ld(i,i),i}function uu(t,e,i,r){if(t==null||r==null)return!1;const n=_L(t,I5e),s=_L(r,Lot);if(n===s&&!_fe(s)&&(n!==Oe.UNKNOWN||Zn(t,r)))return L9(i,e),!0;if(_fe(s)){const o=CM[n][Oe.LON_LAT],l=CM[Oe.LON_LAT][s];return o!=null&&l!=null&&(o(e,0,ob,0),l(ob,0,ab,0),$Pe(cD*ob[0],cD*ob[1],i),i[12]=ab[0],i[13]=ab[1],i[14]=ab[2],!0)}if((s===Oe.WEB_MERCATOR||s===Oe.PLATE_CARREE)&&(n===Oe.WGS84||n===Oe.CGCS2000&&s===Oe.PLATE_CARREE||n===Oe.SPHERICAL_ECEF||n===Oe.WEB_MERCATOR)){const o=CM[n][Oe.LON_LAT],l=CM[Oe.LON_LAT][s];return o!=null&&l!=null&&(o(e,0,ob,0),l(ob,0,ab,0),n===Oe.SPHERICAL_ECEF?Nct(cD*ob[0],cD*ob[1],i):Hf(i),i[12]=ab[0],i[13]=ab[1],i[14]=ab[2],!0)}return!1}function _fe(t){return t===Oe.SPHERICAL_ECEF||t===Oe.SPHERICAL_MARS_PCPF||t===Oe.SPHERICAL_MOON_PCPF}const cD=Ei(1),ob=W(),ab=W();function el(t,e,i,r){return!(e==null||r==null||t.length<2)&&(t.length===2&&(uD[0]=t[0],uD[1]=t[1],uD[2]=0,t=uD),vn(t,e,0,i,r,0,1))}const uD=W(),vo=!0,WS={identifierOffset:0,identifierLength:10,versionOffset:10,checksumOffset:12,byteCount:16};function Ioe(t,e,i){return{identifier:String.fromCharCode.apply(null,new Uint8Array(t,i+WS.identifierOffset,WS.identifierLength)),version:e.getUint16(i+WS.versionOffset,vo),checksum:e.getUint32(i+WS.checksumOffset,vo)}}const Th={sizeLo:0,sizeHi:4,minX:8,minY:16,minZ:24,maxX:32,maxY:40,maxZ:48,errorX:56,errorY:64,errorZ:72,count:80,reserved:84,byteCount:88};function Fct(t,e){return{sizeLo:t.getUint32(e+Th.sizeLo,vo),sizeHi:t.getUint32(e+Th.sizeHi,vo),minX:t.getFloat64(e+Th.minX,vo),minY:t.getFloat64(e+Th.minY,vo),minZ:t.getFloat64(e+Th.minZ,vo),maxX:t.getFloat64(e+Th.maxX,vo),maxY:t.getFloat64(e+Th.maxY,vo),maxZ:t.getFloat64(e+Th.maxZ,vo),errorX:t.getFloat64(e+Th.errorX,vo),errorY:t.getFloat64(e+Th.errorY,vo),errorZ:t.getFloat64(e+Th.errorZ,vo),count:t.getUint32(e+Th.count,vo),reserved:t.getUint32(e+Th.reserved,vo)}}function qKt(t){const e=new DataView(t,0);let i=0;const{identifier:r,version:n}=Ioe(t,e,i);if(i+=WS.byteCount,r!=="LEPCC ")throw new se("lepcc-decode-error","Bad identifier");if(n>1)throw new se("lepcc-decode-error","Unknown version");const s=Fct(e,i);if(i+=Th.byteCount,s.sizeHi*2**32+s.sizeLo!==t.byteLength)throw new se("lepcc-decode-error","Bad size");const o=new Float64Array(3*s.count),l=[],c=[],f=[],_=[];if(i=hD(t,i,l),i=hD(t,i,c),i=hD(t,i,f),i=hD(t,i,_),i!==t.byteLength)throw new se("lepcc-decode-error","Bad length");let x=0,T=0;for(let A=0;A>6;let c=0;if(l===0)c=r.getUint32(1,vo),e+=5;else if(l===1)c=r.getUint16(1,vo),e+=3;else{if(l!==2)throw new se("lepcc-decode-error","Bad count type");c=r.getUint8(1),e+=2}if(o)throw new se("lepcc-decode-error","LUT not implemented");const f=Math.ceil(c*s/8),_=new Uint8Array(t,e,f);let x=0,T=0,A=0;const M=-1>>>32-s;for(let I=0;I>>=s,T-=s,T+s>32&&(x|=_[A-1]>>8-T)}return e+A}const N3={sizeLo:0,sizeHi:4,count:8,colorMapCount:12,lookupMethod:14,compressionMethod:15,byteCount:16};function kct(t,e){return{sizeLo:t.getUint32(e+N3.sizeLo,vo),sizeHi:t.getUint32(e+N3.sizeHi,vo),count:t.getUint32(e+N3.count,vo),colorMapCount:t.getUint16(e+N3.colorMapCount,vo),lookupMethod:t.getUint8(e+N3.lookupMethod),compressionMethod:t.getUint8(e+N3.compressionMethod)}}function zct(t){const e=new DataView(t,0);let i=0;const{identifier:r,version:n}=Ioe(t,e,i);if(i+=WS.byteCount,r!=="ClusterRGB")throw new se("lepcc-decode-error","Bad identifier");if(n>1)throw new se("lepcc-decode-error","Unknown version");const s=kct(e,i);if(i+=N3.byteCount,s.sizeHi*2**32+s.sizeLo!==t.byteLength)throw new se("lepcc-decode-error","Bad size");if((s.lookupMethod===2||s.lookupMethod===1)&&s.compressionMethod===0){if(3*s.colorMapCount+s.count+i!==t.byteLength||s.colorMapCount>256)throw new se("lepcc-decode-error","Bad count");const o=new Uint8Array(t,i,3*s.colorMapCount),l=new Uint8Array(t,i+3*s.colorMapCount,s.count),c=new Uint8Array(3*s.count);for(let f=0;f1)throw new se("lepcc-decode-error","Unknown version");const s=Uct(e,i);if(i+=F3.byteCount,s.sizeHi*2**32+s.sizeLo!==t.byteLength)throw new se("lepcc-decode-error","Bad size");const o=new Uint16Array(s.count);if(s.bitsPerPoint===8){if(s.count+i!==t.byteLength)throw new se("lepcc-decode-error","Bad size");const l=new Uint8Array(t,i,s.count);for(let c=0;c=192&&s<224){if(n+1>=i)throw new se("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const o=(31&s)<<6|63&t[e+n+1];r+=String.fromCharCode(o),n+=2}else if(s>=224&&s<240){if(n+2>=i)throw new se("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const o=(15&s)<<12|(63&t[e+n+1])<<6|63&t[e+n+2];r+=String.fromCharCode(o),n+=3}else{if(!(s>=240&&s<248))throw new se("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(n+3>=i)throw new se("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const o=(7&s)<<18|(63&t[e+n+1])<<12|(63&t[e+n+2])<<6|63&t[e+n+3];if(o>=65536){const l=55296+(o-65536>>10),c=56320+(1023&o);r+=String.fromCharCode(l,c)}else r+=String.fromCharCode(o);n+=4}}}return r}function LPe(t,e){const i={byteOffset:0,byteCount:0,fields:Object.create(null)};let r=0;for(let n=0;n{const n=r?Date.parse(r):null;return n&&!Number.isNaN(n)?n:null})}function DPe(t,e,i){const r=[];let n,s,o=0;for(s=0;s0){if(r.push(jct(i,o,n-1)),i[o+n-1]!==0)throw new se("string-array-error","Invalid string array: missing null termination.")}else r.push(null);o+=n}return r}function bfe(t,e){return new sj[e.valueType](t,e.byteOffset,e.count*e.valuesPerElement)}function Hct(t,e){return new Uint8Array(t,e.byteOffset,e.byteCount)}function qct(t,e,i){const r=e.header!=null?LPe(t,e.header):{byteOffset:0,byteCount:0,fields:{count:i}},n={header:r,byteOffset:r.byteCount,byteCount:0,entries:Object.create(null)};let s=r.byteCount;for(let o=0;onew DataView(t,0).getFloat32(e,!0),Float64:(t,e)=>new DataView(t,0).getFloat64(e,!0),UInt8:(t,e)=>new DataView(t,0).getUint8(e),Int8:(t,e)=>new DataView(t,0).getInt8(e),UInt16:(t,e)=>new DataView(t,0).getUint16(e,!0),Int16:(t,e)=>new DataView(t,0).getInt16(e,!0),UInt32:(t,e)=>new DataView(t,0).getUint32(e,!0),Int32:(t,e)=>new DataView(t,0).getInt32(e,!0)};function FPe(t){return sj.hasOwnProperty(t)}function cF(t){return FPe(t)?sj[t].BYTES_PER_ELEMENT:0}function Qct(t,e,i,r){const n=eut(t,e,i),s=Qe();return uu(i,n,s,r),s}const kPe=1,wfe=5-kPe;function eut(t,e,i){const r=W(),n=t[3],s=2**(Math.ceil(Math.log(n)*Math.LOG2E/wfe)*wfe+kPe);if(i.isGeographic){const c=s/Sr(i).radius*180/Math.PI,f=Math.round(t[1]/c),_=Math.max(-90,Math.min(90,f*c)),x=c/Math.cos((Math.abs(_)-c/2)/180*Math.PI),T=Math.round(t[0]/x)*x;r[0]=T,r[1]=_}else{const c=Math.round(t[0]/s),f=Math.round(t[1]/s);r[0]=c*s,r[1]=f*s}const o=t[2]+e,l=Math.round(o/s);return r[2]=l*s,r}function tut(t){return t.type==="fill"}function iut(t){return t.type==="extrude"}var Wi;(function(t){t[t.INVISIBLE=0]="INVISIBLE",t[t.TRANSPARENT=1]="TRANSPARENT",t[t.OPAQUE=2]="OPAQUE"})(Wi||(Wi={}));function rut(t){return t&&t.enabled&&(iut(t)||tut(t))&&t.edges!=null}function nut(t){return t&&t.enabled&&t.edges||null}function zPe(t,e){return UPe(nut(t),e)}function UPe(t,e){if(t==null)return null;const i=t.color!=null?YB(qe.toUnitRGBA(t.color)):Mi(0,0,0,0),r=Tr(t.size),n=Tr(t.extensionLength);switch(t.type){case"solid":return VPe({color:i,size:r,extensionLength:n,...e});case"sketch":return sut({color:i,size:r,extensionLength:n,...e});default:return}}function VPe(t){return{...out,...t,type:"solid"}}function sut(t){return{...aut,...t,type:"sketch"}}const out={color:Mi(0,0,0,.2),size:1,extensionLength:0,opacity:1,objectTransparency:Wi.OPAQUE,hasSlicePlane:!1},aut={color:Mi(0,0,0,.2),size:1,extensionLength:0,opacity:1,objectTransparency:Wi.OPAQUE,hasSlicePlane:!1};var Uo;function BPe(t){switch(t){case"multiply":default:return Uo.Multiply;case"ignore":return Uo.Ignore;case"replace":return Uo.Replace;case"tint":return Uo.Tint}}function jPe(t,e,i){if(t==null||e===Uo.Ignore)return i[0]=255,i[1]=255,i[2]=255,void(i[3]=255);const r=Je(Math.round(t[3]*tU),0,tU),n=r===0||e===Uo.Tint?0:e===Uo.Replace?lut:cut;i[0]=Je(Math.round(t[0]*NE),0,NE),i[1]=Je(Math.round(t[1]*NE),0,NE),i[2]=Je(Math.round(t[2]*NE),0,NE),i[3]=r+n}(function(t){t[t.Multiply=1]="Multiply",t[t.Ignore=2]="Ignore",t[t.Replace=3]="Replace",t[t.Tint=4]="Tint"})(Uo||(Uo={}));const NE=255,tU=85,lut=tU,cut=2*tU;let k_=class{constructor(e){this._allocator=e,this._items=[],this._itemsPtr=0,this._grow()}get(){return this._itemsPtr===0&&kO(()=>this._reset()),this._itemsPtr===this._items.length&&this._grow(),this._items[this._itemsPtr++]}_reset(){const e=Math.min(3*Math.max(8,this._itemsPtr),this._itemsPtr+3*xfe);this._items.length=Math.min(e,this._items.length),this._itemsPtr=0}_grow(){for(let e=0;ethis._reset());const e=Math.floor(this._itemsPtr/this._itemsPerBuffer);for(;this._buffers.length<=e;){const i=new ArrayBuffer(this._itemsPerBuffer*this._itemByteSize);for(let r=0;re;)this._buffers.pop(),this._items.length=this._buffers.length*this._itemsPerBuffer;this._itemsPtr=0}static createVec2f64(e=FE){return new k3(16,HPe,e)}static createVec3f64(e=FE){return new k3(24,oAe,e)}static createVec4f64(e=FE){return new k3(32,ZOe,e)}static createMat3f64(e=FE){return new k3(72,CPe,e)}static createMat4f64(e=FE){return new k3(128,APe,e)}static createQuatf64(e=FE){return new k3(32,OPe,e)}get test(){return{size:this._buffers.length*this._itemsPerBuffer*this._itemByteSize}}};const FE=4*N2.KILOBYTES,ZKt=mP.createVec2f64(),xt=mP.createVec3f64(),$oe=mP.createVec4f64();mP.createMat3f64();const Loe=mP.createMat4f64(),JKt=mP.createQuatf64();function Ko(t){return t?Sfe(Xr(t.origin),Xr(t.direction)):Sfe(W(),W())}function Sfe(t,e){return{origin:t,direction:e}}function KKt(t,e){return Fy(t.origin,e.origin)&&Fy(t.direction,e.direction)}function Sp(t,e){const i=fut.get();return i.origin=t,i.direction=e,i}function iU(t,e=Ko()){return JPe(t.origin,t.direction,e)}function Doe(t,e,i=Ko()){return Ne(i.origin,t),je(i.direction,e,t),i}function JPe(t,e,i=Ko()){return Ne(i.origin,t),Ne(i.direction,e),i}function dut(t,e){const i=Wt(xt.get(),Ye(xt.get(),t.direction),je(xt.get(),e,t.origin));return Ve(i,i)}function put(t,e,i){const r=Ve(t.direction,je(i,e,t.origin));return Be(i,t.origin,De(i,t.direction,r)),i}const fut=new k_(()=>Ko());function QKt(t,e,i){const r=Ve(t,e)/Ve(t,t);return De(i,t,r)}function y2(t,e){return Ve(t,e)/rt(t)}function oj(t,e){const i=Ve(t,e)/(rt(t)*rt(e));return-Ca(i)}function KPe(t,e,i){Ye(dD,t),Ye(BH,e);const r=Ve(dD,BH),n=Ca(r),s=Wt(dD,dD,BH);return Ve(s,i)<0?2*Math.PI-n:n}const dD=W(),BH=W(),QPe=co();function co(){return Xi()}const eRe=VT,mut=VT;function a5(t,e=co()){return mm(e,t)}function Noe(t,e){return Mi(t[0],t[1],t[2],e)}function gut(t){return t}function yut(t){t[0]=t[1]=t[2]=t[3]=0}function aj(t,e){return t[0]=t[1]=t[2]=0,t[3]=e,t}function Zv(t){return t[3]}function vut(t){return t}function tRe(t,e,i,r){return Mi(t,e,i,r)}function _ut(t,e,i){return t!==i&&Ne(i,t),i[3]=t[3]+e,i}function but(t,e,i){return Ce.getLogger("esri.geometry.support.sphere").error("sphere.setExtent is not yet supported"),t===i?i:a5(t,i)}function lx(t,e,i){if(e==null||!rRe(t,e,rU))return!1;let{t0:r,t1:n}=rU;if((r<0||n0)&&(r=n),r<0)return!1;if(i){const{origin:s,direction:o}=e;i[0]=s[0]+o[0]*r,i[1]=s[1]+o[1]*r,i[2]=s[2]+o[2]*r}return!0}function iRe(t,e,i){const r=Doe(e,i);if(!rRe(t,r,rU))return[];const{origin:n,direction:s}=r,{t0:o,t1:l}=rU,c=f=>{const _=W();return ao(_,n,s,f),lj(t,_,_)};return Math.abs(o-l)Math.abs(t[1])?Ie(e,0,1,0):Ie(e,1,0,0),Wt(i,t,e),Ye(e,e),Wt(e,i,t),Ye(i,i)}function pD(t,e,i,r,n,s){const o=t+(e-t)*n;return o+(i+(r-i)*n-o)*s}function Out(t,e,i,r=W()){const n=rt(t),s=rt(e),o=Ve(t,e)/(n*s);if(o<.9999999999999999){const l=Math.acos(o),c=((1-i)*n+i*s)/Math.sin(l),f=c/n*Math.sin((1-i)*l),_=c/s*Math.sin(i*l);return De(YS,t,f),De(XS,e,_),Be(r,YS,XS)}return Qr(r,t,e,i)}function tQt(t,e,i,r=W(),n=W()){const s=rt(t),o=rt(e),l=Ve(t,e)/(s*o);if(l<.9999999999999999){const c=Math.acos(l),f=Math.sin(c),_=Math.sin(i*c),x=Math.sin((1-i)*c),T=(1-i)*s+i*o;{const A=T/f,M=A/o*_;De(YS,t,A/s*x),De(XS,e,M),Be(r,YS,XS)}{const A=1/s*(-Math.cos((1-i)*c)*c*T+x*(-s+o));De(YS,t,A);const M=1/o*(Math.cos(i*c)*c*T+_*(-s+o));De(XS,e,M),Be(n,YS,XS),De(n,n,1/f)}return n}return Qr(r,t,e,i),je(n,e,t),Ye(n,n),n}function uF(t,e,i){t=Ye(YS,t),e=Ye(XS,e);const r=Ca(Ve(t,e));if(i){const n=Wt(Put,t,e);if(Ve(n,i)<0)return-r}return r}function hF(t){const e=t.length;return i=>{if(i<=t[0][0])return t[0][1];if(i>=t[e-1][0])return t[e-1][1];let r=1;for(;i>t[r][0];)r++;const n=t[r-1][0],s=t[r][0],o=(s-i)/(s-n);return o*t[r-1][1]+(1-o)*t[r][1]}}function iQt(t,e,i,r){je(Tfe,e,t),je(Efe,i,t),Wt(r,Tfe,Efe),Ye(r,r),r[3]=-Ve(t,r)}const Tfe=W(),Efe=W(),Put=W(),YS=W(),XS=W();function Fi(t=k4){return[t[0],t[1],t[2],t[3]]}function Rut(t=k4[0],e=k4[1],i=k4[2],r=k4[3]){return Foe(t,e,i,r,$oe.get())}function uj(t,e){return Foe(e[0],e[1],e[2],e[3],t)}function Foe(t,e,i,r,n=Fi()){return n[0]=t,n[1]=e,n[2]=i,n[3]=r,n}function cRe(t,e,i){return Ne(i,t),i[3]=e,i}function z_(t,e,i){const r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=Math.abs(r-1)>1e-5&&r>1e-12?1/Math.sqrt(r):1;return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=-(i[0]*t[0]+i[1]*t[1]+i[2]*t[2]),i}function jl(t,e,i,r=Fi()){const n=i[0]-e[0],s=i[1]-e[1],o=i[2]-e[2],l=t[0]-e[0],c=t[1]-e[1],f=t[2]-e[2],_=s*f-o*c,x=o*l-n*f,T=n*c-s*l,A=_*_+x*x+T*T,M=Math.abs(A-1)>1e-5&&A>1e-12?1/Math.sqrt(A):1;return r[0]=_*M,r[1]=x*M,r[2]=T*M,r[3]=-(r[0]*t[0]+r[1]*t[1]+r[2]*t[2]),r}function koe(t,e,i,r=0,n=Math.floor(i*(1/3)),s=Math.floor(i*(2/3))){if(i<3)return!1;e(qP,r);let o=n,l=!1;for(;oIe(n,e[3*s+0],e[3*s+1],e[3*s+2]),i?r-1:r)}const $ut=.99619469809,qP=W(),kE=W(),MS=W(),fD=W(),mD=W();function xQ(t,e,i){return e!==t&&uj(t,e),t[3]=-Ve(t,i),t}function SQ(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function xL(t,e,i,r){return Wt(MS,e,t),z_(i,MS,r)}function uRe(t,e,i,r){return hj(t,e,je(xt.get(),i,e),zut,r)}function bE(t,e,i){return e!=null&&hj(t,e.origin,e.direction,Uut,i)}function Lut(t,e,i){return hj(t,e.origin,e.vector,Cy.NONE,i)}function Dut(t,e,i){return hj(t,e.origin,e.vector,Cy.CLAMP,i)}const Nut=(()=>{const t=W();return(e,i,r)=>{const n=e,s=i;if(Wt(t,n,s),El(t)x&&_>T?(f[1]=(U*I-k*z)/o,f[2]=(k*F-U*M)/o):x>T?(f[0]=(k*z-U*I)/l,f[2]=(U*A-k*L)/l):(f[0]=(U*M-k*F)/c,f[1]=(k*L-U*A)/c),Ne(r.direction,t),!0}})();function zoe(t,e){return fn(t,e)>=0}function Fut(t,e){const i=Ve(t,e.ray.direction),r=-fn(t,e.ray.origin);if(r<0&&i>=0)return!1;if(i>-1e-6&&i<1e-6)return r>0;if((r<0||i<0)&&!(r<0&&i<0))return!0;const n=r/i;return i>0?ne.c0&&(e.c0=n),e.c0<=e.c1}function kut(t,e){const i=Ve(t,e.ray.direction),r=-fn(t,e.ray.origin);if(i>-1e-6&&i<1e-6)return r>0;const n=r/i;return i>0?ne.c0&&(e.c0=n),e.c0<=e.c1}function Uoe(t,e,i){const r=De(xt.get(),t,-t[3]),n=TQ(t,je(xt.get(),e,r),xt.get());return Be(i,n,r),i}function rQt(t,e,i,r){const n=t,s=xt.get(),o=xt.get();lRe(n,s,o);const l=je(xt.get(),i,e),c=y2(s,l),f=y2(o,l),_=y2(n,l);return Ie(r,c,f,_)}function TQ(t,e,i){const r=De(xt.get(),t,Ve(t,e));return je(i,e,r),i}function EQ(t,e){return Math.abs(fn(t,e))}function fn(t,e){return Ve(t,e)+t[3]}function hj(t,e,i,r,n){const s=Ve(t,i);if(s===0)return!1;let o=-(Ve(t,e)+t[3])/s;return r&Cy.CLAMP&&(o=Je(o,0,1)),!(!(r&Cy.INFINITE_MIN)&&o<0||!(r&Cy.INFINITE_MAX)&&o>1)&&(Be(n,e,De(n,i,o)),!0)}function nQt(t){return t}function Cfe(t){return Math.abs(t[2])r&&(r=o,n=s)}Yh(e,t.minVert[n]),Yh(i,t.maxVert[n])}const $p=[0,0,0];function Hut(t,e,i,r){const{data:n,size:s}=t;let o=Number.NEGATIVE_INFINITY,l=0;for(let c=0;co&&(o=x,l=c)}return Yh(r,n,l),o}const Sa=[0,0];function qut(t,e,i,r,n){Yut(t,e,Sa,n,r);const s=fRe(i,e);Sa[1]-c5<=s&&(r[0]=void 0),Sa[0]+c5>=s&&(n[0]=void 0)}const Mfe=[0,0,0],Ofe=[0,0,0],Pfe=[0,0,0],zE=[0,0,0],UE=[0,0,0],yD=[0,0,0];function z3(t,e,i,r,n,s){if(pRe(e)i[1]&&(i[1]=c,Yh(n,s,l))}}function Rfe(t,e,i){Yh(i.center,t),OS(i.halfSize,e,.5),i.quaternion[0]=0,i.quaternion[1]=0,i.quaternion[2]=0,i.quaternion[3]=1}const v1=[0,0,0],VE=[0,0,0],ZP=[0,0,0],uO=[0,0,0],hO=[0,0,0],Ife=[0,0,0];function Xut(t,e,i){Yh(v1,e),Math.abs(e[0])>Math.abs(e[1])&&Math.abs(e[0])>Math.abs(e[2])?v1[0]=0:Math.abs(e[1])>Math.abs(e[2])?v1[1]=0:v1[2]=0,pRe(v1)this.maxProj[0]&&(this.maxProj[0]=f,s[0]=c),f=o[c+1],fthis.maxProj[1]&&(this.maxProj[1]=f,s[1]=c),f=o[c+2],fthis.maxProj[2]&&(this.maxProj[2]=f,s[2]=c),f=o[c]+o[c+1]+o[c+2],fthis.maxProj[3]&&(this.maxProj[3]=f,s[3]=c),f=o[c]+o[c+1]-o[c+2],fthis.maxProj[4]&&(this.maxProj[4]=f,s[4]=c),f=o[c]-o[c+1]+o[c+2],fthis.maxProj[5]&&(this.maxProj[5]=f,s[5]=c),f=o[c]-o[c+1]-o[c+2],fthis.maxProj[6]&&(this.maxProj[6]=f,s[6]=c)}for(let c=0;c0){const r=1/Math.sqrt(i);t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r}}function pRe(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function AQ(t,e){const i=e[0]-t[0],r=e[1]-t[1],n=e[2]-t[2];return i*i+r*r+n*n}function fRe(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Kut(t,e){const i=e[0]+e[4]+e[8];if(i>0){let r=Math.sqrt(i+1);t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r}else{let r=0;e[4]>e[0]&&(r=1),e[8]>e[3*r+r]&&(r=2);const n=(r+1)%3,s=(r+2)%3;let o=Math.sqrt(e[3*r+r]-e[3*n+n]-e[3*s+s]+1);t[r]=.5*o,o=.5/o,t[3]=(e[3*n+s]-e[3*s+n])*o,t[n]=(e[3*n+r]+e[3*r+n])*o,t[s]=(e[3*s+r]+e[3*r+s])*o}}const fT=Cp(),Qc=W(),MQ=W(),Qut=as();function dj(t=[0,0,0],e=[-1,-1,-1],i=Cp()){return{center:Xr(t),halfSize:Xr(e),quaternion:MPe(i)}}function $fe(t){return dj(t.center,t.halfSize,t.quaternion)}function cQt(t,e){Ne(e.center,t.center),Ne(e.halfSize,t.halfSize),V9(e.quaternion,t.quaternion)}function mRe(t,e){return e=e||dj(),Vut(t,e),e}function U3(t,e){const i=fn(e,t.center),r=pj(t,e);return i>r?1:i<-r?-1:0}function uQt(t,e){return Qc[0]=t.center[0]-e[0],Qc[1]=t.center[1]-e[1],Qc[2]=t.center[2]-e[2],__(fT,t.quaternion),Of(Qc,Qc,fT),GO(Qc,Qc),yB(MQ,Qc,t.halfSize),vB(MQ,Qc)1e-6){const f=(r+t.halfSize[c]-n[c])/s[c],_=(-r-t.halfSize[c]-n[c])/s[c];o=Math.max(o,Math.min(f,_)),l=Math.min(l,Math.max(f,_))}else if(n[c]>t.halfSize[c]+r||n[c]<-t.halfSize[c]-r)return!1;return o<=l}(()=>{const t=new Int8Array(162);let e=0;const i=r=>{for(let n=0;n0?1+e/o:1,c=s>0?1+i/s:1,f=(c+l)/2,_=(c-l)/2;De(n.halfSize,jE,_),ao(n.halfSize,n.halfSize,t.halfSize,f),De(n.center,jE,f),ao(n.center,n.center,t.halfSize,_),Iz(hb,hb),gB(n.center,n.center,hb),Of(n.center,n.center,n.quaternion)}}else{const s=Ie(hb,0,0,1);ao(n.center,t.center,s,(i+e)/2),__(_D,t.quaternion),Of(s,s,_D),GO(s,s),ao(n.halfSize,t.halfSize,s,(i-e)/2)}return n}const hb=W(),jE=W(),GE=W(),_D=Cp();function vRe(t){return t?parseInt(t.substring(t.lastIndexOf("/")+1,t.length),10):void 0}function gQt(t){var e;if(Le("disable-feature:i3s-draco")||!t)return!1;for(const i of t)for(const r of i.geometryBuffers)if(((e=r.compressedAttributes)==null?void 0:e.encoding)==="draco")return!0;return!1}function yQt(t,e,i,r){i.traverse(e,n=>{const s=n.mbs;return(s!=null&&tht(t,s))!==ZS.OUTSIDE&&(r(n),!0)})}function vQt(t,e,i){let r=0,n=0;for(let s=0;s=0===e&&(i[n]=i[r],n++),r++;i.length=n}const JP=Ni();function bQt(t,e){if(e.rotationScale[1]===0&&e.rotationScale[2]===0&&e.rotationScale[3]===0&&e.rotationScale[5]===0&&e.rotationScale[6]===0&&e.rotationScale[7]===0)return JP[0]=(t[0]-e.position[0])/e.rotationScale[0],JP[1]=(t[1]-e.position[1])/e.rotationScale[4],JP[2]=(t[2]-e.position[0])/e.rotationScale[0],JP[3]=(t[3]-e.position[1])/e.rotationScale[4],JP}var ZS;function tht(t,e){const i=e[0],r=e[1],n=e[3],s=t[0]-i,o=i-t[2],l=t[1]-r,c=r-t[3],f=Math.max(s,o,0),_=Math.max(l,c,0),x=f*f+_*_;return x>n*n?ZS.OUTSIDE:x>0?ZS.INTERSECTS_CENTER_OUTSIDE:-Math.max(s,o,l,c)>n?ZS.INSIDE:ZS.INTERSECTS_CENTER_INSIDE}function iht(t,e,i){const r=[],n=i==null?void 0:i.missingFields,s=i==null?void 0:i.originalFields;for(const o of t){const l=o.toLowerCase();let c=!1;for(const f of e)if(l===f.name.toLowerCase()){r.push(f.name),c=!0,s&&s.push(o);break}!c&&n&&n.push(o)}return r}async function wQt(t,e,i,r,n){if(e.length===0)return[];const s=t.attributeStorageInfo;if(t.associatedLayer!=null)try{return await nht(t.associatedLayer,e,i,r)}catch(o){if(t.associatedLayer.loaded)throw o}if(s){const o=rht(e,i,n);if(o==null)throw new se("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const l=t.parsedUrl.path;return(await Promise.all(o.map(c=>sht(l,s,c.node,c.indices,r).then(f=>{for(let _=0;_=0){let x=r.get(f.node);x||(x={node:f.node,indices:[],graphics:[]},n.push(x),r.set(f.node,x)),x.indices.push(_),x.graphics.push(o);for(let T=c;T>0;T--)s[T]=s[T-1];s[0]=f;break}}}return n}async function nht(t,e,i,r){e.sort((c,f)=>c.attributes[i]-f.attributes[i]);const n=e.map(c=>c.attributes[i]),s=[],o=iht(r,t.fields,{originalFields:s}),l=await _Re(t,n,o);for(let c=0;cr){const s=L3e(e,r);return Promise.all(s.map(o=>_Re(t,o,i))).then(o=>o.flat())}const n=new F_({objectIds:e,outFields:i,orderByFields:[t.objectIdField]});return t.queryFeatures(n).then(s=>{if(s&&s.features&&s.features.length===e.length)return s.features.map(o=>o.attributes);throw new se("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")})}function sht(t,e,i,r,n){return bRe(t,e,i.resources.attributes,r,n)}async function bRe(t,e,i,r,n){const s=[];for(const c of e)if(c&&n.includes(c.name)){const f=`${t}/nodes/${i}/attributes/${c.key}/0`;s.push({url:f,storageInfo:c})}const o=await Promise.allSettled(s.map(c=>bi(c.url,{responseType:"array-buffer"}).then(f=>Jct(c.storageInfo,f.data)))),l=[];for(const c of r){const f={};for(let _=0;_{if(!l)if(l=PQ,od(bD),t.serviceObb!=null){vht(t.serviceObb,i,Dfe,e,n),gRe(Dfe,l);for(const A of l)bt(A,A,wD),nO(bD,A)}else{const A=t.mbs;if(!A)return;const M=A[3];el(A,i,zr,e),bt(zr,zr,wD),zr[2]+=n;for(let I=0;I<8;++I){const L=1&I?M:-M,F=2&I?M:-M,z=4&I?M:-M,k=l[I];Ne(k,[zr[0]+L,zr[1]+F,zr[2]+z]),nO(bD,k)}}};let f=1/0,_=-1/0;const x=A=>{if(A.type!=="replace")return;const M=A.geometry;if(!(M!=null&&M.hasZ))return;od(GH);const I=M.spatialReference||r,L=M.rings.reduce((F,z)=>z.reduce((k,U)=>(el(U,I,zr,e),bt(zr,zr,wD),nO(GH,zr),Math.min(zr[2],k)),F),1/0);c(),P9(bD,GH)&&(f=Math.min(f,L),_=Math.max(_,L))};if(s.forEach(A=>x(A)),f===1/0)return null;const T=(A,M,I)=>{bt(zr,I,o),A[M]=zr[0],A[M+1]=zr[1],A[M+2]=zr[2],M+=24,I[2]=f,bt(zr,I,o),A[M]=zr[0],A[M+1]=zr[1],A[M+2]=zr[2],M+=24,I[2]=_,bt(zr,I,o),A[M]=zr[0],A[M+1]=zr[1],A[M+2]=zr[2]};for(let A=0;A<8;++A)T(Nfe.data,3*A,l[A]);return mRe(Nfe)}function LQt(t){return t!=null&&t.halfSize[0]>=0}function DQt(t){return t[3]>=0}function NQt(t){t!=null&&(t.halfSize[0]=-1)}function FQt(t){t!=null&&(t[3]=-1)}const vd=Qe(),xv=Cp(),PQ=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],GH=Ni(),bD=Ni(),Dfe=dj(),zr=W(),Nfe={data:new Array(72),size:3,exclusive:!0,stride:3},wD=Qe();async function Eht(t,e=t.popupTemplate){var _,x;if(e==null)return[];const i=await e.getRequiredFields(t.fieldsIndex),{lastEditInfoEnabled:r}=e,{objectIdField:n,typeIdField:s,globalIdField:o,relationships:l}=t;if(i.includes("*"))return["*"];const c=r?yit(t):[],f=RB(t.fieldsIndex,[...i,...c]);return s&&f.push(s),f&&n&&((_=t.fieldsIndex)!=null&&_.has(n))&&!f.includes(n)&&f.push(n),f&&o&&((x=t.fieldsIndex)!=null&&x.has(o))&&!f.includes(o)&&f.push(o),l&&l.forEach(T=>{var M;const{keyField:A}=T;f&&A&&((M=t.fieldsIndex)!=null&&M.has(A))&&!f.includes(A)&&f.push(A)}),f}function xRe(t,e){return t.popupTemplate?t.popupTemplate:e!=null&&e.defaultPopupTemplateEnabled&&t.defaultPopupTemplate!=null?t.defaultPopupTemplate:null}function kQt(t,e){return xRe(t,{defaultPopupTemplateEnabled:e})!=null}const Cht=new Set(["3DObject","Point"]),Ffe=Iat();let _i=class extends not(cat(m5e(XB(JB(OB(fP(Gst(Xs(uE))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new it,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,i){return typeof e=="string"?{url:e,...i}:e}destroy(){this._set("renderer",null)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,i){var n,s,o;const r=(s=(n=this.getFeatureType(i==null?void 0:i.feature))==null?void 0:n.domains)==null?void 0:s[e];return r&&r.type!=="inherited"?r:((o=this.getField(e))==null?void 0:o.domain)??null}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){var e;return((e=this.associatedLayer)==null?void 0:e.types)??[]}get typeIdField(){var e;return((e=this.associatedLayer)==null?void 0:e.typeIdField)??null}get templates(){var e;return((e=this.associatedLayer)==null?void 0:e.templates)??null}get formTemplate(){var e;return((e=this.associatedLayer)==null?void 0:e.formTemplate)??null}get fieldsIndex(){return new Zse(this.fields)}readNodePages(e,i,r){return i.layerType==="Point"&&(e=i.pointNodePages),e==null||typeof e!="object"?null:AS.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){var e;return this._capabilitiesFromAssociatedFeatureLayer((e=this.associatedLayer)==null?void 0:e.effectiveCapabilities)}get effectiveEditingEnabled(){return this.associatedLayer!=null&&Pat(this.associatedLayer)}get geometryType(){return Aht[this.profile]||"mesh"}set renderer(e){upe(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return e!=null&&typeof e=="object"||(e={}),e.color==null&&(e.color=!1),e}get capabilities(){var e;return this._capabilitiesFromAssociatedFeatureLayer((e=this.associatedLayer)==null?void 0:e.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){var H;e=e??fat;const{query:i,queryRelated:r,editing:{supportsGlobalId:n,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:l,supportsReturnServiceEditsInSourceSpatialReference:c},data:{supportsZ:f,supportsM:_,isVersioned:x,supportsAttachment:T},operations:{supportsEditing:A,supportsAdd:M,supportsUpdate:I,supportsDelete:L,supportsQuery:F,supportsQueryAttachments:z,supportsAsyncConvert3D:k}}=e,U=e.operations.supportsChangeTracking,j=!!((H=this.associatedLayer)!=null&&H.infoFor3D)&&Upe();return{query:i,queryRelated:r,editing:{supportsGlobalId:n,supportsReturnServiceEditsInSourceSpatialReference:c,supportsRollbackOnFailure:s,supportsGeometryUpdate:j&&l,supportsUploadWithItemId:o},data:{supportsAttachment:T,supportsZ:f,supportsM:_,isVersioned:x},operations:{supportsQuery:F,supportsQueryAttachments:z,supportsEditing:A&&U,supportsAdd:j&&M&&U,supportsDelete:j&&L&&U,supportsUpdate:I&&U,supportsAsyncConvert3D:k}}}get editingEnabled(){var e;return this._isOverridden("editingEnabled")?this._get("editingEnabled"):((e=this.associatedLayer)==null?void 0:e.editingEnabled)??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){var e;return((e=this.associatedLayer)==null?void 0:e.infoFor3D)??null}get relationships(){var e;return(e=this.associatedLayer)==null?void 0:e.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,i){return!e&&i.fields&&i.fields.some(r=>(r.type==="esriFieldTypeOID"&&(e=r.name),!!e)),e||void 0}readGlobalIdField(e,i){return!e&&i.fields&&i.fields.some(r=>(r.type==="esriFieldTypeGlobalID"&&(e=r.name),!!e)),e||void 0}get displayField(){var e;return((e=this.associatedLayer)==null?void 0:e.displayField)??null}readProfile(e,i){const r=i.store.profile;return r!=null&&kfe[r]?kfe[r]:(Ce.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const i=e!=null?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(zo),await this._fetchService(i),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,i),this._setAssociatedFeatureLayer(i),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await Alt(this,{origin:"service"},i),upe(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){this.filter!=null&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){Ce.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new F_;return this.geometryType!=="mesh"&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,i){return this._getAssociatedLayerForQuery().then(r=>r.queryExtent(e||this.createQuery(),i))}queryFeatureCount(e,i){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatureCount(e||this.createQuery(),i))}queryFeatures(e,i){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatures(e||this.createQuery(),i)).then(r=>{if(r!=null&&r.features)for(const n of r.features)n.layer=this,n.sourceLayer=this;return r})}async queryRelatedFeatures(e,i){if(await this.load(),!this.associatedLayer)throw new se("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,i)}async queryRelatedFeaturesCount(e,i){if(await this.load(),!this.associatedLayer)throw new se("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,i)}async queryCachedAttributes(e,i){const r=hit(this.fieldsIndex,await Eht(this,xRe(this)));return bRe(this.parsedUrl.path,this.attributeStorageInfo??[],e,i,r)}async queryCachedFeature(e,i){const r=await this.queryCachedAttributes(e,[i]);if(!r||r.length===0)throw new se("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const n=new Ml;return n.attributes=r[0],n.layer=this,n.sourceLayer=this,n}queryObjectIds(e,i){return this._getAssociatedLayerForQuery().then(r=>r.queryObjectIds(e||this.createQuery(),i))}queryAttachments(e,i){return this._getAssociatedLayerForQuery().then(r=>r.queryAttachments(e,i))}getFieldUsageInfo(e){const i={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||i:(Ce.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),i)}createPopupTemplate(e){return Llt(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e!=null&&e.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new se("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new se("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return this.statisticsInfo!=null&&this.statisticsInfo.some(i=>i.name===e)}async queryCachedStatistics(e,i){if(await this.load(i),!this.statisticsInfo)throw new se("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const r=this.fieldsIndex.get(e);if(!r)throw new se("scenelayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const n of this.statisticsInfo)if(n.name===r.name){const s=s0(this.parsedUrl.path,n.href);return bi(s,{query:{f:"json",token:this.apiKey},responseType:"json",signal:i?i.signal:null}).then(o=>o.data)}throw new se("scenelayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,i){return this._debouncedSaveOperations(n5.SAVE_AS,{...i,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(n5.SAVE,e)}async applyEdits(e,i){const{applyEdits:r}=await we(()=>import("./editingSupport-EiPa9PKq.js"),__vite__mapDeps([]));let n=i;await this.load();const s=this.associatedLayer;if(!s)throw new se(`${this.type}-layer:not-editable`,"Service is not editable");await s.load();const{globalIdField:o}=s,l=!!s.infoFor3D,c=(n==null?void 0:n.globalIdUsed)??!0;if(l&&o==null)throw new se(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(l&&!c)throw new se(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return qpe(s.url)&&l&&e.deleteFeatures!=null&&o!=null&&(n={...n,globalIdToObjectId:await oPe(s,e.deleteFeatures,o)}),r(this,s.source,e,n)}async uploadAssets(e,i){if(await this.load(),this.associatedLayer==null)throw new se(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,i)}on(e,i){return super.on(e,i)}validateLayer(e){if(e.layerType&&!Cht.has(e.layerType))throw new se("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new se("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new se("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function i(r,n){let s=!1,o=!1;if(r==null)s=!0,o=!0;else{const l=n&&n.isGeographic;switch(r){case"east-north-up":case"earth-centered":s=!0,o=l;break;case"vertex-reference-frame":s=!0,o=!l;break;default:s=!1}}if(!s)throw new se("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!o)throw new se("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}i(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if(this.profile==="points")e.push("Point");else{if(this.profile!=="mesh-pyramids")throw new se("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){var e,i;if(this._fieldUsageInfo={},this.fields)for(const r of this.fields){const n=!(!this.attributeStorageInfo||!this.attributeStorageInfo.some(l=>l.name===r.name)),s=!!((i=(e=this.associatedLayer)==null?void 0:e.fields)!=null&&i.some(l=>l&&r.name===l.name)),o={supportsLabelingInfo:n,supportsRenderer:n,supportsPopupTemplate:n||s,supportsLayerQuery:s};this._fieldUsageInfo[r.name]=o}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){var i;if(!((i=this.associatedLayer)!=null&&i.fields))return;let e=null;for(const r of this.associatedLayer.fields){const n=this.getField(r.name);n?(!n.domain&&r.domain&&(n.domain=r.domain.clone()),n.editable=r.editable,n.nullable=r.nullable,n.length=r.length):(e||(e=this.fields?this.fields.slice():[]),e.push(r.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],i=Zl(this);for(let r=0;rthis.popupEnabled&&this.popupTemplate!=null);const e=`this SceneLayer: ${this.title}`;this.attributeStorageInfo==null?Ce.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):Ce.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;this.profile==="mesh-pyramids"&&pfe(Ce.getLogger(this),Rlt("Mesh scene layers","relative-to-scene",e)),pfe(Ce.getLogger(this),Ilt("Scene layers",e))}};y([w({types:{key:"type",base:c$,typeMap:{selection:Rat}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],_i.prototype,"featureReduction",void 0),y([w({type:[ew],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],_i.prototype,"rangeInfos",void 0),y([w({json:{read:!1}})],_i.prototype,"associatedLayer",void 0),y([w({type:["show","hide"]})],_i.prototype,"listMode",void 0),y([w({type:["ArcGISSceneServiceLayer"]})],_i.prototype,"operationalLayerType",void 0),y([w({json:{read:!1},readOnly:!0})],_i.prototype,"type",void 0),y([w({...Ffe.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],_i.prototype,"fields",void 0),y([w()],_i.prototype,"types",null),y([w()],_i.prototype,"typeIdField",null),y([w()],_i.prototype,"templates",null),y([w()],_i.prototype,"formTemplate",null),y([w({readOnly:!0,clonable:!1})],_i.prototype,"fieldsIndex",null),y([w({type:clt,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],_i.prototype,"floorInfo",void 0),y([w(Ffe.outFields)],_i.prototype,"outFields",void 0),y([w({type:AS,readOnly:!0,json:{read:!1}})],_i.prototype,"nodePages",void 0),y([$t("service","nodePages",["nodePages","pointNodePages"])],_i.prototype,"readNodePages",null),y([w({type:[Hp],readOnly:!0})],_i.prototype,"materialDefinitions",void 0),y([w({type:[D4],readOnly:!0})],_i.prototype,"textureSetDefinitions",void 0),y([w({type:[F4],readOnly:!0})],_i.prototype,"geometryDefinitions",void 0),y([w({readOnly:!0})],_i.prototype,"serviceUpdateTimeStamp",void 0),y([w({readOnly:!0})],_i.prototype,"attributeStorageInfo",void 0),y([w({readOnly:!0})],_i.prototype,"statisticsInfo",void 0),y([w({type:it.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],_i.prototype,"excludeObjectIds",void 0),y([w({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],_i.prototype,"definitionExpression",void 0),y([w({type:Clt,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],_i.prototype,"filter",void 0),y([w({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],_i.prototype,"path",void 0),y([w(yot)],_i.prototype,"elevationInfo",null),y([w({readOnly:!0,json:{read:!1}})],_i.prototype,"effectiveCapabilities",null),y([w({readOnly:!0})],_i.prototype,"effectiveEditingEnabled",null),y([w({type:String})],_i.prototype,"geometryType",null),y([w(got)],_i.prototype,"labelsVisible",void 0),y([w({type:[hPe],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:dfe},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:dfe},write:!0}})],_i.prototype,"labelingInfo",void 0),y([w(b5e)],_i.prototype,"legendEnabled",void 0),y([w({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(t,e){var r,n;if(typeof t=="number"&&t>=0&&t<=1)return t;const i=(n=(r=e.layerDefinition)==null?void 0:r.drawingInfo)==null?void 0:n.transparency;return i!==void 0?jT(i):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],_i.prototype,"opacity",void 0),y([w({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],_i.prototype,"priority",void 0),y([w({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],_i.prototype,"semantic",void 0),y([w({types:$st,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],_i.prototype,"renderer",null),y([w({json:{read:!1}})],_i.prototype,"cachedDrawingInfo",void 0),y([$t("service","cachedDrawingInfo")],_i.prototype,"readCachedDrawingInfo",null),y([w({readOnly:!0,json:{read:!1}})],_i.prototype,"capabilities",null),y([w({type:Boolean,json:{read:!1}})],_i.prototype,"editingEnabled",null),y([w({readOnly:!0,json:{write:!1,read:!1}})],_i.prototype,"infoFor3D",null),y([w({readOnly:!0,json:{write:!1,read:!1}})],_i.prototype,"relationships",null),y([w(mot)],_i.prototype,"popupEnabled",void 0),y([w({type:hE,json:{name:"popupInfo",write:!0}})],_i.prototype,"popupTemplate",void 0),y([w({readOnly:!0,json:{read:!1}})],_i.prototype,"defaultPopupTemplate",null),y([w({type:String,json:{read:!1}})],_i.prototype,"objectIdField",void 0),y([$t("service","objectIdField",["objectIdField","fields"])],_i.prototype,"readObjectIdField",null),y([w({type:String,json:{read:!1}})],_i.prototype,"globalIdField",void 0),y([$t("service","globalIdField",["globalIdField","fields"])],_i.prototype,"readGlobalIdField",null),y([w({readOnly:!0,type:String,json:{read:!1}})],_i.prototype,"displayField",null),y([w({type:String,json:{read:!1}})],_i.prototype,"profile",void 0),y([$t("service","profile",["store.profile"])],_i.prototype,"readProfile",null),y([w({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],_i.prototype,"normalReferenceFrame",void 0),y([w(fot)],_i.prototype,"screenSizePerspectiveEnabled",void 0),y([w({json:{read:!1,origins:{service:{read:!0}}}})],_i.prototype,"serviceItemId",void 0),_i=y([Z("esri.layers.SceneLayer")],_i);const kfe={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},Aht={"mesh-pyramids":"mesh",points:"point",lines:"polyline",polygons:"polygon"},SRe=_i,Mht=Object.freeze(Object.defineProperty({__proto__:null,default:SRe},Symbol.toStringTag,{value:"Module"}));let AA=class extends it{constructor(e){super(e),this.getCollections=null}initialize(){this.addHandles(wSe(()=>this._refresh()))}destroy(){this.getCollections=null}_refresh(){const e=this.getCollections!=null?this.getCollections():null;if(e==null)return void this.removeAll();let i=0;for(const r of e)r!=null&&(i=this._processCollection(i,r));this.splice(i,this.length)}_createNewInstance(e){return new it(e)}_processCollection(e,i){if(!i)return e;const r=this.itemFilterFunction??(n=>!!n);for(const n of i)if(n){if(r(n)){const s=this.indexOf(n,e);s>=0?s!==e&&this.reorder(n,e):this.add(n,e),++e}if(this.getChildrenFunction){const s=this.getChildrenFunction(n);if(Array.isArray(s))for(const o of s)e=this._processCollection(e,o);else e=this._processCollection(e,s)}}return e}};y([w()],AA.prototype,"getCollections",void 0),y([w()],AA.prototype,"getChildrenFunction",void 0),y([w()],AA.prototype,"itemFilterFunction",void 0),AA=y([Z("esri.core.CollectionFlattener")],AA);const GT=AA,Voe=96;function zfe(t,e){const i=e||t.extent,r=t.width,n=ws(i==null?void 0:i.spatialReference);return i&&r?i.width/r*n*Wne*Voe:0}function TRe(t,e){return t/(ws(e)*Wne*Voe)}function Oht(t){return t/(Wne*Voe)}function Pht(t,e){const i=t.extent,r=t.width-(t.padding?t.padding.left+t.padding.right:0),n=TRe(e,i.spatialReference);return i.clone().expand(n*r/i.width)}function Rht(t,e,i){return Iht(t,e)&&$ht(t,i)}function Iht(t,e){return e===0||Ey(t,e)||te}const l2=new it,h$=new WeakMap;function Lht(t){Nht(t)&&l2.push(new WeakRef(t))}function Dht(t){const e=l2.find(i=>i.deref()===t);e&&l2.remove(e)}function Nht(t){return t!=null&&typeof t=="object"&&"refreshInterval"in t&&"refresh"in t}function ERe(t,e){return Number.isFinite(t)&&Number.isFinite(e)?e<=0?t:ERe(e,t%e):0}let HH=0,xD=0;function Fht(){const t=Date.now();let e=!1;for(const i of l2){const r=i.deref();r?r.refreshInterval&&t-(h$.get(r)??0)+5>=6e4*r.refreshInterval&&(h$.set(r,t),r.refresh(t)):e=!0}if(e)for(let i=l2.length-1;i>=0;i--)l2.at(i).deref()||l2.removeAt(i)}wSe(()=>{const t=Date.now();let e=0;for(const i of l2){const r=i.deref();r&&(e=ERe(Math.round(6e4*r.refreshInterval),e),r.refreshInterval?h$.get(r)||h$.set(r,t):h$.delete(r))}if(e!==xD){if(xD=e,clearInterval(HH),xD===0)return void(HH=0);HH=setInterval(Fht,xD)}});function kht(t){return t!=null&&typeof t=="object"&&"refreshTimestamp"in t&&"refresh"in t}const Ufe=.1,zht=t=>{let e=class extends t{constructor(...i){super(...i),this.refreshInterval=0,this.refreshTimestamp=0,this._debounceHasDataChanged=X5(()=>this.hasDataChanged()),this.when().then(()=>{this.destroyed||Lht(this)},()=>{})}destroy(){Dht(this)}castRefreshInterval(i){return i>=Ufe?i:i<=0?0:Ufe}get refreshParameters(){return{_ts:this.refreshTimestamp||null}}refresh(i=Date.now()){$m(this._debounceHasDataChanged()).then(r=>{r&&this._set("refreshTimestamp",i),this.emit("refresh",{dataChanged:r})},r=>{Ce.getLogger(this).error(r),this.emit("refresh",{dataChanged:!1,error:r})})}async hasDataChanged(){return!0}get test(){const i=this;return{set refreshInterval(r){i._set("refreshInterval",r)}}}};return y([w({type:Number,json:{write:!0,origins:{"web-scene":{write:{enabled:!0,layerContainerTypes:Wf}}}}})],e.prototype,"refreshInterval",void 0),y([Ci("refreshInterval")],e.prototype,"castRefreshInterval",null),y([w({readOnly:!0})],e.prototype,"refreshTimestamp",void 0),y([w({readOnly:!0})],e.prototype,"refreshParameters",null),e=y([Z("esri.layers.mixins.RefreshableLayer")],e),e},CRe=fu()({esriTimeUnitsMilliseconds:"milliseconds",esriTimeUnitsSeconds:"seconds",esriTimeUnitsMinutes:"minutes",esriTimeUnitsHours:"hours",esriTimeUnitsDays:"days",esriTimeUnitsWeeks:"weeks",esriTimeUnitsMonths:"months",esriTimeUnitsYears:"years",esriTimeUnitsDecades:"decades",esriTimeUnitsCenturies:"centuries",esriTimeUnitsUnknown:void 0});let z4=class extends Xs(Ue){constructor(e){super(e),this.unit="milliseconds",this.value=0}toMilliseconds(){return Gs(this.value,this.unit,"milliseconds")}};y([Vt(CRe,{nonNullable:!0})],z4.prototype,"unit",void 0),y([w({type:Number,json:{write:!0},nonNullable:!0})],z4.prototype,"value",void 0),z4=y([Z("esri.TimeInterval")],z4);const nU=z4;function Vfe(t,e){return nU.fromJSON({value:t,unit:e})}let qc=class extends Xs(Ue){constructor(e){super(e),this.cumulative=!1,this.endField=null,this.fullTimeExtent=null,this.hasLiveData=!1,this.interval=null,this.startField=null,this.timeZone=null,this.trackIdField=null,this.useTime=!0}readFullTimeExtent(e,i){if(!i.timeExtent||!Array.isArray(i.timeExtent)||i.timeExtent.length!==2)return null;const r=new Date(i.timeExtent[0]),n=new Date(i.timeExtent[1]);return new D_({start:r,end:n})}writeFullTimeExtent(e,i){(e==null?void 0:e.start)!=null&&e.end!=null?i.timeExtent=[e.start.getTime(),e.end.getTime()]:i.timeExtent=null}readInterval(e,i){return i.timeInterval&&i.timeIntervalUnits?Vfe(i.timeInterval,i.timeIntervalUnits):i.defaultTimeInterval&&i.defaultTimeIntervalUnits?Vfe(i.defaultTimeInterval,i.defaultTimeIntervalUnits):null}writeInterval(e,i){i.timeInterval=(e==null?void 0:e.toJSON().value)??null,i.timeIntervalUnits=(e==null?void 0:e.toJSON().unit)??null}};y([w({type:Boolean,json:{name:"exportOptions.timeDataCumulative",write:!0}})],qc.prototype,"cumulative",void 0),y([w({type:String,json:{name:"endTimeField",write:{enabled:!0,allowNull:!0}}})],qc.prototype,"endField",void 0),y([w({type:D_,json:{write:{enabled:!0,allowNull:!0}}})],qc.prototype,"fullTimeExtent",void 0),y([$t("fullTimeExtent",["timeExtent"])],qc.prototype,"readFullTimeExtent",null),y([Pt("fullTimeExtent")],qc.prototype,"writeFullTimeExtent",null),y([w({type:Boolean,json:{write:!0}})],qc.prototype,"hasLiveData",void 0),y([w({type:nU,json:{write:{enabled:!0,allowNull:!0}}})],qc.prototype,"interval",void 0),y([$t("interval",["timeInterval","timeIntervalUnits","defaultTimeInterval","defaultTimeIntervalUnits"])],qc.prototype,"readInterval",null),y([Pt("interval")],qc.prototype,"writeInterval",null),y([w({type:String,json:{name:"startTimeField",write:{enabled:!0,allowNull:!0}}})],qc.prototype,"startField",void 0),y([w(BWe("timeReference",!0))],qc.prototype,"timeZone",void 0),y([w({type:String,json:{write:{enabled:!0,allowNull:!0}}})],qc.prototype,"trackIdField",void 0),y([w({type:Boolean,json:{name:"exportOptions.useTime",write:!0}})],qc.prototype,"useTime",void 0),qc=y([Z("esri.layers.support.TimeInfo")],qc);const Uht=qc,Vht=t=>{let e=class extends t{constructor(){super(...arguments),this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0}readOffset(i,r){const n=r.timeInfo.exportOptions;if(!n)return null;const s=n.timeOffset,o=CRe.fromJSON(n.timeOffsetUnits);return s&&o?new nU({value:s,unit:o}):null}set timeInfo(i){uit(i,this.fieldsIndex),this._set("timeInfo",i)}};return y([w({type:D_,json:{write:!1}})],e.prototype,"timeExtent",void 0),y([w({type:nU})],e.prototype,"timeOffset",void 0),y([$t("service","timeOffset",["timeInfo.exportOptions"])],e.prototype,"readOffset",null),y([w({value:null,type:Uht,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],e.prototype,"timeInfo",null),y([w({type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation"},origins:{"web-scene":{read:!1,write:!1}}}})],e.prototype,"useViewTime",void 0),e=y([Z("esri.layers.mixins.TemporalLayer")],e),e},Bht=[[3819,3819],[3821,3824],[3889,3889],[3906,3906],[4001,4025],[4027,4036],[4039,4047],[4052,4055],[4074,4075],[4080,4081],[4120,4176],[4178,4185],[4188,4216],[4218,4289],[4291,4304],[4306,4319],[4322,4326],[4463,4463],[4470,4470],[4475,4475],[4483,4483],[4490,4490],[4555,4558],[4600,4646],[4657,4765],[4801,4811],[4813,4821],[4823,4824],[4901,4904],[5013,5013],[5132,5132],[5228,5229],[5233,5233],[5246,5246],[5252,5252],[5264,5264],[5324,5340],[5354,5354],[5360,5360],[5365,5365],[5370,5373],[5381,5381],[5393,5393],[5451,5451],[5464,5464],[5467,5467],[5489,5489],[5524,5524],[5527,5527],[5546,5546],[2044,2045],[2081,2083],[2085,2086],[2093,2093],[2096,2098],[2105,2132],[2169,2170],[2176,2180],[2193,2193],[2200,2200],[2206,2212],[2319,2319],[2320,2462],[2523,2549],[2551,2735],[2738,2758],[2935,2941],[2953,2953],[3006,3030],[3034,3035],[3038,3051],[3058,3059],[3068,3068],[3114,3118],[3126,3138],[3150,3151],[3300,3301],[3328,3335],[3346,3346],[3350,3352],[3366,3366],[3389,3390],[3416,3417],[3833,3841],[3844,3850],[3854,3854],[3873,3885],[3907,3910],[4026,4026],[4037,4038],[4417,4417],[4434,4434],[4491,4554],[4839,4839],[5048,5048],[5105,5130],[5253,5259],[5269,5275],[5343,5349],[5479,5482],[5518,5519],[5520,5520],[20004,20032],[20064,20092],[21413,21423],[21473,21483],[21896,21899],[22171,22177],[22181,22187],[22191,22197],[25884,25884],[27205,27232],[27391,27398],[27492,27492],[28402,28432],[28462,28492],[30161,30179],[30800,30800],[31251,31259],[31275,31279],[31281,31290],[31466,31700]];function RQ(t){return t!=null&&Bht.some(([e,i])=>t>=e&&t<=i)}const jht={visible:"visibleSublayers"};let Sv=class extends ze{constructor(e){super(e),this.scale=0}set layer(e){this._get("layer")!==e&&(this._set("layer",e),this.removeHandles("layer"),e&&this.addHandles([e.sublayers.on("change",()=>this.notifyChange("visibleSublayers")),e.on("wms-sublayer-update",i=>this.notifyChange(jht[i.propertyName]))],"layer"))}get layers(){return this.visibleSublayers.filter(({name:e})=>e).map(({name:e})=>e).join()}get version(){this.commitProperty("layers");const e=this.layer;return e&&e.commitProperty("imageTransparency"),(this._get("version")||0)+1}get visibleSublayers(){const{layer:e,scale:i}=this,r=e==null?void 0:e.sublayers,n=[],s=o=>{const{minScale:l,maxScale:c,sublayers:f,visible:_}=o;_&&(i===0||(l===0||i<=l)&&(c===0||i>=c))&&(f?f.forEach(s):n.push(o))};return r==null||r.forEach(s),n}toJSON(){const{layer:e,layers:i}=this,{imageFormat:r,imageTransparency:n,version:s}=e;return{format:r,request:"GetMap",service:"WMS",styles:"",transparent:n?"TRUE":"FALSE",version:s,layers:i}}};y([w()],Sv.prototype,"layer",null),y([w({readOnly:!0})],Sv.prototype,"layers",null),y([w({type:Number})],Sv.prototype,"scale",void 0),y([w({readOnly:!0})],Sv.prototype,"version",null),y([w({readOnly:!0})],Sv.prototype,"visibleSublayers",null),Sv=y([Z("esri.layers.support.ExportWMSImageParameters")],Sv);async function Ght(t,e,i){let r;try{r=await createImageBitmap(t)}catch(n){throw new se("request:server",`Unable to load ${e}`,{url:e,error:n})}return St(i),r}async function GQt(t,e,i,r,n){let s;try{s=await createImageBitmap(t)}catch(o){throw new se("request:server",`Unable to load tile ${e}/${i}/${r}`,{error:o,level:e,row:i,col:r})}return St(n),s}var fF;let Hht=0,Io=fF=class extends I_(Yz){constructor(t){super(t),this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.legendUrl=null,this.legendEnabled=!0,this.layer=null,this.maxScale=0,this.minScale=0,this.name=null,this.parent=null,this.popupEnabled=!1,this.queryable=!1,this.sublayers=null,this.spatialReferences=null,this.title=null,this.addHandles([Jr(()=>this.sublayers,"after-add",({item:e})=>{e.parent=this,e.layer=this.layer},Li),Jr(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=e.parent=null},Li),_e(()=>this.sublayers,(e,i)=>{if(i)for(const r of i)r.layer=r.parent=null;if(e)for(const r of e)r.parent=this,r.layer=this.layer},Li),_e(()=>this.layer,e=>{if(this.sublayers)for(const i of this.sublayers)i.layer=e},Li)])}get id(){return this._get("id")??Hht++}set id(t){this._set("id",t)}readLegendUrl(t,e){return e.legendUrl??e.legendURL??null}get effectiveScaleRange(){const{minScale:t,maxScale:e}=this;return{minScale:t,maxScale:e}}castSublayers(t){return $s(it.ofType(fF),t)}set visible(t){this._setAndNotifyLayer("visible",t)}clone(){var e,i,r;const t=new fF;return this.hasOwnProperty("description")&&(t.description=this.description),this.hasOwnProperty("fullExtent")&&(t.fullExtent=this.fullExtent.clone()),this.hasOwnProperty("fullExtents")&&(t.fullExtents=((e=this.fullExtents)==null?void 0:e.map(n=>n.clone()))??null),this.hasOwnProperty("legendUrl")&&(t.legendUrl=this.legendUrl),this.hasOwnProperty("legendEnabled")&&(t.legendEnabled=this.legendEnabled),this.hasOwnProperty("layer")&&(t.layer=this.layer),this.hasOwnProperty("name")&&(t.name=this.name),this.hasOwnProperty("parent")&&(t.parent=this.parent),this.hasOwnProperty("queryable")&&(t.queryable=this.queryable),this.hasOwnProperty("sublayers")&&(t.sublayers=(i=this.sublayers)==null?void 0:i.map(n=>n.clone())),this.hasOwnProperty("spatialReferences")&&(t.spatialReferences=(r=this.spatialReferences)==null?void 0:r.map(n=>n)),this.hasOwnProperty("visible")&&(t.visible=this.visible),this.hasOwnProperty("title")&&(t.title=this.title),t}_setAndNotifyLayer(t,e){const i=this.layer;this._get(t)!==e&&(this._set(t,e),i&&i.emit("wms-sublayer-update",{propertyName:t,id:this.id}))}};y([w()],Io.prototype,"description",void 0),y([w({readOnly:!0})],Io.prototype,"dimensions",void 0),y([w({type:Vi,json:{name:"extent"}})],Io.prototype,"fullExtent",void 0),y([w()],Io.prototype,"fullExtents",void 0),y([w({type:Number,json:{write:{enabled:!1,overridePolicy:()=>({ignoreOrigin:!0,enabled:!0})}}})],Io.prototype,"id",null),y([w({type:String,json:{name:"legendUrl",write:{ignoreOrigin:!0}}})],Io.prototype,"legendUrl",void 0),y([$t("legendUrl",["legendUrl","legendURL"])],Io.prototype,"readLegendUrl",null),y([w({type:Boolean,json:{name:"showLegend",origins:{"web-map":{read:!1,write:!1},"web-scene":{read:!1,write:!1}}}})],Io.prototype,"legendEnabled",void 0),y([w()],Io.prototype,"layer",void 0),y([w()],Io.prototype,"maxScale",void 0),y([w()],Io.prototype,"minScale",void 0),y([w({readOnly:!0})],Io.prototype,"effectiveScaleRange",null),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],Io.prototype,"name",void 0),y([w()],Io.prototype,"parent",void 0),y([w({type:Boolean,json:{read:{source:"showPopup"},write:{ignoreOrigin:!0,target:"showPopup"}}})],Io.prototype,"popupEnabled",void 0),y([w({type:Boolean,json:{write:{ignoreOrigin:!0}}})],Io.prototype,"queryable",void 0),y([w()],Io.prototype,"sublayers",void 0),y([Ci("sublayers")],Io.prototype,"castSublayers",null),y([w({type:[Number],json:{read:{source:"spatialReferences"}}})],Io.prototype,"spatialReferences",void 0),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],Io.prototype,"title",void 0),y([w({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"}}})],Io.prototype,"visible",null),Io=fF=y([Z("esri.layers.support.WMSSublayer")],Io);const IQ=Io,Bfe={84:4326,83:4269,27:4267};function qht(t){if(!t)return null;const e={idCounter:-1};typeof t=="string"&&(t=new DOMParser().parseFromString(t,"text/xml"));const i=t.documentElement;if(i.nodeName==="ServiceExceptionReport"){const de=Array.prototype.slice.call(i.childNodes).map(ve=>ve.textContent).join(`\r -`);throw new se("wmslayer:wms-capabilities-xml-is-not-valid","The server returned errors when the WMS capabilities were requested.",de)}const r=lu("Capability",i),n=lu("Service",i),s=r&&lu("Request",r);if(!r||!n||!s)return null;const o=lu("Layer",r);if(!o)return null;const l=i.nodeName==="WMS_Capabilities"||i.nodeName==="WMT_MS_Capabilities"?i.getAttribute("version"):"1.3.0",c=oy("Title",n,"")||oy("Name",n,""),f=oy("AccessConstraints",n,""),_=/^none$/i.test(f)?"":f,x=oy("Abstract",n,""),T=parseInt(oy("MaxWidth",n,"5000"),10),A=parseInt(oy("MaxHeight",n,"5000"),10),M=Gfe(s,"GetMap"),I=jfe(s,"GetMap"),L=U4(o,l,e);if(!L)return null;let F,z=0;const k=Array.prototype.slice.call(r.childNodes),U=L.sublayers??[],j=de=>{de!=null&&U.push(de)};k.forEach(de=>{de.nodeName==="Layer"&&(z===0?F=de:(z===1&&L.name&&(L.name="",j(U4(F,l,e))),j(U4(de,l,e))),z++)});let H=L.sublayers,Y=L.extent;const Q=L.fullExtents??[];if(H||(H=[]),H.length===0&&H.push(L),!Y){const de=new Vi(H[0].extent);L.extent=de.toJSON(),Y=L.extent}const ne=L.spatialReferences.length>0?L.spatialReferences:ARe(L),re=jfe(s,"GetFeatureInfo"),he=re?Gfe(s,"GetFeatureInfo"):null,ce=MRe(H),be=L.minScale||0,ye=L.maxScale||0,pe=L.dimensions??[],Ee=ce.reduce((de,ve)=>de.concat(ve.dimensions??[]),[]),te=pe.concat(Ee).filter(PRe);let le=null;if(te.length){const de=te.map(ve=>{const{extent:Se}=ve;return Xht(Se)?Se.map(Ae=>Ae.getTime()):Se==null?void 0:Se.map(Ae=>[Ae.min.getTime(),Ae.max.getTime()])}).flat(2).filter(ys);le={startTimeField:null,endTimeField:null,trackIdField:void 0,timeExtent:[Math.min(...de),Math.max(...de)]}}return{copyright:_,description:x,dimensions:pe,extent:Y,fullExtents:Q,featureInfoFormats:he,featureInfoUrl:re,mapUrl:I,maxWidth:T,maxHeight:A,maxScale:ye,minScale:be,layers:ce,spatialReferences:ne,supportedImageFormatTypes:M,timeInfo:le,title:c,version:l}}function Wht(t){const e=t.filter(i=>i.popupEnabled&&i.name&&i.queryable);return e.length?e.map(({name:i})=>i).join():null}function ARe(t){if(t.spatialReferences.length>0)return t.spatialReferences;if(t.sublayers)for(const e of t.sublayers){const i=ARe(e);if(i.length>0)return i}return[]}function MRe(t){var i;let e=[];for(const r of t)e.push(r),(i=r.sublayers)!=null&&i.length&&(e=e.concat(MRe(r.sublayers)),delete r.sublayers);return e}function mF(t,e,i){return e.getAttribute(t)??i}function Yht(t,e,i,r){const n=lu(t,i);return n?mF(e,n,r):r}function lu(t,e){for(let i=0;in).filter(ys);const r=[];for(const n of i)if(n.getAttribute("name")===e){const s=gF("Format",n);for(const{textContent:o}of s)o!=null&&r.push(o)}return r}function Hfe(t,e,i){const r=lu(e,t);if(!r)return i;const{textContent:n}=r;if(n==null||n==="")return i;const s=Number(n);return isNaN(s)?i:s}function U4(t,e,i){if(!t)return null;const r={id:i.idCounter++,fullExtents:[],parentLayerId:null,queryable:t.getAttribute("queryable")==="1",spatialReferences:[],sublayers:null},n=lu("LatLonBoundingBox",t),s=lu("EX_GeographicBoundingBox",t);let o=null;n&&(o=KP(n,4326)),s&&(o=new Vi(0,0,0,0,new at({wkid:4326})),o.xmin=parseFloat(oy("westBoundLongitude",s,"0")),o.ymin=parseFloat(oy("southBoundLatitude",s,"0")),o.xmax=parseFloat(oy("eastBoundLongitude",s,"0")),o.ymax=parseFloat(oy("northBoundLatitude",s,"0"))),n||s||(o=new Vi(-180,-90,180,90,new at({wkid:4326}))),r.minScale=Hfe(t,"MaxScaleDenominator",0),r.maxScale=Hfe(t,"MinScaleDenominator",0);const l=["1.0.0","1.1.0","1.1.1"].includes(e)?"SRS":"CRS";return Array.prototype.slice.call(t.childNodes).forEach(c=>{var f;if(c.nodeName==="Name")r.name=c.textContent||"";else if(c.nodeName==="Title")r.title=c.textContent||"";else if(c.nodeName==="Abstract")r.description=c.textContent||"";else if(c.nodeName==="BoundingBox"){const _=c.getAttribute(l);if(_&&_.indexOf("EPSG:")===0){const T=parseInt(_.substring(5),10);T===0||isNaN(T)||o||(o=e==="1.3.0"?KP(c,T,RQ(T)):KP(c,T))}const x=_&&_.indexOf(":");if(x&&x>-1){let T=parseInt(_.substring(x+1,_.length),10);T===0||isNaN(T)||(T=Bfe[T]??T);const A=e==="1.3.0"?KP(c,T,RQ(T)):KP(c,T);A&&r.fullExtents&&r.fullExtents.push(A)}}else if(c.nodeName===l)(((f=c.textContent)==null?void 0:f.split(" "))??[]).forEach(_=>{const x=_.includes(":")?parseInt(_.split(":")[1],10):parseInt(_,10);if(x!==0&&!isNaN(x)){const T=Bfe[x]??x;r.spatialReferences.includes(T)||r.spatialReferences.push(T)}});else if(c.nodeName!=="Style"||r.legendUrl){if(c.nodeName==="Layer"){const _=U4(c,e,i);_&&(_.parentLayerId=r.id,r.sublayers||(r.sublayers=[]),r.sublayers.push(_))}}else{const _=lu("LegendURL",c);if(_){const x=lu("OnlineResource",_);x&&(r.legendUrl=x.getAttribute("xlink:href"))}}}),r.extent=o==null?void 0:o.toJSON(),r.dimensions=gF("Dimension",t).filter(c=>c.getAttribute("name")&&c.getAttribute("units")&&c.textContent).map(c=>{const f=c.getAttribute("name"),_=c.getAttribute("units"),x=c.textContent,T=c.getAttribute("unitSymbol")??void 0,A=c.getAttribute("default")??void 0,M=mF("default",c,"0")!=="0",I=mF("nearestValue",c,"0")!=="0",L=mF("current",c,"0")!=="0";return PRe({name:f,units:_})?{name:"time",units:"ISO8601",extent:Yfe(x),default:Yfe(A),multipleValues:M,nearestValue:I,current:L}:Zht({name:f,units:_})?{name:"elevation",units:_,extent:qfe(x),unitSymbol:T,default:qfe(A),multipleValues:M,nearestValue:I}:{name:f,units:_,extent:Wfe(x),unitSymbol:T,default:Wfe(A),multipleValues:M,nearestValue:I}}),r}function Xht(t){return Array.isArray(t)&&t.length>0&&t[0]instanceof Date}function ORe(t){return t.nodeType===Node.ELEMENT_NODE}function Zht(t){return/^elevation$/i.test(t.name)&&/^(epsg|crs):\d+$/i.test(t.units)}function PRe(t){return/^time$/i.test(t.name)&&/^iso8601$/i.test(t.units)}function Jht(t,e){const i=[],r=qs(t);for(const n in r.query)r.query.hasOwnProperty(n)&&(e.includes(n.toLowerCase())||i.push(n+"="+r.query[n]));return r.path+(i.length?"?"+i.join("&"):"")}function qfe(t){if(!t)return;const e=t.includes("/"),i=t.split(",");return e?i.map(r=>{const n=r.split("/");return n.length<2?null:{min:parseFloat(n[0]),max:parseFloat(n[1]),resolution:n.length>=3&&n[2]!=="0"?parseFloat(n[2]):void 0}}).filter(ys):i.map(r=>parseFloat(r))}function Wfe(t){if(!t)return;const e=t.includes("/"),i=t.split(",");return e?i.map(r=>{const n=r.split("/");return n.length<2?null:{min:n[0],max:n[1],resolution:n.length>=3&&n[2]!=="0"?n[2]:void 0}}).filter(ys):i}function Yfe(t){if(!t)return;const e=t.includes("/"),i=t.split(",");return e?i.map(r=>{const n=r.split("/");return n.length<2?null:{min:new Date(n[0]),max:new Date(n[1]),resolution:n.length>=3&&n[2]!=="0"?Kht(n[2]):void 0}}).filter(ys):i.map(r=>new Date(r))}function Kht(t){const e=/(?:p(\d+y|\d+(?:\.|,)\d+y)?(\d+m|\d+(?:\.|,)\d+m)?(\d+d|\d+(?:\.|,)\d+d)?)?(?:t(\d+h|\d+(?:\.|,)\d+h)?(\d+m|\d+(?:\.|,)\d+m)?(\d+s|\d+(?:\.|,)\d+s)?)?/i,i=t.match(e);return i?{years:HE(i[1]),months:HE(i[2]),days:HE(i[3]),hours:HE(i[4]),minutes:HE(i[5]),seconds:HE(i[6])}:null}function HE(t){if(!t)return 0;const e=/(?:\d+(?:\.|,)\d+|\d+)/,i=t.match(e);if(!i)return 0;const r=i[0].replace(",",".");return Number(r)}function qE(t){return t.toISOString().replace(/\.[0-9]{3}/,"")}const Xfe=new Set([102100,3857,102113,900913]),Qht=new Set([3395,54004]);function edt(t,e){let i=t.wkid;return e==null?i:(i!=null&&e.includes(i)||!t.latestWkid||(i=t.latestWkid),i!=null&&Xfe.has(i)?e.find(r=>Xfe.has(r))||e.find(r=>Qht.has(r))||102100:i)}const qH=new yn({bmp:"image/bmp",gif:"image/gif",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"},{ignoreUnknown:!1});function Zfe(t){return t==="text/html"}function Jfe(t){return t==="text/plain"}let qr=class extends Sse(Vht(zht(OB(XB(JB(fP(uE))))))){constructor(...e){super(...e),this.allSublayers=new GT({getCollections:()=>[this.sublayers],getChildrenFunction:i=>i.sublayers}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType="WMS",this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type="wms",this.version=null,this.addHandles([Jr(()=>this.sublayers,"after-add",({item:i})=>{i.parent=i.layer=this},Li),Jr(()=>this.sublayers,"after-remove",({item:i})=>{i.layer=i.parent=null},Li),_e(()=>this.sublayers,(i,r)=>{if(r)for(const n of r)n.layer=n.parent=null;if(i)for(const n of i)n.parent=n.layer=this},Li)])}normalizeCtorArgs(e,i){return typeof e=="string"?{url:e,...i}:e}destroy(){this.allSublayers.destroy()}load(e){const i=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMS"]},e).catch(zo).then(()=>this._fetchService(i))),Promise.resolve(this)}readFullExtentFromItemOrMap(e,i){const r=i.extent;return r?new Vi({xmin:r[0][0],ymin:r[0][1],xmax:r[1][0],ymax:r[1][1]}):null}writeFullExtent(e,i){i.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return this.featureInfoFormats==null?null:this.featureInfoFormats.find(Zfe)??this.featureInfoFormats.find(Jfe)??null}set featureInfoFormat(e){e==null?(this.revert("featureInfoFormat","service"),this._clearOverride("featureInfoFormat")):(Zfe(e)||Jfe(e))&&this._override("featureInfoFormat",e)}readImageFormat(e,i){const r=i.supportedImageFormatTypes;return r&&r.includes("image/png")?"image/png":r&&r[0]}readSpatialReferenceFromItemOrDocument(e,i){return new at(i.spatialReferences[0])}writeSpatialReferences(e,i){var n;const r=(n=this.spatialReference)==null?void 0:n.wkid;e&&r?(i.spatialReferences=e.filter(s=>s!==r),i.spatialReferences.unshift(r)):i.spatialReferences=e}readSublayersFromItemOrMap(e,i,r){return Kfe(i.layers,r,i.visibleLayers)}readSublayers(e,i,r){return Kfe(i.layers,r)}writeSublayers(e,i,r,n){var l,c;i.layers=[];const s=new Map,o=e.flatten(({sublayers:f})=>f??[]);for(const f of o)if(typeof((l=f.parent)==null?void 0:l.id)=="number"){const _=s.get(f.parent.id);_!=null?_.push(f.id):s.set(f.parent.id,[f.id])}for(const f of o){const _={sublayer:f,...n},x=f.write({parentLayerId:typeof((c=f.parent)==null?void 0:c.id)=="number"?f.parent.id:-1},_);if(s.has(f.id)&&(x.sublayerIds=s.get(f.id)),!f.sublayers&&f.name){const T=f.write({},_);delete T.id,i.layers.push(T)}}i.visibleLayers=o.filter(({visible:f,sublayers:_})=>f&&!_).map(({name:f})=>f).toArray()}set url(e){if(!e)return void this._set("url",e);const{path:i,query:r}=qs(e);for(const s in r)/^(request|service)$/i.test(s)&&delete r[s];const n=tO(i,r??{});this._set("url",n)}createExportImageParameters(e,i,r,n){const s=(n==null?void 0:n.pixelRatio)??1,o=zfe({extent:e,width:i})*s,l=new Sv({layer:this,scale:o}),{xmin:c,ymin:f,xmax:_,ymax:x,spatialReference:T}=e,A=edt(T,this.spatialReferences),M=this.version==="1.3.0"&&RQ(A)?`${f},${c},${x},${_}`:`${c},${f},${_},${x}`,I=l.toJSON();return{bbox:M,[this.version==="1.3.0"?"crs":"srs"]:A==null||isNaN(A)?void 0:"EPSG:"+A,...I}}async fetchImage(e,i,r,n){var x,T;const s=this.mapUrl,o=this.createExportImageParameters(e,i,r,n);if(!o.layers){const A=document.createElement("canvas");return A.width=i,A.height=r,A}const l=(x=n==null?void 0:n.timeExtent)==null?void 0:x.start,c=(T=n==null?void 0:n.timeExtent)==null?void 0:T.end,f=l!=null&&c!=null?l.getTime()===c.getTime()?qE(l):`${qE(l)}/${qE(c)}`:void 0,_={responseType:"image",query:this._mixCustomParameters({width:i,height:r,...o,time:f,...this.refreshParameters}),signal:n==null?void 0:n.signal};return bi(s??"",_).then(A=>A.data)}async fetchImageBitmap(e,i,r,n){var T,A;const s=this.mapUrl??"",o=this.createExportImageParameters(e,i,r,n);if(!o.layers){const M=document.createElement("canvas");return M.width=i,M.height=r,M}const l=(T=n==null?void 0:n.timeExtent)==null?void 0:T.start,c=(A=n==null?void 0:n.timeExtent)==null?void 0:A.end,f=l!=null&&c!=null?l.getTime()===c.getTime()?qE(l):`${qE(l)}/${qE(c)}`:void 0,_={responseType:"blob",query:this._mixCustomParameters({width:i,height:r,...o,time:f,...this.refreshParameters}),signal:n==null?void 0:n.signal},{data:x}=await bi(s,_);return Ght(x,s,n==null?void 0:n.signal)}fetchFeatureInfo(e,i,r,n,s){const o=zfe({extent:e,width:i}),l=new Sv({layer:this,scale:o}),c=Wht(l.visibleSublayers);if(this.featureInfoUrl==null||c==null)return Promise.resolve([]);if(this.fetchFeatureInfoFunction==null&&this.featureInfoFormat==null)return Promise.resolve([]);const f=this.version==="1.3.0"?{I:n,J:s}:{x:n,y:s},_={query_layers:c,request:"GetFeatureInfo",info_format:this.featureInfoFormat,feature_count:25,width:i,height:r,...f},x={...this.createExportImageParameters(e,i,r),..._},T=this._mixCustomParameters(x);return this.fetchFeatureInfoFunction!=null?this.fetchFeatureInfoFunction(T):this._defaultFetchFeatureInfoFunction(tO(this.featureInfoUrl,T))}findSublayerById(e){return this.allSublayers.find(i=>i.id===e)}findSublayerByName(e){return this.allSublayers.find(i=>i.name===e)}serviceSupportsSpatialReference(e){return Kst(this.url)||this.spatialReferences!=null&&this.spatialReferences.some(i=>{const r=i===900913?at.WebMercator:new at({wkid:i});return Zn(r,e)})}_defaultFetchFeatureInfoFunction(e){const i=document.createElement("iframe");i.src=$Ye(e),i.style.border="none",i.style.margin="0",i.style.width="100%",i.setAttribute("sandbox","");const r=new hE({title:this.title,content:i}),n=new Ml({sourceLayer:this,popupTemplate:r});return Promise.resolve([n])}async _fetchService(e){var i;if(!this.resourceInfo&&((i=this.parsedUrl)!=null&&i.path)){const{path:r,query:n}=this.parsedUrl,{data:s}=await bi(r,{query:{SERVICE:"WMS",REQUEST:"GetCapabilities",...n,...this.customParameters},responseType:"xml",signal:e});this.resourceInfo=qht(s)}if(this.parsedUrl){const r=new m2(this.parsedUrl.path),{httpsDomains:n}=Ar.request;r.scheme!=="https"||r.port&&r.port!=="443"||!r.host||n.includes(r.host)||n.push(r.host)}this.read(this.resourceInfo,{origin:"service"})}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;const i={...this.customParameters,...this.customLayerParameters};for(const r in i)e[r.toLowerCase()]=i[r];return e}};function tdt(t,e){return t.some(i=>{for(const r in i)if(oEe(i,r,null,e))return!0;return!1})}function Kfe(t,e,i){t=t??[];const r=new Map;t.every(s=>s.id==null)&&(t=Re(t)).forEach((s,o)=>s.id=o);for(const s of t){const o=new IQ;o.read(s,e),i&&!i.includes(o.name)&&(o.visible=!1),r.set(o.id,o)}const n=[];for(const s of t){const o=s.id!=null?r.get(s.id):null;if(o)if(s.parentLayerId!=null&&s.parentLayerId>=0){const l=r.get(s.parentLayerId);if(!l)continue;l.sublayers||(l.sublayers=new it),l.sublayers.push(o)}else n.push(o)}return n}y([w({readOnly:!0})],qr.prototype,"allSublayers",void 0),y([w({json:{type:Object,write:!0}})],qr.prototype,"customParameters",void 0),y([w({json:{type:Object,write:!0}})],qr.prototype,"customLayerParameters",void 0),y([w({type:String,json:{write:!0}})],qr.prototype,"copyright",void 0),y([w()],qr.prototype,"description",void 0),y([w({readOnly:!0})],qr.prototype,"dimensions",void 0),y([w({json:{type:[[Number]],read:{source:"extent"},write:{target:"extent"},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],qr.prototype,"fullExtent",void 0),y([$t(["web-document","portal-item"],"fullExtent",["extent"])],qr.prototype,"readFullExtentFromItemOrMap",null),y([Pt(["web-document","portal-item"],"fullExtent",{extent:{type:[[Number]]}})],qr.prototype,"writeFullExtent",null),y([w()],qr.prototype,"fullExtents",void 0),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],qr.prototype,"featureInfoFormat",null),y([w({type:[String],readOnly:!0})],qr.prototype,"featureInfoFormats",void 0),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],qr.prototype,"featureInfoUrl",void 0),y([w()],qr.prototype,"fetchFeatureInfoFunction",void 0),y([w({type:String,json:{origins:{"web-document":{default:"image/png",type:qH.jsonValues,read:{reader:qH.read,source:"format"},write:{writer:qH.write,target:"format"}}}}})],qr.prototype,"imageFormat",void 0),y([$t("imageFormat",["supportedImageFormatTypes"])],qr.prototype,"readImageFormat",null),y([w({type:Number,json:{read:{source:"maxHeight"},write:{target:"maxHeight"}}})],qr.prototype,"imageMaxHeight",void 0),y([w({type:Number,json:{read:{source:"maxWidth"},write:{target:"maxWidth"}}})],qr.prototype,"imageMaxWidth",void 0),y([w()],qr.prototype,"imageTransparency",void 0),y([w(b5e)],qr.prototype,"legendEnabled",void 0),y([w({type:["show","hide","hide-children"]})],qr.prototype,"listMode",void 0),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],qr.prototype,"mapUrl",void 0),y([w({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],qr.prototype,"isReference",void 0),y([w({type:["WMS"]})],qr.prototype,"operationalLayerType",void 0),y([w()],qr.prototype,"resourceInfo",void 0),y([w({type:at,json:{origins:{service:{read:{source:"extent.spatialReference"}}},write:!1}})],qr.prototype,"spatialReference",void 0),y([$t(["web-document","portal-item"],"spatialReference",["spatialReferences"])],qr.prototype,"readSpatialReferenceFromItemOrDocument",null),y([w({type:[$n],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],qr.prototype,"spatialReferences",void 0),y([Pt(["web-document","portal-item"],"spatialReferences")],qr.prototype,"writeSpatialReferences",null),y([w({type:it.ofType(IQ),json:{write:{target:"layers",overridePolicy(t,e,i){if(tdt(this.allSublayers,i))return{ignoreOrigin:!0}}}}})],qr.prototype,"sublayers",void 0),y([$t(["web-document","portal-item"],"sublayers",["layers","visibleLayers"])],qr.prototype,"readSublayersFromItemOrMap",null),y([$t("service","sublayers",["layers"])],qr.prototype,"readSublayers",null),y([Pt("sublayers",{layers:{type:[IQ]},visibleLayers:{type:[String]}})],qr.prototype,"writeSublayers",null),y([w({json:{read:!1},readOnly:!0,value:"wms"})],qr.prototype,"type",void 0),y([w(soe)],qr.prototype,"url",null),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],qr.prototype,"version",void 0),qr=y([Z("esri.layers.WMSLayer")],qr);const RRe=qr,idt=Object.freeze(Object.defineProperty({__proto__:null,default:RRe},Symbol.toStringTag,{value:"Module"}));async function fj(t,e){return await t.load(),rdt(t,e)}async function rdt(t,e){const i=[],r=(...s)=>{for(const o of s)o!=null&&(Array.isArray(o)?r(...o):it.isCollection(o)?o.forEach(l=>r(l)):jf.isLoadable(o)&&i.push(o))};e(r);let n=null;if(await EHe(i,async s=>{const o=await Ju(ndt(s)?s.loadAll():s.load());o.ok!==!1||n||(n=o)}),n)throw n.error;return t}function ndt(t){return"loadAll"in t&&typeof t.loadAll=="function"}function IRe(t){return new GT({getCollections:()=>[t.tables,t.layers],getChildrenFunction:e=>{const i=[];return"tables"in e&&i.push(e.tables),"layers"in e&&i.push(e.layers),i},itemFilterFunction:e=>{const i=e.parent;return!!i&&"tables"in i&&i.tables.includes(e)}})}function WH(t){for(const e of t.values())e==null||e.destroy();t.clear()}function $Q(t,e,i){let r,n;if(t)for(let s=0,o=t.length;s{let e=class extends t{constructor(...i){super(...i),this.layers=new it;const r=o=>{o.parent&&"remove"in o.parent&&o.parent.remove(o)},n=o=>{o.parent=this,this.layerAdded(o),o.type!=="elevation"&&o.type!=="base-elevation"||Ce.getLogger(this).error(`Layer 'title:${o.title}, id:${o.id}' of type '${o.type}' is not supported as an operational layer and will therefore be ignored.`)},s=o=>{o.parent=null,this.layerRemoved(o)};this.addHandles([this.layers.on("before-add",o=>r(o.item)),this.layers.on("after-add",o=>n(o.item)),this.layers.on("after-remove",o=>s(o.item))])}destroy(){const i=this.layers.toArray();for(const r of i)r.destroy();this.layers.destroy()}set layers(i){this._set("layers",sd(i,this._get("layers")))}add(i,r){const n=this.layers;if(r=n.getNextIndex(r),i instanceof uE){const s=i;s.parent===this?this.reorder(s,r):n.add(s,r)}else pd(i)?i.then(s=>{this.destroyed||this.add(s,r)}):Ce.getLogger(this).error("#add()","The item being added is not a Layer or a Promise that resolves to a Layer.")}addMany(i,r){const n=this.layers;let s=n.getNextIndex(r);i.slice().forEach(o=>{o.parent!==this?(n.add(o,s),s+=1):this.reorder(o,s)})}findLayerById(i){return $Q(this.layers,"id",i)}findLayerByUid(i){return $Q(this.layers,"uid",i)}remove(i){return this.layers.remove(i)}removeMany(i){return this.layers.removeMany(i)}removeAll(){return this.layers.removeAll()}reorder(i,r){return this.layers.reorder(i,r)}layerAdded(i){}layerRemoved(i){}};return y([w()],e.prototype,"layers",null),e=y([Z("esri.support.LayersMixin")],e),e};function LQ(t,e,i){if(t)for(let r=0,n=t.length;r{let e=class extends t{constructor(...i){super(...i),this.tables=new it,this.addHandles([this.tables.on("after-add",r=>{const n=r.item;n.parent&&n.parent!==this&&"tables"in n.parent&&n.parent.tables.remove(n),n.parent=this,n.type!=="feature"&&Ce.getLogger(this).error(`Layer 'title:${n.title}, id:${n.id}' of type '${n.type}' is not supported as a table and will therefore be ignored.`)}),this.tables.on("after-remove",r=>{r.item.parent=null})])}destroy(){const i=this.tables.toArray();for(const r of i)r.destroy();this.tables.destroy()}set tables(i){this._set("tables",sd(i,this._get("tables")))}findTableById(i){return LQ(this.tables,"id",i)}findTableByUid(i){return LQ(this.tables,"uid",i)}};return y([w()],e.prototype,"tables",null),e=y([Z("esri.support.TablesMixin")],e),e},DRe=Symbol("WebScene");var fy;(function(t){t[t.SAVE=0]="SAVE",t[t.SAVE_AS=1]="SAVE_AS"})(fy||(fy={}));const sdt=new Set(["bing-maps","imagery","imagery-tile","map-image","open-street-map","tile","unknown","unsupported","vector-tile","web-tile","wms","wmts"]),odt=new Set(["csv","feature","geo-rss","geojson","group","imagery","imagery-tile","kml","map-image","map-notes","media","ogc-feature","oriented-imagery","route","stream","subtype-group","tile","unknown","unsupported","vector-tile","web-tile","wfs","wms","wmts"]);function adt(t){return t.layerContainerType==="basemap"?sdt:t.layerContainerType==="operational-layers"?odt:null}function ldt(t,e){if(e.restrictedWebMapWriting){const i=adt(e);return i==null||i.has(t.type)&&!GB(t)}return!0}function cdt(t,e){var i;if(e)if(GB(t)){const r=u9("featureCollection.layers",e),n=(i=r==null?void 0:r[0])==null?void 0:i.layerDefinition;n&&Qfe(t,n)}else t.type!=="group"&&Qfe(t,e)}function Qfe(t,e){"maxScale"in t&&(e.maxScale=ez(t.maxScale)??void 0),"minScale"in t&&(e.minScale=ez(t.minScale)??void 0)}function udt(t,e){if(cdt(t,e),e&&(e.id=t.id,"blendMode"in t&&(e.blendMode=t.blendMode,e.blendMode==="normal"&&delete e.blendMode),e.opacity=ez(t.opacity)??void 0,e.title=t.title||"Layer",e.visibility=t.visible,"legendEnabled"in t&&t.type!=="wmts"))if(GB(t)){const i=e.featureCollection;i&&(i.showLegend=t.legendEnabled)}else e.showLegend=t.legendEnabled}function DQ(t,e,i){if(!t.persistenceEnabled)return null;if(!("write"in t)||!t.write)return i!=null&&i.messages&&i.messages.push(new se("layer:unsupported",`Layers (${t.title}, ${t.id}) of type '${t.declaredClass}' cannot be persisted`,{layer:t})),null;if(GB(t)&&!t.isTable)e=t.resourceInfo;else if(ldt(t,i)){const r={};return t.write(r,i)?r:null}return e!=null&&udt(t,e=Re(e)),e}let nc=class extends Sse(OB(XB(JB(LRe($Re(fP(uE))))))){constructor(e){super(e),this.allLayers=new GT({getCollections:()=>[this.layers],getChildrenFunction:i=>"layers"in i?i.layers:null}),this.allTables=IRe(this),this.fullExtent=void 0,this.operationalLayerType="GroupLayer",this.spatialReference=void 0,this.type="group",this._debouncedSaveOperations=X5(async(i,r,n)=>{const{save:s,saveAs:o}=await we(()=>import("./groupLayerUtils-ciLlAkrK.js"),__vite__mapDeps([127,128,45]));switch(i){case fy.SAVE:return s(this,r);case fy.SAVE_AS:return o(this,n,r)}})}initialize(){this._enforceVisibility(this.visibilityMode,this.visible),this.addHandles([_e(()=>{let e=this.parent;for(;e&&"parent"in e&&e.parent;)e=e.parent;return e&&DRe in e},e=>{const i="prevent-adding-tables";this.removeHandles(i),e&&(this.tables.removeAll(),this.addHandles(Jr(()=>this.tables,"before-add",r=>{r.preventDefault(),Ce.getLogger(this).errorOnce("tables","tables in group layers in a webscene are not supported. Please move the tables from the group layer to the webscene if you want to persist them.")}),i))},kt),_e(()=>this.visible,this._onVisibilityChange.bind(this),Li)])}destroy(){this.allLayers.destroy(),this.allTables.destroy()}get sourceIsPortalItem(){return this.portalItem&&this.originIdOf("portalItem")===Di.USER}_writeLayers(e,i,r,n){const s=[];if(!e)return s;e.forEach(o=>{const l=DQ(o,n.webmap?n.webmap.getLayerJSONFromResourceInfo(o):null,n);l!=null&&l.layerType&&s.push(l)}),i.layers=s}set portalItem(e){this._set("portalItem",e)}readPortalItem(e,i,r){const{itemId:n,layerType:s}=i;if(s==="GroupLayer"&&n)return new Am({id:n,portal:r==null?void 0:r.portal})}writePortalItem(e,i){e!=null&&e.id&&(i.itemId=e.id)}set visibilityMode(e){const i=this._get("visibilityMode")!==e;this._set("visibilityMode",e),i&&this._enforceVisibility(e,this.visible)}async beforeSave(){return lat(this)}load(e){const i=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Group Layer","Scene Service"],layerModuleTypeMap:dPe},e).catch(r=>{if(zo(r),this.sourceIsPortalItem)throw r});return this.addResolvingPromise(i),Promise.resolve(this)}async loadAll(){return fj(this,e=>{e(this.layers,this.tables)})}async save(e){return this._debouncedSaveOperations(fy.SAVE,e)}async saveAs(e,i){return this._debouncedSaveOperations(fy.SAVE_AS,i,e)}layerAdded(e){e.visible&&this.visibilityMode==="exclusive"?this._turnOffOtherLayers(e):this.visibilityMode==="inherited"&&(e.visible=this.visible),this.hasHandles(e.uid)?console.error(`Layer readded to Grouplayer: uid=${e.uid}`):this.addHandles(_e(()=>e.visible,i=>this._onChildVisibilityChange(e,i),Li),e.uid)}layerRemoved(e){this.removeHandles(e.uid),this._enforceVisibility(this.visibilityMode,this.visible)}_turnOffOtherLayers(e){this.layers.forEach(i=>{i!==e&&(i.visible=!1)})}_enforceVisibility(e,i){if(!Zl(this).initialized)return;const r=this.layers;let n=r.find(s=>s.visible);switch(e){case"exclusive":r.length&&!n&&(n=r.at(0),n.visible=!0),this._turnOffOtherLayers(n);break;case"inherited":r.forEach(s=>{s.visible=i})}}_onVisibilityChange(e){this.visibilityMode==="inherited"&&this.layers.forEach(i=>{i.visible=e})}_onChildVisibilityChange(e,i){switch(this.visibilityMode){case"exclusive":i?this._turnOffOtherLayers(e):this._isAnyLayerVisible()||(e.visible=!0);break;case"inherited":e.visible=this.visible}}_isAnyLayerVisible(){return this.layers.some(e=>e.visible)}};y([w({readOnly:!0,dependsOn:[]})],nc.prototype,"allLayers",void 0),y([w({readOnly:!0})],nc.prototype,"allTables",void 0),y([w({json:{read:!0,write:!0}})],nc.prototype,"blendMode",void 0),y([w()],nc.prototype,"fullExtent",void 0),y([w({readOnly:!0})],nc.prototype,"sourceIsPortalItem",null),y([w({json:{read:!1,write:{ignoreOrigin:!0}}})],nc.prototype,"layers",void 0),y([Pt("layers")],nc.prototype,"_writeLayers",null),y([w({type:["GroupLayer"]})],nc.prototype,"operationalLayerType",void 0),y([w({json:{origins:{"web-map":{read:!1,write:{overridePolicy(t,e,i){return{enabled:(t==null?void 0:t.type)==="Group Layer"&&(i==null?void 0:i.initiator)!==this}}}},"web-scene":{read:!1,write:!1}}}})],nc.prototype,"portalItem",null),y([$t("web-map","portalItem",["itemId"])],nc.prototype,"readPortalItem",null),y([Pt("web-map","portalItem",{itemId:{type:String}})],nc.prototype,"writePortalItem",null),y([w()],nc.prototype,"spatialReference",void 0),y([w({json:{read:!1},readOnly:!0,value:"group"})],nc.prototype,"type",void 0),y([w({type:["independent","inherited","exclusive"],value:"independent",json:{write:!0,origins:{"web-map":{type:["independent","exclusive"],write:(t,e,i)=>{t!=="inherited"&&(e[i]=t)}}}}})],nc.prototype,"visibilityMode",null),nc=y([Z("esri.layers.GroupLayer")],nc);const NRe=nc,hdt=Object.freeze(Object.defineProperty({__proto__:null,default:NRe},Symbol.toStringTag,{value:"Module"})),ddt=()=>new jse({elevationInfo:{mode:"absolute-height"},title:"Joonistatud kihid"}),pdt=(t,e)=>new SRe({portalItem:{id:t},title:e}),fdt=()=>new RRe({portalItem:{id:"38a98f83f3a248faaea9ce793e50ddee"},title:"Ortofoto WMS",visible:!1,listMode:"hide"}),e0e=(t,e,i=!1)=>new NRe({title:t,visible:i,visibilityMode:e}),mdt=(t,e)=>{const i=e.map.allLayers.find(n=>n.title==="Taimkate analüütiline");i.visible=!0;const r=e.map.allLayers.find(n=>n.title==="Taimkate realistlik");t.addMany([i,r]),e.map.removeMany([i,r])},gdt=t=>{const e=["Puurkaevud/puuraugud","Ehitusgeoloogia","Geoloogia WMS"],i={};return t.map.layers.forEach(n=>{const s=n.title;e.includes(s)&&(i[s]=n)}),{items:e.map(n=>i[n]).filter(Boolean)}},t0e=t=>{const{items:e}=t.map.allLayers,{initVisible:i}=e.reduce((r,n)=>(n.visible===!0&&r.initVisible.push(n),r),{initVisible:[]});return i},ydt=(t,e)=>{const i=t.filter(f=>!e.includes(f)),r=e.filter(f=>!t.includes(f)),n=f=>f.title,s=[...i.map(n),...r.map(n)],o=["Kõrgusmudel","Aluspõhi 50m","Aluskord 50m"],l=s.filter(f=>!o.includes(f)),c=s.filter(f=>o.includes(f));return[l,c]};async function vdt(t){if(!t)return;const e=t.includes("-vector")?t.slice(0,t.indexOf("-vector")):t.includes("-3d")?t.slice(0,t.indexOf("-3d")):t,i=await lE("esri/t9n/basemaps");return i[t]||i[e]}const u5={satellite:{id:"satellite",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/satellite.jpg")},baseMapLayers:[{id:"satellite-base-layer",url:"//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Imagery",showLegend:!1,visibility:!0,opacity:1}]},hybrid:{id:"hybrid",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/hybrid.jpg")},baseMapLayers:[{id:"hybrid-base-layer",url:"//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Imagery",showLegend:!1,visibility:!0,opacity:1},{id:"hybrid-reference-layer",styleUrl:"https://cdn.arcgis.com/sharing/rest/content/items/30d6b8271e1849cd9c3042060001f425/resources/styles/root.json",layerType:"VectorTileLayer",title:"Hybrid Reference Layer",isReference:!0,showLegend:!1,visibility:!0,opacity:1}]},terrain:{id:"terrain",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/terrain.jpg")},baseMapLayers:[{id:"terrain-base-layer",url:"//services.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Terrain Base",showLegend:!1,visibility:!0,opacity:1},{id:"terrain-reference-layer",url:"//services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Reference Overlay",isReference:!0,showLegend:!1,visibility:!0,opacity:1}]},oceans:{id:"oceans",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/oceans.jpg")},baseMapLayers:[{id:"oceans-base-layer",url:"//services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Ocean Base",showLegend:!1,visibility:!0,opacity:1},{id:"oceans-reference-layer",url:"//services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Ocean Reference",isReference:!0,showLegend:!1,visibility:!0,opacity:1}]},osm:{id:"osm",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/osm.jpg")},baseMapLayers:[{id:"osm-base-layer",layerType:"OpenStreetMap",title:"Open Street Map",showLegend:!1,visibility:!0,opacity:1}]},"dark-gray-vector":{id:"dark-gray-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/dark-gray-vector.jpg")},baseMapLayers:[{id:"dark-gray-base-layer",styleUrl:"https://cdn.arcgis.com/sharing/rest/content/items/5e9b3685f4c24d8781073dd928ebda50/resources/styles/root.json",layerType:"VectorTileLayer",title:"Dark Gray Base",visibility:!0,opacity:1},{id:"dark-gray-reference-layer",styleUrl:"https://cdn.arcgis.com/sharing/rest/content/items/747cb7a5329c478cbe6981076cc879c5/resources/styles/root.json",layerType:"VectorTileLayer",title:"Dark Gray Reference",isReference:!0,visibility:!0,opacity:1}]},get"dark-gray"(){return{...this["dark-gray-vector"],id:"dark-gray"}},"gray-vector":{id:"gray-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/gray-vector.jpg")},baseMapLayers:[{id:"gray-base-layer",styleUrl:"https://cdn.arcgis.com/sharing/rest/content/items/291da5eab3a0412593b66d384379f89f/resources/styles/root.json",layerType:"VectorTileLayer",title:"Light Gray Base",visibility:!0,opacity:1},{id:"gray-reference-layer",styleUrl:"https://cdn.arcgis.com/sharing/rest/content/items/1768e8369a214dfab4e2167d5c5f2454/resources/styles/root.json",layerType:"VectorTileLayer",title:"Light Gray Reference",isReference:!0,visibility:!0,opacity:1}]},get gray(){return{...this["gray-vector"],id:"gray"}},"streets-vector":{id:"streets-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/streets-vector.jpg")},baseMapLayers:[{id:"streets-vector-base-layer",styleUrl:"//cdn.arcgis.com/sharing/rest/content/items/de26a3cf4cc9451298ea173c4b324736/resources/styles/root.json",layerType:"VectorTileLayer",title:"World Streets",visibility:!0,opacity:1}]},get streets(){return{...this["streets-vector"],id:"streets"}},"topo-vector":{id:"topo-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/topo-vector.jpg")},baseMapLayers:[{id:"world-hillshade-layer",url:"//services.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Hillshade",showLegend:!1,visibility:!0,opacity:1},{id:"topo-vector-base-layer",styleUrl:"//cdn.arcgis.com/sharing/rest/content/items/7dc6cea0b1764a1f9af2e679f642f0f5/resources/styles/root.json",layerType:"VectorTileLayer",title:"World Topo",visibility:!0,opacity:1}]},get topo(){return{...this["topo-vector"],id:"topo"}},"streets-night-vector":{id:"streets-night-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/streets-night.jpg")},baseMapLayers:[{id:"streets-night-vector-base-layer",styleUrl:"//cdn.arcgis.com/sharing/rest/content/items/86f556a2d1fd468181855a35e344567f/resources/styles/root.json",layerType:"VectorTileLayer",title:"World Streets Night",visibility:!0,opacity:1}]},"streets-relief-vector":{id:"streets-relief-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/streets-relief.jpg")},baseMapLayers:[{id:"world-hillshade-layer",url:"//services.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Hillshade",showLegend:!1,visibility:!0,opacity:1},{id:"streets-relief-vector-base-layer",styleUrl:"//www.arcgis.com/sharing/rest/content/items/b266e6d17fc345b498345613930fbd76/resources/styles/root.json",title:"World Streets Relief",layerType:"VectorTileLayer",visibility:!0,opacity:1}]},"streets-navigation-vector":{id:"streets-navigation-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/streets-navigation.jpg")},baseMapLayers:[{id:"streets-navigation-vector-base-layer",styleUrl:"//cdn.arcgis.com/sharing/rest/content/items/63c47b7177f946b49902c24129b87252/resources/styles/root.json",layerType:"VectorTileLayer",title:"World Streets Navigation",visibility:!0,opacity:1}]},"topo-3d":{id:"topo-3d",is3d:!0,get thumbnailUrl(){return Wr("esri/images/basemap/topo-3d.png")},baseMapLayers:[{id:"topo-3d-base-layer",styleUrl:"https://www.arcgis.com/sharing/rest/content/items/1e7d1784d1ef4b79ba6764d0bd6c3150/resources/styles/root.json",layerType:"VectorTileLayer",title:"Topographic",visibility:!0,opacity:1},{id:"topo-3d-trees",title:"Trees",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_Trees_Thematic_v1/SceneServer",itemId:"f75fef56b2d944fe92ef9f7737b4f953",layerType:"ArcGISSceneServiceLayer"},{id:"topo-3d-places-and-labels",title:"Places and Labels",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_DarkLabels_v1/SceneServer",itemId:"a84404ad39c64c328d0596e361ec459b",layerType:"ArcGISSceneServiceLayer"},{id:"topo-3d-buildings",title:"Buildings",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_Buildings_v1/SceneServer",itemId:"ca0470dbbddb4db28bad74ed39949e25",layerType:"ArcGISSceneServiceLayer"}]},"navigation-3d":{id:"navigation-3d",is3d:!0,get thumbnailUrl(){return Wr("esri/images/basemap/navigation-3d.jpg")},baseMapLayers:[{id:"navigation-3d-base-layer",styleUrl:"https://www.arcgis.com/sharing/rest/content/items/ccc904ff872b4144b94934e55e32784b/resources/styles/root.json",layerType:"VectorTileLayer",title:"Navigation",visibility:!0,opacity:1},{id:"navigation-3d-places-and-labels",title:"Places and Labels",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_DarkLabels_v1/SceneServer",itemId:"a84404ad39c64c328d0596e361ec459b",layerType:"ArcGISSceneServiceLayer"},{id:"navigation-3d-buildings",title:"Buildings",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_Buildings_v1/SceneServer",itemId:"ca0470dbbddb4db28bad74ed39949e25",layerType:"ArcGISSceneServiceLayer"}]},"navigation-dark-3d":{id:"navigation-dark-3d",itemId:"5a1365328b4943f09a54cf5fd1205707",is3d:!0,baseMapLayers:[{id:"navigation-dark-3d-base-layer",styleUrl:"https://www.arcgis.com/sharing/rest/content/items/451a1777ab3f4bf095fae24a117439d9/resources/styles/root.json",layerType:"VectorTileLayer",title:"Navigation Dark"},{id:"navigation-dark-3d-places-and-labels",title:"Places and Labels",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_LightLabels_v1/SceneServer/layers/0",itemId:"f364b70b012a4da5a4b5921e193eac4a",layerType:"ArcGISSceneServiceLayer"},{id:"navigation-dark-3d-buildings",title:"Buildings",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_Buildings_v1/SceneServer",itemId:"ca0470dbbddb4db28bad74ed39949e25",layerType:"ArcGISSceneServiceLayer"}]},"arcgis-imagery":{get thumbnailUrl(){return Wr("esri/images/basemap/hybrid.jpg")},title:"Imagery Hybrid",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Imagery",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Imagery:Labels",title:"Hybrid Reference Layer",isReference:!0}]},"arcgis-imagery-standard":{get thumbnailUrl(){return Wr("esri/images/basemap/satellite.jpg")},title:"Imagery",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Imagery",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer"}]},"arcgis-imagery-labels":{title:"Hybrid [Reference]",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Imagery:Labels",title:"Hybrid Reference Layer",isReference:!0}]},"arcgis-light-gray":{get thumbnailUrl(){return Wr("esri/images/basemap/gray-vector.jpg")},title:"Light Gray Canvas",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:LightGray:Base",title:"Light Gray Canvas Base"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:LightGray:Labels",title:"Light Gray Canvas Labels",isReference:!0}]},"arcgis-dark-gray":{get thumbnailUrl(){return Wr("esri/images/basemap/dark-gray.jpg")},title:"Dark Gray Canvas",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:DarkGray:Base",title:"Dark Gray Canvas Base"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:DarkGray:Labels",title:"Dark Gray Canvas Labels",isReference:!0}]},"arcgis-navigation":{get thumbnailUrl(){return Wr("esri/images/basemap/streets-navigation.jpg")},title:"Navigation",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Navigation",title:"World Navigation Map"}]},"arcgis-navigation-night":{title:"Navigation (Dark Mode)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:NavigationNight",title:"World Navigation Map (Dark Mode)"}]},"arcgis-streets":{get thumbnailUrl(){return Wr("esri/images/basemap/streets-vector.jpg")},title:"Streets",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Streets",title:"World Street Map"}]},"arcgis-streets-night":{get thumbnailUrl(){return Wr("esri/images/basemap/streets-night.jpg")},title:"Streets (Night)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:StreetsNight",title:"World Street Map (Night)"}]},"arcgis-streets-relief":{get thumbnailUrl(){return Wr("esri/images/basemap/streets-relief.jpg")},title:"Streets (with Relief)",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:StreetsRelief:Base",title:"World Street Map (with Relief)"}]},"arcgis-topographic":{get thumbnailUrl(){return Wr("esri/images/basemap/topo.jpg")},title:"Topographic",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Topographic:Base",title:"World Topographic Map"}]},"arcgis-oceans":{get thumbnailUrl(){return Wr("esri/images/basemap/oceans.jpg")},title:"Oceans",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Ocean Base",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Oceans:Labels",title:"World Ocean Reference",isReference:!0}]},"osm-standard":{title:"OpenStreetMap",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:Standard",title:"OpenStreetMap"}]},"osm-standard-relief":{title:"OpenStreetMap (with relief)",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:StandardRelief:Base",layerType:"VectorTileLayer",title:"OpenStreetMap Relief Base"}]},"osm-streets":{title:"OpenStreetMap (Streets)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:Streets",title:"OpenStreetMap (Streets)"}]},"osm-streets-relief":{title:"OpenStreetMap (Streets with relief)",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:StreetsRelief:Base",layerType:"VectorTileLayer",title:"OpenStreetMap Relief Base"}]},"osm-light-gray":{title:"OpenStreetMap (Light Gray Canvas)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:LightGray:Base",title:"OSM (Light Gray Base)"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:LightGray:Labels",title:"OSM (Light Gray Reference)",isReference:!0}]},"osm-dark-gray":{title:"OpenStreetMap (Dark Gray Canvas)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:DarkGray:Base",title:"OSM (Dark Gray Base)"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:DarkGray:Labels",title:"OSM (Dark Gray Reference)",isReference:!0}]},"arcgis-terrain":{title:"Terrain with Labels",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Terrain:Base",title:"World Terrain Base"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Terrain:Detail",title:"World Terrain Reference",isReference:!0}]},"arcgis-community":{title:"Community",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Community",title:"Community"}]},"arcgis-charted-territory":{title:"Charted Territory",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:ChartedTerritory:Base",title:"Charted Territory"}]},"arcgis-colored-pencil":{title:"Colored Pencil",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:ColoredPencil",title:"Colored Pencil"}]},"arcgis-nova":{title:"Nova",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Nova",title:"Nova"}]},"arcgis-modern-antique":{title:"Modern Antique",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:ModernAntique:Base",title:"Modern Antique"}]},"arcgis-midcentury":{title:"Mid-Century",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Midcentury",title:"Mid-Century"}]},"arcgis-newspaper":{title:"Newspaper",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Newspaper",title:"Newspaper"}]},"arcgis-hillshade-light":{title:"Hillshade",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"}]},"arcgis-hillshade-dark":{title:"Hillshade (Dark)",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade (Dark)",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade_Dark/MapServer"}]},"arcgis-human-geography":{title:"Human Geography",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeography:Base",title:"Human Geography Base"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeography:Detail",title:"Human Geography Detail",isReference:!0},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeography:Label",title:"Human Geography Label",isReference:!0}]},"arcgis-human-geography-dark":{title:"Human Geography (Dark)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeographyDark:Base",title:"Human Geography Dark Base"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeographyDark:Detail",title:"Human Geography Dark Detail",isReference:!0},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeographyDark:Label",title:"Human Geography Dark Label",isReference:!0}]}},_dt=new Set(["ar","bs","ca","hr","cs","da","nl","en","et","fi","fr","de","el","he","hu","id","it","ja","ko","lv","lt","nb","pl","ro","ru","sr","es","sv","th","tr","uk","vi"]);let MA=class extends ze{constructor(e){super(e),this.id=null,this.language=null,this.serviceUrl="https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/webmaps"}getLanguageParamValue(){if(this.language)return this.language;const e=fa().toLowerCase();switch(e){case"pt-br":return"pt-BR";case"pt-pt":return"pt-PT";case"zh-cn":return"zh-CN";case"zh-hk":return"zh-HK";case"zh-tw":return"zh-TW"}const i=lne(e);return i==="pt"?"pt-BR":i&&_dt.has(i)?i:"global"}};y([w()],MA.prototype,"id",void 0),y([w()],MA.prototype,"language",void 0),y([w()],MA.prototype,"serviceUrl",void 0),MA=y([Z("esri.support.BasemapStyle")],MA);const bdt=MA;var V4;let wdt=0;const xdt="esri.Basemap";let Rd=V4=class extends P_(jf){constructor(t){super(t),this.id=null,this.portalItem=null,this.spatialReference=null,this.style=null,this.thumbnailUrl=null,this.title="Basemap",this.id=Date.now().toString(16)+"-basemap-"+wdt++,this.baseLayers=new it,this.referenceLayers=new it;const e=r=>{r.parent&&r.parent!==this&&"remove"in r.parent&&r.parent.remove(r),r.parent=this,r.type==="elevation"&&Ce.getLogger(this).error(`Layer '${r.title}, id:${r.id}' of type '${r.type}' is not supported as a basemap layer and will therefore be ignored.`)},i=r=>{r.parent=null};this.addHandles([this.baseLayers.on("after-add",r=>e(r.item)),this.referenceLayers.on("after-add",r=>e(r.item)),this.baseLayers.on("after-remove",r=>i(r.item)),this.referenceLayers.on("after-remove",r=>i(r.item))])}initialize(){this.when().catch(t=>{Ce.getLogger(this).error("#load()",`Failed to load basemap (title: '${this.title}', id: '${this.id}')`,t)}),this.resourceInfo&&this.read(this.resourceInfo.data,this.resourceInfo.context)}destroy(){const t=this.baseLayers.toArray();for(const i of t)i.destroy();const e=this.referenceLayers.toArray();for(const i of e)i.destroy();this.baseLayers.destroy(),this.referenceLayers.destroy(),this.portalItem=et(this.portalItem)}normalizeCtorArgs(t){return t&&"resourceInfo"in t&&(this._set("resourceInfo",t.resourceInfo),delete(t={...t}).resourceInfo),t}set baseLayers(t){this._set("baseLayers",sd(t,this._get("baseLayers")))}_writeBaseLayers(t,e,i){const r=[];t&&(i={...i,layerContainerType:"basemap"},this.baseLayers.forEach(n=>{const s=DQ(n,i.webmap?i.webmap.getLayerJSONFromResourceInfo(n):null,i);s!=null&&r.push(s)}),this.referenceLayers.forEach(n=>{const s=DQ(n,i.webmap?i.webmap.getLayerJSONFromResourceInfo(n):null,i);s!=null&&(n.type!=="scene"&&(s.isReference=!0),r.push(s))})),e.baseMapLayers=r}set referenceLayers(t){this._set("referenceLayers",sd(t,this._get("referenceLayers")))}writeTitle(t,e){e.title=t||"Basemap"}load(t){return this.addResolvingPromise(this._loadFromSource(t)),Promise.resolve(this)}loadAll(){return fj(this,t=>{t(this.baseLayers,this.referenceLayers)})}clone(){const t={id:this.id,title:this.title,portalItem:this.portalItem,baseLayers:this.baseLayers.map(e=>Uk(e)?e.clone():e),referenceLayers:this.referenceLayers.map(e=>Uk(e)?e.clone():e)};return this.loaded&&(t.loadStatus="loaded"),new V4({resourceInfo:this.resourceInfo}).set(t)}read(t,e){this.resourceInfo||this._set("resourceInfo",{data:t,context:e}),super.read(t,e)}write(t,e){var i;return t=t||{},e!=null&&e.origin||(e={origin:"web-map",...e}),super.write(t,e),!this.loaded&&((i=this.resourceInfo)!=null&&i.data.baseMapLayers)&&(t.baseMapLayers=this.resourceInfo.data.baseMapLayers.map(r=>{const n=Re(r);return n.url&&jy(n.url)&&(n.url=`https:${n.url}`),n.templateUrl&&jy(n.templateUrl)&&(n.templateUrl=`https:${n.templateUrl}`),n})),t}async _loadFromSource(t){const{resourceInfo:e,portalItem:i,style:r}=this;St(t);const n=[];if(e){const s=e.context?e.context.url:null;if(n.push(this._loadLayersFromJSON(e.data,s,t)),e.data.id&&!e.data.title){const o=e.data.id;n.push(vdt(o).then(l=>{l&&this.read({title:l},e.context)}))}}else i?n.push(this._loadFromItem(i,t)):r&&n.push(this._loadFromStylesService(r,t));await Promise.all(n)}async _loadLayersFromJSON(t,e,i){var c,f;const r=(c=this.resourceInfo)==null?void 0:c.context,n=((f=this.portalItem)==null?void 0:f.portal)||(r==null?void 0:r.portal)||null,s=Tdt[(r==null?void 0:r.origin)||""]??"web-map",{populateOperationalLayers:o}=await we(()=>import("./layersCreator-aC1PvuFa.js"),__vite__mapDeps([44,35,36])),l=[];if(St(i),t.baseMapLayers&&Array.isArray(t.baseMapLayers)){const _={context:{...r,origin:s,url:e,portal:n,layerContainerType:"basemap"},defaultLayerType:"DefaultTileLayer"},x=M=>s==="web-scene"&&M.layerType==="ArcGISSceneServiceLayer"||M.isReference,T=o(this.baseLayers,t.baseMapLayers.filter(M=>!x(M)),_);l.push(T);const A=o(this.referenceLayers,t.baseMapLayers.filter(x),_);l.push(A)}await Promise.allSettled(l)}async _loadFromItem(t,e){const i=await t.load(e),r=await i.fetchData("json",e),n=qs(t.itemUrl??"");return this._set("resourceInfo",{data:r.baseMap??{},context:{origin:Sdt[t.type||""]??"web-map",portal:t.portal||os.getDefault(),url:n}}),this.read(this.resourceInfo.data,this.resourceInfo.context),this.read({spatialReference:r.spatialReference},this.resourceInfo.context),this.read({title:t.title,thumbnailUrl:t.thumbnailUrl},{origin:"portal-item",portal:t.portal||os.getDefault(),url:n}),this._loadLayersFromJSON(this.resourceInfo.data,n,e)}async _loadFromStylesService(t,e){var s;const i=`${t.serviceUrl}/${t.id}`,r=(await bi(i,{query:{language:t.getLanguageParamValue()},signal:e==null?void 0:e.signal})).data;if(r.baseMap&&Array.isArray(r.baseMap.baseMapLayers)){for(const o of r.baseMap.baseMapLayers)if(!o.customParameters&&((s=o.styleUrl)!=null&&s.includes("?"))){const l=qs(o.styleUrl);l.query&&(o.styleUrl=l.path,o.customParameters=l.query)}}const n=qs(i);return this._set("resourceInfo",{data:r.baseMap??{},context:{origin:"web-map",url:n}}),this.read(this.resourceInfo.data,this.resourceInfo.context),this.read({spatialReference:r.spatialReference},this.resourceInfo.context),this._loadLayersFromJSON(this.resourceInfo.data,n,e)}static fromId(t){const e=u5[t];return e?e.itemId?new V4({portalItem:{id:e.itemId,portal:{url:"https://www.arcgis.com"}}}):V4.fromJSON(e,{origin:e.is3d?"web-scene":"web-map"}):null}};y([w({json:{write:{ignoreOrigin:!0,target:"baseMapLayers",writer(t,e,i,r){this._writeBaseLayers(t,e,r)}},origins:{"web-scene":{write:{ignoreOrigin:!0,target:{baseMapLayers:{type:it}},writer(t,e,i,r){this._writeBaseLayers(t,e,r)}}}}}})],Rd.prototype,"baseLayers",null),y([w({type:String,json:{origins:{"web-scene":{write:!0}}}})],Rd.prototype,"id",void 0),y([w({type:Am})],Rd.prototype,"portalItem",void 0),y([w()],Rd.prototype,"referenceLayers",null),y([w({readOnly:!0})],Rd.prototype,"resourceInfo",void 0),y([w({type:at})],Rd.prototype,"spatialReference",void 0),y([w({type:bdt})],Rd.prototype,"style",void 0),y([w()],Rd.prototype,"thumbnailUrl",void 0),y([w({type:String,json:{origins:{"web-scene":{write:{isRequired:!0}}}}})],Rd.prototype,"title",void 0),y([Pt("title")],Rd.prototype,"writeTitle",null),Rd=V4=y([Z(xdt)],Rd);const Sdt={"Web Scene":"web-scene","Web Map":"web-map","Link Chart":"link-chart"},Tdt={"web-scene":"web-scene","web-map":"web-map","link-chart":"link-chart"},Ay=Rd,Edt=Object.freeze(Object.defineProperty({__proto__:null,default:Ay},Symbol.toStringTag,{value:"Module"}));var NQ;let yF=NQ=class extends Ue{constructor(t){super(t),this.type="none"}clone(){return new NQ({type:this.type})}};y([Vt({none:"none",stayAbove:"stay-above"})],yF.prototype,"type",void 0),yF=NQ=y([Z("esri.ground.NavigationConstraint")],yF);var FQ;let J1=FQ=class extends P_(jf){constructor(t){super(t),this.opacity=1,this.surfaceColor=null,this.navigationConstraint=null,this.layers=new it;const e=r=>{r.parent&&r.parent!==this&&"remove"in r.parent&&r.parent.remove(r),r.parent=this,r.type!=="elevation"&&r.type!=="base-elevation"&&Ce.getLogger(this).error(`Layer '${r.title}, id:${r.id}' of type '${r.type}' is not supported as a ground layer and will therefore be ignored. Only layers of type 'elevation' are supported.`)},i=r=>{r.parent=null};this.addHandles([this.layers.on("after-add",r=>e(r.item)),this.layers.on("after-remove",r=>i(r.item))])}initialize(){this.when().catch(t=>{sn(t)||Ce.getLogger(this).error("#load()","Failed to load ground",t)}),this.resourceInfo&&this.read(this.resourceInfo.data,this.resourceInfo.context)}destroy(){const t=this.layers.removeAll();for(const e of t)et(e);this.layers.destroy()}normalizeCtorArgs(t){return t&&"resourceInfo"in t&&(this._set("resourceInfo",t.resourceInfo),delete(t={...t}).resourceInfo),t}set layers(t){this._set("layers",sd(t,this._get("layers")))}writeLayers(t,e,i,r){const n=[];t&&(r={...r,layerContainerType:"ground"},t.forEach(s=>{if("write"in s){const o={};bnt(s)().write(o,r)&&n.push(o)}else r!=null&&r.messages&&r.messages.push(new se("layer:unsupported",`Layers (${s.title}, ${s.id}) of type '${s.declaredClass}' cannot be persisted in the ground`,{layer:s}))})),e.layers=n}load(t){return this.addResolvingPromise(this._loadFromSource(t)),Promise.resolve(this)}loadAll(){return fj(this,t=>{t(this.layers)})}async queryElevation(t,e){await this.load({signal:e==null?void 0:e.signal});const{ElevationQuery:i}=await we(()=>Promise.resolve().then(()=>zV),void 0);St(e);const r=new i,n=this.layers.filter(i0e).toArray();return r.queryAll(n,t,e)}async createElevationSampler(t,e){await this.load({signal:e==null?void 0:e.signal});const{ElevationQuery:i}=await we(()=>Promise.resolve().then(()=>zV),void 0);St(e);const r=new i,n=this.layers.filter(i0e).toArray();return r.createSamplerAll(n,t,e)}clone(){const t={opacity:this.opacity,surfaceColor:Re(this.surfaceColor),navigationConstraint:Re(this.navigationConstraint),layers:this.layers.slice()};return this.loaded&&(t.loadStatus="loaded"),new FQ({resourceInfo:this.resourceInfo}).set(t)}read(t,e){this.resourceInfo||this._set("resourceInfo",{data:t,context:e}),super.read(t,e)}_loadFromSource(t){const e=this.resourceInfo;return e?this._loadLayersFromJSON(e.data,e.context,t):Promise.resolve()}async _loadLayersFromJSON(t,e,i){const r=(e==null?void 0:e.origin)||"web-scene",n=(e==null?void 0:e.portal)||null,s=(e==null?void 0:e.url)||null,{populateOperationalLayers:o}=await we(()=>import("./layersCreator-aC1PvuFa.js"),__vite__mapDeps([44,35,36]));St(i);const l=[];if(t.layers&&Array.isArray(t.layers)){const c={context:{origin:r,url:s,portal:n,layerContainerType:"ground"},defaultLayerType:"ArcGISTiledElevationServiceLayer"};l.push(o(this.layers,t.layers,c))}await Promise.allSettled(l)}};function Cdt(t){return t&&"createElevationSampler"in t}function i0e(t){return t.type==="elevation"||Cdt(t)}y([w({json:{read:!1}})],J1.prototype,"layers",null),y([Pt("layers")],J1.prototype,"writeLayers",null),y([w({readOnly:!0})],J1.prototype,"resourceInfo",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{type:$n,read:{reader:jT,source:"transparency"},write:{writer:(t,e)=>{e.transparency=DB(t)},target:"transparency"}}})],J1.prototype,"opacity",void 0),y([w({type:qe,json:{type:[$n],write:(t,e)=>{e.surfaceColor=t.toJSON().slice(0,3)}}})],J1.prototype,"surfaceColor",void 0),y([w({type:yF,json:{write:!0}})],J1.prototype,"navigationConstraint",void 0),J1=FQ=y([Z("esri.Ground")],J1);const h5=J1,Adt=[["binary","application/octet-stream","bin",""]];function YQt(t,e){return zRe(e.name,(t==null?void 0:t.supportedFormats)??[])!=null}function XQt(t,e){if(!t)return!1;const i=Mdt(e,t.supportedFormats??[]);return i!=null&&t.editFormats.includes(i)}function FRe(t,e){return joe(Pdt(t,e))}function kRe(t,e){return joe(zRe(t,e))}function ZQt(t,e){return URe(Odt(t,e))}function Mdt(t,e){return kRe(t.name,e)??FRe(t.type,e)}function Boe(t){return[...Adt,...t]}function Odt(t,e){return Boe(e).find(i=>joe(i)===t)}function Pdt(t,e){const i=t.toLowerCase();return Boe(e).find(r=>URe(r)===i)}function zRe(t,e){const i=t.toLowerCase();return Boe(e).find(r=>Rdt(r).some(n=>i.endsWith(n)))}function joe(t){return t==null?void 0:t[0]}function URe(t){return t==null?void 0:t[1].toLowerCase()}function Rdt(t){return(t==null?void 0:t[2].split(",").map(e=>e.toLowerCase()))??[]}function JQt(t){var e;return(e=t.tables)==null?void 0:e.find(i=>i.role==="assetMaps")}function Idt(t){var e,i;return!(!(t&&typeof t=="object"&&"loaded"in t&&t.loaded&&((i=(e=Bnt(t))==null?void 0:e.operations)!=null&&i.supportsEditing)&&"type"in t)||"editingEnabled"in t&&!Gnt(t)||t.type==="scene"&&!$dt(t))}function $dt(t){const{associatedLayer:e}=t,i=e==null?void 0:e.infoFor3D;if(!i)return!0;const{supportedFormats:r,queryFormats:n}=i,s=FRe("model/gltf-binary",r)??kRe("glb",r);if(!(s!=null&&n.includes(s)))return Ce.getLogger("esri.layers.support.editableLayers").warnOnce(`SceneLayer (${t.title??"Untitled layer"}, ${t.id}) is not editable because it does not support GLB queries.`),!1;const o=t.spatialReference,l=e.spatialReference;if(!Zn(o,l))return Ce.getLogger("esri.layers.support.editableLayers").warnOnce(`SceneLayer (${t.title??"Untitled layer"}, ${t.id}) is not editable because its spatial reference (wkid:${o.wkid}) is different from its associated FeatureLayer's spatial reference (wkid:${l.wkid}).`),!1;const c=e.sourceJSON.sourceSpatialReference;return!(c!=null&&!Zn(c,l))||(Ce.getLogger("esri.layers.support.editableLayers").warnOnce(`SceneLayer (${t.title??"Untitled layer"}, ${t.id}) is not editable because the spatial reference of its associated FeatureLayer's service (wkid:${l.wkid}) is different from its source spatial reference (wkid:${c.wkid}).`),!1)}const r0e=Ce.getLogger("esri.support.basemapUtils");function Ldt(){return{}}function Ddt(t){for(const e in t){const i=t[e];et(i),delete t[e]}}function Goe(t,e){let i;if(typeof t=="string"){const r=t in u5,n=!r&&t.includes("/");if(!r&&!n){const s=Object.entries(u5).filter(([o,l])=>Ar.apiKey&&!l.classic||!Ar.apiKey&&(l.classic||l.is3d)).map(([o])=>`"${o}"`).sort().join(", ");return r0e.warn(`Unable to find basemap definition for: ${t}. Try one of these: ${s}`),null}e&&(i=e[t]),i||(i=r?Ay.fromId(t):new Ay({style:{id:t}}),e&&(e[t]=i))}else i=$s(Ay,t);return i!=null&&i.destroyed&&(r0e.warn("The provided basemap is already destroyed",{basemap:i}),i=null),i}function Ndt(t){var e;return((e=t.portalItem)==null?void 0:e.type)==="Web Scene"}function Fdt(t){var e,i;return!!((i=(e=t==null?void 0:t.portalItem)==null?void 0:e.tags)!=null&&i.some(r=>r.toLowerCase()==="beta"))}function KQt(t,e){var i,r,n,s;return((r=(i=t.basemap)==null?void 0:i.referenceLayers)==null?void 0:r.some(o=>o.uid===e))||((s=(n=t.basemap)==null?void 0:n.baseLayers)==null?void 0:s.some(o=>o.uid===e))}function kdt(t,e=null){const i=Goe(t);if(!i)return null;const r=i.clone();return e&&(r.baseLayers=n0e(r.baseLayers,e.baseLayers),r.referenceLayers=n0e(r.referenceLayers,e.referenceLayers)),r}function zdt(t){let e=null;const i=kQ(t),r=!(i!=null&&i.baseLayers.length);for(const n in u5){const s=BRe(i,VRe(u5[n]),{mustMatchReferences:r});if(s==="equal"){e=n;break}s==="base-layers-equal"&&(e=n)}return e}function Udt(t,e){var i,r;return t===e||((i=t==null?void 0:t.portalItem)==null?void 0:i.id)!=null&&t.portalItem.id===((r=e==null?void 0:e.portalItem)==null?void 0:r.id)?!0:BRe(kQ(t),kQ(e),{mustMatchReferences:!0})==="equal"}function n0e(t,e){const i=new it;return t.forEach(r=>{const n=e.find(s=>s.type!=="scene"&&jRe(zQ(r),zQ(s)))||r;i.includes(n)?i.push(r):i.push(n)}),i}function s0e(t){return!!(t!=null&&t.baseLayers.concat(t.referenceLayers).some(Vdt))}function Vdt(t){if(o0e(t.url))return!0;if(t.type==="vector-tile")for(const e in t.sourceNameToSource){const i=t.sourceNameToSource[e];if(o0e(i==null?void 0:i.sourceUrl))return!0}return!1}function Bdt(t,e){var s;if(e==null||t==null)return{spatialReference:null,updating:!1};if(e.loadStatus==="not-loaded")return e.load(),{spatialReference:null,updating:!0};if(e.spatialReference)return{spatialReference:e.spatialReference,updating:!1};if(e.baseLayers.length===0)return{spatialReference:null,updating:!1};const i=e.baseLayers.at(0);switch(i.loadStatus){case"not-loaded":i.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const r=(("supportedSpatialReferences"in i?i.supportedSpatialReferences:null)||["tileInfo"in i?(s=i.tileInfo)==null?void 0:s.spatialReference:i.spatialReference]).filter(Boolean),n=t.spatialReference;return n?{spatialReference:r.find(o=>n.equals(o))??r[0]??null,updating:!1}:{spatialReference:r[0],updating:!1}}const jdt=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function o0e(t){if(!t)return!1;const e=new m2(Gh(t));return!!e.authority&&jdt.test(e.authority)}function kQ(t){return t?!t.loaded&&t.resourceInfo?VRe(t.resourceInfo.data):{baseLayers:a0e(t.baseLayers),referenceLayers:a0e(t.referenceLayers)}:null}function a0e(t){return(it.isCollection(t)?t.toArray():t).map(zQ)}function zQ(t){var e,i;return{type:t.type,effect:"effect"in t?t.effect:void 0,url:GRe("urlTemplate"in t&&t.urlTemplate||t.url||"styleUrl"in t&&t.styleUrl||""),minScale:"minScale"in t&&t.minScale!=null?t.minScale:0,maxScale:"maxScale"in t&&t.maxScale!=null?t.maxScale:0,opacity:t.opacity!=null?t.opacity:1,visible:t.visible==null||!!t.visible,sublayers:t.type!=="map-image"&&t.type!=="wms"||t.sublayers==null||(e=t.sublayers)==null?void 0:e.map(r=>({id:r.id,visible:r.visible})),activeLayerId:t.type==="wmts"?(i=t.activeLayer)==null?void 0:i.id:void 0}}function l0e(t){return t.isReference||t.layerType==="ArcGISSceneServiceLayer"}function VRe(t){return t?{baseLayers:c0e((t.baseMapLayers??[]).filter(e=>!l0e(e))),referenceLayers:c0e((t.baseMapLayers??[]).filter(e=>l0e(e)))}:null}function c0e(t){return t.map(e=>Gdt(e))}function Gdt(t){let e;switch(t.layerType){case"VectorTileLayer":e="vector-tile";break;case"ArcGISTiledMapServiceLayer":e="tile";break;case"ArcGISSceneServiceLayer":e="scene";break;default:e="unknown"}return{type:e,effect:t.effect,url:GRe(t.templateUrl||t.urlTemplate||t.styleUrl||t.url),minScale:t.minScale??0,maxScale:t.maxScale??0,opacity:t.opacity??1,visible:t.visibility==null||!!t.visibility,sublayers:void 0,activeLayerId:void 0}}function BRe(t,e,i){return t!=null!=(e!=null)?"not-equal":!t||!e?"equal":u0e(t.baseLayers,e.baseLayers)?u0e(t.referenceLayers,e.referenceLayers)?"equal":i.mustMatchReferences?"not-equal":"base-layers-equal":"not-equal"}function u0e(t,e){if(t.length!==e.length)return!1;for(let i=0;i{var i,r,n;return[(i=this.basemap)==null?void 0:i.baseLayers,(r=this.ground)==null?void 0:r.layers,this.layers,(n=this.basemap)==null?void 0:n.referenceLayers]},getChildrenFunction:i=>"layers"in i?i.layers:null}),this.allTables=IRe(this),this.basemap=null,this.editableLayers=new GT({getCollections:()=>[this.allLayers],itemFilterFunction:Idt}),this.ground=new h5,this._basemapCache=Ldt()}destroy(){Ddt(this._basemapCache),this._basemapCache=null,this.allLayers.destroy(),this.allTables.destroy(),this.editableLayers.destroy(),this.basemap=et(this.basemap),et(this.ground),this._set("ground",null)}castBasemap(e){return Goe(e,this._basemapCache)}castGround(e){return Wdt(e)??this._get("ground")}findLayerById(e){return this.allLayers.find(i=>i.id===e)}findTableById(e){return this.allTables.find(i=>i.id===e)}};y([w({readOnly:!0,dependsOn:[]})],Ag.prototype,"allLayers",void 0),y([w({readOnly:!0})],Ag.prototype,"allTables",void 0),y([w({type:Ay,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],Ag.prototype,"basemap",void 0),y([Ci("basemap")],Ag.prototype,"castBasemap",null),y([w({readOnly:!0})],Ag.prototype,"editableLayers",void 0),y([w({type:h5,nonNullable:!0})],Ag.prototype,"ground",void 0),y([Ci("ground")],Ag.prototype,"castGround",null),Ag=y([Z("esri.Map")],Ag);const HRe=Ag;let F2=class{constructor(e,i){this.min=e,this.max=i,this.range=i-e}ndiff(e,i=0){return Math.ceil((e-i)/this.range)*this.range+i}_normalize(e,i,r,n=0,s=!1){return(r-=n)i&&(r-=this.ndiff(r-i)),s&&r===i&&(r=e),r+n}normalize(e,i=0,r=!1){return this._normalize(this.min,this.max,e,i,r)}clamp(e,i=0){return Je(e-i,this.min,this.max)+i}monotonic(e,i,r){return ee&&rd5.normalize(Vh(t)))],K1.prototype,"heading",void 0),y([w({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),Ci(t=>Je(Vh(t),-180,180))],K1.prototype,"tilt",void 0),y([w({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],K1.prototype,"fov",void 0),K1=y([Z("esri.Camera")],K1);const cd=K1;var UQ;let tw=UQ=class extends Ue{constructor(t){super(t),this.rotation=0,this.scale=0,this.targetGeometry=null,this.camera=null}castRotation(t){return(t%=360)<0&&(t+=360),t}clone(){return new UQ({rotation:this.rotation,scale:this.scale,targetGeometry:this.targetGeometry!=null?this.targetGeometry.clone():null,camera:this.camera!=null?this.camera.clone():null})}};function YH(){return{enabled:!this.camera}}y([w({type:Number,json:{write:!0,origins:{"web-map":{default:0,write:!0},"web-scene":{write:{overridePolicy:YH}}}}})],tw.prototype,"rotation",void 0),y([Ci("rotation")],tw.prototype,"castRotation",null),y([w({type:Number,json:{write:!0,origins:{"web-map":{default:0,write:!0},"web-scene":{write:{overridePolicy:YH}}}}})],tw.prototype,"scale",void 0),y([w({types:I9,json:{read:O2,write:!0,origins:{"web-scene":{read:O2,write:{overridePolicy:YH}}}}})],tw.prototype,"targetGeometry",void 0),y([w({type:cd,json:{write:!0}})],tw.prototype,"camera",void 0),tw=UQ=y([Z("esri.Viewpoint")],tw);const ih=tw;function Xdt(t,e){if(!t)return null;if(!VQ(t))return new se("webscene:unsupported-height-model-info","The vertical coordinate system of the scene is not supported",{heightModelInfo:t});const i=t.heightUnit,r=N_.deriveUnitFromSR(t,e).heightUnit;return i!==r?new se("webscene:incompatible-height-unit",`The vertical units of the scene (${i}) must match the horizontal units of the scene (${r})`,{verticalUnit:i,horizontalUnit:r}):null}function iei(t,e,i){const r=qRe(t),n=e,s=Zdt(r,n,i);if(r){const o=N_.deriveUnitFromSR(r,t.spatialReference).heightUnit;if(!i&&o!==r.heightUnit){const l=new se("layerview:unmatched-height-unit",`The vertical units of the layer must match the horizontal units (${o})`,{horizontalUnit:o});return new se("layerview:unsupported-height-model-info","The vertical coordinate system of the layer is not supported",{heightModelInfo:r,error:l})}}if(!Jdt(t)||s===Lh.Unsupported)return new se("layerview:unsupported-height-model-info","The vertical coordinate system of the layer is not supported",{heightModelInfo:r});switch(s){case Lh.Units:{const o=(r==null?void 0:r.heightUnit)||"unknown",l=(n==null?void 0:n.heightUnit)||"unknown",c=new se("layerview:incompatible-height-unit",`The vertical units of the layer (${o}) must match the vertical units of the scene (${l})`,{layerUnit:o,sceneUnit:l});return new se("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:r,sceneHeightModelInfo:n,error:c})}case Lh.HeightModel:{const o=(r==null?void 0:r.heightModel)||"unknown",l=(n==null?void 0:n.heightModel)||"unknown",c=new se("layerview:incompatible-height-model",`The height model of the layer (${o}) must match the height model of the scene (${l})`,{layerHeightModel:o,sceneHeightModel:l});return new se("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:r,sceneHeightModelInfo:n,error:c})}case Lh.CRS:{const o=(r==null?void 0:r.vertCRS)||"unknown",l=(n==null?void 0:n.vertCRS)||"unknown",c=new se("layerview:incompatible-vertical-datum",`The vertical datum of the layer (${o}) must match the vertical datum of the scene (${l})`,{layerDatum:o,sceneDatum:l});return new se("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:r,sceneHeightModelInfo:n,error:c})}}return null}function Zdt(t,e,i){if(!VQ(t)||!VQ(e))return Lh.Unsupported;if(t==null||e==null)return Lh.Ok;if(!i&&t.heightUnit!==e.heightUnit)return Lh.Units;if(t.heightModel!==e.heightModel)return Lh.HeightModel;switch(t.heightModel){case"gravity-related-height":return Lh.Ok;case"ellipsoidal":return t.vertCRS===e.vertCRS?Lh.Ok:Lh.CRS;default:return Lh.Unsupported}}var Lh;function VQ(t){return t==null||t.heightModel!=null&&t.heightUnit!=null}function Jdt(t){return"heightModelInfo"in t&&t.heightModelInfo!=null||t.spatialReference!=null||!XRe(t)}function qRe(t){var r;const e=t.url?vE(t.url):void 0;return!(((r=t.spatialReference)==null?void 0:r.vcsWkid)==null&&e!=null&&e.serverType==="ImageServer")&&WRe(t)&&t.heightModelInfo?t.heightModelInfo:XRe(t)?N_.deriveUnitFromSR(Qdt,t.spatialReference):null}function WRe(t){return"heightModelInfo"in t}function YRe(t){if(t.type==="unknown"||!("capabilities"in t))return!1;switch(t.type){case"csv":case"feature":case"geojson":case"subtype-group":case"ogc-feature":case"oriented-imagery":case"wfs":case"knowledge-graph-sublayer":return!0;default:return!1}}function XRe(t){return YRe(t)?!!(t.capabilities&&t.capabilities.data&&t.capabilities.data.supportsZ):ZRe(t)}function Kdt(t){return t.layers!=null||ZRe(t)||YRe(t)||WRe(t)}function ZRe(t){switch(t.type){case"building-scene":case"elevation":case"integrated-mesh":case"point-cloud":case"scene":case"voxel":return!0;case"base-dynamic":case"base-elevation":case"base-tile":case"bing-maps":case"csv":case"dimension":case"geojson":case"feature":case"subtype-group":case"geo-rss":case"graphics":case"group":case"imagery":case"imagery-tile":case"kml":case"knowledge-graph":case"link-chart":case"knowledge-graph-sublayer":case"line-of-sight":case"map-image":case"map-notes":case"media":case"ogc-feature":case"open-street-map":case"oriented-imagery":case"route":case"stream":case"tile":case"unknown":case"unsupported":case"vector-tile":case"video":case"wcs":case"web-tile":case"wfs":case"wms":case"wmts":case null:return!1}return!1}(function(t){t[t.Ok=0]="Ok",t[t.Units=1]="Units",t[t.HeightModel=2]="HeightModel",t[t.CRS=3]="CRS",t[t.Unsupported=4]="Unsupported"})(Lh||(Lh={}));const Qdt=new N_({heightModel:"gravity-related-height"});let iw=class extends Ue{constructor(e){super(e),this.facilityIdField=null,this.layerId=null,this.nameField=null,this.siteIdField=null,this.sublayerId=null}};y([w({type:String,json:{write:!0}})],iw.prototype,"facilityIdField",void 0),y([w({type:String,json:{write:!0}})],iw.prototype,"layerId",void 0),y([w({type:String,json:{write:!0}})],iw.prototype,"nameField",void 0),y([w({type:String,json:{write:!0}})],iw.prototype,"siteIdField",void 0),y([w({type:Number,json:{read:{source:"subLayerId"},write:{target:"subLayerId"},origins:{"web-scene":{read:!1,write:!1}}}})],iw.prototype,"sublayerId",void 0),iw=y([Z("esri.layers.support.FacilityLayerInfo")],iw);const ept=iw;let D0=class extends Ue{constructor(e){super(e),this.facilityIdField=null,this.layerId=null,this.levelIdField=null,this.levelNumberField=null,this.longNameField=null,this.shortNameField=null,this.sublayerId=null,this.verticalOrderField=null}};y([w({type:String,json:{write:!0}})],D0.prototype,"facilityIdField",void 0),y([w({type:String,json:{write:!0}})],D0.prototype,"layerId",void 0),y([w({type:String,json:{write:!0}})],D0.prototype,"levelIdField",void 0),y([w({type:String,json:{write:!0}})],D0.prototype,"levelNumberField",void 0),y([w({type:String,json:{write:!0}})],D0.prototype,"longNameField",void 0),y([w({type:String,json:{write:!0}})],D0.prototype,"shortNameField",void 0),y([w({type:Number,json:{read:{source:"subLayerId"},write:{target:"subLayerId"},origins:{"web-scene":{read:!1,write:!1}}}})],D0.prototype,"sublayerId",void 0),y([w({type:String,json:{write:!0}})],D0.prototype,"verticalOrderField",void 0),D0=y([Z("esri.layers.support.LevelLayerInfo")],D0);const tpt=D0;let V3=class extends Ue{constructor(e){super(e),this.layerId=null,this.nameField=null,this.siteIdField=null,this.sublayerId=null}};y([w({type:String,json:{write:!0}})],V3.prototype,"layerId",void 0),y([w({type:String,json:{write:!0}})],V3.prototype,"nameField",void 0),y([w({type:String,json:{write:!0}})],V3.prototype,"siteIdField",void 0),y([w({type:Number,json:{read:{source:"subLayerId"},write:{target:"subLayerId"},origins:{"web-scene":{read:!1,write:!1}}}})],V3.prototype,"sublayerId",void 0),V3=y([Z("esri.layers.support.SiteLayerInfo")],V3);const ipt=V3;let OA=class extends Ue{constructor(e){super(e),this.levelLayer=null,this.facilityLayer=null,this.siteLayer=null}};y([w({type:tpt,json:{write:!0}})],OA.prototype,"levelLayer",void 0),y([w({type:ept,json:{write:!0}})],OA.prototype,"facilityLayer",void 0),y([w({type:ipt,json:{write:!0}})],OA.prototype,"siteLayer",void 0),OA=y([Z("esri.support.MapFloorInfo")],OA);const rpt=OA,npt="webscene:failed-to-copy-embedded-resources",spt="webscene:schema-validation";function opt(){return new se(npt,"Copying of embedded resources is currently not supported")}function apt(t){return new se(spt,"Failed to save webscene due to schema validation errors. See 'details.errors' for more detailed information",{errors:t})}function p5(t,e){return t!=null&&(e==null||(e===_t.Local?!t.isGeographic||t.isWGS84||t.wkid===wf.CGCS2000:t.isWebMercator||t.isWGS84||t.wkid===wf.CGCS2000||t.wkid===wf.GCSMARS2000||t.wkid===wf.GCSMARS2000_SPHERE||t.wkid===wf.GCSMOON2000))}const lpt={width:600,height:400},SD=1.5;function cpt(t,e){e=e||lpt;let{width:i,height:r}=e;const n=i/r;return nSD&&(i=r*SD),i>t.width&&(r*=t.width/i,i=t.width),r>t.height&&(i*=t.height/r,r=t.height),{width:Math.round(i),height:Math.round(r)}}function d0e(t){return{enabled:!!(t!=null&&t.length)}}var BQ;let PA=BQ=class extends Ue{constructor(t){super(t),this.exactMatch=!1,this.name=null,this.type=null}clone(){return new BQ({exactMatch:this.exactMatch,type:this.type,name:this.name})}};y([w({type:Boolean,json:{write:!0}})],PA.prototype,"exactMatch",void 0),y([w({type:String,json:{write:!0}})],PA.prototype,"name",void 0),y([Vt(foe)],PA.prototype,"type",void 0),PA=BQ=y([Z("esri.webdoc.applicationProperties.SearchLayerField")],PA);const upt=PA;var jQ;let RA=jQ=class extends Ue{constructor(t){super(t),this.field=null,this.id=null,this.subLayer=null}clone(){return new jQ(Re({field:this.field,id:this.id,subLayer:this.subLayer}))}};y([w({type:upt,json:{write:{isRequired:!0}}})],RA.prototype,"field",void 0),y([w({type:String,json:{write:{isRequired:!0}}})],RA.prototype,"id",void 0),y([w({type:$n,json:{write:!0}})],RA.prototype,"subLayer",void 0),RA=jQ=y([Z("esri.webdoc.applicationProperties.SearchLayer")],RA);const hpt=RA;var GQ;let IA=GQ=class extends Ue{constructor(t){super(t),this.exactMatch=!1,this.name=null,this.type=null}clone(){return new GQ({exactMatch:this.exactMatch,type:this.type,name:this.name})}};y([w({type:Boolean,json:{write:!0}})],IA.prototype,"exactMatch",void 0),y([w({type:String,json:{write:!0}})],IA.prototype,"name",void 0),y([Vt(foe)],IA.prototype,"type",void 0),IA=GQ=y([Z("esri.webdoc.applicationProperties.SearchTableField")],IA);const dpt=IA;var HQ;let B4=HQ=class extends Ue{constructor(t){super(t),this.field=null,this.id=null}clone(){return new HQ(Re({field:this.field,id:this.id}))}};y([w({type:dpt,json:{write:{isRequired:!0}}})],B4.prototype,"field",void 0),y([w({type:String,json:{write:{isRequired:!0}}})],B4.prototype,"id",void 0),B4=HQ=y([Z("esri.webdoc.applicationProperties.SearchTable")],B4);const ppt=B4;var qQ;const JRe=it.ofType(hpt),KRe=it.ofType(ppt);let Mg=qQ=class extends Ue{constructor(t){super(t),this.addressSearchEnabled=!0,this.enabled=!0,this.hintText=null,this.layers=new JRe,this.tables=new KRe}readAddressSearchEnabled(t){return!t}writeAddressSearchEnabled(t,e,i){e[i]=!t}clone(){return new qQ(Re({addressSearchEnabled:this.addressSearchEnabled,enabled:this.enabled,hintText:this.hintText,layers:this.layers,tables:this.tables}))}};y([w({type:Boolean,nonNullable:!0,json:{read:{source:"disablePlaceFinder"},write:{target:"disablePlaceFinder",isRequired:!0},origins:{"web-scene":{read:!1,write:!1}}}})],Mg.prototype,"addressSearchEnabled",void 0),y([$t("addressSearchEnabled")],Mg.prototype,"readAddressSearchEnabled",null),y([Pt("addressSearchEnabled")],Mg.prototype,"writeAddressSearchEnabled",null),y([w({type:Boolean,nonNullable:!0,json:{write:!0,origins:{"web-map":{write:{isRequired:!0}},"web-scene":{default:!0,write:!0}}}})],Mg.prototype,"enabled",void 0),y([w({type:String,json:{write:!0}})],Mg.prototype,"hintText",void 0),y([w({type:JRe,json:{write:{overridePolicy:d0e},origins:{"web-scene":{write:{isRequired:!0}}}}})],Mg.prototype,"layers",void 0),y([w({type:KRe,json:{read:!0,write:{overridePolicy:d0e}}})],Mg.prototype,"tables",void 0),Mg=qQ=y([Z("esri.webdoc.applicationProperties.Search")],Mg);const fpt=Mg;var WQ;let vF=WQ=class extends Ue{constructor(t){super(t),this.search=null}clone(){return new WQ(Re({search:this.search}))}};y([w({type:fpt,json:{write:!0}})],vF.prototype,"search",void 0),vF=WQ=y([Z("esri.webdoc.applicationProperties.Viewing")],vF);const mpt=vF;var YQ;let _F=YQ=class extends Ue{constructor(t){super(t),this.viewing=null}clone(){return new YQ({viewing:this.viewing?this.viewing.clone():null})}};y([w({type:mpt,json:{write:!0}})],_F.prototype,"viewing",void 0),_F=YQ=y([Z("esri.webscene.ApplicationProperties")],_F);const gpt=_F;var XQ;let j4=XQ=class extends Ue{constructor(t){super(t),this.type="sunny",this.cloudCover=.5}clone(){return new XQ({cloudCover:this.cloudCover})}};y([Vt({sunny:"sunny"})],j4.prototype,"type",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],j4.prototype,"cloudCover",void 0),j4=XQ=y([Z("esri.views.3d.environment.SunnyWeather")],j4);const sU=j4;var ZQ;let G4=ZQ=class extends Ue{constructor(t){super(t),this.type="cloudy",this.cloudCover=.5}clone(){return new ZQ({cloudCover:this.cloudCover})}};y([Vt({cloudy:"cloudy"})],G4.prototype,"type",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],G4.prototype,"cloudCover",void 0),G4=ZQ=y([Z("esri.views.3d.environment.CloudyWeather")],G4);const ypt=G4;var JQ;let H4=JQ=class extends Ue{constructor(t){super(t),this.type="foggy",this.fogStrength=.5}clone(){return new JQ({fogStrength:this.fogStrength})}};y([Vt({foggy:"foggy"})],H4.prototype,"type",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],H4.prototype,"fogStrength",void 0),H4=JQ=y([Z("esri.views.3d.environment.FoggyWeather")],H4);const vpt=H4;var KQ;let $A=KQ=class extends Ue{constructor(t){super(t),this.type="rainy",this.cloudCover=.5,this.precipitation=.5}clone(){return new KQ({cloudCover:this.cloudCover,precipitation:this.precipitation})}};y([Vt({rainy:"rainy"})],$A.prototype,"type",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],$A.prototype,"cloudCover",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],$A.prototype,"precipitation",void 0),$A=KQ=y([Z("esri.views.3d.environment.RainyWeather")],$A);const _pt=$A;var QQ;let B3=QQ=class extends Ue{constructor(t){super(t),this.type="snowy",this.cloudCover=.5,this.precipitation=.5,this.snowCover="disabled"}clone(){return new QQ({cloudCover:this.cloudCover,precipitation:this.precipitation,snowCover:this.snowCover})}};y([Vt({snowy:"snowy"})],B3.prototype,"type",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],B3.prototype,"cloudCover",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],B3.prototype,"precipitation",void 0),y([w({type:["enabled","disabled"],nonNullable:!0,json:{write:!0}})],B3.prototype,"snowCover",void 0),B3=QQ=y([Z("esri.views.3d.environment.SnowyWeather")],B3);const bpt=B3,qoe={key:"type",base:sU,typeMap:{sunny:sU,cloudy:ypt,rainy:_pt,snowy:bpt,foggy:vpt}},wpt=Object.keys(qoe.typeMap);function xpt(t,e){return!!wpt.includes(t)||(e.error(`"${t}" is not a valid weather type`),!1)}const Pv=1e4,Spt=1e5;var eee;let qp=eee=class extends Ue{constructor(t){super(t),this.type="sun",this.date=null,this.directShadowsEnabled=!1,this.displayUTCOffset=null}readDate(t,e){return e.datetime!=null&&new Date(e.datetime)||null}writeDate(t,e,i){e[i]=t.getTime()}readDirectShadowsEnabled(t,e){return!!e.directShadows}writedirectShadowsEnabled(t,e,i){t&&(e[i]=t)}writeDisplayUTCOffset(t,e){t!=null&&(e.displayUTCOffset=t)}clone(){return new eee(this.cloneConstructProperties())}cloneConstructProperties(){const t={directShadowsEnabled:this.directShadowsEnabled,displayUTCOffset:this.displayUTCOffset!=null?this.displayUTCOffset:null};return this.date!=null&&(t.date=new Date(this.date.getTime())),t}};y([w({readOnly:!0,type:["sun"],json:{write:!0}})],qp.prototype,"type",void 0),y([w({type:Date,json:{type:Number,write:{target:"datetime"}}})],qp.prototype,"date",void 0),y([$t("date",["datetime"])],qp.prototype,"readDate",null),y([Pt("date")],qp.prototype,"writeDate",null),y([w({type:Boolean,json:{default:!1,write:{target:"directShadows"}}})],qp.prototype,"directShadowsEnabled",void 0),y([$t("directShadowsEnabled",["directShadows"])],qp.prototype,"readDirectShadowsEnabled",null),y([Pt("directShadowsEnabled")],qp.prototype,"writedirectShadowsEnabled",null),y([w({type:Number,json:{write:!0}})],qp.prototype,"displayUTCOffset",void 0),y([Pt("displayUTCOffset")],qp.prototype,"writeDisplayUTCOffset",null),qp=eee=y([Z("esri.webscene.SunLighting")],qp);const HT=qp;var tee;let q4=tee=class extends Ue{constructor(t){super(t),this.type="virtual",this.directShadowsEnabled=!1}clone(){return new tee(this.cloneConstructProperties())}cloneConstructProperties(){return{directShadowsEnabled:this.directShadowsEnabled}}};y([w({readOnly:!0,type:["virtual"],json:{write:!0}})],q4.prototype,"type",void 0),y([w({type:Boolean,json:{default:!1,name:"directShadows",write:!0}})],q4.prototype,"directShadowsEnabled",void 0),q4=tee=y([Z("esri.webscene.VirtualLighting")],q4);const B9=q4,QRe={key:"type",defaultKeyValue:"sun",base:null,typeMap:{sun:HT,virtual:B9}};let bF=class extends Ue{constructor(e){super(e)}clone(){}};y([w({readOnly:!0,json:{read:!1}})],bF.prototype,"type",void 0),bF=y([Z("esri.webscene.background.Background")],bF);const e4e=bF;var iee;const Tpt={...$_,nonNullable:!0};let W4=iee=class extends e4e{constructor(t){super(t),this.type="color",this.color=new qe([0,0,0,1])}clone(){return new iee(this.cloneProperties())}cloneProperties(){return{color:this.color.clone()}}};y([Vt({color:"color"},{readOnly:!0})],W4.prototype,"type",void 0),y([w(Tpt)],W4.prototype,"color",void 0),W4=iee=y([Z("esri.webscene.background.ColorBackground")],W4);const t4e=W4,p0e={base:e4e,key:"type",typeMap:{color:t4e}};function Ept(t){return(e,i,r)=>{if(!e)return e;for(const n in t.typeMap)if(e.type===n){const s=new t.typeMap[n];return s.read(e,r),s}}}const Cpt={types:p0e,json:{read:Ept(p0e),write:{overridePolicy:(t,e,i)=>({enabled:!i||!i.isPresentation})}}};var ree;const i4e="esri.webscene.Environment",Apt=Ce.getLogger(i4e),f0e=(t,e,i)=>({enabled:!i||!i.isPresentation});let rw=ree=class extends Ue{constructor(t){super(t),this.lighting=new HT,this.background=null,this.atmosphereEnabled=!0,this.starsEnabled=!0}set weather(t){xpt(t==null?void 0:t.type,Apt)&&this._set("weather",t)}clone(){return new ree(this.cloneConstructProperties())}cloneConstructProperties(){return{lighting:this.lighting&&this.lighting.type==="virtual"?B9.prototype.clone.call(this.lighting):HT.prototype.clone.call(this.lighting),background:Re(this.background),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,weather:this.weather.clone()}}};y([w({types:QRe,nonNullable:!0,json:{write:!0}})],rw.prototype,"lighting",void 0),y([w(Cpt)],rw.prototype,"background",void 0),y([w({type:Boolean,nonNullable:!0,json:{write:{overridePolicy:f0e}}})],rw.prototype,"atmosphereEnabled",void 0),y([w({type:Boolean,nonNullable:!0,json:{write:{overridePolicy:f0e}}})],rw.prototype,"starsEnabled",void 0),y([w({types:qoe,nonNullable:!0,json:{write:!0},value:new sU})],rw.prototype,"weather",null),rw=ree=y([Z(i4e)],rw);const f5=rw;var nee;let j3=nee=class extends Ue{constructor(t){super(t),this.environment=new f5,this.spatialReference=null,this.viewpoint=null}set viewingMode(t){this._set("viewingMode",t)}clone(){return new nee({environment:this.environment.clone(),spatialReference:this.spatialReference?this.spatialReference.clone():null,viewingMode:this.viewingMode,viewpoint:this.viewpoint?this.viewpoint.clone():null})}};y([w({type:f5,json:{write:{isRequired:!0}}})],j3.prototype,"environment",void 0),y([w({type:at})],j3.prototype,"spatialReference",void 0),y([w({type:["local","global"]})],j3.prototype,"viewingMode",null),y([w({type:ih,json:{write:{isRequired:!0}}})],j3.prototype,"viewpoint",void 0),j3=nee=y([Z("esri.webscene.InitialViewProperties")],j3);const oU=j3;let Mpt=class{constructor(e,i){this._observable=new v9,this._value=e,this._equalityFunction=i}get value(){return wi(this._observable),this._value}set value(e){this._equalityFunction(e,this._value)||(this._value=e,this._observable.notify())}mutate(e){e(this._value),this._observable.notify()}};function m5(t,e=Z3e){return new Mpt(t,e)}let Opt=class{constructor(){this._tasks=new Array,this._running=m5(!1)}get length(){return this._tasks.length}get running(){return this._running.value}destroy(){this.cancelAll()}runTask(e){for(;!e.done&&this._process(e);)e.madeProgress()}push(e,i,r){return this._running.value=!0,new Promise((n,s)=>this._tasks.push(new m0e(n,s,e,i,r)))}unshift(e,i,r){return this._running.value=!0,new Promise((n,s)=>this._tasks.unshift(new m0e(n,s,e,i,r)))}_process(e){var r;if(this._tasks.length===0)return!1;const i=this._tasks.shift();try{const n=xo(i.signal);if(n&&!i.abortCallback)i.reject(ur());else{const s=n?(r=i.abortCallback)==null?void 0:r.call(i,ur()):i.callback(e);pd(s)?s.then(i.resolve,i.reject):i.resolve(s)}}catch(n){i.reject(n)}return this._running.value=this._tasks.length>0,!0}cancelAll(){const e=ur();for(const i of this._tasks)if(i.abortCallback){const r=i.abortCallback(e);i.resolve(r)}else i.reject(e);this._tasks.length=0,this._running.value=!1}},m0e=class{constructor(e,i,r,n=void 0,s=void 0){this.resolve=e,this.reject=i,this.callback=r,this.signal=n,this.abortCallback=s}},Y4=class extends ze{constructor(){super(...arguments),this.SCHEDULER_LOG_SLOW_TASKS=!1,this.FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES=!1}};y([w()],Y4.prototype,"SCHEDULER_LOG_SLOW_TASKS",void 0),y([w()],Y4.prototype,"FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES",void 0),Y4=y([Z("esri.views.support.DebugFlags")],Y4);const Ppt=new Y4;var Vr;(function(t){t[t.ANIMATING=0]="ANIMATING",t[t.INTERACTING=1]="INTERACTING",t[t.IDLE=2]="IDLE"})(Vr||(Vr={}));function Rpt(){return new aU.Scheduler}var Xl,ni;(function(t){t[t.YIELD=1]="YIELD"})(Xl||(Xl={})),function(t){t.RESOURCE_CONTROLLER_IMMEDIATE="immediate",t.RESOURCE_CONTROLLER="schedule",t.SLIDE="slide",t.STREAM_DATA_LOADER="stream loader",t.ELEVATION_QUERY="elevation query",t.TERRAIN_SURFACE="terrain",t.SURFACE_GEOMETRY_UPDATES="surface geometry updates",t.LOD_RENDERER="LoD renderer",t.GRAPHICS_CORE="Graphics3D",t.I3S_CONTROLLER="I3S",t.POINT_CLOUD_LAYER="point cloud",t.FEATURE_TILE_FETCHER="feature fetcher",t.OVERLAY="overlay",t.STAGE="stage",t.GRAPHICS_DECONFLICTOR="graphics deconflictor",t.FILTER_VISIBILITY="Graphics3D filter visibility",t.SCALE_VISIBILITY="Graphics3D scale visibility",t.FRUSTUM_VISIBILITY="Graphics3D frustum visibility",t.POINT_OF_INTEREST_FREQUENT="POI frequent",t.POINT_OF_INTEREST_INFREQUENT="POI infrequent",t.LABELER="labeler",t.FEATURE_QUERY_ENGINE="feature query",t.FEATURE_TILE_TREE="feature tile tree",t.FEATURE_TILE_TREE_ACTIVE="fast feature tile tree",t.ELEVATION_ALIGNMENT="elevation alignment",t.TEXT_TEXTURE_ATLAS="text texture atlas",t.TEXTURE_UNLOAD="texture unload",t.LINE_OF_SIGHT_TOOL="line of sight tool",t.LINE_OF_SIGHT_TOOL_INTERACTIVE="interactive line of sight tool",t.ELEVATION_PROFILE="elevation profile",t.SNAPPING="snapping",t.SHADOW_ACCUMULATOR="shadow accumulator",t.CLOUDS_GENERATOR="clouds generator",t[t.NONE=0]="NONE",t[t.TEST_PRIO=1]="TEST_PRIO"}(ni||(ni={}));const iy=0,g0e=new Map([[ni.RESOURCE_CONTROLLER_IMMEDIATE,iy],[ni.RESOURCE_CONTROLLER,4],[ni.SLIDE,iy],[ni.STREAM_DATA_LOADER,iy],[ni.ELEVATION_QUERY,iy],[ni.TERRAIN_SURFACE,1],[ni.SURFACE_GEOMETRY_UPDATES,1],[ni.LOD_RENDERER,2],[ni.GRAPHICS_CORE,2],[ni.I3S_CONTROLLER,2],[ni.POINT_CLOUD_LAYER,2],[ni.FEATURE_TILE_FETCHER,2],[ni.OVERLAY,4],[ni.STAGE,4],[ni.GRAPHICS_DECONFLICTOR,4],[ni.FILTER_VISIBILITY,4],[ni.SCALE_VISIBILITY,4],[ni.FRUSTUM_VISIBILITY,4],[ni.CLOUDS_GENERATOR,4],[ni.POINT_OF_INTEREST_FREQUENT,6],[ni.POINT_OF_INTEREST_INFREQUENT,30],[ni.LABELER,8],[ni.FEATURE_QUERY_ENGINE,8],[ni.FEATURE_TILE_TREE,16],[ni.FEATURE_TILE_TREE_ACTIVE,iy],[ni.ELEVATION_ALIGNMENT,12],[ni.TEXT_TEXTURE_ATLAS,12],[ni.TEXTURE_UNLOAD,12],[ni.LINE_OF_SIGHT_TOOL,16],[ni.LINE_OF_SIGHT_TOOL_INTERACTIVE,iy],[ni.SNAPPING,iy],[ni.SHADOW_ACCUMULATOR,30]]);function y0e(t){return g0e.has(t)?g0e.get(t):typeof t=="number"?t:1}const v0e=6.5,_0e=1,Ipt=30,b0e=1e3/30,w0e=100,x0e=.9;var aU,wx;(function(t){class e{get updating(){return this._updating.value}_updatingChanged(){this._updating.value=this._tasks.some(s=>s.needsUpdate)}constructor(){this._updating=m5(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new zv("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new r,this._state=Vr.INTERACTING,this._tasks=new Pi,this._runQueue=new Pi,this._load=0,this._idleStateCallbacks=new Pi,this._idleUpdatesStartFired=!1,this._forceTask=!1,this._debug=!1,this._debugHandle=_e(()=>Ppt.SCHEDULER_LOG_SLOW_TASKS,o=>this._debug=o,ii);for(const o of Object.keys(ni))this.performanceInfo.tasks.set(ni[o],new zv(ni[o]));const s=this;this._test={FRAME_SAFETY_BUDGET:v0e,INTERACTING_BUDGET:b0e,IDLE_BUDGET:w0e,get availableBudget(){return s._budget.budget},usedBudget:0,getBudget:()=>s._budget,setBudget:o=>s._budget=o,updateTask:o=>this._updateTask(o),getState:o=>this._getState(o),getRuntime:o=>this._getRuntime(o),frameTaskTimes:this._frameTaskTimes,resetRuntimes:()=>this._resetRuntimes(),getRunning:()=>this._getRunning()}}destroy(){this._tasks.toArray().forEach(s=>s.remove()),this._tasks.clear(),en(this._debugHandle),this._microTaskQueued=!1,this._updatingChanged()}taskRunningChanged(s){this._updatingChanged(),s&&this._budget.remaining>0&&!this._microTaskQueued&&(this._microTaskQueued=!0,queueMicrotask(()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.remaining>0&&this._schedule()&&this.frame())}))}registerTask(s,o){const l=y0e(s),c=new i(this,s,o,l);return this._tasks.push(c),this._updatingChanged(),this.performanceInfo.tasks.has(s)||this.performanceInfo.tasks.set(s,new zv(s)),c}registerIdleStateCallbacks(s,o){const l={idleBegin:s,idleEnd:o};this._idleStateCallbacks.push(l),this.state===Vr.IDLE&&this._idleUpdatesStartFired&&l.idleBegin();const c=this;return{remove:()=>this._removeIdleStateCallbacks(l),set idleBegin(f){c._idleUpdatesStartFired&&(l.idleEnd(),c._state===Vr.IDLE&&f()),l.idleBegin=f},set idleEnd(f){l.idleEnd=f}}}get load(){return this._load}set state(s){this._state!==s&&(this._state=s,this.state!==Vr.IDLE&&this._idleUpdatesStartFired&&(this._idleUpdatesStartFired=!1,this._idleStateCallbacks.forAll(o=>o.idleEnd())))}get state(){return this._state}updateBudget(s){this._test.usedBudget=0,++this._frameNumber;let o=v0e,l=s.frameDuration,c=_0e;switch(this.state){case Vr.IDLE:o=0,l=Math.max(w0e,s.frameDuration),c=Ipt;break;case Vr.INTERACTING:l=Math.max(b0e,s.frameDuration);case Vr.ANIMATING:}return l=l-s.elapsedFrameTime-o,this.state!==Vr.IDLE&&l<_0e&&!this._forceTask?(this._forceTask=!0,!1):(l=Math.max(l,c),this._budget.reset(l,this.state),this._updateLoad(),this._schedule())}frame(){switch(this._forceTask=!1,this._microTaskQueued=!1,this.state){case Vr.IDLE:this._idleUpdatesStartFired||(this._idleUpdatesStartFired=!0,this._idleStateCallbacks.forAll(s=>s.idleBegin())),this._runIdle();break;case Vr.INTERACTING:this._runInteracting();break;default:this._runAnimating()}this._test.usedBudget=this._budget.elapsed}stopFrame(){this._budget.reset(0,this._state),this._budget.madeProgress()}_removeIdleStateCallbacks(s){this._idleUpdatesStartFired&&s.idleEnd(),this._idleStateCallbacks.removeUnordered(s)}removeTask(s){this._tasks.removeUnordered(s),this._runQueue.removeUnordered(s),this._updatingChanged()}_updateTask(s){this._tasks.forAll(o=>{o.name===s&&o.setPriority(s)})}_getState(s){if(this._runQueue.some(l=>l.name===s))return wx.SCHEDULED;let o=wx.IDLE;return this._tasks.forAll(l=>{l.name===s&&l.needsUpdate&&(l.schedulePriority<=1?o=wx.READY:o!==wx.READY&&(o=wx.WAITING))}),o}_getRuntime(s){let o=0;return this._tasks.forAll(l=>{l.name===s&&(o+=l.runtime)}),o}_resetRuntimes(){this._tasks.forAll(s=>s.runtime=0)}_getRunning(){const s=new Map;if(this._tasks.forAll(l=>{l.needsUpdate&&s.set(l.name,(s.get(l.name)||0)+1)}),s.size===0)return null;let o="";return s.forEach((l,c)=>{o+=l>1?` ${l}x ${c}`:` ${c}`}),o}_runIdle(){this._run()}_runInteracting(){this._run()}_runAnimating(){this._run()}_updateLoad(){const s=this._tasks.reduce((o,l)=>l.needsUpdate?++o:o,0);this._load=this._load*x0e+s*(1-x0e)}_schedule(){for(this._runQueue.filterInPlace(s=>!!s.needsUpdate||(s.schedulePriority=s.basePriority,!1)),this._tasks.forAll(s=>{s.basePriority===iy&&s.needsUpdate&&!this._runQueue.includes(s)&&s.blockFrame!==this._frameNumber&&this._runQueue.unshift(s)});this._runQueue.length===0;){let s=!1,o=0;if(this._tasks.forAll(l=>{l.needsUpdate&&l.schedulePriority!==0&&l.basePriority!==iy&&l.blockFrame!==this._frameNumber&&(s=!0,o=Math.max(o,l.basePriority),l.schedulePriority===1?(l.schedulePriority=0,this._runQueue.push(l)):--l.schedulePriority)}),!s)return this._updatingChanged(),!1}return this._updatingChanged(),!0}_run(){const s=this._budget.now();this._startFrameTaskTimes();do for(;this._runQueue.length>0;){const o=this._budget.now(),l=this._runQueue.pop();this._budget.resetProgress();try{l.task.runTask(this._budget)===Xl.YIELD&&(l.blockFrame=this._frameNumber)}catch(f){Ce.getLogger("esri.views.support.Scheduler").error(`Exception in task "${l.name}"`,f),l.blockFrame=this._frameNumber}!this._budget.hasProgressed&&l.blockFrame!==this._frameNumber&&l.needsUpdate&&(l.name,ni.I3S_CONTROLLER,l.blockFrame=this._frameNumber),l.schedulePriority=l.basePriority;const c=this._budget.now()-o;if(l.runtime+=c,this._frameTaskTimes.set(l.priority,this._frameTaskTimes.get(l.priority)+c),this._debug&&c>2*this._budget.budget&&console.log("Task",l.name,"used",c,"of max",this._budget.budget,"ms"),this._budget.remaining<=0)return this._updatingChanged(),void this._recordFrameTaskTimes(this._budget.now()-s)}while(this._schedule());this._updatingChanged(),this._recordFrameTaskTimes(this._budget.now()-s)}_startFrameTaskTimes(){for(const s of Object.keys(ni))this._frameTaskTimes.set(ni[s],0)}_recordFrameTaskTimes(s){this._frameTaskTimes.forEach((o,l)=>this.performanceInfo.tasks.get(l).record(o)),this.performanceInfo.total.record(s)}get test(){return this._test}}t.Scheduler=e;class i{get task(){return this._task.value}get updating(){return this._queue.running}constructor(s,o,l,c){this._scheduler=s,this.name=o,this._basePriority=c,this.blockFrame=0,this.runtime=0,this._queue=new Opt,this._handles=new O_,this.schedulePriority=this._basePriority,this._task=m5(l??this._queue),this._handles.add(Mo(()=>this.task.running,f=>s.taskRunningChanged(f)))}remove(){this.processQueue(ou),this._scheduler.removeTask(this),this.schedule=g5.schedule,this.reschedule=g5.reschedule,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(s){this.name=s;const o=y0e(s);this._basePriority!==iy&&this.schedulePriority===0||(this.schedulePriority=o),this._basePriority=o}get priority(){return this.name}set priority(s){this.setPriority(s)}get needsUpdate(){return this.updating||this.task.running}schedule(s,o,l){return this._queue.push(s,o,l)}reschedule(s,o,l){return this._queue.unshift(s,o,l)}processQueue(s){this._queue.runTask(s)}}class r{constructor(){this._begin=typeof performance<"u"?performance.now():0,this._budget=0,this._state=Vr.IDLE,this._done=!1,this._progressed=!1,this._enabled=!0}run(s){return!this.done&&(s()===!0&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get state(){return this._state}get enabled(){return this._enabled}set enabled(s){this._enabled=s}reset(s,o){this._begin=this.now(),this._budget=s,this._state=o,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return performance.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}}t.Budget=r})(aU||(aU={})),function(t){t.SCHEDULED="s",t.READY="r",t.WAITING="w",t.IDLE="i"}(wx||(wx={}));const ou=(()=>{const t=new aU.Budget;return t.enabled=!1,t})();let $pt=class{remove(){}processQueue(){}schedule(e,i,r){try{if(xo(i)){const n=ur();return r?Promise.resolve(r(n)):Promise.reject(n)}return JX(e(ou))}catch(n){return Promise.reject(n)}}reschedule(e,i,r){return this.schedule(e,i,r)}};const g5=new $pt;var see;let Gv=see=class extends Ue{constructor(){super(...arguments),this.url=""}destroy(){this.url=""}clone(){return new see({url:this.url})}};y([w({type:String,json:{write:{isRequired:!0}}})],Gv.prototype,"url",void 0),Gv=see=y([Z("esri.webdoc.support.SlideThumbnail")],Gv);var oee;let wF=oee=class extends Ue{constructor(){super(...arguments),this.text=""}clone(){return new oee({text:this.text})}};y([w({type:String,json:{write:!0}})],wF.prototype,"text",void 0),wF=oee=y([Z("esri.webscene.support.Description")],wF);const xF=wF;var aee;let MM=aee=class extends Ue{constructor(){super(...arguments),this.lighting=new HT,this.weather=new sU}clone(){return new aee({lighting:Re(this.lighting),weather:Re(this.weather)})}};y([w({types:QRe,json:{write:!0}})],MM.prototype,"lighting",void 0),y([w({types:qoe,json:{write:!0}})],MM.prototype,"weather",void 0),MM=aee=y([Z("esri.webscene.Environment")],MM);var SF;let TF=SF=class extends Ue{constructor(){super(...arguments),this.opacity=null}clone(){return new SF({opacity:this.opacity})}cloneAndApplyTo(t){return this.opacity==null||((t=(t==null?void 0:t.clone())??new h5).opacity=this.opacity),t}static fromGround(t){return new SF({opacity:t.opacity})}};y([w({type:Number,json:{type:$n,read:{reader:jT,source:"transparency"},write:{writer:(t,e)=>{e.transparency=DB(t)},target:"transparency"}}})],TF.prototype,"opacity",void 0),TF=SF=y([Z("esri.webscene.support.SlideGround")],TF);const r4e=TF;var lee;let OM=lee=class extends Ue{constructor(t){super(t),this.id="",this.sublayerIds=null}clone(){return new lee({id:this.id,sublayerIds:Re(this.sublayerIds)})}};y([w({type:String,json:{write:!0}})],OM.prototype,"id",void 0),y([w({type:[$n],json:{read:{source:"subLayerIds"},write:{target:"subLayerIds"}}})],OM.prototype,"sublayerIds",void 0),OM=lee=y([Z("esri.webscene.support.SlideVisibleLayer")],OM);var cee;let EF=cee=class extends Ue{constructor(){super(...arguments),this.text=""}clone(){return new cee({text:this.text})}};y([w({type:String,json:{write:{isRequired:!0}}})],EF.prototype,"text",void 0),EF=cee=y([Z("esri.webscene.support.Title")],EF);const d$=EF;let Lpt=0;const uee=it.ofType(OM);let Nl=class extends Ue{constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+Lpt++,this.title=new d$,this.description=new xF,this.hidden=!1,this.thumbnail=new Gv,this.viewpoint=null,this.basemap=null,this.ground=null,this.environment=new MM,this.visibleLayers=new uee}destroy(){this.visibleLayers.removeAll(),this.basemap=null,this.thumbnail=et(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null}castTitle(e){return typeof e=="string"?new d$({text:e}):$s(d$,e)}castDescription(e){return typeof e=="string"?new xF({text:e}):$s(xF,e)}castThumbnail(e){return typeof e=="string"?new Gv({url:e}):$s(Gv,e)}castBasemap(e){return Goe(e)}set visibleLayers(e){this._set("visibleLayers",sd(e,this._get("visibleLayers"),uee))}castVisibleLayers(e){return e&&typeof e.map=="function"?e.map(i=>{if(typeof i=="string")return{id:i};if(i instanceof uE){const r=S0e(i);return{id:i.id,sublayerIds:r}}return i.id?{id:i.id,sublayerIds:"sublayerIds"in i?i.sublayerIds:void 0}:(Ce.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),i)}):null}clone(){var e,i;return new this.constructor({id:this.id,title:this.title.clone(),thumbnail:this.thumbnail.clone(),description:this.description&&this.description.clone()||null,viewpoint:this.viewpoint&&this.viewpoint.clone()||null,basemap:((e=this.basemap)==null?void 0:e.clone())||null,ground:((i=this.ground)==null?void 0:i.clone())||null,visibleLayers:this.visibleLayers.clone(),environment:this.environment&&this.environment.clone()||null,hidden:this.hidden})}async _updateVisibleLayersFrom(e){const i=[];await Promise.allSettled(this._getLayers(e.map).map(r=>e.whenLayerView(r).then(n=>{if(n.visible){const s=S0e(r);i.push(new OM({id:n.layer.id,sublayerIds:s}))}})).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(i)}updateFrom(e,i){const r={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...i==null?void 0:i.screenshot};return e.when(()=>(this.viewpoint=e.viewpoint.clone(),this.environment.lighting=e.environment.lighting.type==="virtual"?B9.prototype.clone.apply(e.environment.lighting):HT.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.basemap=e.map.basemap&&e.map.basemap.clone()||null,this.ground=e.map.ground?r4e.fromGround(e.map.ground):null,this._updateVisibleLayersFrom(e))).then(()=>e.takeScreenshot(r)).then(n=>(this.thumbnail=new Gv({url:n.dataUrl}),this))}async applyTo(e,i){this._applyToController!=null&&this._applyToController.abort();let r=new AbortController;this._applyToController=r;const n=g9(i,()=>r==null?void 0:r.abort()),s=e.resourceController.scheduler.registerTask(ni.SLIDE);let o=!1;const l={animate:!0,...i,signal:this._applyToController.signal},c=async()=>{await Promise.all([s.schedule(async()=>o=await this._setViewpointOfInterest(e,l)),s.schedule(()=>this._applyBasemap(e,l),l.signal)]),await this._loadLayersWithSublayerVisibility(e),await Promise.all([s.schedule(()=>this._applyLayerVisibility(e),l.signal),s.schedule(()=>this._applyGround(e),l.signal),s.schedule(()=>this._applyViewpoint(e,l),l.signal)]),await s.schedule(()=>e.environment.weather=this.environment.weather.clone())},f=await Ju(e.addUpdatingPromise(c()));if(o&&(e.contentCamera=null),s.remove(),this._applyToController===r&&(this._applyToController=null),r=null,n==null||n.remove(),f.ok===!1)throw f.error;return this}async _applyBasemap(e,i){if(this.basemap){try{await this.basemap.load(i)}catch(r){if(sn(r))throw r}e.map.basemap=kdt(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_getLayers(e){const i=new it;return this._collectLayers(e,i),this._collectLayers(e.ground,i),i}_collectLayers(e,i){e.layers.forEach(r=>{r.persistenceEnabled&&(i.add(r),"layers"in r&&this._collectLayers(r,i))})}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map(i=>{var n;return((n=this.visibleLayers.find(s=>s.id===i.id))==null?void 0:n.sublayerIds)?i.load():null}))}_applyLayerVisibility(e){this.visibleLayers&&this._getLayers(e.map).forEach(i=>{const r=this.visibleLayers.find(o=>o.id===i.id);i.visible=r!=null;const n=r==null?void 0:r.sublayerIds,s=n4e(i);n&&s&&s.forEach(o=>o.visible=n.includes(o.id))})}async _setViewpointOfInterest(e,i){if(e.state.fixedContentCamera||!this.viewpoint||i!=null&&i.ignoreViewpoint||!(i!=null&&i.useDestinationCamera))return!1;const{toCameraAsync:r}=await we(()=>Promise.resolve().then(()=>Swt),void 0),n=await r(e,this.viewpoint);return e.contentCamera=n,n!=null}async _applyViewpoint(e,i){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!i.ignoreViewpoint){this.viewpoint.camera!=null&&(this.viewpoint.camera.fov=e.camera.fov);const r=this.environment.lighting;if(i.animate&&r.type==="sun"&&r.date)return this._animateToLighting(e,i);i.animate&&(e.environment.applyLighting(r.clone()),await e.goTo(this.viewpoint,i)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,i){let r=null;return e.environment.lighting.type!=="virtual"&&this.environment.lighting.type!=="virtual"&&(e.viewingMode==="global"&&(r=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,this.environment.lighting.type==="virtual"||e.environment.lighting.type==="virtual"?(e.environment.applyLighting(this.environment.lighting.clone()),e.environment.lighting.type!=="virtual"&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):this.environment.lighting.displayUTCOffset!=null&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset),e.goTo(this.viewpoint,i).then(()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())}).catch(n=>{throw e.animation==null&&this._applyCachedCameraTrackingEnabled(e),n}).finally(()=>{en(r)})}_applyCachedCameraTrackingEnabled(e){e.environment.cachedCameraTrackingEnabled!=null&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[e.getTime(),3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds()]}_setTime(e,i,r){return e.setTime(i),e.setUTCHours(r/3600),e.setUTCMinutes(r%3600/60),e.setUTCSeconds(r%3600%60),e}_animateLightingWithCamera(e,i,r){const n=new Date(i.date.toString()),[s,o]=this._getTime(n),[l,c]=this._getTime(r.date),f=Dpt(o,c),_=e.renderCoordsHelper,x=W();_.toRenderCoords(e.camera.position,x);const T=W(),A=W();this.viewpoint.camera!=null&&_.toRenderCoords(this.viewpoint.camera.position,T);const M=new Date;return Mo(()=>e.camera,I=>{_.toRenderCoords(I.position,A);const L=Co(x,A),F=Co(T,A);let z=0;L+F!==0&&(z=L/(L+F));const k=s+(l-s)*z,U=Npt(o,f*z);i.date=this._setTime(M,k,U)})}static createFrom(e,i){return new this().updateFrom(e,i)}};function n4e(t){if(t.type==="building-scene"||t.type==="map-image")return t.allSublayers.toArray()}function S0e(t){const e=n4e(t);if(e)return e.filter(i=>i.visible).map(i=>i.id)}y([w({type:String,json:{write:{isRequired:!0}}})],Nl.prototype,"id",void 0),y([w({type:d$,json:{default:()=>new d$({text:""}),write:{isRequired:!0}}})],Nl.prototype,"title",void 0),y([Ci("title")],Nl.prototype,"castTitle",null),y([w({type:xF,json:{write:{overridePolicy:t=>({enabled:!(!t||!t.text)})}}})],Nl.prototype,"description",void 0),y([Ci("description")],Nl.prototype,"castDescription",null),y([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],Nl.prototype,"hidden",void 0),y([w({type:Gv,json:{default:()=>new Gv({url:""}),write:{isRequired:!0}}})],Nl.prototype,"thumbnail",void 0),y([Ci("thumbnail")],Nl.prototype,"castThumbnail",null),y([w({type:ih,nonNullable:!0,json:{write:{isRequired:!0}}})],Nl.prototype,"viewpoint",void 0),y([w({type:Ay,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],Nl.prototype,"basemap",void 0),y([Ci("basemap")],Nl.prototype,"castBasemap",null),y([w({type:r4e,json:{write:!0}})],Nl.prototype,"ground",void 0),y([w({type:uee,json:{write:{isRequired:!0}}})],Nl.prototype,"visibleLayers",null),y([Ci("visibleLayers")],Nl.prototype,"castVisibleLayers",null),y([w({type:MM,json:{write:!0}})],Nl.prototype,"environment",void 0),Nl=y([Z("esri.webscene.Slide")],Nl);const hee=86400,T0e=43200;function Dpt(t,e){let i=e-t;return i>T0e&&(i-=hee),i<-T0e&&(i+=hee),i}function Npt(t,e){return xet(t+e,hee)}const Fpt=Nl,dee=it.ofType(Fpt);let CF=class extends Ue{constructor(e){super(e),this.slides=new dee}destroy(){this.slides.forEach(e=>e.destroy()),this.slides.removeAll()}set slides(e){e&&(e=e.filter(i=>!!i.viewpoint)),this._set("slides",sd(e,this._get("slides"),dee))}clone(){return new this.constructor({slides:this.slides.clone()})}};y([w({type:dee,nonNullable:!0,json:{write:!0}}),Ci(nP)],CF.prototype,"slides",null),CF=y([Z("esri.webscene.Presentation")],CF);const s4e=CF;var pee;let LA=pee=class extends Ue{constructor(t){super(t)}clone(){return new pee({name:this.name,path:this.path,title:this.title})}};y([w({type:String,json:{write:!0}})],LA.prototype,"name",void 0),y([w({type:String,json:{write:!0}})],LA.prototype,"path",void 0),y([w({type:String,json:{write:!0}})],LA.prototype,"title",void 0),LA=pee=y([Z("esri.webscene.TransportationNetwork")],LA);const kpt=LA;let lU=class extends $2{constructor(e,i){super(e,i,"webscene")}get supportsGround(){return this.since(1,8)}get supportsVisibleElevationLayersInSlides(){return this.lessThan(1,8)}},zpt=null;function Upt(){return zpt}var o4e;const mT=new lU(1,32),Vpt=()=>{const e=[],i=mT.major;for(let r=8;r<=mT.minor;r++)e.push(`${i}.${r}`);return e},XH="Web Scene";let bn=class extends jf.LoadableMixin(S9(fP(HRe))){constructor(e){super(e),this[o4e]=!0,this._layersIdGCTimeoutId=void 0,this._updateFromPromise=null,this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=void 0,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new s4e,this.initialViewProperties=new oU,this.portalItem=null,this.resourceInfo=null,this._debouncedSaveOperations=X5(async(i,r,n)=>{switch(i){case fy.SAVE:return this._saveImpl(r);case fy.SAVE_AS:return this._saveAsImpl(n,r)}}),this._resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch(e=>{Ce.getLogger(this).error("#load()","Failed to load web scene",e)}),this.resourceInfo){let e;try{e=this._validateJSON(this.resourceInfo)}catch(i){return void this.addResolvingPromise(Promise.reject(i))}this.read(e),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this.addHandles(Jr(()=>this.allLayers,"change",()=>this._scheduleLayersIdGC()))}destroy(){this._unscheduleLayersIdGC(),this.presentation&&this.presentation.destroy(),this.portalItem=et(this.portalItem)}writeClippingArea(e,i){i.clippingArea||(i.clippingArea={}),i.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,i){return!!i.clippingArea&&!!i.clippingArea.clip}writeClippingEnabled(e,i){this.clippingArea&&(i.clippingArea||(i.clippingArea={}),i.clippingArea.clip=e)}writeLayers(e,i,r,n){i[r]=this._layersToJSON(e,"operational-layers",n)}readSourceVersion(e,i){const[r,n]=i.version.split(".");return new lU(parseInt(r,10),parseInt(n,10))}writeSourceVersion(e,i,r){i[r]=`${mT.major}.${mT.minor}`}writeTables(e,i,r,n){const s=this._layersToJSON(e,"tables",n);s.length&&(i[r]=s)}get thumbnailUrl(){var e;return((e=this.portalItem)==null?void 0:e.thumbnailUrl)??null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,i){e&&this._isAuthoringAppSetByUser?i.authoringApp=e:i.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,i){e&&this._isAuthoringAppVersionSetByUser?i.authoringAppVersion=e:i.authoringAppVersion=wEe}writeGround(e,i,r,n){i[r]=e?e.write({},n):{transparency:0,layers:[]}}readInitialViewProperties(e,i){var n,s;const r={};return(n=i.initialState)!=null&&n.environment&&(r.environment=f5.fromJSON(i.initialState.environment)),r.spatialReference=i.spatialReference?at.fromJSON(i.spatialReference):at.WebMercator,r.viewingMode=i.viewingMode??"global",(s=i.initialState)!=null&&s.viewpoint&&(r.viewpoint=ih.fromJSON(i.initialState.viewpoint)),new oU(r)}get spatialReference(){var e;return((e=this.initialViewProperties)==null?void 0:e.spatialReference)??at.WebMercator}get viewingMode(){var e;return((e=this.initialViewProperties)==null?void 0:e.viewingMode)??"global"}load(e){const i=this.ground;return this.addResolvingPromise(this._loadFromSource().then(()=>{i&&i!==this.ground&&i.destroy()})),Promise.resolve(this)}loadAll(){return fj(this,e=>{const i=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,i&&i.map(r=>r.basemap),this.tables)})}read(e,i){var s;i={...i,origin:"web-scene"};const r=this._isAuthoringAppVersionSetByUser,n=this._isAuthoringAppSetByUser;if(nEe(this,e,o=>super.read(e,o),i),n||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&((s=this.sourceVersion)==null?void 0:s.supportsVisibleElevationLayersInSlides)){const o=e.baseMap.elevationLayers.map(_=>({id:_.id})),l=this.presentation.slides,c=(_,x)=>_.visibleLayers.some(T=>T.id===x),f=o.filter(_=>!l.some(x=>c(x,_.id)));l.forEach(_=>{_.visibleLayers.addMany(f)})}}_writeBasemapElevationLayers(e){var r;const i=(r=e.ground)==null?void 0:r.layers;!e.baseMap&&(i!=null&&i.length)&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=Re(i))}_layersToJSON(e,i,r){const n={...r,layerContainerType:i};return e.map(s=>this._verifyWritableLayer(s,r)?s.write({},n):null).filter(s=>!!s).toArray()}_verifyWritableLayer(e,i){return!!e.persistenceEnabled&&("write"in e||(i!=null&&i.messages&&i.messages.push(new se("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1))}write(e,i){var s;if(this.loadStatus!=="loaded"){const o=new se("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw Ce.getLogger(this).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),o}this._runLayersIdGC();const r=!(i!=null&&i.messages);i={messages:[],...i,origin:"web-scene"};const n=super.write(e,i);if(r){const o=((s=i.messages)==null?void 0:s.filter(l=>l.name==="web-document-write:property-required"))??[];if(o.length){const l=new se("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:o});throw Ce.getLogger(this).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",o),l}}return this._writeBasemapElevationLayers(n),n}async save(e){return this._debouncedSaveOperations(fy.SAVE,e)}async _saveImpl(e){var s;if(!this.portalItem)throw new se("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene");if(Kz(this.portalItem),((s=this.portalItem)==null?void 0:s.type)!==XH)throw new se("webscene:portal-item-wrong-type",`Portal item needs to have type "${XH}"`);const i=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:this.portalItem.itemUrl?qs(this.portalItem.itemUrl):null,messages:[],portal:this.portalItem.portal??os.getDefault(),portalItem:this.portalItem,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),n=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(n,r,e),this._updateTypeKeywords(this.portalItem),await Z5e(this.portalItem,n,this._resourceReferences,r,null),Zz(r),i&&await i,await this._saveThumbnail(),this.portalItem}async saveAs(e,i){return this._debouncedSaveOperations(fy.SAVE_AS,i,e)}async _saveAsImpl(e,i){let r=Am.from(e);if(!r)throw new se("webscene:portal-item-required","saveAs requires a portal item to save to");Kz(r),r.id&&(r=r.clone(),r.id=null);const n=r.portal||os.getDefault();await this._ensureLoadBeforeSave(),r.type=XH,r.portal=n;const s=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:null,messages:[],portal:n,portalItem:r,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),o=this.write({},s);await Promise.all(s.resources.pendingOperations),await this._verifySaveAs(o,s,i);const l=this.thumbnailUrl,c=!this._isOverridden("thumbnailUrl");if(this._updateTypeKeywords(r),await n.signIn(),!n.user)throw new se("webscene:user-not-signed-in","saveAs requires a user to be signed in to the portal");return await n.user.addItem({item:r,folder:i==null?void 0:i.folder,data:o}),await X5e(this._resourceReferences,s,null),this.portalItem=r,Yz.prototype.read.call(this,{version:o.version,authoringApp:o.authoringApp,authoringAppVersion:o.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl?qs(r.itemUrl):void 0}),Zz(s),l&&(this.thumbnailUrl=c?Pne(l,"w","8192"):l),s.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){var e;this._isOverridden("thumbnailUrl")&&(await((e=this.portalItem)==null?void 0:e.updateThumbnail({thumbnail:this.thumbnailUrl})),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}_verifySave(e,i,r,n=!1){var f;if(!VO(this.spatialReference))return Promise.reject(new se("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently."));let s,o=((f=i.messages)==null?void 0:f.filter(_=>_.type==="error").map(_=>new se(_.name,_.message,_.details)))??[];i.blockedRelativeUrls&&(o=o.concat(i.blockedRelativeUrls.map(_=>new se("url:unsupported",`Relative url '${_}' is not supported in Web Scene`)))),r&&r.ignoreUnsupported&&(o=o.filter(_=>_.name!=="layer:unsupported"&&_.name!=="symbol:unsupported"&&_.name!=="symbol-layer:unsupported"&&_.name!=="property:unsupported"&&_.name!=="url:unsupported"&&_.name!=="scenemodification:unsupported")),r!=null&&r.requiredPropertyChecksDisabled&&(o=o.filter(_=>_.name!=="web-document-write:property-required"));const l=!!(r!=null&&r.strictSchemaValidationEnabled),c=Upt();return s=l&&c?c().then(_=>{const x=_.validate(e);if(x.length>0){const T=`webscene did not validate: +`)}`;if(jH.error(`_validateAgainstJSONSchema(): ${S}`),o.failPolicy==="throw"){const C=x.map(M=>new se("sceneservice:schema-validation",M)).concat(s);throw new se("sceneservice-validate:error","Failed to save layer item due to schema validation, see `details.errors`.",{combined:C})}}}if(s.length>0)throw new se("sceneservice:save","Failed to save SceneService due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:s})}};return y([w(ant)],e.prototype,"id",void 0),y([w({type:rt})],e.prototype,"spatialReference",void 0),y([Rt("spatialReference",["spatialReference","store.indexCRS","store.geographicCRS"])],e.prototype,"readSpatialReference",null),y([w({type:Vi})],e.prototype,"fullExtent",void 0),y([Rt("fullExtent",["fullExtent","store.extent","spatialReference","store.indexCRS","store.geographicCRS"])],e.prototype,"readFullExtent",null),y([w({readOnly:!0,type:B_})],e.prototype,"heightModelInfo",void 0),y([w({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:{source:"minScale"},write:!1}}}})],e.prototype,"minScale",void 0),y([w({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:{source:"maxScale"},write:!1}}}})],e.prototype,"maxScale",void 0),y([w({readOnly:!0})],e.prototype,"version",void 0),y([Rt("version",["store.version"])],e.prototype,"readVersion",null),y([w({type:String,json:{read:{source:"copyrightText"}}})],e.prototype,"copyright",void 0),y([w({type:String,json:{read:!1}})],e.prototype,"sublayerTitleMode",void 0),y([w({type:String})],e.prototype,"title",void 0),y([Rt("portal-item","title")],e.prototype,"readTitlePortalItem",null),y([Rt("service","title",["name"])],e.prototype,"readTitleService",null),y([w({type:Number,json:{origins:{service:{read:{source:"id"}},"portal-item":{write:{target:"id",isRequired:!0,ignoreOrigin:!0},read:!1}}}})],e.prototype,"layerId",void 0),y([w(goe)],e.prototype,"url",null),y([Et("url")],e.prototype,"writeUrl",null),y([w()],e.prototype,"parsedUrl",null),y([w({readOnly:!0})],e.prototype,"store",void 0),y([w({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],e.prototype,"rootNode",void 0),e=y([Z(CPe)],e),e},GH=-1e38;var v$;(function(t){t[t.existingItem=0]="existingItem",t[t.newItem=1]="newItem"})(v$||(v$={}));const HH="Scene Service",Zpe={getTypeKeywords:()=>[],portalItemLayerType:"unknown",validationOptions:{enabled:!0,ignoreUnsupported:!1,failPolicy:"throw"}};var pP;(function(t){t[t.SAVE=0]="SAVE",t[t.SAVE_AS=1]="SAVE_AS"})(pP||(pP={}));async function Jnt(t,e){const i=TE(t);if(!i)throw new se("invalid-url","Invalid scene service url");const r={...e,sceneServerUrl:i.url.path,layerId:i.sublayer??void 0};if(r.sceneLayerItem??(r.sceneLayerItem=await Knt(r)),r.sceneLayerItem==null)return Jpe(r.sceneServerUrl.replace("/SceneServer","/FeatureServer"),r);const n=await est(r);if(!(n!=null&&n.url))throw new se("related-service-not-found","Could not find feature service through portal item relationship");const s=await Jpe(n.url,r);return s.portalItem=n,s}async function Knt(t){const e=(await APe(t)).serviceItemId;if(!e)return null;const i=new Om({id:e,apiKey:t.apiKey}),r=await Qnt(t);r!=null&&(i.portal=new os({url:r}));try{return i.load({signal:t.signal})}catch(n){return Uo(n),null}}async function APe(t){if(t.rootDocument)return t.rootDocument;const e={query:{f:"json",token:t.apiKey},responseType:"json",signal:t.signal};try{const i=await yi(t.sceneServerUrl,e);t.rootDocument=i.data}catch{t.rootDocument={}}return t.rootDocument}async function Qnt(t){const e=yr==null?void 0:yr.findServerInfo(t.sceneServerUrl);if(e!=null&&e.owningSystemUrl)return e.owningSystemUrl;const i=t.sceneServerUrl.replace(/(.*\/rest)\/.*/i,"$1")+"/info";try{const r=(await yi(i,{query:{f:"json"},responseType:"json",signal:t.signal})).data.owningSystemUrl;if(r)return r}catch(r){Uo(r)}return null}async function Jpe(t,e){const i=TE(t);if(!i)throw new se("invalid-feature-service-url","Invalid feature service url");const r=i.url.path,n=e.layerId;if(n==null)return{serverUrl:r};const s=APe(e),o=S=>{const C={query:{f:"json"},responseType:"json",authMode:S,signal:e.signal};return yi(r,C)},a=o("anonymous").catch(()=>o("no-prompt")),[c,p]=await Promise.all([a,s]),_=p==null?void 0:p.layers,x=c.data&&c.data.layers;if(!Array.isArray(x))throw new Error("expected layers array");if(Array.isArray(_)){for(let S=0;Sn.type==="Feature Service")||null;if(!i)return null;const r=new Om({portal:i.portal,id:i.id});return await r.load(),r}catch(i){return Uo(i),null}}const tst={analytics:{supportsCacheHint:!1},attachment:{supportsContentType:!1,supportsExifInfo:!1,supportsKeywords:!1,supportsName:!1,supportsSize:!1,supportsCacheHint:!1,supportsResize:!1},data:{isVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsAsyncApplyEdits:!1,zDefault:void 0},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},query:{maxRecordCount:0,maxRecordCountFactor:0,standardMaxRecordCount:0,supportsCacheHint:!1,supportsCentroid:!1,supportsCompactGeometry:!1,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsSqlExpression:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsStatistics:!1,tileMaxRecordCount:0}};var ZK;let BI=ZK=class extends Ue{constructor(t){super(t),this.name=null,this.code=null}clone(){return new ZK({name:this.name,code:this.code})}};y([w({type:String,json:{write:!0}})],BI.prototype,"name",void 0),y([w({type:[String,Number],json:{write:!0}})],BI.prototype,"code",void 0),BI=ZK=y([Z("esri.layers.support.CodedValue")],BI);const ist=new tn({inherited:"inherited",codedValue:"coded-value",range:"range"});let jI=class extends Ue{constructor(e){super(e),this.name=null,this.type=null}};y([w({type:String,json:{write:!0}})],jI.prototype,"name",void 0),y([Vt(ist)],jI.prototype,"type",void 0),jI=y([Z("esri.layers.support.Domain")],jI);const rj=jI;var JK;let GI=JK=class extends rj{constructor(t){super(t),this.codedValues=null,this.type="coded-value"}getName(t){let e=null;if(this.codedValues){const i=String(t);this.codedValues.some(r=>(String(r.code)===i&&(e=r.name),!!e))}return e}clone(){return new JK({codedValues:Pe(this.codedValues),name:this.name})}};y([w({type:[BI],json:{write:!0}})],GI.prototype,"codedValues",void 0),y([Vt({codedValue:"coded-value"})],GI.prototype,"type",void 0),GI=JK=y([Z("esri.layers.support.CodedValueDomain")],GI);const MPe=GI;var KK;let dF=KK=class extends rj{constructor(t){super(t),this.type="inherited"}clone(){return new KK}};y([Vt({inherited:"inherited"})],dF.prototype,"type",void 0),dF=KK=y([Z("esri.layers.support.InheritedDomain")],dF);const OPe=dF;var QK;let EA=QK=class extends rj{constructor(t){super(t),this.maxValue=null,this.minValue=null,this.type="range"}clone(){return new QK({maxValue:this.maxValue,minValue:this.minValue,name:this.name})}};y([w({json:{type:[Number],read:{source:"range",reader:(t,e)=>{var i;return(i=e.range)==null?void 0:i[1]}},write:{enabled:!1,overridePolicy(){return{enabled:this.maxValue!=null&&this.minValue==null}},target:"range",writer(t,e,i){e[i]=[this.minValue||0,t]}}}})],EA.prototype,"maxValue",void 0),y([w({json:{type:[Number],read:{source:"range",reader:(t,e)=>{var i;return(i=e.range)==null?void 0:i[0]}},write:{target:"range",writer(t,e,i){e[i]=[t,this.maxValue||0]}}}})],EA.prototype,"minValue",void 0),y([Vt({range:"range"})],EA.prototype,"type",void 0),EA=QK=y([Z("esri.layers.support.RangeDomain")],EA);const PPe=EA,rst={key:"type",base:rj,typeMap:{range:PPe,"coded-value":MPe,inherited:OPe}};function nst(t){if(!(t!=null&&t.type))return null;switch(t.type){case"range":return PPe.fromJSON(t);case"codedValue":return MPe.fromJSON(t);case"inherited":return OPe.fromJSON(t)}return null}const Eoe=new tn({esriFieldTypeSmallInteger:"small-integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"single",esriFieldTypeDouble:"double",esriFieldTypeLong:"long",esriFieldTypeString:"string",esriFieldTypeDate:"date",esriFieldTypeOID:"oid",esriFieldTypeGeometry:"geometry",esriFieldTypeBlob:"blob",esriFieldTypeRaster:"raster",esriFieldTypeGUID:"guid",esriFieldTypeGlobalID:"global-id",esriFieldTypeXML:"xml",esriFieldTypeBigInteger:"big-integer",esriFieldTypeDateOnly:"date-only",esriFieldTypeTimeOnly:"time-only",esriFieldTypeTimestampOffset:"timestamp-offset"});var eQ;const sst=new tn({binary:"binary",coordinate:"coordinate",countOrAmount:"count-or-amount",dateAndTime:"date-and-time",description:"description",locationOrPlaceName:"location-or-place-name",measurement:"measurement",nameOrTitle:"name-or-title",none:"none",orderedOrRanked:"ordered-or-ranked",percentageOrRatio:"percentage-or-ratio",typeOrCategory:"type-or-category",uniqueIdentifier:"unique-identifier"});let Yc=eQ=class extends Ue{constructor(t){super(t),this.alias=null,this.defaultValue=void 0,this.description=null,this.domain=null,this.editable=!0,this.length=void 0,this.name=null,this.nullable=!0,this.type=null,this.valueType=null,this.visible=!0}readDescription(t,{description:e}){let i=null;try{i=e?JSON.parse(e):null}catch{}return(i==null?void 0:i.value)??null}readValueType(t,{description:e}){let i=null;try{i=e?JSON.parse(e):null}catch{}return i?sst.fromJSON(i.fieldValueType):null}clone(){return new eQ({alias:this.alias,defaultValue:this.defaultValue,description:this.description,domain:this.domain&&this.domain.clone()||null,editable:this.editable,length:this.length,name:this.name,nullable:this.nullable,type:this.type,valueType:this.valueType,visible:this.visible})}};y([w({type:String,json:{write:!0}})],Yc.prototype,"alias",void 0),y([w({type:[String,Number],json:{write:{allowNull:!0}}})],Yc.prototype,"defaultValue",void 0),y([w()],Yc.prototype,"description",void 0),y([Rt("description")],Yc.prototype,"readDescription",null),y([w({types:rst,json:{read:{reader:nst},write:!0}})],Yc.prototype,"domain",void 0),y([w({type:Boolean,json:{write:!0}})],Yc.prototype,"editable",void 0),y([w({type:_n,json:{write:{overridePolicy:t=>({enabled:Number.isFinite(t)})}}})],Yc.prototype,"length",void 0),y([w({type:String,json:{write:!0}})],Yc.prototype,"name",void 0),y([w({type:Boolean,json:{write:!0}})],Yc.prototype,"nullable",void 0),y([Vt(Eoe)],Yc.prototype,"type",void 0),y([w()],Yc.prototype,"valueType",void 0),y([Rt("valueType",["description"])],Yc.prototype,"readValueType",null),y([w({type:Boolean,json:{read:!1}})],Yc.prototype,"visible",void 0),Yc=eQ=y([Z("esri.layers.support.Field")],Yc);const nj=Yc;var tQ;let CA=tQ=class extends Ue{constructor(t){super(t),this.type="map-layer"}clone(){const{mapLayerId:t,gdbVersion:e}=this;return new tQ({mapLayerId:t,gdbVersion:e})}};y([Vt({mapLayer:"map-layer"})],CA.prototype,"type",void 0),y([w({type:_n,json:{write:!0}})],CA.prototype,"mapLayerId",void 0),y([w({type:String,json:{write:!0}})],CA.prototype,"gdbVersion",void 0),CA=tQ=y([Z("esri.layers.support.source.MapLayerSource")],CA);var iQ;let nv=iQ=class extends Ue{constructor(t){super(t),this.type="query-table"}clone(){const{workspaceId:t,query:e,oidFields:i,spatialReference:r,geometryType:n}=this,s={workspaceId:t,query:e,oidFields:i,spatialReference:(r==null?void 0:r.clone())??void 0,geometryType:n};return new iQ(s)}};y([Vt({queryTable:"query-table"})],nv.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],nv.prototype,"workspaceId",void 0),y([w({type:String,json:{write:!0}})],nv.prototype,"query",void 0),y([w({type:String,json:{write:!0}})],nv.prototype,"oidFields",void 0),y([w({type:rt,json:{write:!0}})],nv.prototype,"spatialReference",void 0),y([Vt(tCe)],nv.prototype,"geometryType",void 0),nv=iQ=y([Z("esri.layers.support.source.QueryTableDataSource")],nv);var rQ;let AA=rQ=class extends Ue{constructor(t){super(t),this.type="raster"}clone(){const{workspaceId:t,dataSourceName:e}=this;return new rQ({workspaceId:t,dataSourceName:e})}};y([Vt({raster:"raster"})],AA.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],AA.prototype,"dataSourceName",void 0),y([w({type:String,json:{write:!0}})],AA.prototype,"workspaceId",void 0),AA=rQ=y([Z("esri.layers.support.source.RasterDataSource")],AA);var nQ;let z3=nQ=class extends Ue{constructor(t){super(t),this.type="table"}clone(){const{workspaceId:t,gdbVersion:e,dataSourceName:i}=this;return new nQ({workspaceId:t,gdbVersion:e,dataSourceName:i})}};y([Vt({table:"table"})],z3.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],z3.prototype,"workspaceId",void 0),y([w({type:String,json:{write:!0}})],z3.prototype,"gdbVersion",void 0),y([w({type:String,json:{write:!0}})],z3.prototype,"dataSourceName",void 0),z3=nQ=y([Z("esri.layers.support.source.TableDataSource")],z3);var sQ,oQ;const ost=gu()({esriLeftInnerJoin:"left-inner-join",esriLeftOuterJoin:"left-outer-join"});let Ld=sQ=class extends Ue{constructor(t){super(t),this.type="join-table"}readLeftTableSource(t,e,i){return Kpe()(t,e,i)}castLeftTableSource(t){return Hy(aQ(),t)}readRightTableSource(t,e,i){return Kpe()(t,e,i)}castRightTableSource(t){return Hy(aQ(),t)}clone(){const{leftTableKey:t,rightTableKey:e,leftTableSource:i,rightTableSource:r,joinType:n}=this,s={leftTableKey:t,rightTableKey:e,leftTableSource:(i==null?void 0:i.clone())??void 0,rightTableSource:(r==null?void 0:r.clone())??void 0,joinType:n};return new sQ(s)}};y([Vt({joinTable:"join-table"})],Ld.prototype,"type",void 0),y([w({type:String,json:{write:!0}})],Ld.prototype,"leftTableKey",void 0),y([w({type:String,json:{write:!0}})],Ld.prototype,"rightTableKey",void 0),y([w({json:{write:!0}})],Ld.prototype,"leftTableSource",void 0),y([Rt("leftTableSource")],Ld.prototype,"readLeftTableSource",null),y([Ci("leftTableSource")],Ld.prototype,"castLeftTableSource",null),y([w({json:{write:!0}})],Ld.prototype,"rightTableSource",void 0),y([Rt("rightTableSource")],Ld.prototype,"readRightTableSource",null),y([Ci("rightTableSource")],Ld.prototype,"castRightTableSource",null),y([Vt(ost)],Ld.prototype,"joinType",void 0),Ld=sQ=y([Z("esri.layers.support.source.JoinTableDataSource")],Ld);let qH=null;function Kpe(){return qH||(qH=s5({types:aQ()})),qH}let WH=null;function aQ(){return WH||(WH={key:"type",base:null,typeMap:{"data-layer":oy,"map-layer":CA}}),WH}const ast={key:"type",base:null,typeMap:{"join-table":Ld,"query-table":nv,raster:AA,table:z3}};let oy=oQ=class extends Ue{constructor(t){super(t),this.type="data-layer"}clone(){const{fields:t,dataSource:e}=this;return new oQ({fields:t,dataSource:e})}};y([Vt({dataLayer:"data-layer"})],oy.prototype,"type",void 0),y([w({type:[nj],json:{write:!0}})],oy.prototype,"fields",void 0),y([w({types:ast,json:{write:!0}})],oy.prototype,"dataSource",void 0),oy=oQ=y([Z("esri.layers.support.source.DataLayerSource")],oy),oy.from=_s(oy);let U3=class extends Xs(Ue){constructor(e){super(e),this.onFields=null,this.operator=null,this.searchTerm=null,this.searchType=null}};y([w({type:[String],json:{write:{enabled:!0,overridePolicy(){return{enabled:this.onFields!=null&&this.onFields.length>0}}}}})],U3.prototype,"onFields",void 0),y([w({type:String,json:{write:!0}})],U3.prototype,"operator",void 0),y([w({type:String,json:{write:!0}})],U3.prototype,"searchTerm",void 0),y([w({type:String,json:{write:!0}})],U3.prototype,"searchType",void 0),U3=y([Z("esri.rest.support.FullTextSearch")],U3);const RPe=U3;var lQ;const Qpe=new tn({upperLeft:"upper-left",lowerLeft:"lower-left"});let V3=lQ=class extends Ue{constructor(t){super(t),this.extent=null,this.mode="view",this.originPosition="upper-left",this.tolerance=1}clone(){return new lQ(Pe({extent:this.extent,mode:this.mode,originPosition:this.originPosition,tolerance:this.tolerance}))}};y([w({type:Vi,json:{write:{overridePolicy(){return{enabled:this.mode==="view"}}}}})],V3.prototype,"extent",void 0),y([w({type:["view","edit"],json:{write:!0}})],V3.prototype,"mode",void 0),y([w({type:String,json:{read:Qpe.read,write:Qpe.write}})],V3.prototype,"originPosition",void 0),y([w({type:Number,json:{write:{overridePolicy(){return{enabled:this.mode==="view"}}}}})],V3.prototype,"tolerance",void 0),V3=lQ=y([Z("esri.rest.support.QuantizationParameters")],V3);const lst=V3;var cQ;const efe=new tn({count:"count",sum:"sum",min:"min",max:"max",avg:"avg",stddev:"stddev",var:"var",exceedslimit:"exceedslimit",percentile_cont:"percentile-continuous",percentile_disc:"percentile-discrete",EnvelopeAggregate:"envelope-aggregate",CentroidAggregate:"centroid-aggregate",ConvexHullAggregate:"convex-hull-aggregate"});let F0=cQ=class extends Ue{constructor(t){super(t),this.maxPointCount=void 0,this.maxRecordCount=void 0,this.maxVertexCount=void 0,this.onStatisticField=null,this.outStatisticFieldName=null,this.statisticType=null,this.statisticParameters=null}writeStatisticParameters(t,e){this.statisticType!=="percentile-continuous"&&this.statisticType!=="percentile-discrete"||(e.statisticParameters=Pe(t))}clone(){return new cQ({maxPointCount:this.maxPointCount,maxRecordCount:this.maxRecordCount,maxVertexCount:this.maxVertexCount,onStatisticField:this.onStatisticField,outStatisticFieldName:this.outStatisticFieldName,statisticType:this.statisticType,statisticParameters:Pe(this.statisticParameters)})}};y([w({type:Number,json:{write:!0}})],F0.prototype,"maxPointCount",void 0),y([w({type:Number,json:{write:!0}})],F0.prototype,"maxRecordCount",void 0),y([w({type:Number,json:{write:!0}})],F0.prototype,"maxVertexCount",void 0),y([w({type:String,json:{write:!0}})],F0.prototype,"onStatisticField",void 0),y([w({type:String,json:{write:!0}})],F0.prototype,"outStatisticFieldName",void 0),y([w({type:String,json:{read:{source:"statisticType",reader:efe.read},write:{target:"statisticType",writer:efe.write}}})],F0.prototype,"statisticType",void 0),y([w({type:Object})],F0.prototype,"statisticParameters",void 0),y([Et("statisticParameters")],F0.prototype,"writeStatisticParameters",null),F0=cQ=y([Z("esri.rest.support.StatisticDefinition")],F0);const cst=F0;var pF;const ust=new tn({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),hst=new tn({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let Si=pF=class extends Ue{static from(t){return DT(pF,t)}constructor(t){super(t),this.aggregateIds=null,this.cacheHint=void 0,this.compactGeometryEnabled=!1,this.datumTransformation=null,this.defaultSpatialReferenceEnabled=!1,this.distance=void 0,this.dynamicDataSource=void 0,this.formatOf3DObjects=null,this.fullText=null,this.gdbVersion=null,this.geometry=null,this.geometryPrecision=void 0,this.groupByFieldsForStatistics=null,this.having=null,this.historicMoment=null,this.maxAllowableOffset=void 0,this.maxRecordCountFactor=1,this.multipatchOption=null,this.num=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.outStatistics=null,this.parameterValues=null,this.pixelSize=null,this.quantizationParameters=null,this.rangeValues=null,this.relationParameter=null,this.resultType=null,this.returnCentroid=!1,this.returnDistinctValues=!1,this.returnExceededLimitFeatures=!0,this.returnGeometry=!1,this.returnQueryGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.sourceSpatialReference=null,this.spatialRelationship="intersects",this.start=void 0,this.sqlFormat=null,this.text=null,this.timeExtent=null,this.timeReferenceUnknownClient=!1,this.units=null,this.where=null}castDatumTransformation(t){return typeof t=="number"||typeof t=="object"?t:null}writeHistoricMoment(t,e){e.historicMoment=t&&t.getTime()}writeParameterValues(t,e){if(t){const i={};for(const r in t){const n=t[r];Array.isArray(n)?i[r]=n.map(s=>s instanceof Date?s.getTime():s):n instanceof Date?i[r]=n.getTime():i[r]=n}e.parameterValues=i}}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10,e.where="1=1"}writeWhere(t,e){e.where=t||"1=1"}clone(){return new pF(Pe({aggregateIds:this.aggregateIds,cacheHint:this.cacheHint,compactGeometryEnabled:this.compactGeometryEnabled,datumTransformation:this.datumTransformation,defaultSpatialReferenceEnabled:this.defaultSpatialReferenceEnabled,distance:this.distance,fullText:this.fullText,formatOf3DObjects:this.formatOf3DObjects,gdbVersion:this.gdbVersion,geometry:this.geometry,geometryPrecision:this.geometryPrecision,groupByFieldsForStatistics:this.groupByFieldsForStatistics,having:this.having,historicMoment:this.historicMoment!=null?new Date(this.historicMoment.getTime()):null,maxAllowableOffset:this.maxAllowableOffset,maxRecordCountFactor:this.maxRecordCountFactor,multipatchOption:this.multipatchOption,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,outStatistics:this.outStatistics,parameterValues:this.parameterValues,pixelSize:this.pixelSize,quantizationParameters:this.quantizationParameters,rangeValues:this.rangeValues,relationParameter:this.relationParameter,resultType:this.resultType,returnDistinctValues:this.returnDistinctValues,returnGeometry:this.returnGeometry,returnCentroid:this.returnCentroid,returnExceededLimitFeatures:this.returnExceededLimitFeatures,returnQueryGeometry:this.returnQueryGeometry,returnM:this.returnM,returnZ:this.returnZ,dynamicDataSource:this.dynamicDataSource,sourceSpatialReference:this.sourceSpatialReference,spatialRelationship:this.spatialRelationship,start:this.start,sqlFormat:this.sqlFormat,text:this.text,timeExtent:this.timeExtent,timeReferenceUnknownClient:this.timeReferenceUnknownClient,units:this.units,where:this.where}))}};Si.MAX_MAX_RECORD_COUNT_FACTOR=5,y([w({json:{write:!0}})],Si.prototype,"aggregateIds",void 0),y([w({type:Boolean,json:{write:!0}})],Si.prototype,"cacheHint",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"compactGeometryEnabled",void 0),y([w({json:{write:!0}})],Si.prototype,"datumTransformation",void 0),y([Ci("datumTransformation")],Si.prototype,"castDatumTransformation",null),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"defaultSpatialReferenceEnabled",void 0),y([w({type:Number,json:{write:{overridePolicy:t=>({enabled:t>0})}}})],Si.prototype,"distance",void 0),y([w({type:oy,json:{write:!0}})],Si.prototype,"dynamicDataSource",void 0),y([w({type:String,json:{write:!0}})],Si.prototype,"formatOf3DObjects",void 0),y([w({type:[RPe],json:{write:{enabled:!0,overridePolicy(){return{enabled:this.fullText!=null&&this.fullText.length>0}}}}})],Si.prototype,"fullText",void 0),y([w({type:String,json:{write:!0}})],Si.prototype,"gdbVersion",void 0),y([w({types:dE,json:{read:Wy,write:!0}})],Si.prototype,"geometry",void 0),y([w({type:Number,json:{write:!0}})],Si.prototype,"geometryPrecision",void 0),y([w({type:[String],json:{write:!0}})],Si.prototype,"groupByFieldsForStatistics",void 0),y([w({type:String,json:{write:!0}})],Si.prototype,"having",void 0),y([w({type:Date})],Si.prototype,"historicMoment",void 0),y([Et("historicMoment")],Si.prototype,"writeHistoricMoment",null),y([w({type:Number,json:{write:!0}})],Si.prototype,"maxAllowableOffset",void 0),y([w({type:Number,cast:t=>t<1?1:t>Si.MAX_MAX_RECORD_COUNT_FACTOR?Si.MAX_MAX_RECORD_COUNT_FACTOR:t,json:{write:{overridePolicy:t=>({enabled:t>1})}}})],Si.prototype,"maxRecordCountFactor",void 0),y([w({type:["xyFootprint"],json:{write:!0}})],Si.prototype,"multipatchOption",void 0),y([w({type:Number,json:{read:{source:"resultRecordCount"}}})],Si.prototype,"num",void 0),y([w({json:{write:!0}})],Si.prototype,"objectIds",void 0),y([w({type:[String],json:{write:!0}})],Si.prototype,"orderByFields",void 0),y([w({type:[String],json:{write:!0}})],Si.prototype,"outFields",void 0),y([w({type:rt,json:{name:"outSR",write:!0}})],Si.prototype,"outSpatialReference",void 0),y([w({type:[cst],json:{write:{enabled:!0,overridePolicy(){return{enabled:this.outStatistics!=null&&this.outStatistics.length>0}}}}})],Si.prototype,"outStatistics",void 0),y([w({json:{write:!0}})],Si.prototype,"parameterValues",void 0),y([Et("parameterValues")],Si.prototype,"writeParameterValues",null),y([w({type:mt,json:{write:!0}})],Si.prototype,"pixelSize",void 0),y([w({type:lst,json:{write:!0}})],Si.prototype,"quantizationParameters",void 0),y([w({type:[Object],json:{write:!0}})],Si.prototype,"rangeValues",void 0),y([w({type:String,json:{read:{source:"relationParam"},write:{target:"relationParam",overridePolicy(){return{enabled:this.spatialRelationship==="relation"}}}}})],Si.prototype,"relationParameter",void 0),y([w({type:String,json:{write:!0}})],Si.prototype,"resultType",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"returnCentroid",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"returnDistinctValues",void 0),y([w({type:Boolean,json:{default:!0,write:!0}})],Si.prototype,"returnExceededLimitFeatures",void 0),y([w({type:Boolean,json:{write:!0}})],Si.prototype,"returnGeometry",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"returnQueryGeometry",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"returnM",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Si.prototype,"returnZ",void 0),y([w({type:rt,json:{write:!0}})],Si.prototype,"sourceSpatialReference",void 0),y([Vt(ust,{ignoreUnknown:!1,name:"spatialRel"})],Si.prototype,"spatialRelationship",void 0),y([w({type:Number,json:{read:{source:"resultOffset"}}})],Si.prototype,"start",void 0),y([Et("start"),Et("num")],Si.prototype,"writeStart",null),y([w({type:String,json:{write:!0}})],Si.prototype,"sqlFormat",void 0),y([w({type:String,json:{write:!0}})],Si.prototype,"text",void 0),y([w({type:f1,json:{write:!0}})],Si.prototype,"timeExtent",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Si.prototype,"timeReferenceUnknownClient",void 0),y([Vt(hst,{ignoreUnknown:!1}),w({json:{write:{overridePolicy(t){return{enabled:!!t&&this.distance!=null&&this.distance>0}}}}})],Si.prototype,"units",void 0),y([w({type:String,json:{write:{overridePolicy(t){return{enabled:t!=null||this.start!=null&&this.start>0}}}}})],Si.prototype,"where",void 0),y([Et("where")],Si.prototype,"writeWhere",null),Si=pF=y([Z("esri.rest.support.Query")],Si);const Wm=Si;async function dst(t,e,i){e=e.clone(),t.capabilities.query.supportsMaxRecordCountFactor&&(e.maxRecordCountFactor=IPe(t));const r=pst(t),n=t.capabilities.query.supportsPagination;e.start=0,e.num=r;let s=null;for(;;){const o=await t.source.queryFeaturesJSON(e,i);if(s==null?s=o:s.features=s.features.concat(o.features),s.exceededTransferLimit=o.exceededTransferLimit,!n||!o.exceededTransferLimit)break;e.start+=r}return s}function pst(t){return IPe(t)*fst(t)}function fst(t){return t.capabilities.query.maxRecordCount||2e3}function IPe(t){return t.capabilities.query.supportsMaxRecordCountFactor?Wm.MAX_MAX_RECORD_COUNT_FACTOR:1}var uQ;let Nl=uQ=class extends Ue{constructor(t){super(t),this.attachmentTypes=null,this.attachmentsWhere=null,this.cacheHint=void 0,this.keywords=null,this.globalIds=null,this.name=null,this.num=null,this.objectIds=null,this.returnMetadata=!1,this.size=null,this.start=null,this.where=null}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10}clone(){return new uQ(Pe({attachmentTypes:this.attachmentTypes,attachmentsWhere:this.attachmentsWhere,cacheHint:this.cacheHint,keywords:this.keywords,where:this.where,globalIds:this.globalIds,name:this.name,num:this.num,objectIds:this.objectIds,returnMetadata:this.returnMetadata,size:this.size,start:this.start}))}};y([w({type:[String],json:{write:!0}})],Nl.prototype,"attachmentTypes",void 0),y([w({type:String,json:{read:{source:"attachmentsDefinitionExpression"},write:{target:"attachmentsDefinitionExpression"}}})],Nl.prototype,"attachmentsWhere",void 0),y([w({type:Boolean,json:{write:!0}})],Nl.prototype,"cacheHint",void 0),y([w({type:[String],json:{write:!0}})],Nl.prototype,"keywords",void 0),y([w({type:[Number],json:{write:!0}})],Nl.prototype,"globalIds",void 0),y([w({json:{write:!0}})],Nl.prototype,"name",void 0),y([w({type:Number,json:{read:{source:"resultRecordCount"}}})],Nl.prototype,"num",void 0),y([w({type:[Number],json:{write:!0}})],Nl.prototype,"objectIds",void 0),y([w({type:Boolean,json:{default:!1,write:!0}})],Nl.prototype,"returnMetadata",void 0),y([w({type:[Number],json:{write:!0}})],Nl.prototype,"size",void 0),y([w({type:Number,json:{read:{source:"resultOffset"}}})],Nl.prototype,"start",void 0),y([Et("start"),Et("num")],Nl.prototype,"writeStart",null),y([w({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],Nl.prototype,"where",void 0),Nl=uQ=y([Z("esri.rest.support.AttachmentQuery")],Nl),Nl.from=_s(Nl);const mst=Nl;var hQ;let Io=hQ=class extends Ue{constructor(t){super(t),this.cacheHint=void 0,this.dynamicDataSource=void 0,this.gdbVersion=null,this.geometryPrecision=void 0,this.historicMoment=null,this.maxAllowableOffset=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.relationshipId=void 0,this.start=void 0,this.num=void 0,this.returnGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.where=null}_writeHistoricMoment(t,e){e.historicMoment=t&&t.getTime()}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10,this.start>0&&this.where==null&&(e.definitionExpression="1=1")}clone(){return new hQ(Pe({cacheHint:this.cacheHint,dynamicDataSource:this.dynamicDataSource,gdbVersion:this.gdbVersion,geometryPrecision:this.geometryPrecision,historicMoment:this.historicMoment&&new Date(this.historicMoment.getTime()),maxAllowableOffset:this.maxAllowableOffset,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,relationshipId:this.relationshipId,start:this.start,num:this.num,returnGeometry:this.returnGeometry,where:this.where,returnZ:this.returnZ,returnM:this.returnM}))}};y([w({type:Boolean,json:{write:!0}})],Io.prototype,"cacheHint",void 0),y([w({type:oy,json:{write:!0}})],Io.prototype,"dynamicDataSource",void 0),y([w({type:String,json:{write:!0}})],Io.prototype,"gdbVersion",void 0),y([w({type:Number,json:{write:!0}})],Io.prototype,"geometryPrecision",void 0),y([w({type:Date})],Io.prototype,"historicMoment",void 0),y([Et("historicMoment")],Io.prototype,"_writeHistoricMoment",null),y([w({type:Number,json:{write:!0}})],Io.prototype,"maxAllowableOffset",void 0),y([w({type:[Number],json:{write:!0}})],Io.prototype,"objectIds",void 0),y([w({type:[String],json:{write:!0}})],Io.prototype,"orderByFields",void 0),y([w({type:[String],json:{write:!0}})],Io.prototype,"outFields",void 0),y([w({type:rt,json:{read:{source:"outSR"},write:{target:"outSR"}}})],Io.prototype,"outSpatialReference",void 0),y([w({json:{write:!0}})],Io.prototype,"relationshipId",void 0),y([w({type:Number,json:{read:{source:"resultOffset"}}})],Io.prototype,"start",void 0),y([Et("start"),Et("num")],Io.prototype,"writeStart",null),y([w({type:Number,json:{read:{source:"resultRecordCount"}}})],Io.prototype,"num",void 0),y([w({json:{write:!0}})],Io.prototype,"returnGeometry",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Io.prototype,"returnM",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Io.prototype,"returnZ",void 0),y([w({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],Io.prototype,"where",void 0),Io=hQ=y([Z("esri.rest.support.RelationshipQuery")],Io),Io.from=_s(Io);const Coe=Io,hQt=Object.freeze(Object.defineProperty({__proto__:null,default:Coe},Symbol.toStringTag,{value:"Module"})),dQt=new tn({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function pQt(t,e,i,r){const n=await dx(t);if(await Aoe(t,e,r),!n.addAttachment)throw new se(r,"Layer source does not support addAttachment capability");return n.addAttachment(e,i)}function Aoe(t,e,i){var s,o;const{attributes:r}=e,{objectIdField:n}=t;return(o=(s=t.capabilities)==null?void 0:s.data)!=null&&o.supportsAttachment?e?r?n&&r[n]?Promise.resolve():Promise.reject(new se(i,`feature is missing the identifying attribute ${n}`)):Promise.reject(new se(i,"'attributes' are required on a feature to query attachments")):Promise.reject(new se(i,"A feature is required to add/delete/update attachments")):Promise.reject(new se(i,"this layer doesn't support attachments"))}async function fQt(t,e,i,r,n){const s=await dx(t);if(await Aoe(t,e,n),!s.updateAttachment)throw new se(n,"Layer source does not support updateAttachment capability");return s.updateAttachment(e,i,r)}async function mQt(t,e,i){const{applyEdits:r}=await we(()=>import("./editingSupport-HfkJiqt7.js"),__vite__mapDeps([])),n=await t.load(),{source:s,globalIdField:o}=n;let a=i;return n.type==="feature"&&n.infoFor3D&&e.deleteFeatures!=null&&o!=null&&(a={...a,globalIdToObjectId:await $Pe(t,e.deleteFeatures,o)}),r(n,s,e,i)}async function gQt(t,e,i){const{uploadAssets:r}=await we(()=>import("./editingSupport-HfkJiqt7.js"),__vite__mapDeps([])),n=await t.load();return r(n,n.source,e,i)}async function yQt(t,e,i,r){const n=await dx(t);if(await Aoe(t,e,r),!n.deleteAttachments)throw new se(r,"Layer source does not support deleteAttachments capability");return n.deleteAttachments(e,i)}async function vQt(t,e,i){const r=(await t.load({signal:e==null?void 0:e.signal})).source;if(!r.fetchRecomputedExtents)throw new se(i,"Layer source does not support fetchUpdates capability");return r.fetchRecomputedExtents(e)}async function _Qt(t,e,i,r){var C,M;e=mst.from(e),await t.load();const n=t.source,s=t.capabilities;if(!((C=s==null?void 0:s.data)!=null&&C.supportsAttachment))throw new se(r,"this layer doesn't support attachments");const{attachmentTypes:o,objectIds:a,globalIds:c,num:p,size:_,start:x,where:S}=e;if(!((M=s==null?void 0:s.operations)!=null&&M.supportsQueryAttachments)&&((o==null?void 0:o.length)>0||(c==null?void 0:c.length)>0||(_==null?void 0:_.length)>0||p||x||S))throw new se(r,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",e);if(!(a!=null&&a.length||c!=null&&c.length||S))throw new se(r,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",e);if(!n.queryAttachments)throw new se(r,"Layer source does not support queryAttachments capability",e);return n.queryAttachments(e)}async function bQt(t,e,i,r){const n=await dx(t);if(!n.queryObjectIds)throw new se(r,"Layer source does not support queryObjectIds capability");return n.queryObjectIds(Wm.from(e)??t.createQuery(),i)}async function wQt(t,e,i,r){const n=await dx(t);if(!n.queryFeatureCount)throw new se(r,"Layer source does not support queryFeatureCount capability");return n.queryFeatureCount(Wm.from(e)??t.createQuery(),i)}async function xQt(t,e,i,r){const n=await dx(t);if(!n.queryExtent)throw new se(r,"Layer source does not support queryExtent capability");return n.queryExtent(Wm.from(e)??t.createQuery(),i)}async function SQt(t,e,i,r){const n=await dx(t);if(!n.queryRelatedFeatures)throw new se(r,"Layer source does not support queryRelatedFeatures capability");return n.queryRelatedFeatures(Coe.from(e),i)}async function TQt(t,e,i,r){const n=await dx(t);if(!n.queryRelatedFeaturesCount)throw new se(r,"Layer source does not support queryRelatedFeaturesCount capability");return n.queryRelatedFeaturesCount(Coe.from(e),i)}async function EQt(t){const e=t.source;if(e!=null&&e.refresh)try{const{dataChanged:i,updates:r}=await e.refresh();if(r!=null&&(t.sourceJSON={...t.sourceJSON,...r},t.read(r,{origin:"service",url:t.parsedUrl})),i)return!0}catch{}if(t.definitionExpression)try{return(await _se(t.definitionExpression,t.fieldsIndex)).hasDateFunctions}catch{}return!1}function CQt(t){var o,a;const e=new Wm,i=(o=t.capabilities)==null?void 0:o.data,r=(a=t.capabilities)==null?void 0:a.query;e.historicMoment=t.historicMoment,e.gdbVersion=t.gdbVersion,e.returnGeometry=!0,r&&(e.compactGeometryEnabled=r.supportsCompactGeometry,e.defaultSpatialReferenceEnabled=r.supportsDefaultSpatialReference),i&&(i.supportsZ&&t.returnZ!=null&&(e.returnZ=t.returnZ),i.supportsM&&t.returnM!=null&&(e.returnM=t.returnM)),e.outFields=["*"];const{timeOffset:n,timeExtent:s}=t;return e.timeExtent=n!=null&&s!=null?s.offset(-n.value,n.unit):s||null,e.multipatchOption=t.geometryType==="multipatch"?"xyFootprint":null,e}function AQt(t){const{globalIdField:e,fields:i}=t;if(e)return e;if(i){for(const r of i)if(r.type==="esriFieldTypeGlobalID")return r.name}}function MQt(t){const{objectIdField:e,fields:i}=t;if(e)return e;if(i){for(const r of i)if(r.type==="esriFieldTypeOID")return r.name}}function OQt(t){return t.currentVersion?t.currentVersion:t.hasOwnProperty("capabilities")||t.hasOwnProperty("drawingInfo")||t.hasOwnProperty("hasAttachments")||t.hasOwnProperty("htmlPopupType")||t.hasOwnProperty("relationships")||t.hasOwnProperty("timeInfo")||t.hasOwnProperty("typeIdField")||t.hasOwnProperty("types")?10:9.3}async function dx(t){return(await t.load()).source}async function gst(t,e){if(!yr||yr.findCredential(t))return;let i;try{const r=await dOe(t,e);r&&(i=await yr.checkSignInStatus(`${r}/sharing`))}catch{}if(i)try{const r=e!=null?e.signal:null;await yr.getCredential(t,{signal:r})}catch{}}async function PQt(t,e,i){var n;const r=(n=t.parsedUrl)==null?void 0:n.path;r&&t.authenticationTriggerEvent===e&&await gst(r,i)}function yst(t){var e;return!((e=t.sourceJSON)!=null&&e.isMultiServicesView)&&(t.userHasUpdateItemPrivileges||t.editingEnabled)}const YH=s5({types:WMe});function RQt(t,e){var i;if(t.defaultSymbol)return(i=t.types)!=null&&i.length?new poe({defaultSymbol:YH(t.defaultSymbol,t,e),field:t.typeIdField,uniqueValueInfos:t.types.map(r=>({id:r.id,symbol:YH(r.symbol,r,e)}))}):new uoe({symbol:YH(t.defaultSymbol,t,e)})}function IQt(t){var r,n,s;let e=(r=t.sourceJSON)==null?void 0:r.cacheMaxAge;if(!e)return!1;const i=(s=(n=t.editingInfo)==null?void 0:n.lastEditDate)==null?void 0:s.getTime();return i==null||(e*=1e3,Date.now()-i{let _=null;if("attributes"in p){const{attributes:x}=p;_={globalId:x[i],objectId:x[n]!=null&&x[n]!==-1?x[n]:null}}else _={globalId:p.globalId,objectId:p.objectId!=null&&p.objectId!==-1?p.objectId:null};_.globalId!=null&&(_.objectId!=null&&_.objectId!==-1||r.push(_.globalId))}),r.length===0)return null;const s=t.createQuery();s.where=r.map(p=>`${i}='${p}'`).join(" OR "),s.returnGeometry=!1,s.outFields=[n,i],s.cacheHint=!1;const o=await Dtt(dst(t,s));if(!o.ok)return null;const a=new Map,c=o.value.features;for(const p of c){const _=p.attributes[i],x=p.attributes[n];_!=null&&x!=null&&x!==-1&&a.set(_,x)}return a}let _$=class extends Ue{constructor(){super(...arguments),this.type=null}};y([w({type:["selection","cluster","binning"],readOnly:!0,json:{read:!1,write:!0}})],_$.prototype,"type",void 0),_$=y([Z("esri.layers.support.FeatureReduction")],_$);var dQ;let fF=dQ=class extends _${constructor(t){super(t),this.type="selection"}clone(){return new dQ}};y([w({type:["selection"]})],fF.prototype,"type",void 0),fF=dQ=y([Z("esri.layers.support.FeatureReductionSelection")],fF);const vst=fF;function _st(){return{fields:{type:[nj],value:null,set:function(t){if(t&&$e("big-integer-warning-enabled")){const e=t.filter(i=>i.type==="big-integer"||i.type==="oid"&&(i.length||0)>=8);if(e.length){const i=e.map(r=>`'${r.name}'`).join(", ");Ce.getLogger(this).warn("#fields",`Layer (title: '${this.title??"no title"}', id: '${this.id??"no id"}') references big-integer field(s): ${i}, support for which is experimental. Only integers less than ${Number.MAX_SAFE_INTEGER} (Number.MAX_SAFE_INTEGER) are supported.`)}}this._set("fields",t)}},fieldsIndex:{readOnly:!0,get(){return aoe.fromLayer(this)}},outFields:{type:[String],json:{read:!1},set:function(t){this._userOutFields=t,this.notifyChange("outFields")},get:function(){var e;const t=this._userOutFields;if(!(t!=null&&t.length))return null;if(t.includes("*"))return["*"];if(!this.fields)return t;for(const i of t)((e=this.fieldsIndex)==null?void 0:e.has(i))||Ce.getLogger("esri.layers.support.fieldProperties").error("field-attributes-layer:invalid-field",`Invalid field ${i} found in outFields`,{layer:this,outFields:t});return DB(this.fieldsIndex,t)}}}}let IS=class extends Ue{constructor(){super(...arguments),this.nodesPerPage=null,this.rootIndex=0,this.lodSelectionMetricType=null}};y([w({type:Number})],IS.prototype,"nodesPerPage",void 0),y([w({type:Number})],IS.prototype,"rootIndex",void 0),y([w({type:String})],IS.prototype,"lodSelectionMetricType",void 0),IS=y([Z("esri.layer.support.I3SNodePageDefinition")],IS);let Xv=class extends Ue{constructor(){super(...arguments),this.factor=1}};y([w({type:Number,json:{read:{source:"textureSetDefinitionId"}}})],Xv.prototype,"id",void 0),y([w({type:Number})],Xv.prototype,"factor",void 0),Xv=y([Z("esri.layer.support.I3SMaterialTexture")],Xv);let rw=class extends Ue{constructor(){super(...arguments),this.baseColorFactor=[1,1,1,1],this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.metallicFactor=1,this.roughnessFactor=1}};y([w({type:[Number]})],rw.prototype,"baseColorFactor",void 0),y([w({type:Xv})],rw.prototype,"baseColorTexture",void 0),y([w({type:Xv})],rw.prototype,"metallicRoughnessTexture",void 0),y([w({type:Number})],rw.prototype,"metallicFactor",void 0),y([w({type:Number})],rw.prototype,"roughnessFactor",void 0),rw=y([Z("esri.layer.support.I3SMaterialPBRMetallicRoughness")],rw);let Zp=class extends Ue{constructor(){super(...arguments),this.alphaMode="opaque",this.alphaCutoff=.25,this.doubleSided=!1,this.cullFace="none",this.normalTexture=null,this.occlusionTexture=null,this.emissiveTexture=null,this.emissiveFactor=null,this.pbrMetallicRoughness=null}};y([Vt({opaque:"opaque",mask:"mask",blend:"blend"})],Zp.prototype,"alphaMode",void 0),y([w({type:Number})],Zp.prototype,"alphaCutoff",void 0),y([w({type:Boolean})],Zp.prototype,"doubleSided",void 0),y([Vt({none:"none",back:"back",front:"front"})],Zp.prototype,"cullFace",void 0),y([w({type:Xv})],Zp.prototype,"normalTexture",void 0),y([w({type:Xv})],Zp.prototype,"occlusionTexture",void 0),y([w({type:Xv})],Zp.prototype,"emissiveTexture",void 0),y([w({type:[Number]})],Zp.prototype,"emissiveFactor",void 0),y([w({type:rw})],Zp.prototype,"pbrMetallicRoughness",void 0),Zp=y([Z("esri.layer.support.I3SMaterialDefinition")],Zp);let HI=class extends Ue{};y([w({type:String,json:{read:{source:["name","index"],reader:(t,e)=>t??`${e.index}`}}})],HI.prototype,"name",void 0),y([Vt({jpg:"jpg",png:"png",dds:"dds","ktx-etc2":"ktx-etc2",ktx2:"ktx2",basis:"basis"})],HI.prototype,"format",void 0),HI=y([Z("esri.layer.support.I3STextureFormat")],HI);let qI=class extends Ue{constructor(){super(...arguments),this.atlas=!1}};y([w({type:[HI]})],qI.prototype,"formats",void 0),y([w({type:Boolean})],qI.prototype,"atlas",void 0),qI=y([Z("esri.layer.support.I3STextureSetDefinition")],qI);let lm=class extends Ue{};y([Vt({Float32:"Float32",UInt64:"UInt64",UInt32:"UInt32",UInt16:"UInt16",UInt8:"UInt8"})],lm.prototype,"type",void 0),y([w({type:Number})],lm.prototype,"component",void 0),lm=y([Z("esri.layer.support.I3SGeometryAttribute")],lm);let WI=class extends Ue{};y([Vt({draco:"draco"})],WI.prototype,"encoding",void 0),y([w({type:[String]})],WI.prototype,"attributes",void 0),WI=y([Z("esri.layer.support.I3SGeometryCompressedAttributes")],WI);let g0=class extends Ue{constructor(){super(...arguments),this.offset=0}};y([w({type:Number})],g0.prototype,"offset",void 0),y([w({type:lm})],g0.prototype,"position",void 0),y([w({type:lm})],g0.prototype,"normal",void 0),y([w({type:lm})],g0.prototype,"uv0",void 0),y([w({type:lm})],g0.prototype,"color",void 0),y([w({type:lm})],g0.prototype,"uvRegion",void 0),y([w({type:lm})],g0.prototype,"featureId",void 0),y([w({type:lm})],g0.prototype,"faceRange",void 0),y([w({type:WI})],g0.prototype,"compressedAttributes",void 0),g0=y([Z("esri.layer.support.I3SGeometryBuffer")],g0);let YI=class extends Ue{};y([Vt({triangle:"triangle"})],YI.prototype,"topology",void 0),y([w()],YI.prototype,"geometryBuffers",void 0),YI=y([Z("esri.layer.support.I3SGeometryDefinition")],YI);const Moe="__begin__",Ooe="__end__",bst=new RegExp(Moe,"ig"),wst=new RegExp(Ooe,"ig"),tfe=new RegExp("^"+Moe,"i"),ife=new RegExp(Ooe+"$","i"),Jz='"',xst=Jz+" + ",Sst=" + "+Jz;function Tst(t){return t.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function Est(t){return t.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function sj(t){const e={expression:"",type:"none"};return t.labelExpressionInfo?t.labelExpressionInfo.value?(e.expression=t.labelExpressionInfo.value,e.type="conventional"):t.labelExpressionInfo.expression&&(e.expression=t.labelExpressionInfo.expression,e.type="arcade"):t.labelExpression!=null&&(e.expression=Tst(t.labelExpression),e.type="conventional"),e}function Cst(t){const e=sj(t);if(!e)return null;switch(e.type){case"conventional":return pQ(e.expression);case"arcade":return e.expression}return null}function Ast(t){const e=sj(t);if(!e)return null;switch(e.type){case"conventional":return Ost(e.expression);case"arcade":return Poe(e.expression)}return null}function pQ(t){let e;return t?(e=w9(t,i=>Moe+'$feature["'+i+'"]'+Ooe),e=tfe.test(e)?e.replace(tfe,""):Jz+e,e=ife.test(e)?e.replace(ife,""):e+Jz,e=e.replaceAll(bst,xst).replaceAll(wst,Sst)):e='""',e}const Mst=/^\s*\{([^}]+)\}\s*$/i;function Ost(t){const e=t==null?void 0:t.match(Mst);return(e==null?void 0:e[1].trim())||null}const Pst=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])([\w\s]+)(\2)\]));?\s*$/i,Rst=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])([\w\s]+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,Ist=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])([\w\s]+)(\1)\s*\));?\s*$/i;function Poe(t){if(!t)return null;let e=Pst.exec(t)||Rst.exec(t);return e?e[1]||e[3]:(e=Ist.exec(t),e?e[2]:null)}var fQ;let nw=fQ=class extends Ue{constructor(){super(...arguments),this.expression=null,this.title=null,this.value=null}readExpression(t,e){return e.value?pQ(e.value):t}writeExpression(t,e,i){this.value!=null&&(t=pQ(this.value)),t!=null&&(e[i]=t)}clone(){return new fQ({expression:this.expression,title:this.title,value:this.value})}};y([w({type:String,json:{write:{writerEnsuresNonNull:!0}}})],nw.prototype,"expression",void 0),y([Rt("expression",["expression","value"])],nw.prototype,"readExpression",null),y([Et("expression")],nw.prototype,"writeExpression",null),y([w({type:String,json:{write:!0,origins:{"web-scene":{write:!1}}}})],nw.prototype,"title",void 0),y([w({json:{read:!1,write:!1}})],nw.prototype,"value",void 0),nw=fQ=y([Z("esri.layers.support.LabelExpressionInfo")],nw);const LPe=nw,DPe=[252,146,31,255],GQt=[153,153,153,255],$st={type:"esriSMS",style:"esriSMSCircle",size:6,color:DPe,outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[153,153,153,255]}},Lst={type:"esriSLS",style:"esriSLSSolid",width:.75,color:DPe},Dst={type:"esriSFS",style:"esriSFSSolid",color:[252,146,31,196],outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[255,255,255,191]}},Nst={type:"esriTS",color:[255,255,255,255],font:{family:"arial-unicode-ms",size:10,weight:"bold"},horizontalAlignment:"center",kerning:!0,haloColor:[0,0,0,255],haloSize:1,rotated:!1,text:"",xoffset:0,yoffset:0,angle:0},Fst={type:"esriSMS",style:"esriSMSCircle",color:[0,0,0,255],outline:null,size:10.5},kst={type:"esriSLS",style:"esriSLSSolid",color:[0,0,0,255],width:1.5},zst={type:"esriSFS",style:"esriSFSSolid",color:[0,0,0,255],outline:null},Ust=du.fromJSON($st),Vst=Ic.fromJSON(Lst),Bst=qm.fromJSON(Dst),jst=wE.fromJSON(Nst);function HQt(t){if(t==null)return null;switch(t.type){case"mesh":return null;case"point":case"multipoint":return Ust;case"polyline":return Vst;case"polygon":case"extent":return Bst}return null}du.fromJSON(Fst);Ic.fromJSON(kst);qm.fromJSON(zst);var mQ;const hD=new tn({esriServerPointLabelPlacementAboveCenter:"above-center",esriServerPointLabelPlacementAboveLeft:"above-left",esriServerPointLabelPlacementAboveRight:"above-right",esriServerPointLabelPlacementBelowCenter:"below-center",esriServerPointLabelPlacementBelowLeft:"below-left",esriServerPointLabelPlacementBelowRight:"below-right",esriServerPointLabelPlacementCenterCenter:"center-center",esriServerPointLabelPlacementCenterLeft:"center-left",esriServerPointLabelPlacementCenterRight:"center-right",esriServerLinePlacementAboveAfter:"above-after",esriServerLinePlacementAboveAlong:"above-along",esriServerLinePlacementAboveBefore:"above-before",esriServerLinePlacementAboveStart:"above-start",esriServerLinePlacementAboveEnd:"above-end",esriServerLinePlacementBelowAfter:"below-after",esriServerLinePlacementBelowAlong:"below-along",esriServerLinePlacementBelowBefore:"below-before",esriServerLinePlacementBelowStart:"below-start",esriServerLinePlacementBelowEnd:"below-end",esriServerLinePlacementCenterAfter:"center-after",esriServerLinePlacementCenterAlong:"center-along",esriServerLinePlacementCenterBefore:"center-before",esriServerLinePlacementCenterStart:"center-start",esriServerLinePlacementCenterEnd:"center-end",esriServerPolygonPlacementAlwaysHorizontal:"always-horizontal"},{ignoreUnknown:!0});function dD(t,e,i){return{enabled:!hOe(i==null?void 0:i.layer)}}function NPe(t){var e;return!t||t.origin!=="service"&&((e=t.layer)==null?void 0:e.type)!=="map-image"}function Gst(t){return(t==null?void 0:t.type)==="map-image"}function FPe(t){var e,i;return!!Gst(t)&&!!((i=(e=t.capabilities)==null?void 0:e.exportMap)!=null&&i.supportsArcadeExpressionForLabeling)}function Hst(t){return NPe(t)||FPe(t==null?void 0:t.layer)}let ia=mQ=class extends Ue{static evaluateWhere(t,e){const i=(r,n,s)=>{switch(n){case"=":return r==s;case"<>":return r!=s;case">":return r>s;case">=":return r>=s;case"<":return rHst(i)?{allowNull:!0}:{enabled:!1}}}})],ia.prototype,"labelExpressionInfo",void 0),y([Et("labelExpressionInfo")],ia.prototype,"writeLabelExpressionInfo",null),y([w({type:hD.apiValues,json:{type:hD.jsonValues,read:hD.read,write:hD.write}})],ia.prototype,"labelPlacement",void 0),y([w({type:["curved","parallel"],json:{write:!0,origins:{"web-map":{write:!1},"web-scene":{write:!1},"portal-item":{write:!1}}}})],ia.prototype,"labelPosition",void 0),y([w({type:Number})],ia.prototype,"maxScale",void 0),y([Et("maxScale")],ia.prototype,"writeMaxScale",null),y([w({type:Number})],ia.prototype,"minScale",void 0),y([Et("minScale")],ia.prototype,"writeMinScale",null),y([w({type:Boolean,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:dD}}}}})],ia.prototype,"repeatLabel",void 0),y([w({type:Number,cast:vs,json:{write:!0,origins:{"web-scene":{write:!1},"portal-item":{write:{overridePolicy:dD}}}}})],ia.prototype,"repeatLabelDistance",void 0),y([w({types:Vtt,json:{origins:{"web-scene":{types:Btt,write:Tpe,default:null}},write:Tpe,default:null}})],ia.prototype,"symbol",void 0),y([w({type:Boolean,json:{write:!0}})],ia.prototype,"useCodedValues",void 0),y([w({type:String,json:{write:!0}})],ia.prototype,"where",void 0),ia=mQ=y([Z("esri.layers.support.LabelClass")],ia);const kPe=ia,XH=Ce.getLogger("esri.layers.support.labelingInfo"),qst=/\[([^\[\]]+)\]/gi;function rfe(t,e,i){return t?t.map(r=>{var s;const n=new kPe;if(n.read(r,i),n.labelExpression){const o=e.fields||((s=e.layerDefinition)==null?void 0:s.fields)||this.fields;n.labelExpression=n.labelExpression.replaceAll(qst,(a,c)=>`[${Wst(c,o)}]`)}return n}):null}function Wst(t,e){if(!e)return t;const i=t.toLowerCase();for(let r=0;rXst(r,e))?[]:i}function Xst(t,e){const i=t.labelPlacement,r=Yst[e];if(!t.symbol)return XH.warn("No ILabelClass symbol specified."),!0;if(!r)return XH.error(new se("labeling:unsupported-geometry-type",`Unable to create labels for layer, geometry type '${e}' is not supported`)),!0;if(!r.includes(i)){const n=r[0];i&&XH.warn(`Found invalid label placement type ${i} for ${e}. Defaulting to ${n}`),t.labelPlacement=n}return!1}var gQ;let MA=gQ=class extends Ue{constructor(t){super(t),this.floorField=null,this.viewAllMode=!1,this.viewAllLevelIds=new tt}clone(){return new gQ({floorField:this.floorField,viewAllMode:this.viewAllMode,viewAllLevelIds:this.viewAllLevelIds})}};y([w({type:String,json:{write:!0}})],MA.prototype,"floorField",void 0),y([w({json:{read:!1,write:!1}})],MA.prototype,"viewAllMode",void 0),y([w({json:{read:!1,write:!1}})],MA.prototype,"viewAllLevelIds",void 0),MA=gQ=y([Z("esri.layers.support.LayerFloorInfo")],MA);const Zst=MA,zPe={BingMapsLayer:async()=>(await we(()=>import("./BingMapsLayer-UB9V9S3W.js"),__vite__mapDeps([]))).default,BuildingSceneLayer:async()=>(await we(()=>import("./BuildingSceneLayer-Bnoa9yAy.js"),__vite__mapDeps([11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]))).default,CSVLayer:async()=>(await we(()=>import("./CSVLayer-iQyfu2e9.js"),__vite__mapDeps([26,13,14,15,16,17,18,19,20,21,22,23,24,27,28]))).default,DimensionLayer:async()=>(await we(()=>import("./DimensionLayer-pDBYhz_R.js"),__vite__mapDeps([29,30]))).default,ElevationLayer:async()=>(await we(()=>Promise.resolve().then(()=>Jje),void 0)).default,FeatureLayer:async()=>(await we(()=>import("./FeatureLayer-9tNCmEbA.js"),__vite__mapDeps([13,14,15,16,17,18,19,20,21,22,23,24]))).default,GeoJSONLayer:async()=>(await we(()=>import("./GeoJSONLayer--Go-c1Ql.js"),__vite__mapDeps([31,27,28,17,18,19,20,21,22,23]))).default,GeoRSSLayer:async()=>(await we(()=>import("./GeoRSSLayer-mvh9EmL0.js"),__vite__mapDeps([]))).default,GroupLayer:async()=>(await we(()=>Promise.resolve().then(()=>Kct),void 0)).default,ImageryLayer:async()=>(await we(()=>import("./ImageryLayer-STU2SwYQ.js"),__vite__mapDeps([32,33,34,35,36,17,24]))).default,ImageryTileLayer:async()=>(await we(()=>import("./ImageryTileLayer-7zhL4pR_.js"),__vite__mapDeps([37,17,33,34,35,38,39]))).default,IntegratedMeshLayer:async()=>(await we(()=>import("./IntegratedMeshLayer-cHWMTQWg.js"),__vite__mapDeps([40,41]))).default,KMLLayer:async()=>(await we(()=>import("./KMLLayer-pgkQk7d5.js"),__vite__mapDeps([]))).default,LineOfSightLayer:async()=>(await we(()=>import("./LineOfSightLayer-5jg3FABh.js"),__vite__mapDeps([]))).default,LinkChartLayer:async()=>(await we(()=>import("./LinkChartLayer-bx0B-Kgd.js"),__vite__mapDeps([42,43,44,45,46,47,48,4,5,49,28,50,35,51,27,20]))).default,MapImageLayer:async()=>(await we(()=>import("./MapImageLayer-oZq_Q4o2.js"),__vite__mapDeps([52,53,54,36,55,23,22,15,17,24]))).default,MapNotesLayer:async()=>(await we(()=>import("./MapNotesLayer-ldLz1FWK.js"),__vite__mapDeps([56,13,14,15,16,17,18,19,20,21,22,23,24,57]))).default,MediaLayer:async()=>(await we(()=>import("./MediaLayer-PKp6pKCX.js"),__vite__mapDeps([58,59,60,45,46,47]))).default,OGCFeatureLayer:async()=>(await we(()=>import("./OGCFeatureLayer-hko6jm86.js"),__vite__mapDeps([61,62,63,64,27,28,17,18,19,20,21,23,22]))).default,OpenStreetMapLayer:async()=>(await we(()=>import("./OpenStreetMapLayer-qslplUAm.js"),__vite__mapDeps([65,66]))).default,OrientedImageryLayer:async()=>(await we(()=>import("./OrientedImageryLayer-F57-BGcl.js"),__vite__mapDeps([67,13,14,15,16,17,18,19,20,21,22,23,24]))).default,PointCloudLayer:async()=>(await we(()=>import("./PointCloudLayer-EgPyZPkK.js"),__vite__mapDeps([68,69]))).default,RouteLayer:async()=>(await we(()=>import("./RouteLayer-HsRHI0PF.js"),__vite__mapDeps([70,71]))).default,SceneLayer:async()=>(await we(()=>Promise.resolve().then(()=>mct),void 0)).default,StreamLayer:async()=>(await we(()=>import("./StreamLayer-FMdUAhtW.js"),__vite__mapDeps([72,17,18,19,20]))).default,SubtypeGroupLayer:async()=>(await we(()=>import("./SubtypeGroupLayer-lkxtOZrq.js"),__vite__mapDeps([73,17,14,15,22,24]))).default,TileLayer:async()=>(await we(()=>import("./TileLayer-RB9GhSe4.js"),__vite__mapDeps([74,53,54,36,55,23,22,15,17]))).default,UnknownLayer:async()=>(await we(()=>import("./UnknownLayer-lHoSTlsX.js"),__vite__mapDeps([]))).default,UnsupportedLayer:async()=>(await we(()=>import("./UnsupportedLayer--BUwN-ET.js"),__vite__mapDeps([]))).default,VectorTileLayer:async()=>(await we(()=>import("./VectorTileLayer-3l6dancR.js"),__vite__mapDeps([75,17,10,76,77,78]))).default,VoxelLayer:async()=>(await we(()=>import("./VoxelLayer-ggmlUmsY.js"),__vite__mapDeps([]))).default,WFSLayer:async()=>(await we(()=>import("./WFSLayer-8l6HCYA6.js"),__vite__mapDeps([79,27,28,80,63,64,81,17,18,19,20,21]))).default,WMSLayer:async()=>(await we(()=>Promise.resolve().then(()=>jct),void 0)).default,WMTSLayer:async()=>(await we(()=>import("./WMTSLayer-TE5fyme_.js"),__vite__mapDeps([82,66,81]))).default,WebTileLayer:async()=>(await we(()=>import("./WebTileLayer-jfo0VJmw.js").then(t=>t.W),__vite__mapDeps([]))).default};let sw=class extends Ue{constructor(){super(...arguments),this.name=null,this.field=null,this.currentRangeExtent=null,this.fullRangeExtent=null,this.type="rangeInfo"}};y([w({type:String,json:{read:!0,write:!0}})],sw.prototype,"name",void 0),y([w({type:String,json:{read:!0,write:!0}})],sw.prototype,"field",void 0),y([w({type:[Number],json:{read:!0,write:!0}})],sw.prototype,"currentRangeExtent",void 0),y([w({type:[Number],json:{read:!0,write:!0}})],sw.prototype,"fullRangeExtent",void 0),y([w({type:["rangeInfo"],readOnly:!0,json:{read:!1,write:!0}})],sw.prototype,"type",void 0),sw=y([Z("esri.layers.support.RangeInfo")],sw);const VE={Base64:0,Hex:1,String:2,Raw:3},mO=8,UPe=(1<>16)+(e>>16)+(i>>16)<<16|65535&i}function Jst(t){const e=[];for(let i=0,r=t.length*mO;i>5]|=(t.charCodeAt(i/mO)&UPe)<>5]>>>i%32&UPe));return e.join("")}function Qst(t){const e="0123456789abcdef",i=[];for(let r=0,n=4*t.length;r>2]>>r%4*8+4&15)+e.charAt(t[r>>2]>>r%4*8&15));return i.join("")}function eot(t){const e="=",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=[];for(let n=0,s=4*t.length;n>2]>>n%4*8&255)<<16|(t[n+1>>2]>>(n+1)%4*8&255)<<8|t[n+2>>2]>>(n+2)%4*8&255;for(let a=0;a<4;a++)8*n+6*a>32*t.length?r.push(e):r.push(i.charAt(o>>6*(3-a)&63))}return r.join("")}function tot(t,e){return t<>>32-e}function oj(t,e,i,r,n,s){return d2(tot(d2(d2(e,t),d2(r,s)),n),i)}function Dc(t,e,i,r,n,s,o){return oj(e&i|~e&r,t,e,n,s,o)}function Nc(t,e,i,r,n,s,o){return oj(e&r|i&~r,t,e,n,s,o)}function Fc(t,e,i,r,n,s,o){return oj(e^i^r,t,e,n,s,o)}function kc(t,e,i,r,n,s,o){return oj(i^(e|~r),t,e,n,s,o)}function iot(t,e){t[e>>5]|=128<>>9<<4)]=e;let i=1732584193,r=-271733879,n=-1732584194,s=271733878;for(let o=0;o{const n=aot(t,i,r);for(const s of e){const o=bne(i,s,r);for(const a in n)o[a]=n[a]}}}function aot(t,e,i){if((t==null?void 0:t.type)==="resource")return lot(t,e,i);switch((t==null?void 0:t.type)??"other"){case"other":return{read:!0,write:!0};case"url":{const{read:r,write:n}=mtt;return{read:r,write:n}}}}function lot(t,e,i){const r=T9(e,i);return{type:String,read:(n,s,o)=>{const a=BB(n,s,o);return r.type===String?a:typeof r.type=="function"?new r.type({url:a}):void 0},write:{writer(n,s,o,a){if(!(a!=null&&a.resources))return typeof n=="string"?void(s[o]=x_(n,a)):void(s[o]=n.write({},a));const c=hot(n),p=x_(c,{...a,verifyItemRelativeUrls:a!=null&&a.verifyItemRelativeUrls?{writtenUrls:a.verifyItemRelativeUrls.writtenUrls,rootPath:void 0}:void 0},oP.NO),_=r.type!==String&&(!vPe(this)||(a==null?void 0:a.origin)&&this.originIdOf(i)>qv(a.origin)),x={object:this,propertyName:i,value:n,targetUrl:p,dest:s,targetPropertyName:o,context:a,params:t};a!=null&&a.portalItem&&p&&!Qh(p)?_&&(t!=null&&t.contentAddressed)?_Q(x):_?cot(x):uot(x):a!=null&&a.portalItem&&(p==null||SMe(p)!=null||R2(p)||_)?_Q(x):s[o]=p}}}}function _Q(t){var M;const{targetUrl:e,params:i,value:r,context:n,dest:s,targetPropertyName:o}=t;if(!n.portalItem)return;const a=TMe(e),c=jPe(r,e,n);if(i!=null&&i.contentAddressed&&c.type!=="json")return void((M=n.messages)==null?void 0:M.push(new se("persistable:contentAddressingUnsupported",`Property "${o}" is trying to serializing a resource with content of type ${c.type} with content addressing. Content addressing is only supported for json resources.`,{content:c})));const p=i!=null&&i.contentAddressed&&c.type==="json"?rot(c.jsonString):(a==null?void 0:a.filename)??Zf(),_=Pp((i==null?void 0:i.prefix)??(a==null?void 0:a.prefix),p),x=`${_}.${yQ(c)}`;if(i!=null&&i.contentAddressed&&n.resources&&c.type==="json"){const P=n.resources.toKeep.find($=>$.resource.path===x)??n.resources.toAdd.find($=>$.resource.path===x);if(P)return void(s[o]=P.resource.itemRelativeUrl)}const S=n.portalItem.resourceFromPath(x);R2(e)&&n.resources&&n.resources.pendingOperations.push(Gqe(e).then(P=>{S.path=`${_}.${yQ({type:"blob",blob:P})}`,s[o]=S.itemRelativeUrl}).catch(()=>{}));const C=(i==null?void 0:i.compress)??!1;n.resources&&BPe({...t,resource:S,content:c,compress:C,updates:n.resources.toAdd}),s[o]=S.itemRelativeUrl}function cot(t){const{context:e,targetUrl:i,params:r,value:n,dest:s,targetPropertyName:o}=t;if(!e.portalItem)return;const a=e.portalItem.resourceFromPath(i),c=jPe(n,i,e),p=yQ(c),_=Nne(a.path),x=(r==null?void 0:r.compress)??!1;p===_?(e.resources&&BPe({...t,resource:a,content:c,compress:x,updates:e.resources.toUpdate}),s[o]=i):_Q(t)}function uot({context:t,targetUrl:e,dest:i,targetPropertyName:r}){t.portalItem&&t.resources&&(t.resources.toKeep.push({resource:t.portalItem.resourceFromPath(e),compress:!1}),i[r]=e)}function BPe({object:t,propertyName:e,updates:i,resource:r,content:n,compress:s}){i.push({resource:r,content:n,compress:s,finish:o=>{dot(t,e,o)}})}function jPe(t,e,i){return typeof t=="string"?{type:"url",url:e}:{type:"json",jsonString:JSON.stringify(t.toJSON(i))}}function hot(t){return t==null?null:typeof t=="string"?t:t.url}function dot(t,e,i){typeof t[e]=="string"?t[e]=i.url:t[e].url=i.url}var mF;let bQ=mF=class extends F_(tt.ofType(tl)){constructor(t){super(t)}clone(){return new mF(this.items.map(t=>t.clone()))}write(t,e){return this.toJSON(e)}toJSON(t){var i;const e=(i=t==null?void 0:t.layer)==null?void 0:i.spatialReference;return e?this.toArray().map(r=>{if(!e.equals(r.spatialReference)){if(!rh(r.spatialReference,e))return t!=null&&t.messages&&t.messages.push(new Hf("scenefilter:unsupported","Scene filters with incompatible spatial references are not supported",{modification:this,spatialReference:t.layer.spatialReference,context:t})),null;const s=new tl;pPe(r,s,e),r=s}const n=r.toJSON(t);return delete n.spatialReference,n}).filter(r=>r!=null):(t!=null&&t.messages&&t.messages.push(new Hf("scenefilter:unsupported","Writing Scene filters without context layer is not supported",{modification:this,spatialReference:t.layer.spatialReference,context:t})),this.toArray().map(r=>r.toJSON(t)))}static fromJSON(t,e){const i=new mF;return t.forEach(r=>i.add(tl.fromJSON(r,e))),i}};bQ=mF=y([Z("esri.layers.support.PolygonCollection")],bQ);const gF=bQ;var wQ;let OA=wQ=class extends Ue{constructor(t){super(t),this.spatialRelationship="disjoint",this.geometries=new gF,this._geometriesSource=null}initialize(){this.addHandles(Jr(()=>this.geometries,"after-changes",()=>this.geometries=this.geometries,Li))}readGeometries(t,e,i){Array.isArray(t)?this.geometries=gF.fromJSON(t,i):this._geometriesSource={url:w_(t,i),context:i}}async loadGeometries(t,e){if(this._geometriesSource==null)return;const{url:i,context:r}=this._geometriesSource,n=await yi(i,{responseType:"json",signal:e==null?void 0:e.signal}),s=t.toJSON(),o=n.data.map(a=>({...a,spatialReference:s}));this.geometries=gF.fromJSON(o,r),this._geometriesSource=null}clone(){const t=new wQ({geometries:Pe(this.geometries),spatialRelationship:this.spatialRelationship});return t._geometriesSource=this._geometriesSource,t}};y([w({type:["disjoint","contains"],nonNullable:!0,json:{write:!0}})],OA.prototype,"spatialRelationship",void 0),y([w({type:gF,nonNullable:!0,json:{write:!0}}),jv({origins:["web-scene","portal-item"],type:"resource",prefix:"geometries",contentAddressed:!0})],OA.prototype,"geometries",void 0),y([Rt(["web-scene","portal-item"],"geometries")],OA.prototype,"readGeometries",null),OA=wQ=y([Z("esri.layers.support.SceneFilter")],OA);const pot=OA;async function fot(t,e,i){const r=t&&t.getAtOrigin&&t.getAtOrigin("renderer",e.origin);if(r&&r.type==="unique-value"&&r.styleOrigin){const n=await ih(r.populateFromStyle());if(St(i),n.ok===!1){const s=n.error;e!=null&&e.messages&&e.messages.push(new Hf("renderer:style-reference",`Failed to create unique value renderer from style reference: ${s.message}`,{error:s,context:e})),t.clear("renderer",e==null?void 0:e.origin)}}}function GPe(t){return t?ga:bot}function mot(t,e){return e!=null&&e.mode?e.mode:GPe(t).mode}function HPe(t,e){return e??GPe(t)}function Ioe(t,e){return mot(t!=null&&t.hasZ,e)}function YQt(t,e){return HPe(t!=null&&!!t.hasZ,e)}function aj(t){const e=$oe(t);return Ioe(t.geometry,e)}function qPe(t){const e=$oe(t),i=Ioe(t.geometry,e);return{mode:i,offset:e!=null&&i!=="on-the-ground"?(e.offset??0)*XMe(e.unit??"meters"):0}}function lj(t){if(aj(t)==="on-the-ground")return!1;const e=$oe(t),i=e!=null&&e.featureExpressionInfo?e.featureExpressionInfo.expression:null;return!(!i||i==="0")}function $oe(t){return t.layer&&"elevationInfo"in t.layer?t.layer.elevationInfo:null}function XQt(t,e,i){if(!(i!=null&&i.mode))return;const r=t.hasZ?t.z:0,n=i.offset!=null?i.offset:0;switch(i.mode){case"absolute-height":return r-n;case"on-the-ground":return 0;case"relative-to-ground":return r-((e.elevationProvider.getElevation(t.x,t.y,r,t.spatialReference,"ground")??0)+n);case"relative-to-scene":return r-((e.elevationProvider.getElevation(t.x,t.y,r,t.spatialReference,"scene")??0)+n)}}function WPe(t,e,i,r=null){return XPe(t,e.x,e.y,e.hasZ?e.z:0,e.spatialReference,i,r)}function YPe(t,e,i,r,n=null){return XPe(t,e[0],e[1],e.length>2?e[2]:0,i,r,n)}function XPe(t,e,i,r,n,s,o=null){if(s==null)return;const a=o!=null?o.mode:"absolute-height";if(a==="on-the-ground")return 0;const{absoluteZ:c}=got(e,i,r,n,t,s);return yot(c,e,i,r,n,t,o,a)}function got(t,e,i,r,n,s){const o=s.offset!=null?s.offset:0;switch(s.mode){case"absolute-height":return{absoluteZ:i+o,elevation:0};case"on-the-ground":{const a=n.elevationProvider.getElevation(t,e,0,r,"ground")??0;return{absoluteZ:a,elevation:a}}case"relative-to-ground":{const a=n.elevationProvider.getElevation(t,e,i,r,"ground")??0;return{absoluteZ:i+a+o,elevation:a}}case"relative-to-scene":{const a=n.elevationProvider.getElevation(t,e,i,r,"scene")??0;return{absoluteZ:i+a+o,elevation:a}}}}function yot(t,e,i,r,n,s,o,a){const c=(o==null?void 0:o.offset)!=null?o.offset:0;switch(a){case"absolute-height":return t-c;case"relative-to-ground":return t-((s.elevationProvider.getElevation(e,i,r,n,"ground")??0)+c);case"relative-to-scene":return t-((s.elevationProvider.getElevation(e,i,r,n,"scene")??0)+c)}}function ZQt(t,e){if(e==null)return!1;const{mode:i}=e;return i!=null&&(t==="scene"&&i==="relative-to-scene"||t==="ground"&&i!=="absolute-height")}function JQt(t,e,i){return i&&i.mode!==e?`${t} only support ${e} elevation mode`:null}function vot(t,e,i){return(i==null?void 0:i.mode)===e?`${t} do not support ${e} elevation mode`:null}function _ot(t,e){return(e==null?void 0:e.featureExpressionInfo)!=null&&e.featureExpressionInfo.expression!=="0"?`${t} do not support featureExpressionInfo`:null}function nfe(t,e){e&&t.warn(".elevationInfo=",e)}const ga={mode:"absolute-height",offset:0},bot={mode:"on-the-ground",offset:null};function wot({displayField:t,editFieldsInfo:e,fields:i,objectIdField:r,title:n},s){if(!i)return null;const o=Eot({editFieldsInfo:e,fields:i,objectIdField:r},s);if(!o.length)return null;const a=Mot({titleBase:n,fields:i,displayField:t}),c=Aot();return new yE({title:a,content:c,fieldInfos:o})}const xot=(t,e)=>e.visibleFieldNames?e.visibleFieldNames.has(t.name):XQe(t,e);function Sot(t,e){const i=t;return e&&(t=t.filter(r=>!e.includes(r.type))),t===i&&(t=t.slice()),t.sort(Tot),t}function Tot(t,e){return t.type==="oid"?-1:e.type==="oid"?1:sfe(t)?-1:sfe(e)?1:(t.alias||t.name).toLocaleLowerCase().localeCompare((e.alias||e.name).toLocaleLowerCase())}function Eot(t,e){const i=e==null?void 0:e.visibleFieldNames;return Sot(t.fields??[],(e==null?void 0:e.ignoreFieldTypes)||Oot).map(r=>new Nse({fieldName:r.name,isEditable:YQe(r,t),label:r.alias,format:Cot(r),visible:xot(r,{...t,visibleFieldNames:i})}))}function Cot(t){switch(t.type){case"small-integer":case"integer":case"single":return new $7({digitSeparator:!0,places:0});case"double":return new $7({digitSeparator:!0,places:2});case"string":return wet(t.name)?new $7({digitSeparator:!0,places:0}):null;default:return null}}function Aot(){return[new TL,new SL]}function Mot(t){const e=FQe(t),{titleBase:i}=t;return e?`${i}: {${e.trim()}}`:i??""}function sfe(t){return(t.name&&t.name.toLowerCase())==="name"?!0:(t.alias&&t.alias.toLowerCase())==="name"}const Oot=["geometry","blob","raster","guid","xml"];function Kf(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function Pot(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Loe(t,e,i,r,n,s,o,a,c,p){return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t[4]=s,t[5]=o,t[6]=a,t[7]=c,t[8]=p,t}function Doe(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Qf(t,e){if(t===e){const i=e[1],r=e[2],n=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=r,t[7]=n}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function EE(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],a=e[5],c=e[6],p=e[7],_=e[8],x=_*o-a*p,S=-_*s+a*c,C=p*s-o*c;let M=i*x+r*S+n*C;return M?(M=1/M,t[0]=x*M,t[1]=(-_*r+n*p)*M,t[2]=(a*r-n*o)*M,t[3]=S*M,t[4]=(_*i-n*c)*M,t[5]=(-a*i+n*s)*M,t[6]=C*M,t[7]=(-p*i+r*c)*M,t[8]=(o*i-r*s)*M,t):null}function Rot(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],a=e[5],c=e[6],p=e[7],_=e[8];return t[0]=o*_-a*p,t[1]=n*p-r*_,t[2]=r*a-n*o,t[3]=a*c-s*_,t[4]=i*_-n*c,t[5]=n*s-i*a,t[6]=s*p-o*c,t[7]=r*c-i*p,t[8]=i*o-r*s,t}function Iot(t){const e=t[0],i=t[1],r=t[2],n=t[3],s=t[4],o=t[5],a=t[6],c=t[7],p=t[8];return e*(p*s-o*c)+i*(-p*n+o*a)+r*(c*n-s*a)}function fP(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3],a=e[4],c=e[5],p=e[6],_=e[7],x=e[8],S=i[0],C=i[1],M=i[2],P=i[3],$=i[4],F=i[5],z=i[6],k=i[7],U=i[8];return t[0]=S*r+C*o+M*p,t[1]=S*n+C*a+M*_,t[2]=S*s+C*c+M*x,t[3]=P*r+$*o+F*p,t[4]=P*n+$*a+F*_,t[5]=P*s+$*c+F*x,t[6]=z*r+k*o+U*p,t[7]=z*n+k*a+U*_,t[8]=z*s+k*c+U*x,t}function Kz(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3],a=e[4],c=e[5],p=e[6],_=e[7],x=e[8],S=i[0],C=i[1];return t[0]=r,t[1]=n,t[2]=s,t[3]=o,t[4]=a,t[5]=c,t[6]=S*r+C*o+p,t[7]=S*n+C*a+_,t[8]=S*s+C*c+x,t}function Noe(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3],a=e[4],c=e[5],p=e[6],_=e[7],x=e[8],S=Math.sin(i),C=Math.cos(i);return t[0]=C*r+S*o,t[1]=C*n+S*a,t[2]=C*s+S*c,t[3]=C*o-S*r,t[4]=C*a-S*n,t[5]=C*c-S*s,t[6]=p,t[7]=_,t[8]=x,t}function Foe(t,e,i){const r=i[0],n=i[1],s=i[2];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t[6]=s*e[6],t[7]=s*e[7],t[8]=s*e[8],t}function $ot(t,e,i){const r=i[0],n=i[1];return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t}function Lot(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function Dot(t,e){const i=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=i,t[2]=0,t[3]=-i,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Not(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Fot(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function cj(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=i+i,a=r+r,c=n+n,p=i*o,_=r*o,x=r*a,S=n*o,C=n*a,M=n*c,P=s*o,$=s*a,F=s*c;return t[0]=1-x-M,t[3]=_-F,t[6]=S+$,t[1]=_+F,t[4]=1-p-M,t[7]=C-P,t[2]=S-$,t[5]=C+P,t[8]=1-p-x,t}function ZPe(t,e){const i=e[0],r=e[1],n=e[2],s=e[4],o=e[5],a=e[6],c=e[8],p=e[9],_=e[10],x=_*o-a*p,S=-_*s+a*c,C=p*s-o*c,M=i*x+r*S+n*C;if(!M)return null;const P=1/M;return t[0]=x*P,t[1]=(-_*r+n*p)*P,t[2]=(a*r-n*o)*P,t[3]=S*P,t[4]=(_*i-n*c)*P,t[5]=(-a*i+n*s)*P,t[6]=C*P,t[7]=(-p*i+r*c)*P,t[8]=(o*i-r*s)*P,t}function E_(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],a=e[5],c=e[6],p=e[7],_=e[8],x=e[9],S=e[10],C=e[11],M=e[12],P=e[13],$=e[14],F=e[15],z=i*a-r*o,k=i*c-n*o,U=i*p-s*o,j=r*c-n*a,G=r*p-s*a,Y=n*p-s*c,Q=_*P-x*M,ne=_*$-S*M,ie=_*F-C*M,he=x*$-S*P,ce=x*F-C*P,ve=S*F-C*$;let ge=z*ve-k*ce+U*he+j*ie-G*ne+Y*Q;return ge?(ge=1/ge,t[0]=(a*ve-c*ce+p*he)*ge,t[1]=(c*ie-o*ve-p*ne)*ge,t[2]=(o*ce-a*ie+p*Q)*ge,t[3]=(n*ce-r*ve-s*he)*ge,t[4]=(i*ve-n*ie+s*ne)*ge,t[5]=(r*ie-i*ce-s*Q)*ge,t[6]=(P*Y-$*G+F*j)*ge,t[7]=($*U-M*Y-F*k)*ge,t[8]=(M*G-P*U+F*z)*ge,t):null}function kot(t,e,i){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/i,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function zot(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function Uot(t){return Math.sqrt(t[0]**2+t[1]**2+t[2]**2+t[3]**2+t[4]**2+t[5]**2+t[6]**2+t[7]**2+t[8]**2)}function Vot(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t}function JPe(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t}function Bot(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t}function jot(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t[2]=e[2]+i[2]*r,t[3]=e[3]+i[3]*r,t[4]=e[4]+i[4]*r,t[5]=e[5]+i[5]*r,t[6]=e[6]+i[6]*r,t[7]=e[7]+i[7]*r,t[8]=e[8]+i[8]*r,t}function Got(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function Hot(t,e){const i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],c=t[6],p=t[7],_=t[8],x=e[0],S=e[1],C=e[2],M=e[3],P=e[4],$=e[5],F=e[6],z=e[7],k=e[8],U=al();return Math.abs(i-x)<=U*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(r-S)<=U*Math.max(1,Math.abs(r),Math.abs(S))&&Math.abs(n-C)<=U*Math.max(1,Math.abs(n),Math.abs(C))&&Math.abs(s-M)<=U*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(o-P)<=U*Math.max(1,Math.abs(o),Math.abs(P))&&Math.abs(a-$)<=U*Math.max(1,Math.abs(a),Math.abs($))&&Math.abs(c-F)<=U*Math.max(1,Math.abs(c),Math.abs(F))&&Math.abs(p-z)<=U*Math.max(1,Math.abs(p),Math.abs(z))&&Math.abs(_-k)<=U*Math.max(1,Math.abs(_),Math.abs(k))}function koe(t){const e=al(),i=t[0],r=t[1],n=t[2],s=t[3],o=t[4],a=t[5],c=t[6],p=t[7],_=t[8];return Math.abs(1-(i*i+s*s+c*c))<=e&&Math.abs(1-(r*r+o*o+p*p))<=e&&Math.abs(1-(n*n+a*a+_*_))<=e}const qot=fP,Wot=JPe;Object.freeze(Object.defineProperty({__proto__:null,add:Vot,adjoint:Rot,copy:Pot,determinant:Iot,equals:Hot,exactEquals:Got,frob:Uot,fromMat2d:Fot,fromMat4:Kf,fromQuat:cj,fromRotation:Dot,fromScaling:Not,fromTranslation:Lot,identity:Doe,invert:EE,isOrthoNormal:koe,mul:qot,multiply:fP,multiplyScalar:Bot,multiplyScalarAndAdd:jot,normalFromMat4:E_,normalFromMat4Legacy:ZPe,projection:kot,rotate:Noe,scale:Foe,scaleByVec2:$ot,set:Loe,str:zot,sub:Wot,subtract:JPe,translate:Kz,transpose:Qf},Symbol.toStringTag,{value:"Module"}));function as(){return[1,0,0,0,1,0,0,0,1]}function KPe(t){return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8]]}function Yot(t,e,i,r,n,s,o,a,c){return[t,e,i,r,n,s,o,a,c]}function QPe(t,e){return new Float64Array(t,e,9)}Object.freeze(Object.defineProperty({__proto__:null,clone:KPe,create:as,createView:QPe,fromValues:Yot},Symbol.toStringTag,{value:"Module"}));function Qe(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function mP(t){return[t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15]]}function zoe(t,e,i,r,n,s,o,a,c,p,_,x,S,C,M,P){return[t,e,i,r,n,s,o,a,c,p,_,x,S,C,M,P]}function e5e(t,e){return new Float64Array(t,e,16)}const gs=Qe();Object.freeze(Object.defineProperty({__proto__:null,IDENTITY:gs,clone:mP,create:Qe,createView:e5e,fromValues:zoe},Symbol.toStringTag,{value:"Module"}));function Rp(){return[0,0,0,1]}function t5e(t){return[t[0],t[1],t[2],t[3]]}function Xot(t,e,i,r){return[t,e,i,r]}function i5e(t,e){return new Float64Array(t,e,4)}const Zot=Rp();Object.freeze(Object.defineProperty({__proto__:null,IDENTITY:Zot,clone:t5e,create:Rp,createView:i5e,fromValues:Xot},Symbol.toStringTag,{value:"Module"}));function Jot(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function OL(t,e,i){i*=.5;const r=Math.sin(i);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(i),t}function Uoe(t,e){const i=2*Math.acos(e[3]),r=Math.sin(i/2);return r>al()?(t[0]=e[0]/r,t[1]=e[1]/r,t[2]=e[2]/r):(t[0]=1,t[1]=0,t[2]=0),i}function uj(t,e,i){const r=e[0],n=e[1],s=e[2],o=e[3],a=i[0],c=i[1],p=i[2],_=i[3];return t[0]=r*_+o*a+n*p-s*c,t[1]=n*_+o*c+s*a-r*p,t[2]=s*_+o*p+r*c-n*a,t[3]=o*_-r*a-n*c-s*p,t}function Kot(t,e,i){i*=.5;const r=e[0],n=e[1],s=e[2],o=e[3],a=Math.sin(i),c=Math.cos(i);return t[0]=r*c+o*a,t[1]=n*c+s*a,t[2]=s*c-n*a,t[3]=o*c-r*a,t}function Qot(t,e,i){i*=.5;const r=e[0],n=e[1],s=e[2],o=e[3],a=Math.sin(i),c=Math.cos(i);return t[0]=r*c-s*a,t[1]=n*c+o*a,t[2]=s*c+r*a,t[3]=o*c-n*a,t}function eat(t,e,i){i*=.5;const r=e[0],n=e[1],s=e[2],o=e[3],a=Math.sin(i),c=Math.cos(i);return t[0]=r*c+n*a,t[1]=n*c-r*a,t[2]=s*c+o*a,t[3]=o*c-s*a,t}function tat(t,e){const i=e[0],r=e[1],n=e[2];return t[0]=i,t[1]=r,t[2]=n,t[3]=Math.sqrt(Math.abs(1-i*i-r*r-n*n)),t}function yF(t,e,i,r){const n=e[0],s=e[1],o=e[2],a=e[3];let c,p,_,x,S,C=i[0],M=i[1],P=i[2],$=i[3];return p=n*C+s*M+o*P+a*$,p<0&&(p=-p,C=-C,M=-M,P=-P,$=-$),1-p>al()?(c=Math.acos(p),_=Math.sin(c),x=Math.sin((1-r)*c)/_,S=Math.sin(r*c)/_):(x=1-r,S=r),t[0]=x*n+S*C,t[1]=x*s+S*M,t[2]=x*o+S*P,t[3]=x*a+S*$,t}function iat(t){const e=P9,i=e(),r=e(),n=e(),s=Math.sqrt(1-i),o=Math.sqrt(i);return t[0]=s*Math.sin(2*Math.PI*r),t[1]=s*Math.cos(2*Math.PI*r),t[2]=o*Math.sin(2*Math.PI*n),t[3]=o*Math.cos(2*Math.PI*n),t}function rat(t,e){const i=e[0],r=e[1],n=e[2],s=e[3],o=i*i+r*r+n*n+s*s,a=o?1/o:0;return t[0]=-i*a,t[1]=-r*a,t[2]=-n*a,t[3]=s*a,t}function C_(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function r5e(t,e){const i=e[0]+e[4]+e[8];let r;if(i>0)r=Math.sqrt(i+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{let n=0;e[4]>e[0]&&(n=1),e[8]>e[3*n+n]&&(n=2);const s=(n+1)%3,o=(n+2)%3;r=Math.sqrt(e[3*n+n]-e[3*s+s]-e[3*o+o]+1),t[n]=.5*r,r=.5/r,t[3]=(e[3*s+o]-e[3*o+s])*r,t[s]=(e[3*s+n]+e[3*n+s])*r,t[o]=(e[3*o+n]+e[3*n+o])*r}return t}function nat(t,e,i,r){const n=.5*Math.PI/180;e*=n,i*=n,r*=n;const s=Math.sin(e),o=Math.cos(e),a=Math.sin(i),c=Math.cos(i),p=Math.sin(r),_=Math.cos(r);return t[0]=s*c*_-o*a*p,t[1]=o*a*_+s*c*p,t[2]=o*c*p-s*a*_,t[3]=o*c*_+s*a*p,t}function sat(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}const H9=ym,oat=rs,aat=Kne,lat=uj,cat=jT,uat=NEe,hat=vB,n5e=Qne,dat=n5e,s5e=ese,pat=s5e,Voe=DEe,fat=aO,mat=GT;function gat(t,e,i){const r=Ve(e,i);return r<-.999999?(Wt(ig,yat,e),Nh(ig)<1e-6&&Wt(ig,vat,e),Ye(ig,ig),OL(t,ig,Math.PI),t):r>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(Wt(ig,e,i),t[0]=ig[0],t[1]=ig[1],t[2]=ig[2],t[3]=1+r,Voe(t,t))}const ig=W(),yat=st(1,0,0),vat=st(0,1,0);function _at(t,e,i,r,n,s){return yF(ofe,e,n,s),yF(afe,i,r,s),yF(t,ofe,afe,2*s*(1-s)),t}const ofe=Rp(),afe=Rp();function bat(t,e,i,r){const n=wat;return n[0]=i[0],n[3]=i[1],n[6]=i[2],n[1]=r[0],n[4]=r[1],n[7]=r[2],n[2]=-e[0],n[5]=-e[1],n[8]=-e[2],Voe(t,r5e(t,n))}const wat=as();Object.freeze(Object.defineProperty({__proto__:null,add:aat,calculateW:tat,conjugate:C_,copy:H9,dot:uat,equals:mat,exactEquals:fat,fromEuler:nat,fromMat3:r5e,getAxisAngle:Uoe,identity:Jot,invert:rat,len:dat,length:n5e,lerp:hat,mul:lat,multiply:uj,normalize:Voe,random:iat,rotateX:Kot,rotateY:Qot,rotateZ:eat,rotationTo:gat,scale:cat,set:oat,setAxes:bat,setAxisAngle:OL,slerp:yF,sqlerp:_at,sqrLen:pat,squaredLength:s5e,str:sat},Symbol.toStringTag,{value:"Module"}));const xat=new rt(tEe),lfe=new rt(uB),cfe=new rt(hB),KQt=new rt(iEe);function e0(t){return t&&(u1(t)||jn(t,lfe))?lfe:t&&(h1(t)||jn(t,cfe))?cfe:xat}function o5e(t,e,i){const r=Math.sin(t),n=Math.cos(t),s=Math.sin(e),o=Math.cos(e),a=i;return a[0]=-r,a[4]=-s*n,a[8]=o*n,a[12]=0,a[1]=n,a[5]=-s*r,a[9]=o*r,a[13]=0,a[2]=0,a[6]=o,a[10]=s,a[14]=0,a[3]=0,a[7]=0,a[11]=0,a[15]=1,a}function Sat(t,e,i){return o5e(t,e,i),ud(i,i),i}function Ac(t,e,i,r){if(t==null||r==null)return!1;const n=AL(t,nPe),s=AL(r,xnt);if(n===s&&!ufe(s)&&(n!==Oe.UNKNOWN||jn(t,r)))return D9(i,e),!0;if(ufe(s)){const o=IM[n][Oe.LON_LAT],a=IM[Oe.LON_LAT][s];return o!=null&&a!=null&&(o(e,0,hb,0),a(hb,0,db,0),o5e(pD*hb[0],pD*hb[1],i),i[12]=db[0],i[13]=db[1],i[14]=db[2],!0)}if((s===Oe.WEB_MERCATOR||s===Oe.PLATE_CARREE)&&(n===Oe.WGS84||n===Oe.CGCS2000&&s===Oe.PLATE_CARREE||n===Oe.SPHERICAL_ECEF||n===Oe.WEB_MERCATOR)){const o=IM[n][Oe.LON_LAT],a=IM[Oe.LON_LAT][s];return o!=null&&a!=null&&(o(e,0,hb,0),a(hb,0,db,0),n===Oe.SPHERICAL_ECEF?Sat(pD*hb[0],pD*hb[1],i):Yf(i),i[12]=db[0],i[13]=db[1],i[14]=db[2],!0)}return!1}function ufe(t){return t===Oe.SPHERICAL_ECEF||t===Oe.SPHERICAL_MARS_PCPF||t===Oe.SPHERICAL_MOON_PCPF}const pD=Ei(1),hb=W(),db=W();function il(t,e,i,r){return!(e==null||r==null||t.length<2)&&(t.length===2&&(fD[0]=t[0],fD[1]=t[1],fD[2]=0,t=fD),un(t,e,0,i,r,0,1))}const fD=W(),_o=!0,KS={identifierOffset:0,identifierLength:10,versionOffset:10,checksumOffset:12,byteCount:16};function Boe(t,e,i){return{identifier:String.fromCharCode.apply(null,new Uint8Array(t,i+KS.identifierOffset,KS.identifierLength)),version:e.getUint16(i+KS.versionOffset,_o),checksum:e.getUint32(i+KS.checksumOffset,_o)}}const Eh={sizeLo:0,sizeHi:4,minX:8,minY:16,minZ:24,maxX:32,maxY:40,maxZ:48,errorX:56,errorY:64,errorZ:72,count:80,reserved:84,byteCount:88};function Tat(t,e){return{sizeLo:t.getUint32(e+Eh.sizeLo,_o),sizeHi:t.getUint32(e+Eh.sizeHi,_o),minX:t.getFloat64(e+Eh.minX,_o),minY:t.getFloat64(e+Eh.minY,_o),minZ:t.getFloat64(e+Eh.minZ,_o),maxX:t.getFloat64(e+Eh.maxX,_o),maxY:t.getFloat64(e+Eh.maxY,_o),maxZ:t.getFloat64(e+Eh.maxZ,_o),errorX:t.getFloat64(e+Eh.errorX,_o),errorY:t.getFloat64(e+Eh.errorY,_o),errorZ:t.getFloat64(e+Eh.errorZ,_o),count:t.getUint32(e+Eh.count,_o),reserved:t.getUint32(e+Eh.reserved,_o)}}function QQt(t){const e=new DataView(t,0);let i=0;const{identifier:r,version:n}=Boe(t,e,i);if(i+=KS.byteCount,r!=="LEPCC ")throw new se("lepcc-decode-error","Bad identifier");if(n>1)throw new se("lepcc-decode-error","Unknown version");const s=Tat(e,i);if(i+=Eh.byteCount,s.sizeHi*2**32+s.sizeLo!==t.byteLength)throw new se("lepcc-decode-error","Bad size");const o=new Float64Array(3*s.count),a=[],c=[],p=[],_=[];if(i=mD(t,i,a),i=mD(t,i,c),i=mD(t,i,p),i=mD(t,i,_),i!==t.byteLength)throw new se("lepcc-decode-error","Bad length");let x=0,S=0;for(let C=0;C>6;let c=0;if(a===0)c=r.getUint32(1,_o),e+=5;else if(a===1)c=r.getUint16(1,_o),e+=3;else{if(a!==2)throw new se("lepcc-decode-error","Bad count type");c=r.getUint8(1),e+=2}if(o)throw new se("lepcc-decode-error","LUT not implemented");const p=Math.ceil(c*s/8),_=new Uint8Array(t,e,p);let x=0,S=0,C=0;const M=-1>>>32-s;for(let P=0;P>>=s,S-=s,S+s>32&&(x|=_[C-1]>>8-S)}return e+C}const B3={sizeLo:0,sizeHi:4,count:8,colorMapCount:12,lookupMethod:14,compressionMethod:15,byteCount:16};function Eat(t,e){return{sizeLo:t.getUint32(e+B3.sizeLo,_o),sizeHi:t.getUint32(e+B3.sizeHi,_o),count:t.getUint32(e+B3.count,_o),colorMapCount:t.getUint16(e+B3.colorMapCount,_o),lookupMethod:t.getUint8(e+B3.lookupMethod),compressionMethod:t.getUint8(e+B3.compressionMethod)}}function Cat(t){const e=new DataView(t,0);let i=0;const{identifier:r,version:n}=Boe(t,e,i);if(i+=KS.byteCount,r!=="ClusterRGB")throw new se("lepcc-decode-error","Bad identifier");if(n>1)throw new se("lepcc-decode-error","Unknown version");const s=Eat(e,i);if(i+=B3.byteCount,s.sizeHi*2**32+s.sizeLo!==t.byteLength)throw new se("lepcc-decode-error","Bad size");if((s.lookupMethod===2||s.lookupMethod===1)&&s.compressionMethod===0){if(3*s.colorMapCount+s.count+i!==t.byteLength||s.colorMapCount>256)throw new se("lepcc-decode-error","Bad count");const o=new Uint8Array(t,i,3*s.colorMapCount),a=new Uint8Array(t,i+3*s.colorMapCount,s.count),c=new Uint8Array(3*s.count);for(let p=0;p1)throw new se("lepcc-decode-error","Unknown version");const s=Aat(e,i);if(i+=j3.byteCount,s.sizeHi*2**32+s.sizeLo!==t.byteLength)throw new se("lepcc-decode-error","Bad size");const o=new Uint16Array(s.count);if(s.bitsPerPoint===8){if(s.count+i!==t.byteLength)throw new se("lepcc-decode-error","Bad size");const a=new Uint8Array(t,i,s.count);for(let c=0;c=192&&s<224){if(n+1>=i)throw new se("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const o=(31&s)<<6|63&t[e+n+1];r+=String.fromCharCode(o),n+=2}else if(s>=224&&s<240){if(n+2>=i)throw new se("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const o=(15&s)<<12|(63&t[e+n+1])<<6|63&t[e+n+2];r+=String.fromCharCode(o),n+=3}else{if(!(s>=240&&s<248))throw new se("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(n+3>=i)throw new se("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const o=(7&s)<<18|(63&t[e+n+1])<<12|(63&t[e+n+2])<<6|63&t[e+n+3];if(o>=65536){const a=55296+(o-65536>>10),c=56320+(1023&o);r+=String.fromCharCode(a,c)}else r+=String.fromCharCode(o);n+=4}}}return r}function a5e(t,e){const i={byteOffset:0,byteCount:0,fields:Object.create(null)};let r=0;for(let n=0;n{const n=r?Date.parse(r):null;return n&&!Number.isNaN(n)?n:null})}function l5e(t,e,i){const r=[];let n,s,o=0;for(s=0;s0){if(r.push(Pat(i,o,n-1)),i[o+n-1]!==0)throw new se("string-array-error","Invalid string array: missing null termination.")}else r.push(null);o+=n}return r}function hfe(t,e){return new hj[e.valueType](t,e.byteOffset,e.count*e.valuesPerElement)}function Iat(t,e){return new Uint8Array(t,e.byteOffset,e.byteCount)}function $at(t,e,i){const r=e.header!=null?a5e(t,e.header):{byteOffset:0,byteCount:0,fields:{count:i}},n={header:r,byteOffset:r.byteCount,byteCount:0,entries:Object.create(null)};let s=r.byteCount;for(let o=0;onew DataView(t,0).getFloat32(e,!0),Float64:(t,e)=>new DataView(t,0).getFloat64(e,!0),UInt8:(t,e)=>new DataView(t,0).getUint8(e),Int8:(t,e)=>new DataView(t,0).getInt8(e),UInt16:(t,e)=>new DataView(t,0).getUint16(e,!0),Int16:(t,e)=>new DataView(t,0).getInt16(e,!0),UInt32:(t,e)=>new DataView(t,0).getUint32(e,!0),Int32:(t,e)=>new DataView(t,0).getInt32(e,!0)};function u5e(t){return hj.hasOwnProperty(t)}function vF(t){return u5e(t)?hj[t].BYTES_PER_ELEMENT:0}function Uat(t,e,i,r){const n=Vat(t,e,i),s=Qe();return Ac(i,n,s,r),s}const h5e=1,dfe=5-h5e;function Vat(t,e,i){const r=W(),n=t[3],s=2**(Math.ceil(Math.log(n)*Math.LOG2E/dfe)*dfe+h5e);if(i.isGeographic){const c=s/Tr(i).radius*180/Math.PI,p=Math.round(t[1]/c),_=Math.max(-90,Math.min(90,p*c)),x=c/Math.cos((Math.abs(_)-c/2)/180*Math.PI),S=Math.round(t[0]/x)*x;r[0]=S,r[1]=_}else{const c=Math.round(t[0]/s),p=Math.round(t[1]/s);r[0]=c*s,r[1]=p*s}const o=t[2]+e,a=Math.round(o/s);return r[2]=a*s,r}function Bat(t){return t.type==="fill"}function jat(t){return t.type==="extrude"}var Wi;(function(t){t[t.INVISIBLE=0]="INVISIBLE",t[t.TRANSPARENT=1]="TRANSPARENT",t[t.OPAQUE=2]="OPAQUE"})(Wi||(Wi={}));function Gat(t){return t&&t.enabled&&(jat(t)||Bat(t))&&t.edges!=null}function Hat(t){return t&&t.enabled&&t.edges||null}function d5e(t,e){return p5e(Hat(t),e)}function p5e(t,e){if(t==null)return null;const i=t.color!=null?QB(qe.toUnitRGBA(t.color)):Mi(0,0,0,0),r=Er(t.size),n=Er(t.extensionLength);switch(t.type){case"solid":return f5e({color:i,size:r,extensionLength:n,...e});case"sketch":return qat({color:i,size:r,extensionLength:n,...e});default:return}}function f5e(t){return{...Wat,...t,type:"solid"}}function qat(t){return{...Yat,...t,type:"sketch"}}const Wat={color:Mi(0,0,0,.2),size:1,extensionLength:0,opacity:1,objectTransparency:Wi.OPAQUE,hasSlicePlane:!1},Yat={color:Mi(0,0,0,.2),size:1,extensionLength:0,opacity:1,objectTransparency:Wi.OPAQUE,hasSlicePlane:!1};var Vo;function m5e(t){switch(t){case"multiply":default:return Vo.Multiply;case"ignore":return Vo.Ignore;case"replace":return Vo.Replace;case"tint":return Vo.Tint}}function g5e(t,e,i){if(t==null||e===Vo.Ignore)return i[0]=255,i[1]=255,i[2]=255,void(i[3]=255);const r=Je(Math.round(t[3]*Qz),0,Qz),n=r===0||e===Vo.Tint?0:e===Vo.Replace?Xat:Zat;i[0]=Je(Math.round(t[0]*BE),0,BE),i[1]=Je(Math.round(t[1]*BE),0,BE),i[2]=Je(Math.round(t[2]*BE),0,BE),i[3]=r+n}(function(t){t[t.Multiply=1]="Multiply",t[t.Ignore=2]="Ignore",t[t.Replace=3]="Replace",t[t.Tint=4]="Tint"})(Vo||(Vo={}));const BE=255,Qz=85,Xat=Qz,Zat=2*Qz;let j_=class{constructor(e){this._allocator=e,this._items=[],this._itemsPtr=0,this._grow()}get(){return this._itemsPtr===0&&qO(()=>this._reset()),this._itemsPtr===this._items.length&&this._grow(),this._items[this._itemsPtr++]}_reset(){const e=Math.min(3*Math.max(8,this._itemsPtr),this._itemsPtr+3*pfe);this._items.length=Math.min(e,this._items.length),this._itemsPtr=0}_grow(){for(let e=0;ethis._reset());const e=Math.floor(this._itemsPtr/this._itemsPerBuffer);for(;this._buffers.length<=e;){const i=new ArrayBuffer(this._itemsPerBuffer*this._itemByteSize);for(let r=0;re;)this._buffers.pop(),this._items.length=this._buffers.length*this._itemsPerBuffer;this._itemsPtr=0}static createVec2f64(e=jE){return new G3(16,v5e,e)}static createVec3f64(e=jE){return new G3(24,wEe,e)}static createVec4f64(e=jE){return new G3(32,xOe,e)}static createMat3f64(e=jE){return new G3(72,QPe,e)}static createMat4f64(e=jE){return new G3(128,e5e,e)}static createQuatf64(e=jE){return new G3(32,i5e,e)}get test(){return{size:this._buffers.length*this._itemsPerBuffer*this._itemByteSize}}};const jE=4*V2.KILOBYTES,rei=E5.createVec2f64(),xt=E5.createVec3f64(),joe=E5.createVec4f64();E5.createMat3f64();const Goe=E5.createMat4f64(),nei=E5.createQuatf64();function Qo(t){return t?ffe(Xr(t.origin),Xr(t.direction)):ffe(W(),W())}function ffe(t,e){return{origin:t,direction:e}}function sei(t,e){return jy(t.origin,e.origin)&&jy(t.direction,e.direction)}function Ap(t,e){const i=tlt.get();return i.origin=t,i.direction=e,i}function eU(t,e=Qo()){return T5e(t.origin,t.direction,e)}function Hoe(t,e,i=Qo()){return Ne(i.origin,t),je(i.direction,e,t),i}function T5e(t,e,i=Qo()){return Ne(i.origin,t),Ne(i.direction,e),i}function Qat(t,e){const i=Wt(xt.get(),Ye(xt.get(),t.direction),je(xt.get(),e,t.origin));return Ve(i,i)}function elt(t,e,i){const r=Ve(t.direction,je(i,e,t.origin));return Be(i,t.origin,De(i,t.direction,r)),i}const tlt=new j_(()=>Qo());function oei(t,e,i){const r=Ve(t,e)/Ve(t,t);return De(i,t,r)}function S2(t,e){return Ve(t,e)/nt(t)}function dj(t,e){const i=Ve(t,e)/(nt(t)*nt(e));return-Aa(i)}function E5e(t,e,i){Ye(gD,t),Ye(ZH,e);const r=Ve(gD,ZH),n=Aa(r),s=Wt(gD,gD,ZH);return Ve(s,i)<0?2*Math.PI-n:n}const gD=W(),ZH=W(),C5e=uo();function uo(){return Xi()}const A5e=GT,ilt=GT;function gP(t,e=uo()){return ym(e,t)}function qoe(t,e){return Mi(t[0],t[1],t[2],e)}function rlt(t){return t}function nlt(t){t[0]=t[1]=t[2]=t[3]=0}function pj(t,e){return t[0]=t[1]=t[2]=0,t[3]=e,t}function r_(t){return t[3]}function slt(t){return t}function M5e(t,e,i,r){return Mi(t,e,i,r)}function olt(t,e,i){return t!==i&&Ne(i,t),i[3]=t[3]+e,i}function alt(t,e,i){return Ce.getLogger("esri.geometry.support.sphere").error("sphere.setExtent is not yet supported"),t===i?i:gP(t,i)}function px(t,e,i){if(e==null||!P5e(t,e,tU))return!1;let{t0:r,t1:n}=tU;if((r<0||n0)&&(r=n),r<0)return!1;if(i){const{origin:s,direction:o}=e;i[0]=s[0]+o[0]*r,i[1]=s[1]+o[1]*r,i[2]=s[2]+o[2]*r}return!0}function O5e(t,e,i){const r=Hoe(e,i);if(!P5e(t,r,tU))return[];const{origin:n,direction:s}=r,{t0:o,t1:a}=tU,c=p=>{const _=W();return lo(_,n,s,p),fj(t,_,_)};return Math.abs(o-a)Math.abs(t[1])?Ie(e,0,1,0):Ie(e,1,0,0),Wt(i,t,e),Ye(e,e),Wt(e,i,t),Ye(i,i)}function yD(t,e,i,r,n,s){const o=t+(e-t)*n;return o+(i+(r-i)*n-o)*s}function glt(t,e,i,r=W()){const n=nt(t),s=nt(e),o=Ve(t,e)/(n*s);if(o<.9999999999999999){const a=Math.acos(o),c=((1-i)*n+i*s)/Math.sin(a),p=c/n*Math.sin((1-i)*a),_=c/s*Math.sin(i*a);return De(QS,t,p),De(eT,e,_),Be(r,QS,eT)}return Qr(r,t,e,i)}function lei(t,e,i,r=W(),n=W()){const s=nt(t),o=nt(e),a=Ve(t,e)/(s*o);if(a<.9999999999999999){const c=Math.acos(a),p=Math.sin(c),_=Math.sin(i*c),x=Math.sin((1-i)*c),S=(1-i)*s+i*o;{const C=S/p,M=C/o*_;De(QS,t,C/s*x),De(eT,e,M),Be(r,QS,eT)}{const C=1/s*(-Math.cos((1-i)*c)*c*S+x*(-s+o));De(QS,t,C);const M=1/o*(Math.cos(i*c)*c*S+_*(-s+o));De(eT,e,M),Be(n,QS,eT),De(n,n,1/p)}return n}return Qr(r,t,e,i),je(n,e,t),Ye(n,n),n}function _F(t,e,i){t=Ye(QS,t),e=Ye(eT,e);const r=Aa(Ve(t,e));if(i){const n=Wt(ylt,t,e);if(Ve(n,i)<0)return-r}return r}function bF(t){const e=t.length;return i=>{if(i<=t[0][0])return t[0][1];if(i>=t[e-1][0])return t[e-1][1];let r=1;for(;i>t[r][0];)r++;const n=t[r-1][0],s=t[r][0],o=(s-i)/(s-n);return o*t[r-1][1]+(1-o)*t[r][1]}}function cei(t,e,i,r){je(mfe,e,t),je(gfe,i,t),Wt(r,mfe,gfe),Ye(r,r),r[3]=-Ve(t,r)}const mfe=W(),gfe=W(),ylt=W(),QS=W(),eT=W();function Fi(t=XI){return[t[0],t[1],t[2],t[3]]}function vlt(t=XI[0],e=XI[1],i=XI[2],r=XI[3]){return Woe(t,e,i,r,joe.get())}function gj(t,e){return Woe(e[0],e[1],e[2],e[3],t)}function Woe(t,e,i,r,n=Fi()){return n[0]=t,n[1]=e,n[2]=i,n[3]=r,n}function N5e(t,e,i){return Ne(i,t),i[3]=e,i}function G_(t,e,i){const r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=Math.abs(r-1)>1e-5&&r>1e-12?1/Math.sqrt(r):1;return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=-(i[0]*t[0]+i[1]*t[1]+i[2]*t[2]),i}function Hl(t,e,i,r=Fi()){const n=i[0]-e[0],s=i[1]-e[1],o=i[2]-e[2],a=t[0]-e[0],c=t[1]-e[1],p=t[2]-e[2],_=s*p-o*c,x=o*a-n*p,S=n*c-s*a,C=_*_+x*x+S*S,M=Math.abs(C-1)>1e-5&&C>1e-12?1/Math.sqrt(C):1;return r[0]=_*M,r[1]=x*M,r[2]=S*M,r[3]=-(r[0]*t[0]+r[1]*t[1]+r[2]*t[2]),r}function Yoe(t,e,i,r=0,n=Math.floor(i*(1/3)),s=Math.floor(i*(2/3))){if(i<3)return!1;e(tR,r);let o=n,a=!1;for(;oIe(n,e[3*s+0],e[3*s+1],e[3*s+2]),i?r-1:r)}const blt=.99619469809,tR=W(),GE=W(),$S=W(),vD=W(),_D=W();function CQ(t,e,i){return e!==t&&gj(t,e),t[3]=-Ve(t,i),t}function AQ(t,e){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function PL(t,e,i,r){return Wt($S,e,t),G_(i,$S,r)}function F5e(t,e,i,r){return yj(t,e,je(xt.get(),i,e),Clt,r)}function CE(t,e,i){return e!=null&&yj(t,e.origin,e.direction,Alt,i)}function wlt(t,e,i){return yj(t,e.origin,e.vector,Iy.NONE,i)}function xlt(t,e,i){return yj(t,e.origin,e.vector,Iy.CLAMP,i)}const Slt=(()=>{const t=W();return(e,i,r)=>{const n=e,s=i;if(Wt(t,n,s),Al(t)x&&_>S?(p[1]=(U*P-k*z)/o,p[2]=(k*F-U*M)/o):x>S?(p[0]=(k*z-U*P)/a,p[2]=(U*C-k*$)/a):(p[0]=(U*M-k*F)/c,p[1]=(k*$-U*C)/c),Ne(r.direction,t),!0}})();function Xoe(t,e){return gn(t,e)>=0}function Tlt(t,e){const i=Ve(t,e.ray.direction),r=-gn(t,e.ray.origin);if(r<0&&i>=0)return!1;if(i>-1e-6&&i<1e-6)return r>0;if((r<0||i<0)&&!(r<0&&i<0))return!0;const n=r/i;return i>0?ne.c0&&(e.c0=n),e.c0<=e.c1}function Elt(t,e){const i=Ve(t,e.ray.direction),r=-gn(t,e.ray.origin);if(i>-1e-6&&i<1e-6)return r>0;const n=r/i;return i>0?ne.c0&&(e.c0=n),e.c0<=e.c1}function Zoe(t,e,i){const r=De(xt.get(),t,-t[3]),n=MQ(t,je(xt.get(),e,r),xt.get());return Be(i,n,r),i}function uei(t,e,i,r){const n=t,s=xt.get(),o=xt.get();D5e(n,s,o);const a=je(xt.get(),i,e),c=S2(s,a),p=S2(o,a),_=S2(n,a);return Ie(r,c,p,_)}function MQ(t,e,i){const r=De(xt.get(),t,Ve(t,e));return je(i,e,r),i}function OQ(t,e){return Math.abs(gn(t,e))}function gn(t,e){return Ve(t,e)+t[3]}function yj(t,e,i,r,n){const s=Ve(t,i);if(s===0)return!1;let o=-(Ve(t,e)+t[3])/s;return r&Iy.CLAMP&&(o=Je(o,0,1)),!(!(r&Iy.INFINITE_MIN)&&o<0||!(r&Iy.INFINITE_MAX)&&o>1)&&(Be(n,e,De(n,i,o)),!0)}function hei(t){return t}function yfe(t){return Math.abs(t[2])r&&(r=o,n=s)}Jh(e,t.minVert[n]),Jh(i,t.maxVert[n])}const kp=[0,0,0];function Ilt(t,e,i,r){const{data:n,size:s}=t;let o=Number.NEGATIVE_INFINITY,a=0;for(let c=0;co&&(o=x,a=c)}return Jh(r,n,a),o}const Ta=[0,0];function $lt(t,e,i,r,n){Dlt(t,e,Ta,n,r);const s=V5e(i,e);Ta[1]-vP<=s&&(r[0]=void 0),Ta[0]+vP>=s&&(n[0]=void 0)}const _fe=[0,0,0],bfe=[0,0,0],wfe=[0,0,0],HE=[0,0,0],qE=[0,0,0],wD=[0,0,0];function H3(t,e,i,r,n,s){if(U5e(e)i[1]&&(i[1]=c,Jh(n,s,a))}}function xfe(t,e,i){Jh(i.center,t),LS(i.halfSize,e,.5),i.quaternion[0]=0,i.quaternion[1]=0,i.quaternion[2]=0,i.quaternion[3]=1}const C1=[0,0,0],WE=[0,0,0],sR=[0,0,0],yO=[0,0,0],vO=[0,0,0],Sfe=[0,0,0];function Nlt(t,e,i){Jh(C1,e),Math.abs(e[0])>Math.abs(e[1])&&Math.abs(e[0])>Math.abs(e[2])?C1[0]=0:Math.abs(e[1])>Math.abs(e[2])?C1[1]=0:C1[2]=0,U5e(C1)this.maxProj[0]&&(this.maxProj[0]=p,s[0]=c),p=o[c+1],pthis.maxProj[1]&&(this.maxProj[1]=p,s[1]=c),p=o[c+2],pthis.maxProj[2]&&(this.maxProj[2]=p,s[2]=c),p=o[c]+o[c+1]+o[c+2],pthis.maxProj[3]&&(this.maxProj[3]=p,s[3]=c),p=o[c]+o[c+1]-o[c+2],pthis.maxProj[4]&&(this.maxProj[4]=p,s[4]=c),p=o[c]-o[c+1]+o[c+2],pthis.maxProj[5]&&(this.maxProj[5]=p,s[5]=c),p=o[c]-o[c+1]-o[c+2],pthis.maxProj[6]&&(this.maxProj[6]=p,s[6]=c)}for(let c=0;c0){const r=1/Math.sqrt(i);t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r}}function U5e(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function RQ(t,e){const i=e[0]-t[0],r=e[1]-t[1],n=e[2]-t[2];return i*i+r*r+n*n}function V5e(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function zlt(t,e){const i=e[0]+e[4]+e[8];if(i>0){let r=Math.sqrt(i+1);t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r}else{let r=0;e[4]>e[0]&&(r=1),e[8]>e[3*r+r]&&(r=2);const n=(r+1)%3,s=(r+2)%3;let o=Math.sqrt(e[3*r+r]-e[3*n+n]-e[3*s+s]+1);t[r]=.5*o,o=.5/o,t[3]=(e[3*n+s]-e[3*s+n])*o,t[n]=(e[3*n+r]+e[3*r+n])*o,t[s]=(e[3*s+r]+e[3*r+s])*o}}const wT=Rp(),iu=W(),IQ=W(),Ult=as();function vj(t=[0,0,0],e=[-1,-1,-1],i=Rp()){return{center:Xr(t),halfSize:Xr(e),quaternion:t5e(i)}}function Tfe(t){return vj(t.center,t.halfSize,t.quaternion)}function gei(t,e){Ne(e.center,t.center),Ne(e.halfSize,t.halfSize),H9(e.quaternion,t.quaternion)}function B5e(t,e){return e=e||vj(),Mlt(t,e),e}function q3(t,e){const i=gn(e,t.center),r=_j(t,e);return i>r?1:i<-r?-1:0}function yei(t,e){return iu[0]=t.center[0]-e[0],iu[1]=t.center[1]-e[1],iu[2]=t.center[2]-e[2],C_(wT,t.quaternion),Lf(iu,iu,wT),KO(iu,iu),gB(IQ,iu,t.halfSize),yB(IQ,iu)1e-6){const p=(r+t.halfSize[c]-n[c])/s[c],_=(-r-t.halfSize[c]-n[c])/s[c];o=Math.max(o,Math.min(p,_)),a=Math.min(a,Math.max(p,_))}else if(n[c]>t.halfSize[c]+r||n[c]<-t.halfSize[c]-r)return!1;return o<=a}(()=>{const t=new Int8Array(162);let e=0;const i=r=>{for(let n=0;n0?1+e/o:1,c=s>0?1+i/s:1,p=(c+a)/2,_=(c-a)/2;De(n.halfSize,XE,_),lo(n.halfSize,n.halfSize,t.halfSize,p),De(n.center,XE,p),lo(n.center,n.center,t.halfSize,_),Ez(gb,gb),mB(n.center,n.center,gb),Lf(n.center,n.center,n.quaternion)}}else{const s=Ie(gb,0,0,1);lo(n.center,t.center,s,(i+e)/2),C_(SD,t.quaternion),Lf(s,s,SD),KO(s,s),lo(n.halfSize,t.halfSize,s,(i-e)/2)}return n}const gb=W(),XE=W(),ZE=W(),SD=Rp();function H5e(t){return t?parseInt(t.substring(t.lastIndexOf("/")+1,t.length),10):void 0}function Sei(t){var e;if($e("disable-feature:i3s-draco")||!t)return!1;for(const i of t)for(const r of i.geometryBuffers)if(((e=r.compressedAttributes)==null?void 0:e.encoding)==="draco")return!0;return!1}function Tei(t,e,i,r){i.traverse(e,n=>{const s=n.mbs;return(s!=null&&Blt(t,s))!==tT.OUTSIDE&&(r(n),!0)})}function Eei(t,e,i){let r=0,n=0;for(let s=0;s=0===e&&(i[n]=i[r],n++),r++;i.length=n}const oR=Ni();function Aei(t,e){if(e.rotationScale[1]===0&&e.rotationScale[2]===0&&e.rotationScale[3]===0&&e.rotationScale[5]===0&&e.rotationScale[6]===0&&e.rotationScale[7]===0)return oR[0]=(t[0]-e.position[0])/e.rotationScale[0],oR[1]=(t[1]-e.position[1])/e.rotationScale[4],oR[2]=(t[2]-e.position[0])/e.rotationScale[0],oR[3]=(t[3]-e.position[1])/e.rotationScale[4],oR}var tT;function Blt(t,e){const i=e[0],r=e[1],n=e[3],s=t[0]-i,o=i-t[2],a=t[1]-r,c=r-t[3],p=Math.max(s,o,0),_=Math.max(a,c,0),x=p*p+_*_;return x>n*n?tT.OUTSIDE:x>0?tT.INTERSECTS_CENTER_OUTSIDE:-Math.max(s,o,a,c)>n?tT.INSIDE:tT.INTERSECTS_CENTER_INSIDE}function jlt(t,e,i){const r=[],n=i==null?void 0:i.missingFields,s=i==null?void 0:i.originalFields;for(const o of t){const a=o.toLowerCase();let c=!1;for(const p of e)if(a===p.name.toLowerCase()){r.push(p.name),c=!0,s&&s.push(o);break}!c&&n&&n.push(o)}return r}async function Mei(t,e,i,r,n){if(e.length===0)return[];const s=t.attributeStorageInfo;if(t.associatedLayer!=null)try{return await Hlt(t.associatedLayer,e,i,r)}catch(o){if(t.associatedLayer.loaded)throw o}if(s){const o=Glt(e,i,n);if(o==null)throw new se("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const a=t.parsedUrl.path;return(await Promise.all(o.map(c=>qlt(a,s,c.node,c.indices,r).then(p=>{for(let _=0;_=0){let x=r.get(p.node);x||(x={node:p.node,indices:[],graphics:[]},n.push(x),r.set(p.node,x)),x.indices.push(_),x.graphics.push(o);for(let S=c;S>0;S--)s[S]=s[S-1];s[0]=p;break}}}return n}async function Hlt(t,e,i,r){e.sort((c,p)=>c.attributes[i]-p.attributes[i]);const n=e.map(c=>c.attributes[i]),s=[],o=jlt(r,t.fields,{originalFields:s}),a=await q5e(t,n,o);for(let c=0;cr){const s=pSe(e,r);return Promise.all(s.map(o=>q5e(t,o,i))).then(o=>o.flat())}const n=new Wm({objectIds:e,outFields:i,orderByFields:[t.objectIdField]});return t.queryFeatures(n).then(s=>{if(s&&s.features&&s.features.length===e.length)return s.features.map(o=>o.attributes);throw new se("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")})}function qlt(t,e,i,r,n){return W5e(t,e,i.resources.attributes,r,n)}async function W5e(t,e,i,r,n){const s=[];for(const c of e)if(c&&n.includes(c.name)){const p=`${t}/nodes/${i}/attributes/${c.key}/0`;s.push({url:p,storageInfo:c})}const o=await Promise.allSettled(s.map(c=>yi(c.url,{responseType:"array-buffer"}).then(p=>kat(c.storageInfo,p.data)))),a=[];for(const c of r){const p={};for(let _=0;_{if(!a)if(a=LQ,ld(TD),t.serviceObb!=null){sct(t.serviceObb,i,Cfe,e,n),j5e(Cfe,a);for(const C of a)bt(C,C,ED),lO(TD,C)}else{const C=t.mbs;if(!C)return;const M=C[3];il(C,i,zr,e),bt(zr,zr,ED),zr[2]+=n;for(let P=0;P<8;++P){const $=1&P?M:-M,F=2&P?M:-M,z=4&P?M:-M,k=a[P];Ne(k,[zr[0]+$,zr[1]+F,zr[2]+z]),lO(TD,k)}}};let p=1/0,_=-1/0;const x=C=>{if(C.type!=="replace")return;const M=C.geometry;if(!(M!=null&&M.hasZ))return;ld(KH);const P=M.spatialReference||r,$=M.rings.reduce((F,z)=>z.reduce((k,U)=>(il(U,P,zr,e),bt(zr,zr,ED),lO(KH,zr),Math.min(zr[2],k)),F),1/0);c(),I9(TD,KH)&&(p=Math.min(p,$),_=Math.max(_,$))};if(s.forEach(C=>x(C)),p===1/0)return null;const S=(C,M,P)=>{bt(zr,P,o),C[M]=zr[0],C[M+1]=zr[1],C[M+2]=zr[2],M+=24,P[2]=p,bt(zr,P,o),C[M]=zr[0],C[M+1]=zr[1],C[M+2]=zr[2],M+=24,P[2]=_,bt(zr,P,o),C[M]=zr[0],C[M+1]=zr[1],C[M+2]=zr[2]};for(let C=0;C<8;++C)S(Afe.data,3*C,a[C]);return B5e(Afe)}function Vei(t){return t!=null&&t.halfSize[0]>=0}function Bei(t){return t[3]>=0}function jei(t){t!=null&&(t.halfSize[0]=-1)}function Gei(t){t!=null&&(t[3]=-1)}const xd=Qe(),Pv=Rp(),LQ=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],KH=Ni(),TD=Ni(),Cfe=vj(),zr=W(),Afe={data:new Array(72),size:3,exclusive:!0,stride:3},ED=Qe();async function dct(t,e=t.popupTemplate){var _,x;if(e==null)return[];const i=await e.getRequiredFields(t.fieldsIndex),{lastEditInfoEnabled:r}=e,{objectIdField:n,typeIdField:s,globalIdField:o,relationships:a}=t;if(i.includes("*"))return["*"];const c=r?BQe(t):[],p=DB(t.fieldsIndex,[...i,...c]);return s&&p.push(s),p&&n&&((_=t.fieldsIndex)!=null&&_.has(n))&&!p.includes(n)&&p.push(n),p&&o&&((x=t.fieldsIndex)!=null&&x.has(o))&&!p.includes(o)&&p.push(o),a&&a.forEach(S=>{var M;const{keyField:C}=S;p&&C&&((M=t.fieldsIndex)!=null&&M.has(C))&&!p.includes(C)&&p.push(C)}),p}function X5e(t,e){return t.popupTemplate?t.popupTemplate:e!=null&&e.defaultPopupTemplateEnabled&&t.defaultPopupTemplate!=null?t.defaultPopupTemplate:null}function Hei(t,e){return X5e(t,{defaultPopupTemplateEnabled:e})!=null}const pct=new Set(["3DObject","Point"]),Mfe=_st();let bi=class extends qrt(Znt(VOe(ej(ij(AB(T5(Prt(Xs(pE))))))))){constructor(...e){super(...e),this.featureReduction=null,this.rangeInfos=null,this.operationalLayerType="ArcGISSceneServiceLayer",this.type="scene",this.fields=null,this.floorInfo=null,this.outFields=null,this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.excludeObjectIds=new tt,this.definitionExpression=null,this.filter=null,this.path=null,this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.priority=null,this.semantic=null,this.cachedDrawingInfo={color:!1},this.popupEnabled=!0,this.popupTemplate=null,this.objectIdField=null,this.globalIdField=null,this._fieldUsageInfo={},this.screenSizePerspectiveEnabled=!0,this.serviceItemId=void 0}normalizeCtorArgs(e,i){return typeof e=="string"?{url:e,...i}:e}destroy(){this._set("renderer",null)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,i){var n,s,o;const r=(s=(n=this.getFeatureType(i==null?void 0:i.feature))==null?void 0:n.domains)==null?void 0:s[e];return r&&r.type!=="inherited"?r:((o=this.getField(e))==null?void 0:o.domain)??null}getFeatureType(e){return e&&this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){var e;return((e=this.associatedLayer)==null?void 0:e.types)??[]}get typeIdField(){var e;return((e=this.associatedLayer)==null?void 0:e.typeIdField)??null}get templates(){var e;return((e=this.associatedLayer)==null?void 0:e.templates)??null}get formTemplate(){var e;return((e=this.associatedLayer)==null?void 0:e.formTemplate)??null}get fieldsIndex(){return new aoe(this.fields)}readNodePages(e,i,r){return i.layerType==="Point"&&(e=i.pointNodePages),e==null||typeof e!="object"?null:IS.fromJSON(e,r)}set elevationInfo(e){this._set("elevationInfo",e),this.loaded&&this._validateElevationInfo()}get effectiveCapabilities(){var e;return this._capabilitiesFromAssociatedFeatureLayer((e=this.associatedLayer)==null?void 0:e.effectiveCapabilities)}get effectiveEditingEnabled(){return this.associatedLayer!=null&&yst(this.associatedLayer)}get geometryType(){return fct[this.profile]||"mesh"}set renderer(e){Qde(e,this.fieldsIndex),this._set("renderer",e)}readCachedDrawingInfo(e){return e!=null&&typeof e=="object"||(e={}),e.color==null&&(e.color=!1),e}get capabilities(){var e;return this._capabilitiesFromAssociatedFeatureLayer((e=this.associatedLayer)==null?void 0:e.capabilities)}_capabilitiesFromAssociatedFeatureLayer(e){var G;e=e??tst;const{query:i,queryRelated:r,editing:{supportsGlobalId:n,supportsRollbackOnFailure:s,supportsUploadWithItemId:o,supportsGeometryUpdate:a,supportsReturnServiceEditsInSourceSpatialReference:c},data:{supportsZ:p,supportsM:_,isVersioned:x,supportsAttachment:S},operations:{supportsEditing:C,supportsAdd:M,supportsUpdate:P,supportsDelete:$,supportsQuery:F,supportsQueryAttachments:z,supportsAsyncConvert3D:k}}=e,U=e.operations.supportsChangeTracking,j=!!((G=this.associatedLayer)!=null&&G.infoFor3D)&&Rpe();return{query:i,queryRelated:r,editing:{supportsGlobalId:n,supportsReturnServiceEditsInSourceSpatialReference:c,supportsRollbackOnFailure:s,supportsGeometryUpdate:j&&a,supportsUploadWithItemId:o},data:{supportsAttachment:S,supportsZ:p,supportsM:_,isVersioned:x},operations:{supportsQuery:F,supportsQueryAttachments:z,supportsEditing:C&&U,supportsAdd:j&&M&&U,supportsDelete:j&&$&&U,supportsUpdate:P&&U,supportsAsyncConvert3D:k}}}get editingEnabled(){var e;return this._isOverridden("editingEnabled")?this._get("editingEnabled"):((e=this.associatedLayer)==null?void 0:e.editingEnabled)??!1}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}get infoFor3D(){var e;return((e=this.associatedLayer)==null?void 0:e.infoFor3D)??null}get relationships(){var e;return(e=this.associatedLayer)==null?void 0:e.relationships}get defaultPopupTemplate(){return this.associatedLayer||this.attributeStorageInfo?this.createPopupTemplate():null}readObjectIdField(e,i){return!e&&i.fields&&i.fields.some(r=>(r.type==="esriFieldTypeOID"&&(e=r.name),!!e)),e||void 0}readGlobalIdField(e,i){return!e&&i.fields&&i.fields.some(r=>(r.type==="esriFieldTypeGlobalID"&&(e=r.name),!!e)),e||void 0}get displayField(){var e;return((e=this.associatedLayer)==null?void 0:e.displayField)??null}readProfile(e,i){const r=i.store.profile;return r!=null&&Ofe[r]?Ofe[r]:(Ce.getLogger(this).error("Unknown or missing profile",{profile:r,layer:this}),"mesh-pyramids")}load(e){return this.addResolvingPromise(this._load(e)),Promise.resolve(this)}async _load(e){const i=e!=null?e.signal:null;await this.loadFromPortal({supportedTypes:["Scene Service"]},e).catch(Uo),await this._fetchService(i),await Promise.all([this._fetchIndexAndUpdateExtent(this.nodePages,i),this._setAssociatedFeatureLayer(i),this._loadFilterGeometries()]),this._validateElevationInfo(),this._applyAssociatedLayerOverrides(),this._populateFieldUsageInfo(),await fot(this,{origin:"service"},i),Qde(this.renderer,this.fieldsIndex),await this.finishLoadEditablePortalLayer(e)}async beforeSave(){this.filter!=null&&(this.filter=this.filter.clone(),await this.load())}async _loadFilterGeometries(){if(this.filter)try{await this.filter.loadGeometries(this.spatialReference)}catch(e){Ce.getLogger(this).error("#_loadFilterGeometries()",this,"Failed to load filter geometries. Geometry filter will not be applied for this layer.",{error:e}),this.filter=null}}createQuery(){const e=new Wm;return this.geometryType!=="mesh"&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e.outFields=["*"],e}queryExtent(e,i){return this._getAssociatedLayerForQuery().then(r=>r.queryExtent(e||this.createQuery(),i))}queryFeatureCount(e,i){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatureCount(e||this.createQuery(),i))}queryFeatures(e,i){return this._getAssociatedLayerForQuery().then(r=>r.queryFeatures(e||this.createQuery(),i)).then(r=>{if(r!=null&&r.features)for(const n of r.features)n.layer=this,n.sourceLayer=this;return r})}async queryRelatedFeatures(e,i){if(await this.load(),!this.associatedLayer)throw new se("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeatures(e,i)}async queryRelatedFeaturesCount(e,i){if(await this.load(),!this.associatedLayer)throw new se("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});return this.associatedLayer.queryRelatedFeaturesCount(e,i)}async queryCachedAttributes(e,i){const r=NQe(this.fieldsIndex,await dct(this,X5e(this)));return W5e(this.parsedUrl.path,this.attributeStorageInfo??[],e,i,r)}async queryCachedFeature(e,i){const r=await this.queryCachedAttributes(e,[i]);if(!r||r.length===0)throw new se("scenelayer:feature-not-in-cached-data","Feature not found in cached data");const n=new Ma;return n.attributes=r[0],n.layer=this,n.sourceLayer=this,n}queryObjectIds(e,i){return this._getAssociatedLayerForQuery().then(r=>r.queryObjectIds(e||this.createQuery(),i))}queryAttachments(e,i){return this._getAssociatedLayerForQuery().then(r=>r.queryAttachments(e,i))}getFieldUsageInfo(e){const i={supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1};return this.loaded?this._fieldUsageInfo[e]||i:(Ce.getLogger(this).error("#getFieldUsageInfo()","Unavailable until layer is loaded"),i)}createPopupTemplate(e){return wot(this,e)}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return e!=null&&e.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),!this.associatedLayer)throw new se("scenelayer:query-not-available","SceneLayer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new se("scenelayer:query-not-available","SceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}hasCachedStatistics(e){return this.statisticsInfo!=null&&this.statisticsInfo.some(i=>i.name===e)}async queryCachedStatistics(e,i){if(await this.load(i),!this.statisticsInfo)throw new se("scenelayer:no-cached-statistics","Cached statistics are not available for this layer");const r=this.fieldsIndex.get(e);if(!r)throw new se("scenelayer:field-unexisting",`Field '${e}' does not exist on the layer`);for(const n of this.statisticsInfo)if(n.name===r.name){const s=Pp(this.parsedUrl.path,n.href);return yi(s,{query:{f:"json",token:this.apiKey},responseType:"json",signal:i?i.signal:null}).then(o=>o.data)}throw new se("scenelayer:no-cached-statistics","Cached statistics for this attribute are not available")}async saveAs(e,i){return this._debouncedSaveOperations(pP.SAVE_AS,{...i,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"scene"};return this._debouncedSaveOperations(pP.SAVE,e)}async applyEdits(e,i){const{applyEdits:r}=await we(()=>import("./editingSupport-HfkJiqt7.js"),__vite__mapDeps([]));let n=i;await this.load();const s=this.associatedLayer;if(!s)throw new se(`${this.type}-layer:not-editable`,"Service is not editable");await s.load();const{globalIdField:o}=s,a=!!s.infoFor3D,c=(n==null?void 0:n.globalIdUsed)??!0;if(a&&o==null)throw new se(`${this.type}-layer:not-editable`,"Valid globalIdField expected on editable SceneLayer");if(a&&!c)throw new se(`${this.type}-layer:globalid-required`,"globalIdUsed must not be false for SceneLayer editing as globalIds are required.");return Fpe(s.url)&&a&&e.deleteFeatures!=null&&o!=null&&(n={...n,globalIdToObjectId:await $Pe(s,e.deleteFeatures,o)}),r(this,s.source,e,n)}async uploadAssets(e,i){if(await this.load(),this.associatedLayer==null)throw new se(`${this.type}-layer:not-editable`,"Service is not editable");return await this.associatedLayer.load(),this.associatedLayer.uploadAssets(e,i)}on(e,i){return super.on(e,i)}validateLayer(e){if(e.layerType&&!pct.has(e.layerType))throw new se("scenelayer:layer-type-not-supported","SceneLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new se("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});if(this.version.major>2)throw new se("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x, 2.x"});function i(r,n){let s=!1,o=!1;if(r==null)s=!0,o=!0;else{const a=n&&n.isGeographic;switch(r){case"east-north-up":case"earth-centered":s=!0,o=a;break;case"vertex-reference-frame":s=!0,o=!a;break;default:s=!1}}if(!s)throw new se("scenelayer:unsupported-normal-reference-frame","Normal reference frame is invalid.");if(!o)throw new se("scenelayer:incompatible-normal-reference-frame","Normal reference frame is incompatible with layer spatial reference.")}i(this.normalReferenceFrame,this.spatialReference)}_getTypeKeywords(){const e=[];if(this.profile==="points")e.push("Point");else{if(this.profile!=="mesh-pyramids")throw new se("scenelayer:unknown-profile","SceneLayer:save() encountered an unknown SceneLayer profile: "+this.profile);e.push("3DObject")}return e}_populateFieldUsageInfo(){var e,i;if(this._fieldUsageInfo={},this.fields)for(const r of this.fields){const n=!(!this.attributeStorageInfo||!this.attributeStorageInfo.some(a=>a.name===r.name)),s=!!((i=(e=this.associatedLayer)==null?void 0:e.fields)!=null&&i.some(a=>a&&r.name===a.name)),o={supportsLabelingInfo:n,supportsRenderer:n,supportsPopupTemplate:n||s,supportsLayerQuery:s};this._fieldUsageInfo[r.name]=o}}_applyAssociatedLayerOverrides(){this._applyAssociatedLayerFieldsOverrides(),this._applyAssociatedLayerPopupOverrides(),this._applyAssociatedLayerExtentOverride(),this._applyAssociatedLayerPrivileges()}_applyAssociatedLayerFieldsOverrides(){var i;if(!((i=this.associatedLayer)!=null&&i.fields))return;let e=null;for(const r of this.associatedLayer.fields){const n=this.getField(r.name);n?(!n.domain&&r.domain&&(n.domain=r.domain.clone()),n.editable=r.editable,n.nullable=r.nullable,n.length=r.length):(e||(e=this.fields?this.fields.slice():[]),e.push(r.clone()))}e&&this._set("fields",e)}_applyAssociatedLayerPopupOverrides(){if(!this.associatedLayer)return;const e=["popupTemplate","popupEnabled"],i=Kl(this);for(let r=0;rthis.popupEnabled&&this.popupTemplate!=null);const e=`this SceneLayer: ${this.title}`;this.attributeStorageInfo==null?Ce.getLogger(this).warn(`Associated FeatureLayer could not be loaded and no binary attributes found. Popups will not work on ${e}`):Ce.getLogger(this).info(`Associated FeatureLayer could not be loaded. Falling back to binary attributes for Popups on ${e}`)}_validateElevationInfo(){const e=this.elevationInfo;this.profile==="mesh-pyramids"&&nfe(Ce.getLogger(this),vot("Mesh scene layers","relative-to-scene",e)),nfe(Ce.getLogger(this),_ot("Scene layers",e))}};y([w({types:{key:"type",base:_$,typeMap:{selection:vst}},json:{origins:{"web-scene":{name:"layerDefinition.featureReduction",write:!0},"portal-item":{name:"layerDefinition.featureReduction",write:!0}}}})],bi.prototype,"featureReduction",void 0),y([w({type:[sw],json:{read:!1,origins:{"web-scene":{name:"layerDefinition.rangeInfos",write:!0},"portal-item":{name:"layerDefinition.rangeInfos",write:!0}}}})],bi.prototype,"rangeInfos",void 0),y([w({json:{read:!1}})],bi.prototype,"associatedLayer",void 0),y([w({type:["show","hide"]})],bi.prototype,"listMode",void 0),y([w({type:["ArcGISSceneServiceLayer"]})],bi.prototype,"operationalLayerType",void 0),y([w({json:{read:!1},readOnly:!0})],bi.prototype,"type",void 0),y([w({...Mfe.fields,readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],bi.prototype,"fields",void 0),y([w()],bi.prototype,"types",null),y([w()],bi.prototype,"typeIdField",null),y([w()],bi.prototype,"templates",null),y([w()],bi.prototype,"formTemplate",null),y([w({readOnly:!0,clonable:!1})],bi.prototype,"fieldsIndex",null),y([w({type:Zst,json:{read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo"}}})],bi.prototype,"floorInfo",void 0),y([w(Mfe.outFields)],bi.prototype,"outFields",void 0),y([w({type:IS,readOnly:!0,json:{read:!1}})],bi.prototype,"nodePages",void 0),y([Rt("service","nodePages",["nodePages","pointNodePages"])],bi.prototype,"readNodePages",null),y([w({type:[Zp],readOnly:!0})],bi.prototype,"materialDefinitions",void 0),y([w({type:[qI],readOnly:!0})],bi.prototype,"textureSetDefinitions",void 0),y([w({type:[YI],readOnly:!0})],bi.prototype,"geometryDefinitions",void 0),y([w({readOnly:!0})],bi.prototype,"serviceUpdateTimeStamp",void 0),y([w({readOnly:!0})],bi.prototype,"attributeStorageInfo",void 0),y([w({readOnly:!0})],bi.prototype,"statisticsInfo",void 0),y([w({type:tt.ofType(Number),nonNullable:!0,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.excludeObjectIds",write:{enabled:!0}}})],bi.prototype,"excludeObjectIds",void 0),y([w({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],bi.prototype,"definitionExpression",void 0),y([w({type:pot,json:{name:"layerDefinition.polygonFilter",write:{enabled:!0,allowNull:!0},origins:{service:{read:!1,write:!1}}}})],bi.prototype,"filter",void 0),y([w({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],bi.prototype,"path",void 0),y([w(snt)],bi.prototype,"elevationInfo",null),y([w({readOnly:!0,json:{read:!1}})],bi.prototype,"effectiveCapabilities",null),y([w({readOnly:!0})],bi.prototype,"effectiveEditingEnabled",null),y([w({type:String})],bi.prototype,"geometryType",null),y([w(nnt)],bi.prototype,"labelsVisible",void 0),y([w({type:[kPe],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:{reader:rfe},write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:{reader:rfe},write:!0}})],bi.prototype,"labelingInfo",void 0),y([w(qOe)],bi.prototype,"legendEnabled",void 0),y([w({type:Number,json:{origins:{"web-document":{default:1,write:{enabled:!0,target:{opacity:{type:Number},"layerDefinition.drawingInfo.transparency":{type:Number}}},read:{source:["opacity","layerDefinition.drawingInfo.transparency"],reader(t,e){var r,n;if(typeof t=="number"&&t>=0&&t<=1)return t;const i=(n=(r=e.layerDefinition)==null?void 0:r.drawingInfo)==null?void 0:n.transparency;return i!==void 0?WT(i):void 0}}},"portal-item":{write:!0},service:{read:!1}}}})],bi.prototype,"opacity",void 0),y([w({type:["Low","High"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],bi.prototype,"priority",void 0),y([w({type:["Labels"],readOnly:!0,json:{read:!1,origins:{service:{read:!0}}}})],bi.prototype,"semantic",void 0),y([w({types:_rt,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],bi.prototype,"renderer",null),y([w({json:{read:!1}})],bi.prototype,"cachedDrawingInfo",void 0),y([Rt("service","cachedDrawingInfo")],bi.prototype,"readCachedDrawingInfo",null),y([w({readOnly:!0,json:{read:!1}})],bi.prototype,"capabilities",null),y([w({type:Boolean,json:{read:!1}})],bi.prototype,"editingEnabled",null),y([w({readOnly:!0,json:{write:!1,read:!1}})],bi.prototype,"infoFor3D",null),y([w({readOnly:!0,json:{write:!1,read:!1}})],bi.prototype,"relationships",null),y([w(rnt)],bi.prototype,"popupEnabled",void 0),y([w({type:yE,json:{name:"popupInfo",write:!0}})],bi.prototype,"popupTemplate",void 0),y([w({readOnly:!0,json:{read:!1}})],bi.prototype,"defaultPopupTemplate",null),y([w({type:String,json:{read:!1}})],bi.prototype,"objectIdField",void 0),y([Rt("service","objectIdField",["objectIdField","fields"])],bi.prototype,"readObjectIdField",null),y([w({type:String,json:{read:!1}})],bi.prototype,"globalIdField",void 0),y([Rt("service","globalIdField",["globalIdField","fields"])],bi.prototype,"readGlobalIdField",null),y([w({readOnly:!0,type:String,json:{read:!1}})],bi.prototype,"displayField",null),y([w({type:String,json:{read:!1}})],bi.prototype,"profile",void 0),y([Rt("service","profile",["store.profile"])],bi.prototype,"readProfile",null),y([w({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],bi.prototype,"normalReferenceFrame",void 0),y([w(int)],bi.prototype,"screenSizePerspectiveEnabled",void 0),y([w({json:{read:!1,origins:{service:{read:!0}}}})],bi.prototype,"serviceItemId",void 0),bi=y([Z("esri.layers.SceneLayer")],bi);const Ofe={"mesh-pyramids":"mesh-pyramids",meshpyramids:"mesh-pyramids","features-meshes":"mesh-pyramids",points:"points","features-points":"points",lines:"lines","features-lines":"lines",polygons:"polygons","features-polygons":"polygons"},fct={"mesh-pyramids":"mesh",points:"point",lines:"polyline",polygons:"polygon"},Z5e=bi,mct=Object.freeze(Object.defineProperty({__proto__:null,default:Z5e},Symbol.toStringTag,{value:"Module"}));let PA=class extends tt{constructor(e){super(e),this.getCollections=null}initialize(){this.addHandles(eTe(()=>this._refresh()))}destroy(){this.getCollections=null}_refresh(){const e=this.getCollections!=null?this.getCollections():null;if(e==null)return void this.removeAll();let i=0;for(const r of e)r!=null&&(i=this._processCollection(i,r));this.splice(i,this.length)}_createNewInstance(e){return new tt(e)}_processCollection(e,i){if(!i)return e;const r=this.itemFilterFunction??(n=>!!n);for(const n of i)if(n){if(r(n)){const s=this.indexOf(n,e);s>=0?s!==e&&this.reorder(n,e):this.add(n,e),++e}if(this.getChildrenFunction){const s=this.getChildrenFunction(n);if(Array.isArray(s))for(const o of s)e=this._processCollection(e,o);else e=this._processCollection(e,s)}}return e}};y([w()],PA.prototype,"getCollections",void 0),y([w()],PA.prototype,"getChildrenFunction",void 0),y([w()],PA.prototype,"itemFilterFunction",void 0),PA=y([Z("esri.core.CollectionFlattener")],PA);const YT=PA,Joe=96;function Pfe(t,e){const i=e||t.extent,r=t.width,n=xs(i==null?void 0:i.spatialReference);return i&&r?i.width/r*n*jne*Joe:0}function J5e(t,e){return t/(xs(e)*jne*Joe)}function gct(t){return t/(jne*Joe)}function yct(t,e){const i=t.extent,r=t.width-(t.padding?t.padding.left+t.padding.right:0),n=J5e(e,i.spatialReference);return i.clone().expand(n*r/i.width)}function vct(t,e,i){return _ct(t,e)&&bct(t,i)}function _ct(t,e){return e===0||Ry(t,e)||te}const p2=new tt,w$=new WeakMap;function wct(t){Sct(t)&&p2.push(new WeakRef(t))}function xct(t){const e=p2.find(i=>i.deref()===t);e&&p2.remove(e)}function Sct(t){return t!=null&&typeof t=="object"&&"refreshInterval"in t&&"refresh"in t}function K5e(t,e){return Number.isFinite(t)&&Number.isFinite(e)?e<=0?t:K5e(e,t%e):0}let QH=0,CD=0;function Tct(){const t=Date.now();let e=!1;for(const i of p2){const r=i.deref();r?r.refreshInterval&&t-(w$.get(r)??0)+5>=6e4*r.refreshInterval&&(w$.set(r,t),r.refresh(t)):e=!0}if(e)for(let i=p2.length-1;i>=0;i--)p2.at(i).deref()||p2.removeAt(i)}eTe(()=>{const t=Date.now();let e=0;for(const i of p2){const r=i.deref();r&&(e=K5e(Math.round(6e4*r.refreshInterval),e),r.refreshInterval?w$.get(r)||w$.set(r,t):w$.delete(r))}if(e!==CD){if(CD=e,clearInterval(QH),CD===0)return void(QH=0);QH=setInterval(Tct,CD)}});function Ect(t){return t!=null&&typeof t=="object"&&"refreshTimestamp"in t&&"refresh"in t}const Rfe=.1,Cct=t=>{let e=class extends t{constructor(...i){super(...i),this.refreshInterval=0,this.refreshTimestamp=0,this._debounceHasDataChanged=n5(()=>this.hasDataChanged()),this.when().then(()=>{this.destroyed||wct(this)},()=>{})}destroy(){xct(this)}castRefreshInterval(i){return i>=Rfe?i:i<=0?0:Rfe}get refreshParameters(){return{_ts:this.refreshTimestamp||null}}refresh(i=Date.now()){Nm(this._debounceHasDataChanged()).then(r=>{r&&this._set("refreshTimestamp",i),this.emit("refresh",{dataChanged:r})},r=>{Ce.getLogger(this).error(r),this.emit("refresh",{dataChanged:!1,error:r})})}async hasDataChanged(){return!0}get test(){const i=this;return{set refreshInterval(r){i._set("refreshInterval",r)}}}};return y([w({type:Number,json:{write:!0,origins:{"web-scene":{write:{enabled:!0,layerContainerTypes:Jf}}}}})],e.prototype,"refreshInterval",void 0),y([Ci("refreshInterval")],e.prototype,"castRefreshInterval",null),y([w({readOnly:!0})],e.prototype,"refreshTimestamp",void 0),y([w({readOnly:!0})],e.prototype,"refreshParameters",null),e=y([Z("esri.layers.mixins.RefreshableLayer")],e),e},Q5e=gu()({esriTimeUnitsMilliseconds:"milliseconds",esriTimeUnitsSeconds:"seconds",esriTimeUnitsMinutes:"minutes",esriTimeUnitsHours:"hours",esriTimeUnitsDays:"days",esriTimeUnitsWeeks:"weeks",esriTimeUnitsMonths:"months",esriTimeUnitsYears:"years",esriTimeUnitsDecades:"decades",esriTimeUnitsCenturies:"centuries",esriTimeUnitsUnknown:void 0});let ZI=class extends Xs(Ue){constructor(e){super(e),this.unit="milliseconds",this.value=0}toMilliseconds(){return Hs(this.value,this.unit,"milliseconds")}};y([Vt(Q5e,{nonNullable:!0})],ZI.prototype,"unit",void 0),y([w({type:Number,json:{write:!0},nonNullable:!0})],ZI.prototype,"value",void 0),ZI=y([Z("esri.TimeInterval")],ZI);const iU=ZI;function Ife(t,e){return iU.fromJSON({value:t,unit:e})}let Xc=class extends Xs(Ue){constructor(e){super(e),this.cumulative=!1,this.endField=null,this.fullTimeExtent=null,this.hasLiveData=!1,this.interval=null,this.startField=null,this.timeZone=null,this.trackIdField=null,this.useTime=!0}readFullTimeExtent(e,i){if(!i.timeExtent||!Array.isArray(i.timeExtent)||i.timeExtent.length!==2)return null;const r=new Date(i.timeExtent[0]),n=new Date(i.timeExtent[1]);return new f1({start:r,end:n})}writeFullTimeExtent(e,i){(e==null?void 0:e.start)!=null&&e.end!=null?i.timeExtent=[e.start.getTime(),e.end.getTime()]:i.timeExtent=null}readInterval(e,i){return i.timeInterval&&i.timeIntervalUnits?Ife(i.timeInterval,i.timeIntervalUnits):i.defaultTimeInterval&&i.defaultTimeIntervalUnits?Ife(i.defaultTimeInterval,i.defaultTimeIntervalUnits):null}writeInterval(e,i){i.timeInterval=(e==null?void 0:e.toJSON().value)??null,i.timeIntervalUnits=(e==null?void 0:e.toJSON().unit)??null}};y([w({type:Boolean,json:{name:"exportOptions.timeDataCumulative",write:!0}})],Xc.prototype,"cumulative",void 0),y([w({type:String,json:{name:"endTimeField",write:{enabled:!0,allowNull:!0}}})],Xc.prototype,"endField",void 0),y([w({type:f1,json:{write:{enabled:!0,allowNull:!0}}})],Xc.prototype,"fullTimeExtent",void 0),y([Rt("fullTimeExtent",["timeExtent"])],Xc.prototype,"readFullTimeExtent",null),y([Et("fullTimeExtent")],Xc.prototype,"writeFullTimeExtent",null),y([w({type:Boolean,json:{write:!0}})],Xc.prototype,"hasLiveData",void 0),y([w({type:iU,json:{write:{enabled:!0,allowNull:!0}}})],Xc.prototype,"interval",void 0),y([Rt("interval",["timeInterval","timeIntervalUnits","defaultTimeInterval","defaultTimeIntervalUnits"])],Xc.prototype,"readInterval",null),y([Et("interval")],Xc.prototype,"writeInterval",null),y([w({type:String,json:{name:"startTimeField",write:{enabled:!0,allowNull:!0}}})],Xc.prototype,"startField",void 0),y([w(XKe("timeReference",!0))],Xc.prototype,"timeZone",void 0),y([w({type:String,json:{write:{enabled:!0,allowNull:!0}}})],Xc.prototype,"trackIdField",void 0),y([w({type:Boolean,json:{name:"exportOptions.useTime",write:!0}})],Xc.prototype,"useTime",void 0),Xc=y([Z("esri.layers.support.TimeInfo")],Xc);const Act=Xc,Mct=t=>{let e=class extends t{constructor(){super(...arguments),this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0}readOffset(i,r){const n=r.timeInfo.exportOptions;if(!n)return null;const s=n.timeOffset,o=Q5e.fromJSON(n.timeOffsetUnits);return s&&o?new iU({value:s,unit:o}):null}set timeInfo(i){DQe(i,this.fieldsIndex),this._set("timeInfo",i)}};return y([w({type:f1,json:{write:!1}})],e.prototype,"timeExtent",void 0),y([w({type:iU})],e.prototype,"timeOffset",void 0),y([Rt("service","timeOffset",["timeInfo.exportOptions"])],e.prototype,"readOffset",null),y([w({value:null,type:Act,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],e.prototype,"timeInfo",null),y([w({type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation"},origins:{"web-scene":{read:!1,write:!1}}}})],e.prototype,"useViewTime",void 0),e=y([Z("esri.layers.mixins.TemporalLayer")],e),e},Oct=[[3819,3819],[3821,3824],[3889,3889],[3906,3906],[4001,4025],[4027,4036],[4039,4047],[4052,4055],[4074,4075],[4080,4081],[4120,4176],[4178,4185],[4188,4216],[4218,4289],[4291,4304],[4306,4319],[4322,4326],[4463,4463],[4470,4470],[4475,4475],[4483,4483],[4490,4490],[4555,4558],[4600,4646],[4657,4765],[4801,4811],[4813,4821],[4823,4824],[4901,4904],[5013,5013],[5132,5132],[5228,5229],[5233,5233],[5246,5246],[5252,5252],[5264,5264],[5324,5340],[5354,5354],[5360,5360],[5365,5365],[5370,5373],[5381,5381],[5393,5393],[5451,5451],[5464,5464],[5467,5467],[5489,5489],[5524,5524],[5527,5527],[5546,5546],[2044,2045],[2081,2083],[2085,2086],[2093,2093],[2096,2098],[2105,2132],[2169,2170],[2176,2180],[2193,2193],[2200,2200],[2206,2212],[2319,2319],[2320,2462],[2523,2549],[2551,2735],[2738,2758],[2935,2941],[2953,2953],[3006,3030],[3034,3035],[3038,3051],[3058,3059],[3068,3068],[3114,3118],[3126,3138],[3150,3151],[3300,3301],[3328,3335],[3346,3346],[3350,3352],[3366,3366],[3389,3390],[3416,3417],[3833,3841],[3844,3850],[3854,3854],[3873,3885],[3907,3910],[4026,4026],[4037,4038],[4417,4417],[4434,4434],[4491,4554],[4839,4839],[5048,5048],[5105,5130],[5253,5259],[5269,5275],[5343,5349],[5479,5482],[5518,5519],[5520,5520],[20004,20032],[20064,20092],[21413,21423],[21473,21483],[21896,21899],[22171,22177],[22181,22187],[22191,22197],[25884,25884],[27205,27232],[27391,27398],[27492,27492],[28402,28432],[28462,28492],[30161,30179],[30800,30800],[31251,31259],[31275,31279],[31281,31290],[31466,31700]];function DQ(t){return t!=null&&Oct.some(([e,i])=>t>=e&&t<=i)}const Pct={visible:"visibleSublayers"};let Rv=class extends ze{constructor(e){super(e),this.scale=0}set layer(e){this._get("layer")!==e&&(this._set("layer",e),this.removeHandles("layer"),e&&this.addHandles([e.sublayers.on("change",()=>this.notifyChange("visibleSublayers")),e.on("wms-sublayer-update",i=>this.notifyChange(Pct[i.propertyName]))],"layer"))}get layers(){return this.visibleSublayers.filter(({name:e})=>e).map(({name:e})=>e).join()}get version(){this.commitProperty("layers");const e=this.layer;return e&&e.commitProperty("imageTransparency"),(this._get("version")||0)+1}get visibleSublayers(){const{layer:e,scale:i}=this,r=e==null?void 0:e.sublayers,n=[],s=o=>{const{minScale:a,maxScale:c,sublayers:p,visible:_}=o;_&&(i===0||(a===0||i<=a)&&(c===0||i>=c))&&(p?p.forEach(s):n.push(o))};return r==null||r.forEach(s),n}toJSON(){const{layer:e,layers:i}=this,{imageFormat:r,imageTransparency:n,version:s}=e;return{format:r,request:"GetMap",service:"WMS",styles:"",transparent:n?"TRUE":"FALSE",version:s,layers:i}}};y([w()],Rv.prototype,"layer",null),y([w({readOnly:!0})],Rv.prototype,"layers",null),y([w({type:Number})],Rv.prototype,"scale",void 0),y([w({readOnly:!0})],Rv.prototype,"version",null),y([w({readOnly:!0})],Rv.prototype,"visibleSublayers",null),Rv=y([Z("esri.layers.support.ExportWMSImageParameters")],Rv);async function Rct(t,e,i){let r;try{r=await createImageBitmap(t)}catch(n){throw new se("request:server",`Unable to load ${e}`,{url:e,error:n})}return St(i),r}async function Jei(t,e,i,r,n){let s;try{s=await createImageBitmap(t)}catch(o){throw new se("request:server",`Unable to load tile ${e}/${i}/${r}`,{error:o,level:e,row:i,col:r})}return St(n),s}var SF;let Ict=0,$o=SF=class extends z_(qz){constructor(t){super(t),this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.legendUrl=null,this.legendEnabled=!0,this.layer=null,this.maxScale=0,this.minScale=0,this.name=null,this.parent=null,this.popupEnabled=!1,this.queryable=!1,this.sublayers=null,this.spatialReferences=null,this.title=null,this.addHandles([Jr(()=>this.sublayers,"after-add",({item:e})=>{e.parent=this,e.layer=this.layer},Li),Jr(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=e.parent=null},Li),_e(()=>this.sublayers,(e,i)=>{if(i)for(const r of i)r.layer=r.parent=null;if(e)for(const r of e)r.parent=this,r.layer=this.layer},Li),_e(()=>this.layer,e=>{if(this.sublayers)for(const i of this.sublayers)i.layer=e},Li)])}get id(){return this._get("id")??Ict++}set id(t){this._set("id",t)}readLegendUrl(t,e){return e.legendUrl??e.legendURL??null}get effectiveScaleRange(){const{minScale:t,maxScale:e}=this;return{minScale:t,maxScale:e}}castSublayers(t){return _s(tt.ofType(SF),t)}set visible(t){this._setAndNotifyLayer("visible",t)}clone(){var e,i,r;const t=new SF;return this.hasOwnProperty("description")&&(t.description=this.description),this.hasOwnProperty("fullExtent")&&(t.fullExtent=this.fullExtent.clone()),this.hasOwnProperty("fullExtents")&&(t.fullExtents=((e=this.fullExtents)==null?void 0:e.map(n=>n.clone()))??null),this.hasOwnProperty("legendUrl")&&(t.legendUrl=this.legendUrl),this.hasOwnProperty("legendEnabled")&&(t.legendEnabled=this.legendEnabled),this.hasOwnProperty("layer")&&(t.layer=this.layer),this.hasOwnProperty("name")&&(t.name=this.name),this.hasOwnProperty("parent")&&(t.parent=this.parent),this.hasOwnProperty("queryable")&&(t.queryable=this.queryable),this.hasOwnProperty("sublayers")&&(t.sublayers=(i=this.sublayers)==null?void 0:i.map(n=>n.clone())),this.hasOwnProperty("spatialReferences")&&(t.spatialReferences=(r=this.spatialReferences)==null?void 0:r.map(n=>n)),this.hasOwnProperty("visible")&&(t.visible=this.visible),this.hasOwnProperty("title")&&(t.title=this.title),t}_setAndNotifyLayer(t,e){const i=this.layer;this._get(t)!==e&&(this._set(t,e),i&&i.emit("wms-sublayer-update",{propertyName:t,id:this.id}))}};y([w()],$o.prototype,"description",void 0),y([w({readOnly:!0})],$o.prototype,"dimensions",void 0),y([w({type:Vi,json:{name:"extent"}})],$o.prototype,"fullExtent",void 0),y([w()],$o.prototype,"fullExtents",void 0),y([w({type:Number,json:{write:{enabled:!1,overridePolicy:()=>({ignoreOrigin:!0,enabled:!0})}}})],$o.prototype,"id",null),y([w({type:String,json:{name:"legendUrl",write:{ignoreOrigin:!0}}})],$o.prototype,"legendUrl",void 0),y([Rt("legendUrl",["legendUrl","legendURL"])],$o.prototype,"readLegendUrl",null),y([w({type:Boolean,json:{name:"showLegend",origins:{"web-map":{read:!1,write:!1},"web-scene":{read:!1,write:!1}}}})],$o.prototype,"legendEnabled",void 0),y([w()],$o.prototype,"layer",void 0),y([w()],$o.prototype,"maxScale",void 0),y([w()],$o.prototype,"minScale",void 0),y([w({readOnly:!0})],$o.prototype,"effectiveScaleRange",null),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],$o.prototype,"name",void 0),y([w()],$o.prototype,"parent",void 0),y([w({type:Boolean,json:{read:{source:"showPopup"},write:{ignoreOrigin:!0,target:"showPopup"}}})],$o.prototype,"popupEnabled",void 0),y([w({type:Boolean,json:{write:{ignoreOrigin:!0}}})],$o.prototype,"queryable",void 0),y([w()],$o.prototype,"sublayers",void 0),y([Ci("sublayers")],$o.prototype,"castSublayers",null),y([w({type:[Number],json:{read:{source:"spatialReferences"}}})],$o.prototype,"spatialReferences",void 0),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],$o.prototype,"title",void 0),y([w({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"}}})],$o.prototype,"visible",null),$o=SF=y([Z("esri.layers.support.WMSSublayer")],$o);const NQ=$o,$fe={84:4326,83:4269,27:4267};function $ct(t){if(!t)return null;const e={idCounter:-1};typeof t=="string"&&(t=new DOMParser().parseFromString(t,"text/xml"));const i=t.documentElement;if(i.nodeName==="ServiceExceptionReport"){const de=Array.prototype.slice.call(i.childNodes).map(be=>be.textContent).join(`\r +`);throw new se("wmslayer:wms-capabilities-xml-is-not-valid","The server returned errors when the WMS capabilities were requested.",de)}const r=hu("Capability",i),n=hu("Service",i),s=r&&hu("Request",r);if(!r||!n||!s)return null;const o=hu("Layer",r);if(!o)return null;const a=i.nodeName==="WMS_Capabilities"||i.nodeName==="WMT_MS_Capabilities"?i.getAttribute("version"):"1.3.0",c=hy("Title",n,"")||hy("Name",n,""),p=hy("AccessConstraints",n,""),_=/^none$/i.test(p)?"":p,x=hy("Abstract",n,""),S=parseInt(hy("MaxWidth",n,"5000"),10),C=parseInt(hy("MaxHeight",n,"5000"),10),M=Dfe(s,"GetMap"),P=Lfe(s,"GetMap"),$=JI(o,a,e);if(!$)return null;let F,z=0;const k=Array.prototype.slice.call(r.childNodes),U=$.sublayers??[],j=de=>{de!=null&&U.push(de)};k.forEach(de=>{de.nodeName==="Layer"&&(z===0?F=de:(z===1&&$.name&&($.name="",j(JI(F,a,e))),j(JI(de,a,e))),z++)});let G=$.sublayers,Y=$.extent;const Q=$.fullExtents??[];if(G||(G=[]),G.length===0&&G.push($),!Y){const de=new Vi(G[0].extent);$.extent=de.toJSON(),Y=$.extent}const ne=$.spatialReferences.length>0?$.spatialReferences:eRe($),ie=Lfe(s,"GetFeatureInfo"),he=ie?Dfe(s,"GetFeatureInfo"):null,ce=tRe(G),ve=$.minScale||0,ge=$.maxScale||0,pe=$.dimensions??[],Ee=ce.reduce((de,be)=>de.concat(be.dimensions??[]),[]),te=pe.concat(Ee).filter(rRe);let le=null;if(te.length){const de=te.map(be=>{const{extent:Se}=be;return Nct(Se)?Se.map(Ae=>Ae.getTime()):Se==null?void 0:Se.map(Ae=>[Ae.min.getTime(),Ae.max.getTime()])}).flat(2).filter(ys);le={startTimeField:null,endTimeField:null,trackIdField:void 0,timeExtent:[Math.min(...de),Math.max(...de)]}}return{copyright:_,description:x,dimensions:pe,extent:Y,fullExtents:Q,featureInfoFormats:he,featureInfoUrl:ie,mapUrl:P,maxWidth:S,maxHeight:C,maxScale:ge,minScale:ve,layers:ce,spatialReferences:ne,supportedImageFormatTypes:M,timeInfo:le,title:c,version:a}}function Lct(t){const e=t.filter(i=>i.popupEnabled&&i.name&&i.queryable);return e.length?e.map(({name:i})=>i).join():null}function eRe(t){if(t.spatialReferences.length>0)return t.spatialReferences;if(t.sublayers)for(const e of t.sublayers){const i=eRe(e);if(i.length>0)return i}return[]}function tRe(t){var i;let e=[];for(const r of t)e.push(r),(i=r.sublayers)!=null&&i.length&&(e=e.concat(tRe(r.sublayers)),delete r.sublayers);return e}function TF(t,e,i){return e.getAttribute(t)??i}function Dct(t,e,i,r){const n=hu(t,i);return n?TF(e,n,r):r}function hu(t,e){for(let i=0;in).filter(ys);const r=[];for(const n of i)if(n.getAttribute("name")===e){const s=EF("Format",n);for(const{textContent:o}of s)o!=null&&r.push(o)}return r}function Nfe(t,e,i){const r=hu(e,t);if(!r)return i;const{textContent:n}=r;if(n==null||n==="")return i;const s=Number(n);return isNaN(s)?i:s}function JI(t,e,i){if(!t)return null;const r={id:i.idCounter++,fullExtents:[],parentLayerId:null,queryable:t.getAttribute("queryable")==="1",spatialReferences:[],sublayers:null},n=hu("LatLonBoundingBox",t),s=hu("EX_GeographicBoundingBox",t);let o=null;n&&(o=aR(n,4326)),s&&(o=new Vi(0,0,0,0,new rt({wkid:4326})),o.xmin=parseFloat(hy("westBoundLongitude",s,"0")),o.ymin=parseFloat(hy("southBoundLatitude",s,"0")),o.xmax=parseFloat(hy("eastBoundLongitude",s,"0")),o.ymax=parseFloat(hy("northBoundLatitude",s,"0"))),n||s||(o=new Vi(-180,-90,180,90,new rt({wkid:4326}))),r.minScale=Nfe(t,"MaxScaleDenominator",0),r.maxScale=Nfe(t,"MinScaleDenominator",0);const a=["1.0.0","1.1.0","1.1.1"].includes(e)?"SRS":"CRS";return Array.prototype.slice.call(t.childNodes).forEach(c=>{var p;if(c.nodeName==="Name")r.name=c.textContent||"";else if(c.nodeName==="Title")r.title=c.textContent||"";else if(c.nodeName==="Abstract")r.description=c.textContent||"";else if(c.nodeName==="BoundingBox"){const _=c.getAttribute(a);if(_&&_.indexOf("EPSG:")===0){const S=parseInt(_.substring(5),10);S===0||isNaN(S)||o||(o=e==="1.3.0"?aR(c,S,DQ(S)):aR(c,S))}const x=_&&_.indexOf(":");if(x&&x>-1){let S=parseInt(_.substring(x+1,_.length),10);S===0||isNaN(S)||(S=$fe[S]??S);const C=e==="1.3.0"?aR(c,S,DQ(S)):aR(c,S);C&&r.fullExtents&&r.fullExtents.push(C)}}else if(c.nodeName===a)(((p=c.textContent)==null?void 0:p.split(" "))??[]).forEach(_=>{const x=_.includes(":")?parseInt(_.split(":")[1],10):parseInt(_,10);if(x!==0&&!isNaN(x)){const S=$fe[x]??x;r.spatialReferences.includes(S)||r.spatialReferences.push(S)}});else if(c.nodeName!=="Style"||r.legendUrl){if(c.nodeName==="Layer"){const _=JI(c,e,i);_&&(_.parentLayerId=r.id,r.sublayers||(r.sublayers=[]),r.sublayers.push(_))}}else{const _=hu("LegendURL",c);if(_){const x=hu("OnlineResource",_);x&&(r.legendUrl=x.getAttribute("xlink:href"))}}}),r.extent=o==null?void 0:o.toJSON(),r.dimensions=EF("Dimension",t).filter(c=>c.getAttribute("name")&&c.getAttribute("units")&&c.textContent).map(c=>{const p=c.getAttribute("name"),_=c.getAttribute("units"),x=c.textContent,S=c.getAttribute("unitSymbol")??void 0,C=c.getAttribute("default")??void 0,M=TF("default",c,"0")!=="0",P=TF("nearestValue",c,"0")!=="0",$=TF("current",c,"0")!=="0";return rRe({name:p,units:_})?{name:"time",units:"ISO8601",extent:zfe(x),default:zfe(C),multipleValues:M,nearestValue:P,current:$}:Fct({name:p,units:_})?{name:"elevation",units:_,extent:Ffe(x),unitSymbol:S,default:Ffe(C),multipleValues:M,nearestValue:P}:{name:p,units:_,extent:kfe(x),unitSymbol:S,default:kfe(C),multipleValues:M,nearestValue:P}}),r}function Nct(t){return Array.isArray(t)&&t.length>0&&t[0]instanceof Date}function iRe(t){return t.nodeType===Node.ELEMENT_NODE}function Fct(t){return/^elevation$/i.test(t.name)&&/^(epsg|crs):\d+$/i.test(t.units)}function rRe(t){return/^time$/i.test(t.name)&&/^iso8601$/i.test(t.units)}function kct(t,e){const i=[],r=Is(t);for(const n in r.query)r.query.hasOwnProperty(n)&&(e.includes(n.toLowerCase())||i.push(n+"="+r.query[n]));return r.path+(i.length?"?"+i.join("&"):"")}function Ffe(t){if(!t)return;const e=t.includes("/"),i=t.split(",");return e?i.map(r=>{const n=r.split("/");return n.length<2?null:{min:parseFloat(n[0]),max:parseFloat(n[1]),resolution:n.length>=3&&n[2]!=="0"?parseFloat(n[2]):void 0}}).filter(ys):i.map(r=>parseFloat(r))}function kfe(t){if(!t)return;const e=t.includes("/"),i=t.split(",");return e?i.map(r=>{const n=r.split("/");return n.length<2?null:{min:n[0],max:n[1],resolution:n.length>=3&&n[2]!=="0"?n[2]:void 0}}).filter(ys):i}function zfe(t){if(!t)return;const e=t.includes("/"),i=t.split(",");return e?i.map(r=>{const n=r.split("/");return n.length<2?null:{min:new Date(n[0]),max:new Date(n[1]),resolution:n.length>=3&&n[2]!=="0"?zct(n[2]):void 0}}).filter(ys):i.map(r=>new Date(r))}function zct(t){const e=/(?:p(\d+y|\d+(?:\.|,)\d+y)?(\d+m|\d+(?:\.|,)\d+m)?(\d+d|\d+(?:\.|,)\d+d)?)?(?:t(\d+h|\d+(?:\.|,)\d+h)?(\d+m|\d+(?:\.|,)\d+m)?(\d+s|\d+(?:\.|,)\d+s)?)?/i,i=t.match(e);return i?{years:JE(i[1]),months:JE(i[2]),days:JE(i[3]),hours:JE(i[4]),minutes:JE(i[5]),seconds:JE(i[6])}:null}function JE(t){if(!t)return 0;const e=/(?:\d+(?:\.|,)\d+|\d+)/,i=t.match(e);if(!i)return 0;const r=i[0].replace(",",".");return Number(r)}function KE(t){return t.toISOString().replace(/\.[0-9]{3}/,"")}const Ufe=new Set([102100,3857,102113,900913]),Uct=new Set([3395,54004]);function Vct(t,e){let i=t.wkid;return e==null?i:(i!=null&&e.includes(i)||!t.latestWkid||(i=t.latestWkid),i!=null&&Ufe.has(i)?e.find(r=>Ufe.has(r))||e.find(r=>Uct.has(r))||102100:i)}const eq=new tn({bmp:"image/bmp",gif:"image/gif",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"},{ignoreUnknown:!1});function Vfe(t){return t==="text/html"}function Bfe(t){return t==="text/plain"}let qr=class extends vse(Mct(Cct(AB(ej(ij(T5(pE))))))){constructor(...e){super(...e),this.allSublayers=new YT({getCollections:()=>[this.sublayers],getChildrenFunction:i=>i.sublayers}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType="WMS",this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type="wms",this.version=null,this.addHandles([Jr(()=>this.sublayers,"after-add",({item:i})=>{i.parent=i.layer=this},Li),Jr(()=>this.sublayers,"after-remove",({item:i})=>{i.layer=i.parent=null},Li),_e(()=>this.sublayers,(i,r)=>{if(r)for(const n of r)n.layer=n.parent=null;if(i)for(const n of i)n.parent=n.layer=this},Li)])}normalizeCtorArgs(e,i){return typeof e=="string"?{url:e,...i}:e}destroy(){this.allSublayers.destroy()}load(e){const i=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMS"]},e).catch(Uo).then(()=>this._fetchService(i))),Promise.resolve(this)}readFullExtentFromItemOrMap(e,i){const r=i.extent;return r?new Vi({xmin:r[0][0],ymin:r[0][1],xmax:r[1][0],ymax:r[1][1]}):null}writeFullExtent(e,i){i.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return this.featureInfoFormats==null?null:this.featureInfoFormats.find(Vfe)??this.featureInfoFormats.find(Bfe)??null}set featureInfoFormat(e){e==null?(this.revert("featureInfoFormat","service"),this._clearOverride("featureInfoFormat")):(Vfe(e)||Bfe(e))&&this._override("featureInfoFormat",e)}readImageFormat(e,i){const r=i.supportedImageFormatTypes;return r&&r.includes("image/png")?"image/png":r&&r[0]}readSpatialReferenceFromItemOrDocument(e,i){return new rt(i.spatialReferences[0])}writeSpatialReferences(e,i){var n;const r=(n=this.spatialReference)==null?void 0:n.wkid;e&&r?(i.spatialReferences=e.filter(s=>s!==r),i.spatialReferences.unshift(r)):i.spatialReferences=e}readSublayersFromItemOrMap(e,i,r){return jfe(i.layers,r,i.visibleLayers)}readSublayers(e,i,r){return jfe(i.layers,r)}writeSublayers(e,i,r,n){var a,c;i.layers=[];const s=new Map,o=e.flatten(({sublayers:p})=>p??[]);for(const p of o)if(typeof((a=p.parent)==null?void 0:a.id)=="number"){const _=s.get(p.parent.id);_!=null?_.push(p.id):s.set(p.parent.id,[p.id])}for(const p of o){const _={sublayer:p,...n},x=p.write({parentLayerId:typeof((c=p.parent)==null?void 0:c.id)=="number"?p.parent.id:-1},_);if(s.has(p.id)&&(x.sublayerIds=s.get(p.id)),!p.sublayers&&p.name){const S=p.write({},_);delete S.id,i.layers.push(S)}}i.visibleLayers=o.filter(({visible:p,sublayers:_})=>p&&!_).map(({name:p})=>p).toArray()}set url(e){if(!e)return void this._set("url",e);const{path:i,query:r}=Is(e);for(const s in r)/^(request|service)$/i.test(s)&&delete r[s];const n=oO(i,r??{});this._set("url",n)}createExportImageParameters(e,i,r,n){const s=(n==null?void 0:n.pixelRatio)??1,o=Pfe({extent:e,width:i})*s,a=new Rv({layer:this,scale:o}),{xmin:c,ymin:p,xmax:_,ymax:x,spatialReference:S}=e,C=Vct(S,this.spatialReferences),M=this.version==="1.3.0"&&DQ(C)?`${p},${c},${x},${_}`:`${c},${p},${_},${x}`,P=a.toJSON();return{bbox:M,[this.version==="1.3.0"?"crs":"srs"]:C==null||isNaN(C)?void 0:"EPSG:"+C,...P}}async fetchImage(e,i,r,n){var x,S;const s=this.mapUrl,o=this.createExportImageParameters(e,i,r,n);if(!o.layers){const C=document.createElement("canvas");return C.width=i,C.height=r,C}const a=(x=n==null?void 0:n.timeExtent)==null?void 0:x.start,c=(S=n==null?void 0:n.timeExtent)==null?void 0:S.end,p=a!=null&&c!=null?a.getTime()===c.getTime()?KE(a):`${KE(a)}/${KE(c)}`:void 0,_={responseType:"image",query:this._mixCustomParameters({width:i,height:r,...o,time:p,...this.refreshParameters}),signal:n==null?void 0:n.signal};return yi(s??"",_).then(C=>C.data)}async fetchImageBitmap(e,i,r,n){var S,C;const s=this.mapUrl??"",o=this.createExportImageParameters(e,i,r,n);if(!o.layers){const M=document.createElement("canvas");return M.width=i,M.height=r,M}const a=(S=n==null?void 0:n.timeExtent)==null?void 0:S.start,c=(C=n==null?void 0:n.timeExtent)==null?void 0:C.end,p=a!=null&&c!=null?a.getTime()===c.getTime()?KE(a):`${KE(a)}/${KE(c)}`:void 0,_={responseType:"blob",query:this._mixCustomParameters({width:i,height:r,...o,time:p,...this.refreshParameters}),signal:n==null?void 0:n.signal},{data:x}=await yi(s,_);return Rct(x,s,n==null?void 0:n.signal)}fetchFeatureInfo(e,i,r,n,s){const o=Pfe({extent:e,width:i}),a=new Rv({layer:this,scale:o}),c=Lct(a.visibleSublayers);if(this.featureInfoUrl==null||c==null)return Promise.resolve([]);if(this.fetchFeatureInfoFunction==null&&this.featureInfoFormat==null)return Promise.resolve([]);const p=this.version==="1.3.0"?{I:n,J:s}:{x:n,y:s},_={query_layers:c,request:"GetFeatureInfo",info_format:this.featureInfoFormat,feature_count:25,width:i,height:r,...p},x={...this.createExportImageParameters(e,i,r),..._},S=this._mixCustomParameters(x);return this.fetchFeatureInfoFunction!=null?this.fetchFeatureInfoFunction(S):this._defaultFetchFeatureInfoFunction(oO(this.featureInfoUrl,S))}findSublayerById(e){return this.allSublayers.find(i=>i.id===e)}findSublayerByName(e){return this.allSublayers.find(i=>i.name===e)}serviceSupportsSpatialReference(e){return krt(this.url)||this.spatialReferences!=null&&this.spatialReferences.some(i=>{const r=i===900913?rt.WebMercator:new rt({wkid:i});return jn(r,e)})}_defaultFetchFeatureInfoFunction(e){const i=document.createElement("iframe");i.src=zqe(e),i.style.border="none",i.style.margin="0",i.style.width="100%",i.setAttribute("sandbox","");const r=new yE({title:this.title,content:i}),n=new Ma({sourceLayer:this,popupTemplate:r});return Promise.resolve([n])}async _fetchService(e){var i;if(!this.resourceInfo&&((i=this.parsedUrl)!=null&&i.path)){const{path:r,query:n}=this.parsedUrl,{data:s}=await yi(r,{query:{SERVICE:"WMS",REQUEST:"GetCapabilities",...n,...this.customParameters},responseType:"xml",signal:e});this.resourceInfo=$ct(s)}if(this.parsedUrl){const r=new w2(this.parsedUrl.path),{httpsDomains:n}=Mr.request;r.scheme!=="https"||r.port&&r.port!=="443"||!r.host||n.includes(r.host)||n.push(r.host)}this.read(this.resourceInfo,{origin:"service"})}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;const i={...this.customParameters,...this.customLayerParameters};for(const r in i)e[r.toLowerCase()]=i[r];return e}};function Bct(t,e){return t.some(i=>{for(const r in i)if(OTe(i,r,null,e))return!0;return!1})}function jfe(t,e,i){t=t??[];const r=new Map;t.every(s=>s.id==null)&&(t=Pe(t)).forEach((s,o)=>s.id=o);for(const s of t){const o=new NQ;o.read(s,e),i&&!i.includes(o.name)&&(o.visible=!1),r.set(o.id,o)}const n=[];for(const s of t){const o=s.id!=null?r.get(s.id):null;if(o)if(s.parentLayerId!=null&&s.parentLayerId>=0){const a=r.get(s.parentLayerId);if(!a)continue;a.sublayers||(a.sublayers=new tt),a.sublayers.push(o)}else n.push(o)}return n}y([w({readOnly:!0})],qr.prototype,"allSublayers",void 0),y([w({json:{type:Object,write:!0}})],qr.prototype,"customParameters",void 0),y([w({json:{type:Object,write:!0}})],qr.prototype,"customLayerParameters",void 0),y([w({type:String,json:{write:!0}})],qr.prototype,"copyright",void 0),y([w()],qr.prototype,"description",void 0),y([w({readOnly:!0})],qr.prototype,"dimensions",void 0),y([w({json:{type:[[Number]],read:{source:"extent"},write:{target:"extent"},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],qr.prototype,"fullExtent",void 0),y([Rt(["web-document","portal-item"],"fullExtent",["extent"])],qr.prototype,"readFullExtentFromItemOrMap",null),y([Et(["web-document","portal-item"],"fullExtent",{extent:{type:[[Number]]}})],qr.prototype,"writeFullExtent",null),y([w()],qr.prototype,"fullExtents",void 0),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],qr.prototype,"featureInfoFormat",null),y([w({type:[String],readOnly:!0})],qr.prototype,"featureInfoFormats",void 0),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],qr.prototype,"featureInfoUrl",void 0),y([w()],qr.prototype,"fetchFeatureInfoFunction",void 0),y([w({type:String,json:{origins:{"web-document":{default:"image/png",type:eq.jsonValues,read:{reader:eq.read,source:"format"},write:{writer:eq.write,target:"format"}}}}})],qr.prototype,"imageFormat",void 0),y([Rt("imageFormat",["supportedImageFormatTypes"])],qr.prototype,"readImageFormat",null),y([w({type:Number,json:{read:{source:"maxHeight"},write:{target:"maxHeight"}}})],qr.prototype,"imageMaxHeight",void 0),y([w({type:Number,json:{read:{source:"maxWidth"},write:{target:"maxWidth"}}})],qr.prototype,"imageMaxWidth",void 0),y([w()],qr.prototype,"imageTransparency",void 0),y([w(qOe)],qr.prototype,"legendEnabled",void 0),y([w({type:["show","hide","hide-children"]})],qr.prototype,"listMode",void 0),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],qr.prototype,"mapUrl",void 0),y([w({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],qr.prototype,"isReference",void 0),y([w({type:["WMS"]})],qr.prototype,"operationalLayerType",void 0),y([w()],qr.prototype,"resourceInfo",void 0),y([w({type:rt,json:{origins:{service:{read:{source:"extent.spatialReference"}}},write:!1}})],qr.prototype,"spatialReference",void 0),y([Rt(["web-document","portal-item"],"spatialReference",["spatialReferences"])],qr.prototype,"readSpatialReferenceFromItemOrDocument",null),y([w({type:[_n],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],qr.prototype,"spatialReferences",void 0),y([Et(["web-document","portal-item"],"spatialReferences")],qr.prototype,"writeSpatialReferences",null),y([w({type:tt.ofType(NQ),json:{write:{target:"layers",overridePolicy(t,e,i){if(Bct(this.allSublayers,i))return{ignoreOrigin:!0}}}}})],qr.prototype,"sublayers",void 0),y([Rt(["web-document","portal-item"],"sublayers",["layers","visibleLayers"])],qr.prototype,"readSublayersFromItemOrMap",null),y([Rt("service","sublayers",["layers"])],qr.prototype,"readSublayers",null),y([Et("sublayers",{layers:{type:[NQ]},visibleLayers:{type:[String]}})],qr.prototype,"writeSublayers",null),y([w({json:{read:!1},readOnly:!0,value:"wms"})],qr.prototype,"type",void 0),y([w(goe)],qr.prototype,"url",null),y([w({type:String,json:{write:{ignoreOrigin:!0}}})],qr.prototype,"version",void 0),qr=y([Z("esri.layers.WMSLayer")],qr);const nRe=qr,jct=Object.freeze(Object.defineProperty({__proto__:null,default:nRe},Symbol.toStringTag,{value:"Module"}));async function bj(t,e){return await t.load(),Gct(t,e)}async function Gct(t,e){const i=[],r=(...s)=>{for(const o of s)o!=null&&(Array.isArray(o)?r(...o):tt.isCollection(o)?o.forEach(a=>r(a)):Wf.isLoadable(o)&&i.push(o))};e(r);let n=null;if(await Itt(i,async s=>{const o=await ih(Hct(s)?s.loadAll():s.load());o.ok!==!1||n||(n=o)}),n)throw n.error;return t}function Hct(t){return"loadAll"in t&&typeof t.loadAll=="function"}function sRe(t){return new YT({getCollections:()=>[t.tables,t.layers],getChildrenFunction:e=>{const i=[];return"tables"in e&&i.push(e.tables),"layers"in e&&i.push(e.layers),i},itemFilterFunction:e=>{const i=e.parent;return!!i&&"tables"in i&&i.tables.includes(e)}})}function tq(t){for(const e of t.values())e==null||e.destroy();t.clear()}function FQ(t,e,i){let r,n;if(t)for(let s=0,o=t.length;s{let e=class extends t{constructor(...i){super(...i),this.layers=new tt;const r=o=>{o.parent&&"remove"in o.parent&&o.parent.remove(o)},n=o=>{o.parent=this,this.layerAdded(o),o.type!=="elevation"&&o.type!=="base-elevation"||Ce.getLogger(this).error(`Layer 'title:${o.title}, id:${o.id}' of type '${o.type}' is not supported as an operational layer and will therefore be ignored.`)},s=o=>{o.parent=null,this.layerRemoved(o)};this.addHandles([this.layers.on("before-add",o=>r(o.item)),this.layers.on("after-add",o=>n(o.item)),this.layers.on("after-remove",o=>s(o.item))])}destroy(){const i=this.layers.toArray();for(const r of i)r.destroy();this.layers.destroy()}set layers(i){this._set("layers",od(i,this._get("layers")))}add(i,r){const n=this.layers;if(r=n.getNextIndex(r),i instanceof pE){const s=i;s.parent===this?this.reorder(s,r):n.add(s,r)}else yd(i)?i.then(s=>{this.destroyed||this.add(s,r)}):Ce.getLogger(this).error("#add()","The item being added is not a Layer or a Promise that resolves to a Layer.")}addMany(i,r){const n=this.layers;let s=n.getNextIndex(r);i.slice().forEach(o=>{o.parent!==this?(n.add(o,s),s+=1):this.reorder(o,s)})}findLayerById(i){return FQ(this.layers,"id",i)}findLayerByUid(i){return FQ(this.layers,"uid",i)}remove(i){return this.layers.remove(i)}removeMany(i){return this.layers.removeMany(i)}removeAll(){return this.layers.removeAll()}reorder(i,r){return this.layers.reorder(i,r)}layerAdded(i){}layerRemoved(i){}};return y([w()],e.prototype,"layers",null),e=y([Z("esri.support.LayersMixin")],e),e};function kQ(t,e,i){if(t)for(let r=0,n=t.length;r{let e=class extends t{constructor(...i){super(...i),this.tables=new tt,this.addHandles([this.tables.on("after-add",r=>{const n=r.item;n.parent&&n.parent!==this&&"tables"in n.parent&&n.parent.tables.remove(n),n.parent=this,n.type!=="feature"&&Ce.getLogger(this).error(`Layer 'title:${n.title}, id:${n.id}' of type '${n.type}' is not supported as a table and will therefore be ignored.`)}),this.tables.on("after-remove",r=>{r.item.parent=null})])}destroy(){const i=this.tables.toArray();for(const r of i)r.destroy();this.tables.destroy()}set tables(i){this._set("tables",od(i,this._get("tables")))}findTableById(i){return kQ(this.tables,"id",i)}findTableByUid(i){return kQ(this.tables,"uid",i)}};return y([w()],e.prototype,"tables",null),e=y([Z("esri.support.TablesMixin")],e),e},lRe=Symbol("WebScene");var by;(function(t){t[t.SAVE=0]="SAVE",t[t.SAVE_AS=1]="SAVE_AS"})(by||(by={}));const qct=new Set(["bing-maps","imagery","imagery-tile","map-image","open-street-map","tile","unknown","unsupported","vector-tile","web-tile","wms","wmts"]),Wct=new Set(["csv","feature","geo-rss","geojson","group","imagery","imagery-tile","kml","map-image","map-notes","media","ogc-feature","oriented-imagery","route","stream","subtype-group","tile","unknown","unsupported","vector-tile","web-tile","wfs","wms","wmts"]);function Yct(t){return t.layerContainerType==="basemap"?qct:t.layerContainerType==="operational-layers"?Wct:null}function Xct(t,e){if(e.restrictedWebMapWriting){const i=Yct(e);return i==null||i.has(t.type)&&!XB(t)}return!0}function Zct(t,e){var i;if(e)if(XB(t)){const r=b9("featureCollection.layers",e),n=(i=r==null?void 0:r[0])==null?void 0:i.layerDefinition;n&&Gfe(t,n)}else t.type!=="group"&&Gfe(t,e)}function Gfe(t,e){"maxScale"in t&&(e.maxScale=dz(t.maxScale)??void 0),"minScale"in t&&(e.minScale=dz(t.minScale)??void 0)}function Jct(t,e){if(Zct(t,e),e&&(e.id=t.id,"blendMode"in t&&(e.blendMode=t.blendMode,e.blendMode==="normal"&&delete e.blendMode),e.opacity=dz(t.opacity)??void 0,e.title=t.title||"Layer",e.visibility=t.visible,"legendEnabled"in t&&t.type!=="wmts"))if(XB(t)){const i=e.featureCollection;i&&(i.showLegend=t.legendEnabled)}else e.showLegend=t.legendEnabled}function zQ(t,e,i){if(!t.persistenceEnabled)return null;if(!("write"in t)||!t.write)return i!=null&&i.messages&&i.messages.push(new se("layer:unsupported",`Layers (${t.title}, ${t.id}) of type '${t.declaredClass}' cannot be persisted`,{layer:t})),null;if(XB(t)&&!t.isTable)e=t.resourceInfo;else if(Xct(t,i)){const r={};return t.write(r,i)?r:null}return e!=null&&Jct(t,e=Pe(e)),e}let ac=class extends vse(AB(ej(ij(aRe(oRe(T5(pE))))))){constructor(e){super(e),this.allLayers=new YT({getCollections:()=>[this.layers],getChildrenFunction:i=>"layers"in i?i.layers:null}),this.allTables=sRe(this),this.fullExtent=void 0,this.operationalLayerType="GroupLayer",this.spatialReference=void 0,this.type="group",this._debouncedSaveOperations=n5(async(i,r,n)=>{const{save:s,saveAs:o}=await we(()=>import("./groupLayerUtils-dIBU5FCY.js"),__vite__mapDeps([83,84,10]));switch(i){case by.SAVE:return s(this,r);case by.SAVE_AS:return o(this,n,r)}})}initialize(){this._enforceVisibility(this.visibilityMode,this.visible),this.addHandles([_e(()=>{let e=this.parent;for(;e&&"parent"in e&&e.parent;)e=e.parent;return e&&lRe in e},e=>{const i="prevent-adding-tables";this.removeHandles(i),e&&(this.tables.removeAll(),this.addHandles(Jr(()=>this.tables,"before-add",r=>{r.preventDefault(),Ce.getLogger(this).errorOnce("tables","tables in group layers in a webscene are not supported. Please move the tables from the group layer to the webscene if you want to persist them.")}),i))},kt),_e(()=>this.visible,this._onVisibilityChange.bind(this),Li)])}destroy(){this.allLayers.destroy(),this.allTables.destroy()}get sourceIsPortalItem(){return this.portalItem&&this.originIdOf("portalItem")===Di.USER}_writeLayers(e,i,r,n){const s=[];if(!e)return s;e.forEach(o=>{const a=zQ(o,n.webmap?n.webmap.getLayerJSONFromResourceInfo(o):null,n);a!=null&&a.layerType&&s.push(a)}),i.layers=s}set portalItem(e){this._set("portalItem",e)}readPortalItem(e,i,r){const{itemId:n,layerType:s}=i;if(s==="GroupLayer"&&n)return new Om({id:n,portal:r==null?void 0:r.portal})}writePortalItem(e,i){e!=null&&e.id&&(i.itemId=e.id)}set visibilityMode(e){const i=this._get("visibilityMode")!==e;this._set("visibilityMode",e),i&&this._enforceVisibility(e,this.visible)}async beforeSave(){return Xnt(this)}load(e){const i=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Group Layer","Scene Service"],layerModuleTypeMap:zPe},e).catch(r=>{if(Uo(r),this.sourceIsPortalItem)throw r});return this.addResolvingPromise(i),Promise.resolve(this)}async loadAll(){return bj(this,e=>{e(this.layers,this.tables)})}async save(e){return this._debouncedSaveOperations(by.SAVE,e)}async saveAs(e,i){return this._debouncedSaveOperations(by.SAVE_AS,i,e)}layerAdded(e){e.visible&&this.visibilityMode==="exclusive"?this._turnOffOtherLayers(e):this.visibilityMode==="inherited"&&(e.visible=this.visible),this.hasHandles(e.uid)?console.error(`Layer readded to Grouplayer: uid=${e.uid}`):this.addHandles(_e(()=>e.visible,i=>this._onChildVisibilityChange(e,i),Li),e.uid)}layerRemoved(e){this.removeHandles(e.uid),this._enforceVisibility(this.visibilityMode,this.visible)}_turnOffOtherLayers(e){this.layers.forEach(i=>{i!==e&&(i.visible=!1)})}_enforceVisibility(e,i){if(!Kl(this).initialized)return;const r=this.layers;let n=r.find(s=>s.visible);switch(e){case"exclusive":r.length&&!n&&(n=r.at(0),n.visible=!0),this._turnOffOtherLayers(n);break;case"inherited":r.forEach(s=>{s.visible=i})}}_onVisibilityChange(e){this.visibilityMode==="inherited"&&this.layers.forEach(i=>{i.visible=e})}_onChildVisibilityChange(e,i){switch(this.visibilityMode){case"exclusive":i?this._turnOffOtherLayers(e):this._isAnyLayerVisible()||(e.visible=!0);break;case"inherited":e.visible=this.visible}}_isAnyLayerVisible(){return this.layers.some(e=>e.visible)}};y([w({readOnly:!0,dependsOn:[]})],ac.prototype,"allLayers",void 0),y([w({readOnly:!0})],ac.prototype,"allTables",void 0),y([w({json:{read:!0,write:!0}})],ac.prototype,"blendMode",void 0),y([w()],ac.prototype,"fullExtent",void 0),y([w({readOnly:!0})],ac.prototype,"sourceIsPortalItem",null),y([w({json:{read:!1,write:{ignoreOrigin:!0}}})],ac.prototype,"layers",void 0),y([Et("layers")],ac.prototype,"_writeLayers",null),y([w({type:["GroupLayer"]})],ac.prototype,"operationalLayerType",void 0),y([w({json:{origins:{"web-map":{read:!1,write:{overridePolicy(t,e,i){return{enabled:(t==null?void 0:t.type)==="Group Layer"&&(i==null?void 0:i.initiator)!==this}}}},"web-scene":{read:!1,write:!1}}}})],ac.prototype,"portalItem",null),y([Rt("web-map","portalItem",["itemId"])],ac.prototype,"readPortalItem",null),y([Et("web-map","portalItem",{itemId:{type:String}})],ac.prototype,"writePortalItem",null),y([w()],ac.prototype,"spatialReference",void 0),y([w({json:{read:!1},readOnly:!0,value:"group"})],ac.prototype,"type",void 0),y([w({type:["independent","inherited","exclusive"],value:"independent",json:{write:!0,origins:{"web-map":{type:["independent","exclusive"],write:(t,e,i)=>{t!=="inherited"&&(e[i]=t)}}}}})],ac.prototype,"visibilityMode",null),ac=y([Z("esri.layers.GroupLayer")],ac);const cRe=ac,Kct=Object.freeze(Object.defineProperty({__proto__:null,default:cRe},Symbol.toStringTag,{value:"Module"})),Qct=()=>new eoe({elevationInfo:{mode:"absolute-height"},title:"Joonistatud kihid"}),eut=(t,e)=>new Z5e({portalItem:{id:t},title:e}),tut=()=>new nRe({portalItem:{id:"38a98f83f3a248faaea9ce793e50ddee"},title:"Ortofoto WMS",visible:!1,listMode:"hide"}),Hfe=(t,e,i=!1)=>new cRe({title:t,visible:i,visibilityMode:e}),iut=(t,e)=>{const i=e.map.allLayers.find(n=>n.title==="Taimkate analüütiline");i.visible=!0;const r=e.map.allLayers.find(n=>n.title==="Taimkate realistlik");t.addMany([i,r]),e.map.removeMany([i,r])},rut=t=>{const e=["Puurkaevud/puuraugud","Ehitusgeoloogia","Geoloogia WMS"],i={};return t.map.layers.forEach(n=>{const s=n.title;e.includes(s)&&(i[s]=n)}),{items:e.map(n=>i[n]).filter(Boolean)}},qfe=t=>{const{items:e}=t.map.allLayers,{initVisible:i}=e.reduce((r,n)=>(n.visible===!0&&r.initVisible.push(n),r),{initVisible:[]});return i},nut=(t,e)=>{const i=t.filter(p=>!e.includes(p)),r=e.filter(p=>!t.includes(p)),n=p=>p.title,s=[...i.map(n),...r.map(n)],o=["Kõrgusmudel","Aluspõhi 50m","Aluskord 50m"],a=s.filter(p=>!o.includes(p)),c=s.filter(p=>o.includes(p));return[a,c]},sut=(t,e)=>{const i=document.getElementById("basemapSwitch");let r;i.addEventListener("calciteCheckboxChange",()=>{t.activeBasemap.title!=="Basemap"&&(r=t.activeBasemap),i.checked?e.map.basemap={}:e.map.basemap=r,t.disabled=!t.disabled})};async function out(t){if(!t)return;const e=t.includes("-vector")?t.slice(0,t.indexOf("-vector")):t.includes("-3d")?t.slice(0,t.indexOf("-3d")):t,i=await gE("esri/t9n/basemaps");return i[t]||i[e]}const _P={satellite:{id:"satellite",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/satellite.jpg")},baseMapLayers:[{id:"satellite-base-layer",url:"//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Imagery",showLegend:!1,visibility:!0,opacity:1}]},hybrid:{id:"hybrid",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/hybrid.jpg")},baseMapLayers:[{id:"hybrid-base-layer",url:"//services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Imagery",showLegend:!1,visibility:!0,opacity:1},{id:"hybrid-reference-layer",styleUrl:"https://cdn.arcgis.com/sharing/rest/content/items/30d6b8271e1849cd9c3042060001f425/resources/styles/root.json",layerType:"VectorTileLayer",title:"Hybrid Reference Layer",isReference:!0,showLegend:!1,visibility:!0,opacity:1}]},terrain:{id:"terrain",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/terrain.jpg")},baseMapLayers:[{id:"terrain-base-layer",url:"//services.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Terrain Base",showLegend:!1,visibility:!0,opacity:1},{id:"terrain-reference-layer",url:"//services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Reference Overlay",isReference:!0,showLegend:!1,visibility:!0,opacity:1}]},oceans:{id:"oceans",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/oceans.jpg")},baseMapLayers:[{id:"oceans-base-layer",url:"//services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Ocean Base",showLegend:!1,visibility:!0,opacity:1},{id:"oceans-reference-layer",url:"//services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Ocean Reference",isReference:!0,showLegend:!1,visibility:!0,opacity:1}]},osm:{id:"osm",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/osm.jpg")},baseMapLayers:[{id:"osm-base-layer",layerType:"OpenStreetMap",title:"Open Street Map",showLegend:!1,visibility:!0,opacity:1}]},"dark-gray-vector":{id:"dark-gray-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/dark-gray-vector.jpg")},baseMapLayers:[{id:"dark-gray-base-layer",styleUrl:"https://cdn.arcgis.com/sharing/rest/content/items/5e9b3685f4c24d8781073dd928ebda50/resources/styles/root.json",layerType:"VectorTileLayer",title:"Dark Gray Base",visibility:!0,opacity:1},{id:"dark-gray-reference-layer",styleUrl:"https://cdn.arcgis.com/sharing/rest/content/items/747cb7a5329c478cbe6981076cc879c5/resources/styles/root.json",layerType:"VectorTileLayer",title:"Dark Gray Reference",isReference:!0,visibility:!0,opacity:1}]},get"dark-gray"(){return{...this["dark-gray-vector"],id:"dark-gray"}},"gray-vector":{id:"gray-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/gray-vector.jpg")},baseMapLayers:[{id:"gray-base-layer",styleUrl:"https://cdn.arcgis.com/sharing/rest/content/items/291da5eab3a0412593b66d384379f89f/resources/styles/root.json",layerType:"VectorTileLayer",title:"Light Gray Base",visibility:!0,opacity:1},{id:"gray-reference-layer",styleUrl:"https://cdn.arcgis.com/sharing/rest/content/items/1768e8369a214dfab4e2167d5c5f2454/resources/styles/root.json",layerType:"VectorTileLayer",title:"Light Gray Reference",isReference:!0,visibility:!0,opacity:1}]},get gray(){return{...this["gray-vector"],id:"gray"}},"streets-vector":{id:"streets-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/streets-vector.jpg")},baseMapLayers:[{id:"streets-vector-base-layer",styleUrl:"//cdn.arcgis.com/sharing/rest/content/items/de26a3cf4cc9451298ea173c4b324736/resources/styles/root.json",layerType:"VectorTileLayer",title:"World Streets",visibility:!0,opacity:1}]},get streets(){return{...this["streets-vector"],id:"streets"}},"topo-vector":{id:"topo-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/topo-vector.jpg")},baseMapLayers:[{id:"world-hillshade-layer",url:"//services.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Hillshade",showLegend:!1,visibility:!0,opacity:1},{id:"topo-vector-base-layer",styleUrl:"//cdn.arcgis.com/sharing/rest/content/items/7dc6cea0b1764a1f9af2e679f642f0f5/resources/styles/root.json",layerType:"VectorTileLayer",title:"World Topo",visibility:!0,opacity:1}]},get topo(){return{...this["topo-vector"],id:"topo"}},"streets-night-vector":{id:"streets-night-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/streets-night.jpg")},baseMapLayers:[{id:"streets-night-vector-base-layer",styleUrl:"//cdn.arcgis.com/sharing/rest/content/items/86f556a2d1fd468181855a35e344567f/resources/styles/root.json",layerType:"VectorTileLayer",title:"World Streets Night",visibility:!0,opacity:1}]},"streets-relief-vector":{id:"streets-relief-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/streets-relief.jpg")},baseMapLayers:[{id:"world-hillshade-layer",url:"//services.arcgisonline.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer",layerType:"ArcGISTiledMapServiceLayer",title:"World Hillshade",showLegend:!1,visibility:!0,opacity:1},{id:"streets-relief-vector-base-layer",styleUrl:"//www.arcgis.com/sharing/rest/content/items/b266e6d17fc345b498345613930fbd76/resources/styles/root.json",title:"World Streets Relief",layerType:"VectorTileLayer",visibility:!0,opacity:1}]},"streets-navigation-vector":{id:"streets-navigation-vector",classic:!0,get thumbnailUrl(){return Wr("esri/images/basemap/streets-navigation.jpg")},baseMapLayers:[{id:"streets-navigation-vector-base-layer",styleUrl:"//cdn.arcgis.com/sharing/rest/content/items/63c47b7177f946b49902c24129b87252/resources/styles/root.json",layerType:"VectorTileLayer",title:"World Streets Navigation",visibility:!0,opacity:1}]},"topo-3d":{id:"topo-3d",is3d:!0,get thumbnailUrl(){return Wr("esri/images/basemap/topo-3d.png")},baseMapLayers:[{id:"topo-3d-base-layer",styleUrl:"https://www.arcgis.com/sharing/rest/content/items/1e7d1784d1ef4b79ba6764d0bd6c3150/resources/styles/root.json",layerType:"VectorTileLayer",title:"Topographic",visibility:!0,opacity:1},{id:"topo-3d-trees",title:"Trees",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_Trees_Thematic_v1/SceneServer",itemId:"f75fef56b2d944fe92ef9f7737b4f953",layerType:"ArcGISSceneServiceLayer"},{id:"topo-3d-places-and-labels",title:"Places and Labels",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_DarkLabels_v1/SceneServer",itemId:"a84404ad39c64c328d0596e361ec459b",layerType:"ArcGISSceneServiceLayer"},{id:"topo-3d-buildings",title:"Buildings",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_Buildings_v1/SceneServer",itemId:"ca0470dbbddb4db28bad74ed39949e25",layerType:"ArcGISSceneServiceLayer"}]},"navigation-3d":{id:"navigation-3d",is3d:!0,get thumbnailUrl(){return Wr("esri/images/basemap/navigation-3d.jpg")},baseMapLayers:[{id:"navigation-3d-base-layer",styleUrl:"https://www.arcgis.com/sharing/rest/content/items/ccc904ff872b4144b94934e55e32784b/resources/styles/root.json",layerType:"VectorTileLayer",title:"Navigation",visibility:!0,opacity:1},{id:"navigation-3d-places-and-labels",title:"Places and Labels",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_DarkLabels_v1/SceneServer",itemId:"a84404ad39c64c328d0596e361ec459b",layerType:"ArcGISSceneServiceLayer"},{id:"navigation-3d-buildings",title:"Buildings",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_Buildings_v1/SceneServer",itemId:"ca0470dbbddb4db28bad74ed39949e25",layerType:"ArcGISSceneServiceLayer"}]},"navigation-dark-3d":{id:"navigation-dark-3d",itemId:"5a1365328b4943f09a54cf5fd1205707",is3d:!0,baseMapLayers:[{id:"navigation-dark-3d-base-layer",styleUrl:"https://www.arcgis.com/sharing/rest/content/items/451a1777ab3f4bf095fae24a117439d9/resources/styles/root.json",layerType:"VectorTileLayer",title:"Navigation Dark"},{id:"navigation-dark-3d-places-and-labels",title:"Places and Labels",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_LightLabels_v1/SceneServer/layers/0",itemId:"f364b70b012a4da5a4b5921e193eac4a",layerType:"ArcGISSceneServiceLayer"},{id:"navigation-dark-3d-buildings",title:"Buildings",url:"https://basemaps3d.arcgis.com/arcgis/rest/services/OpenStreetMap3D_Buildings_v1/SceneServer",itemId:"ca0470dbbddb4db28bad74ed39949e25",layerType:"ArcGISSceneServiceLayer"}]},"arcgis-imagery":{get thumbnailUrl(){return Wr("esri/images/basemap/hybrid.jpg")},title:"Imagery Hybrid",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Imagery",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Imagery:Labels",title:"Hybrid Reference Layer",isReference:!0}]},"arcgis-imagery-standard":{get thumbnailUrl(){return Wr("esri/images/basemap/satellite.jpg")},title:"Imagery",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Imagery",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer"}]},"arcgis-imagery-labels":{title:"Hybrid [Reference]",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Imagery:Labels",title:"Hybrid Reference Layer",isReference:!0}]},"arcgis-light-gray":{get thumbnailUrl(){return Wr("esri/images/basemap/gray-vector.jpg")},title:"Light Gray Canvas",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:LightGray:Base",title:"Light Gray Canvas Base"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:LightGray:Labels",title:"Light Gray Canvas Labels",isReference:!0}]},"arcgis-dark-gray":{get thumbnailUrl(){return Wr("esri/images/basemap/dark-gray.jpg")},title:"Dark Gray Canvas",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:DarkGray:Base",title:"Dark Gray Canvas Base"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:DarkGray:Labels",title:"Dark Gray Canvas Labels",isReference:!0}]},"arcgis-navigation":{get thumbnailUrl(){return Wr("esri/images/basemap/streets-navigation.jpg")},title:"Navigation",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Navigation",title:"World Navigation Map"}]},"arcgis-navigation-night":{title:"Navigation (Dark Mode)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:NavigationNight",title:"World Navigation Map (Dark Mode)"}]},"arcgis-streets":{get thumbnailUrl(){return Wr("esri/images/basemap/streets-vector.jpg")},title:"Streets",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Streets",title:"World Street Map"}]},"arcgis-streets-night":{get thumbnailUrl(){return Wr("esri/images/basemap/streets-night.jpg")},title:"Streets (Night)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:StreetsNight",title:"World Street Map (Night)"}]},"arcgis-streets-relief":{get thumbnailUrl(){return Wr("esri/images/basemap/streets-relief.jpg")},title:"Streets (with Relief)",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:StreetsRelief:Base",title:"World Street Map (with Relief)"}]},"arcgis-topographic":{get thumbnailUrl(){return Wr("esri/images/basemap/topo.jpg")},title:"Topographic",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Topographic:Base",title:"World Topographic Map"}]},"arcgis-oceans":{get thumbnailUrl(){return Wr("esri/images/basemap/oceans.jpg")},title:"Oceans",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Ocean Base",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Oceans:Labels",title:"World Ocean Reference",isReference:!0}]},"osm-standard":{title:"OpenStreetMap",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:Standard",title:"OpenStreetMap"}]},"osm-standard-relief":{title:"OpenStreetMap (with relief)",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:StandardRelief:Base",layerType:"VectorTileLayer",title:"OpenStreetMap Relief Base"}]},"osm-streets":{title:"OpenStreetMap (Streets)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:Streets",title:"OpenStreetMap (Streets)"}]},"osm-streets-relief":{title:"OpenStreetMap (Streets with relief)",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:StreetsRelief:Base",layerType:"VectorTileLayer",title:"OpenStreetMap Relief Base"}]},"osm-light-gray":{title:"OpenStreetMap (Light Gray Canvas)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:LightGray:Base",title:"OSM (Light Gray Base)"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:LightGray:Labels",title:"OSM (Light Gray Reference)",isReference:!0}]},"osm-dark-gray":{title:"OpenStreetMap (Dark Gray Canvas)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:DarkGray:Base",title:"OSM (Dark Gray Base)"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/OSM:DarkGray:Labels",title:"OSM (Dark Gray Reference)",isReference:!0}]},"arcgis-terrain":{title:"Terrain with Labels",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Terrain:Base",title:"World Terrain Base"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Terrain:Detail",title:"World Terrain Reference",isReference:!0}]},"arcgis-community":{title:"Community",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Community",title:"Community"}]},"arcgis-charted-territory":{title:"Charted Territory",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:ChartedTerritory:Base",title:"Charted Territory"}]},"arcgis-colored-pencil":{title:"Colored Pencil",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:ColoredPencil",title:"Colored Pencil"}]},"arcgis-nova":{title:"Nova",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Nova",title:"Nova"}]},"arcgis-modern-antique":{title:"Modern Antique",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:ModernAntique:Base",title:"Modern Antique"}]},"arcgis-midcentury":{title:"Mid-Century",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Midcentury",title:"Mid-Century"}]},"arcgis-newspaper":{title:"Newspaper",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:Newspaper",title:"Newspaper"}]},"arcgis-hillshade-light":{title:"Hillshade",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer"}]},"arcgis-hillshade-dark":{title:"Hillshade (Dark)",baseMapLayers:[{layerType:"ArcGISTiledMapServiceLayer",showLegend:!1,title:"World Hillshade (Dark)",url:"https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade_Dark/MapServer"}]},"arcgis-human-geography":{title:"Human Geography",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeography:Base",title:"Human Geography Base"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeography:Detail",title:"Human Geography Detail",isReference:!0},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeography:Label",title:"Human Geography Label",isReference:!0}]},"arcgis-human-geography-dark":{title:"Human Geography (Dark)",baseMapLayers:[{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeographyDark:Base",title:"Human Geography Dark Base"},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeographyDark:Detail",title:"Human Geography Dark Detail",isReference:!0},{layerType:"VectorTileLayer",styleUrl:"https://basemaps-api.arcgis.com/arcgis/rest/services/styles/ArcGIS:HumanGeographyDark:Label",title:"Human Geography Dark Label",isReference:!0}]}},aut=new Set(["ar","bs","ca","hr","cs","da","nl","en","et","fi","fr","de","el","he","hu","id","it","ja","ko","lv","lt","nb","pl","ro","ru","sr","es","sv","th","tr","uk","vi"]);let RA=class extends ze{constructor(e){super(e),this.id=null,this.language=null,this.serviceUrl="https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/webmaps"}getLanguageParamValue(){if(this.language)return this.language;const e=ma().toLowerCase();switch(e){case"pt-br":return"pt-BR";case"pt-pt":return"pt-PT";case"zh-cn":return"zh-CN";case"zh-hk":return"zh-HK";case"zh-tw":return"zh-TW"}const i=bse(e);return i==="pt"?"pt-BR":i&&aut.has(i)?i:"global"}};y([w()],RA.prototype,"id",void 0),y([w()],RA.prototype,"language",void 0),y([w()],RA.prototype,"serviceUrl",void 0),RA=y([Z("esri.support.BasemapStyle")],RA);const lut=RA;var KI;let cut=0;const uut="esri.Basemap";let Dd=KI=class extends F_(Wf){constructor(t){super(t),this.id=null,this.portalItem=null,this.spatialReference=null,this.style=null,this.thumbnailUrl=null,this.title="Basemap",this.id=Date.now().toString(16)+"-basemap-"+cut++,this.baseLayers=new tt,this.referenceLayers=new tt;const e=r=>{r.parent&&r.parent!==this&&"remove"in r.parent&&r.parent.remove(r),r.parent=this,r.type==="elevation"&&Ce.getLogger(this).error(`Layer '${r.title}, id:${r.id}' of type '${r.type}' is not supported as a basemap layer and will therefore be ignored.`)},i=r=>{r.parent=null};this.addHandles([this.baseLayers.on("after-add",r=>e(r.item)),this.referenceLayers.on("after-add",r=>e(r.item)),this.baseLayers.on("after-remove",r=>i(r.item)),this.referenceLayers.on("after-remove",r=>i(r.item))])}initialize(){this.when().catch(t=>{Ce.getLogger(this).error("#load()",`Failed to load basemap (title: '${this.title}', id: '${this.id}')`,t)}),this.resourceInfo&&this.read(this.resourceInfo.data,this.resourceInfo.context)}destroy(){const t=this.baseLayers.toArray();for(const i of t)i.destroy();const e=this.referenceLayers.toArray();for(const i of e)i.destroy();this.baseLayers.destroy(),this.referenceLayers.destroy(),this.portalItem=et(this.portalItem)}normalizeCtorArgs(t){return t&&"resourceInfo"in t&&(this._set("resourceInfo",t.resourceInfo),delete(t={...t}).resourceInfo),t}set baseLayers(t){this._set("baseLayers",od(t,this._get("baseLayers")))}_writeBaseLayers(t,e,i){const r=[];t&&(i={...i,layerContainerType:"basemap"},this.baseLayers.forEach(n=>{const s=zQ(n,i.webmap?i.webmap.getLayerJSONFromResourceInfo(n):null,i);s!=null&&r.push(s)}),this.referenceLayers.forEach(n=>{const s=zQ(n,i.webmap?i.webmap.getLayerJSONFromResourceInfo(n):null,i);s!=null&&(n.type!=="scene"&&(s.isReference=!0),r.push(s))})),e.baseMapLayers=r}set referenceLayers(t){this._set("referenceLayers",od(t,this._get("referenceLayers")))}writeTitle(t,e){e.title=t||"Basemap"}load(t){return this.addResolvingPromise(this._loadFromSource(t)),Promise.resolve(this)}loadAll(){return bj(this,t=>{t(this.baseLayers,this.referenceLayers)})}clone(){const t={id:this.id,title:this.title,portalItem:this.portalItem,baseLayers:this.baseLayers.map(e=>Kk(e)?e.clone():e),referenceLayers:this.referenceLayers.map(e=>Kk(e)?e.clone():e)};return this.loaded&&(t.loadStatus="loaded"),new KI({resourceInfo:this.resourceInfo}).set(t)}read(t,e){this.resourceInfo||this._set("resourceInfo",{data:t,context:e}),super.read(t,e)}write(t,e){var i;return t=t||{},e!=null&&e.origin||(e={origin:"web-map",...e}),super.write(t,e),!this.loaded&&((i=this.resourceInfo)!=null&&i.data.baseMapLayers)&&(t.baseMapLayers=this.resourceInfo.data.baseMapLayers.map(r=>{const n=Pe(r);return n.url&&qy(n.url)&&(n.url=`https:${n.url}`),n.templateUrl&&qy(n.templateUrl)&&(n.templateUrl=`https:${n.templateUrl}`),n})),t}async _loadFromSource(t){const{resourceInfo:e,portalItem:i,style:r}=this;St(t);const n=[];if(e){const s=e.context?e.context.url:null;if(n.push(this._loadLayersFromJSON(e.data,s,t)),e.data.id&&!e.data.title){const o=e.data.id;n.push(out(o).then(a=>{a&&this.read({title:a},e.context)}))}}else i?n.push(this._loadFromItem(i,t)):r&&n.push(this._loadFromStylesService(r,t));await Promise.all(n)}async _loadLayersFromJSON(t,e,i){var c,p;const r=(c=this.resourceInfo)==null?void 0:c.context,n=((p=this.portalItem)==null?void 0:p.portal)||(r==null?void 0:r.portal)||null,s=dut[(r==null?void 0:r.origin)||""]??"web-map",{populateOperationalLayers:o}=await we(()=>import("./layersCreator-kgscMbpL.js"),__vite__mapDeps([9,0,1])),a=[];if(St(i),t.baseMapLayers&&Array.isArray(t.baseMapLayers)){const _={context:{...r,origin:s,url:e,portal:n,layerContainerType:"basemap"},defaultLayerType:"DefaultTileLayer"},x=M=>s==="web-scene"&&M.layerType==="ArcGISSceneServiceLayer"||M.isReference,S=o(this.baseLayers,t.baseMapLayers.filter(M=>!x(M)),_);a.push(S);const C=o(this.referenceLayers,t.baseMapLayers.filter(x),_);a.push(C)}await Promise.allSettled(a)}async _loadFromItem(t,e){const i=await t.load(e),r=await i.fetchData("json",e),n=Is(t.itemUrl??"");return this._set("resourceInfo",{data:r.baseMap??{},context:{origin:hut[t.type||""]??"web-map",portal:t.portal||os.getDefault(),url:n}}),this.read(this.resourceInfo.data,this.resourceInfo.context),this.read({spatialReference:r.spatialReference},this.resourceInfo.context),this.read({title:t.title,thumbnailUrl:t.thumbnailUrl},{origin:"portal-item",portal:t.portal||os.getDefault(),url:n}),this._loadLayersFromJSON(this.resourceInfo.data,n,e)}async _loadFromStylesService(t,e){var s;const i=`${t.serviceUrl}/${t.id}`,r=(await yi(i,{query:{language:t.getLanguageParamValue()},signal:e==null?void 0:e.signal})).data;if(r.baseMap&&Array.isArray(r.baseMap.baseMapLayers)){for(const o of r.baseMap.baseMapLayers)if(!o.customParameters&&((s=o.styleUrl)!=null&&s.includes("?"))){const a=Is(o.styleUrl);a.query&&(o.styleUrl=a.path,o.customParameters=a.query)}}const n=Is(i);return this._set("resourceInfo",{data:r.baseMap??{},context:{origin:"web-map",url:n}}),this.read(this.resourceInfo.data,this.resourceInfo.context),this.read({spatialReference:r.spatialReference},this.resourceInfo.context),this._loadLayersFromJSON(this.resourceInfo.data,n,e)}static fromId(t){const e=_P[t];return e?e.itemId?new KI({portalItem:{id:e.itemId,portal:{url:"https://www.arcgis.com"}}}):KI.fromJSON(e,{origin:e.is3d?"web-scene":"web-map"}):null}};y([w({json:{write:{ignoreOrigin:!0,target:"baseMapLayers",writer(t,e,i,r){this._writeBaseLayers(t,e,r)}},origins:{"web-scene":{write:{ignoreOrigin:!0,target:{baseMapLayers:{type:tt}},writer(t,e,i,r){this._writeBaseLayers(t,e,r)}}}}}})],Dd.prototype,"baseLayers",null),y([w({type:String,json:{origins:{"web-scene":{write:!0}}}})],Dd.prototype,"id",void 0),y([w({type:Om})],Dd.prototype,"portalItem",void 0),y([w()],Dd.prototype,"referenceLayers",null),y([w({readOnly:!0})],Dd.prototype,"resourceInfo",void 0),y([w({type:rt})],Dd.prototype,"spatialReference",void 0),y([w({type:lut})],Dd.prototype,"style",void 0),y([w()],Dd.prototype,"thumbnailUrl",void 0),y([w({type:String,json:{origins:{"web-scene":{write:{isRequired:!0}}}}})],Dd.prototype,"title",void 0),y([Et("title")],Dd.prototype,"writeTitle",null),Dd=KI=y([Z(uut)],Dd);const hut={"Web Scene":"web-scene","Web Map":"web-map","Link Chart":"link-chart"},dut={"web-scene":"web-scene","web-map":"web-map","link-chart":"link-chart"},$y=Dd,put=Object.freeze(Object.defineProperty({__proto__:null,default:$y},Symbol.toStringTag,{value:"Module"}));var UQ;let CF=UQ=class extends Ue{constructor(t){super(t),this.type="none"}clone(){return new UQ({type:this.type})}};y([Vt({none:"none",stayAbove:"stay-above"})],CF.prototype,"type",void 0),CF=UQ=y([Z("esri.ground.NavigationConstraint")],CF);var VQ;let sv=VQ=class extends F_(Wf){constructor(t){super(t),this.opacity=1,this.surfaceColor=null,this.navigationConstraint=null,this.layers=new tt;const e=r=>{r.parent&&r.parent!==this&&"remove"in r.parent&&r.parent.remove(r),r.parent=this,r.type!=="elevation"&&r.type!=="base-elevation"&&Ce.getLogger(this).error(`Layer '${r.title}, id:${r.id}' of type '${r.type}' is not supported as a ground layer and will therefore be ignored. Only layers of type 'elevation' are supported.`)},i=r=>{r.parent=null};this.addHandles([this.layers.on("after-add",r=>e(r.item)),this.layers.on("after-remove",r=>i(r.item))])}initialize(){this.when().catch(t=>{on(t)||Ce.getLogger(this).error("#load()","Failed to load ground",t)}),this.resourceInfo&&this.read(this.resourceInfo.data,this.resourceInfo.context)}destroy(){const t=this.layers.removeAll();for(const e of t)et(e);this.layers.destroy()}normalizeCtorArgs(t){return t&&"resourceInfo"in t&&(this._set("resourceInfo",t.resourceInfo),delete(t={...t}).resourceInfo),t}set layers(t){this._set("layers",od(t,this._get("layers")))}writeLayers(t,e,i,r){const n=[];t&&(r={...r,layerContainerType:"ground"},t.forEach(s=>{if("write"in s){const o={};oit(s)().write(o,r)&&n.push(o)}else r!=null&&r.messages&&r.messages.push(new se("layer:unsupported",`Layers (${s.title}, ${s.id}) of type '${s.declaredClass}' cannot be persisted in the ground`,{layer:s}))})),e.layers=n}load(t){return this.addResolvingPromise(this._loadFromSource(t)),Promise.resolve(this)}loadAll(){return bj(this,t=>{t(this.layers)})}async queryElevation(t,e){await this.load({signal:e==null?void 0:e.signal});const{ElevationQuery:i}=await we(()=>Promise.resolve().then(()=>ZV),void 0);St(e);const r=new i,n=this.layers.filter(Wfe).toArray();return r.queryAll(n,t,e)}async createElevationSampler(t,e){await this.load({signal:e==null?void 0:e.signal});const{ElevationQuery:i}=await we(()=>Promise.resolve().then(()=>ZV),void 0);St(e);const r=new i,n=this.layers.filter(Wfe).toArray();return r.createSamplerAll(n,t,e)}clone(){const t={opacity:this.opacity,surfaceColor:Pe(this.surfaceColor),navigationConstraint:Pe(this.navigationConstraint),layers:this.layers.slice()};return this.loaded&&(t.loadStatus="loaded"),new VQ({resourceInfo:this.resourceInfo}).set(t)}read(t,e){this.resourceInfo||this._set("resourceInfo",{data:t,context:e}),super.read(t,e)}_loadFromSource(t){const e=this.resourceInfo;return e?this._loadLayersFromJSON(e.data,e.context,t):Promise.resolve()}async _loadLayersFromJSON(t,e,i){const r=(e==null?void 0:e.origin)||"web-scene",n=(e==null?void 0:e.portal)||null,s=(e==null?void 0:e.url)||null,{populateOperationalLayers:o}=await we(()=>import("./layersCreator-kgscMbpL.js"),__vite__mapDeps([9,0,1]));St(i);const a=[];if(t.layers&&Array.isArray(t.layers)){const c={context:{origin:r,url:s,portal:n,layerContainerType:"ground"},defaultLayerType:"ArcGISTiledElevationServiceLayer"};a.push(o(this.layers,t.layers,c))}await Promise.allSettled(a)}};function fut(t){return t&&"createElevationSampler"in t}function Wfe(t){return t.type==="elevation"||fut(t)}y([w({json:{read:!1}})],sv.prototype,"layers",null),y([Et("layers")],sv.prototype,"writeLayers",null),y([w({readOnly:!0})],sv.prototype,"resourceInfo",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{type:_n,read:{reader:WT,source:"transparency"},write:{writer:(t,e)=>{e.transparency=zB(t)},target:"transparency"}}})],sv.prototype,"opacity",void 0),y([w({type:qe,json:{type:[_n],write:(t,e)=>{e.surfaceColor=t.toJSON().slice(0,3)}}})],sv.prototype,"surfaceColor",void 0),y([w({type:CF,json:{write:!0}})],sv.prototype,"navigationConstraint",void 0),sv=VQ=y([Z("esri.Ground")],sv);const bP=sv,mut=[["binary","application/octet-stream","bin",""]];function tti(t,e){return dRe(e.name,(t==null?void 0:t.supportedFormats)??[])!=null}function iti(t,e){if(!t)return!1;const i=gut(e,t.supportedFormats??[]);return i!=null&&t.editFormats.includes(i)}function uRe(t,e){return Qoe(vut(t,e))}function hRe(t,e){return Qoe(dRe(t,e))}function rti(t,e){return pRe(yut(t,e))}function gut(t,e){return hRe(t.name,e)??uRe(t.type,e)}function Koe(t){return[...mut,...t]}function yut(t,e){return Koe(e).find(i=>Qoe(i)===t)}function vut(t,e){const i=t.toLowerCase();return Koe(e).find(r=>pRe(r)===i)}function dRe(t,e){const i=t.toLowerCase();return Koe(e).find(r=>_ut(r).some(n=>i.endsWith(n)))}function Qoe(t){return t==null?void 0:t[0]}function pRe(t){return t==null?void 0:t[1].toLowerCase()}function _ut(t){return(t==null?void 0:t[2].split(",").map(e=>e.toLowerCase()))??[]}function nti(t){var e;return(e=t.tables)==null?void 0:e.find(i=>i.role==="assetMaps")}function but(t){var e,i;return!(!(t&&typeof t=="object"&&"loaded"in t&&t.loaded&&((i=(e=Mit(t))==null?void 0:e.operations)!=null&&i.supportsEditing)&&"type"in t)||"editingEnabled"in t&&!Pit(t)||t.type==="scene"&&!wut(t))}function wut(t){const{associatedLayer:e}=t,i=e==null?void 0:e.infoFor3D;if(!i)return!0;const{supportedFormats:r,queryFormats:n}=i,s=uRe("model/gltf-binary",r)??hRe("glb",r);if(!(s!=null&&n.includes(s)))return Ce.getLogger("esri.layers.support.editableLayers").warnOnce(`SceneLayer (${t.title??"Untitled layer"}, ${t.id}) is not editable because it does not support GLB queries.`),!1;const o=t.spatialReference,a=e.spatialReference;if(!jn(o,a))return Ce.getLogger("esri.layers.support.editableLayers").warnOnce(`SceneLayer (${t.title??"Untitled layer"}, ${t.id}) is not editable because its spatial reference (wkid:${o.wkid}) is different from its associated FeatureLayer's spatial reference (wkid:${a.wkid}).`),!1;const c=e.sourceJSON.sourceSpatialReference;return!(c!=null&&!jn(c,a))||(Ce.getLogger("esri.layers.support.editableLayers").warnOnce(`SceneLayer (${t.title??"Untitled layer"}, ${t.id}) is not editable because the spatial reference of its associated FeatureLayer's service (wkid:${a.wkid}) is different from its source spatial reference (wkid:${c.wkid}).`),!1)}const Yfe=Ce.getLogger("esri.support.basemapUtils");function xut(){return{}}function Sut(t){for(const e in t){const i=t[e];et(i),delete t[e]}}function eae(t,e){let i;if(typeof t=="string"){const r=t in _P,n=!r&&t.includes("/");if(!r&&!n){const s=Object.entries(_P).filter(([o,a])=>Mr.apiKey&&!a.classic||!Mr.apiKey&&(a.classic||a.is3d)).map(([o])=>`"${o}"`).sort().join(", ");return Yfe.warn(`Unable to find basemap definition for: ${t}. Try one of these: ${s}`),null}e&&(i=e[t]),i||(i=r?$y.fromId(t):new $y({style:{id:t}}),e&&(e[t]=i))}else i=_s($y,t);return i!=null&&i.destroyed&&(Yfe.warn("The provided basemap is already destroyed",{basemap:i}),i=null),i}function Tut(t){var e;return((e=t.portalItem)==null?void 0:e.type)==="Web Scene"}function Eut(t){var e,i;return!!((i=(e=t==null?void 0:t.portalItem)==null?void 0:e.tags)!=null&&i.some(r=>r.toLowerCase()==="beta"))}function sti(t,e){var i,r,n,s;return((r=(i=t.basemap)==null?void 0:i.referenceLayers)==null?void 0:r.some(o=>o.uid===e))||((s=(n=t.basemap)==null?void 0:n.baseLayers)==null?void 0:s.some(o=>o.uid===e))}function Cut(t,e=null){const i=eae(t);if(!i)return null;const r=i.clone();return e&&(r.baseLayers=Xfe(r.baseLayers,e.baseLayers),r.referenceLayers=Xfe(r.referenceLayers,e.referenceLayers)),r}function Aut(t){let e=null;const i=BQ(t),r=!(i!=null&&i.baseLayers.length);for(const n in _P){const s=mRe(i,fRe(_P[n]),{mustMatchReferences:r});if(s==="equal"){e=n;break}s==="base-layers-equal"&&(e=n)}return e}function Mut(t,e){var i,r;return t===e||((i=t==null?void 0:t.portalItem)==null?void 0:i.id)!=null&&t.portalItem.id===((r=e==null?void 0:e.portalItem)==null?void 0:r.id)?!0:mRe(BQ(t),BQ(e),{mustMatchReferences:!0})==="equal"}function Xfe(t,e){const i=new tt;return t.forEach(r=>{const n=e.find(s=>s.type!=="scene"&&gRe(jQ(r),jQ(s)))||r;i.includes(n)?i.push(r):i.push(n)}),i}function Zfe(t){return!!(t!=null&&t.baseLayers.concat(t.referenceLayers).some(Out))}function Out(t){if(Jfe(t.url))return!0;if(t.type==="vector-tile")for(const e in t.sourceNameToSource){const i=t.sourceNameToSource[e];if(Jfe(i==null?void 0:i.sourceUrl))return!0}return!1}function Put(t,e){var s;if(e==null||t==null)return{spatialReference:null,updating:!1};if(e.loadStatus==="not-loaded")return e.load(),{spatialReference:null,updating:!0};if(e.spatialReference)return{spatialReference:e.spatialReference,updating:!1};if(e.baseLayers.length===0)return{spatialReference:null,updating:!1};const i=e.baseLayers.at(0);switch(i.loadStatus){case"not-loaded":i.load();case"loading":return{spatialReference:null,updating:!0};case"failed":return{spatialReference:null,updating:!1}}const r=(("supportedSpatialReferences"in i?i.supportedSpatialReferences:null)||["tileInfo"in i?(s=i.tileInfo)==null?void 0:s.spatialReference:i.spatialReference]).filter(Boolean),n=t.spatialReference;return n?{spatialReference:r.find(o=>n.equals(o))??r[0]??null,updating:!1}:{spatialReference:r[0],updating:!1}}const Rut=/^(basemaps|ibasemaps).*-api\.arcgis\.com$/i;function Jfe(t){if(!t)return!1;const e=new w2(Wh(t));return!!e.authority&&Rut.test(e.authority)}function BQ(t){return t?!t.loaded&&t.resourceInfo?fRe(t.resourceInfo.data):{baseLayers:Kfe(t.baseLayers),referenceLayers:Kfe(t.referenceLayers)}:null}function Kfe(t){return(tt.isCollection(t)?t.toArray():t).map(jQ)}function jQ(t){var e,i;return{type:t.type,effect:"effect"in t?t.effect:void 0,url:yRe("urlTemplate"in t&&t.urlTemplate||t.url||"styleUrl"in t&&t.styleUrl||""),minScale:"minScale"in t&&t.minScale!=null?t.minScale:0,maxScale:"maxScale"in t&&t.maxScale!=null?t.maxScale:0,opacity:t.opacity!=null?t.opacity:1,visible:t.visible==null||!!t.visible,sublayers:t.type!=="map-image"&&t.type!=="wms"||t.sublayers==null||(e=t.sublayers)==null?void 0:e.map(r=>({id:r.id,visible:r.visible})),activeLayerId:t.type==="wmts"?(i=t.activeLayer)==null?void 0:i.id:void 0}}function Qfe(t){return t.isReference||t.layerType==="ArcGISSceneServiceLayer"}function fRe(t){return t?{baseLayers:e0e((t.baseMapLayers??[]).filter(e=>!Qfe(e))),referenceLayers:e0e((t.baseMapLayers??[]).filter(e=>Qfe(e)))}:null}function e0e(t){return t.map(e=>Iut(e))}function Iut(t){let e;switch(t.layerType){case"VectorTileLayer":e="vector-tile";break;case"ArcGISTiledMapServiceLayer":e="tile";break;case"ArcGISSceneServiceLayer":e="scene";break;default:e="unknown"}return{type:e,effect:t.effect,url:yRe(t.templateUrl||t.urlTemplate||t.styleUrl||t.url),minScale:t.minScale??0,maxScale:t.maxScale??0,opacity:t.opacity??1,visible:t.visibility==null||!!t.visibility,sublayers:void 0,activeLayerId:void 0}}function mRe(t,e,i){return t!=null!=(e!=null)?"not-equal":!t||!e?"equal":t0e(t.baseLayers,e.baseLayers)?t0e(t.referenceLayers,e.referenceLayers)?"equal":i.mustMatchReferences?"not-equal":"base-layers-equal":"not-equal"}function t0e(t,e){if(t.length!==e.length)return!1;for(let i=0;i{var i,r,n;return[(i=this.basemap)==null?void 0:i.baseLayers,(r=this.ground)==null?void 0:r.layers,this.layers,(n=this.basemap)==null?void 0:n.referenceLayers]},getChildrenFunction:i=>"layers"in i?i.layers:null}),this.allTables=sRe(this),this.basemap=null,this.editableLayers=new YT({getCollections:()=>[this.allLayers],itemFilterFunction:but}),this.ground=new bP,this._basemapCache=xut()}destroy(){Sut(this._basemapCache),this._basemapCache=null,this.allLayers.destroy(),this.allTables.destroy(),this.editableLayers.destroy(),this.basemap=et(this.basemap),et(this.ground),this._set("ground",null)}castBasemap(e){return eae(e,this._basemapCache)}castGround(e){return Dut(e)??this._get("ground")}findLayerById(e){return this.allLayers.find(i=>i.id===e)}findTableById(e){return this.allTables.find(i=>i.id===e)}};y([w({readOnly:!0,dependsOn:[]})],Rg.prototype,"allLayers",void 0),y([w({readOnly:!0})],Rg.prototype,"allTables",void 0),y([w({type:$y,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],Rg.prototype,"basemap",void 0),y([Ci("basemap")],Rg.prototype,"castBasemap",null),y([w({readOnly:!0})],Rg.prototype,"editableLayers",void 0),y([w({type:bP,nonNullable:!0})],Rg.prototype,"ground",void 0),y([Ci("ground")],Rg.prototype,"castGround",null),Rg=y([Z("esri.Map")],Rg);const vRe=Rg;let B2=class{constructor(e,i){this.min=e,this.max=i,this.range=i-e}ndiff(e,i=0){return Math.ceil((e-i)/this.range)*this.range+i}_normalize(e,i,r,n=0,s=!1){return(r-=n)i&&(r-=this.ndiff(r-i)),s&&r===i&&(r=e),r+n}normalize(e,i=0,r=!1){return this._normalize(this.min,this.max,e,i,r)}clamp(e,i=0){return Je(e-i,this.min,this.max)+i}monotonic(e,i,r){return ee&&rwP.normalize(Gh(t)))],ov.prototype,"heading",void 0),y([w({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),Ci(t=>Je(Gh(t),-180,180))],ov.prototype,"tilt",void 0),y([w({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],ov.prototype,"fov",void 0),ov=y([Z("esri.Camera")],ov);const pd=ov;var GQ;let ow=GQ=class extends Ue{constructor(t){super(t),this.rotation=0,this.scale=0,this.targetGeometry=null,this.camera=null}castRotation(t){return(t%=360)<0&&(t+=360),t}clone(){return new GQ({rotation:this.rotation,scale:this.scale,targetGeometry:this.targetGeometry!=null?this.targetGeometry.clone():null,camera:this.camera!=null?this.camera.clone():null})}};function iq(){return{enabled:!this.camera}}y([w({type:Number,json:{write:!0,origins:{"web-map":{default:0,write:!0},"web-scene":{write:{overridePolicy:iq}}}}})],ow.prototype,"rotation",void 0),y([Ci("rotation")],ow.prototype,"castRotation",null),y([w({type:Number,json:{write:!0,origins:{"web-map":{default:0,write:!0},"web-scene":{write:{overridePolicy:iq}}}}})],ow.prototype,"scale",void 0),y([w({types:dE,json:{read:Wy,write:!0,origins:{"web-scene":{read:Wy,write:{overridePolicy:iq}}}}})],ow.prototype,"targetGeometry",void 0),y([w({type:pd,json:{write:!0}})],ow.prototype,"camera",void 0),ow=GQ=y([Z("esri.Viewpoint")],ow);const nh=ow;function Fut(t,e){if(!t)return null;if(!HQ(t))return new se("webscene:unsupported-height-model-info","The vertical coordinate system of the scene is not supported",{heightModelInfo:t});const i=t.heightUnit,r=B_.deriveUnitFromSR(t,e).heightUnit;return i!==r?new se("webscene:incompatible-height-unit",`The vertical units of the scene (${i}) must match the horizontal units of the scene (${r})`,{verticalUnit:i,horizontalUnit:r}):null}function cti(t,e,i){const r=_Re(t),n=e,s=kut(r,n,i);if(r){const o=B_.deriveUnitFromSR(r,t.spatialReference).heightUnit;if(!i&&o!==r.heightUnit){const a=new se("layerview:unmatched-height-unit",`The vertical units of the layer must match the horizontal units (${o})`,{horizontalUnit:o});return new se("layerview:unsupported-height-model-info","The vertical coordinate system of the layer is not supported",{heightModelInfo:r,error:a})}}if(!zut(t)||s===Fh.Unsupported)return new se("layerview:unsupported-height-model-info","The vertical coordinate system of the layer is not supported",{heightModelInfo:r});switch(s){case Fh.Units:{const o=(r==null?void 0:r.heightUnit)||"unknown",a=(n==null?void 0:n.heightUnit)||"unknown",c=new se("layerview:incompatible-height-unit",`The vertical units of the layer (${o}) must match the vertical units of the scene (${a})`,{layerUnit:o,sceneUnit:a});return new se("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:r,sceneHeightModelInfo:n,error:c})}case Fh.HeightModel:{const o=(r==null?void 0:r.heightModel)||"unknown",a=(n==null?void 0:n.heightModel)||"unknown",c=new se("layerview:incompatible-height-model",`The height model of the layer (${o}) must match the height model of the scene (${a})`,{layerHeightModel:o,sceneHeightModel:a});return new se("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:r,sceneHeightModelInfo:n,error:c})}case Fh.CRS:{const o=(r==null?void 0:r.vertCRS)||"unknown",a=(n==null?void 0:n.vertCRS)||"unknown",c=new se("layerview:incompatible-vertical-datum",`The vertical datum of the layer (${o}) must match the vertical datum of the scene (${a})`,{layerDatum:o,sceneDatum:a});return new se("layerview:incompatible-height-model-info","The vertical coordinate system of the layer is incompatible with the scene",{layerHeightModelInfo:r,sceneHeightModelInfo:n,error:c})}}return null}function kut(t,e,i){if(!HQ(t)||!HQ(e))return Fh.Unsupported;if(t==null||e==null)return Fh.Ok;if(!i&&t.heightUnit!==e.heightUnit)return Fh.Units;if(t.heightModel!==e.heightModel)return Fh.HeightModel;switch(t.heightModel){case"gravity-related-height":return Fh.Ok;case"ellipsoidal":return t.vertCRS===e.vertCRS?Fh.Ok:Fh.CRS;default:return Fh.Unsupported}}var Fh;function HQ(t){return t==null||t.heightModel!=null&&t.heightUnit!=null}function zut(t){return"heightModelInfo"in t&&t.heightModelInfo!=null||t.spatialReference!=null||!xRe(t)}function _Re(t){var r;const e=t.url?TE(t.url):void 0;return!(((r=t.spatialReference)==null?void 0:r.vcsWkid)==null&&e!=null&&e.serverType==="ImageServer")&&bRe(t)&&t.heightModelInfo?t.heightModelInfo:xRe(t)?B_.deriveUnitFromSR(Vut,t.spatialReference):null}function bRe(t){return"heightModelInfo"in t}function wRe(t){if(t.type==="unknown"||!("capabilities"in t))return!1;switch(t.type){case"csv":case"feature":case"geojson":case"subtype-group":case"ogc-feature":case"oriented-imagery":case"wfs":case"knowledge-graph-sublayer":return!0;default:return!1}}function xRe(t){return wRe(t)?!!(t.capabilities&&t.capabilities.data&&t.capabilities.data.supportsZ):SRe(t)}function Uut(t){return t.layers!=null||SRe(t)||wRe(t)||bRe(t)}function SRe(t){switch(t.type){case"building-scene":case"elevation":case"integrated-mesh":case"point-cloud":case"scene":case"voxel":return!0;case"base-dynamic":case"base-elevation":case"base-tile":case"bing-maps":case"csv":case"dimension":case"geojson":case"feature":case"subtype-group":case"geo-rss":case"graphics":case"group":case"imagery":case"imagery-tile":case"kml":case"knowledge-graph":case"link-chart":case"knowledge-graph-sublayer":case"line-of-sight":case"map-image":case"map-notes":case"media":case"ogc-feature":case"open-street-map":case"oriented-imagery":case"route":case"stream":case"tile":case"unknown":case"unsupported":case"vector-tile":case"video":case"wcs":case"web-tile":case"wfs":case"wms":case"wmts":case null:return!1}return!1}(function(t){t[t.Ok=0]="Ok",t[t.Units=1]="Units",t[t.HeightModel=2]="HeightModel",t[t.CRS=3]="CRS",t[t.Unsupported=4]="Unsupported"})(Fh||(Fh={}));const Vut=new B_({heightModel:"gravity-related-height"});let aw=class extends Ue{constructor(e){super(e),this.facilityIdField=null,this.layerId=null,this.nameField=null,this.siteIdField=null,this.sublayerId=null}};y([w({type:String,json:{write:!0}})],aw.prototype,"facilityIdField",void 0),y([w({type:String,json:{write:!0}})],aw.prototype,"layerId",void 0),y([w({type:String,json:{write:!0}})],aw.prototype,"nameField",void 0),y([w({type:String,json:{write:!0}})],aw.prototype,"siteIdField",void 0),y([w({type:Number,json:{read:{source:"subLayerId"},write:{target:"subLayerId"},origins:{"web-scene":{read:!1,write:!1}}}})],aw.prototype,"sublayerId",void 0),aw=y([Z("esri.layers.support.FacilityLayerInfo")],aw);const But=aw;let k0=class extends Ue{constructor(e){super(e),this.facilityIdField=null,this.layerId=null,this.levelIdField=null,this.levelNumberField=null,this.longNameField=null,this.shortNameField=null,this.sublayerId=null,this.verticalOrderField=null}};y([w({type:String,json:{write:!0}})],k0.prototype,"facilityIdField",void 0),y([w({type:String,json:{write:!0}})],k0.prototype,"layerId",void 0),y([w({type:String,json:{write:!0}})],k0.prototype,"levelIdField",void 0),y([w({type:String,json:{write:!0}})],k0.prototype,"levelNumberField",void 0),y([w({type:String,json:{write:!0}})],k0.prototype,"longNameField",void 0),y([w({type:String,json:{write:!0}})],k0.prototype,"shortNameField",void 0),y([w({type:Number,json:{read:{source:"subLayerId"},write:{target:"subLayerId"},origins:{"web-scene":{read:!1,write:!1}}}})],k0.prototype,"sublayerId",void 0),y([w({type:String,json:{write:!0}})],k0.prototype,"verticalOrderField",void 0),k0=y([Z("esri.layers.support.LevelLayerInfo")],k0);const jut=k0;let W3=class extends Ue{constructor(e){super(e),this.layerId=null,this.nameField=null,this.siteIdField=null,this.sublayerId=null}};y([w({type:String,json:{write:!0}})],W3.prototype,"layerId",void 0),y([w({type:String,json:{write:!0}})],W3.prototype,"nameField",void 0),y([w({type:String,json:{write:!0}})],W3.prototype,"siteIdField",void 0),y([w({type:Number,json:{read:{source:"subLayerId"},write:{target:"subLayerId"},origins:{"web-scene":{read:!1,write:!1}}}})],W3.prototype,"sublayerId",void 0),W3=y([Z("esri.layers.support.SiteLayerInfo")],W3);const Gut=W3;let IA=class extends Ue{constructor(e){super(e),this.levelLayer=null,this.facilityLayer=null,this.siteLayer=null}};y([w({type:jut,json:{write:!0}})],IA.prototype,"levelLayer",void 0),y([w({type:But,json:{write:!0}})],IA.prototype,"facilityLayer",void 0),y([w({type:Gut,json:{write:!0}})],IA.prototype,"siteLayer",void 0),IA=y([Z("esri.support.MapFloorInfo")],IA);const Hut=IA,qut="webscene:failed-to-copy-embedded-resources",Wut="webscene:schema-validation";function Yut(){return new se(qut,"Copying of embedded resources is currently not supported")}function Xut(t){return new se(Wut,"Failed to save webscene due to schema validation errors. See 'details.errors' for more detailed information",{errors:t})}function xP(t,e){return t!=null&&(e==null||(e===_t.Local?!t.isGeographic||t.isWGS84||t.wkid===Cf.CGCS2000:t.isWebMercator||t.isWGS84||t.wkid===Cf.CGCS2000||t.wkid===Cf.GCSMARS2000||t.wkid===Cf.GCSMARS2000_SPHERE||t.wkid===Cf.GCSMOON2000))}const Zut={width:600,height:400},AD=1.5;function Jut(t,e){e=e||Zut;let{width:i,height:r}=e;const n=i/r;return nAD&&(i=r*AD),i>t.width&&(r*=t.width/i,i=t.width),r>t.height&&(i*=t.height/r,r=t.height),{width:Math.round(i),height:Math.round(r)}}function r0e(t){return{enabled:!!(t!=null&&t.length)}}var qQ;let $A=qQ=class extends Ue{constructor(t){super(t),this.exactMatch=!1,this.name=null,this.type=null}clone(){return new qQ({exactMatch:this.exactMatch,type:this.type,name:this.name})}};y([w({type:Boolean,json:{write:!0}})],$A.prototype,"exactMatch",void 0),y([w({type:String,json:{write:!0}})],$A.prototype,"name",void 0),y([Vt(Eoe)],$A.prototype,"type",void 0),$A=qQ=y([Z("esri.webdoc.applicationProperties.SearchLayerField")],$A);const Kut=$A;var WQ;let LA=WQ=class extends Ue{constructor(t){super(t),this.field=null,this.id=null,this.subLayer=null}clone(){return new WQ(Pe({field:this.field,id:this.id,subLayer:this.subLayer}))}};y([w({type:Kut,json:{write:{isRequired:!0}}})],LA.prototype,"field",void 0),y([w({type:String,json:{write:{isRequired:!0}}})],LA.prototype,"id",void 0),y([w({type:_n,json:{write:!0}})],LA.prototype,"subLayer",void 0),LA=WQ=y([Z("esri.webdoc.applicationProperties.SearchLayer")],LA);const Qut=LA;var YQ;let DA=YQ=class extends Ue{constructor(t){super(t),this.exactMatch=!1,this.name=null,this.type=null}clone(){return new YQ({exactMatch:this.exactMatch,type:this.type,name:this.name})}};y([w({type:Boolean,json:{write:!0}})],DA.prototype,"exactMatch",void 0),y([w({type:String,json:{write:!0}})],DA.prototype,"name",void 0),y([Vt(Eoe)],DA.prototype,"type",void 0),DA=YQ=y([Z("esri.webdoc.applicationProperties.SearchTableField")],DA);const eht=DA;var XQ;let QI=XQ=class extends Ue{constructor(t){super(t),this.field=null,this.id=null}clone(){return new XQ(Pe({field:this.field,id:this.id}))}};y([w({type:eht,json:{write:{isRequired:!0}}})],QI.prototype,"field",void 0),y([w({type:String,json:{write:{isRequired:!0}}})],QI.prototype,"id",void 0),QI=XQ=y([Z("esri.webdoc.applicationProperties.SearchTable")],QI);const tht=QI;var ZQ;const TRe=tt.ofType(Qut),ERe=tt.ofType(tht);let Ig=ZQ=class extends Ue{constructor(t){super(t),this.addressSearchEnabled=!0,this.enabled=!0,this.hintText=null,this.layers=new TRe,this.tables=new ERe}readAddressSearchEnabled(t){return!t}writeAddressSearchEnabled(t,e,i){e[i]=!t}clone(){return new ZQ(Pe({addressSearchEnabled:this.addressSearchEnabled,enabled:this.enabled,hintText:this.hintText,layers:this.layers,tables:this.tables}))}};y([w({type:Boolean,nonNullable:!0,json:{read:{source:"disablePlaceFinder"},write:{target:"disablePlaceFinder",isRequired:!0},origins:{"web-scene":{read:!1,write:!1}}}})],Ig.prototype,"addressSearchEnabled",void 0),y([Rt("addressSearchEnabled")],Ig.prototype,"readAddressSearchEnabled",null),y([Et("addressSearchEnabled")],Ig.prototype,"writeAddressSearchEnabled",null),y([w({type:Boolean,nonNullable:!0,json:{write:!0,origins:{"web-map":{write:{isRequired:!0}},"web-scene":{default:!0,write:!0}}}})],Ig.prototype,"enabled",void 0),y([w({type:String,json:{write:!0}})],Ig.prototype,"hintText",void 0),y([w({type:TRe,json:{write:{overridePolicy:r0e},origins:{"web-scene":{write:{isRequired:!0}}}}})],Ig.prototype,"layers",void 0),y([w({type:ERe,json:{read:!0,write:{overridePolicy:r0e}}})],Ig.prototype,"tables",void 0),Ig=ZQ=y([Z("esri.webdoc.applicationProperties.Search")],Ig);const iht=Ig;var JQ;let AF=JQ=class extends Ue{constructor(t){super(t),this.search=null}clone(){return new JQ(Pe({search:this.search}))}};y([w({type:iht,json:{write:!0}})],AF.prototype,"search",void 0),AF=JQ=y([Z("esri.webdoc.applicationProperties.Viewing")],AF);const rht=AF;var KQ;let MF=KQ=class extends Ue{constructor(t){super(t),this.viewing=null}clone(){return new KQ({viewing:this.viewing?this.viewing.clone():null})}};y([w({type:rht,json:{write:!0}})],MF.prototype,"viewing",void 0),MF=KQ=y([Z("esri.webscene.ApplicationProperties")],MF);const nht=MF;var QQ;let e4=QQ=class extends Ue{constructor(t){super(t),this.type="sunny",this.cloudCover=.5}clone(){return new QQ({cloudCover:this.cloudCover})}};y([Vt({sunny:"sunny"})],e4.prototype,"type",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],e4.prototype,"cloudCover",void 0),e4=QQ=y([Z("esri.views.3d.environment.SunnyWeather")],e4);const rU=e4;var eee;let t4=eee=class extends Ue{constructor(t){super(t),this.type="cloudy",this.cloudCover=.5}clone(){return new eee({cloudCover:this.cloudCover})}};y([Vt({cloudy:"cloudy"})],t4.prototype,"type",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],t4.prototype,"cloudCover",void 0),t4=eee=y([Z("esri.views.3d.environment.CloudyWeather")],t4);const sht=t4;var tee;let i4=tee=class extends Ue{constructor(t){super(t),this.type="foggy",this.fogStrength=.5}clone(){return new tee({fogStrength:this.fogStrength})}};y([Vt({foggy:"foggy"})],i4.prototype,"type",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],i4.prototype,"fogStrength",void 0),i4=tee=y([Z("esri.views.3d.environment.FoggyWeather")],i4);const oht=i4;var iee;let NA=iee=class extends Ue{constructor(t){super(t),this.type="rainy",this.cloudCover=.5,this.precipitation=.5}clone(){return new iee({cloudCover:this.cloudCover,precipitation:this.precipitation})}};y([Vt({rainy:"rainy"})],NA.prototype,"type",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],NA.prototype,"cloudCover",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],NA.prototype,"precipitation",void 0),NA=iee=y([Z("esri.views.3d.environment.RainyWeather")],NA);const aht=NA;var ree;let Y3=ree=class extends Ue{constructor(t){super(t),this.type="snowy",this.cloudCover=.5,this.precipitation=.5,this.snowCover="disabled"}clone(){return new ree({cloudCover:this.cloudCover,precipitation:this.precipitation,snowCover:this.snowCover})}};y([Vt({snowy:"snowy"})],Y3.prototype,"type",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],Y3.prototype,"cloudCover",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],Y3.prototype,"precipitation",void 0),y([w({type:["enabled","disabled"],nonNullable:!0,json:{write:!0}})],Y3.prototype,"snowCover",void 0),Y3=ree=y([Z("esri.views.3d.environment.SnowyWeather")],Y3);const lht=Y3,iae={key:"type",base:rU,typeMap:{sunny:rU,cloudy:sht,rainy:aht,snowy:lht,foggy:oht}},cht=Object.keys(iae.typeMap);function uht(t,e){return!!cht.includes(t)||(e.error(`"${t}" is not a valid weather type`),!1)}const kv=1e4,hht=1e5;var nee;let Jp=nee=class extends Ue{constructor(t){super(t),this.type="sun",this.date=null,this.directShadowsEnabled=!1,this.displayUTCOffset=null}readDate(t,e){return e.datetime!=null&&new Date(e.datetime)||null}writeDate(t,e,i){e[i]=t.getTime()}readDirectShadowsEnabled(t,e){return!!e.directShadows}writedirectShadowsEnabled(t,e,i){t&&(e[i]=t)}writeDisplayUTCOffset(t,e){t!=null&&(e.displayUTCOffset=t)}clone(){return new nee(this.cloneConstructProperties())}cloneConstructProperties(){const t={directShadowsEnabled:this.directShadowsEnabled,displayUTCOffset:this.displayUTCOffset!=null?this.displayUTCOffset:null};return this.date!=null&&(t.date=new Date(this.date.getTime())),t}};y([w({readOnly:!0,type:["sun"],json:{write:!0}})],Jp.prototype,"type",void 0),y([w({type:Date,json:{type:Number,write:{target:"datetime"}}})],Jp.prototype,"date",void 0),y([Rt("date",["datetime"])],Jp.prototype,"readDate",null),y([Et("date")],Jp.prototype,"writeDate",null),y([w({type:Boolean,json:{default:!1,write:{target:"directShadows"}}})],Jp.prototype,"directShadowsEnabled",void 0),y([Rt("directShadowsEnabled",["directShadows"])],Jp.prototype,"readDirectShadowsEnabled",null),y([Et("directShadowsEnabled")],Jp.prototype,"writedirectShadowsEnabled",null),y([w({type:Number,json:{write:!0}})],Jp.prototype,"displayUTCOffset",void 0),y([Et("displayUTCOffset")],Jp.prototype,"writeDisplayUTCOffset",null),Jp=nee=y([Z("esri.webscene.SunLighting")],Jp);const XT=Jp;var see;let r4=see=class extends Ue{constructor(t){super(t),this.type="virtual",this.directShadowsEnabled=!1}clone(){return new see(this.cloneConstructProperties())}cloneConstructProperties(){return{directShadowsEnabled:this.directShadowsEnabled}}};y([w({readOnly:!0,type:["virtual"],json:{write:!0}})],r4.prototype,"type",void 0),y([w({type:Boolean,json:{default:!1,name:"directShadows",write:!0}})],r4.prototype,"directShadowsEnabled",void 0),r4=see=y([Z("esri.webscene.VirtualLighting")],r4);const q9=r4,CRe={key:"type",defaultKeyValue:"sun",base:null,typeMap:{sun:XT,virtual:q9}};let OF=class extends Ue{constructor(e){super(e)}clone(){}};y([w({readOnly:!0,json:{read:!1}})],OF.prototype,"type",void 0),OF=y([Z("esri.webscene.background.Background")],OF);const ARe=OF;var oee;const dht={...U_,nonNullable:!0};let n4=oee=class extends ARe{constructor(t){super(t),this.type="color",this.color=new qe([0,0,0,1])}clone(){return new oee(this.cloneProperties())}cloneProperties(){return{color:this.color.clone()}}};y([Vt({color:"color"},{readOnly:!0})],n4.prototype,"type",void 0),y([w(dht)],n4.prototype,"color",void 0),n4=oee=y([Z("esri.webscene.background.ColorBackground")],n4);const MRe=n4,n0e={base:ARe,key:"type",typeMap:{color:MRe}};function pht(t){return(e,i,r)=>{if(!e)return e;for(const n in t.typeMap)if(e.type===n){const s=new t.typeMap[n];return s.read(e,r),s}}}const fht={types:n0e,json:{read:pht(n0e),write:{overridePolicy:(t,e,i)=>({enabled:!i||!i.isPresentation})}}};var aee;const ORe="esri.webscene.Environment",mht=Ce.getLogger(ORe),s0e=(t,e,i)=>({enabled:!i||!i.isPresentation});let lw=aee=class extends Ue{constructor(t){super(t),this.lighting=new XT,this.background=null,this.atmosphereEnabled=!0,this.starsEnabled=!0}set weather(t){uht(t==null?void 0:t.type,mht)&&this._set("weather",t)}clone(){return new aee(this.cloneConstructProperties())}cloneConstructProperties(){return{lighting:this.lighting&&this.lighting.type==="virtual"?q9.prototype.clone.call(this.lighting):XT.prototype.clone.call(this.lighting),background:Pe(this.background),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,weather:this.weather.clone()}}};y([w({types:CRe,nonNullable:!0,json:{write:!0}})],lw.prototype,"lighting",void 0),y([w(fht)],lw.prototype,"background",void 0),y([w({type:Boolean,nonNullable:!0,json:{write:{overridePolicy:s0e}}})],lw.prototype,"atmosphereEnabled",void 0),y([w({type:Boolean,nonNullable:!0,json:{write:{overridePolicy:s0e}}})],lw.prototype,"starsEnabled",void 0),y([w({types:iae,nonNullable:!0,json:{write:!0},value:new rU})],lw.prototype,"weather",null),lw=aee=y([Z(ORe)],lw);const SP=lw;var lee;let X3=lee=class extends Ue{constructor(t){super(t),this.environment=new SP,this.spatialReference=null,this.viewpoint=null}set viewingMode(t){this._set("viewingMode",t)}clone(){return new lee({environment:this.environment.clone(),spatialReference:this.spatialReference?this.spatialReference.clone():null,viewingMode:this.viewingMode,viewpoint:this.viewpoint?this.viewpoint.clone():null})}};y([w({type:SP,json:{write:{isRequired:!0}}})],X3.prototype,"environment",void 0),y([w({type:rt})],X3.prototype,"spatialReference",void 0),y([w({type:["local","global"]})],X3.prototype,"viewingMode",null),y([w({type:nh,json:{write:{isRequired:!0}}})],X3.prototype,"viewpoint",void 0),X3=lee=y([Z("esri.webscene.InitialViewProperties")],X3);const nU=X3;let ght=class{constructor(e,i){this._observable=new M9,this._value=e,this._equalityFunction=i}get value(){return wi(this._observable),this._value}set value(e){this._equalityFunction(e,this._value)||(this._value=e,this._observable.notify())}mutate(e){e(this._value),this._observable.notify()}};function TP(t,e=OSe){return new ght(t,e)}let yht=class{constructor(){this._tasks=new Array,this._running=TP(!1)}get length(){return this._tasks.length}get running(){return this._running.value}destroy(){this.cancelAll()}runTask(e){for(;!e.done&&this._process(e);)e.madeProgress()}push(e,i,r){return this._running.value=!0,new Promise((n,s)=>this._tasks.push(new o0e(n,s,e,i,r)))}unshift(e,i,r){return this._running.value=!0,new Promise((n,s)=>this._tasks.unshift(new o0e(n,s,e,i,r)))}_process(e){var r;if(this._tasks.length===0)return!1;const i=this._tasks.shift();try{const n=So(i.signal);if(n&&!i.abortCallback)i.reject(ur());else{const s=n?(r=i.abortCallback)==null?void 0:r.call(i,ur()):i.callback(e);yd(s)?s.then(i.resolve,i.reject):i.resolve(s)}}catch(n){i.reject(n)}return this._running.value=this._tasks.length>0,!0}cancelAll(){const e=ur();for(const i of this._tasks)if(i.abortCallback){const r=i.abortCallback(e);i.resolve(r)}else i.reject(e);this._tasks.length=0,this._running.value=!1}},o0e=class{constructor(e,i,r,n=void 0,s=void 0){this.resolve=e,this.reject=i,this.callback=r,this.signal=n,this.abortCallback=s}},s4=class extends ze{constructor(){super(...arguments),this.SCHEDULER_LOG_SLOW_TASKS=!1,this.FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES=!1}};y([w()],s4.prototype,"SCHEDULER_LOG_SLOW_TASKS",void 0),y([w()],s4.prototype,"FEATURE_SERVICE_SNAPPING_SOURCE_TILE_TREE_SHOW_TILES",void 0),s4=y([Z("esri.views.support.DebugFlags")],s4);const vht=new s4;var Vr;(function(t){t[t.ANIMATING=0]="ANIMATING",t[t.INTERACTING=1]="INTERACTING",t[t.IDLE=2]="IDLE"})(Vr||(Vr={}));function _ht(){return new sU.Scheduler}var Jl,ni;(function(t){t[t.YIELD=1]="YIELD"})(Jl||(Jl={})),function(t){t.RESOURCE_CONTROLLER_IMMEDIATE="immediate",t.RESOURCE_CONTROLLER="schedule",t.SLIDE="slide",t.STREAM_DATA_LOADER="stream loader",t.ELEVATION_QUERY="elevation query",t.TERRAIN_SURFACE="terrain",t.SURFACE_GEOMETRY_UPDATES="surface geometry updates",t.LOD_RENDERER="LoD renderer",t.GRAPHICS_CORE="Graphics3D",t.I3S_CONTROLLER="I3S",t.POINT_CLOUD_LAYER="point cloud",t.FEATURE_TILE_FETCHER="feature fetcher",t.OVERLAY="overlay",t.STAGE="stage",t.GRAPHICS_DECONFLICTOR="graphics deconflictor",t.FILTER_VISIBILITY="Graphics3D filter visibility",t.SCALE_VISIBILITY="Graphics3D scale visibility",t.FRUSTUM_VISIBILITY="Graphics3D frustum visibility",t.POINT_OF_INTEREST_FREQUENT="POI frequent",t.POINT_OF_INTEREST_INFREQUENT="POI infrequent",t.LABELER="labeler",t.FEATURE_QUERY_ENGINE="feature query",t.FEATURE_TILE_TREE="feature tile tree",t.FEATURE_TILE_TREE_ACTIVE="fast feature tile tree",t.ELEVATION_ALIGNMENT="elevation alignment",t.TEXT_TEXTURE_ATLAS="text texture atlas",t.TEXTURE_UNLOAD="texture unload",t.LINE_OF_SIGHT_TOOL="line of sight tool",t.LINE_OF_SIGHT_TOOL_INTERACTIVE="interactive line of sight tool",t.ELEVATION_PROFILE="elevation profile",t.SNAPPING="snapping",t.SHADOW_ACCUMULATOR="shadow accumulator",t.CLOUDS_GENERATOR="clouds generator",t[t.NONE=0]="NONE",t[t.TEST_PRIO=1]="TEST_PRIO"}(ni||(ni={}));const ay=0,a0e=new Map([[ni.RESOURCE_CONTROLLER_IMMEDIATE,ay],[ni.RESOURCE_CONTROLLER,4],[ni.SLIDE,ay],[ni.STREAM_DATA_LOADER,ay],[ni.ELEVATION_QUERY,ay],[ni.TERRAIN_SURFACE,1],[ni.SURFACE_GEOMETRY_UPDATES,1],[ni.LOD_RENDERER,2],[ni.GRAPHICS_CORE,2],[ni.I3S_CONTROLLER,2],[ni.POINT_CLOUD_LAYER,2],[ni.FEATURE_TILE_FETCHER,2],[ni.OVERLAY,4],[ni.STAGE,4],[ni.GRAPHICS_DECONFLICTOR,4],[ni.FILTER_VISIBILITY,4],[ni.SCALE_VISIBILITY,4],[ni.FRUSTUM_VISIBILITY,4],[ni.CLOUDS_GENERATOR,4],[ni.POINT_OF_INTEREST_FREQUENT,6],[ni.POINT_OF_INTEREST_INFREQUENT,30],[ni.LABELER,8],[ni.FEATURE_QUERY_ENGINE,8],[ni.FEATURE_TILE_TREE,16],[ni.FEATURE_TILE_TREE_ACTIVE,ay],[ni.ELEVATION_ALIGNMENT,12],[ni.TEXT_TEXTURE_ATLAS,12],[ni.TEXTURE_UNLOAD,12],[ni.LINE_OF_SIGHT_TOOL,16],[ni.LINE_OF_SIGHT_TOOL_INTERACTIVE,ay],[ni.SNAPPING,ay],[ni.SHADOW_ACCUMULATOR,30]]);function l0e(t){return a0e.has(t)?a0e.get(t):typeof t=="number"?t:1}const c0e=6.5,u0e=1,bht=30,h0e=1e3/30,d0e=100,p0e=.9;var sU,Ax;(function(t){class e{get updating(){return this._updating.value}_updatingChanged(){this._updating.value=this._tasks.some(s=>s.needsUpdate)}constructor(){this._updating=TP(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new Wv("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new r,this._state=Vr.INTERACTING,this._tasks=new Pi,this._runQueue=new Pi,this._load=0,this._idleStateCallbacks=new Pi,this._idleUpdatesStartFired=!1,this._forceTask=!1,this._debug=!1,this._debugHandle=_e(()=>vht.SCHEDULER_LOG_SLOW_TASKS,o=>this._debug=o,Qt);for(const o of Object.keys(ni))this.performanceInfo.tasks.set(ni[o],new Wv(ni[o]));const s=this;this._test={FRAME_SAFETY_BUDGET:c0e,INTERACTING_BUDGET:h0e,IDLE_BUDGET:d0e,get availableBudget(){return s._budget.budget},usedBudget:0,getBudget:()=>s._budget,setBudget:o=>s._budget=o,updateTask:o=>this._updateTask(o),getState:o=>this._getState(o),getRuntime:o=>this._getRuntime(o),frameTaskTimes:this._frameTaskTimes,resetRuntimes:()=>this._resetRuntimes(),getRunning:()=>this._getRunning()}}destroy(){this._tasks.toArray().forEach(s=>s.remove()),this._tasks.clear(),en(this._debugHandle),this._microTaskQueued=!1,this._updatingChanged()}taskRunningChanged(s){this._updatingChanged(),s&&this._budget.remaining>0&&!this._microTaskQueued&&(this._microTaskQueued=!0,queueMicrotask(()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.remaining>0&&this._schedule()&&this.frame())}))}registerTask(s,o){const a=l0e(s),c=new i(this,s,o,a);return this._tasks.push(c),this._updatingChanged(),this.performanceInfo.tasks.has(s)||this.performanceInfo.tasks.set(s,new Wv(s)),c}registerIdleStateCallbacks(s,o){const a={idleBegin:s,idleEnd:o};this._idleStateCallbacks.push(a),this.state===Vr.IDLE&&this._idleUpdatesStartFired&&a.idleBegin();const c=this;return{remove:()=>this._removeIdleStateCallbacks(a),set idleBegin(p){c._idleUpdatesStartFired&&(a.idleEnd(),c._state===Vr.IDLE&&p()),a.idleBegin=p},set idleEnd(p){a.idleEnd=p}}}get load(){return this._load}set state(s){this._state!==s&&(this._state=s,this.state!==Vr.IDLE&&this._idleUpdatesStartFired&&(this._idleUpdatesStartFired=!1,this._idleStateCallbacks.forAll(o=>o.idleEnd())))}get state(){return this._state}updateBudget(s){this._test.usedBudget=0,++this._frameNumber;let o=c0e,a=s.frameDuration,c=u0e;switch(this.state){case Vr.IDLE:o=0,a=Math.max(d0e,s.frameDuration),c=bht;break;case Vr.INTERACTING:a=Math.max(h0e,s.frameDuration);case Vr.ANIMATING:}return a=a-s.elapsedFrameTime-o,this.state!==Vr.IDLE&&as.idleBegin())),this._runIdle();break;case Vr.INTERACTING:this._runInteracting();break;default:this._runAnimating()}this._test.usedBudget=this._budget.elapsed}stopFrame(){this._budget.reset(0,this._state),this._budget.madeProgress()}_removeIdleStateCallbacks(s){this._idleUpdatesStartFired&&s.idleEnd(),this._idleStateCallbacks.removeUnordered(s)}removeTask(s){this._tasks.removeUnordered(s),this._runQueue.removeUnordered(s),this._updatingChanged()}_updateTask(s){this._tasks.forAll(o=>{o.name===s&&o.setPriority(s)})}_getState(s){if(this._runQueue.some(a=>a.name===s))return Ax.SCHEDULED;let o=Ax.IDLE;return this._tasks.forAll(a=>{a.name===s&&a.needsUpdate&&(a.schedulePriority<=1?o=Ax.READY:o!==Ax.READY&&(o=Ax.WAITING))}),o}_getRuntime(s){let o=0;return this._tasks.forAll(a=>{a.name===s&&(o+=a.runtime)}),o}_resetRuntimes(){this._tasks.forAll(s=>s.runtime=0)}_getRunning(){const s=new Map;if(this._tasks.forAll(a=>{a.needsUpdate&&s.set(a.name,(s.get(a.name)||0)+1)}),s.size===0)return null;let o="";return s.forEach((a,c)=>{o+=a>1?` ${a}x ${c}`:` ${c}`}),o}_runIdle(){this._run()}_runInteracting(){this._run()}_runAnimating(){this._run()}_updateLoad(){const s=this._tasks.reduce((o,a)=>a.needsUpdate?++o:o,0);this._load=this._load*p0e+s*(1-p0e)}_schedule(){for(this._runQueue.filterInPlace(s=>!!s.needsUpdate||(s.schedulePriority=s.basePriority,!1)),this._tasks.forAll(s=>{s.basePriority===ay&&s.needsUpdate&&!this._runQueue.includes(s)&&s.blockFrame!==this._frameNumber&&this._runQueue.unshift(s)});this._runQueue.length===0;){let s=!1,o=0;if(this._tasks.forAll(a=>{a.needsUpdate&&a.schedulePriority!==0&&a.basePriority!==ay&&a.blockFrame!==this._frameNumber&&(s=!0,o=Math.max(o,a.basePriority),a.schedulePriority===1?(a.schedulePriority=0,this._runQueue.push(a)):--a.schedulePriority)}),!s)return this._updatingChanged(),!1}return this._updatingChanged(),!0}_run(){const s=this._budget.now();this._startFrameTaskTimes();do for(;this._runQueue.length>0;){const o=this._budget.now(),a=this._runQueue.pop();this._budget.resetProgress();try{a.task.runTask(this._budget)===Jl.YIELD&&(a.blockFrame=this._frameNumber)}catch(p){Ce.getLogger("esri.views.support.Scheduler").error(`Exception in task "${a.name}"`,p),a.blockFrame=this._frameNumber}!this._budget.hasProgressed&&a.blockFrame!==this._frameNumber&&a.needsUpdate&&(a.name,ni.I3S_CONTROLLER,a.blockFrame=this._frameNumber),a.schedulePriority=a.basePriority;const c=this._budget.now()-o;if(a.runtime+=c,this._frameTaskTimes.set(a.priority,this._frameTaskTimes.get(a.priority)+c),this._debug&&c>2*this._budget.budget&&console.log("Task",a.name,"used",c,"of max",this._budget.budget,"ms"),this._budget.remaining<=0)return this._updatingChanged(),void this._recordFrameTaskTimes(this._budget.now()-s)}while(this._schedule());this._updatingChanged(),this._recordFrameTaskTimes(this._budget.now()-s)}_startFrameTaskTimes(){for(const s of Object.keys(ni))this._frameTaskTimes.set(ni[s],0)}_recordFrameTaskTimes(s){this._frameTaskTimes.forEach((o,a)=>this.performanceInfo.tasks.get(a).record(o)),this.performanceInfo.total.record(s)}get test(){return this._test}}t.Scheduler=e;class i{get task(){return this._task.value}get updating(){return this._queue.running}constructor(s,o,a,c){this._scheduler=s,this.name=o,this._basePriority=c,this.blockFrame=0,this.runtime=0,this._queue=new yht,this._handles=new N_,this.schedulePriority=this._basePriority,this._task=TP(a??this._queue),this._handles.add(Oo(()=>this.task.running,p=>s.taskRunningChanged(p)))}remove(){this.processQueue(cu),this._scheduler.removeTask(this),this.schedule=EP.schedule,this.reschedule=EP.reschedule,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(s){this.name=s;const o=l0e(s);this._basePriority!==ay&&this.schedulePriority===0||(this.schedulePriority=o),this._basePriority=o}get priority(){return this.name}set priority(s){this.setPriority(s)}get needsUpdate(){return this.updating||this.task.running}schedule(s,o,a){return this._queue.push(s,o,a)}reschedule(s,o,a){return this._queue.unshift(s,o,a)}processQueue(s){this._queue.runTask(s)}}class r{constructor(){this._begin=typeof performance<"u"?performance.now():0,this._budget=0,this._state=Vr.IDLE,this._done=!1,this._progressed=!1,this._enabled=!0}run(s){return!this.done&&(s()===!0&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){return this._progressed=!0,this._done=this.elapsed>=this._budget&&this._enabled,this._done}get state(){return this._state}get enabled(){return this._enabled}set enabled(s){this._enabled=s}reset(s,o){this._begin=this.now(),this._budget=s,this._state=o,this.resetProgress()}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return performance.now()-this._begin}resetProgress(){this._progressed=!1,this._done=!1}get hasProgressed(){return this._progressed}}t.Budget=r})(sU||(sU={})),function(t){t.SCHEDULED="s",t.READY="r",t.WAITING="w",t.IDLE="i"}(Ax||(Ax={}));const cu=(()=>{const t=new sU.Budget;return t.enabled=!1,t})();let wht=class{remove(){}processQueue(){}schedule(e,i,r){try{if(So(i)){const n=ur();return r?Promise.resolve(r(n)):Promise.reject(n)}return cZ(e(cu))}catch(n){return Promise.reject(n)}}reschedule(e,i,r){return this.schedule(e,i,r)}};const EP=new wht;var cee;let Zv=cee=class extends Ue{constructor(){super(...arguments),this.url=""}destroy(){this.url=""}clone(){return new cee({url:this.url})}};y([w({type:String,json:{write:{isRequired:!0}}})],Zv.prototype,"url",void 0),Zv=cee=y([Z("esri.webdoc.support.SlideThumbnail")],Zv);var uee;let PF=uee=class extends Ue{constructor(){super(...arguments),this.text=""}clone(){return new uee({text:this.text})}};y([w({type:String,json:{write:!0}})],PF.prototype,"text",void 0),PF=uee=y([Z("esri.webscene.support.Description")],PF);const RF=PF;var hee;let LM=hee=class extends Ue{constructor(){super(...arguments),this.lighting=new XT,this.weather=new rU}clone(){return new hee({lighting:Pe(this.lighting),weather:Pe(this.weather)})}};y([w({types:CRe,json:{write:!0}})],LM.prototype,"lighting",void 0),y([w({types:iae,json:{write:!0}})],LM.prototype,"weather",void 0),LM=hee=y([Z("esri.webscene.Environment")],LM);var IF;let $F=IF=class extends Ue{constructor(){super(...arguments),this.opacity=null}clone(){return new IF({opacity:this.opacity})}cloneAndApplyTo(t){return this.opacity==null||((t=(t==null?void 0:t.clone())??new bP).opacity=this.opacity),t}static fromGround(t){return new IF({opacity:t.opacity})}};y([w({type:Number,json:{type:_n,read:{reader:WT,source:"transparency"},write:{writer:(t,e)=>{e.transparency=zB(t)},target:"transparency"}}})],$F.prototype,"opacity",void 0),$F=IF=y([Z("esri.webscene.support.SlideGround")],$F);const PRe=$F;var dee;let DM=dee=class extends Ue{constructor(t){super(t),this.id="",this.sublayerIds=null}clone(){return new dee({id:this.id,sublayerIds:Pe(this.sublayerIds)})}};y([w({type:String,json:{write:!0}})],DM.prototype,"id",void 0),y([w({type:[_n],json:{read:{source:"subLayerIds"},write:{target:"subLayerIds"}}})],DM.prototype,"sublayerIds",void 0),DM=dee=y([Z("esri.webscene.support.SlideVisibleLayer")],DM);var pee;let LF=pee=class extends Ue{constructor(){super(...arguments),this.text=""}clone(){return new pee({text:this.text})}};y([w({type:String,json:{write:{isRequired:!0}}})],LF.prototype,"text",void 0),LF=pee=y([Z("esri.webscene.support.Title")],LF);const x$=LF;let xht=0;const fee=tt.ofType(DM);let Fl=class extends Ue{constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+xht++,this.title=new x$,this.description=new RF,this.hidden=!1,this.thumbnail=new Zv,this.viewpoint=null,this.basemap=null,this.ground=null,this.environment=new LM,this.visibleLayers=new fee}destroy(){this.visibleLayers.removeAll(),this.basemap=null,this.thumbnail=et(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null}castTitle(e){return typeof e=="string"?new x$({text:e}):_s(x$,e)}castDescription(e){return typeof e=="string"?new RF({text:e}):_s(RF,e)}castThumbnail(e){return typeof e=="string"?new Zv({url:e}):_s(Zv,e)}castBasemap(e){return eae(e)}set visibleLayers(e){this._set("visibleLayers",od(e,this._get("visibleLayers"),fee))}castVisibleLayers(e){return e&&typeof e.map=="function"?e.map(i=>{if(typeof i=="string")return{id:i};if(i instanceof pE){const r=f0e(i);return{id:i.id,sublayerIds:r}}return i.id?{id:i.id,sublayerIds:"sublayerIds"in i?i.sublayerIds:void 0}:(Ce.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),i)}):null}clone(){var e,i;return new this.constructor({id:this.id,title:this.title.clone(),thumbnail:this.thumbnail.clone(),description:this.description&&this.description.clone()||null,viewpoint:this.viewpoint&&this.viewpoint.clone()||null,basemap:((e=this.basemap)==null?void 0:e.clone())||null,ground:((i=this.ground)==null?void 0:i.clone())||null,visibleLayers:this.visibleLayers.clone(),environment:this.environment&&this.environment.clone()||null,hidden:this.hidden})}async _updateVisibleLayersFrom(e){const i=[];await Promise.allSettled(this._getLayers(e.map).map(r=>e.whenLayerView(r).then(n=>{if(n.visible){const s=f0e(r);i.push(new DM({id:n.layer.id,sublayerIds:s}))}})).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(i)}updateFrom(e,i){const r={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...i==null?void 0:i.screenshot};return e.when(()=>(this.viewpoint=e.viewpoint.clone(),this.environment.lighting=e.environment.lighting.type==="virtual"?q9.prototype.clone.apply(e.environment.lighting):XT.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.basemap=e.map.basemap&&e.map.basemap.clone()||null,this.ground=e.map.ground?PRe.fromGround(e.map.ground):null,this._updateVisibleLayersFrom(e))).then(()=>e.takeScreenshot(r)).then(n=>(this.thumbnail=new Zv({url:n.dataUrl}),this))}async applyTo(e,i){this._applyToController!=null&&this._applyToController.abort();let r=new AbortController;this._applyToController=r;const n=C9(i,()=>r==null?void 0:r.abort()),s=e.resourceController.scheduler.registerTask(ni.SLIDE);let o=!1;const a={animate:!0,...i,signal:this._applyToController.signal},c=async()=>{await Promise.all([s.schedule(async()=>o=await this._setViewpointOfInterest(e,a)),s.schedule(()=>this._applyBasemap(e,a),a.signal)]),await this._loadLayersWithSublayerVisibility(e),await Promise.all([s.schedule(()=>this._applyLayerVisibility(e),a.signal),s.schedule(()=>this._applyGround(e),a.signal),s.schedule(()=>this._applyViewpoint(e,a),a.signal)]),await s.schedule(()=>e.environment.weather=this.environment.weather.clone())},p=await ih(e.addUpdatingPromise(c()));if(o&&(e.contentCamera=null),s.remove(),this._applyToController===r&&(this._applyToController=null),r=null,n==null||n.remove(),p.ok===!1)throw p.error;return this}async _applyBasemap(e,i){if(this.basemap){try{await this.basemap.load(i)}catch(r){if(on(r))throw r}e.map.basemap=Cut(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_getLayers(e){const i=new tt;return this._collectLayers(e,i),this._collectLayers(e.ground,i),i}_collectLayers(e,i){e.layers.forEach(r=>{r.persistenceEnabled&&(i.add(r),"layers"in r&&this._collectLayers(r,i))})}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map(i=>{var n;return((n=this.visibleLayers.find(s=>s.id===i.id))==null?void 0:n.sublayerIds)?i.load():null}))}_applyLayerVisibility(e){this.visibleLayers&&this._getLayers(e.map).forEach(i=>{const r=this.visibleLayers.find(o=>o.id===i.id);i.visible=r!=null;const n=r==null?void 0:r.sublayerIds,s=RRe(i);n&&s&&s.forEach(o=>o.visible=n.includes(o.id))})}async _setViewpointOfInterest(e,i){if(e.state.fixedContentCamera||!this.viewpoint||i!=null&&i.ignoreViewpoint||!(i!=null&&i.useDestinationCamera))return!1;const{toCameraAsync:r}=await we(()=>Promise.resolve().then(()=>xbt),void 0),n=await r(e,this.viewpoint);return e.contentCamera=n,n!=null}async _applyViewpoint(e,i){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!i.ignoreViewpoint){this.viewpoint.camera!=null&&(this.viewpoint.camera.fov=e.camera.fov);const r=this.environment.lighting;if(i.animate&&r.type==="sun"&&r.date)return this._animateToLighting(e,i);i.animate&&(e.environment.applyLighting(r.clone()),await e.goTo(this.viewpoint,i)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,i){let r=null;return e.environment.lighting.type!=="virtual"&&this.environment.lighting.type!=="virtual"&&(e.viewingMode==="global"&&(r=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,this.environment.lighting.type==="virtual"||e.environment.lighting.type==="virtual"?(e.environment.applyLighting(this.environment.lighting.clone()),e.environment.lighting.type!=="virtual"&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):this.environment.lighting.displayUTCOffset!=null&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset),e.goTo(this.viewpoint,i).then(()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())}).catch(n=>{throw e.animation==null&&this._applyCachedCameraTrackingEnabled(e),n}).finally(()=>{en(r)})}_applyCachedCameraTrackingEnabled(e){e.environment.cachedCameraTrackingEnabled!=null&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[e.getTime(),3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds()]}_setTime(e,i,r){return e.setTime(i),e.setUTCHours(r/3600),e.setUTCMinutes(r%3600/60),e.setUTCSeconds(r%3600%60),e}_animateLightingWithCamera(e,i,r){const n=new Date(i.date.toString()),[s,o]=this._getTime(n),[a,c]=this._getTime(r.date),p=Sht(o,c),_=e.renderCoordsHelper,x=W();_.toRenderCoords(e.camera.position,x);const S=W(),C=W();this.viewpoint.camera!=null&&_.toRenderCoords(this.viewpoint.camera.position,S);const M=new Date;return Oo(()=>e.camera,P=>{_.toRenderCoords(P.position,C);const $=Ao(x,C),F=Ao(S,C);let z=0;$+F!==0&&(z=$/($+F));const k=s+(a-s)*z,U=Tht(o,p*z);i.date=this._setTime(M,k,U)})}static createFrom(e,i){return new this().updateFrom(e,i)}};function RRe(t){if(t.type==="building-scene"||t.type==="map-image")return t.allSublayers.toArray()}function f0e(t){const e=RRe(t);if(e)return e.filter(i=>i.visible).map(i=>i.id)}y([w({type:String,json:{write:{isRequired:!0}}})],Fl.prototype,"id",void 0),y([w({type:x$,json:{default:()=>new x$({text:""}),write:{isRequired:!0}}})],Fl.prototype,"title",void 0),y([Ci("title")],Fl.prototype,"castTitle",null),y([w({type:RF,json:{write:{overridePolicy:t=>({enabled:!(!t||!t.text)})}}})],Fl.prototype,"description",void 0),y([Ci("description")],Fl.prototype,"castDescription",null),y([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],Fl.prototype,"hidden",void 0),y([w({type:Zv,json:{default:()=>new Zv({url:""}),write:{isRequired:!0}}})],Fl.prototype,"thumbnail",void 0),y([Ci("thumbnail")],Fl.prototype,"castThumbnail",null),y([w({type:nh,nonNullable:!0,json:{write:{isRequired:!0}}})],Fl.prototype,"viewpoint",void 0),y([w({type:$y,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],Fl.prototype,"basemap",void 0),y([Ci("basemap")],Fl.prototype,"castBasemap",null),y([w({type:PRe,json:{write:!0}})],Fl.prototype,"ground",void 0),y([w({type:fee,json:{write:{isRequired:!0}}})],Fl.prototype,"visibleLayers",null),y([Ci("visibleLayers")],Fl.prototype,"castVisibleLayers",null),y([w({type:LM,json:{write:!0}})],Fl.prototype,"environment",void 0),Fl=y([Z("esri.webscene.Slide")],Fl);const mee=86400,m0e=43200;function Sht(t,e){let i=e-t;return i>m0e&&(i-=mee),i<-m0e&&(i+=mee),i}function Tht(t,e){return mXe(t+e,mee)}const Eht=Fl,gee=tt.ofType(Eht);let DF=class extends Ue{constructor(e){super(e),this.slides=new gee}destroy(){this.slides.forEach(e=>e.destroy()),this.slides.removeAll()}set slides(e){e&&(e=e.filter(i=>!!i.viewpoint)),this._set("slides",od(e,this._get("slides"),gee))}clone(){return new this.constructor({slides:this.slides.clone()})}};y([w({type:gee,nonNullable:!0,json:{write:!0}}),Ci(o5)],DF.prototype,"slides",null),DF=y([Z("esri.webscene.Presentation")],DF);const IRe=DF;var yee;let FA=yee=class extends Ue{constructor(t){super(t)}clone(){return new yee({name:this.name,path:this.path,title:this.title})}};y([w({type:String,json:{write:!0}})],FA.prototype,"name",void 0),y([w({type:String,json:{write:!0}})],FA.prototype,"path",void 0),y([w({type:String,json:{write:!0}})],FA.prototype,"title",void 0),FA=yee=y([Z("esri.webscene.TransportationNetwork")],FA);const Cht=FA;let oU=class extends k2{constructor(e,i){super(e,i,"webscene")}get supportsGround(){return this.since(1,8)}get supportsVisibleElevationLayersInSlides(){return this.lessThan(1,8)}},Aht=null;function Mht(){return Aht}var $Re;const xT=new oU(1,32),Oht=()=>{const e=[],i=xT.major;for(let r=8;r<=xT.minor;r++)e.push(`${i}.${r}`);return e},rq="Web Scene";let wn=class extends Wf.LoadableMixin($9(T5(vRe))){constructor(e){super(e),this[$Re]=!0,this._layersIdGCTimeoutId=void 0,this._updateFromPromise=null,this.applicationProperties=null,this.clippingArea=null,this.clippingEnabled=!1,this.floorInfo=null,this.heightModelInfo=void 0,this.sourceVersion=null,this.transportationNetworks=null,this.presentation=new IRe,this.initialViewProperties=new nU,this.portalItem=null,this.resourceInfo=null,this._debouncedSaveOperations=n5(async(i,r,n)=>{switch(i){case by.SAVE:return this._saveImpl(r);case by.SAVE_AS:return this._saveAsImpl(n,r)}}),this._resourceReferences={portalItem:null,paths:[]},this.authoringApp=null,this.authoringAppVersion=null,this._isAuthoringAppSetByUser=!1,this._isAuthoringAppVersionSetByUser=!1}initialize(){if(this.when().catch(e=>{Ce.getLogger(this).error("#load()","Failed to load web scene",e)}),this.resourceInfo){let e;try{e=this._validateJSON(this.resourceInfo)}catch(i){return void this.addResolvingPromise(Promise.reject(i))}this.read(e),this.addResolvingPromise(this._validateSpatialReference()),this.addResolvingPromise(this._validateHeightModelInfo())}this.addHandles(Jr(()=>this.allLayers,"change",()=>this._scheduleLayersIdGC()))}destroy(){this._unscheduleLayersIdGC(),this.presentation&&this.presentation.destroy(),this.portalItem=et(this.portalItem)}writeClippingArea(e,i){i.clippingArea||(i.clippingArea={}),i.clippingArea.geometry=e.toJSON()}readClippingEnabled(e,i){return!!i.clippingArea&&!!i.clippingArea.clip}writeClippingEnabled(e,i){this.clippingArea&&(i.clippingArea||(i.clippingArea={}),i.clippingArea.clip=e)}writeLayers(e,i,r,n){i[r]=this._layersToJSON(e,"operational-layers",n)}readSourceVersion(e,i){const[r,n]=i.version.split(".");return new oU(parseInt(r,10),parseInt(n,10))}writeSourceVersion(e,i,r){i[r]=`${xT.major}.${xT.minor}`}writeTables(e,i,r,n){const s=this._layersToJSON(e,"tables",n);s.length&&(i[r]=s)}get thumbnailUrl(){var e;return((e=this.portalItem)==null?void 0:e.thumbnailUrl)??null}set thumbnailUrl(e){e?this._override("thumbnailUrl",e):(this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}set authoringApp(e){this._isAuthoringAppSetByUser=!0,this._set("authoringApp",e)}writeAuthoringApp(e,i){e&&this._isAuthoringAppSetByUser?i.authoringApp=e:i.authoringApp="ArcGIS API for JavaScript"}set authoringAppVersion(e){this._isAuthoringAppVersionSetByUser=!0,this._set("authoringAppVersion",e)}writeAuthoringAppVersion(e,i){e&&this._isAuthoringAppVersionSetByUser?i.authoringAppVersion=e:i.authoringAppVersion=GTe}writeGround(e,i,r,n){i[r]=e?e.write({},n):{transparency:0,layers:[]}}readInitialViewProperties(e,i){var n,s;const r={};return(n=i.initialState)!=null&&n.environment&&(r.environment=SP.fromJSON(i.initialState.environment)),r.spatialReference=i.spatialReference?rt.fromJSON(i.spatialReference):rt.WebMercator,r.viewingMode=i.viewingMode??"global",(s=i.initialState)!=null&&s.viewpoint&&(r.viewpoint=nh.fromJSON(i.initialState.viewpoint)),new nU(r)}get spatialReference(){var e;return((e=this.initialViewProperties)==null?void 0:e.spatialReference)??rt.WebMercator}get viewingMode(){var e;return((e=this.initialViewProperties)==null?void 0:e.viewingMode)??"global"}load(e){const i=this.ground;return this.addResolvingPromise(this._loadFromSource().then(()=>{i&&i!==this.ground&&i.destroy()})),Promise.resolve(this)}loadAll(){return bj(this,e=>{const i=this.presentation&&this.presentation.slides;e(this.ground,this.basemap,this.layers,i&&i.map(r=>r.basemap),this.tables)})}read(e,i){var s;i={...i,origin:"web-scene"};const r=this._isAuthoringAppVersionSetByUser,n=this._isAuthoringAppSetByUser;if(ATe(this,e,o=>super.read(e,o),i),n||(this._isAuthoringAppSetByUser=!1),r||(this._isAuthoringAppVersionSetByUser=!1),e.baseMap&&Array.isArray(e.baseMap.elevationLayers)&&((s=this.sourceVersion)==null?void 0:s.supportsVisibleElevationLayersInSlides)){const o=e.baseMap.elevationLayers.map(_=>({id:_.id})),a=this.presentation.slides,c=(_,x)=>_.visibleLayers.some(S=>S.id===x),p=o.filter(_=>!a.some(x=>c(x,_.id)));a.forEach(_=>{_.visibleLayers.addMany(p)})}}_writeBasemapElevationLayers(e){var r;const i=(r=e.ground)==null?void 0:r.layers;!e.baseMap&&(i!=null&&i.length)&&(e.baseMap={title:"Basemap",baseMapLayers:[]}),e.baseMap&&(e.baseMap.elevationLayers=Pe(i))}_layersToJSON(e,i,r){const n={...r,layerContainerType:i};return e.map(s=>this._verifyWritableLayer(s,r)?s.write({},n):null).filter(s=>!!s).toArray()}_verifyWritableLayer(e,i){return!!e.persistenceEnabled&&("write"in e||(i!=null&&i.messages&&i.messages.push(new se("layer:unsupported",`Layers (${e.title}, ${e.id}) of type '${e.declaredClass}' cannot be persisted in web scenes`,{layer:e})),!1))}write(e,i){var s;if(this.loadStatus!=="loaded"){const o=new se("webscene:not-loaded","Web scene must be loaded before it can be serialized");throw Ce.getLogger(this).error("#toJSON()","Web scene must be loaded before it can be serialized",this.loadError||this.loadStatus),o}this._runLayersIdGC();const r=!(i!=null&&i.messages);i={messages:[],...i,origin:"web-scene"};const n=super.write(e,i);if(r){const o=((s=i.messages)==null?void 0:s.filter(a=>a.name==="web-document-write:property-required"))??[];if(o.length){const a=new se("web-document:property-required","One or more properties that are required in the webscene JSON are missing, see details for the specific errors",{errors:o});throw Ce.getLogger(this).error("#toJSON()","One or more properties that are required in the webscene JSON are missing",o),a}}return this._writeBasemapElevationLayers(n),n}async save(e){return this._debouncedSaveOperations(by.SAVE,e)}async _saveImpl(e){var s;if(!this.portalItem)throw new se("webscene:portal-item-not-set","Portal item to save to has not been set on the WebScene");if(Zz(this.portalItem),((s=this.portalItem)==null?void 0:s.type)!==rq)throw new se("webscene:portal-item-wrong-type",`Portal item needs to have type "${rq}"`);const i=this._updateFromPromise;await this._ensureLoadBeforeSave();const r=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:this.portalItem.itemUrl?Is(this.portalItem.itemUrl):null,messages:[],portal:this.portalItem.portal??os.getDefault(),portalItem:this.portalItem,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),n=this.write({},r);return await Promise.all(r.resources.pendingOperations),await this._verifySave(n,r,e),this._updateTypeKeywords(this.portalItem),await SPe(this.portalItem,n,this._resourceReferences,r,null),Yz(r),i&&await i,await this._saveThumbnail(),this.portalItem}async saveAs(e,i){return this._debouncedSaveOperations(by.SAVE_AS,i,e)}async _saveAsImpl(e,i){let r=Om.from(e);if(!r)throw new se("webscene:portal-item-required","saveAs requires a portal item to save to");Zz(r),r.id&&(r=r.clone(),r.id=null);const n=r.portal||os.getDefault();await this._ensureLoadBeforeSave(),r.type=rq,r.portal=n;const s=this._enableVerifyItemRelativeUrls({origin:"web-scene",url:null,messages:[],portal:n,portalItem:r,writtenProperties:[],blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}),o=this.write({},s);await Promise.all(s.resources.pendingOperations),await this._verifySaveAs(o,s,i);const a=this.thumbnailUrl,c=!this._isOverridden("thumbnailUrl");if(this._updateTypeKeywords(r),await n.signIn(),!n.user)throw new se("webscene:user-not-signed-in","saveAs requires a user to be signed in to the portal");return await n.user.addItem({item:r,folder:i==null?void 0:i.folder,data:o}),await xPe(this._resourceReferences,s,null),this.portalItem=r,qz.prototype.read.call(this,{version:o.version,authoringApp:o.authoringApp,authoringAppVersion:o.authoringAppVersion},{name:"web-scene",ignoreDefaults:!0,url:r.itemUrl?Is(r.itemUrl):void 0}),Yz(s),a&&(this.thumbnailUrl=c?Dne(a,"w","8192"):a),s.portalItem=r,await this._saveThumbnail(),r}async _saveThumbnail(){var e;this._isOverridden("thumbnailUrl")&&(await((e=this.portalItem)==null?void 0:e.updateThumbnail({thumbnail:this.thumbnailUrl})),this._clearOverride("thumbnailUrl"),this.clear("thumbnailUrl","user"))}_verifySave(e,i,r,n=!1){var p;if(!XO(this.spatialReference))return Promise.reject(new se("webscene:unsupported-spatial-reference","Webscenes using spatial reference systems from Mars or Moon can not be saved currently."));let s,o=((p=i.messages)==null?void 0:p.filter(_=>_.type==="error").map(_=>new se(_.name,_.message,_.details)))??[];i.blockedRelativeUrls&&(o=o.concat(i.blockedRelativeUrls.map(_=>new se("url:unsupported",`Relative url '${_}' is not supported in Web Scene`)))),r&&r.ignoreUnsupported&&(o=o.filter(_=>_.name!=="layer:unsupported"&&_.name!=="symbol:unsupported"&&_.name!=="symbol-layer:unsupported"&&_.name!=="property:unsupported"&&_.name!=="url:unsupported"&&_.name!=="scenemodification:unsupported")),r!=null&&r.requiredPropertyChecksDisabled&&(o=o.filter(_=>_.name!=="web-document-write:property-required"));const a=!!(r!=null&&r.strictSchemaValidationEnabled),c=Mht();return s=a&&c?c().then(_=>{const x=_.validate(e);if(x.length>0){const S=`webscene did not validate: ${x.join(` -`)}`;Ce.getLogger(this).error(`${n?"saveAs":"save"}(): ${T}`)}return x.map(T=>new se("webscene:schema-validation",T))}).then(_=>{if(_.length>0)throw apt(_.concat(o));return o}):Promise.resolve(o),s.then(_=>{if(_.length>0)throw new se("webscene:save","Failed to save webscene due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:_})})}_verifySaveAs(e,i,r){return this.canNotSaveAs(i)?Promise.reject(opt()):this._verifySave(e,i,r,!0)}verifySaveAs(e){const i=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},i);return this._verifySaveAs(r,i,e)}canNotSaveAs(e){var i,r;return e||(e=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),this.write({},e)),(((r=(i=e.verifyItemRelativeUrls)==null?void 0:i.writtenUrls)==null?void 0:r.length)??0)>0}async updateFrom(e,i={}){const r=this._updateFrom(e,i);this._updateFromPromise=r,await r,this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,i={}){if(await e.whenReady(),!i.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=f5.prototype.clone.apply(e.environment)),!i.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,e.clippingArea!=null?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const n="visible";n in r&&n in r.layer&&r._isOverridden(n)&&(r.layer[n]=r[n])}(i.thumbnailExcluded===!1||i.thumbnailExcluded==null&&!i.viewpointExcluded)&&await this._updateFromThumbnail(e,i.thumbnailSize??void 0)}async _updateFromThumbnail(e,i){const r=cpt(e,i),n=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=n.dataUrl}_loadFromSource(){var e;return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-scene"}):(e=this.portalItem)!=null&&e.id?this._loadFromItem(this.portalItem):this._loadObjectsWithLayers()}_readAndLoadFromJSON(e,i){const r=this._validateJSON(e);return this.read(r,i),this._loadFromJSON(r,i)}_extractOperationalLayers(e){var s;const i=[];if(!((s=this.sourceVersion)!=null&&s.supportsGround)&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)i.push(o);const r=[],n=o=>{var l;return o.layers&&(o.layers=o.layers.filter(n)),o.layerType!=="ArcGISTiledElevationServiceLayer"||((l=this.sourceVersion)!=null&&l.supportsGround||r.push(o),!1)};return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(n):[],operationalElevationLayers:r,basemapElevationLayers:i}}async _loadFromJSON(e,i){var _;const r=new it;await this._validateSpatialReference(),await this._validateHeightModelInfo();const{populateOperationalLayers:n}=await we(()=>import("./layersCreator-aC1PvuFa.js"),__vite__mapDeps([44,35,36])),{operationalLayers:s,operationalElevationLayers:o,basemapElevationLayers:l}=this._extractOperationalLayers(e),c=[],f={context:{...i,layerContainerType:"operational-layers"}};if(this.portalItem&&(f.context.portal=this.portalItem.portal||os.getDefault()),l.length>0){const x={...f,context:{...f.context,layerContainerType:"ground"}};x.defaultLayerType="ArcGISTiledElevationServiceLayer",c.push(n(this.ground.layers,l,x))}if(o.length>0){const x={...f,context:{...f.context,layerContainerType:"ground"}};x.defaultLayerType="ArcGISTiledElevationServiceLayer",c.push(n(r,o,x))}s&&s.length>0&&c.push(n(this.layers,s,f)),(_=e.tables)!=null&&_.length&&c.push(n(this.tables,e.tables,{...f,context:{...f.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"})),await Promise.allSettled(c),await this._loadObjectsWithLayers(),this.ground.layers.addMany(r)}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[],i=[...this.allLayers.items];for(const{basemap:r}of this.presentation.slides.items)r&&(i.push(...r.baseLayers.items),i.push(...r.referenceLayers.items));for(const r of i)if("beforeSave"in r&&typeof r.beforeSave=="function"){const n=r.beforeSave();n&&e.push(n)}await Promise.allSettled(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach(i=>{i.basemap&&e.push(i.basemap.load())}),await Promise.allSettled(e)}async _loadFromItem(e){if(await e.load().catch(n=>{throw new se("webscene:load-portal-item","Failed to load portal item",{error:n})}),e.type!=="Web Scene")throw new se("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const i=await e.fetchData();this.resourceInfo=i;const r={origin:"web-scene",url:qs(e.itemUrl),portal:e.portal||os.getDefault(),portalItem:e,readResourcePaths:[]};await this._readAndLoadFromJSON(i,r),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]}}_validateSpatialReference(){const e=this.initialViewProperties,i=this._sceneSpatialReference;let r;if(e.viewingMode!=="local"){if(!p5(i,_t.Global))return Promise.reject(new se("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:i,viewingMode:e.viewingMode}));r=c=>!c||th(c,i)}else{if(!p5(i,_t.Local))return Promise.reject(new se("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:i,viewingMode:e.viewingMode}));r=c=>!c||c.equals(i)}const n=c=>{var f,_;return((f=c==null?void 0:c.camera)==null?void 0:f.position.spatialReference)??((_=c==null?void 0:c.targetGeometry)==null?void 0:_.spatialReference)},s=e.viewpoint,o=n(s);if(o&&!r(o))return Promise.reject(new se("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:o,sceneSpatialReference:i,viewingMode:e.viewingMode}));const l=this.presentation.slides.find(c=>!r(n(c.viewpoint)));if(l){const c=n(l.viewpoint);return Promise.reject(new se("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:c,sceneSpatialReference:i,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,i=Xdt(this.heightModelInfo,e);return i?Promise.reject(i):Promise.resolve()}_validateJSON(e){const i=lU.parse(e.version||"","webscene");return mT.validate(i),e.version=`${i.major}.${i.minor}`,i.major===1&&i.minor<=2&&(e.spatialReference=at.WebMercator.toJSON()),e}_updateTypeKeywords(e){tfe(e,HK.LOCAL_SCENE,this.initialViewProperties.viewingMode==="local"),tfe(e,HK.DEVELOPER_BASEMAP,s0e(this.basemap)||this.presentation.slides.some(({basemap:i})=>!!i&&s0e(i))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter((i,r,n)=>n.indexOf(i)===r))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||at.WebMercator}get _verifyItemRelativeRootPath(){var e;return(e=this.portalItem)!=null&&e.itemUrl?qs(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const i=this._verifyItemRelativeRootPath;return i&&(e.verifyItemRelativeUrls={rootPath:i,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout(()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()},3e3)}_runLayersIdGC(){var n,s;this._unscheduleLayersIdGC();const e=(s=(n=this.applicationProperties)==null?void 0:n.viewing)==null?void 0:s.search,i=o=>this.allLayers.some(l=>l.id===o&&l.persistenceEnabled);e&&e.layers&&(e.layers=e.layers.filter(o=>i(o.id)));const r=this.presentation&&this.presentation.slides;r&&r.forEach(o=>{o.visibleLayers&&(o.visibleLayers=o.visibleLayers.filter(l=>i(l.id)))})}static fromJSON(e){if(!e)throw new se("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}};o4e=DRe,bn.version=`${mT.major}.${mT.minor}`,y([w({type:gpt,json:{write:!0}})],bn.prototype,"applicationProperties",void 0),y([w({type:Vi,json:{read:{source:"clippingArea.geometry",reader:O2},write:{target:"clippingArea.geometry"}}})],bn.prototype,"clippingArea",void 0),y([Pt("clippingArea")],bn.prototype,"writeClippingArea",null),y([w({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],bn.prototype,"clippingEnabled",void 0),y([$t("clippingEnabled",["clippingArea"])],bn.prototype,"readClippingEnabled",null),y([Pt("clippingEnabled")],bn.prototype,"writeClippingEnabled",null),y([w({type:rpt,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],bn.prototype,"floorInfo",void 0),y([w({type:N_,json:{write:!0}})],bn.prototype,"heightModelInfo",void 0),y([w({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],bn.prototype,"layers",void 0),y([Pt("layers")],bn.prototype,"writeLayers",null),y([w({readOnly:!0,type:lU,json:{type:Vpt(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],bn.prototype,"sourceVersion",void 0),y([$t("sourceVersion",["version"])],bn.prototype,"readSourceVersion",null),y([Pt("sourceVersion")],bn.prototype,"writeSourceVersion",null),y([w({json:{read:!1,write:{enabled:!0,ignoreOrigin:!0}}})],bn.prototype,"tables",void 0),y([Pt("tables")],bn.prototype,"writeTables",null),y([w()],bn.prototype,"thumbnailUrl",null),y([w({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],bn.prototype,"authoringApp",null),y([Pt("authoringApp")],bn.prototype,"writeAuthoringApp",null),y([w({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],bn.prototype,"authoringAppVersion",null),y([Pt("authoringAppVersion")],bn.prototype,"writeAuthoringAppVersion",null),y([w({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],bn.prototype,"ground",void 0),y([Pt("ground")],bn.prototype,"writeGround",null),y([w({type:it.ofType(kpt),json:{write:!0}})],bn.prototype,"transportationNetworks",void 0),y([w({type:s4e,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(t,e,i,r)=>{if(t.slides&&t.slides.length>0){const n={...r,isPresentation:!0};e.presentation=t.write({},n)}}}}})],bn.prototype,"presentation",void 0),y([w({type:oU,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new oU({viewingMode:"global",spatialReference:at.WebMercator})}})],bn.prototype,"initialViewProperties",void 0),y([$t("initialViewProperties",["initialState.environment","initialState.viewpoint","spatialReference","viewingMode"])],bn.prototype,"readInitialViewProperties",null),y([w({type:at,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],bn.prototype,"spatialReference",null),y([w({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],bn.prototype,"viewingMode",null),y([w({type:Am})],bn.prototype,"portalItem",void 0),y([w()],bn.prototype,"resourceInfo",void 0),bn=y([Z("esri.WebScene")],bn);const Bpt=bn;let cU=class{constructor(e=i=>i.values().next().value){this._peeker=e,this._observable=new v9,this._items=new Set}get length(){return wi(this._observable),this._items.size}clear(){this.length!==0&&(this._items.clear(),this._observable.notify())}last(){if(this.length===0)return;let e;for(e of this._items);return e}peek(){if(this.length!==0)return this._peeker(this._items)}push(e){this.contains(e)||(this._items.add(e),this._observable.notify())}contains(e){return wi(this._observable),this._items.has(e)}pop(){if(this.length===0)return;const e=this.peek();return this._items.delete(e),this._observable.notify(),e}popLast(){if(this.length===0)return;const e=this.last();return this._items.delete(e),this._observable.notify(),e}remove(e){this.contains(e)&&(this._items.delete(e),this._observable.notify())}filter(e){const i=this.length;return this._items.forEach(r=>{e(r)||this._items.delete(r)}),i!==this._items.size&&this._observable.notify(),this}*[Symbol.iterator](){wi(this._observable),yield*this._items}};const a4e=new FinalizationRegistry(t=>{t.close()});function jpt(t,e){a4e.register(t,e,e)}function Gpt(t){a4e.unregister(t)}const Hpt={statsWorker:()=>we(()=>import("./statsWorker-HfKfr9Es.js"),__vite__mapDeps([129,94,73])),geometryEngineWorker:()=>we(()=>import("./geometryEngineWorker-yTomxYzK.js"),__vite__mapDeps([130,131,93])),CSVSourceWorker:()=>we(()=>import("./CSVSourceWorker-GlkXsKJn.js"),__vite__mapDeps([132,108,93,88,89,90,91,92,39,40,66,94,73,95,65])),EdgeProcessingWorker:()=>we(()=>import("./EdgeProcessingWorker-V8L8etpG.js"),__vite__mapDeps([])),ElevationSamplerWorker:()=>we(()=>import("./ElevationSamplerWorker-_kiMcA-u.js"),__vite__mapDeps([133,90,91])),FeatureServiceSnappingSourceWorker:()=>we(()=>import("./FeatureServiceSnappingSourceWorker-TBw9rhlL.js"),__vite__mapDeps([134,88,89,90,91,92,39,40,93,66,94,73,95,135,76,77,75,52])),GeoJSONSourceWorker:()=>we(()=>import("./GeoJSONSourceWorker-Sd5A35h-.js"),__vite__mapDeps([136,88,89,90,91,92,39,40,93,66,94,73,95,107,108,65,137])),LercWorker:()=>we(()=>import("./LercWorker-e_UqPfL3.js"),__vite__mapDeps([])),MemorySourceWorker:()=>we(()=>import("./MemorySourceWorker-K3WXTL5J.js"),__vite__mapDeps([138,101,88,89,90,91,92,39,40,93,66,94,73,95,65,137,108])),PBFDecoderWorker:()=>we(()=>import("./PBFDecoderWorker--NqrOA1Y.js"),__vite__mapDeps([139,76,77])),Pipeline:()=>we(()=>import("./Pipeline--6jAENf8.js").then(t=>t.P),__vite__mapDeps([140,92,39,40,93,66,94,73,141,91,142,106,107,108,65,75,76,77,52,143,122,144,145,87])),PointCloudWorker:()=>we(()=>import("./PointCloudWorker-UgniuzRB.js"),__vite__mapDeps([146,147,113])),RasterWorker:()=>we(()=>import("./RasterWorker-0s4_fI9v.js"),__vite__mapDeps([148,72,82,81])),SceneLayerSnappingSourceWorker:()=>we(()=>import("./SceneLayerSnappingSourceWorker-gaKuqg8q.js"),__vite__mapDeps([])),SceneLayerWorker:()=>we(()=>import("./SceneLayerWorker-o7OZRrjZ.js").then(t=>t.S),__vite__mapDeps([149,150])),WFSSourceWorker:()=>we(()=>import("./WFSSourceWorker-iUwpu94Y.js"),__vite__mapDeps([151,88,89,90,91,92,39,40,93,66,94,73,95,107,108,137,124,125])),WorkerTileHandler:()=>we(()=>import("./WorkerTileHandler-9KieSe2P.js"),__vite__mapDeps([152,121,120,122,153,77,154,155]))};var Gl;(function(t){t[t.HANDSHAKE=0]="HANDSHAKE",t[t.OPEN=1]="OPEN",t[t.OPENED=2]="OPENED",t[t.RESPONSE=3]="RESPONSE",t[t.INVOKE=4]="INVOKE",t[t.ABORT=5]="ABORT",t[t.CLOSE=6]="CLOSE",t[t.OPEN_PORT=7]="OPEN_PORT",t[t.ON=8]="ON"})(Gl||(Gl={}));let qpt=0;function l4e(){return qpt++}function Wpt(t){return t&&typeof t=="object"&&("result"in t||"transferList"in t)}function SL(t){return t?typeof t=="string"?JSON.stringify({name:"message",message:t}):t.toJSON?JSON.stringify(t):JSON.stringify({name:t.name,message:t.message,details:t.details||{stack:t.stack}}):null}function Woe(t,e,i,r){if(e.type===Gl.OPEN_PORT)return void t.postMessage(e,[e.port]);if(e.type!==Gl.INVOKE&&e.type!==Gl.RESPONSE)return void t.postMessage(e);let n;if(Wpt(i)?(n=E0e(i.transferList),e.data=i.result):(n=E0e(r),e.data=i),n){if(Le("ff")){for(const s of n)if("byteLength"in s&&s.byteLength>267386880){const o="Worker call with large ArrayBuffer would crash Firefox";switch(e.type){case Gl.INVOKE:throw o;case Gl.RESPONSE:return void Woe(t,{type:Gl.RESPONSE,jobId:e.jobId,error:SL(o)})}}}t.postMessage(e,n)}else t.postMessage(e)}function TL(t){if(!t)return null;const e=t.data;return e?typeof e=="string"?JSON.parse(e):e:null}function E0e(t){if(!(t!=null&&t.length))return null;if(Le("esri-workers-arraybuffer-transfer"))return t;const e=t.filter(i=>!Ypt(i));return e.length?e:null}function Ypt(t){var e;return t instanceof ArrayBuffer||((e=t==null?void 0:t.constructor)==null?void 0:e.name)==="ArrayBuffer"}const{CLOSE:C0e,ABORT:A0e,INVOKE:M0e,RESPONSE:QP,OPEN_PORT:O0e,ON:Xpt}=Gl,Zpt=2;let Jpt=class{constructor(e){this._timer=null,this._cancelledJobIds=new Set,this._invokeMessages=[],this._invoke=e,this._timer=null,this._process=this._process.bind(this)}push(e){e.type===Gl.ABORT?this._cancelledJobIds.add(e.jobId):(this._invokeMessages.push(e),this._timer===null&&(this._timer=setTimeout(this._process,0)))}clear(){this._invokeMessages.length=0,this._cancelledJobIds.clear(),this._timer=null}_process(){this._timer=null;for(const e of this._invokeMessages)this._cancelledJobIds.has(e.jobId)||this._invoke(e);this._cancelledJobIds.clear(),this._invokeMessages.length=0}},z2=class DA{static connect(e){const i=new MessageChannel;let r;r=typeof e=="function"?new e:"default"in e&&typeof e.default=="function"?new e.default:e;const n=new DA(i.port1,{channel:i,client:r});return typeof r=="object"&&"remoteClient"in r&&(r.remoteClient=n),DA.clients.set(n,r),i.port2}static loadWorker(e){const i=Hpt[e];return i?i():Promise.resolve(null)}constructor(e,i,r){this._port=e,this._jobQueue=r,this._outJobs=new Map,this._inJobs=new Map,this._invokeQueue=new Jpt(n=>this._onInvokeMessage(n)),this._client=i.client,this._onMessage=this._onMessage.bind(this),this._channel=i.channel,this._schedule=i.schedule,this._port.addEventListener("message",this._onMessage),this._port.start()}close(){this._post({type:C0e}),this._close()}isBusy(){return this._outJobs.size>0}invoke(e,i,r){const n=r==null?void 0:r.signal,s=r==null?void 0:r.transferList;if(!this._port)return Promise.reject(new se("worker:port-closed",`Cannot call invoke('${e}'), port is closed`,{methodName:e,data:i}));const o=l4e();return new Promise((l,c)=>{if(xo(n))return this._processWork(),void c(ur());const f=Yl(n,()=>{const x=this._outJobs.get(o);x&&(this._outJobs.delete(o),this._processWork(),en(x.abortHandle),this._post({type:A0e,jobId:o}),c(ur()))}),_={resolve:l,reject:c,abortHandle:f,debugInfo:e};this._outJobs.set(o,_),this._post({type:M0e,jobId:o,methodName:e,abortable:n!=null},i,s)})}on(e,i){const r=new MessageChannel;function n(s){i(s.data)}return this._port.postMessage({type:Gl.ON,eventType:e,port:r.port2},[r.port2]),r.port1.addEventListener("message",n),r.port1.start(),rr(()=>{r.port1.postMessage({type:Gl.CLOSE}),r.port1.close(),r.port1.removeEventListener("message",n)})}jobAdded(){this._processWork()}openPort(){const e=new MessageChannel;return this._post({type:O0e,port:e.port2}),e.port1}_processWork(){var o;if(this._outJobs.size>=Zpt)return;const e=(o=this._jobQueue)==null?void 0:o.pop();if(!e)return;const{methodName:i,data:r,invokeOptions:n,resolver:s}=e;this.invoke(i,r,n).then(l=>s.resolve(l)).catch(l=>s.reject(l))}_close(){this._channel&&(this._channel=void 0),this._port.removeEventListener("message",this._onMessage),this._port.close(),this._outJobs.forEach(e=>{en(e.abortHandle),e.reject(ur(`Worker closing, aborting job calling '${e.debugInfo}'`))}),this._inJobs.clear(),this._outJobs.clear(),this._invokeQueue.clear(),this._port=null,this._client=null,this._schedule=null}_onMessage(e){this._schedule!=null?this._schedule(()=>this._processMessage(e)):this._processMessage(e)}_processMessage(e){const i=TL(e);if(i)switch(i.type){case QP:this._onResponseMessage(i);break;case M0e:this._invokeQueue.push(i);break;case A0e:this._onAbortMessage(i);break;case C0e:this._onCloseMessage();break;case O0e:this._onOpenPortMessage(i);break;case Xpt:this._onOnMessage(i)}}_onAbortMessage(e){const i=this._inJobs,r=e.jobId,n=i.get(r);this._invokeQueue.push(e),n&&(n.controller&&n.controller.abort(),i.delete(r))}_onCloseMessage(){const e=this._client;this._close(),e&&"destroy"in e&&DA.clients.get(this)===e&&e.destroy(),DA.clients.delete(this),e!=null&&e.remoteClient&&(e.remoteClient=null)}_onInvokeMessage(e){const{methodName:i,jobId:r,data:n,abortable:s}=e,o=s?new AbortController:null,l=this._inJobs;let c,f=this._client,_=f[i];try{if(!_&&i&&i.includes(".")){const x=i.split(".");for(let T=0;T{l.has(r)&&(l.delete(r),this._post({type:QP,jobId:r},x))},x=>{l.has(r)&&(l.delete(r),sn(x)||this._post({type:QP,jobId:r,error:SL(x||{message:`Error encountered at method ${i}`})}))})):this._post({type:QP,jobId:r},c)}_onOpenPortMessage(e){new DA(e.port,{client:this._client})}_onOnMessage(e){const{port:i}=e,r=this._client.on(e.eventType,s=>{i.postMessage(s)}),n=Y5(e.port,"message",s=>{const o=TL(s);(o==null?void 0:o.type)===Gl.CLOSE&&(n.remove(),r.remove(),i.close())})}_onResponseMessage(e){const{jobId:i,error:r,data:n}=e,s=this._outJobs;if(!s.has(i))return;const o=s.get(i);s.delete(i),this._processWork(),en(o.abortHandle),r?o.reject(se.fromJSON(JSON.parse(r))):o.resolve(n)}_post(e,i,r){return Woe(this._port,e,i,r)}};z2.kernelInfo={buildDate:_Ee,fullVersion:Ine,revision:bEe},z2.clients=new Map;let Kpt=class{constructor(){this._inUseClients=new Array,this._clients=new Array,this._clientPromises=new Array,this._ongoingJobsQueue=new cU}destroy(){this.close()}get closed(){var e;return!((e=this._clients)!=null&&e.length)}open(e,i){return new Promise((r,n)=>{let s=!0;const o=l=>{St(i.signal),s&&(s=!1,l())};this._clients.length=e.length,this._clientPromises.length=e.length,this._inUseClients.length=e.length;for(let l=0;l(this._clients[l]=new z2(f,i,this._ongoingJobsQueue),o(r),this._clients[l]),()=>(o(n),null)):(this._clients[l]=new z2(c,i,this._ongoingJobsQueue),this._clientPromises[l]=Promise.resolve(this._clients[l]),o(r))}})}broadcast(e,i,r){const n=new Array(this._clientPromises.length);for(let s=0;sl==null?void 0:l.invoke(e,i,r))}return n}close(){let e;for(;e=this._ongoingJobsQueue.pop();)e.resolver.reject(ur(`Worker closing, aborting job calling '${e.methodName}'`));for(const i of this._clientPromises)i.then(r=>r==null?void 0:r.close());this._clients.length=0,this._clientPromises.length=0,this._inUseClients.length=0,Gpt(this)}invoke(e,i,r){let n;Array.isArray(r)?(Ce.getLogger("esri.core.workers.Connection").warn("invoke()","The transferList parameter is deprecated, use the options object instead"),n={transferList:r}):n=r;const s=Jl();this._ongoingJobsQueue.push({methodName:e,data:i,invokeOptions:n,resolver:s});for(let o=0;oc==null?void 0:c.jobAdded())}return s.promise}on(e,i){return Promise.all(this._clientPromises).then(()=>id(this._clients.map(r=>r.on(e,i))))}openPorts(){return new Promise(e=>{const i=new Array(this._clientPromises.length);let r=i.length;for(let n=0;n{s&&(i[n]=s.openPort()),--r==0&&e(i)})})}get test(){return{numClients:this._clients.length}}};const Qpt={async request(t,e){var o,l;const i=t.options,r=i.responseType;i.signal=e==null?void 0:e.signal,i.responseType=r==="native"||r==="native-request-init"?"native-request-init":r&&["blob","json","text"].includes(r)&&((o=pEe(t.url))!=null&&o.after)?r:"array-buffer";const n=await bi(t.url,i),s={data:n.data,httpStatus:n.httpStatus,ssl:n.ssl};switch((l=n.requestOptions)==null?void 0:l.responseType){case"native-request-init":return delete s.data.signal,s;case"blob":s.data=await s.data.arrayBuffer();break;case"json":s.data=new TextEncoder().encode(JSON.stringify(s.data)).buffer;break;case"text":s.data=new TextEncoder().encode(s.data).buffer}return{result:s,transferList:[s.data]}}},eft={};function tft(t){var i;const e={async:t.async,isDebug:t.isDebug,locale:t.locale,baseUrl:t.baseUrl,has:{...t.has},map:{...t.map},packages:((i=t.packages)==null?void 0:i.concat())||[],paths:{...t.paths}};return t.hasOwnProperty("async")||(e.async=!0),t.hasOwnProperty("isDebug")||(e.isDebug=!1),t.baseUrl||(e.baseUrl=eft.baseUrl),e}let ift=class{constructor(){const e=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach(i=>{this[i]=(...r)=>e[i](...r)})}},AF=class{constructor(){this._dispatcher=new ift,this._workerPostMessage({type:Gl.HANDSHAKE})}terminate(){}get onmessage(){return this._onmessageHandler}set onmessage(e){this._onmessageHandler&&this.removeEventListener("message",this._onmessageHandler),this._onmessageHandler=e,e&&this.addEventListener("message",e)}get onmessageerror(){return this._onmessageerrorHandler}set onmessageerror(e){this._onmessageerrorHandler&&this.removeEventListener("messageerror",this._onmessageerrorHandler),this._onmessageerrorHandler=e,e&&this.addEventListener("messageerror",e)}get onerror(){return this._onerrorHandler}set onerror(e){this._onerrorHandler&&this.removeEventListener("error",this._onerrorHandler),this._onerrorHandler=e,e&&this.addEventListener("error",e)}postMessage(e){kO(()=>{this._workerMessageHandler(new MessageEvent("message",{data:e}))})}dispatchEvent(e){return this._dispatcher.dispatchEvent(e)}addEventListener(e,i,r){this._dispatcher.addEventListener(e,i,r)}removeEventListener(e,i,r){this._dispatcher.removeEventListener(e,i,r)}_workerPostMessage(e){kO(()=>{this.dispatchEvent(new MessageEvent("message",{data:e}))})}async _workerMessageHandler(e){const i=TL(e);if(i&&i.type===Gl.OPEN){const{modulePath:r,jobId:n}=i;let s=await z2.loadWorker(r);s||(s=await we(()=>import(r),__vite__mapDeps([])));const o=z2.connect(s);this._workerPostMessage({type:Gl.OPENED,jobId:n,data:o})}}};const fee=Ce.getLogger("esri.core.workers.workerFactory"),{HANDSHAKE:rft}=Gl,nft='let globalId=0;const outgoing=new Map,configuration=JSON.parse("{CONFIGURATION}");self.esriConfig=configuration.esriConfig;const workerPath=self.esriConfig.workers.workerPath,HANDSHAKE=0,OPEN=1,OPENED=2,RESPONSE=3,INVOKE=4,ABORT=5;function createAbortError(){const e=new Error("Aborted");return e.name="AbortError",e}function receiveMessage(e){return e&&e.data?"string"==typeof e.data?JSON.parse(e.data):e.data:null}function invokeStaticMessage(e,o,r){const t=r&&r.signal,n=globalId++;return new Promise(((r,s)=>{if(t){if(t.aborted)return s(createAbortError());t.addEventListener("abort",(()=>{outgoing.get(n)&&(outgoing.delete(n),self.postMessage({type:ABORT,jobId:n}),s(createAbortError()))}))}outgoing.set(n,{resolve:r,reject:s}),self.postMessage({type:INVOKE,jobId:n,methodName:e,abortable:null!=t,data:o})}))}let workerRevisionChecked=!1;function checkWorkerRevision(e){if(!workerRevisionChecked&&e.kernelInfo){workerRevisionChecked=!0;const{revision:o,fullVersion:r}=configuration.kernelInfo,{revision:t,fullVersion:n,version:s}=e.kernelInfo;esriConfig.assetsPath!==esriConfig.defaultAssetsPath&&o!==t&&console.warn(`Version mismatch detected between ArcGIS Maps SDK for JavaScript modules and assets. For more information visit https://bit.ly/3QnsuSo.\\nModules version: ${r}\\nAssets version: ${n??s}\\nAssets path: ${esriConfig.assetsPath}`)}}function messageHandler(e){const o=receiveMessage(e);if(!o)return;const r=o.jobId;switch(o.type){case OPEN:let n;function t(e){const o=n.connect(e);self.postMessage({type:OPENED,jobId:r,data:o},[o])}"function"==typeof define&&define.amd?require([workerPath],(e=>{n=e.default||e,checkWorkerRevision(n),n.loadWorker(o.modulePath).then((e=>e||new Promise((e=>{require([o.modulePath],e)})))).then(t)})):"System"in self&&"function"==typeof System.import?System.import(workerPath).then((e=>(n=e.default,checkWorkerRevision(n),n.loadWorker(o.modulePath)))).then((e=>e||System.import(o.modulePath))).then(t):esriConfig.workers.useDynamicImport?import(workerPath).then((e=>{n=e.default||e,checkWorkerRevision(n),n.loadWorker(o.modulePath).then((e=>e||import(o.modulePath))).then(t)})):(self.RemoteClient||importScripts(workerPath),n=self.RemoteClient.default||self.RemoteClient,checkWorkerRevision(n),n.loadWorker(o.modulePath).then(t));break;case RESPONSE:if(outgoing.has(r)){const s=outgoing.get(r);outgoing.delete(r),o.error?s.reject(JSON.parse(o.error)):s.resolve(o.data)}}}self.dojoConfig=configuration.loaderConfig,esriConfig.workers.loaderUrl&&(self.importScripts(esriConfig.workers.loaderUrl),"function"==typeof require&&"function"==typeof require.config&&require.config(configuration.loaderConfig)),self.addEventListener("message",messageHandler),self.postMessage({type:0});';let TD,ED;const P0e="Failed to create Worker. Fallback to execute module in main thread";async function sft(){if(!Le("esri-workers"))return R0e(new AF);if(!TD&&!ED)try{const e=nft.split('"{CONFIGURATION}"').join(`'${oft()}'`);TD=URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}catch(e){ED=e||{}}let t;if(TD)try{t=new Worker(TD,{name:"esri-worker-"+aft++})}catch{fee.warn(P0e,ED),t=new AF}else fee.warn(P0e,ED),t=new AF;return R0e(t)}async function R0e(t){return new Promise(e=>{function i(n){const s=TL(n);s&&s.type===rft&&(t.removeEventListener("message",i),t.removeEventListener("error",r),e(t))}function r(n){n.preventDefault(),t.removeEventListener("message",i),t.removeEventListener("error",r),fee.warn("Failed to create Worker. Fallback to execute module in main thread",n),(t=new AF).addEventListener("message",i),t.addEventListener("error",r)}t.addEventListener("message",i),t.addEventListener("error",r)})}function oft(){let t;if(Ar.default!=null){const n={...Ar};delete n.default,t=JSON.parse(JSON.stringify(n))}else t=JSON.parse(JSON.stringify(Ar));t.assetsPath=Gh(t.assetsPath),t.defaultAssetsPath=t.defaultAssetsPath?Gh(t.defaultAssetsPath):void 0,t.request.interceptors=[],t.log.interceptors=[],t.locale=fa(),t.has={"esri-csp-restrictions":Le("esri-csp-restrictions"),"esri-2d-debug":!1,"esri-2d-update-debug":Le("esri-2d-update-debug"),"esri-2d-log-updating":Le("esri-2d-log-updating"),"featurelayer-pbf":Le("featurelayer-pbf"),"featurelayer-simplify-thresholds":Le("featurelayer-simplify-thresholds"),"featurelayer-simplify-payload-size-factors":Le("featurelayer-simplify-payload-size-factors"),"featurelayer-simplify-mobile-factor":Le("featurelayer-simplify-mobile-factor"),"esri-atomics":Le("esri-atomics"),"esri-shared-array-buffer":Le("esri-shared-array-buffer"),"esri-tiles-debug":Le("esri-tiles-debug"),"esri-workers-arraybuffer-transfer":Le("esri-workers-arraybuffer-transfer"),"feature-polyline-generalization-factor":Le("feature-polyline-generalization-factor"),"host-webworker":1},t.workers.loaderUrl&&(t.workers.loaderUrl=Gh(t.workers.loaderUrl)),t.workers.workerPath?t.workers.workerPath=Gh(t.workers.workerPath):t.workers.workerPath=Gh(Wr("esri/core/workers/RemoteClient.js")),t.workers.useDynamicImport=!1;const e=Ar.workers.loaderConfig,i=tft({baseUrl:e==null?void 0:e.baseUrl,locale:fa(),has:{"csp-restrictions":1,"dojo-test-sniff":0,"host-webworker":1,...e==null?void 0:e.has},map:{...e==null?void 0:e.map},paths:{...e==null?void 0:e.paths},packages:(e==null?void 0:e.packages)||[]});return JSON.stringify({esriConfig:t,loaderConfig:i,kernelInfo:{buildDate:_Ee,fullVersion:Ine,revision:bEe}})}let aft=0;const{ABORT:I0e,INVOKE:lft,OPEN:cft,OPENED:uft,RESPONSE:eR}=Gl;let hft=class c4e{static async create(e){const i=await sft();return new c4e(i,e)}constructor(e,i){this._outJobs=new Map,this._inJobs=new Map,this.worker=e,this.id=i,e.addEventListener("message",this._onMessage.bind(this)),e.addEventListener("error",r=>{r.preventDefault(),Ce.getLogger("esri.core.workers.WorkerOwner").error(r)})}terminate(){this.worker.terminate()}async open(e,i={}){const{signal:r}=i,n=l4e();return new Promise((s,o)=>{const l={resolve:s,reject:o,abortHandle:g9(r,()=>{this._outJobs.delete(n),this._post({type:I0e,jobId:n})})};this._outJobs.set(n,l),this._post({type:cft,jobId:n,modulePath:e})})}_onMessage(e){const i=TL(e);if(i)switch(i.type){case uft:this._onOpenedMessage(i);break;case eR:this._onResponseMessage(i);break;case I0e:this._onAbortMessage(i);break;case lft:this._onInvokeMessage(i)}}_onAbortMessage(e){const i=this._inJobs,r=e.jobId,n=i.get(r);n&&(n.controller&&n.controller.abort(),i.delete(r))}_onInvokeMessage(e){const{methodName:i,jobId:r,data:n,abortable:s}=e,o=s?new AbortController:null,l=this._inJobs,c=Qpt[i];let f;try{if(typeof c!="function")throw new TypeError(`${i} is not a function`);f=c.call(null,n,{signal:o?o.signal:null})}catch(_){return void this._post({type:eR,jobId:r,error:SL(_)})}pd(f)?(l.set(r,{controller:o,promise:f}),f.then(_=>{l.has(r)&&(l.delete(r),this._post({type:eR,jobId:r},_))},_=>{l.has(r)&&(l.delete(r),_||(_={message:"Error encountered at method"+i}),sn(_)||this._post({type:eR,jobId:r,error:SL(_||{message:`Error encountered at method ${i}`})}))})):this._post({type:eR,jobId:r},f)}_onOpenedMessage(e){const{jobId:i,data:r}=e,n=this._outJobs.get(i);n&&(this._outJobs.delete(i),en(n.abortHandle),n.resolve(r))}_onResponseMessage(e){const{jobId:i,error:r,data:n}=e,s=this._outJobs.get(i);s&&(this._outJobs.delete(i),en(s.abortHandle),r?s.reject(se.fromJSON(JSON.parse(r))):s.resolve(n))}_post(e,i,r){return Woe(this.worker,e,i,r)}};const $0e=Le("host-browser")?Math.min(navigator.hardwareConcurrency-1,Le("workers-pool-size")):0;let JS=Le("esri-mobile")?Math.min($0e,3):$0e;JS||(JS=Le("safari")&&Le("mac")?7:2);let L0e=0;const MF=[];function dft(){u4e()}async function CD(t,e){const i=new Kpt,{registryTarget:r,...n}=e;return await i.open(t,n),r&&jpt(r,i),i}async function pft(t,e={}){if(typeof t!="string")throw new se("workers:undefined-module","modulePath is missing");let i=e.strategy||"distributed";if(Le("host-webworker")&&!Le("esri-workers")&&(i="local"),i==="local"){let r=await z2.loadWorker(t);r||(r=await we(()=>import(t),__vite__mapDeps([]))),St(e.signal);const n=e.client||r;return CD([z2.connect(r)],{...e,client:n})}if(await u4e(),St(e.signal),i==="dedicated"){const r=L0e++%JS;return CD([await MF[r].open(t,e)],e)}if(e.maxNumWorkers&&e.maxNumWorkers>0){const r=Math.min(e.maxNumWorkers,JS);if(rr.open(t,e)),e)}let AD=null;async function u4e(){if(AD)return AD;new AbortController;const t=[];for(let e=0;e(MF[e]=r,r));t.push(i)}return AD=Promise.all(t),AD}function mj(t,e,i,r){return t!=null&&(Zn(e,r)?(d_(i,t),!0):(sh[0]=t[0],sh[1]=t[1],sh[2]=0,!!vn(sh,e,0,sh,r,0,1)&&(i[0]=sh[0],i[1]=sh[1],sh[0]=t[2],sh[1]=t[3],sh[2]=0,!!vn(sh,e,0,sh,r,0,1)&&(i[2]=sh[0],i[3]=sh[1],!0))))}const sh=W();function ud(t,e,i,r=0){MD[0]=t.x,MD[1]=t.y;const n=t.z;return MD[2]=n!==void 0?n:r,vn(MD,t.spatialReference,0,e,i,0,1)}const MD=W();function jm(t){return t?{origin:Xr(t.origin),vector:Xr(t.vector)}:{origin:W(),vector:W()}}function fft(t,e){const i=gft.get();return i.origin=t,i.vector=e,i}function xei(t,e=jm()){return mft(t.origin,t.vector,e)}function mft(t,e,i=jm()){return Ne(i.origin,t),Ne(i.vector,e),i}function gT(t,e,i=jm()){return Ne(i.origin,t),je(i.vector,e,t),i}function Yoe(t,e){const i=je(xt.get(),e,t.origin),r=Ve(t.vector,i),n=Ve(t.vector,t.vector),s=Je(r/n,0,1),o=je(xt.get(),De(xt.get(),t.vector,s),i);return Ve(o,o)}function Sei(t,e,i){return mee(t,e,0,1,i)}function Tei(t,e,i){return Be(i,t.origin,De(i,t.vector,e))}function mee(t,e,i,r,n){const{vector:s,origin:o}=t,l=je(xt.get(),e,o),c=Ve(s,l)/El(s);return De(n,s,Je(c,i,r)),Be(n,n,t.origin)}function Eei(t,e){if(d4e(t,fft(e.origin,e.direction),!1,uU)){const{tA:i,pB:r,distance2:n}=uU;if(i>=0&&i<=1)return n;if(i<0)return Co(t.origin,r);if(i>1)return Co(Be(xt.get(),t.origin,t.vector),r)}return null}function h4e(t,e,i){return!!d4e(t,e,!0,uU)&&(Ne(i,uU.pA),!0)}function d4e(t,e,i,r){const s=t.origin,o=Be(xt.get(),s,t.vector),l=e.origin,c=Be(xt.get(),l,e.vector),f=xt.get(),_=xt.get();if(f[0]=s[0]-l[0],f[1]=s[1]-l[1],f[2]=s[2]-l[2],_[0]=c[0]-l[0],_[1]=c[1]-l[1],_[2]=c[2]-l[2],Math.abs(_[0])<1e-6&&Math.abs(_[1])<1e-6&&Math.abs(_[2])<1e-6)return!1;const x=xt.get();if(x[0]=o[0]-s[0],x[1]=o[1]-s[1],x[2]=o[2]-s[2],Math.abs(x[0])<1e-6&&Math.abs(x[1])<1e-6&&Math.abs(x[2])<1e-6)return!1;const T=f[0]*_[0]+f[1]*_[1]+f[2]*_[2],A=_[0]*x[0]+_[1]*x[1]+_[2]*x[2],M=f[0]*x[0]+f[1]*x[1]+f[2]*x[2],I=_[0]*_[0]+_[1]*_[1]+_[2]*_[2],L=(x[0]*x[0]+x[1]*x[1]+x[2]*x[2])*I-A*A;if(Math.abs(L)<1e-6)return!1;let F=(T*A-M*I)/L,z=(T+A*F)/I;i&&(F=Je(F,0,1),z=Je(z,0,1));const k=xt.get(),U=xt.get();return k[0]=s[0]+F*x[0],k[1]=s[1]+F*x[1],k[2]=s[2]+F*x[2],U[0]=l[0]+z*_[0],U[1]=l[1]+z*_[1],U[2]=l[2]+z*_[2],r.tA=F,r.tB=z,r.pA=k,r.pB=U,r.distance2=Co(k,U),!0}const uU={tA:0,tB:0,pA:W(),pB:W(),distance2:0},gft=new k_(()=>jm()),ZH=Ce.getLogger("esri.views.3d.support.geometryUtils.boundedPlane");let yft=class{constructor(){this.plane=Fi(),this.origin=W(),this.basis1=W(),this.basis2=W()}};const p4e=yft;function U_(t=T4e){return{plane:Fi(t.plane),origin:Xr(t.origin),basis1:Xr(t.basis1),basis2:Xr(t.basis2)}}function vft(t,e,i){const r=Pft.get();return r.origin=t,r.basis1=e,r.basis2=i,r.plane=Rut(0,0,0,0),gj(r),r}function wE(t,e=U_()){return Xoe(t.origin,t.basis1,t.basis2,e)}function _ft(t,e){Ne(e.origin,t.origin),Ne(e.basis1,t.basis1),Ne(e.basis2,t.basis2),uj(e.plane,t.plane)}function Xoe(t,e,i,r=U_()){return Ne(r.origin,t),Ne(r.basis1,e),Ne(r.basis2,i),gj(r),Mft(r,"fromValues()"),r}function gj(t){xL(t.basis2,t.basis1,t.origin,t.plane)}function f4e(t,e,i){t!==i&&wE(t,i);const r=De(xt.get(),b_(t),e);return Be(i.origin,i.origin,r),i.plane[3]-=e,i}function bft(t,e,i){return m4e(e,i),f4e(i,Qoe(t,t.origin),i),i}function m4e(t,e=U_()){const i=(t[2]-t[0])/2,r=(t[3]-t[1])/2;return Ie(e.origin,t[0]+i,t[1]+r,0),Ie(e.basis1,i,0,0),Ie(e.basis2,0,r,0),Foe(0,0,1,0,e.plane),e}function Zoe(t,e,i){return!!bE(t.plane,e,i)&&x4e(t,i)}function wft(t,e,i){if(Zoe(t,e,i))return i;const r=g4e(t,e,xt.get());return Be(i,e.origin,De(xt.get(),e.direction,Sn(e.origin,r)/rt(e.direction))),i}function g4e(t,e,i){const r=hU.get();S4e(t,e,r,hU.get());let n=Number.POSITIVE_INFINITY;for(const s of tae){const o=eae(t,s,yj.get()),l=xt.get();if(Lut(r,o,l)){const c=R_(xt.get(),e.origin,l),f=Math.abs(Ca(Ve(e.direction,c)));fi&&(i=s)}return Math.sqrt(i)}function Koe(t,e){return zoe(t.plane,e)&&x4e(t,e)}function Tft(t,e,i,r){return Aft(t,i,r)}function Qoe(t,e){const i=-t.plane[3];return y2(b_(t),e)-i}function Eft(t,e,i,r){const n=Qoe(t,e),s=De(Oft,b_(t),i-n);return Be(r,e,s),r}function b4e(t,e){return jr(t.basis1,e.basis1)&&jr(t.basis2,e.basis2)&&jr(t.origin,e.origin)}function w4e(t,e,i){return t!==i&&wE(t,i),Vo(WE,e),ld(WE,WE),bt(i.basis1,t.basis1,WE),bt(i.basis2,t.basis2,WE),bt(i.plane,t.plane,WE),bt(i.origin,t.origin,e),xQ(i.plane,i.plane,i.origin),i}function Cft(t,e,i,r){return t!==r&&wE(t,r),xp(JH,e,i),bt(r.basis1,t.basis1,JH),bt(r.basis2,t.basis2,JH),gj(r),r}function b_(t){return t.plane}function Aft(t,e,i){switch(e){case Ms.X:Ne(i,t.basis1),Ye(i,i);break;case Ms.Y:Ne(i,t.basis2),Ye(i,i);break;case Ms.Z:Ne(i,b_(t))}return i}function x4e(t,e){const i=je(xt.get(),e,t.origin),r=El(t.basis1),n=El(t.basis2),s=Ve(t.basis1,i),o=Ve(t.basis2,i);return-s-r<0&&s-r<0&&-o-n<0&&o-n<0}function D0e(t,e){const i=yj.get();return Ne(i.origin,t.origin),Ne(i.vector,e),i}function eae(t,e,i){const{basis1:r,basis2:n,origin:s}=t,o=De(xt.get(),r,e.origin[0]),l=De(xt.get(),n,e.origin[1]);Be(i.origin,o,l),Be(i.origin,i.origin,s);const c=De(xt.get(),r,e.direction[0]),f=De(xt.get(),n,e.direction[1]);return De(i.vector,Be(c,c,f),2),i}function Mft(t,e){Math.abs(Ve(t.basis1,t.basis2)/(rt(t.basis1)*rt(t.basis2)))>1e-6&&ZH.warn(e,"Provided basis vectors are not perpendicular"),Math.abs(Ve(t.basis1,b_(t)))>1e-6&&ZH.warn(e,"Basis vectors and plane normal are not perpendicular"),Math.abs(-Ve(b_(t),t.origin)-t.plane[3])>1e-6&&ZH.warn(e,"Plane offset is not consistent with plane origin")}function S4e(t,e,i,r){const n=b_(t);xL(n,e.direction,e.origin,i),xL(i,n,e.origin,r)}const T4e={plane:Fi(),origin:nt(0,0,0),basis1:nt(1,0,0),basis2:nt(0,1,0)},hU=new k_(Fi),yj=new k_(jm),Oft=W(),Pft=new k_(()=>U_()),tae=[{origin:[-1,-1],direction:[1,0]},{origin:[1,-1],direction:[0,1]},{origin:[1,1],direction:[-1,0]},{origin:[-1,1],direction:[0,-1]}],WE=Qe(),JH=Qe(),Rft=Object.freeze(Object.defineProperty({__proto__:null,BoundedPlaneClass:p4e,altitudeAt:Qoe,axisAt:Tft,closestPoint:y4e,closestPointOnSilhouette:g4e,copy:wE,copyWithoutVerify:_ft,create:U_,distance:xft,distance2:Joe,distanceToSilhouette:Sft,elevate:f4e,equals:b4e,extrusionContainsPoint:Koe,fromAABoundingRect:m4e,fromValues:Xoe,intersectRay:Zoe,intersectRayClosestSilhouette:wft,normal:b_,projectPoint:v4e,projectPointLocal:_4e,rotate:Cft,setAltitudeAt:Eft,setExtent:bft,transform:w4e,up:T4e,updateUnboundedPlane:gj,wrap:vft},Symbol.toStringTag,{value:"Module"}));function Ift(t){const{value:e,operations:i}=t;return{operations:i,value:i.create(e)}}function $ft(t,e,i){return t.operations.setExtent(t.value,e,i.value),i}function Lft(t){return{operations:t,value:t.create()}}function E4e(t,e,i=Lft(t)){return i.operations=t,t.copy(e,i.value),i}function Dft(t){return E4e(Aut,tRe(0,0,0,Sr(t).radius))}const N0e=2**50;function Nft(){return E4e(Rft,Xoe([0,0,0],[N0e,0,0],[0,N0e,0]))}function Fft(t,e,i){return t.operations.axisAt(t.value,e,Ms.Z,i)}function kft(t,e,i,r){return t.operations.axisAt(t.value,e,i,r)}function zft(t,e,i){return t.operations.intersectRay(t.value,e,i)}function Uft(t,e,i){return t.operations.intersectRayClosestSilhouette(t.value,e,i)}function Vft(t,e){return t.operations.altitudeAt(t.value,e)}function C4e(t,e,i,r){return t.operations.setAltitudeAt(t.value,e,i,r)}function Bft(t,e,i,r){return e!==r&&Ao(r,e),Ie(YE,r[12],r[13],r[14]),C4e(t,YE,i,YE),r[12]=YE[0],r[13]=YE[1],r[14]=YE[2],r}function KH(t,e,i){return t.operations.elevate(t.value,e,i.value)}const YE=W();function F0e(t,e,i,r,n){return n[0]=Ve(t,e),n[1]=Ve(t,i),n[2]=Ve(t,r),n}function gee(t,e,i,r,n){Ne(i,t),Ne(OD,e),Ye(OD,OD),Wt(r,OD,i),Wt(n,r,i)}function jft(t,e){return t?Zf(e):e.isGeographic?at.PlateCarree:e}const OD=W(),Gft="OBJECTID";let y5=class extends YI{constructor(e){super(e),this.addHandles(this.on("before-add",i=>{i.item!=null&&i.item.parent===this.owner&&(Ce.getLogger(this).warn("Analysis inside the collection must be unique. Not adding this element again."),i.preventDefault())}))}_own(e){e.parent=this.owner}_release(e){e.parent=null}};y5=y([Z("esri.support.AnalysesCollection")],y5);const OF={widthBreakpoint:{getValue(t){const e=t.viewSize[0],i=t.breakpoints,r=this.values;return e<=i.xsmall?r.xsmall:e<=i.small?r.small:e<=i.medium?r.medium:e<=i.large?r.large:r.xlarge},values:{xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge"},valueToClassName:{xsmall:"esri-view-width-xsmall esri-view-width-less-than-small esri-view-width-less-than-medium esri-view-width-less-than-large esri-view-width-less-than-xlarge",small:"esri-view-width-small esri-view-width-greater-than-xsmall esri-view-width-less-than-medium esri-view-width-less-than-large esri-view-width-less-than-xlarge",medium:"esri-view-width-medium esri-view-width-greater-than-xsmall esri-view-width-greater-than-small esri-view-width-less-than-large esri-view-width-less-than-xlarge",large:"esri-view-width-large esri-view-width-greater-than-xsmall esri-view-width-greater-than-small esri-view-width-greater-than-medium esri-view-width-less-than-xlarge",xlarge:"esri-view-width-xlarge esri-view-width-greater-than-xsmall esri-view-width-greater-than-small esri-view-width-greater-than-medium esri-view-width-greater-than-large"}},heightBreakpoint:{getValue(t){const e=t.viewSize[1],i=t.breakpoints,r=this.values;return e<=i.xsmall?r.xsmall:e<=i.small?r.small:e<=i.medium?r.medium:e<=i.large?r.large:r.xlarge},values:{xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge"},valueToClassName:{xsmall:"esri-view-height-xsmall esri-view-height-less-than-small esri-view-height-less-than-medium esri-view-height-less-than-large esri-view-height-less-than-xlarge",small:"esri-view-height-small esri-view-height-greater-than-xsmall esri-view-height-less-than-medium esri-view-height-less-than-large esri-view-height-less-than-xlarge",medium:"esri-view-height-medium esri-view-height-greater-than-xsmall esri-view-height-greater-than-small esri-view-height-less-than-large esri-view-height-less-than-xlarge",large:"esri-view-height-large esri-view-height-greater-than-xsmall esri-view-height-greater-than-small esri-view-height-greater-than-medium esri-view-height-less-than-xlarge",xlarge:"esri-view-height-xlarge esri-view-height-greater-than-xsmall esri-view-height-greater-than-small esri-view-height-greater-than-medium esri-view-height-greater-than-large"}},orientation:{getValue(t){const e=t.viewSize,i=e[0],r=e[1],n=this.values;return r>=i?n.portrait:n.landscape},values:{portrait:"portrait",landscape:"landscape"},valueToClassName:{portrait:"esri-view-orientation-portrait",landscape:"esri-view-orientation-landscape"}}},QH={xsmall:544,small:768,medium:992,large:1200};function Hft(t){const e=t;return e&&e.xsmall{let e=class extends t{constructor(...i){super(...i),this.orientation=null,this.widthBreakpoint=null,this.heightBreakpoint=null,this.breakpoints=QH}initialize(){this.addHandles(_e(()=>[this.breakpoints,this.size],()=>this._updateClassNames(),ii))}destroy(){this.destroyed||this._removeActiveClassNames()}set breakpoints(i){if(i===this._get("breakpoints"))return;const r=Hft(i);if(!r){const n=JSON.stringify(QH,null,2);console.warn("provided breakpoints are not valid, using defaults:"+n)}i=r?i:QH,this._set("breakpoints",{...i})}_updateClassNames(){if(!this.container)return;const i=Uh.acquire(),r=Uh.acquire();let n,s=!1;for(n in OF){const o=this[n],l=OF[n].getValue({viewSize:this.size,breakpoints:this.breakpoints});o!==l&&(s=!0,this[n]=l,eq(n,o).forEach(c=>r.push(c)),eq(n,l).forEach(c=>i.push(c)))}s&&(this._applyClassNameChanges(i,r),Uh.release(i),Uh.release(r))}_applyClassNameChanges(i,r){const n=this.container;n&&(r.forEach(s=>n.classList.remove(s)),i.forEach(s=>n.classList.add(s)))}_removeActiveClassNames(){const i=this.container;if(!i)return;let r;for(r in OF)eq(r,this[r]).forEach(n=>i.classList.remove(n))}};return y([w()],e.prototype,"breakpoints",null),y([w()],e.prototype,"orientation",void 0),y([w()],e.prototype,"widthBreakpoint",void 0),y([w()],e.prototype,"heightBreakpoint",void 0),e=y([Z("esri.views.BreakpointsOwner")],e),e};let Rf=class extends ze{constructor(){super(...arguments),this.updating=!1,this._handleId=0,this._scheduleHandleId=0,this._pendingPromises=new Set}destroy(){this.removeAll()}add(e,i,r={}){return this._installWatch(e,i,r,_e)}addWhen(e,i,r={}){return this._installWatch(e,i,r,Mo)}addOnCollectionChange(e,i,{initial:r=!1,final:n=!1}={}){const s=++this._handleId;return this.addHandles([Jr(e,"after-changes",this._createSyncUpdatingCallback(),Li),Jr(e,"change",i,{onListenerAdd:r?o=>i({added:o.toArray(),removed:[]}):void 0,onListenerRemove:n?o=>i({added:[],removed:o.toArray()}):void 0})],s),rr(()=>this.removeHandles(s))}addPromise(e){if(e==null)return e;const i=++this._handleId;this.addHandles(rr(()=>{this._pendingPromises.delete(e)&&(this._pendingPromises.size!==0||this.hasHandles(PD)||this._set("updating",!1))}),i),this._pendingPromises.add(e),this._set("updating",!0);const r=()=>this.removeHandles(i);return e.then(r,r),e}removeAll(){this._pendingPromises.clear(),this.removeAllHandles(),this._set("updating",!1)}_installWatch(e,i,r={},n){const s=++this._handleId;r.sync||this._installSyncUpdatingWatch(e,s);const o=n(e,i,r);return this.addHandles(o,s),rr(()=>this.removeHandles(s))}_installSyncUpdatingWatch(e,i){const r=this._createSyncUpdatingCallback(),n=_e(e,r,{sync:!0,equals:()=>!1});return this.addHandles(n,i),n}_createSyncUpdatingCallback(){return()=>{this.removeHandles(PD),++this._scheduleHandleId;const e=this._scheduleHandleId;this._get("updating")||this._set("updating",!0),this.addHandles(tx(()=>{e===this._scheduleHandleId&&(this._set("updating",this._pendingPromises.size>0),this.removeHandles(PD))}),PD)}}};y([w({readOnly:!0})],Rf.prototype,"updating",void 0),Rf=y([Z("esri.core.support.UpdatingHandles")],Rf);const PD=-42;let nw=class extends ze{constructor(){super(...arguments),this.items=new it,this._watchUpdatingTracking=new Rf,this._callbacks=new Map,this._projector=pz(),this._hiddenProjector=pz()}get needsRender(){return this.items.length>0}get updating(){var e;return((e=this._watchUpdatingTracking)==null?void 0:e.updating)??!1}initialize(){const e=document.createElement("div");e.className="esri-overlay-surface",this._set("surface",e),this._hiddenSurface=document.createElement("div"),this._hiddenSurface.setAttribute("style","visibility: hidden;"),e.appendChild(this._hiddenSurface),this._watchUpdatingTracking.addOnCollectionChange(()=>this.items,i=>{for(const r of i.added){const n=()=>r.render();this._callbacks.set(r,n),this._projector.append(this.surface,n)}for(const r of i.removed){const n=this._projector.detach(this._callbacks.get(r));this.surface.removeChild(n.domNode),this._callbacks.delete(r)}})}addItem(e){this.items.add(e)}removeItem(e){this.items.remove(e)}destroy(){this.items.removeAll(),this._callbacks.forEach(e=>this._projector.detach(e)),this._callbacks=null,this._projector=null,this._watchUpdatingTracking.destroy()}render(){this._projector.renderNow()}computeBoundingRect(e){const i=this._hiddenSurface,r=this._hiddenProjector;let n;const s=()=>(n=e.render(),n);r.append(i,s),r.renderNow();const o={left:0,top:0,right:0,bottom:0};if(n!=null&&n.domNode){const l=n.domNode.getBoundingClientRect();o.left=l.left,o.top=l.top,o.right=l.right,o.bottom=l.bottom}for(r.detach(s);i.firstChild;)i.removeChild(i.firstChild);return o}overlaps(e,i){const r=this.computeBoundingRect(e),n=this.computeBoundingRect(i);return Math.max(r.left,n.left)<=Math.min(r.right,n.right)&&Math.max(r.top,n.top)<=Math.min(r.bottom,n.bottom)}get hasVisibleItems(){return this.items.some(e=>e.visible)}async prepare(){await document.fonts.load(this._fontString()).catch(()=>{})}renderCanvas(e,i){const r=!!(i!=null&&i.disableDecorations);if(!this.items.some(s=>s.visible&&!(r&&s.isDecoration)))return;const n=e.getContext("2d");n.save(),n.font=this._fontString(),this.items.forEach(s=>{r&&s.isDecoration||(n.save(),s.renderCanvas(n),n.restore())}),n.restore()}_fontString(){return`10px ${getComputedStyle(this.surface).fontFamily}`}};y([w({readOnly:!0})],nw.prototype,"surface",void 0),y([w({readOnly:!0})],nw.prototype,"items",void 0),y([w({readOnly:!0})],nw.prototype,"needsRender",null),y([w({readOnly:!0})],nw.prototype,"_watchUpdatingTracking",void 0),y([w({readOnly:!0})],nw.prototype,"updating",null),nw=y([Z("esri.views.overlay.ViewOverlay")],nw);const k0e=nw,tq=[0,0];function Wft(t){const e=(t.ownerDocument||window.document).defaultView,i=t.getBoundingClientRect();return tq[0]=i.left+((e==null?void 0:e.pageXOffset)??0),tq[1]=i.top+((e==null?void 0:e.pageYOffset)??0),tq}function z0e(t){t&&(CEe(t),t.parentNode&&t.parentNode.removeChild(t))}function Yft(t){const e=document.createElement("div");return t.appendChild(e),e}const tR=16,RD=750,Xft=512,Zft=2,Jft=t=>{let e=class extends t{constructor(...i){super(...i),this._freqInfo={freq:tR,time:RD},this._overlayRenderTaskHandle=null,this.height=0,this.messagesCommon=null,this.overlay=null,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.ui=null,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.addHandles([_e(()=>this.cursor,r=>{const{surface:n}=this;n&&n.setAttribute("data-cursor",r)}),_e(()=>this.navigating,r=>{const{surface:n}=this;n&&n.setAttribute("data-navigating",r.toString())})])}initialize(){const i=Le("mac"),r=async()=>{i&&(await rd(()=>this.ready),this.messagesCommon=await lE("esri/t9n/common").catch(()=>{}))};r(),this.addHandles([_e(()=>this.ui,(n,s)=>this._handleUIChange(n,s),ii),this.on("focus",()=>this.notifyChange("focused")),this.on("blur",()=>this.notifyChange("focused")),oE(r)])}destroy(){this.destroyed||(this.ui=et(this.ui),this.container=null)}get container(){return this._get("container")??null}set container(i){const r=this._get("container"),n=x9(i);if(n||typeof i!="string"||Ce.getLogger(this).error("#container",`element with id '${i}' not found`),r===n)return;if(this._stopMeasuring(),r&&(r.classList.remove("esri-view"),this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay&&(this.overlay.destroy(),this._set("overlay",null)),this.root&&(z0e(this.root),this._set("root",null)),this.userContent&&(dde(this.userContent,r),z0e(this.userContent),this._set("userContent",null))),!n)return this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),void this._set("container",null);n.classList.add("esri-view");const s=document.createElement("div");s.className="esri-view-user-storage",dde(n,s),n.appendChild(s),this._set("userContent",s);const o=document.createElement("div");o.className="esri-view-root",n.insertBefore(o,n.firstChild),this._set("root",o);const l=document.createElement("div");l.className="esri-view-surface",l.setAttribute("role","application"),l.tabIndex=0,o.appendChild(l),this._set("surface",l);const c=new k0e;o.appendChild(c.surface),this._set("overlay",c),this.addHandles(_e(()=>c.needsRender,f=>{f&&!this._overlayRenderTaskHandle?this._overlayRenderTaskHandle=AT({render:()=>{var _;return(_=this.overlay)==null?void 0:_.render()}}):this._overlayRenderTaskHandle=en(this._overlayRenderTaskHandle)})),this.forceDOMReadyCycle(),this._set("container",n),this._startMeasuring()}get focused(){const i=document.activeElement===this.surface;return document.hasFocus()&&i}get size(){return[this.width,this.height]}blur(){var i;(i=this.surface)==null||i.blur()}focus(){var i;(i=this.surface)==null||i.focus()}pageToContainer(i,r,n){const s=this.position;return i-=s?s[0]:0,r-=s?s[1]:0,n?(n[0]=i,n[1]=r):n=[i,r],n}containerToPage(i,r,n){const s=this.position;return i+=s?s[0]:0,r+=s?s[1]:0,n?(n[0]=i,n[1]=r):n=[i,r],n}_handleUIChange(i,r){this.removeHandles("ui"),r&&r!==i&&r.destroy(),i&&(i.view=this,this.addHandles(_e(()=>this.root,n=>{i.container=n?Yft(n):null},ii),"ui")),this._set("ui",i)}_stopMeasuring(){this.removeHandles("measuring"),this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const i=this._freqInfo;i.freq=tR,i.time=RD,this.addHandles([Y5(window,"resize",()=>{i.freq=tR,i.time=RD}),AT({prepare:r=>{const n=this._measure(),s=this._freqInfo;if(s.time+=r.deltaTime,n&&(s.freq=tR,this._get("resizing")||this._set("resizing",!0)),s.time=Xft&&this._get("resizing")&&this._set("resizing",!1)}})],"measuring"),this._measure(),this._position()}_measure(){const i=this.container,r=i?i.clientWidth:0,n=i?i.clientHeight:0;if(r===0||n===0)return this.suspended||this._set("suspended",!0),!1;const s=this.width,o=this.height;return r===s&&n===o?(this.suspended&&this._set("suspended",!1),!1):(this._set("width",r),this._set("height",n),this.suspended&&this._set("suspended",!1),this.emit("resize",{oldWidth:s,oldHeight:o,width:r,height:n}),!0)}_position(){const i=this.container,r=this.position,n=i&&Wft(i);return!!n&&(!r||n[0]!==r[0]||n[1]!==r[1])&&(this._set("position",[n[0],n[1]]),!0)}forceDOMReadyCycle(){}};return y([w()],e.prototype,"container",null),y([w({readOnly:!0})],e.prototype,"focused",null),y([w({readOnly:!0})],e.prototype,"height",void 0),y([w()],e.prototype,"messagesCommon",void 0),y([w({type:k0e})],e.prototype,"overlay",void 0),y([w({readOnly:!0})],e.prototype,"position",void 0),y([w({readOnly:!0})],e.prototype,"resizing",void 0),y([w({readOnly:!0})],e.prototype,"root",void 0),y([w({value:null,readOnly:!0})],e.prototype,"size",null),y([w({readOnly:!0})],e.prototype,"surface",void 0),y([w({readOnly:!0})],e.prototype,"suspended",void 0),y([w()],e.prototype,"ui",void 0),y([w({readOnly:!0})],e.prototype,"userContent",void 0),y([w({readOnly:!0})],e.prototype,"width",void 0),y([w()],e.prototype,"widthBreakpoint",void 0),e=y([Z("esri.views.DOMContainer")],e),e};function Xu(t,e,i,r){return{x:t,y:e,z:i,hasZ:i!=null,hasM:!1,spatialReference:r,type:"point"}}async function dU(t,e,i,r,n){r??(r=0);const s=t.spatialReference;if(th(s,i)||s==null||i==null||Zn(s,i))return ID[0]=t.x,ID[1]=t.y,ID[2]=t.z??r,void vn(ID,t.spatialReference,0,e,i,0,1);const o=Xu(t.x,t.y,t.z??r,s),l=await qy(o,i,n);e[0]=l.x,e[1]=l.y,e[2]=l.z??0}const ID=W();function w_(t,e,i){if(e==null||i==null)return null;const r=new mt({spatialReference:i});return vn(t,e,0,$D,i,0,1)?(r.x=$D[0],r.y=$D[1],r.z=$D[2],r):null}const $D=W();async function A4e(t,e,i,r){const n=w_(t,e,i);if(n!=null)return n;const s=new mt({x:t[0],y:t[1],z:t[2],spatialReference:e,hasZ:!0});return qy(s,i,r)}var ms,tl;(function(t){t[t.OBJECT=0]="OBJECT",t[t.HUD=1]="HUD",t[t.TERRAIN=2]="TERRAIN",t[t.OVERLAY=3]="OVERLAY",t[t.I3S=4]="I3S",t[t.PCL=5]="PCL",t[t.LOD=6]="LOD",t[t.VOXEL=7]="VOXEL"})(ms||(ms={}));let Kft=class{constructor(){this.verticalOffset=0,this.selectionMode=!1,this.hud=!0,this.selectOpaqueTerrainOnly=!0,this.invisibleTerrain=!1,this.backfacesTerrain=!0,this.isFiltered=!1,this.filteredLayerUids=[],this.store=tl.ALL}};(function(t){t[t.MIN=0]="MIN",t[t.MINMAX=1]="MINMAX",t[t.ALL=2]="ALL"})(tl||(tl={}));let Qft=class{constructor(e,i,r){this.object=e,this.geometryId=i,this.triangleNr=r}},e0t=class extends Qft{constructor(e,i,r,n){super(e,i,r),this.center=n!=null?Xr(n):null}},M4e=class{constructor(e){this.layerUid=e}},vj=class extends M4e{constructor(e,i){super(e),this.graphicUid=i}};function Gm(t){return(t==null?void 0:t.dist)!=null}function U0e(t){return(e,i,r)=>(Qr(V0e,e,i,r),!Koe(t,V0e))}function _j(t){return Gm(t)&&t.intersector===ms.OBJECT&&!!t.target}function bj(t){return Gm(t)&&t.intersector===ms.HUD&&!!t.target&&"center"in t.target&&t.target.center!=null}const V0e=W();let t0t=class{constructor(){this._transform=Qe(),this._transformInverse=new LD({value:this._transform},Vo,Qe),this._transformInverseTranspose=new LD(this._transformInverse,ld,Qe),this._transformTranspose=new LD({value:this._transform},ld,Qe),this._transformInverseRotation=new LD({value:this._transform},SPe,as)}_invalidateLazyTransforms(){this._transformInverse.invalidate(),this._transformInverseTranspose.invalidate(),this._transformTranspose.invalidate(),this._transformInverseRotation.invalidate()}get transform(){return this._transform}get inverse(){return this._transformInverse.value}get inverseTranspose(){return this._transformInverseTranspose.value}get inverseRotation(){return this._transformInverseRotation.value}get transpose(){return this._transformTranspose.value}setTransformMatrix(e){Ao(this._transform,e)}multiplyTransform(e){nn(this._transform,this._transform,e)}set(e){Ao(this._transform,e),this._invalidateLazyTransforms()}setAndInvalidateLazyTransforms(e,i){this.setTransformMatrix(e),this.multiplyTransform(i),this._invalidateLazyTransforms()}},LD=class{constructor(e,i,r){this._original=e,this._update=i,this._dirty=!0,this._transform=r()}invalidate(){this._dirty=!0}get value(){return this._dirty&&(this._update(this._transform,this._original.value),this._dirty=!1),this._transform}},i0t=class{constructor(e=0){this.offset=e,this.tmpVertex=W()}applyToVertex(e,i,r){const n=Ie(pU,e,i,r),s=Be(vee,n,this.localOrigin),o=this.offset/rt(s);return ao(this.tmpVertex,n,s,o),this.tmpVertex}applyToAabb(e){const i=O4e,r=P4e,n=R4e;for(let c=0;c<3;++c)i[c]=e[0+c]+this.localOrigin[c],r[c]=e[3+c]+this.localOrigin[c],n[c]=i[c];const s=this.applyToVertex(i[0],i[1],i[2]);for(let c=0;c<3;++c)e[c]=s[c],e[c+3]=s[c];const o=c=>{const f=this.applyToVertex(c[0],c[1],c[2]);for(let _=0;_<3;++_)e[_]=Math.min(e[_],f[_]),e[_+3]=Math.max(e[_+3],f[_])};for(let c=1;c<8;++c){for(let f=0;f<3;++f)n[f]=c&1<0?this._totalOffset:0,e[4]+=r[1]>0?this._totalOffset:0,e[5]+=r[2]>0?this._totalOffset:0,e;const _=fAe(H0e,o,l),x=rt(_),T=this._totalOffset/x,A=this._totalOffset/f;return e[0]+=i[0]*(i[0]>0?T:A),e[1]+=i[1]*(i[1]>0?T:A),e[2]+=i[2]*(i[2]>0?T:A),e[3]+=r[0]*(r[0]<0?T:A),e[4]+=r[1]*(r[1]<0?T:A),e[5]+=r[2]*(r[2]<0?T:A),e}applyToMbs(e){const i=rt(e),r=this._totalOffset/i;return ao(this._mbs,e,e,r),this._mbs[3]=e[3]+e[3]*this._totalOffset/i,this._mbs}applyToObb(e){return yRe(e,this._totalOffset,this._totalOffset,_t.Global,this._obb),this._obb}},n0t=class{constructor(e=0){this.offset=e,this.sphere=co(),this.tmpVertex=W()}applyToVertex(e,i,r){const n=this.objectTransform.transform,s=Ie(pU,e,i,r),o=bt(s,s,n),l=this.offset/rt(o);ao(o,o,o,l);const c=this.objectTransform.inverse;return bt(this.tmpVertex,o,c),this.tmpVertex}applyToMinMax(e,i){const r=this.offset/rt(e);ao(e,e,e,r);const n=this.offset/rt(i);ao(i,i,i,n)}applyToAabb(e){const i=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*i,e[1]+=e[1]*i,e[2]+=e[2]*i;const r=this.offset/Math.sqrt(e[3]*e[3]+e[4]*e[4]+e[5]*e[5]);return e[3]+=e[3]*r,e[4]+=e[4]*r,e[5]+=e[5]*r,e}applyToBoundingSphere(e){const i=rt(e),r=this.offset/i;return ao(this.sphere,e,e,r),this.sphere[3]=e[3]+e[3]*this.offset/i,this.sphere}};const B0e=new n0t;function yee(t){return t!=null?(B0e.offset=t,B0e):null}const j0e=new r0t;function s0t(t){return t!=null?(j0e.offset=t,j0e):null}const G0e=new i0t;function o0t(t){return t!=null?(G0e.offset=t,G0e):null}const Gw="terrain",pU=W(),vee=W(),O4e=W(),P4e=W(),R4e=W(),a0t=W(),H0e=W(),v5=1e-5;let l0t=class{constructor(e){this.options=new Kft,this._results=new c0t,this.transform=new t0t,this.tolerance=v5,this.verticalOffset=null,this._ray=Ko(),this._rayEnd=W(),this._rayBeginTransformed=W(),this._rayEndTransformed=W(),this.viewingMode=e??_t.Global}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(e,i,r){this.resetWithRay(Doe(e,i,this._ray),r)}resetWithRay(e,i){this.camera=i,e!==this._ray&&iU(e,this._ray),this.options.verticalOffset!==0?this.viewingMode===_t.Local?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset:this.verticalOffset=null,Be(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray)}intersect(e=null,i,r,n,s){var l;this.point=i,this.filterPredicate=n,this.tolerance=r??v5;const o=yee(this.verticalOffset);if(e&&e.length>0){const c=s?f=>{s(f)&&this.intersectObject(f)}:f=>{this.intersectObject(f)};for(const f of e){const _=(l=f.getSpatialQueryAccelerator)==null?void 0:l.call(f);_!=null?(o!=null?_.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,c,o):_.forEachAlongRay(this._ray.origin,this._ray.direction,c),this.options.selectionMode&&this.options.hud&&_.forEachDegenerateObject(c)):f.objects.forAll(x=>c(x))}}this.sortResults()}intersectObject(e){const i=e.geometries;if(!i)return;const r=e.effectiveTransformation,n=yee(this.verticalOffset);for(const s of i){if(!s.visible)continue;const{material:o,id:l}=s;this.transform.setAndInvalidateLazyTransforms(r,s.transformation),bt(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),bt(this._rayEndTransformed,this.rayEnd,this.transform.inverse);const c=this.transform.transform;n!=null&&(n.objectTransform=this.transform),o.intersect(s,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,(f,_,x,T,A,M)=>{if(f>=0){if(this.filterPredicate!=null&&!this.filterPredicate(this._ray.origin,this._rayEnd,f))return;const I=T?this._results.hud:this._results,L=T?F=>{const z=new e0t(e,l,x,M);F.set(ms.HUD,z,f,_,gs,A)}:F=>F.set(ms.OBJECT,{object:e,geometryId:l,triangleNr:x},f,_,c,A);if((I.min.drapedLayerOrder==null||A>=I.min.drapedLayerOrder)&&(I.min.dist==null||fI.max.dist)&&L(I.max),this.options.store===tl.ALL)if(T){const F=new _ee(this._ray);L(F),this._results.hud.all.push(F)}else{const F=new dO(this._ray);L(F),this._results.all.push(F)}}})}}sortResults(e=this._results.all){e.sort((i,r)=>i.dist!==r.dist?(i.dist??0)-(r.dist??0):i.drapedLayerOrder!==r.drapedLayerOrder?(i.drapedLayerOrder??Number.MAX_VALUE)-(r.drapedLayerOrder??Number.MAX_VALUE):(r.drapedLayerGraphicOrder??Number.MIN_VALUE)-(i.drapedLayerGraphicOrder??Number.MIN_VALUE))}};function Tp(t){return new l0t(t)}let c0t=class{constructor(){this.min=new dO(Ko()),this.max=new dO(Ko()),this.hud={min:new _ee(Ko()),max:new _ee(Ko()),all:new Array},this.ground=new dO(Ko()),this.all=[]}init(e){this.min.init(e),this.max.init(e),this.ground.init(e),this.all.length=0,this.hud.min.init(e),this.hud.max.init(e),this.hud.all.length=0}},dO=class{get ray(){return this._ray}get distanceInRenderSpace(){return this.dist!=null?(De(DD,this.ray.direction,this.dist),rt(DD)):null}getIntersectionPoint(e){return!!Gm(this)&&(De(DD,this.ray.direction,this.dist),Be(e,this.ray.origin,DD),!0)}getTransformedNormal(e){return Ne(iR,this.normal),iR[3]=0,lp(iR,iR,this.transformation),Ne(e,iR),Ye(e,e)}constructor(e){this.intersector=ms.OBJECT,this.normal=W(),this.transformation=Qe(),this._ray=Ko(),this.init(e)}init(e){this.dist=null,this.target=null,this.drapedLayerOrder=null,this.drapedLayerGraphicOrder=null,this.intersector=ms.OBJECT,iU(e,this._ray)}set(e,i,r,n,s,o,l){this.intersector=e,this.dist=r,Ne(this.normal,n??fB),Ao(this.transformation,s??gs),this.target=i,this.drapedLayerOrder=o,this.drapedLayerGraphicOrder=l}copy(e){iU(e.ray,this._ray),this.intersector=e.intersector,this.dist=e.dist,this.target=e.target,this.drapedLayerOrder=e.drapedLayerOrder,this.drapedLayerGraphicOrder=e.drapedLayerGraphicOrder,Ne(this.normal,e.normal),Ao(this.transformation,e.transformation)}},_ee=class extends dO{constructor(){super(...arguments),this.intersector=ms.HUD}};function iae(t){return new dO(t)}const DD=W(),iR=Xi();function I4e(t,e,i,r){return t.renderCoordsHelper.fromRenderCoords(e.eye,fU,r)!=null&&CAe(i,fU)}function wj(t,e){return t.elevationProvider?t.elevationProvider.getElevation(e[0],e[1],e[2],t.renderCoordsHelper.spatialReference,"ground")??0:0}function xE(t,e,i,r){const n=t.state.camera.clone();e&&i&&r&&(n.eye=e,n.center=i,n.up=r),u0t(t,n.ray,db)||Ne(db,n.center);const s=t.state.constraints,o=s.minimumPoiDistance;if(Co(n.eye,db)o}function u0t(t,e,i){let r=W0e[t.viewingMode];r||(r=Tp(t.state.viewingMode),r.options.backfacesTerrain=!t.state.isGlobal,r.options.invisibleTerrain=!0,W0e[t.viewingMode]=r);const{isGlobal:n}=t.state;return!(!t.sceneIntersectionHelper.intersectRay(e,r,i)||q0e(t,e.origin,i))||!(!t.renderCoordsHelper.intersectManifold(e,0,i)||q0e(t,e.origin,i))||!!n&&h0t(e,i,Sr(t.spatialReference).radius)}function h0t(t,e,i){const r=Ve(t.origin,t.origin)-i*i,n=r>0?Math.sqrt(r)/3:1;return De(e,t.direction,n/rt(t.direction)),Be(e,e,t.origin),!0}const W0e={},fU=W(),db=W(),xx=W(),d0t={near:0,far:0},p0t=W(),ND=W();function rae(){return{direction:W(),up:W()}}function $4e(t,e,i,r,n){let s=Ye(p0t,t),o=Ve(s,r);const l=o>0;o=Math.abs(o),o>.99&&(o=Math.abs(Ve(e,r)),o<.99?(Ne(s,e),l&&De(s,s,-1)):s=null);let c=0;if(s){De(ND,r,Ve(r,s)),je(s,s,ND);const _=Ve(s,n)/(rt(s)*rt(n));Wt(ND,s,n),c=(Ve(ND,r)>0?1:-1)*pu(Ca(_))}const f=pu(Ca(-Ve(r,t)/rt(t)));return i?(i.heading=c,i.tilt=f,i):{heading:c,tilt:f}}const L4e=nt(0,1,0),D4e=nt(0,0,1),rR=Qe(),_1=W(),b1=W();function N4e(t,e,i,r=rae()){const{direction:n,up:s}=r;return WAe(rR,-Ei(e)),WO(rR,rR,Ei(i)),bt(n,D4e,rR),De(n,n,-1),bt(s,L4e,rR),r}function f0t(t,e,i,r){return $4e(e,i,r,D4e,L4e)}function m0t(t,e,i,r){const n=N4e(t,i,r),s=W();return De(s,n.direction,-e),Be(s,s,t),{up:n.up,eye:s,heading:i,tilt:r}}function g0t(t){return pu(t)}function y0t(t){return Ei(t)}function F4e(t,e,i,r,n){const s=t.renderSpatialReference,o=t.map&&t.spatialReference||e.spatialReference;return ud(e,_1,s),ud(e,b1,s),_1[0]-=i/2,b1[0]+=i/2,_1[1]-=r/2,b1[1]+=r/2,el(_1,s,_1,o),el(b1,s,b1,o),n?(n.xmin=_1[0],n.ymin=_1[1],n.xmax=b1[0],n.ymax=b1[1],n.spatialReference=o):n=new Vi(_1[0],_1[1],b1[0],b1[1],o),n}const v0t=Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:f0t,eyeForCenterWithHeadingTilt:m0t,eyeTiltToLookAtTilt:y0t,headingTiltToDirectionUp:N4e,lookAtTiltToEyeTilt:g0t,toExtent:F4e},Symbol.toStringTag,{value:"Module"}));function Y0e(t,e,i){if(e.longitude==null||e.latitude==null||i.longitude==null||i.latitude==null)throw new Error("Invalid points: no lon/lat");return _0t(t,e.longitude,e.latitude,i.longitude,i.latitude)}function _0t(t,e,i,r,n){const s=Ei(i),o=Ei(n),l=s-o,c=Ei(e)-Ei(r),f=Math.sin(l/2),_=Math.sin(c/2),x=2*Gf(Math.sqrt(f*f+Math.cos(s)*Math.cos(o)*_*_))*t;return Math.round(1e4*x)/1e4}function b0t(t,e,i){const r=e.spatialReference,n=Sr(r),s=new mt(e.x,t.y,r),o=new mt(i.x,t.y,r),l=new mt(t.x,e.y,r),c=new mt(t.x,i.y,r);return{lon:Y0e(n.radius,s,o),lat:Y0e(n.radius,l,c)}}function w0t(t,e,i){const r=e/i,n=Ei(t),s=Math.sin(r/2),o=Math.cos(n),l=2*Gf(Math.sqrt(s*s/(o*o)));return pu(l)}function k4e(t,e){let i=t/15;return e||(i=Math.round(i)),i}function bee(t,e){const i=t==null?void 0:t[0];if(i==null)return null;e||(e={hours:0,minutes:0,seconds:0}),e.hours=k4e(i,!0);const r=e.hours%1;e.hours-=r,e.minutes=60*r;const n=e.minutes%1;return e.minutes-=n,e.seconds=Math.round(60*n),e}const z4e=nt(0,0,1),U4e=Ye(W(),nt(1,1,1)),x0t=new F2(-180,180),nR=Qe(),Lw=W(),XE=W();function V4e(t,e,i,r=rae()){Wt(Lw,t,z4e),Ve(Lw,Lw)===0&&Wt(Lw,t,U4e),xp(nR,-Ei(e),t),Wh(nR,nR,-Ei(i),Lw);const{up:n,direction:s}=r;return Wt(n,Lw,t),Ye(n,n),bt(n,n,nR),Ye(s,t),Sc(s,s),bt(s,s,nR),r}function S0t(t,e,i,r){const n=Lw,s=XE;return Ye(n,t),Wt(XE,n,z4e),Ve(XE,XE)===0&&Wt(XE,n,U4e),Wt(s,XE,n),$4e(e,i,r,n,s)}function T0t(t,e,i,r){const n={eye:W(),up:null,tilt:r,heading:i},s=Lw;s[0]=t[0],s[1]=t[2],s[2]=-t[1];const o=e,l=Ei(i),c=Ei(r),f=Math.sin(l),_=Math.cos(l),x=Math.sin(c),T=Math.cos(c),A=rt(s);let M;if(Math.abs(c)<1e-8)M=o+A;else{const Ee=A/x,te=Gf(o/Ee),le=Math.PI-c-te;M=Ee*Math.sin(le)}const I=T*o,L=o*o*(x*x),F=_*_*L,z=M-I,k=z*z,U=F*(F+k-s[1]*s[1]);if(U<0)return De(n.eye,s,M/A),n.tilt=0,FD(n,t);const j=Math.sqrt(U),H=s[1]*z,Y=F+k;let Q;if(Q=_>0?-j+H:j+H,Math.abs(Y)<1e-8)return A<1e-8?(n.eye[0]=0,n.eye[1]=0,n.eye[2]=o):De(n.eye,s,M/A),n.tilt=0,iq(n.eye),FD(n,t);n.eye[1]=Q/Y;const ne=f*f*L,re=x*o,he=_*re*n.eye[1],ce=n.eye[1]*n.eye[1],be=1-ce,ye=Math.sqrt(be),pe=F*ce+ne-2*he*ye*z+be*k;return Math.abs(pe)<1e-8?(De(n.eye,s,M/A),n.tilt=0,iq(n.eye),FD(n,t)):(n.eye[0]=(be*(M*s[0]-I*s[0])-re*ye*(s[0]*n.eye[1]*_+s[2]*f))/pe,n.eye[2]=(be*(M*s[2]-I*s[2])-re*ye*(s[2]*n.eye[1]*_-s[0]*f))/pe,De(n.eye,n.eye,M),iq(n.eye),FD(n,t))}function iq(t){const e=t[1];t[1]=-t[2],t[2]=e}function FD(t,e){const i=V4e(e,t.heading,t.tilt);return t.up=i.up,t}function E0t(t,e,i){const r=rt(e),n=Math.sqrt(i*i+r*r-2*i*r*Math.cos(Math.PI-t)),s=Gf(i/(n/Math.sin(t)));return pu(t-s)}function C0t(t,e,i){const r=Ei(t),n=rt(e);return Gf(i/(n/Math.sin(r)))+r}function B4e(t,e,i,r,n){let s,o,l,c;const f=e.latitude,_=Sr(t.spatialReference).radius,x=e.longitude,T=w0t(f,i,_)/2;s=x-T,o=x+T;const A=Ei(f),M=(1+Math.sin(A))/(1-Math.sin(A)),I=(M+1)*Math.tan(r/_/2),L=I*I;function F(k){const U=Math.PI/2;return(k=Ydt.normalize(k,-U))>U&&(k=Math.PI-k),k}if(l=1.5*Math.PI-2*Math.atan(.5*(I+Math.sqrt(4*M+L))),c=l+r/_,l=F(l),c=F(c),c180){const k=(o-s-180)/2;s+=k,o-=k}const z=t.spatialReference&&t.spatialReference.isGeographic?t.spatialReference:at.WGS84;return n?(n.xmin=s,n.ymin=l,n.xmax=o,n.ymax=c,n.spatialReference=z):n=new Vi(s,l,o,c,z),t.spatialReference&&t.spatialReference.isWebMercator&&Ty(n,!1,n),n}const A0t=Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:S0t,eyeForCenterWithHeadingTilt:T0t,eyeTiltToLookAtTilt:C0t,headingTiltToDirectionUp:V4e,lookAtTiltToEyeTilt:E0t,toExtent:B4e},Symbol.toStringTag,{value:"Module"}));function mU(t){return t.type==="point"}let nae=class{constructor(e,i=null,r=0){this.array=e,this.spatialReference=i,this.offset=r}};function j4e(t){return"array"in t}function my(t,e,i="ground"){if(mU(e))return t.getElevation(e.x,e.y,e.z||0,e.spatialReference,i);if(j4e(e)){let r=e.offset;return t.getElevation(e.array[r++],e.array[r++],e.array[r]||0,e.spatialReference??t.spatialReference,i)}return t.getElevation(e[0],e[1],e[2]||0,t.spatialReference,i)}const G4e=Ce.getLogger("esri.views.3d.support.cameraUtils"),H4e=39.37,q4e=96,wee=1,M0t=8,O0t=5,W4e=1,X0e=W(),P0t={heading:0,tilt:0},p$=W(),R0t=new F2(-20037508342788905e-9,20037508342788905e-9),I0t=new F2(-180,180);var ql;function V_(t){return t.spatialReference??at.WGS84}function vP(t){return t.viewingMode==="global"?A0t:v0t}function $0t(t,e,i,r,n){return vP(t).headingTiltToDirectionUp(e,i,r,n)}function Tv(t,e){if(e==null)return null;const i=t.renderSpatialReference,r=vP(t).headingTiltToDirectionUp,n=W();if(!ud(e.position,n,i))return null;const s=r(n,e.heading,e.tilt);De(s.direction,s.direction,t.state.camera.distance),Be(s.direction,s.direction,n);const o=xE(t,n,s.direction,s.up);return o.fov=Ei(e.fov),o}(function(t){t[t.LOCKED=0]="LOCKED",t[t.ADJUST=1]="ADJUST"})(ql||(ql={}));const ZE=W();function _5(t,e,i){const r=t.renderSpatialReference,n=Sj(t,e.eye,e.viewForward,e.up,P0t);let s=V_(t);return el(e.eye,r,ZE,s)||(s=at.WGS84,el(e.eye,r,ZE,s)),i==null?new cd(new mt(ZE,s),n.heading,n.tilt,pu(e.fov)):(i.position.x=ZE[0],i.position.y=ZE[1],i.position.z=ZE[2],i.position.spatialReference=s,i.heading=n.heading,i.tilt=n.tilt,i.fov=pu(e.fov),i)}function xj(t,e,i){const r=t.state.camera,n=r.width/2/r.pixelRatio;return t.renderCoordsHelper.viewingMode===_t.Global&&i!=null&&(e*=Math.cos(Ei(i))),e/=t.renderCoordsHelper.unitInMeters,n/(q4e*H4e/e)/Math.tan(r.fovX/2)}function qT(t,e,i){const r=t.state.camera,n=e*Math.tan(r.fovX/2),s=r.width/2/r.pixelRatio;let o=q4e*H4e/(s/n);return t.renderCoordsHelper.viewingMode===_t.Global&&i!=null&&(o/=Math.cos(Ei(i))),o*t.renderCoordsHelper.unitInMeters}async function Y4e(t,e,i,r,n,s){return X4e(t,e,xj(t,i,e.latitude),r,n,s)}function L0t(t,e,i,r,n,s){return cIe(t,sae(t,r.heading,r.tilt,e,i,n),r.fov,s)}async function X4e(t,e,i,r,n,s){const o=await J4e(t,r.heading,r.tilt,e,i,n,s);return St(s),uIe(t,o,r.fov,s)}function Sj(t,e,i,r,n){return vP(t).directionToHeadingTilt(e,i,r,n)}function Z4e(t,e){return!!(t.basemapTerrain&&t.renderCoordsHelper.fromRenderCoords(e,p$,t.spatialReference)&&t.elevationProvider&&(my(t.elevationProvider,p$)??0)>p$[2]-W4e)}async function D0t(t,e,i){if(Z4e(t,e))return!0;const{elevationProvider:r,spatialReference:n,renderCoordsHelper:s}=t;if(r==null||!s.fromRenderCoords(e,p$,n))return!1;const[o,l,c]=p$,f=await r.queryElevation(o,l,c,n,"ground",i)??0;return St(i),f>c-W4e}async function N0t(t,e,i){const r=W();if(e==null)return Ne(r,t.state.camera.center);if(e instanceof mt){const{renderSpatialReference:n,basemapTerrain:s,elevationProvider:o}=t,l=e.spatialReference;if(await dU(e,r,n,0,{signal:i}),St(i),e.z==null&&s!=null&&o!=null){const c=await o.queryElevation(e.x,e.y,e.z??0,l,"ground",i);St(i),c!=null&&t.renderCoordsHelper.setAltitude(r,c)}return r}return Ne(r,e)}function F0t(t,e){const i=W();if(e==null)return Ne(i,t.state.camera.center);if(e instanceof mt){if(!ud(e,i,t.renderSpatialReference))return null;const{basemapTerrain:r,elevationProvider:n}=t;if(e.z==null&&r!=null&&n!=null){const s=my(n,e);s!=null&&t.renderCoordsHelper.setAltitude(i,s)}return i}return Ne(i,e)}function sae(t,e,i,r,n,s){return K4e(t,e,i,r instanceof mt?r:null,F0t(t,r),n,s)}async function J4e(t,e,i,r,n,s,o){const l=r instanceof mt?r:null,c=await N0t(t,r,o);return St(o),Q4e(t,e,i,l,c,n,s,o)}function K4e(t,e,i,r,n,s,o){if(n==null||(r??(r=w_(n,t.renderSpatialReference,V_(t))),r==null))return null;const l=eIe(t,e,i,n,s,o);if(tIe(t,i,o)&&Z4e(t,l.eye)){const{tilt:c,mode:f}=iIe(t,i,n,s);return K4e(t,e,c,r,n,s,f)}return rIe(l,n)}async function Q4e(t,e,i,r,n,s,o,l){r??(r=await A4e(n,t.renderSpatialReference,V_(t),{signal:l})),St(l);const c=eIe(t,e,i,n,s,o);if(tIe(t,i,o)&&await D0t(t,c.eye,l)){St(l);const{tilt:f,mode:_}=iIe(t,i,n,s);return Q4e(t,e,f,r,n,s,_,l)}return rIe(c,n)}function eIe(t,e,i,r,n,s){const o=z0t(t,e,i,r,n=Math.max(n,t.state.constraints.minimumPoiDistance),s);return(0,vP(t).eyeForCenterWithHeadingTilt)(r,n,o.heading,o.tilt)}function tIe(t,e,i){const r=t.map.ground.navigationConstraint;return i===ql.ADJUST&&t.viewingMode==="global"&&e>0&&(r==null||r.type==="stay-above")}function iIe(t,e,i,r){const n=lIe(t,i,r,V0t(t,r,e,i));return{tilt:n,mode:e-n<1?ql.LOCKED:ql.ADJUST}}function rIe(t,e){return{...t,center:Xr(e)}}function nIe(t,e){const{state:i,spatialReference:r}=t,n=e.spatialReference;return i.isGlobal&&p5(n,_t.Global)||i.isLocal&&r.equals(n)}function sIe(t,e){let i,r,n;if(t.state.isGlobal){const _=new mt(e.xmin,e.ymin,e.spatialReference),x=new mt(e.xmax,e.ymax,e.spatialReference),T=e.spatialReference.isGeographic?I0t:R0t;i=new mt({x:T.center(_.x,x.x),y:(x.y+_.y)/2,z:e.zmax!=null&&e.zmin!=null?(e.zmax+e.zmin)/2:void 0,spatialReference:e.spatialReference});const A=Sr(e.spatialReference),M=b0t(i,_,x);r=M.lon,n=M.lat,T.diff(_.x,x.x)>T.range/2&&(r+=A.halfCircumference),r=Math.min(r,A.halfCircumference),n=Math.min(n,A.halfCircumference)}else{const _=t.renderSpatialReference??e.spatialReference;_.equals(e.spatialReference)||(e=rl(e,_)),r=e.xmax-e.xmin,n=e.ymax-e.ymin;const x=e.zmax!=null&&e.zmin!=null?(e.zmax+e.zmin)/2:void 0;i=new mt({x:e.xmin+.5*r,y:e.ymin+.5*n,z:x,spatialReference:_})}const s=e.zmax!=null&&e.zmin!=null?e.zmax-e.zmin:0,o=t.state.camera,l=1/Math.tan(o.fovX/2),c=1/Math.tan(o.fovY/2),f=1/Math.tan(o.fov/2);return{center:i,distance:Math.max(.5*r*l,.5*n*c,.5*s*f)/wee}}async function oIe(t,e,i,r,n,s){const o=nIe(t,e)?e:await qy(e,t.spatialReference,{signal:s});St(s);const{center:l,distance:c}=sIe(t,o),f=await J4e(t,i,r,l,c,n,s);return St(s),uIe(t,f,t.camera.fov,s)}function PF(t,e,i,r,n,s){let o;try{o=nIe(t,e)?e:rl(e,t.spatialReference)}catch{return null}const{center:l,distance:c}=sIe(t,o),f=sae(t,i,r,l,c,n);return f==null?null:cIe(t,f,t.camera.fov,s)}function aIe(t,e,i){const r=t.renderSpatialReference,n=w_(i,r,V_(t));if(n==null)return null;const s=Math.tan(e.fovX/2),o=Math.tan(e.fovY/2),l=O9(e.eye,i),c=2*l*s*wee,f=2*l*o*wee;return t.viewingMode==="global"?B4e(t,n,c,f):F4e(t,n,c,f)}function k0t(t,e,i){const r=t.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(i/r)/Math.LN2>M0t)return!0;const n=t.renderSpatialReference,s=V_(t),o=w_(e,n,s),l=w_(t.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,n,s);if(o==null||l==null)return!1;const c=Math.tan(.5*t.state.camera.fov)*r;return l.distance(o)/c>O0t}function z0t(t,e,i,r,n,s){let o=0;return s===ql.ADJUST&&k0t(t,r,n)?(e=0,o=U0t(t,n,i,r)):o=oae(t,r,n,i),o=t.state.constraints.clampTilt(n,o),{heading:e,tilt:i=lIe(t,r,n,o)}}const gU=.7;function U0t(t,e,i,r){const n=oae(t,r,e,i);if(!t.state.constraints.tilt)return n;const s=t.state.constraints.tilt(e);s.max=Math.min(s.max,.5*Math.PI);const o=s.min*(1-gU)+s.max*gU;return Math.min(n,o)}function V0t(t,e,i,r){let n=oae(t,r,e,i);if(!t.state.constraints.tilt)return n;const s=t.state.constraints.tilt(e);return n=Math.min(n,.5*Math.PI),s.min*(1-gU)+n*gU}function lIe(t,e,i,r){return vP(t).lookAtTiltToEyeTilt(r,e,i)}function oae(t,e,i,r){return vP(t).eyeTiltToLookAtTilt(r,e,i)}function cIe(t,e,i,r){if(e==null)return null;const n=t.renderSpatialReference,s=w_(e.eye,n,V_(t));return s==null?null:(r??(r=new cd),r.position=s,r.heading=e.heading,r.tilt=e.tilt,r.fov=i,r)}async function uIe(t,e,i,r){const n=t.renderSpatialReference,s=await A4e(e.eye,n,V_(t),{signal:r});return St(r),new cd(s,e.heading,e.tilt,i)}function B0t(t,e){var r;const i=(r=t.basemapTerrain)==null?void 0:r.tilingScheme;if(i)return i.levelAtScale(e);G4e.error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function hIe(t,e){var r;const i=(r=t.basemapTerrain)==null?void 0:r.tilingScheme;if(i)return i.scaleAtLevel(e);G4e.error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}function dIe(t,e){return el(e.center,t.renderSpatialReference,X0e,at.WGS84),qT(t,e.distance,X0e[1])}const aae=Ce.getLogger("esri.layers.support.ElevationSampler");let pIe=class{queryElevation(e){return fIe(e.clone(),this)}on(){return rr()}projectIfRequired(e,i){return mIe(e,i)}},j0t=class extends pIe{get spatialReference(){return this.extent.spatialReference}constructor(e,i,r){super(),this.tile=e,this.noDataValue=r;const n=e.tile.extent;this.extent=bB(n,i.spatialReference),this.extent.zmin=e.zmin,this.extent.zmax=e.zmax,this._aaExtent=n;const s=ws(i.spatialReference),o=i.lodAt(e.tile.level).resolution*s;this.demResolution={min:o,max:o}}contains(e){const i=this.projectIfRequired(e,this.spatialReference);return i!=null&&this.containsAt(i.x,i.y)}containsAt(e,i){return wB(this._aaExtent,e,i)}elevationAt(e,i){if(!this.containsAt(e,i)){const r=this.extent,n=`${r.xmin}, ${r.ymin}, ${r.xmax}, ${r.ymax}`;return aae.warn("#elevationAt()",`Point used to sample elevation (${e}, ${i}) is outside of the sampler extent (${n})`),this.noDataValue}return this.tile.sample(e,i)??this.noDataValue}},Z0e=class extends pIe{get spatialReference(){return this.extent.spatialReference}constructor(e,i,r){let n;super(),typeof i=="number"?(this.noDataValue=i,n=null):(n=i,this.noDataValue=r),this.samplers=n?e.map(o=>new j0t(o,n,this.noDataValue)):e;const s=this.samplers[0];if(s){this.extent=s.extent.clone();const{min:o,max:l}=s.demResolution;this.demResolution={min:o,max:l};for(let c=1;c=0;A--)x.unshift(new cm({level:A,scale:T,resolution:T})),T*=2}return new sw({dpi:96,lods:x,origin:new mt(0,0,n),size:[r,r],spatialReference:n})}const o=pp(n),l=t.origin?new mt({x:t.origin.x,y:t.origin.y,spatialReference:n}):new mt(o?{x:o.origin[0],y:o.origin[1],spatialReference:n}:{x:0,y:0,spatialReference:n}),c=96,f=1/(ws(n)*39.37*c),_=[];if(i)for(let x=0;x{r.push(s.scale),e=s.scale>e?s.scale:e,i=s.scale=e.length-1)return e[e.length-1];const i=Math.floor(t),r=i+1;return e[i]/(e[i]/e[r])**(t-i)}scaleToZoom(t){const e=this.scales,i=e.length-1;let r=0;for(;rt&&s=e?this.zoomToScale(Math.ceil(i)):this.zoomToScale(Math.floor(i))}tileAt(t,e,i,r){const n=this.lodAt(t);if(!n)return null;let s,o;if(typeof e=="number")s=e,o=i;else if(Zn(e.spatialReference,this.spatialReference))s=e.x,o=e.y,r=i;else{const f=rP(e,this.spatialReference);if(f==null)return null;s=f.x,o=f.y,r=i}const l=n.resolution*this.size[0],c=n.resolution*this.size[1];return r||(r=new Tj(null,0,0,0,Ni())),r.level=t,r.row=Math.floor((this.origin.y-o)/c+.001),r.col=Math.floor((s-this.origin.x)/l+.001),this.updateTileInfo(r),r}updateTileInfo(t,e=sw.ExtrapolateOptions.NONE){let i=this.lodAt(t.level);if(!i&&e===sw.ExtrapolateOptions.POWER_OF_TWO){const o=this.lods[this.lods.length-1];o.levelArray.isArray(t)?t:typeof t=="number"?[t,t]:[256,256]})],sc.prototype,"size",void 0),y([$t("size",["rows","cols"])],sc.prototype,"readSize",null),y([Pt("size",{cols:{type:$n},rows:{type:$n}})],sc.prototype,"writeSize",null),y([w({type:at,json:{write:!0}})],sc.prototype,"spatialReference",void 0),sc=sw=y([Z("esri.layers.support.TileInfo")],sc),function(t){var e;(e=t.ExtrapolateOptions||(t.ExtrapolateOptions={}))[e.NONE=0]="NONE",e[e.POWER_OF_TWO=1]="POWER_OF_TWO"}(sc||(sc={}));const pO=sc,W0t=12;let Bu=class Au{constructor(e){const i=Au.checkUnsupported(e);if(i!=null)throw i;const r=e;this.spatialReference=r.spatialReference,this._isWebMercator=this.spatialReference.isWebMercator,this._isGCS=D2(this.spatialReference)||r1(this.spatialReference)||n1(this.spatialReference),this.origin=[r.origin.x,r.origin.y],this.pixelSize=r.size[0],this.dpi=r.dpi;const n=r.lods.reduce((f,_,x)=>(_.levelnew cm({level:i,scale:e.scale,resolution:e.resolution}))})}getExtent(e,i,r,n){const s=this.levels[e],o=s.tileSize[0],l=s.tileSize[1];n[0]=this.origin[0]+r*o,n[2]=this.origin[0]+(r+1)*o,n[3]=this.origin[1]-i*l,n[1]=this.origin[1]-(i+1)*l}convertExtentToRadians(e,i){this._isWebMercator?(i[0]=jde(e[0]),i[1]=Mz(e[1]),i[2]=jde(e[2]),i[3]=Mz(e[3])):this._isGCS&&(i[0]=Ei(e[0]),i[1]=Ei(e[1]),i[2]=Ei(e[2]),i[3]=Ei(e[3]))}getExtentGeometry(e,i,r,n=new Vi){return this.getExtent(e,i,r,Qm),n.spatialReference=this.spatialReference,n.xmin=Qm[0],n.ymin=Qm[1],n.xmax=Qm[2],n.ymax=Qm[3],n.zmin=void 0,n.zmax=void 0,n}ensureMaxLod(e){if(e==null)return!1;let i=!1;for(;this.levels.length<=e;){const r=this.levels[this.levels.length-1],n=r.resolution/2;this.levels.push({resolution:n,scale:r.scale/2,tileSize:[n*this.pixelSize,n*this.pixelSize]}),i=!0}return i}capMaxLod(e){this.levels.length>e+1&&(this.levels.length=e+1)}getMaxLod(){return this.levels.length-1}scaleAtLevel(e){return this.levels[0].scale/2**e}levelAtScale(e){const i=this.levels[0].scale;return e>=i?0:Math.log(i/e)*Math.LOG2E}resolutionAtLevel(e){return this.levels[0].resolution/2**e}compatibleWith(e){if(!(e instanceof Au)){if(Au.checkUnsupported(e))return!1;e=new Au(e)}if(!e.spatialReference.equals(this.spatialReference)||e.pixelSize!==this.pixelSize)return!1;const i=Math.min(this.levels.length,e.levels.length)-1,r=this.levels[i].resolution;let n=.5*r;return!Ey(e.origin[0],this.origin[0],n)||!Ey(e.origin[1],this.origin[1],n)?!1:(n=.5*r/2**i/this.pixelSize*W0t,Ey(r,e.levels[i].resolution,n))}rootTilesInExtent(e,i=null,r=1/0){const n=new Array,s=this.levels[0].tileSize;if(e==null||s[0]===0||s[1]===0)return n;Au.computeRowColExtent(e,s,this.origin,Qm);let o=Qm[1],l=Qm[3],c=Qm[0],f=Qm[2];const _=f-c,x=l-o;if(_*x>r){const T=Math.floor(Math.sqrt(r));x>T&&(o=o+Math.floor(.5*x)-Math.floor(.5*T),l=o+T),_>T&&(c=c+Math.floor(.5*_)-Math.floor(.5*T),f=c+T)}for(let T=o;T!bet(n.resolution,r/2**n.level))}static hasGapInLevels(e){const i=e.lods.map(r=>r.level);i.sort((r,n)=>r-n);for(let r=1;r=128&&i<=512}static hasOriginPerLODs(e){const i=e.origin;return e.lods.some(r=>r.origin!=null&&(r.origin[0]!==i.x||r.origin[1]!==i.y))}static getMissingTileInfoError(){return new se("tilingscheme:tile-info-missing","Tiling scheme must have tiling information")}static checkUnsupported(e){return e==null?lae():e.lods.length<1?new se("tilingscheme:generic","Tiling scheme must have at least one level"):Au.isPowerOfTwo(e)?Au.hasGapInLevels(e)?new se("tilingscheme:gaps","Tiling scheme levels must not have gaps between min and max level"):Au.tileSizeSupported(e)?Au.hasOriginPerLODs(e)?new se("tilingscheme:multiple-origin","Tiling scheme levels must not have their own origin"):null:new se("tilingscheme:tile-size","Tiles must be square and size must be one of [128, 256, 512]"):new se("tilingscheme:power-of-two","Tiling scheme must be power of two")}static fromExtent(e,i){const r=e[2]-e[0],n=e[3]-e[1],s=ws(i),o=1.2*Math.max(r,n),l=256,c=96,f=.0254,_=new Au(new pO({size:[l,l],origin:new mt({x:e[0]-.5*(o-r),y:e[3]+.5*(o-n)}),lods:[new cm({level:0,resolution:o/l,scale:1/(l/c*f/(o*s))})],spatialReference:i}));return _.ensureMaxLod(20),_}static makeWebMercatorAuxiliarySphere(e){const i=new Au(Au.WebMercatorAuxiliarySphereTileInfo);return i.ensureMaxLod(e),i}static makeGCSWithTileSize(e,i=256,r=16){const n=256/i,s=new Au(new pO({size:[i,i],origin:new mt({x:-180,y:90,spatialReference:e}),spatialReference:e,lods:[new cm({level:0,resolution:.703125*n,scale:295497598570834e-6*n})]}));return s.ensureMaxLod(r),s}get test(){return{isWebMercator:this._isWebMercator,isGCS:this._isGCS}}};function lae(){return new se("tilingscheme:tile-info-missing","Tiling scheme must have tiling information")}Bu.WebMercatorAuxiliarySphereTileInfo=new pO({size:[256,256],origin:new mt({x:-20037508342787e-6,y:20037508342787e-6,spatialReference:at.WebMercator}),spatialReference:at.WebMercator,lods:[new cm({level:0,resolution:156543.03392800014,scale:591657527591555e-6})]}),Bu.WebMercatorAuxiliarySphere=Bu.makeWebMercatorAuxiliarySphere(19);const Qm=Ni(),PM=64,X4=512,Y0t=2.5,EL=wet(HZ/10),gIe=2,yIe=Ni();Bu.WebMercatorAuxiliarySphere.getExtent(0,0,0,yIe);const X0t=Ni([-180,-90,180,90]),Z0t="Cannot extend surface to encompass all layers because it would result in too many root tiles.",J0t="Surface extent is too large for tile resolution at level 0.",K0t=3;let Q0t=K0t;function See(t){return t<4?3:Q0t}let ow=class extends Dn.EventedAccessor{constructor(e){super(e),this.demResolution={min:-1,max:-1},this.noDataValue=EL}initialize(){this.view.basemapTerrain.on("elevation-change",()=>this.emit("changed",{}))}get extent(){const e=this.view.basemapTerrain;if((e==null?void 0:e.extent)==null||e.spatialReference==null)return null;const i=bB(e.extent,e.spatialReference);return i.zmin=e.visibleElevationBounds.min,i.zmax=e.visibleElevationBounds.max,i}get spatialReference(){var e;return((e=this.view.basemapTerrain)==null?void 0:e.spatialReference)??at.WGS84}elevationAt(e,i){var r;if(this.extent==null||!Kc(this.extent,e,i)){const n=this.extent!=null?`${this.extent.xmin}, ${this.extent.ymin}, ${this.extent.xmax}, ${this.extent.ymax}`:null;return Ce.getLogger(this).warn("#elevationAt()",`Point used to sample elevation (${e}, ${i}) is outside of the sampler extent (${n})`),this.noDataValue}return((r=this.view.elevationProvider)==null?void 0:r.getElevation(e,i,0,this.spatialReference,"ground"))??this.noDataValue}queryElevation(e){return fIe(e.clone(),this)}};y([w({readOnly:!0})],ow.prototype,"demResolution",void 0),y([w({readOnly:!0})],ow.prototype,"extent",null),y([w({readOnly:!0})],ow.prototype,"noDataValue",void 0),y([w()],ow.prototype,"spatialReference",null),y([w({constructOnly:!0})],ow.prototype,"view",void 0),ow=y([Z("esri.views.support.GroundViewElevationSampler")],ow);const emt=ow;let Q1=class extends ze{constructor(e){super(e),this.view=null,this.layerViews=new it}initialize(){this.addHandles(Mo(()=>{var e,i;return(i=(e=this.view)==null?void 0:e.map)==null?void 0:i.ground},e=>e.load())),this.addHandles(this.layerViews.on("after-changes",()=>this._layerViewsAfterChangesHandler()))}destroy(){this._set("view",null);for(const e of this.layerViews)e.destroy();this.layerViews.length=0}get elevationSampler(){return this.view?this.view.type==="2d"?null:this.view.ready&&this.view.basemapTerrain&&this.view.basemapTerrain.ready?new emt({view:this.view}):null:null}get extent(){const e=this.view;return e&&e.type!=="2d"&&e.ready?aIe(e,e.state.camera,e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation):null}get updating(){return!this.suspended&&this.layerViews.some(e=>e.updating)}get suspended(){return!this.view||this.view.suspended}_layerViewsAfterChangesHandler(){this.removeHandles("updating"),this.addHandles(this.layerViews.map(e=>_e(()=>e.updating,()=>this._updateUpdating(),Li)).toArray(),"updating"),this._updateUpdating()}_updateUpdating(){this.notifyChange("updating")}};y([w({readOnly:!0})],Q1.prototype,"elevationSampler",null),y([w({readOnly:!0})],Q1.prototype,"extent",null),y([w({type:Boolean,readOnly:!0})],Q1.prototype,"updating",null),y([w({constructOnly:!0})],Q1.prototype,"view",void 0),y([w({type:it,readOnly:!0})],Q1.prototype,"layerViews",void 0),y([w({readOnly:!0})],Q1.prototype,"suspended",null),Q1=y([Z("esri.views.GroundView")],Q1);const tmt=Q1;let x_=class{constructor(e,i){this._owner=i,this._properties={},this._afterDispatchHandle=null;for(const r in e){const n=e[r],s=new dSe(n,void 0,void 0,2,2);this._properties[r]={pool:s,acquired:[]}}this._afterDispatchHandle=TSe(()=>this._release())}destroy(){this._afterDispatchHandle&&(this._afterDispatchHandle.remove(),this._afterDispatchHandle=null);for(const e in this._properties){const i=this._properties[e];for(const r of i.acquired)phe(r)||i.pool.release(r);i.pool.destroy(),i.pool=null,i.acquired=null}this._properties=null,this._owner=null}get(e){const i=this._owner._get(e),r=this._properties[e];let n=r.pool.acquire();for(r.acquired.push(n);n===i;)r.acquired.push(n),n=r.pool.acquire();return n}_release(){for(const e in this._properties){const i=this._properties[e];let r=0;for(const n of i.acquired)phe(n)?i.acquired[r++]=n:i.pool.release(n);i.acquired.length=r}}};const imt=Le("mac")?"Meta":"Ctrl",Ej={8:"Backspace",9:"Tab",13:"Enter",27:"Escape",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete"};for(let t=48;t<58;t++)Ej[t]=String.fromCharCode(t);for(let t=1;t<25;t++)Ej[111+t]=`F${t}`;for(let t=65;t<91;t++)Ej[t]=[String.fromCharCode(t+32),String.fromCharCode(t)];function rmt(t){if(t.key!==void 0)return Sf(t);const e=Ej[t.keyCode];return Array.isArray(e)?t.shiftKey?e[1]:e[0]:e}function nmt(t){switch(t){case"Ctrl":case"Alt":case"Shift":case"Meta":case"Primary":return!0}return!1}let smt=class{constructor(e,i=[]){this.eventType=e,this.keyModifiers=i}matches(e){if(e.type!==this.eventType)return!1;if(this.keyModifiers.length===0)return!0;const i=e.modifiers;for(const r of this.keyModifiers)if(!i.has(r))return!1;return!0}};const K0e=Ce.getLogger("esri.views.input.InputHandler");let Rl=class{constructor(e){this._manager=null,this._incoming={},this._outgoing={},this._incomingEventMatches=null,this._incomingEventTypes=null,this._outgoingEventTypes=null,this._hasSideEffects=e}get incomingEventMatches(){if(!this._incomingEventMatches){this._incomingEventMatches=[];for(const e in this._incoming){const i=this._incoming[e];for(const r of i)this._incomingEventMatches.push(r.match)}}return this._incomingEventMatches}get incomingEventTypes(){return this._incomingEventTypes||(this._incomingEventTypes=this.incomingEventMatches.map(e=>e.eventType)),this._incomingEventTypes}get outgoingEventTypes(){return this._outgoingEventTypes||(this._outgoingEventTypes=Object.keys(this._outgoing)),this._outgoingEventTypes}get hasSideEffects(){return this._hasSideEffects}get hasPendingInputs(){return!1}onInstall(e){this._manager?K0e.error("This InputHandler has already been registered with an InputManager"):(e.setEventCallback(i=>this._handleEvent(i)),e.setUninstallCallback(()=>this._onUninstall()),this._manager=e)}onUninstall(){}registerIncoming(e,i,r){let n;typeof i=="function"?(r=i,n=[]):n=i||[];const s=typeof e=="string"?new smt(e,n):e,o=()=>{this._incomingEventTypes=null,this._incomingEventMatches=null},l=_=>{const x=this._incoming[_.match.eventType];if(x){const T=x.indexOf(_);x.splice(T,1),o(),this._manager&&this._manager.updateDependencies()}},c=new omt(s,r,{onPause:l,onRemove:l,onResume:_=>{const x=this._incoming[_.match.eventType];x&&!x.includes(_)&&(x.push(_),o(),this._manager&&this._manager.updateDependencies())}});let f=this._incoming[s.eventType];return f||(f=[],this._incoming[s.eventType]=f),f.push(c),o(),this._manager&&this._manager.updateDependencies(),c}registerOutgoing(e){if(this._outgoing[e])throw new Error("There is already a callback registered for this outgoing InputEvent: "+e);const i=new amt(e,{onEmit:(r,n,s,o)=>{var l;(l=this._manager)==null||l.emit(r.eventType,n,s,o)},onRemove:r=>{var n;delete this._outgoing[r.eventType],(n=this._manager)==null||n.updateDependencies()}});return this._outgoing[e]=i,this._outgoingEventTypes=null,this._manager&&this._manager.updateDependencies(),i}startCapturingPointer(e){var i;(i=this._manager)==null||i.setPointerCapture(e,!0)}stopCapturingPointer(e){var i;(i=this._manager)==null||i.setPointerCapture(e,!1)}refreshHasPendingInputs(){var e;(e=this._manager)==null||e.refreshHasPendingInputs()}_onUninstall(){this._manager?(this.onUninstall(),this._manager=null):K0e.error("This InputHandler is not registered with an InputManager")}_handleEvent(e){var r;const i=this._incoming[e.type];if(i){for(const n of i)if(n.match.matches(e)&&((r=n.callback)==null||r.call(n,e),e.shouldStopPropagation()))break}}},omt=class{constructor(e,i,r){this.match=e,this._callback=i,this._handler=r}pause(){this._handler.onPause(this)}resume(){this._handler.onResume(this)}remove(){this._handler.onRemove(this)}get callback(){return this._callback}},amt=class{constructor(e,i){this.eventType=e,this._removed=!1,this._handler=i}emit(e,i,r){this._removed||this._handler.onEmit(this,e,i,r)}remove(){this._removed=!0,this._handler.onRemove(this)}},lmt=class extends Rl{constructor(e){super(!0),this._onChange=e,this._value="mouse",this._x=null,this._y=null,this.registerIncoming("pointer-move",i=>{this._update(i.data)})}_update(e){const i=e.native.pointerType==="touch"?"touch":"mouse",{x:r,y:n}=e;i===this._value&&this._x===r&&this._y===n||(this._value=i,this._x=r,this._y=n,this._onChange(i,r,n))}},cmt=class extends Rl{get multiTouchActive(){return this._multiTouchActive.value}constructor(){super(!0),this._activeTouchPointerIds=new Set,this._multiTouchActive=m5(!1),this._onPointerAdd=({data:e})=>{e.pointerType==="touch"&&(this._activeTouchPointerIds.add(e.native.pointerId),this._update())},this._onPointerRemove=({data:e})=>{e.pointerType==="touch"&&(this._activeTouchPointerIds.delete(e.native.pointerId),this._update())},this.registerIncoming("pointer-down",this._onPointerAdd),this.registerIncoming("pointer-up",this._onPointerRemove),this.registerIncoming("pointer-capture-lost",this._onPointerRemove),this.registerIncoming("pointer-cancel",this._onPointerRemove)}_update(){this._multiTouchActive.value=this._activeTouchPointerIds.size>1}},Wp=class extends ze{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._handlersPriority=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=imt,this._latestPointerType="mouse",this._propertiesPool=new x_({latestPointerLocation:dmt},this),this.latestPointerLocation=null,this._paused=!1,this.test={timestamp:void 0,hasCurrentPropagation:()=>!!this._currentPropagation}}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this._installRecognizers()}destroy(){const e=Object.keys(this._nameToGroup);for(const i of e)this.uninstallHandlers(i);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some(e=>e.handler.hasPendingInputs)}get latestPointerType(){return this._latestPointerType}get multiTouchActive(){return this._multiTouchHandler.multiTouchActive}get updating(){return this.hasPendingInputs||this._paused}installHandlers(e,i,r=Es.INTERNAL){if(this._nameToGroup[e])return void Ce.getLogger(this).error("There is already an InputHandler group registered under the name `"+e+"`");if(i.length===0)return void Ce.getLogger(this).error("Can't register a group of zero handlers");const n={name:e,handlers:i.map(s=>({handler:s,active:!0,removed:!1,priorityIndex:0,groupPriority:r,eventCallback:null,uninstallCallback:null}))};this._nameToGroup[e]=n;for(let s=n.handlers.length-1;s>=0;s--){const o=n.handlers[s];this._handlers.push(o),o.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(l,c,f,_,x)=>{this._emitInputEvent(o.priorityIndex+1,l,c,f,x,_)},setPointerCapture:(l,c)=>{this._setPointerCapture(n,o,l,c)},setEventCallback:l=>{o.eventCallback=l},setUninstallCallback:l=>{o.uninstallCallback=l},refreshHasPendingInputs:()=>{this.notifyChange("hasPendingInputs")}})}this.updateDependencies()}uninstallHandlers(e){const i=this._nameToGroup[e];i?(i.handlers.forEach(r=>{var n;r.removed=!0,(n=r.uninstallCallback)==null||n.call(r)}),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):Ce.getLogger(this).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return this._nameToGroup[e]!==void 0}updateDependencies(){if(this._currentPropagation)return void(this._updateDependenciesAfterPropagation=!0);this._updateDependenciesAfterPropagation=!1;const e=new Set,i=new Set;this._handlersPriority=[];for(let r=this._handlers.length-1;r>=0;r--){const n=this._handlers[r];n.priorityIndex=r,this._handlersPriority.push(n)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let r=this._handlersPriority.length-1;r>=0;r--){const n=this._handlersPriority[r];n.priorityIndex=r;let s=n.handler.hasSideEffects;if(!s){for(const o of n.handler.outgoingEventTypes)if(e.has(o)){s=!0;break}}if(s)for(const o of n.handler.incomingEventMatches){e.add(o.eventType);for(const l of o.keyModifiers)nmt(l)||i.add(l)}n.active=s}this._sourceEvents=e,this._keyModifiers=i,this._pointerCaptures.size>0&&this._sourceEvents.add("pointer-capture-lost"),this._keyModifiers.size>0&&(this._sourceEvents.add("key-down"),this._sourceEvents.add("key-up")),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents)}_setLatestPointer(e,i,r){this._latestPointerType=e;const n=this._get("latestPointerLocation");if(n==null||n.x!==i||n.y!==r){const s=this._propertiesPool.get("latestPointerLocation");s.x=i,s.y=r,this._set("latestPointerLocation",s)}}_onEventReceived(e,i){if(e==="pointer-capture-lost"){const s=i;this._pointerCaptures.delete(s.native.pointerId)}this._updateKeyModifiers(e,i);const r=this.test.timestamp!=null?this.test.timestamp:i.native?i.native.timestamp:void 0,n=i.native?i.native.cancelable:void 0;this._emitInputEventFromSource(e,i,r,n)}_updateKeyModifiers(e,i){if(!i)return;let r=!1;const n=()=>{if(!r){const l=new Set;this._activeKeyModifiers.forEach(c=>{l.add(c)}),this._activeKeyModifiers=l,r=!0}},s=(l,c)=>{c&&!this._activeKeyModifiers.has(l)?(n(),this._activeKeyModifiers.add(l)):!c&&this._activeKeyModifiers.has(l)&&(n(),this._activeKeyModifiers.delete(l))};if(e==="key-down"||e==="key-up"){const l=i.key;this._keyModifiers.has(l)&&s(l,e==="key-down")}const o=i.native;s("Alt",!(!o||!o.altKey)),s("Ctrl",!(!o||!o.ctrlKey)),s("Shift",!(!o||!o.shiftKey)),s("Meta",!(!o||!o.metaKey)),s("Primary",this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new lmt((e,i,r)=>this._setLatestPointer(e,i,r)),this._multiTouchHandler=new cmt,this.installHandlers("input-manager-logic",[this._latestPointerHandler,this._multiTouchHandler],Es.ALWAYS),this.recognizers.length>0&&this.installHandlers("default",this.recognizers,Es.INTERNAL)}_setPointerCapture(e,i,r,n){const s=e.name+"-"+i.priorityIndex,o=this._pointerCaptures.get(r.pointerId)||new Set;this._pointerCaptures.set(r.pointerId,o),n?(o.add(s),o.size===1&&this.eventSource&&this.eventSource.setPointerCapture(r,!0)):o.has(s)&&(o.delete(s),o.size===0&&(this._pointerCaptures.delete(r.pointerId),this.eventSource&&this.eventSource.setPointerCapture(r,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter(e=>!e.removed),this.updateDependencies()}_emitInputEventFromSource(e,i,r,n){this._emitInputEvent(0,e,i,r,n)}_emitInputEvent(e,i,r,n,s,o){const l=n!==void 0?n:this._currentPropagation?this._currentPropagation.timestamp:performance.now(),c=s!==void 0&&s,f={event:new umt(i,r,l,o||this._activeKeyModifiers,c),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(f):this._doNewPropagation(f)}_doNewPropagation(e){this._currentPropagation={events:new cU,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){var i,r,n;this._paused=!1;const e=this._currentPropagation;if(e){for(;e.events.length>0;){const{event:s,priorityIndex:o}=e.events.pop(),l=(i=s.data)==null?void 0:i.eventId;if(!(l!=null&&this._stoppedPropagationEventIds.has(l)))for(e.currentHandler=this._handlersPriority[o];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!s.shouldStopPropagation()&&((n=(r=e.currentHandler).eventCallback)==null||n.call(r,s)),s.shouldStopPropagation()){l!=null&&this._stoppedPropagationEventIds.add(l);break}if(s.shouldPausePropagation(()=>this._continuePropagation()))return void this._pausePropagation({event:s,priorityIndex:e.currentHandler.priorityIndex+1})}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}}_pausePropagation(e){const i=new cU;i.push(e);const r=this._currentPropagation;if(r){for(;r.events.length;)i.push(r.events.pop());r.events=i,r.currentHandler=null,this._paused=!0}}_compareHandlerPriority(e,i){if(e.handler.hasSideEffects!==i.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==i.groupPriority)return e.groupPriority>i.groupPriority?-1:1;for(const r of e.handler.incomingEventMatches)for(const n of i.handler.incomingEventMatches){if(r.eventType!==n.eventType)continue;const s=r.keyModifiers.filter(o=>n.keyModifiers.includes(o));if(s.length===r.keyModifiers.length!=(s.length===n.keyModifiers.length))return r.keyModifiers.length>n.keyModifiers.length?-1:1}return e.priorityIndex>i.priorityIndex?-1:1}_sortHandlersPriority(e){const i=[];for(const r of e){let n=0;for(;n=0;)n++;i.splice(n,0,r)}return i}get debug(){const e=i=>{const r=this._setPointerCapture;this._setPointerCapture=()=>{},i(),this._setPointerCapture=r};return{injectEvent:(i,r)=>{e(()=>{this._onEventReceived(i,r)})},disablePointerCapture:e}}};y([w({readOnly:!0})],Wp.prototype,"hasPendingInputs",null),y([w({constructOnly:!0})],Wp.prototype,"eventSource",void 0),y([w({constructOnly:!0})],Wp.prototype,"recognizers",void 0),y([w()],Wp.prototype,"_latestPointerType",void 0),y([w()],Wp.prototype,"latestPointerType",null),y([w()],Wp.prototype,"multiTouchActive",null),y([w({readOnly:!0})],Wp.prototype,"latestPointerLocation",void 0),y([w()],Wp.prototype,"_paused",void 0),y([w({readOnly:!0})],Wp.prototype,"updating",null),Wp=y([Z("esri.views.input.InputManager")],Wp);let umt=class{constructor(e,i,r,n,s){this.type=e,this.data=i,this.timestamp=r,this.modifiers=n,this.cancelable=s,this._propagationState=Dw.NONE,this._resumeCallback=null}stopPropagation(){this._propagationState|=Dw.STOPPED}shouldStopPropagation(){return(this._propagationState&Dw.STOPPED)!=0}async(e){this._propagationState|=Dw.PAUSED;const i=(r,n)=>{this._propagationState&=~Dw.PAUSED;const s=this._resumeCallback;if(this._resumeCallback=null,s&&s(),n)throw r;return r};return(typeof e=="function"?e():e).then(r=>i(r,!1),r=>i(r,!0))}shouldPausePropagation(e){return!!(this._propagationState&Dw.PAUSED)&&(this._resumeCallback=e,!0)}preventDefault(){this.data.native.preventDefault()}};var Dw;(function(t){t[t.NONE=0]="NONE",t[t.STOPPED=1]="STOPPED",t[t.PAUSED=2]="PAUSED"})(Dw||(Dw={}));const Es={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};let hmt=class{};const dmt=hmt;function eg(t){return t!=null&&"open"in t&&"declaredClass"in t}function Q0e(t){return t!=null&&"declaredClass"in t&&"dockOptions"in t}const pmt=t=>{let e=class extends t{constructor(){super(...arguments),this._popupSetupTask=null,this.popup={},this.popupEnabled=!0}initialize(){this.addHandles([_e(()=>[this.ui,this.popup],([i,r],n)=>{const s="popup",o="manual";if(n){const[l,c]=n;l&&eg(c)&&(c.view=null,Q0e(c)&&l.remove(c,s))}i&&eg(r)&&(r.view=this,Q0e(r)&&i.add(r,{key:s,position:o,internal:!0}))},ii),this.on("click",i=>{this.popup&&this.popupEnabled&&(i.pointerType!=="mouse"||i.button===0)&&(!eg(this.popup)&&"autoOpenEnabled"in this.popup&&this.popup.autoOpenEnabled===!1||(eg(this.popup)?this.popup.viewModel.handleViewClick(i):i.async(async()=>{await this.setupPopup(),eg(this.popup)&&!this.destroyed&&this.ready&&this.popupEnabled&&this.popup.viewModel.handleViewClick(i)})))},Es.WIDGET)]),rd(()=>this.ready&&this.popupEnabled&&!this.updating).then(()=>{we(()=>import("./Popup-aRK3Vd3w.js"),__vite__mapDeps([156,78,157,74,75,76,77,52,53,62,48,49,50,51,54,55,56,57,58,59,60,61,158,159]))})}destroy(){this.destroyed||this.closePopup()}async openPopup(i){if(eg(this.popup))return this.popup.open(i);try{if(await this.setupPopup(),!this.popup)return void Ce.getLogger(this).error(new se("view:null-popup","Popup is null and can't be opened"));this.popup.open(i)}catch{}}closePopup(){var i;(i=this._popupSetupTask)==null||i.abort(),eg(this.popup)&&this.popup.close()}async fetchPopupFeatures(i,r){await this.when();const{location:n,queryArea:s,layerViewsAndGraphics:o,clientOnlyGraphics:l}=await this._prepareFetchPopupFeatures(i,r),c=Promise.resolve(l),f=this._queryLayerPopupFeatures(s,o,r),_=f.map(x=>x.promise);return{location:n,clientOnlyGraphics:l,allGraphicsPromise:wGe([c,..._]).then(x=>Array.from(new Set(x.flat()))),promisesPerLayerView:f}}async setupPopup(){var i;if((i=this._popupSetupTask)==null||i.abort(),this.popup&&!eg(this.popup))return this._popupSetupTask=Cc(async r=>{const{default:n}=await we(()=>import("./Popup-aRK3Vd3w.js"),__vite__mapDeps([156,78,157,74,75,76,77,52,53,62,48,49,50,51,54,55,56,57,58,59,60,61,158,159]));if(St(r),!this.popup||eg(this.popup))return;const s=this.popup;delete s.open,delete s.close,this.popup=new n(s)}),this._popupSetupTask.promise}_queryLayerPopupFeatures(i,r,n){return r.map(({layerView:s,graphics:o})=>{const l={clientGraphics:o,event:n!=null?n.event:void 0,signal:n!=null?n.signal:void 0,defaultPopupTemplateEnabled:n!=null&&!!n.defaultPopupTemplateEnabled},c=s.fetchPopupFeatures(i,l);return{layerView:s,promise:c}})}_isValidPopupGraphic(i,r){return i&&!!i.getEffectivePopupTemplate(r!=null&&r.defaultPopupTemplateEnabled)}async _prepareFetchPopupFeatures(i,r){const{clientGraphics:n,queryArea:s,location:o}=await this._popupHitTestGraphics(i,r),l=this._getFetchPopupLayerViews(),{layerViewsAndGraphics:c,clientOnlyGraphics:f}=this._graphicsPerFetchPopupLayerView(n,l);return{clientOnlyGraphics:f,layerViewsAndGraphics:c,queryArea:s,location:o}}async _popupHitTestGraphics(i,r){const n=await this.popupHitTest(i),s=n.results,o=n.mapPoint,l=s.filter(f=>f.type==="graphic"&&this._isValidPopupGraphic(f.graphic,r)),c=l.length?l[0].mapPoint:null;return{clientGraphics:l.map(f=>f.graphic),queryArea:o,location:o||c}}_getFetchPopupLayerViews(){const i=[];return this.allLayerViews.forEach(r=>{this._isValidPopupLayerView(r)&&i.push(r)}),this.graphicsView!=null&&this._isValidPopupLayerView(this.graphicsView)&&i.push(this.graphicsView),i.reverse()}_isValidPopupLayerView(i){return i!=null&&(!("layer"in i)||!i.suspended)&&"fetchPopupFeatures"in i}_graphicsPerFetchPopupLayerView(i,r){const n=[],s=new Map,o=r.map(l=>{const c=[];return"layer"in l?s.set(l.layer,c):s.set(l.graphics,c),{layerView:l,graphics:c}});for(const l of i){const c=s.get(l.layer)||s.get(l.sourceLayer)||null;c?c.push(l):n.push(l)}return{layerViewsAndGraphics:o,clientOnlyGraphics:n}}};return y([w({cast(i){return!i||eg(i)||typeof i=="object"&&(i.open=r=>(NO(Ce.getLogger(this),"view.popup is no longer created by default. view.popup.open() will stop working when the popup isn't created",{replacement:"Use view.openPopup() instead.",version:"4.27"}),this.openPopup(r)),i.close=()=>(NO(Ce.getLogger(this),"view.popup is no longer created by default. view.popup.close() will stop working when the popup isn't created",{replacement:"Use view.closePopup() instead.",version:"4.27"}),this.closePopup())),i}})],e.prototype,"popup",void 0),y([w()],e.prototype,"popupEnabled",void 0),e=y([Z("esri.views.PopupView")],e),e};let aw=class extends ze{constructor(e){super(e),this.view=null,this.baseLayerViews=new it,this.referenceLayerViews=new it,this._loadingHandle=_e(()=>{var i,r;return(r=(i=this.view)==null?void 0:i.map)==null?void 0:r.basemap},i=>{i&&i.load().catch(()=>{})},ii)}destroy(){this._set("view",null),this._loadingHandle&&(this._loadingHandle.remove(),this._loadingHandle=null);for(const e of this.baseLayerViews)e.destroy();this.baseLayerViews.length=0;for(const e of this.referenceLayerViews)e.destroy();this.referenceLayerViews.length=0}get suspended(){return!this.view||this.view.suspended}get updating(){var i,r;if(this.view&&this.view.suspended)return!1;const e=(r=(i=this.view)==null?void 0:i.map)==null?void 0:r.basemap;return!!e&&!!e.loaded&&(this.baseLayerViews.some(n=>n.updating)||this.referenceLayerViews.some(n=>n.updating))}};y([w({constructOnly:!0})],aw.prototype,"view",void 0),y([w({readOnly:!0})],aw.prototype,"baseLayerViews",void 0),y([w({readOnly:!0})],aw.prototype,"referenceLayerViews",void 0),y([w({readOnly:!0})],aw.prototype,"suspended",null),y([w({type:Boolean,readOnly:!0})],aw.prototype,"updating",null),aw=y([Z("esri.views.BasemapView")],aw);function fmt(t){return"tryRecycleWith"in t}let mmt=class{constructor(e,i,r){this.layer=e,this.view=i,this.layerViewImporter=r,this._controller=new AbortController,this._deferred=Jl(),this._started=!1,this.done=!1,this.promise=this._deferred.promise,Yl(this._controller.signal,()=>{const n=new se("cancelled:layerview-create","layerview creation cancelled",{layer:e});this._deferred.reject(n)})}tryRecycle(e){if(!this.done||!this.layerView||!fmt(this.layerView))return null;const i=this.layer.type,r=this._controller.signal;for(let n=0;n(St(this._controller.signal),s.emit("layerview-destroy",{view:c,layerView:l}),c.emit("layerview-destroy",{view:c,layerView:l}),s.emit("layerview-create",{view:c,layerView:l}),c.emit("layerview-create",{view:c,layerView:l}),l)),new Promise((f,_)=>Yl(this._controller.signal,()=>_(ur())))]),this.promise}}return null}destroy(){this._controller.abort();const{layerView:e}=this;if(e){const{layer:i,view:r}=this;i.emit("layerview-destroy",{view:r,layerView:e}),r.emit("layerview-destroy",{layer:i,layerView:e})}this.done=!0,this.layer=null,this.layerView=null,this.view=null,this.layerViewImporter=null,this._map=null}async start(){var n,s;if(this._started)return;this._started=!0;const{_controller:{signal:e},layer:i,view:r}=this;this._map=r.map;try{let o,l;if(await i.load({signal:e}),i.prefetchResources&&await i.prefetchResources({signal:e}),ymt(i))o=await i.createLayerView(r,{signal:e});else{if(!this.layerViewImporter.hasLayerViewModule(i))throw new se("layer:view-not-supported","No layerview implementation was found");const _=await this.layerViewImporter.importLayerView(i);St(e),o="default"in _?new _.default({layer:i,view:r}):new _({layer:i,view:r})}const c=()=>{l=en(l),o.destroyed||o.destroy(),o.layer=null,o.parent=null,o.view=null,this.done=!0};l=Yl(e,c),St(e);try{await o.when()}catch(_){throw c(),_}if(!((s=(n=this._map)==null?void 0:n.allLayers)==null?void 0:s.includes(i)))return c(),void this._deferred.reject(new se("view:no-layerview-for-layer","The layer has been removed from the map",{layer:i}));this.layerView=o,i.emit("layerview-create",{view:r,layerView:o}),r.emit("layerview-create",{layer:i,layerView:o}),this.done=!0,this._deferred.resolve(o)}catch(o){i.emit("layerview-create-error",{view:r,error:o}),r.emit("layerview-create-error",{layer:i,error:o}),this.done=!0,this._deferred.reject(new se("layerview:create-error","layerview creation failed",{layer:i,error:o}))}}},Yp=class extends ze{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new Rf,this.supportsGround=!0,this._preloadLayerViewModules=()=>{var r;const i=(r=this.view.map)==null?void 0:r.allLayers;if(i)for(const n of i)this.layerViewImporter.hasLayerViewModule(n)&&this.layerViewImporter.importLayerView(n)},this._reschedule=()=>this.destroyed?Promise.reject():(this._workPromise==null&&(this._workPromise=Jl(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(tx(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{var c,f,_;if(this.destroyed)return;const i=this.view.map;if(this._map!==i&&(this.clear(),this._map=i),this._workPromise==null)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,n=[],s=this.view.ready,o=x=>{if(x!=null){for(const T of x)if(T){r.add(T);const A=this._layerLayerViewInfoMap.get(T);A&&s?A.start():A||this._recyclingInfoMap.has(T)||n.push(T),"layers"in T&&T.layers&&o(T.layers)}}};for(const x of this._rootCollectionNames)o(au(this,x));for(const[x,T]of this._layerLayerViewInfoMap)if(!r.has(x)){this._layerLayerViewInfoMap.delete(T.layer);const A=T.tryRecycle(n);A?(this.notifyChange("updating"),this._recyclingInfoMap.set(T.layer,T),A.then(()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(T.layer),this._layerLayerViewInfoMap.set(T.layer,T),this._reschedule()}).catch(()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(T.layer),T.destroy(),this._reschedule()})):T.destroy()}for(const[x,T]of this._recyclingInfoMap)r.has(x)||(this.notifyChange("updating"),this._recyclingInfoMap.delete(T.layer),T.destroy());for(const x of n)this._createLayerView(x);this._refreshCollections();const l=[(c=i==null?void 0:i.ground)==null?void 0:c.layers,(f=i==null?void 0:i.basemap)==null?void 0:f.baseLayers,(_=i==null?void 0:i.basemap)==null?void 0:_.referenceLayers,i==null?void 0:i.layers].filter(x=>!!x);r.forEach(x=>"layers"in x&&l.push(x.layers)),this.addHandles(l.map(x=>this._watchUpdatingTracking.addOnCollectionChange(()=>x,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null}}initialize(){this.addHandles([Jr(()=>{var e,i;return(i=(e=this.view)==null?void 0:e.map)==null?void 0:i.allLayers},"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),_e(()=>{const e=this.view,i=e==null?void 0:e.map;return[i==null?void 0:i.basemap,i==null?void 0:i.ground,i==null?void 0:i.layers,e==null?void 0:e.ready]},()=>this._reschedule(),kt)]),this._preloadLayerViewModules(),this._reschedule()}destroy(){this.clear(),WH(this._recyclingInfoMap),WH(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,this._workPromise!=null&&(this._workPromise.reject(ur()),this._workPromise=null)}get _layersToLayerViews(){const e=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.layers","view.layerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"]];return this.supportsGround&&e.push(["view.map.ground.layers","view.groundView.layerViews"]),new Map(e)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return this._workPromise!=null||this._watchUpdatingTracking.updating||rp(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const i of this._layerLayerViewInfoMap.values())i.done||++e;return e}clear(){this.destroyed||(WH(this._layerLayerViewInfoMap),this._refreshCollections())}async whenLayerView(e){if(await this._reschedule(),!this._layerLayerViewInfoMap.has(e)){if(this._recyclingInfoMap.has(e))return this._recyclingInfoMap.get(e).promise;throw new se("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e})}return this._layerLayerViewInfoMap.get(e).promise}_refreshCollections(){for(const[e,i]of this._layersToLayerViews)this._populateLayerViewsOwners(au(this,e),au(this,i),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_populateLayerViewsOwners(e,i,r){if(!e||!i)return void(i&&i.removeAll());let n=0;for(const s of e){const o=this._layerLayerViewInfoMap.get(s);if(!(o!=null&&o.layerView))continue;const l=o.layerView;l.layer=s,l.parent=r,i.at(n)!==l&&i.splice(n,0,l),s.layers&&this._populateLayerViewsOwners(s.layers,l.layerViews,l),n+=1}n{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const i=new mmt(e,this.view,this.layerViewImporter);i.promise.then(()=>this._refreshCollections(),r=>{r&&(sn(r)||r.name==="cancelled:layerview-create")||Ce.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,i),this.view.ready&&i.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};y([w()],Yp.prototype,"_workPromise",void 0),y([w({readOnly:!0})],Yp.prototype,"_watchUpdatingTracking",void 0),y([w({readOnly:!0})],Yp.prototype,"_layersToLayerViews",null),y([w({readOnly:!0})],Yp.prototype,"_rootCollectionNames",null),y([w()],Yp.prototype,"layerViewImporter",void 0),y([w()],Yp.prototype,"supportsGround",void 0),y([w({readOnly:!0})],Yp.prototype,"updating",null),y([w({readOnly:!0})],Yp.prototype,"updatingRemaining",null),y([w({constructOnly:!0})],Yp.prototype,"view",void 0),Yp=y([Z("esri.views.LayerViewManager")],Yp);const gmt=Yp;function ymt(t){return"createLayerView"in t&&t.createLayerView!=null}let Id=class extends ze{constructor(e){super(e),this.factor=1.5,this.offset=Ku(0,0),this.position=null,this.size=120,this.maskUrl=null,this.maskEnabled=!0,this.overlayUrl=null,this.overlayEnabled=!0,this.visible=!0}get version(){return this.commitProperty("factor"),this.commitProperty("offset"),this.commitProperty("position"),this.commitProperty("visible"),this.commitProperty("size"),this.commitProperty("maskUrl"),this.commitProperty("maskEnabled"),this.commitProperty("overlayUrl"),this.commitProperty("overlayEnabled"),(this._get("version")||0)+1}};y([w({type:Number})],Id.prototype,"factor",void 0),y([w({nonNullable:!0})],Id.prototype,"offset",void 0),y([w()],Id.prototype,"position",void 0),y([w({type:Number,range:{min:0}})],Id.prototype,"size",void 0),y([w()],Id.prototype,"maskUrl",void 0),y([w()],Id.prototype,"maskEnabled",void 0),y([w()],Id.prototype,"overlayUrl",void 0),y([w()],Id.prototype,"overlayEnabled",void 0),y([w({readOnly:!0})],Id.prototype,"version",null),y([w({type:Boolean})],Id.prototype,"visible",void 0),Id=y([Z("esri.views.Magnifier")],Id);const vIe=Id;let Z4=class extends Xs(ze){constructor(e){super(e),this.accentColor=new qe([255,127,0]),this.textColor=new qe([255,255,255])}};y([w({type:qe,nonNullable:!0})],Z4.prototype,"accentColor",void 0),y([w({type:qe,nonNullable:!0})],Z4.prototype,"textColor",void 0),Z4=y([Z("esri.views.Theme")],Z4);const Tee=Z4;var eme;(function(t){t[t.Left=0]="Left",t[t.Middle=1]="Middle",t[t.Right=2]="Right"})(eme||(eme={}));const _Ie=["click","double-click","immediate-click","immediate-double-click","hold","drag","key-down","key-up","pointer-down","pointer-move","pointer-up","pointer-drag","mouse-wheel","pointer-enter","pointer-leave","gamepad","focus","blur"],bIe={};function wIe(t){return!!bIe[t]}function vmt(t){for(const e of t)if(!wIe(e))return!1;return!0}_Ie.forEach(t=>{bIe[t]=!0});let _mt=class{constructor(e){this._handlers=new Map,this._counter=0,this._handlerCounts=new Map,this.view=e,this.inputManager=null}connect(e){e&&this.disconnect(),this.inputManager=e,this._handlers.forEach(({handler:i,priority:r},n)=>{var s;return(s=this.inputManager)==null?void 0:s.installHandlers(n,[i],r)})}disconnect(){this.inputManager&&this._handlers.forEach((e,i)=>{var r;return(r=this.inputManager)==null?void 0:r.uninstallHandlers(i)}),this.inputManager=null}destroy(){this.disconnect(),this._handlers.clear(),this.view=null}on(e,i,r,n){const s=Array.isArray(e)?e:e.split(",");if(!vmt(s))return s.some(wIe)&&console.error("Error: registering input events and other events on the view at the same time is not supported."),null;let o,l;Array.isArray(i)?l=i:(o=i,l=[]),typeof r=="function"?o=r:n=r,n=n??Es.DEFAULT;const c=this._createUniqueGroupName(),f=new bmt(this.view,s,l,o);this._handlers.set(c,{handler:f,priority:n});for(const _ of s){const x=this._handlerCounts.get(_)||0;this._handlerCounts.set(_,x+1)}return this.inputManager&&this.inputManager.installHandlers(c,[f],n),rr(()=>this._removeHandler(c,s))}hasHandler(e){return!!this._handlerCounts.get(e)}_removeHandler(e,i){if(this._handlers.has(e)){this._handlers.delete(e);for(const r of i){const n=this._handlerCounts.get(r);n===void 0?console.error("Trying to remove handler for event that has no handlers registered: ",r):n===1?this._handlerCounts.delete(r):this._handlerCounts.set(r,n-1)}}this.inputManager&&this.inputManager.uninstallHandlers(e)}_createUniqueGroupName(){return this._counter+=1,`viewEvents_${this._counter}`}},bmt=class extends Rl{constructor(e,i,r,n){super(!0),this._latestDragStart=void 0,this.view=e;for(const s of i)switch(s){case"click":this.registerIncoming("click",r,o=>n(this._wrapClick(o)));break;case"double-click":this.registerIncoming("double-click",r,o=>n(this._wrapDoubleClick(o)));break;case"immediate-click":this.registerIncoming("immediate-click",r,o=>n(this._wrapImmediateClick(o)));break;case"immediate-double-click":this.registerIncoming("immediate-double-click",r,o=>n(this._wrapImmediateDoubleClick(o)));break;case"hold":this.registerIncoming("hold",r,o=>n(this._wrapHold(o)));break;case"drag":this.registerIncoming("drag",r,o=>{const l=this._wrapDrag(o);l&&n(l)});break;case"key-down":this.registerIncoming("key-down",r,o=>n(this._wrapKeyDown(o)));break;case"key-up":this.registerIncoming("key-up",r,o=>n(this._wrapKeyUp(o)));break;case"pointer-down":this.registerIncoming("pointer-down",r,o=>n(this._wrapPointer(o,"pointer-down")));break;case"pointer-move":this.registerIncoming("pointer-move",r,o=>n(this._wrapPointer(o,"pointer-move")));break;case"pointer-up":this.registerIncoming("pointer-up",r,o=>n(this._wrapPointer(o,"pointer-up")));break;case"pointer-drag":this.registerIncoming("pointer-drag",r,o=>n(this._wrapPointerDrag(o)));break;case"mouse-wheel":this.registerIncoming("mouse-wheel",r,o=>n(this._wrapMouseWheel(o)));break;case"pointer-enter":this.registerIncoming("pointer-enter",r,o=>n(this._wrapPointer(o,"pointer-enter")));break;case"pointer-leave":this.registerIncoming("pointer-leave",r,o=>n(this._wrapPointer(o,"pointer-leave")));break;case"gamepad":this.registerIncoming("gamepad",r,o=>{n(this._wrapGamepad(o))});break;case"focus":this.registerIncoming("focus",r,o=>{n(this._wrapFocus(o))});break;case"blur":this.registerIncoming("blur",r,o=>{n(this._wrapBlur(o))})}}_wrapFocus(e){return{type:"focus",timestamp:e.timestamp,native:e.data.native,cancelable:e.cancelable,stopPropagation:()=>e.stopPropagation(),async:i=>e.async(i),preventDefault:()=>e.preventDefault()}}_wrapBlur(e){return{type:"blur",timestamp:e.timestamp,native:e.data.native,cancelable:e.cancelable,stopPropagation:()=>e.stopPropagation(),async:i=>e.async(i),preventDefault:()=>e.preventDefault()}}_wrapClick(e){const{pointerType:i,button:r,buttons:n,x:s,y:o,native:l,eventId:c}=e.data,{cancelable:f,timestamp:_}=e;return{type:"click",pointerType:i,button:r,buttons:n,x:s,y:o,native:l,timestamp:_,screenPoint:Ku(s,o),mapPoint:this._getMapPoint(s,o),eventId:c,cancelable:f,stopPropagation:()=>e.stopPropagation(),async:x=>e.async(x),preventDefault:()=>e.preventDefault()}}_wrapDoubleClick(e){const{pointerType:i,button:r,buttons:n,x:s,y:o,native:l,eventId:c}=e.data,{cancelable:f,timestamp:_}=e;return{type:"double-click",pointerType:i,button:r,buttons:n,x:s,y:o,native:l,timestamp:_,mapPoint:this._getMapPoint(s,o),eventId:c,cancelable:f,stopPropagation:()=>e.stopPropagation(),async:x=>e.async(x),preventDefault:()=>e.preventDefault()}}_wrapImmediateClick(e){const{pointerType:i,button:r,buttons:n,x:s,y:o,native:l,eventId:c}=e.data,f=l.pointerId,{cancelable:_,timestamp:x}=e;return{type:"immediate-click",pointerId:f,pointerType:i,button:r,buttons:n,x:s,y:o,native:l,timestamp:x,mapPoint:this._getMapPoint(s,o),eventId:c,cancelable:_,stopPropagation:()=>e.stopPropagation(),async:T=>e.async(T),preventDefault:()=>e.preventDefault()}}_wrapImmediateDoubleClick(e){const{pointerType:i,button:r,buttons:n,x:s,y:o,native:l,eventId:c}=e.data,f=l.pointerId,{cancelable:_,timestamp:x}=e;return{type:"immediate-double-click",pointerId:f,pointerType:i,button:r,buttons:n,x:s,y:o,native:l,timestamp:x,mapPoint:this._getMapPoint(s,o),eventId:c,cancelable:_,stopPropagation:()=>e.stopPropagation(),async:T=>e.async(T),preventDefault:()=>e.preventDefault()}}_wrapHold(e){const{pointerType:i,button:r,buttons:n,x:s,y:o,native:l}=e.data,{cancelable:c,timestamp:f}=e;return{type:"hold",pointerType:i,button:r,buttons:n,x:s,y:o,native:l,timestamp:f,mapPoint:this._getMapPoint(s,o),cancelable:c,stopPropagation:()=>e.stopPropagation(),async:_=>e.async(_),preventDefault:()=>e.preventDefault()}}_getMapPoint(e,i){return this.view.toMap(Ku(e,i),{exclude:[]})}_wrapDrag(e){const i=e.data,{x:r,y:n}=i.center,{action:s,pointerType:o,button:l}=i;if(s==="start"&&(this._latestDragStart=i),!this._latestDragStart)return;const c=i.pointer.native,f=i.buttons,{cancelable:_,timestamp:x}=e,T={x:this._latestDragStart.center.x,y:this._latestDragStart.center.y};return s==="end"&&(this._latestDragStart=void 0),{type:"drag",action:s,x:r,y:n,origin:T,pointerType:o,button:l,buttons:f,radius:i.radius,angle:pu(i.angle),native:c,timestamp:x,cancelable:_,stopPropagation:()=>e.stopPropagation(),async:A=>e.async(A),preventDefault:()=>e.preventDefault()}}_wrapKeyDown(e){const{key:i,repeat:r,native:n}=e.data,{cancelable:s,timestamp:o}=e;return{type:"key-down",key:i,repeat:r,native:n,timestamp:o,cancelable:s,stopPropagation:()=>e.stopPropagation(),async:l=>e.async(l),preventDefault:()=>e.preventDefault()}}_wrapKeyUp(e){const{key:i,native:r}=e.data,{cancelable:n,timestamp:s}=e;return{type:"key-up",key:i,native:r,timestamp:s,cancelable:n,stopPropagation:()=>e.stopPropagation(),async:o=>e.async(o),preventDefault:()=>e.preventDefault()}}_wrapPointer(e,i){const{x:r,y:n,button:s,buttons:o,native:l,eventId:c}=e.data,f=l.pointerId,_=l.pointerType,{cancelable:x,timestamp:T}=e;return{type:i,x:r,y:n,pointerId:f,pointerType:_,button:s,buttons:o,native:l,timestamp:T,eventId:c,cancelable:x,stopPropagation:()=>e.stopPropagation(),async:A=>e.async(A),preventDefault:()=>e.preventDefault()}}_wrapPointerDrag(e){const{x:i,y:r,buttons:n,native:s,eventId:o}=e.data.currentEvent,{button:l}=e.data.startEvent,c=e.data.startEvent.native.pointerId,f=e.data.startEvent.native.pointerType,_=e.data.action,x={x:e.data.startEvent.x,y:e.data.startEvent.y},{cancelable:T,timestamp:A}=e;return{type:"pointer-drag",x:i,y:r,pointerId:c,pointerType:f,button:l,buttons:n,action:_,origin:x,native:s,timestamp:A,eventId:o,cancelable:T,stopPropagation:()=>e.stopPropagation(),async:M=>e.async(M),preventDefault:()=>e.preventDefault()}}_wrapMouseWheel(e){const{cancelable:i,data:r,timestamp:n}=e,{x:s,y:o,deltaY:l,native:c}=r;return{type:"mouse-wheel",x:s,y:o,deltaY:l,native:c,timestamp:n,cancelable:i,stopPropagation:()=>e.stopPropagation(),async:f=>e.async(f),preventDefault:()=>e.preventDefault()}}_wrapGamepad(e){const{action:i,state:r,device:n}=e.data,{cancelable:s,timestamp:o}=e,{buttons:l,axes:c}=r;return{type:"gamepad",device:n,timestamp:o,action:i,buttons:l,axes:c,cancelable:s,stopPropagation:()=>e.stopPropagation(),async:f=>e.async(f),preventDefault:()=>e.preventDefault()}}};var CL,tme,ime;(function(t){t[t.USER=0]="USER",t[t.MANAGER=1]="MANAGER"})(CL||(CL={})),function(t){t[t.None=0]="None",t[t.Unfocused=1]="Unfocused",t[t.Focused=2]="Focused",t[t.Unselected=4]="Unselected",t[t.Selected=8]="Selected",t[t.All=15]="All"}(tme||(tme={})),function(t){t[t.None=0]="None",t[t.Custom1=16]="Custom1",t[t.Custom2=32]="Custom2",t[t.Custom3=64]="Custom3",t[t.Custom4=128]="Custom4",t[t.Custom5=256]="Custom5",t[t.Custom6=512]="Custom6",t[t.Custom7=1024]="Custom7",t[t.Custom8=2048]="Custom8",t[t.Custom9=4096]="Custom9",t[t.Custom10=8192]="Custom10",t[t.Custom11=16384]="Custom11",t[t.Custom12=32768]="Custom12",t[t.All=65520]="All"}(ime||(ime={}));function wmt(t){return[t.on("before-add",e=>{const i=e.item;if(i==null||t.includes(i))return Ce.getLogger("esri.views.interactive.interactiveToolUtils").warn("Tool is either already in the list of tools or tool is `null`. Not adding tool."),void e.preventDefault();i.onAdd()}),t.on("after-remove",e=>{const i=e.item;i.active&&(i.view.activeTool=null),i.destroy()})]}function Eee(t){return t.visible&&t.getEditableFlag!=null&&t.getEditableFlag(CL.USER)&&t.getEditableFlag(CL.MANAGER)}function sf(t){return Ku(t.x,t.y)}function fti(t){return ss(t.x,t.y)}function xIe(t,e){var r;const i=(r=t instanceof HTMLElement?t:t.surface)==null?void 0:r.getBoundingClientRect();return i?Ku(e.clientX-i.left,e.clientY-i.top):Ku(0,0)}function rme(t,e){return e instanceof Event?xIe(t,e):sf(e)}function nme(t){if(t instanceof Event)return!0;if(typeof t=="object"&&"type"in t)switch(t.type){case"click":case"double-click":case"pointer-down":case"pointer-drag":case"pointer-enter":case"pointer-leave":case"pointer-up":case"pointer-move":case"immediate-click":case"immediate-double-click":case"hold":case"drag":case"mouse-wheel":return!0;default:return!1}return!1}let xmt=class{constructor(){this._pointerLocations=new Map,this._hoveredManipulators=new Map,this._grabbedManipulators=new Map,this._draggedManipulators=new Map,this._stopDrag=!1,this._revertToNullActiveTool=!1,this._cursor=null}get cursor(){return this._cursor}hasFocusedManipulators(){return this._grabbedManipulators.size>0||this._draggedManipulators.size>0}handleInputEvent(e,i){const r=()=>e.stopPropagation();switch(e.type){case"pointer-move":sme(e.pointerType)&&this._pointerLocations.set(e.pointerId,{x:e.x,y:e.y,pointerType:e.pointerType});break;case"drag":this._grabbedManipulators.size>0&&(this._stopDrag=!0),this._stopDrag&&(r(),e.action==="end"&&(this._stopDrag=!1));break;case"pointer-down":{if(!ome(e))break;const n=sf(e),s=this._intersect(n,e.pointerType,i.forEachTool);if(s==null)break;const o=s.manipulator,l=s.tool;o==null||l==null||!o.interactive||o.grabbable&&o.grabbableForEvent(e)||!o.grabbing||o.dragging||this._ungrabManipulatorBeforeDragging(o,e,i),o!=null&&l!=null&&o.interactive&&o.grabbable&&o.grabbableForEvent(e)&&!o.grabbing&&(this._grabbedManipulators.set(e.pointerId,{manipulator:o,tool:l,start:n,pointerType:e.pointerType}),this._grabbedManipulators.size===1&&i.activeTool==null&&(this._revertToNullActiveTool=!0,i.setActiveTool(s.tool)),o.grabbing=!0,o.events.emit("grab-changed",{action:"start",pointerType:e.pointerType,screenPoint:n}),r());break}case"pointer-up":this._draggedManipulators.has(e.pointerId)||this._handlePointerEnd(e,i);break;case"pointer-drag":{if(!ome(e))break;const n=this._grabbedManipulators.get(e.pointerId),s=n==null?void 0:n.manipulator,o=n==null?void 0:n.tool;if(s==null||o==null)break;const l=sf(e);l.x=Je(l.x,0,i.view.width),l.y=Je(l.y,0,i.view.height);const c=n.start,f=this._draggedManipulators.get(e.pointerId);switch(e.action){case"start":case"update":e.action!=="update"&&this._grabbedManipulators.size!==1||(s.dragging=!0,f?s.events.emit("drag",{action:"update",start:c,screenPoint:l}):s.events.emit("drag",{action:"start",start:c,screenPoint:l,pointerType:e.pointerType}),this._draggedManipulators.set(e.pointerId,{tool:o,manipulator:s,start:c}));break;case"end":s.dragging=!1,f&&s.events.emit("drag",{action:"end",start:c,screenPoint:l}),this._draggedManipulators.delete(e.pointerId),this._handlePointerEnd(e,i)}r();break}case"immediate-click":{const n=sf(e),s=this._intersect(n,e.pointerType,i.forEachTool);if(Smt(e)||i.forEachTool(f=>{if((s==null||s.tool!==f||f.automaticManipulatorSelection)&&f.manipulators){let _=!1;f.manipulators.forEach(({manipulator:x})=>{x.selected&&(x.selected=!1,_=!0)}),_&&f.onManipulatorSelectionChanged&&f.onManipulatorSelectionChanged()}}),s==null)break;const{manipulator:o,tool:l}=s;if(!o.interactive)break;o.selectable&&l.automaticManipulatorSelection&&(o.selected=!o.selected,l.onManipulatorSelectionChanged&&l.onManipulatorSelectionChanged());const c=e.native.shiftKey;o.events.emit("immediate-click",{screenPoint:n,button:e.button,pointerType:e.pointerType,shiftKey:c,stopPropagation:r}),rq(o,r);break}case"click":{const n=sf(e),s=this._intersect(n,e.pointerType,i.forEachTool),o=s==null?void 0:s.manipulator;if(o==null||!o.interactive)break;const l=e.native.shiftKey;o.events.emit(e.type,{screenPoint:n,button:e.button,pointerType:e.pointerType,shiftKey:l}),r();break}case"double-click":{const n=sf(e),s=this._intersect(n,e.pointerType,i.forEachTool),o=s!=null?s.manipulator:null;if(o==null||!o.interactive)break;const l=e.native.shiftKey;o.events.emit("double-click",{screenPoint:n,button:e.button,pointerType:e.pointerType,shiftKey:l,stopPropagation:r}),rq(o,r);break}case"immediate-double-click":{const n=sf(e),s=this._intersect(n,e.pointerType,i.forEachTool),o=s!=null?s.manipulator:null;if(o==null||!o.interactive)break;const l=e.native.shiftKey;o.events.emit("immediate-double-click",{screenPoint:n,button:e.button,pointerType:e.pointerType,shiftKey:l,stopPropagation:r}),rq(o,r);break}}this._onFocusChange(i.forEachTool)}_ungrabManipulatorBeforeDragging(e,i,r){e.grabbing=!1,e.events.emit("grab-changed",{action:"end",pointerType:i.pointerType,screenPoint:sf(i)}),this._grabbedManipulators.forEach(({manipulator:n},s)=>{n===e&&this._grabbedManipulators.delete(s)}),this._afterManipulatorUngrab(r.setActiveTool)}_handlePointerEnd(e,i){var n;const r=(n=this._grabbedManipulators.get(e.pointerId))==null?void 0:n.manipulator;r!=null&&r.grabbing&&(r.grabbing=!1,r.events.emit("grab-changed",{action:"end",pointerType:e.pointerType,screenPoint:sf(e)}),this._grabbedManipulators.delete(e.pointerId),this._afterManipulatorUngrab(i.setActiveTool))}_cursorFromMap(e){let i=null;return rp(e,({manipulator:r})=>!(r==null||!r.interactive)&&(r.grabbing&&r.grabCursor?(i=r.grabCursor,!0):!!r.cursor&&(i=r.cursor,!0))),i}_onFocusChange(e){this._updateCursor(),this._updateFocusedManipulatorTools(e)}_updateCursor(){this._grabbedManipulators.size>0?this._cursor=this._cursorFromMap(this._grabbedManipulators)||"grabbing":this._hoveredManipulators.size>0?this._cursor=this._cursorFromMap(this._hoveredManipulators)||"pointer":this._cursor=null}_updateFocusedManipulatorTools(e){const i=new Set,r=new Set;this._grabbedManipulators.forEach(({tool:n})=>{i.add(n)}),this._hoveredManipulators.forEach(({tool:n})=>{r.add(n)}),e(n=>{n.hasGrabbedManipulators=i.has(n),n.hasHoveredManipulators=r.has(n);const s=this._grabbedManipulators.values(),o=bje(s,({tool:l})=>l===n);n.firstGrabbedManipulator=o!=null?o.manipulator:null})}clearPointers(e,{forEachTool:i,setActiveTool:r},n=!0,s){const o=(l,c)=>l===e&&(s==null||s===c);this._grabbedManipulators.forEach(({tool:l,manipulator:c,pointerType:f},_)=>{o(l,c)&&(this._grabbedManipulators.delete(_),c.grabbing=!1,c.events.emit("grab-changed",{action:"end",screenPoint:null,pointerType:f}))}),this._draggedManipulators.forEach(({tool:l,manipulator:c},f)=>{o(l,c)&&(this._draggedManipulators.delete(f),c.dragging=!1,c.events.emit("drag",{action:"cancel"}))}),n&&this._hoveredManipulators.forEach(({tool:l,manipulator:c},f)=>{o(l,c)&&(this._hoveredManipulators.delete(f),c.hovering=!1)}),this._afterManipulatorUngrab(r),this._onFocusChange(i)}_intersect(e,i,r){let n=null;return r(s=>{if(s.manipulators==null||!Eee(s))return!1;const o=s.manipulators.intersect(e,i);return o!=null&&(n={tool:s,manipulator:o},!0)}),n}updateHoveredStateFromKnownPointers(e){this._pointerLocations.forEach((i,r)=>{this._updateHoveredStateForPointerAtScreenPosition(Ku(i.x,i.y),r,i.pointerType,e)})}handleHoverEvent(e,i){e.type!=="pointer-up"&&e.type!=="immediate-click"&&e.type!=="pointer-move"||!sme(e.pointerType)||this._updateHoveredStateForPointerAtScreenPosition(sf(e),e.pointerId,e.pointerType,i)}_updateHoveredStateForPointerAtScreenPosition(e,i,r,n){var l;let s=this._intersect(e,r,n);const o=(l=this._hoveredManipulators.get(i))==null?void 0:l.manipulator;s==null||s.manipulator.interactive||(s=null),s!=null&&o===s.manipulator||(o!=null&&(o.hovering=!1),s!=null?(s.manipulator.hovering=!0,this._hoveredManipulators.set(i,s)):this._hoveredManipulators.delete(i),this._onFocusChange(n))}_afterManipulatorUngrab(e){this._grabbedManipulators.size===0&&this._revertToNullActiveTool&&(e(null),this._revertToNullActiveTool=!1)}};function sme(t){return t==="mouse"}function ome(t){return t.pointerType!=="mouse"||t.button===0}function Smt(t){return!!t.native.shiftKey}function rq(t,e){t!=null&&t.consumesClicks&&e()}const ame="attached",nq="tools",lme=1e3;let Pg=class extends ze{constructor(e){super(e),this._updatingHandles=new Rf,this._clock=m9,this._manipulatorState=new xmt,this.tools=new it,this.cursor=null,this._interacting=!1,this._interactingTimeout=lme,this._interactingTimeoutHandle=null,this._forEachTool=i=>{for(const r of this.tools.items)if(i(r))return}}initialize(){this.addHandles([this.view.on(_Ie,e=>{this._handleInputEvent(e)},Es.TOOL),...wmt(this.tools),this.tools.on("before-add",({item:e})=>{this._updateToolEditableFlag(e)}),this.tools.on("before-remove",({item:e})=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs),this._updateCursor()}),this.tools.on("change",()=>{this._refreshToolWatchers()})])}destroy(){this.activeTool=null,this.tools.drain(e=>e.destroy()),this._clearInteractingTimeout(),this._interacting=!1,this._updatingHandles.destroy()}get _manipulatorStateEventArgs(){return{forEachTool:this._forEachTool,activeTool:this.activeTool,setActiveTool:e=>{this.activeTool=e},view:this.view}}set activeTool(e){if(e!=null&&!this.view.ready)return void Ce.getLogger(this).error("Cannot set active tool while view is not ready.");if(e===this.activeTool)return;const i=this.activeTool;this._set("activeTool",e),i!=null&&i.deactivate(),e!=null&&e.activate(),this._removeIncompleteTools(e);for(const r of this.tools){this._updateToolEditableFlag(r);const n=Eee(r);this.activeTool!=null&&n||this._manipulatorState.clearPointers(r,this._manipulatorStateEventArgs,!n)}this._updateCursor()}get updating(){return this._updatingHandles.updating||this.tools.some(e=>e.updating)}get interacting(){return this._interacting}_clearInteractingTimeout(){this._interactingTimeoutHandle=en(this._interactingTimeoutHandle)}_startInteractingTimeout(){this._clearInteractingTimeout(),this._interactingTimeoutHandle=this._clock.setTimeout(()=>this._interacting=!1,this._interactingTimeout)}attach(){var e;this.view.type==="3d"?this.addHandles([_e(()=>{const{state:i}=this.view;return"camera"in i&&i.camera},()=>this._forEachManipulator(i=>i.onViewChange())),(e=this.view.elevationProvider)==null?void 0:e.on("elevation-change",i=>this._forEachManipulator(r=>r.onElevationChange(i)))],ame):this.addHandles(_e(()=>this.view.extent,()=>this._forEachManipulator(i=>i.onViewChange())))}detach(){this.activeTool=null,this.tools.removeAll(),this.removeHandles(ame),this._clearInteractingTimeout(),this._interacting=!1}_forEachManipulator(e){this._forEachTool(i=>{i.manipulators&&i.manipulators.forEach(({manipulator:r})=>e(r,i))})}_handleInputEvent(e){let i=!1;const r={...e,stopPropagation:()=>{i=!0,e.stopPropagation()}};this.activeTool!=null?this.activeTool.handleInputEvent&&this.activeTool.handleInputEvent(r):this._forEachTool(n=>{!i&&n.visible&&n.handleInputEvent(r)}),!i&&e.type==="key-down"&&e.key==="Escape"&&this.activeTool&&(e.stopPropagation(),this.activeTool=null),this._manipulatorState.handleInputEvent(r,this._manipulatorStateEventArgs),i||this.activeTool==null||this.activeTool.handleInputEventAfter(r),this._manipulatorState.handleHoverEvent(r,this._forEachTool),this._updateCursor(),e.type==="pointer-move"&&(this._manipulatorState.hasFocusedManipulators()||this.activeTool)&&(this._interacting=!0,this._startInteractingTimeout())}_refreshToolWatchers(){this.removeHandles(nq),this._forEachTool(e=>{if(e instanceof ze){const i=_e(()=>[e.cursor,e.visible,e.editable],()=>{Eee(e)||this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs),this._updateCursor()});this.addHandles(i,nq)}e.manipulators&&this.addHandles([e.manipulators.on("after-remove",i=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs,!0,i.item.manipulator)}),e.manipulators.on("change",()=>{this._manipulatorState.updateHoveredStateFromKnownPointers(this._forEachTool),this._updateCursor()})],nq)}),this._manipulatorState.updateHoveredStateFromKnownPointers(this._forEachTool),this._updateCursor()}_updateToolEditableFlag(e){var i;(i=e.setEditableFlag)==null||i.call(e,CL.MANAGER,this.activeTool==null||e===this.activeTool)}_updateCursor(){let e=this._manipulatorState.cursor;e==null&&this._forEachTool(i=>!(i.cursor==null||!i.visible)&&(e=i.cursor,!0)),this._get("cursor")!==e&&this._set("cursor",e)}_removeIncompleteTools(e){this.tools.filter(i=>(e==null||i!==e)&&!i.created&&i.removeIncompleteOnCancel).forEach(i=>{this.tools.remove(i)})}get test(){const e=this;return{setClock:i=>this._clock=i,set interactingTimeoutEnabled(i){e._interactingTimeout=i?lme:0},get interactingTimeoutEnabled(){return e._interactingTimeout!==0}}}};y([w({constructOnly:!0,nonNullable:!0})],Pg.prototype,"view",void 0),y([w({value:null})],Pg.prototype,"activeTool",null),y([w({readOnly:!0,type:it})],Pg.prototype,"tools",void 0),y([w({readOnly:!0})],Pg.prototype,"cursor",void 0),y([w({readOnly:!0})],Pg.prototype,"updating",null),y([w()],Pg.prototype,"_interacting",void 0),y([w({readOnly:!0})],Pg.prototype,"interacting",null),Pg=y([Z("esri.views.ToolViewManager")],Pg);let NA=class extends ze{constructor(e){super(),this.nativeIndex=null,this._detectedDeviceType="unknown",e.mapping==="standard"?this._detectedDeviceType="standard":Tmt.test(e.id)?this._detectedDeviceType="spacemouse":this._detectedDeviceType="unknown",this.nativeIndex=e.index}get native(){const e=navigator.getGamepads?navigator.getGamepads():[];return this.nativeIndex!=null&&this.nativeIndexPromise.resolve().then(()=>n4t),void 0).then(e=>Cee=e)),await sq,St(t)}async function EIe(t,e,i,r){if(!t)return null;const n=t.spatialReference;return ox()||th(n,e)?rl(t,e):Cee?Cee.projectGeometry(t,e,i,r):(await Promise.race([Mmt(r),g_(r)]),EIe(t,e,i,r))}let us=class extends ze{constructor(e){super(e),this.required={tileInfo:!1,heightModelInfo:!1,extent:!1},this.defaultSpatialReference=null,this.userSpatialReference=null,this.sourcePreloadCount=10,this.priorityCollection=null,this.requiresExtentInSpatialReference=!0,this.suspended=!1,this._projectExtentTask={task:null,input:null,output:null,spatialReference:null}}destroy(){this._projectExtentTask.task&&(this._projectExtentTask.task=gn(this._projectExtentTask.task)),this._set("map",null)}get ready(){return!this._spatialReferenceTask.updating&&!this._tileInfoTask.updating&&!this._extentTask.updating}get heightModelInfoReady(){return!this._heightModelInfoTask.updating}get spatialReference(){return this.userSpatialReference!=null?this.userSpatialReference:this._spatialReferenceTask.spatialReference}get extent(){return this._extentTask.extent}get heightModelInfo(){return this._heightModelInfoTask.heightModelInfo}get vcsWkid(){return this._heightModelInfoTask.vcsWkid}get latestVcsWkid(){return this._heightModelInfoTask.latestVcsWkid}get viewingMode(){return this.userSpatialReference==null||this.userSpatialReference.equals(this._spatialReferenceTask.spatialReference)?this._spatialReferenceTask.viewingMode:null}get tileInfo(){return this._tileInfoTask.tileInfo}get mapCollections(){var r,n,s,o;const e=(r=this.map)==null?void 0:r.call(this),i=[];return this.priorityCollection!=null&&i.push(this.priorityCollection),i.push({parent:e==null?void 0:e.basemap,layers:(n=e==null?void 0:e.basemap)==null?void 0:n.baseLayers},{layers:e==null?void 0:e.layers},{parent:e==null?void 0:e.ground,layers:(s=e==null?void 0:e.ground)==null?void 0:s.layers},{parent:e==null?void 0:e.basemap,layers:(o=e==null?void 0:e.basemap)==null?void 0:o.referenceLayers}),i}get _allLayers(){return this._collectLayers(this.mapCollections)}get _spatialReferenceTask(){if(this.suspended)return this._get("_spatialReferenceTask")??{updating:!1};const{layers:e,updating:i}=this._allLayers;let r=null;for(const s of e){const o=this._getSupportedSpatialReferences(s);if(o.length>0){const l=this._narrowDownSpatialReferenceCandidates(r,o);l!=null&&(r=l)}if(r!=null&&r.length===1)break}if(i&&(r==null||r.length!==1))return{updating:!0};const n=this._pickSpatialReferenceCandidate(r);return{spatialReference:n!=null?n.spatialReference:null,viewingMode:n!=null?n.viewingMode:null,updating:!1}}get _tileInfoTask(){var r,n,s,o,l,c,f;if(!this.required.tileInfo)return this._get("_tileInfoTask")??{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{layers:e,updating:i}=this._collectLayers([{parent:(n=(r=this.map)==null?void 0:r.call(this))==null?void 0:n.basemap,layers:(l=(o=(s=this.map)==null?void 0:s.call(this))==null?void 0:o.basemap)==null?void 0:l.baseLayers},{layers:(f=(c=this.map)==null?void 0:c.call(this))==null?void 0:f.layers}]);if(e&&e.length>0&&"tileInfo"in e[0]){const _=e[0].tileInfo;return{tileInfo:_&&_.spatialReference.equals(this.spatialReference)?_:null,updating:!1}}return{updating:i}}get _heightModelInfoTask(){var r,n,s;if(!this.required.heightModelInfo||this.suspended&&((r=this._get("_heightModelInfoTask"))!=null&&r.heightModelInfo))return this._get("_heightModelInfoTask")??{updating:!1};const{layers:e,updating:i}=this._allLayers;for(const o of e)if(Kdt(o)){const l=qRe(o);if(l)return{heightModelInfo:l,vcsWkid:(n=o.spatialReference)==null?void 0:n.vcsWkid,latestVcsWkid:(s=o.spatialReference)==null?void 0:s.latestVcsWkid,updating:!1}}return{updating:i}}get _extentCandidatesTask(){if(this.suspended||!this.required.extent)return this._get("_extentCandidatesTask")??{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const e=this._allLayers,i=e.updating,r=[];for(const n of e.layers){const s="fullExtents"in n&&n.fullExtents||(n.fullExtent!=null?[n.fullExtent]:[]),o=this.requiresExtentInSpatialReference?null:s[0],l=s.find(c=>c.spatialReference.equals(this.spatialReference))??o;if(l)return{candidates:[{extent:l,layer:n}],updating:!1};if(this._getSupportedSpatialReferences(n).length>0)for(const c of s)r.push({extent:c,layer:n})}return{candidates:r,updating:i}}get _extentTask(){const{candidates:e,updating:i}=this._extentCandidatesTask;if(i)return{updating:i};if(e==null||e.length===0)return{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const r=this._pickExtentCandidate(e),n=this.spatialReference;return r.extent.equals(this._projectExtentTask.input)&&n.equals(this._projectExtentTask.spatialReference)?{extent:this._projectExtentTask.output,updating:this._projectExtentTask.task!=null&&!this._projectExtentTask.task.finished}:(this._projectExtentTask.task!=null&&(this._projectExtentTask.task=gn(this._projectExtentTask.task)),this._projectExtentTask={input:r.extent.clone(),output:null,spatialReference:n.clone(),task:Cc(async s=>{try{const o=await EIe(r.extent,n,"portalItem"in r.layer?r.layer.portalItem:void 0,s);this._projectExtentTask={...this._projectExtentTask,task:null,output:o}}catch{if(xo(s))return;this._projectExtentTask={...this._projectExtentTask,task:null}}})},{updating:!0})}_narrowDownSpatialReferenceCandidates(e,i){if(e==null)return i;const r=[],n=(s,o)=>s!=null?o!=null?s===o&&s:s:o;for(const s of e)for(const o of i){if(!s.spatialReference.equals(o.spatialReference))continue;const l=n(s.viewingMode,o.viewingMode);if(l!==!1){r.push({spatialReference:s.spatialReference,viewingMode:l});break}}return r.length>0?r:null}_pickSpatialReferenceCandidate(e){const i=this.defaultSpatialReference;return e==null||e.length<1?i!=null?{spatialReference:i,viewingMode:null}:null:(i!=null&&e.length>1&&e.some(({spatialReference:r})=>r.equals(i))&&(e=e.filter(({spatialReference:r})=>r.equals(i))),e.length>1&&e.some(({viewingMode:r})=>r!==_t.Local)&&(e=e.filter(({viewingMode:r})=>r!==_t.Local)),e[0])}_getSupportedSpatialReferences(e){const i="supportedSpatialReferences"in e&&e.supportedSpatialReferences||(e.spatialReference?[e.spatialReference]:[]);if(i.length===0)return[];const r=[];for(const n of i){const s=this.getSpatialReferenceSupport({spatialReference:n,layer:e});if(s!=null){const o=s.constraints!=null?s.constraints:[{spatialReference:n,viewingMode:null}];for(const{spatialReference:l,viewingMode:c}of o)this.requiresExtentInSpatialReference&&this.userSpatialReference!=null&&!l.equals(this.userSpatialReference)||r.push({spatialReference:l,viewingMode:c})}}return r}_pickExtentCandidate(e){const i=this.spatialReference;return e.find(({extent:r})=>i.equals(r.spatialReference))||e[0]}_collectLayers(e){var r;if(this._loadMaybe((r=this.map)==null?void 0:r.call(this))!=="loaded")return{layers:[],updating:!0};const i=new Omt;for(const n of e)if(this._collectCollection(n,i),i.preloading===this.sourcePreloadCount)break;return{layers:i.layers,updating:i.updating}}_collectCollection(e,i){if(e.layers){switch(this._loadMaybe(e.parent)){case"loading":return i.updating=!0,void++i.preloading;case"failed":return}for(const r of e.layers){switch(this._loadMaybe(r)){case"failed":continue;case"loading":i.updating=!0,++i.preloading;break;case"loaded":i.updating||i.layers.push(r),"layers"in r&&this._collectCollection({layers:r.layers},i)}if(i.preloading===this.sourcePreloadCount)break}}}_loadMaybe(e){return e&&"loadStatus"in e&&e.loadStatus!=null?e.loadStatus==="not-loaded"?(e.load().catch(i=>{sn(i)||console.log(i)}),"loading"):e.loadStatus:"loaded"}};y([w()],us.prototype,"required",void 0),y([w({constructOnly:!0})],us.prototype,"map",void 0),y([w({constructOnly:!0})],us.prototype,"getSpatialReferenceSupport",void 0),y([w()],us.prototype,"defaultSpatialReference",void 0),y([w()],us.prototype,"userSpatialReference",void 0),y([w()],us.prototype,"sourcePreloadCount",void 0),y([w()],us.prototype,"priorityCollection",void 0),y([w()],us.prototype,"requiresExtentInSpatialReference",void 0),y([w()],us.prototype,"suspended",void 0),y([w({readOnly:!0})],us.prototype,"ready",null),y([w({readOnly:!0})],us.prototype,"heightModelInfoReady",null),y([w({readOnly:!0})],us.prototype,"spatialReference",null),y([w({readOnly:!0})],us.prototype,"extent",null),y([w({readOnly:!0})],us.prototype,"heightModelInfo",null),y([w({readOnly:!0})],us.prototype,"vcsWkid",null),y([w({readOnly:!0})],us.prototype,"latestVcsWkid",null),y([w({readOnly:!0})],us.prototype,"viewingMode",null),y([w({readOnly:!0})],us.prototype,"tileInfo",null),y([w({readOnly:!0})],us.prototype,"mapCollections",null),y([w({readOnly:!0})],us.prototype,"_allLayers",null),y([w({readOnly:!0})],us.prototype,"_spatialReferenceTask",null),y([w({readOnly:!0})],us.prototype,"_tileInfoTask",null),y([w({readOnly:!0})],us.prototype,"_heightModelInfoTask",null),y([w({readOnly:!0})],us.prototype,"_extentCandidatesTask",null),y([w()],us.prototype,"_extentTask",null),y([w()],us.prototype,"_projectExtentTask",void 0),us=y([Z("esri.views.support.DefaultsFromMap")],us);let Omt=class{constructor(){this.layers=new Array,this.preloading=-1,this.updating=!1}};var K4;let gi=K4=class extends Dn.EventedMixin(S9(ze)){constructor(t){super(t),this._userSpatialReference=null,this._cursor=null,this.handles=new O_,this.updatingHandles=new Rf,this.allLayerViews=new GT({getCollections:()=>{var e,i,r;return[(e=this.basemapView)==null?void 0:e.baseLayerViews,(i=this.groundView)==null?void 0:i.layerViews,this.layerViews,(r=this.basemapView)==null?void 0:r.referenceLayerViews]},getChildrenFunction:Rmt}),this.groundView=null,this.basemapView=null,this.fatalError=null,this.graphics=new dT,this.analyses=new y5,this.typeSpecificPreconditionsReady=!0,this.layerViews=new it,this.magnifier=new vIe,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this.spatialReferenceWarningDelay=1e3,this.supportsGround=!0,this.timeExtent=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new Amt,this.navigation=new TIe,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new _mt(this),this.persistableViewModels=new it,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this.theme=null,this.handles.add(_e(()=>this.preconditionsReady,e=>{var i,r;e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,K4.views.add(this)):(this._lockedSpatialReference=null,K4.views.remove(this)),this.notifyChange("spatialReference"),!e&&this.ready?((i=this.toolViewManager)==null||i.detach(),this.analysisViewManager!=null&&this.analysisViewManager.detach(),(r=this.layerViewManager)==null||r.clear(),this._teardown()):e&&!this.ready&&(this._startup(),this.analysisViewManager!=null&&this.analysisViewManager.attach(),this.toolViewManager.attach())},Li))}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,rd(()=>this.ready)))),this.basemapView=new aw({view:this}),this.layerViewManager=new gmt({view:this,layerViewImporter:{importLayerView:t=>this.importLayerView(t),hasLayerViewModule:t=>this.hasLayerViewModule(t)},supportsGround:this.supportsGround}),this.toolViewManager=new Pg({view:this}),this._setupSpatialReferenceLogger(),this.addHandles([_e(()=>this.initialExtentRequired,t=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:t},{sync:!0,initial:!0}),_e(()=>this.ready,t=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=t,this.defaultsFromMap.userSpatialReference=t?this.spatialReference:this._userSpatialReference)},{sync:!0}),_e(()=>this._userSpatialReference,t=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=t)},{sync:!0,initial:!0})])}_setupSpatialReferenceLogger(){let t=null;this.addHandles([_e(()=>{var e;return(e=this.defaultsFromMap)==null?void 0:e.ready},e=>{var r;const i=((r=this.map)==null?void 0:r.allLayers.length)>0;if(e&&!this.spatialReference&&i){if(t!=null)return;const n=rr(()=>t=gn(t));t=Cc(async s=>{try{await T2(this.spatialReferenceWarningDelay,null,s)}catch{return}finally{t=null}Ce.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")}),this.addHandles(n,"spatial-reference-logger-task")}else this.removeHandles("spatial-reference-logger-task")},{sync:!0})])}destroy(){var t,e;this.destroyed||(K4.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=et(this.graphics),this.analyses=et(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),et(this.analysisViewManager),this.toolViewManager=et(this.toolViewManager),this.layerViewManager=et(this.layerViewManager),this.basemapView=et(this.basemapView),(t=this.groundView)==null||t.destroy(),(e=this.layerViews)==null||e.forEach(i=>i.destroy()),this.layerViews.length=0,this.invalidate(),this._emitter.clear(),this.handles.destroy(),this.map=et(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return Ce.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){var t;return(t=this.toolViewManager)==null?void 0:t.activeTool}set activeTool(t){this.toolViewManager&&(this.toolViewManager.activeTool=t)}get animation(){return this._get("animation")}set animation(t){this._set("animation",t)}get center(){return null}get _defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new us({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:t=>this.getSpatialReferenceSupport(t),...this._defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(t){this._set("extent",t)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){var t;return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||jf.isLoadable(this.map)&&!this.map.loaded||this.width===0||this.height===0||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._lockedSpatialReference&&!((t=this.defaultsFromMap)!=null&&t.ready)||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(t){t!==this._get("map")&&(t!=null&&t.destroyed&&(Ce.getLogger(this).warn("#map","The provided map is already destroyed",{map:t}),t=null),jf.isLoadable(t)&&t.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",t))}get spatialReference(){var e,i;let t=this._userSpatialReference||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;return t&&((i=(e=this.defaultsFromMap)==null?void 0:e.required)!=null&&i.heightModelInfo)&&(t=t.clone(),t.vcsWkid=this.defaultsFromMap.vcsWkid,t.latestVcsWkid=this.defaultsFromMap.latestVcsWkid),t}set spatialReference(t){const e=!Zn(t,this._get("spatialReference"));this._set("_userSpatialReference",t),e&&(this._set("spatialReference",t),this._spatialReferenceChanged(t))}_spatialReferenceChanged(t){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??Uy}set timeZone(t){const e=new Set(["etc/utc","etc/gmt","gmt"]),i=new Set(Intl.supportedValuesOf("timeZone").map(r=>r.toLowerCase()));this._userTimeZone=t,t===Uy||t===OT||e.has(t.toLowerCase())||i.has(t.toLowerCase())||Ce.getLogger(this).warn("#timeZone",`the parsed value '${t}' may not be a valid IANA time zone`)}get tools(){var t;return(t=this.toolViewManager)==null?void 0:t.tools}get initialExtent(){var t;return(t=this.defaultsFromMap)==null?void 0:t.extent}get cursor(){var t;return((t=this.toolViewManager)==null?void 0:t.cursor)??this._cursor??"default"}set cursor(t){this._cursor=t,this.notifyChange("cursor")}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new Tee}whenLayerView(t){var e;return((e=this.layerViewManager)==null?void 0:e.whenLayerView(t))??Promise.reject()}getDefaultSpatialReference(){var t;return(t=this.defaultsFromMap)==null?void 0:t.spatialReference}getDefaultHeightModelInfo(){var t;return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??((t=this.defaultsFromMap)==null?void 0:t.heightModelInfo)??null}getDefaultTimeZone(){return null}importLayerView(t){throw new se("importLayerView() not implemented")}hasLayerViewModule(t){return!1}async validate(){}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(t){return this.getSpatialReferenceSupport({spatialReference:t})!=null}when(t,e){return this.isResolved()&&!this.ready&&Ce.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(t,e)}forceReadyCycle(){this.ready&&(Mo(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}addAndActivateTool(t){this.toolViewManager.tools.add(t),this.activeTool=t}tryFatalErrorRecovery(){this.fatalError=null}};gi.views=new it,y([w()],gi.prototype,"_userSpatialReference",void 0),y([w()],gi.prototype,"activeTool",null),y([w({readOnly:!0})],gi.prototype,"allLayerViews",void 0),y([w()],gi.prototype,"groundView",void 0),y([w()],gi.prototype,"animation",null),y([w()],gi.prototype,"basemapView",void 0),y([w()],gi.prototype,"center",null),y([w({readOnly:!0})],gi.prototype,"_defaultsFromMapSettings",null),y([w()],gi.prototype,"defaultsFromMap",null),y([w()],gi.prototype,"fatalError",void 0),y([w({type:Vi})],gi.prototype,"extent",null),y([w(Pz(dT,"graphics"))],gi.prototype,"graphics",void 0),y([w(Pz(y5,"analyses"))],gi.prototype,"analyses",void 0),y([w({readOnly:!0,type:N_})],gi.prototype,"heightModelInfo",null),y([w({readOnly:!0})],gi.prototype,"interacting",null),y([w({readOnly:!0})],gi.prototype,"navigating",null),y([w({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_lockedSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],gi.prototype,"preconditionsReady",null),y([w({readOnly:!0})],gi.prototype,"typeSpecificPreconditionsReady",void 0),y([w({type:it,readOnly:!0})],gi.prototype,"layerViews",void 0),y([w()],gi.prototype,"resolution",null),y([w({type:vIe})],gi.prototype,"magnifier",void 0),y([w({value:null,type:HRe})],gi.prototype,"map",null),y([w()],gi.prototype,"padding",void 0),y([w({readOnly:!0})],gi.prototype,"ready",void 0),y([w({type:at})],gi.prototype,"spatialReference",null),y([w()],gi.prototype,"spatialReferenceWarningDelay",void 0),y([w()],gi.prototype,"stationary",null),y([w({readOnly:!0})],gi.prototype,"supportsGround",void 0),y([w({type:D_})],gi.prototype,"timeExtent",void 0),y([w({type:String,nonNullable:!0})],gi.prototype,"timeZone",null),y([w()],gi.prototype,"tools",null),y([w()],gi.prototype,"toolViewManager",void 0),y([w({readOnly:!0})],gi.prototype,"type",void 0),y([w({type:Number})],gi.prototype,"scale",void 0),y([w({readOnly:!0})],gi.prototype,"updating",void 0),y([w({readOnly:!0})],gi.prototype,"initialExtentRequired",void 0),y([w({readOnly:!0})],gi.prototype,"initialExtent",null),y([w()],gi.prototype,"cursor",null),y([w({readOnly:!0})],gi.prototype,"input",void 0),y([w({type:TIe,nonNullable:!0})],gi.prototype,"navigation",void 0),y([w()],gi.prototype,"layerViewManager",void 0),y([w()],gi.prototype,"analysisViewManager",void 0),y([w()],gi.prototype,"width",void 0),y([w()],gi.prototype,"height",void 0),y([w({readOnly:!0})],gi.prototype,"resizing",void 0),y([w({value:null,readOnly:!0})],gi.prototype,"size",null),y([w({readOnly:!0})],gi.prototype,"suspended",void 0),y([w({readOnly:!0})],gi.prototype,"viewEvents",void 0),y([w({readOnly:!0})],gi.prototype,"persistableViewModels",void 0),y([w()],gi.prototype,"_isValid",void 0),y([w()],gi.prototype,"_readyCycleForced",void 0),y([w()],gi.prototype,"_lockedSpatialReference",void 0),y([w()],gi.prototype,"_userTimeZone",void 0),y([w()],gi.prototype,"_lockedTimeZone",void 0),y([w({type:Tee})],gi.prototype,"theme",void 0),y([w({readOnly:!0,type:Tee})],gi.prototype,"effectiveTheme",null),gi=K4=y([Z("esri.views.View")],gi);const Pmt=gi;function Rmt(t){return t.layerViews}let cw=class extends uz{constructor(e){super(e),this.state="running",this.target=null,this._resolver=null}initialize(){this._resolver=Jl(),this.addResolvingPromise(this._resolver.promise)}get done(){return this.state==="finished"||this.state==="stopped"}stop(){var e;this.state!=="stopped"&&this.state!=="finished"&&(this._set("state","stopped"),(e=this._resolver)==null||e.reject(new se("ViewAnimation stopped")))}finish(){var e;this.state!=="stopped"&&this.state!=="finished"&&(this._set("state","finished"),(e=this._resolver)==null||e.resolve())}update(e,i){i||(i=pd(e)?"waiting-for-target":"running"),this._set("target",e),this._set("state",i)}};y([w({readOnly:!0})],cw.prototype,"done",null),y([w({readOnly:!0,type:String})],cw.prototype,"state",void 0),y([w()],cw.prototype,"target",void 0),cw=y([Z("esri.views.ViewAnimation")],cw),function(t){t.State={RUNNING:"running",STOPPED:"stopped",FINISHED:"finished",WAITING_FOR_TARGET:"waiting-for-target"}}(cw||(cw={}));const b5=cw,sR=()=>we(()=>import("./TileLayerView3D-5Hf3FIEh.js"),__vite__mapDeps([160,161,162,163,164,165,13])),cme=()=>we(()=>import("./ElevationLayerView3D-aDJhr4Zv.js"),__vite__mapDeps([166,161,162,163])),ume={"base-dynamic":()=>we(()=>import("./BaseDynamicLayerView3D-aiAW9HKo.js"),__vite__mapDeps([167,168,161,169,170,163,164])),"base-elevation":cme,"base-tile":sR,"bing-maps":sR,"building-scene":()=>we(()=>import("./BuildingSceneLayerView3D-jychJ4lg.js"),__vite__mapDeps([171,63,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,39,40,172,173,150,159,174,175,176,177,178,8,179,42,180,95,90,91,92,93,66,94,73,88,89,169,161,75,76,77,181,163,164,84,149,182,183])),csv:()=>we(()=>import("./CSVLayerView3D-t0wtEtZq.js"),__vite__mapDeps([184,177,178,8,179,42,180,95,90,91,92,39,40,93,66,94,73,53,88,89,169,161,75,76,77,52,181,56,163,164])),dimension:()=>we(()=>import("./DimensionLayerView3D-sKnmIRMF.js"),__vite__mapDeps([185,161,163])),elevation:cme,feature:()=>we(()=>import("./FeatureLayerView3D-t6NDkLO0.js"),__vite__mapDeps([176,177,178,8,179,42,180,95,90,91,92,39,40,93,66,94,73,53,88,89,169,161,75,76,77,52,181,56,163,164])),geojson:()=>we(()=>import("./GeoJSONLayerView3D-4MSCbPJp.js"),__vite__mapDeps([186,177,178,8,179,42,180,95,90,91,92,39,40,93,66,94,73,53,88,89,169,161,75,76,77,52,181,56,163,164])),graphics:()=>we(()=>import("./GraphicsLayerView3D-TqJxY2EU.js"),__vite__mapDeps([187,161,179,188,180,95,90,91,169,163])),group:()=>we(()=>import("./GroupLayerView-do80uFuS.js"),__vite__mapDeps([189,163])),imagery:()=>we(()=>import("./ImageryLayerView3D-Ajt9-b41.js"),__vite__mapDeps([190,168,161,169,170,163,164])),"integrated-mesh":()=>we(()=>import("./IntegratedMeshLayerView3D-EW3nzBgf.js"),__vite__mapDeps([191,172,173,150,159,174,175,53,176,177,178,8,179,42,180,95,90,91,92,39,40,93,66,94,73,88,89,169,161,75,76,77,52,181,56,163,164,84,149])),"line-of-sight":()=>we(()=>import("./LineOfSightLayerView3D-rUjgrEFl.js"),__vite__mapDeps([192,161,163])),"map-image":()=>we(()=>import("./MapImageLayerView3D-GIO-oWiM.js"),__vite__mapDeps([193,168,161,169,170,163,164,165,13])),media:()=>we(()=>import("./MediaLayerView3D-CIdxGOiQ.js"),__vite__mapDeps([194,103,104,161,170,163])),"ogc-feature":()=>we(()=>import("./OGCFeatureLayerView3D-FLI41Ca4.js"),__vite__mapDeps([195,177,178,8,179,42,180,95,90,91,92,39,40,93,66,94,73,53,88,89,169,161,75,76,77,52,181,56,163,164])),"open-street-map":sR,"oriented-imagery":()=>we(()=>import("./FeatureLayerView3D-t6NDkLO0.js"),__vite__mapDeps([176,177,178,8,179,42,180,95,90,91,92,39,40,93,66,94,73,53,88,89,169,161,75,76,77,52,181,56,163,164])),"point-cloud":()=>we(()=>import("./PointCloudLayerView3D-KHREaqUZ.js"),__vite__mapDeps([196,161,147,113,197,163])),voxel:()=>we(()=>import("./VoxelLayerView3D-FruX8zyo.js"),__vite__mapDeps([198,161,197,163])),route:()=>we(()=>import("./RouteLayerView3D-tOy-WtTD.js"),__vite__mapDeps([199,115,161,188,180,95,90,91,169,181,163])),scene:t=>t.profile==null||t.profile==="mesh-pyramids"?we(()=>import("./SceneLayerView3D-7NpyxR5M.js"),__vite__mapDeps([200,159,39,40,172,173,150,174,175,53,176,177,178,8,179,42,180,95,90,91,92,93,66,94,73,88,89,169,161,75,76,77,52,181,56,163,164,84,149,201,183,182,197])):we(()=>import("./SceneLayerGraphicsView3D-Abn6jwJk.js"),__vite__mapDeps([202,173,150,159,174,175,53,176,177,178,8,179,42,180,95,90,91,92,39,40,93,66,94,73,88,89,169,161,75,76,77,52,181,56,163,164,201,183,197])),stream:()=>we(()=>import("./StreamLayerView3D-nu_wqFzJ.js"),__vite__mapDeps([203,141,143,75,76,77,52,181,178,8,179,42,180,95,90,91,92,39,40,93,66,94,73,53,88,89,169,161,163])),tile:sR,"imagery-tile":()=>we(()=>import("./ImageryTileLayerView3D-kyd0hRhY.js"),__vite__mapDeps([204,81,161,162,163,164,13])),"vector-tile":()=>we(()=>import("./VectorTileLayerView3D-eexSRj3E.js"),__vite__mapDeps([205,153,77,206,19,122,144,145,207,120,121,161,162,163])),wcs:()=>we(()=>import("./ImageryTileLayerView3D-kyd0hRhY.js"),__vite__mapDeps([204,81,161,162,163,164,13])),"web-tile":sR,wfs:()=>we(()=>import("./WFSLayerView3D-OjHmKjv_.js"),__vite__mapDeps([208,177,178,8,179,42,180,95,90,91,92,39,40,93,66,94,73,53,88,89,169,161,75,76,77,52,181,56,163,164])),wms:()=>we(()=>import("./WMSLayerView3D-HO_hwLwX.js"),__vite__mapDeps([209,168,161,169,170,163,164])),wmts:()=>we(()=>import("./WMTSLayerView3D-oO1etwl-.js"),__vite__mapDeps([210,161,162,163,164])),"geo-rss":null,kml:null,"knowledge-graph":null,"link-chart":null,"knowledge-graph-sublayer":null,"map-notes":null,"subtype-group":null,unknown:null,unsupported:null,video:null};function Imt(t){const e=t.declaredClass?t.declaredClass.slice(t.declaredClass.lastIndexOf(".")+1):"Unknown",i=e.replaceAll(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return new se(`${i}:view-not-supported`,`${e} is not supported in 3D`)}const hme={hasLayerViewModule:t=>ume[t.type]!=null,importLayerView:t=>{const e=ume[t.type];if(e==null)throw Imt(t);return e(t)}},dme="analyses-owner-handles";var RM,PS;(function(t){t[t.PENDING=0]="PENDING",t[t.CREATED=1]="CREATED"})(RM||(RM={})),function(t){t[t.ADDED=0]="ADDED",t[t.REMOVED=1]="REMOVED"}(PS||(PS={}));let H3=class extends ze{constructor(e){super(e),this._allAnalysisViews=new it,this._creatingViewCount=0,this._items=new Map,this._scheduledUpdateHandle=null,this._attachedToViewResolver=pme(),this._analysisModules={"area-measurement":{module:null},dimension:{module:null},"direct-line-measurement":{module:null},"line-of-sight":{module:null},slice:{module:null}}}destroy(){this._disconnectOwners(),this._attachedToViewResolver.reject(ur("AnalysisViewManager was destroyed"))}attach(){this._connectOwners(),this._attachedToViewResolver.resolve()}detach(){this._disconnectOwners(),this._attachedToViewResolver.reject(ur()),this._attachedToViewResolver=pme()}get updating(){return!this.view.ready||this._creatingViewCount!==0||this._allAnalysisViews.some(e=>e.updating)}get testInfo(){return{allAnalysisViews:this._allAnalysisViews}}async whenAnalysisView(e){await this._attachedToViewResolver.promise;const i=this._items.get(e);if(i==null||i.state.list===PS.REMOVED)throw new se("AnalysisViewManager:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});return i.createAnalysisViewTask.promise}_connectOwners(){this.addHandles(this._connectAnalysesCollection(this.view.analyses),dme)}_disconnectOwners(){this.removeHandles(dme),this._update(),this._creatingViewCount=0}_connectAnalysesCollection(e){for(const n of e)this._addAnalysis(n);const i=e.on("after-add",n=>this._addAnalysis(n.item)),r=e.on("after-remove",n=>this._removeAnalysis(n.item));return rr(()=>{i.remove(),r.remove();for(const n of e)this._removeAnalysis(n)})}_addAnalysis(e){const i=this._items.get(e);if(i==null){const r={state:{view:RM.PENDING,list:PS.ADDED},analysis:e,view:null,createAnalysisViewTask:null};this._items.set(e,r),r.createAnalysisViewTask=Cc(n=>this._createAnalysisViewPromise(r,n))}else i.state.list=PS.ADDED}_removeAnalysis(e){const i=this._items.get(e);i!=null?(i.state.list=PS.REMOVED,this._scheduleUpdate()):Ce.getLogger(this).error("Trying to remove analysis which was not added")}_scheduleUpdate(){this._scheduledUpdateHandle==null&&(this._scheduledUpdateHandle=tx(()=>this._update()))}_update(){this._scheduledUpdateHandle=en(this._scheduledUpdateHandle),this._items.forEach(e=>{if(e.state.list===PS.REMOVED)switch(this._items.delete(e.analysis),e.state.view){case RM.PENDING:e.createAnalysisViewTask=gn(e.createAnalysisViewTask);break;case RM.CREATED:e.view!=null&&(this._allAnalysisViews.remove(e.view),e.view=et(e.view),e.createAnalysisViewTask=null)}})}async _createAnalysisViewPromise(e,i){const r=e.analysis,n=r.type,s=this._analysisModules[n];if(this._creatingViewCount+=1,s.module==null)try{s.module=await this._loadAnalysisModule(n)}catch(l){throw this._creatingViewCount-=1,l}if(xo(i))throw this._creatingViewCount-=1,ur("AnalysisView creation aborted");const o=new s.module.default({analysis:r,view:this.view});try{await o.when()}catch(l){throw this._creatingViewCount-=1,l}if(xo(i))throw this._creatingViewCount-=1,o.destroy(),ur("AnalysisView creation aborted");return e.view=o,e.state.view=RM.CREATED,this._allAnalysisViews.add(o),this._creatingViewCount-=1,o}_loadAnalysisModule(e){switch(e){case"area-measurement":return we(()=>import("./AreaMeasurementAnalysisView3D-AasBQOV-.js"),__vite__mapDeps([211,212,33,16,213,214,215,216,24,21,5,217,218,219]));case"dimension":return we(()=>import("./DimensionAnalysisView3D-W2fgoQBr.js"),__vite__mapDeps([220,212,68,218,21,219,221,215,27,26,9,10,170,222,17,18,19,20,22,23,24,25,3,4,216,223,5,29,11,8,6,28,217,224]));case"direct-line-measurement":return we(()=>import("./DirectLineMeasurementAnalysisView3D-AgdgP6Nj.js"),__vite__mapDeps([225,212,33,216,24,21,213,217,34,218,219,25,20]));case"line-of-sight":return we(()=>import("./LineOfSightAnalysisView3D-lX-OBMBB.js"),__vite__mapDeps([226,212,216,24,21,27,227,22,28,9,10,23,224]));case"slice":return we(()=>import("./SliceAnalysisView3D--IcVdus9.js"),__vite__mapDeps([228,212,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,229,27,170,216,24,21,222,26,9,10,28,224]))}}};function pme(){const t=Jl();return t.promise.catch(()=>{}),t}y([w()],H3.prototype,"updating",null),y([w({constructOnly:!0})],H3.prototype,"view",void 0),y([w()],H3.prototype,"_allAnalysisViews",void 0),y([w()],H3.prototype,"_creatingViewCount",void 0),H3=y([Z("esri.views.3d.analysis.AnalysisViewManager3D")],H3);const $mt=H3;let ev=class extends ze{constructor(e){super(e),this.collision=new Q4,this.distance=1/0,this.minimumPoiDistance=4,this.tilt=null}get altitude(){return this.mode===_t.Local?null:this._get("altitude")||null}set altitude(e){this.mode!==_t.Local?this._set("altitude",e):Ce.getLogger(this).warn("Altitude constraint is ignored in local scenes")}clampAltitude(e){return this.altitude?Je(e,this.altitude.min,this.altitude.max):e}clampTilt(e,i){if(!this.tilt)return i;const r=this.tilt(e);return Je(i,r.min,r.max)}clampDistance(e){return Math.min(e,this.distance)}createDefaultTilt(){return this.mode===_t.Local?this._createDefaultTiltLocal():this._createDefaultTiltGlobal()}createConstantMaxTilt(e){return(i,r=oq)=>(r.min=Bl.min,r.max=e,r)}_createDefaultTiltLocal(){const e=this.collision.enabled?hF([[4e3,Bl.max],[1e4,Ei(88)],[6e6,Ei(88)]]):()=>Bl.max;return(i,r=oq)=>(r.min=Bl.min,r.max=e(i),r)}_createDefaultTiltGlobal(){const e=this.collision.enabled?hF([[4e3,Bl.max],[5e4,Ei(88)],[6e6,Ei(88)],[2e7,Bl.min]]):hF([[3e5,Bl.max],[3e6,Ei(88)],[6e6,Ei(88)],[2e7,Bl.min]]);return(i,r=oq)=>(r.min=Bl.min,r.max=e(i),r)}};function Lmt(t){return{min:-2e5,max:4*t.radius}}y([w()],ev.prototype,"altitude",null),y([w({readOnly:!0})],ev.prototype,"collision",void 0),y([w()],ev.prototype,"distance",void 0),y([w({readOnly:!0})],ev.prototype,"minimumPoiDistance",void 0),y([w()],ev.prototype,"tilt",void 0),y([w({constructOnly:!0})],ev.prototype,"mode",void 0),ev=y([Z("esri.views.3d.state.Constraints")],ev);const fme=Lmt(Mr),Bl={min:Ei(.5),max:Ei(179.5)},oq={min:0,max:0};let Q4=class extends ze{constructor(){super(...arguments),this.enabled=!0,this.elevationMargin=5}};y([w({type:Boolean})],Q4.prototype,"enabled",void 0),y([w({type:Number})],Q4.prototype,"elevationMargin",void 0),Q4=y([Z("esri.views.3d.state.Constraints.CollisionConstraint")],Q4);let IM=class extends ze{constructor(){super(...arguments),this.min=fme.min,this.max=fme.max}};y([w({type:Number})],IM.prototype,"min",void 0),y([w({type:Number})],IM.prototype,"max",void 0),IM=y([Z("esri.views.3d.constraints.AltitudeConstraint")],IM);let Ev=class extends ze{constructor(){super(...arguments),this.mode="auto"}get near(){return this._get("near")}set near(e){this._set("near",e),e>=this._get("far")&&(this.far=e+1e-9),this.mode="manual"}castNear(e){return Math.max(1e-8,e)}get far(){return this._get("far")}set far(e){this._set("far",e),e<=this._get("near")&&(this.near=e-1e-9),this.mode="manual"}castFar(e){return Math.max(1e-8,e)}autoUpdate(e,i){this.mode==="auto"&&(this._get("near")!==e&&this._set("near",e),this._get("far")!==i&&this._set("far",i))}};y([w({type:Number,value:1e-8})],Ev.prototype,"near",null),y([Ci("near")],Ev.prototype,"castNear",null),y([w({type:Number,value:1e-8})],Ev.prototype,"far",null),y([Ci("far")],Ev.prototype,"castFar",null),y([w({type:["auto","manual"]})],Ev.prototype,"mode",void 0),Ev=y([Z("esri.views.3d.constraints.ClipDistanceConstraint")],Ev);const Aee={min:pu(Bl.min),max:pu(Bl.max)};let RS=class extends ze{constructor(){super(...arguments),this.mode="auto"}get max(){return this._get("max")}set max(e){this._set("max",e),this.mode="manual"}castMax(e){return Je(e,Aee.min,Aee.max)}autoUpdate(e){this.mode==="auto"&&this._get("max")!==e&&this._set("max",e)}};y([w({type:["auto","manual"]})],RS.prototype,"mode",void 0),y([w({type:Number,value:Aee.max})],RS.prototype,"max",null),y([Ci("max")],RS.prototype,"castMax",null),RS=y([Z("esri.views.3d.constraints.TiltConstraint")],RS);let IS=class extends ze{constructor(){super(...arguments),this.tilt=new RS,this.altitude=new IM,this.clipDistance=new Ev}};y([w({type:RS})],IS.prototype,"tilt",void 0),y([w({type:IM})],IS.prototype,"altitude",void 0),y([w({type:Ev})],IS.prototype,"clipDistance",void 0),IS=y([Z("esri.views.3d.constraints.Constraints")],IS);var FA;const CIe="esri.views.3d.environment.SunLighting",kD=Ce.getLogger(CIe);let Rg=FA=class extends Dn.EventedMixin(HT){constructor(t){super(t),this.cameraTrackingEnabled=!0,this.positionTimezoneInfo={hours:0,minutes:0,seconds:0,autoUpdated:!0};const e=new Date().getFullYear(),i=new Date("March 15, "+e+" 12:00:00 UTC");this._set("defaultDate",i),this._set("date",i)}get ambientOcclusionEnabled(){return pm(kD,"ambientOcclusionEnabled",{replacement:"ambient occlusion is automatically shown and this property has no effect",version:"4.27"}),this._get("ambientOcclusionEnabled")??!1}set ambientOcclusionEnabled(t){pm(kD,"ambientOcclusionEnabled",{replacement:"ambient occlusion is automatically shown and this property has no effect",version:"4.27"}),this._set("ambientOcclusionEnabled",t)}get waterReflectionEnabled(){return pm(kD,"waterReflectionEnabled",{replacement:"reflections are automatically shown and this property has no effect",version:"4.27"}),this._get("waterReflectionEnabled")??!1}set waterReflectionEnabled(t){pm(kD,"waterReflectionEnabled",{replacement:"reflections are automatically shown and this property has no effect",version:"4.27"}),this._set("waterReflectionEnabled",t)}get defaultDate(){return new Date(this._get("defaultDate").getTime())}static fromWebsceneLighting(t){return new FA(t.cloneConstructProperties())}set defaultDate(t){const e=this._get("date")===this._get("defaultDate");t=new Date(t.getTime()),this._set("defaultDate",t),e&&this._set("date",t)}set date(t){t!=null&&(this.positionTimezoneInfo.autoUpdated=!1,this._set("date",new Date(t.getTime())))}autoUpdate(t,e){const i=FA.calculateTimezoneOffset(this.positionTimezoneInfo);this.positionTimezoneInfo.hours=e.hours,this.positionTimezoneInfo.minutes=e.minutes,this.positionTimezoneInfo.seconds=e.seconds;let r=null;t!=null&&(this.positionTimezoneInfo.autoUpdated=!0,isNaN(t.getTime())?(r=this.defaultDate.getTime(),this._set("date",this.defaultDate)):(r=this.date&&this.date.getTime(),this._set("date",new Date(t.getTime()))));const n=FA.calculateTimezoneOffset(this.positionTimezoneInfo);if(i!==n&&(zD.target=this,zD.timezoneOffset=n,this.emit("timezone-will-change",zD),zD.target=null),t!=null)return isNaN(t.getTime())||r!==t.getTime()}clone(){const t=this._get("date")===this._get("defaultDate"),e=new FA({...this.cloneConstructProperties(),defaultDate:this.defaultDate,cameraTrackingEnabled:this.cameraTrackingEnabled});return t&&e._set("date",e._get("defaultDate")),e.positionTimezoneInfo.autoUpdated=this.positionTimezoneInfo.autoUpdated,e.positionTimezoneInfo.hours=this.positionTimezoneInfo.hours,e.positionTimezoneInfo.minutes=this.positionTimezoneInfo.minutes,e.positionTimezoneInfo.seconds=this.positionTimezoneInfo.seconds,e}cloneWithWebsceneLighting(t){const e=this.clone();return t.date!=null&&(e.date=t.date),e.directShadowsEnabled=t.directShadowsEnabled,e.displayUTCOffset=t.displayUTCOffset,e}cloneNonPersistentConstructProperties(){return{cameraTrackingEnabled:this.cameraTrackingEnabled}}};y([w({type:Boolean})],Rg.prototype,"cameraTrackingEnabled",void 0),y([w({type:Boolean})],Rg.prototype,"ambientOcclusionEnabled",null),y([w({type:Boolean})],Rg.prototype,"waterReflectionEnabled",null),y([w({type:Date})],Rg.prototype,"defaultDate",null),y([w({type:Date})],Rg.prototype,"date",null),Rg=FA=y([Z(CIe)],Rg),function(t){function e({hours:i,minutes:r,seconds:n}){return Math.round(i+r/60+n/3600)}t.calculateTimezoneOffset=e}(Rg||(Rg={}));const zD={target:null,timezoneOffset:0},Rv=Rg;var IF;const AIe="esri.views.3d.environment.VirtualLighting",UD=Ce.getLogger(AIe);let kA=IF=class extends Dn.EventedMixin(B9){constructor(t){super(t),this.cameraTrackingEnabled=!0}get ambientOcclusionEnabled(){return pm(UD,"ambientOcclusionEnabled",{replacement:"ambient occlusion is automatically shown and this property has no effect",version:"4.27"}),this._get("ambientOcclusionEnabled")??!1}set ambientOcclusionEnabled(t){pm(UD,"ambientOcclusionEnabled",{replacement:"ambient occlusion is automatically shown and this property has no effect",version:"4.27"}),this._set("ambientOcclusionEnabled",t)}get waterReflectionEnabled(){return pm(UD,"waterReflectionEnabled",{replacement:"water reflections are automatically shown and this property has no effect",version:"4.27"}),this._get("waterReflectionEnabled")??!1}set waterReflectionEnabled(t){pm(UD,"waterReflectionEnabled",{replacement:"water reflections are automatically shown and this property has no effect",version:"4.27"}),this._set("waterReflectionEnabled",t)}clone(){return new IF({...this.cloneConstructProperties(),cameraTrackingEnabled:this.cameraTrackingEnabled})}static fromWebsceneLighting(t){return new IF(t.cloneConstructProperties())}cloneWithWebsceneLighting(t){const e=this.clone();return e.directShadowsEnabled=t.directShadowsEnabled,e}cloneNonPersistentConstructProperties(){return{cameraTrackingEnabled:this.cameraTrackingEnabled}}};y([w({type:Boolean})],kA.prototype,"ambientOcclusionEnabled",null),y([w({type:Boolean})],kA.prototype,"waterReflectionEnabled",null),y([w({type:Boolean})],kA.prototype,"cameraTrackingEnabled",void 0),kA=IF=y([Z(AIe)],kA);const $M=kA,Dmt={key:"type",defaultKeyValue:"sun",base:null,typeMap:{sun:Rv,virtual:$M}};var Mee;let f$=Mee=class extends ze{set quality(t){["low","high"].includes(t)&&this._set("quality",t)}clone(){return new Mee({quality:this.quality})}};y([w({type:["low","high"],value:"low"})],f$.prototype,"quality",null),f$=Mee=y([Z("esri.views.3d.environment.SceneViewAtmosphere")],f$);var eI;let zA=eI=class extends f5{constructor(t){super(t),this.atmosphere=new f$,this.lighting=this.castLighting(),this.cachedCameraTrackingEnabled=null}static fromWebsceneEnvironment(t){const e=t.cloneConstructProperties();return new eI({...e,lighting:e.lighting?e.lighting.type==="virtual"?$M.fromWebsceneLighting(e.lighting):Rv.fromWebsceneLighting(e.lighting):void 0})}castLighting(t){return this._convertLightingWithDestroy(t)}applyLighting(t){this.lighting=this._convertLightingWithDestroy(t)}_convertLightingWithDestroy(t){const e=this._convertLighting(t);return e!==t&&this.addHandles(Jre(e)),e}_convertLighting(t){var e,i;return t?t instanceof Rv||t instanceof $M?t:t instanceof HT?this.lighting&&this.lighting.type!=="virtual"?this.lighting.cloneWithWebsceneLighting(t):new Rv({...t.cloneConstructProperties(),...(e=this.lighting)==null?void 0:e.cloneNonPersistentConstructProperties()}):t instanceof B9?this.lighting&&this.lighting.type==="virtual"?this.lighting.cloneWithWebsceneLighting(t):new $M({...t.cloneConstructProperties(),...(i=this.lighting)==null?void 0:i.cloneNonPersistentConstructProperties()}):zy(Dmt,t):new Rv}clone(){return new eI({lighting:this.lighting.clone(),atmosphere:this.atmosphere.clone(),weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:Re(this.background)})}cloneWithWebsceneEnvironment(t){return new eI({atmosphere:this.atmosphere.clone(),weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:Re(this.background),...t.cloneConstructProperties(),lighting:this._getLighting(t)})}_getLighting(t){switch(t.lighting.type){case"sun":return this.lighting&&this.lighting.type==="sun"?this.lighting.cloneWithWebsceneLighting(t.lighting):Rv.fromWebsceneLighting(t.lighting);case"virtual":return this.lighting&&this.lighting.type==="virtual"?this.lighting.cloneWithWebsceneLighting(t.lighting):$M.fromWebsceneLighting(t.lighting);default:return t.lighting,Rv.fromWebsceneLighting(t.lighting)}}};y([w({type:f$,json:{read:!1},nonNullable:!0})],zA.prototype,"atmosphere",void 0),y([w({nonNullable:!0})],zA.prototype,"lighting",void 0),y([Ci("lighting")],zA.prototype,"castLighting",null),zA=eI=y([Z("esri.views.3d.environment.SceneViewEnvironment")],zA);const UA=zA;function Nmt(t,e,i){if(e==null)return!1;const r=S5e(e);return r!=null&&(r(t,0,oR,0),i!==oR&&(i[0]=oR[0],i[1]=oR[1],i.length>2&&(i[2]=oR[2])),!0)}const oR=W();function Fmt(t,e){VD[0]=t.x,VD[1]=t.y;const i=t.z;return VD[2]=i!==void 0?i:0,Nmt(VD,t.spatialReference,e)}const VD=W();var pc;(function(t){t[t.Realistic=0]="Realistic",t[t.Local=1]="Local",t[t.Mars=2]="Mars",t[t.None=3]="None"})(pc||(pc={}));function kmt(t){return"r"in t&&"g"in t&&"b"in t}function MIe(t){return"h"in t&&"s"in t&&"v"in t}function OIe(t){return"l"in t&&"a"in t&&"b"in t}function PIe(t){return"l"in t&&"c"in t&&"h"in t}function zmt(t){return"x"in t&&"y"in t&&"z"in t}const Umt=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],Vmt=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]];function RIe(t,e){const i=[];let r,n;if(t[0].length!==e.length)throw new Error("dimensions do not match");const s=t.length,o=t[0].length;let l=0;for(r=0;rr<=.04045?r/12.92:((r+.055)/1.055)**2.4),i=RIe(Umt,e);return{x:100*i[0],y:100*i[1],z:100*i[2]}}function uae(t){const e=RIe(Vmt,[t.x/100,t.y/100,t.z/100]).map(i=>{const r=i<=.0031308?12.92*i:1.055*i**.4166666666666667-.055;return Math.min(1,Math.max(r,0))});return{r:Math.round(255*e[0]),g:Math.round(255*e[1]),b:Math.round(255*e[2])}}function $Ie(t){const e=[t.x/95.047,t.y/100,t.z/108.883].map(i=>i>.008856451679035631?i**.3333333333333333:7.787037037037035*i+.13793103448275862);return{l:116*e[1]-16,a:500*(e[0]-e[1]),b:200*(e[1]-e[2])}}function LIe(t){const e=t.l,i=[(e+16)/116+t.a/500,(e+16)/116,(e+16)/116-t.b/200].map(r=>r>6/29?r**3:3*(6/29)**2*(r-4/29));return{x:95.047*i[0],y:100*i[1],z:108.883*i[2]}}function Bmt(t){const e=t.l,i=t.a,r=t.b,n=Math.sqrt(i*i+r*r);let s=Math.atan2(r,i);return s=s>0?s:s+2*Math.PI,{l:e,c:n,h:s}}function jmt(t){const e=t.l,i=t.c,r=t.h;return{l:e,a:i*Math.cos(r),b:i*Math.sin(r)}}function Gmt(t){return $Ie(IIe(t))}function Hmt(t){return uae(LIe(t))}function qmt(t){return Bmt($Ie(IIe(t)))}function Wmt(t){return uae(LIe(jmt(t)))}function Ymt(t){const e=t.r,i=t.g,r=t.b,n=Math.max(e,i,r),s=n-Math.min(e,i,r);let o=n,l=s===0?0:n===e?(i-r)/s%6:n===i?(r-e)/s+2:(e-i)/s+4,c=s===0?0:s/o;return l<0&&(l+=6),l*=60,c*=100,o*=100/255,{h:l,s:c,v:o}}function Xmt(t){const e=(t.h+360)%360/60,i=t.s/100,r=t.v/100*255,n=r*i,s=n*(1-Math.abs(e%2-1));let o;switch(Math.floor(e)){case 0:o={r:n,g:s,b:0};break;case 1:o={r:s,g:n,b:0};break;case 2:o={r:0,g:n,b:s};break;case 3:o={r:0,g:s,b:n};break;case 4:o={r:s,g:0,b:n};break;case 5:case 6:o={r:n,g:0,b:s};break;default:o={r:0,g:0,b:0}}return o.r=Math.round(o.r+r-n),o.g=Math.round(o.g+r-n),o.b=Math.round(o.b+r-n),o}function SE(t){return kmt(t)?t:PIe(t)?Wmt(t):OIe(t)?Hmt(t):zmt(t)?uae(t):MIe(t)?Xmt(t):t}function Cj(t){return MIe(t)?t:Ymt(SE(t))}function Zmt(t){return OIe(t)?t:Gmt(SE(t))}function Iti(t){return PIe(t)?t:qmt(SE(t))}function Jmt(t){let{r:e,g:i,b:r,a:n}=t;return n<1&&(e=Math.round(n*e+255*(1-n)),i=Math.round(n*i+255*(1-n)),r=Math.round(n*r+255*(1-n))),new qe({r:e,g:i,b:r})}function Kmt(t,e){const{r:i,g:r,b:n}=e!=null&&e.ignoreAlpha?t:Jmt(t);return .2126*i+.7152*r+.0722*n}var Oee;function $ti(t,e=Oee.High){return Kmt(t,{ignoreAlpha:!0})>e?new qe([0,0,0,t.a]):new qe([255,255,255,t.a])}function Lti(t,e){const i=Zmt(t);i.l*=1-e;const r=SE(i),n=t.clone();return n.setColor(r),n.a=t.a,n}function Dti(t,e){const i=t.clone();return i.a*=e,i}function Nti(t,e){const i=Cj(t);i.s*=e;const r=SE(i),n=t.clone();return n.setColor(r),n.a=t.a,n}function AL(t){return qe.toUnitRGBA(t)}function Fti(t,e){return t===e||t!=null&&t.equals(e)}function kti(t,e){return t===e||t!=null&&e!=null&&VT(t,e)}function zti(t){return Mi(t[0],t[1],t[2],t.length>3?t[3]:1)}function Uti(t,e){const i=qe.toUnitRGBA(t);return i[3]*=e,i}(function(t){t[t.Low=160]="Low",t[t.High=225]="High"})(Oee||(Oee={}));function Qo(t,e){return t[0]=e[0],t[1]=e[1],t}function or(t,e,i){return t[0]=e,t[1]=i,t}function df(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t}function Ps(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t}function DIe(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t}function NIe(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t}function Qmt(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function egt(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function tgt(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t}function igt(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t}function rgt(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function Gu(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t}function If(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t}function Dm(t,e){const i=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(i*i+r*r)}function Jf(t,e){const i=e[0]-t[0],r=e[1]-t[1];return i*i+r*r}function j9(t){const e=t[0],i=t[1];return Math.sqrt(e*e+i*i)}function Yy(t){const e=t[0],i=t[1];return e*e+i*i}function hae(t,e){return t[0]=-e[0],t[1]=-e[1],t}function ngt(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function w5(t,e){const i=e[0],r=e[1];let n=i*i+r*r;return n>0&&(n=1/Math.sqrt(n),t[0]=e[0]*n,t[1]=e[1]*n),t}function fs(t,e){return t[0]*e[0]+t[1]*e[1]}function sgt(t,e,i){const r=e[0]*i[1]-e[1]*i[0];return t[0]=t[1]=0,t[2]=r,t}function ju(t,e,i,r){const n=e[0],s=e[1];return t[0]=n+r*(i[0]-n),t[1]=s+r*(i[1]-s),t}function ogt(t,e){e=e||1;const i=2*M9()*Math.PI;return t[0]=Math.cos(i)*e,t[1]=Math.sin(i)*e,t}function FIe(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[2]*n,t[1]=i[1]*r+i[3]*n,t}function uw(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[2]*n+i[4],t[1]=i[1]*r+i[3]*n+i[5],t}function agt(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[3]*n+i[6],t[1]=i[1]*r+i[4]*n+i[7],t}function lgt(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t}function cgt(t,e,i,r){const n=e[0]-i[0],s=e[1]-i[1],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l-s*o+i[0],t[1]=n*o+s*l+i[1],t}function ugt(t,e){const i=t[0],r=t[1],n=e[0],s=e[1];let o=i*i+r*r;o>0&&(o=1/Math.sqrt(o));let l=n*n+s*s;l>0&&(l=1/Math.sqrt(l));const c=(i*n+r*s)*o*l;return c>1?0:c<-1?Math.PI:Math.acos(c)}function hgt(t){return"vec2("+t[0]+", "+t[1]+")"}function kIe(t,e){return t[0]===e[0]&&t[1]===e[1]}function zIe(t,e){const i=t[0],r=t[1],n=e[0],s=e[1],o=sl();return Math.abs(i-n)<=o*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(r-s)<=o*Math.max(1,Math.abs(r),Math.abs(s))}function dgt(t,e,i,r,n){let s=e[0]-i[0],o=e[1]-i[1];const l=(r[0]*s+r[1]*o)*(n-1);return s=r[0]*l,o=r[1]*l,t[0]=e[0]+s,t[1]=e[1]+o,t}const pgt=j9,UIe=Ps,fgt=DIe,mgt=NIe,VIe=Dm,ggt=Jf,ygt=Yy;Object.freeze(Object.defineProperty({__proto__:null,add:df,angle:ugt,ceil:Qmt,copy:Qo,cross:sgt,dist:VIe,distance:Dm,div:mgt,divide:NIe,dot:fs,equals:zIe,exactEquals:kIe,floor:egt,inverse:ngt,len:pgt,length:j9,lerp:ju,max:igt,min:tgt,mul:fgt,multiply:DIe,negate:hae,normalize:w5,projectAndScale:dgt,random:ogt,rotate:cgt,round:rgt,scale:Gu,scaleAndAdd:If,set:or,sqrDist:ggt,sqrLen:ygt,squaredDistance:Jf,squaredLength:Yy,str:hgt,sub:UIe,subtract:Ps,transformMat2:FIe,transformMat2d:uw,transformMat3:agt,transformMat4:lgt},Symbol.toStringTag,{value:"Module"}));function dae(t){return Je((t-1e5)/9e5,0,1)}const Pee=1e4,vgt=.085,Nw=1e5;let _gt=class{};const _n=_gt;function V(t,...e){let i="";for(let r=0;rnew se("webscene:schema-validation",S))}).then(_=>{if(_.length>0)throw Xut(_.concat(o));return o}):Promise.resolve(o),s.then(_=>{if(_.length>0)throw new se("webscene:save","Failed to save webscene due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:_})})}_verifySaveAs(e,i,r){return this.canNotSaveAs(i)?Promise.reject(Yut()):this._verifySave(e,i,r,!0)}verifySaveAs(e){const i=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),r=this.write({},i);return this._verifySaveAs(r,i,e)}canNotSaveAs(e){var i,r;return e||(e=this._enableVerifyItemRelativeUrls({origin:"web-scene",messages:[]}),this.write({},e)),(((r=(i=e.verifyItemRelativeUrls)==null?void 0:i.writtenUrls)==null?void 0:r.length)??0)>0}async updateFrom(e,i={}){const r=this._updateFrom(e,i);this._updateFromPromise=r,await r,this._updateFromPromise===r&&(this._updateFromPromise=null)}async _updateFrom(e,i={}){if(await e.whenReady(),!i.environmentExcluded&&e.environment&&(this.initialViewProperties.environment=SP.prototype.clone.apply(e.environment)),!i.viewpointExcluded&&e.viewpoint&&(this.initialViewProperties.viewpoint=e.viewpoint.clone()),this.initialViewProperties.spatialReference=e.spatialReference.clone(),this.initialViewProperties.viewingMode=e.viewingMode,e.clippingArea!=null?e.clippingArea!==this.clippingArea&&(this.clippingArea=e.clippingArea.clone(),this.clippingEnabled=!0):this.clippingEnabled=!1,e.heightModelInfo&&(this.heightModelInfo=e.heightModelInfo.clone()),e.map===this)for(const r of e.allLayerViews){const n="visible";n in r&&n in r.layer&&r._isOverridden(n)&&(r.layer[n]=r[n])}(i.thumbnailExcluded===!1||i.thumbnailExcluded==null&&!i.viewpointExcluded)&&await this._updateFromThumbnail(e,i.thumbnailSize??void 0)}async _updateFromThumbnail(e,i){const r=Jut(e,i),n=await e.takeScreenshot({format:"jpg",width:r.width,height:r.height,disableDecorations:!0});this.thumbnailUrl=n.dataUrl}_loadFromSource(){var e;return this.resourceInfo?this._loadFromJSON(this.resourceInfo,{origin:"web-scene"}):(e=this.portalItem)!=null&&e.id?this._loadFromItem(this.portalItem):this._loadObjectsWithLayers()}_readAndLoadFromJSON(e,i){const r=this._validateJSON(e);return this.read(r,i),this._loadFromJSON(r,i)}_extractOperationalLayers(e){var s;const i=[];if(!((s=this.sourceVersion)!=null&&s.supportsGround)&&e.baseMap&&Array.isArray(e.baseMap.elevationLayers))for(const o of e.baseMap.elevationLayers)i.push(o);const r=[],n=o=>{var a;return o.layers&&(o.layers=o.layers.filter(n)),o.layerType!=="ArcGISTiledElevationServiceLayer"||((a=this.sourceVersion)!=null&&a.supportsGround||r.push(o),!1)};return{operationalLayers:e.operationalLayers?e.operationalLayers.filter(n):[],operationalElevationLayers:r,basemapElevationLayers:i}}async _loadFromJSON(e,i){var _;const r=new tt;await this._validateSpatialReference(),await this._validateHeightModelInfo();const{populateOperationalLayers:n}=await we(()=>import("./layersCreator-kgscMbpL.js"),__vite__mapDeps([9,0,1])),{operationalLayers:s,operationalElevationLayers:o,basemapElevationLayers:a}=this._extractOperationalLayers(e),c=[],p={context:{...i,layerContainerType:"operational-layers"}};if(this.portalItem&&(p.context.portal=this.portalItem.portal||os.getDefault()),a.length>0){const x={...p,context:{...p.context,layerContainerType:"ground"}};x.defaultLayerType="ArcGISTiledElevationServiceLayer",c.push(n(this.ground.layers,a,x))}if(o.length>0){const x={...p,context:{...p.context,layerContainerType:"ground"}};x.defaultLayerType="ArcGISTiledElevationServiceLayer",c.push(n(r,o,x))}s&&s.length>0&&c.push(n(this.layers,s,p)),(_=e.tables)!=null&&_.length&&c.push(n(this.tables,e.tables,{...p,context:{...p.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"})),await Promise.allSettled(c),await this._loadObjectsWithLayers(),this.ground.layers.addMany(r)}async _ensureLoadBeforeSave(){await this.load(),await this._loadObjectsWithLayers();const e=[],i=[...this.allLayers.items];for(const{basemap:r}of this.presentation.slides.items)r&&(i.push(...r.baseLayers.items),i.push(...r.referenceLayers.items));for(const r of i)if("beforeSave"in r&&typeof r.beforeSave=="function"){const n=r.beforeSave();n&&e.push(n)}await Promise.allSettled(e)}async _loadObjectsWithLayers(){const e=[];this.ground&&e.push(this.ground.load()),this.basemap&&e.push(this.basemap.load()),this.presentation.slides.forEach(i=>{i.basemap&&e.push(i.basemap.load())}),await Promise.allSettled(e)}async _loadFromItem(e){if(await e.load().catch(n=>{throw new se("webscene:load-portal-item","Failed to load portal item",{error:n})}),e.type!=="Web Scene")throw new se("webscene:invalid-portal-item","Invalid portal item type '${type}', expected 'Web Scene'",{type:e.type});const i=await e.fetchData();this.resourceInfo=i;const r={origin:"web-scene",url:Is(e.itemUrl),portal:e.portal||os.getDefault(),portalItem:e,readResourcePaths:[]};await this._readAndLoadFromJSON(i,r),this._resourceReferences={portalItem:e,paths:r.readResourcePaths??[]}}_validateSpatialReference(){const e=this.initialViewProperties,i=this._sceneSpatialReference;let r;if(e.viewingMode!=="local"){if(!xP(i,_t.Global))return Promise.reject(new se("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in global mode, only Web Mercator, WGS84 GCS or CGCS2000 are supported",{spatialReference:i,viewingMode:e.viewingMode}));r=c=>!c||rh(c,i)}else{if(!xP(i,_t.Local))return Promise.reject(new se("webscene:unsupported-spatial-reference","Unsupported spatial reference (${spatialReference.wkid}) in local mode, only projected coordinate systems are supported",{spatialReference:i,viewingMode:e.viewingMode}));r=c=>!c||c.equals(i)}const n=c=>{var p,_;return((p=c==null?void 0:c.camera)==null?void 0:p.position.spatialReference)??((_=c==null?void 0:c.targetGeometry)==null?void 0:_.spatialReference)},s=e.viewpoint,o=n(s);if(o&&!r(o))return Promise.reject(new se("webscene:incompatible-camera-spatial-reference","Camera spatial reference (${cameraSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{cameraSpatialReference:o,sceneSpatialReference:i,viewingMode:e.viewingMode}));const a=this.presentation.slides.find(c=>!r(n(c.viewpoint)));if(a){const c=n(a.viewpoint);return Promise.reject(new se("webscene:incompatible-slide-spatial-reference","Slide spatial reference (${slideSpatialReference.wkid}) is incompatible with the scene spatial reference (${sceneSpatialReference.wkid})",{slideSpatialReference:c,sceneSpatialReference:i,viewingMode:e.viewingMode}))}return Promise.resolve()}_validateHeightModelInfo(){const e=this._sceneSpatialReference,i=Fut(this.heightModelInfo,e);return i?Promise.reject(i):Promise.resolve()}_validateJSON(e){const i=oU.parse(e.version||"","webscene");return xT.validate(i),e.version=`${i.major}.${i.minor}`,i.major===1&&i.minor<=2&&(e.spatialReference=rt.WebMercator.toJSON()),e}_updateTypeKeywords(e){qpe(e,XK.LOCAL_SCENE,this.initialViewProperties.viewingMode==="local"),qpe(e,XK.DEVELOPER_BASEMAP,Zfe(this.basemap)||this.presentation.slides.some(({basemap:i})=>!!i&&Zfe(i))),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter((i,r,n)=>n.indexOf(i)===r))}get _sceneSpatialReference(){return this.initialViewProperties.spatialReference||rt.WebMercator}get _verifyItemRelativeRootPath(){var e;return(e=this.portalItem)!=null&&e.itemUrl?Is(this.portalItem.itemUrl).path:null}_enableVerifyItemRelativeUrls(e){const i=this._verifyItemRelativeRootPath;return i&&(e.verifyItemRelativeUrls={rootPath:i,writtenUrls:[]}),e}_unscheduleLayersIdGC(){this._layersIdGCTimeoutId&&(clearTimeout(this._layersIdGCTimeoutId),this._layersIdGCTimeoutId=0)}_scheduleLayersIdGC(){this._unscheduleLayersIdGC(),this._layersIdGCTimeoutId=setTimeout(()=>{this._layersIdGCTimeoutId=0,this._runLayersIdGC()},3e3)}_runLayersIdGC(){var n,s;this._unscheduleLayersIdGC();const e=(s=(n=this.applicationProperties)==null?void 0:n.viewing)==null?void 0:s.search,i=o=>this.allLayers.some(a=>a.id===o&&a.persistenceEnabled);e&&e.layers&&(e.layers=e.layers.filter(o=>i(o.id)));const r=this.presentation&&this.presentation.slides;r&&r.forEach(o=>{o.visibleLayers&&(o.visibleLayers=o.visibleLayers.filter(a=>i(a.id)))})}static fromJSON(e){if(!e)throw new se("webscene:empty-resource","Expected a JSON resource but got nothing");return new this({resourceInfo:e})}};$Re=lRe,wn.version=`${xT.major}.${xT.minor}`,y([w({type:nht,json:{write:!0}})],wn.prototype,"applicationProperties",void 0),y([w({type:Vi,json:{read:{source:"clippingArea.geometry",reader:Wy},write:{target:"clippingArea.geometry"}}})],wn.prototype,"clippingArea",void 0),y([Et("clippingArea")],wn.prototype,"writeClippingArea",null),y([w({type:Boolean,json:{write:{target:"clippingArea.clip"}}})],wn.prototype,"clippingEnabled",void 0),y([Rt("clippingEnabled",["clippingArea"])],wn.prototype,"readClippingEnabled",null),y([Et("clippingEnabled")],wn.prototype,"writeClippingEnabled",null),y([w({type:Hut,json:{read:{source:"mapFloorInfo"},write:{target:"mapFloorInfo"}}})],wn.prototype,"floorInfo",void 0),y([w({type:B_,json:{write:!0}})],wn.prototype,"heightModelInfo",void 0),y([w({json:{write:{target:"operationalLayers",ignoreOrigin:!0}}})],wn.prototype,"layers",void 0),y([Et("layers")],wn.prototype,"writeLayers",null),y([w({readOnly:!0,type:oU,json:{type:Oht(),write:{ignoreOrigin:!0,target:"version",isRequired:!0,overridePolicy:()=>({enabled:!0,allowNull:!0,ignoreOrigin:!0})}}})],wn.prototype,"sourceVersion",void 0),y([Rt("sourceVersion",["version"])],wn.prototype,"readSourceVersion",null),y([Et("sourceVersion")],wn.prototype,"writeSourceVersion",null),y([w({json:{read:!1,write:{enabled:!0,ignoreOrigin:!0}}})],wn.prototype,"tables",void 0),y([Et("tables")],wn.prototype,"writeTables",null),y([w()],wn.prototype,"thumbnailUrl",null),y([w({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],wn.prototype,"authoringApp",null),y([Et("authoringApp")],wn.prototype,"writeAuthoringApp",null),y([w({type:String,json:{write:{writerEnsuresNonNull:!0,ignoreOrigin:!0}}})],wn.prototype,"authoringAppVersion",null),y([Et("authoringAppVersion")],wn.prototype,"writeAuthoringAppVersion",null),y([w({json:{write:{isRequired:!0,allowNull:!0,ignoreOrigin:!0,enabled:!0}}})],wn.prototype,"ground",void 0),y([Et("ground")],wn.prototype,"writeGround",null),y([w({type:tt.ofType(Cht),json:{write:!0}})],wn.prototype,"transportationNetworks",void 0),y([w({type:IRe,nonNullable:!0,json:{write:{ignoreOrigin:!0,writer:(t,e,i,r)=>{if(t.slides&&t.slides.length>0){const n={...r,isPresentation:!0};e.presentation=t.write({},n)}}}}})],wn.prototype,"presentation",void 0),y([w({type:nU,nonNullable:!0,json:{write:{target:"initialState",isRequired:!0,ignoreOrigin:!0},default:()=>new nU({viewingMode:"global",spatialReference:rt.WebMercator})}})],wn.prototype,"initialViewProperties",void 0),y([Rt("initialViewProperties",["initialState.environment","initialState.viewpoint","spatialReference","viewingMode"])],wn.prototype,"readInitialViewProperties",null),y([w({type:rt,json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],wn.prototype,"spatialReference",null),y([w({type:["local","global"],json:{read:!1,write:{isRequired:!0,ignoreOrigin:!0}}})],wn.prototype,"viewingMode",null),y([w({type:Om})],wn.prototype,"portalItem",void 0),y([w()],wn.prototype,"resourceInfo",void 0),wn=y([Z("esri.WebScene")],wn);const Pht=wn;function W9(t){return typeof t=="string"?document.getElementById(t):t??null}function LRe(t){for(;t.hasChildNodes();)t.removeChild(t.firstChild)}function g0e(t,e){const i=e.parentNode;i&&i.insertBefore(t,e)}function y0e(t,e){for(;;){const i=t.firstChild;if(!i)break;e.appendChild(i)}}function Rht(t){t.parentNode&&t.parentNode.removeChild(t)}let aU=class{constructor(e=i=>i.values().next().value){this._peeker=e,this._observable=new M9,this._items=new Set}get length(){return wi(this._observable),this._items.size}clear(){this.length!==0&&(this._items.clear(),this._observable.notify())}last(){if(this.length===0)return;let e;for(e of this._items);return e}peek(){if(this.length!==0)return this._peeker(this._items)}push(e){this.contains(e)||(this._items.add(e),this._observable.notify())}contains(e){return wi(this._observable),this._items.has(e)}pop(){if(this.length===0)return;const e=this.peek();return this._items.delete(e),this._observable.notify(),e}popLast(){if(this.length===0)return;const e=this.last();return this._items.delete(e),this._observable.notify(),e}remove(e){this.contains(e)&&(this._items.delete(e),this._observable.notify())}filter(e){const i=this.length;return this._items.forEach(r=>{e(r)||this._items.delete(r)}),i!==this._items.size&&this._observable.notify(),this}*[Symbol.iterator](){wi(this._observable),yield*this._items}};const DRe=new FinalizationRegistry(t=>{t.close()});function Iht(t,e){DRe.register(t,e,e)}function $ht(t){DRe.unregister(t)}const Lht={statsWorker:()=>we(()=>import("./statsWorker-Z_8Cn8It.js"),__vite__mapDeps([85,50,35])),geometryEngineWorker:()=>we(()=>import("./geometryEngineWorker-8ZL1nHC2.js"),__vite__mapDeps([86,87,49])),CSVSourceWorker:()=>we(()=>import("./CSVSourceWorker-4-dU7rZu.js"),__vite__mapDeps([88,64,49,44,45,46,47,48,4,5,28,50,35,51,27])),EdgeProcessingWorker:()=>we(()=>import("./EdgeProcessingWorker-sY3QTnTZ.js"),__vite__mapDeps([])),ElevationSamplerWorker:()=>we(()=>import("./ElevationSamplerWorker-k8_PEq10.js"),__vite__mapDeps([89,46,47])),FeatureServiceSnappingSourceWorker:()=>we(()=>import("./FeatureServiceSnappingSourceWorker-GdDLcUBl.js"),__vite__mapDeps([90,44,45,46,47,48,4,5,49,28,50,35,51,91])),GeoJSONSourceWorker:()=>we(()=>import("./GeoJSONSourceWorker-KDFieIXt.js"),__vite__mapDeps([92,44,45,46,47,48,4,5,49,28,50,35,51,63,64,27,93])),LercWorker:()=>we(()=>import("./LercWorker-p4NiAClL.js"),__vite__mapDeps([])),MemorySourceWorker:()=>we(()=>import("./MemorySourceWorker-6wu4D2bo.js"),__vite__mapDeps([94,57,44,45,46,47,48,4,5,49,28,50,35,51,27,93,64])),PBFDecoderWorker:()=>we(()=>import("./PBFDecoderWorker-mLYHZi4e.js"),__vite__mapDeps([])),Pipeline:()=>we(()=>import("./Pipeline-PlEwhMAg.js").then(t=>t.P),__vite__mapDeps([95,48,4,5,49,28,50,35,96,47,97,62,63,64,27,98,78,99,100,43])),PointCloudWorker:()=>we(()=>import("./PointCloudWorker-rfPDyXh6.js"),__vite__mapDeps([101,102,69])),RasterWorker:()=>we(()=>import("./RasterWorker-dDXhiR2p.js"),__vite__mapDeps([103,34,39,38])),SceneLayerSnappingSourceWorker:()=>we(()=>import("./SceneLayerSnappingSourceWorker-Ty-SvQ0f.js"),__vite__mapDeps([])),SceneLayerWorker:()=>we(()=>import("./SceneLayerWorker-fjNBmTGi.js").then(t=>t.S),__vite__mapDeps([104,105])),WFSSourceWorker:()=>we(()=>import("./WFSSourceWorker-AqESE9b6.js"),__vite__mapDeps([106,44,45,46,47,48,4,5,49,28,50,35,51,63,64,93,80,81])),WorkerTileHandler:()=>we(()=>import("./WorkerTileHandler-znQwxG7k.js"),__vite__mapDeps([107,77,76,78,108,109,110]))};var ql;(function(t){t[t.HANDSHAKE=0]="HANDSHAKE",t[t.OPEN=1]="OPEN",t[t.OPENED=2]="OPENED",t[t.RESPONSE=3]="RESPONSE",t[t.INVOKE=4]="INVOKE",t[t.ABORT=5]="ABORT",t[t.CLOSE=6]="CLOSE",t[t.OPEN_PORT=7]="OPEN_PORT",t[t.ON=8]="ON"})(ql||(ql={}));let Dht=0;function NRe(){return Dht++}function Nht(t){return t&&typeof t=="object"&&("result"in t||"transferList"in t)}function RL(t){return t?typeof t=="string"?JSON.stringify({name:"message",message:t}):t.toJSON?JSON.stringify(t):JSON.stringify({name:t.name,message:t.message,details:t.details||{stack:t.stack}}):null}function rae(t,e,i,r){if(e.type===ql.OPEN_PORT)return void t.postMessage(e,[e.port]);if(e.type!==ql.INVOKE&&e.type!==ql.RESPONSE)return void t.postMessage(e);let n;if(Nht(i)?(n=v0e(i.transferList),e.data=i.result):(n=v0e(r),e.data=i),n){if($e("ff")){for(const s of n)if("byteLength"in s&&s.byteLength>267386880){const o="Worker call with large ArrayBuffer would crash Firefox";switch(e.type){case ql.INVOKE:throw o;case ql.RESPONSE:return void rae(t,{type:ql.RESPONSE,jobId:e.jobId,error:RL(o)})}}}t.postMessage(e,n)}else t.postMessage(e)}function IL(t){if(!t)return null;const e=t.data;return e?typeof e=="string"?JSON.parse(e):e:null}function v0e(t){if(!(t!=null&&t.length))return null;if($e("esri-workers-arraybuffer-transfer"))return t;const e=t.filter(i=>!Fht(i));return e.length?e:null}function Fht(t){var e;return t instanceof ArrayBuffer||((e=t==null?void 0:t.constructor)==null?void 0:e.name)==="ArrayBuffer"}const{CLOSE:_0e,ABORT:b0e,INVOKE:w0e,RESPONSE:lR,OPEN_PORT:x0e,ON:kht}=ql,zht=2;let Uht=class{constructor(e){this._timer=null,this._cancelledJobIds=new Set,this._invokeMessages=[],this._invoke=e,this._timer=null,this._process=this._process.bind(this)}push(e){e.type===ql.ABORT?this._cancelledJobIds.add(e.jobId):(this._invokeMessages.push(e),this._timer===null&&(this._timer=setTimeout(this._process,0)))}clear(){this._invokeMessages.length=0,this._cancelledJobIds.clear(),this._timer=null}_process(){this._timer=null;for(const e of this._invokeMessages)this._cancelledJobIds.has(e.jobId)||this._invoke(e);this._cancelledJobIds.clear(),this._invokeMessages.length=0}},G2=class kA{static connect(e){const i=new MessageChannel;let r;r=typeof e=="function"?new e:"default"in e&&typeof e.default=="function"?new e.default:e;const n=new kA(i.port1,{channel:i,client:r});return typeof r=="object"&&"remoteClient"in r&&(r.remoteClient=n),kA.clients.set(n,r),i.port2}static loadWorker(e){const i=Lht[e];return i?i():Promise.resolve(null)}constructor(e,i,r){this._port=e,this._jobQueue=r,this._outJobs=new Map,this._inJobs=new Map,this._invokeQueue=new Uht(n=>this._onInvokeMessage(n)),this._client=i.client,this._onMessage=this._onMessage.bind(this),this._channel=i.channel,this._schedule=i.schedule,this._port.addEventListener("message",this._onMessage),this._port.start()}close(){this._post({type:_0e}),this._close()}isBusy(){return this._outJobs.size>0}invoke(e,i,r){const n=r==null?void 0:r.signal,s=r==null?void 0:r.transferList;if(!this._port)return Promise.reject(new se("worker:port-closed",`Cannot call invoke('${e}'), port is closed`,{methodName:e,data:i}));const o=NRe();return new Promise((a,c)=>{if(So(n))return this._processWork(),void c(ur());const p=Zl(n,()=>{const x=this._outJobs.get(o);x&&(this._outJobs.delete(o),this._processWork(),en(x.abortHandle),this._post({type:b0e,jobId:o}),c(ur()))}),_={resolve:a,reject:c,abortHandle:p,debugInfo:e};this._outJobs.set(o,_),this._post({type:w0e,jobId:o,methodName:e,abortable:n!=null},i,s)})}on(e,i){const r=new MessageChannel;function n(s){i(s.data)}return this._port.postMessage({type:ql.ON,eventType:e,port:r.port2},[r.port2]),r.port1.addEventListener("message",n),r.port1.start(),rr(()=>{r.port1.postMessage({type:ql.CLOSE}),r.port1.close(),r.port1.removeEventListener("message",n)})}jobAdded(){this._processWork()}openPort(){const e=new MessageChannel;return this._post({type:x0e,port:e.port2}),e.port1}_processWork(){var o;if(this._outJobs.size>=zht)return;const e=(o=this._jobQueue)==null?void 0:o.pop();if(!e)return;const{methodName:i,data:r,invokeOptions:n,resolver:s}=e;this.invoke(i,r,n).then(a=>s.resolve(a)).catch(a=>s.reject(a))}_close(){this._channel&&(this._channel=void 0),this._port.removeEventListener("message",this._onMessage),this._port.close(),this._outJobs.forEach(e=>{en(e.abortHandle),e.reject(ur(`Worker closing, aborting job calling '${e.debugInfo}'`))}),this._inJobs.clear(),this._outJobs.clear(),this._invokeQueue.clear(),this._port=null,this._client=null,this._schedule=null}_onMessage(e){this._schedule!=null?this._schedule(()=>this._processMessage(e)):this._processMessage(e)}_processMessage(e){const i=IL(e);if(i)switch(i.type){case lR:this._onResponseMessage(i);break;case w0e:this._invokeQueue.push(i);break;case b0e:this._onAbortMessage(i);break;case _0e:this._onCloseMessage();break;case x0e:this._onOpenPortMessage(i);break;case kht:this._onOnMessage(i)}}_onAbortMessage(e){const i=this._inJobs,r=e.jobId,n=i.get(r);this._invokeQueue.push(e),n&&(n.controller&&n.controller.abort(),i.delete(r))}_onCloseMessage(){const e=this._client;this._close(),e&&"destroy"in e&&kA.clients.get(this)===e&&e.destroy(),kA.clients.delete(this),e!=null&&e.remoteClient&&(e.remoteClient=null)}_onInvokeMessage(e){const{methodName:i,jobId:r,data:n,abortable:s}=e,o=s?new AbortController:null,a=this._inJobs;let c,p=this._client,_=p[i];try{if(!_&&i&&i.includes(".")){const x=i.split(".");for(let S=0;S{a.has(r)&&(a.delete(r),this._post({type:lR,jobId:r},x))},x=>{a.has(r)&&(a.delete(r),on(x)||this._post({type:lR,jobId:r,error:RL(x||{message:`Error encountered at method ${i}`})}))})):this._post({type:lR,jobId:r},c)}_onOpenPortMessage(e){new kA(e.port,{client:this._client})}_onOnMessage(e){const{port:i}=e,r=this._client.on(e.eventType,s=>{i.postMessage(s)}),n=r5(e.port,"message",s=>{const o=IL(s);(o==null?void 0:o.type)===ql.CLOSE&&(n.remove(),r.remove(),i.close())})}_onResponseMessage(e){const{jobId:i,error:r,data:n}=e,s=this._outJobs;if(!s.has(i))return;const o=s.get(i);s.delete(i),this._processWork(),en(o.abortHandle),r?o.reject(se.fromJSON(JSON.parse(r))):o.resolve(n)}_post(e,i,r){return rae(this._port,e,i,r)}};G2.kernelInfo={buildDate:BTe,fullVersion:Fne,revision:jTe},G2.clients=new Map;let Vht=class{constructor(){this._inUseClients=new Array,this._clients=new Array,this._clientPromises=new Array,this._ongoingJobsQueue=new aU}destroy(){this.close()}get closed(){var e;return!((e=this._clients)!=null&&e.length)}open(e,i){return new Promise((r,n)=>{let s=!0;const o=a=>{St(i.signal),s&&(s=!1,a())};this._clients.length=e.length,this._clientPromises.length=e.length,this._inUseClients.length=e.length;for(let a=0;a(this._clients[a]=new G2(p,i,this._ongoingJobsQueue),o(r),this._clients[a]),()=>(o(n),null)):(this._clients[a]=new G2(c,i,this._ongoingJobsQueue),this._clientPromises[a]=Promise.resolve(this._clients[a]),o(r))}})}broadcast(e,i,r){const n=new Array(this._clientPromises.length);for(let s=0;sa==null?void 0:a.invoke(e,i,r))}return n}close(){let e;for(;e=this._ongoingJobsQueue.pop();)e.resolver.reject(ur(`Worker closing, aborting job calling '${e.methodName}'`));for(const i of this._clientPromises)i.then(r=>r==null?void 0:r.close());this._clients.length=0,this._clientPromises.length=0,this._inUseClients.length=0,$ht(this)}invoke(e,i,r){let n;Array.isArray(r)?(Ce.getLogger("esri.core.workers.Connection").warn("invoke()","The transferList parameter is deprecated, use the options object instead"),n={transferList:r}):n=r;const s=ec();this._ongoingJobsQueue.push({methodName:e,data:i,invokeOptions:n,resolver:s});for(let o=0;oc==null?void 0:c.jobAdded())}return s.promise}on(e,i){return Promise.all(this._clientPromises).then(()=>sd(this._clients.map(r=>r.on(e,i))))}openPorts(){return new Promise(e=>{const i=new Array(this._clientPromises.length);let r=i.length;for(let n=0;n{s&&(i[n]=s.openPort()),--r==0&&e(i)})})}get test(){return{numClients:this._clients.length}}};const Bht={async request(t,e){var o,a;const i=t.options,r=i.responseType;i.signal=e==null?void 0:e.signal,i.responseType=r==="native"||r==="native-request-init"?"native-request-init":r&&["blob","json","text"].includes(r)&&((o=NTe(t.url))!=null&&o.after)?r:"array-buffer";const n=await yi(t.url,i),s={data:n.data,httpStatus:n.httpStatus,ssl:n.ssl};switch((a=n.requestOptions)==null?void 0:a.responseType){case"native-request-init":return delete s.data.signal,s;case"blob":s.data=await s.data.arrayBuffer();break;case"json":s.data=new TextEncoder().encode(JSON.stringify(s.data)).buffer;break;case"text":s.data=new TextEncoder().encode(s.data).buffer}return{result:s,transferList:[s.data]}}},jht={};function Ght(t){var i;const e={async:t.async,isDebug:t.isDebug,locale:t.locale,baseUrl:t.baseUrl,has:{...t.has},map:{...t.map},packages:((i=t.packages)==null?void 0:i.concat())||[],paths:{...t.paths}};return t.hasOwnProperty("async")||(e.async=!0),t.hasOwnProperty("isDebug")||(e.isDebug=!1),t.baseUrl||(e.baseUrl=jht.baseUrl),e}let Hht=class{constructor(){const e=document.createDocumentFragment();["addEventListener","dispatchEvent","removeEventListener"].forEach(i=>{this[i]=(...r)=>e[i](...r)})}},NF=class{constructor(){this._dispatcher=new Hht,this._workerPostMessage({type:ql.HANDSHAKE})}terminate(){}get onmessage(){return this._onmessageHandler}set onmessage(e){this._onmessageHandler&&this.removeEventListener("message",this._onmessageHandler),this._onmessageHandler=e,e&&this.addEventListener("message",e)}get onmessageerror(){return this._onmessageerrorHandler}set onmessageerror(e){this._onmessageerrorHandler&&this.removeEventListener("messageerror",this._onmessageerrorHandler),this._onmessageerrorHandler=e,e&&this.addEventListener("messageerror",e)}get onerror(){return this._onerrorHandler}set onerror(e){this._onerrorHandler&&this.removeEventListener("error",this._onerrorHandler),this._onerrorHandler=e,e&&this.addEventListener("error",e)}postMessage(e){qO(()=>{this._workerMessageHandler(new MessageEvent("message",{data:e}))})}dispatchEvent(e){return this._dispatcher.dispatchEvent(e)}addEventListener(e,i,r){this._dispatcher.addEventListener(e,i,r)}removeEventListener(e,i,r){this._dispatcher.removeEventListener(e,i,r)}_workerPostMessage(e){qO(()=>{this.dispatchEvent(new MessageEvent("message",{data:e}))})}async _workerMessageHandler(e){const i=IL(e);if(i&&i.type===ql.OPEN){const{modulePath:r,jobId:n}=i;let s=await G2.loadWorker(r);s||(s=await we(()=>import(r),__vite__mapDeps([])));const o=G2.connect(s);this._workerPostMessage({type:ql.OPENED,jobId:n,data:o})}}};const vee=Ce.getLogger("esri.core.workers.workerFactory"),{HANDSHAKE:qht}=ql,Wht='let globalId=0;const outgoing=new Map,configuration=JSON.parse("{CONFIGURATION}");self.esriConfig=configuration.esriConfig;const workerPath=self.esriConfig.workers.workerPath,HANDSHAKE=0,OPEN=1,OPENED=2,RESPONSE=3,INVOKE=4,ABORT=5;function createAbortError(){const e=new Error("Aborted");return e.name="AbortError",e}function receiveMessage(e){return e&&e.data?"string"==typeof e.data?JSON.parse(e.data):e.data:null}function invokeStaticMessage(e,o,r){const t=r&&r.signal,n=globalId++;return new Promise(((r,s)=>{if(t){if(t.aborted)return s(createAbortError());t.addEventListener("abort",(()=>{outgoing.get(n)&&(outgoing.delete(n),self.postMessage({type:ABORT,jobId:n}),s(createAbortError()))}))}outgoing.set(n,{resolve:r,reject:s}),self.postMessage({type:INVOKE,jobId:n,methodName:e,abortable:null!=t,data:o})}))}let workerRevisionChecked=!1;function checkWorkerRevision(e){if(!workerRevisionChecked&&e.kernelInfo){workerRevisionChecked=!0;const{revision:o,fullVersion:r}=configuration.kernelInfo,{revision:t,fullVersion:n,version:s}=e.kernelInfo;esriConfig.assetsPath!==esriConfig.defaultAssetsPath&&o!==t&&console.warn(`Version mismatch detected between ArcGIS Maps SDK for JavaScript modules and assets. For more information visit https://bit.ly/3QnsuSo.\\nModules version: ${r}\\nAssets version: ${n??s}\\nAssets path: ${esriConfig.assetsPath}`)}}function messageHandler(e){const o=receiveMessage(e);if(!o)return;const r=o.jobId;switch(o.type){case OPEN:let n;function t(e){const o=n.connect(e);self.postMessage({type:OPENED,jobId:r,data:o},[o])}"function"==typeof define&&define.amd?require([workerPath],(e=>{n=e.default||e,checkWorkerRevision(n),n.loadWorker(o.modulePath).then((e=>e||new Promise((e=>{require([o.modulePath],e)})))).then(t)})):"System"in self&&"function"==typeof System.import?System.import(workerPath).then((e=>(n=e.default,checkWorkerRevision(n),n.loadWorker(o.modulePath)))).then((e=>e||System.import(o.modulePath))).then(t):esriConfig.workers.useDynamicImport?import(workerPath).then((e=>{n=e.default||e,checkWorkerRevision(n),n.loadWorker(o.modulePath).then((e=>e||import(o.modulePath))).then(t)})):(self.RemoteClient||importScripts(workerPath),n=self.RemoteClient.default||self.RemoteClient,checkWorkerRevision(n),n.loadWorker(o.modulePath).then(t));break;case RESPONSE:if(outgoing.has(r)){const s=outgoing.get(r);outgoing.delete(r),o.error?s.reject(JSON.parse(o.error)):s.resolve(o.data)}}}self.dojoConfig=configuration.loaderConfig,esriConfig.workers.loaderUrl&&(self.importScripts(esriConfig.workers.loaderUrl),"function"==typeof require&&"function"==typeof require.config&&require.config(configuration.loaderConfig)),self.addEventListener("message",messageHandler),self.postMessage({type:0});';let MD,OD;const S0e="Failed to create Worker. Fallback to execute module in main thread";async function Yht(){if(!$e("esri-workers"))return T0e(new NF);if(!MD&&!OD)try{const e=Wht.split('"{CONFIGURATION}"').join(`'${Xht()}'`);MD=URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}catch(e){OD=e||{}}let t;if(MD)try{t=new Worker(MD,{name:"esri-worker-"+Zht++})}catch{vee.warn(S0e,OD),t=new NF}else vee.warn(S0e,OD),t=new NF;return T0e(t)}async function T0e(t){return new Promise(e=>{function i(n){const s=IL(n);s&&s.type===qht&&(t.removeEventListener("message",i),t.removeEventListener("error",r),e(t))}function r(n){n.preventDefault(),t.removeEventListener("message",i),t.removeEventListener("error",r),vee.warn("Failed to create Worker. Fallback to execute module in main thread",n),(t=new NF).addEventListener("message",i),t.addEventListener("error",r)}t.addEventListener("message",i),t.addEventListener("error",r)})}function Xht(){let t;if(Mr.default!=null){const n={...Mr};delete n.default,t=JSON.parse(JSON.stringify(n))}else t=JSON.parse(JSON.stringify(Mr));t.assetsPath=Wh(t.assetsPath),t.defaultAssetsPath=t.defaultAssetsPath?Wh(t.defaultAssetsPath):void 0,t.request.interceptors=[],t.log.interceptors=[],t.locale=ma(),t.has={"esri-csp-restrictions":$e("esri-csp-restrictions"),"esri-2d-debug":!1,"esri-2d-update-debug":$e("esri-2d-update-debug"),"esri-2d-log-updating":$e("esri-2d-log-updating"),"featurelayer-pbf":$e("featurelayer-pbf"),"featurelayer-simplify-thresholds":$e("featurelayer-simplify-thresholds"),"featurelayer-simplify-payload-size-factors":$e("featurelayer-simplify-payload-size-factors"),"featurelayer-simplify-mobile-factor":$e("featurelayer-simplify-mobile-factor"),"esri-atomics":$e("esri-atomics"),"esri-shared-array-buffer":$e("esri-shared-array-buffer"),"esri-tiles-debug":$e("esri-tiles-debug"),"esri-workers-arraybuffer-transfer":$e("esri-workers-arraybuffer-transfer"),"feature-polyline-generalization-factor":$e("feature-polyline-generalization-factor"),"host-webworker":1},t.workers.loaderUrl&&(t.workers.loaderUrl=Wh(t.workers.loaderUrl)),t.workers.workerPath?t.workers.workerPath=Wh(t.workers.workerPath):t.workers.workerPath=Wh(Wr("esri/core/workers/RemoteClient.js")),t.workers.useDynamicImport=!1;const e=Mr.workers.loaderConfig,i=Ght({baseUrl:e==null?void 0:e.baseUrl,locale:ma(),has:{"csp-restrictions":1,"dojo-test-sniff":0,"host-webworker":1,...e==null?void 0:e.has},map:{...e==null?void 0:e.map},paths:{...e==null?void 0:e.paths},packages:(e==null?void 0:e.packages)||[]});return JSON.stringify({esriConfig:t,loaderConfig:i,kernelInfo:{buildDate:BTe,fullVersion:Fne,revision:jTe}})}let Zht=0;const{ABORT:E0e,INVOKE:Jht,OPEN:Kht,OPENED:Qht,RESPONSE:cR}=ql;let edt=class FRe{static async create(e){const i=await Yht();return new FRe(i,e)}constructor(e,i){this._outJobs=new Map,this._inJobs=new Map,this.worker=e,this.id=i,e.addEventListener("message",this._onMessage.bind(this)),e.addEventListener("error",r=>{r.preventDefault(),Ce.getLogger("esri.core.workers.WorkerOwner").error(r)})}terminate(){this.worker.terminate()}async open(e,i={}){const{signal:r}=i,n=NRe();return new Promise((s,o)=>{const a={resolve:s,reject:o,abortHandle:C9(r,()=>{this._outJobs.delete(n),this._post({type:E0e,jobId:n})})};this._outJobs.set(n,a),this._post({type:Kht,jobId:n,modulePath:e})})}_onMessage(e){const i=IL(e);if(i)switch(i.type){case Qht:this._onOpenedMessage(i);break;case cR:this._onResponseMessage(i);break;case E0e:this._onAbortMessage(i);break;case Jht:this._onInvokeMessage(i)}}_onAbortMessage(e){const i=this._inJobs,r=e.jobId,n=i.get(r);n&&(n.controller&&n.controller.abort(),i.delete(r))}_onInvokeMessage(e){const{methodName:i,jobId:r,data:n,abortable:s}=e,o=s?new AbortController:null,a=this._inJobs,c=Bht[i];let p;try{if(typeof c!="function")throw new TypeError(`${i} is not a function`);p=c.call(null,n,{signal:o?o.signal:null})}catch(_){return void this._post({type:cR,jobId:r,error:RL(_)})}yd(p)?(a.set(r,{controller:o,promise:p}),p.then(_=>{a.has(r)&&(a.delete(r),this._post({type:cR,jobId:r},_))},_=>{a.has(r)&&(a.delete(r),_||(_={message:"Error encountered at method"+i}),on(_)||this._post({type:cR,jobId:r,error:RL(_||{message:`Error encountered at method ${i}`})}))})):this._post({type:cR,jobId:r},p)}_onOpenedMessage(e){const{jobId:i,data:r}=e,n=this._outJobs.get(i);n&&(this._outJobs.delete(i),en(n.abortHandle),n.resolve(r))}_onResponseMessage(e){const{jobId:i,error:r,data:n}=e,s=this._outJobs.get(i);s&&(this._outJobs.delete(i),en(s.abortHandle),r?s.reject(se.fromJSON(JSON.parse(r))):s.resolve(n))}_post(e,i,r){return rae(this.worker,e,i,r)}};const C0e=$e("host-browser")?Math.min(navigator.hardwareConcurrency-1,$e("workers-pool-size")):0;let iT=$e("esri-mobile")?Math.min(C0e,3):C0e;iT||(iT=$e("safari")&&$e("mac")?7:2);let A0e=0;const FF=[];function tdt(){kRe()}async function PD(t,e){const i=new Vht,{registryTarget:r,...n}=e;return await i.open(t,n),r&&Iht(r,i),i}async function idt(t,e={}){if(typeof t!="string")throw new se("workers:undefined-module","modulePath is missing");let i=e.strategy||"distributed";if($e("host-webworker")&&!$e("esri-workers")&&(i="local"),i==="local"){let r=await G2.loadWorker(t);r||(r=await we(()=>import(t),__vite__mapDeps([]))),St(e.signal);const n=e.client||r;return PD([G2.connect(r)],{...e,client:n})}if(await kRe(),St(e.signal),i==="dedicated"){const r=A0e++%iT;return PD([await FF[r].open(t,e)],e)}if(e.maxNumWorkers&&e.maxNumWorkers>0){const r=Math.min(e.maxNumWorkers,iT);if(rr.open(t,e)),e)}let RD=null;async function kRe(){if(RD)return RD;new AbortController;const t=[];for(let e=0;e(FF[e]=r,r));t.push(i)}return RD=Promise.all(t),RD}function wj(t,e,i,r){return t!=null&&(jn(e,r)?(__(i,t),!0):(ah[0]=t[0],ah[1]=t[1],ah[2]=0,!!un(ah,e,0,ah,r,0,1)&&(i[0]=ah[0],i[1]=ah[1],ah[0]=t[2],ah[1]=t[3],ah[2]=0,!!un(ah,e,0,ah,r,0,1)&&(i[2]=ah[0],i[3]=ah[1],!0))))}const ah=W();function fd(t,e,i,r=0){ID[0]=t.x,ID[1]=t.y;const n=t.z;return ID[2]=n!==void 0?n:r,un(ID,t.spatialReference,0,e,i,0,1)}const ID=W();function Ym(t){return t?{origin:Xr(t.origin),vector:Xr(t.vector)}:{origin:W(),vector:W()}}function rdt(t,e){const i=sdt.get();return i.origin=t,i.vector=e,i}function Oti(t,e=Ym()){return ndt(t.origin,t.vector,e)}function ndt(t,e,i=Ym()){return Ne(i.origin,t),Ne(i.vector,e),i}function ST(t,e,i=Ym()){return Ne(i.origin,t),je(i.vector,e,t),i}function nae(t,e){const i=je(xt.get(),e,t.origin),r=Ve(t.vector,i),n=Ve(t.vector,t.vector),s=Je(r/n,0,1),o=je(xt.get(),De(xt.get(),t.vector,s),i);return Ve(o,o)}function Pti(t,e,i){return _ee(t,e,0,1,i)}function Rti(t,e,i){return Be(i,t.origin,De(i,t.vector,e))}function _ee(t,e,i,r,n){const{vector:s,origin:o}=t,a=je(xt.get(),e,o),c=Ve(s,a)/Al(s);return De(n,s,Je(c,i,r)),Be(n,n,t.origin)}function Iti(t,e){if(URe(t,rdt(e.origin,e.direction),!1,lU)){const{tA:i,pB:r,distance2:n}=lU;if(i>=0&&i<=1)return n;if(i<0)return Ao(t.origin,r);if(i>1)return Ao(Be(xt.get(),t.origin,t.vector),r)}return null}function zRe(t,e,i){return!!URe(t,e,!0,lU)&&(Ne(i,lU.pA),!0)}function URe(t,e,i,r){const s=t.origin,o=Be(xt.get(),s,t.vector),a=e.origin,c=Be(xt.get(),a,e.vector),p=xt.get(),_=xt.get();if(p[0]=s[0]-a[0],p[1]=s[1]-a[1],p[2]=s[2]-a[2],_[0]=c[0]-a[0],_[1]=c[1]-a[1],_[2]=c[2]-a[2],Math.abs(_[0])<1e-6&&Math.abs(_[1])<1e-6&&Math.abs(_[2])<1e-6)return!1;const x=xt.get();if(x[0]=o[0]-s[0],x[1]=o[1]-s[1],x[2]=o[2]-s[2],Math.abs(x[0])<1e-6&&Math.abs(x[1])<1e-6&&Math.abs(x[2])<1e-6)return!1;const S=p[0]*_[0]+p[1]*_[1]+p[2]*_[2],C=_[0]*x[0]+_[1]*x[1]+_[2]*x[2],M=p[0]*x[0]+p[1]*x[1]+p[2]*x[2],P=_[0]*_[0]+_[1]*_[1]+_[2]*_[2],$=(x[0]*x[0]+x[1]*x[1]+x[2]*x[2])*P-C*C;if(Math.abs($)<1e-6)return!1;let F=(S*C-M*P)/$,z=(S+C*F)/P;i&&(F=Je(F,0,1),z=Je(z,0,1));const k=xt.get(),U=xt.get();return k[0]=s[0]+F*x[0],k[1]=s[1]+F*x[1],k[2]=s[2]+F*x[2],U[0]=a[0]+z*_[0],U[1]=a[1]+z*_[1],U[2]=a[2]+z*_[2],r.tA=F,r.tB=z,r.pA=k,r.pB=U,r.distance2=Ao(k,U),!0}const lU={tA:0,tB:0,pA:W(),pB:W(),distance2:0},sdt=new j_(()=>Ym()),nq=Ce.getLogger("esri.views.3d.support.geometryUtils.boundedPlane");let odt=class{constructor(){this.plane=Fi(),this.origin=W(),this.basis1=W(),this.basis2=W()}};const VRe=odt;function H_(t=KRe){return{plane:Fi(t.plane),origin:Xr(t.origin),basis1:Xr(t.basis1),basis2:Xr(t.basis2)}}function adt(t,e,i){const r=_dt.get();return r.origin=t,r.basis1=e,r.basis2=i,r.plane=vlt(0,0,0,0),xj(r),r}function AE(t,e=H_()){return sae(t.origin,t.basis1,t.basis2,e)}function ldt(t,e){Ne(e.origin,t.origin),Ne(e.basis1,t.basis1),Ne(e.basis2,t.basis2),gj(e.plane,t.plane)}function sae(t,e,i,r=H_()){return Ne(r.origin,t),Ne(r.basis1,e),Ne(r.basis2,i),xj(r),ydt(r,"fromValues()"),r}function xj(t){PL(t.basis2,t.basis1,t.origin,t.plane)}function BRe(t,e,i){t!==i&&AE(t,i);const r=De(xt.get(),A_(t),e);return Be(i.origin,i.origin,r),i.plane[3]-=e,i}function cdt(t,e,i){return jRe(e,i),BRe(i,cae(t,t.origin),i),i}function jRe(t,e=H_()){const i=(t[2]-t[0])/2,r=(t[3]-t[1])/2;return Ie(e.origin,t[0]+i,t[1]+r,0),Ie(e.basis1,i,0,0),Ie(e.basis2,0,r,0),Woe(0,0,1,0,e.plane),e}function oae(t,e,i){return!!CE(t.plane,e,i)&&ZRe(t,i)}function udt(t,e,i){if(oae(t,e,i))return i;const r=GRe(t,e,xt.get());return Be(i,e.origin,De(xt.get(),e.direction,Tn(e.origin,r)/nt(e.direction))),i}function GRe(t,e,i){const r=cU.get();JRe(t,e,r,cU.get());let n=Number.POSITIVE_INFINITY;for(const s of hae){const o=uae(t,s,Sj.get()),a=xt.get();if(wlt(r,o,a)){const c=k_(xt.get(),e.origin,a),p=Math.abs(Aa(Ve(e.direction,c)));pi&&(i=s)}return Math.sqrt(i)}function lae(t,e){return Xoe(t.plane,e)&&ZRe(t,e)}function pdt(t,e,i,r){return gdt(t,i,r)}function cae(t,e){const i=-t.plane[3];return S2(A_(t),e)-i}function fdt(t,e,i,r){const n=cae(t,e),s=De(vdt,A_(t),i-n);return Be(r,e,s),r}function YRe(t,e){return jr(t.basis1,e.basis1)&&jr(t.basis2,e.basis2)&&jr(t.origin,e.origin)}function XRe(t,e,i){return t!==i&&AE(t,i),Bo(QE,e),ud(QE,QE),bt(i.basis1,t.basis1,QE),bt(i.basis2,t.basis2,QE),bt(i.plane,t.plane,QE),bt(i.origin,t.origin,e),CQ(i.plane,i.plane,i.origin),i}function mdt(t,e,i,r){return t!==r&&AE(t,r),Ep(sq,e,i),bt(r.basis1,t.basis1,sq),bt(r.basis2,t.basis2,sq),xj(r),r}function A_(t){return t.plane}function gdt(t,e,i){switch(e){case Os.X:Ne(i,t.basis1),Ye(i,i);break;case Os.Y:Ne(i,t.basis2),Ye(i,i);break;case Os.Z:Ne(i,A_(t))}return i}function ZRe(t,e){const i=je(xt.get(),e,t.origin),r=Al(t.basis1),n=Al(t.basis2),s=Ve(t.basis1,i),o=Ve(t.basis2,i);return-s-r<0&&s-r<0&&-o-n<0&&o-n<0}function M0e(t,e){const i=Sj.get();return Ne(i.origin,t.origin),Ne(i.vector,e),i}function uae(t,e,i){const{basis1:r,basis2:n,origin:s}=t,o=De(xt.get(),r,e.origin[0]),a=De(xt.get(),n,e.origin[1]);Be(i.origin,o,a),Be(i.origin,i.origin,s);const c=De(xt.get(),r,e.direction[0]),p=De(xt.get(),n,e.direction[1]);return De(i.vector,Be(c,c,p),2),i}function ydt(t,e){Math.abs(Ve(t.basis1,t.basis2)/(nt(t.basis1)*nt(t.basis2)))>1e-6&&nq.warn(e,"Provided basis vectors are not perpendicular"),Math.abs(Ve(t.basis1,A_(t)))>1e-6&&nq.warn(e,"Basis vectors and plane normal are not perpendicular"),Math.abs(-Ve(A_(t),t.origin)-t.plane[3])>1e-6&&nq.warn(e,"Plane offset is not consistent with plane origin")}function JRe(t,e,i,r){const n=A_(t);PL(n,e.direction,e.origin,i),PL(i,n,e.origin,r)}const KRe={plane:Fi(),origin:st(0,0,0),basis1:st(1,0,0),basis2:st(0,1,0)},cU=new j_(Fi),Sj=new j_(Ym),vdt=W(),_dt=new j_(()=>H_()),hae=[{origin:[-1,-1],direction:[1,0]},{origin:[1,-1],direction:[0,1]},{origin:[1,1],direction:[-1,0]},{origin:[-1,1],direction:[0,-1]}],QE=Qe(),sq=Qe(),bdt=Object.freeze(Object.defineProperty({__proto__:null,BoundedPlaneClass:VRe,altitudeAt:cae,axisAt:pdt,closestPoint:HRe,closestPointOnSilhouette:GRe,copy:AE,copyWithoutVerify:ldt,create:H_,distance:hdt,distance2:aae,distanceToSilhouette:ddt,elevate:BRe,equals:YRe,extrusionContainsPoint:lae,fromAABoundingRect:jRe,fromValues:sae,intersectRay:oae,intersectRayClosestSilhouette:udt,normal:A_,projectPoint:qRe,projectPointLocal:WRe,rotate:mdt,setAltitudeAt:fdt,setExtent:cdt,transform:XRe,up:KRe,updateUnboundedPlane:xj,wrap:adt},Symbol.toStringTag,{value:"Module"}));function wdt(t){const{value:e,operations:i}=t;return{operations:i,value:i.create(e)}}function xdt(t,e,i){return t.operations.setExtent(t.value,e,i.value),i}function Sdt(t){return{operations:t,value:t.create()}}function QRe(t,e,i=Sdt(t)){return i.operations=t,t.copy(e,i.value),i}function Tdt(t){return QRe(flt,M5e(0,0,0,Tr(t).radius))}const O0e=2**50;function Edt(){return QRe(bdt,sae([0,0,0],[O0e,0,0],[0,O0e,0]))}function Cdt(t,e,i){return t.operations.axisAt(t.value,e,Os.Z,i)}function Adt(t,e,i,r){return t.operations.axisAt(t.value,e,i,r)}function Mdt(t,e,i){return t.operations.intersectRay(t.value,e,i)}function Odt(t,e,i){return t.operations.intersectRayClosestSilhouette(t.value,e,i)}function Pdt(t,e){return t.operations.altitudeAt(t.value,e)}function eIe(t,e,i,r){return t.operations.setAltitudeAt(t.value,e,i,r)}function Rdt(t,e,i,r){return e!==r&&Mo(r,e),Ie(eC,r[12],r[13],r[14]),eIe(t,eC,i,eC),r[12]=eC[0],r[13]=eC[1],r[14]=eC[2],r}function oq(t,e,i){return t.operations.elevate(t.value,e,i.value)}const eC=W();function P0e(t,e,i,r,n){return n[0]=Ve(t,e),n[1]=Ve(t,i),n[2]=Ve(t,r),n}function bee(t,e,i,r,n){Ne(i,t),Ne($D,e),Ye($D,$D),Wt(r,$D,i),Wt(n,r,i)}function Idt(t,e){return t?e0(e):e.isGeographic?rt.PlateCarree:e}const $D=W(),$dt="OBJECTID";let CP=class extends Q4{constructor(e){super(e),this.addHandles(this.on("before-add",i=>{i.item!=null&&i.item.parent===this.owner&&(Ce.getLogger(this).warn("Analysis inside the collection must be unique. Not adding this element again."),i.preventDefault())}))}_own(e){e.parent=this.owner}_release(e){e.parent=null}};CP=y([Z("esri.support.AnalysesCollection")],CP);const kF={widthBreakpoint:{getValue(t){const e=t.viewSize[0],i=t.breakpoints,r=this.values;return e<=i.xsmall?r.xsmall:e<=i.small?r.small:e<=i.medium?r.medium:e<=i.large?r.large:r.xlarge},values:{xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge"},valueToClassName:{xsmall:"esri-view-width-xsmall esri-view-width-less-than-small esri-view-width-less-than-medium esri-view-width-less-than-large esri-view-width-less-than-xlarge",small:"esri-view-width-small esri-view-width-greater-than-xsmall esri-view-width-less-than-medium esri-view-width-less-than-large esri-view-width-less-than-xlarge",medium:"esri-view-width-medium esri-view-width-greater-than-xsmall esri-view-width-greater-than-small esri-view-width-less-than-large esri-view-width-less-than-xlarge",large:"esri-view-width-large esri-view-width-greater-than-xsmall esri-view-width-greater-than-small esri-view-width-greater-than-medium esri-view-width-less-than-xlarge",xlarge:"esri-view-width-xlarge esri-view-width-greater-than-xsmall esri-view-width-greater-than-small esri-view-width-greater-than-medium esri-view-width-greater-than-large"}},heightBreakpoint:{getValue(t){const e=t.viewSize[1],i=t.breakpoints,r=this.values;return e<=i.xsmall?r.xsmall:e<=i.small?r.small:e<=i.medium?r.medium:e<=i.large?r.large:r.xlarge},values:{xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge"},valueToClassName:{xsmall:"esri-view-height-xsmall esri-view-height-less-than-small esri-view-height-less-than-medium esri-view-height-less-than-large esri-view-height-less-than-xlarge",small:"esri-view-height-small esri-view-height-greater-than-xsmall esri-view-height-less-than-medium esri-view-height-less-than-large esri-view-height-less-than-xlarge",medium:"esri-view-height-medium esri-view-height-greater-than-xsmall esri-view-height-greater-than-small esri-view-height-less-than-large esri-view-height-less-than-xlarge",large:"esri-view-height-large esri-view-height-greater-than-xsmall esri-view-height-greater-than-small esri-view-height-greater-than-medium esri-view-height-less-than-xlarge",xlarge:"esri-view-height-xlarge esri-view-height-greater-than-xsmall esri-view-height-greater-than-small esri-view-height-greater-than-medium esri-view-height-greater-than-large"}},orientation:{getValue(t){const e=t.viewSize,i=e[0],r=e[1],n=this.values;return r>=i?n.portrait:n.landscape},values:{portrait:"portrait",landscape:"landscape"},valueToClassName:{portrait:"esri-view-orientation-portrait",landscape:"esri-view-orientation-landscape"}}},aq={xsmall:544,small:768,medium:992,large:1200};function Ldt(t){const e=t;return e&&e.xsmall{let e=class extends t{constructor(...i){super(...i),this.orientation=null,this.widthBreakpoint=null,this.heightBreakpoint=null,this.breakpoints=aq}initialize(){this.addHandles(_e(()=>[this.breakpoints,this.size],()=>this._updateClassNames(),Qt))}destroy(){this.destroyed||this._removeActiveClassNames()}set breakpoints(i){if(i===this._get("breakpoints"))return;const r=Ldt(i);if(!r){const n=JSON.stringify(aq,null,2);console.warn("provided breakpoints are not valid, using defaults:"+n)}i=r?i:aq,this._set("breakpoints",{...i})}_updateClassNames(){if(!this.container)return;const i=jh.acquire(),r=jh.acquire();let n,s=!1;for(n in kF){const o=this[n],a=kF[n].getValue({viewSize:this.size,breakpoints:this.breakpoints});o!==a&&(s=!0,this[n]=a,lq(n,o).forEach(c=>r.push(c)),lq(n,a).forEach(c=>i.push(c)))}s&&(this._applyClassNameChanges(i,r),jh.release(i),jh.release(r))}_applyClassNameChanges(i,r){const n=this.container;n&&(r.forEach(s=>n.classList.remove(s)),i.forEach(s=>n.classList.add(s)))}_removeActiveClassNames(){const i=this.container;if(!i)return;let r;for(r in kF)lq(r,this[r]).forEach(n=>i.classList.remove(n))}};return y([w()],e.prototype,"breakpoints",null),y([w()],e.prototype,"orientation",void 0),y([w()],e.prototype,"widthBreakpoint",void 0),y([w()],e.prototype,"heightBreakpoint",void 0),e=y([Z("esri.views.BreakpointsOwner")],e),e};let Nf=class extends ze{constructor(){super(...arguments),this.updating=!1,this._handleId=0,this._scheduleHandleId=0,this._pendingPromises=new Set}destroy(){this.removeAll()}add(e,i,r={}){return this._installWatch(e,i,r,_e)}addWhen(e,i,r={}){return this._installWatch(e,i,r,Oo)}addOnCollectionChange(e,i,{initial:r=!1,final:n=!1}={}){const s=++this._handleId;return this.addHandles([Jr(e,"after-changes",this._createSyncUpdatingCallback(),Li),Jr(e,"change",i,{onListenerAdd:r?o=>i({added:o.toArray(),removed:[]}):void 0,onListenerRemove:n?o=>i({added:[],removed:o.toArray()}):void 0})],s),rr(()=>this.removeHandles(s))}addPromise(e){if(e==null)return e;const i=++this._handleId;this.addHandles(rr(()=>{this._pendingPromises.delete(e)&&(this._pendingPromises.size!==0||this.hasHandles(LD)||this._set("updating",!1))}),i),this._pendingPromises.add(e),this._set("updating",!0);const r=()=>this.removeHandles(i);return e.then(r,r),e}removeAll(){this._pendingPromises.clear(),this.removeAllHandles(),this._set("updating",!1)}_installWatch(e,i,r={},n){const s=++this._handleId;r.sync||this._installSyncUpdatingWatch(e,s);const o=n(e,i,r);return this.addHandles(o,s),rr(()=>this.removeHandles(s))}_installSyncUpdatingWatch(e,i){const r=this._createSyncUpdatingCallback(),n=_e(e,r,{sync:!0,equals:()=>!1});return this.addHandles(n,i),n}_createSyncUpdatingCallback(){return()=>{this.removeHandles(LD),++this._scheduleHandleId;const e=this._scheduleHandleId;this._get("updating")||this._set("updating",!0),this.addHandles(ox(()=>{e===this._scheduleHandleId&&(this._set("updating",this._pendingPromises.size>0),this.removeHandles(LD))}),LD)}}};y([w({readOnly:!0})],Nf.prototype,"updating",void 0),Nf=y([Z("esri.core.support.UpdatingHandles")],Nf);const LD=-42;/*! + * @esri/arcgis-html-sanitizer - v3.0.1 - Tue Nov 15 2022 09:46:54 GMT-0800 (Pacific Standard Time) + * Copyright (c) 2022 - Environmental Systems Research Institute, Inc. + * Apache-2.0 + * + * js-xss + * Copyright (c) 2012-2018 Zongmin Lei(雷宗民) + * http://ucdok.com + * MIT License, see https://github.com/leizongmin/js-xss/blob/master/LICENSE for details + */var Ndt=function(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);if(e===null)return!0;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},DS={exports:{}},ta={},$L={exports:{}},ME={};function tIe(){var t={};return t["align-content"]=!1,t["align-items"]=!1,t["align-self"]=!1,t["alignment-adjust"]=!1,t["alignment-baseline"]=!1,t.all=!1,t["anchor-point"]=!1,t.animation=!1,t["animation-delay"]=!1,t["animation-direction"]=!1,t["animation-duration"]=!1,t["animation-fill-mode"]=!1,t["animation-iteration-count"]=!1,t["animation-name"]=!1,t["animation-play-state"]=!1,t["animation-timing-function"]=!1,t.azimuth=!1,t["backface-visibility"]=!1,t.background=!0,t["background-attachment"]=!0,t["background-clip"]=!0,t["background-color"]=!0,t["background-image"]=!0,t["background-origin"]=!0,t["background-position"]=!0,t["background-repeat"]=!0,t["background-size"]=!0,t["baseline-shift"]=!1,t.binding=!1,t.bleed=!1,t["bookmark-label"]=!1,t["bookmark-level"]=!1,t["bookmark-state"]=!1,t.border=!0,t["border-bottom"]=!0,t["border-bottom-color"]=!0,t["border-bottom-left-radius"]=!0,t["border-bottom-right-radius"]=!0,t["border-bottom-style"]=!0,t["border-bottom-width"]=!0,t["border-collapse"]=!0,t["border-color"]=!0,t["border-image"]=!0,t["border-image-outset"]=!0,t["border-image-repeat"]=!0,t["border-image-slice"]=!0,t["border-image-source"]=!0,t["border-image-width"]=!0,t["border-left"]=!0,t["border-left-color"]=!0,t["border-left-style"]=!0,t["border-left-width"]=!0,t["border-radius"]=!0,t["border-right"]=!0,t["border-right-color"]=!0,t["border-right-style"]=!0,t["border-right-width"]=!0,t["border-spacing"]=!0,t["border-style"]=!0,t["border-top"]=!0,t["border-top-color"]=!0,t["border-top-left-radius"]=!0,t["border-top-right-radius"]=!0,t["border-top-style"]=!0,t["border-top-width"]=!0,t["border-width"]=!0,t.bottom=!1,t["box-decoration-break"]=!0,t["box-shadow"]=!0,t["box-sizing"]=!0,t["box-snap"]=!0,t["box-suppress"]=!0,t["break-after"]=!0,t["break-before"]=!0,t["break-inside"]=!0,t["caption-side"]=!1,t.chains=!1,t.clear=!0,t.clip=!1,t["clip-path"]=!1,t["clip-rule"]=!1,t.color=!0,t["color-interpolation-filters"]=!0,t["column-count"]=!1,t["column-fill"]=!1,t["column-gap"]=!1,t["column-rule"]=!1,t["column-rule-color"]=!1,t["column-rule-style"]=!1,t["column-rule-width"]=!1,t["column-span"]=!1,t["column-width"]=!1,t.columns=!1,t.contain=!1,t.content=!1,t["counter-increment"]=!1,t["counter-reset"]=!1,t["counter-set"]=!1,t.crop=!1,t.cue=!1,t["cue-after"]=!1,t["cue-before"]=!1,t.cursor=!1,t.direction=!1,t.display=!0,t["display-inside"]=!0,t["display-list"]=!0,t["display-outside"]=!0,t["dominant-baseline"]=!1,t.elevation=!1,t["empty-cells"]=!1,t.filter=!1,t.flex=!1,t["flex-basis"]=!1,t["flex-direction"]=!1,t["flex-flow"]=!1,t["flex-grow"]=!1,t["flex-shrink"]=!1,t["flex-wrap"]=!1,t.float=!1,t["float-offset"]=!1,t["flood-color"]=!1,t["flood-opacity"]=!1,t["flow-from"]=!1,t["flow-into"]=!1,t.font=!0,t["font-family"]=!0,t["font-feature-settings"]=!0,t["font-kerning"]=!0,t["font-language-override"]=!0,t["font-size"]=!0,t["font-size-adjust"]=!0,t["font-stretch"]=!0,t["font-style"]=!0,t["font-synthesis"]=!0,t["font-variant"]=!0,t["font-variant-alternates"]=!0,t["font-variant-caps"]=!0,t["font-variant-east-asian"]=!0,t["font-variant-ligatures"]=!0,t["font-variant-numeric"]=!0,t["font-variant-position"]=!0,t["font-weight"]=!0,t.grid=!1,t["grid-area"]=!1,t["grid-auto-columns"]=!1,t["grid-auto-flow"]=!1,t["grid-auto-rows"]=!1,t["grid-column"]=!1,t["grid-column-end"]=!1,t["grid-column-start"]=!1,t["grid-row"]=!1,t["grid-row-end"]=!1,t["grid-row-start"]=!1,t["grid-template"]=!1,t["grid-template-areas"]=!1,t["grid-template-columns"]=!1,t["grid-template-rows"]=!1,t["hanging-punctuation"]=!1,t.height=!0,t.hyphens=!1,t.icon=!1,t["image-orientation"]=!1,t["image-resolution"]=!1,t["ime-mode"]=!1,t["initial-letters"]=!1,t["inline-box-align"]=!1,t["justify-content"]=!1,t["justify-items"]=!1,t["justify-self"]=!1,t.left=!1,t["letter-spacing"]=!0,t["lighting-color"]=!0,t["line-box-contain"]=!1,t["line-break"]=!1,t["line-grid"]=!1,t["line-height"]=!1,t["line-snap"]=!1,t["line-stacking"]=!1,t["line-stacking-ruby"]=!1,t["line-stacking-shift"]=!1,t["line-stacking-strategy"]=!1,t["list-style"]=!0,t["list-style-image"]=!0,t["list-style-position"]=!0,t["list-style-type"]=!0,t.margin=!0,t["margin-bottom"]=!0,t["margin-left"]=!0,t["margin-right"]=!0,t["margin-top"]=!0,t["marker-offset"]=!1,t["marker-side"]=!1,t.marks=!1,t.mask=!1,t["mask-box"]=!1,t["mask-box-outset"]=!1,t["mask-box-repeat"]=!1,t["mask-box-slice"]=!1,t["mask-box-source"]=!1,t["mask-box-width"]=!1,t["mask-clip"]=!1,t["mask-image"]=!1,t["mask-origin"]=!1,t["mask-position"]=!1,t["mask-repeat"]=!1,t["mask-size"]=!1,t["mask-source-type"]=!1,t["mask-type"]=!1,t["max-height"]=!0,t["max-lines"]=!1,t["max-width"]=!0,t["min-height"]=!0,t["min-width"]=!0,t["move-to"]=!1,t["nav-down"]=!1,t["nav-index"]=!1,t["nav-left"]=!1,t["nav-right"]=!1,t["nav-up"]=!1,t["object-fit"]=!1,t["object-position"]=!1,t.opacity=!1,t.order=!1,t.orphans=!1,t.outline=!1,t["outline-color"]=!1,t["outline-offset"]=!1,t["outline-style"]=!1,t["outline-width"]=!1,t.overflow=!1,t["overflow-wrap"]=!1,t["overflow-x"]=!1,t["overflow-y"]=!1,t.padding=!0,t["padding-bottom"]=!0,t["padding-left"]=!0,t["padding-right"]=!0,t["padding-top"]=!0,t.page=!1,t["page-break-after"]=!1,t["page-break-before"]=!1,t["page-break-inside"]=!1,t["page-policy"]=!1,t.pause=!1,t["pause-after"]=!1,t["pause-before"]=!1,t.perspective=!1,t["perspective-origin"]=!1,t.pitch=!1,t["pitch-range"]=!1,t["play-during"]=!1,t.position=!1,t["presentation-level"]=!1,t.quotes=!1,t["region-fragment"]=!1,t.resize=!1,t.rest=!1,t["rest-after"]=!1,t["rest-before"]=!1,t.richness=!1,t.right=!1,t.rotation=!1,t["rotation-point"]=!1,t["ruby-align"]=!1,t["ruby-merge"]=!1,t["ruby-position"]=!1,t["shape-image-threshold"]=!1,t["shape-outside"]=!1,t["shape-margin"]=!1,t.size=!1,t.speak=!1,t["speak-as"]=!1,t["speak-header"]=!1,t["speak-numeral"]=!1,t["speak-punctuation"]=!1,t["speech-rate"]=!1,t.stress=!1,t["string-set"]=!1,t["tab-size"]=!1,t["table-layout"]=!1,t["text-align"]=!0,t["text-align-last"]=!0,t["text-combine-upright"]=!0,t["text-decoration"]=!0,t["text-decoration-color"]=!0,t["text-decoration-line"]=!0,t["text-decoration-skip"]=!0,t["text-decoration-style"]=!0,t["text-emphasis"]=!0,t["text-emphasis-color"]=!0,t["text-emphasis-position"]=!0,t["text-emphasis-style"]=!0,t["text-height"]=!0,t["text-indent"]=!0,t["text-justify"]=!0,t["text-orientation"]=!0,t["text-overflow"]=!0,t["text-shadow"]=!0,t["text-space-collapse"]=!0,t["text-transform"]=!0,t["text-underline-position"]=!0,t["text-wrap"]=!0,t.top=!1,t.transform=!1,t["transform-origin"]=!1,t["transform-style"]=!1,t.transition=!1,t["transition-delay"]=!1,t["transition-duration"]=!1,t["transition-property"]=!1,t["transition-timing-function"]=!1,t["unicode-bidi"]=!1,t["vertical-align"]=!1,t.visibility=!1,t["voice-balance"]=!1,t["voice-duration"]=!1,t["voice-family"]=!1,t["voice-pitch"]=!1,t["voice-range"]=!1,t["voice-rate"]=!1,t["voice-stress"]=!1,t["voice-volume"]=!1,t.volume=!1,t["white-space"]=!1,t.widows=!1,t.width=!0,t["will-change"]=!1,t["word-break"]=!0,t["word-spacing"]=!0,t["word-wrap"]=!0,t["wrap-flow"]=!1,t["wrap-through"]=!1,t["writing-mode"]=!1,t["z-index"]=!1,t}function Fdt(t,e,i){}function kdt(t,e,i){}var zdt=/javascript\s*\:/img;function Udt(t,e){return zdt.test(e)?"":e}ME.whiteList=tIe();ME.getDefaultWhiteList=tIe;ME.onAttr=Fdt;ME.onIgnoreAttr=kdt;ME.safeAttrValue=Udt;var Vdt={indexOf:function(t,e){var i,r;if(Array.prototype.indexOf)return t.indexOf(e);for(i=0,r=t.length;i/g,ipt=/"/g,rpt=/"/g,npt=/&#([a-zA-Z0-9]*);?/gim,spt=/:?/gim,opt=/&newline;?/gim,ND=/((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi,I0e=/e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi,$0e=/u\s*r\s*l\s*\(.*/gi;function oIe(t){return t.replace(ipt,""")}function aIe(t){return t.replace(rpt,'"')}function lIe(t){return t.replace(npt,function(i,r){return r[0]==="x"||r[0]==="X"?String.fromCharCode(parseInt(r.substr(1),16)):String.fromCharCode(parseInt(r,10))})}function cIe(t){return t.replace(spt,":").replace(opt," ")}function uIe(t){for(var e="",i=0,r=t.length;i",r);if(n===-1)break;i=n+3}return e}function upt(t){var e=t.split("");return e=e.filter(function(i){var r=i.charCodeAt(0);return r===127?!1:r<=31?r===10||r===13:!0}),e.join("")}ta.whiteList=rIe();ta.getDefaultWhiteList=rIe;ta.onTag=Xdt;ta.onIgnoreTag=Zdt;ta.onTagAttr=Jdt;ta.onIgnoreTagAttr=Kdt;ta.safeAttrValue=Qdt;ta.escapeHtml=sIe;ta.escapeQuote=oIe;ta.unescapeQuote=aIe;ta.escapeHtmlEntities=lIe;ta.escapeDangerHtml5Entities=cIe;ta.clearNonPrintableCharacter=uIe;ta.friendlyAttrValue=hIe;ta.escapeAttrValue=dIe;ta.onIgnoreTagStripAll=apt;ta.StripTagBody=lpt;ta.stripCommentTag=cpt;ta.stripBlankChar=upt;ta.cssFilter=nIe;ta.getDefaultCSSWhiteList=Ydt;var Tj={},kw=dae;function hpt(t){var e=kw.spaceIndex(t),i;return e===-1?i=t.slice(1,-1):i=t.slice(1,e+1),i=kw.trim(i).toLowerCase(),i.slice(0,1)==="/"&&(i=i.slice(1)),i.slice(-1)==="/"&&(i=i.slice(0,-1)),i}function dpt(t){return t.slice(0,2)===""){r+=i(t.slice(n,s)),_=t.slice(s,a+1),p=hpt(_),r+=e(s,r.length,p,_,dpt(_)),n=a+1,s=!1;continue}if(x==='"'||x==="'")for(var S=1,C=t.charAt(a-S);C.trim()===""||C==="=";){if(C==="="){o=x;continue e}C=t.charAt(a-++S)}}else if(x===o){o=!1;continue}}return n0;e--){var i=t[e];if(i!==" ")return i==="="?e:-1}}function _pt(t){return t[0]==='"'&&t[t.length-1]==='"'||t[0]==="'"&&t[t.length-1]==="'"}function L0e(t){return _pt(t)?t.substr(1,t.length-2):t}Tj.parseTag=ppt;Tj.parseAttr=mpt;var bpt=$L.exports.FilterCSS,rm=ta,pIe=Tj,wpt=pIe.parseTag,xpt=pIe.parseAttr,zF=dae;function FD(t){return t==null}function Spt(t){var e=zF.spaceIndex(t);if(e===-1)return{html:"",closing:t[t.length-2]==="/"};t=zF.trim(t.slice(e+1,-1));var i=t[t.length-1]==="/";return i&&(t=zF.trim(t.slice(0,-1))),{html:t,closing:i}}function Tpt(t){var e={};for(var i in t)e[i]=t[i];return e}function Ept(t){var e={};for(var i in t)Array.isArray(t[i])?e[i.toLowerCase()]=t[i].map(function(r){return r.toLowerCase()}):e[i.toLowerCase()]=t[i];return e}function fIe(t){t=Tpt(t||{}),t.stripIgnoreTag&&(t.onIgnoreTag&&console.error('Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'),t.onIgnoreTag=rm.onIgnoreTagStripAll),t.whiteList||t.allowList?t.whiteList=Ept(t.whiteList||t.allowList):t.whiteList=rm.whiteList,t.onTag=t.onTag||rm.onTag,t.onTagAttr=t.onTagAttr||rm.onTagAttr,t.onIgnoreTag=t.onIgnoreTag||rm.onIgnoreTag,t.onIgnoreTagAttr=t.onIgnoreTagAttr||rm.onIgnoreTagAttr,t.safeAttrValue=t.safeAttrValue||rm.safeAttrValue,t.escapeHtml=t.escapeHtml||rm.escapeHtml,this.options=t,t.css===!1?this.cssFilter=!1:(t.css=t.css||{},this.cssFilter=new bpt(t.css))}fIe.prototype.process=function(t){if(t=t||"",t=t.toString(),!t)return"";var e=this,i=e.options,r=i.whiteList,n=i.onTag,s=i.onIgnoreTag,o=i.onTagAttr,a=i.onIgnoreTagAttr,c=i.safeAttrValue,p=i.escapeHtml,_=e.cssFilter;i.stripBlankChar&&(t=rm.stripBlankChar(t)),i.allowCommentTag||(t=rm.stripCommentTag(t));var x=!1;i.stripIgnoreTagBody&&(x=rm.StripTagBody(i.stripIgnoreTagBody,s),s=x.onIgnoreTag);var S=wpt(t,function(C,M,P,$,F){var z={sourcePosition:C,position:M,isClosing:F,isWhite:Object.prototype.hasOwnProperty.call(r,P)},k=n(P,$,z);if(!FD(k))return k;if(z.isWhite){if(z.isClosing)return"";var U=Spt($),j=r[P],G=xpt(U.html,function(Y,Q){var ne=zF.indexOf(j,Y)!==-1,ie=o(P,Y,Q,ne);return FD(ie)?ne?(Q=c(P,Y,Q,_),Q?Y+'="'+Q+'"':Y):(ie=a(P,Y,Q,ne),FD(ie)?void 0:ie):ie});return $="<"+P,G&&($+=" "+G),U.closing&&($+=" /"),$+=">",$}else return k=s(P,$,z),FD(k)?p($):k},p);return x&&(S=x.remove(S)),S};var Cpt=fIe;(function(t,e){var i=ta,r=Tj,n=Cpt;function s(a,c){var p=new n(c);return p.process(a)}e=t.exports=s,e.filterXSS=s,e.FilterXSS=n,function(){for(var a in i)e[a]=i[a];for(var c in r)e[c]=r[c]}();function o(){return typeof self<"u"&&typeof DedicatedWorkerGlobalScope<"u"&&self instanceof DedicatedWorkerGlobalScope}o()&&(self.filterXSS=t.exports)})(DS,DS.exports);var Apt=function(){function t(e,i){var r=this;this.arcgisWhiteList={a:["href","style","target"],abbr:["title"],audio:["autoplay","controls","loop","muted","preload"],b:[],br:[],dd:["style"],div:["align","style"],dl:["style"],dt:["style"],em:[],figcaption:["style"],figure:["style"],font:["color","face","size","style"],h1:["style"],h2:["style"],h3:["style"],h4:["style"],h5:["style"],h6:["style"],hr:[],i:[],img:["alt","border","height","src","style","width"],li:[],ol:[],p:["style"],source:["media","src","type"],span:["style"],strong:[],sub:["style"],sup:["style"],table:["border","cellpadding","cellspacing","height","style","width"],tbody:[],tr:["align","height","style","valign"],td:["align","colspan","height","nowrap","rowspan","style","valign","width"],th:["align","colspan","height","nowrap","rowspan","style","valign","width"],u:[],ul:[],video:["autoplay","controls","height","loop","muted","poster","preload","width"]},this.allowedProtocols=["http","https","mailto","iform","tel","flow","lfmobile","arcgis-navigator","arcgis-appstudio-player","arcgis-survey123","arcgis-collector","arcgis-workforce","arcgis-explorer","arcgis-trek2there","arcgis-quickcapture","mspbi","comgooglemaps","pdfefile","pdfehttp","pdfehttps","boxapp","boxemm","awb","awbs","gropen","radarscope"],this.arcgisFilterOptions={allowCommentTag:!0,safeAttrValue:function(s,o,a,c){return s==="a"&&o==="href"||(s==="img"||s==="source")&&o==="src"?r.sanitizeUrl(a):DS.exports.safeAttrValue(s,o,a,c)}},this._entityMap={"&":"8","<":"<",">":">",'"':""","'":"'","/":"/"};var n;e&&!i?n=e:e&&i?(n=Object.create(this.arcgisFilterOptions),Object.keys(e).forEach(function(s){s==="whiteList"?n.whiteList=r._extendObjectOfArrays([r.arcgisWhiteList,e.whiteList||{}]):n[s]=e[s]})):(n=Object.create(this.arcgisFilterOptions),n.whiteList=this.arcgisWhiteList),this.xssFilterOptions=n,this._xssFilter=new DS.exports.FilterXSS(n)}return t.prototype.sanitize=function(e,i){switch(i===void 0&&(i={}),typeof e){case"number":return isNaN(e)||!isFinite(e)?null:e;case"boolean":return e;case"string":return this._xssFilter.process(e);case"object":return this._iterateOverObject(e,i);default:return i.allowUndefined&&typeof e>"u"?void 0:null}},t.prototype.sanitizeUrl=function(e,i){var r=(i??{}).isProtocolRequired,n=r===void 0?!0:r,s=this._trim(e.substring(0,e.indexOf(":"))),o=e==="/",a=/^#/.test(e),c=s&&this.allowedProtocols.indexOf(s.toLowerCase())>-1;return o||a||c?DS.exports.escapeAttrValue(e):!s&&!n?DS.exports.escapeAttrValue("https://".concat(e)):""},t.prototype.sanitizeHTMLAttribute=function(e,i,r,n){return typeof this.xssFilterOptions.safeAttrValue=="function"?this.xssFilterOptions.safeAttrValue(e,i,r,n):DS.exports.safeAttrValue(e,i,r,n)},t.prototype.validate=function(e,i){i===void 0&&(i={});var r=this.sanitize(e,i);return{isValid:e===r,sanitized:r}},t.prototype.encodeHTML=function(e){var i=this;return String(e).replace(/[&<>"'\/]/g,function(r){return i._entityMap[r]})},t.prototype.encodeAttrValue=function(e){var i=/^[a-zA-Z0-9]$/;return String(e).replace(/[\x00-\xFF]/g,function(r,n){return i.test(r)?r:"&#x".concat(Number(e.charCodeAt(n)).toString(16),";")})},t.prototype._extendObjectOfArrays=function(e){var i={};return e.forEach(function(r){Object.keys(r).forEach(function(n){Array.isArray(r[n])&&Array.isArray(i[n])?i[n]=i[n].concat(r[n]):i[n]=r[n]})}),i},t.prototype._iterateOverObject=function(e,i){var r=this;i===void 0&&(i={});try{var n=!1,s=void 0;if(Array.isArray(e))s=e.reduce(function(a,c){var p=r.validate(c,i);return p.isValid?a.concat([c]):(n=!0,a.concat([p.sanitized]))},[]);else if(Ndt(e)){var o=Object.keys(e);s=o.reduce(function(a,c){var p=e[c],_=r.validate(p,i);return _.isValid?a[c]=p:(n=!0,a[c]=_.sanitized),a},{})}else return i.allowUndefined&&typeof e>"u"?void 0:null;return n?s:e}catch{return null}},t.prototype._trim=function(e){return String.prototype.trim?e.trim():e.replace(/(^\s*)|(\s*$)/g,"")},t}();const Ej=new Map;function mIe(){Ej.clear()}function Mpt(t){return Ej.get(t)}function Opt(t,e){Ej.set(t,e)}function cq(t){Ej.delete(t)}const Ppt=Ce.getLogger("esri.widgets.support.widgetUtils");function rT(t){const e=jh.acquire();for(let r=0;r{const t=new Map,e=new ResizeObserver(r=>{var n;mIe();for(const s of r)(n=t.get(s.target))==null||n(s)}),i=(r,n,s)=>(t.has(r)&&Ppt.error("Already observing element",r),t.set(r,n),e.observe(r,s),rr(()=>{e.unobserve(r),t.delete(r)}));return(r,n,s)=>{let o=null;return sd([_e(()=>typeof r=="function"?r():r,a=>{o==null||o.remove(),a&&(o=i(a,n,s))},kt),rr(()=>o==null?void 0:o.remove())])}})();function ZT(t){const e=t==null?void 0:t.closest("[dir]");return e!==null&&e instanceof HTMLElement&&e.dir==="rtl"||document.dir==="rtl"}function Rpt(t){return ZT(t)?"rtl":"ltr"}function Nti(t){const e="data-node-ref";this[t.getAttribute(e)]=null}function Jv(t){const e="data-node-ref";this[t.getAttribute(e)]=t}const Ipt=["dd","dl","dt","h1","h2","h3","h4","h5","h6","sub","sup","animate","animatetransform","circle","clippath","defs","ellipse","g","image","line","lineargradient","marker","mask","path","pattern","polygon","polyline","radialgradient","rect","stop","svg","switch","symbol","text","textpath","tspan","use"],$pt=Ipt.reduce((t,e)=>(t[e]=[],t),{}),Lpt=["align","alink","alt","bgcolor","border","cellpadding","cellspacing","class","color","cols","colspan","coords","d","dir","face","height","hspace","ismap","lang","marginheight","marginwidth","multiple","nohref","noresize","noshade","nowrap","ref","rel","rev","rows","rowspan","scrolling","shape","span","summary","tabindex","title","usemap","valign","value","vlink","vspace","width"],gIe=new Apt({whiteList:$pt,onTagAttr:(t,e,i)=>{const r=`${e}="${i}"`;if(Lpt.includes(e))return r},stripIgnoreTag:!0,stripIgnoreTagBody:["script","style"]},!0);function Dpt(t,e){const i=t.getBoundingClientRect(),r=e.getBoundingClientRect(),n=i.top+i.height,s=r.top+r.height,o=i.top,a=r.top;(n>s||o{let i={};return Object.keys(t).forEach(r=>{i[r]=t[r]}),e&&Object.keys(e).forEach(r=>{i[r]=e[r]}),i},fae=(t,e)=>t.vnodeSelector===e.vnodeSelector&&(t.properties&&e.properties?t.properties.key===e.properties.key&&t.properties.bind===e.properties.bind:!t.properties&&!e.properties),_Ie=t=>{if(typeof t!="string")throw new Error("Style values must be strings")},Npt=(t,e,i)=>{if(e.vnodeSelector!==""){for(let r=i;r{let n=t[e];if(n.vnodeSelector==="")return;let s=n.properties;if(!(s&&(s.key===void 0?s.bind:s.key))){for(let o=0;o{if(t.properties){let e=t.properties.enterAnimation;e&&e(t.domNode,t.properties)}},wee=[],xee=!1,bIe=t=>{(t.children||[]).forEach(bIe),t.properties&&t.properties.afterRemoved&&t.properties.afterRemoved.apply(t.properties.bind||t.properties,[t.domNode])},N0e=()=>{xee=!1,wee.forEach(bIe),wee.length=0},F0e=t=>{wee.push(t),xee||(xee=!0,typeof window<"u"&&"requestIdleCallback"in window?window.requestIdleCallback(N0e,{timeout:16}):setTimeout(N0e,16))},k0e=t=>{let e=t.domNode;if(t.properties){let i=t.properties.exitAnimation;if(i)return e.style.pointerEvents="none",void i(e,()=>{e.parentNode&&(e.parentNode.removeChild(e),F0e(t))},t.properties)}e.parentNode&&(e.parentNode.removeChild(e),F0e(t))},kpt=(t,e,i)=>{if(!e)return;let r=i.eventHandlerInterceptor,n=Object.keys(e),s=n.length;for(let o=0;o{if(e)for(let r of e)FM(r,t,void 0,i)},wIe=(t,e,i)=>{zpt(t,e.children,i),e.text&&(t.textContent=e.text),kpt(t,e.properties,i),e.properties&&e.properties.afterCreate&&e.properties.afterCreate.apply(e.properties.bind||e.properties,[t,i,e.vnodeSelector,e.properties,e.children])},FM=(t,e,i,r)=>{let n,s=0,o=t.vnodeSelector,a=e.ownerDocument;if(o==="")n=t.domNode=a.createTextNode(t.text),i!==void 0?e.insertBefore(n,i):e.appendChild(n);else{for(let c=0;c<=o.length;++c){let p=o.charAt(c);if(c===o.length||p==="."||p==="#"){let _=o.charAt(s-1),x=o.slice(s,c);_==="."?n.classList.add(x):_==="#"?n.id=x:(x==="svg"&&(r=pae(r,{namespace:Aj})),r.namespace!==void 0?n=t.domNode=a.createElementNS(r.namespace,x):(n=t.domNode=t.domNode||a.createElement(x),x==="input"&&t.properties&&t.properties.type!==void 0&&n.setAttribute("type",t.properties.type)),i!==void 0?e.insertBefore(n,i):n.parentNode!==e&&e.appendChild(n)),s=c+1}}wIe(n,t,r)}},Tee=(t,e,i)=>{e&&e.split(" ").forEach(r=>{r&&t.classList.toggle(r,i)})},Upt=(t,e,i,r)=>{if(!i)return;let n=!1,s=Object.keys(i),o=s.length;for(let a=0;a{if(i===r)return!1;r=r||D0e;let s,o=(i=i||D0e).length,a=r.length,c=0,p=0,_=!1;for(;p=0){for(s=c;sc)for(s=c;s{let r=t.domNode,n=!1;if(t===e)return!1;let s=!1;if(e.vnodeSelector===""){if(e.text!==t.text){let o=r.ownerDocument.createTextNode(e.text);return r.parentNode.replaceChild(o,r),e.domNode=o,n=!0,n}e.domNode=r}else e.vnodeSelector.lastIndexOf("svg",0)===0&&(i=pae(i,{namespace:Aj})),t.text!==e.text&&(s=!0,e.text===void 0?r.removeChild(r.firstChild):r.textContent=e.text),e.domNode=r,s=Vpt(e,r,t.children,e.children,i)||s,s=Upt(r,t.properties,e.properties,i)||s,e.properties&&e.properties.afterUpdate&&e.properties.afterUpdate.apply(e.properties.bind||e.properties,[r,i,e.vnodeSelector,e.properties,e.children]);return s&&e.properties&&e.properties.updateAnimation&&e.properties.updateAnimation(r,e.properties,t.properties),n};let hR=(t,e)=>({getLastRender:()=>t,update:i=>{if(t.vnodeSelector!==i.vnodeSelector)throw new Error("The selector for the root VNode may not be changed. (consider using dom.merge and add one extra level to the virtual DOM)");let r=t;t=i,hU(r,i,e)},domNode:t.domNode});const Bpt={namespace:void 0,performanceLogger:()=>{},eventHandlerInterceptor:void 0,styleApplyer:(t,e,i)=>{e.charAt(0)==="-"?t.style.setProperty(e,i):t.style[e]=i}};let zA=t=>pae(Bpt,t),f2={create:(t,e)=>(e=zA(e),FM(t,document.createElement("div"),void 0,e),hR(t,e)),append:(t,e,i)=>(i=zA(i),FM(e,t,void 0,i),hR(e,i)),insertBefore:(t,e,i)=>(i=zA(i),FM(e,t.parentNode,t,i),hR(e,i)),merge:(t,e,i)=>(i=zA(i),e.domNode=t,wIe(t,e,i),hR(e,i)),replace:(t,e,i)=>(i=zA(i),FM(e,t.parentNode,t,i),t.parentNode.removeChild(t),hR(e,i))},xIe,jpt=(t,e)=>{let i=[];for(;t&&t!==e;)i.push(t),t=t.parentNode;return i};xIe=Array.prototype.find?(t,e)=>t.find(e):(t,e)=>t.filter(e)[0];let Gpt=(t,e)=>{let i=t;return e.forEach(r=>{i=i&&i.children?xIe(i.children,n=>n.domNode===r):void 0}),i},Hpt=(t,e,i)=>{let r=function(n){i("domEvent",n);let s=e(),o=jpt(n.currentTarget,s.domNode);o.reverse();let a,c=Gpt(s.getLastRender(),o);return t.scheduleRender(),c&&(a=c.properties[`on${n.type}`].apply(c.properties.bind||this,arguments)),i("domEventProcessed",n),a};return(n,s,o,a)=>r},dU=t=>{let e,i,r=zA(t),n=r.performanceLogger,s=!0,o=!1,a=[],c=[],p=(x,S,C)=>{let M,P=()=>M;r.eventHandlerInterceptor=Hpt(e,P,n),M=x(S,C(),r),a.push(M),c.push(C)},_=()=>{if(i=void 0,s){s=!1,n("renderStart",void 0);for(let x=0;x{i||o||(i=requestAnimationFrame(_))},stop:()=>{i&&(cancelAnimationFrame(i),i=void 0),o=!0},resume:()=>{o=!1,s=!0,e.scheduleRender()},append:(x,S)=>{p(f2.append,x,S)},insertBefore:(x,S)=>{p(f2.insertBefore,x,S)},merge:(x,S)=>{p(f2.merge,x,S)},replace:(x,S)=>{p(f2.replace,x,S)},detach:x=>{for(let S=0;S0}get updating(){var e;return((e=this._watchUpdatingTracking)==null?void 0:e.updating)??!1}initialize(){const e=document.createElement("div");e.className="esri-overlay-surface",this._set("surface",e),this._hiddenSurface=document.createElement("div"),this._hiddenSurface.setAttribute("style","visibility: hidden;"),e.appendChild(this._hiddenSurface),this._watchUpdatingTracking.addOnCollectionChange(()=>this.items,i=>{for(const r of i.added){const n=()=>r.render();this._callbacks.set(r,n),this._projector.append(this.surface,n)}for(const r of i.removed){const n=this._projector.detach(this._callbacks.get(r));this.surface.removeChild(n.domNode),this._callbacks.delete(r)}})}addItem(e){this.items.add(e)}removeItem(e){this.items.remove(e)}destroy(){this.items.removeAll(),this._callbacks.forEach(e=>this._projector.detach(e)),this._callbacks=null,this._projector=null,this._watchUpdatingTracking.destroy()}render(){this._projector.renderNow()}computeBoundingRect(e){const i=this._hiddenSurface,r=this._hiddenProjector;let n;const s=()=>(n=e.render(),n);r.append(i,s),r.renderNow();const o={left:0,top:0,right:0,bottom:0};if(n!=null&&n.domNode){const a=n.domNode.getBoundingClientRect();o.left=a.left,o.top=a.top,o.right=a.right,o.bottom=a.bottom}for(r.detach(s);i.firstChild;)i.removeChild(i.firstChild);return o}overlaps(e,i){const r=this.computeBoundingRect(e),n=this.computeBoundingRect(i);return Math.max(r.left,n.left)<=Math.min(r.right,n.right)&&Math.max(r.top,n.top)<=Math.min(r.bottom,n.bottom)}get hasVisibleItems(){return this.items.some(e=>e.visible)}async prepare(){await document.fonts.load(this._fontString()).catch(()=>{})}renderCanvas(e,i){const r=!!(i!=null&&i.disableDecorations);if(!this.items.some(s=>s.visible&&!(r&&s.isDecoration)))return;const n=e.getContext("2d");n.save(),n.font=this._fontString(),this.items.forEach(s=>{r&&s.isDecoration||(n.save(),s.renderCanvas(n),n.restore())}),n.restore()}_fontString(){return`10px ${getComputedStyle(this.surface).fontFamily}`}};y([w({readOnly:!0})],cw.prototype,"surface",void 0),y([w({readOnly:!0})],cw.prototype,"items",void 0),y([w({readOnly:!0})],cw.prototype,"needsRender",null),y([w({readOnly:!0})],cw.prototype,"_watchUpdatingTracking",void 0),y([w({readOnly:!0})],cw.prototype,"updating",null),cw=y([Z("esri.views.overlay.ViewOverlay")],cw);const z0e=cw,hq=[0,0];function qpt(t){const e=(t.ownerDocument||window.document).defaultView,i=t.getBoundingClientRect();return hq[0]=i.left+((e==null?void 0:e.pageXOffset)??0),hq[1]=i.top+((e==null?void 0:e.pageYOffset)??0),hq}function U0e(t){t&&(LRe(t),t.parentNode&&t.parentNode.removeChild(t))}function Wpt(t){const e=document.createElement("div");return t.appendChild(e),e}const dR=16,kD=750,Ypt=512,Xpt=2,Zpt=t=>{let e=class extends t{constructor(...i){super(...i),this._freqInfo={freq:dR,time:kD},this._overlayRenderTaskHandle=null,this.height=0,this.messagesCommon=null,this.overlay=null,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.ui=null,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.addHandles([_e(()=>this.cursor,r=>{const{surface:n}=this;n&&n.setAttribute("data-cursor",r)}),_e(()=>this.navigating,r=>{const{surface:n}=this;n&&n.setAttribute("data-navigating",r.toString())})])}initialize(){const i=$e("mac"),r=async()=>{i&&(await dd(()=>this.ready),this.messagesCommon=await gE("esri/t9n/common").catch(()=>{}))};r(),this.addHandles([_e(()=>this.ui,(n,s)=>this._handleUIChange(n,s),Qt),this.on("focus",()=>this.notifyChange("focused")),this.on("blur",()=>this.notifyChange("focused")),fE(r)])}destroy(){this.destroyed||(this.ui=et(this.ui),this.container=null)}get container(){return this._get("container")??null}set container(i){const r=this._get("container"),n=W9(i);if(n||typeof i!="string"||Ce.getLogger(this).error("#container",`element with id '${i}' not found`),r===n)return;if(this._stopMeasuring(),r&&(r.classList.remove("esri-view"),this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay&&(this.overlay.destroy(),this._set("overlay",null)),this.root&&(U0e(this.root),this._set("root",null)),this.userContent&&(y0e(this.userContent,r),U0e(this.userContent),this._set("userContent",null))),!n)return this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),void this._set("container",null);n.classList.add("esri-view");const s=document.createElement("div");s.className="esri-view-user-storage",y0e(n,s),n.appendChild(s),this._set("userContent",s);const o=document.createElement("div");o.className="esri-view-root",n.insertBefore(o,n.firstChild),this._set("root",o);const a=document.createElement("div");a.className="esri-view-surface",a.setAttribute("role","application"),a.tabIndex=0,o.appendChild(a),this._set("surface",a);const c=new z0e;o.appendChild(c.surface),this._set("overlay",c),this.addHandles(_e(()=>c.needsRender,p=>{p&&!this._overlayRenderTaskHandle?this._overlayRenderTaskHandle=LT({render:()=>{var _;return(_=this.overlay)==null?void 0:_.render()}}):this._overlayRenderTaskHandle=en(this._overlayRenderTaskHandle)})),this.forceDOMReadyCycle(),this._set("container",n),this._startMeasuring()}get focused(){const i=document.activeElement===this.surface;return document.hasFocus()&&i}get size(){return[this.width,this.height]}blur(){var i;(i=this.surface)==null||i.blur()}focus(){var i;(i=this.surface)==null||i.focus()}pageToContainer(i,r,n){const s=this.position;return i-=s?s[0]:0,r-=s?s[1]:0,n?(n[0]=i,n[1]=r):n=[i,r],n}containerToPage(i,r,n){const s=this.position;return i+=s?s[0]:0,r+=s?s[1]:0,n?(n[0]=i,n[1]=r):n=[i,r],n}_handleUIChange(i,r){this.removeHandles("ui"),r&&r!==i&&r.destroy(),i&&(i.view=this,this.addHandles(_e(()=>this.root,n=>{i.container=n?Wpt(n):null},Qt),"ui")),this._set("ui",i)}_stopMeasuring(){this.removeHandles("measuring"),this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const i=this._freqInfo;i.freq=dR,i.time=kD,this.addHandles([r5(window,"resize",()=>{i.freq=dR,i.time=kD}),LT({prepare:r=>{const n=this._measure(),s=this._freqInfo;if(s.time+=r.deltaTime,n&&(s.freq=dR,this._get("resizing")||this._set("resizing",!0)),s.time=Ypt&&this._get("resizing")&&this._set("resizing",!1)}})],"measuring"),this._measure(),this._position()}_measure(){const i=this.container,r=i?i.clientWidth:0,n=i?i.clientHeight:0;if(r===0||n===0)return this.suspended||this._set("suspended",!0),!1;const s=this.width,o=this.height;return r===s&&n===o?(this.suspended&&this._set("suspended",!1),!1):(this._set("width",r),this._set("height",n),this.suspended&&this._set("suspended",!1),this.emit("resize",{oldWidth:s,oldHeight:o,width:r,height:n}),!0)}_position(){const i=this.container,r=this.position,n=i&&qpt(i);return!!n&&(!r||n[0]!==r[0]||n[1]!==r[1])&&(this._set("position",[n[0],n[1]]),!0)}forceDOMReadyCycle(){}};return y([w()],e.prototype,"container",null),y([w({readOnly:!0})],e.prototype,"focused",null),y([w({readOnly:!0})],e.prototype,"height",void 0),y([w()],e.prototype,"messagesCommon",void 0),y([w({type:z0e})],e.prototype,"overlay",void 0),y([w({readOnly:!0})],e.prototype,"position",void 0),y([w({readOnly:!0})],e.prototype,"resizing",void 0),y([w({readOnly:!0})],e.prototype,"root",void 0),y([w({value:null,readOnly:!0})],e.prototype,"size",null),y([w({readOnly:!0})],e.prototype,"surface",void 0),y([w({readOnly:!0})],e.prototype,"suspended",void 0),y([w()],e.prototype,"ui",void 0),y([w({readOnly:!0})],e.prototype,"userContent",void 0),y([w({readOnly:!0})],e.prototype,"width",void 0),y([w()],e.prototype,"widthBreakpoint",void 0),e=y([Z("esri.views.DOMContainer")],e),e};function Ju(t,e,i,r){return{x:t,y:e,z:i,hasZ:i!=null,hasM:!1,spatialReference:r,type:"point"}}async function pU(t,e,i,r,n){r??(r=0);const s=t.spatialReference;if(rh(s,i)||s==null||i==null||jn(s,i))return zD[0]=t.x,zD[1]=t.y,zD[2]=t.z??r,void un(zD,t.spatialReference,0,e,i,0,1);const o=Ju(t.x,t.y,t.z??r,s),a=await Qy(o,i,n);e[0]=a.x,e[1]=a.y,e[2]=a.z??0}const zD=W();function M_(t,e,i){if(e==null||i==null)return null;const r=new mt({spatialReference:i});return un(t,e,0,UD,i,0,1)?(r.x=UD[0],r.y=UD[1],r.z=UD[2],r):null}const UD=W();async function SIe(t,e,i,r){const n=M_(t,e,i);if(n!=null)return n;const s=new mt({x:t[0],y:t[1],z:t[2],spatialReference:e,hasZ:!0});return Qy(s,i,r)}var ms,rl;(function(t){t[t.OBJECT=0]="OBJECT",t[t.HUD=1]="HUD",t[t.TERRAIN=2]="TERRAIN",t[t.OVERLAY=3]="OVERLAY",t[t.I3S=4]="I3S",t[t.PCL=5]="PCL",t[t.LOD=6]="LOD",t[t.VOXEL=7]="VOXEL"})(ms||(ms={}));let Jpt=class{constructor(){this.verticalOffset=0,this.selectionMode=!1,this.hud=!0,this.selectOpaqueTerrainOnly=!0,this.invisibleTerrain=!1,this.backfacesTerrain=!0,this.isFiltered=!1,this.filteredLayerUids=[],this.store=rl.ALL}};(function(t){t[t.MIN=0]="MIN",t[t.MINMAX=1]="MINMAX",t[t.ALL=2]="ALL"})(rl||(rl={}));let Kpt=class{constructor(e,i,r){this.object=e,this.geometryId=i,this.triangleNr=r}},Qpt=class extends Kpt{constructor(e,i,r,n){super(e,i,r),this.center=n!=null?Xr(n):null}},TIe=class{constructor(e){this.layerUid=e}},Mj=class extends TIe{constructor(e,i){super(e),this.graphicUid=i}};function Xm(t){return(t==null?void 0:t.dist)!=null}function V0e(t){return(e,i,r)=>(Qr(B0e,e,i,r),!lae(t,B0e))}function Oj(t){return Xm(t)&&t.intersector===ms.OBJECT&&!!t.target}function Pj(t){return Xm(t)&&t.intersector===ms.HUD&&!!t.target&&"center"in t.target&&t.target.center!=null}const B0e=W();let eft=class{constructor(){this._transform=Qe(),this._transformInverse=new VD({value:this._transform},Bo,Qe),this._transformInverseTranspose=new VD(this._transformInverse,ud,Qe),this._transformTranspose=new VD({value:this._transform},ud,Qe),this._transformInverseRotation=new VD({value:this._transform},ZPe,as)}_invalidateLazyTransforms(){this._transformInverse.invalidate(),this._transformInverseTranspose.invalidate(),this._transformTranspose.invalidate(),this._transformInverseRotation.invalidate()}get transform(){return this._transform}get inverse(){return this._transformInverse.value}get inverseTranspose(){return this._transformInverseTranspose.value}get inverseRotation(){return this._transformInverseRotation.value}get transpose(){return this._transformTranspose.value}setTransformMatrix(e){Mo(this._transform,e)}multiplyTransform(e){sn(this._transform,this._transform,e)}set(e){Mo(this._transform,e),this._invalidateLazyTransforms()}setAndInvalidateLazyTransforms(e,i){this.setTransformMatrix(e),this.multiplyTransform(i),this._invalidateLazyTransforms()}},VD=class{constructor(e,i,r){this._original=e,this._update=i,this._dirty=!0,this._transform=r()}invalidate(){this._dirty=!0}get value(){return this._dirty&&(this._update(this._transform,this._original.value),this._dirty=!1),this._transform}},tft=class{constructor(e=0){this.offset=e,this.tmpVertex=W()}applyToVertex(e,i,r){const n=Ie(fU,e,i,r),s=Be(Cee,n,this.localOrigin),o=this.offset/nt(s);return lo(this.tmpVertex,n,s,o),this.tmpVertex}applyToAabb(e){const i=EIe,r=CIe,n=AIe;for(let c=0;c<3;++c)i[c]=e[0+c]+this.localOrigin[c],r[c]=e[3+c]+this.localOrigin[c],n[c]=i[c];const s=this.applyToVertex(i[0],i[1],i[2]);for(let c=0;c<3;++c)e[c]=s[c],e[c+3]=s[c];const o=c=>{const p=this.applyToVertex(c[0],c[1],c[2]);for(let _=0;_<3;++_)e[_]=Math.min(e[_],p[_]),e[_+3]=Math.max(e[_+3],p[_])};for(let c=1;c<8;++c){for(let p=0;p<3;++p)n[p]=c&1<0?this._totalOffset:0,e[4]+=r[1]>0?this._totalOffset:0,e[5]+=r[2]>0?this._totalOffset:0,e;const _=OEe(q0e,o,a),x=nt(_),S=this._totalOffset/x,C=this._totalOffset/p;return e[0]+=i[0]*(i[0]>0?S:C),e[1]+=i[1]*(i[1]>0?S:C),e[2]+=i[2]*(i[2]>0?S:C),e[3]+=r[0]*(r[0]<0?S:C),e[4]+=r[1]*(r[1]<0?S:C),e[5]+=r[2]*(r[2]<0?S:C),e}applyToMbs(e){const i=nt(e),r=this._totalOffset/i;return lo(this._mbs,e,e,r),this._mbs[3]=e[3]+e[3]*this._totalOffset/i,this._mbs}applyToObb(e){return G5e(e,this._totalOffset,this._totalOffset,_t.Global,this._obb),this._obb}},rft=class{constructor(e=0){this.offset=e,this.sphere=uo(),this.tmpVertex=W()}applyToVertex(e,i,r){const n=this.objectTransform.transform,s=Ie(fU,e,i,r),o=bt(s,s,n),a=this.offset/nt(o);lo(o,o,o,a);const c=this.objectTransform.inverse;return bt(this.tmpVertex,o,c),this.tmpVertex}applyToMinMax(e,i){const r=this.offset/nt(e);lo(e,e,e,r);const n=this.offset/nt(i);lo(i,i,i,n)}applyToAabb(e){const i=this.offset/Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]+=e[0]*i,e[1]+=e[1]*i,e[2]+=e[2]*i;const r=this.offset/Math.sqrt(e[3]*e[3]+e[4]*e[4]+e[5]*e[5]);return e[3]+=e[3]*r,e[4]+=e[4]*r,e[5]+=e[5]*r,e}applyToBoundingSphere(e){const i=nt(e),r=this.offset/i;return lo(this.sphere,e,e,r),this.sphere[3]=e[3]+e[3]*this.offset/i,this.sphere}};const j0e=new rft;function Eee(t){return t!=null?(j0e.offset=t,j0e):null}const G0e=new ift;function nft(t){return t!=null?(G0e.offset=t,G0e):null}const H0e=new tft;function sft(t){return t!=null?(H0e.offset=t,H0e):null}const Zw="terrain",fU=W(),Cee=W(),EIe=W(),CIe=W(),AIe=W(),oft=W(),q0e=W(),AP=1e-5;let aft=class{constructor(e){this.options=new Jpt,this._results=new lft,this.transform=new eft,this.tolerance=AP,this.verticalOffset=null,this._ray=Qo(),this._rayEnd=W(),this._rayBeginTransformed=W(),this._rayEndTransformed=W(),this.viewingMode=e??_t.Global}get results(){return this._results}get ray(){return this._ray}get rayBegin(){return this._ray.origin}get rayEnd(){return this._rayEnd}reset(e,i,r){this.resetWithRay(Hoe(e,i,this._ray),r)}resetWithRay(e,i){this.camera=i,e!==this._ray&&eU(e,this._ray),this.options.verticalOffset!==0?this.viewingMode===_t.Local?this._ray.origin[2]-=this.options.verticalOffset:this.verticalOffset=this.options.verticalOffset:this.verticalOffset=null,Be(this._rayEnd,this._ray.origin,this._ray.direction),this._results.init(this._ray)}intersect(e=null,i,r,n,s){var a;this.point=i,this.filterPredicate=n,this.tolerance=r??AP;const o=Eee(this.verticalOffset);if(e&&e.length>0){const c=s?p=>{s(p)&&this.intersectObject(p)}:p=>{this.intersectObject(p)};for(const p of e){const _=(a=p.getSpatialQueryAccelerator)==null?void 0:a.call(p);_!=null?(o!=null?_.forEachAlongRayWithVerticalOffset(this._ray.origin,this._ray.direction,c,o):_.forEachAlongRay(this._ray.origin,this._ray.direction,c),this.options.selectionMode&&this.options.hud&&_.forEachDegenerateObject(c)):p.objects.forAll(x=>c(x))}}this.sortResults()}intersectObject(e){const i=e.geometries;if(!i)return;const r=e.effectiveTransformation,n=Eee(this.verticalOffset);for(const s of i){if(!s.visible)continue;const{material:o,id:a}=s;this.transform.setAndInvalidateLazyTransforms(r,s.transformation),bt(this._rayBeginTransformed,this.rayBegin,this.transform.inverse),bt(this._rayEndTransformed,this.rayEnd,this.transform.inverse);const c=this.transform.transform;n!=null&&(n.objectTransform=this.transform),o.intersect(s,this.transform.transform,this,this._rayBeginTransformed,this._rayEndTransformed,(p,_,x,S,C,M)=>{if(p>=0){if(this.filterPredicate!=null&&!this.filterPredicate(this._ray.origin,this._rayEnd,p))return;const P=S?this._results.hud:this._results,$=S?F=>{const z=new Qpt(e,a,x,M);F.set(ms.HUD,z,p,_,gs,C)}:F=>F.set(ms.OBJECT,{object:e,geometryId:a,triangleNr:x},p,_,c,C);if((P.min.drapedLayerOrder==null||C>=P.min.drapedLayerOrder)&&(P.min.dist==null||pP.max.dist)&&$(P.max),this.options.store===rl.ALL)if(S){const F=new Aee(this._ray);$(F),this._results.hud.all.push(F)}else{const F=new _O(this._ray);$(F),this._results.all.push(F)}}})}}sortResults(e=this._results.all){e.sort((i,r)=>i.dist!==r.dist?(i.dist??0)-(r.dist??0):i.drapedLayerOrder!==r.drapedLayerOrder?(i.drapedLayerOrder??Number.MAX_VALUE)-(r.drapedLayerOrder??Number.MAX_VALUE):(r.drapedLayerGraphicOrder??Number.MIN_VALUE)-(i.drapedLayerGraphicOrder??Number.MIN_VALUE))}};function Mp(t){return new aft(t)}let lft=class{constructor(){this.min=new _O(Qo()),this.max=new _O(Qo()),this.hud={min:new Aee(Qo()),max:new Aee(Qo()),all:new Array},this.ground=new _O(Qo()),this.all=[]}init(e){this.min.init(e),this.max.init(e),this.ground.init(e),this.all.length=0,this.hud.min.init(e),this.hud.max.init(e),this.hud.all.length=0}},_O=class{get ray(){return this._ray}get distanceInRenderSpace(){return this.dist!=null?(De(BD,this.ray.direction,this.dist),nt(BD)):null}getIntersectionPoint(e){return!!Xm(this)&&(De(BD,this.ray.direction,this.dist),Be(e,this.ray.origin,BD),!0)}getTransformedNormal(e){return Ne(pR,this.normal),pR[3]=0,dp(pR,pR,this.transformation),Ne(e,pR),Ye(e,e)}constructor(e){this.intersector=ms.OBJECT,this.normal=W(),this.transformation=Qe(),this._ray=Qo(),this.init(e)}init(e){this.dist=null,this.target=null,this.drapedLayerOrder=null,this.drapedLayerGraphicOrder=null,this.intersector=ms.OBJECT,eU(e,this._ray)}set(e,i,r,n,s,o,a){this.intersector=e,this.dist=r,Ne(this.normal,n??pB),Mo(this.transformation,s??gs),this.target=i,this.drapedLayerOrder=o,this.drapedLayerGraphicOrder=a}copy(e){eU(e.ray,this._ray),this.intersector=e.intersector,this.dist=e.dist,this.target=e.target,this.drapedLayerOrder=e.drapedLayerOrder,this.drapedLayerGraphicOrder=e.drapedLayerGraphicOrder,Ne(this.normal,e.normal),Mo(this.transformation,e.transformation)}},Aee=class extends _O{constructor(){super(...arguments),this.intersector=ms.HUD}};function mae(t){return new _O(t)}const BD=W(),pR=Xi();function MIe(t,e,i,r){return t.renderCoordsHelper.fromRenderCoords(e.eye,mU,r)!=null&&VEe(i,mU)}function Rj(t,e){return t.elevationProvider?t.elevationProvider.getElevation(e[0],e[1],e[2],t.renderCoordsHelper.spatialReference,"ground")??0:0}function OE(t,e,i,r){const n=t.state.camera.clone();e&&i&&r&&(n.eye=e,n.center=i,n.up=r),cft(t,n.ray,yb)||Ne(yb,n.center);const s=t.state.constraints,o=s.minimumPoiDistance;if(Ao(n.eye,yb)o}function cft(t,e,i){let r=Y0e[t.viewingMode];r||(r=Mp(t.state.viewingMode),r.options.backfacesTerrain=!t.state.isGlobal,r.options.invisibleTerrain=!0,Y0e[t.viewingMode]=r);const{isGlobal:n}=t.state;return!(!t.sceneIntersectionHelper.intersectRay(e,r,i)||W0e(t,e.origin,i))||!(!t.renderCoordsHelper.intersectManifold(e,0,i)||W0e(t,e.origin,i))||!!n&&uft(e,i,Tr(t.spatialReference).radius)}function uft(t,e,i){const r=Ve(t.origin,t.origin)-i*i,n=r>0?Math.sqrt(r)/3:1;return De(e,t.direction,n/nt(t.direction)),Be(e,e,t.origin),!0}const Y0e={},mU=W(),yb=W(),Mx=W(),hft={near:0,far:0},dft=W(),jD=W();function gae(){return{direction:W(),up:W()}}function OIe(t,e,i,r,n){let s=Ye(dft,t),o=Ve(s,r);const a=o>0;o=Math.abs(o),o>.99&&(o=Math.abs(Ve(e,r)),o<.99?(Ne(s,e),a&&De(s,s,-1)):s=null);let c=0;if(s){De(jD,r,Ve(r,s)),je(s,s,jD);const _=Ve(s,n)/(nt(s)*nt(n));Wt(jD,s,n),c=(Ve(jD,r)>0?1:-1)*mu(Aa(_))}const p=mu(Aa(-Ve(r,t)/nt(t)));return i?(i.heading=c,i.tilt=p,i):{heading:c,tilt:p}}const PIe=st(0,1,0),RIe=st(0,0,1),fR=Qe(),A1=W(),M1=W();function IIe(t,e,i,r=gae()){const{direction:n,up:s}=r;return cCe(fR,-Ei(e)),tP(fR,fR,Ei(i)),bt(n,RIe,fR),De(n,n,-1),bt(s,PIe,fR),r}function pft(t,e,i,r){return OIe(e,i,r,RIe,PIe)}function fft(t,e,i,r){const n=IIe(t,i,r),s=W();return De(s,n.direction,-e),Be(s,s,t),{up:n.up,eye:s,heading:i,tilt:r}}function mft(t){return mu(t)}function gft(t){return Ei(t)}function $Ie(t,e,i,r,n){const s=t.renderSpatialReference,o=t.map&&t.spatialReference||e.spatialReference;return fd(e,A1,s),fd(e,M1,s),A1[0]-=i/2,M1[0]+=i/2,A1[1]-=r/2,M1[1]+=r/2,il(A1,s,A1,o),il(M1,s,M1,o),n?(n.xmin=A1[0],n.ymin=A1[1],n.xmax=M1[0],n.ymax=M1[1],n.spatialReference=o):n=new Vi(A1[0],A1[1],M1[0],M1[1],o),n}const yft=Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:pft,eyeForCenterWithHeadingTilt:fft,eyeTiltToLookAtTilt:gft,headingTiltToDirectionUp:IIe,lookAtTiltToEyeTilt:mft,toExtent:$Ie},Symbol.toStringTag,{value:"Module"}));function X0e(t,e,i){if(e.longitude==null||e.latitude==null||i.longitude==null||i.latitude==null)throw new Error("Invalid points: no lon/lat");return vft(t,e.longitude,e.latitude,i.longitude,i.latitude)}function vft(t,e,i,r,n){const s=Ei(i),o=Ei(n),a=s-o,c=Ei(e)-Ei(r),p=Math.sin(a/2),_=Math.sin(c/2),x=2*qf(Math.sqrt(p*p+Math.cos(s)*Math.cos(o)*_*_))*t;return Math.round(1e4*x)/1e4}function _ft(t,e,i){const r=e.spatialReference,n=Tr(r),s=new mt(e.x,t.y,r),o=new mt(i.x,t.y,r),a=new mt(t.x,e.y,r),c=new mt(t.x,i.y,r);return{lon:X0e(n.radius,s,o),lat:X0e(n.radius,a,c)}}function bft(t,e,i){const r=e/i,n=Ei(t),s=Math.sin(r/2),o=Math.cos(n),a=2*qf(Math.sqrt(s*s/(o*o)));return mu(a)}function LIe(t,e){let i=t/15;return e||(i=Math.round(i)),i}function Mee(t,e){const i=t==null?void 0:t[0];if(i==null)return null;e||(e={hours:0,minutes:0,seconds:0}),e.hours=LIe(i,!0);const r=e.hours%1;e.hours-=r,e.minutes=60*r;const n=e.minutes%1;return e.minutes-=n,e.seconds=Math.round(60*n),e}const DIe=st(0,0,1),NIe=Ye(W(),st(1,1,1)),wft=new B2(-180,180),mR=Qe(),zw=W(),tC=W();function FIe(t,e,i,r=gae()){Wt(zw,t,DIe),Ve(zw,zw)===0&&Wt(zw,t,NIe),Ep(mR,-Ei(e),t),Zh(mR,mR,-Ei(i),zw);const{up:n,direction:s}=r;return Wt(n,zw,t),Ye(n,n),bt(n,n,mR),Ye(s,t),Cc(s,s),bt(s,s,mR),r}function xft(t,e,i,r){const n=zw,s=tC;return Ye(n,t),Wt(tC,n,DIe),Ve(tC,tC)===0&&Wt(tC,n,NIe),Wt(s,tC,n),OIe(e,i,r,n,s)}function Sft(t,e,i,r){const n={eye:W(),up:null,tilt:r,heading:i},s=zw;s[0]=t[0],s[1]=t[2],s[2]=-t[1];const o=e,a=Ei(i),c=Ei(r),p=Math.sin(a),_=Math.cos(a),x=Math.sin(c),S=Math.cos(c),C=nt(s);let M;if(Math.abs(c)<1e-8)M=o+C;else{const Ee=C/x,te=qf(o/Ee),le=Math.PI-c-te;M=Ee*Math.sin(le)}const P=S*o,$=o*o*(x*x),F=_*_*$,z=M-P,k=z*z,U=F*(F+k-s[1]*s[1]);if(U<0)return De(n.eye,s,M/C),n.tilt=0,GD(n,t);const j=Math.sqrt(U),G=s[1]*z,Y=F+k;let Q;if(Q=_>0?-j+G:j+G,Math.abs(Y)<1e-8)return C<1e-8?(n.eye[0]=0,n.eye[1]=0,n.eye[2]=o):De(n.eye,s,M/C),n.tilt=0,dq(n.eye),GD(n,t);n.eye[1]=Q/Y;const ne=p*p*$,ie=x*o,he=_*ie*n.eye[1],ce=n.eye[1]*n.eye[1],ve=1-ce,ge=Math.sqrt(ve),pe=F*ce+ne-2*he*ge*z+ve*k;return Math.abs(pe)<1e-8?(De(n.eye,s,M/C),n.tilt=0,dq(n.eye),GD(n,t)):(n.eye[0]=(ve*(M*s[0]-P*s[0])-ie*ge*(s[0]*n.eye[1]*_+s[2]*p))/pe,n.eye[2]=(ve*(M*s[2]-P*s[2])-ie*ge*(s[2]*n.eye[1]*_-s[0]*p))/pe,De(n.eye,n.eye,M),dq(n.eye),GD(n,t))}function dq(t){const e=t[1];t[1]=-t[2],t[2]=e}function GD(t,e){const i=FIe(e,t.heading,t.tilt);return t.up=i.up,t}function Tft(t,e,i){const r=nt(e),n=Math.sqrt(i*i+r*r-2*i*r*Math.cos(Math.PI-t)),s=qf(i/(n/Math.sin(t)));return mu(t-s)}function Eft(t,e,i){const r=Ei(t),n=nt(e);return qf(i/(n/Math.sin(r)))+r}function kIe(t,e,i,r,n){let s,o,a,c;const p=e.latitude,_=Tr(t.spatialReference).radius,x=e.longitude,S=bft(p,i,_)/2;s=x-S,o=x+S;const C=Ei(p),M=(1+Math.sin(C))/(1-Math.sin(C)),P=(M+1)*Math.tan(r/_/2),$=P*P;function F(k){const U=Math.PI/2;return(k=Nut.normalize(k,-U))>U&&(k=Math.PI-k),k}if(a=1.5*Math.PI-2*Math.atan(.5*(P+Math.sqrt(4*M+$))),c=a+r/_,a=F(a),c=F(c),c180){const k=(o-s-180)/2;s+=k,o-=k}const z=t.spatialReference&&t.spatialReference.isGeographic?t.spatialReference:rt.WGS84;return n?(n.xmin=s,n.ymin=a,n.xmax=o,n.ymax=c,n.spatialReference=z):n=new Vi(s,a,o,c,z),t.spatialReference&&t.spatialReference.isWebMercator&&Py(n,!1,n),n}const Cft=Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:xft,eyeForCenterWithHeadingTilt:Sft,eyeTiltToLookAtTilt:Eft,headingTiltToDirectionUp:FIe,lookAtTiltToEyeTilt:Tft,toExtent:kIe},Symbol.toStringTag,{value:"Module"}));function gU(t){return t.type==="point"}let yae=class{constructor(e,i=null,r=0){this.array=e,this.spatialReference=i,this.offset=r}};function zIe(t){return"array"in t}function wy(t,e,i="ground"){if(gU(e))return t.getElevation(e.x,e.y,e.z||0,e.spatialReference,i);if(zIe(e)){let r=e.offset;return t.getElevation(e.array[r++],e.array[r++],e.array[r]||0,e.spatialReference??t.spatialReference,i)}return t.getElevation(e[0],e[1],e[2]||0,t.spatialReference,i)}const UIe=Ce.getLogger("esri.views.3d.support.cameraUtils"),VIe=39.37,BIe=96,Oee=1,Aft=8,Mft=5,jIe=1,Z0e=W(),Oft={heading:0,tilt:0},S$=W(),Pft=new B2(-20037508342788905e-9,20037508342788905e-9),Rft=new B2(-180,180);var Yl;function q_(t){return t.spatialReference??rt.WGS84}function M5(t){return t.viewingMode==="global"?Cft:yft}function Ift(t,e,i,r,n){return M5(t).headingTiltToDirectionUp(e,i,r,n)}function Iv(t,e){if(e==null)return null;const i=t.renderSpatialReference,r=M5(t).headingTiltToDirectionUp,n=W();if(!fd(e.position,n,i))return null;const s=r(n,e.heading,e.tilt);De(s.direction,s.direction,t.state.camera.distance),Be(s.direction,s.direction,n);const o=OE(t,n,s.direction,s.up);return o.fov=Ei(e.fov),o}(function(t){t[t.LOCKED=0]="LOCKED",t[t.ADJUST=1]="ADJUST"})(Yl||(Yl={}));const iC=W();function MP(t,e,i){const r=t.renderSpatialReference,n=$j(t,e.eye,e.viewForward,e.up,Oft);let s=q_(t);return il(e.eye,r,iC,s)||(s=rt.WGS84,il(e.eye,r,iC,s)),i==null?new pd(new mt(iC,s),n.heading,n.tilt,mu(e.fov)):(i.position.x=iC[0],i.position.y=iC[1],i.position.z=iC[2],i.position.spatialReference=s,i.heading=n.heading,i.tilt=n.tilt,i.fov=mu(e.fov),i)}function Ij(t,e,i){const r=t.state.camera,n=r.width/2/r.pixelRatio;return t.renderCoordsHelper.viewingMode===_t.Global&&i!=null&&(e*=Math.cos(Ei(i))),e/=t.renderCoordsHelper.unitInMeters,n/(BIe*VIe/e)/Math.tan(r.fovX/2)}function JT(t,e,i){const r=t.state.camera,n=e*Math.tan(r.fovX/2),s=r.width/2/r.pixelRatio;let o=BIe*VIe/(s/n);return t.renderCoordsHelper.viewingMode===_t.Global&&i!=null&&(o/=Math.cos(Ei(i))),o*t.renderCoordsHelper.unitInMeters}async function GIe(t,e,i,r,n,s){return HIe(t,e,Ij(t,i,e.latitude),r,n,s)}function $ft(t,e,i,r,n,s){return s4e(t,vae(t,r.heading,r.tilt,e,i,n),r.fov,s)}async function HIe(t,e,i,r,n,s){const o=await WIe(t,r.heading,r.tilt,e,i,n,s);return St(s),o4e(t,o,r.fov,s)}function $j(t,e,i,r,n){return M5(t).directionToHeadingTilt(e,i,r,n)}function qIe(t,e){return!!(t.basemapTerrain&&t.renderCoordsHelper.fromRenderCoords(e,S$,t.spatialReference)&&t.elevationProvider&&(wy(t.elevationProvider,S$)??0)>S$[2]-jIe)}async function Lft(t,e,i){if(qIe(t,e))return!0;const{elevationProvider:r,spatialReference:n,renderCoordsHelper:s}=t;if(r==null||!s.fromRenderCoords(e,S$,n))return!1;const[o,a,c]=S$,p=await r.queryElevation(o,a,c,n,"ground",i)??0;return St(i),p>c-jIe}async function Dft(t,e,i){const r=W();if(e==null)return Ne(r,t.state.camera.center);if(e instanceof mt){const{renderSpatialReference:n,basemapTerrain:s,elevationProvider:o}=t,a=e.spatialReference;if(await pU(e,r,n,0,{signal:i}),St(i),e.z==null&&s!=null&&o!=null){const c=await o.queryElevation(e.x,e.y,e.z??0,a,"ground",i);St(i),c!=null&&t.renderCoordsHelper.setAltitude(r,c)}return r}return Ne(r,e)}function Nft(t,e){const i=W();if(e==null)return Ne(i,t.state.camera.center);if(e instanceof mt){if(!fd(e,i,t.renderSpatialReference))return null;const{basemapTerrain:r,elevationProvider:n}=t;if(e.z==null&&r!=null&&n!=null){const s=wy(n,e);s!=null&&t.renderCoordsHelper.setAltitude(i,s)}return i}return Ne(i,e)}function vae(t,e,i,r,n,s){return YIe(t,e,i,r instanceof mt?r:null,Nft(t,r),n,s)}async function WIe(t,e,i,r,n,s,o){const a=r instanceof mt?r:null,c=await Dft(t,r,o);return St(o),XIe(t,e,i,a,c,n,s,o)}function YIe(t,e,i,r,n,s,o){if(n==null||(r??(r=M_(n,t.renderSpatialReference,q_(t))),r==null))return null;const a=ZIe(t,e,i,n,s,o);if(JIe(t,i,o)&&qIe(t,a.eye)){const{tilt:c,mode:p}=KIe(t,i,n,s);return YIe(t,e,c,r,n,s,p)}return QIe(a,n)}async function XIe(t,e,i,r,n,s,o,a){r??(r=await SIe(n,t.renderSpatialReference,q_(t),{signal:a})),St(a);const c=ZIe(t,e,i,n,s,o);if(JIe(t,i,o)&&await Lft(t,c.eye,a)){St(a);const{tilt:p,mode:_}=KIe(t,i,n,s);return XIe(t,e,p,r,n,s,_,a)}return QIe(c,n)}function ZIe(t,e,i,r,n,s){const o=kft(t,e,i,r,n=Math.max(n,t.state.constraints.minimumPoiDistance),s);return(0,M5(t).eyeForCenterWithHeadingTilt)(r,n,o.heading,o.tilt)}function JIe(t,e,i){const r=t.map.ground.navigationConstraint;return i===Yl.ADJUST&&t.viewingMode==="global"&&e>0&&(r==null||r.type==="stay-above")}function KIe(t,e,i,r){const n=n4e(t,i,r,Uft(t,r,e,i));return{tilt:n,mode:e-n<1?Yl.LOCKED:Yl.ADJUST}}function QIe(t,e){return{...t,center:Xr(e)}}function e4e(t,e){const{state:i,spatialReference:r}=t,n=e.spatialReference;return i.isGlobal&&xP(n,_t.Global)||i.isLocal&&r.equals(n)}function t4e(t,e){let i,r,n;if(t.state.isGlobal){const _=new mt(e.xmin,e.ymin,e.spatialReference),x=new mt(e.xmax,e.ymax,e.spatialReference),S=e.spatialReference.isGeographic?Rft:Pft;i=new mt({x:S.center(_.x,x.x),y:(x.y+_.y)/2,z:e.zmax!=null&&e.zmin!=null?(e.zmax+e.zmin)/2:void 0,spatialReference:e.spatialReference});const C=Tr(e.spatialReference),M=_ft(i,_,x);r=M.lon,n=M.lat,S.diff(_.x,x.x)>S.range/2&&(r+=C.halfCircumference),r=Math.min(r,C.halfCircumference),n=Math.min(n,C.halfCircumference)}else{const _=t.renderSpatialReference??e.spatialReference;_.equals(e.spatialReference)||(e=sl(e,_)),r=e.xmax-e.xmin,n=e.ymax-e.ymin;const x=e.zmax!=null&&e.zmin!=null?(e.zmax+e.zmin)/2:void 0;i=new mt({x:e.xmin+.5*r,y:e.ymin+.5*n,z:x,spatialReference:_})}const s=e.zmax!=null&&e.zmin!=null?e.zmax-e.zmin:0,o=t.state.camera,a=1/Math.tan(o.fovX/2),c=1/Math.tan(o.fovY/2),p=1/Math.tan(o.fov/2);return{center:i,distance:Math.max(.5*r*a,.5*n*c,.5*s*p)/Oee}}async function i4e(t,e,i,r,n,s){const o=e4e(t,e)?e:await Qy(e,t.spatialReference,{signal:s});St(s);const{center:a,distance:c}=t4e(t,o),p=await WIe(t,i,r,a,c,n,s);return St(s),o4e(t,p,t.camera.fov,s)}function UF(t,e,i,r,n,s){let o;try{o=e4e(t,e)?e:sl(e,t.spatialReference)}catch{return null}const{center:a,distance:c}=t4e(t,o),p=vae(t,i,r,a,c,n);return p==null?null:s4e(t,p,t.camera.fov,s)}function r4e(t,e,i){const r=t.renderSpatialReference,n=M_(i,r,q_(t));if(n==null)return null;const s=Math.tan(e.fovX/2),o=Math.tan(e.fovY/2),a=R9(e.eye,i),c=2*a*s*Oee,p=2*a*o*Oee;return t.viewingMode==="global"?kIe(t,n,c,p):$Ie(t,n,c,p)}function Fft(t,e,i){const r=t.pointsOfInterest.centerOnSurfaceFrequent.distance;if(Math.log(i/r)/Math.LN2>Aft)return!0;const n=t.renderSpatialReference,s=q_(t),o=M_(e,n,s),a=M_(t.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,n,s);if(o==null||a==null)return!1;const c=Math.tan(.5*t.state.camera.fov)*r;return a.distance(o)/c>Mft}function kft(t,e,i,r,n,s){let o=0;return s===Yl.ADJUST&&Fft(t,r,n)?(e=0,o=zft(t,n,i,r)):o=_ae(t,r,n,i),o=t.state.constraints.clampTilt(n,o),{heading:e,tilt:i=n4e(t,r,n,o)}}const yU=.7;function zft(t,e,i,r){const n=_ae(t,r,e,i);if(!t.state.constraints.tilt)return n;const s=t.state.constraints.tilt(e);s.max=Math.min(s.max,.5*Math.PI);const o=s.min*(1-yU)+s.max*yU;return Math.min(n,o)}function Uft(t,e,i,r){let n=_ae(t,r,e,i);if(!t.state.constraints.tilt)return n;const s=t.state.constraints.tilt(e);return n=Math.min(n,.5*Math.PI),s.min*(1-yU)+n*yU}function n4e(t,e,i,r){return M5(t).lookAtTiltToEyeTilt(r,e,i)}function _ae(t,e,i,r){return M5(t).eyeTiltToLookAtTilt(r,e,i)}function s4e(t,e,i,r){if(e==null)return null;const n=t.renderSpatialReference,s=M_(e.eye,n,q_(t));return s==null?null:(r??(r=new pd),r.position=s,r.heading=e.heading,r.tilt=e.tilt,r.fov=i,r)}async function o4e(t,e,i,r){const n=t.renderSpatialReference,s=await SIe(e.eye,n,q_(t),{signal:r});return St(r),new pd(s,e.heading,e.tilt,i)}function Vft(t,e){var r;const i=(r=t.basemapTerrain)==null?void 0:r.tilingScheme;if(i)return i.levelAtScale(e);UIe.error("#scaleToZoom()","Cannot compute zoom from scale without a tiling scheme")}function a4e(t,e){var r;const i=(r=t.basemapTerrain)==null?void 0:r.tilingScheme;if(i)return i.scaleAtLevel(e);UIe.error("#zoomToScale()","Cannot compute scale from zoom without a tiling scheme")}function l4e(t,e){return il(e.center,t.renderSpatialReference,Z0e,rt.WGS84),JT(t,e.distance,Z0e[1])}const bae=Ce.getLogger("esri.layers.support.ElevationSampler");let c4e=class{queryElevation(e){return u4e(e.clone(),this)}on(){return rr()}projectIfRequired(e,i){return h4e(e,i)}},Bft=class extends c4e{get spatialReference(){return this.extent.spatialReference}constructor(e,i,r){super(),this.tile=e,this.noDataValue=r;const n=e.tile.extent;this.extent=_B(n,i.spatialReference),this.extent.zmin=e.zmin,this.extent.zmax=e.zmax,this._aaExtent=n;const s=xs(i.spatialReference),o=i.lodAt(e.tile.level).resolution*s;this.demResolution={min:o,max:o}}contains(e){const i=this.projectIfRequired(e,this.spatialReference);return i!=null&&this.containsAt(i.x,i.y)}containsAt(e,i){return bB(this._aaExtent,e,i)}elevationAt(e,i){if(!this.containsAt(e,i)){const r=this.extent,n=`${r.xmin}, ${r.ymin}, ${r.xmax}, ${r.ymax}`;return bae.warn("#elevationAt()",`Point used to sample elevation (${e}, ${i}) is outside of the sampler extent (${n})`),this.noDataValue}return this.tile.sample(e,i)??this.noDataValue}},J0e=class extends c4e{get spatialReference(){return this.extent.spatialReference}constructor(e,i,r){let n;super(),typeof i=="number"?(this.noDataValue=i,n=null):(n=i,this.noDataValue=r),this.samplers=n?e.map(o=>new Bft(o,n,this.noDataValue)):e;const s=this.samplers[0];if(s){this.extent=s.extent.clone();const{min:o,max:a}=s.demResolution;this.demResolution={min:o,max:a};for(let c=1;c=0;C--)x.unshift(new hm({level:C,scale:S,resolution:S})),S*=2}return new uw({dpi:96,lods:x,origin:new mt(0,0,n),size:[r,r],spatialReference:n})}const o=gp(n),a=t.origin?new mt({x:t.origin.x,y:t.origin.y,spatialReference:n}):new mt(o?{x:o.origin[0],y:o.origin[1],spatialReference:n}:{x:0,y:0,spatialReference:n}),c=96,p=1/(xs(n)*39.37*c),_=[];if(i)for(let x=0;x{r.push(s.scale),e=s.scale>e?s.scale:e,i=s.scale=e.length-1)return e[e.length-1];const i=Math.floor(t),r=i+1;return e[i]/(e[i]/e[r])**(t-i)}scaleToZoom(t){const e=this.scales,i=e.length-1;let r=0;for(;rt&&s=e?this.zoomToScale(Math.ceil(i)):this.zoomToScale(Math.floor(i))}tileAt(t,e,i,r){const n=this.lodAt(t);if(!n)return null;let s,o;if(typeof e=="number")s=e,o=i;else if(jn(e.spatialReference,this.spatialReference))s=e.x,o=e.y,r=i;else{const p=l5(e,this.spatialReference);if(p==null)return null;s=p.x,o=p.y,r=i}const a=n.resolution*this.size[0],c=n.resolution*this.size[1];return r||(r=new Lj(null,0,0,0,Ni())),r.level=t,r.row=Math.floor((this.origin.y-o)/c+.001),r.col=Math.floor((s-this.origin.x)/a+.001),this.updateTileInfo(r),r}updateTileInfo(t,e=uw.ExtrapolateOptions.NONE){let i=this.lodAt(t.level);if(!i&&e===uw.ExtrapolateOptions.POWER_OF_TWO){const o=this.lods[this.lods.length-1];o.levelArray.isArray(t)?t:typeof t=="number"?[t,t]:[256,256]})],lc.prototype,"size",void 0),y([Rt("size",["rows","cols"])],lc.prototype,"readSize",null),y([Et("size",{cols:{type:_n},rows:{type:_n}})],lc.prototype,"writeSize",null),y([w({type:rt,json:{write:!0}})],lc.prototype,"spatialReference",void 0),lc=uw=y([Z("esri.layers.support.TileInfo")],lc),function(t){var e;(e=t.ExtrapolateOptions||(t.ExtrapolateOptions={}))[e.NONE=0]="NONE",e[e.POWER_OF_TWO=1]="POWER_OF_TWO"}(lc||(lc={}));const bO=lc,qft=12;let Gu=class Ou{constructor(e){const i=Ou.checkUnsupported(e);if(i!=null)throw i;const r=e;this.spatialReference=r.spatialReference,this._isWebMercator=this.spatialReference.isWebMercator,this._isGCS=U2(this.spatialReference)||u1(this.spatialReference)||h1(this.spatialReference),this.origin=[r.origin.x,r.origin.y],this.pixelSize=r.size[0],this.dpi=r.dpi;const n=r.lods.reduce((p,_,x)=>(_.levelnew hm({level:i,scale:e.scale,resolution:e.resolution}))})}getExtent(e,i,r,n){const s=this.levels[e],o=s.tileSize[0],a=s.tileSize[1];n[0]=this.origin[0]+r*o,n[2]=this.origin[0]+(r+1)*o,n[3]=this.origin[1]-i*a,n[1]=this.origin[1]-(i+1)*a}convertExtentToRadians(e,i){this._isWebMercator?(i[0]=Khe(e[0]),i[1]=xz(e[1]),i[2]=Khe(e[2]),i[3]=xz(e[3])):this._isGCS&&(i[0]=Ei(e[0]),i[1]=Ei(e[1]),i[2]=Ei(e[2]),i[3]=Ei(e[3]))}getExtentGeometry(e,i,r,n=new Vi){return this.getExtent(e,i,r,ng),n.spatialReference=this.spatialReference,n.xmin=ng[0],n.ymin=ng[1],n.xmax=ng[2],n.ymax=ng[3],n.zmin=void 0,n.zmax=void 0,n}ensureMaxLod(e){if(e==null)return!1;let i=!1;for(;this.levels.length<=e;){const r=this.levels[this.levels.length-1],n=r.resolution/2;this.levels.push({resolution:n,scale:r.scale/2,tileSize:[n*this.pixelSize,n*this.pixelSize]}),i=!0}return i}capMaxLod(e){this.levels.length>e+1&&(this.levels.length=e+1)}getMaxLod(){return this.levels.length-1}scaleAtLevel(e){return this.levels[0].scale/2**e}levelAtScale(e){const i=this.levels[0].scale;return e>=i?0:Math.log(i/e)*Math.LOG2E}resolutionAtLevel(e){return this.levels[0].resolution/2**e}compatibleWith(e){if(!(e instanceof Ou)){if(Ou.checkUnsupported(e))return!1;e=new Ou(e)}if(!e.spatialReference.equals(this.spatialReference)||e.pixelSize!==this.pixelSize)return!1;const i=Math.min(this.levels.length,e.levels.length)-1,r=this.levels[i].resolution;let n=.5*r;return!Ry(e.origin[0],this.origin[0],n)||!Ry(e.origin[1],this.origin[1],n)?!1:(n=.5*r/2**i/this.pixelSize*qft,Ry(r,e.levels[i].resolution,n))}rootTilesInExtent(e,i=null,r=1/0){const n=new Array,s=this.levels[0].tileSize;if(e==null||s[0]===0||s[1]===0)return n;Ou.computeRowColExtent(e,s,this.origin,ng);let o=ng[1],a=ng[3],c=ng[0],p=ng[2];const _=p-c,x=a-o;if(_*x>r){const S=Math.floor(Math.sqrt(r));x>S&&(o=o+Math.floor(.5*x)-Math.floor(.5*S),a=o+S),_>S&&(c=c+Math.floor(.5*_)-Math.floor(.5*S),p=c+S)}for(let S=o;S!pXe(n.resolution,r/2**n.level))}static hasGapInLevels(e){const i=e.lods.map(r=>r.level);i.sort((r,n)=>r-n);for(let r=1;r=128&&i<=512}static hasOriginPerLODs(e){const i=e.origin;return e.lods.some(r=>r.origin!=null&&(r.origin[0]!==i.x||r.origin[1]!==i.y))}static getMissingTileInfoError(){return new se("tilingscheme:tile-info-missing","Tiling scheme must have tiling information")}static checkUnsupported(e){return e==null?wae():e.lods.length<1?new se("tilingscheme:generic","Tiling scheme must have at least one level"):Ou.isPowerOfTwo(e)?Ou.hasGapInLevels(e)?new se("tilingscheme:gaps","Tiling scheme levels must not have gaps between min and max level"):Ou.tileSizeSupported(e)?Ou.hasOriginPerLODs(e)?new se("tilingscheme:multiple-origin","Tiling scheme levels must not have their own origin"):null:new se("tilingscheme:tile-size","Tiles must be square and size must be one of [128, 256, 512]"):new se("tilingscheme:power-of-two","Tiling scheme must be power of two")}static fromExtent(e,i){const r=e[2]-e[0],n=e[3]-e[1],s=xs(i),o=1.2*Math.max(r,n),a=256,c=96,p=.0254,_=new Ou(new bO({size:[a,a],origin:new mt({x:e[0]-.5*(o-r),y:e[3]+.5*(o-n)}),lods:[new hm({level:0,resolution:o/a,scale:1/(a/c*p/(o*s))})],spatialReference:i}));return _.ensureMaxLod(20),_}static makeWebMercatorAuxiliarySphere(e){const i=new Ou(Ou.WebMercatorAuxiliarySphereTileInfo);return i.ensureMaxLod(e),i}static makeGCSWithTileSize(e,i=256,r=16){const n=256/i,s=new Ou(new bO({size:[i,i],origin:new mt({x:-180,y:90,spatialReference:e}),spatialReference:e,lods:[new hm({level:0,resolution:.703125*n,scale:295497598570834e-6*n})]}));return s.ensureMaxLod(r),s}get test(){return{isWebMercator:this._isWebMercator,isGCS:this._isGCS}}};function wae(){return new se("tilingscheme:tile-info-missing","Tiling scheme must have tiling information")}Gu.WebMercatorAuxiliarySphereTileInfo=new bO({size:[256,256],origin:new mt({x:-20037508342787e-6,y:20037508342787e-6,spatialReference:rt.WebMercator}),spatialReference:rt.WebMercator,lods:[new hm({level:0,resolution:156543.03392800014,scale:591657527591555e-6})]}),Gu.WebMercatorAuxiliarySphere=Gu.makeWebMercatorAuxiliarySphere(19);const ng=Ni(),kM=64,o4=512,Wft=2.5,LL=fXe(FZ/10),d4e=2,p4e=Ni();Gu.WebMercatorAuxiliarySphere.getExtent(0,0,0,p4e);const Yft=Ni([-180,-90,180,90]),Xft="Cannot extend surface to encompass all layers because it would result in too many root tiles.",Zft="Surface extent is too large for tile resolution at level 0.",Jft=3;let Kft=Jft;function Ree(t){return t<4?3:Kft}let hw=class extends Dn.EventedAccessor{constructor(e){super(e),this.demResolution={min:-1,max:-1},this.noDataValue=LL}initialize(){this.view.basemapTerrain.on("elevation-change",()=>this.emit("changed",{}))}get extent(){const e=this.view.basemapTerrain;if((e==null?void 0:e.extent)==null||e.spatialReference==null)return null;const i=_B(e.extent,e.spatialReference);return i.zmin=e.visibleElevationBounds.min,i.zmax=e.visibleElevationBounds.max,i}get spatialReference(){var e;return((e=this.view.basemapTerrain)==null?void 0:e.spatialReference)??rt.WGS84}elevationAt(e,i){var r;if(this.extent==null||!tu(this.extent,e,i)){const n=this.extent!=null?`${this.extent.xmin}, ${this.extent.ymin}, ${this.extent.xmax}, ${this.extent.ymax}`:null;return Ce.getLogger(this).warn("#elevationAt()",`Point used to sample elevation (${e}, ${i}) is outside of the sampler extent (${n})`),this.noDataValue}return((r=this.view.elevationProvider)==null?void 0:r.getElevation(e,i,0,this.spatialReference,"ground"))??this.noDataValue}queryElevation(e){return u4e(e.clone(),this)}};y([w({readOnly:!0})],hw.prototype,"demResolution",void 0),y([w({readOnly:!0})],hw.prototype,"extent",null),y([w({readOnly:!0})],hw.prototype,"noDataValue",void 0),y([w()],hw.prototype,"spatialReference",null),y([w({constructOnly:!0})],hw.prototype,"view",void 0),hw=y([Z("esri.views.support.GroundViewElevationSampler")],hw);const Qft=hw;let av=class extends ze{constructor(e){super(e),this.view=null,this.layerViews=new tt}initialize(){this.addHandles(Oo(()=>{var e,i;return(i=(e=this.view)==null?void 0:e.map)==null?void 0:i.ground},e=>e.load())),this.addHandles(this.layerViews.on("after-changes",()=>this._layerViewsAfterChangesHandler()))}destroy(){this._set("view",null);for(const e of this.layerViews)e.destroy();this.layerViews.length=0}get elevationSampler(){return this.view?this.view.type==="2d"?null:this.view.ready&&this.view.basemapTerrain&&this.view.basemapTerrain.ready?new Qft({view:this.view}):null:null}get extent(){const e=this.view;return e&&e.type!=="2d"&&e.ready?r4e(e,e.state.camera,e.pointsOfInterest.centerOnSurfaceFrequent.renderLocation):null}get updating(){return!this.suspended&&this.layerViews.some(e=>e.updating)}get suspended(){return!this.view||this.view.suspended}_layerViewsAfterChangesHandler(){this.removeHandles("updating"),this.addHandles(this.layerViews.map(e=>_e(()=>e.updating,()=>this._updateUpdating(),Li)).toArray(),"updating"),this._updateUpdating()}_updateUpdating(){this.notifyChange("updating")}};y([w({readOnly:!0})],av.prototype,"elevationSampler",null),y([w({readOnly:!0})],av.prototype,"extent",null),y([w({type:Boolean,readOnly:!0})],av.prototype,"updating",null),y([w({constructOnly:!0})],av.prototype,"view",void 0),y([w({type:tt,readOnly:!0})],av.prototype,"layerViews",void 0),y([w({readOnly:!0})],av.prototype,"suspended",null),av=y([Z("esri.views.GroundView")],av);const e0t=av;let O_=class{constructor(e,i){this._owner=i,this._properties={},this._afterDispatchHandle=null;for(const r in e){const n=e[r],s=new HSe(n,void 0,void 0,2,2);this._properties[r]={pool:s,acquired:[]}}this._afterDispatchHandle=rTe(()=>this._release())}destroy(){this._afterDispatchHandle&&(this._afterDispatchHandle.remove(),this._afterDispatchHandle=null);for(const e in this._properties){const i=this._properties[e];for(const r of i.acquired)Rhe(r)||i.pool.release(r);i.pool.destroy(),i.pool=null,i.acquired=null}this._properties=null,this._owner=null}get(e){const i=this._owner._get(e),r=this._properties[e];let n=r.pool.acquire();for(r.acquired.push(n);n===i;)r.acquired.push(n),n=r.pool.acquire();return n}_release(){for(const e in this._properties){const i=this._properties[e];let r=0;for(const n of i.acquired)Rhe(n)?i.acquired[r++]=n:i.pool.release(n);i.acquired.length=r}}};const t0t=$e("mac")?"Meta":"Ctrl",Dj={8:"Backspace",9:"Tab",13:"Enter",27:"Escape",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete"};for(let t=48;t<58;t++)Dj[t]=String.fromCharCode(t);for(let t=1;t<25;t++)Dj[111+t]=`F${t}`;for(let t=65;t<91;t++)Dj[t]=[String.fromCharCode(t+32),String.fromCharCode(t)];function i0t(t){if(t.key!==void 0)return Mf(t);const e=Dj[t.keyCode];return Array.isArray(e)?t.shiftKey?e[1]:e[0]:e}function r0t(t){switch(t){case"Ctrl":case"Alt":case"Shift":case"Meta":case"Primary":return!0}return!1}let n0t=class{constructor(e,i=[]){this.eventType=e,this.keyModifiers=i}matches(e){if(e.type!==this.eventType)return!1;if(this.keyModifiers.length===0)return!0;const i=e.modifiers;for(const r of this.keyModifiers)if(!i.has(r))return!1;return!0}};const Q0e=Ce.getLogger("esri.views.input.InputHandler");let Rl=class{constructor(e){this._manager=null,this._incoming={},this._outgoing={},this._incomingEventMatches=null,this._incomingEventTypes=null,this._outgoingEventTypes=null,this._hasSideEffects=e}get incomingEventMatches(){if(!this._incomingEventMatches){this._incomingEventMatches=[];for(const e in this._incoming){const i=this._incoming[e];for(const r of i)this._incomingEventMatches.push(r.match)}}return this._incomingEventMatches}get incomingEventTypes(){return this._incomingEventTypes||(this._incomingEventTypes=this.incomingEventMatches.map(e=>e.eventType)),this._incomingEventTypes}get outgoingEventTypes(){return this._outgoingEventTypes||(this._outgoingEventTypes=Object.keys(this._outgoing)),this._outgoingEventTypes}get hasSideEffects(){return this._hasSideEffects}get hasPendingInputs(){return!1}onInstall(e){this._manager?Q0e.error("This InputHandler has already been registered with an InputManager"):(e.setEventCallback(i=>this._handleEvent(i)),e.setUninstallCallback(()=>this._onUninstall()),this._manager=e)}onUninstall(){}registerIncoming(e,i,r){let n;typeof i=="function"?(r=i,n=[]):n=i||[];const s=typeof e=="string"?new n0t(e,n):e,o=()=>{this._incomingEventTypes=null,this._incomingEventMatches=null},a=_=>{const x=this._incoming[_.match.eventType];if(x){const S=x.indexOf(_);x.splice(S,1),o(),this._manager&&this._manager.updateDependencies()}},c=new s0t(s,r,{onPause:a,onRemove:a,onResume:_=>{const x=this._incoming[_.match.eventType];x&&!x.includes(_)&&(x.push(_),o(),this._manager&&this._manager.updateDependencies())}});let p=this._incoming[s.eventType];return p||(p=[],this._incoming[s.eventType]=p),p.push(c),o(),this._manager&&this._manager.updateDependencies(),c}registerOutgoing(e){if(this._outgoing[e])throw new Error("There is already a callback registered for this outgoing InputEvent: "+e);const i=new o0t(e,{onEmit:(r,n,s,o)=>{var a;(a=this._manager)==null||a.emit(r.eventType,n,s,o)},onRemove:r=>{var n;delete this._outgoing[r.eventType],(n=this._manager)==null||n.updateDependencies()}});return this._outgoing[e]=i,this._outgoingEventTypes=null,this._manager&&this._manager.updateDependencies(),i}startCapturingPointer(e){var i;(i=this._manager)==null||i.setPointerCapture(e,!0)}stopCapturingPointer(e){var i;(i=this._manager)==null||i.setPointerCapture(e,!1)}refreshHasPendingInputs(){var e;(e=this._manager)==null||e.refreshHasPendingInputs()}_onUninstall(){this._manager?(this.onUninstall(),this._manager=null):Q0e.error("This InputHandler is not registered with an InputManager")}_handleEvent(e){var r;const i=this._incoming[e.type];if(i){for(const n of i)if(n.match.matches(e)&&((r=n.callback)==null||r.call(n,e),e.shouldStopPropagation()))break}}},s0t=class{constructor(e,i,r){this.match=e,this._callback=i,this._handler=r}pause(){this._handler.onPause(this)}resume(){this._handler.onResume(this)}remove(){this._handler.onRemove(this)}get callback(){return this._callback}},o0t=class{constructor(e,i){this.eventType=e,this._removed=!1,this._handler=i}emit(e,i,r){this._removed||this._handler.onEmit(this,e,i,r)}remove(){this._removed=!0,this._handler.onRemove(this)}},a0t=class extends Rl{constructor(e){super(!0),this._onChange=e,this._value="mouse",this._x=null,this._y=null,this.registerIncoming("pointer-move",i=>{this._update(i.data)})}_update(e){const i=e.native.pointerType==="touch"?"touch":"mouse",{x:r,y:n}=e;i===this._value&&this._x===r&&this._y===n||(this._value=i,this._x=r,this._y=n,this._onChange(i,r,n))}},l0t=class extends Rl{get multiTouchActive(){return this._multiTouchActive.value}constructor(){super(!0),this._activeTouchPointerIds=new Set,this._multiTouchActive=TP(!1),this._onPointerAdd=({data:e})=>{e.pointerType==="touch"&&(this._activeTouchPointerIds.add(e.native.pointerId),this._update())},this._onPointerRemove=({data:e})=>{e.pointerType==="touch"&&(this._activeTouchPointerIds.delete(e.native.pointerId),this._update())},this.registerIncoming("pointer-down",this._onPointerAdd),this.registerIncoming("pointer-up",this._onPointerRemove),this.registerIncoming("pointer-capture-lost",this._onPointerRemove),this.registerIncoming("pointer-cancel",this._onPointerRemove)}_update(){this._multiTouchActive.value=this._activeTouchPointerIds.size>1}},Kp=class extends ze{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._handlersPriority=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=t0t,this._latestPointerType="mouse",this._propertiesPool=new O_({latestPointerLocation:h0t},this),this.latestPointerLocation=null,this._paused=!1,this.test={timestamp:void 0,hasCurrentPropagation:()=>!!this._currentPropagation}}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this._installRecognizers()}destroy(){const e=Object.keys(this._nameToGroup);for(const i of e)this.uninstallHandlers(i);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some(e=>e.handler.hasPendingInputs)}get latestPointerType(){return this._latestPointerType}get multiTouchActive(){return this._multiTouchHandler.multiTouchActive}get updating(){return this.hasPendingInputs||this._paused}installHandlers(e,i,r=Cs.INTERNAL){if(this._nameToGroup[e])return void Ce.getLogger(this).error("There is already an InputHandler group registered under the name `"+e+"`");if(i.length===0)return void Ce.getLogger(this).error("Can't register a group of zero handlers");const n={name:e,handlers:i.map(s=>({handler:s,active:!0,removed:!1,priorityIndex:0,groupPriority:r,eventCallback:null,uninstallCallback:null}))};this._nameToGroup[e]=n;for(let s=n.handlers.length-1;s>=0;s--){const o=n.handlers[s];this._handlers.push(o),o.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(a,c,p,_,x)=>{this._emitInputEvent(o.priorityIndex+1,a,c,p,x,_)},setPointerCapture:(a,c)=>{this._setPointerCapture(n,o,a,c)},setEventCallback:a=>{o.eventCallback=a},setUninstallCallback:a=>{o.uninstallCallback=a},refreshHasPendingInputs:()=>{this.notifyChange("hasPendingInputs")}})}this.updateDependencies()}uninstallHandlers(e){const i=this._nameToGroup[e];i?(i.handlers.forEach(r=>{var n;r.removed=!0,(n=r.uninstallCallback)==null||n.call(r)}),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):Ce.getLogger(this).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return this._nameToGroup[e]!==void 0}updateDependencies(){if(this._currentPropagation)return void(this._updateDependenciesAfterPropagation=!0);this._updateDependenciesAfterPropagation=!1;const e=new Set,i=new Set;this._handlersPriority=[];for(let r=this._handlers.length-1;r>=0;r--){const n=this._handlers[r];n.priorityIndex=r,this._handlersPriority.push(n)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let r=this._handlersPriority.length-1;r>=0;r--){const n=this._handlersPriority[r];n.priorityIndex=r;let s=n.handler.hasSideEffects;if(!s){for(const o of n.handler.outgoingEventTypes)if(e.has(o)){s=!0;break}}if(s)for(const o of n.handler.incomingEventMatches){e.add(o.eventType);for(const a of o.keyModifiers)r0t(a)||i.add(a)}n.active=s}this._sourceEvents=e,this._keyModifiers=i,this._pointerCaptures.size>0&&this._sourceEvents.add("pointer-capture-lost"),this._keyModifiers.size>0&&(this._sourceEvents.add("key-down"),this._sourceEvents.add("key-up")),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents)}_setLatestPointer(e,i,r){this._latestPointerType=e;const n=this._get("latestPointerLocation");if(n==null||n.x!==i||n.y!==r){const s=this._propertiesPool.get("latestPointerLocation");s.x=i,s.y=r,this._set("latestPointerLocation",s)}}_onEventReceived(e,i){if(e==="pointer-capture-lost"){const s=i;this._pointerCaptures.delete(s.native.pointerId)}this._updateKeyModifiers(e,i);const r=this.test.timestamp!=null?this.test.timestamp:i.native?i.native.timestamp:void 0,n=i.native?i.native.cancelable:void 0;this._emitInputEventFromSource(e,i,r,n)}_updateKeyModifiers(e,i){if(!i)return;let r=!1;const n=()=>{if(!r){const a=new Set;this._activeKeyModifiers.forEach(c=>{a.add(c)}),this._activeKeyModifiers=a,r=!0}},s=(a,c)=>{c&&!this._activeKeyModifiers.has(a)?(n(),this._activeKeyModifiers.add(a)):!c&&this._activeKeyModifiers.has(a)&&(n(),this._activeKeyModifiers.delete(a))};if(e==="key-down"||e==="key-up"){const a=i.key;this._keyModifiers.has(a)&&s(a,e==="key-down")}const o=i.native;s("Alt",!(!o||!o.altKey)),s("Ctrl",!(!o||!o.ctrlKey)),s("Shift",!(!o||!o.shiftKey)),s("Meta",!(!o||!o.metaKey)),s("Primary",this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new a0t((e,i,r)=>this._setLatestPointer(e,i,r)),this._multiTouchHandler=new l0t,this.installHandlers("input-manager-logic",[this._latestPointerHandler,this._multiTouchHandler],Cs.ALWAYS),this.recognizers.length>0&&this.installHandlers("default",this.recognizers,Cs.INTERNAL)}_setPointerCapture(e,i,r,n){const s=e.name+"-"+i.priorityIndex,o=this._pointerCaptures.get(r.pointerId)||new Set;this._pointerCaptures.set(r.pointerId,o),n?(o.add(s),o.size===1&&this.eventSource&&this.eventSource.setPointerCapture(r,!0)):o.has(s)&&(o.delete(s),o.size===0&&(this._pointerCaptures.delete(r.pointerId),this.eventSource&&this.eventSource.setPointerCapture(r,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter(e=>!e.removed),this.updateDependencies()}_emitInputEventFromSource(e,i,r,n){this._emitInputEvent(0,e,i,r,n)}_emitInputEvent(e,i,r,n,s,o){const a=n!==void 0?n:this._currentPropagation?this._currentPropagation.timestamp:performance.now(),c=s!==void 0&&s,p={event:new c0t(i,r,a,o||this._activeKeyModifiers,c),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(p):this._doNewPropagation(p)}_doNewPropagation(e){this._currentPropagation={events:new aU,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){var i,r,n;this._paused=!1;const e=this._currentPropagation;if(e){for(;e.events.length>0;){const{event:s,priorityIndex:o}=e.events.pop(),a=(i=s.data)==null?void 0:i.eventId;if(!(a!=null&&this._stoppedPropagationEventIds.has(a)))for(e.currentHandler=this._handlersPriority[o];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!s.shouldStopPropagation()&&((n=(r=e.currentHandler).eventCallback)==null||n.call(r,s)),s.shouldStopPropagation()){a!=null&&this._stoppedPropagationEventIds.add(a);break}if(s.shouldPausePropagation(()=>this._continuePropagation()))return void this._pausePropagation({event:s,priorityIndex:e.currentHandler.priorityIndex+1})}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}}_pausePropagation(e){const i=new aU;i.push(e);const r=this._currentPropagation;if(r){for(;r.events.length;)i.push(r.events.pop());r.events=i,r.currentHandler=null,this._paused=!0}}_compareHandlerPriority(e,i){if(e.handler.hasSideEffects!==i.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==i.groupPriority)return e.groupPriority>i.groupPriority?-1:1;for(const r of e.handler.incomingEventMatches)for(const n of i.handler.incomingEventMatches){if(r.eventType!==n.eventType)continue;const s=r.keyModifiers.filter(o=>n.keyModifiers.includes(o));if(s.length===r.keyModifiers.length!=(s.length===n.keyModifiers.length))return r.keyModifiers.length>n.keyModifiers.length?-1:1}return e.priorityIndex>i.priorityIndex?-1:1}_sortHandlersPriority(e){const i=[];for(const r of e){let n=0;for(;n=0;)n++;i.splice(n,0,r)}return i}get debug(){const e=i=>{const r=this._setPointerCapture;this._setPointerCapture=()=>{},i(),this._setPointerCapture=r};return{injectEvent:(i,r)=>{e(()=>{this._onEventReceived(i,r)})},disablePointerCapture:e}}};y([w({readOnly:!0})],Kp.prototype,"hasPendingInputs",null),y([w({constructOnly:!0})],Kp.prototype,"eventSource",void 0),y([w({constructOnly:!0})],Kp.prototype,"recognizers",void 0),y([w()],Kp.prototype,"_latestPointerType",void 0),y([w()],Kp.prototype,"latestPointerType",null),y([w()],Kp.prototype,"multiTouchActive",null),y([w({readOnly:!0})],Kp.prototype,"latestPointerLocation",void 0),y([w()],Kp.prototype,"_paused",void 0),y([w({readOnly:!0})],Kp.prototype,"updating",null),Kp=y([Z("esri.views.input.InputManager")],Kp);let c0t=class{constructor(e,i,r,n,s){this.type=e,this.data=i,this.timestamp=r,this.modifiers=n,this.cancelable=s,this._propagationState=Uw.NONE,this._resumeCallback=null}stopPropagation(){this._propagationState|=Uw.STOPPED}shouldStopPropagation(){return(this._propagationState&Uw.STOPPED)!=0}async(e){this._propagationState|=Uw.PAUSED;const i=(r,n)=>{this._propagationState&=~Uw.PAUSED;const s=this._resumeCallback;if(this._resumeCallback=null,s&&s(),n)throw r;return r};return(typeof e=="function"?e():e).then(r=>i(r,!1),r=>i(r,!0))}shouldPausePropagation(e){return!!(this._propagationState&Uw.PAUSED)&&(this._resumeCallback=e,!0)}preventDefault(){this.data.native.preventDefault()}};var Uw;(function(t){t[t.NONE=0]="NONE",t[t.STOPPED=1]="STOPPED",t[t.PAUSED=2]="PAUSED"})(Uw||(Uw={}));const Cs={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};let u0t=class{};const h0t=u0t;function sg(t){return t!=null&&"open"in t&&"declaredClass"in t}function eme(t){return t!=null&&"declaredClass"in t&&"dockOptions"in t}const d0t=t=>{let e=class extends t{constructor(){super(...arguments),this._popupSetupTask=null,this.popup={},this.popupEnabled=!0}initialize(){this.addHandles([_e(()=>[this.ui,this.popup],([i,r],n)=>{const s="popup",o="manual";if(n){const[a,c]=n;a&&sg(c)&&(c.view=null,eme(c)&&a.remove(c,s))}i&&sg(r)&&(r.view=this,eme(r)&&i.add(r,{key:s,position:o,internal:!0}))},Qt),this.on("click",i=>{this.popup&&this.popupEnabled&&(i.pointerType!=="mouse"||i.button===0)&&(!sg(this.popup)&&"autoOpenEnabled"in this.popup&&this.popup.autoOpenEnabled===!1||(sg(this.popup)?this.popup.viewModel.handleViewClick(i):i.async(async()=>{await this.setupPopup(),sg(this.popup)&&!this.destroyed&&this.ready&&this.popupEnabled&&this.popup.viewModel.handleViewClick(i)})))},Cs.WIDGET)]),dd(()=>this.ready&&this.popupEnabled&&!this.updating).then(()=>{we(()=>import("./Popup-a4-j6aRT.js"),__vite__mapDeps([111,112,13,14,15,16,17,18,19,20,21,22,23,24,113,114]))})}destroy(){this.destroyed||this.closePopup()}async openPopup(i){if(sg(this.popup))return this.popup.open(i);try{if(await this.setupPopup(),!this.popup)return void Ce.getLogger(this).error(new se("view:null-popup","Popup is null and can't be opened"));this.popup.open(i)}catch{}}closePopup(){var i;(i=this._popupSetupTask)==null||i.abort(),sg(this.popup)&&this.popup.close()}async fetchPopupFeatures(i,r){await this.when();const{location:n,queryArea:s,layerViewsAndGraphics:o,clientOnlyGraphics:a}=await this._prepareFetchPopupFeatures(i,r),c=Promise.resolve(a),p=this._queryLayerPopupFeatures(s,o,r),_=p.map(x=>x.promise);return{location:n,clientOnlyGraphics:a,allGraphicsPromise:oHe([c,..._]).then(x=>Array.from(new Set(x.flat()))),promisesPerLayerView:p}}async setupPopup(){var i;if((i=this._popupSetupTask)==null||i.abort(),this.popup&&!sg(this.popup))return this._popupSetupTask=Oc(async r=>{const{default:n}=await we(()=>import("./Popup-a4-j6aRT.js"),__vite__mapDeps([111,112,13,14,15,16,17,18,19,20,21,22,23,24,113,114]));if(St(r),!this.popup||sg(this.popup))return;const s=this.popup;delete s.open,delete s.close,this.popup=new n(s)}),this._popupSetupTask.promise}_queryLayerPopupFeatures(i,r,n){return r.map(({layerView:s,graphics:o})=>{const a={clientGraphics:o,event:n!=null?n.event:void 0,signal:n!=null?n.signal:void 0,defaultPopupTemplateEnabled:n!=null&&!!n.defaultPopupTemplateEnabled},c=s.fetchPopupFeatures(i,a);return{layerView:s,promise:c}})}_isValidPopupGraphic(i,r){return i&&!!i.getEffectivePopupTemplate(r!=null&&r.defaultPopupTemplateEnabled)}async _prepareFetchPopupFeatures(i,r){const{clientGraphics:n,queryArea:s,location:o}=await this._popupHitTestGraphics(i,r),a=this._getFetchPopupLayerViews(),{layerViewsAndGraphics:c,clientOnlyGraphics:p}=this._graphicsPerFetchPopupLayerView(n,a);return{clientOnlyGraphics:p,layerViewsAndGraphics:c,queryArea:s,location:o}}async _popupHitTestGraphics(i,r){const n=await this.popupHitTest(i),s=n.results,o=n.mapPoint,a=s.filter(p=>p.type==="graphic"&&this._isValidPopupGraphic(p.graphic,r)),c=a.length?a[0].mapPoint:null;return{clientGraphics:a.map(p=>p.graphic),queryArea:o,location:o||c}}_getFetchPopupLayerViews(){const i=[];return this.allLayerViews.forEach(r=>{this._isValidPopupLayerView(r)&&i.push(r)}),this.graphicsView!=null&&this._isValidPopupLayerView(this.graphicsView)&&i.push(this.graphicsView),i.reverse()}_isValidPopupLayerView(i){return i!=null&&(!("layer"in i)||!i.suspended)&&"fetchPopupFeatures"in i}_graphicsPerFetchPopupLayerView(i,r){const n=[],s=new Map,o=r.map(a=>{const c=[];return"layer"in a?s.set(a.layer,c):s.set(a.graphics,c),{layerView:a,graphics:c}});for(const a of i){const c=s.get(a.layer)||s.get(a.sourceLayer)||null;c?c.push(a):n.push(a)}return{layerViewsAndGraphics:o,clientOnlyGraphics:n}}};return y([w({cast(i){return!i||sg(i)||typeof i=="object"&&(i.open=r=>(GO(Ce.getLogger(this),"view.popup is no longer created by default. view.popup.open() will stop working when the popup isn't created",{replacement:"Use view.openPopup() instead.",version:"4.27"}),this.openPopup(r)),i.close=()=>(GO(Ce.getLogger(this),"view.popup is no longer created by default. view.popup.close() will stop working when the popup isn't created",{replacement:"Use view.closePopup() instead.",version:"4.27"}),this.closePopup())),i}})],e.prototype,"popup",void 0),y([w()],e.prototype,"popupEnabled",void 0),e=y([Z("esri.views.PopupView")],e),e};let dw=class extends ze{constructor(e){super(e),this.view=null,this.baseLayerViews=new tt,this.referenceLayerViews=new tt,this._loadingHandle=_e(()=>{var i,r;return(r=(i=this.view)==null?void 0:i.map)==null?void 0:r.basemap},i=>{i&&i.load().catch(()=>{})},Qt)}destroy(){this._set("view",null),this._loadingHandle&&(this._loadingHandle.remove(),this._loadingHandle=null);for(const e of this.baseLayerViews)e.destroy();this.baseLayerViews.length=0;for(const e of this.referenceLayerViews)e.destroy();this.referenceLayerViews.length=0}get suspended(){return!this.view||this.view.suspended}get updating(){var i,r;if(this.view&&this.view.suspended)return!1;const e=(r=(i=this.view)==null?void 0:i.map)==null?void 0:r.basemap;return!!e&&!!e.loaded&&(this.baseLayerViews.some(n=>n.updating)||this.referenceLayerViews.some(n=>n.updating))}};y([w({constructOnly:!0})],dw.prototype,"view",void 0),y([w({readOnly:!0})],dw.prototype,"baseLayerViews",void 0),y([w({readOnly:!0})],dw.prototype,"referenceLayerViews",void 0),y([w({readOnly:!0})],dw.prototype,"suspended",null),y([w({type:Boolean,readOnly:!0})],dw.prototype,"updating",null),dw=y([Z("esri.views.BasemapView")],dw);function p0t(t){return"tryRecycleWith"in t}let f0t=class{constructor(e,i,r){this.layer=e,this.view=i,this.layerViewImporter=r,this._controller=new AbortController,this._deferred=ec(),this._started=!1,this.done=!1,this.promise=this._deferred.promise,Zl(this._controller.signal,()=>{const n=new se("cancelled:layerview-create","layerview creation cancelled",{layer:e});this._deferred.reject(n)})}tryRecycle(e){if(!this.done||!this.layerView||!p0t(this.layerView))return null;const i=this.layer.type,r=this._controller.signal;for(let n=0;n(St(this._controller.signal),s.emit("layerview-destroy",{view:c,layerView:a}),c.emit("layerview-destroy",{view:c,layerView:a}),s.emit("layerview-create",{view:c,layerView:a}),c.emit("layerview-create",{view:c,layerView:a}),a)),new Promise((p,_)=>Zl(this._controller.signal,()=>_(ur())))]),this.promise}}return null}destroy(){this._controller.abort();const{layerView:e}=this;if(e){const{layer:i,view:r}=this;i.emit("layerview-destroy",{view:r,layerView:e}),r.emit("layerview-destroy",{layer:i,layerView:e})}this.done=!0,this.layer=null,this.layerView=null,this.view=null,this.layerViewImporter=null,this._map=null}async start(){var n,s;if(this._started)return;this._started=!0;const{_controller:{signal:e},layer:i,view:r}=this;this._map=r.map;try{let o,a;if(await i.load({signal:e}),i.prefetchResources&&await i.prefetchResources({signal:e}),g0t(i))o=await i.createLayerView(r,{signal:e});else{if(!this.layerViewImporter.hasLayerViewModule(i))throw new se("layer:view-not-supported","No layerview implementation was found");const _=await this.layerViewImporter.importLayerView(i);St(e),o="default"in _?new _.default({layer:i,view:r}):new _({layer:i,view:r})}const c=()=>{a=en(a),o.destroyed||o.destroy(),o.layer=null,o.parent=null,o.view=null,this.done=!0};a=Zl(e,c),St(e);try{await o.when()}catch(_){throw c(),_}if(!((s=(n=this._map)==null?void 0:n.allLayers)==null?void 0:s.includes(i)))return c(),void this._deferred.reject(new se("view:no-layerview-for-layer","The layer has been removed from the map",{layer:i}));this.layerView=o,i.emit("layerview-create",{view:r,layerView:o}),r.emit("layerview-create",{layer:i,layerView:o}),this.done=!0,this._deferred.resolve(o)}catch(o){i.emit("layerview-create-error",{view:r,error:o}),r.emit("layerview-create-error",{layer:i,error:o}),this.done=!0,this._deferred.reject(new se("layerview:create-error","layerview creation failed",{layer:i,error:o}))}}},Qp=class extends ze{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new Nf,this.supportsGround=!0,this._preloadLayerViewModules=()=>{var r;const i=(r=this.view.map)==null?void 0:r.allLayers;if(i)for(const n of i)this.layerViewImporter.hasLayerViewModule(n)&&this.layerViewImporter.importLayerView(n)},this._reschedule=()=>this.destroyed?Promise.reject():(this._workPromise==null&&(this._workPromise=ec(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(ox(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{var c,p,_;if(this.destroyed)return;const i=this.view.map;if(this._map!==i&&(this.clear(),this._map=i),this._workPromise==null)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,n=[],s=this.view.ready,o=x=>{if(x!=null){for(const S of x)if(S){r.add(S);const C=this._layerLayerViewInfoMap.get(S);C&&s?C.start():C||this._recyclingInfoMap.has(S)||n.push(S),"layers"in S&&S.layers&&o(S.layers)}}};for(const x of this._rootCollectionNames)o(uu(this,x));for(const[x,S]of this._layerLayerViewInfoMap)if(!r.has(x)){this._layerLayerViewInfoMap.delete(S.layer);const C=S.tryRecycle(n);C?(this.notifyChange("updating"),this._recyclingInfoMap.set(S.layer,S),C.then(()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(S.layer),this._layerLayerViewInfoMap.set(S.layer,S),this._reschedule()}).catch(()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(S.layer),S.destroy(),this._reschedule()})):S.destroy()}for(const[x,S]of this._recyclingInfoMap)r.has(x)||(this.notifyChange("updating"),this._recyclingInfoMap.delete(S.layer),S.destroy());for(const x of n)this._createLayerView(x);this._refreshCollections();const a=[(c=i==null?void 0:i.ground)==null?void 0:c.layers,(p=i==null?void 0:i.basemap)==null?void 0:p.baseLayers,(_=i==null?void 0:i.basemap)==null?void 0:_.referenceLayers,i==null?void 0:i.layers].filter(x=>!!x);r.forEach(x=>"layers"in x&&a.push(x.layers)),this.addHandles(a.map(x=>this._watchUpdatingTracking.addOnCollectionChange(()=>x,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null}}initialize(){this.addHandles([Jr(()=>{var e,i;return(i=(e=this.view)==null?void 0:e.map)==null?void 0:i.allLayers},"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),_e(()=>{const e=this.view,i=e==null?void 0:e.map;return[i==null?void 0:i.basemap,i==null?void 0:i.ground,i==null?void 0:i.layers,e==null?void 0:e.ready]},()=>this._reschedule(),kt)]),this._preloadLayerViewModules(),this._reschedule()}destroy(){this.clear(),tq(this._recyclingInfoMap),tq(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,this._workPromise!=null&&(this._workPromise.reject(ur()),this._workPromise=null)}get _layersToLayerViews(){const e=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.layers","view.layerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"]];return this.supportsGround&&e.push(["view.map.ground.layers","view.groundView.layerViews"]),new Map(e)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return this._workPromise!=null||this._watchUpdatingTracking.updating||ap(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const i of this._layerLayerViewInfoMap.values())i.done||++e;return e}clear(){this.destroyed||(tq(this._layerLayerViewInfoMap),this._refreshCollections())}async whenLayerView(e){if(await this._reschedule(),!this._layerLayerViewInfoMap.has(e)){if(this._recyclingInfoMap.has(e))return this._recyclingInfoMap.get(e).promise;throw new se("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e})}return this._layerLayerViewInfoMap.get(e).promise}_refreshCollections(){for(const[e,i]of this._layersToLayerViews)this._populateLayerViewsOwners(uu(this,e),uu(this,i),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_populateLayerViewsOwners(e,i,r){if(!e||!i)return void(i&&i.removeAll());let n=0;for(const s of e){const o=this._layerLayerViewInfoMap.get(s);if(!(o!=null&&o.layerView))continue;const a=o.layerView;a.layer=s,a.parent=r,i.at(n)!==a&&i.splice(n,0,a),s.layers&&this._populateLayerViewsOwners(s.layers,a.layerViews,a),n+=1}n{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const i=new f0t(e,this.view,this.layerViewImporter);i.promise.then(()=>this._refreshCollections(),r=>{r&&(on(r)||r.name==="cancelled:layerview-create")||Ce.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,i),this.view.ready&&i.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};y([w()],Qp.prototype,"_workPromise",void 0),y([w({readOnly:!0})],Qp.prototype,"_watchUpdatingTracking",void 0),y([w({readOnly:!0})],Qp.prototype,"_layersToLayerViews",null),y([w({readOnly:!0})],Qp.prototype,"_rootCollectionNames",null),y([w()],Qp.prototype,"layerViewImporter",void 0),y([w()],Qp.prototype,"supportsGround",void 0),y([w({readOnly:!0})],Qp.prototype,"updating",null),y([w({readOnly:!0})],Qp.prototype,"updatingRemaining",null),y([w({constructOnly:!0})],Qp.prototype,"view",void 0),Qp=y([Z("esri.views.LayerViewManager")],Qp);const m0t=Qp;function g0t(t){return"createLayerView"in t&&t.createLayerView!=null}let Nd=class extends ze{constructor(e){super(e),this.factor=1.5,this.offset=Qu(0,0),this.position=null,this.size=120,this.maskUrl=null,this.maskEnabled=!0,this.overlayUrl=null,this.overlayEnabled=!0,this.visible=!0}get version(){return this.commitProperty("factor"),this.commitProperty("offset"),this.commitProperty("position"),this.commitProperty("visible"),this.commitProperty("size"),this.commitProperty("maskUrl"),this.commitProperty("maskEnabled"),this.commitProperty("overlayUrl"),this.commitProperty("overlayEnabled"),(this._get("version")||0)+1}};y([w({type:Number})],Nd.prototype,"factor",void 0),y([w({nonNullable:!0})],Nd.prototype,"offset",void 0),y([w()],Nd.prototype,"position",void 0),y([w({type:Number,range:{min:0}})],Nd.prototype,"size",void 0),y([w()],Nd.prototype,"maskUrl",void 0),y([w()],Nd.prototype,"maskEnabled",void 0),y([w()],Nd.prototype,"overlayUrl",void 0),y([w()],Nd.prototype,"overlayEnabled",void 0),y([w({readOnly:!0})],Nd.prototype,"version",null),y([w({type:Boolean})],Nd.prototype,"visible",void 0),Nd=y([Z("esri.views.Magnifier")],Nd);const f4e=Nd;let a4=class extends Xs(ze){constructor(e){super(e),this.accentColor=new qe([255,127,0]),this.textColor=new qe([255,255,255])}};y([w({type:qe,nonNullable:!0})],a4.prototype,"accentColor",void 0),y([w({type:qe,nonNullable:!0})],a4.prototype,"textColor",void 0),a4=y([Z("esri.views.Theme")],a4);const Iee=a4;var tme;(function(t){t[t.Left=0]="Left",t[t.Middle=1]="Middle",t[t.Right=2]="Right"})(tme||(tme={}));const m4e=["click","double-click","immediate-click","immediate-double-click","hold","drag","key-down","key-up","pointer-down","pointer-move","pointer-up","pointer-drag","mouse-wheel","pointer-enter","pointer-leave","gamepad","focus","blur"],g4e={};function y4e(t){return!!g4e[t]}function y0t(t){for(const e of t)if(!y4e(e))return!1;return!0}m4e.forEach(t=>{g4e[t]=!0});let v0t=class{constructor(e){this._handlers=new Map,this._counter=0,this._handlerCounts=new Map,this.view=e,this.inputManager=null}connect(e){e&&this.disconnect(),this.inputManager=e,this._handlers.forEach(({handler:i,priority:r},n)=>{var s;return(s=this.inputManager)==null?void 0:s.installHandlers(n,[i],r)})}disconnect(){this.inputManager&&this._handlers.forEach((e,i)=>{var r;return(r=this.inputManager)==null?void 0:r.uninstallHandlers(i)}),this.inputManager=null}destroy(){this.disconnect(),this._handlers.clear(),this.view=null}on(e,i,r,n){const s=Array.isArray(e)?e:e.split(",");if(!y0t(s))return s.some(y4e)&&console.error("Error: registering input events and other events on the view at the same time is not supported."),null;let o,a;Array.isArray(i)?a=i:(o=i,a=[]),typeof r=="function"?o=r:n=r,n=n??Cs.DEFAULT;const c=this._createUniqueGroupName(),p=new _0t(this.view,s,a,o);this._handlers.set(c,{handler:p,priority:n});for(const _ of s){const x=this._handlerCounts.get(_)||0;this._handlerCounts.set(_,x+1)}return this.inputManager&&this.inputManager.installHandlers(c,[p],n),rr(()=>this._removeHandler(c,s))}hasHandler(e){return!!this._handlerCounts.get(e)}_removeHandler(e,i){if(this._handlers.has(e)){this._handlers.delete(e);for(const r of i){const n=this._handlerCounts.get(r);n===void 0?console.error("Trying to remove handler for event that has no handlers registered: ",r):n===1?this._handlerCounts.delete(r):this._handlerCounts.set(r,n-1)}}this.inputManager&&this.inputManager.uninstallHandlers(e)}_createUniqueGroupName(){return this._counter+=1,`viewEvents_${this._counter}`}},_0t=class extends Rl{constructor(e,i,r,n){super(!0),this._latestDragStart=void 0,this.view=e;for(const s of i)switch(s){case"click":this.registerIncoming("click",r,o=>n(this._wrapClick(o)));break;case"double-click":this.registerIncoming("double-click",r,o=>n(this._wrapDoubleClick(o)));break;case"immediate-click":this.registerIncoming("immediate-click",r,o=>n(this._wrapImmediateClick(o)));break;case"immediate-double-click":this.registerIncoming("immediate-double-click",r,o=>n(this._wrapImmediateDoubleClick(o)));break;case"hold":this.registerIncoming("hold",r,o=>n(this._wrapHold(o)));break;case"drag":this.registerIncoming("drag",r,o=>{const a=this._wrapDrag(o);a&&n(a)});break;case"key-down":this.registerIncoming("key-down",r,o=>n(this._wrapKeyDown(o)));break;case"key-up":this.registerIncoming("key-up",r,o=>n(this._wrapKeyUp(o)));break;case"pointer-down":this.registerIncoming("pointer-down",r,o=>n(this._wrapPointer(o,"pointer-down")));break;case"pointer-move":this.registerIncoming("pointer-move",r,o=>n(this._wrapPointer(o,"pointer-move")));break;case"pointer-up":this.registerIncoming("pointer-up",r,o=>n(this._wrapPointer(o,"pointer-up")));break;case"pointer-drag":this.registerIncoming("pointer-drag",r,o=>n(this._wrapPointerDrag(o)));break;case"mouse-wheel":this.registerIncoming("mouse-wheel",r,o=>n(this._wrapMouseWheel(o)));break;case"pointer-enter":this.registerIncoming("pointer-enter",r,o=>n(this._wrapPointer(o,"pointer-enter")));break;case"pointer-leave":this.registerIncoming("pointer-leave",r,o=>n(this._wrapPointer(o,"pointer-leave")));break;case"gamepad":this.registerIncoming("gamepad",r,o=>{n(this._wrapGamepad(o))});break;case"focus":this.registerIncoming("focus",r,o=>{n(this._wrapFocus(o))});break;case"blur":this.registerIncoming("blur",r,o=>{n(this._wrapBlur(o))})}}_wrapFocus(e){return{type:"focus",timestamp:e.timestamp,native:e.data.native,cancelable:e.cancelable,stopPropagation:()=>e.stopPropagation(),async:i=>e.async(i),preventDefault:()=>e.preventDefault()}}_wrapBlur(e){return{type:"blur",timestamp:e.timestamp,native:e.data.native,cancelable:e.cancelable,stopPropagation:()=>e.stopPropagation(),async:i=>e.async(i),preventDefault:()=>e.preventDefault()}}_wrapClick(e){const{pointerType:i,button:r,buttons:n,x:s,y:o,native:a,eventId:c}=e.data,{cancelable:p,timestamp:_}=e;return{type:"click",pointerType:i,button:r,buttons:n,x:s,y:o,native:a,timestamp:_,screenPoint:Qu(s,o),mapPoint:this._getMapPoint(s,o),eventId:c,cancelable:p,stopPropagation:()=>e.stopPropagation(),async:x=>e.async(x),preventDefault:()=>e.preventDefault()}}_wrapDoubleClick(e){const{pointerType:i,button:r,buttons:n,x:s,y:o,native:a,eventId:c}=e.data,{cancelable:p,timestamp:_}=e;return{type:"double-click",pointerType:i,button:r,buttons:n,x:s,y:o,native:a,timestamp:_,mapPoint:this._getMapPoint(s,o),eventId:c,cancelable:p,stopPropagation:()=>e.stopPropagation(),async:x=>e.async(x),preventDefault:()=>e.preventDefault()}}_wrapImmediateClick(e){const{pointerType:i,button:r,buttons:n,x:s,y:o,native:a,eventId:c}=e.data,p=a.pointerId,{cancelable:_,timestamp:x}=e;return{type:"immediate-click",pointerId:p,pointerType:i,button:r,buttons:n,x:s,y:o,native:a,timestamp:x,mapPoint:this._getMapPoint(s,o),eventId:c,cancelable:_,stopPropagation:()=>e.stopPropagation(),async:S=>e.async(S),preventDefault:()=>e.preventDefault()}}_wrapImmediateDoubleClick(e){const{pointerType:i,button:r,buttons:n,x:s,y:o,native:a,eventId:c}=e.data,p=a.pointerId,{cancelable:_,timestamp:x}=e;return{type:"immediate-double-click",pointerId:p,pointerType:i,button:r,buttons:n,x:s,y:o,native:a,timestamp:x,mapPoint:this._getMapPoint(s,o),eventId:c,cancelable:_,stopPropagation:()=>e.stopPropagation(),async:S=>e.async(S),preventDefault:()=>e.preventDefault()}}_wrapHold(e){const{pointerType:i,button:r,buttons:n,x:s,y:o,native:a}=e.data,{cancelable:c,timestamp:p}=e;return{type:"hold",pointerType:i,button:r,buttons:n,x:s,y:o,native:a,timestamp:p,mapPoint:this._getMapPoint(s,o),cancelable:c,stopPropagation:()=>e.stopPropagation(),async:_=>e.async(_),preventDefault:()=>e.preventDefault()}}_getMapPoint(e,i){return this.view.toMap(Qu(e,i),{exclude:[]})}_wrapDrag(e){const i=e.data,{x:r,y:n}=i.center,{action:s,pointerType:o,button:a}=i;if(s==="start"&&(this._latestDragStart=i),!this._latestDragStart)return;const c=i.pointer.native,p=i.buttons,{cancelable:_,timestamp:x}=e,S={x:this._latestDragStart.center.x,y:this._latestDragStart.center.y};return s==="end"&&(this._latestDragStart=void 0),{type:"drag",action:s,x:r,y:n,origin:S,pointerType:o,button:a,buttons:p,radius:i.radius,angle:mu(i.angle),native:c,timestamp:x,cancelable:_,stopPropagation:()=>e.stopPropagation(),async:C=>e.async(C),preventDefault:()=>e.preventDefault()}}_wrapKeyDown(e){const{key:i,repeat:r,native:n}=e.data,{cancelable:s,timestamp:o}=e;return{type:"key-down",key:i,repeat:r,native:n,timestamp:o,cancelable:s,stopPropagation:()=>e.stopPropagation(),async:a=>e.async(a),preventDefault:()=>e.preventDefault()}}_wrapKeyUp(e){const{key:i,native:r}=e.data,{cancelable:n,timestamp:s}=e;return{type:"key-up",key:i,native:r,timestamp:s,cancelable:n,stopPropagation:()=>e.stopPropagation(),async:o=>e.async(o),preventDefault:()=>e.preventDefault()}}_wrapPointer(e,i){const{x:r,y:n,button:s,buttons:o,native:a,eventId:c}=e.data,p=a.pointerId,_=a.pointerType,{cancelable:x,timestamp:S}=e;return{type:i,x:r,y:n,pointerId:p,pointerType:_,button:s,buttons:o,native:a,timestamp:S,eventId:c,cancelable:x,stopPropagation:()=>e.stopPropagation(),async:C=>e.async(C),preventDefault:()=>e.preventDefault()}}_wrapPointerDrag(e){const{x:i,y:r,buttons:n,native:s,eventId:o}=e.data.currentEvent,{button:a}=e.data.startEvent,c=e.data.startEvent.native.pointerId,p=e.data.startEvent.native.pointerType,_=e.data.action,x={x:e.data.startEvent.x,y:e.data.startEvent.y},{cancelable:S,timestamp:C}=e;return{type:"pointer-drag",x:i,y:r,pointerId:c,pointerType:p,button:a,buttons:n,action:_,origin:x,native:s,timestamp:C,eventId:o,cancelable:S,stopPropagation:()=>e.stopPropagation(),async:M=>e.async(M),preventDefault:()=>e.preventDefault()}}_wrapMouseWheel(e){const{cancelable:i,data:r,timestamp:n}=e,{x:s,y:o,deltaY:a,native:c}=r;return{type:"mouse-wheel",x:s,y:o,deltaY:a,native:c,timestamp:n,cancelable:i,stopPropagation:()=>e.stopPropagation(),async:p=>e.async(p),preventDefault:()=>e.preventDefault()}}_wrapGamepad(e){const{action:i,state:r,device:n}=e.data,{cancelable:s,timestamp:o}=e,{buttons:a,axes:c}=r;return{type:"gamepad",device:n,timestamp:o,action:i,buttons:a,axes:c,cancelable:s,stopPropagation:()=>e.stopPropagation(),async:p=>e.async(p),preventDefault:()=>e.preventDefault()}}};var DL,ime,rme;(function(t){t[t.USER=0]="USER",t[t.MANAGER=1]="MANAGER"})(DL||(DL={})),function(t){t[t.None=0]="None",t[t.Unfocused=1]="Unfocused",t[t.Focused=2]="Focused",t[t.Unselected=4]="Unselected",t[t.Selected=8]="Selected",t[t.All=15]="All"}(ime||(ime={})),function(t){t[t.None=0]="None",t[t.Custom1=16]="Custom1",t[t.Custom2=32]="Custom2",t[t.Custom3=64]="Custom3",t[t.Custom4=128]="Custom4",t[t.Custom5=256]="Custom5",t[t.Custom6=512]="Custom6",t[t.Custom7=1024]="Custom7",t[t.Custom8=2048]="Custom8",t[t.Custom9=4096]="Custom9",t[t.Custom10=8192]="Custom10",t[t.Custom11=16384]="Custom11",t[t.Custom12=32768]="Custom12",t[t.All=65520]="All"}(rme||(rme={}));function b0t(t){return[t.on("before-add",e=>{const i=e.item;if(i==null||t.includes(i))return Ce.getLogger("esri.views.interactive.interactiveToolUtils").warn("Tool is either already in the list of tools or tool is `null`. Not adding tool."),void e.preventDefault();i.onAdd()}),t.on("after-remove",e=>{const i=e.item;i.active&&(i.view.activeTool=null),i.destroy()})]}function $ee(t){return t.visible&&t.getEditableFlag!=null&&t.getEditableFlag(DL.USER)&&t.getEditableFlag(DL.MANAGER)}function uf(t){return Qu(t.x,t.y)}function xii(t){return ss(t.x,t.y)}function v4e(t,e){var r;const i=(r=t instanceof HTMLElement?t:t.surface)==null?void 0:r.getBoundingClientRect();return i?Qu(e.clientX-i.left,e.clientY-i.top):Qu(0,0)}function nme(t,e){return e instanceof Event?v4e(t,e):uf(e)}function sme(t){if(t instanceof Event)return!0;if(typeof t=="object"&&"type"in t)switch(t.type){case"click":case"double-click":case"pointer-down":case"pointer-drag":case"pointer-enter":case"pointer-leave":case"pointer-up":case"pointer-move":case"immediate-click":case"immediate-double-click":case"hold":case"drag":case"mouse-wheel":return!0;default:return!1}return!1}let w0t=class{constructor(){this._pointerLocations=new Map,this._hoveredManipulators=new Map,this._grabbedManipulators=new Map,this._draggedManipulators=new Map,this._stopDrag=!1,this._revertToNullActiveTool=!1,this._cursor=null}get cursor(){return this._cursor}hasFocusedManipulators(){return this._grabbedManipulators.size>0||this._draggedManipulators.size>0}handleInputEvent(e,i){const r=()=>e.stopPropagation();switch(e.type){case"pointer-move":ome(e.pointerType)&&this._pointerLocations.set(e.pointerId,{x:e.x,y:e.y,pointerType:e.pointerType});break;case"drag":this._grabbedManipulators.size>0&&(this._stopDrag=!0),this._stopDrag&&(r(),e.action==="end"&&(this._stopDrag=!1));break;case"pointer-down":{if(!ame(e))break;const n=uf(e),s=this._intersect(n,e.pointerType,i.forEachTool);if(s==null)break;const o=s.manipulator,a=s.tool;o==null||a==null||!o.interactive||o.grabbable&&o.grabbableForEvent(e)||!o.grabbing||o.dragging||this._ungrabManipulatorBeforeDragging(o,e,i),o!=null&&a!=null&&o.interactive&&o.grabbable&&o.grabbableForEvent(e)&&!o.grabbing&&(this._grabbedManipulators.set(e.pointerId,{manipulator:o,tool:a,start:n,pointerType:e.pointerType}),this._grabbedManipulators.size===1&&i.activeTool==null&&(this._revertToNullActiveTool=!0,i.setActiveTool(s.tool)),o.grabbing=!0,o.events.emit("grab-changed",{action:"start",pointerType:e.pointerType,screenPoint:n}),r());break}case"pointer-up":this._draggedManipulators.has(e.pointerId)||this._handlePointerEnd(e,i);break;case"pointer-drag":{if(!ame(e))break;const n=this._grabbedManipulators.get(e.pointerId),s=n==null?void 0:n.manipulator,o=n==null?void 0:n.tool;if(s==null||o==null)break;const a=uf(e);a.x=Je(a.x,0,i.view.width),a.y=Je(a.y,0,i.view.height);const c=n.start,p=this._draggedManipulators.get(e.pointerId);switch(e.action){case"start":case"update":e.action!=="update"&&this._grabbedManipulators.size!==1||(s.dragging=!0,p?s.events.emit("drag",{action:"update",start:c,screenPoint:a}):s.events.emit("drag",{action:"start",start:c,screenPoint:a,pointerType:e.pointerType}),this._draggedManipulators.set(e.pointerId,{tool:o,manipulator:s,start:c}));break;case"end":s.dragging=!1,p&&s.events.emit("drag",{action:"end",start:c,screenPoint:a}),this._draggedManipulators.delete(e.pointerId),this._handlePointerEnd(e,i)}r();break}case"immediate-click":{const n=uf(e),s=this._intersect(n,e.pointerType,i.forEachTool);if(x0t(e)||i.forEachTool(p=>{if((s==null||s.tool!==p||p.automaticManipulatorSelection)&&p.manipulators){let _=!1;p.manipulators.forEach(({manipulator:x})=>{x.selected&&(x.selected=!1,_=!0)}),_&&p.onManipulatorSelectionChanged&&p.onManipulatorSelectionChanged()}}),s==null)break;const{manipulator:o,tool:a}=s;if(!o.interactive)break;o.selectable&&a.automaticManipulatorSelection&&(o.selected=!o.selected,a.onManipulatorSelectionChanged&&a.onManipulatorSelectionChanged());const c=e.native.shiftKey;o.events.emit("immediate-click",{screenPoint:n,button:e.button,pointerType:e.pointerType,shiftKey:c,stopPropagation:r}),pq(o,r);break}case"click":{const n=uf(e),s=this._intersect(n,e.pointerType,i.forEachTool),o=s==null?void 0:s.manipulator;if(o==null||!o.interactive)break;const a=e.native.shiftKey;o.events.emit(e.type,{screenPoint:n,button:e.button,pointerType:e.pointerType,shiftKey:a}),r();break}case"double-click":{const n=uf(e),s=this._intersect(n,e.pointerType,i.forEachTool),o=s!=null?s.manipulator:null;if(o==null||!o.interactive)break;const a=e.native.shiftKey;o.events.emit("double-click",{screenPoint:n,button:e.button,pointerType:e.pointerType,shiftKey:a,stopPropagation:r}),pq(o,r);break}case"immediate-double-click":{const n=uf(e),s=this._intersect(n,e.pointerType,i.forEachTool),o=s!=null?s.manipulator:null;if(o==null||!o.interactive)break;const a=e.native.shiftKey;o.events.emit("immediate-double-click",{screenPoint:n,button:e.button,pointerType:e.pointerType,shiftKey:a,stopPropagation:r}),pq(o,r);break}}this._onFocusChange(i.forEachTool)}_ungrabManipulatorBeforeDragging(e,i,r){e.grabbing=!1,e.events.emit("grab-changed",{action:"end",pointerType:i.pointerType,screenPoint:uf(i)}),this._grabbedManipulators.forEach(({manipulator:n},s)=>{n===e&&this._grabbedManipulators.delete(s)}),this._afterManipulatorUngrab(r.setActiveTool)}_handlePointerEnd(e,i){var n;const r=(n=this._grabbedManipulators.get(e.pointerId))==null?void 0:n.manipulator;r!=null&&r.grabbing&&(r.grabbing=!1,r.events.emit("grab-changed",{action:"end",pointerType:e.pointerType,screenPoint:uf(e)}),this._grabbedManipulators.delete(e.pointerId),this._afterManipulatorUngrab(i.setActiveTool))}_cursorFromMap(e){let i=null;return ap(e,({manipulator:r})=>!(r==null||!r.interactive)&&(r.grabbing&&r.grabCursor?(i=r.grabCursor,!0):!!r.cursor&&(i=r.cursor,!0))),i}_onFocusChange(e){this._updateCursor(),this._updateFocusedManipulatorTools(e)}_updateCursor(){this._grabbedManipulators.size>0?this._cursor=this._cursorFromMap(this._grabbedManipulators)||"grabbing":this._hoveredManipulators.size>0?this._cursor=this._cursorFromMap(this._hoveredManipulators)||"pointer":this._cursor=null}_updateFocusedManipulatorTools(e){const i=new Set,r=new Set;this._grabbedManipulators.forEach(({tool:n})=>{i.add(n)}),this._hoveredManipulators.forEach(({tool:n})=>{r.add(n)}),e(n=>{n.hasGrabbedManipulators=i.has(n),n.hasHoveredManipulators=r.has(n);const s=this._grabbedManipulators.values(),o=sGe(s,({tool:a})=>a===n);n.firstGrabbedManipulator=o!=null?o.manipulator:null})}clearPointers(e,{forEachTool:i,setActiveTool:r},n=!0,s){const o=(a,c)=>a===e&&(s==null||s===c);this._grabbedManipulators.forEach(({tool:a,manipulator:c,pointerType:p},_)=>{o(a,c)&&(this._grabbedManipulators.delete(_),c.grabbing=!1,c.events.emit("grab-changed",{action:"end",screenPoint:null,pointerType:p}))}),this._draggedManipulators.forEach(({tool:a,manipulator:c},p)=>{o(a,c)&&(this._draggedManipulators.delete(p),c.dragging=!1,c.events.emit("drag",{action:"cancel"}))}),n&&this._hoveredManipulators.forEach(({tool:a,manipulator:c},p)=>{o(a,c)&&(this._hoveredManipulators.delete(p),c.hovering=!1)}),this._afterManipulatorUngrab(r),this._onFocusChange(i)}_intersect(e,i,r){let n=null;return r(s=>{if(s.manipulators==null||!$ee(s))return!1;const o=s.manipulators.intersect(e,i);return o!=null&&(n={tool:s,manipulator:o},!0)}),n}updateHoveredStateFromKnownPointers(e){this._pointerLocations.forEach((i,r)=>{this._updateHoveredStateForPointerAtScreenPosition(Qu(i.x,i.y),r,i.pointerType,e)})}handleHoverEvent(e,i){e.type!=="pointer-up"&&e.type!=="immediate-click"&&e.type!=="pointer-move"||!ome(e.pointerType)||this._updateHoveredStateForPointerAtScreenPosition(uf(e),e.pointerId,e.pointerType,i)}_updateHoveredStateForPointerAtScreenPosition(e,i,r,n){var a;let s=this._intersect(e,r,n);const o=(a=this._hoveredManipulators.get(i))==null?void 0:a.manipulator;s==null||s.manipulator.interactive||(s=null),s!=null&&o===s.manipulator||(o!=null&&(o.hovering=!1),s!=null?(s.manipulator.hovering=!0,this._hoveredManipulators.set(i,s)):this._hoveredManipulators.delete(i),this._onFocusChange(n))}_afterManipulatorUngrab(e){this._grabbedManipulators.size===0&&this._revertToNullActiveTool&&(e(null),this._revertToNullActiveTool=!1)}};function ome(t){return t==="mouse"}function ame(t){return t.pointerType!=="mouse"||t.button===0}function x0t(t){return!!t.native.shiftKey}function pq(t,e){t!=null&&t.consumesClicks&&e()}const lme="attached",fq="tools",cme=1e3;let Lg=class extends ze{constructor(e){super(e),this._updatingHandles=new Nf,this._clock=E9,this._manipulatorState=new w0t,this.tools=new tt,this.cursor=null,this._interacting=!1,this._interactingTimeout=cme,this._interactingTimeoutHandle=null,this._forEachTool=i=>{for(const r of this.tools.items)if(i(r))return}}initialize(){this.addHandles([this.view.on(m4e,e=>{this._handleInputEvent(e)},Cs.TOOL),...b0t(this.tools),this.tools.on("before-add",({item:e})=>{this._updateToolEditableFlag(e)}),this.tools.on("before-remove",({item:e})=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs),this._updateCursor()}),this.tools.on("change",()=>{this._refreshToolWatchers()})])}destroy(){this.activeTool=null,this.tools.drain(e=>e.destroy()),this._clearInteractingTimeout(),this._interacting=!1,this._updatingHandles.destroy()}get _manipulatorStateEventArgs(){return{forEachTool:this._forEachTool,activeTool:this.activeTool,setActiveTool:e=>{this.activeTool=e},view:this.view}}set activeTool(e){if(e!=null&&!this.view.ready)return void Ce.getLogger(this).error("Cannot set active tool while view is not ready.");if(e===this.activeTool)return;const i=this.activeTool;this._set("activeTool",e),i!=null&&i.deactivate(),e!=null&&e.activate(),this._removeIncompleteTools(e);for(const r of this.tools){this._updateToolEditableFlag(r);const n=$ee(r);this.activeTool!=null&&n||this._manipulatorState.clearPointers(r,this._manipulatorStateEventArgs,!n)}this._updateCursor()}get updating(){return this._updatingHandles.updating||this.tools.some(e=>e.updating)}get interacting(){return this._interacting}_clearInteractingTimeout(){this._interactingTimeoutHandle=en(this._interactingTimeoutHandle)}_startInteractingTimeout(){this._clearInteractingTimeout(),this._interactingTimeoutHandle=this._clock.setTimeout(()=>this._interacting=!1,this._interactingTimeout)}attach(){var e;this.view.type==="3d"?this.addHandles([_e(()=>{const{state:i}=this.view;return"camera"in i&&i.camera},()=>this._forEachManipulator(i=>i.onViewChange())),(e=this.view.elevationProvider)==null?void 0:e.on("elevation-change",i=>this._forEachManipulator(r=>r.onElevationChange(i)))],lme):this.addHandles(_e(()=>this.view.extent,()=>this._forEachManipulator(i=>i.onViewChange())))}detach(){this.activeTool=null,this.tools.removeAll(),this.removeHandles(lme),this._clearInteractingTimeout(),this._interacting=!1}_forEachManipulator(e){this._forEachTool(i=>{i.manipulators&&i.manipulators.forEach(({manipulator:r})=>e(r,i))})}_handleInputEvent(e){let i=!1;const r={...e,stopPropagation:()=>{i=!0,e.stopPropagation()}};this.activeTool!=null?this.activeTool.handleInputEvent&&this.activeTool.handleInputEvent(r):this._forEachTool(n=>{!i&&n.visible&&n.handleInputEvent(r)}),!i&&e.type==="key-down"&&e.key==="Escape"&&this.activeTool&&(e.stopPropagation(),this.activeTool=null),this._manipulatorState.handleInputEvent(r,this._manipulatorStateEventArgs),i||this.activeTool==null||this.activeTool.handleInputEventAfter(r),this._manipulatorState.handleHoverEvent(r,this._forEachTool),this._updateCursor(),e.type==="pointer-move"&&(this._manipulatorState.hasFocusedManipulators()||this.activeTool)&&(this._interacting=!0,this._startInteractingTimeout())}_refreshToolWatchers(){this.removeHandles(fq),this._forEachTool(e=>{if(e instanceof ze){const i=_e(()=>[e.cursor,e.visible,e.editable],()=>{$ee(e)||this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs),this._updateCursor()});this.addHandles(i,fq)}e.manipulators&&this.addHandles([e.manipulators.on("after-remove",i=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs,!0,i.item.manipulator)}),e.manipulators.on("change",()=>{this._manipulatorState.updateHoveredStateFromKnownPointers(this._forEachTool),this._updateCursor()})],fq)}),this._manipulatorState.updateHoveredStateFromKnownPointers(this._forEachTool),this._updateCursor()}_updateToolEditableFlag(e){var i;(i=e.setEditableFlag)==null||i.call(e,DL.MANAGER,this.activeTool==null||e===this.activeTool)}_updateCursor(){let e=this._manipulatorState.cursor;e==null&&this._forEachTool(i=>!(i.cursor==null||!i.visible)&&(e=i.cursor,!0)),this._get("cursor")!==e&&this._set("cursor",e)}_removeIncompleteTools(e){this.tools.filter(i=>(e==null||i!==e)&&!i.created&&i.removeIncompleteOnCancel).forEach(i=>{this.tools.remove(i)})}get test(){const e=this;return{setClock:i=>this._clock=i,set interactingTimeoutEnabled(i){e._interactingTimeout=i?cme:0},get interactingTimeoutEnabled(){return e._interactingTimeout!==0}}}};y([w({constructOnly:!0,nonNullable:!0})],Lg.prototype,"view",void 0),y([w({value:null})],Lg.prototype,"activeTool",null),y([w({readOnly:!0,type:tt})],Lg.prototype,"tools",void 0),y([w({readOnly:!0})],Lg.prototype,"cursor",void 0),y([w({readOnly:!0})],Lg.prototype,"updating",null),y([w()],Lg.prototype,"_interacting",void 0),y([w({readOnly:!0})],Lg.prototype,"interacting",null),Lg=y([Z("esri.views.ToolViewManager")],Lg);let UA=class extends ze{constructor(e){super(),this.nativeIndex=null,this._detectedDeviceType="unknown",e.mapping==="standard"?this._detectedDeviceType="standard":S0t.test(e.id)?this._detectedDeviceType="spacemouse":this._detectedDeviceType="unknown",this.nativeIndex=e.index}get native(){const e=navigator.getGamepads?navigator.getGamepads():[];return this.nativeIndex!=null&&this.nativeIndexPromise.resolve().then(()=>rRt),void 0).then(e=>Lee=e)),await mq,St(t)}async function w4e(t,e,i,r){if(!t)return null;const n=t.spatialReference;return hx()||rh(n,e)?sl(t,e):Lee?Lee.projectGeometry(t,e,i,r):(await Promise.race([A0t(r),S_(r)]),w4e(t,e,i,r))}let us=class extends ze{constructor(e){super(e),this.required={tileInfo:!1,heightModelInfo:!1,extent:!1},this.defaultSpatialReference=null,this.userSpatialReference=null,this.sourcePreloadCount=10,this.priorityCollection=null,this.requiresExtentInSpatialReference=!0,this.suspended=!1,this._projectExtentTask={task:null,input:null,output:null,spatialReference:null}}destroy(){this._projectExtentTask.task&&(this._projectExtentTask.task=vn(this._projectExtentTask.task)),this._set("map",null)}get ready(){return!this._spatialReferenceTask.updating&&!this._tileInfoTask.updating&&!this._extentTask.updating}get heightModelInfoReady(){return!this._heightModelInfoTask.updating}get spatialReference(){return this.userSpatialReference!=null?this.userSpatialReference:this._spatialReferenceTask.spatialReference}get extent(){return this._extentTask.extent}get heightModelInfo(){return this._heightModelInfoTask.heightModelInfo}get vcsWkid(){return this._heightModelInfoTask.vcsWkid}get latestVcsWkid(){return this._heightModelInfoTask.latestVcsWkid}get viewingMode(){return this.userSpatialReference==null||this.userSpatialReference.equals(this._spatialReferenceTask.spatialReference)?this._spatialReferenceTask.viewingMode:null}get tileInfo(){return this._tileInfoTask.tileInfo}get mapCollections(){var r,n,s,o;const e=(r=this.map)==null?void 0:r.call(this),i=[];return this.priorityCollection!=null&&i.push(this.priorityCollection),i.push({parent:e==null?void 0:e.basemap,layers:(n=e==null?void 0:e.basemap)==null?void 0:n.baseLayers},{layers:e==null?void 0:e.layers},{parent:e==null?void 0:e.ground,layers:(s=e==null?void 0:e.ground)==null?void 0:s.layers},{parent:e==null?void 0:e.basemap,layers:(o=e==null?void 0:e.basemap)==null?void 0:o.referenceLayers}),i}get _allLayers(){return this._collectLayers(this.mapCollections)}get _spatialReferenceTask(){if(this.suspended)return this._get("_spatialReferenceTask")??{updating:!1};const{layers:e,updating:i}=this._allLayers;let r=null;for(const s of e){const o=this._getSupportedSpatialReferences(s);if(o.length>0){const a=this._narrowDownSpatialReferenceCandidates(r,o);a!=null&&(r=a)}if(r!=null&&r.length===1)break}if(i&&(r==null||r.length!==1))return{updating:!0};const n=this._pickSpatialReferenceCandidate(r);return{spatialReference:n!=null?n.spatialReference:null,viewingMode:n!=null?n.viewingMode:null,updating:!1}}get _tileInfoTask(){var r,n,s,o,a,c,p;if(!this.required.tileInfo)return this._get("_tileInfoTask")??{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const{layers:e,updating:i}=this._collectLayers([{parent:(n=(r=this.map)==null?void 0:r.call(this))==null?void 0:n.basemap,layers:(a=(o=(s=this.map)==null?void 0:s.call(this))==null?void 0:o.basemap)==null?void 0:a.baseLayers},{layers:(p=(c=this.map)==null?void 0:c.call(this))==null?void 0:p.layers}]);if(e&&e.length>0&&"tileInfo"in e[0]){const _=e[0].tileInfo;return{tileInfo:_&&_.spatialReference.equals(this.spatialReference)?_:null,updating:!1}}return{updating:i}}get _heightModelInfoTask(){var r,n,s;if(!this.required.heightModelInfo||this.suspended&&((r=this._get("_heightModelInfoTask"))!=null&&r.heightModelInfo))return this._get("_heightModelInfoTask")??{updating:!1};const{layers:e,updating:i}=this._allLayers;for(const o of e)if(Uut(o)){const a=_Re(o);if(a)return{heightModelInfo:a,vcsWkid:(n=o.spatialReference)==null?void 0:n.vcsWkid,latestVcsWkid:(s=o.spatialReference)==null?void 0:s.latestVcsWkid,updating:!1}}return{updating:i}}get _extentCandidatesTask(){if(this.suspended||!this.required.extent)return this._get("_extentCandidatesTask")??{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const e=this._allLayers,i=e.updating,r=[];for(const n of e.layers){const s="fullExtents"in n&&n.fullExtents||(n.fullExtent!=null?[n.fullExtent]:[]),o=this.requiresExtentInSpatialReference?null:s[0],a=s.find(c=>c.spatialReference.equals(this.spatialReference))??o;if(a)return{candidates:[{extent:a,layer:n}],updating:!1};if(this._getSupportedSpatialReferences(n).length>0)for(const c of s)r.push({extent:c,layer:n})}return{candidates:r,updating:i}}get _extentTask(){const{candidates:e,updating:i}=this._extentCandidatesTask;if(i)return{updating:i};if(e==null||e.length===0)return{updating:!1};if(!this.spatialReference)return{updating:this._spatialReferenceTask.updating};const r=this._pickExtentCandidate(e),n=this.spatialReference;return r.extent.equals(this._projectExtentTask.input)&&n.equals(this._projectExtentTask.spatialReference)?{extent:this._projectExtentTask.output,updating:this._projectExtentTask.task!=null&&!this._projectExtentTask.task.finished}:(this._projectExtentTask.task!=null&&(this._projectExtentTask.task=vn(this._projectExtentTask.task)),this._projectExtentTask={input:r.extent.clone(),output:null,spatialReference:n.clone(),task:Oc(async s=>{try{const o=await w4e(r.extent,n,"portalItem"in r.layer?r.layer.portalItem:void 0,s);this._projectExtentTask={...this._projectExtentTask,task:null,output:o}}catch{if(So(s))return;this._projectExtentTask={...this._projectExtentTask,task:null}}})},{updating:!0})}_narrowDownSpatialReferenceCandidates(e,i){if(e==null)return i;const r=[],n=(s,o)=>s!=null?o!=null?s===o&&s:s:o;for(const s of e)for(const o of i){if(!s.spatialReference.equals(o.spatialReference))continue;const a=n(s.viewingMode,o.viewingMode);if(a!==!1){r.push({spatialReference:s.spatialReference,viewingMode:a});break}}return r.length>0?r:null}_pickSpatialReferenceCandidate(e){const i=this.defaultSpatialReference;return e==null||e.length<1?i!=null?{spatialReference:i,viewingMode:null}:null:(i!=null&&e.length>1&&e.some(({spatialReference:r})=>r.equals(i))&&(e=e.filter(({spatialReference:r})=>r.equals(i))),e.length>1&&e.some(({viewingMode:r})=>r!==_t.Local)&&(e=e.filter(({viewingMode:r})=>r!==_t.Local)),e[0])}_getSupportedSpatialReferences(e){const i="supportedSpatialReferences"in e&&e.supportedSpatialReferences||(e.spatialReference?[e.spatialReference]:[]);if(i.length===0)return[];const r=[];for(const n of i){const s=this.getSpatialReferenceSupport({spatialReference:n,layer:e});if(s!=null){const o=s.constraints!=null?s.constraints:[{spatialReference:n,viewingMode:null}];for(const{spatialReference:a,viewingMode:c}of o)this.requiresExtentInSpatialReference&&this.userSpatialReference!=null&&!a.equals(this.userSpatialReference)||r.push({spatialReference:a,viewingMode:c})}}return r}_pickExtentCandidate(e){const i=this.spatialReference;return e.find(({extent:r})=>i.equals(r.spatialReference))||e[0]}_collectLayers(e){var r;if(this._loadMaybe((r=this.map)==null?void 0:r.call(this))!=="loaded")return{layers:[],updating:!0};const i=new M0t;for(const n of e)if(this._collectCollection(n,i),i.preloading===this.sourcePreloadCount)break;return{layers:i.layers,updating:i.updating}}_collectCollection(e,i){if(e.layers){switch(this._loadMaybe(e.parent)){case"loading":return i.updating=!0,void++i.preloading;case"failed":return}for(const r of e.layers){switch(this._loadMaybe(r)){case"failed":continue;case"loading":i.updating=!0,++i.preloading;break;case"loaded":i.updating||i.layers.push(r),"layers"in r&&this._collectCollection({layers:r.layers},i)}if(i.preloading===this.sourcePreloadCount)break}}}_loadMaybe(e){return e&&"loadStatus"in e&&e.loadStatus!=null?e.loadStatus==="not-loaded"?(e.load().catch(i=>{on(i)||console.log(i)}),"loading"):e.loadStatus:"loaded"}};y([w()],us.prototype,"required",void 0),y([w({constructOnly:!0})],us.prototype,"map",void 0),y([w({constructOnly:!0})],us.prototype,"getSpatialReferenceSupport",void 0),y([w()],us.prototype,"defaultSpatialReference",void 0),y([w()],us.prototype,"userSpatialReference",void 0),y([w()],us.prototype,"sourcePreloadCount",void 0),y([w()],us.prototype,"priorityCollection",void 0),y([w()],us.prototype,"requiresExtentInSpatialReference",void 0),y([w()],us.prototype,"suspended",void 0),y([w({readOnly:!0})],us.prototype,"ready",null),y([w({readOnly:!0})],us.prototype,"heightModelInfoReady",null),y([w({readOnly:!0})],us.prototype,"spatialReference",null),y([w({readOnly:!0})],us.prototype,"extent",null),y([w({readOnly:!0})],us.prototype,"heightModelInfo",null),y([w({readOnly:!0})],us.prototype,"vcsWkid",null),y([w({readOnly:!0})],us.prototype,"latestVcsWkid",null),y([w({readOnly:!0})],us.prototype,"viewingMode",null),y([w({readOnly:!0})],us.prototype,"tileInfo",null),y([w({readOnly:!0})],us.prototype,"mapCollections",null),y([w({readOnly:!0})],us.prototype,"_allLayers",null),y([w({readOnly:!0})],us.prototype,"_spatialReferenceTask",null),y([w({readOnly:!0})],us.prototype,"_tileInfoTask",null),y([w({readOnly:!0})],us.prototype,"_heightModelInfoTask",null),y([w({readOnly:!0})],us.prototype,"_extentCandidatesTask",null),y([w()],us.prototype,"_extentTask",null),y([w()],us.prototype,"_projectExtentTask",void 0),us=y([Z("esri.views.support.DefaultsFromMap")],us);let M0t=class{constructor(){this.layers=new Array,this.preloading=-1,this.updating=!1}};var c4;let gi=c4=class extends Dn.EventedMixin($9(ze)){constructor(t){super(t),this._userSpatialReference=null,this._cursor=null,this.handles=new N_,this.updatingHandles=new Nf,this.allLayerViews=new YT({getCollections:()=>{var e,i,r;return[(e=this.basemapView)==null?void 0:e.baseLayerViews,(i=this.groundView)==null?void 0:i.layerViews,this.layerViews,(r=this.basemapView)==null?void 0:r.referenceLayerViews]},getChildrenFunction:P0t}),this.groundView=null,this.basemapView=null,this.fatalError=null,this.graphics=new _T,this.analyses=new CP,this.typeSpecificPreconditionsReady=!0,this.layerViews=new tt,this.magnifier=new f4e,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this.spatialReferenceWarningDelay=1e3,this.supportsGround=!0,this.timeExtent=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new C0t,this.navigation=new b4e,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new v0t(this),this.persistableViewModels=new tt,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this.theme=null,this.handles.add(_e(()=>this.preconditionsReady,e=>{var i,r;e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,c4.views.add(this)):(this._lockedSpatialReference=null,c4.views.remove(this)),this.notifyChange("spatialReference"),!e&&this.ready?((i=this.toolViewManager)==null||i.detach(),this.analysisViewManager!=null&&this.analysisViewManager.detach(),(r=this.layerViewManager)==null||r.clear(),this._teardown()):e&&!this.ready&&(this._startup(),this.analysisViewManager!=null&&this.analysisViewManager.attach(),this.toolViewManager.attach())},Li))}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this.validate()]).then(()=>(this._isValid=!0,dd(()=>this.ready)))),this.basemapView=new dw({view:this}),this.layerViewManager=new m0t({view:this,layerViewImporter:{importLayerView:t=>this.importLayerView(t),hasLayerViewModule:t=>this.hasLayerViewModule(t)},supportsGround:this.supportsGround}),this.toolViewManager=new Lg({view:this}),this._setupSpatialReferenceLogger(),this.addHandles([_e(()=>this.initialExtentRequired,t=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:t},{sync:!0,initial:!0}),_e(()=>this.ready,t=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=t,this.defaultsFromMap.userSpatialReference=t?this.spatialReference:this._userSpatialReference)},{sync:!0}),_e(()=>this._userSpatialReference,t=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=t)},{sync:!0,initial:!0})])}_setupSpatialReferenceLogger(){let t=null;this.addHandles([_e(()=>{var e;return(e=this.defaultsFromMap)==null?void 0:e.ready},e=>{var r;const i=((r=this.map)==null?void 0:r.allLayers.length)>0;if(e&&!this.spatialReference&&i){if(t!=null)return;const n=rr(()=>t=vn(t));t=Oc(async s=>{try{await P2(this.spatialReferenceWarningDelay,null,s)}catch{return}finally{t=null}Ce.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")}),this.addHandles(n,"spatial-reference-logger-task")}else this.removeHandles("spatial-reference-logger-task")},{sync:!0})])}destroy(){var t,e;this.destroyed||(c4.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=et(this.graphics),this.analyses=et(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),et(this.analysisViewManager),this.toolViewManager=et(this.toolViewManager),this.layerViewManager=et(this.layerViewManager),this.basemapView=et(this.basemapView),(t=this.groundView)==null||t.destroy(),(e=this.layerViews)==null||e.forEach(i=>i.destroy()),this.layerViews.length=0,this.invalidate(),this._emitter.clear(),this.handles.destroy(),this.map=et(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return Ce.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){var t;return(t=this.toolViewManager)==null?void 0:t.activeTool}set activeTool(t){this.toolViewManager&&(this.toolViewManager.activeTool=t)}get animation(){return this._get("animation")}set animation(t){this._set("animation",t)}get center(){return null}get _defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new us({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:t=>this.getSpatialReferenceSupport(t),...this._defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(t){this._set("extent",t)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){var t;return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||Wf.isLoadable(this.map)&&!this.map.loaded||this.width===0||this.height===0||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._lockedSpatialReference&&!((t=this.defaultsFromMap)!=null&&t.ready)||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(t){t!==this._get("map")&&(t!=null&&t.destroyed&&(Ce.getLogger(this).warn("#map","The provided map is already destroyed",{map:t}),t=null),Wf.isLoadable(t)&&t.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",t))}get spatialReference(){var e,i;let t=this._userSpatialReference||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;return t&&((i=(e=this.defaultsFromMap)==null?void 0:e.required)!=null&&i.heightModelInfo)&&(t=t.clone(),t.vcsWkid=this.defaultsFromMap.vcsWkid,t.latestVcsWkid=this.defaultsFromMap.latestVcsWkid),t}set spatialReference(t){const e=!jn(t,this._get("spatialReference"));this._set("_userSpatialReference",t),e&&(this._set("spatialReference",t),this._spatialReferenceChanged(t))}_spatialReferenceChanged(t){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??Yy}set timeZone(t){const e=new Set(["etc/utc","etc/gmt","gmt"]),i=new Set(Intl.supportedValuesOf("timeZone").map(r=>r.toLowerCase()));this._userTimeZone=t,t===Yy||t===qT||e.has(t.toLowerCase())||i.has(t.toLowerCase())||Ce.getLogger(this).warn("#timeZone",`the parsed value '${t}' may not be a valid IANA time zone`)}get tools(){var t;return(t=this.toolViewManager)==null?void 0:t.tools}get initialExtent(){var t;return(t=this.defaultsFromMap)==null?void 0:t.extent}get cursor(){var t;return((t=this.toolViewManager)==null?void 0:t.cursor)??this._cursor??"default"}set cursor(t){this._cursor=t,this.notifyChange("cursor")}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new Iee}whenLayerView(t){var e;return((e=this.layerViewManager)==null?void 0:e.whenLayerView(t))??Promise.reject()}getDefaultSpatialReference(){var t;return(t=this.defaultsFromMap)==null?void 0:t.spatialReference}getDefaultHeightModelInfo(){var t;return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??((t=this.defaultsFromMap)==null?void 0:t.heightModelInfo)??null}getDefaultTimeZone(){return null}importLayerView(t){throw new se("importLayerView() not implemented")}hasLayerViewModule(t){return!1}async validate(){}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(t){return this.getSpatialReferenceSupport({spatialReference:t})!=null}when(t,e){return this.isResolved()&&!this.ready&&Ce.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(t,e)}forceReadyCycle(){this.ready&&(Oo(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}addAndActivateTool(t){this.toolViewManager.tools.add(t),this.activeTool=t}tryFatalErrorRecovery(){this.fatalError=null}};gi.views=new tt,y([w()],gi.prototype,"_userSpatialReference",void 0),y([w()],gi.prototype,"activeTool",null),y([w({readOnly:!0})],gi.prototype,"allLayerViews",void 0),y([w()],gi.prototype,"groundView",void 0),y([w()],gi.prototype,"animation",null),y([w()],gi.prototype,"basemapView",void 0),y([w()],gi.prototype,"center",null),y([w({readOnly:!0})],gi.prototype,"_defaultsFromMapSettings",null),y([w()],gi.prototype,"defaultsFromMap",null),y([w()],gi.prototype,"fatalError",void 0),y([w({type:Vi})],gi.prototype,"extent",null),y([w(pz(_T,"graphics"))],gi.prototype,"graphics",void 0),y([w(pz(CP,"analyses"))],gi.prototype,"analyses",void 0),y([w({readOnly:!0,type:B_})],gi.prototype,"heightModelInfo",null),y([w({readOnly:!0})],gi.prototype,"interacting",null),y([w({readOnly:!0})],gi.prototype,"navigating",null),y([w({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_lockedSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],gi.prototype,"preconditionsReady",null),y([w({readOnly:!0})],gi.prototype,"typeSpecificPreconditionsReady",void 0),y([w({type:tt,readOnly:!0})],gi.prototype,"layerViews",void 0),y([w()],gi.prototype,"resolution",null),y([w({type:f4e})],gi.prototype,"magnifier",void 0),y([w({value:null,type:vRe})],gi.prototype,"map",null),y([w()],gi.prototype,"padding",void 0),y([w({readOnly:!0})],gi.prototype,"ready",void 0),y([w({type:rt})],gi.prototype,"spatialReference",null),y([w()],gi.prototype,"spatialReferenceWarningDelay",void 0),y([w()],gi.prototype,"stationary",null),y([w({readOnly:!0})],gi.prototype,"supportsGround",void 0),y([w({type:f1})],gi.prototype,"timeExtent",void 0),y([w({type:String,nonNullable:!0})],gi.prototype,"timeZone",null),y([w()],gi.prototype,"tools",null),y([w()],gi.prototype,"toolViewManager",void 0),y([w({readOnly:!0})],gi.prototype,"type",void 0),y([w({type:Number})],gi.prototype,"scale",void 0),y([w({readOnly:!0})],gi.prototype,"updating",void 0),y([w({readOnly:!0})],gi.prototype,"initialExtentRequired",void 0),y([w({readOnly:!0})],gi.prototype,"initialExtent",null),y([w()],gi.prototype,"cursor",null),y([w({readOnly:!0})],gi.prototype,"input",void 0),y([w({type:b4e,nonNullable:!0})],gi.prototype,"navigation",void 0),y([w()],gi.prototype,"layerViewManager",void 0),y([w()],gi.prototype,"analysisViewManager",void 0),y([w()],gi.prototype,"width",void 0),y([w()],gi.prototype,"height",void 0),y([w({readOnly:!0})],gi.prototype,"resizing",void 0),y([w({value:null,readOnly:!0})],gi.prototype,"size",null),y([w({readOnly:!0})],gi.prototype,"suspended",void 0),y([w({readOnly:!0})],gi.prototype,"viewEvents",void 0),y([w({readOnly:!0})],gi.prototype,"persistableViewModels",void 0),y([w()],gi.prototype,"_isValid",void 0),y([w()],gi.prototype,"_readyCycleForced",void 0),y([w()],gi.prototype,"_lockedSpatialReference",void 0),y([w()],gi.prototype,"_userTimeZone",void 0),y([w()],gi.prototype,"_lockedTimeZone",void 0),y([w({type:Iee})],gi.prototype,"theme",void 0),y([w({readOnly:!0,type:Iee})],gi.prototype,"effectiveTheme",null),gi=c4=y([Z("esri.views.View")],gi);const O0t=gi;function P0t(t){return t.layerViews}let fw=class extends Rz{constructor(e){super(e),this.state="running",this.target=null,this._resolver=null}initialize(){this._resolver=ec(),this.addResolvingPromise(this._resolver.promise)}get done(){return this.state==="finished"||this.state==="stopped"}stop(){var e;this.state!=="stopped"&&this.state!=="finished"&&(this._set("state","stopped"),(e=this._resolver)==null||e.reject(new se("ViewAnimation stopped")))}finish(){var e;this.state!=="stopped"&&this.state!=="finished"&&(this._set("state","finished"),(e=this._resolver)==null||e.resolve())}update(e,i){i||(i=yd(e)?"waiting-for-target":"running"),this._set("target",e),this._set("state",i)}};y([w({readOnly:!0})],fw.prototype,"done",null),y([w({readOnly:!0,type:String})],fw.prototype,"state",void 0),y([w()],fw.prototype,"target",void 0),fw=y([Z("esri.views.ViewAnimation")],fw),function(t){t.State={RUNNING:"running",STOPPED:"stopped",FINISHED:"finished",WAITING_FOR_TARGET:"waiting-for-target"}}(fw||(fw={}));const OP=fw,gR=()=>we(()=>import("./TileLayerView3D-KbvgzCEw.js"),__vite__mapDeps([115,116,117,118,119,120,121])),ume=()=>we(()=>import("./ElevationLayerView3D-fn8Lf5lz.js"),__vite__mapDeps([122,116,117,118])),hme={"base-dynamic":()=>we(()=>import("./BaseDynamicLayerView3D-HrHMPsDQ.js"),__vite__mapDeps([123,124,116,125,126,118,119])),"base-elevation":ume,"base-tile":gR,"bing-maps":gR,"building-scene":()=>we(()=>import("./BuildingSceneLayerView3D-9E-CA71T.js"),__vite__mapDeps([127,25,12,13,14,15,16,17,18,19,20,21,22,23,24,4,5,128,129,105,114,130,131,132,133,134,135,136,7,137,51,46,47,48,49,28,50,35,44,45,125,116,138,118,119,41,104,139,140])),csv:()=>we(()=>import("./CSVLayerView3D-WZv0l0uX.js"),__vite__mapDeps([141,133,134,135,136,7,137,51,46,47,48,4,5,49,28,50,35,44,45,125,116,138,19,118,119])),dimension:()=>we(()=>import("./DimensionLayerView3D-fNUV7ooO.js"),__vite__mapDeps([142,116,118])),elevation:ume,feature:()=>we(()=>import("./FeatureLayerView3D-vzwVkoh-.js"),__vite__mapDeps([132,133,134,135,136,7,137,51,46,47,48,4,5,49,28,50,35,44,45,125,116,138,19,118,119])),geojson:()=>we(()=>import("./GeoJSONLayerView3D-lumzM4UY.js"),__vite__mapDeps([143,133,134,135,136,7,137,51,46,47,48,4,5,49,28,50,35,44,45,125,116,138,19,118,119])),graphics:()=>we(()=>import("./GraphicsLayerView3D-WVV0TMGR.js"),__vite__mapDeps([144,116,136,145,137,51,46,47,125,118])),group:()=>we(()=>import("./GroupLayerView-Ck4zCvvf.js"),__vite__mapDeps([146,118])),imagery:()=>we(()=>import("./ImageryLayerView3D-BaVb1zzV.js"),__vite__mapDeps([147,124,116,125,126,118,119])),"integrated-mesh":()=>we(()=>import("./IntegratedMeshLayerView3D-3obO3XcM.js"),__vite__mapDeps([148,128,129,105,114,130,131,132,133,134,135,136,7,137,51,46,47,48,4,5,49,28,50,35,44,45,125,116,138,19,118,119,41,104])),"line-of-sight":()=>we(()=>import("./LineOfSightLayerView3D-uRdo1RJr.js"),__vite__mapDeps([149,116,118])),"map-image":()=>we(()=>import("./MapImageLayerView3D-XQURj3BI.js"),__vite__mapDeps([150,124,116,125,126,118,119,120,121])),media:()=>we(()=>import("./MediaLayerView3D-LfY78zh1.js"),__vite__mapDeps([151,59,60,116,126,118])),"ogc-feature":()=>we(()=>import("./OGCFeatureLayerView3D-a9b4I66a.js"),__vite__mapDeps([152,133,134,135,136,7,137,51,46,47,48,4,5,49,28,50,35,44,45,125,116,138,19,118,119])),"open-street-map":gR,"oriented-imagery":()=>we(()=>import("./FeatureLayerView3D-vzwVkoh-.js"),__vite__mapDeps([132,133,134,135,136,7,137,51,46,47,48,4,5,49,28,50,35,44,45,125,116,138,19,118,119])),"point-cloud":()=>we(()=>import("./PointCloudLayerView3D-LHTTpHpk.js"),__vite__mapDeps([153,116,102,69,154,118])),voxel:()=>we(()=>import("./VoxelLayerView3D-4VCjvhwH.js"),__vite__mapDeps([155,116,154,118])),route:()=>we(()=>import("./RouteLayerView3D-EnI30QTX.js"),__vite__mapDeps([156,71,116,145,137,51,46,47,125,138,118])),scene:t=>t.profile==null||t.profile==="mesh-pyramids"?we(()=>import("./SceneLayerView3D-wSIS3UPq.js"),__vite__mapDeps([157,114,4,5,128,129,105,130,131,132,133,134,135,136,7,137,51,46,47,48,49,28,50,35,44,45,125,116,138,19,118,119,41,104,158,140,139,154])):we(()=>import("./SceneLayerGraphicsView3D-KM9RpQwS.js"),__vite__mapDeps([159,129,105,114,130,131,132,133,134,135,136,7,137,51,46,47,48,4,5,49,28,50,35,44,45,125,116,138,19,118,119,158,140,154])),stream:()=>we(()=>import("./StreamLayerView3D-kATjjzFd.js"),__vite__mapDeps([160,96,98,138,134,135,136,7,137,51,46,47,48,4,5,49,28,50,35,44,45,125,116,118])),tile:gR,"imagery-tile":()=>we(()=>import("./ImageryTileLayerView3D-OR6Vjdkd.js"),__vite__mapDeps([161,38,116,117,118,119,121])),"vector-tile":()=>we(()=>import("./VectorTileLayerView3D-eTryeubP.js"),__vite__mapDeps([162,108,163,164,78,99,100,165,76,77,116,117,118])),wcs:()=>we(()=>import("./ImageryTileLayerView3D-OR6Vjdkd.js"),__vite__mapDeps([161,38,116,117,118,119,121])),"web-tile":gR,wfs:()=>we(()=>import("./WFSLayerView3D-_qadKQVq.js"),__vite__mapDeps([166,133,134,135,136,7,137,51,46,47,48,4,5,49,28,50,35,44,45,125,116,138,19,118,119])),wms:()=>we(()=>import("./WMSLayerView3D-OqbPQcsr.js"),__vite__mapDeps([167,124,116,125,126,118,119])),wmts:()=>we(()=>import("./WMTSLayerView3D-6XYesvf9.js"),__vite__mapDeps([168,116,117,118,119])),"geo-rss":null,kml:null,"knowledge-graph":null,"link-chart":null,"knowledge-graph-sublayer":null,"map-notes":null,"subtype-group":null,unknown:null,unsupported:null,video:null};function R0t(t){const e=t.declaredClass?t.declaredClass.slice(t.declaredClass.lastIndexOf(".")+1):"Unknown",i=e.replaceAll(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return new se(`${i}:view-not-supported`,`${e} is not supported in 3D`)}const dme={hasLayerViewModule:t=>hme[t.type]!=null,importLayerView:t=>{const e=hme[t.type];if(e==null)throw R0t(t);return e(t)}},pme="analyses-owner-handles";var zM,NS;(function(t){t[t.PENDING=0]="PENDING",t[t.CREATED=1]="CREATED"})(zM||(zM={})),function(t){t[t.ADDED=0]="ADDED",t[t.REMOVED=1]="REMOVED"}(NS||(NS={}));let J3=class extends ze{constructor(e){super(e),this._allAnalysisViews=new tt,this._creatingViewCount=0,this._items=new Map,this._scheduledUpdateHandle=null,this._attachedToViewResolver=fme(),this._analysisModules={"area-measurement":{module:null},dimension:{module:null},"direct-line-measurement":{module:null},"line-of-sight":{module:null},slice:{module:null}}}destroy(){this._disconnectOwners(),this._attachedToViewResolver.reject(ur("AnalysisViewManager was destroyed"))}attach(){this._connectOwners(),this._attachedToViewResolver.resolve()}detach(){this._disconnectOwners(),this._attachedToViewResolver.reject(ur()),this._attachedToViewResolver=fme()}get updating(){return!this.view.ready||this._creatingViewCount!==0||this._allAnalysisViews.some(e=>e.updating)}get testInfo(){return{allAnalysisViews:this._allAnalysisViews}}async whenAnalysisView(e){await this._attachedToViewResolver.promise;const i=this._items.get(e);if(i==null||i.state.list===NS.REMOVED)throw new se("AnalysisViewManager:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});return i.createAnalysisViewTask.promise}_connectOwners(){this.addHandles(this._connectAnalysesCollection(this.view.analyses),pme)}_disconnectOwners(){this.removeHandles(pme),this._update(),this._creatingViewCount=0}_connectAnalysesCollection(e){for(const n of e)this._addAnalysis(n);const i=e.on("after-add",n=>this._addAnalysis(n.item)),r=e.on("after-remove",n=>this._removeAnalysis(n.item));return rr(()=>{i.remove(),r.remove();for(const n of e)this._removeAnalysis(n)})}_addAnalysis(e){const i=this._items.get(e);if(i==null){const r={state:{view:zM.PENDING,list:NS.ADDED},analysis:e,view:null,createAnalysisViewTask:null};this._items.set(e,r),r.createAnalysisViewTask=Oc(n=>this._createAnalysisViewPromise(r,n))}else i.state.list=NS.ADDED}_removeAnalysis(e){const i=this._items.get(e);i!=null?(i.state.list=NS.REMOVED,this._scheduleUpdate()):Ce.getLogger(this).error("Trying to remove analysis which was not added")}_scheduleUpdate(){this._scheduledUpdateHandle==null&&(this._scheduledUpdateHandle=ox(()=>this._update()))}_update(){this._scheduledUpdateHandle=en(this._scheduledUpdateHandle),this._items.forEach(e=>{if(e.state.list===NS.REMOVED)switch(this._items.delete(e.analysis),e.state.view){case zM.PENDING:e.createAnalysisViewTask=vn(e.createAnalysisViewTask);break;case zM.CREATED:e.view!=null&&(this._allAnalysisViews.remove(e.view),e.view=et(e.view),e.createAnalysisViewTask=null)}})}async _createAnalysisViewPromise(e,i){const r=e.analysis,n=r.type,s=this._analysisModules[n];if(this._creatingViewCount+=1,s.module==null)try{s.module=await this._loadAnalysisModule(n)}catch(a){throw this._creatingViewCount-=1,a}if(So(i))throw this._creatingViewCount-=1,ur("AnalysisView creation aborted");const o=new s.module.default({analysis:r,view:this.view});try{await o.when()}catch(a){throw this._creatingViewCount-=1,a}if(So(i))throw this._creatingViewCount-=1,o.destroy(),ur("AnalysisView creation aborted");return e.view=o,e.state.view=zM.CREATED,this._allAnalysisViews.add(o),this._creatingViewCount-=1,o}_loadAnalysisModule(e){switch(e){case"area-measurement":return we(()=>import("./AreaMeasurementAnalysisView3D-RBc-E7CZ.js"),__vite__mapDeps([169,170,171,172,173,174,175,176,177,178,179,180,181,182]));case"dimension":return we(()=>import("./DimensionAnalysisView3D-6H84TLcJ.js"),__vite__mapDeps([183,170,30,181,178,182,184,175,185,186,187,188,126,189,190,191,164,192,193,194,177,195,196,197,176,198,179,199,200,135,201,202,180,203]));case"direct-line-measurement":return we(()=>import("./DirectLineMeasurementAnalysisView3D-iWb0_QxT.js"),__vite__mapDeps([204,170,171,176,177,178,173,180,205,181,182,195,192]));case"line-of-sight":return we(()=>import("./LineOfSightAnalysisView3D-oCrG9jF8.js"),__vite__mapDeps([206,170,176,177,178,185,207,193,202,187,188,194,203]));case"slice":return we(()=>import("./SliceAnalysisView3D--Kqu5Yhm.js"),__vite__mapDeps([208,170,12,13,14,15,16,17,18,19,20,21,22,23,24,209,185,126,176,177,178,189,186,187,188,202,203]))}}};function fme(){const t=ec();return t.promise.catch(()=>{}),t}y([w()],J3.prototype,"updating",null),y([w({constructOnly:!0})],J3.prototype,"view",void 0),y([w()],J3.prototype,"_allAnalysisViews",void 0),y([w()],J3.prototype,"_creatingViewCount",void 0),J3=y([Z("esri.views.3d.analysis.AnalysisViewManager3D")],J3);const I0t=J3;let lv=class extends ze{constructor(e){super(e),this.collision=new u4,this.distance=1/0,this.minimumPoiDistance=4,this.tilt=null}get altitude(){return this.mode===_t.Local?null:this._get("altitude")||null}set altitude(e){this.mode!==_t.Local?this._set("altitude",e):Ce.getLogger(this).warn("Altitude constraint is ignored in local scenes")}clampAltitude(e){return this.altitude?Je(e,this.altitude.min,this.altitude.max):e}clampTilt(e,i){if(!this.tilt)return i;const r=this.tilt(e);return Je(i,r.min,r.max)}clampDistance(e){return Math.min(e,this.distance)}createDefaultTilt(){return this.mode===_t.Local?this._createDefaultTiltLocal():this._createDefaultTiltGlobal()}createConstantMaxTilt(e){return(i,r=gq)=>(r.min=Gl.min,r.max=e,r)}_createDefaultTiltLocal(){const e=this.collision.enabled?bF([[4e3,Gl.max],[1e4,Ei(88)],[6e6,Ei(88)]]):()=>Gl.max;return(i,r=gq)=>(r.min=Gl.min,r.max=e(i),r)}_createDefaultTiltGlobal(){const e=this.collision.enabled?bF([[4e3,Gl.max],[5e4,Ei(88)],[6e6,Ei(88)],[2e7,Gl.min]]):bF([[3e5,Gl.max],[3e6,Ei(88)],[6e6,Ei(88)],[2e7,Gl.min]]);return(i,r=gq)=>(r.min=Gl.min,r.max=e(i),r)}};function $0t(t){return{min:-2e5,max:4*t.radius}}y([w()],lv.prototype,"altitude",null),y([w({readOnly:!0})],lv.prototype,"collision",void 0),y([w()],lv.prototype,"distance",void 0),y([w({readOnly:!0})],lv.prototype,"minimumPoiDistance",void 0),y([w()],lv.prototype,"tilt",void 0),y([w({constructOnly:!0})],lv.prototype,"mode",void 0),lv=y([Z("esri.views.3d.state.Constraints")],lv);const mme=$0t(Or),Gl={min:Ei(.5),max:Ei(179.5)},gq={min:0,max:0};let u4=class extends ze{constructor(){super(...arguments),this.enabled=!0,this.elevationMargin=5}};y([w({type:Boolean})],u4.prototype,"enabled",void 0),y([w({type:Number})],u4.prototype,"elevationMargin",void 0),u4=y([Z("esri.views.3d.state.Constraints.CollisionConstraint")],u4);let UM=class extends ze{constructor(){super(...arguments),this.min=mme.min,this.max=mme.max}};y([w({type:Number})],UM.prototype,"min",void 0),y([w({type:Number})],UM.prototype,"max",void 0),UM=y([Z("esri.views.3d.constraints.AltitudeConstraint")],UM);let $v=class extends ze{constructor(){super(...arguments),this.mode="auto"}get near(){return this._get("near")}set near(e){this._set("near",e),e>=this._get("far")&&(this.far=e+1e-9),this.mode="manual"}castNear(e){return Math.max(1e-8,e)}get far(){return this._get("far")}set far(e){this._set("far",e),e<=this._get("near")&&(this.near=e-1e-9),this.mode="manual"}castFar(e){return Math.max(1e-8,e)}autoUpdate(e,i){this.mode==="auto"&&(this._get("near")!==e&&this._set("near",e),this._get("far")!==i&&this._set("far",i))}};y([w({type:Number,value:1e-8})],$v.prototype,"near",null),y([Ci("near")],$v.prototype,"castNear",null),y([w({type:Number,value:1e-8})],$v.prototype,"far",null),y([Ci("far")],$v.prototype,"castFar",null),y([w({type:["auto","manual"]})],$v.prototype,"mode",void 0),$v=y([Z("esri.views.3d.constraints.ClipDistanceConstraint")],$v);const Dee={min:mu(Gl.min),max:mu(Gl.max)};let FS=class extends ze{constructor(){super(...arguments),this.mode="auto"}get max(){return this._get("max")}set max(e){this._set("max",e),this.mode="manual"}castMax(e){return Je(e,Dee.min,Dee.max)}autoUpdate(e){this.mode==="auto"&&this._get("max")!==e&&this._set("max",e)}};y([w({type:["auto","manual"]})],FS.prototype,"mode",void 0),y([w({type:Number,value:Dee.max})],FS.prototype,"max",null),y([Ci("max")],FS.prototype,"castMax",null),FS=y([Z("esri.views.3d.constraints.TiltConstraint")],FS);let kS=class extends ze{constructor(){super(...arguments),this.tilt=new FS,this.altitude=new UM,this.clipDistance=new $v}};y([w({type:FS})],kS.prototype,"tilt",void 0),y([w({type:UM})],kS.prototype,"altitude",void 0),y([w({type:$v})],kS.prototype,"clipDistance",void 0),kS=y([Z("esri.views.3d.constraints.Constraints")],kS);var VA;const x4e="esri.views.3d.environment.SunLighting",HD=Ce.getLogger(x4e);let Dg=VA=class extends Dn.EventedMixin(XT){constructor(t){super(t),this.cameraTrackingEnabled=!0,this.positionTimezoneInfo={hours:0,minutes:0,seconds:0,autoUpdated:!0};const e=new Date().getFullYear(),i=new Date("March 15, "+e+" 12:00:00 UTC");this._set("defaultDate",i),this._set("date",i)}get ambientOcclusionEnabled(){return gm(HD,"ambientOcclusionEnabled",{replacement:"ambient occlusion is automatically shown and this property has no effect",version:"4.27"}),this._get("ambientOcclusionEnabled")??!1}set ambientOcclusionEnabled(t){gm(HD,"ambientOcclusionEnabled",{replacement:"ambient occlusion is automatically shown and this property has no effect",version:"4.27"}),this._set("ambientOcclusionEnabled",t)}get waterReflectionEnabled(){return gm(HD,"waterReflectionEnabled",{replacement:"reflections are automatically shown and this property has no effect",version:"4.27"}),this._get("waterReflectionEnabled")??!1}set waterReflectionEnabled(t){gm(HD,"waterReflectionEnabled",{replacement:"reflections are automatically shown and this property has no effect",version:"4.27"}),this._set("waterReflectionEnabled",t)}get defaultDate(){return new Date(this._get("defaultDate").getTime())}static fromWebsceneLighting(t){return new VA(t.cloneConstructProperties())}set defaultDate(t){const e=this._get("date")===this._get("defaultDate");t=new Date(t.getTime()),this._set("defaultDate",t),e&&this._set("date",t)}set date(t){t!=null&&(this.positionTimezoneInfo.autoUpdated=!1,this._set("date",new Date(t.getTime())))}autoUpdate(t,e){const i=VA.calculateTimezoneOffset(this.positionTimezoneInfo);this.positionTimezoneInfo.hours=e.hours,this.positionTimezoneInfo.minutes=e.minutes,this.positionTimezoneInfo.seconds=e.seconds;let r=null;t!=null&&(this.positionTimezoneInfo.autoUpdated=!0,isNaN(t.getTime())?(r=this.defaultDate.getTime(),this._set("date",this.defaultDate)):(r=this.date&&this.date.getTime(),this._set("date",new Date(t.getTime()))));const n=VA.calculateTimezoneOffset(this.positionTimezoneInfo);if(i!==n&&(qD.target=this,qD.timezoneOffset=n,this.emit("timezone-will-change",qD),qD.target=null),t!=null)return isNaN(t.getTime())||r!==t.getTime()}clone(){const t=this._get("date")===this._get("defaultDate"),e=new VA({...this.cloneConstructProperties(),defaultDate:this.defaultDate,cameraTrackingEnabled:this.cameraTrackingEnabled});return t&&e._set("date",e._get("defaultDate")),e.positionTimezoneInfo.autoUpdated=this.positionTimezoneInfo.autoUpdated,e.positionTimezoneInfo.hours=this.positionTimezoneInfo.hours,e.positionTimezoneInfo.minutes=this.positionTimezoneInfo.minutes,e.positionTimezoneInfo.seconds=this.positionTimezoneInfo.seconds,e}cloneWithWebsceneLighting(t){const e=this.clone();return t.date!=null&&(e.date=t.date),e.directShadowsEnabled=t.directShadowsEnabled,e.displayUTCOffset=t.displayUTCOffset,e}cloneNonPersistentConstructProperties(){return{cameraTrackingEnabled:this.cameraTrackingEnabled}}};y([w({type:Boolean})],Dg.prototype,"cameraTrackingEnabled",void 0),y([w({type:Boolean})],Dg.prototype,"ambientOcclusionEnabled",null),y([w({type:Boolean})],Dg.prototype,"waterReflectionEnabled",null),y([w({type:Date})],Dg.prototype,"defaultDate",null),y([w({type:Date})],Dg.prototype,"date",null),Dg=VA=y([Z(x4e)],Dg),function(t){function e({hours:i,minutes:r,seconds:n}){return Math.round(i+r/60+n/3600)}t.calculateTimezoneOffset=e}(Dg||(Dg={}));const qD={target:null,timezoneOffset:0},zv=Dg;var BF;const S4e="esri.views.3d.environment.VirtualLighting",WD=Ce.getLogger(S4e);let BA=BF=class extends Dn.EventedMixin(q9){constructor(t){super(t),this.cameraTrackingEnabled=!0}get ambientOcclusionEnabled(){return gm(WD,"ambientOcclusionEnabled",{replacement:"ambient occlusion is automatically shown and this property has no effect",version:"4.27"}),this._get("ambientOcclusionEnabled")??!1}set ambientOcclusionEnabled(t){gm(WD,"ambientOcclusionEnabled",{replacement:"ambient occlusion is automatically shown and this property has no effect",version:"4.27"}),this._set("ambientOcclusionEnabled",t)}get waterReflectionEnabled(){return gm(WD,"waterReflectionEnabled",{replacement:"water reflections are automatically shown and this property has no effect",version:"4.27"}),this._get("waterReflectionEnabled")??!1}set waterReflectionEnabled(t){gm(WD,"waterReflectionEnabled",{replacement:"water reflections are automatically shown and this property has no effect",version:"4.27"}),this._set("waterReflectionEnabled",t)}clone(){return new BF({...this.cloneConstructProperties(),cameraTrackingEnabled:this.cameraTrackingEnabled})}static fromWebsceneLighting(t){return new BF(t.cloneConstructProperties())}cloneWithWebsceneLighting(t){const e=this.clone();return e.directShadowsEnabled=t.directShadowsEnabled,e}cloneNonPersistentConstructProperties(){return{cameraTrackingEnabled:this.cameraTrackingEnabled}}};y([w({type:Boolean})],BA.prototype,"ambientOcclusionEnabled",null),y([w({type:Boolean})],BA.prototype,"waterReflectionEnabled",null),y([w({type:Boolean})],BA.prototype,"cameraTrackingEnabled",void 0),BA=BF=y([Z(S4e)],BA);const VM=BA,L0t={key:"type",defaultKeyValue:"sun",base:null,typeMap:{sun:zv,virtual:VM}};var Nee;let T$=Nee=class extends ze{set quality(t){["low","high"].includes(t)&&this._set("quality",t)}clone(){return new Nee({quality:this.quality})}};y([w({type:["low","high"],value:"low"})],T$.prototype,"quality",null),T$=Nee=y([Z("esri.views.3d.environment.SceneViewAtmosphere")],T$);var h4;let jA=h4=class extends SP{constructor(t){super(t),this.atmosphere=new T$,this.lighting=this.castLighting(),this.cachedCameraTrackingEnabled=null}static fromWebsceneEnvironment(t){const e=t.cloneConstructProperties();return new h4({...e,lighting:e.lighting?e.lighting.type==="virtual"?VM.fromWebsceneLighting(e.lighting):zv.fromWebsceneLighting(e.lighting):void 0})}castLighting(t){return this._convertLightingWithDestroy(t)}applyLighting(t){this.lighting=this._convertLightingWithDestroy(t)}_convertLightingWithDestroy(t){const e=this._convertLighting(t);return e!==t&&this.addHandles(gne(e)),e}_convertLighting(t){var e,i;return t?t instanceof zv||t instanceof VM?t:t instanceof XT?this.lighting&&this.lighting.type!=="virtual"?this.lighting.cloneWithWebsceneLighting(t):new zv({...t.cloneConstructProperties(),...(e=this.lighting)==null?void 0:e.cloneNonPersistentConstructProperties()}):t instanceof q9?this.lighting&&this.lighting.type==="virtual"?this.lighting.cloneWithWebsceneLighting(t):new VM({...t.cloneConstructProperties(),...(i=this.lighting)==null?void 0:i.cloneNonPersistentConstructProperties()}):Hy(L0t,t):new zv}clone(){return new h4({lighting:this.lighting.clone(),atmosphere:this.atmosphere.clone(),weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:Pe(this.background)})}cloneWithWebsceneEnvironment(t){return new h4({atmosphere:this.atmosphere.clone(),weather:this.weather.clone(),atmosphereEnabled:this.atmosphereEnabled,starsEnabled:this.starsEnabled,background:Pe(this.background),...t.cloneConstructProperties(),lighting:this._getLighting(t)})}_getLighting(t){switch(t.lighting.type){case"sun":return this.lighting&&this.lighting.type==="sun"?this.lighting.cloneWithWebsceneLighting(t.lighting):zv.fromWebsceneLighting(t.lighting);case"virtual":return this.lighting&&this.lighting.type==="virtual"?this.lighting.cloneWithWebsceneLighting(t.lighting):VM.fromWebsceneLighting(t.lighting);default:return t.lighting,zv.fromWebsceneLighting(t.lighting)}}};y([w({type:T$,json:{read:!1},nonNullable:!0})],jA.prototype,"atmosphere",void 0),y([w({nonNullable:!0})],jA.prototype,"lighting",void 0),y([Ci("lighting")],jA.prototype,"castLighting",null),jA=h4=y([Z("esri.views.3d.environment.SceneViewEnvironment")],jA);const GA=jA;function D0t(t,e,i){if(e==null)return!1;const r=XOe(e);return r!=null&&(r(t,0,yR,0),i!==yR&&(i[0]=yR[0],i[1]=yR[1],i.length>2&&(i[2]=yR[2])),!0)}const yR=W();function N0t(t,e){YD[0]=t.x,YD[1]=t.y;const i=t.z;return YD[2]=i!==void 0?i:0,D0t(YD,t.spatialReference,e)}const YD=W();var gc;(function(t){t[t.Realistic=0]="Realistic",t[t.Local=1]="Local",t[t.Mars=2]="Mars",t[t.None=3]="None"})(gc||(gc={}));function F0t(t){return"r"in t&&"g"in t&&"b"in t}function T4e(t){return"h"in t&&"s"in t&&"v"in t}function E4e(t){return"l"in t&&"a"in t&&"b"in t}function C4e(t){return"l"in t&&"c"in t&&"h"in t}function k0t(t){return"x"in t&&"y"in t&&"z"in t}const z0t=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],U0t=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]];function A4e(t,e){const i=[];let r,n;if(t[0].length!==e.length)throw new Error("dimensions do not match");const s=t.length,o=t[0].length;let a=0;for(r=0;rr<=.04045?r/12.92:((r+.055)/1.055)**2.4),i=A4e(z0t,e);return{x:100*i[0],y:100*i[1],z:100*i[2]}}function Sae(t){const e=A4e(U0t,[t.x/100,t.y/100,t.z/100]).map(i=>{const r=i<=.0031308?12.92*i:1.055*i**.4166666666666667-.055;return Math.min(1,Math.max(r,0))});return{r:Math.round(255*e[0]),g:Math.round(255*e[1]),b:Math.round(255*e[2])}}function O4e(t){const e=[t.x/95.047,t.y/100,t.z/108.883].map(i=>i>.008856451679035631?i**.3333333333333333:7.787037037037035*i+.13793103448275862);return{l:116*e[1]-16,a:500*(e[0]-e[1]),b:200*(e[1]-e[2])}}function P4e(t){const e=t.l,i=[(e+16)/116+t.a/500,(e+16)/116,(e+16)/116-t.b/200].map(r=>r>6/29?r**3:3*(6/29)**2*(r-4/29));return{x:95.047*i[0],y:100*i[1],z:108.883*i[2]}}function V0t(t){const e=t.l,i=t.a,r=t.b,n=Math.sqrt(i*i+r*r);let s=Math.atan2(r,i);return s=s>0?s:s+2*Math.PI,{l:e,c:n,h:s}}function B0t(t){const e=t.l,i=t.c,r=t.h;return{l:e,a:i*Math.cos(r),b:i*Math.sin(r)}}function j0t(t){return O4e(M4e(t))}function G0t(t){return Sae(P4e(t))}function H0t(t){return V0t(O4e(M4e(t)))}function q0t(t){return Sae(P4e(B0t(t)))}function W0t(t){const e=t.r,i=t.g,r=t.b,n=Math.max(e,i,r),s=n-Math.min(e,i,r);let o=n,a=s===0?0:n===e?(i-r)/s%6:n===i?(r-e)/s+2:(e-i)/s+4,c=s===0?0:s/o;return a<0&&(a+=6),a*=60,c*=100,o*=100/255,{h:a,s:c,v:o}}function Y0t(t){const e=(t.h+360)%360/60,i=t.s/100,r=t.v/100*255,n=r*i,s=n*(1-Math.abs(e%2-1));let o;switch(Math.floor(e)){case 0:o={r:n,g:s,b:0};break;case 1:o={r:s,g:n,b:0};break;case 2:o={r:0,g:n,b:s};break;case 3:o={r:0,g:s,b:n};break;case 4:o={r:s,g:0,b:n};break;case 5:case 6:o={r:n,g:0,b:s};break;default:o={r:0,g:0,b:0}}return o.r=Math.round(o.r+r-n),o.g=Math.round(o.g+r-n),o.b=Math.round(o.b+r-n),o}function PE(t){return F0t(t)?t:C4e(t)?q0t(t):E4e(t)?G0t(t):k0t(t)?Sae(t):T4e(t)?Y0t(t):t}function Nj(t){return T4e(t)?t:W0t(PE(t))}function X0t(t){return E4e(t)?t:j0t(PE(t))}function Uii(t){return C4e(t)?t:H0t(PE(t))}function Z0t(t){let{r:e,g:i,b:r,a:n}=t;return n<1&&(e=Math.round(n*e+255*(1-n)),i=Math.round(n*i+255*(1-n)),r=Math.round(n*r+255*(1-n))),new qe({r:e,g:i,b:r})}function J0t(t,e){const{r:i,g:r,b:n}=e!=null&&e.ignoreAlpha?t:Z0t(t);return .2126*i+.7152*r+.0722*n}var Fee;function Vii(t,e=Fee.High){return J0t(t,{ignoreAlpha:!0})>e?new qe([0,0,0,t.a]):new qe([255,255,255,t.a])}function Bii(t,e){const i=X0t(t);i.l*=1-e;const r=PE(i),n=t.clone();return n.setColor(r),n.a=t.a,n}function jii(t,e){const i=t.clone();return i.a*=e,i}function Gii(t,e){const i=Nj(t);i.s*=e;const r=PE(i),n=t.clone();return n.setColor(r),n.a=t.a,n}function NL(t){return qe.toUnitRGBA(t)}function Hii(t,e){return t===e||t!=null&&t.equals(e)}function qii(t,e){return t===e||t!=null&&e!=null&>(t,e)}function Wii(t){return Mi(t[0],t[1],t[2],t.length>3?t[3]:1)}function Yii(t,e){const i=qe.toUnitRGBA(t);return i[3]*=e,i}(function(t){t[t.Low=160]="Low",t[t.High=225]="High"})(Fee||(Fee={}));function ea(t,e){return t[0]=e[0],t[1]=e[1],t}function or(t,e,i){return t[0]=e,t[1]=i,t}function yf(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t}function Rs(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t}function R4e(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t}function I4e(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t}function K0t(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function Q0t(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function emt(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t}function tmt(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t}function imt(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function qu(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t}function Ff(t,e,i,r){return t[0]=e[0]+i[0]*r,t[1]=e[1]+i[1]*r,t}function km(t,e){const i=e[0]-t[0],r=e[1]-t[1];return Math.sqrt(i*i+r*r)}function t0(t,e){const i=e[0]-t[0],r=e[1]-t[1];return i*i+r*r}function Y9(t){const e=t[0],i=t[1];return Math.sqrt(e*e+i*i)}function t1(t){const e=t[0],i=t[1];return e*e+i*i}function Tae(t,e){return t[0]=-e[0],t[1]=-e[1],t}function rmt(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function PP(t,e){const i=e[0],r=e[1];let n=i*i+r*r;return n>0&&(n=1/Math.sqrt(n),t[0]=e[0]*n,t[1]=e[1]*n),t}function fs(t,e){return t[0]*e[0]+t[1]*e[1]}function nmt(t,e,i){const r=e[0]*i[1]-e[1]*i[0];return t[0]=t[1]=0,t[2]=r,t}function Hu(t,e,i,r){const n=e[0],s=e[1];return t[0]=n+r*(i[0]-n),t[1]=s+r*(i[1]-s),t}function smt(t,e){e=e||1;const i=2*P9()*Math.PI;return t[0]=Math.cos(i)*e,t[1]=Math.sin(i)*e,t}function $4e(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[2]*n,t[1]=i[1]*r+i[3]*n,t}function mw(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[2]*n+i[4],t[1]=i[1]*r+i[3]*n+i[5],t}function omt(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[3]*n+i[6],t[1]=i[1]*r+i[4]*n+i[7],t}function amt(t,e,i){const r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t}function lmt(t,e,i,r){const n=e[0]-i[0],s=e[1]-i[1],o=Math.sin(r),a=Math.cos(r);return t[0]=n*a-s*o+i[0],t[1]=n*o+s*a+i[1],t}function cmt(t,e){const i=t[0],r=t[1],n=e[0],s=e[1];let o=i*i+r*r;o>0&&(o=1/Math.sqrt(o));let a=n*n+s*s;a>0&&(a=1/Math.sqrt(a));const c=(i*n+r*s)*o*a;return c>1?0:c<-1?Math.PI:Math.acos(c)}function umt(t){return"vec2("+t[0]+", "+t[1]+")"}function L4e(t,e){return t[0]===e[0]&&t[1]===e[1]}function D4e(t,e){const i=t[0],r=t[1],n=e[0],s=e[1],o=al();return Math.abs(i-n)<=o*Math.max(1,Math.abs(i),Math.abs(n))&&Math.abs(r-s)<=o*Math.max(1,Math.abs(r),Math.abs(s))}function hmt(t,e,i,r,n){let s=e[0]-i[0],o=e[1]-i[1];const a=(r[0]*s+r[1]*o)*(n-1);return s=r[0]*a,o=r[1]*a,t[0]=e[0]+s,t[1]=e[1]+o,t}const dmt=Y9,N4e=Rs,pmt=R4e,fmt=I4e,F4e=km,mmt=t0,gmt=t1;Object.freeze(Object.defineProperty({__proto__:null,add:yf,angle:cmt,ceil:K0t,copy:ea,cross:nmt,dist:F4e,distance:km,div:fmt,divide:I4e,dot:fs,equals:D4e,exactEquals:L4e,floor:Q0t,inverse:rmt,len:dmt,length:Y9,lerp:Hu,max:tmt,min:emt,mul:pmt,multiply:R4e,negate:Tae,normalize:PP,projectAndScale:hmt,random:smt,rotate:lmt,round:imt,scale:qu,scaleAndAdd:Ff,set:or,sqrDist:mmt,sqrLen:gmt,squaredDistance:t0,squaredLength:t1,str:umt,sub:N4e,subtract:Rs,transformMat2:$4e,transformMat2d:mw,transformMat3:omt,transformMat4:amt},Symbol.toStringTag,{value:"Module"}));function Eae(t){return Je((t-1e5)/9e5,0,1)}const kee=1e4,ymt=.085,Vw=1e5;let vmt=class{};const bn=vmt;function V(t,...e){let i="";for(let r=0;rr.setUniform3fv(e,i(n,s)))}};function B_(t){t.uniforms.add(new Oi("mainLightDirection",(e,i)=>i.lighting.mainLight.direction))}function a1(t){t.uniforms.add(new Oi("mainLightIntensity",(e,i)=>i.lighting.mainLight.intensity))}function yU(t){B_(t.fragment),a1(t.fragment),t.fragment.code.add(V`vec3 evaluateMainLighting(vec3 normal_global, float shadowing) { +}`)}var Pr;(function(t){t[t.Pass=0]="Pass",t[t.Draw=1]="Draw"})(Pr||(Pr={}));let Ds=class{constructor(e,i,r,n,s=null){if(this.name=e,this.type=i,this.arraySize=s,this.bind={[Pr.Pass]:null,[Pr.Draw]:null},n)switch(r){case Pr.Pass:this.bind[Pr.Pass]=n;break;case Pr.Draw:this.bind[Pr.Draw]=n}}equals(e){return this.type===e.type&&this.name===e.name&&this.arraySize===e.arraySize}},Oi=class extends Ds{constructor(e,i){super(e,"vec3",Pr.Pass,(r,n,s)=>r.setUniform3fv(e,i(n,s)))}};function W_(t){t.uniforms.add(new Oi("mainLightDirection",(e,i)=>i.lighting.mainLight.direction))}function m1(t){t.uniforms.add(new Oi("mainLightIntensity",(e,i)=>i.lighting.mainLight.intensity))}function vU(t){W_(t.fragment),m1(t.fragment),t.fragment.code.add(V`vec3 evaluateMainLighting(vec3 normal_global, float shadowing) { float dotVal = clamp(dot(normal_global, mainLightDirection), 0.0, 1.0); return mainLightIntensity * ((1.0 - shadowing) * dotVal); -}`)}let ln=class extends Ls{constructor(e,i){super(e,"vec2",Or.Pass,(r,n,s)=>r.setUniform2fv(e,i(n,s)))}},gr=class extends Ls{constructor(e,i){super(e,"vec4",Or.Pass,(r,n,s)=>r.setUniform4fv(e,i(n,s)))}},ft=class extends Ls{constructor(e,i){super(e,"float",Or.Pass,(r,n,s)=>r.setUniform1f(e,i(n,s)))}},_s=class extends Ls{constructor(e,i){super(e,"mat4",Or.Pass,(r,n,s)=>r.setUniformMatrix4fv(e,i(n,s)))}};const Nc=Xi();let bgt=class{constructor(e){this.message=e}toString(){return`AssertException: ${this.message}`}};function Xt(t,e){if(!t){e=e||"Assertion";const i=new Error(e).stack;throw new bgt(`${e} at ${i}`)}}function JE(t,e){t||(e=e||"",console.warn("Verify failed: "+e+` -`+new Error("verify").stack))}function mme(t,e,i,r){let n,s=(i[0]-t[0])/e[0],o=(r[0]-t[0])/e[0];s>o&&(n=s,s=o,o=n);let l=(i[1]-t[1])/e[1],c=(r[1]-t[1])/e[1];if(l>c&&(n=l,l=c,c=n),s>c||l>o)return!1;l>s&&(s=l),c_&&(n=f,f=_,_=n),!(s>_||f>o)&&(_2&&(n[2]=-Nc[2]),lp(Nc,Nc,i),Xt(Nc[3]!==0),n[0]=Nc[0]/Nc[3],n[1]=Nc[1]/Nc[3],n[2]=Nc[2]/Nc[3],n[0]=(.5*n[0]+.5)*r[2]+r[0],n[1]=(.5*n[1]+.5)*r[3]+r[1]}function wgt(t,e){return Math.log(t)/Math.log(e)}function xgt(t,e,i,r){t[12]=e,t[13]=i,t[14]=r}function BIe(t){return t[0]===1&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===1&&t[6]===0&&t[7]===0&&t[8]===0&&t[9]===0&&t[10]===1&&t[11]===0&&t[15]===1}const jIe=Ce.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");let GIe=class{constructor(){this._includedModules=new Map}include(e,i){if(this._includedModules.has(e)){const r=this._includedModules.get(e);if(r!==i){jIe.error("Trying to include shader module multiple times with different sets of options.");const n=new Set;for(const s of Object.keys(r))r[s]!==e[s]&&n.add(s);for(const s of Object.keys(e))r[s]!==e[s]&&n.add(s);n.forEach(s=>console.error(` ${s}: current ${r[s]} new ${e[s]}`))}}else this._includedModules.set(e,i),e(this.builder,i)}},Cr=class extends GIe{constructor(){super(...arguments),this.vertex=new yme,this.fragment=new yme,this.attributes=new Egt,this.varyings=new Cgt,this.extensions=new Ree,this.constants=new HIe,this.outputs=new $ee}get fragmentUniforms(){return this.fragment.uniforms.entries}get builder(){return this}generate(e){const i=this.extensions.generateSource(e),r=this.attributes.generateSource(e),n=this.varyings.generateSource(e),s=e==="vertex"?this.vertex:this.fragment,o=s.uniforms.generateSource(),l=s.code.generateSource(),c=e==="vertex"?Mgt:Agt,f=this.constants.generateSource().concat(s.constants.generateSource()),_=this.outputs.generateSource(e);return`#version 300 es +}`)}let cn=class extends Ds{constructor(e,i){super(e,"vec2",Pr.Pass,(r,n,s)=>r.setUniform2fv(e,i(n,s)))}},gr=class extends Ds{constructor(e,i){super(e,"vec4",Pr.Pass,(r,n,s)=>r.setUniform4fv(e,i(n,s)))}},ft=class extends Ds{constructor(e,i){super(e,"float",Pr.Pass,(r,n,s)=>r.setUniform1f(e,i(n,s)))}},bs=class extends Ds{constructor(e,i){super(e,"mat4",Pr.Pass,(r,n,s)=>r.setUniformMatrix4fv(e,i(n,s)))}};const zc=Xi();let _mt=class{constructor(e){this.message=e}toString(){return`AssertException: ${this.message}`}};function Xt(t,e){if(!t){e=e||"Assertion";const i=new Error(e).stack;throw new _mt(`${e} at ${i}`)}}function rC(t,e){t||(e=e||"",console.warn("Verify failed: "+e+` +`+new Error("verify").stack))}function gme(t,e,i,r){let n,s=(i[0]-t[0])/e[0],o=(r[0]-t[0])/e[0];s>o&&(n=s,s=o,o=n);let a=(i[1]-t[1])/e[1],c=(r[1]-t[1])/e[1];if(a>c&&(n=a,a=c,c=n),s>c||a>o)return!1;a>s&&(s=a),c_&&(n=p,p=_,_=n),!(s>_||p>o)&&(_2&&(n[2]=-zc[2]),dp(zc,zc,i),Xt(zc[3]!==0),n[0]=zc[0]/zc[3],n[1]=zc[1]/zc[3],n[2]=zc[2]/zc[3],n[0]=(.5*n[0]+.5)*r[2]+r[0],n[1]=(.5*n[1]+.5)*r[3]+r[1]}function bmt(t,e){return Math.log(t)/Math.log(e)}function wmt(t,e,i,r){t[12]=e,t[13]=i,t[14]=r}function k4e(t){return t[0]===1&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===1&&t[6]===0&&t[7]===0&&t[8]===0&&t[9]===0&&t[10]===1&&t[11]===0&&t[15]===1}const z4e=Ce.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");let U4e=class{constructor(){this._includedModules=new Map}include(e,i){if(this._includedModules.has(e)){const r=this._includedModules.get(e);if(r!==i){z4e.error("Trying to include shader module multiple times with different sets of options.");const n=new Set;for(const s of Object.keys(r))r[s]!==e[s]&&n.add(s);for(const s of Object.keys(e))r[s]!==e[s]&&n.add(s);n.forEach(s=>console.error(` ${s}: current ${r[s]} new ${e[s]}`))}}else this._includedModules.set(e,i),e(this.builder,i)}},Ar=class extends U4e{constructor(){super(...arguments),this.vertex=new vme,this.fragment=new vme,this.attributes=new Tmt,this.varyings=new Emt,this.extensions=new zee,this.constants=new V4e,this.outputs=new Vee}get fragmentUniforms(){return this.fragment.uniforms.entries}get builder(){return this}generate(e){const i=this.extensions.generateSource(e),r=this.attributes.generateSource(e),n=this.varyings.generateSource(e),s=e==="vertex"?this.vertex:this.fragment,o=s.uniforms.generateSource(),a=s.code.generateSource(),c=e==="vertex"?Amt:Cmt,p=this.constants.generateSource().concat(s.constants.generateSource()),_=this.outputs.generateSource(e);return`#version 300 es ${i.join(` `)} ${c} -${f.join(` +${p.join(` `)} ${o.join(` @@ -130,21 +119,21 @@ ${n.join(` ${_.join(` `)} -${l.join(` -`)}`}generateBindPass(e){const i=new Map;this.vertex.uniforms.entries.forEach(s=>{const o=s.bind[Or.Pass];o&&i.set(s.name,o)}),this.fragment.uniforms.entries.forEach(s=>{const o=s.bind[Or.Pass];o&&i.set(s.name,o)});const r=Array.from(i.values()),n=r.length;return(s,o)=>{for(let l=0;l{const o=s.bind[Or.Draw];o&&i.set(s.name,o)}),this.fragment.uniforms.entries.forEach(s=>{const o=s.bind[Or.Draw];o&&i.set(s.name,o)});const r=Array.from(i.values()),n=r.length;return(s,o,l)=>{for(let c=0;ce.arraySize!=null?`uniform ${e.type} ${e.name}[${e.arraySize}];`:`uniform ${e.type} ${e.name};`)}get entries(){return Array.from(this._entries.values())}},Tgt=class{constructor(){this._entries=new Array}add(e){this._entries.push(e)}generateSource(){return this._entries}},yme=class extends GIe{constructor(){super(...arguments),this.uniforms=new Sgt,this.code=new Tgt,this.constants=new HIe}get builder(){return this}},Egt=class{constructor(){this._entries=new Array}add(e,i){this._entries.push([e,i])}generateSource(e){return e==="fragment"?[]:this._entries.map(i=>`in ${i[1]} ${i[0]};`)}},Cgt=class{constructor(){this._entries=new Map}add(e,i){this._entries.has(e)&&Xt(this._entries.get(e)===i),this._entries.set(e,i)}generateSource(e){const i=new Array;return this._entries.forEach((r,n)=>i.push(e==="vertex"?`out ${r} ${n};`:`in ${r} ${n};`)),i}},Ree=class Iee{constructor(){this._entries=new Set}add(e){this._entries.add(e)}generateSource(e){const i=e==="vertex"?Iee.ALLOWLIST_VERTEX:Iee.ALLOWLIST_FRAGMENT;return Array.from(this._entries).filter(r=>i.includes(r)).map(r=>`#extension ${r} : enable`)}};Ree.ALLOWLIST_FRAGMENT=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives"],Ree.ALLOWLIST_VERTEX=[];let $ee=class Lee{constructor(){this._entries=new Map}add(e,i,r=0){const n=this._entries.get(r);n?Xt(n.name===e&&n.type===i,`Fragment shader output location ${r} occupied`):this._entries.set(r,{name:e,type:i})}generateSource(e){if(e==="vertex")return[];this._entries.size===0&&this._entries.set(0,{name:Lee.DEFAULT_NAME,type:Lee.DEFAULT_TYPE});const i=new Array;return this._entries.forEach((r,n)=>i.push(`layout(location = ${n}) out ${r.type} ${r.name};`)),i}};$ee.DEFAULT_TYPE="vec4",$ee.DEFAULT_NAME="fragColor";let HIe=class ia{constructor(){this._entries=new Set}add(e,i,r){let n="ERROR_CONSTRUCTOR_STRING";switch(i){case"float":n=ia._numberToFloatStr(r);break;case"int":n=ia._numberToIntStr(r);break;case"bool":n=r.toString();break;case"vec2":n=`vec2(${ia._numberToFloatStr(r[0])}, ${ia._numberToFloatStr(r[1])})`;break;case"vec3":n=`vec3(${ia._numberToFloatStr(r[0])}, ${ia._numberToFloatStr(r[1])}, ${ia._numberToFloatStr(r[2])})`;break;case"vec4":n=`vec4(${ia._numberToFloatStr(r[0])}, ${ia._numberToFloatStr(r[1])}, ${ia._numberToFloatStr(r[2])}, ${ia._numberToFloatStr(r[3])})`;break;case"ivec2":n=`ivec2(${ia._numberToIntStr(r[0])}, ${ia._numberToIntStr(r[1])})`;break;case"ivec3":n=`ivec3(${ia._numberToIntStr(r[0])}, ${ia._numberToIntStr(r[1])}, ${ia._numberToIntStr(r[2])})`;break;case"ivec4":n=`ivec4(${ia._numberToIntStr(r[0])}, ${ia._numberToIntStr(r[1])}, ${ia._numberToIntStr(r[2])}, ${ia._numberToIntStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":n=`${i}(${Array.prototype.map.call(r,s=>ia._numberToFloatStr(s)).join(", ")})`}return this._entries.add(`const ${i} ${e} = ${n};`),this}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}};const Agt=`#ifdef GL_FRAGMENT_PRECISION_HIGH +${a.join(` +`)}`}generateBindPass(e){const i=new Map;this.vertex.uniforms.entries.forEach(s=>{const o=s.bind[Pr.Pass];o&&i.set(s.name,o)}),this.fragment.uniforms.entries.forEach(s=>{const o=s.bind[Pr.Pass];o&&i.set(s.name,o)});const r=Array.from(i.values()),n=r.length;return(s,o)=>{for(let a=0;a{const o=s.bind[Pr.Draw];o&&i.set(s.name,o)}),this.fragment.uniforms.entries.forEach(s=>{const o=s.bind[Pr.Draw];o&&i.set(s.name,o)});const r=Array.from(i.values()),n=r.length;return(s,o,a)=>{for(let c=0;ce.arraySize!=null?`uniform ${e.type} ${e.name}[${e.arraySize}];`:`uniform ${e.type} ${e.name};`)}get entries(){return Array.from(this._entries.values())}},Smt=class{constructor(){this._entries=new Array}add(e){this._entries.push(e)}generateSource(){return this._entries}},vme=class extends U4e{constructor(){super(...arguments),this.uniforms=new xmt,this.code=new Smt,this.constants=new V4e}get builder(){return this}},Tmt=class{constructor(){this._entries=new Array}add(e,i){this._entries.push([e,i])}generateSource(e){return e==="fragment"?[]:this._entries.map(i=>`in ${i[1]} ${i[0]};`)}},Emt=class{constructor(){this._entries=new Map}add(e,i){this._entries.has(e)&&Xt(this._entries.get(e)===i),this._entries.set(e,i)}generateSource(e){const i=new Array;return this._entries.forEach((r,n)=>i.push(e==="vertex"?`out ${r} ${n};`:`in ${r} ${n};`)),i}},zee=class Uee{constructor(){this._entries=new Set}add(e){this._entries.add(e)}generateSource(e){const i=e==="vertex"?Uee.ALLOWLIST_VERTEX:Uee.ALLOWLIST_FRAGMENT;return Array.from(this._entries).filter(r=>i.includes(r)).map(r=>`#extension ${r} : enable`)}};zee.ALLOWLIST_FRAGMENT=["GL_EXT_shader_texture_lod","GL_OES_standard_derivatives"],zee.ALLOWLIST_VERTEX=[];let Vee=class Bee{constructor(){this._entries=new Map}add(e,i,r=0){const n=this._entries.get(r);n?Xt(n.name===e&&n.type===i,`Fragment shader output location ${r} occupied`):this._entries.set(r,{name:e,type:i})}generateSource(e){if(e==="vertex")return[];this._entries.size===0&&this._entries.set(0,{name:Bee.DEFAULT_NAME,type:Bee.DEFAULT_TYPE});const i=new Array;return this._entries.forEach((r,n)=>i.push(`layout(location = ${n}) out ${r.type} ${r.name};`)),i}};Vee.DEFAULT_TYPE="vec4",Vee.DEFAULT_NAME="fragColor";let V4e=class ra{constructor(){this._entries=new Set}add(e,i,r){let n="ERROR_CONSTRUCTOR_STRING";switch(i){case"float":n=ra._numberToFloatStr(r);break;case"int":n=ra._numberToIntStr(r);break;case"bool":n=r.toString();break;case"vec2":n=`vec2(${ra._numberToFloatStr(r[0])}, ${ra._numberToFloatStr(r[1])})`;break;case"vec3":n=`vec3(${ra._numberToFloatStr(r[0])}, ${ra._numberToFloatStr(r[1])}, ${ra._numberToFloatStr(r[2])})`;break;case"vec4":n=`vec4(${ra._numberToFloatStr(r[0])}, ${ra._numberToFloatStr(r[1])}, ${ra._numberToFloatStr(r[2])}, ${ra._numberToFloatStr(r[3])})`;break;case"ivec2":n=`ivec2(${ra._numberToIntStr(r[0])}, ${ra._numberToIntStr(r[1])})`;break;case"ivec3":n=`ivec3(${ra._numberToIntStr(r[0])}, ${ra._numberToIntStr(r[1])}, ${ra._numberToIntStr(r[2])})`;break;case"ivec4":n=`ivec4(${ra._numberToIntStr(r[0])}, ${ra._numberToIntStr(r[1])}, ${ra._numberToIntStr(r[2])}, ${ra._numberToIntStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":n=`${i}(${Array.prototype.map.call(r,s=>ra._numberToFloatStr(s)).join(", ")})`}return this._entries.add(`const ${i} ${e} = ${n};`),this}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}};const Cmt=`#ifdef GL_FRAGMENT_PRECISION_HIGH precision highp float; precision highp sampler2D; #else precision mediump float; precision mediump sampler2D; -#endif`,Mgt=`precision highp float; -precision highp sampler2D;`;let Zt=class extends Ls{constructor(e,i){super(e,"sampler2D",Or.Pass,(r,n,s)=>r.bindTexture(e,i(n,s)))}};const fO=nt(parseFloat(5802e-9.toFixed(6)),parseFloat(13558e-9.toFixed(6)),parseFloat(331e-7.toFixed(6))),aq=3,lq=nt(aq*parseFloat(65e-8.toFixed(6)),aq*parseFloat(1881e-9.toFixed(6)),aq*parseFloat(85e-9.toFixed(6))),Ogt=3996e-9,Pgt=nt(parseFloat(Number(fO[0]+lq[0]).toFixed(6)),parseFloat(Number(fO[1]+lq[1]).toFixed(6)),parseFloat(Number(fO[2]+lq[2]).toFixed(6)));function qIe(t){const e=new Cr;e.attributes.add(J.POSITION,"vec2"),e.include(My,{textureCoordinateType:So.Default}),e.varyings.add("worldRay","vec3"),e.varyings.add("eyeDir","vec3");const{vertex:i,fragment:r}=e;return i.uniforms.add(new _s("inverseProjectionMatrix",(n,s)=>s.camera.inverseProjectionMatrix),new _s("inverseViewMatrix",(n,s)=>sP(Rgt,s.camera.viewMatrix))),i.code.add(V`void main(void) { +#endif`,Amt=`precision highp float; +precision highp sampler2D;`;let Zt=class extends Ds{constructor(e,i){super(e,"sampler2D",Pr.Pass,(r,n,s)=>r.bindTexture(e,i(n,s)))}};const wO=st(parseFloat(5802e-9.toFixed(6)),parseFloat(13558e-9.toFixed(6)),parseFloat(331e-7.toFixed(6))),yq=3,vq=st(yq*parseFloat(65e-8.toFixed(6)),yq*parseFloat(1881e-9.toFixed(6)),yq*parseFloat(85e-9.toFixed(6))),Mmt=3996e-9,Omt=st(parseFloat(Number(wO[0]+vq[0]).toFixed(6)),parseFloat(Number(wO[1]+vq[1]).toFixed(6)),parseFloat(Number(wO[2]+vq[2]).toFixed(6)));function B4e(t){const e=new Ar;e.attributes.add(J.POSITION,"vec2"),e.include(Ly,{textureCoordinateType:To.Default}),e.varyings.add("worldRay","vec3"),e.varyings.add("eyeDir","vec3");const{vertex:i,fragment:r}=e;return i.uniforms.add(new bs("inverseProjectionMatrix",(n,s)=>s.camera.inverseProjectionMatrix),new bs("inverseViewMatrix",(n,s)=>u5(Pmt,s.camera.viewMatrix))),i.code.add(V`void main(void) { vec3 posViewNear = (inverseProjectionMatrix * vec4(position, -1, 1)).xyz; eyeDir = posViewNear; worldRay = (inverseViewMatrix * vec4(posViewNear, 0)).xyz; forwardTextureCoordinates(); gl_Position = vec4(position, 1, 1); -}`),r.uniforms.add(new Oi("backgroundColor",n=>n.backgroundColor),new ln("radii",n=>n.radii),new Oi("cameraPosition",(n,s)=>s.camera.eye),new gr("heightParameters",n=>n.heightParameters),new ft("innerFadeDistance",n=>n.innerFadeDistance),new ft("altitudeFade",n=>n.altitudeFade),new Zt("depthTexture",n=>n.depthTexture),new ft("hazeStrength",n=>n.hazeStrength)),r.constants.add("betaRayleigh","vec3",fO),r.constants.add("betaCombined","vec3",Pgt),r.constants.add("betaMie","float",Ogt),r.constants.add("scaleHeight","float",vgt*Nw),B_(r),e.include(Aj),t.haze&&(r.include(Kf),r.uniforms.add(new ln("nearFar",(n,s)=>s.camera.nearFar))),r.code.add(V`vec2 sphereIntersect(vec3 start, vec3 dir, float radius, bool planet) { +}`),r.uniforms.add(new Oi("backgroundColor",n=>n.backgroundColor),new cn("radii",n=>n.radii),new Oi("cameraPosition",(n,s)=>s.camera.eye),new gr("heightParameters",n=>n.heightParameters),new ft("innerFadeDistance",n=>n.innerFadeDistance),new ft("altitudeFade",n=>n.altitudeFade),new Zt("depthTexture",n=>n.depthTexture),new ft("hazeStrength",n=>n.hazeStrength)),r.constants.add("betaRayleigh","vec3",wO),r.constants.add("betaCombined","vec3",Omt),r.constants.add("betaMie","float",Mmt),r.constants.add("scaleHeight","float",ymt*Vw),W_(r),e.include(Fj),t.haze&&(r.include(i0),r.uniforms.add(new cn("nearFar",(n,s)=>s.camera.nearFar))),r.code.add(V`vec2 sphereIntersect(vec3 start, vec3 dir, float radius, bool planet) { float a = dot(dir, dir); float b = 2.0 * dot(dir, start); float c = planet ? heightParameters[1] - radius * radius : heightParameters[2]; @@ -354,12 +343,12 @@ return scaleHeight * chapmanApproximation(radii[0] / scaleHeight, h, dot(normali fragColor = delinearizeGamma(vec4(col, alpha)); ${t.haze?"":V`fragColor = applyUndergroundAtmosphere(rayDir, mainLightDirection, fragColor);`} } - `),e}const Rgt=Qe(),Igt=Object.freeze(Object.defineProperty({__proto__:null,betaRayleigh:fO,build:qIe},Symbol.toStringTag,{value:"Module"}));let Rr=class{constructor(e,i){this._module=e,this._loadModule=i}get(){return this._module}async reload(){return this._module=await this._loadModule(),this._module}};var In,sr,st,Xy,fi,vm,x5,Yt,Zr,bs,ki,Bi,Hs,ci,zt,ga,Wa,Pr,tp,Vl;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT"})(In||(In={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(sr||(sr={})),function(t){t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(st||(st={})),function(t){t[t.ADD=32774]="ADD",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.SUBTRACT=32778]="SUBTRACT",t[t.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(Xy||(Xy={})),function(t){t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER"}(fi||(fi={})),function(t){t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(vm||(vm={})),function(t){t[t.CW=2304]="CW",t[t.CCW=2305]="CCW"}(x5||(x5={})),function(t){t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT"}(Yt||(Yt={})),function(t){t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS"}(Zr||(Zr={})),function(t){t[t.ZERO=0]="ZERO",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP"}(bs||(bs={})),function(t){t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(ki||(ki={})),function(t){t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(Bi||(Bi={})),function(t){t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY"}(Hs||(Hs={})),function(t){t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.RED=6403]="RED",t[t.RG=33319]="RG",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER"}(ci||(ci={})),function(t){t[t.RGBA4=32854]="RGBA4",t[t.R16F=33325]="R16F",t[t.RG16F=33327]="RG16F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.R32F=33326]="R32F",t[t.RG32F=33328]="RG32F",t[t.RGBA32F=34836]="RGBA32F",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB5_A1=32855]="RGB5_A1",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.RGB16F=34843]="RGB16F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.RGB565=36194]="RGB565",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2=32857]="RGB10_A2",t[t.RGB10_A2UI=36975]="RGB10_A2UI"}(zt||(zt={})),function(t){t[t.FLOAT=5126]="FLOAT",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.INT=5124]="INT",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV"}(ga||(ga={})),function(t){t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(Wa||(Wa={})),function(t){t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.STATIC_READ=35045]="STATIC_READ",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.STREAM_COPY=35042]="STREAM_COPY"}(Pr||(Pr={})),function(t){t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER"}(tp||(tp={})),function(t){t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(Vl||(Vl={}));const cq=33984;var _o,zu,Dee;(function(t){t[t.Texture=0]="Texture",t[t.BufferObject=1]="BufferObject",t[t.VertexArrayObject=2]="VertexArrayObject",t[t.Shader=3]="Shader",t[t.Program=4]="Program",t[t.FramebufferObject=5]="FramebufferObject",t[t.Renderbuffer=6]="Renderbuffer",t[t.Sync=7]="Sync",t[t.UNCOUNTED=8]="UNCOUNTED",t[t.LinesOfCode=8]="LinesOfCode",t[t.Uniform=9]="Uniform",t[t.COUNT=10]="COUNT"})(_o||(_o={})),function(t){t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15"}(zu||(zu={})),function(t){t[t.NONE=0]="NONE",t[t.BACK=1029]="BACK"}(Dee||(Dee={}));const vme=33306;var eo,_me,bme,wme,vU,Nee,xme;(function(t){t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"})(eo||(eo={})),function(t){t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT=5124]="INT",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(_me||(_me={})),function(t){t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS"}(bme||(bme={})),function(t){t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED"}(wme||(wme={})),function(t){t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED"}(vU||(vU={})),function(t){t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(Nee||(Nee={})),function(t){t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(xme||(xme={}));let Hr=class{constructor(e,i,r){this.release=r,this.initializeConfiguration(e,i),this._configuration=i.snapshot(),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e.rctx.capabilities)}destroy(){this._program=Kt(this._program),this._pipeline=this._configuration=null}reload(e){Kt(this._program),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e.rctx.capabilities)}get program(){return this._program}get compiled(){return this.program.compiled}get key(){return this._configuration.key}get configuration(){return this._configuration}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}get primitiveType(){return sr.TRIANGLES}getPipeline(e,i,r){return this._pipeline}initializeConfiguration(e,i){}};const Er=new Map([[J.POSITION,0],[J.NORMAL,1],[J.NORMALCOMPRESSED,1],[J.UV0,2],[J.COLOR,3],[J.COLORFEATUREATTRIBUTE,3],[J.SIZE,4],[J.TANGENT,4],[J.AUXPOS1,5],[J.SYMBOLCOLOR,5],[J.AUXPOS2,6],[J.FEATUREATTRIBUTE,6],[J.INSTANCEFEATUREATTRIBUTE,6],[J.INSTANCECOLOR,7],[J.OBJECTANDLAYERIDCOLOR,7],[J.INSTANCEOBJECTANDLAYERIDCOLOR,7],[J.INSTANCEMODEL,8],[J.INSTANCEMODELNORMAL,12],[J.INSTANCEMODELORIGINHI,11],[J.INSTANCEMODELORIGINLO,15]]),$gt=Ce.getLogger("esri.views.webgl.checkWebGLError");function Lgt(t,e){switch(e){case t.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case t.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case t.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case t.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case t.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case t.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}const WIe=!!Le("enable-feature:webgl-debug");function om(){return WIe}function Fee(){return WIe}function cy(t){if(om()){const e=t.getError();if(e){const i=Lgt(t,e),r=new Error().stack;$gt.error(new se("webgl-error","WebGL error occurred",{message:i,stack:r}))}}}let Ir=class{constructor(e,i,r){this._context=e,this._locations=r,this._textures=new Map,this._freeTextureUnits=new Pi({deallocator:null}),this._glProgram=e.programCache.acquire(i.generate("vertex"),i.generate("fragment"),r),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bindPass=i.generateBindPass(this),this.bindDraw=i.generateBindDraw(this),this._fragmentUniforms=om()?i.fragmentUniforms:null}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get compiled(){return this._glProgram.compiled}setUniform1b(e,i){this._glProgram.setUniform1i(e,i?1:0)}setUniform1i(e,i){this._glProgram.setUniform1i(e,i)}setUniform1f(e,i){this._glProgram.setUniform1f(e,i)}setUniform2fv(e,i){this._glProgram.setUniform2fv(e,i)}setUniform3fv(e,i){this._glProgram.setUniform3fv(e,i)}setUniform4fv(e,i){this._glProgram.setUniform4fv(e,i)}setUniformMatrix3fv(e,i){this._glProgram.setUniformMatrix3fv(e,i)}setUniformMatrix4fv(e,i){this._glProgram.setUniformMatrix4fv(e,i)}setUniform1fv(e,i){this._glProgram.setUniform1fv(e,i)}setUniform1iv(e,i){this._glProgram.setUniform1iv(e,i)}setUniform2iv(e,i){this._glProgram.setUniform3iv(e,i)}setUniform3iv(e,i){this._glProgram.setUniform3iv(e,i)}setUniform4iv(e,i){this._glProgram.setUniform4iv(e,i)}assertCompatibleVertexAttributeLocations(e){e.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){this._textures.clear(),this._freeTextureUnits.clear()}bindTexture(e,i){if((i==null?void 0:i.glName)==null){const n=this._textures.get(e);return n&&(this._context.bindTexture(null,n.unit),this._freeTextureUnit(n),this._textures.delete(e)),null}let r=this._textures.get(e);return r==null?(r=this._allocTextureUnit(i),this._textures.set(e,r)):r.texture=i,this._context.useProgram(this),this.setUniform1i(e,r.unit),this._context.bindTexture(i,r.unit),r.unit}rebindTextures(){this._context.useProgram(this),this._textures.forEach((e,i)=>{this._context.bindTexture(e.texture,e.unit),this.setUniform1i(i,e.unit)}),this._fragmentUniforms!=null&&this._fragmentUniforms.forEach(e=>{e.type!=="sampler2D"&&e.type!=="samplerCube"||this._textures.has(e.name)||console.error(`Texture sampler ${e.name} has no bound texture`)})}_allocTextureUnit(e){return{texture:e,unit:this._freeTextureUnits.length===0?this._textures.size:this._freeTextureUnits.pop()}}_freeTextureUnit(e){this._freeTextureUnits.push(e.unit)}};var Ln,WT,no,U2,Zu,S_,mn,Xh,Jv;(function(t){t[t.None=0]="None",t[t.Front=1]="Front",t[t.Back=2]="Back",t[t.COUNT=3]="COUNT"})(Ln||(Ln={})),function(t){t[t.Less=0]="Less",t[t.Lequal=1]="Lequal",t[t.COUNT=2]="COUNT"}(WT||(WT={})),function(t){t[t.BACKGROUND=0]="BACKGROUND",t[t.UPDATE=1]="UPDATE"}(no||(no={})),function(t){t[t.NOT_LOADED=0]="NOT_LOADED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED"}(U2||(U2={})),function(t){t[t.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",t[t.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(Zu||(Zu={})),function(t){t[t.Highlight=0]="Highlight",t[t.MaskOccludee=1]="MaskOccludee",t[t.COUNT=2]="COUNT"}(S_||(S_={})),function(t){t[t.Blend=0]="Blend",t[t.Opaque=1]="Opaque",t[t.Mask=2]="Mask",t[t.MaskBlend=3]="MaskBlend",t[t.COUNT=4]="COUNT"}(mn||(mn={})),function(t){t[t.OFF=0]="OFF",t[t.ON=1]="ON"}(Xh||(Xh={})),function(t){t.DDS_ENCODING="image/vnd-ms.dds",t.KTX2_ENCODING="image/ktx2",t.BASIS_ENCODING="image/x.basis"}(Jv||(Jv={}));function hd(t,e,i=Xy.ADD,r=[0,0,0,0]){return{srcRgb:t,srcAlpha:t,dstRgb:e,dstAlpha:e,opRgb:i,opAlpha:i,color:{r:r[0],g:r[1],b:r[2],a:r[3]}}}function Ol(t,e,i,r,n=Xy.ADD,s=Xy.ADD,o=[0,0,0,0]){return{srcRgb:t,srcAlpha:e,dstRgb:i,dstAlpha:r,opRgb:n,opAlpha:s,color:{r:o[0],g:o[1],b:o[2],a:o[3]}}}const pae={face:vm.BACK,mode:x5.CCW},YIe={face:vm.FRONT,mode:x5.CCW},Mj=t=>t===Ln.Back?pae:t===Ln.Front?YIe:null,rh={zNear:0,zFar:1},ji={r:!0,g:!0,b:!0,a:!0};function Dgt(t){return Ggt.intern(t)}function Ngt(t){return Hgt.intern(t)}function Fgt(t){return qgt.intern(t)}function kgt(t){return Wgt.intern(t)}function zgt(t){return Ygt.intern(t)}function Ugt(t){return Xgt.intern(t)}function Vgt(t){return Zgt.intern(t)}function Bgt(t){return Jgt.intern(t)}function jgt(t){return Kgt.intern(t)}function Ti(t){return Qgt.intern(t)}let l1=class{constructor(e,i){this._makeKey=e,this._makeRef=i,this._interns=new Map}intern(e){if(!e)return null;const i=this._makeKey(e),r=this._interns;return r.has(i)||r.set(i,this._makeRef(e)),r.get(i)??null}};function c1(t){return"["+t.join(",")+"]"}const Ggt=new l1(XIe,t=>({__tag:"Blending",...t}));function XIe(t){return t?c1([t.srcRgb,t.srcAlpha,t.dstRgb,t.dstAlpha,t.opRgb,t.opAlpha,t.color.r,t.color.g,t.color.b,t.color.a]):null}const Hgt=new l1(ZIe,t=>({__tag:"Culling",...t}));function ZIe(t){return t?c1([t.face,t.mode]):null}const qgt=new l1(JIe,t=>({__tag:"PolygonOffset",...t}));function JIe(t){return t?c1([t.factor,t.units]):null}const Wgt=new l1(KIe,t=>({__tag:"DepthTest",...t}));function KIe(t){return t?c1([t.func]):null}const Ygt=new l1(QIe,t=>({__tag:"StencilTest",...t}));function QIe(t){return t?c1([t.function.func,t.function.ref,t.function.mask,t.operation.fail,t.operation.zFail,t.operation.zPass]):null}const Xgt=new l1(e$e,t=>({__tag:"DepthWrite",...t}));function e$e(t){return t?c1([t.zNear,t.zFar]):null}const Zgt=new l1(t$e,t=>({__tag:"ColorWrite",...t}));function t$e(t){return t?c1([t.r,t.g,t.b,t.a]):null}const Jgt=new l1(i$e,t=>({__tag:"StencilWrite",...t}));function i$e(t){return t?c1([t.mask]):null}const Kgt=new l1(r$e,t=>({__tag:"DrawBuffers",...t}));function r$e(t){return t?c1(t.buffers):null}const Qgt=new l1(eyt,t=>({blending:Dgt(t.blending),culling:Ngt(t.culling),polygonOffset:Fgt(t.polygonOffset),depthTest:kgt(t.depthTest),stencilTest:zgt(t.stencilTest),depthWrite:Ugt(t.depthWrite),colorWrite:Vgt(t.colorWrite),stencilWrite:Bgt(t.stencilWrite),drawBuffers:jgt(t.drawBuffers)}));function eyt(t){return t?c1([XIe(t.blending),ZIe(t.culling),JIe(t.polygonOffset),KIe(t.depthTest),QIe(t.stencilTest),e$e(t.depthWrite),t$e(t.colorWrite),i$e(t.stencilWrite),r$e(t.drawBuffers)]):null}let tyt=class{constructor(e){this._pipelineInvalid=!0,this._blendingInvalid=!0,this._cullingInvalid=!0,this._polygonOffsetInvalid=!0,this._depthTestInvalid=!0,this._stencilTestInvalid=!0,this._depthWriteInvalid=!0,this._colorWriteInvalid=!0,this._stencilWriteInvalid=!0,this._drawBuffersInvalid=!0,this._stateSetters=e}setPipeline(e){(this._pipelineInvalid||e!==this._pipeline)&&(this._setBlending(e.blending),this._setCulling(e.culling),this._setPolygonOffset(e.polygonOffset),this._setDepthTest(e.depthTest),this._setStencilTest(e.stencilTest),this._setDepthWrite(e.depthWrite),this._setColorWrite(e.colorWrite),this._setStencilWrite(e.stencilWrite),this._setDrawBuffers(e.drawBuffers),this._pipeline=e),this._pipelineInvalid=!1}invalidateBlending(){this._blendingInvalid=!0,this._pipelineInvalid=!0}invalidateCulling(){this._cullingInvalid=!0,this._pipelineInvalid=!0}invalidatePolygonOffset(){this._polygonOffsetInvalid=!0,this._pipelineInvalid=!0}invalidateDepthTest(){this._depthTestInvalid=!0,this._pipelineInvalid=!0}invalidateStencilTest(){this._stencilTestInvalid=!0,this._pipelineInvalid=!0}invalidateDepthWrite(){this._depthWriteInvalid=!0,this._pipelineInvalid=!0}invalidateColorWrite(){this._colorWriteInvalid=!0,this._pipelineInvalid=!0}invalidateStencilWrite(){this._stencilTestInvalid=!0,this._pipelineInvalid=!0}invalidateDrawBuffers(){this._drawBuffersInvalid=!0,this._pipelineInvalid=!0}_setBlending(e){this._blending=this._setSubState(e,this._blending,this._blendingInvalid,this._stateSetters.setBlending),this._blendingInvalid=!1}_setCulling(e){this._culling=this._setSubState(e,this._culling,this._cullingInvalid,this._stateSetters.setCulling),this._cullingInvalid=!1}_setPolygonOffset(e){this._polygonOffset=this._setSubState(e,this._polygonOffset,this._polygonOffsetInvalid,this._stateSetters.setPolygonOffset),this._polygonOffsetInvalid=!1}_setDepthTest(e){this._depthTest=this._setSubState(e,this._depthTest,this._depthTestInvalid,this._stateSetters.setDepthTest),this._depthTestInvalid=!1}_setStencilTest(e){this._stencilTest=this._setSubState(e,this._stencilTest,this._stencilTestInvalid,this._stateSetters.setStencilTest),this._stencilTestInvalid=!1}_setDepthWrite(e){this._depthWrite=this._setSubState(e,this._depthWrite,this._depthWriteInvalid,this._stateSetters.setDepthWrite),this._depthWriteInvalid=!1}_setColorWrite(e){this._colorWrite=this._setSubState(e,this._colorWrite,this._colorWriteInvalid,this._stateSetters.setColorWrite),this._colorWriteInvalid=!1}_setStencilWrite(e){this._stencilWrite=this._setSubState(e,this._stencilWrite,this._stencilWriteInvalid,this._stateSetters.setStencilWrite),this._stencilTestInvalid=!1}_setDrawBuffers(e){this._drawBuffers=this._setSubState(e,this._drawBuffers,this._drawBuffersInvalid,this._stateSetters.setDrawBuffers),this._drawBuffersInvalid=!1}_setSubState(e,i,r,n){return(r||e!==i)&&(n(e),this._pipelineInvalid=!0),e}},iyt=class extends _n{constructor(){super(...arguments),this.heightParameters=Xi(),this.radii=yt(),this.innerFadeDistance=0,this.altitudeFade=0,this.hazeStrength=1,this.renderScale=yt(),this.backgroundColor=W()}},tI=class n$e extends Hr{initializeProgram(e){return new Ir(e.rctx,n$e.shader.get().build(this.configuration),Er)}initializePipeline(){return this.configuration.reduced?Ti({blending:hd(st.ONE,st.ZERO),depthTest:{func:Zr.ALWAYS},colorWrite:ji}):this.configuration.haze?Ti({blending:Ol(st.ONE,st.ZERO,st.ONE_MINUS_SRC_COLOR,st.ONE),colorWrite:ji}):Ti({blending:hd(st.SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};tI.shader=new Rr(Igt,()=>we(()=>Promise.resolve().then(()=>dWt),void 0));let nh=class extends _n{constructor(){super(),this._key="",this._keyDirty=!1,this._parameterBits=this._parameterBits?this._parameterBits.map(()=>0):[],this._parameterNames||(this._parameterNames=[])}get key(){return this._keyDirty&&(this._keyDirty=!1,this._key=String.fromCharCode.apply(String,this._parameterBits)),this._key}snapshot(){const e=this._parameterNames,i={key:this.key};for(const r of e)i[r]=this[r];return i}};function fe(t={}){return(e,i)=>{if(e._parameterNames=e._parameterNames??[],e._parameterNames.push(i),t.constValue!=null)Object.defineProperty(e,i,{get:()=>t.constValue});else{const r=e._parameterNames.length-1,n=t.count||2,s=Math.ceil(Math.log2(n)),o=e._parameterBits??[0];let l=0;for(;o[l]+s>16;)l++,l>=o.length&&o.push(0);e._parameterBits=o;const c=o[l],f=(1<this._remove(r,n))}hitrate(){return this._cache.hitRate}destroy(){this._cache.destroy()}clear(){this._cache.clear()}pop(e){const i=this._cache.peek(e);if(!i)return;const r=i.pop();if(i.length>0){const n=i.reduce((s,o)=>s+o.usedMemory,0);this._cache.updateSize(e,i,n)}else this._cache.pop(e);return r}put(e,i,r=t$){const n=this._cache.peek(e);if(!n)return void this._cache.put(e,[i],i.usedMemory,r);n.push(i);const s=n.reduce((o,l)=>o+l.usedMemory,0);this._cache.updateSize(e,n,s)}_remove(e,i){var r;switch(i){case nm.ALL:return e.forEach(n=>n.dispose()),0;case nm.SOME:return(r=e.shift())==null||r.dispose(),e.reduce((n,s)=>n+s.usedMemory,0)}}},uq=class{constructor(e,i){this._last=new Pi,this._incarnation=0,this._cache=new G9(e,i)}destroy(){var e;(e=this._last)==null||e.forAll(i=>i.dispose()),this._last=null,this._cache.destroy()}set interactive(e){var i;e&&!this._last?this._last=new Pi:e||((i=this._last)==null||i.forAll(r=>r.dispose()),this._last=null)}clean(){var e;(e=this._last)==null||e.filterInPlace(i=>!(i.incarnationr.key===e);if(i)return this._last.removeUnordered(i),i}return this._cache.pop(e)}put(e){e.incarnation=this._incarnation,this._last?this._last.push(e):this._cache.put(e.key,e)}get usedMemory(){var e;return((e=this._last)==null?void 0:e.reduce((i,r)=>i+r.usedMemory,0))??0}};var cr;function kee(t,e,i={}){const r=e===cr.WEBGL1?"webgl":"webgl2";return t.getContext(r,i)||null}function ryt(t,e,i={}){const r=s$e(t);for(const n of r){const s=kee(e,n,i);if(s)return s}return null}function s$e(t){if(t==="3d")return[cr.WEBGL2];const e=Le("esri-force-webgl");return e===cr.WEBGL1||e===cr.WEBGL2?[e]:Le("mac")&&Le("chrome")?[cr.WEBGL1,cr.WEBGL2]:[cr.WEBGL2,cr.WEBGL1]}(function(t){t[t.WEBGL1=1]="WEBGL1",t[t.WEBGL2=2]="WEBGL2"})(cr||(cr={}));const tg=Ce.getLogger("esri.views.webgl.BufferObject");let Yr=class VA{static createIndex(e,i,r){return new VA(e,fi.ELEMENT_ARRAY_BUFFER,i,r)}static createVertex(e,i,r){return new VA(e,fi.ARRAY_BUFFER,i,r)}static createUniform(e,i,r){if(e.type!==cr.WEBGL2)throw new Error("Uniform buffers are supported in WebGL2 only!");return new VA(e,fi.UNIFORM_BUFFER,i,r)}static createPixelPack(e,i=Pr.STREAM_READ,r){if(e.type!==cr.WEBGL2)throw new Error("Pixel pack buffers are supported in WebGL2 only!");const n=new VA(e,fi.PIXEL_PACK_BUFFER,i);return r&&n.setSize(r),n}static createPixelUnpack(e,i=Pr.STREAM_DRAW,r){if(e.type!==cr.WEBGL2)throw new Error("Pixel unpack buffers are supported in WebGL2 only!");return new VA(e,fi.PIXEL_UNPACK_BUFFER,i,r)}constructor(e,i,r,n){this._context=e,this.bufferType=i,this.usage=r,this._glName=null,this._size=-1,this._indexType=void 0,e.instanceCounter.increment(_o.BufferObject,this),this._glName=this._context.gl.createBuffer(),cy(this._context.gl),n&&this.setData(n)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get byteLength(){return this.bufferType===fi.ELEMENT_ARRAY_BUFFER?this._indexType===Yt.UNSIGNED_INT?4*this._size:2*this._size:this._size}get _isVAOAware(){return this.bufferType===fi.ELEMENT_ARRAY_BUFFER||this.bufferType===fi.ARRAY_BUFFER}dispose(){var e;(e=this._context)!=null&&e.gl?(this._glName&&(this._context.gl.deleteBuffer(this._glName),this._glName=null),this._context.instanceCounter.decrement(_o.BufferObject,this),this._context=null):this._glName&&tg.warn("Leaked WebGL buffer object")}setSize(e,i=null){if(e<=0&&tg.error("Buffer size needs to be positive!"),this.bufferType===fi.ELEMENT_ARRAY_BUFFER&&i!=null)switch(this._indexType=i,i){case Yt.UNSIGNED_SHORT:e*=2;break;case Yt.UNSIGNED_INT:e*=4}this._setBufferData(e)}setData(e){if(!e)return;let i=e.byteLength;this.bufferType===fi.ELEMENT_ARRAY_BUFFER&&(jV(e)&&(i/=2,this._indexType=Yt.UNSIGNED_SHORT),HV(e)&&(i/=4,this._indexType=Yt.UNSIGNED_INT)),this._setBufferData(i,e)}_setBufferData(e,i=null){this._size=e;const r=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const n=this._context.gl;i!=null?n.bufferData(this.bufferType,i,this.usage):n.bufferData(this.bufferType,e,this.usage),cy(n),this._isVAOAware&&this._context.bindVAO(r)}setSubData(e,i,r,n){if(!e)return;(i<0||i*e.BYTES_PER_ELEMENT>=this.byteLength)&&tg.error("offset is out of range!"),r>=n&&tg.error("end must be bigger than start!"),(i+(n-r))*e.BYTES_PER_ELEMENT>this.byteLength&&tg.error("An attempt to write beyond the end of the buffer!");const s=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const o=this._context.gl;if(this._context.type===cr.WEBGL2)o.bufferSubData(this.bufferType,i*e.BYTES_PER_ELEMENT,e,r,n-r);else{const l=r===0&&n===e.length?e:e.subarray(r,n);o.bufferSubData(this.bufferType,i*e.BYTES_PER_ELEMENT,l)}cy(o),this._isVAOAware&&this._context.bindVAO(s)}getSubData(e,i=0,r,n){if(this._context.type!==cr.WEBGL2)return void tg.error("Get buffer subdata is supported in WebGL2 only!");if(r<0||n<0)return void tg.error("Problem getting subdata: offset and length were less than zero!");const s=nyt(e)?e.BYTES_PER_ELEMENT:1;if(s*((r??0)+(n??0))>e.byteLength)return void tg.error("Problem getting subdata: offset and length exceeded destination size!");i+s*(n??0)>this.byteLength&&tg.warn("Potential problem getting subdata: requested data exceeds buffer size!");const o=this._context.gl;this._context.bindBuffer(this,fi.COPY_READ_BUFFER),o.getBufferSubData(fi.COPY_READ_BUFFER,i,e,r,n),this._context.unbindBuffer(fi.COPY_READ_BUFFER)}async getSubDataAsync(e,i=0,r,n){this._context.type===cr.WEBGL2?(await this._context.clientWaitAsync(),this.getSubData(e,i,r,n)):tg.error("Get buffer subdata is supported in WebGL2 only!")}};function nyt(t){return Cje(t)}var V2;(function(t){t[t.Texture=0]="Texture",t[t.RenderBuffer=1]="RenderBuffer"})(V2||(V2={}));function syt(t){const e=t.gl;switch(e.getError()){case e.NO_ERROR:return null;case e.INVALID_ENUM:return"An unacceptable value has been specified for an enumerated argument";case e.INVALID_VALUE:return"An unacceptable value has been specified for an argument";case e.INVALID_OPERATION:return"The specified command is not allowed for the current state";case e.INVALID_FRAMEBUFFER_OPERATION:return"The currently bound framebuffer is not framebuffer complete";case e.OUT_OF_MEMORY:return"Not enough memory is left to execute the command";case e.CONTEXT_LOST_WEBGL:return"WebGL context is lost"}return"Unknown error"}function Kv(t,e){return t.vertexBuffers[e].byteLength/oyt(t.layout[e])}function oyt(t){return t[0].stride}function fae(t,e,i,r,n=0){var o,l,c;const s=t.gl;t.bindBuffer(i);for(const f of r){const _=e.get(f.name);_===void 0&&console.error(`There is no location for vertex attribute '${f.name}' defined.`);const x=n*f.stride;if(f.count<=4)s.vertexAttribPointer(_,f.count,f.type,f.normalized,f.stride,f.offset+x),s.enableVertexAttribArray(_),f.divisor>0&&((o=t.gl2)==null||o.vertexAttribDivisor(_,f.divisor));else if(f.count===9)for(let T=0;T<3;T++)s.vertexAttribPointer(_+T,3,f.type,f.normalized,f.stride,f.offset+12*T+x),s.enableVertexAttribArray(_+T),f.divisor>0&&((l=t.gl2)==null||l.vertexAttribDivisor(_+T,f.divisor));else if(f.count===16)for(let T=0;T<4;T++)s.vertexAttribPointer(_+T,4,f.type,f.normalized,f.stride,f.offset+16*T+x),s.enableVertexAttribArray(_+T),f.divisor>0&&((c=t.gl2)==null||c.vertexAttribDivisor(_+T,f.divisor));else console.error("Unsupported vertex attribute element count: "+f.count)}}function mae(t,e,i,r){var s,o,l;const n=t.gl;t.bindBuffer(i);for(const c of r){const f=e.get(c.name);if(c.count<=4)n.disableVertexAttribArray(f),c.divisor&&c.divisor>0&&((s=t.gl2)==null||s.vertexAttribDivisor(f,0));else if(c.count===9)for(let _=0;_<3;_++)n.disableVertexAttribArray(f+_),c.divisor&&c.divisor>0&&((o=t.gl2)==null||o.vertexAttribDivisor(f+_,0));else if(c.count===16)for(let _=0;_<4;_++)n.disableVertexAttribArray(f+_),c.divisor&&c.divisor>0&&((l=t.gl2)==null||l.vertexAttribDivisor(f+_,0));else console.error("Unsupported vertex attribute element count: "+c.count)}t.unbindBuffer(fi.ARRAY_BUFFER)}function gae(t){switch(t){case ci.ALPHA:case ci.LUMINANCE:case ci.RED:case ci.RED_INTEGER:case zt.R8:case zt.R8I:case zt.R8UI:case zt.R8_SNORM:case Wa.STENCIL_INDEX8:return 1;case ci.LUMINANCE_ALPHA:case ci.RG:case ci.RG_INTEGER:case zt.RGBA4:case zt.R16F:case zt.R16I:case zt.R16UI:case zt.RG8:case zt.RG8I:case zt.RG8UI:case zt.RG8_SNORM:case zt.RGB565:case zt.RGB5_A1:case Wa.DEPTH_COMPONENT16:return 2;case ci.DEPTH_COMPONENT:case ci.RGB:case ci.RGB_INTEGER:case zt.RGB8:case zt.RGB8I:case zt.RGB8UI:case zt.RGB8_SNORM:case zt.SRGB8:case Wa.DEPTH_COMPONENT24:return 3;case ci.DEPTH_STENCIL:case ci.DEPTH24_STENCIL8:case ci.RGBA:case ci.RGBA_INTEGER:case zt.RGBA8:case zt.R32F:case zt.R11F_G11F_B10F:case zt.RG16F:case zt.R32I:case zt.R32UI:case zt.RG16I:case zt.RG16UI:case zt.RGBA8I:case zt.RGBA8UI:case zt.RGBA8_SNORM:case zt.SRGB8_ALPHA8:case zt.RGB9_E5:case zt.RGB10_A2UI:case zt.RGB10_A2:case Wa.DEPTH_STENCIL:case Wa.DEPTH_COMPONENT32F:case Wa.DEPTH24_STENCIL8:return 4;case Wa.DEPTH32F_STENCIL8:return 5;case zt.RGB16F:case zt.RGB16I:case zt.RGB16UI:return 6;case zt.RG32F:case zt.RG32I:case zt.RG32UI:case zt.RGBA16F:case zt.RGBA16I:case zt.RGBA16UI:return 8;case zt.RGB32F:case zt.RGB32I:case zt.RGB32UI:return 12;case zt.RGBA32F:case zt.RGBA32I:case zt.RGBA32UI:return 16;case eo.COMPRESSED_RGB_S3TC_DXT1_EXT:case eo.COMPRESSED_RGBA_S3TC_DXT1_EXT:return .5;case eo.COMPRESSED_RGBA_S3TC_DXT3_EXT:case eo.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case eo.COMPRESSED_R11_EAC:case eo.COMPRESSED_SIGNED_R11_EAC:case eo.COMPRESSED_RGB8_ETC2:case eo.COMPRESSED_SRGB8_ETC2:case eo.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case eo.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return .5;case eo.COMPRESSED_RG11_EAC:case eo.COMPRESSED_SIGNED_RG11_EAC:case eo.COMPRESSED_RGBA8_ETC2_EAC:case eo.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}let $F=class{constructor(e,i,r=i){this.internalFormat=e,this.width=i,this.height=r,this.multisampled=!1,this.samples=1}};function ayt(t){return t.width<=0||t.height<=0||t.internalFormat==null?0:t.width*t.height*gae(t.internalFormat)}let o$e=class{constructor(e,i){this._context=e,this._descriptor=i,this.type=V2.RenderBuffer,this._context.instanceCounter.increment(_o.Renderbuffer,this);const r=this._context.gl;this.glName=r.createRenderbuffer(),this._context.bindRenderbuffer(this);const{width:n,height:s,internalFormat:o,multisampled:l}=i;if(l){if(this._context.type!==cr.WEBGL2)throw new Error("Multisampled renderbuffers are not supported in WebGL1!");r.renderbufferStorageMultisample(r.RENDERBUFFER,this.samples,o,n,s)}else r.renderbufferStorage(r.RENDERBUFFER,o,n,s)}get descriptor(){return this._descriptor}get samples(){const e=this._descriptor.samples,i=this._context.parameters.maxSamples;return e?Math.min(e,i):i}get gpuMemoryUsage(){return ayt(this._descriptor)}resize(e,i){const r=this._descriptor;if(r.width===e&&r.height===i)return;r.width=e,r.height=i;const n=this._context.gl;this._context.bindRenderbuffer(this),r.multisampled?n.renderbufferStorageMultisample(n.RENDERBUFFER,this.samples,r.internalFormat,r.width,r.height):n.renderbufferStorage(n.RENDERBUFFER,r.internalFormat,r.width,r.height)}dispose(){this._context&&(this._context.gl.deleteRenderbuffer(this.glName),this._context.instanceCounter.decrement(_o.Renderbuffer,this),this._context=null)}},tn=class{constructor(e=0,i=e){this.width=e,this.height=i,this.target=Hs.TEXTURE_2D,this.pixelFormat=ci.RGBA,this.dataType=ga.UNSIGNED_BYTE,this.samplingMode=ki.LINEAR,this.wrapMode=Bi.REPEAT,this.maxAnisotropy=1,this.flipped=!1,this.hasMipmap=!1,this.isOpaque=!1,this.unpackAlignment=4,this.preMultiplyAlpha=!1,this.depth=1,this.isImmutable=!1}};function lyt(t){return t.width<=0||t.height<=0?0:t.width*t.height*(t.hasMipmap?4/3:1)*(t.internalFormat==null?4:gae(t.internalFormat))}let cyt=class a$e extends tn{constructor(e,i){switch(super(),this.context=e,Object.assign(this,i),this.internalFormat){case zt.R16F:case zt.R16I:case zt.R16UI:case zt.R32F:case zt.R32I:case zt.R32UI:case zt.R8_SNORM:case zt.R8:case zt.R8I:case zt.R8UI:this.pixelFormat=ci.RED}}static validate(e,i){return new a$e(e,i)}};const Sme=4;let Ai=class{constructor(e,i=null,r=null){if(this.type=V2.Texture,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=i;else{const n=cyt.validate(e,i);if(!n)throw new se("Texture descriptor invalid");this._descriptor=n}if(this._descriptor.context.type!==cr.WEBGL2&&(this._descriptor.isImmutable&&(this._descriptor.isImmutable=!1),q3(this._descriptor.target)))throw new se("3D and array textures are not supported in WebGL1");this._descriptor.target===Hs.TEXTURE_CUBE_MAP?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get gpuMemoryUsage(){return fyt.delete(this),lyt(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty}dispose(){this._glName&&this._descriptor.context.instanceCounter.decrement(_o.Texture,this),this._descriptor.context.gl&&this._glName&&(this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}resize(e,i){const r=this._descriptor;if(r.width!==e||r.height!==i){if(this._wasImmutablyAllocated)throw new se("Immutable textures can't be resized!");r.width=e,r.height=i,this._descriptor.target===Hs.TEXTURE_CUBE_MAP?this._setDataCubeMap(null):this.setData(null)}}_setDataCubeMap(e=null){for(let i=Hs.TEXTURE_CUBE_MAP_POSITIVE_X;i<=Hs.TEXTURE_CUBE_MAP_NEGATIVE_Z;i++)this._setData(e,i)}setData(e){this._setData(e)}_setData(e,i){var f;if(!((f=this._descriptor.context)!=null&&f.gl))return;const r=this._descriptor.context.gl;cy(r),this._glName||(this._glName=r.createTexture(),this._glName&&this._descriptor.context.instanceCounter.increment(_o.Texture,this)),e===void 0&&(e=null);const n=this._descriptor,s=i??n.target,o=q3(s);e===null&&(n.width=n.width||Sme,n.height=n.height||Sme,o&&(n.depth=n.depth??1));const l=this._descriptor.context.bindTexture(this,Ai.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(Ai.TEXTURE_UNIT_FOR_UPDATES),hq(this._descriptor.context,n),this._configurePixelStorage(),cy(r);const c=this._deriveInternalFormat();if(dq(e)){let _="width"in e?e.width:e.codedWidth,x="height"in e?e.height:e.codedHeight;const T=1;e instanceof HTMLVideoElement&&(_=e.videoWidth,x=e.videoHeight),n.width&&n.height,o&&n.depth,n.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(s,c,n.hasMipmap,_,x,T),this._texImage(s,0,c,_,x,T,e),cy(r),n.hasMipmap&&this.generateMipmap(),n.width||(n.width=_),n.height||(n.height=x),o&&!n.depth&&(n.depth=T)}else{const{width:_,height:x,depth:T}=n;if(_==null||x==null)throw new se("Width and height must be specified!");if(o&&T==null)throw new se("Depth must be specified!");if(n.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(s,c,n.hasMipmap,_,x,T),LF(e)){const A=e.levels,M=Cme(s,_,x,T),I=Math.min(M-1,A.length-1);this._descriptor.context.gl2!=null?r.texParameteri(n.target,this._descriptor.context.gl2.TEXTURE_MAX_LEVEL,I):n.hasMipmap=n.hasMipmap&&M===A.length;const L=c;if(!dyt(L))throw new se("Attempting to use compressed data with an uncompressed format!");this._forEachMipmapLevel((F,z,k,U)=>{const j=A[Math.min(F,A.length-1)];this._compressedTexImage(s,F,L,z,k,U,j)},I)}else this._texImage(s,0,c,_,x,T,e),cy(r),n.hasMipmap&&this.generateMipmap()}Tme(r,this._descriptor),Eme(r,this._descriptor),uyt(this._descriptor.context,this._descriptor),cy(r),this._descriptor.context.bindTexture(l,Ai.TEXTURE_UNIT_FOR_UPDATES)}updateData(e,i,r,n,s,o,l=0){o||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const c=this._descriptor.context.gl,f=this._descriptor.context.gl2,_=this._descriptor,x=this._deriveInternalFormat(),{pixelFormat:T,dataType:A,target:M,isImmutable:I}=_;if(I&&!this._wasImmutablyAllocated)throw new se("Cannot update immutable texture before allocation!");const L=this._descriptor.context.bindTexture(this,Ai.TEXTURE_UNIT_FOR_UPDATES,!0);if((i<0||r<0||n>_.width||s>_.height||i+n>_.width||r+s>_.height)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),l){if(!f)return void console.error("Webgl2 must be enabled to use dataRowOffset!");c.pixelStorei(f.UNPACK_SKIP_ROWS,l)}if(dq(o)?f?f.texSubImage2D(M,e,i,r,n,s,T,A,o):c.texSubImage2D(M,e,i,r,T,A,o):LF(o)?c.compressedTexSubImage2D(M,e,i,r,n,s,x,o.levels[e]):c.texSubImage2D(M,e,i,r,n,s,T,A,o),l){if(!f)return void console.error("Webgl2 must be enabled to use dataRowOffset!");c.pixelStorei(f.UNPACK_SKIP_ROWS,0)}this._descriptor.context.bindTexture(L,Ai.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,i,r,n,s,o,l,c){c||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const f=this._descriptor.context.gl2;if(f==null)throw new se("3D textures are not supported in WebGL1");const _=this._descriptor,x=this._deriveInternalFormat(),{pixelFormat:T,dataType:A,isImmutable:M,target:I}=_;if(M&&!this._wasImmutablyAllocated)throw new se("Cannot update immutable texture before allocation!");q3(I)||console.warn("Attempting to set 3D texture data on a non-3D texture");const L=this._descriptor.context.bindTexture(this,Ai.TEXTURE_UNIT_FOR_UPDATES);if(this._descriptor.context.setActiveTexture(Ai.TEXTURE_UNIT_FOR_UPDATES),(i<0||r<0||n<0||s>_.width||o>_.height||l>_.depth||i+s>_.width||r+o>_.height||n+l>_.depth)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),LF(c))c=c.levels[e],f.compressedTexSubImage3D(I,e,i,r,n,s,o,l,x,c);else{const F=c;f.texSubImage3D(I,e,i,r,n,s,o,l,T,A,F)}this._descriptor.context.bindTexture(L,Ai.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const e=this._descriptor;if(!e.hasMipmap){if(this._wasImmutablyAllocated)throw new se("Cannot add mipmaps to immutable texture after allocation");e.hasMipmap=!0,this._samplingModeDirty=!0,hq(this._descriptor.context,e)}e.samplingMode===ki.LINEAR?(this._samplingModeDirty=!0,e.samplingMode=ki.LINEAR_MIPMAP_NEAREST):e.samplingMode===ki.NEAREST&&(this._samplingModeDirty=!0,e.samplingMode=ki.NEAREST_MIPMAP_NEAREST);const i=this._descriptor.context.bindTexture(this,Ai.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(Ai.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(i,Ai.TEXTURE_UNIT_FOR_UPDATES)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,hq(this._descriptor.context,this._descriptor),this._wrapModeDirty=!0)}applyChanges(){const e=this._descriptor.context.gl,i=this._descriptor;this._samplingModeDirty&&(Tme(e,i),this._samplingModeDirty=!1),this._wrapModeDirty&&(Eme(e,i),this._wrapModeDirty=!1)}_deriveInternalFormat(){if(this._descriptor.context.type===cr.WEBGL1)return this._descriptor.internalFormat=this._descriptor.pixelFormat;if(this._descriptor.internalFormat!=null)return this._descriptor.internalFormat===ci.DEPTH_STENCIL&&(this._descriptor.internalFormat=ci.DEPTH24_STENCIL8),this._descriptor.internalFormat;switch(this._descriptor.dataType){case ga.FLOAT:switch(this._descriptor.pixelFormat){case ci.RGBA:return this._descriptor.internalFormat=zt.RGBA32F;case ci.RGB:return this._descriptor.internalFormat=zt.RGB32F;default:throw new se("Unable to derive format")}case ga.UNSIGNED_BYTE:switch(this._descriptor.pixelFormat){case ci.RGBA:return this._descriptor.internalFormat=zt.RGBA8;case ci.RGB:return this._descriptor.internalFormat=zt.RGB8}}return this._descriptor.internalFormat=this._descriptor.pixelFormat===ci.DEPTH_STENCIL?ci.DEPTH24_STENCIL8:this._descriptor.pixelFormat}_configurePixelStorage(){const e=this._descriptor.context.gl,{unpackAlignment:i,flipped:r,preMultiplyAlpha:n}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,i),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r?1:0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n?1:0)}_texStorage(e,i,r,n,s,o){const l=this._descriptor.context.gl2;if(l==null)throw new se("Immutable textures are not supported in WebGL1");if(!hyt(i))throw new se("Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const c=r?Cme(e,n,s,o):1;if(q3(e)){if(o==null)throw new se("Missing depth dimension for 3D texture upload");l.texStorage3D(e,c,i,n,s,o)}else l.texStorage2D(e,c,i,n,s);this._wasImmutablyAllocated=!0}_texImage(e,i,r,n,s,o,l){const c=this._descriptor.context.gl,f=q3(e),{isImmutable:_,pixelFormat:x,dataType:T}=this._descriptor,A=this._descriptor.context.type===cr.WEBGL2,M=A?c:null;if(A||!dq(l))if(_){if(l!=null){const I=l;if(f){if(o==null)throw new se("Missing depth dimension for 3D texture upload");M.texSubImage3D(e,i,0,0,0,n,s,o,x,T,I)}else c.texSubImage2D(e,i,0,0,n,s,x,T,I)}}else{const I=l;if(f){if(o==null)throw new se("Missing depth dimension for 3D texture upload");M.texImage3D(e,i,r,n,s,o,0,x,T,I)}else c.texImage2D(e,i,r,n,s,0,x,T,I)}else c.texImage2D(e,0,r,x,T,l)}_compressedTexImage(e,i,r,n,s,o,l){const c=this._descriptor.context.gl;let f=null;const _=q3(e),x=this._descriptor.isImmutable;if(_){if(this._descriptor.context.type!==cr.WEBGL2)throw new se("3D textures are not supported in WebGL1");f=c}if(x){if(l!=null)if(_){if(o==null)throw new se("Missing depth dimension for 3D texture upload");f.compressedTexSubImage3D(e,i,0,0,0,n,s,o,r,l)}else c.compressedTexSubImage2D(e,i,0,0,n,s,r,l)}else if(_){if(o==null)throw new se("Missing depth dimension for 3D texture upload");f.compressedTexImage3D(e,i,r,n,s,o,0,l)}else c.compressedTexImage2D(e,i,r,n,s,0,l)}_forEachMipmapLevel(e,i=1/0){let{width:r,height:n,depth:s,hasMipmap:o,target:l}=this._descriptor;const c=l===Hs.TEXTURE_3D;if(r==null||n==null||c&&s==null)throw new se("Missing texture dimensions for mipmap calculation");for(let f=0;e(f,r,n,s),o&&(r!==1||n!==1||c&&s!==1)&&!(f>=i);++f)r=Math.max(1,r>>1),n=Math.max(1,n>>1),c&&(s=Math.max(1,s>>1))}};function hq(t,e){(e.width!=null&&e.width<0||e.height!=null&&e.height<0||e.depth!=null&&e.depth<0)&&console.error("Negative dimension parameters are not allowed!");const i=t.type===cr.WEBGL2;i||!e.isImmutable&&!q3(e.target)||console.error("Immutable and 3D-like textures are not supported in WebGL1!"),!i&&(e.width!=null&&BT(e.width)&&e.height!=null&&BT(e.height)||(typeof e.wrapMode=="number"?e.wrapMode!==Bi.CLAMP_TO_EDGE&&console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"):e.wrapMode.s===Bi.CLAMP_TO_EDGE&&e.wrapMode.t===Bi.CLAMP_TO_EDGE||console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"),e.hasMipmap&&console.error("Mipmapping requires power-of-two textures!")))}function Tme(t,e){let i=e.samplingMode,r=e.samplingMode;i===ki.LINEAR_MIPMAP_NEAREST||i===ki.LINEAR_MIPMAP_LINEAR?(i=ki.LINEAR,e.hasMipmap||(r=ki.LINEAR)):i!==ki.NEAREST_MIPMAP_NEAREST&&i!==ki.NEAREST_MIPMAP_LINEAR||(i=ki.NEAREST,e.hasMipmap||(r=ki.NEAREST)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,i),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r)}function Eme(t,e){typeof e.wrapMode=="number"?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}function uyt(t,e){const i=t.capabilities.textureFilterAnisotropic;i&&t.gl.texParameterf(e.target,i.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}function hyt(t){return t in zt}function dyt(t){return t in eo}function LF(t){return t!=null&&"type"in t&&t.type==="compressed"}function pyt(t){return t!=null&&"byteLength"in t}function dq(t){return t!=null&&!LF(t)&&!pyt(t)}function q3(t){return t===Hs.TEXTURE_3D||t===Hs.TEXTURE_2D_ARRAY}function Cme(t,e,i,r=1){let n=Math.max(e,i);return t===Hs.TEXTURE_3D&&(n=Math.max(n,r)),Math.round(Math.log(n)/Math.LN2)+1}Ai.TEXTURE_UNIT_FOR_UPDATES=0;const fyt=new Map,myt=Ce.getLogger("esri.views.webgl.FramebufferObject");let Hm=class BA{constructor(e,i,r=null){this._context=e,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,this._initialized=!1,e.instanceCounter.increment(_o.FramebufferObject,this);const n=DF(i)?i:new Ai(this._context,i);if(this._colorAttachments.set(zu.COLOR_ATTACHMENT0,n),this._validateTextureDescriptor(n.descriptor),this._validateColorAttachmentPoint(zu.COLOR_ATTACHMENT0),r!=null)if(yyt(r))this._context.capabilities.depthTexture||console.error("Setting the depth/stencil texture as an attachment requires WEBGL_depth_texture or WebGL2"),this._depthStencilTexture=DF(r)?r:new Ai(this._context,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const s=gyt(r)?r:new o$e(this._context,r);this._depthStencilBuffer=s,this._validateRenderBufferDescriptor(s.descriptor)}}dispose(){var i,r;if(this._colorAttachments.size===0&&!this._glName)return;const e=this._context.getBoundFramebufferObject();this._colorAttachments.forEach((n,s)=>{var o;return(o=this.detachColorTexture(s))==null?void 0:o.dispose()}),(i=this.detachDepthStencilBuffer())==null||i.dispose(),(r=this.detachDepthStencilTexture())==null||r.dispose(),this._glName&&(this._context.gl.deleteFramebuffer(this._glName),this._glName=null),this._context.bindFramebuffer(e),this._context.instanceCounter.decrement(_o.FramebufferObject,this)}get glName(){return this._glName}get colorTexture(){return this._colorAttachments.get(zu.COLOR_ATTACHMENT0)}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){var i;const e=this._colorAttachments.get(zu.COLOR_ATTACHMENT0);return((i=e==null?void 0:e.descriptor)==null?void 0:i.width)??0}get height(){var i;const e=this._colorAttachments.get(zu.COLOR_ATTACHMENT0);return((i=e==null?void 0:e.descriptor)==null?void 0:i.height)??0}get gpuMemoryUsage(){var e;return[...this._colorAttachments].reduce((i,[r,n])=>i+n.gpuMemoryUsage,((e=this.depthStencil)==null?void 0:e.gpuMemoryUsage)??0)}getColorTexture(e){const i=this._colorAttachments.get(e);return i&&DF(i)?i:null}get colorAttachments(){return[...this._colorAttachments.keys()]}attachColorTexture(e,i=zu.COLOR_ATTACHMENT0){var n;if(!e)return;this._validateColorAttachmentPoint(i);const r=e.descriptor;this._validateTextureDescriptor(r),(n=this.detachColorTexture(i))==null||n.dispose(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,i)),this._colorAttachments.set(i,e)}detachColorTexture(e=zu.COLOR_ATTACHMENT0){const i=this._colorAttachments.get(e);if(i){if(this._initialized){const r=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),this._framebufferTexture2D(null,e),this._context.bindFramebuffer(r)}return this._colorAttachments.delete(e),i}}setColorTextureTarget(e,i=zu.COLOR_ATTACHMENT0){const r=this._colorAttachments.get(i);r&&this._framebufferTexture2D(r.glName,i,e)}attachDepthStencil(e){if(e)switch(e.type){case V2.Texture:return this._attachDepthStencilTexture(e);case V2.RenderBuffer:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){var r;if(e==null)return;const i=e.descriptor;i.pixelFormat!==ci.DEPTH_STENCIL&&i.pixelFormat!==ci.DEPTH24_STENCIL8&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),i.dataType!==ga.UNSIGNED_INT_24_8&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!"),this._validateTextureDescriptor(i),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,vme)),(r=this._depthStencilTexture)==null||r.dispose(),this._depthStencilTexture=e}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,vme)),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(e==null)return;const i=e.descriptor;if(this._validateRenderBufferDescriptor(i),this._disposeDepthStencilAttachments(),this._initialized){this._context.bindFramebuffer(this);const r=this._context.gl,n=this._getGLAttachmentPoint(i);r.framebufferRenderbuffer(Vl.FRAMEBUFFER,n,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._initialized){this._context.bindFramebuffer(this);const i=this._context.gl,r=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(Vl.FRAMEBUFFER,r,i.RENDERBUFFER,null)}return this._depthStencilBuffer=null,e}copyToTexture(e,i,r,n,s,o,l){(e<0||i<0||s<0||o<0)&&console.error("Offsets cannot be negative!"),(r<=0||n<=0)&&console.error("Copy width and height must be greater than zero!");const c=l.descriptor;l.descriptor.target!==Hs.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),((c==null?void 0:c.width)==null||(c==null?void 0:c.height)==null||e+r>this.width||i+n>this.height||s+r>c.width||o+n>c.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const f=this._context,_=f.bindTexture(l,Ai.TEXTURE_UNIT_FOR_UPDATES);f.setActiveTexture(Ai.TEXTURE_UNIT_FOR_UPDATES),f.bindFramebuffer(this),f.gl.copyTexSubImage2D(Hs.TEXTURE_2D,0,s,o,e,i,r,n),f.bindTexture(_,Ai.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,i,r,n,s,o,l){(r<=0||n<=0)&&console.error("Copy width and height must be greater than zero!"),l||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,i,r,n,s,o,l)}async readPixelsAsync(e,i,r,n,s,o,l){if(this._context.type!==cr.WEBGL2)return om()&&console.warn("Attempting to read pixels using pixel buffer object without WebGL2"),void this.readPixels(e,i,r,n,s,o,l);const c=this._context.gl,f=Yr.createPixelPack(this._context,Pr.STREAM_READ,l.byteLength);this._context.bindBuffer(f),this._context.bindFramebuffer(this),c.readPixels(e,i,r,n,s,o,0),this._context.unbindBuffer(fi.PIXEL_PACK_BUFFER),await f.getSubDataAsync(l),f.dispose()}resize(e,i){var n,s;if(this.width===e&&this.height===i)return;const r={width:e,height:i};KS(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(o=>o.resize(r.width,r.height)),(n=this._depthStencilTexture)==null||n.resize(r.width,r.height),this._initialized&&(KS(r,this._context.parameters.maxRenderbufferSize),(s=this._depthStencilBuffer)==null||s.resize(r.width,r.height),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1)}initializeAndBind(e=Vl.FRAMEBUFFER){const i=this._context.gl;if(this._initialized)return void i.bindFramebuffer(e,this.glName);this._glName&&i.deleteFramebuffer(this._glName);const r=i.createFramebuffer();if(i.bindFramebuffer(e,r),this._colorAttachments.forEach((n,s)=>this._framebufferTexture2D(n.glName,s,Ame(n),e)),this._depthStencilBuffer){const n=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);i.framebufferRenderbuffer(e,n,i.RENDERBUFFER,this._depthStencilBuffer.glName)}else this._depthStencilTexture&&this._framebufferTexture2D(this._depthStencilTexture.glName,i.DEPTH_STENCIL_ATTACHMENT,Ame(this._depthStencilTexture),e);om()&&i.checkFramebufferStatus(e)!==i.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!"),this._glName=r,this._initialized=!0}_framebufferTexture2D(e,i=zu.COLOR_ATTACHMENT0,r=Hs.TEXTURE_2D,n=Vl.FRAMEBUFFER,s=0){this._context.gl.framebufferTexture2D(n,i,r,e,s)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._initialized){this._context.bindFramebuffer(this);const i=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(Vl.FRAMEBUFFER,i,e.RENDERBUFFER,null)}this._depthStencilBuffer=Kt(this._depthStencilBuffer)}this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,e.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture=Kt(this._depthStencilTexture))}_validateTextureDescriptor(e){e.target!==Hs.TEXTURE_2D&&e.target!==Hs.TEXTURE_CUBE_MAP&&console.error("Texture type must be TEXTURE_2D or TEXTURE_CUBE_MAP!"),KS(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderBufferDescriptor(e){KS(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case Wa.DEPTH_COMPONENT16:case Wa.DEPTH_COMPONENT24:case Wa.DEPTH_COMPONENT32F:return this._context.gl.DEPTH_ATTACHMENT;case Wa.DEPTH24_STENCIL8:case Wa.DEPTH32F_STENCIL8:case Wa.DEPTH_STENCIL:return this._context.gl.DEPTH_STENCIL_ATTACHMENT;case Wa.STENCIL_INDEX8:return this._context.gl.STENCIL_ATTACHMENT}}_validateColorAttachmentPoint(e){if(BA._MAX_COLOR_ATTACHMENTS===-1){const r=this._context.capabilities.drawBuffers;if(r){const n=this._context.gl;BA._MAX_COLOR_ATTACHMENTS=n.getParameter(r.MAX_COLOR_ATTACHMENTS)}else BA._MAX_COLOR_ATTACHMENTS=1}const i=e-zu.COLOR_ATTACHMENT0;i+1>BA._MAX_COLOR_ATTACHMENTS&&Ce.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${i+1}. Implementation supports up to ${BA._MAX_COLOR_ATTACHMENTS} color attachments`)}};function DF(t){return t!=null&&"type"in t&&t.type===V2.Texture}function gyt(t){return t!=null&&"type"in t&&t.type===V2.RenderBuffer}function yyt(t){return DF(t)||t!=null&&"pixelFormat"in t}function KS(t,e){const i=Math.max(t.width,t.height);if(i>e){myt.warn(`Resizing FBO attachment size ${t.width}x${t.height} to device limit ${e}`);const r=e/i;return t.width=Math.round(t.width*r),t.height=Math.round(t.height*r),!1}return!0}function Ame(t){return t.descriptor.target===Hs.TEXTURE_CUBE_MAP?Hs.TEXTURE_CUBE_MAP_POSITIVE_X:Hs.TEXTURE_2D}Hm._MAX_COLOR_ATTACHMENTS=-1;let vyt=class{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new uq(e.newCache,"FBOCache"),this._depthCache=new uq(e.newCache,"DepthAttachmentCache"),this._colorCache=new uq(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frame(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame()}get usedMemory(){return Array.from(this._acquired.values()).reduce((e,i)=>{var r;return e+("colorTexture"in i?((r=i.colorTexture)==null?void 0:r.gpuMemoryUsage)??0:i.usedMemory)},this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(e,i,r){const n=pq(e,i,r),s=this._cache.pop(n)||new _yt(n,new Hm(this.rctx,{...Ome[e],width:i,height:r}),o=>(s.releaseDepth(),s.depth=this._acquireDepth(o,s.fbo.width,s.fbo.height),s.fbo.attachDepthStencil(s.depth.attachment),s),(o,l)=>{const c=this._acquireColor(o,i,r);return s.colors??(s.colors=new Map),s.colors.set(l,c),s.fbo.attachColorTexture(c.attachment,l),s});return s.release=()=>{this._acquired.delete(s),s.releaseDepth(),this._cache.put(s),s.release=()=>console.log(`Double FBO release in ${new Error().stack}`)},this.rctx.unbindTexture(s.fbo.colorTexture),this._trackHandle(s)}acquireDepth(e,i,r){return this._acquireDepth(e,i,r)}_acquireDepth(e,i,r){const n=pq(e,i,r),s=this._depthCache.pop(n);if(s)return this._trackHandle(s);const o=e===la.DEPTH_STENCIL_TEXTURE?new Mme(n,new Ai(this.rctx,{...Pme[e],width:i,height:r}),()=>{this._acquired.delete(o),this._depthCache.put(o)}):new Mme(n,new o$e(this.rctx,{...Pme[e],width:i,height:r}),()=>{this._acquired.delete(o),this._depthCache.put(o)});return this._trackHandle(o)}_acquireColor(e,i,r){const n=pq(e,i,r),s=this._colorCache.pop(n);if(s)return this._trackHandle(s);const o=new byt(n,new Ai(this.rctx,{...Ome[e],width:i,height:r}),()=>{this._acquired.delete(o),this._colorCache.put(o)});return this._trackHandle(o)}_trackHandle(e){return this._acquired.add(e),e}},_yt=class{constructor(e,i,r,n){this.key=e,this.fbo=i,this.acquireDepth=r,this.acquireColor=n,this.release=()=>{},this.incarnation=0}dispose(){this.fbo.dispose()}releaseDepth(){this.fbo.detachDepthStencilTexture(),this.fbo.detachDepthStencilBuffer(),this.depth=ir(this.depth)}detachDepth(){const e=this.depth;return this.depth=void 0,this.fbo.detachDepthStencilTexture(),this.fbo.detachDepthStencilBuffer(),e}attachDepth(e){return this.releaseDepth(),e&&(this.fbo.attachDepthStencil(e.attachment),this.depth=e),this}releaseColor(e){var r,n;this.fbo.detachColorTexture(e);const i=(r=this.colors)==null?void 0:r.get(e);(n=this.colors)==null||n.delete(e),ir(i)}get colorTexture(){var e;return(e=this.fbo)==null?void 0:e.colorTexture}getColorTexture(e=zu.COLOR_ATTACHMENT0){var i;return(i=this.fbo)==null?void 0:i.getColorTexture(e)}get usedMemory(){return this.fbo.gpuMemoryUsage}},l$e=class{constructor(e,i,r){this.key=e,this.attachment=i,this.release=r,this.incarnation=0}dispose(){this.attachment.dispose()}get usedMemory(){return this.attachment.gpuMemoryUsage}},Mme=class extends l$e{},byt=class extends l$e{constructor(e,i,r){super(e,i,r),this.attachment=i,this.release=r}};function pq(t,e,i){return`${t}x${e}x${i}`}var xr;(function(t){t[t.RED=0]="RED",t[t.RG=1]="RG",t[t.RGBA4=2]="RGBA4",t[t.RGBA=3]="RGBA",t[t.RGBA_MIPMAP=4]="RGBA_MIPMAP",t[t.R16F=5]="R16F",t[t.RGBA16F=6]="RGBA16F"})(xr||(xr={}));const NF=new tn;NF.pixelFormat=ci.RED,NF.internalFormat=zt.R8,NF.wrapMode=Bi.CLAMP_TO_EDGE;const FF=new tn;FF.pixelFormat=ci.RG,FF.internalFormat=zt.RG8,FF.wrapMode=Bi.CLAMP_TO_EDGE;const kF=new tn;kF.internalFormat=zt.RGBA4,kF.dataType=ga.UNSIGNED_SHORT_4_4_4_4,kF.wrapMode=Bi.CLAMP_TO_EDGE;const c$e=new tn;c$e.wrapMode=Bi.CLAMP_TO_EDGE;const iI=new tn;iI.wrapMode=Bi.CLAMP_TO_EDGE,iI.samplingMode=ki.LINEAR_MIPMAP_LINEAR,iI.hasMipmap=!0,iI.maxAnisotropy=8;const rI=new tn;rI.pixelFormat=ci.RED,rI.dataType=ga.HALF_FLOAT,rI.internalFormat=zt.R16F,rI.samplingMode=ki.NEAREST;const zF=new tn;zF.dataType=ga.HALF_FLOAT,zF.internalFormat=zt.RGBA16F,zF.samplingMode=ki.NEAREST;const Ome={[xr.RED]:NF,[xr.RG]:FF,[xr.RGBA4]:kF,[xr.RGBA]:c$e,[xr.RGBA_MIPMAP]:iI,[xr.R16F]:rI,[xr.RGBA16F]:zF};var la;(function(t){t[t.DEPTH_STENCIL_TEXTURE=0]="DEPTH_STENCIL_TEXTURE",t[t.DEPTH_STENCIL_BUFFER=1]="DEPTH_STENCIL_BUFFER",t[t.DEPTH24_BUFFER=2]="DEPTH24_BUFFER",t[t.DEPTH16_BUFFER=3]="DEPTH16_BUFFER"})(la||(la={}));const nI=new tn;nI.pixelFormat=ci.DEPTH_STENCIL,nI.dataType=ga.UNSIGNED_INT_24_8,nI.samplingMode=ki.NEAREST,nI.wrapMode=Bi.CLAMP_TO_EDGE;const Pme={[la.DEPTH_STENCIL_TEXTURE]:nI,[la.DEPTH_STENCIL_BUFFER]:new $F(Wa.DEPTH24_STENCIL8,4),[la.DEPTH24_BUFFER]:new $F(Wa.DEPTH_COMPONENT24,4),[la.DEPTH16_BUFFER]:new $F(Wa.DEPTH_COMPONENT16,4)};let Al=class{constructor(e,i,r,n,s,o=!1,l=0){this.name=e,this.count=i,this.type=r,this.offset=n,this.stride=s,this.normalized=o,this.divisor=l}};new Al(J.POSITION,3,Yt.FLOAT,0,12);new Al(J.POSITION,3,Yt.FLOAT,0,20),new Al(J.UV0,2,Yt.FLOAT,12,20);new Al(J.POSITION,3,Yt.FLOAT,0,32),new Al(J.NORMAL,3,Yt.FLOAT,12,32),new Al(J.UV0,2,Yt.FLOAT,24,32);new Al(J.POSITION,3,Yt.FLOAT,0,16),new Al(J.COLOR,4,Yt.UNSIGNED_BYTE,12,16);const yae=[new Al(J.POSITION,2,Yt.FLOAT,0,8)],H9=[new Al(J.POSITION,2,Yt.FLOAT,0,16),new Al(J.UV0,2,Yt.FLOAT,8,16)],KE=Ce.getLogger("esri.views.webgl.VertexArrayObject");let Qf=class{constructor(e,i,r,n,s=null){this._context=e,this._locations=i,this._layout=r,this._buffers=n,this._indexBuffer=s,this._glName=null,this._initialized=!1}get glName(){return this._glName}get context(){return this._context}get vertexBuffers(){return this._buffers}get indexBuffer(){return this._indexBuffer}get byteSize(){return Object.keys(this._buffers).reduce((e,i)=>e+this._buffers[i].byteLength,this._indexBuffer!=null?this._indexBuffer.byteLength:0)}get layout(){return this._layout}get locations(){return this._locations}get usedMemory(){return this.byteSize+(Object.keys(this._buffers).length+(this._indexBuffer?1:0))*H3e}dispose(){var e;if(this._context){this._context.getBoundVAO()===this&&this._context.bindVAO(null);for(const i in this._buffers)(e=this._buffers[i])==null||e.dispose(),delete this._buffers[i];this._indexBuffer=Kt(this._indexBuffer),this.disposeVAOOnly()}else(this._glName||Object.getOwnPropertyNames(this._buffers).length>0)&&KE.warn("Leaked WebGL VAO")}disposeVAOOnly(){var e,i;this._glName&&(((i=(e=this._context)==null?void 0:e.capabilities)==null?void 0:i.vao).deleteVertexArray(this._glName),this._glName=null,this._context.instanceCounter.decrement(_o.VertexArrayObject,this)),this._context=null}initialize(){if(this._initialized)return;const e=this._context.capabilities.vao;if(e){const i=e.createVertexArray();e.bindVertexArray(i),this._bindLayout(),e.bindVertexArray(null),this._glName=i,this._context.instanceCounter.increment(_o.VertexArrayObject,this)}this._initialized=!0}bind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(this.glName):(this._context.bindVAO(null),this._bindLayout())}_bindLayout(){const{_buffers:e,_layout:i,_indexBuffer:r}=this;e||KE.error("Vertex buffer dictionary is empty!");const n=this._context.gl;for(const s in e){const o=e[s];o||KE.error("Vertex buffer is uninitialized!");const l=i[s];l||KE.error("Vertex element descriptor is empty!"),fae(this._context,this._locations,o,l)}r!=null&&(this._context.capabilities.vao?n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,r.glName):this._context.bindBuffer(r))}unbind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(null):this._unbindLayout()}_unbindLayout(){const{_buffers:e,_layout:i}=this;e||KE.error("Vertex buffer dictionary is empty!");for(const r in e){const n=e[r];n||KE.error("Vertex buffer is uninitialized!");const s=i[r];mae(this._context,this._locations,n,s)}this._indexBuffer!=null&&this._context.unbindBuffer(this._indexBuffer.bufferType)}},qm=class extends Qf{};function u1(t,e=yae,i=Er,r=-1,n=1){let s=null;return e===H9?s=new Float32Array([r,r,0,0,n,r,1,0,r,n,0,1,n,n,1,1]):s=new Float32Array([r,r,n,r,r,n,n,n]),new qm(t,i,{geometry:e},{geometry:Yr.createVertex(t,Pr.STATIC_DRAW,s)})}function wyt(t,e=yae,i=Er){const r=new Float32Array([-1,-1,3,-1,-1,3]);return new qm(t,i,{geometry:e},{geometry:Yr.createVertex(t,Pr.STATIC_DRAW,r)})}const xyt=4;function u$e(t){const e=new tn(xyt);return e.samplingMode=ki.NEAREST,new Ai(t,e)}function Syt(t){const e=new tn(1);return e.samplingMode=ki.NEAREST,new Ai(t,e,new Uint8Array([255,255,255,255]))}const Rme=16;function yT(t){return Math.ceil(t/Rme)*Rme}function Tyt(t,e){let s=t.width*t.height;if(s<4096)return t instanceof ImageData?h$e(t):t;let o=t.width,l=t.height;do o=Math.ceil(o/2),l=Math.ceil(l/2),s=o*l;while(s>1048576||e!=null&&(o>e||l>e));return vae(t,o,l)}function Eyt(t,e){const i=Math.max(t.width,t.height);if(i<=e)return t;const r=e/i;return vae(t,Math.round(t.width*r),Math.round(t.height*r))}function vae(t,e,i){if(t instanceof ImageData)return vae(h$e(t),e,i);const r=document.createElement("canvas");return r.width=e,r.height=i,r.getContext("2d").drawImage(t,0,0,r.width,r.height),r}function h$e(t){const e=document.createElement("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");if(i==null)throw new se("Failed to create 2d context from HTMLCanvasElement");return i.putImageData(t,0,0),e}function Pc(t,e=!0){t.attributes.add(J.POSITION,"vec2"),e&&t.varyings.add("uv","vec2"),t.vertex.code.add(V` + `),e}const Pmt=Qe(),Rmt=Object.freeze(Object.defineProperty({__proto__:null,betaRayleigh:wO,build:B4e},Symbol.toStringTag,{value:"Module"}));let Ir=class{constructor(e,i){this._module=e,this._loadModule=i}get(){return this._module}async reload(){return this._module=await this._loadModule(),this._module}};var $n,sr,ot,i1,fi,wm,RP,Yt,Zr,ws,ki,Bi,qs,ci,zt,ya,Xa,Rr,sp,jl;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT"})($n||($n={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(sr||(sr={})),function(t){t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA"}(ot||(ot={})),function(t){t[t.ADD=32774]="ADD",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.SUBTRACT=32778]="SUBTRACT",t[t.REVERSE_SUBTRACT=32779]="REVERSE_SUBTRACT"}(i1||(i1={})),function(t){t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER"}(fi||(fi={})),function(t){t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK"}(wm||(wm={})),function(t){t[t.CW=2304]="CW",t[t.CCW=2305]="CCW"}(RP||(RP={})),function(t){t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT"}(Yt||(Yt={})),function(t){t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS"}(Zr||(Zr={})),function(t){t[t.ZERO=0]="ZERO",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP"}(ws||(ws={})),function(t){t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"}(ki||(ki={})),function(t){t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(Bi||(Bi={})),function(t){t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY"}(qs||(qs={})),function(t){t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.RED=6403]="RED",t[t.RG=33319]="RG",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER"}(ci||(ci={})),function(t){t[t.RGBA4=32854]="RGBA4",t[t.R16F=33325]="R16F",t[t.RG16F=33327]="RG16F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.R32F=33326]="R32F",t[t.RG32F=33328]="RG32F",t[t.RGBA32F=34836]="RGBA32F",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB5_A1=32855]="RGB5_A1",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.RGB16F=34843]="RGB16F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.RGB565=36194]="RGB565",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2=32857]="RGB10_A2",t[t.RGB10_A2UI=36975]="RGB10_A2UI"}(zt||(zt={})),function(t){t[t.FLOAT=5126]="FLOAT",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.INT=5124]="INT",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV"}(ya||(ya={})),function(t){t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8"}(Xa||(Xa={})),function(t){t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.STATIC_READ=35045]="STATIC_READ",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.STREAM_COPY=35042]="STREAM_COPY"}(Rr||(Rr={})),function(t){t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER"}(sp||(sp={})),function(t){t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER"}(jl||(jl={}));const _q=33984;var bo,Vu,jee;(function(t){t[t.Texture=0]="Texture",t[t.BufferObject=1]="BufferObject",t[t.VertexArrayObject=2]="VertexArrayObject",t[t.Shader=3]="Shader",t[t.Program=4]="Program",t[t.FramebufferObject=5]="FramebufferObject",t[t.Renderbuffer=6]="Renderbuffer",t[t.Sync=7]="Sync",t[t.UNCOUNTED=8]="UNCOUNTED",t[t.LinesOfCode=8]="LinesOfCode",t[t.Uniform=9]="Uniform",t[t.COUNT=10]="COUNT"})(bo||(bo={})),function(t){t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15"}(Vu||(Vu={})),function(t){t[t.NONE=0]="NONE",t[t.BACK=1029]="BACK"}(jee||(jee={}));const _me=33306;var to,bme,wme,xme,_U,Gee,Sme;(function(t){t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"})(to||(to={})),function(t){t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT=5124]="INT",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY"}(bme||(bme={})),function(t){t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS"}(wme||(wme={})),function(t){t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED"}(xme||(xme={})),function(t){t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED"}(_U||(_U={})),function(t){t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE"}(Gee||(Gee={})),function(t){t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT"}(Sme||(Sme={}));let Hr=class{constructor(e,i,r){this.release=r,this.initializeConfiguration(e,i),this._configuration=i.snapshot(),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e.rctx.capabilities)}destroy(){this._program=Kt(this._program),this._pipeline=this._configuration=null}reload(e){Kt(this._program),this._program=this.initializeProgram(e),this._pipeline=this.initializePipeline(e.rctx.capabilities)}get program(){return this._program}get compiled(){return this.program.compiled}get key(){return this._configuration.key}get configuration(){return this._configuration}ensureAttributeLocations(e){this.program.assertCompatibleVertexAttributeLocations(e)}get primitiveType(){return sr.TRIANGLES}getPipeline(e,i,r){return this._pipeline}initializeConfiguration(e,i){}};const Cr=new Map([[J.POSITION,0],[J.NORMAL,1],[J.NORMALCOMPRESSED,1],[J.UV0,2],[J.COLOR,3],[J.COLORFEATUREATTRIBUTE,3],[J.SIZE,4],[J.TANGENT,4],[J.AUXPOS1,5],[J.SYMBOLCOLOR,5],[J.AUXPOS2,6],[J.FEATUREATTRIBUTE,6],[J.INSTANCEFEATUREATTRIBUTE,6],[J.INSTANCECOLOR,7],[J.OBJECTANDLAYERIDCOLOR,7],[J.INSTANCEOBJECTANDLAYERIDCOLOR,7],[J.INSTANCEMODEL,8],[J.INSTANCEMODELNORMAL,12],[J.INSTANCEMODELORIGINHI,11],[J.INSTANCEMODELORIGINLO,15]]),Imt=Ce.getLogger("esri.views.webgl.checkWebGLError");function $mt(t,e){switch(e){case t.INVALID_ENUM:return"Invalid Enum. An unacceptable value has been specified for an enumerated argument.";case t.INVALID_VALUE:return"Invalid Value. A numeric argument is out of range.";case t.INVALID_OPERATION:return"Invalid Operation. The specified command is not allowed for the current state.";case t.INVALID_FRAMEBUFFER_OPERATION:return"Invalid Framebuffer operation. The currently bound framebuffer is not framebuffer complete when trying to render to or to read from it.";case t.OUT_OF_MEMORY:return"Out of memory. Not enough memory is left to execute the command.";case t.CONTEXT_LOST_WEBGL:return"WebGL context has been lost";default:return"Unknown error"}}const j4e=!!$e("enable-feature:webgl-debug");function cm(){return j4e}function Hee(){return j4e}function fy(t){if(cm()){const e=t.getError();if(e){const i=$mt(t,e),r=new Error().stack;Imt.error(new se("webgl-error","WebGL error occurred",{message:i,stack:r}))}}}let $r=class{constructor(e,i,r){this._context=e,this._locations=r,this._textures=new Map,this._freeTextureUnits=new Pi({deallocator:null}),this._glProgram=e.programCache.acquire(i.generate("vertex"),i.generate("fragment"),r),this._glProgram.stop=()=>{throw new Error("Wrapped _glProgram used directly")},this.bindPass=i.generateBindPass(this),this.bindDraw=i.generateBindDraw(this),this._fragmentUniforms=cm()?i.fragmentUniforms:null}dispose(){this._glProgram.dispose()}get glName(){return this._glProgram.glName}get compiled(){return this._glProgram.compiled}setUniform1b(e,i){this._glProgram.setUniform1i(e,i?1:0)}setUniform1i(e,i){this._glProgram.setUniform1i(e,i)}setUniform1f(e,i){this._glProgram.setUniform1f(e,i)}setUniform2fv(e,i){this._glProgram.setUniform2fv(e,i)}setUniform3fv(e,i){this._glProgram.setUniform3fv(e,i)}setUniform4fv(e,i){this._glProgram.setUniform4fv(e,i)}setUniformMatrix3fv(e,i){this._glProgram.setUniformMatrix3fv(e,i)}setUniformMatrix4fv(e,i){this._glProgram.setUniformMatrix4fv(e,i)}setUniform1fv(e,i){this._glProgram.setUniform1fv(e,i)}setUniform1iv(e,i){this._glProgram.setUniform1iv(e,i)}setUniform2iv(e,i){this._glProgram.setUniform3iv(e,i)}setUniform3iv(e,i){this._glProgram.setUniform3iv(e,i)}setUniform4iv(e,i){this._glProgram.setUniform4iv(e,i)}assertCompatibleVertexAttributeLocations(e){e.locations!==this._locations&&console.error("VertexAttributeLocations are incompatible")}stop(){this._textures.clear(),this._freeTextureUnits.clear()}bindTexture(e,i){if((i==null?void 0:i.glName)==null){const n=this._textures.get(e);return n&&(this._context.bindTexture(null,n.unit),this._freeTextureUnit(n),this._textures.delete(e)),null}let r=this._textures.get(e);return r==null?(r=this._allocTextureUnit(i),this._textures.set(e,r)):r.texture=i,this._context.useProgram(this),this.setUniform1i(e,r.unit),this._context.bindTexture(i,r.unit),r.unit}rebindTextures(){this._context.useProgram(this),this._textures.forEach((e,i)=>{this._context.bindTexture(e.texture,e.unit),this.setUniform1i(i,e.unit)}),this._fragmentUniforms!=null&&this._fragmentUniforms.forEach(e=>{e.type!=="sampler2D"&&e.type!=="samplerCube"||this._textures.has(e.name)||console.error(`Texture sampler ${e.name} has no bound texture`)})}_allocTextureUnit(e){return{texture:e,unit:this._freeTextureUnits.length===0?this._textures.size:this._freeTextureUnits.pop()}}_freeTextureUnit(e){this._freeTextureUnits.push(e.unit)}};var Ln,KT,so,H2,Ku,P_,yn,Kh,n_;(function(t){t[t.None=0]="None",t[t.Front=1]="Front",t[t.Back=2]="Back",t[t.COUNT=3]="COUNT"})(Ln||(Ln={})),function(t){t[t.Less=0]="Less",t[t.Lequal=1]="Lequal",t[t.COUNT=2]="COUNT"}(KT||(KT={})),function(t){t[t.BACKGROUND=0]="BACKGROUND",t[t.UPDATE=1]="UPDATE"}(so||(so={})),function(t){t[t.NOT_LOADED=0]="NOT_LOADED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED"}(H2||(H2={})),function(t){t[t.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",t[t.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(Ku||(Ku={})),function(t){t[t.Highlight=0]="Highlight",t[t.MaskOccludee=1]="MaskOccludee",t[t.COUNT=2]="COUNT"}(P_||(P_={})),function(t){t[t.Blend=0]="Blend",t[t.Opaque=1]="Opaque",t[t.Mask=2]="Mask",t[t.MaskBlend=3]="MaskBlend",t[t.COUNT=4]="COUNT"}(yn||(yn={})),function(t){t[t.OFF=0]="OFF",t[t.ON=1]="ON"}(Kh||(Kh={})),function(t){t.DDS_ENCODING="image/vnd-ms.dds",t.KTX2_ENCODING="image/ktx2",t.BASIS_ENCODING="image/x.basis"}(n_||(n_={}));function md(t,e,i=i1.ADD,r=[0,0,0,0]){return{srcRgb:t,srcAlpha:t,dstRgb:e,dstAlpha:e,opRgb:i,opAlpha:i,color:{r:r[0],g:r[1],b:r[2],a:r[3]}}}function Pl(t,e,i,r,n=i1.ADD,s=i1.ADD,o=[0,0,0,0]){return{srcRgb:t,srcAlpha:e,dstRgb:i,dstAlpha:r,opRgb:n,opAlpha:s,color:{r:o[0],g:o[1],b:o[2],a:o[3]}}}const Cae={face:wm.BACK,mode:RP.CCW},G4e={face:wm.FRONT,mode:RP.CCW},kj=t=>t===Ln.Back?Cae:t===Ln.Front?G4e:null,sh={zNear:0,zFar:1},ji={r:!0,g:!0,b:!0,a:!0};function Lmt(t){return jmt.intern(t)}function Dmt(t){return Gmt.intern(t)}function Nmt(t){return Hmt.intern(t)}function Fmt(t){return qmt.intern(t)}function kmt(t){return Wmt.intern(t)}function zmt(t){return Ymt.intern(t)}function Umt(t){return Xmt.intern(t)}function Vmt(t){return Zmt.intern(t)}function Bmt(t){return Jmt.intern(t)}function Ti(t){return Kmt.intern(t)}let g1=class{constructor(e,i){this._makeKey=e,this._makeRef=i,this._interns=new Map}intern(e){if(!e)return null;const i=this._makeKey(e),r=this._interns;return r.has(i)||r.set(i,this._makeRef(e)),r.get(i)??null}};function y1(t){return"["+t.join(",")+"]"}const jmt=new g1(H4e,t=>({__tag:"Blending",...t}));function H4e(t){return t?y1([t.srcRgb,t.srcAlpha,t.dstRgb,t.dstAlpha,t.opRgb,t.opAlpha,t.color.r,t.color.g,t.color.b,t.color.a]):null}const Gmt=new g1(q4e,t=>({__tag:"Culling",...t}));function q4e(t){return t?y1([t.face,t.mode]):null}const Hmt=new g1(W4e,t=>({__tag:"PolygonOffset",...t}));function W4e(t){return t?y1([t.factor,t.units]):null}const qmt=new g1(Y4e,t=>({__tag:"DepthTest",...t}));function Y4e(t){return t?y1([t.func]):null}const Wmt=new g1(X4e,t=>({__tag:"StencilTest",...t}));function X4e(t){return t?y1([t.function.func,t.function.ref,t.function.mask,t.operation.fail,t.operation.zFail,t.operation.zPass]):null}const Ymt=new g1(Z4e,t=>({__tag:"DepthWrite",...t}));function Z4e(t){return t?y1([t.zNear,t.zFar]):null}const Xmt=new g1(J4e,t=>({__tag:"ColorWrite",...t}));function J4e(t){return t?y1([t.r,t.g,t.b,t.a]):null}const Zmt=new g1(K4e,t=>({__tag:"StencilWrite",...t}));function K4e(t){return t?y1([t.mask]):null}const Jmt=new g1(Q4e,t=>({__tag:"DrawBuffers",...t}));function Q4e(t){return t?y1(t.buffers):null}const Kmt=new g1(Qmt,t=>({blending:Lmt(t.blending),culling:Dmt(t.culling),polygonOffset:Nmt(t.polygonOffset),depthTest:Fmt(t.depthTest),stencilTest:kmt(t.stencilTest),depthWrite:zmt(t.depthWrite),colorWrite:Umt(t.colorWrite),stencilWrite:Vmt(t.stencilWrite),drawBuffers:Bmt(t.drawBuffers)}));function Qmt(t){return t?y1([H4e(t.blending),q4e(t.culling),W4e(t.polygonOffset),Y4e(t.depthTest),X4e(t.stencilTest),Z4e(t.depthWrite),J4e(t.colorWrite),K4e(t.stencilWrite),Q4e(t.drawBuffers)]):null}let egt=class{constructor(e){this._pipelineInvalid=!0,this._blendingInvalid=!0,this._cullingInvalid=!0,this._polygonOffsetInvalid=!0,this._depthTestInvalid=!0,this._stencilTestInvalid=!0,this._depthWriteInvalid=!0,this._colorWriteInvalid=!0,this._stencilWriteInvalid=!0,this._drawBuffersInvalid=!0,this._stateSetters=e}setPipeline(e){(this._pipelineInvalid||e!==this._pipeline)&&(this._setBlending(e.blending),this._setCulling(e.culling),this._setPolygonOffset(e.polygonOffset),this._setDepthTest(e.depthTest),this._setStencilTest(e.stencilTest),this._setDepthWrite(e.depthWrite),this._setColorWrite(e.colorWrite),this._setStencilWrite(e.stencilWrite),this._setDrawBuffers(e.drawBuffers),this._pipeline=e),this._pipelineInvalid=!1}invalidateBlending(){this._blendingInvalid=!0,this._pipelineInvalid=!0}invalidateCulling(){this._cullingInvalid=!0,this._pipelineInvalid=!0}invalidatePolygonOffset(){this._polygonOffsetInvalid=!0,this._pipelineInvalid=!0}invalidateDepthTest(){this._depthTestInvalid=!0,this._pipelineInvalid=!0}invalidateStencilTest(){this._stencilTestInvalid=!0,this._pipelineInvalid=!0}invalidateDepthWrite(){this._depthWriteInvalid=!0,this._pipelineInvalid=!0}invalidateColorWrite(){this._colorWriteInvalid=!0,this._pipelineInvalid=!0}invalidateStencilWrite(){this._stencilTestInvalid=!0,this._pipelineInvalid=!0}invalidateDrawBuffers(){this._drawBuffersInvalid=!0,this._pipelineInvalid=!0}_setBlending(e){this._blending=this._setSubState(e,this._blending,this._blendingInvalid,this._stateSetters.setBlending),this._blendingInvalid=!1}_setCulling(e){this._culling=this._setSubState(e,this._culling,this._cullingInvalid,this._stateSetters.setCulling),this._cullingInvalid=!1}_setPolygonOffset(e){this._polygonOffset=this._setSubState(e,this._polygonOffset,this._polygonOffsetInvalid,this._stateSetters.setPolygonOffset),this._polygonOffsetInvalid=!1}_setDepthTest(e){this._depthTest=this._setSubState(e,this._depthTest,this._depthTestInvalid,this._stateSetters.setDepthTest),this._depthTestInvalid=!1}_setStencilTest(e){this._stencilTest=this._setSubState(e,this._stencilTest,this._stencilTestInvalid,this._stateSetters.setStencilTest),this._stencilTestInvalid=!1}_setDepthWrite(e){this._depthWrite=this._setSubState(e,this._depthWrite,this._depthWriteInvalid,this._stateSetters.setDepthWrite),this._depthWriteInvalid=!1}_setColorWrite(e){this._colorWrite=this._setSubState(e,this._colorWrite,this._colorWriteInvalid,this._stateSetters.setColorWrite),this._colorWriteInvalid=!1}_setStencilWrite(e){this._stencilWrite=this._setSubState(e,this._stencilWrite,this._stencilWriteInvalid,this._stateSetters.setStencilWrite),this._stencilTestInvalid=!1}_setDrawBuffers(e){this._drawBuffers=this._setSubState(e,this._drawBuffers,this._drawBuffersInvalid,this._stateSetters.setDrawBuffers),this._drawBuffersInvalid=!1}_setSubState(e,i,r,n){return(r||e!==i)&&(n(e),this._pipelineInvalid=!0),e}},tgt=class extends bn{constructor(){super(...arguments),this.heightParameters=Xi(),this.radii=yt(),this.innerFadeDistance=0,this.altitudeFade=0,this.hazeStrength=1,this.renderScale=yt(),this.backgroundColor=W()}},d4=class e$e extends Hr{initializeProgram(e){return new $r(e.rctx,e$e.shader.get().build(this.configuration),Cr)}initializePipeline(){return this.configuration.reduced?Ti({blending:md(ot.ONE,ot.ZERO),depthTest:{func:Zr.ALWAYS},colorWrite:ji}):this.configuration.haze?Ti({blending:Pl(ot.ONE,ot.ZERO,ot.ONE_MINUS_SRC_COLOR,ot.ONE),colorWrite:ji}):Ti({blending:md(ot.SRC_ALPHA,ot.ONE_MINUS_SRC_ALPHA),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};d4.shader=new Ir(Rmt,()=>we(()=>Promise.resolve().then(()=>YYt),void 0));let oh=class extends bn{constructor(){super(),this._key="",this._keyDirty=!1,this._parameterBits=this._parameterBits?this._parameterBits.map(()=>0):[],this._parameterNames||(this._parameterNames=[])}get key(){return this._keyDirty&&(this._keyDirty=!1,this._key=String.fromCharCode.apply(String,this._parameterBits)),this._key}snapshot(){const e=this._parameterNames,i={key:this.key};for(const r of e)i[r]=this[r];return i}};function fe(t={}){return(e,i)=>{if(e._parameterNames=e._parameterNames??[],e._parameterNames.push(i),t.constValue!=null)Object.defineProperty(e,i,{get:()=>t.constValue});else{const r=e._parameterNames.length-1,n=t.count||2,s=Math.ceil(Math.log2(n)),o=e._parameterBits??[0];let a=0;for(;o[a]+s>16;)a++,a>=o.length&&o.push(0);e._parameterBits=o;const c=o[a],p=(1<this._remove(r,n))}hitrate(){return this._cache.hitRate}destroy(){this._cache.destroy()}clear(){this._cache.clear()}pop(e){const i=this._cache.peek(e);if(!i)return;const r=i.pop();if(i.length>0){const n=i.reduce((s,o)=>s+o.usedMemory,0);this._cache.updateSize(e,i,n)}else this._cache.pop(e);return r}put(e,i,r=h$){const n=this._cache.peek(e);if(!n)return void this._cache.put(e,[i],i.usedMemory,r);n.push(i);const s=n.reduce((o,a)=>o+a.usedMemory,0);this._cache.updateSize(e,n,s)}_remove(e,i){var r;switch(i){case am.ALL:return e.forEach(n=>n.dispose()),0;case am.SOME:return(r=e.shift())==null||r.dispose(),e.reduce((n,s)=>n+s.usedMemory,0)}}},bq=class{constructor(e,i){this._last=new Pi,this._incarnation=0,this._cache=new X9(e,i)}destroy(){var e;(e=this._last)==null||e.forAll(i=>i.dispose()),this._last=null,this._cache.destroy()}set interactive(e){var i;e&&!this._last?this._last=new Pi:e||((i=this._last)==null||i.forAll(r=>r.dispose()),this._last=null)}clean(){var e;(e=this._last)==null||e.filterInPlace(i=>!(i.incarnationr.key===e);if(i)return this._last.removeUnordered(i),i}return this._cache.pop(e)}put(e){e.incarnation=this._incarnation,this._last?this._last.push(e):this._cache.put(e.key,e)}get usedMemory(){var e;return((e=this._last)==null?void 0:e.reduce((i,r)=>i+r.usedMemory,0))??0}};var cr;function qee(t,e,i={}){const r=e===cr.WEBGL1?"webgl":"webgl2";return t.getContext(r,i)||null}function igt(t,e,i={}){const r=t$e(t);for(const n of r){const s=qee(e,n,i);if(s)return s}return null}function t$e(t){if(t==="3d")return[cr.WEBGL2];const e=$e("esri-force-webgl");return e===cr.WEBGL1||e===cr.WEBGL2?[e]:$e("mac")&&$e("chrome")?[cr.WEBGL1,cr.WEBGL2]:[cr.WEBGL2,cr.WEBGL1]}(function(t){t[t.WEBGL1=1]="WEBGL1",t[t.WEBGL2=2]="WEBGL2"})(cr||(cr={}));const og=Ce.getLogger("esri.views.webgl.BufferObject");let Yr=class HA{static createIndex(e,i,r){return new HA(e,fi.ELEMENT_ARRAY_BUFFER,i,r)}static createVertex(e,i,r){return new HA(e,fi.ARRAY_BUFFER,i,r)}static createUniform(e,i,r){if(e.type!==cr.WEBGL2)throw new Error("Uniform buffers are supported in WebGL2 only!");return new HA(e,fi.UNIFORM_BUFFER,i,r)}static createPixelPack(e,i=Rr.STREAM_READ,r){if(e.type!==cr.WEBGL2)throw new Error("Pixel pack buffers are supported in WebGL2 only!");const n=new HA(e,fi.PIXEL_PACK_BUFFER,i);return r&&n.setSize(r),n}static createPixelUnpack(e,i=Rr.STREAM_DRAW,r){if(e.type!==cr.WEBGL2)throw new Error("Pixel unpack buffers are supported in WebGL2 only!");return new HA(e,fi.PIXEL_UNPACK_BUFFER,i,r)}constructor(e,i,r,n){this._context=e,this.bufferType=i,this.usage=r,this._glName=null,this._size=-1,this._indexType=void 0,e.instanceCounter.increment(bo.BufferObject,this),this._glName=this._context.gl.createBuffer(),fy(this._context.gl),n&&this.setData(n)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get byteLength(){return this.bufferType===fi.ELEMENT_ARRAY_BUFFER?this._indexType===Yt.UNSIGNED_INT?4*this._size:2*this._size:this._size}get _isVAOAware(){return this.bufferType===fi.ELEMENT_ARRAY_BUFFER||this.bufferType===fi.ARRAY_BUFFER}dispose(){var e;(e=this._context)!=null&&e.gl?(this._glName&&(this._context.gl.deleteBuffer(this._glName),this._glName=null),this._context.instanceCounter.decrement(bo.BufferObject,this),this._context=null):this._glName&&og.warn("Leaked WebGL buffer object")}setSize(e,i=null){if(e<=0&&og.error("Buffer size needs to be positive!"),this.bufferType===fi.ELEMENT_ARRAY_BUFFER&&i!=null)switch(this._indexType=i,i){case Yt.UNSIGNED_SHORT:e*=2;break;case Yt.UNSIGNED_INT:e*=4}this._setBufferData(e)}setData(e){if(!e)return;let i=e.byteLength;this.bufferType===fi.ELEMENT_ARRAY_BUFFER&&(eB(e)&&(i/=2,this._indexType=Yt.UNSIGNED_SHORT),iB(e)&&(i/=4,this._indexType=Yt.UNSIGNED_INT)),this._setBufferData(i,e)}_setBufferData(e,i=null){this._size=e;const r=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const n=this._context.gl;i!=null?n.bufferData(this.bufferType,i,this.usage):n.bufferData(this.bufferType,e,this.usage),fy(n),this._isVAOAware&&this._context.bindVAO(r)}setSubData(e,i,r,n){if(!e)return;(i<0||i*e.BYTES_PER_ELEMENT>=this.byteLength)&&og.error("offset is out of range!"),r>=n&&og.error("end must be bigger than start!"),(i+(n-r))*e.BYTES_PER_ELEMENT>this.byteLength&&og.error("An attempt to write beyond the end of the buffer!");const s=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const o=this._context.gl;if(this._context.type===cr.WEBGL2)o.bufferSubData(this.bufferType,i*e.BYTES_PER_ELEMENT,e,r,n-r);else{const a=r===0&&n===e.length?e:e.subarray(r,n);o.bufferSubData(this.bufferType,i*e.BYTES_PER_ELEMENT,a)}fy(o),this._isVAOAware&&this._context.bindVAO(s)}getSubData(e,i=0,r,n){if(this._context.type!==cr.WEBGL2)return void og.error("Get buffer subdata is supported in WebGL2 only!");if(r<0||n<0)return void og.error("Problem getting subdata: offset and length were less than zero!");const s=rgt(e)?e.BYTES_PER_ELEMENT:1;if(s*((r??0)+(n??0))>e.byteLength)return void og.error("Problem getting subdata: offset and length exceeded destination size!");i+s*(n??0)>this.byteLength&&og.warn("Potential problem getting subdata: requested data exceeds buffer size!");const o=this._context.gl;this._context.bindBuffer(this,fi.COPY_READ_BUFFER),o.getBufferSubData(fi.COPY_READ_BUFFER,i,e,r,n),this._context.unbindBuffer(fi.COPY_READ_BUFFER)}async getSubDataAsync(e,i=0,r,n){this._context.type===cr.WEBGL2?(await this._context.clientWaitAsync(),this.getSubData(e,i,r,n)):og.error("Get buffer subdata is supported in WebGL2 only!")}};function rgt(t){return hGe(t)}var q2;(function(t){t[t.Texture=0]="Texture",t[t.RenderBuffer=1]="RenderBuffer"})(q2||(q2={}));function ngt(t){const e=t.gl;switch(e.getError()){case e.NO_ERROR:return null;case e.INVALID_ENUM:return"An unacceptable value has been specified for an enumerated argument";case e.INVALID_VALUE:return"An unacceptable value has been specified for an argument";case e.INVALID_OPERATION:return"The specified command is not allowed for the current state";case e.INVALID_FRAMEBUFFER_OPERATION:return"The currently bound framebuffer is not framebuffer complete";case e.OUT_OF_MEMORY:return"Not enough memory is left to execute the command";case e.CONTEXT_LOST_WEBGL:return"WebGL context is lost"}return"Unknown error"}function s_(t,e){return t.vertexBuffers[e].byteLength/sgt(t.layout[e])}function sgt(t){return t[0].stride}function Aae(t,e,i,r,n=0){var o,a,c;const s=t.gl;t.bindBuffer(i);for(const p of r){const _=e.get(p.name);_===void 0&&console.error(`There is no location for vertex attribute '${p.name}' defined.`);const x=n*p.stride;if(p.count<=4)s.vertexAttribPointer(_,p.count,p.type,p.normalized,p.stride,p.offset+x),s.enableVertexAttribArray(_),p.divisor>0&&((o=t.gl2)==null||o.vertexAttribDivisor(_,p.divisor));else if(p.count===9)for(let S=0;S<3;S++)s.vertexAttribPointer(_+S,3,p.type,p.normalized,p.stride,p.offset+12*S+x),s.enableVertexAttribArray(_+S),p.divisor>0&&((a=t.gl2)==null||a.vertexAttribDivisor(_+S,p.divisor));else if(p.count===16)for(let S=0;S<4;S++)s.vertexAttribPointer(_+S,4,p.type,p.normalized,p.stride,p.offset+16*S+x),s.enableVertexAttribArray(_+S),p.divisor>0&&((c=t.gl2)==null||c.vertexAttribDivisor(_+S,p.divisor));else console.error("Unsupported vertex attribute element count: "+p.count)}}function Mae(t,e,i,r){var s,o,a;const n=t.gl;t.bindBuffer(i);for(const c of r){const p=e.get(c.name);if(c.count<=4)n.disableVertexAttribArray(p),c.divisor&&c.divisor>0&&((s=t.gl2)==null||s.vertexAttribDivisor(p,0));else if(c.count===9)for(let _=0;_<3;_++)n.disableVertexAttribArray(p+_),c.divisor&&c.divisor>0&&((o=t.gl2)==null||o.vertexAttribDivisor(p+_,0));else if(c.count===16)for(let _=0;_<4;_++)n.disableVertexAttribArray(p+_),c.divisor&&c.divisor>0&&((a=t.gl2)==null||a.vertexAttribDivisor(p+_,0));else console.error("Unsupported vertex attribute element count: "+c.count)}t.unbindBuffer(fi.ARRAY_BUFFER)}function Oae(t){switch(t){case ci.ALPHA:case ci.LUMINANCE:case ci.RED:case ci.RED_INTEGER:case zt.R8:case zt.R8I:case zt.R8UI:case zt.R8_SNORM:case Xa.STENCIL_INDEX8:return 1;case ci.LUMINANCE_ALPHA:case ci.RG:case ci.RG_INTEGER:case zt.RGBA4:case zt.R16F:case zt.R16I:case zt.R16UI:case zt.RG8:case zt.RG8I:case zt.RG8UI:case zt.RG8_SNORM:case zt.RGB565:case zt.RGB5_A1:case Xa.DEPTH_COMPONENT16:return 2;case ci.DEPTH_COMPONENT:case ci.RGB:case ci.RGB_INTEGER:case zt.RGB8:case zt.RGB8I:case zt.RGB8UI:case zt.RGB8_SNORM:case zt.SRGB8:case Xa.DEPTH_COMPONENT24:return 3;case ci.DEPTH_STENCIL:case ci.DEPTH24_STENCIL8:case ci.RGBA:case ci.RGBA_INTEGER:case zt.RGBA8:case zt.R32F:case zt.R11F_G11F_B10F:case zt.RG16F:case zt.R32I:case zt.R32UI:case zt.RG16I:case zt.RG16UI:case zt.RGBA8I:case zt.RGBA8UI:case zt.RGBA8_SNORM:case zt.SRGB8_ALPHA8:case zt.RGB9_E5:case zt.RGB10_A2UI:case zt.RGB10_A2:case Xa.DEPTH_STENCIL:case Xa.DEPTH_COMPONENT32F:case Xa.DEPTH24_STENCIL8:return 4;case Xa.DEPTH32F_STENCIL8:return 5;case zt.RGB16F:case zt.RGB16I:case zt.RGB16UI:return 6;case zt.RG32F:case zt.RG32I:case zt.RG32UI:case zt.RGBA16F:case zt.RGBA16I:case zt.RGBA16UI:return 8;case zt.RGB32F:case zt.RGB32I:case zt.RGB32UI:return 12;case zt.RGBA32F:case zt.RGBA32I:case zt.RGBA32UI:return 16;case to.COMPRESSED_RGB_S3TC_DXT1_EXT:case to.COMPRESSED_RGBA_S3TC_DXT1_EXT:return .5;case to.COMPRESSED_RGBA_S3TC_DXT3_EXT:case to.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case to.COMPRESSED_R11_EAC:case to.COMPRESSED_SIGNED_R11_EAC:case to.COMPRESSED_RGB8_ETC2:case to.COMPRESSED_SRGB8_ETC2:case to.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case to.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return .5;case to.COMPRESSED_RG11_EAC:case to.COMPRESSED_SIGNED_RG11_EAC:case to.COMPRESSED_RGBA8_ETC2_EAC:case to.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}let jF=class{constructor(e,i,r=i){this.internalFormat=e,this.width=i,this.height=r,this.multisampled=!1,this.samples=1}};function ogt(t){return t.width<=0||t.height<=0||t.internalFormat==null?0:t.width*t.height*Oae(t.internalFormat)}let i$e=class{constructor(e,i){this._context=e,this._descriptor=i,this.type=q2.RenderBuffer,this._context.instanceCounter.increment(bo.Renderbuffer,this);const r=this._context.gl;this.glName=r.createRenderbuffer(),this._context.bindRenderbuffer(this);const{width:n,height:s,internalFormat:o,multisampled:a}=i;if(a){if(this._context.type!==cr.WEBGL2)throw new Error("Multisampled renderbuffers are not supported in WebGL1!");r.renderbufferStorageMultisample(r.RENDERBUFFER,this.samples,o,n,s)}else r.renderbufferStorage(r.RENDERBUFFER,o,n,s)}get descriptor(){return this._descriptor}get samples(){const e=this._descriptor.samples,i=this._context.parameters.maxSamples;return e?Math.min(e,i):i}get gpuMemoryUsage(){return ogt(this._descriptor)}resize(e,i){const r=this._descriptor;if(r.width===e&&r.height===i)return;r.width=e,r.height=i;const n=this._context.gl;this._context.bindRenderbuffer(this),r.multisampled?n.renderbufferStorageMultisample(n.RENDERBUFFER,this.samples,r.internalFormat,r.width,r.height):n.renderbufferStorage(n.RENDERBUFFER,r.internalFormat,r.width,r.height)}dispose(){this._context&&(this._context.gl.deleteRenderbuffer(this.glName),this._context.instanceCounter.decrement(bo.Renderbuffer,this),this._context=null)}},rn=class{constructor(e=0,i=e){this.width=e,this.height=i,this.target=qs.TEXTURE_2D,this.pixelFormat=ci.RGBA,this.dataType=ya.UNSIGNED_BYTE,this.samplingMode=ki.LINEAR,this.wrapMode=Bi.REPEAT,this.maxAnisotropy=1,this.flipped=!1,this.hasMipmap=!1,this.isOpaque=!1,this.unpackAlignment=4,this.preMultiplyAlpha=!1,this.depth=1,this.isImmutable=!1}};function agt(t){return t.width<=0||t.height<=0?0:t.width*t.height*(t.hasMipmap?4/3:1)*(t.internalFormat==null?4:Oae(t.internalFormat))}let lgt=class r$e extends rn{constructor(e,i){switch(super(),this.context=e,Object.assign(this,i),this.internalFormat){case zt.R16F:case zt.R16I:case zt.R16UI:case zt.R32F:case zt.R32I:case zt.R32UI:case zt.R8_SNORM:case zt.R8:case zt.R8I:case zt.R8UI:this.pixelFormat=ci.RED}}static validate(e,i){return new r$e(e,i)}};const Tme=4;let Ai=class{constructor(e,i=null,r=null){if(this.type=q2.Texture,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=i;else{const n=lgt.validate(e,i);if(!n)throw new se("Texture descriptor invalid");this._descriptor=n}if(this._descriptor.context.type!==cr.WEBGL2&&(this._descriptor.isImmutable&&(this._descriptor.isImmutable=!1),K3(this._descriptor.target)))throw new se("3D and array textures are not supported in WebGL1");this._descriptor.target===qs.TEXTURE_CUBE_MAP?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get gpuMemoryUsage(){return pgt.delete(this),agt(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty}dispose(){this._glName&&this._descriptor.context.instanceCounter.decrement(bo.Texture,this),this._descriptor.context.gl&&this._glName&&(this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}resize(e,i){const r=this._descriptor;if(r.width!==e||r.height!==i){if(this._wasImmutablyAllocated)throw new se("Immutable textures can't be resized!");r.width=e,r.height=i,this._descriptor.target===qs.TEXTURE_CUBE_MAP?this._setDataCubeMap(null):this.setData(null)}}_setDataCubeMap(e=null){for(let i=qs.TEXTURE_CUBE_MAP_POSITIVE_X;i<=qs.TEXTURE_CUBE_MAP_NEGATIVE_Z;i++)this._setData(e,i)}setData(e){this._setData(e)}_setData(e,i){var p;if(!((p=this._descriptor.context)!=null&&p.gl))return;const r=this._descriptor.context.gl;fy(r),this._glName||(this._glName=r.createTexture(),this._glName&&this._descriptor.context.instanceCounter.increment(bo.Texture,this)),e===void 0&&(e=null);const n=this._descriptor,s=i??n.target,o=K3(s);e===null&&(n.width=n.width||Tme,n.height=n.height||Tme,o&&(n.depth=n.depth??1));const a=this._descriptor.context.bindTexture(this,Ai.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(Ai.TEXTURE_UNIT_FOR_UPDATES),wq(this._descriptor.context,n),this._configurePixelStorage(),fy(r);const c=this._deriveInternalFormat();if(xq(e)){let _="width"in e?e.width:e.codedWidth,x="height"in e?e.height:e.codedHeight;const S=1;e instanceof HTMLVideoElement&&(_=e.videoWidth,x=e.videoHeight),n.width&&n.height,o&&n.depth,n.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(s,c,n.hasMipmap,_,x,S),this._texImage(s,0,c,_,x,S,e),fy(r),n.hasMipmap&&this.generateMipmap(),n.width||(n.width=_),n.height||(n.height=x),o&&!n.depth&&(n.depth=S)}else{const{width:_,height:x,depth:S}=n;if(_==null||x==null)throw new se("Width and height must be specified!");if(o&&S==null)throw new se("Depth must be specified!");if(n.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(s,c,n.hasMipmap,_,x,S),GF(e)){const C=e.levels,M=Ame(s,_,x,S),P=Math.min(M-1,C.length-1);this._descriptor.context.gl2!=null?r.texParameteri(n.target,this._descriptor.context.gl2.TEXTURE_MAX_LEVEL,P):n.hasMipmap=n.hasMipmap&&M===C.length;const $=c;if(!hgt($))throw new se("Attempting to use compressed data with an uncompressed format!");this._forEachMipmapLevel((F,z,k,U)=>{const j=C[Math.min(F,C.length-1)];this._compressedTexImage(s,F,$,z,k,U,j)},P)}else this._texImage(s,0,c,_,x,S,e),fy(r),n.hasMipmap&&this.generateMipmap()}Eme(r,this._descriptor),Cme(r,this._descriptor),cgt(this._descriptor.context,this._descriptor),fy(r),this._descriptor.context.bindTexture(a,Ai.TEXTURE_UNIT_FOR_UPDATES)}updateData(e,i,r,n,s,o,a=0){o||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const c=this._descriptor.context.gl,p=this._descriptor.context.gl2,_=this._descriptor,x=this._deriveInternalFormat(),{pixelFormat:S,dataType:C,target:M,isImmutable:P}=_;if(P&&!this._wasImmutablyAllocated)throw new se("Cannot update immutable texture before allocation!");const $=this._descriptor.context.bindTexture(this,Ai.TEXTURE_UNIT_FOR_UPDATES,!0);if((i<0||r<0||n>_.width||s>_.height||i+n>_.width||r+s>_.height)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),a){if(!p)return void console.error("Webgl2 must be enabled to use dataRowOffset!");c.pixelStorei(p.UNPACK_SKIP_ROWS,a)}if(xq(o)?p?p.texSubImage2D(M,e,i,r,n,s,S,C,o):c.texSubImage2D(M,e,i,r,S,C,o):GF(o)?c.compressedTexSubImage2D(M,e,i,r,n,s,x,o.levels[e]):c.texSubImage2D(M,e,i,r,n,s,S,C,o),a){if(!p)return void console.error("Webgl2 must be enabled to use dataRowOffset!");c.pixelStorei(p.UNPACK_SKIP_ROWS,0)}this._descriptor.context.bindTexture($,Ai.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,i,r,n,s,o,a,c){c||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const p=this._descriptor.context.gl2;if(p==null)throw new se("3D textures are not supported in WebGL1");const _=this._descriptor,x=this._deriveInternalFormat(),{pixelFormat:S,dataType:C,isImmutable:M,target:P}=_;if(M&&!this._wasImmutablyAllocated)throw new se("Cannot update immutable texture before allocation!");K3(P)||console.warn("Attempting to set 3D texture data on a non-3D texture");const $=this._descriptor.context.bindTexture(this,Ai.TEXTURE_UNIT_FOR_UPDATES);if(this._descriptor.context.setActiveTexture(Ai.TEXTURE_UNIT_FOR_UPDATES),(i<0||r<0||n<0||s>_.width||o>_.height||a>_.depth||i+s>_.width||r+o>_.height||n+a>_.depth)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage(),GF(c))c=c.levels[e],p.compressedTexSubImage3D(P,e,i,r,n,s,o,a,x,c);else{const F=c;p.texSubImage3D(P,e,i,r,n,s,o,a,S,C,F)}this._descriptor.context.bindTexture($,Ai.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const e=this._descriptor;if(!e.hasMipmap){if(this._wasImmutablyAllocated)throw new se("Cannot add mipmaps to immutable texture after allocation");e.hasMipmap=!0,this._samplingModeDirty=!0,wq(this._descriptor.context,e)}e.samplingMode===ki.LINEAR?(this._samplingModeDirty=!0,e.samplingMode=ki.LINEAR_MIPMAP_NEAREST):e.samplingMode===ki.NEAREST&&(this._samplingModeDirty=!0,e.samplingMode=ki.NEAREST_MIPMAP_NEAREST);const i=this._descriptor.context.bindTexture(this,Ai.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(Ai.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(i,Ai.TEXTURE_UNIT_FOR_UPDATES)}setSamplingMode(e){e!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=e,this._samplingModeDirty=!0)}setWrapMode(e){e!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=e,wq(this._descriptor.context,this._descriptor),this._wrapModeDirty=!0)}applyChanges(){const e=this._descriptor.context.gl,i=this._descriptor;this._samplingModeDirty&&(Eme(e,i),this._samplingModeDirty=!1),this._wrapModeDirty&&(Cme(e,i),this._wrapModeDirty=!1)}_deriveInternalFormat(){if(this._descriptor.context.type===cr.WEBGL1)return this._descriptor.internalFormat=this._descriptor.pixelFormat;if(this._descriptor.internalFormat!=null)return this._descriptor.internalFormat===ci.DEPTH_STENCIL&&(this._descriptor.internalFormat=ci.DEPTH24_STENCIL8),this._descriptor.internalFormat;switch(this._descriptor.dataType){case ya.FLOAT:switch(this._descriptor.pixelFormat){case ci.RGBA:return this._descriptor.internalFormat=zt.RGBA32F;case ci.RGB:return this._descriptor.internalFormat=zt.RGB32F;default:throw new se("Unable to derive format")}case ya.UNSIGNED_BYTE:switch(this._descriptor.pixelFormat){case ci.RGBA:return this._descriptor.internalFormat=zt.RGBA8;case ci.RGB:return this._descriptor.internalFormat=zt.RGB8}}return this._descriptor.internalFormat=this._descriptor.pixelFormat===ci.DEPTH_STENCIL?ci.DEPTH24_STENCIL8:this._descriptor.pixelFormat}_configurePixelStorage(){const e=this._descriptor.context.gl,{unpackAlignment:i,flipped:r,preMultiplyAlpha:n}=this._descriptor;e.pixelStorei(e.UNPACK_ALIGNMENT,i),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r?1:0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n?1:0)}_texStorage(e,i,r,n,s,o){const a=this._descriptor.context.gl2;if(a==null)throw new se("Immutable textures are not supported in WebGL1");if(!ugt(i))throw new se("Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const c=r?Ame(e,n,s,o):1;if(K3(e)){if(o==null)throw new se("Missing depth dimension for 3D texture upload");a.texStorage3D(e,c,i,n,s,o)}else a.texStorage2D(e,c,i,n,s);this._wasImmutablyAllocated=!0}_texImage(e,i,r,n,s,o,a){const c=this._descriptor.context.gl,p=K3(e),{isImmutable:_,pixelFormat:x,dataType:S}=this._descriptor,C=this._descriptor.context.type===cr.WEBGL2,M=C?c:null;if(C||!xq(a))if(_){if(a!=null){const P=a;if(p){if(o==null)throw new se("Missing depth dimension for 3D texture upload");M.texSubImage3D(e,i,0,0,0,n,s,o,x,S,P)}else c.texSubImage2D(e,i,0,0,n,s,x,S,P)}}else{const P=a;if(p){if(o==null)throw new se("Missing depth dimension for 3D texture upload");M.texImage3D(e,i,r,n,s,o,0,x,S,P)}else c.texImage2D(e,i,r,n,s,0,x,S,P)}else c.texImage2D(e,0,r,x,S,a)}_compressedTexImage(e,i,r,n,s,o,a){const c=this._descriptor.context.gl;let p=null;const _=K3(e),x=this._descriptor.isImmutable;if(_){if(this._descriptor.context.type!==cr.WEBGL2)throw new se("3D textures are not supported in WebGL1");p=c}if(x){if(a!=null)if(_){if(o==null)throw new se("Missing depth dimension for 3D texture upload");p.compressedTexSubImage3D(e,i,0,0,0,n,s,o,r,a)}else c.compressedTexSubImage2D(e,i,0,0,n,s,r,a)}else if(_){if(o==null)throw new se("Missing depth dimension for 3D texture upload");p.compressedTexImage3D(e,i,r,n,s,o,0,a)}else c.compressedTexImage2D(e,i,r,n,s,0,a)}_forEachMipmapLevel(e,i=1/0){let{width:r,height:n,depth:s,hasMipmap:o,target:a}=this._descriptor;const c=a===qs.TEXTURE_3D;if(r==null||n==null||c&&s==null)throw new se("Missing texture dimensions for mipmap calculation");for(let p=0;e(p,r,n,s),o&&(r!==1||n!==1||c&&s!==1)&&!(p>=i);++p)r=Math.max(1,r>>1),n=Math.max(1,n>>1),c&&(s=Math.max(1,s>>1))}};function wq(t,e){(e.width!=null&&e.width<0||e.height!=null&&e.height<0||e.depth!=null&&e.depth<0)&&console.error("Negative dimension parameters are not allowed!");const i=t.type===cr.WEBGL2;i||!e.isImmutable&&!K3(e.target)||console.error("Immutable and 3D-like textures are not supported in WebGL1!"),!i&&(e.width!=null&&HT(e.width)&&e.height!=null&&HT(e.height)||(typeof e.wrapMode=="number"?e.wrapMode!==Bi.CLAMP_TO_EDGE&&console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"):e.wrapMode.s===Bi.CLAMP_TO_EDGE&&e.wrapMode.t===Bi.CLAMP_TO_EDGE||console.error("Non-power-of-two textures must have a wrap mode of CLAMP_TO_EDGE!"),e.hasMipmap&&console.error("Mipmapping requires power-of-two textures!")))}function Eme(t,e){let i=e.samplingMode,r=e.samplingMode;i===ki.LINEAR_MIPMAP_NEAREST||i===ki.LINEAR_MIPMAP_LINEAR?(i=ki.LINEAR,e.hasMipmap||(r=ki.LINEAR)):i!==ki.NEAREST_MIPMAP_NEAREST&&i!==ki.NEAREST_MIPMAP_LINEAR||(i=ki.NEAREST,e.hasMipmap||(r=ki.NEAREST)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,i),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r)}function Cme(t,e){typeof e.wrapMode=="number"?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}function cgt(t,e){const i=t.capabilities.textureFilterAnisotropic;i&&t.gl.texParameterf(e.target,i.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}function ugt(t){return t in zt}function hgt(t){return t in to}function GF(t){return t!=null&&"type"in t&&t.type==="compressed"}function dgt(t){return t!=null&&"byteLength"in t}function xq(t){return t!=null&&!GF(t)&&!dgt(t)}function K3(t){return t===qs.TEXTURE_3D||t===qs.TEXTURE_2D_ARRAY}function Ame(t,e,i,r=1){let n=Math.max(e,i);return t===qs.TEXTURE_3D&&(n=Math.max(n,r)),Math.round(Math.log(n)/Math.LN2)+1}Ai.TEXTURE_UNIT_FOR_UPDATES=0;const pgt=new Map,fgt=Ce.getLogger("esri.views.webgl.FramebufferObject");let Zm=class qA{constructor(e,i,r=null){this._context=e,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,this._initialized=!1,e.instanceCounter.increment(bo.FramebufferObject,this);const n=HF(i)?i:new Ai(this._context,i);if(this._colorAttachments.set(Vu.COLOR_ATTACHMENT0,n),this._validateTextureDescriptor(n.descriptor),this._validateColorAttachmentPoint(Vu.COLOR_ATTACHMENT0),r!=null)if(ggt(r))this._context.capabilities.depthTexture||console.error("Setting the depth/stencil texture as an attachment requires WEBGL_depth_texture or WebGL2"),this._depthStencilTexture=HF(r)?r:new Ai(this._context,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const s=mgt(r)?r:new i$e(this._context,r);this._depthStencilBuffer=s,this._validateRenderBufferDescriptor(s.descriptor)}}dispose(){var i,r;if(this._colorAttachments.size===0&&!this._glName)return;const e=this._context.getBoundFramebufferObject();this._colorAttachments.forEach((n,s)=>{var o;return(o=this.detachColorTexture(s))==null?void 0:o.dispose()}),(i=this.detachDepthStencilBuffer())==null||i.dispose(),(r=this.detachDepthStencilTexture())==null||r.dispose(),this._glName&&(this._context.gl.deleteFramebuffer(this._glName),this._glName=null),this._context.bindFramebuffer(e),this._context.instanceCounter.decrement(bo.FramebufferObject,this)}get glName(){return this._glName}get colorTexture(){return this._colorAttachments.get(Vu.COLOR_ATTACHMENT0)}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){var i;const e=this._colorAttachments.get(Vu.COLOR_ATTACHMENT0);return((i=e==null?void 0:e.descriptor)==null?void 0:i.width)??0}get height(){var i;const e=this._colorAttachments.get(Vu.COLOR_ATTACHMENT0);return((i=e==null?void 0:e.descriptor)==null?void 0:i.height)??0}get gpuMemoryUsage(){var e;return[...this._colorAttachments].reduce((i,[r,n])=>i+n.gpuMemoryUsage,((e=this.depthStencil)==null?void 0:e.gpuMemoryUsage)??0)}getColorTexture(e){const i=this._colorAttachments.get(e);return i&&HF(i)?i:null}get colorAttachments(){return[...this._colorAttachments.keys()]}attachColorTexture(e,i=Vu.COLOR_ATTACHMENT0){var n;if(!e)return;this._validateColorAttachmentPoint(i);const r=e.descriptor;this._validateTextureDescriptor(r),(n=this.detachColorTexture(i))==null||n.dispose(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,i)),this._colorAttachments.set(i,e)}detachColorTexture(e=Vu.COLOR_ATTACHMENT0){const i=this._colorAttachments.get(e);if(i){if(this._initialized){const r=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),this._framebufferTexture2D(null,e),this._context.bindFramebuffer(r)}return this._colorAttachments.delete(e),i}}setColorTextureTarget(e,i=Vu.COLOR_ATTACHMENT0){const r=this._colorAttachments.get(i);r&&this._framebufferTexture2D(r.glName,i,e)}attachDepthStencil(e){if(e)switch(e.type){case q2.Texture:return this._attachDepthStencilTexture(e);case q2.RenderBuffer:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){var r;if(e==null)return;const i=e.descriptor;i.pixelFormat!==ci.DEPTH_STENCIL&&i.pixelFormat!==ci.DEPTH24_STENCIL8&&console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!"),i.dataType!==ya.UNSIGNED_INT_24_8&&console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"),this._context.capabilities.depthTexture||console.error("Extension WEBGL_depth_texture isn't supported therefore it is no possible to set the depth/stencil texture!"),this._validateTextureDescriptor(i),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,_me)),(r=this._depthStencilTexture)==null||r.dispose(),this._depthStencilTexture=e}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,_me)),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(e==null)return;const i=e.descriptor;if(this._validateRenderBufferDescriptor(i),this._disposeDepthStencilAttachments(),this._initialized){this._context.bindFramebuffer(this);const r=this._context.gl,n=this._getGLAttachmentPoint(i);r.framebufferRenderbuffer(jl.FRAMEBUFFER,n,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._initialized){this._context.bindFramebuffer(this);const i=this._context.gl,r=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(jl.FRAMEBUFFER,r,i.RENDERBUFFER,null)}return this._depthStencilBuffer=null,e}copyToTexture(e,i,r,n,s,o,a){(e<0||i<0||s<0||o<0)&&console.error("Offsets cannot be negative!"),(r<=0||n<=0)&&console.error("Copy width and height must be greater than zero!");const c=a.descriptor;a.descriptor.target!==qs.TEXTURE_2D&&console.error("Texture target must be TEXTURE_2D!"),((c==null?void 0:c.width)==null||(c==null?void 0:c.height)==null||e+r>this.width||i+n>this.height||s+r>c.width||o+n>c.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const p=this._context,_=p.bindTexture(a,Ai.TEXTURE_UNIT_FOR_UPDATES);p.setActiveTexture(Ai.TEXTURE_UNIT_FOR_UPDATES),p.bindFramebuffer(this),p.gl.copyTexSubImage2D(qs.TEXTURE_2D,0,s,o,e,i,r,n),p.bindTexture(_,Ai.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,i,r,n,s,o,a){(r<=0||n<=0)&&console.error("Copy width and height must be greater than zero!"),a||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,i,r,n,s,o,a)}async readPixelsAsync(e,i,r,n,s,o,a){if(this._context.type!==cr.WEBGL2)return cm()&&console.warn("Attempting to read pixels using pixel buffer object without WebGL2"),void this.readPixels(e,i,r,n,s,o,a);const c=this._context.gl,p=Yr.createPixelPack(this._context,Rr.STREAM_READ,a.byteLength);this._context.bindBuffer(p),this._context.bindFramebuffer(this),c.readPixels(e,i,r,n,s,o,0),this._context.unbindBuffer(fi.PIXEL_PACK_BUFFER),await p.getSubDataAsync(a),p.dispose()}resize(e,i){var n,s;if(this.width===e&&this.height===i)return;const r={width:e,height:i};nT(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(o=>o.resize(r.width,r.height)),(n=this._depthStencilTexture)==null||n.resize(r.width,r.height),this._initialized&&(nT(r,this._context.parameters.maxRenderbufferSize),(s=this._depthStencilBuffer)==null||s.resize(r.width,r.height),this._context.getBoundFramebufferObject()===this&&this._context.bindFramebuffer(null),this._initialized=!1)}initializeAndBind(e=jl.FRAMEBUFFER){const i=this._context.gl;if(this._initialized)return void i.bindFramebuffer(e,this.glName);this._glName&&i.deleteFramebuffer(this._glName);const r=i.createFramebuffer();if(i.bindFramebuffer(e,r),this._colorAttachments.forEach((n,s)=>this._framebufferTexture2D(n.glName,s,Mme(n),e)),this._depthStencilBuffer){const n=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);i.framebufferRenderbuffer(e,n,i.RENDERBUFFER,this._depthStencilBuffer.glName)}else this._depthStencilTexture&&this._framebufferTexture2D(this._depthStencilTexture.glName,i.DEPTH_STENCIL_ATTACHMENT,Mme(this._depthStencilTexture),e);cm()&&i.checkFramebufferStatus(e)!==i.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!"),this._glName=r,this._initialized=!0}_framebufferTexture2D(e,i=Vu.COLOR_ATTACHMENT0,r=qs.TEXTURE_2D,n=jl.FRAMEBUFFER,s=0){this._context.gl.framebufferTexture2D(n,i,r,e,s)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._initialized){this._context.bindFramebuffer(this);const i=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(jl.FRAMEBUFFER,i,e.RENDERBUFFER,null)}this._depthStencilBuffer=Kt(this._depthStencilBuffer)}this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,e.DEPTH_STENCIL_ATTACHMENT)),this._depthStencilTexture=Kt(this._depthStencilTexture))}_validateTextureDescriptor(e){e.target!==qs.TEXTURE_2D&&e.target!==qs.TEXTURE_CUBE_MAP&&console.error("Texture type must be TEXTURE_2D or TEXTURE_CUBE_MAP!"),nT(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderBufferDescriptor(e){nT(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case Xa.DEPTH_COMPONENT16:case Xa.DEPTH_COMPONENT24:case Xa.DEPTH_COMPONENT32F:return this._context.gl.DEPTH_ATTACHMENT;case Xa.DEPTH24_STENCIL8:case Xa.DEPTH32F_STENCIL8:case Xa.DEPTH_STENCIL:return this._context.gl.DEPTH_STENCIL_ATTACHMENT;case Xa.STENCIL_INDEX8:return this._context.gl.STENCIL_ATTACHMENT}}_validateColorAttachmentPoint(e){if(qA._MAX_COLOR_ATTACHMENTS===-1){const r=this._context.capabilities.drawBuffers;if(r){const n=this._context.gl;qA._MAX_COLOR_ATTACHMENTS=n.getParameter(r.MAX_COLOR_ATTACHMENTS)}else qA._MAX_COLOR_ATTACHMENTS=1}const i=e-Vu.COLOR_ATTACHMENT0;i+1>qA._MAX_COLOR_ATTACHMENTS&&Ce.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${i+1}. Implementation supports up to ${qA._MAX_COLOR_ATTACHMENTS} color attachments`)}};function HF(t){return t!=null&&"type"in t&&t.type===q2.Texture}function mgt(t){return t!=null&&"type"in t&&t.type===q2.RenderBuffer}function ggt(t){return HF(t)||t!=null&&"pixelFormat"in t}function nT(t,e){const i=Math.max(t.width,t.height);if(i>e){fgt.warn(`Resizing FBO attachment size ${t.width}x${t.height} to device limit ${e}`);const r=e/i;return t.width=Math.round(t.width*r),t.height=Math.round(t.height*r),!1}return!0}function Mme(t){return t.descriptor.target===qs.TEXTURE_CUBE_MAP?qs.TEXTURE_CUBE_MAP_POSITIVE_X:qs.TEXTURE_2D}Zm._MAX_COLOR_ATTACHMENTS=-1;let ygt=class{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new bq(e.newCache,"FBOCache"),this._depthCache=new bq(e.newCache,"DepthAttachmentCache"),this._colorCache=new bq(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frame(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame()}get usedMemory(){return Array.from(this._acquired.values()).reduce((e,i)=>{var r;return e+("colorTexture"in i?((r=i.colorTexture)==null?void 0:r.gpuMemoryUsage)??0:i.usedMemory)},this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(e,i,r){const n=Sq(e,i,r),s=this._cache.pop(n)||new vgt(n,new Zm(this.rctx,{...Pme[e],width:i,height:r}),o=>(s.releaseDepth(),s.depth=this._acquireDepth(o,s.fbo.width,s.fbo.height),s.fbo.attachDepthStencil(s.depth.attachment),s),(o,a)=>{const c=this._acquireColor(o,i,r);return s.colors??(s.colors=new Map),s.colors.set(a,c),s.fbo.attachColorTexture(c.attachment,a),s});return s.release=()=>{this._acquired.delete(s),s.releaseDepth(),this._cache.put(s),s.release=()=>console.log(`Double FBO release in ${new Error().stack}`)},this.rctx.unbindTexture(s.fbo.colorTexture),this._trackHandle(s)}acquireDepth(e,i,r){return this._acquireDepth(e,i,r)}_acquireDepth(e,i,r){const n=Sq(e,i,r),s=this._depthCache.pop(n);if(s)return this._trackHandle(s);const o=e===ca.DEPTH_STENCIL_TEXTURE?new Ome(n,new Ai(this.rctx,{...Rme[e],width:i,height:r}),()=>{this._acquired.delete(o),this._depthCache.put(o)}):new Ome(n,new i$e(this.rctx,{...Rme[e],width:i,height:r}),()=>{this._acquired.delete(o),this._depthCache.put(o)});return this._trackHandle(o)}_acquireColor(e,i,r){const n=Sq(e,i,r),s=this._colorCache.pop(n);if(s)return this._trackHandle(s);const o=new _gt(n,new Ai(this.rctx,{...Pme[e],width:i,height:r}),()=>{this._acquired.delete(o),this._colorCache.put(o)});return this._trackHandle(o)}_trackHandle(e){return this._acquired.add(e),e}},vgt=class{constructor(e,i,r,n){this.key=e,this.fbo=i,this.acquireDepth=r,this.acquireColor=n,this.release=()=>{},this.incarnation=0}dispose(){this.fbo.dispose()}releaseDepth(){this.fbo.detachDepthStencilTexture(),this.fbo.detachDepthStencilBuffer(),this.depth=ir(this.depth)}detachDepth(){const e=this.depth;return this.depth=void 0,this.fbo.detachDepthStencilTexture(),this.fbo.detachDepthStencilBuffer(),e}attachDepth(e){return this.releaseDepth(),e&&(this.fbo.attachDepthStencil(e.attachment),this.depth=e),this}releaseColor(e){var r,n;this.fbo.detachColorTexture(e);const i=(r=this.colors)==null?void 0:r.get(e);(n=this.colors)==null||n.delete(e),ir(i)}get colorTexture(){var e;return(e=this.fbo)==null?void 0:e.colorTexture}getColorTexture(e=Vu.COLOR_ATTACHMENT0){var i;return(i=this.fbo)==null?void 0:i.getColorTexture(e)}get usedMemory(){return this.fbo.gpuMemoryUsage}},n$e=class{constructor(e,i,r){this.key=e,this.attachment=i,this.release=r,this.incarnation=0}dispose(){this.attachment.dispose()}get usedMemory(){return this.attachment.gpuMemoryUsage}},Ome=class extends n$e{},_gt=class extends n$e{constructor(e,i,r){super(e,i,r),this.attachment=i,this.release=r}};function Sq(t,e,i){return`${t}x${e}x${i}`}var Sr;(function(t){t[t.RED=0]="RED",t[t.RG=1]="RG",t[t.RGBA4=2]="RGBA4",t[t.RGBA=3]="RGBA",t[t.RGBA_MIPMAP=4]="RGBA_MIPMAP",t[t.R16F=5]="R16F",t[t.RGBA16F=6]="RGBA16F"})(Sr||(Sr={}));const qF=new rn;qF.pixelFormat=ci.RED,qF.internalFormat=zt.R8,qF.wrapMode=Bi.CLAMP_TO_EDGE;const WF=new rn;WF.pixelFormat=ci.RG,WF.internalFormat=zt.RG8,WF.wrapMode=Bi.CLAMP_TO_EDGE;const YF=new rn;YF.internalFormat=zt.RGBA4,YF.dataType=ya.UNSIGNED_SHORT_4_4_4_4,YF.wrapMode=Bi.CLAMP_TO_EDGE;const s$e=new rn;s$e.wrapMode=Bi.CLAMP_TO_EDGE;const p4=new rn;p4.wrapMode=Bi.CLAMP_TO_EDGE,p4.samplingMode=ki.LINEAR_MIPMAP_LINEAR,p4.hasMipmap=!0,p4.maxAnisotropy=8;const f4=new rn;f4.pixelFormat=ci.RED,f4.dataType=ya.HALF_FLOAT,f4.internalFormat=zt.R16F,f4.samplingMode=ki.NEAREST;const XF=new rn;XF.dataType=ya.HALF_FLOAT,XF.internalFormat=zt.RGBA16F,XF.samplingMode=ki.NEAREST;const Pme={[Sr.RED]:qF,[Sr.RG]:WF,[Sr.RGBA4]:YF,[Sr.RGBA]:s$e,[Sr.RGBA_MIPMAP]:p4,[Sr.R16F]:f4,[Sr.RGBA16F]:XF};var ca;(function(t){t[t.DEPTH_STENCIL_TEXTURE=0]="DEPTH_STENCIL_TEXTURE",t[t.DEPTH_STENCIL_BUFFER=1]="DEPTH_STENCIL_BUFFER",t[t.DEPTH24_BUFFER=2]="DEPTH24_BUFFER",t[t.DEPTH16_BUFFER=3]="DEPTH16_BUFFER"})(ca||(ca={}));const m4=new rn;m4.pixelFormat=ci.DEPTH_STENCIL,m4.dataType=ya.UNSIGNED_INT_24_8,m4.samplingMode=ki.NEAREST,m4.wrapMode=Bi.CLAMP_TO_EDGE;const Rme={[ca.DEPTH_STENCIL_TEXTURE]:m4,[ca.DEPTH_STENCIL_BUFFER]:new jF(Xa.DEPTH24_STENCIL8,4),[ca.DEPTH24_BUFFER]:new jF(Xa.DEPTH_COMPONENT24,4),[ca.DEPTH16_BUFFER]:new jF(Xa.DEPTH_COMPONENT16,4)};let Ol=class{constructor(e,i,r,n,s,o=!1,a=0){this.name=e,this.count=i,this.type=r,this.offset=n,this.stride=s,this.normalized=o,this.divisor=a}};new Ol(J.POSITION,3,Yt.FLOAT,0,12);new Ol(J.POSITION,3,Yt.FLOAT,0,20),new Ol(J.UV0,2,Yt.FLOAT,12,20);new Ol(J.POSITION,3,Yt.FLOAT,0,32),new Ol(J.NORMAL,3,Yt.FLOAT,12,32),new Ol(J.UV0,2,Yt.FLOAT,24,32);new Ol(J.POSITION,3,Yt.FLOAT,0,16),new Ol(J.COLOR,4,Yt.UNSIGNED_BYTE,12,16);const Pae=[new Ol(J.POSITION,2,Yt.FLOAT,0,8)],Z9=[new Ol(J.POSITION,2,Yt.FLOAT,0,16),new Ol(J.UV0,2,Yt.FLOAT,8,16)],nC=Ce.getLogger("esri.views.webgl.VertexArrayObject");let r0=class{constructor(e,i,r,n,s=null){this._context=e,this._locations=i,this._layout=r,this._buffers=n,this._indexBuffer=s,this._glName=null,this._initialized=!1}get glName(){return this._glName}get context(){return this._context}get vertexBuffers(){return this._buffers}get indexBuffer(){return this._indexBuffer}get byteSize(){return Object.keys(this._buffers).reduce((e,i)=>e+this._buffers[i].byteLength,this._indexBuffer!=null?this._indexBuffer.byteLength:0)}get layout(){return this._layout}get locations(){return this._locations}get usedMemory(){return this.byteSize+(Object.keys(this._buffers).length+(this._indexBuffer?1:0))*TSe}dispose(){var e;if(this._context){this._context.getBoundVAO()===this&&this._context.bindVAO(null);for(const i in this._buffers)(e=this._buffers[i])==null||e.dispose(),delete this._buffers[i];this._indexBuffer=Kt(this._indexBuffer),this.disposeVAOOnly()}else(this._glName||Object.getOwnPropertyNames(this._buffers).length>0)&&nC.warn("Leaked WebGL VAO")}disposeVAOOnly(){var e,i;this._glName&&(((i=(e=this._context)==null?void 0:e.capabilities)==null?void 0:i.vao).deleteVertexArray(this._glName),this._glName=null,this._context.instanceCounter.decrement(bo.VertexArrayObject,this)),this._context=null}initialize(){if(this._initialized)return;const e=this._context.capabilities.vao;if(e){const i=e.createVertexArray();e.bindVertexArray(i),this._bindLayout(),e.bindVertexArray(null),this._glName=i,this._context.instanceCounter.increment(bo.VertexArrayObject,this)}this._initialized=!0}bind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(this.glName):(this._context.bindVAO(null),this._bindLayout())}_bindLayout(){const{_buffers:e,_layout:i,_indexBuffer:r}=this;e||nC.error("Vertex buffer dictionary is empty!");const n=this._context.gl;for(const s in e){const o=e[s];o||nC.error("Vertex buffer is uninitialized!");const a=i[s];a||nC.error("Vertex element descriptor is empty!"),Aae(this._context,this._locations,o,a)}r!=null&&(this._context.capabilities.vao?n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,r.glName):this._context.bindBuffer(r))}unbind(){this.initialize();const e=this._context.capabilities.vao;e?e.bindVertexArray(null):this._unbindLayout()}_unbindLayout(){const{_buffers:e,_layout:i}=this;e||nC.error("Vertex buffer dictionary is empty!");for(const r in e){const n=e[r];n||nC.error("Vertex buffer is uninitialized!");const s=i[r];Mae(this._context,this._locations,n,s)}this._indexBuffer!=null&&this._context.unbindBuffer(this._indexBuffer.bufferType)}},Jm=class extends r0{};function v1(t,e=Pae,i=Cr,r=-1,n=1){let s=null;return e===Z9?s=new Float32Array([r,r,0,0,n,r,1,0,r,n,0,1,n,n,1,1]):s=new Float32Array([r,r,n,r,r,n,n,n]),new Jm(t,i,{geometry:e},{geometry:Yr.createVertex(t,Rr.STATIC_DRAW,s)})}function bgt(t,e=Pae,i=Cr){const r=new Float32Array([-1,-1,3,-1,-1,3]);return new Jm(t,i,{geometry:e},{geometry:Yr.createVertex(t,Rr.STATIC_DRAW,r)})}const wgt=4;function o$e(t){const e=new rn(wgt);return e.samplingMode=ki.NEAREST,new Ai(t,e)}function xgt(t){const e=new rn(1);return e.samplingMode=ki.NEAREST,new Ai(t,e,new Uint8Array([255,255,255,255]))}const Ime=16;function TT(t){return Math.ceil(t/Ime)*Ime}function Sgt(t,e){let s=t.width*t.height;if(s<4096)return t instanceof ImageData?a$e(t):t;let o=t.width,a=t.height;do o=Math.ceil(o/2),a=Math.ceil(a/2),s=o*a;while(s>1048576||e!=null&&(o>e||a>e));return Rae(t,o,a)}function Tgt(t,e){const i=Math.max(t.width,t.height);if(i<=e)return t;const r=e/i;return Rae(t,Math.round(t.width*r),Math.round(t.height*r))}function Rae(t,e,i){if(t instanceof ImageData)return Rae(a$e(t),e,i);const r=document.createElement("canvas");return r.width=e,r.height=i,r.getContext("2d").drawImage(t,0,0,r.width,r.height),r}function a$e(t){const e=document.createElement("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");if(i==null)throw new se("Failed to create 2d context from HTMLCanvasElement");return i.putImageData(t,0,0),e}function $c(t,e=!0){t.attributes.add(J.POSITION,"vec2"),e&&t.varyings.add("uv","vec2"),t.vertex.code.add(V` void main(void) { gl_Position = vec4(position, 0.0, 1.0); ${e?V`uv = position * 0.5 + vec2(0.5);`:""} } - `)}let _ae=class extends _n{};function d$e(t){const e=new Cr;e.include(Pc),e.fragment.uniforms.add(new Zt("colorTexture",r=>r.color),new Zt("depthTexture",r=>r.depth));const i=t.haze;return e.fragment.code.add(V` + `)}let Iae=class extends bn{};function l$e(t){const e=new Ar;e.include($c),e.fragment.uniforms.add(new Zt("colorTexture",r=>r.color),new Zt("depthTexture",r=>r.depth));const i=t.haze;return e.fragment.code.add(V` void main() { ${i?V`vec4`:V`float`} depthSample = texture(depthTexture, uv) ${i?"":V`.r`}; if (depthSample ${i?V`== vec4(0)`:V`!= 1.0`} ) { @@ -368,31 +357,31 @@ return scaleHeight * chapmanApproximation(radii[0] / scaleHeight, h, dot(normali } fragColor = texture(colorTexture, uv); } - `),e}const Cyt=Object.freeze(Object.defineProperty({__proto__:null,AtmosphereCompositingPassParameters:_ae,build:d$e},Symbol.toStringTag,{value:"Module"}));let p$e=class f$e extends Hr{initializeProgram(e){return new Ir(e.rctx,f$e.shader.get().build(this.configuration),Er)}initializePipeline(){return this.configuration.haze?Ti({blending:Ol(st.ONE,st.ZERO,st.ONE_MINUS_SRC_COLOR,st.ONE),depthTest:{func:Zr.ALWAYS},colorWrite:ji}):Ti({blending:hd(st.SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),depthTest:{func:Zr.ALWAYS},colorWrite:ji})}};p$e.shader=new Rr(Cyt,()=>we(()=>Promise.resolve().then(()=>pWt),void 0));let Ime=class{constructor(e,i){this._view=e,this._context=i,this.type=pc.Realistic,this._handles=new O_,this._atmosphereCompositionParameters=new _ae,this._atmosphereConfiguration=new _U,this._passParameters=new iyt,this._rootTileElevationMin=NaN,this._lowerBoundEarthRadius=Mr.radius,this._fadeHaze=0,this._updateRadius(Mr.radius);const r=this._context.renderContext.rctx;this._updateRootTileElevationBounds(),this._handles.add([_e(()=>{var s,o;return(o=(s=this._view)==null?void 0:s.basemapTerrain)==null?void 0:o.rootTileElevationBounds},()=>{var s;return(s=this._view)!=null&&s.basemapTerrain?this._updateRootTileElevationBounds():null}),_e(()=>{var s,o;return(o=(s=this._view)==null?void 0:s.basemapTerrain)==null?void 0:o.visibleElevationBounds},()=>{var s;return(s=this._view)!=null&&s.basemapTerrain?this._updateVisibleElevationBounds():null}),_e(()=>{var s;return(s=this._view)==null?void 0:s.environment.background},s=>{const o=s instanceof t4e?AL(s.color):gp;Ie(this._passParameters.backgroundColor,o[0]*o[3],o[1]*o[3],o[2]*o[3])},kt)]);const n=new _U;n.haze=!1,this._atmosphereTechnique=this._context.techniqueRepository.acquire(tI,n),n.haze=!0,this._atmosphereHazeTechnique=this._context.techniqueRepository.acquire(tI,n),n.reduced=!0,n.haze=!1,this._atmosphereReducedTechnique=this._context.techniqueRepository.acquire(tI,n),n.haze=!0,this._atmosphereHazeReducedTechnique=this._context.techniqueRepository.acquire(tI,n),this._vao=u1(r,H9)}destroy(){this._handles.destroy(),this._atmosphereTechnique.release(),this._atmosphereHazeTechnique.release(),this._atmosphereReducedTechnique.release(),this._atmosphereHazeReducedTechnique.release(),this._vao.dispose()}render(e,i){this._render(e,i?this._atmosphereTechnique:this._atmosphereReducedTechnique,e.offscreenRenderingHelper.depthTexture,i,!1)}renderHaze(e,i,r){var n;this._fadeHaze=i,this._render(e,r?this._atmosphereHazeTechnique:this._atmosphereHazeReducedTechnique,(n=e.bindParameters.linearDepth)==null?void 0:n.colorTexture,r,!0)}_render(e,i,r,n,s){if(r==null)return;const o=e.offscreenRenderingHelper;this._update(e.bindParameters.camera),this._passParameters.depthTexture=r;const l=e.rctx.bindTechnique(i,this._passParameters,e.bindParameters);if(n)o.renderDepthDetached(()=>this._renderCommon(l,e));else{const c=e.rctx.getViewport(),f=rt(e.bindParameters.camera.eye)-Mr.radius;let _;if(fthis._renderCommon(l,e),[0,0,0,1],xr.RGBA,null,x,T);e.rctx.setViewport(c.x,c.y,c.width,c.height),this._atmosphereCompositionParameters.color=A.colorTexture,this._atmosphereCompositionParameters.depth=r,this._atmosphereConfiguration.haze=s;const M=this._context.techniqueRepository.acquire(p$e,this._atmosphereConfiguration);e.rctx.bindTechnique(M,this._atmosphereCompositionParameters,e.bindParameters),o.renderDepthDetached(()=>e.rctx.screen.draw()),M.release(),A.release()}}_renderCommon(e,i){this._vao!=null&&(i.rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),i.rctx.drawArrays(sr.TRIANGLE_STRIP,0,4))}_adjustRadiusForTesselation(e){return e*Math.cos(Math.PI/16/16)}_updateRootTileElevationBounds(){const e=this._view.basemapTerrain.rootTileElevationBounds.min;e!==this._rootTileElevationMin&&(this._rootTileElevationMin=e,this._lowerBoundEarthRadius=Mr.radius,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=this._adjustRadiusForTesselation(Mr.radius+this._view.basemapTerrain.visibleElevationBounds.min);ewe(()=>Promise.resolve().then(()=>XYt),void 0));let $me=class{constructor(e,i){this._view=e,this._context=i,this.type=gc.Realistic,this._handles=new N_,this._atmosphereCompositionParameters=new Iae,this._atmosphereConfiguration=new bU,this._passParameters=new tgt,this._rootTileElevationMin=NaN,this._lowerBoundEarthRadius=Or.radius,this._fadeHaze=0,this._updateRadius(Or.radius);const r=this._context.renderContext.rctx;this._updateRootTileElevationBounds(),this._handles.add([_e(()=>{var s,o;return(o=(s=this._view)==null?void 0:s.basemapTerrain)==null?void 0:o.rootTileElevationBounds},()=>{var s;return(s=this._view)!=null&&s.basemapTerrain?this._updateRootTileElevationBounds():null}),_e(()=>{var s,o;return(o=(s=this._view)==null?void 0:s.basemapTerrain)==null?void 0:o.visibleElevationBounds},()=>{var s;return(s=this._view)!=null&&s.basemapTerrain?this._updateVisibleElevationBounds():null}),_e(()=>{var s;return(s=this._view)==null?void 0:s.environment.background},s=>{const o=s instanceof MRe?NL(s.color):bp;Ie(this._passParameters.backgroundColor,o[0]*o[3],o[1]*o[3],o[2]*o[3])},kt)]);const n=new bU;n.haze=!1,this._atmosphereTechnique=this._context.techniqueRepository.acquire(d4,n),n.haze=!0,this._atmosphereHazeTechnique=this._context.techniqueRepository.acquire(d4,n),n.reduced=!0,n.haze=!1,this._atmosphereReducedTechnique=this._context.techniqueRepository.acquire(d4,n),n.haze=!0,this._atmosphereHazeReducedTechnique=this._context.techniqueRepository.acquire(d4,n),this._vao=v1(r,Z9)}destroy(){this._handles.destroy(),this._atmosphereTechnique.release(),this._atmosphereHazeTechnique.release(),this._atmosphereReducedTechnique.release(),this._atmosphereHazeReducedTechnique.release(),this._vao.dispose()}render(e,i){this._render(e,i?this._atmosphereTechnique:this._atmosphereReducedTechnique,e.offscreenRenderingHelper.depthTexture,i,!1)}renderHaze(e,i,r){var n;this._fadeHaze=i,this._render(e,r?this._atmosphereHazeTechnique:this._atmosphereHazeReducedTechnique,(n=e.bindParameters.linearDepth)==null?void 0:n.colorTexture,r,!0)}_render(e,i,r,n,s){if(r==null)return;const o=e.offscreenRenderingHelper;this._update(e.bindParameters.camera),this._passParameters.depthTexture=r;const a=e.rctx.bindTechnique(i,this._passParameters,e.bindParameters);if(n)o.renderDepthDetached(()=>this._renderCommon(a,e));else{const c=e.rctx.getViewport(),p=nt(e.bindParameters.camera.eye)-Or.radius;let _;if(pthis._renderCommon(a,e),[0,0,0,1],Sr.RGBA,null,x,S);e.rctx.setViewport(c.x,c.y,c.width,c.height),this._atmosphereCompositionParameters.color=C.colorTexture,this._atmosphereCompositionParameters.depth=r,this._atmosphereConfiguration.haze=s;const M=this._context.techniqueRepository.acquire(c$e,this._atmosphereConfiguration);e.rctx.bindTechnique(M,this._atmosphereCompositionParameters,e.bindParameters),o.renderDepthDetached(()=>e.rctx.screen.draw()),M.release(),C.release()}}_renderCommon(e,i){this._vao!=null&&(i.rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),i.rctx.drawArrays(sr.TRIANGLE_STRIP,0,4))}_adjustRadiusForTesselation(e){return e*Math.cos(Math.PI/16/16)}_updateRootTileElevationBounds(){const e=this._view.basemapTerrain.rootTileElevationBounds.min;e!==this._rootTileElevationMin&&(this._rootTileElevationMin=e,this._lowerBoundEarthRadius=Or.radius,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=this._adjustRadiusForTesselation(Or.radius+this._view.basemapTerrain.visibleElevationBounds.min);er.setUniform3fv(e,i(n,s,o)))}},$f=class extends Ls{constructor(e,i){super(e,"sampler2D",Or.Draw,(r,n,s)=>r.bindTexture(e,i(n,s)))}},cx=class{constructor(e){this._material=e.material,this._techniqueRepository=e.techniqueRep,this._output=e.output}dispose(){this._techniqueRepository.release(this._technique)}get technique(){return this._technique}get _stippleTextureRepository(){return this._techniqueRepository.constructionContext.stippleTextureRepository}get _markerTextureRepository(){return this._techniqueRepository.constructionContext.markerTextureRepository}ensureTechnique(e,i){return this._technique=this._techniqueRepository.releaseAndAcquire(e,this._material.getConfiguration(this._output,i),this._technique),this._technique}ensureResources(e){return U2.LOADED}},wae=class extends cx{constructor(e){super(e),this._numLoading=0,this._disposed=!1,this._textureRepository=e.textureRepository,this._textureId=e.textureId,this._acquire(e.textureId,i=>this._texture=i),this._acquire(e.normalTextureId,i=>this._textureNormal=i),this._acquire(e.emissiveTextureId,i=>this._textureEmissive=i),this._acquire(e.occlusionTextureId,i=>this._textureOcclusion=i),this._acquire(e.metallicRoughnessTextureId,i=>this._textureMetallicRoughness=i)}dispose(){this._texture=ir(this._texture),this._textureNormal=ir(this._textureNormal),this._textureEmissive=ir(this._textureEmissive),this._textureOcclusion=ir(this._textureOcclusion),this._textureMetallicRoughness=ir(this._textureMetallicRoughness),this._disposed=!0}ensureResources(e){return this._numLoading===0?U2.LOADED:U2.LOADING}get textureBindParameters(){return new g$e(this._texture!=null?this._texture.glTexture:null,this._textureNormal!=null?this._textureNormal.glTexture:null,this._textureEmissive!=null?this._textureEmissive.glTexture:null,this._textureOcclusion!=null?this._textureOcclusion.glTexture:null,this._textureMetallicRoughness!=null?this._textureMetallicRoughness.glTexture:null)}updateTexture(e){this._texture!=null&&e===this._texture.id||(this._texture=ir(this._texture),this._textureId=e,this._acquire(this._textureId,i=>this._texture=i))}_acquire(e,i){if(e==null)return void i(null);const r=this._textureRepository.acquire(e);if(pd(r))return++this._numLoading,void r.then(n=>{if(this._disposed)return ir(n),void i(null);i(n)}).finally(()=>--this._numLoading);i(r)}},g$e=class extends _n{constructor(e=null,i=null,r=null,n=null,s=null){super(),this.texture=e,this.textureNormal=i,this.textureEmissive=r,this.textureOcclusion=n,this.textureMetallicRoughness=s}};var ei;(function(t){t[t.Disabled=0]="Disabled",t[t.Normal=1]="Normal",t[t.Schematic=2]="Schematic",t[t.Water=3]="Water",t[t.WaterOnIntegratedMesh=4]="WaterOnIntegratedMesh",t[t.Terrain=5]="Terrain",t[t.TerrainWithWater=6]="TerrainWithWater",t[t.COUNT=7]="COUNT"})(ei||(ei={}));function xae(t,e){const i=t.fragment,r=e.hasMetallicRoughnessTexture||e.hasEmissionTexture||e.hasOcclusionTexture;if(e.pbrMode===ei.Normal&&r&&t.include(bae,e),e.pbrMode!==ei.Schematic)if(e.pbrMode!==ei.Disabled){if(e.pbrMode===ei.Normal){i.code.add(V`vec3 mrr; +}`);default:e.textureCoordinateType;case To.None:case To.COUNT:return}}let wp=class extends Ds{constructor(e,i){super(e,"vec3",Pr.Draw,(r,n,s,o)=>r.setUniform3fv(e,i(n,s,o)))}},kf=class extends Ds{constructor(e,i){super(e,"sampler2D",Pr.Draw,(r,n,s)=>r.bindTexture(e,i(n,s)))}},fx=class{constructor(e){this._material=e.material,this._techniqueRepository=e.techniqueRep,this._output=e.output}dispose(){this._techniqueRepository.release(this._technique)}get technique(){return this._technique}get _stippleTextureRepository(){return this._techniqueRepository.constructionContext.stippleTextureRepository}get _markerTextureRepository(){return this._techniqueRepository.constructionContext.markerTextureRepository}ensureTechnique(e,i){return this._technique=this._techniqueRepository.releaseAndAcquire(e,this._material.getConfiguration(this._output,i),this._technique),this._technique}ensureResources(e){return H2.LOADED}},Lae=class extends fx{constructor(e){super(e),this._numLoading=0,this._disposed=!1,this._textureRepository=e.textureRepository,this._textureId=e.textureId,this._acquire(e.textureId,i=>this._texture=i),this._acquire(e.normalTextureId,i=>this._textureNormal=i),this._acquire(e.emissiveTextureId,i=>this._textureEmissive=i),this._acquire(e.occlusionTextureId,i=>this._textureOcclusion=i),this._acquire(e.metallicRoughnessTextureId,i=>this._textureMetallicRoughness=i)}dispose(){this._texture=ir(this._texture),this._textureNormal=ir(this._textureNormal),this._textureEmissive=ir(this._textureEmissive),this._textureOcclusion=ir(this._textureOcclusion),this._textureMetallicRoughness=ir(this._textureMetallicRoughness),this._disposed=!0}ensureResources(e){return this._numLoading===0?H2.LOADED:H2.LOADING}get textureBindParameters(){return new d$e(this._texture!=null?this._texture.glTexture:null,this._textureNormal!=null?this._textureNormal.glTexture:null,this._textureEmissive!=null?this._textureEmissive.glTexture:null,this._textureOcclusion!=null?this._textureOcclusion.glTexture:null,this._textureMetallicRoughness!=null?this._textureMetallicRoughness.glTexture:null)}updateTexture(e){this._texture!=null&&e===this._texture.id||(this._texture=ir(this._texture),this._textureId=e,this._acquire(this._textureId,i=>this._texture=i))}_acquire(e,i){if(e==null)return void i(null);const r=this._textureRepository.acquire(e);if(yd(r))return++this._numLoading,void r.then(n=>{if(this._disposed)return ir(n),void i(null);i(n)}).finally(()=>--this._numLoading);i(r)}},d$e=class extends bn{constructor(e=null,i=null,r=null,n=null,s=null){super(),this.texture=e,this.textureNormal=i,this.textureEmissive=r,this.textureOcclusion=n,this.textureMetallicRoughness=s}};var ti;(function(t){t[t.Disabled=0]="Disabled",t[t.Normal=1]="Normal",t[t.Schematic=2]="Schematic",t[t.Water=3]="Water",t[t.WaterOnIntegratedMesh=4]="WaterOnIntegratedMesh",t[t.Terrain=5]="Terrain",t[t.TerrainWithWater=6]="TerrainWithWater",t[t.COUNT=7]="COUNT"})(ti||(ti={}));function Dae(t,e){const i=t.fragment,r=e.hasMetallicRoughnessTexture||e.hasEmissionTexture||e.hasOcclusionTexture;if(e.pbrMode===ti.Normal&&r&&t.include($ae,e),e.pbrMode!==ti.Schematic)if(e.pbrMode!==ti.Disabled){if(e.pbrMode===ti.Normal){i.code.add(V`vec3 mrr; vec3 emission; -float occlusion;`);const n=e.pbrTextureBindType;e.hasMetallicRoughnessTexture&&(i.uniforms.add(n===Or.Pass?new Zt("texMetallicRoughness",s=>s.textureMetallicRoughness):new $f("texMetallicRoughness",s=>s.textureMetallicRoughness)),i.code.add(V`void applyMetallnessAndRoughness(vec2 uv) { +float occlusion;`);const n=e.pbrTextureBindType;e.hasMetallicRoughnessTexture&&(i.uniforms.add(n===Pr.Pass?new Zt("texMetallicRoughness",s=>s.textureMetallicRoughness):new kf("texMetallicRoughness",s=>s.textureMetallicRoughness)),i.code.add(V`void applyMetallnessAndRoughness(vec2 uv) { vec3 metallicRoughness = textureLookup(texMetallicRoughness, uv).rgb; mrr[0] *= metallicRoughness.b; mrr[1] *= metallicRoughness.g; -}`)),e.hasEmissionTexture&&(i.uniforms.add(n===Or.Pass?new Zt("texEmission",s=>s.textureEmissive):new $f("texEmission",s=>s.textureEmissive)),i.code.add(V`void applyEmission(vec2 uv) { +}`)),e.hasEmissionTexture&&(i.uniforms.add(n===Pr.Pass?new Zt("texEmission",s=>s.textureEmissive):new kf("texEmission",s=>s.textureEmissive)),i.code.add(V`void applyEmission(vec2 uv) { emission *= textureLookup(texEmission, uv).rgb; -}`)),e.hasOcclusionTexture?(i.uniforms.add(n===Or.Pass?new Zt("texOcclusion",s=>s.textureOcclusion):new $f("texOcclusion",s=>s.textureOcclusion)),i.code.add(V`void applyOcclusion(vec2 uv) { +}`)),e.hasOcclusionTexture?(i.uniforms.add(n===Pr.Pass?new Zt("texOcclusion",s=>s.textureOcclusion):new kf("texOcclusion",s=>s.textureOcclusion)),i.code.add(V`void applyOcclusion(vec2 uv) { occlusion *= textureLookup(texOcclusion, uv).r; } float getBakedOcclusion() { return occlusion; -}`)):i.code.add(V`float getBakedOcclusion() { return 1.0; }`),n===Or.Pass?i.uniforms.add(new Oi("emissionFactor",s=>s.emissiveFactor),new Oi("mrrFactors",s=>s.mrrFactors)):i.uniforms.add(new yp("emissionFactor",s=>s.emissiveFactor),new yp("mrrFactors",s=>s.mrrFactors)),i.code.add(V` +}`)):i.code.add(V`float getBakedOcclusion() { return 1.0; }`),n===Pr.Pass?i.uniforms.add(new Oi("emissionFactor",s=>s.emissiveFactor),new Oi("mrrFactors",s=>s.mrrFactors)):i.uniforms.add(new wp("emissionFactor",s=>s.emissiveFactor),new wp("mrrFactors",s=>s.mrrFactors)),i.code.add(V` void applyPBRFactors() { mrr = mrrFactors; emission = emissionFactor; @@ -408,10 +397,10 @@ return occlusion; vec3 emission = vec3(0.0); float occlusion = 1.0; void applyPBRFactors() {} -float getBakedOcclusion() { return 1.0; }`)}function Sae(t,e){const i=t.fragment,r=e.lightingSphericalHarmonicsOrder!==void 0?e.lightingSphericalHarmonicsOrder:2;r===0?(i.uniforms.add(new Oi("lightingAmbientSH0",(n,s)=>Ie($me,s.lighting.sh.r[0],s.lighting.sh.g[0],s.lighting.sh.b[0]))),i.code.add(V`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) { +float getBakedOcclusion() { return 1.0; }`)}function Nae(t,e){const i=t.fragment,r=e.lightingSphericalHarmonicsOrder!==void 0?e.lightingSphericalHarmonicsOrder:2;r===0?(i.uniforms.add(new Oi("lightingAmbientSH0",(n,s)=>Ie(Lme,s.lighting.sh.r[0],s.lighting.sh.g[0],s.lighting.sh.b[0]))),i.code.add(V`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) { vec3 ambientLight = 0.282095 * lightingAmbientSH0; return ambientLight * (1.0 - ambientOcclusion); -}`)):r===1?(i.uniforms.add(new gr("lightingAmbientSH_R",(n,s)=>rs(w1,s.lighting.sh.r[0],s.lighting.sh.r[1],s.lighting.sh.r[2],s.lighting.sh.r[3])),new gr("lightingAmbientSH_G",(n,s)=>rs(w1,s.lighting.sh.g[0],s.lighting.sh.g[1],s.lighting.sh.g[2],s.lighting.sh.g[3])),new gr("lightingAmbientSH_B",(n,s)=>rs(w1,s.lighting.sh.b[0],s.lighting.sh.b[1],s.lighting.sh.b[2],s.lighting.sh.b[3]))),i.code.add(V`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) { +}`)):r===1?(i.uniforms.add(new gr("lightingAmbientSH_R",(n,s)=>rs(O1,s.lighting.sh.r[0],s.lighting.sh.r[1],s.lighting.sh.r[2],s.lighting.sh.r[3])),new gr("lightingAmbientSH_G",(n,s)=>rs(O1,s.lighting.sh.g[0],s.lighting.sh.g[1],s.lighting.sh.g[2],s.lighting.sh.g[3])),new gr("lightingAmbientSH_B",(n,s)=>rs(O1,s.lighting.sh.b[0],s.lighting.sh.b[1],s.lighting.sh.b[2],s.lighting.sh.b[3]))),i.code.add(V`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) { vec4 sh0 = vec4( 0.282095, 0.488603 * normal.x, @@ -424,7 +413,7 @@ dot(lightingAmbientSH_G, sh0), dot(lightingAmbientSH_B, sh0) ); return ambientLight * (1.0 - ambientOcclusion); -}`)):r===2&&(i.uniforms.add(new Oi("lightingAmbientSH0",(n,s)=>Ie($me,s.lighting.sh.r[0],s.lighting.sh.g[0],s.lighting.sh.b[0])),new gr("lightingAmbientSH_R1",(n,s)=>rs(w1,s.lighting.sh.r[1],s.lighting.sh.r[2],s.lighting.sh.r[3],s.lighting.sh.r[4])),new gr("lightingAmbientSH_G1",(n,s)=>rs(w1,s.lighting.sh.g[1],s.lighting.sh.g[2],s.lighting.sh.g[3],s.lighting.sh.g[4])),new gr("lightingAmbientSH_B1",(n,s)=>rs(w1,s.lighting.sh.b[1],s.lighting.sh.b[2],s.lighting.sh.b[3],s.lighting.sh.b[4])),new gr("lightingAmbientSH_R2",(n,s)=>rs(w1,s.lighting.sh.r[5],s.lighting.sh.r[6],s.lighting.sh.r[7],s.lighting.sh.r[8])),new gr("lightingAmbientSH_G2",(n,s)=>rs(w1,s.lighting.sh.g[5],s.lighting.sh.g[6],s.lighting.sh.g[7],s.lighting.sh.g[8])),new gr("lightingAmbientSH_B2",(n,s)=>rs(w1,s.lighting.sh.b[5],s.lighting.sh.b[6],s.lighting.sh.b[7],s.lighting.sh.b[8]))),i.code.add(V`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) { +}`)):r===2&&(i.uniforms.add(new Oi("lightingAmbientSH0",(n,s)=>Ie(Lme,s.lighting.sh.r[0],s.lighting.sh.g[0],s.lighting.sh.b[0])),new gr("lightingAmbientSH_R1",(n,s)=>rs(O1,s.lighting.sh.r[1],s.lighting.sh.r[2],s.lighting.sh.r[3],s.lighting.sh.r[4])),new gr("lightingAmbientSH_G1",(n,s)=>rs(O1,s.lighting.sh.g[1],s.lighting.sh.g[2],s.lighting.sh.g[3],s.lighting.sh.g[4])),new gr("lightingAmbientSH_B1",(n,s)=>rs(O1,s.lighting.sh.b[1],s.lighting.sh.b[2],s.lighting.sh.b[3],s.lighting.sh.b[4])),new gr("lightingAmbientSH_R2",(n,s)=>rs(O1,s.lighting.sh.r[5],s.lighting.sh.r[6],s.lighting.sh.r[7],s.lighting.sh.r[8])),new gr("lightingAmbientSH_G2",(n,s)=>rs(O1,s.lighting.sh.g[5],s.lighting.sh.g[6],s.lighting.sh.g[7],s.lighting.sh.g[8])),new gr("lightingAmbientSH_B2",(n,s)=>rs(O1,s.lighting.sh.b[5],s.lighting.sh.b[6],s.lighting.sh.b[7],s.lighting.sh.b[8]))),i.code.add(V`vec3 calculateAmbientIrradiance(vec3 normal, float ambientOcclusion) { vec3 ambientLight = 0.282095 * lightingAmbientSH0; vec4 sh1 = vec4( 0.488603 * normal.x, @@ -449,15 +438,15 @@ dot(lightingAmbientSH_G2, sh2), dot(lightingAmbientSH_B2, sh2) ); return ambientLight * (1.0 - ambientOcclusion); -}`),e.pbrMode!==ei.Normal&&e.pbrMode!==ei.Schematic||i.code.add(V`const vec3 skyTransmittance = vec3(0.9, 0.9, 1.0); +}`),e.pbrMode!==ti.Normal&&e.pbrMode!==ti.Schematic||i.code.add(V`const vec3 skyTransmittance = vec3(0.9, 0.9, 1.0); vec3 calculateAmbientRadiance(float ambientOcclusion) { vec3 ambientLight = 1.2 * (0.282095 * lightingAmbientSH0) - 0.2; return ambientLight *= (1.0 - ambientOcclusion) * skyTransmittance; -}`))}const $me=W(),w1=Xi();function q9(t){t.vertex.code.add(V`const float PI = 3.141592653589793;`),t.fragment.code.add(V`const float PI = 3.141592653589793; +}`))}const Lme=W(),O1=Xi();function J9(t){t.vertex.code.add(V`const float PI = 3.141592653589793;`),t.fragment.code.add(V`const float PI = 3.141592653589793; const float LIGHT_NORMALIZATION = 1.0 / PI; const float INV_PI = 0.3183098861837907; -const float HALF_PI = 1.570796326794897;`)}var gy,YT;function Ayt(t){return(t==null?void 0:t.cubeMap)!=null}function Myt(t){return t!=null&&!t.running}(function(t){t[t.RENDERING=0]="RENDERING",t[t.FADING=1]="FADING",t[t.FINISHED=2]="FINISHED"})(gy||(gy={})),function(t){t[t.RG=0]="RG",t[t.BA=1]="BA"}(YT||(YT={}));function j_(t=y$e){return[t[0],t[1],t[2],t[3]]}function UF(t,e,i=j_()){return Ne(i,t),i[3]=e,i}function Lme(t,e,i=j_()){return Wt(i,t,e),Ye(i,i),i[3]=-mAe(t,e),i}function Dme(t,e,i=j_()){return wL(jD,t,zee(t)),wL(Nme,e,zee(e)),nj(jD,Nme,jD),Pyt(i,pu(Poe(i,jD)))}function Iii(t,e,i,r=j_()){return UF(hAe,t,GD),UF(dAe,e,Fme),UF(fB,i,kme),Dme(GD,Fme,GD),Dme(GD,kme,r),r}function $ii(t){return t}function Oyt(t){return t[3]}function zee(t){return Ei(t[3])}function Pyt(t,e){return t[3]=e,t}const y$e=[0,0,1,0],jD=Cp(),Nme=Cp();j_();const GD=j_(),Fme=j_(),kme=j_();let Ryt=class{constructor(){this.readChannels=YT.RG,this.renderingStage=gy.FINISHED,this.startTime=0,this.startTimeHeightFade=0,this.cameraPositionLastFrame=W(),this.parallax=new zme,this.parallaxNew=new zme,this.pointOnGround=W(),this.fadeMode=Vn.HIDE,this.fadeFactor=0,this.opacity=0}updateParallax(e){const i=this.parallax,r=rt(e.eye);if(i.radiusCurvatureCorrectionFactor=.84*Math.sqrt(Math.max(r*r-Mr.radius*Mr.radius,0))/r,Lme(Ume,i.anchorPointClouds,QE),Wh(i.transform,gs,QE[3],QE),this.fadeMode===Vn.CROSS_FADE){const n=this.parallaxNew;Lme(Ume,n.anchorPointClouds,QE),Wh(n.transform,gs,QE[3],QE)}}updateFading(e,i,r,n){this.isFading&&this._advanceFading(r,n),this._evaluateFading(e,i,r)}_evaluateFading(e,i,r){const n=e.relativeElevation,s=this._calculateDistanceToAnchorPoint(e);if((n>1.7*Pv||n<-Pv||s>Nyt)&&this.opacity>0)this._setFade(Vn.HIDE,r);else if(!this.isFading){if((n>Pv||n<-.35*Pv||s>Dyt)&&this.opacity>0)this._setFade(Vn.FADE_OUT,r);else if(n<=Pv&&n>=-.35*Pv&&i===Vr.IDLE&&Myt(this.data)){if(this.opacity===0)return void this._setFade(Vn.FADE_IN,r);(s>Lyt||this.renderingStage===gy.FADING)&&this._setFade(Vn.CROSS_FADE,r)}}}_advanceFading(e,i){this._switchReadChannels(),this._updateAnchorPoint(),this._advanceFadingFactorAndOpacity(e,i)}_advanceFadingFactorAndOpacity(e,i){if(this.fadeFactor<1)return this.fadeFactor=i?Je((e-this.startTime)/($yt*i),0,1):1,this.fadeMode===Vn.FADE_OUT&&(this.opacity=1-this.fadeFactor),this.fadeMode===Vn.FADE_IN&&(this.opacity=this.fadeFactor),void(this.fadeMode===Vn.CROSS_FADE&&(this.opacity=1));this.fadeFactor=0,this.fadeMode===Vn.FADE_OUT&&(this.opacity=0),this.fadeMode===Vn.FADE_IN&&(this.opacity=1),this.fadeMode===Vn.CROSS_FADE&&(this.opacity=1),this.fadeMode=Vn.NONE}_switchReadChannels(){const e=this.fadeMode===Vn.CROSS_FADE&&this.fadeFactor===1,i=this.fadeMode===Vn.FADE_IN&&this.fadeFactor===0;this.renderingStage===gy.FADING&&(e||i)&&(this.readChannels=1-this.readChannels,this.renderingStage=gy.FINISHED)}_calculateDistanceToAnchorPoint(e){return Ye(this.pointOnGround,e.eye),De(this.pointOnGround,this.pointOnGround,Mr.radius),rt(je(Iyt,this.parallax.anchorPointClouds,this.pointOnGround))}_updateAnchorPoint(){this.fadeMode===Vn.CROSS_FADE&&(this.fadeFactor===0&&Ne(this.parallaxNew.anchorPointClouds,this.pointOnGround),this.fadeFactor===1&&Ne(this.parallax.anchorPointClouds,this.parallaxNew.anchorPointClouds)),this.fadeMode===Vn.FADE_IN&&this.fadeFactor===0&&Ne(this.parallax.anchorPointClouds,this.pointOnGround)}_setFade(e,i){switch(e){case Vn.HIDE:this.opacity=0;break;case Vn.FADE_OUT:this.opacity=1;break;case Vn.FADE_IN:this.opacity=0;break;case Vn.CROSS_FADE:this.opacity=1}this.fadeMode=e,this.fadeFactor=0,this.startTime=i}get isFading(){return this.fadeMode===Vn.FADE_OUT||this.fadeMode===Vn.FADE_IN||this.fadeMode===Vn.CROSS_FADE}};var Vn;(function(t){t[t.NONE=0]="NONE",t[t.HIDE=1]="HIDE",t[t.FADE_OUT=2]="FADE_OUT",t[t.FADE_IN=3]="FADE_IN",t[t.CROSS_FADE=4]="CROSS_FADE"})(Vn||(Vn={}));let zme=class{constructor(){this.anchorPointClouds=W(),this.radiusCurvatureCorrectionFactor=0,this.transform=Qe()}};const Ume=nt(0,0,1),QE=j_(),Iyt=W(),$yt=1.25,Lyt=34e3,Dyt=64e3,Nyt=2e5;let Oy=class extends Ls{constructor(e,i){super(e,"bool",Or.Pass,(r,n,s)=>r.setUniform1b(e,i(n,s)))}},Fyt=class extends Ls{constructor(e,i){super(e,"samplerCube",Or.Pass,(r,n,s)=>r.bindTexture(e,i(n,s)))}};function v$e(t){const e=t.fragment;e.uniforms.add(new _s("rotationMatrixClouds",(i,r)=>r.cloudsFade.parallax.transform),new _s("rotationMatrixCloudsCrossFade",(i,r)=>r.cloudsFade.parallaxNew.transform),new Oi("anchorPosition",(i,r)=>r.cloudsFade.parallax.anchorPointClouds),new Oi("anchorPositionCrossFade",(i,r)=>r.cloudsFade.parallaxNew.anchorPointClouds),new ft("cloudsHeight",()=>Spt),new ft("radiusCurvatureCorrectionFactor",(i,r)=>r.cloudsFade.parallax.radiusCurvatureCorrectionFactor),new ft("totalFadeInOut",(i,r)=>1-r.cloudsFade.opacity),new ft("crossFadeAnchorFactor",(i,r)=>Je(r.cloudsFade.fadeFactor,0,1)),new Fyt("cubeMap",(i,r)=>{var n,s;return((s=(n=r.cloudsFade.data)==null?void 0:n.cubeMap)==null?void 0:s.colorTexture)??null}),new Oy("crossFade",(i,r)=>r.cloudsFade.fadeMode===Vn.CROSS_FADE),new Oy("readChannelsRG",(i,r)=>r.cloudsFade.readChannels===YT.RG),new Oy("fadeTextureChannels",(i,r)=>r.cloudsFade.renderingStage===gy.FADING)),e.constants.add("planetRadius","float",Mr.radius),e.code.add(V`vec3 intersectWithCloudLayer(vec3 dir, vec3 cameraPosition, vec3 spherePos) +const float HALF_PI = 1.570796326794897;`)}var xy,QT;function Cgt(t){return(t==null?void 0:t.cubeMap)!=null}function Agt(t){return t!=null&&!t.running}(function(t){t[t.RENDERING=0]="RENDERING",t[t.FADING=1]="FADING",t[t.FINISHED=2]="FINISHED"})(xy||(xy={})),function(t){t[t.RG=0]="RG",t[t.BA=1]="BA"}(QT||(QT={}));function Y_(t=p$e){return[t[0],t[1],t[2],t[3]]}function ZF(t,e,i=Y_()){return Ne(i,t),i[3]=e,i}function Dme(t,e,i=Y_()){return Wt(i,t,e),Ye(i,i),i[3]=-PEe(t,e),i}function Nme(t,e,i=Y_()){return OL(ZD,t,Wee(t)),OL(Fme,e,Wee(e)),uj(ZD,Fme,ZD),Ogt(i,mu(Uoe(i,ZD)))}function Uri(t,e,i,r=Y_()){return ZF(CEe,t,JD),ZF(AEe,e,kme),ZF(pB,i,zme),Nme(JD,kme,JD),Nme(JD,zme,r),r}function Vri(t){return t}function Mgt(t){return t[3]}function Wee(t){return Ei(t[3])}function Ogt(t,e){return t[3]=e,t}const p$e=[0,0,1,0],ZD=Rp(),Fme=Rp();Y_();const JD=Y_(),kme=Y_(),zme=Y_();let Pgt=class{constructor(){this.readChannels=QT.RG,this.renderingStage=xy.FINISHED,this.startTime=0,this.startTimeHeightFade=0,this.cameraPositionLastFrame=W(),this.parallax=new Ume,this.parallaxNew=new Ume,this.pointOnGround=W(),this.fadeMode=Vn.HIDE,this.fadeFactor=0,this.opacity=0}updateParallax(e){const i=this.parallax,r=nt(e.eye);if(i.radiusCurvatureCorrectionFactor=.84*Math.sqrt(Math.max(r*r-Or.radius*Or.radius,0))/r,Dme(Vme,i.anchorPointClouds,sC),Zh(i.transform,gs,sC[3],sC),this.fadeMode===Vn.CROSS_FADE){const n=this.parallaxNew;Dme(Vme,n.anchorPointClouds,sC),Zh(n.transform,gs,sC[3],sC)}}updateFading(e,i,r,n){this.isFading&&this._advanceFading(r,n),this._evaluateFading(e,i,r)}_evaluateFading(e,i,r){const n=e.relativeElevation,s=this._calculateDistanceToAnchorPoint(e);if((n>1.7*kv||n<-kv||s>Dgt)&&this.opacity>0)this._setFade(Vn.HIDE,r);else if(!this.isFading){if((n>kv||n<-.35*kv||s>Lgt)&&this.opacity>0)this._setFade(Vn.FADE_OUT,r);else if(n<=kv&&n>=-.35*kv&&i===Vr.IDLE&&Agt(this.data)){if(this.opacity===0)return void this._setFade(Vn.FADE_IN,r);(s>$gt||this.renderingStage===xy.FADING)&&this._setFade(Vn.CROSS_FADE,r)}}}_advanceFading(e,i){this._switchReadChannels(),this._updateAnchorPoint(),this._advanceFadingFactorAndOpacity(e,i)}_advanceFadingFactorAndOpacity(e,i){if(this.fadeFactor<1)return this.fadeFactor=i?Je((e-this.startTime)/(Igt*i),0,1):1,this.fadeMode===Vn.FADE_OUT&&(this.opacity=1-this.fadeFactor),this.fadeMode===Vn.FADE_IN&&(this.opacity=this.fadeFactor),void(this.fadeMode===Vn.CROSS_FADE&&(this.opacity=1));this.fadeFactor=0,this.fadeMode===Vn.FADE_OUT&&(this.opacity=0),this.fadeMode===Vn.FADE_IN&&(this.opacity=1),this.fadeMode===Vn.CROSS_FADE&&(this.opacity=1),this.fadeMode=Vn.NONE}_switchReadChannels(){const e=this.fadeMode===Vn.CROSS_FADE&&this.fadeFactor===1,i=this.fadeMode===Vn.FADE_IN&&this.fadeFactor===0;this.renderingStage===xy.FADING&&(e||i)&&(this.readChannels=1-this.readChannels,this.renderingStage=xy.FINISHED)}_calculateDistanceToAnchorPoint(e){return Ye(this.pointOnGround,e.eye),De(this.pointOnGround,this.pointOnGround,Or.radius),nt(je(Rgt,this.parallax.anchorPointClouds,this.pointOnGround))}_updateAnchorPoint(){this.fadeMode===Vn.CROSS_FADE&&(this.fadeFactor===0&&Ne(this.parallaxNew.anchorPointClouds,this.pointOnGround),this.fadeFactor===1&&Ne(this.parallax.anchorPointClouds,this.parallaxNew.anchorPointClouds)),this.fadeMode===Vn.FADE_IN&&this.fadeFactor===0&&Ne(this.parallax.anchorPointClouds,this.pointOnGround)}_setFade(e,i){switch(e){case Vn.HIDE:this.opacity=0;break;case Vn.FADE_OUT:this.opacity=1;break;case Vn.FADE_IN:this.opacity=0;break;case Vn.CROSS_FADE:this.opacity=1}this.fadeMode=e,this.fadeFactor=0,this.startTime=i}get isFading(){return this.fadeMode===Vn.FADE_OUT||this.fadeMode===Vn.FADE_IN||this.fadeMode===Vn.CROSS_FADE}};var Vn;(function(t){t[t.NONE=0]="NONE",t[t.HIDE=1]="HIDE",t[t.FADE_OUT=2]="FADE_OUT",t[t.FADE_IN=3]="FADE_IN",t[t.CROSS_FADE=4]="CROSS_FADE"})(Vn||(Vn={}));let Ume=class{constructor(){this.anchorPointClouds=W(),this.radiusCurvatureCorrectionFactor=0,this.transform=Qe()}};const Vme=st(0,0,1),sC=Y_(),Rgt=W(),Igt=1.25,$gt=34e3,Lgt=64e3,Dgt=2e5;let Dy=class extends Ds{constructor(e,i){super(e,"bool",Pr.Pass,(r,n,s)=>r.setUniform1b(e,i(n,s)))}},Ngt=class extends Ds{constructor(e,i){super(e,"samplerCube",Pr.Pass,(r,n,s)=>r.bindTexture(e,i(n,s)))}};function f$e(t){const e=t.fragment;e.uniforms.add(new bs("rotationMatrixClouds",(i,r)=>r.cloudsFade.parallax.transform),new bs("rotationMatrixCloudsCrossFade",(i,r)=>r.cloudsFade.parallaxNew.transform),new Oi("anchorPosition",(i,r)=>r.cloudsFade.parallax.anchorPointClouds),new Oi("anchorPositionCrossFade",(i,r)=>r.cloudsFade.parallaxNew.anchorPointClouds),new ft("cloudsHeight",()=>hht),new ft("radiusCurvatureCorrectionFactor",(i,r)=>r.cloudsFade.parallax.radiusCurvatureCorrectionFactor),new ft("totalFadeInOut",(i,r)=>1-r.cloudsFade.opacity),new ft("crossFadeAnchorFactor",(i,r)=>Je(r.cloudsFade.fadeFactor,0,1)),new Ngt("cubeMap",(i,r)=>{var n,s;return((s=(n=r.cloudsFade.data)==null?void 0:n.cubeMap)==null?void 0:s.colorTexture)??null}),new Dy("crossFade",(i,r)=>r.cloudsFade.fadeMode===Vn.CROSS_FADE),new Dy("readChannelsRG",(i,r)=>r.cloudsFade.readChannels===QT.RG),new Dy("fadeTextureChannels",(i,r)=>r.cloudsFade.renderingStage===xy.FADING)),e.constants.add("planetRadius","float",Or.radius),e.code.add(V`vec3 intersectWithCloudLayer(vec3 dir, vec3 cameraPosition, vec3 spherePos) { float radiusClouds = planetRadius + cloudsHeight; float B = 2.0 * dot(cameraPosition, dir); @@ -474,7 +463,7 @@ return dir; }`),e.code.add(V`vec3 rotateDirectionToAnchorPoint(mat4 rotMat, vec3 inVec) { return (rotMat * vec4(inVec, 0.0)).xyz; -}`),B_(e),a1(e),e.code.add(V`const float SUNSET_TRANSITION_FACTOR = 0.3; +}`),W_(e),m1(e),e.code.add(V`const float SUNSET_TRANSITION_FACTOR = 0.3; const vec3 RIM_COLOR = vec3(0.28, 0.175, 0.035); const float RIM_SCATTERING_FACTOR = 140.0; const float BACKLIGHT_FACTOR = 0.2; @@ -540,7 +529,7 @@ return vec4(cloudColor.rgb, totalTransmittance); }`),e.code.add(V`vec4 renderClouds(vec3 worldRay, vec3 cameraPosition) { return crossFade ? renderCloudsCrossFade(worldRay, cameraPosition) : renderCloudsNoFade(worldRay, cameraPosition); -}`)}function h1(t){t.code.add(V`vec4 premultiplyAlpha(vec4 v) { +}`)}function _1(t){t.code.add(V`vec4 premultiplyAlpha(vec4 v) { return vec4(v.rgb * v.a, v.a); } vec3 rgb2hsv(vec3 c) { @@ -558,15 +547,15 @@ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } float rgb2v(vec3 c) { return max(c.x, max(c.y, c.z)); -}`)}function _$e(){const t=new Cr,{attributes:e,varyings:i,vertex:r,fragment:n}=t;return e.add(J.POSITION,"vec2"),i.add("worldRay","vec3"),r.uniforms.add(new _s("inverseProjectionMatrix",(s,o)=>o.camera.inverseProjectionMatrix),new _s("inverseViewMatrix",(s,o)=>sP(kyt,o.camera.viewMatrix))),r.code.add(V`void main(void) { +}`)}function m$e(){const t=new Ar,{attributes:e,varyings:i,vertex:r,fragment:n}=t;return e.add(J.POSITION,"vec2"),i.add("worldRay","vec3"),r.uniforms.add(new bs("inverseProjectionMatrix",(s,o)=>o.camera.inverseProjectionMatrix),new bs("inverseViewMatrix",(s,o)=>u5(Fgt,o.camera.viewMatrix))),r.code.add(V`void main(void) { vec3 posViewNear = (inverseProjectionMatrix * vec4(position, -1.0, 1.0)).xyz; worldRay = (inverseViewMatrix * vec4(posViewNear, 0.0)).xyz; gl_Position = vec4(position, 1.0, 1.0); -}`),n.include(h1),n.include(o0),t.include(Sae,{pbrMode:ei.Disabled,lightingSphericalHarmonicsOrder:2}),t.include(q9),t.include(Aj),t.include(yU),t.include(v$e),n.uniforms.add(new Oi("cameraPosition",(s,o)=>o.camera.eye)),n.code.add(V`void main() { +}`),n.include(_1),n.include(c0),t.include(Nae,{pbrMode:ti.Disabled,lightingSphericalHarmonicsOrder:2}),t.include(J9),t.include(Fj),t.include(vU),t.include(f$e),n.uniforms.add(new Oi("cameraPosition",(s,o)=>o.camera.eye)),n.code.add(V`void main() { vec4 cloudsColor = renderClouds(normalize(worldRay), cameraPosition); fragColor = vec4((1.0 - totalFadeInOut) * cloudsColor.rgb, cloudsColor.a); -}`),t}const kyt=Qe(),zyt=Object.freeze(Object.defineProperty({__proto__:null,build:_$e},Symbol.toStringTag,{value:"Module"}));let b$e=class w$e extends Hr{constructor(e){super(e,new nh,()=>this.destroy())}initializeProgram(e){return new Ir(e.rctx,w$e.shader.get().build(),Er)}initializePipeline(){return Ti({blending:Ol(st.ONE,st.ZERO,st.SRC_ALPHA,st.ONE),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};b$e.shader=new Rr(zyt,()=>we(()=>Promise.resolve().then(()=>fWt),void 0));let W3=class extends ze{constructor(e){super(e),this._technique=new b$e(e),this._vao=u1(e.rctx)}destroy(){this._technique=ir(this._technique),this._vao=Kt(this._vao)}render(e){if(!this._technique.compiled)return void this.requestRender();const i=e.bindParameters.cloudsFade;if(this._vao==null||i.data==null)return;const r=e.rctx.bindTechnique(this._technique,Uyt,e.bindParameters);e.rctx.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),e.rctx.drawArrays(sr.TRIANGLE_STRIP,0,4)}};y([w({constructOnly:!0})],W3.prototype,"rctx",void 0),y([w({constructOnly:!0})],W3.prototype,"viewingMode",void 0),y([w({constructOnly:!0})],W3.prototype,"planetRadius",void 0),y([w({constructOnly:!0})],W3.prototype,"requestRender",void 0),W3=y([Z("esri.views.3d.environment.CloudsComposition")],W3);const Uyt=new _n;function Bs(){return new Float32Array(3)}function Uee(t){const e=new Float32Array(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function pn(t,e,i){const r=new Float32Array(3);return r[0]=t,r[1]=e,r[2]=i,r}function Vyt(t,e){return new Float32Array(t,e,3)}function Tae(){return Bs()}function x$e(){return pn(1,1,1)}function S$e(){return pn(1,0,0)}function T$e(){return pn(0,1,0)}function E$e(){return pn(0,0,1)}const Byt=Tae(),jyt=x$e(),Gyt=S$e(),Hyt=T$e(),qyt=E$e();Object.freeze(Object.defineProperty({__proto__:null,ONES:jyt,UNIT_X:Gyt,UNIT_Y:Hyt,UNIT_Z:qyt,ZEROS:Byt,clone:Uee,create:Bs,createView:Vyt,fromValues:pn,ones:x$e,unitX:S$e,unitY:T$e,unitZ:E$e,zeros:Tae},Symbol.toStringTag,{value:"Module"}));var Wu;(function(t){t[t.SIXTEEN=0]="SIXTEEN",t[t.HUNDRED=1]="HUNDRED",t[t.TWOHUNDRED=2]="TWOHUNDRED",t[t.COUNT=3]="COUNT"})(Wu||(Wu={}));let VF=class extends nh{constructor(){super(...arguments),this.steps=Wu.SIXTEEN,this.writeTextureChannels=YT.RG}};y([fe({count:Wu.COUNT})],VF.prototype,"steps",void 0),y([fe({constValue:Le("esri-mobile")?1024:2048})],VF.prototype,"cubeMapSize",void 0),y([fe()],VF.prototype,"writeTextureChannels",void 0);let sI=class{constructor(e,i,r,n,s,o,l,c,f=.5){this.coverage=e,this.density=i,this.absorption=r,this.cloudSize=n,this.detailSize=s,this.smoothness=o,this.cloudHeight=l,this.raymarchingSteps=c,this.median=f}};const Vme=new sI([0,.6],[.03,.03],[0,0],[.9,.9],[.8,.8],[.7,.7],[.05,.05],Wu.SIXTEEN),cc={sunny:Vme,cloudy:new sI([.3,.65],[.2,.4],[0,0],[.85,.85],[.75,.75],[.3,.4],[1,1],Wu.TWOHUNDRED,.6),rainy:new sI([.6,.8],[.5,.8],[.1,.5],[.9,.9],[.75,.75],[.5,.5],[1,1],Wu.TWOHUNDRED,.4),snowy:new sI([.25,.75],[.3,.3],[0,0],[.95,.95],[.7,.7],[.69,.75],[.3,1],Wu.HUNDRED,.65),foggy:new sI([.8,.8],[.5,.5],[0,0],[.95,.95],[.9,.9],[.55,.55],[.3,.3],Wu.SIXTEEN),default:Vme},pf=Le("esri-mobile")?64:128,Wyt=pf/128,Q0=Math.ceil(Math.sqrt(pf)),v2=(pf+2)*Q0,Yyt=1e5,fq=128,Xyt=v2/1560;let ML=class extends Ls{constructor(e,i){super(e,"mat3",Or.Draw,(r,n,s)=>r.setUniformMatrix3fv(e,i(n,s)))}},Eae=class extends _n{constructor(){super(...arguments),this.cloudRadius=0,this.cloudSize=0,this.detailSize=0,this.absorption=0,this.density=0,this.smoothness=0,this.cloudHeight=0,this.coverage=0,this.raymarchingSteps=cc.default.raymarchingSteps,this.weatherTile=yt()}},Cae=class extends _n{constructor(){super(...arguments),this.viewMatrix=as()}};function C$e(t){const e=new Cr;e.include(Pc,!1);const i=e.fragment;return i.uniforms.add(new ft("cloudRadius",r=>r.cloudRadius),new ft("power",r=>ui(35,120,r.absorption)),new ft("sigmaE",r=>1+r.absorption),new ft("density",r=>ui(0,.3,r.density)),new ft("cloudSize",r=>ui(0,.02,Math.max(.01,1-r.cloudSize))),new ft("detailSize",r=>ui(0,.2,Math.max(.01,1-r.detailSize))),new ft("smoothness",r=>ui(0,.5,1-r.smoothness)),new ft("cloudHeight",r=>ui(0,1500,r.cloudHeight)),new ft("coverage",r=>r.coverage),new ML("view",r=>r.viewMatrix),new Zt("cloudShapeTexture",r=>r.noiseTexture!=null?r.noiseTexture.textureAtlas:null),new ln("cloudVariables",r=>or(Zyt,r.coverage,r.absorption))),i.constants.add("halfCubeMapSize","float",.5*t.cubeMapSize),i.code.add(V` - const int STEPS = ${t.steps===Wu.SIXTEEN?V`16`:t.steps===Wu.HUNDRED?V`100`:V`200`}; +}`),t}const Fgt=Qe(),kgt=Object.freeze(Object.defineProperty({__proto__:null,build:m$e},Symbol.toStringTag,{value:"Module"}));let g$e=class y$e extends Hr{constructor(e){super(e,new oh,()=>this.destroy())}initializeProgram(e){return new $r(e.rctx,y$e.shader.get().build(),Cr)}initializePipeline(){return Ti({blending:Pl(ot.ONE,ot.ZERO,ot.SRC_ALPHA,ot.ONE),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};g$e.shader=new Ir(kgt,()=>we(()=>Promise.resolve().then(()=>ZYt),void 0));let Q3=class extends ze{constructor(e){super(e),this._technique=new g$e(e),this._vao=v1(e.rctx)}destroy(){this._technique=ir(this._technique),this._vao=Kt(this._vao)}render(e){if(!this._technique.compiled)return void this.requestRender();const i=e.bindParameters.cloudsFade;if(this._vao==null||i.data==null)return;const r=e.rctx.bindTechnique(this._technique,zgt,e.bindParameters);e.rctx.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),e.rctx.drawArrays(sr.TRIANGLE_STRIP,0,4)}};y([w({constructOnly:!0})],Q3.prototype,"rctx",void 0),y([w({constructOnly:!0})],Q3.prototype,"viewingMode",void 0),y([w({constructOnly:!0})],Q3.prototype,"planetRadius",void 0),y([w({constructOnly:!0})],Q3.prototype,"requestRender",void 0),Q3=y([Z("esri.views.3d.environment.CloudsComposition")],Q3);const zgt=new bn;function js(){return new Float32Array(3)}function Yee(t){const e=new Float32Array(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function mn(t,e,i){const r=new Float32Array(3);return r[0]=t,r[1]=e,r[2]=i,r}function Ugt(t,e){return new Float32Array(t,e,3)}function Fae(){return js()}function v$e(){return mn(1,1,1)}function _$e(){return mn(1,0,0)}function b$e(){return mn(0,1,0)}function w$e(){return mn(0,0,1)}const Vgt=Fae(),Bgt=v$e(),jgt=_$e(),Ggt=b$e(),Hgt=w$e();Object.freeze(Object.defineProperty({__proto__:null,ONES:Bgt,UNIT_X:jgt,UNIT_Y:Ggt,UNIT_Z:Hgt,ZEROS:Vgt,clone:Yee,create:js,createView:Ugt,fromValues:mn,ones:v$e,unitX:_$e,unitY:b$e,unitZ:w$e,zeros:Fae},Symbol.toStringTag,{value:"Module"}));var Xu;(function(t){t[t.SIXTEEN=0]="SIXTEEN",t[t.HUNDRED=1]="HUNDRED",t[t.TWOHUNDRED=2]="TWOHUNDRED",t[t.COUNT=3]="COUNT"})(Xu||(Xu={}));let JF=class extends oh{constructor(){super(...arguments),this.steps=Xu.SIXTEEN,this.writeTextureChannels=QT.RG}};y([fe({count:Xu.COUNT})],JF.prototype,"steps",void 0),y([fe({constValue:$e("esri-mobile")?1024:2048})],JF.prototype,"cubeMapSize",void 0),y([fe()],JF.prototype,"writeTextureChannels",void 0);let g4=class{constructor(e,i,r,n,s,o,a,c,p=.5){this.coverage=e,this.density=i,this.absorption=r,this.cloudSize=n,this.detailSize=s,this.smoothness=o,this.cloudHeight=a,this.raymarchingSteps=c,this.median=p}};const Bme=new g4([0,.6],[.03,.03],[0,0],[.9,.9],[.8,.8],[.7,.7],[.05,.05],Xu.SIXTEEN),dc={sunny:Bme,cloudy:new g4([.3,.65],[.2,.4],[0,0],[.85,.85],[.75,.75],[.3,.4],[1,1],Xu.TWOHUNDRED,.6),rainy:new g4([.6,.8],[.5,.8],[.1,.5],[.9,.9],[.75,.75],[.5,.5],[1,1],Xu.TWOHUNDRED,.4),snowy:new g4([.25,.75],[.3,.3],[0,0],[.95,.95],[.7,.7],[.69,.75],[.3,1],Xu.HUNDRED,.65),foggy:new g4([.8,.8],[.5,.5],[0,0],[.95,.95],[.9,.9],[.55,.55],[.3,.3],Xu.SIXTEEN),default:Bme},vf=$e("esri-mobile")?64:128,qgt=vf/128,im=Math.ceil(Math.sqrt(vf)),T2=(vf+2)*im,Wgt=1e5,Tq=128,Ygt=T2/1560;let FL=class extends Ds{constructor(e,i){super(e,"mat3",Pr.Draw,(r,n,s)=>r.setUniformMatrix3fv(e,i(n,s)))}},kae=class extends bn{constructor(){super(...arguments),this.cloudRadius=0,this.cloudSize=0,this.detailSize=0,this.absorption=0,this.density=0,this.smoothness=0,this.cloudHeight=0,this.coverage=0,this.raymarchingSteps=dc.default.raymarchingSteps,this.weatherTile=yt()}},zae=class extends bn{constructor(){super(...arguments),this.viewMatrix=as()}};function x$e(t){const e=new Ar;e.include($c,!1);const i=e.fragment;return i.uniforms.add(new ft("cloudRadius",r=>r.cloudRadius),new ft("power",r=>ui(35,120,r.absorption)),new ft("sigmaE",r=>1+r.absorption),new ft("density",r=>ui(0,.3,r.density)),new ft("cloudSize",r=>ui(0,.02,Math.max(.01,1-r.cloudSize))),new ft("detailSize",r=>ui(0,.2,Math.max(.01,1-r.detailSize))),new ft("smoothness",r=>ui(0,.5,1-r.smoothness)),new ft("cloudHeight",r=>ui(0,1500,r.cloudHeight)),new ft("coverage",r=>r.coverage),new FL("view",r=>r.viewMatrix),new Zt("cloudShapeTexture",r=>r.noiseTexture!=null?r.noiseTexture.textureAtlas:null),new cn("cloudVariables",r=>or(Xgt,r.coverage,r.absorption))),i.constants.add("halfCubeMapSize","float",.5*t.cubeMapSize),i.code.add(V` + const int STEPS = ${t.steps===Xu.SIXTEEN?V`16`:t.steps===Xu.HUNDRED?V`100`:V`200`}; const int STEPS_LIGHT = 6; const float stepL = 300.0 / float(STEPS_LIGHT); const float cloudStart = 1500.0; @@ -584,13 +573,13 @@ fragColor = vec4((1.0 - totalFadeInOut) * cloudsColor.rgb, cloudsColor.a); return clamp(x, 0.0, 1.0); }`),i.code.add(V` float getCloudShape(vec3 pos, float pOffset) { - const float textureWidth = ${V.float(v2)}; - const float dataWidth = ${V.float(v2)}; - const float tileRows = ${V.float(Q0)}; - const vec3 atlasDimensions = vec3(${V.float(pf)}, ${V.float(pf)}, tileRows * tileRows); + const float textureWidth = ${V.float(T2)}; + const float dataWidth = ${V.float(T2)}; + const float tileRows = ${V.float(im)}; + const vec3 atlasDimensions = vec3(${V.float(vf)}, ${V.float(vf)}, tileRows * tileRows); //Change from Y being height to Z being height - vec3 p = float(${V.float(Wyt)}) * pos.xzy; + vec3 p = float(${V.float(qgt)}) * pos.xzy; //Pixel coordinates of point in the 3D data vec3 coord = vec3(mod(p - pOffset * atlasDimensions, atlasDimensions)); @@ -609,7 +598,7 @@ fragColor = vec4((1.0 - totalFadeInOut) * cloudsColor.rgb, cloudsColor.a); float getCloudMap(vec2 p){ // Shift the texture center to origin to avoid seam artifacts - vec2 uv = (${V.float(Xyt)} * p) / ${V.float(v2)} + 0.5; + vec2 uv = (${V.float(Ygt)} * p) / ${V.float(T2)} + 0.5; return texture(cloudShapeTexture, uv).a; } @@ -728,9 +717,9 @@ shading = 0.5 * mainRay(viewPos, rayDir, sunDirection, distToStart, totalDistanc shading = mix(clamp(1.0 - cloudVariables.y, 0.6, 1.0), shading, hazeFactor); totalTransmittance = mix(0.0, totalTransmittance, hazeFactor); fragColor = vec4(shading, totalTransmittance, shading, totalTransmittance); -}`),e}const Zyt=yt(),Jyt=Object.freeze(Object.defineProperty({__proto__:null,CloudsDrawParameters:Cae,CloudsPassParameters:Eae,build:C$e},Symbol.toStringTag,{value:"Module"}));let A$e=class M$e extends Hr{constructor(e,i){super(e,i,()=>this.destroy())}initializeProgram(e){return new Ir(e.rctx,M$e.shader.get().build(this.configuration),Er)}initializePipeline(){return Ti({blending:hd(st.CONSTANT_COLOR,st.ONE_MINUS_CONSTANT_COLOR,Xy.ADD,this.configuration.writeTextureChannels===YT.RG?[1,1,0,0]:[0,0,1,1]),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};A$e.shader=new Rr(Jyt,()=>we(()=>Promise.resolve().then(()=>mWt),void 0));var np;(function(t){t[t.Full=0]="Full",t[t.WeatherMap=1]="WeatherMap",t[t.COUNT=2]="COUNT"})(np||(np={}));let Vee=class extends nh{constructor(){super(...arguments),this.mode=np.Full}};y([fe({count:np.COUNT})],Vee.prototype,"mode",void 0);let Aae=class extends _n{constructor(){super(...arguments),this.weatherTile=Ji(0,0)}};function O$e(t){const e=new Cr;return e.include(Pc,!1),e.fragment.code.add(V`float remap(float x, float low1, float high1, float low2, float high2) { +}`),e}const Xgt=yt(),Zgt=Object.freeze(Object.defineProperty({__proto__:null,CloudsDrawParameters:zae,CloudsPassParameters:kae,build:x$e},Symbol.toStringTag,{value:"Module"}));let S$e=class T$e extends Hr{constructor(e,i){super(e,i,()=>this.destroy())}initializeProgram(e){return new $r(e.rctx,T$e.shader.get().build(this.configuration),Cr)}initializePipeline(){return Ti({blending:md(ot.CONSTANT_COLOR,ot.ONE_MINUS_CONSTANT_COLOR,i1.ADD,this.configuration.writeTextureChannels===QT.RG?[1,1,0,0]:[0,0,1,1]),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};S$e.shader=new Ir(Zgt,()=>we(()=>Promise.resolve().then(()=>JYt),void 0));var lp;(function(t){t[t.Full=0]="Full",t[t.WeatherMap=1]="WeatherMap",t[t.COUNT=2]="COUNT"})(lp||(lp={}));let Xee=class extends oh{constructor(){super(...arguments),this.mode=lp.Full}};y([fe({count:lp.COUNT})],Xee.prototype,"mode",void 0);let Uae=class extends bn{constructor(){super(...arguments),this.weatherTile=Ji(0,0)}};function E$e(t){const e=new Ar;return e.include($c,!1),e.fragment.code.add(V`float remap(float x, float low1, float high1, float low2, float high2) { return low2 + (x - low1) * (high2 - low2) / (high1 - low1); -}`),t.mode===np.Full&&e.fragment.code.add(V` +}`),t.mode===lp.Full&&e.fragment.code.add(V` float saturate(float x) { return clamp(x, 0.0, 1.0); } @@ -812,7 +801,7 @@ return low2 + (x - low1) * (high2 - low2) / (high1 - low1); vec3 get3Dfrom2D(vec2 uv) { vec2 tile = floor(uv); - float z = floor(${V.float(Q0)} * tile.y + tile.x); + float z = floor(${V.float(im)} * tile.y + tile.x); return vec3(fract(uv), z); } @@ -839,20 +828,20 @@ return low2 + (x - low1) * (high2 - low2) / (high1 - low1); return FBM0 * 0.625 + FBM1 * 0.25 + FBM2 * 0.125; } - `),e.fragment.uniforms.add(new ln("weatherTile",i=>i.weatherTile)),e.fragment.code.add(V` + `),e.fragment.uniforms.add(new cn("weatherTile",i=>i.weatherTile)),e.fragment.code.add(V` vec2 modulo(vec2 m, float n){ return mod(mod(m, n) + n, n); } vec2 hash(vec2 p){ // Get position of p in weather tile - p = modulo(p, ${V.float(fq)}); + p = modulo(p, ${V.float(Tq)}); // Get global coordinates of p - p += weatherTile * ${V.float(fq)}; + p += weatherTile * ${V.float(Tq)}; // Limit position to avoid numerical instability - p = modulo(p, ${V.float(Yyt)}); + p = modulo(p, ${V.float(Wgt)}); vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973)); p3 += dot(p3, p3.yzx + 33.33); @@ -889,10 +878,10 @@ return low2 + (x - low1) * (high2 - low2) / (high1 - low1); } return 1.0 - clamp(d, 0.0, 1.0); } - `),e.fragment.code.add(V`void main() {`),t.mode===np.Full&&e.fragment.code.add(V` + `),e.fragment.code.add(V`void main() {`),t.mode===lp.Full&&e.fragment.code.add(V` float padWidth = 1.0; - float paddedSize = ${V.float(pf)} + 2.0 * padWidth; - float tileCount = ${V.float(Q0)} * ${V.float(Q0)}; + float paddedSize = ${V.float(vf)} + 2.0 * padWidth; + float tileCount = ${V.float(im)} * ${V.float(im)}; vec2 tile = floor((gl_FragCoord.xy - 0.5) / paddedSize); bool padCell = false; @@ -932,55 +921,55 @@ return low2 + (x - low1) * (high2 - low2) / (high1 - low1); vec2 pixel = gl_FragCoord.xy - padWidth - padding; if (startPadX) { - pixel.x += ${V.float(pf)}; + pixel.x += ${V.float(vf)}; } if (startPadY) { - pixel.y += ${V.float(pf)}; + pixel.y += ${V.float(vf)}; } if (endPadX) { - pixel.x -= ${V.float(pf)}; + pixel.x -= ${V.float(vf)}; } if (endPadY) { - pixel.y -= ${V.float(pf)}; + pixel.y -= ${V.float(vf)}; } - uv = vec2(pixel.xy / ${V.float(pf)}); + uv = vec2(pixel.xy / ${V.float(vf)}); } else { vec2 pixel = gl_FragCoord.xy - padWidth - padding; - uv = vec2(pixel.xy / ${V.float(pf)}); + uv = vec2(pixel.xy / ${V.float(vf)}); } vec3 p_ = get3Dfrom2D(uv); vec3 p = p_; - p.z /= (${V.float(Q0)} * ${V.float(Q0)}); + p.z /= (${V.float(im)} * ${V.float(im)}); float worleyPerlinNoise = getTextureForPointPerlinWorley(p); float worleyNoise = getTextureForPointWorley(p); fragColor.r = saturate(remap(worleyPerlinNoise, worleyNoise, 1.0, 0.0, 1.0)); - p_ = mod(p_ + 1.0, ${V.float(Q0)} * ${V.float(Q0)}); + p_ = mod(p_ + 1.0, ${V.float(im)} * ${V.float(im)}); p = p_; - p.z /= (${V.float(Q0)} * ${V.float(Q0)}); + p.z /= (${V.float(im)} * ${V.float(im)}); worleyPerlinNoise = getTextureForPointPerlinWorley(p); worleyNoise = getTextureForPointWorley(p); fragColor.g = saturate(remap(worleyPerlinNoise, worleyNoise, 1.0, 0.0, 1.0)); `),e.fragment.code.add(V` - vec2 mapUV = ${V.float(fq)} * (gl_FragCoord.xy / ${V.float(v2)}); + vec2 mapUV = ${V.float(Tq)} * (gl_FragCoord.xy / ${V.float(T2)}); float map = abs(gradientNoise(mapUV)); map = remap(map, 0.25 * (1.0 - worley(8.0 * mapUV)), 1.0, 0.0, 1.0); - ${t.mode===np.Full?V`fragColor.ba = vec2(0.0, map);`:V`fragColor = vec4(map);`}; + ${t.mode===lp.Full?V`fragColor.ba = vec2(0.0, map);`:V`fragColor = vec4(map);`}; } - `),e}const Kyt=Object.freeze(Object.defineProperty({__proto__:null,NoiseTextureAtlasPassParameters:Aae,build:O$e},Symbol.toStringTag,{value:"Module"}));let Bee=class P$e extends Hr{initializeProgram(e){return new Ir(e.rctx,P$e.shader.get().build(this.configuration),Er)}initializePipeline(){return Ti({blending:this.configuration.mode===np.Full?hd(st.ONE,st.ZERO):Ol(st.ZERO,st.ONE,st.ONE,st.ZERO),depthTest:{func:Zr.ALWAYS},colorWrite:ji})}};Bee.shader=new Rr(Kyt,()=>we(()=>Promise.resolve().then(()=>gWt),void 0));let oI=class extends ze{constructor(e){super(e),this._needsRender=!0,this._passParameters=new Aae,this._frameBuffer=new Hm(e.context.renderContext.rctx,new tn(v2)),this._vao=u1(e.context.renderContext.rctx)}get _techniqueRepository(){return this.context.techniqueRepository}get textureAtlas(){return this._texture!=null?this._weatherMapTechnique!=null&&this._weatherMapTechnique.compiled&&this._needsRender&&(this._texture=this._render(np.WeatherMap)):this._fullTechnique!=null&&this._fullTechnique.compiled&&(this._texture=this._render(np.Full)),this._texture}_setDirty(){this._needsRender=!0}updateWeatherMap(e){this._passParameters.weatherTile[0]===e[0]&&this._passParameters.weatherTile[1]===e[1]||(Qo(this._passParameters.weatherTile,e),this._setDirty())}destroy(){this._fullTechniqueCached=ir(this._fullTechniqueCached),this._weatherMapTechniqueCached=ir(this._weatherMapTechniqueCached),this._frameBuffer=Kt(this._frameBuffer),this._vao=Kt(this._vao)}get _fullTechnique(){if(this._fullTechniqueCached==null){const e=new Vee;e.mode=np.Full,this._fullTechniqueCached=this._techniqueRepository.acquire(Bee,e)}return this._fullTechniqueCached}get _weatherMapTechnique(){if(this._weatherMapTechniqueCached==null){const e=new Vee;e.mode=np.WeatherMap,this._weatherMapTechniqueCached=this._techniqueRepository.acquire(Bee,e)}return this._weatherMapTechniqueCached}_render(e){if(this._vao==null||this._frameBuffer==null)return null;const i=e===np.Full?this._fullTechnique:this._weatherMapTechnique,r=this.context.renderContext.rctx,n=r.getViewport();r.setViewport(0,0,v2,v2),r.bindFramebuffer(this._frameBuffer);const s=r.bindTechnique(i,this._passParameters,null);return r.bindVAO(this._vao),s.assertCompatibleVertexAttributeLocations(this._vao),r.gl.drawArrays(r.gl.TRIANGLE_STRIP,0,4),r.setViewport(n.x,n.y,n.width,n.height),this._needsRender=!1,this._frameBuffer.colorTexture}};y([w({constructOnly:!0})],oI.prototype,"context",void 0),y([w({readOnly:!0})],oI.prototype,"_techniqueRepository",null),oI=y([Z("esri.views.3d.environment.NoiseTextureAtlas")],oI);var Ih;(function(t){t[t.Occluded=0]="Occluded",t[t.NotOccluded=1]="NotOccluded",t[t.Both=2]="Both",t[t.COUNT=3]="COUNT"})(Ih||(Ih={}));function R$e(t){t.include(Kf),t.uniforms.add(new Zt("geometryDepthTexture",(e,i)=>{var r;return(r=i.multipassGeometry.linearDepth)==null?void 0:r.colorTexture}),new ln("nearFar",(e,i)=>i.camera.nearFar)),t.code.add(V`bool geometryDepthTest(vec2 pos, float elementDepth) { + `),e}const Jgt=Object.freeze(Object.defineProperty({__proto__:null,NoiseTextureAtlasPassParameters:Uae,build:E$e},Symbol.toStringTag,{value:"Module"}));let Zee=class C$e extends Hr{initializeProgram(e){return new $r(e.rctx,C$e.shader.get().build(this.configuration),Cr)}initializePipeline(){return Ti({blending:this.configuration.mode===lp.Full?md(ot.ONE,ot.ZERO):Pl(ot.ZERO,ot.ONE,ot.ONE,ot.ZERO),depthTest:{func:Zr.ALWAYS},colorWrite:ji})}};Zee.shader=new Ir(Jgt,()=>we(()=>Promise.resolve().then(()=>KYt),void 0));let y4=class extends ze{constructor(e){super(e),this._needsRender=!0,this._passParameters=new Uae,this._frameBuffer=new Zm(e.context.renderContext.rctx,new rn(T2)),this._vao=v1(e.context.renderContext.rctx)}get _techniqueRepository(){return this.context.techniqueRepository}get textureAtlas(){return this._texture!=null?this._weatherMapTechnique!=null&&this._weatherMapTechnique.compiled&&this._needsRender&&(this._texture=this._render(lp.WeatherMap)):this._fullTechnique!=null&&this._fullTechnique.compiled&&(this._texture=this._render(lp.Full)),this._texture}_setDirty(){this._needsRender=!0}updateWeatherMap(e){this._passParameters.weatherTile[0]===e[0]&&this._passParameters.weatherTile[1]===e[1]||(ea(this._passParameters.weatherTile,e),this._setDirty())}destroy(){this._fullTechniqueCached=ir(this._fullTechniqueCached),this._weatherMapTechniqueCached=ir(this._weatherMapTechniqueCached),this._frameBuffer=Kt(this._frameBuffer),this._vao=Kt(this._vao)}get _fullTechnique(){if(this._fullTechniqueCached==null){const e=new Xee;e.mode=lp.Full,this._fullTechniqueCached=this._techniqueRepository.acquire(Zee,e)}return this._fullTechniqueCached}get _weatherMapTechnique(){if(this._weatherMapTechniqueCached==null){const e=new Xee;e.mode=lp.WeatherMap,this._weatherMapTechniqueCached=this._techniqueRepository.acquire(Zee,e)}return this._weatherMapTechniqueCached}_render(e){if(this._vao==null||this._frameBuffer==null)return null;const i=e===lp.Full?this._fullTechnique:this._weatherMapTechnique,r=this.context.renderContext.rctx,n=r.getViewport();r.setViewport(0,0,T2,T2),r.bindFramebuffer(this._frameBuffer);const s=r.bindTechnique(i,this._passParameters,null);return r.bindVAO(this._vao),s.assertCompatibleVertexAttributeLocations(this._vao),r.gl.drawArrays(r.gl.TRIANGLE_STRIP,0,4),r.setViewport(n.x,n.y,n.width,n.height),this._needsRender=!1,this._frameBuffer.colorTexture}};y([w({constructOnly:!0})],y4.prototype,"context",void 0),y([w({readOnly:!0})],y4.prototype,"_techniqueRepository",null),y4=y([Z("esri.views.3d.environment.NoiseTextureAtlas")],y4);var Dh;(function(t){t[t.Occluded=0]="Occluded",t[t.NotOccluded=1]="NotOccluded",t[t.Both=2]="Both",t[t.COUNT=3]="COUNT"})(Dh||(Dh={}));function A$e(t){t.include(i0),t.uniforms.add(new Zt("geometryDepthTexture",(e,i)=>{var r;return(r=i.multipassGeometry.linearDepth)==null?void 0:r.colorTexture}),new cn("nearFar",(e,i)=>i.camera.nearFar)),t.code.add(V`bool geometryDepthTest(vec2 pos, float elementDepth) { float geometryDepth = linearDepthFromTexture(geometryDepthTexture, pos, nearFar); return (elementDepth < (geometryDepth - 1.0)); -}`)}let Qyt=class{};function dd(t,e){if(!e.multipassEnabled)return;t.fragment.include(Kf),t.fragment.uniforms.add(new Zt("terrainDepthTexture",(r,n)=>{var s;return(s=n.multipassTerrain.linearDepth)==null?void 0:s.colorTexture})),t.fragment.uniforms.add(new ln("nearFar",(r,n)=>n.camera.nearFar));const i=e.occlusionPass;t.fragment.code.add(V` +}`)}let Kgt=class{};function gd(t,e){if(!e.multipassEnabled)return;t.fragment.include(i0),t.fragment.uniforms.add(new Zt("terrainDepthTexture",(r,n)=>{var s;return(s=n.multipassTerrain.linearDepth)==null?void 0:s.colorTexture})),t.fragment.uniforms.add(new cn("nearFar",(r,n)=>n.camera.nearFar));const i=e.occlusionPass;t.fragment.code.add(V` ${i?"bool":"void"} terrainDepthTest(float fragmentDepth) { vec4 data = texelFetch(terrainDepthTexture, ivec2(gl_FragCoord.xy), 0); float linearDepth = linearDepthFromRGBA(data, nearFar); @@ -988,13 +977,13 @@ return (elementDepth < (geometryDepth - 1.0)); if(fragmentDepth ${e.cullAboveGround?">":"<="} linearDepth){ discard; }`} - }`)}let e1t=class{constructor(){this.cullAboveGround=!1}};function Oj(t){return t?{ray:Ko(t.ray),c0:t.c0,c1:t.c1}:{ray:Ko(),c0:0,c1:Number.MAX_VALUE}}function t1t(t,e=Oj()){return iU(t,e.ray),e.c0=0,e.c1=Number.MAX_VALUE,e}function i1t(t,e,i=Oj()){const r=rt(t.vector);return JPe(t.origin,e,i.ray),i.c0=0,i.c1=r,i}function Xii(t,e){return I$e(t,t.c0,e)}function Zii(t,e){return I$e(t,t.c1,e)}function I$e(t,e,i){return Be(i,t.ray.origin,De(i,t.ray.direction,e))}new k_(()=>Oj());function OL(t){return t?[Fi(t[0]),Fi(t[1]),Fi(t[2]),Fi(t[3]),Fi(t[4]),Fi(t[5])]:[Fi(),Fi(),Fi(),Fi(),Fi(),Fi()]}function $$e(){return[W(),W(),W(),W(),W(),W(),W(),W()]}function bU(t,e){for(let i=0;i<_P;i++)uj(t[i],e[i]);return t}function L$e(t,e,i,r=l1t){const n=nn(Loe.get(),e,t);Vo(n,n);for(let s=0;s=e[3])return!1}return!0}function r1t(t,e){return F$e(t,t1t(e,k$e.get()))}function Jii(t,e){for(let i=0;i<_P;i++){const r=t[i];if(!kut(r,e))return!1}return!0}function n1t(t,e,i){return F$e(t,i1t(e,i,k$e.get()))}function N$e(t,e){for(let i=0;i<_P;i++)if(fn(t[i],e)>0)return!1;return!0}function F$e(t,e){for(let i=0;i<_P;i++)if(!Fut(t[i],e))return!1;return!0}var Rn,Gt;(function(t){t[t.LEFT=0]="LEFT",t[t.RIGHT=1]="RIGHT",t[t.BOTTOM=2]="BOTTOM",t[t.TOP=3]="TOP",t[t.NEAR=4]="NEAR",t[t.FAR=5]="FAR"})(Rn||(Rn={})),function(t){t[t.NEAR_BOTTOM_LEFT=0]="NEAR_BOTTOM_LEFT",t[t.NEAR_BOTTOM_RIGHT=1]="NEAR_BOTTOM_RIGHT",t[t.NEAR_TOP_RIGHT=2]="NEAR_TOP_RIGHT",t[t.NEAR_TOP_LEFT=3]="NEAR_TOP_LEFT",t[t.FAR_BOTTOM_LEFT=4]="FAR_BOTTOM_LEFT",t[t.FAR_BOTTOM_RIGHT=5]="FAR_BOTTOM_RIGHT",t[t.FAR_TOP_RIGHT=6]="FAR_TOP_RIGHT",t[t.FAR_TOP_LEFT=7]="FAR_TOP_LEFT"}(Gt||(Gt={}));const s1t={bottom:[Gt.FAR_BOTTOM_RIGHT,Gt.NEAR_BOTTOM_RIGHT,Gt.NEAR_BOTTOM_LEFT,Gt.FAR_BOTTOM_LEFT],near:[Gt.NEAR_BOTTOM_LEFT,Gt.NEAR_BOTTOM_RIGHT,Gt.NEAR_TOP_RIGHT,Gt.NEAR_TOP_LEFT],far:[Gt.FAR_BOTTOM_RIGHT,Gt.FAR_BOTTOM_LEFT,Gt.FAR_TOP_LEFT,Gt.FAR_TOP_RIGHT],right:[Gt.NEAR_BOTTOM_RIGHT,Gt.FAR_BOTTOM_RIGHT,Gt.FAR_TOP_RIGHT,Gt.NEAR_TOP_RIGHT],left:[Gt.FAR_BOTTOM_LEFT,Gt.NEAR_BOTTOM_LEFT,Gt.NEAR_TOP_LEFT,Gt.FAR_TOP_LEFT],top:[Gt.FAR_TOP_LEFT,Gt.NEAR_TOP_LEFT,Gt.NEAR_TOP_RIGHT,Gt.FAR_TOP_RIGHT]},_P=6,o1t=8,a1t=[Mi(-1,-1,-1,1),Mi(1,-1,-1,1),Mi(1,1,-1,1),Mi(-1,1,-1,1),Mi(-1,-1,1,1),Mi(1,-1,1,1),Mi(1,1,1,1),Mi(-1,1,1,1)],k$e=new k_(Oj),l1t=$$e();function c1t(t,e,i){return 2*Math.atan(Math.sqrt(e*e+i*i)*Math.tan(.5*t)/e)}function u1t(t,e,i){return 2*Math.atan(Math.sqrt(e*e+i*i)*Math.tan(.5*t)/i)}function h1t(t,e,i){return 2*Math.atan(e*Math.tan(.5*t)/Math.sqrt(e*e+i*i))}function d1t(t,e,i){return 2*Math.atan(i*Math.tan(.5*t)/Math.sqrt(e*e+i*i))}var jee;let ai=jee=class extends ze{constructor(t={}){super(t),this._center=W(),this._up=W(),this._viewUp=W(),this._viewForward=W(),this._viewRight=W(),this._ray=Ko(),this._viewport=Mi(0,0,1,1),this._padding=Mi(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=Ji(1,1e3),this._viewDirty=!0,this._viewMatrix=Qe(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=Qe(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=Qe(),this._frustumDirty=!0,this._frustum=OL(),this._fullViewport=Xi(),this._pixelRatio=1,this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return je(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){Ao(this._viewMatrix,t),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),this._viewForward}get viewUp(){return this._ensureViewClean(),this._viewUp}get viewRight(){return this._ensureViewClean(),this._viewRight}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(this.pixelRatio===1)return this._viewport;const t=UT(Xi(),this._viewport,1/this.pixelRatio),e=this._get("screenViewport");return e&&VT(t,e)?e:t}get screenPadding(){if(this.pixelRatio===1)return this._padding;const t=UT(Xi(),this._padding,1/this.pixelRatio),e=this._get("screenPadding");return e&&VT(t,e)?e:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[er.LEFT],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[er.BOTTOM],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[er.RIGHT]+this._padding[er.LEFT]}set fullWidth(t){this.width=t-(this._padding[er.RIGHT]+this._padding[er.LEFT])}get fullHeight(){return this._viewport[3]+this._padding[er.TOP]+this._padding[er.BOTTOM]}set fullHeight(t){this.height=t-(this._padding[er.TOP]+this._padding[er.BOTTOM])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[er.LEFT],this._fullViewport[1]=this._viewport[1]-this._padding[er.BOTTOM],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){rO(this._padding,t)||(this._viewport[0]+=t[er.LEFT]-this._padding[er.LEFT],this._viewport[1]+=t[er.BOTTOM]-this._padding[er.BOTTOM],this._viewport[2]-=t[er.RIGHT]+t[er.LEFT]-(this._padding[er.RIGHT]+this._padding[er.LEFT]),this._viewport[3]-=t[er.TOP]+t[er.BOTTOM]-(this._padding[er.TOP]+this._padding[er.BOTTOM]),mm(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(nn(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){const t=this.width,e=this.height,i=this.near*Math.tan(this.fovY/2),r=i*this._aspect,n=JAe(Qe(),-r*(1+2*this._padding[er.LEFT]/t),r*(1+2*this._padding[er.RIGHT]/t),-i*(1+2*this._padding[er.BOTTOM]/e),i*(1+2*this._padding[er.TOP]/e),this.near,this.far),s=this._get("projectionMatrix");return s&&CB(s,n)?s:n}get inverseProjectionMatrix(){return Vo(Qe(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||Qe()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return h1t(this._fov,this.width,this.height)}set fovX(t){this._fov=c1t(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return d1t(this._fov,this.width,this.height)}set fovY(t){this._fov=u1t(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return Sn(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(Vo(this._viewInverseTransposeMatrix,this.viewMatrix),ld(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const e=2*t-1;return 2*this.near*this.far/(this.far+this.near-e*(this.far-this.near))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return this.relativeElevation!=null&&this.relativeElevation>=0}copyFrom(t){Ne(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,mm(this._viewport,t.viewport),this.notifyChange("_viewport"),mm(this._padding,t.padding),this.notifyChange("_padding"),Qo(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.relativeElevation=t.relativeElevation;const e=t;return this._viewDirty=e._viewDirty,this._viewDirty||(Ao(this._viewMatrix,t.viewMatrix),Ne(this._viewRight,t.viewRight),Ne(this._viewUp,t.viewUp),Ne(this._viewForward,t.viewForward)),this._viewProjectionDirty=!0,this._frustumDirty=e._frustumDirty,this._frustumDirty||(bU(this._frustum,t.frustum),this._frustumDirty=!1),e._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(Ao(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),mm(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up}clone(){return new jee().copyFrom(this)}equals(t){return jr(this.eye,t.eye)&&jr(this.center,t.center)&&jr(this.up,t.up)&&rO(this._viewport,t.viewport)&&rO(this._padding,t.padding)&&kIe(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation}almostEquals(t){const e=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||$z(t.screenPadding,this.screenPadding)>=e||$z(this.screenViewport,t.screenViewport)>=e)return!1;xn(Ql,t.eye,t.center),xn(mq,this.eye,this.center);const i=Ve(Ql,mq),r=HO(Ql),n=HO(mq),s=5e-4;return i*i>=(1-1e-10)*r*n&&vB(t.eye,this.eye)2&&(e[2]=.5*(Qi[2]+1))),e}unprojectFromScreen(t,e){return this.unprojectFromRenderScreen(this.screenToRender(t,gq),e)}unprojectFromRenderScreen(t,e){if(nn(HD,this.projectionMatrix,this.viewMatrix),!Vo(HD,HD))return null;const i=this.fullViewport;return Qi[0]=2*(t[0]-i[0])/i[2]-1,Qi[1]=2*(t[1]-i[1])/i[3]-1,Qi[2]=2*t[2]-1,Qi[3]=1,lp(Qi,Qi,HD),Qi[3]===0?null:(e[0]=Qi[0]/Qi[3],e[1]=Qi[1]/Qi[3],e[2]=Qi[2]/Qi[3],e)}constrainWindowSize(t,e,i,r){const n=t*this.pixelRatio,s=e*this.pixelRatio,o=Math.max(n-i/2,0),l=Math.max(this.fullHeight-s-r/2,0),c=-Math.min(n-i/2,0),f=-Math.min(this.fullHeight-s-r/2,0),_=i-c- -Math.min(this.fullWidth-n-i/2,0),x=r-f- -Math.min(s-r/2,0);return[Math.round(o),Math.round(l),Math.round(_),Math.round(x)]}computeUp(t){t===_t.Global?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,e){const i=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return e[0]=i,e[1]=r,e}renderToScreen(t,e){const i=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;e[0]=i,e[1]=r}_computeUpGlobal(){je(Ql,this.center,this.eye);const t=rt(this.center);t<1?(Ie(this._up,0,0,1),this._markViewDirty(),this.notifyChange("_up")):Math.abs(Ve(Ql,this.center))>.9999*rt(Ql)*t||(Wt(this._up,Ql,this.center),Wt(this._up,this._up,Ql),Ye(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_computeUpLocal(){R_(Ql,this.eye,this.center),Math.abs(Ql[2])<=.9999&&(De(Ql,Ql,Ql[2]),Ie(this._up,-Ql[0],-Ql[1],1-Ql[2]),Ye(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_compareAndSetView(t,e,i=""){typeof t[0]=="number"&&isFinite(t[0])&&typeof t[1]=="number"&&isFinite(t[1])&&typeof t[2]=="number"&&isFinite(t[2])?jr(t,e)||(Ne(e,t),this._markViewDirty(),i.length&&this.notifyChange(i)):Ce.getLogger("esri.views.3d.webgl-engine.lib.Camera").warn("Camera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(L$e(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(EB(this._viewMatrix,this.eye,this.center,this.up),Ie(this._viewForward,-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10]),Ie(this._viewUp,this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9]),Ie(this._viewRight,this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8]),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};y([w()],ai.prototype,"_center",void 0),y([w()],ai.prototype,"_up",void 0),y([w()],ai.prototype,"_viewport",void 0),y([w()],ai.prototype,"_padding",void 0),y([w()],ai.prototype,"_fov",void 0),y([w()],ai.prototype,"_nearFar",void 0),y([w()],ai.prototype,"_pixelRatio",void 0),y([w()],ai.prototype,"pixelRatio",null),y([w()],ai.prototype,"eye",null),y([w()],ai.prototype,"center",null),y([w()],ai.prototype,"up",null),y([w({readOnly:!0})],ai.prototype,"nearFar",null),y([w()],ai.prototype,"near",null),y([w()],ai.prototype,"far",null),y([w()],ai.prototype,"viewport",null),y([w({readOnly:!0})],ai.prototype,"screenViewport",null),y([w({readOnly:!0})],ai.prototype,"screenPadding",null),y([w()],ai.prototype,"x",null),y([w()],ai.prototype,"y",null),y([w()],ai.prototype,"width",null),y([w()],ai.prototype,"height",null),y([w()],ai.prototype,"fullWidth",null),y([w()],ai.prototype,"fullHeight",null),y([w({readOnly:!0})],ai.prototype,"_aspect",null),y([w()],ai.prototype,"padding",null),y([w({readOnly:!0})],ai.prototype,"projectionMatrix",null),y([w({readOnly:!0})],ai.prototype,"inverseProjectionMatrix",null),y([w()],ai.prototype,"fov",null),y([w()],ai.prototype,"fovX",null),y([w()],ai.prototype,"fovY",null),ai=jee=y([Z("esri.views.3d.webgl-engine.lib.Camera")],ai);const Qi=Xi(),HD=Qe(),Ql=W(),mq=W(),gq=Za();var er;(function(t){t[t.TOP=0]="TOP",t[t.RIGHT=1]="RIGHT",t[t.BOTTOM=2]="BOTTOM",t[t.LEFT=3]="LEFT"})(er||(er={}));var ke;(function(t){t[t.INTEGRATED_MESH=0]="INTEGRATED_MESH",t[t.OPAQUE_TERRAIN=1]="OPAQUE_TERRAIN",t[t.OPAQUE_MATERIAL=2]="OPAQUE_MATERIAL",t[t.TRANSPARENT_MATERIAL=3]="TRANSPARENT_MATERIAL",t[t.TRANSPARENT_TERRAIN=4]="TRANSPARENT_TERRAIN",t[t.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL=5]="TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL",t[t.OCCLUDED_TERRAIN=6]="OCCLUDED_TERRAIN",t[t.OCCLUDER_MATERIAL=7]="OCCLUDER_MATERIAL",t[t.TRANSPARENT_OCCLUDER_MATERIAL=8]="TRANSPARENT_OCCLUDER_MATERIAL",t[t.OCCLUSION_PIXELS=9]="OCCLUSION_PIXELS",t[t.ANTIALIASING=10]="ANTIALIASING",t[t.COMPOSITE=11]="COMPOSITE",t[t.BLIT=12]="BLIT",t[t.SSAO=13]="SSAO",t[t.HIGHLIGHT=14]="HIGHLIGHT",t[t.SHADOW_HIGHLIGHT=15]="SHADOW_HIGHLIGHT",t[t.ENVIRONMENT_OPAQUE=16]="ENVIRONMENT_OPAQUE",t[t.ENVIRONMENT_TRANSPARENT=17]="ENVIRONMENT_TRANSPARENT",t[t.LASERLINES=18]="LASERLINES",t[t.LASERLINES_CONTRAST_CONTROL=19]="LASERLINES_CONTRAST_CONTROL",t[t.HUD_MATERIAL=20]="HUD_MATERIAL",t[t.LABEL_MATERIAL=21]="LABEL_MATERIAL",t[t.LINE_CALLOUTS=22]="LINE_CALLOUTS",t[t.LINE_CALLOUTS_HUD_DEPTH=23]="LINE_CALLOUTS_HUD_DEPTH",t[t.DRAPED_MATERIAL=24]="DRAPED_MATERIAL",t[t.DRAPED_WATER=25]="DRAPED_WATER",t[t.VOXEL=26]="VOXEL",t[t.MAX_SLOTS=27]="MAX_SLOTS"})(ke||(ke={}));var Jt;(function(t){t[t.Color=0]="Color",t[t.Alpha=1]="Alpha",t[t.FrontFace=2]="FrontFace",t[t.NONE=3]="NONE",t[t.COUNT=4]="COUNT"})(Jt||(Jt={}));let Mae=class{constructor(e=W()){this.intensity=e}},z$e=class{constructor(e=W(),i=nt(.57735,.57735,.57735)){this.intensity=e,this.direction=i}},wU=class{constructor(e=W(),i=nt(.57735,.57735,.57735),r=!0,n=1,s=1){this.intensity=e,this.direction=i,this.castShadows=r,this.specularStrength=n,this.environmentStrength=s}},U$e=class{constructor(){this.r=[0],this.g=[0],this.b=[0]}};function p1t(t,e,i){(i=i||t).length=t.length;for(let r=0;r=0&&(o[0]=.28209479177),e>=1&&(o[1]=.4886025119*r,o[2]=.4886025119*s,o[3]=.4886025119*n),e>=2&&(o[4]=1.09254843059*r*n,o[5]=1.09254843059*n*s,o[6]=.31539156525*(3*s*s-1),o[7]=1.09254843059*r*s,o[8]=.54627421529*(r*r-n*n)),o}function m1t(t,e){const i=V$e(t),r=e||{r:[],g:[],b:[]};r.r.length=r.g.length=r.b.length=i;for(let n=0;n=1?this._lighting=r:(this._fadedLighting.lerpLighting(i,r,e),this._lighting=this._fadedLighting)}},S1t=class{constructor(){this.fadeFactor=1,this.reprojectionMatrix=Qe()}},Mu=class extends ze{constructor(e){super(e),this._techniques=new Array,this._techniqueConfiguration=new VF,this._bindParameters=new Pj(null,null),this._passParameters=new Eae,this._drawParameters=new Cae,this._weatherTile=yt(),this._weatherTileCount=128,this._faceIndex=0,this._tileIndex=0,this.coverage=ui(cc.default.coverage[0],cc.default.coverage[1],.5),this.density=ui(cc.default.density[0],cc.default.density[1],.5),this.absorption=ui(cc.default.absorption[0],cc.default.absorption[1],.5),this.cloudSize=ui(cc.default.cloudSize[0],cc.default.cloudSize[1],.5),this.detailSize=ui(cc.default.detailSize[0],cc.default.detailSize[1],.5),this.smoothness=ui(cc.default.smoothness[0],cc.default.smoothness[1],.5),this.cloudHeight=ui(cc.default.cloudHeight[0],cc.default.cloudHeight[1],.5),this.raymarchingSteps=cc.default.raymarchingSteps,this._viewMatrix=Qe(),this._dirty=!1,this.running=!1,this._vao=u1(e.context.renderContext.rctx)}_getTechnique(e){const i=1-this.context.renderContext.bindParameters.cloudsFade.readChannels,r=i===YT.RG?2*e:2*e+1;return this._techniques[r]||(this._techniqueConfiguration.writeTextureChannels=i,this._techniqueConfiguration.steps=e,this._techniques[r]=new A$e({rctx:this.context.renderContext.rctx,viewingMode:this.view.state.viewingMode},this._techniqueConfiguration),this._techniques[r])}updateWeatherTile(){const e=this.view.camera.position.latitude,i=this.view.camera.position.longitude;if(e==null||i==null)return;or(this._weatherTile,(e+90)/180,(i+180)/360);const r=Math.floor(this._weatherTileCount*Math.abs(2*this._weatherTile[0]-1));this._weatherTile[0]=Math.floor(2*this._weatherTileCount*this._weatherTile[0]),this._weatherTile[1]=Math.floor(4*(this._weatherTileCount-r)*this._weatherTile[1]);let n=0,s=0;if(this.view.environment!=null&&this.view.environment.lighting.type!=="virtual"&&this.view.environment.lighting.date!=null){const o=new Date(this.view.environment.lighting.date);o.setUTCHours(this.view.environment.lighting.date.getUTCHours()+(this.view.environment.lighting.displayUTCOffset??0)),n=31*o.getUTCMonth()+o.getUTCDate(),s=o.getUTCFullYear()}this._weatherTile[0]=(this._weatherTile[0]+n)%(2*this._weatherTileCount),this._weatherTile[1]=(this._weatherTile[1]+s%100)%(4*this._weatherTileCount),zIe(this._passParameters.weatherTile,this._weatherTile)||this.setDirty()}initialize(){const e=Sr(this.view.spatialReference);this._passParameters.cloudRadius=.5*e.radius,this.setDirty(),this.updateWeatherTile(),this.addHandles([this.view.resourceController.scheduler.registerTask(ni.CLOUDS_GENERATOR,this),_e(()=>[this.coverage,this.density,this.absorption,this.cloudSize,this.detailSize,this.smoothness,this.cloudHeight,this.raymarchingSteps],()=>this.setDirty(),ii)])}destroy(){this._techniques.forEach(e=>ir(e)),this._frameBufferCube=Kt(this._frameBufferCube),this._techniques.length=0,this._vao.dispose(),this._passParameters.noiseTexture=et(this._passParameters.noiseTexture)}get _tilesPerFace(){switch(this._techniqueConfiguration.steps){case Wu.SIXTEEN:return 1;case Wu.HUNDRED:return 4;case Wu.COUNT:case Wu.TWOHUNDRED:return 8}}get usedMemory(){var e,i,r;return(((e=this._frameBufferCube)==null?void 0:e.gpuMemoryUsage)??0)+(((r=(i=this._passParameters.noiseTexture)==null?void 0:i.textureAtlas)==null?void 0:r.gpuMemoryUsage)??0)}_ensureNoiseTexture(){if(this._passParameters.noiseTexture!=null)this._passParameters.noiseTexture.updateWeatherMap(this._passParameters.weatherTile);else{const e=this.context;this._passParameters.noiseTexture=new oI({context:e}),this._passParameters.noiseTexture.updateWeatherMap(this._passParameters.weatherTile)}return this._passParameters.noiseTexture.textureAtlas!=null}_ensureFrameBufferCube(e){if(this._frameBufferCube==null){const i=new tn(e);i.target=Hs.TEXTURE_CUBE_MAP,i.wrapMode=Bi.CLAMP_TO_EDGE,this._frameBufferCube=new Hm(this.context.renderContext.rctx,i)}return this._frameBufferCube}get cubeMap(){return this._frameBufferCube}destroyFrameBufferCube(){this._frameBufferCube=Kt(this._frameBufferCube)}applyPreset(e,i){const r=e.median,n=s=>{const o=ui(s[0],s[1],r);return i<.5?ui(s[0],o,2*i):ui(o,s[1],2*(i-.5))};this.coverage=n(e.coverage),this.density=n(e.density),this.absorption=n(e.absorption),this.cloudSize=n(e.cloudSize),this.detailSize=n(e.detailSize),this.smoothness=n(e.smoothness),this.cloudHeight=n(e.cloudHeight),this.raymarchingSteps=e.raymarchingSteps}setDirty(){this._dirty=this.running=!0}runTask(e){this._faceIndex===0&&this._tileIndex===0&&(this._passParameters.raymarchingSteps=this.raymarchingSteps,this.updateWeatherTile(),Qo(this._passParameters.weatherTile,this._weatherTile));const i=this._getTechnique(this._passParameters.raymarchingSteps);if(!i.compiled||this.context.renderContext.bindParameters.cloudsFade.fadeMode===Vn.CROSS_FADE||!this._ensureNoiseTexture())return Xl.YIELD;this._faceIndex===0&&this._tileIndex===0&&(this.context.renderContext.bindParameters.cloudsFade.renderingStage=gy.RENDERING,this._passParameters.absorption=this.absorption,this._passParameters.density=this.density,this._passParameters.cloudSize=this.cloudSize,this._passParameters.detailSize=this.detailSize,this._passParameters.smoothness=this.smoothness,this._passParameters.cloudHeight=this.cloudHeight,this._passParameters.coverage=this.coverage,this._dirty=!1);const r=this.context.renderContext.rctx,n=r.bindTechnique(i,this._passParameters,this._bindParameters);r.bindVAO(this._vao),n.assertCompatibleVertexAttributeLocations(this._vao);const s=r.getViewport(),o=i.configuration.cubeMapSize,l=o/this._tilesPerFace,c=this._tileIndex*l;r.setViewport(0,c,o,l);const f=this._ensureFrameBufferCube(o);r.bindFramebuffer(f);const _=T1t[this._faceIndex],x=E1t[this._faceIndex];QAe(this._viewMatrix,C1t,_,x),Yf(this._drawParameters.viewMatrix,this._viewMatrix);const T=Hs.TEXTURE_CUBE_MAP_POSITIVE_X+this._faceIndex;return f.setColorTextureTarget(T),n.bindDraw(this._drawParameters,this._bindParameters,this._passParameters),r.gl.drawArrays(r.gl.TRIANGLE_STRIP,0,4),r.gl.flush(),r.setViewport(s.x,s.y,s.width,s.height),this.requestRender(),++this._tileIndex,this._faceIndex===4&&this._tileIndex===this._tilesPerFace?(this.running=this._dirty,this._faceIndex=0,this._tileIndex=0,this.running||(this.context.renderContext.bindParameters.cloudsFade.renderingStage=gy.FADING)):this._tileIndex===this._tilesPerFace&&(++this._faceIndex,this._tileIndex=0),e.madeProgress(),Xl.YIELD}};y([w({constructOnly:!0})],Mu.prototype,"context",void 0),y([w({constructOnly:!0})],Mu.prototype,"view",void 0),y([w({constructOnly:!0})],Mu.prototype,"requestRender",void 0),y([w()],Mu.prototype,"coverage",void 0),y([w()],Mu.prototype,"density",void 0),y([w()],Mu.prototype,"absorption",void 0),y([w()],Mu.prototype,"cloudSize",void 0),y([w()],Mu.prototype,"detailSize",void 0),y([w()],Mu.prototype,"smoothness",void 0),y([w()],Mu.prototype,"cloudHeight",void 0),y([w()],Mu.prototype,"raymarchingSteps",void 0),y([w()],Mu.prototype,"running",void 0),Mu=y([Z("esri.views.3d.environment.CloudsGenerator")],Mu);const T1t=[pn(1,0,0),pn(-1,0,0),pn(0,1,0),pn(0,-1,0),pn(0,0,1)],E1t=[pn(0,1,0),pn(0,1,0),pn(0,0,-1),pn(0,0,1),pn(0,1,0)],C1t=Tae();let Oae=class extends _n{constructor(){super(...arguments),this.fogColor=W(),this.fogStrength=4e-6,this.atmosphereC=1,this.fogAmount=0}};function G$e(){const t=new Cr;t.attributes.add(J.POSITION,"vec2"),t.include(My,{textureCoordinateType:So.Default}),t.varyings.add("worldRay","vec3"),t.varyings.add("eyeDir","vec3");const{vertex:e,fragment:i}=t;return e.uniforms.add(new _s("inverseProjectionMatrix",(r,n)=>n.camera.inverseProjectionMatrix),new _s("inverseViewMatrix",(r,n)=>sP(A1t,n.camera.viewMatrix))),e.code.add(V`void main(void) { + }`)}let Qgt=class{constructor(){this.cullAboveGround=!1}};function zj(t){return t?{ray:Qo(t.ray),c0:t.c0,c1:t.c1}:{ray:Qo(),c0:0,c1:Number.MAX_VALUE}}function eyt(t,e=zj()){return eU(t,e.ray),e.c0=0,e.c1=Number.MAX_VALUE,e}function tyt(t,e,i=zj()){const r=nt(t.vector);return T5e(t.origin,e,i.ray),i.c0=0,i.c1=r,i}function rni(t,e){return M$e(t,t.c0,e)}function nni(t,e){return M$e(t,t.c1,e)}function M$e(t,e,i){return Be(i,t.ray.origin,De(i,t.ray.direction,e))}new j_(()=>zj());function kL(t){return t?[Fi(t[0]),Fi(t[1]),Fi(t[2]),Fi(t[3]),Fi(t[4]),Fi(t[5])]:[Fi(),Fi(),Fi(),Fi(),Fi(),Fi()]}function O$e(){return[W(),W(),W(),W(),W(),W(),W(),W()]}function wU(t,e){for(let i=0;i=e[3])return!1}return!0}function iyt(t,e){return $$e(t,eyt(e,L$e.get()))}function sni(t,e){for(let i=0;i0)return!1;return!0}function $$e(t,e){for(let i=0;i0?t:1}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return je(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){Mo(this._viewMatrix,t),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),this._viewForward}get viewUp(){return this._ensureViewClean(),this._viewUp}get viewRight(){return this._ensureViewClean(),this._viewRight}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(this.pixelRatio===1)return this._viewport;const t=jT(Xi(),this._viewport,1/this.pixelRatio),e=this._get("screenViewport");return e&>(t,e)?e:t}get screenPadding(){if(this.pixelRatio===1)return this._padding;const t=jT(Xi(),this._padding,1/this.pixelRatio),e=this._get("screenPadding");return e&>(t,e)?e:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[er.LEFT],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[er.BOTTOM],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[er.RIGHT]+this._padding[er.LEFT]}set fullWidth(t){this.width=t-(this._padding[er.RIGHT]+this._padding[er.LEFT])}get fullHeight(){return this._viewport[3]+this._padding[er.TOP]+this._padding[er.BOTTOM]}set fullHeight(t){this.height=t-(this._padding[er.TOP]+this._padding[er.BOTTOM])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[er.LEFT],this._fullViewport[1]=this._viewport[1]-this._padding[er.BOTTOM],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){aO(this._padding,t)||(this._viewport[0]+=t[er.LEFT]-this._padding[er.LEFT],this._viewport[1]+=t[er.BOTTOM]-this._padding[er.BOTTOM],this._viewport[2]-=t[er.RIGHT]+t[er.LEFT]-(this._padding[er.RIGHT]+this._padding[er.LEFT]),this._viewport[3]-=t[er.TOP]+t[er.BOTTOM]-(this._padding[er.TOP]+this._padding[er.BOTTOM]),ym(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(sn(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){const t=this.width,e=this.height,i=this.near*Math.tan(this.fovY/2),r=i*this._aspect,n=pCe(Qe(),-r*(1+2*this._padding[er.LEFT]/t),r*(1+2*this._padding[er.RIGHT]/t),-i*(1+2*this._padding[er.BOTTOM]/e),i*(1+2*this._padding[er.TOP]/e),this.near,this.far),s=this._get("projectionMatrix");return s&&TB(s,n)?s:n}get inverseProjectionMatrix(){return Bo(Qe(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||Qe()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return uyt(this._fov,this.width,this.height)}set fovX(t){this._fov=lyt(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return hyt(this._fov,this.width,this.height)}set fovY(t){this._fov=cyt(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return Tn(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(Bo(this._viewInverseTransposeMatrix,this.viewMatrix),ud(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const e=2*t-1;return 2*this.near*this.far/(this.far+this.near-e*(this.far-this.near))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return this.relativeElevation!=null&&this.relativeElevation>=0}copyFrom(t){Ne(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,ym(this._viewport,t.viewport),this.notifyChange("_viewport"),ym(this._padding,t.padding),this.notifyChange("_padding"),ea(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.relativeElevation=t.relativeElevation;const e=t;return this._viewDirty=e._viewDirty,this._viewDirty||(Mo(this._viewMatrix,t.viewMatrix),Ne(this._viewRight,t.viewRight),Ne(this._viewUp,t.viewUp),Ne(this._viewForward,t.viewForward)),this._viewProjectionDirty=!0,this._frustumDirty=e._frustumDirty,this._frustumDirty||(wU(this._frustum,t.frustum),this._frustumDirty=!1),e._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(Mo(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),ym(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up}clone(){return new Jee().copyFrom(this)}equals(t){return jr(this.eye,t.eye)&&jr(this.center,t.center)&&jr(this.up,t.up)&&aO(this._viewport,t.viewport)&&aO(this._padding,t.padding)&&L4e(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation}almostEquals(t){const e=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||Cz(t.screenPadding,this.screenPadding)>=e||Cz(this.screenViewport,t.screenViewport)>=e)return!1;Sn(ic,t.eye,t.center),Sn(Eq,this.eye,this.center);const i=Ve(ic,Eq),r=QO(ic),n=QO(Eq),s=5e-4;return i*i>=(1-1e-10)*r*n&&yB(t.eye,this.eye)2&&(e[2]=.5*(Qi[2]+1))),e}unprojectFromScreen(t,e){return this.unprojectFromRenderScreen(this.screenToRender(t,Cq),e)}unprojectFromRenderScreen(t,e){if(sn(KD,this.projectionMatrix,this.viewMatrix),!Bo(KD,KD))return null;const i=this.fullViewport;return Qi[0]=2*(t[0]-i[0])/i[2]-1,Qi[1]=2*(t[1]-i[1])/i[3]-1,Qi[2]=2*t[2]-1,Qi[3]=1,dp(Qi,Qi,KD),Qi[3]===0?null:(e[0]=Qi[0]/Qi[3],e[1]=Qi[1]/Qi[3],e[2]=Qi[2]/Qi[3],e)}constrainWindowSize(t,e,i,r){const n=t*this.pixelRatio,s=e*this.pixelRatio,o=Math.max(n-i/2,0),a=Math.max(this.fullHeight-s-r/2,0),c=-Math.min(n-i/2,0),p=-Math.min(this.fullHeight-s-r/2,0),_=i-c- -Math.min(this.fullWidth-n-i/2,0),x=r-p- -Math.min(s-r/2,0);return[Math.round(o),Math.round(a),Math.round(_),Math.round(x)]}computeUp(t){t===_t.Global?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,e){const i=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return e[0]=i,e[1]=r,e}renderToScreen(t,e){const i=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;e[0]=i,e[1]=r}_computeUpGlobal(){je(ic,this.center,this.eye);const t=nt(this.center);t<1?(Ie(this._up,0,0,1),this._markViewDirty(),this.notifyChange("_up")):Math.abs(Ve(ic,this.center))>.9999*nt(ic)*t||(Wt(this._up,ic,this.center),Wt(this._up,this._up,ic),Ye(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_computeUpLocal(){k_(ic,this.eye,this.center),Math.abs(ic[2])<=.9999&&(De(ic,ic,ic[2]),Ie(this._up,-ic[0],-ic[1],1-ic[2]),Ye(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_compareAndSetView(t,e,i=""){typeof t[0]=="number"&&isFinite(t[0])&&typeof t[1]=="number"&&isFinite(t[1])&&typeof t[2]=="number"&&isFinite(t[2])?jr(t,e)||(Ne(e,t),this._markViewDirty(),i.length&&this.notifyChange(i)):Ce.getLogger("esri.views.3d.webgl-engine.lib.Camera").warn("Camera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(P$e(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(SB(this._viewMatrix,this.eye,this.center,this.up),Ie(this._viewForward,-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10]),Ie(this._viewUp,this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9]),Ie(this._viewRight,this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8]),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};y([w()],si.prototype,"_center",void 0),y([w()],si.prototype,"_up",void 0),y([w()],si.prototype,"_viewport",void 0),y([w()],si.prototype,"_padding",void 0),y([w()],si.prototype,"_fov",void 0),y([w()],si.prototype,"_nearFar",void 0),y([w()],si.prototype,"_pixelRatio",void 0),y([w()],si.prototype,"pixelRatio",null),y([w()],si.prototype,"eye",null),y([w()],si.prototype,"center",null),y([w()],si.prototype,"up",null),y([w({readOnly:!0})],si.prototype,"nearFar",null),y([w()],si.prototype,"near",null),y([w()],si.prototype,"far",null),y([w()],si.prototype,"viewport",null),y([w({readOnly:!0})],si.prototype,"screenViewport",null),y([w({readOnly:!0})],si.prototype,"screenPadding",null),y([w()],si.prototype,"x",null),y([w()],si.prototype,"y",null),y([w()],si.prototype,"width",null),y([w()],si.prototype,"height",null),y([w()],si.prototype,"fullWidth",null),y([w()],si.prototype,"fullHeight",null),y([w({readOnly:!0})],si.prototype,"_aspect",null),y([w()],si.prototype,"padding",null),y([w({readOnly:!0})],si.prototype,"projectionMatrix",null),y([w({readOnly:!0})],si.prototype,"inverseProjectionMatrix",null),y([w()],si.prototype,"fov",null),y([w()],si.prototype,"fovX",null),y([w()],si.prototype,"fovY",null),si=Jee=y([Z("esri.views.3d.webgl-engine.lib.Camera")],si);const Qi=Xi(),KD=Qe(),ic=W(),Eq=W(),Cq=Ka();var er;(function(t){t[t.TOP=0]="TOP",t[t.RIGHT=1]="RIGHT",t[t.BOTTOM=2]="BOTTOM",t[t.LEFT=3]="LEFT"})(er||(er={}));var ke;(function(t){t[t.INTEGRATED_MESH=0]="INTEGRATED_MESH",t[t.OPAQUE_TERRAIN=1]="OPAQUE_TERRAIN",t[t.OPAQUE_MATERIAL=2]="OPAQUE_MATERIAL",t[t.TRANSPARENT_MATERIAL=3]="TRANSPARENT_MATERIAL",t[t.TRANSPARENT_TERRAIN=4]="TRANSPARENT_TERRAIN",t[t.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL=5]="TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL",t[t.OCCLUDED_TERRAIN=6]="OCCLUDED_TERRAIN",t[t.OCCLUDER_MATERIAL=7]="OCCLUDER_MATERIAL",t[t.TRANSPARENT_OCCLUDER_MATERIAL=8]="TRANSPARENT_OCCLUDER_MATERIAL",t[t.OCCLUSION_PIXELS=9]="OCCLUSION_PIXELS",t[t.ANTIALIASING=10]="ANTIALIASING",t[t.COMPOSITE=11]="COMPOSITE",t[t.BLIT=12]="BLIT",t[t.SSAO=13]="SSAO",t[t.HIGHLIGHT=14]="HIGHLIGHT",t[t.SHADOW_HIGHLIGHT=15]="SHADOW_HIGHLIGHT",t[t.ENVIRONMENT_OPAQUE=16]="ENVIRONMENT_OPAQUE",t[t.ENVIRONMENT_TRANSPARENT=17]="ENVIRONMENT_TRANSPARENT",t[t.LASERLINES=18]="LASERLINES",t[t.LASERLINES_CONTRAST_CONTROL=19]="LASERLINES_CONTRAST_CONTROL",t[t.HUD_MATERIAL=20]="HUD_MATERIAL",t[t.LABEL_MATERIAL=21]="LABEL_MATERIAL",t[t.LINE_CALLOUTS=22]="LINE_CALLOUTS",t[t.LINE_CALLOUTS_HUD_DEPTH=23]="LINE_CALLOUTS_HUD_DEPTH",t[t.DRAPED_MATERIAL=24]="DRAPED_MATERIAL",t[t.DRAPED_WATER=25]="DRAPED_WATER",t[t.VOXEL=26]="VOXEL",t[t.MAX_SLOTS=27]="MAX_SLOTS"})(ke||(ke={}));var Jt;(function(t){t[t.Color=0]="Color",t[t.Alpha=1]="Alpha",t[t.FrontFace=2]="FrontFace",t[t.NONE=3]="NONE",t[t.COUNT=4]="COUNT"})(Jt||(Jt={}));let Vae=class{constructor(e=W()){this.intensity=e}},D$e=class{constructor(e=W(),i=st(.57735,.57735,.57735)){this.intensity=e,this.direction=i}},xU=class{constructor(e=W(),i=st(.57735,.57735,.57735),r=!0,n=1,s=1){this.intensity=e,this.direction=i,this.castShadows=r,this.specularStrength=n,this.environmentStrength=s}},N$e=class{constructor(){this.r=[0],this.g=[0],this.b=[0]}};function dyt(t,e,i){(i=i||t).length=t.length;for(let r=0;r=0&&(o[0]=.28209479177),e>=1&&(o[1]=.4886025119*r,o[2]=.4886025119*s,o[3]=.4886025119*n),e>=2&&(o[4]=1.09254843059*r*n,o[5]=1.09254843059*n*s,o[6]=.31539156525*(3*s*s-1),o[7]=1.09254843059*r*s,o[8]=.54627421529*(r*r-n*n)),o}function fyt(t,e){const i=F$e(t),r=e||{r:[],g:[],b:[]};r.r.length=r.g.length=r.b.length=i;for(let n=0;n=1?this._lighting=r:(this._fadedLighting.lerpLighting(i,r,e),this._lighting=this._fadedLighting)}},xyt=class{constructor(){this.fadeFactor=1,this.reprojectionMatrix=Qe()}},Pu=class extends ze{constructor(e){super(e),this._techniques=new Array,this._techniqueConfiguration=new JF,this._bindParameters=new Uj(null,null),this._passParameters=new kae,this._drawParameters=new zae,this._weatherTile=yt(),this._weatherTileCount=128,this._faceIndex=0,this._tileIndex=0,this.coverage=ui(dc.default.coverage[0],dc.default.coverage[1],.5),this.density=ui(dc.default.density[0],dc.default.density[1],.5),this.absorption=ui(dc.default.absorption[0],dc.default.absorption[1],.5),this.cloudSize=ui(dc.default.cloudSize[0],dc.default.cloudSize[1],.5),this.detailSize=ui(dc.default.detailSize[0],dc.default.detailSize[1],.5),this.smoothness=ui(dc.default.smoothness[0],dc.default.smoothness[1],.5),this.cloudHeight=ui(dc.default.cloudHeight[0],dc.default.cloudHeight[1],.5),this.raymarchingSteps=dc.default.raymarchingSteps,this._viewMatrix=Qe(),this._dirty=!1,this.running=!1,this._vao=v1(e.context.renderContext.rctx)}_getTechnique(e){const i=1-this.context.renderContext.bindParameters.cloudsFade.readChannels,r=i===QT.RG?2*e:2*e+1;return this._techniques[r]||(this._techniqueConfiguration.writeTextureChannels=i,this._techniqueConfiguration.steps=e,this._techniques[r]=new S$e({rctx:this.context.renderContext.rctx,viewingMode:this.view.state.viewingMode},this._techniqueConfiguration),this._techniques[r])}updateWeatherTile(){const e=this.view.camera.position.latitude,i=this.view.camera.position.longitude;if(e==null||i==null)return;or(this._weatherTile,(e+90)/180,(i+180)/360);const r=Math.floor(this._weatherTileCount*Math.abs(2*this._weatherTile[0]-1));this._weatherTile[0]=Math.floor(2*this._weatherTileCount*this._weatherTile[0]),this._weatherTile[1]=Math.floor(4*(this._weatherTileCount-r)*this._weatherTile[1]);let n=0,s=0;if(this.view.environment!=null&&this.view.environment.lighting.type!=="virtual"&&this.view.environment.lighting.date!=null){const o=new Date(this.view.environment.lighting.date);o.setUTCHours(this.view.environment.lighting.date.getUTCHours()+(this.view.environment.lighting.displayUTCOffset??0)),n=31*o.getUTCMonth()+o.getUTCDate(),s=o.getUTCFullYear()}this._weatherTile[0]=(this._weatherTile[0]+n)%(2*this._weatherTileCount),this._weatherTile[1]=(this._weatherTile[1]+s%100)%(4*this._weatherTileCount),D4e(this._passParameters.weatherTile,this._weatherTile)||this.setDirty()}initialize(){const e=Tr(this.view.spatialReference);this._passParameters.cloudRadius=.5*e.radius,this.setDirty(),this.updateWeatherTile(),this.addHandles([this.view.resourceController.scheduler.registerTask(ni.CLOUDS_GENERATOR,this),_e(()=>[this.coverage,this.density,this.absorption,this.cloudSize,this.detailSize,this.smoothness,this.cloudHeight,this.raymarchingSteps],()=>this.setDirty(),Qt)])}destroy(){this._techniques.forEach(e=>ir(e)),this._frameBufferCube=Kt(this._frameBufferCube),this._techniques.length=0,this._vao.dispose(),this._passParameters.noiseTexture=et(this._passParameters.noiseTexture)}get _tilesPerFace(){switch(this._techniqueConfiguration.steps){case Xu.SIXTEEN:return 1;case Xu.HUNDRED:return 4;case Xu.COUNT:case Xu.TWOHUNDRED:return 8}}get usedMemory(){var e,i,r;return(((e=this._frameBufferCube)==null?void 0:e.gpuMemoryUsage)??0)+(((r=(i=this._passParameters.noiseTexture)==null?void 0:i.textureAtlas)==null?void 0:r.gpuMemoryUsage)??0)}_ensureNoiseTexture(){if(this._passParameters.noiseTexture!=null)this._passParameters.noiseTexture.updateWeatherMap(this._passParameters.weatherTile);else{const e=this.context;this._passParameters.noiseTexture=new y4({context:e}),this._passParameters.noiseTexture.updateWeatherMap(this._passParameters.weatherTile)}return this._passParameters.noiseTexture.textureAtlas!=null}_ensureFrameBufferCube(e){if(this._frameBufferCube==null){const i=new rn(e);i.target=qs.TEXTURE_CUBE_MAP,i.wrapMode=Bi.CLAMP_TO_EDGE,this._frameBufferCube=new Zm(this.context.renderContext.rctx,i)}return this._frameBufferCube}get cubeMap(){return this._frameBufferCube}destroyFrameBufferCube(){this._frameBufferCube=Kt(this._frameBufferCube)}applyPreset(e,i){const r=e.median,n=s=>{const o=ui(s[0],s[1],r);return i<.5?ui(s[0],o,2*i):ui(o,s[1],2*(i-.5))};this.coverage=n(e.coverage),this.density=n(e.density),this.absorption=n(e.absorption),this.cloudSize=n(e.cloudSize),this.detailSize=n(e.detailSize),this.smoothness=n(e.smoothness),this.cloudHeight=n(e.cloudHeight),this.raymarchingSteps=e.raymarchingSteps}setDirty(){this._dirty=this.running=!0}runTask(e){this._faceIndex===0&&this._tileIndex===0&&(this._passParameters.raymarchingSteps=this.raymarchingSteps,this.updateWeatherTile(),ea(this._passParameters.weatherTile,this._weatherTile));const i=this._getTechnique(this._passParameters.raymarchingSteps);if(!i.compiled||this.context.renderContext.bindParameters.cloudsFade.fadeMode===Vn.CROSS_FADE||!this._ensureNoiseTexture())return Jl.YIELD;this._faceIndex===0&&this._tileIndex===0&&(this.context.renderContext.bindParameters.cloudsFade.renderingStage=xy.RENDERING,this._passParameters.absorption=this.absorption,this._passParameters.density=this.density,this._passParameters.cloudSize=this.cloudSize,this._passParameters.detailSize=this.detailSize,this._passParameters.smoothness=this.smoothness,this._passParameters.cloudHeight=this.cloudHeight,this._passParameters.coverage=this.coverage,this._dirty=!1);const r=this.context.renderContext.rctx,n=r.bindTechnique(i,this._passParameters,this._bindParameters);r.bindVAO(this._vao),n.assertCompatibleVertexAttributeLocations(this._vao);const s=r.getViewport(),o=i.configuration.cubeMapSize,a=o/this._tilesPerFace,c=this._tileIndex*a;r.setViewport(0,c,o,a);const p=this._ensureFrameBufferCube(o);r.bindFramebuffer(p);const _=Syt[this._faceIndex],x=Tyt[this._faceIndex];mCe(this._viewMatrix,Eyt,_,x),Kf(this._drawParameters.viewMatrix,this._viewMatrix);const S=qs.TEXTURE_CUBE_MAP_POSITIVE_X+this._faceIndex;return p.setColorTextureTarget(S),n.bindDraw(this._drawParameters,this._bindParameters,this._passParameters),r.gl.drawArrays(r.gl.TRIANGLE_STRIP,0,4),r.gl.flush(),r.setViewport(s.x,s.y,s.width,s.height),this.requestRender(),++this._tileIndex,this._faceIndex===4&&this._tileIndex===this._tilesPerFace?(this.running=this._dirty,this._faceIndex=0,this._tileIndex=0,this.running||(this.context.renderContext.bindParameters.cloudsFade.renderingStage=xy.FADING)):this._tileIndex===this._tilesPerFace&&(++this._faceIndex,this._tileIndex=0),e.madeProgress(),Jl.YIELD}};y([w({constructOnly:!0})],Pu.prototype,"context",void 0),y([w({constructOnly:!0})],Pu.prototype,"view",void 0),y([w({constructOnly:!0})],Pu.prototype,"requestRender",void 0),y([w()],Pu.prototype,"coverage",void 0),y([w()],Pu.prototype,"density",void 0),y([w()],Pu.prototype,"absorption",void 0),y([w()],Pu.prototype,"cloudSize",void 0),y([w()],Pu.prototype,"detailSize",void 0),y([w()],Pu.prototype,"smoothness",void 0),y([w()],Pu.prototype,"cloudHeight",void 0),y([w()],Pu.prototype,"raymarchingSteps",void 0),y([w()],Pu.prototype,"running",void 0),Pu=y([Z("esri.views.3d.environment.CloudsGenerator")],Pu);const Syt=[mn(1,0,0),mn(-1,0,0),mn(0,1,0),mn(0,-1,0),mn(0,0,1)],Tyt=[mn(0,1,0),mn(0,1,0),mn(0,0,-1),mn(0,0,1),mn(0,1,0)],Eyt=Fae();let Bae=class extends bn{constructor(){super(...arguments),this.fogColor=W(),this.fogStrength=4e-6,this.atmosphereC=1,this.fogAmount=0}};function U$e(){const t=new Ar;t.attributes.add(J.POSITION,"vec2"),t.include(Ly,{textureCoordinateType:To.Default}),t.varyings.add("worldRay","vec3"),t.varyings.add("eyeDir","vec3");const{vertex:e,fragment:i}=t;return e.uniforms.add(new bs("inverseProjectionMatrix",(r,n)=>n.camera.inverseProjectionMatrix),new bs("inverseViewMatrix",(r,n)=>u5(Cyt,n.camera.viewMatrix))),e.code.add(V`void main(void) { vec3 posViewNear = (inverseProjectionMatrix * vec4(position, -1, 1)).xyz; eyeDir = posViewNear; worldRay = (inverseViewMatrix * vec4(posViewNear, 0)).xyz; forwardTextureCoordinates(); gl_Position = vec4(position, 1, 1); -}`),i.uniforms.add(new ft("atmosphereC",r=>r.atmosphereC),new Oi("cameraPosition",(r,n)=>n.camera.eye),new ln("nearFar",(r,n)=>n.camera.nearFar),new Zt("depthTexture",r=>r.depthTexture),new ft("fogStrength",r=>r.fogStrength),new ft("fogAmount",r=>r.fogAmount),new Oi("fogColor",r=>r.fogColor)),t.include(Aj),i.include(Kf),i.code.add(V`vec2 sphereIntersect(vec3 start, vec3 dir) { +}`),i.uniforms.add(new ft("atmosphereC",r=>r.atmosphereC),new Oi("cameraPosition",(r,n)=>n.camera.eye),new cn("nearFar",(r,n)=>n.camera.nearFar),new Zt("depthTexture",r=>r.depthTexture),new ft("fogStrength",r=>r.fogStrength),new ft("fogAmount",r=>r.fogAmount),new Oi("fogColor",r=>r.fogColor)),t.include(Fj),i.include(i0),i.code.add(V`vec2 sphereIntersect(vec3 start, vec3 dir) { float a = dot(dir, dir); float b = 2.0 * dot(dir, start); float d = (b * b) - 4.0 * a * atmosphereC; @@ -1026,7 +1015,7 @@ terrainDepth = max(0.0, length(cameraSpaceRay)); } vec4 fog = applyFog(terrainDepth, rayDir); fragColor = delinearizeGamma(vec4(tonemapACES(fog.rgb), fog.a)); -}`),t}const A1t=Qe(),M1t=Object.freeze(Object.defineProperty({__proto__:null,FogPassParameters:Oae,build:G$e},Symbol.toStringTag,{value:"Module"}));let H$e=class q$e extends Hr{constructor(e){super(e,new nh,()=>this.destroy())}initializeProgram(e){return new Ir(e.rctx,q$e.shader.get().build(),Er)}initializePipeline(){return Ti({blending:Ol(st.SRC_ALPHA,st.ZERO,st.ONE_MINUS_SRC_ALPHA,st.ONE),colorWrite:ji})}};H$e.shader=new Rr(M1t,()=>we(()=>Promise.resolve().then(()=>yWt),void 0));const O1t=.95,P1t=1;let Y3=class extends ze{constructor(e){super(e),this._passParameters=new Oae;const i=e.context.renderContext.rctx;this._vao=u1(i,H9),this._technique=new H$e(e);const r=Sr(e.view.spatialReference);this._planetRadius=r.radius,this._atmosphereRadius=r.radius+Nw}destroy(){this._technique.release(),this._vao.dispose()}set strength(e){this._passParameters.fogStrength=e}get strength(){return this._passParameters.fogStrength}render(e,i){if(this._update(e,i),this._passParameters.fogAmount<=0)return;const r=this._technique;if(!r.compiled)return void this.context.requestRender();const n=e.offscreenRenderingHelper;n.renderDepthDetached(()=>{this._passParameters.depthTexture=n.depthTexture;const s=e.rctx.bindTechnique(r,this._passParameters,e.bindParameters);this._renderFog(s,e)})}_renderFog(e,i){const r=i.rctx;r.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(sr.TRIANGLE_STRIP,0,4)}_update(e,i){const r=e.bindParameters.camera;Ye(jme,r.eye);const n=Math.max(0,Ve(jme,e.bindParameters.lighting.mainLight.direction)),s=i.color;De(Gme,s,.1),Qr(this._passParameters.fogColor,Gme,s,n);const o=rt(r.eye),l=o*o;this._passParameters.atmosphereC=l-this._atmosphereRadius*this._atmosphereRadius,this._passParameters.fogAmount=(1-pL(O1t*Pv,P1t*Pv,Math.abs(o-this._planetRadius)))*i.amount,this._passParameters.fogStrength=i.strength}static isSupported(e){return e.capabilities.depthTexture}};y([w({constructOnly:!0})],Y3.prototype,"context",void 0),y([w({constructOnly:!0})],Y3.prototype,"view",void 0),y([w({constructOnly:!0})],Y3.prototype,"rctx",void 0),y([w({constructOnly:!0})],Y3.prototype,"viewingMode",void 0),Y3=y([Z("esri.views.3d.environment.Fog")],Y3);let R1t=class{constructor(){this.color=W(),this.strength=0,this.amount=0}};const jme=W(),Gme=W();var ue;(function(t){t[t.Color=0]="Color",t[t.Depth=1]="Depth",t[t.Normal=2]="Normal",t[t.Shadow=3]="Shadow",t[t.ShadowHighlight=4]="ShadowHighlight",t[t.ShadowExcludeHighlight=5]="ShadowExcludeHighlight",t[t.Highlight=6]="Highlight",t[t.Alpha=7]="Alpha",t[t.ObjectAndLayerIdColor=8]="ObjectAndLayerIdColor",t[t.CompositeColor=9]="CompositeColor",t[t.COUNT=10]="COUNT"})(ue||(ue={}));function Pae({code:t},e){e.doublePrecisionRequiresObfuscation?t.add(V`vec3 dpPlusFrc(vec3 a, vec3 b) { +}`),t}const Cyt=Qe(),Ayt=Object.freeze(Object.defineProperty({__proto__:null,FogPassParameters:Bae,build:U$e},Symbol.toStringTag,{value:"Module"}));let V$e=class B$e extends Hr{constructor(e){super(e,new oh,()=>this.destroy())}initializeProgram(e){return new $r(e.rctx,B$e.shader.get().build(),Cr)}initializePipeline(){return Ti({blending:Pl(ot.SRC_ALPHA,ot.ZERO,ot.ONE_MINUS_SRC_ALPHA,ot.ONE),colorWrite:ji})}};V$e.shader=new Ir(Ayt,()=>we(()=>Promise.resolve().then(()=>QYt),void 0));const Myt=.95,Oyt=1;let eS=class extends ze{constructor(e){super(e),this._passParameters=new Bae;const i=e.context.renderContext.rctx;this._vao=v1(i,Z9),this._technique=new V$e(e);const r=Tr(e.view.spatialReference);this._planetRadius=r.radius,this._atmosphereRadius=r.radius+Vw}destroy(){this._technique.release(),this._vao.dispose()}set strength(e){this._passParameters.fogStrength=e}get strength(){return this._passParameters.fogStrength}render(e,i){if(this._update(e,i),this._passParameters.fogAmount<=0)return;const r=this._technique;if(!r.compiled)return void this.context.requestRender();const n=e.offscreenRenderingHelper;n.renderDepthDetached(()=>{this._passParameters.depthTexture=n.depthTexture;const s=e.rctx.bindTechnique(r,this._passParameters,e.bindParameters);this._renderFog(s,e)})}_renderFog(e,i){const r=i.rctx;r.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),r.drawArrays(sr.TRIANGLE_STRIP,0,4)}_update(e,i){const r=e.bindParameters.camera;Ye(Gme,r.eye);const n=Math.max(0,Ve(Gme,e.bindParameters.lighting.mainLight.direction)),s=i.color;De(Hme,s,.1),Qr(this._passParameters.fogColor,Hme,s,n);const o=nt(r.eye),a=o*o;this._passParameters.atmosphereC=a-this._atmosphereRadius*this._atmosphereRadius,this._passParameters.fogAmount=(1-bL(Myt*kv,Oyt*kv,Math.abs(o-this._planetRadius)))*i.amount,this._passParameters.fogStrength=i.strength}static isSupported(e){return e.capabilities.depthTexture}};y([w({constructOnly:!0})],eS.prototype,"context",void 0),y([w({constructOnly:!0})],eS.prototype,"view",void 0),y([w({constructOnly:!0})],eS.prototype,"rctx",void 0),y([w({constructOnly:!0})],eS.prototype,"viewingMode",void 0),eS=y([Z("esri.views.3d.environment.Fog")],eS);let Pyt=class{constructor(){this.color=W(),this.strength=0,this.amount=0}};const Gme=W(),Hme=W();var ue;(function(t){t[t.Color=0]="Color",t[t.Depth=1]="Depth",t[t.Normal=2]="Normal",t[t.Shadow=3]="Shadow",t[t.ShadowHighlight=4]="ShadowHighlight",t[t.ShadowExcludeHighlight=5]="ShadowExcludeHighlight",t[t.Highlight=6]="Highlight",t[t.Alpha=7]="Alpha",t[t.ObjectAndLayerIdColor=8]="ObjectAndLayerIdColor",t[t.CompositeColor=9]="CompositeColor",t[t.COUNT=10]="COUNT"})(ue||(ue={}));function jae({code:t},e){e.doublePrecisionRequiresObfuscation?t.add(V`vec3 dpPlusFrc(vec3 a, vec3 b) { return mix(a, a + b, vec3(notEqual(b, vec3(0)))); } vec3 dpMinusFrc(vec3 a, vec3 b) { @@ -1042,7 +1031,7 @@ vec3 t1 = hiA + hiB; vec3 e = t1 - hiA; vec3 t2 = ((hiB - e) + (hiA - (t1 - e))) + loA + loB; return t1 + t2; -}`)}let W$e=class extends Ls{constructor(e,i){super(e,"mat4",Or.Draw,(r,n,s)=>r.setUniformMatrix4fv(e,i(n,s)))}};function Nm(t,e){e.instancedDoublePrecision?t.constants.add("cameraPosition","vec3",Ka):t.uniforms.add(new yp("cameraPosition",(i,r)=>Ie(Y$e,r.camera.viewInverseTransposeMatrix[3]-i.origin[0],r.camera.viewInverseTransposeMatrix[7]-i.origin[1],r.camera.viewInverseTransposeMatrix[11]-i.origin[2])))}function Kh(t,e){if(!e.instancedDoublePrecision)return void t.uniforms.add(new _s("proj",(r,n)=>n.camera.projectionMatrix),new W$e("view",(r,n)=>Qu(Hme,n.camera.viewMatrix,r.origin)),new yp("localOrigin",r=>r.origin));const i=r=>Ie(Y$e,r.camera.viewInverseTransposeMatrix[3],r.camera.viewInverseTransposeMatrix[7],r.camera.viewInverseTransposeMatrix[11]);t.uniforms.add(new _s("proj",(r,n)=>n.camera.projectionMatrix),new _s("view",(r,n)=>Qu(Hme,n.camera.viewMatrix,i(n))),new Oi("localOrigin",(r,n)=>i(n)))}const Hme=Qe(),Y$e=W();function S5(t){t.uniforms.add(new _s("viewNormal",(e,i)=>i.camera.viewInverseTransposeMatrix))}function bP(t){t.uniforms.add(new ft("pixelRatio",(e,i)=>i.camera.pixelRatio/i.overlayStretch))}let Wm=class extends Ls{constructor(e,i){super(e,"mat3",Or.Pass,(r,n,s)=>r.setUniformMatrix3fv(e,i(n,s)))}};function Hee(t,e,i){for(let r=0;rs.modelTransformation??gs)),t.vertex.uniforms.add(new Wm("normalLocalOriginFromModel",s=>(v_(qme,s.modelTransformation??gs),qme)))),e.instanced&&r&&(t.attributes.add(J.INSTANCEMODELORIGINHI,"vec3"),t.attributes.add(J.INSTANCEMODELORIGINLO,"vec3"),t.attributes.add(J.INSTANCEMODEL,"mat3"),t.attributes.add(J.INSTANCEMODELNORMAL,"mat3"));const n=t.vertex;r&&(n.include(Pae,e),n.uniforms.add(new yp("viewOriginHi",(s,o)=>I1t(Ie(WD,o.camera.viewInverseTransposeMatrix[3],o.camera.viewInverseTransposeMatrix[7],o.camera.viewInverseTransposeMatrix[11]),WD)),new yp("viewOriginLo",(s,o)=>$1t(Ie(WD,o.camera.viewInverseTransposeMatrix[3],o.camera.viewInverseTransposeMatrix[7],o.camera.viewInverseTransposeMatrix[11]),WD)))),n.code.add(V` +}`)}let j$e=class extends Ds{constructor(e,i){super(e,"mat4",Pr.Draw,(r,n,s)=>r.setUniformMatrix4fv(e,i(n,s)))}};function zm(t,e){e.instancedDoublePrecision?t.constants.add("cameraPosition","vec3",el):t.uniforms.add(new wp("cameraPosition",(i,r)=>Ie(G$e,r.camera.viewInverseTransposeMatrix[3]-i.origin[0],r.camera.viewInverseTransposeMatrix[7]-i.origin[1],r.camera.viewInverseTransposeMatrix[11]-i.origin[2])))}function td(t,e){if(!e.instancedDoublePrecision)return void t.uniforms.add(new bs("proj",(r,n)=>n.camera.projectionMatrix),new j$e("view",(r,n)=>eh(qme,n.camera.viewMatrix,r.origin)),new wp("localOrigin",r=>r.origin));const i=r=>Ie(G$e,r.camera.viewInverseTransposeMatrix[3],r.camera.viewInverseTransposeMatrix[7],r.camera.viewInverseTransposeMatrix[11]);t.uniforms.add(new bs("proj",(r,n)=>n.camera.projectionMatrix),new bs("view",(r,n)=>eh(qme,n.camera.viewMatrix,i(n))),new Oi("localOrigin",(r,n)=>i(n)))}const qme=Qe(),G$e=W();function IP(t){t.uniforms.add(new bs("viewNormal",(e,i)=>i.camera.viewInverseTransposeMatrix))}function P5(t){t.uniforms.add(new ft("pixelRatio",(e,i)=>i.camera.pixelRatio/i.overlayStretch))}let Km=class extends Ds{constructor(e,i){super(e,"mat3",Pr.Pass,(r,n,s)=>r.setUniformMatrix3fv(e,i(n,s)))}};function Qee(t,e,i){for(let r=0;rs.modelTransformation??gs)),t.vertex.uniforms.add(new Km("normalLocalOriginFromModel",s=>(E_(Wme,s.modelTransformation??gs),Wme)))),e.instanced&&r&&(t.attributes.add(J.INSTANCEMODELORIGINHI,"vec3"),t.attributes.add(J.INSTANCEMODELORIGINLO,"vec3"),t.attributes.add(J.INSTANCEMODEL,"mat3"),t.attributes.add(J.INSTANCEMODELNORMAL,"mat3"));const n=t.vertex;r&&(n.include(jae,e),n.uniforms.add(new wp("viewOriginHi",(s,o)=>Ryt(Ie(eN,o.camera.viewInverseTransposeMatrix[3],o.camera.viewInverseTransposeMatrix[7],o.camera.viewInverseTransposeMatrix[11]),eN)),new wp("viewOriginLo",(s,o)=>Iyt(Ie(eN,o.camera.viewInverseTransposeMatrix[3],o.camera.viewInverseTransposeMatrix[7],o.camera.viewInverseTransposeMatrix[11]),eN)))),n.code.add(V` vec3 getVertexInLocalOriginSpace() { return ${i?r?"(model * vec4(instanceModel * localPosition().xyz, 1.0)).xyz":"(model * localPosition()).xyz":r?"instanceModel * localPosition().xyz":"localPosition().xyz"}; } @@ -1059,14 +1048,14 @@ return t1 + t2; vec3 dpNormal(vec4 _normal) { return normalize(${i?r?"normalLocalOriginFromModel * (instanceModelNormal * _normal.xyz)":"normalLocalOriginFromModel * _normal.xyz":r?"instanceModelNormal * _normal.xyz":"_normal.xyz"}); } - `),e.output===ue.Normal&&(S5(n),n.code.add(V` + `),e.output===ue.Normal&&(IP(n),n.code.add(V` vec3 dpNormalView(vec4 _normal) { return normalize((viewNormal * ${i?r?"vec4(normalLocalOriginFromModel * (instanceModelNormal * _normal.xyz), 1.0)":"vec4(normalLocalOriginFromModel * _normal.xyz, 1.0)":r?"vec4(instanceModelNormal * _normal.xyz, 1.0)":"_normal"}).xyz); } `)),e.hasVertexTangents&&n.code.add(V` vec4 dpTransformVertexTangent(vec4 _tangent) { ${i?r?"return vec4(normalLocalOriginFromModel * (instanceModelNormal * _tangent.xyz), _tangent.w);":"return vec4(normalLocalOriginFromModel * _tangent.xyz, _tangent.w);":r?"return vec4(instanceModelNormal * _tangent.xyz, _tangent.w);":"return _tangent;"} - }`)}const WD=W();let hu=class extends qee{};y([fe({constValue:!0})],hu.prototype,"hasSliceHighlight",void 0),y([fe({constValue:!1})],hu.prototype,"hasSliceInVertexProgram",void 0),y([fe({constValue:Or.Pass})],hu.prototype,"pbrTextureBindType",void 0);var Zy;(function(t){t[t.Cone=0]="Cone",t[t.Cylinder=1]="Cylinder",t[t.Underground=2]="Underground",t[t.COUNT=3]="COUNT"})(Zy||(Zy={}));let Rae=class extends hu{constructor(){super(...arguments),this.geometry=Zy.Cone}};y([fe({count:Zy.COUNT})],Rae.prototype,"geometry",void 0);function W9(t){t.attributes.add(J.POSITION,"vec3"),t.vertex.code.add(V`vec3 positionModel() { return position; }`)}function gO(t,e){t.include(W9);const i=t.vertex;i.include(Pae,e),t.varyings.add("vPositionWorldCameraRelative","vec3"),t.varyings.add("vPosition_view","vec3"),i.uniforms.add(new Oi("transformWorldFromViewTH",r=>r.transformWorldFromViewTH),new Oi("transformWorldFromViewTL",r=>r.transformWorldFromViewTL),new Wm("transformViewFromCameraRelativeRS",r=>r.transformViewFromCameraRelativeRS),new _s("transformProjFromView",r=>r.transformProjFromView),new ML("transformWorldFromModelRS",r=>r.transformWorldFromModelRS),new yp("transformWorldFromModelTH",r=>r.transformWorldFromModelTH),new yp("transformWorldFromModelTL",r=>r.transformWorldFromModelTL)),i.code.add(V`vec3 positionWorldCameraRelative() { + }`)}const eN=W();let pu=class extends ete{};y([fe({constValue:!0})],pu.prototype,"hasSliceHighlight",void 0),y([fe({constValue:!1})],pu.prototype,"hasSliceInVertexProgram",void 0),y([fe({constValue:Pr.Pass})],pu.prototype,"pbrTextureBindType",void 0);var r1;(function(t){t[t.Cone=0]="Cone",t[t.Cylinder=1]="Cylinder",t[t.Underground=2]="Underground",t[t.COUNT=3]="COUNT"})(r1||(r1={}));let Gae=class extends pu{constructor(){super(...arguments),this.geometry=r1.Cone}};y([fe({count:r1.COUNT})],Gae.prototype,"geometry",void 0);function K9(t){t.attributes.add(J.POSITION,"vec3"),t.vertex.code.add(V`vec3 positionModel() { return position; }`)}function SO(t,e){t.include(K9);const i=t.vertex;i.include(jae,e),t.varyings.add("vPositionWorldCameraRelative","vec3"),t.varyings.add("vPosition_view","vec3"),i.uniforms.add(new Oi("transformWorldFromViewTH",r=>r.transformWorldFromViewTH),new Oi("transformWorldFromViewTL",r=>r.transformWorldFromViewTL),new Km("transformViewFromCameraRelativeRS",r=>r.transformViewFromCameraRelativeRS),new bs("transformProjFromView",r=>r.transformProjFromView),new FL("transformWorldFromModelRS",r=>r.transformWorldFromModelRS),new wp("transformWorldFromModelTH",r=>r.transformWorldFromModelTH),new wp("transformWorldFromModelTL",r=>r.transformWorldFromModelTL)),i.code.add(V`vec3 positionWorldCameraRelative() { vec3 rotatedModelPosition = transformWorldFromModelRS * positionModel(); vec3 transform_CameraRelativeFromModel = dpAdd( transformWorldFromModelTL, @@ -1089,24 +1078,24 @@ return transform_CameraRelativeFromModel + rotatedModelPosition; return transformWorldFromViewTL + vPositionWorldCameraRelative; }`),t.fragment.code.add(V`vec3 positionWorld() { return transformWorldFromViewTL + vPositionWorldCameraRelative; -}`)}let Z$e=class extends _n{constructor(){super(...arguments),this.transformWorldFromViewTH=W(),this.transformWorldFromViewTL=W(),this.transformViewFromCameraRelativeRS=as(),this.transformProjFromView=Qe()}},J$e=class extends _n{constructor(){super(...arguments),this.transformWorldFromModelRS=as(),this.transformWorldFromModelTH=W(),this.transformWorldFromModelTL=W()}};function B2(t){t.varyings.add("linearDepth","float")}function XT(t){t.vertex.uniforms.add(new ln("nearFar",(e,i)=>i.camera.nearFar))}function Rj(t){t.vertex.code.add(V`float calculateLinearDepth(vec2 nearFar,float z) { +}`)}let q$e=class extends bn{constructor(){super(...arguments),this.transformWorldFromViewTH=W(),this.transformWorldFromViewTL=W(),this.transformViewFromCameraRelativeRS=as(),this.transformProjFromView=Qe()}},W$e=class extends bn{constructor(){super(...arguments),this.transformWorldFromModelRS=as(),this.transformWorldFromModelTH=W(),this.transformWorldFromModelTL=W()}};function W2(t){t.varyings.add("linearDepth","float")}function eE(t){t.vertex.uniforms.add(new cn("nearFar",(e,i)=>i.camera.nearFar))}function Vj(t){t.vertex.code.add(V`float calculateLinearDepth(vec2 nearFar,float z) { return (-z - nearFar[0]) / (nearFar[1] - nearFar[0]); -}`)}function wP(t,e){const{vertex:i}=t;switch(e.output){case ue.Color:if(e.receiveShadows)return B2(t),void i.code.add(V`void forwardLinearDepth() { linearDepth = gl_Position.w; }`);break;case ue.Depth:case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:return t.include(gO,e),B2(t),XT(t),Rj(t),void i.code.add(V`void forwardLinearDepth() { +}`)}function R5(t,e){const{vertex:i}=t;switch(e.output){case ue.Color:if(e.receiveShadows)return W2(t),void i.code.add(V`void forwardLinearDepth() { linearDepth = gl_Position.w; }`);break;case ue.Depth:case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:return t.include(SO,e),W2(t),eE(t),Vj(t),void i.code.add(V`void forwardLinearDepth() { linearDepth = calculateLinearDepth(nearFar, vPosition_view.z); -}`)}i.code.add(V`void forwardLinearDepth() {}`)}function Yu(t){Rj(t),t.vertex.code.add(V`vec4 transformPositionWithDepth(mat4 proj, mat4 view, vec3 pos, vec2 nearFar, out float depth) { +}`)}i.code.add(V`void forwardLinearDepth() {}`)}function Zu(t){Vj(t),t.vertex.code.add(V`vec4 transformPositionWithDepth(mat4 proj, mat4 view, vec3 pos, vec2 nearFar, out float depth) { vec4 eye = view * vec4(pos, 1.0); depth = calculateLinearDepth(nearFar,eye.z); return proj * eye; }`),t.vertex.code.add(V`vec4 transformPosition(mat4 proj, mat4 view, vec3 pos) { return proj * (view * vec4(pos, 1.0)); -}`)}let Ij=class extends _n{constructor(){super(...arguments),this.texV=yt(),this.altitudeFade=0,this.innerScale=0,this.undergroundFadeAlpha=0,this.silhouette=new Iae}},Iae=class{constructor(){this.center=W(),this.v1=W(),this.v2=W()}};function K$e(t){const e=new Cr,{vertex:i,fragment:r}=e;if(B_(i),t.geometry===Zy.Underground)e.attributes.add(J.POSITION,"vec2"),e.varyings.add("color","vec4"),i.uniforms.add(new Oi("cameraPosition",(n,s)=>s.camera.eye),new ft("undergroundFadeAlpha",n=>n.undergroundFadeAlpha)),i.code.add(V`void main(void) { +}`)}let Bj=class extends bn{constructor(){super(...arguments),this.texV=yt(),this.altitudeFade=0,this.innerScale=0,this.undergroundFadeAlpha=0,this.silhouette=new Hae}},Hae=class{constructor(){this.center=W(),this.v1=W(),this.v2=W()}};function Y$e(t){const e=new Ar,{vertex:i,fragment:r}=e;if(W_(i),t.geometry===r1.Underground)e.attributes.add(J.POSITION,"vec2"),e.varyings.add("color","vec4"),i.uniforms.add(new Oi("cameraPosition",(n,s)=>s.camera.eye),new ft("undergroundFadeAlpha",n=>n.undergroundFadeAlpha)),i.code.add(V`void main(void) { float ndotl = dot(normalize(cameraPosition), mainLightDirection); float lighting = max(0.0, smoothstep(-1.0, 0.8, 2.0 * ndotl)); color = vec4(vec3(lighting), undergroundFadeAlpha); gl_Position = vec4(position.xy, 1.0, 1.0); }`),r.code.add(V`void main() { fragColor = color; -}`);else{e.include(Yu,t),e.attributes.add(J.POSITION,"vec3"),e.varyings.add("vtc","vec2"),e.varyings.add("falloff","float");const n=t.geometry===Zy.Cylinder;i.uniforms.add(new _s("proj",(l,c)=>c.camera.projectionMatrix),new _s("view",(l,c)=>c.camera.viewMatrix)),n||(e.varyings.add("innerFactor","float"),i.uniforms.add(new Oi("silCircleCenter",l=>l.silhouette.center)),i.uniforms.add(new Oi("silCircleV1",l=>l.silhouette.v1)),i.uniforms.add(new Oi("silCircleV2",l=>l.silhouette.v2)),i.uniforms.add(new ln("texV",l=>l.texV)),i.uniforms.add(new ft("innerScale",l=>l.innerScale)));const s=6.2831853,o=1/128;i.code.add(V` +}`);else{e.include(Zu,t),e.attributes.add(J.POSITION,"vec3"),e.varyings.add("vtc","vec2"),e.varyings.add("falloff","float");const n=t.geometry===r1.Cylinder;i.uniforms.add(new bs("proj",(a,c)=>c.camera.projectionMatrix),new bs("view",(a,c)=>c.camera.viewMatrix)),n||(e.varyings.add("innerFactor","float"),i.uniforms.add(new Oi("silCircleCenter",a=>a.silhouette.center)),i.uniforms.add(new Oi("silCircleV1",a=>a.silhouette.v1)),i.uniforms.add(new Oi("silCircleV2",a=>a.silhouette.v2)),i.uniforms.add(new cn("texV",a=>a.texV)),i.uniforms.add(new ft("innerScale",a=>a.innerScale)));const s=6.2831853,o=1/128;i.code.add(V` void main(void) { ${n?V` vec3 pos = position; @@ -1125,14 +1114,14 @@ fragColor = color; gl_Position = transformPosition(proj, view, pos); gl_Position.z = gl_Position.w; // project atmosphere onto the far plane } - `),r.uniforms.add(new Zt("tex",l=>l.texture)),n||r.uniforms.add(new ft("altitudeFade",l=>l.altitudeFade)),r.code.add(V` + `),r.uniforms.add(new Zt("tex",a=>a.texture)),n||r.uniforms.add(new ft("altitudeFade",a=>a.altitudeFade)),r.code.add(V` void main() { vec4 atmosphereColor = texture(tex, vtc) * falloff; ${n?V`fragColor = atmosphereColor;`:V` vec4 innerColor = vec4(atmosphereColor.rgb, 1.0 - altitudeFade); fragColor = mix(atmosphereColor, innerColor, smoothstep(0.0, 1.0, innerFactor)); `} - }`)}return e}const L1t=Object.freeze(Object.defineProperty({__proto__:null,SilhouetteCircle:Iae,SimpleAtmospherePassParameters:Ij,build:K$e},Symbol.toStringTag,{value:"Module"}));let xU=class Q$e extends Hr{initializeProgram(e){return new Ir(e.rctx,Q$e.shader.get().build(this.configuration),Er)}initializePipeline(){return this.configuration.geometry===Zy.Cylinder?Ti({blending:Ol(st.SRC_ALPHA,st.ONE,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),culling:pae,depthTest:{func:Zr.LEQUAL},colorWrite:ji}):Ti({blending:Ol(st.SRC_ALPHA,st.ONE,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};xU.shader=new Rr(L1t,()=>we(()=>Promise.resolve().then(()=>vWt),void 0));const D1t=new Uint8ClampedArray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,9,0,0,0,9,0,0,0,9,0,0,0,9,0,0,0,9,0,0,0,10,0,0,0,10,0,0,0,10,0,0,0,10,0,0,0,11,0,0,0,11,0,0,0,11,0,0,0,11,0,0,0,11,0,0,0,12,0,0,0,12,0,0,0,12,0,0,0,12,0,0,0,13,0,0,0,13,0,0,0,13,0,0,0,13,0,0,0,14,0,0,0,14,0,0,0,14,0,0,0,14,0,0,0,15,0,0,0,15,0,0,0,15,0,0,0,15,0,0,0,15,16,0,0,16,16,0,0,16,16,0,0,16,16,0,0,16,15,0,0,17,15,0,0,17,15,0,0,17,15,0,0,17,14,0,0,18,14,0,0,18,14,0,0,18,13,0,0,19,13,0,0,19,13,0,0,19,13,0,0,19,13,0,0,20,13,0,0,20,13,0,0,20,13,0,0,20,12,0,0,21,12,0,0,21,12,0,0,21,12,0,0,21,12,0,0,22,12,0,0,22,12,0,0,22,12,0,0,22,11,0,0,23,11,0,0,23,11,0,0,23,11,0,0,24,11,0,0,24,11,0,0,24,11,0,0,24,10,0,0,25,10,0,0,25,10,0,0,25,10,0,0,26,10,0,0,26,10,0,0,26,10,0,0,26,9,0,0,27,9,0,0,27,9,0,0,27,18,0,0,28,18,0,0,28,18,0,0,28,18,0,0,28,18,0,0,29,18,0,0,29,18,0,0,29,17,0,0,30,17,0,0,30,17,0,0,30,17,0,0,30,16,0,0,31,16,0,0,31,16,0,0,31,16,0,0,32,16,0,0,32,16,0,0,32,15,0,0,33,15,0,0,33,15,0,0,33,15,0,0,34,15,8,0,34,15,8,0,34,15,8,0,34,15,7,0,35,15,7,0,35,15,7,0,35,21,7,0,36,21,7,0,36,21,7,0,36,21,7,0,37,21,7,0,37,21,7,0,37,20,7,0,38,20,7,0,38,20,7,0,38,20,7,0,39,20,7,0,39,20,7,0,39,20,7,0,39,19,6,0,40,19,6,0,40,19,6,0,40,19,6,0,41,19,6,0,41,19,6,0,41,18,6,0,42,18,6,0,42,18,6,0,42,24,6,0,43,24,6,0,43,24,6,0,43,23,6,0,44,23,6,0,44,23,6,0,44,23,6,0,45,23,6,0,45,23,6,0,45,22,6,0,46,22,6,0,46,22,6,0,46,22,5,0,47,22,5,0,47,22,5,0,47,21,5,0,48,21,5,0,48,21,5,0,48,21,5,0,49,21,5,0,49,26,5,0,49,25,5,0,50,25,5,0,50,25,5,0,50,25,5,0,51,25,5,0,51,25,5,0,51,25,5,0,52,25,5,0,52,25,5,0,52,24,5,0,53,24,5,0,53,24,5,0,53,24,9,0,54,28,9,0,54,28,9,0,54,28,9,0,55,28,9,0,55,27,9,0,56,27,9,0,56,27,9,0,56,27,9,4,57,27,9,4,57,27,9,4,57,26,9,4,58,26,9,4,58,26,9,4,58,26,9,4,59,26,9,4,59,26,9,4,59,26,8,4,60,30,8,4,60,30,8,4,60,29,8,4,61,29,8,4,61,29,8,4,62,29,8,4,62,29,8,4,62,28,8,4,63,28,8,4,63,28,8,4,63,28,12,4,64,28,12,4,64,28,12,4,64,27,12,4,65,27,12,8,65,27,12,8,65,31,12,8,66,31,12,8,66,30,11,8,67,30,11,8,67,30,11,8,67,30,11,8,68,30,11,8,68,30,11,8,68,30,15,7,69,30,15,7,69,30,15,7,69,33,15,11,70,33,15,11,70,32,14,11,71,32,14,11,71,32,14,11,71,32,18,14,72,32,18,14,72,32,18,14,72,31,17,14,73,35,17,14,73,34,17,17,74,34,21,17,74,34,21,17,74,34,20,17,75,34,20,20,75,34,20,20,75,34,23,20,76,34,23,20,76,36,23,23,77,36,23,23,77,36,23,23,77,36,23,23,78,36,26,26,78,36,26,26,78,36,26,26,79,36,26,29,79,38,26,29,80,38,29,29,80,38,29,29,80,38,28,31,81,38,28,31,81,38,31,31,81,37,31,34,82,37,31,34,82,37,31,37,83,40,34,37,83,40,34,37,83,39,33,39,84,39,33,39,84,39,36,42,84,39,36,42,85,39,36,42,85,39,36,42,85,39,39,44,86,39,39,44,86,41,38,47,87,41,41,47,87,41,41,50,87,41,41,49,88,41,41,52,88,40,43,52,89,43,43,52,89,43,43,54,89,42,45,54,90,42,45,57,90,42,45,57,90,42,45,59,91,42,48,59,91,44,47,61,92,44,47,61,92,44,50,61,92,44,49,63,93,44,49,63,93,44,52,66,93,43,52,65,94,46,54,68,94,46,54,70,95,46,54,70,95,46,54,70,95,45,56,72,96,45,56,72,96,45,58,74,97,47,58,76,97,47,58,76,97,47,60,78,98,47,60,78,98,47,60,81,98,49,62,80,99,49,62,82,99,48,61,84,100,48,64,84,100,48,64,84,100,50,63,86,101,50,66,86,101,50,66,88,101,50,65,90,102,52,67,89,103,51,69,91,104,51,68,92,105,52,69,93,107,52,71,94,108,54,70,96,109,53,71,96,111,52,73,98,112,54,72,98,114,53,73,100,115,54,72,100,117,54,73,102,118,55,74,104,120,55,76,105,121,56,77,106,123,56,76,107,124,57,79,107,126,58,78,110,128,57,79,111,129,56,80,113,131,58,79,112,132,57,82,114,134,58,81,116,136,60,82,117,137,59,83,117,139,60,83,119,141,59,84,120,142,60,85,122,144,59,86,122,146,60,86,126,148,62,87,127,149,61,88,127,151,62,88,128,153,63,89,130,155,62,90,131,156,63,90,132,158,64,91,134,160,65,91,135,162,64,92,136,163,63,93,138,165,66,95,139,167,65,95,140,169,66,95,142,171,67,96,142,172,66,97,144,174,67,99,145,176,67,97,148,178,67,99,147,180,68,100,149,181,68,100,150,183,69,101,152,185,70,102,153,187,71,103,155,188,70,103,156,190,70,104,157,192,71,105,158,194,71,106,160,195,72,106,161,197,72,108,161,199,73,108,163,200,73,109,164,202,74,109,165,204,74,110,167,206,75,111,168,207,74,112,170,209,75,112,170,210,76,113,171,212,76,114,173,214,77,115,174,215,78,115,175,217,78,116,175,218,78,117,177,220,78,118,178,221,79,118,180,223,80,120,180,224,81,120,181,226,81,120,182,227,82,121,184,229,82,122,185,230,84,123,186,232,83,123,187,233,84,124,189,234,84,125,188,235,85,126,189,237,86,126,190,238,86,127,191,239,87,127,192,240,87,129,193,242,88,129,194,243,89,130,195,244,90,131,196,245,90,132,197,246,91,132,197,247,92,133,198,248,92,134,199,249,93,135,200,250,94,136,201,251,95,137,202,252,96,138,203,253,97,140,204,254,98,141,205,254,99,142,206,255,101,143,207,255,102,144,208,255,103,146,209,255,104,147,209,255,106,148,210,255,107,149,211,255,108,151,212,255,110,152,213,255,111,153,213,255,112,154,214,255,114,156,215,255,115,157,215,255,117,158,216,255,118,160,217,255,120,161,217,255,121,162,218,255,123,164,218,255,124,165,219,255,125,166,219,255,127,167,220,255,129,169,220,255,130,170,221,255,132,171,221,255,133,173,222,255,134,174,222,255,136,175,223,255,139,178,224,255,142,180,224,255,144,182,225,255,147,185,226,255,150,187,226,255,153,189,227,255,155,191,228,255,158,194,228,255,160,196,229,255,163,198,229,255,165,200,230,255,168,202,231,255,170,203,231,255,172,205,232,255,174,207,232,255,176,209,233,255,178,210,234,255,180,212,234,255,182,214,235,255,184,215,236,255,186,217,237,255,188,219,238,255,190,220,238,255,192,221,239,255,193,222,240,255,194,224,240,255,196,225,241,255,197,226,241,255,198,226,242,255,199,227,242,255,200,228,242,255,201,228,243,255,202,229,243,255,203,230,243,255,204,230,244,255,205,231,244,255,207,232,244,255,208,233,245,255,209,233,245,255,211,234,246,255,213,235,246,255,217,238,247,255,222,240,248,255,226,242,249,255,231,245,250,255,236,247,251,255,241,249,252,255,245,251,253,255,249,252,254,255,255,255,255,255]);function md(t,e=0){const i=t.stride;return Array.from(t.fields.keys()).map(r=>{const n=t.fields.get(r),s=n.constructor.ElementCount,o=N1t(n.constructor.ElementType),l=n.offset,c=!(!n.optional||!n.optional.glNormalized);return new Al(r,s,o,l,i,c,e)})}function N1t(t){const e=F1t[t];if(e)return e;throw new Error("BufferType not supported in WebGL")}const F1t={u8:Yt.UNSIGNED_BYTE,u16:Yt.UNSIGNED_SHORT,u32:Yt.UNSIGNED_INT,i8:Yt.BYTE,i16:Yt.SHORT,i32:Yt.INT,f32:Yt.FLOAT};let $ae=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.elementCount=9;const o=this.TypedArrayConstructor;n===void 0&&(n=9*o.BYTES_PER_ELEMENT);const l=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,l):new o(i,l,(s-r)/o.BYTES_PER_ELEMENT),this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride),this.stride=this.typedBufferStride*this.TypedArrayConstructor.BYTES_PER_ELEMENT}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}getMat(e,i){let r=e*this.typedBufferStride;for(let n=0;n<9;n++)i[n]=this.typedBuffer[r++];return i}setMat(e,i){let r=e*this.typedBufferStride;for(let n=0;n<9;n++)this.typedBuffer[r++]=i[n]}get(e,i){return this.typedBuffer[e*this.typedBufferStride+i]}set(e,i,r){this.typedBuffer[e*this.typedBufferStride+i]=r}copyFrom(e,i,r){const n=this.typedBuffer,s=i.typedBuffer;let o=e*this.typedBufferStride,l=r*i.typedBufferStride;for(let c=0;c<9;++c)n[o++]=s[l++]}get buffer(){return this.typedBuffer.buffer}};$ae.ElementCount=9;let Lae=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.elementCount=16;const o=this.TypedArrayConstructor;n===void 0&&(n=16*o.BYTES_PER_ELEMENT);const l=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,l):new o(i,l,(s-r)/o.BYTES_PER_ELEMENT),this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride),this.stride=this.typedBufferStride*this.TypedArrayConstructor.BYTES_PER_ELEMENT}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}getMat(e,i){let r=e*this.typedBufferStride;for(let n=0;n<16;n++)i[n]=this.typedBuffer[r++];return i}setMat(e,i){let r=e*this.typedBufferStride;for(let n=0;n<16;n++)this.typedBuffer[r++]=i[n]}get(e,i){return this.typedBuffer[e*this.typedBufferStride+i]}set(e,i,r){this.typedBuffer[e*this.typedBufferStride+i]=r}copyFrom(e,i,r){const n=this.typedBuffer,s=i.typedBuffer;let o=e*this.typedBufferStride,l=r*i.typedBufferStride;for(let c=0;c<16;++c)n[o++]=s[l++]}get buffer(){return this.typedBuffer.buffer}};Lae.ElementCount=16;let G_=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.elementCount=1;const o=this.TypedArrayConstructor;n===void 0&&(n=o.BYTES_PER_ELEMENT);const l=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,l):new o(i,l,(s-r)/o.BYTES_PER_ELEMENT),this.stride=n,this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride)}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}get(e){return this.typedBuffer[e*this.typedBufferStride]}set(e,i){this.typedBuffer[e*this.typedBufferStride]=i}get buffer(){return this.typedBuffer.buffer}};G_.ElementCount=1;let H_=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.elementCount=2;const o=this.TypedArrayConstructor;n===void 0&&(n=2*o.BYTES_PER_ELEMENT);const l=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,l):new o(i,l,(s-r)/o.BYTES_PER_ELEMENT),this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride),this.stride=this.typedBufferStride*this.TypedArrayConstructor.BYTES_PER_ELEMENT}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}getVec(e,i){return e*=this.typedBufferStride,or(i,this.typedBuffer[e],this.typedBuffer[e+1])}setVec(e,i){e*=this.typedBufferStride,this.typedBuffer[e++]=i[0],this.typedBuffer[e]=i[1]}get(e,i){return this.typedBuffer[e*this.typedBufferStride+i]}set(e,i,r){this.typedBuffer[e*this.typedBufferStride+i]=r}setValues(e,i,r){e*=this.typedBufferStride,this.typedBuffer[e++]=i,this.typedBuffer[e]=r}copyFrom(e,i,r){const n=this.typedBuffer,s=i.typedBuffer;let o=e*this.typedBufferStride,l=r*i.typedBufferStride;n[o++]=s[l++],n[o]=s[l]}get buffer(){return this.typedBuffer.buffer}};H_.ElementCount=2;let q_=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.elementCount=3;const o=this.TypedArrayConstructor;n===void 0&&(n=3*o.BYTES_PER_ELEMENT);const l=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,l):new o(i,l,(s-r)/o.BYTES_PER_ELEMENT),this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride),this.stride=this.typedBufferStride*this.TypedArrayConstructor.BYTES_PER_ELEMENT}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}getVec(e,i){return e*=this.typedBufferStride,Ie(i,this.typedBuffer[e],this.typedBuffer[e+1],this.typedBuffer[e+2])}setVec(e,i){e*=this.typedBufferStride,this.typedBuffer[e++]=i[0],this.typedBuffer[e++]=i[1],this.typedBuffer[e]=i[2]}get(e,i){return this.typedBuffer[e*this.typedBufferStride+i]}set(e,i,r){this.typedBuffer[e*this.typedBufferStride+i]=r}setValues(e,i,r,n){e*=this.typedBufferStride,this.typedBuffer[e++]=i,this.typedBuffer[e++]=r,this.typedBuffer[e]=n}copyFrom(e,i,r){const n=this.typedBuffer,s=i.typedBuffer;let o=e*this.typedBufferStride,l=r*i.typedBufferStride;n[o++]=s[l++],n[o++]=s[l++],n[o]=s[l]}get buffer(){return this.typedBuffer.buffer}};q_.ElementCount=3;let W_=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.start=r,this.elementCount=4;const o=this.TypedArrayConstructor;n===void 0&&(n=4*o.BYTES_PER_ELEMENT);const l=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,l):new o(i,l,(s-r)/o.BYTES_PER_ELEMENT),this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride),this.stride=this.typedBufferStride*this.TypedArrayConstructor.BYTES_PER_ELEMENT}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}getVec(e,i){return e*=this.typedBufferStride,rs(i,this.typedBuffer[e++],this.typedBuffer[e++],this.typedBuffer[e++],this.typedBuffer[e])}setVec(e,i){e*=this.typedBufferStride,this.typedBuffer[e++]=i[0],this.typedBuffer[e++]=i[1],this.typedBuffer[e++]=i[2],this.typedBuffer[e]=i[3]}get(e,i){return this.typedBuffer[e*this.typedBufferStride+i]}set(e,i,r){this.typedBuffer[e*this.typedBufferStride+i]=r}setValues(e,i,r,n,s){e*=this.typedBufferStride,this.typedBuffer[e++]=i,this.typedBuffer[e++]=r,this.typedBuffer[e++]=n,this.typedBuffer[e]=s}copyFrom(e,i,r){const n=this.typedBuffer,s=i.typedBuffer;let o=e*this.typedBufferStride,l=r*i.typedBufferStride;n[o++]=s[l++],n[o++]=s[l++],n[o++]=s[l++],n[o]=s[l]}get buffer(){return this.typedBuffer.buffer}};W_.ElementCount=4;let $j=class eLe extends G_{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}static fromTypedArray(e,i){return new eLe(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};$j.ElementType="f32";let TE=class Wee extends H_{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}slice(e,i){return this.sliceBuffer(Wee,e,i)}static fromTypedArray(e,i){return new Wee(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};TE.ElementType="f32";let Ea=class Yee extends q_{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}slice(e,i){return this.sliceBuffer(Yee,e,i)}static fromTypedArray(e,i){return new Yee(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Ea.ElementType="f32";let Fm=class Xee extends W_{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}slice(e,i){return this.sliceBuffer(Xee,e,i)}static fromTypedArray(e,i){return new Xee(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Fm.ElementType="f32";let j2=class Zee extends $ae{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}slice(e,i){return this.sliceBuffer(Zee,e,i)}static fromTypedArray(e,i){return new Zee(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};j2.ElementType="f32";let Dae=class Jee extends $ae{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(Jee,e,i)}static fromTypedArray(e,i){return new Jee(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Dae.ElementType="f64";let Nae=class Kee extends Lae{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}slice(e,i){return this.sliceBuffer(Kee,e,i)}static fromTypedArray(e,i){return new Kee(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Nae.ElementType="f32";let PL=class Qee extends Lae{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(Qee,e,i)}static fromTypedArray(e,i){return new Qee(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};PL.ElementType="f64";let Fae=class ete extends G_{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(ete,e,i)}static fromTypedArray(e,i){return new ete(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Fae.ElementType="f64";let kae=class tte extends H_{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(tte,e,i)}static fromTypedArray(e,i){return new tte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};kae.ElementType="f64";let e0=class ite extends q_{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(ite,e,i)}static fromTypedArray(e,i){return new ite(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};e0.ElementType="f64";let Lj=class rte extends W_{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(rte,e,i)}static fromTypedArray(e,i){return new rte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Lj.ElementType="f64";let T5=class nte extends G_{constructor(e,i=0,r,n){super(Uint8Array,e,i,r,n),this.elementType="u8"}slice(e,i){return this.sliceBuffer(nte,e,i)}static fromTypedArray(e,i){return new nte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};T5.ElementType="u8";let Dj=class ste extends H_{constructor(e,i=0,r,n){super(Uint8Array,e,i,r,n),this.elementType="u8"}slice(e,i){return this.sliceBuffer(ste,e,i)}static fromTypedArray(e,i){return new ste(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Dj.ElementType="u8";let Nj=class ote extends q_{constructor(e,i=0,r,n){super(Uint8Array,e,i,r,n),this.elementType="u8"}slice(e,i){return this.sliceBuffer(ote,e,i)}static fromTypedArray(e,i){return new ote(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Nj.ElementType="u8";let Ac=class ate extends W_{constructor(e,i=0,r,n){super(Uint8Array,e,i,r,n),this.elementType="u8"}slice(e,i){return this.sliceBuffer(ate,e,i)}static fromTypedArray(e,i){return new ate(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Ac.ElementType="u8";let Fj=class lte extends G_{constructor(e,i=0,r,n){super(Uint16Array,e,i,r,n),this.elementType="u16"}slice(e,i){return this.sliceBuffer(lte,e,i)}static fromTypedArray(e,i){return new lte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Fj.ElementType="u16";let zae=class cte extends H_{constructor(e,i=0,r,n){super(Uint16Array,e,i,r,n),this.elementType="u16"}slice(e,i){return this.sliceBuffer(cte,e,i)}static fromTypedArray(e,i){return new cte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};zae.ElementType="u16";let kj=class ute extends q_{constructor(e,i=0,r,n){super(Uint16Array,e,i,r,n),this.elementType="u16"}slice(e,i){return this.sliceBuffer(ute,e,i)}static fromTypedArray(e,i){return new ute(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};kj.ElementType="u16";let Y9=class hte extends W_{constructor(e,i=0,r,n){super(Uint16Array,e,i,r,n),this.elementType="u16"}slice(e,i){return this.sliceBuffer(hte,e,i)}static fromTypedArray(e,i){return new hte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Y9.ElementType="u16";let zj=class dte extends G_{constructor(e,i=0,r,n){super(Uint32Array,e,i,r,n),this.elementType="u32"}slice(e,i){return this.sliceBuffer(dte,e,i)}static fromTypedArray(e,i){return new dte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};zj.ElementType="u32";let Uae=class pte extends H_{constructor(e,i=0,r,n){super(Uint32Array,e,i,r,n),this.elementType="u32"}slice(e,i){return this.sliceBuffer(pte,e,i)}static fromTypedArray(e,i){return new pte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Uae.ElementType="u32";let tLe=class fte extends q_{constructor(e,i=0,r,n){super(Uint32Array,e,i,r,n),this.elementType="u32"}slice(e,i){return this.sliceBuffer(fte,e,i)}static fromTypedArray(e,i){return new fte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};tLe.ElementType="u32";let iLe=class mte extends W_{constructor(e,i=0,r,n){super(Uint32Array,e,i,r,n),this.elementType="u32"}slice(e,i){return this.sliceBuffer(mte,e,i)}static fromTypedArray(e,i){return new mte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};iLe.ElementType="u32";let Vae=class gte extends G_{constructor(e,i=0,r,n){super(Int8Array,e,i,r,n),this.elementType="i8"}slice(e,i){return this.sliceBuffer(gte,e,i)}static fromTypedArray(e,i){return new gte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Vae.ElementType="i8";let Uj=class yte extends H_{constructor(e,i=0,r,n){super(Int8Array,e,i,r,n),this.elementType="i8"}slice(e,i){return this.sliceBuffer(yte,e,i)}static fromTypedArray(e,i){return new yte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Uj.ElementType="i8";let rLe=class vte extends q_{constructor(e,i=0,r,n){super(Int8Array,e,i,r,n),this.elementType="i8"}slice(e,i){return this.sliceBuffer(vte,e,i)}static fromTypedArray(e,i){return new vte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};rLe.ElementType="i8";let nLe=class _te extends W_{constructor(e,i=0,r,n){super(Int8Array,e,i,r,n),this.elementType="i8"}slice(e,i){return this.sliceBuffer(_te,e,i)}static fromTypedArray(e,i){return new _te(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};nLe.ElementType="i8";let sLe=class bte extends G_{constructor(e,i=0,r,n){super(Int16Array,e,i,r,n),this.elementType="i16"}slice(e,i){return this.sliceBuffer(bte,e,i)}static fromTypedArray(e,i){return new bte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};sLe.ElementType="i16";let X9=class wte extends H_{constructor(e,i=0,r,n){super(Int16Array,e,i,r,n),this.elementType="i16"}slice(e,i){return this.sliceBuffer(wte,e,i)}static fromTypedArray(e,i){return new wte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};X9.ElementType="i16";let oLe=class xte extends q_{constructor(e,i=0,r,n){super(Int16Array,e,i,r,n),this.elementType="i16"}slice(e,i){return this.sliceBuffer(xte,e,i)}static fromTypedArray(e,i){return new xte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};oLe.ElementType="i16";let aLe=class Ste extends W_{constructor(e,i=0,r,n){super(Int16Array,e,i,r,n),this.elementType="i16"}slice(e,i){return this.sliceBuffer(Ste,e,i)}static fromTypedArray(e,i){return new Ste(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};aLe.ElementType="i16";let lLe=class Tte extends G_{constructor(e,i=0,r,n){super(Int32Array,e,i,r,n),this.elementType="i32"}slice(e,i){return this.sliceBuffer(Tte,e,i)}static fromTypedArray(e,i){return new Tte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};lLe.ElementType="i32";let cLe=class Ete extends H_{constructor(e,i=0,r,n){super(Int32Array,e,i,r,n),this.elementType="i32"}slice(e,i){return this.sliceBuffer(Ete,e,i)}static fromTypedArray(e,i){return new Ete(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};cLe.ElementType="i32";let uLe=class Cte extends q_{constructor(e,i=0,r,n){super(Int32Array,e,i,r,n),this.elementType="i32"}slice(e,i){return this.sliceBuffer(Cte,e,i)}static fromTypedArray(e,i){return new Cte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};uLe.ElementType="i32";let hLe=class Ate extends W_{constructor(e,i=0,r,n){super(Int32Array,e,i,r,n),this.elementType="i32"}slice(e,i){return this.sliceBuffer(Ate,e,i)}static fromTypedArray(e,i){return new Ate(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};hLe.ElementType="i32";function Wme(t){switch(t){case"u8":case"i8":return 1;case"u16":case"i16":return 2;case"u32":case"i32":case"f32":return 4;case"f64":return 8}}let Yme=class dLe{constructor(e,i){this.layout=e,this.buffer=typeof i=="number"?new ArrayBuffer(i*e.stride):i;for(const r of e.fields.keys()){const n=e.fields.get(r);this[r]=new n.constructor(this.buffer,n.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,i){const r=this[e];return r&&r.elementCount===i.ElementCount&&r.elementType===i.ElementType?r:null}slice(e,i){return new dLe(this.layout,this.buffer.slice(e*this.stride,i*this.stride))}copyFrom(e,i=0,r=0,n=e.count){const s=this.stride;if(s%4==0){const o=new Uint32Array(e.buffer,i*s,n*s/4);new Uint32Array(this.buffer,r*s,n*s/4).set(o)}else{const o=new Uint8Array(e.buffer,i*s,n*s);new Uint8Array(this.buffer,r*s,n*s).set(o)}return this}get usedMemory(){return this.byteLength}dispose(){}},pLe=class fLe{constructor(e=null){this._stride=0,this._lastAligned=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach(i=>this._fields.set(i[0],{...i[1],constructor:U1t(i[1].constructor)})))}vec2f(e,i){return this._appendField(e,TE,i),this}vec2f64(e,i){return this._appendField(e,kae,i),this}vec3f(e,i){return this._appendField(e,Ea,i),this}vec3f64(e,i){return this._appendField(e,e0,i),this}vec4f(e,i){return this._appendField(e,Fm,i),this}vec4f64(e,i){return this._appendField(e,Lj,i),this}mat3f(e,i){return this._appendField(e,j2,i),this}mat3f64(e,i){return this._appendField(e,Dae,i),this}mat4f(e,i){return this._appendField(e,Nae,i),this}mat4f64(e,i){return this._appendField(e,PL,i),this}vec4u8(e,i){return this._appendField(e,Ac,i),this}f32(e,i){return this._appendField(e,$j,i),this}f64(e,i){return this._appendField(e,Fae,i),this}u8(e,i){return this._appendField(e,T5,i),this}u16(e,i){return this._appendField(e,Fj,i),this}i8(e,i){return this._appendField(e,Vae,i),this}vec2i8(e,i){return this._appendField(e,Uj,i),this}vec2i16(e,i){return this._appendField(e,X9,i),this}vec2u8(e,i){return this._appendField(e,Dj,i),this}vec4u16(e,i){return this._appendField(e,Y9,i),this}u32(e,i){return this._appendField(e,zj,i),this}_appendField(e,i,r){if(this._fields.has(e))return void Xt(!1,`${e} already added to vertex buffer layout`);const n=i.ElementCount*Wme(i.ElementType),s=this._stride;this._stride+=n,this._fields.set(e,{size:n,constructor:i,offset:s,optional:r})}createBuffer(e){return new Yme(this,e)}createView(e){return new Yme(this,e)}clone(){const e=new fLe;return e._stride=this._stride,e._fields=new Map,this._fields.forEach((i,r)=>e._fields.set(r,i)),e.BufferType=this.BufferType,e}get stride(){if(this._lastAligned!==this._fields.size){let e=1;this._fields.forEach(i=>e=Math.max(e,Wme(i.constructor.ElementType))),this._stride=Math.floor((this._stride+e-1)/e)*e,this._lastAligned=this._fields.size}return this._stride}get fields(){return this._fields}};function ls(){return new pLe}let k1t=class{constructor(e){this.fields=new Array,e.fields.forEach((i,r)=>{const n={...i,constructor:mLe(i.constructor)};this.fields.push([r,n])}),this.stride=e.stride}};const z1t=[$j,TE,Ea,Fm,j2,Nae,Fae,kae,e0,Lj,Dae,PL,T5,Dj,Nj,Ac,Fj,zae,kj,Y9,zj,Uae,tLe,iLe,Vae,Uj,rLe,nLe,sLe,X9,oLe,aLe,lLe,cLe,uLe,hLe];function mLe(t){return`${t.ElementType}_${t.ElementCount}`}function U1t(t){return gLe.get(t)}const gLe=new Map;z1t.forEach(t=>gLe.set(mLe(t),t));function Ja(t,e=!1){return t<=td?e?new Array(t).fill(0):new Array(t):new Float64Array(t)}function yLe(t){return(zf(t)?t.length:t.byteLength/8)<=td?Array.from(t):new Float64Array(t)}function Lf(t,e,i){return Array.isArray(t)?t.slice(e,e+i):t.subarray(e,e+i)}function V1t(t,e){for(let i=0;i(e=e&&r===0,i=i&&r===n,!e&&!i)),e?ux(t.length):i?EE(t.length):zf(t)||t.BYTES_PER_ELEMENT!==Uint16Array.BYTES_PER_ELEMENT?B1t(t):t}function B1t(t){let e=!0;for(const i of t){if(i>=65536)return zf(t)?new Uint32Array(t):t;i>=256&&(e=!1)}return e?new Uint8Array(t):new Uint16Array(t)}function TU(t){return t<=td?new Array(t):t<=65536?new Uint16Array(t):new Uint32Array(t)}function j1t(t){return t<=td?new Array(t):new Uint32Array(t)}let tC=(()=>{const t=new Uint32Array(131072);for(let e=0;e{const t=new Uint16Array(65536);for(let e=0;etC.length){const e=Math.max(2*tC.length,t);tC=new Uint32Array(e);for(let i=0;iYD.length){const e=Math.max(2*YD.length,t);YD=new Uint8Array(e)}return new Uint8Array(YD.buffer,0,t)}var Mte;(function(t){function e(o,l){const c=o[l],f=o[l+1],_=o[l+2];return Math.sqrt(c*c+f*f+_*_)}function i(o,l){const c=o[l],f=o[l+1],_=o[l+2],x=1/Math.sqrt(c*c+f*f+_*_);o[l]*=x,o[l+1]*=x,o[l+2]*=x}function r(o,l,c){o[l]*=c,o[l+1]*=c,o[l+2]*=c}function n(o,l,c,f,_,x=l){(_=_||o)[x]=o[l]+c[f],_[x+1]=o[l+1]+c[f+1],_[x+2]=o[l+2]+c[f+2]}function s(o,l,c,f,_,x=l){(_=_||o)[x]=o[l]-c[f],_[x+1]=o[l+1]-c[f+1],_[x+2]=o[l+2]-c[f+2]}t.length=e,t.normalize=i,t.scale=r,t.add=n,t.subtract=s})(Mte||(Mte={}));var Ws;(function(t){t[t.Layer=0]="Layer",t[t.Object=1]="Object",t[t.Mesh=2]="Mesh",t[t.Line=3]="Line",t[t.Point=4]="Point",t[t.Material=5]="Material",t[t.Texture=6]="Texture",t[t.COUNT=7]="COUNT"})(Ws||(Ws={}));function G1t(t){if(t.length=1),Xt(r.size===3||r.size===4);const{data:n,size:s,indices:o}=r;Xt(o.length%this._numIndexPerPrimitive==0),Xt(o.length>=e.length*this._numIndexPerPrimitive);const l=e.length;let c=s*o[this._numIndexPerPrimitive*e[0]];Sx.clear(),Sx.push(c);const f=nt(n[c],n[c+1],n[c+2]),_=Xr(f);for(let A=0;A0&&++c;if(c<2)return;const f=new Array(8);for(let _=0;_<8;++_)f[_]=n[_]>0?new Uint32Array(n[_]):void 0;for(let _=0;_<8;++_)n[_]=0;for(let _=0;_H1t());const bq=W(),Jme=W();function W1t(t,e){if(!t)return!1;const{size:i,data:r,indices:n}=t;Ie(e,0,0,0),Ie(cf,0,0,0);let s=0,o=0;for(let l=0;l1&&De(e,e,1/o),o>0}function X1t(t,e,i){if(!t)return!1;Ie(i,0,0,0),Ie(cf,0,0,0);let r=0,n=0;const{size:s,data:o,indices:l}=t,c=l.length-1,f=c+(e?2:0);for(let _=0;_0?(Be(i,i,De(Ba,Ba,M)),r+=M):r===0&&(Be(cf,cf,Ba),n++)}return r!==0?(De(i,i,1/r),!0):n!==0&&(De(i,cf,1/n),!0)}const Ba=W(),Fv=W(),XD=W(),cf=W();let EU=class{constructor(e){this.channel=e,this.id=hp()}};function Ote(t,e){return t==null&&(t=[]),t.push(e),t}function Pte(t,e){if(t==null)return null;const i=t.filter(r=>r!==e);return i.length===0?null:i}function Z1t(t,e,i,r,n){ZD[0]=t.get(e,0),ZD[1]=t.get(e,1),ZD[2]=t.get(e,2),Hee(ZD,Tx,3),i.set(n,0,Tx[0]),r.set(n,0,Tx[1]),i.set(n,1,Tx[2]),r.set(n,1,Tx[3]),i.set(n,2,Tx[4]),r.set(n,2,Tx[5])}const ZD=W(),Tx=new Float32Array(6);let Bo=class wLe extends Z9{constructor(e,i,r=null,n=Ws.Mesh,s=null,o=-1){super(),this.material=e,this.mapPositions=r,this.type=n,this.objectAndLayerIdColor=s,this.edgeIndicesLength=o,this.visible=!0,this._attributes=new Map,this._boundingInfo=null;for(const[l,c]of i)this._attributes.set(l,{...c,indices:Py(c.indices)}),l===J.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._attributes.get(l).indices.length:this.edgeIndicesLength)}instantiate(e={}){const i=new wLe(e.material||this.material,[],this.mapPositions,this.type,this.objectAndLayerIdColor,this.edgeIndicesLength);return this._attributes.forEach((r,n)=>{r.exclusive=!1,i._attributes.set(n,r)}),i._boundingInfo=this._boundingInfo,i.transformation=e.transformation||this.transformation,i}get attributes(){return this._attributes}getMutableAttribute(e){let i=this._attributes.get(e);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:G1t(i.data)},this._attributes.set(e,i)),i}setAttributeData(e,i){const r=this._attributes.get(e);r&&this._attributes.set(e,{...r,exclusive:!0,data:i})}get indexCount(){const e=this._attributes.values().next().value.indices;return(e==null?void 0:e.length)??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo==null&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(e){return!!(this.type===Ws.Mesh?this._computeAttachmentOriginTriangles(e):this.type===Ws.Line?this._computeAttachmentOriginLines(e):this._computeAttachmentOriginPoints(e))&&(this._transformation!=null&&bt(e,e,this._transformation),!0)}_computeAttachmentOriginTriangles(e){const i=this.attributes.get(J.POSITION);return W1t(i,e)}_computeAttachmentOriginLines(e){const i=this.attributes.get(J.POSITION);return X1t(i,J1t(this.material.parameters,i),e)}_computeAttachmentOriginPoints(e){const i=this.attributes.get(J.POSITION);return Y1t(i,e)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const e=this.attributes.get(J.POSITION);if(!e||e.indices.length===0)return null;const i=this.type===Ws.Mesh?3:1;Xt(e.indices.length%i==0,"Indexing error: "+e.indices.length+" not divisible by "+i);const r=EE(e.indices.length/i);return new _Le(r,i,e)}get transformation(){return this._transformation??gs}set transformation(e){this._transformation=e&&e!==gs?o5(e):null}addHighlight(){const e=new EU(S_.Highlight);return this.highlights=Ote(this.highlights,e),e}removeHighlight(e){this.highlights=Pte(this.highlights,e)}};function J1t(t,e){return!(!("isClosed"in t)||!t.isClosed)&&e.indices.length>2}const iC=Mte,wq=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],K1t=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],Q1t=[0,0,1,0,1,1,0,1],evt=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],xLe=new Array(36);for(let t=0;t<6;t++)for(let e=0;e<6;e++)xLe[6*t+e]=t;const X3=new Array(36);for(let t=0;t<6;t++)X3[6*t]=0,X3[6*t+1]=1,X3[6*t+2]=2,X3[6*t+3]=2,X3[6*t+4]=3,X3[6*t+5]=0;function tvt(t,e){Array.isArray(e)||(e=[e,e,e]);const i=new Array(24);for(let r=0;r<8;r++)i[3*r]=wq[r][0]*e[0],i[3*r+1]=wq[r][1]*e[1],i[3*r+2]=wq[r][2]*e[2];return new Bo(t,[[J.POSITION,new It(i,evt,3,!0)],[J.NORMAL,new It(K1t,xLe,3)],[J.UV0,new It(Q1t,X3,2)]])}const xq=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],ivt=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],rvt=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],nvt=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function svt(t,e){Array.isArray(e)||(e=[e,e,e]);const i=new Array(18);for(let r=0;r<6;r++)i[3*r]=xq[r][0]*e[0],i[3*r+1]=xq[r][1]*e[1],i[3*r+2]=xq[r][2]*e[2];return new Bo(t,[[J.POSITION,new It(i,rvt,3,!0)],[J.NORMAL,new It(ivt,nvt,3)]])}const jF=pn(-.5,0,-.5),GF=pn(.5,0,-.5),HF=pn(0,0,.5),qF=pn(0,.5,0),rC=Bs(),nC=Bs(),yO=Bs(),vO=Bs(),_O=Bs();je(rC,jF,qF),je(nC,jF,GF),Wt(yO,rC,nC),Ye(yO,yO),je(rC,GF,qF),je(nC,GF,HF),Wt(vO,rC,nC),Ye(vO,vO),je(rC,HF,qF),je(nC,HF,jF),Wt(_O,rC,nC),Ye(_O,_O);const Sq=[jF,GF,HF,qF],ovt=[0,-1,0,yO[0],yO[1],yO[2],vO[0],vO[1],vO[2],_O[0],_O[1],_O[2]],avt=[0,1,2,3,1,0,3,2,1,3,0,2],lvt=[0,0,0,1,1,1,2,2,2,3,3,3];function cvt(t,e){Array.isArray(e)||(e=[e,e,e]);const i=new Array(12);for(let r=0;r<4;r++)i[3*r]=Sq[r][0]*e[0],i[3*r+1]=Sq[r][1]*e[1],i[3*r+2]=Sq[r][2]*e[2];return new Bo(t,[[J.POSITION,new It(i,avt,3,!0)],[J.NORMAL,new It(ovt,lvt,3)]])}function Rri(t,e,i,r,n={uv:!0}){const s=-Math.PI,o=2*Math.PI,l=-Math.PI/2,c=Math.PI,f=Math.max(3,Math.floor(i)),_=Math.max(2,Math.floor(r)),x=(f+1)*(_+1),T=Rs(3*x),A=Rs(3*x),M=Rs(2*x),I=[];let L=0;for(let k=0;k<=_;k++){const U=[],j=k/_,H=l+j*c,Y=Math.cos(H);for(let Q=0;Q<=f;Q++){const ne=Q/f,re=s+ne*o,he=Math.cos(re)*Y,ce=Math.sin(H),be=-Math.sin(re)*Y;T[3*L]=he*e,T[3*L+1]=ce*e,T[3*L+2]=be*e,A[3*L]=he,A[3*L+1]=ce,A[3*L+2]=be,M[2*L]=ne,M[2*L+1]=j,U.push(L),++L}I.push(U)}const F=new Array;for(let k=0;k<_;k++)for(let U=0;U_&&([f,_]=[_,f]);const x=f.toString()+"."+_.toString();if(o[x])return o[x];let T=n.length;return n.length+=3,iC.add(n,3*f,n,3*_,n,T),iC.scale(n,T,t/iC.length(n,T)),T/=3,o[x]=T,T}for(let f=0;f3?255*r[3]:255]:[255,255,255,255],T=n!=null&&n.length===2?n:[1,1],A=ux(1),M=[[J.POSITION,new It(f,A,3,!0)],[J.NORMAL,new It(_,A,3,!0)],[J.UV0,new It(o,A,o.length)],[J.COLOR,new It(x,A,4,!0)],[J.SIZE,new It(T,A,2)]];if(s!=null){const I=[s[0],s[1],s[2],s[3]];M.push([J.AUXPOS1,new It(I,A,4)])}if(l!=null){const I=[l[0],l[1],l[2],l[3]];M.push([J.FEATUREATTRIBUTE,new It(I,A,4)])}return new Bo(t,M,null,Ws.Point,c)}const hvt=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function Iri(t,e=hvt){const i=new Array(12);for(let f=0;f<4;f++)for(let _=0;_<3;_++)i[3*f+_]=e[f][_];const r=[0,1,2,2,3,0],n=[0,0,1],s=[0,0,0,0,0,0],o=[0,0,1,0,1,1,0,1],l=[255,255,255,255],c=[[J.POSITION,new It(i,r,3,!0)],[J.NORMAL,new It(n,s,3,!0)],[J.UV0,new It(o,r,2,!0)],[J.COLOR,new It(l,s,4,!0)]];return new Bo(t,c)}function Kme(t,e,i,r,n,s=!0,o=!0){let l=0;const c=i,f=e;let _=pn(0,l,0),x=pn(0,l+f,0),T=pn(0,-1,0),A=pn(0,1,0);n&&(l=f,x=pn(0,0,0),_=pn(0,l,0),T=pn(0,1,0),A=pn(0,-1,0));const M=[x,_],I=[T,A],L=r+2,F=Math.sqrt(f*f+c*c);if(n)for(let Y=r-1;Y>=0;Y--){const Q=Y*(2*Math.PI/r),ne=pn(Math.cos(Q)*c,l,Math.sin(Q)*c);M.push(ne);const re=pn(f*Math.cos(Q)/F,-c/F,f*Math.sin(Q)/F);I.push(re)}else for(let Y=0;Y{k[re]=he,U[re]=ce};let H=0;const Y=Bs(),Q=Bs();for(let re=0;re1);const o=[[0,0,0]],l=[],c=[];for(let f=0;f0?n[le][0]:-n[le][0]-1+r.length),_.push(n[le][1]>0?n[le][1]:-n[le][1]-1+r.length),_.push(n[le][2]>0?n[le][2]:-n[le][2]-1+r.length),x.push(0),x.push(0),x.push(0);let ce=r.length;const be=r.length-1;for(let le=0;le0&&(Ne(M,I),le=0?ce+n[le][0]:-n[le][0]-1+Ee),_.push(n[le][2]>=0?ce+n[le][2]:-n[le][2]-1+Ee),_.push(n[le][1]>=0?ce+n[le][1]:-n[le][1]-1+Ee),x.push(pe),x.push(pe),x.push(pe);const te=[[J.POSITION,new It(c,_,3,!0)],[J.NORMAL,new It(f,x,3,!0)]];return new Bo(t,te)}function Lri(t,e,i,r){Xt(e.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),Xt(e[0].length===3,"createPolylineGeometry(): malformed vertex"),Xt(i==null||i.length===e.length,"createPolylineGeometry: need same number of points and normals"),Xt(i==null||i[0].length===3,"createPolylineGeometry(): malformed normal");const n=Ja(3*e.length),s=new Array(2*(e.length-1));let o=0,l=0;for(let f=0;f0&&(s[l++]=f-1,s[l++]=f)}const c=[[J.POSITION,new It(n,s,3,!0)]];if(i){const f=Rs(3*i.length);let _=0;for(let x=0;xn)&&(Wt(i,t,e),Ye(i,i),Wt(r,i,t),Ye(r,r),!0)}function CU(t,e,i,r,n,s,o){return Tq(t,e,n,s,o)||Tq(t,i,n,s,o)||Tq(t,r,n,s,o)}const Qme=.99619469809,sC=Bs();let mvt=class{constructor(e,i){this.type=pc.Local,this._configuration=new Rae,this._passParameters=new Ij,this._configuration.geometry=Zy.Cylinder,this._technique=i.techniqueRepository.acquire(xU,this._configuration);const r=i.renderContext.rctx;this._vao=this._createVertexArrayObject(r),this._vaoCount=Kv(this._vao,"geometry");const n=new tn;n.wrapMode=Bi.CLAMP_TO_EDGE,n.flipped=!0,n.width=1,n.height=512,this._passParameters.texture=new Ai(r,n,D1t)}destroy(){this._passParameters.texture=Kt(this._passParameters.texture),this._vao.dispose(),this._technique.release()}render(e){const i=e.rctx,r=i.bindTechnique(this._technique,this._passParameters,e.bindParameters);gvt(ege,e.bindParameters.camera.viewMatrix),r.setUniformMatrix4fv("view",ege),i.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),i.drawArrays(sr.TRIANGLES,0,this._vaoCount)}renderHaze(){return!1}_createVertexArrayObject(e){const i=SLe(1,2,!1),{data:r,indices:n}=i[0][1],s=tge.createBuffer(n.length),o=s.position;for(let l=0;l1-511/512,_vt=hF([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let bvt=class{constructor(e,i){this.view=e,this.type=pc.Mars,this._passParameters=new Ij,this._vaoCount=0,this._texV1=1;const r=Sr(e.spatialReference);this._planetRadius=r.radius,this._outerRimWidth=r.outerAtmosphereRimWidth,this._innerRimFactor=(this._planetRadius+ige)/this._planetRadius,this._middleRimFactor=(this._planetRadius+rge)/this._planetRadius,this._outerRimFactor=(this._planetRadius+this._outerRimWidth)/this._planetRadius,this._texV0=rge/this._outerRimWidth,this._texVScale=this._texV1-this._texV0,this._techniqueRepository=i.techniqueRepository;const n=i.renderContext.rctx;this._cameraChangeHandle=_e(()=>{var l;return(l=this.view.state)==null?void 0:l.camera},()=>i.requestRender(),kt),this._vao=this._createRibbon(n),this._vaoCount=Kv(this._vao,"geometry"),this._fadeVao=u1(n),this._fadeVaoCount=Kv(this._fadeVao,"geometry");const s=new tn;s.wrapMode=Bi.CLAMP_TO_EDGE,s.flipped=!0,s.width=1,s.height=512,this._passParameters.texture=new Ai(n,s,yvt);const o=new Rae;o.geometry=Zy.Cone,this._coneTechnique=this._techniqueRepository.acquire(xU,o),o.geometry=Zy.Underground,this._undergroundTechnique=this._techniqueRepository.acquire(xU,o)}destroy(){this._coneTechnique.release(),this._undergroundTechnique.release(),this._cameraChangeHandle.remove(),this._passParameters.texture=Kt(this._passParameters.texture),this._fadeVao.dispose(),this._vao.dispose()}render(e){const i=e.bindParameters.camera;this._update(i);const r=e.rctx;this._passParameters.undergroundFadeAlpha<1&&(r.bindTechnique(this._coneTechnique,this._passParameters,e.bindParameters),r.bindVAO(this._vao),r.drawArrays(sr.TRIANGLES,0,this._vaoCount)),this._passParameters.undergroundFadeAlpha>0&&(r.bindTechnique(this._undergroundTechnique,this._passParameters,e.bindParameters),r.bindVAO(this._fadeVao),r.drawArrays(sr.TRIANGLE_STRIP,0,this._fadeVaoCount))}renderHaze(){}_update(e){const i=W(),r=this._planetRadius,n=rt(e.eye),s=n-r;if(s<0){const A=Math.min(-s/5e3,1);this._passParameters.undergroundFadeAlpha=A}else this._passParameters.undergroundFadeAlpha=0;const o=Math.max(Eq,s),l=r+ige;this._passParameters.innerScale=wvt(r+o,r,l)-1,this._passParameters.altitudeFade=dae(s),De(i,e.eye,(r+Eq)/n),nge(i,e.center,e.up,r,this._passParameters.silhouette);const c=this._computeScreenRimWidth(e,i,e.up,this._passParameters.silhouette),f=vvt(),_=_vt(s);let x=this._texV0+f*this._texVScale,T=this._texV0+c*_*this._texVScale;if(s>Eq){nge(e.eye,e.center,e.up,r,this._passParameters.silhouette);const A=this._computeScreenRimWidth(e,e.eye,e.up,this._passParameters.silhouette),M=Je((A-1.5)/(c-1.5),0,1);x=this._texV0+M*f*this._texVScale,T=this._texV0+ui(this._texV1,c*_,M)*this._texVScale}or(this._passParameters.texV,x,T)}_createRibbon(e){const i=Rs(3+3*JD*3),r=new Uint32Array(3*JD*5);i[0]=0,i[1]=0,i[2]=-1;for(let o=0;or.camera.eye)),e.vertex.uniforms.add(new Oi("offset",(i,r)=>xvt(i,r))),e.vertex.uniforms.add(new ft("width",i=>i.width)),e.vertex.uniforms.add(new _s("proj",(i,r)=>r.camera.projectionMatrix)),e.vertex.uniforms.add(new _s("view",(i,r)=>r.camera.viewMatrix)),e.vertex.uniforms.add(new ft("time",i=>i.time)),e.varyings.add("vUv","vec2"),e.vertex.code.add(V` + }`)}return e}const $yt=Object.freeze(Object.defineProperty({__proto__:null,SilhouetteCircle:Hae,SimpleAtmospherePassParameters:Bj,build:Y$e},Symbol.toStringTag,{value:"Module"}));let SU=class X$e extends Hr{initializeProgram(e){return new $r(e.rctx,X$e.shader.get().build(this.configuration),Cr)}initializePipeline(){return this.configuration.geometry===r1.Cylinder?Ti({blending:Pl(ot.SRC_ALPHA,ot.ONE,ot.ONE_MINUS_SRC_ALPHA,ot.ONE_MINUS_SRC_ALPHA),culling:Cae,depthTest:{func:Zr.LEQUAL},colorWrite:ji}):Ti({blending:Pl(ot.SRC_ALPHA,ot.ONE,ot.ONE_MINUS_SRC_ALPHA,ot.ONE_MINUS_SRC_ALPHA),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};SU.shader=new Ir($yt,()=>we(()=>Promise.resolve().then(()=>eXt),void 0));const Lyt=new Uint8ClampedArray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,4,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,5,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,6,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,7,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,8,0,0,0,9,0,0,0,9,0,0,0,9,0,0,0,9,0,0,0,9,0,0,0,10,0,0,0,10,0,0,0,10,0,0,0,10,0,0,0,11,0,0,0,11,0,0,0,11,0,0,0,11,0,0,0,11,0,0,0,12,0,0,0,12,0,0,0,12,0,0,0,12,0,0,0,13,0,0,0,13,0,0,0,13,0,0,0,13,0,0,0,14,0,0,0,14,0,0,0,14,0,0,0,14,0,0,0,15,0,0,0,15,0,0,0,15,0,0,0,15,0,0,0,15,16,0,0,16,16,0,0,16,16,0,0,16,16,0,0,16,15,0,0,17,15,0,0,17,15,0,0,17,15,0,0,17,14,0,0,18,14,0,0,18,14,0,0,18,13,0,0,19,13,0,0,19,13,0,0,19,13,0,0,19,13,0,0,20,13,0,0,20,13,0,0,20,13,0,0,20,12,0,0,21,12,0,0,21,12,0,0,21,12,0,0,21,12,0,0,22,12,0,0,22,12,0,0,22,12,0,0,22,11,0,0,23,11,0,0,23,11,0,0,23,11,0,0,24,11,0,0,24,11,0,0,24,11,0,0,24,10,0,0,25,10,0,0,25,10,0,0,25,10,0,0,26,10,0,0,26,10,0,0,26,10,0,0,26,9,0,0,27,9,0,0,27,9,0,0,27,18,0,0,28,18,0,0,28,18,0,0,28,18,0,0,28,18,0,0,29,18,0,0,29,18,0,0,29,17,0,0,30,17,0,0,30,17,0,0,30,17,0,0,30,16,0,0,31,16,0,0,31,16,0,0,31,16,0,0,32,16,0,0,32,16,0,0,32,15,0,0,33,15,0,0,33,15,0,0,33,15,0,0,34,15,8,0,34,15,8,0,34,15,8,0,34,15,7,0,35,15,7,0,35,15,7,0,35,21,7,0,36,21,7,0,36,21,7,0,36,21,7,0,37,21,7,0,37,21,7,0,37,20,7,0,38,20,7,0,38,20,7,0,38,20,7,0,39,20,7,0,39,20,7,0,39,20,7,0,39,19,6,0,40,19,6,0,40,19,6,0,40,19,6,0,41,19,6,0,41,19,6,0,41,18,6,0,42,18,6,0,42,18,6,0,42,24,6,0,43,24,6,0,43,24,6,0,43,23,6,0,44,23,6,0,44,23,6,0,44,23,6,0,45,23,6,0,45,23,6,0,45,22,6,0,46,22,6,0,46,22,6,0,46,22,5,0,47,22,5,0,47,22,5,0,47,21,5,0,48,21,5,0,48,21,5,0,48,21,5,0,49,21,5,0,49,26,5,0,49,25,5,0,50,25,5,0,50,25,5,0,50,25,5,0,51,25,5,0,51,25,5,0,51,25,5,0,52,25,5,0,52,25,5,0,52,24,5,0,53,24,5,0,53,24,5,0,53,24,9,0,54,28,9,0,54,28,9,0,54,28,9,0,55,28,9,0,55,27,9,0,56,27,9,0,56,27,9,0,56,27,9,4,57,27,9,4,57,27,9,4,57,26,9,4,58,26,9,4,58,26,9,4,58,26,9,4,59,26,9,4,59,26,9,4,59,26,8,4,60,30,8,4,60,30,8,4,60,29,8,4,61,29,8,4,61,29,8,4,62,29,8,4,62,29,8,4,62,28,8,4,63,28,8,4,63,28,8,4,63,28,12,4,64,28,12,4,64,28,12,4,64,27,12,4,65,27,12,8,65,27,12,8,65,31,12,8,66,31,12,8,66,30,11,8,67,30,11,8,67,30,11,8,67,30,11,8,68,30,11,8,68,30,11,8,68,30,15,7,69,30,15,7,69,30,15,7,69,33,15,11,70,33,15,11,70,32,14,11,71,32,14,11,71,32,14,11,71,32,18,14,72,32,18,14,72,32,18,14,72,31,17,14,73,35,17,14,73,34,17,17,74,34,21,17,74,34,21,17,74,34,20,17,75,34,20,20,75,34,20,20,75,34,23,20,76,34,23,20,76,36,23,23,77,36,23,23,77,36,23,23,77,36,23,23,78,36,26,26,78,36,26,26,78,36,26,26,79,36,26,29,79,38,26,29,80,38,29,29,80,38,29,29,80,38,28,31,81,38,28,31,81,38,31,31,81,37,31,34,82,37,31,34,82,37,31,37,83,40,34,37,83,40,34,37,83,39,33,39,84,39,33,39,84,39,36,42,84,39,36,42,85,39,36,42,85,39,36,42,85,39,39,44,86,39,39,44,86,41,38,47,87,41,41,47,87,41,41,50,87,41,41,49,88,41,41,52,88,40,43,52,89,43,43,52,89,43,43,54,89,42,45,54,90,42,45,57,90,42,45,57,90,42,45,59,91,42,48,59,91,44,47,61,92,44,47,61,92,44,50,61,92,44,49,63,93,44,49,63,93,44,52,66,93,43,52,65,94,46,54,68,94,46,54,70,95,46,54,70,95,46,54,70,95,45,56,72,96,45,56,72,96,45,58,74,97,47,58,76,97,47,58,76,97,47,60,78,98,47,60,78,98,47,60,81,98,49,62,80,99,49,62,82,99,48,61,84,100,48,64,84,100,48,64,84,100,50,63,86,101,50,66,86,101,50,66,88,101,50,65,90,102,52,67,89,103,51,69,91,104,51,68,92,105,52,69,93,107,52,71,94,108,54,70,96,109,53,71,96,111,52,73,98,112,54,72,98,114,53,73,100,115,54,72,100,117,54,73,102,118,55,74,104,120,55,76,105,121,56,77,106,123,56,76,107,124,57,79,107,126,58,78,110,128,57,79,111,129,56,80,113,131,58,79,112,132,57,82,114,134,58,81,116,136,60,82,117,137,59,83,117,139,60,83,119,141,59,84,120,142,60,85,122,144,59,86,122,146,60,86,126,148,62,87,127,149,61,88,127,151,62,88,128,153,63,89,130,155,62,90,131,156,63,90,132,158,64,91,134,160,65,91,135,162,64,92,136,163,63,93,138,165,66,95,139,167,65,95,140,169,66,95,142,171,67,96,142,172,66,97,144,174,67,99,145,176,67,97,148,178,67,99,147,180,68,100,149,181,68,100,150,183,69,101,152,185,70,102,153,187,71,103,155,188,70,103,156,190,70,104,157,192,71,105,158,194,71,106,160,195,72,106,161,197,72,108,161,199,73,108,163,200,73,109,164,202,74,109,165,204,74,110,167,206,75,111,168,207,74,112,170,209,75,112,170,210,76,113,171,212,76,114,173,214,77,115,174,215,78,115,175,217,78,116,175,218,78,117,177,220,78,118,178,221,79,118,180,223,80,120,180,224,81,120,181,226,81,120,182,227,82,121,184,229,82,122,185,230,84,123,186,232,83,123,187,233,84,124,189,234,84,125,188,235,85,126,189,237,86,126,190,238,86,127,191,239,87,127,192,240,87,129,193,242,88,129,194,243,89,130,195,244,90,131,196,245,90,132,197,246,91,132,197,247,92,133,198,248,92,134,199,249,93,135,200,250,94,136,201,251,95,137,202,252,96,138,203,253,97,140,204,254,98,141,205,254,99,142,206,255,101,143,207,255,102,144,208,255,103,146,209,255,104,147,209,255,106,148,210,255,107,149,211,255,108,151,212,255,110,152,213,255,111,153,213,255,112,154,214,255,114,156,215,255,115,157,215,255,117,158,216,255,118,160,217,255,120,161,217,255,121,162,218,255,123,164,218,255,124,165,219,255,125,166,219,255,127,167,220,255,129,169,220,255,130,170,221,255,132,171,221,255,133,173,222,255,134,174,222,255,136,175,223,255,139,178,224,255,142,180,224,255,144,182,225,255,147,185,226,255,150,187,226,255,153,189,227,255,155,191,228,255,158,194,228,255,160,196,229,255,163,198,229,255,165,200,230,255,168,202,231,255,170,203,231,255,172,205,232,255,174,207,232,255,176,209,233,255,178,210,234,255,180,212,234,255,182,214,235,255,184,215,236,255,186,217,237,255,188,219,238,255,190,220,238,255,192,221,239,255,193,222,240,255,194,224,240,255,196,225,241,255,197,226,241,255,198,226,242,255,199,227,242,255,200,228,242,255,201,228,243,255,202,229,243,255,203,230,243,255,204,230,244,255,205,231,244,255,207,232,244,255,208,233,245,255,209,233,245,255,211,234,246,255,213,235,246,255,217,238,247,255,222,240,248,255,226,242,249,255,231,245,250,255,236,247,251,255,241,249,252,255,245,251,253,255,249,252,254,255,255,255,255,255]);function _d(t,e=0){const i=t.stride;return Array.from(t.fields.keys()).map(r=>{const n=t.fields.get(r),s=n.constructor.ElementCount,o=Dyt(n.constructor.ElementType),a=n.offset,c=!(!n.optional||!n.optional.glNormalized);return new Ol(r,s,o,a,i,c,e)})}function Dyt(t){const e=Nyt[t];if(e)return e;throw new Error("BufferType not supported in WebGL")}const Nyt={u8:Yt.UNSIGNED_BYTE,u16:Yt.UNSIGNED_SHORT,u32:Yt.UNSIGNED_INT,i8:Yt.BYTE,i16:Yt.SHORT,i32:Yt.INT,f32:Yt.FLOAT};let qae=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.elementCount=9;const o=this.TypedArrayConstructor;n===void 0&&(n=9*o.BYTES_PER_ELEMENT);const a=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,a):new o(i,a,(s-r)/o.BYTES_PER_ELEMENT),this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride),this.stride=this.typedBufferStride*this.TypedArrayConstructor.BYTES_PER_ELEMENT}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}getMat(e,i){let r=e*this.typedBufferStride;for(let n=0;n<9;n++)i[n]=this.typedBuffer[r++];return i}setMat(e,i){let r=e*this.typedBufferStride;for(let n=0;n<9;n++)this.typedBuffer[r++]=i[n]}get(e,i){return this.typedBuffer[e*this.typedBufferStride+i]}set(e,i,r){this.typedBuffer[e*this.typedBufferStride+i]=r}copyFrom(e,i,r){const n=this.typedBuffer,s=i.typedBuffer;let o=e*this.typedBufferStride,a=r*i.typedBufferStride;for(let c=0;c<9;++c)n[o++]=s[a++]}get buffer(){return this.typedBuffer.buffer}};qae.ElementCount=9;let Wae=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.elementCount=16;const o=this.TypedArrayConstructor;n===void 0&&(n=16*o.BYTES_PER_ELEMENT);const a=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,a):new o(i,a,(s-r)/o.BYTES_PER_ELEMENT),this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride),this.stride=this.typedBufferStride*this.TypedArrayConstructor.BYTES_PER_ELEMENT}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}getMat(e,i){let r=e*this.typedBufferStride;for(let n=0;n<16;n++)i[n]=this.typedBuffer[r++];return i}setMat(e,i){let r=e*this.typedBufferStride;for(let n=0;n<16;n++)this.typedBuffer[r++]=i[n]}get(e,i){return this.typedBuffer[e*this.typedBufferStride+i]}set(e,i,r){this.typedBuffer[e*this.typedBufferStride+i]=r}copyFrom(e,i,r){const n=this.typedBuffer,s=i.typedBuffer;let o=e*this.typedBufferStride,a=r*i.typedBufferStride;for(let c=0;c<16;++c)n[o++]=s[a++]}get buffer(){return this.typedBuffer.buffer}};Wae.ElementCount=16;let X_=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.elementCount=1;const o=this.TypedArrayConstructor;n===void 0&&(n=o.BYTES_PER_ELEMENT);const a=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,a):new o(i,a,(s-r)/o.BYTES_PER_ELEMENT),this.stride=n,this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride)}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}get(e){return this.typedBuffer[e*this.typedBufferStride]}set(e,i){this.typedBuffer[e*this.typedBufferStride]=i}get buffer(){return this.typedBuffer.buffer}};X_.ElementCount=1;let Z_=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.elementCount=2;const o=this.TypedArrayConstructor;n===void 0&&(n=2*o.BYTES_PER_ELEMENT);const a=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,a):new o(i,a,(s-r)/o.BYTES_PER_ELEMENT),this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride),this.stride=this.typedBufferStride*this.TypedArrayConstructor.BYTES_PER_ELEMENT}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}getVec(e,i){return e*=this.typedBufferStride,or(i,this.typedBuffer[e],this.typedBuffer[e+1])}setVec(e,i){e*=this.typedBufferStride,this.typedBuffer[e++]=i[0],this.typedBuffer[e]=i[1]}get(e,i){return this.typedBuffer[e*this.typedBufferStride+i]}set(e,i,r){this.typedBuffer[e*this.typedBufferStride+i]=r}setValues(e,i,r){e*=this.typedBufferStride,this.typedBuffer[e++]=i,this.typedBuffer[e]=r}copyFrom(e,i,r){const n=this.typedBuffer,s=i.typedBuffer;let o=e*this.typedBufferStride,a=r*i.typedBufferStride;n[o++]=s[a++],n[o]=s[a]}get buffer(){return this.typedBuffer.buffer}};Z_.ElementCount=2;let J_=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.elementCount=3;const o=this.TypedArrayConstructor;n===void 0&&(n=3*o.BYTES_PER_ELEMENT);const a=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,a):new o(i,a,(s-r)/o.BYTES_PER_ELEMENT),this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride),this.stride=this.typedBufferStride*this.TypedArrayConstructor.BYTES_PER_ELEMENT}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}getVec(e,i){return e*=this.typedBufferStride,Ie(i,this.typedBuffer[e],this.typedBuffer[e+1],this.typedBuffer[e+2])}setVec(e,i){e*=this.typedBufferStride,this.typedBuffer[e++]=i[0],this.typedBuffer[e++]=i[1],this.typedBuffer[e]=i[2]}get(e,i){return this.typedBuffer[e*this.typedBufferStride+i]}set(e,i,r){this.typedBuffer[e*this.typedBufferStride+i]=r}setValues(e,i,r,n){e*=this.typedBufferStride,this.typedBuffer[e++]=i,this.typedBuffer[e++]=r,this.typedBuffer[e]=n}copyFrom(e,i,r){const n=this.typedBuffer,s=i.typedBuffer;let o=e*this.typedBufferStride,a=r*i.typedBufferStride;n[o++]=s[a++],n[o++]=s[a++],n[o]=s[a]}get buffer(){return this.typedBuffer.buffer}};J_.ElementCount=3;let K_=class{constructor(e,i,r=0,n,s){this.TypedArrayConstructor=e,this.start=r,this.elementCount=4;const o=this.TypedArrayConstructor;n===void 0&&(n=4*o.BYTES_PER_ELEMENT);const a=i.byteLength===0?0:r;this.typedBuffer=s==null?new o(i,a):new o(i,a,(s-r)/o.BYTES_PER_ELEMENT),this.typedBufferStride=n/o.BYTES_PER_ELEMENT,this.count=Math.ceil(this.typedBuffer.length/this.typedBufferStride),this.stride=this.typedBufferStride*this.TypedArrayConstructor.BYTES_PER_ELEMENT}sliceBuffer(e,i,r=this.count-i){const n=this.typedBuffer.byteOffset+i*this.stride;return new e(this.buffer,n,this.stride,n+r*this.stride)}getVec(e,i){return e*=this.typedBufferStride,rs(i,this.typedBuffer[e++],this.typedBuffer[e++],this.typedBuffer[e++],this.typedBuffer[e])}setVec(e,i){e*=this.typedBufferStride,this.typedBuffer[e++]=i[0],this.typedBuffer[e++]=i[1],this.typedBuffer[e++]=i[2],this.typedBuffer[e]=i[3]}get(e,i){return this.typedBuffer[e*this.typedBufferStride+i]}set(e,i,r){this.typedBuffer[e*this.typedBufferStride+i]=r}setValues(e,i,r,n,s){e*=this.typedBufferStride,this.typedBuffer[e++]=i,this.typedBuffer[e++]=r,this.typedBuffer[e++]=n,this.typedBuffer[e]=s}copyFrom(e,i,r){const n=this.typedBuffer,s=i.typedBuffer;let o=e*this.typedBufferStride,a=r*i.typedBufferStride;n[o++]=s[a++],n[o++]=s[a++],n[o++]=s[a++],n[o]=s[a]}get buffer(){return this.typedBuffer.buffer}};K_.ElementCount=4;let jj=class Z$e extends X_{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}static fromTypedArray(e,i){return new Z$e(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};jj.ElementType="f32";let RE=class tte extends Z_{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}slice(e,i){return this.sliceBuffer(tte,e,i)}static fromTypedArray(e,i){return new tte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};RE.ElementType="f32";let Ca=class ite extends J_{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}slice(e,i){return this.sliceBuffer(ite,e,i)}static fromTypedArray(e,i){return new ite(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Ca.ElementType="f32";let Um=class rte extends K_{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}slice(e,i){return this.sliceBuffer(rte,e,i)}static fromTypedArray(e,i){return new rte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Um.ElementType="f32";let Y2=class nte extends qae{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}slice(e,i){return this.sliceBuffer(nte,e,i)}static fromTypedArray(e,i){return new nte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Y2.ElementType="f32";let Yae=class ste extends qae{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(ste,e,i)}static fromTypedArray(e,i){return new ste(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Yae.ElementType="f64";let Xae=class ote extends Wae{constructor(e,i=0,r,n){super(Float32Array,e,i,r,n),this.elementType="f32"}slice(e,i){return this.sliceBuffer(ote,e,i)}static fromTypedArray(e,i){return new ote(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Xae.ElementType="f32";let zL=class ate extends Wae{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(ate,e,i)}static fromTypedArray(e,i){return new ate(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};zL.ElementType="f64";let Zae=class lte extends X_{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(lte,e,i)}static fromTypedArray(e,i){return new lte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Zae.ElementType="f64";let Jae=class cte extends Z_{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(cte,e,i)}static fromTypedArray(e,i){return new cte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Jae.ElementType="f64";let n0=class ute extends J_{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(ute,e,i)}static fromTypedArray(e,i){return new ute(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};n0.ElementType="f64";let Gj=class hte extends K_{constructor(e,i=0,r,n){super(Float64Array,e,i,r,n),this.elementType="f64"}slice(e,i){return this.sliceBuffer(hte,e,i)}static fromTypedArray(e,i){return new hte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Gj.ElementType="f64";let $P=class dte extends X_{constructor(e,i=0,r,n){super(Uint8Array,e,i,r,n),this.elementType="u8"}slice(e,i){return this.sliceBuffer(dte,e,i)}static fromTypedArray(e,i){return new dte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};$P.ElementType="u8";let Hj=class pte extends Z_{constructor(e,i=0,r,n){super(Uint8Array,e,i,r,n),this.elementType="u8"}slice(e,i){return this.sliceBuffer(pte,e,i)}static fromTypedArray(e,i){return new pte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Hj.ElementType="u8";let qj=class fte extends J_{constructor(e,i=0,r,n){super(Uint8Array,e,i,r,n),this.elementType="u8"}slice(e,i){return this.sliceBuffer(fte,e,i)}static fromTypedArray(e,i){return new fte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};qj.ElementType="u8";let Pc=class mte extends K_{constructor(e,i=0,r,n){super(Uint8Array,e,i,r,n),this.elementType="u8"}slice(e,i){return this.sliceBuffer(mte,e,i)}static fromTypedArray(e,i){return new mte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Pc.ElementType="u8";let Wj=class gte extends X_{constructor(e,i=0,r,n){super(Uint16Array,e,i,r,n),this.elementType="u16"}slice(e,i){return this.sliceBuffer(gte,e,i)}static fromTypedArray(e,i){return new gte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Wj.ElementType="u16";let Kae=class yte extends Z_{constructor(e,i=0,r,n){super(Uint16Array,e,i,r,n),this.elementType="u16"}slice(e,i){return this.sliceBuffer(yte,e,i)}static fromTypedArray(e,i){return new yte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Kae.ElementType="u16";let Yj=class vte extends J_{constructor(e,i=0,r,n){super(Uint16Array,e,i,r,n),this.elementType="u16"}slice(e,i){return this.sliceBuffer(vte,e,i)}static fromTypedArray(e,i){return new vte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Yj.ElementType="u16";let Q9=class _te extends K_{constructor(e,i=0,r,n){super(Uint16Array,e,i,r,n),this.elementType="u16"}slice(e,i){return this.sliceBuffer(_te,e,i)}static fromTypedArray(e,i){return new _te(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Q9.ElementType="u16";let Xj=class bte extends X_{constructor(e,i=0,r,n){super(Uint32Array,e,i,r,n),this.elementType="u32"}slice(e,i){return this.sliceBuffer(bte,e,i)}static fromTypedArray(e,i){return new bte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Xj.ElementType="u32";let Qae=class wte extends Z_{constructor(e,i=0,r,n){super(Uint32Array,e,i,r,n),this.elementType="u32"}slice(e,i){return this.sliceBuffer(wte,e,i)}static fromTypedArray(e,i){return new wte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Qae.ElementType="u32";let J$e=class xte extends J_{constructor(e,i=0,r,n){super(Uint32Array,e,i,r,n),this.elementType="u32"}slice(e,i){return this.sliceBuffer(xte,e,i)}static fromTypedArray(e,i){return new xte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};J$e.ElementType="u32";let K$e=class Ste extends K_{constructor(e,i=0,r,n){super(Uint32Array,e,i,r,n),this.elementType="u32"}slice(e,i){return this.sliceBuffer(Ste,e,i)}static fromTypedArray(e,i){return new Ste(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};K$e.ElementType="u32";let ele=class Tte extends X_{constructor(e,i=0,r,n){super(Int8Array,e,i,r,n),this.elementType="i8"}slice(e,i){return this.sliceBuffer(Tte,e,i)}static fromTypedArray(e,i){return new Tte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};ele.ElementType="i8";let Zj=class Ete extends Z_{constructor(e,i=0,r,n){super(Int8Array,e,i,r,n),this.elementType="i8"}slice(e,i){return this.sliceBuffer(Ete,e,i)}static fromTypedArray(e,i){return new Ete(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Zj.ElementType="i8";let Q$e=class Cte extends J_{constructor(e,i=0,r,n){super(Int8Array,e,i,r,n),this.elementType="i8"}slice(e,i){return this.sliceBuffer(Cte,e,i)}static fromTypedArray(e,i){return new Cte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};Q$e.ElementType="i8";let eLe=class Ate extends K_{constructor(e,i=0,r,n){super(Int8Array,e,i,r,n),this.elementType="i8"}slice(e,i){return this.sliceBuffer(Ate,e,i)}static fromTypedArray(e,i){return new Ate(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};eLe.ElementType="i8";let tLe=class Mte extends X_{constructor(e,i=0,r,n){super(Int16Array,e,i,r,n),this.elementType="i16"}slice(e,i){return this.sliceBuffer(Mte,e,i)}static fromTypedArray(e,i){return new Mte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};tLe.ElementType="i16";let e6=class Ote extends Z_{constructor(e,i=0,r,n){super(Int16Array,e,i,r,n),this.elementType="i16"}slice(e,i){return this.sliceBuffer(Ote,e,i)}static fromTypedArray(e,i){return new Ote(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};e6.ElementType="i16";let iLe=class Pte extends J_{constructor(e,i=0,r,n){super(Int16Array,e,i,r,n),this.elementType="i16"}slice(e,i){return this.sliceBuffer(Pte,e,i)}static fromTypedArray(e,i){return new Pte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};iLe.ElementType="i16";let rLe=class Rte extends K_{constructor(e,i=0,r,n){super(Int16Array,e,i,r,n),this.elementType="i16"}slice(e,i){return this.sliceBuffer(Rte,e,i)}static fromTypedArray(e,i){return new Rte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};rLe.ElementType="i16";let nLe=class Ite extends X_{constructor(e,i=0,r,n){super(Int32Array,e,i,r,n),this.elementType="i32"}slice(e,i){return this.sliceBuffer(Ite,e,i)}static fromTypedArray(e,i){return new Ite(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};nLe.ElementType="i32";let sLe=class $te extends Z_{constructor(e,i=0,r,n){super(Int32Array,e,i,r,n),this.elementType="i32"}slice(e,i){return this.sliceBuffer($te,e,i)}static fromTypedArray(e,i){return new $te(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};sLe.ElementType="i32";let oLe=class Lte extends J_{constructor(e,i=0,r,n){super(Int32Array,e,i,r,n),this.elementType="i32"}slice(e,i){return this.sliceBuffer(Lte,e,i)}static fromTypedArray(e,i){return new Lte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};oLe.ElementType="i32";let aLe=class Dte extends K_{constructor(e,i=0,r,n){super(Int32Array,e,i,r,n),this.elementType="i32"}slice(e,i){return this.sliceBuffer(Dte,e,i)}static fromTypedArray(e,i){return new Dte(e.buffer,e.byteOffset,i,e.byteOffset+e.byteLength)}};aLe.ElementType="i32";function Yme(t){switch(t){case"u8":case"i8":return 1;case"u16":case"i16":return 2;case"u32":case"i32":case"f32":return 4;case"f64":return 8}}let Xme=class lLe{constructor(e,i){this.layout=e,this.buffer=typeof i=="number"?new ArrayBuffer(i*e.stride):i;for(const r of e.fields.keys()){const n=e.fields.get(r);this[r]=new n.constructor(this.buffer,n.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,i){const r=this[e];return r&&r.elementCount===i.ElementCount&&r.elementType===i.ElementType?r:null}slice(e,i){return new lLe(this.layout,this.buffer.slice(e*this.stride,i*this.stride))}copyFrom(e,i=0,r=0,n=e.count){const s=this.stride;if(s%4==0){const o=new Uint32Array(e.buffer,i*s,n*s/4);new Uint32Array(this.buffer,r*s,n*s/4).set(o)}else{const o=new Uint8Array(e.buffer,i*s,n*s);new Uint8Array(this.buffer,r*s,n*s).set(o)}return this}get usedMemory(){return this.byteLength}dispose(){}},cLe=class uLe{constructor(e=null){this._stride=0,this._lastAligned=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach(i=>this._fields.set(i[0],{...i[1],constructor:zyt(i[1].constructor)})))}vec2f(e,i){return this._appendField(e,RE,i),this}vec2f64(e,i){return this._appendField(e,Jae,i),this}vec3f(e,i){return this._appendField(e,Ca,i),this}vec3f64(e,i){return this._appendField(e,n0,i),this}vec4f(e,i){return this._appendField(e,Um,i),this}vec4f64(e,i){return this._appendField(e,Gj,i),this}mat3f(e,i){return this._appendField(e,Y2,i),this}mat3f64(e,i){return this._appendField(e,Yae,i),this}mat4f(e,i){return this._appendField(e,Xae,i),this}mat4f64(e,i){return this._appendField(e,zL,i),this}vec4u8(e,i){return this._appendField(e,Pc,i),this}f32(e,i){return this._appendField(e,jj,i),this}f64(e,i){return this._appendField(e,Zae,i),this}u8(e,i){return this._appendField(e,$P,i),this}u16(e,i){return this._appendField(e,Wj,i),this}i8(e,i){return this._appendField(e,ele,i),this}vec2i8(e,i){return this._appendField(e,Zj,i),this}vec2i16(e,i){return this._appendField(e,e6,i),this}vec2u8(e,i){return this._appendField(e,Hj,i),this}vec4u16(e,i){return this._appendField(e,Q9,i),this}u32(e,i){return this._appendField(e,Xj,i),this}_appendField(e,i,r){if(this._fields.has(e))return void Xt(!1,`${e} already added to vertex buffer layout`);const n=i.ElementCount*Yme(i.ElementType),s=this._stride;this._stride+=n,this._fields.set(e,{size:n,constructor:i,offset:s,optional:r})}createBuffer(e){return new Xme(this,e)}createView(e){return new Xme(this,e)}clone(){const e=new uLe;return e._stride=this._stride,e._fields=new Map,this._fields.forEach((i,r)=>e._fields.set(r,i)),e.BufferType=this.BufferType,e}get stride(){if(this._lastAligned!==this._fields.size){let e=1;this._fields.forEach(i=>e=Math.max(e,Yme(i.constructor.ElementType))),this._stride=Math.floor((this._stride+e-1)/e)*e,this._lastAligned=this._fields.size}return this._stride}get fields(){return this._fields}};function ls(){return new cLe}let Fyt=class{constructor(e){this.fields=new Array,e.fields.forEach((i,r)=>{const n={...i,constructor:hLe(i.constructor)};this.fields.push([r,n])}),this.stride=e.stride}};const kyt=[jj,RE,Ca,Um,Y2,Xae,Zae,Jae,n0,Gj,Yae,zL,$P,Hj,qj,Pc,Wj,Kae,Yj,Q9,Xj,Qae,J$e,K$e,ele,Zj,Q$e,eLe,tLe,e6,iLe,rLe,nLe,sLe,oLe,aLe];function hLe(t){return`${t.ElementType}_${t.ElementCount}`}function zyt(t){return dLe.get(t)}const dLe=new Map;kyt.forEach(t=>dLe.set(hLe(t),t));function Qa(t,e=!1){return t<=nd?e?new Array(t).fill(0):new Array(t):new Float64Array(t)}function pLe(t){return(Gf(t)?t.length:t.byteLength/8)<=nd?Array.from(t):new Float64Array(t)}function zf(t,e,i){return Array.isArray(t)?t.slice(e,e+i):t.subarray(e,e+i)}function Uyt(t,e){for(let i=0;i(e=e&&r===0,i=i&&r===n,!e&&!i)),e?mx(t.length):i?IE(t.length):Gf(t)||t.BYTES_PER_ELEMENT!==Uint16Array.BYTES_PER_ELEMENT?Vyt(t):t}function Vyt(t){let e=!0;for(const i of t){if(i>=65536)return Gf(t)?new Uint32Array(t):t;i>=256&&(e=!1)}return e?new Uint8Array(t):new Uint16Array(t)}function EU(t){return t<=nd?new Array(t):t<=65536?new Uint16Array(t):new Uint32Array(t)}function Byt(t){return t<=nd?new Array(t):new Uint32Array(t)}let aC=(()=>{const t=new Uint32Array(131072);for(let e=0;e{const t=new Uint16Array(65536);for(let e=0;eaC.length){const e=Math.max(2*aC.length,t);aC=new Uint32Array(e);for(let i=0;itN.length){const e=Math.max(2*tN.length,t);tN=new Uint8Array(e)}return new Uint8Array(tN.buffer,0,t)}var Nte;(function(t){function e(o,a){const c=o[a],p=o[a+1],_=o[a+2];return Math.sqrt(c*c+p*p+_*_)}function i(o,a){const c=o[a],p=o[a+1],_=o[a+2],x=1/Math.sqrt(c*c+p*p+_*_);o[a]*=x,o[a+1]*=x,o[a+2]*=x}function r(o,a,c){o[a]*=c,o[a+1]*=c,o[a+2]*=c}function n(o,a,c,p,_,x=a){(_=_||o)[x]=o[a]+c[p],_[x+1]=o[a+1]+c[p+1],_[x+2]=o[a+2]+c[p+2]}function s(o,a,c,p,_,x=a){(_=_||o)[x]=o[a]-c[p],_[x+1]=o[a+1]-c[p+1],_[x+2]=o[a+2]-c[p+2]}t.length=e,t.normalize=i,t.scale=r,t.add=n,t.subtract=s})(Nte||(Nte={}));var Ws;(function(t){t[t.Layer=0]="Layer",t[t.Object=1]="Object",t[t.Mesh=2]="Mesh",t[t.Line=3]="Line",t[t.Point=4]="Point",t[t.Material=5]="Material",t[t.Texture=6]="Texture",t[t.COUNT=7]="COUNT"})(Ws||(Ws={}));function jyt(t){if(t.length=1),Xt(r.size===3||r.size===4);const{data:n,size:s,indices:o}=r;Xt(o.length%this._numIndexPerPrimitive==0),Xt(o.length>=e.length*this._numIndexPerPrimitive);const a=e.length;let c=s*o[this._numIndexPerPrimitive*e[0]];Ox.clear(),Ox.push(c);const p=st(n[c],n[c+1],n[c+2]),_=Xr(p);for(let C=0;C0&&++c;if(c<2)return;const p=new Array(8);for(let _=0;_<8;++_)p[_]=n[_]>0?new Uint32Array(n[_]):void 0;for(let _=0;_<8;++_)n[_]=0;for(let _=0;_Gyt());const Pq=W(),Kme=W();function qyt(t,e){if(!t)return!1;const{size:i,data:r,indices:n}=t;Ie(e,0,0,0),Ie(ff,0,0,0);let s=0,o=0;for(let a=0;a1&&De(e,e,1/o),o>0}function Yyt(t,e,i){if(!t)return!1;Ie(i,0,0,0),Ie(ff,0,0,0);let r=0,n=0;const{size:s,data:o,indices:a}=t,c=a.length-1,p=c+(e?2:0);for(let _=0;_0?(Be(i,i,De(Ga,Ga,M)),r+=M):r===0&&(Be(ff,ff,Ga),n++)}return r!==0?(De(i,i,1/r),!0):n!==0&&(De(i,ff,1/n),!0)}const Ga=W(),Hv=W(),iN=W(),ff=W();let CU=class{constructor(e){this.channel=e,this.id=mp()}};function Fte(t,e){return t==null&&(t=[]),t.push(e),t}function kte(t,e){if(t==null)return null;const i=t.filter(r=>r!==e);return i.length===0?null:i}function Xyt(t,e,i,r,n){rN[0]=t.get(e,0),rN[1]=t.get(e,1),rN[2]=t.get(e,2),Qee(rN,Px,3),i.set(n,0,Px[0]),r.set(n,0,Px[1]),i.set(n,1,Px[2]),r.set(n,1,Px[3]),i.set(n,2,Px[4]),r.set(n,2,Px[5])}const rN=W(),Px=new Float32Array(6);let jo=class yLe extends t6{constructor(e,i,r=null,n=Ws.Mesh,s=null,o=-1){super(),this.material=e,this.mapPositions=r,this.type=n,this.objectAndLayerIdColor=s,this.edgeIndicesLength=o,this.visible=!0,this._attributes=new Map,this._boundingInfo=null;for(const[a,c]of i)this._attributes.set(a,{...c,indices:Ny(c.indices)}),a===J.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._attributes.get(a).indices.length:this.edgeIndicesLength)}instantiate(e={}){const i=new yLe(e.material||this.material,[],this.mapPositions,this.type,this.objectAndLayerIdColor,this.edgeIndicesLength);return this._attributes.forEach((r,n)=>{r.exclusive=!1,i._attributes.set(n,r)}),i._boundingInfo=this._boundingInfo,i.transformation=e.transformation||this.transformation,i}get attributes(){return this._attributes}getMutableAttribute(e){let i=this._attributes.get(e);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:jyt(i.data)},this._attributes.set(e,i)),i}setAttributeData(e,i){const r=this._attributes.get(e);r&&this._attributes.set(e,{...r,exclusive:!0,data:i})}get indexCount(){const e=this._attributes.values().next().value.indices;return(e==null?void 0:e.length)??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo==null&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(e){return!!(this.type===Ws.Mesh?this._computeAttachmentOriginTriangles(e):this.type===Ws.Line?this._computeAttachmentOriginLines(e):this._computeAttachmentOriginPoints(e))&&(this._transformation!=null&&bt(e,e,this._transformation),!0)}_computeAttachmentOriginTriangles(e){const i=this.attributes.get(J.POSITION);return qyt(i,e)}_computeAttachmentOriginLines(e){const i=this.attributes.get(J.POSITION);return Yyt(i,Zyt(this.material.parameters,i),e)}_computeAttachmentOriginPoints(e){const i=this.attributes.get(J.POSITION);return Wyt(i,e)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const e=this.attributes.get(J.POSITION);if(!e||e.indices.length===0)return null;const i=this.type===Ws.Mesh?3:1;Xt(e.indices.length%i==0,"Indexing error: "+e.indices.length+" not divisible by "+i);const r=IE(e.indices.length/i);return new mLe(r,i,e)}get transformation(){return this._transformation??gs}set transformation(e){this._transformation=e&&e!==gs?mP(e):null}addHighlight(){const e=new CU(P_.Highlight);return this.highlights=Fte(this.highlights,e),e}removeHighlight(e){this.highlights=kte(this.highlights,e)}};function Zyt(t,e){return!(!("isClosed"in t)||!t.isClosed)&&e.indices.length>2}const lC=Nte,Rq=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],Jyt=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],Kyt=[0,0,1,0,1,1,0,1],Qyt=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],vLe=new Array(36);for(let t=0;t<6;t++)for(let e=0;e<6;e++)vLe[6*t+e]=t;const tS=new Array(36);for(let t=0;t<6;t++)tS[6*t]=0,tS[6*t+1]=1,tS[6*t+2]=2,tS[6*t+3]=2,tS[6*t+4]=3,tS[6*t+5]=0;function e1t(t,e){Array.isArray(e)||(e=[e,e,e]);const i=new Array(24);for(let r=0;r<8;r++)i[3*r]=Rq[r][0]*e[0],i[3*r+1]=Rq[r][1]*e[1],i[3*r+2]=Rq[r][2]*e[2];return new jo(t,[[J.POSITION,new $t(i,Qyt,3,!0)],[J.NORMAL,new $t(Jyt,vLe,3)],[J.UV0,new $t(Kyt,tS,2)]])}const Iq=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],t1t=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],i1t=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],r1t=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function n1t(t,e){Array.isArray(e)||(e=[e,e,e]);const i=new Array(18);for(let r=0;r<6;r++)i[3*r]=Iq[r][0]*e[0],i[3*r+1]=Iq[r][1]*e[1],i[3*r+2]=Iq[r][2]*e[2];return new jo(t,[[J.POSITION,new $t(i,i1t,3,!0)],[J.NORMAL,new $t(t1t,r1t,3)]])}const QF=mn(-.5,0,-.5),ek=mn(.5,0,-.5),tk=mn(0,0,.5),ik=mn(0,.5,0),cC=js(),uC=js(),TO=js(),EO=js(),CO=js();je(cC,QF,ik),je(uC,QF,ek),Wt(TO,cC,uC),Ye(TO,TO),je(cC,ek,ik),je(uC,ek,tk),Wt(EO,cC,uC),Ye(EO,EO),je(cC,tk,ik),je(uC,tk,QF),Wt(CO,cC,uC),Ye(CO,CO);const $q=[QF,ek,tk,ik],s1t=[0,-1,0,TO[0],TO[1],TO[2],EO[0],EO[1],EO[2],CO[0],CO[1],CO[2]],o1t=[0,1,2,3,1,0,3,2,1,3,0,2],a1t=[0,0,0,1,1,1,2,2,2,3,3,3];function l1t(t,e){Array.isArray(e)||(e=[e,e,e]);const i=new Array(12);for(let r=0;r<4;r++)i[3*r]=$q[r][0]*e[0],i[3*r+1]=$q[r][1]*e[1],i[3*r+2]=$q[r][2]*e[2];return new jo(t,[[J.POSITION,new $t(i,o1t,3,!0)],[J.NORMAL,new $t(s1t,a1t,3)]])}function zni(t,e,i,r,n={uv:!0}){const s=-Math.PI,o=2*Math.PI,a=-Math.PI/2,c=Math.PI,p=Math.max(3,Math.floor(i)),_=Math.max(2,Math.floor(r)),x=(p+1)*(_+1),S=$s(3*x),C=$s(3*x),M=$s(2*x),P=[];let $=0;for(let k=0;k<=_;k++){const U=[],j=k/_,G=a+j*c,Y=Math.cos(G);for(let Q=0;Q<=p;Q++){const ne=Q/p,ie=s+ne*o,he=Math.cos(ie)*Y,ce=Math.sin(G),ve=-Math.sin(ie)*Y;S[3*$]=he*e,S[3*$+1]=ce*e,S[3*$+2]=ve*e,C[3*$]=he,C[3*$+1]=ce,C[3*$+2]=ve,M[2*$]=ne,M[2*$+1]=j,U.push($),++$}P.push(U)}const F=new Array;for(let k=0;k<_;k++)for(let U=0;U_&&([p,_]=[_,p]);const x=p.toString()+"."+_.toString();if(o[x])return o[x];let S=n.length;return n.length+=3,lC.add(n,3*p,n,3*_,n,S),lC.scale(n,S,t/lC.length(n,S)),S/=3,o[x]=S,S}for(let p=0;p3?255*r[3]:255]:[255,255,255,255],S=n!=null&&n.length===2?n:[1,1],C=mx(1),M=[[J.POSITION,new $t(p,C,3,!0)],[J.NORMAL,new $t(_,C,3,!0)],[J.UV0,new $t(o,C,o.length)],[J.COLOR,new $t(x,C,4,!0)],[J.SIZE,new $t(S,C,2)]];if(s!=null){const P=[s[0],s[1],s[2],s[3]];M.push([J.AUXPOS1,new $t(P,C,4)])}if(a!=null){const P=[a[0],a[1],a[2],a[3]];M.push([J.FEATUREATTRIBUTE,new $t(P,C,4)])}return new jo(t,M,null,Ws.Point,c)}const u1t=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function Uni(t,e=u1t){const i=new Array(12);for(let p=0;p<4;p++)for(let _=0;_<3;_++)i[3*p+_]=e[p][_];const r=[0,1,2,2,3,0],n=[0,0,1],s=[0,0,0,0,0,0],o=[0,0,1,0,1,1,0,1],a=[255,255,255,255],c=[[J.POSITION,new $t(i,r,3,!0)],[J.NORMAL,new $t(n,s,3,!0)],[J.UV0,new $t(o,r,2,!0)],[J.COLOR,new $t(a,s,4,!0)]];return new jo(t,c)}function Qme(t,e,i,r,n,s=!0,o=!0){let a=0;const c=i,p=e;let _=mn(0,a,0),x=mn(0,a+p,0),S=mn(0,-1,0),C=mn(0,1,0);n&&(a=p,x=mn(0,0,0),_=mn(0,a,0),S=mn(0,1,0),C=mn(0,-1,0));const M=[x,_],P=[S,C],$=r+2,F=Math.sqrt(p*p+c*c);if(n)for(let Y=r-1;Y>=0;Y--){const Q=Y*(2*Math.PI/r),ne=mn(Math.cos(Q)*c,a,Math.sin(Q)*c);M.push(ne);const ie=mn(p*Math.cos(Q)/F,-c/F,p*Math.sin(Q)/F);P.push(ie)}else for(let Y=0;Y{k[ie]=he,U[ie]=ce};let G=0;const Y=js(),Q=js();for(let ie=0;ie1);const o=[[0,0,0]],a=[],c=[];for(let p=0;p0?n[le][0]:-n[le][0]-1+r.length),_.push(n[le][1]>0?n[le][1]:-n[le][1]-1+r.length),_.push(n[le][2]>0?n[le][2]:-n[le][2]-1+r.length),x.push(0),x.push(0),x.push(0);let ce=r.length;const ve=r.length-1;for(let le=0;le0&&(Ne(M,P),le=0?ce+n[le][0]:-n[le][0]-1+Ee),_.push(n[le][2]>=0?ce+n[le][2]:-n[le][2]-1+Ee),_.push(n[le][1]>=0?ce+n[le][1]:-n[le][1]-1+Ee),x.push(pe),x.push(pe),x.push(pe);const te=[[J.POSITION,new $t(c,_,3,!0)],[J.NORMAL,new $t(p,x,3,!0)]];return new jo(t,te)}function Bni(t,e,i,r){Xt(e.length>1,"createPolylineGeometry(): polyline needs at least 2 points"),Xt(e[0].length===3,"createPolylineGeometry(): malformed vertex"),Xt(i==null||i.length===e.length,"createPolylineGeometry: need same number of points and normals"),Xt(i==null||i[0].length===3,"createPolylineGeometry(): malformed normal");const n=Qa(3*e.length),s=new Array(2*(e.length-1));let o=0,a=0;for(let p=0;p0&&(s[a++]=p-1,s[a++]=p)}const c=[[J.POSITION,new $t(n,s,3,!0)]];if(i){const p=$s(3*i.length);let _=0;for(let x=0;xn)&&(Wt(i,t,e),Ye(i,i),Wt(r,i,t),Ye(r,r),!0)}function AU(t,e,i,r,n,s,o){return Lq(t,e,n,s,o)||Lq(t,i,n,s,o)||Lq(t,r,n,s,o)}const ege=.99619469809,hC=js();let f1t=class{constructor(e,i){this.type=gc.Local,this._configuration=new Gae,this._passParameters=new Bj,this._configuration.geometry=r1.Cylinder,this._technique=i.techniqueRepository.acquire(SU,this._configuration);const r=i.renderContext.rctx;this._vao=this._createVertexArrayObject(r),this._vaoCount=s_(this._vao,"geometry");const n=new rn;n.wrapMode=Bi.CLAMP_TO_EDGE,n.flipped=!0,n.width=1,n.height=512,this._passParameters.texture=new Ai(r,n,Lyt)}destroy(){this._passParameters.texture=Kt(this._passParameters.texture),this._vao.dispose(),this._technique.release()}render(e){const i=e.rctx,r=i.bindTechnique(this._technique,this._passParameters,e.bindParameters);m1t(tge,e.bindParameters.camera.viewMatrix),r.setUniformMatrix4fv("view",tge),i.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),i.drawArrays(sr.TRIANGLES,0,this._vaoCount)}renderHaze(){return!1}_createVertexArrayObject(e){const i=_Le(1,2,!1),{data:r,indices:n}=i[0][1],s=ige.createBuffer(n.length),o=s.position;for(let a=0;a1-511/512,v1t=bF([[50,.1015625],[500,.21875],[5e3,1-250/512],[5e4,.4140625]]);let _1t=class{constructor(e,i){this.view=e,this.type=gc.Mars,this._passParameters=new Bj,this._vaoCount=0,this._texV1=1;const r=Tr(e.spatialReference);this._planetRadius=r.radius,this._outerRimWidth=r.outerAtmosphereRimWidth,this._innerRimFactor=(this._planetRadius+rge)/this._planetRadius,this._middleRimFactor=(this._planetRadius+nge)/this._planetRadius,this._outerRimFactor=(this._planetRadius+this._outerRimWidth)/this._planetRadius,this._texV0=nge/this._outerRimWidth,this._texVScale=this._texV1-this._texV0,this._techniqueRepository=i.techniqueRepository;const n=i.renderContext.rctx;this._cameraChangeHandle=_e(()=>{var a;return(a=this.view.state)==null?void 0:a.camera},()=>i.requestRender(),kt),this._vao=this._createRibbon(n),this._vaoCount=s_(this._vao,"geometry"),this._fadeVao=v1(n),this._fadeVaoCount=s_(this._fadeVao,"geometry");const s=new rn;s.wrapMode=Bi.CLAMP_TO_EDGE,s.flipped=!0,s.width=1,s.height=512,this._passParameters.texture=new Ai(n,s,g1t);const o=new Gae;o.geometry=r1.Cone,this._coneTechnique=this._techniqueRepository.acquire(SU,o),o.geometry=r1.Underground,this._undergroundTechnique=this._techniqueRepository.acquire(SU,o)}destroy(){this._coneTechnique.release(),this._undergroundTechnique.release(),this._cameraChangeHandle.remove(),this._passParameters.texture=Kt(this._passParameters.texture),this._fadeVao.dispose(),this._vao.dispose()}render(e){const i=e.bindParameters.camera;this._update(i);const r=e.rctx;this._passParameters.undergroundFadeAlpha<1&&(r.bindTechnique(this._coneTechnique,this._passParameters,e.bindParameters),r.bindVAO(this._vao),r.drawArrays(sr.TRIANGLES,0,this._vaoCount)),this._passParameters.undergroundFadeAlpha>0&&(r.bindTechnique(this._undergroundTechnique,this._passParameters,e.bindParameters),r.bindVAO(this._fadeVao),r.drawArrays(sr.TRIANGLE_STRIP,0,this._fadeVaoCount))}renderHaze(){}_update(e){const i=W(),r=this._planetRadius,n=nt(e.eye),s=n-r;if(s<0){const C=Math.min(-s/5e3,1);this._passParameters.undergroundFadeAlpha=C}else this._passParameters.undergroundFadeAlpha=0;const o=Math.max(Dq,s),a=r+rge;this._passParameters.innerScale=b1t(r+o,r,a)-1,this._passParameters.altitudeFade=Eae(s),De(i,e.eye,(r+Dq)/n),sge(i,e.center,e.up,r,this._passParameters.silhouette);const c=this._computeScreenRimWidth(e,i,e.up,this._passParameters.silhouette),p=y1t(),_=v1t(s);let x=this._texV0+p*this._texVScale,S=this._texV0+c*_*this._texVScale;if(s>Dq){sge(e.eye,e.center,e.up,r,this._passParameters.silhouette);const C=this._computeScreenRimWidth(e,e.eye,e.up,this._passParameters.silhouette),M=Je((C-1.5)/(c-1.5),0,1);x=this._texV0+M*p*this._texVScale,S=this._texV0+ui(this._texV1,c*_,M)*this._texVScale}or(this._passParameters.texV,x,S)}_createRibbon(e){const i=$s(3+3*nN*3),r=new Uint32Array(3*nN*5);i[0]=0,i[1]=0,i[2]=-1;for(let o=0;or.camera.eye)),e.vertex.uniforms.add(new Oi("offset",(i,r)=>w1t(i,r))),e.vertex.uniforms.add(new ft("width",i=>i.width)),e.vertex.uniforms.add(new bs("proj",(i,r)=>r.camera.projectionMatrix)),e.vertex.uniforms.add(new bs("view",(i,r)=>r.camera.viewMatrix)),e.vertex.uniforms.add(new ft("time",i=>i.time)),e.varyings.add("vUv","vec2"),e.vertex.code.add(V` vec3 hash31(float p){ vec3 p3 = fract(vec3(p) * vec3(0.1031, 0.1030, 0.0973)); p3 += dot(p3, p3.yzx + 33.33); @@ -1178,7 +1167,7 @@ fragColor = color; // Rain particles fall straight down and are randomly oriented // Snow particles have random sinusoid trajectories and are rotated to face the camera - ${t.type===T_.Rain?V` + ${t.type===R_.Rain?V` // Random rotation for particle vec3 rotationAxis = up; vec4 quat = vec4(rotationAxis * sin(angle), cos(angle)); @@ -1203,7 +1192,7 @@ fragColor = color; gl_Position = proj * (0.5 * vec4(position.xzy, 0.0) + pos); `} } - `),e.fragment.uniforms.add(new ft("opacity",i=>i.opacity),new Oi("particleColor",(i,r)=>Svt(r,t))),e.fragment.code.add(V` + `),e.fragment.uniforms.add(new ft("opacity",i=>i.opacity),new Oi("particleColor",(i,r)=>x1t(r,t))),e.fragment.code.add(V` void main() { // Cut off corners of the triangle @@ -1213,10 +1202,10 @@ fragColor = color; float d = length(vUv - vec2(0.5)); - ${t.type===T_.Rain?V`d = 0.35 * smoothstep(0.5, 0.0, d);`:V`d = smoothstep(0.5, 0.1, d);`} + ${t.type===R_.Rain?V`d = 0.35 * smoothstep(0.5, 0.0, d);`:V`d = smoothstep(0.5, 0.1, d);`} fragColor = opacity * vec4(particleColor * d, d); } - `),e}function xvt(t,e){const i=e.camera.eye,r=.5*t.width,n=1/t.width,s=pAe($te,Ie($te,(i[0]+r)*n,(i[1]+r)*n,(i[2]+r)*n));return xn(s,i,De(s,s,t.width))}function Svt(t,e){const i=e.type===T_.Rain?Evt:Tvt,r=De($te,i,Cvt),n=t.camera.eye;Ye(oge,n);const s=Math.max(0,Ve(oge,t.lighting.mainLight.direction));return Qr(r,r,i,s)}const $te=W(),oge=W(),Tvt=nt(1,1,1),Evt=nt(.85,.85,.85),Cvt=.7,Avt=Object.freeze(Object.defineProperty({__proto__:null,build:TLe},Symbol.toStringTag,{value:"Module"}));let Mvt=class extends _n{constructor(){super(...arguments),this.time=0,this.radius=1,this.width=500,this.opacity=1}},Lte=class ELe extends Hr{initializeProgram(e){return new Ir(e.rctx,ELe.shader.get().build(this.configuration),WF)}initializePipeline(){return Ti({blending:Ol(st.ONE,st.ONE,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};Lte.shader=new Rr(Avt,()=>we(()=>Promise.resolve().then(()=>_Wt),void 0));const WF=new Map([[J.POSITION,0],[J.INSTANCEFEATUREATTRIBUTE,1]]);let CLe=class{constructor(){this.enabled=!0,this._time=0}get time(){return this._time}advance({deltaTime:e,fixedTime:i}){return i!=null?this._time!==i&&(this._time=i,!0):(this._time=this._time+e,e!==0)}},Ovt=class{constructor(e,i){this.deltaTime=e,this.fixedTime=i}},Z3=class extends ze{constructor(e){super(e),this._numParticles=25e4,this._rainSpeed=.1,this._snowSpeed=.01,this._passParameters=new Mvt,this._animation=new CLe,this._updatingTracking=new Rf,this._passParameters.time=0,this._passParameters.radius=Sr(e.view.spatialReference).radius,this._techniqueRepository=e.context.techniqueRepository}destroy(){this._updatingTracking.destroy(),this._numParticles=0,this._snowTechniqueCached=ir(this._snowTechniqueCached),this._rainTechniqueCached=ir(this._rainTechniqueCached),this._vao=Kt(this._vao),this._instanceIdBuffer=Kt(this._instanceIdBuffer)}get updating(){return this._updatingTracking.updating}get _rainTechnique(){if(this._rainTechniqueCached==null){const e=new Ite;e.type=T_.Rain,this._rainTechniqueCached=this._techniqueRepository.acquire(Lte,e)}return this._rainTechniqueCached}get _snowTechnique(){if(this._snowTechniqueCached==null){const e=new Ite;e.type=T_.Snow,this._snowTechniqueCached=this._techniqueRepository.acquire(Lte,e)}return this._snowTechniqueCached}update(e){return this._animation.advance(e)}render(e,i,r){const n=r==="rainy"?this._rainTechnique:this._snowTechnique;if(!n.compiled)return void this.context.requestRender();const s=e.rctx;if(this._ensureResources(s),n==null||this._vao==null||this._instanceIdBuffer==null||(e.bindParameters.cloudsFade.data!=null&&(this._passParameters.opacity=e.bindParameters.cloudsFade.opacity),this._passParameters.opacity<=0))return;const o=.35;i=i<.5?ui(0,o,2*i):ui(o,1,2*(i-.5)),this._passParameters.time=(r==="rainy"?this._rainSpeed:this._snowSpeed)*Qre(this._animation.time)%1e5;const l=s.bindTechnique(n,this._passParameters,e.bindParameters);s.bindVAO(this._vao),l.assertCompatibleVertexAttributeLocations(this._vao),fae(s,WF,this._instanceIdBuffer,age,0),s.drawArraysInstanced(sr.TRIANGLES,0,3,this._numParticles*i),mae(s,WF,this._instanceIdBuffer,age)}_ensureResources(e){this._vao==null&&(this._vao=this._createVertexArrayObject(e)),this._instanceIdBuffer==null&&(this._instanceIdBuffer=this._createInstanceIndices(e))}_createInstanceIndices(e){const i=[];for(let r=0;rRvt(e,i)),new gr("viewport",(e,i)=>i.camera.fullViewport),new ft("pixelRatio",(e,i)=>i.camera.pixelRatio)),t.vertex.code.add(V`void main(void) { + `),e}function w1t(t,e){const i=e.camera.eye,r=.5*t.width,n=1/t.width,s=MEe(Vte,Ie(Vte,(i[0]+r)*n,(i[1]+r)*n,(i[2]+r)*n));return Sn(s,i,De(s,s,t.width))}function x1t(t,e){const i=e.type===R_.Rain?T1t:S1t,r=De(Vte,i,E1t),n=t.camera.eye;Ye(age,n);const s=Math.max(0,Ve(age,t.lighting.mainLight.direction));return Qr(r,r,i,s)}const Vte=W(),age=W(),S1t=st(1,1,1),T1t=st(.85,.85,.85),E1t=.7,C1t=Object.freeze(Object.defineProperty({__proto__:null,build:bLe},Symbol.toStringTag,{value:"Module"}));let A1t=class extends bn{constructor(){super(...arguments),this.time=0,this.radius=1,this.width=500,this.opacity=1}},Bte=class wLe extends Hr{initializeProgram(e){return new $r(e.rctx,wLe.shader.get().build(this.configuration),rk)}initializePipeline(){return Ti({blending:Pl(ot.ONE,ot.ONE,ot.ONE_MINUS_SRC_ALPHA,ot.ONE_MINUS_SRC_ALPHA),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};Bte.shader=new Ir(C1t,()=>we(()=>Promise.resolve().then(()=>tXt),void 0));const rk=new Map([[J.POSITION,0],[J.INSTANCEFEATUREATTRIBUTE,1]]);let xLe=class{constructor(){this.enabled=!0,this._time=0}get time(){return this._time}advance({deltaTime:e,fixedTime:i}){return i!=null?this._time!==i&&(this._time=i,!0):(this._time=this._time+e,e!==0)}},M1t=class{constructor(e,i){this.deltaTime=e,this.fixedTime=i}},iS=class extends ze{constructor(e){super(e),this._numParticles=25e4,this._rainSpeed=.1,this._snowSpeed=.01,this._passParameters=new A1t,this._animation=new xLe,this._updatingTracking=new Nf,this._passParameters.time=0,this._passParameters.radius=Tr(e.view.spatialReference).radius,this._techniqueRepository=e.context.techniqueRepository}destroy(){this._updatingTracking.destroy(),this._numParticles=0,this._snowTechniqueCached=ir(this._snowTechniqueCached),this._rainTechniqueCached=ir(this._rainTechniqueCached),this._vao=Kt(this._vao),this._instanceIdBuffer=Kt(this._instanceIdBuffer)}get updating(){return this._updatingTracking.updating}get _rainTechnique(){if(this._rainTechniqueCached==null){const e=new Ute;e.type=R_.Rain,this._rainTechniqueCached=this._techniqueRepository.acquire(Bte,e)}return this._rainTechniqueCached}get _snowTechnique(){if(this._snowTechniqueCached==null){const e=new Ute;e.type=R_.Snow,this._snowTechniqueCached=this._techniqueRepository.acquire(Bte,e)}return this._snowTechniqueCached}update(e){return this._animation.advance(e)}render(e,i,r){const n=r==="rainy"?this._rainTechnique:this._snowTechnique;if(!n.compiled)return void this.context.requestRender();const s=e.rctx;if(this._ensureResources(s),n==null||this._vao==null||this._instanceIdBuffer==null||(e.bindParameters.cloudsFade.data!=null&&(this._passParameters.opacity=e.bindParameters.cloudsFade.opacity),this._passParameters.opacity<=0))return;const o=.35;i=i<.5?ui(0,o,2*i):ui(o,1,2*(i-.5)),this._passParameters.time=(r==="rainy"?this._rainSpeed:this._snowSpeed)*vne(this._animation.time)%1e5;const a=s.bindTechnique(n,this._passParameters,e.bindParameters);s.bindVAO(this._vao),a.assertCompatibleVertexAttributeLocations(this._vao),Aae(s,rk,this._instanceIdBuffer,lge,0),s.drawArraysInstanced(sr.TRIANGLES,0,3,this._numParticles*i),Mae(s,rk,this._instanceIdBuffer,lge)}_ensureResources(e){this._vao==null&&(this._vao=this._createVertexArrayObject(e)),this._instanceIdBuffer==null&&(this._instanceIdBuffer=this._createInstanceIndices(e))}_createInstanceIndices(e){const i=[];for(let r=0;rP1t(e,i)),new gr("viewport",(e,i)=>i.camera.fullViewport),new ft("pixelRatio",(e,i)=>i.camera.pixelRatio)),t.vertex.code.add(V`void main(void) { gl_Position = transform * vec4(position, 0); vcolor = color / 1.2; vsize = size * 5.0 * pixelRatio; @@ -1231,7 +1220,7 @@ if (vsize < 3.0) { intensity *= 0.5; } fragColor = vec4(vcolor.xyz, intensity); -}`),t}function Rvt(t,e){return Ao(pb,e.camera.projectionMatrix),pb[10]=24e-8-1,pb[11]=-1,pb[14]=(24e-8-2)*e.camera.near,nn(pb,pb,e.camera.viewMatrix),nn(pb,pb,t.modelMatrix)}const pb=Qe(),Ivt=Object.freeze(Object.defineProperty({__proto__:null,build:ALe},Symbol.toStringTag,{value:"Module"}));let $vt=class extends _n{constructor(){super(...arguments),this.modelMatrix=Qe()}},MLe=class OLe extends Hr{constructor(e){super(e,new nh,()=>this.destroy())}initializeProgram(e){return new Ir(e.rctx,OLe.shader.get().build(),Er)}initializePipeline(){return Ti({blending:Ol(st.SRC_ALPHA,st.ONE,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};MLe.shader=new Rr(Ivt,()=>we(()=>Promise.resolve().then(()=>bWt),void 0));let hw=class extends ze{get updating(){return this._updatingTracking.updating||this.loading}get loading(){return this._loadDataTask!=null&&!this._loadDataTask.finished}constructor(e){super(e),this._loadDataTask=null,this._numPoints=0,this._renderParameter=new $vt,this._updatingTracking=new Rf}initialize(){this._loadDataTask=this._createLoadDataTask()}destroy(){this._loadDataTask=gn(this._loadDataTask),this._updatingTracking.destroy(),this._numPoints=0,this._technique=ir(this._technique),this._vao=Kt(this._vao),Ex=null}render(e){const{rctx:i}=e;if(this._ensureResources(i),this._technique==null||this._vao==null)return;if(!this._technique.compiled)return void this.requestRender();const r=i.bindTechnique(this._technique,this._renderParameter,e.bindParameters);i.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),i.drawArrays(sr.POINTS,0,this._numPoints)}_ensureResources(e){if(this._technique!=null||Ex==null)return;this._technique=new MLe({rctx:e,viewingMode:this.view.state.viewingMode}),this._numPoints=Ex.byteLength/lge;const i=new Float32Array(Ex,0,2*this._numPoints),r=new Uint8Array(Ex,2*this._numPoints*4,this._numPoints);this._vao=this._createVertexArrayObject(e,i,r,this._numPoints),this._updatingTracking.add(()=>this.view.environment.lighting.type!=="virtual"?this.view.environment.lighting.date:null,n=>this._update(n),ii)}_computeDayDuration(e){const i=e,r=new Date(e.getFullYear(),0,1,11,58,56);return(+i-+r)/(+new Date(e.getFullYear()+1,0,1,11,58,55)-+r)}_update(e){if(!e)return;const i=(e.getHours()/12+e.getMinutes()/60*(2/24)+e.getSeconds()/60*(2/1440)-.9972222)%2,r=2*this._computeDayDuration(e),n=Ao(this._renderParameter.modelMatrix,Nvt);YO(n,n,-r*Math.PI),nn(n,Dvt,n),YO(n,n,-i*Math.PI),this.requestRender()}_hexToRGB(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}_unpackUint8Attributes(e){return e>=192?[2.9,e-192]:e>=160?[2.5,e-160]:e>=128?[2,e-128]:e>=96?[1.5,e-96]:e>=64?[1,e-64]:e>=32?[.7,e-32]:[.4,e]}_createVertexArrayObject(e,i,r,n){const s=cge.createBuffer(n),o=s.position,l=s.color,c=s.size;for(let f=0;f{const{data:r}=await yXe("esri/views/3d/environment/resources/stars.wsv",{responseType:"array-buffer",signal:i});this._verifyStarData(r),Ex=r});return e.promise.catch(i=>{sn(i)||Ce.getLogger(this).error(i)}).then(()=>{this.destroyed||(this.requestRender(),this.notifyChange("updating"))}),e}_verifyStarData(e){if(!e)throw new se("stars:no-data-received","Failed to create stars because star catalogue is missing");const i=e.byteLength/lge;if(i%1!=0||i>5e4||i<5e3)throw new se("stars:invalid-data","Failed to create stars because star catalogue data is invalid")}};y([w({constructOnly:!0})],hw.prototype,"view",void 0),y([w({constructOnly:!0})],hw.prototype,"requestRender",void 0),y([w({readOnly:!0})],hw.prototype,"updating",null),y([w()],hw.prototype,"_loadDataTask",void 0),y([w()],hw.prototype,"_updatingTracking",void 0),hw=y([Z("esri.views.3d.environment.Stars")],hw);const Lvt=["9bb2ff","9eb5ff","aabfff","bbccff","ccd8ff ","dae2ff","e4e9ff","eeefff","f8f6ff","fff9fb","fff5ef","fff1e5","ffeddb","ffe9d2","ffe6ca","ffe3c3","ffe0bb","ffddb4","ffdaad","ffd6a5","ffd29c","ffcc8f","ffc178","ffa94b","ff7b00"],Dvt=Ooe(1,0,0,0,0,.9174771405229186,.39778850739794974,0,0,-.39778850739794974,.9174771405229186,0,0,0,0,1),Nvt=Ooe(1,0,0,0,0,.9174771405229186,-.39778850739794974,0,0,.39778850739794974,.9174771405229186,0,0,0,0,1),lge=9,cge=ls().vec3f(J.POSITION).vec4u8(J.COLOR).f32(J.SIZE);let Ex=null;const Vj={required:[]},PLe={required:[ue.Depth]},RLe={required:[ue.CompositeColor]},ILe={required:[ue.Highlight]},Fvt={required:[ue.Depth,ue.Normal]};let Bj=class extends ze{consumes(){return Vj}get usedMemory(){return 0}get isDecoration(){return!1}get running(){return!1}},CE=class extends Bj{},$Le=class extends Bj{},kvt=class extends Bj{},zvt=class extends Bj{};var bO;(function(t){t[t.Immediate=0]="Immediate",t[t.Faded=1]="Faded"})(bO||(bO={}));var aI;let Fl=aI=class extends CE{constructor(t){super(t),this.produces=new Map([[ke.ENVIRONMENT_OPAQUE,()=>!(this._atmosphere===null&&this._stars===null)],[ke.ENVIRONMENT_TRANSPARENT,()=>this._atmosphere!==null]]),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new Aq,this._newWeatherParameters=new Aq,this._fadedWeatherParameters=new Aq,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){var t;this.removeHandles(),this.uninitializeRenderContext(),((t=this.view)==null?void 0:t._stage)!=null&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return this.atmosphere!=null?this.atmosphere.type:pc.None}consumes(){return this._atmosphereType===pc.Realistic?PLe:Vj}updateAnimation(t){return this._precipitation!=null&&this._precipitation.update(t)}get updating(){return this._stars!=null&&this._stars.updating||this._clouds!=null&&this._clouds.running}get weatherVisible(){return rt(this.view.state.camera.eye)-Sr(this.view.spatialReference).radius<=Pv}get usedMemory(){var t;return((t=this._clouds)==null?void 0:t.usedMemory)??0}get _stars(){var r;const t=this.view,e=((r=t.environment)==null?void 0:r.starsEnabled)??!1,i=this._get("_stars");return e&&this._context!=null?i??new hw({view:t,requestRender:()=>this._setNeedsRender()}):(et(i),null)}get _precipitation(){const t=this._get("_precipitation");if(!this._precipitationEnabled||this._context==null)return et(t),null;const e=this.view,i=this._context;return t!=null&&t.context===i?t:(et(t),new Z3({context:i,view:e}))}get _clouds(){const t=this._get("_clouds");if(!this.weatherEnabled||this._context==null)return et(t),null;if(t!=null)return t;const e=this.view,i=this._context;return et(t),new Mu({context:i,view:e,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const t=this._get("_cloudsComposition");if(!this.weatherEnabled||this._context==null)return et(t),null;const e=this.view.state.viewingMode,i=this._context.renderContext.rctx,r=Sr(this.view.spatialReference).radius;return t!=null&&t.viewingMode===e&&t.planetRadius===r?t:(et(t),new W3({rctx:i,viewingMode:e,planetRadius:r,requestRender:()=>this._setNeedsRender()}))}get _fog(){const t=this._get("_fog");if(!this.weatherEnabled||this._context==null)return et(t),null;if(t!=null)return t;const e=this.view,i=this._context,r=this._context.renderContext.rctx,n=this.view.state.viewingMode;return new Y3({context:i,view:e,rctx:r,viewingMode:n})}get weatherEnabled(){var t,e;return!!((e=(t=this.view)==null?void 0:t.environmentManager)!=null&&e.weatherEnabled)}get _precipitationEnabled(){return this.weatherEnabled&&(this.view.environment.weather.type==="rainy"||this.view.environment.weather.type==="snowy")}initializeRenderContext(t=null){this._context=t;const e=()=>this._setNeedsRender();this.addHandles([_e(()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),i=>this._updateAtmosphere(i),kt),_e(()=>this._stars,e),_e(()=>this._precipitation,e),_e(()=>this._clouds,()=>this._updateWeather(),ii),_e(()=>this._fog,()=>this._updateFogHaze(),ii),_e(()=>this.view.state.mode,()=>{this._setNeedsRender()},Li),_e(()=>this._weatherUpdateParameters,()=>{this._updateWeather(),this._updateFogHaze()},kt)])}uninitializeRenderContext(){this._context=null,this._atmosphere=et(this._atmosphere),this._set("_stars",et(this._stars)),this._set("_precipitation",et(this._precipitation)),this._set("_clouds",et(this._clouds)),this._set("_cloudsComposition",et(this._cloudsComposition)),this._set("_fog",et(this._fog))}prepareRender(t){var e;t.bindParameters.cloudsFade.data=Ayt(this._clouds)?this._clouds:null,this.view.viewingMode!=="local"&&((e=t.bindParameters.cloudsFade.data)==null?void 0:e.cubeMap)!=null&&(this._updateWeatherFading(t.bindParameters,t.time),t.bindParameters.cloudsFade.renderingStage===gy.FINISHED&&this._clouds!=null&&this._clouds.coverage===0&&this._clouds.running===!1&&(this._clouds.destroyFrameBufferCube(),t.bindParameters.cloudsFade.data=null))}renderNode(t){var e,i,r,n,s,o,l;switch(t.bindParameters.slot){case ke.ENVIRONMENT_OPAQUE:this._stars!=null&&this._stars.render(t),this.atmosphere!=null&&(this.atmosphere.render(t,(r=(i=(e=this.view)==null?void 0:e._stage)==null?void 0:i.renderer)==null?void 0:r.fullResolutionAtmosphere),this._cloudsComposition!=null&&t.bindParameters.cloudsFade.data!=null&&(this.weatherVisible&&this._clouds!=null&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(t)),t.bindParameters.cloudsFade.isFading&&this._context!=null&&((n=t.bindParameters.cloudsFade.data)==null?void 0:n.cubeMap)!=null&&this._context.requestRender());break;case ke.ENVIRONMENT_TRANSPARENT:if(this.atmosphere!=null&&(this.atmosphere.renderHaze(t,this._weatherParameters.hazeAmount,(l=(o=(s=this.view)==null?void 0:s._stage)==null?void 0:o.renderer)==null?void 0:l.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&this._fog!=null&&this._fog.render(t,this._weatherParameters.fog),this._precipitation!=null)){const c=this.view.environment.weather;c.type!=="rainy"&&c.type!=="snowy"||this._precipitation.render(t,c.precipitation,c.type)}}}updateLightSources(t,e,i,r){if(this._context!=null){const n=this._context.renderContext;n.bindParameters.oldLighting.copyFrom(n.bindParameters.lighting),n.bindParameters.newLighting.noonFactor=e,n.bindParameters.newLighting.globalFactor=i,n.bindParameters.newLighting.set(t),r===bO.Faded||n.bindParameters.weatherFading?n.bindParameters.fadeLighting(0):n.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const t=this.weatherEnabled?this.view.environment.weather:null;return t==null?null:t.type==="rainy"||t.type==="snowy"?{type:t.type,weatherAdjustment:t.cloudCover,effect:t.precipitation}:{type:t.type,weatherAdjustment:t.type==="foggy"?t.fogStrength:t.cloudCover}}_updateWeatherFading(t,e){t.cloudsFade.updateFading(t.camera,this.view.state.mode,e,this.view.qualitySettings.fadeDuration),t.cloudsFade.updateParallax(t.camera),t.weatherFading&&(this._updateLighting(t),this._updateFogAtmoshpere(t))}_updateLighting(t){t.cloudsFade.fadeMode!==Vn.CROSS_FADE&&t.cloudsFade.fadeMode!==Vn.FADE_IN?t.fadeLighting(0):t.fadeLighting(t.cloudsFade.fadeFactor)}_updateFogAtmoshpere(t){t.cloudsFade.fadeMode!==Vn.CROSS_FADE&&t.cloudsFade.fadeMode!==Vn.FADE_IN?this._fadeWeather(0):this._fadeWeather(t.cloudsFade.fadeFactor)}_fadeWeather(t){const{_newWeatherParameters:e,_oldWeatherParameters:i}=this;t>=1?this._weatherParameters=e:(this._fadedWeatherParameters.lerp(i,e,t),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const t=this._weatherUpdateParameters;t!=null&&this._clouds!=null&&(this._clouds.applyPreset(cc[t.type],t.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){this._context!=null&&this._context.requestRender()}_updateFogHaze(){const t=this._weatherUpdateParameters;if(this._fog==null||t==null||this._context==null)return;const e=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),t.type){case"foggy":this._newWeatherParameters.fog.strength=ui(3e-5,.005,t.weatherAdjustment**3),Ne(this._newWeatherParameters.fog.color,uge),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=ui(4e-6,2e-4,(t.effect??0)**3),Ne(this._newWeatherParameters.fog.color,Uvt),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=ui(4e-6,2e-4,(t.effect??0)**3),Ne(this._newWeatherParameters.fog.color,uge),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}e.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(t){const e=this._selectAtmosphereType(t);if(e!==pc.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==e){this._atmosphere=et(this._atmosphere);const i=this._getAtmosphereClass(e);i&&(this._atmosphere=new i(this.view,this._context))}}else this._atmosphere=et(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(t){switch(t){case pc.Realistic:return Ime;case pc.Local:return mvt;case pc.Mars:return bvt;default:case pc.None:return null}}_selectAtmosphereType(t){const{enabled:e,viewingMode:i}=t;return!e||n1(this.view.spatialReference)?pc.None:i===_t.Local?pc.Local:this._context!=null&&Ime.isSupported(this._context)&&VO(this.view.spatialReference)?pc.Realistic:r1(this.view.spatialReference)?pc.Mars:pc.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:t=>{hge=aI.prototype._getAtmosphereClass,aI.prototype._getAtmosphereClass=t},restoreGetAtmosphereClass:()=>{aI.prototype._getAtmosphereClass=hge}}}};y([w({constructOnly:!0})],Fl.prototype,"view",void 0),y([w({readOnly:!0})],Fl.prototype,"atmosphere",null),y([w({readOnly:!0})],Fl.prototype,"_atmosphereType",null),y([w({type:Boolean,readOnly:!0})],Fl.prototype,"updating",null),y([w({readOnly:!0})],Fl.prototype,"weatherVisible",null),y([w()],Fl.prototype,"_context",void 0),y([w()],Fl.prototype,"_atmosphere",void 0),y([w({readOnly:!0})],Fl.prototype,"_stars",null),y([w({readOnly:!0})],Fl.prototype,"_precipitation",null),y([w({readOnly:!0})],Fl.prototype,"_clouds",null),y([w({readOnly:!0})],Fl.prototype,"_cloudsComposition",null),y([w({readOnly:!0})],Fl.prototype,"_fog",null),y([w({readOnly:!0})],Fl.prototype,"weatherEnabled",null),y([w({readOnly:!0})],Fl.prototype,"_precipitationEnabled",null),y([w({readOnly:!0})],Fl.prototype,"_weatherUpdateParameters",null),Fl=aI=y([Z("esri.views.3d.environment.EnvironmentRenderer")],Fl);let Aq=class{constructor(){this.fog=new R1t,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,Ne(this.fog.color,e.fog.color)}lerp(e,i,r){this.fog.amount=ui(e.fog.amount,i.fog.amount,r),this.hazeAmount=ui(e.hazeAmount,i.hazeAmount,r),this.fog.strength=ui(e.fog.strength,i.fog.strength,r),Qr(this.fog.color,e.fog.color,i.fog.color,r)}};const Uvt=nt(.5,.5,.5),uge=nt(1.5,1.5,1.5);let hge;var dge,pge,fge,Dte={exports:{}};Dte.exports,dge=Dte,pge=function(){var t=Math.PI,e=Math.sin,i=Math.cos,r=Math.tan,n=Math.asin,s=Math.atan2,o=Math.acos,l=t/180,c=864e5,f=2440588,_=2451545,x={dec:0,ra:0};function T(te){return te.valueOf()/c-.5+f}function A(te){return new Date((te+.5-f)*c)}function M(te){return T(te)-_}var I=23.4397*l;function L(te,le){return s(e(te)*i(I)-r(le)*e(I),i(te))}function F(te,le){return n(e(le)*i(I)+i(le)*e(I)*e(te))}function z(te,le,de){return s(e(te),i(te)*e(le)-r(de)*i(le))}function k(te,le,de){return n(e(le)*e(de)+i(le)*i(de)*i(te))}function U(te,le){return l*(280.16+360.9856235*te)-le}function j(te){return l*(357.5291+.98560028*te)}function H(te){return l*(1.9148*e(te)+.02*e(2*te)+3e-4*e(3*te))}function Y(te,le){return te+le+102.9372*l+t}function Q(te,le){var de=j(te),ve=Y(de,H(de));return le||(le={dec:0,ra:0}),le.dec=F(ve,0),le.ra=L(ve,0),le}var ne={PolarException:{NORMAL:0,MIDNIGHT_SUN:1,POLAR_NIGHT:2},getPosition:function(te,le,de,ve){var Se=l*-de,Ae=l*le,Pe=M(te),Ge=Q(Pe,x),ut=U(Pe,Se)-Ge.ra;return ve||(ve={azimuth:0,altitude:0}),ve.azimuth=z(ut,Ae,Ge.dec),ve.altitude=k(ut,Ae,Ge.dec),ve}},re=[[-.83,"sunrise","sunset"]];ne.addTime=function(te,le,de){re.push([te,le,de])};var he=9e-4;function ce(te,le){return Math.round(te-he-le/(2*t))}function be(te,le,de){return he+(te+le)/(2*t)+de}function ye(te,le,de){return _+te+.0053*e(le)-.0069*e(2*de)}function pe(te,le,de){return o((e(te)-e(le)*e(de))/(i(le)*i(de)))}function Ee(te){var le=l*(134.963+13.064993*te),de=l*(93.272+13.22935*te),ve=l*(218.316+13.176396*te)+6.289*l*e(le),Se=5.128*l*e(de),Ae=385001-20905*i(le);return{ra:L(ve,Se),dec:F(ve,Se),dist:Ae}}return ne.getTimes=function(te,le,de){var ve=l*-de,Se=l*le,Ae=ce(M(te),ve),Pe=be(0,ve,Ae),Ge=j(Pe),ut=H(Ge),Ft=Y(Ge,ut),Qt=F(Ft,0),At=ye(Pe,Ge,Ft);function ri(Tt){return ye(be(pe(Tt,Se,Qt),ve,Ae),Ge,Ft)}function Rt(Tt){var ie=(e(Tt)-e(Se)*e(Qt))/(i(Se)*i(Qt));return ie<-1?ne.PolarException.MIDNIGHT_SUN:ie>1?ne.PolarException.POLAR_NIGHT:ne.PolarException.NORMAL}var dt,pt,oi,ht,Et,Dt={solarNoon:A(At),nadir:A(At-.5),polarException:ne.PolarException.NORMAL};for(dt=0,pt=re.length;dtI)Qo(L,Pq),Ne(F,Mq),Ne(z,Oq),k="night";else if(r0&&(mge(F,U),mge(z,U));const j=FLe(i);return{direct:{intensity:L[0]*j.direct,color:F},ambient:{intensity:L[1]*j.ambient,color:z},timeOfDay:k}}const Ege=new Date(0),Cge=Qe(),Rq=W(),Iq=W(),Xvt=W(),$q=.25,Zvt=.2;let N0=class extends Dn.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandlesKey="viewHandles",this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new wU,this._ambientLight=new Mae,this._moonLight=new z$e,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePosWGS84Comparable=null,this._resetReferencePosition()}destroy(){this.disconnectView()}get _view(){var e;return(e=this._renderer)==null?void 0:e.view}get updating(){var e;return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!((e=this._renderer)!=null&&e.updating))}get weatherEnabled(){var e,i,r;return((e=this._view)==null?void 0:e.environment.atmosphereEnabled)&&!this._disableWeather&&((r=(i=this._view)==null?void 0:i.state)==null?void 0:r.viewingMode)===_t.Global&&VO(this._view.spatialReference)}get weatherVisible(){var e;return this.weatherEnabled&&((e=this._renderer)==null?void 0:e.weatherVisible)}get referencePositionWGS84Comparable(){return this._referencePosWGS84Comparable}connectView(e){if(this._renderer)return;this._renderer=new Fl({view:e});const i=()=>this._updateRenderParameters(),r=()=>this._cameraHandler();this.addHandles([_e(()=>e.environment.lighting,n=>this._updateLightingHandler(n),Li),_e(()=>e.environment.lighting.type!=="virtual"?e.environment.lighting.date:null,n=>this._lightingDateHandler(n),Li),_e(()=>e.stationary,()=>this._interactingStationaryHandler()),_e(()=>e.environment.lighting.directShadowsEnabled,i,Li),_e(()=>e.qualitySettings.ambientOcclusion,i,Li),_e(()=>e.qualitySettings.reflections,i,Li),_e(()=>e.spatialReference,()=>this._resetReferencePosition(!0),Li),_e(()=>e.environment.weather.type,()=>this._updateLighting(null,bO.Faded),Li),_e(()=>this.weatherEnabled,()=>this._updateLighting(null,bO.Faded),Li),_e(()=>e.viewingMode,()=>this._resetReferencePosition(!0),kt),_e(()=>e.environment.lighting.type!=="virtual"&&e.environment.lighting.cameraTrackingEnabled,n=>this._updateCameraTracking(n),kt),_e(()=>e.state.camera,r,kt),_e(()=>this.disableQueries,r)],this._viewHandlesKey),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition(),this._renderer=et(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking(e.type!=="virtual"&&e.cameraTrackingEnabled),this._lightingDateHandler(e.type!=="virtual"?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const i=this._view.environment.lighting;(i==null?void 0:i.type)!=="virtual"&&(i.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const i=this._view.environment.lighting;if((i==null?void 0:i.type)!=="virtual"){if(e){if(!i.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const r=this._view.spatialReference;if(!D2(r)){const n=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(n))return void this._requestReferencePositionUpdate(n)}if(this._preupdateTracking(e),this._referencePosWGS84Comparable!=null){const n=bee(this._referencePosWGS84Comparable,Age);n!=null&&(i.autoUpdate(null,n),this._trackingEnabled&&(i.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&this._view.environment.lighting.type!=="virtual"&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const i=this._view;if(!i.ready)return;const r=i.stateManager.camera;r&&(this._cameraHandlerClientSide(r,e)||this._cameraHandlerServerSide(r))}_cameraHandlerClientSide(e,i){const r=VO(this._view.spatialReference);if(r&&!D2(this._view.spatialReference))return this._view.environment.lighting.type==="virtual"&&this._updateLighting(),!1;const n=e.position;return this._referencePosWGS84Comparable==null&&(this._referencePosWGS84Comparable=W()),r?Fmt(n,this._referencePosWGS84Comparable):Ie(this._referencePosWGS84Comparable,n.longitude??0,n.latitude??0,n.z??0),this.notifyChange("referencePositionWGS84Comparable"),this._autoUpdateTimezone(this._referencePosWGS84Comparable,i)||this._updateLighting(i),!0}_cameraHandlerServerSide(e){const i=e.position;(!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(i))&&this._requestReferencePositionUpdate(i,!0),this._view.mapCoordsHelper&&this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable[2]=(i.z??0)*this._view.mapCoordsHelper.unitInMeters,this._referencePosChanged())}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e,i=bO.Immediate){const r=this._view;e=e||(r.environment.lighting.type==="virtual"?null:r.environment.lighting.date);const n=this._referencePosWGS84Comparable,s=n!=null?Jvt:Kvt,o=this.weatherVisible?r.environment.weather.type:"disabled";n!=null?Vvt(e,n,r.state.viewingMode,o,r.state.camera,s):r.environment.lighting.type==="virtual"&&LLe(r.state.camera,r.state.viewingMode,s.direct.directionToLightSource);const l=this._mainLight,c=s.direct;De(l.intensity,c.color,c.intensity*Math.PI),Ne(l.direction,c.directionToLightSource),l.specularStrength=s.specularStrength,l.environmentStrength=s.environmentStrength;const f=this._ambientLight;De(f.intensity,s.ambient.color,s.ambient.intensity);const _=this._moonLight;Qr(_.intensity,e_t,t_t,s.globalFactor);const x=(1-.5*s.globalFactor)*(1-.4*s.noonFactor*(1-s.globalFactor));De(_.intensity,_.intensity,x),Ne(_.direction,c.directionToLightSource),this._renderer.updateLightSources([l,f,_],s.noonFactor,s.globalFactor,i),this._updateRenderParameters()}_autoUpdateTimezone(e,i=null){if(this._view.environment.lighting.type==="virtual"||!this._view.environment.lighting.cameraTrackingEnabled||e==null)return!1;const r=Qvt;r.setTime((i||this._view.environment.lighting.date).getTime());const n=bee(e,Age);if(n==null)return!1;let s=this._view.environment.lighting.positionTimezoneInfo;if(s.autoUpdated){if(s.hours===n.hours&&s.minutes===n.minutes&&s.seconds===n.seconds)return!1}else s=n;const o=r.getUTCHours()-(n.hours-s.hours),l=r.getUTCMinutes()-(n.minutes-s.minutes),c=r.getUTCSeconds()-(n.seconds-s.seconds);return r.setUTCHours(o),r.setUTCMinutes(l),r.setUTCSeconds(c),!i&&this._view.environment.lighting.autoUpdate(r,n)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const i=this._referencePosWGS84Comparable==null||Bvt(this._referencePosWGS84Comparable[2],this._view.state.viewingMode);e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&i,environment:this._view.environment,weatherVisible:this._view.environmentManager.weatherVisible,qualitySettings:this._view.qualitySettings})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePosWGS84Comparable=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,i=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!i,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const r=this._referencePosUpdateQuery=T2(this._referencePointUpdateDelay).then(()=>{if(this._referencePosUpdateQuery===r){const s=()=>this._referencePosUpdateQuery!==r;return this._doReferencePositionUpdateQuery(s)}}).catch(s=>{s.name==="mapcoordshelper:missing-geometry-service"&&(this.disableQueries=!0)}).then(()=>{this._referencePosUpdateQuery===r&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))}),n=this._referencePosUpdateTimer=T2(this._referencePointUpdateInterval).then(()=>{this._referencePosUpdateTimer===n&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())});this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const i=await this._view.mapCoordsHelper.toGeographic(this._referencePosMapCoords);if(!e()&&!isNaN(i[0])&&!isNaN(i[1])){const r=(this._referencePosMapCoords.z??0)*this._view.mapCoordsHelper.unitInMeters;this._referencePosWGS84Comparable?(this._referencePosWGS84Comparable[0]=i[0],this._referencePosWGS84Comparable[1]=i[1],this._referencePosWGS84Comparable[2]=r):this._referencePosWGS84Comparable=[i[0],i[1],r],this._referencePosChanged()}}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePosWGS84Comparable)||this._updateLighting(),this.notifyChange("referencePositionWGS84Comparable")}_exceedsReferencePosDistThreshold(e){if(this._referencePosMapCoords){let i=this._referencePosMapCoords.distance(e);return this._view.mapCoordsHelper&&(i*=this._view.mapCoordsHelper.unitInMeters),i>this._referencePointUpdateDistThreshold}return!0}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){const e=this;return{get renderer(){return e._renderer},set referencePointUpdateInterval(i){e._referencePointUpdateInterval=i},set referencePointUpdateDistThreshold(i){e._referencePointUpdateDistThreshold=i},set referencePosUpdateTimer(i){e._referencePosUpdateTimer=i},set referencePointUpdateDelay(i){e._referencePointUpdateDelay=i},set disableWeather(i){e._disableWeather=i}}}};y([w({type:Boolean,readOnly:!0})],N0.prototype,"updating",null),y([w()],N0.prototype,"disableQueries",void 0),y([w()],N0.prototype,"_disableWeather",void 0),y([w()],N0.prototype,"weatherEnabled",null),y([w()],N0.prototype,"weatherVisible",null),y([w()],N0.prototype,"referencePositionWGS84Comparable",null),y([w()],N0.prototype,"_renderer",void 0),y([w()],N0.prototype,"_referencePosWGS84Comparable",void 0),N0=y([Z("esri.views.3d.environment.SceneViewEnvironmentManager")],N0);const Jvt=new NLe,Kvt=new NLe,Qvt=new Date,Age={hours:0,minutes:0,seconds:0},e_t=nt(.22,.22,.33),t_t=nt(.22,.22,.22);var Yn;(function(t){t[t.NONE=0]="NONE",t[t.TILT=1]="TILT",t[t.ALTITUDE=2]="ALTITUDE",t[t.DISTANCE=4]="DISTANCE",t[t.COLLISION=8]="COLLISION",t[t.ALL=15]="ALL",t[t.ALL_EXCEPT_COLLISION=7]="ALL_EXCEPT_COLLISION"})(Yn||(Yn={}));var Ki;(function(t){t[t.NONE=0]="NONE",t[t.ZOOM=1]="ZOOM",t[t.TUMBLE=2]="TUMBLE",t[t.LOOK_AROUND=3]="LOOK_AROUND",t[t.PAN=4]="PAN",t[t.ASCEND=5]="ASCEND"})(Ki||(Ki={}));var il;(function(t){t[t.TUMBLE=0]="TUMBLE",t[t.LOOK_AROUND=1]="LOOK_AROUND"})(il||(il={}));function RL(t,e){return(t&e)!=0}function AU(t,e,i,r,n,s){t!==0&&(i?(s.min=Math.min(s.min,e),s.max=Math.max(s.max,e)):r!=null?(s.min-=Math.max(0,(e-s.min)*(1-r)),s.max+=Math.max(0,(e-s.max)*(1-r))):n&&(s.min-=Math.max(0,e-s.min-n),s.max+=Math.max(0,e-s.max-n)))}const H2={selection:Yn.NONE,interactionType:Ki.NONE,interactionFactor:0,interactionStartCamera:null,interactionDirection:null,tiltMode:il.TUMBLE};function kLe(t,e,i,r){return e=e||t.viewForward,Ne(r,e),De(r,r,Math.sign(Ve(e,i))),r}function i_t(t,e,i,r){return a_t(t,e,i,s_t(r,e,i,!0))}function r_t(t,e,i,r){const n=Ve(i,je(t,r,e));return Be(t,e,De(t,i,n))}const n_t={dir:W(),len:0,clip:yt()};function s_t(t,e,i,r){const n=n_t;return t?(i&&r&&(n.len=Sn(e,i)),Ne(n.dir,t)):r?(n.len=Sn(e,i),je(n.dir,i,e),De(n.dir,n.dir,1/n.len)):(je(n.dir,i,e),Ye(n.dir,n.dir)),n}function o_t(t,e,i){const r=Ve(t,i.dir),n=-fn(t,e);if(n<0&&r>=0)return!1;if(r>-1e-6&&r<1e-6)return n>0;if((n<0||r<0)&&!(n<0&&r<0))return!0;const s=n/r;return r>0?si.clip[0]&&(i.clip[0]=s),i.clip[0]<=i.clip[1]}function a_t(t,e,i,r){r.clip[0]=0,r.clip[1]=i?r.len:Number.MAX_VALUE;for(let n=0;n=-1e-6?0:s}function y_t(t,e,i=H2){const r=jae(t,e,i);if(r===0)return!1;const n=t.pointsOfInterest.surfaceOrigin;if(!n.renderLocation)return!1;const s=Gae(t,e)+r,o=Ne(b_t,e.eye),l=kLe(e,i.interactionDirection,__t(e,n.renderLocation,S_t),x_t);if(!lx(Noe(n.renderLocation,s),Sp(e.eye,l),tN))return!1;e.eye=tN;const c=je(w_t,e.eye,o);e.center=Be(tN,e.center,c);const f=t.renderCoordsHelper.getAltitude(e.center),_=t.renderCoordsHelper.intersectInfiniteManifold(e.ray,f,tN);return _!=null&&(e.center=_),!0}function v_t(t,e,i){const r=e.interactionType;if(r===Ki.NONE)return;const{min:n,max:s}=i,{interactionStartCamera:o,interactionFactor:l}=e;if(!o)return;const c=r===Ki.ZOOM||r===Ki.PAN,f=jae(t,o),_=f===0?0:Gae(t,o);i.min=n,i.max=s,AU(f,_,c,l,.05*_,i)}function Gae(t,e){const i=t.pointsOfInterest.surfaceOrigin;return i.renderLocation?Sn(e.eye,i.renderLocation):0}function __t(t,e,i){return R_(i,t.eye,e)}const eN={min:0,max:0},b_t=W(),w_t=W(),x_t=W(),S_t=W(),tN=W();function xP(t,e,i=Cf.EYE){const r=t.state.constraints;if(!r.collision.enabled)return!1;const n=wj(t,e.eye),s=t.renderCoordsHelper.getAltitude(e.eye),o=n+r.collision.elevationMargin;if(s>=o)return!1;const l=rt(e.eye);if(je(iN,e.center,e.eye),e.eye=t.renderCoordsHelper.setAltitude(T_t,o,e.eye),i===Cf.EYE_AND_CENTER)e.center=Be(iN,e.eye,iN);else if(i===Cf.EYE_AND_CENTER_SCALE){const c=(l-s+o)/l;e.center=De(iN,e.center,c)}return!0}var Cf;(function(t){t[t.EYE=0]="EYE",t[t.EYE_AND_CENTER=1]="EYE_AND_CENTER",t[t.EYE_AND_CENTER_SCALE=2]="EYE_AND_CENTER_SCALE"})(Cf||(Cf={}));const iN=W(),T_t=W();function q2(t,e,i){t.worldUpAtPosition(e,Mge),je(Dq,i,e);const r=rt(Dq);return r===0?0:Ca(Ve(Dq,Mge)/r)}const Mge=W(),Dq=W();function zLe(t,e,i=H2,r=!0){aR.eyeCenterDistance=0,aR.requiresTwoSteps=!1;const n=Hae(t,e,i,void 0,aR);if(n===0)return!1;switch(xp(rN,-n,e.viewRight),i.tiltMode){case il.LOOK_AROUND:bt(fb,e.viewForward,rN),De(fb,fb,aR.eyeCenterDistance),e.center=Be(Hw,e.eye,fb);break;case il.TUMBLE:je(fb,e.center,e.eye),bt(fb,fb,rN),e.eye=je(Hw,e.center,fb);break;default:i.tiltMode}return e.up=bt(Hw,e.up,rN),!aR.requiresTwoSteps||!r||zLe(t,e,i,!1)}function Hae(t,e,i=H2,r=H2,n){if(!t.state.constraints.tilt)return 0;const s=e.distance,o=t.state.constraints.tilt(s,L_t);return $_t(t,i,o),r.interactionType===Ki.TUMBLE&&RL(r.selection,Yn.ALTITUDE)&&ULe(t,r.interactionStartCamera,o),i.tiltMode===il.LOOK_AROUND||r.tiltMode===il.LOOK_AROUND?C_t(t,e,o,n):E_t(t,e,o)}function E_t(t,e,i){const r=q2(t.renderCoordsHelper,e.center,e.eye),n=r-Je(r,i.min,i.max);return IL(n)?n:0}function C_t(t,e,i,r){switch(r&&(r.requiresTwoSteps=!1),t.viewingMode){case"global":return M_t(t,e,i,r);case"local":return A_t(t,e,i,r)}}function A_t(t,e,i,r){const n=q2(t.renderCoordsHelper,e.center,e.eye),s=Je(n,i.min,i.max),o=n-s;if(!IL(o))return 0;if(r){const l=t.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,c=t.renderCoordsHelper.getAltitude(e.eye)-l,f=Math.cos(s);Math.abs(f)>1e-4?r.eyeCenterDistance=c/f:r.eyeCenterDistance=e.distance}return o}function M_t(t,e,i,r){const n=O_t(t,e,D_t),s=Je(n.tiltAtCenter,i.min,i.max);if(!IL(n.tiltAtCenter-s))return 0;let o,l;return n.centerIsOnSurface?(o=P_t(n),l=R_t(n,o)):(o=n.constraints.clampTilt(n.eyeCenterDistance,n.tiltAtCenter),r&&o1e-9}function P_t(t){const{constraints:e,eyeCenterDistance:i,tiltAtCenter:r}=t;let n=r,s=e.clampTilt(i,r);const o=Bte(t,s);if(e.clampTilt(o,r)===s)return s;let l=0;for(;l<10&&IL(s-n);){const c=(n+s)/2,f=Bte(t,c);IL(e.clampTilt(f,c)-c)?n=c:s=c,l++}return s}function Bte(t,e){if(!t.centerIsOnSurface)return t.eyeCenterDistance;const i=Math.PI-Je(e,0,Math.PI),r=Gf(t.radius/t.eyeRadius*Math.sin(i)),n=Math.PI-i-r,s=Math.sin(n)/Math.sin(i);if(t.eyeRadius1){const o=Math.PI-r,l=Math.PI-i-o;return Math.sin(l)/Math.sin(i)*t.eyeRadius}return s*t.eyeRadius}function R_t(t,e){const i=Gf(t.radius/t.eyeRadius*Math.sin(t.tiltAtCenter)),r=Gf(t.radius/t.eyeRadius*Math.sin(e));return t.eyeRadius>t.radius?i-r:r-i}function I_t(t,e){return t.tiltAtCenter-Math.PI/2-(e-Math.PI/2)}function $_t(t,e,i){if(e.interactionType===Ki.NONE)return;const{interactionStartCamera:r,interactionFactor:n}=e;if(!r)return;const{min:s,max:o}=i,l=Hae(t,r,H2,e),c=l===0?0:q2(t.renderCoordsHelper,r.center,r.eye);i.min=s,i.max=o,e.interactionType===Ki.TUMBLE?(RL(e.selection,Yn.ALTITUDE)&&ULe(t,r,i),AU(l,c,!0,n,Oge,i)):AU(l,c,!1,n,Oge,i)}function ULe(t,e,i){const r=t.state.constraints;if(t.state.isLocal||!r.altitude||!e)return;const n=El(e.center),s=Math.sqrt(n),o=e.distance,l=Sr(t.spatialReference).radius,c=r.altitude.min+l,f=r.altitude.max+l,_=(c*c-o*o-n)/(-2*s*o),x=(f*f-o*o-n)/(-2*s*o);i.min=Math.max(i.min,Math.min(Math.PI-Ca(x),i.max)),i.max=Math.min(i.max,Math.PI-Ca(_))}const fb=W(),rN=Qe(),Hw=W(),Oge=Ei(5),L_t={min:0,max:0},D_t={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,eyeCenterDistance:0,tiltAtCenter:0},aR={eyeCenterDistance:0,requiresTwoSteps:!1},N_t=t=>t,jj=t=>t*t,qae=t=>1-jj(1-t),F_t=t=>t<.5?jj(2*t)/2:(qae(2*(t-.5))+1)/2,Wae=t=>t*t*t,VLe=t=>1-Wae(1-t),BLe=t=>t<.5?Wae(2*t)/2:(VLe(2*(t-.5))+1)/2,Yae=t=>t*t*t*t,jLe=t=>1-Yae(1-t),k_t=t=>t<.5?Yae(2*t)/2:(jLe(2*(t-.5))+1)/2,Xae=t=>t*t*t*t*t,GLe=t=>1-Xae(1-t),z_t=t=>t<.5?Xae(2*t)/2:(GLe(2*(t-.5))+1)/2,Zae=t=>1-Math.cos(t*Math.PI/2),HLe=t=>1-Zae(1-t),U_t=t=>t<.5?Zae(2*t)/2:(HLe(2*(t-.5))+1)/2,Jae=t=>2**(10*(t-1)),J9=t=>1-Jae(1-t),V_t=t=>t<.5?Jae(2*t)/2:(J9(2*(t-.5))+1)/2,Kae=t=>-(Math.sqrt(1-t*t)-1),qLe=t=>1-Kae(1-t),B_t=t=>t<.5?Kae(2*t)/2:(qLe(2*(t-.5))+1)/2;function a0(t){const e=2*(t-Math.sqrt((t-1)*t)),i=e/2/t;return r=>ri=Math.PI&&(r=2*Math.PI-r);const n=Math.abs(e.pitch-this.pitch);return i.rotate=Math.max(r,n),i.sourceZoom=this.distance,i.targetZoom=e.distance,i}interpolate(e,i,r){this.viewingMode===_t.Global?Out(e.center,i.center,r.pan,this.center):Qr(this.center,e.center,i.center,r.pan),this.distance=isFinite(i.distance)?ui(e.distance,i.distance,r.zoom):e.distance,this.pitch=ui(e.pitch,i.pitch,r.rotate);let n=e.yaw;const s=i.yaw;Math.abs(s-n)>=Math.PI&&(n+=2*(n0&&De(r,r,-1)):Ne(r,e),Wt(oh,r,bd.upward),Ye(oh,oh),uF(bd.sideway,oh,bd.upward)}};const MU={desiredScreenFlow:2,minDuration:500,maxDuration:8e3};let abt=class YLe{constructor(e){this._createCamera=e,this.compared={sourceZoom:0,targetZoom:0,pan:0,rotate:0},this.settings={desiredScreenFlow:MU.desiredScreenFlow},this.source=e(),this.target=e()}clone(){const e=new YLe(this._createCamera);return e.copyFrom(this),e}copyFrom(e){this.update(e.source,e.target,e.settings)}update(e,i,r){this.source!==e&&this.source.copyFrom(e),this.target!==i&&this.target.copyFrom(i),this.compared=this.source.compareTo(this.target,this.compared),this.settings.desiredScreenFlow=r.desiredScreenFlow!=null?r.desiredScreenFlow:MU.desiredScreenFlow,this.desiredPixelFlow=this.settings.desiredScreenFlow*this.target.size,this.halfWindowSize=this.target.size/2}halfWindowPanAtZoom(e){const i=this.target.pixelsPerPanAtZoom(e);return this.halfWindowSize/i}get hasZoom(){return Math.abs(this.compared.sourceZoom-this.compared.targetZoom)>1e-5}get hasPan(){return this.compared.pan>1e-9}get hasRotate(){return this.compared.rotate>1e-9}},lbt=class{constructor(){this.segments=[]}get time(){return this.segments.reduce((e,i)=>e+i.time,0)}interpolateComponentsAt(e,i){e=Math.min(Math.max(e,0),1),e*=this.time;let r=0,n=0;const s=this.definition;for(let o=0;on?1:-1,this._panPixelsAtSource=i.pan*e.source.pixelsPerPanAtZoom(r);const s=(e.source.pixelsPerRotateAtZoom(r)+e.target.pixelsPerRotateAtZoom(n))/2;this._rotatePixels=i.rotate*s}_updatePixelFlow(){const e=this.definition.compared.sourceZoom,i=this.definition.compared.targetZoom,{hasZoom:r,hasPan:n,hasRotate:s}=this.definition;let o=0,l=0;r&&(n&&(o=(i/e-1)/(-1/(this._zoomSign*this.definition.halfWindowSize)*Math.LN2*this._panPixelsAtSource)),s&&(l=this._zoomSign*(Math.log(e/i)/Math.LN2)*this.definition.halfWindowSize/this._rotatePixels)),this._zoomPixelFlow=0,this._panPixelFlow=0,this._rotatePixelFlow=0;const c=this.definition.desiredPixelFlow;if(r&&n&&s){const f=o+l+o*l;this._zoomPixelFlow=o*l/f*c,this._panPixelFlow=l/f*c,this._rotatePixelFlow=o/f*c}else if(r&&n){const f=1+o;this._zoomPixelFlow=o/f*c,this._panPixelFlow=1/f*c}else if(r&&s){const f=1+l;this._zoomPixelFlow=l/f*c,this._rotatePixelFlow=1/f*c}else if(n&&s){const f=this._panPixelsAtSource/this._rotatePixels,_=1+f;this._panPixelFlow=f/_*c,this._rotatePixelFlow=1/_*c}else n?this._panPixelFlow=c:r?this._zoomPixelFlow=c:s&&(this._rotatePixelFlow=c);this._time=s?this.rotateTime:r?this.zoomTime:n?this.panTime:0}get rotateTime(){return this.definition.hasRotate?this._rotatePixels/this._rotatePixelFlow:0}get zoomTime(){return this.definition.hasZoom?this._zoomSign*(Math.log(this.definition.compared.sourceZoom/this.definition.compared.targetZoom)/Math.LN2)*this.definition.halfWindowSize/this._zoomPixelFlow:0}get panTime(){if(this.definition.hasPan){if(this.definition.hasZoom){const e=-1/(this._zoomSign*this.definition.halfWindowSize)*Math.LN2,i=e*this._panPixelsAtSource;return Math.log(i*(this._zoomPixelFlow/this._panPixelFlow)+1)/(e*this._zoomPixelFlow)}return this._panPixelsAtSource/this._panPixelFlow}return 0}_interpolateComponentsZoom(e){if(e===0||e===1)return e;if(this.definition.hasZoom){const i=this.definition.compared.sourceZoom,r=this.definition.compared.targetZoom;return(i*(i/r)**-e-i)/(r-i)}return e}_interpolateComponentsPan(e){if(e===0||e===1)return e;if(this.definition.hasPan&&this.definition.hasZoom){const i=-1/(this._zoomSign*this.definition.halfWindowSize)*this._zoomPixelFlow;return 1/this._panPixelsAtSource*(this._panPixelFlow*(2**(i*e*this._time)-1))/(i*Math.LN2)}return e}_interpolateComponentsRotate(e){return e}interpolateComponentsAt(e,i){e=Math.min(Math.max(e,0),1);const r=this._interpolateComponentsZoom(e),n=this._interpolateComponentsPan(e),s=this._interpolateComponentsRotate(e);return i?(i.zoom=r,i.pan=n,i.rotate=s):i={zoom:r,pan:n,rotate:s},i}};function cbt(t,e,i){const r=e-t.compared.sourceZoom,n=t.halfWindowPanAtZoom(r);return-t.halfWindowSize*(i.ascensionFactor*Math.LN2*t.compared.pan+n)*Math.log(t.compared.sourceZoom/e)/(t.desiredPixelFlow*Math.LN2*n)}function ubt(t,e,i){const r=1/e,n=Math.log(t.compared.sourceZoom*r),s=1/t.desiredPixelFlow,o=1/Math.LN2,l=e-t.compared.sourceZoom,c=1/l,f=(i.ascensionFactor*Math.LN2*t.compared.pan+t.halfWindowPanAtZoom(l))/t.halfWindowPanAtZoom(1);return t.halfWindowSize*r*s*o*c*f-t.halfWindowSize*n*s*o*c+t.halfWindowSize*n*s*o*f/(l*l)}function hbt(t,e,i){const r=e-t.compared.sourceZoom,n=1/r,s=1/e,o=Math.log(t.compared.sourceZoom*s),l=(i.ascensionFactor*Math.LN2*t.compared.pan+t.halfWindowPanAtZoom(r))/t.halfWindowPanAtZoom(1);return t.halfWindowSize*n*(-2*n*s*l+2*n*o+2*s-2*o*l/(r*r)-l/(e*e))/(t.desiredPixelFlow*Math.LN2)}function dbt(t,e){return-t.halfWindowSize*Math.log(t.compared.sourceZoom/e)/(t.desiredPixelFlow*Math.LN2)}function pbt(t,e){return t.halfWindowSize/(e*t.desiredPixelFlow*Math.LN2)}function fbt(t,e){return-t.halfWindowSize/(e*e*t.desiredPixelFlow*Math.LN2)}function mbt(t,e,i){return-t.compared.pan*t.halfWindowSize*(i.ascensionFactor+i.descensionFactor-1)/(t.desiredPixelFlow*t.halfWindowPanAtZoom(e))}function gbt(t,e,i){return t.compared.pan*t.halfWindowSize*(i.ascensionFactor+i.descensionFactor-1)/(t.desiredPixelFlow*t.halfWindowPanAtZoom(e*e))}function ybt(t,e,i){return-2*t.compared.pan*t.halfWindowSize*(i.ascensionFactor+i.descensionFactor-1)/(t.desiredPixelFlow*t.halfWindowPanAtZoom(e*e*e))}function vbt(t,e,i){return t.halfWindowSize*(-t.halfWindowPanAtZoom(e)-i.descensionFactor*Math.LN2*t.compared.pan+t.halfWindowPanAtZoom(t.compared.targetZoom))*Math.log(e/t.compared.targetZoom)/(t.desiredPixelFlow*Math.LN2*t.halfWindowPanAtZoom(-e+t.compared.targetZoom))}function _bt(t,e,i){const r=Math.log(e/t.compared.targetZoom),n=1/t.desiredPixelFlow,s=1/Math.LN2,o=-e+t.compared.targetZoom,l=1/o,c=(-t.halfWindowPanAtZoom(e)-i.descensionFactor*Math.LN2*t.compared.pan+t.halfWindowPanAtZoom(t.compared.targetZoom))/t.halfWindowPanAtZoom(1);return-t.halfWindowSize*r*n*s*l+t.halfWindowSize*r*n*s*c/(o*o)+t.halfWindowSize*n*s*l*c/e}function bbt(t,e,i){const r=e-t.compared.targetZoom,n=1/r,s=1/e,o=Math.log(e/t.compared.targetZoom),l=(t.halfWindowPanAtZoom(e)+i.descensionFactor*Math.LN2*t.compared.pan-t.halfWindowPanAtZoom(t.compared.targetZoom))/t.halfWindowPanAtZoom(1);return t.halfWindowSize*n*(-2*n*s*l-2*n*o+2*s+2*o*l/(r*r)-l/(e*e))/(t.desiredPixelFlow*Math.LN2)}function wbt(t,e){return t.halfWindowSize*Math.log(e/t.compared.targetZoom)/(t.desiredPixelFlow*Math.LN2)}function xbt(t,e){return t.halfWindowSize/(e*t.desiredPixelFlow*Math.LN2)}function Sbt(t,e){return-t.halfWindowSize/(e*e*t.desiredPixelFlow*Math.LN2)}function Tbt(t){const e=Math.LN2*t.compared.pan,i=t.compared.sourceZoom-t.compared.targetZoom,r=t.halfWindowPanAtZoom(i),n=t.halfWindowSize*Math.log(t.compared.sourceZoom/t.compared.targetZoom)/(t.desiredPixelFlow*Math.LN2*r);return t.compared.sourceZoom<=t.compared.targetZoom?n*(e-r):n*(e+r)}function Ebt(t,e){let i=Cbt(t,e);const r={ascensionFactor:e.ascensionFactor!=null?e.ascensionFactor:.5,descensionFactor:e.descensionFactor!=null?e.descensionFactor:.5},n=r.ascensionFactor===0,s=r.descensionFactor===0,o=n?dbt:cbt,l=n?pbt:ubt,c=n?fbt:hbt,f=s?wbt:vbt,_=s?xbt:_bt,x=s?Sbt:bbt,T=U=>o(t,U,r)+mbt(t,U,r)+f(t,U,r),A=U=>l(t,U,r)+gbt(t,U,r)+_(t,U,r),M=U=>c(t,U,r)+ybt(t,U,r)+x(t,U,r);let I=T(i);const L=Tbt(t);let F;const z=e.maximumIterations||20,k=e.maximumDistance!=null?e.maximumDistance:1/0;for(F=0;F=k&&j<0){if(!isFinite(k))return null;i=k,I=T(i);break}if(i-=j,iL*(1-.3)||i0&&(n.definition?n.definition.copyFrom(this.definition):n.definition=this.definition.clone(),n.definition.copyFrom(this.definition),n.definition.compared.sourceZoom=e,n.definition.compared.targetZoom=e,n.definition.compared.pan=this.definition.compared.pan*c,n.definition.compared.rotate=this.definition.compared.rotate*c,n.update(),this.segments.push(n)),s.definition?s.definition.copyFrom(this.definition):s.definition=this.definition.clone(),s.definition.compared.sourceZoom=e,s.definition.compared.pan=this.definition.compared.pan*l,s.definition.compared.rotate=this.definition.compared.rotate*l,s.update(),this._descensionSegment=s,this.segments.push(s)}_updateWithoutApex(){const[e]=this._preallocSegments;e.update(this.definition),this.segments.push(e)}};const Mbt={zoom:0,pan:0,rotate:0};let Obt=class{get time(){return this._time}constructor(e){this._createCamera=e,this._time=0,this.definition=new abt(e),this.path=new Abt}update(e,i,r){this.definition.update(e,i,r),this.path.update(this.definition,r),this._time=this._applyTimeSettings(fSe(isFinite(this.path.time)?this.path.time:0),r),this._easing=r.easing??(this._time>=1e3?WLe:J9)}cameraAt(e,i){i=i||this._createCamera(),e=Math.min(Math.max(0,e),1),e=this._normalizedEasing(e);const r=this.path.interpolateComponentsAt(e,Mbt);return i.interpolate(this.definition.source,this.definition.target,r),i}_normalizedEasing(e){const i=this._easing(0,this._time),r=this._easing(1,this._time);return(this._easing(e,this._time)-i)/(r-i)}_applyTimeSettings(e,i){const r=i.speedFactor!=null?i.speedFactor:1;i.duration!=null?e=i.duration:i.speedFactor!=null&&(e=e/r);const n=i.minDuration!=null?i.minDuration:MU.minDuration/r,s=i.maxDuration!=null?i.maxDuration:MU.maxDuration/r;return Math.min(Math.max(n,e),s)}};const Pbt=W();let Rbt=class{get finished(){return this.currentTime>=this._animation.time}get time(){return this._animation.time}constructor(e){this.currentTime=0,this._animation=new Obt(()=>new Rge(e)),this._current=new Rge(e)}update(e,i,r){const n=this._animation.definition.source,s=this._animation.definition.target,o=je(Pbt,i.center,e.center),l=rt(o);l>=1e-5?(o[0]/=l,o[1]/=l,o[2]/=l):(o[0]=0,o[1]=1,o[0]=0),Ne(n.lookAtDirection,o),Ne(s.lookAtDirection,o),n.copyFromRenderCamera(e),s.copyFromRenderCamera(i),this._current.copyFrom(n),this._animation.update(n,s,r),this.currentTime=0,e.almostEquals(i)&&(this.currentTime=this._animation.time)}cameraAt(e,i){return this._animation.cameraAt(e,this._current),i=i||new ai,this._current.copyToRenderCamera(i),i}step(e,i){return this.finished||(this.currentTime=this.currentTime+fSe(e),this.currentTime>=this.time&&(this.currentTime=this.time)),this.cameraAt(this.currentTime/this.time,i)}};var Cs;(function(t){t.Ready="ready",t.Rejected="rejected",t.Running="running",t.Stopped="stopped",t.Finished="finished"})(Cs||(Cs={}));let Iv=class extends ze{constructor(e){super(e),this.state=Cs.Ready}get active(){return this.state===Cs.Running}get isInteractive(){return!1}get canStop(){return!1}stopController(){return!!this.canStop&&(this.state=Cs.Stopped,!0)}finishController(){this.state=Cs.Finished}get steppingFinished(){return!1}};y([w({constructOnly:!0})],Iv.prototype,"view",void 0),y([w({readOnly:!0})],Iv.prototype,"active",null),y([w()],Iv.prototype,"state",void 0),y([w({readOnly:!0})],Iv.prototype,"isInteractive",null),Iv=y([Z("esri.views.3d.state.controllers.CameraController")],Iv);let $L=class extends Iv{constructor(){super(...arguments),this._asyncResult=null}get canStop(){return!0}set asyncResult(e){this._asyncResult&&(this._asyncResult.reject(ur()),this._asyncResult=null),this.state===Cs.Finished||this.state===Cs.Stopped?(ky(e),this.state===Cs.Finished?e.resolve():e.reject(ur())):this._asyncResult=e}get asyncResult(){return this._asyncResult}onControllerStart(){this.state=Cs.Running,this.viewAnimation!=null&&this.viewAnimation.when(()=>this.updateStateFromViewAnimation(),()=>this.updateStateFromViewAnimation())}updateStateFromViewAnimation(){this.viewAnimation==null||this.state!==Cs.Ready&&this.state!==Cs.Running||(this.viewAnimation.state===b5.State.FINISHED?this.finish():this.viewAnimation.state===b5.State.STOPPED&&(this.state=Cs.Stopped))}onControllerEnd(){this.viewAnimation==null||this.viewAnimation.done||(this.state===Cs.Finished?this.viewAnimation.finish():this.state===Cs.Stopped&&this.viewAnimation.stop()),this._asyncResult&&(this.state===Cs.Finished?this._asyncResult.resolve():this._asyncResult.reject(ur()))}finish(){this.finishController()}};$L=y([Z("esri.views.3d.state.controllers.AnimationController")],$L);let Hv=class extends $L{get intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(e){super(e),this.mode="interaction",this._hasTarget=!1}initialize(){this.animation=new Rbt(this.view.state.viewingMode),this.viewAnimation=this.mode==="interaction"?null:new b5}get isInteractive(){return this.mode==="interaction"}begin(e,i){this._hasTarget=!0;const r=this.animationSettings(i);nN.copyFrom(this.view.state.camera);const n=Tp(this.view.state.viewingMode);this.intersectionHelper.intersectRay(nN.ray,n,Ige)&&(nN.center=Ige),this.animation.update(nN,e,r),this.animation.finished&&this.finish()}finish(){this.animation.currentTime=this.animation.time,super.finish()}get steppingFinished(){return this._hasTarget&&this.animation.finished}stepController(e,i){this._hasTarget&&this.animation.step(e,i)}onControllerEnd(e){this._hasTarget&&(this.animation.cameraAt(this.animation.currentTime/this.animation.time,e),this.animation.currentTime=this.animation.time),super.onControllerEnd(e)}animationSettings(e={}){return{apex:{maximumDistance:this.view.state.constraints.clampAltitude(1/0)/6,ascensionFactor:void 0,descensionFactor:void 0},...e,easing:typeof e.easing=="string"?ebt[e.easing]:e.easing}}};y([w({constructOnly:!0})],Hv.prototype,"mode",void 0),y([w({readOnly:!0})],Hv.prototype,"isInteractive",null),Hv=y([Z("esri.views.3d.state.controllers.PointToPointAnimationController")],Hv);const nN=new ai,Ige=W();function Gj(t=$bt){return[t[0],t[1],t[2],t[3]]}function LL(t,e){return Ibt(t[0],t[1],t[2],e,$oe.get())}function Ibt(t,e,i,r,n=Gj()){return n[0]=t,n[1]=e,n[2]=i,n[3]=r,n}function Qae(t,e,i){return Wt(i,t,e),Ye(i,i),i[3]=oj(t,e),i}const $bt=[0,0,1,0];function uni(t,e,i=Ko()){return ele(t,dm(e),i),Ye(i.direction,i.direction),i}function ele(t,e,i){return Lbt(t,t.screenToRender(e,xt.get()),i)}function Lbt(t,e,i){const r=Qo(xt.get(),e);if(r[2]=0,!t.unprojectFromRenderScreen(r,i.origin))return null;const n=Qo(xt.get(),e);n[2]=1;const s=t.unprojectFromRenderScreen(n,xt.get());return s==null?null:(je(i.direction,s,i.origin),i)}function SP(t,e,i){return tle(t,t.screenToRender(e,xt.get()),i)}function tle(t,e,i){Ne(i.origin,t.eye);const r=Ie(xt.get(),e[0],e[1],1),n=t.unprojectFromRenderScreen(r,xt.get());return n==null?null:(je(i.direction,n,i.origin),i)}function ile(t,e,i,r){const n=SP(e,i,Dbt);return lx(t,n,r)}const Dbt=Ko();var E5;(function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"})(E5||(E5={}));const XLe=30,OU=[1,3e8],Hj=80,ZLe=8,JLe=200,KLe=1508e5,QLe=5,e9e=50,Nbt=5,Fbt=10,Fq=90,AE={exclude:new Set([Gw])};function vT(t,e,i){return i[0]=e[0]/(t.fullWidth/t.pixelRatio),i[1]=e[1]/(t.fullHeight/t.pixelRatio),i}function jte(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function W2(t,e,i){const r=xp(Loe.get(),i[3],i);r==null||yse(r,gs)||(je(dn,t.eye,e),bt(dn,dn,r),t.eye=Be(dn,dn,e),je(dn,t.center,e),bt(dn,dn,r),t.center=Be(dn,dn,e),t.up=bt(dn,t.up,r))}function kbt(t,e,i,r){return bE(t,ele(e,i,sle),r)}function Gte(t,e,i,r){return bE(t,SP(e,i,sle),r)}function rle(t,e,i,r){const n=xt.get();let s=1-i;je(n,e,t.eye);const o=rt(n);let l=o*(1-s);s>=0&&lDge.Elevation?Xa.Horizontal:(SP(t,e,jge),-Math.sign(t.relativeElevation)*(.5*Math.PI+oj(t.eye,jge.direction))i?-(e-i)/(o*i):e<-i?Math.PI-(e+i)/(o*i):Ca(e/i),s=t>i?-(t-i)/(o*i):t<-i?Math.PI-(t+i)/(o*i):Ca(t/i),(s-n)*i}function zbt(t,e,i,r,n,s,o,l,c,f){const _=kge(t[2],e[2],s[3],l),x=c?kge(t[0],e[0],s[3],180):e[0]-t[0],T=Math.sin(o)*x-Math.cos(o)*_,A=Math.cos(o)*x+Math.sin(o)*_;Ye(dn,n);const M=c?T/Math.sqrt(Math.abs(s[3]**2-Ve(i,dn)**2)):T/s[3],I=A/Math.sqrt(Math.abs(s[3]**2-Ve(i,r)**2));or(f,M,I)}function o9e(t,e,i,r,n,s,o,l,c,f){Wt(IU,t,e),gee(s.up,s.eye,aN,lN,cN),gee([0,0,1],s.eye,Qv,_2,u9e),Ne(i,_2),Ne(r,Qv),Ye(i,i),De(i,i,rt(IU)),F0e(t,Ye(lN,lN),Ye(cN,cN),Ye(aN,aN),zge),F0e(e,lN,cN,aN,Uge),zbt(zge,Uge,t,Qv,_2,o,l,c,f,n)}function Ubt(t,e,i,r,n,s,o){xp(PU,n,r),xp(RU,o,s),nn(DM,PU,RU),je(e,t,i),bt(e,e,DM),Be(e,e,i)}function a9e(t,e,i,r,n,s){xp(PU,r,i),xp(RU,s,n),nn(DM,PU,RU),je(dn,t.eye,e),bt(dn,dn,DM),t.eye=Be(dn,dn,e),je(dn,t.center,e),bt(dn,dn,DM),t.center=Be(dn,dn,e),je(dn,t.up,e),bt(dn,dn,DM),t.up=Be(dn,dn,e)}function nle(t,e,i,r,n,s){return(Math.abs(r)>Math.PI-sN.Angle||Math.abs(r)i)&&s.aboveGround&&nc&&(f=Co(i,Ax),o9e(i,Ax,_2,Qv,lR,hN,t,n,s,o),a9e(hN,t,Qv,lR[1],_2,lR[0]),Ubt(Ax,Ax,t,Qv,lR[1],_2,lR[0]),_=Co(i,Ax),_0,o=!0),this._tmpCamera.copyFrom(r.camera),s?this.intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter):this.intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:Ne(this._zoomLocation,this._tmpCamera.center),this._updateCamera(this._tmpCamera,e,this._zoomLocation,i,o),this.begin(this._tmpCamera)}animationSettings(){return{duration:600,easing:J9}}_updateCamera(e,i,r,n,s){const o=Sr(this.view.spatialReference),l=qj(e,n,o),c=Math.abs(this.view.camera.position.z);Ye(pN,e.eye),De(pN,pN,-1),SP(e,n,this._tmpRayDir),Ye(this._tmpRayDir.direction,this._tmpRayDir.direction);const f=Je(Math.min(ZLe,1/Math.abs(Ve(pN,this._tmpRayDir.direction)))*c,JLe,KLe);if(l===Xa.Horizontal){let _=Gge**i;this._sphere[3]=rt(r),je(this._tmpViewDir,e.center,e.eye);const x=Math.min(rt(this._tmpViewDir),f);let T=x*_;if(_<=1&&T1e-12&&ile(this._sphere,e,n,this._targetOnSphere)&&Vbt(this._sphere,e,r,this._targetOnSphere,this.view.camera.heading,this.view.camera.tilt,!0)}else{let _=Gge**Math.abs(i);const x=i>0?1:-1;je(this._tmpViewDir,r,e.eye);const T=rt(this._tmpViewDir),A=this.view._stage.renderView.getMinimalDepthForArea(null,n[0],n[1],this.view.state.camera,Hbt);let M=A??f;M=s&&i>0?Math.min(M,T):M,De(this._tmpRayDir.direction,this._tmpRayDir.direction,M),Be(r,this._tmpRayDir.origin,this._tmpRayDir.direction);let I=M*_;const L=Math.max(Uq,1.01*e.nearFar[0]);if(i>0&&Iimport("./VoxelWasmPerSceneView-YeZpknKe.js"),__vite__mapDeps([]))),ZF=await XF);const e=t.view;let i=wO.get(e);return i||(i=new ZF.default({view:e}),wO.set(e,i)),i.addVoxelLayer(t)}function NL(t){return wO.get(t)}function pni(t){const e=t.view,i=wO.get(e);i&&i.removeVoxelLayer(t)<1&&(wO.delete(e),wO.size===0&&(XF=null,ZF=null))}const qbt=.6,Wbt=4,Ybt=60;let LU=class extends Hv{constructor(){super(...arguments),this._zoomLocation=W(),this._tmpCamera=new ai,this._tmpRayDir=W(),this._tmpCenter=W(),this._constraintOptions={selection:Yn.ALL,interactionType:Ki.ZOOM,interactionFactor:null,interactionStartCamera:new ai,interactionDirection:null,tiltMode:il.TUMBLE}}zoomStep(e,i){if(!this.active)return;const r=this.view.state,{interactionStartCamera:n}=this._constraintOptions;n&&(this.animation.finished?n.copyFrom(r.camera):this.animation.cameraAt(1,n)),this._tmpCamera.copyFrom(r.camera);const s=Tp(this.view.state.viewingMode);let o=!1;e>0?(o=this.intersectionHelper.intersectScreenFreePointFallback(i,this._zoomLocation,this.view.map.ground.opacity===0?AE:{}),this.intersectionHelper.intersectRay(this._tmpCamera.ray,s,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter)):this.intersectionHelper.intersectRay(this._tmpCamera.ray,s,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:Ne(this._zoomLocation,this._tmpCamera.center);const l=qbt**e;let c=this.view._stage.renderView.getMinimalDepthForArea(NL(this.view),i[0],i[1],this.view.state.camera,Ybt);je(fN,this._tmpCamera.eye,this._zoomLocation),Ye(fN,fN);const f=Je(Math.min(ZLe,1/Math.abs(Ve(Xbt,fN)))*Math.abs(this.view.camera.position.z),JLe,KLe);if(c=c??f,c){const _=W();je(_,this._zoomLocation,this._tmpCamera.eye),(cthis._handleDoubleClick(r))}_handleDoubleClick(e){const i=e.data;if(Zbt(i,"primary")){const r=this._view.state.isGlobal?new $U({view:this._view,mode:"animation"}):new LU({view:this._view,mode:"animation"});this._view.state.switchCameraController(r),r.zoomStep(Math.log(.5)/Math.log(.6),ss(i.x,i.y)),e.stopPropagation()}}};function Kbt(t,e,i){return t===_t.Global?new ewt(i):new Qbt(e,i)}let Qbt=class{constructor(e,i){this._elevationProvider=e,this._referenceEllipsoid=Sr(i),this._unitInMeters=ws(i,this._referenceEllipsoid.metersPerDegree)}compute(e,i,r,n,s){var k;s||(s={near:0,far:0});let o=e[2]*this._unitInMeters;const l=o,c=o-n,f=(k=this._elevationProvider)==null?void 0:k.visibleElevationBounds;f&&(o=c>=0?l-this._unitInMeters*f.min:this._unitInMeters*f.max-l);const _={x:(r=r??new Vi({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0})).xmax-r.xmin,y:r.ymax-r.ymin,z:4*Math.max(r.xmax-r.xmin,r.ymax-r.ymin)},x=Math.max(_.x,_.y,_.z);je(Mx,i,e),lC[0]=Mx[0]>0?r.xmax:r.xmin,lC[1]=Mx[1]>0?r.ymax:r.ymin,lC[2]=Mx[2]>0?x/2:-x/2,je(lC,lC,e),Ye(Mx,Mx);const T=1.1*Ve(lC,Mx)*this._unitInMeters,A=Math.sqrt(o*(o+2*this._referenceEllipsoid.radius)),M=Math.max(r.xmax-r.xmin,r.ymax-r.ymin),I=M*rwt*this._unitInMeters,L=M*nwt*this._unitInMeters,F=Je((o-L)/(I-L),0,1)**3,z=Math.min(ui(A,T,F),A)*Math.max(Math.log(Math.abs(c)),1);return h9e(Math.min(z,Math.max(34064e4,x))/this._unitInMeters,twt,this._unitInMeters,s)}},ewt=class{constructor(e){this._referenceEllipsoid=Sr(e)}compute(e,i,r,n,s){s||(s={near:0,far:0});const o=rt(e),l=o-this._referenceEllipsoid.radius,c=this._referenceEllipsoid.radius+Math.min(0,n),f=Math.abs(l-n),_=Math.max(f,Math.abs(l)),x=Math.sqrt(_*(_+2*c)),T=o+this._referenceEllipsoid.radius;return h9e(1.2*ui(x,T,dae(_)),Je(2e4-(Math.log(_)-7.983)/9.011*19e3,1e3,2e4),1,s)}};function h9e(t,e,i,r){const n=iwt/i;return t/e>n?(r.far=t,r.near=r.far/e):(r.near=n,r.far=r.near*e),r}const twt=2e4,iwt=2,rwt=.001,nwt=1e-4,lC=W(),Mx=W();let JF=class extends ze{constructor(e){super(e)}initialize(){this.addHandles(this.view.basemapTerrain.on("elevation-change",e=>this._handleElevationChangeEvent(e)))}_handleElevationChangeEvent(e){if(this.view.state.cameraController)return;const i=this.view.state.camera;e.spatialReference!=null&&I4e(this.view,i,e.extent,e.spatialReference)&&this._applyToCurrentCamera()}_applyToCurrentCamera(){this.view.state.updateCamera(e=>xP(this.view,e,Cf.EYE_AND_CENTER))}};y([w({constructOnly:!0})],JF.prototype,"view",void 0),JF=y([Z("esri.views.3d.state.ElevationCollisionConstraint")],JF);let lI=class extends ze{constructor(e){super(e),this.nearFarHeuristic=Kbt(e.view.state.viewingMode,e.view.basemapTerrain,e.view.renderCoordsHelper.spatialReference)}initialize(){this.addHandles([_e(()=>{var e,i,r,n;return[(i=(e=this.view.constraints)==null?void 0:e.clipDistance)==null?void 0:i.near,(n=(r=this.view.constraints)==null?void 0:r.clipDistance)==null?void 0:n.far]},()=>this._clipDistanceNearFarChanged()),_e(()=>{var e,i;return(i=(e=this.view.constraints)==null?void 0:e.clipDistance)==null?void 0:i.mode},()=>this._updateNearFar()),this.view.state.events.on("before-camera-change",e=>this._updateCameraNearFar(e)),_e(()=>this.view.renderDataExtent,()=>this._updateNearFar(),Li),_e(()=>{var e,i,r,n;return[(i=(e=this.view.constraints)==null?void 0:e.altitude)==null?void 0:i.min,(n=(r=this.view.constraints)==null?void 0:r.altitude)==null?void 0:n.max]},()=>this._updateAltitude(),Li),_e(()=>{var e,i;return(i=(e=this.view.constraints)==null?void 0:e.tilt)==null?void 0:i.max},()=>this._updateTiltMax(),Li),_e(()=>{var e,i;return(i=(e=this.view.constraints)==null?void 0:e.tilt)==null?void 0:i.mode},()=>this._updateTilt(),Li),_e(()=>{var e;return(e=this.view.state)==null?void 0:e.camera},()=>this._updateTiltAutoMax(),Li),_e(()=>{var e,i,r,n,s,o;return[(r=(i=(e=this.view.map)==null?void 0:e.ground)==null?void 0:i.navigationConstraint)==null?void 0:r.type,(o=(s=(n=this.view.state)==null?void 0:n.constraints)==null?void 0:s.collision)==null?void 0:o.enabled]},()=>this._updateCollision(),Li)]),this.view.state.isLocal&&this.addHandles(_e(()=>this.view.renderDataExtent,e=>this._updateLocalSurfaceDistance(e),ii)),this._updateNearFar(),this.view.state.viewingMode!==_t.Local&&this._updateAltitude(),this._updateTilt(),this._updateCollision(),this._set("surfaceCollisionConstraint",new JF({view:this.view}))}destroy(){this.surfaceCollisionConstraint&&(this.surfaceCollisionConstraint.destroy(),this._set("surfaceCollisionConstraint",null))}_clipDistanceNearFarChanged(){var i;const e=(i=this.view.constraints)==null?void 0:i.clipDistance;e&&e.mode!=="auto"&&this.view.state.updateCamera(r=>this._updateCameraNearFarManual(r,e))}_updateNearFar(){this.view.state.updateCamera(e=>this._updateCameraNearFar(e))}_updateCameraNearFar(e){const i=this.view.constraints&&this.view.constraints.clipDistance;(i?i.mode:"auto")==="manual"?this._updateCameraNearFarManual(e,i):this._updateCameraNearFarAuto(e,i)}_updateCameraNearFarAuto(e,i){this.nearFarHeuristic.compute(e.eye,e.center,this.view.renderDataExtent,wj(this.view,e.eye),e),i&&i.autoUpdate(e.near,e.far)}_updateCameraNearFarManual(e,i){i&&(e.near=i.near,e.far=i.far)}_updateCollision(){var n,s,o;const e=(o=(s=(n=this.view.map)==null?void 0:n.ground)==null?void 0:s.navigationConstraint)==null?void 0:o.type,i=!e||e==="stay-above",r=this.view.state.constraints.collision;if(i!==r.enabled){r.enabled=i,i&&this._reapplyConstraints(Yn.COLLISION);const l=this.view.constraints&&this.view.constraints.tilt;l&&l.mode!=="auto"||this._updateTiltAuto()}}_updateAltitude(){const e=this.view.constraints&&this.view.constraints.altitude;e&&this.view.state.viewingMode!==_t.Local?this.view.state.constraints.altitude={min:e.min,max:e.max}:this.view.state.constraints.altitude=null,this._reapplyConstraints()}_updateTiltMax(){const e=this.view.constraints&&this.view.constraints.tilt;e&&e.mode!=="auto"&&(this._updateTiltManual(e),this._reapplyConstraints())}_updateTilt(){const e=this.view.constraints&&this.view.constraints.tilt;(e?e.mode:"auto")==="manual"?this._updateTiltManual(e):this._updateTiltAuto(),this._reapplyConstraints()}_updateTiltManual(e){const i=this.view.state.constraints;i.tilt=i.createConstantMaxTilt(Ei(e.max))}_updateTiltAuto(){const e=this.view.state.constraints;e.tilt=e.createDefaultTilt(),this._updateTiltAutoMax()}_updateTiltAutoMax(){const e=this.view.constraints&&this.view.constraints.tilt;if(!e||e.mode!=="auto")return;const i=this.view.state.constraints;if(i.tilt){const r=i.tilt(this.view.state.camera.distance).max;e.autoUpdate(pu(r))}}_updateLocalSurfaceDistance(e){if(e==null)return;let i=Math.max(e.width,e.height);if(i<=0)return;e.zmax!=null&&e.zmin!=null&&(i=Math.max(i,e.zmax-e.zmin));const r=this.view.state,n=3*i/Math.atan(r.camera.fov/2);n!==r.constraints.distance&&(r.constraints.distance=n)}_reapplyConstraints(e=Yn.ALL){this.view.state.updateCamera(i=>wo(this.view,i,{selection:e,interactionType:Ki.NONE,interactionFactor:null,interactionStartCamera:null,interactionDirection:null,tiltMode:il.TUMBLE}))}};y([w({constructOnly:!0})],lI.prototype,"view",void 0),y([w({readOnly:!0})],lI.prototype,"surfaceCollisionConstraint",void 0),lI=y([Z("esri.views.3d.state.ConstraintsManager")],lI);let qw=class{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}constructor(e){this.renderCoordsHelper=e,this.frustum=OL(),this._points=$$e(),this.lines=new Array(12),this._origin=W(),this._direction=W(),this._altitude=null;for(let i=0;i<12;i++)this.lines[i]={origin:null,direction:W(),endpoint:null}}update(e){L$e(e.viewMatrix,e.projectionMatrix,this.frustum,this._points),Ne(this._origin,e.eye),Ne(this._direction,e.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines()}updatePoints(e){for(let i=0;ithis._handleElevationChangeEvent(e))),this._applyCorrection()}onControllerEnd(){this.removeAllHandles()}stepController(){}_handleElevationChangeEvent(e){(e.spatialReference==null||I4e(this.view,this.desiredCamera,e.extent,e.spatialReference))&&this._applyCorrection()}_applyCorrection(){this.view.state.updateCamera(e=>{e.copyViewFrom(this.desiredCamera),xP(this.view,e,Cf.EYE_AND_CENTER)||this.constraintEnabled||(this.state=Cs.Stopped)})}};y([w({constructOnly:!0})],m$.prototype,"desiredCamera",null),m$=y([Z("esri.views.3d.state.controllers.SurfaceCollisionCorrectionController")],m$);const swt=.66;function d9e(t){return 360-d5.normalize(t)}function Wj(t){return d5.normalize(360-t)}function p9e(t,e,i){const r=e.camera;if(r!=null)return owt(r,V_(t));const{targetGeometry:n}=e;if(n==null)return null;const{camera:s,mode:o}=m9e(t,e.rotation,i);if(n.type==="point")return lwt(t,e,n,s,o);const l=n.extent;return l==null?null:PF(t,l,s.heading,s.tilt,o)}async function f9e(t,e,i,r){const n=e.camera;if(n!=null)return awt(n,V_(t),r);const{targetGeometry:s}=e;if(s==null)throw new Error("Viewpoint has no targetGeometry!");const{camera:o,mode:l}=m9e(t,e.rotation,i);if(s.type==="point")return cwt(t,e,s,o,l,r);const c=s.extent;if(c==null)throw new Error("Target geometry has no extent!");return oIe(t,c,o.heading,o.tilt,l,r)}function owt(t,e){const i=t.position;let r;try{r=rl(i,e)}catch{return null}const n=t.clone();return n.position=r.clone(),n}async function awt(t,e,i){const r=t.position,n=await qy(r,e,{signal:i});St(i);const s=t.clone();return s.position=n.clone(),s}function m9e(t,e,i){const r=_5(t,t.state.camera);let n=ql.ADJUST;return e!=null&&(r.heading=d9e(e),n=ql.LOCKED),i!=null&&(r.tilt=i),{camera:r,mode:n}}function lwt(t,e,i,r,n){const s=t.spatialReference;let o;try{o=rl(i.clone(),s)}catch{return null}const l=e.scale!=null?xj(t,e.scale,o.latitude):t.state.camera.distance;return L0t(t,o,l,r,n)}async function cwt(t,e,i,r,n,s){const o=t.spatialReference,l=await qy(i.clone(),o,{signal:s});St(s);const c=e.scale!=null?xj(t,e.scale,l.latitude):t.state.camera.distance;return X4e(t,l,c,r,n,s)}function g9e(t,e,i=null){return i==null&&(i=new ih),cle(t,null,e.clone(),i)}async function y9e(t,e,i){const r=_wt(t,e);if(!r)throw new se("viewpointutils-create:no-target","Missing target for creating viewpoint");const n=new cd({fov:t.camera.fov}),s=new ih({camera:n});if(r.target instanceof ih)return Ox(await dwt(t,r.target,r,i,s));if(r.target instanceof cd)return Ox(await _9e(t,r.target,i,s));const o=r.scale!=null||r.zoom!=null;if(r.target instanceof Vi){const f=r.target.xmin===r.target.xmax||r.target.ymin===r.target.ymax;return Ox(o||f?await Hte(t,r,r.target.center,n,i,s):await gwt(t,r,r.target,n,i,s))}const l={boundingBox:Bn(),hasZ:!1,screenSpaceObjects:[]},c=o?uwt(t,r):void 0;if(await v9e(t,r.target,c,l,i),isFinite(l.boundingBox[0])){let f;if(gm(l.boundingBox,ro),Zd.x=ro[0],Zd.y=ro[1],Zd.z=ro[2],Zd.spatialReference=t.spatialReference,isFinite(Zd.z)&&l.hasZ?f=Dse(l.boundingBox):(Zd.z=void 0,f=Cet(Lse(l.boundingBox,wwt))),o||f)return Ox(await Hte(t,r,Zd,n,i,s));const _=bwt(t,l.screenSpaceObjects);return Ox(await vwt(t,r,Zd,l.boundingBox,_,n,i,s))}return r.position?Ox(await fwt(t,r,n,s,i)):Ox(await mwt(t,r,n,i,s))}function ale(t,e){return e.scale==null&&e.zoom!=null?hIe(t,e.zoom):e.scale}function uwt(t,e){const i=ale(t,e);return i?Oht(i):void 0}function lle(t,e){let i=!1;return e.heading!=null?(t.heading=e.heading,i=!0):e.rotation!=null&&(t.heading=d9e(e.rotation),i=!0),e.tilt!=null&&(t.tilt=e.tilt,i=!0),e.fov!=null&&(t.fov=e.fov),i}function cle(t,e,i,r){const n=t.spatialReference||at.WGS84;return(e=e??Tv(t,i))==null||(r.targetGeometry=w_(e.center,t.renderSpatialReference,n),r.scale=dIe(t,e),r.rotation=Wj(i.heading),r.camera=i),r}async function DU(t,e,i,r){var x;const n=()=>new se("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw n();e.type==="mesh"&&(e=e.extent);const s=e.spatialReference,o=t.spatialReference,l=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let T;switch(e.type){case"point":T=e;break;case"multipoint":case"polyline":T=(x=e.extent)==null?void 0:x.center;break;case"extent":T=e.center;break;case"polygon":T=e.centroid}T!=null&&l!=null&&t.elevationProvider!=null?(T=await qy(T,l,{signal:r}),ro[2]=my(t.elevationProvider,T)??0):ro[2]=0}const c=xwt[e.type],f=new Array;if(c(e,e.hasZ?T=>{f.push([T[0],T[1],T[2]])}:T=>{f.push([T[0],T[1]])},ro),f.length===0)throw n();const _=await qy(new Cm({spatialReference:s,hasZ:e.hasZ,hasM:!1,points:f}),o,{signal:r});if(e.hasZ&&(i.hasZ=!0),e.hasZ)for(const[T,A,M]of _.points)ro[0]=T,ro[1]=A,ro[2]=M,qf(i.boundingBox,ro);else for(const[T,A]of _.points)ro[0]=T,ro[1]=A,qf(i.boundingBox,ro)}async function hwt(t,e,i,r,n){const s=await Ju(t.whenViewForGraphic(e));if(s.ok===!1||s.value==null||!("whenGraphicBounds"in s.value))return void await DU(t,e.geometry,r,n);const o=s.value,l=await Ju(o.whenGraphicBounds(e,{minDemResolution:i}));if(l.ok===!1||!l.value)return void await DU(t,e.geometry,r,n);const{screenSpaceObjects:c,boundingBox:f}=l.value;ZO(r.boundingBox,f),c&&c.forEach(_=>{r.screenSpaceObjects.push(_)}),isFinite(f[2])&&(r.hasZ=!0)}async function v9e(t,e,i,r,n){var s;if(Array.isArray(e)&&e.length===2){const o=e[0],l=e[1];if(typeof o=="number"&&typeof l=="number")return Zd.x=o,Zd.y=l,Zd.z=void 0,Zd.spatialReference=(s=t.spatialReference)!=null&&s.isGeographic?t.spatialReference:at.WGS84,void await DU(t,Zd,r,n)}e&&"map"in e&&typeof e.map=="function"?await Promise.allSettled(e.map(o=>v9e(t,o,i,r,n))):e instanceof ix?await DU(t,e,r,n):e instanceof Ml&&await hwt(t,e,i,r,n)}async function dwt(t,e,i,r,n){if(e.camera!=null)return _9e(t,e.camera,r,n);n.scale=e.scale,n.rotation=e.rotation,n.targetGeometry=e.targetGeometry!=null?e.targetGeometry.clone():null,n.camera=null,i.heading!=null?n.rotation=Wj(i.heading):i.rotation!=null&&(n.rotation=i.rotation);const s=ale(t,i);return s!=null&&(n.scale=s),n.camera=await f9e(t,n,i.tilt,r),n}async function _9e(t,e,i,r){const n=t.spatialReference,s=await qy(e.position,n,{signal:i});return(e=e.clone()).fov=t.camera.fov,e.position=s,cle(t,null,e,r)}async function pwt(t,e,i,r,n,s,o){const l=t.renderSpatialReference;return await dU(e,Bq,l,0,{signal:o}),await dU(i,gN,l,0,{signal:o}),s.targetGeometry=new mt(e),n.position=new mt(i),je(NU,Bq,gN),Sj(t,gN,NU,r.up,n),s.scale=qT(t,Sn(gN,Bq),s.targetGeometry.latitude),s.rotation=Wj(n.heading),s.camera=n,s}async function Hte(t,e,i,r,n,s){if(i==null)throw new se("createfromcenter","invalid point");s.targetGeometry=i.clone();const o=xE(t);if(e.position)return pwt(t,s.targetGeometry,e.position,o,r,s,n);if(e.zoomFactor){const c=o.distance/e.zoomFactor,f=De(ro,o.viewForward,-c);o.eye=Be(ro,o.center,f),s.scale=qT(t,c,i.latitude)}_5(t,o,r);const l=lle(r,e)?ql.LOCKED:ql.ADJUST;if(!e.zoomFactor){const c=ale(t,e);if(c==null){const{renderSpatialReference:f}=t;await dU(i,ro,f,0,{signal:n}),N$e(o.frustum,ro)?s.scale=qT(t,Sn(o.eye,ro),i.latitude):s.scale=dIe(t,o)}else s.scale=c;s.camera=await Y4e(t,s.targetGeometry,s.scale,r,l,n)}return s}async function fwt(t,e,i,r,n){const s=xE(t);Ne(NU,s.viewForward),Sj(t,s.eye,NU,s.up,jq);const o=t.spatialReference,{position:l}=e;if(l){const c=await qy(l,o,{signal:n});i.position=c}else i.position=new mt;return i.heading=e.heading!=null?e.heading:jq.heading,i.tilt=e.tilt!=null?e.tilt:jq.tilt,cle(t,null,i,r)}async function mwt(t,e,i,r,n){const s=xE(t),{spatialReference:o,renderSpatialReference:l}=t;return Hte(t,e,w_(s.center,l,o),i,r,n)}async function gwt(t,e,i,r,n,s){s.targetGeometry=i.clone();const o=xE(t);_5(t,o,r);const l=lle(r,e)?ql.LOCKED:ql.ADJUST;return s.camera=await oIe(t,i,r.heading,r.tilt,l,n),s}function ywt(t,e,i,r,n){let s=0;i.z!=null?s=i.z:t.basemapTerrain&&t.elevationProvider&&(s=my(t.elevationProvider,i)),Ie(ro,i.x,i.y,s),uu(t.spatialReference,ro,qge,t.renderSpatialReference),Yf(mN,qge),Xf(mN,mN),Bn(cR);const o=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let M=0;M{this._resolveCallback=n,this._rejectCallback=s;const o=new AbortController;this.options.signal!=null&&Yl(this.options.signal,()=>{this.abort()}),this._abortController=o,this.waitForReady()})}resolve(e){if(this.state!=="finished")return this.state="finished",this._resolveCallback(e)}reject(e){if(this.state!=="finished")return this.state="finished",this._rejectCallback(e)}abort(e=!1){this._abortController.abort(),this.state==="wait-for-animation-finish"&&!e&&this._animationController!=null&&this.view.state.cameraController===this._animationController&&this._animationController.active&&this._animationController.stopController(),this.reject(ur())}async waitForReady(){if(this.state="wait-for-ready",!this.view.ready)try{await rd(()=>this.view.ready,this._abortController.signal)}catch(e){return this.reject(e)}this.createViewPoint()}async createViewPoint(){if(this.state!=="finished"){this.state="wait-for-viewpoint",this._animationController=this.options.animate?this._getAnimationController():null;try{const e=await y9e(this.view,this.target,this._abortController.signal);if(this.state==="finished")return;const i=e?this._getCameraFromViewpoint(e):null;if(i==null)return;if(this.options.animate){if(this._animationController==null)return;this.startAnimation(i,this._animationController)}else this.view.stateManager.setStateCamera(i.camera,{applyConstraints:!i.isFullySpecified,positionAndOrientationOnly:!0,doNotCancelGoToOperation:!0}),this.resolve()}catch(e){this.reject(e)}}}_getCameraFromViewpoint(e){var s;const i=!!(this.target instanceof ih&&this.target.camera||this.target instanceof cd),r=e.camera;if(r==null)return null;if(!this.view.stateManager.isCompatible(r)){const o=r.position,l=o&&o.spatialReference,c=l?l.wkid:"none",f=(s=this.view.spatialReference)==null?void 0:s.wkid;return this.reject(new se("GotoAnimation:incompatible-spatialreference",`Resulting camera has an incompatible spatial reference (camera: ${c}, view: ${f})`,{camera:r})),null}const n=Tv(this.view,r);return n==null?(this.reject(new se("GotoAnimation:invalid-camera","Resulting camera is invalid")),null):{viewpoint:e,camera:n,isFullySpecified:i}}startAnimation(e,i){this.state="wait-for-animation-finish";const r=i.viewAnimation;if(r==null)return void this.reject(new se("GotoAnimation:missing-animation","Unreachable code in view.stateManager"));if(r.update(e.viewpoint,"running"),!i.active||i.viewAnimation==null||i.viewAnimation.target!==e.viewpoint||this.view.state.cameraController!==i)return this.abort();let n;e.isFullySpecified?(n=new m$({view:this.view,desiredCamera:e.camera}),xP(this.view,e.camera,Cf.EYE_AND_CENTER)):wo(this.view,e.camera),i.begin(e.camera,this.options);const s=()=>{const l=this.view.state.cameraController;n&&(l&&l.active?l instanceof Hv&&l.viewAnimation!=null&&l.viewAnimation.target===e.viewpoint&&(this.view.state.cameraController=n):i.viewAnimation!=null&&i.viewAnimation.target===e.viewpoint&&i.state==="finished"&&(this.view.state.cameraController=n))},o=l=>{if(this.view.state!=null)switch(i.state){case Cs.Finished:switch(this.state){case"pending":case"wait-for-ready":case"wait-for-viewpoint":case"wait-for-animation-finish":this.resolve()}break;case Cs.Ready:case Cs.Rejected:case Cs.Running:case Cs.Stopped:switch(this.state){case"pending":case"wait-for-ready":case"wait-for-viewpoint":case"wait-for-animation-finish":this.reject(l)}}};r.when(s,l=>o(l)),i.asyncResult={resolve:()=>o(),reject:l=>o(l)}}_getAnimationController(){let e=null,i=null;const r=this.view.state.cameraController;return r instanceof Hv&&(r.updateStateFromViewAnimation(),r.active&&(e=r,i=e.viewAnimation)),e!=null||(e=new Hv({view:this.view,mode:"animation"}),i=e.viewAnimation,this.view.state.switchCameraController(e))?e:(i!=null&&i.stop(),this.reject(new se("GotoAnimation:goto-cannot-interrupt","Cannot start an animation while interacting")),null)}},TP=class{constructor(){this._outer=new Map}clear(){this._outer.clear()}get empty(){return this._outer.size===0}get(e,i){var r;return(r=this._outer.get(e))==null?void 0:r.get(i)}set(e,i,r){const n=this._outer.get(e);n?n.set(i,r):this._outer.set(e,new Map([[i,r]]))}delete(e,i){const r=this._outer.get(e);r&&(r.delete(i),r.size===0&&this._outer.delete(e))}forEach(e){this._outer.forEach((i,r)=>e(i,r))}};var Zo;function Gq(t=!Le("disable-feature:high-quality-idle"),e=null){const i=new TP;return t?(i.set(Vr.IDLE,Zo.Antialiasing,e!=="low"),i.set(Vr.IDLE,Zo.HighResolutionAtmosphere,e!=="low"),i.set(Vr.IDLE,Zo.HighQualityTransparency,!0),i.set(Vr.IDLE,Zo.SSAO,!0),i.set(Vr.IDLE,Zo.WaterReflection,!0),i.set(Vr.IDLE,Zo.PhysicalPixelRendering,!0)):(i.set(Vr.ANIMATING,Zo.HighResolutionShadows,!0),i.set(Vr.INTERACTING,Zo.HighResolutionShadows,!0)),i.set(Vr.IDLE,Zo.HighResolutionShadows,!0),i.set(Vr.IDLE,Zo.HighResolutionVoxel,!0),i}(function(t){t[t.Antialiasing=0]="Antialiasing",t[t.HighQualityTransparency=1]="HighQualityTransparency",t[t.HighResolutionVoxel=2]="HighResolutionVoxel",t[t.HighResolutionAtmosphere=3]="HighResolutionAtmosphere",t[t.SSAO=4]="SSAO",t[t.WaterReflection=5]="WaterReflection",t[t.HighResolutionShadows=6]="HighResolutionShadows",t[t.PhysicalPixelRendering=7]="PhysicalPixelRendering"})(Zo||(Zo={}));let ra=class extends ze{get camera(){const e=this._get("camera");if(!this.ready)return e;const i=_5(this.view,this.view.state.camera,Hq);return i&&e&&i.equals(e)?e:i.clone()}set camera(e){var i,r;this._updatePropertyBeforeReady("camera",e)||((i=this.view.elevationProvider)==null||i.enableElevationCache(!0),this.setStateCamera(Tv(this.view,e),{applyConstraints:!1})||Ce.getLogger(this).error("#camera=","Invalid camera",e),(r=this.view.elevationProvider)==null||r.enableElevationCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const i=_5(this.view,this.view.state.contentCamera,Hq);return i&&e&&i.equals(e)?e:i.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const i=Tv(this.view,e);i!=null?(this._updateElevation(i),this.view.state.contentCamera=i):this.view.state.contentCamera=null}installContentCameraReset(e){if(this.removeHandles(qq),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const i=this.zoom,r=this.view.state.camera.distance**2,n=mc(this.view.state.camera.center),s=e.sticky?this.contentCamera.clone():null;return this.addHandles([_e(()=>this.contentCamera,()=>{e.sticky||(this.removeHandles(qq),this.test.contentCameraResetState.clear())}),_e(()=>this.zoom,o=>{o!==void 0&&i!==void 0&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(o-i)/2),Math.abs(o-i)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=s))}),_e(()=>this.view.state.camera,o=>{const l=Co(n,o.center);this.test.contentCameraResetState.set("camera.center",l/r),l>r?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=s)})],qq),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){var i;this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():Ce.getLogger(this).error("#center=","Invalid center",e):Ce.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+((i=this.view.spatialReference)==null?void 0:i.wkid)+")",e):Ce.getLogger(this).error("#center=","Center may not be null or undefined"))}get extent(){if(!this.ready)return this._get("extent");const e=this.view,i=aIe(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return i??this._get("extent")}set extent(e){var i;this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||Ce.getLogger(this).error("#extent=","Invalid extent",e):Ce.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+((i=this.view.spatialReference)==null?void 0:i.wkid)+")",e):Ce.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get _initialViewpoint(){var i;const e=this.view.map;return e&&"initialViewProperties"in e?(i=e.initialViewProperties)==null?void 0:i.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(this.ready){const e=this.view.pointsOfInterest.centerOnContent;return qT(this.view,e.distance,e.location.latitude)}return this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||Ce.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,i=e.padding,r=e.pixelRatio,n=this._get("padding"),s=Math.round(i[er.TOP]/r),o=Math.round(i[er.RIGHT]/r),l=Math.round(i[er.BOTTOM]/r),c=Math.round(i[er.LEFT]/r);return n!=null&&n.top===s&&n.right===o&&n.bottom===l&&n.left===c?n:{top:s,right:o,bottom:l,left:c}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,yN),this.view.state.updateCamera(i=>i.padding=yN))}_paddingToArray(e,i,r){e?rs(r,e.top||0,e.right||0,e.bottom||0,e.left||0):rs(r,0,0,0,0);for(let n=0;n<4;n++)r[n]=Math.round(r[n]*i)}get screenCenter(){const e=this.padding;return Ku((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?g9e(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){var i;if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||Ce.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const r=e.camera!=null?e.camera.position:e.targetGeometry,n=r!=null&&r.spatialReference;Ce.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(n?n.wkid:"none")+", view: "+((i=this.view.spatialReference)==null?void 0:i.wkid)+")",e)}else Ce.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?B0t(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||e===void 0||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||Ce.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),i=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*i),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*i);const r=this.view._stage.renderView.renderingContext.parameters.maxTextureSize;return KS(this._tmpCanvasSize,r),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:i,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return this._devicePixelRatioOverride!=null?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){var e,i;return((i=(e=this.view)==null?void 0:e._stage)==null?void 0:i.renderer.isFeatureEnabled(Zo.PhysicalPixelRendering))??!1}get _usePhysicalPixelRenderingAny(){var i,r;const e=(r=(i=this.view)==null?void 0:i._stage)==null?void 0:r.renderer;return e&&(e.isFeatureEnabled(Zo.PhysicalPixelRendering,Vr.IDLE)||e.isFeatureEnabled(Zo.PhysicalPixelRendering,Vr.INTERACTING)||e.isFeatureEnabled(Zo.PhysicalPixelRendering,Vr.ANIMATING))}constructor(e){super(e),this.constraintsManager=null,this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=Wge,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:i=>this._devicePixelRatioOverride=i,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return this.renderState!=null},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(i){this.viewStateManager._idleTimeout=i?Wge:0}},this._propertiesPool=new x_({frustum:qw},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new Ewt}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([Jr(()=>this.view.state.events,"before-camera-change",e=>e&&this._updateElevation(e)),_e(()=>{var e;return(e=this.view.state)==null?void 0:e.camera},(e,i)=>this._cameraChangedHandler(e,i),Li)]),Mo(()=>{var e;return(e=this.view.state)==null?void 0:e.camera},e=>this._updateElevation(e),{once:!0,sync:!0}),this.addHandles([AT({prepare:()=>this._prepareFrame()}),_e(()=>this.view.state.cameraController,()=>{this._cameraSetByUser=!0,this.removeHandles(vN)}),Jr(()=>this.view.state.events,"camera-projection-changed",()=>this.notifyChange("scale"))])}destroy(){this.exit(),this._propertiesPool=et(this._propertiesPool)}init(){this.constraintsManager=new lI({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const i of e)this.set(i.name,i.value);if(!this._cameraSetByUser){const i=this._initialViewpoint||this.view.initialExtent;i&&this.isCompatible(i)?this._setInitialView(i):this.view.state.viewingMode===_t.Local&&this.addHandles(Mo(()=>this.view.basemapTerrain.ready,()=>{this.removeHandles(vN),this._setInitialView(this.view.dataExtent)},{once:!0,initial:!0}),vN)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(vN),this.constraintsManager=et(this.constraintsManager))}async goTo(e,i){const r={animate:!0,...i};return this._gotoOperation!=null&&this._gotoOperation.abort(r.animate),this._gotoOperation=new Twt(e,r,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(xE(this.view),{applyConstraints:!1})}step(e){const i=this.view.state,r=i==null?void 0:i.cameraController;r&&(i.updateCamera(n=>r.stepController(e,n)),r.steppingFinished&&r.finishController())}_cancelGoToOperation(){this._gotoOperation!=null&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,i=[];for(const{propertyName:r,overrides:n}of Awt){const s=e.has(r),o=this._isOverridden(r);!s&&o&&i.push({name:r,value:this._get(r)}),this._clearOverride(r),(s||o)&&n.forEach(l=>e.add(l))}return i}_setInitialView(e){if(e==null||this._cameraSetByUser)return;if(e instanceof cd)return void this.setStateCamera(Tv(this.view,e),{applyConstraints:!1});if(e instanceof ih){if(e.targetGeometry instanceof Vi){const s=PF(this.view,e.targetGeometry,0,.5,ql.LOCKED);return void(s!=null&&this.setStateCamera(Tv(this.view,s),{applyConstraints:!0}))}const r={applyConstraints:!e.camera},n=this._viewpointToCamera(e);return void this.setStateCamera(n,r)}const i=PF(this.view,e,0,.5,ql.LOCKED);i!=null&&this.setStateCamera(Tv(this.view,i),{applyConstraints:!0})}_updatePropertyBeforeReady(e,i){return!this.ready&&(this._override(e,i),i&&Cwt.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return e!=null&&(e instanceof ih?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof cd?this.isCompatible(e.position):e.spatialReference&&HI(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=Mwt){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,i,r=gb){const{heading:n,tilt:s}=this._getPreservingHeadingTilt(),o=sae(this.view,n,s,e,i,ql.ADJUST);return o==null?null:(r.copyFrom(this.view.state.camera),r.eye=o.eye,r.center=o.center,r.up=o.up,r)}_centerToCamera(e){const i=this.view.pointsOfInterest.centerOnContent;i.runTask();const r=i.distance;return this._centerPointAtDistanceToCamera(e,r)}_extentToCamera(e){const{heading:i,tilt:r}=this._getPreservingHeadingTilt(),n=PF(this.view,e,i,r,ql.ADJUST,Hq);return n?Tv(this.view,n):null}_scaleToCamera(e){if(e==null)return null;const i=this.view.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,n=i.location.latitude;if(n==null)return null;const s=xj(this.view,e,n);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(hIe(this.view,e))}_viewpointToCamera(e){return Tv(this.view,p9e(this.view,e))}setStateCamera(e,i){return!(e==null||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,i.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera(r=>{i.positionAndOrientationOnly?(r.eye=e.eye,r.center=e.center,r.up=e.up):r.copyFrom(e),i.applyConstraints&&wo(this.view,r)}),i.applyConstraints||(this.view.state.cameraController=new m$({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:i}=this.view;if(!e||!i)return;this._windowDevicePixelRatio=window.devicePixelRatio;const r=this._computeCanvasSize();if(r.width!==0&&r.height!==0&&(i.width===r.width&&i.height===r.height||(i.width=r.width,i.height=r.height),this.view.state)){const n=this.view.state.camera;n.fullWidth===r.width&&n.fullHeight===r.height&&n.pixelRatio===r.pixelRatio||(gb.copyFrom(n),gb.pixelRatio!==r.pixelRatio&&(this._paddingToArray(this.padding,r.pixelRatio,yN),gb.padding=yN),gb.fullWidth=r.width,gb.fullHeight=r.height,gb.pixelRatio=r.pixelRatio,this.view.state.camera=gb),this._updateViewState()}}_updateElevation(e){var s,o;const i=(s=this.view.basemapTerrain)==null?void 0:s.spatialReference,r=((o=this.view.renderCoordsHelper)==null?void 0:o.getAltitude(e.eye))??0,n=i?wj(this.view,e.eye):0;e.relativeElevation=r-n}_updateViewState(){this.test.renderState!=null?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=Vr.ANIMATING:this.view.interacting?this.view.state.mode=Vr.INTERACTING:(this.view.state.mode===Vr.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTimethis.notifyChange("isInteractive"),Yge),this.view.state.updateCamera(e=>this.stepController(0,e)),this.steppingFinished&&this.finishController()}};y([w({readOnly:!0})],yy.prototype,"isInteractive",null),y([w()],yy.prototype,"_lastInteraction",void 0),yy=y([Z("esri.views.3d.state.controllers.InteractiveController")],yy);var Dh;(function(t){t[t.CENTER=0]="CENTER",t[t.EYE=1]="EYE"})(Dh||(Dh={}));let g$=class extends yy{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(e){super(e),this.pivot=Dh.CENTER,this._rotScale=0,this._lastPoint=yt(),this._tmpWorldUp=W(),this._tmpViewDir=W(),this._tmpRotCurPoint=yt(),this._tmpTransf=Qe(),this._tmpAxis=W(),this._tmpPivotPoint=W(),this._pivotPos=W(),this._constraintOptions={selection:Yn.ALL,interactionType:Ki.TUMBLE,interactionFactor:0,interactionStartCamera:null,interactionDirection:null,tiltMode:il.TUMBLE}}initialize(){this._rotScale=this.pivot===Dh.CENTER?3:1.5}begin(e){if(this.active){switch(this.pivot){case Dh.EYE:Ne(this._pivotPos,this.startCamera.eye),this._constraintOptions.interactionType=Ki.LOOK_AROUND,this._constraintOptions.tiltMode=il.LOOK_AROUND,this._constraintOptions.selection=Yn.NONE;break;case Dh.CENTER:{const i=this._intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this._pivotPos,this.view.map.ground.opacity===0?AE:{});i||Ne(this._pivotPos,this.startCamera.center),this._constrainPivotPoint(e,i),this.startCamera.center=this._pivotPos,this._constraintOptions.interactionType=Ki.TUMBLE,this._constraintOptions.tiltMode=il.TUMBLE,this._constraintOptions.selection=Yn.ALL&~Yn.DISTANCE;break}}this._constraintOptions.interactionStartCamera=this.startCamera,vT(this.startCamera,e,this._lastPoint)}}_constrainPivotPoint(e,i){const r=this.startCamera,n=W();je(n,this._pivotPos,r.eye);const s=rt(n),o=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(r.eye,Xge);let l=Math.max(Math.min(Nbt,1/Math.abs(Ve(Xge,r.viewForward)))*o,Fbt);i&&(l=Math.min(s,l));const c=Sr(this.view.spatialReference),f=ss(r.width/r.pixelRatio*.5,r.height/r.pixelRatio*.5),_=qj(this.startCamera,f,c);let x=this.view._stage.renderView.getMinimalDepthForArea(NL(this.view),r.fullWidth/r.pixelRatio*.5,r.fullHeight/r.pixelRatio*.5,r,2.5*Fq,Fq),T=this.view._stage.renderView.getMinimalDepthForArea(NL(this.view),e[0],e[1],r,Fq);x==null&&T==null||(x=x??T??0,T=T==null||_===Xa.Horizontal?x:T,l=x>T?T:x,l=i?Math.min(l,s):l),Ye(n,n),Ne(this._pivotPos,Be(this._tmpPivotPoint,r.eye,De(this._tmpPivotPoint,n,l)))}update(e){if(this.active){switch(this.pivot){case Dh.EYE:this.currentCamera.center=this._applyRotation(this.currentCamera,e,this.currentCamera.center,this._pivotPos);break;case Dh.CENTER:this.currentCamera.center=this._pivotPos,this.currentCamera.eye=this._applyRotation(this.currentCamera,e,this.currentCamera.eye,this._pivotPos)}wo(this.view,this.currentCamera,this._constraintOptions),this.commitCamera()}}end(){this.active&&this.finishController()}_applyRotation(e,i,r,n){this.view.renderCoordsHelper.worldUpAtPosition(n,this._tmpWorldUp),vT(e,i,this._tmpRotCurPoint);let s=(this._lastPoint[1]-this._tmpRotCurPoint[1])*this._rotScale,o=(this._tmpRotCurPoint[0]-this._lastPoint[0])*this._rotScale;je(this._tmpViewDir,r,n);const l=rt(this._tmpViewDir),c=Ca(Ve(this._tmpViewDir,this._tmpWorldUp)/l);if(this.pivot===Dh.EYE){s*=-.5;const f=.5*Math.PI-c,_=.5*Math.PI*.99;s=f-Math.max(-_,Math.min(_,f+s))}return s=Je(s+c,Bl.min,Bl.max)-c,Wt(this._tmpAxis,e.up,this._tmpViewDir),this.pivot===Dh.CENTER&&(o=-o),xp(this._tmpTransf,o,this._tmpWorldUp),Wh(this._tmpTransf,this._tmpTransf,s,this._tmpAxis),bt(this._tmpViewDir,this._tmpViewDir,this._tmpTransf),e.up=bt(Wq,e.up,this._tmpTransf),Be(Wq,n,this._tmpViewDir),Qo(this._lastPoint,this._tmpRotCurPoint),Wq}};y([w()],g$.prototype,"pivot",void 0),g$=y([Z("esri.views.3d.state.controllers.RotateController")],g$);const Wq=W(),Xge=W();let Yq=class extends Rl{constructor(e,i,r,n){super(!0),this._view=e,this.pointerAction=i,this._pivot=r,this.registerIncoming("drag",n,s=>this._handleDrag(s))}_handleDrag(e){const i=e.data;if(i.pointers.size>1||!ole(e.data,this.pointerAction))return;const r=ss(i.center.x,i.center.y);switch(i.action){case"start":this._cameraController&&(this._cameraController.end(),this._cameraController=null),this._cameraController=new g$({view:this._view,pivot:this._pivot}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(r);break;case"update":this._cameraController&&this._cameraController.update(r);break;case"end":this._cameraController&&(this._cameraController.end(),this._cameraController=null)}e.stopPropagation()}},qte=class extends yy{constructor(){super(...arguments),this._pickPoint=W(),this._tmpP0=yt(),this._panAxisAngle=Gj(),this._tmpRayDir=W(),this._tmpRayDirPick=W(),this._targetOnSphere=W(),this._navMode=Xa.Horizontal,this._tmpRay={origin:W(),direction:W()},this.dragBeginPoint=ss(),this._normalizedAnchorPoint=yt(),this._constraintOptions={selection:Yn.ALL_EXCEPT_COLLISION,interactionType:Ki.ZOOM,interactionFactor:0,interactionStartCamera:null,interactionDirection:null,tiltMode:il.TUMBLE},this._sphere=co(),this._hasPickPoint=!1}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(e){if(!this.active)return;Qo(this.dragBeginPoint,e),vT(this.startCamera,e,this._normalizedAnchorPoint);const i=Sr(this.view.spatialReference),r=r9e(this._intersectionHelper,this.startCamera,e,i,E5.Ellipsoid,this.view.map.ground.opacity===0?AE:{});if(this._navMode=qj(this.startCamera,e,i),this._navMode===Xa.Horizontal)this._hasPickPoint=!!r.scenePickPoint,this._pickPoint=r.scenePickPoint??this._pickPoint,this._sphere=r.sphere;else{let n;SP(this.startCamera,e,this._tmpRay),Ye(this._tmpRay.direction,this._tmpRay.direction),r.scenePickPoint!=null&&(je(this._tmpRayDirPick,this.startCamera.eye,r.scenePickPoint),n=rt(this._tmpRayDirPick));const s=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,Zge);let o=Je(Math.min(XLe,1/Math.abs(Ve(Zge,this._tmpRay.direction)))*s,OU[0],OU[1]);const l=this.view._stage.renderView.getMinimalDepthForArea(null,e[0],e[1],this.view.state.camera,Hj);o=l??o,o=n!=null?Math.min(o,n):o,this._hasPickPoint=!0,De(this._tmpRay.direction,this._tmpRay.direction,o),Be(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}this._constraintOptions.interactionStartCamera=this.startCamera}update(e){if(this.active){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,this._navMode===Xa.Horizontal){je(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);const i=rt(this._tmpRayDir);vT(this.currentCamera,e,this._tmpP0);const r=12*(this._normalizedAnchorPoint[1]-this._tmpP0[1]);let n=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&n=0&&nthis.startCamera.center[2]?Px[2]=Math.max(this.startCamera.center[2],Px[2]):Px[2]=Math.min(this.startCamera.center[2],Px[2]),this.currentCamera.center=Px,this._constraintOptions.interactionFactor=um(Dm(this.dragBeginPoint,e)),wo(this.view,this.currentCamera,this._constraintOptions),this.commitCamera())}end(){this.active&&this.finishController()}};Wte=y([Z("esri.views.3d.state.controllers.local.ZoomController")],Wte);const Px=W(),Owt=nt(0,0,1);let Pwt=class extends Rl{constructor(e,i,r){super(!0),this._view=e,this.pointerAction=i,this.registerIncoming("drag",r,n=>this._handleDrag(n))}_handleDrag(e){const i=e.data;if(i.pointers.size>1||!ole(e.data,this.pointerAction))return;const r=ss(i.center.x,i.center.y);switch(i.action){case"start":this._cameraController&&(this._cameraController.end(),this._cameraController=null),this._view.state.isGlobal?this._cameraController=new qte({view:this._view}):this._cameraController=new Wte({view:this._view}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(r);break;case"update":this._cameraController&&this._cameraController.update(r);break;case"end":this._cameraController&&(this._cameraController.end(),this._cameraController=null)}e.stopPropagation()}};function f0(t){let e=t*t;return t<0&&(e*=-1),e}function Jge(t,e,i){const r=i,n=t.state,s=t.device,o=e.tiltDirection==="forward-down"?1:-1,l=1;return s.deviceType==="standard"?(r.translation[0]=f0(n.axes[0]),r.translation[1]=f0(n.axes[1]),r.translation[2]=f0(n.buttons[7])-f0(n.buttons[6]),r.heading=f0(n.axes[2]),r.tilt=f0(n.axes[3])):s.deviceType==="spacemouse"&&(r.translation[0]=1.2*f0(n.axes[0]),r.translation[1]=1.2*f0(n.axes[1]),r.translation[2]=2*-f0(n.axes[2]),r.heading=1.2*f0(n.axes[5]),r.tilt=1.2*f0(n.axes[3])),r.tilt*=o,De(r.translation,r.translation,l),r}function Kge(t,e){const i=e;return i.translation[0]=t[1]-t[0],i.translation[1]=t[3]-t[2],i.translation[2]=t[4]-t[5],i.heading=t[7]-t[6],i.tilt=t[8]-t[9],i.zoom=t[10]-t[11],i}function Xq(t){return t.translation[0]===0&&t.translation[1]===0&&t.translation[2]===0&&t.heading===0&&t.tilt===0&&t.zoom===0}let QS=class extends yy{constructor(e){super(e),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new ai,this._headingStart=0,this._constraintOptions={selection:Yn.ALL,interactionType:Ki.NONE,interactionStartCamera:new ai,interactionFactor:0,interactionDirection:null,tiltMode:il.LOOK_AROUND}}handleEventGamepad(e){const i=Jge(e,this.view.navigation.gamepad,this._transformation);(e.action==="end"||Xq(i))&&this.finishController()}activateDirection(e){this._keysButtonState[e]=1,Kge(this._keysButtonState,this._transformation)}deactivateDirection(e){this._keysButtonState[e]=0;const i=Kge(this._keysButtonState,this._transformation);Xq(i)&&this.finishController()}onControllerStart(e){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(e)}_updateFilteredSurfaceElevation(e){const i=this.view.pointsOfInterest.cameraOnSurface.location.z,r=1;this._filteredSurfaceElevation+=r*(i-this._filteredSurfaceElevation)*e}stepController(e,i){var r;this._updateStartHeading(),this._updateFilteredSurfaceElevation(e),this.currentCamera.copyViewFrom(i),this._updateCameraCenter(),(r=this._constraintOptions.interactionStartCamera)==null||r.copyFrom(this.currentCamera),this._calculateControlTransformation(e,this.currentCamera,Rx),this._applyDisabledMovementTypes(Rx),this._applyPan(Rx.pan),this._applyRotate(Rx.rotate),this._applyZoom(Rx.zoom),this._applyAscend(Rx.ascend),this._constraintOptions.interactionType=Ki.NONE,this._constraintOptions.selection=Yn.COLLISION,wo(this.view,this.currentCamera,this._constraintOptions),super.stepController(e,i)}_updateStartHeading(){this._transformation.heading!==0&&(this._headingStart=this.view.camera.heading)}_applyRotate(e){if(!e.enabled)return;const i=this.currentCamera;je(mu,i.center,i.eye),bt(mu,mu,e.matrix),i.center=Be(mu,mu,i.eye),i.up=bt(mu,i.up,e.matrix),this._constraintOptions.interactionType=Ki.LOOK_AROUND,this._constraintOptions.selection=Yn.ALL_EXCEPT_COLLISION,wo(this.view,i,this._constraintOptions)}_applyPan(e,i=this.currentCamera){e.enabled&&(i.eye=bt(mu,i.eye,e.matrix),i.center=bt(mu,i.center,e.matrix),this.view.state.isGlobal&&(i.up=bt(mu,i.up,e.matrix)),this._constraintOptions.interactionType=Ki.PAN,this._constraintOptions.selection=Yn.ALL,wo(this.view,i,this._constraintOptions))}_applyZoom(e){if(!e)return;const i=this.currentCamera.viewForward;this.currentCamera.eye=Be(mu,this.currentCamera.eye,De(xt.get(),i,e)),Ne(uR,i),Sc(uR,uR),this._constraintOptions.interactionDirection=uR,this._constraintOptions.interactionType=Ki.ZOOM,this._constraintOptions.selection=Yn.ALL_EXCEPT_COLLISION,wo(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(e){if(!e)return;const i=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,xt.get());if(this._constraintOptions.interactionDirection=Ne(uR,i),this.view.state.isGlobal){const r=rt(this.currentCamera.eye),n=(r+e)/r;this.currentCamera.eye=De(mu,this.currentCamera.eye,n),this.currentCamera.center=De(mu,this.currentCamera.center,n)}else{const r=De(xt.get(),i,e);this.currentCamera.eye=Be(mu,this.currentCamera.eye,r),this.currentCamera.center=Be(mu,this.currentCamera.center,r)}this._updateCameraCenter(),this._constraintOptions.interactionType=Ki.ASCEND,this._constraintOptions.selection=Yn.COLLISION,wo(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=Yn.ALL_EXCEPT_COLLISION,wo(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(e,i,r){Fwt(r);const n=this._computeVelocities(e);this.view.state.isLocal?this._calculateControlTransformationLocal(n,i,r):this._calculateControlTransformationGlobal(n,i,r)}_updateCameraCenter(){const e=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,i=this.view.renderCoordsHelper,r=this.currentCamera.ray;this.currentCamera.center=i.intersectManifoldClosestSilhouette(r,e,mu)}_calculateControlTransformationLocal(e,i,r){const{viewRight:n,viewForward:s}=i,o=this._transformation,l=this.view.navigation.gamepad,c=Ie(xt.get(),s[0],s[1],0);Ye(c,c);const f=o.translation[0]*e.pan;if(f!==0){const I=De(xt.get(),n,f);Qu(r.pan.matrix,r.pan.matrix,I),r.pan.enabled=!0}switch(l.mode){case"pan":{const I=-o.translation[1]*e.pan;if(I!==0){const L=De(xt.get(),c,I);Qu(r.pan.matrix,r.pan.matrix,L),r.pan.enabled=!0}r.zoom=o.zoom*e.zoom;break}case"zoom":r.zoom=(-o.translation[1]+o.zoom)*e.zoom;break;default:l.mode}const _=o.translation[2]*e.ascend;r.ascend=_;const x=-o.heading*e.rotate;x!==0&&(Wh(r.rotate.matrix,r.rotate.matrix,x,this.view.renderCoordsHelper.worldUpAtPosition(i.eye,xt.get())),r.rotate.enabled=!0);const T=o.tilt*e.rotate,A=q2(this.view.renderCoordsHelper,i.center,i.eye),M=Je(A+T,Bl.min,Bl.max)-A;M&&(Wh(r.rotate.matrix,r.rotate.matrix,M,n),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(e,i,r){const{eye:n,viewRight:s}=i,o=this._transformation,l=this.view.navigation.gamepad,c=Wt(xt.get(),s,n);Ye(c,c),Sc(c,c),Gbt(this.startCamera,i,o,e,this.view.camera.heading,this._headingStart,this.view.camera.tilt,r,l),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(Rx.pan,this._tmpCamera);const f=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,_=o.translation[2]*e.ascend;r.ascend=_;const x=-o.heading*e.rotate;x!==0&&(Wh(r.rotate.matrix,r.rotate.matrix,x,this._tmpCamera.eye),r.rotate.enabled=!0);const T=o.tilt*e.rotate,A=this._clampTiltDeltaGlobalToValidRange(T,i.ray,f);A!==0&&(Wh(r.rotate.matrix,r.rotate.matrix,A,this._tmpCamera.viewRight),r.rotate.enabled=!0),r.zoom+=o.zoom*e.zoom}_clampTiltDeltaGlobalToValidRange(e,i,r){const n=Sr(this.view.spatialReference),s=YF(Bl.min,i.origin,r,n);let o=0,l=0;const c=xt.get();if(this.view.renderCoordsHelper.intersectManifold(i,r,c)){const f=q2(this.view.renderCoordsHelper,c,i.origin);o=YF(f,i.origin,r,n),l=YF(Bl.max,i.origin,r,n)}else{gP(aj(cj,r+n.radius),i,c);const f=Math.PI+oj(i.direction,c);o=Lge(f,i.origin,r,n),l=Lge(Bl.max,i.origin,r,n)}return Je(o+e,s,l)-o}_getPointAbsoluteSurfaceElevation(e,i,r){const{renderCoordsHelper:n}=this.view,s=n.getAltitude(e),o=i+Math.abs(s-i);return n.setAltitude(r,o,e),o}_clampedDistanceToSurface(e,i){const{renderCoordsHelper:r}=this.view,{camera:n}=this.view.state,{direction:s}=$0t(this.view,i,0,b9e,Nwt),o=r.intersectManifoldClosestSilhouette(Sp(i,s),e,xt.get()),l=Sn(i,o),c=r.intersectManifoldClosestSilhouette(Sp(i,R_(xt.get(),i,n.center)),e,xt.get()),f=Sn(i,c);return Math.min(l,f)}_computeHeadingRotateRadius(e){const{renderCoordsHelper:i,state:r}=this.view,{camera:n,isGlobal:s}=r,o=i.intersectManifoldClosestSilhouette(n.ray,this._filteredSurfaceElevation,xt.get());if(s){const l=je(xt.get(),e,o),c=rt(l);De(l,l,1/c);const f=Ye(xt.get(),e),_=Ca(Ve(f,l));return c*Math.sin(Math.min(Iwt,_))}{const l=Ne(xt.get(),e);return i.setAltitude(l,this._filteredSurfaceElevation),Sn(o,l)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:$wt}_computeVelocities(e){const i=this._filteredSurfaceElevation,r=i+Sr(this.view.spatialReference).radius,{camera:n,isGlobal:s}=this.view.state,o=xt.get(),l=this._getPointAbsoluteSurfaceElevation(n.eye,i,o),c=this._clampedDistanceToSurface(i,o),f=n.width/2,_=Qge*n.width,x=Qge*n.width,T=c*Math.tan(.5*n.fovX)/f,A=T/r,M=T/this._computeHeadingRotateRadius(o),I=l-i;return{pan:(s?A:T)*_*e,ascend:Math.max(this._minimumAscendVelocity()*e,2**(_*e/f)*I-I),zoom:2**(_*e/f)*c-c,rotate:Je(M*x,Lwt,Dwt)*e}}_applyDisabledMovementTypes(e){this.disableMovements==null||this.disableMovements.mode!==void 0&&this.view.state.viewingMode!==this.disableMovements.mode||(e.zoom=this.disableMovements.zoom?0:e.zoom,e.ascend=this.disableMovements.ascend?0:e.ascend,e.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&Hf(e.pan.matrix),e.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&Hf(e.rotate.matrix))}static activatesFor(e,i){const r=Jge(i,e.navigation.gamepad,Rwt);return!(i.action==="end"||Xq(r))}};y([w({constructOnly:!0})],QS.prototype,"gamepadDevice",void 0),y([w({constructOnly:!0})],QS.prototype,"disableMovements",void 0),QS=y([Z("esri.views.3d.state.controllers.GamepadKeyboardController")],QS);const Rwt={translation:[0,0,0],heading:0,tilt:0,zoom:0},b9e=80,Iwt=Ei(b9e),Qge=.75,$wt=5,Lwt=Ei(30),Dwt=Ei(80),Rx={zoom:0,ascend:0,pan:{enabled:!1,matrix:Qe()},rotate:{enabled:!1,matrix:Qe()}},mu=W(),uR=W(),Nwt=rae();function Fwt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,Hf(t.pan.matrix),t.rotate.enabled=!1,Hf(t.rotate.matrix)}let kwt=class extends Rl{constructor(e){super(!0),this._view=e,this._watchHandles=new O_,this._handle=this.registerIncoming("gamepad",i=>this._handleEventGamepad(i)),this._handle.pause()}onInstall(e){super.onInstall(e),this._watchHandles.add([_e(()=>this._view.navigation.gamepad.enabled,i=>{i?this._handle.resume():(this._handle.pause(),this._cameraControllerGamepad&&(this._cameraControllerGamepad.finishController(),this._cameraControllerGamepad=null))},ii),_e(()=>this._view.navigation.gamepad.device,i=>{this._cameraControllerGamepad&&i&&this._cameraControllerGamepad.gamepadDevice!==i&&(this._cameraControllerGamepad.finishController(),this._cameraControllerGamepad=null)})])}onUninstall(){this._watchHandles.removeAll(),super.onUninstall()}_handleEventGamepad(e){const i=this._view.navigation.gamepad.device;if(i&&e.data.device!==i)return;const r=this._cameraControllerGamepad&&this._cameraControllerGamepad.active;if(r||QS.activatesFor(this._view,e.data)){if(!r){const n=new QS({view:this._view,gamepadDevice:e.data.device});this._view.state.switchCameraController(n)&&(this._cameraControllerGamepad=n)}this._cameraControllerGamepad&&this._cameraControllerGamepad.active&&this._cameraControllerGamepad.gamepadDevice===e.data.device&&this._cameraControllerGamepad.handleEventGamepad(e.data)}}};function zwt(t){const e=()=>t(document.visibilityState==="visible");return document.addEventListener("visibilitychange",e),{remove:()=>document.addEventListener("visibilitychange",e)}}var Ch;(function(t){t[t.LEFT=0]="LEFT",t[t.RIGHT=1]="RIGHT",t[t.FORWARD=2]="FORWARD",t[t.BACKWARD=3]="BACKWARD",t[t.UP=4]="UP",t[t.DOWN=5]="DOWN",t[t.HEADINGLEFT=6]="HEADINGLEFT",t[t.HEADINGRIGHT=7]="HEADINGRIGHT",t[t.TILTUP=8]="TILTUP",t[t.TILTDOWN=9]="TILTDOWN",t[t.ZOOMIN=10]="ZOOMIN",t[t.ZOOMOUT=11]="ZOOMOUT"})(Ch||(Ch={}));let Uwt=class extends Rl{constructor(e,i){super(!0),this._view=e,this._disableMovements={pan:!0,zoom:!1,ascend:!0,rotate:!1,mode:_t.Local},this._keyToNumber={[i.left]:Ch.LEFT,[i.right]:Ch.RIGHT,[i.forward]:Ch.FORWARD,[i.backward]:Ch.BACKWARD,[i.up]:Ch.UP,[i.down]:Ch.DOWN,[i.headingLeft]:Ch.HEADINGLEFT,[i.headingRight]:Ch.HEADINGRIGHT,[i.tiltUp]:Ch.TILTUP,[i.tiltDown]:Ch.TILTDOWN,[i.zoomIn]:Ch.ZOOMIN,[i.zoomOut]:Ch.ZOOMOUT},this.registerIncoming("key-down",null,r=>this._handleKeyDown(r)),this.registerIncoming("key-up",null,r=>this._handleKeyUp(r)),this.registerIncoming("blur",null,()=>this._handleStop()),this._visibilityHandle=zwt(r=>r?null:this._handleStop())}onUninstall(){var e;(e=this._visibilityHandle)==null||e.remove(),this._handleStop()}_handleKeyDown(e){if(e.data.native.ctrlKey||e.data.native.metaKey)return;const i=this._keyToNumber[e.data.key];i!=null&&(this._cameraControllerKeyboard&&this._cameraControllerKeyboard.active||(this._cameraControllerKeyboard=new QS({view:this._view,disableMovements:this._disableMovements}),this._view.state.switchCameraController(this._cameraControllerKeyboard)),this._cameraControllerKeyboard.active&&(this._cameraControllerKeyboard.activateDirection(i),e.stopPropagation()))}_handleStop(){var e;(e=this._cameraControllerKeyboard)!=null&&e.active&&(this._cameraControllerKeyboard.finishController(),this._cameraControllerKeyboard=null)}_handleKeyUp(e){if(e.data.native.ctrlKey||e.data.native.metaKey)return;const i=this._keyToNumber[e.data.key];i!=null&&this._cameraControllerKeyboard&&this._cameraControllerKeyboard.active&&(this._cameraControllerKeyboard.deactivateDirection(i),e.stopPropagation())}},Vwt=class extends Rl{constructor(e,i){super(!0),this._view=e,this.registerIncoming("mouse-wheel",i,r=>this._handleMouseWheel(r))}_handleMouseWheel(e){if(!this._view.navigation.mouseWheelZoomEnabled)return;const i=e.data;this._cameraController&&this._cameraController.active||(this._cameraController=this._view.state.isGlobal?new $U({view:this._view,mode:"interaction"}):new LU({view:this._view,mode:"interaction"}),this._view.state.switchCameraController(this._cameraController)),this._cameraController.zoomStep(-1/60*i.deltaY,ss(i.x,i.y)),e.preventDefault(),e.stopPropagation()}},FU=class{constructor(e){this._gain=e}reset(e){this._value=e}set gain(e){this._gain=e}get value(){return this._value===void 0?0:this._value}update(e){this._value===void 0?this._value=e:this._value=this._gain*e+(1-this._gain)*this._value}},ZT=class extends $L{constructor(){super(...arguments),this._beginCamera=new ai,this._elapsedTimeSec=0,this.constraintOptions={selection:Yn.ALL,interactionType:Ki.PAN,interactionFactor:0,interactionStartCamera:new ai,interactionDirection:null,tiltMode:il.TUMBLE}}initialize(){this.constraintOptions.interactionType=this.interactionType,this.viewAnimation=new b5}get steppingFinished(){return this.momentum.isFinished(this._elapsedTimeSec)}onControllerStart(e){this._beginCamera.copyFrom(e),this.constraintOptions.interactionStartCamera=this._beginCamera,super.onControllerStart(e)}stepController(e,i){i.copyViewFrom(this._beginCamera),this._elapsedTimeSec+=e,this.momentumStep(this._elapsedTimeSec,i),wo(this.view,i,this.constraintOptions)}};ZT=y([Z("esri.views.3d.state.controllers.momentum.MomentumController")],ZT);let y$=class extends ZT{constructor(e){super(e),this.interactionType=Ki.PAN,this._tmpPan=W()}momentumStep(e,i){const r=this.momentum.value(e);De(this._tmpPan,this.momentum.direction,r),i.eye=je(eye,i.eye,this._tmpPan),i.center=je(eye,i.center,this._tmpPan),this.constraintOptions.interactionDirection=this._tmpPan}};y([w({constructOnly:!0})],y$.prototype,"momentum",void 0),y$=y([Z("esri.views.3d.state.controllers.momentum.PanPlanarMomentumController")],y$);const eye=W(),Bwt=W(),bN=W();let KF=class extends ZT{constructor(e){super(e),this.interactionType=Ki.PAN}momentumStep(e,i){const r=this.momentum.value1(e),n=this.momentum.value2(e);Ne(bN,i.eye),Ye(bN,bN),Wt(this.momentum.axis2,bN,this.momentum.axis1),a9e(i,Bwt,this.momentum.axis1,r,this.momentum.axis2,n)}};y([w({constructOnly:!0})],KF.prototype,"momentum",void 0),KF=y([Z("esri.views.3d.state.controllers.momentum.PanSphericalMomentumController")],KF);let $S=class extends ZT{set center(e){this._set("center",Xr(e))}set axis(e){this._set("axis",Xr(e))}constructor(e){super(e),this.interactionType=Ki.TUMBLE}momentumStep(e,i){const r=this.momentum.value(e);W2(i,this.center,LL(this.axis,r))}};y([w({constructOnly:!0})],$S.prototype,"momentum",void 0),y([w({constructOnly:!0})],$S.prototype,"center",null),y([w({constructOnly:!0})],$S.prototype,"axis",null),$S=y([Z("esri.views.3d.state.controllers.momentum.MomentumController")],$S);let NM=class extends ZT{set zoomCenter(e){this._set("zoomCenter",Xr(e))}constructor(e){super(e),this.interactionType=Ki.ZOOM,this.constraintOptions.interactionDirection=W()}momentumStep(e,i){const{interactionDirection:r}=this.constraintOptions;if(!r)return;Ne(r,i.eye);const n=this.momentum.valueDelta(0,e);rle(i,this.zoomCenter,n,this.view.state.constraints.minimumPoiDistance),R_(r,i.eye,r)}};y([w({constructOnly:!0})],NM.prototype,"momentum",void 0),y([w({constructOnly:!0})],NM.prototype,"zoomCenter",null),NM=y([Z("esri.views.3d.state.controllers.momentum.ZoomPlanarMomentumController")],NM);let J3=class extends ZT{set screenCenter(e){this._set("screenCenter",ss(e[0],e[1]))}set sceneCenter(e){this._set("sceneCenter",Xr(e))}constructor(e){super(e),this.interactionType=Ki.ZOOM,this.radius=0,this._tmpSceneCenter=W(),this._tmpZoomAxisAngle=Gj(),this._sphere=co()}initialize(){this._sphere[3]=this.radius}momentumStep(e,i){const r=this.momentum.valueDelta(0,e);t9e(this._sphere,i,r),this.constraintOptions.interactionType=Ki.ZOOM,wo(this.view,i,this.constraintOptions),DL(this._sphere,i,this.screenCenter,this._tmpSceneCenter),Qae(this.sceneCenter,this._tmpSceneCenter,this._tmpZoomAxisAngle),W2(i,this._sphere,this._tmpZoomAxisAngle),this.constraintOptions.interactionType=Ki.PAN}};y([w({constructOnly:!0})],J3.prototype,"momentum",void 0),y([w({constructOnly:!0})],J3.prototype,"screenCenter",null),y([w({constructOnly:!0})],J3.prototype,"sceneCenter",null),y([w({constructOnly:!0})],J3.prototype,"radius",void 0),J3=y([Z("esri.views.3d.state.controllers.momentum.ZoomSphericalMomentumController")],J3);let hm=class{constructor(e){this._gain=e,this.lastValue=void 0,this.filteredDelta=void 0}update(e){if(this.hasLastValue()){const i=this.computeDelta(e);this._updateDelta(i)}this.lastValue=e}reset(){this.lastValue=void 0,this.filteredDelta=void 0}hasLastValue(){return this.lastValue!==void 0}hasFilteredDelta(){return this.filteredDelta!==void 0}computeDelta(e){return this.lastValue===void 0?NaN:e-this.lastValue}_updateDelta(e){this.filteredDelta!==void 0?this.filteredDelta=(1-this._gain)*this.filteredDelta+this._gain*e:this.filteredDelta=e}},Yj=class{constructor(e,i,r){this._initialVelocity=e,this._stopVelocity=i,this._friction=r,this._duration=Math.abs(Math.log(Math.abs(this._initialVelocity)/this._stopVelocity)/Math.log(1-this._friction))}get duration(){return this._duration}isFinished(e){return e>this.duration}get friction(){return this._friction}value(e){return this.valueFromInitialVelocity(this._initialVelocity,e)}valueDelta(e,i){const r=this.value(e);return this.value(e+i)-r}valueFromInitialVelocity(e,i){i=Math.min(i,this.duration);const r=1-this.friction;return e*(r**i-1)/Math.log(r)}},jwt=class extends Yj{constructor(e,i,r,n,s){super(e,i,r),this._sceneVelocity=n,this.direction=s}value(e){return super.valueFromInitialVelocity(this._sceneVelocity,e)}},w9e=class{constructor(e=300,i=12,r=.84){this._minimumInitialVelocity=e,this._stopVelocity=i,this._friction=r,this.enabled=!0,this._time=new hm(.6),this._screen=[new hm(.4),new hm(.4)],this._scene=[new hm(.6),new hm(.6),new hm(.6)],this._tmpDirection=W()}add(e,i,r){if(this.enabled){if(this._time.hasLastValue()&&this._time.computeDelta(r)<.015)return;this._screen[0].update(e[0]),this._screen[1].update(e[1]),this._scene[0].update(i[0]),this._scene[1].update(i[1]),this._scene[2].update(i[2]),this._time.update(r)}}reset(){this._screen[0].reset(),this._screen[1].reset(),this._scene[0].reset(),this._scene[1].reset(),this._scene[2].reset(),this._time.reset()}evaluateMomentum(){if(!this.enabled||!this._screen[0].hasFilteredDelta()||!this._time.hasFilteredDelta())return null;const e=this._screen[0].filteredDelta,i=this._screen[1].filteredDelta,r=e==null||i==null?0:Math.sqrt(e*e+i*i),n=this._time.filteredDelta,s=n==null||r==null?0:r/n;return Math.abs(s)0&&De(this._tmpDirection,this._tmpDirection,1/n);const s=this._time.filteredDelta;return new jwt(e,i,r,s==null?0:n/s,this._tmpDirection)}},tye=class{constructor(e){this._gain=e}update(e){this.filteredValue!==void 0?this.filteredValue=(1-this._gain)*this.filteredValue+this._gain*e:this.filteredValue=e}reset(){this.filteredValue=void 0}get hasFilteredValue(){return this.filteredValue!==void 0}};const iye=1e-5;let Gwt=class extends Yj{constructor(e,i,r,n,s,o=0,l){super(e,i,r),this._angularVelocity1=n,this.axis1=s,this.angularVelocity2=o,this.axis2=l}value1(e){return super.valueFromInitialVelocity(this._angularVelocity1,e)}value2(e){return super.valueFromInitialVelocity(this.angularVelocity2,e)}},Hwt=class{constructor(e=300,i=12,r=.84){this._minimumInitialVelocity=e,this._stopVelocity=i,this._friction=r,this.enabled=!0,this._tmpAxis1=W(),this._tmpAxis2=W(),this._tmpAngles=yt(),this._time=new hm(.3),this._screen=[new hm(.4),new hm(.4)],this._angle1=new tye(.6),this._angle2=new tye(.6),this._axis1=W(),this._axis2=W(),this._lastScene=W()}addMomentumDirectRotation(e,i,r,n,s,o){if(this.enabled){if(this._time.hasLastValue()){if(this._time.computeDelta(r)<.01)return;let l=s9e(this._lastScene,i,this._tmpAxis2,n,s,o);this._angle2.update(0),El(this._tmpAxis2)Math.PI;)n-=2*Math.PI;for(;n<-Math.PI;)n+=2*Math.PI;e=r+n}super.add(e,i)}},qwt=class extends Yj{constructor(e,i,r){super(e,i,r)}value(e){const i=super.value(e);return Math.exp(i)}valueDelta(e,i){const r=super.value(e),n=super.value(e+i)-r;return Math.exp(n)}},T9e=class extends x9e{constructor(e=2.5,i=.01,r=.95,n=12){super(e,i,r,n)}add(e,i){super.add(Math.log(e),i)}createMomentum(e,i,r){return new qwt(e,i,r)}},Yte=class extends yy{constructor(){super(...arguments),this._smoothRotation=new FU(.05),this._rotationAxis=W(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=Fi(),this._beginRadius=0,this._smoothScaling=new FU(.05),this._zoomCenterScreen=ss(),this._zoomMomentumEstimator=new T9e,this._rotationMomentumEstimator=new S9e,this._panSphericalMomentumEstimator=new Hwt,this._panPlanarMomentumEstimator=new w9e,this._adjustedSphere=co(),this._tmp3d=W(),this._tmpScreenPointArray=ss(),this._beginScreenPoint=ss(),this._beginScenePoint=W(),this._screenPickPoint=ss(),this._scenePickPoint=W(),this._mode=Xa.Horizontal,this._sphere=co(),this._pointerCount=0,this._tmpInteractionDirection=W(),this._constraintOptions={selection:Yn.ALL,interactionType:Ki.NONE,interactionFactor:0,interactionStartCamera:new ai,interactionDirection:null,tiltMode:il.TUMBLE}}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(e){var s;if(!this.active)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panPlanarMomentumEstimator.enabled=i,this._panSphericalMomentumEstimator.enabled=i,this._beginHeading=-k2.normalize(Ei(this.view.camera.heading)),this._beginRadius=e.radius,this._pointerCount=e.pointers.size,this._beginAngle=e.angle,this._smoothRotation.reset(),dm(e.center,this._screenPickPoint),Qo(this._beginScreenPoint,this._screenPickPoint);const r=Sr(this.view.spatialReference),n=r9e(this._intersectionHelper,this.startCamera,this._screenPickPoint,r,E5.Silhouette,this.view.map.ground.opacity===0?AE:{});n.scenePickPoint!=null&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,Ne(this._beginScenePoint,this._scenePickPoint),this._mode=qj(this.startCamera,this._screenPickPoint,r),this._mode===Xa.Vertical&&this._preparePlanarPanMode(e,n.hasGeometryIntersection),(s=this._constraintOptions.interactionStartCamera)==null||s.copyFrom(this.startCamera))}update(e){if(!this.active)return;this.currentCamera.copyFrom(this.startCamera);const i=e.pointers.size>1;this._mode===Xa.Horizontal?(i&&this._zoomSpherical(e),this._panningSpherical(e),i&&this._rotateSpherical(e)):(i&&this._zoomPlanar(e),this._panningPlanar(e),i&&this._rotatePlanar(e)),this.commitCamera()}end(e){e.pointers.size===this._pointerCount&&this.update(e),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return this._mode===Xa.Horizontal?new J3({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere[3]}):new NM({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const r=this._rotationMomentumEstimator.evaluateMomentum();if(r)return new $S({view:this.view,momentum:r,center:this._sphere,axis:this._rotationAxis});if(this._mode===Xa.Horizontal){const n=this._panSphericalMomentumEstimator.evaluateMomentum();if(n)return new KF({view:this.view,momentum:n})}else{const n=this._panPlanarMomentumEstimator.evaluateMomentum();if(n)return new y$({view:this.view,momentum:n})}return null}_preparePlanarPanMode(e,i){const r=Sc(this._tmp3d,this.startCamera.viewForward);z_(this._scenePickPoint,r,this._panningPlane);const n=ss(this._screenPickPoint[0],0),s=W(),o=rt(this.startCamera.eye);this._adjustedSphere[3]=o=Wwt.ANGLE_THRESHOLD?Xa.Horizontal:Xa.Vertical;const f=Math.min(QLe,1/Math.abs(Ve(o,this.startCamera.viewForward)))*Math.max(Math.abs(this.view.camera.position.z),e9e);xQ(this._planeHorizontal,this._planeHorizontal,r),this.startCamera.aboveGround||SQ(this._planeHorizontal,this._planeHorizontal);const _=W(),x=W(),T=W();je(_,r,this.currentCamera.eye);const A=rt(_);if(Ye(_,_),this._panMode===Xa.Vertical){De(o,o,l),je(this._planeVertical,s,o),Ye(this._planeVertical,this._planeVertical),xQ(this._planeVertical,this._planeVertical,r);const I=this.view._stage.renderView.getMinimalDepthForArea(NL(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,Hj);let L=I??f;L=n?Math.min(L,A):L,Ne(T,Be(x,this.currentCamera.eye,De(x,_,L))),this._planeVertical[3]=-Ve(this._planeVertical,T),this._computePlanePoints(e.pointers,this._planeVertical,this.startCamera,this._tmpPoints),kq(this._tmpPoints,this._beginCenter)}else{const I=n?A:f;Ne(T,Be(x,this.currentCamera.eye,De(x,_,I))),this._planeHorizontal[3]=-Ve(this._planeHorizontal,T),this._computePlanePoints(e.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),kq(this._tmpPoints,this._beginCenter)}(M=this._constraintOptions.interactionStartCamera)==null||M.copyFrom(this.startCamera)}update(e){if(!this.active)return;this.currentCamera.copyFrom(this.startCamera);const i=e.pointers.size>1,r=this._panMode===Xa.Horizontal?this._planeHorizontal:this._planeVertical,n=this._beginCenter;if(i){const s=this._beginRadius/e.radius,o=.001875*Math.min(Math.max(e.radius,40),120);this._scalingValueSmooth.gain=o,this._scalingValueSmooth.update(s),rle(this.currentCamera,n,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*e.timestamp),this._constraintOptions.interactionType=Ki.ZOOM,this._constraintOptions.interactionFactor=um(Math.abs(e.radius-this._beginRadius)),wo(this.view,this.currentCamera,this._constraintOptions)}if(this._computePlanePoints(e.pointers,r,this.currentCamera,this._tmpPoints),kq(this._tmpPoints,this._tmpCentroid3d),dm(e.center,this._tmpCentroid2d),n9e(this.currentCamera,n,this._tmpCentroid3d),this._panMomentumEstimator.add(this._tmpCentroid2d,this._tmpCentroid3d,.001*e.timestamp),this._constraintOptions.interactionType=Ki.PAN,this._constraintOptions.interactionFactor=um(Dm(this._beginCenterScreen,this._tmpCentroid2d)),wo(this.view,this.currentCamera,this._constraintOptions),i){const s=this._planeHorizontal,o=n,l=this._rotationValueSmooth.value,c=l+jte(e.angle-l),f=.00125*Math.min(Math.max(e.radius,40),120);this._rotationValueSmooth.gain=f,this._rotationValueSmooth.update(c);const _=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(_,.001*e.timestamp),W2(this.currentCamera,o,LL(s,_)),this._constraintOptions.interactionType=Ki.TUMBLE,this._constraintOptions.interactionFactor=um(Math.abs(e.radius*_)),wo(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(e){e.pointers.size===this._pointerCount&&this.update(e),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return new NM({view:this.view,momentum:i,zoomCenter:this._beginCenter});const r=this._rotationMomentumEstimator.evaluateMomentum();if(r)return new $S({view:this.view,momentum:r,center:this._beginCenter,axis:this._planeHorizontal});const n=this._panMomentumEstimator.evaluateMomentum();return n?new y$({view:this.view,momentum:n}):null}_computePlanePoints(e,i,r,n){n.length=e.size;const s=this._tmp2d;let o=0;return e.forEach(l=>{s[0]=l.x,s[1]=l.y,n[o]===void 0&&(n[o]=W()),Gte(i,r,s,n[o]),o+=1}),n}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};Xte=y([Z("esri.views.3d.state.controllers.local.PinchAndPanController")],Xte);let nye=class extends Rl{constructor(e,i,r){super(!0),this._view=e,this.pointerAction=i,this._lastEndTimestamp=0,this._lastTimestamp=0,this.registerIncoming("drag",r,n=>this._handleDrag(n))}_handleDrag(e){if(e.data.pointerType==="mouse"&&!ole(e.data,this.pointerAction))return;const i=e.timestamp-this._lastEndTimestamp,r=40,n=this._momentum&&this._momentum.active&&i2&&(this._controller.update(e.data),this._lastTimestamp=e.timestamp):this._startController(e);break;case"end":case"removed":this._endController(e,!0);break;case"added":this._endController(e,!1),this._startController(e)}e.stopPropagation()}_endController(e,i){if(this._controller&&this._controller.active){this._lastEndTimestamp=e.timestamp;const r=this._controller.end(e.data);i&&r&&(this._momentum=r,this._view.state.switchCameraController(this._momentum))}this._controller=null}_startController(e){this._controller=this._createController(),this._view.state.switchCameraController(this._controller),this._controller.begin(e.data),this._lastTimestamp=e.timestamp}_createController(){return this._view.state.isGlobal?new Yte({view:this._view}):new Xte({view:this._view})}},Ywt=class extends Rl{constructor(e,i){super(!0),this.view=e,this.registerIncoming("pointer-down",i,()=>this.view.state.stopActiveCameraController())}},E9e=class extends Rl{constructor(e,i){super(!0),this.key=e,this.registerIncoming("key-down",i,r=>this._handleKeyDown(r))}_handleKeyDown(e){e.data.key===this.key&&(this.activate(),e.stopPropagation())}},Xwt=class extends E9e{constructor(e,i,r){super(i,r),this.view=e}activate(){this.view.goTo({heading:0}).catch(()=>{})}},Zwt=class extends E9e{constructor(e,i,r){super(i,r),this.view=e}activate(){this.view.goTo({tilt:0}).catch(()=>{})}},Jwt=class extends Rl{constructor(e,i=!1){super(!0),this._view=e,this._invert=i,this.registerIncoming("vertical-two-finger-drag",r=>this._handleTwoFinger(r))}_handleTwoFinger(e){var n,s,o;const i=this._invert?-1:1,r=ss(0,e.data.delta*i);switch(e.data.action){case"begin":(n=this._cameraController)==null||n.end(),this._cameraController=new g$({view:this._view,pivot:Dh.CENTER}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(r);break;case"update":(s=this._cameraController)==null||s.update(r);break;case"end":(o=this._cameraController)==null||o.end(),this._cameraController=null}}};function sye(t){const e=t.native;return e?{buttons:e.buttons.map(i=>i.pressed?i.value||1:0),axes:e.axes.map(i=>e2t(i,t.axisThreshold))}:{buttons:[],axes:[]}}function Kwt(t,e){if(t.axes.length!==e.axes.length||t.buttons.length!==e.buttons.length)return!1;for(let i=0;i{this._connectGamepad(s.gamepad)},this._onDisconnectGamepad=s=>{const o=s.gamepad,l=o.index,c=this._inputDevices[l];c&&(this._emitGamepadEvent(o,sye(c),!1),this._inputDevices.splice(l,1),this._latestUpdate.splice(l,1),this._input.gamepad.devices.remove(c),this.ensurePollingState())},this._frameTask=null,this._latestUpdate=new Array,this._inputDevices=new Array,this._callback=null;const r="getGamepads"in window.navigator,n=window.isSecureContext;this.supported=r&&n,this.supported&&(this._forEachGamepad(s=>this._connectGamepad(s)),window.addEventListener("gamepadconnected",this._onConnectGamepad),window.addEventListener("gamepaddisconnected",this._onDisconnectGamepad),this.ensurePollingState())}destroy(){this.hasEventListeners=!1,this.supported&&(window.removeEventListener("gamepadconnected",this._onConnectGamepad),window.removeEventListener("gamepaddisconnected",this._onDisconnectGamepad))}set hasEventListeners(e){this._hasEventListeners!==e&&(this._hasEventListeners=e,this.ensurePollingState())}get _eventsEnabled(){return this.supported&&this._inputDevices.length>0&&this._hasEventListeners}set onEvent(e){this._callback=e}_connectGamepad(e){const i=new cae(e);i.deviceType!=="unknown"&&(this._inputDevices[e.index]=i,this._input.gamepad.devices.add(i)),this.ensurePollingState()}ensurePollingState(){this._eventsEnabled?this._startPolling():this._stopPolling()}_startPolling(){this._frameTask==null&&(this._frameTask=AT({update:()=>this._readGamepadState()}))}_stopPolling(){this._frameTask!=null&&(this._frameTask.remove(),this._frameTask=null,this._latestUpdate=new Array)}_readGamepadState(){const e=document.hasFocus(),i=this._element.contains(document.activeElement),r=this._input.gamepad.enabledFocusMode==="document"&&!e||this._input.gamepad.enabledFocusMode==="view"&&!i;this._forEachGamepad(n=>{const s=this._inputDevices[n.index];if(!s)return;const o=this._latestUpdate[n.index],l=sye(s),c=r||Qwt(l);o&&(o.timestamp===n.timestamp||!o.active&&c||Kwt(o.state,l))||this._emitGamepadEvent(n,l,!c)})}_forEachGamepad(e){const i=window.navigator.getGamepads();for(let r=0;r{},this._activePointerCaptures=new Set,this._keyDownState=new Set,this._eventId=1,this._browserTouchPanningEnabled=!1,this._element=e,e.getAttribute("tabindex")||e.setAttribute("tabindex","0"),this._eventHandlers={"key-down":this._handleKey,"key-up":this._handleKey,"pointer-down":this._handlePointer,"pointer-move":this._handlePointerPreventDefault,"pointer-up":this._handlePointerPreventDefault,"pointer-enter":this._handlePointer,"pointer-leave":this._handlePointer,"pointer-cancel":this._handlePointer,"mouse-wheel":this._handleMouseWheel,"pointer-capture-lost":this._handlePointerCaptureLost},this._updateTouchAction(),this._element.addEventListener("keydown",this._preventAltKeyDefault),this._gamepadSource=new t2t(e,this._input),this._gamepadSource.onEvent=r=>this._callback("gamepad",r)}destroy(){this._callback=()=>{},this.activeEvents=null,this._activePointerCaptures.forEach(e=>{this._releasePointerCaptureSafe(e)}),this._gamepadSource=et(this._gamepadSource),this._activePointerCaptures=null,this._removeTouchAction(),this._element.removeEventListener("keydown",this._preventAltKeyDefault)}get browserTouchPanningEnabled(){return this._browserTouchPanningEnabled}set browserTouchPanningEnabled(e){this._browserTouchPanningEnabled=e,this._updateTouchAction(),this._updateTouchEventHandling()}set onEventReceived(e){this._callback=e}set activeEvents(e){for(const i in this._active)if(!e||!e.has(i)){const r=this._active[i];this._element.removeEventListener(Zq[i],r),delete this._active[i]}e&&e.forEach(i=>{if(!this._active[i]&&Zq[i]){const r=(this._eventHandlers[i]||this._handleDefault).bind(this,i);this._element.addEventListener(Zq[i],r),this._active[i]=r}}),this._gamepadSource.hasEventListeners=(e==null?void 0:e.has("gamepad"))??!1}setPointerCapture(e,i){i?this._setPointerCatpureSafe(e.pointerId):(this._releasePointerCaptureSafe(e.pointerId),this._activePointerCaptures.delete(e.pointerId))}_updateTouchAction(){this._element.classList.remove(this._browserTouchPanningEnabled?cC.touchNone:cC.touchPan),this._element.classList.add(this._browserTouchPanningEnabled?cC.touchPan:cC.touchNone)}_updateTouchEventHandling(){this._browserTouchPanningEnabled?this._element.addEventListener("touchmove",this._preventMultiTouchPanning):this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_removeTouchAction(){this._element.classList.remove(cC.touchNone),this._element.classList.remove(cC.touchPan),this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_setPointerCatpureSafe(e){try{this._element.setPointerCapture(e),this._activePointerCaptures.add(e)}catch{}}_releasePointerCaptureSafe(e){try{if(this._element.hasPointerCapture&&!this._element.hasPointerCapture(e))return;this._element.releasePointerCapture(e)}catch{}}_updateNormalizedPointerLikeEvent(e,i){const r=xIe(this._element,e);return A9e.test.disableSubpixelCoordinates&&(r.x=Math.round(r.x),r.y=Math.round(r.y)),i.x=r.x,i.y=r.y,i}_handleKey(e,i){const r=rmt(i);r&&e==="key-up"&&this._keyDownState.delete(r);const n={native:i,key:r,repeat:!!r&&this._keyDownState.has(r)};r&&e==="key-down"&&this._keyDownState.add(n.key),this._callback(e,n)}_handlePointer(e,i){const r=this._updateNormalizedPointerLikeEvent(i,{native:i,x:0,y:0,pointerType:i.pointerType,button:i.button,buttons:i.buttons,eventId:this._eventId++});this._callback(e,r)}_handlePointerPreventDefault(e,i){const r=this._updateNormalizedPointerLikeEvent(i,{native:i,x:0,y:0,pointerType:i.pointerType,button:i.button,buttons:i.buttons,eventId:this._eventId++});i.preventDefault(),this._callback(e,r)}_handleMouseWheel(e,i){let r=i.deltaY;switch(i.deltaMode){case 0:oye&&(r=r/document.documentElement.clientHeight*600);break;case 1:r*=30;break;case 2:r*=900}oye?r*=.7:i2t||n2t?r*=.6:r2t&&(r*=1.375);const n=100,s=Math.abs(r);s>n&&(r=r/s*200/(1+Math.exp(-.02*(s-n))));const o=this._updateNormalizedPointerLikeEvent(i,{native:i,x:0,y:0,deltaY:r});this._callback(e,o)}_handlePointerCaptureLost(e,i){this._activePointerCaptures.delete(i.pointerId),this._handleDefault(e,i)}_handleDefault(e,i){const r={native:i};i.preventDefault(),this._callback(e,r)}_preventAltKeyDefault(e){e.key==="Alt"&&e.preventDefault()}_preventMultiTouchPanning(e){e.touches.length>1&&e.preventDefault()}};C9e.test={disableSubpixelCoordinates:!1};const Zq={"key-down":"keydown","key-up":"keyup","pointer-down":"pointerdown","pointer-up":"pointerup","pointer-move":"pointermove","mouse-wheel":"wheel","pointer-capture-got":"gotpointercapture","pointer-capture-lost":"lostpointercapture","context-menu":"contextmenu","pointer-enter":"pointerenter","pointer-leave":"pointerleave","pointer-cancel":"pointercancel",focus:"focus",blur:"blur"};let s2t=class extends Rl{constructor(){super(!0),this.registerIncoming("context-menu",e=>{e.data.native.preventDefault()})}};const sp={maximumClickDelay:300,movementUntilMouseDrag:1.5,movementUntilPenDrag:6,movementUntilTouchDrag:6,holdDelay:500,maximumDoubleClickDelay:250,maximumDoubleClickDistance:10,maximumDoubleTouchDelay:350,maximumDoubleTouchDistance:35};function Zte(t,e){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)}function o2t(t,e){const i=e.x-t.x,r=e.y-t.y;return Math.sqrt(i*i+r*r)}function a2t(t,e){if(e?(e.radius=0,e.center.x=0,e.center.y=0):e={radius:0,center:Ku()},t.length===0)return e;if(t.length===1)return e.center.x=t[0].x,e.center.y=t[0].y,e;if(t.length===2){const[k,U]=t,[j,H]=[U.x-k.x,U.y-k.y];return e.radius=Math.sqrt(j*j+H*H)/2,e.center.x=(k.x+U.x)/2,e.center.y=(k.y+U.y)/2,e}let i=0,r=0;for(let k=0;kk.x-i),s=t.map(k=>k.y-r);let o=0,l=0,c=0,f=0,_=0,x=0,T=0;for(let k=0;k{r.initialAngle=QF(r,i)-e,r.lastAngle=QF(r,i)-e})}_emitEvent(e,i,r){const n=wN(this._activePointerMap);this._drag.emit(this._createPayload(e,i,n,r),void 0,this._startStateModifiers)}_handlePointerUpAndPointerLost(e){const i=e.data.native.pointerId,r=e.timestamp;this._activePointerMap.get(i)&&(this._activePointerMap.size===1?(this._updatePointer(e.data),!this._isCurrentDragSuppressed&&this._emitEvent("end",e.data,r),this._isDragging=!1,this._isCurrentDragSuppressed=!1,this._removePointer(i)):(this._removePointer(i),this._emitEvent("removed",e.data,e.timestamp)))}_handlePointerDrag(e){const i=e.data,r=i.currentEvent,n=e.timestamp;switch(i.action){case"start":case"update":this._isDragging?this._activePointerMap.has(r.native.pointerId)?(this._updatePointer(r),!this._isCurrentDragSuppressed&&this._emitEvent("update",r,n)):(this._addPointer(r),this._emitEvent("added",r,n),this._isCurrentDragSuppressed=this._isSuppressed):(this._updatePointer(r),this._pointerType=e.data.startEvent.pointerType,this._mouseButton=e.data.startEvent.button,this._startStateModifiers=e.modifiers,this._isDragging=!0,this._isCurrentDragSuppressed=this._isSuppressed,!this._isCurrentDragSuppressed&&this._emitEvent("start",r,n))}}get _isSuppressed(){return!!this._navigationTouch&&!this._navigationTouch.browserTouchPanEnabled&&this._pointerType==="touch"&&this._activePointerMap.size===1}};function M9e(t){const e=[];return t.forEach(i=>{e.push(Ku(i.event.x,i.event.y))}),a2t(e)}function wN(t){const e=M9e(t);let i=0;return t.forEach(r=>{let n=QF(r,e),s=n-r.lastAngle;for(;s>Math.PI;)s-=2*Math.PI;for(;s<-Math.PI;)s+=2*Math.PI;n=r.lastAngle+s,r.lastAngle=n;const o=n-r.initialAngle;i+=o}),i/=t.size||1,{angle:i,radius:e.radius,center:e.center}}function c2t(t){const e=new Map;return t.forEach((i,r)=>e.set(r,i.event)),e}function QF(t,e){const i=t.event,r=i.x-e.center.x,n=i.y-e.center.y;return Math.atan2(n,r)}var lye;(function(t){t[t.Left=0]="Left",t[t.Middle=1]="Middle",t[t.Right=2]="Right",t[t.Back=3]="Back",t[t.Forward=4]="Forward",t[t.Undefined=-1]="Undefined"})(lye||(lye={}));let u2t=class extends Rl{constructor(e=sp.maximumDoubleClickDelay,i=sp.maximumDoubleClickDistance,r=sp.maximumDoubleTouchDelay,n=sp.maximumDoubleTouchDistance,s=m9){super(!1),this._maximumDoubleClickDelay=e,this._maximumDoubleClickDistance=i,this._maximumDoubleTouchDelay=r,this._maximumDoubleTouchDistance=n,this._clock=s,this._pointerState=new Map,this._immediateDoubleClick=this.registerOutgoing("immediate-double-click"),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this)),this.registerIncoming("pointer-up",this._handlePointerUp.bind(this))}onUninstall(){this._pointerState.forEach(e=>{e.immediateDoubleClick&&e.immediateDoubleClick.timeoutHandle.remove()}),super.onUninstall()}_handlePointerDown(e){const i=e.data,r=v$(i);if(!this._pointerState.has(r)){const n={downButton:i.native.button,x:i.x,y:i.y,immediateDoubleClick:null};this._pointerState.set(r,n),this.startCapturingPointer(i.native)}}_handlePointerUp(e){const i=e.data,r=v$(i),n=this._pointerState.get(r);if(n&&n.downButton===i.native.button){const s=n.immediateDoubleClick,o=e.data.native.pointerType==="touch"?this._maximumDoubleTouchDistance:this._maximumDoubleClickDistance;s?(s.timeoutHandle.remove(),Zte(s,e.data)>o?this._startImmediateDoubleClick(e,n):(this._immediateDoubleClick.emit(e.data,void 0,s.modifiers),this._removeState(i))):Zte(n,e.data)>o?this._removeState(i):this._startImmediateDoubleClick(e,n)}}_startImmediateDoubleClick(e,i){const r=e.data.native.pointerType==="touch"?this._maximumDoubleTouchDelay:this._maximumDoubleClickDelay;i.immediateDoubleClick={x:e.data.x,y:e.data.y,modifiers:e.modifiers,timeoutHandle:this._clock.setTimeout(()=>this._removeState(e.data),r)}}_removeState(e){const i=v$(e);this._pointerState.delete(i),this.stopCapturingPointer(e.native),this.refreshHasPendingInputs()}},h2t=class extends Rl{constructor(e=sp.maximumClickDelay,i=sp.movementUntilMouseDrag,r=sp.movementUntilPenDrag,n=sp.movementUntilTouchDrag,s=sp.holdDelay,o=m9){super(!1),this._maximumClickDelay=e,this._movementUntilMouseDrag=i,this._movementUntilPenDrag=r,this._movementUntilTouchDrag=n,this._holdDelay=s,this._clock=o,this._pointerState=new Map,this._pointerDrag=this.registerOutgoing("pointer-drag"),this._immediateClick=this.registerOutgoing("immediate-click"),this._pointerHold=this.registerOutgoing("hold"),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this)),this.registerIncoming("pointer-up",l=>{this._handlePointerLoss(l,"pointer-up")}),this.registerIncoming("pointer-capture-lost",l=>{this._handlePointerLoss(l,"pointer-capture-lost")}),this.registerIncoming("pointer-cancel",l=>{this._handlePointerLoss(l,"pointer-cancel")}),this._moveHandle=this.registerIncoming("pointer-move",this._handlePointerMove.bind(this)),this._moveHandle.pause()}onUninstall(){this._pointerState.forEach(e=>{e.holdTimeout=en(e.holdTimeout)}),super.onUninstall()}_handlePointerDown(e){const i=e.data,r=i.native.pointerId;let n=null;this._pointerState.size===0&&(n=this._clock.setTimeout(()=>{const o=this._pointerState.get(r);if(o){if(!o.isDragging){const l=o.previousEvent;this._pointerHold.emit(l,void 0,e.modifiers),o.holdEmitted=!0}o.holdTimeout=null}},this._holdDelay));const s={startEvent:i,previousEvent:i,startTimestamp:e.timestamp,isDragging:!1,downButton:i.native.button,holdTimeout:n,modifiers:new Set};this._pointerState.set(r,s),this.startCapturingPointer(i.native),this._moveHandle.resume(),this._pointerState.size>1&&this._startDragging(e)}_createPointerDragData(e,i,r){return{action:e,startEvent:i.startEvent,previousEvent:i.previousEvent,currentEvent:r}}_handlePointerMove(e){const i=e.data,r=i.native.pointerId,n=this._pointerState.get(r);n&&(n.isDragging?this._pointerDrag.emit(this._createPointerDragData("update",n,i),void 0,n.modifiers):o2t(i,n.startEvent)>this._getDragThreshold(i.native.pointerType)&&this._startDragging(e),n.previousEvent=i)}_getDragThreshold(e){switch(e){case"touch":return this._movementUntilTouchDrag;case"pen":return this._movementUntilPenDrag;default:return this._movementUntilMouseDrag}}_startDragging(e){const i=e.data,r=i.native.pointerId;this._pointerState.forEach(n=>{n.holdTimeout!=null&&(n.holdTimeout.remove(),n.holdTimeout=null),n.isDragging||(n.modifiers=e.modifiers,n.isDragging=!0,r===n.startEvent.native.pointerId?this._pointerDrag.emit(this._createPointerDragData("start",n,i)):this._pointerDrag.emit(this._createPointerDragData("start",n,n.previousEvent),e.timestamp))})}_handlePointerLoss(e,i){const r=e.data,n=r.native.pointerId,s=this._pointerState.get(n);s&&(s.holdTimeout!=null&&(s.holdTimeout.remove(),s.holdTimeout=null),s.isDragging?this._pointerDrag.emit(this._createPointerDragData("end",s,i==="pointer-up"?r:s.previousEvent),void 0,s.modifiers):i==="pointer-up"&&s.downButton===r.native.button&&e.timestamp-s.startTimestamp<=this._maximumClickDelay&&!s.holdEmitted&&this._immediateClick.emit(r),this._pointerState.delete(n),this.stopCapturingPointer(r.native),this._pointerState.size===0&&this._moveHandle.pause())}},d2t=class extends Rl{constructor(e=sp.maximumDoubleClickDelay,i=sp.maximumDoubleClickDistance,r=sp.maximumDoubleTouchDelay,n=sp.maximumDoubleTouchDistance,s=m9){super(!1),this._maximumDoubleClickDelay=e,this._maximumDoubleClickDistance=i,this._maximumDoubleTouchDelay=r,this._maximumDoubleTouchDistance=n,this._clock=s,this._pointerState=new Map,this._click=this.registerOutgoing("click"),this._doubleClick=this.registerOutgoing("double-click"),this.registerIncoming("immediate-click",this._handleImmediateClick.bind(this)),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this))}onUninstall(){this._pointerState.forEach(e=>e.doubleClickTimer=en(e.doubleClickTimer))}get hasPendingInputs(){return rp(this._pointerState,e=>e.doubleClickTimer!=null)}_clearDoubleClickTimer(e,i){const r=this._pointerState.get(e);r&&(r.doubleClickTimer=en(r.doubleClickTimer),i&&this._click.emit(r.event.data,void 0,r.event.modifiers),this._pointerState.delete(e),this.refreshHasPendingInputs())}_doubleClickTimeoutExceeded(e){const i=this._pointerState.get(e);i.pointerDownCount===1&&this._click.emit(i.event.data,void 0,i.event.modifiers),i.doubleClickTimer=null,this._pointerState.delete(e),this.refreshHasPendingInputs()}_getPointerId(e){const{pointerId:i,pointerType:r,button:n}=e.native;return r==="mouse"?`${i}:${n}`:`${r}`}_handleImmediateClick(e){const i=e.data,{pointerType:r}=i.native,n=this._getPointerId(i);if(!this._pointerState.has(n))return void this._startClick(e);const s=this._pointerState.get(n),{data:o,modifiers:l}=s.event,c=r==="touch"?this._maximumDoubleTouchDistance:this._maximumDoubleClickDistance;Zte(o,i)>c?(this._clearDoubleClickTimer(n,!0),this._startClick(e)):(this._clearDoubleClickTimer(n,!1),s.pointerDownCount===2&&this._doubleClick.emit(o,void 0,l))}_handlePointerDown(e){const i=v$(e.data),r=this._pointerState.get(i);r&&(r.pointerDownCount+=1)}_startClick(e){const{data:i}=e,{native:{pointerType:r}}=i,n=v$(i),s=r==="touch"?this._maximumDoubleTouchDelay:this._maximumDoubleClickDelay,o=this._clock.setTimeout(()=>this._doubleClickTimeoutExceeded(n),s),l=1;this._pointerState.set(n,{event:e,doubleClickTimer:o,pointerDownCount:l}),this.refreshHasPendingInputs()}},p2t=class{constructor(e){this._callbacks=e,this._currentCount=0,this._callbacks.condition||(this._callbacks.condition=()=>!0)}handle(e){const i=e.data,r=i.pointers.size;switch(i.action){case"start":this._currentCount=r,this._emitStart(e);break;case"added":this._emitEnd(this._previousEvent),this._currentCount=r,this._emitStart(e);break;case"update":this._emitUpdate(e);break;case"removed":this._startEvent&&this._emitEnd(this._previousEvent),this._currentCount=r,this._emitStart(e);break;case"end":this._emitEnd(e),this._currentCount=0}this._previousEvent=e}_emitStart(e){var i,r;this._startEvent=e,(r=(i=this._callbacks).condition)!=null&&r.call(i,this._currentCount,e)&&this._callbacks.start(this._currentCount,e,this._startEvent)}_emitUpdate(e){var i,r;(r=(i=this._callbacks).condition)!=null&&r.call(i,this._currentCount,e)&&this._callbacks.update(this._currentCount,e,this._startEvent)}_emitEnd(e){var i,r;(r=(i=this._callbacks).condition)!=null&&r.call(i,this._currentCount,e)&&this._callbacks.end(this._currentCount,e,this._startEvent),this._startEvent=null}},f2t=class extends Rl{constructor(e=20,i=40){super(!1),this._threshold=e,this._maxDelta=i,this._state="ready",this._emittedArtificalEnd2=!1,this._vertical=this.registerOutgoing("vertical-two-finger-drag"),this._artificalDrag=this.registerOutgoing("drag"),this._dragEventSeparator=new p2t({start:(r,n)=>this._observeStart(r,n),update:(r,n,s)=>this._observeUpdate(r,n,s),end:(r,n)=>this._observeEnd(n)}),this.registerIncoming("drag",r=>this._dragEventSeparator.handle(r))}get failed(){return this._state==="failed"}_observeStart(e,i){e===1&&this._emittedArtificalEnd2&&(this._emittedArtificalEnd2=!1,this._artificalDrag.emit({action:"start",button:i.data.button,buttons:i.data.buttons,pointerType:i.data.pointerType,timestamp:i.data.timestamp,pointers:i.data.pointers,pointer:i.data.pointer,angle:i.data.angle,radius:i.data.radius,center:i.data.center}),i.stopPropagation()),this._state=e===2?"ready":"failed"}_observeUpdate(e,i,r){if(this._state!=="failed"&&e===2)return this._state==="active"?(this._vertical.emit({delta:i.data.center.y-this._thresholdReachedCenter.y,action:"update"}),void i.stopPropagation()):void(this._checkMovementWithinLimits(i.data,r.data)?this._checkVerticalThresholdReached(i.data,r.data)&&(this._state="active",this._emittedArtificalEnd2=!0,this._thresholdReachedCenter=i.data.center,this._artificalDrag.emit({action:"end",button:i.data.button,buttons:i.data.buttons,pointerType:i.data.pointerType,timestamp:i.data.timestamp,pointers:i.data.pointers,pointer:i.data.pointer,angle:i.data.angle,radius:i.data.radius,center:i.data.center}),this._vertical.emit({delta:i.data.center.y-this._thresholdReachedCenter.y,action:"begin"}),i.stopPropagation()):this._state="failed")}_observeEnd(e){this._state==="active"&&(this._vertical.emit({delta:e.data.center.y-this._thresholdReachedCenter.y,action:"end"}),this._state="ready",e.stopPropagation())}_checkMovementWithinLimits(e,i){let r=-1/0,n=1/0,s=-1/0,o=1/0;for(const{x:I,y:L}of i.pointers.values())r=Math.max(r,I),n=Math.min(n,I),s=Math.max(s,L),o=Math.min(o,L);let l=-1/0,c=1/0,f=-1/0,_=1/0;for(const{x:I,y:L}of e.pointers.values())l=Math.max(l,I),c=Math.min(c,I),f=Math.max(f,L),_=Math.min(_,L);const x=r-n,T=s-o,A=l-c,M=f-_;return Math.abs(e.center.x-i.center.x){const o=i.pointers.get(s);r=Math.min(r,Math.abs(n.y-o.y))}),r>=this._threshold}},F0=class extends ze{destroy(){this.disconnect()}get primaryDragAction(){return this._get("primaryDragAction")}set primaryDragAction(e){e!=="pan"&&e!=="rotate"||e===this._get("primaryDragAction")||(this._set("primaryDragAction",e),this._updateMode())}get mode(){return this._get("mode")}set mode(e){e!=="default"&&e!=="pro"||e===this._get("mode")||(this._set("mode",e),this._updateMode())}get updating(){var e;return!!((e=this._inputManager)!=null&&e.updating)}get latestPointerType(){var e;return(e=this._inputManager)==null?void 0:e.latestPointerType}get latestPointerLocation(){var e;return(e=this._inputManager)==null?void 0:e.latestPointerLocation}get multiTouchActive(){var e;return((e=this._inputManager)==null?void 0:e.multiTouchActive)??!1}disconnect(){this.view.viewEvents.disconnect(),this._inputManager=et(this._inputManager)}connect(){const e=this.view;this._source=new C9e(this.view.surface,e.input);const i=[new u2t,new h2t,new d2t,new l2t(this.view.navigation),new f2t],r=new Wp({eventSource:this._source,recognizers:i});this._inputManager=r,r.installHandlers("prevent-context-menu",[new s2t],Es.INTERNAL),this._modeDragPan=new nye(e,"primary"),this._modeDragRotate=new Yq(e,"secondary",Dh.CENTER),this._modeDragZoom=new Pwt(e,"tertiary");const n={lookAround:"b",pan:{left:"ArrowLeft",right:"ArrowRight",forward:"ArrowUp",backward:"ArrowDown",up:"u",down:"j",headingLeft:"a",headingRight:"d",tiltUp:"w",tiltDown:"s",zoomIn:"+",zoomOut:"-"},resetHeading:"n",resetTilt:"p"};r.installHandlers("navigation",[new Ywt(e),new Jbt(e),new kwt(e),new Uwt(e,n.pan),new Vwt(e),new Zwt(e,n.resetTilt),new Xwt(e,n.resetHeading),new Yq(e,"primary",Dh.EYE,[n.lookAround]),new Yq(e,"secondary",Dh.CENTER,[n.lookAround]),new nye(e,"tertiary",[n.lookAround]),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,new Jwt(e)],Es.INTERNAL),this.view.viewEvents.connect(r),this._updateMode(),this.addHandles(_e(()=>{var s;return(s=this.view.navigation)==null?void 0:s.browserTouchPanEnabled},s=>{this._source.browserTouchPanningEnabled=!s},ii))}_updateMode(){var n;const e=this.mode,i=this.primaryDragAction,r=(n=Jte.get(e))==null?void 0:n.get(i);r&&(this._modeDragPan&&(this._modeDragPan.pointerAction=r.pan),this._modeDragRotate&&(this._modeDragRotate.pointerAction=r.rotate),this._modeDragZoom&&(this._modeDragZoom.pointerAction=r.zoom))}get test(){return{inputManager:this._inputManager,modeDragPan:this._modeDragPan,modeDragRotate:this._modeDragRotate,modeDragZoom:this._modeDragZoom}}};y([w()],F0.prototype,"view",void 0),y([w({value:"pan"})],F0.prototype,"primaryDragAction",null),y([w({value:"default"})],F0.prototype,"mode",null),y([w({readOnly:!0})],F0.prototype,"updating",null),y([w()],F0.prototype,"latestPointerType",null),y([w()],F0.prototype,"latestPointerLocation",null),y([w()],F0.prototype,"multiTouchActive",null),y([w()],F0.prototype,"_inputManager",void 0),F0=y([Z("esri.views.3d.input.SceneInputManager")],F0);const Jte=new Map,Jq=new Map,Kq=new Map;Jq.set("pan",{pan:"primary",rotate:"secondary",zoom:"tertiary"}),Jq.set("rotate",{pan:"secondary",rotate:"primary",zoom:"tertiary"}),Kq.set("pan",{pan:"primary",rotate:"tertiary",zoom:"secondary"}),Kq.set("rotate",{pan:"tertiary",rotate:"primary",zoom:"secondary"}),Jte.set("default",Jq),Jte.set("pro",Kq);const m2t=F0;let mo=class extends ze{constructor(){super(...arguments),this.SCENEVIEW_HITTEST_RETURN_INTERSECTOR=!1,this.DECONFLICTOR_SHOW_VISIBLE=!1,this.DECONFLICTOR_SHOW_INVISIBLE=!1,this.DECONFLICTOR_SHOW_GRID=!1,this.LABELS_SHOW_BORDER=!1,this.TEXT_SHOW_BASELINE=!1,this.TEXT_SHOW_BORDER=!1,this.OVERLAY_DRAW_DEBUG_TEXTURE=!1,this.OVERLAY_SHOW_CENTER=!1,this.SHOW_POI=!1,this.TESTS_DISABLE_OPTIMIZATIONS=!1,this.TESTS_DISABLE_FAST_UPDATES=!1,this.DRAW_MESH_GEOMETRY_NORMALS=!1,this.FEATURE_TILE_FETCH_SHOW_TILES=!1,this.FEATURE_TILE_TREE_SHOW_TILES=!1,this.TERRAIN_TILE_TREE_SHOW_TILES=!1,this.I3S_TREE_SHOW_TILES=!1,this.I3S_SHOW_MODIFICATIONS=!1,this.LOD_INSTANCE_RENDERER_DISABLE_UPDATES=!1,this.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL=!1,this.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES=!1,this.LINE_WIREFRAMES=!1}};y([w()],mo.prototype,"SCENEVIEW_HITTEST_RETURN_INTERSECTOR",void 0),y([w()],mo.prototype,"DECONFLICTOR_SHOW_VISIBLE",void 0),y([w()],mo.prototype,"DECONFLICTOR_SHOW_INVISIBLE",void 0),y([w()],mo.prototype,"DECONFLICTOR_SHOW_GRID",void 0),y([w()],mo.prototype,"LABELS_SHOW_BORDER",void 0),y([w()],mo.prototype,"TEXT_SHOW_BASELINE",void 0),y([w()],mo.prototype,"TEXT_SHOW_BORDER",void 0),y([w()],mo.prototype,"OVERLAY_DRAW_DEBUG_TEXTURE",void 0),y([w()],mo.prototype,"OVERLAY_SHOW_CENTER",void 0),y([w()],mo.prototype,"SHOW_POI",void 0),y([w()],mo.prototype,"TESTS_DISABLE_OPTIMIZATIONS",void 0),y([w()],mo.prototype,"TESTS_DISABLE_FAST_UPDATES",void 0),y([w()],mo.prototype,"DRAW_MESH_GEOMETRY_NORMALS",void 0),y([w()],mo.prototype,"FEATURE_TILE_FETCH_SHOW_TILES",void 0),y([w()],mo.prototype,"FEATURE_TILE_TREE_SHOW_TILES",void 0),y([w()],mo.prototype,"TERRAIN_TILE_TREE_SHOW_TILES",void 0),y([w()],mo.prototype,"I3S_TREE_SHOW_TILES",void 0),y([w()],mo.prototype,"I3S_SHOW_MODIFICATIONS",void 0),y([w()],mo.prototype,"LOD_INSTANCE_RENDERER_DISABLE_UPDATES",void 0),y([w()],mo.prototype,"LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL",void 0),y([w()],mo.prototype,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",void 0),y([w()],mo.prototype,"LINE_WIREFRAMES",void 0),mo=y([Z("esri.views.3d.support.DebugFlags")],mo);const Tn=new mo;let Jd,xO,Kte=!1,Qte=!1,eie=!1,tie=!1,_$=null;function g2t(t,e){if(!Qte||!xO)return;O9e();const i=xO;let r=0;for(let n=0;nv2t(t):Jd&&(Jd.parentElement.removeChild(Jd),Jd=null)}function O9e(){_$&&(_$(),_$=null)}function v2t(t){Jd==null&&(Jd=document.createElement("canvas"),Jd.setAttribute("id","debugCanvas2d"),t.surface.parentElement.style.position="relative",t.surface.parentElement.appendChild(Jd));const{state:e}=t,{camera:i,pixelRatio:r}=e,{width:n,height:s}=i,o=n*r,l=s*r;Jd.setAttribute("width",`${o}px`),Jd.setAttribute("height",`${l}px`),Jd.setAttribute("style",`position:absolute;left:0px;top:0px;display:block;pointer-events:none;width:${n}px;height:${s}px`),xO=Jd.getContext("2d"),xO.clearRect(0,0,n,s),xO.font="12px Arial"}function P9e(t,e,i,r,n){O9e();const s=Jd.height,o=xO;o.beginPath(),o.lineWidth=1,o.strokeStyle=n,o.moveTo(t,s-i),o.lineTo(e,s-i),o.stroke(),o.lineTo(e,s-r),o.stroke(),o.lineTo(e,s-i),o.stroke(),o.lineTo(t,s-i),o.stroke(),o.lineTo(t,s-i),o.stroke(),o.closePath()}function _2t(t,e){Kte&&(e&&eie||!e&&tie)&&P9e(t.aabr[0],t.aabr[2],t.aabr[1],t.aabr[3],e?"green":"red")}var Hl,Ya;(function(t){t[t.USER=1]="USER",t[t.SCALE_RANGE=2]="SCALE_RANGE",t[t.FILTER=4]="FILTER",t[t.DECONFLICTION=8]="DECONFLICTION",t[t.ALL_GRAPHIC=15]="ALL_GRAPHIC",t[t.ALL_LABEL=255]="ALL_LABEL"})(Hl||(Hl={})),function(t){t[t.GRAPHIC=1]="GRAPHIC",t[t.LABEL=16]="LABEL"}(Ya||(Ya={}));function R9e(t,e){return new L9e(t,N9e,e)}function b2t(t,e){const{curvatureDependent:i,scaleStart:r,scaleFallOffRange:n}=N9e;return new L9e(t,{curvatureDependent:{min:{curvature:i.min.curvature,tiltAngle:i.min.tiltAngle,scaleFallOffFactor:Qq.curvatureDependent.min.scaleFallOffFactor},max:{curvature:i.max.curvature,tiltAngle:i.max.tiltAngle,scaleFallOffFactor:Qq.curvatureDependent.max.scaleFallOffFactor}},scaleStart:r,scaleFallOffRange:n,minPixelSize:Qq.minPixelSize},e)}function w2t(t){return Math.abs(t*t*t)}function I9e(t,e,i){const r=i.parameters;return eW.scale=Math.min(r.divisor/(e-r.offset),1),eW.factor=w2t(t),eW}function ule(t,e){return ui(t*Math.max(e.scale,e.minScaleFactor),t,e.factor)}function x2t(t,e,i){const r=I9e(t,e,i);return r.minScaleFactor=0,ule(1,r)}function cye(t,e,i,r){r.scale=x2t(t,e,i),r.factor=0,r.minScaleFactor=i.minScaleFactor}function $9e(t,e,i=[0,0]){const r=Math.min(Math.max(e.scale,e.minScaleFactor),1);return i[0]=t[0]*r,i[1]=t[1]*r,i}function S2t(t,e,i,r){return ule(t,I9e(e,i,r))}let L9e=class D9e{get minScaleFactor(){return this._fontHeight!=null?Math.min(this._description.minPixelSize/this._fontHeight,1):0}constructor(e,i,r,n=T2t(),s){this._viewingMode=e,this._description=i,this._ellipsoidRadius=r,this.parameters=n,this._fontHeight=s,this._viewingMode===_t.Local?(this._coverageCompensation=this._surfaceCoverageCompensationLocal,this._calculateCurvatureDependentParameters=this._calculateCurvatureDependentParametersLocal):(this._coverageCompensation=this._surfaceCoverageCompensationGlobal,this._calculateCurvatureDependentParameters=this._calculateCurvatureDependentParametersGlobal)}update(e){return(!this.parameters||this.parameters.camera.fovY!==e.fovY||this.parameters.camera.distance!==e.distance)&&(this._calculateParameters(e,this._ellipsoidRadius,this.parameters),!0)}overrideFontHeight(e){return e!==this._fontHeight?new D9e(this._viewingMode,this._description,this._ellipsoidRadius,this.parameters,e):this}_calculateParameters(e,i,r){const{scaleStart:n,scaleFallOffRange:s}=this._description,{fovY:o,distance:l}=e,c=this._calculateCurvatureDependentParameters(e,i),f=this._coverageCompensation(e,i,c),{tiltAngle:_,scaleFallOffFactor:x}=c,T=Math.sin(_)*l,A=.5*Math.PI-_-o*(.5-n*f),M=T/Math.cos(A),I=A+o*s*f,L=(M-x*(T/Math.cos(I)))/(1-x);return r.camera.fovY=e.fovY,r.camera.distance=e.distance,r.offset=L,r.divisor=M-L,r}_calculateCurvatureDependentParametersLocal(e,i,r=uye){return r.tiltAngle=this._description.curvatureDependent.min.tiltAngle,r.scaleFallOffFactor=this._description.curvatureDependent.min.scaleFallOffFactor,r}_calculateCurvatureDependentParametersGlobal(e,i,r=uye){const n=this._description.curvatureDependent,s=1+e.distance/i,o=Math.sqrt(s*s-1),[l,c]=[n.min.curvature,n.max.curvature],f=Je((o-l)/(c-l),0,1),[_,x]=[n.min,n.max];return r.tiltAngle=ui(_.tiltAngle,x.tiltAngle,f),r.scaleFallOffFactor=ui(_.scaleFallOffFactor,x.scaleFallOffFactor,f),r}_surfaceCoverageCompensationLocal(e,i,r){return(e.fovY-r.tiltAngle)/e.fovY}_surfaceCoverageCompensationGlobal(e,i,r){const n=i*i,s=r.tiltAngle+.5*Math.PI,{fovY:o,distance:l}=e,c=l*l+n-2*Math.cos(s)*l*i,f=Math.sqrt(c),_=Math.sqrt(c-n);return(Math.acos(_/f)-Math.asin(i/(f/Math.sin(s)))+.5*o)/o}};const N9e={curvatureDependent:{min:{curvature:Ei(10),tiltAngle:Ei(12),scaleFallOffFactor:.5},max:{curvature:Ei(70),tiltAngle:Ei(40),scaleFallOffFactor:.8}},scaleStart:.3,scaleFallOffRange:.65,minPixelSize:0},Qq={curvatureDependent:{min:{scaleFallOffFactor:.7},max:{scaleFallOffFactor:.95}},minPixelSize:14};function T2t(){return{camera:{distance:0,fovY:0},divisor:0,offset:0}}const eW={scale:0,factor:0,minScaleFactor:0},uye={tiltAngle:0,scaleFallOffFactor:0};function E2t(t){return t instanceof Float32Array&&t.length>=16}function C2t(t){return Array.isArray(t)&&t.length>=16}function A2t(t){return E2t(t)||C2t(t)}var vc,hye;(function(t){t[t.Undefined=0]="Undefined",t[t.DefinedSize=1]="DefinedSize",t[t.DefinedScale=2]="DefinedScale"})(vc||(vc={})),function(t){t[t.Undefined=0]="Undefined",t[t.DefinedAngle=1]="DefinedAngle"}(hye||(hye={}));let hle=class{constructor(e){this.field=e}},M2t=class extends hle{constructor(e){super(e),this.minSize=[0,0,0],this.maxSize=[0,0,0],this.offset=[0,0,0],this.factor=[0,0,0],this.type=[vc.Undefined,vc.Undefined,vc.Undefined]}},O2t=class extends hle{constructor(e){super(e),this.colors=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.values=[0,0,0,0,0,0,0,0]}},P2t=class extends hle{constructor(e){super(e),this.values=[0,0,0,0,0,0,0,0],this.opacityValues=[0,0,0,0,0,0,0,0]}},R2t=class{};function hR(t){return t!=null}function uC(t){return typeof t=="number"}function Xj(t){return typeof t=="string"}function I2t(t){return t==null||Xj(t)}function ha(t,e){t&&t.push(e)}function $2t(t,e,i,r=Qe()){const n=t||0,s=e||0,o=i||0;return n!==0&&YO(r,r,-n/180*Math.PI),s!==0&&WO(r,r,s/180*Math.PI),o!==0&&TB(r,r,o/180*Math.PI),r}function yb(t,e,i,r,n){var l;const s=t.minSize,o=t.maxSize;if(t.expression)return ha(n,"Could not convert size info: expression not supported"),!1;if(t.useSymbolValue){const c=r.symbolSize[i];return e.minSize[i]=c,e.maxSize[i]=c,e.offset[i]=e.minSize[i],e.factor[i]=0,e.type[i]=vc.DefinedSize,!0}if(hR(t.field))return hR(t.stops)?t.stops.length===2&&uC(t.stops[0].size)&&uC(t.stops[1].size)?(dye(t.stops[0].size,t.stops[1].size,t.stops[0].value,t.stops[1].value,e,i),e.type[i]=vc.DefinedSize,!0):(ha(n,"Could not convert size info: stops only supported with 2 elements"),!1):uC(s)&&uC(o)&&hR(t.minDataValue)&&hR(t.maxDataValue)?(dye(s,o,t.minDataValue,t.maxDataValue,e,i),e.type[i]=vc.DefinedSize,!0):t.valueUnit==="unknown"?(ha(n,"Could not convert size info: proportional size not supported"),!1):KO[t.valueUnit]!=null?(e.minSize[i]=-1/0,e.maxSize[i]=1/0,e.offset[i]=0,e.factor[i]=1/KO[t.valueUnit],e.type[i]=vc.DefinedSize,!0):(ha(n,"Could not convert size info: scale-dependent size not supported"),!1);if(!hR(t.field)){if((l=t.stops)!=null&&l[0]&&uC(t.stops[0].size))return e.minSize[i]=t.stops[0].size,e.maxSize[i]=t.stops[0].size,e.offset[i]=e.minSize[i],e.factor[i]=0,e.type[i]=vc.DefinedSize,!0;if(uC(s))return e.minSize[i]=s,e.maxSize[i]=s,e.offset[i]=s,e.factor[i]=0,e.type[i]=vc.DefinedSize,!0}return ha(n,"Could not convert size info: unsupported variant of sizeInfo"),!1}function dye(t,e,i,r,n,s){const o=Math.abs(r-i)>0?(e-t)/(r-i):0;n.minSize[s]=o>0?t:e,n.maxSize[s]=o>0?e:t,n.offset[s]=t-i*o,n.factor[s]=o}function L2t(t,e,i,r){if(t.normalizationField||t.valueRepresentation)return ha(r,"Could not convert size info: unsupported property"),null;if(!I2t(t.field))return ha(r,"Could not convert size info: field is not a string"),null;if(e.size){if(t.field)if(e.size.field){if(t.field!==e.size.field)return ha(r,"Could not convert size info: multiple fields in use"),null}else e.size.field=t.field}else e.size=new M2t(t.field);let n;switch(t.axis){case"width":return n=yb(t,e.size,0,i,r),n?e:null;case"height":return n=yb(t,e.size,2,i,r),n?e:null;case"depth":return n=yb(t,e.size,1,i,r),n?e:null;case"width-and-depth":return n=yb(t,e.size,0,i,r),n&&yb(t,e.size,1,i,r),n?e:null;case null:case void 0:case"all":return n=yb(t,e.size,0,i,r),n=n&&yb(t,e.size,1,i,r),n=n&&yb(t,e.size,2,i,r),n?e:null;default:return ha(r,`Could not convert size info: unknown axis "${t.axis}""`),null}}function D2t(t,e,i){for(let n=0;n<3;++n){let s=e.unitInMeters;t.type[n]===vc.DefinedSize&&(s*=e.modelSize[n],t.type[n]=vc.DefinedScale),t.minSize[n]=t.minSize[n]/s,t.maxSize[n]=t.maxSize[n]/s,t.offset[n]=t.offset[n]/s,t.factor[n]=t.factor[n]/s}let r;if(t.type[0]!==vc.Undefined)r=0;else if(t.type[1]!==vc.Undefined)r=1;else{if(t.type[2]===vc.Undefined)return ha(i,"No size axis contains a valid size or scale"),!1;r=2}for(let n=0;n<3;++n)t.type[n]===vc.Undefined&&(t.minSize[n]=t.minSize[r],t.maxSize[n]=t.maxSize[r],t.offset[n]=t.offset[r],t.factor[n]=t.factor[r],t.type[n]=t.type[r]);return!0}function pye(t,e,i){t[4*e]=i.r/255,t[4*e+1]=i.g/255,t[4*e+2]=i.b/255,t[4*e+3]=i.a}function N2t(t,e,i){if(t.normalizationField)return ha(i,"Could not convert color info: unsupported property"),null;if(Xj(t.field)){if(!t.stops)return ha(i,"Could not convert color info: missing stops or colors"),null;{if(t.stops.length>8)return ha(i,"Could not convert color info: too many color stops"),null;e.color=new O2t(t.field);const r=t.stops;for(let n=0;n<8;++n){const s=r[Math.min(n,r.length-1)];e.color.values[n]=s.value,pye(e.color.colors,n,s.color)}}}else{if(!(t.stops&&t.stops.length>=0))return ha(i,"Could not convert color info: no field and no colors/stops"),null;{const r=t.stops&&t.stops.length>=0&&t.stops[0].color;e.color={field:null,values:[0,0,0,0,0,0,0,0],colors:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};for(let n=0;n<8;n++)e.color.values[n]=1/0,pye(e.color.colors,n,r)}}return e}function F2t(t,e,i){if(t.normalizationField)return ha(i,"Could not convert opacity info: unsupported property"),null;if(Xj(t.field)){if(!t.stops)return ha(i,"Could not convert opacity info: missing stops or opacities"),null;{if(t.stops.length>8)return ha(i,"Could not convert opacity info: too many opacity stops"),null;e.opacity=new P2t(t.field);const r=t.stops;for(let n=0;n<8;++n){const s=r[Math.min(n,r.length-1)];e.opacity.values[n]=s.value,e.opacity.opacityValues[n]=s.opacity}}}else{if(!(t.stops&&t.stops.length>=0))return ha(i,"Could not convert opacity info: no field and no opacities/stops"),null;{const r=t.stops&&t.stops.length>=0?t.stops[0].opacity:0;e.opacity={field:null,values:[0,0,0,0,0,0,0,0],opacityValues:[0,0,0,0,0,0,0,0]};for(let n=0;n<8;n++)e.opacity.values[n]=1/0,e.opacity.opacityValues[n]=r}}return e}function tW(t,e,i){const r=i===2&&t.rotationType==="arithmetic";e.offset[i]=r?90:0,e.factor[i]=r?-1:1,e.type[i]=1}function k2t(t,e,i){if(!Xj(t.field))return ha(i,"Could not convert rotation info: field is not a string"),null;if(e.rotation){if(t.field)if(e.rotation.field){if(t.field!==e.rotation.field)return ha(i,"Could not convert rotation info: multiple fields in use"),null}else e.rotation.field=t.field}else e.rotation={field:t.field,offset:[0,0,0],factor:[1,1,1],type:[0,0,0]};switch(t.axis){case"tilt":return tW(t,e.rotation,0),e;case"roll":return tW(t,e.rotation,1),e;case null:case void 0:case"heading":return tW(t,e.rotation,2),e;default:return ha(i,`Could not convert rotation info: unknown axis "${t.axis}""`),null}}let K9=class{constructor(e,i=[1,1,1],r=[1,1,1],n=1,s=[0,0,0],o=[1,1,1],l=[0,0,0]){this.supports=e,this.modelSize=i,this.symbolSize=r,this.unitInMeters=n,this.anchor=s,this.scale=o,this.rotation=l}};function F9e(t,e,i){if(!t)return null;const r=t.reduce((n,s)=>{if(!n)return n;if(s.valueExpression)return ha(i,"Could not convert visual variables: arcade expressions not supported"),null;switch(s.type){case"size":return e.supports.size?L2t(s,n,e,i):n;case"color":return e.supports.color?N2t(s,n,i):n;case"opacity":return e.supports.opacity?F2t(s,n,i):null;case"rotation":return e.supports.rotation?k2t(s,n,i):n;default:return null}},new R2t);return!(t.length>0&&r)||r.size||r.color||r.opacity||r.rotation?r!=null&&r.size&&!D2t(r.size,e,i)?null:r:null}let z2t=class{constructor(e,i,r){this.visualVariables=e,this.materialParameters=i,this.requiresShaderTransformation=r}};function C5(t,e){if(!t||Tn.TESTS_DISABLE_FAST_UPDATES)return null;const i=F9e(t.visualVariables,e);return i?new z2t(i,z9e(i,e),!!i.size):null}function A5(t,e,i){if(!e||!t)return!1;const r=t.visualVariables,n=F9e(e.visualVariables,i);return!!n&&!!(xN(r.size,n.size,"size")&&xN(r.color,n.color,"color")&&xN(r.rotation,n.rotation,"rotation")&&xN(r.opacity,n.opacity,"opacity"))&&(t.visualVariables=n,t.materialParameters=z9e(n,i),t.requiresShaderTransformation=!!n.size,!0)}function xN(t,e,i){if(!!t!=!!e||t&&t.field!==(e==null?void 0:e.field))return!1;if(t&&i==="rotation"){const r=t,n=e;for(let s=0;s<3;s++)if(r.type[s]!==n.type[s]||r.offset[s]!==n.offset[s]||r.factor[s]!==n.factor[s])return!1}return!0}let k9e=class extends _n{constructor(e){super(),this.vvSize=(e==null?void 0:e.size)??null,this.vvColor=(e==null?void 0:e.color)??null,this.vvOpacity=(e==null?void 0:e.opacity)??null}};function z9e(t,e){const i=new k9e(t);return i.vvSize&&(i.vvSymbolAnchor=e.anchor,Hf(b$),$2t(e.rotation[2],e.rotation[0],e.rotation[1],b$),i.vvSymbolRotationMatrix=i.vvSymbolRotationMatrix||as(),Yf(i.vvSymbolRotationMatrix,b$)),i}function U2t(t,e,i){if(!t.vvSize)return i;Ao(vb,i);const r=t.vvSymbolRotationMatrix;s1(b$,r[0],r[1],r[2],0,r[3],r[4],r[5],0,r[6],r[7],r[8],0,0,0,0,1),nn(vb,vb,b$);for(let n=0;n<3;++n){const s=t.vvSize.offset[n]+e[0]*t.vvSize.factor[n];fye[n]=Je(s,t.vvSize.minSize[n],t.vvSize.maxSize[n])}return $9(vb,vb,fye),Qu(vb,vb,t.vvSymbolAnchor),vb}function dle(t,e,i){if(!e.vvSize)return Ie(t,1,1,1),t;for(let r=0;r<3;++r){const n=e.vvSize.offset[r]+i[0]*e.vvSize.factor[r];t[r]=Je(n,e.vvSize.minSize[r],e.vvSize.maxSize[r])}return t}function Om(t,e){const i=t==null?0:e.attributes[t];return typeof i=="number"&&isFinite(i)?i:0}const vb=Qe(),fye=W(),b$=Qe();function ple(t){t.vertex.code.add(V`float screenSizePerspectiveViewAngleDependentFactor(float absCosAngle) { +}`),t}function P1t(t,e){return Mo(vb,e.camera.projectionMatrix),vb[10]=24e-8-1,vb[11]=-1,vb[14]=(24e-8-2)*e.camera.near,sn(vb,vb,e.camera.viewMatrix),sn(vb,vb,t.modelMatrix)}const vb=Qe(),R1t=Object.freeze(Object.defineProperty({__proto__:null,build:SLe},Symbol.toStringTag,{value:"Module"}));let I1t=class extends bn{constructor(){super(...arguments),this.modelMatrix=Qe()}},TLe=class ELe extends Hr{constructor(e){super(e,new oh,()=>this.destroy())}initializeProgram(e){return new $r(e.rctx,ELe.shader.get().build(),Cr)}initializePipeline(){return Ti({blending:Pl(ot.SRC_ALPHA,ot.ONE,ot.ONE_MINUS_SRC_ALPHA,ot.ONE_MINUS_SRC_ALPHA),depthTest:{func:Zr.LEQUAL},colorWrite:ji})}};TLe.shader=new Ir(R1t,()=>we(()=>Promise.resolve().then(()=>iXt),void 0));let gw=class extends ze{get updating(){return this._updatingTracking.updating||this.loading}get loading(){return this._loadDataTask!=null&&!this._loadDataTask.finished}constructor(e){super(e),this._loadDataTask=null,this._numPoints=0,this._renderParameter=new I1t,this._updatingTracking=new Nf}initialize(){this._loadDataTask=this._createLoadDataTask()}destroy(){this._loadDataTask=vn(this._loadDataTask),this._updatingTracking.destroy(),this._numPoints=0,this._technique=ir(this._technique),this._vao=Kt(this._vao),Rx=null}render(e){const{rctx:i}=e;if(this._ensureResources(i),this._technique==null||this._vao==null)return;if(!this._technique.compiled)return void this.requestRender();const r=i.bindTechnique(this._technique,this._renderParameter,e.bindParameters);i.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),i.drawArrays(sr.POINTS,0,this._numPoints)}_ensureResources(e){if(this._technique!=null||Rx==null)return;this._technique=new TLe({rctx:e,viewingMode:this.view.state.viewingMode}),this._numPoints=Rx.byteLength/cge;const i=new Float32Array(Rx,0,2*this._numPoints),r=new Uint8Array(Rx,2*this._numPoints*4,this._numPoints);this._vao=this._createVertexArrayObject(e,i,r,this._numPoints),this._updatingTracking.add(()=>this.view.environment.lighting.type!=="virtual"?this.view.environment.lighting.date:null,n=>this._update(n),Qt)}_computeDayDuration(e){const i=e,r=new Date(e.getFullYear(),0,1,11,58,56);return(+i-+r)/(+new Date(e.getFullYear()+1,0,1,11,58,55)-+r)}_update(e){if(!e)return;const i=(e.getHours()/12+e.getMinutes()/60*(2/24)+e.getSeconds()/60*(2/1440)-.9972222)%2,r=2*this._computeDayDuration(e),n=Mo(this._renderParameter.modelMatrix,D1t);iP(n,n,-r*Math.PI),sn(n,L1t,n),iP(n,n,-i*Math.PI),this.requestRender()}_hexToRGB(e){return[parseInt(e.substring(0,2),16),parseInt(e.substring(2,4),16),parseInt(e.substring(4,6),16)]}_unpackUint8Attributes(e){return e>=192?[2.9,e-192]:e>=160?[2.5,e-160]:e>=128?[2,e-128]:e>=96?[1.5,e-96]:e>=64?[1,e-64]:e>=32?[.7,e-32]:[.4,e]}_createVertexArrayObject(e,i,r,n){const s=uge.createBuffer(n),o=s.position,a=s.color,c=s.size;for(let p=0;p{const{data:r}=await bWe("esri/views/3d/environment/resources/stars.wsv",{responseType:"array-buffer",signal:i});this._verifyStarData(r),Rx=r});return e.promise.catch(i=>{on(i)||Ce.getLogger(this).error(i)}).then(()=>{this.destroyed||(this.requestRender(),this.notifyChange("updating"))}),e}_verifyStarData(e){if(!e)throw new se("stars:no-data-received","Failed to create stars because star catalogue is missing");const i=e.byteLength/cge;if(i%1!=0||i>5e4||i<5e3)throw new se("stars:invalid-data","Failed to create stars because star catalogue data is invalid")}};y([w({constructOnly:!0})],gw.prototype,"view",void 0),y([w({constructOnly:!0})],gw.prototype,"requestRender",void 0),y([w({readOnly:!0})],gw.prototype,"updating",null),y([w()],gw.prototype,"_loadDataTask",void 0),y([w()],gw.prototype,"_updatingTracking",void 0),gw=y([Z("esri.views.3d.environment.Stars")],gw);const $1t=["9bb2ff","9eb5ff","aabfff","bbccff","ccd8ff ","dae2ff","e4e9ff","eeefff","f8f6ff","fff9fb","fff5ef","fff1e5","ffeddb","ffe9d2","ffe6ca","ffe3c3","ffe0bb","ffddb4","ffdaad","ffd6a5","ffd29c","ffcc8f","ffc178","ffa94b","ff7b00"],L1t=zoe(1,0,0,0,0,.9174771405229186,.39778850739794974,0,0,-.39778850739794974,.9174771405229186,0,0,0,0,1),D1t=zoe(1,0,0,0,0,.9174771405229186,-.39778850739794974,0,0,.39778850739794974,.9174771405229186,0,0,0,0,1),cge=9,uge=ls().vec3f(J.POSITION).vec4u8(J.COLOR).f32(J.SIZE);let Rx=null;const Jj={required:[]},CLe={required:[ue.Depth]},ALe={required:[ue.CompositeColor]},MLe={required:[ue.Highlight]},N1t={required:[ue.Depth,ue.Normal]};let Kj=class extends ze{consumes(){return Jj}get usedMemory(){return 0}get isDecoration(){return!1}get running(){return!1}},gx=class extends Kj{},OLe=class extends Kj{},F1t=class extends Kj{},k1t=class extends Kj{};var AO;(function(t){t[t.Immediate=0]="Immediate",t[t.Faded=1]="Faded"})(AO||(AO={}));var v4;let kl=v4=class extends gx{constructor(t){super(t),this.produces=new Map([[ke.ENVIRONMENT_OPAQUE,()=>!(this._atmosphere===null&&this._stars===null)],[ke.ENVIRONMENT_TRANSPARENT,()=>this._atmosphere!==null]]),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new Fq,this._newWeatherParameters=new Fq,this._fadedWeatherParameters=new Fq,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){var t;this.removeHandles(),this.uninitializeRenderContext(),((t=this.view)==null?void 0:t._stage)!=null&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return this.atmosphere!=null?this.atmosphere.type:gc.None}consumes(){return this._atmosphereType===gc.Realistic?CLe:Jj}updateAnimation(t){return this._precipitation!=null&&this._precipitation.update(t)}get updating(){return this._stars!=null&&this._stars.updating||this._clouds!=null&&this._clouds.running}get weatherVisible(){return nt(this.view.state.camera.eye)-Tr(this.view.spatialReference).radius<=kv}get usedMemory(){var t;return((t=this._clouds)==null?void 0:t.usedMemory)??0}get _stars(){var r;const t=this.view,e=((r=t.environment)==null?void 0:r.starsEnabled)??!1,i=this._get("_stars");return e&&this._context!=null?i??new gw({view:t,requestRender:()=>this._setNeedsRender()}):(et(i),null)}get _precipitation(){const t=this._get("_precipitation");if(!this._precipitationEnabled||this._context==null)return et(t),null;const e=this.view,i=this._context;return t!=null&&t.context===i?t:(et(t),new iS({context:i,view:e}))}get _clouds(){const t=this._get("_clouds");if(!this.weatherEnabled||this._context==null)return et(t),null;if(t!=null)return t;const e=this.view,i=this._context;return et(t),new Pu({context:i,view:e,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const t=this._get("_cloudsComposition");if(!this.weatherEnabled||this._context==null)return et(t),null;const e=this.view.state.viewingMode,i=this._context.renderContext.rctx,r=Tr(this.view.spatialReference).radius;return t!=null&&t.viewingMode===e&&t.planetRadius===r?t:(et(t),new Q3({rctx:i,viewingMode:e,planetRadius:r,requestRender:()=>this._setNeedsRender()}))}get _fog(){const t=this._get("_fog");if(!this.weatherEnabled||this._context==null)return et(t),null;if(t!=null)return t;const e=this.view,i=this._context,r=this._context.renderContext.rctx,n=this.view.state.viewingMode;return new eS({context:i,view:e,rctx:r,viewingMode:n})}get weatherEnabled(){var t,e;return!!((e=(t=this.view)==null?void 0:t.environmentManager)!=null&&e.weatherEnabled)}get _precipitationEnabled(){return this.weatherEnabled&&(this.view.environment.weather.type==="rainy"||this.view.environment.weather.type==="snowy")}initializeRenderContext(t=null){this._context=t;const e=()=>this._setNeedsRender();this.addHandles([_e(()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),i=>this._updateAtmosphere(i),kt),_e(()=>this._stars,e),_e(()=>this._precipitation,e),_e(()=>this._clouds,()=>this._updateWeather(),Qt),_e(()=>this._fog,()=>this._updateFogHaze(),Qt),_e(()=>this.view.state.mode,()=>{this._setNeedsRender()},Li),_e(()=>this._weatherUpdateParameters,()=>{this._updateWeather(),this._updateFogHaze()},kt)])}uninitializeRenderContext(){this._context=null,this._atmosphere=et(this._atmosphere),this._set("_stars",et(this._stars)),this._set("_precipitation",et(this._precipitation)),this._set("_clouds",et(this._clouds)),this._set("_cloudsComposition",et(this._cloudsComposition)),this._set("_fog",et(this._fog))}prepareRender(t){var e;t.bindParameters.cloudsFade.data=Cgt(this._clouds)?this._clouds:null,this.view.viewingMode!=="local"&&((e=t.bindParameters.cloudsFade.data)==null?void 0:e.cubeMap)!=null&&(this._updateWeatherFading(t.bindParameters,t.time),t.bindParameters.cloudsFade.renderingStage===xy.FINISHED&&this._clouds!=null&&this._clouds.coverage===0&&this._clouds.running===!1&&(this._clouds.destroyFrameBufferCube(),t.bindParameters.cloudsFade.data=null))}renderNode(t){var e,i,r,n,s,o,a;switch(t.bindParameters.slot){case ke.ENVIRONMENT_OPAQUE:this._stars!=null&&this._stars.render(t),this.atmosphere!=null&&(this.atmosphere.render(t,(r=(i=(e=this.view)==null?void 0:e._stage)==null?void 0:i.renderer)==null?void 0:r.fullResolutionAtmosphere),this._cloudsComposition!=null&&t.bindParameters.cloudsFade.data!=null&&(this.weatherVisible&&this._clouds!=null&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(t)),t.bindParameters.cloudsFade.isFading&&this._context!=null&&((n=t.bindParameters.cloudsFade.data)==null?void 0:n.cubeMap)!=null&&this._context.requestRender());break;case ke.ENVIRONMENT_TRANSPARENT:if(this.atmosphere!=null&&(this.atmosphere.renderHaze(t,this._weatherParameters.hazeAmount,(a=(o=(s=this.view)==null?void 0:s._stage)==null?void 0:o.renderer)==null?void 0:a.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&this._fog!=null&&this._fog.render(t,this._weatherParameters.fog),this._precipitation!=null)){const c=this.view.environment.weather;c.type!=="rainy"&&c.type!=="snowy"||this._precipitation.render(t,c.precipitation,c.type)}}}updateLightSources(t,e,i,r){if(this._context!=null){const n=this._context.renderContext;n.bindParameters.oldLighting.copyFrom(n.bindParameters.lighting),n.bindParameters.newLighting.noonFactor=e,n.bindParameters.newLighting.globalFactor=i,n.bindParameters.newLighting.set(t),r===AO.Faded||n.bindParameters.weatherFading?n.bindParameters.fadeLighting(0):n.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const t=this.weatherEnabled?this.view.environment.weather:null;return t==null?null:t.type==="rainy"||t.type==="snowy"?{type:t.type,weatherAdjustment:t.cloudCover,effect:t.precipitation}:{type:t.type,weatherAdjustment:t.type==="foggy"?t.fogStrength:t.cloudCover}}_updateWeatherFading(t,e){t.cloudsFade.updateFading(t.camera,this.view.state.mode,e,this.view.qualitySettings.fadeDuration),t.cloudsFade.updateParallax(t.camera),t.weatherFading&&(this._updateLighting(t),this._updateFogAtmoshpere(t))}_updateLighting(t){t.cloudsFade.fadeMode!==Vn.CROSS_FADE&&t.cloudsFade.fadeMode!==Vn.FADE_IN?t.fadeLighting(0):t.fadeLighting(t.cloudsFade.fadeFactor)}_updateFogAtmoshpere(t){t.cloudsFade.fadeMode!==Vn.CROSS_FADE&&t.cloudsFade.fadeMode!==Vn.FADE_IN?this._fadeWeather(0):this._fadeWeather(t.cloudsFade.fadeFactor)}_fadeWeather(t){const{_newWeatherParameters:e,_oldWeatherParameters:i}=this;t>=1?this._weatherParameters=e:(this._fadedWeatherParameters.lerp(i,e,t),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const t=this._weatherUpdateParameters;t!=null&&this._clouds!=null&&(this._clouds.applyPreset(dc[t.type],t.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){this._context!=null&&this._context.requestRender()}_updateFogHaze(){const t=this._weatherUpdateParameters;if(this._fog==null||t==null||this._context==null)return;const e=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),t.type){case"foggy":this._newWeatherParameters.fog.strength=ui(3e-5,.005,t.weatherAdjustment**3),Ne(this._newWeatherParameters.fog.color,hge),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=ui(4e-6,2e-4,(t.effect??0)**3),Ne(this._newWeatherParameters.fog.color,z1t),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=ui(4e-6,2e-4,(t.effect??0)**3),Ne(this._newWeatherParameters.fog.color,hge),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}e.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(t){const e=this._selectAtmosphereType(t);if(e!==gc.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==e){this._atmosphere=et(this._atmosphere);const i=this._getAtmosphereClass(e);i&&(this._atmosphere=new i(this.view,this._context))}}else this._atmosphere=et(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(t){switch(t){case gc.Realistic:return $me;case gc.Local:return f1t;case gc.Mars:return _1t;default:case gc.None:return null}}_selectAtmosphereType(t){const{enabled:e,viewingMode:i}=t;return!e||h1(this.view.spatialReference)?gc.None:i===_t.Local?gc.Local:this._context!=null&&$me.isSupported(this._context)&&XO(this.view.spatialReference)?gc.Realistic:u1(this.view.spatialReference)?gc.Mars:gc.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:t=>{dge=v4.prototype._getAtmosphereClass,v4.prototype._getAtmosphereClass=t},restoreGetAtmosphereClass:()=>{v4.prototype._getAtmosphereClass=dge}}}};y([w({constructOnly:!0})],kl.prototype,"view",void 0),y([w({readOnly:!0})],kl.prototype,"atmosphere",null),y([w({readOnly:!0})],kl.prototype,"_atmosphereType",null),y([w({type:Boolean,readOnly:!0})],kl.prototype,"updating",null),y([w({readOnly:!0})],kl.prototype,"weatherVisible",null),y([w()],kl.prototype,"_context",void 0),y([w()],kl.prototype,"_atmosphere",void 0),y([w({readOnly:!0})],kl.prototype,"_stars",null),y([w({readOnly:!0})],kl.prototype,"_precipitation",null),y([w({readOnly:!0})],kl.prototype,"_clouds",null),y([w({readOnly:!0})],kl.prototype,"_cloudsComposition",null),y([w({readOnly:!0})],kl.prototype,"_fog",null),y([w({readOnly:!0})],kl.prototype,"weatherEnabled",null),y([w({readOnly:!0})],kl.prototype,"_precipitationEnabled",null),y([w({readOnly:!0})],kl.prototype,"_weatherUpdateParameters",null),kl=v4=y([Z("esri.views.3d.environment.EnvironmentRenderer")],kl);let Fq=class{constructor(){this.fog=new Pyt,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,Ne(this.fog.color,e.fog.color)}lerp(e,i,r){this.fog.amount=ui(e.fog.amount,i.fog.amount,r),this.hazeAmount=ui(e.hazeAmount,i.hazeAmount,r),this.fog.strength=ui(e.fog.strength,i.fog.strength,r),Qr(this.fog.color,e.fog.color,i.fog.color,r)}};const z1t=st(.5,.5,.5),hge=st(1.5,1.5,1.5);let dge;var pge,fge,mge,jte={exports:{}};jte.exports,pge=jte,fge=function(){var t=Math.PI,e=Math.sin,i=Math.cos,r=Math.tan,n=Math.asin,s=Math.atan2,o=Math.acos,a=t/180,c=864e5,p=2440588,_=2451545,x={dec:0,ra:0};function S(te){return te.valueOf()/c-.5+p}function C(te){return new Date((te+.5-p)*c)}function M(te){return S(te)-_}var P=23.4397*a;function $(te,le){return s(e(te)*i(P)-r(le)*e(P),i(te))}function F(te,le){return n(e(le)*i(P)+i(le)*e(P)*e(te))}function z(te,le,de){return s(e(te),i(te)*e(le)-r(de)*i(le))}function k(te,le,de){return n(e(le)*e(de)+i(le)*i(de)*i(te))}function U(te,le){return a*(280.16+360.9856235*te)-le}function j(te){return a*(357.5291+.98560028*te)}function G(te){return a*(1.9148*e(te)+.02*e(2*te)+3e-4*e(3*te))}function Y(te,le){return te+le+102.9372*a+t}function Q(te,le){var de=j(te),be=Y(de,G(de));return le||(le={dec:0,ra:0}),le.dec=F(be,0),le.ra=$(be,0),le}var ne={PolarException:{NORMAL:0,MIDNIGHT_SUN:1,POLAR_NIGHT:2},getPosition:function(te,le,de,be){var Se=a*-de,Ae=a*le,Re=M(te),Ge=Q(Re,x),ut=U(Re,Se)-Ge.ra;return be||(be={azimuth:0,altitude:0}),be.azimuth=z(ut,Ae,Ge.dec),be.altitude=k(ut,Ae,Ge.dec),be}},ie=[[-.83,"sunrise","sunset"]];ne.addTime=function(te,le,de){ie.push([te,le,de])};var he=9e-4;function ce(te,le){return Math.round(te-he-le/(2*t))}function ve(te,le,de){return he+(te+le)/(2*t)+de}function ge(te,le,de){return _+te+.0053*e(le)-.0069*e(2*de)}function pe(te,le,de){return o((e(te)-e(le)*e(de))/(i(le)*i(de)))}function Ee(te){var le=a*(134.963+13.064993*te),de=a*(93.272+13.22935*te),be=a*(218.316+13.176396*te)+6.289*a*e(le),Se=5.128*a*e(de),Ae=385001-20905*i(le);return{ra:$(be,Se),dec:F(be,Se),dist:Ae}}return ne.getTimes=function(te,le,de){var be=a*-de,Se=a*le,Ae=ce(M(te),be),Re=ve(0,be,Ae),Ge=j(Re),ut=G(Ge),Ft=Y(Ge,ut),ei=F(Ft,0),Mt=ge(Re,Ge,Ft);function ri(Tt){return ge(ve(pe(Tt,Se,ei),be,Ae),Ge,Ft)}function It(Tt){var re=(e(Tt)-e(Se)*e(ei))/(i(Se)*i(ei));return re<-1?ne.PolarException.MIDNIGHT_SUN:re>1?ne.PolarException.POLAR_NIGHT:ne.PolarException.NORMAL}var dt,pt,ai,ht,Ct,Dt={solarNoon:C(Mt),nadir:C(Mt-.5),polarException:ne.PolarException.NORMAL};for(dt=0,pt=ie.length;dtP)ea($,Uq),Ne(F,kq),Ne(z,zq),k="night";else if(r0&&(gge(F,U),gge(z,U));const j=$Le(i);return{direct:{intensity:$[0]*j.direct,color:F},ambient:{intensity:$[1]*j.ambient,color:z},timeOfDay:k}}const Cge=new Date(0),Age=Qe(),Vq=W(),Bq=W(),Y1t=W(),jq=.25,X1t=.2;let z0=class extends Dn.EventedAccessor{constructor(){super(),this._referencePointUpdateDelay=200,this._referencePointUpdateInterval=3e3,this._referencePointUpdateDistThreshold=1e6,this._referencePosUpdateQuery=null,this._referencePosMapCoordsRequested=null,this._viewHandlesKey="viewHandles",this._preserveAbsoluteDateTime=!1,this._trackingEnabled=!1,this._referencePosResetPreserveAbsoluteTime=!1,this._referencePosUpdateTimer=null,this._referencePosMapCoords=null,this._mainLight=new xU,this._ambientLight=new Vae,this._moonLight=new D$e,this.disableQueries=!1,this._disableWeather=!1,this._renderer=null,this._referencePosWGS84Comparable=null,this._resetReferencePosition()}destroy(){this.disconnectView()}get _view(){var e;return(e=this._renderer)==null?void 0:e.view}get updating(){var e;return!((this.disableQueries||!this._referencePosUpdateQuery&&!this._referencePosMapCoordsRequested)&&!((e=this._renderer)!=null&&e.updating))}get weatherEnabled(){var e,i,r;return((e=this._view)==null?void 0:e.environment.atmosphereEnabled)&&!this._disableWeather&&((r=(i=this._view)==null?void 0:i.state)==null?void 0:r.viewingMode)===_t.Global&&XO(this._view.spatialReference)}get weatherVisible(){var e;return this.weatherEnabled&&((e=this._renderer)==null?void 0:e.weatherVisible)}get referencePositionWGS84Comparable(){return this._referencePosWGS84Comparable}connectView(e){if(this._renderer)return;this._renderer=new kl({view:e});const i=()=>this._updateRenderParameters(),r=()=>this._cameraHandler();this.addHandles([_e(()=>e.environment.lighting,n=>this._updateLightingHandler(n),Li),_e(()=>e.environment.lighting.type!=="virtual"?e.environment.lighting.date:null,n=>this._lightingDateHandler(n),Li),_e(()=>e.stationary,()=>this._interactingStationaryHandler()),_e(()=>e.environment.lighting.directShadowsEnabled,i,Li),_e(()=>e.qualitySettings.ambientOcclusion,i,Li),_e(()=>e.qualitySettings.reflections,i,Li),_e(()=>e.spatialReference,()=>this._resetReferencePosition(!0),Li),_e(()=>e.environment.weather.type,()=>this._updateLighting(null,AO.Faded),Li),_e(()=>this.weatherEnabled,()=>this._updateLighting(null,AO.Faded),Li),_e(()=>e.viewingMode,()=>this._resetReferencePosition(!0),kt),_e(()=>e.environment.lighting.type!=="virtual"&&e.environment.lighting.cameraTrackingEnabled,n=>this._updateCameraTracking(n),kt),_e(()=>e.state.camera,r,kt),_e(()=>this.disableQueries,r)],this._viewHandlesKey),this._updateRenderParameters(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition(),this._renderer=et(this._renderer)}_updateLightingHandler(e){this._updateCameraTracking(e.type!=="virtual"&&e.cameraTrackingEnabled),this._lightingDateHandler(e.type!=="virtual"?e.date:null),this._updateRenderParameters()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{const i=this._view.environment.lighting;(i==null?void 0:i.type)!=="virtual"&&(i.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){const i=this._view.environment.lighting;if((i==null?void 0:i.type)!=="virtual"){if(e){if(!i.positionTimezoneInfo.autoUpdated){this._preserveAbsoluteDateTime=!0;const r=this._view.spatialReference;if(!U2(r)){const n=this._view.camera.position;if(!this._referencePosMapCoords||!this._referencePosMapCoords.equals(n))return void this._requestReferencePositionUpdate(n)}if(this._preupdateTracking(e),this._referencePosWGS84Comparable!=null){const n=Mee(this._referencePosWGS84Comparable,Mge);n!=null&&(i.autoUpdate(null,n),this._trackingEnabled&&(i.positionTimezoneInfo.autoUpdated=!0))}}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){!this._trackingEnabled&&this._view.environment.lighting.type!=="virtual"&&this._view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const i=this._view;if(!i.ready)return;const r=i.stateManager.camera;r&&(this._cameraHandlerClientSide(r,e)||this._cameraHandlerServerSide(r))}_cameraHandlerClientSide(e,i){const r=XO(this._view.spatialReference);if(r&&!U2(this._view.spatialReference))return this._view.environment.lighting.type==="virtual"&&this._updateLighting(),!1;const n=e.position;return this._referencePosWGS84Comparable==null&&(this._referencePosWGS84Comparable=W()),r?N0t(n,this._referencePosWGS84Comparable):Ie(this._referencePosWGS84Comparable,n.longitude??0,n.latitude??0,n.z??0),this.notifyChange("referencePositionWGS84Comparable"),this._autoUpdateTimezone(this._referencePosWGS84Comparable,i)||this._updateLighting(i),!0}_cameraHandlerServerSide(e){const i=e.position;(!this._referencePosMapCoords||this._referencePosMapCoordsRequested||this._exceedsReferencePosDistThreshold(i))&&this._requestReferencePositionUpdate(i,!0),this._view.mapCoordsHelper&&this._referencePosWGS84Comparable&&(this._referencePosWGS84Comparable[2]=(i.z??0)*this._view.mapCoordsHelper.unitInMeters,this._referencePosChanged())}_interactingStationaryHandler(){this._view.stationary&&this._executePendingReferencePositionUpdate()}_updateLighting(e,i=AO.Immediate){const r=this._view;e=e||(r.environment.lighting.type==="virtual"?null:r.environment.lighting.date);const n=this._referencePosWGS84Comparable,s=n!=null?Z1t:J1t,o=this.weatherVisible?r.environment.weather.type:"disabled";n!=null?U1t(e,n,r.state.viewingMode,o,r.state.camera,s):r.environment.lighting.type==="virtual"&&PLe(r.state.camera,r.state.viewingMode,s.direct.directionToLightSource);const a=this._mainLight,c=s.direct;De(a.intensity,c.color,c.intensity*Math.PI),Ne(a.direction,c.directionToLightSource),a.specularStrength=s.specularStrength,a.environmentStrength=s.environmentStrength;const p=this._ambientLight;De(p.intensity,s.ambient.color,s.ambient.intensity);const _=this._moonLight;Qr(_.intensity,Q1t,evt,s.globalFactor);const x=(1-.5*s.globalFactor)*(1-.4*s.noonFactor*(1-s.globalFactor));De(_.intensity,_.intensity,x),Ne(_.direction,c.directionToLightSource),this._renderer.updateLightSources([a,p,_],s.noonFactor,s.globalFactor,i),this._updateRenderParameters()}_autoUpdateTimezone(e,i=null){if(this._view.environment.lighting.type==="virtual"||!this._view.environment.lighting.cameraTrackingEnabled||e==null)return!1;const r=K1t;r.setTime((i||this._view.environment.lighting.date).getTime());const n=Mee(e,Mge);if(n==null)return!1;let s=this._view.environment.lighting.positionTimezoneInfo;if(s.autoUpdated){if(s.hours===n.hours&&s.minutes===n.minutes&&s.seconds===n.seconds)return!1}else s=n;const o=r.getUTCHours()-(n.hours-s.hours),a=r.getUTCMinutes()-(n.minutes-s.minutes),c=r.getUTCSeconds()-(n.seconds-s.seconds);return r.setUTCHours(o),r.setUTCMinutes(a),r.setUTCSeconds(c),!i&&this._view.environment.lighting.autoUpdate(r,n)}_updateRenderParameters(){const e=this._view._stage;if(!e)return;const i=this._referencePosWGS84Comparable==null||V1t(this._referencePosWGS84Comparable[2],this._view.state.viewingMode);e.renderer.setParameters({shadowMap:this._view.environment.lighting.directShadowsEnabled&&i,environment:this._view.environment,weatherVisible:this._view.environmentManager.weatherVisible,qualitySettings:this._view.qualitySettings})}_resetReferencePosition(e=!1){this._cancelReferencePosUpdates(),this._referencePosMapCoords=null,this._referencePosMapCoordsRequested=null,this._referencePosResetPreserveAbsoluteTime=null,this._referencePosWGS84Comparable=null,this.notifyChange("updating"),e&&this._cameraHandler()}_requestReferencePositionUpdate(e,i=!1){if(!this.disableQueries&&(this._referencePosMapCoordsRequested?this._referencePosMapCoordsRequested.copy(e):this._referencePosMapCoordsRequested=e.clone(),this._referencePosResetPreserveAbsoluteTime=!!i,!this._referencePosUpdateQuery&&!this._referencePosUpdateTimer&&this._view.stationary)){const r=this._referencePosUpdateQuery=P2(this._referencePointUpdateDelay).then(()=>{if(this._referencePosUpdateQuery===r){const s=()=>this._referencePosUpdateQuery!==r;return this._doReferencePositionUpdateQuery(s)}}).catch(s=>{s.name==="mapcoordshelper:missing-geometry-service"&&(this.disableQueries=!0)}).then(()=>{this._referencePosUpdateQuery===r&&(this._referencePosUpdateQuery=null,this._referencePosUpdateTimer||this._executePendingReferencePositionUpdate(),this.notifyChange("updating"))}),n=this._referencePosUpdateTimer=P2(this._referencePointUpdateInterval).then(()=>{this._referencePosUpdateTimer===n&&(this._referencePosUpdateTimer=null,this._referencePosUpdateQuery||this._executePendingReferencePositionUpdate())});this.notifyChange("updating")}}async _doReferencePositionUpdateQuery(e){this._referencePosResetPreserveAbsoluteTime&&(this._preserveAbsoluteDateTime=!1),this._referencePosMapCoords?this._referencePosMapCoords.copy(this._referencePosMapCoordsRequested):this._referencePosMapCoords=this._referencePosMapCoordsRequested.clone(),this._referencePosResetPreserveAbsoluteTime=null,this._referencePosMapCoordsRequested=null;const i=await this._view.mapCoordsHelper.toGeographic(this._referencePosMapCoords);if(!e()&&!isNaN(i[0])&&!isNaN(i[1])){const r=(this._referencePosMapCoords.z??0)*this._view.mapCoordsHelper.unitInMeters;this._referencePosWGS84Comparable?(this._referencePosWGS84Comparable[0]=i[0],this._referencePosWGS84Comparable[1]=i[1],this._referencePosWGS84Comparable[2]=r):this._referencePosWGS84Comparable=[i[0],i[1],r],this._referencePosChanged()}}_executePendingReferencePositionUpdate(){const e=this._referencePosMapCoordsRequested;e&&this._requestReferencePositionUpdate(e,this._referencePosResetPreserveAbsoluteTime)}_referencePosChanged(){this._preserveAbsoluteDateTime?this._updateLighting():this._autoUpdateTimezone(this._referencePosWGS84Comparable)||this._updateLighting(),this.notifyChange("referencePositionWGS84Comparable")}_exceedsReferencePosDistThreshold(e){if(this._referencePosMapCoords){let i=this._referencePosMapCoords.distance(e);return this._view.mapCoordsHelper&&(i*=this._view.mapCoordsHelper.unitInMeters),i>this._referencePointUpdateDistThreshold}return!0}_cancelReferencePosUpdates(){const e=!!this._referencePosUpdateQuery;return this._referencePosUpdateQuery=null,this._referencePosUpdateTimer=null,e}get test(){const e=this;return{get renderer(){return e._renderer},set referencePointUpdateInterval(i){e._referencePointUpdateInterval=i},set referencePointUpdateDistThreshold(i){e._referencePointUpdateDistThreshold=i},set referencePosUpdateTimer(i){e._referencePosUpdateTimer=i},set referencePointUpdateDelay(i){e._referencePointUpdateDelay=i},set disableWeather(i){e._disableWeather=i}}}};y([w({type:Boolean,readOnly:!0})],z0.prototype,"updating",null),y([w()],z0.prototype,"disableQueries",void 0),y([w()],z0.prototype,"_disableWeather",void 0),y([w()],z0.prototype,"weatherEnabled",null),y([w()],z0.prototype,"weatherVisible",null),y([w()],z0.prototype,"referencePositionWGS84Comparable",null),y([w()],z0.prototype,"_renderer",void 0),y([w()],z0.prototype,"_referencePosWGS84Comparable",void 0),z0=y([Z("esri.views.3d.environment.SceneViewEnvironmentManager")],z0);const Z1t=new ILe,J1t=new ILe,K1t=new Date,Mge={hours:0,minutes:0,seconds:0},Q1t=st(.22,.22,.33),evt=st(.22,.22,.22);var Xn;(function(t){t[t.NONE=0]="NONE",t[t.TILT=1]="TILT",t[t.ALTITUDE=2]="ALTITUDE",t[t.DISTANCE=4]="DISTANCE",t[t.COLLISION=8]="COLLISION",t[t.ALL=15]="ALL",t[t.ALL_EXCEPT_COLLISION=7]="ALL_EXCEPT_COLLISION"})(Xn||(Xn={}));var Ki;(function(t){t[t.NONE=0]="NONE",t[t.ZOOM=1]="ZOOM",t[t.TUMBLE=2]="TUMBLE",t[t.LOOK_AROUND=3]="LOOK_AROUND",t[t.PAN=4]="PAN",t[t.ASCEND=5]="ASCEND"})(Ki||(Ki={}));var nl;(function(t){t[t.TUMBLE=0]="TUMBLE",t[t.LOOK_AROUND=1]="LOOK_AROUND"})(nl||(nl={}));function UL(t,e){return(t&e)!=0}function MU(t,e,i,r,n,s){t!==0&&(i?(s.min=Math.min(s.min,e),s.max=Math.max(s.max,e)):r!=null?(s.min-=Math.max(0,(e-s.min)*(1-r)),s.max+=Math.max(0,(e-s.max)*(1-r))):n&&(s.min-=Math.max(0,e-s.min-n),s.max+=Math.max(0,e-s.max-n)))}const Z2={selection:Xn.NONE,interactionType:Ki.NONE,interactionFactor:0,interactionStartCamera:null,interactionDirection:null,tiltMode:nl.TUMBLE};function LLe(t,e,i,r){return e=e||t.viewForward,Ne(r,e),De(r,r,Math.sign(Ve(e,i))),r}function tvt(t,e,i,r){return ovt(t,e,i,nvt(r,e,i,!0))}function ivt(t,e,i,r){const n=Ve(i,je(t,r,e));return Be(t,e,De(t,i,n))}const rvt={dir:W(),len:0,clip:yt()};function nvt(t,e,i,r){const n=rvt;return t?(i&&r&&(n.len=Tn(e,i)),Ne(n.dir,t)):r?(n.len=Tn(e,i),je(n.dir,i,e),De(n.dir,n.dir,1/n.len)):(je(n.dir,i,e),Ye(n.dir,n.dir)),n}function svt(t,e,i){const r=Ve(t,i.dir),n=-gn(t,e);if(n<0&&r>=0)return!1;if(r>-1e-6&&r<1e-6)return n>0;if((n<0||r<0)&&!(n<0&&r<0))return!0;const s=n/r;return r>0?si.clip[0]&&(i.clip[0]=s),i.clip[0]<=i.clip[1]}function ovt(t,e,i,r){r.clip[0]=0,r.clip[1]=i?r.len:Number.MAX_VALUE;for(let n=0;n=-1e-6?0:s}function gvt(t,e,i=Z2){const r=ile(t,e,i);if(r===0)return!1;const n=t.pointsOfInterest.surfaceOrigin;if(!n.renderLocation)return!1;const s=rle(t,e)+r,o=Ne(_vt,e.eye),a=LLe(e,i.interactionDirection,vvt(e,n.renderLocation,xvt),wvt);if(!px(qoe(n.renderLocation,s),Ap(e.eye,a),lN))return!1;e.eye=lN;const c=je(bvt,e.eye,o);e.center=Be(lN,e.center,c);const p=t.renderCoordsHelper.getAltitude(e.center),_=t.renderCoordsHelper.intersectInfiniteManifold(e.ray,p,lN);return _!=null&&(e.center=_),!0}function yvt(t,e,i){const r=e.interactionType;if(r===Ki.NONE)return;const{min:n,max:s}=i,{interactionStartCamera:o,interactionFactor:a}=e;if(!o)return;const c=r===Ki.ZOOM||r===Ki.PAN,p=ile(t,o),_=p===0?0:rle(t,o);i.min=n,i.max=s,MU(p,_,c,a,.05*_,i)}function rle(t,e){const i=t.pointsOfInterest.surfaceOrigin;return i.renderLocation?Tn(e.eye,i.renderLocation):0}function vvt(t,e,i){return k_(i,t.eye,e)}const aN={min:0,max:0},_vt=W(),bvt=W(),wvt=W(),xvt=W(),lN=W();function I5(t,e,i=Rf.EYE){const r=t.state.constraints;if(!r.collision.enabled)return!1;const n=Rj(t,e.eye),s=t.renderCoordsHelper.getAltitude(e.eye),o=n+r.collision.elevationMargin;if(s>=o)return!1;const a=nt(e.eye);if(je(cN,e.center,e.eye),e.eye=t.renderCoordsHelper.setAltitude(Svt,o,e.eye),i===Rf.EYE_AND_CENTER)e.center=Be(cN,e.eye,cN);else if(i===Rf.EYE_AND_CENTER_SCALE){const c=(a-s+o)/a;e.center=De(cN,e.center,c)}return!0}var Rf;(function(t){t[t.EYE=0]="EYE",t[t.EYE_AND_CENTER=1]="EYE_AND_CENTER",t[t.EYE_AND_CENTER_SCALE=2]="EYE_AND_CENTER_SCALE"})(Rf||(Rf={}));const cN=W(),Svt=W();function J2(t,e,i){t.worldUpAtPosition(e,Oge),je(Hq,i,e);const r=nt(Hq);return r===0?0:Aa(Ve(Hq,Oge)/r)}const Oge=W(),Hq=W();function DLe(t,e,i=Z2,r=!0){vR.eyeCenterDistance=0,vR.requiresTwoSteps=!1;const n=nle(t,e,i,void 0,vR);if(n===0)return!1;switch(Ep(uN,-n,e.viewRight),i.tiltMode){case nl.LOOK_AROUND:bt(_b,e.viewForward,uN),De(_b,_b,vR.eyeCenterDistance),e.center=Be(Jw,e.eye,_b);break;case nl.TUMBLE:je(_b,e.center,e.eye),bt(_b,_b,uN),e.eye=je(Jw,e.center,_b);break;default:i.tiltMode}return e.up=bt(Jw,e.up,uN),!vR.requiresTwoSteps||!r||DLe(t,e,i,!1)}function nle(t,e,i=Z2,r=Z2,n){if(!t.state.constraints.tilt)return 0;const s=e.distance,o=t.state.constraints.tilt(s,$vt);return Ivt(t,i,o),r.interactionType===Ki.TUMBLE&&UL(r.selection,Xn.ALTITUDE)&&NLe(t,r.interactionStartCamera,o),i.tiltMode===nl.LOOK_AROUND||r.tiltMode===nl.LOOK_AROUND?Evt(t,e,o,n):Tvt(t,e,o)}function Tvt(t,e,i){const r=J2(t.renderCoordsHelper,e.center,e.eye),n=r-Je(r,i.min,i.max);return VL(n)?n:0}function Evt(t,e,i,r){switch(r&&(r.requiresTwoSteps=!1),t.viewingMode){case"global":return Avt(t,e,i,r);case"local":return Cvt(t,e,i,r)}}function Cvt(t,e,i,r){const n=J2(t.renderCoordsHelper,e.center,e.eye),s=Je(n,i.min,i.max),o=n-s;if(!VL(o))return 0;if(r){const a=t.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,c=t.renderCoordsHelper.getAltitude(e.eye)-a,p=Math.cos(s);Math.abs(p)>1e-4?r.eyeCenterDistance=c/p:r.eyeCenterDistance=e.distance}return o}function Avt(t,e,i,r){const n=Mvt(t,e,Lvt),s=Je(n.tiltAtCenter,i.min,i.max);if(!VL(n.tiltAtCenter-s))return 0;let o,a;return n.centerIsOnSurface?(o=Ovt(n),a=Pvt(n,o)):(o=n.constraints.clampTilt(n.eyeCenterDistance,n.tiltAtCenter),r&&o1e-9}function Ovt(t){const{constraints:e,eyeCenterDistance:i,tiltAtCenter:r}=t;let n=r,s=e.clampTilt(i,r);const o=Zte(t,s);if(e.clampTilt(o,r)===s)return s;let a=0;for(;a<10&&VL(s-n);){const c=(n+s)/2,p=Zte(t,c);VL(e.clampTilt(p,c)-c)?n=c:s=c,a++}return s}function Zte(t,e){if(!t.centerIsOnSurface)return t.eyeCenterDistance;const i=Math.PI-Je(e,0,Math.PI),r=qf(t.radius/t.eyeRadius*Math.sin(i)),n=Math.PI-i-r,s=Math.sin(n)/Math.sin(i);if(t.eyeRadius1){const o=Math.PI-r,a=Math.PI-i-o;return Math.sin(a)/Math.sin(i)*t.eyeRadius}return s*t.eyeRadius}function Pvt(t,e){const i=qf(t.radius/t.eyeRadius*Math.sin(t.tiltAtCenter)),r=qf(t.radius/t.eyeRadius*Math.sin(e));return t.eyeRadius>t.radius?i-r:r-i}function Rvt(t,e){return t.tiltAtCenter-Math.PI/2-(e-Math.PI/2)}function Ivt(t,e,i){if(e.interactionType===Ki.NONE)return;const{interactionStartCamera:r,interactionFactor:n}=e;if(!r)return;const{min:s,max:o}=i,a=nle(t,r,Z2,e),c=a===0?0:J2(t.renderCoordsHelper,r.center,r.eye);i.min=s,i.max=o,e.interactionType===Ki.TUMBLE?(UL(e.selection,Xn.ALTITUDE)&&NLe(t,r,i),MU(a,c,!0,n,Pge,i)):MU(a,c,!1,n,Pge,i)}function NLe(t,e,i){const r=t.state.constraints;if(t.state.isLocal||!r.altitude||!e)return;const n=Al(e.center),s=Math.sqrt(n),o=e.distance,a=Tr(t.spatialReference).radius,c=r.altitude.min+a,p=r.altitude.max+a,_=(c*c-o*o-n)/(-2*s*o),x=(p*p-o*o-n)/(-2*s*o);i.min=Math.max(i.min,Math.min(Math.PI-Aa(x),i.max)),i.max=Math.min(i.max,Math.PI-Aa(_))}const _b=W(),uN=Qe(),Jw=W(),Pge=Ei(5),$vt={min:0,max:0},Lvt={constraints:null,radius:0,eyeRadius:0,centerIsOnSurface:!0,eyeCenterDistance:0,tiltAtCenter:0},vR={eyeCenterDistance:0,requiresTwoSteps:!1},Dvt=t=>t,Qj=t=>t*t,sle=t=>1-Qj(1-t),Nvt=t=>t<.5?Qj(2*t)/2:(sle(2*(t-.5))+1)/2,ole=t=>t*t*t,FLe=t=>1-ole(1-t),kLe=t=>t<.5?ole(2*t)/2:(FLe(2*(t-.5))+1)/2,ale=t=>t*t*t*t,zLe=t=>1-ale(1-t),Fvt=t=>t<.5?ale(2*t)/2:(zLe(2*(t-.5))+1)/2,lle=t=>t*t*t*t*t,ULe=t=>1-lle(1-t),kvt=t=>t<.5?lle(2*t)/2:(ULe(2*(t-.5))+1)/2,cle=t=>1-Math.cos(t*Math.PI/2),VLe=t=>1-cle(1-t),zvt=t=>t<.5?cle(2*t)/2:(VLe(2*(t-.5))+1)/2,ule=t=>2**(10*(t-1)),i6=t=>1-ule(1-t),Uvt=t=>t<.5?ule(2*t)/2:(i6(2*(t-.5))+1)/2,hle=t=>-(Math.sqrt(1-t*t)-1),BLe=t=>1-hle(1-t),Vvt=t=>t<.5?hle(2*t)/2:(BLe(2*(t-.5))+1)/2;function u0(t){const e=2*(t-Math.sqrt((t-1)*t)),i=e/2/t;return r=>ri=Math.PI&&(r=2*Math.PI-r);const n=Math.abs(e.pitch-this.pitch);return i.rotate=Math.max(r,n),i.sourceZoom=this.distance,i.targetZoom=e.distance,i}interpolate(e,i,r){this.viewingMode===_t.Global?glt(e.center,i.center,r.pan,this.center):Qr(this.center,e.center,i.center,r.pan),this.distance=isFinite(i.distance)?ui(e.distance,i.distance,r.zoom):e.distance,this.pitch=ui(e.pitch,i.pitch,r.rotate);let n=e.yaw;const s=i.yaw;Math.abs(s-n)>=Math.PI&&(n+=2*(n0&&De(r,r,-1)):Ne(r,e),Wt(lh,r,Td.upward),Ye(lh,lh),_F(Td.sideway,lh,Td.upward)}};const OU={desiredScreenFlow:2,minDuration:500,maxDuration:8e3};let o_t=class GLe{constructor(e){this._createCamera=e,this.compared={sourceZoom:0,targetZoom:0,pan:0,rotate:0},this.settings={desiredScreenFlow:OU.desiredScreenFlow},this.source=e(),this.target=e()}clone(){const e=new GLe(this._createCamera);return e.copyFrom(this),e}copyFrom(e){this.update(e.source,e.target,e.settings)}update(e,i,r){this.source!==e&&this.source.copyFrom(e),this.target!==i&&this.target.copyFrom(i),this.compared=this.source.compareTo(this.target,this.compared),this.settings.desiredScreenFlow=r.desiredScreenFlow!=null?r.desiredScreenFlow:OU.desiredScreenFlow,this.desiredPixelFlow=this.settings.desiredScreenFlow*this.target.size,this.halfWindowSize=this.target.size/2}halfWindowPanAtZoom(e){const i=this.target.pixelsPerPanAtZoom(e);return this.halfWindowSize/i}get hasZoom(){return Math.abs(this.compared.sourceZoom-this.compared.targetZoom)>1e-5}get hasPan(){return this.compared.pan>1e-9}get hasRotate(){return this.compared.rotate>1e-9}},a_t=class{constructor(){this.segments=[]}get time(){return this.segments.reduce((e,i)=>e+i.time,0)}interpolateComponentsAt(e,i){e=Math.min(Math.max(e,0),1),e*=this.time;let r=0,n=0;const s=this.definition;for(let o=0;on?1:-1,this._panPixelsAtSource=i.pan*e.source.pixelsPerPanAtZoom(r);const s=(e.source.pixelsPerRotateAtZoom(r)+e.target.pixelsPerRotateAtZoom(n))/2;this._rotatePixels=i.rotate*s}_updatePixelFlow(){const e=this.definition.compared.sourceZoom,i=this.definition.compared.targetZoom,{hasZoom:r,hasPan:n,hasRotate:s}=this.definition;let o=0,a=0;r&&(n&&(o=(i/e-1)/(-1/(this._zoomSign*this.definition.halfWindowSize)*Math.LN2*this._panPixelsAtSource)),s&&(a=this._zoomSign*(Math.log(e/i)/Math.LN2)*this.definition.halfWindowSize/this._rotatePixels)),this._zoomPixelFlow=0,this._panPixelFlow=0,this._rotatePixelFlow=0;const c=this.definition.desiredPixelFlow;if(r&&n&&s){const p=o+a+o*a;this._zoomPixelFlow=o*a/p*c,this._panPixelFlow=a/p*c,this._rotatePixelFlow=o/p*c}else if(r&&n){const p=1+o;this._zoomPixelFlow=o/p*c,this._panPixelFlow=1/p*c}else if(r&&s){const p=1+a;this._zoomPixelFlow=a/p*c,this._rotatePixelFlow=1/p*c}else if(n&&s){const p=this._panPixelsAtSource/this._rotatePixels,_=1+p;this._panPixelFlow=p/_*c,this._rotatePixelFlow=1/_*c}else n?this._panPixelFlow=c:r?this._zoomPixelFlow=c:s&&(this._rotatePixelFlow=c);this._time=s?this.rotateTime:r?this.zoomTime:n?this.panTime:0}get rotateTime(){return this.definition.hasRotate?this._rotatePixels/this._rotatePixelFlow:0}get zoomTime(){return this.definition.hasZoom?this._zoomSign*(Math.log(this.definition.compared.sourceZoom/this.definition.compared.targetZoom)/Math.LN2)*this.definition.halfWindowSize/this._zoomPixelFlow:0}get panTime(){if(this.definition.hasPan){if(this.definition.hasZoom){const e=-1/(this._zoomSign*this.definition.halfWindowSize)*Math.LN2,i=e*this._panPixelsAtSource;return Math.log(i*(this._zoomPixelFlow/this._panPixelFlow)+1)/(e*this._zoomPixelFlow)}return this._panPixelsAtSource/this._panPixelFlow}return 0}_interpolateComponentsZoom(e){if(e===0||e===1)return e;if(this.definition.hasZoom){const i=this.definition.compared.sourceZoom,r=this.definition.compared.targetZoom;return(i*(i/r)**-e-i)/(r-i)}return e}_interpolateComponentsPan(e){if(e===0||e===1)return e;if(this.definition.hasPan&&this.definition.hasZoom){const i=-1/(this._zoomSign*this.definition.halfWindowSize)*this._zoomPixelFlow;return 1/this._panPixelsAtSource*(this._panPixelFlow*(2**(i*e*this._time)-1))/(i*Math.LN2)}return e}_interpolateComponentsRotate(e){return e}interpolateComponentsAt(e,i){e=Math.min(Math.max(e,0),1);const r=this._interpolateComponentsZoom(e),n=this._interpolateComponentsPan(e),s=this._interpolateComponentsRotate(e);return i?(i.zoom=r,i.pan=n,i.rotate=s):i={zoom:r,pan:n,rotate:s},i}};function l_t(t,e,i){const r=e-t.compared.sourceZoom,n=t.halfWindowPanAtZoom(r);return-t.halfWindowSize*(i.ascensionFactor*Math.LN2*t.compared.pan+n)*Math.log(t.compared.sourceZoom/e)/(t.desiredPixelFlow*Math.LN2*n)}function c_t(t,e,i){const r=1/e,n=Math.log(t.compared.sourceZoom*r),s=1/t.desiredPixelFlow,o=1/Math.LN2,a=e-t.compared.sourceZoom,c=1/a,p=(i.ascensionFactor*Math.LN2*t.compared.pan+t.halfWindowPanAtZoom(a))/t.halfWindowPanAtZoom(1);return t.halfWindowSize*r*s*o*c*p-t.halfWindowSize*n*s*o*c+t.halfWindowSize*n*s*o*p/(a*a)}function u_t(t,e,i){const r=e-t.compared.sourceZoom,n=1/r,s=1/e,o=Math.log(t.compared.sourceZoom*s),a=(i.ascensionFactor*Math.LN2*t.compared.pan+t.halfWindowPanAtZoom(r))/t.halfWindowPanAtZoom(1);return t.halfWindowSize*n*(-2*n*s*a+2*n*o+2*s-2*o*a/(r*r)-a/(e*e))/(t.desiredPixelFlow*Math.LN2)}function h_t(t,e){return-t.halfWindowSize*Math.log(t.compared.sourceZoom/e)/(t.desiredPixelFlow*Math.LN2)}function d_t(t,e){return t.halfWindowSize/(e*t.desiredPixelFlow*Math.LN2)}function p_t(t,e){return-t.halfWindowSize/(e*e*t.desiredPixelFlow*Math.LN2)}function f_t(t,e,i){return-t.compared.pan*t.halfWindowSize*(i.ascensionFactor+i.descensionFactor-1)/(t.desiredPixelFlow*t.halfWindowPanAtZoom(e))}function m_t(t,e,i){return t.compared.pan*t.halfWindowSize*(i.ascensionFactor+i.descensionFactor-1)/(t.desiredPixelFlow*t.halfWindowPanAtZoom(e*e))}function g_t(t,e,i){return-2*t.compared.pan*t.halfWindowSize*(i.ascensionFactor+i.descensionFactor-1)/(t.desiredPixelFlow*t.halfWindowPanAtZoom(e*e*e))}function y_t(t,e,i){return t.halfWindowSize*(-t.halfWindowPanAtZoom(e)-i.descensionFactor*Math.LN2*t.compared.pan+t.halfWindowPanAtZoom(t.compared.targetZoom))*Math.log(e/t.compared.targetZoom)/(t.desiredPixelFlow*Math.LN2*t.halfWindowPanAtZoom(-e+t.compared.targetZoom))}function v_t(t,e,i){const r=Math.log(e/t.compared.targetZoom),n=1/t.desiredPixelFlow,s=1/Math.LN2,o=-e+t.compared.targetZoom,a=1/o,c=(-t.halfWindowPanAtZoom(e)-i.descensionFactor*Math.LN2*t.compared.pan+t.halfWindowPanAtZoom(t.compared.targetZoom))/t.halfWindowPanAtZoom(1);return-t.halfWindowSize*r*n*s*a+t.halfWindowSize*r*n*s*c/(o*o)+t.halfWindowSize*n*s*a*c/e}function __t(t,e,i){const r=e-t.compared.targetZoom,n=1/r,s=1/e,o=Math.log(e/t.compared.targetZoom),a=(t.halfWindowPanAtZoom(e)+i.descensionFactor*Math.LN2*t.compared.pan-t.halfWindowPanAtZoom(t.compared.targetZoom))/t.halfWindowPanAtZoom(1);return t.halfWindowSize*n*(-2*n*s*a-2*n*o+2*s+2*o*a/(r*r)-a/(e*e))/(t.desiredPixelFlow*Math.LN2)}function b_t(t,e){return t.halfWindowSize*Math.log(e/t.compared.targetZoom)/(t.desiredPixelFlow*Math.LN2)}function w_t(t,e){return t.halfWindowSize/(e*t.desiredPixelFlow*Math.LN2)}function x_t(t,e){return-t.halfWindowSize/(e*e*t.desiredPixelFlow*Math.LN2)}function S_t(t){const e=Math.LN2*t.compared.pan,i=t.compared.sourceZoom-t.compared.targetZoom,r=t.halfWindowPanAtZoom(i),n=t.halfWindowSize*Math.log(t.compared.sourceZoom/t.compared.targetZoom)/(t.desiredPixelFlow*Math.LN2*r);return t.compared.sourceZoom<=t.compared.targetZoom?n*(e-r):n*(e+r)}function T_t(t,e){let i=E_t(t,e);const r={ascensionFactor:e.ascensionFactor!=null?e.ascensionFactor:.5,descensionFactor:e.descensionFactor!=null?e.descensionFactor:.5},n=r.ascensionFactor===0,s=r.descensionFactor===0,o=n?h_t:l_t,a=n?d_t:c_t,c=n?p_t:u_t,p=s?b_t:y_t,_=s?w_t:v_t,x=s?x_t:__t,S=U=>o(t,U,r)+f_t(t,U,r)+p(t,U,r),C=U=>a(t,U,r)+m_t(t,U,r)+_(t,U,r),M=U=>c(t,U,r)+g_t(t,U,r)+x(t,U,r);let P=S(i);const $=S_t(t);let F;const z=e.maximumIterations||20,k=e.maximumDistance!=null?e.maximumDistance:1/0;for(F=0;F=k&&j<0){if(!isFinite(k))return null;i=k,P=S(i);break}if(i-=j,i$*(1-.3)||i0&&(n.definition?n.definition.copyFrom(this.definition):n.definition=this.definition.clone(),n.definition.copyFrom(this.definition),n.definition.compared.sourceZoom=e,n.definition.compared.targetZoom=e,n.definition.compared.pan=this.definition.compared.pan*c,n.definition.compared.rotate=this.definition.compared.rotate*c,n.update(),this.segments.push(n)),s.definition?s.definition.copyFrom(this.definition):s.definition=this.definition.clone(),s.definition.compared.sourceZoom=e,s.definition.compared.pan=this.definition.compared.pan*a,s.definition.compared.rotate=this.definition.compared.rotate*a,s.update(),this._descensionSegment=s,this.segments.push(s)}_updateWithoutApex(){const[e]=this._preallocSegments;e.update(this.definition),this.segments.push(e)}};const A_t={zoom:0,pan:0,rotate:0};let M_t=class{get time(){return this._time}constructor(e){this._createCamera=e,this._time=0,this.definition=new o_t(e),this.path=new C_t}update(e,i,r){this.definition.update(e,i,r),this.path.update(this.definition,r),this._time=this._applyTimeSettings(WSe(isFinite(this.path.time)?this.path.time:0),r),this._easing=r.easing??(this._time>=1e3?jLe:i6)}cameraAt(e,i){i=i||this._createCamera(),e=Math.min(Math.max(0,e),1),e=this._normalizedEasing(e);const r=this.path.interpolateComponentsAt(e,A_t);return i.interpolate(this.definition.source,this.definition.target,r),i}_normalizedEasing(e){const i=this._easing(0,this._time),r=this._easing(1,this._time);return(this._easing(e,this._time)-i)/(r-i)}_applyTimeSettings(e,i){const r=i.speedFactor!=null?i.speedFactor:1;i.duration!=null?e=i.duration:i.speedFactor!=null&&(e=e/r);const n=i.minDuration!=null?i.minDuration:OU.minDuration/r,s=i.maxDuration!=null?i.maxDuration:OU.maxDuration/r;return Math.min(Math.max(n,e),s)}};const O_t=W();let P_t=class{get finished(){return this.currentTime>=this._animation.time}get time(){return this._animation.time}constructor(e){this.currentTime=0,this._animation=new M_t(()=>new Ige(e)),this._current=new Ige(e)}update(e,i,r){const n=this._animation.definition.source,s=this._animation.definition.target,o=je(O_t,i.center,e.center),a=nt(o);a>=1e-5?(o[0]/=a,o[1]/=a,o[2]/=a):(o[0]=0,o[1]=1,o[0]=0),Ne(n.lookAtDirection,o),Ne(s.lookAtDirection,o),n.copyFromRenderCamera(e),s.copyFromRenderCamera(i),this._current.copyFrom(n),this._animation.update(n,s,r),this.currentTime=0,e.almostEquals(i)&&(this.currentTime=this._animation.time)}cameraAt(e,i){return this._animation.cameraAt(e,this._current),i=i||new si,this._current.copyToRenderCamera(i),i}step(e,i){return this.finished||(this.currentTime=this.currentTime+WSe(e),this.currentTime>=this.time&&(this.currentTime=this.time)),this.cameraAt(this.currentTime/this.time,i)}};var As;(function(t){t.Ready="ready",t.Rejected="rejected",t.Running="running",t.Stopped="stopped",t.Finished="finished"})(As||(As={}));let Uv=class extends ze{constructor(e){super(e),this.state=As.Ready}get active(){return this.state===As.Running}get isInteractive(){return!1}get canStop(){return!1}stopController(){return!!this.canStop&&(this.state=As.Stopped,!0)}finishController(){this.state=As.Finished}get steppingFinished(){return!1}};y([w({constructOnly:!0})],Uv.prototype,"view",void 0),y([w({readOnly:!0})],Uv.prototype,"active",null),y([w()],Uv.prototype,"state",void 0),y([w({readOnly:!0})],Uv.prototype,"isInteractive",null),Uv=y([Z("esri.views.3d.state.controllers.CameraController")],Uv);let BL=class extends Uv{constructor(){super(...arguments),this._asyncResult=null}get canStop(){return!0}set asyncResult(e){this._asyncResult&&(this._asyncResult.reject(ur()),this._asyncResult=null),this.state===As.Finished||this.state===As.Stopped?(Gy(e),this.state===As.Finished?e.resolve():e.reject(ur())):this._asyncResult=e}get asyncResult(){return this._asyncResult}onControllerStart(){this.state=As.Running,this.viewAnimation!=null&&this.viewAnimation.when(()=>this.updateStateFromViewAnimation(),()=>this.updateStateFromViewAnimation())}updateStateFromViewAnimation(){this.viewAnimation==null||this.state!==As.Ready&&this.state!==As.Running||(this.viewAnimation.state===OP.State.FINISHED?this.finish():this.viewAnimation.state===OP.State.STOPPED&&(this.state=As.Stopped))}onControllerEnd(){this.viewAnimation==null||this.viewAnimation.done||(this.state===As.Finished?this.viewAnimation.finish():this.state===As.Stopped&&this.viewAnimation.stop()),this._asyncResult&&(this.state===As.Finished?this._asyncResult.resolve():this._asyncResult.reject(ur()))}finish(){this.finishController()}};BL=y([Z("esri.views.3d.state.controllers.AnimationController")],BL);let Kv=class extends BL{get intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(e){super(e),this.mode="interaction",this._hasTarget=!1}initialize(){this.animation=new P_t(this.view.state.viewingMode),this.viewAnimation=this.mode==="interaction"?null:new OP}get isInteractive(){return this.mode==="interaction"}begin(e,i){this._hasTarget=!0;const r=this.animationSettings(i);hN.copyFrom(this.view.state.camera);const n=Mp(this.view.state.viewingMode);this.intersectionHelper.intersectRay(hN.ray,n,$ge)&&(hN.center=$ge),this.animation.update(hN,e,r),this.animation.finished&&this.finish()}finish(){this.animation.currentTime=this.animation.time,super.finish()}get steppingFinished(){return this._hasTarget&&this.animation.finished}stepController(e,i){this._hasTarget&&this.animation.step(e,i)}onControllerEnd(e){this._hasTarget&&(this.animation.cameraAt(this.animation.currentTime/this.animation.time,e),this.animation.currentTime=this.animation.time),super.onControllerEnd(e)}animationSettings(e={}){return{apex:{maximumDistance:this.view.state.constraints.clampAltitude(1/0)/6,ascensionFactor:void 0,descensionFactor:void 0},...e,easing:typeof e.easing=="string"?Qvt[e.easing]:e.easing}}};y([w({constructOnly:!0})],Kv.prototype,"mode",void 0),y([w({readOnly:!0})],Kv.prototype,"isInteractive",null),Kv=y([Z("esri.views.3d.state.controllers.PointToPointAnimationController")],Kv);const hN=new si,$ge=W();function eG(t=I_t){return[t[0],t[1],t[2],t[3]]}function jL(t,e){return R_t(t[0],t[1],t[2],e,joe.get())}function R_t(t,e,i,r,n=eG()){return n[0]=t,n[1]=e,n[2]=i,n[3]=r,n}function dle(t,e,i){return Wt(i,t,e),Ye(i,i),i[3]=dj(t,e),i}const I_t=[0,0,1,0];function vsi(t,e,i=Qo()){return ple(t,mm(e),i),Ye(i.direction,i.direction),i}function ple(t,e,i){return $_t(t,t.screenToRender(e,xt.get()),i)}function $_t(t,e,i){const r=ea(xt.get(),e);if(r[2]=0,!t.unprojectFromRenderScreen(r,i.origin))return null;const n=ea(xt.get(),e);n[2]=1;const s=t.unprojectFromRenderScreen(n,xt.get());return s==null?null:(je(i.direction,s,i.origin),i)}function $5(t,e,i){return fle(t,t.screenToRender(e,xt.get()),i)}function fle(t,e,i){Ne(i.origin,t.eye);const r=Ie(xt.get(),e[0],e[1],1),n=t.unprojectFromRenderScreen(r,xt.get());return n==null?null:(je(i.direction,n,i.origin),i)}function mle(t,e,i,r){const n=$5(e,i,L_t);return px(t,n,r)}const L_t=Qo();var LP;(function(t){t[t.Ellipsoid=0]="Ellipsoid",t[t.Silhouette=1]="Silhouette"})(LP||(LP={}));const HLe=30,PU=[1,3e8],tG=80,qLe=8,WLe=200,YLe=1508e5,XLe=5,ZLe=50,D_t=5,N_t=10,Wq=90,$E={exclude:new Set([Zw])};function ET(t,e,i){return i[0]=e[0]/(t.fullWidth/t.pixelRatio),i[1]=e[1]/(t.fullHeight/t.pixelRatio),i}function Jte(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function K2(t,e,i){const r=Ep(Goe.get(),i[3],i);r==null||dse(r,gs)||(je(fn,t.eye,e),bt(fn,fn,r),t.eye=Be(fn,fn,e),je(fn,t.center,e),bt(fn,fn,r),t.center=Be(fn,fn,e),t.up=bt(fn,t.up,r))}function F_t(t,e,i,r){return CE(t,ple(e,i,vle),r)}function Kte(t,e,i,r){return CE(t,$5(e,i,vle),r)}function gle(t,e,i,r){const n=xt.get();let s=1-i;je(n,e,t.eye);const o=nt(n);let a=o*(1-s);s>=0&&aNge.Elevation?Ja.Horizontal:($5(t,e,Gge),-Math.sign(t.relativeElevation)*(.5*Math.PI+dj(t.eye,Gge.direction))i?-(e-i)/(o*i):e<-i?Math.PI-(e+i)/(o*i):Aa(e/i),s=t>i?-(t-i)/(o*i):t<-i?Math.PI-(t+i)/(o*i):Aa(t/i),(s-n)*i}function k_t(t,e,i,r,n,s,o,a,c,p){const _=zge(t[2],e[2],s[3],a),x=c?zge(t[0],e[0],s[3],180):e[0]-t[0],S=Math.sin(o)*x-Math.cos(o)*_,C=Math.cos(o)*x+Math.sin(o)*_;Ye(fn,n);const M=c?S/Math.sqrt(Math.abs(s[3]**2-Ve(i,fn)**2)):S/s[3],P=C/Math.sqrt(Math.abs(s[3]**2-Ve(i,r)**2));or(p,M,P)}function i9e(t,e,i,r,n,s,o,a,c,p){Wt($U,t,e),bee(s.up,s.eye,fN,mN,gN),bee([0,0,1],s.eye,o_,E2,o9e),Ne(i,E2),Ne(r,o_),Ye(i,i),De(i,i,nt($U)),P0e(t,Ye(mN,mN),Ye(gN,gN),Ye(fN,fN),Uge),P0e(e,mN,gN,fN,Vge),k_t(Uge,Vge,t,o_,E2,o,a,c,p,n)}function z_t(t,e,i,r,n,s,o){Ep(RU,n,r),Ep(IU,o,s),sn(jM,RU,IU),je(e,t,i),bt(e,e,jM),Be(e,e,i)}function r9e(t,e,i,r,n,s){Ep(RU,r,i),Ep(IU,s,n),sn(jM,RU,IU),je(fn,t.eye,e),bt(fn,fn,jM),t.eye=Be(fn,fn,e),je(fn,t.center,e),bt(fn,fn,jM),t.center=Be(fn,fn,e),je(fn,t.up,e),bt(fn,fn,jM),t.up=Be(fn,fn,e)}function yle(t,e,i,r,n,s){return(Math.abs(r)>Math.PI-dN.Angle||Math.abs(r)i)&&s.aboveGround&&nc&&(p=Ao(i,$x),i9e(i,$x,E2,o_,_R,vN,t,n,s,o),r9e(vN,t,o_,_R[1],E2,_R[0]),z_t($x,$x,t,o_,_R[1],E2,_R[0]),_=Ao(i,$x),_0,o=!0),this._tmpCamera.copyFrom(r.camera),s?this.intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter):this.intersectionHelper.intersectRay(this._tmpCamera.ray,this._intersector,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:Ne(this._zoomLocation,this._tmpCamera.center),this._updateCamera(this._tmpCamera,e,this._zoomLocation,i,o),this.begin(this._tmpCamera)}animationSettings(){return{duration:600,easing:i6}}_updateCamera(e,i,r,n,s){const o=Tr(this.view.spatialReference),a=iG(e,n,o),c=Math.abs(this.view.camera.position.z);Ye(bN,e.eye),De(bN,bN,-1),$5(e,n,this._tmpRayDir),Ye(this._tmpRayDir.direction,this._tmpRayDir.direction);const p=Je(Math.min(qLe,1/Math.abs(Ve(bN,this._tmpRayDir.direction)))*c,WLe,YLe);if(a===Ja.Horizontal){let _=Hge**i;this._sphere[3]=nt(r),je(this._tmpViewDir,e.center,e.eye);const x=Math.min(nt(this._tmpViewDir),p);let S=x*_;if(_<=1&&S1e-12&&mle(this._sphere,e,n,this._targetOnSphere)&&U_t(this._sphere,e,r,this._targetOnSphere,this.view.camera.heading,this.view.camera.tilt,!0)}else{let _=Hge**Math.abs(i);const x=i>0?1:-1;je(this._tmpViewDir,r,e.eye);const S=nt(this._tmpViewDir),C=this.view._stage.renderView.getMinimalDepthForArea(null,n[0],n[1],this.view.state.camera,G_t);let M=C??p;M=s&&i>0?Math.min(M,S):M,De(this._tmpRayDir.direction,this._tmpRayDir.direction,M),Be(r,this._tmpRayDir.origin,this._tmpRayDir.direction);let P=M*_;const $=Math.max(Zq,1.01*e.nearFar[0]);if(i>0&&P<$&&(P=$,_=P/M),Math.abs(M-P)<1e-6)return;De(this._tmpRayDir.direction,this._tmpRayDir.direction,x*(1-_)),e.eye=Be(_N,e.eye,this._tmpRayDir.direction),e.center=Be(_N,e.center,this._tmpRayDir.direction)}I5(this.view,e)}};LU=y([Z("esri.views.3d.state.controllers.global.ZoomStepController")],LU);const _N=W(),bN=W();let sk,ok=null;const MO=new Map;async function bsi(t){ok==null&&(sk==null&&(sk=we(()=>import("./VoxelWasmPerSceneView-xko8AJDS.js"),__vite__mapDeps([]))),ok=await sk);const e=t.view;let i=MO.get(e);return i||(i=new ok.default({view:e}),MO.set(e,i)),i.addVoxelLayer(t)}function HL(t){return MO.get(t)}function wsi(t){const e=t.view,i=MO.get(e);i&&i.removeVoxelLayer(t)<1&&(MO.delete(e),MO.size===0&&(sk=null,ok=null))}const H_t=.6,q_t=4,W_t=60;let DU=class extends Kv{constructor(){super(...arguments),this._zoomLocation=W(),this._tmpCamera=new si,this._tmpRayDir=W(),this._tmpCenter=W(),this._constraintOptions={selection:Xn.ALL,interactionType:Ki.ZOOM,interactionFactor:null,interactionStartCamera:new si,interactionDirection:null,tiltMode:nl.TUMBLE}}zoomStep(e,i){if(!this.active)return;const r=this.view.state,{interactionStartCamera:n}=this._constraintOptions;n&&(this.animation.finished?n.copyFrom(r.camera):this.animation.cameraAt(1,n)),this._tmpCamera.copyFrom(r.camera);const s=Mp(this.view.state.viewingMode);let o=!1;e>0?(o=this.intersectionHelper.intersectScreenFreePointFallback(i,this._zoomLocation,this.view.map.ground.opacity===0?$E:{}),this.intersectionHelper.intersectRay(this._tmpCamera.ray,s,this._tmpCenter)&&(this._tmpCamera.center=this._tmpCenter)):this.intersectionHelper.intersectRay(this._tmpCamera.ray,s,this._zoomLocation)?this._tmpCamera.center=this._zoomLocation:Ne(this._zoomLocation,this._tmpCamera.center);const a=H_t**e;let c=this.view._stage.renderView.getMinimalDepthForArea(HL(this.view),i[0],i[1],this.view.state.camera,W_t);je(wN,this._tmpCamera.eye,this._zoomLocation),Ye(wN,wN);const p=Je(Math.min(qLe,1/Math.abs(Ve(Y_t,wN)))*Math.abs(this.view.camera.position.z),WLe,YLe);if(c=c??p,c){const _=W();je(_,this._zoomLocation,this._tmpCamera.eye),(cthis._handleDoubleClick(r))}_handleDoubleClick(e){const i=e.data;if(X_t(i,"primary")){const r=this._view.state.isGlobal?new LU({view:this._view,mode:"animation"}):new DU({view:this._view,mode:"animation"});this._view.state.switchCameraController(r),r.zoomStep(Math.log(.5)/Math.log(.6),ss(i.x,i.y)),e.stopPropagation()}}};function J_t(t,e,i){return t===_t.Global?new Q_t(i):new K_t(e,i)}let K_t=class{constructor(e,i){this._elevationProvider=e,this._referenceEllipsoid=Tr(i),this._unitInMeters=xs(i,this._referenceEllipsoid.metersPerDegree)}compute(e,i,r,n,s){var k;s||(s={near:0,far:0});let o=e[2]*this._unitInMeters;const a=o,c=o-n,p=(k=this._elevationProvider)==null?void 0:k.visibleElevationBounds;p&&(o=c>=0?a-this._unitInMeters*p.min:this._unitInMeters*p.max-a);const _={x:(r=r??new Vi({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0})).xmax-r.xmin,y:r.ymax-r.ymin,z:4*Math.max(r.xmax-r.xmin,r.ymax-r.ymin)},x=Math.max(_.x,_.y,_.z);je(Lx,i,e),fC[0]=Lx[0]>0?r.xmax:r.xmin,fC[1]=Lx[1]>0?r.ymax:r.ymin,fC[2]=Lx[2]>0?x/2:-x/2,je(fC,fC,e),Ye(Lx,Lx);const S=1.1*Ve(fC,Lx)*this._unitInMeters,C=Math.sqrt(o*(o+2*this._referenceEllipsoid.radius)),M=Math.max(r.xmax-r.xmin,r.ymax-r.ymin),P=M*ibt*this._unitInMeters,$=M*rbt*this._unitInMeters,F=Je((o-$)/(P-$),0,1)**3,z=Math.min(ui(C,S,F),C)*Math.max(Math.log(Math.abs(c)),1);return a9e(Math.min(z,Math.max(34064e4,x))/this._unitInMeters,ebt,this._unitInMeters,s)}},Q_t=class{constructor(e){this._referenceEllipsoid=Tr(e)}compute(e,i,r,n,s){s||(s={near:0,far:0});const o=nt(e),a=o-this._referenceEllipsoid.radius,c=this._referenceEllipsoid.radius+Math.min(0,n),p=Math.abs(a-n),_=Math.max(p,Math.abs(a)),x=Math.sqrt(_*(_+2*c)),S=o+this._referenceEllipsoid.radius;return a9e(1.2*ui(x,S,Eae(_)),Je(2e4-(Math.log(_)-7.983)/9.011*19e3,1e3,2e4),1,s)}};function a9e(t,e,i,r){const n=tbt/i;return t/e>n?(r.far=t,r.near=r.far/e):(r.near=n,r.far=r.near*e),r}const ebt=2e4,tbt=2,ibt=.001,rbt=1e-4,fC=W(),Lx=W();let ak=class extends ze{constructor(e){super(e)}initialize(){this.addHandles(this.view.basemapTerrain.on("elevation-change",e=>this._handleElevationChangeEvent(e)))}_handleElevationChangeEvent(e){if(this.view.state.cameraController)return;const i=this.view.state.camera;e.spatialReference!=null&&MIe(this.view,i,e.extent,e.spatialReference)&&this._applyToCurrentCamera()}_applyToCurrentCamera(){this.view.state.updateCamera(e=>I5(this.view,e,Rf.EYE_AND_CENTER))}};y([w({constructOnly:!0})],ak.prototype,"view",void 0),ak=y([Z("esri.views.3d.state.ElevationCollisionConstraint")],ak);let _4=class extends ze{constructor(e){super(e),this.nearFarHeuristic=J_t(e.view.state.viewingMode,e.view.basemapTerrain,e.view.renderCoordsHelper.spatialReference)}initialize(){this.addHandles([_e(()=>{var e,i,r,n;return[(i=(e=this.view.constraints)==null?void 0:e.clipDistance)==null?void 0:i.near,(n=(r=this.view.constraints)==null?void 0:r.clipDistance)==null?void 0:n.far]},()=>this._clipDistanceNearFarChanged()),_e(()=>{var e,i;return(i=(e=this.view.constraints)==null?void 0:e.clipDistance)==null?void 0:i.mode},()=>this._updateNearFar()),this.view.state.events.on("before-camera-change",e=>this._updateCameraNearFar(e)),_e(()=>this.view.renderDataExtent,()=>this._updateNearFar(),Li),_e(()=>{var e,i,r,n;return[(i=(e=this.view.constraints)==null?void 0:e.altitude)==null?void 0:i.min,(n=(r=this.view.constraints)==null?void 0:r.altitude)==null?void 0:n.max]},()=>this._updateAltitude(),Li),_e(()=>{var e,i;return(i=(e=this.view.constraints)==null?void 0:e.tilt)==null?void 0:i.max},()=>this._updateTiltMax(),Li),_e(()=>{var e,i;return(i=(e=this.view.constraints)==null?void 0:e.tilt)==null?void 0:i.mode},()=>this._updateTilt(),Li),_e(()=>{var e;return(e=this.view.state)==null?void 0:e.camera},()=>this._updateTiltAutoMax(),Li),_e(()=>{var e,i,r,n,s,o;return[(r=(i=(e=this.view.map)==null?void 0:e.ground)==null?void 0:i.navigationConstraint)==null?void 0:r.type,(o=(s=(n=this.view.state)==null?void 0:n.constraints)==null?void 0:s.collision)==null?void 0:o.enabled]},()=>this._updateCollision(),Li)]),this.view.state.isLocal&&this.addHandles(_e(()=>this.view.renderDataExtent,e=>this._updateLocalSurfaceDistance(e),Qt)),this._updateNearFar(),this.view.state.viewingMode!==_t.Local&&this._updateAltitude(),this._updateTilt(),this._updateCollision(),this._set("surfaceCollisionConstraint",new ak({view:this.view}))}destroy(){this.surfaceCollisionConstraint&&(this.surfaceCollisionConstraint.destroy(),this._set("surfaceCollisionConstraint",null))}_clipDistanceNearFarChanged(){var i;const e=(i=this.view.constraints)==null?void 0:i.clipDistance;e&&e.mode!=="auto"&&this.view.state.updateCamera(r=>this._updateCameraNearFarManual(r,e))}_updateNearFar(){this.view.state.updateCamera(e=>this._updateCameraNearFar(e))}_updateCameraNearFar(e){const i=this.view.constraints&&this.view.constraints.clipDistance;(i?i.mode:"auto")==="manual"?this._updateCameraNearFarManual(e,i):this._updateCameraNearFarAuto(e,i)}_updateCameraNearFarAuto(e,i){this.nearFarHeuristic.compute(e.eye,e.center,this.view.renderDataExtent,Rj(this.view,e.eye),e),i&&i.autoUpdate(e.near,e.far)}_updateCameraNearFarManual(e,i){i&&(e.near=i.near,e.far=i.far)}_updateCollision(){var n,s,o;const e=(o=(s=(n=this.view.map)==null?void 0:n.ground)==null?void 0:s.navigationConstraint)==null?void 0:o.type,i=!e||e==="stay-above",r=this.view.state.constraints.collision;if(i!==r.enabled){r.enabled=i,i&&this._reapplyConstraints(Xn.COLLISION);const a=this.view.constraints&&this.view.constraints.tilt;a&&a.mode!=="auto"||this._updateTiltAuto()}}_updateAltitude(){const e=this.view.constraints&&this.view.constraints.altitude;e&&this.view.state.viewingMode!==_t.Local?this.view.state.constraints.altitude={min:e.min,max:e.max}:this.view.state.constraints.altitude=null,this._reapplyConstraints()}_updateTiltMax(){const e=this.view.constraints&&this.view.constraints.tilt;e&&e.mode!=="auto"&&(this._updateTiltManual(e),this._reapplyConstraints())}_updateTilt(){const e=this.view.constraints&&this.view.constraints.tilt;(e?e.mode:"auto")==="manual"?this._updateTiltManual(e):this._updateTiltAuto(),this._reapplyConstraints()}_updateTiltManual(e){const i=this.view.state.constraints;i.tilt=i.createConstantMaxTilt(Ei(e.max))}_updateTiltAuto(){const e=this.view.state.constraints;e.tilt=e.createDefaultTilt(),this._updateTiltAutoMax()}_updateTiltAutoMax(){const e=this.view.constraints&&this.view.constraints.tilt;if(!e||e.mode!=="auto")return;const i=this.view.state.constraints;if(i.tilt){const r=i.tilt(this.view.state.camera.distance).max;e.autoUpdate(mu(r))}}_updateLocalSurfaceDistance(e){if(e==null)return;let i=Math.max(e.width,e.height);if(i<=0)return;e.zmax!=null&&e.zmin!=null&&(i=Math.max(i,e.zmax-e.zmin));const r=this.view.state,n=3*i/Math.atan(r.camera.fov/2);n!==r.constraints.distance&&(r.constraints.distance=n)}_reapplyConstraints(e=Xn.ALL){this.view.state.updateCamera(i=>xo(this.view,i,{selection:e,interactionType:Ki.NONE,interactionFactor:null,interactionStartCamera:null,interactionDirection:null,tiltMode:nl.TUMBLE}))}};y([w({constructOnly:!0})],_4.prototype,"view",void 0),y([w({readOnly:!0})],_4.prototype,"surfaceCollisionConstraint",void 0),_4=y([Z("esri.views.3d.state.ConstraintsManager")],_4);let Kw=class{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}constructor(e){this.renderCoordsHelper=e,this.frustum=kL(),this._points=O$e(),this.lines=new Array(12),this._origin=W(),this._direction=W(),this._altitude=null;for(let i=0;i<12;i++)this.lines[i]={origin:null,direction:W(),endpoint:null}}update(e){P$e(e.viewMatrix,e.projectionMatrix,this.frustum,this._points),Ne(this._origin,e.eye),Ne(this._direction,e.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines()}updatePoints(e){for(let i=0;ithis._handleElevationChangeEvent(e))),this._applyCorrection()}onControllerEnd(){this.removeAllHandles()}stepController(){}_handleElevationChangeEvent(e){(e.spatialReference==null||MIe(this.view,this.desiredCamera,e.extent,e.spatialReference))&&this._applyCorrection()}_applyCorrection(){this.view.state.updateCamera(e=>{e.copyViewFrom(this.desiredCamera),I5(this.view,e,Rf.EYE_AND_CENTER)||this.constraintEnabled||(this.state=As.Stopped)})}};y([w({constructOnly:!0})],E$.prototype,"desiredCamera",null),E$=y([Z("esri.views.3d.state.controllers.SurfaceCollisionCorrectionController")],E$);const nbt=.66;function l9e(t){return 360-wP.normalize(t)}function rG(t){return wP.normalize(360-t)}function c9e(t,e,i){const r=e.camera;if(r!=null)return sbt(r,q_(t));const{targetGeometry:n}=e;if(n==null)return null;const{camera:s,mode:o}=h9e(t,e.rotation,i);if(n.type==="point")return abt(t,e,n,s,o);const a=n.extent;return a==null?null:UF(t,a,s.heading,s.tilt,o)}async function u9e(t,e,i,r){const n=e.camera;if(n!=null)return obt(n,q_(t),r);const{targetGeometry:s}=e;if(s==null)throw new Error("Viewpoint has no targetGeometry!");const{camera:o,mode:a}=h9e(t,e.rotation,i);if(s.type==="point")return lbt(t,e,s,o,a,r);const c=s.extent;if(c==null)throw new Error("Target geometry has no extent!");return i4e(t,c,o.heading,o.tilt,a,r)}function sbt(t,e){const i=t.position;let r;try{r=sl(i,e)}catch{return null}const n=t.clone();return n.position=r.clone(),n}async function obt(t,e,i){const r=t.position,n=await Qy(r,e,{signal:i});St(i);const s=t.clone();return s.position=n.clone(),s}function h9e(t,e,i){const r=MP(t,t.state.camera);let n=Yl.ADJUST;return e!=null&&(r.heading=l9e(e),n=Yl.LOCKED),i!=null&&(r.tilt=i),{camera:r,mode:n}}function abt(t,e,i,r,n){const s=t.spatialReference;let o;try{o=sl(i.clone(),s)}catch{return null}const a=e.scale!=null?Ij(t,e.scale,o.latitude):t.state.camera.distance;return $ft(t,o,a,r,n)}async function lbt(t,e,i,r,n,s){const o=t.spatialReference,a=await Qy(i.clone(),o,{signal:s});St(s);const c=e.scale!=null?Ij(t,e.scale,a.latitude):t.state.camera.distance;return HIe(t,a,c,r,n,s)}function d9e(t,e,i=null){return i==null&&(i=new nh),xle(t,null,e.clone(),i)}async function p9e(t,e,i){const r=vbt(t,e);if(!r)throw new se("viewpointutils-create:no-target","Missing target for creating viewpoint");const n=new pd({fov:t.camera.fov}),s=new nh({camera:n});if(r.target instanceof nh)return Dx(await hbt(t,r.target,r,i,s));if(r.target instanceof pd)return Dx(await m9e(t,r.target,i,s));const o=r.scale!=null||r.zoom!=null;if(r.target instanceof Vi){const p=r.target.xmin===r.target.xmax||r.target.ymin===r.target.ymax;return Dx(o||p?await Qte(t,r,r.target.center,n,i,s):await mbt(t,r,r.target,n,i,s))}const a={boundingBox:Bn(),hasZ:!1,screenSpaceObjects:[]},c=o?cbt(t,r):void 0;if(await f9e(t,r.target,c,a,i),isFinite(a.boundingBox[0])){let p;if(_m(a.boundingBox,no),Qd.x=no[0],Qd.y=no[1],Qd.z=no[2],Qd.spatialReference=t.spatialReference,isFinite(Qd.z)&&a.hasZ?p=Bse(a.boundingBox):(Qd.z=void 0,p=vXe(Vse(a.boundingBox,bbt))),o||p)return Dx(await Qte(t,r,Qd,n,i,s));const _=_bt(t,a.screenSpaceObjects);return Dx(await ybt(t,r,Qd,a.boundingBox,_,n,i,s))}return r.position?Dx(await pbt(t,r,n,s,i)):Dx(await fbt(t,r,n,i,s))}function ble(t,e){return e.scale==null&&e.zoom!=null?a4e(t,e.zoom):e.scale}function cbt(t,e){const i=ble(t,e);return i?gct(i):void 0}function wle(t,e){let i=!1;return e.heading!=null?(t.heading=e.heading,i=!0):e.rotation!=null&&(t.heading=l9e(e.rotation),i=!0),e.tilt!=null&&(t.tilt=e.tilt,i=!0),e.fov!=null&&(t.fov=e.fov),i}function xle(t,e,i,r){const n=t.spatialReference||rt.WGS84;return(e=e??Iv(t,i))==null||(r.targetGeometry=M_(e.center,t.renderSpatialReference,n),r.scale=l4e(t,e),r.rotation=rG(i.heading),r.camera=i),r}async function NU(t,e,i,r){var x;const n=()=>new se("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw n();e.type==="mesh"&&(e=e.extent);const s=e.spatialReference,o=t.spatialReference,a=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let S;switch(e.type){case"point":S=e;break;case"multipoint":case"polyline":S=(x=e.extent)==null?void 0:x.center;break;case"extent":S=e.center;break;case"polygon":S=e.centroid}S!=null&&a!=null&&t.elevationProvider!=null?(S=await Qy(S,a,{signal:r}),no[2]=wy(t.elevationProvider,S)??0):no[2]=0}const c=wbt[e.type],p=new Array;if(c(e,e.hasZ?S=>{p.push([S[0],S[1],S[2]])}:S=>{p.push([S[0],S[1]])},no),p.length===0)throw n();const _=await Qy(new Mm({spatialReference:s,hasZ:e.hasZ,hasM:!1,points:p}),o,{signal:r});if(e.hasZ&&(i.hasZ=!0),e.hasZ)for(const[S,C,M]of _.points)no[0]=S,no[1]=C,no[2]=M,Xf(i.boundingBox,no);else for(const[S,C]of _.points)no[0]=S,no[1]=C,Xf(i.boundingBox,no)}async function ubt(t,e,i,r,n){const s=await ih(t.whenViewForGraphic(e));if(s.ok===!1||s.value==null||!("whenGraphicBounds"in s.value))return void await NU(t,e.geometry,r,n);const o=s.value,a=await ih(o.whenGraphicBounds(e,{minDemResolution:i}));if(a.ok===!1||!a.value)return void await NU(t,e.geometry,r,n);const{screenSpaceObjects:c,boundingBox:p}=a.value;sP(r.boundingBox,p),c&&c.forEach(_=>{r.screenSpaceObjects.push(_)}),isFinite(p[2])&&(r.hasZ=!0)}async function f9e(t,e,i,r,n){var s;if(Array.isArray(e)&&e.length===2){const o=e[0],a=e[1];if(typeof o=="number"&&typeof a=="number")return Qd.x=o,Qd.y=a,Qd.z=void 0,Qd.spatialReference=(s=t.spatialReference)!=null&&s.isGeographic?t.spatialReference:rt.WGS84,void await NU(t,Qd,r,n)}e&&"map"in e&&typeof e.map=="function"?await Promise.allSettled(e.map(o=>f9e(t,o,i,r,n))):e instanceof ax?await NU(t,e,r,n):e instanceof Ma&&await ubt(t,e,i,r,n)}async function hbt(t,e,i,r,n){if(e.camera!=null)return m9e(t,e.camera,r,n);n.scale=e.scale,n.rotation=e.rotation,n.targetGeometry=e.targetGeometry!=null?e.targetGeometry.clone():null,n.camera=null,i.heading!=null?n.rotation=rG(i.heading):i.rotation!=null&&(n.rotation=i.rotation);const s=ble(t,i);return s!=null&&(n.scale=s),n.camera=await u9e(t,n,i.tilt,r),n}async function m9e(t,e,i,r){const n=t.spatialReference,s=await Qy(e.position,n,{signal:i});return(e=e.clone()).fov=t.camera.fov,e.position=s,xle(t,null,e,r)}async function dbt(t,e,i,r,n,s,o){const a=t.renderSpatialReference;return await pU(e,Kq,a,0,{signal:o}),await pU(i,SN,a,0,{signal:o}),s.targetGeometry=new mt(e),n.position=new mt(i),je(FU,Kq,SN),$j(t,SN,FU,r.up,n),s.scale=JT(t,Tn(SN,Kq),s.targetGeometry.latitude),s.rotation=rG(n.heading),s.camera=n,s}async function Qte(t,e,i,r,n,s){if(i==null)throw new se("createfromcenter","invalid point");s.targetGeometry=i.clone();const o=OE(t);if(e.position)return dbt(t,s.targetGeometry,e.position,o,r,s,n);if(e.zoomFactor){const c=o.distance/e.zoomFactor,p=De(no,o.viewForward,-c);o.eye=Be(no,o.center,p),s.scale=JT(t,c,i.latitude)}MP(t,o,r);const a=wle(r,e)?Yl.LOCKED:Yl.ADJUST;if(!e.zoomFactor){const c=ble(t,e);if(c==null){const{renderSpatialReference:p}=t;await pU(i,no,p,0,{signal:n}),I$e(o.frustum,no)?s.scale=JT(t,Tn(o.eye,no),i.latitude):s.scale=l4e(t,o)}else s.scale=c;s.camera=await GIe(t,s.targetGeometry,s.scale,r,a,n)}return s}async function pbt(t,e,i,r,n){const s=OE(t);Ne(FU,s.viewForward),$j(t,s.eye,FU,s.up,Qq);const o=t.spatialReference,{position:a}=e;if(a){const c=await Qy(a,o,{signal:n});i.position=c}else i.position=new mt;return i.heading=e.heading!=null?e.heading:Qq.heading,i.tilt=e.tilt!=null?e.tilt:Qq.tilt,xle(t,null,i,r)}async function fbt(t,e,i,r,n){const s=OE(t),{spatialReference:o,renderSpatialReference:a}=t;return Qte(t,e,M_(s.center,a,o),i,r,n)}async function mbt(t,e,i,r,n,s){s.targetGeometry=i.clone();const o=OE(t);MP(t,o,r);const a=wle(r,e)?Yl.LOCKED:Yl.ADJUST;return s.camera=await i4e(t,i,r.heading,r.tilt,a,n),s}function gbt(t,e,i,r,n){let s=0;i.z!=null?s=i.z:t.basemapTerrain&&t.elevationProvider&&(s=wy(t.elevationProvider,i)),Ie(no,i.x,i.y,s),Ac(t.spatialReference,no,Wge,t.renderSpatialReference),Kf(xN,Wge),Qf(xN,xN),Bn(bR);const o=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let M=0;M{this._resolveCallback=n,this._rejectCallback=s;const o=new AbortController;this.options.signal!=null&&Zl(this.options.signal,()=>{this.abort()}),this._abortController=o,this.waitForReady()})}resolve(e){if(this.state!=="finished")return this.state="finished",this._resolveCallback(e)}reject(e){if(this.state!=="finished")return this.state="finished",this._rejectCallback(e)}abort(e=!1){this._abortController.abort(),this.state==="wait-for-animation-finish"&&!e&&this._animationController!=null&&this.view.state.cameraController===this._animationController&&this._animationController.active&&this._animationController.stopController(),this.reject(ur())}async waitForReady(){if(this.state="wait-for-ready",!this.view.ready)try{await dd(()=>this.view.ready,this._abortController.signal)}catch(e){return this.reject(e)}this.createViewPoint()}async createViewPoint(){if(this.state!=="finished"){this.state="wait-for-viewpoint",this._animationController=this.options.animate?this._getAnimationController():null;try{const e=await p9e(this.view,this.target,this._abortController.signal);if(this.state==="finished")return;const i=e?this._getCameraFromViewpoint(e):null;if(i==null)return;if(this.options.animate){if(this._animationController==null)return;this.startAnimation(i,this._animationController)}else this.view.stateManager.setStateCamera(i.camera,{applyConstraints:!i.isFullySpecified,positionAndOrientationOnly:!0,doNotCancelGoToOperation:!0}),this.resolve()}catch(e){this.reject(e)}}}_getCameraFromViewpoint(e){var s;const i=!!(this.target instanceof nh&&this.target.camera||this.target instanceof pd),r=e.camera;if(r==null)return null;if(!this.view.stateManager.isCompatible(r)){const o=r.position,a=o&&o.spatialReference,c=a?a.wkid:"none",p=(s=this.view.spatialReference)==null?void 0:s.wkid;return this.reject(new se("GotoAnimation:incompatible-spatialreference",`Resulting camera has an incompatible spatial reference (camera: ${c}, view: ${p})`,{camera:r})),null}const n=Iv(this.view,r);return n==null?(this.reject(new se("GotoAnimation:invalid-camera","Resulting camera is invalid")),null):{viewpoint:e,camera:n,isFullySpecified:i}}startAnimation(e,i){this.state="wait-for-animation-finish";const r=i.viewAnimation;if(r==null)return void this.reject(new se("GotoAnimation:missing-animation","Unreachable code in view.stateManager"));if(r.update(e.viewpoint,"running"),!i.active||i.viewAnimation==null||i.viewAnimation.target!==e.viewpoint||this.view.state.cameraController!==i)return this.abort();let n;e.isFullySpecified?(n=new E$({view:this.view,desiredCamera:e.camera}),I5(this.view,e.camera,Rf.EYE_AND_CENTER)):xo(this.view,e.camera),i.begin(e.camera,this.options);const s=()=>{const a=this.view.state.cameraController;n&&(a&&a.active?a instanceof Kv&&a.viewAnimation!=null&&a.viewAnimation.target===e.viewpoint&&(this.view.state.cameraController=n):i.viewAnimation!=null&&i.viewAnimation.target===e.viewpoint&&i.state==="finished"&&(this.view.state.cameraController=n))},o=a=>{if(this.view.state!=null)switch(i.state){case As.Finished:switch(this.state){case"pending":case"wait-for-ready":case"wait-for-viewpoint":case"wait-for-animation-finish":this.resolve()}break;case As.Ready:case As.Rejected:case As.Running:case As.Stopped:switch(this.state){case"pending":case"wait-for-ready":case"wait-for-viewpoint":case"wait-for-animation-finish":this.reject(a)}}};r.when(s,a=>o(a)),i.asyncResult={resolve:()=>o(),reject:a=>o(a)}}_getAnimationController(){let e=null,i=null;const r=this.view.state.cameraController;return r instanceof Kv&&(r.updateStateFromViewAnimation(),r.active&&(e=r,i=e.viewAnimation)),e!=null||(e=new Kv({view:this.view,mode:"animation"}),i=e.viewAnimation,this.view.state.switchCameraController(e))?e:(i!=null&&i.stop(),this.reject(new se("GotoAnimation:goto-cannot-interrupt","Cannot start an animation while interacting")),null)}},L5=class{constructor(){this._outer=new Map}clear(){this._outer.clear()}get empty(){return this._outer.size===0}get(e,i){var r;return(r=this._outer.get(e))==null?void 0:r.get(i)}set(e,i,r){const n=this._outer.get(e);n?n.set(i,r):this._outer.set(e,new Map([[i,r]]))}delete(e,i){const r=this._outer.get(e);r&&(r.delete(i),r.size===0&&this._outer.delete(e))}forEach(e){this._outer.forEach((i,r)=>e(i,r))}};var Jo;function eW(t=!$e("disable-feature:high-quality-idle"),e=null){const i=new L5;return t?(i.set(Vr.IDLE,Jo.Antialiasing,e!=="low"),i.set(Vr.IDLE,Jo.HighResolutionAtmosphere,e!=="low"),i.set(Vr.IDLE,Jo.HighQualityTransparency,!0),i.set(Vr.IDLE,Jo.SSAO,!0),i.set(Vr.IDLE,Jo.WaterReflection,!0),i.set(Vr.IDLE,Jo.PhysicalPixelRendering,!0)):(i.set(Vr.ANIMATING,Jo.HighResolutionShadows,!0),i.set(Vr.INTERACTING,Jo.HighResolutionShadows,!0)),i.set(Vr.IDLE,Jo.HighResolutionShadows,!0),i.set(Vr.IDLE,Jo.HighResolutionVoxel,!0),i}(function(t){t[t.Antialiasing=0]="Antialiasing",t[t.HighQualityTransparency=1]="HighQualityTransparency",t[t.HighResolutionVoxel=2]="HighResolutionVoxel",t[t.HighResolutionAtmosphere=3]="HighResolutionAtmosphere",t[t.SSAO=4]="SSAO",t[t.WaterReflection=5]="WaterReflection",t[t.HighResolutionShadows=6]="HighResolutionShadows",t[t.PhysicalPixelRendering=7]="PhysicalPixelRendering"})(Jo||(Jo={}));let na=class extends ze{get camera(){const e=this._get("camera");if(!this.ready)return e;const i=MP(this.view,this.view.state.camera,tW);return i&&e&&i.equals(e)?e:i.clone()}set camera(e){var i,r;this._updatePropertyBeforeReady("camera",e)||((i=this.view.elevationProvider)==null||i.enableElevationCache(!0),this.setStateCamera(Iv(this.view,e),{applyConstraints:!1})||Ce.getLogger(this).error("#camera=","Invalid camera",e),(r=this.view.elevationProvider)==null||r.enableElevationCache(!1))}get contentCamera(){const e=this._get("contentCamera");if(!this.ready)return e;const i=MP(this.view,this.view.state.contentCamera,tW);return i&&e&&i.equals(e)?e:i.clone()}set contentCamera(e){if(this._updatePropertyBeforeReady("contentCamera",e))return;const i=Iv(this.view,e);i!=null?(this._updateElevation(i),this.view.state.contentCamera=i):this.view.state.contentCamera=null}installContentCameraReset(e){if(this.removeHandles(iW),this.test.contentCameraResetState.clear(),!this.view.state.fixedContentCamera)return!1;const i=this.zoom,r=this.view.state.camera.distance**2,n=vc(this.view.state.camera.center),s=e.sticky?this.contentCamera.clone():null;return this.addHandles([_e(()=>this.contentCamera,()=>{e.sticky||(this.removeHandles(iW),this.test.contentCameraResetState.clear())}),_e(()=>this.zoom,o=>{o!==void 0&&i!==void 0&&(this.test.contentCameraResetState.set("view.zoom",Math.abs(o-i)/2),Math.abs(o-i)>2?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=s))}),_e(()=>this.view.state.camera,o=>{const a=Ao(n,o.center);this.test.contentCameraResetState.set("camera.center",a/r),a>r?this.contentCamera=null:this.view.state.fixedContentCamera||(this.contentCamera=s)})],iW),!0}get center(){return this.ready?this.view.pointsOfInterest.centerOnContent.location:this._get("center")}set center(e){var i;this._updatePropertyBeforeReady("center",e)||(e?this.isCompatible(e)?this.setStateCamera(this._centerToCamera(e),{applyConstraints:!0})?this.view.pointsOfInterest.centerOnContent.runTask():Ce.getLogger(this).error("#center=","Invalid center",e):Ce.getLogger(this).error("#center=","Center has an incompatible spatial reference (center: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+((i=this.view.spatialReference)==null?void 0:i.wkid)+")",e):Ce.getLogger(this).error("#center=","Center may not be null or undefined"))}get extent(){if(!this.ready)return this._get("extent");const e=this.view,i=r4e(e,e.state.camera,e.pointsOfInterest.centerOnContent.renderLocation);return i??this._get("extent")}set extent(e){var i;this._updatePropertyBeforeReady("extent",e)||(e?this.isCompatible(e)?this.setStateCamera(this._extentToCamera(e),{applyConstraints:!0})||Ce.getLogger(this).error("#extent=","Invalid extent",e):Ce.getLogger(this).error("#extent=","Extent has an incompatible spatial reference (extent: "+(e.spatialReference?e.spatialReference.wkid:"none")+", view: "+((i=this.view.spatialReference)==null?void 0:i.wkid)+")",e):Ce.getLogger(this).error("#extent=","Extent may not be null or undefined"))}get frustum(){const e=this._propertiesPool.get("frustum");return e.renderCoordsHelper=this.view.renderCoordsHelper,e.update(this.view.state.camera),e}get _initialViewpoint(){var i;const e=this.view.map;return e&&"initialViewProperties"in e?(i=e.initialViewProperties)==null?void 0:i.viewpoint:void 0}get hasInitialView(){return!!this._initialViewpoint}get scale(){if(this.ready){const e=this.view.pointsOfInterest.centerOnContent;return JT(this.view,e.distance,e.location.latitude)}return this._get("scale")}set scale(e){this._updatePropertyBeforeReady("scale",e)||this.setStateCamera(this._scaleToCamera(e),{applyConstraints:!0})||Ce.getLogger(this).error("#scale=","Invalid scale",e)}get padding(){if(!this.ready)return this._get("padding");const e=this.view.state.camera,i=e.padding,r=e.pixelRatio,n=this._get("padding"),s=Math.round(i[er.TOP]/r),o=Math.round(i[er.RIGHT]/r),a=Math.round(i[er.BOTTOM]/r),c=Math.round(i[er.LEFT]/r);return n!=null&&n.top===s&&n.right===o&&n.bottom===a&&n.left===c?n:{top:s,right:o,bottom:a,left:c}}set padding(e){this._updatePropertyBeforeReady("padding",e)||(this._paddingToArray(e,this.view.state.camera.pixelRatio,TN),this.view.state.updateCamera(i=>i.padding=TN))}_paddingToArray(e,i,r){e?rs(r,e.top||0,e.right||0,e.bottom||0,e.left||0):rs(r,0,0,0,0);for(let n=0;n<4;n++)r[n]=Math.round(r[n]*i)}get screenCenter(){const e=this.padding;return Qu((this.view.width-(e.left+e.right))/2+e.left,(this.view.height-(e.top+e.bottom))/2+e.top)}get viewpoint(){return this.ready?d9e(this.view,this.camera):this._get("viewpoint")}set viewpoint(e){var i;if(!this._updatePropertyBeforeReady("viewpoint",e))if(e)if(this.isCompatible(e))this.setStateCamera(this._viewpointToCamera(e),{applyConstraints:!e.camera})||Ce.getLogger(this).error("#viewpoint=","Invalid viewpoint",e);else{const r=e.camera!=null?e.camera.position:e.targetGeometry,n=r!=null&&r.spatialReference;Ce.getLogger(this).error("#viewpoint=","Viewpoint has an incompatible spatial reference (viewpoint: "+(n?n.wkid:"none")+", view: "+((i=this.view.spatialReference)==null?void 0:i.wkid)+")",e)}else Ce.getLogger(this).error("#viewpoint=","Viewpoint may not be null or undefined")}get zoom(){return this.ready?Vft(this.view,this.scale):this._get("zoom")}set zoom(e){this._updatePropertyBeforeReady("zoom",e)||e===void 0||this.setStateCamera(this._zoomToCamera(e),{applyConstraints:!0})||Ce.getLogger(this).error("#zoom=","Invalid zoom",e)}_computeCanvasSize(){if(this._devicePixelRatioOverride)return this.view.state.contentPixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*this._devicePixelRatioOverride),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*this._devicePixelRatioOverride),this._tmpCanvasSize.pixelRatio=this._devicePixelRatioOverride,this._tmpCanvasSize;const e=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio),i=(this._usePhysicalPixelRendering?this._windowDevicePixelRatio:e)*this.view.resolutionScale;this._tmpCanvasSize.width=Math.round(this.view.surface.clientWidth*i),this._tmpCanvasSize.height=Math.round(this.view.surface.clientHeight*i);const r=this.view._stage.renderView.renderingContext.parameters.maxTextureSize;return nT(this._tmpCanvasSize,r),this._tmpCanvasSize.pixelRatio=this._tmpCanvasSize.width>0?this._tmpCanvasSize.width/this.view.surface.clientWidth*.5+this._tmpCanvasSize.height/this.view.surface.clientHeight*.5:i,this.view.state&&(this.view.state.contentPixelRatio=Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)),this._tmpCanvasSize}get _rasterPixelRatio(){return this._devicePixelRatioOverride!=null?this._devicePixelRatioOverride:this._usePhysicalPixelRenderingAny?this._windowDevicePixelRatio:Math.min(this._windowDevicePixelRatio,this.view.qualitySettings.maximumPixelRatio)}get _usePhysicalPixelRendering(){var e,i;return((i=(e=this.view)==null?void 0:e._stage)==null?void 0:i.renderer.isFeatureEnabled(Jo.PhysicalPixelRendering))??!1}get _usePhysicalPixelRenderingAny(){var i,r;const e=(r=(i=this.view)==null?void 0:i._stage)==null?void 0:r.renderer;return e&&(e.isFeatureEnabled(Jo.PhysicalPixelRendering,Vr.IDLE)||e.isFeatureEnabled(Jo.PhysicalPixelRendering,Vr.INTERACTING)||e.isFeatureEnabled(Jo.PhysicalPixelRendering,Vr.ANIMATING))}constructor(e){super(e),this.constraintsManager=null,this.ready=!1,this._windowDevicePixelRatio=1,this._devicePixelRatioOverride=null,this._idleTimeout=Yge,this.test={viewStateManager:this,contentCameraResetState:new Map,setDevicePixelRatio:i=>this._devicePixelRatioOverride=i,renderState:null,get maximumPixelRatio(){return this.viewStateManager.view.qualitySettings.maximumPixelRatio},get updatingIgnoreRenderState(){return this.renderState!=null},get idleTimeoutEnabled(){return this.viewStateManager._idleTimeout>0},set idleTimeoutEnabled(i){this.viewStateManager._idleTimeout=i?Yge:0}},this._propertiesPool=new O_({frustum:Kw},this),this._cameraSetByUser=!1,this._gotoOperation=null,this._cameraChangeTime=0,this._tmpCanvasSize=new Tbt}initialize(){this._cameraChangeTime=performance.now(),this.addHandles([Jr(()=>this.view.state.events,"before-camera-change",e=>e&&this._updateElevation(e)),_e(()=>{var e;return(e=this.view.state)==null?void 0:e.camera},(e,i)=>this._cameraChangedHandler(e,i),Li)]),Oo(()=>{var e;return(e=this.view.state)==null?void 0:e.camera},e=>this._updateElevation(e),{once:!0,sync:!0}),this.addHandles([LT({prepare:()=>this._prepareFrame()}),_e(()=>this.view.state.cameraController,()=>{this._cameraSetByUser=!0,this.removeHandles(EN)}),Jr(()=>this.view.state.events,"camera-projection-changed",()=>this.notifyChange("scale"))])}destroy(){this.exit(),this._propertiesPool=et(this._propertiesPool)}init(){this.constraintsManager=new _4({view:this.view}),this._prepareFrame();const e=this._getInitialProperties();this._cameraSetByUser=!1,this._set("ready",!0);for(const i of e)this.set(i.name,i.value);if(!this._cameraSetByUser){const i=this._initialViewpoint||this.view.initialExtent;i&&this.isCompatible(i)?this._setInitialView(i):this.view.state.viewingMode===_t.Local&&this.addHandles(Oo(()=>this.view.basemapTerrain.ready,()=>{this.removeHandles(EN),this._setInitialView(this.view.dataExtent)},{once:!0,initial:!0}),EN)}}exit(){this._cancelGoToOperation(),this.ready&&(this._override("padding",this.padding),this._set("ready",!1),this._clearOverride("hasInitialView"),this._cameraSetByUser=!1,this.removeHandles(EN),this.constraintsManager=et(this.constraintsManager))}async goTo(e,i){const r={animate:!0,...i};return this._gotoOperation!=null&&this._gotoOperation.abort(r.animate),this._gotoOperation=new Sbt(e,r,this.view),this.view.resourceController.scheduler.stopFrame(),this._gotoOperation.promise}debugSetCameraOnContent(){this.setStateCamera(OE(this.view),{applyConstraints:!1})}step(e){const i=this.view.state,r=i==null?void 0:i.cameraController;r&&(i.updateCamera(n=>r.stepController(e,n)),r.steppingFinished&&r.finishController())}_cancelGoToOperation(){this._gotoOperation!=null&&(this._gotoOperation.abort(),this._gotoOperation=null)}_getInitialProperties(){const e=new Set,i=[];for(const{propertyName:r,overrides:n}of Cbt){const s=e.has(r),o=this._isOverridden(r);!s&&o&&i.push({name:r,value:this._get(r)}),this._clearOverride(r),(s||o)&&n.forEach(a=>e.add(a))}return i}_setInitialView(e){if(e==null||this._cameraSetByUser)return;if(e instanceof pd)return void this.setStateCamera(Iv(this.view,e),{applyConstraints:!1});if(e instanceof nh){if(e.targetGeometry instanceof Vi){const s=UF(this.view,e.targetGeometry,0,.5,Yl.LOCKED);return void(s!=null&&this.setStateCamera(Iv(this.view,s),{applyConstraints:!0}))}const r={applyConstraints:!e.camera},n=this._viewpointToCamera(e);return void this.setStateCamera(n,r)}const i=UF(this.view,e,0,.5,Yl.LOCKED);i!=null&&this.setStateCamera(Iv(this.view,i),{applyConstraints:!0})}_updatePropertyBeforeReady(e,i){return!this.ready&&(this._override(e,i),i&&Ebt.has(e)&&this._override("hasInitialView",!0),!0)}isCompatible(e){return e!=null&&(e instanceof nh?e.camera?this.isCompatible(e.camera):this.isCompatible(e.targetGeometry):e instanceof pd?this.isCompatible(e.position):e.spatialReference&&e$(e.spatialReference,this.view.spatialReference))}_getPreservingHeadingTilt(e=Abt){return this._cameraSetByUser?(e.heading=this.camera.heading,e.tilt=this.camera.tilt):(e.heading=0,e.tilt=.5),e}_centerPointAtDistanceToCamera(e,i,r=wb){const{heading:n,tilt:s}=this._getPreservingHeadingTilt(),o=vae(this.view,n,s,e,i,Yl.ADJUST);return o==null?null:(r.copyFrom(this.view.state.camera),r.eye=o.eye,r.center=o.center,r.up=o.up,r)}_centerToCamera(e){const i=this.view.pointsOfInterest.centerOnContent;i.runTask();const r=i.distance;return this._centerPointAtDistanceToCamera(e,r)}_extentToCamera(e){const{heading:i,tilt:r}=this._getPreservingHeadingTilt(),n=UF(this.view,e,i,r,Yl.ADJUST,tW);return n?Iv(this.view,n):null}_scaleToCamera(e){if(e==null)return null;const i=this.view.pointsOfInterest.centerOnContent;i.runTask();const r=i.renderLocation,n=i.location.latitude;if(n==null)return null;const s=Ij(this.view,e,n);return this._centerPointAtDistanceToCamera(r,s)}_zoomToCamera(e){return this._scaleToCamera(a4e(this.view,e))}_viewpointToCamera(e){return Iv(this.view,c9e(this.view,e))}setStateCamera(e,i){return!(e==null||!this.view.state.stopActiveCameraController())&&(this._cameraSetByUser=!0,i.doNotCancelGoToOperation||this._cancelGoToOperation(),this.view.state.updateCamera(r=>{i.positionAndOrientationOnly?(r.eye=e.eye,r.center=e.center,r.up=e.up):r.copyFrom(e),i.applyConstraints&&xo(this.view,r)}),i.applyConstraints||(this.view.state.cameraController=new E$({view:this.view,desiredCamera:e})),!0)}_prepareFrame(){const{surface:e,canvas:i}=this.view;if(!e||!i)return;this._windowDevicePixelRatio=window.devicePixelRatio;const r=this._computeCanvasSize();if(r.width!==0&&r.height!==0&&(i.width===r.width&&i.height===r.height||(i.width=r.width,i.height=r.height),this.view.state)){const n=this.view.state.camera;n.fullWidth===r.width&&n.fullHeight===r.height&&n.pixelRatio===r.pixelRatio||(wb.copyFrom(n),wb.pixelRatio!==r.pixelRatio&&(this._paddingToArray(this.padding,r.pixelRatio,TN),wb.padding=TN),wb.fullWidth=r.width,wb.fullHeight=r.height,wb.pixelRatio=r.pixelRatio,this.view.state.camera=wb),this._updateViewState()}}_updateElevation(e){var s,o;const i=(s=this.view.basemapTerrain)==null?void 0:s.spatialReference,r=((o=this.view.renderCoordsHelper)==null?void 0:o.getAltitude(e.eye))??0,n=i?Rj(this.view,e.eye):0;e.relativeElevation=r-n}_updateViewState(){this.test.renderState!=null?this.view.state.mode=this.test.renderState:this.view.animation?this.view.state.mode=Vr.ANIMATING:this.view.interacting?this.view.state.mode=Vr.INTERACTING:(this.view.state.mode===Vr.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTimethis.notifyChange("isInteractive"),Xge),this.view.state.updateCamera(e=>this.stepController(0,e)),this.steppingFinished&&this.finishController()}};y([w({readOnly:!0})],Sy.prototype,"isInteractive",null),y([w()],Sy.prototype,"_lastInteraction",void 0),Sy=y([Z("esri.views.3d.state.controllers.InteractiveController")],Sy);var kh;(function(t){t[t.CENTER=0]="CENTER",t[t.EYE=1]="EYE"})(kh||(kh={}));let C$=class extends Sy{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(e){super(e),this.pivot=kh.CENTER,this._rotScale=0,this._lastPoint=yt(),this._tmpWorldUp=W(),this._tmpViewDir=W(),this._tmpRotCurPoint=yt(),this._tmpTransf=Qe(),this._tmpAxis=W(),this._tmpPivotPoint=W(),this._pivotPos=W(),this._constraintOptions={selection:Xn.ALL,interactionType:Ki.TUMBLE,interactionFactor:0,interactionStartCamera:null,interactionDirection:null,tiltMode:nl.TUMBLE}}initialize(){this._rotScale=this.pivot===kh.CENTER?3:1.5}begin(e){if(this.active){switch(this.pivot){case kh.EYE:Ne(this._pivotPos,this.startCamera.eye),this._constraintOptions.interactionType=Ki.LOOK_AROUND,this._constraintOptions.tiltMode=nl.LOOK_AROUND,this._constraintOptions.selection=Xn.NONE;break;case kh.CENTER:{const i=this._intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this._pivotPos,this.view.map.ground.opacity===0?$E:{});i||Ne(this._pivotPos,this.startCamera.center),this._constrainPivotPoint(e,i),this.startCamera.center=this._pivotPos,this._constraintOptions.interactionType=Ki.TUMBLE,this._constraintOptions.tiltMode=nl.TUMBLE,this._constraintOptions.selection=Xn.ALL&~Xn.DISTANCE;break}}this._constraintOptions.interactionStartCamera=this.startCamera,ET(this.startCamera,e,this._lastPoint)}}_constrainPivotPoint(e,i){const r=this.startCamera,n=W();je(n,this._pivotPos,r.eye);const s=nt(n),o=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(r.eye,Zge);let a=Math.max(Math.min(D_t,1/Math.abs(Ve(Zge,r.viewForward)))*o,N_t);i&&(a=Math.min(s,a));const c=Tr(this.view.spatialReference),p=ss(r.width/r.pixelRatio*.5,r.height/r.pixelRatio*.5),_=iG(this.startCamera,p,c);let x=this.view._stage.renderView.getMinimalDepthForArea(HL(this.view),r.fullWidth/r.pixelRatio*.5,r.fullHeight/r.pixelRatio*.5,r,2.5*Wq,Wq),S=this.view._stage.renderView.getMinimalDepthForArea(HL(this.view),e[0],e[1],r,Wq);x==null&&S==null||(x=x??S??0,S=S==null||_===Ja.Horizontal?x:S,a=x>S?S:x,a=i?Math.min(a,s):a),Ye(n,n),Ne(this._pivotPos,Be(this._tmpPivotPoint,r.eye,De(this._tmpPivotPoint,n,a)))}update(e){if(this.active){switch(this.pivot){case kh.EYE:this.currentCamera.center=this._applyRotation(this.currentCamera,e,this.currentCamera.center,this._pivotPos);break;case kh.CENTER:this.currentCamera.center=this._pivotPos,this.currentCamera.eye=this._applyRotation(this.currentCamera,e,this.currentCamera.eye,this._pivotPos)}xo(this.view,this.currentCamera,this._constraintOptions),this.commitCamera()}}end(){this.active&&this.finishController()}_applyRotation(e,i,r,n){this.view.renderCoordsHelper.worldUpAtPosition(n,this._tmpWorldUp),ET(e,i,this._tmpRotCurPoint);let s=(this._lastPoint[1]-this._tmpRotCurPoint[1])*this._rotScale,o=(this._tmpRotCurPoint[0]-this._lastPoint[0])*this._rotScale;je(this._tmpViewDir,r,n);const a=nt(this._tmpViewDir),c=Aa(Ve(this._tmpViewDir,this._tmpWorldUp)/a);if(this.pivot===kh.EYE){s*=-.5;const p=.5*Math.PI-c,_=.5*Math.PI*.99;s=p-Math.max(-_,Math.min(_,p+s))}return s=Je(s+c,Gl.min,Gl.max)-c,Wt(this._tmpAxis,e.up,this._tmpViewDir),this.pivot===kh.CENTER&&(o=-o),Ep(this._tmpTransf,o,this._tmpWorldUp),Zh(this._tmpTransf,this._tmpTransf,s,this._tmpAxis),bt(this._tmpViewDir,this._tmpViewDir,this._tmpTransf),e.up=bt(rW,e.up,this._tmpTransf),Be(rW,n,this._tmpViewDir),ea(this._lastPoint,this._tmpRotCurPoint),rW}};y([w()],C$.prototype,"pivot",void 0),C$=y([Z("esri.views.3d.state.controllers.RotateController")],C$);const rW=W(),Zge=W();let nW=class extends Rl{constructor(e,i,r,n){super(!0),this._view=e,this.pointerAction=i,this._pivot=r,this.registerIncoming("drag",n,s=>this._handleDrag(s))}_handleDrag(e){const i=e.data;if(i.pointers.size>1||!_le(e.data,this.pointerAction))return;const r=ss(i.center.x,i.center.y);switch(i.action){case"start":this._cameraController&&(this._cameraController.end(),this._cameraController=null),this._cameraController=new C$({view:this._view,pivot:this._pivot}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(r);break;case"update":this._cameraController&&this._cameraController.update(r);break;case"end":this._cameraController&&(this._cameraController.end(),this._cameraController=null)}e.stopPropagation()}},eie=class extends Sy{constructor(){super(...arguments),this._pickPoint=W(),this._tmpP0=yt(),this._panAxisAngle=eG(),this._tmpRayDir=W(),this._tmpRayDirPick=W(),this._targetOnSphere=W(),this._navMode=Ja.Horizontal,this._tmpRay={origin:W(),direction:W()},this.dragBeginPoint=ss(),this._normalizedAnchorPoint=yt(),this._constraintOptions={selection:Xn.ALL_EXCEPT_COLLISION,interactionType:Ki.ZOOM,interactionFactor:0,interactionStartCamera:null,interactionDirection:null,tiltMode:nl.TUMBLE},this._sphere=uo(),this._hasPickPoint=!1}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(e){if(!this.active)return;ea(this.dragBeginPoint,e),ET(this.startCamera,e,this._normalizedAnchorPoint);const i=Tr(this.view.spatialReference),r=QLe(this._intersectionHelper,this.startCamera,e,i,LP.Ellipsoid,this.view.map.ground.opacity===0?$E:{});if(this._navMode=iG(this.startCamera,e,i),this._navMode===Ja.Horizontal)this._hasPickPoint=!!r.scenePickPoint,this._pickPoint=r.scenePickPoint??this._pickPoint,this._sphere=r.sphere;else{let n;$5(this.startCamera,e,this._tmpRay),Ye(this._tmpRay.direction,this._tmpRay.direction),r.scenePickPoint!=null&&(je(this._tmpRayDirPick,this.startCamera.eye,r.scenePickPoint),n=nt(this._tmpRayDirPick));const s=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,Jge);let o=Je(Math.min(HLe,1/Math.abs(Ve(Jge,this._tmpRay.direction)))*s,PU[0],PU[1]);const a=this.view._stage.renderView.getMinimalDepthForArea(null,e[0],e[1],this.view.state.camera,tG);o=a??o,o=n!=null?Math.min(o,n):o,this._hasPickPoint=!0,De(this._tmpRay.direction,this._tmpRay.direction,o),Be(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}this._constraintOptions.interactionStartCamera=this.startCamera}update(e){if(this.active){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,this._navMode===Ja.Horizontal){je(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);const i=nt(this._tmpRayDir);ET(this.currentCamera,e,this._tmpP0);const r=12*(this._normalizedAnchorPoint[1]-this._tmpP0[1]);let n=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&n=0&&nthis.startCamera.center[2]?Nx[2]=Math.max(this.startCamera.center[2],Nx[2]):Nx[2]=Math.min(this.startCamera.center[2],Nx[2]),this.currentCamera.center=Nx,this._constraintOptions.interactionFactor=dm(km(this.dragBeginPoint,e)),xo(this.view,this.currentCamera,this._constraintOptions),this.commitCamera())}end(){this.active&&this.finishController()}};tie=y([Z("esri.views.3d.state.controllers.local.ZoomController")],tie);const Nx=W(),Mbt=st(0,0,1);let Obt=class extends Rl{constructor(e,i,r){super(!0),this._view=e,this.pointerAction=i,this.registerIncoming("drag",r,n=>this._handleDrag(n))}_handleDrag(e){const i=e.data;if(i.pointers.size>1||!_le(e.data,this.pointerAction))return;const r=ss(i.center.x,i.center.y);switch(i.action){case"start":this._cameraController&&(this._cameraController.end(),this._cameraController=null),this._view.state.isGlobal?this._cameraController=new eie({view:this._view}):this._cameraController=new tie({view:this._view}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(r);break;case"update":this._cameraController&&this._cameraController.update(r);break;case"end":this._cameraController&&(this._cameraController.end(),this._cameraController=null)}e.stopPropagation()}};function y0(t){let e=t*t;return t<0&&(e*=-1),e}function Kge(t,e,i){const r=i,n=t.state,s=t.device,o=e.tiltDirection==="forward-down"?1:-1,a=1;return s.deviceType==="standard"?(r.translation[0]=y0(n.axes[0]),r.translation[1]=y0(n.axes[1]),r.translation[2]=y0(n.buttons[7])-y0(n.buttons[6]),r.heading=y0(n.axes[2]),r.tilt=y0(n.axes[3])):s.deviceType==="spacemouse"&&(r.translation[0]=1.2*y0(n.axes[0]),r.translation[1]=1.2*y0(n.axes[1]),r.translation[2]=2*-y0(n.axes[2]),r.heading=1.2*y0(n.axes[5]),r.tilt=1.2*y0(n.axes[3])),r.tilt*=o,De(r.translation,r.translation,a),r}function Qge(t,e){const i=e;return i.translation[0]=t[1]-t[0],i.translation[1]=t[3]-t[2],i.translation[2]=t[4]-t[5],i.heading=t[7]-t[6],i.tilt=t[8]-t[9],i.zoom=t[10]-t[11],i}function sW(t){return t.translation[0]===0&&t.translation[1]===0&&t.translation[2]===0&&t.heading===0&&t.tilt===0&&t.zoom===0}let sT=class extends Sy{constructor(e){super(e),this._filteredSurfaceElevation=0,this._transformation={translation:[0,0,0],heading:0,tilt:0,zoom:0},this._keysButtonState=[0,0,0,0,0,0,0,0,0,0,0,0],this._tmpCamera=new si,this._headingStart=0,this._constraintOptions={selection:Xn.ALL,interactionType:Ki.NONE,interactionStartCamera:new si,interactionFactor:0,interactionDirection:null,tiltMode:nl.LOOK_AROUND}}handleEventGamepad(e){const i=Kge(e,this.view.navigation.gamepad,this._transformation);(e.action==="end"||sW(i))&&this.finishController()}activateDirection(e){this._keysButtonState[e]=1,Qge(this._keysButtonState,this._transformation)}deactivateDirection(e){this._keysButtonState[e]=0;const i=Qge(this._keysButtonState,this._transformation);sW(i)&&this.finishController()}onControllerStart(e){this._filteredSurfaceElevation=this.view.pointsOfInterest.cameraOnSurface.location.z,this._headingStart=this.view.camera.heading,super.onControllerStart(e)}_updateFilteredSurfaceElevation(e){const i=this.view.pointsOfInterest.cameraOnSurface.location.z,r=1;this._filteredSurfaceElevation+=r*(i-this._filteredSurfaceElevation)*e}stepController(e,i){var r;this._updateStartHeading(),this._updateFilteredSurfaceElevation(e),this.currentCamera.copyViewFrom(i),this._updateCameraCenter(),(r=this._constraintOptions.interactionStartCamera)==null||r.copyFrom(this.currentCamera),this._calculateControlTransformation(e,this.currentCamera,Fx),this._applyDisabledMovementTypes(Fx),this._applyPan(Fx.pan),this._applyRotate(Fx.rotate),this._applyZoom(Fx.zoom),this._applyAscend(Fx.ascend),this._constraintOptions.interactionType=Ki.NONE,this._constraintOptions.selection=Xn.COLLISION,xo(this.view,this.currentCamera,this._constraintOptions),super.stepController(e,i)}_updateStartHeading(){this._transformation.heading!==0&&(this._headingStart=this.view.camera.heading)}_applyRotate(e){if(!e.enabled)return;const i=this.currentCamera;je(yu,i.center,i.eye),bt(yu,yu,e.matrix),i.center=Be(yu,yu,i.eye),i.up=bt(yu,i.up,e.matrix),this._constraintOptions.interactionType=Ki.LOOK_AROUND,this._constraintOptions.selection=Xn.ALL_EXCEPT_COLLISION,xo(this.view,i,this._constraintOptions)}_applyPan(e,i=this.currentCamera){e.enabled&&(i.eye=bt(yu,i.eye,e.matrix),i.center=bt(yu,i.center,e.matrix),this.view.state.isGlobal&&(i.up=bt(yu,i.up,e.matrix)),this._constraintOptions.interactionType=Ki.PAN,this._constraintOptions.selection=Xn.ALL,xo(this.view,i,this._constraintOptions))}_applyZoom(e){if(!e)return;const i=this.currentCamera.viewForward;this.currentCamera.eye=Be(yu,this.currentCamera.eye,De(xt.get(),i,e)),Ne(wR,i),Cc(wR,wR),this._constraintOptions.interactionDirection=wR,this._constraintOptions.interactionType=Ki.ZOOM,this._constraintOptions.selection=Xn.ALL_EXCEPT_COLLISION,xo(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_applyAscend(e){if(!e)return;const i=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,xt.get());if(this._constraintOptions.interactionDirection=Ne(wR,i),this.view.state.isGlobal){const r=nt(this.currentCamera.eye),n=(r+e)/r;this.currentCamera.eye=De(yu,this.currentCamera.eye,n),this.currentCamera.center=De(yu,this.currentCamera.center,n)}else{const r=De(xt.get(),i,e);this.currentCamera.eye=Be(yu,this.currentCamera.eye,r),this.currentCamera.center=Be(yu,this.currentCamera.center,r)}this._updateCameraCenter(),this._constraintOptions.interactionType=Ki.ASCEND,this._constraintOptions.selection=Xn.COLLISION,xo(this.view,this.currentCamera,this._constraintOptions)&&this._updateCameraCenter(),this._constraintOptions.selection=Xn.ALL_EXCEPT_COLLISION,xo(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}_calculateControlTransformation(e,i,r){Nbt(r);const n=this._computeVelocities(e);this.view.state.isLocal?this._calculateControlTransformationLocal(n,i,r):this._calculateControlTransformationGlobal(n,i,r)}_updateCameraCenter(){const e=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,i=this.view.renderCoordsHelper,r=this.currentCamera.ray;this.currentCamera.center=i.intersectManifoldClosestSilhouette(r,e,yu)}_calculateControlTransformationLocal(e,i,r){const{viewRight:n,viewForward:s}=i,o=this._transformation,a=this.view.navigation.gamepad,c=Ie(xt.get(),s[0],s[1],0);Ye(c,c);const p=o.translation[0]*e.pan;if(p!==0){const P=De(xt.get(),n,p);eh(r.pan.matrix,r.pan.matrix,P),r.pan.enabled=!0}switch(a.mode){case"pan":{const P=-o.translation[1]*e.pan;if(P!==0){const $=De(xt.get(),c,P);eh(r.pan.matrix,r.pan.matrix,$),r.pan.enabled=!0}r.zoom=o.zoom*e.zoom;break}case"zoom":r.zoom=(-o.translation[1]+o.zoom)*e.zoom;break;default:a.mode}const _=o.translation[2]*e.ascend;r.ascend=_;const x=-o.heading*e.rotate;x!==0&&(Zh(r.rotate.matrix,r.rotate.matrix,x,this.view.renderCoordsHelper.worldUpAtPosition(i.eye,xt.get())),r.rotate.enabled=!0);const S=o.tilt*e.rotate,C=J2(this.view.renderCoordsHelper,i.center,i.eye),M=Je(C+S,Gl.min,Gl.max)-C;M&&(Zh(r.rotate.matrix,r.rotate.matrix,M,n),r.rotate.enabled=!0)}_calculateControlTransformationGlobal(e,i,r){const{eye:n,viewRight:s}=i,o=this._transformation,a=this.view.navigation.gamepad,c=Wt(xt.get(),s,n);Ye(c,c),Cc(c,c),j_t(this.startCamera,i,o,e,this.view.camera.heading,this._headingStart,this.view.camera.tilt,r,a),this._tmpCamera.copyFrom(this.currentCamera),this._applyPan(Fx.pan,this._tmpCamera);const p=this.view.pointsOfInterest.centerOnSurfaceFrequent.estimatedSurfaceAltitude,_=o.translation[2]*e.ascend;r.ascend=_;const x=-o.heading*e.rotate;x!==0&&(Zh(r.rotate.matrix,r.rotate.matrix,x,this._tmpCamera.eye),r.rotate.enabled=!0);const S=o.tilt*e.rotate,C=this._clampTiltDeltaGlobalToValidRange(S,i.ray,p);C!==0&&(Zh(r.rotate.matrix,r.rotate.matrix,C,this._tmpCamera.viewRight),r.rotate.enabled=!0),r.zoom+=o.zoom*e.zoom}_clampTiltDeltaGlobalToValidRange(e,i,r){const n=Tr(this.view.spatialReference),s=nk(Gl.min,i.origin,r,n);let o=0,a=0;const c=xt.get();if(this.view.renderCoordsHelper.intersectManifold(i,r,c)){const p=J2(this.view.renderCoordsHelper,c,i.origin);o=nk(p,i.origin,r,n),a=nk(Gl.max,i.origin,r,n)}else{C5(pj(mj,r+n.radius),i,c);const p=Math.PI+dj(i.direction,c);o=Dge(p,i.origin,r,n),a=Dge(Gl.max,i.origin,r,n)}return Je(o+e,s,a)-o}_getPointAbsoluteSurfaceElevation(e,i,r){const{renderCoordsHelper:n}=this.view,s=n.getAltitude(e),o=i+Math.abs(s-i);return n.setAltitude(r,o,e),o}_clampedDistanceToSurface(e,i){const{renderCoordsHelper:r}=this.view,{camera:n}=this.view.state,{direction:s}=Ift(this.view,i,0,g9e,Dbt),o=r.intersectManifoldClosestSilhouette(Ap(i,s),e,xt.get()),a=Tn(i,o),c=r.intersectManifoldClosestSilhouette(Ap(i,k_(xt.get(),i,n.center)),e,xt.get()),p=Tn(i,c);return Math.min(a,p)}_computeHeadingRotateRadius(e){const{renderCoordsHelper:i,state:r}=this.view,{camera:n,isGlobal:s}=r,o=i.intersectManifoldClosestSilhouette(n.ray,this._filteredSurfaceElevation,xt.get());if(s){const a=je(xt.get(),e,o),c=nt(a);De(a,a,1/c);const p=Ye(xt.get(),e),_=Aa(Ve(p,a));return c*Math.sin(Math.min(Rbt,_))}{const a=Ne(xt.get(),e);return i.setAltitude(a,this._filteredSurfaceElevation),Tn(o,a)}}_minimumAscendVelocity(){return this.view.state.constraints.collision.enabled?0:Ibt}_computeVelocities(e){const i=this._filteredSurfaceElevation,r=i+Tr(this.view.spatialReference).radius,{camera:n,isGlobal:s}=this.view.state,o=xt.get(),a=this._getPointAbsoluteSurfaceElevation(n.eye,i,o),c=this._clampedDistanceToSurface(i,o),p=n.width/2,_=eye*n.width,x=eye*n.width,S=c*Math.tan(.5*n.fovX)/p,C=S/r,M=S/this._computeHeadingRotateRadius(o),P=a-i;return{pan:(s?C:S)*_*e,ascend:Math.max(this._minimumAscendVelocity()*e,2**(_*e/p)*P-P),zoom:2**(_*e/p)*c-c,rotate:Je(M*x,$bt,Lbt)*e}}_applyDisabledMovementTypes(e){this.disableMovements==null||this.disableMovements.mode!==void 0&&this.view.state.viewingMode!==this.disableMovements.mode||(e.zoom=this.disableMovements.zoom?0:e.zoom,e.ascend=this.disableMovements.ascend?0:e.ascend,e.pan.enabled=!this.disableMovements.pan,this.disableMovements.pan&&Yf(e.pan.matrix),e.rotate.enabled=!this.disableMovements.rotate,this.disableMovements.rotate&&Yf(e.rotate.matrix))}static activatesFor(e,i){const r=Kge(i,e.navigation.gamepad,Pbt);return!(i.action==="end"||sW(r))}};y([w({constructOnly:!0})],sT.prototype,"gamepadDevice",void 0),y([w({constructOnly:!0})],sT.prototype,"disableMovements",void 0),sT=y([Z("esri.views.3d.state.controllers.GamepadKeyboardController")],sT);const Pbt={translation:[0,0,0],heading:0,tilt:0,zoom:0},g9e=80,Rbt=Ei(g9e),eye=.75,Ibt=5,$bt=Ei(30),Lbt=Ei(80),Fx={zoom:0,ascend:0,pan:{enabled:!1,matrix:Qe()},rotate:{enabled:!1,matrix:Qe()}},yu=W(),wR=W(),Dbt=gae();function Nbt(t){t.zoom=0,t.ascend=0,t.pan.enabled=!1,Yf(t.pan.matrix),t.rotate.enabled=!1,Yf(t.rotate.matrix)}let Fbt=class extends Rl{constructor(e){super(!0),this._view=e,this._watchHandles=new N_,this._handle=this.registerIncoming("gamepad",i=>this._handleEventGamepad(i)),this._handle.pause()}onInstall(e){super.onInstall(e),this._watchHandles.add([_e(()=>this._view.navigation.gamepad.enabled,i=>{i?this._handle.resume():(this._handle.pause(),this._cameraControllerGamepad&&(this._cameraControllerGamepad.finishController(),this._cameraControllerGamepad=null))},Qt),_e(()=>this._view.navigation.gamepad.device,i=>{this._cameraControllerGamepad&&i&&this._cameraControllerGamepad.gamepadDevice!==i&&(this._cameraControllerGamepad.finishController(),this._cameraControllerGamepad=null)})])}onUninstall(){this._watchHandles.removeAll(),super.onUninstall()}_handleEventGamepad(e){const i=this._view.navigation.gamepad.device;if(i&&e.data.device!==i)return;const r=this._cameraControllerGamepad&&this._cameraControllerGamepad.active;if(r||sT.activatesFor(this._view,e.data)){if(!r){const n=new sT({view:this._view,gamepadDevice:e.data.device});this._view.state.switchCameraController(n)&&(this._cameraControllerGamepad=n)}this._cameraControllerGamepad&&this._cameraControllerGamepad.active&&this._cameraControllerGamepad.gamepadDevice===e.data.device&&this._cameraControllerGamepad.handleEventGamepad(e.data)}}};function kbt(t){const e=()=>t(document.visibilityState==="visible");return document.addEventListener("visibilitychange",e),{remove:()=>document.addEventListener("visibilitychange",e)}}var Oh;(function(t){t[t.LEFT=0]="LEFT",t[t.RIGHT=1]="RIGHT",t[t.FORWARD=2]="FORWARD",t[t.BACKWARD=3]="BACKWARD",t[t.UP=4]="UP",t[t.DOWN=5]="DOWN",t[t.HEADINGLEFT=6]="HEADINGLEFT",t[t.HEADINGRIGHT=7]="HEADINGRIGHT",t[t.TILTUP=8]="TILTUP",t[t.TILTDOWN=9]="TILTDOWN",t[t.ZOOMIN=10]="ZOOMIN",t[t.ZOOMOUT=11]="ZOOMOUT"})(Oh||(Oh={}));let zbt=class extends Rl{constructor(e,i){super(!0),this._view=e,this._disableMovements={pan:!0,zoom:!1,ascend:!0,rotate:!1,mode:_t.Local},this._keyToNumber={[i.left]:Oh.LEFT,[i.right]:Oh.RIGHT,[i.forward]:Oh.FORWARD,[i.backward]:Oh.BACKWARD,[i.up]:Oh.UP,[i.down]:Oh.DOWN,[i.headingLeft]:Oh.HEADINGLEFT,[i.headingRight]:Oh.HEADINGRIGHT,[i.tiltUp]:Oh.TILTUP,[i.tiltDown]:Oh.TILTDOWN,[i.zoomIn]:Oh.ZOOMIN,[i.zoomOut]:Oh.ZOOMOUT},this.registerIncoming("key-down",null,r=>this._handleKeyDown(r)),this.registerIncoming("key-up",null,r=>this._handleKeyUp(r)),this.registerIncoming("blur",null,()=>this._handleStop()),this._visibilityHandle=kbt(r=>r?null:this._handleStop())}onUninstall(){var e;(e=this._visibilityHandle)==null||e.remove(),this._handleStop()}_handleKeyDown(e){if(e.data.native.ctrlKey||e.data.native.metaKey)return;const i=this._keyToNumber[e.data.key];i!=null&&(this._cameraControllerKeyboard&&this._cameraControllerKeyboard.active||(this._cameraControllerKeyboard=new sT({view:this._view,disableMovements:this._disableMovements}),this._view.state.switchCameraController(this._cameraControllerKeyboard)),this._cameraControllerKeyboard.active&&(this._cameraControllerKeyboard.activateDirection(i),e.stopPropagation()))}_handleStop(){var e;(e=this._cameraControllerKeyboard)!=null&&e.active&&(this._cameraControllerKeyboard.finishController(),this._cameraControllerKeyboard=null)}_handleKeyUp(e){if(e.data.native.ctrlKey||e.data.native.metaKey)return;const i=this._keyToNumber[e.data.key];i!=null&&this._cameraControllerKeyboard&&this._cameraControllerKeyboard.active&&(this._cameraControllerKeyboard.deactivateDirection(i),e.stopPropagation())}},Ubt=class extends Rl{constructor(e,i){super(!0),this._view=e,this.registerIncoming("mouse-wheel",i,r=>this._handleMouseWheel(r))}_handleMouseWheel(e){if(!this._view.navigation.mouseWheelZoomEnabled)return;const i=e.data;this._cameraController&&this._cameraController.active||(this._cameraController=this._view.state.isGlobal?new LU({view:this._view,mode:"interaction"}):new DU({view:this._view,mode:"interaction"}),this._view.state.switchCameraController(this._cameraController)),this._cameraController.zoomStep(-1/60*i.deltaY,ss(i.x,i.y)),e.preventDefault(),e.stopPropagation()}},kU=class{constructor(e){this._gain=e}reset(e){this._value=e}set gain(e){this._gain=e}get value(){return this._value===void 0?0:this._value}update(e){this._value===void 0?this._value=e:this._value=this._gain*e+(1-this._gain)*this._value}},tE=class extends BL{constructor(){super(...arguments),this._beginCamera=new si,this._elapsedTimeSec=0,this.constraintOptions={selection:Xn.ALL,interactionType:Ki.PAN,interactionFactor:0,interactionStartCamera:new si,interactionDirection:null,tiltMode:nl.TUMBLE}}initialize(){this.constraintOptions.interactionType=this.interactionType,this.viewAnimation=new OP}get steppingFinished(){return this.momentum.isFinished(this._elapsedTimeSec)}onControllerStart(e){this._beginCamera.copyFrom(e),this.constraintOptions.interactionStartCamera=this._beginCamera,super.onControllerStart(e)}stepController(e,i){i.copyViewFrom(this._beginCamera),this._elapsedTimeSec+=e,this.momentumStep(this._elapsedTimeSec,i),xo(this.view,i,this.constraintOptions)}};tE=y([Z("esri.views.3d.state.controllers.momentum.MomentumController")],tE);let A$=class extends tE{constructor(e){super(e),this.interactionType=Ki.PAN,this._tmpPan=W()}momentumStep(e,i){const r=this.momentum.value(e);De(this._tmpPan,this.momentum.direction,r),i.eye=je(tye,i.eye,this._tmpPan),i.center=je(tye,i.center,this._tmpPan),this.constraintOptions.interactionDirection=this._tmpPan}};y([w({constructOnly:!0})],A$.prototype,"momentum",void 0),A$=y([Z("esri.views.3d.state.controllers.momentum.PanPlanarMomentumController")],A$);const tye=W(),Vbt=W(),AN=W();let lk=class extends tE{constructor(e){super(e),this.interactionType=Ki.PAN}momentumStep(e,i){const r=this.momentum.value1(e),n=this.momentum.value2(e);Ne(AN,i.eye),Ye(AN,AN),Wt(this.momentum.axis2,AN,this.momentum.axis1),r9e(i,Vbt,this.momentum.axis1,r,this.momentum.axis2,n)}};y([w({constructOnly:!0})],lk.prototype,"momentum",void 0),lk=y([Z("esri.views.3d.state.controllers.momentum.PanSphericalMomentumController")],lk);let zS=class extends tE{set center(e){this._set("center",Xr(e))}set axis(e){this._set("axis",Xr(e))}constructor(e){super(e),this.interactionType=Ki.TUMBLE}momentumStep(e,i){const r=this.momentum.value(e);K2(i,this.center,jL(this.axis,r))}};y([w({constructOnly:!0})],zS.prototype,"momentum",void 0),y([w({constructOnly:!0})],zS.prototype,"center",null),y([w({constructOnly:!0})],zS.prototype,"axis",null),zS=y([Z("esri.views.3d.state.controllers.momentum.MomentumController")],zS);let GM=class extends tE{set zoomCenter(e){this._set("zoomCenter",Xr(e))}constructor(e){super(e),this.interactionType=Ki.ZOOM,this.constraintOptions.interactionDirection=W()}momentumStep(e,i){const{interactionDirection:r}=this.constraintOptions;if(!r)return;Ne(r,i.eye);const n=this.momentum.valueDelta(0,e);gle(i,this.zoomCenter,n,this.view.state.constraints.minimumPoiDistance),k_(r,i.eye,r)}};y([w({constructOnly:!0})],GM.prototype,"momentum",void 0),y([w({constructOnly:!0})],GM.prototype,"zoomCenter",null),GM=y([Z("esri.views.3d.state.controllers.momentum.ZoomPlanarMomentumController")],GM);let rS=class extends tE{set screenCenter(e){this._set("screenCenter",ss(e[0],e[1]))}set sceneCenter(e){this._set("sceneCenter",Xr(e))}constructor(e){super(e),this.interactionType=Ki.ZOOM,this.radius=0,this._tmpSceneCenter=W(),this._tmpZoomAxisAngle=eG(),this._sphere=uo()}initialize(){this._sphere[3]=this.radius}momentumStep(e,i){const r=this.momentum.valueDelta(0,e);JLe(this._sphere,i,r),this.constraintOptions.interactionType=Ki.ZOOM,xo(this.view,i,this.constraintOptions),GL(this._sphere,i,this.screenCenter,this._tmpSceneCenter),dle(this.sceneCenter,this._tmpSceneCenter,this._tmpZoomAxisAngle),K2(i,this._sphere,this._tmpZoomAxisAngle),this.constraintOptions.interactionType=Ki.PAN}};y([w({constructOnly:!0})],rS.prototype,"momentum",void 0),y([w({constructOnly:!0})],rS.prototype,"screenCenter",null),y([w({constructOnly:!0})],rS.prototype,"sceneCenter",null),y([w({constructOnly:!0})],rS.prototype,"radius",void 0),rS=y([Z("esri.views.3d.state.controllers.momentum.ZoomSphericalMomentumController")],rS);let pm=class{constructor(e){this._gain=e,this.lastValue=void 0,this.filteredDelta=void 0}update(e){if(this.hasLastValue()){const i=this.computeDelta(e);this._updateDelta(i)}this.lastValue=e}reset(){this.lastValue=void 0,this.filteredDelta=void 0}hasLastValue(){return this.lastValue!==void 0}hasFilteredDelta(){return this.filteredDelta!==void 0}computeDelta(e){return this.lastValue===void 0?NaN:e-this.lastValue}_updateDelta(e){this.filteredDelta!==void 0?this.filteredDelta=(1-this._gain)*this.filteredDelta+this._gain*e:this.filteredDelta=e}},nG=class{constructor(e,i,r){this._initialVelocity=e,this._stopVelocity=i,this._friction=r,this._duration=Math.abs(Math.log(Math.abs(this._initialVelocity)/this._stopVelocity)/Math.log(1-this._friction))}get duration(){return this._duration}isFinished(e){return e>this.duration}get friction(){return this._friction}value(e){return this.valueFromInitialVelocity(this._initialVelocity,e)}valueDelta(e,i){const r=this.value(e);return this.value(e+i)-r}valueFromInitialVelocity(e,i){i=Math.min(i,this.duration);const r=1-this.friction;return e*(r**i-1)/Math.log(r)}},Bbt=class extends nG{constructor(e,i,r,n,s){super(e,i,r),this._sceneVelocity=n,this.direction=s}value(e){return super.valueFromInitialVelocity(this._sceneVelocity,e)}},y9e=class{constructor(e=300,i=12,r=.84){this._minimumInitialVelocity=e,this._stopVelocity=i,this._friction=r,this.enabled=!0,this._time=new pm(.6),this._screen=[new pm(.4),new pm(.4)],this._scene=[new pm(.6),new pm(.6),new pm(.6)],this._tmpDirection=W()}add(e,i,r){if(this.enabled){if(this._time.hasLastValue()&&this._time.computeDelta(r)<.015)return;this._screen[0].update(e[0]),this._screen[1].update(e[1]),this._scene[0].update(i[0]),this._scene[1].update(i[1]),this._scene[2].update(i[2]),this._time.update(r)}}reset(){this._screen[0].reset(),this._screen[1].reset(),this._scene[0].reset(),this._scene[1].reset(),this._scene[2].reset(),this._time.reset()}evaluateMomentum(){if(!this.enabled||!this._screen[0].hasFilteredDelta()||!this._time.hasFilteredDelta())return null;const e=this._screen[0].filteredDelta,i=this._screen[1].filteredDelta,r=e==null||i==null?0:Math.sqrt(e*e+i*i),n=this._time.filteredDelta,s=n==null||r==null?0:r/n;return Math.abs(s)0&&De(this._tmpDirection,this._tmpDirection,1/n);const s=this._time.filteredDelta;return new Bbt(e,i,r,s==null?0:n/s,this._tmpDirection)}},iye=class{constructor(e){this._gain=e}update(e){this.filteredValue!==void 0?this.filteredValue=(1-this._gain)*this.filteredValue+this._gain*e:this.filteredValue=e}reset(){this.filteredValue=void 0}get hasFilteredValue(){return this.filteredValue!==void 0}};const rye=1e-5;let jbt=class extends nG{constructor(e,i,r,n,s,o=0,a){super(e,i,r),this._angularVelocity1=n,this.axis1=s,this.angularVelocity2=o,this.axis2=a}value1(e){return super.valueFromInitialVelocity(this._angularVelocity1,e)}value2(e){return super.valueFromInitialVelocity(this.angularVelocity2,e)}},Gbt=class{constructor(e=300,i=12,r=.84){this._minimumInitialVelocity=e,this._stopVelocity=i,this._friction=r,this.enabled=!0,this._tmpAxis1=W(),this._tmpAxis2=W(),this._tmpAngles=yt(),this._time=new pm(.3),this._screen=[new pm(.4),new pm(.4)],this._angle1=new iye(.6),this._angle2=new iye(.6),this._axis1=W(),this._axis2=W(),this._lastScene=W()}addMomentumDirectRotation(e,i,r,n,s,o){if(this.enabled){if(this._time.hasLastValue()){if(this._time.computeDelta(r)<.01)return;let a=t9e(this._lastScene,i,this._tmpAxis2,n,s,o);this._angle2.update(0),Al(this._tmpAxis2)Math.PI;)n-=2*Math.PI;for(;n<-Math.PI;)n+=2*Math.PI;e=r+n}super.add(e,i)}},Hbt=class extends nG{constructor(e,i,r){super(e,i,r)}value(e){const i=super.value(e);return Math.exp(i)}valueDelta(e,i){const r=super.value(e),n=super.value(e+i)-r;return Math.exp(n)}},b9e=class extends v9e{constructor(e=2.5,i=.01,r=.95,n=12){super(e,i,r,n)}add(e,i){super.add(Math.log(e),i)}createMomentum(e,i,r){return new Hbt(e,i,r)}},iie=class extends Sy{constructor(){super(...arguments),this._smoothRotation=new kU(.05),this._rotationAxis=W(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=Fi(),this._beginRadius=0,this._smoothScaling=new kU(.05),this._zoomCenterScreen=ss(),this._zoomMomentumEstimator=new b9e,this._rotationMomentumEstimator=new _9e,this._panSphericalMomentumEstimator=new Gbt,this._panPlanarMomentumEstimator=new y9e,this._adjustedSphere=uo(),this._tmp3d=W(),this._tmpScreenPointArray=ss(),this._beginScreenPoint=ss(),this._beginScenePoint=W(),this._screenPickPoint=ss(),this._scenePickPoint=W(),this._mode=Ja.Horizontal,this._sphere=uo(),this._pointerCount=0,this._tmpInteractionDirection=W(),this._constraintOptions={selection:Xn.ALL,interactionType:Ki.NONE,interactionFactor:0,interactionStartCamera:new si,interactionDirection:null,tiltMode:nl.TUMBLE}}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(e){var s;if(!this.active)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panPlanarMomentumEstimator.enabled=i,this._panSphericalMomentumEstimator.enabled=i,this._beginHeading=-j2.normalize(Ei(this.view.camera.heading)),this._beginRadius=e.radius,this._pointerCount=e.pointers.size,this._beginAngle=e.angle,this._smoothRotation.reset(),mm(e.center,this._screenPickPoint),ea(this._beginScreenPoint,this._screenPickPoint);const r=Tr(this.view.spatialReference),n=QLe(this._intersectionHelper,this.startCamera,this._screenPickPoint,r,LP.Silhouette,this.view.map.ground.opacity===0?$E:{});n.scenePickPoint!=null&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,Ne(this._beginScenePoint,this._scenePickPoint),this._mode=iG(this.startCamera,this._screenPickPoint,r),this._mode===Ja.Vertical&&this._preparePlanarPanMode(e,n.hasGeometryIntersection),(s=this._constraintOptions.interactionStartCamera)==null||s.copyFrom(this.startCamera))}update(e){if(!this.active)return;this.currentCamera.copyFrom(this.startCamera);const i=e.pointers.size>1;this._mode===Ja.Horizontal?(i&&this._zoomSpherical(e),this._panningSpherical(e),i&&this._rotateSpherical(e)):(i&&this._zoomPlanar(e),this._panningPlanar(e),i&&this._rotatePlanar(e)),this.commitCamera()}end(e){e.pointers.size===this._pointerCount&&this.update(e),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return this._mode===Ja.Horizontal?new rS({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere[3]}):new GM({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const r=this._rotationMomentumEstimator.evaluateMomentum();if(r)return new zS({view:this.view,momentum:r,center:this._sphere,axis:this._rotationAxis});if(this._mode===Ja.Horizontal){const n=this._panSphericalMomentumEstimator.evaluateMomentum();if(n)return new lk({view:this.view,momentum:n})}else{const n=this._panPlanarMomentumEstimator.evaluateMomentum();if(n)return new A$({view:this.view,momentum:n})}return null}_preparePlanarPanMode(e,i){const r=Cc(this._tmp3d,this.startCamera.viewForward);G_(this._scenePickPoint,r,this._panningPlane);const n=ss(this._screenPickPoint[0],0),s=W(),o=nt(this.startCamera.eye);this._adjustedSphere[3]=o=qbt.ANGLE_THRESHOLD?Ja.Horizontal:Ja.Vertical;const p=Math.min(XLe,1/Math.abs(Ve(o,this.startCamera.viewForward)))*Math.max(Math.abs(this.view.camera.position.z),ZLe);CQ(this._planeHorizontal,this._planeHorizontal,r),this.startCamera.aboveGround||AQ(this._planeHorizontal,this._planeHorizontal);const _=W(),x=W(),S=W();je(_,r,this.currentCamera.eye);const C=nt(_);if(Ye(_,_),this._panMode===Ja.Vertical){De(o,o,a),je(this._planeVertical,s,o),Ye(this._planeVertical,this._planeVertical),CQ(this._planeVertical,this._planeVertical,r);const P=this.view._stage.renderView.getMinimalDepthForArea(HL(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,tG);let $=P??p;$=n?Math.min($,C):$,Ne(S,Be(x,this.currentCamera.eye,De(x,_,$))),this._planeVertical[3]=-Ve(this._planeVertical,S),this._computePlanePoints(e.pointers,this._planeVertical,this.startCamera,this._tmpPoints),Yq(this._tmpPoints,this._beginCenter)}else{const P=n?C:p;Ne(S,Be(x,this.currentCamera.eye,De(x,_,P))),this._planeHorizontal[3]=-Ve(this._planeHorizontal,S),this._computePlanePoints(e.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),Yq(this._tmpPoints,this._beginCenter)}(M=this._constraintOptions.interactionStartCamera)==null||M.copyFrom(this.startCamera)}update(e){if(!this.active)return;this.currentCamera.copyFrom(this.startCamera);const i=e.pointers.size>1,r=this._panMode===Ja.Horizontal?this._planeHorizontal:this._planeVertical,n=this._beginCenter;if(i){const s=this._beginRadius/e.radius,o=.001875*Math.min(Math.max(e.radius,40),120);this._scalingValueSmooth.gain=o,this._scalingValueSmooth.update(s),gle(this.currentCamera,n,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*e.timestamp),this._constraintOptions.interactionType=Ki.ZOOM,this._constraintOptions.interactionFactor=dm(Math.abs(e.radius-this._beginRadius)),xo(this.view,this.currentCamera,this._constraintOptions)}if(this._computePlanePoints(e.pointers,r,this.currentCamera,this._tmpPoints),Yq(this._tmpPoints,this._tmpCentroid3d),mm(e.center,this._tmpCentroid2d),e9e(this.currentCamera,n,this._tmpCentroid3d),this._panMomentumEstimator.add(this._tmpCentroid2d,this._tmpCentroid3d,.001*e.timestamp),this._constraintOptions.interactionType=Ki.PAN,this._constraintOptions.interactionFactor=dm(km(this._beginCenterScreen,this._tmpCentroid2d)),xo(this.view,this.currentCamera,this._constraintOptions),i){const s=this._planeHorizontal,o=n,a=this._rotationValueSmooth.value,c=a+Jte(e.angle-a),p=.00125*Math.min(Math.max(e.radius,40),120);this._rotationValueSmooth.gain=p,this._rotationValueSmooth.update(c);const _=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(_,.001*e.timestamp),K2(this.currentCamera,o,jL(s,_)),this._constraintOptions.interactionType=Ki.TUMBLE,this._constraintOptions.interactionFactor=dm(Math.abs(e.radius*_)),xo(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(e){e.pointers.size===this._pointerCount&&this.update(e),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return new GM({view:this.view,momentum:i,zoomCenter:this._beginCenter});const r=this._rotationMomentumEstimator.evaluateMomentum();if(r)return new zS({view:this.view,momentum:r,center:this._beginCenter,axis:this._planeHorizontal});const n=this._panMomentumEstimator.evaluateMomentum();return n?new A$({view:this.view,momentum:n}):null}_computePlanePoints(e,i,r,n){n.length=e.size;const s=this._tmp2d;let o=0;return e.forEach(a=>{s[0]=a.x,s[1]=a.y,n[o]===void 0&&(n[o]=W()),Kte(i,r,s,n[o]),o+=1}),n}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};rie=y([Z("esri.views.3d.state.controllers.local.PinchAndPanController")],rie);let sye=class extends Rl{constructor(e,i,r){super(!0),this._view=e,this.pointerAction=i,this._lastEndTimestamp=0,this._lastTimestamp=0,this.registerIncoming("drag",r,n=>this._handleDrag(n))}_handleDrag(e){if(e.data.pointerType==="mouse"&&!_le(e.data,this.pointerAction))return;const i=e.timestamp-this._lastEndTimestamp,r=40,n=this._momentum&&this._momentum.active&&i2&&(this._controller.update(e.data),this._lastTimestamp=e.timestamp):this._startController(e);break;case"end":case"removed":this._endController(e,!0);break;case"added":this._endController(e,!1),this._startController(e)}e.stopPropagation()}_endController(e,i){if(this._controller&&this._controller.active){this._lastEndTimestamp=e.timestamp;const r=this._controller.end(e.data);i&&r&&(this._momentum=r,this._view.state.switchCameraController(this._momentum))}this._controller=null}_startController(e){this._controller=this._createController(),this._view.state.switchCameraController(this._controller),this._controller.begin(e.data),this._lastTimestamp=e.timestamp}_createController(){return this._view.state.isGlobal?new iie({view:this._view}):new rie({view:this._view})}},Wbt=class extends Rl{constructor(e,i){super(!0),this.view=e,this.registerIncoming("pointer-down",i,()=>this.view.state.stopActiveCameraController())}},w9e=class extends Rl{constructor(e,i){super(!0),this.key=e,this.registerIncoming("key-down",i,r=>this._handleKeyDown(r))}_handleKeyDown(e){e.data.key===this.key&&(this.activate(),e.stopPropagation())}},Ybt=class extends w9e{constructor(e,i,r){super(i,r),this.view=e}activate(){this.view.goTo({heading:0}).catch(()=>{})}},Xbt=class extends w9e{constructor(e,i,r){super(i,r),this.view=e}activate(){this.view.goTo({tilt:0}).catch(()=>{})}},Zbt=class extends Rl{constructor(e,i=!1){super(!0),this._view=e,this._invert=i,this.registerIncoming("vertical-two-finger-drag",r=>this._handleTwoFinger(r))}_handleTwoFinger(e){var n,s,o;const i=this._invert?-1:1,r=ss(0,e.data.delta*i);switch(e.data.action){case"begin":(n=this._cameraController)==null||n.end(),this._cameraController=new C$({view:this._view,pivot:kh.CENTER}),this._view.state.switchCameraController(this._cameraController),this._cameraController.begin(r);break;case"update":(s=this._cameraController)==null||s.update(r);break;case"end":(o=this._cameraController)==null||o.end(),this._cameraController=null}}};function oye(t){const e=t.native;return e?{buttons:e.buttons.map(i=>i.pressed?i.value||1:0),axes:e.axes.map(i=>Qbt(i,t.axisThreshold))}:{buttons:[],axes:[]}}function Jbt(t,e){if(t.axes.length!==e.axes.length||t.buttons.length!==e.buttons.length)return!1;for(let i=0;i{this._connectGamepad(s.gamepad)},this._onDisconnectGamepad=s=>{const o=s.gamepad,a=o.index,c=this._inputDevices[a];c&&(this._emitGamepadEvent(o,oye(c),!1),this._inputDevices.splice(a,1),this._latestUpdate.splice(a,1),this._input.gamepad.devices.remove(c),this.ensurePollingState())},this._frameTask=null,this._latestUpdate=new Array,this._inputDevices=new Array,this._callback=null;const r="getGamepads"in window.navigator,n=window.isSecureContext;this.supported=r&&n,this.supported&&(this._forEachGamepad(s=>this._connectGamepad(s)),window.addEventListener("gamepadconnected",this._onConnectGamepad),window.addEventListener("gamepaddisconnected",this._onDisconnectGamepad),this.ensurePollingState())}destroy(){this.hasEventListeners=!1,this.supported&&(window.removeEventListener("gamepadconnected",this._onConnectGamepad),window.removeEventListener("gamepaddisconnected",this._onDisconnectGamepad))}set hasEventListeners(e){this._hasEventListeners!==e&&(this._hasEventListeners=e,this.ensurePollingState())}get _eventsEnabled(){return this.supported&&this._inputDevices.length>0&&this._hasEventListeners}set onEvent(e){this._callback=e}_connectGamepad(e){const i=new xae(e);i.deviceType!=="unknown"&&(this._inputDevices[e.index]=i,this._input.gamepad.devices.add(i)),this.ensurePollingState()}ensurePollingState(){this._eventsEnabled?this._startPolling():this._stopPolling()}_startPolling(){this._frameTask==null&&(this._frameTask=LT({update:()=>this._readGamepadState()}))}_stopPolling(){this._frameTask!=null&&(this._frameTask.remove(),this._frameTask=null,this._latestUpdate=new Array)}_readGamepadState(){const e=document.hasFocus(),i=this._element.contains(document.activeElement),r=this._input.gamepad.enabledFocusMode==="document"&&!e||this._input.gamepad.enabledFocusMode==="view"&&!i;this._forEachGamepad(n=>{const s=this._inputDevices[n.index];if(!s)return;const o=this._latestUpdate[n.index],a=oye(s),c=r||Kbt(a);o&&(o.timestamp===n.timestamp||!o.active&&c||Jbt(o.state,a))||this._emitGamepadEvent(n,a,!c)})}_forEachGamepad(e){const i=window.navigator.getGamepads();for(let r=0;r{},this._activePointerCaptures=new Set,this._keyDownState=new Set,this._eventId=1,this._browserTouchPanningEnabled=!1,this._element=e,e.getAttribute("tabindex")||e.setAttribute("tabindex","0"),this._eventHandlers={"key-down":this._handleKey,"key-up":this._handleKey,"pointer-down":this._handlePointer,"pointer-move":this._handlePointerPreventDefault,"pointer-up":this._handlePointerPreventDefault,"pointer-enter":this._handlePointer,"pointer-leave":this._handlePointer,"pointer-cancel":this._handlePointer,"mouse-wheel":this._handleMouseWheel,"pointer-capture-lost":this._handlePointerCaptureLost},this._updateTouchAction(),this._element.addEventListener("keydown",this._preventAltKeyDefault),this._gamepadSource=new ewt(e,this._input),this._gamepadSource.onEvent=r=>this._callback("gamepad",r)}destroy(){this._callback=()=>{},this.activeEvents=null,this._activePointerCaptures.forEach(e=>{this._releasePointerCaptureSafe(e)}),this._gamepadSource=et(this._gamepadSource),this._activePointerCaptures=null,this._removeTouchAction(),this._element.removeEventListener("keydown",this._preventAltKeyDefault)}get browserTouchPanningEnabled(){return this._browserTouchPanningEnabled}set browserTouchPanningEnabled(e){this._browserTouchPanningEnabled=e,this._updateTouchAction(),this._updateTouchEventHandling()}set onEventReceived(e){this._callback=e}set activeEvents(e){for(const i in this._active)if(!e||!e.has(i)){const r=this._active[i];this._element.removeEventListener(oW[i],r),delete this._active[i]}e&&e.forEach(i=>{if(!this._active[i]&&oW[i]){const r=(this._eventHandlers[i]||this._handleDefault).bind(this,i);this._element.addEventListener(oW[i],r),this._active[i]=r}}),this._gamepadSource.hasEventListeners=(e==null?void 0:e.has("gamepad"))??!1}setPointerCapture(e,i){i?this._setPointerCatpureSafe(e.pointerId):(this._releasePointerCaptureSafe(e.pointerId),this._activePointerCaptures.delete(e.pointerId))}_updateTouchAction(){this._element.classList.remove(this._browserTouchPanningEnabled?mC.touchNone:mC.touchPan),this._element.classList.add(this._browserTouchPanningEnabled?mC.touchPan:mC.touchNone)}_updateTouchEventHandling(){this._browserTouchPanningEnabled?this._element.addEventListener("touchmove",this._preventMultiTouchPanning):this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_removeTouchAction(){this._element.classList.remove(mC.touchNone),this._element.classList.remove(mC.touchPan),this._element.removeEventListener("touchmove",this._preventMultiTouchPanning)}_setPointerCatpureSafe(e){try{this._element.setPointerCapture(e),this._activePointerCaptures.add(e)}catch{}}_releasePointerCaptureSafe(e){try{if(this._element.hasPointerCapture&&!this._element.hasPointerCapture(e))return;this._element.releasePointerCapture(e)}catch{}}_updateNormalizedPointerLikeEvent(e,i){const r=v4e(this._element,e);return S9e.test.disableSubpixelCoordinates&&(r.x=Math.round(r.x),r.y=Math.round(r.y)),i.x=r.x,i.y=r.y,i}_handleKey(e,i){const r=i0t(i);r&&e==="key-up"&&this._keyDownState.delete(r);const n={native:i,key:r,repeat:!!r&&this._keyDownState.has(r)};r&&e==="key-down"&&this._keyDownState.add(n.key),this._callback(e,n)}_handlePointer(e,i){const r=this._updateNormalizedPointerLikeEvent(i,{native:i,x:0,y:0,pointerType:i.pointerType,button:i.button,buttons:i.buttons,eventId:this._eventId++});this._callback(e,r)}_handlePointerPreventDefault(e,i){const r=this._updateNormalizedPointerLikeEvent(i,{native:i,x:0,y:0,pointerType:i.pointerType,button:i.button,buttons:i.buttons,eventId:this._eventId++});i.preventDefault(),this._callback(e,r)}_handleMouseWheel(e,i){let r=i.deltaY;switch(i.deltaMode){case 0:aye&&(r=r/document.documentElement.clientHeight*600);break;case 1:r*=30;break;case 2:r*=900}aye?r*=.7:twt||rwt?r*=.6:iwt&&(r*=1.375);const n=100,s=Math.abs(r);s>n&&(r=r/s*200/(1+Math.exp(-.02*(s-n))));const o=this._updateNormalizedPointerLikeEvent(i,{native:i,x:0,y:0,deltaY:r});this._callback(e,o)}_handlePointerCaptureLost(e,i){this._activePointerCaptures.delete(i.pointerId),this._handleDefault(e,i)}_handleDefault(e,i){const r={native:i};i.preventDefault(),this._callback(e,r)}_preventAltKeyDefault(e){e.key==="Alt"&&e.preventDefault()}_preventMultiTouchPanning(e){e.touches.length>1&&e.preventDefault()}};x9e.test={disableSubpixelCoordinates:!1};const oW={"key-down":"keydown","key-up":"keyup","pointer-down":"pointerdown","pointer-up":"pointerup","pointer-move":"pointermove","mouse-wheel":"wheel","pointer-capture-got":"gotpointercapture","pointer-capture-lost":"lostpointercapture","context-menu":"contextmenu","pointer-enter":"pointerenter","pointer-leave":"pointerleave","pointer-cancel":"pointercancel",focus:"focus",blur:"blur"};let nwt=class extends Rl{constructor(){super(!0),this.registerIncoming("context-menu",e=>{e.data.native.preventDefault()})}};const cp={maximumClickDelay:300,movementUntilMouseDrag:1.5,movementUntilPenDrag:6,movementUntilTouchDrag:6,holdDelay:500,maximumDoubleClickDelay:250,maximumDoubleClickDistance:10,maximumDoubleTouchDelay:350,maximumDoubleTouchDistance:35};function nie(t,e){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)}function swt(t,e){const i=e.x-t.x,r=e.y-t.y;return Math.sqrt(i*i+r*r)}function owt(t,e){if(e?(e.radius=0,e.center.x=0,e.center.y=0):e={radius:0,center:Qu()},t.length===0)return e;if(t.length===1)return e.center.x=t[0].x,e.center.y=t[0].y,e;if(t.length===2){const[k,U]=t,[j,G]=[U.x-k.x,U.y-k.y];return e.radius=Math.sqrt(j*j+G*G)/2,e.center.x=(k.x+U.x)/2,e.center.y=(k.y+U.y)/2,e}let i=0,r=0;for(let k=0;kk.x-i),s=t.map(k=>k.y-r);let o=0,a=0,c=0,p=0,_=0,x=0,S=0;for(let k=0;k{r.initialAngle=ck(r,i)-e,r.lastAngle=ck(r,i)-e})}_emitEvent(e,i,r){const n=MN(this._activePointerMap);this._drag.emit(this._createPayload(e,i,n,r),void 0,this._startStateModifiers)}_handlePointerUpAndPointerLost(e){const i=e.data.native.pointerId,r=e.timestamp;this._activePointerMap.get(i)&&(this._activePointerMap.size===1?(this._updatePointer(e.data),!this._isCurrentDragSuppressed&&this._emitEvent("end",e.data,r),this._isDragging=!1,this._isCurrentDragSuppressed=!1,this._removePointer(i)):(this._removePointer(i),this._emitEvent("removed",e.data,e.timestamp)))}_handlePointerDrag(e){const i=e.data,r=i.currentEvent,n=e.timestamp;switch(i.action){case"start":case"update":this._isDragging?this._activePointerMap.has(r.native.pointerId)?(this._updatePointer(r),!this._isCurrentDragSuppressed&&this._emitEvent("update",r,n)):(this._addPointer(r),this._emitEvent("added",r,n),this._isCurrentDragSuppressed=this._isSuppressed):(this._updatePointer(r),this._pointerType=e.data.startEvent.pointerType,this._mouseButton=e.data.startEvent.button,this._startStateModifiers=e.modifiers,this._isDragging=!0,this._isCurrentDragSuppressed=this._isSuppressed,!this._isCurrentDragSuppressed&&this._emitEvent("start",r,n))}}get _isSuppressed(){return!!this._navigationTouch&&!this._navigationTouch.browserTouchPanEnabled&&this._pointerType==="touch"&&this._activePointerMap.size===1}};function T9e(t){const e=[];return t.forEach(i=>{e.push(Qu(i.event.x,i.event.y))}),owt(e)}function MN(t){const e=T9e(t);let i=0;return t.forEach(r=>{let n=ck(r,e),s=n-r.lastAngle;for(;s>Math.PI;)s-=2*Math.PI;for(;s<-Math.PI;)s+=2*Math.PI;n=r.lastAngle+s,r.lastAngle=n;const o=n-r.initialAngle;i+=o}),i/=t.size||1,{angle:i,radius:e.radius,center:e.center}}function lwt(t){const e=new Map;return t.forEach((i,r)=>e.set(r,i.event)),e}function ck(t,e){const i=t.event,r=i.x-e.center.x,n=i.y-e.center.y;return Math.atan2(n,r)}var cye;(function(t){t[t.Left=0]="Left",t[t.Middle=1]="Middle",t[t.Right=2]="Right",t[t.Back=3]="Back",t[t.Forward=4]="Forward",t[t.Undefined=-1]="Undefined"})(cye||(cye={}));let cwt=class extends Rl{constructor(e=cp.maximumDoubleClickDelay,i=cp.maximumDoubleClickDistance,r=cp.maximumDoubleTouchDelay,n=cp.maximumDoubleTouchDistance,s=E9){super(!1),this._maximumDoubleClickDelay=e,this._maximumDoubleClickDistance=i,this._maximumDoubleTouchDelay=r,this._maximumDoubleTouchDistance=n,this._clock=s,this._pointerState=new Map,this._immediateDoubleClick=this.registerOutgoing("immediate-double-click"),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this)),this.registerIncoming("pointer-up",this._handlePointerUp.bind(this))}onUninstall(){this._pointerState.forEach(e=>{e.immediateDoubleClick&&e.immediateDoubleClick.timeoutHandle.remove()}),super.onUninstall()}_handlePointerDown(e){const i=e.data,r=M$(i);if(!this._pointerState.has(r)){const n={downButton:i.native.button,x:i.x,y:i.y,immediateDoubleClick:null};this._pointerState.set(r,n),this.startCapturingPointer(i.native)}}_handlePointerUp(e){const i=e.data,r=M$(i),n=this._pointerState.get(r);if(n&&n.downButton===i.native.button){const s=n.immediateDoubleClick,o=e.data.native.pointerType==="touch"?this._maximumDoubleTouchDistance:this._maximumDoubleClickDistance;s?(s.timeoutHandle.remove(),nie(s,e.data)>o?this._startImmediateDoubleClick(e,n):(this._immediateDoubleClick.emit(e.data,void 0,s.modifiers),this._removeState(i))):nie(n,e.data)>o?this._removeState(i):this._startImmediateDoubleClick(e,n)}}_startImmediateDoubleClick(e,i){const r=e.data.native.pointerType==="touch"?this._maximumDoubleTouchDelay:this._maximumDoubleClickDelay;i.immediateDoubleClick={x:e.data.x,y:e.data.y,modifiers:e.modifiers,timeoutHandle:this._clock.setTimeout(()=>this._removeState(e.data),r)}}_removeState(e){const i=M$(e);this._pointerState.delete(i),this.stopCapturingPointer(e.native),this.refreshHasPendingInputs()}},uwt=class extends Rl{constructor(e=cp.maximumClickDelay,i=cp.movementUntilMouseDrag,r=cp.movementUntilPenDrag,n=cp.movementUntilTouchDrag,s=cp.holdDelay,o=E9){super(!1),this._maximumClickDelay=e,this._movementUntilMouseDrag=i,this._movementUntilPenDrag=r,this._movementUntilTouchDrag=n,this._holdDelay=s,this._clock=o,this._pointerState=new Map,this._pointerDrag=this.registerOutgoing("pointer-drag"),this._immediateClick=this.registerOutgoing("immediate-click"),this._pointerHold=this.registerOutgoing("hold"),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this)),this.registerIncoming("pointer-up",a=>{this._handlePointerLoss(a,"pointer-up")}),this.registerIncoming("pointer-capture-lost",a=>{this._handlePointerLoss(a,"pointer-capture-lost")}),this.registerIncoming("pointer-cancel",a=>{this._handlePointerLoss(a,"pointer-cancel")}),this._moveHandle=this.registerIncoming("pointer-move",this._handlePointerMove.bind(this)),this._moveHandle.pause()}onUninstall(){this._pointerState.forEach(e=>{e.holdTimeout=en(e.holdTimeout)}),super.onUninstall()}_handlePointerDown(e){const i=e.data,r=i.native.pointerId;let n=null;this._pointerState.size===0&&(n=this._clock.setTimeout(()=>{const o=this._pointerState.get(r);if(o){if(!o.isDragging){const a=o.previousEvent;this._pointerHold.emit(a,void 0,e.modifiers),o.holdEmitted=!0}o.holdTimeout=null}},this._holdDelay));const s={startEvent:i,previousEvent:i,startTimestamp:e.timestamp,isDragging:!1,downButton:i.native.button,holdTimeout:n,modifiers:new Set};this._pointerState.set(r,s),this.startCapturingPointer(i.native),this._moveHandle.resume(),this._pointerState.size>1&&this._startDragging(e)}_createPointerDragData(e,i,r){return{action:e,startEvent:i.startEvent,previousEvent:i.previousEvent,currentEvent:r}}_handlePointerMove(e){const i=e.data,r=i.native.pointerId,n=this._pointerState.get(r);n&&(n.isDragging?this._pointerDrag.emit(this._createPointerDragData("update",n,i),void 0,n.modifiers):swt(i,n.startEvent)>this._getDragThreshold(i.native.pointerType)&&this._startDragging(e),n.previousEvent=i)}_getDragThreshold(e){switch(e){case"touch":return this._movementUntilTouchDrag;case"pen":return this._movementUntilPenDrag;default:return this._movementUntilMouseDrag}}_startDragging(e){const i=e.data,r=i.native.pointerId;this._pointerState.forEach(n=>{n.holdTimeout!=null&&(n.holdTimeout.remove(),n.holdTimeout=null),n.isDragging||(n.modifiers=e.modifiers,n.isDragging=!0,r===n.startEvent.native.pointerId?this._pointerDrag.emit(this._createPointerDragData("start",n,i)):this._pointerDrag.emit(this._createPointerDragData("start",n,n.previousEvent),e.timestamp))})}_handlePointerLoss(e,i){const r=e.data,n=r.native.pointerId,s=this._pointerState.get(n);s&&(s.holdTimeout!=null&&(s.holdTimeout.remove(),s.holdTimeout=null),s.isDragging?this._pointerDrag.emit(this._createPointerDragData("end",s,i==="pointer-up"?r:s.previousEvent),void 0,s.modifiers):i==="pointer-up"&&s.downButton===r.native.button&&e.timestamp-s.startTimestamp<=this._maximumClickDelay&&!s.holdEmitted&&this._immediateClick.emit(r),this._pointerState.delete(n),this.stopCapturingPointer(r.native),this._pointerState.size===0&&this._moveHandle.pause())}},hwt=class extends Rl{constructor(e=cp.maximumDoubleClickDelay,i=cp.maximumDoubleClickDistance,r=cp.maximumDoubleTouchDelay,n=cp.maximumDoubleTouchDistance,s=E9){super(!1),this._maximumDoubleClickDelay=e,this._maximumDoubleClickDistance=i,this._maximumDoubleTouchDelay=r,this._maximumDoubleTouchDistance=n,this._clock=s,this._pointerState=new Map,this._click=this.registerOutgoing("click"),this._doubleClick=this.registerOutgoing("double-click"),this.registerIncoming("immediate-click",this._handleImmediateClick.bind(this)),this.registerIncoming("pointer-down",this._handlePointerDown.bind(this))}onUninstall(){this._pointerState.forEach(e=>e.doubleClickTimer=en(e.doubleClickTimer))}get hasPendingInputs(){return ap(this._pointerState,e=>e.doubleClickTimer!=null)}_clearDoubleClickTimer(e,i){const r=this._pointerState.get(e);r&&(r.doubleClickTimer=en(r.doubleClickTimer),i&&this._click.emit(r.event.data,void 0,r.event.modifiers),this._pointerState.delete(e),this.refreshHasPendingInputs())}_doubleClickTimeoutExceeded(e){const i=this._pointerState.get(e);i.pointerDownCount===1&&this._click.emit(i.event.data,void 0,i.event.modifiers),i.doubleClickTimer=null,this._pointerState.delete(e),this.refreshHasPendingInputs()}_getPointerId(e){const{pointerId:i,pointerType:r,button:n}=e.native;return r==="mouse"?`${i}:${n}`:`${r}`}_handleImmediateClick(e){const i=e.data,{pointerType:r}=i.native,n=this._getPointerId(i);if(!this._pointerState.has(n))return void this._startClick(e);const s=this._pointerState.get(n),{data:o,modifiers:a}=s.event,c=r==="touch"?this._maximumDoubleTouchDistance:this._maximumDoubleClickDistance;nie(o,i)>c?(this._clearDoubleClickTimer(n,!0),this._startClick(e)):(this._clearDoubleClickTimer(n,!1),s.pointerDownCount===2&&this._doubleClick.emit(o,void 0,a))}_handlePointerDown(e){const i=M$(e.data),r=this._pointerState.get(i);r&&(r.pointerDownCount+=1)}_startClick(e){const{data:i}=e,{native:{pointerType:r}}=i,n=M$(i),s=r==="touch"?this._maximumDoubleTouchDelay:this._maximumDoubleClickDelay,o=this._clock.setTimeout(()=>this._doubleClickTimeoutExceeded(n),s),a=1;this._pointerState.set(n,{event:e,doubleClickTimer:o,pointerDownCount:a}),this.refreshHasPendingInputs()}},dwt=class{constructor(e){this._callbacks=e,this._currentCount=0,this._callbacks.condition||(this._callbacks.condition=()=>!0)}handle(e){const i=e.data,r=i.pointers.size;switch(i.action){case"start":this._currentCount=r,this._emitStart(e);break;case"added":this._emitEnd(this._previousEvent),this._currentCount=r,this._emitStart(e);break;case"update":this._emitUpdate(e);break;case"removed":this._startEvent&&this._emitEnd(this._previousEvent),this._currentCount=r,this._emitStart(e);break;case"end":this._emitEnd(e),this._currentCount=0}this._previousEvent=e}_emitStart(e){var i,r;this._startEvent=e,(r=(i=this._callbacks).condition)!=null&&r.call(i,this._currentCount,e)&&this._callbacks.start(this._currentCount,e,this._startEvent)}_emitUpdate(e){var i,r;(r=(i=this._callbacks).condition)!=null&&r.call(i,this._currentCount,e)&&this._callbacks.update(this._currentCount,e,this._startEvent)}_emitEnd(e){var i,r;(r=(i=this._callbacks).condition)!=null&&r.call(i,this._currentCount,e)&&this._callbacks.end(this._currentCount,e,this._startEvent),this._startEvent=null}},pwt=class extends Rl{constructor(e=20,i=40){super(!1),this._threshold=e,this._maxDelta=i,this._state="ready",this._emittedArtificalEnd2=!1,this._vertical=this.registerOutgoing("vertical-two-finger-drag"),this._artificalDrag=this.registerOutgoing("drag"),this._dragEventSeparator=new dwt({start:(r,n)=>this._observeStart(r,n),update:(r,n,s)=>this._observeUpdate(r,n,s),end:(r,n)=>this._observeEnd(n)}),this.registerIncoming("drag",r=>this._dragEventSeparator.handle(r))}get failed(){return this._state==="failed"}_observeStart(e,i){e===1&&this._emittedArtificalEnd2&&(this._emittedArtificalEnd2=!1,this._artificalDrag.emit({action:"start",button:i.data.button,buttons:i.data.buttons,pointerType:i.data.pointerType,timestamp:i.data.timestamp,pointers:i.data.pointers,pointer:i.data.pointer,angle:i.data.angle,radius:i.data.radius,center:i.data.center}),i.stopPropagation()),this._state=e===2?"ready":"failed"}_observeUpdate(e,i,r){if(this._state!=="failed"&&e===2)return this._state==="active"?(this._vertical.emit({delta:i.data.center.y-this._thresholdReachedCenter.y,action:"update"}),void i.stopPropagation()):void(this._checkMovementWithinLimits(i.data,r.data)?this._checkVerticalThresholdReached(i.data,r.data)&&(this._state="active",this._emittedArtificalEnd2=!0,this._thresholdReachedCenter=i.data.center,this._artificalDrag.emit({action:"end",button:i.data.button,buttons:i.data.buttons,pointerType:i.data.pointerType,timestamp:i.data.timestamp,pointers:i.data.pointers,pointer:i.data.pointer,angle:i.data.angle,radius:i.data.radius,center:i.data.center}),this._vertical.emit({delta:i.data.center.y-this._thresholdReachedCenter.y,action:"begin"}),i.stopPropagation()):this._state="failed")}_observeEnd(e){this._state==="active"&&(this._vertical.emit({delta:e.data.center.y-this._thresholdReachedCenter.y,action:"end"}),this._state="ready",e.stopPropagation())}_checkMovementWithinLimits(e,i){let r=-1/0,n=1/0,s=-1/0,o=1/0;for(const{x:P,y:$}of i.pointers.values())r=Math.max(r,P),n=Math.min(n,P),s=Math.max(s,$),o=Math.min(o,$);let a=-1/0,c=1/0,p=-1/0,_=1/0;for(const{x:P,y:$}of e.pointers.values())a=Math.max(a,P),c=Math.min(c,P),p=Math.max(p,$),_=Math.min(_,$);const x=r-n,S=s-o,C=a-c,M=p-_;return Math.abs(e.center.x-i.center.x){const o=i.pointers.get(s);r=Math.min(r,Math.abs(n.y-o.y))}),r>=this._threshold}},U0=class extends ze{destroy(){this.disconnect()}get primaryDragAction(){return this._get("primaryDragAction")}set primaryDragAction(e){e!=="pan"&&e!=="rotate"||e===this._get("primaryDragAction")||(this._set("primaryDragAction",e),this._updateMode())}get mode(){return this._get("mode")}set mode(e){e!=="default"&&e!=="pro"||e===this._get("mode")||(this._set("mode",e),this._updateMode())}get updating(){var e;return!!((e=this._inputManager)!=null&&e.updating)}get latestPointerType(){var e;return(e=this._inputManager)==null?void 0:e.latestPointerType}get latestPointerLocation(){var e;return(e=this._inputManager)==null?void 0:e.latestPointerLocation}get multiTouchActive(){var e;return((e=this._inputManager)==null?void 0:e.multiTouchActive)??!1}disconnect(){this.view.viewEvents.disconnect(),this._inputManager=et(this._inputManager)}connect(){const e=this.view;this._source=new x9e(this.view.surface,e.input);const i=[new cwt,new uwt,new hwt,new awt(this.view.navigation),new pwt],r=new Kp({eventSource:this._source,recognizers:i});this._inputManager=r,r.installHandlers("prevent-context-menu",[new nwt],Cs.INTERNAL),this._modeDragPan=new sye(e,"primary"),this._modeDragRotate=new nW(e,"secondary",kh.CENTER),this._modeDragZoom=new Obt(e,"tertiary");const n={lookAround:"b",pan:{left:"ArrowLeft",right:"ArrowRight",forward:"ArrowUp",backward:"ArrowDown",up:"u",down:"j",headingLeft:"a",headingRight:"d",tiltUp:"w",tiltDown:"s",zoomIn:"+",zoomOut:"-"},resetHeading:"n",resetTilt:"p"};r.installHandlers("navigation",[new Wbt(e),new Z_t(e),new Fbt(e),new zbt(e,n.pan),new Ubt(e),new Xbt(e,n.resetTilt),new Ybt(e,n.resetHeading),new nW(e,"primary",kh.EYE,[n.lookAround]),new nW(e,"secondary",kh.CENTER,[n.lookAround]),new sye(e,"tertiary",[n.lookAround]),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,new Zbt(e)],Cs.INTERNAL),this.view.viewEvents.connect(r),this._updateMode(),this.addHandles(_e(()=>{var s;return(s=this.view.navigation)==null?void 0:s.browserTouchPanEnabled},s=>{this._source.browserTouchPanningEnabled=!s},Qt))}_updateMode(){var n;const e=this.mode,i=this.primaryDragAction,r=(n=sie.get(e))==null?void 0:n.get(i);r&&(this._modeDragPan&&(this._modeDragPan.pointerAction=r.pan),this._modeDragRotate&&(this._modeDragRotate.pointerAction=r.rotate),this._modeDragZoom&&(this._modeDragZoom.pointerAction=r.zoom))}get test(){return{inputManager:this._inputManager,modeDragPan:this._modeDragPan,modeDragRotate:this._modeDragRotate,modeDragZoom:this._modeDragZoom}}};y([w()],U0.prototype,"view",void 0),y([w({value:"pan"})],U0.prototype,"primaryDragAction",null),y([w({value:"default"})],U0.prototype,"mode",null),y([w({readOnly:!0})],U0.prototype,"updating",null),y([w()],U0.prototype,"latestPointerType",null),y([w()],U0.prototype,"latestPointerLocation",null),y([w()],U0.prototype,"multiTouchActive",null),y([w()],U0.prototype,"_inputManager",void 0),U0=y([Z("esri.views.3d.input.SceneInputManager")],U0);const sie=new Map,aW=new Map,lW=new Map;aW.set("pan",{pan:"primary",rotate:"secondary",zoom:"tertiary"}),aW.set("rotate",{pan:"secondary",rotate:"primary",zoom:"tertiary"}),lW.set("pan",{pan:"primary",rotate:"tertiary",zoom:"secondary"}),lW.set("rotate",{pan:"tertiary",rotate:"primary",zoom:"secondary"}),sie.set("default",aW),sie.set("pro",lW);const fwt=U0;let go=class extends ze{constructor(){super(...arguments),this.SCENEVIEW_HITTEST_RETURN_INTERSECTOR=!1,this.DECONFLICTOR_SHOW_VISIBLE=!1,this.DECONFLICTOR_SHOW_INVISIBLE=!1,this.DECONFLICTOR_SHOW_GRID=!1,this.LABELS_SHOW_BORDER=!1,this.TEXT_SHOW_BASELINE=!1,this.TEXT_SHOW_BORDER=!1,this.OVERLAY_DRAW_DEBUG_TEXTURE=!1,this.OVERLAY_SHOW_CENTER=!1,this.SHOW_POI=!1,this.TESTS_DISABLE_OPTIMIZATIONS=!1,this.TESTS_DISABLE_FAST_UPDATES=!1,this.DRAW_MESH_GEOMETRY_NORMALS=!1,this.FEATURE_TILE_FETCH_SHOW_TILES=!1,this.FEATURE_TILE_TREE_SHOW_TILES=!1,this.TERRAIN_TILE_TREE_SHOW_TILES=!1,this.I3S_TREE_SHOW_TILES=!1,this.I3S_SHOW_MODIFICATIONS=!1,this.LOD_INSTANCE_RENDERER_DISABLE_UPDATES=!1,this.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL=!1,this.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES=!1,this.LINE_WIREFRAMES=!1}};y([w()],go.prototype,"SCENEVIEW_HITTEST_RETURN_INTERSECTOR",void 0),y([w()],go.prototype,"DECONFLICTOR_SHOW_VISIBLE",void 0),y([w()],go.prototype,"DECONFLICTOR_SHOW_INVISIBLE",void 0),y([w()],go.prototype,"DECONFLICTOR_SHOW_GRID",void 0),y([w()],go.prototype,"LABELS_SHOW_BORDER",void 0),y([w()],go.prototype,"TEXT_SHOW_BASELINE",void 0),y([w()],go.prototype,"TEXT_SHOW_BORDER",void 0),y([w()],go.prototype,"OVERLAY_DRAW_DEBUG_TEXTURE",void 0),y([w()],go.prototype,"OVERLAY_SHOW_CENTER",void 0),y([w()],go.prototype,"SHOW_POI",void 0),y([w()],go.prototype,"TESTS_DISABLE_OPTIMIZATIONS",void 0),y([w()],go.prototype,"TESTS_DISABLE_FAST_UPDATES",void 0),y([w()],go.prototype,"DRAW_MESH_GEOMETRY_NORMALS",void 0),y([w()],go.prototype,"FEATURE_TILE_FETCH_SHOW_TILES",void 0),y([w()],go.prototype,"FEATURE_TILE_TREE_SHOW_TILES",void 0),y([w()],go.prototype,"TERRAIN_TILE_TREE_SHOW_TILES",void 0),y([w()],go.prototype,"I3S_TREE_SHOW_TILES",void 0),y([w()],go.prototype,"I3S_SHOW_MODIFICATIONS",void 0),y([w()],go.prototype,"LOD_INSTANCE_RENDERER_DISABLE_UPDATES",void 0),y([w()],go.prototype,"LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL",void 0),y([w()],go.prototype,"EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES",void 0),y([w()],go.prototype,"LINE_WIREFRAMES",void 0),go=y([Z("esri.views.3d.support.DebugFlags")],go);const En=new go;let ep,OO,oie=!1,aie=!1,lie=!1,cie=!1,O$=null;function mwt(t,e){if(!aie||!OO)return;E9e();const i=OO;let r=0;for(let n=0;nywt(t):ep&&(ep.parentElement.removeChild(ep),ep=null)}function E9e(){O$&&(O$(),O$=null)}function ywt(t){ep==null&&(ep=document.createElement("canvas"),ep.setAttribute("id","debugCanvas2d"),t.surface.parentElement.style.position="relative",t.surface.parentElement.appendChild(ep));const{state:e}=t,{camera:i,pixelRatio:r}=e,{width:n,height:s}=i,o=n*r,a=s*r;ep.setAttribute("width",`${o}px`),ep.setAttribute("height",`${a}px`),ep.setAttribute("style",`position:absolute;left:0px;top:0px;display:block;pointer-events:none;width:${n}px;height:${s}px`),OO=ep.getContext("2d"),OO.clearRect(0,0,n,s),OO.font="12px Arial"}function C9e(t,e,i,r,n){E9e();const s=ep.height,o=OO;o.beginPath(),o.lineWidth=1,o.strokeStyle=n,o.moveTo(t,s-i),o.lineTo(e,s-i),o.stroke(),o.lineTo(e,s-r),o.stroke(),o.lineTo(e,s-i),o.stroke(),o.lineTo(t,s-i),o.stroke(),o.lineTo(t,s-i),o.stroke(),o.closePath()}function vwt(t,e){oie&&(e&&lie||!e&&cie)&&C9e(t.aabr[0],t.aabr[2],t.aabr[1],t.aabr[3],e?"green":"red")}var Wl,Za;(function(t){t[t.USER=1]="USER",t[t.SCALE_RANGE=2]="SCALE_RANGE",t[t.FILTER=4]="FILTER",t[t.DECONFLICTION=8]="DECONFLICTION",t[t.ALL_GRAPHIC=15]="ALL_GRAPHIC",t[t.ALL_LABEL=255]="ALL_LABEL"})(Wl||(Wl={})),function(t){t[t.GRAPHIC=1]="GRAPHIC",t[t.LABEL=16]="LABEL"}(Za||(Za={}));function A9e(t,e){return new P9e(t,I9e,e)}function _wt(t,e){const{curvatureDependent:i,scaleStart:r,scaleFallOffRange:n}=I9e;return new P9e(t,{curvatureDependent:{min:{curvature:i.min.curvature,tiltAngle:i.min.tiltAngle,scaleFallOffFactor:cW.curvatureDependent.min.scaleFallOffFactor},max:{curvature:i.max.curvature,tiltAngle:i.max.tiltAngle,scaleFallOffFactor:cW.curvatureDependent.max.scaleFallOffFactor}},scaleStart:r,scaleFallOffRange:n,minPixelSize:cW.minPixelSize},e)}function bwt(t){return Math.abs(t*t*t)}function M9e(t,e,i){const r=i.parameters;return uW.scale=Math.min(r.divisor/(e-r.offset),1),uW.factor=bwt(t),uW}function Sle(t,e){return ui(t*Math.max(e.scale,e.minScaleFactor),t,e.factor)}function wwt(t,e,i){const r=M9e(t,e,i);return r.minScaleFactor=0,Sle(1,r)}function uye(t,e,i,r){r.scale=wwt(t,e,i),r.factor=0,r.minScaleFactor=i.minScaleFactor}function O9e(t,e,i=[0,0]){const r=Math.min(Math.max(e.scale,e.minScaleFactor),1);return i[0]=t[0]*r,i[1]=t[1]*r,i}function xwt(t,e,i,r){return Sle(t,M9e(e,i,r))}let P9e=class R9e{get minScaleFactor(){return this._fontHeight!=null?Math.min(this._description.minPixelSize/this._fontHeight,1):0}constructor(e,i,r,n=Swt(),s){this._viewingMode=e,this._description=i,this._ellipsoidRadius=r,this.parameters=n,this._fontHeight=s,this._viewingMode===_t.Local?(this._coverageCompensation=this._surfaceCoverageCompensationLocal,this._calculateCurvatureDependentParameters=this._calculateCurvatureDependentParametersLocal):(this._coverageCompensation=this._surfaceCoverageCompensationGlobal,this._calculateCurvatureDependentParameters=this._calculateCurvatureDependentParametersGlobal)}update(e){return(!this.parameters||this.parameters.camera.fovY!==e.fovY||this.parameters.camera.distance!==e.distance)&&(this._calculateParameters(e,this._ellipsoidRadius,this.parameters),!0)}overrideFontHeight(e){return e!==this._fontHeight?new R9e(this._viewingMode,this._description,this._ellipsoidRadius,this.parameters,e):this}_calculateParameters(e,i,r){const{scaleStart:n,scaleFallOffRange:s}=this._description,{fovY:o,distance:a}=e,c=this._calculateCurvatureDependentParameters(e,i),p=this._coverageCompensation(e,i,c),{tiltAngle:_,scaleFallOffFactor:x}=c,S=Math.sin(_)*a,C=.5*Math.PI-_-o*(.5-n*p),M=S/Math.cos(C),P=C+o*s*p,$=(M-x*(S/Math.cos(P)))/(1-x);return r.camera.fovY=e.fovY,r.camera.distance=e.distance,r.offset=$,r.divisor=M-$,r}_calculateCurvatureDependentParametersLocal(e,i,r=hye){return r.tiltAngle=this._description.curvatureDependent.min.tiltAngle,r.scaleFallOffFactor=this._description.curvatureDependent.min.scaleFallOffFactor,r}_calculateCurvatureDependentParametersGlobal(e,i,r=hye){const n=this._description.curvatureDependent,s=1+e.distance/i,o=Math.sqrt(s*s-1),[a,c]=[n.min.curvature,n.max.curvature],p=Je((o-a)/(c-a),0,1),[_,x]=[n.min,n.max];return r.tiltAngle=ui(_.tiltAngle,x.tiltAngle,p),r.scaleFallOffFactor=ui(_.scaleFallOffFactor,x.scaleFallOffFactor,p),r}_surfaceCoverageCompensationLocal(e,i,r){return(e.fovY-r.tiltAngle)/e.fovY}_surfaceCoverageCompensationGlobal(e,i,r){const n=i*i,s=r.tiltAngle+.5*Math.PI,{fovY:o,distance:a}=e,c=a*a+n-2*Math.cos(s)*a*i,p=Math.sqrt(c),_=Math.sqrt(c-n);return(Math.acos(_/p)-Math.asin(i/(p/Math.sin(s)))+.5*o)/o}};const I9e={curvatureDependent:{min:{curvature:Ei(10),tiltAngle:Ei(12),scaleFallOffFactor:.5},max:{curvature:Ei(70),tiltAngle:Ei(40),scaleFallOffFactor:.8}},scaleStart:.3,scaleFallOffRange:.65,minPixelSize:0},cW={curvatureDependent:{min:{scaleFallOffFactor:.7},max:{scaleFallOffFactor:.95}},minPixelSize:14};function Swt(){return{camera:{distance:0,fovY:0},divisor:0,offset:0}}const uW={scale:0,factor:0,minScaleFactor:0},hye={tiltAngle:0,scaleFallOffFactor:0};function Twt(t){return t instanceof Float32Array&&t.length>=16}function Ewt(t){return Array.isArray(t)&&t.length>=16}function Cwt(t){return Twt(t)||Ewt(t)}var wc,dye;(function(t){t[t.Undefined=0]="Undefined",t[t.DefinedSize=1]="DefinedSize",t[t.DefinedScale=2]="DefinedScale"})(wc||(wc={})),function(t){t[t.Undefined=0]="Undefined",t[t.DefinedAngle=1]="DefinedAngle"}(dye||(dye={}));let Tle=class{constructor(e){this.field=e}},Awt=class extends Tle{constructor(e){super(e),this.minSize=[0,0,0],this.maxSize=[0,0,0],this.offset=[0,0,0],this.factor=[0,0,0],this.type=[wc.Undefined,wc.Undefined,wc.Undefined]}},Mwt=class extends Tle{constructor(e){super(e),this.colors=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.values=[0,0,0,0,0,0,0,0]}},Owt=class extends Tle{constructor(e){super(e),this.values=[0,0,0,0,0,0,0,0],this.opacityValues=[0,0,0,0,0,0,0,0]}},Pwt=class{};function xR(t){return t!=null}function gC(t){return typeof t=="number"}function sG(t){return typeof t=="string"}function Rwt(t){return t==null||sG(t)}function da(t,e){t&&t.push(e)}function Iwt(t,e,i,r=Qe()){const n=t||0,s=e||0,o=i||0;return n!==0&&iP(r,r,-n/180*Math.PI),s!==0&&tP(r,r,s/180*Math.PI),o!==0&&xB(r,r,o/180*Math.PI),r}function xb(t,e,i,r,n){var a;const s=t.minSize,o=t.maxSize;if(t.expression)return da(n,"Could not convert size info: expression not supported"),!1;if(t.useSymbolValue){const c=r.symbolSize[i];return e.minSize[i]=c,e.maxSize[i]=c,e.offset[i]=e.minSize[i],e.factor[i]=0,e.type[i]=wc.DefinedSize,!0}if(xR(t.field))return xR(t.stops)?t.stops.length===2&&gC(t.stops[0].size)&&gC(t.stops[1].size)?(pye(t.stops[0].size,t.stops[1].size,t.stops[0].value,t.stops[1].value,e,i),e.type[i]=wc.DefinedSize,!0):(da(n,"Could not convert size info: stops only supported with 2 elements"),!1):gC(s)&&gC(o)&&xR(t.minDataValue)&&xR(t.maxDataValue)?(pye(s,o,t.minDataValue,t.maxDataValue,e,i),e.type[i]=wc.DefinedSize,!0):t.valueUnit==="unknown"?(da(n,"Could not convert size info: proportional size not supported"),!1):aP[t.valueUnit]!=null?(e.minSize[i]=-1/0,e.maxSize[i]=1/0,e.offset[i]=0,e.factor[i]=1/aP[t.valueUnit],e.type[i]=wc.DefinedSize,!0):(da(n,"Could not convert size info: scale-dependent size not supported"),!1);if(!xR(t.field)){if((a=t.stops)!=null&&a[0]&&gC(t.stops[0].size))return e.minSize[i]=t.stops[0].size,e.maxSize[i]=t.stops[0].size,e.offset[i]=e.minSize[i],e.factor[i]=0,e.type[i]=wc.DefinedSize,!0;if(gC(s))return e.minSize[i]=s,e.maxSize[i]=s,e.offset[i]=s,e.factor[i]=0,e.type[i]=wc.DefinedSize,!0}return da(n,"Could not convert size info: unsupported variant of sizeInfo"),!1}function pye(t,e,i,r,n,s){const o=Math.abs(r-i)>0?(e-t)/(r-i):0;n.minSize[s]=o>0?t:e,n.maxSize[s]=o>0?e:t,n.offset[s]=t-i*o,n.factor[s]=o}function $wt(t,e,i,r){if(t.normalizationField||t.valueRepresentation)return da(r,"Could not convert size info: unsupported property"),null;if(!Rwt(t.field))return da(r,"Could not convert size info: field is not a string"),null;if(e.size){if(t.field)if(e.size.field){if(t.field!==e.size.field)return da(r,"Could not convert size info: multiple fields in use"),null}else e.size.field=t.field}else e.size=new Awt(t.field);let n;switch(t.axis){case"width":return n=xb(t,e.size,0,i,r),n?e:null;case"height":return n=xb(t,e.size,2,i,r),n?e:null;case"depth":return n=xb(t,e.size,1,i,r),n?e:null;case"width-and-depth":return n=xb(t,e.size,0,i,r),n&&xb(t,e.size,1,i,r),n?e:null;case null:case void 0:case"all":return n=xb(t,e.size,0,i,r),n=n&&xb(t,e.size,1,i,r),n=n&&xb(t,e.size,2,i,r),n?e:null;default:return da(r,`Could not convert size info: unknown axis "${t.axis}""`),null}}function Lwt(t,e,i){for(let n=0;n<3;++n){let s=e.unitInMeters;t.type[n]===wc.DefinedSize&&(s*=e.modelSize[n],t.type[n]=wc.DefinedScale),t.minSize[n]=t.minSize[n]/s,t.maxSize[n]=t.maxSize[n]/s,t.offset[n]=t.offset[n]/s,t.factor[n]=t.factor[n]/s}let r;if(t.type[0]!==wc.Undefined)r=0;else if(t.type[1]!==wc.Undefined)r=1;else{if(t.type[2]===wc.Undefined)return da(i,"No size axis contains a valid size or scale"),!1;r=2}for(let n=0;n<3;++n)t.type[n]===wc.Undefined&&(t.minSize[n]=t.minSize[r],t.maxSize[n]=t.maxSize[r],t.offset[n]=t.offset[r],t.factor[n]=t.factor[r],t.type[n]=t.type[r]);return!0}function fye(t,e,i){t[4*e]=i.r/255,t[4*e+1]=i.g/255,t[4*e+2]=i.b/255,t[4*e+3]=i.a}function Dwt(t,e,i){if(t.normalizationField)return da(i,"Could not convert color info: unsupported property"),null;if(sG(t.field)){if(!t.stops)return da(i,"Could not convert color info: missing stops or colors"),null;{if(t.stops.length>8)return da(i,"Could not convert color info: too many color stops"),null;e.color=new Mwt(t.field);const r=t.stops;for(let n=0;n<8;++n){const s=r[Math.min(n,r.length-1)];e.color.values[n]=s.value,fye(e.color.colors,n,s.color)}}}else{if(!(t.stops&&t.stops.length>=0))return da(i,"Could not convert color info: no field and no colors/stops"),null;{const r=t.stops&&t.stops.length>=0&&t.stops[0].color;e.color={field:null,values:[0,0,0,0,0,0,0,0],colors:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]};for(let n=0;n<8;n++)e.color.values[n]=1/0,fye(e.color.colors,n,r)}}return e}function Nwt(t,e,i){if(t.normalizationField)return da(i,"Could not convert opacity info: unsupported property"),null;if(sG(t.field)){if(!t.stops)return da(i,"Could not convert opacity info: missing stops or opacities"),null;{if(t.stops.length>8)return da(i,"Could not convert opacity info: too many opacity stops"),null;e.opacity=new Owt(t.field);const r=t.stops;for(let n=0;n<8;++n){const s=r[Math.min(n,r.length-1)];e.opacity.values[n]=s.value,e.opacity.opacityValues[n]=s.opacity}}}else{if(!(t.stops&&t.stops.length>=0))return da(i,"Could not convert opacity info: no field and no opacities/stops"),null;{const r=t.stops&&t.stops.length>=0?t.stops[0].opacity:0;e.opacity={field:null,values:[0,0,0,0,0,0,0,0],opacityValues:[0,0,0,0,0,0,0,0]};for(let n=0;n<8;n++)e.opacity.values[n]=1/0,e.opacity.opacityValues[n]=r}}return e}function hW(t,e,i){const r=i===2&&t.rotationType==="arithmetic";e.offset[i]=r?90:0,e.factor[i]=r?-1:1,e.type[i]=1}function Fwt(t,e,i){if(!sG(t.field))return da(i,"Could not convert rotation info: field is not a string"),null;if(e.rotation){if(t.field)if(e.rotation.field){if(t.field!==e.rotation.field)return da(i,"Could not convert rotation info: multiple fields in use"),null}else e.rotation.field=t.field}else e.rotation={field:t.field,offset:[0,0,0],factor:[1,1,1],type:[0,0,0]};switch(t.axis){case"tilt":return hW(t,e.rotation,0),e;case"roll":return hW(t,e.rotation,1),e;case null:case void 0:case"heading":return hW(t,e.rotation,2),e;default:return da(i,`Could not convert rotation info: unknown axis "${t.axis}""`),null}}let r6=class{constructor(e,i=[1,1,1],r=[1,1,1],n=1,s=[0,0,0],o=[1,1,1],a=[0,0,0]){this.supports=e,this.modelSize=i,this.symbolSize=r,this.unitInMeters=n,this.anchor=s,this.scale=o,this.rotation=a}};function $9e(t,e,i){if(!t)return null;const r=t.reduce((n,s)=>{if(!n)return n;if(s.valueExpression)return da(i,"Could not convert visual variables: arcade expressions not supported"),null;switch(s.type){case"size":return e.supports.size?$wt(s,n,e,i):n;case"color":return e.supports.color?Dwt(s,n,i):n;case"opacity":return e.supports.opacity?Nwt(s,n,i):null;case"rotation":return e.supports.rotation?Fwt(s,n,i):n;default:return null}},new Pwt);return!(t.length>0&&r)||r.size||r.color||r.opacity||r.rotation?r!=null&&r.size&&!Lwt(r.size,e,i)?null:r:null}let kwt=class{constructor(e,i,r){this.visualVariables=e,this.materialParameters=i,this.requiresShaderTransformation=r}};function DP(t,e){if(!t||En.TESTS_DISABLE_FAST_UPDATES)return null;const i=$9e(t.visualVariables,e);return i?new kwt(i,D9e(i,e),!!i.size):null}function NP(t,e,i){if(!e||!t)return!1;const r=t.visualVariables,n=$9e(e.visualVariables,i);return!!n&&!!(ON(r.size,n.size,"size")&&ON(r.color,n.color,"color")&&ON(r.rotation,n.rotation,"rotation")&&ON(r.opacity,n.opacity,"opacity"))&&(t.visualVariables=n,t.materialParameters=D9e(n,i),t.requiresShaderTransformation=!!n.size,!0)}function ON(t,e,i){if(!!t!=!!e||t&&t.field!==(e==null?void 0:e.field))return!1;if(t&&i==="rotation"){const r=t,n=e;for(let s=0;s<3;s++)if(r.type[s]!==n.type[s]||r.offset[s]!==n.offset[s]||r.factor[s]!==n.factor[s])return!1}return!0}let L9e=class extends bn{constructor(e){super(),this.vvSize=(e==null?void 0:e.size)??null,this.vvColor=(e==null?void 0:e.color)??null,this.vvOpacity=(e==null?void 0:e.opacity)??null}};function D9e(t,e){const i=new L9e(t);return i.vvSize&&(i.vvSymbolAnchor=e.anchor,Yf(P$),Iwt(e.rotation[2],e.rotation[0],e.rotation[1],P$),i.vvSymbolRotationMatrix=i.vvSymbolRotationMatrix||as(),Kf(i.vvSymbolRotationMatrix,P$)),i}function zwt(t,e,i){if(!t.vvSize)return i;Mo(Sb,i);const r=t.vvSymbolRotationMatrix;d1(P$,r[0],r[1],r[2],0,r[3],r[4],r[5],0,r[6],r[7],r[8],0,0,0,0,1),sn(Sb,Sb,P$);for(let n=0;n<3;++n){const s=t.vvSize.offset[n]+e[0]*t.vvSize.factor[n];mye[n]=Je(s,t.vvSize.minSize[n],t.vvSize.maxSize[n])}return L9(Sb,Sb,mye),eh(Sb,Sb,t.vvSymbolAnchor),Sb}function Ele(t,e,i){if(!e.vvSize)return Ie(t,1,1,1),t;for(let r=0;r<3;++r){const n=e.vvSize.offset[r]+i[0]*e.vvSize.factor[r];t[r]=Je(n,e.vvSize.minSize[r],e.vvSize.maxSize[r])}return t}function Rm(t,e){const i=t==null?0:e.attributes[t];return typeof i=="number"&&isFinite(i)?i:0}const Sb=Qe(),mye=W(),P$=Qe();function Cle(t){t.vertex.code.add(V`float screenSizePerspectiveViewAngleDependentFactor(float absCosAngle) { return absCosAngle * absCosAngle * absCosAngle; }`),t.vertex.code.add(V`vec3 screenSizePerspectiveScaleFactor(float absCosAngle, float distanceToCamera, vec3 params) { return vec3( @@ -1250,7 +1239,7 @@ screenSizePerspectiveScaleFactor(absCosAngle, distanceToCamera, params) return mix(size * clamp(factor.x, factor.z, 1.0), size, factor.y); }`),t.vertex.code.add(V`vec2 screenSizePerspectiveScaleVec2(vec2 size, float absCosAngle, float distanceToCamera, vec3 params) { return applyScreenSizePerspectiveScaleFactorVec2(size, screenSizePerspectiveScaleFactor(absCosAngle, distanceToCamera, params)); -}`)}function V2t(t){t.uniforms.add(new Oi("screenSizePerspective",e=>U9e(e.screenSizePerspective)))}function Zj(t){t.uniforms.add(new Oi("screenSizePerspectiveAlignment",e=>U9e(e.screenSizePerspectiveAlignment||e.screenSizePerspective)))}function U9e(t){return Ie(B2t,t.parameters.divisor,t.parameters.offset,t.minScaleFactor)}const B2t=W();function V9e(t,e){const i=t.vertex;e.hasVerticalOffset?(B9e(i),e.hasScreenSizePerspective&&(t.include(ple),Zj(i),Nm(t.vertex,e)),i.code.add(V` +}`)}function Uwt(t){t.uniforms.add(new Oi("screenSizePerspective",e=>N9e(e.screenSizePerspective)))}function oG(t){t.uniforms.add(new Oi("screenSizePerspectiveAlignment",e=>N9e(e.screenSizePerspectiveAlignment||e.screenSizePerspective)))}function N9e(t){return Ie(Vwt,t.parameters.divisor,t.parameters.offset,t.minScaleFactor)}const Vwt=W();function F9e(t,e){const i=t.vertex;e.hasVerticalOffset?(k9e(i),e.hasScreenSizePerspective&&(t.include(Cle),oG(i),zm(t.vertex,e)),i.code.add(V` vec3 calculateVerticalOffset(vec3 worldPos, vec3 localOrigin) { float viewDistance = length((view * vec4(worldPos, 1.0)).xyz); ${e.spherical?V`vec3 worldNormal = normalize(worldPos + localOrigin);`:V`vec3 worldNormal = vec3(0.0, 0.0, 1.0);`} @@ -1266,7 +1255,7 @@ return applyScreenSizePerspectiveScaleFactorVec2(size, screenSizePerspectiveScal vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos + calculateVerticalOffset(worldPos, localOrigin); } - `)):i.code.add(V`vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos; }`)}const j2t=Xi();function B9e(t){t.uniforms.add(new gr("verticalOffset",(e,i)=>{const{minWorldLength:r,maxWorldLength:n,screenLength:s}=e.verticalOffset,o=Math.tan(.5*i.camera.fovY)/(.5*i.camera.fullViewport[3]),l=i.camera.pixelRatio||1;return rs(j2t,s*l,o,r,n)}))}const j9e=.5;function G9e(t,e){t.include(ple),t.attributes.add(J.POSITION,"vec3"),t.attributes.add(J.NORMAL,"vec3"),t.attributes.add(J.AUXPOS1,"vec4");const i=t.vertex;Kh(i,e),Nm(i,e),i.uniforms.add(new gr("viewport",(r,n)=>n.camera.fullViewport),new ft("polygonOffset",r=>r.shaderPolygonOffset),new ft("cameraGroundRelative",(r,n)=>n.camera.aboveGround?1:-1)),e.hasVerticalOffset&&B9e(i),i.constants.add("smallOffsetAngle","float",.984807753012208),i.code.add(V`struct ProjectHUDAux { + `)):i.code.add(V`vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos; }`)}const Bwt=Xi();function k9e(t){t.uniforms.add(new gr("verticalOffset",(e,i)=>{const{minWorldLength:r,maxWorldLength:n,screenLength:s}=e.verticalOffset,o=Math.tan(.5*i.camera.fovY)/(.5*i.camera.fullViewport[3]),a=i.camera.pixelRatio||1;return rs(Bwt,s*a,o,r,n)}))}const z9e=.5;function U9e(t,e){t.include(Cle),t.attributes.add(J.POSITION,"vec3"),t.attributes.add(J.NORMAL,"vec3"),t.attributes.add(J.AUXPOS1,"vec4");const i=t.vertex;td(i,e),zm(i,e),i.uniforms.add(new gr("viewport",(r,n)=>n.camera.fullViewport),new ft("polygonOffset",r=>r.shaderPolygonOffset),new ft("cameraGroundRelative",(r,n)=>n.camera.aboveGround?1:-1)),e.hasVerticalOffset&&k9e(i),i.constants.add("smallOffsetAngle","float",.984807753012208),i.code.add(V`struct ProjectHUDAux { vec3 posModel; vec3 posView; vec3 vnormal; @@ -1302,12 +1291,12 @@ float absCosAngle; return groundRelative; } - `),e.draped&&!e.hasVerticalOffset||S5(i),e.draped||(i.uniforms.add(new ft("perDistancePixelRatio",(r,n)=>Math.tan(n.camera.fovY/2)/(n.camera.fullViewport[2]/2))),i.code.add(V` + `),e.draped&&!e.hasVerticalOffset||IP(i),e.draped||(i.uniforms.add(new ft("perDistancePixelRatio",(r,n)=>Math.tan(n.camera.fovY/2)/(n.camera.fullViewport[2]/2))),i.code.add(V` void applyHUDVerticalGroundOffset(vec3 normalModel, inout vec3 posModel, inout vec3 posView) { float distanceToCamera = length(posView); // Compute offset in world units for a half pixel shift - float pixelOffset = distanceToCamera * perDistancePixelRatio * ${V.float(j9e)}; + float pixelOffset = distanceToCamera * perDistancePixelRatio * ${V.float(z9e)}; // Apply offset along normal in the direction away from the ground surface vec3 modelOffset = normalModel * cameraGroundRelative * pixelOffset; @@ -1318,7 +1307,7 @@ float absCosAngle; posModel += modelOffset; posView += viewOffset; } - `)),e.screenCenterOffsetUnitsEnabled&&bP(i),e.hasScreenSizePerspective&&Zj(i),i.code.add(V` + `)),e.screenCenterOffsetUnitsEnabled&&P5(i),e.hasScreenSizePerspective&&oG(i),i.code.add(V` vec4 projectPositionHUD(out ProjectHUDAux aux) { // centerOffset is in view space and is used to implement world size offset of labels with respect to objects. // It also pulls the label towards the viewer so that the label is visible in front of the object. @@ -1383,7 +1372,7 @@ float absCosAngle; posProj.z -= groundRelative * polygonOffset * posProj.w; return posProj; } - `)}const SN=ya();function H9e(t,e,i,r,n,s){if(t.visible)if(t.boundingInfo){Xt(t.type===Ws.Mesh);const o=e.tolerance;q9e(t.boundingInfo,i,r,o,n,s)}else{const o=t.attributes.get(J.POSITION),l=o.indices;Q9(i,r,0,l.length/3,l,o,void 0,n,s)}}const G2t=W();function q9e(t,e,i,r,n,s){if(t==null)return;const o=Y9e(e,i,G2t);if(HMe(SN,t.bbMin),qMe(SN,t.bbMax),n!=null&&n.applyToAabb(SN),mle(SN,e,o,r)){const{primitiveIndices:l,position:c}=t,f=l?l.length:c.indices.length/3;if(f>Y2t){const _=t.getChildren();if(_!==void 0){for(const x of _)q9e(x,e,i,r,n,s);return}}Q9(e,i,0,f,c.indices,c,l,n,s)}}const W9e=W();function Q9(t,e,i,r,n,s,o,l,c){if(o)return H2t(t,e,i,r,n,s,o,l,c);const{data:f,stride:_}=s,x=t[0],T=t[1],A=t[2],M=e[0]-x,I=e[1]-T,L=e[2]-A;for(let F=i,z=3*i;F0){if(Ft<0||Ft>Ae)continue}else if(Ft>0||Ft0){if(Rt<0||Ft+Rt>Ae)continue}else if(Rt>0||Ft+Rt=0&&c(dt,fle(be,ye,pe,Ee,te,le,W9e),F,!1)}}function H2t(t,e,i,r,n,s,o,l,c){const{data:f,stride:_}=s,x=t[0],T=t[1],A=t[2],M=e[0]-x,I=e[1]-T,L=e[2]-A;for(let F=i;F0){if(Qt<0||Qt>Pe)continue}else if(Qt>0||Qt0){if(dt<0||Qt+dt>Pe)continue}else if(dt>0||Qt+dt=0&&c(pt,fle(ye,pe,Ee,te,le,de,W9e),z,!1)}}const mye=W(),gye=W();function fle(t,e,i,r,n,s,o){return Ie(mye,t,e,i),Ie(gye,r,n,s),Wt(o,mye,gye),Ye(o,o),o}function Y9e(t,e,i){return Ie(i,1/(e[0]-t[0]),1/(e[1]-t[1]),1/(e[2]-t[2]))}function mle(t,e,i,r){return gle(t,e,i,r,1/0)}function gle(t,e,i,r,n){const s=(t[0]-r-e[0])*i[0],o=(t[3]+r-e[0])*i[0];let l=Math.min(s,o),c=Math.max(s,o);const f=(t[1]-r-e[1])*i[1],_=(t[4]+r-e[1])*i[1];if(c=Math.min(c,Math.max(f,_)),c<0||(l=Math.max(l,Math.min(f,_)),l>c))return!1;const x=(t[2]-r-e[2])*i[2],T=(t[5]+r-e[2])*i[2];return c=Math.min(c,Math.max(x,T)),!(c<0)&&(l=Math.max(l,Math.min(x,T)),!(l>c)&&le.push(i)),e}const J9e={multiply:1,ignore:2,replace:3,tint:4},Y2t=1e3;let hx=class extends Z9{constructor(e,i){super(),this.type=Ws.Material,this.supportsEdges=!1,this._visible=!0,this._renderPriority=0,this._vertexAttributeLocations=Er,this._pp0=nt(0,0,1),this._pp1=nt(0,0,0),this._parameters=Z9e(e,i),this.validateParameters(this._parameters)}get parameters(){return this._parameters}update(e){return!1}setParameters(e,i=!0){q2t(this._parameters,e)&&(this.validateParameters(this._parameters),i&&this.parametersChanged())}validateParameters(e){}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.parametersChanged())}shouldRender(e){return this.isVisible()&&this.isVisibleForOutput(e.output)&&(!this.parameters.isDecoration||e.bindParameters.decorations===Xh.ON)&&(this.parameters.renderOccluded&e.renderOccludedMask)!=0}isVisibleForOutput(e){return!0}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}isVisible(){return this._visible}parametersChanged(){var e;(e=this.repository)==null||e.materialChanged(this)}intersectDraped(e,i,r,n,s,o){return this._pp0[0]=this._pp1[0]=n[0],this._pp0[1]=this._pp1[1]=n[1],this.intersect(e,i,r,this._pp0,this._pp1,s)}},K9e=class extends Ovt{constructor(e,i,r){super(i,r),this.camera=e}};var Wn;(function(t){t[t.None=0]="None",t[t.Occlude=1]="Occlude",t[t.Transparent=2]="Transparent",t[t.OccludeAndTransparent=4]="OccludeAndTransparent",t[t.OccludeAndTransparentStencil=8]="OccludeAndTransparentStencil",t[t.Opaque=16]="Opaque"})(Wn||(Wn={}));let yle=class extends _n{constructor(){super(...arguments),this.renderOccluded=Wn.Occlude,this.isDecoration=!1}},Q9e=class{constructor(){this.factor=new yye,this.factorAlignment=new yye}},yye=class{constructor(){this.scale=0,this.factor=0,this.minScaleFactor=0}};function Rsi(t,e,i,r=1){const{data:n,indices:s}=t,o=e.typedBuffer,l=e.typedBufferStride,c=s.length;if(i*=l,r===1)for(let f=0;f{H=s[re]+k,Y=s[re+1]+U,Q=s[re+2]+j}:re=>{const he=s[re],ce=s[re+1],be=s[re+2];H=_*he+A*ce+L*be+k,Y=x*he+M*ce+F*be+U,Q=T*he+I*ce+z*be+j};if(n===1)for(let re=0;re{Y=s[he],Q=s[he+1],ne=s[he+2]}:he=>{const ce=s[he],be=s[he+1],ye=s[he+2];Y=x*ce+M*be+F*ye,Q=T*ce+I*be+z*ye,ne=A*ce+L*be+k*ye};if(n===1)if(U)for(let he=0;he<_;++he){re(3*o[he]);const ce=Y*Y+Q*Q+ne*ne;if(cej){const be=1/Math.sqrt(ce);c[r]=Y*be,c[r+1]=Q*be,c[r+2]=ne*be}else c[r]=Y,c[r+1]=Q,c[r+2]=ne;r+=f}else for(let he=0;he<_;++he)re(3*o[he]),c[r]=Y,c[r+1]=Q,c[r+2]=ne,r+=f;else for(let he=0;he<_;++he){if(re(3*o[he]),U){const ce=Y*Y+Q*Q+ne*ne;if(cej){const be=1/Math.sqrt(ce);Y*=be,Q*=be,ne*=be}}for(let ce=0;cej){const te=1/Math.sqrt(Ee);be*=te,ye*=te,pe*=te}}c[r]=be,c[r+1]=ye,c[r+2]=pe,c[r+3]=ce,r+=f}else for(let Y=0;Y<_;++Y){const Q=4*o[Y],ne=s[Q],re=s[Q+1],he=s[Q+2],ce=s[Q+3];let be=x*ne+M*re+F*he,ye=T*ne+I*re+z*he,pe=A*ne+L*re+k*he;if(U){const Ee=be*be+ye*ye+pe*pe;if(Eej){const te=1/Math.sqrt(Ee);be*=te,ye*=te,pe*=te}}for(let Ee=0;Eel6e(e,i,r)),new Oi("slicePlaneBasis1",(i,r)=>{var n;return kU(e,i,r,(n=r.slicePlane)==null?void 0:n.basis1)}),new Oi("slicePlaneBasis2",(i,r)=>{var n;return kU(e,i,r,(n=r.slicePlane)==null?void 0:n.basis2)}))}function oo(t,e){n6e(t,e,new yp("slicePlaneOrigin",(i,r)=>l6e(e,i,r)),new yp("slicePlaneBasis1",(i,r)=>{var n;return kU(e,i,r,(n=r.slicePlane)==null?void 0:n.basis1)}),new yp("slicePlaneBasis2",(i,r)=>{var n;return kU(e,i,r,(n=r.slicePlane)==null?void 0:n.basis2)}))}function n6e(t,e,...i){if(!e.hasSlicePlane){const o=V`#define rejectBySlice(_pos_) false + `)}const PN=va();function V9e(t,e,i,r,n,s){if(t.visible)if(t.boundingInfo){Xt(t.type===Ws.Mesh);const o=e.tolerance;B9e(t.boundingInfo,i,r,o,n,s)}else{const o=t.attributes.get(J.POSITION),a=o.indices;n6(i,r,0,a.length/3,a,o,void 0,n,s)}}const jwt=W();function B9e(t,e,i,r,n,s){if(t==null)return;const o=G9e(e,i,jwt);if(mMe(PN,t.bbMin),gMe(PN,t.bbMax),n!=null&&n.applyToAabb(PN),Mle(PN,e,o,r)){const{primitiveIndices:a,position:c}=t,p=a?a.length:c.indices.length/3;if(p>Wwt){const _=t.getChildren();if(_!==void 0){for(const x of _)B9e(x,e,i,r,n,s);return}}n6(e,i,0,p,c.indices,c,a,n,s)}}const j9e=W();function n6(t,e,i,r,n,s,o,a,c){if(o)return Gwt(t,e,i,r,n,s,o,a,c);const{data:p,stride:_}=s,x=t[0],S=t[1],C=t[2],M=e[0]-x,P=e[1]-S,$=e[2]-C;for(let F=i,z=3*i;F0){if(Ft<0||Ft>Ae)continue}else if(Ft>0||Ft0){if(It<0||Ft+It>Ae)continue}else if(It>0||Ft+It=0&&c(dt,Ale(ve,ge,pe,Ee,te,le,j9e),F,!1)}}function Gwt(t,e,i,r,n,s,o,a,c){const{data:p,stride:_}=s,x=t[0],S=t[1],C=t[2],M=e[0]-x,P=e[1]-S,$=e[2]-C;for(let F=i;F0){if(ei<0||ei>Re)continue}else if(ei>0||ei0){if(dt<0||ei+dt>Re)continue}else if(dt>0||ei+dt=0&&c(pt,Ale(ge,pe,Ee,te,le,de,j9e),z,!1)}}const gye=W(),yye=W();function Ale(t,e,i,r,n,s,o){return Ie(gye,t,e,i),Ie(yye,r,n,s),Wt(o,gye,yye),Ye(o,o),o}function G9e(t,e,i){return Ie(i,1/(e[0]-t[0]),1/(e[1]-t[1]),1/(e[2]-t[2]))}function Mle(t,e,i,r){return Ole(t,e,i,r,1/0)}function Ole(t,e,i,r,n){const s=(t[0]-r-e[0])*i[0],o=(t[3]+r-e[0])*i[0];let a=Math.min(s,o),c=Math.max(s,o);const p=(t[1]-r-e[1])*i[1],_=(t[4]+r-e[1])*i[1];if(c=Math.min(c,Math.max(p,_)),c<0||(a=Math.max(a,Math.min(p,_)),a>c))return!1;const x=(t[2]-r-e[2])*i[2],S=(t[5]+r-e[2])*i[2];return c=Math.min(c,Math.max(x,S)),!(c<0)&&(a=Math.max(a,Math.min(x,S)),!(a>c)&&ae.push(i)),e}const W9e={multiply:1,ignore:2,replace:3,tint:4},Wwt=1e3;let yx=class extends t6{constructor(e,i){super(),this.type=Ws.Material,this.supportsEdges=!1,this._visible=!0,this._renderPriority=0,this._vertexAttributeLocations=Cr,this._pp0=st(0,0,1),this._pp1=st(0,0,0),this._parameters=q9e(e,i),this.validateParameters(this._parameters)}get parameters(){return this._parameters}update(e){return!1}setParameters(e,i=!0){Hwt(this._parameters,e)&&(this.validateParameters(this._parameters),i&&this.parametersChanged())}validateParameters(e){}get visible(){return this._visible}set visible(e){e!==this._visible&&(this._visible=e,this.parametersChanged())}shouldRender(e){return this.isVisible()&&this.isVisibleForOutput(e.output)&&(!this.parameters.isDecoration||e.bindParameters.decorations===Kh.ON)&&(this.parameters.renderOccluded&e.renderOccludedMask)!=0}isVisibleForOutput(e){return!0}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}isVisible(){return this._visible}parametersChanged(){var e;(e=this.repository)==null||e.materialChanged(this)}intersectDraped(e,i,r,n,s,o){return this._pp0[0]=this._pp1[0]=n[0],this._pp0[1]=this._pp1[1]=n[1],this.intersect(e,i,r,this._pp0,this._pp1,s)}},Y9e=class extends M1t{constructor(e,i,r){super(i,r),this.camera=e}};var Yn;(function(t){t[t.None=0]="None",t[t.Occlude=1]="Occlude",t[t.Transparent=2]="Transparent",t[t.OccludeAndTransparent=4]="OccludeAndTransparent",t[t.OccludeAndTransparentStencil=8]="OccludeAndTransparentStencil",t[t.Opaque=16]="Opaque"})(Yn||(Yn={}));let Ple=class extends bn{constructor(){super(...arguments),this.renderOccluded=Yn.Occlude,this.isDecoration=!1}},X9e=class{constructor(){this.factor=new vye,this.factorAlignment=new vye}},vye=class{constructor(){this.scale=0,this.factor=0,this.minScaleFactor=0}};function zoi(t,e,i,r=1){const{data:n,indices:s}=t,o=e.typedBuffer,a=e.typedBufferStride,c=s.length;if(i*=a,r===1)for(let p=0;p{G=s[ie]+k,Y=s[ie+1]+U,Q=s[ie+2]+j}:ie=>{const he=s[ie],ce=s[ie+1],ve=s[ie+2];G=_*he+C*ce+$*ve+k,Y=x*he+M*ce+F*ve+U,Q=S*he+P*ce+z*ve+j};if(n===1)for(let ie=0;ie{Y=s[he],Q=s[he+1],ne=s[he+2]}:he=>{const ce=s[he],ve=s[he+1],ge=s[he+2];Y=x*ce+M*ve+F*ge,Q=S*ce+P*ve+z*ge,ne=C*ce+$*ve+k*ge};if(n===1)if(U)for(let he=0;he<_;++he){ie(3*o[he]);const ce=Y*Y+Q*Q+ne*ne;if(cej){const ve=1/Math.sqrt(ce);c[r]=Y*ve,c[r+1]=Q*ve,c[r+2]=ne*ve}else c[r]=Y,c[r+1]=Q,c[r+2]=ne;r+=p}else for(let he=0;he<_;++he)ie(3*o[he]),c[r]=Y,c[r+1]=Q,c[r+2]=ne,r+=p;else for(let he=0;he<_;++he){if(ie(3*o[he]),U){const ce=Y*Y+Q*Q+ne*ne;if(cej){const ve=1/Math.sqrt(ce);Y*=ve,Q*=ve,ne*=ve}}for(let ce=0;cej){const te=1/Math.sqrt(Ee);ve*=te,ge*=te,pe*=te}}c[r]=ve,c[r+1]=ge,c[r+2]=pe,c[r+3]=ce,r+=p}else for(let Y=0;Y<_;++Y){const Q=4*o[Y],ne=s[Q],ie=s[Q+1],he=s[Q+2],ce=s[Q+3];let ve=x*ne+M*ie+F*he,ge=S*ne+P*ie+z*he,pe=C*ne+$*ie+k*he;if(U){const Ee=ve*ve+ge*ge+pe*pe;if(Eej){const te=1/Math.sqrt(Ee);ve*=te,ge*=te,pe*=te}}for(let Ee=0;Een6e(e,i,r)),new Oi("slicePlaneBasis1",(i,r)=>{var n;return zU(e,i,r,(n=r.slicePlane)==null?void 0:n.basis1)}),new Oi("slicePlaneBasis2",(i,r)=>{var n;return zU(e,i,r,(n=r.slicePlane)==null?void 0:n.basis2)}))}function ao(t,e){e6e(t,e,new wp("slicePlaneOrigin",(i,r)=>n6e(e,i,r)),new wp("slicePlaneBasis1",(i,r)=>{var n;return zU(e,i,r,(n=r.slicePlane)==null?void 0:n.basis1)}),new wp("slicePlaneBasis2",(i,r)=>{var n;return zU(e,i,r,(n=r.slicePlane)==null?void 0:n.basis2)}))}function e6e(t,e,...i){if(!e.hasSlicePlane){const o=V`#define rejectBySlice(_pos_) false #define discardBySlice(_pos_) {} #define highlightSlice(_color_, _pos_) (_color_)`;return e.hasSliceInVertexProgram&&t.vertex.code.add(o),void t.fragment.code.add(o)}e.hasSliceInVertexProgram&&t.vertex.uniforms.add(...i),t.fragment.uniforms.add(...i);const r=V`struct SliceFactors { float front; @@ -1443,11 +1432,11 @@ return mix(color, vec4(HIGHLIGHT_COLOR.rgb, color.a), highlightFactor * HIGHLIGH }`,s=e.hasSliceHighlight?V` ${n} #define highlightSlice(_color_, _pos_) (sliceEnabled() ? applySliceHighlight(_color_, _pos_) : (_color_)) - `:V`#define highlightSlice(_color_, _pos_) (_color_)`;e.hasSliceInVertexProgram&&t.vertex.code.add(r),t.fragment.code.add(r),t.fragment.code.add(s)}function s6e(t,e,i){return t.instancedDoublePrecision?Ie(Q2t,i.camera.viewInverseTransposeMatrix[3],i.camera.viewInverseTransposeMatrix[7],i.camera.viewInverseTransposeMatrix[11]):e.slicePlaneLocalOrigin}function o6e(t,e){return t!=null?je(zU,e.origin,t):e.origin}function a6e(t,e,i){return t.hasSliceTranslatedView?e!=null?Qu(ext,i.camera.viewMatrix,e):i.camera.viewMatrix:null}function l6e(t,e,i){if(i.slicePlane==null)return Ka;const r=s6e(t,e,i),n=o6e(r,i.slicePlane),s=a6e(t,r,i);return s!=null?bt(zU,n,s):n}function kU(t,e,i,r){if(r==null||i.slicePlane==null)return Ka;const n=s6e(t,e,i),s=o6e(n,i.slicePlane),o=a6e(t,n,i);return o!=null?(Be(dR,r,s),bt(zU,s,o),bt(dR,dR,o),je(dR,dR,zU)):r}const Q2t=W(),zU=W(),dR=W(),ext=Qe();function e6(t,e){const i=e.output===ue.ObjectAndLayerIdColor,r=e.objectAndLayerIdColorInstanced;i&&(t.varyings.add("objectAndLayerIdColorVarying","vec4"),r?t.attributes.add(J.INSTANCEOBJECTANDLAYERIDCOLOR,"vec4"):t.attributes.add(J.OBJECTANDLAYERIDCOLOR,"vec4")),t.vertex.code.add(V` + `:V`#define highlightSlice(_color_, _pos_) (_color_)`;e.hasSliceInVertexProgram&&t.vertex.code.add(r),t.fragment.code.add(r),t.fragment.code.add(s)}function t6e(t,e,i){return t.instancedDoublePrecision?Ie(Kwt,i.camera.viewInverseTransposeMatrix[3],i.camera.viewInverseTransposeMatrix[7],i.camera.viewInverseTransposeMatrix[11]):e.slicePlaneLocalOrigin}function i6e(t,e){return t!=null?je(UU,e.origin,t):e.origin}function r6e(t,e,i){return t.hasSliceTranslatedView?e!=null?eh(Qwt,i.camera.viewMatrix,e):i.camera.viewMatrix:null}function n6e(t,e,i){if(i.slicePlane==null)return el;const r=t6e(t,e,i),n=i6e(r,i.slicePlane),s=r6e(t,r,i);return s!=null?bt(UU,n,s):n}function zU(t,e,i,r){if(r==null||i.slicePlane==null)return el;const n=t6e(t,e,i),s=i6e(n,i.slicePlane),o=r6e(t,n,i);return o!=null?(Be(SR,r,s),bt(UU,s,o),bt(SR,SR,o),je(SR,SR,UU)):r}const Kwt=W(),UU=W(),SR=W(),Qwt=Qe();function s6(t,e){const i=e.output===ue.ObjectAndLayerIdColor,r=e.objectAndLayerIdColorInstanced;i&&(t.varyings.add("objectAndLayerIdColorVarying","vec4"),r?t.attributes.add(J.INSTANCEOBJECTANDLAYERIDCOLOR,"vec4"):t.attributes.add(J.OBJECTANDLAYERIDCOLOR,"vec4")),t.vertex.code.add(V` void forwardObjectAndLayerIdColor() { ${i?r?V`objectAndLayerIdColorVarying = instanceObjectAndLayerIdColor * 0.003921568627451;`:V`objectAndLayerIdColorVarying = objectAndLayerIdColor * 0.003921568627451;`:V``} }`),t.fragment.code.add(V` void outputObjectAndLayerIdColor() { - ${i?V`fragColor = objectAndLayerIdColorVarying;`:V``} }`)}function Jj(t){t.uniforms.add(new Oy("alignPixelEnabled",(e,i)=>i.alignPixelEnabled)),t.code.add(V`vec4 alignToPixelCenter(vec4 clipCoord, vec2 widthHeight) { + ${i?V`fragColor = objectAndLayerIdColorVarying;`:V``} }`)}function aG(t){t.uniforms.add(new Dy("alignPixelEnabled",(e,i)=>i.alignPixelEnabled)),t.code.add(V`vec4 alignToPixelCenter(vec4 clipCoord, vec2 widthHeight) { if (!alignPixelEnabled) return clipCoord; vec2 xy = vec2(0.500123) + 0.5 * clipCoord.xy / clipCoord.w; @@ -1463,7 +1452,7 @@ vec2 pixelSz = vec2(1.0) / widthHeight; vec2 ij = floor((xy + 0.5 * pixelSz) * widthHeight) * pixelSz; vec2 result = (ij * 2.0 - vec2(1.0)) * clipCoord.w; return vec4(result, clipCoord.zw); -}`)}function txt(t,e){const{vertex:i,fragment:r}=t;i.include(Jj),e.multipassEnabled&&(i.include(R$e),t.varyings.add("depth","float")),i.code.add(V` +}`)}function e2t(t,e){const{vertex:i,fragment:r}=t;i.include(aG),e.multipassEnabled&&(i.include(A$e),t.varyings.add("depth","float")),i.code.add(V` void main(void) { vec4 posProjCenter; if (dot(position, position) > 0.0) { @@ -1493,7 +1482,7 @@ return vec4(result, clipCoord.zw); gl_Position = posProjCenter; gl_PointSize = 1.0; } - `),t.include(dd,e),r.code.add(V` + `),t.include(gd,e),r.code.add(V` void main() { fragColor = vec4(1); ${e.multipassEnabled?V` @@ -1501,21 +1490,21 @@ return vec4(result, clipCoord.zw); fragColor.g = 0.5; }`:""} } - `)}function c6e(t){t.vertex.uniforms.add(new ft("renderTransparentlyOccludedHUD",(e,i)=>i.hudRenderStyle===Ih.Occluded?1:i.hudRenderStyle===Ih.NotOccluded?0:.75),new gr("viewport",(e,i)=>i.camera.fullViewport),new Zt("hudVisibilityTexture",(e,i)=>{var r;return(r=i.hudVisibility)==null?void 0:r.colorTexture})),t.vertex.include(Jj),t.vertex.code.add(V`bool testHUDVisibility(vec4 posProj) { + `)}function s6e(t){t.vertex.uniforms.add(new ft("renderTransparentlyOccludedHUD",(e,i)=>i.hudRenderStyle===Dh.Occluded?1:i.hudRenderStyle===Dh.NotOccluded?0:.75),new gr("viewport",(e,i)=>i.camera.fullViewport),new Zt("hudVisibilityTexture",(e,i)=>{var r;return(r=i.hudVisibility)==null?void 0:r.colorTexture})),t.vertex.include(aG),t.vertex.code.add(V`bool testHUDVisibility(vec4 posProj) { vec4 posProjCenter = alignToPixelCenter(posProj, viewport.zw); vec4 occlusionPixel = texture(hudVisibilityTexture, .5 + .5 * posProjCenter.xy / posProjCenter.w); if (renderTransparentlyOccludedHUD > 0.5) { return occlusionPixel.r * occlusionPixel.g > 0.0 && occlusionPixel.g * renderTransparentlyOccludedHUD < 1.0; } return occlusionPixel.r * occlusionPixel.g > 0.0 && occlusionPixel.g == 1.0; -}`)}const u6e=Mi(1,1,0,1),ble=Mi(1,0,1,1);function dx(t){t.fragment.uniforms.add(new Zt("depthTexture",(e,i)=>i.mainDepth)),t.fragment.constants.add("occludedHighlightFlag","vec4",u6e).add("unoccludedHighlightFlag","vec4",ble),t.fragment.code.add(V`void outputHighlight() { +}`)}const o6e=Mi(1,1,0,1),$le=Mi(1,0,1,1);function vx(t){t.fragment.uniforms.add(new Zt("depthTexture",(e,i)=>i.mainDepth)),t.fragment.constants.add("occludedHighlightFlag","vec4",o6e).add("unoccludedHighlightFlag","vec4",$le),t.fragment.code.add(V`void outputHighlight() { float sceneDepth = float(texelFetch(depthTexture, ivec2(gl_FragCoord.xy), 0).x); if (gl_FragCoord.z > sceneDepth + 5e-7) { fragColor = occludedHighlightFlag; } else { fragColor = unoccludedHighlightFlag; } -}`)}let h6e=class extends Ls{constructor(e,i,r){super(e,"vec4",Or.Pass,(n,s,o)=>n.setUniform4fv(e,i(s,o)),r)}},Hu=class extends Ls{constructor(e,i,r){super(e,"float",Or.Pass,(n,s,o)=>n.setUniform1fv(e,i(s,o)),r)}},t6=class extends k9e{constructor(){super(...arguments),this.renderOccluded=Wn.Occlude,this.isDecoration=!1}};const SO=8;function e_(t,e){const{vertex:i,attributes:r}=t;e.hasVvInstancing&&(e.vvSize||e.vvColor)&&r.add(J.INSTANCEFEATUREATTRIBUTE,"vec4"),e.vvSize?(i.uniforms.add(new Oi("vvSizeMinSize",n=>n.vvSize.minSize)),i.uniforms.add(new Oi("vvSizeMaxSize",n=>n.vvSize.maxSize)),i.uniforms.add(new Oi("vvSizeOffset",n=>n.vvSize.offset)),i.uniforms.add(new Oi("vvSizeFactor",n=>n.vvSize.factor)),i.uniforms.add(new Wm("vvSymbolRotationMatrix",n=>n.vvSymbolRotationMatrix)),i.uniforms.add(new Oi("vvSymbolAnchor",n=>n.vvSymbolAnchor)),i.code.add(V`vec3 vvScale(vec4 _featureAttribute) { +}`)}let a6e=class extends Ds{constructor(e,i,r){super(e,"vec4",Pr.Pass,(n,s,o)=>n.setUniform4fv(e,i(s,o)),r)}},Wu=class extends Ds{constructor(e,i,r){super(e,"float",Pr.Pass,(n,s,o)=>n.setUniform1fv(e,i(s,o)),r)}},o6=class extends L9e{constructor(){super(...arguments),this.renderOccluded=Yn.Occlude,this.isDecoration=!1}};const PO=8;function a_(t,e){const{vertex:i,attributes:r}=t;e.hasVvInstancing&&(e.vvSize||e.vvColor)&&r.add(J.INSTANCEFEATUREATTRIBUTE,"vec4"),e.vvSize?(i.uniforms.add(new Oi("vvSizeMinSize",n=>n.vvSize.minSize)),i.uniforms.add(new Oi("vvSizeMaxSize",n=>n.vvSize.maxSize)),i.uniforms.add(new Oi("vvSizeOffset",n=>n.vvSize.offset)),i.uniforms.add(new Oi("vvSizeFactor",n=>n.vvSize.factor)),i.uniforms.add(new Km("vvSymbolRotationMatrix",n=>n.vvSymbolRotationMatrix)),i.uniforms.add(new Oi("vvSymbolAnchor",n=>n.vvSymbolAnchor)),i.code.add(V`vec3 vvScale(vec4 _featureAttribute) { return clamp(vvSizeOffset + _featureAttribute.x * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize); } vec4 vvTransformPosition(vec3 position, vec4 _featureAttribute) { @@ -1536,7 +1525,7 @@ return vec4(vvSymbolRotationMatrix * ( vvScale(_featureAttribute) * (position + return vvTransformPosition(position, instanceFeatureAttribute); }`:""} `)):i.code.add(V`vec4 localPosition() { return vec4(position, 1.0); } -vec4 vvLocalNormal(vec3 _normal) { return vec4(_normal, 1.0); }`),e.vvColor?(i.constants.add("vvColorNumber","int",SO),i.uniforms.add(new Hu("vvColorValues",n=>n.vvColor.values,SO),new h6e("vvColorColors",n=>n.vvColor.colors,SO)),i.code.add(V` +vec4 vvLocalNormal(vec3 _normal) { return vec4(_normal, 1.0); }`),e.vvColor?(i.constants.add("vvColorNumber","int",PO),i.uniforms.add(new Wu("vvColorValues",n=>n.vvColor.values,PO),new a6e("vvColorColors",n=>n.vvColor.colors,PO)),i.code.add(V` vec4 interpolateVVColor(float value) { if (value <= vvColorValues[0]) { return vvColorColors[0]; @@ -1559,7 +1548,7 @@ vec4 vvLocalNormal(vec3 _normal) { return vec4(_normal, 1.0); }`),e.vvColor?(i.c vec4 vvColor() { return vvGetColor(instanceFeatureAttribute); }`:"vec4 vvColor() { return vec4(1.0); }"} - `)):i.code.add(V`vec4 vvColor() { return vec4(1.0); }`)}const UU=.1,Cl=.001;function d6e(t){const e=new Cr,i=t.signedDistanceFieldEnabled;if(e.include(G9e,t),e.include(oo,t),t.occlusionPass)return e.include(txt,t),e;const{vertex:r,fragment:n}=e;e.include(ple),n.include(o0),n.include(h1),e.include(e_,t),e.include(e6,t),e.include(c6e),e.varyings.add("vcolor","vec4"),e.varyings.add("vtc","vec2"),e.varyings.add("vsize","vec2"),e.varyings.add("voccluded","float"),r.uniforms.add(new gr("viewport",(f,_)=>_.camera.fullViewport),new ln("screenOffset",(f,_)=>or(p6e,2*f.screenOffset[0]*_.camera.pixelRatio,2*f.screenOffset[1]*_.camera.pixelRatio)),new ln("anchorPosition",f=>FL(f)),new gr("materialColor",f=>f.color)),bP(r),i&&(r.uniforms.add(new gr("outlineColor",f=>f.outlineColor)),n.uniforms.add(new gr("outlineColor",f=>bye(f)?f.outlineColor:gp),new ft("outlineSize",f=>bye(f)?f.outlineSize:0))),t.pixelSnappingEnabled&&r.include(Jj),t.hasScreenSizePerspective&&(V2t(r),Zj(r)),t.debugDrawLabelBorder&&e.varyings.add("debugBorderCoords","vec4"),e.attributes.add(J.UV0,"vec2"),e.attributes.add(J.COLOR,"vec4"),e.attributes.add(J.SIZE,"vec2"),e.attributes.add(J.FEATUREATTRIBUTE,"vec4"),r.code.add(V` + `)):i.code.add(V`vec4 vvColor() { return vec4(1.0); }`)}const VU=.1,Ml=.001;function l6e(t){const e=new Ar,i=t.signedDistanceFieldEnabled;if(e.include(U9e,t),e.include(ao,t),t.occlusionPass)return e.include(e2t,t),e;const{vertex:r,fragment:n}=e;e.include(Cle),n.include(c0),n.include(_1),e.include(a_,t),e.include(s6,t),e.include(s6e),e.varyings.add("vcolor","vec4"),e.varyings.add("vtc","vec2"),e.varyings.add("vsize","vec2"),e.varyings.add("voccluded","float"),r.uniforms.add(new gr("viewport",(p,_)=>_.camera.fullViewport),new cn("screenOffset",(p,_)=>or(c6e,2*p.screenOffset[0]*_.camera.pixelRatio,2*p.screenOffset[1]*_.camera.pixelRatio)),new cn("anchorPosition",p=>qL(p)),new gr("materialColor",p=>p.color)),P5(r),i&&(r.uniforms.add(new gr("outlineColor",p=>p.outlineColor)),n.uniforms.add(new gr("outlineColor",p=>wye(p)?p.outlineColor:bp),new ft("outlineSize",p=>wye(p)?p.outlineSize:0))),t.pixelSnappingEnabled&&r.include(aG),t.hasScreenSizePerspective&&(Uwt(r),oG(r)),t.debugDrawLabelBorder&&e.varyings.add("debugBorderCoords","vec4"),e.attributes.add(J.UV0,"vec2"),e.attributes.add(J.COLOR,"vec4"),e.attributes.add(J.SIZE,"vec2"),e.attributes.add(J.FEATUREATTRIBUTE,"vec4"),r.code.add(V` void main(void) { ProjectHUDAux projectAux; vec4 posProj = projectPositionHUD(projectAux); @@ -1596,8 +1585,8 @@ posProj = alignToPixelOrigin(posProj, viewport.zw); ${t.output===ue.ObjectAndLayerIdColor?V`vcolor.a = 1.0;`:""} - bool alphaDiscard = vcolor.a < ${V.float(Cl)}; - ${i?`alphaDiscard = alphaDiscard && outlineColor.a < ${V.float(Cl)};`:""} + bool alphaDiscard = vcolor.a < ${V.float(Ml)}; + ${i?`alphaDiscard = alphaDiscard && outlineColor.a < ${V.float(Ml)};`:""} if (alphaDiscard) { // "early discard" if both symbol color (= fill) and outline color (if applicable) are transparent gl_Position = vec4(1e38, 1e38, 1e38, 1.0); @@ -1614,7 +1603,7 @@ posProj = alignToPixelOrigin(posProj, viewport.zw); ${t.occlusionTestEnabled?V`} else { vtc = vec2(0.0); ${t.debugDrawLabelBorder?"debugBorderCoords = vec4(0.5, 0.5, 1.5 / combinedSize);}":"}"}`:""} } - `),n.uniforms.add(new Zt("tex",f=>f.texture));const l=t.debugDrawLabelBorder?V`(isBorder > 0.0 ? 0.0 : ${V.float(UU)})`:V.float(UU),c=V` + `),n.uniforms.add(new Zt("tex",p=>p.texture));const a=t.debugDrawLabelBorder?V`(isBorder > 0.0 ? 0.0 : ${V.float(VU)})`:V.float(VU),c=V` ${t.debugDrawLabelBorder?V` float isBorder = float(any(lessThan(debugBorderCoords.xy, debugBorderCoords.zw)) || any(greaterThan(debugBorderCoords.xy, 1.0 - debugBorderCoords.zw)));`:""} @@ -1654,8 +1643,8 @@ posProj = alignToPixelOrigin(posProj, viewport.zw); outlinePixelColor.a *= outlineAlphaFactor; if ( - outlineAlphaFactor + fillAlphaFactor < ${l} || - fillPixelColor.a + outlinePixelColor.a < ${V.float(Cl)} + outlineAlphaFactor + fillAlphaFactor < ${a} || + fillPixelColor.a + outlinePixelColor.a < ${V.float(Ml)} ) { discard; } @@ -1667,7 +1656,7 @@ posProj = alignToPixelOrigin(posProj, viewport.zw); fragColor = vec4(compositeColor, compositeAlpha); } else { - if (fillAlphaFactor < ${l}) { + if (fillAlphaFactor < ${a}) { discard; } @@ -1678,7 +1667,7 @@ posProj = alignToPixelOrigin(posProj, viewport.zw); // fragColor = vec4(clamp(-dist/vsize.x*2.0, 0.0, 1.0), clamp(dist/vsize.x*2.0, 0.0, 1.0), 0.0, 1.0); `:V` vec4 texColor = texture(tex, vtc, -0.5); - if (texColor.a < ${l}) { + if (texColor.a < ${a}) { discard; } fragColor = texColor * premultiplyAlpha(vcolor); @@ -1698,7 +1687,7 @@ posProj = alignToPixelOrigin(posProj, viewport.zw); void main() { ${c} outputObjectAndLayerIdColor(); - }`);break;case ue.Highlight:n.constants.add("occludedHighlightFlag","vec4",u6e).add("unoccludedHighlightFlag","vec4",ble),n.code.add(V` + }`);break;case ue.Highlight:n.constants.add("occludedHighlightFlag","vec4",o6e).add("unoccludedHighlightFlag","vec4",$le),n.code.add(V` void main() { ${c} if (voccluded == 1.0) { @@ -1706,37 +1695,37 @@ posProj = alignToPixelOrigin(posProj, viewport.zw); } else { fragColor = unoccludedHighlightFlag; } - }`)}return e}function bye(t){return t.outlineColor[3]>0&&t.outlineSize>0}function FL(t,e=p6e){return t.textureIsSignedDistanceField?ixt(t.anchorPosition,t.distanceFieldBoundingBox,e):Qo(e,t.anchorPosition),e}function ixt(t,e,i){e!=null?or(i,t[0]*(e[2]-e[0])+e[0],t[1]*(e[3]-e[1])+e[1]):or(i,0,0)}const p6e=yt(),rxt=Object.freeze(Object.defineProperty({__proto__:null,build:d6e,calculateAnchorPosForRendering:FL},Symbol.toStringTag,{value:"Module"})),vp=Ol(st.SRC_ALPHA,st.ONE,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),nxt=hd(st.ONE,st.ONE),f6e=hd(st.ZERO,st.ONE_MINUS_SRC_ALPHA);function Y_(t){return t===Jt.FrontFace?null:t===Jt.Alpha?f6e:nxt}function Kj(t){return t===Jt.FrontFace?rh:null}const Qj=5e5,eG={factor:-1,units:-2};function tG(t){return t?eG:null}function px(t,e=Zr.LESS){return t===Jt.NONE||t===Jt.FrontFace?e:Zr.LEQUAL}let m6e=class g6e extends Hr{initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global}initializeProgram(e){return new Ir(e.rctx,g6e.shader.get().build(this.configuration),Er)}initializePipeline(){const e=this.configuration.transparencyPassType,i=this.configuration,r=e===Jt.NONE,n=e===Jt.FrontFace,s=this.configuration.hasPolygonOffset?sxt:null,o=(r||n)&&i.output!==ue.Highlight&&(i.depthEnabled||i.occlusionPass)?rh:null;return Ti({blending:i.output===ue.Color||i.output===ue.Alpha||i.output===ue.Highlight?r?oxt:Y_(e):null,depthTest:{func:Zr.LEQUAL},depthWrite:o,colorWrite:ji,polygonOffset:s})}get primitiveType(){return this.configuration.occlusionPass?sr.POINTS:sr.TRIANGLES}};m6e.shader=new Rr(rxt,()=>we(()=>Promise.resolve().then(()=>wWt),void 0));const sxt={factor:0,units:-4},oxt=hd(st.ONE,st.ONE_MINUS_SRC_ALPHA);let $o=class extends hu{constructor(){super(...arguments),this.output=ue.Color,this.transparencyPassType=Jt.NONE,this.screenCenterOffsetUnitsEnabled=!1,this.spherical=!1,this.occlusionTestEnabled=!0,this.signedDistanceFieldEnabled=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.vvSize=!1,this.vvColor=!1,this.hasVerticalOffset=!1,this.hasScreenSizePerspective=!1,this.debugDrawLabelBorder=!1,this.hasSlicePlane=!1,this.hasPolygonOffset=!1,this.depthEnabled=!0,this.pixelSnappingEnabled=!0,this.draped=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.occlusionPass=!1,this.objectAndLayerIdColorInstanced=!1}};y([fe({count:ue.COUNT})],$o.prototype,"output",void 0),y([fe({count:Jt.COUNT})],$o.prototype,"transparencyPassType",void 0),y([fe()],$o.prototype,"screenCenterOffsetUnitsEnabled",void 0),y([fe()],$o.prototype,"spherical",void 0),y([fe()],$o.prototype,"occlusionTestEnabled",void 0),y([fe()],$o.prototype,"signedDistanceFieldEnabled",void 0),y([fe()],$o.prototype,"sampleSignedDistanceFieldTexelCenter",void 0),y([fe()],$o.prototype,"vvSize",void 0),y([fe()],$o.prototype,"vvColor",void 0),y([fe()],$o.prototype,"hasVerticalOffset",void 0),y([fe()],$o.prototype,"hasScreenSizePerspective",void 0),y([fe()],$o.prototype,"debugDrawLabelBorder",void 0),y([fe()],$o.prototype,"hasSlicePlane",void 0),y([fe()],$o.prototype,"hasPolygonOffset",void 0),y([fe()],$o.prototype,"depthEnabled",void 0),y([fe()],$o.prototype,"pixelSnappingEnabled",void 0),y([fe()],$o.prototype,"draped",void 0),y([fe()],$o.prototype,"multipassEnabled",void 0),y([fe()],$o.prototype,"cullAboveGround",void 0),y([fe()],$o.prototype,"occlusionPass",void 0),y([fe()],$o.prototype,"objectAndLayerIdColorInstanced",void 0),y([fe({constValue:!0})],$o.prototype,"hasSliceInVertexProgram",void 0),y([fe({constValue:!1})],$o.prototype,"hasVvInstancing",void 0);let O5=class extends hx{constructor(e){super(e,new vxt),this._configuration=new $o}getConfiguration(e,i){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled=this.parameters.centerOffsetUnits==="screen",this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.isDraped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=i.slot===ke.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===ue.Color||e===ue.Alpha),e===ue.Color&&(this._configuration.debugDrawLabelBorder=!!Tn.LABELS_SHOW_BORDER),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration.cullAboveGround=i.multipassTerrain.cullAboveGround,this._configuration}intersect(e,i,r,n,s,o){if(!(r.options.selectionMode&&r.options.hud&&e.visible&&r.point))return;const l=this.parameters,c=r.point,f=r.camera;let{scaleX:_,scaleY:x}=this._getScreenScale(e);_*=f.pixelRatio,x*=f.pixelRatio,Yf(rW,i),e.attributes.has(J.FEATUREATTRIBUTE)&&cxt(rW);const T=e.attributes.get(J.POSITION),A=e.attributes.get(J.SIZE),M=e.attributes.get(J.NORMAL),I=e.attributes.get(J.AUXPOS1);Xt(T.size>=3);const L=FL(l),F=this.parameters.centerOffsetUnits==="screen";for(let z=0;z-1){F&&(wd[0]||wd[1])&&(Fc[0]+=wd[0]*f.pixelRatio,wd[1]!==0&&(Fc[1]+=ule(wd[1],iW.factorAlignment)*f.pixelRatio),f.unapplyProjection(Fc,tc)),Fc[0]+=this.parameters.screenOffset[0]*f.pixelRatio,Fc[1]+=this.parameters.screenOffset[1]*f.pixelRatio,Fc[0]=Math.floor(Fc[0]),Fc[1]=Math.floor(Fc[1]),$9e(_b,iW.factor,_b);const Y=mxt*f.pixelRatio;let Q=0;if(l.textureIsSignedDistanceField&&(Q=l.outlineSize*f.pixelRatio/2),wye(c,Fc[0],Fc[1],_b,Y,Q,l,L)){const ne=r.ray;if(bt(xye,tc,Vo(dxt,f.viewMatrix)),Fc[0]=c[0],Fc[1]=c[1],f.unprojectFromRenderScreen(Fc,tc)){const re=W();Ne(re,ne.direction);const he=1/rt(re);De(re,re,he),o(Sn(ne.origin,tc)*he,re,-1,!0,1,xye)}}}}}intersectDraped(e,i,r,n,s,o){const l=e.attributes.get(J.POSITION),c=e.attributes.get(J.SIZE),f=this.parameters,_=FL(f);let{scaleX:x,scaleY:T}=this._getScreenScale(e);x*=e.screenToWorldRatio,T*=e.screenToWorldRatio;const A=gxt*e.screenToWorldRatio;for(let M=0;M0?_:1/_),s}_applyVerticalGroundOffsetView(e,i,r,n){const s=rt(e),o=r.aboveGround?1:-1,l=r.computeRenderPixelSizeAtDist(s)*j9e,c=De(tc,i.normal,o*l);return Be(n,e,c),n}_applyVerticalOffsetTransformationView(e,i,r,n){var f;const s=this.parameters;if(!((f=s.verticalOffset)!=null&&f.screenLength)){if(s.screenSizePerspective||s.screenSizePerspectiveAlignment){const _=rt(e);this._updateScaleInfo(n,_,i.cosAngle)}else n.factor.scale=1,n.factorAlignment.scale=1;return e}const o=rt(e),l=s.screenSizePerspectiveAlignment??s.screenSizePerspective,c=X9e(r,o,s.verticalOffset,i.cosAngle,l);return this._updateScaleInfo(n,o,i.cosAngle),De(i.normal,i.normal,c),Be(e,e,i.normal)}_applyCenterOffsetView(e,i,r){const n=this.parameters.centerOffsetUnits!=="screen";return r!==e&&Ne(r,e),n&&(r[0]+=i[0],r[1]+=i[1],i[2]&&(Ye(pR,r),Be(r,r,De(pR,pR,i[2])))),r}_applyCenterOffsetNDC(e,i,r,n){const s=this.parameters.centerOffsetUnits!=="screen";return n!==e&&Ne(n,e),s||(n[0]+=i[0]/r.fullWidth*2,n[1]+=i[1]/r.fullHeight*2),n}_applyPolygonOffsetNDC(e,i,r,n){const s=this.parameters.shaderPolygonOffset;if(e!==n&&Ne(n,e),s){const o=r.aboveGround?1:-1,l=o*Math.sign(i[3]);n[2]-=(l||o)*s}return n}produces(e,i){if(i===ue.Color||i===ue.Alpha||i===ue.Highlight||i===ue.ObjectAndLayerIdColor){if(e===ke.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:r,occlusionTest:n}=this.parameters;return e===(r?ke.LABEL_MATERIAL:ke.HUD_MATERIAL)||n&&e===ke.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new axt(e)}calculateRelativeScreenBounds(e,i,r=Ni()){return lxt(this.parameters,e,i,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}_getScreenScale(e){const i=e.attributes.get(J.FEATUREATTRIBUTE);if(i==null)return{scaleX:1,scaleY:1};const r=YB(i.data,fxt),[n,s]=dle(pxt,this.parameters,r);return{scaleX:n,scaleY:s}}},axt=class extends wae{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(m6e,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}};function lxt(t,e,i,r=uxt){return Qo(r,t.anchorPosition),r[0]*=-e[0],r[1]*=-e[1],r[0]+=t.screenOffset[0]*i,r[1]+=t.screenOffset[1]*i,r}function cxt(t){const e=t[0],i=t[1],r=t[2],n=t[3],s=t[4],o=t[5],l=t[6],c=t[7],f=t[8],_=1/Math.sqrt(e*e+i*i+r*r),x=1/Math.sqrt(n*n+s*s+o*o),T=1/Math.sqrt(l*l+c*c+f*f);return t[0]=e*_,t[1]=i*_,t[2]=r*_,t[3]=n*x,t[4]=s*x,t[5]=o*x,t[6]=l*T,t[7]=c*T,t[8]=f*T,t}function wye(t,e,i,r,n,s,o,l){let c=e-n-(l[0]>0?r[0]*l[0]:0),f=c+r[0]+2*n,_=i-n-(l[1]>0?r[1]*l[1]:0),x=_+r[1]+2*n;const T=o.distanceFieldBoundingBox;return o.textureIsSignedDistanceField&&T!=null&&(c+=r[0]*T[0],_+=r[1]*T[1],f-=r[0]*(1-T[2]),x-=r[1]*(1-T[3]),c-=s,f+=s,_-=s,x+=s),t[0]>c&&t[0]_&&t[1]0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==Ph.Idle||this._dirty}get updatingProgress(){if(!this.updating)return 1;const t=this._state/Ph.NumStates;return this._dirty?.5*t:t}get running(){return this.view.ready&&this.view.state!=null&&this.updating}runTask(t){switch(this._state){case Ph.Idle:this._startUpdate(),t.madeProgress();case Ph.Process:if(this._state=Ph.Process,!this._processActiveGraphics(t))return;case Ph.Sort:if(this._state=Ph.Sort,!this._sortVisibleGraphics(t))return;case Ph.Deconflict:if(this._state=Ph.Deconflict,!this._deconflictVisibleGraphics(t))return;default:g2t(this,this._visible),this._state=Ph.Idle,this.notifyChange("updating")}}modifyGraphics(t,e){e?t.forEach(i=>this.addToActiveGraphics(i)):t.forEach(i=>this.removeFromActiveGraphics(i)),this.setDirty()}layerSupportsDeconfliction(t){if(t==null||t.type!=="object3d")return!1;const e=t.stageObject;if(((e==null?void 0:e.geometries.length)??0)!==1)return!1;const i=e==null?void 0:e.geometries[0];return(i==null?void 0:i.material)instanceof O5}_startUpdate(){y2t(this.view),this._dirty=!1,this._runningViewState.copyFrom(this.viewState);const{fullWidth:t,fullHeight:e}=this._runningViewState.camera;this._initBins(t,e),this._resetIterators()}addToActiveGraphics(t){t.info[this.visibilityGroup]=new Ext,this._active.set(t.graphics3DGraphic.graphic.uid,t),this.setDirty()}removeFromActiveGraphics(t){this._visible.delete(t.graphics3DGraphic.graphic.uid),Axt(t,this.visibilityGroup),delete t.info[this.visibilityGroup],this._active.delete(t.graphics3DGraphic.graphic.uid),this.setDirty()}_processActiveGraphics(t){const e=this._ensureActiveGraphicsIterator(),i=sP(wxt,this._runningViewState.camera.projectionMatrix),r=this.view.viewingMode==="global"&&this.view.map.ground.opacity===1&&this._runningViewState.camera.relativeElevation>0?xxt:null;let n=0;for(r!=null&&(bt(r,Ka,this._runningViewState.camera.viewMatrix),r[3]=Sr(this.view.spatialReference).radius,n=nRe(r,Ka));!t.done;){t.madeProgress();const s=e.next();if(s.done===!0)return this._resetActiveGraphicsIterator(),!0;const o=s.value,l=o==null?void 0:o.info[this.visibilityGroup];l&&(this._collectGraphics3DGraphics(o,i,r,n),l.culled?this._visible.delete(o.graphics3DGraphic.graphic.uid):this._visible.set(o.graphics3DGraphic.graphic.uid,o))}return!1}_sortVisibleGraphics(t){const e=this._ensureSortGraphicsIterator();for(;!t.done;){const i=e.next();if(t.madeProgress(),i.done===!0)return this._resetSortGraphicsIterator(),!0}return!1}_deconflictVisibleGraphics(t){const e=this._ensureVisibleGraphicsIterator(),i=this.visibilityGroup===Ya.LABEL;for(;!t.done;){t.madeProgress();const r=e.next();if(r.done===!0)return this._resetVisibleGraphicsIterator(),!0;const n=r.value,s=n.info[this.visibilityGroup];if(!s||s.culled){this._setGraphicVisibility(n,!1);continue}const o=n.graphics3DGraphic,l=!i||o.isVisible();s.visible=l&&!this._isConflicted(n),s.visible&&this._addToBins(n),this._setGraphicVisibility(n,s.visible),_2t(s,s.visible)}return!1}_resetIterators(){this._iterators.active=null,this._iterators.visible=null,this._iterators.sort=null}_ensureActiveGraphicsIterator(){return this._iterators.active||(this._iterators.active=Sye(this._active)),this._iterators.active}_resetActiveGraphicsIterator(){this._iterators.active=null}_ensureVisibleGraphicsIterator(){return this._iterators.visible||(this._iterators.visible=Sye(this._visible)),this._iterators.visible}_resetVisibleGraphicsIterator(){this._iterators.visible=null}_ensureSortGraphicsIterator(){return this._iterators.sort||(this._iterators.sort=Mxt(this._visible,this._iterators.sortArray,this.visibilityGroup)),this._iterators.sort}_resetSortGraphicsIterator(){this._iterators.sort=null}_collectGraphics3DGraphics(t,e,i,r){const n=t.graphics3DGraphic;if(n.destroyed)return;const s=t.info[this.visibilityGroup];if(!n.isVisible(Ya.GRAPHIC,Hl.DECONFLICTION))return void(s.culled=!0);const o=this.getGraphicsLayers(n);od(s.aabr);let l=null;for(const c of o){if(!this.layerSupportsDeconfliction(c))continue;const f=c.stageObject.geometries[0].material;if(l==null&&(l=$xt,this._getProjectionInfo(c,e,l),l.isOutsideScreen||this._isCulledBySlice(t,ig)||i!=null&&this._isCulledByHorizon(l,i,r)))return void(s.culled=!0);this._expandBoundingRect(s,c,f,l)}l==null?s.culled=!0:(s.distance=l.distance,s.culled=!1)}_getProjectionInfo(t,e,i){const r=this._runningViewState.camera,n=t.stageObject,s=n.geometries[0],o=s.material,l=n.boundingVolumeWorldSpace.bounds;bt(ig,l,r.viewMatrix);const c=s.attributes,f=c.get(J.NORMAL).data,_=c.get(J.AUXPOS1).data;o.applyShaderOffsetsView(ig,f,n.transformation,_,r,i.scaleInfo,ig),rs(hC,ig[0],ig[1],ig[2],1),lp(fR,hC,r.projectionMatrix),De(i.positionNDC,fR,1/fR[3]),o.applyShaderOffsetsNDC(i.positionNDC,_,r,i.positionNDC,sW),i.distanceWithoutPolygonOffset=r.depthNDCToWorld(sW[2]),i.distance=sW[2]===i.positionNDC[2]?i.distanceWithoutPolygonOffset:r.depthNDCToWorld(i.positionNDC[2]),rs(fR,i.positionNDC[0],i.positionNDC[1],i.positionNDC[2],1),lp(hC,fR,e),UT(hC,hC,1/hC[3]),Ie(i.positionView,ig[0],ig[1],ig[2])}_isCulledByHorizon(t,e,i){return Ne(oW.direction,t.positionView),Ie(oW.origin,0,0,0),!!lx(e,oW,Sxt)&&t.distanceWithoutPolygonOffset>i}_isCulledBySlice(t,e){return t.slicePlaneEnabled&&this._runningViewState.slicePlaneEnabled&&Koe(this._runningViewState.slicePlane,e)}_expandBoundingRect(t,e,i,{positionNDC:r,scaleInfo:n}){const s=this._runningViewState.camera,o=e.getScreenSize(Rxt);$9e(o,n.factor,o),o[0]*=s.pixelRatio,o[1]*=s.pixelRatio;const l=Fz(i.calculateRelativeScreenBounds(o,n.factorAlignment.scale,Txt),ui(0,s.fullWidth,.5+.5*r[0]),ui(0,s.fullHeight,.5+.5*r[1])),c=this.marginFactor;if(c!==0){const f=c*Math.min(_c(l),qu(l));l[0]-=f,l[1]-=f,l[2]+=f,l[3]+=f}g2(t.aabr,l,t.aabr)}_isConflicted(t){const e=t.graphics3DGraphic.graphic.uid,i=t.info[this.visibilityGroup];let r=!0;for(let n=Math.floor(i.aabr[0]/this._accBinsSizeX);n<=Math.floor(i.aabr[2]/this._accBinsSizeX);n++)if(!(n<0||n>=this._accBinsNumX))for(let s=Math.floor(i.aabr[1]/this._accBinsSizeY);s<=Math.floor(i.aabr[3]/this._accBinsSizeY);s++){if(s<0||s>=this._accBinsNumY)continue;r=!1;const o=this._accBins[n][s];for(let l=0;l=this._accBinsNumX))for(let l=n;l<=s;l++)l<0||l>=this._accBinsNumY||this._accBins[o][l].push(t)}_setGraphicVisibility(t,e){const i=t.graphics3DGraphic;i.destroyed||(i.setVisibilityFlag(this.visibilityGroup,Hl.DECONFLICTION,e),this.visibilityGroup===Ya.LABEL&&this.view.labeler.setLabelGraphicVisibility(i,e))}};function Axt(t,e){const i=t.graphics3DGraphic;i.destroyed||i.setVisibilityFlag(e,Hl.DECONFLICTION,!0)}function*Sye(t){if(Map.prototype.entries){const e=t.entries();for(let i=e.next();!i.done;i=e.next())yield i.value[1]}else yield*t.values()}function*Mxt(t,e,i){e.clear(),t.forEach((n,s)=>{var c;const o=e.pushNew();o.id=s,o.visible=n.graphics3DGraphic.getVisibilityFlag(i,Hl.DECONFLICTION);const l=(c=n.info)==null?void 0:c[i];o.prio=n.graphics3DGraphic.deconflictionPriority,o.distance=l?l.distance:Number.MAX_VALUE}),yield;const r=e.iterableSort((n,s)=>n.prio!==s.prio?s.prio-n.prio:n.distance!==s.distance?n.distance-s.distance:n.visible!==s.visible?n.visible?-1:1:n.id-s.id);for(let n=r.next();!n.done;n=r.next())yield;e.forAll(n=>{const s=t.get(n.id);s&&(t.delete(n.id),t.set(n.id,s))}),e.clear()}y([w({constructOnly:!0})],FM.prototype,"view",void 0),y([w({type:Boolean,readOnly:!0})],FM.prototype,"updating",null),FM=y([Z("esri.views.3d.layers.graphics.Deconflictor")],FM);class Oxt{constructor(){this.id=0,this.visible=!1,this.prio=0,this.distance=0}}class Pxt{constructor(e=null,i=null,r=null){this.active=e,this.visible=i,this.sort=r,this.sortArray=new Pi({allocator:n=>n||new Oxt})}}const Rxt=yt();class Ixt{constructor(){this.positionView=W(),this.positionNDC=W(),this.distance=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new Q9e}get isOutsideScreen(){const e=this.positionNDC;return e[0]<-1||e[1]<-1||e[2]<-1||e[0]>=1||e[1]>=1}}const $xt=new Ixt,Lxt=2e3;let ek=class extends FM{constructor(e){super(e),this.visibilityGroup=Ya.LABEL,this.marginFactor=.05,this._lastDeconfliction=0}get viewState(){return this.parent.viewState}runTask(e){if(this.parent.running)return Xl.YIELD;const i=performance.now();if(e.state!==Vr.IDLE&&i-this._lastDeconfliction{var e,i;return(i=(e=this.view)==null?void 0:e.state)==null?void 0:i.camera},()=>{this._updateViewState(),this.setDirty()}),_e(()=>{var e,i,r;return(r=(i=(e=this.view)==null?void 0:e.map)==null?void 0:i.ground)==null?void 0:r.opacity},(e,i)=>{e!==1&&i!==1||this.setDirty()}),_e(()=>{var e;return(e=this.view)==null?void 0:e.slicePlane},()=>{this._updateSlicePlane(),this._slicePlaneChanged()},ii)]),this._frameTask=this.view.resourceController.scheduler.registerTask(ni.GRAPHICS_DECONFLICTOR,this),this._labels=new ek({view:this.view,parent:this})}destroy(){this._labels=et(this._labels),this._frameTask=en(this._frameTask)}get marginFactor(){return this._marginFactor}set marginFactor(e){this._marginFactor=e,this.setDirty()}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){super.runTask(e),this.running||this._labels.setDirty()}setInitialIconVisibilityFlag(e,i){const r=!(this._graphicSupportsDeconfliction(i)&&aW(e));i.setVisibilityFlag(Ya.GRAPHIC,Hl.DECONFLICTION,r)}_updateViewState(){var e;(e=this.view)!=null&&e.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){const e=this.view?this.view.slicePlane:null;e!=null&&w4e(e,this._viewState.camera.viewMatrix,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=e!=null}_slicePlaneChanged(){rp(this._contexts,(e,i)=>i.symbolCreationContext.slicePlaneEnabled)&&this.setDirty()}addGraphicsOwner(e){const i=this._getGraphicsContext(e);return{addGraphic:r=>this._addGraphic(e,i,r),removeGraphic:r=>this._removeGraphic(i,r),labelingInfoChange:()=>this._labels.enabledChanged(e,i),featureReductionChange:()=>this.enabledChanged(e,i),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,i),clear:()=>i.forEach(r=>this._removeGraphic(i,r.graphics3DGraphic))}}removeGraphicsOwner(e){const i=this._contexts.get(e);i&&(i.forEach(r=>this._removeGraphic(i,r.graphics3DGraphic)),this._contexts.delete(e),this.setDirty())}_addGraphic(e,i,r){const n=r.graphic.uid,s=new Cxt(r,e.symbolCreationContext.slicePlaneEnabled);i.set(n,s),aW(e)&&this.addToActiveGraphics(s),e.labelsEnabled&&this._labels.addToActiveGraphics(s)}_removeGraphic(e,i){const r=i.graphic.uid,n=e.get(r);n&&(this.removeFromActiveGraphics(n),this._labels.removeFromActiveGraphics(n),e.delete(r),this.setDirty())}enabledChanged(e,i){const r=aW(e);r||Dxt(e),this.modifyGraphics(i,r)}_slicePlaneEnabledChanged(e,i){const r=e.symbolCreationContext.slicePlaneEnabled;i.forEach(n=>n.slicePlaneEnabled=r),this.setDirty()}getGraphicsLayers(e){return e.layers}_graphicSupportsDeconfliction(e){if(e.isDraped)return!1;const i=e.layers;if(!(i!=null&&i.length))return!1;for(const r of i)if(this.layerSupportsDeconfliction(r))return!0;return!1}_getGraphicsContext(e){const i=this._contexts.get(e);if(i)return i;const r=new Map;return this._contexts.set(e,r),this.setDirty(),r}};function aW(t){const e=t.layer;return!(!(e!=null&&e.featureReduction)||e.featureReduction.type!=="selection")}function Dxt(t){const e=t.graphics3DGraphics;e&&e.forEach(i=>i.setVisibilityFlag(Ya.GRAPHIC,Hl.DECONFLICTION,!0))}iie=y([Z("esri.views.3d.layers.graphics.GraphicsDeconflictor")],iie);function b6e(t){return"declaredClass"in t}function Tye(t){return"declaredClass"in t}function Nxt(t){return"declaredClass"in t}function Fxt(t,e){return t?Nxt(t)?t:new Ml({layer:e,sourceLayer:e,visible:t.visible,symbol:Re(t.symbol),attributes:Re(t.attributes),geometry:w6e(t.geometry)}):null}function w6e(t){return t==null?null:b6e(t)?t:O2(kxt(t))}function kxt(t){const{wkid:e,wkt:i,wkt2:r,latestWkid:n}=t.spatialReference,s={wkid:e,wkt:i,wkt2:r,latestWkid:n};switch(t.type){case"point":{const{x:o,y:l,z:c,m:f}=t;return{x:o,y:l,z:c,m:f,spatialReference:s}}case"polygon":{const{rings:o,hasZ:l,hasM:c}=t;return{rings:Eye(o),hasZ:l,hasM:c,spatialReference:s}}case"polyline":{const{paths:o,hasZ:l,hasM:c}=t;return{paths:Eye(o),hasZ:l,hasM:c,spatialReference:s}}case"extent":{const{xmin:o,xmax:l,ymin:c,ymax:f,zmin:_,zmax:x,mmin:T,mmax:A,hasZ:M,hasM:I}=t;return{xmin:o,xmax:l,ymin:c,ymax:f,zmin:_,zmax:x,mmin:T,mmax:A,hasZ:M,hasM:I,spatialReference:s}}case"multipoint":{const{points:o,hasZ:l,hasM:c}=t;return{points:S6e(o)?x6e(o):o,hasZ:l,hasM:c,spatialReference:s}}default:return}}function Eye(t){return zxt(t)?t.map(e=>x6e(e)):t}function x6e(t){return t.map(e=>Array.from(e))}function zxt(t){for(const e of t)if(e.length!==0)return S6e(e);return!1}function S6e(t){return t.length>0&&(q5(t[0])||W5(t[0]))}function Uxt(t,e){if(!t)return null;let i;if(Tye(t)){if(e==null)return t.clone();if(Tye(e))return e.copy(t)}return e!=null?(i=e,i.x=t.x,i.y=t.y,i.spatialReference=t.spatialReference,t.hasZ?(i.z=t.z,i.hasZ=t.hasZ):(i.z=void 0,i.hasZ=!1),t.hasM?(i.m=t.m,i.hasM=!0):(i.m=void 0,i.hasM=!1)):(i=Xu(t.x,t.y,t.z,t.spatialReference),t.hasM&&(i.m=t.m,i.hasM=!0)),i}function Gsi(t){const{wkid:e,wkt:i,wkt2:r,latestWkid:n}=t,s={wkid:e,wkt:i,wkt2:r,latestWkid:n};return at.fromJSON(s)}const lW=Ce.getLogger("esri.layers.support.labelFormatUtils"),cW={type:"simple",evaluate:()=>null},Vxt={getAttribute:(t,e)=>t.field(e)};async function T6e(t,e,i){if(!t||!t.symbol||!e)return cW;const r=t.where,n=QB(t);let s;if(n.type==="arcade"){const o=await iit(n.expression,i,e);if(o==null)return cW;s={type:"arcade",evaluate(l,c){try{const f="attributes"in l?o.repurposeFeature(l):l;f.contextTimeZone=c??null;const _=o.evaluate({$view:{timeZone:c},$feature:f},o.services);if(_!=null)return _.toString()}catch(f){lW.error(new se("arcade-expression-error","Encountered an error when evaluating label expression for feature",{error:f,feature:l,expression:n}))}return null},needsHydrationToEvaluate:()=>boe(n.expression)==null}}else s={type:"simple",evaluate:o=>n.expression.replaceAll(/{[^}]*}/g,l=>{const c=l.slice(1,-1),f=e.get(c);if(!f)return l;let _=null;return"attributes"in o?o&&o.attributes&&(_=o.attributes[f.name]):_=o.field(f.name),_==null?"":E6e(_,f)})};if(r){let o;try{o=await Tse(r,e)}catch(c){return lW.error(new se("bad-where-clause","Encountered an error when evaluating where clause, ignoring",{where:r,error:c})),cW}const l=s.evaluate;s.evaluate=(c,f)=>{const _="attributes"in c?void 0:Vxt;try{if(o.testFeature(c,_))return l(c,f)}catch(x){lW.error(new se("bad-where-clause","Encountered an error when evaluating where clause for feature",{where:r,feature:c,error:x}))}return null}}return s}function E6e(t,e){if(t==null)return"";const i=e.domain;if(i){if(i.type==="codedValue"||i.type==="coded-value"){const n=t;for(const s of i.codedValues)if(s.code===n)return s.name}else if(i.type==="range"){const{max:n,min:s}=vMe(e),o=+t;if(s!=null&&n!=null&&s<=o&&o<=n)return i.name}}let r=t;return Ase(e)?r=js(r,oA("short-date")):Cse(e)&&(r=nd(+r)),r||""}const Hsi=Object.freeze(Object.defineProperty({__proto__:null,createLabelFunction:T6e,formatField:E6e},Symbol.toStringTag,{value:"Module"}));function wle(t,e){if(t.type==="point")return bb(t,e,!1);if(b6e(t))switch(t.type){case"extent":return bb(t.center,e,!1);case"polygon":return bb(t.centroid,e,!1);case"polyline":return bb(Cye(t),e,!0);case"mesh":return bb(t.origin,e,!1)}else switch(t.type){case"extent":return bb(Bxt(t),e,!0);case"polygon":return bb(jxt(t),e,!0);case"polyline":return bb(Cye(t),e,!0)}}function Cye(t){const e=t.paths[0];if(!e||e.length===0)return null;const i=iAe(e,tAe(e)/2);return Xu(i[0],i[1],i[2],t.spatialReference)}function Bxt(t){return Xu(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),t.zmin!=null&&t.zmax!=null&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function jxt(t){const e=t.rings[0];if(!e||e.length===0)return null;const i=nAe(t.rings,!!t.hasZ);return Xu(i[0],i[1],i[2],t.spatialReference)}function bb(t,e,i){const r=i?t:Uxt(t);return e&&t?N5e(t,r,e)?r:null:r}function qsi(t,e,i,r=0){if(t){e||(e=Ni());const n=t;let s=.5*n.width*(i-1),o=.5*n.height*(i-1);return n.width<1e-7*n.height?s+=o/20:n.height<1e-7*n.width&&(o+=s/20),rs(e,n.xmin-s-r,n.ymin-o-r,n.xmax+s+r,n.ymax+o+r),e}return null}function C6e(t,e){for(let i=0;i3&&(r[3]=t[3]),i&&(r[0]*=i,r[1]*=i,r[2]*=i,r[3]*=i),r}function Wsi(t,e,i,r,n,s=[0,0,0,0]){for(let o=0;o<3;++o)s[o]=(t==null?void 0:t[o])!=null?t[o]:(i==null?void 0:i[o])!=null?i[o]:n[o];return s[3]=e??r??n[3],s}function Aye(t=Bv,e,i,r=1){const n=new Array(3);if(e==null||i==null)n[0]=1,n[1]=1,n[2]=1;else{let s,o=0;for(let l=2;l>=0;l--){const c=t[l];let f;const _=c!=null,x=l===0&&!s&&!_,T=i[l];c==="symbol-value"||x?f=T!==0?e[l]/T:1:_&&c!=="proportional"&&isFinite(c)&&(f=T!==0?c/T:1),f!=null&&(n[l]=f,s=f,o=Math.max(o,Math.abs(f)))}for(let l=2;l>=0;l--)n[l]==null?n[l]=s:n[l]===0&&(n[l]=.001*o)}for(let s=2;s>=0;s--)n[s]/=r;return mc(n)}function Gxt(t){return t.isPrimitive!=null}function iG(t){return rie(Gxt(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function rie(t){const e=i=>i==null||i>=0;return Array.isArray(t)?t.every(e):e(t)}function Hxt(t,e,i,r=Qe()){return t&&YO(r,r,-t/180*Math.PI),e&&WO(r,r,e/180*Math.PI),i&&TB(r,r,i/180*Math.PI),r}function xle(t,e,i){if(i.minDemResolution!=null)return i.minDemResolution;const r=ws(e),n=dE(t)*r,s=pE(t)*r,o=sx(t)*(e.isGeographic?1:r);return n===0&&s===0&&o===0?i.minDemResolutionForPoints:.01*Math.max(n,s,o)}function A6e(t,e,i,r,n,s,o,l,c,f,_){const x=Qxt[_.mode];let T,A,M=0;if(vn(t,e,i,r,c.spatialReference,n,l))return x.requiresAlignment(_)?(M=x.applyElevationAlignmentBuffer(r,n,s,o,l,c,f,_),T=s,A=o):(T=r,A=n),vn(T,c.spatialReference,A,s,f.spatialReference,o,l)?M:void 0}function Y2(t,e,i,r,n){const s=(mU(t)?t.z:j4e(t)?t.array[t.offset+2]:t[2])||0;switch(i.mode){case"on-the-ground":{const o=my(e,t,"ground")??0;return n.verticalDistanceToGround=0,n.sampledElevation=o,void(n.z=o)}case"relative-to-ground":{const o=my(e,t,"ground")??0,l=i.geometryZWithOffset(s,r);return n.verticalDistanceToGround=l,n.sampledElevation=o,void(n.z=l+o)}case"relative-to-scene":{const o=my(e,t,"scene")??0,l=i.geometryZWithOffset(s,r);return n.verticalDistanceToGround=l,n.sampledElevation=o,void(n.z=l+o)}case"absolute-height":{const o=i.geometryZWithOffset(s,r),l=my(e,t,"ground")??0;return n.verticalDistanceToGround=o-l,n.sampledElevation=l,void(n.z=o)}default:return void(n.z=0)}}function qxt(t,e,i,r){return Y2(t,e,i,r,kM),kM.z}function i6(t,e,i){return e==null||i==null?t.definedChanged:e==="on-the-ground"&&i==="on-the-ground"?t.staysOnTheGround:e===i||e!=="on-the-ground"&&i!=="on-the-ground"?Ys.UPDATE:t.onTheGroundChanged}function t0(t){return t==="relative-to-ground"||t==="relative-to-scene"}function X2(t){return t!=="absolute-height"}function Wxt(t,e,i,r,n){Y2(e,i,n,r,kM),C6e(t,kM.verticalDistanceToGround);const s=kM.sampledElevation,o=Ao(e3t,t.transformation);return TN[0]=e.x,TN[1]=e.y,TN[2]=kM.z,uu(e.spatialReference,TN,o,r.spatialReference)?t.transformation=o:console.warn("Could not locate symbol object properly, it might be misplaced"),s}function Yxt(t,e,i,r,n,s){let o=0;const l=s.spatialReference;e*=3,r*=3;for(let c=0;c!0},"relative-to-ground":{applyElevationAlignmentBuffer:Xxt,requiresAlignment:()=>!0},"relative-to-scene":{applyElevationAlignmentBuffer:Zxt,requiresAlignment:()=>!0}},e3t=Qe(),kM=new r6,TN=W();function Sle(t){return t.mapPositions!=null}function M6e(t,e,i,r,n){const s=t.stageObject,o=s.geometries;let l=0;for(const c of o){if(!Sle(c))continue;const{update:f,averageGeometrySampledElevation:_}=P6e(c,e,i,r,n);l+=_,f&&s.geometryVertexAttributeUpdated(c,J.POSITION)}return l/o.length}function _T(t,e,i,r,n,s){const o=t.stageObject,l=e.centerPointInElevationSR;let c=0;o.usesVerticalDistanceToGround?(r(l,Vu),C6e(o,Vu.verticalDistanceToGround),c=Vu.sampledElevation):(r(l,Vu),e.mode!=="absolute-height"&&(c=Vu.sampledElevation));const f=Ao(t3t,s??o.transformation),_=Ie(O6e,f[12],f[13],f[14]);Tn.TESTS_DISABLE_OPTIMIZATIONS?(Uu[0]=l.x,Uu[1]=l.y,Uu[2]=Vu.z,uu(l.spatialReference,Uu,f,n.spatialReference)&&(s?Ao(s,f):o.transformation=f)):n.setAltitudeOfTransformation(Vu.z,f);const x=Tle/n.unitInMeters;return(Math.abs(f[12]-_[0])>=x||Math.abs(f[13]-_[1])>=x||Math.abs(f[14]-_[2])>=x)&&(s?Ao(s,f):o.transformation=f),c}const t3t=Qe();function i3t(t,e,i,r,n){const s=t.graphics3DSymbolLayer.lodRenderer;if(s==null)return 0;const o=e.centerPointInElevationSR;r(o,Vu);const l=e.mode!=="absolute-height"?Vu.sampledElevation:0,c=s.instanceData,f=t.instanceIndex,_=n3t;c.getGlobalTransform(f,_);const x=Ie(O6e,_[12],_[13],_[14]);Tn.TESTS_DISABLE_OPTIMIZATIONS?(Uu[0]=o.x,Uu[1]=o.y,Uu[2]=Vu.z,uu(o.spatialReference,Uu,_,n.spatialReference)&&c.setGlobalTransform(f,_)):n.setAltitudeOfTransformation(Vu.z,_);const T=Tle/n.unitInMeters;return(Tn.TESTS_DISABLE_OPTIMIZATIONS||Math.abs(_[12]-x[0])>=T||Math.abs(_[13]-x[1])>=T||Math.abs(_[14]-x[2])>=T)&&c.setGlobalTransform(f,_),l}function r3t(t,e,i,r,n){const s=t.stageObject,o=s.geometries;if(o.length===0)return 0;let l=0,c=null,f=0,_=!1;for(const x of o){if(!Sle(x))continue;const T=x.attributes.get(J.POSITION);if(T!==c){const{update:A,averageGeometrySampledElevation:M}=P6e(x,e,i,r,n);f=M,c=T,_=A}_&&s.geometryVertexAttributeUpdated(x,J.POSITION),l+=f}return l/o.length}const Tle=.01,Uu=W(),Lp=W(),dC=W(),n3t=Qe(),O6e=W(),Vu=new r6;function P6e(t,e,i,r,n){let s=!1;const o=t.transformation,l=e.requiresSampledElevationInfo;Lp[0]=o[12],Lp[1]=o[13],Lp[2]=o[14],t.invalidateBoundingInfo();const c=t.getMutableAttribute(J.POSITION),f=c.data,_=c.size,x=f.length/_,T=new nae(t.mapPositions,i);let A=0,M=0;for(let I=0;I=L||Math.abs(dC[1]-f[A+1])>=L||Math.abs(dC[2]-f[A+2])>=L)&&(s=!0)}A+=_,T.offset+=3}return M/=x,{update:s,averageGeometrySampledElevation:M}}const s3t=Ce.getLogger("esri.views.3d.layers.graphics.featureExpressionInfoUtils");function o3t(t){return{cachedResult:t.cachedResult,arcade:t.arcade?{func:t.arcade.func,context:t.arcade.modules.arcadeUtils.createExecContext(null,{sr:t.arcade.context.spatialReference}),modules:t.arcade.modules}:null}}function Xsi(t){const e=t==null?void 0:t.expression;if(typeof e=="string"){const i=$6e(e);if(i!=null)return{cachedResult:i}}return null}async function Zsi(t,e,i,r){const n=t==null?void 0:t.expression;if(typeof n!="string")return null;const s=$6e(n);if(s!=null)return{cachedResult:s};const o=await p_();St(i);const l=o.arcadeUtils,c=l.createSyntaxTree(n);return l.dependsOnView(c)?(r!=null&&r.error("Expressions containing '$view' are not supported on ElevationInfo"),{cachedResult:0}):{arcade:{func:l.createFunction(c),context:l.createExecContext(null,{sr:e}),modules:o}}}function R6e(t,e,i){return t.arcadeUtils.createFeature(e.attributes,e.geometry,i)}function rG(t,e){if(t!=null&&!I6e(t)){if(!e||!t.arcade)return void s3t.errorOncePerTick("Arcade support required but not provided");const i=e;i._geometry&&(i._geometry=w6e(i._geometry)),t.arcade.modules.arcadeUtils.updateExecContext(t.arcade.context,e)}}function a3t(t){if(t!=null){if(I6e(t))return t.cachedResult;const e=t.arcade;let i=e==null?void 0:e.modules.arcadeUtils.executeFunction(e.func,e.context);return typeof i!="number"&&(t.cachedResult=0,i=0),i}return 0}function Jsi(t,e=!1){let i=t==null?void 0:t.featureExpressionInfo;const r=i==null?void 0:i.expression;return e||r==="0"||(i=null),i??null}const l3t={cachedResult:0};function I6e(t){return t.cachedResult!=null}function $6e(t){return t==="0"?0:null}let VU=class L6e{constructor(){this._meterUnitOffset=0,this._renderUnitOffset=0,this._unit="meters",this._metersPerElevationInfoUnit=1,this._featureExpressionInfoContext=null,this.centerPointInElevationSR=null,this.mode=null}get featureExpressionInfoContext(){return this._featureExpressionInfoContext}get meterUnitOffset(){return this._meterUnitOffset}get unit(){return this._unit}set unit(e){this._unit=e,this._metersPerElevationInfoUnit=SOe(e)}get requiresSampledElevationInfo(){return this.mode!=="absolute-height"}reset(){this.mode=null,this._meterUnitOffset=0,this._renderUnitOffset=0,this._featureExpressionInfoContext=null,this.unit="meters"}set offsetMeters(e){this._meterUnitOffset=e,this._renderUnitOffset=0}set offsetElevationInfoUnits(e){this._meterUnitOffset=e*this._metersPerElevationInfoUnit,this._renderUnitOffset=0}addOffsetRenderUnits(e){this._renderUnitOffset+=e}geometryZWithOffset(e,i){const r=this.calculateOffsetRenderUnits(i);return this.featureExpressionInfoContext!=null?r:e+r}calculateOffsetRenderUnits(e){let i=this._meterUnitOffset;const r=this.featureExpressionInfoContext;return r!=null&&(i+=a3t(r)*this._metersPerElevationInfoUnit),i/e.unitInMeters+this._renderUnitOffset}setFromElevationInfo(e){this.mode=e.mode,this.unit=snt(e.unit)?e.unit:"meters",this.offsetElevationInfoUnits=e.offset??0}updateFeatureExpressionInfoContext(e,i,r){if(e==null)return void(this._featureExpressionInfoContext=null);const n=e==null?void 0:e.arcade;n&&i!=null&&r!=null?(this._featureExpressionInfoContext=o3t(e),rG(this._featureExpressionInfoContext,R6e(n.modules,i,r))):this._featureExpressionInfoContext=e}static fromElevationInfo(e){const i=new L6e;return e!=null&&i.setFromElevationInfo(e),i}},c3t=class{constructor(e,i,r){this.graphic=e,this.renderingInfo=i,this.layer=r}},u3t=class{constructor(e,i,r){this.baseMaterial=e,this.edgeMaterials=i,this.properties=r}},d1=class{get isElevationSource(){return!!this.stageObject.lastValidElevationBB}constructor(e,i,r,n,s,o,l,c=null){this.graphics3DSymbolLayer=e,this.stageObject=i,this._uniqueGeometries=r,this._uniqueMaterials=n,this._sharedResource=s,this.elevationAligner=o,this.elevationContext=l,this._edgeState=c,this.type="object3d",this._stageLayer=null,this._visible=!1,this._addedToStage=!1,this.alignedSampledElevation=0,this.needsElevationUpdates=!1,this.useObjectOriginAsAttachmentOrigin=!1}initialize(e){this._stageLayer=e;const i=e.stage;i.addMany(this._uniqueMaterials),i.addMany(this._uniqueGeometries),i.add(this.stageObject)}destroy(){var r;if(!this._stageLayer)return;const e=this._stageLayer.stage;e.removeMany(this._uniqueMaterials),e.removeMany(this._uniqueGeometries),e.remove(this.stageObject),this._addedToStage&&(this._stageLayer.remove(this.stageObject),this._addedToStage=!1);const i=e.renderer.edgeView;i!=null&&i.hasObject(this.stageObject)&&i.removeObject(this.stageObject),this.stageObject.dispose(),(r=this._sharedResource)==null||r.release(),this._visible=!1,this._stageLayer=null}layerOpacityChanged(e,i){if(this._edgeState==null)return;const r=Mye(this._edgeState.baseMaterial);let n=!1;for(const s of this._edgeState.edgeMaterials)s.objectTransparency!==r&&(s.objectTransparency=r,n=!0);n&&this.resetEdgeObject(i),this._stageLayer.stage.renderer.ensureEdgeView().updateAllComponentOpacities(this.stageObject,[e])}slicePlaneEnabledChanged(e,i){this._edgeState!=null&&(this._stageLayer.stage.renderer.ensureEdgeView().updateAllComponentMaterials(this.stageObject,this._edgeState.edgeMaterials,{hasSlicePlane:e},!i),this._edgeState.properties.hasSlicePlane=e)}setVisibility(e){if(this._stageLayer!=null&&this._visible!==e&&(this._visible=e,this.stageObject.visible=e,this._visible&&!this._addedToStage&&(this._stageLayer.add(this.stageObject),this._addedToStage=!0),this._edgeState)){const i=this._stageLayer.stage.renderer.ensureEdgeView();i.hasObject(this.stageObject)?i.updateObjectVisibility(this.stageObject,e):e&&this._addOrUpdateEdgeObject(i,!1)}}get visible(){return this._visible}alignWithElevation(e,i,r,n){if(this.elevationAligner==null)return;r!=null&&rG(this.elevationContext.featureExpressionInfoContext,r);const s=(o,l)=>Y2(o,e,this.elevationContext,i,l);this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,e.spatialReference,s,i),this.resetEdgeObject(n)}alignWithAbsoluteElevation(e,i,r){const n=(s,o)=>{o.sampledElevation=e,o.verticalDistanceToGround=0,o.z=e};this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,null,n,i),this.resetEdgeObject(r)}getCenterObjectSpace(e=W()){return Ne(e,this.stageObject.boundingVolumeObjectSpace.bounds)}getBoundingBoxObjectSpace(e=ya()){const i=this.stageObject.boundingVolumeObjectSpace;return HMe(e,i.min),qMe(e,i.max),e}computeAttachmentOrigin(e){const i=this.stageObject.effectiveTransformation;if(this.useObjectOriginAsAttachmentOrigin)e.render.origin[0]+=i[12],e.render.origin[1]+=i[13],e.render.origin[2]+=i[14],e.render.num++;else for(const r of this.stageObject.geometries)r.computeAttachmentOrigin(x1)&&(bt(x1,x1,i),Be(e.render.origin,e.render.origin,x1),e.render.num++)}async getProjectedBoundingBox(e,i,r,n,s){const o=this.getBoundingBoxObjectSpace(s),l=h3t,c=Dse(o)?1:l.length;for(let _=0;_{var s;return(s=this._stageLayer)==null?void 0:s.sync()})}};function Mye(t){return t.isVisible()?t.parameters.transparent?Wi.TRANSPARENT:Wi.OPAQUE:Wi.INVISIBLE}const Ix=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],wb=W(),x1=W(),h3t=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];let D6e=class{constructor(e,i=null){this.labelText=i,this.elevationOffset=e??0}};const N6e=3,nie=3,F6e=10;let k6e=class{constructor(e,i=null){this.geometry=e,this.textures=i}},z6e=class{constructor(e,i,r){this.components=e,this.minScreenSpaceRadius=i,this.pivotOffset=r;const n=this.geometries;this.numVertices=n.reduce((s,o)=>s+o.attributes.get(J.POSITION).indices.length,0)}get geometries(){return c9(this.components.map(e=>e.geometry))}},U6e=class{constructor(e){this.levels=e,this.levels.sort((i,r)=>i.minScreenSpaceRadius===r.minScreenSpaceRadius?i.numVertices-r.numVertices:i.minScreenSpaceRadius-r.minScreenSpaceRadius)}};function EN(t){const e=[];return t.levels.forEach(i=>i.components.forEach(r=>e.push(r.geometry.material))),c9(e)}function Oye(t){const e=new Array;return t.levels.forEach(i=>i.components.forEach(r=>{r.textures!=null&&e.push(...r.textures)})),c9(e)}function Pye(t){const e=new Array;return t.levels.forEach(i=>i.components.forEach(r=>e.push(r.geometry))),c9(e)}function d3t(t){switch(t){case"sphere":case"cube":case"diamond":case"cylinder":case"cone":case"inverted-cone":case"tetrahedron":return!0}return!1}function V6e(t,e){const i=(r,n,s=!1)=>new U6e(r.map(o=>{const l=n(o.tesselation);return s&&fvt(l),new z6e([new k6e(l)],o.minScreenSpaceRadius)}));switch(t){case"sphere":return i([{tesselation:0,minScreenSpaceRadius:0},{tesselation:1,minScreenSpaceRadius:8},{tesselation:2,minScreenSpaceRadius:16},{tesselation:3,minScreenSpaceRadius:50},{tesselation:4,minScreenSpaceRadius:250}],r=>uvt(e,.5,r,!0));case"cube":return i([{tesselation:0,minScreenSpaceRadius:0}],()=>tvt(e,1));case"cone":return i(uW,r=>Kme(e,1,.5,r,!1),!0);case"inverted-cone":return i(uW,r=>Kme(e,1,.5,r,!0),!0);case"cylinder":return i(uW,r=>dvt(e,1,.5,r,[0,0,1],[0,0,.5]));case"tetrahedron":return i([{tesselation:0,minScreenSpaceRadius:0}],()=>cvt(e,1),!0);case"diamond":return i([{tesselation:0,minScreenSpaceRadius:0}],()=>svt(e,1),!0);default:return}}const uW=[{tesselation:6,minScreenSpaceRadius:0},{tesselation:18,minScreenSpaceRadius:7},{tesselation:64,minScreenSpaceRadius:65}];let ff=class{constructor(e){this.estimated=!1,this.verticesPerFeature=e.verticesPerFeature??0,this.verticesPerCoordinate=e.verticesPerCoordinate??0,this.drawCallsPerFeature=e.drawCallsPerFeature??0,this.memory=e.memory??new B6e}},Ele=class extends ff{constructor(e){super(e),this.estimated=!0}},p3t=class extends ff{constructor(e,i){super(i),this.numComplexities=e}},f3t=class extends Ele{constructor(e,i){super(i),this.numComplexities=e}},B6e=class{constructor(){this.bytesPerFeature=0,this.bytesPerFeatureLabel=0,this.resourceBytes=0,this.draped={bytesPerFeature:0,bytesPerFeatureLabel:0}}};function n6(t,e){switch(e.normalType){case Br.Compressed:t.attributes.add(J.NORMALCOMPRESSED,"vec2"),t.vertex.code.add(V`vec3 normalModel() { + }`)}return e}function wye(t){return t.outlineColor[3]>0&&t.outlineSize>0}function qL(t,e=c6e){return t.textureIsSignedDistanceField?t2t(t.anchorPosition,t.distanceFieldBoundingBox,e):ea(e,t.anchorPosition),e}function t2t(t,e,i){e!=null?or(i,t[0]*(e[2]-e[0])+e[0],t[1]*(e[3]-e[1])+e[1]):or(i,0,0)}const c6e=yt(),i2t=Object.freeze(Object.defineProperty({__proto__:null,build:l6e,calculateAnchorPosForRendering:qL},Symbol.toStringTag,{value:"Module"})),xp=Pl(ot.SRC_ALPHA,ot.ONE,ot.ONE_MINUS_SRC_ALPHA,ot.ONE_MINUS_SRC_ALPHA),r2t=md(ot.ONE,ot.ONE),u6e=md(ot.ZERO,ot.ONE_MINUS_SRC_ALPHA);function Q_(t){return t===Jt.FrontFace?null:t===Jt.Alpha?u6e:r2t}function lG(t){return t===Jt.FrontFace?sh:null}const cG=5e5,uG={factor:-1,units:-2};function hG(t){return t?uG:null}function _x(t,e=Zr.LESS){return t===Jt.NONE||t===Jt.FrontFace?e:Zr.LEQUAL}let h6e=class d6e extends Hr{initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global}initializeProgram(e){return new $r(e.rctx,d6e.shader.get().build(this.configuration),Cr)}initializePipeline(){const e=this.configuration.transparencyPassType,i=this.configuration,r=e===Jt.NONE,n=e===Jt.FrontFace,s=this.configuration.hasPolygonOffset?n2t:null,o=(r||n)&&i.output!==ue.Highlight&&(i.depthEnabled||i.occlusionPass)?sh:null;return Ti({blending:i.output===ue.Color||i.output===ue.Alpha||i.output===ue.Highlight?r?s2t:Q_(e):null,depthTest:{func:Zr.LEQUAL},depthWrite:o,colorWrite:ji,polygonOffset:s})}get primitiveType(){return this.configuration.occlusionPass?sr.POINTS:sr.TRIANGLES}};h6e.shader=new Ir(i2t,()=>we(()=>Promise.resolve().then(()=>rXt),void 0));const n2t={factor:0,units:-4},s2t=md(ot.ONE,ot.ONE_MINUS_SRC_ALPHA);let Lo=class extends pu{constructor(){super(...arguments),this.output=ue.Color,this.transparencyPassType=Jt.NONE,this.screenCenterOffsetUnitsEnabled=!1,this.spherical=!1,this.occlusionTestEnabled=!0,this.signedDistanceFieldEnabled=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.vvSize=!1,this.vvColor=!1,this.hasVerticalOffset=!1,this.hasScreenSizePerspective=!1,this.debugDrawLabelBorder=!1,this.hasSlicePlane=!1,this.hasPolygonOffset=!1,this.depthEnabled=!0,this.pixelSnappingEnabled=!0,this.draped=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.occlusionPass=!1,this.objectAndLayerIdColorInstanced=!1}};y([fe({count:ue.COUNT})],Lo.prototype,"output",void 0),y([fe({count:Jt.COUNT})],Lo.prototype,"transparencyPassType",void 0),y([fe()],Lo.prototype,"screenCenterOffsetUnitsEnabled",void 0),y([fe()],Lo.prototype,"spherical",void 0),y([fe()],Lo.prototype,"occlusionTestEnabled",void 0),y([fe()],Lo.prototype,"signedDistanceFieldEnabled",void 0),y([fe()],Lo.prototype,"sampleSignedDistanceFieldTexelCenter",void 0),y([fe()],Lo.prototype,"vvSize",void 0),y([fe()],Lo.prototype,"vvColor",void 0),y([fe()],Lo.prototype,"hasVerticalOffset",void 0),y([fe()],Lo.prototype,"hasScreenSizePerspective",void 0),y([fe()],Lo.prototype,"debugDrawLabelBorder",void 0),y([fe()],Lo.prototype,"hasSlicePlane",void 0),y([fe()],Lo.prototype,"hasPolygonOffset",void 0),y([fe()],Lo.prototype,"depthEnabled",void 0),y([fe()],Lo.prototype,"pixelSnappingEnabled",void 0),y([fe()],Lo.prototype,"draped",void 0),y([fe()],Lo.prototype,"multipassEnabled",void 0),y([fe()],Lo.prototype,"cullAboveGround",void 0),y([fe()],Lo.prototype,"occlusionPass",void 0),y([fe()],Lo.prototype,"objectAndLayerIdColorInstanced",void 0),y([fe({constValue:!0})],Lo.prototype,"hasSliceInVertexProgram",void 0),y([fe({constValue:!1})],Lo.prototype,"hasVvInstancing",void 0);let kP=class extends yx{constructor(e){super(e,new y2t),this._configuration=new Lo}getConfiguration(e,i){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled=this.parameters.centerOffsetUnits==="screen",this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=this.parameters.isDraped,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=i.slot===ke.OCCLUSION_PIXELS&&this.parameters.occlusionTest&&(e===ue.Color||e===ue.Alpha),e===ue.Color&&(this._configuration.debugDrawLabelBorder=!!En.LABELS_SHOW_BORDER),this._configuration.depthEnabled=this.parameters.depthEnabled,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration.cullAboveGround=i.multipassTerrain.cullAboveGround,this._configuration}intersect(e,i,r,n,s,o){if(!(r.options.selectionMode&&r.options.hud&&e.visible&&r.point))return;const a=this.parameters,c=r.point,p=r.camera;let{scaleX:_,scaleY:x}=this._getScreenScale(e);_*=p.pixelRatio,x*=p.pixelRatio,Kf(pW,i),e.attributes.has(J.FEATUREATTRIBUTE)&&l2t(pW);const S=e.attributes.get(J.POSITION),C=e.attributes.get(J.SIZE),M=e.attributes.get(J.NORMAL),P=e.attributes.get(J.AUXPOS1);Xt(S.size>=3);const $=qL(a),F=this.parameters.centerOffsetUnits==="screen";for(let z=0;z-1){F&&(Ed[0]||Ed[1])&&(Uc[0]+=Ed[0]*p.pixelRatio,Ed[1]!==0&&(Uc[1]+=Sle(Ed[1],dW.factorAlignment)*p.pixelRatio),p.unapplyProjection(Uc,nc)),Uc[0]+=this.parameters.screenOffset[0]*p.pixelRatio,Uc[1]+=this.parameters.screenOffset[1]*p.pixelRatio,Uc[0]=Math.floor(Uc[0]),Uc[1]=Math.floor(Uc[1]),O9e(Tb,dW.factor,Tb);const Y=f2t*p.pixelRatio;let Q=0;if(a.textureIsSignedDistanceField&&(Q=a.outlineSize*p.pixelRatio/2),xye(c,Uc[0],Uc[1],Tb,Y,Q,a,$)){const ne=r.ray;if(bt(Sye,nc,Bo(h2t,p.viewMatrix)),Uc[0]=c[0],Uc[1]=c[1],p.unprojectFromRenderScreen(Uc,nc)){const ie=W();Ne(ie,ne.direction);const he=1/nt(ie);De(ie,ie,he),o(Tn(ne.origin,nc)*he,ie,-1,!0,1,Sye)}}}}}intersectDraped(e,i,r,n,s,o){const a=e.attributes.get(J.POSITION),c=e.attributes.get(J.SIZE),p=this.parameters,_=qL(p);let{scaleX:x,scaleY:S}=this._getScreenScale(e);x*=e.screenToWorldRatio,S*=e.screenToWorldRatio;const C=m2t*e.screenToWorldRatio;for(let M=0;M0?_:1/_),s}_applyVerticalGroundOffsetView(e,i,r,n){const s=nt(e),o=r.aboveGround?1:-1,a=r.computeRenderPixelSizeAtDist(s)*z9e,c=De(nc,i.normal,o*a);return Be(n,e,c),n}_applyVerticalOffsetTransformationView(e,i,r,n){var p;const s=this.parameters;if(!((p=s.verticalOffset)!=null&&p.screenLength)){if(s.screenSizePerspective||s.screenSizePerspectiveAlignment){const _=nt(e);this._updateScaleInfo(n,_,i.cosAngle)}else n.factor.scale=1,n.factorAlignment.scale=1;return e}const o=nt(e),a=s.screenSizePerspectiveAlignment??s.screenSizePerspective,c=H9e(r,o,s.verticalOffset,i.cosAngle,a);return this._updateScaleInfo(n,o,i.cosAngle),De(i.normal,i.normal,c),Be(e,e,i.normal)}_applyCenterOffsetView(e,i,r){const n=this.parameters.centerOffsetUnits!=="screen";return r!==e&&Ne(r,e),n&&(r[0]+=i[0],r[1]+=i[1],i[2]&&(Ye(TR,r),Be(r,r,De(TR,TR,i[2])))),r}_applyCenterOffsetNDC(e,i,r,n){const s=this.parameters.centerOffsetUnits!=="screen";return n!==e&&Ne(n,e),s||(n[0]+=i[0]/r.fullWidth*2,n[1]+=i[1]/r.fullHeight*2),n}_applyPolygonOffsetNDC(e,i,r,n){const s=this.parameters.shaderPolygonOffset;if(e!==n&&Ne(n,e),s){const o=r.aboveGround?1:-1,a=o*Math.sign(i[3]);n[2]-=(a||o)*s}return n}produces(e,i){if(i===ue.Color||i===ue.Alpha||i===ue.Highlight||i===ue.ObjectAndLayerIdColor){if(e===ke.DRAPED_MATERIAL)return!0;const{drawInSecondSlot:r,occlusionTest:n}=this.parameters;return e===(r?ke.LABEL_MATERIAL:ke.HUD_MATERIAL)||n&&e===ke.OCCLUSION_PIXELS}return!1}createGLMaterial(e){return new o2t(e)}calculateRelativeScreenBounds(e,i,r=Ni()){return a2t(this.parameters,e,i,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}_getScreenScale(e){const i=e.attributes.get(J.FEATUREATTRIBUTE);if(i==null)return{scaleX:1,scaleY:1};const r=QB(i.data,p2t),[n,s]=Ele(d2t,this.parameters,r);return{scaleX:n,scaleY:s}}},o2t=class extends Lae{constructor(e){super({...e,...e.material.parameters})}selectProgram(e){return this.ensureTechnique(h6e,e)}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.selectProgram(e)}};function a2t(t,e,i,r=c2t){return ea(r,t.anchorPosition),r[0]*=-e[0],r[1]*=-e[1],r[0]+=t.screenOffset[0]*i,r[1]+=t.screenOffset[1]*i,r}function l2t(t){const e=t[0],i=t[1],r=t[2],n=t[3],s=t[4],o=t[5],a=t[6],c=t[7],p=t[8],_=1/Math.sqrt(e*e+i*i+r*r),x=1/Math.sqrt(n*n+s*s+o*o),S=1/Math.sqrt(a*a+c*c+p*p);return t[0]=e*_,t[1]=i*_,t[2]=r*_,t[3]=n*x,t[4]=s*x,t[5]=o*x,t[6]=a*S,t[7]=c*S,t[8]=p*S,t}function xye(t,e,i,r,n,s,o,a){let c=e-n-(a[0]>0?r[0]*a[0]:0),p=c+r[0]+2*n,_=i-n-(a[1]>0?r[1]*a[1]:0),x=_+r[1]+2*n;const S=o.distanceFieldBoundingBox;return o.textureIsSignedDistanceField&&S!=null&&(c+=r[0]*S[0],_+=r[1]*S[1],p-=r[0]*(1-S[2]),x-=r[1]*(1-S[3]),c-=s,p+=s,_-=s,x+=s),t[0]>c&&t[0]_&&t[1]0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==$h.Idle||this._dirty}get updatingProgress(){if(!this.updating)return 1;const t=this._state/$h.NumStates;return this._dirty?.5*t:t}get running(){return this.view.ready&&this.view.state!=null&&this.updating}runTask(t){switch(this._state){case $h.Idle:this._startUpdate(),t.madeProgress();case $h.Process:if(this._state=$h.Process,!this._processActiveGraphics(t))return;case $h.Sort:if(this._state=$h.Sort,!this._sortVisibleGraphics(t))return;case $h.Deconflict:if(this._state=$h.Deconflict,!this._deconflictVisibleGraphics(t))return;default:mwt(this,this._visible),this._state=$h.Idle,this.notifyChange("updating")}}modifyGraphics(t,e){e?t.forEach(i=>this.addToActiveGraphics(i)):t.forEach(i=>this.removeFromActiveGraphics(i)),this.setDirty()}layerSupportsDeconfliction(t){if(t==null||t.type!=="object3d")return!1;const e=t.stageObject;if(((e==null?void 0:e.geometries.length)??0)!==1)return!1;const i=e==null?void 0:e.geometries[0];return(i==null?void 0:i.material)instanceof kP}_startUpdate(){gwt(this.view),this._dirty=!1,this._runningViewState.copyFrom(this.viewState);const{fullWidth:t,fullHeight:e}=this._runningViewState.camera;this._initBins(t,e),this._resetIterators()}addToActiveGraphics(t){t.info[this.visibilityGroup]=new T2t,this._active.set(t.graphics3DGraphic.graphic.uid,t),this.setDirty()}removeFromActiveGraphics(t){this._visible.delete(t.graphics3DGraphic.graphic.uid),C2t(t,this.visibilityGroup),delete t.info[this.visibilityGroup],this._active.delete(t.graphics3DGraphic.graphic.uid),this.setDirty()}_processActiveGraphics(t){const e=this._ensureActiveGraphicsIterator(),i=u5(b2t,this._runningViewState.camera.projectionMatrix),r=this.view.viewingMode==="global"&&this.view.map.ground.opacity===1&&this._runningViewState.camera.relativeElevation>0?w2t:null;let n=0;for(r!=null&&(bt(r,el,this._runningViewState.camera.viewMatrix),r[3]=Tr(this.view.spatialReference).radius,n=R5e(r,el));!t.done;){t.madeProgress();const s=e.next();if(s.done===!0)return this._resetActiveGraphicsIterator(),!0;const o=s.value,a=o==null?void 0:o.info[this.visibilityGroup];a&&(this._collectGraphics3DGraphics(o,i,r,n),a.culled?this._visible.delete(o.graphics3DGraphic.graphic.uid):this._visible.set(o.graphics3DGraphic.graphic.uid,o))}return!1}_sortVisibleGraphics(t){const e=this._ensureSortGraphicsIterator();for(;!t.done;){const i=e.next();if(t.madeProgress(),i.done===!0)return this._resetSortGraphicsIterator(),!0}return!1}_deconflictVisibleGraphics(t){const e=this._ensureVisibleGraphicsIterator(),i=this.visibilityGroup===Za.LABEL;for(;!t.done;){t.madeProgress();const r=e.next();if(r.done===!0)return this._resetVisibleGraphicsIterator(),!0;const n=r.value,s=n.info[this.visibilityGroup];if(!s||s.culled){this._setGraphicVisibility(n,!1);continue}const o=n.graphics3DGraphic,a=!i||o.isVisible();s.visible=a&&!this._isConflicted(n),s.visible&&this._addToBins(n),this._setGraphicVisibility(n,s.visible),vwt(s,s.visible)}return!1}_resetIterators(){this._iterators.active=null,this._iterators.visible=null,this._iterators.sort=null}_ensureActiveGraphicsIterator(){return this._iterators.active||(this._iterators.active=Tye(this._active)),this._iterators.active}_resetActiveGraphicsIterator(){this._iterators.active=null}_ensureVisibleGraphicsIterator(){return this._iterators.visible||(this._iterators.visible=Tye(this._visible)),this._iterators.visible}_resetVisibleGraphicsIterator(){this._iterators.visible=null}_ensureSortGraphicsIterator(){return this._iterators.sort||(this._iterators.sort=A2t(this._visible,this._iterators.sortArray,this.visibilityGroup)),this._iterators.sort}_resetSortGraphicsIterator(){this._iterators.sort=null}_collectGraphics3DGraphics(t,e,i,r){const n=t.graphics3DGraphic;if(n.destroyed)return;const s=t.info[this.visibilityGroup];if(!n.isVisible(Za.GRAPHIC,Wl.DECONFLICTION))return void(s.culled=!0);const o=this.getGraphicsLayers(n);ld(s.aabr);let a=null;for(const c of o){if(!this.layerSupportsDeconfliction(c))continue;const p=c.stageObject.geometries[0].material;if(a==null&&(a=I2t,this._getProjectionInfo(c,e,a),a.isOutsideScreen||this._isCulledBySlice(t,ag)||i!=null&&this._isCulledByHorizon(a,i,r)))return void(s.culled=!0);this._expandBoundingRect(s,c,p,a)}a==null?s.culled=!0:(s.distance=a.distance,s.culled=!1)}_getProjectionInfo(t,e,i){const r=this._runningViewState.camera,n=t.stageObject,s=n.geometries[0],o=s.material,a=n.boundingVolumeWorldSpace.bounds;bt(ag,a,r.viewMatrix);const c=s.attributes,p=c.get(J.NORMAL).data,_=c.get(J.AUXPOS1).data;o.applyShaderOffsetsView(ag,p,n.transformation,_,r,i.scaleInfo,ag),rs(yC,ag[0],ag[1],ag[2],1),dp(ER,yC,r.projectionMatrix),De(i.positionNDC,ER,1/ER[3]),o.applyShaderOffsetsNDC(i.positionNDC,_,r,i.positionNDC,mW),i.distanceWithoutPolygonOffset=r.depthNDCToWorld(mW[2]),i.distance=mW[2]===i.positionNDC[2]?i.distanceWithoutPolygonOffset:r.depthNDCToWorld(i.positionNDC[2]),rs(ER,i.positionNDC[0],i.positionNDC[1],i.positionNDC[2],1),dp(yC,ER,e),jT(yC,yC,1/yC[3]),Ie(i.positionView,ag[0],ag[1],ag[2])}_isCulledByHorizon(t,e,i){return Ne(gW.direction,t.positionView),Ie(gW.origin,0,0,0),!!px(e,gW,x2t)&&t.distanceWithoutPolygonOffset>i}_isCulledBySlice(t,e){return t.slicePlaneEnabled&&this._runningViewState.slicePlaneEnabled&&lae(this._runningViewState.slicePlane,e)}_expandBoundingRect(t,e,i,{positionNDC:r,scaleInfo:n}){const s=this._runningViewState.camera,o=e.getScreenSize(P2t);O9e(o,n.factor,o),o[0]*=s.pixelRatio,o[1]*=s.pixelRatio;const a=Pz(i.calculateRelativeScreenBounds(o,n.factorAlignment.scale,S2t),ui(0,s.fullWidth,.5+.5*r[0]),ui(0,s.fullHeight,.5+.5*r[1])),c=this.marginFactor;if(c!==0){const p=c*Math.min(xc(a),Yu(a));a[0]-=p,a[1]-=p,a[2]+=p,a[3]+=p}x2(t.aabr,a,t.aabr)}_isConflicted(t){const e=t.graphics3DGraphic.graphic.uid,i=t.info[this.visibilityGroup];let r=!0;for(let n=Math.floor(i.aabr[0]/this._accBinsSizeX);n<=Math.floor(i.aabr[2]/this._accBinsSizeX);n++)if(!(n<0||n>=this._accBinsNumX))for(let s=Math.floor(i.aabr[1]/this._accBinsSizeY);s<=Math.floor(i.aabr[3]/this._accBinsSizeY);s++){if(s<0||s>=this._accBinsNumY)continue;r=!1;const o=this._accBins[n][s];for(let a=0;a=this._accBinsNumX))for(let a=n;a<=s;a++)a<0||a>=this._accBinsNumY||this._accBins[o][a].push(t)}_setGraphicVisibility(t,e){const i=t.graphics3DGraphic;i.destroyed||(i.setVisibilityFlag(this.visibilityGroup,Wl.DECONFLICTION,e),this.visibilityGroup===Za.LABEL&&this.view.labeler.setLabelGraphicVisibility(i,e))}};function C2t(t,e){const i=t.graphics3DGraphic;i.destroyed||i.setVisibilityFlag(e,Wl.DECONFLICTION,!0)}function*Tye(t){if(Map.prototype.entries){const e=t.entries();for(let i=e.next();!i.done;i=e.next())yield i.value[1]}else yield*t.values()}function*A2t(t,e,i){e.clear(),t.forEach((n,s)=>{var c;const o=e.pushNew();o.id=s,o.visible=n.graphics3DGraphic.getVisibilityFlag(i,Wl.DECONFLICTION);const a=(c=n.info)==null?void 0:c[i];o.prio=n.graphics3DGraphic.deconflictionPriority,o.distance=a?a.distance:Number.MAX_VALUE}),yield;const r=e.iterableSort((n,s)=>n.prio!==s.prio?s.prio-n.prio:n.distance!==s.distance?n.distance-s.distance:n.visible!==s.visible?n.visible?-1:1:n.id-s.id);for(let n=r.next();!n.done;n=r.next())yield;e.forAll(n=>{const s=t.get(n.id);s&&(t.delete(n.id),t.set(n.id,s))}),e.clear()}y([w({constructOnly:!0})],HM.prototype,"view",void 0),y([w({type:Boolean,readOnly:!0})],HM.prototype,"updating",null),HM=y([Z("esri.views.3d.layers.graphics.Deconflictor")],HM);class M2t{constructor(){this.id=0,this.visible=!1,this.prio=0,this.distance=0}}class O2t{constructor(e=null,i=null,r=null){this.active=e,this.visible=i,this.sort=r,this.sortArray=new Pi({allocator:n=>n||new M2t})}}const P2t=yt();class R2t{constructor(){this.positionView=W(),this.positionNDC=W(),this.distance=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new X9e}get isOutsideScreen(){const e=this.positionNDC;return e[0]<-1||e[1]<-1||e[2]<-1||e[0]>=1||e[1]>=1}}const I2t=new R2t,$2t=2e3;let uk=class extends HM{constructor(e){super(e),this.visibilityGroup=Za.LABEL,this.marginFactor=.05,this._lastDeconfliction=0}get viewState(){return this.parent.viewState}runTask(e){if(this.parent.running)return Jl.YIELD;const i=performance.now();if(e.state!==Vr.IDLE&&i-this._lastDeconfliction<$2t)return Jl.YIELD;super.runTask(e),this.state===$h.Idle&&(this._lastDeconfliction=i)}enabledChanged(e,i){this.modifyGraphics(i,e.labelsEnabled)}getGraphicsLayers(e){return e.labelLayers}};y([w({constructOnly:!0})],uk.prototype,"parent",void 0),uk=y([Z("esri.views.3d.layers.graphics.LabelDeconflictor")],uk);let uie=class extends HM{constructor(){super(...arguments),this._contexts=new Map,this._viewState=new m6e,this.visibilityGroup=Za.GRAPHIC,this._marginFactor=-.1}get labels(){return this._labels}get viewState(){return this._viewState}initialize(){this.addHandles([_e(()=>{var e,i;return(i=(e=this.view)==null?void 0:e.state)==null?void 0:i.camera},()=>{this._updateViewState(),this.setDirty()}),_e(()=>{var e,i,r;return(r=(i=(e=this.view)==null?void 0:e.map)==null?void 0:i.ground)==null?void 0:r.opacity},(e,i)=>{e!==1&&i!==1||this.setDirty()}),_e(()=>{var e;return(e=this.view)==null?void 0:e.slicePlane},()=>{this._updateSlicePlane(),this._slicePlaneChanged()},Qt)]),this._frameTask=this.view.resourceController.scheduler.registerTask(ni.GRAPHICS_DECONFLICTOR,this),this._labels=new uk({view:this.view,parent:this})}destroy(){this._labels=et(this._labels),this._frameTask=en(this._frameTask)}get marginFactor(){return this._marginFactor}set marginFactor(e){this._marginFactor=e,this.setDirty()}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){super.runTask(e),this.running||this._labels.setDirty()}setInitialIconVisibilityFlag(e,i){const r=!(this._graphicSupportsDeconfliction(i)&&yW(e));i.setVisibilityFlag(Za.GRAPHIC,Wl.DECONFLICTION,r)}_updateViewState(){var e;(e=this.view)!=null&&e.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){const e=this.view?this.view.slicePlane:null;e!=null&&XRe(e,this._viewState.camera.viewMatrix,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=e!=null}_slicePlaneChanged(){ap(this._contexts,(e,i)=>i.symbolCreationContext.slicePlaneEnabled)&&this.setDirty()}addGraphicsOwner(e){const i=this._getGraphicsContext(e);return{addGraphic:r=>this._addGraphic(e,i,r),removeGraphic:r=>this._removeGraphic(i,r),labelingInfoChange:()=>this._labels.enabledChanged(e,i),featureReductionChange:()=>this.enabledChanged(e,i),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,i),clear:()=>i.forEach(r=>this._removeGraphic(i,r.graphics3DGraphic))}}removeGraphicsOwner(e){const i=this._contexts.get(e);i&&(i.forEach(r=>this._removeGraphic(i,r.graphics3DGraphic)),this._contexts.delete(e),this.setDirty())}_addGraphic(e,i,r){const n=r.graphic.uid,s=new E2t(r,e.symbolCreationContext.slicePlaneEnabled);i.set(n,s),yW(e)&&this.addToActiveGraphics(s),e.labelsEnabled&&this._labels.addToActiveGraphics(s)}_removeGraphic(e,i){const r=i.graphic.uid,n=e.get(r);n&&(this.removeFromActiveGraphics(n),this._labels.removeFromActiveGraphics(n),e.delete(r),this.setDirty())}enabledChanged(e,i){const r=yW(e);r||L2t(e),this.modifyGraphics(i,r)}_slicePlaneEnabledChanged(e,i){const r=e.symbolCreationContext.slicePlaneEnabled;i.forEach(n=>n.slicePlaneEnabled=r),this.setDirty()}getGraphicsLayers(e){return e.layers}_graphicSupportsDeconfliction(e){if(e.isDraped)return!1;const i=e.layers;if(!(i!=null&&i.length))return!1;for(const r of i)if(this.layerSupportsDeconfliction(r))return!0;return!1}_getGraphicsContext(e){const i=this._contexts.get(e);if(i)return i;const r=new Map;return this._contexts.set(e,r),this.setDirty(),r}};function yW(t){const e=t.layer;return!(!(e!=null&&e.featureReduction)||e.featureReduction.type!=="selection")}function L2t(t){const e=t.graphics3DGraphics;e&&e.forEach(i=>i.setVisibilityFlag(Za.GRAPHIC,Wl.DECONFLICTION,!0))}uie=y([Z("esri.views.3d.layers.graphics.GraphicsDeconflictor")],uie);function g6e(t){return"declaredClass"in t}function Eye(t){return"declaredClass"in t}function D2t(t){return"declaredClass"in t}function N2t(t,e){return t?D2t(t)?t:new Ma({layer:e,sourceLayer:e,visible:t.visible,symbol:Pe(t.symbol),attributes:Pe(t.attributes),geometry:y6e(t.geometry)}):null}function y6e(t){return t==null?null:g6e(t)?t:Wy(F2t(t))}function F2t(t){const{wkid:e,wkt:i,wkt2:r,latestWkid:n}=t.spatialReference,s={wkid:e,wkt:i,wkt2:r,latestWkid:n};switch(t.type){case"point":{const{x:o,y:a,z:c,m:p}=t;return{x:o,y:a,z:c,m:p,spatialReference:s}}case"polygon":{const{rings:o,hasZ:a,hasM:c}=t;return{rings:Cye(o),hasZ:a,hasM:c,spatialReference:s}}case"polyline":{const{paths:o,hasZ:a,hasM:c}=t;return{paths:Cye(o),hasZ:a,hasM:c,spatialReference:s}}case"extent":{const{xmin:o,xmax:a,ymin:c,ymax:p,zmin:_,zmax:x,mmin:S,mmax:C,hasZ:M,hasM:P}=t;return{xmin:o,xmax:a,ymin:c,ymax:p,zmin:_,zmax:x,mmin:S,mmax:C,hasZ:M,hasM:P,spatialReference:s}}case"multipoint":{const{points:o,hasZ:a,hasM:c}=t;return{points:_6e(o)?v6e(o):o,hasZ:a,hasM:c,spatialReference:s}}default:return}}function Cye(t){return k2t(t)?t.map(e=>v6e(e)):t}function v6e(t){return t.map(e=>Array.from(e))}function k2t(t){for(const e of t)if(e.length!==0)return _6e(e);return!1}function _6e(t){return t.length>0&&(t5(t[0])||i5(t[0]))}function z2t(t,e){if(!t)return null;let i;if(Eye(t)){if(e==null)return t.clone();if(Eye(e))return e.copy(t)}return e!=null?(i=e,i.x=t.x,i.y=t.y,i.spatialReference=t.spatialReference,t.hasZ?(i.z=t.z,i.hasZ=t.hasZ):(i.z=void 0,i.hasZ=!1),t.hasM?(i.m=t.m,i.hasM=!0):(i.m=void 0,i.hasM=!1)):(i=Ju(t.x,t.y,t.z,t.spatialReference),t.hasM&&(i.m=t.m,i.hasM=!0)),i}function Koi(t){const{wkid:e,wkt:i,wkt2:r,latestWkid:n}=t,s={wkid:e,wkt:i,wkt2:r,latestWkid:n};return rt.fromJSON(s)}const vW=Ce.getLogger("esri.layers.support.labelFormatUtils"),_W={type:"simple",evaluate:()=>null},U2t={getAttribute:(t,e)=>t.field(e)};async function b6e(t,e,i){if(!t||!t.symbol||!e)return _W;const r=t.where,n=sj(t);let s;if(n.type==="arcade"){const o=await AQe(n.expression,i,e);if(o==null)return _W;s={type:"arcade",evaluate(a,c){try{const p="attributes"in a?o.repurposeFeature(a):a;p.contextTimeZone=c??null;const _=o.evaluate({$view:{timeZone:c},$feature:p},o.services);if(_!=null)return _.toString()}catch(p){vW.error(new se("arcade-expression-error","Encountered an error when evaluating label expression for feature",{error:p,feature:a,expression:n}))}return null},needsHydrationToEvaluate:()=>Poe(n.expression)==null}}else s={type:"simple",evaluate:o=>n.expression.replaceAll(/{[^}]*}/g,a=>{const c=a.slice(1,-1),p=e.get(c);if(!p)return a;let _=null;return"attributes"in o?o&&o.attributes&&(_=o.attributes[p.name]):_=o.field(p.name),_==null?"":w6e(_,p)})};if(r){let o;try{o=await _se(r,e)}catch(c){return vW.error(new se("bad-where-clause","Encountered an error when evaluating where clause, ignoring",{where:r,error:c})),_W}const a=s.evaluate;s.evaluate=(c,p)=>{const _="attributes"in c?void 0:U2t;try{if(o.testFeature(c,_))return a(c,p)}catch(x){vW.error(new se("bad-where-clause","Encountered an error when evaluating where clause for feature",{where:r,feature:c,error:x}))}return null}}return s}function w6e(t,e){if(t==null)return"";const i=e.domain;if(i){if(i.type==="codedValue"||i.type==="coded-value"){const n=t;for(const s of i.codedValues)if(s.code===n)return s.name}else if(i.type==="range"){const{max:n,min:s}=BAe(e),o=+t;if(s!=null&&n!=null&&s<=o&&o<=n)return i.name}}let r=t;return Lse(e)?r=Gs(r,pA("short-date")):$se(e)&&(r=hd(+r)),r||""}const Qoi=Object.freeze(Object.defineProperty({__proto__:null,createLabelFunction:b6e,formatField:w6e},Symbol.toStringTag,{value:"Module"}));function Lle(t,e){if(t.type==="point")return Eb(t,e,!1);if(g6e(t))switch(t.type){case"extent":return Eb(t.center,e,!1);case"polygon":return Eb(t.centroid,e,!1);case"polyline":return Eb(Aye(t),e,!0);case"mesh":return Eb(t.origin,e,!1)}else switch(t.type){case"extent":return Eb(V2t(t),e,!0);case"polygon":return Eb(B2t(t),e,!0);case"polyline":return Eb(Aye(t),e,!0)}}function Aye(t){const e=t.paths[0];if(!e||e.length===0)return null;const i=yEe(e,gEe(e)/2);return Ju(i[0],i[1],i[2],t.spatialReference)}function V2t(t){return Ju(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),t.zmin!=null&&t.zmax!=null&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function B2t(t){const e=t.rings[0];if(!e||e.length===0)return null;const i=_Ee(t.rings,!!t.hasZ);return Ju(i[0],i[1],i[2],t.spatialReference)}function Eb(t,e,i){const r=i?t:z2t(t);return e&&t?cPe(t,r,e)?r:null:r}function eai(t,e,i,r=0){if(t){e||(e=Ni());const n=t;let s=.5*n.width*(i-1),o=.5*n.height*(i-1);return n.width<1e-7*n.height?s+=o/20:n.height<1e-7*n.width&&(o+=s/20),rs(e,n.xmin-s-r,n.ymin-o-r,n.xmax+s+r,n.ymax+o+r),e}return null}function x6e(t,e){for(let i=0;i3&&(r[3]=t[3]),i&&(r[0]*=i,r[1]*=i,r[2]*=i,r[3]*=i),r}function tai(t,e,i,r,n,s=[0,0,0,0]){for(let o=0;o<3;++o)s[o]=(t==null?void 0:t[o])!=null?t[o]:(i==null?void 0:i[o])!=null?i[o]:n[o];return s[3]=e??r??n[3],s}function Mye(t=Yv,e,i,r=1){const n=new Array(3);if(e==null||i==null)n[0]=1,n[1]=1,n[2]=1;else{let s,o=0;for(let a=2;a>=0;a--){const c=t[a];let p;const _=c!=null,x=a===0&&!s&&!_,S=i[a];c==="symbol-value"||x?p=S!==0?e[a]/S:1:_&&c!=="proportional"&&isFinite(c)&&(p=S!==0?c/S:1),p!=null&&(n[a]=p,s=p,o=Math.max(o,Math.abs(p)))}for(let a=2;a>=0;a--)n[a]==null?n[a]=s:n[a]===0&&(n[a]=.001*o)}for(let s=2;s>=0;s--)n[s]/=r;return vc(n)}function j2t(t){return t.isPrimitive!=null}function dG(t){return hie(j2t(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function hie(t){const e=i=>i==null||i>=0;return Array.isArray(t)?t.every(e):e(t)}function G2t(t,e,i,r=Qe()){return t&&iP(r,r,-t/180*Math.PI),e&&tP(r,r,e/180*Math.PI),i&&xB(r,r,i/180*Math.PI),r}function Dle(t,e,i){if(i.minDemResolution!=null)return i.minDemResolution;const r=xs(e),n=vE(t)*r,s=_E(t)*r,o=ux(t)*(e.isGeographic?1:r);return n===0&&s===0&&o===0?i.minDemResolutionForPoints:.01*Math.max(n,s,o)}function S6e(t,e,i,r,n,s,o,a,c,p,_){const x=K2t[_.mode];let S,C,M=0;if(un(t,e,i,r,c.spatialReference,n,a))return x.requiresAlignment(_)?(M=x.applyElevationAlignmentBuffer(r,n,s,o,a,c,p,_),S=s,C=o):(S=r,C=n),un(S,c.spatialReference,C,s,p.spatialReference,o,a)?M:void 0}function Q2(t,e,i,r,n){const s=(gU(t)?t.z:zIe(t)?t.array[t.offset+2]:t[2])||0;switch(i.mode){case"on-the-ground":{const o=wy(e,t,"ground")??0;return n.verticalDistanceToGround=0,n.sampledElevation=o,void(n.z=o)}case"relative-to-ground":{const o=wy(e,t,"ground")??0,a=i.geometryZWithOffset(s,r);return n.verticalDistanceToGround=a,n.sampledElevation=o,void(n.z=a+o)}case"relative-to-scene":{const o=wy(e,t,"scene")??0,a=i.geometryZWithOffset(s,r);return n.verticalDistanceToGround=a,n.sampledElevation=o,void(n.z=a+o)}case"absolute-height":{const o=i.geometryZWithOffset(s,r),a=wy(e,t,"ground")??0;return n.verticalDistanceToGround=o-a,n.sampledElevation=a,void(n.z=o)}default:return void(n.z=0)}}function H2t(t,e,i,r){return Q2(t,e,i,r,qM),qM.z}function a6(t,e,i){return e==null||i==null?t.definedChanged:e==="on-the-ground"&&i==="on-the-ground"?t.staysOnTheGround:e===i||e!=="on-the-ground"&&i!=="on-the-ground"?Ys.UPDATE:t.onTheGroundChanged}function s0(t){return t==="relative-to-ground"||t==="relative-to-scene"}function ex(t){return t!=="absolute-height"}function q2t(t,e,i,r,n){Q2(e,i,n,r,qM),x6e(t,qM.verticalDistanceToGround);const s=qM.sampledElevation,o=Mo(Q2t,t.transformation);return RN[0]=e.x,RN[1]=e.y,RN[2]=qM.z,Ac(e.spatialReference,RN,o,r.spatialReference)?t.transformation=o:console.warn("Could not locate symbol object properly, it might be misplaced"),s}function W2t(t,e,i,r,n,s){let o=0;const a=s.spatialReference;e*=3,r*=3;for(let c=0;c!0},"relative-to-ground":{applyElevationAlignmentBuffer:Y2t,requiresAlignment:()=>!0},"relative-to-scene":{applyElevationAlignmentBuffer:X2t,requiresAlignment:()=>!0}},Q2t=Qe(),qM=new l6,RN=W();function Nle(t){return t.mapPositions!=null}function T6e(t,e,i,r,n){const s=t.stageObject,o=s.geometries;let a=0;for(const c of o){if(!Nle(c))continue;const{update:p,averageGeometrySampledElevation:_}=C6e(c,e,i,r,n);a+=_,p&&s.geometryVertexAttributeUpdated(c,J.POSITION)}return a/o.length}function CT(t,e,i,r,n,s){const o=t.stageObject,a=e.centerPointInElevationSR;let c=0;o.usesVerticalDistanceToGround?(r(a,ju),x6e(o,ju.verticalDistanceToGround),c=ju.sampledElevation):(r(a,ju),e.mode!=="absolute-height"&&(c=ju.sampledElevation));const p=Mo(ext,s??o.transformation),_=Ie(E6e,p[12],p[13],p[14]);En.TESTS_DISABLE_OPTIMIZATIONS?(Bu[0]=a.x,Bu[1]=a.y,Bu[2]=ju.z,Ac(a.spatialReference,Bu,p,n.spatialReference)&&(s?Mo(s,p):o.transformation=p)):n.setAltitudeOfTransformation(ju.z,p);const x=Fle/n.unitInMeters;return(Math.abs(p[12]-_[0])>=x||Math.abs(p[13]-_[1])>=x||Math.abs(p[14]-_[2])>=x)&&(s?Mo(s,p):o.transformation=p),c}const ext=Qe();function txt(t,e,i,r,n){const s=t.graphics3DSymbolLayer.lodRenderer;if(s==null)return 0;const o=e.centerPointInElevationSR;r(o,ju);const a=e.mode!=="absolute-height"?ju.sampledElevation:0,c=s.instanceData,p=t.instanceIndex,_=rxt;c.getGlobalTransform(p,_);const x=Ie(E6e,_[12],_[13],_[14]);En.TESTS_DISABLE_OPTIMIZATIONS?(Bu[0]=o.x,Bu[1]=o.y,Bu[2]=ju.z,Ac(o.spatialReference,Bu,_,n.spatialReference)&&c.setGlobalTransform(p,_)):n.setAltitudeOfTransformation(ju.z,_);const S=Fle/n.unitInMeters;return(En.TESTS_DISABLE_OPTIMIZATIONS||Math.abs(_[12]-x[0])>=S||Math.abs(_[13]-x[1])>=S||Math.abs(_[14]-x[2])>=S)&&c.setGlobalTransform(p,_),a}function ixt(t,e,i,r,n){const s=t.stageObject,o=s.geometries;if(o.length===0)return 0;let a=0,c=null,p=0,_=!1;for(const x of o){if(!Nle(x))continue;const S=x.attributes.get(J.POSITION);if(S!==c){const{update:C,averageGeometrySampledElevation:M}=C6e(x,e,i,r,n);p=M,c=S,_=C}_&&s.geometryVertexAttributeUpdated(x,J.POSITION),a+=p}return a/o.length}const Fle=.01,Bu=W(),zp=W(),vC=W(),rxt=Qe(),E6e=W(),ju=new l6;function C6e(t,e,i,r,n){let s=!1;const o=t.transformation,a=e.requiresSampledElevationInfo;zp[0]=o[12],zp[1]=o[13],zp[2]=o[14],t.invalidateBoundingInfo();const c=t.getMutableAttribute(J.POSITION),p=c.data,_=c.size,x=p.length/_,S=new yae(t.mapPositions,i);let C=0,M=0;for(let P=0;P=$||Math.abs(vC[1]-p[C+1])>=$||Math.abs(vC[2]-p[C+2])>=$)&&(s=!0)}C+=_,S.offset+=3}return M/=x,{update:s,averageGeometrySampledElevation:M}}const nxt=Ce.getLogger("esri.views.3d.layers.graphics.featureExpressionInfoUtils");function sxt(t){return{cachedResult:t.cachedResult,arcade:t.arcade?{func:t.arcade.func,context:t.arcade.modules.arcadeUtils.createExecContext(null,{sr:t.arcade.context.spatialReference}),modules:t.arcade.modules}:null}}function rai(t){const e=t==null?void 0:t.expression;if(typeof e=="string"){const i=O6e(e);if(i!=null)return{cachedResult:i}}return null}async function nai(t,e,i,r){const n=t==null?void 0:t.expression;if(typeof n!="string")return null;const s=O6e(n);if(s!=null)return{cachedResult:s};const o=await b_();St(i);const a=o.arcadeUtils,c=a.createSyntaxTree(n);return a.dependsOnView(c)?(r!=null&&r.error("Expressions containing '$view' are not supported on ElevationInfo"),{cachedResult:0}):{arcade:{func:a.createFunction(c),context:a.createExecContext(null,{sr:e}),modules:o}}}function A6e(t,e,i){return t.arcadeUtils.createFeature(e.attributes,e.geometry,i)}function pG(t,e){if(t!=null&&!M6e(t)){if(!e||!t.arcade)return void nxt.errorOncePerTick("Arcade support required but not provided");const i=e;i._geometry&&(i._geometry=y6e(i._geometry)),t.arcade.modules.arcadeUtils.updateExecContext(t.arcade.context,e)}}function oxt(t){if(t!=null){if(M6e(t))return t.cachedResult;const e=t.arcade;let i=e==null?void 0:e.modules.arcadeUtils.executeFunction(e.func,e.context);return typeof i!="number"&&(t.cachedResult=0,i=0),i}return 0}function sai(t,e=!1){let i=t==null?void 0:t.featureExpressionInfo;const r=i==null?void 0:i.expression;return e||r==="0"||(i=null),i??null}const axt={cachedResult:0};function M6e(t){return t.cachedResult!=null}function O6e(t){return t==="0"?0:null}let BU=class P6e{constructor(){this._meterUnitOffset=0,this._renderUnitOffset=0,this._unit="meters",this._metersPerElevationInfoUnit=1,this._featureExpressionInfoContext=null,this.centerPointInElevationSR=null,this.mode=null}get featureExpressionInfoContext(){return this._featureExpressionInfoContext}get meterUnitOffset(){return this._meterUnitOffset}get unit(){return this._unit}set unit(e){this._unit=e,this._metersPerElevationInfoUnit=XMe(e)}get requiresSampledElevationInfo(){return this.mode!=="absolute-height"}reset(){this.mode=null,this._meterUnitOffset=0,this._renderUnitOffset=0,this._featureExpressionInfoContext=null,this.unit="meters"}set offsetMeters(e){this._meterUnitOffset=e,this._renderUnitOffset=0}set offsetElevationInfoUnits(e){this._meterUnitOffset=e*this._metersPerElevationInfoUnit,this._renderUnitOffset=0}addOffsetRenderUnits(e){this._renderUnitOffset+=e}geometryZWithOffset(e,i){const r=this.calculateOffsetRenderUnits(i);return this.featureExpressionInfoContext!=null?r:e+r}calculateOffsetRenderUnits(e){let i=this._meterUnitOffset;const r=this.featureExpressionInfoContext;return r!=null&&(i+=oxt(r)*this._metersPerElevationInfoUnit),i/e.unitInMeters+this._renderUnitOffset}setFromElevationInfo(e){this.mode=e.mode,this.unit=Htt(e.unit)?e.unit:"meters",this.offsetElevationInfoUnits=e.offset??0}updateFeatureExpressionInfoContext(e,i,r){if(e==null)return void(this._featureExpressionInfoContext=null);const n=e==null?void 0:e.arcade;n&&i!=null&&r!=null?(this._featureExpressionInfoContext=sxt(e),pG(this._featureExpressionInfoContext,A6e(n.modules,i,r))):this._featureExpressionInfoContext=e}static fromElevationInfo(e){const i=new P6e;return e!=null&&i.setFromElevationInfo(e),i}},lxt=class{constructor(e,i,r){this.graphic=e,this.renderingInfo=i,this.layer=r}},cxt=class{constructor(e,i,r){this.baseMaterial=e,this.edgeMaterials=i,this.properties=r}},b1=class{get isElevationSource(){return!!this.stageObject.lastValidElevationBB}constructor(e,i,r,n,s,o,a,c=null){this.graphics3DSymbolLayer=e,this.stageObject=i,this._uniqueGeometries=r,this._uniqueMaterials=n,this._sharedResource=s,this.elevationAligner=o,this.elevationContext=a,this._edgeState=c,this.type="object3d",this._stageLayer=null,this._visible=!1,this._addedToStage=!1,this.alignedSampledElevation=0,this.needsElevationUpdates=!1,this.useObjectOriginAsAttachmentOrigin=!1}initialize(e){this._stageLayer=e;const i=e.stage;i.addMany(this._uniqueMaterials),i.addMany(this._uniqueGeometries),i.add(this.stageObject)}destroy(){var r;if(!this._stageLayer)return;const e=this._stageLayer.stage;e.removeMany(this._uniqueMaterials),e.removeMany(this._uniqueGeometries),e.remove(this.stageObject),this._addedToStage&&(this._stageLayer.remove(this.stageObject),this._addedToStage=!1);const i=e.renderer.edgeView;i!=null&&i.hasObject(this.stageObject)&&i.removeObject(this.stageObject),this.stageObject.dispose(),(r=this._sharedResource)==null||r.release(),this._visible=!1,this._stageLayer=null}layerOpacityChanged(e,i){if(this._edgeState==null)return;const r=Oye(this._edgeState.baseMaterial);let n=!1;for(const s of this._edgeState.edgeMaterials)s.objectTransparency!==r&&(s.objectTransparency=r,n=!0);n&&this.resetEdgeObject(i),this._stageLayer.stage.renderer.ensureEdgeView().updateAllComponentOpacities(this.stageObject,[e])}slicePlaneEnabledChanged(e,i){this._edgeState!=null&&(this._stageLayer.stage.renderer.ensureEdgeView().updateAllComponentMaterials(this.stageObject,this._edgeState.edgeMaterials,{hasSlicePlane:e},!i),this._edgeState.properties.hasSlicePlane=e)}setVisibility(e){if(this._stageLayer!=null&&this._visible!==e&&(this._visible=e,this.stageObject.visible=e,this._visible&&!this._addedToStage&&(this._stageLayer.add(this.stageObject),this._addedToStage=!0),this._edgeState)){const i=this._stageLayer.stage.renderer.ensureEdgeView();i.hasObject(this.stageObject)?i.updateObjectVisibility(this.stageObject,e):e&&this._addOrUpdateEdgeObject(i,!1)}}get visible(){return this._visible}alignWithElevation(e,i,r,n){if(this.elevationAligner==null)return;r!=null&&pG(this.elevationContext.featureExpressionInfoContext,r);const s=(o,a)=>Q2(o,e,this.elevationContext,i,a);this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,e.spatialReference,s,i),this.resetEdgeObject(n)}alignWithAbsoluteElevation(e,i,r){const n=(s,o)=>{o.sampledElevation=e,o.verticalDistanceToGround=0,o.z=e};this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,null,n,i),this.resetEdgeObject(r)}getCenterObjectSpace(e=W()){return Ne(e,this.stageObject.boundingVolumeObjectSpace.bounds)}getBoundingBoxObjectSpace(e=va()){const i=this.stageObject.boundingVolumeObjectSpace;return mMe(e,i.min),gMe(e,i.max),e}computeAttachmentOrigin(e){const i=this.stageObject.effectiveTransformation;if(this.useObjectOriginAsAttachmentOrigin)e.render.origin[0]+=i[12],e.render.origin[1]+=i[13],e.render.origin[2]+=i[14],e.render.num++;else for(const r of this.stageObject.geometries)r.computeAttachmentOrigin(P1)&&(bt(P1,P1,i),Be(e.render.origin,e.render.origin,P1),e.render.num++)}async getProjectedBoundingBox(e,i,r,n,s){const o=this.getBoundingBoxObjectSpace(s),a=uxt,c=Bse(o)?1:a.length;for(let _=0;_{var s;return(s=this._stageLayer)==null?void 0:s.sync()})}};function Oye(t){return t.isVisible()?t.parameters.transparent?Wi.TRANSPARENT:Wi.OPAQUE:Wi.INVISIBLE}const kx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Cb=W(),P1=W(),uxt=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];let R6e=class{constructor(e,i=null){this.labelText=i,this.elevationOffset=e??0}};const I6e=3,die=3,$6e=10;let L6e=class{constructor(e,i=null){this.geometry=e,this.textures=i}},D6e=class{constructor(e,i,r){this.components=e,this.minScreenSpaceRadius=i,this.pivotOffset=r;const n=this.geometries;this.numVertices=n.reduce((s,o)=>s+o.attributes.get(J.POSITION).indices.length,0)}get geometries(){return _9(this.components.map(e=>e.geometry))}},N6e=class{constructor(e){this.levels=e,this.levels.sort((i,r)=>i.minScreenSpaceRadius===r.minScreenSpaceRadius?i.numVertices-r.numVertices:i.minScreenSpaceRadius-r.minScreenSpaceRadius)}};function IN(t){const e=[];return t.levels.forEach(i=>i.components.forEach(r=>e.push(r.geometry.material))),_9(e)}function Pye(t){const e=new Array;return t.levels.forEach(i=>i.components.forEach(r=>{r.textures!=null&&e.push(...r.textures)})),_9(e)}function Rye(t){const e=new Array;return t.levels.forEach(i=>i.components.forEach(r=>e.push(r.geometry))),_9(e)}function hxt(t){switch(t){case"sphere":case"cube":case"diamond":case"cylinder":case"cone":case"inverted-cone":case"tetrahedron":return!0}return!1}function F6e(t,e){const i=(r,n,s=!1)=>new N6e(r.map(o=>{const a=n(o.tesselation);return s&&p1t(a),new D6e([new L6e(a)],o.minScreenSpaceRadius)}));switch(t){case"sphere":return i([{tesselation:0,minScreenSpaceRadius:0},{tesselation:1,minScreenSpaceRadius:8},{tesselation:2,minScreenSpaceRadius:16},{tesselation:3,minScreenSpaceRadius:50},{tesselation:4,minScreenSpaceRadius:250}],r=>c1t(e,.5,r,!0));case"cube":return i([{tesselation:0,minScreenSpaceRadius:0}],()=>e1t(e,1));case"cone":return i(bW,r=>Qme(e,1,.5,r,!1),!0);case"inverted-cone":return i(bW,r=>Qme(e,1,.5,r,!0),!0);case"cylinder":return i(bW,r=>h1t(e,1,.5,r,[0,0,1],[0,0,.5]));case"tetrahedron":return i([{tesselation:0,minScreenSpaceRadius:0}],()=>l1t(e,1),!0);case"diamond":return i([{tesselation:0,minScreenSpaceRadius:0}],()=>n1t(e,1),!0);default:return}}const bW=[{tesselation:6,minScreenSpaceRadius:0},{tesselation:18,minScreenSpaceRadius:7},{tesselation:64,minScreenSpaceRadius:65}];let _f=class{constructor(e){this.estimated=!1,this.verticesPerFeature=e.verticesPerFeature??0,this.verticesPerCoordinate=e.verticesPerCoordinate??0,this.drawCallsPerFeature=e.drawCallsPerFeature??0,this.memory=e.memory??new k6e}},kle=class extends _f{constructor(e){super(e),this.estimated=!0}},dxt=class extends _f{constructor(e,i){super(i),this.numComplexities=e}},pxt=class extends kle{constructor(e,i){super(i),this.numComplexities=e}},k6e=class{constructor(){this.bytesPerFeature=0,this.bytesPerFeatureLabel=0,this.resourceBytes=0,this.draped={bytesPerFeature:0,bytesPerFeatureLabel:0}}};function c6(t,e){switch(e.normalType){case Br.Compressed:t.attributes.add(J.NORMALCOMPRESSED,"vec2"),t.vertex.code.add(V`vec3 normalModel() { float z = 1.0 - abs(normalCompressed.x) - abs(normalCompressed.y); return vec3(normalCompressed + sign(normalCompressed) * min(z, 0.0), z); }`);break;case Br.Attribute:t.attributes.add(J.NORMAL,"vec3"),t.vertex.code.add(V`vec3 normalModel() { return normal; }`);break;case Br.ScreenDerivative:t.fragment.code.add(V`vec3 screenDerivativeNormal(vec3 positionView) { return normalize(cross(dFdx(positionView), dFdy(positionView))); -}`);break;default:e.normalType;case Br.COUNT:case Br.Ground:}}var Br;(function(t){t[t.Attribute=0]="Attribute",t[t.Compressed=1]="Compressed",t[t.Ground=2]="Ground",t[t.ScreenDerivative=3]="ScreenDerivative",t[t.COUNT=4]="COUNT"})(Br||(Br={}));function j6e(t,e){const i=t.fragment;switch(i.code.add(V`struct ShadingNormalParameters { +}`);break;default:e.normalType;case Br.COUNT:case Br.Ground:}}var Br;(function(t){t[t.Attribute=0]="Attribute",t[t.Compressed=1]="Compressed",t[t.Ground=2]="Ground",t[t.ScreenDerivative=3]="ScreenDerivative",t[t.COUNT=4]="COUNT"})(Br||(Br={}));function z6e(t,e){const i=t.fragment;switch(i.code.add(V`struct ShadingNormalParameters { vec3 normalView; vec3 viewDirection; -} shadingParams;`),e.doubleSidedMode){case Is.None:i.code.add(V`vec3 shadingNormal(ShadingNormalParameters params) { +} shadingParams;`),e.doubleSidedMode){case Ls.None:i.code.add(V`vec3 shadingNormal(ShadingNormalParameters params) { return normalize(params.normalView); -}`);break;case Is.View:i.code.add(V`vec3 shadingNormal(ShadingNormalParameters params) { +}`);break;case Ls.View:i.code.add(V`vec3 shadingNormal(ShadingNormalParameters params) { return dot(params.normalView, params.viewDirection) > 0.0 ? normalize(-params.normalView) : normalize(params.normalView); -}`);break;case Is.WindingOrder:i.code.add(V`vec3 shadingNormal(ShadingNormalParameters params) { +}`);break;case Ls.WindingOrder:i.code.add(V`vec3 shadingNormal(ShadingNormalParameters params) { return gl_FrontFacing ? normalize(params.normalView) : normalize(-params.normalView); -}`);break;default:e.doubleSidedMode;case Is.COUNT:}}var Is;(function(t){t[t.None=0]="None",t[t.View=1]="View",t[t.WindingOrder=2]="WindingOrder",t[t.COUNT=3]="COUNT"})(Is||(Is={}));let EP=class{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.attributes.get(J.POSITION).indices.length}write(e,i,r,n,s){J2t(r,this.vertexBufferLayout,e,i,n,s)}};function nG(t,e){switch(e.normalType){case Br.Attribute:case Br.Compressed:t.include(n6,e),t.varyings.add("vNormalWorld","vec3"),t.varyings.add("vNormalView","vec3"),t.vertex.uniforms.add(new ML("transformNormalGlobalFromModel",i=>i.transformNormalGlobalFromModel),new Wm("transformNormalViewFromGlobal",i=>i.transformNormalViewFromGlobal)),t.vertex.code.add(V`void forwardNormal() { +}`);break;default:e.doubleSidedMode;case Ls.COUNT:}}var Ls;(function(t){t[t.None=0]="None",t[t.View=1]="View",t[t.WindingOrder=2]="WindingOrder",t[t.COUNT=3]="COUNT"})(Ls||(Ls={}));let D5=class{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.attributes.get(J.POSITION).indices.length}write(e,i,r,n,s){Zwt(r,this.vertexBufferLayout,e,i,n,s)}};function fG(t,e){switch(e.normalType){case Br.Attribute:case Br.Compressed:t.include(c6,e),t.varyings.add("vNormalWorld","vec3"),t.varyings.add("vNormalView","vec3"),t.vertex.uniforms.add(new FL("transformNormalGlobalFromModel",i=>i.transformNormalGlobalFromModel),new Km("transformNormalViewFromGlobal",i=>i.transformNormalViewFromGlobal)),t.vertex.code.add(V`void forwardNormal() { vNormalWorld = transformNormalGlobalFromModel * normalModel(); vNormalView = transformNormalViewFromGlobal * vNormalWorld; -}`);break;case Br.Ground:t.include(gO,e),t.varyings.add("vNormalWorld","vec3"),t.vertex.code.add(V` +}`);break;case Br.Ground:t.include(SO,e),t.varyings.add("vNormalWorld","vec3"),t.vertex.code.add(V` void forwardNormal() { vNormalWorld = ${e.spherical?V`normalize(vPositionWorldCameraRelative);`:V`vec3(0.0, 0.0, 1.0);`} } - `);break;case Br.ScreenDerivative:t.vertex.code.add(V`void forwardNormal() {}`);break;default:e.normalType;case Br.COUNT:}}let G6e=class extends Z$e{constructor(){super(...arguments),this.transformNormalViewFromGlobal=as()}},H6e=class extends J$e{constructor(){super(...arguments),this.transformNormalGlobalFromModel=as(),this.toMapSpace=Xi()}};const Cle={func:Zr.LESS},BU={func:Zr.ALWAYS},Jy={mask:255},q6e={mask:0},m3t=t=>({function:{func:Zr.NOTEQUAL,ref:t,mask:t},operation:{fail:bs.KEEP,zFail:bs.KEEP,zPass:bs.KEEP}}),g3t=t=>({function:{func:Zr.ALWAYS,ref:t,mask:t},operation:{fail:bs.KEEP,zFail:bs.KEEP,zPass:bs.REPLACE}}),fx={function:{func:Zr.ALWAYS,ref:Zu.OutlineVisualElementMask,mask:Zu.OutlineVisualElementMask},operation:{fail:bs.KEEP,zFail:bs.KEEP,zPass:bs.ZERO}},Z2={function:{func:Zr.ALWAYS,ref:Zu.OutlineVisualElementMask,mask:Zu.OutlineVisualElementMask},operation:{fail:bs.KEEP,zFail:bs.KEEP,zPass:bs.REPLACE}},W6e={function:{func:Zr.EQUAL,ref:Zu.OutlineVisualElementMask,mask:Zu.OutlineVisualElementMask},operation:{fail:bs.KEEP,zFail:bs.KEEP,zPass:bs.KEEP}},Y6e={function:{func:Zr.NOTEQUAL,ref:Zu.OutlineVisualElementMask,mask:Zu.OutlineVisualElementMask},operation:{fail:bs.KEEP,zFail:bs.KEEP,zPass:bs.KEEP}};function X6e({normalTexture:t,metallicRoughnessTexture:e,metallicFactor:i,roughnessFactor:r,emissiveTexture:n,emissiveFactor:s,occlusionTexture:o}){return t==null&&e==null&&n==null&&(s==null||jr(s,Ka))&&o==null&&(r==null||r===1)&&(i==null||i===1||i===0)}const sG=[1,1,.5],Ale=[0,.6,.2],y3t=[0,1,.2];function Z6e(t){t.vertex.code.add(V`vec4 offsetBackfacingClipPosition(vec4 posClip, vec3 posWorld, vec3 normalWorld, vec3 camPosWorld) { + `);break;case Br.ScreenDerivative:t.vertex.code.add(V`void forwardNormal() {}`);break;default:e.normalType;case Br.COUNT:}}let U6e=class extends q$e{constructor(){super(...arguments),this.transformNormalViewFromGlobal=as()}},V6e=class extends W$e{constructor(){super(...arguments),this.transformNormalGlobalFromModel=as(),this.toMapSpace=Xi()}};const zle={func:Zr.LESS},jU={func:Zr.ALWAYS},n1={mask:255},B6e={mask:0},fxt=t=>({function:{func:Zr.NOTEQUAL,ref:t,mask:t},operation:{fail:ws.KEEP,zFail:ws.KEEP,zPass:ws.KEEP}}),mxt=t=>({function:{func:Zr.ALWAYS,ref:t,mask:t},operation:{fail:ws.KEEP,zFail:ws.KEEP,zPass:ws.REPLACE}}),bx={function:{func:Zr.ALWAYS,ref:Ku.OutlineVisualElementMask,mask:Ku.OutlineVisualElementMask},operation:{fail:ws.KEEP,zFail:ws.KEEP,zPass:ws.ZERO}},tx={function:{func:Zr.ALWAYS,ref:Ku.OutlineVisualElementMask,mask:Ku.OutlineVisualElementMask},operation:{fail:ws.KEEP,zFail:ws.KEEP,zPass:ws.REPLACE}},j6e={function:{func:Zr.EQUAL,ref:Ku.OutlineVisualElementMask,mask:Ku.OutlineVisualElementMask},operation:{fail:ws.KEEP,zFail:ws.KEEP,zPass:ws.KEEP}},G6e={function:{func:Zr.NOTEQUAL,ref:Ku.OutlineVisualElementMask,mask:Ku.OutlineVisualElementMask},operation:{fail:ws.KEEP,zFail:ws.KEEP,zPass:ws.KEEP}};function H6e({normalTexture:t,metallicRoughnessTexture:e,metallicFactor:i,roughnessFactor:r,emissiveTexture:n,emissiveFactor:s,occlusionTexture:o}){return t==null&&e==null&&n==null&&(s==null||jr(s,el))&&o==null&&(r==null||r===1)&&(i==null||i===1||i===0)}const mG=[1,1,.5],Ule=[0,.6,.2],gxt=[0,1,.2];function q6e(t){t.vertex.code.add(V`vec4 offsetBackfacingClipPosition(vec4 posClip, vec3 posWorld, vec3 normalWorld, vec3 camPosWorld) { vec3 camToVert = posWorld - camPosWorld; bool isBackface = dot(camToVert, normalWorld) > 0.0; if (isBackface) { posClip.z += 0.0000003 * posClip.w; } return posClip; -}`)}function J6e(t){t.vertex.code.add(V` +}`)}function W6e(t){t.vertex.code.add(V` vec4 decodeSymbolColor(vec4 symbolColor, out int colorMixMode) { float symbolAlpha = 0.0; @@ -1745,30 +1734,30 @@ return posClip; const float scaleAlpha = 3.0; if (symbolColor.a > maxReplace) { - colorMixMode = ${V.int(Uo.Multiply)}; + colorMixMode = ${V.int(Vo.Multiply)}; symbolAlpha = scaleAlpha * (symbolColor.a - maxReplace); } else if (symbolColor.a > maxTint) { - colorMixMode = ${V.int(Uo.Replace)}; + colorMixMode = ${V.int(Vo.Replace)}; symbolAlpha = scaleAlpha * (symbolColor.a - maxTint); } else if (symbolColor.a > 0.0) { - colorMixMode = ${V.int(Uo.Tint)}; + colorMixMode = ${V.int(Vo.Tint)}; symbolAlpha = scaleAlpha * symbolColor.a; } else { - colorMixMode = ${V.int(Uo.Multiply)}; + colorMixMode = ${V.int(Vo.Multiply)}; symbolAlpha = 0.0; } return vec4(symbolColor.r, symbolColor.g, symbolColor.b, symbolAlpha); } - `)}let s6=class extends Ls{constructor(e,i){super(e,"int",Or.Pass,(r,n,s)=>r.setUniform1i(e,i(n,s)))}};function K6e(t,e){e.hasSymbolColors?(t.include(J6e),t.attributes.add(J.SYMBOLCOLOR,"vec4"),t.varyings.add("colorMixMode","mediump float"),t.vertex.code.add(V`int symbolColorMixMode; + `)}let u6=class extends Ds{constructor(e,i){super(e,"int",Pr.Pass,(r,n,s)=>r.setUniform1i(e,i(n,s)))}};function Y6e(t,e){e.hasSymbolColors?(t.include(W6e),t.attributes.add(J.SYMBOLCOLOR,"vec4"),t.varyings.add("colorMixMode","mediump float"),t.vertex.code.add(V`int symbolColorMixMode; vec4 getSymbolColor() { return decodeSymbolColor(symbolColor, symbolColorMixMode) * 0.003921568627451; } void forwardColorMixMode() { colorMixMode = float(symbolColorMixMode) + 0.5; -}`)):(t.fragment.uniforms.add(new s6("colorMixMode",i=>J9e[i.colorMixMode])),t.vertex.code.add(V`vec4 getSymbolColor() { return vec4(1.0); } -void forwardColorMixMode() {}`))}function ME(t,e){e.hasVertexColors?(t.attributes.add(J.COLOR,"vec4"),t.varyings.add("vColor","vec4"),t.vertex.code.add(V`void forwardVertexColor() { vColor = color; }`),t.vertex.code.add(V`void forwardNormalizedVertexColor() { vColor = color * 0.003921568627451; }`)):t.vertex.code.add(V`void forwardVertexColor() {} -void forwardNormalizedVertexColor() {}`)}function Q6e(t){t.code.add(V`const float MAX_RGBA4_FLOAT = +}`)):(t.fragment.uniforms.add(new u6("colorMixMode",i=>W9e[i.colorMixMode])),t.vertex.code.add(V`vec4 getSymbolColor() { return vec4(1.0); } +void forwardColorMixMode() {}`))}function LE(t,e){e.hasVertexColors?(t.attributes.add(J.COLOR,"vec4"),t.varyings.add("vColor","vec4"),t.vertex.code.add(V`void forwardVertexColor() { vColor = color; }`),t.vertex.code.add(V`void forwardNormalizedVertexColor() { vColor = color * 0.003921568627451; }`)):t.vertex.code.add(V`void forwardVertexColor() {} +void forwardNormalizedVertexColor() {}`)}function X6e(t){t.code.add(V`const float MAX_RGBA4_FLOAT = 15.0 / 16.0 + 15.0 / 16.0 / 16.0 + 15.0 / 16.0 / 16.0 / 16.0 + @@ -1788,7 +1777,7 @@ const vec4 RGBA4_2_FLOAT_FACTORS = vec4( ); float rgba4ToFloat(vec4 rgba) { return dot(rgba, RGBA4_2_FLOAT_FACTORS); -}`)}function E_(t,e){switch(e.output){case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:t.fragment.include(Q6e),t.fragment.code.add(V`float _calculateFragDepth(const in float depth) { +}`)}function I_(t,e){switch(e.output){case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:t.fragment.include(X6e),t.fragment.code.add(V`float _calculateFragDepth(const in float depth) { const float SLOPE_SCALE = 2.0; const float BIAS = 20.0 * .000015259; float m = max(abs(dFdx(depth)), abs(dFdy(depth))); @@ -1796,20 +1785,20 @@ return depth + SLOPE_SCALE * m + BIAS; } void outputDepth(float _linearDepth) { fragColor = floatToRgba4(_calculateFragDepth(_linearDepth)); -}`);break;case ue.Depth:t.fragment.include(o0),t.fragment.code.add(V`void outputDepth(float _linearDepth) { +}`);break;case ue.Depth:t.fragment.include(c0),t.fragment.code.add(V`void outputDepth(float _linearDepth) { fragColor = float2rgba(_linearDepth); -}`)}}function v3t(t){t.fragment.code.add(V` - #define discardOrAdjustAlpha(color) { if (color.a < ${V.float(Cl)}) { discard; } } - `)}let bT=class extends Ls{constructor(e,i){super(e,"float",Or.Draw,(r,n,s)=>r.setUniform1f(e,i(n,s)))}};function wT(t,e){eDe(t,e,new ft("textureAlphaCutoff",i=>i.textureAlphaCutoff))}function _3t(t,e){eDe(t,e,new bT("textureAlphaCutoff",i=>i.textureAlphaCutoff))}function eDe(t,e,i){const r=t.fragment;switch(e.alphaDiscardMode!==mn.Mask&&e.alphaDiscardMode!==mn.MaskBlend||r.uniforms.add(i),e.alphaDiscardMode){case mn.Blend:return t.include(v3t);case mn.Opaque:r.code.add(V`void discardOrAdjustAlpha(inout vec4 color) { +}`)}}function yxt(t){t.fragment.code.add(V` + #define discardOrAdjustAlpha(color) { if (color.a < ${V.float(Ml)}) { discard; } } + `)}let AT=class extends Ds{constructor(e,i){super(e,"float",Pr.Draw,(r,n,s)=>r.setUniform1f(e,i(n,s)))}};function MT(t,e){Z6e(t,e,new ft("textureAlphaCutoff",i=>i.textureAlphaCutoff))}function vxt(t,e){Z6e(t,e,new AT("textureAlphaCutoff",i=>i.textureAlphaCutoff))}function Z6e(t,e,i){const r=t.fragment;switch(e.alphaDiscardMode!==yn.Mask&&e.alphaDiscardMode!==yn.MaskBlend||r.uniforms.add(i),e.alphaDiscardMode){case yn.Blend:return t.include(yxt);case yn.Opaque:r.code.add(V`void discardOrAdjustAlpha(inout vec4 color) { color.a = 1.0; -}`);break;case mn.Mask:r.code.add(V`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } else { color.a = 1.0; } }`);break;case mn.MaskBlend:t.fragment.code.add(V`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } }`)}}function tDe(t,e){const{vertex:i,fragment:r}=t,n=e.hasColorTexture&&e.alphaDiscardMode!==mn.Opaque;switch(e.output){case ue.Depth:case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:case ue.ObjectAndLayerIdColor:Kh(i,e),t.include(Yu,e),t.include(My,e),t.include(e_,e),t.include(E_,e),t.include(oo,e),t.include(e6,e),XT(t),t.varyings.add("depth","float"),n&&r.uniforms.add(new Zt("tex",s=>s.texture)),i.code.add(V`void main(void) { +}`);break;case yn.Mask:r.code.add(V`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } else { color.a = 1.0; } }`);break;case yn.MaskBlend:t.fragment.code.add(V`#define discardOrAdjustAlpha(color) { if (color.a < textureAlphaCutoff) { discard; } }`)}}function J6e(t,e){const{vertex:i,fragment:r}=t,n=e.hasColorTexture&&e.alphaDiscardMode!==yn.Opaque;switch(e.output){case ue.Depth:case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:case ue.ObjectAndLayerIdColor:td(i,e),t.include(Zu,e),t.include(Ly,e),t.include(a_,e),t.include(I_,e),t.include(ao,e),t.include(s6,e),eE(t),t.varyings.add("depth","float"),n&&r.uniforms.add(new Zt("tex",s=>s.texture)),i.code.add(V`void main(void) { vpos = getVertexInLocalOriginSpace(); vpos = subtractOrigin(vpos); vpos = addVerticalOffset(vpos, localOrigin); gl_Position = transformPositionWithDepth(proj, view, vpos, nearFar, depth); forwardTextureCoordinates(); forwardObjectAndLayerIdColor(); -}`),t.include(wT,e),r.code.add(V` +}`),t.include(MT,e),r.code.add(V` void main(void) { discardBySlice(vpos); ${n?V` @@ -1817,7 +1806,7 @@ forwardObjectAndLayerIdColor(); discardOrAdjustAlpha(texColor);`:""} ${e.output===ue.ObjectAndLayerIdColor?V`outputObjectAndLayerIdColor();`:V`outputDepth(depth);`} } - `);break;case ue.Normal:{Kh(i,e),t.include(Yu,e),t.include(n6,e),t.include(nG,e),t.include(My,e),t.include(e_,e),n&&r.uniforms.add(new Zt("tex",o=>o.texture)),e.normalType===Br.ScreenDerivative&&t.varyings.add("vPositionView","vec3");const s=e.normalType===Br.Attribute||e.normalType===Br.Compressed;i.code.add(V` + `);break;case ue.Normal:{td(i,e),t.include(Zu,e),t.include(c6,e),t.include(fG,e),t.include(Ly,e),t.include(a_,e),n&&r.uniforms.add(new Zt("tex",o=>o.texture)),e.normalType===Br.ScreenDerivative&&t.varyings.add("vPositionView","vec3");const s=e.normalType===Br.Attribute||e.normalType===Br.Compressed;i.code.add(V` void main(void) { vpos = getVertexInLocalOriginSpace(); @@ -1830,7 +1819,7 @@ forwardObjectAndLayerIdColor(); gl_Position = transformPosition(proj, view, vpos); forwardTextureCoordinates(); } - `),t.include(oo,e),t.include(wT,e),r.code.add(V` + `),t.include(ao,e),t.include(MT,e),r.code.add(V` void main() { discardBySlice(vpos); ${n?V` @@ -1844,13 +1833,13 @@ forwardObjectAndLayerIdColor(); }`} fragColor = vec4(0.5 + 0.5 * normal, 1.0); } - `);break}case ue.Highlight:Kh(i,e),t.include(Yu,e),t.include(My,e),t.include(e_,e),n&&r.uniforms.add(new Zt("tex",s=>s.texture)),i.code.add(V`void main(void) { + `);break}case ue.Highlight:td(i,e),t.include(Zu,e),t.include(Ly,e),t.include(a_,e),n&&r.uniforms.add(new Zt("tex",s=>s.texture)),i.code.add(V`void main(void) { vpos = getVertexInLocalOriginSpace(); vpos = subtractOrigin(vpos); vpos = addVerticalOffset(vpos, localOrigin); gl_Position = transformPosition(proj, view, vpos); forwardTextureCoordinates(); -}`),t.include(oo,e),t.include(wT,e),t.include(dx,e),r.code.add(V` +}`),t.include(ao,e),t.include(MT,e),t.include(vx,e),r.code.add(V` void main() { discardBySlice(vpos); ${n?V` @@ -1858,7 +1847,7 @@ forwardTextureCoordinates(); discardOrAdjustAlpha(texColor);`:""} outputHighlight(); } - `)}}function iDe(t,e){const i=t.fragment;e.hasVertexTangents?(t.attributes.add(J.TANGENT,"vec4"),t.varyings.add("vTangent","vec4"),e.doubleSidedMode===Is.WindingOrder?i.code.add(V`mat3 computeTangentSpace(vec3 normal) { + `)}}function K6e(t,e){const i=t.fragment;e.hasVertexTangents?(t.attributes.add(J.TANGENT,"vec4"),t.varyings.add("vTangent","vec4"),e.doubleSidedMode===Ls.WindingOrder?i.code.add(V`mat3 computeTangentSpace(vec3 normal) { float tangentHeadedness = gl_FrontFacing ? vTangent.w : -vTangent.w; vec3 tangent = normalize(gl_FrontFacing ? vTangent.xyz : -vTangent.xyz); vec3 bitangent = cross(normal, tangent) * tangentHeadedness; @@ -1879,10 +1868,10 @@ T = T - normal * dot(normal, T); T *= inversesqrt(max(dot(T,T), 1.e-10)); vec3 B = sign(det) * cross(normal, T); return mat3(T, B, normal); -}`),e.textureCoordinateType!==So.None&&(t.include(bae,e),i.uniforms.add(e.pbrTextureBindType===Or.Pass?new Zt("normalTexture",r=>r.textureNormal):new $f("normalTexture",r=>r.textureNormal)),i.code.add(V`vec3 computeTextureNormal(mat3 tangentSpace, vec2 uv) { +}`),e.textureCoordinateType!==To.None&&(t.include($ae,e),i.uniforms.add(e.pbrTextureBindType===Pr.Pass?new Zt("normalTexture",r=>r.textureNormal):new kf("normalTexture",r=>r.textureNormal)),i.code.add(V`vec3 computeTextureNormal(mat3 tangentSpace, vec2 uv) { vec3 rawNormal = textureLookup(normalTexture, uv).rgb * 2.0 - 1.0; return tangentSpace * rawNormal; -}`))}let rDe=class extends Ls{constructor(e,i){super(e,"vec2",Or.Draw,(r,n,s,o)=>r.setUniform2fv(e,i(n,s,o)))}};const hW=4;function nDe(){const t=new Cr,e=t.fragment;t.include(Pc);const i=(hW+1)/2,r=1/(2*i*i);return e.include(Kf),e.uniforms.add(new Zt("depthMap",n=>n.depthTexture),new $f("tex",n=>n.colorTexture),new rDe("blurSize",n=>n.blurSize),new ft("projScale",(n,s)=>{const o=Sn(s.camera.eye,s.camera.center);return o>5e4?Math.max(0,n.projScale-(o-5e4)):n.projScale}),new ln("nearFar",(n,s)=>s.camera.nearFar)),e.code.add(V` +}`))}let Q6e=class extends Ds{constructor(e,i){super(e,"vec2",Pr.Draw,(r,n,s,o)=>r.setUniform2fv(e,i(n,s,o)))}};const wW=4;function eDe(){const t=new Ar,e=t.fragment;t.include($c);const i=(wW+1)/2,r=1/(2*i*i);return e.include(i0),e.uniforms.add(new Zt("depthMap",n=>n.depthTexture),new kf("tex",n=>n.colorTexture),new Q6e("blurSize",n=>n.blurSize),new ft("projScale",(n,s)=>{const o=Tn(s.camera.eye,s.camera.center);return o>5e4?Math.max(0,n.projScale-(o-5e4)):n.projScale}),new cn("nearFar",(n,s)=>s.camera.nearFar)),e.code.add(V` void blurFunction(vec2 uv, float r, float center_d, float sharpness, inout float wTotal, inout float bTotal) { float c = texture(tex, uv).r; float d = linearDepthFromTexture(depthMap, uv, nearFar); @@ -1901,7 +1890,7 @@ return tangentSpace * rawNormal; float center_d = linearDepthFromTexture(depthMap, uv, nearFar); float sharpness = -0.05 * projScale / center_d; - for (int r = -${V.int(hW)}; r <= ${V.int(hW)}; ++r) { + for (int r = -${V.int(wW)}; r <= ${V.int(wW)}; ++r) { float rf = float(r); vec2 uvOffset = uv + rf * blurSize; blurFunction(uvOffset, rf, center_d, sharpness, w_total, b); @@ -1909,9 +1898,9 @@ return tangentSpace * rawNormal; fragBlur = b / w_total; } - `),t}const b3t=Object.freeze(Object.defineProperty({__proto__:null,build:nDe},Symbol.toStringTag,{value:"Module"}));let sDe=class oDe extends Hr{initializeProgram(e){return new Ir(e.rctx,oDe.shader.get().build(),Er)}initializePipeline(){return Ti({colorWrite:ji})}};sDe.shader=new Rr(b3t,()=>we(()=>Promise.resolve().then(()=>xWt),void 0));const w3t="eXKEvZaUc66cjIKElE1jlJ6MjJ6Ufkl+jn2fcXp5jBx7c6KEflSGiXuXeW6OWs+tfqZ2Yot2Y7Zzfo2BhniEj3xoiXuXj4eGZpqEaHKDWjSMe7palFlzc3BziYOGlFVzg6Zzg7CUY5JrjFF7eYJ4jIKEcyyEonSXe7qUfqZ7j3xofqZ2c4R5lFZ5Y0WUbppoe1l2cIh2ezyUho+BcHN2cG6DbpqJhqp2e1GcezhrdldzjFGUcyxjc3aRjDyEc1h7Sl17c6aMjH92pb6Mjpd4dnqBjMOEhqZleIOBYzB7gYx+fnqGjJuEkWlwnCx7fGl+c4hjfGyRe5qMlNOMfnqGhIWHc6OMi4GDc6aMfqZuc6aMzqJzlKZ+lJ6Me3qRfoFue0WUhoR5UraEa6qMkXiPjMOMlJOGe7JrUqKMjK6MeYRzdod+Sl17boiPc6qEeYBlcIh2c1WEe7GDiWCDa0WMjEmMdod+Y0WcdntzhmN8WjyMjKJjiXtzgYxYaGd+a89zlEV7e2GJfnd+lF1rcK5zc4p5cHuBhL6EcXp5eYB7fnh8iX6HjIKEeaxuiYOGc66RfG2Ja5hzjlGMjEmMe9OEgXuPfHyGhPeEdl6JY02McGuMfnqGhFiMa3WJfnx2l4hwcG1uhmN8c0WMc39og1GBbrCEjE2EZY+JcIh2cIuGhIWHe0mEhIVrc09+gY5+eYBlnCyMhGCDl3drfmmMgX15aGd+gYx+fnuRfnhzY1SMsluJfnd+hm98WtNrcIuGh4SEj0qPdkqOjFF7jNNjdnqBgaqUjMt7boeBhnZ4jDR7c5pze4GGjEFrhLqMjHyMc0mUhKZze4WEa117kWlwbpqJjHZ2eX2Bc09zeId+e0V7WlF7jHJ2l72BfId8l3eBgXyBe897jGl7c66cgW+Xc76EjKNbgaSEjGx4fId8jFFjgZB8cG6DhlFziZhrcIh2fH6HgUqBgXiPY8dahGFzjEmMhEFre2dxhoBzc5SGfleGe6alc7aUeYBlhKqUdlp+cH5za4OEczxza0Gcc4J2jHZ5iXuXjH2Jh5yRjH2JcFx+hImBjH+MpddCl3dreZeJjIt8ZW18bm1zjoSEeIOBlF9oh3N7hlqBY4+UeYFwhLJjeYFwaGd+gUqBYxiEYot2fqZ2ondzhL6EYyiEY02Ea0VjgZB8doaGjHxoc66cjEGEiXuXiXWMiZhreHx8frGMe75rY02Ec5pzfnhzlEp4a3VzjM+EhFFza3mUY7Zza1V5e2iMfGyRcziEhDyEkXZ2Y4OBnCx7g5t2eyBjgV6EhEFrcIh2dod+c4Z+nJ5zjm15jEmUeYxijJp7nL6clIpjhoR5WrZraGd+fnuRa6pzlIiMg6ZzfHx5foh+eX1ufnB5eX1ufnB5aJt7UqKMjIh+e3aBfm5lbYSBhGFze6J4c39oc0mUc4Z+e0V7fKFVe0WEdoaGY02Ec4Z+Y02EZYWBfH6HgU1+gY5+hIWUgW+XjJ57ebWRhFVScHuBfJ6PhBx7WqJzlM+Ujpd4gHZziX6HjHmEgZN+lJt5boiPe2GJgX+GjIGJgHZzeaxufnB5hF2JtdN7jJ57hp57hK6ElFVzg6ZzbmiEbndzhIWHe3uJfoFue3qRhJd2j3xoc65zlE1jc3p8lE1jhniEgXJ7e657vZaUc3qBh52BhIF4aHKDa9drgY5+c52GWqZzbpqJe8tjnM+UhIeMfo2BfGl+hG1zSmmMjKJjZVaGgX15c1lze0mEp4OHa3mUhIWHhDyclJ6MeYOJkXiPc0VzhFiMlKaEboSJa5Jze41re3qRhn+HZYWBe0mEc4p5fnORbox5lEp4hGFjhGGEjJuEc1WEhLZjeHeGa7KlfHx2hLaMeX1ugY5+hIWHhKGPjMN7c1WEho1zhoBzZYx7fnhzlJt5exyUhFFziXtzfmmMa6qMYyiEiXxweV12kZSMeWqXSl17fnhzxmmMrVGEe1mcc4p5eHeGjK6MgY5+doaGa6pzlGV7g1qBh4KHkXiPeW6OaKqafqZ2eXZ5e1V7jGd7boSJc3BzhJd2e0mcYot2h1RoY8dahK6EQmWEWjx7e1l2lL6UgXyBdnR4eU9zc0VreX1umqaBhld7fo2Bc6KEc5Z+hDyEcIeBWtNrfHyGe5qMhMuMe5qMhEGEbVVupcNzg3aHhIF4boeBe0mEdlptc39ofFl5Y8uUlJOGiYt2UmGEcyxjjGx4jFF7a657ZYWBnElzhp57iXtrgZN+tfOEhIOBjE2HgU1+e8tjjKNbiWCDhE15gUqBgYN7fnqGc66ce9d7iYSBj0qPcG6DnGGcT3eGa6qMZY+JlIiMl4hwc3aRdnqBlGV7eHJ2hLZjfnuRhDyEeX6MSk17g6Z+c6aUjHmEhIF4gXyBc76EZW18fGl+fkl+jCxrhoVwhDyUhIqGlL2DlI6EhJd2tdN7eYORhEGMa2Faa6pzc3Bzc4R5lIRznM+UY9eMhDycc5Z+c4p5c4iGY117pb6MgXuPrbJafnx2eYOJeXZ5e657hDyEcziElKZjfoB5eHeGj4WRhGGEe6KGeX1utTStc76EhFGJnCyMa5hzfH6HnNeceYB7hmN8gYuMhIVrczSMgYF8h3N7c5pza5hzjJqEYIRdgYuMlL2DeYRzhGGEeX1uhLaEc4iGeZ1zdl6JhrVteX6Me2iMfm5lWqJzSpqEa6pzdnmchHx2c6OMhNdrhoR5g3aHczxzeW52gV6Ejm15frGMc0Vzc4Z+l3drfniJe+9rWq5rlF1rhGGEhoVwe9OEfoh+e7pac09+c3qBY0lrhDycdnp2lJ6MiYOGhGCDc3aRlL2DlJt5doaGdnp2gYF8gWeOjF2Uc4R5c5Z+jEmMe7KEc4mEeYJ4dmyBe0mcgXiPbqJ7eYB7fmGGiYSJjICGlF1reZ2PnElzbpqJfH6Hc39oe4WEc5eJhK6EhqyJc3qBgZB8c09+hEmEaHKDhFGJc5SGiXWMUpaEa89zc6OMnCyMiXtrho+Be5qMc7KEjJ57dmN+hKGPjICGbmiEe7prdod+hGCDdnmchBx7eX6MkXZ2hGGEa657hm98jFFjY5JreYOJgY2EjHZ2a295Y3FajJ6Mc1J+YzB7e4WBjF2Uc4R5eV12gYxzg1qBeId+c9OUc5pzjFFjgY5+hFiMlIaPhoR5lIpjjIKBlNdSe7KEeX2BfrGMhIqGc65zjE2UhK6EklZ+QmWEeziMWqZza3VzdnR4foh+gYF8n3iJiZhrnKp7gYF8eId+lJ6Me1lrcIuGjKJjhmN8c66MjFF7a6prjJ6UnJ5zezyUfruRWlF7nI5zfHyGe657h4SEe8tjhBx7jFFjc09+c39ojICMeZeJeXt+YzRzjHZ2c0WEcIeBeXZ5onSXkVR+gYJ+eYFwdldzgYF7eX2BjJ6UiXuXlE1jh4SEe1mchLJjc4Z+hqZ7eXZ5bm1zlL6Ue5p7iWeGhKqUY5pzjKJjcIeBe8t7gXyBYIRdlEp4a3mGnK6EfmmMZpqEfFl5gYxzjKZuhGFjhoKGhHx2fnx2eXuMe3aBiWeGvbKMe6KGa5hzYzB7gZOBlGV7hmN8hqZlYot2Y117a6pzc6KEfId8foB5rctrfneJfJ6PcHN2hFiMc5pzjH92c0VzgY2EcElzdmCBlFVzg1GBc65zY4OBboeBcHiBeYJ4ewxzfHx5lIRzlEmEnLKEbk1zfJ6PhmN8eYBljBiEnMOEiXxwezyUcIeBe76EdsKEeX2BdnR4jGWUrXWMjGd7fkl+j4WRlEGMa5Jzho+BhDyEfnqMeXt+g3aHlE1jczClhNN7ZW18eHx8hGFjZW18iXWMjKJjhH57gYuMcIuGWjyMe4ZtjJuExmmMj4WRdntzi4GDhFFzYIRdnGGcjJp7Y0F7e4WEkbCGiX57fnSHa657a6prhBCMe3Z+SmmMjH92eHJ2hK6EY1FzexhrvbKMnI5za4OEfnd+eXuMhImBe897hLaMjN+EfG+BeIOBhF1+eZeJi4GDkXZ2eXKEgZ6Ejpd4c2GHa1V5e5KUfqZuhCx7jKp7lLZrg11+hHx2hFWUoot2nI5zgbh5mo9zvZaUe3qRbqKMfqZ2kbCGhFiM";let x3t=class extends _n{constructor(){super(...arguments),this.projScale=1}},S3t=class extends x3t{constructor(){super(...arguments),this.intensity=1}},T3t=class extends _n{},E3t=class extends T3t{constructor(){super(...arguments),this.blurSize=yt()}};function oG(t){t.fragment.uniforms.add(new gr("projInfo",(e,i)=>C3t(i))),t.fragment.uniforms.add(new ln("zScale",(e,i)=>A3t(i))),t.fragment.code.add(V`vec3 reconstructPosition(vec2 fragCoord, float depth) { + `),t}const _xt=Object.freeze(Object.defineProperty({__proto__:null,build:eDe},Symbol.toStringTag,{value:"Module"}));let tDe=class iDe extends Hr{initializeProgram(e){return new $r(e.rctx,iDe.shader.get().build(),Cr)}initializePipeline(){return Ti({colorWrite:ji})}};tDe.shader=new Ir(_xt,()=>we(()=>Promise.resolve().then(()=>nXt),void 0));const bxt="eXKEvZaUc66cjIKElE1jlJ6MjJ6Ufkl+jn2fcXp5jBx7c6KEflSGiXuXeW6OWs+tfqZ2Yot2Y7Zzfo2BhniEj3xoiXuXj4eGZpqEaHKDWjSMe7palFlzc3BziYOGlFVzg6Zzg7CUY5JrjFF7eYJ4jIKEcyyEonSXe7qUfqZ7j3xofqZ2c4R5lFZ5Y0WUbppoe1l2cIh2ezyUho+BcHN2cG6DbpqJhqp2e1GcezhrdldzjFGUcyxjc3aRjDyEc1h7Sl17c6aMjH92pb6Mjpd4dnqBjMOEhqZleIOBYzB7gYx+fnqGjJuEkWlwnCx7fGl+c4hjfGyRe5qMlNOMfnqGhIWHc6OMi4GDc6aMfqZuc6aMzqJzlKZ+lJ6Me3qRfoFue0WUhoR5UraEa6qMkXiPjMOMlJOGe7JrUqKMjK6MeYRzdod+Sl17boiPc6qEeYBlcIh2c1WEe7GDiWCDa0WMjEmMdod+Y0WcdntzhmN8WjyMjKJjiXtzgYxYaGd+a89zlEV7e2GJfnd+lF1rcK5zc4p5cHuBhL6EcXp5eYB7fnh8iX6HjIKEeaxuiYOGc66RfG2Ja5hzjlGMjEmMe9OEgXuPfHyGhPeEdl6JY02McGuMfnqGhFiMa3WJfnx2l4hwcG1uhmN8c0WMc39og1GBbrCEjE2EZY+JcIh2cIuGhIWHe0mEhIVrc09+gY5+eYBlnCyMhGCDl3drfmmMgX15aGd+gYx+fnuRfnhzY1SMsluJfnd+hm98WtNrcIuGh4SEj0qPdkqOjFF7jNNjdnqBgaqUjMt7boeBhnZ4jDR7c5pze4GGjEFrhLqMjHyMc0mUhKZze4WEa117kWlwbpqJjHZ2eX2Bc09zeId+e0V7WlF7jHJ2l72BfId8l3eBgXyBe897jGl7c66cgW+Xc76EjKNbgaSEjGx4fId8jFFjgZB8cG6DhlFziZhrcIh2fH6HgUqBgXiPY8dahGFzjEmMhEFre2dxhoBzc5SGfleGe6alc7aUeYBlhKqUdlp+cH5za4OEczxza0Gcc4J2jHZ5iXuXjH2Jh5yRjH2JcFx+hImBjH+MpddCl3dreZeJjIt8ZW18bm1zjoSEeIOBlF9oh3N7hlqBY4+UeYFwhLJjeYFwaGd+gUqBYxiEYot2fqZ2ondzhL6EYyiEY02Ea0VjgZB8doaGjHxoc66cjEGEiXuXiXWMiZhreHx8frGMe75rY02Ec5pzfnhzlEp4a3VzjM+EhFFza3mUY7Zza1V5e2iMfGyRcziEhDyEkXZ2Y4OBnCx7g5t2eyBjgV6EhEFrcIh2dod+c4Z+nJ5zjm15jEmUeYxijJp7nL6clIpjhoR5WrZraGd+fnuRa6pzlIiMg6ZzfHx5foh+eX1ufnB5eX1ufnB5aJt7UqKMjIh+e3aBfm5lbYSBhGFze6J4c39oc0mUc4Z+e0V7fKFVe0WEdoaGY02Ec4Z+Y02EZYWBfH6HgU1+gY5+hIWUgW+XjJ57ebWRhFVScHuBfJ6PhBx7WqJzlM+Ujpd4gHZziX6HjHmEgZN+lJt5boiPe2GJgX+GjIGJgHZzeaxufnB5hF2JtdN7jJ57hp57hK6ElFVzg6ZzbmiEbndzhIWHe3uJfoFue3qRhJd2j3xoc65zlE1jc3p8lE1jhniEgXJ7e657vZaUc3qBh52BhIF4aHKDa9drgY5+c52GWqZzbpqJe8tjnM+UhIeMfo2BfGl+hG1zSmmMjKJjZVaGgX15c1lze0mEp4OHa3mUhIWHhDyclJ6MeYOJkXiPc0VzhFiMlKaEboSJa5Jze41re3qRhn+HZYWBe0mEc4p5fnORbox5lEp4hGFjhGGEjJuEc1WEhLZjeHeGa7KlfHx2hLaMeX1ugY5+hIWHhKGPjMN7c1WEho1zhoBzZYx7fnhzlJt5exyUhFFziXtzfmmMa6qMYyiEiXxweV12kZSMeWqXSl17fnhzxmmMrVGEe1mcc4p5eHeGjK6MgY5+doaGa6pzlGV7g1qBh4KHkXiPeW6OaKqafqZ2eXZ5e1V7jGd7boSJc3BzhJd2e0mcYot2h1RoY8dahK6EQmWEWjx7e1l2lL6UgXyBdnR4eU9zc0VreX1umqaBhld7fo2Bc6KEc5Z+hDyEcIeBWtNrfHyGe5qMhMuMe5qMhEGEbVVupcNzg3aHhIF4boeBe0mEdlptc39ofFl5Y8uUlJOGiYt2UmGEcyxjjGx4jFF7a657ZYWBnElzhp57iXtrgZN+tfOEhIOBjE2HgU1+e8tjjKNbiWCDhE15gUqBgYN7fnqGc66ce9d7iYSBj0qPcG6DnGGcT3eGa6qMZY+JlIiMl4hwc3aRdnqBlGV7eHJ2hLZjfnuRhDyEeX6MSk17g6Z+c6aUjHmEhIF4gXyBc76EZW18fGl+fkl+jCxrhoVwhDyUhIqGlL2DlI6EhJd2tdN7eYORhEGMa2Faa6pzc3Bzc4R5lIRznM+UY9eMhDycc5Z+c4p5c4iGY117pb6MgXuPrbJafnx2eYOJeXZ5e657hDyEcziElKZjfoB5eHeGj4WRhGGEe6KGeX1utTStc76EhFGJnCyMa5hzfH6HnNeceYB7hmN8gYuMhIVrczSMgYF8h3N7c5pza5hzjJqEYIRdgYuMlL2DeYRzhGGEeX1uhLaEc4iGeZ1zdl6JhrVteX6Me2iMfm5lWqJzSpqEa6pzdnmchHx2c6OMhNdrhoR5g3aHczxzeW52gV6Ejm15frGMc0Vzc4Z+l3drfniJe+9rWq5rlF1rhGGEhoVwe9OEfoh+e7pac09+c3qBY0lrhDycdnp2lJ6MiYOGhGCDc3aRlL2DlJt5doaGdnp2gYF8gWeOjF2Uc4R5c5Z+jEmMe7KEc4mEeYJ4dmyBe0mcgXiPbqJ7eYB7fmGGiYSJjICGlF1reZ2PnElzbpqJfH6Hc39oe4WEc5eJhK6EhqyJc3qBgZB8c09+hEmEaHKDhFGJc5SGiXWMUpaEa89zc6OMnCyMiXtrho+Be5qMc7KEjJ57dmN+hKGPjICGbmiEe7prdod+hGCDdnmchBx7eX6MkXZ2hGGEa657hm98jFFjY5JreYOJgY2EjHZ2a295Y3FajJ6Mc1J+YzB7e4WBjF2Uc4R5eV12gYxzg1qBeId+c9OUc5pzjFFjgY5+hFiMlIaPhoR5lIpjjIKBlNdSe7KEeX2BfrGMhIqGc65zjE2UhK6EklZ+QmWEeziMWqZza3VzdnR4foh+gYF8n3iJiZhrnKp7gYF8eId+lJ6Me1lrcIuGjKJjhmN8c66MjFF7a6prjJ6UnJ5zezyUfruRWlF7nI5zfHyGe657h4SEe8tjhBx7jFFjc09+c39ojICMeZeJeXt+YzRzjHZ2c0WEcIeBeXZ5onSXkVR+gYJ+eYFwdldzgYF7eX2BjJ6UiXuXlE1jh4SEe1mchLJjc4Z+hqZ7eXZ5bm1zlL6Ue5p7iWeGhKqUY5pzjKJjcIeBe8t7gXyBYIRdlEp4a3mGnK6EfmmMZpqEfFl5gYxzjKZuhGFjhoKGhHx2fnx2eXuMe3aBiWeGvbKMe6KGa5hzYzB7gZOBlGV7hmN8hqZlYot2Y117a6pzc6KEfId8foB5rctrfneJfJ6PcHN2hFiMc5pzjH92c0VzgY2EcElzdmCBlFVzg1GBc65zY4OBboeBcHiBeYJ4ewxzfHx5lIRzlEmEnLKEbk1zfJ6PhmN8eYBljBiEnMOEiXxwezyUcIeBe76EdsKEeX2BdnR4jGWUrXWMjGd7fkl+j4WRlEGMa5Jzho+BhDyEfnqMeXt+g3aHlE1jczClhNN7ZW18eHx8hGFjZW18iXWMjKJjhH57gYuMcIuGWjyMe4ZtjJuExmmMj4WRdntzi4GDhFFzYIRdnGGcjJp7Y0F7e4WEkbCGiX57fnSHa657a6prhBCMe3Z+SmmMjH92eHJ2hK6EY1FzexhrvbKMnI5za4OEfnd+eXuMhImBe897hLaMjN+EfG+BeIOBhF1+eZeJi4GDkXZ2eXKEgZ6Ejpd4c2GHa1V5e5KUfqZuhCx7jKp7lLZrg11+hHx2hFWUoot2nI5zgbh5mo9zvZaUe3qRbqKMfqZ2kbCGhFiM";let wxt=class extends bn{constructor(){super(...arguments),this.projScale=1}},xxt=class extends wxt{constructor(){super(...arguments),this.intensity=1}},Sxt=class extends bn{},Txt=class extends Sxt{constructor(){super(...arguments),this.blurSize=yt()}};function gG(t){t.fragment.uniforms.add(new gr("projInfo",(e,i)=>Ext(i))),t.fragment.uniforms.add(new cn("zScale",(e,i)=>Cxt(i))),t.fragment.code.add(V`vec3 reconstructPosition(vec2 fragCoord, float depth) { return vec3((fragCoord * projInfo.xy + projInfo.zw) * (zScale.x * depth + zScale.y), depth); -}`)}function C3t(t){const e=t.camera.projectionMatrix;return e[11]===0?rs(Rye,2/(t.camera.fullWidth*e[0]),2/(t.camera.fullHeight*e[5]),(1+e[12])/e[0],(1+e[13])/e[5]):rs(Rye,-2/(t.camera.fullWidth*e[0]),-2/(t.camera.fullHeight*e[5]),(1-e[8])/e[0],(1-e[9])/e[5])}const Rye=Xi();function A3t(t){return t.camera.projectionMatrix[11]===0?or(Iye,0,1):or(Iye,1,0)}const Iye=yt(),$ye=16;function aDe(){const t=new Cr,e=t.fragment;return t.include(Pc),e.include(Kf),t.include(oG),e.uniforms.add(new ft("radius",(i,r)=>aG(r.camera))),e.code.add(V`vec3 sphere[16]; +}`)}function Ext(t){const e=t.camera.projectionMatrix;return e[11]===0?rs(Iye,2/(t.camera.fullWidth*e[0]),2/(t.camera.fullHeight*e[5]),(1+e[12])/e[0],(1+e[13])/e[5]):rs(Iye,-2/(t.camera.fullWidth*e[0]),-2/(t.camera.fullHeight*e[5]),(1-e[8])/e[0],(1-e[9])/e[5])}const Iye=Xi();function Cxt(t){return t.camera.projectionMatrix[11]===0?or($ye,0,1):or($ye,1,0)}const $ye=yt(),Lye=16;function rDe(){const t=new Ar,e=t.fragment;return t.include($c),e.include(i0),t.include(gG),e.uniforms.add(new ft("radius",(i,r)=>yG(r.camera))),e.code.add(V`vec3 sphere[16]; void fillSphere() { sphere[0] = vec3(0.186937, 0.0, 0.0); sphere[1] = vec3(0.700542, 0.0, 0.0); @@ -1938,7 +1927,7 @@ vec3 v = Q - C; float vv = dot(v, v); float vn = dot(normalize(v), n_C); return fallOffFunction(vv, vn, 0.1); -}`),e.uniforms.add(new ln("nearFar",(i,r)=>r.camera.nearFar),new Zt("normalMap",i=>i.normalTexture),new Zt("depthMap",i=>i.depthTexture),new ft("projScale",i=>i.projScale),new Zt("rnm",i=>i.noiseTexture),new ln("rnmScale",(i,r)=>or(Lye,r.camera.fullWidth/i.noiseTexture.descriptor.width,r.camera.fullHeight/i.noiseTexture.descriptor.height)),new ft("intensity",i=>i.intensity),new ln("screenSize",(i,r)=>or(Lye,r.camera.fullWidth,r.camera.fullHeight))),t.outputs.add("fragOcclusion","float"),e.code.add(V` +}`),e.uniforms.add(new cn("nearFar",(i,r)=>r.camera.nearFar),new Zt("normalMap",i=>i.normalTexture),new Zt("depthMap",i=>i.depthTexture),new ft("projScale",i=>i.projScale),new Zt("rnm",i=>i.noiseTexture),new cn("rnmScale",(i,r)=>or(Dye,r.camera.fullWidth/i.noiseTexture.descriptor.width,r.camera.fullHeight/i.noiseTexture.descriptor.height)),new ft("intensity",i=>i.intensity),new cn("screenSize",(i,r)=>or(Dye,r.camera.fullWidth,r.camera.fullHeight))),t.outputs.add("fragOcclusion","float"),e.code.add(V` void main(void) { fillSphere(); vec3 fres = normalize(2.0 * texture(rnm, uv * rnmScale).xyz - 1.0); @@ -1963,7 +1952,7 @@ return fallOffFunction(vv, vn, 0.1); // bug or deviation from CE somewhere else? float ps = projScale / (2.0 * currentPixelPos.z * zScale.x + zScale.y); - for(int i = 0; i < ${V.int($ye)}; ++i) { + for(int i = 0; i < ${V.int(Lye)}; ++i) { vec2 unitOffset = reflect(sphere[i], fres).xy; vec2 offset = vec2(-unitOffset * radius * ps); @@ -1989,21 +1978,21 @@ return fallOffFunction(vv, vn, 0.1); } // output the result - float A = max(1.0 - sum * intensity / float(${V.int($ye)}), 0.0); + float A = max(1.0 - sum * intensity / float(${V.int(Lye)}), 0.0); // Anti-tone map to reduce contrast and drag dark region farther: (x^0.2 + 1.2 * x^4) / 2.2 A = (pow(A, 0.2) + 1.2 * A*A*A*A) / 2.2; fragOcclusion = A; } - `),t}function aG(t){return Math.max(10,20*t.computeScreenPixelSizeAtDist(Math.abs(4*t.relativeElevation)))}const Lye=yt(),M3t=Object.freeze(Object.defineProperty({__proto__:null,build:aDe,getRadius:aG},Symbol.toStringTag,{value:"Module"}));let lDe=class cDe extends Hr{initializeProgram(e){return new Ir(e.rctx,cDe.shader.get().build(),Er)}initializePipeline(){return Ti({colorWrite:ji})}};lDe.shader=new Rr(M3t,()=>we(()=>Promise.resolve().then(()=>SWt),void 0));const cI=2;let uI=class extends CE{constructor(e){super(e),this._context=null,this._passParameters=new S3t,this._drawParameters=new E3t,this.produces=new Map([[ke.SSAO,()=>this._produces()]])}_produces(){return this._enableTime!=null&&this._context!=null}consumes(){return this._produces()?Fvt:Vj}initializeRenderContext(e){this._context=e,this.addHandles([_e(()=>{var i;return this.view.qualitySettings.ambientOcclusion||((i=this._context)==null?void 0:i.isFeatureEnabled(Zo.SSAO))},i=>i?this._enable():this._disable(),kt)])}uninitializeRenderContext(){this._disable(),this._context=null}_disable(){this._passParameters.noiseTexture=Kt(this._passParameters.noiseTexture),this._enableTime=null}destroy(){this._disable()}_enable(){var r;if(this._enableTime!=null||!this._context)return;const e=Uint8Array.from(atob(w3t),n=>n.charCodeAt(0)),i=new tn;i.wrapMode=Bi.CLAMP_TO_EDGE,i.pixelFormat=ci.RGB,i.wrapMode=Bi.REPEAT,i.hasMipmap=!0,i.width=32,i.height=32,this._passParameters.noiseTexture=new Ai(this._context.renderContext.rctx,i,e),this._ssaoTechnique==null&&(this._ssaoTechnique=this._context.techniqueRepository.acquire(lDe)),this._blurTechnique==null&&(this._blurTechnique=this._context.techniqueRepository.acquire(sDe)),this._enableTime=0,(r=this._context)==null||r.requestRender()}renderNode(e,i,r){var U,j;const n=e.bindParameters,s=(U=n.linearDepth)==null?void 0:U.colorTexture,o=(j=r==null?void 0:r.normal)==null?void 0:j.colorTexture;if(this._enableTime==null||this._context==null||s==null||!o)return;if(!this._ssaoTechnique.compiled||!this._blurTechnique.compiled)return this._enableTime=e.time,void this._context.requestRender();this._enableTime===0&&(this._enableTime=e.time);const l=e.rctx,c=n.camera,f=this.view.qualitySettings.fadeDuration,_=f>0?Math.min(f,e.time-this._enableTime)/f:1;this._passParameters.normalTexture=o,this._passParameters.depthTexture=s,this._passParameters.projScale=1/c.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*O3t/aG(c)**6*_;const x=c.fullViewport[2],T=c.fullViewport[3],A=Math.round(x/cI),M=Math.round(T/cI),I=this._context.fbos,L=I.acquire(xr.RED,x,T);l.bindFramebuffer(L.fbo),l.setViewport(0,0,x,T),l.bindTechnique(this._ssaoTechnique,this._passParameters,n).bindDraw(this._drawParameters,n,this._passParameters),l.screen.draw();const F=l.bindTechnique(this._blurTechnique,this._passParameters,n);l.setViewport(0,0,A,M);const z=I.acquire(xr.RED,A,M);l.bindFramebuffer(z.fbo),this._drawParameters.colorTexture=L.colorTexture,or(this._drawParameters.blurSize,0,cI/T),F.bindDraw(this._drawParameters,n,this._passParameters),l.setViewport(0,0,A,M),l.screen.draw(),L.release();const k=I.acquire(xr.RED,A,M);return l.bindFramebuffer(k.fbo),l.setViewport(0,0,x,T),l.setClearColor(1,1,1,0),l.clear(In.COLOR_BUFFER_BIT),l.setViewport(0,0,A,M),this._drawParameters.colorTexture=z.colorTexture,or(this._drawParameters.blurSize,cI/x,0),F.bindDraw(this._drawParameters,n,this._passParameters),l.screen.draw(),l.setViewport4fv(c.fullViewport),z.release(),_<1&&this._context.requestRender(),k}};y([w({constructOnly:!0})],uI.prototype,"view",void 0),y([w()],uI.prototype,"_context",void 0),uI=y([Z("esri.views.3d.webgl-engine.effects.ssao.SSAO")],uI);const O3t=.5;function o6(t,e){const i=t.fragment;e.receiveAmbientOcclusion?(i.uniforms.add(new Zt("ssaoTex",(r,n)=>{var s;return(s=n.ssao)==null?void 0:s.colorTexture})),i.constants.add("blurSizePixelsInverse","float",1/cI),i.code.add(V`float evaluateAmbientOcclusionInverse() { + `),t}function yG(t){return Math.max(10,20*t.computeScreenPixelSizeAtDist(Math.abs(4*t.relativeElevation)))}const Dye=yt(),Axt=Object.freeze(Object.defineProperty({__proto__:null,build:rDe,getRadius:yG},Symbol.toStringTag,{value:"Module"}));let nDe=class sDe extends Hr{initializeProgram(e){return new $r(e.rctx,sDe.shader.get().build(),Cr)}initializePipeline(){return Ti({colorWrite:ji})}};nDe.shader=new Ir(Axt,()=>we(()=>Promise.resolve().then(()=>sXt),void 0));const b4=2;let w4=class extends gx{constructor(e){super(e),this._context=null,this._passParameters=new xxt,this._drawParameters=new Txt,this.produces=new Map([[ke.SSAO,()=>this._produces()]])}_produces(){return this._enableTime!=null&&this._context!=null}consumes(){return this._produces()?N1t:Jj}initializeRenderContext(e){this._context=e,this.addHandles([_e(()=>{var i;return this.view.qualitySettings.ambientOcclusion||((i=this._context)==null?void 0:i.isFeatureEnabled(Jo.SSAO))},i=>i?this._enable():this._disable(),kt)])}uninitializeRenderContext(){this._disable(),this._context=null}_disable(){this._passParameters.noiseTexture=Kt(this._passParameters.noiseTexture),this._enableTime=null}destroy(){this._disable()}_enable(){var r;if(this._enableTime!=null||!this._context)return;const e=Uint8Array.from(atob(bxt),n=>n.charCodeAt(0)),i=new rn;i.wrapMode=Bi.CLAMP_TO_EDGE,i.pixelFormat=ci.RGB,i.wrapMode=Bi.REPEAT,i.hasMipmap=!0,i.width=32,i.height=32,this._passParameters.noiseTexture=new Ai(this._context.renderContext.rctx,i,e),this._ssaoTechnique==null&&(this._ssaoTechnique=this._context.techniqueRepository.acquire(nDe)),this._blurTechnique==null&&(this._blurTechnique=this._context.techniqueRepository.acquire(tDe)),this._enableTime=0,(r=this._context)==null||r.requestRender()}renderNode(e,i,r){var U,j;const n=e.bindParameters,s=(U=n.linearDepth)==null?void 0:U.colorTexture,o=(j=r==null?void 0:r.normal)==null?void 0:j.colorTexture;if(this._enableTime==null||this._context==null||s==null||!o)return;if(!this._ssaoTechnique.compiled||!this._blurTechnique.compiled)return this._enableTime=e.time,void this._context.requestRender();this._enableTime===0&&(this._enableTime=e.time);const a=e.rctx,c=n.camera,p=this.view.qualitySettings.fadeDuration,_=p>0?Math.min(p,e.time-this._enableTime)/p:1;this._passParameters.normalTexture=o,this._passParameters.depthTexture=s,this._passParameters.projScale=1/c.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*Mxt/yG(c)**6*_;const x=c.fullViewport[2],S=c.fullViewport[3],C=Math.round(x/b4),M=Math.round(S/b4),P=this._context.fbos,$=P.acquire(Sr.RED,x,S);a.bindFramebuffer($.fbo),a.setViewport(0,0,x,S),a.bindTechnique(this._ssaoTechnique,this._passParameters,n).bindDraw(this._drawParameters,n,this._passParameters),a.screen.draw();const F=a.bindTechnique(this._blurTechnique,this._passParameters,n);a.setViewport(0,0,C,M);const z=P.acquire(Sr.RED,C,M);a.bindFramebuffer(z.fbo),this._drawParameters.colorTexture=$.colorTexture,or(this._drawParameters.blurSize,0,b4/S),F.bindDraw(this._drawParameters,n,this._passParameters),a.setViewport(0,0,C,M),a.screen.draw(),$.release();const k=P.acquire(Sr.RED,C,M);return a.bindFramebuffer(k.fbo),a.setViewport(0,0,x,S),a.setClearColor(1,1,1,0),a.clear($n.COLOR_BUFFER_BIT),a.setViewport(0,0,C,M),this._drawParameters.colorTexture=z.colorTexture,or(this._drawParameters.blurSize,b4/x,0),F.bindDraw(this._drawParameters,n,this._passParameters),a.screen.draw(),a.setViewport4fv(c.fullViewport),z.release(),_<1&&this._context.requestRender(),k}};y([w({constructOnly:!0})],w4.prototype,"view",void 0),y([w()],w4.prototype,"_context",void 0),w4=y([Z("esri.views.3d.webgl-engine.effects.ssao.SSAO")],w4);const Mxt=.5;function h6(t,e){const i=t.fragment;e.receiveAmbientOcclusion?(i.uniforms.add(new Zt("ssaoTex",(r,n)=>{var s;return(s=n.ssao)==null?void 0:s.colorTexture})),i.constants.add("blurSizePixelsInverse","float",1/b4),i.code.add(V`float evaluateAmbientOcclusionInverse() { vec2 ssaoTextureSizeInverse = 1.0 / vec2(textureSize(ssaoTex, 0)); return texture(ssaoTex, gl_FragCoord.xy * blurSizePixelsInverse * ssaoTextureSizeInverse).r; } float evaluateAmbientOcclusion() { return 1.0 - evaluateAmbientOcclusionInverse(); }`)):i.code.add(V`float evaluateAmbientOcclusionInverse() { return 1.0; } -float evaluateAmbientOcclusion() { return 0.0; }`)}function P3t(t){const e=t.fragment.code;e.add(V`vec3 evaluateDiffuseIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float NdotNG) +float evaluateAmbientOcclusion() { return 0.0; }`)}function Oxt(t){const e=t.fragment.code;e.add(V`vec3 evaluateDiffuseIlluminationHemisphere(vec3 ambientGround, vec3 ambientSky, float NdotNG) { return ((1.0 - NdotNG) * ambientGround + (1.0 + NdotNG) * ambientSky) * 0.5; }`),e.add(V`float integratedRadiance(float cosTheta2, float roughness) @@ -2016,7 +2005,7 @@ float intRadTheta = integratedRadiance(cosTheta2, roughness); float ground = RdotNG < 0.0 ? 1.0 - intRadTheta : 1.0 + intRadTheta; float sky = 2.0 - ground; return (ground * ambientGround + sky * ambientSky) * 0.5; -}`)}function Mle(t,e){const i=t.fragment.code;t.include(q9),e.pbrMode!==ei.Normal&&e.pbrMode!==ei.Schematic&&e.pbrMode!==ei.Terrain&&e.pbrMode!==ei.TerrainWithWater||(i.add(V`float normalDistribution(float NdotH, float roughness) +}`)}function Vle(t,e){const i=t.fragment.code;t.include(J9),e.pbrMode!==ti.Normal&&e.pbrMode!==ti.Schematic&&e.pbrMode!==ti.Terrain&&e.pbrMode!==ti.TerrainWithWater||(i.add(V`float normalDistribution(float NdotH, float roughness) { float a = NdotH * roughness; float b = roughness / (1.0 - NdotH * NdotH + a * a); @@ -2028,7 +2017,7 @@ vec2 prefilteredDFGAnalytical(float roughness, float NdotV) { vec4 r = roughness * c0 + c1; float a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y; return c2 * a004 + r.zw; -}`)),e.pbrMode!==ei.Normal&&e.pbrMode!==ei.Schematic||(t.include(P3t),i.add(V`struct PBRShadingInfo +}`)),e.pbrMode!==ti.Normal&&e.pbrMode!==ti.Schematic||(t.include(Oxt),i.add(V`struct PBRShadingInfo { float NdotL; float NdotV; @@ -2068,7 +2057,7 @@ outColor.x = gamutMapChanel(inColor.x, p) ; outColor.y = gamutMapChanel(inColor.y, p) ; outColor.z = gamutMapChanel(inColor.z, p) ; return outColor; -}`))}function R3t(t,e){const i=t.fragment.code;t.include(q9),i.add(V` +}`))}function Pxt(t,e){const i=t.fragment.code;t.include(J9),i.add(V` struct PBRShadingWater { float NdotL; // cos angle between normal and light direction @@ -2103,19 +2092,19 @@ return ((dSun + dSunHaze) * V) * F; } vec3 tonemapACES(const vec3 x) { return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14); -}`)}function a6(t){t.constants.add("ambientBoostFactor","float",j$e)}function CP(t){t.uniforms.add(new ft("lightingGlobalFactor",(e,i)=>i.lighting.globalFactor))}function JT(t,e){const i=t.fragment;switch(t.include(o6,e),e.pbrMode!==ei.Disabled&&t.include(Mle,e),t.include(Sae,e),t.include(q9),i.code.add(V` +}`)}function d6(t){t.constants.add("ambientBoostFactor","float",z$e)}function N5(t){t.uniforms.add(new ft("lightingGlobalFactor",(e,i)=>i.lighting.globalFactor))}function iE(t,e){const i=t.fragment;switch(t.include(h6,e),e.pbrMode!==ti.Disabled&&t.include(Vle,e),t.include(Nae,e),t.include(J9),i.code.add(V` const float GAMMA_SRGB = 2.1; const float INV_GAMMA_SRGB = 0.4761904; - ${e.pbrMode===ei.Disabled?"":"const vec3 GROUND_REFLECTANCE = vec3(0.2);"} - `),a6(i),CP(i),B_(i),i.code.add(V` + ${e.pbrMode===ti.Disabled?"":"const vec3 GROUND_REFLECTANCE = vec3(0.2);"} + `),d6(i),N5(i),W_(i),i.code.add(V` float additionalDirectedAmbientLight(vec3 vPosWorld) { float vndl = dot(${e.spherical?V`normalize(vPosWorld)`:V`vec3(0.0, 0.0, 1.0)`}, mainLightDirection); return smoothstep(0.0, 1.0, clamp(vndl * 2.5, 0.0, 1.0)); } - `),a1(i),i.code.add(V`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) { + `),m1(i),i.code.add(V`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) { float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld); return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity; -}`),e.pbrMode){case ei.Disabled:case ei.WaterOnIntegratedMesh:case ei.Water:t.include(yU),i.code.add(V`vec3 evaluateSceneLighting(vec3 normalWorld, vec3 albedo, float shadow, float ssao, vec3 additionalLight) +}`),e.pbrMode){case ti.Disabled:case ti.WaterOnIntegratedMesh:case ti.Water:t.include(vU),i.code.add(V`vec3 evaluateSceneLighting(vec3 normalWorld, vec3 albedo, float shadow, float ssao, vec3 additionalLight) { vec3 mainLighting = evaluateMainLighting(normalWorld, shadow); vec3 ambientLighting = calculateAmbientIrradiance(normalWorld, ssao); @@ -2124,7 +2113,7 @@ vec3 totalLight = mainLighting + ambientLighting + additionalLight; totalLight = min(totalLight, vec3(PI)); vec3 outColor = vec3((albedoLinear / PI) * totalLight); return pow(outColor, vec3(INV_GAMMA_SRGB)); -}`);break;case ei.Normal:case ei.Schematic:i.code.add(V`const float fillLightIntensity = 0.25; +}`);break;case ti.Normal:case ti.Schematic:i.code.add(V`const float fillLightIntensity = 0.25; const float horizonLightDiffusion = 0.4; const float additionalAmbientIrradianceFactor = 0.02; vec3 evaluateSceneLightingPBR(vec3 normal, vec3 albedo, float shadow, float ssao, vec3 additionalLight, vec3 viewDir, vec3 normalGround, vec3 mrr, vec3 _emission, float additionalAmbientIrradiance) @@ -2144,7 +2133,7 @@ inputs.ssao = ssao; inputs.metalness = mrr[0]; inputs.roughness = clamp(mrr[1] * mrr[1], 0.001, 0.99);`),i.code.add(V`inputs.f0 = (0.16 * mrr[2] * mrr[2]) * (1.0 - inputs.metalness) + inputs.albedoLinear * inputs.metalness; inputs.f90 = vec3(clamp(dot(inputs.f0, vec3(50.0 * 0.33)), 0.0, 1.0)); -inputs.diffuseColor = inputs.albedoLinear * (vec3(1.0) - inputs.f0) * (1.0 - inputs.metalness);`),e.useFillLights?i.uniforms.add(new Oy("hasFillLights",(r,n)=>n.enableFillLights)):i.constants.add("hasFillLights","bool",!1),i.code.add(V`vec3 ambientDir = vec3(5.0 * normalGround[1] - normalGround[0] * normalGround[2], - 5.0 * normalGround[0] - normalGround[2] * normalGround[1], normalGround[1] * normalGround[1] + normalGround[0] * normalGround[0]); +inputs.diffuseColor = inputs.albedoLinear * (vec3(1.0) - inputs.f0) * (1.0 - inputs.metalness);`),e.useFillLights?i.uniforms.add(new Dy("hasFillLights",(r,n)=>n.enableFillLights)):i.constants.add("hasFillLights","bool",!1),i.code.add(V`vec3 ambientDir = vec3(5.0 * normalGround[1] - normalGround[0] * normalGround[2], - 5.0 * normalGround[0] - normalGround[2] * normalGround[1], normalGround[1] * normalGround[1] + normalGround[0] * normalGround[0]); ambientDir = ambientDir != vec3(0.0) ? normalize(ambientDir) : normalize(vec3(5.0, -1.0, 0.0)); inputs.NdotAmbDir = hasFillLights ? abs(dot(normal, ambientDir)) : 1.0; vec3 mainLightIrradianceComponent = inputs.NdotL * (1.0 - shadow) * mainLightIntensity; @@ -2165,10 +2154,10 @@ inputs.averageAmbientRadiance = ambientLightIrradianceComponent[1] * (1.0 + GROU vec3 additionalMaterialReflectanceComponent = inputs.albedoLinear * additionalAmbientIrradiance; vec3 emissionComponent = _emission == vec3(0.0) ? _emission : pow(_emission, vec3(GAMMA_SRGB)); vec3 outColorLinear = reflectedColorComponent + additionalMaterialReflectanceComponent + emissionComponent; - ${e.pbrMode!==ei.Schematic||e.hasColorTexture?V`vec3 outColor = pow(blackLevelSoftCompression(outColorLinear, inputs), vec3(INV_GAMMA_SRGB));`:V`vec3 outColor = pow(max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance), vec3(INV_GAMMA_SRGB));`} + ${e.pbrMode!==ti.Schematic||e.hasColorTexture?V`vec3 outColor = pow(blackLevelSoftCompression(outColorLinear, inputs), vec3(INV_GAMMA_SRGB));`:V`vec3 outColor = pow(max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance), vec3(INV_GAMMA_SRGB));`} return outColor; } - `);break;case ei.Terrain:case ei.TerrainWithWater:t.include(yU),i.code.add(V`const float roughnessTerrain = 0.5; + `);break;case ti.Terrain:case ti.TerrainWithWater:t.include(vU),i.code.add(V`const float roughnessTerrain = 0.5; const float specularityTerrain = 0.5; const vec3 fresnelReflectionTerrain = vec3(0.04); vec3 evaluateTerrainLighting(vec3 n, vec3 c, float shadow, float ssao, vec3 al, vec3 vd, vec3 nup) { @@ -2194,7 +2183,7 @@ vec3 specularComponent = specularityTerrain * specularColor * mainLightRadianceC vec3 outColorLinear = outDiffColor + specularComponent; vec3 outColor = pow(outColorLinear, vec3(INV_GAMMA_SRGB)); return outColor; -}`);break;default:e.pbrMode;case ei.COUNT:}}let I3t=class extends Ls{constructor(e,i,r){super(e,"mat4",Or.Draw,(n,s,o,l)=>n.setUniformMatrix4fv(e,i(s,o,l)),r)}},$3t=class extends Ls{constructor(e,i,r){super(e,"mat4",Or.Pass,(n,s,o)=>n.setUniformMatrix4fv(e,i(s,o)),r)}},L3t=class extends _n{constructor(){super(...arguments),this.origin=W()}},D3t=class extends L3t{},N3t=class extends _n{constructor(){super(...arguments),this.modelTransformation=gs}},Ole=class extends N3t{constructor(){super(...arguments),this.origin=W()}};function lG(t,e){e.receiveShadows&&(t.fragment.uniforms.add(new $3t("shadowMapMatrix",(i,r)=>r.shadowMap.getShadowMapMatrices(i.origin),4)),uDe(t))}function KT(t,e){e.receiveShadows&&(t.fragment.uniforms.add(new I3t("shadowMapMatrix",(i,r)=>r.shadowMap.getShadowMapMatrices(i.origin),4)),uDe(t))}function uDe(t){const e=t.fragment;e.include(Q6e),e.uniforms.add(new Zt("shadowMapTex",(i,r)=>r.shadowMap.depthTexture),new s6("numCascades",(i,r)=>r.shadowMap.numCascades),new gr("cascadeDistances",(i,r)=>r.shadowMap.cascadeDistances)),e.code.add(V`int chooseCascade(float depth, out mat4 mat) { +}`);break;default:e.pbrMode;case ti.COUNT:}}let Rxt=class extends Ds{constructor(e,i,r){super(e,"mat4",Pr.Draw,(n,s,o,a)=>n.setUniformMatrix4fv(e,i(s,o,a)),r)}},Ixt=class extends Ds{constructor(e,i,r){super(e,"mat4",Pr.Pass,(n,s,o)=>n.setUniformMatrix4fv(e,i(s,o)),r)}},$xt=class extends bn{constructor(){super(...arguments),this.origin=W()}},Lxt=class extends $xt{},Dxt=class extends bn{constructor(){super(...arguments),this.modelTransformation=gs}},Ble=class extends Dxt{constructor(){super(...arguments),this.origin=W()}};function vG(t,e){e.receiveShadows&&(t.fragment.uniforms.add(new Ixt("shadowMapMatrix",(i,r)=>r.shadowMap.getShadowMapMatrices(i.origin),4)),oDe(t))}function rE(t,e){e.receiveShadows&&(t.fragment.uniforms.add(new Rxt("shadowMapMatrix",(i,r)=>r.shadowMap.getShadowMapMatrices(i.origin),4)),oDe(t))}function oDe(t){const e=t.fragment;e.include(X6e),e.uniforms.add(new Zt("shadowMapTex",(i,r)=>r.shadowMap.depthTexture),new u6("numCascades",(i,r)=>r.shadowMap.numCascades),new gr("cascadeDistances",(i,r)=>r.shadowMap.cascadeDistances)),e.code.add(V`int chooseCascade(float depth, out mat4 mat) { vec4 distance = cascadeDistances; int i = depth < distance[1] ? 0 : depth < distance[2] ? 1 : depth < distance[3] ? 2 : 3; mat = i == 0 ? shadowMapMatrix[0] : i == 1 ? shadowMapMatrix[1] : i == 2 ? shadowMapMatrix[2] : shadowMapMatrix[3]; @@ -2234,30 +2223,30 @@ if (lvpos.x < 0.0 || lvpos.x > 1.0 || lvpos.y < 0.0 || lvpos.y > 1.0) { return 0 ivec2 size = textureSize(shadowMapTex, 0); vec2 uv = cascadeCoordinates(i, size, lvpos); return filterShadow(uv, lvpos, size, shadowMapTex); -}`)}function Tc(){const t=new Float32Array(9);return t[0]=1,t[4]=1,t[8]=1,t}function hDe(t){const e=new Float32Array(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function tk(t,e,i,r,n,s,o,l,c){const f=new Float32Array(9);return f[0]=t,f[1]=e,f[2]=i,f[3]=r,f[4]=n,f[5]=s,f[6]=o,f[7]=l,f[8]=c,f}function F3t(t,e){return new Float32Array(t,e,9)}Object.freeze(Object.defineProperty({__proto__:null,clone:hDe,create:Tc,createView:F3t,fromValues:tk},Symbol.toStringTag,{value:"Module"}));function k3t(t){t.vertex.uniforms.add(new Wm("colorTextureTransformMatrix",e=>e.colorTextureTransformMatrix!=null?e.colorTextureTransformMatrix:Tc())),t.varyings.add("colorUV","vec2"),t.vertex.code.add(V`void forwardColorUV(){ +}`)}function Mc(){const t=new Float32Array(9);return t[0]=1,t[4]=1,t[8]=1,t}function aDe(t){const e=new Float32Array(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function hk(t,e,i,r,n,s,o,a,c){const p=new Float32Array(9);return p[0]=t,p[1]=e,p[2]=i,p[3]=r,p[4]=n,p[5]=s,p[6]=o,p[7]=a,p[8]=c,p}function Nxt(t,e){return new Float32Array(t,e,9)}Object.freeze(Object.defineProperty({__proto__:null,clone:aDe,create:Mc,createView:Nxt,fromValues:hk},Symbol.toStringTag,{value:"Module"}));function Fxt(t){t.vertex.uniforms.add(new Km("colorTextureTransformMatrix",e=>e.colorTextureTransformMatrix!=null?e.colorTextureTransformMatrix:Mc())),t.varyings.add("colorUV","vec2"),t.vertex.code.add(V`void forwardColorUV(){ colorUV = (colorTextureTransformMatrix * vec3(vuv0, 1.0)).xy; -}`)}function z3t(t){t.vertex.uniforms.add(new Wm("normalTextureTransformMatrix",e=>e.normalTextureTransformMatrix!=null?e.normalTextureTransformMatrix:Tc())),t.varyings.add("normalUV","vec2"),t.vertex.code.add(V`void forwardNormalUV(){ +}`)}function kxt(t){t.vertex.uniforms.add(new Km("normalTextureTransformMatrix",e=>e.normalTextureTransformMatrix!=null?e.normalTextureTransformMatrix:Mc())),t.varyings.add("normalUV","vec2"),t.vertex.code.add(V`void forwardNormalUV(){ normalUV = (normalTextureTransformMatrix * vec3(vuv0, 1.0)).xy; -}`)}function U3t(t){t.vertex.uniforms.add(new Wm("emissiveTextureTransformMatrix",e=>e.emissiveTextureTransformMatrix!=null?e.emissiveTextureTransformMatrix:Tc())),t.varyings.add("emissiveUV","vec2"),t.vertex.code.add(V`void forwardEmissiveUV(){ +}`)}function zxt(t){t.vertex.uniforms.add(new Km("emissiveTextureTransformMatrix",e=>e.emissiveTextureTransformMatrix!=null?e.emissiveTextureTransformMatrix:Mc())),t.varyings.add("emissiveUV","vec2"),t.vertex.code.add(V`void forwardEmissiveUV(){ emissiveUV = (emissiveTextureTransformMatrix * vec3(vuv0, 1.0)).xy; -}`)}function V3t(t){t.vertex.uniforms.add(new Wm("occlusionTextureTransformMatrix",e=>e.occlusionTextureTransformMatrix!=null?e.occlusionTextureTransformMatrix:Tc())),t.varyings.add("occlusionUV","vec2"),t.vertex.code.add(V`void forwardOcclusionUV(){ +}`)}function Uxt(t){t.vertex.uniforms.add(new Km("occlusionTextureTransformMatrix",e=>e.occlusionTextureTransformMatrix!=null?e.occlusionTextureTransformMatrix:Mc())),t.varyings.add("occlusionUV","vec2"),t.vertex.code.add(V`void forwardOcclusionUV(){ occlusionUV = (occlusionTextureTransformMatrix * vec3(vuv0, 1.0)).xy; -}`)}function B3t(t){t.vertex.uniforms.add(new Wm("metallicRoughnessTextureTransformMatrix",e=>e.metallicRoughnessTextureTransformMatrix!=null?e.metallicRoughnessTextureTransformMatrix:Tc())),t.varyings.add("metallicRoughnessUV","vec2"),t.vertex.code.add(V`void forwardMetallicRoughnessUV(){ +}`)}function Vxt(t){t.vertex.uniforms.add(new Km("metallicRoughnessTextureTransformMatrix",e=>e.metallicRoughnessTextureTransformMatrix!=null?e.metallicRoughnessTextureTransformMatrix:Mc())),t.varyings.add("metallicRoughnessUV","vec2"),t.vertex.code.add(V`void forwardMetallicRoughnessUV(){ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0)).xy; -}`)}function kL(t){t.include(h1),t.code.add(V` +}`)}function WL(t){t.include(_1),t.code.add(V` vec3 mixExternalColor(vec3 internalColor, vec3 textureColor, vec3 externalColor, int mode) { // workaround for artifacts in OSX using Intel Iris Pro // see: https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/10475 vec3 internalMixed = internalColor * textureColor; vec3 allMixed = internalMixed * externalColor; - if (mode == ${V.int(Uo.Multiply)}) { + if (mode == ${V.int(Vo.Multiply)}) { return allMixed; } - if (mode == ${V.int(Uo.Ignore)}) { + if (mode == ${V.int(Vo.Ignore)}) { return internalMixed; } - if (mode == ${V.int(Uo.Replace)}) { + if (mode == ${V.int(Vo.Replace)}) { return externalColor; } @@ -2274,17 +2263,17 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) float internalMixed = internalOpacity * textureOpacity; float allMixed = internalMixed * externalOpacity; - if (mode == ${V.int(Uo.Ignore)}) { + if (mode == ${V.int(Vo.Ignore)}) { return internalMixed; } - if (mode == ${V.int(Uo.Replace)}) { + if (mode == ${V.int(Vo.Replace)}) { return externalOpacity; } // multiply or tint (or something invalid) return allMixed; } - `)}function dDe(t){const e=new Cr,{vertex:i,fragment:r,varyings:n}=e;if(Kh(i,t),e.include(W9),n.add("vpos","vec3"),e.include(e_,t),e.include(X$e,t),e.include(V9e,t),t.hasColorTextureTransform&&e.include(k3t),t.output===ue.Color||t.output===ue.Alpha){t.hasNormalTextureTransform&&e.include(z3t),t.hasEmissionTextureTransform&&e.include(U3t),t.hasOcclusionTextureTransform&&e.include(V3t),t.hasMetallicRoughnessTextureTransform&&e.include(B3t),Nm(i,t),e.include(n6,t),e.include(Yu,t);const s=t.normalType===Br.Attribute||t.normalType===Br.Compressed;s&&t.offsetBackfaces&&e.include(Z6e),e.include(iDe,t),e.include(nG,t),t.instancedColor&&e.attributes.add(J.INSTANCECOLOR,"vec4"),n.add("vPositionLocal","vec3"),e.include(My,t),e.include(wP,t),e.include(K6e,t),e.include(ME,t),i.uniforms.add(new gr("externalColor",o=>o.externalColor)),n.add("vcolorExt","vec4"),t.multipassEnabled&&n.add("depth","float"),i.code.add(V` + `)}function lDe(t){const e=new Ar,{vertex:i,fragment:r,varyings:n}=e;if(td(i,t),e.include(K9),n.add("vpos","vec3"),e.include(a_,t),e.include(H$e,t),e.include(F9e,t),t.hasColorTextureTransform&&e.include(Fxt),t.output===ue.Color||t.output===ue.Alpha){t.hasNormalTextureTransform&&e.include(kxt),t.hasEmissionTextureTransform&&e.include(zxt),t.hasOcclusionTextureTransform&&e.include(Uxt),t.hasMetallicRoughnessTextureTransform&&e.include(Vxt),zm(i,t),e.include(c6,t),e.include(Zu,t);const s=t.normalType===Br.Attribute||t.normalType===Br.Compressed;s&&t.offsetBackfaces&&e.include(q6e),e.include(K6e,t),e.include(fG,t),t.instancedColor&&e.attributes.add(J.INSTANCECOLOR,"vec4"),n.add("vPositionLocal","vec3"),e.include(Ly,t),e.include(R5,t),e.include(Y6e,t),e.include(LE,t),i.uniforms.add(new gr("externalColor",o=>o.externalColor)),n.add("vcolorExt","vec4"),t.multipassEnabled&&n.add("depth","float"),i.code.add(V` void main(void) { forwardNormalizedVertexColor(); vcolorExt = externalColor; @@ -2293,7 +2282,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) vcolorExt *= getSymbolColor(); forwardColorMixMode(); - if (vcolorExt.a < ${V.float(Cl)}) { + if (vcolorExt.a < ${V.float(Ml)}) { gl_Position = vec4(1e38, 1e38, 1e38, 1.0); } else { vpos = getVertexInLocalOriginSpace(); @@ -2315,7 +2304,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) ${t.hasOcclusionTextureTransform?V`forwardOcclusionUV();`:""} ${t.hasMetallicRoughnessTextureTransform?V`forwardMetallicRoughnessUV();`:""} } - `)}switch(t.output){case ue.Alpha:e.include(oo,t),e.include(wT,t),e.include(dd,t),r.uniforms.add(new ft("opacity",s=>s.opacity),new ft("layerOpacity",s=>s.layerOpacity)),t.hasColorTexture&&r.uniforms.add(new Zt("tex",s=>s.texture)),r.include(kL),r.code.add(V` + `)}switch(t.output){case ue.Alpha:e.include(ao,t),e.include(MT,t),e.include(gd,t),r.uniforms.add(new ft("opacity",s=>s.opacity),new ft("layerOpacity",s=>s.layerOpacity)),t.hasColorTexture&&r.uniforms.add(new Zt("tex",s=>s.texture)),r.include(WL),r.code.add(V` void main() { discardBySlice(vpos); ${t.multipassEnabled?"terrainDepthTest(depth);":""} @@ -2326,7 +2315,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) ${t.hasVertexColors?V`float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));`:V`float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`} fragColor = vec4(opacity_); } - `);break;case ue.Color:e.include(oo,t),e.include(JT,t),e.include(o6,t),e.include(wT,t),e.include(t.instancedDoublePrecision?lG:KT,t),e.include(dd,t),Nm(r,t),r.uniforms.add(i.uniforms.get("localOrigin"),new Oi("ambient",s=>s.ambient),new Oi("diffuse",s=>s.diffuse),new ft("opacity",s=>s.opacity),new ft("layerOpacity",s=>s.layerOpacity)),t.hasColorTexture&&r.uniforms.add(new Zt("tex",s=>s.texture)),e.include(xae,t),e.include(Mle,t),r.include(kL),e.include(j6e,t),a6(r),CP(r),a1(r),r.code.add(V` + `);break;case ue.Color:e.include(ao,t),e.include(iE,t),e.include(h6,t),e.include(MT,t),e.include(t.instancedDoublePrecision?vG:rE,t),e.include(gd,t),zm(r,t),r.uniforms.add(i.uniforms.get("localOrigin"),new Oi("ambient",s=>s.ambient),new Oi("diffuse",s=>s.diffuse),new ft("opacity",s=>s.opacity),new ft("layerOpacity",s=>s.layerOpacity)),t.hasColorTexture&&r.uniforms.add(new Zt("tex",s=>s.texture)),e.include(Dae,t),e.include(Vle,t),r.include(WL),e.include(z6e,t),d6(r),N5(r),m1(r),r.code.add(V` void main() { discardBySlice(vpos); ${t.multipassEnabled?"terrainDepthTest(depth);":""} @@ -2339,7 +2328,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) vec3 normal = screenDerivativeNormal(vPositionLocal);`:V` shadingParams.normalView = vNormalWorld; vec3 normal = shadingNormal(shadingParams);`} - ${t.pbrMode===ei.Normal?"applyPBRFactors();":""} + ${t.pbrMode===ti.Normal?"applyPBRFactors();":""} float ssao = evaluateAmbientOcclusionInverse(); ssao *= getBakedOcclusion(); @@ -2367,7 +2356,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor; - ${t.pbrMode===ei.Normal||t.pbrMode===ei.Schematic?V` + ${t.pbrMode===ti.Normal||t.pbrMode===ti.Schematic?V` float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2]; ${t.snowCover?V` mrr = mix(mrr, vec3(0.0, 1.0, 0.04), snow); @@ -2377,7 +2366,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) fragColor = highlightSlice(vec4(shadedColor, opacity_), vpos); ${t.transparencyPassType===Jt.Color?V`fragColor = premultiplyAlpha(fragColor);`:""} } - `)}return e.include(tDe,t),e}const j3t=Object.freeze(Object.defineProperty({__proto__:null,build:dDe},Symbol.toStringTag,{value:"Module"}));let G3t=class extends G6e{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=mc(sG),this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=Ln.Back,this.isInstanced=!1,this.hasInstancedColor=!1,this.emissiveFactor=nt(0,0,0),this.instancedDoublePrecision=!1,this.normalType=Br.Attribute,this.receiveShadows=!0,this.castShadows=!0,this.shadowMappingEnabled=!1,this.ambient=nt(.2,.2,.2),this.diffuse=nt(.8,.8,.8),this.externalColor=Mi(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=W(),this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.transparent=!1,this.writeDepth=!0,this.customDepthTest=WT.Less,this.textureAlphaMode=mn.Blend,this.textureAlphaCutoff=UU,this.textureAlphaPremultiplied=!1,this.hasOccludees=!1,this.renderOccluded=Wn.Occlude,this.isDecoration=!1}},H3t=class extends H6e{constructor(){super(...arguments),this.origin=W(),this.slicePlaneLocalOrigin=this.origin}},Ple=class pDe extends Hr{initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global,i.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result,i.textureCoordinateType=i.hasColorTexture||i.hasMetallicRoughnessTexture||i.hasEmissionTexture||i.hasOcclusionTexture||i.hasNormalTexture?So.Default:So.None,i.objectAndLayerIdColorInstanced=i.instanced}initializeProgram(e){return this._initializeProgram(e,pDe.shader)}_initializeProgram(e,i){return new Ir(e.rctx,i.get().build(this.configuration),Er)}_convertDepthTestFunction(e){return e===WT.Lequal?Zr.LEQUAL:Zr.LESS}_makePipeline(e,i){const r=this.configuration,n=e===Jt.NONE,s=e===Jt.FrontFace;return Ti({blending:r.output!==ue.Color&&r.output!==ue.Alpha||!r.transparent?null:n?vp:Y_(e),culling:q3t(r)?Mj(r.cullFace):null,depthTest:{func:px(e,this._convertDepthTestFunction(r.customDepthTest))},depthWrite:(n||s)&&r.writeDepth?rh:null,colorWrite:ji,stencilWrite:r.hasOccludees?Jy:null,stencilTest:r.hasOccludees?i?Z2:fx:null,polygonOffset:n||s?null:tG(r.enableOffset)})}initializePipeline(){return this._occludeePipelineState=this._makePipeline(this.configuration.transparencyPassType,!0),this._makePipeline(this.configuration.transparencyPassType,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}};function q3t(t){return t.cullFace!==Ln.None||!t.hasSlicePlane&&!t.transparent&&!t.doubleSidedMode}Ple.shader=new Rr(j3t,()=>we(()=>Promise.resolve().then(()=>TWt),void 0));let Ui=class extends hu{constructor(){super(...arguments),this.output=ue.Color,this.alphaDiscardMode=mn.Opaque,this.doubleSidedMode=Is.None,this.pbrMode=ei.Disabled,this.cullFace=Ln.None,this.transparencyPassType=Jt.NONE,this.normalType=Br.Attribute,this.textureCoordinateType=So.None,this.customDepthTest=WT.Less,this.spherical=!1,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.vvSize=!1,this.vvColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instanced=!1,this.instancedColor=!1,this.objectAndLayerIdColorInstanced=!1,this.instancedDoublePrecision=!1,this.doublePrecisionRequiresObfuscation=!1,this.writeDepth=!0,this.transparent=!1,this.enableOffset=!0,this.cullAboveGround=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1}};y([fe({count:ue.COUNT})],Ui.prototype,"output",void 0),y([fe({count:mn.COUNT})],Ui.prototype,"alphaDiscardMode",void 0),y([fe({count:Is.COUNT})],Ui.prototype,"doubleSidedMode",void 0),y([fe({count:ei.COUNT})],Ui.prototype,"pbrMode",void 0),y([fe({count:Ln.COUNT})],Ui.prototype,"cullFace",void 0),y([fe({count:Jt.COUNT})],Ui.prototype,"transparencyPassType",void 0),y([fe({count:Br.COUNT})],Ui.prototype,"normalType",void 0),y([fe({count:So.COUNT})],Ui.prototype,"textureCoordinateType",void 0),y([fe({count:WT.COUNT})],Ui.prototype,"customDepthTest",void 0),y([fe()],Ui.prototype,"spherical",void 0),y([fe()],Ui.prototype,"hasVertexColors",void 0),y([fe()],Ui.prototype,"hasSymbolColors",void 0),y([fe()],Ui.prototype,"hasVerticalOffset",void 0),y([fe()],Ui.prototype,"hasSlicePlane",void 0),y([fe()],Ui.prototype,"hasSliceHighlight",void 0),y([fe()],Ui.prototype,"hasColorTexture",void 0),y([fe()],Ui.prototype,"hasMetallicRoughnessTexture",void 0),y([fe()],Ui.prototype,"hasEmissionTexture",void 0),y([fe()],Ui.prototype,"hasOcclusionTexture",void 0),y([fe()],Ui.prototype,"hasNormalTexture",void 0),y([fe()],Ui.prototype,"hasScreenSizePerspective",void 0),y([fe()],Ui.prototype,"hasVertexTangents",void 0),y([fe()],Ui.prototype,"hasOccludees",void 0),y([fe()],Ui.prototype,"multipassEnabled",void 0),y([fe()],Ui.prototype,"hasModelTransformation",void 0),y([fe()],Ui.prototype,"offsetBackfaces",void 0),y([fe()],Ui.prototype,"vvSize",void 0),y([fe()],Ui.prototype,"vvColor",void 0),y([fe()],Ui.prototype,"receiveShadows",void 0),y([fe()],Ui.prototype,"receiveAmbientOcclusion",void 0),y([fe()],Ui.prototype,"textureAlphaPremultiplied",void 0),y([fe()],Ui.prototype,"instanced",void 0),y([fe()],Ui.prototype,"instancedColor",void 0),y([fe()],Ui.prototype,"objectAndLayerIdColorInstanced",void 0),y([fe()],Ui.prototype,"instancedDoublePrecision",void 0),y([fe()],Ui.prototype,"doublePrecisionRequiresObfuscation",void 0),y([fe()],Ui.prototype,"writeDepth",void 0),y([fe()],Ui.prototype,"transparent",void 0),y([fe()],Ui.prototype,"enableOffset",void 0),y([fe()],Ui.prototype,"cullAboveGround",void 0),y([fe()],Ui.prototype,"snowCover",void 0),y([fe()],Ui.prototype,"hasColorTextureTransform",void 0),y([fe()],Ui.prototype,"hasEmissionTextureTransform",void 0),y([fe()],Ui.prototype,"hasNormalTextureTransform",void 0),y([fe()],Ui.prototype,"hasOcclusionTextureTransform",void 0),y([fe()],Ui.prototype,"hasMetallicRoughnessTextureTransform",void 0),y([fe({constValue:!1})],Ui.prototype,"occlusionPass",void 0),y([fe({constValue:!0})],Ui.prototype,"hasVvInstancing",void 0),y([fe({constValue:!1})],Ui.prototype,"useCustomDTRExponentForWater",void 0),y([fe({constValue:!1})],Ui.prototype,"supportsTextureAtlas",void 0),y([fe({constValue:!0})],Ui.prototype,"useFillLights",void 0);function fDe(t){const e=new Cr,{vertex:i,fragment:r,varyings:n}=e;return Kh(i,t),e.include(W9),n.add("vpos","vec3"),e.include(e_,t),e.include(X$e,t),e.include(V9e,t),t.output!==ue.Color&&t.output!==ue.Alpha||(Nm(e.vertex,t),e.include(n6,t),e.include(Yu,t),t.offsetBackfaces&&e.include(Z6e),t.instancedColor&&e.attributes.add(J.INSTANCECOLOR,"vec4"),n.add("vNormalWorld","vec3"),n.add("localvpos","vec3"),t.multipassEnabled&&n.add("depth","float"),e.include(My,t),e.include(wP,t),e.include(K6e,t),e.include(ME,t),i.uniforms.add(new gr("externalColor",s=>s.externalColor)),n.add("vcolorExt","vec4"),i.code.add(V` + `)}return e.include(J6e,t),e}const Bxt=Object.freeze(Object.defineProperty({__proto__:null,build:lDe},Symbol.toStringTag,{value:"Module"}));let jxt=class extends U6e{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=vc(mG),this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=Ln.Back,this.isInstanced=!1,this.hasInstancedColor=!1,this.emissiveFactor=st(0,0,0),this.instancedDoublePrecision=!1,this.normalType=Br.Attribute,this.receiveShadows=!0,this.castShadows=!0,this.shadowMappingEnabled=!1,this.ambient=st(.2,.2,.2),this.diffuse=st(.8,.8,.8),this.externalColor=Mi(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=W(),this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.transparent=!1,this.writeDepth=!0,this.customDepthTest=KT.Less,this.textureAlphaMode=yn.Blend,this.textureAlphaCutoff=VU,this.textureAlphaPremultiplied=!1,this.hasOccludees=!1,this.renderOccluded=Yn.Occlude,this.isDecoration=!1}},Gxt=class extends V6e{constructor(){super(...arguments),this.origin=W(),this.slicePlaneLocalOrigin=this.origin}},jle=class cDe extends Hr{initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global,i.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result,i.textureCoordinateType=i.hasColorTexture||i.hasMetallicRoughnessTexture||i.hasEmissionTexture||i.hasOcclusionTexture||i.hasNormalTexture?To.Default:To.None,i.objectAndLayerIdColorInstanced=i.instanced}initializeProgram(e){return this._initializeProgram(e,cDe.shader)}_initializeProgram(e,i){return new $r(e.rctx,i.get().build(this.configuration),Cr)}_convertDepthTestFunction(e){return e===KT.Lequal?Zr.LEQUAL:Zr.LESS}_makePipeline(e,i){const r=this.configuration,n=e===Jt.NONE,s=e===Jt.FrontFace;return Ti({blending:r.output!==ue.Color&&r.output!==ue.Alpha||!r.transparent?null:n?xp:Q_(e),culling:Hxt(r)?kj(r.cullFace):null,depthTest:{func:_x(e,this._convertDepthTestFunction(r.customDepthTest))},depthWrite:(n||s)&&r.writeDepth?sh:null,colorWrite:ji,stencilWrite:r.hasOccludees?n1:null,stencilTest:r.hasOccludees?i?tx:bx:null,polygonOffset:n||s?null:hG(r.enableOffset)})}initializePipeline(){return this._occludeePipelineState=this._makePipeline(this.configuration.transparencyPassType,!0),this._makePipeline(this.configuration.transparencyPassType,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}};function Hxt(t){return t.cullFace!==Ln.None||!t.hasSlicePlane&&!t.transparent&&!t.doubleSidedMode}jle.shader=new Ir(Bxt,()=>we(()=>Promise.resolve().then(()=>oXt),void 0));let Ui=class extends pu{constructor(){super(...arguments),this.output=ue.Color,this.alphaDiscardMode=yn.Opaque,this.doubleSidedMode=Ls.None,this.pbrMode=ti.Disabled,this.cullFace=Ln.None,this.transparencyPassType=Jt.NONE,this.normalType=Br.Attribute,this.textureCoordinateType=To.None,this.customDepthTest=KT.Less,this.spherical=!1,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasSlicePlane=!1,this.hasSliceHighlight=!0,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.vvSize=!1,this.vvColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instanced=!1,this.instancedColor=!1,this.objectAndLayerIdColorInstanced=!1,this.instancedDoublePrecision=!1,this.doublePrecisionRequiresObfuscation=!1,this.writeDepth=!0,this.transparent=!1,this.enableOffset=!0,this.cullAboveGround=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1}};y([fe({count:ue.COUNT})],Ui.prototype,"output",void 0),y([fe({count:yn.COUNT})],Ui.prototype,"alphaDiscardMode",void 0),y([fe({count:Ls.COUNT})],Ui.prototype,"doubleSidedMode",void 0),y([fe({count:ti.COUNT})],Ui.prototype,"pbrMode",void 0),y([fe({count:Ln.COUNT})],Ui.prototype,"cullFace",void 0),y([fe({count:Jt.COUNT})],Ui.prototype,"transparencyPassType",void 0),y([fe({count:Br.COUNT})],Ui.prototype,"normalType",void 0),y([fe({count:To.COUNT})],Ui.prototype,"textureCoordinateType",void 0),y([fe({count:KT.COUNT})],Ui.prototype,"customDepthTest",void 0),y([fe()],Ui.prototype,"spherical",void 0),y([fe()],Ui.prototype,"hasVertexColors",void 0),y([fe()],Ui.prototype,"hasSymbolColors",void 0),y([fe()],Ui.prototype,"hasVerticalOffset",void 0),y([fe()],Ui.prototype,"hasSlicePlane",void 0),y([fe()],Ui.prototype,"hasSliceHighlight",void 0),y([fe()],Ui.prototype,"hasColorTexture",void 0),y([fe()],Ui.prototype,"hasMetallicRoughnessTexture",void 0),y([fe()],Ui.prototype,"hasEmissionTexture",void 0),y([fe()],Ui.prototype,"hasOcclusionTexture",void 0),y([fe()],Ui.prototype,"hasNormalTexture",void 0),y([fe()],Ui.prototype,"hasScreenSizePerspective",void 0),y([fe()],Ui.prototype,"hasVertexTangents",void 0),y([fe()],Ui.prototype,"hasOccludees",void 0),y([fe()],Ui.prototype,"multipassEnabled",void 0),y([fe()],Ui.prototype,"hasModelTransformation",void 0),y([fe()],Ui.prototype,"offsetBackfaces",void 0),y([fe()],Ui.prototype,"vvSize",void 0),y([fe()],Ui.prototype,"vvColor",void 0),y([fe()],Ui.prototype,"receiveShadows",void 0),y([fe()],Ui.prototype,"receiveAmbientOcclusion",void 0),y([fe()],Ui.prototype,"textureAlphaPremultiplied",void 0),y([fe()],Ui.prototype,"instanced",void 0),y([fe()],Ui.prototype,"instancedColor",void 0),y([fe()],Ui.prototype,"objectAndLayerIdColorInstanced",void 0),y([fe()],Ui.prototype,"instancedDoublePrecision",void 0),y([fe()],Ui.prototype,"doublePrecisionRequiresObfuscation",void 0),y([fe()],Ui.prototype,"writeDepth",void 0),y([fe()],Ui.prototype,"transparent",void 0),y([fe()],Ui.prototype,"enableOffset",void 0),y([fe()],Ui.prototype,"cullAboveGround",void 0),y([fe()],Ui.prototype,"snowCover",void 0),y([fe()],Ui.prototype,"hasColorTextureTransform",void 0),y([fe()],Ui.prototype,"hasEmissionTextureTransform",void 0),y([fe()],Ui.prototype,"hasNormalTextureTransform",void 0),y([fe()],Ui.prototype,"hasOcclusionTextureTransform",void 0),y([fe()],Ui.prototype,"hasMetallicRoughnessTextureTransform",void 0),y([fe({constValue:!1})],Ui.prototype,"occlusionPass",void 0),y([fe({constValue:!0})],Ui.prototype,"hasVvInstancing",void 0),y([fe({constValue:!1})],Ui.prototype,"useCustomDTRExponentForWater",void 0),y([fe({constValue:!1})],Ui.prototype,"supportsTextureAtlas",void 0),y([fe({constValue:!0})],Ui.prototype,"useFillLights",void 0);function uDe(t){const e=new Ar,{vertex:i,fragment:r,varyings:n}=e;return td(i,t),e.include(K9),n.add("vpos","vec3"),e.include(a_,t),e.include(H$e,t),e.include(F9e,t),t.output!==ue.Color&&t.output!==ue.Alpha||(zm(e.vertex,t),e.include(c6,t),e.include(Zu,t),t.offsetBackfaces&&e.include(q6e),t.instancedColor&&e.attributes.add(J.INSTANCECOLOR,"vec4"),n.add("vNormalWorld","vec3"),n.add("localvpos","vec3"),t.multipassEnabled&&n.add("depth","float"),e.include(Ly,t),e.include(R5,t),e.include(Y6e,t),e.include(LE,t),i.uniforms.add(new gr("externalColor",s=>s.externalColor)),n.add("vcolorExt","vec4"),i.code.add(V` void main(void) { forwardNormalizedVertexColor(); vcolorExt = externalColor; @@ -2386,7 +2375,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) vcolorExt *= getSymbolColor(); forwardColorMixMode(); - if (vcolorExt.a < ${V.float(Cl)}) { + if (vcolorExt.a < ${V.float(Ml)}) { gl_Position = vec4(1e38, 1e38, 1e38, 1.0); } else { vpos = getVertexInLocalOriginSpace(); @@ -2401,7 +2390,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) forwardLinearDepth(); forwardTextureCoordinates(); } - `)),t.output===ue.Alpha&&(e.include(oo,t),e.include(wT,t),e.include(dd,t),r.uniforms.add(new ft("opacity",s=>s.opacity),new ft("layerOpacity",s=>s.layerOpacity)),t.hasColorTexture&&r.uniforms.add(new Zt("tex",s=>s.texture)),r.include(kL),r.code.add(V` + `)),t.output===ue.Alpha&&(e.include(ao,t),e.include(MT,t),e.include(gd,t),r.uniforms.add(new ft("opacity",s=>s.opacity),new ft("layerOpacity",s=>s.layerOpacity)),t.hasColorTexture&&r.uniforms.add(new Zt("tex",s=>s.texture)),r.include(WL),r.code.add(V` void main() { discardBySlice(vpos); ${t.multipassEnabled?V`terrainDepthTest(depth);`:""} @@ -2413,7 +2402,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) fragColor = vec4(opacity_); } - `)),t.output===ue.Color&&(e.include(oo,t),e.include(JT,t),e.include(o6,t),e.include(wT,t),e.include(t.instancedDoublePrecision?lG:KT,t),e.include(dd,t),Nm(e.fragment,t),B_(r),a6(r),CP(r),r.uniforms.add(i.uniforms.get("localOrigin"),i.uniforms.get("view"),new Oi("ambient",s=>s.ambient),new Oi("diffuse",s=>s.diffuse),new ft("opacity",s=>s.opacity),new ft("layerOpacity",s=>s.layerOpacity)),t.hasColorTexture&&r.uniforms.add(new Zt("tex",s=>s.texture)),e.include(xae,t),e.include(Mle,t),r.include(kL),a1(r),r.code.add(V` + `)),t.output===ue.Color&&(e.include(ao,t),e.include(iE,t),e.include(h6,t),e.include(MT,t),e.include(t.instancedDoublePrecision?vG:rE,t),e.include(gd,t),zm(e.fragment,t),W_(r),d6(r),N5(r),r.uniforms.add(i.uniforms.get("localOrigin"),i.uniforms.get("view"),new Oi("ambient",s=>s.ambient),new Oi("diffuse",s=>s.diffuse),new ft("opacity",s=>s.opacity),new ft("layerOpacity",s=>s.layerOpacity)),t.hasColorTexture&&r.uniforms.add(new Zt("tex",s=>s.texture)),e.include(Dae,t),e.include(Vle,t),r.include(WL),m1(r),r.code.add(V` void main() { discardBySlice(vpos); ${t.multipassEnabled?V`terrainDepthTest(depth);`:""} @@ -2422,7 +2411,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) ${t.textureAlphaPremultiplied?"texColor.rgb /= texColor.a;":""} discardOrAdjustAlpha(texColor);`:V`vec4 texColor = vec4(1.0);`} vec3 viewDirection = normalize(vpos - cameraPosition); - ${t.pbrMode===ei.Normal?"applyPBRFactors();":""} + ${t.pbrMode===ti.Normal?"applyPBRFactors();":""} float ssao = evaluateAmbientOcclusionInverse(); ssao *= getBakedOcclusion(); @@ -2445,8 +2434,8 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) float treeRadialFalloff = vColor.r; float backLightFactor = 0.5 * treeRadialFalloff * alignmentLightView * transmittance * (1.0 - shadow); additionalLight += backLightFactor * mainLightIntensity;`} - ${t.pbrMode===ei.Normal||t.pbrMode===ei.Schematic?t.spherical?V`vec3 normalGround = normalize(vpos + localOrigin);`:V`vec3 normalGround = vec3(0.0, 0.0, 1.0);`:V``} - ${t.pbrMode===ei.Normal||t.pbrMode===ei.Schematic?V` + ${t.pbrMode===ti.Normal||t.pbrMode===ti.Schematic?t.spherical?V`vec3 normalGround = normalize(vpos + localOrigin);`:V`vec3 normalGround = vec3(0.0, 0.0, 1.0);`:V``} + ${t.pbrMode===ti.Normal||t.pbrMode===ti.Schematic?V` float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2]; ${t.snowCover?V` mrr = vec3(0.0, 1.0, 0.04); @@ -2456,7 +2445,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) fragColor = highlightSlice(vec4(shadedColor, opacity_), vpos); ${t.transparencyPassType===Jt.Color?V`fragColor = premultiplyAlpha(fragColor);`:V``} } - `)),e.include(tDe,t),e}const W3t=Object.freeze(Object.defineProperty({__proto__:null,build:fDe},Symbol.toStringTag,{value:"Module"}));let mDe=class gDe extends Ple{initializeConfiguration(e,i){super.initializeConfiguration(e,i),i.hasMetallicRoughnessTexture=!1,i.hasEmissionTexture=!1,i.hasOcclusionTexture=!1,i.hasNormalTexture=!1,i.hasModelTransformation=!1,i.normalType=Br.Attribute,i.doubleSidedMode=Is.WindingOrder,i.hasVertexTangents=!1}initializeProgram(e){return this._initializeProgram(e,gDe.shader)}};mDe.shader=new Rr(W3t,()=>we(()=>Promise.resolve().then(()=>EWt),void 0));let km=class extends hx{constructor(e){super(e,Z3t),this.supportsEdges=!0,this._configuration=new Ui,this._vertexBufferLayout=J3t(this.parameters)}isVisibleForOutput(e){return e!==ue.Shadow&&e!==ue.ShadowExcludeHighlight&&e!==ue.ShadowHighlight||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||e.layerOpacity===0)return!1;const{hasInstancedColor:i,hasVertexColors:r,hasSymbolColors:n,vvColor:s}=e,o=e.colorMixMode==="replace",l=e.opacity>0,c=e.externalColor&&e.externalColor[3]>0,f=i||s||n;return r&&f?o||l:r?o?c:l:f?o||l:o?c:l}getConfiguration(e,i){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=this.parameters.verticalOffset!=null,this._configuration.hasScreenSizePerspective=this.parameters.screenSizePerspective!=null,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this.parameters.customDepthTest!=null&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?Ln.None:this.parameters.cullFace,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration.cullAboveGround=i.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=this.parameters.modelTransformation!=null,e!==ue.Color&&e!==ue.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=Is.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&this.parameters.doubleSidedType==="normal"?Is.View:this.parameters.doubleSided&&this.parameters.doubleSidedType==="winding-order"?Is.WindingOrder:Is.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=i.ssao!=null,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?ei.Schematic:ei.Normal:ei.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.enableOffset=i.camera.relativeElevationvDe(t,e)))}function Rle(t){let e=0,i=0,r=0,n=!1,s=0;const o=new B6e;for(const l of t)l!=null&&(e+=l.verticesPerFeature,i+=l.verticesPerCoordinate,r+=l.drawCallsPerFeature,o.bytesPerFeature+=l.memory.bytesPerFeature,o.bytesPerFeatureLabel+=l.memory.bytesPerFeatureLabel,o.resourceBytes+=l.memory.resourceBytes,o.draped.bytesPerFeature+=l.memory.bytesPerFeature,o.draped.bytesPerFeatureLabel+=l.memory.bytesPerFeatureLabel,n=n||l.estimated,++s);return n?new f3t(s,{verticesPerFeature:e,verticesPerCoordinate:i,drawCallsPerFeature:r,memory:o}):new p3t(s,{verticesPerFeature:e,verticesPerCoordinate:i,drawCallsPerFeature:r,memory:o})}function Loi(t){const e=Rle(t);return e.numComplexities>0&&(e.verticesPerFeature/=e.numComplexities,e.verticesPerCoordinate/=e.numComplexities,e.drawCallsPerFeature/=e.numComplexities,e.memory.bytesPerFeature/=e.numComplexities,e.memory.bytesPerFeatureLabel/=e.numComplexities,e.memory.resourceBytes/=e.numComplexities,e.memory.draped.bytesPerFeature/=e.numComplexities,e.memory.draped.bytesPerFeatureLabel/=e.numComplexities),e}const fW={};function vDe(t,e){var n,s;const i=_De(t,e),r=rut(e)?2:0;switch(e.type){case"extrude":return new ff({verticesPerFeature:-12,verticesPerCoordinate:12,drawCallsPerFeature:r,memory:i});case"fill":if(t.type==="mesh-3d")return new ff({drawCallsPerFeature:r,memory:i});if(e.outline!=null&&e.outline.size>0)return new ff({verticesPerFeature:-12,verticesPerCoordinate:9,memory:i});case"water":return new ff({verticesPerFeature:-6,verticesPerCoordinate:3,memory:i});case"line":return new ff({verticesPerFeature:-6,verticesPerCoordinate:6,memory:i});case"object":return(n=e.resource)!=null&&n.href?new Ele({verticesPerFeature:100,memory:i}):{...iSt(((s=e.resource)==null?void 0:s.primitive)??Fse),memory:i};case"path":{let o=0,l=0;switch(e.profile){case"circle":o=F6e;break;case"quad":o=4;break;default:return void(e.profile,void 0)}switch(e.join??"simple"){case"round":l=N6e;break;case"miter":case"bevel":l=1;break;default:return}const c=2*o,f=o*l*2,_=f+c;let x=-2*f-c;switch(e.cap){case"none":break;case"butt":case"square":x+=2*(o-1);break;case"round":x+=2*(o*(nie-1)*2+o);break;default:return}return new ff({verticesPerFeature:x,verticesPerCoordinate:_,memory:i})}case"text":case"icon":return new ff({verticesPerFeature:6,memory:i});default:return}}function _De(t,e){const i=t.type==="point-3d";switch(e.type){case"extrude":return e.edges&&e.edges.size>0?gu.EXTRUDE_EDGES:gu.EXTRUDE;case"fill":return e.outline!=null&&e.outline.size>0?gu.FILL_OUTLINE:gu.FILL;case"water":return gu.FILL;case"line":return e.join==="round"?gu.LINE_ROUND:gu.LINE_MITER;case"path":switch(e.join){case"round":switch(e.profile){case"circle":return gu.PATH_ROUND_CIRCLE;case"quad":return gu.PATH_ROUND_QUAD;default:return void(e.profile,void 0)}case"miter":case"bevel":switch(e.profile){case"circle":return gu.PATH_MITER_CIRCLE;case"quad":return gu.PATH_MITER_QUAD;default:return void(e.profile,void 0)}default:return}case"object":return i?gu.OBJECT_POINT:gu.OBJECT_POLYGON;case"icon":case"text":return i?gu.ICON_POINT:gu.ICON_POLYGON;default:return}}function iSt(t){const e=fW[t];if(e)return e;const i=bDe(V6e(t,new km({})).levels);return fW[t]=new ff({verticesPerFeature:i}),fW[t]}function bDe(t){return t.reduce((e,i,r)=>e+i.numVertices*(1/10**r),0)/t.reduce((e,i,r)=>e+1/10**r,0)}const gu={ICON_POINT:{bytesPerFeature:2111.586639736967,bytesPerFeatureLabel:870.520855,resourceBytes:0,draped:{bytesPerFeature:1799.2619971817762,bytesPerFeatureLabel:857.4890149999999}},ICON_POLYGON:{bytesPerFeature:2829.8183316810564,bytesPerFeatureLabel:858.0951816666667,resourceBytes:0,draped:{bytesPerFeature:2521.242008227286,bytesPerFeatureLabel:869.6919750000001}},OBJECT_POINT:{bytesPerFeature:607.8007336777831,bytesPerFeatureLabel:715.7017950000001,resourceBytes:0,draped:{bytesPerFeature:607.8007336777831,bytesPerFeatureLabel:715.7017950000001}},OBJECT_POLYGON:{bytesPerFeature:1111.4123028075749,bytesPerFeatureLabel:684.5498416666667,resourceBytes:0,draped:{bytesPerFeature:1111.4123028075749,bytesPerFeatureLabel:684.5498416666667}},LINE_MITER:{bytesPerFeature:3053.034748007272,bytesPerFeatureLabel:804.5473016666666,resourceBytes:0,draped:{bytesPerFeature:2649.5661560225844,bytesPerFeatureLabel:843.3404083333334}},LINE_ROUND:{bytesPerFeature:3225.35183564197,bytesPerFeatureLabel:807.296835,resourceBytes:0,draped:{bytesPerFeature:2650.9229994933276,bytesPerFeatureLabel:861.108335}},PATH_MITER_CIRCLE:{bytesPerFeature:38664.832646351235,bytesPerFeatureLabel:862.95665,resourceBytes:0,draped:{bytesPerFeature:38664.832646351235,bytesPerFeatureLabel:862.95665}},PATH_ROUND_CIRCLE:{bytesPerFeature:42462.97022293504,bytesPerFeatureLabel:851.35885,resourceBytes:0,draped:{bytesPerFeature:42462.97022293504,bytesPerFeatureLabel:851.35885}},PATH_MITER_QUAD:{bytesPerFeature:25558.22153327986,bytesPerFeatureLabel:838.56885,resourceBytes:0,draped:{bytesPerFeature:25558.22153327986,bytesPerFeatureLabel:838.56885}},PATH_ROUND_QUAD:{bytesPerFeature:42274.86801764233,bytesPerFeatureLabel:867.5658500000001,resourceBytes:0,draped:{bytesPerFeature:42274.86801764233,bytesPerFeatureLabel:867.5658500000001}},FILL:{bytesPerFeature:3124.272297197038,bytesPerFeatureLabel:850.6966816666666,resourceBytes:0,draped:{bytesPerFeature:2630.99580851019,bytesPerFeatureLabel:845.464495}},FILL_OUTLINE:{bytesPerFeature:4501.643043274039,bytesPerFeatureLabel:866.3982816666668,resourceBytes:0,draped:{bytesPerFeature:3841.8870233416183,bytesPerFeatureLabel:854.9969683333334}},EXTRUDE:{bytesPerFeature:7545.975968446941,bytesPerFeatureLabel:859.7106016666668,resourceBytes:0,draped:{bytesPerFeature:7545.975968446941,bytesPerFeatureLabel:859.7106016666668}},EXTRUDE_EDGES:{bytesPerFeature:2872.306473115409,bytesPerFeatureLabel:604.556581666667,resourceBytes:0,draped:{bytesPerFeature:2872.306473115409,bytesPerFeatureLabel:604.556581666667}}};var To;(function(t){t[t.RecreateSymbol=0]="RecreateSymbol",t[t.RecreateGraphics=1]="RecreateGraphics",t[t.FastUpdate=2]="FastUpdate"})(To||(To={}));let Ile=class{constructor(e){this.schedule=e,this._abortController=null,this._loadStatus=ep.LOADING,this._loadError=null,this._loader=null,this.logger=null}destroy(){this.abortLoad()}get loadStatus(){return this._loadStatus}load(e,i){return this._loadStatus===ep.LOADED?(e&&e(),this._loader??Promise.resolve()):this._loadStatus===ep.FAILED?(i&&i(this._loadError),this._loader??Promise.resolve()):(this._loader==null&&(this._abortController=new AbortController,this._loader=this.doLoad(this._abortController.signal).then(()=>{this._abortController=null,this._loadStatus=ep.LOADED},r=>{throw this._loadError=r,this._abortController=null,this._loadStatus=ep.FAILED,!sn(r)&&this.logger&&r.message&&this.logger.warn(r.message),r})),this._loader.then(e,i).catch(()=>{}),this._loader)}abortLoad(){this._abortController!=null?this._abortController=gn(this._abortController):this._loadStatus===ep.LOADING&&(this._loadStatus=ep.FAILED),this._loader=null}};var ep;(function(t){t[t.LOADING=0]="LOADING",t[t.LOADED=1]="LOADED",t[t.FAILED=2]="FAILED"})(ep||(ep={}));const pC=Ce.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");let p1=class extends Ile{constructor(e,i,r,n){super(r.schedule),this.symbol=e,this.symbolLayer=i,this._context=r,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1},this._materials=[],this.usedMemory=0,this.logger=pC,this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=n.renderPriority,this._renderPriorityStep=n.renderPriorityStep,this._elevationContext=new VU,this.complexity=this.computeComplexity(),this.ignoreDrivers=n.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=Nye(this._context.renderer)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const i=this._drivenProperties,r=Nye(e);return r.color!==i.color||r.opacity!==i.opacity||r.opacityAlwaysOpaque!==i.opacityAlwaysOpaque||r.size!==i.size}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,i,r,n){const s=e.projectionSuccess,o="polygons"in e?e.polygons:null,l=`${n} geometry failed to be created`;let c=null;s?!this._logGeometryValidationWarnings(i,r,n)&&o&&o.length===0&&r==="rings"&&i.length>0&&i[0].length>2&&(c=`${l} (filled rings should use clockwise winding - try reversing the order of vertices)`):c=`${l} (failed to project geometry to view spatial reference)`,c&&pC.warnOncePerTick(c)}_logGeometryValidationWarnings(e,i,r){const n=`${r} geometry failed to be created`;return!e.length||e.length===1&&!e[0].length?(pC.warnOncePerTick(`${n} (no ${i} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(pC.warnOncePerTick(`${n} (${i} should be defined as a 2D array)`),!0)}_validateGeometry(e,i=null,r=null){if(i!=null&&!i.includes(e.type))return this.logger.warn("unsupported geometry type for "+r+` symbol: ${e.type}`),!1;if(e.type==="point"){const n=e;if(!isFinite(n.x)||!isFinite(n.y))return pC.warn("point coordinate is not a valid number, graphic skipped"),!1}return!0}_defaultElevationInfoNoZ(){return rSt}_defaultElevationInfoZ(){return nSt}_updateElevationContext(){this._elevationInfoOverride!=null?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,i=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||i.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,i=new VU){const r=e.geometry,n=this.getDefaultElevationInfo(r);i.unit=this._elevationContext.unit!=null?this._elevationContext.unit:n.unit,i.mode=this.getGeometryElevationMode(r,n),i.offsetMeters=this._elevationContext.meterUnitOffset??n.offset??0;const s=!this._elevationOptions.supportsOnTheGround&&i.mode==="on-the-ground";s&&(i.mode="relative-to-ground",i.offsetMeters=0);const o=s?l3t:this._elevationContext.featureExpressionInfoContext;return i.updateFeatureExpressionInfoContext(o,e,this._context.layer),i}prepareSymbolLayerPatch(e){}updateGeometry(e,i){return!1}updateTransform(e,i,r,n){return!1}onRemoveGraphic(e){}_getLayerOpacity(){return this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner?this._context.graphicsCoreOwner.fullOpacity??0:this._context.layer.opacity??1}_getCombinedOpacity(e,i=Fye){let r=1;return this.draped||(r*=this._getLayerOpacity()),this._drivenProperties.opacity||(e!=null?r*=e.a:i.hasIntrinsicColor||(r=0)),r}_getCombinedOpacityAndColor(e,i=Fye){const r=this._getCombinedOpacity(e,i);if(this._drivenProperties.color)return w$(null,r);const n=e!=null?qe.toUnitRGB(e):Bv;return w$(n,r)}_getVertexOpacityAndColor(e,i=null){const r=this._drivenProperties.color?e.color:null,n=this._drivenProperties.opacity?e.opacity:null,s=w$(r,n);return i&&(s[0]*=i,s[1]*=i,s[2]*=i,s[3]*=i),s}isFastUpdatesEnabled(){return this._fastUpdates!=null}computeComplexity(){return vDe(this.symbol,this.symbolLayer)}globalPropertyChanged(e,i,r){switch(e){case"opacity":return this.layerOpacityChanged(i,r),!0;case"elevationInfo":{const n=this._elevationContext.mode;return this._updateElevationContext(),this.layerElevationInfoChanged(i,r,n)!==Ys.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(i,r);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,i,r){let n=Ys.UPDATE;return e.forEach(s=>{const o=i(s);if(o!=null){const l=s.graphic;this.setGraphicElevationContext(l,o.elevationContext),o.needsElevationUpdates=r(o.elevationContext.mode)}else n=Ys.RECREATE}),n}applyRendererDiff(e,i){return To.RecreateSymbol}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const i=this._fastUpdates.visualVariables,r=i.size?Om(i.size.field,e):0,n=i.color?Om(i.color.field,e):0,s=i.opacity?Om(i.opacity.field,e):0;return Mi(r,n,s,0)}get draped(){return this._draped}ensureDrapedStatus(e){return this._draped==null?(this._draped=e,!0):(e!==this.draped&&pC.warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>{var i,r,n,s,o,l,c,f;return{size:((r=(i=this._fastUpdates)==null?void 0:i.visualVariables.size)==null?void 0:r.field)??null,color:((s=(n=this._fastUpdates)==null?void 0:n.visualVariables.color)==null?void 0:s.field)??null,opacity:((l=(o=this._fastUpdates)==null?void 0:o.visualVariables.opacity)==null?void 0:l.field)??null,rotation:((f=(c=this._fastUpdates)==null?void 0:c.visualVariables.rotation)==null?void 0:f.field)??null}};return{drivenProperties:this._drivenProperties,getVisVarFields:e}}};function Nye(t){const e={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};return t&&"visualVariables"in t&&t.visualVariables&&t.visualVariables.forEach(i=>{switch(i.type){case"color":if(e.color=!0,i.stops)for(let r=0;r0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(e,i,r=!1){this._emit("attributesChanged",{object:this,geometry:e,attribute:i,sync:r}),Bct(i)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(e){if(this._visible!==e){this._visible=e;for(const i of this._geometries)i.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const e=new EU(S_.MaskOccludee);for(const i of this._geometries)i.occludees=Ote(i.occludees,e);return this._emit("occlusionChanged",this),e}removeOcclude(e){for(const i of this._geometries)i.occludees=Pte(i.occludees,e);this._emit("occlusionChanged",this)}highlight(){const e=new EU(S_.Highlight);for(const i of this._geometries)i.highlights=Ote(i.highlights,e);return this._emit("highlightChanged",this),e}removeHighlight(e){for(const i of this._geometries)i.highlights=Pte(i.highlights,e);this._emit("highlightChanged",this)}getCombinedStaticTransformation(e,i){return nn(i,this.transformation,e.transformation)}getCombinedShaderTransformation(e,i=Qe()){return nn(i,this.effectiveTransformation,e.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=this._bvWorldSpace||new kye,this._validateBoundingVolume(this._bvWorldSpace,x$.WorldSpace)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=this._bvObjectSpace||new kye,this._validateBoundingVolume(this._bvObjectSpace,x$.ObjectSpace)),this._bvObjectSpace}_validateBoundingVolume(e,i){const r=i===x$.ObjectSpace;for(const n of this._geometries){const s=n.boundingInfo;s&&sSt(s,e,r?n.transformation:this.getCombinedShaderTransformation(n))}Qr(e.bounds,e.min,e.max,.5);for(const n of this._geometries){const s=n.boundingInfo;if(s==null)continue;const o=r?n.transformation:this.getCombinedShaderTransformation(n),l=l5(o);bt(zye,s.center,o);const c=Sn(zye,e.bounds),f=s.radius*l;e.bounds[3]=Math.max(e.bounds[3],c+f)}}_invalidateBoundingVolume(){var i;const e=(i=this._bvWorldSpace)==null?void 0:i.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this._parentLayer&&e&&this._parentLayer.notifyObjectBBChanged(this,e)}_emit(e,i){this._parentLayer&&this._parentLayer.events.emit(e,i)}get test(){const e=this;return{hasGeometry:i=>e._geometries.includes(i),getGeometryIndex:i=>e._geometries.indexOf(i)}}},wDe=class{constructor(){this.min=nt(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this.max=nt(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)}isEmpty(){return this.max[0]s.camera.fullViewport),new ft("lineSize",(n,s)=>n.size>0?Math.max(1,n.size)*s.camera.pixelRatio:0),new ln("pixelToNDC",(n,s)=>or(Vye,2/s.camera.fullViewport[2],2/s.camera.fullViewport[3])),new ft("borderSize",(n,s)=>n.borderColor!=null?s.camera.pixelRatio:0),new ln("screenOffset",(n,s)=>or(Vye,n.horizontalScreenOffset*s.camera.pixelRatio,0))),e.varyings.add("coverageSampling","vec4"),e.varyings.add("lineSizes","vec2"),t.multipassEnabled&&e.varyings.add("depth","float"),t.occlusionTestEnabled&&e.include(c6e),t.hasScreenSizePerspective&&Zj(i),i.code.add(V` + `)),e.include(J6e,t),e}const qxt=Object.freeze(Object.defineProperty({__proto__:null,build:uDe},Symbol.toStringTag,{value:"Module"}));let hDe=class dDe extends jle{initializeConfiguration(e,i){super.initializeConfiguration(e,i),i.hasMetallicRoughnessTexture=!1,i.hasEmissionTexture=!1,i.hasOcclusionTexture=!1,i.hasNormalTexture=!1,i.hasModelTransformation=!1,i.normalType=Br.Attribute,i.doubleSidedMode=Ls.WindingOrder,i.hasVertexTangents=!1}initializeProgram(e){return this._initializeProgram(e,dDe.shader)}};hDe.shader=new Ir(qxt,()=>we(()=>Promise.resolve().then(()=>aXt),void 0));let Vm=class extends yx{constructor(e){super(e,Xxt),this.supportsEdges=!0,this._configuration=new Ui,this._vertexBufferLayout=Zxt(this.parameters)}isVisibleForOutput(e){return e!==ue.Shadow&&e!==ue.ShadowExcludeHighlight&&e!==ue.ShadowHighlight||this.parameters.castShadows}isVisible(){const e=this.parameters;if(!super.isVisible()||e.layerOpacity===0)return!1;const{hasInstancedColor:i,hasVertexColors:r,hasSymbolColors:n,vvColor:s}=e,o=e.colorMixMode==="replace",a=e.opacity>0,c=e.externalColor&&e.externalColor[3]>0,p=i||s||n;return r&&p?o||a:r?o?c:a:p?o||a:o?c:a}getConfiguration(e,i){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=this.parameters.verticalOffset!=null,this._configuration.hasScreenSizePerspective=this.parameters.screenSizePerspective!=null,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this.parameters.customDepthTest!=null&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?Ln.None:this.parameters.cullFace,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration.cullAboveGround=i.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=this.parameters.modelTransformation!=null,e!==ue.Color&&e!==ue.Alpha||(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=Ls.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&this.parameters.doubleSidedType==="normal"?Ls.View:this.parameters.doubleSided&&this.parameters.doubleSidedType==="winding-order"?Ls.WindingOrder:Ls.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=i.ssao!=null,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?ti.Schematic:ti.Normal:ti.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.enableOffset=i.camera.relativeElevationfDe(t,e)))}function Gle(t){let e=0,i=0,r=0,n=!1,s=0;const o=new k6e;for(const a of t)a!=null&&(e+=a.verticesPerFeature,i+=a.verticesPerCoordinate,r+=a.drawCallsPerFeature,o.bytesPerFeature+=a.memory.bytesPerFeature,o.bytesPerFeatureLabel+=a.memory.bytesPerFeatureLabel,o.resourceBytes+=a.memory.resourceBytes,o.draped.bytesPerFeature+=a.memory.bytesPerFeature,o.draped.bytesPerFeatureLabel+=a.memory.bytesPerFeatureLabel,n=n||a.estimated,++s);return n?new pxt(s,{verticesPerFeature:e,verticesPerCoordinate:i,drawCallsPerFeature:r,memory:o}):new dxt(s,{verticesPerFeature:e,verticesPerCoordinate:i,drawCallsPerFeature:r,memory:o})}function Bai(t){const e=Gle(t);return e.numComplexities>0&&(e.verticesPerFeature/=e.numComplexities,e.verticesPerCoordinate/=e.numComplexities,e.drawCallsPerFeature/=e.numComplexities,e.memory.bytesPerFeature/=e.numComplexities,e.memory.bytesPerFeatureLabel/=e.numComplexities,e.memory.resourceBytes/=e.numComplexities,e.memory.draped.bytesPerFeature/=e.numComplexities,e.memory.draped.bytesPerFeatureLabel/=e.numComplexities),e}const TW={};function fDe(t,e){var n,s;const i=mDe(t,e),r=Gat(e)?2:0;switch(e.type){case"extrude":return new _f({verticesPerFeature:-12,verticesPerCoordinate:12,drawCallsPerFeature:r,memory:i});case"fill":if(t.type==="mesh-3d")return new _f({drawCallsPerFeature:r,memory:i});if(e.outline!=null&&e.outline.size>0)return new _f({verticesPerFeature:-12,verticesPerCoordinate:9,memory:i});case"water":return new _f({verticesPerFeature:-6,verticesPerCoordinate:3,memory:i});case"line":return new _f({verticesPerFeature:-6,verticesPerCoordinate:6,memory:i});case"object":return(n=e.resource)!=null&&n.href?new kle({verticesPerFeature:100,memory:i}):{...t3t(((s=e.resource)==null?void 0:s.primitive)??Hse),memory:i};case"path":{let o=0,a=0;switch(e.profile){case"circle":o=$6e;break;case"quad":o=4;break;default:return void(e.profile,void 0)}switch(e.join??"simple"){case"round":a=I6e;break;case"miter":case"bevel":a=1;break;default:return}const c=2*o,p=o*a*2,_=p+c;let x=-2*p-c;switch(e.cap){case"none":break;case"butt":case"square":x+=2*(o-1);break;case"round":x+=2*(o*(die-1)*2+o);break;default:return}return new _f({verticesPerFeature:x,verticesPerCoordinate:_,memory:i})}case"text":case"icon":return new _f({verticesPerFeature:6,memory:i});default:return}}function mDe(t,e){const i=t.type==="point-3d";switch(e.type){case"extrude":return e.edges&&e.edges.size>0?vu.EXTRUDE_EDGES:vu.EXTRUDE;case"fill":return e.outline!=null&&e.outline.size>0?vu.FILL_OUTLINE:vu.FILL;case"water":return vu.FILL;case"line":return e.join==="round"?vu.LINE_ROUND:vu.LINE_MITER;case"path":switch(e.join){case"round":switch(e.profile){case"circle":return vu.PATH_ROUND_CIRCLE;case"quad":return vu.PATH_ROUND_QUAD;default:return void(e.profile,void 0)}case"miter":case"bevel":switch(e.profile){case"circle":return vu.PATH_MITER_CIRCLE;case"quad":return vu.PATH_MITER_QUAD;default:return void(e.profile,void 0)}default:return}case"object":return i?vu.OBJECT_POINT:vu.OBJECT_POLYGON;case"icon":case"text":return i?vu.ICON_POINT:vu.ICON_POLYGON;default:return}}function t3t(t){const e=TW[t];if(e)return e;const i=gDe(F6e(t,new Vm({})).levels);return TW[t]=new _f({verticesPerFeature:i}),TW[t]}function gDe(t){return t.reduce((e,i,r)=>e+i.numVertices*(1/10**r),0)/t.reduce((e,i,r)=>e+1/10**r,0)}const vu={ICON_POINT:{bytesPerFeature:2111.586639736967,bytesPerFeatureLabel:870.520855,resourceBytes:0,draped:{bytesPerFeature:1799.2619971817762,bytesPerFeatureLabel:857.4890149999999}},ICON_POLYGON:{bytesPerFeature:2829.8183316810564,bytesPerFeatureLabel:858.0951816666667,resourceBytes:0,draped:{bytesPerFeature:2521.242008227286,bytesPerFeatureLabel:869.6919750000001}},OBJECT_POINT:{bytesPerFeature:607.8007336777831,bytesPerFeatureLabel:715.7017950000001,resourceBytes:0,draped:{bytesPerFeature:607.8007336777831,bytesPerFeatureLabel:715.7017950000001}},OBJECT_POLYGON:{bytesPerFeature:1111.4123028075749,bytesPerFeatureLabel:684.5498416666667,resourceBytes:0,draped:{bytesPerFeature:1111.4123028075749,bytesPerFeatureLabel:684.5498416666667}},LINE_MITER:{bytesPerFeature:3053.034748007272,bytesPerFeatureLabel:804.5473016666666,resourceBytes:0,draped:{bytesPerFeature:2649.5661560225844,bytesPerFeatureLabel:843.3404083333334}},LINE_ROUND:{bytesPerFeature:3225.35183564197,bytesPerFeatureLabel:807.296835,resourceBytes:0,draped:{bytesPerFeature:2650.9229994933276,bytesPerFeatureLabel:861.108335}},PATH_MITER_CIRCLE:{bytesPerFeature:38664.832646351235,bytesPerFeatureLabel:862.95665,resourceBytes:0,draped:{bytesPerFeature:38664.832646351235,bytesPerFeatureLabel:862.95665}},PATH_ROUND_CIRCLE:{bytesPerFeature:42462.97022293504,bytesPerFeatureLabel:851.35885,resourceBytes:0,draped:{bytesPerFeature:42462.97022293504,bytesPerFeatureLabel:851.35885}},PATH_MITER_QUAD:{bytesPerFeature:25558.22153327986,bytesPerFeatureLabel:838.56885,resourceBytes:0,draped:{bytesPerFeature:25558.22153327986,bytesPerFeatureLabel:838.56885}},PATH_ROUND_QUAD:{bytesPerFeature:42274.86801764233,bytesPerFeatureLabel:867.5658500000001,resourceBytes:0,draped:{bytesPerFeature:42274.86801764233,bytesPerFeatureLabel:867.5658500000001}},FILL:{bytesPerFeature:3124.272297197038,bytesPerFeatureLabel:850.6966816666666,resourceBytes:0,draped:{bytesPerFeature:2630.99580851019,bytesPerFeatureLabel:845.464495}},FILL_OUTLINE:{bytesPerFeature:4501.643043274039,bytesPerFeatureLabel:866.3982816666668,resourceBytes:0,draped:{bytesPerFeature:3841.8870233416183,bytesPerFeatureLabel:854.9969683333334}},EXTRUDE:{bytesPerFeature:7545.975968446941,bytesPerFeatureLabel:859.7106016666668,resourceBytes:0,draped:{bytesPerFeature:7545.975968446941,bytesPerFeatureLabel:859.7106016666668}},EXTRUDE_EDGES:{bytesPerFeature:2872.306473115409,bytesPerFeatureLabel:604.556581666667,resourceBytes:0,draped:{bytesPerFeature:2872.306473115409,bytesPerFeatureLabel:604.556581666667}}};var Eo;(function(t){t[t.RecreateSymbol=0]="RecreateSymbol",t[t.RecreateGraphics=1]="RecreateGraphics",t[t.FastUpdate=2]="FastUpdate"})(Eo||(Eo={}));let Hle=class{constructor(e){this.schedule=e,this._abortController=null,this._loadStatus=np.LOADING,this._loadError=null,this._loader=null,this.logger=null}destroy(){this.abortLoad()}get loadStatus(){return this._loadStatus}load(e,i){return this._loadStatus===np.LOADED?(e&&e(),this._loader??Promise.resolve()):this._loadStatus===np.FAILED?(i&&i(this._loadError),this._loader??Promise.resolve()):(this._loader==null&&(this._abortController=new AbortController,this._loader=this.doLoad(this._abortController.signal).then(()=>{this._abortController=null,this._loadStatus=np.LOADED},r=>{throw this._loadError=r,this._abortController=null,this._loadStatus=np.FAILED,!on(r)&&this.logger&&r.message&&this.logger.warn(r.message),r})),this._loader.then(e,i).catch(()=>{}),this._loader)}abortLoad(){this._abortController!=null?this._abortController=vn(this._abortController):this._loadStatus===np.LOADING&&(this._loadStatus=np.FAILED),this._loader=null}};var np;(function(t){t[t.LOADING=0]="LOADING",t[t.LOADED=1]="LOADED",t[t.FAILED=2]="FAILED"})(np||(np={}));const _C=Ce.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");let w1=class extends Hle{constructor(e,i,r,n){super(r.schedule),this.symbol=e,this.symbolLayer=i,this._context=r,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1},this._materials=[],this.usedMemory=0,this.logger=_C,this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=n.renderPriority,this._renderPriorityStep=n.renderPriorityStep,this._elevationContext=new BU,this.complexity=this.computeComplexity(),this.ignoreDrivers=n.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=Fye(this._context.renderer)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const i=this._drivenProperties,r=Fye(e);return r.color!==i.color||r.opacity!==i.opacity||r.opacityAlwaysOpaque!==i.opacityAlwaysOpaque||r.size!==i.size}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,i,r,n){const s=e.projectionSuccess,o="polygons"in e?e.polygons:null,a=`${n} geometry failed to be created`;let c=null;s?!this._logGeometryValidationWarnings(i,r,n)&&o&&o.length===0&&r==="rings"&&i.length>0&&i[0].length>2&&(c=`${a} (filled rings should use clockwise winding - try reversing the order of vertices)`):c=`${a} (failed to project geometry to view spatial reference)`,c&&_C.warnOncePerTick(c)}_logGeometryValidationWarnings(e,i,r){const n=`${r} geometry failed to be created`;return!e.length||e.length===1&&!e[0].length?(_C.warnOncePerTick(`${n} (no ${i} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(_C.warnOncePerTick(`${n} (${i} should be defined as a 2D array)`),!0)}_validateGeometry(e,i=null,r=null){if(i!=null&&!i.includes(e.type))return this.logger.warn("unsupported geometry type for "+r+` symbol: ${e.type}`),!1;if(e.type==="point"){const n=e;if(!isFinite(n.x)||!isFinite(n.y))return _C.warn("point coordinate is not a valid number, graphic skipped"),!1}return!0}_defaultElevationInfoNoZ(){return i3t}_defaultElevationInfoZ(){return r3t}_updateElevationContext(){this._elevationInfoOverride!=null?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,i=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||i.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,i=new BU){const r=e.geometry,n=this.getDefaultElevationInfo(r);i.unit=this._elevationContext.unit!=null?this._elevationContext.unit:n.unit,i.mode=this.getGeometryElevationMode(r,n),i.offsetMeters=this._elevationContext.meterUnitOffset??n.offset??0;const s=!this._elevationOptions.supportsOnTheGround&&i.mode==="on-the-ground";s&&(i.mode="relative-to-ground",i.offsetMeters=0);const o=s?axt:this._elevationContext.featureExpressionInfoContext;return i.updateFeatureExpressionInfoContext(o,e,this._context.layer),i}prepareSymbolLayerPatch(e){}updateGeometry(e,i){return!1}updateTransform(e,i,r,n){return!1}onRemoveGraphic(e){}_getLayerOpacity(){return this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner?this._context.graphicsCoreOwner.fullOpacity??0:this._context.layer.opacity??1}_getCombinedOpacity(e,i=kye){let r=1;return this.draped||(r*=this._getLayerOpacity()),this._drivenProperties.opacity||(e!=null?r*=e.a:i.hasIntrinsicColor||(r=0)),r}_getCombinedOpacityAndColor(e,i=kye){const r=this._getCombinedOpacity(e,i);if(this._drivenProperties.color)return R$(null,r);const n=e!=null?qe.toUnitRGB(e):Yv;return R$(n,r)}_getVertexOpacityAndColor(e,i=null){const r=this._drivenProperties.color?e.color:null,n=this._drivenProperties.opacity?e.opacity:null,s=R$(r,n);return i&&(s[0]*=i,s[1]*=i,s[2]*=i,s[3]*=i),s}isFastUpdatesEnabled(){return this._fastUpdates!=null}computeComplexity(){return fDe(this.symbol,this.symbolLayer)}globalPropertyChanged(e,i,r){switch(e){case"opacity":return this.layerOpacityChanged(i,r),!0;case"elevationInfo":{const n=this._elevationContext.mode;return this._updateElevationContext(),this.layerElevationInfoChanged(i,r,n)!==Ys.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(i,r);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,i,r){let n=Ys.UPDATE;return e.forEach(s=>{const o=i(s);if(o!=null){const a=s.graphic;this.setGraphicElevationContext(a,o.elevationContext),o.needsElevationUpdates=r(o.elevationContext.mode)}else n=Ys.RECREATE}),n}applyRendererDiff(e,i){return Eo.RecreateSymbol}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const i=this._fastUpdates.visualVariables,r=i.size?Rm(i.size.field,e):0,n=i.color?Rm(i.color.field,e):0,s=i.opacity?Rm(i.opacity.field,e):0;return Mi(r,n,s,0)}get draped(){return this._draped}ensureDrapedStatus(e){return this._draped==null?(this._draped=e,!0):(e!==this.draped&&_C.warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>{var i,r,n,s,o,a,c,p;return{size:((r=(i=this._fastUpdates)==null?void 0:i.visualVariables.size)==null?void 0:r.field)??null,color:((s=(n=this._fastUpdates)==null?void 0:n.visualVariables.color)==null?void 0:s.field)??null,opacity:((a=(o=this._fastUpdates)==null?void 0:o.visualVariables.opacity)==null?void 0:a.field)??null,rotation:((p=(c=this._fastUpdates)==null?void 0:c.visualVariables.rotation)==null?void 0:p.field)??null}};return{drivenProperties:this._drivenProperties,getVisVarFields:e}}};function Fye(t){const e={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};return t&&"visualVariables"in t&&t.visualVariables&&t.visualVariables.forEach(i=>{switch(i.type){case"color":if(e.color=!0,i.stops)for(let r=0;r0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(e,i,r=!1){this._emit("attributesChanged",{object:this,geometry:e,attribute:i,sync:r}),Oat(i)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(e){if(this._visible!==e){this._visible=e;for(const i of this._geometries)i.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const e=new CU(P_.MaskOccludee);for(const i of this._geometries)i.occludees=Fte(i.occludees,e);return this._emit("occlusionChanged",this),e}removeOcclude(e){for(const i of this._geometries)i.occludees=kte(i.occludees,e);this._emit("occlusionChanged",this)}highlight(){const e=new CU(P_.Highlight);for(const i of this._geometries)i.highlights=Fte(i.highlights,e);return this._emit("highlightChanged",this),e}removeHighlight(e){for(const i of this._geometries)i.highlights=kte(i.highlights,e);this._emit("highlightChanged",this)}getCombinedStaticTransformation(e,i){return sn(i,this.transformation,e.transformation)}getCombinedShaderTransformation(e,i=Qe()){return sn(i,this.effectiveTransformation,e.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=this._bvWorldSpace||new zye,this._validateBoundingVolume(this._bvWorldSpace,I$.WorldSpace)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=this._bvObjectSpace||new zye,this._validateBoundingVolume(this._bvObjectSpace,I$.ObjectSpace)),this._bvObjectSpace}_validateBoundingVolume(e,i){const r=i===I$.ObjectSpace;for(const n of this._geometries){const s=n.boundingInfo;s&&n3t(s,e,r?n.transformation:this.getCombinedShaderTransformation(n))}Qr(e.bounds,e.min,e.max,.5);for(const n of this._geometries){const s=n.boundingInfo;if(s==null)continue;const o=r?n.transformation:this.getCombinedShaderTransformation(n),a=yP(o);bt(Uye,s.center,o);const c=Tn(Uye,e.bounds),p=s.radius*a;e.bounds[3]=Math.max(e.bounds[3],c+p)}}_invalidateBoundingVolume(){var i;const e=(i=this._bvWorldSpace)==null?void 0:i.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this._parentLayer&&e&&this._parentLayer.notifyObjectBBChanged(this,e)}_emit(e,i){this._parentLayer&&this._parentLayer.events.emit(e,i)}get test(){const e=this;return{hasGeometry:i=>e._geometries.includes(i),getGeometryIndex:i=>e._geometries.indexOf(i)}}},yDe=class{constructor(){this.min=st(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this.max=st(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)}isEmpty(){return this.max[0]s.camera.fullViewport),new ft("lineSize",(n,s)=>n.size>0?Math.max(1,n.size)*s.camera.pixelRatio:0),new cn("pixelToNDC",(n,s)=>or(Bye,2/s.camera.fullViewport[2],2/s.camera.fullViewport[3])),new ft("borderSize",(n,s)=>n.borderColor!=null?s.camera.pixelRatio:0),new cn("screenOffset",(n,s)=>or(Bye,n.horizontalScreenOffset*s.camera.pixelRatio,0))),e.varyings.add("coverageSampling","vec4"),e.varyings.add("lineSizes","vec2"),t.multipassEnabled&&e.varyings.add("depth","float"),t.occlusionTestEnabled&&e.include(s6e),t.hasScreenSizePerspective&&oG(i),i.code.add(V` void main(void) { ProjectHUDAux projectAux; vec4 endPoint = projectPositionHUD(projectAux); @@ -2541,7 +2530,7 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) gl_Position = projectedPosition; } - `),r.uniforms.add(new gr("uColor",n=>Uye(n.color)),new gr("borderColor",n=>Uye(n.borderColor))),t.multipassEnabled&&(r.include(R$e,t),r.uniforms.add(new ln("inverseViewport",(n,s)=>s.inverseViewport))),r.code.add(V` + `),r.uniforms.add(new gr("uColor",n=>Vye(n.color)),new gr("borderColor",n=>Vye(n.borderColor))),t.multipassEnabled&&(r.include(A$e,t),r.uniforms.add(new cn("inverseViewport",(n,s)=>s.inverseViewport))),r.code.add(V` void main() { ${t.multipassEnabled?"if( geometryDepthTest(gl_FragCoord.xy * inverseViewport, depth) ){ discard; }":""} @@ -2567,12 +2556,12 @@ metallicRoughnessUV = (metallicRoughnessTextureTransformMatrix * vec3(vuv0, 1.0) fragColor = vec4(finalRgb, finalAlpha); `} } - `),e}function Uye(t){return t??gp}const Vye=yt(),hSt=Object.freeze(Object.defineProperty({__proto__:null,build:ODe},Symbol.toStringTag,{value:"Module"}));let PDe=class RDe extends Hr{initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global}initializeProgram(e){return new Ir(e.rctx,RDe.shader.get().build(this.configuration),Er)}setPipelineState(e){const i=e?Zr.ALWAYS:Zr.LESS;return this.configuration.depthHudEnabled?Ti({depthTest:{func:i},depthWrite:rh}):Ti({blending:Ol(st.ONE,st.SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),depthTest:{func:i},colorWrite:ji})}initializePipeline(){return this.setPipelineState(this.configuration.multipassEnabled)}};PDe.shader=new Rr(hSt,()=>we(()=>Promise.resolve().then(()=>CWt),void 0));let Xp=class extends hu{constructor(){super(...arguments),this.screenCenterOffsetUnitsEnabled=!1,this.spherical=!1,this.occlusionTestEnabled=!0,this.hasVerticalOffset=!1,this.hasScreenSizePerspective=!1,this.depthHudEnabled=!1,this.depthHudAlignStartEnabled=!1,this.hasSlicePlane=!1,this.multipassEnabled=!1}};y([fe()],Xp.prototype,"screenCenterOffsetUnitsEnabled",void 0),y([fe()],Xp.prototype,"spherical",void 0),y([fe()],Xp.prototype,"occlusionTestEnabled",void 0),y([fe()],Xp.prototype,"hasVerticalOffset",void 0),y([fe()],Xp.prototype,"hasScreenSizePerspective",void 0),y([fe()],Xp.prototype,"depthHudEnabled",void 0),y([fe()],Xp.prototype,"depthHudAlignStartEnabled",void 0),y([fe()],Xp.prototype,"hasSlicePlane",void 0),y([fe()],Xp.prototype,"multipassEnabled",void 0),y([fe({constValue:!0})],Xp.prototype,"hasSliceInVertexProgram",void 0),y([fe({constValue:!1})],Xp.prototype,"draped",void 0);let CN=class sie extends hx{get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}constructor(e){super(e,new IDe),this._configuration=new Xp,this._uniqueMaterialIdentifier=sie.uniqueMaterialIdentifier(this.parameters)}getPassParameters(){return this.parameters}getConfiguration(e,i){const r=(i==null?void 0:i.slot)!==ke.LINE_CALLOUTS;return this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=this.parameters.verticalOffset!=null,this._configuration.hasScreenSizePerspective=this.parameters.screenSizePerspective!=null,this._configuration.depthHudEnabled=r,this._configuration.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this._configuration.screenCenterOffsetUnitsEnabled=this.parameters.centerOffsetUnits==="screen",this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration}intersect(){}produces(e,i){if(i===ue.Color)switch(e){case ke.LINE_CALLOUTS:case ke.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return new dSt(e)}createBufferWriter(){return new fSt}validateParameters(e){const i=sie.uniqueMaterialIdentifier(e);i!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=i)}static uniqueMaterialIdentifier(e){return JSON.stringify({horizontalScreenOffset:e.horizontalScreenOffset??0,centerOffsetUnits:e.centerOffsetUnits||"world"})}},dSt=class extends cx{beginSlot(e){return this.ensureTechnique(PDe,e)}},IDe=class extends yle{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=[0,0,0,1],this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.depthHUDAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}};const pSt=ls().vec3f(J.POSITION).vec3f(J.NORMAL).vec2f(J.UV0).vec4f(J.AUXPOS1),Bye=[vf(0,0),vf(1,0),vf(0,1),vf(1,0),vf(1,1),vf(0,1)];let fSt=class{constructor(){this.vertexBufferLayout=pSt}elementCount(e){return 6*e.attributes.get(J.POSITION).indices.length}write(e,i,r,n,s){vle(r.attributes.get(J.POSITION),e,n.position,s,6),_le(r.attributes.get(J.NORMAL),i,n.normal,s,6),M5(r.attributes.get(J.AUXPOS1),n.auxpos1,s,6);for(let o=0;oc.type==="object"||c.type==="text"));if(s.type!=="label-3d"&&o||s.type==="point-3d"&&s.symbolLayers.every(c=>c.type==="text"&&!cOe(c)))return null;const l=wle(r.geometry);return l==null?null:this._createAs3DShape(l,n,i,r.uid)}layerOpacityChanged(){var e;(e=this._materials[0])==null||e.setParameters(this._materialParameters)}layerElevationInfoChanged(e,i,r){const n=this._elevationContext.mode,s=i6(LDe.elevationModeChangeTypes,r,n);return s!==Ys.UPDATE||e.forEach(o=>{const l=i(o);l!=null&&this.updateGraphicElevationContext(o.graphic,l)}),s}slicePlaneEnabledChanged(){var e;return(e=this._materials[0])==null||e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}setGraphicElevationContext(e,i,r=0){return super.setGraphicElevationContext(e,i),i.addOffsetRenderUnits(r),i}updateGraphicElevationContext(e,i){this.setGraphicElevationContext(e,i.elevationContext,i.metadata!=null?i.metadata.elevationOffset:0),i.needsElevationUpdates=t0(i.elevationContext.mode)}computeComplexity(){return new ff({verticesPerFeature:6})}_createVertexData(e){const{translation:i,centerOffset:r}=e,n=new It(i?[i[0],i[1],i[2]]:[0,0,0],mW,3,!0),s=new It(r?[r[0],r[1],r[2],r[3]]:[0,0,0,1],mW,4,!0);return[[J.POSITION,n],[J.NORMAL,new It([0,0,1],mW,3,!0)],[J.AUXPOS1,s]]}_getOrCreateMaterial(e){var n;const i=this._perInstanceMaterialParameters(e),r=CN.uniqueMaterialIdentifier(i);if(r===((n=this._materials[0])==null?void 0:n.uniqueMaterialIdentifier))return{material:this._materials[0],isUnique:!1};if(e.materialCollection!=null){let s=e.materialCollection.get(r);return s==null&&(s=new CN(i),e.materialCollection.add(r,s)),{material:s,isUnique:!1}}return{material:new CN(i),isUnique:!0}}_createAs3DShape(e,i,r,n){const s=this._context.layer.uid,o=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerUid:s}),l=this._getOrCreateMaterial(r),c=new Bo(l.material,this._createVertexData(r),null,Ws.Point,o),f=$le(this._context,e,c,i,n);if(f==null)return null;const _=new d1(this,f.object,[c],l.isUnique?[l.material]:null,null,_T,i);return _.metadata=new D6e(r.elevationOffset),_.alignedSampledElevation=f.sampledElevation,_.needsElevationUpdates=t0(i.mode),zL(_,e,this._context.elevationProvider),_}};$De.elevationModeChangeTypes={definedChanged:Ys.UPDATE,staysOnTheGround:Ys.UPDATE,onTheGroundChanged:Ys.RECREATE};const mW=[0],mSt={mode:"relative-to-ground",offset:0},gSt={ignoreDrivers:!0,renderPriority:0,renderPriorityStep:1};let ySt=class{constructor(e,i,r=W(),n=Xi(),s=0,o="world",l=0,c=null){this.renderer=e,this.symbol=i,this.translation=r,this.centerOffset=n,this.horizontalScreenOffset=s,this.centerOffsetUnits=o,this.elevationOffset=l,this.materialCollection=c}},vSt=class extends c3t{};const jye=Ce.getLogger("esri.views.3d.layers.graphics.Graphics3DCalloutSymbolLayerFactory");function _St(t,e){if(!Vse(t))return jye.error("Graphics3DCalloutSymbolLayerFactory#make",`symbol of type '${t.type}' does not support callouts`),null;if(!t.callout)return null;const i=bSt[t.callout.type];return i?new i(t,e):(jye.error("Graphics3DCalloutSymbolLayerFactory#make",`unknown or unsupported callout type ${t.callout.type}`),null)}const bSt={line:$De},Lle=(t,e,i)=>[e,i],P5=(t,e,i)=>[e,i,t[2]],Dle=(t,e,i)=>[e,i,t[2],t[3]];function qoi(t){return t?{originPosition:t.originPosition==="upper-left"?"upperLeft":t.originPosition==="lower-left"?"lowerLeft":t.originPosition,scale:t.tolerance?[t.tolerance,t.tolerance]:[1,1],translate:t.extent!=null?[t.extent.xmin,t.extent.ymax]:[0,0]}:null}function wSt({scale:t,translate:e},i){return Math.round((i-e[0])/t[0])}function xSt({scale:t,translate:e},i){return Math.round((e[1]-i)/t[1])}function DDe({scale:t,translate:e},i){return i*t[0]+e[0]}function NDe({scale:t,translate:e},i){return e[1]-i*t[1]}function FDe(t,e,i){const r=new Array(i.length);if(!i.length)return r;const[n,s]=t.scale;let o=DDe(t,i[0][0]),l=NDe(t,i[0][1]);r[0]=e(i[0],o,l);for(let c=1;c{const l=CSt(o,e,i,t.objectIdFieldName),c=l.geometry;if(c!=null&&r)switch(c.type){case"point":l.geometry=UDe(r,c,c,c.hasZ,c.hasM);break;case"multipoint":l.geometry=zDe(r,c,c,!!c.hasZ,!!c.hasM);break;case"polygon":l.geometry=VDe(r,c,c,!!c.hasZ,!!c.hasM);break;case"polyline":l.geometry=BDe(r,c,c,!!c.hasZ,!!c.hasM);break;case"extent":case"mesh":l.geometry=c}return l});return{geometryType:e,features:n,spatialReference:i,fields:((s=t.fields)==null?void 0:s.map(o=>moe.fromJSON(o)))??[],objectIdFieldName:t.objectIdFieldName,globalIdFieldName:t.globalIdFieldName,geohashFieldName:t.geohashFieldName,geometryProperties:t.geometryProperties,hasZ:t.hasZ,hasM:t.hasM,exceededTransferLimit:t.exceededTransferLimit,transform:null}}function CSt(t,e,i,r){return{uid:hp(),objectId:r&&t.attributes?t.attributes[r]:null,attributes:t.attributes,geometry:ASt(t.geometry,e,i),visible:!0}}function ASt(t,e,i){if(t==null)return null;switch(e){case"point":{const r=t;return{x:r.x,y:r.y,z:r.z,m:r.m,hasZ:r.z!=null,hasM:r.m!=null,type:"point",spatialReference:i}}case"polyline":{const r=t;return{paths:r.paths,hasZ:!!r.hasZ,hasM:!!r.hasM,type:"polyline",spatialReference:i}}case"polygon":{const r=t;return{rings:r.rings,hasZ:!!r.hasZ,hasM:!!r.hasM,type:"polygon",spatialReference:i}}case"multipoint":{const r=t;return{points:r.points,hasZ:!!r.hasZ,hasM:!!r.hasM,type:"multipoint",spatialReference:i}}}}function MSt(t){if(t==null)return 0;let e=32;switch(t.type){case"point":e+=42;break;case"polyline":case"polygon":{let i=0;const r=2+(t.hasZ?1:0)+(t.hasM?1:0),n=t.type==="polyline"?t.paths:t.rings;for(const s of n)i+=s.length;e+=8*i*r+64,e+=128*i,e+=34,e+=32*(n.length+1);break}case"multipoint":{const i=2+(t.hasZ?1:0)+(t.hasM?1:0),r=t.points.length;e+=8*r*i+64,e+=128*r,e+=34,e+=32;break}case"extent":e+=98,t.hasM&&(e+=32),t.hasZ&&(e+=32);break;case"mesh":e+=l_(t.vertexAttributes.position,t.vertexAttributes.normal,t.vertexAttributes.uv,t.vertexAttributes.tangent)}return e}function eai(t){let e=32;return e+=z3e(t.attributes),e+=3,e+=8+MSt(t.geometry),e}function tai(t){if(t==null)return 0;switch(t.type){case"point":return 1;case"polyline":{let e=0;for(const i of t.paths)e+=i.length;return e}case"polygon":{let e=0;for(const i of t.rings)e+=i.length;return e}case"multipoint":return t.points.length;case"extent":return 2;case"mesh":{const e=t.vertexAttributes&&t.vertexAttributes.position;return e?e.length/3:0}default:return}}function iai(t){if(t==null)return!1;switch(t.type){case"extent":case"point":return!0;case"polyline":for(const e of t.paths)if(e.length>0)return!0;return!1;case"polygon":for(const e of t.rings)if(e.length>0)return!0;return!1;case"multipoint":return t.points.length>0;case"mesh":return!t.loaded||t.vertexAttributes.position.length>0}}function rai(t,e){switch(Bn(e),t.type==="mesh"&&(t=t.extent),t.type){case"point":e[0]=e[3]=t.x,e[1]=e[4]=t.y,t.hasZ&&(e[2]=e[5]=t.z);break;case"polyline":for(let i=0;ie+i)}forEachVertex(e){let i=0;this.lengths.length||e(this.coords[0],this.coords[1]);for(let r=0;r{t[i]=n,t[i+1]=s},Gye=(t,e,i,r,n,s)=>{t[i]=n,t[i+1]=s,t[i+2]=e[r+2]},ISt=(t,e,i,r,n,s)=>{t[i]=n,t[i+1]=s,t[i+2]=e[r+3]},$St=(t,e,i,r,n,s)=>{t[i]=n,t[i+1]=s,t[i+2]=e[r+2],t[i+3]=e[r+3]};function Nle(t,e,i,r){if(t){if(i)return e&&r?$St:Gye;if(e&&r)return ISt}else if(e&&r)return Gye;return RSt}function gW({scale:t,translate:e},i){return Math.round((i-e[0])/t[0])}function yW({scale:t,translate:e},i){return Math.round((e[1]-i)/t[1])}function vW({scale:t,translate:e},i,r){return i*t[r]+e[r]}function lai(t,e,i){return t?e?i?zle(t):Fle(t):i?kle(t):cG(t):null}function cG(t){const e=t.coords;return{x:e[0],y:e[1]}}function qDe(t,e){return t.coords[0]=e.x,t.coords[1]=e.y,t}function Fle(t){const e=t.coords;return{x:e[0],y:e[1],z:e[2]}}function LSt(t,e){return t.coords[0]=e.x,t.coords[1]=e.y,t.coords[2]=e.z,t}function kle(t){const e=t.coords;return{x:e[0],y:e[1],m:e[2]}}function DSt(t,e){return t.coords[0]=e.x,t.coords[1]=e.y,t.coords[2]=e.m,t}function zle(t){const e=t.coords;return{x:e[0],y:e[1],z:e[2],m:e[3]}}function NSt(t,e){return t.coords[0]=e.x,t.coords[1]=e.y,t.coords[2]=e.z,t.coords[3]=e.m,t}function FSt(t,e,i,r){let n=cG;i&&r?n=zle:i?n=Fle:r&&(n=kle);for(const s of e){const{geometry:o,attributes:l}=s,c=o!=null?n(o):null;t.push({attributes:l,geometry:c})}return t}function Ule(t,e){return t&&e?NSt:t?LSt:e?DSt:qDe}function kSt(t,e,i,r,n){const s=Ule(i,r);for(const{geometry:o,attributes:l}of e){const c=o!=null?s(new J2,o):null;t.push(new QT(c,l,null,n?l[n]:void 0))}return t}function cai(t,e,i=Ule(e.z!=null,e.m!=null)){return i(t,e)}function zSt(t,e,i,r){for(const{geometry:n,attributes:s}of e)t.push({attributes:s,geometry:n!=null?WDe(n,i,r):null});return t}function WDe(t,e,i){if(t==null)return null;const r=Mc(e,i),n=[];for(let s=0;s=c&&(t.lengths.push(H),U=k)}return zm(t.coords,U),t.coords.length?t:null}function gai(t,e,i,r,n,s,o=i,l=r){if(t_(t),!(e!=null&&e.coords.length))return null;const c=HDe[n],{coords:f,lengths:_}=e,x=Mc(i,r),T=Mc(i&&o,r&&l),A=Nle(i,r,o,l);if(!_.length)return A(t.coords,f,0,0,f[0],f[1]),t_(t,x,0),t;let M=0;const I=s*s;for(const L of _){if(L=c?t.lengths.push(U):zm(t.coords,F*T),M+=L*x}return t.coords.length?t:null}function XSt(t,e,i,r){const n=t[e],s=t[e+1],o=t[i],l=t[i+1],c=t[r],f=t[r+1];let _=o,x=l,T=c-_,A=f-x;if(T!==0||A!==0){const M=((n-_)*T+(s-x)*A)/(T*T+A*A);M>1?(_=c,x=f):M>0&&(_+=T*M,x+=A*M)}return T=n-_,A=s-x,T*T+A*A}function oie(t,e,i,r,n,s,o){let l,c=r,f=0;for(let _=s+i;_c&&(f=_,c=l);c>r&&(f-s>i&&oie(t,e,i,r,n,s,f),n(t,e,t.length,f,e[f],e[f+1]),o-f>i&&oie(t,e,i,r,n,f,o))}function yai(t,e,i,r){var f;if(!((f=e==null?void 0:e.coords)!=null&&f.length))return null;const n=Mc(i,r);let s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;if(e&&e.coords){const _=e.coords;for(let x=0;x<_.length;x+=n){const T=_[x],A=_[x+1];s=Math.min(s,T),l=Math.max(l,T),o=Math.min(o,A),c=Math.max(c,A)}}return $J(t)?Mrt(t,s,o,l,c):ose(s,o,l,c,t),t}function qye(t,e,i,r,n){const{coords:s,lengths:o}=e,l=Mc(i,r);if(!s.length)return t!==e&&t_(t),t;ky(n);const{originPosition:c,scale:f,translate:_}=n,x=JSt;x.originPosition=c;const T=x.scale;T[0]=f[0]??1,T[1]=-(f[1]??1),T[2]=f[2]??1,T[3]=f[3]??1;const A=x.translate;if(A[0]=_[0]??0,A[1]=_[1]??0,A[2]=_[2]??0,A[3]=_[3]??0,!o.length){for(let I=0;INB(t,WMe),null,10,5),KSt=Ni();let QSt=class{get labelLayers(){return this._labelLayers||Lje}get extent(){return this._extent}get isElevationSource(){return this.layers.some(e=>e==null?void 0:e.isElevationSource)}constructor(e,i,r,n,s){this.graphic=e,this.graphics3DSymbol=i,this.layers=r,this._visibleFlags=Hl.ALL_LABEL,this.deconflictionPriority=0,++i.referenced,this._featureExpressionFeature=s?R6e(s,e,n):null}initialize(e){this._layer=e,this._forEachSymbolLayerGraphic(i=>{i.initialize(e),i.setVisibility(this.isVisible())})}destroy(){this._forEachSymbolLayerGraphic(e=>e.destroy()),this._calloutLayer=null,--this.graphics3DSymbol.referenced,this.graphics3DSymbol=null}get destroyed(){return this.layers==null}clearLabelGraphics(){this._forEachLabelGraphic(e=>e.destroy()),this._labelLayers=null}addLabelGraphic(e,i){this._labelLayers||(this._labelLayers=new Array),this._labelLayers.push(e),e.initialize(i),e.setVisibility(this.isVisible(Ya.LABEL))}setCalloutGraphic(e){this._calloutLayer=e,this._layer&&(e.initialize(this._layer),e.setVisibility(this.isVisible()))}get calloutLayer(){return this._calloutLayer}get isDraped(){let e=!1;return this._forEachSymbolLayerGraphic(i=>{i.type==="draped"&&(e=!0)}),e}isVisible(e=Ya.GRAPHIC,i){const r=i?this._visibleFlags|i|Ya.LABEL*i:this._visibleFlags;return e===Ya.GRAPHIC?(r&Hl.ALL_GRAPHIC)===Hl.ALL_GRAPHIC:(r&Hl.ALL_LABEL)===Hl.ALL_LABEL}setVisibilityFlag(e,i,r){const n=this.isVisible(e);r?this._visibleFlags|=e*i:this._visibleFlags&=~(e*i);const s=this.isVisible(e);if(n===s)return!1;if(e===Ya.LABEL)this._forEachLabelGraphic(o=>o.setVisibility(s));else{this._forEachSymbolLayerGraphic(l=>l.setVisibility(s));const o=this.isVisible(Ya.LABEL);this._forEachLabelGraphic(l=>l.setVisibility(o))}return!0}getVisibilityFlag(e,i){return(this._visibleFlags&e*i)!=0}computeExtent(e){if(!this._extent){const i=this.graphic.geometry;if(i==null)return!1;this._extent=Ni(),OSt(i,this._extent);const r=i.spatialReference;if(!Zn(r,e)&&!mj(this._extent,r,this._extent,e))return this._extent=null,!1}return!0}getAsOptimizedGeometry(e,i){return this._optimizedGeometry||(this._optimizedGeometry=this._convertGraphicToOptimizedGeometry(this.graphic,e,i)),this._optimizedGeometry}_convertGraphicToOptimizedGeometry(e,i,r){let n=e.geometry;return n.type!=="mesh"&&n.type!=="extent"||(n=Qa.fromExtent(n.type==="mesh"?n.extent:n)),qSt(n,i,r)}get usedMemory(){let e=z3e(this.graphic.attributes);return this._forEachSymbolLayerGraphic(i=>e+=i.graphics3DSymbolLayer.usedMemory),e}computeAttachmentOrigin(){const e={render:{origin:W(),num:0},draped:{origin:yt(),num:0}};for(const i of this.layers)i!=null&&i.computeAttachmentOrigin(e);return e.render.num>1&&De(e.render.origin,e.render.origin,1/e.render.num),e.draped.num>1&&Gu(e.draped.origin,e.draped.origin,1/e.draped.num),e}async getProjectedBoundingBox(e,i,r,n,s){return s||(s={boundingBox:null,requiresDrapedElevation:!1,screenSpaceObjects:[]}),s.boundingBox?Bn(s.boundingBox):s.boundingBox=Bn(),s.requiresDrapedElevation=!1,await JV(this.layers,async o=>{if(o==null)return;const l=o.type==="draped"?i:e,c=Wye.acquire(),f=await o.getProjectedBoundingBox(l,r,s.screenSpaceObjects,n,c);isFinite(f[2])&&isFinite(f[5])||(s.requiresDrapedElevation=!0),f&&ZO(s.boundingBox,c),Wye.release(c)}),Crt(s.boundingBox)||qZ(Lse(s.boundingBox,KSt))?s:null}needsElevationUpdates(){var e;for(const i of this.layers)if(i!=null&&(i.type==="object3d"||i.type==="lod-instance")&&i.needsElevationUpdates)return!0;return((e=this._labelLayers)==null?void 0:e.some(i=>(i==null?void 0:i.needsElevationUpdates)??!1))??!1}alignWithElevation(e,i,r){this._forEachRenderedGraphic(n=>{n.type!=="object3d"&&n.type!=="lod-instance"||n.alignWithElevation(e,i,this._featureExpressionFeature,r)})}alignWithAbsoluteElevation(e,i,r){this._forEachRenderedGraphic(n=>{n.type==="object3d"&&n.alignWithAbsoluteElevation(e,i,r)})}addObjectStateSet(e,i){this._forEachSymbolLayerGraphic(r=>r.addObjectState(e,i))}removeObjectState(e){this._forEachSymbolLayerGraphic(i=>i.removeObjectState(e))}_forEachGraphicList(e,i){e==null||e.forEach(r=>r&&i(r))}_forEachSymbolLayerGraphic(e){this._forEachGraphicList(this.layers,e),this._calloutLayer&&e(this._calloutLayer)}_forEachLabelGraphic(e){this._forEachGraphicList(this._labelLayers,e)}_forEachRenderedGraphic(e){this._forEachSymbolLayerGraphic(e),this._forEachLabelGraphic(e)}get test(){const e=this;return{addLabelLayer:i=>{e._labelLayers||(e._labelLayers=new Array),e._labelLayers.push(i)}}}},wai=class{constructor(e,i){this.scheduler=e,this.schedule=i,this.sharedResources=null,this.streamDataRequester=null,this.elevationProvider=null,this.renderer=null,this.stage=null,this.clippingExtent=null,this.renderCoordsHelper=null,this.overlaySR=null,this.layer=null,this.drapeSourceRenderer=null,this.graphicsCoreOwner=null,this.localOriginFactory=null,this.featureExpressionInfoContext=null,this.screenSizePerspectiveEnabled=!0,this.slicePlaneEnabled=!1,this.physicalBasedRenderingEnabled=!1,this.skipHighSymbolLods=!1,this.isAsync=!1}},eTt=class{constructor(){this.renderPriority=0,this.renderPriorityStep=1,this.ignoreDrivers=!1}};var Yye,Xye,Zye,aie={exports:{}};aie.exports,Yye=aie,Xye=function(){function t(te,le,de){de=de||2;var ve,Se,Ae,Pe,Ge,ut,Ft,Qt=le&&le.length,At=Qt?le[0]*de:te.length,ri=e(te,0,At,de,!0),Rt=[];if(!ri||ri.next===ri.prev)return Rt;if(Qt&&(ri=c(te,le,ri,de)),te.length>80*de){ve=Ae=te[0],Se=Pe=te[1];for(var dt=de;dtAe&&(Ae=Ge),ut>Pe&&(Pe=ut);Ft=(Ft=Math.max(Ae-ve,Pe-Se))!==0?1/Ft:0}return r(ri,Rt,de,ve,Se,Ft),Rt}function e(te,le,de,ve,Se){var Ae,Pe;if(Se===Ee(te,le,de,ve)>0)for(Ae=le;Ae=le;Ae-=ve)Pe=be(Ae,te[Ae],te[Ae+1],Pe);if(Pe&&j(Pe,Pe.next)){var Ge=Pe.next;ye(Pe),Pe=Ge}return Pe}function i(te,le){if(!te)return te;le||(le=te);var de,ve=te;do if(de=!1,ve.steiner||!j(ve,ve.next)&&U(ve.prev,ve,ve.next)!==0)ve=ve.next;else{var Se=ve.prev;if(ye(ve),(ve=le=Se)===ve.next)break;de=!0}while(de||ve!==le);return le}function r(te,le,de,ve,Se,Ae,Pe){if(te){!Pe&&Ae&&M(te,ve,Se,Ae);for(var Ge,ut,Ft=te;te.prev!==te.next;)if(Ge=te.prev,ut=te.next,Ae?s(te,ve,Se,Ae):n(te))le.push(Ge.i/de),le.push(te.i/de),le.push(ut.i/de),ye(te),te=ut.next,Ft=ut.next;else if((te=ut)===Ft){Pe?Pe===1?r(te=o(i(te),le,de),le,de,ve,Se,Ae,2):Pe===2&&l(te,le,de,ve,Se,Ae):r(i(te),le,de,ve,Se,Ae,1);break}}}function n(te){var le=te.prev,de=te,ve=te.next;if(U(le,de,ve)>=0)return!1;for(var Se=te.next.next;Se!==te.prev;){if(z(le.x,le.y,de.x,de.y,ve.x,ve.y,Se.x,Se.y)&&U(Se.prev,Se,Se.next)>=0)return!1;Se=Se.next}return!0}function s(te,le,de,ve){var Se=te.prev,Ae=te,Pe=te.next;if(U(Se,Ae,Pe)>=0)return!1;for(var Ge=Se.xAe.x?Se.x>Pe.x?Se.x:Pe.x:Ae.x>Pe.x?Ae.x:Pe.x,Qt=Se.y>Ae.y?Se.y>Pe.y?Se.y:Pe.y:Ae.y>Pe.y?Ae.y:Pe.y,At=L(Ge,ut,le,de,ve),ri=L(Ft,Qt,le,de,ve),Rt=te.prevZ,dt=te.nextZ;Rt&&Rt.z>=At&&dt&&dt.z<=ri;){if(Rt!==te.prev&&Rt!==te.next&&z(Se.x,Se.y,Ae.x,Ae.y,Pe.x,Pe.y,Rt.x,Rt.y)&&U(Rt.prev,Rt,Rt.next)>=0||(Rt=Rt.prevZ,dt!==te.prev&&dt!==te.next&&z(Se.x,Se.y,Ae.x,Ae.y,Pe.x,Pe.y,dt.x,dt.y)&&U(dt.prev,dt,dt.next)>=0))return!1;dt=dt.nextZ}for(;Rt&&Rt.z>=At;){if(Rt!==te.prev&&Rt!==te.next&&z(Se.x,Se.y,Ae.x,Ae.y,Pe.x,Pe.y,Rt.x,Rt.y)&&U(Rt.prev,Rt,Rt.next)>=0)return!1;Rt=Rt.prevZ}for(;dt&&dt.z<=ri;){if(dt!==te.prev&&dt!==te.next&&z(Se.x,Se.y,Ae.x,Ae.y,Pe.x,Pe.y,dt.x,dt.y)&&U(dt.prev,dt,dt.next)>=0)return!1;dt=dt.nextZ}return!0}function o(te,le,de){var ve=te;do{var Se=ve.prev,Ae=ve.next.next;!j(Se,Ae)&&H(Se,ve,ve.next,Ae)&&re(Se,Ae)&&re(Ae,Se)&&(le.push(Se.i/de),le.push(ve.i/de),le.push(Ae.i/de),ye(ve),ye(ve.next),ve=te=Ae),ve=ve.next}while(ve!==te);return i(ve)}function l(te,le,de,ve,Se,Ae){var Pe=te;do{for(var Ge=Pe.next.next;Ge!==Pe.prev;){if(Pe.i!==Ge.i&&k(Pe,Ge)){var ut=ce(Pe,Ge);return Pe=i(Pe,Pe.next),ut=i(ut,ut.next),r(Pe,le,de,ve,Se,Ae),void r(ut,le,de,ve,Se,Ae)}Ge=Ge.next}Pe=Pe.next}while(Pe!==te)}function c(te,le,de,ve){var Se,Ae,Pe,Ge=[];for(Se=0,Ae=le.length;Se=ve.next.y&&ve.next.y!==ve.y){var Ge=ve.x+(Ae-ve.y)*(ve.next.x-ve.x)/(ve.next.y-ve.y);if(Ge<=Se&&Ge>Pe){if(Pe=Ge,Ge===Se){if(Ae===ve.y)return ve;if(Ae===ve.next.y)return ve.next}de=ve.x=ve.x&&ve.x>=Qt&&Se!==ve.x&&z(Aede.x||ve.x===de.x&&A(de,ve)))&&(de=ve,ri=ut)),ve=ve.next;while(ve!==Ft);return de}function A(te,le){return U(te.prev,te,le.prev)<0&&U(le.next,te,te.next)<0}function M(te,le,de,ve){var Se=te;do Se.z===null&&(Se.z=L(Se.x,Se.y,le,de,ve)),Se.prevZ=Se.prev,Se.nextZ=Se.next,Se=Se.next;while(Se!==te);Se.prevZ.nextZ=null,Se.prevZ=null,I(Se)}function I(te){var le,de,ve,Se,Ae,Pe,Ge,ut,Ft=1;do{for(de=te,te=null,Ae=null,Pe=0;de;){for(Pe++,ve=de,Ge=0,le=0;le0||ut>0&&ve;)Ge!==0&&(ut===0||!ve||de.z<=ve.z)?(Se=de,de=de.nextZ,Ge--):(Se=ve,ve=ve.nextZ,ut--),Ae?Ae.nextZ=Se:te=Se,Se.prevZ=Ae,Ae=Se;de=ve}Ae.nextZ=null,Ft*=2}while(Pe>1);return te}function L(te,le,de,ve,Se){return(te=1431655765&((te=858993459&((te=252645135&((te=16711935&((te=32767*(te-de)*Se)|te<<8))|te<<4))|te<<2))|te<<1))|(le=1431655765&((le=858993459&((le=252645135&((le=16711935&((le=32767*(le-ve)*Se)|le<<8))|le<<4))|le<<2))|le<<1))<<1}function F(te){var le=te,de=te;do(le.x=0&&(te-Pe)*(ve-Ge)-(de-Pe)*(le-Ge)>=0&&(de-Pe)*(Ae-Ge)-(Se-Pe)*(ve-Ge)>=0}function k(te,le){return te.next.i!==le.i&&te.prev.i!==le.i&&!ne(te,le)&&(re(te,le)&&re(le,te)&&he(te,le)&&(U(te.prev,te,le.prev)||U(te,le.prev,le))||j(te,le)&&U(te.prev,te,te.next)>0&&U(le.prev,le,le.next)>0)}function U(te,le,de){return(le.y-te.y)*(de.x-le.x)-(le.x-te.x)*(de.y-le.y)}function j(te,le){return te.x===le.x&&te.y===le.y}function H(te,le,de,ve){var Se=Q(U(te,le,de)),Ae=Q(U(te,le,ve)),Pe=Q(U(de,ve,te)),Ge=Q(U(de,ve,le));return Se!==Ae&&Pe!==Ge||!(Se!==0||!Y(te,de,le))||!(Ae!==0||!Y(te,ve,le))||!(Pe!==0||!Y(de,te,ve))||!(Ge!==0||!Y(de,le,ve))}function Y(te,le,de){return le.x<=Math.max(te.x,de.x)&&le.x>=Math.min(te.x,de.x)&&le.y<=Math.max(te.y,de.y)&&le.y>=Math.min(te.y,de.y)}function Q(te){return te>0?1:te<0?-1:0}function ne(te,le){var de=te;do{if(de.i!==te.i&&de.next.i!==te.i&&de.i!==le.i&&de.next.i!==le.i&&H(de,de.next,te,le))return!0;de=de.next}while(de!==te);return!1}function re(te,le){return U(te.prev,te,te.next)<0?U(te,le,te.next)>=0&&U(te,te.prev,le)>=0:U(te,le,te.prev)<0||U(te,te.next,le)<0}function he(te,le){var de=te,ve=!1,Se=(te.x+le.x)/2,Ae=(te.y+le.y)/2;do de.y>Ae!=de.next.y>Ae&&de.next.y!==de.y&&Se<(de.next.x-de.x)*(Ae-de.y)/(de.next.y-de.y)+de.x&&(ve=!ve),de=de.next;while(de!==te);return ve}function ce(te,le){var de=new pe(te.i,te.x,te.y),ve=new pe(le.i,le.x,le.y),Se=te.next,Ae=le.prev;return te.next=le,le.prev=te,de.next=Se,Se.prev=de,ve.next=de,de.prev=ve,Ae.next=ve,ve.prev=Ae,ve}function be(te,le,de,ve){var Se=new pe(te,le,de);return ve?(Se.next=ve.next,Se.prev=ve,ve.next.prev=Se,ve.next=Se):(Se.prev=Se,Se.next=Se),Se}function ye(te){te.next.prev=te.prev,te.prev.next=te.next,te.prevZ&&(te.prevZ.nextZ=te.nextZ),te.nextZ&&(te.nextZ.prevZ=te.prevZ)}function pe(te,le,de){this.i=te,this.x=le,this.y=de,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ee(te,le,de,ve){for(var Se=0,Ae=le,Pe=de-ve;Ae0&&(ve+=te[Se-1].length,de.holes.push(ve))}return de},t},(Zye=Xye())!==void 0&&(Yye.exports=Zye);const R5=oP(aie.exports),uG=Ce.getLogger("esri.views.3d.support.buffer.math");function tTt(t,e,i){Um(t.typedBuffer,e.typedBuffer,i,t.typedBufferStride,e.typedBufferStride)}function Um(t,e,i,r=3,n=r){if(t.length/r!==Math.ceil(e.length/n))return uG.error("source and destination buffers need to have the same number of elements"),t;const s=t.length/r,o=i[0],l=i[1],c=i[2],f=i[4],_=i[5],x=i[6],T=i[8],A=i[9],M=i[10],I=i[12],L=i[13],F=i[14];let z=0,k=0;for(let U=0;U0){const T=1/Math.sqrt(x);t[o]=T*c,t[o+1]=T*f,t[o+2]=T*_}s+=r,o+=i}}function nTt(t,e,i){const r=Math.min(t.count,e.count),n=t.typedBuffer,s=t.typedBufferStride,o=e.typedBuffer,l=e.typedBufferStride;let c=0,f=0;for(let _=0;_>i,n[f+1]=o[c+1]>>i,n[f+2]=o[c+2]>>i,c+=l,f+=s}Object.freeze(Object.defineProperty({__proto__:null,normalize:hG,normalizeView:rTt,scale:jU,scaleView:iTt,shiftRight:nTt,transformMat3:Vm,transformMat3View:tNe,transformMat4:Um,transformMat4View:tTt},Symbol.toStringTag,{value:"Module"}));function sTt(t,e,i){return{objectId:t,target:e,distance:i,type:"vertex"}}function Jye(t,e,i,r,n,s=!1){return{objectId:t,target:e,distance:i,type:"edge",start:r,end:n,draped:s}}function dG(t,e){if(!t||t.symbol)return null;const i=e==null?void 0:e.renderer;return t&&i!=null&&i.getObservationRenderer?i.getObservationRenderer(t):i}function oTt(t,e){if(t.symbol!=null)return t.symbol;const i=dG(t,e);return i!=null&&i.type!=="dot-density"?i.getSymbol(t,e):null}function Tai(t,e){const i=dG(t,e),r=oTt(t,e);if(r==null)return null;const n={renderer:i,symbol:r};if(i==null||!("visualVariables"in i)||!i.visualVariables)return n;const s=qse(i,t,e)??[],o=["proportional","proportional","proportional"];for(const{variable:l,value:c}of s)switch(l.type){case"color":n.color=c.toRgba();break;case"size":if(l.target==="outline")n.outlineSize=c;else{const f=l.axis,_=l.useSymbolValue?"symbol-value":c;switch(f){case"width":o[0]=_;break;case"depth":o[1]=_;break;case"height":o[2]=_;break;case"width-and-depth":o[0]=o[1]=_;break;default:o[0]=o[1]=o[2]=_}}break;case"opacity":n.opacity=c;break;case"rotation":switch(l.axis){case"tilt":n.tilt=c;break;case"roll":n.roll=c;break;default:n.heading=c}}return o[0]==="proportional"&&o[1]==="proportional"&&o[2]==="proportional"||(n.size=o),n}async function aTt(t,e){if(t.symbol!=null)return t.symbol;const i=dG(t,e);return i!=null?i.getSymbolAsync(t,e):null}async function Eai(t,e){const i=dG(t,e),r=await aTt(t,e);if(!r)return null;const n={renderer:i,symbol:r};if(!i||!("visualVariables"in i)||!i.visualVariables)return n;const s=qse(i,t,e)??[],o=["proportional","proportional","proportional"];for(const{variable:l,value:c}of s)if(l.type==="color")n.color=qe.toUnitRGBA(c);else if(l.type==="size")if(l.target==="outline")n.outlineSize=c;else{const f=l.axis,_=l.useSymbolValue?"symbol-value":c;f==="width"?o[0]=_:f==="depth"?o[1]=_:f==="height"?o[2]=_:o[0]=o[1]=f==="width-and-depth"?_:o[2]=_}else l.type==="opacity"?n.opacity=c:l.type==="rotation"&&l.axis==="tilt"?n.tilt=c:l.type==="rotation"&&l.axis==="roll"?n.roll=c:l.type==="rotation"&&(n.heading=c);return(isFinite(o[0])||isFinite(o[1])||isFinite(o[2]))&&(n.size=o),n}function lTt(t,e=0){const i=t[e];return typeof i=="number"&&isFinite(i)?i:null}function cTt(t){for(let e=0;e<3;e++){const i=t[e];if(typeof i=="number")return isFinite(i)?i:0}return 0}function uTt(t,e,i,r){const n=(o=>!Array.isArray(o[0]))(e)?(o,l)=>e[3*o+l]:(o,l)=>e[o][l],s=r?ws(r)/Bf(r):1;return koe(t,(o,l)=>Ie(o,n(l,0)*s,n(l,1)*s,n(l,2)),i)}function iNe(t,e,i){const r=uTt(Kye,t,e,i)?Kye:[0,0,1];return Math.abs(r[2])>Math.cos(Ei(80))?Ms.Z:Math.abs(r[1])>Math.abs(r[0])?Ms.Y:Ms.X}const Kye=Fi();function hTt(t,e,i){const r=iNe(t,(e.length>0?e[0]:t.length/3)-1,i);if(r!==Ms.Z){t=t.slice();for(let n=0;n_&&(_=Y)}else _=n;const x=Math.floor(1.1*_)+1;(rg==null||rg.length<2*x)&&(rg=new Uint32Array(SAe(2*x)));for(let H=0;H<2*x;H++)rg[H]=0;let T=0;const A=!!f&&!!l,M=A?c:n;let I=TU(n);const L=new Uint32Array(c),F=1.96;let z=o!==0?Math.ceil(4*F*F/(o*o)*o*(1-o)):M,k=1,U=f?f[1]:M;for(let H=0;H=x&&(re-=x)}he===T&&(rg[2*re]=ne,rg[2*re+1]=Y+1,T++),I[Y]=he}if(o!==0&&1-T/n>>2)|0;return r>>>0}let rg=null;function Aai(t){const e=c6(t.rings,t.hasZ,Ky.CCW_IS_HOLE,t.spatialReference),i=new Array;let r=0,n=0;for(const l of e.polygons){const c=l.count,f=l.index,_=Lf(e.position,3*f,3*c),x=l.holeIndices.map(A=>A-f),T=Py(R5(_,x,3));i.push({position:_,faces:T}),r+=_.length,n+=T.length}const s=mTt(i,r,n),o=Array.isArray(s.position)?lie(s.position,3,{originalIndices:s.faces}):lie(s.position.buffer,6,{originalIndices:s.faces});return s.position=yLe(new Float64Array(o.buffer)),s.faces=o.indices,s}function mTt(t,e,i){if(t.length===1)return t[0];const r=Ja(e),n=new Array(i);let s=0,o=0,l=0;for(const c of t){for(let f=0;f=0;M--){const I=t[M],L=i===Ky.CCW_IS_HOLE&&gTt(I,e,r);if(L&&n!==1)s[c++]=I;else{let F=I.length;for(let k=0;k0&&(l[_++]={index:A,count:I.length}),A=L?AN(I,I.length-1,-1,T,A,I.length,e):AN(I,0,1,T,A,I.length,e);for(let k=0;k0&&(l[_++]={index:A,count:U.length}),A=AN(U,0,1,T,A,U.length,e)}c=0,z.count>0&&(o[f++]=z)}}for(let M=0;M0&&(l[_++]={index:A,count:I.length}),A=AN(I,0,1,T,A,I.length,e)}return o.length=f,l.length=_,{position:T,polygons:o,outlines:l}}function AN(t,e,i,r,n,s,o){n*=3;for(let l=0;l=e.max){const r=this.canvasGeometries.extents[this.canvasGeometries.numViews++];Fz(this._extent,-e.range,0,r)}}setupGeometryViewsDirect(){this.canvasGeometries.numViews=1,d_(this.canvasGeometries.extents[0],this._extent)}hasSomeSizedView(){for(let e=0;ei.valid?e|=1<we(()=>Promise.resolve().then(()=>lXt),void 0));let ef=class extends pu{constructor(){super(...arguments),this.screenCenterOffsetUnitsEnabled=!1,this.spherical=!1,this.occlusionTestEnabled=!0,this.hasVerticalOffset=!1,this.hasScreenSizePerspective=!1,this.depthHudEnabled=!1,this.depthHudAlignStartEnabled=!1,this.hasSlicePlane=!1,this.multipassEnabled=!1}};y([fe()],ef.prototype,"screenCenterOffsetUnitsEnabled",void 0),y([fe()],ef.prototype,"spherical",void 0),y([fe()],ef.prototype,"occlusionTestEnabled",void 0),y([fe()],ef.prototype,"hasVerticalOffset",void 0),y([fe()],ef.prototype,"hasScreenSizePerspective",void 0),y([fe()],ef.prototype,"depthHudEnabled",void 0),y([fe()],ef.prototype,"depthHudAlignStartEnabled",void 0),y([fe()],ef.prototype,"hasSlicePlane",void 0),y([fe()],ef.prototype,"multipassEnabled",void 0),y([fe({constValue:!0})],ef.prototype,"hasSliceInVertexProgram",void 0),y([fe({constValue:!1})],ef.prototype,"draped",void 0);let $N=class pie extends yx{get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}constructor(e){super(e,new MDe),this._configuration=new ef,this._uniqueMaterialIdentifier=pie.uniqueMaterialIdentifier(this.parameters)}getPassParameters(){return this.parameters}getConfiguration(e,i){const r=(i==null?void 0:i.slot)!==ke.LINE_CALLOUTS;return this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=this.parameters.verticalOffset!=null,this._configuration.hasScreenSizePerspective=this.parameters.screenSizePerspective!=null,this._configuration.depthHudEnabled=r,this._configuration.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this._configuration.screenCenterOffsetUnitsEnabled=this.parameters.centerOffsetUnits==="screen",this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration}intersect(){}produces(e,i){if(i===ue.Color)switch(e){case ke.LINE_CALLOUTS:case ke.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return new h3t(e)}createBufferWriter(){return new p3t}validateParameters(e){const i=pie.uniqueMaterialIdentifier(e);i!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=i)}static uniqueMaterialIdentifier(e){return JSON.stringify({horizontalScreenOffset:e.horizontalScreenOffset??0,centerOffsetUnits:e.centerOffsetUnits||"world"})}},h3t=class extends fx{beginSlot(e){return this.ensureTechnique(CDe,e)}},MDe=class extends Ple{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=[0,0,0,1],this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.depthHUDAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}};const d3t=ls().vec3f(J.POSITION).vec3f(J.NORMAL).vec2f(J.UV0).vec4f(J.AUXPOS1),jye=[Sf(0,0),Sf(1,0),Sf(0,1),Sf(1,0),Sf(1,1),Sf(0,1)];let p3t=class{constructor(){this.vertexBufferLayout=d3t}elementCount(e){return 6*e.attributes.get(J.POSITION).indices.length}write(e,i,r,n,s){Rle(r.attributes.get(J.POSITION),e,n.position,s,6),Ile(r.attributes.get(J.NORMAL),i,n.normal,s,6),FP(r.attributes.get(J.AUXPOS1),n.auxpos1,s,6);for(let o=0;oc.type==="object"||c.type==="text"));if(s.type!=="label-3d"&&o||s.type==="point-3d"&&s.symbolLayers.every(c=>c.type==="text"&&!$Me(c)))return null;const a=Lle(r.geometry);return a==null?null:this._createAs3DShape(a,n,i,r.uid)}layerOpacityChanged(){var e;(e=this._materials[0])==null||e.setParameters(this._materialParameters)}layerElevationInfoChanged(e,i,r){const n=this._elevationContext.mode,s=a6(PDe.elevationModeChangeTypes,r,n);return s!==Ys.UPDATE||e.forEach(o=>{const a=i(o);a!=null&&this.updateGraphicElevationContext(o.graphic,a)}),s}slicePlaneEnabledChanged(){var e;return(e=this._materials[0])==null||e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}setGraphicElevationContext(e,i,r=0){return super.setGraphicElevationContext(e,i),i.addOffsetRenderUnits(r),i}updateGraphicElevationContext(e,i){this.setGraphicElevationContext(e,i.elevationContext,i.metadata!=null?i.metadata.elevationOffset:0),i.needsElevationUpdates=s0(i.elevationContext.mode)}computeComplexity(){return new _f({verticesPerFeature:6})}_createVertexData(e){const{translation:i,centerOffset:r}=e,n=new $t(i?[i[0],i[1],i[2]]:[0,0,0],EW,3,!0),s=new $t(r?[r[0],r[1],r[2],r[3]]:[0,0,0,1],EW,4,!0);return[[J.POSITION,n],[J.NORMAL,new $t([0,0,1],EW,3,!0)],[J.AUXPOS1,s]]}_getOrCreateMaterial(e){var n;const i=this._perInstanceMaterialParameters(e),r=$N.uniqueMaterialIdentifier(i);if(r===((n=this._materials[0])==null?void 0:n.uniqueMaterialIdentifier))return{material:this._materials[0],isUnique:!1};if(e.materialCollection!=null){let s=e.materialCollection.get(r);return s==null&&(s=new $N(i),e.materialCollection.add(r,s)),{material:s,isUnique:!1}}return{material:new $N(i),isUnique:!0}}_createAs3DShape(e,i,r,n){const s=this._context.layer.uid,o=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerUid:s}),a=this._getOrCreateMaterial(r),c=new jo(a.material,this._createVertexData(r),null,Ws.Point,o),p=qle(this._context,e,c,i,n);if(p==null)return null;const _=new b1(this,p.object,[c],a.isUnique?[a.material]:null,null,CT,i);return _.metadata=new R6e(r.elevationOffset),_.alignedSampledElevation=p.sampledElevation,_.needsElevationUpdates=s0(i.mode),YL(_,e,this._context.elevationProvider),_}};ODe.elevationModeChangeTypes={definedChanged:Ys.UPDATE,staysOnTheGround:Ys.UPDATE,onTheGroundChanged:Ys.RECREATE};const EW=[0],f3t={mode:"relative-to-ground",offset:0},m3t={ignoreDrivers:!0,renderPriority:0,renderPriorityStep:1};let g3t=class{constructor(e,i,r=W(),n=Xi(),s=0,o="world",a=0,c=null){this.renderer=e,this.symbol=i,this.translation=r,this.centerOffset=n,this.horizontalScreenOffset=s,this.centerOffsetUnits=o,this.elevationOffset=a,this.materialCollection=c}},y3t=class extends lxt{};const Gye=Ce.getLogger("esri.views.3d.layers.graphics.Graphics3DCalloutSymbolLayerFactory");function v3t(t,e){if(!Xse(t))return Gye.error("Graphics3DCalloutSymbolLayerFactory#make",`symbol of type '${t.type}' does not support callouts`),null;if(!t.callout)return null;const i=_3t[t.callout.type];return i?new i(t,e):(Gye.error("Graphics3DCalloutSymbolLayerFactory#make",`unknown or unsupported callout type ${t.callout.type}`),null)}const _3t={line:ODe},Wle=(t,e,i)=>[e,i],zP=(t,e,i)=>[e,i,t[2]],Yle=(t,e,i)=>[e,i,t[2],t[3]];function eli(t){return t?{originPosition:t.originPosition==="upper-left"?"upperLeft":t.originPosition==="lower-left"?"lowerLeft":t.originPosition,scale:t.tolerance?[t.tolerance,t.tolerance]:[1,1],translate:t.extent!=null?[t.extent.xmin,t.extent.ymax]:[0,0]}:null}function b3t({scale:t,translate:e},i){return Math.round((i-e[0])/t[0])}function w3t({scale:t,translate:e},i){return Math.round((e[1]-i)/t[1])}function RDe({scale:t,translate:e},i){return i*t[0]+e[0]}function IDe({scale:t,translate:e},i){return e[1]-i*t[1]}function $De(t,e,i){const r=new Array(i.length);if(!i.length)return r;const[n,s]=t.scale;let o=RDe(t,i[0][0]),a=IDe(t,i[0][1]);r[0]=e(i[0],o,a);for(let c=1;c{const a=E3t(o,e,i,t.objectIdFieldName),c=a.geometry;if(c!=null&&r)switch(c.type){case"point":a.geometry=NDe(r,c,c,c.hasZ,c.hasM);break;case"multipoint":a.geometry=DDe(r,c,c,!!c.hasZ,!!c.hasM);break;case"polygon":a.geometry=FDe(r,c,c,!!c.hasZ,!!c.hasM);break;case"polyline":a.geometry=kDe(r,c,c,!!c.hasZ,!!c.hasM);break;case"extent":case"mesh":a.geometry=c}return a});return{geometryType:e,features:n,spatialReference:i,fields:((s=t.fields)==null?void 0:s.map(o=>nj.fromJSON(o)))??[],objectIdFieldName:t.objectIdFieldName,globalIdFieldName:t.globalIdFieldName,geohashFieldName:t.geohashFieldName,geometryProperties:t.geometryProperties,hasZ:t.hasZ,hasM:t.hasM,exceededTransferLimit:t.exceededTransferLimit,transform:null}}function E3t(t,e,i,r){return{uid:mp(),objectId:r&&t.attributes?t.attributes[r]:null,attributes:t.attributes,geometry:C3t(t.geometry,e,i),visible:!0}}function C3t(t,e,i){if(t==null)return null;switch(e){case"point":{const r=t;return{x:r.x,y:r.y,z:r.z,m:r.m,hasZ:r.z!=null,hasM:r.m!=null,type:"point",spatialReference:i}}case"polyline":{const r=t;return{paths:r.paths,hasZ:!!r.hasZ,hasM:!!r.hasM,type:"polyline",spatialReference:i}}case"polygon":{const r=t;return{rings:r.rings,hasZ:!!r.hasZ,hasM:!!r.hasM,type:"polygon",spatialReference:i}}case"multipoint":{const r=t;return{points:r.points,hasZ:!!r.hasZ,hasM:!!r.hasM,type:"multipoint",spatialReference:i}}}}function A3t(t){if(t==null)return 0;let e=32;switch(t.type){case"point":e+=42;break;case"polyline":case"polygon":{let i=0;const r=2+(t.hasZ?1:0)+(t.hasM?1:0),n=t.type==="polyline"?t.paths:t.rings;for(const s of n)i+=s.length;e+=8*i*r+64,e+=128*i,e+=34,e+=32*(n.length+1);break}case"multipoint":{const i=2+(t.hasZ?1:0)+(t.hasM?1:0),r=t.points.length;e+=8*r*i+64,e+=128*r,e+=34,e+=32;break}case"extent":e+=98,t.hasM&&(e+=32),t.hasZ&&(e+=32);break;case"mesh":e+=m_(t.vertexAttributes.position,t.vertexAttributes.normal,t.vertexAttributes.uv,t.vertexAttributes.tangent)}return e}function lli(t){let e=32;return e+=vSe(t.attributes),e+=3,e+=8+A3t(t.geometry),e}function cli(t){if(t==null)return 0;switch(t.type){case"point":return 1;case"polyline":{let e=0;for(const i of t.paths)e+=i.length;return e}case"polygon":{let e=0;for(const i of t.rings)e+=i.length;return e}case"multipoint":return t.points.length;case"extent":return 2;case"mesh":{const e=t.vertexAttributes&&t.vertexAttributes.position;return e?e.length/3:0}default:return}}function uli(t){if(t==null)return!1;switch(t.type){case"extent":case"point":return!0;case"polyline":for(const e of t.paths)if(e.length>0)return!0;return!1;case"polygon":for(const e of t.rings)if(e.length>0)return!0;return!1;case"multipoint":return t.points.length>0;case"mesh":return!t.loaded||t.vertexAttributes.position.length>0}}function hli(t,e){switch(Bn(e),t.type==="mesh"&&(t=t.extent),t.type){case"point":e[0]=e[3]=t.x,e[1]=e[4]=t.y,t.hasZ&&(e[2]=e[5]=t.z);break;case"polyline":for(let i=0;ie+i)}forEachVertex(e){let i=0;this.lengths.length||e(this.coords[0],this.coords[1]);for(let r=0;r{t[i]=n,t[i+1]=s},Hye=(t,e,i,r,n,s)=>{t[i]=n,t[i+1]=s,t[i+2]=e[r+2]},R3t=(t,e,i,r,n,s)=>{t[i]=n,t[i+1]=s,t[i+2]=e[r+3]},I3t=(t,e,i,r,n,s)=>{t[i]=n,t[i+1]=s,t[i+2]=e[r+2],t[i+3]=e[r+3]};function Xle(t,e,i,r){if(t){if(i)return e&&r?I3t:Hye;if(e&&r)return R3t}else if(e&&r)return Hye;return P3t}function CW({scale:t,translate:e},i){return Math.round((i-e[0])/t[0])}function AW({scale:t,translate:e},i){return Math.round((e[1]-i)/t[1])}function MW({scale:t,translate:e},i,r){return i*t[r]+e[r]}function mli(t,e,i){return t?e?i?Kle(t):Zle(t):i?Jle(t):_G(t):null}function _G(t){const e=t.coords;return{x:e[0],y:e[1]}}function jDe(t,e){return t.coords[0]=e.x,t.coords[1]=e.y,t}function Zle(t){const e=t.coords;return{x:e[0],y:e[1],z:e[2]}}function $3t(t,e){return t.coords[0]=e.x,t.coords[1]=e.y,t.coords[2]=e.z,t}function Jle(t){const e=t.coords;return{x:e[0],y:e[1],m:e[2]}}function L3t(t,e){return t.coords[0]=e.x,t.coords[1]=e.y,t.coords[2]=e.m,t}function Kle(t){const e=t.coords;return{x:e[0],y:e[1],z:e[2],m:e[3]}}function D3t(t,e){return t.coords[0]=e.x,t.coords[1]=e.y,t.coords[2]=e.z,t.coords[3]=e.m,t}function N3t(t,e,i,r){let n=_G;i&&r?n=Kle:i?n=Zle:r&&(n=Jle);for(const s of e){const{geometry:o,attributes:a}=s,c=o!=null?n(o):null;t.push({attributes:a,geometry:c})}return t}function Qle(t,e){return t&&e?D3t:t?$3t:e?L3t:jDe}function F3t(t,e,i,r,n){const s=Qle(i,r);for(const{geometry:o,attributes:a}of e){const c=o!=null?s(new Bm,o):null;t.push(new ix(c,a,null,n?a[n]:void 0))}return t}function gli(t,e,i=Qle(e.z!=null,e.m!=null)){return i(t,e)}function k3t(t,e,i,r){for(const{geometry:n,attributes:s}of e)t.push({attributes:s,geometry:n!=null?GDe(n,i,r):null});return t}function GDe(t,e,i){if(t==null)return null;const r=Rc(e,i),n=[];for(let s=0;s=c&&(t.lengths.push(G),U=k)}return jm(t.coords,U),t.coords.length?t:null}function Sli(t,e,i,r,n,s,o=i,a=r){if(l_(t),!(e!=null&&e.coords.length))return null;const c=BDe[n],{coords:p,lengths:_}=e,x=Rc(i,r),S=Rc(i&&o,r&&a),C=Xle(i,r,o,a);if(!_.length)return C(t.coords,p,0,0,p[0],p[1]),l_(t,x,0),t;let M=0;const P=s*s;for(const $ of _){if($=c?t.lengths.push(U):jm(t.coords,F*S),M+=$*x}return t.coords.length?t:null}function Y3t(t,e,i,r){const n=t[e],s=t[e+1],o=t[i],a=t[i+1],c=t[r],p=t[r+1];let _=o,x=a,S=c-_,C=p-x;if(S!==0||C!==0){const M=((n-_)*S+(s-x)*C)/(S*S+C*C);M>1?(_=c,x=p):M>0&&(_+=S*M,x+=C*M)}return S=n-_,C=s-x,S*S+C*C}function fie(t,e,i,r,n,s,o){let a,c=r,p=0;for(let _=s+i;_c&&(p=_,c=a);c>r&&(p-s>i&&fie(t,e,i,r,n,s,p),n(t,e,t.length,p,e[p],e[p+1]),o-p>i&&fie(t,e,i,r,n,p,o))}function Tli(t,e,i,r){var p;if(!((p=e==null?void 0:e.coords)!=null&&p.length))return null;const n=Rc(i,r);let s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;if(e&&e.coords){const _=e.coords;for(let x=0;x<_.length;x+=n){const S=_[x],C=_[x+1];s=Math.min(s,S),a=Math.max(a,S),o=Math.min(o,C),c=Math.max(c,C)}}return $J(t)?ttt(t,s,o,a,c):tse(s,o,a,c,t),t}function Wye(t,e,i,r,n){const{coords:s,lengths:o}=e,a=Rc(i,r);if(!s.length)return t!==e&&l_(t),t;Gy(n);const{originPosition:c,scale:p,translate:_}=n,x=Z3t;x.originPosition=c;const S=x.scale;S[0]=p[0]??1,S[1]=-(p[1]??1),S[2]=p[2]??1,S[3]=p[3]??1;const C=x.translate;if(C[0]=_[0]??0,C[1]=_[1]??0,C[2]=_[2]??0,C[3]=_[3]??0,!o.length){for(let P=0;PUB(t,yMe),null,10,5),J3t=Ni();let K3t=class{get labelLayers(){return this._labelLayers||_Ge}get extent(){return this._extent}get isElevationSource(){return this.layers.some(e=>e==null?void 0:e.isElevationSource)}constructor(e,i,r,n,s){this.graphic=e,this.graphics3DSymbol=i,this.layers=r,this._visibleFlags=Wl.ALL_LABEL,this.deconflictionPriority=0,++i.referenced,this._featureExpressionFeature=s?A6e(s,e,n):null}initialize(e){this._layer=e,this._forEachSymbolLayerGraphic(i=>{i.initialize(e),i.setVisibility(this.isVisible())})}destroy(){this._forEachSymbolLayerGraphic(e=>e.destroy()),this._calloutLayer=null,--this.graphics3DSymbol.referenced,this.graphics3DSymbol=null}get destroyed(){return this.layers==null}clearLabelGraphics(){this._forEachLabelGraphic(e=>e.destroy()),this._labelLayers=null}addLabelGraphic(e,i){this._labelLayers||(this._labelLayers=new Array),this._labelLayers.push(e),e.initialize(i),e.setVisibility(this.isVisible(Za.LABEL))}setCalloutGraphic(e){this._calloutLayer=e,this._layer&&(e.initialize(this._layer),e.setVisibility(this.isVisible()))}get calloutLayer(){return this._calloutLayer}get isDraped(){let e=!1;return this._forEachSymbolLayerGraphic(i=>{i.type==="draped"&&(e=!0)}),e}isVisible(e=Za.GRAPHIC,i){const r=i?this._visibleFlags|i|Za.LABEL*i:this._visibleFlags;return e===Za.GRAPHIC?(r&Wl.ALL_GRAPHIC)===Wl.ALL_GRAPHIC:(r&Wl.ALL_LABEL)===Wl.ALL_LABEL}setVisibilityFlag(e,i,r){const n=this.isVisible(e);r?this._visibleFlags|=e*i:this._visibleFlags&=~(e*i);const s=this.isVisible(e);if(n===s)return!1;if(e===Za.LABEL)this._forEachLabelGraphic(o=>o.setVisibility(s));else{this._forEachSymbolLayerGraphic(a=>a.setVisibility(s));const o=this.isVisible(Za.LABEL);this._forEachLabelGraphic(a=>a.setVisibility(o))}return!0}getVisibilityFlag(e,i){return(this._visibleFlags&e*i)!=0}computeExtent(e){if(!this._extent){const i=this.graphic.geometry;if(i==null)return!1;this._extent=Ni(),M3t(i,this._extent);const r=i.spatialReference;if(!jn(r,e)&&!wj(this._extent,r,this._extent,e))return this._extent=null,!1}return!0}getAsOptimizedGeometry(e,i){return this._optimizedGeometry||(this._optimizedGeometry=this._convertGraphicToOptimizedGeometry(this.graphic,e,i)),this._optimizedGeometry}_convertGraphicToOptimizedGeometry(e,i,r){let n=e.geometry;return n.type!=="mesh"&&n.type!=="extent"||(n=tl.fromExtent(n.type==="mesh"?n.extent:n)),H3t(n,i,r)}get usedMemory(){let e=vSe(this.graphic.attributes);return this._forEachSymbolLayerGraphic(i=>e+=i.graphics3DSymbolLayer.usedMemory),e}computeAttachmentOrigin(){const e={render:{origin:W(),num:0},draped:{origin:yt(),num:0}};for(const i of this.layers)i!=null&&i.computeAttachmentOrigin(e);return e.render.num>1&&De(e.render.origin,e.render.origin,1/e.render.num),e.draped.num>1&&qu(e.draped.origin,e.draped.origin,1/e.draped.num),e}async getProjectedBoundingBox(e,i,r,n,s){return s||(s={boundingBox:null,requiresDrapedElevation:!1,screenSpaceObjects:[]}),s.boundingBox?Bn(s.boundingBox):s.boundingBox=Bn(),s.requiresDrapedElevation=!1,await HB(this.layers,async o=>{if(o==null)return;const a=o.type==="draped"?i:e,c=Yye.acquire(),p=await o.getProjectedBoundingBox(a,r,s.screenSpaceObjects,n,c);isFinite(p[2])&&isFinite(p[5])||(s.requiresDrapedElevation=!0),p&&sP(s.boundingBox,c),Yye.release(c)}),Qet(s.boundingBox)||kZ(Vse(s.boundingBox,J3t))?s:null}needsElevationUpdates(){var e;for(const i of this.layers)if(i!=null&&(i.type==="object3d"||i.type==="lod-instance")&&i.needsElevationUpdates)return!0;return((e=this._labelLayers)==null?void 0:e.some(i=>(i==null?void 0:i.needsElevationUpdates)??!1))??!1}alignWithElevation(e,i,r){this._forEachRenderedGraphic(n=>{n.type!=="object3d"&&n.type!=="lod-instance"||n.alignWithElevation(e,i,this._featureExpressionFeature,r)})}alignWithAbsoluteElevation(e,i,r){this._forEachRenderedGraphic(n=>{n.type==="object3d"&&n.alignWithAbsoluteElevation(e,i,r)})}addObjectStateSet(e,i){this._forEachSymbolLayerGraphic(r=>r.addObjectState(e,i))}removeObjectState(e){this._forEachSymbolLayerGraphic(i=>i.removeObjectState(e))}_forEachGraphicList(e,i){e==null||e.forEach(r=>r&&i(r))}_forEachSymbolLayerGraphic(e){this._forEachGraphicList(this.layers,e),this._calloutLayer&&e(this._calloutLayer)}_forEachLabelGraphic(e){this._forEachGraphicList(this._labelLayers,e)}_forEachRenderedGraphic(e){this._forEachSymbolLayerGraphic(e),this._forEachLabelGraphic(e)}get test(){const e=this;return{addLabelLayer:i=>{e._labelLayers||(e._labelLayers=new Array),e._labelLayers.push(i)}}}},Mli=class{constructor(e,i){this.scheduler=e,this.schedule=i,this.sharedResources=null,this.streamDataRequester=null,this.elevationProvider=null,this.renderer=null,this.stage=null,this.clippingExtent=null,this.renderCoordsHelper=null,this.overlaySR=null,this.layer=null,this.drapeSourceRenderer=null,this.graphicsCoreOwner=null,this.localOriginFactory=null,this.featureExpressionInfoContext=null,this.screenSizePerspectiveEnabled=!0,this.slicePlaneEnabled=!1,this.physicalBasedRenderingEnabled=!1,this.skipHighSymbolLods=!1,this.isAsync=!1}},Q3t=class{constructor(){this.renderPriority=0,this.renderPriorityStep=1,this.ignoreDrivers=!1}};var Xye,Zye,Jye,mie={exports:{}};mie.exports,Xye=mie,Zye=function(){function t(te,le,de){de=de||2;var be,Se,Ae,Re,Ge,ut,Ft,ei=le&&le.length,Mt=ei?le[0]*de:te.length,ri=e(te,0,Mt,de,!0),It=[];if(!ri||ri.next===ri.prev)return It;if(ei&&(ri=c(te,le,ri,de)),te.length>80*de){be=Ae=te[0],Se=Re=te[1];for(var dt=de;dtAe&&(Ae=Ge),ut>Re&&(Re=ut);Ft=(Ft=Math.max(Ae-be,Re-Se))!==0?1/Ft:0}return r(ri,It,de,be,Se,Ft),It}function e(te,le,de,be,Se){var Ae,Re;if(Se===Ee(te,le,de,be)>0)for(Ae=le;Ae=le;Ae-=be)Re=ve(Ae,te[Ae],te[Ae+1],Re);if(Re&&j(Re,Re.next)){var Ge=Re.next;ge(Re),Re=Ge}return Re}function i(te,le){if(!te)return te;le||(le=te);var de,be=te;do if(de=!1,be.steiner||!j(be,be.next)&&U(be.prev,be,be.next)!==0)be=be.next;else{var Se=be.prev;if(ge(be),(be=le=Se)===be.next)break;de=!0}while(de||be!==le);return le}function r(te,le,de,be,Se,Ae,Re){if(te){!Re&&Ae&&M(te,be,Se,Ae);for(var Ge,ut,Ft=te;te.prev!==te.next;)if(Ge=te.prev,ut=te.next,Ae?s(te,be,Se,Ae):n(te))le.push(Ge.i/de),le.push(te.i/de),le.push(ut.i/de),ge(te),te=ut.next,Ft=ut.next;else if((te=ut)===Ft){Re?Re===1?r(te=o(i(te),le,de),le,de,be,Se,Ae,2):Re===2&&a(te,le,de,be,Se,Ae):r(i(te),le,de,be,Se,Ae,1);break}}}function n(te){var le=te.prev,de=te,be=te.next;if(U(le,de,be)>=0)return!1;for(var Se=te.next.next;Se!==te.prev;){if(z(le.x,le.y,de.x,de.y,be.x,be.y,Se.x,Se.y)&&U(Se.prev,Se,Se.next)>=0)return!1;Se=Se.next}return!0}function s(te,le,de,be){var Se=te.prev,Ae=te,Re=te.next;if(U(Se,Ae,Re)>=0)return!1;for(var Ge=Se.xAe.x?Se.x>Re.x?Se.x:Re.x:Ae.x>Re.x?Ae.x:Re.x,ei=Se.y>Ae.y?Se.y>Re.y?Se.y:Re.y:Ae.y>Re.y?Ae.y:Re.y,Mt=$(Ge,ut,le,de,be),ri=$(Ft,ei,le,de,be),It=te.prevZ,dt=te.nextZ;It&&It.z>=Mt&&dt&&dt.z<=ri;){if(It!==te.prev&&It!==te.next&&z(Se.x,Se.y,Ae.x,Ae.y,Re.x,Re.y,It.x,It.y)&&U(It.prev,It,It.next)>=0||(It=It.prevZ,dt!==te.prev&&dt!==te.next&&z(Se.x,Se.y,Ae.x,Ae.y,Re.x,Re.y,dt.x,dt.y)&&U(dt.prev,dt,dt.next)>=0))return!1;dt=dt.nextZ}for(;It&&It.z>=Mt;){if(It!==te.prev&&It!==te.next&&z(Se.x,Se.y,Ae.x,Ae.y,Re.x,Re.y,It.x,It.y)&&U(It.prev,It,It.next)>=0)return!1;It=It.prevZ}for(;dt&&dt.z<=ri;){if(dt!==te.prev&&dt!==te.next&&z(Se.x,Se.y,Ae.x,Ae.y,Re.x,Re.y,dt.x,dt.y)&&U(dt.prev,dt,dt.next)>=0)return!1;dt=dt.nextZ}return!0}function o(te,le,de){var be=te;do{var Se=be.prev,Ae=be.next.next;!j(Se,Ae)&&G(Se,be,be.next,Ae)&&ie(Se,Ae)&&ie(Ae,Se)&&(le.push(Se.i/de),le.push(be.i/de),le.push(Ae.i/de),ge(be),ge(be.next),be=te=Ae),be=be.next}while(be!==te);return i(be)}function a(te,le,de,be,Se,Ae){var Re=te;do{for(var Ge=Re.next.next;Ge!==Re.prev;){if(Re.i!==Ge.i&&k(Re,Ge)){var ut=ce(Re,Ge);return Re=i(Re,Re.next),ut=i(ut,ut.next),r(Re,le,de,be,Se,Ae),void r(ut,le,de,be,Se,Ae)}Ge=Ge.next}Re=Re.next}while(Re!==te)}function c(te,le,de,be){var Se,Ae,Re,Ge=[];for(Se=0,Ae=le.length;Se=be.next.y&&be.next.y!==be.y){var Ge=be.x+(Ae-be.y)*(be.next.x-be.x)/(be.next.y-be.y);if(Ge<=Se&&Ge>Re){if(Re=Ge,Ge===Se){if(Ae===be.y)return be;if(Ae===be.next.y)return be.next}de=be.x=be.x&&be.x>=ei&&Se!==be.x&&z(Aede.x||be.x===de.x&&C(de,be)))&&(de=be,ri=ut)),be=be.next;while(be!==Ft);return de}function C(te,le){return U(te.prev,te,le.prev)<0&&U(le.next,te,te.next)<0}function M(te,le,de,be){var Se=te;do Se.z===null&&(Se.z=$(Se.x,Se.y,le,de,be)),Se.prevZ=Se.prev,Se.nextZ=Se.next,Se=Se.next;while(Se!==te);Se.prevZ.nextZ=null,Se.prevZ=null,P(Se)}function P(te){var le,de,be,Se,Ae,Re,Ge,ut,Ft=1;do{for(de=te,te=null,Ae=null,Re=0;de;){for(Re++,be=de,Ge=0,le=0;le0||ut>0&&be;)Ge!==0&&(ut===0||!be||de.z<=be.z)?(Se=de,de=de.nextZ,Ge--):(Se=be,be=be.nextZ,ut--),Ae?Ae.nextZ=Se:te=Se,Se.prevZ=Ae,Ae=Se;de=be}Ae.nextZ=null,Ft*=2}while(Re>1);return te}function $(te,le,de,be,Se){return(te=1431655765&((te=858993459&((te=252645135&((te=16711935&((te=32767*(te-de)*Se)|te<<8))|te<<4))|te<<2))|te<<1))|(le=1431655765&((le=858993459&((le=252645135&((le=16711935&((le=32767*(le-be)*Se)|le<<8))|le<<4))|le<<2))|le<<1))<<1}function F(te){var le=te,de=te;do(le.x=0&&(te-Re)*(be-Ge)-(de-Re)*(le-Ge)>=0&&(de-Re)*(Ae-Ge)-(Se-Re)*(be-Ge)>=0}function k(te,le){return te.next.i!==le.i&&te.prev.i!==le.i&&!ne(te,le)&&(ie(te,le)&&ie(le,te)&&he(te,le)&&(U(te.prev,te,le.prev)||U(te,le.prev,le))||j(te,le)&&U(te.prev,te,te.next)>0&&U(le.prev,le,le.next)>0)}function U(te,le,de){return(le.y-te.y)*(de.x-le.x)-(le.x-te.x)*(de.y-le.y)}function j(te,le){return te.x===le.x&&te.y===le.y}function G(te,le,de,be){var Se=Q(U(te,le,de)),Ae=Q(U(te,le,be)),Re=Q(U(de,be,te)),Ge=Q(U(de,be,le));return Se!==Ae&&Re!==Ge||!(Se!==0||!Y(te,de,le))||!(Ae!==0||!Y(te,be,le))||!(Re!==0||!Y(de,te,be))||!(Ge!==0||!Y(de,le,be))}function Y(te,le,de){return le.x<=Math.max(te.x,de.x)&&le.x>=Math.min(te.x,de.x)&&le.y<=Math.max(te.y,de.y)&&le.y>=Math.min(te.y,de.y)}function Q(te){return te>0?1:te<0?-1:0}function ne(te,le){var de=te;do{if(de.i!==te.i&&de.next.i!==te.i&&de.i!==le.i&&de.next.i!==le.i&&G(de,de.next,te,le))return!0;de=de.next}while(de!==te);return!1}function ie(te,le){return U(te.prev,te,te.next)<0?U(te,le,te.next)>=0&&U(te,te.prev,le)>=0:U(te,le,te.prev)<0||U(te,te.next,le)<0}function he(te,le){var de=te,be=!1,Se=(te.x+le.x)/2,Ae=(te.y+le.y)/2;do de.y>Ae!=de.next.y>Ae&&de.next.y!==de.y&&Se<(de.next.x-de.x)*(Ae-de.y)/(de.next.y-de.y)+de.x&&(be=!be),de=de.next;while(de!==te);return be}function ce(te,le){var de=new pe(te.i,te.x,te.y),be=new pe(le.i,le.x,le.y),Se=te.next,Ae=le.prev;return te.next=le,le.prev=te,de.next=Se,Se.prev=de,be.next=de,de.prev=be,Ae.next=be,be.prev=Ae,be}function ve(te,le,de,be){var Se=new pe(te,le,de);return be?(Se.next=be.next,Se.prev=be,be.next.prev=Se,be.next=Se):(Se.prev=Se,Se.next=Se),Se}function ge(te){te.next.prev=te.prev,te.prev.next=te.next,te.prevZ&&(te.prevZ.nextZ=te.nextZ),te.nextZ&&(te.nextZ.prevZ=te.prevZ)}function pe(te,le,de){this.i=te,this.x=le,this.y=de,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ee(te,le,de,be){for(var Se=0,Ae=le,Re=de-be;Ae0&&(be+=te[Se-1].length,de.holes.push(be))}return de},t},(Jye=Zye())!==void 0&&(Xye.exports=Jye);const UP=h5(mie.exports),bG=Ce.getLogger("esri.views.3d.support.buffer.math");function eSt(t,e,i){Gm(t.typedBuffer,e.typedBuffer,i,t.typedBufferStride,e.typedBufferStride)}function Gm(t,e,i,r=3,n=r){if(t.length/r!==Math.ceil(e.length/n))return bG.error("source and destination buffers need to have the same number of elements"),t;const s=t.length/r,o=i[0],a=i[1],c=i[2],p=i[4],_=i[5],x=i[6],S=i[8],C=i[9],M=i[10],P=i[12],$=i[13],F=i[14];let z=0,k=0;for(let U=0;U0){const S=1/Math.sqrt(x);t[o]=S*c,t[o+1]=S*p,t[o+2]=S*_}s+=r,o+=i}}function rSt(t,e,i){const r=Math.min(t.count,e.count),n=t.typedBuffer,s=t.typedBufferStride,o=e.typedBuffer,a=e.typedBufferStride;let c=0,p=0;for(let _=0;_>i,n[p+1]=o[c+1]>>i,n[p+2]=o[c+2]>>i,c+=a,p+=s}Object.freeze(Object.defineProperty({__proto__:null,normalize:wG,normalizeView:iSt,scale:GU,scaleView:tSt,shiftRight:rSt,transformMat3:Hm,transformMat3View:KDe,transformMat4:Gm,transformMat4View:eSt},Symbol.toStringTag,{value:"Module"}));function nSt(t,e,i){return{objectId:t,target:e,distance:i,type:"vertex"}}function Kye(t,e,i,r,n,s=!1){return{objectId:t,target:e,distance:i,type:"edge",start:r,end:n,draped:s}}function xG(t,e){if(!t||t.symbol)return null;const i=e==null?void 0:e.renderer;return t&&i!=null&&i.getObservationRenderer?i.getObservationRenderer(t):i}function sSt(t,e){if(t.symbol!=null)return t.symbol;const i=xG(t,e);return i!=null&&i.type!=="dot-density"?i.getSymbol(t,e):null}function Rli(t,e){const i=xG(t,e),r=sSt(t,e);if(r==null)return null;const n={renderer:i,symbol:r};if(i==null||!("visualVariables"in i)||!i.visualVariables)return n;const s=roe(i,t,e)??[],o=["proportional","proportional","proportional"];for(const{variable:a,value:c}of s)switch(a.type){case"color":n.color=c.toRgba();break;case"size":if(a.target==="outline")n.outlineSize=c;else{const p=a.axis,_=a.useSymbolValue?"symbol-value":c;switch(p){case"width":o[0]=_;break;case"depth":o[1]=_;break;case"height":o[2]=_;break;case"width-and-depth":o[0]=o[1]=_;break;default:o[0]=o[1]=o[2]=_}}break;case"opacity":n.opacity=c;break;case"rotation":switch(a.axis){case"tilt":n.tilt=c;break;case"roll":n.roll=c;break;default:n.heading=c}}return o[0]==="proportional"&&o[1]==="proportional"&&o[2]==="proportional"||(n.size=o),n}async function oSt(t,e){if(t.symbol!=null)return t.symbol;const i=xG(t,e);return i!=null?i.getSymbolAsync(t,e):null}async function Ili(t,e){const i=xG(t,e),r=await oSt(t,e);if(!r)return null;const n={renderer:i,symbol:r};if(!i||!("visualVariables"in i)||!i.visualVariables)return n;const s=roe(i,t,e)??[],o=["proportional","proportional","proportional"];for(const{variable:a,value:c}of s)if(a.type==="color")n.color=qe.toUnitRGBA(c);else if(a.type==="size")if(a.target==="outline")n.outlineSize=c;else{const p=a.axis,_=a.useSymbolValue?"symbol-value":c;p==="width"?o[0]=_:p==="depth"?o[1]=_:p==="height"?o[2]=_:o[0]=o[1]=p==="width-and-depth"?_:o[2]=_}else a.type==="opacity"?n.opacity=c:a.type==="rotation"&&a.axis==="tilt"?n.tilt=c:a.type==="rotation"&&a.axis==="roll"?n.roll=c:a.type==="rotation"&&(n.heading=c);return(isFinite(o[0])||isFinite(o[1])||isFinite(o[2]))&&(n.size=o),n}function aSt(t,e=0){const i=t[e];return typeof i=="number"&&isFinite(i)?i:null}function lSt(t){for(let e=0;e<3;e++){const i=t[e];if(typeof i=="number")return isFinite(i)?i:0}return 0}function cSt(t,e,i,r){const n=(o=>!Array.isArray(o[0]))(e)?(o,a)=>e[3*o+a]:(o,a)=>e[o][a],s=r?xs(r)/ad(r):1;return Yoe(t,(o,a)=>Ie(o,n(a,0)*s,n(a,1)*s,n(a,2)),i)}function QDe(t,e,i){const r=cSt(Qye,t,e,i)?Qye:[0,0,1];return Math.abs(r[2])>Math.cos(Ei(80))?Os.Z:Math.abs(r[1])>Math.abs(r[0])?Os.Y:Os.X}const Qye=Fi();function uSt(t,e,i){const r=QDe(t,(e.length>0?e[0]:t.length/3)-1,i);if(r!==Os.Z){t=t.slice();for(let n=0;n_&&(_=Y)}else _=n;const x=Math.floor(1.1*_)+1;(lg==null||lg.length<2*x)&&(lg=new Uint32Array(kEe(2*x)));for(let G=0;G<2*x;G++)lg[G]=0;let S=0;const C=!!p&&!!a,M=C?c:n;let P=EU(n);const $=new Uint32Array(c),F=1.96;let z=o!==0?Math.ceil(4*F*F/(o*o)*o*(1-o)):M,k=1,U=p?p[1]:M;for(let G=0;G=x&&(ie-=x)}he===S&&(lg[2*ie]=ne,lg[2*ie+1]=Y+1,S++),P[Y]=he}if(o!==0&&1-S/n>>2)|0;return r>>>0}let lg=null;function Lli(t){const e=f6(t.rings,t.hasZ,s1.CCW_IS_HOLE,t.spatialReference),i=new Array;let r=0,n=0;for(const a of e.polygons){const c=a.count,p=a.index,_=zf(e.position,3*p,3*c),x=a.holeIndices.map(C=>C-p),S=Ny(UP(_,x,3));i.push({position:_,faces:S}),r+=_.length,n+=S.length}const s=fSt(i,r,n),o=Array.isArray(s.position)?gie(s.position,3,{originalIndices:s.faces}):gie(s.position.buffer,6,{originalIndices:s.faces});return s.position=pLe(new Float64Array(o.buffer)),s.faces=o.indices,s}function fSt(t,e,i){if(t.length===1)return t[0];const r=Qa(e),n=new Array(i);let s=0,o=0,a=0;for(const c of t){for(let p=0;p=0;M--){const P=t[M],$=i===s1.CCW_IS_HOLE&&mSt(P,e,r);if($&&n!==1)s[c++]=P;else{let F=P.length;for(let k=0;k0&&(a[_++]={index:C,count:P.length}),C=$?LN(P,P.length-1,-1,S,C,P.length,e):LN(P,0,1,S,C,P.length,e);for(let k=0;k0&&(a[_++]={index:C,count:U.length}),C=LN(U,0,1,S,C,U.length,e)}c=0,z.count>0&&(o[p++]=z)}}for(let M=0;M0&&(a[_++]={index:C,count:P.length}),C=LN(P,0,1,S,C,P.length,e)}return o.length=p,a.length=_,{position:S,polygons:o,outlines:a}}function LN(t,e,i,r,n,s,o){n*=3;for(let a=0;a=e.max){const r=this.canvasGeometries.extents[this.canvasGeometries.numViews++];Pz(this._extent,-e.range,0,r)}}setupGeometryViewsDirect(){this.canvasGeometries.numViews=1,__(this.canvasGeometries.extents[0],this._extent)}hasSomeSizedView(){for(let e=0;ei.valid?e|=1<n.camera.nearFar)),i.uniforms.add(new Zt("depthMap",(r,n)=>{var s;return(s=n.linearDepth)==null?void 0:s.colorTexture})),i.uniforms.add(new _s("proj",(r,n)=>n.camera.projectionMatrix)),i.uniforms.add(new ft("invResolutionHeight",(r,n)=>1/n.camera.height)),i.uniforms.add(new _s("reprojectionMatrix",(r,n)=>n.ssr.reprojectionMatrix)),i.code.add(V` +}`)}function ESt(t,e){const i=t.fragment;i.include(i0),i.uniforms.add(new cn("nearFar",(r,n)=>n.camera.nearFar)),i.uniforms.add(new Zt("depthMap",(r,n)=>{var s;return(s=n.linearDepth)==null?void 0:s.colorTexture})),i.uniforms.add(new bs("proj",(r,n)=>n.camera.projectionMatrix)),i.uniforms.add(new ft("invResolutionHeight",(r,n)=>1/n.camera.height)),i.uniforms.add(new bs("reprojectionMatrix",(r,n)=>n.ssr.reprojectionMatrix)),i.code.add(V` vec2 reprojectionCoordinate(vec3 projectionCoordinate) { vec4 zw = proj * vec4(0.0, 0.0, -projectionCoordinate.z, 1.0); @@ -2679,7 +2668,7 @@ return foamIntensityExternal * (0.075 * skyZenitColor * pow(foamPixelIntensity, } return vec3(P, 0.0); } - `)}function rNe(t,e){t.include(R3t,e),t.include(Aj),t.include(ETt),e.hasCloudsReflections&&t.include(v$e,e),e.hasScreenSpaceReflections&&t.include(CTt,e);const i=t.fragment;i.constants.add("fresnelSky","vec3",[.02,1,15]).add("fresnelMaterial","vec2",[.02,.1]).add("roughness","float",.015).add("foamIntensityExternal","float",1.7).add("ssrIntensity","float",.65).add("ssrHeightFadeStart","float",3e5).add("ssrHeightFadeEnd","float",5e5).add("waterDiffusion","float",.92).add("waterSeaColorMod","float",.8).add("correctionViewingPowerFactor","float",.4).add("skyZenitColor","vec3",[.52,.68,.9]).add("skyColor","vec3",[.67,.79,.9]).add("cloudFresnelModifier","vec2",[1.2,.01]),i.code.add(V`PBRShadingWater shadingInfo; + `)}function eNe(t,e){t.include(Pxt,e),t.include(Fj),t.include(TSt),e.hasCloudsReflections&&t.include(f$e,e),e.hasScreenSpaceReflections&&t.include(ESt,e);const i=t.fragment;i.constants.add("fresnelSky","vec3",[.02,1,15]).add("fresnelMaterial","vec2",[.02,.1]).add("roughness","float",.015).add("foamIntensityExternal","float",1.7).add("ssrIntensity","float",.65).add("ssrHeightFadeStart","float",3e5).add("ssrHeightFadeEnd","float",5e5).add("waterDiffusion","float",.92).add("waterSeaColorMod","float",.8).add("correctionViewingPowerFactor","float",.4).add("skyZenitColor","vec3",[.52,.68,.9]).add("skyColor","vec3",[.67,.79,.9]).add("cloudFresnelModifier","vec2",[1.2,.01]),i.code.add(V`PBRShadingWater shadingInfo; vec3 getSkyGradientColor(in float cosTheta, in vec3 horizon, in vec3 zenit) { float exponent = pow((1.0 - cosTheta), fresnelSky[2]); return mix(zenit, horizon, exponent); @@ -2720,7 +2709,7 @@ vec3 normalCorrectedClouds = mix(localUp, n, correctionViewingFactor); vec3 reflectedWorld = normalize(reflect(-v, normalCorrectedClouds));`),e.hasCloudsReflections&&i.code.add(V`vec4 cloudsColor = renderClouds(reflectedWorld, position); cloudsColor.a = 1.0 - cloudsColor.a; cloudsColor = pow(cloudsColor, vec4(GAMMA)); -cloudsColor *= clamp(fresnelModifier.y * cloudFresnelModifier[0] - cloudFresnelModifier[1], 0.0, 1.0) * clamp((1.0 - totalFadeInOut), 0.0, 1.0);`),e.hasScreenSpaceReflections?(i.uniforms.add(new _s("view",(r,n)=>n.camera.viewMatrix),new Zt("lastFrameColorTexture",(r,n)=>{var s;return(s=n.ssr.lastFrameColor)==null?void 0:s.colorTexture}),new ft("fadeFactorSSR",(r,n)=>n.ssr.fadeFactor)),i.code.add(V`vec3 viewDir = normalize(viewPosition); +cloudsColor *= clamp(fresnelModifier.y * cloudFresnelModifier[0] - cloudFresnelModifier[1], 0.0, 1.0) * clamp((1.0 - totalFadeInOut), 0.0, 1.0);`),e.hasScreenSpaceReflections?(i.uniforms.add(new bs("view",(r,n)=>n.camera.viewMatrix),new Zt("lastFrameColorTexture",(r,n)=>{var s;return(s=n.ssr.lastFrameColor)==null?void 0:s.colorTexture}),new ft("fadeFactorSSR",(r,n)=>n.ssr.fadeFactor)),i.code.add(V`vec3 viewDir = normalize(viewPosition); vec4 viewNormalVectorCoordinate = view *vec4(n, 0.0); vec3 viewNormal = normalize(viewNormalVectorCoordinate.xyz); vec4 viewUp = view * vec4(localUp, 0.0); @@ -2743,7 +2732,7 @@ vec3 waterRenderedColor = tonemapACES((1.0 - reflectionHitDiffused) * reflSky + reflSea * seaColorMod + specular + foam);`)):i.code.add(V`vec3 waterRenderedColor = tonemapACES(reflSky + reflSea * waterSeaColorMod + specular + foam);`),e.hasCloudsReflections?e.hasScreenSpaceReflections?i.code.add(V`return waterRenderedColor * (1.0 - (1.0 - reflectionHit) * cloudsColor.a) + (1.0 - reflectionHit) * cloudsColor.xyz; }`):i.code.add(V`return waterRenderedColor * (1.0 - cloudsColor.a) + cloudsColor.xyz; }`):i.code.add(V`return waterRenderedColor; -}`)}let qU=class extends Ls{constructor(e,i){super(e,"vec4",Or.Draw,(r,n,s)=>r.setUniform4fv(e,i(n,s)))}};var vy;function ATt(t,e){const{vertex:i,fragment:r}=t;i.uniforms.add(new qU("overlayTexOffset",(n,s)=>MTt(n,s)),new qU("overlayTexScale",(n,s)=>OTt(n,s))),r.constants.add("overlayOpacity","float",1),r.uniforms.add(new Zt("ovColorTex",(n,s)=>uie(n,s))),nNe(t,e)}function mR(t,e){const{vertex:i,fragment:r}=t;i.uniforms.add(new i1e("overlayTexOffset"),new i1e("overlayTexScale")),r.uniforms.add(new ft("overlayOpacity",n=>n.overlayOpacity),new Zt("ovColorTex",(n,s)=>{var o;return(o=s.overlay)==null?void 0:o.getTexture(n.overlayContent)})),nNe(t,e)}(function(t){t[t.Disabled=0]="Disabled",t[t.Enabled=1]="Enabled",t[t.EnabledWithWater=2]="EnabledWithWater",t[t.COUNT=3]="COUNT"})(vy||(vy={}));let i1e=class extends Ls{constructor(e){super(e,"vec4")}};function nNe(t,e){e.pbrMode!==ei.Water&&e.pbrMode!==ei.WaterOnIntegratedMesh&&e.pbrMode!==ei.TerrainWithWater||t.include(rNe,e);const{vertex:i,fragment:r}=t;t.varyings.add("vtcOverlay","vec4"),i.code.add(V`void setOverlayVTC(in vec2 uv) { +}`)}let WU=class extends Ds{constructor(e,i){super(e,"vec4",Pr.Draw,(r,n,s)=>r.setUniform4fv(e,i(n,s)))}};var Ty;function CSt(t,e){const{vertex:i,fragment:r}=t;i.uniforms.add(new WU("overlayTexOffset",(n,s)=>ASt(n,s)),new WU("overlayTexScale",(n,s)=>MSt(n,s))),r.constants.add("overlayOpacity","float",1),r.uniforms.add(new Zt("ovColorTex",(n,s)=>vie(n,s))),tNe(t,e)}function CR(t,e){const{vertex:i,fragment:r}=t;i.uniforms.add(new r1e("overlayTexOffset"),new r1e("overlayTexScale")),r.uniforms.add(new ft("overlayOpacity",n=>n.overlayOpacity),new Zt("ovColorTex",(n,s)=>{var o;return(o=s.overlay)==null?void 0:o.getTexture(n.overlayContent)})),tNe(t,e)}(function(t){t[t.Disabled=0]="Disabled",t[t.Enabled=1]="Enabled",t[t.EnabledWithWater=2]="EnabledWithWater",t[t.COUNT=3]="COUNT"})(Ty||(Ty={}));let r1e=class extends Ds{constructor(e){super(e,"vec4")}};function tNe(t,e){e.pbrMode!==ti.Water&&e.pbrMode!==ti.WaterOnIntegratedMesh&&e.pbrMode!==ti.TerrainWithWater||t.include(eNe,e);const{vertex:i,fragment:r}=t;t.varyings.add("vtcOverlay","vec4"),i.code.add(V`void setOverlayVTC(in vec2 uv) { vtcOverlay = vec4(uv, uv) * overlayTexScale + overlayTexOffset; }`),r.code.add(V`bool isValid(vec2 uv, vec2 dxdy) { return (uv.x >= 0.0 + dxdy.x) && (uv.x <= 1.0 - dxdy.x) && (uv.y >= 0.0 + dxdy.y) && (uv.y <= 1.0 - dxdy.y); @@ -2763,20 +2752,20 @@ vec4 color1 = texelFetch(ovColorTex, ivec2(vec2(texCoords.z * 0.5 + 0.5, texCoor bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy)); bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0)); return mix(color1 * float(isValid1), color0, float(isValid0)); -}`),e.pbrMode!==ei.Water&&e.pbrMode!==ei.WaterOnIntegratedMesh&&e.pbrMode!==ei.TerrainWithWater||(B_(r),a1(r),r.code.add(V`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir, +}`),e.pbrMode!==ti.Water&&e.pbrMode!==ti.WaterOnIntegratedMesh&&e.pbrMode!==ti.TerrainWithWater||(W_(r),m1(r),r.code.add(V`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir, float shadow, vec3 localUp, mat3 tbn, vec3 position, vec3 positionWorld) { vec3 n = normalize(tbn * (2.0 * maskInput.rgb - vec3(1.0))); vec3 v = vposEyeDir; vec3 final = getSeaColor(n, v, mainLightDirection, colorInput.rgb, mainLightIntensity, localUp, 1.0 - shadow, maskInput.w, position, positionWorld); return vec4(final, colorInput.w); -}`))}function uie(t,e){var i,r,n;return t.identifier===Hh.Material&&t.output===ue.Color?(i=e.overlay)==null?void 0:i.getTexture(ns.ColorNoRasterImage):t.identifier===Hh.Material&&t.output===ue.ObjectAndLayerIdColor?(r=e.overlay)==null?void 0:r.getTexture(ns.ObjectAndLayerIdColor):t.identifier===Hh.Highlight?(n=e.overlay)==null?void 0:n.getTexture(ns.Highlight):null}function MTt(t,e){var n,s,o,l;const i=(s=(n=e.overlay)==null?void 0:n.overlays[ko.INNER])==null?void 0:s.extent;Dz(i)&&(uy[0]=t.toMapSpace[0]/_c(i)-i[0]/_c(i),uy[1]=t.toMapSpace[1]/qu(i)-i[1]/qu(i));const r=(l=(o=e.overlay)==null?void 0:o.overlays[ko.OUTER])==null?void 0:l.extent;return Dz(r)&&(uy[2]=t.toMapSpace[0]/_c(r)-r[0]/_c(r),uy[3]=t.toMapSpace[1]/qu(r)-r[1]/qu(r)),uy}function OTt(t,e){var n,s,o,l;const i=(s=(n=e.overlay)==null?void 0:n.overlays[ko.INNER])==null?void 0:s.extent;Dz(i)&&(uy[0]=t.toMapSpace[2]/_c(i),uy[1]=t.toMapSpace[3]/qu(i));const r=(l=(o=e.overlay)==null?void 0:o.overlays[ko.OUTER])==null?void 0:l.extent;return Dz(r)&&(uy[2]=t.toMapSpace[2]/_c(r),uy[3]=t.toMapSpace[3]/qu(r)),uy}const uy=Xi();let Ble=class extends _n{constructor(){super(...arguments),this.color=Mi(1,1,1,1)}};function sNe(){const t=new Cr;return t.include(Pc),t.fragment.uniforms.add(new Zt("tex",e=>e.texture),new gr("uColor",e=>e.color)),t.fragment.code.add(V`void main() { +}`))}function vie(t,e){var i,r,n;return t.identifier===Yh.Material&&t.output===ue.Color?(i=e.overlay)==null?void 0:i.getTexture(ns.ColorNoRasterImage):t.identifier===Yh.Material&&t.output===ue.ObjectAndLayerIdColor?(r=e.overlay)==null?void 0:r.getTexture(ns.ObjectAndLayerIdColor):t.identifier===Yh.Highlight?(n=e.overlay)==null?void 0:n.getTexture(ns.Highlight):null}function ASt(t,e){var n,s,o,a;const i=(s=(n=e.overlay)==null?void 0:n.overlays[zo.INNER])==null?void 0:s.extent;Mz(i)&&(my[0]=t.toMapSpace[0]/xc(i)-i[0]/xc(i),my[1]=t.toMapSpace[1]/Yu(i)-i[1]/Yu(i));const r=(a=(o=e.overlay)==null?void 0:o.overlays[zo.OUTER])==null?void 0:a.extent;return Mz(r)&&(my[2]=t.toMapSpace[0]/xc(r)-r[0]/xc(r),my[3]=t.toMapSpace[1]/Yu(r)-r[1]/Yu(r)),my}function MSt(t,e){var n,s,o,a;const i=(s=(n=e.overlay)==null?void 0:n.overlays[zo.INNER])==null?void 0:s.extent;Mz(i)&&(my[0]=t.toMapSpace[2]/xc(i),my[1]=t.toMapSpace[3]/Yu(i));const r=(a=(o=e.overlay)==null?void 0:o.overlays[zo.OUTER])==null?void 0:a.extent;return Mz(r)&&(my[2]=t.toMapSpace[2]/xc(r),my[3]=t.toMapSpace[3]/Yu(r)),my}const my=Xi();let tce=class extends bn{constructor(){super(...arguments),this.color=Mi(1,1,1,1)}};function iNe(){const t=new Ar;return t.include($c),t.fragment.uniforms.add(new Zt("tex",e=>e.texture),new gr("uColor",e=>e.color)),t.fragment.code.add(V`void main() { vec4 texColor = texture(tex, uv); fragColor = texColor * uColor; -}`),t}const PTt=Object.freeze(Object.defineProperty({__proto__:null,TextureOnlyPassParameters:Ble,build:sNe},Symbol.toStringTag,{value:"Module"}));let oNe=class{constructor(e){this._context=e,this._perConstructorInstances=new TP,this._frameCounter=0,this._keepAliveFrameCount=r1e}get viewingMode(){return this._context.viewingMode}get constructionContext(){return this._context}destroy(){this._perConstructorInstances.forEach(e=>e.forEach(i=>i.technique.destroy())),this._perConstructorInstances.clear()}acquire(e,i=ITt){const r=i.key;let n=this._perConstructorInstances.get(e,r);if(n==null){const s=new e(this._context,i,()=>this.release(s));n=new RTt(s),this._perConstructorInstances.set(e,r,n)}return++n.refCount,n.technique}releaseAndAcquire(e,i,r){if(r!=null){if(i.key===r.key)return r;this.release(r)}return this.acquire(e,i)}release(e){if(e==null||this._perConstructorInstances.empty)return;const i=this._perConstructorInstances.get(e.constructor,e.key);i!=null&&(--i.refCount,i.refCount===0&&(i.refZeroFrame=this._frameCounter))}frameUpdate(){this._frameCounter++,this._keepAliveFrameCount!==r1e&&this._perConstructorInstances.forEach((e,i)=>{e.forEach((r,n)=>{r.refCount===0&&r.refZeroFrame+this._keepAliveFrameCount{const n=async(s,o)=>{const l=o.shader;l&&(await l.reload(),s.forEach(c=>c.technique.reload(this._context)))};e.push(n(i,r))}),await Promise.all(e)}},RTt=class{constructor(e){this.technique=e,this.refCount=0,this.refZeroFrame=0}};const r1e=-1,ITt=new nh;let aNe=class{constructor(e,i,r,n){this._textureRepository=e,this._techniqueRepository=i,this.materialChanged=r,this.requestRender=n,this._id2glMaterialRef=new TP}dispose(){this._textureRepository.destroy()}acquire(e,i,r){if(this._ownMaterial(e),!e.produces(i,r))return null;let n=this._id2glMaterialRef.get(r,e.id);if(n==null){const s=e.createGLMaterial({material:e,techniqueRep:this._techniqueRepository,textureRepository:this._textureRepository,output:r});n=new $Tt(s),this._id2glMaterialRef.set(r,e.id,n)}return n.ref(),n.glMaterial}release(e,i){const r=this._id2glMaterialRef.get(i,e.id);r!=null&&(r.unref(),r.referenced||(Kt(r.glMaterial),this._id2glMaterialRef.delete(i,e.id)))}_ownMaterial(e){e.repository&&e.repository!==this&&Ce.getLogger("esri.views.3d.webgl-engine.lib.GLMaterialRepository").error("Material is already owned by a different material repository"),e.repository=this}},$Tt=class{constructor(e){this.glMaterial=e,this._refCnt=0}ref(){++this._refCnt}unref(){--this._refCnt,Xt(this._refCnt>=0)}get referenced(){return this._refCnt>0}};const LTt=["layerObjectAdded","layerObjectRemoved","layerObjectsAdded","layerObjectsRemoved","transformationChanged","shaderTransformationChanged","visibilityChanged","occlusionChanged","highlightChanged","geometryAdded","geometryRemoved","attributesChanged"];let hie=class rk{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(e,i){this.objectToBoundingSphere=e,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new za,this._objectCount=0,i&&(i.maximumObjectsPerNode!==void 0&&(this._maximumObjectsPerNode=i.maximumObjectsPerNode),i.maximumDepth!==void 0&&(this._maximumDepth=i.maximumDepth))}destroy(){this._degenerateObjects.clear(),za.clearPool(),die[0]=null,$x.prune(),K3.prune()}add(e,i=e.length){this._objectCount+=i,this._grow(e,i);const r=za.acquire();for(let n=0;n{if(!this._intersectsNode(n,s))return!1;const o=s.node;return o.terminals.forAll(l=>{this._intersectsObject(n,l)&&r(l)}),o.residents!==null&&o.residents.forAll(l=>{this._intersectsObject(n,l)&&r(l)}),!0})}forEachAlongRayWithVerticalOffset(e,i,r,n){const s=Sp(e,i);this._forEachNode(this._root,o=>{if(!this._intersectsNodeWithOffset(s,o,n))return!1;const l=o.node;return l.terminals.forAll(c=>{this._intersectsObjectWithOffset(s,c,n)&&r(c)}),l.residents!==null&&l.residents.forAll(c=>{this._intersectsObjectWithOffset(s,c,n)&&r(c)}),!0})}forEach(e){this._forEachNode(this._root,i=>{const r=i.node;return r.terminals.forAll(e),r.residents!==null&&r.residents.forAll(e),!0}),this._degenerateObjects.forEach(e)}forEachDegenerateObject(e){this._degenerateObjects.forEach(e)}findClosest(e,i,r,n=()=>!0,s=1/0){let o=1/0,l=1/0,c=null;const f=_W(e,i),_=x=>{if(--s,!n(x))return;const T=this.objectToBoundingSphere(x);if(!c2(r,T))return;const A=Fw(e,i,T),M=A-T[3],I=A+T[3];M{if(s<=0||!c2(r,x.bounds)||(De(Dp,f,x.halfSize),Be(Dp,Dp,x.bounds),Fw(e,i,Dp)>l))return!1;const T=x.node;return T.terminals.forAll(A=>_(A)),T.residents!==null&&T.residents.forAll(A=>_(A)),!0},e,i),c}forEachInDepthRange(e,i,r,n,s,o,l){let c=-1/0,f=1/0;const _={setRange:I=>{r===rk.DepthOrder.FRONT_TO_BACK?(c=Math.max(c,I.near),f=Math.min(f,I.far)):(c=Math.max(c,-I.far),f=Math.min(f,-I.near))}};_.setRange(n);const x=Fw(i,r,e),T=_W(i,r),A=_W(i,-r),M=I=>{if(!l(I))return;const L=this.objectToBoundingSphere(I),F=L,z=Fw(i,r,F)-x,k=z-L[3],U=z+L[3];k>f||U{if(!c2(o,I.bounds)||(De(Dp,T,I.halfSize),Be(Dp,Dp,I.bounds),Fw(i,r,Dp)-x>f)||(De(Dp,A,I.halfSize),Be(Dp,Dp,I.bounds),Fw(i,r,Dp)-xM(F)),L.residents!==null&&L.residents.forAll(F=>M(F)),!0},i,r)}forEachNode(e){this._forEachNode(this._root,i=>e(i.node,i.bounds,i.halfSize,i.depth))}forEachNeighbor(e,i){const r=Zv(i),n=i,s=c=>{const f=this.objectToBoundingSphere(c),_=Zv(f),x=r+_;return!(Co(f,n)-x*x<=0)||e(c)};let o=!0;const l=c=>{o&&(o=s(c))};this._forEachNode(this._root,c=>{const f=Zv(c.bounds),_=r+f;if(Co(c.bounds,n)-_*_>0)return!1;const x=c.node;return x.terminals.forAll(l),o&&x.residents!==null&&x.residents.forAll(l),o}),o&&this.forEachDegenerateObject(l)}_intersectsNode(e,i){return MN(i.bounds,2*-i.halfSize,Kd),MN(i.bounds,2*i.halfSize,Qd),mme(e.origin,e.direction,Kd,Qd)}_intersectsNodeWithOffset(e,i,r){return MN(i.bounds,2*-i.halfSize,Kd),MN(i.bounds,2*i.halfSize,Qd),r.applyToMinMax(Kd,Qd),mme(e.origin,e.direction,Kd,Qd)}_intersectsObject(e,i){const r=this.objectToBoundingSphere(i);return!(r[3]>0)||bQ(r,e)}_intersectsObjectWithOffset(e,i,r){const n=this.objectToBoundingSphere(i);return!(n[3]>0)||bQ(r.applyToBoundingSphere(n),e)}_forEachNode(e,i){let r=za.acquire().init(e);const n=[r];for(;n.length!==0;){if(r=n.pop(),i(r)&&!r.isLeaf())for(let s=0;s=0;--l){const c=o1e[l];s.node.children[c]&&o.push(za.acquire().init(s).advance(c))}za.release(s)}}_remove(e,i,r){$x.clear();const n=r.advanceTo(i,(s,o)=>{$x.push(s.node),$x.push(o)})?r.node.terminals:r.node.residents;if(n.removeUnordered(e),n.length===0)for(let s=$x.length-2;s>=0;s-=2){const o=$x.data[s],l=$x.data[s+1];if(!this._purge(o,l))break}}_nodeIsEmpty(e){if(e.terminals.length!==0)return!1;if(e.residents!==null)return e.residents.length===0;for(let i=0;i=0&&(e.children[i]=null),!!this._nodeIsEmpty(e)&&(e.residents===null&&(e.residents=new Pi({shrink:!0})),!0)}_add(e,i){i.advanceTo(this.objectToBoundingSphere(e))?i.node.terminals.push(e):(i.node.residents.push(e),i.node.residents.length>this._maximumObjectsPerNode&&i.depththis.objectToBoundingSphere(r),S1),hI(S1[3])&&!this._fitsInsideTree(S1)))if(this._nodeIsEmpty(this._root.node))a5(S1,this._root.bounds),this._root.halfSize=1.25*this._root.bounds[3],this._root.updateBoundsRadiusFromHalfSize();else{const r=this._rootBoundsForRootAsSubNode(S1);this._placingRootViolatesMaxDepth(r)?this._rebuildTree(S1,r):this._growRootAsSubNode(r),za.release(r)}}_rebuildTree(e,i){Ne(wW,i.bounds),wW[3]=i.halfSize,n1e([e,wW],2,n=>n,xW);const r=za.acquire().init(this._root);this._root.initFrom(null,xW,xW[3]),this._root.increaseHalfSize(1.25),this._forEachNode(r,n=>(this.add(n.node.terminals.data,n.node.terminals.length),n.node.residents!==null&&this.add(n.node.residents.data,n.node.residents.length),!0)),za.release(r)}_placingRootViolatesMaxDepth(e){const i=Math.log(e.halfSize/this._root.halfSize)*Math.LOG2E;let r=0;return this._forEachNode(this._root,n=>(r=Math.max(r,n.depth),r+i<=this._maximumDepth)),r+i>this._maximumDepth}_rootBoundsForRootAsSubNode(e){const i=e[3],r=e;let n=-1/0;const s=this._root.bounds,o=this._root.halfSize;for(let c=0;c<3;c++){const f=s[c]-o-(r[c]-i),_=r[c]+i-(s[c]+o),x=Math.max(0,Math.ceil(f/(2*o))),T=Math.max(0,Math.ceil(_/(2*o)))+1,A=2**Math.ceil(Math.log(x+T)*Math.LOG2E);n=Math.max(n,A),ON[c].min=x,ON[c].max=T}for(let c=0;c<3;c++){let f=ON[c].min,_=ON[c].max;const x=(n-(f+_))/2;f+=Math.ceil(x),_+=Math.floor(x);const T=s[c]-o-f*o*2;bW[c]=T+(_+f)*o}const l=n*o;return bW[3]=l*cNe,za.acquire().initFrom(null,bW,l,0)}_growRootAsSubNode(e){const i=this._root.node;Ne(S1,this._root.bounds),S1[3]=this._root.halfSize,this._root.init(e),e.advanceTo(S1,null,!0),e.node.children=i.children,e.node.residents=i.residents,e.node.terminals=i.terminals}_shrink(){for(;;){const e=this._findShrinkIndex();if(e===-1)break;this._root.advance(e),this._root.depth=0}}_findShrinkIndex(){if(this._root.node.terminals.length!==0||this._root.isLeaf())return-1;let e=null;const i=this._root.node.children;let r=0,n=0;for(;n=i[0]-r&&e[0]<=i[0]+r&&e[1]>=i[1]-r&&e[1]<=i[1]+r&&e[2]>=i[2]-r&&e[2]<=i[2]+r}toJSON(){const{maximumDepth:e,maximumObjectsPerNode:i,_objectCount:r}=this,n=this._nodeToJSON(this._root.node);return{maximumDepth:e,maximumObjectsPerNode:i,objectCount:r,root:{bounds:this._root.bounds,halfSize:this._root.halfSize,depth:this._root.depth,node:n}}}_nodeToJSON(e){var s,o;const i=e.children.map(l=>l?this._nodeToJSON(l):null),r=(s=e.residents)==null?void 0:s.map(l=>this.objectToBoundingSphere(l)),n=(o=e.terminals)==null?void 0:o.map(l=>this.objectToBoundingSphere(l));return{children:i,residents:r,terminals:n}}static fromJSON(e){const i=new rk(r=>r,{maximumDepth:e.maximumDepth,maximumObjectsPerNode:e.maximumObjectsPerNode});return i._objectCount=e.objectCount,i._root.initFrom(e.root.node,e.root.bounds,e.root.halfSize,e.root.depth),i}},za=class jA{constructor(){this.bounds=co(),this.halfSize=0,this.initFrom(null,null,0,0)}init(e){return this.initFrom(e.node,e.bounds,e.halfSize,e.depth)}initFrom(e,i,r,n=this.depth){return this.node=e??jA.createEmptyNode(),i!=null&&a5(i,this.bounds),this.halfSize=r,this.depth=n,this}increaseHalfSize(e){this.halfSize*=e,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds[3]=this.halfSize*cNe}advance(e){let i=this.node.children[e];i||(i=jA.createEmptyNode(),this.node.children[e]=i),this.node=i,this.halfSize/=2,this.depth++;const r=lNe[e];return this.bounds[0]+=r[0]*this.halfSize,this.bounds[1]+=r[1]*this.halfSize,this.bounds[2]+=r[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(e,i,r=!1){for(;;){if(this.isTerminalFor(e))return i&&i(this,-1),!0;if(this.isLeaf()){if(!r)return i&&i(this,-1),!1;this.node.residents=null}const n=this._childIndex(e);i&&i(this,n),this.advance(n)}}isLeaf(){return this.node.residents!=null}isTerminalFor(e){return e[3]>this.halfSize/2}_childIndex(e){const i=this.bounds;return(i[0]r.distance-n.distance);for(let r=0;r<8;++r)i[r]=K3.data[r].index}function _W(t,e){let i,r=1/0;for(let n=0;n<8;++n){const s=Fw(t,e,s1e[n]);s0}za._pool=new Ec(za),function(t){var e;(e=t.DepthOrder||(t.DepthOrder={}))[e.FRONT_TO_BACK=1]="FRONT_TO_BACK",e[e.BACK_TO_FRONT=-1]="BACK_TO_FRONT"}(hie||(hie={}));const lNe=[nt(-1,-1,-1),nt(1,-1,-1),nt(-1,1,-1),nt(1,1,-1),nt(-1,-1,1),nt(1,-1,1),nt(-1,1,1),nt(1,1,1)],s1e=[nt(-1,-1,-1),nt(-1,-1,1),nt(-1,1,-1),nt(-1,1,1),nt(1,-1,-1),nt(1,-1,1),nt(1,1,-1),nt(1,1,1)],cNe=Math.sqrt(3),die=[null];function kTt(t){return die[0]=t,die}const bW=co(),Dp=W(),Kd=W(),Qd=W(),$x=new Pi,zTt=co(),S1=co(),wW=co(),xW=co(),ON=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],K3=new Pi,o1e=[0,0,0,0,0,0,0,0],_m=hie;var b2;(function(t){t[t.ASYNC=0]="ASYNC",t[t.SYNC=1]="SYNC"})(b2||(b2={}));let uNe=class extends Z9{get objects(){return this._objects}constructor(e,i,r=""){super(),this.stage=e,this.apiLayerUid=r,this.type=Ws.Layer,this.events=new Dn,this.visible=!0,this.pickable=!0,this.sliceable=!1,this._objects=new Pi,this._objectsAdded=new Pi,this._handles=new O_,this.apiLayerUid=r,this.visible=(i==null?void 0:i.visible)??!0,this.pickable=(i==null?void 0:i.pickable)??!0,this.updatePolicy=(i==null?void 0:i.updatePolicy)??b2.ASYNC,this._disableOctree=(i==null?void 0:i.disableOctree)??!1,e.add(this);for(const n of LTt)this._handles.add(this.events.on(n,s=>e.handleEvent(n,s)))}destroy(){this._handles.size&&(this._handles.destroy(),this.stage.remove(this),this.invalidateSpatialQueryAccelerator())}add(e){this._objects.push(e),e.parentLayer=this,this.events.emit("layerObjectAdded",{layer:this,object:e}),this._octree!=null&&this._objectsAdded.push(e)}remove(e){this._objects.removeUnordered(e)&&(e.parentLayer=null,this.events.emit("layerObjectRemoved",{layer:this,object:e}),this._octree!=null&&(this._objectsAdded.removeUnordered(e)||this._octree.remove([e])))}addMany(e){this._objects.pushArray(e);for(const i of e)i.parentLayer=this;this.events.emit("layerObjectsAdded",{layer:this,objects:e}),this._octree!=null&&this._objectsAdded.pushArray(e)}removeMany(e){const i=new Array;if(this._objects.removeUnorderedMany(e,e.length,i),i.length!==0){for(const r of i)r.parentLayer=null;if(this.events.emit("layerObjectsRemoved",{layer:this,objects:i}),this._octree!=null){for(let r=0;r50&&!this._disableOctree?(this._octree=new _m(e=>e.boundingVolumeWorldSpace.bounds),this._octree.add(this._objects.data,this._objects.length)):this._octree!=null&&this._objectsAdded.length>0&&(this._octree.add(this._objectsAdded.data,this._objectsAdded.length),this._objectsAdded.clear()),this._octree}invalidateSpatialQueryAccelerator(){this._octree=et(this._octree),this._objectsAdded.clear()}};function WU(t){return t!=null&&t.type===Ws.Layer}var _p,eE;(function(t){t[t.Draped=0]="Draped",t[t.Screen=1]="Screen",t[t.World=2]="World",t[t.COUNT=3]="COUNT"})(_p||(_p={})),function(t){t[t.Center=0]="Center",t[t.Tip=1]="Tip",t[t.COUNT=2]="COUNT"}(eE||(eE={}));let Na=class extends hu{constructor(){super(...arguments),this.output=ue.Color,this.transparencyPassType=Jt.NONE,this.occluder=!1,this.hasSlicePlane=!1,this.writeDepth=!1,this.space=_p.Screen,this.hideOnShortSegments=!1,this.hasCap=!1,this.anchor=eE.Center,this.hasTip=!1,this.vvSize=!1,this.vvColor=!1,this.vvOpacity=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1}get draped(){return this.space===_p.Draped}};y([fe({count:ue.COUNT})],Na.prototype,"output",void 0),y([fe({count:Jt.COUNT})],Na.prototype,"transparencyPassType",void 0),y([fe()],Na.prototype,"occluder",void 0),y([fe()],Na.prototype,"hasSlicePlane",void 0),y([fe()],Na.prototype,"writeDepth",void 0),y([fe({count:_p.COUNT})],Na.prototype,"space",void 0),y([fe()],Na.prototype,"hideOnShortSegments",void 0),y([fe()],Na.prototype,"hasCap",void 0),y([fe({count:eE.COUNT})],Na.prototype,"anchor",void 0),y([fe()],Na.prototype,"hasTip",void 0),y([fe()],Na.prototype,"vvSize",void 0),y([fe()],Na.prototype,"vvColor",void 0),y([fe()],Na.prototype,"vvOpacity",void 0),y([fe()],Na.prototype,"hasOccludees",void 0),y([fe()],Na.prototype,"multipassEnabled",void 0),y([fe()],Na.prototype,"cullAboveGround",void 0),y([fe({constValue:!1})],Na.prototype,"occlusionPass",void 0),y([fe({constValue:!0})],Na.prototype,"hasVvInstancing",void 0),y([fe({constValue:!0})],Na.prototype,"hasSliceTranslatedView",void 0);const a1e=8;function hNe(t,e){const i=t.vertex;i.uniforms.add(new ft("intrinsicWidth",r=>r.width)),e.vvSize?(t.attributes.add(J.SIZEFEATUREATTRIBUTE,"float"),i.uniforms.add(new Oi("vvSizeMinSize",r=>r.vvSize.minSize),new Oi("vvSizeMaxSize",r=>r.vvSize.maxSize),new Oi("vvSizeOffset",r=>r.vvSize.offset),new Oi("vvSizeFactor",r=>r.vvSize.factor)),i.code.add(V`float getSize() { +}`),t}const OSt=Object.freeze(Object.defineProperty({__proto__:null,TextureOnlyPassParameters:tce,build:iNe},Symbol.toStringTag,{value:"Module"}));let rNe=class{constructor(e){this._context=e,this._perConstructorInstances=new L5,this._frameCounter=0,this._keepAliveFrameCount=n1e}get viewingMode(){return this._context.viewingMode}get constructionContext(){return this._context}destroy(){this._perConstructorInstances.forEach(e=>e.forEach(i=>i.technique.destroy())),this._perConstructorInstances.clear()}acquire(e,i=RSt){const r=i.key;let n=this._perConstructorInstances.get(e,r);if(n==null){const s=new e(this._context,i,()=>this.release(s));n=new PSt(s),this._perConstructorInstances.set(e,r,n)}return++n.refCount,n.technique}releaseAndAcquire(e,i,r){if(r!=null){if(i.key===r.key)return r;this.release(r)}return this.acquire(e,i)}release(e){if(e==null||this._perConstructorInstances.empty)return;const i=this._perConstructorInstances.get(e.constructor,e.key);i!=null&&(--i.refCount,i.refCount===0&&(i.refZeroFrame=this._frameCounter))}frameUpdate(){this._frameCounter++,this._keepAliveFrameCount!==n1e&&this._perConstructorInstances.forEach((e,i)=>{e.forEach((r,n)=>{r.refCount===0&&r.refZeroFrame+this._keepAliveFrameCount{const n=async(s,o)=>{const a=o.shader;a&&(await a.reload(),s.forEach(c=>c.technique.reload(this._context)))};e.push(n(i,r))}),await Promise.all(e)}},PSt=class{constructor(e){this.technique=e,this.refCount=0,this.refZeroFrame=0}};const n1e=-1,RSt=new oh;let nNe=class{constructor(e,i,r,n){this._textureRepository=e,this._techniqueRepository=i,this.materialChanged=r,this.requestRender=n,this._id2glMaterialRef=new L5}dispose(){this._textureRepository.destroy()}acquire(e,i,r){if(this._ownMaterial(e),!e.produces(i,r))return null;let n=this._id2glMaterialRef.get(r,e.id);if(n==null){const s=e.createGLMaterial({material:e,techniqueRep:this._techniqueRepository,textureRepository:this._textureRepository,output:r});n=new ISt(s),this._id2glMaterialRef.set(r,e.id,n)}return n.ref(),n.glMaterial}release(e,i){const r=this._id2glMaterialRef.get(i,e.id);r!=null&&(r.unref(),r.referenced||(Kt(r.glMaterial),this._id2glMaterialRef.delete(i,e.id)))}_ownMaterial(e){e.repository&&e.repository!==this&&Ce.getLogger("esri.views.3d.webgl-engine.lib.GLMaterialRepository").error("Material is already owned by a different material repository"),e.repository=this}},ISt=class{constructor(e){this.glMaterial=e,this._refCnt=0}ref(){++this._refCnt}unref(){--this._refCnt,Xt(this._refCnt>=0)}get referenced(){return this._refCnt>0}};const $St=["layerObjectAdded","layerObjectRemoved","layerObjectsAdded","layerObjectsRemoved","transformationChanged","shaderTransformationChanged","visibilityChanged","occlusionChanged","highlightChanged","geometryAdded","geometryRemoved","attributesChanged"];let _ie=class pk{get bounds(){return this._root.bounds}get halfSize(){return this._root.halfSize}get root(){return this._root.node}get maximumObjectsPerNode(){return this._maximumObjectsPerNode}get maximumDepth(){return this._maximumDepth}get objectCount(){return this._objectCount}constructor(e,i){this.objectToBoundingSphere=e,this._maximumObjectsPerNode=10,this._maximumDepth=20,this._degenerateObjects=new Set,this._root=new Va,this._objectCount=0,i&&(i.maximumObjectsPerNode!==void 0&&(this._maximumObjectsPerNode=i.maximumObjectsPerNode),i.maximumDepth!==void 0&&(this._maximumDepth=i.maximumDepth))}destroy(){this._degenerateObjects.clear(),Va.clearPool(),bie[0]=null,zx.prune(),nS.prune()}add(e,i=e.length){this._objectCount+=i,this._grow(e,i);const r=Va.acquire();for(let n=0;n{if(!this._intersectsNode(n,s))return!1;const o=s.node;return o.terminals.forAll(a=>{this._intersectsObject(n,a)&&r(a)}),o.residents!==null&&o.residents.forAll(a=>{this._intersectsObject(n,a)&&r(a)}),!0})}forEachAlongRayWithVerticalOffset(e,i,r,n){const s=Ap(e,i);this._forEachNode(this._root,o=>{if(!this._intersectsNodeWithOffset(s,o,n))return!1;const a=o.node;return a.terminals.forAll(c=>{this._intersectsObjectWithOffset(s,c,n)&&r(c)}),a.residents!==null&&a.residents.forAll(c=>{this._intersectsObjectWithOffset(s,c,n)&&r(c)}),!0})}forEach(e){this._forEachNode(this._root,i=>{const r=i.node;return r.terminals.forAll(e),r.residents!==null&&r.residents.forAll(e),!0}),this._degenerateObjects.forEach(e)}forEachDegenerateObject(e){this._degenerateObjects.forEach(e)}findClosest(e,i,r,n=()=>!0,s=1/0){let o=1/0,a=1/0,c=null;const p=OW(e,i),_=x=>{if(--s,!n(x))return;const S=this.objectToBoundingSphere(x);if(!m2(r,S))return;const C=Bw(e,i,S),M=C-S[3],P=C+S[3];M{if(s<=0||!m2(r,x.bounds)||(De(Up,p,x.halfSize),Be(Up,Up,x.bounds),Bw(e,i,Up)>a))return!1;const S=x.node;return S.terminals.forAll(C=>_(C)),S.residents!==null&&S.residents.forAll(C=>_(C)),!0},e,i),c}forEachInDepthRange(e,i,r,n,s,o,a){let c=-1/0,p=1/0;const _={setRange:P=>{r===pk.DepthOrder.FRONT_TO_BACK?(c=Math.max(c,P.near),p=Math.min(p,P.far)):(c=Math.max(c,-P.far),p=Math.min(p,-P.near))}};_.setRange(n);const x=Bw(i,r,e),S=OW(i,r),C=OW(i,-r),M=P=>{if(!a(P))return;const $=this.objectToBoundingSphere(P),F=$,z=Bw(i,r,F)-x,k=z-$[3],U=z+$[3];k>p||U{if(!m2(o,P.bounds)||(De(Up,S,P.halfSize),Be(Up,Up,P.bounds),Bw(i,r,Up)-x>p)||(De(Up,C,P.halfSize),Be(Up,Up,P.bounds),Bw(i,r,Up)-xM(F)),$.residents!==null&&$.residents.forAll(F=>M(F)),!0},i,r)}forEachNode(e){this._forEachNode(this._root,i=>e(i.node,i.bounds,i.halfSize,i.depth))}forEachNeighbor(e,i){const r=r_(i),n=i,s=c=>{const p=this.objectToBoundingSphere(c),_=r_(p),x=r+_;return!(Ao(p,n)-x*x<=0)||e(c)};let o=!0;const a=c=>{o&&(o=s(c))};this._forEachNode(this._root,c=>{const p=r_(c.bounds),_=r+p;if(Ao(c.bounds,n)-_*_>0)return!1;const x=c.node;return x.terminals.forAll(a),o&&x.residents!==null&&x.residents.forAll(a),o}),o&&this.forEachDegenerateObject(a)}_intersectsNode(e,i){return DN(i.bounds,2*-i.halfSize,tp),DN(i.bounds,2*i.halfSize,ip),gme(e.origin,e.direction,tp,ip)}_intersectsNodeWithOffset(e,i,r){return DN(i.bounds,2*-i.halfSize,tp),DN(i.bounds,2*i.halfSize,ip),r.applyToMinMax(tp,ip),gme(e.origin,e.direction,tp,ip)}_intersectsObject(e,i){const r=this.objectToBoundingSphere(i);return!(r[3]>0)||TQ(r,e)}_intersectsObjectWithOffset(e,i,r){const n=this.objectToBoundingSphere(i);return!(n[3]>0)||TQ(r.applyToBoundingSphere(n),e)}_forEachNode(e,i){let r=Va.acquire().init(e);const n=[r];for(;n.length!==0;){if(r=n.pop(),i(r)&&!r.isLeaf())for(let s=0;s=0;--a){const c=a1e[a];s.node.children[c]&&o.push(Va.acquire().init(s).advance(c))}Va.release(s)}}_remove(e,i,r){zx.clear();const n=r.advanceTo(i,(s,o)=>{zx.push(s.node),zx.push(o)})?r.node.terminals:r.node.residents;if(n.removeUnordered(e),n.length===0)for(let s=zx.length-2;s>=0;s-=2){const o=zx.data[s],a=zx.data[s+1];if(!this._purge(o,a))break}}_nodeIsEmpty(e){if(e.terminals.length!==0)return!1;if(e.residents!==null)return e.residents.length===0;for(let i=0;i=0&&(e.children[i]=null),!!this._nodeIsEmpty(e)&&(e.residents===null&&(e.residents=new Pi({shrink:!0})),!0)}_add(e,i){i.advanceTo(this.objectToBoundingSphere(e))?i.node.terminals.push(e):(i.node.residents.push(e),i.node.residents.length>this._maximumObjectsPerNode&&i.depththis.objectToBoundingSphere(r),R1),x4(R1[3])&&!this._fitsInsideTree(R1)))if(this._nodeIsEmpty(this._root.node))gP(R1,this._root.bounds),this._root.halfSize=1.25*this._root.bounds[3],this._root.updateBoundsRadiusFromHalfSize();else{const r=this._rootBoundsForRootAsSubNode(R1);this._placingRootViolatesMaxDepth(r)?this._rebuildTree(R1,r):this._growRootAsSubNode(r),Va.release(r)}}_rebuildTree(e,i){Ne(RW,i.bounds),RW[3]=i.halfSize,s1e([e,RW],2,n=>n,IW);const r=Va.acquire().init(this._root);this._root.initFrom(null,IW,IW[3]),this._root.increaseHalfSize(1.25),this._forEachNode(r,n=>(this.add(n.node.terminals.data,n.node.terminals.length),n.node.residents!==null&&this.add(n.node.residents.data,n.node.residents.length),!0)),Va.release(r)}_placingRootViolatesMaxDepth(e){const i=Math.log(e.halfSize/this._root.halfSize)*Math.LOG2E;let r=0;return this._forEachNode(this._root,n=>(r=Math.max(r,n.depth),r+i<=this._maximumDepth)),r+i>this._maximumDepth}_rootBoundsForRootAsSubNode(e){const i=e[3],r=e;let n=-1/0;const s=this._root.bounds,o=this._root.halfSize;for(let c=0;c<3;c++){const p=s[c]-o-(r[c]-i),_=r[c]+i-(s[c]+o),x=Math.max(0,Math.ceil(p/(2*o))),S=Math.max(0,Math.ceil(_/(2*o)))+1,C=2**Math.ceil(Math.log(x+S)*Math.LOG2E);n=Math.max(n,C),NN[c].min=x,NN[c].max=S}for(let c=0;c<3;c++){let p=NN[c].min,_=NN[c].max;const x=(n-(p+_))/2;p+=Math.ceil(x),_+=Math.floor(x);const S=s[c]-o-p*o*2;PW[c]=S+(_+p)*o}const a=n*o;return PW[3]=a*oNe,Va.acquire().initFrom(null,PW,a,0)}_growRootAsSubNode(e){const i=this._root.node;Ne(R1,this._root.bounds),R1[3]=this._root.halfSize,this._root.init(e),e.advanceTo(R1,null,!0),e.node.children=i.children,e.node.residents=i.residents,e.node.terminals=i.terminals}_shrink(){for(;;){const e=this._findShrinkIndex();if(e===-1)break;this._root.advance(e),this._root.depth=0}}_findShrinkIndex(){if(this._root.node.terminals.length!==0||this._root.isLeaf())return-1;let e=null;const i=this._root.node.children;let r=0,n=0;for(;n=i[0]-r&&e[0]<=i[0]+r&&e[1]>=i[1]-r&&e[1]<=i[1]+r&&e[2]>=i[2]-r&&e[2]<=i[2]+r}toJSON(){const{maximumDepth:e,maximumObjectsPerNode:i,_objectCount:r}=this,n=this._nodeToJSON(this._root.node);return{maximumDepth:e,maximumObjectsPerNode:i,objectCount:r,root:{bounds:this._root.bounds,halfSize:this._root.halfSize,depth:this._root.depth,node:n}}}_nodeToJSON(e){var s,o;const i=e.children.map(a=>a?this._nodeToJSON(a):null),r=(s=e.residents)==null?void 0:s.map(a=>this.objectToBoundingSphere(a)),n=(o=e.terminals)==null?void 0:o.map(a=>this.objectToBoundingSphere(a));return{children:i,residents:r,terminals:n}}static fromJSON(e){const i=new pk(r=>r,{maximumDepth:e.maximumDepth,maximumObjectsPerNode:e.maximumObjectsPerNode});return i._objectCount=e.objectCount,i._root.initFrom(e.root.node,e.root.bounds,e.root.halfSize,e.root.depth),i}},Va=class WA{constructor(){this.bounds=uo(),this.halfSize=0,this.initFrom(null,null,0,0)}init(e){return this.initFrom(e.node,e.bounds,e.halfSize,e.depth)}initFrom(e,i,r,n=this.depth){return this.node=e??WA.createEmptyNode(),i!=null&&gP(i,this.bounds),this.halfSize=r,this.depth=n,this}increaseHalfSize(e){this.halfSize*=e,this.updateBoundsRadiusFromHalfSize()}updateBoundsRadiusFromHalfSize(){this.bounds[3]=this.halfSize*oNe}advance(e){let i=this.node.children[e];i||(i=WA.createEmptyNode(),this.node.children[e]=i),this.node=i,this.halfSize/=2,this.depth++;const r=sNe[e];return this.bounds[0]+=r[0]*this.halfSize,this.bounds[1]+=r[1]*this.halfSize,this.bounds[2]+=r[2]*this.halfSize,this.updateBoundsRadiusFromHalfSize(),this}advanceTo(e,i,r=!1){for(;;){if(this.isTerminalFor(e))return i&&i(this,-1),!0;if(this.isLeaf()){if(!r)return i&&i(this,-1),!1;this.node.residents=null}const n=this._childIndex(e);i&&i(this,n),this.advance(n)}}isLeaf(){return this.node.residents!=null}isTerminalFor(e){return e[3]>this.halfSize/2}_childIndex(e){const i=this.bounds;return(i[0]r.distance-n.distance);for(let r=0;r<8;++r)i[r]=nS.data[r].index}function OW(t,e){let i,r=1/0;for(let n=0;n<8;++n){const s=Bw(t,e,o1e[n]);s0}Va._pool=new Ql(Va),function(t){var e;(e=t.DepthOrder||(t.DepthOrder={}))[e.FRONT_TO_BACK=1]="FRONT_TO_BACK",e[e.BACK_TO_FRONT=-1]="BACK_TO_FRONT"}(_ie||(_ie={}));const sNe=[st(-1,-1,-1),st(1,-1,-1),st(-1,1,-1),st(1,1,-1),st(-1,-1,1),st(1,-1,1),st(-1,1,1),st(1,1,1)],o1e=[st(-1,-1,-1),st(-1,-1,1),st(-1,1,-1),st(-1,1,1),st(1,-1,-1),st(1,-1,1),st(1,1,-1),st(1,1,1)],oNe=Math.sqrt(3),bie=[null];function FSt(t){return bie[0]=t,bie}const PW=uo(),Up=W(),tp=W(),ip=W(),zx=new Pi,kSt=uo(),R1=uo(),RW=uo(),IW=uo(),NN=[{min:0,max:0},{min:0,max:0},{min:0,max:0}],nS=new Pi,a1e=[0,0,0,0,0,0,0,0],xm=_ie;var C2;(function(t){t[t.ASYNC=0]="ASYNC",t[t.SYNC=1]="SYNC"})(C2||(C2={}));let aNe=class extends t6{get objects(){return this._objects}constructor(e,i,r=""){super(),this.stage=e,this.apiLayerUid=r,this.type=Ws.Layer,this.events=new Dn,this.visible=!0,this.pickable=!0,this.sliceable=!1,this._objects=new Pi,this._objectsAdded=new Pi,this._handles=new N_,this.apiLayerUid=r,this.visible=(i==null?void 0:i.visible)??!0,this.pickable=(i==null?void 0:i.pickable)??!0,this.updatePolicy=(i==null?void 0:i.updatePolicy)??C2.ASYNC,this._disableOctree=(i==null?void 0:i.disableOctree)??!1,e.add(this);for(const n of $St)this._handles.add(this.events.on(n,s=>e.handleEvent(n,s)))}destroy(){this._handles.size&&(this._handles.destroy(),this.stage.remove(this),this.invalidateSpatialQueryAccelerator())}add(e){this._objects.push(e),e.parentLayer=this,this.events.emit("layerObjectAdded",{layer:this,object:e}),this._octree!=null&&this._objectsAdded.push(e)}remove(e){this._objects.removeUnordered(e)&&(e.parentLayer=null,this.events.emit("layerObjectRemoved",{layer:this,object:e}),this._octree!=null&&(this._objectsAdded.removeUnordered(e)||this._octree.remove([e])))}addMany(e){this._objects.pushArray(e);for(const i of e)i.parentLayer=this;this.events.emit("layerObjectsAdded",{layer:this,objects:e}),this._octree!=null&&this._objectsAdded.pushArray(e)}removeMany(e){const i=new Array;if(this._objects.removeUnorderedMany(e,e.length,i),i.length!==0){for(const r of i)r.parentLayer=null;if(this.events.emit("layerObjectsRemoved",{layer:this,objects:i}),this._octree!=null){for(let r=0;r50&&!this._disableOctree?(this._octree=new xm(e=>e.boundingVolumeWorldSpace.bounds),this._octree.add(this._objects.data,this._objects.length)):this._octree!=null&&this._objectsAdded.length>0&&(this._octree.add(this._objectsAdded.data,this._objectsAdded.length),this._objectsAdded.clear()),this._octree}invalidateSpatialQueryAccelerator(){this._octree=et(this._octree),this._objectsAdded.clear()}};function YU(t){return t!=null&&t.type===Ws.Layer}var Sp,nE;(function(t){t[t.Draped=0]="Draped",t[t.Screen=1]="Screen",t[t.World=2]="World",t[t.COUNT=3]="COUNT"})(Sp||(Sp={})),function(t){t[t.Center=0]="Center",t[t.Tip=1]="Tip",t[t.COUNT=2]="COUNT"}(nE||(nE={}));let Fa=class extends pu{constructor(){super(...arguments),this.output=ue.Color,this.transparencyPassType=Jt.NONE,this.occluder=!1,this.hasSlicePlane=!1,this.writeDepth=!1,this.space=Sp.Screen,this.hideOnShortSegments=!1,this.hasCap=!1,this.anchor=nE.Center,this.hasTip=!1,this.vvSize=!1,this.vvColor=!1,this.vvOpacity=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1}get draped(){return this.space===Sp.Draped}};y([fe({count:ue.COUNT})],Fa.prototype,"output",void 0),y([fe({count:Jt.COUNT})],Fa.prototype,"transparencyPassType",void 0),y([fe()],Fa.prototype,"occluder",void 0),y([fe()],Fa.prototype,"hasSlicePlane",void 0),y([fe()],Fa.prototype,"writeDepth",void 0),y([fe({count:Sp.COUNT})],Fa.prototype,"space",void 0),y([fe()],Fa.prototype,"hideOnShortSegments",void 0),y([fe()],Fa.prototype,"hasCap",void 0),y([fe({count:nE.COUNT})],Fa.prototype,"anchor",void 0),y([fe()],Fa.prototype,"hasTip",void 0),y([fe()],Fa.prototype,"vvSize",void 0),y([fe()],Fa.prototype,"vvColor",void 0),y([fe()],Fa.prototype,"vvOpacity",void 0),y([fe()],Fa.prototype,"hasOccludees",void 0),y([fe()],Fa.prototype,"multipassEnabled",void 0),y([fe()],Fa.prototype,"cullAboveGround",void 0),y([fe({constValue:!1})],Fa.prototype,"occlusionPass",void 0),y([fe({constValue:!0})],Fa.prototype,"hasVvInstancing",void 0),y([fe({constValue:!0})],Fa.prototype,"hasSliceTranslatedView",void 0);const l1e=8;function lNe(t,e){const i=t.vertex;i.uniforms.add(new ft("intrinsicWidth",r=>r.width)),e.vvSize?(t.attributes.add(J.SIZEFEATUREATTRIBUTE,"float"),i.uniforms.add(new Oi("vvSizeMinSize",r=>r.vvSize.minSize),new Oi("vvSizeMaxSize",r=>r.vvSize.maxSize),new Oi("vvSizeOffset",r=>r.vvSize.offset),new Oi("vvSizeFactor",r=>r.vvSize.factor)),i.code.add(V`float getSize() { return intrinsicWidth * clamp(vvSizeOffset + sizeFeatureAttribute * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize).x; }`)):(t.attributes.add(J.SIZE,"float"),i.code.add(V`float getSize(){ return intrinsicWidth * size; -}`)),e.vvOpacity?(t.attributes.add(J.OPACITYFEATUREATTRIBUTE,"float"),i.constants.add("vvOpacityNumber","int",8),i.uniforms.add(new Hu("vvOpacityValues",r=>r.vvOpacity.values,a1e),new Hu("vvOpacityOpacities",r=>r.vvOpacity.opacityValues,a1e)),i.code.add(V`float interpolateOpacity( float value ){ +}`)),e.vvOpacity?(t.attributes.add(J.OPACITYFEATUREATTRIBUTE,"float"),i.constants.add("vvOpacityNumber","int",8),i.uniforms.add(new Wu("vvOpacityValues",r=>r.vvOpacity.values,l1e),new Wu("vvOpacityOpacities",r=>r.vvOpacity.opacityValues,l1e)),i.code.add(V`float interpolateOpacity( float value ){ if (value <= vvOpacityValues[0]) { return vvOpacityOpacities[0]; } @@ -2792,16 +2781,16 @@ vec4 applyOpacity( vec4 color ){ return vec4(color.xyz, interpolateOpacity(opacityFeatureAttribute)); }`)):i.code.add(V`vec4 applyOpacity( vec4 color ){ return color; -}`),e.vvColor?(t.include(e_,e),t.attributes.add(J.COLORFEATUREATTRIBUTE,"float"),i.code.add(V`vec4 getColor(){ +}`),e.vvColor?(t.include(a_,e),t.attributes.add(J.COLORFEATUREATTRIBUTE,"float"),i.code.add(V`vec4 getColor(){ return applyOpacity(interpolateVVColor(colorFeatureAttribute)); }`)):(t.attributes.add(J.COLOR,"vec4"),i.code.add(V`vec4 getColor(){ return applyOpacity(color); -}`))}function BL(t,e,i=0){const r=Je(t,0,BTt);for(let n=0;n<4;n++)e[i+n]=Math.floor(256*jTt(r*UTt[n]))}function jle(t,e=0){let i=0;for(let r=0;r<4;r++)i+=t[e+r]*VTt[r];return i}const UTt=[1,256,65536,16777216],VTt=[1/256,1/65536,1/16777216,1/4294967296],BTt=jle(new Uint8ClampedArray([255,255,255,255]));function jTt(t){return t-Math.floor(t)}let dNe=class{constructor(e,i,r){this._createTexture=e,this._parametersKey=i,this._repository=new Map,this._orphanCache=r.newCache(`procedural-texture-repository:${hp()}`,n=>n.dispose())}destroy(){for(const[e,{texture:i}]of this._repository)i.dispose();this._repository.clear(),this._orphanCache.destroy()}swap(e,i=null){const r=this._acquire(e);return this.release(i),r}release(e){if(e==null)return;const i=this._parametersKey(e),r=this._repository.get(i);if(r&&(r.refCount--,r.refCount===0)){this._repository.delete(i);const{texture:n}=r,s=n.gpuMemoryUsage;this._orphanCache.put(i,n,s)}}_acquire(e){if(e==null)return null;const i=this._parametersKey(e),r=this._repository.get(i);if(r)return r.refCount++,r.texture;const n=this._orphanCache.pop(i)??this._createTexture(e),s=new GTt(n);return this._repository.set(i,s),n}},GTt=class{constructor(e){this.texture=e,this.refCount=1}};function HTt(t,e){return new dNe(i=>{const{encodedData:r,textureSize:n}=qTt(i),s=new tn;return s.internalFormat=ci.RGBA,s.width=n,s.height=1,s.wrapMode=Bi.REPEAT,new Ai(t,s,r)},i=>`${i.pattern.join(",")}-r${i.pixelRatio}`,e)}function qTt(t){const e=Gle(t),i=1/t.pixelRatio,r=pNe(t),n=fNe(t),s=(Math.floor(.5*(n-1))+.5)*i,o=[];let l=1;for(const T of e){for(let A=0;AMath.round(e*t.pixelRatio))}function pNe(t){if(t==null)return 1;const e=Gle(t);return Math.floor(e.reduce((i,r)=>i+r))}function fNe(t){return Gle(t).reduce((e,i)=>Math.max(e,i))}function WTt(t){return t==null?gp:t.length===4?t:rs(YTt,t[0],t[1],t[2],1)}const YTt=Xi();function XTt(t,e){t.constants.add("stippleAlphaColorDiscard","float",.001),t.constants.add("stippleAlphaHighlightDiscard","float",.5),e.stippleEnabled?ZTt(t,e):JTt(t)}function ZTt(t,e){const i=!(e.draped&&e.stipplePreferContinuous),{vertex:r,fragment:n}=t;n.include(o0),e.draped||(Nm(r,e),r.uniforms.add(new ft("worldToScreenPerDistanceRatio",(s,o)=>1/o.camera.perScreenPixelRatio)),r.code.add(V`float computeWorldToScreenRatio(vec3 segmentCenter) { +}`))}function JL(t,e,i=0){const r=Je(t,0,VSt);for(let n=0;n<4;n++)e[i+n]=Math.floor(256*BSt(r*zSt[n]))}function ice(t,e=0){let i=0;for(let r=0;r<4;r++)i+=t[e+r]*USt[r];return i}const zSt=[1,256,65536,16777216],USt=[1/256,1/65536,1/16777216,1/4294967296],VSt=ice(new Uint8ClampedArray([255,255,255,255]));function BSt(t){return t-Math.floor(t)}let cNe=class{constructor(e,i,r){this._createTexture=e,this._parametersKey=i,this._repository=new Map,this._orphanCache=r.newCache(`procedural-texture-repository:${mp()}`,n=>n.dispose())}destroy(){for(const[e,{texture:i}]of this._repository)i.dispose();this._repository.clear(),this._orphanCache.destroy()}swap(e,i=null){const r=this._acquire(e);return this.release(i),r}release(e){if(e==null)return;const i=this._parametersKey(e),r=this._repository.get(i);if(r&&(r.refCount--,r.refCount===0)){this._repository.delete(i);const{texture:n}=r,s=n.gpuMemoryUsage;this._orphanCache.put(i,n,s)}}_acquire(e){if(e==null)return null;const i=this._parametersKey(e),r=this._repository.get(i);if(r)return r.refCount++,r.texture;const n=this._orphanCache.pop(i)??this._createTexture(e),s=new jSt(n);return this._repository.set(i,s),n}},jSt=class{constructor(e){this.texture=e,this.refCount=1}};function GSt(t,e){return new cNe(i=>{const{encodedData:r,textureSize:n}=HSt(i),s=new rn;return s.internalFormat=ci.RGBA,s.width=n,s.height=1,s.wrapMode=Bi.REPEAT,new Ai(t,s,r)},i=>`${i.pattern.join(",")}-r${i.pixelRatio}`,e)}function HSt(t){const e=rce(t),i=1/t.pixelRatio,r=uNe(t),n=hNe(t),s=(Math.floor(.5*(n-1))+.5)*i,o=[];let a=1;for(const S of e){for(let C=0;CMath.round(e*t.pixelRatio))}function uNe(t){if(t==null)return 1;const e=rce(t);return Math.floor(e.reduce((i,r)=>i+r))}function hNe(t){return rce(t).reduce((e,i)=>Math.max(e,i))}function qSt(t){return t==null?bp:t.length===4?t:rs(WSt,t[0],t[1],t[2],1)}const WSt=Xi();function YSt(t,e){t.constants.add("stippleAlphaColorDiscard","float",.001),t.constants.add("stippleAlphaHighlightDiscard","float",.5),e.stippleEnabled?XSt(t,e):ZSt(t)}function XSt(t,e){const i=!(e.draped&&e.stipplePreferContinuous),{vertex:r,fragment:n}=t;n.include(c0),e.draped||(zm(r,e),r.uniforms.add(new ft("worldToScreenPerDistanceRatio",(s,o)=>1/o.camera.perScreenPixelRatio)),r.code.add(V`float computeWorldToScreenRatio(vec3 segmentCenter) { float segmentDistanceToCamera = length(segmentCenter - cameraPosition); return worldToScreenPerDistanceRatio / segmentDistanceToCamera; }`)),t.varyings.add("vStippleDistance","float"),t.varyings.add("vStippleDistanceLimits","vec2"),t.varyings.add("vStipplePatternStretch","float"),r.code.add(V` float discretizeWorldToScreenRatio(float worldToScreenRatio) { - float step = ${QTt}; + float step = ${KSt}; float discreteWorldToScreenRatio = log(worldToScreenRatio); discreteWorldToScreenRatio = ceil(discreteWorldToScreenRatio / step) * step; @@ -2810,7 +2799,7 @@ return worldToScreenPerDistanceRatio / segmentDistanceToCamera; } `),r.code.add(V`vec2 computeStippleDistanceLimits(float startPseudoScreen, float segmentLengthPseudoScreen, float segmentLengthScreen, float patternLength) {`),r.code.add(V` if (segmentLengthPseudoScreen >= ${i?"patternLength":"1e4"}) { - `),bP(r),r.code.add(V`float repetitions = segmentLengthScreen / (patternLength * pixelRatio); + `),P5(r),r.code.add(V`float repetitions = segmentLengthScreen / (patternLength * pixelRatio); float flooredRepetitions = max(1.0, floor(repetitions + 0.5)); float segmentLengthScreenRounded = flooredRepetitions * patternLength; float stretch = repetitions / flooredRepetitions; @@ -2818,7 +2807,7 @@ vStipplePatternStretch = max(0.75, stretch); return vec2(0.0, segmentLengthScreenRounded); } return vec2(startPseudoScreen, startPseudoScreen + segmentLengthPseudoScreen); -}`),n.uniforms.add(new Zt("stipplePatternTexture",s=>s.stippleTexture),new ft("stipplePatternSDFNormalizer",s=>KTt(s.stipplePattern)),new ft("stipplePatternPixelSizeInv",s=>1/mNe(s))),n.code.add(V`float getStippleSDF(out bool isClamped) { +}`),n.uniforms.add(new Zt("stipplePatternTexture",s=>s.stippleTexture),new ft("stipplePatternSDFNormalizer",s=>JSt(s.stipplePattern)),new ft("stipplePatternPixelSizeInv",s=>1/dNe(s))),n.code.add(V`float getStippleSDF(out bool isClamped) { float stippleDistanceClamped = clamp(vStippleDistance, vStippleDistanceLimits.x, vStippleDistanceLimits.y); vec2 aaCorrectedLimits = vStippleDistanceLimits + vec2(1.0, -1.0) / gl_FragCoord.w; isClamped = vStippleDistance < aaCorrectedLimits.x || vStippleDistance > aaCorrectedLimits.y; @@ -2837,16 +2826,16 @@ bool isClamped; float stippleSDF = getStippleSDF(isClamped); float antiAliasedResult = clamp(stippleSDF * vLineWidth + 0.5, 0.0, 1.0); return isClamped ? floor(antiAliasedResult + 0.5) : antiAliasedResult; -}`),e.stippleOffColorEnabled?(n.uniforms.add(new gr("stippleOffColor",s=>WTt(s.stippleOffColor))),n.code.add(V`#define discardByStippleAlpha(stippleAlpha, threshold) {} +}`),e.stippleOffColorEnabled?(n.uniforms.add(new gr("stippleOffColor",s=>qSt(s.stippleOffColor))),n.code.add(V`#define discardByStippleAlpha(stippleAlpha, threshold) {} #define blendStipple(color, stippleAlpha) mix(color, stippleOffColor, stippleAlpha)`)):n.code.add(V`#define discardByStippleAlpha(stippleAlpha, threshold) if (stippleAlpha < threshold) { discard; } -#define blendStipple(color, stippleAlpha) vec4(color.rgb, color.a * stippleAlpha)`)}function JTt(t){t.fragment.code.add(V`float getStippleAlpha() { return 1.0; } +#define blendStipple(color, stippleAlpha) vec4(color.rgb, color.a * stippleAlpha)`)}function ZSt(t){t.fragment.code.add(V`float getStippleAlpha() { return 1.0; } #define discardByStippleAlpha(_stippleAlpha_, _threshold_) {} -#define blendStipple(color, _stippleAlpha_) color`)}function KTt(t){return t?(Math.floor(.5*(fNe(t)-1))+.5)/t.pixelRatio:1}function mNe(t){const e=t.stipplePattern;return e?pNe(t.stipplePattern)/e.pixelRatio:1}const QTt=V.float(.4);async function C_(t,e){const{data:i}=await bi(t,{responseType:"image",...e});return i}function eEt(){if(SW==null){const t=e=>Wr(`esri/libs/basisu/${e}`);SW=we(()=>import("./basis_transcoder-FsrOzl2Q.js"),__vite__mapDeps([])).then(e=>e.b).then(({default:e})=>e({locateFile:t}).then(i=>(i.initializeBasis(),delete i.then,i)))}return SW}let SW;var LS;(function(t){t[t.ETC1_RGB=0]="ETC1_RGB",t[t.ETC2_RGBA=1]="ETC2_RGBA",t[t.BC1_RGB=2]="BC1_RGB",t[t.BC3_RGBA=3]="BC3_RGBA",t[t.BC4_R=4]="BC4_R",t[t.BC5_RG=5]="BC5_RG",t[t.BC7_M6_RGB=6]="BC7_M6_RGB",t[t.BC7_M5_RGBA=7]="BC7_M5_RGBA",t[t.PVRTC1_4_RGB=8]="PVRTC1_4_RGB",t[t.PVRTC1_4_RGBA=9]="PVRTC1_4_RGBA",t[t.ASTC_4x4_RGBA=10]="ASTC_4x4_RGBA",t[t.ATC_RGB=11]="ATC_RGB",t[t.ATC_RGBA=12]="ATC_RGBA",t[t.FXT1_RGB=17]="FXT1_RGB",t[t.PVRTC2_4_RGB=18]="PVRTC2_4_RGB",t[t.PVRTC2_4_RGBA=19]="PVRTC2_4_RGBA",t[t.ETC2_EAC_R11=20]="ETC2_EAC_R11",t[t.ETC2_EAC_RG11=21]="ETC2_EAC_RG11",t[t.RGBA32=13]="RGBA32",t[t.RGB565=14]="RGB565",t[t.BGR565=15]="BGR565",t[t.RGBA4444=16]="RGBA4444"})(LS||(LS={}));let Pm=null,PN=null;async function gNe(){return PN==null&&(PN=eEt(),Pm=await PN),PN}function tEt(t,e){if(Pm==null)return t.byteLength;const i=new Pm.BasisFile(new Uint8Array(t)),r=vNe(i)?yNe(i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),e):0;return i.close(),i.delete(),r}function iEt(t,e){if(Pm==null)return t.byteLength;const i=new Pm.KTX2File(new Uint8Array(t)),r=_Ne(i)?yNe(i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),e):0;return i.close(),i.delete(),r}function yNe(t,e,i,r,n){const s=gae(e?eo.COMPRESSED_RGBA8_ETC2_EAC:eo.COMPRESSED_RGB8_ETC2),o=n&&t>1?(4**t-1)/(3*4**(t-1)):1;return Math.ceil(i*r*s*o)}function vNe(t){return t.getNumImages()>=1&&!t.isUASTC()}function _Ne(t){return t.getFaces()>=1&&t.isETC1S()}async function rEt(t,e,i){Pm==null&&(Pm=await gNe());const r=new Pm.BasisFile(new Uint8Array(i));if(!vNe(r))return null;r.startTranscoding();const n=bNe(t,e,r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),(s,o)=>r.getImageTranscodedSizeInBytes(0,s,o),(s,o,l)=>r.transcodeImage(l,0,s,o,0,0));return r.close(),r.delete(),n}async function nEt(t,e,i){Pm==null&&(Pm=await gNe());const r=new Pm.KTX2File(new Uint8Array(i));if(!_Ne(r))return null;r.startTranscoding();const n=bNe(t,e,r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),(s,o)=>r.getImageTranscodedSizeInBytes(s,0,0,o),(s,o,l)=>r.transcodeImage(l,s,0,0,o,0,-1,-1));return r.close(),r.delete(),n}function bNe(t,e,i,r,n,s,o,l){const{compressedTextureETC:c,compressedTextureS3TC:f}=t.capabilities,[_,x]=c?r?[LS.ETC2_RGBA,eo.COMPRESSED_RGBA8_ETC2_EAC]:[LS.ETC1_RGB,eo.COMPRESSED_RGB8_ETC2]:f?r?[LS.BC3_RGBA,eo.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[LS.BC1_RGB,eo.COMPRESSED_RGB_S3TC_DXT1_EXT]:[LS.RGBA32,ci.RGBA],T=e.hasMipmap?i:Math.min(1,i),A=[];for(let M=0;M1,e.samplingMode=e.hasMipmap?ki.LINEAR_MIPMAP_LINEAR:ki.LINEAR,e.width=n,e.height=s,new Ai(t,e,{type:"compressed",levels:A})}const RN=Ce.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil"),sEt=542327876,oEt=131072,aEt=4;function Hle(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}function lEt(t){return String.fromCharCode(255&t,t>>8&255,t>>16&255,t>>24&255)}const cEt=Hle("DXT1"),uEt=Hle("DXT3"),hEt=Hle("DXT5"),dEt=31,pEt=0,fEt=1,mEt=2,gEt=3,yEt=4,vEt=7,_Et=20,bEt=21;function wEt(t,e,i){const r=xEt(i,e.hasMipmap??!1);if(r==null)throw new Error("DDS texture data is null");const{textureData:n,internalFormat:s,width:o,height:l}=r;return e.samplingMode=n.levels.length>1?ki.LINEAR_MIPMAP_LINEAR:ki.LINEAR,e.hasMipmap=n.levels.length>1,e.internalFormat=s,e.width=o,e.height=l,new Ai(t,e,n)}function xEt(t,e){const i=new Int32Array(t,0,dEt);if(i[pEt]!==sEt)return RN.error("Invalid magic number in DDS header"),null;if(!(i[_Et]&aEt))return RN.error("Unsupported format, must contain a FourCC code"),null;const r=i[bEt];let n,s;switch(r){case cEt:n=8,s=eo.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case uEt:n=16,s=eo.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case hEt:n=16,s=eo.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return RN.error("Unsupported FourCC code:",lEt(r)),null}let o=1,l=i[yEt],c=i[gEt];!(3&l)&&!(3&c)||(RN.warn("Rounding up compressed texture size to nearest multiple of 4."),l=l+3&-4,c=c+3&-4);const f=l,_=c;let x,T;i[mEt]&oEt&&e!==!1&&(o=Math.max(1,i[vEt]));let A=i[fEt]+4;const M=[];for(let I=0;I>2)*(c+3>>2)*n,x=new Uint8Array(t,A,T),M.push(x),A+=T,l=Math.max(1,l>>1),c=Math.max(1,c>>1);return{textureData:{type:"compressed",levels:M},internalFormat:s,width:f,height:_}}let OE=class extends Z9{get parameters(){return this._parameters}constructor(e,i){super(),this._data=e,this.type=Ws.Texture,this._glTexture=null,this._loadingPromise=null,this._loadingController=null,this.events=new Dn,this._parameters={...TEt,...i},this._startPreload(e)}dispose(){this.unload(),this._data=this.frameUpdate=void 0}_startPreload(e){e!=null&&(e instanceof HTMLVideoElement?(this.frameUpdate=i=>this._frameUpdate(e,i),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e))}_startPreloadVideoElement(e){if(!(E2(e.src)||e.preload==="auto"&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const i=!e.paused;if(e.src=e.src,i&&e.autoplay){const r=()=>{e.removeEventListener("canplay",r),e.play()};e.addEventListener("canplay",r)}}}_startPreloadImageElement(e){i1(e.src)||E2(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const i=new tn;return i.wrapMode=this._parameters.wrap??Bi.REPEAT,i.flipped=!this._parameters.noUnpackFlip,i.samplingMode=this._parameters.mipmap?ki.LINEAR_MIPMAP_LINEAR:ki.LINEAR,i.hasMipmap=!!this._parameters.mipmap,i.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,i.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),i}get glTexture(){return this._glTexture}get memoryEstimate(){var e;return((e=this._glTexture)==null?void 0:e.gpuMemoryUsage)||SEt(this._data,this._parameters)}load(e){if(this._glTexture)return this._glTexture;if(this._loadingPromise)return this._loadingPromise;const i=this._data;return i==null?(this._glTexture=new Ai(e,this._createDescriptor(e),null),this._glTexture):(this._parameters.reloadable||(this._data=void 0),typeof i=="string"?this._loadFromURL(e,i):i instanceof Image?this._loadFromImageElement(e,i):i instanceof HTMLVideoElement?this._loadFromVideoElement(e,i):i instanceof ImageData||i instanceof HTMLCanvasElement?this._loadFromImage(e,i):(XR(i)||Zw(i))&&this._parameters.encoding===Jv.DDS_ENCODING?this._loadFromDDSData(e,i):(XR(i)||Zw(i))&&this._parameters.encoding===Jv.KTX2_ENCODING?this._loadFromKTX2(e,i):(XR(i)||Zw(i))&&this._parameters.encoding===Jv.BASIS_ENCODING?this._loadFromBasis(e,i):Zw(i)?this._loadFromPixelData(e,i):XR(i)?this._loadFromPixelData(e,new Uint8Array(i)):null)}_frameUpdate(e,i){return this._glTexture==null||e.readyStatenEt(e,this._createDescriptor(e),i).then(r=>(this._glTexture=r,r)))}_loadFromBasis(e,i){return this._loadAsync(()=>rEt(e,this._createDescriptor(e),i).then(r=>(this._glTexture=r,r)))}_loadFromPixelData(e,i){Xt(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=this._parameters.components===1?ci.LUMINANCE:this._parameters.components===3?ci.RGB:ci.RGBA,r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new Ai(e,r,i),this._glTexture}_loadFromURL(e,i){return this._loadAsync(async r=>{const n=await C_(i,{signal:r});return St(r),this._loadFromImage(e,n)})}_loadFromImageElement(e,i){return i.complete?this._loadFromImage(e,i):this._loadAsync(async r=>{const n=await xEe(i,i.src,!1,r);return St(r),this._loadFromImage(e,n)})}_loadFromVideoElement(e,i){return i.readyState>=C$.HAVE_CURRENT_DATA?this._loadFromImage(e,i):this._loadFromVideoElementAsync(e,i)}_loadFromVideoElementAsync(e,i){return this._loadAsync(r=>new Promise((n,s)=>{const o=()=>{i.removeEventListener("loadeddata",l),i.removeEventListener("error",c),en(f)},l=()=>{i.readyState>=C$.HAVE_CURRENT_DATA&&(o(),n(this._loadFromImage(e,i)))},c=_=>{o(),s(_||new se("Failed to load video"))};i.addEventListener("loadeddata",l),i.addEventListener("error",c);const f=Yl(r,()=>c(ur()))}))}_loadFromImage(e,i){let r=i;if(!(r instanceof HTMLVideoElement)){const{maxTextureSize:o}=e.parameters;r=this._parameters.downsampleUncompressed?Tyt(r,o):Eyt(r,o)}const n=wNe(r);this._parameters.width=n.width,this._parameters.height=n.height;const s=this._createDescriptor(e);return s.pixelFormat=this._parameters.components===3?ci.RGB:ci.RGBA,s.width=n.width,s.height=n.height,this._glTexture=new Ai(e,s,r),this._glTexture}_loadAsync(e){const i=new AbortController;this._loadingController=i;const r=e(i.signal);this._loadingPromise=r;const n=()=>{this._loadingController===i&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(n,n),r}unload(){if(this._glTexture=Kt(this._glTexture),this._loadingController!=null){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}};function SEt(t,e){if(t==null)return 0;if(XR(t)||Zw(t))return e.encoding===Jv.KTX2_ENCODING?iEt(t,!!e.mipmap):e.encoding===Jv.BASIS_ENCODING?tEt(t,!!e.mipmap):t.byteLength;const{width:i,height:r}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?wNe(t):e;return(e.mipmap?4/3:1)*i*r*(e.components||4)||0}function wNe(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}var C$;(function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"})(C$||(C$={}));const TEt={wrap:{s:Bi.REPEAT,t:Bi.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1,downsampleUncompressed:!1},YU=128,qle=.5;function EEt(t){return t==="cross"||t==="x"}function CEt(t,e=YU,i=e*qle,r=0){const n=xNe(t,e,i,r);return new OE(n,{mipmap:!1,wrap:{s:Bi.CLAMP_TO_EDGE,t:Bi.CLAMP_TO_EDGE},width:e,height:e,components:4,noUnpackFlip:!0,reloadable:!0})}function xNe(t,e=YU,i=e*qle,r=0){switch(t){case"circle":default:return AEt(e,i);case"square":return MEt(e,i);case"cross":return PEt(e,i,r);case"x":return REt(e,i,r);case"kite":return OEt(e,i);case"triangle":return IEt(e,i);case"arrow":return $Et(e,i)}}function AEt(t,e){const i=t/2-.5;return u6(t,ENe(i,i,e/2))}function MEt(t,e){return SNe(t,e,!1)}function OEt(t,e){return SNe(t,e,!0)}function PEt(t,e,i=0){return TNe(t,e,!1,i)}function REt(t,e,i=0){return TNe(t,e,!0,i)}function IEt(t,e){return u6(t,CNe(t/2,e,e/2))}function $Et(t,e){const i=e,r=e/2,n=t/2,s=.8*i,o=ENe(n,(t-e)/2-s,Math.sqrt(s*s+r*r)),l=CNe(n,i,r);return u6(t,(c,f)=>Math.max(l(c,f),-o(c,f)))}function SNe(t,e,i){return i&&(e/=Math.SQRT2),u6(t,(r,n)=>{let s=r-.5*t+.25,o=.5*t-n-.75;if(i){const l=(s+o)/Math.SQRT2;o=(o-s)/Math.SQRT2,s=l}return Math.max(Math.abs(s),Math.abs(o))-.5*e})}function TNe(t,e,i,r=0){e-=r,i&&(e*=Math.SQRT2);const n=.5*e;return u6(t,(s,o)=>{let l,c=s-.5*t,f=.5*t-o-1;if(i){const _=(c+f)/Math.SQRT2;f=(f-c)/Math.SQRT2,c=_}return c=Math.abs(c),f=Math.abs(f),l=c>f?c>n?Math.sqrt((c-n)*(c-n)+f*f):f:f>n?Math.sqrt(c*c+(f-n)*(f-n)):c,l-=r/2,l})}function ENe(t,e,i){return(r,n)=>{const s=r-t,o=n-e;return Math.sqrt(s*s+o*o)-i}}function CNe(t,e,i){const r=Math.sqrt(e*e+i*i);return(n,s)=>{const o=Math.abs(n-t)-i,l=s-t+e/2+.75,c=(e*o+i*l)/r,f=-l;return Math.max(c,f)}}function u6(t,e){const i=new Uint8Array(4*t*t);for(let r=0;rWr(`esri/libs/basisu/${e}`);$W=we(()=>import("./basis_transcoder-5u4h2z6s.js"),__vite__mapDeps([])).then(e=>e.b).then(({default:e})=>e({locateFile:t}).then(i=>(i.initializeBasis(),delete i.then,i)))}return $W}let $W;var US;(function(t){t[t.ETC1_RGB=0]="ETC1_RGB",t[t.ETC2_RGBA=1]="ETC2_RGBA",t[t.BC1_RGB=2]="BC1_RGB",t[t.BC3_RGBA=3]="BC3_RGBA",t[t.BC4_R=4]="BC4_R",t[t.BC5_RG=5]="BC5_RG",t[t.BC7_M6_RGB=6]="BC7_M6_RGB",t[t.BC7_M5_RGBA=7]="BC7_M5_RGBA",t[t.PVRTC1_4_RGB=8]="PVRTC1_4_RGB",t[t.PVRTC1_4_RGBA=9]="PVRTC1_4_RGBA",t[t.ASTC_4x4_RGBA=10]="ASTC_4x4_RGBA",t[t.ATC_RGB=11]="ATC_RGB",t[t.ATC_RGBA=12]="ATC_RGBA",t[t.FXT1_RGB=17]="FXT1_RGB",t[t.PVRTC2_4_RGB=18]="PVRTC2_4_RGB",t[t.PVRTC2_4_RGBA=19]="PVRTC2_4_RGBA",t[t.ETC2_EAC_R11=20]="ETC2_EAC_R11",t[t.ETC2_EAC_RG11=21]="ETC2_EAC_RG11",t[t.RGBA32=13]="RGBA32",t[t.RGB565=14]="RGB565",t[t.BGR565=15]="BGR565",t[t.RGBA4444=16]="RGBA4444"})(US||(US={}));let Im=null,FN=null;async function pNe(){return FN==null&&(FN=QSt(),Im=await FN),FN}function eTt(t,e){if(Im==null)return t.byteLength;const i=new Im.BasisFile(new Uint8Array(t)),r=mNe(i)?fNe(i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),e):0;return i.close(),i.delete(),r}function tTt(t,e){if(Im==null)return t.byteLength;const i=new Im.KTX2File(new Uint8Array(t)),r=gNe(i)?fNe(i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),e):0;return i.close(),i.delete(),r}function fNe(t,e,i,r,n){const s=Oae(e?to.COMPRESSED_RGBA8_ETC2_EAC:to.COMPRESSED_RGB8_ETC2),o=n&&t>1?(4**t-1)/(3*4**(t-1)):1;return Math.ceil(i*r*s*o)}function mNe(t){return t.getNumImages()>=1&&!t.isUASTC()}function gNe(t){return t.getFaces()>=1&&t.isETC1S()}async function iTt(t,e,i){Im==null&&(Im=await pNe());const r=new Im.BasisFile(new Uint8Array(i));if(!mNe(r))return null;r.startTranscoding();const n=yNe(t,e,r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),(s,o)=>r.getImageTranscodedSizeInBytes(0,s,o),(s,o,a)=>r.transcodeImage(a,0,s,o,0,0));return r.close(),r.delete(),n}async function rTt(t,e,i){Im==null&&(Im=await pNe());const r=new Im.KTX2File(new Uint8Array(i));if(!gNe(r))return null;r.startTranscoding();const n=yNe(t,e,r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),(s,o)=>r.getImageTranscodedSizeInBytes(s,0,0,o),(s,o,a)=>r.transcodeImage(a,s,0,0,o,0,-1,-1));return r.close(),r.delete(),n}function yNe(t,e,i,r,n,s,o,a){const{compressedTextureETC:c,compressedTextureS3TC:p}=t.capabilities,[_,x]=c?r?[US.ETC2_RGBA,to.COMPRESSED_RGBA8_ETC2_EAC]:[US.ETC1_RGB,to.COMPRESSED_RGB8_ETC2]:p?r?[US.BC3_RGBA,to.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[US.BC1_RGB,to.COMPRESSED_RGB_S3TC_DXT1_EXT]:[US.RGBA32,ci.RGBA],S=e.hasMipmap?i:Math.min(1,i),C=[];for(let M=0;M1,e.samplingMode=e.hasMipmap?ki.LINEAR_MIPMAP_LINEAR:ki.LINEAR,e.width=n,e.height=s,new Ai(t,e,{type:"compressed",levels:C})}const kN=Ce.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil"),nTt=542327876,sTt=131072,oTt=4;function nce(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}function aTt(t){return String.fromCharCode(255&t,t>>8&255,t>>16&255,t>>24&255)}const lTt=nce("DXT1"),cTt=nce("DXT3"),uTt=nce("DXT5"),hTt=31,dTt=0,pTt=1,fTt=2,mTt=3,gTt=4,yTt=7,vTt=20,_Tt=21;function bTt(t,e,i){const r=wTt(i,e.hasMipmap??!1);if(r==null)throw new Error("DDS texture data is null");const{textureData:n,internalFormat:s,width:o,height:a}=r;return e.samplingMode=n.levels.length>1?ki.LINEAR_MIPMAP_LINEAR:ki.LINEAR,e.hasMipmap=n.levels.length>1,e.internalFormat=s,e.width=o,e.height=a,new Ai(t,e,n)}function wTt(t,e){const i=new Int32Array(t,0,hTt);if(i[dTt]!==nTt)return kN.error("Invalid magic number in DDS header"),null;if(!(i[vTt]&oTt))return kN.error("Unsupported format, must contain a FourCC code"),null;const r=i[_Tt];let n,s;switch(r){case lTt:n=8,s=to.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case cTt:n=16,s=to.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case uTt:n=16,s=to.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return kN.error("Unsupported FourCC code:",aTt(r)),null}let o=1,a=i[gTt],c=i[mTt];!(3&a)&&!(3&c)||(kN.warn("Rounding up compressed texture size to nearest multiple of 4."),a=a+3&-4,c=c+3&-4);const p=a,_=c;let x,S;i[fTt]&sTt&&e!==!1&&(o=Math.max(1,i[yTt]));let C=i[pTt]+4;const M=[];for(let P=0;P>2)*(c+3>>2)*n,x=new Uint8Array(t,C,S),M.push(x),C+=S,a=Math.max(1,a>>1),c=Math.max(1,c>>1);return{textureData:{type:"compressed",levels:M},internalFormat:s,width:p,height:_}}let DE=class extends t6{get parameters(){return this._parameters}constructor(e,i){super(),this._data=e,this.type=Ws.Texture,this._glTexture=null,this._loadingPromise=null,this._loadingController=null,this.events=new Dn,this._parameters={...STt,...i},this._startPreload(e)}dispose(){this.unload(),this._data=this.frameUpdate=void 0}_startPreload(e){e!=null&&(e instanceof HTMLVideoElement?(this.frameUpdate=i=>this._frameUpdate(e,i),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e))}_startPreloadVideoElement(e){if(!(R2(e.src)||e.preload==="auto"&&e.crossOrigin)){e.preload="auto",e.crossOrigin="anonymous";const i=!e.paused;if(e.src=e.src,i&&e.autoplay){const r=()=>{e.removeEventListener("canplay",r),e.play()};e.addEventListener("canplay",r)}}}_startPreloadImageElement(e){c1(e.src)||R2(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const i=new rn;return i.wrapMode=this._parameters.wrap??Bi.REPEAT,i.flipped=!this._parameters.noUnpackFlip,i.samplingMode=this._parameters.mipmap?ki.LINEAR_MIPMAP_LINEAR:ki.LINEAR,i.hasMipmap=!!this._parameters.mipmap,i.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,i.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),i}get glTexture(){return this._glTexture}get memoryEstimate(){var e;return((e=this._glTexture)==null?void 0:e.gpuMemoryUsage)||xTt(this._data,this._parameters)}load(e){if(this._glTexture)return this._glTexture;if(this._loadingPromise)return this._loadingPromise;const i=this._data;return i==null?(this._glTexture=new Ai(e,this._createDescriptor(e),null),this._glTexture):(this._parameters.reloadable||(this._data=void 0),typeof i=="string"?this._loadFromURL(e,i):i instanceof Image?this._loadFromImageElement(e,i):i instanceof HTMLVideoElement?this._loadFromVideoElement(e,i):i instanceof ImageData||i instanceof HTMLCanvasElement?this._loadFromImage(e,i):(oI(i)||i2(i))&&this._parameters.encoding===n_.DDS_ENCODING?this._loadFromDDSData(e,i):(oI(i)||i2(i))&&this._parameters.encoding===n_.KTX2_ENCODING?this._loadFromKTX2(e,i):(oI(i)||i2(i))&&this._parameters.encoding===n_.BASIS_ENCODING?this._loadFromBasis(e,i):i2(i)?this._loadFromPixelData(e,i):oI(i)?this._loadFromPixelData(e,new Uint8Array(i)):null)}_frameUpdate(e,i){return this._glTexture==null||e.readyStaterTt(e,this._createDescriptor(e),i).then(r=>(this._glTexture=r,r)))}_loadFromBasis(e,i){return this._loadAsync(()=>iTt(e,this._createDescriptor(e),i).then(r=>(this._glTexture=r,r)))}_loadFromPixelData(e,i){Xt(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return r.pixelFormat=this._parameters.components===1?ci.LUMINANCE:this._parameters.components===3?ci.RGB:ci.RGBA,r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._glTexture=new Ai(e,r,i),this._glTexture}_loadFromURL(e,i){return this._loadAsync(async r=>{const n=await $_(i,{signal:r});return St(r),this._loadFromImage(e,n)})}_loadFromImageElement(e,i){return i.complete?this._loadFromImage(e,i):this._loadAsync(async r=>{const n=await HTe(i,i.src,!1,r);return St(r),this._loadFromImage(e,n)})}_loadFromVideoElement(e,i){return i.readyState>=N$.HAVE_CURRENT_DATA?this._loadFromImage(e,i):this._loadFromVideoElementAsync(e,i)}_loadFromVideoElementAsync(e,i){return this._loadAsync(r=>new Promise((n,s)=>{const o=()=>{i.removeEventListener("loadeddata",a),i.removeEventListener("error",c),en(p)},a=()=>{i.readyState>=N$.HAVE_CURRENT_DATA&&(o(),n(this._loadFromImage(e,i)))},c=_=>{o(),s(_||new se("Failed to load video"))};i.addEventListener("loadeddata",a),i.addEventListener("error",c);const p=Zl(r,()=>c(ur()))}))}_loadFromImage(e,i){let r=i;if(!(r instanceof HTMLVideoElement)){const{maxTextureSize:o}=e.parameters;r=this._parameters.downsampleUncompressed?Sgt(r,o):Tgt(r,o)}const n=vNe(r);this._parameters.width=n.width,this._parameters.height=n.height;const s=this._createDescriptor(e);return s.pixelFormat=this._parameters.components===3?ci.RGB:ci.RGBA,s.width=n.width,s.height=n.height,this._glTexture=new Ai(e,s,r),this._glTexture}_loadAsync(e){const i=new AbortController;this._loadingController=i;const r=e(i.signal);this._loadingPromise=r;const n=()=>{this._loadingController===i&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null)};return r.then(n,n),r}unload(){if(this._glTexture=Kt(this._glTexture),this._loadingController!=null){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}};function xTt(t,e){if(t==null)return 0;if(oI(t)||i2(t))return e.encoding===n_.KTX2_ENCODING?tTt(t,!!e.mipmap):e.encoding===n_.BASIS_ENCODING?eTt(t,!!e.mipmap):t.byteLength;const{width:i,height:r}=t instanceof Image||t instanceof ImageData||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement?vNe(t):e;return(e.mipmap?4/3:1)*i*r*(e.components||4)||0}function vNe(t){return t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t}var N$;(function(t){t[t.HAVE_NOTHING=0]="HAVE_NOTHING",t[t.HAVE_METADATA=1]="HAVE_METADATA",t[t.HAVE_CURRENT_DATA=2]="HAVE_CURRENT_DATA",t[t.HAVE_FUTURE_DATA=3]="HAVE_FUTURE_DATA",t[t.HAVE_ENOUGH_DATA=4]="HAVE_ENOUGH_DATA"})(N$||(N$={}));const STt={wrap:{s:Bi.REPEAT,t:Bi.REPEAT},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1,downsampleUncompressed:!1},XU=128,sce=.5;function TTt(t){return t==="cross"||t==="x"}function ETt(t,e=XU,i=e*sce,r=0){const n=_Ne(t,e,i,r);return new DE(n,{mipmap:!1,wrap:{s:Bi.CLAMP_TO_EDGE,t:Bi.CLAMP_TO_EDGE},width:e,height:e,components:4,noUnpackFlip:!0,reloadable:!0})}function _Ne(t,e=XU,i=e*sce,r=0){switch(t){case"circle":default:return CTt(e,i);case"square":return ATt(e,i);case"cross":return OTt(e,i,r);case"x":return PTt(e,i,r);case"kite":return MTt(e,i);case"triangle":return RTt(e,i);case"arrow":return ITt(e,i)}}function CTt(t,e){const i=t/2-.5;return m6(t,xNe(i,i,e/2))}function ATt(t,e){return bNe(t,e,!1)}function MTt(t,e){return bNe(t,e,!0)}function OTt(t,e,i=0){return wNe(t,e,!1,i)}function PTt(t,e,i=0){return wNe(t,e,!0,i)}function RTt(t,e){return m6(t,SNe(t/2,e,e/2))}function ITt(t,e){const i=e,r=e/2,n=t/2,s=.8*i,o=xNe(n,(t-e)/2-s,Math.sqrt(s*s+r*r)),a=SNe(n,i,r);return m6(t,(c,p)=>Math.max(a(c,p),-o(c,p)))}function bNe(t,e,i){return i&&(e/=Math.SQRT2),m6(t,(r,n)=>{let s=r-.5*t+.25,o=.5*t-n-.75;if(i){const a=(s+o)/Math.SQRT2;o=(o-s)/Math.SQRT2,s=a}return Math.max(Math.abs(s),Math.abs(o))-.5*e})}function wNe(t,e,i,r=0){e-=r,i&&(e*=Math.SQRT2);const n=.5*e;return m6(t,(s,o)=>{let a,c=s-.5*t,p=.5*t-o-1;if(i){const _=(c+p)/Math.SQRT2;p=(p-c)/Math.SQRT2,c=_}return c=Math.abs(c),p=Math.abs(p),a=c>p?c>n?Math.sqrt((c-n)*(c-n)+p*p):p:p>n?Math.sqrt(c*c+(p-n)*(p-n)):c,a-=r/2,a})}function xNe(t,e,i){return(r,n)=>{const s=r-t,o=n-e;return Math.sqrt(s*s+o*o)-i}}function SNe(t,e,i){const r=Math.sqrt(e*e+i*i);return(n,s)=>{const o=Math.abs(n-t)-i,a=s-t+e/2+.75,c=(e*o+i*a)/r,p=-a;return Math.max(c,p)}}function m6(t,e){const i=new Uint8Array(4*t*t);for(let r=0;rs.camera.perRenderPixelRatio)),i.code.add(V`bool areWorldMarkersHidden(vec4 pos, vec4 other) { +}`),e.space===Sp.World&&(i.constants.add("maxSegmentLengthFraction","float",.45),i.uniforms.add(new ft("perRenderPixelRatio",(n,s)=>s.camera.perRenderPixelRatio)),i.code.add(V`bool areWorldMarkersHidden(vec4 pos, vec4 other) { vec3 midPoint = mix(pos.xyz, other.xyz, 0.5); float distanceToCamera = length(midPoint); float screenToWorldRatio = perRenderPixelRatio * distanceToCamera * 0.5; @@ -2858,7 +2847,7 @@ float getWorldMarkerSize(vec4 pos) { float distanceToCamera = length(pos.xyz); float screenToWorldRatio = perRenderPixelRatio * distanceToCamera * 0.5; return getScreenMarkerSize() * screenToWorldRatio; -}`))}var Df;(function(t){t[t.BUTT=0]="BUTT",t[t.SQUARE=1]="SQUARE",t[t.ROUND=2]="ROUND",t[t.COUNT=3]="COUNT"})(Df||(Df={}));let Ns=class extends hu{constructor(){super(...arguments),this.output=ue.Color,this.capType=Df.BUTT,this.transparencyPassType=Jt.NONE,this.occluder=!1,this.hasSlicePlane=!1,this.hasPolygonOffset=!1,this.writeDepth=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.vvSize=!1,this.vvColor=!1,this.vvOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.wireframe=!1,this.objectAndLayerIdColorInstanced=!1}};y([fe({count:ue.COUNT})],Ns.prototype,"output",void 0),y([fe({count:Df.COUNT})],Ns.prototype,"capType",void 0),y([fe({count:Jt.COUNT})],Ns.prototype,"transparencyPassType",void 0),y([fe()],Ns.prototype,"occluder",void 0),y([fe()],Ns.prototype,"hasSlicePlane",void 0),y([fe()],Ns.prototype,"hasPolygonOffset",void 0),y([fe()],Ns.prototype,"writeDepth",void 0),y([fe()],Ns.prototype,"draped",void 0),y([fe()],Ns.prototype,"stippleEnabled",void 0),y([fe()],Ns.prototype,"stippleOffColorEnabled",void 0),y([fe()],Ns.prototype,"stipplePreferContinuous",void 0),y([fe()],Ns.prototype,"roundJoins",void 0),y([fe()],Ns.prototype,"applyMarkerOffset",void 0),y([fe()],Ns.prototype,"vvSize",void 0),y([fe()],Ns.prototype,"vvColor",void 0),y([fe()],Ns.prototype,"vvOpacity",void 0),y([fe()],Ns.prototype,"falloffEnabled",void 0),y([fe()],Ns.prototype,"innerColorEnabled",void 0),y([fe()],Ns.prototype,"hasOccludees",void 0),y([fe()],Ns.prototype,"multipassEnabled",void 0),y([fe()],Ns.prototype,"cullAboveGround",void 0),y([fe()],Ns.prototype,"wireframe",void 0),y([fe()],Ns.prototype,"objectAndLayerIdColorInstanced",void 0),y([fe({constValue:!1})],Ns.prototype,"occlusionPass",void 0),y([fe({constValue:!0})],Ns.prototype,"hasVvInstancing",void 0),y([fe({constValue:!0})],Ns.prototype,"hasSliceTranslatedView",void 0);const jL=1;function ONe(t){const e=new Cr,{vertex:i,fragment:r}=e,n=t.multipassEnabled&&(t.output===ue.Color||t.output===ue.Alpha);e.include(q9),e.include(hNe,t),e.include(XTt,t);const s=t.applyMarkerOffset&&!t.draped;s&&(i.uniforms.add(new ft("markerScale",A=>A.markerScale)),e.include(MNe,{space:_p.World,draped:!1})),t.output===ue.Depth&&e.include(E_,t),e.include(e6,t),Kh(i,t),i.uniforms.add(new _s("inverseProjectionMatrix",(A,M)=>M.camera.inverseProjectionMatrix),new ln("nearFar",(A,M)=>M.camera.nearFar),new ft("miterLimit",A=>A.join!=="miter"?0:A.miterLimit),new gr("viewport",(A,M)=>M.camera.fullViewport)),i.constants.add("LARGE_HALF_FLOAT","float",65500),e.attributes.add(J.POSITION,"vec3"),e.attributes.add(J.SUBDIVISIONFACTOR,"float"),e.attributes.add(J.UV0,"vec2"),e.attributes.add(J.AUXPOS1,"vec3"),e.attributes.add(J.AUXPOS2,"vec3"),e.varyings.add("vColor","vec4"),e.varyings.add("vpos","vec3"),B2(e),n&&e.varyings.add("depth","float");const o=t.stippleEnabled;o&&e.varyings.add("vLineSizeInv","float");const l=t.capType===Df.ROUND,c=o||l;c&&e.varyings.add("vLineWidth","float");const f=t.innerColorEnabled||l;f&&e.varyings.add("vLineDistance","float");const _=t.stippleEnabled&&l,x=t.falloffEnabled||_;x&&e.varyings.add("vLineDistanceNorm","float"),l&&(e.varyings.add("vSegmentSDF","float"),e.varyings.add("vReverseSegmentSDF","float")),i.code.add(V`#define PERPENDICULAR(v) vec2(v.y, -v.x); +}`))}var Uf;(function(t){t[t.BUTT=0]="BUTT",t[t.SQUARE=1]="SQUARE",t[t.ROUND=2]="ROUND",t[t.COUNT=3]="COUNT"})(Uf||(Uf={}));let Fs=class extends pu{constructor(){super(...arguments),this.output=ue.Color,this.capType=Uf.BUTT,this.transparencyPassType=Jt.NONE,this.occluder=!1,this.hasSlicePlane=!1,this.hasPolygonOffset=!1,this.writeDepth=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.vvSize=!1,this.vvColor=!1,this.vvOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.wireframe=!1,this.objectAndLayerIdColorInstanced=!1}};y([fe({count:ue.COUNT})],Fs.prototype,"output",void 0),y([fe({count:Uf.COUNT})],Fs.prototype,"capType",void 0),y([fe({count:Jt.COUNT})],Fs.prototype,"transparencyPassType",void 0),y([fe()],Fs.prototype,"occluder",void 0),y([fe()],Fs.prototype,"hasSlicePlane",void 0),y([fe()],Fs.prototype,"hasPolygonOffset",void 0),y([fe()],Fs.prototype,"writeDepth",void 0),y([fe()],Fs.prototype,"draped",void 0),y([fe()],Fs.prototype,"stippleEnabled",void 0),y([fe()],Fs.prototype,"stippleOffColorEnabled",void 0),y([fe()],Fs.prototype,"stipplePreferContinuous",void 0),y([fe()],Fs.prototype,"roundJoins",void 0),y([fe()],Fs.prototype,"applyMarkerOffset",void 0),y([fe()],Fs.prototype,"vvSize",void 0),y([fe()],Fs.prototype,"vvColor",void 0),y([fe()],Fs.prototype,"vvOpacity",void 0),y([fe()],Fs.prototype,"falloffEnabled",void 0),y([fe()],Fs.prototype,"innerColorEnabled",void 0),y([fe()],Fs.prototype,"hasOccludees",void 0),y([fe()],Fs.prototype,"multipassEnabled",void 0),y([fe()],Fs.prototype,"cullAboveGround",void 0),y([fe()],Fs.prototype,"wireframe",void 0),y([fe()],Fs.prototype,"objectAndLayerIdColorInstanced",void 0),y([fe({constValue:!1})],Fs.prototype,"occlusionPass",void 0),y([fe({constValue:!0})],Fs.prototype,"hasVvInstancing",void 0),y([fe({constValue:!0})],Fs.prototype,"hasSliceTranslatedView",void 0);const KL=1;function CNe(t){const e=new Ar,{vertex:i,fragment:r}=e,n=t.multipassEnabled&&(t.output===ue.Color||t.output===ue.Alpha);e.include(J9),e.include(lNe,t),e.include(YSt,t);const s=t.applyMarkerOffset&&!t.draped;s&&(i.uniforms.add(new ft("markerScale",C=>C.markerScale)),e.include(ENe,{space:Sp.World,draped:!1})),t.output===ue.Depth&&e.include(I_,t),e.include(s6,t),td(i,t),i.uniforms.add(new bs("inverseProjectionMatrix",(C,M)=>M.camera.inverseProjectionMatrix),new cn("nearFar",(C,M)=>M.camera.nearFar),new ft("miterLimit",C=>C.join!=="miter"?0:C.miterLimit),new gr("viewport",(C,M)=>M.camera.fullViewport)),i.constants.add("LARGE_HALF_FLOAT","float",65500),e.attributes.add(J.POSITION,"vec3"),e.attributes.add(J.SUBDIVISIONFACTOR,"float"),e.attributes.add(J.UV0,"vec2"),e.attributes.add(J.AUXPOS1,"vec3"),e.attributes.add(J.AUXPOS2,"vec3"),e.varyings.add("vColor","vec4"),e.varyings.add("vpos","vec3"),W2(e),n&&e.varyings.add("depth","float");const o=t.stippleEnabled;o&&e.varyings.add("vLineSizeInv","float");const a=t.capType===Uf.ROUND,c=o||a;c&&e.varyings.add("vLineWidth","float");const p=t.innerColorEnabled||a;p&&e.varyings.add("vLineDistance","float");const _=t.stippleEnabled&&a,x=t.falloffEnabled||_;x&&e.varyings.add("vLineDistanceNorm","float"),a&&(e.varyings.add("vSegmentSDF","float"),e.varyings.add("vReverseSegmentSDF","float")),i.code.add(V`#define PERPENDICULAR(v) vec2(v.y, -v.x); float interp(float ncp, vec4 a, vec4 b) { return (-ncp - a.z) / (b.z - a.z); } @@ -2871,7 +2860,7 @@ return m * v; vec4 posNdc = proj * pos; posNdc.xy *= viewport.zw / posNdc.w; return posNdc; -}`),Rj(e),i.code.add(V` +}`),Vj(e),i.code.add(V` void clipAndTransform(inout vec4 pos, inout vec4 prev, inout vec4 next, in bool isStartVertex) { float vnp = nearFar[0] * 0.99; @@ -2913,7 +2902,7 @@ return posNdc; next = projectAndScale(next); prev = projectAndScale(prev); } - `),bP(i),i.code.add(V` + `),P5(i),i.code.add(V` void main(void) { // unpack values from uv0.y bool isStartVertex = abs(abs(uv0.y)-3.0) == 1.0; @@ -2958,11 +2947,11 @@ pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos) * 0.5; vec2 left = (pos.xy - prev.xy); vec2 right = (next.xy - pos.xy); float leftLen = length(left); -float rightLen = length(right);`),(t.stippleEnabled||l)&&i.code.add(V` +float rightLen = length(right);`),(t.stippleEnabled||a)&&i.code.add(V` float isEndVertex = float(!isStartVertex); vec2 segmentOrigin = mix(pos.xy, prev.xy, isEndVertex); vec2 segment = mix(right, left, isEndVertex); - ${l?V`vec2 segmentEnd = mix(next.xy, pos.xy, isEndVertex);`:""} + ${a?V`vec2 segmentEnd = mix(next.xy, pos.xy, isEndVertex);`:""} `),i.code.add(V`left = (leftLen > 0.001) ? left/leftLen : vec2(0.0, 0.0); right = (rightLen > 0.001) ? right/rightLen : vec2(0.0, 0.0); vec2 capDisplacementDir = vec2(0, 0); @@ -2986,7 +2975,7 @@ if (isOutside && (displacementLen > miterLimit * lineWidth)) {`),t.roundJoins?i. vec2 endDir = rightLen < 0.001 ? left : right; endDir = PERPENDICULAR(endDir); - float factor = ${t.stippleEnabled?V`min(1.0, subdivisionFactor * ${V.float((jL+2)/(jL+1))})`:V`subdivisionFactor`}; + float factor = ${t.stippleEnabled?V`min(1.0, subdivisionFactor * ${V.float((KL+2)/(KL+1))})`:V`subdivisionFactor`}; float rotationAngle = acos(clamp(dot(startDir, endDir), -1.0, 1.0)); joinDisplacementDir = rotate(startDir, -sign(uv0.y) * factor * rotationAngle); @@ -2999,7 +2988,7 @@ joinDisplacementDir = left; else { joinDisplacementDir = (isStartVertex || subdivisionFactor > 0.0) ? right : left; } -joinDisplacementDir = PERPENDICULAR(joinDisplacementDir);`);const T=t.capType!==Df.BUTT;return i.code.add(V` +joinDisplacementDir = PERPENDICULAR(joinDisplacementDir);`);const S=t.capType!==Uf.BUTT;return i.code.add(V` displacementLen = lineWidth; } } else { @@ -3007,28 +2996,28 @@ joinDisplacementDir = PERPENDICULAR(joinDisplacementDir);`);const T=t.capType!== joinDisplacementDir = isStartVertex ? right : left; joinDisplacementDir = PERPENDICULAR(joinDisplacementDir); - ${T?V`capDisplacementDir = isStartVertex ? -right : left;`:""} + ${S?V`capDisplacementDir = isStartVertex ? -right : left;`:""} } `),i.code.add(V` // Displacement (in pixels) caused by join/or cap vec2 dpos = joinDisplacementDir * sign(uv0.y) * displacementLen + capDisplacementDir * displacementLen; - ${x||f?V`float lineDistNorm = sign(uv0.y) * pos.w;`:""} + ${x||p?V`float lineDistNorm = sign(uv0.y) * pos.w;`:""} - ${f?V`vLineDistance = lineWidth * lineDistNorm;`:""} + ${p?V`vLineDistance = lineWidth * lineDistNorm;`:""} ${x?V`vLineDistanceNorm = lineDistNorm;`:""} pos.xy += dpos; - `),l&&i.code.add(V`vec2 segmentDir = normalize(segment); + `),a&&i.code.add(V`vec2 segmentDir = normalize(segment); vSegmentSDF = (isJoin && isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentOrigin, segmentDir) * pos.w) ; -vReverseSegmentSDF = (isJoin && !isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentEnd, -segmentDir) * pos.w);`),t.stippleEnabled&&(t.draped?i.uniforms.add(new ft("worldToScreenRatio",(A,M)=>1/M.screenToPCSRatio)):i.code.add(V`vec3 segmentCenter = mix((auxpos2 + position) * 0.5, (position + auxpos1) * 0.5, isEndVertex); +vReverseSegmentSDF = (isJoin && !isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentEnd, -segmentDir) * pos.w);`),t.stippleEnabled&&(t.draped?i.uniforms.add(new ft("worldToScreenRatio",(C,M)=>1/M.screenToPCSRatio)):i.code.add(V`vec3 segmentCenter = mix((auxpos2 + position) * 0.5, (position + auxpos1) * 0.5, isEndVertex); float worldToScreenRatio = computeWorldToScreenRatio(segmentCenter);`),i.code.add(V`float segmentLengthScreenDouble = length(segment); float segmentLengthScreen = segmentLengthScreenDouble * 0.5; float discreteWorldToScreenRatio = discretizeWorldToScreenRatio(worldToScreenRatio); float segmentLengthRender = length(mix(auxpos2 - position, position - auxpos1, isEndVertex)); vStipplePatternStretch = worldToScreenRatio / discreteWorldToScreenRatio;`),t.draped?i.code.add(V`float segmentLengthPseudoScreen = segmentLengthScreen / pixelRatio * discreteWorldToScreenRatio / worldToScreenRatio; float startPseudoScreen = uv0.x * discreteWorldToScreenRatio - mix(0.0, segmentLengthPseudoScreen, isEndVertex);`):i.code.add(V`float startPseudoScreen = mix(uv0.x, uv0.x - segmentLengthRender, isEndVertex) * discreteWorldToScreenRatio; -float segmentLengthPseudoScreen = segmentLengthRender * discreteWorldToScreenRatio;`),i.uniforms.add(new ft("stipplePatternPixelSize",A=>mNe(A))),i.code.add(V`float patternLength = lineSize * stipplePatternPixelSize; +float segmentLengthPseudoScreen = segmentLengthRender * discreteWorldToScreenRatio;`),i.uniforms.add(new ft("stipplePatternPixelSize",C=>dNe(C))),i.code.add(V`float patternLength = lineSize * stipplePatternPixelSize; vStippleDistanceLimits = computeStippleDistanceLimits(startPseudoScreen, segmentLengthPseudoScreen, segmentLengthScreen, patternLength); vStippleDistance = mix(vStippleDistanceLimits.x, vStippleDistanceLimits.y, isEndVertex); if (segmentLengthScreenDouble >= 0.001) { @@ -3057,11 +3046,11 @@ vec2(vStippleDistanceLimits.x, 1e34);`)),i.code.add(V` forwardObjectAndLayerIdColor(); } } - `),n&&e.include(dd,t),e.include(oo,t),r.include(h1),r.code.add(V` + `),n&&e.include(gd,t),e.include(ao,t),r.include(_1),r.code.add(V` void main() { discardBySlice(vpos); ${n?"terrainDepthTest(depth);":""} - `),t.wireframe?r.code.add(V`vec4 finalColor = vec4(1.0, 0.0, 1.0, 1.0);`):(l&&r.code.add(V` + `),t.wireframe?r.code.add(V`vec4 finalColor = vec4(1.0, 0.0, 1.0, 1.0);`):(a&&r.code.add(V` float sdf = min(vSegmentSDF, vReverseSegmentSDF); vec2 fragmentPosition = vec2( min(sdf, 0.0), @@ -3072,7 +3061,7 @@ vec2(vStippleDistanceLimits.x, 1e34);`)),i.code.add(V` float fragmentCapSDF = (fragmentRadius - vLineWidth) * 0.5; // Divide by 2 to transform from double pixel scale float capCoverage = clamp(0.5 - fragmentCapSDF, 0.0, 1.0); - if (capCoverage < ${V.float(Cl)}) { + if (capCoverage < ${V.float(Ml)}) { discard; } `),_?r.code.add(V` @@ -3083,14 +3072,14 @@ vec2(vStippleDistanceLimits.x, 1e34);`)),i.code.add(V` float stippleRadius = length(stipplePosition * vLineWidth); float stippleCapSDF = (stippleRadius - vLineWidth) * 0.5; // Divide by 2 to transform from double pixel scale float stippleCoverage = clamp(0.5 - stippleCapSDF, 0.0, 1.0); - float stippleAlpha = step(${V.float(Cl)}, stippleCoverage); - `):r.code.add(V`float stippleAlpha = getStippleAlpha();`),t.output!==ue.ObjectAndLayerIdColor&&r.code.add(V`discardByStippleAlpha(stippleAlpha, stippleAlphaColorDiscard);`),r.uniforms.add(new gr("intrinsicColor",A=>A.color)),r.code.add(V`vec4 color = intrinsicColor * vColor;`),t.innerColorEnabled&&(r.uniforms.add(new gr("innerColor",A=>A.innerColor??A.color),new ft("innerWidth",(A,M)=>A.innerWidth*M.camera.pixelRatio)),r.code.add(V`float distToInner = abs(vLineDistance * gl_FragCoord.w) - innerWidth; + float stippleAlpha = step(${V.float(Ml)}, stippleCoverage); + `):r.code.add(V`float stippleAlpha = getStippleAlpha();`),t.output!==ue.ObjectAndLayerIdColor&&r.code.add(V`discardByStippleAlpha(stippleAlpha, stippleAlphaColorDiscard);`),r.uniforms.add(new gr("intrinsicColor",C=>C.color)),r.code.add(V`vec4 color = intrinsicColor * vColor;`),t.innerColorEnabled&&(r.uniforms.add(new gr("innerColor",C=>C.innerColor??C.color),new ft("innerWidth",(C,M)=>C.innerWidth*M.camera.pixelRatio)),r.code.add(V`float distToInner = abs(vLineDistance * gl_FragCoord.w) - innerWidth; float innerAA = clamp(0.5 - distToInner, 0.0, 1.0); float innerAlpha = innerColor.a + color.a * (1.0 - innerColor.a); -color = mix(color, vec4(innerColor.rgb, innerAlpha), innerAA);`)),r.code.add(V`vec4 finalColor = blendStipple(color, stippleAlpha);`),t.falloffEnabled&&(r.uniforms.add(new ft("falloff",A=>A.falloff)),r.code.add(V`finalColor.a *= pow(max(0.0, 1.0 - abs(vLineDistanceNorm * gl_FragCoord.w)), falloff);`))),r.code.add(V` +color = mix(color, vec4(innerColor.rgb, innerAlpha), innerAA);`)),r.code.add(V`vec4 finalColor = blendStipple(color, stippleAlpha);`),t.falloffEnabled&&(r.uniforms.add(new ft("falloff",C=>C.falloff)),r.code.add(V`finalColor.a *= pow(max(0.0, 1.0 - abs(vLineDistanceNorm * gl_FragCoord.w)), falloff);`))),r.code.add(V` ${t.output===ue.ObjectAndLayerIdColor?V`finalColor.a = 1.0;`:""} - if (finalColor.a < ${V.float(Cl)}) { + if (finalColor.a < ${V.float(Ml)}) { discard; } @@ -3101,7 +3090,7 @@ color = mix(color, vec4(innerColor.rgb, innerAlpha), innerAA);`)),r.code.add(V`v ${t.output===ue.Depth?V`outputDepth(linearDepth);`:""} ${t.output===ue.ObjectAndLayerIdColor?V`outputObjectAndLayerIdColor();`:""} } - `),e}const FEt=Object.freeze(Object.defineProperty({__proto__:null,build:ONe,ribbonlineNumRoundJoinSubdivisions:jL},Symbol.toStringTag,{value:"Module"})),PNe=new Map([[J.POSITION,0],[J.SUBDIVISIONFACTOR,1],[J.UV0,2],[J.AUXPOS1,3],[J.AUXPOS2,4],[J.COLOR,5],[J.COLORFEATUREATTRIBUTE,5],[J.SIZE,6],[J.SIZEFEATUREATTRIBUTE,6],[J.OPACITYFEATUREATTRIBUTE,7],[J.OBJECTANDLAYERIDCOLOR,8]]);let RNe=class INe extends Hr{initializeProgram(e){return new Ir(e.rctx,INe.shader.get().build(this.configuration),PNe)}_makePipelineState(e,i){const r=this.configuration,n=e===Jt.NONE,s=e===Jt.FrontFace;return Ti({blending:r.output===ue.Color||r.output===ue.Alpha?n?vp:Y_(e):null,depthTest:{func:px(e)},depthWrite:n?r.writeDepth?rh:null:Kj(e),colorWrite:ji,stencilWrite:r.hasOccludees?Jy:null,stencilTest:r.hasOccludees?i?Z2:fx:null,polygonOffset:n||s?r.hasPolygonOffset?l1e:null:eG})}initializePipeline(){const e=this.configuration;if(e.occluder){const i=e.hasPolygonOffset?l1e:null;this._occluderPipelineTransparent=Ti({blending:vp,polygonOffset:i,depthTest:BU,depthWrite:null,colorWrite:ji,stencilWrite:null,stencilTest:Y6e}),this._occluderPipelineOpaque=Ti({blending:vp,polygonOffset:i,depthTest:BU,depthWrite:null,colorWrite:ji,stencilWrite:q6e,stencilTest:W6e}),this._occluderPipelineMaskWrite=Ti({blending:null,polygonOffset:i,depthTest:Cle,depthWrite:null,colorWrite:null,stencilWrite:Jy,stencilTest:Z2})}return this._occludeePipelineState=this._makePipelineState(this.configuration.transparencyPassType,!0),this._makePipelineState(this.configuration.transparencyPassType,!1)}get primitiveType(){return this.configuration.wireframe?sr.LINES:sr.TRIANGLE_STRIP}getPipeline(e,i,r){return e?this._occludeePipelineState:this.configuration.occluder?r?this._occluderPipelineTransparent:i?this._occluderPipelineOpaque:this._occluderPipelineMaskWrite:super.getPipeline()}};RNe.shader=new Rr(FEt,()=>we(()=>Promise.resolve().then(()=>AWt),void 0));const l1e={factor:0,units:-4};var Ah;(function(t){t[t.LEFT_JOIN_START=-2]="LEFT_JOIN_START",t[t.LEFT_JOIN_END=-1]="LEFT_JOIN_END",t[t.LEFT_CAP_START=-4]="LEFT_CAP_START",t[t.LEFT_CAP_END=-5]="LEFT_CAP_END",t[t.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",t[t.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",t[t.RIGHT_CAP_START=4]="RIGHT_CAP_START",t[t.RIGHT_CAP_END=5]="RIGHT_CAP_END"})(Ah||(Ah={}));let zM=class extends hx{constructor(e){super(e,new zEt),this._configuration=new Ns,this._vertexAttributeLocations=PNe}getConfiguration(e,i){this._configuration.output=e,this._configuration.draped=i.slot===ke.DRAPED_MATERIAL;const r=this.parameters.stipplePattern!=null&&e!==ue.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins=this.parameters.join==="round",this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&VEt(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===Wn.OccludeAndTransparentStencil,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration.cullAboveGround=i.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,i,r,n,s,o){if(!r.options.selectionMode)return;const l=e.attributes.get(J.POSITION).data,c=e.attributes.get(J.SIZE);let f=this.parameters.width;if(this.parameters.vvSize){const I=e.attributes.get(J.SIZEFEATUREATTRIBUTE).data[0];f*=Je(this.parameters.vvSize.offset[0]+I*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else c&&(f*=c.data[0]);const _=n[0],x=n[1],T=(f/2+4)*e.screenToWorldRatio;let A=Number.MAX_VALUE,M=0;for(let I=0;I0){je(ng,yu,vu);const j=_.frustum,H=-fn(j[Rn.NEAR],yu)/Ve(ng,j[Rn.NEAR]);De(ng,ng,H),Be(yu,yu,ng),_.projectToRenderScreen(yu,Dx)}else if(Dx[2]>0&&Nx[2]<0){je(ng,vu,yu);const j=_.frustum,H=-fn(j[Rn.NEAR],vu)/Ve(ng,j[Rn.NEAR]);De(ng,ng,H),Be(vu,vu,ng),_.projectToRenderScreen(vu,Nx)}else if(Dx[2]<0&&Nx[2]<0)continue;Dx[2]=0,Nx[2]=0;const U=Yoe(gT(Dx,Nx,h1e),x);Uhe=T[Se]:(de,ve,Se)=>he+=Sn(de,ve),be=Le("enable-feature:objectAndLayerId-rendering"),ye=(de,ve,Se,Ae,Pe,Ge,ut)=>{if(H[ne++]=ve[0],H[ne++]=ve[1],H[ne++]=ve[2],H[ne++]=Ae,H[ne++]=ut,H[ne++]=Pe,H[ne++]=de[0],H[ne++]=de[1],H[ne++]=de[2],H[ne++]=Se[0],H[ne++]=Se[1],H[ne++]=Se[2],H[ne++]=I?M:A,z)H[ne++]=F;else{const Ft=Math.min(4*Ge,L.length-4);H[ne++]=L[Ft],H[ne++]=L[Ft+1],H[ne++]=L[Ft+2],H[ne++]=L[Ft+3]}j&&(H[ne++]=U),be&&(k!=null&&(Y[4*ne]=k[0],Y[4*ne+1]=k[1],Y[4*ne+2]=k[2],Y[4*ne+3]=k[3]),ne++)};ne+=Q,Ie(l,f.data[0],f.data[1],f.data[2]),e&&bt(l,l,e);const pe=this._isClosed(r);if(pe){const de=f.data.length-3;Ie(o,f.data[de],f.data[de+1],f.data[de+2]),e&&bt(o,o,e)}else Ie(c,f.data[3],f.data[4],f.data[5]),e&&bt(c,c,e),ye(l,l,c,1,Ah.LEFT_CAP_START,0,0),ye(l,l,c,1,Ah.RIGHT_CAP_START,0,0),Ne(o,l),Ne(l,c);const Ee=pe?0:1,te=pe?x:x-1;for(let de=Ee;del=TW(o,f,s,l,n);for(let f=0;f2:!1}function VEt(t){return t.anchor===eE.Tip&&t.hideOnShortSegments&&t.placement==="begin-end"&&t.worldSpace}const yu=W(),vu=W(),ng=W(),Lx=W(),BEt=W(),Dx=Za(),Nx=Za(),c1e=W(),u1e=W(),h1e=jm(),jEt=jm(),GEt=W(),HEt=W(),qEt=W(),gR=[Za(),Za(),Za(),Za()],T1=[W(),W(),W(),W()],EW=Fi(),CW=Fi(),AW=Fi(),MW=Fi();let Yle=class{constructor(e){this._originSR=e,this._rootOriginId="root/"+hp(),this._origins=new Map,this._objects=new Map,this._gridSize=5e5}getOrigin(e){const i=this._origins.get(this._rootOriginId);if(i==null){const _=HU(e[0]+Math.random()-.5,e[1]+Math.random()-.5,e[2]+Math.random()-.5,this._rootOriginId);return this._origins.set(this._rootOriginId,_),_}const r=this._gridSize,n=Math.round(e[0]/r),s=Math.round(e[1]/r),o=Math.round(e[2]/r),l=`${n}/${s}/${o}`;let c=this._origins.get(l);const f=.5*r;if(je(al,e,i.vec3),al[0]=Math.abs(al[0]),al[1]=Math.abs(al[1]),al[2]=Math.abs(al[2]),al[0]0&&_.push(A-1,A);vn(f,this._originSR,0,f,r.renderSpatialReference,0,c);const T=new Bo(this._material,[[J.POSITION,new It(f,_,3,!0)]],null,Ws.Line);n.add(T),o.addGeometry(T)}get test(){const e=this;return{set gridSize(i){e._gridSize=i}}}};const al=W();let LNe=class{constructor(e,i,r=null){this.rctx=e,this.sliceHelper=r,this.lastFrameCamera=new ai,this.output=ue.Color,this.renderOccludedMask=d1e,this.bindParameters=new Pj(i,r!=null?r.plane:null),this.bindParameters.alignPixelEnabled=!0}resetRenderOccludedMask(){this.renderOccludedMask=d1e}},WEt=class extends LNe{constructor(e,i,r,n){super(e,r,n),this.offscreenRenderingHelper=i,this.sliceHelper=n,this.time=0}};const d1e=Wn.Occlude|Wn.OccludeAndTransparent|Wn.OccludeAndTransparentStencil;let dI=class extends ai{constructor(){super(...arguments),this._projectionMatrix=Qe()}get projectionMatrix(){return this._projectionMatrix}};y([w()],dI.prototype,"_projectionMatrix",void 0),y([w({readOnly:!0})],dI.prototype,"projectionMatrix",null),dI=y([Z("esri.views.3d.webgl-engine.lib.CascadeCamera")],dI);var I5;(function(t){t[t.Highlight=0]="Highlight",t[t.Default=1]="Default"})(I5||(I5={}));let IN=class{constructor(){this.camera=new dI,this.lightMat=Qe()}},YEt=class{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}},Xle=class{get depthTexture(){var e;return(e=this._handle)==null?void 0:e.colorTexture}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return rs(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}constructor(e,i){this._fbos=e,this._viewingMode=i,this._enabled=!1,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new YEt,this._projectionView=Qe(),this._projectionViewInverse=Qe(),this._modelViewLight=Qe(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=Xi(),this._cascades=[new IN,new IN,new IN,new IN],this._lastOrigin=null,this._maxTextureWidth=Math.min(Le("esri-mobile")?4096:16384,e.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}disposeOffscreenBuffers(){this._handle=ir(this._handle),this._discardSnapshots()}set maxCascades(e){this.settings.maxNumCascadesHighQuality=Je(Math.floor(e),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(e){this._enabled=e,e||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&this.depthTexture!=null}get cascades(){for(let e=0;e=r&&(i=2,r=4),{near:i,far:r}}_computeCascadeDistances(e,i,r){const n=r?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(wgt(i/e,4)),n);const s=(i-e)/this._numCascades,o=(i/e)**(1/this._numCascades);let l=e,c=e;for(let f=0;fT&&(T=H)}Qo(r,Sd),Gu(xb,va,x-e),df(r,r,xb);let A=-1,M=1,I=0,L=0;for(let j=0;j<8;++j){Ps(yR,t[j],r),w5(yR,yR);const H=va[0]*yR[1]-va[1]*yR[0];H>0?H>A&&(A=H,I=j):H0,"leftArea"),JE(M<0,"rightArea"),Gu(gC,va,x),df(gC,gC,Sd),Gu(yC,va,T),df(yC,yC,Sd),$N[0]=-va[1],$N[1]=va[0];const F=BD(r,t[L],yC,df(xb,yC,$N),1,n),z=BD(r,t[I],yC,xb,1,s),k=BD(r,t[I],gC,df(xb,gC,$N),1,o),U=BD(r,t[L],gC,xb,1,l);JE(F,"rayRay"),JE(z,"rayRay"),JE(k,"rayRay"),JE(U,"rayRay")}function br(t,e){return 3*e+t}const b1e=yt();function ah(t,e){return or(b1e,t[e],t[e+3]),b1e}const _u=yt(),jt=as();function KEt(t,e,i,r,n){Ps(_u,i,r),Gu(_u,_u,.5),jt[0]=_u[0],jt[1]=_u[1],jt[2]=0,jt[3]=_u[1],jt[4]=-_u[0],jt[5]=0,jt[6]=_u[0]*_u[0]+_u[1]*_u[1],jt[7]=_u[0]*_u[1]-_u[1]*_u[0],jt[8]=1,jt[br(0,2)]=-fs(ah(jt,0),t),jt[br(1,2)]=-fs(ah(jt,1),t);let s=fs(ah(jt,0),i)+jt[br(0,2)],o=fs(ah(jt,1),i)+jt[br(1,2)],l=fs(ah(jt,0),r)+jt[br(0,2)],c=fs(ah(jt,1),r)+jt[br(1,2)];s=-(s+l)/(o+c),jt[br(0,0)]+=jt[br(1,0)]*s,jt[br(0,1)]+=jt[br(1,1)]*s,jt[br(0,2)]+=jt[br(1,2)]*s,s=1/(fs(ah(jt,0),i)+jt[br(0,2)]),o=1/(fs(ah(jt,1),i)+jt[br(1,2)]),jt[br(0,0)]*=s,jt[br(0,1)]*=s,jt[br(0,2)]*=s,jt[br(1,0)]*=o,jt[br(1,1)]*=o,jt[br(1,2)]*=o,jt[br(2,0)]=jt[br(1,0)],jt[br(2,1)]=jt[br(1,1)],jt[br(2,2)]=jt[br(1,2)],jt[br(1,2)]+=1,s=fs(ah(jt,1),e)+jt[br(1,2)],o=fs(ah(jt,2),e)+jt[br(2,2)],l=fs(ah(jt,1),i)+jt[br(1,2)],c=fs(ah(jt,2),i)+jt[br(2,2)],s=-.5*(s/o+l/c),jt[br(1,0)]+=jt[br(2,0)]*s,jt[br(1,1)]+=jt[br(2,1)]*s,jt[br(1,2)]+=jt[br(2,2)]*s,s=fs(ah(jt,1),e)+jt[br(1,2)],o=fs(ah(jt,2),e)+jt[br(2,2)],l=-o/s,jt[br(1,0)]*=l,jt[br(1,1)]*=l,jt[br(1,2)]*=l,n[0]=jt[0],n[1]=jt[1],n[2]=0,n[3]=jt[2],n[4]=jt[3],n[5]=jt[4],n[6]=0,n[7]=jt[5],n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=jt[6],n[13]=jt[7],n[14]=0,n[15]=jt[8]}function QEt(t,e,i,r,n){const s=1/uf[0][3],o=1/uf[4][3];Xt(se||new iCt,deallocator:e=>(e.renderGeometry=null,e)})}clear(){this.adds.clear(),this.removes.clear(),this.updates.clear()}prune(){this.adds.prune(),this.removes.prune(),this.updates.prune()}get empty(){return this.adds.length===0&&this.removes.length===0&&this.updates.length===0}},iCt=class{},rCt=class{constructor(){this.adds=new Array,this.removes=new Array,this.updates=new Array}};var ds,ca;(function(t){t[t.ADD=0]="ADD",t[t.UPDATE=1]="UPDATE",t[t.REMOVE=2]="REMOVE"})(ds||(ds={})),function(t){t[t.NONE=0]="NONE",t[t.VISIBILITY=1]="VISIBILITY",t[t.GEOMETRY=2]="GEOMETRY",t[t.TRANSFORMATION=4]="TRANSFORMATION",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.OCCLUDEE=16]="OCCLUDEE"}(ca||(ca={}));function NNe(t){const e=new Map,i=r=>{let n=e.get(r);return n||(n=new rCt,e.set(r,n)),n};return t.removes.forAll(r=>{IW(r)&&i(r.material).removes.push(r)}),t.adds.forAll(r=>{IW(r)&&i(r.material).adds.push(r)}),t.updates.forAll(r=>{IW(r.renderGeometry)&&i(r.renderGeometry.material).updates.push(r)}),e}function IW(t){return t.geometry.indexCount>=1}let FNe=class{constructor(e,i){this._material=e,this._repository=i,this._map=new Map}dispose(){this._map.forEach((e,i)=>{e!=null&&this._repository.release(this._material,i)})}load(e,i,r){if(!this._material.produces(i,r))return null;this._map.has(r)||this._map.set(r,this._repository.acquire(this._material,i,r));const n=this._map.get(r);if(n!=null){if(n.ensureResources(e)===U2.LOADED)return n;this._repository.requestRender()}return null}},fie=class extends H6e{constructor(e=W()){super(),this.origin=e,this.slicePlaneLocalOrigin=this.origin}};const nCt=ls().vec3f(J.POSITION),sCt=ls().vec3f(J.POSITION).vec2f(J.UV0),oCt=ls().vec3f(J.POSITION).vec4u8(J.COLOR);ls().vec3f(J.POSITION).vec4u8(J.OBJECTANDLAYERIDCOLOR);const aCt=ls().vec3f(J.POSITION).vec2f(J.UV0).vec4u8(J.OBJECTANDLAYERIDCOLOR);ls().vec3f(J.POSITION).vec4u8(J.COLOR).vec4u8(J.OBJECTANDLAYERIDCOLOR);let Zle=class extends hx{intersect(e,i,r,n,s,o){return H9e(e,r,n,s,void 0,o)}};function w1e(t){t.fragment.uniforms.add(new Zt("texWaveNormal",e=>e.waveNormal),new Zt("texWavePerturbation",e=>e.wavePerturbation),new gr("waveParams",e=>rs(lCt,e.waveStrength,e.waveTextureRepeat,e.flowStrength,e.flowOffset)),new ln("waveDirection",e=>or(cCt,e.waveDirection[0]*e.waveVelocity,e.waveDirection[1]*e.waveVelocity))),t.include(TTt),t.fragment.code.add(V`const vec2 FLOW_JUMP = vec2(6.0/25.0, 5.0/24.0); + `),e}const NTt=Object.freeze(Object.defineProperty({__proto__:null,build:CNe,ribbonlineNumRoundJoinSubdivisions:KL},Symbol.toStringTag,{value:"Module"})),ANe=new Map([[J.POSITION,0],[J.SUBDIVISIONFACTOR,1],[J.UV0,2],[J.AUXPOS1,3],[J.AUXPOS2,4],[J.COLOR,5],[J.COLORFEATUREATTRIBUTE,5],[J.SIZE,6],[J.SIZEFEATUREATTRIBUTE,6],[J.OPACITYFEATUREATTRIBUTE,7],[J.OBJECTANDLAYERIDCOLOR,8]]);let MNe=class ONe extends Hr{initializeProgram(e){return new $r(e.rctx,ONe.shader.get().build(this.configuration),ANe)}_makePipelineState(e,i){const r=this.configuration,n=e===Jt.NONE,s=e===Jt.FrontFace;return Ti({blending:r.output===ue.Color||r.output===ue.Alpha?n?xp:Q_(e):null,depthTest:{func:_x(e)},depthWrite:n?r.writeDepth?sh:null:lG(e),colorWrite:ji,stencilWrite:r.hasOccludees?n1:null,stencilTest:r.hasOccludees?i?tx:bx:null,polygonOffset:n||s?r.hasPolygonOffset?c1e:null:uG})}initializePipeline(){const e=this.configuration;if(e.occluder){const i=e.hasPolygonOffset?c1e:null;this._occluderPipelineTransparent=Ti({blending:xp,polygonOffset:i,depthTest:jU,depthWrite:null,colorWrite:ji,stencilWrite:null,stencilTest:G6e}),this._occluderPipelineOpaque=Ti({blending:xp,polygonOffset:i,depthTest:jU,depthWrite:null,colorWrite:ji,stencilWrite:B6e,stencilTest:j6e}),this._occluderPipelineMaskWrite=Ti({blending:null,polygonOffset:i,depthTest:zle,depthWrite:null,colorWrite:null,stencilWrite:n1,stencilTest:tx})}return this._occludeePipelineState=this._makePipelineState(this.configuration.transparencyPassType,!0),this._makePipelineState(this.configuration.transparencyPassType,!1)}get primitiveType(){return this.configuration.wireframe?sr.LINES:sr.TRIANGLE_STRIP}getPipeline(e,i,r){return e?this._occludeePipelineState:this.configuration.occluder?r?this._occluderPipelineTransparent:i?this._occluderPipelineOpaque:this._occluderPipelineMaskWrite:super.getPipeline()}};MNe.shader=new Ir(NTt,()=>we(()=>Promise.resolve().then(()=>cXt),void 0));const c1e={factor:0,units:-4};var Ph;(function(t){t[t.LEFT_JOIN_START=-2]="LEFT_JOIN_START",t[t.LEFT_JOIN_END=-1]="LEFT_JOIN_END",t[t.LEFT_CAP_START=-4]="LEFT_CAP_START",t[t.LEFT_CAP_END=-5]="LEFT_CAP_END",t[t.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",t[t.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",t[t.RIGHT_CAP_START=4]="RIGHT_CAP_START",t[t.RIGHT_CAP_END=5]="RIGHT_CAP_END"})(Ph||(Ph={}));let WM=class extends yx{constructor(e){super(e,new kTt),this._configuration=new Fs,this._vertexAttributeLocations=ANe}getConfiguration(e,i){this._configuration.output=e,this._configuration.draped=i.slot===ke.DRAPED_MATERIAL;const r=this.parameters.stipplePattern!=null&&e!==ue.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins=this.parameters.join==="round",this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&UTt(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===Yn.OccludeAndTransparentStencil,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration.cullAboveGround=i.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,i,r,n,s,o){if(!r.options.selectionMode)return;const a=e.attributes.get(J.POSITION).data,c=e.attributes.get(J.SIZE);let p=this.parameters.width;if(this.parameters.vvSize){const P=e.attributes.get(J.SIZEFEATUREATTRIBUTE).data[0];p*=Je(this.parameters.vvSize.offset[0]+P*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else c&&(p*=c.data[0]);const _=n[0],x=n[1],S=(p/2+4)*e.screenToWorldRatio;let C=Number.MAX_VALUE,M=0;for(let P=0;P0){je(cg,_u,bu);const j=_.frustum,G=-gn(j[In.NEAR],_u)/Ve(cg,j[In.NEAR]);De(cg,cg,G),Be(_u,_u,cg),_.projectToRenderScreen(_u,Vx)}else if(Vx[2]>0&&Bx[2]<0){je(cg,bu,_u);const j=_.frustum,G=-gn(j[In.NEAR],bu)/Ve(cg,j[In.NEAR]);De(cg,cg,G),Be(bu,bu,cg),_.projectToRenderScreen(bu,Bx)}else if(Vx[2]<0&&Bx[2]<0)continue;Vx[2]=0,Bx[2]=0;const U=nae(ST(Vx,Bx,d1e),x);Uhe=S[Se]:(de,be,Se)=>he+=Tn(de,be),ve=$e("enable-feature:objectAndLayerId-rendering"),ge=(de,be,Se,Ae,Re,Ge,ut)=>{if(G[ne++]=be[0],G[ne++]=be[1],G[ne++]=be[2],G[ne++]=Ae,G[ne++]=ut,G[ne++]=Re,G[ne++]=de[0],G[ne++]=de[1],G[ne++]=de[2],G[ne++]=Se[0],G[ne++]=Se[1],G[ne++]=Se[2],G[ne++]=P?M:C,z)G[ne++]=F;else{const Ft=Math.min(4*Ge,$.length-4);G[ne++]=$[Ft],G[ne++]=$[Ft+1],G[ne++]=$[Ft+2],G[ne++]=$[Ft+3]}j&&(G[ne++]=U),ve&&(k!=null&&(Y[4*ne]=k[0],Y[4*ne+1]=k[1],Y[4*ne+2]=k[2],Y[4*ne+3]=k[3]),ne++)};ne+=Q,Ie(a,p.data[0],p.data[1],p.data[2]),e&&bt(a,a,e);const pe=this._isClosed(r);if(pe){const de=p.data.length-3;Ie(o,p.data[de],p.data[de+1],p.data[de+2]),e&&bt(o,o,e)}else Ie(c,p.data[3],p.data[4],p.data[5]),e&&bt(c,c,e),ge(a,a,c,1,Ph.LEFT_CAP_START,0,0),ge(a,a,c,1,Ph.RIGHT_CAP_START,0,0),Ne(o,a),Ne(a,c);const Ee=pe?0:1,te=pe?x:x-1;for(let de=Ee;dea=LW(o,p,s,a,n);for(let p=0;p2:!1}function UTt(t){return t.anchor===nE.Tip&&t.hideOnShortSegments&&t.placement==="begin-end"&&t.worldSpace}const _u=W(),bu=W(),cg=W(),Ux=W(),VTt=W(),Vx=Ka(),Bx=Ka(),u1e=W(),h1e=W(),d1e=Ym(),BTt=Ym(),jTt=W(),GTt=W(),HTt=W(),AR=[Ka(),Ka(),Ka(),Ka()],I1=[W(),W(),W(),W()],DW=Fi(),NW=Fi(),FW=Fi(),kW=Fi();let ace=class{constructor(e){this._originSR=e,this._rootOriginId="root/"+mp(),this._origins=new Map,this._objects=new Map,this._gridSize=5e5}getOrigin(e){const i=this._origins.get(this._rootOriginId);if(i==null){const _=qU(e[0]+Math.random()-.5,e[1]+Math.random()-.5,e[2]+Math.random()-.5,this._rootOriginId);return this._origins.set(this._rootOriginId,_),_}const r=this._gridSize,n=Math.round(e[0]/r),s=Math.round(e[1]/r),o=Math.round(e[2]/r),a=`${n}/${s}/${o}`;let c=this._origins.get(a);const p=.5*r;if(je(cl,e,i.vec3),cl[0]=Math.abs(cl[0]),cl[1]=Math.abs(cl[1]),cl[2]=Math.abs(cl[2]),cl[0]0&&_.push(C-1,C);un(p,this._originSR,0,p,r.renderSpatialReference,0,c);const S=new jo(this._material,[[J.POSITION,new $t(p,_,3,!0)]],null,Ws.Line);n.add(S),o.addGeometry(S)}get test(){const e=this;return{set gridSize(i){e._gridSize=i}}}};const cl=W();let RNe=class{constructor(e,i,r=null){this.rctx=e,this.sliceHelper=r,this.lastFrameCamera=new si,this.output=ue.Color,this.renderOccludedMask=p1e,this.bindParameters=new Uj(i,r!=null?r.plane:null),this.bindParameters.alignPixelEnabled=!0}resetRenderOccludedMask(){this.renderOccludedMask=p1e}},qTt=class extends RNe{constructor(e,i,r,n){super(e,r,n),this.offscreenRenderingHelper=i,this.sliceHelper=n,this.time=0}};const p1e=Yn.Occlude|Yn.OccludeAndTransparent|Yn.OccludeAndTransparentStencil;let S4=class extends si{constructor(){super(...arguments),this._projectionMatrix=Qe()}get projectionMatrix(){return this._projectionMatrix}};y([w()],S4.prototype,"_projectionMatrix",void 0),y([w({readOnly:!0})],S4.prototype,"projectionMatrix",null),S4=y([Z("esri.views.3d.webgl-engine.lib.CascadeCamera")],S4);var VP;(function(t){t[t.Highlight=0]="Highlight",t[t.Default=1]="Default"})(VP||(VP={}));let zN=class{constructor(){this.camera=new S4,this.lightMat=Qe()}},WTt=class{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}},lce=class{get depthTexture(){var e;return(e=this._handle)==null?void 0:e.colorTexture}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return rs(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}constructor(e,i){this._fbos=e,this._viewingMode=i,this._enabled=!1,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new WTt,this._projectionView=Qe(),this._projectionViewInverse=Qe(),this._modelViewLight=Qe(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=Xi(),this._cascades=[new zN,new zN,new zN,new zN],this._lastOrigin=null,this._maxTextureWidth=Math.min($e("esri-mobile")?4096:16384,e.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}disposeOffscreenBuffers(){this._handle=ir(this._handle),this._discardSnapshots()}set maxCascades(e){this.settings.maxNumCascadesHighQuality=Je(Math.floor(e),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(e){this._enabled=e,e||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&this.depthTexture!=null}get cascades(){for(let e=0;e=r&&(i=2,r=4),{near:i,far:r}}_computeCascadeDistances(e,i,r){const n=r?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(bmt(i/e,4)),n);const s=(i-e)/this._numCascades,o=(i/e)**(1/this._numCascades);let a=e,c=e;for(let p=0;pS&&(S=G)}ea(r,Ad),qu(Ab,_a,x-e),yf(r,r,Ab);let C=-1,M=1,P=0,$=0;for(let j=0;j<8;++j){Rs(MR,t[j],r),PP(MR,MR);const G=_a[0]*MR[1]-_a[1]*MR[0];G>0?G>C&&(C=G,P=j):G0,"leftArea"),rC(M<0,"rightArea"),qu(xC,_a,x),yf(xC,xC,Ad),qu(SC,_a,S),yf(SC,SC,Ad),UN[0]=-_a[1],UN[1]=_a[0];const F=XD(r,t[$],SC,yf(Ab,SC,UN),1,n),z=XD(r,t[P],SC,Ab,1,s),k=XD(r,t[P],xC,yf(Ab,xC,UN),1,o),U=XD(r,t[$],xC,Ab,1,a);rC(F,"rayRay"),rC(z,"rayRay"),rC(k,"rayRay"),rC(U,"rayRay")}function br(t,e){return 3*e+t}const w1e=yt();function ch(t,e){return or(w1e,t[e],t[e+3]),w1e}const wu=yt(),jt=as();function JTt(t,e,i,r,n){Rs(wu,i,r),qu(wu,wu,.5),jt[0]=wu[0],jt[1]=wu[1],jt[2]=0,jt[3]=wu[1],jt[4]=-wu[0],jt[5]=0,jt[6]=wu[0]*wu[0]+wu[1]*wu[1],jt[7]=wu[0]*wu[1]-wu[1]*wu[0],jt[8]=1,jt[br(0,2)]=-fs(ch(jt,0),t),jt[br(1,2)]=-fs(ch(jt,1),t);let s=fs(ch(jt,0),i)+jt[br(0,2)],o=fs(ch(jt,1),i)+jt[br(1,2)],a=fs(ch(jt,0),r)+jt[br(0,2)],c=fs(ch(jt,1),r)+jt[br(1,2)];s=-(s+a)/(o+c),jt[br(0,0)]+=jt[br(1,0)]*s,jt[br(0,1)]+=jt[br(1,1)]*s,jt[br(0,2)]+=jt[br(1,2)]*s,s=1/(fs(ch(jt,0),i)+jt[br(0,2)]),o=1/(fs(ch(jt,1),i)+jt[br(1,2)]),jt[br(0,0)]*=s,jt[br(0,1)]*=s,jt[br(0,2)]*=s,jt[br(1,0)]*=o,jt[br(1,1)]*=o,jt[br(1,2)]*=o,jt[br(2,0)]=jt[br(1,0)],jt[br(2,1)]=jt[br(1,1)],jt[br(2,2)]=jt[br(1,2)],jt[br(1,2)]+=1,s=fs(ch(jt,1),e)+jt[br(1,2)],o=fs(ch(jt,2),e)+jt[br(2,2)],a=fs(ch(jt,1),i)+jt[br(1,2)],c=fs(ch(jt,2),i)+jt[br(2,2)],s=-.5*(s/o+a/c),jt[br(1,0)]+=jt[br(2,0)]*s,jt[br(1,1)]+=jt[br(2,1)]*s,jt[br(1,2)]+=jt[br(2,2)]*s,s=fs(ch(jt,1),e)+jt[br(1,2)],o=fs(ch(jt,2),e)+jt[br(2,2)],a=-o/s,jt[br(1,0)]*=a,jt[br(1,1)]*=a,jt[br(1,2)]*=a,n[0]=jt[0],n[1]=jt[1],n[2]=0,n[3]=jt[2],n[4]=jt[3],n[5]=jt[4],n[6]=0,n[7]=jt[5],n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=jt[6],n[13]=jt[7],n[14]=0,n[15]=jt[8]}function KTt(t,e,i,r,n){const s=1/mf[0][3],o=1/mf[4][3];Xt(se||new tEt,deallocator:e=>(e.renderGeometry=null,e)})}clear(){this.adds.clear(),this.removes.clear(),this.updates.clear()}prune(){this.adds.prune(),this.removes.prune(),this.updates.prune()}get empty(){return this.adds.length===0&&this.removes.length===0&&this.updates.length===0}},tEt=class{},iEt=class{constructor(){this.adds=new Array,this.removes=new Array,this.updates=new Array}};var ds,ua;(function(t){t[t.ADD=0]="ADD",t[t.UPDATE=1]="UPDATE",t[t.REMOVE=2]="REMOVE"})(ds||(ds={})),function(t){t[t.NONE=0]="NONE",t[t.VISIBILITY=1]="VISIBILITY",t[t.GEOMETRY=2]="GEOMETRY",t[t.TRANSFORMATION=4]="TRANSFORMATION",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.OCCLUDEE=16]="OCCLUDEE"}(ua||(ua={}));function $Ne(t){const e=new Map,i=r=>{let n=e.get(r);return n||(n=new iEt,e.set(r,n)),n};return t.removes.forAll(r=>{BW(r)&&i(r.material).removes.push(r)}),t.adds.forAll(r=>{BW(r)&&i(r.material).adds.push(r)}),t.updates.forAll(r=>{BW(r.renderGeometry)&&i(r.renderGeometry.material).updates.push(r)}),e}function BW(t){return t.geometry.indexCount>=1}let LNe=class{constructor(e,i){this._material=e,this._repository=i,this._map=new Map}dispose(){this._map.forEach((e,i)=>{e!=null&&this._repository.release(this._material,i)})}load(e,i,r){if(!this._material.produces(i,r))return null;this._map.has(r)||this._map.set(r,this._repository.acquire(this._material,i,r));const n=this._map.get(r);if(n!=null){if(n.ensureResources(e)===H2.LOADED)return n;this._repository.requestRender()}return null}},xie=class extends V6e{constructor(e=W()){super(),this.origin=e,this.slicePlaneLocalOrigin=this.origin}};const rEt=ls().vec3f(J.POSITION),nEt=ls().vec3f(J.POSITION).vec2f(J.UV0),sEt=ls().vec3f(J.POSITION).vec4u8(J.COLOR);ls().vec3f(J.POSITION).vec4u8(J.OBJECTANDLAYERIDCOLOR);const oEt=ls().vec3f(J.POSITION).vec2f(J.UV0).vec4u8(J.OBJECTANDLAYERIDCOLOR);ls().vec3f(J.POSITION).vec4u8(J.COLOR).vec4u8(J.OBJECTANDLAYERIDCOLOR);let cce=class extends yx{intersect(e,i,r,n,s,o){return V9e(e,r,n,s,void 0,o)}};function x1e(t){t.fragment.uniforms.add(new Zt("texWaveNormal",e=>e.waveNormal),new Zt("texWavePerturbation",e=>e.wavePerturbation),new gr("waveParams",e=>rs(aEt,e.waveStrength,e.waveTextureRepeat,e.flowStrength,e.flowOffset)),new cn("waveDirection",e=>or(lEt,e.waveDirection[0]*e.waveVelocity,e.waveDirection[1]*e.waveVelocity))),t.include(SSt),t.fragment.code.add(V`const vec2 FLOW_JUMP = vec2(6.0/25.0, 5.0/24.0); vec2 textureDenormalized2D(sampler2D _tex, vec2 _uv) { return 2.0 * texture(_tex, _uv).rg - 1.0; } @@ -3150,7 +3139,7 @@ float waveTextureRepeat = waveParams[1]; vec3 normal = getWaveLayer(texWaveNormal, texWavePerturbation, _uv * waveTextureRepeat, waveDirection, _time); float foam = normals2FoamIntensity(normal, waveParams[0]); return vec4(normal, foam); -}`)}const lCt=Xi(),cCt=yt();function GL(t,e){e.spherical?t.vertex.code.add(V`vec3 getLocalUp(in vec3 pos, in vec3 origin) { +}`)}const aEt=Xi(),lEt=yt();function QL(t,e){e.spherical?t.vertex.code.add(V`vec3 getLocalUp(in vec3 pos, in vec3 origin) { return normalize(pos + origin); }`):t.vertex.code.add(V`vec3 getLocalUp(in vec3 pos, in vec3 origin) { return vec3(0.0, 0.0, 1.0); @@ -3162,9 +3151,9 @@ return mat3(t, b, n); vec3 t = vec3(1.0, 0.0, 0.0); vec3 b = normalize(cross(n, t)); return mat3(t, b, n); -}`)}function kNe(t){const e=new Cr,{vertex:i,fragment:r}=e;Kh(i,t),e.include(Yu,t),e.attributes.add(J.POSITION,"vec3"),e.attributes.add(J.UV0,"vec2");const n=new gr("waterColor",s=>s.color);if(t.output===ue.Color&&t.isDraped)return e.varyings.add("vpos","vec3"),i.uniforms.add(n),i.code.add(V` +}`)}function DNe(t){const e=new Ar,{vertex:i,fragment:r}=e;td(i,t),e.include(Zu,t),e.attributes.add(J.POSITION,"vec3"),e.attributes.add(J.UV0,"vec2");const n=new gr("waterColor",s=>s.color);if(t.output===ue.Color&&t.isDraped)return e.varyings.add("vpos","vec3"),i.uniforms.add(n),i.code.add(V` void main(void) { - if (waterColor.a < ${V.float(Cl)}) { + if (waterColor.a < ${V.float(Ml)}) { // Discard this vertex gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; @@ -3175,9 +3164,9 @@ return mat3(t, b, n); } `),r.uniforms.add(n),r.code.add(V`void main() { fragColor = waterColor; -}`),e;switch(t.output!==ue.Color&&t.output!==ue.Alpha||(e.include(GL,t),e.include(wP,t),e.varyings.add("vuv","vec2"),e.varyings.add("vpos","vec3"),e.varyings.add("vnormal","vec3"),e.varyings.add("vtbnMatrix","mat3"),t.multipassEnabled&&e.varyings.add("depth","float"),i.uniforms.add(n),i.code.add(V` +}`),e;switch(t.output!==ue.Color&&t.output!==ue.Alpha||(e.include(QL,t),e.include(R5,t),e.varyings.add("vuv","vec2"),e.varyings.add("vpos","vec3"),e.varyings.add("vnormal","vec3"),e.varyings.add("vtbnMatrix","mat3"),t.multipassEnabled&&e.varyings.add("depth","float"),i.uniforms.add(n),i.code.add(V` void main(void) { - if (waterColor.a < ${V.float(Cl)}) { + if (waterColor.a < ${V.float(Ml)}) { // Discard this vertex gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; @@ -3194,14 +3183,14 @@ fragColor = waterColor; gl_Position = transformPosition(proj, view, vpos); ${t.output===ue.Color?"forwardLinearDepth();":""} } - `)),e.include(dd,t),t.output){case ue.Alpha:e.include(oo,t),r.uniforms.add(n),r.code.add(V` + `)),e.include(gd,t),t.output){case ue.Alpha:e.include(ao,t),r.uniforms.add(n),r.code.add(V` void main() { discardBySlice(vpos); ${t.multipassEnabled?"terrainDepthTest(depth);":""} fragColor = vec4(waterColor.a); } - `);break;case ue.Color:e.include(yU),e.include(Sae,{pbrMode:ei.Disabled,lightingSphericalHarmonicsOrder:2}),e.include(w1e),e.include(oo,t),e.include(KT,t),e.include(rNe,t),r.uniforms.add(n,new ft("timeElapsed",s=>s.timeElapsed),i.uniforms.get("view"),i.uniforms.get("localOrigin")),Nm(r,t),r.include(h1),B_(r),a1(r),r.code.add(V` + `);break;case ue.Color:e.include(vU),e.include(Nae,{pbrMode:ti.Disabled,lightingSphericalHarmonicsOrder:2}),e.include(x1e),e.include(ao,t),e.include(rE,t),e.include(eNe,t),r.uniforms.add(n,new ft("timeElapsed",s=>s.timeElapsed),i.uniforms.get("view"),i.uniforms.get("localOrigin")),zm(r,t),r.include(_1),W_(r),m1(r),r.code.add(V` void main() { discardBySlice(vpos); ${t.multipassEnabled?"terrainDepthTest(depth);":""} @@ -3221,9 +3210,9 @@ fragColor = waterColor; fragColor = highlightSlice(fragColor, vpos); ${t.transparencyPassType===Jt.Color?"fragColor = premultiplyAlpha(fragColor);":""} } - `);break;case ue.Normal:e.include(GL,t),e.include(w1e,t),e.include(oo,t),e.varyings.add("vpos","vec3"),e.varyings.add("vuv","vec2"),i.uniforms.add(n),i.code.add(V` + `);break;case ue.Normal:e.include(QL,t),e.include(x1e,t),e.include(ao,t),e.varyings.add("vpos","vec3"),e.varyings.add("vuv","vec2"),i.uniforms.add(n),i.code.add(V` void main(void) { - if (waterColor.a < ${V.float(Cl)}) { + if (waterColor.a < ${V.float(Ml)}) { // Discard this vertex gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; @@ -3239,9 +3228,9 @@ discardBySlice(vpos); vec4 tangentNormalFoam = getSurfaceNormalAndFoam(vuv, timeElapsed); tangentNormalFoam.xyz = normalize(tangentNormalFoam.xyz); fragColor = vec4((tangentNormalFoam.xyz + vec3(1.0)) * 0.5, tangentNormalFoam.w); -}`);break;case ue.Highlight:e.include(dx,t),e.varyings.add("vpos","vec3"),i.uniforms.add(n),i.code.add(V` +}`);break;case ue.Highlight:e.include(vx,t),e.varyings.add("vpos","vec3"),i.uniforms.add(n),i.code.add(V` void main(void) { - if (waterColor.a < ${V.float(Cl)}) { + if (waterColor.a < ${V.float(Ml)}) { // Discard this vertex gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; @@ -3250,12 +3239,12 @@ fragColor = vec4((tangentNormalFoam.xyz + vec3(1.0)) * 0.5, tangentNormalFoam.w) vpos = position; gl_Position = transformPosition(proj, view, vpos); } - `),e.include(oo,t),r.code.add(V`void main() { + `),e.include(ao,t),r.code.add(V`void main() { discardBySlice(vpos); outputHighlight(); -}`);break;case ue.ObjectAndLayerIdColor:e.include(e6,t),e.varyings.add("vpos","vec3"),i.uniforms.add(n),i.code.add(V` +}`);break;case ue.ObjectAndLayerIdColor:e.include(s6,t),e.varyings.add("vpos","vec3"),i.uniforms.add(n),i.code.add(V` void main(void) { - if (waterColor.a < ${V.float(Cl)}) { + if (waterColor.a < ${V.float(Ml)}) { // Discard this vertex gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; @@ -3265,14 +3254,14 @@ outputHighlight(); gl_Position = transformPosition(proj, view, vpos); forwardObjectAndLayerIdColor(); } - `),e.include(oo,t),r.code.add(V`void main() { + `),e.include(ao,t),r.code.add(V`void main() { discardBySlice(vpos); outputObjectAndLayerIdColor(); -}`)}return e}const uCt=Object.freeze(Object.defineProperty({__proto__:null,build:kNe},Symbol.toStringTag,{value:"Module"}));let zNe=class UNe extends Hr{initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global,i.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result}initializeProgram(e){return new Ir(e.rctx,UNe.shader.get().build(this.configuration),Er)}_setPipelineState(e){const i=this.configuration,r=e===Jt.NONE,n=e===Jt.FrontFace;return Ti({blending:i.output!==ue.Normal&&i.output!==ue.Highlight&&i.output!==ue.ObjectAndLayerIdColor&&i.transparent?r?vp:Y_(e):null,depthTest:{func:px(e)},depthWrite:r?i.writeDepth?rh:null:Kj(e),colorWrite:ji,polygonOffset:r||n?null:tG(i.enableOffset)})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}};zNe.shader=new Rr(uCt,()=>we(()=>Promise.resolve().then(()=>MWt),void 0));let _a=class extends hu{constructor(){super(...arguments),this.output=ue.Color,this.transparencyPassType=Jt.NONE,this.spherical=!1,this.receiveShadows=!1,this.hasSlicePlane=!1,this.transparent=!1,this.enableOffset=!0,this.writeDepth=!1,this.hasScreenSpaceReflections=!1,this.doublePrecisionRequiresObfuscation=!1,this.hasCloudsReflections=!1,this.objectAndLayerIdColorInstanced=!1,this.isDraped=!1,this.multipassEnabled=!1,this.cullAboveGround=!1}};y([fe({count:ue.COUNT})],_a.prototype,"output",void 0),y([fe({count:Jt.COUNT})],_a.prototype,"transparencyPassType",void 0),y([fe()],_a.prototype,"spherical",void 0),y([fe()],_a.prototype,"receiveShadows",void 0),y([fe()],_a.prototype,"hasSlicePlane",void 0),y([fe()],_a.prototype,"transparent",void 0),y([fe()],_a.prototype,"enableOffset",void 0),y([fe()],_a.prototype,"writeDepth",void 0),y([fe()],_a.prototype,"hasScreenSpaceReflections",void 0),y([fe()],_a.prototype,"doublePrecisionRequiresObfuscation",void 0),y([fe()],_a.prototype,"hasCloudsReflections",void 0),y([fe()],_a.prototype,"objectAndLayerIdColorInstanced",void 0),y([fe()],_a.prototype,"isDraped",void 0),y([fe()],_a.prototype,"multipassEnabled",void 0),y([fe()],_a.prototype,"cullAboveGround",void 0),y([fe({constValue:!1})],_a.prototype,"occlusionPass",void 0),y([fe({constValue:ei.Water})],_a.prototype,"pbrMode",void 0),y([fe({constValue:!0})],_a.prototype,"useCustomDTRExponentForWater",void 0),y([fe({constValue:!0})],_a.prototype,"highStepCount",void 0),y([fe({constValue:!1})],_a.prototype,"useFillLights",void 0);let hCt=class extends cx{_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.receiveShadows&&this._material.setParameters({receiveShadows:e.shadowMap.enabled})}_updateSSRState(e){const i=e.ssr.lastFrameColor!=null;i!==this._material.parameters.hasScreenSpaceReflections&&this._material.setParameters({hasScreenSpaceReflections:i})}_updateCloudsReflectionState(e){const i=e.cloudsFade.data!=null;i!==this._material.parameters.hasCloudsReflections&&this._material.setParameters({hasCloudsReflections:i})}ensureResources(e){return this._techniqueRepository.constructionContext.waterTextureRepository.ensureResources(e)}beginSlot(e){return this._output===ue.Color&&(this._updateShadowState(e),this._updateSSRState(e),this._updateCloudsReflectionState(e)),this._material.setParameters(this._techniqueRepository.constructionContext.waterTextureRepository.passParameters),this.ensureTechnique(zNe,e)}},VNe=class extends Zle{constructor(e){super(e,new BNe),this._configuration=new _a,this._animation=new CLe}getConfiguration(e,i){return this._configuration.output=e,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasScreenSpaceReflections=this.parameters.hasScreenSpaceReflections,this._configuration.hasCloudsReflections=this.parameters.hasCloudsReflections,this._configuration.isDraped=this.parameters.isDraped,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.enableOffset=i.camera.relativeElevatione.set(r.from,r));let i=!0;for(;i;)i=!1,t.forEach(r=>{const n=e.get(r.to);n&&(r.to=n.to,e.delete(n.from),t.removeUnordered(n),i=!0)})}let S1e=class extends Jle{constructor(e,i,r){super(i,r),this.geometry=e}get isVisible(){return this.geometry.visible}get hasHighlights(){return this.geometry.highlights!=null&&this.isVisible}get hasOccludees(){return this.geometry.occludees!=null}},pCt=class{constructor(){this.first=0,this.count=0}},fCt=class{constructor(){this._numElements=0,this._instances=new Map,this.holes=new Pi({allocator:e=>e||new Jle,deallocator:null}),this.hasHiddenInstances=!1,this.hasHighlights=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.drawCommandsDefault=LN(),this.drawCommandsHighlight=LN(),this.drawCommandsOccludees=LN(),this.drawCommandsShadowHighlightRest=LN()}get numElements(){return this._numElements}get instances(){return this._instances}addInstance(e,i){this.deleteInstance(e),this._instances.set(e,i),this._numElements+=i.numElements}deleteInstance(e){const i=this._instances.get(e);i&&(this._numElements-=i.numElements,this._instances.delete(e))}updateInstance(e,i,r){const n=this._instances.get(e);n&&(this._numElements-=n.numElements,n.from=i,n.to=r,this._numElements+=n.numElements)}updateDrawState(e){e.isVisible?(e.hasHighlights&&(this.hasHighlights=!0),e.hasOccludees&&(this.hasOccludees=!0)):this.hasHiddenInstances=!0}updateDrawCommands(e){if(this.drawCommandsDefault.clear(),this.drawCommandsHighlight.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsShadowHighlightRest.clear(),this.drawCommandsDirty=!1,this._instances.size===0)return;if(!this.needsMultipleCommands()){const r=this.drawCommandsDefault.pushNew(),n=this.holes.front();return this.vao!=null&&this.holes.length===1&&n.to===Math.floor(this.vao.byteSize/e)?(r.first=0,void(r.count=n.from)):(r.first=1/0,r.count=0,this._instances.forEach(s=>{r.first=Math.min(r.first,s.from),r.count=Math.max(r.count,s.to)}),void(r.count-=r.first))}const i=Array.from(this._instances.values()).sort((r,n)=>r.from===n.from?r.to-n.to:r.from-n.from);for(const r of i)r.isVisible&&(T1e(r.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,r),T1e(r.hasHighlights?this.drawCommandsHighlight:this.drawCommandsShadowHighlightRest,r))}needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}};function mCt(t){return t.vao!=null}function LN(){return new Pi({allocator:t=>t||new pCt,deallocator:t=>t})}function T1e(t,e){const i=t.back();if(i==null){const r=t.pushNew();return r.first=e.from,void(r.count=e.numElements)}if(gCt(i,e)){const r=e.from-i.first+e.numElements;i.count=r}else{const r=t.pushNew();r.first=e.from,r.count=e.numElements}}function gCt(t,e){return t.first+t.count>=e.from}let yCt=class{constructor(e){this.origin=e,this.buffers=new Array}dispose(){this.buffers.forEach(e=>e.vao.dispose()),this.buffers.length=0}findBuffer(e){return this.buffers.find(i=>i.instances.has(e))}};const vCt=t$+1;let _Ct=class{constructor(e,i,r){this._rctx=e,this._locations=i,this._layout=r,this._cache=new G9(e.newCache,"VAOCache")}dispose(){this._cache.destroy()}newVao(e){const i=e.toString();let r=this._cache.pop(i);return r||(r=new qm(this._rctx,this._locations,{geometry:this._layout},{geometry:Yr.createVertex(this._rctx,Pr.STATIC_DRAW)}),r.vertexBuffers.geometry.setSize(e),r)}deleteVao(e){if(e==null)return;const i=e.byteSize.toString();this._cache.put(i,e,vCt)}},A$=class extends $Le{constructor(e){super(e),this._vaoCache=null,this._glMaterials=null,this._bufferWriter=null,this._dataByOrigin=new Map,this._hasHighlights=!1,this._hasOccludees=!1,this.priority=0,this.produces=new Map}dispose(){this._glMaterials=Kt(this._glMaterials),this._dataByOrigin.forEach(e=>e.dispose()),this._dataByOrigin.clear(),this._vaoCache=Kt(this._vaoCache)}initializeRenderContext(e,i){const{rctx:r}=e.renderContext;this._glMaterials=new FNe(this.material,i??e.materialRepository),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=new _Ct(r,this.material.vertexAttributeLocations,md(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get isEmpty(){return this._dataByOrigin.size===0}get hasHighlights(){return this._hasHighlights}get hasOccludees(){return this._hasOccludees}get hasWater(){return!this.isEmpty&&this.material instanceof VNe}get isDecoration(){return this.material.parameters.isDecoration}get rendersOccluded(){return!this.isEmpty&&this.material.parameters.renderOccluded!==Wn.Occlude}get numGeometries(){let e=0;return this._dataByOrigin.forEach(i=>e+=i.buffers.reduce((r,n)=>r+n.instances.size,0)),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach(i=>e+=i.buffers.reduce((r,n)=>r+n.vao.usedMemory,0)),e}forEachGeometry(e){this._dataByOrigin.forEach(i=>i.buffers.forEach(r=>r.instances.forEach(n=>e(n.geometry))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}_updateGeometries(e){const i=this._bufferWriter;if(i===null)return;const r=i.vertexBufferLayout.stride/4;for(const n of e){const s=n.renderGeometry,o=this._dataByOrigin.get(s.localOrigin.id),l=o==null?void 0:o.findBuffer(s.id);if(l==null)return;const c=l.instances.get(s.id);if(n.updateType&(ca.GEOMETRY|ca.TRANSFORMATION)){const f=FN(i.elementCount(c.geometry.geometry)*r),_=i.vertexBufferLayout.createView(f.buffer);this._writeGeometry(s,_,0),l.vao.vertexBuffers.geometry.setSubData(f,c.from*r,0,c.numElements*r)}n.updateType&(ca.HIGHLIGHT|ca.OCCLUDEE|ca.VISIBILITY)&&(l.drawCommandsDirty=!0)}}_computeDeltas(e,i){const r=new TP;for(const n of e){const s=n.localOrigin;if(s==null)continue;let o=r.get(s.id,null);o==null&&(o=new E1e(s.vec3),r.set(s.id,null,o)),o.changes.push(n)}for(const n of i){const s=n.localOrigin;if(s==null)continue;const o=this._dataByOrigin.get(s.id),l=o==null?void 0:o.findBuffer(n.id);if(l==null)continue;let c=r.get(s.id,l);c==null&&(c=new E1e(s.vec3),r.set(s.id,l,c)),c.changes.push(n)}return r}_addAndRemoveGeometries(e,i){if(this._bufferWriter===null||this._vaoCache===null)return;const{_bufferWriter:r,_dataByOrigin:n}=this,s=r.vertexBufferLayout.stride/4,o=this._computeDeltas(e,i);o.forEach((l,c)=>{const f=l.get(null),_=f!=null?f.changes:[];o.delete(c,null);let x=n.get(c);if(l.forEach((T,A)=>{if(o.delete(c,A),A==null)return void Xt(!1,"No VAO for removed geometries");if(A.instances.size===T.changes.length)return this._vaoCache.deleteVao(A.vao),Q$(x.buffers,A),void(x.buffers.length===0&&_.length===0&&n.delete(c));const M=A.numElements,I=A.vao.byteSize/4,L=_.reduce((U,j)=>U+r.elementCount(j.geometry),0),F=T.changes.reduce((U,j)=>U+r.elementCount(j.geometry),0),z=Math.min((M+L-F)*s,NN),k=z>I;z>XU&&zA.deleteInstance(U)),A.instances.forEach(({geometry:U})=>_.push(U)),this._vaoCache.deleteVao(A.vao),Q$(x.buffers,A)):k?this._applyAndRebuild(A,_,T):this._applyRemoves(A,T)}),_.length>0)for(x==null&&(x=new yCt(f.origin),n.set(c,x)),x.buffers.forEach(T=>this._applyAdds(T,_));_.length>0;)x.buffers.push(this._applyAndRebuild(new fCt,_,null))})}_updateDrawCommands(){this._hasHighlights=!1,this._hasOccludees=!1,this._dataByOrigin.forEach(e=>{e.buffers.forEach(i=>{i.drawCommandsDirty&&(i.hasHiddenInstances=!1,i.hasHighlights=!1,i.hasOccludees=!1,rp(i.instances,r=>(i.updateDrawState(r),i.hasHiddenInstances&&i.hasHighlights&&i.hasOccludees)),i.updateDrawCommands(this._bufferWriter.vertexBufferLayout.stride)),this._hasHighlights=this._hasHighlights||i.hasHighlights,this._hasOccludees=this._hasOccludees||i.hasOccludees})})}_applyAndRebuild(e,i,r){if(r!=null)for(const M of r.changes)e.deleteInstance(M.id);const n=this._bufferWriter,s=n.vertexBufferLayout.stride,o=s/4,l=Math.floor(NN/o);let c=e.numElements;for(;i.length>0;){const M=i.pop(),I=n.elementCount(M.geometry);if(c+I>l&&c>0){i.push(M);break}c+=I;const L=new S1e(M,0,0);Xt(e.instances.get(M.id)==null),e.addInstance(M.id,L)}const f=c*o,_=FN(f),x=n.vertexBufferLayout.createView(_.buffer);let T=0;e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,e.instances.forEach((M,I)=>{this._writeGeometry(M.geometry,x,T);const L=T;T+=n.elementCount(M.geometry.geometry),e.updateInstance(I,L,T),e.updateDrawState(M)}),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(M1e(f)),e.vao.vertexBuffers.geometry.setSubData(_,0,0,T*o),e.holes.clear();const A=e.holes.pushNew();return A.from=T,A.to=Math.floor(e.vao.byteSize/s),e.updateDrawCommands(s),e}_applyRemoves(e,i){if(i.changes.length===0||this._bufferWriter===null)return;for(const l of i.changes){const c=l.id,f=e.instances.get(c);if(!f)continue;e.deleteInstance(c);const _=sg.back();if(_){if(_.to===f.from){_.to=f.to;continue}if(_.from===f.to){_.from=f.from;continue}}const x=sg.pushNew();x.from=f.from,x.to=f.to}x1e(sg);const r=this._bufferWriter.vertexBufferLayout.stride/4,n=sg.reduce((l,c)=>Math.max(l,c.numElements),0)*r,s=FN(n);s.fill(0,0,n);const o=e.vao.vertexBuffers.geometry;sg.forAll(l=>o.setSubData(s,l.from*r,0,l.numElements*r)),e.holes.pushArray(sg.data,sg.length),sg.forAll((l,c)=>sg.data[c]=null),sg.clear(),e.drawCommandsDirty=!0}_applyAdds(e,i){if(i.length===0||this._bufferWriter===null)return;if(!mCt(e))return void this._applyAndRebuild(e,i,null);const r=this._bufferWriter,n=r.vertexBufferLayout.stride/4,s=e.numElements,o=i.reduce((F,z)=>F+r.elementCount(z.geometry),0),l=Math.min((s+o)*n,NN),c=4*l;if(e.vao.byteSizee.vao.byteSize)return void this._applyAndRebuild(e,i,null);x1e(e.holes);const f=new Array;for(const F of i){const z=r.elementCount(F.geometry),k=bCt(e.holes,z);f.push(k)}const _=e.vao.vertexBuffers.geometry;let x=0,T=0,A=0;const M=FN(l),I=r.vertexBufferLayout.createView(M.buffer);i.forEach((F,z)=>{const k=f[z];if(k==null)return;if(A!==k){const H=A-T;H>0&&_.setSubData(M,T*n,0,H*n),T=k,x=0}const U=r.elementCount(F.geometry);this._writeGeometry(F,I,x),x+=U,A=k+U;const j=new S1e(F,k,k+U);Xt(e.instances.get(F.id)==null),e.addInstance(F.id,j),e.drawCommandsDirty=!0});const L=A-T;L>0&&_.setSubData(M,T*n,0,L*n),Ije(i,(F,z)=>f[z]==null)}_writeGeometry(e,i,r){if(this._bufferWriter===null)return;const n=e.localOrigin.vec3;xgt(C1e,-n[0],-n[1],-n[2]);const s=nn(wCt,C1e,e.transformation);Vo(DN,s),ld(DN,DN),this._bufferWriter.write(s,DN,e.geometry,i,r)}updateAnimation(e){return this.material.update(e)}prepareTechnique(e){if(!this.material.shouldRender(e))return null;const{output:i,bindParameters:r}=e;if(!this.material.produces(r.slot,i))return null;const n=i===ue.Highlight||i===ue.ShadowHighlight;if(n&&!this._hasHighlights)return null;const s=i===ue.ShadowExcludeHighlight,o=!(n||s);for(const l of this._dataByOrigin.values())for(const c of l.buffers){if(n&&!c.hasHighlights)continue;const f=(n?c.drawCommandsHighlight:s&&c.needsMultipleCommands()?c.drawCommandsShadowHighlightRest:c.drawCommandsDefault)||null,_=o&&c.drawCommandsOccludees||null;if(f!=null&&f.length||_!=null&&_.length){const x=this._glMaterials.load(e.rctx,r.slot,i),T=x!=null?x.beginSlot(r):null;if(T!=null)return T}}return null}renderNode(e,i){const{output:r,bindParameters:n}=e,s=r===ue.Highlight||r===ue.ShadowHighlight,o=r===ue.ShadowExcludeHighlight,l=!(s||o),c=e.rctx,f=e.bindParameters.slot===ke.OCCLUDER_MATERIAL,_=e.bindParameters.slot===ke.TRANSPARENT_OCCLUDER_MATERIAL;c.runAppleAmdDriverHelper(),c.bindTechnique(i,this.material.parameters,n);for(const x of this._dataByOrigin.values())for(const T of x.buffers){if(s&&!T.hasHighlights)continue;const A=(s?T.drawCommandsHighlight:o&&T.needsMultipleCommands()?T.drawCommandsShadowHighlightRest:T.drawCommandsDefault)||null,M=l&&T.drawCommandsOccludees||null;(A!=null&&A.length||M!=null&&M.length)&&(i.program.bindDraw(new fie(x.origin),n,this.material.parameters),i.ensureAttributeLocations(T.vao),c.bindVAO(T.vao),A!=null&&A.length&&(c.setPipelineState(i.getPipeline(!1,f,_)),A.forAll(I=>c.drawArrays(i.primitiveType,I.first,I.count))),M!=null&&M.length&&(c.setPipelineState(i.getPipeline(!0,f,_)),M.forAll(I=>c.drawArrays(i.primitiveType,I.first,I.count))))}}get test(){return{material:this.material,glMaterials:this._glMaterials,dataByOrigin:this._dataByOrigin}}};y([w({constructOnly:!0})],A$.prototype,"material",void 0),A$=y([Z("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],A$);let E1e=class{constructor(e){this.origin=e,this.changes=new Array}};function bCt(t,e){let i;if(!t.some(n=>!(n.numElements=i.to&&t.removeUnordered(i),r}const C1e=Qe(),wCt=Qe(),DN=Qe(),sg=new Pi({allocator:t=>t||new Jle,deallocator:null}),XU=65536,$W=4*XU,A1e=1024,jNe=16777216,NN=jNe/4;let LW=new Float32Array(XU);function FN(t){return LW.lengthe.dispose()),this._materialRenderers.clear(),this._sortedMaterialRenderers.clear(),this._geometries.clear(),this._pending.clear()}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _materialRepository(){return this.rendererContext.materialRepository}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}get hasWater(){return this._hasWater}get rendersOccluded(){return this._materialRenderers.some(e=>e.rendersOccluded)}get isEmpty(){return!this.updating&&this._materialRenderers.length===0&&this._geometries.size===0}getMemoryForMaterial(e){if(e==null)return 0;const i=this._materialRenderers.find(r=>r.material===e);return(i==null?void 0:i.usedMemory)??0}commitChanges(){if(!this.updating)return!1;this._processAddsRemoves();const e=NNe(this._changes);let i=!1,r=!1,n=!1;return e.forEach((s,o)=>{let l=this._materialRenderers.find(_=>_.material===o);if(!l&&s.adds.length>0){const _=new A$({material:o});_.initializeRenderContext(this.rendererContext.pluginContext,this._materialRepository),l=_,this._materialRenderers.push(l),i=!0,r=!0,n=!0}if(!l)return;const c=r||l.hasHighlights,f=n||l.hasWater;l.modify(s),r=r||c!==l.hasHighlights,n=n||f!==l.hasWater,l.isEmpty&&(this._materialRenderers.removeUnordered(l),l.dispose(),i=!0)}),this._changes.clear(),i&&this._updateSortedMaterialRenderers(),r&&(this._hasHighlights=this._materialRenderers.some(s=>s.hasHighlights)),n&&(this._hasWater=this._materialRenderers.some(s=>s.hasWater)),this.notifyChange("updating"),!0}addGeometries(e,i){if(e.length===0)return;const r=this._validateRenderGeometries(e);for(const s of r)this._geometries.set(s.id,s);const n=this._pending.empty;for(const s of r)this._pending.adds.add(s);n&&this.notifyChange("updating"),i===ds.UPDATE&&this._notifyGraphicGeometryChanged(e)}removeGeometries(e,i){const r=this._pending.empty,n=this._pending.adds;for(const s of e)n.has(s)?(this._pending.removed.add(s),n.delete(s)):this._pending.removed.has(s)||this._pending.removes.add(s),this._geometries.delete(s.id);r&&!this._pending.empty&&this.notifyChange("updating"),i===ds.UPDATE&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,i){const r=this._changes.updates.length===0;for(const n of e){const s=this._changes.updates.pushNew();s.renderGeometry=this._validateRenderGeometry(n),s.updateType=i}switch(r&&this._changes.updates.length>0&&this.notifyChange("updating"),i){case ca.TRANSFORMATION:case ca.GEOMETRY:return this._notifyGraphicGeometryChanged(e);case ca.VISIBILITY:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let i=!1;return this._sortedMaterialRenderers.forAll(r=>i=r.updateAnimation(e)||i),i}shouldRender(e){return this._sortedMaterialRenderers.some(i=>i.prepareTechnique(e))}render(e){this._sortedMaterialRenderers.forAll(i=>{const r=i.prepareTechnique(e);r!=null&&i.renderNode(e,r)})}intersect(e,i,r,n,s){return this._geometries.forEach(o=>{if(n&&!n(o))return;this._intersectRenderGeometry(o,r,i,0,e,s);const l=this.rendererContext.longitudeCyclical;l&&(o.boundingSphere[0]-o.boundingSphere[3]l.max&&this._intersectRenderGeometry(o,r,i,-l.range,e,s)),s++}),s}_updateSortedMaterialRenderers(){this._sortedMaterialRenderers.clear(),this._materialRenderers.forAll((e,i)=>{e.priority=i,this._sortedMaterialRenderers.push(e)}),this._sortedMaterialRenderers.sort((e,i)=>i.material.renderPriority===e.material.renderPriority?e.priority-i.priority:i.material.renderPriority-e.material.renderPriority)}_processAddsRemoves(){this._changes.adds.clear(),this._changes.removes.clear(),this._changes.adds.pushArray(Array.from(this._pending.adds)),this._changes.removes.pushArray(Array.from(this._pending.removes));for(let e=0;e{SCt(i,_,e.material.renderPriority,o,s,e.layerUid,e.graphicUid)},i)}_notifyGraphicGeometryChanged(e){if(this.drapeSource.notifyGraphicGeometryChanged==null)return;let i;for(const r of e){const n=r.graphicUid;n!=null&&n!==i&&(this.drapeSource.notifyGraphicGeometryChanged(n),i=n)}}_notifyGraphicVisibilityChanged(e){if(this.drapeSource.notifyGraphicVisibilityChanged==null)return;let i;for(const r of e){const n=r.graphicUid;n!=null&&n!==i&&(this.drapeSource.notifyGraphicVisibilityChanged(n),i=n)}}_validateRenderGeometries(e){for(const i of e)this._validateRenderGeometry(i);return e}_validateRenderGeometry(e){return e.localOrigin==null&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere)),e}get test(){return{sortedMaterialRenderers:this._sortedMaterialRenderers}}};y([w()],Bd.prototype,"drapeSource",void 0),y([w()],Bd.prototype,"updating",null),y([w()],Bd.prototype,"rctx",null),y([w({constructOnly:!0})],Bd.prototype,"rendererContext",void 0),y([w()],Bd.prototype,"_materialRepository",null),y([w()],Bd.prototype,"_localOriginFactory",null),y([w({readOnly:!0})],Bd.prototype,"isEmpty",null),y([w()],Bd.prototype,"_materialRenderers",void 0),y([w()],Bd.prototype,"_geometries",void 0),Bd=y([Z("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],Bd);let xCt=class{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return this.adds.size===0&&this.removes.size===0&&this.removed.size===0}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}};function SCt(t,e,i,r,n,s,o){const l=new tCt(s,o,e),c=f=>{f.set(ms.OVERLAY,l,t.dist,t.normal,t.transformation,i,r)};if((n.results.min.drapedLayerOrder==null||i>=n.results.min.drapedLayerOrder)&&(n.results.min.dist==null||n.results.ground.dist<=n.results.min.dist)&&c(n.results.min),n.options.store!==tl.MIN&&(n.results.max.drapedLayerOrder==null||in.results.max.dist)&&c(n.results.max),n.options.store===tl.ALL){const f=iae(n.ray);c(f),n.results.all.push(f)}}const DW=yt();let Kle=class GNe extends Hr{initializeProgram(e){return new Ir(e.rctx,GNe.shader.get().build(),Er)}initializePipeline(){return this.configuration.hasAlpha?Ti({blending:Ol(st.SRC_ALPHA,st.ONE,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),colorWrite:ji}):Ti({colorWrite:ji})}};Kle.shader=new Rr(PTt,()=>we(()=>Promise.resolve().then(()=>OWt),void 0));let Qle=class extends nh{constructor(){super(...arguments),this.hasAlpha=!1}};y([fe()],Qle.prototype,"hasAlpha",void 0);let ece=class extends _n{constructor(){super(...arguments),this.overlayIndex=ko.INNER,this.opacity=1}};function HNe(){const t=new Cr;return t.include(Pc),t.fragment.uniforms.add(new Zt("tex",e=>e.texture)),t.fragment.uniforms.add(new s6("overlayIdx",e=>e.overlayIndex)),t.fragment.uniforms.add(new ft("opacity",e=>e.opacity)),t.fragment.code.add(V`void main() { +}`)}return e}const cEt=Object.freeze(Object.defineProperty({__proto__:null,build:DNe},Symbol.toStringTag,{value:"Module"}));let NNe=class FNe extends Hr{initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global,i.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result}initializeProgram(e){return new $r(e.rctx,FNe.shader.get().build(this.configuration),Cr)}_setPipelineState(e){const i=this.configuration,r=e===Jt.NONE,n=e===Jt.FrontFace;return Ti({blending:i.output!==ue.Normal&&i.output!==ue.Highlight&&i.output!==ue.ObjectAndLayerIdColor&&i.transparent?r?xp:Q_(e):null,depthTest:{func:_x(e)},depthWrite:r?i.writeDepth?sh:null:lG(e),colorWrite:ji,polygonOffset:r||n?null:hG(i.enableOffset)})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}};NNe.shader=new Ir(cEt,()=>we(()=>Promise.resolve().then(()=>uXt),void 0));let ba=class extends pu{constructor(){super(...arguments),this.output=ue.Color,this.transparencyPassType=Jt.NONE,this.spherical=!1,this.receiveShadows=!1,this.hasSlicePlane=!1,this.transparent=!1,this.enableOffset=!0,this.writeDepth=!1,this.hasScreenSpaceReflections=!1,this.doublePrecisionRequiresObfuscation=!1,this.hasCloudsReflections=!1,this.objectAndLayerIdColorInstanced=!1,this.isDraped=!1,this.multipassEnabled=!1,this.cullAboveGround=!1}};y([fe({count:ue.COUNT})],ba.prototype,"output",void 0),y([fe({count:Jt.COUNT})],ba.prototype,"transparencyPassType",void 0),y([fe()],ba.prototype,"spherical",void 0),y([fe()],ba.prototype,"receiveShadows",void 0),y([fe()],ba.prototype,"hasSlicePlane",void 0),y([fe()],ba.prototype,"transparent",void 0),y([fe()],ba.prototype,"enableOffset",void 0),y([fe()],ba.prototype,"writeDepth",void 0),y([fe()],ba.prototype,"hasScreenSpaceReflections",void 0),y([fe()],ba.prototype,"doublePrecisionRequiresObfuscation",void 0),y([fe()],ba.prototype,"hasCloudsReflections",void 0),y([fe()],ba.prototype,"objectAndLayerIdColorInstanced",void 0),y([fe()],ba.prototype,"isDraped",void 0),y([fe()],ba.prototype,"multipassEnabled",void 0),y([fe()],ba.prototype,"cullAboveGround",void 0),y([fe({constValue:!1})],ba.prototype,"occlusionPass",void 0),y([fe({constValue:ti.Water})],ba.prototype,"pbrMode",void 0),y([fe({constValue:!0})],ba.prototype,"useCustomDTRExponentForWater",void 0),y([fe({constValue:!0})],ba.prototype,"highStepCount",void 0),y([fe({constValue:!1})],ba.prototype,"useFillLights",void 0);let uEt=class extends fx{_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.receiveShadows&&this._material.setParameters({receiveShadows:e.shadowMap.enabled})}_updateSSRState(e){const i=e.ssr.lastFrameColor!=null;i!==this._material.parameters.hasScreenSpaceReflections&&this._material.setParameters({hasScreenSpaceReflections:i})}_updateCloudsReflectionState(e){const i=e.cloudsFade.data!=null;i!==this._material.parameters.hasCloudsReflections&&this._material.setParameters({hasCloudsReflections:i})}ensureResources(e){return this._techniqueRepository.constructionContext.waterTextureRepository.ensureResources(e)}beginSlot(e){return this._output===ue.Color&&(this._updateShadowState(e),this._updateSSRState(e),this._updateCloudsReflectionState(e)),this._material.setParameters(this._techniqueRepository.constructionContext.waterTextureRepository.passParameters),this.ensureTechnique(NNe,e)}},kNe=class extends cce{constructor(e){super(e,new zNe),this._configuration=new ba,this._animation=new xLe}getConfiguration(e,i){return this._configuration.output=e,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasScreenSpaceReflections=this.parameters.hasScreenSpaceReflections,this._configuration.hasCloudsReflections=this.parameters.hasCloudsReflections,this._configuration.isDraped=this.parameters.isDraped,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.enableOffset=i.camera.relativeElevatione.set(r.from,r));let i=!0;for(;i;)i=!1,t.forEach(r=>{const n=e.get(r.to);n&&(r.to=n.to,e.delete(n.from),t.removeUnordered(n),i=!0)})}let T1e=class extends uce{constructor(e,i,r){super(i,r),this.geometry=e}get isVisible(){return this.geometry.visible}get hasHighlights(){return this.geometry.highlights!=null&&this.isVisible}get hasOccludees(){return this.geometry.occludees!=null}},dEt=class{constructor(){this.first=0,this.count=0}},pEt=class{constructor(){this._numElements=0,this._instances=new Map,this.holes=new Pi({allocator:e=>e||new uce,deallocator:null}),this.hasHiddenInstances=!1,this.hasHighlights=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.drawCommandsDefault=VN(),this.drawCommandsHighlight=VN(),this.drawCommandsOccludees=VN(),this.drawCommandsShadowHighlightRest=VN()}get numElements(){return this._numElements}get instances(){return this._instances}addInstance(e,i){this.deleteInstance(e),this._instances.set(e,i),this._numElements+=i.numElements}deleteInstance(e){const i=this._instances.get(e);i&&(this._numElements-=i.numElements,this._instances.delete(e))}updateInstance(e,i,r){const n=this._instances.get(e);n&&(this._numElements-=n.numElements,n.from=i,n.to=r,this._numElements+=n.numElements)}updateDrawState(e){e.isVisible?(e.hasHighlights&&(this.hasHighlights=!0),e.hasOccludees&&(this.hasOccludees=!0)):this.hasHiddenInstances=!0}updateDrawCommands(e){if(this.drawCommandsDefault.clear(),this.drawCommandsHighlight.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsShadowHighlightRest.clear(),this.drawCommandsDirty=!1,this._instances.size===0)return;if(!this.needsMultipleCommands()){const r=this.drawCommandsDefault.pushNew(),n=this.holes.front();return this.vao!=null&&this.holes.length===1&&n.to===Math.floor(this.vao.byteSize/e)?(r.first=0,void(r.count=n.from)):(r.first=1/0,r.count=0,this._instances.forEach(s=>{r.first=Math.min(r.first,s.from),r.count=Math.max(r.count,s.to)}),void(r.count-=r.first))}const i=Array.from(this._instances.values()).sort((r,n)=>r.from===n.from?r.to-n.to:r.from-n.from);for(const r of i)r.isVisible&&(E1e(r.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,r),E1e(r.hasHighlights?this.drawCommandsHighlight:this.drawCommandsShadowHighlightRest,r))}needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}};function fEt(t){return t.vao!=null}function VN(){return new Pi({allocator:t=>t||new dEt,deallocator:t=>t})}function E1e(t,e){const i=t.back();if(i==null){const r=t.pushNew();return r.first=e.from,void(r.count=e.numElements)}if(mEt(i,e)){const r=e.from-i.first+e.numElements;i.count=r}else{const r=t.pushNew();r.first=e.from,r.count=e.numElements}}function mEt(t,e){return t.first+t.count>=e.from}let gEt=class{constructor(e){this.origin=e,this.buffers=new Array}dispose(){this.buffers.forEach(e=>e.vao.dispose()),this.buffers.length=0}findBuffer(e){return this.buffers.find(i=>i.instances.has(e))}};const yEt=h$+1;let vEt=class{constructor(e,i,r){this._rctx=e,this._locations=i,this._layout=r,this._cache=new X9(e.newCache,"VAOCache")}dispose(){this._cache.destroy()}newVao(e){const i=e.toString();let r=this._cache.pop(i);return r||(r=new Jm(this._rctx,this._locations,{geometry:this._layout},{geometry:Yr.createVertex(this._rctx,Rr.STATIC_DRAW)}),r.vertexBuffers.geometry.setSize(e),r)}deleteVao(e){if(e==null)return;const i=e.byteSize.toString();this._cache.put(i,e,yEt)}},F$=class extends OLe{constructor(e){super(e),this._vaoCache=null,this._glMaterials=null,this._bufferWriter=null,this._dataByOrigin=new Map,this._hasHighlights=!1,this._hasOccludees=!1,this.priority=0,this.produces=new Map}dispose(){this._glMaterials=Kt(this._glMaterials),this._dataByOrigin.forEach(e=>e.dispose()),this._dataByOrigin.clear(),this._vaoCache=Kt(this._vaoCache)}initializeRenderContext(e,i){const{rctx:r}=e.renderContext;this._glMaterials=new LNe(this.material,i??e.materialRepository),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=new vEt(r,this.material.vertexAttributeLocations,_d(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get isEmpty(){return this._dataByOrigin.size===0}get hasHighlights(){return this._hasHighlights}get hasOccludees(){return this._hasOccludees}get hasWater(){return!this.isEmpty&&this.material instanceof kNe}get isDecoration(){return this.material.parameters.isDecoration}get rendersOccluded(){return!this.isEmpty&&this.material.parameters.renderOccluded!==Yn.Occlude}get numGeometries(){let e=0;return this._dataByOrigin.forEach(i=>e+=i.buffers.reduce((r,n)=>r+n.instances.size,0)),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach(i=>e+=i.buffers.reduce((r,n)=>r+n.vao.usedMemory,0)),e}forEachGeometry(e){this._dataByOrigin.forEach(i=>i.buffers.forEach(r=>r.instances.forEach(n=>e(n.geometry))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}_updateGeometries(e){const i=this._bufferWriter;if(i===null)return;const r=i.vertexBufferLayout.stride/4;for(const n of e){const s=n.renderGeometry,o=this._dataByOrigin.get(s.localOrigin.id),a=o==null?void 0:o.findBuffer(s.id);if(a==null)return;const c=a.instances.get(s.id);if(n.updateType&(ua.GEOMETRY|ua.TRANSFORMATION)){const p=GN(i.elementCount(c.geometry.geometry)*r),_=i.vertexBufferLayout.createView(p.buffer);this._writeGeometry(s,_,0),a.vao.vertexBuffers.geometry.setSubData(p,c.from*r,0,c.numElements*r)}n.updateType&(ua.HIGHLIGHT|ua.OCCLUDEE|ua.VISIBILITY)&&(a.drawCommandsDirty=!0)}}_computeDeltas(e,i){const r=new L5;for(const n of e){const s=n.localOrigin;if(s==null)continue;let o=r.get(s.id,null);o==null&&(o=new C1e(s.vec3),r.set(s.id,null,o)),o.changes.push(n)}for(const n of i){const s=n.localOrigin;if(s==null)continue;const o=this._dataByOrigin.get(s.id),a=o==null?void 0:o.findBuffer(n.id);if(a==null)continue;let c=r.get(s.id,a);c==null&&(c=new C1e(s.vec3),r.set(s.id,a,c)),c.changes.push(n)}return r}_addAndRemoveGeometries(e,i){if(this._bufferWriter===null||this._vaoCache===null)return;const{_bufferWriter:r,_dataByOrigin:n}=this,s=r.vertexBufferLayout.stride/4,o=this._computeDeltas(e,i);o.forEach((a,c)=>{const p=a.get(null),_=p!=null?p.changes:[];o.delete(c,null);let x=n.get(c);if(a.forEach((S,C)=>{if(o.delete(c,C),C==null)return void Xt(!1,"No VAO for removed geometries");if(C.instances.size===S.changes.length)return this._vaoCache.deleteVao(C.vao),uL(x.buffers,C),void(x.buffers.length===0&&_.length===0&&n.delete(c));const M=C.numElements,P=C.vao.byteSize/4,$=_.reduce((U,j)=>U+r.elementCount(j.geometry),0),F=S.changes.reduce((U,j)=>U+r.elementCount(j.geometry),0),z=Math.min((M+$-F)*s,jN),k=z>P;z>ZU&&z

C.deleteInstance(U)),C.instances.forEach(({geometry:U})=>_.push(U)),this._vaoCache.deleteVao(C.vao),uL(x.buffers,C)):k?this._applyAndRebuild(C,_,S):this._applyRemoves(C,S)}),_.length>0)for(x==null&&(x=new gEt(p.origin),n.set(c,x)),x.buffers.forEach(S=>this._applyAdds(S,_));_.length>0;)x.buffers.push(this._applyAndRebuild(new pEt,_,null))})}_updateDrawCommands(){this._hasHighlights=!1,this._hasOccludees=!1,this._dataByOrigin.forEach(e=>{e.buffers.forEach(i=>{i.drawCommandsDirty&&(i.hasHiddenInstances=!1,i.hasHighlights=!1,i.hasOccludees=!1,ap(i.instances,r=>(i.updateDrawState(r),i.hasHiddenInstances&&i.hasHighlights&&i.hasOccludees)),i.updateDrawCommands(this._bufferWriter.vertexBufferLayout.stride)),this._hasHighlights=this._hasHighlights||i.hasHighlights,this._hasOccludees=this._hasOccludees||i.hasOccludees})})}_applyAndRebuild(e,i,r){if(r!=null)for(const M of r.changes)e.deleteInstance(M.id);const n=this._bufferWriter,s=n.vertexBufferLayout.stride,o=s/4,a=Math.floor(jN/o);let c=e.numElements;for(;i.length>0;){const M=i.pop(),P=n.elementCount(M.geometry);if(c+P>a&&c>0){i.push(M);break}c+=P;const $=new T1e(M,0,0);Xt(e.instances.get(M.id)==null),e.addInstance(M.id,$)}const p=c*o,_=GN(p),x=n.vertexBufferLayout.createView(_.buffer);let S=0;e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,e.instances.forEach((M,P)=>{this._writeGeometry(M.geometry,x,S);const $=S;S+=n.elementCount(M.geometry.geometry),e.updateInstance(P,$,S),e.updateDrawState(M)}),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(O1e(p)),e.vao.vertexBuffers.geometry.setSubData(_,0,0,S*o),e.holes.clear();const C=e.holes.pushNew();return C.from=S,C.to=Math.floor(e.vao.byteSize/s),e.updateDrawCommands(s),e}_applyRemoves(e,i){if(i.changes.length===0||this._bufferWriter===null)return;for(const a of i.changes){const c=a.id,p=e.instances.get(c);if(!p)continue;e.deleteInstance(c);const _=ug.back();if(_){if(_.to===p.from){_.to=p.to;continue}if(_.from===p.to){_.from=p.from;continue}}const x=ug.pushNew();x.from=p.from,x.to=p.to}S1e(ug);const r=this._bufferWriter.vertexBufferLayout.stride/4,n=ug.reduce((a,c)=>Math.max(a,c.numElements),0)*r,s=GN(n);s.fill(0,0,n);const o=e.vao.vertexBuffers.geometry;ug.forAll(a=>o.setSubData(s,a.from*r,0,a.numElements*r)),e.holes.pushArray(ug.data,ug.length),ug.forAll((a,c)=>ug.data[c]=null),ug.clear(),e.drawCommandsDirty=!0}_applyAdds(e,i){if(i.length===0||this._bufferWriter===null)return;if(!fEt(e))return void this._applyAndRebuild(e,i,null);const r=this._bufferWriter,n=r.vertexBufferLayout.stride/4,s=e.numElements,o=i.reduce((F,z)=>F+r.elementCount(z.geometry),0),a=Math.min((s+o)*n,jN),c=4*a;if(e.vao.byteSizee.vao.byteSize)return void this._applyAndRebuild(e,i,null);S1e(e.holes);const p=new Array;for(const F of i){const z=r.elementCount(F.geometry),k=_Et(e.holes,z);p.push(k)}const _=e.vao.vertexBuffers.geometry;let x=0,S=0,C=0;const M=GN(a),P=r.vertexBufferLayout.createView(M.buffer);i.forEach((F,z)=>{const k=p[z];if(k==null)return;if(C!==k){const G=C-S;G>0&&_.setSubData(M,S*n,0,G*n),S=k,x=0}const U=r.elementCount(F.geometry);this._writeGeometry(F,P,x),x+=U,C=k+U;const j=new T1e(F,k,k+U);Xt(e.instances.get(F.id)==null),e.addInstance(F.id,j),e.drawCommandsDirty=!0});const $=C-S;$>0&&_.setSubData(M,S*n,0,$*n),yGe(i,(F,z)=>p[z]==null)}_writeGeometry(e,i,r){if(this._bufferWriter===null)return;const n=e.localOrigin.vec3;wmt(A1e,-n[0],-n[1],-n[2]);const s=sn(bEt,A1e,e.transformation);Bo(BN,s),ud(BN,BN),this._bufferWriter.write(s,BN,e.geometry,i,r)}updateAnimation(e){return this.material.update(e)}prepareTechnique(e){if(!this.material.shouldRender(e))return null;const{output:i,bindParameters:r}=e;if(!this.material.produces(r.slot,i))return null;const n=i===ue.Highlight||i===ue.ShadowHighlight;if(n&&!this._hasHighlights)return null;const s=i===ue.ShadowExcludeHighlight,o=!(n||s);for(const a of this._dataByOrigin.values())for(const c of a.buffers){if(n&&!c.hasHighlights)continue;const p=(n?c.drawCommandsHighlight:s&&c.needsMultipleCommands()?c.drawCommandsShadowHighlightRest:c.drawCommandsDefault)||null,_=o&&c.drawCommandsOccludees||null;if(p!=null&&p.length||_!=null&&_.length){const x=this._glMaterials.load(e.rctx,r.slot,i),S=x!=null?x.beginSlot(r):null;if(S!=null)return S}}return null}renderNode(e,i){const{output:r,bindParameters:n}=e,s=r===ue.Highlight||r===ue.ShadowHighlight,o=r===ue.ShadowExcludeHighlight,a=!(s||o),c=e.rctx,p=e.bindParameters.slot===ke.OCCLUDER_MATERIAL,_=e.bindParameters.slot===ke.TRANSPARENT_OCCLUDER_MATERIAL;c.runAppleAmdDriverHelper(),c.bindTechnique(i,this.material.parameters,n);for(const x of this._dataByOrigin.values())for(const S of x.buffers){if(s&&!S.hasHighlights)continue;const C=(s?S.drawCommandsHighlight:o&&S.needsMultipleCommands()?S.drawCommandsShadowHighlightRest:S.drawCommandsDefault)||null,M=a&&S.drawCommandsOccludees||null;(C!=null&&C.length||M!=null&&M.length)&&(i.program.bindDraw(new xie(x.origin),n,this.material.parameters),i.ensureAttributeLocations(S.vao),c.bindVAO(S.vao),C!=null&&C.length&&(c.setPipelineState(i.getPipeline(!1,p,_)),C.forAll(P=>c.drawArrays(i.primitiveType,P.first,P.count))),M!=null&&M.length&&(c.setPipelineState(i.getPipeline(!0,p,_)),M.forAll(P=>c.drawArrays(i.primitiveType,P.first,P.count))))}}get test(){return{material:this.material,glMaterials:this._glMaterials,dataByOrigin:this._dataByOrigin}}};y([w({constructOnly:!0})],F$.prototype,"material",void 0),F$=y([Z("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],F$);let C1e=class{constructor(e){this.origin=e,this.changes=new Array}};function _Et(t,e){let i;if(!t.some(n=>!(n.numElements=i.to&&t.removeUnordered(i),r}const A1e=Qe(),bEt=Qe(),BN=Qe(),ug=new Pi({allocator:t=>t||new uce,deallocator:null}),ZU=65536,jW=4*ZU,M1e=1024,UNe=16777216,jN=UNe/4;let GW=new Float32Array(ZU);function GN(t){return GW.lengthe.dispose()),this._materialRenderers.clear(),this._sortedMaterialRenderers.clear(),this._geometries.clear(),this._pending.clear()}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _materialRepository(){return this.rendererContext.materialRepository}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}get hasWater(){return this._hasWater}get rendersOccluded(){return this._materialRenderers.some(e=>e.rendersOccluded)}get isEmpty(){return!this.updating&&this._materialRenderers.length===0&&this._geometries.size===0}getMemoryForMaterial(e){if(e==null)return 0;const i=this._materialRenderers.find(r=>r.material===e);return(i==null?void 0:i.usedMemory)??0}commitChanges(){if(!this.updating)return!1;this._processAddsRemoves();const e=$Ne(this._changes);let i=!1,r=!1,n=!1;return e.forEach((s,o)=>{let a=this._materialRenderers.find(_=>_.material===o);if(!a&&s.adds.length>0){const _=new F$({material:o});_.initializeRenderContext(this.rendererContext.pluginContext,this._materialRepository),a=_,this._materialRenderers.push(a),i=!0,r=!0,n=!0}if(!a)return;const c=r||a.hasHighlights,p=n||a.hasWater;a.modify(s),r=r||c!==a.hasHighlights,n=n||p!==a.hasWater,a.isEmpty&&(this._materialRenderers.removeUnordered(a),a.dispose(),i=!0)}),this._changes.clear(),i&&this._updateSortedMaterialRenderers(),r&&(this._hasHighlights=this._materialRenderers.some(s=>s.hasHighlights)),n&&(this._hasWater=this._materialRenderers.some(s=>s.hasWater)),this.notifyChange("updating"),!0}addGeometries(e,i){if(e.length===0)return;const r=this._validateRenderGeometries(e);for(const s of r)this._geometries.set(s.id,s);const n=this._pending.empty;for(const s of r)this._pending.adds.add(s);n&&this.notifyChange("updating"),i===ds.UPDATE&&this._notifyGraphicGeometryChanged(e)}removeGeometries(e,i){const r=this._pending.empty,n=this._pending.adds;for(const s of e)n.has(s)?(this._pending.removed.add(s),n.delete(s)):this._pending.removed.has(s)||this._pending.removes.add(s),this._geometries.delete(s.id);r&&!this._pending.empty&&this.notifyChange("updating"),i===ds.UPDATE&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,i){const r=this._changes.updates.length===0;for(const n of e){const s=this._changes.updates.pushNew();s.renderGeometry=this._validateRenderGeometry(n),s.updateType=i}switch(r&&this._changes.updates.length>0&&this.notifyChange("updating"),i){case ua.TRANSFORMATION:case ua.GEOMETRY:return this._notifyGraphicGeometryChanged(e);case ua.VISIBILITY:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let i=!1;return this._sortedMaterialRenderers.forAll(r=>i=r.updateAnimation(e)||i),i}shouldRender(e){return this._sortedMaterialRenderers.some(i=>i.prepareTechnique(e))}render(e){this._sortedMaterialRenderers.forAll(i=>{const r=i.prepareTechnique(e);r!=null&&i.renderNode(e,r)})}intersect(e,i,r,n,s){return this._geometries.forEach(o=>{if(n&&!n(o))return;this._intersectRenderGeometry(o,r,i,0,e,s);const a=this.rendererContext.longitudeCyclical;a&&(o.boundingSphere[0]-o.boundingSphere[3]a.max&&this._intersectRenderGeometry(o,r,i,-a.range,e,s)),s++}),s}_updateSortedMaterialRenderers(){this._sortedMaterialRenderers.clear(),this._materialRenderers.forAll((e,i)=>{e.priority=i,this._sortedMaterialRenderers.push(e)}),this._sortedMaterialRenderers.sort((e,i)=>i.material.renderPriority===e.material.renderPriority?e.priority-i.priority:i.material.renderPriority-e.material.renderPriority)}_processAddsRemoves(){this._changes.adds.clear(),this._changes.removes.clear(),this._changes.adds.pushArray(Array.from(this._pending.adds)),this._changes.removes.pushArray(Array.from(this._pending.removes));for(let e=0;e{xEt(i,_,e.material.renderPriority,o,s,e.layerUid,e.graphicUid)},i)}_notifyGraphicGeometryChanged(e){if(this.drapeSource.notifyGraphicGeometryChanged==null)return;let i;for(const r of e){const n=r.graphicUid;n!=null&&n!==i&&(this.drapeSource.notifyGraphicGeometryChanged(n),i=n)}}_notifyGraphicVisibilityChanged(e){if(this.drapeSource.notifyGraphicVisibilityChanged==null)return;let i;for(const r of e){const n=r.graphicUid;n!=null&&n!==i&&(this.drapeSource.notifyGraphicVisibilityChanged(n),i=n)}}_validateRenderGeometries(e){for(const i of e)this._validateRenderGeometry(i);return e}_validateRenderGeometry(e){return e.localOrigin==null&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere)),e}get test(){return{sortedMaterialRenderers:this._sortedMaterialRenderers}}};y([w()],qd.prototype,"drapeSource",void 0),y([w()],qd.prototype,"updating",null),y([w()],qd.prototype,"rctx",null),y([w({constructOnly:!0})],qd.prototype,"rendererContext",void 0),y([w()],qd.prototype,"_materialRepository",null),y([w()],qd.prototype,"_localOriginFactory",null),y([w({readOnly:!0})],qd.prototype,"isEmpty",null),y([w()],qd.prototype,"_materialRenderers",void 0),y([w()],qd.prototype,"_geometries",void 0),qd=y([Z("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],qd);let wEt=class{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return this.adds.size===0&&this.removes.size===0&&this.removed.size===0}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}};function xEt(t,e,i,r,n,s,o){const a=new eEt(s,o,e),c=p=>{p.set(ms.OVERLAY,a,t.dist,t.normal,t.transformation,i,r)};if((n.results.min.drapedLayerOrder==null||i>=n.results.min.drapedLayerOrder)&&(n.results.min.dist==null||n.results.ground.dist<=n.results.min.dist)&&c(n.results.min),n.options.store!==rl.MIN&&(n.results.max.drapedLayerOrder==null||in.results.max.dist)&&c(n.results.max),n.options.store===rl.ALL){const p=mae(n.ray);c(p),n.results.all.push(p)}}const HW=yt();let hce=class VNe extends Hr{initializeProgram(e){return new $r(e.rctx,VNe.shader.get().build(),Cr)}initializePipeline(){return this.configuration.hasAlpha?Ti({blending:Pl(ot.SRC_ALPHA,ot.ONE,ot.ONE_MINUS_SRC_ALPHA,ot.ONE_MINUS_SRC_ALPHA),colorWrite:ji}):Ti({colorWrite:ji})}};hce.shader=new Ir(OSt,()=>we(()=>Promise.resolve().then(()=>hXt),void 0));let dce=class extends oh{constructor(){super(...arguments),this.hasAlpha=!1}};y([fe()],dce.prototype,"hasAlpha",void 0);let pce=class extends bn{constructor(){super(...arguments),this.overlayIndex=zo.INNER,this.opacity=1}};function BNe(){const t=new Ar;return t.include($c),t.fragment.uniforms.add(new Zt("tex",e=>e.texture)),t.fragment.uniforms.add(new u6("overlayIdx",e=>e.overlayIndex)),t.fragment.uniforms.add(new ft("opacity",e=>e.opacity)),t.fragment.code.add(V`void main() { vec2 overlayUV = overlayIdx == 0 ? vec2(uv.x * 0.5, uv.y) : vec2(uv.x * 0.5 + 0.5, uv.y); fragColor = texture(tex, overlayUV) * opacity; -}`),t}const TCt=Object.freeze(Object.defineProperty({__proto__:null,OverlayCompositingPassParameters:ece,build:HNe},Symbol.toStringTag,{value:"Module"}));let qNe=class WNe extends Hr{initializeProgram(e){return new Ir(e.rctx,WNe.shader.get().build(),Er)}initializePipeline(){return Ti({blending:hd(st.ONE,st.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}};qNe.shader=new Rr(TCt,()=>we(()=>Promise.resolve().then(()=>PWt),void 0));let k0=class extends CE{get _bindParameters(){return this._renderContext.bindParameters}get _rctx(){return this.view._stage.renderView.renderingContext}get rctx(){return this._rctx}get materialRepository(){return this._materialRepository}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new ece,this.hasHighlights=!1,this._rendersOccluded=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new Pi,this._passParameters=new Ble,this._materialRepository=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new ai,this.worldToPCSRatio=1,this.events=new Dn,this.longitudeCyclical=null,this.produces=new Map([[ke.DRAPED_MATERIAL,i=>i!==ue.Highlight||this.hasHighlights],[ke.DRAPED_WATER,()=>!0]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this.view._stage.renderer.fboCache,i=this.view._stage.renderView,{waterTextureRepository:r,stippleTextureRepository:n,markerTextureRepository:s}=i;this._shaderTechniqueRepository=new oNe({rctx:this._rctx,viewingMode:_t.Local,stippleTextureRepository:n,markerTextureRepository:s,waterTextureRepository:r}),this._renderContext=new LNe(this._rctx,new Xle(e,this.view.state.viewingMode),null),this.addHandles([_e(()=>r.updating,()=>this.events.emit("content-changed"),kt),_e(()=>this.spatialReference,o=>this._localOriginFactory=new Yle(o),kt),Jr(()=>this.view.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0)]),this._materialRepository=new aNe(i.textureRepository,this._shaderTechniqueRepository,o=>{(o.parameters.renderOccluded&ZU)>0!==this._rendersOccluded&&this._updateRendersOccluded(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed")),this._bindParameters.slot=ke.DRAPED_MATERIAL,this._bindParameters.mainDepth=Syt(this._rctx),this._camera.near=1,this._camera.far=1e4,this._camera.relativeElevation=null,this._bindParameters.camera=this._camera,this._bindParameters.transparencyPassType=Jt.NONE,this._bindParameters.newLighting.noonFactor=0,this._bindParameters.newLighting.globalFactor=0,this._bindParameters.newLighting.set([new Mae(nt(1,1,1))]),this.addHandles(this.view.resourceController.scheduler.registerTask(ni.STAGE,this))}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._debugTextureTechnique=ir(this._debugTextureTechnique),this._passParameters.texture=Kt(this._passParameters.texture),this._bindParameters.mainDepth=Kt(this._bindParameters.mainDepth),this._shaderTechniqueRepository=et(this._shaderTechniqueRepository),this.disposeOverlays()}initializeRenderContext(e){this.pluginContext=e}uninitializeRenderContext(){}renderNode(){}get updating(){return this._sortedDrapeSourceRenderersDirty||rp(this._renderers,e=>e.updating)}get hasOverlays(){return this._overlays!=null&&this._renderTargets!=null}getMemoryForMaterial(e){return Array.from(this._renderers.values()).reduce((i,r)=>i+r.getMemoryForMaterial(e),0)}createGeometryDrapeSourceRenderer(e){return this.createDrapeSourceRenderer(e,Bd)}createDrapeSourceRenderer(e,i,r){const n=this._renderers.get(e);n!=null&&n.destroy();const s=new i({...r,rendererContext:this,drapeSource:e});return this._renderers.set(e,s),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(_e(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e),s}removeDrapeSourceRenderer(e){if(e==null)return;const i=this._renderers.get(e);i!=null&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),i.destroy())}computeValidity(){var e;return((e=this._renderTargets)==null?void 0:e.computeValidity())??0}releaseRenderTargets(){var e;(e=this._renderTargets)==null||e.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&d7(e,i=>i.drapeTargetType===cie.WithoutRasterImage)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=d7(e,i=>i.drapeSourceType===T$.Features),this._hasDrapedRasterSource=d7(e,i=>i.drapeSourceType===T$.RasterImage)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,i,r=this._bindParameters.overlayStretch){this._overlays==null&&(this._renderTargets=new bTt(this.view._stage.renderer.fboCache),this._overlays=[new t1e,new t1e]),this.ensureDrapeTargets(e),this.ensureDrapeSources(i),this._bindParameters.overlayStretch=r}disposeOverlays(){this._overlays=null,this._renderTargets=Kt(this._renderTargets),this.events.emit("textures-disposed")}getTexture(e){var i,r;if(e!=null)return e===ns.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?(i=this._renderTargets)==null?void 0:i.getTexture(ns.Color):(r=this._renderTargets)==null?void 0:r.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_processDrapeSources(e,i){let r=!1;for(const[n,s]of this._renderers){if(e.done)break;(n.destroyed||i(n))&&s.commitChanges()&&(r=!0,e.madeProgress())}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,r=!0,this._updateSortedDrapeSourceRenderers()),r&&(this._overlays!=null&&this._renderers.size===0&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=rp(this._renderers,n=>n.hasHighlights),this._updateRendersOccluded(),this._updateHasWater())}processSyncDrapeSources(){this._processDrapeSources(ou,e=>e.updatePolicy===b2.SYNC)}get isEmpty(){return!Tn.OVERLAY_DRAW_DEBUG_TEXTURE&&!rp(this._renderers,e=>!e.isEmpty)}get hasWater(){return this._hasWater}get rendersOccluded(){return this._rendersOccluded}get mode(){var e,i;return this.isEmpty?vy.Disabled:(e=this._renderTargets)!=null&&e.getTexture(ns.WaterNormal)?vy.EnabledWithWater:(i=this._renderTargets)!=null&&i.getTexture(ns.Color)?vy.Enabled:vy.Disabled}updateAnimation(e){let i=!1;return this._renderers.forEach(r=>i=r.updateAnimation(e)||i),i}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}drawOverlays(e){if(this._overlays&&this._renderTargets){for(const i of this._overlays)this.longitudeCyclical?i.setupGeometryViewsCyclical(this.longitudeCyclical):i.setupGeometryViewsDirect();for(const i of this._renderTargets.targets)(i.content!==ns.ColorNoRasterImage||this._needsColorWithoutRasterImage)&&(this._drawTarget(ko.INNER,i,e),this._drawTarget(ko.OUTER,i,e))}}_drawTarget(e,i,r){const n=this._overlays[e],s=n.canvasGeometries;if(s.numViews===0)return;const{alignPixelEnabled:o,contentPixelRatio:l}=r;this._screenToWorldRatio=l*n.mapUnitsPerPixel/this._bindParameters.overlayStretch;const c=i.output;if(this.isEmpty||c===ue.Highlight&&!this.hasHighlights||c===ue.Normal&&!this.hasWater||!n.hasSomeSizedView())return;const f=this._rctx;this._camera.pixelRatio=n.pixelRatio*l,this._renderContext.output=c,this._bindParameters.alignPixelEnabled=o,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=c===ue.Normal?ke.DRAPED_WATER:ke.DRAPED_MATERIAL;const _=Tn.OVERLAY_DRAW_DEBUG_TEXTURE&&i.content!==ns.Occluded;if(!_&&!this._sortedRenderers.some(({renderer:I})=>I.shouldRender(this._renderContext)))return;const x=n.resolution;this._rctx.setViewport(e===ko.INNER?0:x,0,x,x);const T=2*n.resolution,A=n.resolution,M=i.fbo;if(M.bind(f,T,A),e===ko.INNER&&(f.setClearColor(0,0,0,0),f.clearSafe(In.COLOR_BUFFER_BIT)),i.content===ns.Occluded&&(this._renderContext.renderOccludedMask=ZU),_)for(let I=0;I{if(i.content===ns.ColorNoRasterImage&&I.drapeSourceType===T$.RasterImage)return;const{fullOpacity:F}=I,z=F!=null&&F<1&&c===ue.Color?this.bindTemporaryFramebuffer(T,A):null;for(let k=0;k{const n=e.indexOf(r.layer),s=n>=0,o=this._renderers.size*(r.renderGroup??(s?GU.MapLayer:GU.ViewLayer))+(s?n:0);this._sortedRenderers.push(new ECt(r,i,o))}),this._sortedRenderers.sort((i,r)=>i.index-r.index)}_setViewParameters(e,i){const r=this._camera;r.viewport=[0,0,i.resolution,i.resolution],KAe(r.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],r.near,r.far),L9(r.viewMatrix,[-e[0],-e[1],0])}_updateHasWater(){const e=rp(this._renderers,i=>i.hasWater);e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_updateRendersOccluded(){const e=rp(this._renderers,i=>i.rendersOccluded);e!==this._rendersOccluded&&(this._rendersOccluded=e,this.events.emit("renders-occluded",e))}_ensureDebugPatternResources(e,i){if(Ie(this._passParameters.color,i[0],i[1],i[2]),this._passParameters.texture)return;const r=new Uint8Array(e*e*4);let n=0;for(let l=0;le-20||10*_>e-20?(r[n++]=255,r[n++]=255,r[n++]=255,r[n++]=255):(r[n++]=255,r[n++]=255,r[n++]=255,r[n++]=1&f&&1&_?1&c^1&l?0:255:1&f^1&_?0:128)}const s=new tn(e);s.samplingMode=ki.NEAREST,this._passParameters.texture=new Ai(this._rctx,s,r);const o=new Qle;o.hasAlpha=!0,this._debugTextureTechnique=this._shaderTechniqueRepository.acquire(Kle,o)}get test(){return{drapedRenderers:Array.from(this._renderers.values()),getDrapeSourceRenderer:e=>this._renderers.get(e)}}};y([w()],k0.prototype,"hasHighlights",void 0),y([w()],k0.prototype,"_sortedDrapeSourceRenderersDirty",void 0),y([w({autoDestroy:!0})],k0.prototype,"_shaderTechniqueRepository",void 0),y([w({constructOnly:!0})],k0.prototype,"view",void 0),y([w()],k0.prototype,"worldToPCSRatio",void 0),y([w()],k0.prototype,"spatialReference",void 0),y([w({type:Boolean,readOnly:!0})],k0.prototype,"updating",null),y([w()],k0.prototype,"isEmpty",null),k0=y([Z("esri.views.3d.terrain.OverlayRenderer")],k0);let ECt=class{constructor(e,i,r){this.drapeSource=e,this.renderer=i,this.index=r}};const CCt=[[1,.5,.5],[.5,.5,1]],tce=-2,ZU=Wn.OccludeAndTransparent;function ice(t,e,i,r){const n=c6(t.rings,!!t.hasZ,Ky.CCW_IS_HOLE,t.spatialReference),s=Ja(n.position.length),o=A6e(n.position,t.spatialReference,0,s,0,n.position,0,n.position.length/3,e,i,r),l=o!=null;return new OCt(n.position,s,ZNe(n.polygons,n.position,s),XNe(n.outlines,n.position,s),l,o)}function YNe(t,e){const i=c6(t.rings,!1,Ky.CCW_IS_HOLE),r=vn(i.position,t.spatialReference,0,i.position,e,0,i.position.length/3);for(let n=2;nr>1).map(({index:r,count:n})=>{const s=3*r,o=3*n;return i!=null?new JNe(r,n,Lf(e,s,o),Lf(i,s,o)):new rce(r,n,Lf(e,s,o))})}function ZNe(t,e,i=null){const r=new Array;for(const{index:n,count:s,holeIndices:o,pathLengths:l}of t){if(s<=1)continue;const c=3*n,f=3*s,_=o.map(T=>T-n),x=i!=null?new ACt(n,s,Lf(e,3*n,3*s),Lf(i,c,f),_,l):new MCt(n,s,Lf(e,3*n,3*s),_,l);r.push(x)}return r}let rce=class{constructor(e,i,r){this.index=e,this.count=i,this.position=r}},JNe=class extends rce{constructor(e,i,r,n){super(e,i,r),this.mapPositions=n}},ACt=class extends JNe{constructor(e,i,r,n,s,o){super(e,i,r,n),this.holeIndices=s,this.pathLengths=o}},MCt=class extends rce{constructor(e,i,r,n,s){super(e,i,r),this.holeIndices=n,this.pathLengths=s}},OCt=class{constructor(e,i,r,n,s,o){this.position=e,this.mapPositions=i,this.polygons=r,this.outlines=n,this.projectionSuccess=s,this.sampledElevation=o}};function tE(t,e,i,r,n,s=2){const o=1/(Math.abs(i)+Math.abs(r)+Math.abs(n)),l=i*o,c=r*o,f=n<=0?(l>=0?1:-1)*(1-Math.abs(c)):l,_=n<=0?(c>=0?1:-1)*(1-Math.abs(l)):c,x=e*s;t[x]=O1e(f),t[x+1]=O1e(_)}function PCt(t){const e=t.length/3,i=new Int16Array(2*e);let r=0;for(let n=0;n=0?1:-1)*(1-Math.abs(o)),t[1]=(o>=0?1:-1)*(1-Math.abs(s))):(t[0]=s,t[1]=o),Ye(t,t)}function O1e(t){return Je(Math.round(32767*t),-32767,32767)}function P1e(t){return Je(t/32767,-1,1)}const ICt=["polygon","extent"];let $Ct=class extends p1{constructor(e,i,r,n){super(e,i,r,n),this.ensureDrapedStatus(!1)}async doLoad(){var l,c;if(!this._drivenProperties.size){const f=iG(this._getSymbolSize());if(f)throw new se("graphics3dextrudesymbollayer:invalid-size",f)}const e=(c=(l=this.symbolLayer)==null?void 0:l.material)==null?void 0:c.color,i=this._getCombinedOpacityAndColor(e),r=mc(i),n=i[3],s=n<1||this.needsDrivenTransparentPass,o={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:r,ambient:r,opacity:n,transparent:s,cullFace:s?Ln.None:Ln.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0,normalType:Br.Compressed};this._materials[jd.Main]=new km(o),this._materials[jd.Bottom]=new km({...o,cullFace:Ln.Back}),this._context.stage.addMany(this._materials)}destroy(){super.destroy(),this._context.stage.removeMany(this._materials),this._materials.length=0}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,ICt,this.symbolLayer.type))return null;const r=this._getVertexOpacityAndColor(e.renderingInfo,255),n=this.setGraphicElevationContext(i);return this._createAs3DShape(i,e.renderingInfo,r,n,i.uid)}layerOpacityChanged(e,i){var l,c,f,_;const r=(c=(l=this.symbolLayer)==null?void 0:l.material)==null?void 0:c.color,n=this._getCombinedOpacity(r),s=n<1||this.needsDrivenTransparentPass;(f=this._materials[jd.Main])==null||f.setParameters({opacity:n,transparent:s}),(_=this._materials[jd.Bottom])==null||_.setParameters({opacity:n,transparent:s});const o=this._getLayerOpacity();e.forEach(x=>{const T=i(x);T!=null&&T.layerOpacityChanged(o,this._context.isAsync)})}layerElevationInfoChanged(e,i){return this.updateGraphics3DGraphicElevationInfo(e,i,X2)}slicePlaneEnabledChanged(e,i){var r,n;return(r=this._materials[jd.Main])==null||r.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),(n=this._materials[jd.Bottom])==null||n.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e.forEach(s=>{const o=i(s);o!=null&&o.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){var i,r;const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return(i=this._materials[jd.Main])==null||i.setParameters(e),(r=this._materials[jd.Bottom])==null||r.setParameters(e),!0}_getExtrusionSize(e){let i;return i=e.size&&this._drivenProperties.size?lTt(e.size,2)??0:this._getSymbolSize(),i/=this._context.renderCoordsHelper.unitInMeters,i}applyRendererDiff(e,i){return this._drivenPropertiesChanged(i)?To.RecreateSymbol:To.RecreateGraphics}async queryForSnapping(e,i,r,n){const s=this._getExtrusionSize(r)*this._context.renderCoordsHelper.unitInMeters/Bf(i),{objectId:o,target:l}=e,c=Re(l);switch(c.z=(c.z??0)+s,e.type){case"edge":{const{start:f,end:_}=e,x=Re(f),T=Re(_);return x.z=(x.z??0)+s,T.z=(T.z??0)+s,[Jye(o,c,1/0,x,T)]}case"vertex":return[sTt(o,c,1/0),Jye(o,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,i,r,n,s){const o=VL(e.geometry);if(o==null)return null;if(o.rings.length===0||!o.rings.some(Q=>Q.length>0))return this._logGeometryValidationWarnings(o.rings,"rings","ExtrudeSymbol3DLayer"),null;const l=ice(o,this._context.elevationProvider,this._context.renderCoordsHelper,n);this._logGeometryCreationWarnings(l,o.rings,"rings","ExtrudeSymbol3DLayer");const c=wle(o);if(c==null)return null;const f=new Array,_=new Array,x=ya(),T=Qe(),A=W(),M=this._context.renderCoordsHelper.viewingMode===_t.Global;M||this._context.renderCoordsHelper.worldUpAtPosition(null,A),uu(o.spatialReference,[c.x,c.y,0],T,this._context.renderCoordsHelper.spatialReference);const I=Qe();Vo(I,T);const L=as();v_(L,I);const{polygons:F,mapPositions:z,position:k}=l;for(const Q of F){const ne=Q.count;if(this._context.clippingExtent&&(Bn(x),cp(x,Q.mapPositions),!ym(x,this._context.clippingExtent)))continue;const re=R5(Q.mapPositions,Q.holeIndices,3);if(re.length===0)continue;const he=re.length,ce=6*ne,be=TU(ce+he),ye=TU(he),pe=Ja(3*ce),Ee=Ja(3*ce),te=Ja(3*ce),le=Ja(ce);LCt(k,z,re,Q,pe,te,Ee,le,be,ye,this._getExtrusionSize(i),A,M),Um(pe,pe,I);const de=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:s,layerUid:this._context.layer.uid}),ve=new zCt(pe,te,PCt(Ee),le);f.push(R1e(this._materials[jd.Main],be,be.length-ye.length,ve,r,de),R1e(this._materials[jd.Bottom],ye,0,ve,r,de)),_.push(ve.heights)}if(f.length===0)return null;const U=new X_({geometries:f,layerUid:this._context.layer.uid,graphicUid:s,isElevationSource:!0});U.transformation=T;const j=zPe(this.symbolLayer,{opacity:this._getLayerOpacity()}),H=j!=null?{baseMaterial:this._materials[jd.Main],edgeMaterials:[j],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,Y=new d1(this,U,f,null,null,(Q,ne,re,he,ce)=>FCt(Q,ne,re,he,ce,_),n,H);return Y.alignedSampledElevation=l.sampledElevation,Y.needsElevationUpdates=X2(n.mode),Y}};function R1e(t,e,i,r,n,s){const o=ux(e.length),l=[[J.POSITION,new It(r.positions,e,3,!0)],[J.NORMALCOMPRESSED,new It(r.normals,e,2,!0)],[J.COLOR,new It(n,o,4,!0)]];return new Bo(t,l,r.elevation,Ws.Mesh,s,i)}function LCt(t,e,i,r,n,s,o,l,c,f,_,x,T){const A=i.length/3;let M=0,I=2*r.count;DCt(t,e,r.index,r.count,i,0,A,n,s,o,l,c,f,I,_,x,T);let L=2*r.count;I=0,I1e(n,s,l,o,M,r.pathLengths[0],r.count,L,c,I,_),L+=4*r.pathLengths[0],I+=2*r.pathLengths[0],M+=r.pathLengths[0];for(let F=1;F0?1:-1;let z=3*i,k=0,U=3*k,j=r,H=3*j;for(let ne=0;ne0?(T=n,M=n+o):(T=n,x=n+o)),NCt(t,x,T,A,vR),kN(t,e,r,i,vR,I,x),kN(t,e,r,i,vR,L,T),kN(t,e,r,i,vR,F,A),kN(t,e,r,i,vR,z,M),c[f++]=I,c[f++]=F,c[f++]=z,c[f++]=I,c[f++]=z,c[f++]=L,x++,T++,A++,M++,I+=2,L+=2,F+=2,z+=2}const NW=W(),$1e=W(),L1e=W(),D1e=W(),N1e=W();function NCt(t,e,i,r,n){e*=3,i*=3,r*=3,Ie(NW,t[e++],t[e++],t[e++]),Ie($1e,t[i++],t[i++],t[i++]),Ie(L1e,t[r++],t[r++],t[r++]),je(D1e,$1e,NW),je(N1e,L1e,NW),Wt(n,N1e,D1e),Ye(n,n)}const vC=W();function FCt(t,e,i,r,n,s){const o=t.stageObject,l=o.geometries,c=l.length,f=e.mode!=="absolute-height";let _=0;const x=o.transformation,T=sP(Qe(),x);for(let A=0;A=Y||Math.abs(vC[1]-I[k+1])>=Y||Math.abs(vC[2]-I[k+2])>=Y)&&(U=!0),F.offset+=3,k+=3}U&&(M.invalidateBoundingInfo(),o.geometryVertexAttributeUpdated(l[A],J.POSITION),l[A+1].invalidateBoundingInfo(),o.geometryVertexAttributeUpdated(l[A+1],J.POSITION)),_+=j/z}return _/c}const lh=W(),bu=W(),zN=new r6,F1e=[0,2,1],k1e=[0,1,2],kCt=.01;var jd;(function(t){t[t.Main=0]="Main",t[t.Bottom=1]="Bottom"})(jd||(jd={}));let zCt=class{constructor(e,i,r,n){this.positions=e,this.elevation=i,this.normals=r,this.heights=n}};function UCt(t){return typeof t=="function"}function Uli(t,e,i,r){return UCt(t)?t(e,i,r):t}function Vli(t){return[t.r,t.g,t.b,t.a]}const VCt=` /-, -`;function z1e(t){let e=t.length;for(;e--;)if(!VCt.includes(t.charAt(e)))return!1;return!0}function BCt(t,e){const i=[];let r=0,n=-1;do if(n=t.indexOf("[",r),n>=r){if(n>r){const s=t.substr(r,n-r);i.push([s,null,z1e(s)])}if(r=n+1,n=t.indexOf("]",r),n>=r){if(n>r){const s=e[t.substr(r,n-r)];s&&i.push([null,s,!1])}r=n+1}}while(n!==-1);if(rjCt(n,r,i)}function GCt(t,e){switch(typeof t!="string"&&(t=String(t)),e){case"LowerCase":return t.toLowerCase();case"Allcaps":return t.toUpperCase();default:return t}}function jli(t,e,i,r,n,s,o=!0){const l=e/n,c=i/s,f=Math.ceil(l/2),_=Math.ceil(c/2);for(let x=0;x=-1&&ce<=1&&(M=2*ce*ce*ce-3*ce*ce+1,M>0&&(he=4*(re+H*e),U+=M*t[he+3],L+=M,t[he+3]<255&&(M=M*t[he+3]/250),F+=M*t[he],z+=M*t[he+1],k+=M*t[he+2],I+=M))}}r[A]=F/I,r[A+1]=z/I,r[A+2]=k/I,r[A+3]=U/L}}function KNe(t){return t?{r:t[0],g:t[1],b:t[2],a:t[3]/255}:{r:0,g:0,b:0,a:0}}function QNe(t){var e;return((e=t.data)==null?void 0:e.symbol)??null}function mie(t){return t.type==="CIMVectorMarker"||t.type==="CIMPictureMarker"||t.type==="CIMBarChartMarker"||t.type==="CIMCharacterMarker"||t.type==="CIMPieChartMarker"||t.type==="CIMStackedBarChartMarker"}function gie(t){return t.type==="CIMGradientStroke"||t.type==="CIMPictureStroke"||t.type==="CIMSolidStroke"}function HCt(t){return t!=null&&(t.type==="CIMGradientFill"||t.type==="CIMHatchFill"||t.type==="CIMPictureFill"||t.type==="CIMSolidFill"||t.type==="CIMWaterFill")}function JU(t){return t!=null&&(t.type==="CIMMarkerPlacementAlongLineRandomSize"||t.type==="CIMMarkerPlacementAlongLineSameSize"||t.type==="CIMMarkerPlacementAlongLineVariableSize"||t.type==="CIMMarkerPlacementAtExtremities"||t.type==="CIMMarkerPlacementAtMeasuredUnits"||t.type==="CIMMarkerPlacementAtRatioPositions"||t.type==="CIMMarkerPlacementOnLine"||t.type==="CIMMarkerPlacementOnVertices")}const Gli=(t,e=0)=>t==null||isNaN(t)?e:t,Hli=t=>t.tintColor?KNe(t.tintColor):{r:255,g:255,b:255,a:1},qli=t=>{if(!t)return!1;for(const e of t)switch(e.type){case"CIMGeometricEffectBuffer":case"CIMGeometricEffectOffset":case"CIMGeometricEffectDonut":return!0}return!1};function Wli(){return we(()=>import("./geometryEngineJSON-FxYgI0L3.js").then(t=>t.g),__vite__mapDeps([131,93]))}function Yli(t){if(!t)return"normal";switch(t.toLowerCase()){case"italic":return"italic";case"oblique":return"oblique";default:return"normal"}}function Xli(t){if(!t)return"normal";switch(t.toLowerCase()){case"bold":return"bold";case"bolder":return"bolder";case"lighter":return"lighter";default:return"normal"}}function Zli(t){let e="normal",i="normal";if(t){const r=t.toLowerCase();r.includes("italic")?e="italic":r.includes("oblique")&&(e="oblique"),r.includes("bold")?i="bold":r.includes("light")&&(i="lighter")}return{style:e,weight:i}}function Jli(t){return t.underline?"underline":t.strikethrough?"line-through":"none"}function U1e(t){if(!t)return null;switch(t.type){case"CIMPolygonSymbol":if(t.symbolLayers)for(const e of t.symbolLayers){const i=U1e(e);if(i!=null)return i}break;case"CIMTextSymbol":return U1e(t.symbol);case"CIMSolidFill":return t.color}}function V1e(t){if(t)switch(t.type){case"CIMPolygonSymbol":case"CIMLineSymbol":{const e=t.symbolLayers;if(e)for(const i of e){const r=V1e(i);if(r!=null)return r}break}case"CIMTextSymbol":return V1e(t.symbol);case"CIMSolidStroke":return t.color}}function B1e(t){if(t)switch(t.type){case"CIMPolygonSymbol":case"CIMLineSymbol":if(t.symbolLayers)for(const e of t.symbolLayers){const i=B1e(e);if(i!==void 0)return i}break;case"CIMTextSymbol":return B1e(t.symbol);case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return t.width}}function Kli(t){switch(t){case"Left":default:return"left";case"Right":return"right";case"Center":case"Justify":return"center"}}function Qli(t){switch(t){case"Top":default:return"top";case"Center":return"middle";case"Baseline":return"baseline";case"Bottom":return"bottom"}}function eci(t){return(t?Object.keys(t):[]).map(e=>({name:e,alias:e,type:typeof t[e]=="string"?"esriFieldTypeString":"esriFieldTypeDouble"}))}const tci=t=>t.includes("data:image/svg+xml");function ici(t){if(!t)return null;switch(t.type){case"CIMPointSymbol":case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function e8e(t,e,i,r){if(t)if(t.type!=="CIMTextSymbol"){if(i&&t.effects)for(const n of t.effects)YCt(n,e);if(t.symbolLayers)for(const n of t.symbolLayers)switch(n.type){case"CIMPictureMarker":case"CIMVectorMarker":qCt(n,e,r);break;case"CIMPictureStroke":case"CIMSolidStroke":!(r!=null&&r.preserveOutlineWidth)&&n.width&&(n.width*=e);break;case"CIMPictureFill":n.height&&(n.height*=e),n.offsetX&&(n.offsetX*=e),n.offsetY&&(n.offsetY*=e);break;case"CIMHatchFill":e8e(n.lineSymbol,e,!0,{...r,preserveOutlineWidth:!1}),n.offsetX&&(n.offsetX*=e),n.offsetY&&(n.offsetY*=e),n.separation&&(n.separation*=e)}}else t.height!=null&&(t.height*=e)}function qCt(t,e,i){if(t&&(t.markerPlacement&&WCt(t.markerPlacement,e),t.offsetX&&(t.offsetX*=e),t.offsetY&&(t.offsetY*=e),t.anchorPoint&&t.anchorPointUnits==="Absolute"&&(t.anchorPoint={x:t.anchorPoint.x*e,y:t.anchorPoint.y*e}),t.size=t.size!=null?t.size*e:0,t.type==="CIMVectorMarker"&&t.markerGraphics))for(const r of t.markerGraphics)t.scaleSymbolsProportionally||e8e(r.symbol,e,!0,i)}function WCt(t,e){switch(JU(t)&&t.offset&&(t.offset*=e),t.type){case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAlongLineSameSize":if(t.customEndingOffset&&(t.customEndingOffset*=e),t.offsetAlongLine&&(t.offsetAlongLine*=e),t.placementTemplate&&t.placementTemplate.length){const i=t.placementTemplate.map(r=>r*e);t.placementTemplate=i}break;case"CIMMarkerPlacementAlongLineVariableSize":if(t.maxRandomOffset&&(t.maxRandomOffset*=e),t.placementTemplate&&t.placementTemplate.length){const i=t.placementTemplate.map(r=>r*e);t.placementTemplate=i}break;case"CIMMarkerPlacementOnLine":t.startPointOffset&&(t.startPointOffset*=e);break;case"CIMMarkerPlacementAtExtremities":t.offsetAlongLine&&(t.offsetAlongLine*=e);break;case"CIMMarkerPlacementAtMeasuredUnits":case"CIMMarkerPlacementOnVertices":break;case"CIMMarkerPlacementAtRatioPositions":t.beginPosition&&(t.beginPosition*=e),t.endPosition&&(t.endPosition*=e);break;case"CIMMarkerPlacementPolygonCenter":t.offsetX&&(t.offsetX*=e),t.offsetY&&(t.offsetY*=e);break;case"CIMMarkerPlacementInsidePolygon":t.offsetX&&(t.offsetX*=e),t.offsetY&&(t.offsetY*=e),t.stepX&&(t.stepX*=e),t.stepY&&(t.stepY*=e)}}function YCt(t,e){switch(t.type){case"CIMGeometricEffectArrow":case"CIMGeometricEffectDonut":t.width&&(t.width*=e);break;case"CIMGeometricEffectBuffer":t.size&&(t.size*=e);break;case"CIMGeometricEffectCut":t.beginCut&&(t.beginCut*=e),t.endCut&&(t.endCut*=e),t.middleCut&&(t.middleCut*=e);break;case"CIMGeometricEffectDashes":if(t.customEndingOffset&&(t.customEndingOffset*=e),t.offsetAlongLine&&(t.offsetAlongLine*=e),t.dashTemplate&&t.dashTemplate.length){const i=t.dashTemplate.map(r=>r*e);t.dashTemplate=i}break;case"CIMGeometricEffectExtension":case"CIMGeometricEffectJog":case"CIMGeometricEffectRadial":t.length&&(t.length*=e);break;case"CIMGeometricEffectMove":t.offsetX&&(t.offsetX*=e),t.offsetY&&(t.offsetY*=e);break;case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":t.offset&&(t.offset*=e);break;case"CIMGeometricEffectRegularPolygon":t.radius&&(t.radius*=e);break;case"CIMGeometricEffectTaperedPolygon":t.fromWidth&&(t.fromWidth*=e),t.length&&(t.length*=e),t.toWidth&&(t.toWidth*=e);break;case"CIMGeometricEffectWave":t.amplitude&&(t.amplitude*=e),t.period&&(t.period*=e)}}function t8e(t){const e=[];return yie(QNe(t),e),e.length?new qe(KNe(e[0])):null}function yie(t,e){var n;if(!t)return;let i;i=t.type==="CIMTextSymbol"?t.symbol:t;const r=t.type==="CIMPolygonSymbol";if(i!=null&&i.symbolLayers){for(const s of i.symbolLayers)if(!(s.colorLocked||r&&(gie(s)||mie(s)&&s.markerPlacement&&JU(s.markerPlacement))))switch(s.type){case"CIMPictureMarker":case"CIMPictureStroke":case"CIMPictureFill":s.tintColor&&j1e(e,s.tintColor);break;case"CIMVectorMarker":(n=s.markerGraphics)==null||n.forEach(o=>{yie(o.symbol,e)});break;case"CIMSolidStroke":case"CIMSolidFill":j1e(e,s.color);break;case"CIMHatchFill":yie(s.lineSymbol,e)}}}function j1e(t,e){for(const i of t)if(i.join(".")===e.join("."))return;t.push(e)}function i8e(t,e,i){e instanceof qe||(e=new qe(e));const r=QNe(t);r&&vie(r,e,i)}function vie(t,e,i){var s;if(!t)return;let r;r=t.type==="CIMTextSymbol"?t.symbol:t;const n=(r==null?void 0:r.type)==="CIMPolygonSymbol";if(r!=null&&r.symbolLayers)for(const o of r.symbolLayers){if(o.colorLocked)continue;if(n){if(i){const{layersToColor:c}=i;if((gie(o)||mie(o)&&o.markerPlacement&&JU(o.markerPlacement))&&c==="fill"||HCt(o)&&c==="outline")continue}else if(gie(o)||mie(o)&&o.markerPlacement&&JU(o.markerPlacement))continue}const l=e.toArray();switch(o.type){case"CIMPictureMarker":case"CIMPictureStroke":case"CIMPictureFill":o.tintColor=l;break;case"CIMVectorMarker":(s=o.markerGraphics)==null||s.forEach(c=>{vie(c.symbol,e,i)});break;case"CIMSolidStroke":case"CIMSolidFill":o.color=l;break;case"CIMHatchFill":vie(o.lineSymbol,e,i)}}}const r8e="picture-fill",n8e="simple-fill",XCt="simple-line",s8e="simple-marker",ZCt="text",JCt="cim",FW=new qB(1e3);function KCt(t){const e=t.style;let i=null;if(t)switch(t.type){case s8e:e!=="cross"&&e!=="x"&&(i=t.color);break;case n8e:e==="solid"?i=t.color:e!=="none"&&(i={type:"pattern",x:0,y:0,src:Wr(`esri/symbols/patterns/${e}.png`),width:5,height:5});break;case r8e:i={type:"pattern",src:t.url,width:Tr(t.width)*t.xscale,height:Tr(t.height)*t.yscale,x:Tr(t.xoffset),y:Tr(t.yoffset)};break;case ZCt:i=t.color;break;case JCt:i=t8e(t)}return i}function QCt(t,e){const i=t+"-"+e;return FW.get(i)!==void 0?Promise.resolve(FW.get(i)):bi(t,{responseType:"image"}).then(r=>{const n=r.data,s=n.naturalWidth,o=n.naturalHeight,l=document.createElement("canvas");l.width=s,l.height=o;const c=l.getContext("2d");c.fillStyle=e,c.fillRect(0,0,s,o),c.globalCompositeOperation="destination-in",c.drawImage(n,0,0);const f=l.toDataURL();return FW.put(i,f),f})}function HL(t){if(!t)return null;let e=null;switch(t.type){case n8e:case r8e:case s8e:e=HL(t.outline);break;case XCt:{const i=Tr(t.width);t.style!=null&&t.style!=="none"&&i!==0&&(e={color:t.color,style:nce(t.style),width:i,cap:t.cap,join:t.join==="miter"?Tr(t.miterLimit):t.join});break}default:e=null}return e}const nce=(()=>{const t={};return e=>{if(t[e])return t[e];const i=e.replaceAll("-","");return t[e]=i,i}})(),eAt=new qe([128,128,128]),tAt=new qe("white");function iAt(t){var i,r;const e=(i=t.symbolLayers)==null?void 0:i.at(-1);if(e&&"outline"in e)return(r=e==null?void 0:e.outline)==null?void 0:r.size}function rAt(t){var e;if(!t)return 0;if(Hy(t)){const i=iAt(t);return i??0}return ad((e=HL(t))==null?void 0:e.width)}function fG(t){if(t==null||!("symbolLayers"in t)||t.symbolLayers==null)return!1;switch(t.type){case"point-3d":return t.symbolLayers.some(e=>e.type==="object");case"line-3d":return t.symbolLayers.some(e=>e.type==="path");case"polygon-3d":return t.symbolLayers.some(e=>e.type==="object"||e.type==="extrude");default:return!1}}function o8e(t){var e;return((e=t.resource)==null?void 0:e.href)??""}function _C(t,e){if(!t)return null;let i=null;return Hy(t)?i=nAt(t):VB(t)&&(i=t.type==="cim"?t8e(t):t.color?new qe(t.color):null),i?qL(i,e):null}function nAt(t){const e=t.symbolLayers;if(!e)return null;let i=null;return e.forEach(r=>{var n;r.type==="object"&&((n=r.resource)!=null&&n.href)||(i=r.type==="water"?r.color:r.material?r.material.color:null)}),i?new qe(i):null}function qL(t,e){if(e==null||t==null)return t;const i=t.toRgba();return i[3]=i[3]*e,new qe(i)}function sAt(t,e,i){const r=t.symbolLayers;if(!r)return;const n=s=>qL(e=e??s??(i!=null?tAt:null),i);r.forEach(s=>{var o,l;if(s.type!=="object"||!((o=s.resource)!=null&&o.href)||e)if(s.type==="water")s.color=n(s.color);else{const c=s.material!=null?s.material.color:null,f=n(c);s.material==null?s.material=new mp({color:f}):s.material.color=f,i!=null&&"outline"in s&&((l=s.outline)==null?void 0:l.color)!=null&&(s.outline.color=qL(s.outline.color,i))}})}function oAt(t,e,i){var r;(e=e??t.color)&&(t.color=qL(e,i)),i!=null&&"outline"in t&&((r=t.outline)!=null&&r.color)&&(t.outline.color=qL(t.outline.color,i))}function kW(t,e,i){t&&(e||i!=null)&&(e&&(e=new qe(e)),Hy(t)?sAt(t,e,i):VB(t)&&oAt(t,e,i))}async function aAt(t,e){const i=t.symbolLayers;i&&await JV(i,async r=>lAt(r,e))}async function lAt(t,e){switch(t.type){case"extrude":uAt(t,e);break;case"icon":case"line":case"text":cAt(t,e);break;case"path":dAt(t,e);break;case"object":await hAt(t,e)}}function cAt(t,e){const i=a8e(e);i!=null&&(t.size=i)}function a8e(t){for(const e of t)if(typeof e=="number")return e;return null}function uAt(t,e){t.size=typeof e[2]=="number"?e[2]:0}async function hAt(t,e){const{resourceSize:i,symbolSize:r}=await pAt(t),n=l8e(e,i,r);t.width=M$(e[0],r[0],i[0],n),t.depth=M$(e[1],r[1],i[1],n),t.height=M$(e[2],r[2],i[2],n)}function dAt(t,e){const i=l8e(e,Bv,[t.width,void 0,t.height]);t.width=M$(e[0],t.width,1,i),t.height=M$(e[2],t.height,1,i)}function l8e(t,e,i){for(let r=0;r<3;r++){const n=t[r];switch(n){case"symbol-value":{const s=i[r];return s!=null?s/e[r]:1}case"proportional":break;default:if(n&&e[r])return n/e[r]}}return 1}async function pAt(t){const{computeObjectLayerResourceSize:e}=await we(()=>import("./symbolLayerUtils-VVngrYnW.js"),__vite__mapDeps([])),i=await e(t,10),{width:r,height:n,depth:s}=t,o=[r,s,n];let l=1;for(let c=0;c<3;c++){const f=o[c];if(f!=null){l=f/i[c];break}}for(let c=0;c<3;c++)o[c]==null&&(o[c]=i[c]*l);return{resourceSize:i,symbolSize:o}}function M$(t,e,i,r){switch(t){case"proportional":return i*r;case"symbol-value":return e??i;default:return t}}function fAt(t,e){const i=a8e(e);if(i!=null)switch(t.type){case"simple-marker":t.size=i;break;case"picture-marker":{const r=t.width/t.height;r>1?(t.width=i,t.height=i*r):(t.width=i*r,t.height=i);break}case"simple-line":t.width=i;break;case"text":t.font.size=i}}async function mAt(t,e){if(t&&e)return Hy(t)?aAt(t,e):void(VB(t)&&fAt(t,e))}function gAt(t,e,i){if(t&&e!=null)if(Hy(t)){const r=t.symbolLayers;r&&r.forEach(n=>{if(n&&n.type==="object")switch(i){case"tilt":n.tilt=e;break;case"roll":n.roll=e;break;default:n.heading=e}})}else VB(t)&&(t.type!=="simple-marker"&&t.type!=="picture-marker"&&t.type!=="text"||(t.angle=e))}function WL(t){if(!t)return null;const e=t.effects.filter(i=>i.type!=="bloom").map(i=>i.toJSON());return Uz(e)}function rci(t){return t!=null&&t.type==="polygon-3d"&&t.symbolLayers.some(e=>e.type==="extrude")}async function yAt(t,e){return await t.fetchSymbol(e)||t.fetchCIMSymbol(e)}function vAt(t,e,i,r,n){if(t==null)return null;const s=t.referencesGeometry()&&n?_At(e,r,n):e,o=t.repurposeFeature(s);try{return t.evaluate({...i,$feature:o},t.services)}catch(l){return Ce.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",l),null}}const zW=new Map;function _At(t,e,i){const{transform:r,hasZ:n,hasM:s}=i;zW.has(e)||zW.set(e,bAt(e));const o=zW.get(e)(t.geometry,r,n,s);return{...t,geometry:o}}function bAt(t){const e={};switch(t){case"esriGeometryPoint":return(i,r,n,s)=>UDe(r,e,i,n,s);case"esriGeometryPolygon":return(i,r,n,s)=>VDe(r,e,i,n,s);case"esriGeometryPolyline":return(i,r,n,s)=>BDe(r,e,i,n,s);case"esriGeometryMultipoint":return(i,r,n,s)=>zDe(r,e,i,n,s);default:return Ce.getLogger("esri.views.2d.support.arcadeOnDemand").error(new se("mapview-arcade",`Unable to handle geometryType: ${t}`)),i=>i}}const nci=1.2,wAt=gp,xAt=4;let mG=class{constructor(e,i,r,n){this.graphics3DSymbolLayer=e,this.renderGeometries=i,this.boundingBox=r,this._drapeSourceRenderer=n,this.type="draped",this.stage=null,this._visible=!1,this._addedToStage=!1,this.isElevationSource=!1}initialize(e){this.stage=e.stage}setVisibility(e){if(this.stage!=null&&this._visible!==e){if(this._visible=e,e&&!this._addedToStage)return this._addedToStage=!0,void this._drapeSourceRenderer.addGeometries(this.renderGeometries,ds.ADD);if(e||this._addedToStage){for(const i of this.renderGeometries)i.visible=this._visible;this._drapeSourceRenderer.modifyGeometries(this.renderGeometries,ca.VISIBILITY)}}}destroy(){this.stage&&this._addedToStage&&this._drapeSourceRenderer.removeGeometries(this.renderGeometries,ds.REMOVE),this._addedToStage=!1,this._visible=!1,this.stage=null}getCenterObjectSpace(e=W()){return Ie(e,0,0,0)}getBoundingBoxObjectSpace(e=ya()){return Bn(e)}addObjectState(e,i){e===S_.Highlight&&(this.renderGeometries.forEach(r=>{const n=r.geometry.addHighlight();i.addRenderGeometry(r,n,this)}),this._addedToStage&&this._drapeSourceRenderer.modifyGeometries(this.renderGeometries,ca.HIGHLIGHT))}removeObjectState(e){this.renderGeometries.forEach(i=>{e.removeRenderGeometry(i)})}removeRenderGeometryObjectState(e,i){e.geometry.removeHighlight(i),this._addedToStage&&this._drapeSourceRenderer.modifyGeometries(this.renderGeometries,ca.HIGHLIGHT)}computeAttachmentOrigin(e){for(const i of this.renderGeometries)i.geometry.computeAttachmentOrigin(bC)&&(e.draped.origin[0]+=bC[0],e.draped.origin[1]+=bC[1],e.draped.num++)}async getProjectedBoundingBox(e,i,r,n,s){Bn(s);for(let o=0;o{let t="";for(let e=32;e<127;e++)t+=String.fromCharCode(e);return t})(),QU=1;let u8e=class{constructor(e,i,r,n){this.text=e,this._alignment=i,this._parameters=r,this._maxSize=n,this._textWidths=[],this._lineWidths=[],this._renderPixelRatio=null,this._metricsCached=null,this.key=`TextRenderer-${this._parameters.key}-${this._alignment}--${e}`,this._lines=e.replaceAll(" "," ").split(/\r?\n/)}get displayWidth(){return Math.ceil(this._displayWidth+2*this._horizontalPadding)}get displayHeight(){let e=this._metrics.firstLineAscent;for(let i=0;i{const M=e.measureText(T),I=M.width,L=I+i;this._textWidths.push(I),this._lineWidths.push(L),o=Math.max(o,L),l=Math.max(l,M.actualBoundingBoxAscent),c=Math.max(c,M.actualBoundingBoxDescent),A===0&&(n=M),A===this._lines.length-1&&(s=M)});const f=c8e(this._parameters);l=Math.max(l,f.maxAscent),c=Math.max(c,f.maxDescent);const _=n.actualBoundingBoxAscent,x=this._parameters.definition.font.decoration==="underline"?c:s.actualBoundingBoxDescent;this._metricsCached=new AAt(_,x,l,c,o)}return this._metricsCached}get _lineSpacing(){return(this._midLineHeight+this._linePadding)*this._parameters.definition.lineSpacingFactor}get _midLineHeight(){return this._metrics.midLineHeight}get _linePadding(){return this._midLineHeight*CAt}get _midLineAscent(){return this._metrics.maxLineAscent}get _renderedFontSize(){return this._toRenderUnit(this._fontSize)}get _fontSize(){return this._parameters.definition.size}get _renderedHaloSize(){return this._toRenderUnit(this._haloSize)}get _haloSize(){return this._parameters.haloSize}get _horizontalPadding(){return this._hasBackground?this._parameters.definition.background.padding[0]:0}get _verticalPadding(){return Math.max(this._hasBackground?this._parameters.definition.background.padding[1]:0,QU)}get _hasBackground(){return!!this._parameters.backgroundStyle}get renderPixelRatio(){if(this._renderPixelRatio==null){const e=this._parameters.definition.pixelRatio;this._renderPixelRatio=Math.min(e,Math.min(this._maxSize[0]/this.displayWidth,this._maxSize[1]/this.displayHeight))}return this._renderPixelRatio}_getLineXOffset(e){switch(this._alignment){case w2.Left:return this._horizontalPadding;case w2.Center:return(this.displayWidth-this._lineWidths[e])/2;case w2.Right:return this.displayWidth-this._horizontalPadding-this._lineWidths[e]}}render(e,i,r){e.save();const n=i/=this.renderPixelRatio,s=r/=this.renderPixelRatio,o=this._haloSize,l=this._firstLineYOffset+this._metrics.firstLineAscent;i+=o,r+=l;const c=this._haloSize>0;c&&this._renderHalo(e,n,s,o,l),this._parameters.setFontProperties(e,this._renderedFontSize);for(let f=0;fCEt(i));this._textureHandle=s,e.textureId=s.texture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=EEt(i),e.distanceFieldBoundingBox=DAt;const n=this._getIconSize();this._size=[n,n],this._symbolTextureRatio=1/eT,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,i,r){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const n=this._getIconSize(),s=n*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(this._context.sharedResources.textures!=null){const o=await Ju(this._context.sharedResources.textures.fromUrl(i,s,{signal:r}));if(o.ok===!1)throw zo(o.error),new se("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${i})`);this._textureHandle=o.value;const l=o.value.texture,c=l.parameters.width/l.parameters.height;this._size=c>1?[n,Math.round(n/c)]:[Math.round(n*c),n],e.textureId=l.id}this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,i,r){const n=new nx({data:i});if(!this._context.sharedResources.cimSymbolRasterizer){const _=(await we(()=>import("./CIMSymbolRasterizer-o8gx_uXl.js"),__vite__mapDeps([230,231,142,121,122,145,155,206]))).CIMSymbolRasterizer;St(r),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new _(this._context.renderCoordsHelper.spatialReference,!0))}const s=this._context.layer.fields?this._context.layer.fields.map(_=>_.toJSON()):null;let o,l;if(this._cimLayers=await this._context.sharedResources.cimSymbolRasterizer.analyzeCIMSymbol3D(n,s,this._context.renderer&&this._context.renderer.type==="dictionary"?this._context.renderer.fieldMap:null,"esriGeometryPoint",{signal:r}),this._context.renderer&&this._context.renderer.type==="dictionary"&&this._context.renderer.scaleExpression){const _=this._context.renderer;if(isNaN(_.scaleExpression)){const x=_.scaleExpression,T=await rit(x,this._context.layer.spatialReference,s);l=(A,M,I)=>{const L=vAt(T,A,{$view:I},"esriGeometryPoint",M);return L!==null?L:1}}else o=Number(_.scaleExpression)}this._cimScaleFactorOrFunction=o||l||1;const c=this._context.renderer?await this._context.renderer.getRequiredFields(this._context.layer.fieldsIndex):[];St(r);const f=this._context.layer.fieldsIndex;this._cimRequiredFields=c.map(_=>f.get(_).name),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return this.symbolLayer.resource&&this.symbolLayer.resource.href?null:this.symbolLayer.resource&&this.symbolLayer.resource.primitive||iOe}_getOutlineSize(){var r;let e=0;const i=this.symbolLayer;return((r=i.outline)==null?void 0:r.size)!=null?Math.max(Tr(i.outline.size),0):(e=UW(this._getPrimitive())?LAt:0,Math.max(e,0))}_getOutlineColor(){var n;const e=this._getLayerOpacity(),i=this.symbolLayer,r=(n=i==null?void 0:i.outline)==null?void 0:n.color;if(r!=null){const s=qe.toUnitRGB(r),o=r.a*e;return[s[0],s[1],s[2],o]}return[0,0,0,0]}_getFillColor(){var r,n;if(UW(this._getPrimitive()))return wAt;const e=this._getPrimitive()==null,i=(n=(r=this.symbolLayer)==null?void 0:r.material)==null?void 0:n.color;return this._getCombinedOpacityAndColor(i,{hasIntrinsicColor:e})}_getAnchorPos(e,i){return e==="relative"?Ji((i.x||0)+.5,.5-(i.y||0)):e in nk?nk[e]:nk.center}_createMaterialAndAddToStage(e,i){if(this._cimLayers){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new O5(e),this._cimSymbolMaterials.set(e.textureId??0,r),i.add(r)),r}return this._fastUpdates=C5(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new O5(e),i.add(this._materials[0]),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,isDraped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._forEachMaterial(e=>this._context.stage.remove(e)),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.remove(e)),this._cimSymbolTextures.clear(),this._textureHandle=ir(this._textureHandle)}_getScaleFactor(e,i){if(this._drivenProperties.size&&e.size){for(let r=0;r<3;r++){const n=e.size[r];n&&n!=="symbol-value"&&n!=="proportional"&&(e.size[r]=Tr(n))}if(e.size[0]==="symbol-value")return 1;if(isFinite(+e.size[0]))return+e.size[0]/i;if(isFinite(+e.size[2]))return+e.size[2]/i}return 1}createGraphics3DGraphic(e){var x;const i=e.graphic;if(!this._validateGeometry(i.geometry))return null;let r,n=[0,0];if(this._cimLayers){if(!this._cimLayers.length)return null;const T=this._generateTextureCIM(i),A={textureId:T.id,...this._cimMaterialParametersInfo};r=this._createMaterialAndAddToStage(A,this._context.stage),n=[T.parameters.width,T.parameters.height]}else n=this._size,r=this._materials[0];const s=UL(i.geometry);if(s==null)return this.logger.warn(`unsupported geometry type for icon symbol: ${i.geometry.type}`),null;const o=e.renderingInfo,l=this._getVertexOpacityAndColor(o);let c=1;if(!((x=this._fastUpdates)!=null&&x.visualVariables.size)){const T=n[0]>n[1]?n[0]:n[1];c=this._getScaleFactor(o,T)}c*=this._symbolTextureRatio;const f=Ji(n[0]*c,n[1]*c),_=this.setGraphicElevationContext(i);return this.ensureDrapedStatus(_.mode==="on-the-ground")&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(i,s,r,l,f,e.layer.uid):this._createAs3DShape(i,s,r,l,f,_,i.uid)}layerOpacityChanged(){const e=this._getFillColor(),i=this._getOutlineColor();this._forEachMaterial(r=>{r.setParameters({color:e}),r.setParameters({outlineColor:i})})}layerElevationInfoChanged(e,i,r){const n=this._elevationContext.mode,s=i6(p8e.elevationModeChangeTypes,r,n);if(s!==Ys.UPDATE)return s;const o=t0(n)||n==="absolute-height";return this.updateGraphics3DGraphicElevationInfo(e,i,()=>o)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return this._getPrimitive()!=null}applyRendererDiff(e,i){var r;for(const n in e.diff){if(n!=="visualVariables"||!A5(this._fastUpdates,i,this._fastVisualVariableConvertOptions()))return To.RecreateSymbol;(r=this._materials[0])==null||r.setParameters(this._fastUpdates.materialParameters)}return To.FastUpdate}_defaultElevationInfoNoZ(){return kAt}_createAs3DShape(e,i,r,n,s,o,l){const c=this.getFastUpdateAttrValues(e),f=this._context.layer.uid,_=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerUid:f}),x=Rte(r,X1e,null,n,s,zAt,null,c,_),T=$le(this._context,i,x,o,l);if(T==null)return null;const A=new d1(this,T.object,[x],null,null,_T,o);return A.alignedSampledElevation=T.sampledElevation,A.needsElevationUpdates=t0(o.mode)||o.mode==="absolute-height",A.getScreenSize=this._createScreenSizeGetter(s,c),A.calculateRelativeScreenBounds=M=>r.calculateRelativeScreenBounds(A.getScreenSize(),1,M),zL(A,i,this._context.elevationProvider),A}_createAsOverlay(e,i,r,n,s,o){r.renderPriority=this._renderPriority;const l=Xi();ud(i,l,this._context.overlaySR),l[2]=tce;const c=this._context.clippingExtent;if(c!=null&&!$se(c,l))return null;const f=this.getFastUpdateAttrValues(e),_=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:e.uid,layerUid:this._context.layer.uid}),x=Rte(r,X1e,l,n,s,null,null,f,_),T=new $5(x,{layerUid:o,graphicUid:e.uid}),A=new mG(this,[T],null,this._context.drapeSourceRenderer);return A.getScreenSize=this._createScreenSizeGetter(s,f),A.calculateRelativeScreenBounds=M=>r.calculateRelativeScreenBounds(A.getScreenSize(),1,M),A}_createScreenSizeGetter(e,i){const r=this._outlineSize+2;if(this._fastUpdates&&i){const o=e[0]/this._symbolTextureRatio,l=e[1]/this._symbolTextureRatio;return(c=yt())=>{const[f,_]=dle(UAt,this._fastUpdates.materialParameters,i);return c[0]=f*o+r,c[1]=_*l+r,c}}const n=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(o=yt())=>(o[0]=n,o[1]=s,o)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),i=nt(e,e,e),r=ad(1),n=e*r,s=nt(n,n,n);return new K9({size:!0,color:!0,rotation:!0,opacity:!1},i,s,r)}_getGraphicHash(e){let i="";for(const r of this._cimRequiredFields)i+=r+e.attributes[r];return i}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}};function FAt(t){return t&&t.type==="point-3d"&&t.hasVisibleVerticalOffset()}function UW(t){return t!=null&&(t==="cross"||t==="x")}_ie.PRIMITIVE_SIZE=NAt,_ie.elevationModeChangeTypes={definedChanged:Ys.UPDATE,staysOnTheGround:Ys.NONE,onTheGroundChanged:Ys.RECREATE};const kAt={mode:"relative-to-ground",offset:0},zAt=Mi(0,0,0,1),UAt=W();function bie(t){switch(t){case"butt":return Df.BUTT;case"square":return Df.SQUARE;case"round":return Df.ROUND;default:return null}}function Z1e(t){return t==="diamond"?"kite":t}function wie(t,e,i=null){const r=[],n=e.mapPositions;VAt(e,r);const s=r[0][1].data,o=r[0][1].indices.length,l=ux(o);return BAt(e,r,l),HAt(e,r,l),jAt(e,r,l),GAt(e,r,l),qAt(e,r,l),WAt(e,r,l),YAt(e,r,s),new Bo(t,r,n,Ws.Line,i)}function VAt(t,e){const{attributeData:{position:i},removeDuplicateStartEnd:r}=t,n=XAt(i)&&r,s=i.length/3-(n?1:0),o=new Array(2*(s-1)),l=n?i.slice(0,-3):i;let c=0;for(let f=0;f{const n=r.length,s=Ja(3*n);r.forEach((l,c)=>{s[3*c]=l[0],s[3*c+1]=l[1],s[3*c+2]=l[2]});const o={attributeData:{position:s,normal:e},removeDuplicateStartEnd:!1};i.push(o)}),i}function KAt(t,e,i,r){const n=t.type==="polygon"?Ky.CCW_IS_HOLE:Ky.NONE,s=t.type==="polygon"?t.rings:t.paths,{position:o,outlines:l}=c6(s,!!t.hasZ,n,t.spatialReference),c=Ja(o.length),f=A6e(o,t.spatialReference,0,c,0,o,0,o.length/3,e,i,r),_=f!=null;return{lines:_?f8e(l,o,c):[],projectionSuccess:_,sampledElevation:f}}function QAt(t,e){const i=t.type==="polygon"?Ky.CCW_IS_HOLE:Ky.NONE,r=t.type==="polygon"?t.rings:t.paths,{position:n,outlines:s}=c6(r,!1,i),o=vn(n,t.spatialReference,0,n,e,0,n.length/3);for(let l=2;ll.camera.nearFar),new gr("viewport",(o,l)=>l.camera.fullViewport)),n.code.add(V`vec4 projectAndScale(vec4 pos) { +}`),t}const SEt=Object.freeze(Object.defineProperty({__proto__:null,OverlayCompositingPassParameters:pce,build:BNe},Symbol.toStringTag,{value:"Module"}));let jNe=class GNe extends Hr{initializeProgram(e){return new $r(e.rctx,GNe.shader.get().build(),Cr)}initializePipeline(){return Ti({blending:md(ot.ONE,ot.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}};jNe.shader=new Ir(SEt,()=>we(()=>Promise.resolve().then(()=>dXt),void 0));let V0=class extends gx{get _bindParameters(){return this._renderContext.bindParameters}get _rctx(){return this.view._stage.renderView.renderingContext}get rctx(){return this._rctx}get materialRepository(){return this._materialRepository}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new pce,this.hasHighlights=!1,this._rendersOccluded=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new Pi,this._passParameters=new tce,this._materialRepository=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new si,this.worldToPCSRatio=1,this.events=new Dn,this.longitudeCyclical=null,this.produces=new Map([[ke.DRAPED_MATERIAL,i=>i!==ue.Highlight||this.hasHighlights],[ke.DRAPED_WATER,()=>!0]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this.view._stage.renderer.fboCache,i=this.view._stage.renderView,{waterTextureRepository:r,stippleTextureRepository:n,markerTextureRepository:s}=i;this._shaderTechniqueRepository=new rNe({rctx:this._rctx,viewingMode:_t.Local,stippleTextureRepository:n,markerTextureRepository:s,waterTextureRepository:r}),this._renderContext=new RNe(this._rctx,new lce(e,this.view.state.viewingMode),null),this.addHandles([_e(()=>r.updating,()=>this.events.emit("content-changed"),kt),_e(()=>this.spatialReference,o=>this._localOriginFactory=new ace(o),kt),Jr(()=>this.view.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0)]),this._materialRepository=new nNe(i.textureRepository,this._shaderTechniqueRepository,o=>{(o.parameters.renderOccluded&JU)>0!==this._rendersOccluded&&this._updateRendersOccluded(),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed")),this._bindParameters.slot=ke.DRAPED_MATERIAL,this._bindParameters.mainDepth=xgt(this._rctx),this._camera.near=1,this._camera.far=1e4,this._camera.relativeElevation=null,this._bindParameters.camera=this._camera,this._bindParameters.transparencyPassType=Jt.NONE,this._bindParameters.newLighting.noonFactor=0,this._bindParameters.newLighting.globalFactor=0,this._bindParameters.newLighting.set([new Vae(st(1,1,1))]),this.addHandles(this.view.resourceController.scheduler.registerTask(ni.STAGE,this))}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._debugTextureTechnique=ir(this._debugTextureTechnique),this._passParameters.texture=Kt(this._passParameters.texture),this._bindParameters.mainDepth=Kt(this._bindParameters.mainDepth),this._shaderTechniqueRepository=et(this._shaderTechniqueRepository),this.disposeOverlays()}initializeRenderContext(e){this.pluginContext=e}uninitializeRenderContext(){}renderNode(){}get updating(){return this._sortedDrapeSourceRenderersDirty||ap(this._renderers,e=>e.updating)}get hasOverlays(){return this._overlays!=null&&this._renderTargets!=null}getMemoryForMaterial(e){return Array.from(this._renderers.values()).reduce((i,r)=>i+r.getMemoryForMaterial(e),0)}createGeometryDrapeSourceRenderer(e){return this.createDrapeSourceRenderer(e,qd)}createDrapeSourceRenderer(e,i,r){const n=this._renderers.get(e);n!=null&&n.destroy();const s=new i({...r,rendererContext:this,drapeSource:e});return this._renderers.set(e,s),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(_e(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e),s}removeDrapeSourceRenderer(e){if(e==null)return;const i=this._renderers.get(e);i!=null&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),i.destroy())}computeValidity(){var e;return((e=this._renderTargets)==null?void 0:e.computeValidity())??0}releaseRenderTargets(){var e;(e=this._renderTargets)==null||e.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&x7(e,i=>i.drapeTargetType===yie.WithoutRasterImage)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=x7(e,i=>i.drapeSourceType===L$.Features),this._hasDrapedRasterSource=x7(e,i=>i.drapeSourceType===L$.RasterImage)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,i,r=this._bindParameters.overlayStretch){this._overlays==null&&(this._renderTargets=new _St(this.view._stage.renderer.fboCache),this._overlays=[new i1e,new i1e]),this.ensureDrapeTargets(e),this.ensureDrapeSources(i),this._bindParameters.overlayStretch=r}disposeOverlays(){this._overlays=null,this._renderTargets=Kt(this._renderTargets),this.events.emit("textures-disposed")}getTexture(e){var i,r;if(e!=null)return e===ns.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?(i=this._renderTargets)==null?void 0:i.getTexture(ns.Color):(r=this._renderTargets)==null?void 0:r.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_processDrapeSources(e,i){let r=!1;for(const[n,s]of this._renderers){if(e.done)break;(n.destroyed||i(n))&&s.commitChanges()&&(r=!0,e.madeProgress())}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,r=!0,this._updateSortedDrapeSourceRenderers()),r&&(this._overlays!=null&&this._renderers.size===0&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=ap(this._renderers,n=>n.hasHighlights),this._updateRendersOccluded(),this._updateHasWater())}processSyncDrapeSources(){this._processDrapeSources(cu,e=>e.updatePolicy===C2.SYNC)}get isEmpty(){return!En.OVERLAY_DRAW_DEBUG_TEXTURE&&!ap(this._renderers,e=>!e.isEmpty)}get hasWater(){return this._hasWater}get rendersOccluded(){return this._rendersOccluded}get mode(){var e,i;return this.isEmpty?Ty.Disabled:(e=this._renderTargets)!=null&&e.getTexture(ns.WaterNormal)?Ty.EnabledWithWater:(i=this._renderTargets)!=null&&i.getTexture(ns.Color)?Ty.Enabled:Ty.Disabled}updateAnimation(e){let i=!1;return this._renderers.forEach(r=>i=r.updateAnimation(e)||i),i}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}drawOverlays(e){if(this._overlays&&this._renderTargets){for(const i of this._overlays)this.longitudeCyclical?i.setupGeometryViewsCyclical(this.longitudeCyclical):i.setupGeometryViewsDirect();for(const i of this._renderTargets.targets)(i.content!==ns.ColorNoRasterImage||this._needsColorWithoutRasterImage)&&(this._drawTarget(zo.INNER,i,e),this._drawTarget(zo.OUTER,i,e))}}_drawTarget(e,i,r){const n=this._overlays[e],s=n.canvasGeometries;if(s.numViews===0)return;const{alignPixelEnabled:o,contentPixelRatio:a}=r;this._screenToWorldRatio=a*n.mapUnitsPerPixel/this._bindParameters.overlayStretch;const c=i.output;if(this.isEmpty||c===ue.Highlight&&!this.hasHighlights||c===ue.Normal&&!this.hasWater||!n.hasSomeSizedView())return;const p=this._rctx;this._camera.pixelRatio=n.pixelRatio*a,this._renderContext.output=c,this._bindParameters.alignPixelEnabled=o,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=c===ue.Normal?ke.DRAPED_WATER:ke.DRAPED_MATERIAL;const _=En.OVERLAY_DRAW_DEBUG_TEXTURE&&i.content!==ns.Occluded;if(!_&&!this._sortedRenderers.some(({renderer:P})=>P.shouldRender(this._renderContext)))return;const x=n.resolution;this._rctx.setViewport(e===zo.INNER?0:x,0,x,x);const S=2*n.resolution,C=n.resolution,M=i.fbo;if(M.bind(p,S,C),e===zo.INNER&&(p.setClearColor(0,0,0,0),p.clearSafe($n.COLOR_BUFFER_BIT)),i.content===ns.Occluded&&(this._renderContext.renderOccludedMask=JU),_)for(let P=0;P{if(i.content===ns.ColorNoRasterImage&&P.drapeSourceType===L$.RasterImage)return;const{fullOpacity:F}=P,z=F!=null&&F<1&&c===ue.Color?this.bindTemporaryFramebuffer(S,C):null;for(let k=0;k{const n=e.indexOf(r.layer),s=n>=0,o=this._renderers.size*(r.renderGroup??(s?HU.MapLayer:HU.ViewLayer))+(s?n:0);this._sortedRenderers.push(new TEt(r,i,o))}),this._sortedRenderers.sort((i,r)=>i.index-r.index)}_setViewParameters(e,i){const r=this._camera;r.viewport=[0,0,i.resolution,i.resolution],fCe(r.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],r.near,r.far),D9(r.viewMatrix,[-e[0],-e[1],0])}_updateHasWater(){const e=ap(this._renderers,i=>i.hasWater);e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_updateRendersOccluded(){const e=ap(this._renderers,i=>i.rendersOccluded);e!==this._rendersOccluded&&(this._rendersOccluded=e,this.events.emit("renders-occluded",e))}_ensureDebugPatternResources(e,i){if(Ie(this._passParameters.color,i[0],i[1],i[2]),this._passParameters.texture)return;const r=new Uint8Array(e*e*4);let n=0;for(let a=0;ae-20||10*_>e-20?(r[n++]=255,r[n++]=255,r[n++]=255,r[n++]=255):(r[n++]=255,r[n++]=255,r[n++]=255,r[n++]=1&p&&1&_?1&c^1&a?0:255:1&p^1&_?0:128)}const s=new rn(e);s.samplingMode=ki.NEAREST,this._passParameters.texture=new Ai(this._rctx,s,r);const o=new dce;o.hasAlpha=!0,this._debugTextureTechnique=this._shaderTechniqueRepository.acquire(hce,o)}get test(){return{drapedRenderers:Array.from(this._renderers.values()),getDrapeSourceRenderer:e=>this._renderers.get(e)}}};y([w()],V0.prototype,"hasHighlights",void 0),y([w()],V0.prototype,"_sortedDrapeSourceRenderersDirty",void 0),y([w({autoDestroy:!0})],V0.prototype,"_shaderTechniqueRepository",void 0),y([w({constructOnly:!0})],V0.prototype,"view",void 0),y([w()],V0.prototype,"worldToPCSRatio",void 0),y([w()],V0.prototype,"spatialReference",void 0),y([w({type:Boolean,readOnly:!0})],V0.prototype,"updating",null),y([w()],V0.prototype,"isEmpty",null),V0=y([Z("esri.views.3d.terrain.OverlayRenderer")],V0);let TEt=class{constructor(e,i,r){this.drapeSource=e,this.renderer=i,this.index=r}};const EEt=[[1,.5,.5],[.5,.5,1]],fce=-2,JU=Yn.OccludeAndTransparent;function mce(t,e,i,r){const n=f6(t.rings,!!t.hasZ,s1.CCW_IS_HOLE,t.spatialReference),s=Qa(n.position.length),o=S6e(n.position,t.spatialReference,0,s,0,n.position,0,n.position.length/3,e,i,r),a=o!=null;return new MEt(n.position,s,WNe(n.polygons,n.position,s),qNe(n.outlines,n.position,s),a,o)}function HNe(t,e){const i=f6(t.rings,!1,s1.CCW_IS_HOLE),r=un(i.position,t.spatialReference,0,i.position,e,0,i.position.length/3);for(let n=2;nr>1).map(({index:r,count:n})=>{const s=3*r,o=3*n;return i!=null?new YNe(r,n,zf(e,s,o),zf(i,s,o)):new gce(r,n,zf(e,s,o))})}function WNe(t,e,i=null){const r=new Array;for(const{index:n,count:s,holeIndices:o,pathLengths:a}of t){if(s<=1)continue;const c=3*n,p=3*s,_=o.map(S=>S-n),x=i!=null?new CEt(n,s,zf(e,3*n,3*s),zf(i,c,p),_,a):new AEt(n,s,zf(e,3*n,3*s),_,a);r.push(x)}return r}let gce=class{constructor(e,i,r){this.index=e,this.count=i,this.position=r}},YNe=class extends gce{constructor(e,i,r,n){super(e,i,r),this.mapPositions=n}},CEt=class extends YNe{constructor(e,i,r,n,s,o){super(e,i,r,n),this.holeIndices=s,this.pathLengths=o}},AEt=class extends gce{constructor(e,i,r,n,s){super(e,i,r),this.holeIndices=n,this.pathLengths=s}},MEt=class{constructor(e,i,r,n,s,o){this.position=e,this.mapPositions=i,this.polygons=r,this.outlines=n,this.projectionSuccess=s,this.sampledElevation=o}};function sE(t,e,i,r,n,s=2){const o=1/(Math.abs(i)+Math.abs(r)+Math.abs(n)),a=i*o,c=r*o,p=n<=0?(a>=0?1:-1)*(1-Math.abs(c)):a,_=n<=0?(c>=0?1:-1)*(1-Math.abs(a)):c,x=e*s;t[x]=P1e(p),t[x+1]=P1e(_)}function OEt(t){const e=t.length/3,i=new Int16Array(2*e);let r=0;for(let n=0;n=0?1:-1)*(1-Math.abs(o)),t[1]=(o>=0?1:-1)*(1-Math.abs(s))):(t[0]=s,t[1]=o),Ye(t,t)}function P1e(t){return Je(Math.round(32767*t),-32767,32767)}function R1e(t){return Je(t/32767,-1,1)}const REt=["polygon","extent"];let IEt=class extends w1{constructor(e,i,r,n){super(e,i,r,n),this.ensureDrapedStatus(!1)}async doLoad(){var a,c;if(!this._drivenProperties.size){const p=dG(this._getSymbolSize());if(p)throw new se("graphics3dextrudesymbollayer:invalid-size",p)}const e=(c=(a=this.symbolLayer)==null?void 0:a.material)==null?void 0:c.color,i=this._getCombinedOpacityAndColor(e),r=vc(i),n=i[3],s=n<1||this.needsDrivenTransparentPass,o={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:r,ambient:r,opacity:n,transparent:s,cullFace:s?Ln.None:Ln.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0,normalType:Br.Compressed};this._materials[Wd.Main]=new Vm(o),this._materials[Wd.Bottom]=new Vm({...o,cullFace:Ln.Back}),this._context.stage.addMany(this._materials)}destroy(){super.destroy(),this._context.stage.removeMany(this._materials),this._materials.length=0}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,REt,this.symbolLayer.type))return null;const r=this._getVertexOpacityAndColor(e.renderingInfo,255),n=this.setGraphicElevationContext(i);return this._createAs3DShape(i,e.renderingInfo,r,n,i.uid)}layerOpacityChanged(e,i){var a,c,p,_;const r=(c=(a=this.symbolLayer)==null?void 0:a.material)==null?void 0:c.color,n=this._getCombinedOpacity(r),s=n<1||this.needsDrivenTransparentPass;(p=this._materials[Wd.Main])==null||p.setParameters({opacity:n,transparent:s}),(_=this._materials[Wd.Bottom])==null||_.setParameters({opacity:n,transparent:s});const o=this._getLayerOpacity();e.forEach(x=>{const S=i(x);S!=null&&S.layerOpacityChanged(o,this._context.isAsync)})}layerElevationInfoChanged(e,i){return this.updateGraphics3DGraphicElevationInfo(e,i,ex)}slicePlaneEnabledChanged(e,i){var r,n;return(r=this._materials[Wd.Main])==null||r.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),(n=this._materials[Wd.Bottom])==null||n.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e.forEach(s=>{const o=i(s);o!=null&&o.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){var i,r;const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return(i=this._materials[Wd.Main])==null||i.setParameters(e),(r=this._materials[Wd.Bottom])==null||r.setParameters(e),!0}_getExtrusionSize(e){let i;return i=e.size&&this._drivenProperties.size?aSt(e.size,2)??0:this._getSymbolSize(),i/=this._context.renderCoordsHelper.unitInMeters,i}applyRendererDiff(e,i){return this._drivenPropertiesChanged(i)?Eo.RecreateSymbol:Eo.RecreateGraphics}async queryForSnapping(e,i,r,n){const s=this._getExtrusionSize(r)*this._context.renderCoordsHelper.unitInMeters/ad(i),{objectId:o,target:a}=e,c=Pe(a);switch(c.z=(c.z??0)+s,e.type){case"edge":{const{start:p,end:_}=e,x=Pe(p),S=Pe(_);return x.z=(x.z??0)+s,S.z=(S.z??0)+s,[Kye(o,c,1/0,x,S)]}case"vertex":return[nSt(o,c,1/0),Kye(o,a,1/0,a,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,i,r,n,s){const o=ZL(e.geometry);if(o==null)return null;if(o.rings.length===0||!o.rings.some(Q=>Q.length>0))return this._logGeometryValidationWarnings(o.rings,"rings","ExtrudeSymbol3DLayer"),null;const a=mce(o,this._context.elevationProvider,this._context.renderCoordsHelper,n);this._logGeometryCreationWarnings(a,o.rings,"rings","ExtrudeSymbol3DLayer");const c=Lle(o);if(c==null)return null;const p=new Array,_=new Array,x=va(),S=Qe(),C=W(),M=this._context.renderCoordsHelper.viewingMode===_t.Global;M||this._context.renderCoordsHelper.worldUpAtPosition(null,C),Ac(o.spatialReference,[c.x,c.y,0],S,this._context.renderCoordsHelper.spatialReference);const P=Qe();Bo(P,S);const $=as();E_($,P);const{polygons:F,mapPositions:z,position:k}=a;for(const Q of F){const ne=Q.count;if(this._context.clippingExtent&&(Bn(x),pp(x,Q.mapPositions),!bm(x,this._context.clippingExtent)))continue;const ie=UP(Q.mapPositions,Q.holeIndices,3);if(ie.length===0)continue;const he=ie.length,ce=6*ne,ve=EU(ce+he),ge=EU(he),pe=Qa(3*ce),Ee=Qa(3*ce),te=Qa(3*ce),le=Qa(ce);$Et(k,z,ie,Q,pe,te,Ee,le,ve,ge,this._getExtrusionSize(i),C,M),Gm(pe,pe,P);const de=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:s,layerUid:this._context.layer.uid}),be=new kEt(pe,te,OEt(Ee),le);p.push(I1e(this._materials[Wd.Main],ve,ve.length-ge.length,be,r,de),I1e(this._materials[Wd.Bottom],ge,0,be,r,de)),_.push(be.heights)}if(p.length===0)return null;const U=new eb({geometries:p,layerUid:this._context.layer.uid,graphicUid:s,isElevationSource:!0});U.transformation=S;const j=d5e(this.symbolLayer,{opacity:this._getLayerOpacity()}),G=j!=null?{baseMaterial:this._materials[Wd.Main],edgeMaterials:[j],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,Y=new b1(this,U,p,null,null,(Q,ne,ie,he,ce)=>NEt(Q,ne,ie,he,ce,_),n,G);return Y.alignedSampledElevation=a.sampledElevation,Y.needsElevationUpdates=ex(n.mode),Y}};function I1e(t,e,i,r,n,s){const o=mx(e.length),a=[[J.POSITION,new $t(r.positions,e,3,!0)],[J.NORMALCOMPRESSED,new $t(r.normals,e,2,!0)],[J.COLOR,new $t(n,o,4,!0)]];return new jo(t,a,r.elevation,Ws.Mesh,s,i)}function $Et(t,e,i,r,n,s,o,a,c,p,_,x,S){const C=i.length/3;let M=0,P=2*r.count;LEt(t,e,r.index,r.count,i,0,C,n,s,o,a,c,p,P,_,x,S);let $=2*r.count;P=0,$1e(n,s,a,o,M,r.pathLengths[0],r.count,$,c,P,_),$+=4*r.pathLengths[0],P+=2*r.pathLengths[0],M+=r.pathLengths[0];for(let F=1;F0?1:-1;let z=3*i,k=0,U=3*k,j=r,G=3*j;for(let ne=0;ne0?(S=n,M=n+o):(S=n,x=n+o)),DEt(t,x,S,C,OR),HN(t,e,r,i,OR,P,x),HN(t,e,r,i,OR,$,S),HN(t,e,r,i,OR,F,C),HN(t,e,r,i,OR,z,M),c[p++]=P,c[p++]=F,c[p++]=z,c[p++]=P,c[p++]=z,c[p++]=$,x++,S++,C++,M++,P+=2,$+=2,F+=2,z+=2}const qW=W(),L1e=W(),D1e=W(),N1e=W(),F1e=W();function DEt(t,e,i,r,n){e*=3,i*=3,r*=3,Ie(qW,t[e++],t[e++],t[e++]),Ie(L1e,t[i++],t[i++],t[i++]),Ie(D1e,t[r++],t[r++],t[r++]),je(N1e,L1e,qW),je(F1e,D1e,qW),Wt(n,F1e,N1e),Ye(n,n)}const TC=W();function NEt(t,e,i,r,n,s){const o=t.stageObject,a=o.geometries,c=a.length,p=e.mode!=="absolute-height";let _=0;const x=o.transformation,S=u5(Qe(),x);for(let C=0;C=Y||Math.abs(TC[1]-P[k+1])>=Y||Math.abs(TC[2]-P[k+2])>=Y)&&(U=!0),F.offset+=3,k+=3}U&&(M.invalidateBoundingInfo(),o.geometryVertexAttributeUpdated(a[C],J.POSITION),a[C+1].invalidateBoundingInfo(),o.geometryVertexAttributeUpdated(a[C+1],J.POSITION)),_+=j/z}return _/c}const uh=W(),xu=W(),qN=new l6,k1e=[0,2,1],z1e=[0,1,2],FEt=.01;var Wd;(function(t){t[t.Main=0]="Main",t[t.Bottom=1]="Bottom"})(Wd||(Wd={}));let kEt=class{constructor(e,i,r,n){this.positions=e,this.elevation=i,this.normals=r,this.heights=n}};function zEt(t){return typeof t=="function"}function Wci(t,e,i,r){return zEt(t)?t(e,i,r):t}function Yci(t){return[t.r,t.g,t.b,t.a]}const UEt=` /-, +`;function U1e(t){let e=t.length;for(;e--;)if(!UEt.includes(t.charAt(e)))return!1;return!0}function VEt(t,e){const i=[];let r=0,n=-1;do if(n=t.indexOf("[",r),n>=r){if(n>r){const s=t.substr(r,n-r);i.push([s,null,U1e(s)])}if(r=n+1,n=t.indexOf("]",r),n>=r){if(n>r){const s=e[t.substr(r,n-r)];s&&i.push([null,s,!1])}r=n+1}}while(n!==-1);if(rBEt(n,r,i)}function jEt(t,e){switch(typeof t!="string"&&(t=String(t)),e){case"LowerCase":return t.toLowerCase();case"Allcaps":return t.toUpperCase();default:return t}}function Zci(t,e,i,r,n,s,o=!0){const a=e/n,c=i/s,p=Math.ceil(a/2),_=Math.ceil(c/2);for(let x=0;x=-1&&ce<=1&&(M=2*ce*ce*ce-3*ce*ce+1,M>0&&(he=4*(ie+G*e),U+=M*t[he+3],$+=M,t[he+3]<255&&(M=M*t[he+3]/250),F+=M*t[he],z+=M*t[he+1],k+=M*t[he+2],P+=M))}}r[C]=F/P,r[C+1]=z/P,r[C+2]=k/P,r[C+3]=U/$}}function XNe(t){return t?{r:t[0],g:t[1],b:t[2],a:t[3]/255}:{r:0,g:0,b:0,a:0}}function ZNe(t){var e;return((e=t.data)==null?void 0:e.symbol)??null}function Sie(t){return t.type==="CIMVectorMarker"||t.type==="CIMPictureMarker"||t.type==="CIMBarChartMarker"||t.type==="CIMCharacterMarker"||t.type==="CIMPieChartMarker"||t.type==="CIMStackedBarChartMarker"}function Tie(t){return t.type==="CIMGradientStroke"||t.type==="CIMPictureStroke"||t.type==="CIMSolidStroke"}function GEt(t){return t!=null&&(t.type==="CIMGradientFill"||t.type==="CIMHatchFill"||t.type==="CIMPictureFill"||t.type==="CIMSolidFill"||t.type==="CIMWaterFill")}function KU(t){return t!=null&&(t.type==="CIMMarkerPlacementAlongLineRandomSize"||t.type==="CIMMarkerPlacementAlongLineSameSize"||t.type==="CIMMarkerPlacementAlongLineVariableSize"||t.type==="CIMMarkerPlacementAtExtremities"||t.type==="CIMMarkerPlacementAtMeasuredUnits"||t.type==="CIMMarkerPlacementAtRatioPositions"||t.type==="CIMMarkerPlacementOnLine"||t.type==="CIMMarkerPlacementOnVertices")}const Jci=(t,e=0)=>t==null||isNaN(t)?e:t,Kci=t=>t.tintColor?XNe(t.tintColor):{r:255,g:255,b:255,a:1},Qci=t=>{if(!t)return!1;for(const e of t)switch(e.type){case"CIMGeometricEffectBuffer":case"CIMGeometricEffectOffset":case"CIMGeometricEffectDonut":return!0}return!1};function eui(){return we(()=>import("./geometryEngineJSON-0_tJeUzi.js").then(t=>t.g),__vite__mapDeps([87,49]))}function tui(t){if(!t)return"normal";switch(t.toLowerCase()){case"italic":return"italic";case"oblique":return"oblique";default:return"normal"}}function iui(t){if(!t)return"normal";switch(t.toLowerCase()){case"bold":return"bold";case"bolder":return"bolder";case"lighter":return"lighter";default:return"normal"}}function rui(t){let e="normal",i="normal";if(t){const r=t.toLowerCase();r.includes("italic")?e="italic":r.includes("oblique")&&(e="oblique"),r.includes("bold")?i="bold":r.includes("light")&&(i="lighter")}return{style:e,weight:i}}function nui(t){return t.underline?"underline":t.strikethrough?"line-through":"none"}function V1e(t){if(!t)return null;switch(t.type){case"CIMPolygonSymbol":if(t.symbolLayers)for(const e of t.symbolLayers){const i=V1e(e);if(i!=null)return i}break;case"CIMTextSymbol":return V1e(t.symbol);case"CIMSolidFill":return t.color}}function B1e(t){if(t)switch(t.type){case"CIMPolygonSymbol":case"CIMLineSymbol":{const e=t.symbolLayers;if(e)for(const i of e){const r=B1e(i);if(r!=null)return r}break}case"CIMTextSymbol":return B1e(t.symbol);case"CIMSolidStroke":return t.color}}function j1e(t){if(t)switch(t.type){case"CIMPolygonSymbol":case"CIMLineSymbol":if(t.symbolLayers)for(const e of t.symbolLayers){const i=j1e(e);if(i!==void 0)return i}break;case"CIMTextSymbol":return j1e(t.symbol);case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return t.width}}function sui(t){switch(t){case"Left":default:return"left";case"Right":return"right";case"Center":case"Justify":return"center"}}function oui(t){switch(t){case"Top":default:return"top";case"Center":return"middle";case"Baseline":return"baseline";case"Bottom":return"bottom"}}function aui(t){return(t?Object.keys(t):[]).map(e=>({name:e,alias:e,type:typeof t[e]=="string"?"esriFieldTypeString":"esriFieldTypeDouble"}))}const lui=t=>t.includes("data:image/svg+xml");function cui(t){if(!t)return null;switch(t.type){case"CIMPointSymbol":case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function JNe(t,e,i,r){if(t)if(t.type!=="CIMTextSymbol"){if(i&&t.effects)for(const n of t.effects)WEt(n,e);if(t.symbolLayers)for(const n of t.symbolLayers)switch(n.type){case"CIMPictureMarker":case"CIMVectorMarker":HEt(n,e,r);break;case"CIMPictureStroke":case"CIMSolidStroke":!(r!=null&&r.preserveOutlineWidth)&&n.width&&(n.width*=e);break;case"CIMPictureFill":n.height&&(n.height*=e),n.offsetX&&(n.offsetX*=e),n.offsetY&&(n.offsetY*=e);break;case"CIMHatchFill":JNe(n.lineSymbol,e,!0,{...r,preserveOutlineWidth:!1}),n.offsetX&&(n.offsetX*=e),n.offsetY&&(n.offsetY*=e),n.separation&&(n.separation*=e)}}else t.height!=null&&(t.height*=e)}function HEt(t,e,i){if(t&&(t.markerPlacement&&qEt(t.markerPlacement,e),t.offsetX&&(t.offsetX*=e),t.offsetY&&(t.offsetY*=e),t.anchorPoint&&t.anchorPointUnits==="Absolute"&&(t.anchorPoint={x:t.anchorPoint.x*e,y:t.anchorPoint.y*e}),t.size=t.size!=null?t.size*e:0,t.type==="CIMVectorMarker"&&t.markerGraphics))for(const r of t.markerGraphics)t.scaleSymbolsProportionally||JNe(r.symbol,e,!0,i)}function qEt(t,e){switch(KU(t)&&t.offset&&(t.offset*=e),t.type){case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAlongLineSameSize":if(t.customEndingOffset&&(t.customEndingOffset*=e),t.offsetAlongLine&&(t.offsetAlongLine*=e),t.placementTemplate&&t.placementTemplate.length){const i=t.placementTemplate.map(r=>r*e);t.placementTemplate=i}break;case"CIMMarkerPlacementAlongLineVariableSize":if(t.maxRandomOffset&&(t.maxRandomOffset*=e),t.placementTemplate&&t.placementTemplate.length){const i=t.placementTemplate.map(r=>r*e);t.placementTemplate=i}break;case"CIMMarkerPlacementOnLine":t.startPointOffset&&(t.startPointOffset*=e);break;case"CIMMarkerPlacementAtExtremities":t.offsetAlongLine&&(t.offsetAlongLine*=e);break;case"CIMMarkerPlacementAtMeasuredUnits":case"CIMMarkerPlacementOnVertices":break;case"CIMMarkerPlacementAtRatioPositions":t.beginPosition&&(t.beginPosition*=e),t.endPosition&&(t.endPosition*=e);break;case"CIMMarkerPlacementPolygonCenter":t.offsetX&&(t.offsetX*=e),t.offsetY&&(t.offsetY*=e);break;case"CIMMarkerPlacementInsidePolygon":t.offsetX&&(t.offsetX*=e),t.offsetY&&(t.offsetY*=e),t.stepX&&(t.stepX*=e),t.stepY&&(t.stepY*=e)}}function WEt(t,e){switch(t.type){case"CIMGeometricEffectArrow":case"CIMGeometricEffectDonut":t.width&&(t.width*=e);break;case"CIMGeometricEffectBuffer":t.size&&(t.size*=e);break;case"CIMGeometricEffectCut":t.beginCut&&(t.beginCut*=e),t.endCut&&(t.endCut*=e),t.middleCut&&(t.middleCut*=e);break;case"CIMGeometricEffectDashes":if(t.customEndingOffset&&(t.customEndingOffset*=e),t.offsetAlongLine&&(t.offsetAlongLine*=e),t.dashTemplate&&t.dashTemplate.length){const i=t.dashTemplate.map(r=>r*e);t.dashTemplate=i}break;case"CIMGeometricEffectExtension":case"CIMGeometricEffectJog":case"CIMGeometricEffectRadial":t.length&&(t.length*=e);break;case"CIMGeometricEffectMove":t.offsetX&&(t.offsetX*=e),t.offsetY&&(t.offsetY*=e);break;case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":t.offset&&(t.offset*=e);break;case"CIMGeometricEffectRegularPolygon":t.radius&&(t.radius*=e);break;case"CIMGeometricEffectTaperedPolygon":t.fromWidth&&(t.fromWidth*=e),t.length&&(t.length*=e),t.toWidth&&(t.toWidth*=e);break;case"CIMGeometricEffectWave":t.amplitude&&(t.amplitude*=e),t.period&&(t.period*=e)}}function KNe(t){const e=[];return Eie(ZNe(t),e),e.length?new qe(XNe(e[0])):null}function Eie(t,e){var n;if(!t)return;let i;i=t.type==="CIMTextSymbol"?t.symbol:t;const r=t.type==="CIMPolygonSymbol";if(i!=null&&i.symbolLayers){for(const s of i.symbolLayers)if(!(s.colorLocked||r&&(Tie(s)||Sie(s)&&s.markerPlacement&&KU(s.markerPlacement))))switch(s.type){case"CIMPictureMarker":case"CIMPictureStroke":case"CIMPictureFill":s.tintColor&&G1e(e,s.tintColor);break;case"CIMVectorMarker":(n=s.markerGraphics)==null||n.forEach(o=>{Eie(o.symbol,e)});break;case"CIMSolidStroke":case"CIMSolidFill":G1e(e,s.color);break;case"CIMHatchFill":Eie(s.lineSymbol,e)}}}function G1e(t,e){for(const i of t)if(i.join(".")===e.join("."))return;t.push(e)}function QNe(t,e,i){e instanceof qe||(e=new qe(e));const r=ZNe(t);r&&Cie(r,e,i)}function Cie(t,e,i){var s;if(!t)return;let r;r=t.type==="CIMTextSymbol"?t.symbol:t;const n=(r==null?void 0:r.type)==="CIMPolygonSymbol";if(r!=null&&r.symbolLayers)for(const o of r.symbolLayers){if(o.colorLocked)continue;if(n){if(i){const{layersToColor:c}=i;if((Tie(o)||Sie(o)&&o.markerPlacement&&KU(o.markerPlacement))&&c==="fill"||GEt(o)&&c==="outline")continue}else if(Tie(o)||Sie(o)&&o.markerPlacement&&KU(o.markerPlacement))continue}const a=e.toArray();switch(o.type){case"CIMPictureMarker":case"CIMPictureStroke":case"CIMPictureFill":o.tintColor=a;break;case"CIMVectorMarker":(s=o.markerGraphics)==null||s.forEach(c=>{Cie(c.symbol,e,i)});break;case"CIMSolidStroke":case"CIMSolidFill":o.color=a;break;case"CIMHatchFill":Cie(o.lineSymbol,e,i)}}}const e8e="picture-fill",t8e="simple-fill",YEt="simple-line",i8e="simple-marker",XEt="text",ZEt="cim",WW=new JB(1e3);function JEt(t){const e=t.style;let i=null;if(t)switch(t.type){case i8e:e!=="cross"&&e!=="x"&&(i=t.color);break;case t8e:e==="solid"?i=t.color:e!=="none"&&(i={type:"pattern",x:0,y:0,src:Wr(`esri/symbols/patterns/${e}.png`),width:5,height:5});break;case e8e:i={type:"pattern",src:t.url,width:Er(t.width)*t.xscale,height:Er(t.height)*t.yscale,x:Er(t.xoffset),y:Er(t.yoffset)};break;case XEt:i=t.color;break;case ZEt:i=KNe(t)}return i}function KEt(t,e){const i=t+"-"+e;return WW.get(i)!==void 0?Promise.resolve(WW.get(i)):yi(t,{responseType:"image"}).then(r=>{const n=r.data,s=n.naturalWidth,o=n.naturalHeight,a=document.createElement("canvas");a.width=s,a.height=o;const c=a.getContext("2d");c.fillStyle=e,c.fillRect(0,0,s,o),c.globalCompositeOperation="destination-in",c.drawImage(n,0,0);const p=a.toDataURL();return WW.put(i,p),p})}function e9(t){if(!t)return null;let e=null;switch(t.type){case t8e:case e8e:case i8e:e=e9(t.outline);break;case YEt:{const i=Er(t.width);t.style!=null&&t.style!=="none"&&i!==0&&(e={color:t.color,style:yce(t.style),width:i,cap:t.cap,join:t.join==="miter"?Er(t.miterLimit):t.join});break}default:e=null}return e}const yce=(()=>{const t={};return e=>{if(t[e])return t[e];const i=e.replaceAll("-","");return t[e]=i,i}})(),QEt=new qe([128,128,128]),eCt=new qe("white");function tCt(t){var i,r;const e=(i=t.symbolLayers)==null?void 0:i.at(-1);if(e&&"outline"in e)return(r=e==null?void 0:e.outline)==null?void 0:r.size}function iCt(t){var e;if(!t)return 0;if(Ky(t)){const i=tCt(t);return i??0}return cd((e=e9(t))==null?void 0:e.width)}function TG(t){if(t==null||!("symbolLayers"in t)||t.symbolLayers==null)return!1;switch(t.type){case"point-3d":return t.symbolLayers.some(e=>e.type==="object");case"line-3d":return t.symbolLayers.some(e=>e.type==="path");case"polygon-3d":return t.symbolLayers.some(e=>e.type==="object"||e.type==="extrude");default:return!1}}function r8e(t){var e;return((e=t.resource)==null?void 0:e.href)??""}function EC(t,e){if(!t)return null;let i=null;return Ky(t)?i=rCt(t):qB(t)&&(i=t.type==="cim"?KNe(t):t.color?new qe(t.color):null),i?t9(i,e):null}function rCt(t){const e=t.symbolLayers;if(!e)return null;let i=null;return e.forEach(r=>{var n;r.type==="object"&&((n=r.resource)!=null&&n.href)||(i=r.type==="water"?r.color:r.material?r.material.color:null)}),i?new qe(i):null}function t9(t,e){if(e==null||t==null)return t;const i=t.toRgba();return i[3]=i[3]*e,new qe(i)}function nCt(t,e,i){const r=t.symbolLayers;if(!r)return;const n=s=>t9(e=e??s??(i!=null?eCt:null),i);r.forEach(s=>{var o,a;if(s.type!=="object"||!((o=s.resource)!=null&&o.href)||e)if(s.type==="water")s.color=n(s.color);else{const c=s.material!=null?s.material.color:null,p=n(c);s.material==null?s.material=new _p({color:p}):s.material.color=p,i!=null&&"outline"in s&&((a=s.outline)==null?void 0:a.color)!=null&&(s.outline.color=t9(s.outline.color,i))}})}function sCt(t,e,i){var r;(e=e??t.color)&&(t.color=t9(e,i)),i!=null&&"outline"in t&&((r=t.outline)!=null&&r.color)&&(t.outline.color=t9(t.outline.color,i))}function YW(t,e,i){t&&(e||i!=null)&&(e&&(e=new qe(e)),Ky(t)?nCt(t,e,i):qB(t)&&sCt(t,e,i))}async function oCt(t,e){const i=t.symbolLayers;i&&await HB(i,async r=>aCt(r,e))}async function aCt(t,e){switch(t.type){case"extrude":cCt(t,e);break;case"icon":case"line":case"text":lCt(t,e);break;case"path":hCt(t,e);break;case"object":await uCt(t,e)}}function lCt(t,e){const i=n8e(e);i!=null&&(t.size=i)}function n8e(t){for(const e of t)if(typeof e=="number")return e;return null}function cCt(t,e){t.size=typeof e[2]=="number"?e[2]:0}async function uCt(t,e){const{resourceSize:i,symbolSize:r}=await dCt(t),n=s8e(e,i,r);t.width=k$(e[0],r[0],i[0],n),t.depth=k$(e[1],r[1],i[1],n),t.height=k$(e[2],r[2],i[2],n)}function hCt(t,e){const i=s8e(e,Yv,[t.width,void 0,t.height]);t.width=k$(e[0],t.width,1,i),t.height=k$(e[2],t.height,1,i)}function s8e(t,e,i){for(let r=0;r<3;r++){const n=t[r];switch(n){case"symbol-value":{const s=i[r];return s!=null?s/e[r]:1}case"proportional":break;default:if(n&&e[r])return n/e[r]}}return 1}async function dCt(t){const{computeObjectLayerResourceSize:e}=await we(()=>import("./symbolLayerUtils-5Hw4LbZb.js"),__vite__mapDeps([])),i=await e(t,10),{width:r,height:n,depth:s}=t,o=[r,s,n];let a=1;for(let c=0;c<3;c++){const p=o[c];if(p!=null){a=p/i[c];break}}for(let c=0;c<3;c++)o[c]==null&&(o[c]=i[c]*a);return{resourceSize:i,symbolSize:o}}function k$(t,e,i,r){switch(t){case"proportional":return i*r;case"symbol-value":return e??i;default:return t}}function pCt(t,e){const i=n8e(e);if(i!=null)switch(t.type){case"simple-marker":t.size=i;break;case"picture-marker":{const r=t.width/t.height;r>1?(t.width=i,t.height=i*r):(t.width=i*r,t.height=i);break}case"simple-line":t.width=i;break;case"text":t.font.size=i}}async function fCt(t,e){if(t&&e)return Ky(t)?oCt(t,e):void(qB(t)&&pCt(t,e))}function mCt(t,e,i){if(t&&e!=null)if(Ky(t)){const r=t.symbolLayers;r&&r.forEach(n=>{if(n&&n.type==="object")switch(i){case"tilt":n.tilt=e;break;case"roll":n.roll=e;break;default:n.heading=e}})}else qB(t)&&(t.type!=="simple-marker"&&t.type!=="picture-marker"&&t.type!=="text"||(t.angle=e))}function i9(t){if(!t)return null;const e=t.effects.filter(i=>i.type!=="bloom").map(i=>i.toJSON());return Lz(e)}function uui(t){return t!=null&&t.type==="polygon-3d"&&t.symbolLayers.some(e=>e.type==="extrude")}async function gCt(t,e){return await t.fetchSymbol(e)||t.fetchCIMSymbol(e)}function yCt(t,e,i,r,n){if(t==null)return null;const s=t.referencesGeometry()&&n?vCt(e,r,n):e,o=t.repurposeFeature(s);try{return t.evaluate({...i,$feature:o},t.services)}catch(a){return Ce.getLogger("esri.views.2d.support.arcadeOnDemand").warn("Feature arcade evaluation failed:",a),null}}const XW=new Map;function vCt(t,e,i){const{transform:r,hasZ:n,hasM:s}=i;XW.has(e)||XW.set(e,_Ct(e));const o=XW.get(e)(t.geometry,r,n,s);return{...t,geometry:o}}function _Ct(t){const e={};switch(t){case"esriGeometryPoint":return(i,r,n,s)=>NDe(r,e,i,n,s);case"esriGeometryPolygon":return(i,r,n,s)=>FDe(r,e,i,n,s);case"esriGeometryPolyline":return(i,r,n,s)=>kDe(r,e,i,n,s);case"esriGeometryMultipoint":return(i,r,n,s)=>DDe(r,e,i,n,s);default:return Ce.getLogger("esri.views.2d.support.arcadeOnDemand").error(new se("mapview-arcade",`Unable to handle geometryType: ${t}`)),i=>i}}const hui=1.2,bCt=bp,wCt=4;let EG=class{constructor(e,i,r,n){this.graphics3DSymbolLayer=e,this.renderGeometries=i,this.boundingBox=r,this._drapeSourceRenderer=n,this.type="draped",this.stage=null,this._visible=!1,this._addedToStage=!1,this.isElevationSource=!1}initialize(e){this.stage=e.stage}setVisibility(e){if(this.stage!=null&&this._visible!==e){if(this._visible=e,e&&!this._addedToStage)return this._addedToStage=!0,void this._drapeSourceRenderer.addGeometries(this.renderGeometries,ds.ADD);if(e||this._addedToStage){for(const i of this.renderGeometries)i.visible=this._visible;this._drapeSourceRenderer.modifyGeometries(this.renderGeometries,ua.VISIBILITY)}}}destroy(){this.stage&&this._addedToStage&&this._drapeSourceRenderer.removeGeometries(this.renderGeometries,ds.REMOVE),this._addedToStage=!1,this._visible=!1,this.stage=null}getCenterObjectSpace(e=W()){return Ie(e,0,0,0)}getBoundingBoxObjectSpace(e=va()){return Bn(e)}addObjectState(e,i){e===P_.Highlight&&(this.renderGeometries.forEach(r=>{const n=r.geometry.addHighlight();i.addRenderGeometry(r,n,this)}),this._addedToStage&&this._drapeSourceRenderer.modifyGeometries(this.renderGeometries,ua.HIGHLIGHT))}removeObjectState(e){this.renderGeometries.forEach(i=>{e.removeRenderGeometry(i)})}removeRenderGeometryObjectState(e,i){e.geometry.removeHighlight(i),this._addedToStage&&this._drapeSourceRenderer.modifyGeometries(this.renderGeometries,ua.HIGHLIGHT)}computeAttachmentOrigin(e){for(const i of this.renderGeometries)i.geometry.computeAttachmentOrigin(CC)&&(e.draped.origin[0]+=CC[0],e.draped.origin[1]+=CC[1],e.draped.num++)}async getProjectedBoundingBox(e,i,r,n,s){Bn(s);for(let o=0;o{let t="";for(let e=32;e<127;e++)t+=String.fromCharCode(e);return t})(),eV=1;let a8e=class{constructor(e,i,r,n){this.text=e,this._alignment=i,this._parameters=r,this._maxSize=n,this._textWidths=[],this._lineWidths=[],this._renderPixelRatio=null,this._metricsCached=null,this.key=`TextRenderer-${this._parameters.key}-${this._alignment}--${e}`,this._lines=e.replaceAll(" "," ").split(/\r?\n/)}get displayWidth(){return Math.ceil(this._displayWidth+2*this._horizontalPadding)}get displayHeight(){let e=this._metrics.firstLineAscent;for(let i=0;i{const M=e.measureText(S),P=M.width,$=P+i;this._textWidths.push(P),this._lineWidths.push($),o=Math.max(o,$),a=Math.max(a,M.actualBoundingBoxAscent),c=Math.max(c,M.actualBoundingBoxDescent),C===0&&(n=M),C===this._lines.length-1&&(s=M)});const p=o8e(this._parameters);a=Math.max(a,p.maxAscent),c=Math.max(c,p.maxDescent);const _=n.actualBoundingBoxAscent,x=this._parameters.definition.font.decoration==="underline"?c:s.actualBoundingBoxDescent;this._metricsCached=new CCt(_,x,a,c,o)}return this._metricsCached}get _lineSpacing(){return(this._midLineHeight+this._linePadding)*this._parameters.definition.lineSpacingFactor}get _midLineHeight(){return this._metrics.midLineHeight}get _linePadding(){return this._midLineHeight*ECt}get _midLineAscent(){return this._metrics.maxLineAscent}get _renderedFontSize(){return this._toRenderUnit(this._fontSize)}get _fontSize(){return this._parameters.definition.size}get _renderedHaloSize(){return this._toRenderUnit(this._haloSize)}get _haloSize(){return this._parameters.haloSize}get _horizontalPadding(){return this._hasBackground?this._parameters.definition.background.padding[0]:0}get _verticalPadding(){return Math.max(this._hasBackground?this._parameters.definition.background.padding[1]:0,eV)}get _hasBackground(){return!!this._parameters.backgroundStyle}get renderPixelRatio(){if(this._renderPixelRatio==null){const e=this._parameters.definition.pixelRatio;this._renderPixelRatio=Math.min(e,Math.min(this._maxSize[0]/this.displayWidth,this._maxSize[1]/this.displayHeight))}return this._renderPixelRatio}_getLineXOffset(e){switch(this._alignment){case A2.Left:return this._horizontalPadding;case A2.Center:return(this.displayWidth-this._lineWidths[e])/2;case A2.Right:return this.displayWidth-this._horizontalPadding-this._lineWidths[e]}}render(e,i,r){e.save();const n=i/=this.renderPixelRatio,s=r/=this.renderPixelRatio,o=this._haloSize,a=this._firstLineYOffset+this._metrics.firstLineAscent;i+=o,r+=a;const c=this._haloSize>0;c&&this._renderHalo(e,n,s,o,a),this._parameters.setFontProperties(e,this._renderedFontSize);for(let p=0;pETt(i));this._textureHandle=s,e.textureId=s.texture.id}e.textureIsSignedDistanceField=!0,e.sampleSignedDistanceFieldTexelCenter=TTt(i),e.distanceFieldBoundingBox=LCt;const n=this._getIconSize();this._size=[n,n],this._symbolTextureRatio=1/oT,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,i,r){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const n=this._getIconSize(),s=n*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(this._context.sharedResources.textures!=null){const o=await ih(this._context.sharedResources.textures.fromUrl(i,s,{signal:r}));if(o.ok===!1)throw Uo(o.error),new se("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${i})`);this._textureHandle=o.value;const a=o.value.texture,c=a.parameters.width/a.parameters.height;this._size=c>1?[n,Math.round(n/c)]:[Math.round(n*c),n],e.textureId=a.id}this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,i,r){const n=new cx({data:i});if(!this._context.sharedResources.cimSymbolRasterizer){const _=(await we(()=>import("./CIMSymbolRasterizer-uvvL-Oh3.js"),__vite__mapDeps([210,211,97,77,78,100,110,163]))).CIMSymbolRasterizer;St(r),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new _(this._context.renderCoordsHelper.spatialReference,!0))}const s=this._context.layer.fields?this._context.layer.fields.map(_=>_.toJSON()):null;let o,a;if(this._cimLayers=await this._context.sharedResources.cimSymbolRasterizer.analyzeCIMSymbol3D(n,s,this._context.renderer&&this._context.renderer.type==="dictionary"?this._context.renderer.fieldMap:null,"esriGeometryPoint",{signal:r}),this._context.renderer&&this._context.renderer.type==="dictionary"&&this._context.renderer.scaleExpression){const _=this._context.renderer;if(isNaN(_.scaleExpression)){const x=_.scaleExpression,S=await MQe(x,this._context.layer.spatialReference,s);a=(C,M,P)=>{const $=yCt(S,C,{$view:P},"esriGeometryPoint",M);return $!==null?$:1}}else o=Number(_.scaleExpression)}this._cimScaleFactorOrFunction=o||a||1;const c=this._context.renderer?await this._context.renderer.getRequiredFields(this._context.layer.fieldsIndex):[];St(r);const p=this._context.layer.fieldsIndex;this._cimRequiredFields=c.map(_=>p.get(_).name),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return this.symbolLayer.resource&&this.symbolLayer.resource.href?null:this.symbolLayer.resource&&this.symbolLayer.resource.primitive||CMe}_getOutlineSize(){var r;let e=0;const i=this.symbolLayer;return((r=i.outline)==null?void 0:r.size)!=null?Math.max(Er(i.outline.size),0):(e=ZW(this._getPrimitive())?$Ct:0,Math.max(e,0))}_getOutlineColor(){var n;const e=this._getLayerOpacity(),i=this.symbolLayer,r=(n=i==null?void 0:i.outline)==null?void 0:n.color;if(r!=null){const s=qe.toUnitRGB(r),o=r.a*e;return[s[0],s[1],s[2],o]}return[0,0,0,0]}_getFillColor(){var r,n;if(ZW(this._getPrimitive()))return bCt;const e=this._getPrimitive()==null,i=(n=(r=this.symbolLayer)==null?void 0:r.material)==null?void 0:n.color;return this._getCombinedOpacityAndColor(i,{hasIntrinsicColor:e})}_getAnchorPos(e,i){return e==="relative"?Ji((i.x||0)+.5,.5-(i.y||0)):e in fk?fk[e]:fk.center}_createMaterialAndAddToStage(e,i){if(this._cimLayers){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new kP(e),this._cimSymbolMaterials.set(e.textureId??0,r),i.add(r)),r}return this._fastUpdates=DP(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._materials[0]=new kP(e),i.add(this._materials[0]),this._materials[0]}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial(e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,isDraped:this.draped})}),this.layerOpacityChanged())}destroy(){super.destroy(),this._forEachMaterial(e=>this._context.stage.remove(e)),this._materials.length=0,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach(e=>this._context.stage.remove(e)),this._cimSymbolTextures.clear(),this._textureHandle=ir(this._textureHandle)}_getScaleFactor(e,i){if(this._drivenProperties.size&&e.size){for(let r=0;r<3;r++){const n=e.size[r];n&&n!=="symbol-value"&&n!=="proportional"&&(e.size[r]=Er(n))}if(e.size[0]==="symbol-value")return 1;if(isFinite(+e.size[0]))return+e.size[0]/i;if(isFinite(+e.size[2]))return+e.size[2]/i}return 1}createGraphics3DGraphic(e){var x;const i=e.graphic;if(!this._validateGeometry(i.geometry))return null;let r,n=[0,0];if(this._cimLayers){if(!this._cimLayers.length)return null;const S=this._generateTextureCIM(i),C={textureId:S.id,...this._cimMaterialParametersInfo};r=this._createMaterialAndAddToStage(C,this._context.stage),n=[S.parameters.width,S.parameters.height]}else n=this._size,r=this._materials[0];const s=XL(i.geometry);if(s==null)return this.logger.warn(`unsupported geometry type for icon symbol: ${i.geometry.type}`),null;const o=e.renderingInfo,a=this._getVertexOpacityAndColor(o);let c=1;if(!((x=this._fastUpdates)!=null&&x.visualVariables.size)){const S=n[0]>n[1]?n[0]:n[1];c=this._getScaleFactor(o,S)}c*=this._symbolTextureRatio;const p=Ji(n[0]*c,n[1]*c),_=this.setGraphicElevationContext(i);return this.ensureDrapedStatus(_.mode==="on-the-ground")&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(i,s,r,a,p,e.layer.uid):this._createAs3DShape(i,s,r,a,p,_,i.uid)}layerOpacityChanged(){const e=this._getFillColor(),i=this._getOutlineColor();this._forEachMaterial(r=>{r.setParameters({color:e}),r.setParameters({outlineColor:i})})}layerElevationInfoChanged(e,i,r){const n=this._elevationContext.mode,s=a6(u8e.elevationModeChangeTypes,r,n);if(s!==Ys.UPDATE)return s;const o=s0(n)||n==="absolute-height";return this.updateGraphics3DGraphicElevationInfo(e,i,()=>o)}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial(e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return this._getPrimitive()!=null}applyRendererDiff(e,i){var r;for(const n in e.diff){if(n!=="visualVariables"||!NP(this._fastUpdates,i,this._fastVisualVariableConvertOptions()))return Eo.RecreateSymbol;(r=this._materials[0])==null||r.setParameters(this._fastUpdates.materialParameters)}return Eo.FastUpdate}_defaultElevationInfoNoZ(){return FCt}_createAs3DShape(e,i,r,n,s,o,a){const c=this.getFastUpdateAttrValues(e),p=this._context.layer.uid,_=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:a,layerUid:p}),x=zte(r,Z1e,null,n,s,kCt,null,c,_),S=qle(this._context,i,x,o,a);if(S==null)return null;const C=new b1(this,S.object,[x],null,null,CT,o);return C.alignedSampledElevation=S.sampledElevation,C.needsElevationUpdates=s0(o.mode)||o.mode==="absolute-height",C.getScreenSize=this._createScreenSizeGetter(s,c),C.calculateRelativeScreenBounds=M=>r.calculateRelativeScreenBounds(C.getScreenSize(),1,M),YL(C,i,this._context.elevationProvider),C}_createAsOverlay(e,i,r,n,s,o){r.renderPriority=this._renderPriority;const a=Xi();fd(i,a,this._context.overlaySR),a[2]=fce;const c=this._context.clippingExtent;if(c!=null&&!Use(c,a))return null;const p=this.getFastUpdateAttrValues(e),_=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:e.uid,layerUid:this._context.layer.uid}),x=zte(r,Z1e,a,n,s,null,null,p,_),S=new BP(x,{layerUid:o,graphicUid:e.uid}),C=new EG(this,[S],null,this._context.drapeSourceRenderer);return C.getScreenSize=this._createScreenSizeGetter(s,p),C.calculateRelativeScreenBounds=M=>r.calculateRelativeScreenBounds(C.getScreenSize(),1,M),C}_createScreenSizeGetter(e,i){const r=this._outlineSize+2;if(this._fastUpdates&&i){const o=e[0]/this._symbolTextureRatio,a=e[1]/this._symbolTextureRatio;return(c=yt())=>{const[p,_]=Ele(zCt,this._fastUpdates.materialParameters,i);return c[0]=p*o+r,c[1]=_*a+r,c}}const n=e[0]/this._symbolTextureRatio+r,s=e[1]/this._symbolTextureRatio+r;return(o=yt())=>(o[0]=n,o[1]=s,o)}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),i=st(e,e,e),r=cd(1),n=e*r,s=st(n,n,n);return new r6({size:!0,color:!0,rotation:!0,opacity:!1},i,s,r)}_getGraphicHash(e){let i="";for(const r of this._cimRequiredFields)i+=r+e.attributes[r];return i}_forEachMaterial(e){this._materials.forEach(e),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._materials[0]}}};function NCt(t){return t&&t.type==="point-3d"&&t.hasVisibleVerticalOffset()}function ZW(t){return t!=null&&(t==="cross"||t==="x")}Aie.PRIMITIVE_SIZE=DCt,Aie.elevationModeChangeTypes={definedChanged:Ys.UPDATE,staysOnTheGround:Ys.NONE,onTheGroundChanged:Ys.RECREATE};const FCt={mode:"relative-to-ground",offset:0},kCt=Mi(0,0,0,1),zCt=W();function Mie(t){switch(t){case"butt":return Uf.BUTT;case"square":return Uf.SQUARE;case"round":return Uf.ROUND;default:return null}}function J1e(t){return t==="diamond"?"kite":t}function Oie(t,e,i=null){const r=[],n=e.mapPositions;UCt(e,r);const s=r[0][1].data,o=r[0][1].indices.length,a=mx(o);return VCt(e,r,a),GCt(e,r,a),BCt(e,r,a),jCt(e,r,a),HCt(e,r,a),qCt(e,r,a),WCt(e,r,s),new jo(t,r,n,Ws.Line,i)}function UCt(t,e){const{attributeData:{position:i},removeDuplicateStartEnd:r}=t,n=YCt(i)&&r,s=i.length/3-(n?1:0),o=new Array(2*(s-1)),a=n?i.slice(0,-3):i;let c=0;for(let p=0;p{const n=r.length,s=Qa(3*n);r.forEach((a,c)=>{s[3*c]=a[0],s[3*c+1]=a[1],s[3*c+2]=a[2]});const o={attributeData:{position:s,normal:e},removeDuplicateStartEnd:!1};i.push(o)}),i}function JCt(t,e,i,r){const n=t.type==="polygon"?s1.CCW_IS_HOLE:s1.NONE,s=t.type==="polygon"?t.rings:t.paths,{position:o,outlines:a}=f6(s,!!t.hasZ,n,t.spatialReference),c=Qa(o.length),p=S6e(o,t.spatialReference,0,c,0,o,0,o.length/3,e,i,r),_=p!=null;return{lines:_?h8e(a,o,c):[],projectionSuccess:_,sampledElevation:p}}function KCt(t,e){const i=t.type==="polygon"?s1.CCW_IS_HOLE:s1.NONE,r=t.type==="polygon"?t.rings:t.paths,{position:n,outlines:s}=f6(r,!1,i),o=un(n,t.spatialReference,0,n,e,0,n.length/3);for(let a=2;aa.camera.nearFar),new gr("viewport",(o,a)=>a.camera.fullViewport)),n.code.add(V`vec4 projectAndScale(vec4 pos) { vec4 posNdc = proj * pos; posNdc.xy *= viewport.zw / posNdc.w; return posNdc; @@ -3282,7 +3271,7 @@ if (prev.z > -nearFar[0]) { float interpolation = (-vnp - pos.z) / (prev.z - pos.z); prev = mix(pos, prev, interpolation); } -}`),r?(e.attributes.add(J.NORMAL,"vec3"),S5(n),n.constants.add("tiltThreshold","float",.7),n.code.add(V`vec3 perpendicular(vec3 v) { +}`),r?(e.attributes.add(J.NORMAL,"vec3"),IP(n),n.constants.add("tiltThreshold","float",.7),n.code.add(V`vec3 perpendicular(vec3 v) { vec3 n = (viewNormal * vec4(normal.xyz, 1.0)).xyz; vec3 n2 = cross(v, n); vec3 forward = vec3(0.0, 0.0, 1.0); @@ -3307,11 +3296,11 @@ return vec2(v.y, -v.x); vecN displacementDirU = perpendicular(segment); vecN displacementDirV = segment; - ${t.anchor===eE.Tip?"pos -= 0.5 * displacementLen * displacementDirV;":""} + ${t.anchor===nE.Tip?"pos -= 0.5 * displacementLen * displacementDirV;":""} return pos + displacementLen * (uv0.x * displacementDirU + uv0.y * displacementDirV); } - `),t.space===_p.Screen&&(n.uniforms.add(new _s("inverseProjectionMatrix",(o,l)=>l.camera.inverseProjectionMatrix)),n.code.add(V`vec3 inverseProject(vec4 posScreen) { + `),t.space===Sp.Screen&&(n.uniforms.add(new bs("inverseProjectionMatrix",(o,a)=>a.camera.inverseProjectionMatrix)),n.code.add(V`vec3 inverseProject(vec4 posScreen) { posScreen.xy = (posScreen.xy / viewport.zw) * posScreen.w; return (inverseProjectionMatrix * posScreen).xyz; }`),n.code.add(V`bool rayIntersectPlane(vec3 rayDir, vec3 planeOrigin, vec3 planeNormal, out vec3 intersection) { @@ -3319,7 +3308,7 @@ float cos = dot(rayDir, planeNormal); float t = dot(planeOrigin, planeNormal) / cos; intersection = t * rayDir; return abs(cos) > 0.001 && t > 0.0; -}`),n.uniforms.add(new ft("perScreenPixelRatio",(o,l)=>l.camera.perScreenPixelRatio)),n.code.add(V` +}`),n.uniforms.add(new ft("perScreenPixelRatio",(o,a)=>a.camera.perScreenPixelRatio)),n.code.add(V` vec4 toFront(vec4 displacedPosScreen, vec3 posLeft, vec3 posRight, vec3 prev, float lineWidth) { // Project displaced position back to camera space vec3 displacedPos = inverseProject(displacedPosScreen); @@ -3353,7 +3342,7 @@ return abs(cos) > 0.001 && t > 0.0; displacedPos *= minDepth / length(displacedPos); return vec4(displacedPos.xyz, 1.0); } - `)),bP(n),Rj(e),n.code.add(V`void main(void) { + `)),P5(n),Vj(e),n.code.add(V`void main(void) { if (uv0.y == 0.0) { gl_Position = vec4(1e038, 1e038, 1e038, 1.0); } @@ -3369,7 +3358,7 @@ return; vec4 displacedPosScreen = projectAndScale(pos);`)):(n.code.add(V`vec4 posScreen = projectAndScale(pos); vec4 prevScreen = projectAndScale(prev); vec4 displacedPosScreen = posScreen; -displacedPosScreen.xy = displace(posScreen.xy, prevScreen.xy, screenMarkerSize);`),t.space===_p.Screen&&n.code.add(V`vec2 displacementDirU = perpendicular(normalizedSegment(posScreen.xy, prevScreen.xy)); +displacedPosScreen.xy = displace(posScreen.xy, prevScreen.xy, screenMarkerSize);`),t.space===Sp.Screen&&n.code.add(V`vec2 displacementDirU = perpendicular(normalizedSegment(posScreen.xy, prevScreen.xy)); vec3 lineRight = inverseProject(posScreen + lineWidth * vec4(displacementDirU.xy, 0.0, 0.0)); vec3 lineLeft = pos.xyz + (pos.xyz - lineRight); pos = toFront(displacedPosScreen, lineLeft, lineRight, prev.xyz, lineWidth); @@ -3396,13 +3385,13 @@ displacedPosScreen = projectAndScale(pos);`)),n.code.add(V` gl_Position = displacedPosScreen; } } - `),i&&e.include(dd,t),e.include(oo,t),s.uniforms.add(new gr("intrinsicColor",o=>o.color),new Zt("tex",o=>o.markerTexture)),s.include(h1),e.constants.add("texelSize","float",1/xT),s.code.add(V`float markerAlpha(vec2 samplePos) { + `),i&&e.include(gd,t),e.include(ao,t),s.uniforms.add(new gr("intrinsicColor",o=>o.color),new Zt("tex",o=>o.markerTexture)),s.include(_1),e.constants.add("texelSize","float",1/OT),s.code.add(V`float markerAlpha(vec2 samplePos) { samplePos += vec2(0.5, -0.5) * texelSize; float sdf = rgba2float(texture(tex, samplePos)) - 0.5; float distance = sdf * vSize; distance -= 0.5; return clamp(0.5 - distance, 0.0, 1.0); -}`),t.hasTip&&(e.constants.add("relativeMarkerSize","float",Wle/xT),e.constants.add("relativeTipLineWidth","float",DEt),s.code.add(V` +}`),t.hasTip&&(e.constants.add("relativeMarkerSize","float",oce/OT),e.constants.add("relativeTipLineWidth","float",LTt),s.code.add(V` float tipAlpha(vec2 samplePos) { // Convert coordinates s.t. they are in pixels and relative to the tip of an arrow marker samplePos -= vec2(0.5, 0.5 + 0.5 * relativeMarkerSize); @@ -3416,7 +3405,7 @@ return clamp(0.5 - distance, 0.0, 1.0); float distance = max(abs(samplePos.x) - halfMarkerSize, abs(samplePos.y) - halfTipLineWidth); return clamp(0.5 - distance, 0.0, 1.0); } - `)),e.constants.add("symbolAlphaCutoff","float",Cl),s.code.add(V` + `)),e.constants.add("symbolAlphaCutoff","float",Ml),s.code.add(V` void main() { discardBySlice(vpos); ${i?"terrainDepthTest(depth);":""} @@ -3439,11 +3428,11 @@ return clamp(0.5 - distance, 0.0, 1.0); ${t.output===ue.Highlight?V`fragColor = vec4(1.0);`:""} ${t.output===ue.Depth?V`outputDepth(linearDepth);`:""} } - `),e}const eMt=Object.freeze(Object.defineProperty({__proto__:null,build:m8e},Symbol.toStringTag,{value:"Module"})),g8e=new Map([[J.POSITION,0],[J.UV0,1],[J.AUXPOS1,2],[J.NORMAL,3],[J.COLOR,4],[J.COLORFEATUREATTRIBUTE,4],[J.SIZE,5],[J.SIZEFEATUREATTRIBUTE,5],[J.OPACITYFEATUREATTRIBUTE,6]]);let y8e=class v8e extends Hr{initializeProgram(e){return new Ir(e.rctx,v8e.shader.get().build(this.configuration),g8e)}_makePipelineState(e,i){const r=this.configuration,n=e===Jt.NONE;return Ti({blending:r.output===ue.Color||r.output===ue.Alpha?n?vp:Y_(e):null,depthTest:{func:px(e)},depthWrite:n?r.writeDepth?rh:null:Kj(e),colorWrite:ji,stencilWrite:r.hasOccludees?Jy:null,stencilTest:r.hasOccludees?i?Z2:fx:null,polygonOffset:{factor:0,units:-10}})}initializePipeline(){return this.configuration.occluder&&(this._occluderPipelineTransparent=Ti({blending:vp,depthTest:BU,depthWrite:null,colorWrite:ji,stencilWrite:null,stencilTest:Y6e}),this._occluderPipelineOpaque=Ti({blending:vp,depthTest:BU,depthWrite:null,colorWrite:ji,stencilWrite:q6e,stencilTest:W6e}),this._occluderPipelineMaskWrite=Ti({blending:null,depthTest:Cle,depthWrite:null,colorWrite:null,stencilWrite:Jy,stencilTest:Z2})),this._occludeePipelineState=this._makePipelineState(this.configuration.transparencyPassType,!0),this._makePipelineState(this.configuration.transparencyPassType,!1)}getPipeline(e,i,r){return e?this._occludeePipelineState:this.configuration.occluder?r?this._occluderPipelineTransparent:i?this._occluderPipelineOpaque:this._occluderPipelineMaskWrite:super.getPipeline()}};y8e.shader=new Rr(eMt,()=>we(()=>Promise.resolve().then(()=>RWt),void 0));let tMt=class extends hx{constructor(e){super(e,new rMt),this._vertexAttributeLocations=g8e,this._configuration=new Na,this._layout=this.createLayout()}getConfiguration(e,i){return this._configuration.output=e,this._configuration.space=i.slot===ke.DRAPED_MATERIAL?_p.Draped:this.parameters.worldSpace?_p.World:_p.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==Df.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===Wn.OccludeAndTransparentStencil,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration.cullAboveGround=i.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=ls().vec3f(J.POSITION).vec2f(J.UV0).vec3f(J.AUXPOS1);return this.parameters.worldSpace&&e.vec3f(J.NORMAL),this.parameters.vvSize?e.f32(J.SIZEFEATUREATTRIBUTE):e.f32(J.SIZE),this.parameters.vvColor?e.f32(J.COLORFEATUREATTRIBUTE):e.vec4f(J.COLOR),this.parameters.vvOpacity&&e.f32(J.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new nMt(this._layout,this.parameters)}produces(e,i){return i===ue.Color||i===ue.Alpha||i===ue.Highlight||i===ue.Depth?e===ke.DRAPED_MATERIAL?!0:this.parameters.renderOccluded===Wn.OccludeAndTransparentStencil?e===ke.OPAQUE_MATERIAL||e===ke.OCCLUDER_MATERIAL||e===ke.TRANSPARENT_OCCLUDER_MATERIAL:i===ue.Color||i===ue.Alpha?e===(this.parameters.writeDepth?ke.TRANSPARENT_MATERIAL:ke.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL):e===ke.OPAQUE_MATERIAL:!1}createGLMaterial(e){return new iMt(e)}},iMt=class extends wae{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextureRepository.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const i=this._material.parameters.markerPrimitive;return i!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextureRepository.swap(i,this._markerPrimitive)}),this._markerPrimitive=i),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(y8e,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==ue.Color&&this._output!==ue.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}},rMt=class extends t6{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=Df.BUTT,this.anchor=eE.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1,this.markerTexture=null}},nMt=class{constructor(e,i){this.vertexBufferLayout=e,this._parameters=i}elementCount(){return this._parameters.placement==="begin-end"?12:6}write(e,i,r,n,s){const o=r.attributes.get(J.POSITION).data,l=o.length/3;let c=[1,0,0];const f=r.attributes.get(J.NORMAL);this._parameters.worldSpace&&f!=null&&(c=f.data);let _=1,x=0;this._parameters.vvSize?x=r.attributes.get(J.SIZEFEATUREATTRIBUTE).data[0]:r.attributes.has(J.SIZE)&&(_=r.attributes.get(J.SIZE).data[0]);let T=[1,1,1,1],A=0;this._parameters.vvColor?A=r.attributes.get(J.COLORFEATUREATTRIBUTE).data[0]:r.attributes.has(J.COLOR)&&(T=r.attributes.get(J.COLOR).data);let M=0;this._parameters.vvOpacity&&(M=r.attributes.get(J.OPACITYFEATUREATTRIBUTE).data[0]);const I=new Float32Array(n.buffer);let L=s*(this.vertexBufferLayout.stride/4);const F=(j,H,Y,Q)=>{if(I[L++]=j[0],I[L++]=j[1],I[L++]=j[2],I[L++]=Y[0],I[L++]=Y[1],I[L++]=H[0],I[L++]=H[1],I[L++]=H[2],this._parameters.worldSpace&&(I[L++]=c[0],I[L++]=c[1],I[L++]=c[2]),this._parameters.vvSize?I[L++]=x:I[L++]=_,this._parameters.vvColor)I[L++]=A;else{const ne=Math.min(4*Q,T.length-4);I[L++]=T[ne],I[L++]=T[ne+1],I[L++]=T[ne+2],I[L++]=T[ne+3]}this._parameters.vvOpacity&&(I[L++]=M)};let z;(function(j){j[j.ASCENDING=1]="ASCENDING",j[j.DESCENDING=-1]="DESCENDING"})(z||(z={}));const k=(j,H)=>{const Y=Ie(sMt,o[3*j],o[3*j+1],o[3*j+2]),Q=oMt;let ne=j+H;do Ie(Q,o[3*ne],o[3*ne+1],o[3*ne+2]),ne+=H;while(M2(Y,Q)&&ne>=0&&nethis._context.stage.remove(e)),this._materials.length=0}_getDrivenSize(e){return this._drivenProperties.size&&e.size?Tr(cTt(e.size)):1}_getDrivenColor(e){const i=Mi(1,1,1,1);return this._drivenProperties.color&&e.color&&(i[0]=e.color[0],i[1]=e.color[1],i[2]=e.color[2],e.color.length>0&&(i[3]=e.color[3])),this._drivenProperties.opacity&&e.opacity&&(i[3]=e.opacity),i}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,hMt,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(i);return this.ensureDrapedStatus(r.mode==="on-the-ground"),this.draped?this._createAsOverlay(e,this._context.layer.uid):this._createAs3DShape(e,r,i.uid)}applyRendererDiff(e,i){for(const r in e.diff){if(r!=="visualVariables")return To.RecreateSymbol;{const n=this._fastUpdates;if(!A5(n,i,J1e))return To.RecreateSymbol;this._forEachMaterial(s=>s==null?void 0:s.setParameters(n.materialParameters))}}return To.FastUpdate}prepareSymbolLayerPatch(e){var s,o;if(e.diff.type!=="partial")return;const i=e.diff.diff,r={};((s=i.size)==null?void 0:s.type)==="complete"&&(r.width=this._computeMaterialWidth(i.size.newValue),delete i.size),((o=i.cap)==null?void 0:o.type)==="complete"&&(r.cap=bie(i.cap.newValue??"butt"),delete i.cap);const n=this._prepareMarkerPatch(e,i);this._prepareMaterialPatch(e,i,n),e.symbolLayerStatePatches.push(()=>this._forEachMaterial(l=>l==null?void 0:l.setParameters(r)))}layerOpacityChanged(){this._forEachMaterial((e,i)=>this._updateMaterialLayerOpacity(e,i===Ks.Marker))}_forEachMaterial(e){this._materials.forEach(e)}_updateMaterialLayerOpacity(e,i=!1){var l,c;if(e==null)return;const r=e.parameters.color,n=(c=(l=this.symbolLayer)==null?void 0:l.material)==null?void 0:c.color,s=this._patternHidesLine&&!i?0:this._getCombinedOpacity(n),o=Mi(r[0],r[1],r[2],s);e.setParameters({color:o})}layerElevationInfoChanged(e,i,r){const n=this._elevationContext.mode,s=i6(w8e.elevationModeChangeTypes,r,n);if(s!==Ys.UPDATE)return s;const o=t0(n);return this.updateGraphics3DGraphicElevationInfo(e,i,()=>o)}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};return this._forEachMaterial(i=>i==null?void 0:i.setParameters(e)),!0}physicalBasedRenderingChanged(){return!0}_getGeometryAsPolygonOrPolyline(e){switch(e.type){case"extent":if(e instanceof Vi)return Qa.fromExtent(e);break;case"polygon":case"polyline":return e}return null}_createAs3DShape(e,i,r){const n=e.graphic,s=this._getGeometryAsPolygonOrPolyline(n.geometry),o=s.type==="polygon"?s.rings:s.paths,l=new Array,c=ya(),f=KAt(s,this._context.elevationProvider,this._context.renderCoordsHelper,i),_=s.type==="polygon"?"rings":"paths";this._logGeometryCreationWarnings(f,o,_,"LineSymbol3DLayer");for(let A=0;A{const F=this._createGeometry(L,e,M.position,void 0,n.type,O$.DRAPED,r.uid),z=new $5(F,{layerUid:i,graphicUid:r.uid});f.push(z)};if(c!=null){I(c);const L=this.symbolLayer.marker.placement;L!=="begin"&&L!=="begin-end"||cp(_,M.position,0,1),L!=="end"&&L!=="begin-end"||cp(_,M.position,M.position.length-3,1)}I(o),Tn.LINE_WIREFRAMES&&I(l)}return new mG(this,f,x,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return e!=null&&e.type==="style"&&e.style==="none"}_computeMaterialWidth(e){var i;return e=e??ad(1),this._drivenProperties.size?(i=this._fastUpdates)!=null&&i.visualVariables.size?Tr(1):1:Tr(e)}_prepareMaterialPatch(e,i,r){var l,c;const n=i.material;if(n==null)return void(r.changed&&r.useMaterialColor&&this._patchMaterialColor(this._getCombinedOpacityAndColor(this._materialColor),this._materials[Ks.Marker],e));if(n.type==="collection")return;const s=n.type==="complete"?(l=n.newValue)==null?void 0:l.color:((c=n.diff.color)==null?void 0:c.type)==="complete"?n.diff.color.newValue:null,o=this._getCombinedOpacityAndColor(s);r.useMaterialColor&&this._patchMaterialColor(U9(o),this._materials[Ks.Marker],e),this._patternHidesLine&&(o[3]=0),this._patchMaterialColor(o,this._materials[Ks.Line],e),delete i.material}_prepareMarkerPatch(e,i){var _;const r=i.marker,n=this._markerMaterial;if(r==null||r.type!=="partial"||r.diff==null||r.diff.placement!=null||r.diff.style!=null&&r.diff.style.type!=="complete"||r.diff.color!=null&&r.diff.color.type!=="complete"||n==null)return{changed:!1,useMaterialColor:this._markerColor==null};const s=r.diff.color,o=s!=null,l=o?s.newValue:null,c=l==null&&this._markerColor==null;l&&this._patchMaterialColor(this._getCombinedOpacityAndColor(l),n,e);const f=(_=r.diff.style)==null?void 0:_.newValue;return f&&e.symbolLayerStatePatches.push(()=>n.setParameters({markerPrimitive:Z1e(f)})),delete i.marker,{changed:o,useMaterialColor:c}}_patchMaterialColor(e,i,r){i!=null&&r.symbolLayerStatePatches.push(()=>i.setParameters({color:e}))}};var O$,Ks;b8e.elevationModeChangeTypes={definedChanged:Ys.RECREATE,staysOnTheGround:Ys.NONE,onTheGroundChanged:Ys.RECREATE},function(t){t[t.DRAPED=0]="DRAPED",t[t.ELEVATED=1]="ELEVATED"}(O$||(O$={})),function(t){t[t.Line=0]="Line",t[t.Ring=1]="Ring",t[t.LineWireframe=2]="LineWireframe",t[t.RingWireframe=3]="RingWireframe",t[t.Marker=4]="Marker"}(Ks||(Ks={}));function x8e(t,e,i){return vn(t,e,0,VN,i.spatialReference,0,1)?(i.x=VN[0],i.y=VN[1],i.z=VN[2],i):null}const VN=W();let _R=null,eV=!0;function VW(t,e,i){if(!t||!e)throw new Error("Cannot construct image data without dimensions");if(eV)try{return new ImageData(t,e)}catch{eV=!1}return S8e(t,e,i)}function dMt(t,e,i,r){if(!e||!i)throw new Error("Cannot construct image data without dimensions");if(eV)try{return new ImageData(t,e,i)}catch{eV=!1}const n=S8e(e,i,r);return n.data.set(t,0),n}function pMt(){return _R||(_R=document.createElement("canvas"),_R.width=1,_R.height=1),_R}function S8e(t,e,i){return i||(i=pMt()),i.getContext("2d").createImageData(t,e)}async function fMt(t,e){const i=window.URL.createObjectURL(t);try{const{data:r}=await bi(i,{...e,responseType:"image"});return r}catch(r){throw sn(r)?r:new se("invalid-image",`Could not fetch requested image at ${i}`)}finally{window.URL.revokeObjectURL(i)}}async function gci(t,e){const{arrayBuffer:i,mediaType:r}=await mMt(t,e),n=r==="image/png";if(r==="image/gif"){const{isAnimatedGIF:s,parseGif:o}=await we(()=>import("./gif--X7Hb6fX.js"),__vite__mapDeps([]));if(s(i))return o(i,e)}if(n){const{isAnimatedPNG:s,parseApng:o}=await we(()=>import("./apng-yUSt3z2o.js"),__vite__mapDeps([]));if(s(i))return o(i,e)}return fMt(new Blob([i],{type:r}),e)}async function mMt(t,e){const i=C2(t);if(i!=null&&i.isBase64)return{arrayBuffer:lEe(i.data),mediaType:i.mediaType};const r=await bi(t,{responseType:"array-buffer",...e});return{arrayBuffer:r.data,mediaType:r.getHeader("Content-Type")}}var GA;const BW=new WeakMap;let gMt=0,Ig=GA=class extends Ue{constructor(t){super(t),this.wrap="repeat"}get url(){return this._get("url")||null}set url(t){this._set("url",t),t&&this._set("data",null)}get data(){return this._get("data")||null}set data(t){this._set("data",t),t&&this._set("url",null)}writeData(t,e,i,r){if(t instanceof HTMLImageElement){const n={type:"image-element",src:m_(t.src,r),crossOrigin:t.crossOrigin};e[i]=n}else if(t instanceof HTMLCanvasElement){const n=t.getContext("2d").getImageData(0,0,t.width,t.height),s={type:"canvas-element",imageData:this._encodeImageData(n)};e[i]=s}else if(t instanceof HTMLVideoElement){const n={type:"video-element",src:m_(t.src,r),autoplay:t.autoplay,loop:t.loop,muted:t.muted,crossOrigin:t.crossOrigin,preload:t.preload};e[i]=n}else if(t instanceof ImageData){const n={type:"image-data",imageData:this._encodeImageData(t)};e[i]=n}}readData(t){switch(t.type){case"image-element":{const e=new Image;return e.src=t.src,e.crossOrigin=t.crossOrigin,e}case"canvas-element":{const e=this._decodeImageData(t.imageData),i=document.createElement("canvas");return i.width=e.width,i.height=e.height,i.getContext("2d").putImageData(e,0,0),i}case"image-data":return this._decodeImageData(t.imageData);case"video-element":{const e=document.createElement("video");return e.src=t.src,e.crossOrigin=t.crossOrigin,e.autoplay=t.autoplay,e.loop=t.loop,e.muted=t.muted,e.preload=t.preload,e}default:return}}get transparent(){const t=this.data,e=this.url;if(t instanceof HTMLCanvasElement)return this._imageDataContainsTransparent(t.getContext("2d").getImageData(0,0,t.width,t.height));if(t instanceof ImageData)return this._imageDataContainsTransparent(t);if(e){const i=e.substr(e.length-4,4).toLowerCase(),r=e.substr(0,15).toLocaleLowerCase();if(i===".png"||r==="data:image/png;")return!0}return!1}set transparent(t){this._overrideIfSome("transparent",t)}get contentHash(){const t=typeof this.wrap=="string"?this.wrap:typeof this.wrap=="object"?`${this.wrap.horizontal}/${this.wrap.vertical}`:"",e=(i="")=>`d:${i},t:${this.transparent},w:${t}`;return this.url!=null?e(this.url):this.data!=null?this.data instanceof HTMLImageElement||this.data instanceof HTMLVideoElement?e(this.data.src):(BW.has(this.data)||BW.set(this.data,++gMt),e(BW.get(this.data))):e()}get memoryUsage(){let t=0;if(t+=this.url!=null?this.url.length:0,this.data!=null){const e=this.data;"data"in e?t+=e.data.byteLength:e instanceof HTMLImageElement?t+=e.naturalWidth*e.naturalHeight*3:e instanceof HTMLCanvasElement&&(t+=e.width*e.height*3)}return t}clone(){const t={url:this.url,data:this.data,wrap:this._cloneWrap()};return new GA(t)}cloneWithDeduplication(t){const e=t.get(this);if(e)return e;const i=this.clone();return t.set(this,i),i}_cloneWrap(){return typeof this.wrap=="string"?this.wrap:{horizontal:this.wrap.horizontal,vertical:this.wrap.vertical}}_encodeImageData(t){let e="";for(let i=0;i{const l=()=>{f(),s(n)},c=_=>{f(),o(_)},f=()=>{URL.revokeObjectURL(r),n.removeEventListener("load",l),n.removeEventListener("error",c)};n.addEventListener("load",l),n.addEventListener("error",c),n.src=r});try{n.src=r,await n.decode()}catch{console.warn("Failed decoding HTMLImageElement")}return URL.revokeObjectURL(r),n}function hy(t){if(t==null)return null;const e=t.offset!=null?t.offset:ADe,i=t.rotation!=null?t.rotation:0,r=t.scale!=null?t.scale:MDe,n=tk(1,0,0,0,1,0,e[0],e[1],1),s=tk(Math.cos(i),-Math.sin(i),0,Math.sin(i),Math.cos(i),0,0,0,1),o=tk(r[0],0,0,0,r[1],0,0,0,1),l=Tc();return s5(l,s,o),s5(l,n,l),l}let jMt=class extends d1{constructor(){super(...arguments),this._originalGeometries=[],this._fastTransformUpdatesEnabled=!1}get fastTransformUpdatesEnabled(){return this._fastTransformUpdatesEnabled}enableFastTransformUpdates(e,i){if(this._fastTransformUpdatesEnabled)return;this._fastTransformUpdatesEnabled=!0;const{stageObject:r}=this,n=r.geometries.slice();r.removeAllGeometries();const s=zz(GW,r.transformation),o=i.getOrigin(s);for(const l of n){const c=e(l.material),f=l.instantiate({material:c});f.localOrigin=o,r.addGeometry(f)}this._originalGeometries=n}disableFastTransformUpdates(e){if(!this._fastTransformUpdatesEnabled)return;this._fastTransformUpdatesEnabled=!1;const{stageObject:i}=this,r=i.geometries.map(n=>e(n.material));i.removeAllGeometries();for(let n=0;n{f.transformation=c,f.localOrigin=l})}updateTransform(e,i,r){const{stageObject:n}=this,s=(i==null?void 0:i.localMatrix)??gs;if(!this._fastTransformUpdatesEnabled)return n.shaderTransformation=null,n.transformation=e,n.geometries.forEach(A=>{A.transformation=s}),void(this._fastUpdateEdgeTransform()||this.resetEdgeObject(r));const o=n.transformation,l=n.geometries[0].transformation,c=e,f=s,_=nn(Q1e,o,l),x=nn(eve,c,f),T=nn(tve,x,Vo(tve,l));n.shaderTransformation=T,this._setFastMaterialTransformation({matA:_,matB:x}),this._fastUpdateEdgeTransform()||this.resetEdgeObject(r)}alignWithElevation(e,i,r,n){if(!this._fastTransformUpdatesEnabled)return void super.alignWithElevation(e,i,r,n);r!=null&&rG(this.elevationContext.featureExpressionInfoContext,r);const s=(M,I)=>Y2(M,e,this.elevationContext,i,I),{stageObject:o}=this;if(!o.geometries[0].material.parameters.modelTransformation)return;const l=o.transformation,c=o.geometries[0].transformation,f=nn(Q1e,l,c),_=o.effectiveTransformation,x=Ao(GMt,_);this.alignedSampledElevation=_T(this,this.elevationContext,e.spatialReference,s,i,x),o.shaderTransformation=x;const T=o.geometries[0].transformation,A=nn(eve,x,T);this._setFastMaterialTransformation({matA:f,matB:A}),this._fastUpdateEdgeTransform()||this.resetEdgeObject(n)}_setFastMaterialTransformation({matA:e,matB:i}){const{stageObject:r}=this;if(r.geometries.length===0)return;const n=r.geometries[0].localOrigin,s=L9(HMt,De(GW,n.vec3,-1)),o=nn(ive,s,e),l=nn(rve,s,i),c=Vo(ive,o),f=nn(rve,l,c);for(const _ of r.geometries)_.material.setParameters({modelTransformation:f})}_fastUpdateEdgeTransform(){return this._stageLayer.stage.renderer.ensureEdgeView().fastUpdateObject3DEdgesTransform(this.stageObject)}};const GW=W(),Q1e=Qe(),eve=Qe(),GMt=Qe(),tve=Qe(),ive=Qe(),rve=Qe(),HMt=Qe();let qMt=class{constructor(){this._fastTransformOriginalMaterials=new Map,this._fastTransformClonedMaterials=new Map,this._graphicReferenceCount=0}enable(e,i,r){e.enableFastTransformUpdates(n=>{if(this._graphicReferenceCount<=1){if(this._fastTransformOriginalMaterials.has(n))return n;const o=i.byMaterial(n);return this._fastTransformOriginalMaterials.set(n,o),i.delete(n),n}const s=new km(n.parameters);return r.stage.add(s),this._fastTransformClonedMaterials.set(s,n),s},r.localOriginFactory)}disable(e,i,r){const n=new Set,s=new Set;e.disableFastTransformUpdates(o=>{if(!this._fastTransformClonedMaterials.has(o)){const f=o,_=this._fastTransformOriginalMaterials.get(f);return i.has(_.uid)?(n.add(f),i.byUid(_.uid).material):(s.add(f),_.material)}const l=o,c=this._fastTransformClonedMaterials.get(l);return this._fastTransformClonedMaterials.delete(l),r.stage.remove(l),c});for(const o of n)this._fastTransformOriginalMaterials.delete(o),r.stage.remove(o);for(const o of s){const l=this._fastTransformOriginalMaterials.get(o);this._fastTransformOriginalMaterials.delete(o),i.set(l.uid,l)}}onAddGraphic(){this._graphicReferenceCount++}onRemoveGraphic(e,i,r){this._graphicReferenceCount--,this.disable(e,i,r)}forEachMaterialInfo(e){this._fastTransformOriginalMaterials.forEach(e)}forEachClonedMaterial(e){this._fastTransformClonedMaterials.forEach(e)}destroy(e){e.removeMany(Array.from(this._fastTransformClonedMaterials.keys())),e.removeMany(Array.from(this._fastTransformOriginalMaterials.values(),({material:i})=>i)),this._fastTransformClonedMaterials.clear(),this._fastTransformOriginalMaterials.clear()}},WMt=class{constructor(){this._byUid=new Map,this._byMaterial=new Map}get materials(){return Array.from(this._byUid.values(),e=>e.material)}byUid(e){return this._byUid.get(e)}byMaterial(e){return this._byMaterial.get(e)}set(e,i){this._byUid.set(e,i),this._byMaterial.set(i.material,i)}delete(e){var r;const i=(r=this._byMaterial.get(e))==null?void 0:r.uid;i&&(this._byUid.delete(i),this._byMaterial.delete(e))}has(e){return this._byUid.has(e)}forEachMaterialInfo(e){this._byUid.forEach(e)}clear(){this._byUid.clear(),this._byMaterial.clear()}};function U8e(t){const e=new Cr,{vertex:i,fragment:r}=e;return e.include(Yu,t),e.include(ME,t),Kh(i,t),e.attributes.add(J.POSITION,"vec3"),e.varyings.add("vpos","vec3"),i.code.add(V`void main(void) { + `),e}const QCt=Object.freeze(Object.defineProperty({__proto__:null,build:d8e},Symbol.toStringTag,{value:"Module"})),p8e=new Map([[J.POSITION,0],[J.UV0,1],[J.AUXPOS1,2],[J.NORMAL,3],[J.COLOR,4],[J.COLORFEATUREATTRIBUTE,4],[J.SIZE,5],[J.SIZEFEATUREATTRIBUTE,5],[J.OPACITYFEATUREATTRIBUTE,6]]);let f8e=class m8e extends Hr{initializeProgram(e){return new $r(e.rctx,m8e.shader.get().build(this.configuration),p8e)}_makePipelineState(e,i){const r=this.configuration,n=e===Jt.NONE;return Ti({blending:r.output===ue.Color||r.output===ue.Alpha?n?xp:Q_(e):null,depthTest:{func:_x(e)},depthWrite:n?r.writeDepth?sh:null:lG(e),colorWrite:ji,stencilWrite:r.hasOccludees?n1:null,stencilTest:r.hasOccludees?i?tx:bx:null,polygonOffset:{factor:0,units:-10}})}initializePipeline(){return this.configuration.occluder&&(this._occluderPipelineTransparent=Ti({blending:xp,depthTest:jU,depthWrite:null,colorWrite:ji,stencilWrite:null,stencilTest:G6e}),this._occluderPipelineOpaque=Ti({blending:xp,depthTest:jU,depthWrite:null,colorWrite:ji,stencilWrite:B6e,stencilTest:j6e}),this._occluderPipelineMaskWrite=Ti({blending:null,depthTest:zle,depthWrite:null,colorWrite:null,stencilWrite:n1,stencilTest:tx})),this._occludeePipelineState=this._makePipelineState(this.configuration.transparencyPassType,!0),this._makePipelineState(this.configuration.transparencyPassType,!1)}getPipeline(e,i,r){return e?this._occludeePipelineState:this.configuration.occluder?r?this._occluderPipelineTransparent:i?this._occluderPipelineOpaque:this._occluderPipelineMaskWrite:super.getPipeline()}};f8e.shader=new Ir(QCt,()=>we(()=>Promise.resolve().then(()=>pXt),void 0));let eAt=class extends yx{constructor(e){super(e,new iAt),this._vertexAttributeLocations=p8e,this._configuration=new Fa,this._layout=this.createLayout()}getConfiguration(e,i){return this._configuration.output=e,this._configuration.space=i.slot===ke.DRAPED_MATERIAL?Sp.Draped:this.parameters.worldSpace?Sp.World:Sp.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==Uf.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===Yn.OccludeAndTransparentStencil,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration.cullAboveGround=i.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=ls().vec3f(J.POSITION).vec2f(J.UV0).vec3f(J.AUXPOS1);return this.parameters.worldSpace&&e.vec3f(J.NORMAL),this.parameters.vvSize?e.f32(J.SIZEFEATUREATTRIBUTE):e.f32(J.SIZE),this.parameters.vvColor?e.f32(J.COLORFEATUREATTRIBUTE):e.vec4f(J.COLOR),this.parameters.vvOpacity&&e.f32(J.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new rAt(this._layout,this.parameters)}produces(e,i){return i===ue.Color||i===ue.Alpha||i===ue.Highlight||i===ue.Depth?e===ke.DRAPED_MATERIAL?!0:this.parameters.renderOccluded===Yn.OccludeAndTransparentStencil?e===ke.OPAQUE_MATERIAL||e===ke.OCCLUDER_MATERIAL||e===ke.TRANSPARENT_OCCLUDER_MATERIAL:i===ue.Color||i===ue.Alpha?e===(this.parameters.writeDepth?ke.TRANSPARENT_MATERIAL:ke.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL):e===ke.OPAQUE_MATERIAL:!1}createGLMaterial(e){return new tAt(e)}},tAt=class extends Lae{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextureRepository.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const i=this._material.parameters.markerPrimitive;return i!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextureRepository.swap(i,this._markerPrimitive)}),this._markerPrimitive=i),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(f8e,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==ue.Color&&this._output!==ue.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}},iAt=class extends o6{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=Uf.BUTT,this.anchor=nE.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1,this.markerTexture=null}},rAt=class{constructor(e,i){this.vertexBufferLayout=e,this._parameters=i}elementCount(){return this._parameters.placement==="begin-end"?12:6}write(e,i,r,n,s){const o=r.attributes.get(J.POSITION).data,a=o.length/3;let c=[1,0,0];const p=r.attributes.get(J.NORMAL);this._parameters.worldSpace&&p!=null&&(c=p.data);let _=1,x=0;this._parameters.vvSize?x=r.attributes.get(J.SIZEFEATUREATTRIBUTE).data[0]:r.attributes.has(J.SIZE)&&(_=r.attributes.get(J.SIZE).data[0]);let S=[1,1,1,1],C=0;this._parameters.vvColor?C=r.attributes.get(J.COLORFEATUREATTRIBUTE).data[0]:r.attributes.has(J.COLOR)&&(S=r.attributes.get(J.COLOR).data);let M=0;this._parameters.vvOpacity&&(M=r.attributes.get(J.OPACITYFEATUREATTRIBUTE).data[0]);const P=new Float32Array(n.buffer);let $=s*(this.vertexBufferLayout.stride/4);const F=(j,G,Y,Q)=>{if(P[$++]=j[0],P[$++]=j[1],P[$++]=j[2],P[$++]=Y[0],P[$++]=Y[1],P[$++]=G[0],P[$++]=G[1],P[$++]=G[2],this._parameters.worldSpace&&(P[$++]=c[0],P[$++]=c[1],P[$++]=c[2]),this._parameters.vvSize?P[$++]=x:P[$++]=_,this._parameters.vvColor)P[$++]=C;else{const ne=Math.min(4*Q,S.length-4);P[$++]=S[ne],P[$++]=S[ne+1],P[$++]=S[ne+2],P[$++]=S[ne+3]}this._parameters.vvOpacity&&(P[$++]=M)};let z;(function(j){j[j.ASCENDING=1]="ASCENDING",j[j.DESCENDING=-1]="DESCENDING"})(z||(z={}));const k=(j,G)=>{const Y=Ie(nAt,o[3*j],o[3*j+1],o[3*j+2]),Q=sAt;let ne=j+G;do Ie(Q,o[3*ne],o[3*ne+1],o[3*ne+2]),ne+=G;while(L2(Y,Q)&&ne>=0&&nethis._context.stage.remove(e)),this._materials.length=0}_getDrivenSize(e){return this._drivenProperties.size&&e.size?Er(lSt(e.size)):1}_getDrivenColor(e){const i=Mi(1,1,1,1);return this._drivenProperties.color&&e.color&&(i[0]=e.color[0],i[1]=e.color[1],i[2]=e.color[2],e.color.length>0&&(i[3]=e.color[3])),this._drivenProperties.opacity&&e.opacity&&(i[3]=e.opacity),i}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,uAt,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(i);return this.ensureDrapedStatus(r.mode==="on-the-ground"),this.draped?this._createAsOverlay(e,this._context.layer.uid):this._createAs3DShape(e,r,i.uid)}applyRendererDiff(e,i){for(const r in e.diff){if(r!=="visualVariables")return Eo.RecreateSymbol;{const n=this._fastUpdates;if(!NP(n,i,K1e))return Eo.RecreateSymbol;this._forEachMaterial(s=>s==null?void 0:s.setParameters(n.materialParameters))}}return Eo.FastUpdate}prepareSymbolLayerPatch(e){var s,o;if(e.diff.type!=="partial")return;const i=e.diff.diff,r={};((s=i.size)==null?void 0:s.type)==="complete"&&(r.width=this._computeMaterialWidth(i.size.newValue),delete i.size),((o=i.cap)==null?void 0:o.type)==="complete"&&(r.cap=Mie(i.cap.newValue??"butt"),delete i.cap);const n=this._prepareMarkerPatch(e,i);this._prepareMaterialPatch(e,i,n),e.symbolLayerStatePatches.push(()=>this._forEachMaterial(a=>a==null?void 0:a.setParameters(r)))}layerOpacityChanged(){this._forEachMaterial((e,i)=>this._updateMaterialLayerOpacity(e,i===Qs.Marker))}_forEachMaterial(e){this._materials.forEach(e)}_updateMaterialLayerOpacity(e,i=!1){var a,c;if(e==null)return;const r=e.parameters.color,n=(c=(a=this.symbolLayer)==null?void 0:a.material)==null?void 0:c.color,s=this._patternHidesLine&&!i?0:this._getCombinedOpacity(n),o=Mi(r[0],r[1],r[2],s);e.setParameters({color:o})}layerElevationInfoChanged(e,i,r){const n=this._elevationContext.mode,s=a6(v8e.elevationModeChangeTypes,r,n);if(s!==Ys.UPDATE)return s;const o=s0(n);return this.updateGraphics3DGraphicElevationInfo(e,i,()=>o)}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};return this._forEachMaterial(i=>i==null?void 0:i.setParameters(e)),!0}physicalBasedRenderingChanged(){return!0}_getGeometryAsPolygonOrPolyline(e){switch(e.type){case"extent":if(e instanceof Vi)return tl.fromExtent(e);break;case"polygon":case"polyline":return e}return null}_createAs3DShape(e,i,r){const n=e.graphic,s=this._getGeometryAsPolygonOrPolyline(n.geometry),o=s.type==="polygon"?s.rings:s.paths,a=new Array,c=va(),p=JCt(s,this._context.elevationProvider,this._context.renderCoordsHelper,i),_=s.type==="polygon"?"rings":"paths";this._logGeometryCreationWarnings(p,o,_,"LineSymbol3DLayer");for(let C=0;C{const F=this._createGeometry($,e,M.position,void 0,n.type,z$.DRAPED,r.uid),z=new BP(F,{layerUid:i,graphicUid:r.uid});p.push(z)};if(c!=null){P(c);const $=this.symbolLayer.marker.placement;$!=="begin"&&$!=="begin-end"||pp(_,M.position,0,1),$!=="end"&&$!=="begin-end"||pp(_,M.position,M.position.length-3,1)}P(o),En.LINE_WIREFRAMES&&P(a)}return new EG(this,p,x,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return e!=null&&e.type==="style"&&e.style==="none"}_computeMaterialWidth(e){var i;return e=e??cd(1),this._drivenProperties.size?(i=this._fastUpdates)!=null&&i.visualVariables.size?Er(1):1:Er(e)}_prepareMaterialPatch(e,i,r){var a,c;const n=i.material;if(n==null)return void(r.changed&&r.useMaterialColor&&this._patchMaterialColor(this._getCombinedOpacityAndColor(this._materialColor),this._materials[Qs.Marker],e));if(n.type==="collection")return;const s=n.type==="complete"?(a=n.newValue)==null?void 0:a.color:((c=n.diff.color)==null?void 0:c.type)==="complete"?n.diff.color.newValue:null,o=this._getCombinedOpacityAndColor(s);r.useMaterialColor&&this._patchMaterialColor(G9(o),this._materials[Qs.Marker],e),this._patternHidesLine&&(o[3]=0),this._patchMaterialColor(o,this._materials[Qs.Line],e),delete i.material}_prepareMarkerPatch(e,i){var _;const r=i.marker,n=this._markerMaterial;if(r==null||r.type!=="partial"||r.diff==null||r.diff.placement!=null||r.diff.style!=null&&r.diff.style.type!=="complete"||r.diff.color!=null&&r.diff.color.type!=="complete"||n==null)return{changed:!1,useMaterialColor:this._markerColor==null};const s=r.diff.color,o=s!=null,a=o?s.newValue:null,c=a==null&&this._markerColor==null;a&&this._patchMaterialColor(this._getCombinedOpacityAndColor(a),n,e);const p=(_=r.diff.style)==null?void 0:_.newValue;return p&&e.symbolLayerStatePatches.push(()=>n.setParameters({markerPrimitive:J1e(p)})),delete i.marker,{changed:o,useMaterialColor:c}}_patchMaterialColor(e,i,r){i!=null&&r.symbolLayerStatePatches.push(()=>i.setParameters({color:e}))}};var z$,Qs;y8e.elevationModeChangeTypes={definedChanged:Ys.RECREATE,staysOnTheGround:Ys.NONE,onTheGroundChanged:Ys.RECREATE},function(t){t[t.DRAPED=0]="DRAPED",t[t.ELEVATED=1]="ELEVATED"}(z$||(z$={})),function(t){t[t.Line=0]="Line",t[t.Ring=1]="Ring",t[t.LineWireframe=2]="LineWireframe",t[t.RingWireframe=3]="RingWireframe",t[t.Marker=4]="Marker"}(Qs||(Qs={}));function _8e(t,e,i){return un(t,e,0,YN,i.spatialReference,0,1)?(i.x=YN[0],i.y=YN[1],i.z=YN[2],i):null}const YN=W();let PR=null,tV=!0;function JW(t,e,i){if(!t||!e)throw new Error("Cannot construct image data without dimensions");if(tV)try{return new ImageData(t,e)}catch{tV=!1}return b8e(t,e,i)}function hAt(t,e,i,r){if(!e||!i)throw new Error("Cannot construct image data without dimensions");if(tV)try{return new ImageData(t,e,i)}catch{tV=!1}const n=b8e(e,i,r);return n.data.set(t,0),n}function dAt(){return PR||(PR=document.createElement("canvas"),PR.width=1,PR.height=1),PR}function b8e(t,e,i){return i||(i=dAt()),i.getContext("2d").createImageData(t,e)}async function pAt(t,e){const i=window.URL.createObjectURL(t);try{const{data:r}=await yi(i,{...e,responseType:"image"});return r}catch(r){throw on(r)?r:new se("invalid-image",`Could not fetch requested image at ${i}`)}finally{window.URL.revokeObjectURL(i)}}async function Sui(t,e){const{arrayBuffer:i,mediaType:r}=await fAt(t,e),n=r==="image/png";if(r==="image/gif"){const{isAnimatedGIF:s,parseGif:o}=await we(()=>import("./gif-NERjgkz0.js"),__vite__mapDeps([]));if(s(i))return o(i,e)}if(n){const{isAnimatedPNG:s,parseApng:o}=await we(()=>import("./apng-_AWHiAIA.js"),__vite__mapDeps([]));if(s(i))return o(i,e)}return pAt(new Blob([i],{type:r}),e)}async function fAt(t,e){const i=I2(t);if(i!=null&&i.isBase64)return{arrayBuffer:RTe(i.data),mediaType:i.mediaType};const r=await yi(t,{responseType:"array-buffer",...e});return{arrayBuffer:r.data,mediaType:r.getHeader("Content-Type")}}var YA;const KW=new WeakMap;let mAt=0,Ng=YA=class extends Ue{constructor(t){super(t),this.wrap="repeat"}get url(){return this._get("url")||null}set url(t){this._set("url",t),t&&this._set("data",null)}get data(){return this._get("data")||null}set data(t){this._set("data",t),t&&this._set("url",null)}writeData(t,e,i,r){if(t instanceof HTMLImageElement){const n={type:"image-element",src:x_(t.src,r),crossOrigin:t.crossOrigin};e[i]=n}else if(t instanceof HTMLCanvasElement){const n=t.getContext("2d").getImageData(0,0,t.width,t.height),s={type:"canvas-element",imageData:this._encodeImageData(n)};e[i]=s}else if(t instanceof HTMLVideoElement){const n={type:"video-element",src:x_(t.src,r),autoplay:t.autoplay,loop:t.loop,muted:t.muted,crossOrigin:t.crossOrigin,preload:t.preload};e[i]=n}else if(t instanceof ImageData){const n={type:"image-data",imageData:this._encodeImageData(t)};e[i]=n}}readData(t){switch(t.type){case"image-element":{const e=new Image;return e.src=t.src,e.crossOrigin=t.crossOrigin,e}case"canvas-element":{const e=this._decodeImageData(t.imageData),i=document.createElement("canvas");return i.width=e.width,i.height=e.height,i.getContext("2d").putImageData(e,0,0),i}case"image-data":return this._decodeImageData(t.imageData);case"video-element":{const e=document.createElement("video");return e.src=t.src,e.crossOrigin=t.crossOrigin,e.autoplay=t.autoplay,e.loop=t.loop,e.muted=t.muted,e.preload=t.preload,e}default:return}}get transparent(){const t=this.data,e=this.url;if(t instanceof HTMLCanvasElement)return this._imageDataContainsTransparent(t.getContext("2d").getImageData(0,0,t.width,t.height));if(t instanceof ImageData)return this._imageDataContainsTransparent(t);if(e){const i=e.substr(e.length-4,4).toLowerCase(),r=e.substr(0,15).toLocaleLowerCase();if(i===".png"||r==="data:image/png;")return!0}return!1}set transparent(t){this._overrideIfSome("transparent",t)}get contentHash(){const t=typeof this.wrap=="string"?this.wrap:typeof this.wrap=="object"?`${this.wrap.horizontal}/${this.wrap.vertical}`:"",e=(i="")=>`d:${i},t:${this.transparent},w:${t}`;return this.url!=null?e(this.url):this.data!=null?this.data instanceof HTMLImageElement||this.data instanceof HTMLVideoElement?e(this.data.src):(KW.has(this.data)||KW.set(this.data,++mAt),e(KW.get(this.data))):e()}get memoryUsage(){let t=0;if(t+=this.url!=null?this.url.length:0,this.data!=null){const e=this.data;"data"in e?t+=e.data.byteLength:e instanceof HTMLImageElement?t+=e.naturalWidth*e.naturalHeight*3:e instanceof HTMLCanvasElement&&(t+=e.width*e.height*3)}return t}clone(){const t={url:this.url,data:this.data,wrap:this._cloneWrap()};return new YA(t)}cloneWithDeduplication(t){const e=t.get(this);if(e)return e;const i=this.clone();return t.set(this,i),i}_cloneWrap(){return typeof this.wrap=="string"?this.wrap:{horizontal:this.wrap.horizontal,vertical:this.wrap.vertical}}_encodeImageData(t){let e="";for(let i=0;i{const a=()=>{p(),s(n)},c=_=>{p(),o(_)},p=()=>{URL.revokeObjectURL(r),n.removeEventListener("load",a),n.removeEventListener("error",c)};n.addEventListener("load",a),n.addEventListener("error",c),n.src=r});try{n.src=r,await n.decode()}catch{console.warn("Failed decoding HTMLImageElement")}return URL.revokeObjectURL(r),n}function gy(t){if(t==null)return null;const e=t.offset!=null?t.offset:SDe,i=t.rotation!=null?t.rotation:0,r=t.scale!=null?t.scale:TDe,n=hk(1,0,0,0,1,0,e[0],e[1],1),s=hk(Math.cos(i),-Math.sin(i),0,Math.sin(i),Math.cos(i),0,0,0,1),o=hk(r[0],0,0,0,r[1],0,0,0,1),a=Mc();return fP(a,s,o),fP(a,n,a),a}let BAt=class extends b1{constructor(){super(...arguments),this._originalGeometries=[],this._fastTransformUpdatesEnabled=!1}get fastTransformUpdatesEnabled(){return this._fastTransformUpdatesEnabled}enableFastTransformUpdates(e,i){if(this._fastTransformUpdatesEnabled)return;this._fastTransformUpdatesEnabled=!0;const{stageObject:r}=this,n=r.geometries.slice();r.removeAllGeometries();const s=$z(eY,r.transformation),o=i.getOrigin(s);for(const a of n){const c=e(a.material),p=a.instantiate({material:c});p.localOrigin=o,r.addGeometry(p)}this._originalGeometries=n}disableFastTransformUpdates(e){if(!this._fastTransformUpdatesEnabled)return;this._fastTransformUpdatesEnabled=!1;const{stageObject:i}=this,r=i.geometries.map(n=>e(n.material));i.removeAllGeometries();for(let n=0;n{p.transformation=c,p.localOrigin=a})}updateTransform(e,i,r){const{stageObject:n}=this,s=(i==null?void 0:i.localMatrix)??gs;if(!this._fastTransformUpdatesEnabled)return n.shaderTransformation=null,n.transformation=e,n.geometries.forEach(C=>{C.transformation=s}),void(this._fastUpdateEdgeTransform()||this.resetEdgeObject(r));const o=n.transformation,a=n.geometries[0].transformation,c=e,p=s,_=sn(eve,o,a),x=sn(tve,c,p),S=sn(ive,x,Bo(ive,a));n.shaderTransformation=S,this._setFastMaterialTransformation({matA:_,matB:x}),this._fastUpdateEdgeTransform()||this.resetEdgeObject(r)}alignWithElevation(e,i,r,n){if(!this._fastTransformUpdatesEnabled)return void super.alignWithElevation(e,i,r,n);r!=null&&pG(this.elevationContext.featureExpressionInfoContext,r);const s=(M,P)=>Q2(M,e,this.elevationContext,i,P),{stageObject:o}=this;if(!o.geometries[0].material.parameters.modelTransformation)return;const a=o.transformation,c=o.geometries[0].transformation,p=sn(eve,a,c),_=o.effectiveTransformation,x=Mo(jAt,_);this.alignedSampledElevation=CT(this,this.elevationContext,e.spatialReference,s,i,x),o.shaderTransformation=x;const S=o.geometries[0].transformation,C=sn(tve,x,S);this._setFastMaterialTransformation({matA:p,matB:C}),this._fastUpdateEdgeTransform()||this.resetEdgeObject(n)}_setFastMaterialTransformation({matA:e,matB:i}){const{stageObject:r}=this;if(r.geometries.length===0)return;const n=r.geometries[0].localOrigin,s=D9(GAt,De(eY,n.vec3,-1)),o=sn(rve,s,e),a=sn(nve,s,i),c=Bo(rve,o),p=sn(nve,a,c);for(const _ of r.geometries)_.material.setParameters({modelTransformation:p})}_fastUpdateEdgeTransform(){return this._stageLayer.stage.renderer.ensureEdgeView().fastUpdateObject3DEdgesTransform(this.stageObject)}};const eY=W(),eve=Qe(),tve=Qe(),jAt=Qe(),ive=Qe(),rve=Qe(),nve=Qe(),GAt=Qe();let HAt=class{constructor(){this._fastTransformOriginalMaterials=new Map,this._fastTransformClonedMaterials=new Map,this._graphicReferenceCount=0}enable(e,i,r){e.enableFastTransformUpdates(n=>{if(this._graphicReferenceCount<=1){if(this._fastTransformOriginalMaterials.has(n))return n;const o=i.byMaterial(n);return this._fastTransformOriginalMaterials.set(n,o),i.delete(n),n}const s=new Vm(n.parameters);return r.stage.add(s),this._fastTransformClonedMaterials.set(s,n),s},r.localOriginFactory)}disable(e,i,r){const n=new Set,s=new Set;e.disableFastTransformUpdates(o=>{if(!this._fastTransformClonedMaterials.has(o)){const p=o,_=this._fastTransformOriginalMaterials.get(p);return i.has(_.uid)?(n.add(p),i.byUid(_.uid).material):(s.add(p),_.material)}const a=o,c=this._fastTransformClonedMaterials.get(a);return this._fastTransformClonedMaterials.delete(a),r.stage.remove(a),c});for(const o of n)this._fastTransformOriginalMaterials.delete(o),r.stage.remove(o);for(const o of s){const a=this._fastTransformOriginalMaterials.get(o);this._fastTransformOriginalMaterials.delete(o),i.set(a.uid,a)}}onAddGraphic(){this._graphicReferenceCount++}onRemoveGraphic(e,i,r){this._graphicReferenceCount--,this.disable(e,i,r)}forEachMaterialInfo(e){this._fastTransformOriginalMaterials.forEach(e)}forEachClonedMaterial(e){this._fastTransformClonedMaterials.forEach(e)}destroy(e){e.removeMany(Array.from(this._fastTransformClonedMaterials.keys())),e.removeMany(Array.from(this._fastTransformOriginalMaterials.values(),({material:i})=>i)),this._fastTransformClonedMaterials.clear(),this._fastTransformOriginalMaterials.clear()}},qAt=class{constructor(){this._byUid=new Map,this._byMaterial=new Map}get materials(){return Array.from(this._byUid.values(),e=>e.material)}byUid(e){return this._byUid.get(e)}byMaterial(e){return this._byMaterial.get(e)}set(e,i){this._byUid.set(e,i),this._byMaterial.set(i.material,i)}delete(e){var r;const i=(r=this._byMaterial.get(e))==null?void 0:r.uid;i&&(this._byUid.delete(i),this._byMaterial.delete(e))}has(e){return this._byUid.has(e)}forEachMaterialInfo(e){this._byUid.forEach(e)}clear(){this._byUid.clear(),this._byMaterial.clear()}};function F8e(t){const e=new Ar,{vertex:i,fragment:r}=e;return e.include(Zu,t),e.include(LE,t),td(i,t),e.attributes.add(J.POSITION,"vec3"),e.varyings.add("vpos","vec3"),i.code.add(V`void main(void) { vpos = position; forwardNormalizedVertexColor(); gl_Position = transformPosition(proj, view, vpos); -}`),t.output===ue.Highlight&&e.include(dx,t),e.include(oo,t),r.uniforms.add(new ft("alphaCoverage",(n,s)=>Math.min(1,n.width*s.camera.pixelRatio))),t.hasVertexColors||r.uniforms.add(new gr("constantColor",n=>n.color)),r.code.add(V` +}`),t.output===ue.Highlight&&e.include(vx,t),e.include(ao,t),r.uniforms.add(new ft("alphaCoverage",(n,s)=>Math.min(1,n.width*s.camera.pixelRatio))),t.hasVertexColors||r.uniforms.add(new gr("constantColor",n=>n.color)),r.code.add(V` void main() { discardBySlice(vpos); @@ -3451,24 +3440,24 @@ gl_Position = transformPosition(proj, view, vpos); ${t.output===ue.ObjectAndLayerIdColor?V`color.a = 1.0;`:""} - if (color.a < ${V.float(Cl)}) { + if (color.a < ${V.float(Ml)}) { discard; } ${t.output===ue.Color?V`fragColor = highlightSlice(color, vpos);`:""} ${t.output===ue.Highlight?V`outputHighlight();`:""} } - `),e}const YMt=Object.freeze(Object.defineProperty({__proto__:null,build:U8e},Symbol.toStringTag,{value:"Module"}));let V8e=class B8e extends Hr{initializeProgram(e){return new Ir(e.rctx,B8e.shader.get().build(this.configuration),Er)}initializePipeline(){const e=this.configuration,i=Ol(st.SRC_ALPHA,st.ONE,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),r=(n,s=null,o=null)=>Ti({blending:s,depthTest:Cle,depthWrite:o,colorWrite:ji,stencilWrite:e.hasOccludees?Jy:null,stencilTest:e.hasOccludees?n?Z2:fx:null});return e.output===ue.Color?(this._occludeePipelineState=r(!0,e.transparent?i:null,rh),r(!1,e.transparent?i:null,rh)):r(!1)}get primitiveType(){return sr.LINES}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}};V8e.shader=new Rr(YMt,()=>we(()=>Promise.resolve().then(()=>IWt),void 0));let WA=class extends hu{constructor(){super(...arguments),this.output=ue.Color,this.hasSlicePlane=!1,this.hasVertexColors=!1,this.transparent=!1,this.hasOccludees=!1}};y([fe({count:ue.COUNT})],WA.prototype,"output",void 0),y([fe()],WA.prototype,"hasSlicePlane",void 0),y([fe()],WA.prototype,"hasVertexColors",void 0),y([fe()],WA.prototype,"transparent",void 0),y([fe()],WA.prototype,"hasOccludees",void 0);let nve=class extends hx{constructor(e){super(e,new ZMt),this._configuration=new WA}getConfiguration(e){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration}intersect(e,i,r,n,s,o){if(!r.options.selectionMode||!e.visible)return;if(!BIe(i))return void Ce.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const l=e.attributes.get(J.POSITION).data,c=r.camera,f=KMt;Qo(f,r.point);const _=2;Ie(wR[0],f[0]-_,f[1]+_,0),Ie(wR[1],f[0]+_,f[1]+_,0),Ie(wR[2],f[0]+_,f[1]-_,0),Ie(wR[3],f[0]-_,f[1]-_,0);for(let I=0;I<4;I++)if(!c.unprojectFromRenderScreen(wR[I],E1[I]))return;jl(c.eye,E1[0],E1[1],HW),jl(c.eye,E1[1],E1[2],qW),jl(c.eye,E1[2],E1[3],WW),jl(c.eye,E1[3],E1[0],YW);let x=Number.MAX_VALUE,T=0;for(let I=0;I0){je(lg,wu,xu);const F=c.frustum,z=-fn(F[Rn.NEAR],wu)/Ve(lg,F[Rn.NEAR]);De(lg,lg,z),Be(wu,wu,lg),c.projectToRenderScreen(wu,zx)}else if(zx[2]>0&&Ux[2]<0){je(lg,xu,wu);const F=c.frustum,z=-fn(F[Rn.NEAR],xu)/Ve(lg,F[Rn.NEAR]);De(lg,lg,z),Be(xu,xu,lg),c.projectToRenderScreen(xu,Ux)}else if(zx[2]<0&&Ux[2]<0)continue;zx[2]=0,Ux[2]=0;const L=Yoe(gT(zx,Ux,ave),f);Le.unload()),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,QMt,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(i),n=e.renderingInfo;return this._createAs3DShape(i,n,r,i.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,i){const r=this._getLayerOpacity();this._updateMaterialParameters(n=>{n.material.setParameters({layerOpacity:r});const s=n.material.parameters;this._setMaterialTransparentParameter(s,n),n.material.setParameters({transparent:s.transparent})}),e.forEach(n=>{var s;return(s=i(n))==null?void 0:s.layerOpacityChanged(r,this._context.isAsync)})}layerElevationInfoChanged(e,i){return this.updateGraphics3DGraphicElevationInfo(e,i,X2)}slicePlaneEnabledChanged(e,i){return this._updateMaterialParameters(({material:r})=>{r.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e.forEach(r=>{var n;return(n=i(r))==null?void 0:n.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters(({material:i})=>i.setParameters({usePBR:e})),!0}updateTransform(e,i,r,n){const s=this._context.renderCoordsHelper.spatialReference,o=tOt,{origin:l,transform:c}=r;switch(uu(i,Ie(Ma,l.x,l.y,l.z??0),o,s),n){case R$.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case R$.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case R$.UpdateFastLocalOrigin:e.updateFastLocalOrigin(o,c,this._context.localOriginFactory)}const{elevationContext:f}=e;f.centerPointInElevationSR=this._getCenterPointInElevationSR(o);const{elevationProvider:_,renderCoordsHelper:x}=this._context,T=(A,M)=>Y2(A,_,f,x,M);return e.alignedSampledElevation=_T(e,f,_.spatialReference,T,x,o),e.updateTransform(o,c,this._context.isAsync),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(e){return e==null?"-":e instanceof qe?e.toHex():e.contentHash}_materialPropertiesDefault(e,i){const r=this._requiresSymbolVertexColors(),n=!!e.vertexAttributes.color,s=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:n,hasVertexTangents:s,uid:`vc:${n},vt:${s},vct${i},svc:${r}`}}_textureTransformUid(e){const{offset:i,scale:r,rotation:n}=e??rOt;return`${i[0]},${i[1]},${n},${r[0]},${r[1]}`}_materialProperties(e,i,r){const n=this._materialPropertiesDefault(e,r);if(!i.material)return n;const{color:s,colorTexture:o,colorTextureTransform:l,normalTexture:c,normalTextureTransform:f,doubleSided:_,alphaCutoff:x,alphaMode:T}=i.material,A=this._colorOrTextureUid(s),M=this._colorOrTextureUid(o),I=this._textureTransformUid(l),L=this._colorOrTextureUid(c),F=this._textureTransformUid(f);if(n.color=s,n.colorTexture=o,n.normalTexture=c,n.uid=`${n.uid},cmuid:${A},ctmuid:${M},cttuid:${I},ntmuid:${L},nttuid:${F},ds:${_},ac:${x},am:${T}`,i.material instanceof T8e){const{metallic:z,roughness:k,metallicRoughnessTexture:U,metallicRoughnessTextureTransform:j,emissiveColor:H,emissiveTexture:Y,emissiveTextureTransform:Q,occlusionTexture:ne,occlusionTextureTransform:re}=i.material,he=this._colorOrTextureUid(U),ce=this._textureTransformUid(j),be=this._colorOrTextureUid(H),ye=this._colorOrTextureUid(Y),pe=this._textureTransformUid(Q),Ee=this._colorOrTextureUid(ne),te=this._textureTransformUid(re);n.metallic=z,n.roughness=k,n.metallicRoughnessTexture=U,n.emissiveColor=H,n.emissiveTexture=Y,n.occlusionTexture=ne,n.colorTextureTransform=this._convertTextureTransform(l),n.normalTextureTransform=this._convertTextureTransform(f),n.emissiveTextureTransform=this._convertTextureTransform(Q),n.occlusionTextureTransform=this._convertTextureTransform(re),n.metallicRoughnessTextureTransform=this._convertTextureTransform(j),n.uid=`${n.uid},mrm:${z},mrr:${k},mrt:${he},mrtt:${ce},emuid:${be},etmuid:${ye},ett:${pe},otmuid:${Ee},ott:${te}`}return n}_convertTextureTransform(e){if(!e)return null;const{scale:i,offset:r,rotation:n}=e;return{scale:i,offset:r,rotation:Ei(n)}}_setInternalColorValueParameters(e,i){i.diffuse=qe.toUnitRGB(e),i.opacity=e.a}_getLoadableTextureResource(e){return e.data??e.url}_getInternalTextureId(e){const i=this._getInternalTexture(e,mn.Opaque);return i==null?void 0:i.id}_getInternalTexture(e,i){const r=this._getLoadableTextureResource(e);if(!r)return null;const n=`${e.contentHash}/${i}`;let s=this._textures.get(n);if(!s){let o=null;const l=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,c={wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,maxAnisotropy:l,mipmap:l>1};I$(r)?(o=r.data,c.preMultiplyAlpha=!1,c.encoding=r.encoding):(o=r,c.preMultiplyAlpha=i!==mn.Opaque,c.downsampleUncompressed=this._context.graphicsCoreOwner.view.qualitySettings.graphics3D.uncompressedTextureDownsamplingEnabled),s=new OE(o,c),this._textures.set(n,s),s.load(this._context.stage.renderView.renderingContext),this._context.stage.add(s)}return s}_castTextureWrap(e="repeat"){if(typeof e=="string"){const i=this._castTextureWrapIndividual(e);return{s:i,t:i}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return Bi.CLAMP_TO_EDGE;case"mirror":return Bi.MIRRORED_REPEAT;default:return Bi.REPEAT}}_setInternalMaterialParameters(e,i){if(e.color!=null&&this._setInternalColorValueParameters(e.color,i),e.colorTexture!=null){const r=this._getInternalTexture(e.colorTexture,i.textureAlphaMode);r?(i.textureId=r.id,i.textureAlphaPremultiplied=!!r.parameters.preMultiplyAlpha):i.textureId=void 0}e.normalTexture&&(i.normalTextureId=this._getInternalTextureId(e.normalTexture)),e.emissiveColor&&(i.emissiveFactor=qe.toUnitRGB(e.emissiveColor)),e.emissiveTexture&&(i.emissiveTextureId=this._getInternalTextureId(e.emissiveTexture)),e.occlusionTexture&&(i.occlusionTextureId=this._getInternalTextureId(e.occlusionTexture)),e.metallicRoughnessTexture&&(i.metallicRoughnessTextureId=this._getInternalTextureId(e.metallicRoughnessTexture)),i.colorTextureTransformMatrix=hy(e.colorTextureTransform),i.normalTextureTransformMatrix=hy(e.normalTextureTransform),i.occlusionTextureTransformMatrix=hy(e.occlusionTextureTransform),i.emissiveTextureTransformMatrix=hy(e.emissiveTextureTransform),i.metallicRoughnessTextureTransformMatrix=hy(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e){var n,s;const i=this._drivenProperties.color;let r=((n=this.symbolLayer.material)==null?void 0:n.colorMixMode)??null;if(i)e.externalColor=xf;else{const o=((s=this.symbolLayer.material)==null?void 0:s.color)??null;o?e.externalColor=qe.toUnitRGBA(o):(r=null,e.externalColor=xf)}r&&(e.colorMixMode=r),e.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const i=e.vertexAttributes.color;if(i==null)return!1;for(let r=3;rY2(L,A,r,M,F);return T.alignedSampledElevation=_T(T,r,A.spatialReference,I,M),T}_getCenterPointInElevationSR(e){const i=Xu(0,0,0,this._context.elevationProvider.spatialReference!=null?this._context.elevationProvider.spatialReference:null);return x8e([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,i),i}_createComponentNormals(e,i,r,n){switch(r.shading||"flat"){default:case"source":return this._createComponentNormalsSource(e,i,r,n);case"flat":return this._createComponentNormalsFlat(e,n);case"smooth":return this._createComponentNormalsSmooth(e,n)}}_createComponentNormalsSource(e,i,r,n){if(i==null)return this._createComponentNormalsFlat(e,n);let s=!1;if(!r.trustSourceNormals)for(let o=0;os&&(s=l)}if(r<=s)return this.logger.warn(`Vertex index ${s} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,i){return i.faces??EE(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){var o;if(!this._context.clippingExtent)return!1;const i=(o=e.vertexAttributes)==null?void 0:o.position;if(!i)return!1;const r=this._context.elevationProvider.spatialReference,n=D8e({positions:i,transform:e.transform,vertexSpace:e.vertexSpace,inSpatialReference:e.spatialReference,outSpatialReference:r??e.spatialReference,localMode:this._context.stage.viewingMode===_t.Local}),s=n.length/3;return Bn(ZW),cp(ZW,n,0,s),!ym(ZW,this._context.clippingExtent)}_createGeometryInfo(e,i,r){if(!th(e.spatialReference,this._context.graphicsCoreOwner.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const n=this._createBuffers(e,i);if(n==null)return null;const{positionBuffer:s,uvBuffer:o,colorBuffer:l,symbolColorBuffer:c,normalBuffer:f,tangentBuffer:_,objectTransformation:x,geometryTransformation:T}=n,A=this._getOrCreateComponents(e),M=new Array;let I=!1;const L=zz(Ma,x),F=this._context.localOriginFactory.getOrigin(L);for(const z of A){if(!this._validateFaces(e,z))return null;const k=this._getOrCreateFaces(e,z);if(k.length===0)continue;const U=this._createComponentNormals(s,f,z,k);U.didFlipNormals&&(I=!0);const j=[[J.POSITION,new It(s,k,3,!0)],[J.NORMAL,new It(U.normals,U.indices,3,!0)]];l&&j.push([J.COLOR,new It(l,k,4,!0)]),c&&j.push([J.SYMBOLCOLOR,new It(c,ux(k.length),4,!0)]),o&&j.push([J.UV0,new It(o,k,2,!0)]),_&&j.push([J.TANGENT,new It(_,k,4,!0)]);const H=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),Y=this._getOrCreateMaterial(e,z),Q=new Bo(Y,j,null,Ws.Mesh,H);Q.transformation=T,Q.localOrigin=F,M.push(Q)}return I&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:M,objectTransformation:x}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((i,r)=>{r.setParameters(i.parameters)})}test(){return{...super.test(),materials:this._materialInfoCache.materials}}},XW=class{constructor(e,i,r){this.normals=e,this.indices=i,this.didFlipNormals=r}};const GN=W(),Ma=W(),xC=W(),SC=W(),TC=W(),lve=Qe(),xR=as(),tOt=Qe(),ZW=ya(),iOt=[new _Mt],rOt=new EO;var Mh;(function(t){t[t.NONE=0]="NONE",t[t.ECEF=1]="ECEF"})(Mh||(Mh={}));let nOt=class{constructor(e,i,r,n){this.graphics3DSymbolLayer=e,this.instanceIndex=i,this.elevationAligner=r,this.elevationContext=n,this.type="lod-instance",this._highlights=new Set,this.alignedSampledElevation=0,this.isElevationSource=!1,this.needsElevationUpdates=!1}initialize(){}setVisibility(e){const i=this._lodRenderer.instanceData;e!==i.getVisible(this.instanceIndex)&&i.setVisible(this.instanceIndex,e)}destroy(){this.instanceIndex!=null&&(this._lodRenderer.instanceData.removeInstance(this.instanceIndex),this.graphics3DSymbolLayer.notifyDestroyGraphicLayer(this))}alignWithElevation(e,i,r){if(this.elevationAligner){rG(this.elevationContext.featureExpressionInfoContext,r);const n=(o,l)=>Y2(o,e,this.elevationContext,i,l),s=this.elevationAligner(this,this.elevationContext,e.spatialReference,n,i);s!=null&&(this.alignedSampledElevation=s)}}getCenterObjectSpace(e=W()){return this._lodRenderer.instanceData.getCombinedLocalTransform(this.instanceIndex,cg),bt(e,this._lodRenderer.baseBoundingSphere.center,cg)}getBoundingBoxObjectSpace(e=ya()){this._lodRenderer.instanceData.getCombinedLocalTransform(this.instanceIndex,cg);const i=this._lodRenderer.baseBoundingBox;Bn(e);for(let r=0;r<8;++r)Ie(Fp,1&r?i[3]:i[0],2&r?i[4]:i[1],4&r?i[5]:i[2]),bt(Fp,Fp,cg),qf(e,Fp);return e}computeAttachmentOrigin(e){this._lodRenderer.instanceData.getGlobalTransform(this.instanceIndex,cg),e.render.origin[0]+=cg[12],e.render.origin[1]+=cg[13],e.render.origin[2]+=cg[14],e.render.num++}async getProjectedBoundingBox(e,i,r,n,s){const o=this.getBoundingBoxObjectSpace(s),l=sOt,c=Dse(o)?1:l.length;this._lodRenderer.instanceData.getGlobalTransform(this.instanceIndex,cg);for(let _=0;_{this._removeHighlightId(n)},r)}}removeObjectState(e){this._highlights.forEach(i=>e.remove(i))}_addHighlightId(e){this._highlights.add(e),this._lodRenderer.instanceData.setHighlight(this.instanceIndex,!0)}_removeHighlightId(e){this._highlights.delete(e),this._lodRenderer.instanceData.setHighlight(this.instanceIndex,this._highlights.size>0)}get _lodRenderer(){return this.graphics3DSymbolLayer.lodRenderer}};const Vx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Fp=W(),JW=W(),sOt=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]],cg=Qe();function oOt(t,e){const i=t.stageResources.geometries.map(n=>new k6e(n,t.stageResources.textures)),r=t.lodThreshold==null||t.lodThreshold===0&&e>0?lOt(i):t.lodThreshold;return new z6e(i,r,t.pivotOffset)}function aOt(t){return new U6e(t.map((e,i)=>oOt(e,i)))}function lOt(t){const e=t.reduce((i,{geometry:r})=>i+r.indexCount/3,0);return Math.sqrt(e*cOt/Math.PI)}const cOt=20;function uOt(t){return t=t||globalThis.location.hostname,hOt.some(e=>(t==null?void 0:t.match(e))!=null)}function Cie(t,e){return t&&(e=e||globalThis.location.hostname)?e.match(j8e)!=null||e.match(H8e)!=null?t.replace("static.arcgis.com","staticdev.arcgis.com"):e.match(G8e)!=null||e.match(q8e)!=null?t.replace("static.arcgis.com","staticqa.arcgis.com"):t:t}const j8e=/^devext.arcgis.com$/,G8e=/^qaext.arcgis.com$/,H8e=/^[\w-]*\.mapsdevext.arcgis.com$/,q8e=/^[\w-]*\.mapsqa.arcgis.com$/,hOt=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local.esri.com$/,j8e,G8e,/^jsapps.esri.com$/,H8e,q8e];function dOt(t,e,i){if(t.count!==e.count)return void uG.error("source and destination buffers need to have the same number of elements");const r=t.count,n=i[0],s=i[1],o=i[2],l=i[3],c=i[4],f=i[5],_=i[6],x=i[7],T=i[8],A=i[9],M=i[10],I=i[11],L=i[12],F=i[13],z=i[14],k=i[15],U=t.typedBuffer,j=t.typedBufferStride,H=e.typedBuffer,Y=e.typedBufferStride;for(let Q=0;Q0){const M=1/Math.sqrt(A);r[c]=M*_,r[c+1]=M*x,r[c+2]=M*T}}}function mOt(t,e,i){tV(t.typedBuffer,e,i,t.typedBufferStride)}function tV(t,e,i,r=4){const n=Math.min(t.length/r,e.count),s=e.typedBuffer,o=e.typedBufferStride;let l=0,c=0;for(let f=0;f{const e={...Y8e,...t.pbrMetallicRoughness},i=AOt({...COt,...t.extras});return{...EOt,...t,pbrMetallicRoughness:e,extras:i}};function AOt(t){switch(t.ESRI_externalColorMixMode){case"multiply":case"tint":case"ignore":case"replace":break;default:t.ESRI_externalColorMixMode,t.ESRI_externalColorMixMode="tint"}return t}const MOt={magFilter:ki.LINEAR,minFilter:ki.LINEAR_MIPMAP_LINEAR,wrapS:Bi.REPEAT,wrapT:Bi.REPEAT},OOt=t=>({...MOt,...t});function POt(t){let e,i;return t.replace(/^(.*\/)?([^/]*)$/,(r,n,s)=>(e=n||"",i=s||"","")),{dirPart:e,filePart:i}}const HN={MAGIC:1179937895,CHUNK_TYPE_JSON:1313821514,CHUNK_TYPE_BIN:5130562,MIN_HEADER_LENGTH:20};let ROt=class dw{constructor(e,i,r,n){if(this._context=e,this.uri=i,this.json=r,this._glbBuffer=n,this._bufferLoaders=new Map,this._textureLoaders=new Map,this._textureCache=new Map,this._materialCache=new Map,this._nodeParentMap=new Map,this._nodeTransformCache=new Map,this._supportedExtensions=["KHR_texture_basisu"],this._baseUri=POt(this.uri).dirPart,this._checkVersionSupported(),this._checkRequiredExtensionsSupported(),r.scenes==null)throw new se("gltf-loader-unsupported-feature","Scenes must be defined.");if(r.meshes==null)throw new se("gltf-loader-unsupported-feature","Meshes must be defined");if(r.nodes==null)throw new se("gltf-loader-unsupported-feature","Nodes must be defined.");this._computeNodeParents()}static async load(e,i,r){if(i1(i)){const o=C2(i);if(o&&o.mediaType!=="model/gltf-binary")try{const c=JSON.parse(o.isBase64?atob(o.data):o.data);return new dw(e,i,c)}catch{}const l=Cne(i);if(dw._isGLBData(l))return this._fromGLBData(e,i,l)}if(FOt.test(i)||(r==null?void 0:r.expectedType)==="gltf"){const o=await e.loadJSON(i,r);return new dw(e,i,o)}const n=await e.loadBinary(i,r);if(dw._isGLBData(n))return this._fromGLBData(e,i,n);if(kOt.test(i)||(r==null?void 0:r.expectedType)==="glb")throw new se("gltf-loader-invalid-glb","This is not a valid glb file.");const s=await e.loadJSON(i,r);return new dw(e,i,s)}static _isGLBData(e){if(e==null)return!1;const i=new cve(e);return i.remainingBytes()>=4&&i.readUint32()===HN.MAGIC}static async _fromGLBData(e,i,r){const n=await dw._parseGLBData(r);return new dw(e,i,n.json,n.binaryData)}static async _parseGLBData(e){const i=new cve(e);if(i.remainingBytes()<12)throw new se("gltf-loader-error","glb binary data is insufficiently large.");const r=i.readUint32(),n=i.readUint32(),s=i.readUint32();if(r!==HN.MAGIC)throw new se("gltf-loader-error","Magic first 4 bytes do not fit to expected glb value.");if(e.byteLength=8;){const f=i.readUint32(),_=i.readUint32();if(c===0){if(_!==HN.CHUNK_TYPE_JSON)throw new se("gltf-loader-error","First glb chunk must be JSON.");if(f<0)throw new se("gltf-loader-error","No JSON data found.");o=await VMt(i.readUint8Array(f))}else if(c===1){if(_!==HN.CHUNK_TYPE_BIN)throw new se("gltf-loader-unsupported-feature","Second glb chunk expected to be BIN.");l=i.readUint8Array(f)}else Ce.getLogger("esri.views.3d.glTF").warn("[Unsupported Feature] More than 2 glb chunks detected. Skipping.");c+=1}if(!o)throw new se("gltf-loader-error","No glb JSON chunk detected.");return{json:o,binaryData:l}}async getBuffer(e,i){const r=this.json.buffers[e];if(r.uri==null){if(this._glbBuffer==null)throw new se("gltf-loader-error","glb buffer not present");return this._glbBuffer}const n=await this._getBufferLoader(e,i);if(n.byteLength!==r.byteLength)throw new se("gltf-loader-error","Buffer byte lengths should match.");return n}async _getBufferLoader(e,i){const r=this._bufferLoaders.get(e);if(r)return r;const n=this.json.buffers[e].uri,s=this._context.loadBinary(this._resolveUri(n),i).then(o=>new Uint8Array(o));return this._bufferLoaders.set(e,s),s}async getAccessor(e,i){if(!this.json.accessors)throw new se("gltf-loader-unsupported-feature","Accessors missing.");const r=this.json.accessors[e];if((r==null?void 0:r.bufferView)==null)throw new se("gltf-loader-unsupported-feature","Some accessor does not specify a bufferView.");if(r.type in[$$.MAT2,$$.MAT3,$$.MAT4])throw new se("gltf-loader-unsupported-feature",`AttributeType ${r.type} is not supported`);const n=this.json.bufferViews[r.bufferView],s=await this.getBuffer(n.buffer,i),o=LOt[r.type],l=DOt[r.componentType],c=o*l,f=n.byteStride||c;return{raw:s.buffer,byteStride:f,byteOffset:s.byteOffset+(n.byteOffset||0)+(r.byteOffset||0),entryCount:r.count,isDenselyPacked:f===c,componentCount:o,componentByteSize:l,componentType:r.componentType,min:r.min,max:r.max,normalized:!!r.normalized}}async getIndexData(e,i){if(e.indices==null)return;const r=await this.getAccessor(e.indices,i);if(r.isDenselyPacked)switch(r.componentType){case Yt.UNSIGNED_BYTE:return new Uint8Array(r.raw,r.byteOffset,r.entryCount);case Yt.UNSIGNED_SHORT:return new Uint16Array(r.raw,r.byteOffset,r.entryCount);case Yt.UNSIGNED_INT:return new Uint32Array(r.raw,r.byteOffset,r.entryCount)}else switch(r.componentType){case Yt.UNSIGNED_BYTE:return ak(this._wrapAccessor(T5,r));case Yt.UNSIGNED_SHORT:return ak(this._wrapAccessor(Fj,r));case Yt.UNSIGNED_INT:return ak(this._wrapAccessor(zj,r))}}async getPositionData(e,i){if(e.attributes.POSITION==null)throw new se("gltf-loader-unsupported-feature","No POSITION vertex data found.");const r=await this.getAccessor(e.attributes.POSITION,i);if(r.componentType!==Yt.FLOAT)throw new se("gltf-loader-unsupported-feature","Expected type FLOAT for POSITION vertex attribute, but found "+Yt[r.componentType]);if(r.componentCount!==3)throw new se("gltf-loader-unsupported-feature","POSITION vertex attribute must have 3 components, but found "+r.componentCount.toFixed());return this._wrapAccessor(Ea,r)}async getNormalData(e,i){if(e.attributes.NORMAL==null)throw new se("gltf-loader-error","No NORMAL vertex data found.");const r=await this.getAccessor(e.attributes.NORMAL,i);if(r.componentType!==Yt.FLOAT)throw new se("gltf-loader-unsupported-feature","Expected type FLOAT for NORMAL vertex attribute, but found "+Yt[r.componentType]);if(r.componentCount!==3)throw new se("gltf-loader-unsupported-feature","NORMAL vertex attribute must have 3 components, but found "+r.componentCount.toFixed());return this._wrapAccessor(Ea,r)}async getTangentData(e,i){if(e.attributes.TANGENT==null)throw new se("gltf-loader-error","No TANGENT vertex data found.");const r=await this.getAccessor(e.attributes.TANGENT,i);if(r.componentType!==Yt.FLOAT)throw new se("gltf-loader-unsupported-feature","Expected type FLOAT for TANGENT vertex attribute, but found "+Yt[r.componentType]);if(r.componentCount!==4)throw new se("gltf-loader-unsupported-feature","TANGENT vertex attribute must have 4 components, but found "+r.componentCount.toFixed());return new Fm(r.raw,r.byteOffset,r.byteStride,r.byteOffset+r.byteStride*r.entryCount)}async getTextureCoordinates(e,i){if(e.attributes.TEXCOORD_0==null)throw new se("gltf-loader-error","No TEXCOORD_0 vertex data found.");const r=await this.getAccessor(e.attributes.TEXCOORD_0,i);if(r.componentCount!==2)throw new se("gltf-loader-unsupported-feature","TEXCOORD_0 vertex attribute must have 2 components, but found "+r.componentCount.toFixed());if(r.componentType===Yt.FLOAT)return this._wrapAccessor(TE,r);if(!r.normalized)throw new se("gltf-loader-unsupported-feature","Integer component types are only supported for a normalized accessor for TEXCOORD_0.");return NOt(r)}async getVertexColors(e,i){if(e.attributes.COLOR_0==null)throw new se("gltf-loader-error","No COLOR_0 vertex data found.");const r=await this.getAccessor(e.attributes.COLOR_0,i);if(r.componentCount!==4&&r.componentCount!==3)throw new se("gltf-loader-unsupported-feature","COLOR_0 attribute must have 3 or 4 components, but found "+r.componentCount.toFixed());if(r.componentCount===4){if(r.componentType===Yt.FLOAT)return this._wrapAccessor(Fm,r);if(r.componentType===Yt.UNSIGNED_BYTE)return this._wrapAccessor(Ac,r);if(r.componentType===Yt.UNSIGNED_SHORT)return this._wrapAccessor(Y9,r)}else if(r.componentCount===3){if(r.componentType===Yt.FLOAT)return this._wrapAccessor(Ea,r);if(r.componentType===Yt.UNSIGNED_BYTE)return this._wrapAccessor(Nj,r);if(r.componentType===Yt.UNSIGNED_SHORT)return this._wrapAccessor(kj,r)}throw new se("gltf-loader-unsupported-feature","Unsupported component type for COLOR_0 attribute: "+Yt[r.componentType])}hasPositions(e){return e.attributes.POSITION!==void 0}hasNormals(e){return e.attributes.NORMAL!==void 0}hasVertexColors(e){return e.attributes.COLOR_0!==void 0}hasTextureCoordinates(e){return e.attributes.TEXCOORD_0!==void 0}hasTangents(e){return e.attributes.TANGENT!==void 0}async getMaterial(e,i,r){var s,o,l,c,f,_,x,T,A,M;let n=e.material?this._materialCache.get(e.material):void 0;if(!n){const I=e.material!=null?hve(this.json.materials[e.material]):hve(),L=I.pbrMetallicRoughness,F=this.hasVertexColors(e),z=this.getTexture(L.baseColorTexture,i),k=this.getTexture(I.normalTexture,i),U=r?this.getTexture(I.occlusionTexture,i):void 0,j=r?this.getTexture(I.emissiveTexture,i):void 0,H=r?this.getTexture(L.metallicRoughnessTexture,i):void 0,Y=e.material!=null?e.material:-1;n={alphaMode:I.alphaMode,alphaCutoff:I.alphaCutoff,color:L.baseColorFactor,doubleSided:!!I.doubleSided,colorTexture:await z,normalTexture:await k,name:I.name,id:Y,occlusionTexture:await U,emissiveTexture:await j,emissiveFactor:I.emissiveFactor,metallicFactor:L.metallicFactor,roughnessFactor:L.roughnessFactor,metallicRoughnessTexture:await H,hasVertexColors:F,ESRI_externalColorMixMode:I.extras.ESRI_externalColorMixMode,colorTextureTransform:(o=(s=L==null?void 0:L.baseColorTexture)==null?void 0:s.extensions)==null?void 0:o.KHR_texture_transform,normalTextureTransform:(c=(l=I.normalTexture)==null?void 0:l.extensions)==null?void 0:c.KHR_texture_transform,occlusionTextureTransform:(_=(f=I.occlusionTexture)==null?void 0:f.extensions)==null?void 0:_.KHR_texture_transform,emissiveTextureTransform:(T=(x=I.emissiveTexture)==null?void 0:x.extensions)==null?void 0:T.KHR_texture_transform,metallicRoughnessTextureTransform:(M=(A=L==null?void 0:L.metallicRoughnessTexture)==null?void 0:A.extensions)==null?void 0:M.KHR_texture_transform}}return n}async getTexture(e,i){if(!e)return;if((e.texCoord||0)!==0)throw new se("gltf-loader-unsupported-feature","Only TEXCOORD with index 0 is supported.");const r=e.index,n=this.json.textures[r],s=OOt(n.sampler!=null?this.json.samplers[n.sampler]:{}),o=this._getTextureSourceId(n),l=this.json.images[o],c=await this._loadTextureImageData(r,n,i);return XV(this._textureCache,r,()=>{const f=x=>x===33071||x===33648||x===10497,_=x=>{throw new se("gltf-loader-error",`Unexpected TextureSampler WrapMode: ${x}`)};return{data:c,wrapS:f(s.wrapS)?s.wrapS:_(s.wrapS),wrapT:f(s.wrapT)?s.wrapT:_(s.wrapT),minFilter:s.minFilter,name:l.name,id:r}})}getNodeTransform(e){if(e===void 0)return IOt;let i=this._nodeTransformCache.get(e);if(!i){const r=this.getNodeTransform(this._getNodeParent(e)),n=this.json.nodes[e];n.matrix?i=nn(Qe(),r,n.matrix):n.translation||n.rotation||n.scale?(i=o5(r),n.translation&&Qu(i,i,n.translation),n.rotation&&(qN[3]=Poe(qN,n.rotation),Wh(i,i,qN[3],qN)),n.scale&&$9(i,i,n.scale)):i=o5(r),this._nodeTransformCache.set(e,i)}return i}_wrapAccessor(e,i){return new e(i.raw,i.byteOffset,i.byteStride,i.byteOffset+i.byteStride*(i.entryCount-1)+i.componentByteSize*i.componentCount)}_resolveUri(e){return Gh(e,this._baseUri)}_getNodeParent(e){return this._nodeParentMap.get(e)}_checkVersionSupported(){const e=$2.parse(this.json.asset.version,"glTF");$Ot.validate(e)}_checkRequiredExtensionsSupported(){const e=this.json;if(e.extensionsRequired&&!e.extensionsRequired.every(i=>this._supportedExtensions.includes(i)))throw new se("gltf-loader-unsupported-feature","gltf loader was not able to load unsupported feature. Required extensions: "+e.extensionsRequired.join(", "))}_computeNodeParents(){this.json.nodes.forEach((e,i)=>{e.children&&e.children.forEach(r=>{this._nodeParentMap.set(r,i)})})}async _loadTextureImageData(e,i,r){const n=this._textureLoaders.get(e);if(n)return n;const s=this._createTextureLoader(i,r);return this._textureLoaders.set(e,s),s}_getTextureSourceId(e){if(e.extensions!==void 0&&e.extensions.KHR_texture_basisu!==null)return e.extensions.KHR_texture_basisu.source;if(e.source!==null)return e.source;throw new se("gltf-loader-unsupported-feature","Source is expected to be defined for a texture. It can also be omitted in favour of an KHR_texture_basisu extension tag.")}async _createTextureLoader(e,i){const r=this._getTextureSourceId(e),n=this.json.images[r];if(n.uri){if(n.uri.endsWith(".ktx2")){const c=await this._context.loadBinary(this._resolveUri(n.uri),i);return new z8e(new Uint8Array(c))}return this._context.loadImage(this._resolveUri(n.uri),i)}if(n.bufferView==null)throw new se("gltf-loader-unsupported-feature","Image bufferView must be defined.");if(n.mimeType==null)throw new se("gltf-loader-unsupported-feature","Image mimeType must be defined.");const s=this.json.bufferViews[n.bufferView],o=await this.getBuffer(s.buffer,i);if(s.byteStride!=null)throw new se("gltf-loader-unsupported-feature","byteStride not supported for image buffer");const l=o.byteOffset+(s.byteOffset||0);return BMt(new Uint8Array(o.buffer,l,s.byteLength),n.mimeType)}async getLoadedBuffersSize(){if(this._glbBuffer)return this._glbBuffer.byteLength;const e=await ZX(Array.from(this._bufferLoaders.values())),i=await ZX(Array.from(this._textureLoaders.values()));return e.reduce((r,n)=>r+((n==null?void 0:n.byteLength)??0),0)+i.reduce((r,n)=>r+(n?I$(n)?n.data.byteLength:n.width*n.height*4:0),0)}};const IOt=qAe(Qe(),Math.PI/2),$Ot=new $2(2,0,"glTF"),qN=Cp(),LOt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},DOt={[Yt.BYTE]:1,[Yt.UNSIGNED_BYTE]:1,[Yt.SHORT]:2,[Yt.UNSIGNED_SHORT]:2,[Yt.FLOAT]:4,[Yt.INT]:4,[Yt.UNSIGNED_INT]:4};function NOt(t){switch(t.componentType){case Yt.BYTE:return new Uj(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount);case Yt.UNSIGNED_BYTE:return new Dj(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount);case Yt.SHORT:return new X9(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount);case Yt.UNSIGNED_SHORT:return new zae(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount);case Yt.UNSIGNED_INT:return new Uae(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount);case Yt.FLOAT:return new TE(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount)}}const FOt=/\.gltf$/i,kOt=/\.glb$/i;let zOt=0;async function X8e(t,e,i={},r=!0){const n=await ROt.load(t,e,i),s="gltf_"+zOt++,o={lods:[],materials:new Map,textures:new Map,meta:UOt(n)},l=!(!n.json.asset.extras||n.json.asset.extras.ESRI_type!=="symbolResource"),c=new Map;await VOt(n,async(_,x,T,A)=>{var re;const M=c.get(T)??0;c.set(T,M+1);const I=_.mode!==void 0?_.mode:sr.TRIANGLES,L=I===sr.TRIANGLES||I===sr.TRIANGLE_STRIP||I===sr.TRIANGLE_FAN?I:null;if(L==null)return void Ce.getLogger("esri.views.3d.glTF").warn("[Unsupported Feature] Unsupported primitive mode ("+sr[I]+"). Skipping primitive.");if(!n.hasPositions(_))return void Ce.getLogger("esri.views.3d.glTF").warn("Skipping primitive without POSITION vertex attribute.");const F=n.getPositionData(_,i),z=n.getMaterial(_,i,r),k=n.hasNormals(_)?n.getNormalData(_,i):null,U=n.hasTangents(_)?n.getTangentData(_,i):null,j=n.hasTextureCoordinates(_)?n.getTextureCoordinates(_,i):null,H=n.hasVertexColors(_)?n.getVertexColors(_,i):null,Y=n.getIndexData(_,i),Q={name:A,transform:o5(x),attributes:{position:await F,normal:k?await k:null,texCoord0:j?await j:null,color:H?await H:null,tangent:U?await U:null},indices:await Y,primitiveType:L,material:jOt(o,await z,s)};let ne=null;((re=o.meta)==null?void 0:re.ESRI_lod)!=null&&o.meta.ESRI_lod.metric==="screenSpaceRadius"&&(ne=o.meta.ESRI_lod.thresholds[T]),o.lods[T]=o.lods[T]||{parts:[],name:A,lodThreshold:ne},o.lods[T].parts[M]=Q});for(const _ of o.lods)_.parts=_.parts.filter(x=>!!x);const f=await n.getLoadedBuffersSize();return{model:o,meta:{isEsriSymbolResource:l,uri:n.uri},customMeta:{},size:f}}function UOt(t){const e=t.json;let i=null;return e.nodes.forEach(r=>{const n=r.extras;n!=null&&(n.ESRI_proxyEllipsoid||n.ESRI_lod)&&(i=n)}),i}async function VOt(t,e){const i=t.json,r=i.scenes[i.scene||0].nodes,n=r.length>1,s=[];for(const l of r){const c=i.nodes[l];s.push(o(l,0)),BOt(c)&&!n&&c.extensions.MSFT_lod.ids.forEach((f,_)=>o(f,_+1))}async function o(l,c){const f=i.nodes[l],_=t.getNodeTransform(l);if(f.weights!=null&&Ce.getLogger("esri.views.3d.glTF").warn("[Unsupported Feature] Morph targets are not supported."),f.mesh!=null){const x=i.meshes[f.mesh];for(const T of x.primitives)s.push(e(T,_,c,x.name))}for(const x of f.children||[])s.push(o(x,c))}await Promise.all(s)}function BOt(t){var e;return((e=t.extensions)==null?void 0:e.MSFT_lod)&&Array.isArray(t.extensions.MSFT_lod.ids)}function jOt(t,e,i){const r=s=>{const o=`${i}_tex_${s&&s.id}${s!=null&&s.name?"_"+s.name:""}`;if(s&&!t.textures.has(o)){const l=TOt(s.data,{wrap:{s:s.wrapS,t:s.wrapT},mipmap:GOt.has(s.minFilter),noUnpackFlip:!0});t.textures.set(o,l)}return o},n=`${i}_mat_${e.id}_${e.name}`;if(!t.materials.has(n)){const s=SOt({color:[e.color[0],e.color[1],e.color[2]],opacity:e.color[3],alphaMode:e.alphaMode,alphaCutoff:e.alphaCutoff,doubleSided:e.doubleSided,colorMixMode:e.ESRI_externalColorMixMode,textureColor:e.colorTexture?r(e.colorTexture):void 0,textureNormal:e.normalTexture?r(e.normalTexture):void 0,textureOcclusion:e.occlusionTexture?r(e.occlusionTexture):void 0,textureEmissive:e.emissiveTexture?r(e.emissiveTexture):void 0,textureMetallicRoughness:e.metallicRoughnessTexture?r(e.metallicRoughnessTexture):void 0,emissiveFactor:[e.emissiveFactor[0],e.emissiveFactor[1],e.emissiveFactor[2]],colorTextureTransform:e.colorTextureTransform,normalTextureTransform:e.normalTextureTransform,occlusionTextureTransform:e.occlusionTextureTransform,emissiveTextureTransform:e.emissiveTextureTransform,metallicRoughnessTextureTransform:e.metallicRoughnessTextureTransform,metallicFactor:e.metallicFactor,roughnessFactor:e.roughnessFactor});t.materials.set(n,s)}return n}const GOt=new Set([ki.LINEAR_MIPMAP_LINEAR,ki.LINEAR_MIPMAP_NEAREST]);function HOt(t,e){switch(e){case sr.TRIANGLES:return qOt(t);case sr.TRIANGLE_STRIP:return WOt(t);case sr.TRIANGLE_FAN:return YOt(t)}}function qOt(t){return typeof t=="number"?EE(t):Zw(t)?new Uint16Array(t):t}function WOt(t){const e=typeof t=="number"?t:t.length;if(e<3)return[];const i=e-2,r=TU(3*i);if(typeof t=="number"){let n=0;for(let s=0;s{if(F.params.topology==="PerAttributeArray")return null;const Ee=F.params.faces;for(const te in Ee)if(te===pe)return Ee[te].values;return null},H=k[J.POSITION],Y=H.values.length/H.valuesPerElement;for(const pe in k){const Ee=k[pe],te=Ee.values,le=j(pe)??EE(Y);U.push([pe,new It(te,le,Ee.valuesPerElement,!0)])}const Q=z.texture,ne=x&&x[Q];if(ne&&!A.has(Q)){const{image:pe,parameters:Ee}=ne,te=new OE(pe,Ee);r.push(te),A.set(Q,te)}const re=A.get(Q),he=re?re.id:void 0,ce=z.material;let be=s.get(ce,Q);if(be==null){const pe=_[ce.substring(ce.lastIndexOf("/")+1)].params;pe.transparency===1&&(pe.transparency=0);const Ee=ne&&ne.alphaChannelUsage,te=pe.transparency>0||Ee==="transparency"||Ee==="maskAndTransparency",le=ne?K8e(ne.alphaChannelUsage):void 0,de={ambient:mc(pe.diffuse),diffuse:mc(pe.diffuse),opacity:1-(pe.transparency||0),transparent:te,textureAlphaMode:le,textureAlphaCutoff:.33,textureId:he,initTextureTransparent:!0,doubleSided:!0,cullFace:Ln.None,colorMixMode:pe.externalColorMixMode||"tint",textureAlphaPremultiplied:(ne==null?void 0:ne.parameters.preMultiplyAlpha)??!1};e!=null&&e.materialParameters&&Object.assign(de,e.materialParameters),be=new km(de),s.set(ce,Q,be)}n.push(be);const ye=new Bo(be,U);T+=((I=(M=U.find(pe=>pe[0]===J.POSITION))==null?void 0:M[1])==null?void 0:I.indices.length)??0,i.push(ye)}return{engineResources:[{name:c,stageResources:{textures:r,materials:n,geometries:i},pivotOffset:o.model.pivotOffset,numberOfVertices:T,lodThreshold:null}],referenceBoundingBox:t5t(i)}}function t5t(t){const e=Bn();return t.forEach(i=>{const r=i.boundingInfo;r!=null&&(qf(e,r.bbMin),qf(e,r.bbMax))}),e}async function i5t(t,e){const i=new Array;for(const s in t){const o=t[s],l=o.images[0].data;if(!l){tv.warn("Externally referenced texture data is not yet supported");continue}const c=o.encoding+";base64,"+l,f="/textureDefinitions/"+s,_=o.channels==="rgba"?o.alphaChannelUsage||"transparency":"none",x={noUnpackFlip:!0,wrap:{s:Bi.REPEAT,t:Bi.REPEAT},preMultiplyAlpha:K8e(_)!==mn.Opaque},T=e!=null&&e.disableTextures?Promise.resolve(null):C_(c,e);i.push(T.then(A=>({refId:f,image:A,parameters:x,alphaChannelUsage:_})))}const r=await Promise.all(i),n={};for(const s of r)n[s.refId]=s;return n}function K8e(t){switch(t){case"mask":return mn.Mask;case"maskAndTransparency":return mn.MaskBlend;case"none":return mn.Opaque;default:return mn.Blend}}function r5t(t){const e=t.params;return{id:1,material:e.material,texture:e.texture,region:e.texture}}const n5t=new $2(1,2,"wosr"),EC=2.1;async function Q8e(t,e){var x;const i=e7e(Cie(t));if(i.fileType==="wosr"){const T=await(e.cache?e.cache.loadWOSR(i.url,e):Z8e(i.url,e)),{engineResources:A,referenceBoundingBox:M}=e5t(T,e);return{lods:A,referenceBoundingBox:M,isEsriSymbolResource:!1,isWosr:!0}}const r=await(e.cache?e.cache.loadGLTF(i.url,e,!!e.usePBR):X8e(new W8e(e.streamDataRequester),i.url,e,e.usePBR)),n=(x=r.model.meta)==null?void 0:x.ESRI_proxyEllipsoid,s=r.meta.isEsriSymbolResource&&n!=null&&r.meta.uri.includes("/RealisticTrees/");s&&!r.customMeta.esriTreeRendering&&(r.customMeta.esriTreeRendering=!0,l5t(r,n));const o=!!e.usePBR,l=r.meta.isEsriSymbolResource?{usePBR:o,isSchematic:!1,treeRendering:s,mrrFactors:[...y3t]}:{usePBR:o,isSchematic:!1,treeRendering:!1,mrrFactors:[...sG]},c={...e.materialParameters,treeRendering:s},{engineResources:f,referenceBoundingBox:_}=t7e(r,l,c,e.skipHighLods&&i.specifiedLodIndex==null?{skipHighLods:!0}:{skipHighLods:!1,singleLodIndex:i.specifiedLodIndex});return{lods:f,referenceBoundingBox:_,isEsriSymbolResource:r.meta.isEsriSymbolResource,isWosr:!1}}function e7e(t){const e=t.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return e?{fileType:"gltf",url:e[1],specifiedLodIndex:e[4]!=null?Number(e[4]):null}:t.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:t,specifiedLodIndex:null}:{fileType:"unknown",url:t,specifiedLodIndex:null}}function t7e(t,e,i,r){const n=t.model,s=new Array,o=new Map,l=new Map,c=n.lods.length,f=Bn();return n.lods.forEach((_,x)=>{const T=r.skipHighLods===!0&&(c>1&&x===0||c>3&&x===1)||r.skipHighLods===!1&&r.singleLodIndex!=null&&x!==r.singleLodIndex;if(T&&x!==0)return;const A=new ZOt(_.name,_.lodThreshold,[0,0,0]);_.parts.forEach(M=>{const I=T?new km({}):s5t(n,M,A,e,i,o,l),{geometry:L,vertexCount:F}=o5t(M,I??new km({})),z=L.boundingInfo;z!=null&&x===0&&(qf(f,z.bbMin),qf(f,z.bbMax)),I!=null&&(A.stageResources.geometries.push(L),A.numberOfVertices+=F)}),T||s.push(A)}),{engineResources:s,referenceBoundingBox:f}}function s5t(t,e,i,r,n,s,o){const l=e.material+(e.attributes.normal?"_normal":"")+(e.attributes.color?"_color":"")+(e.attributes.texCoord0?"_texCoord0":"")+(e.attributes.tangent?"_tangent":""),c=t.materials.get(e.material),f=e.attributes.texCoord0!=null,_=e.attributes.normal!=null;if(c==null)return null;const x=a5t(c.alphaMode);if(!s.has(l)){if(f){const j=(H,Y=!1)=>{if(H!=null&&!o.has(H)){const Q=t.textures.get(H);if(Q!=null){const ne=Q.data;o.set(H,new OE(I$(ne)?ne.data:ne,{...Q.parameters,preMultiplyAlpha:!I$(ne)&&Y,encoding:I$(ne)&&ne.encoding!=null?ne.encoding:void 0}))}}};j(c.textureColor,x!==mn.Opaque),j(c.textureNormal),j(c.textureOcclusion),j(c.textureEmissive),j(c.textureMetallicRoughness)}const A=c.color[0]**(1/EC),M=c.color[1]**(1/EC),I=c.color[2]**(1/EC),L=c.emissiveFactor[0]**(1/EC),F=c.emissiveFactor[1]**(1/EC),z=c.emissiveFactor[2]**(1/EC),k=c.textureColor!=null&&f?o.get(c.textureColor):null,U=X6e({normalTexture:c.textureNormal,metallicRoughnessTexture:c.textureMetallicRoughness,metallicFactor:c.metallicFactor,roughnessFactor:c.roughnessFactor,emissiveTexture:c.textureEmissive,emissiveFactor:c.emissiveFactor,occlusionTexture:c.textureOcclusion});s.set(l,new km({...r,transparent:x===mn.Blend,customDepthTest:WT.Lequal,textureAlphaMode:x,textureAlphaCutoff:c.alphaCutoff,diffuse:[A,M,I],ambient:[A,M,I],opacity:c.opacity,doubleSided:c.doubleSided,doubleSidedType:"winding-order",cullFace:c.doubleSided?Ln.None:Ln.Back,hasVertexColors:!!e.attributes.color,hasVertexTangents:!!e.attributes.tangent,normalType:_?Br.Attribute:Br.ScreenDerivative,castShadows:!0,textureId:k!=null?k.id:void 0,colorMixMode:c.colorMixMode,normalTextureId:c.textureNormal!=null&&f?o.get(c.textureNormal).id:void 0,textureAlphaPremultiplied:k!=null&&!!k.parameters.preMultiplyAlpha,occlusionTextureId:c.textureOcclusion!=null&&f?o.get(c.textureOcclusion).id:void 0,emissiveTextureId:c.textureEmissive!=null&&f?o.get(c.textureEmissive).id:void 0,metallicRoughnessTextureId:c.textureMetallicRoughness!=null&&f?o.get(c.textureMetallicRoughness).id:void 0,emissiveFactor:[L,F,z],mrrFactors:U?[...Ale]:[c.metallicFactor,c.roughnessFactor,r.mrrFactors[2]],isSchematic:U,colorTextureTransformMatrix:hy(c.colorTextureTransform),normalTextureTransformMatrix:hy(c.normalTextureTransform),occlusionTextureTransformMatrix:hy(c.occlusionTextureTransform),emissiveTextureTransformMatrix:hy(c.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:hy(c.metallicRoughnessTextureTransform),...n}))}const T=s.get(l);if(i.stageResources.materials.push(T),f){const A=M=>{M!=null&&i.stageResources.textures.push(o.get(M))};A(c.textureColor),A(c.textureNormal),A(c.textureOcclusion),A(c.textureEmissive),A(c.textureMetallicRoughness)}return T}function o5t(t,e){const i=t.attributes.position.count,r=HOt(t.indices||i,t.primitiveType),n=Rs(3*i),{typedBuffer:s,typedBufferStride:o}=t.attributes.position;Um(n,s,t.transform,3,o);const l=[[J.POSITION,new It(n,r,3,!0)]];if(t.attributes.normal!=null){const c=Rs(3*i),{typedBuffer:f,typedBufferStride:_}=t.attributes.normal;v_(WN,t.transform),Vm(c,f,WN,3,_),l.push([J.NORMAL,new It(c,r,3,!0)])}if(t.attributes.tangent!=null){const c=Rs(4*i),{typedBuffer:f,typedBufferStride:_}=t.attributes.tangent;v_(WN,t.transform),lce(c,f,WN,4,_),l.push([J.TANGENT,new It(c,r,4,!0)])}if(t.attributes.texCoord0!=null){const c=Rs(2*i),{typedBuffer:f,typedBufferStride:_}=t.attributes.texCoord0;cce(c,f,2,_),l.push([J.UV0,new It(c,r,2,!0)])}if(t.attributes.color!=null){const c=new Uint8Array(4*i);t.attributes.color.elementCount===4?t.attributes.color instanceof Fm?tV(c,t.attributes.color,255):t.attributes.color instanceof Ac?uce(c,t.attributes.color):t.attributes.color instanceof Y9&&tV(c,t.attributes.color,1/256):(c.fill(255),t.attributes.color instanceof Ea?jU(c,t.attributes.color,255,4):t.attributes.color instanceof Nj?h6(c,t.attributes.color.typedBuffer,4,t.attributes.color.typedBufferStride):t.attributes.color instanceof kj&&jU(c,t.attributes.color,1/256,4)),l.push([J.COLOR,new It(c,r,4,!0)])}return{geometry:new Bo(e,l),vertexCount:i}}const WN=as();function a5t(t){switch(t){case"BLEND":return mn.Blend;case"MASK":return mn.Mask;case"OPAQUE":case null:case void 0:return mn.Opaque}}function l5t(t,e){for(let i=0;i1&&Qr(_,_,c,F>-1?.2:Math.min(-4*F-3.8,1)),T[M]=_[0],T[M+1]=_[1],T[M+2]=_[2],M+=3,x[I]=255*k,x[I+1]=255*k,x[I+2]=255*k,x[I+3]=255,I+=4}n.attributes.normal=new Ea(T),n.attributes.color=new Ac(x)}}}const kci=Object.freeze(Object.defineProperty({__proto__:null,fetch:Q8e,gltfToEngineResources:t7e,parseUrl:e7e},Symbol.toStringTag,{value:"Module"}));function i7e(t,e,i,r){const n=t.name;return n==null?Promise.reject(new se("symbolstyleutils:style-symbol-reference-name-missing","Missing name in style symbol reference")):t.styleName&&t.styleName==="Esri2DPointSymbolsStyle"?c5t(n,e,r):eoe(t,e,r).then(s=>dce(s,n,e,i,l5e,r))}function hce(t,e){return e.items.find(i=>i.name===t)}function dce(t,e,i,r,n,s){var A,M;const o=(i==null?void 0:i.portal)!=null?i.portal:os.getDefault(),l={portal:o,url:qs(t.baseUrl),origin:"portal-item"},c=hce(e,t.data);if(!c){const I=`The symbol name '${e}' could not be found`;return Promise.reject(new se("symbolstyleutils:symbol-name-not-found",I,{symbolName:e}))}let f=f_(n(c,r),l),_=((A=c.thumbnail)==null?void 0:A.href)??null;const x=(M=c.thumbnail)==null?void 0:M.imageData;uOt()&&(f=Cie(f)??"",_=Cie(_));const T={portal:o,url:qs(One(f)),origin:"portal-item"};return toe(f,s).then(I=>{const L=r==="cimRef"?a5e(I.data):I.data,F=BOe(L,T);if(F&&Hy(F)){if(_){const z=f_(_,l);F.thumbnail=new hT({url:z})}else x&&(F.thumbnail=new hT({url:`data:image/png;base64,${x}`}));t.styleUrl?F.styleOrigin=new yL({portal:i.portal,styleUrl:t.styleUrl,name:e}):t.styleName&&(F.styleOrigin=new yL({portal:i.portal,styleName:t.styleName,name:e}))}return F})}function c5t(t,e,i){const r=Mst.replaceAll(/\{SymbolName\}/gi,t),n=e.portal!=null?e.portal:os.getDefault();return toe(r,i).then(s=>{const o=a5e(s.data);return BOe(o,{portal:n,url:qs(One(r)),origin:"portal-item"})})}const u5t=Object.freeze(Object.defineProperty({__proto__:null,fetchSymbolFromStyle:dce,getStyleItemFromStyle:hce,resolveWebStyleSymbol:i7e},Symbol.toStringTag,{value:"Module"}));async function h5t(t){var l;if(t===null||t.styleName==null&&t.styleUrl==null)return null;const e=t.name;if(e==null)throw new se("symbolstyleutils:style-symbol-reference-name-missing","Missing name in style symbol reference");const i={portal:t.portal},r=await eoe(t,i).catch(()=>null);if(r===null)return null;const n=hce(e,r.data);if(n&&!((l=n.formatInfos)!=null&&l.some(c=>c.type==="gltf_basisu")))return null;const s=await dce(r,e,i,"webRef",(c,f)=>l5e(c,f,["gltf_basisu","gltf"])).catch(()=>null);if(s===null||s.type!=="point-3d")return null;const o=s.symbolLayers.items[0];return o.type==="object"?o.resource:null}let d5t=class{constructor(e,i,r){this._elementSize=i,this._buffer=Yr.createVertex(e,Pr.STATIC_DRAW),this.resize(r)}destroy(){this._buffer.dispose()}get elementSize(){return this._elementSize}get capacity(){return this._capacity}get array(){return this._array}get buffer(){return this._buffer}get usedMemory(){return this._array.byteLength+this._buffer.byteLength}copyRange(e,i,r,n=0){const s=new Uint8Array(this.array,e*this.elementSize,(i-e)*this.elementSize);new Uint8Array(r.array,n*this.elementSize).set(s)}transferAll(){this._buffer.setData(this._array)}transferRange(e,i){const r=e*this._elementSize,n=i*this._elementSize;this._buffer.setSubData(new Uint8Array(this._array),r,r,n)}resize(e){const i=e*this._elementSize,r=new ArrayBuffer(i);this._array&&(e>=this._capacity?new Uint8Array(r).set(new Uint8Array(this._array)):new Uint8Array(r).set(new Uint8Array(this._array).subarray(0,e*this._elementSize))),this._array=r,this._buffer.setSize(i),this._capacity=e}},p5t=class{constructor(e){this.modelOriginHi=e.getField(J.INSTANCEMODELORIGINHI,Ea),this.modelOriginLo=e.getField(J.INSTANCEMODELORIGINLO,Ea),this.model=e.getField(J.INSTANCEMODEL,j2),this.modelNormal=e.getField(J.INSTANCEMODELNORMAL,j2),this.featureAttribute=e.getField(J.INSTANCEFEATUREATTRIBUTE,Fm),this.color=e.getField(J.INSTANCECOLOR,Ac),this.objectAndLayerIdColor=e.getField(J.INSTANCEOBJECTANDLAYERIDCOLOR,Ac)}},dve=class{constructor(e,i){this._headIndex=0,this._tailIndex=0,this._firstIndex=null,this._captureFirstIndex=!0,this._updating=!1,this._prevHeadIndex=0,this._resized=!1,this._rctx=e,this._instanceBufferLayout=i,this._elementSize=i.stride,this._capacity=1}destroy(){this._buffer&&this._buffer.destroy()}get buffer(){return this._buffer.buffer}get view(){return this._view}get capacity(){return this._capacity}get size(){const e=this._headIndex,i=this._tailIndex;return e>=i?e-i:e+this._capacity-i}get isEmpty(){return this._headIndex===this._tailIndex}get isFull(){return this._tailIndex===(this._headIndex+1)%this._capacity}get headIndex(){return this._headIndex}get tailIndex(){return this._tailIndex}get firstIndex(){return this._firstIndex}get usedMemory(){var e;return((e=this._buffer)==null?void 0:e.usedMemory)??0}reset(){this._headIndex=0,this._tailIndex=0,this._firstIndex=null}startUpdateCycle(){this._captureFirstIndex=!0}beginUpdate(){Xt(!this._updating,"already updating"),this._updating=!0,this._prevHeadIndex=this._headIndex}endUpdate(){Xt(this._updating,"not updating"),this.size0,"invalid size");const e=this._tailIndex===this._firstIndex;this._incrementTail(),e&&(this._firstIndex=this._tailIndex)}_grow(){const e=Math.max(iV,Math.floor(this._capacity*VV));this._resize(e)}_shrink(){const e=Math.max(iV,Math.floor(this._capacity*wje));this._resize(e)}_resize(e){if(Xt(this._updating,"not updating"),e===this._capacity)return;const i=new d5t(this._rctx,this._elementSize,e);if(this._buffer){this._firstIndex&&(this._firstIndex=(this._firstIndex+this._capacity-this._tailIndex)%this._capacity);const r=this.size,n=this._compactInstances(i);Xt(n===r,"invalid compaction"),this._buffer.destroy(),this._tailIndex=0,this._headIndex=n,this._prevHeadIndex=0}this._resized=!0,this._capacity=e,this._buffer=i,this._view=new p5t(this._instanceBufferLayout.createView(this._buffer.array))}_compactInstances(e){const i=this._headIndex,r=this._tailIndex;return ri?(this._buffer.copyRange(r,this._capacity,e),i>0&&this._buffer.copyRange(0,i,e,this._capacity-r),i+(this._capacity-r)):0}_incrementHead(e=1){this._headIndex=(this._headIndex+e)%this._capacity}_incrementTail(e=1){this._tailIndex=(this._tailIndex+e)%this._capacity}_transferRange(e,i){ei&&(i>0&&this._buffer.transferRange(0,i),this._buffer.transferRange(e,this._capacity))}};const iV=64;var es;function f5t(t){let e=ls().mat4f64(J.LOCALTRANSFORM).mat4f64(J.GLOBALTRANSFORM).vec4f64(J.BOUNDINGSPHERE).vec3f64(J.MODELORIGIN).mat3f(J.INSTANCEMODEL).mat3f(J.INSTANCEMODELNORMAL).vec2f(J.MODELSCALEFACTORS);return t.includes(J.FEATUREATTRIBUTE)&&(e=e.vec4f(J.FEATUREATTRIBUTE)),t.includes(J.COLOR)&&(e=e.vec4u8(J.COLOR)),t.includes(J.OBJECTANDLAYERIDCOLOR)&&(e=e.vec4u8(J.OBJECTANDLAYERIDCOLOR)),e=e.u8(J.STATE).u8(J.LODLEVEL),e}(function(t){t[t.ALLOCATED=1]="ALLOCATED",t[t.DEFAULT_ACTIVE=2]="DEFAULT_ACTIVE",t[t.VISIBLE=4]="VISIBLE",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.HIGHLIGHT_ACTIVE=16]="HIGHLIGHT_ACTIVE",t[t.REMOVE=32]="REMOVE",t[t.TRANSFORM_CHANGED=64]="TRANSFORM_CHANGED",t[t.ACTIVE=18]="ACTIVE"})(es||(es={}));let pve=class{constructor(e){this.localTransform=e.getField(J.LOCALTRANSFORM,PL),this.globalTransform=e.getField(J.GLOBALTRANSFORM,PL),this.modelOrigin=e.getField(J.MODELORIGIN,e0),this.model=e.getField(J.INSTANCEMODEL,j2),this.modelNormal=e.getField(J.INSTANCEMODELNORMAL,j2),this.modelScaleFactors=e.getField(J.MODELSCALEFACTORS,TE),this.boundingSphere=e.getField(J.BOUNDINGSPHERE,Lj),this.featureAttribute=e.getField(J.FEATUREATTRIBUTE,Fm),this.color=e.getField(J.COLOR,Ac),this.objectAndLayerIdColor=e.getField(J.OBJECTANDLAYERIDCOLOR,Ac),this.state=e.getField(J.STATE,T5),this.lodLevel=e.getField(J.LODLEVEL,T5)}},YA=class extends ze{constructor(e,i){super(e),this.events=new Dn,this._capacity=0,this._size=0,this._next=0,this._layout=f5t(i),this._capacity=iV,this._buffer=this._layout.createBuffer(this._capacity),this._view=new pve(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const e=this._findSlot();return this._view.state.set(e,es.ALLOCATED),this._size++,this.events.emit("instances-changed"),e}removeInstance(e){const i=this._view.state;Xt(e>=0&&e=0&&ethis._instanceData.view.boundingSphere.getVec(r,this._tmpSphere),{maximumDepth:25}),this._instanceData=e,this._boundingSphere=i,this._tmpSphere=co(),this._tmpMat4=Qe()}addInstance(e){const i=this._instanceData.view.boundingSphere,r=this._instanceData.getCombinedModelTransform(e,this._tmpMat4);bt(this._tmpSphere,this._boundingSphere.center,r),this._tmpSphere[3]=this._boundingSphere.radius*l5(r),i.setVec(e,this._tmpSphere),this.add([e])}removeInstance(e){this.remove([e])}},y5t=class{constructor(e,i){this._worldSpaceRadius=e,this._minScreenSpaceRadii=i}selectLevel(e,i,r){const n=r.computeScreenPixelSizeAt(e),s=this._worldSpaceRadius*i/n;let o=0;for(let l=1;l=this._minScreenSpaceRadii[l]&&(o=l);return o}},v5t=class extends vj{constructor(e,i,r,n,s,o){super(e,i),this.layerUid=e,this.graphicUid=i,this.geometryId=r,this.triangleNr=n,this.baseBoundingSphere=s,this.numLodLevels=o}};function pce(t){return Gm(t)&&t.intersector===ms.LOD&&!!t.target}let _5t=class{constructor(e,i){const r=e.renderContext.rctx,n=i.geometry;this._materialRepository=e.materialRepository,n.material.setParameters({instancedDoublePrecision:!0});const s=n.material.createBufferWriter(),o=s.vertexBufferLayout,l=s.elementCount(n),c=o.createBuffer(l);s.write(null,null,n,c,0),this.geometry=n,this.material=n.material,this.glMaterials=new FNe(n.material,this._materialRepository),this.vertexBufferLayout=o,this.vbo=Yr.createVertex(r,Pr.STATIC_DRAW,c.buffer),this.vao=new qm(r,Er,{geometry:md(o)},{geometry:this.vbo}),this.vertexCount=l}destroy(){this.glMaterials.dispose(),this.vbo.dispose(),this.vao.dispose()}get boundingInfo(){return this.geometry.boundingInfo}get triangleCount(){return this.vertexCount/3}intersect(e,i,r,n,s,o,l,c){const f=this.geometry.id;this.material.intersect(this.geometry,e.transform.transform,e,r,n,(_,x,T,A,M)=>{if(_>=0){if(i!=null&&!i(e.rayBegin,e.rayEnd,_))return;const I=new v5t(o.layerUid,o.graphicUid(s),f,T,l,c);if((e.results.min.drapedLayerOrder==null||M>=e.results.min.drapedLayerOrder)&&(e.results.min.dist==null||_=e.results.max.drapedLayerOrder)&&(e.results.max.dist==null||_>e.results.max.dist)&&e.results.max.set(ms.LOD,I,_,x,e.transform.transform,M),e.options.store===tl.ALL){const L=iae(e.results.min.ray);L.set(ms.LOD,I,_,x,e.transform.transform,M),e.results.all.push(L)}}})}},b5t=class r7e{static async create(e,i,r){const n=await Promise.allSettled(i.components.map(o=>e.controller.schedule(()=>new _5t(e,o),r))),s=n.map(o=>o.status==="fulfilled"?o.value:null).filter(ys);if(xo(r)||s.length!==n.length){s.forEach(o=>o.destroy()),St(r);for(const o of n)if(o.status==="rejected")throw o.reason}return new r7e(i.minScreenSpaceRadius,s)}constructor(e,i){this.minScreenSpaceRadius=e,this.components=i}destroy(){this.components.forEach(e=>e.destroy())}intersect(e,i,r,n,s,o,l){this.components.forEach(c=>c.intersect(e,i,r,n,s,o,this.boundingSphere,l))}get boundingBox(){if(this._boundingBox==null){const e=Bn();this.components.forEach(i=>{i.boundingInfo!=null&&(qf(e,i.boundingInfo.bbMin),qf(e,i.boundingInfo.bbMax))}),this._boundingBox=e}return this._boundingBox}get boundingSphere(){if(this._boundingSphere==null){const e=this.boundingBox,i=W();gm(e,i),this._boundingSphere={center:i,radius:.5*jMe(e)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((e,i)=>e+i.triangleCount,0)}};const w5t=t=>{const e=t.baseBoundingSphere.radius,i=t.levels.map(r=>r.minScreenSpaceRadius);return new y5t(e,i)};let Jp=class extends zvt{constructor(e,i){super(e),this.type=ms.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new ai,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[ke.OPAQUE_MATERIAL,r=>this._produces(r)],[ke.TRANSPARENT_MATERIAL,r=>!!this._hasTransparentLevels()&&this._produces(r)]]),this._instanceData=new YA({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(i.registerTask(ni.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=S5t(this.optionalFields),this._glInstanceBufferLayout=md(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce((e,i)=>i.reduce((r,n)=>r+n.usedMemory,e),0)}get renderStats(){const e=this._instanceData.size,i=[];return this._levels.forEach((r,n)=>{const s=this._allRenderInstanceData[0][n].size+this._allRenderInstanceData[1][n].size,o=r.triangleCount;i.push({renderedInstances:s,renderedTriangles:s*o,trianglesPerInstance:o})}),{totalInstances:e,renderedInstances:i.reduce((r,n)=>r+n.renderedInstances,0),renderedTriangles:i.reduce((r,n)=>r+n.renderedTriangles,0),levels:i}}async initializeRenderContext(e,i){this._context=e;const r=e.renderContext.rctx,n=await Promise.allSettled(this.symbol.levels.map(o=>(this._defaultRenderInstanceData[0].push(new dve(r,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new dve(r,this._instanceBufferLayout)),b5t.create(e,o,i)))),s=n.map(o=>o.status==="fulfilled"?o.value:null).filter(ys);if(xo(i)||s.length!==n.length){s.forEach(o=>o.destroy()),St(i);for(const o of n)if(o.status==="rejected")throw o.reason}this._levels=s,this._levelSelector=w5t(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData[0].forEach(e=>e.destroy()),this._highlightRenderInstanceData[0].forEach(e=>e.destroy())}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(i=>i.material.produces(ke.TRANSPARENT_MATERIAL,ue.Color)))}hasHighlights(){return this._highlightRenderInstanceData[0].some(e=>e.size>0)}_produces(e){return e!==ue.Highlight&&e!==ue.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!Tn.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const i=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),i||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(ou),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return null;const i=this._getInstanceDatas(e.output);if(!i)return null;const r=new Array;return i.forEach(n=>this.levels.forEach((s,o)=>{s.components.forEach(l=>r.push(this._beginComponent(e,n[o],l)))})),r}renderNode(e,i){const r=this._getInstanceDatas(e.output);if(!r||i==null)return;let n=0;e.rctx.bindVAO(),r.forEach(s=>this.levels.forEach((o,l)=>{o.components.forEach(c=>this._renderComponent(e,i[n++],s[l],c,l))}))}_getInstanceDatas(e){const i=e!==ue.Highlight&&e!==ue.ShadowHighlight,r=e!==ue.ShadowExcludeHighlight;return i&&r?this._allRenderInstanceData:i?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,i,r,n){if(!this.baseMaterial.isVisible()||this._octree==null)return;const s=W();je(s,n,r);const o=l=>{this._instanceData.getCombinedModelTransform(l,yve),e.transform.set(yve),bt(vve,r,e.transform.inverse),bt(_ve,n,e.transform.inverse);const c=this._instanceData.getState(l),f=this._instanceData.getLodLevel(l),_=this._levels.length;Xt((c&es.ACTIVE)!=0,"invalid instance state"),Xt(f>=0&&f<_,"invaid lod level"),this._levels[f].intersect(e,i,vve,_ve,l,this.metadata,_)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(o):this._octree.forEachAlongRay(r,s,o)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){var e;if(this._octreeCached==null){const i=this._instanceData,r=(e=i.view)==null?void 0:e.state;if(!r)return null;this._octreeCached=new g5t(i,this.baseBoundingSphere);for(let n=0;ne.forEach(i=>i.startUpdateCycle()))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:i,_camera:r,_levelSelector:n}=this;this._allRenderInstanceData.forEach(x=>x.forEach(T=>T.beginUpdate()));const s=this._instanceData,o=s.view;let l=s.size;const c=s.capacity;let f=this._instanceIndex;const _=Math.ceil(c/500);for(let x=0;x=0&&(T&es.HIGHLIGHT?(mve(this._highlightRenderInstanceData[0][I],o,f),A|=es.HIGHLIGHT_ACTIVE):(mve(this._defaultRenderInstanceData[0][I],o,f),A|=es.DEFAULT_ACTIVE)),o.state.set(f,A),o.lodLevel.set(f,I)}else A=T&~(es.ACTIVE|es.TRANSFORM_CHANGED),o.state.set(f,A);if(this._octreeCached!=null){const I=!!(T&es.ACTIVE),L=!!(A&es.ACTIVE);!I&&L?this._octreeCached.addInstance(f):I&&!L?this._octreeCached.removeInstance(f):I&&L&&T&es.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(f),this._octreeCached.addInstance(f))}f=f+1===c?0:f+1,f%_==0&&e.madeProgress()}this._instanceIndex=f,this._allRenderInstanceData.forEach(x=>x.forEach(T=>T.endUpdate())),this._context.requestRender()}_beginComponent(e,i,r){if(i.size===0)return null;const n=r.glMaterials.load(e.rctx,e.bindParameters.slot,e.output);return n!=null?n.beginSlot(e.bindParameters):null}_renderComponent(e,i,r,n,s){if(!i)return;const{bindParameters:o,rctx:l}=e;l.runAppleAmdDriverHelper();const c=l.bindTechnique(i,n.material.parameters,o);l.bindVAO(n.vao),i.ensureAttributeLocations(n.vao),c.bindDraw(T5t,o,n.material.parameters),Tn.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===ue.Color&&(c.setUniform4fv("externalColor",bve[Math.min(s,bve.length-1)]),c.setUniform1i("colorMixMode",J9e.replace));const f=r.capacity,_=r.headIndex,x=r.tailIndex,T=r.firstIndex,A=this._glInstanceBufferLayout,M=(I,L)=>{fae(l,Er,r.buffer,A,I),l.drawArraysInstanced(i.primitiveType,0,n.vertexCount,L-I),mae(l,Er,r.buffer,A)};n.material.parameters.transparent&&T!=null?_>x?(Xt(T>=x&&T<=_,"invalid firstIndex"),M(T,_),M(x,T)):_=0&&T<=_,"invalid firstIndex"),M(T,_),M(x,f),M(0,T)):(Xt(T>=x&&T<=f,"invalid firstIndex"),M(T,f),M(0,_),M(x,T))):_>x?M(x,_):_(n=(r=>(r=this.symbolLayer)==null?void 0:r.material)())==null?void 0:n.color)()){const s=this._getCombinedOpacity(i),o=s<1||this.needsDrivenTransparentPass;return e.transparent=o,e.opacity=s,e.cullFace=o?Ln.None:Ln.Back,e}async _createResourcesForPrimitive(e,i){const r=this.symbolLayer,n=ya(Lrt(e)),s=mc(Y6(n)),o=mc(TH(s,r)),l=rt(o),c=!1,f=!1,_={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:[...Ale],ambient:Bv,diffuse:Bv,hasSlicePlane:this._context.slicePlaneEnabled,hasSliceHighlight:!1,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},x=!!_.usePBR;this._setMaterialTransparencyParameters(_);const T=this.symbol;if(T.type==="point-3d"&&T.verticalOffset){const{screenLength:z,minWorldLength:k,maxWorldLength:U}=T.verticalOffset;_.verticalOffset={screenLength:Tr(z),minWorldLength:k||0,maxWorldLength:U??1/0},_.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(_.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)_.externalColor=xf;else{const z=r.material!=null?r.material.color:null,k=z!=null?qe.toUnitRGBA(z):xf;_.externalColor=k}this._fastUpdates=C5(this._context.renderer,this._fastVisualVariableConvertOptions(n,o,s,null)),_.isInstanced=!0,this._fastUpdates?(Object.assign(_,this._fastUpdates.materialParameters),this._optionalFields.push(J.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(_.hasInstancedColor=!0,this._optionalFields.push(J.COLOR)),Le("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(J.OBJECTANDLAYERIDCOLOR);const A=new km(_),M=V6e(e,A);if(!M)throw new Error(`Unknown object symbol primitive: ${e}`);const I=EN(M).map(z=>({opacity:1,transparent:z.parameters.transparent})),L=await this._createStageResources(M,x,i),F=await this._createLodRenderer(M,i);return new wve(M,F,L,I,s,c,f,n,o,l,x,null)}async _createResourcesForUrl(e,i){var re,he;const r={materialParameters:{isInstanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=C5(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(r.materialParameters,this._fastUpdates.materialParameters),this._optionalFields.push(J.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(r.materialParameters.hasInstancedColor=!0,this._optionalFields.push(J.COLOR)),Le("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(J.OBJECTANDLAYERIDCOLOR);const n=this.symbol;if(n.type==="point-3d"&&n.verticalOffset){const{screenLength:ce,minWorldLength:be,maxWorldLength:ye}=n.verticalOffset;r.materialParameters.verticalOffset={screenLength:Tr(ce),minWorldLength:be||0,maxWorldLength:ye??1/0},r.materialParameters.castShadows=!1}const s=this._context.physicalBasedRenderingEnabled;r.signal=i,r.usePBR=s,r.skipHighLods=this._context.skipHighSymbolLods;const o=await Q8e(e,r),l=o.isEsriSymbolResource,c=o.isWosr,f=aOt(o.lods),_=this._context,x=this.symbolLayer.material,T=this._getExternalColorParameters(x),A=(he=(re=this.symbolLayer)==null?void 0:re.material)==null?void 0:he.color,M=this._getCombinedOpacity(A,{hasIntrinsicColor:!0}),I=this.needsDrivenTransparentPass,L=EN(f),F=EN(f).map(ce=>({opacity:ce.parameters.opacity||1,transparent:ce.parameters.transparent}));L.forEach(ce=>{const be=ce.parameters;ce.setParameters(T);const ye=be.opacity*M,pe=ye<1||I||be.transparent;ce.setParameters({opacity:ye,transparent:pe}),_.screenSizePerspectiveEnabled&&ce.setParameters({screenSizePerspective:_.sharedResources.screenSizePerspectiveSettings})});const z=o.referenceBoundingBox,k=mc(Y6(z)),U=mc(f.levels[0].pivotOffset),j=mc(TH(k,this.symbolLayer)),H=rt(j),Y=this._fastUpdates;A5(Y,this._context.renderer,this._fastVisualVariableConvertOptions(z,j,k,U))&&L.forEach(ce=>ce.setParameters(Y.materialParameters));const Q=await this._createStageResources(f,s,i),ne=await this._createLodRenderer(f,i);return new wve(f,ne,Q,F,k,l,c,z,j,H,s,U)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,i,r){const n=this._context.stage,s=EN(e);i!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),n.addMany(s),this._addDisposeResource(()=>n.removeMany(s));const o=Oye(e);n.addMany(o),this._addDisposeResource(()=>{o.forEach(c=>c.unload()),n.removeMany(o)}),await Promise.all(o.map(c=>this._context.stage.schedule(()=>c.load(n.renderView.renderingContext),r))),St(r);const l=Pye(e);return n.addMany(l),this._addDisposeResource(()=>n.removeMany(l)),{materials:s,textures:o,geometries:l}}async _createLodRenderer(e,i){const r=this._context.stage,n={layerUid:this._context.layer.uid,graphicUid:c=>this._instanceIndexToGraphicUid.get(c),notifyGraphicGeometryChanged:c=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(c)),notifyGraphicVisibilityChanged:c=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(c))},s=this._fastUpdates,o=s?{applyTransform:(c,f,_)=>{c.getFeatureAttribute(f,YN),Ao(_,U2t(s.materialParameters,YN,_))},scaleFactor:(c,f,_)=>{f.getFeatureAttribute(_,YN),dle(c,s.materialParameters,YN)}}:null,l=new Jp({symbol:e,optionalFields:this._optionalFields,metadata:n,shaderTransformation:o},this._context.scheduler);return l.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource(()=>{r.removeRenderPlugin(l),l.destroy()}),await r.addRenderPlugin(l,i),l}_getExternalColorParameters(e){const i={};return this._drivenProperties.color?i.externalColor=xf:(e==null?void 0:e.color)!=null?i.externalColor=qe.toUnitRGBA(e.color):(i.externalColor=xf,i.colorMixMode="ignore"),i}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach(e=>e()),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry))return null;const r=UL(i.geometry);if(r==null)return this.logger.warn(`unsupported geometry type for icon symbol: ${i.geometry.type}`),null;const n=this.setGraphicElevationContext(i),s=e.renderingInfo;return this._createAs3DShape(i,r,s,n,i.uid,e.layer.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){var s,o;if(this._resources==null)return;const e=this._drivenProperties.opacity,i=!this._isPrimitive,r=this._resources.stageResources.materials,n=this._resources.originalMaterialParameters;for(let l=0;lArray.from(l.attributes.values()).reduce((c,f)=>c+l_(f.data,f.indices),0),n=Pye(e).reduce((l,c)=>l+r(c),0),s=Oye(e).reduce((l,c)=>l+c.memoryEstimate,0)+n,o={..._De(this.symbol,this.symbolLayer),resourceBytes:s};return new ff({verticesPerFeature:i,memory:o})}_hasLodRenderer(){return this._resources!=null}_createAs3DShape(e,i,r,n,s,o){if(!this._hasLodRenderer()||this._resources==null)return null;const l=this.getFastUpdateAttrValues(e),c=this._context.clippingExtent;if(ud(i,CC,this._context.elevationProvider.spatialReference),c!=null&&!$se(c,CC))return null;const f=this._requiresTerrainElevation(n),_=this._computeGlobalTransform(i,n,QW,XN),x=this._computeLocalTransform(this._resources,this.symbolLayer,r,xve),T=this._resources.lodRenderer.instanceData,A=T.addInstance();this._instanceIndexToGraphicUid.set(A,s),T.setLocalTransform(A,x,!1),T.setGlobalTransform(A,_),l&&T.setFeatureAttribute(A,l),this._fastUpdates==null&&this._hasPerInstanceColor()&&T.setColor(A,w$(r.color,r.opacity,255)),this._context.stage.renderView.objectAndLayerIdRenderHelper!=null&&T.setObjectAndLayerIdColor(A,this._context.stage.renderView.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor({graphicUid:s,layerUid:o}));const M=new nOt(this,A,i3t,n);return f&&(M.alignedSampledElevation=XN.sampledElevation),M.needsElevationUpdates=X2(n.mode),zL(M,i,this._context.elevationProvider),M}_computeGlobalTransform(e,i,r,n){return Y2(e,this._context.elevationProvider,i,this._context.renderCoordsHelper,n),CC[0]=e.x,CC[1]=e.y,CC[2]=n.z,uu(e.spatialReference,CC,r,this._context.renderCoordsHelper.spatialReference),r}_computeLocalTransform(e,i,r,n){return Hf(n),this._applyObjectRotation(r,!1,n),this._applyObjectRotation(i,!0,n),this._applyObjectScale(e,r,n),this._applyAnchor(e,i,n),n}_applyObjectScale(e,i,r){var o;if((o=this._fastUpdates)!=null&&o.requiresShaderTransformation)return;const n=this._drivenProperties.size&&i.size?i.size:e.symbolSize,s=Aye(n,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);s[0]===1&&s[1]===1&&s[2]===1||$9(r,r,s)}prepareSymbolLayerPatch(e){if(e.diff.type!=="partial")return;const i=e.diff.diff;this._preparePatchTransform(e,i),this._preparePatchColor(e,i)}updateGeometry(e,i){if(this._resources==null)return!0;const r=i&&UL(i);if(r==null)return!1;const n=this.getGeometryElevationMode(i);return e.elevationContext.mode===n&&(this._computeGlobalTransform(r,e.elevationContext,QW,XN),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=XN.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,QW,!0),zL(e,r,this._context.elevationProvider),!0)}_preparePatchTransform(e,i){if(!(i.heading||i.tilt||i.roll||i.width||i.height||i.depth||i.anchor||i.anchorPosition)||this._resources==null)return;const r=(M,I,L)=>(M!=null&&M.type==="complete"?M.newValue:I)??L,n=r(i.heading,this.symbolLayer.heading,0),s=r(i.tilt,this.symbolLayer.tilt,0),o=r(i.roll,this.symbolLayer.roll,0),l=r(i.width,this.symbolLayer.width,void 0),c=r(i.height,this.symbolLayer.height,void 0),f=r(i.depth,this.symbolLayer.depth,void 0),_=r(i.anchor,this.symbolLayer.anchor,void 0),x=r(i.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete i.heading,delete i.tilt,delete i.roll,delete i.width,delete i.height,delete i.depth,delete i.anchor,delete i.anchorPosition;const T={heading:n,tilt:s,roll:o,anchor:_,anchorPosition:x},A=this._resources;this.loadStatus===ep.LOADED&&e.symbolLayerStatePatches.push(()=>{A.symbolSize=mc(TH(A.resourceSize,{width:l,height:c,depth:f,isPrimitive:this.symbolLayer.isPrimitive}))}),e.graphics3DGraphicPatches.push((M,I)=>{const L=this._computeLocalTransform(A,T,I,xve),F=M.instanceIndex;A.lodRenderer.instanceData.setLocalTransform(F,L,!0)})}_preparePatchColor(e,i){if(!i.material||i.material.type!=="partial")return;const r=i.material.diff;if(!r.color||r.color.type!=="complete"||r.color.newValue==null||r.color.oldValue==null)return;const n=r.color.newValue,s=n!=null?qe.toUnitRGBA(n):xf;delete r.color;const o=this._resources;o!=null&&e.graphics3DGraphicPatches.push(l=>{let c;this._hasPerInstanceColor()?(o.lodRenderer.instanceData.setColor(l.instanceIndex,s),c=this._setMaterialTransparencyParameters({},n)):c=this._setMaterialTransparencyParameters({externalColor:s},n);for(const f of o.stageResources.materials)f.setParameters(c)})}_requiresTerrainElevation(e){return e.mode!=="absolute-height"}_applyObjectRotation(e,i,r){var n;if(!((n=this._fastUpdates)!=null&&n.requiresShaderTransformation)||!i)return Hxt(e.heading,e.tilt,e.roll,r)}_computeAnchor(e,i,r){const n=W();switch(r.anchor){case"center":Ne(n,gm(e)),Sc(n,n);break;case"top":{const s=gm(e);Ie(n,-s[0],-s[1],-e[5]);break}case"bottom":{const s=gm(e);Ie(n,-s[0],-s[1],-e[2]);break}case"relative":{const s=gm(e),o=Y6(e),l=r.anchorPosition,c=l?nt(l.x,l.y,l.z):Ka;gB(n,o,c),Be(n,n,s),Sc(n,n);break}default:i!=null?Sc(n,i):Ne(n,Ka)}return n}_applyAnchor(e,i,r){var s;if((s=this._fastUpdates)!=null&&s.requiresShaderTransformation)return;const n=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,i);n&&Qu(r,r,n)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,i,r,n){const s=e!=null?mc(Y6(e)):Bv,o=e!=null?this._computeAnchor(e,n,this.symbolLayer):Ka,l=this._context.renderCoordsHelper.unitInMeters,c=Aye(i??void 0,i,r,l),f=nt(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new K9({size:!0,color:!0,rotation:!0,opacity:!1},s,i??Bv,l,o,c,f)}};const CC=W(),xve=Qe(),QW=Qe(),YN=Xi(),XN=new r6;let C5t=class{constructor(e,i,r,n){this.vertices=e,this.positionsES=i,this.offset=n;const s=e.length,o=Math.floor(s/2),l=this.offset+3*o,c=r[l],f=r[l+1],_=r[l+2];this.origin=nt(c,f,_),this.positions=Rs(3*s);const x=this.offset+3*s;for(let T=this.offset;Tthis.emitCapVertex(n,l,c,f,_,x),o=(l,c,f,_)=>this.emitVertex(n,l,c,f,_);for(this.startCap.rebuildConnectingProfileGeometry(r[n],this.profile,s),n=1;n{s.push(f),s.push(_),s.push(x),o.push(f),o.push(_),o.push(x),l.push(this.pathVertexData[f]),l.push(this.pathVertexData[_]),l.push(this.pathVertexData[x])};for(let f=0;f=this.cutoffAngle){const c=e.rotationFrameUp;for(let f=0;f=0?r(n,i.vertices[_],i.normals[_],!1):r(l,e.applyMiterStretch(Eve,i.vertices[_]),i.normals[_],!0)}}else for(let c=0;c=0;r(l,e.applyMiterStretch(Eve,i.vertices[f]),i.normals[f],!_)}}},s7e=class{constructor(){this.up=W(),this.right=W()}};function P5t(t,e,i){bt(t.up,e.up,i),bt(t.right,e.right,i)}const Eve=yt(),Cve=Qe(),R5t=new s7e;let I5t=class extends Bo{constructor(e,i,r,n,s,o){super(e,i,null,Ws.Mesh,o),this.path=r,this.geometrySR=n,this.stencilWidth=s}};var Ry;function o7e(t){return"path"in t}(function(t){t[t.World=0]="World",t[t.Path=1]="Path"})(Ry||(Ry={}));let a7e=class{constructor(e){this.builder=e}onPathChanged(e){this.builder.onPathChanged()}},l7e=class extends a7e{constructor(e){super(e),this.vertexAttributeColor=Mi(255,255,255,255),this.size=new Array,this.vertexAttributePosition=Rs(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Int16Array(2*this.builder.numVerticesTotal)}bakeVertexColors(e){this.vertexAttributeColor[0]=255*e[0],this.vertexAttributeColor[1]=255*e[1],this.vertexAttributeColor[2]=255*e[2],this.vertexAttributeColor[3]=255*(e.length>3?e[3]:1)}bake(e){this.size=e;const{numVerticesTotal:i,pathVertexData:r,path:n,positions:s,profileRightAxes:o,profileUpAxes:l,profileVertexAndNormals:c}=this.builder;for(let f=0;fQ){or(Y,-H[1],H[0]);const re=fs(z,Y);Gu(H,H,Q*Math.sign(ne)),Gu(Y,Y,re),df(z,H,Y)}Ie(T,0,0,0)}const k=Ie(N5t,L[0]*z[0]+F[0]*z[1],L[1]*z[0]+F[1]*z[1],L[2]*z[0]+F[2]*z[1]),U=3*f;this.vertexAttributePosition[U]=s[_]+k[0]+T[0]*A,this.vertexAttributePosition[U+1]=s[_+1]+k[1]+T[1]*A,this.vertexAttributePosition[U+2]=s[_+2]+k[2]+T[2]*A;const j=or(Ave,c[I+2],c[I+3]);tE(this.vertexAttributeNormal,f,L[0]*j[0]+F[0]*j[1]+T[0]*M,L[1]*j[0]+F[1]*j[1]+T[1]*M,L[2]*j[0]+F[2]*j[1]+T[2]*M)}}createGeometryData(){const e=this.builder.vertexIndices.length,{normalIndices:i,vertexIndices:r}=this.builder;return[[J.POSITION,new It(this.vertexAttributePosition,r,3,!0)],[J.NORMALCOMPRESSED,new It(this.vertexAttributeNormal,i,2,!0)],[J.COLOR,new It(this.vertexAttributeColor,ux(e),4)]]}onPathChanged(e){super.onPathChanged(e),this.bake(this.size)}intersect(e,i,r){const n=this.builder.vertexIndices,s=new yP(this.vertexAttributePosition,3),o=n.length/3;Q9(e,i,0,o,n,s,void 0,void 0,r)}},$5t=class extends a7e{constructor(e,i,r,n){super(e),this.sizeAttributeValue=i,this.colorAttributeValue=r,this.opacityAttributeValue=n,this.vvData=null,this.baked=new l7e(e),this.vvData=Rs(4*this.builder.path.vertices.length);for(let s=0;s0?(L=1/Math.sqrt(L),f[0]=f[0]*L,f[1]=f[1]*L,f[2]=f[2]*L):(f[0]=T.vRight[0],f[1]=T.vRight[1],f[2]=T.vRight[2]),_[0]=A[M]+i.frame.up[0],_[1]=A[M+1]+i.frame.up[1],_[2]=A[M+2]+i.frame.up[2],M+=3;const F=Ie(V5t,A[M],A[M+1],A[M+2]);z_(F,f,x),bE(x,Sp(_,T.vLeft),c)?(c[0]-=A[M],c[1]-=A[M+1],c[2]-=A[M+2],Ye(o,c),Wt(l,f,o),Ye(l,l)):CU(f,i.frame.up,i.frame.right,s,l,o,n),Ne(T.frame.up,o),Ne(T.frame.right,l),i=T}}const V5t=W();let c7e=class{constructor(){this.vertices=new Array,this.normals=new Array,this.indices=new Array,this.poles=new Array,this.poleIndices=new Array}addVertex(e,i){return this.vertices.push(AM(e)),this.normals.push(AM(i)),this.vertices.length-1}addPole(e,i=null){return this.poles.push({position:AM(e),normal:i?AM(i):null}),this.poles.length-1}addSegment(e,i=null){this.indices.push(e.v0),this.indices.push(e.v1),i&&(this.poleIndices.push(i.v0),this.poleIndices.push(i.v1))}get numSegments(){return this.indices.length/2}translate(e,i){for(const r of this.vertices)r[0]+=e,r[1]+=i;for(const r of this.poles)r.position[0]+=e,r.position[1]+=i}get usedMemory(){return this.vertices.length*l_(this.vertices[0])*2+l_(this.indices)}};const u7e={top:[0,-.5],bottom:[0,.5]};function tY(t){const i=F6e,r=new c7e,n={v0:0,v1:0};r.addPole(Ji(0,0));for(let o=0;oTi({blending:s,depthTest:zle,depthWrite:o,colorWrite:ji,stencilWrite:e.hasOccludees?n1:null,stencilTest:e.hasOccludees?n?tx:bx:null});return e.output===ue.Color?(this._occludeePipelineState=r(!0,e.transparent?i:null,sh),r(!1,e.transparent?i:null,sh)):r(!1)}get primitiveType(){return sr.LINES}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}};k8e.shader=new Ir(WAt,()=>we(()=>Promise.resolve().then(()=>fXt),void 0));let JA=class extends pu{constructor(){super(...arguments),this.output=ue.Color,this.hasSlicePlane=!1,this.hasVertexColors=!1,this.transparent=!1,this.hasOccludees=!1}};y([fe({count:ue.COUNT})],JA.prototype,"output",void 0),y([fe()],JA.prototype,"hasSlicePlane",void 0),y([fe()],JA.prototype,"hasVertexColors",void 0),y([fe()],JA.prototype,"transparent",void 0),y([fe()],JA.prototype,"hasOccludees",void 0);let sve=class extends yx{constructor(e){super(e,new XAt),this._configuration=new JA}getConfiguration(e){return this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration}intersect(e,i,r,n,s,o){if(!r.options.selectionMode||!e.visible)return;if(!k4e(i))return void Ce.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const a=e.attributes.get(J.POSITION).data,c=r.camera,p=JAt;ea(p,r.point);const _=2;Ie(IR[0],p[0]-_,p[1]+_,0),Ie(IR[1],p[0]+_,p[1]+_,0),Ie(IR[2],p[0]+_,p[1]-_,0),Ie(IR[3],p[0]-_,p[1]-_,0);for(let P=0;P<4;P++)if(!c.unprojectFromRenderScreen(IR[P],$1[P]))return;Hl(c.eye,$1[0],$1[1],tY),Hl(c.eye,$1[1],$1[2],iY),Hl(c.eye,$1[2],$1[3],rY),Hl(c.eye,$1[3],$1[0],nY);let x=Number.MAX_VALUE,S=0;for(let P=0;P0){je(pg,Su,Tu);const F=c.frustum,z=-gn(F[In.NEAR],Su)/Ve(pg,F[In.NEAR]);De(pg,pg,z),Be(Su,Su,pg),c.projectToRenderScreen(Su,Hx)}else if(Hx[2]>0&&qx[2]<0){je(pg,Tu,Su);const F=c.frustum,z=-gn(F[In.NEAR],Tu)/Ve(pg,F[In.NEAR]);De(pg,pg,z),Be(Tu,Tu,pg),c.projectToRenderScreen(Tu,qx)}else if(Hx[2]<0&&qx[2]<0)continue;Hx[2]=0,qx[2]=0;const $=nae(ST(Hx,qx,lve),p);$e.unload()),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,KAt,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(i),n=e.renderingInfo;return this._createAs3DShape(i,n,r,i.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,i){const r=this._getLayerOpacity();this._updateMaterialParameters(n=>{n.material.setParameters({layerOpacity:r});const s=n.material.parameters;this._setMaterialTransparentParameter(s,n),n.material.setParameters({transparent:s.transparent})}),e.forEach(n=>{var s;return(s=i(n))==null?void 0:s.layerOpacityChanged(r,this._context.isAsync)})}layerElevationInfoChanged(e,i){return this.updateGraphics3DGraphicElevationInfo(e,i,ex)}slicePlaneEnabledChanged(e,i){return this._updateMaterialParameters(({material:r})=>{r.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e.forEach(r=>{var n;return(n=i(r))==null?void 0:n.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters(({material:i})=>i.setParameters({usePBR:e})),!0}updateTransform(e,i,r,n){const s=this._context.renderCoordsHelper.spatialReference,o=eMt,{origin:a,transform:c}=r;switch(Ac(i,Ie(Pa,a.x,a.y,a.z??0),o,s),n){case V$.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case V$.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case V$.UpdateFastLocalOrigin:e.updateFastLocalOrigin(o,c,this._context.localOriginFactory)}const{elevationContext:p}=e;p.centerPointInElevationSR=this._getCenterPointInElevationSR(o);const{elevationProvider:_,renderCoordsHelper:x}=this._context,S=(C,M)=>Q2(C,_,p,x,M);return e.alignedSampledElevation=CT(e,p,_.spatialReference,S,x,o),e.updateTransform(o,c,this._context.isAsync),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(e){return e==null?"-":e instanceof qe?e.toHex():e.contentHash}_materialPropertiesDefault(e,i){const r=this._requiresSymbolVertexColors(),n=!!e.vertexAttributes.color,s=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:n,hasVertexTangents:s,uid:`vc:${n},vt:${s},vct${i},svc:${r}`}}_textureTransformUid(e){const{offset:i,scale:r,rotation:n}=e??iMt;return`${i[0]},${i[1]},${n},${r[0]},${r[1]}`}_materialProperties(e,i,r){const n=this._materialPropertiesDefault(e,r);if(!i.material)return n;const{color:s,colorTexture:o,colorTextureTransform:a,normalTexture:c,normalTextureTransform:p,doubleSided:_,alphaCutoff:x,alphaMode:S}=i.material,C=this._colorOrTextureUid(s),M=this._colorOrTextureUid(o),P=this._textureTransformUid(a),$=this._colorOrTextureUid(c),F=this._textureTransformUid(p);if(n.color=s,n.colorTexture=o,n.normalTexture=c,n.uid=`${n.uid},cmuid:${C},ctmuid:${M},cttuid:${P},ntmuid:${$},nttuid:${F},ds:${_},ac:${x},am:${S}`,i.material instanceof w8e){const{metallic:z,roughness:k,metallicRoughnessTexture:U,metallicRoughnessTextureTransform:j,emissiveColor:G,emissiveTexture:Y,emissiveTextureTransform:Q,occlusionTexture:ne,occlusionTextureTransform:ie}=i.material,he=this._colorOrTextureUid(U),ce=this._textureTransformUid(j),ve=this._colorOrTextureUid(G),ge=this._colorOrTextureUid(Y),pe=this._textureTransformUid(Q),Ee=this._colorOrTextureUid(ne),te=this._textureTransformUid(ie);n.metallic=z,n.roughness=k,n.metallicRoughnessTexture=U,n.emissiveColor=G,n.emissiveTexture=Y,n.occlusionTexture=ne,n.colorTextureTransform=this._convertTextureTransform(a),n.normalTextureTransform=this._convertTextureTransform(p),n.emissiveTextureTransform=this._convertTextureTransform(Q),n.occlusionTextureTransform=this._convertTextureTransform(ie),n.metallicRoughnessTextureTransform=this._convertTextureTransform(j),n.uid=`${n.uid},mrm:${z},mrr:${k},mrt:${he},mrtt:${ce},emuid:${ve},etmuid:${ge},ett:${pe},otmuid:${Ee},ott:${te}`}return n}_convertTextureTransform(e){if(!e)return null;const{scale:i,offset:r,rotation:n}=e;return{scale:i,offset:r,rotation:Ei(n)}}_setInternalColorValueParameters(e,i){i.diffuse=qe.toUnitRGB(e),i.opacity=e.a}_getLoadableTextureResource(e){return e.data??e.url}_getInternalTextureId(e){const i=this._getInternalTexture(e,yn.Opaque);return i==null?void 0:i.id}_getInternalTexture(e,i){const r=this._getLoadableTextureResource(e);if(!r)return null;const n=`${e.contentHash}/${i}`;let s=this._textures.get(n);if(!s){let o=null;const a=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,c={wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,maxAnisotropy:a,mipmap:a>1};B$(r)?(o=r.data,c.preMultiplyAlpha=!1,c.encoding=r.encoding):(o=r,c.preMultiplyAlpha=i!==yn.Opaque,c.downsampleUncompressed=this._context.graphicsCoreOwner.view.qualitySettings.graphics3D.uncompressedTextureDownsamplingEnabled),s=new DE(o,c),this._textures.set(n,s),s.load(this._context.stage.renderView.renderingContext),this._context.stage.add(s)}return s}_castTextureWrap(e="repeat"){if(typeof e=="string"){const i=this._castTextureWrapIndividual(e);return{s:i,t:i}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return Bi.CLAMP_TO_EDGE;case"mirror":return Bi.MIRRORED_REPEAT;default:return Bi.REPEAT}}_setInternalMaterialParameters(e,i){if(e.color!=null&&this._setInternalColorValueParameters(e.color,i),e.colorTexture!=null){const r=this._getInternalTexture(e.colorTexture,i.textureAlphaMode);r?(i.textureId=r.id,i.textureAlphaPremultiplied=!!r.parameters.preMultiplyAlpha):i.textureId=void 0}e.normalTexture&&(i.normalTextureId=this._getInternalTextureId(e.normalTexture)),e.emissiveColor&&(i.emissiveFactor=qe.toUnitRGB(e.emissiveColor)),e.emissiveTexture&&(i.emissiveTextureId=this._getInternalTextureId(e.emissiveTexture)),e.occlusionTexture&&(i.occlusionTextureId=this._getInternalTextureId(e.occlusionTexture)),e.metallicRoughnessTexture&&(i.metallicRoughnessTextureId=this._getInternalTextureId(e.metallicRoughnessTexture)),i.colorTextureTransformMatrix=gy(e.colorTextureTransform),i.normalTextureTransformMatrix=gy(e.normalTextureTransform),i.occlusionTextureTransformMatrix=gy(e.occlusionTextureTransform),i.emissiveTextureTransformMatrix=gy(e.emissiveTextureTransform),i.metallicRoughnessTextureTransformMatrix=gy(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e){var n,s;const i=this._drivenProperties.color;let r=((n=this.symbolLayer.material)==null?void 0:n.colorMixMode)??null;if(i)e.externalColor=Af;else{const o=((s=this.symbolLayer.material)==null?void 0:s.color)??null;o?e.externalColor=qe.toUnitRGBA(o):(r=null,e.externalColor=Af)}r&&(e.colorMixMode=r),e.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const i=e.vertexAttributes.color;if(i==null)return!1;for(let r=3;rQ2($,C,r,M,F);return S.alignedSampledElevation=CT(S,r,C.spatialReference,P,M),S}_getCenterPointInElevationSR(e){const i=Ju(0,0,0,this._context.elevationProvider.spatialReference!=null?this._context.elevationProvider.spatialReference:null);return _8e([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,i),i}_createComponentNormals(e,i,r,n){switch(r.shading||"flat"){default:case"source":return this._createComponentNormalsSource(e,i,r,n);case"flat":return this._createComponentNormalsFlat(e,n);case"smooth":return this._createComponentNormalsSmooth(e,n)}}_createComponentNormalsSource(e,i,r,n){if(i==null)return this._createComponentNormalsFlat(e,n);let s=!1;if(!r.trustSourceNormals)for(let o=0;os&&(s=a)}if(r<=s)return this.logger.warn(`Vertex index ${s} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,i){return i.faces??IE(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){var o;if(!this._context.clippingExtent)return!1;const i=(o=e.vertexAttributes)==null?void 0:o.position;if(!i)return!1;const r=this._context.elevationProvider.spatialReference,n=I8e({positions:i,transform:e.transform,vertexSpace:e.vertexSpace,inSpatialReference:e.spatialReference,outSpatialReference:r??e.spatialReference,localMode:this._context.stage.viewingMode===_t.Local}),s=n.length/3;return Bn(oY),pp(oY,n,0,s),!bm(oY,this._context.clippingExtent)}_createGeometryInfo(e,i,r){if(!rh(e.spatialReference,this._context.graphicsCoreOwner.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const n=this._createBuffers(e,i);if(n==null)return null;const{positionBuffer:s,uvBuffer:o,colorBuffer:a,symbolColorBuffer:c,normalBuffer:p,tangentBuffer:_,objectTransformation:x,geometryTransformation:S}=n,C=this._getOrCreateComponents(e),M=new Array;let P=!1;const $=$z(Pa,x),F=this._context.localOriginFactory.getOrigin($);for(const z of C){if(!this._validateFaces(e,z))return null;const k=this._getOrCreateFaces(e,z);if(k.length===0)continue;const U=this._createComponentNormals(s,p,z,k);U.didFlipNormals&&(P=!0);const j=[[J.POSITION,new $t(s,k,3,!0)],[J.NORMAL,new $t(U.normals,U.indices,3,!0)]];a&&j.push([J.COLOR,new $t(a,k,4,!0)]),c&&j.push([J.SYMBOLCOLOR,new $t(c,mx(k.length),4,!0)]),o&&j.push([J.UV0,new $t(o,k,2,!0)]),_&&j.push([J.TANGENT,new $t(_,k,4,!0)]);const G=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),Y=this._getOrCreateMaterial(e,z),Q=new jo(Y,j,null,Ws.Mesh,G);Q.transformation=S,Q.localOrigin=F,M.push(Q)}return P&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:M,objectTransformation:x}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((i,r)=>{r.setParameters(i.parameters)})}test(){return{...super.test(),materials:this._materialInfoCache.materials}}},sY=class{constructor(e,i,r){this.normals=e,this.indices=i,this.didFlipNormals=r}};const JN=W(),Pa=W(),MC=W(),OC=W(),PC=W(),cve=Qe(),$R=as(),eMt=Qe(),oY=va(),tMt=[new vAt],iMt=new IO;var Rh;(function(t){t[t.NONE=0]="NONE",t[t.ECEF=1]="ECEF"})(Rh||(Rh={}));let rMt=class{constructor(e,i,r,n){this.graphics3DSymbolLayer=e,this.instanceIndex=i,this.elevationAligner=r,this.elevationContext=n,this.type="lod-instance",this._highlights=new Set,this.alignedSampledElevation=0,this.isElevationSource=!1,this.needsElevationUpdates=!1}initialize(){}setVisibility(e){const i=this._lodRenderer.instanceData;e!==i.getVisible(this.instanceIndex)&&i.setVisible(this.instanceIndex,e)}destroy(){this.instanceIndex!=null&&(this._lodRenderer.instanceData.removeInstance(this.instanceIndex),this.graphics3DSymbolLayer.notifyDestroyGraphicLayer(this))}alignWithElevation(e,i,r){if(this.elevationAligner){pG(this.elevationContext.featureExpressionInfoContext,r);const n=(o,a)=>Q2(o,e,this.elevationContext,i,a),s=this.elevationAligner(this,this.elevationContext,e.spatialReference,n,i);s!=null&&(this.alignedSampledElevation=s)}}getCenterObjectSpace(e=W()){return this._lodRenderer.instanceData.getCombinedLocalTransform(this.instanceIndex,fg),bt(e,this._lodRenderer.baseBoundingSphere.center,fg)}getBoundingBoxObjectSpace(e=va()){this._lodRenderer.instanceData.getCombinedLocalTransform(this.instanceIndex,fg);const i=this._lodRenderer.baseBoundingBox;Bn(e);for(let r=0;r<8;++r)Ie(Bp,1&r?i[3]:i[0],2&r?i[4]:i[1],4&r?i[5]:i[2]),bt(Bp,Bp,fg),Xf(e,Bp);return e}computeAttachmentOrigin(e){this._lodRenderer.instanceData.getGlobalTransform(this.instanceIndex,fg),e.render.origin[0]+=fg[12],e.render.origin[1]+=fg[13],e.render.origin[2]+=fg[14],e.render.num++}async getProjectedBoundingBox(e,i,r,n,s){const o=this.getBoundingBoxObjectSpace(s),a=nMt,c=Bse(o)?1:a.length;this._lodRenderer.instanceData.getGlobalTransform(this.instanceIndex,fg);for(let _=0;_{this._removeHighlightId(n)},r)}}removeObjectState(e){this._highlights.forEach(i=>e.remove(i))}_addHighlightId(e){this._highlights.add(e),this._lodRenderer.instanceData.setHighlight(this.instanceIndex,!0)}_removeHighlightId(e){this._highlights.delete(e),this._lodRenderer.instanceData.setHighlight(this.instanceIndex,this._highlights.size>0)}get _lodRenderer(){return this.graphics3DSymbolLayer.lodRenderer}};const Wx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],Bp=W(),aY=W(),nMt=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]],fg=Qe();function sMt(t,e){const i=t.stageResources.geometries.map(n=>new L6e(n,t.stageResources.textures)),r=t.lodThreshold==null||t.lodThreshold===0&&e>0?aMt(i):t.lodThreshold;return new D6e(i,r,t.pivotOffset)}function oMt(t){return new N6e(t.map((e,i)=>sMt(e,i)))}function aMt(t){const e=t.reduce((i,{geometry:r})=>i+r.indexCount/3,0);return Math.sqrt(e*lMt/Math.PI)}const lMt=20;function cMt(t){return t=t||globalThis.location.hostname,uMt.some(e=>(t==null?void 0:t.match(e))!=null)}function Lie(t,e){return t&&(e=e||globalThis.location.hostname)?e.match(U8e)!=null||e.match(B8e)!=null?t.replace("static.arcgis.com","staticdev.arcgis.com"):e.match(V8e)!=null||e.match(j8e)!=null?t.replace("static.arcgis.com","staticqa.arcgis.com"):t:t}const U8e=/^devext.arcgis.com$/,V8e=/^qaext.arcgis.com$/,B8e=/^[\w-]*\.mapsdevext.arcgis.com$/,j8e=/^[\w-]*\.mapsqa.arcgis.com$/,uMt=[/^([\w-]*\.)?[\w-]*\.zrh-dev-local.esri.com$/,U8e,V8e,/^jsapps.esri.com$/,B8e,j8e];function hMt(t,e,i){if(t.count!==e.count)return void bG.error("source and destination buffers need to have the same number of elements");const r=t.count,n=i[0],s=i[1],o=i[2],a=i[3],c=i[4],p=i[5],_=i[6],x=i[7],S=i[8],C=i[9],M=i[10],P=i[11],$=i[12],F=i[13],z=i[14],k=i[15],U=t.typedBuffer,j=t.typedBufferStride,G=e.typedBuffer,Y=e.typedBufferStride;for(let Q=0;Q0){const M=1/Math.sqrt(C);r[c]=M*_,r[c+1]=M*x,r[c+2]=M*S}}}function fMt(t,e,i){iV(t.typedBuffer,e,i,t.typedBufferStride)}function iV(t,e,i,r=4){const n=Math.min(t.length/r,e.count),s=e.typedBuffer,o=e.typedBufferStride;let a=0,c=0;for(let p=0;p{const e={...H8e,...t.pbrMetallicRoughness},i=CMt({...EMt,...t.extras});return{...TMt,...t,pbrMetallicRoughness:e,extras:i}};function CMt(t){switch(t.ESRI_externalColorMixMode){case"multiply":case"tint":case"ignore":case"replace":break;default:t.ESRI_externalColorMixMode,t.ESRI_externalColorMixMode="tint"}return t}const AMt={magFilter:ki.LINEAR,minFilter:ki.LINEAR_MIPMAP_LINEAR,wrapS:Bi.REPEAT,wrapT:Bi.REPEAT},MMt=t=>({...AMt,...t});function OMt(t){let e,i;return t.replace(/^(.*\/)?([^/]*)$/,(r,n,s)=>(e=n||"",i=s||"","")),{dirPart:e,filePart:i}}const KN={MAGIC:1179937895,CHUNK_TYPE_JSON:1313821514,CHUNK_TYPE_BIN:5130562,MIN_HEADER_LENGTH:20};let PMt=class yw{constructor(e,i,r,n){if(this._context=e,this.uri=i,this.json=r,this._glbBuffer=n,this._bufferLoaders=new Map,this._textureLoaders=new Map,this._textureCache=new Map,this._materialCache=new Map,this._nodeParentMap=new Map,this._nodeTransformCache=new Map,this._supportedExtensions=["KHR_texture_basisu"],this._baseUri=OMt(this.uri).dirPart,this._checkVersionSupported(),this._checkRequiredExtensionsSupported(),r.scenes==null)throw new se("gltf-loader-unsupported-feature","Scenes must be defined.");if(r.meshes==null)throw new se("gltf-loader-unsupported-feature","Meshes must be defined");if(r.nodes==null)throw new se("gltf-loader-unsupported-feature","Nodes must be defined.");this._computeNodeParents()}static async load(e,i,r){if(c1(i)){const o=I2(i);if(o&&o.mediaType!=="model/gltf-binary")try{const c=JSON.parse(o.isBase64?atob(o.data):o.data);return new yw(e,i,c)}catch{}const a=Rne(i);if(yw._isGLBData(a))return this._fromGLBData(e,i,a)}if(NMt.test(i)||(r==null?void 0:r.expectedType)==="gltf"){const o=await e.loadJSON(i,r);return new yw(e,i,o)}const n=await e.loadBinary(i,r);if(yw._isGLBData(n))return this._fromGLBData(e,i,n);if(FMt.test(i)||(r==null?void 0:r.expectedType)==="glb")throw new se("gltf-loader-invalid-glb","This is not a valid glb file.");const s=await e.loadJSON(i,r);return new yw(e,i,s)}static _isGLBData(e){if(e==null)return!1;const i=new uve(e);return i.remainingBytes()>=4&&i.readUint32()===KN.MAGIC}static async _fromGLBData(e,i,r){const n=await yw._parseGLBData(r);return new yw(e,i,n.json,n.binaryData)}static async _parseGLBData(e){const i=new uve(e);if(i.remainingBytes()<12)throw new se("gltf-loader-error","glb binary data is insufficiently large.");const r=i.readUint32(),n=i.readUint32(),s=i.readUint32();if(r!==KN.MAGIC)throw new se("gltf-loader-error","Magic first 4 bytes do not fit to expected glb value.");if(e.byteLength=8;){const p=i.readUint32(),_=i.readUint32();if(c===0){if(_!==KN.CHUNK_TYPE_JSON)throw new se("gltf-loader-error","First glb chunk must be JSON.");if(p<0)throw new se("gltf-loader-error","No JSON data found.");o=await UAt(i.readUint8Array(p))}else if(c===1){if(_!==KN.CHUNK_TYPE_BIN)throw new se("gltf-loader-unsupported-feature","Second glb chunk expected to be BIN.");a=i.readUint8Array(p)}else Ce.getLogger("esri.views.3d.glTF").warn("[Unsupported Feature] More than 2 glb chunks detected. Skipping.");c+=1}if(!o)throw new se("gltf-loader-error","No glb JSON chunk detected.");return{json:o,binaryData:a}}async getBuffer(e,i){const r=this.json.buffers[e];if(r.uri==null){if(this._glbBuffer==null)throw new se("gltf-loader-error","glb buffer not present");return this._glbBuffer}const n=await this._getBufferLoader(e,i);if(n.byteLength!==r.byteLength)throw new se("gltf-loader-error","Buffer byte lengths should match.");return n}async _getBufferLoader(e,i){const r=this._bufferLoaders.get(e);if(r)return r;const n=this.json.buffers[e].uri,s=this._context.loadBinary(this._resolveUri(n),i).then(o=>new Uint8Array(o));return this._bufferLoaders.set(e,s),s}async getAccessor(e,i){if(!this.json.accessors)throw new se("gltf-loader-unsupported-feature","Accessors missing.");const r=this.json.accessors[e];if((r==null?void 0:r.bufferView)==null)throw new se("gltf-loader-unsupported-feature","Some accessor does not specify a bufferView.");if(r.type in[j$.MAT2,j$.MAT3,j$.MAT4])throw new se("gltf-loader-unsupported-feature",`AttributeType ${r.type} is not supported`);const n=this.json.bufferViews[r.bufferView],s=await this.getBuffer(n.buffer,i),o=$Mt[r.type],a=LMt[r.componentType],c=o*a,p=n.byteStride||c;return{raw:s.buffer,byteStride:p,byteOffset:s.byteOffset+(n.byteOffset||0)+(r.byteOffset||0),entryCount:r.count,isDenselyPacked:p===c,componentCount:o,componentByteSize:a,componentType:r.componentType,min:r.min,max:r.max,normalized:!!r.normalized}}async getIndexData(e,i){if(e.indices==null)return;const r=await this.getAccessor(e.indices,i);if(r.isDenselyPacked)switch(r.componentType){case Yt.UNSIGNED_BYTE:return new Uint8Array(r.raw,r.byteOffset,r.entryCount);case Yt.UNSIGNED_SHORT:return new Uint16Array(r.raw,r.byteOffset,r.entryCount);case Yt.UNSIGNED_INT:return new Uint32Array(r.raw,r.byteOffset,r.entryCount)}else switch(r.componentType){case Yt.UNSIGNED_BYTE:return yk(this._wrapAccessor($P,r));case Yt.UNSIGNED_SHORT:return yk(this._wrapAccessor(Wj,r));case Yt.UNSIGNED_INT:return yk(this._wrapAccessor(Xj,r))}}async getPositionData(e,i){if(e.attributes.POSITION==null)throw new se("gltf-loader-unsupported-feature","No POSITION vertex data found.");const r=await this.getAccessor(e.attributes.POSITION,i);if(r.componentType!==Yt.FLOAT)throw new se("gltf-loader-unsupported-feature","Expected type FLOAT for POSITION vertex attribute, but found "+Yt[r.componentType]);if(r.componentCount!==3)throw new se("gltf-loader-unsupported-feature","POSITION vertex attribute must have 3 components, but found "+r.componentCount.toFixed());return this._wrapAccessor(Ca,r)}async getNormalData(e,i){if(e.attributes.NORMAL==null)throw new se("gltf-loader-error","No NORMAL vertex data found.");const r=await this.getAccessor(e.attributes.NORMAL,i);if(r.componentType!==Yt.FLOAT)throw new se("gltf-loader-unsupported-feature","Expected type FLOAT for NORMAL vertex attribute, but found "+Yt[r.componentType]);if(r.componentCount!==3)throw new se("gltf-loader-unsupported-feature","NORMAL vertex attribute must have 3 components, but found "+r.componentCount.toFixed());return this._wrapAccessor(Ca,r)}async getTangentData(e,i){if(e.attributes.TANGENT==null)throw new se("gltf-loader-error","No TANGENT vertex data found.");const r=await this.getAccessor(e.attributes.TANGENT,i);if(r.componentType!==Yt.FLOAT)throw new se("gltf-loader-unsupported-feature","Expected type FLOAT for TANGENT vertex attribute, but found "+Yt[r.componentType]);if(r.componentCount!==4)throw new se("gltf-loader-unsupported-feature","TANGENT vertex attribute must have 4 components, but found "+r.componentCount.toFixed());return new Um(r.raw,r.byteOffset,r.byteStride,r.byteOffset+r.byteStride*r.entryCount)}async getTextureCoordinates(e,i){if(e.attributes.TEXCOORD_0==null)throw new se("gltf-loader-error","No TEXCOORD_0 vertex data found.");const r=await this.getAccessor(e.attributes.TEXCOORD_0,i);if(r.componentCount!==2)throw new se("gltf-loader-unsupported-feature","TEXCOORD_0 vertex attribute must have 2 components, but found "+r.componentCount.toFixed());if(r.componentType===Yt.FLOAT)return this._wrapAccessor(RE,r);if(!r.normalized)throw new se("gltf-loader-unsupported-feature","Integer component types are only supported for a normalized accessor for TEXCOORD_0.");return DMt(r)}async getVertexColors(e,i){if(e.attributes.COLOR_0==null)throw new se("gltf-loader-error","No COLOR_0 vertex data found.");const r=await this.getAccessor(e.attributes.COLOR_0,i);if(r.componentCount!==4&&r.componentCount!==3)throw new se("gltf-loader-unsupported-feature","COLOR_0 attribute must have 3 or 4 components, but found "+r.componentCount.toFixed());if(r.componentCount===4){if(r.componentType===Yt.FLOAT)return this._wrapAccessor(Um,r);if(r.componentType===Yt.UNSIGNED_BYTE)return this._wrapAccessor(Pc,r);if(r.componentType===Yt.UNSIGNED_SHORT)return this._wrapAccessor(Q9,r)}else if(r.componentCount===3){if(r.componentType===Yt.FLOAT)return this._wrapAccessor(Ca,r);if(r.componentType===Yt.UNSIGNED_BYTE)return this._wrapAccessor(qj,r);if(r.componentType===Yt.UNSIGNED_SHORT)return this._wrapAccessor(Yj,r)}throw new se("gltf-loader-unsupported-feature","Unsupported component type for COLOR_0 attribute: "+Yt[r.componentType])}hasPositions(e){return e.attributes.POSITION!==void 0}hasNormals(e){return e.attributes.NORMAL!==void 0}hasVertexColors(e){return e.attributes.COLOR_0!==void 0}hasTextureCoordinates(e){return e.attributes.TEXCOORD_0!==void 0}hasTangents(e){return e.attributes.TANGENT!==void 0}async getMaterial(e,i,r){var s,o,a,c,p,_,x,S,C,M;let n=e.material?this._materialCache.get(e.material):void 0;if(!n){const P=e.material!=null?dve(this.json.materials[e.material]):dve(),$=P.pbrMetallicRoughness,F=this.hasVertexColors(e),z=this.getTexture($.baseColorTexture,i),k=this.getTexture(P.normalTexture,i),U=r?this.getTexture(P.occlusionTexture,i):void 0,j=r?this.getTexture(P.emissiveTexture,i):void 0,G=r?this.getTexture($.metallicRoughnessTexture,i):void 0,Y=e.material!=null?e.material:-1;n={alphaMode:P.alphaMode,alphaCutoff:P.alphaCutoff,color:$.baseColorFactor,doubleSided:!!P.doubleSided,colorTexture:await z,normalTexture:await k,name:P.name,id:Y,occlusionTexture:await U,emissiveTexture:await j,emissiveFactor:P.emissiveFactor,metallicFactor:$.metallicFactor,roughnessFactor:$.roughnessFactor,metallicRoughnessTexture:await G,hasVertexColors:F,ESRI_externalColorMixMode:P.extras.ESRI_externalColorMixMode,colorTextureTransform:(o=(s=$==null?void 0:$.baseColorTexture)==null?void 0:s.extensions)==null?void 0:o.KHR_texture_transform,normalTextureTransform:(c=(a=P.normalTexture)==null?void 0:a.extensions)==null?void 0:c.KHR_texture_transform,occlusionTextureTransform:(_=(p=P.occlusionTexture)==null?void 0:p.extensions)==null?void 0:_.KHR_texture_transform,emissiveTextureTransform:(S=(x=P.emissiveTexture)==null?void 0:x.extensions)==null?void 0:S.KHR_texture_transform,metallicRoughnessTextureTransform:(M=(C=$==null?void 0:$.metallicRoughnessTexture)==null?void 0:C.extensions)==null?void 0:M.KHR_texture_transform}}return n}async getTexture(e,i){if(!e)return;if((e.texCoord||0)!==0)throw new se("gltf-loader-unsupported-feature","Only TEXCOORD with index 0 is supported.");const r=e.index,n=this.json.textures[r],s=MMt(n.sampler!=null?this.json.samplers[n.sampler]:{}),o=this._getTextureSourceId(n),a=this.json.images[o],c=await this._loadTextureImageData(r,n,i);return oB(this._textureCache,r,()=>{const p=x=>x===33071||x===33648||x===10497,_=x=>{throw new se("gltf-loader-error",`Unexpected TextureSampler WrapMode: ${x}`)};return{data:c,wrapS:p(s.wrapS)?s.wrapS:_(s.wrapS),wrapT:p(s.wrapT)?s.wrapT:_(s.wrapT),minFilter:s.minFilter,name:a.name,id:r}})}getNodeTransform(e){if(e===void 0)return RMt;let i=this._nodeTransformCache.get(e);if(!i){const r=this.getNodeTransform(this._getNodeParent(e)),n=this.json.nodes[e];n.matrix?i=sn(Qe(),r,n.matrix):n.translation||n.rotation||n.scale?(i=mP(r),n.translation&&eh(i,i,n.translation),n.rotation&&(QN[3]=Uoe(QN,n.rotation),Zh(i,i,QN[3],QN)),n.scale&&L9(i,i,n.scale)):i=mP(r),this._nodeTransformCache.set(e,i)}return i}_wrapAccessor(e,i){return new e(i.raw,i.byteOffset,i.byteStride,i.byteOffset+i.byteStride*(i.entryCount-1)+i.componentByteSize*i.componentCount)}_resolveUri(e){return Wh(e,this._baseUri)}_getNodeParent(e){return this._nodeParentMap.get(e)}_checkVersionSupported(){const e=k2.parse(this.json.asset.version,"glTF");IMt.validate(e)}_checkRequiredExtensionsSupported(){const e=this.json;if(e.extensionsRequired&&!e.extensionsRequired.every(i=>this._supportedExtensions.includes(i)))throw new se("gltf-loader-unsupported-feature","gltf loader was not able to load unsupported feature. Required extensions: "+e.extensionsRequired.join(", "))}_computeNodeParents(){this.json.nodes.forEach((e,i)=>{e.children&&e.children.forEach(r=>{this._nodeParentMap.set(r,i)})})}async _loadTextureImageData(e,i,r){const n=this._textureLoaders.get(e);if(n)return n;const s=this._createTextureLoader(i,r);return this._textureLoaders.set(e,s),s}_getTextureSourceId(e){if(e.extensions!==void 0&&e.extensions.KHR_texture_basisu!==null)return e.extensions.KHR_texture_basisu.source;if(e.source!==null)return e.source;throw new se("gltf-loader-unsupported-feature","Source is expected to be defined for a texture. It can also be omitted in favour of an KHR_texture_basisu extension tag.")}async _createTextureLoader(e,i){const r=this._getTextureSourceId(e),n=this.json.images[r];if(n.uri){if(n.uri.endsWith(".ktx2")){const c=await this._context.loadBinary(this._resolveUri(n.uri),i);return new N8e(new Uint8Array(c))}return this._context.loadImage(this._resolveUri(n.uri),i)}if(n.bufferView==null)throw new se("gltf-loader-unsupported-feature","Image bufferView must be defined.");if(n.mimeType==null)throw new se("gltf-loader-unsupported-feature","Image mimeType must be defined.");const s=this.json.bufferViews[n.bufferView],o=await this.getBuffer(s.buffer,i);if(s.byteStride!=null)throw new se("gltf-loader-unsupported-feature","byteStride not supported for image buffer");const a=o.byteOffset+(s.byteOffset||0);return VAt(new Uint8Array(o.buffer,a,s.byteLength),n.mimeType)}async getLoadedBuffersSize(){if(this._glbBuffer)return this._glbBuffer.byteLength;const e=await lZ(Array.from(this._bufferLoaders.values())),i=await lZ(Array.from(this._textureLoaders.values()));return e.reduce((r,n)=>r+((n==null?void 0:n.byteLength)??0),0)+i.reduce((r,n)=>r+(n?B$(n)?n.data.byteLength:n.width*n.height*4:0),0)}};const RMt=lCe(Qe(),Math.PI/2),IMt=new k2(2,0,"glTF"),QN=Rp(),$Mt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},LMt={[Yt.BYTE]:1,[Yt.UNSIGNED_BYTE]:1,[Yt.SHORT]:2,[Yt.UNSIGNED_SHORT]:2,[Yt.FLOAT]:4,[Yt.INT]:4,[Yt.UNSIGNED_INT]:4};function DMt(t){switch(t.componentType){case Yt.BYTE:return new Zj(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount);case Yt.UNSIGNED_BYTE:return new Hj(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount);case Yt.SHORT:return new e6(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount);case Yt.UNSIGNED_SHORT:return new Kae(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount);case Yt.UNSIGNED_INT:return new Qae(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount);case Yt.FLOAT:return new RE(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*t.entryCount)}}const NMt=/\.gltf$/i,FMt=/\.glb$/i;let kMt=0;async function q8e(t,e,i={},r=!0){const n=await PMt.load(t,e,i),s="gltf_"+kMt++,o={lods:[],materials:new Map,textures:new Map,meta:zMt(n)},a=!(!n.json.asset.extras||n.json.asset.extras.ESRI_type!=="symbolResource"),c=new Map;await UMt(n,async(_,x,S,C)=>{var ie;const M=c.get(S)??0;c.set(S,M+1);const P=_.mode!==void 0?_.mode:sr.TRIANGLES,$=P===sr.TRIANGLES||P===sr.TRIANGLE_STRIP||P===sr.TRIANGLE_FAN?P:null;if($==null)return void Ce.getLogger("esri.views.3d.glTF").warn("[Unsupported Feature] Unsupported primitive mode ("+sr[P]+"). Skipping primitive.");if(!n.hasPositions(_))return void Ce.getLogger("esri.views.3d.glTF").warn("Skipping primitive without POSITION vertex attribute.");const F=n.getPositionData(_,i),z=n.getMaterial(_,i,r),k=n.hasNormals(_)?n.getNormalData(_,i):null,U=n.hasTangents(_)?n.getTangentData(_,i):null,j=n.hasTextureCoordinates(_)?n.getTextureCoordinates(_,i):null,G=n.hasVertexColors(_)?n.getVertexColors(_,i):null,Y=n.getIndexData(_,i),Q={name:C,transform:mP(x),attributes:{position:await F,normal:k?await k:null,texCoord0:j?await j:null,color:G?await G:null,tangent:U?await U:null},indices:await Y,primitiveType:$,material:BMt(o,await z,s)};let ne=null;((ie=o.meta)==null?void 0:ie.ESRI_lod)!=null&&o.meta.ESRI_lod.metric==="screenSpaceRadius"&&(ne=o.meta.ESRI_lod.thresholds[S]),o.lods[S]=o.lods[S]||{parts:[],name:C,lodThreshold:ne},o.lods[S].parts[M]=Q});for(const _ of o.lods)_.parts=_.parts.filter(x=>!!x);const p=await n.getLoadedBuffersSize();return{model:o,meta:{isEsriSymbolResource:a,uri:n.uri},customMeta:{},size:p}}function zMt(t){const e=t.json;let i=null;return e.nodes.forEach(r=>{const n=r.extras;n!=null&&(n.ESRI_proxyEllipsoid||n.ESRI_lod)&&(i=n)}),i}async function UMt(t,e){const i=t.json,r=i.scenes[i.scene||0].nodes,n=r.length>1,s=[];for(const a of r){const c=i.nodes[a];s.push(o(a,0)),VMt(c)&&!n&&c.extensions.MSFT_lod.ids.forEach((p,_)=>o(p,_+1))}async function o(a,c){const p=i.nodes[a],_=t.getNodeTransform(a);if(p.weights!=null&&Ce.getLogger("esri.views.3d.glTF").warn("[Unsupported Feature] Morph targets are not supported."),p.mesh!=null){const x=i.meshes[p.mesh];for(const S of x.primitives)s.push(e(S,_,c,x.name))}for(const x of p.children||[])s.push(o(x,c))}await Promise.all(s)}function VMt(t){var e;return((e=t.extensions)==null?void 0:e.MSFT_lod)&&Array.isArray(t.extensions.MSFT_lod.ids)}function BMt(t,e,i){const r=s=>{const o=`${i}_tex_${s&&s.id}${s!=null&&s.name?"_"+s.name:""}`;if(s&&!t.textures.has(o)){const a=SMt(s.data,{wrap:{s:s.wrapS,t:s.wrapT},mipmap:jMt.has(s.minFilter),noUnpackFlip:!0});t.textures.set(o,a)}return o},n=`${i}_mat_${e.id}_${e.name}`;if(!t.materials.has(n)){const s=xMt({color:[e.color[0],e.color[1],e.color[2]],opacity:e.color[3],alphaMode:e.alphaMode,alphaCutoff:e.alphaCutoff,doubleSided:e.doubleSided,colorMixMode:e.ESRI_externalColorMixMode,textureColor:e.colorTexture?r(e.colorTexture):void 0,textureNormal:e.normalTexture?r(e.normalTexture):void 0,textureOcclusion:e.occlusionTexture?r(e.occlusionTexture):void 0,textureEmissive:e.emissiveTexture?r(e.emissiveTexture):void 0,textureMetallicRoughness:e.metallicRoughnessTexture?r(e.metallicRoughnessTexture):void 0,emissiveFactor:[e.emissiveFactor[0],e.emissiveFactor[1],e.emissiveFactor[2]],colorTextureTransform:e.colorTextureTransform,normalTextureTransform:e.normalTextureTransform,occlusionTextureTransform:e.occlusionTextureTransform,emissiveTextureTransform:e.emissiveTextureTransform,metallicRoughnessTextureTransform:e.metallicRoughnessTextureTransform,metallicFactor:e.metallicFactor,roughnessFactor:e.roughnessFactor});t.materials.set(n,s)}return n}const jMt=new Set([ki.LINEAR_MIPMAP_LINEAR,ki.LINEAR_MIPMAP_NEAREST]);function GMt(t,e){switch(e){case sr.TRIANGLES:return HMt(t);case sr.TRIANGLE_STRIP:return qMt(t);case sr.TRIANGLE_FAN:return WMt(t)}}function HMt(t){return typeof t=="number"?IE(t):i2(t)?new Uint16Array(t):t}function qMt(t){const e=typeof t=="number"?t:t.length;if(e<3)return[];const i=e-2,r=EU(3*i);if(typeof t=="number"){let n=0;for(let s=0;s{if(F.params.topology==="PerAttributeArray")return null;const Ee=F.params.faces;for(const te in Ee)if(te===pe)return Ee[te].values;return null},G=k[J.POSITION],Y=G.values.length/G.valuesPerElement;for(const pe in k){const Ee=k[pe],te=Ee.values,le=j(pe)??IE(Y);U.push([pe,new $t(te,le,Ee.valuesPerElement,!0)])}const Q=z.texture,ne=x&&x[Q];if(ne&&!C.has(Q)){const{image:pe,parameters:Ee}=ne,te=new DE(pe,Ee);r.push(te),C.set(Q,te)}const ie=C.get(Q),he=ie?ie.id:void 0,ce=z.material;let ve=s.get(ce,Q);if(ve==null){const pe=_[ce.substring(ce.lastIndexOf("/")+1)].params;pe.transparency===1&&(pe.transparency=0);const Ee=ne&&ne.alphaChannelUsage,te=pe.transparency>0||Ee==="transparency"||Ee==="maskAndTransparency",le=ne?X8e(ne.alphaChannelUsage):void 0,de={ambient:vc(pe.diffuse),diffuse:vc(pe.diffuse),opacity:1-(pe.transparency||0),transparent:te,textureAlphaMode:le,textureAlphaCutoff:.33,textureId:he,initTextureTransparent:!0,doubleSided:!0,cullFace:Ln.None,colorMixMode:pe.externalColorMixMode||"tint",textureAlphaPremultiplied:(ne==null?void 0:ne.parameters.preMultiplyAlpha)??!1};e!=null&&e.materialParameters&&Object.assign(de,e.materialParameters),ve=new Vm(de),s.set(ce,Q,ve)}n.push(ve);const ge=new jo(ve,U);S+=((P=(M=U.find(pe=>pe[0]===J.POSITION))==null?void 0:M[1])==null?void 0:P.indices.length)??0,i.push(ge)}return{engineResources:[{name:c,stageResources:{textures:r,materials:n,geometries:i},pivotOffset:o.model.pivotOffset,numberOfVertices:S,lodThreshold:null}],referenceBoundingBox:eOt(i)}}function eOt(t){const e=Bn();return t.forEach(i=>{const r=i.boundingInfo;r!=null&&(Xf(e,r.bbMin),Xf(e,r.bbMax))}),e}async function tOt(t,e){const i=new Array;for(const s in t){const o=t[s],a=o.images[0].data;if(!a){cv.warn("Externally referenced texture data is not yet supported");continue}const c=o.encoding+";base64,"+a,p="/textureDefinitions/"+s,_=o.channels==="rgba"?o.alphaChannelUsage||"transparency":"none",x={noUnpackFlip:!0,wrap:{s:Bi.REPEAT,t:Bi.REPEAT},preMultiplyAlpha:X8e(_)!==yn.Opaque},S=e!=null&&e.disableTextures?Promise.resolve(null):$_(c,e);i.push(S.then(C=>({refId:p,image:C,parameters:x,alphaChannelUsage:_})))}const r=await Promise.all(i),n={};for(const s of r)n[s.refId]=s;return n}function X8e(t){switch(t){case"mask":return yn.Mask;case"maskAndTransparency":return yn.MaskBlend;case"none":return yn.Opaque;default:return yn.Blend}}function iOt(t){const e=t.params;return{id:1,material:e.material,texture:e.texture,region:e.texture}}const rOt=new k2(1,2,"wosr"),RC=2.1;async function Z8e(t,e){var x;const i=J8e(Lie(t));if(i.fileType==="wosr"){const S=await(e.cache?e.cache.loadWOSR(i.url,e):W8e(i.url,e)),{engineResources:C,referenceBoundingBox:M}=QMt(S,e);return{lods:C,referenceBoundingBox:M,isEsriSymbolResource:!1,isWosr:!0}}const r=await(e.cache?e.cache.loadGLTF(i.url,e,!!e.usePBR):q8e(new G8e(e.streamDataRequester),i.url,e,e.usePBR)),n=(x=r.model.meta)==null?void 0:x.ESRI_proxyEllipsoid,s=r.meta.isEsriSymbolResource&&n!=null&&r.meta.uri.includes("/RealisticTrees/");s&&!r.customMeta.esriTreeRendering&&(r.customMeta.esriTreeRendering=!0,aOt(r,n));const o=!!e.usePBR,a=r.meta.isEsriSymbolResource?{usePBR:o,isSchematic:!1,treeRendering:s,mrrFactors:[...gxt]}:{usePBR:o,isSchematic:!1,treeRendering:!1,mrrFactors:[...mG]},c={...e.materialParameters,treeRendering:s},{engineResources:p,referenceBoundingBox:_}=K8e(r,a,c,e.skipHighLods&&i.specifiedLodIndex==null?{skipHighLods:!0}:{skipHighLods:!1,singleLodIndex:i.specifiedLodIndex});return{lods:p,referenceBoundingBox:_,isEsriSymbolResource:r.meta.isEsriSymbolResource,isWosr:!1}}function J8e(t){const e=t.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return e?{fileType:"gltf",url:e[1],specifiedLodIndex:e[4]!=null?Number(e[4]):null}:t.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:t,specifiedLodIndex:null}:{fileType:"unknown",url:t,specifiedLodIndex:null}}function K8e(t,e,i,r){const n=t.model,s=new Array,o=new Map,a=new Map,c=n.lods.length,p=Bn();return n.lods.forEach((_,x)=>{const S=r.skipHighLods===!0&&(c>1&&x===0||c>3&&x===1)||r.skipHighLods===!1&&r.singleLodIndex!=null&&x!==r.singleLodIndex;if(S&&x!==0)return;const C=new XMt(_.name,_.lodThreshold,[0,0,0]);_.parts.forEach(M=>{const P=S?new Vm({}):nOt(n,M,C,e,i,o,a),{geometry:$,vertexCount:F}=sOt(M,P??new Vm({})),z=$.boundingInfo;z!=null&&x===0&&(Xf(p,z.bbMin),Xf(p,z.bbMax)),P!=null&&(C.stageResources.geometries.push($),C.numberOfVertices+=F)}),S||s.push(C)}),{engineResources:s,referenceBoundingBox:p}}function nOt(t,e,i,r,n,s,o){const a=e.material+(e.attributes.normal?"_normal":"")+(e.attributes.color?"_color":"")+(e.attributes.texCoord0?"_texCoord0":"")+(e.attributes.tangent?"_tangent":""),c=t.materials.get(e.material),p=e.attributes.texCoord0!=null,_=e.attributes.normal!=null;if(c==null)return null;const x=oOt(c.alphaMode);if(!s.has(a)){if(p){const j=(G,Y=!1)=>{if(G!=null&&!o.has(G)){const Q=t.textures.get(G);if(Q!=null){const ne=Q.data;o.set(G,new DE(B$(ne)?ne.data:ne,{...Q.parameters,preMultiplyAlpha:!B$(ne)&&Y,encoding:B$(ne)&&ne.encoding!=null?ne.encoding:void 0}))}}};j(c.textureColor,x!==yn.Opaque),j(c.textureNormal),j(c.textureOcclusion),j(c.textureEmissive),j(c.textureMetallicRoughness)}const C=c.color[0]**(1/RC),M=c.color[1]**(1/RC),P=c.color[2]**(1/RC),$=c.emissiveFactor[0]**(1/RC),F=c.emissiveFactor[1]**(1/RC),z=c.emissiveFactor[2]**(1/RC),k=c.textureColor!=null&&p?o.get(c.textureColor):null,U=H6e({normalTexture:c.textureNormal,metallicRoughnessTexture:c.textureMetallicRoughness,metallicFactor:c.metallicFactor,roughnessFactor:c.roughnessFactor,emissiveTexture:c.textureEmissive,emissiveFactor:c.emissiveFactor,occlusionTexture:c.textureOcclusion});s.set(a,new Vm({...r,transparent:x===yn.Blend,customDepthTest:KT.Lequal,textureAlphaMode:x,textureAlphaCutoff:c.alphaCutoff,diffuse:[C,M,P],ambient:[C,M,P],opacity:c.opacity,doubleSided:c.doubleSided,doubleSidedType:"winding-order",cullFace:c.doubleSided?Ln.None:Ln.Back,hasVertexColors:!!e.attributes.color,hasVertexTangents:!!e.attributes.tangent,normalType:_?Br.Attribute:Br.ScreenDerivative,castShadows:!0,textureId:k!=null?k.id:void 0,colorMixMode:c.colorMixMode,normalTextureId:c.textureNormal!=null&&p?o.get(c.textureNormal).id:void 0,textureAlphaPremultiplied:k!=null&&!!k.parameters.preMultiplyAlpha,occlusionTextureId:c.textureOcclusion!=null&&p?o.get(c.textureOcclusion).id:void 0,emissiveTextureId:c.textureEmissive!=null&&p?o.get(c.textureEmissive).id:void 0,metallicRoughnessTextureId:c.textureMetallicRoughness!=null&&p?o.get(c.textureMetallicRoughness).id:void 0,emissiveFactor:[$,F,z],mrrFactors:U?[...Ule]:[c.metallicFactor,c.roughnessFactor,r.mrrFactors[2]],isSchematic:U,colorTextureTransformMatrix:gy(c.colorTextureTransform),normalTextureTransformMatrix:gy(c.normalTextureTransform),occlusionTextureTransformMatrix:gy(c.occlusionTextureTransform),emissiveTextureTransformMatrix:gy(c.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:gy(c.metallicRoughnessTextureTransform),...n}))}const S=s.get(a);if(i.stageResources.materials.push(S),p){const C=M=>{M!=null&&i.stageResources.textures.push(o.get(M))};C(c.textureColor),C(c.textureNormal),C(c.textureOcclusion),C(c.textureEmissive),C(c.textureMetallicRoughness)}return S}function sOt(t,e){const i=t.attributes.position.count,r=GMt(t.indices||i,t.primitiveType),n=$s(3*i),{typedBuffer:s,typedBufferStride:o}=t.attributes.position;Gm(n,s,t.transform,3,o);const a=[[J.POSITION,new $t(n,r,3,!0)]];if(t.attributes.normal!=null){const c=$s(3*i),{typedBuffer:p,typedBufferStride:_}=t.attributes.normal;E_(e8,t.transform),Hm(c,p,e8,3,_),a.push([J.NORMAL,new $t(c,r,3,!0)])}if(t.attributes.tangent!=null){const c=$s(4*i),{typedBuffer:p,typedBufferStride:_}=t.attributes.tangent;E_(e8,t.transform),wce(c,p,e8,4,_),a.push([J.TANGENT,new $t(c,r,4,!0)])}if(t.attributes.texCoord0!=null){const c=$s(2*i),{typedBuffer:p,typedBufferStride:_}=t.attributes.texCoord0;xce(c,p,2,_),a.push([J.UV0,new $t(c,r,2,!0)])}if(t.attributes.color!=null){const c=new Uint8Array(4*i);t.attributes.color.elementCount===4?t.attributes.color instanceof Um?iV(c,t.attributes.color,255):t.attributes.color instanceof Pc?Sce(c,t.attributes.color):t.attributes.color instanceof Q9&&iV(c,t.attributes.color,1/256):(c.fill(255),t.attributes.color instanceof Ca?GU(c,t.attributes.color,255,4):t.attributes.color instanceof qj?g6(c,t.attributes.color.typedBuffer,4,t.attributes.color.typedBufferStride):t.attributes.color instanceof Yj&&GU(c,t.attributes.color,1/256,4)),a.push([J.COLOR,new $t(c,r,4,!0)])}return{geometry:new jo(e,a),vertexCount:i}}const e8=as();function oOt(t){switch(t){case"BLEND":return yn.Blend;case"MASK":return yn.Mask;case"OPAQUE":case null:case void 0:return yn.Opaque}}function aOt(t,e){for(let i=0;i1&&Qr(_,_,c,F>-1?.2:Math.min(-4*F-3.8,1)),S[M]=_[0],S[M+1]=_[1],S[M+2]=_[2],M+=3,x[P]=255*k,x[P+1]=255*k,x[P+2]=255*k,x[P+3]=255,P+=4}n.attributes.normal=new Ca(S),n.attributes.color=new Pc(x)}}}const Hui=Object.freeze(Object.defineProperty({__proto__:null,fetch:Z8e,gltfToEngineResources:K8e,parseUrl:J8e},Symbol.toStringTag,{value:"Module"}));function Q8e(t,e,i,r){const n=t.name;return n==null?Promise.reject(new se("symbolstyleutils:style-symbol-reference-name-missing","Missing name in style symbol reference")):t.styleName&&t.styleName==="Esri2DPointSymbolsStyle"?lOt(n,e,r):hoe(t,e,r).then(s=>Ece(s,n,e,i,LOe,r))}function Tce(t,e){return e.items.find(i=>i.name===t)}function Ece(t,e,i,r,n,s){var C,M;const o=(i==null?void 0:i.portal)!=null?i.portal:os.getDefault(),a={portal:o,url:Is(t.baseUrl),origin:"portal-item"},c=Tce(e,t.data);if(!c){const P=`The symbol name '${e}' could not be found`;return Promise.reject(new se("symbolstyleutils:symbol-name-not-found",P,{symbolName:e}))}let p=w_(n(c,r),a),_=((C=c.thumbnail)==null?void 0:C.href)??null;const x=(M=c.thumbnail)==null?void 0:M.imageData;cMt()&&(p=Lie(p)??"",_=Lie(_));const S={portal:o,url:Is(Lne(p)),origin:"portal-item"};return doe(p,s).then(P=>{const $=r==="cimRef"?$Oe(P.data):P.data,F=fOe($,S);if(F&&Ky(F)){if(_){const z=w_(_,a);F.thumbnail=new vT({url:z})}else x&&(F.thumbnail=new vT({url:`data:image/png;base64,${x}`}));t.styleUrl?F.styleOrigin=new EL({portal:i.portal,styleUrl:t.styleUrl,name:e}):t.styleName&&(F.styleOrigin=new EL({portal:i.portal,styleName:t.styleName,name:e}))}return F})}function lOt(t,e,i){const r=frt.replaceAll(/\{SymbolName\}/gi,t),n=e.portal!=null?e.portal:os.getDefault();return doe(r,i).then(s=>{const o=$Oe(s.data);return fOe(o,{portal:n,url:Is(Lne(r)),origin:"portal-item"})})}const cOt=Object.freeze(Object.defineProperty({__proto__:null,fetchSymbolFromStyle:Ece,getStyleItemFromStyle:Tce,resolveWebStyleSymbol:Q8e},Symbol.toStringTag,{value:"Module"}));async function uOt(t){var a;if(t===null||t.styleName==null&&t.styleUrl==null)return null;const e=t.name;if(e==null)throw new se("symbolstyleutils:style-symbol-reference-name-missing","Missing name in style symbol reference");const i={portal:t.portal},r=await hoe(t,i).catch(()=>null);if(r===null)return null;const n=Tce(e,r.data);if(n&&!((a=n.formatInfos)!=null&&a.some(c=>c.type==="gltf_basisu")))return null;const s=await Ece(r,e,i,"webRef",(c,p)=>LOe(c,p,["gltf_basisu","gltf"])).catch(()=>null);if(s===null||s.type!=="point-3d")return null;const o=s.symbolLayers.items[0];return o.type==="object"?o.resource:null}let hOt=class{constructor(e,i,r){this._elementSize=i,this._buffer=Yr.createVertex(e,Rr.STATIC_DRAW),this.resize(r)}destroy(){this._buffer.dispose()}get elementSize(){return this._elementSize}get capacity(){return this._capacity}get array(){return this._array}get buffer(){return this._buffer}get usedMemory(){return this._array.byteLength+this._buffer.byteLength}copyRange(e,i,r,n=0){const s=new Uint8Array(this.array,e*this.elementSize,(i-e)*this.elementSize);new Uint8Array(r.array,n*this.elementSize).set(s)}transferAll(){this._buffer.setData(this._array)}transferRange(e,i){const r=e*this._elementSize,n=i*this._elementSize;this._buffer.setSubData(new Uint8Array(this._array),r,r,n)}resize(e){const i=e*this._elementSize,r=new ArrayBuffer(i);this._array&&(e>=this._capacity?new Uint8Array(r).set(new Uint8Array(this._array)):new Uint8Array(r).set(new Uint8Array(this._array).subarray(0,e*this._elementSize))),this._array=r,this._buffer.setSize(i),this._capacity=e}},dOt=class{constructor(e){this.modelOriginHi=e.getField(J.INSTANCEMODELORIGINHI,Ca),this.modelOriginLo=e.getField(J.INSTANCEMODELORIGINLO,Ca),this.model=e.getField(J.INSTANCEMODEL,Y2),this.modelNormal=e.getField(J.INSTANCEMODELNORMAL,Y2),this.featureAttribute=e.getField(J.INSTANCEFEATUREATTRIBUTE,Um),this.color=e.getField(J.INSTANCECOLOR,Pc),this.objectAndLayerIdColor=e.getField(J.INSTANCEOBJECTANDLAYERIDCOLOR,Pc)}},pve=class{constructor(e,i){this._headIndex=0,this._tailIndex=0,this._firstIndex=null,this._captureFirstIndex=!0,this._updating=!1,this._prevHeadIndex=0,this._resized=!1,this._rctx=e,this._instanceBufferLayout=i,this._elementSize=i.stride,this._capacity=1}destroy(){this._buffer&&this._buffer.destroy()}get buffer(){return this._buffer.buffer}get view(){return this._view}get capacity(){return this._capacity}get size(){const e=this._headIndex,i=this._tailIndex;return e>=i?e-i:e+this._capacity-i}get isEmpty(){return this._headIndex===this._tailIndex}get isFull(){return this._tailIndex===(this._headIndex+1)%this._capacity}get headIndex(){return this._headIndex}get tailIndex(){return this._tailIndex}get firstIndex(){return this._firstIndex}get usedMemory(){var e;return((e=this._buffer)==null?void 0:e.usedMemory)??0}reset(){this._headIndex=0,this._tailIndex=0,this._firstIndex=null}startUpdateCycle(){this._captureFirstIndex=!0}beginUpdate(){Xt(!this._updating,"already updating"),this._updating=!0,this._prevHeadIndex=this._headIndex}endUpdate(){Xt(this._updating,"not updating"),this.size0,"invalid size");const e=this._tailIndex===this._firstIndex;this._incrementTail(),e&&(this._firstIndex=this._tailIndex)}_grow(){const e=Math.max(rV,Math.floor(this._capacity*KV));this._resize(e)}_shrink(){const e=Math.max(rV,Math.floor(this._capacity*oGe));this._resize(e)}_resize(e){if(Xt(this._updating,"not updating"),e===this._capacity)return;const i=new hOt(this._rctx,this._elementSize,e);if(this._buffer){this._firstIndex&&(this._firstIndex=(this._firstIndex+this._capacity-this._tailIndex)%this._capacity);const r=this.size,n=this._compactInstances(i);Xt(n===r,"invalid compaction"),this._buffer.destroy(),this._tailIndex=0,this._headIndex=n,this._prevHeadIndex=0}this._resized=!0,this._capacity=e,this._buffer=i,this._view=new dOt(this._instanceBufferLayout.createView(this._buffer.array))}_compactInstances(e){const i=this._headIndex,r=this._tailIndex;return ri?(this._buffer.copyRange(r,this._capacity,e),i>0&&this._buffer.copyRange(0,i,e,this._capacity-r),i+(this._capacity-r)):0}_incrementHead(e=1){this._headIndex=(this._headIndex+e)%this._capacity}_incrementTail(e=1){this._tailIndex=(this._tailIndex+e)%this._capacity}_transferRange(e,i){ei&&(i>0&&this._buffer.transferRange(0,i),this._buffer.transferRange(e,this._capacity))}};const rV=64;var es;function pOt(t){let e=ls().mat4f64(J.LOCALTRANSFORM).mat4f64(J.GLOBALTRANSFORM).vec4f64(J.BOUNDINGSPHERE).vec3f64(J.MODELORIGIN).mat3f(J.INSTANCEMODEL).mat3f(J.INSTANCEMODELNORMAL).vec2f(J.MODELSCALEFACTORS);return t.includes(J.FEATUREATTRIBUTE)&&(e=e.vec4f(J.FEATUREATTRIBUTE)),t.includes(J.COLOR)&&(e=e.vec4u8(J.COLOR)),t.includes(J.OBJECTANDLAYERIDCOLOR)&&(e=e.vec4u8(J.OBJECTANDLAYERIDCOLOR)),e=e.u8(J.STATE).u8(J.LODLEVEL),e}(function(t){t[t.ALLOCATED=1]="ALLOCATED",t[t.DEFAULT_ACTIVE=2]="DEFAULT_ACTIVE",t[t.VISIBLE=4]="VISIBLE",t[t.HIGHLIGHT=8]="HIGHLIGHT",t[t.HIGHLIGHT_ACTIVE=16]="HIGHLIGHT_ACTIVE",t[t.REMOVE=32]="REMOVE",t[t.TRANSFORM_CHANGED=64]="TRANSFORM_CHANGED",t[t.ACTIVE=18]="ACTIVE"})(es||(es={}));let fve=class{constructor(e){this.localTransform=e.getField(J.LOCALTRANSFORM,zL),this.globalTransform=e.getField(J.GLOBALTRANSFORM,zL),this.modelOrigin=e.getField(J.MODELORIGIN,n0),this.model=e.getField(J.INSTANCEMODEL,Y2),this.modelNormal=e.getField(J.INSTANCEMODELNORMAL,Y2),this.modelScaleFactors=e.getField(J.MODELSCALEFACTORS,RE),this.boundingSphere=e.getField(J.BOUNDINGSPHERE,Gj),this.featureAttribute=e.getField(J.FEATUREATTRIBUTE,Um),this.color=e.getField(J.COLOR,Pc),this.objectAndLayerIdColor=e.getField(J.OBJECTANDLAYERIDCOLOR,Pc),this.state=e.getField(J.STATE,$P),this.lodLevel=e.getField(J.LODLEVEL,$P)}},KA=class extends ze{constructor(e,i){super(e),this.events=new Dn,this._capacity=0,this._size=0,this._next=0,this._layout=pOt(i),this._capacity=rV,this._buffer=this._layout.createBuffer(this._capacity),this._view=new fve(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const e=this._findSlot();return this._view.state.set(e,es.ALLOCATED),this._size++,this.events.emit("instances-changed"),e}removeInstance(e){const i=this._view.state;Xt(e>=0&&e=0&&ethis._instanceData.view.boundingSphere.getVec(r,this._tmpSphere),{maximumDepth:25}),this._instanceData=e,this._boundingSphere=i,this._tmpSphere=uo(),this._tmpMat4=Qe()}addInstance(e){const i=this._instanceData.view.boundingSphere,r=this._instanceData.getCombinedModelTransform(e,this._tmpMat4);bt(this._tmpSphere,this._boundingSphere.center,r),this._tmpSphere[3]=this._boundingSphere.radius*yP(r),i.setVec(e,this._tmpSphere),this.add([e])}removeInstance(e){this.remove([e])}},gOt=class{constructor(e,i){this._worldSpaceRadius=e,this._minScreenSpaceRadii=i}selectLevel(e,i,r){const n=r.computeScreenPixelSizeAt(e),s=this._worldSpaceRadius*i/n;let o=0;for(let a=1;a=this._minScreenSpaceRadii[a]&&(o=a);return o}},yOt=class extends Mj{constructor(e,i,r,n,s,o){super(e,i),this.layerUid=e,this.graphicUid=i,this.geometryId=r,this.triangleNr=n,this.baseBoundingSphere=s,this.numLodLevels=o}};function Cce(t){return Xm(t)&&t.intersector===ms.LOD&&!!t.target}let vOt=class{constructor(e,i){const r=e.renderContext.rctx,n=i.geometry;this._materialRepository=e.materialRepository,n.material.setParameters({instancedDoublePrecision:!0});const s=n.material.createBufferWriter(),o=s.vertexBufferLayout,a=s.elementCount(n),c=o.createBuffer(a);s.write(null,null,n,c,0),this.geometry=n,this.material=n.material,this.glMaterials=new LNe(n.material,this._materialRepository),this.vertexBufferLayout=o,this.vbo=Yr.createVertex(r,Rr.STATIC_DRAW,c.buffer),this.vao=new Jm(r,Cr,{geometry:_d(o)},{geometry:this.vbo}),this.vertexCount=a}destroy(){this.glMaterials.dispose(),this.vbo.dispose(),this.vao.dispose()}get boundingInfo(){return this.geometry.boundingInfo}get triangleCount(){return this.vertexCount/3}intersect(e,i,r,n,s,o,a,c){const p=this.geometry.id;this.material.intersect(this.geometry,e.transform.transform,e,r,n,(_,x,S,C,M)=>{if(_>=0){if(i!=null&&!i(e.rayBegin,e.rayEnd,_))return;const P=new yOt(o.layerUid,o.graphicUid(s),p,S,a,c);if((e.results.min.drapedLayerOrder==null||M>=e.results.min.drapedLayerOrder)&&(e.results.min.dist==null||_=e.results.max.drapedLayerOrder)&&(e.results.max.dist==null||_>e.results.max.dist)&&e.results.max.set(ms.LOD,P,_,x,e.transform.transform,M),e.options.store===rl.ALL){const $=mae(e.results.min.ray);$.set(ms.LOD,P,_,x,e.transform.transform,M),e.results.all.push($)}}})}},_Ot=class e7e{static async create(e,i,r){const n=await Promise.allSettled(i.components.map(o=>e.controller.schedule(()=>new vOt(e,o),r))),s=n.map(o=>o.status==="fulfilled"?o.value:null).filter(ys);if(So(r)||s.length!==n.length){s.forEach(o=>o.destroy()),St(r);for(const o of n)if(o.status==="rejected")throw o.reason}return new e7e(i.minScreenSpaceRadius,s)}constructor(e,i){this.minScreenSpaceRadius=e,this.components=i}destroy(){this.components.forEach(e=>e.destroy())}intersect(e,i,r,n,s,o,a){this.components.forEach(c=>c.intersect(e,i,r,n,s,o,this.boundingSphere,a))}get boundingBox(){if(this._boundingBox==null){const e=Bn();this.components.forEach(i=>{i.boundingInfo!=null&&(Xf(e,i.boundingInfo.bbMin),Xf(e,i.boundingInfo.bbMax))}),this._boundingBox=e}return this._boundingBox}get boundingSphere(){if(this._boundingSphere==null){const e=this.boundingBox,i=W();_m(e,i),this._boundingSphere={center:i,radius:.5*pMe(e)}}return this._boundingSphere}get triangleCount(){return this.components.reduce((e,i)=>e+i.triangleCount,0)}};const bOt=t=>{const e=t.baseBoundingSphere.radius,i=t.levels.map(r=>r.minScreenSpaceRadius);return new gOt(e,i)};let rf=class extends k1t{constructor(e,i){super(e),this.type=ms.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new si,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[ke.OPAQUE_MATERIAL,r=>this._produces(r)],[ke.TRANSPARENT_MATERIAL,r=>!!this._hasTransparentLevels()&&this._produces(r)]]),this._instanceData=new KA({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(i.registerTask(ni.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=xOt(this.optionalFields),this._glInstanceBufferLayout=_d(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce((e,i)=>i.reduce((r,n)=>r+n.usedMemory,e),0)}get renderStats(){const e=this._instanceData.size,i=[];return this._levels.forEach((r,n)=>{const s=this._allRenderInstanceData[0][n].size+this._allRenderInstanceData[1][n].size,o=r.triangleCount;i.push({renderedInstances:s,renderedTriangles:s*o,trianglesPerInstance:o})}),{totalInstances:e,renderedInstances:i.reduce((r,n)=>r+n.renderedInstances,0),renderedTriangles:i.reduce((r,n)=>r+n.renderedTriangles,0),levels:i}}async initializeRenderContext(e,i){this._context=e;const r=e.renderContext.rctx,n=await Promise.allSettled(this.symbol.levels.map(o=>(this._defaultRenderInstanceData[0].push(new pve(r,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new pve(r,this._instanceBufferLayout)),_Ot.create(e,o,i)))),s=n.map(o=>o.status==="fulfilled"?o.value:null).filter(ys);if(So(i)||s.length!==n.length){s.forEach(o=>o.destroy()),St(i);for(const o of n)if(o.status==="rejected")throw o.reason}this._levels=s,this._levelSelector=bOt(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData[0].forEach(e=>e.destroy()),this._highlightRenderInstanceData[0].forEach(e=>e.destroy())}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(i=>i.material.produces(ke.TRANSPARENT_MATERIAL,ue.Color)))}hasHighlights(){return this._highlightRenderInstanceData[0].some(e=>e.size>0)}_produces(e){return e!==ue.Highlight&&e!==ue.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!En.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const i=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),i||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(cu),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return null;const i=this._getInstanceDatas(e.output);if(!i)return null;const r=new Array;return i.forEach(n=>this.levels.forEach((s,o)=>{s.components.forEach(a=>r.push(this._beginComponent(e,n[o],a)))})),r}renderNode(e,i){const r=this._getInstanceDatas(e.output);if(!r||i==null)return;let n=0;e.rctx.bindVAO(),r.forEach(s=>this.levels.forEach((o,a)=>{o.components.forEach(c=>this._renderComponent(e,i[n++],s[a],c,a))}))}_getInstanceDatas(e){const i=e!==ue.Highlight&&e!==ue.ShadowHighlight,r=e!==ue.ShadowExcludeHighlight;return i&&r?this._allRenderInstanceData:i?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,i,r,n){if(!this.baseMaterial.isVisible()||this._octree==null)return;const s=W();je(s,n,r);const o=a=>{this._instanceData.getCombinedModelTransform(a,vve),e.transform.set(vve),bt(_ve,r,e.transform.inverse),bt(bve,n,e.transform.inverse);const c=this._instanceData.getState(a),p=this._instanceData.getLodLevel(a),_=this._levels.length;Xt((c&es.ACTIVE)!=0,"invalid instance state"),Xt(p>=0&&p<_,"invaid lod level"),this._levels[p].intersect(e,i,_ve,bve,a,this.metadata,_)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(o):this._octree.forEachAlongRay(r,s,o)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){var e;if(this._octreeCached==null){const i=this._instanceData,r=(e=i.view)==null?void 0:e.state;if(!r)return null;this._octreeCached=new mOt(i,this.baseBoundingSphere);for(let n=0;ne.forEach(i=>i.startUpdateCycle()))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:i,_camera:r,_levelSelector:n}=this;this._allRenderInstanceData.forEach(x=>x.forEach(S=>S.beginUpdate()));const s=this._instanceData,o=s.view;let a=s.size;const c=s.capacity;let p=this._instanceIndex;const _=Math.ceil(c/500);for(let x=0;x=0&&(S&es.HIGHLIGHT?(gve(this._highlightRenderInstanceData[0][P],o,p),C|=es.HIGHLIGHT_ACTIVE):(gve(this._defaultRenderInstanceData[0][P],o,p),C|=es.DEFAULT_ACTIVE)),o.state.set(p,C),o.lodLevel.set(p,P)}else C=S&~(es.ACTIVE|es.TRANSFORM_CHANGED),o.state.set(p,C);if(this._octreeCached!=null){const P=!!(S&es.ACTIVE),$=!!(C&es.ACTIVE);!P&&$?this._octreeCached.addInstance(p):P&&!$?this._octreeCached.removeInstance(p):P&&$&&S&es.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(p),this._octreeCached.addInstance(p))}p=p+1===c?0:p+1,p%_==0&&e.madeProgress()}this._instanceIndex=p,this._allRenderInstanceData.forEach(x=>x.forEach(S=>S.endUpdate())),this._context.requestRender()}_beginComponent(e,i,r){if(i.size===0)return null;const n=r.glMaterials.load(e.rctx,e.bindParameters.slot,e.output);return n!=null?n.beginSlot(e.bindParameters):null}_renderComponent(e,i,r,n,s){if(!i)return;const{bindParameters:o,rctx:a}=e;a.runAppleAmdDriverHelper();const c=a.bindTechnique(i,n.material.parameters,o);a.bindVAO(n.vao),i.ensureAttributeLocations(n.vao),c.bindDraw(SOt,o,n.material.parameters),En.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===ue.Color&&(c.setUniform4fv("externalColor",wve[Math.min(s,wve.length-1)]),c.setUniform1i("colorMixMode",W9e.replace));const p=r.capacity,_=r.headIndex,x=r.tailIndex,S=r.firstIndex,C=this._glInstanceBufferLayout,M=(P,$)=>{Aae(a,Cr,r.buffer,C,P),a.drawArraysInstanced(i.primitiveType,0,n.vertexCount,$-P),Mae(a,Cr,r.buffer,C)};n.material.parameters.transparent&&S!=null?_>x?(Xt(S>=x&&S<=_,"invalid firstIndex"),M(S,_),M(x,S)):_=0&&S<=_,"invalid firstIndex"),M(S,_),M(x,p),M(0,S)):(Xt(S>=x&&S<=p,"invalid firstIndex"),M(S,p),M(0,_),M(x,S))):_>x?M(x,_):_(n=(r=>(r=this.symbolLayer)==null?void 0:r.material)())==null?void 0:n.color)()){const s=this._getCombinedOpacity(i),o=s<1||this.needsDrivenTransparentPass;return e.transparent=o,e.opacity=s,e.cullFace=o?Ln.None:Ln.Back,e}async _createResourcesForPrimitive(e,i){const r=this.symbolLayer,n=va(att(e)),s=vc(Z6(n)),o=vc(IH(s,r)),a=nt(o),c=!1,p=!1,_={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:[...Ule],ambient:Yv,diffuse:Yv,hasSlicePlane:this._context.slicePlaneEnabled,hasSliceHighlight:!1,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},x=!!_.usePBR;this._setMaterialTransparencyParameters(_);const S=this.symbol;if(S.type==="point-3d"&&S.verticalOffset){const{screenLength:z,minWorldLength:k,maxWorldLength:U}=S.verticalOffset;_.verticalOffset={screenLength:Er(z),minWorldLength:k||0,maxWorldLength:U??1/0},_.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(_.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)_.externalColor=Af;else{const z=r.material!=null?r.material.color:null,k=z!=null?qe.toUnitRGBA(z):Af;_.externalColor=k}this._fastUpdates=DP(this._context.renderer,this._fastVisualVariableConvertOptions(n,o,s,null)),_.isInstanced=!0,this._fastUpdates?(Object.assign(_,this._fastUpdates.materialParameters),this._optionalFields.push(J.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(_.hasInstancedColor=!0,this._optionalFields.push(J.COLOR)),$e("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(J.OBJECTANDLAYERIDCOLOR);const C=new Vm(_),M=F6e(e,C);if(!M)throw new Error(`Unknown object symbol primitive: ${e}`);const P=IN(M).map(z=>({opacity:1,transparent:z.parameters.transparent})),$=await this._createStageResources(M,x,i),F=await this._createLodRenderer(M,i);return new xve(M,F,$,P,s,c,p,n,o,a,x,null)}async _createResourcesForUrl(e,i){var ie,he;const r={materialParameters:{isInstanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=DP(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(r.materialParameters,this._fastUpdates.materialParameters),this._optionalFields.push(J.FEATUREATTRIBUTE)):this._hasPerInstanceColor()&&(r.materialParameters.hasInstancedColor=!0,this._optionalFields.push(J.COLOR)),$e("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push(J.OBJECTANDLAYERIDCOLOR);const n=this.symbol;if(n.type==="point-3d"&&n.verticalOffset){const{screenLength:ce,minWorldLength:ve,maxWorldLength:ge}=n.verticalOffset;r.materialParameters.verticalOffset={screenLength:Er(ce),minWorldLength:ve||0,maxWorldLength:ge??1/0},r.materialParameters.castShadows=!1}const s=this._context.physicalBasedRenderingEnabled;r.signal=i,r.usePBR=s,r.skipHighLods=this._context.skipHighSymbolLods;const o=await Z8e(e,r),a=o.isEsriSymbolResource,c=o.isWosr,p=oMt(o.lods),_=this._context,x=this.symbolLayer.material,S=this._getExternalColorParameters(x),C=(he=(ie=this.symbolLayer)==null?void 0:ie.material)==null?void 0:he.color,M=this._getCombinedOpacity(C,{hasIntrinsicColor:!0}),P=this.needsDrivenTransparentPass,$=IN(p),F=IN(p).map(ce=>({opacity:ce.parameters.opacity||1,transparent:ce.parameters.transparent}));$.forEach(ce=>{const ve=ce.parameters;ce.setParameters(S);const ge=ve.opacity*M,pe=ge<1||P||ve.transparent;ce.setParameters({opacity:ge,transparent:pe}),_.screenSizePerspectiveEnabled&&ce.setParameters({screenSizePerspective:_.sharedResources.screenSizePerspectiveSettings})});const z=o.referenceBoundingBox,k=vc(Z6(z)),U=vc(p.levels[0].pivotOffset),j=vc(IH(k,this.symbolLayer)),G=nt(j),Y=this._fastUpdates;NP(Y,this._context.renderer,this._fastVisualVariableConvertOptions(z,j,k,U))&&$.forEach(ce=>ce.setParameters(Y.materialParameters));const Q=await this._createStageResources(p,s,i),ne=await this._createLodRenderer(p,i);return new xve(p,ne,Q,F,k,a,c,z,j,G,s,U)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,i,r){const n=this._context.stage,s=IN(e);i!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),n.addMany(s),this._addDisposeResource(()=>n.removeMany(s));const o=Pye(e);n.addMany(o),this._addDisposeResource(()=>{o.forEach(c=>c.unload()),n.removeMany(o)}),await Promise.all(o.map(c=>this._context.stage.schedule(()=>c.load(n.renderView.renderingContext),r))),St(r);const a=Rye(e);return n.addMany(a),this._addDisposeResource(()=>n.removeMany(a)),{materials:s,textures:o,geometries:a}}async _createLodRenderer(e,i){const r=this._context.stage,n={layerUid:this._context.layer.uid,graphicUid:c=>this._instanceIndexToGraphicUid.get(c),notifyGraphicGeometryChanged:c=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(c)),notifyGraphicVisibilityChanged:c=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(c))},s=this._fastUpdates,o=s?{applyTransform:(c,p,_)=>{c.getFeatureAttribute(p,t8),Mo(_,zwt(s.materialParameters,t8,_))},scaleFactor:(c,p,_)=>{p.getFeatureAttribute(_,t8),Ele(c,s.materialParameters,t8)}}:null,a=new rf({symbol:e,optionalFields:this._optionalFields,metadata:n,shaderTransformation:o},this._context.scheduler);return a.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource(()=>{r.removeRenderPlugin(a),a.destroy()}),await r.addRenderPlugin(a,i),a}_getExternalColorParameters(e){const i={};return this._drivenProperties.color?i.externalColor=Af:(e==null?void 0:e.color)!=null?i.externalColor=qe.toUnitRGBA(e.color):(i.externalColor=Af,i.colorMixMode="ignore"),i}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach(e=>e()),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry))return null;const r=XL(i.geometry);if(r==null)return this.logger.warn(`unsupported geometry type for icon symbol: ${i.geometry.type}`),null;const n=this.setGraphicElevationContext(i),s=e.renderingInfo;return this._createAs3DShape(i,r,s,n,i.uid,e.layer.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){var s,o;if(this._resources==null)return;const e=this._drivenProperties.opacity,i=!this._isPrimitive,r=this._resources.stageResources.materials,n=this._resources.originalMaterialParameters;for(let a=0;aArray.from(a.attributes.values()).reduce((c,p)=>c+m_(p.data,p.indices),0),n=Rye(e).reduce((a,c)=>a+r(c),0),s=Pye(e).reduce((a,c)=>a+c.memoryEstimate,0)+n,o={...mDe(this.symbol,this.symbolLayer),resourceBytes:s};return new _f({verticesPerFeature:i,memory:o})}_hasLodRenderer(){return this._resources!=null}_createAs3DShape(e,i,r,n,s,o){if(!this._hasLodRenderer()||this._resources==null)return null;const a=this.getFastUpdateAttrValues(e),c=this._context.clippingExtent;if(fd(i,IC,this._context.elevationProvider.spatialReference),c!=null&&!Use(c,IC))return null;const p=this._requiresTerrainElevation(n),_=this._computeGlobalTransform(i,n,cY,i8),x=this._computeLocalTransform(this._resources,this.symbolLayer,r,Sve),S=this._resources.lodRenderer.instanceData,C=S.addInstance();this._instanceIndexToGraphicUid.set(C,s),S.setLocalTransform(C,x,!1),S.setGlobalTransform(C,_),a&&S.setFeatureAttribute(C,a),this._fastUpdates==null&&this._hasPerInstanceColor()&&S.setColor(C,R$(r.color,r.opacity,255)),this._context.stage.renderView.objectAndLayerIdRenderHelper!=null&&S.setObjectAndLayerIdColor(C,this._context.stage.renderView.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor({graphicUid:s,layerUid:o}));const M=new rMt(this,C,txt,n);return p&&(M.alignedSampledElevation=i8.sampledElevation),M.needsElevationUpdates=ex(n.mode),YL(M,i,this._context.elevationProvider),M}_computeGlobalTransform(e,i,r,n){return Q2(e,this._context.elevationProvider,i,this._context.renderCoordsHelper,n),IC[0]=e.x,IC[1]=e.y,IC[2]=n.z,Ac(e.spatialReference,IC,r,this._context.renderCoordsHelper.spatialReference),r}_computeLocalTransform(e,i,r,n){return Yf(n),this._applyObjectRotation(r,!1,n),this._applyObjectRotation(i,!0,n),this._applyObjectScale(e,r,n),this._applyAnchor(e,i,n),n}_applyObjectScale(e,i,r){var o;if((o=this._fastUpdates)!=null&&o.requiresShaderTransformation)return;const n=this._drivenProperties.size&&i.size?i.size:e.symbolSize,s=Mye(n,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);s[0]===1&&s[1]===1&&s[2]===1||L9(r,r,s)}prepareSymbolLayerPatch(e){if(e.diff.type!=="partial")return;const i=e.diff.diff;this._preparePatchTransform(e,i),this._preparePatchColor(e,i)}updateGeometry(e,i){if(this._resources==null)return!0;const r=i&&XL(i);if(r==null)return!1;const n=this.getGeometryElevationMode(i);return e.elevationContext.mode===n&&(this._computeGlobalTransform(r,e.elevationContext,cY,i8),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=i8.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,cY,!0),YL(e,r,this._context.elevationProvider),!0)}_preparePatchTransform(e,i){if(!(i.heading||i.tilt||i.roll||i.width||i.height||i.depth||i.anchor||i.anchorPosition)||this._resources==null)return;const r=(M,P,$)=>(M!=null&&M.type==="complete"?M.newValue:P)??$,n=r(i.heading,this.symbolLayer.heading,0),s=r(i.tilt,this.symbolLayer.tilt,0),o=r(i.roll,this.symbolLayer.roll,0),a=r(i.width,this.symbolLayer.width,void 0),c=r(i.height,this.symbolLayer.height,void 0),p=r(i.depth,this.symbolLayer.depth,void 0),_=r(i.anchor,this.symbolLayer.anchor,void 0),x=r(i.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete i.heading,delete i.tilt,delete i.roll,delete i.width,delete i.height,delete i.depth,delete i.anchor,delete i.anchorPosition;const S={heading:n,tilt:s,roll:o,anchor:_,anchorPosition:x},C=this._resources;this.loadStatus===np.LOADED&&e.symbolLayerStatePatches.push(()=>{C.symbolSize=vc(IH(C.resourceSize,{width:a,height:c,depth:p,isPrimitive:this.symbolLayer.isPrimitive}))}),e.graphics3DGraphicPatches.push((M,P)=>{const $=this._computeLocalTransform(C,S,P,Sve),F=M.instanceIndex;C.lodRenderer.instanceData.setLocalTransform(F,$,!0)})}_preparePatchColor(e,i){if(!i.material||i.material.type!=="partial")return;const r=i.material.diff;if(!r.color||r.color.type!=="complete"||r.color.newValue==null||r.color.oldValue==null)return;const n=r.color.newValue,s=n!=null?qe.toUnitRGBA(n):Af;delete r.color;const o=this._resources;o!=null&&e.graphics3DGraphicPatches.push(a=>{let c;this._hasPerInstanceColor()?(o.lodRenderer.instanceData.setColor(a.instanceIndex,s),c=this._setMaterialTransparencyParameters({},n)):c=this._setMaterialTransparencyParameters({externalColor:s},n);for(const p of o.stageResources.materials)p.setParameters(c)})}_requiresTerrainElevation(e){return e.mode!=="absolute-height"}_applyObjectRotation(e,i,r){var n;if(!((n=this._fastUpdates)!=null&&n.requiresShaderTransformation)||!i)return G2t(e.heading,e.tilt,e.roll,r)}_computeAnchor(e,i,r){const n=W();switch(r.anchor){case"center":Ne(n,_m(e)),Cc(n,n);break;case"top":{const s=_m(e);Ie(n,-s[0],-s[1],-e[5]);break}case"bottom":{const s=_m(e);Ie(n,-s[0],-s[1],-e[2]);break}case"relative":{const s=_m(e),o=Z6(e),a=r.anchorPosition,c=a?st(a.x,a.y,a.z):el;mB(n,o,c),Be(n,n,s),Cc(n,n);break}default:i!=null?Cc(n,i):Ne(n,el)}return n}_applyAnchor(e,i,r){var s;if((s=this._fastUpdates)!=null&&s.requiresShaderTransformation)return;const n=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,i);n&&eh(r,r,n)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,i,r,n){const s=e!=null?vc(Z6(e)):Yv,o=e!=null?this._computeAnchor(e,n,this.symbolLayer):el,a=this._context.renderCoordsHelper.unitInMeters,c=Mye(i??void 0,i,r,a),p=st(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new r6({size:!0,color:!0,rotation:!0,opacity:!1},s,i??Yv,a,o,c,p)}};const IC=W(),Sve=Qe(),cY=Qe(),t8=Xi(),i8=new l6;let EOt=class{constructor(e,i,r,n){this.vertices=e,this.positionsES=i,this.offset=n;const s=e.length,o=Math.floor(s/2),a=this.offset+3*o,c=r[a],p=r[a+1],_=r[a+2];this.origin=st(c,p,_),this.positions=$s(3*s);const x=this.offset+3*s;for(let S=this.offset;Sthis.emitCapVertex(n,a,c,p,_,x),o=(a,c,p,_)=>this.emitVertex(n,a,c,p,_);for(this.startCap.rebuildConnectingProfileGeometry(r[n],this.profile,s),n=1;n{s.push(p),s.push(_),s.push(x),o.push(p),o.push(_),o.push(x),a.push(this.pathVertexData[p]),a.push(this.pathVertexData[_]),a.push(this.pathVertexData[x])};for(let p=0;p=this.cutoffAngle){const c=e.rotationFrameUp;for(let p=0;p=0?r(n,i.vertices[_],i.normals[_],!1):r(a,e.applyMiterStretch(Cve,i.vertices[_]),i.normals[_],!0)}}else for(let c=0;c=0;r(a,e.applyMiterStretch(Cve,i.vertices[p]),i.normals[p],!_)}}},i7e=class{constructor(){this.up=W(),this.right=W()}};function OOt(t,e,i){bt(t.up,e.up,i),bt(t.right,e.right,i)}const Cve=yt(),Ave=Qe(),POt=new i7e;let ROt=class extends jo{constructor(e,i,r,n,s,o){super(e,i,null,Ws.Mesh,o),this.path=r,this.geometrySR=n,this.stencilWidth=s}};var Fy;function r7e(t){return"path"in t}(function(t){t[t.World=0]="World",t[t.Path=1]="Path"})(Fy||(Fy={}));let n7e=class{constructor(e){this.builder=e}onPathChanged(e){this.builder.onPathChanged()}},s7e=class extends n7e{constructor(e){super(e),this.vertexAttributeColor=Mi(255,255,255,255),this.size=new Array,this.vertexAttributePosition=$s(3*this.builder.numVerticesTotal),this.vertexAttributeNormal=new Int16Array(2*this.builder.numVerticesTotal)}bakeVertexColors(e){this.vertexAttributeColor[0]=255*e[0],this.vertexAttributeColor[1]=255*e[1],this.vertexAttributeColor[2]=255*e[2],this.vertexAttributeColor[3]=255*(e.length>3?e[3]:1)}bake(e){this.size=e;const{numVerticesTotal:i,pathVertexData:r,path:n,positions:s,profileRightAxes:o,profileUpAxes:a,profileVertexAndNormals:c}=this.builder;for(let p=0;pQ){or(Y,-G[1],G[0]);const ie=fs(z,Y);qu(G,G,Q*Math.sign(ne)),qu(Y,Y,ie),yf(z,G,Y)}Ie(S,0,0,0)}const k=Ie(DOt,$[0]*z[0]+F[0]*z[1],$[1]*z[0]+F[1]*z[1],$[2]*z[0]+F[2]*z[1]),U=3*p;this.vertexAttributePosition[U]=s[_]+k[0]+S[0]*C,this.vertexAttributePosition[U+1]=s[_+1]+k[1]+S[1]*C,this.vertexAttributePosition[U+2]=s[_+2]+k[2]+S[2]*C;const j=or(Mve,c[P+2],c[P+3]);sE(this.vertexAttributeNormal,p,$[0]*j[0]+F[0]*j[1]+S[0]*M,$[1]*j[0]+F[1]*j[1]+S[1]*M,$[2]*j[0]+F[2]*j[1]+S[2]*M)}}createGeometryData(){const e=this.builder.vertexIndices.length,{normalIndices:i,vertexIndices:r}=this.builder;return[[J.POSITION,new $t(this.vertexAttributePosition,r,3,!0)],[J.NORMALCOMPRESSED,new $t(this.vertexAttributeNormal,i,2,!0)],[J.COLOR,new $t(this.vertexAttributeColor,mx(e),4)]]}onPathChanged(e){super.onPathChanged(e),this.bake(this.size)}intersect(e,i,r){const n=this.builder.vertexIndices,s=new A5(this.vertexAttributePosition,3),o=n.length/3;n6(e,i,0,o,n,s,void 0,void 0,r)}},IOt=class extends n7e{constructor(e,i,r,n){super(e),this.sizeAttributeValue=i,this.colorAttributeValue=r,this.opacityAttributeValue=n,this.vvData=null,this.baked=new s7e(e),this.vvData=$s(4*this.builder.path.vertices.length);for(let s=0;s0?($=1/Math.sqrt($),p[0]=p[0]*$,p[1]=p[1]*$,p[2]=p[2]*$):(p[0]=S.vRight[0],p[1]=S.vRight[1],p[2]=S.vRight[2]),_[0]=C[M]+i.frame.up[0],_[1]=C[M+1]+i.frame.up[1],_[2]=C[M+2]+i.frame.up[2],M+=3;const F=Ie(UOt,C[M],C[M+1],C[M+2]);G_(F,p,x),CE(x,Ap(_,S.vLeft),c)?(c[0]-=C[M],c[1]-=C[M+1],c[2]-=C[M+2],Ye(o,c),Wt(a,p,o),Ye(a,a)):AU(p,i.frame.up,i.frame.right,s,a,o,n),Ne(S.frame.up,o),Ne(S.frame.right,a),i=S}}const UOt=W();let o7e=class{constructor(){this.vertices=new Array,this.normals=new Array,this.indices=new Array,this.poles=new Array,this.poleIndices=new Array}addVertex(e,i){return this.vertices.push($M(e)),this.normals.push($M(i)),this.vertices.length-1}addPole(e,i=null){return this.poles.push({position:$M(e),normal:i?$M(i):null}),this.poles.length-1}addSegment(e,i=null){this.indices.push(e.v0),this.indices.push(e.v1),i&&(this.poleIndices.push(i.v0),this.poleIndices.push(i.v1))}get numSegments(){return this.indices.length/2}translate(e,i){for(const r of this.vertices)r[0]+=e,r[1]+=i;for(const r of this.poles)r.position[0]+=e,r.position[1]+=i}get usedMemory(){return this.vertices.length*m_(this.vertices[0])*2+m_(this.indices)}};const a7e={top:[0,-.5],bottom:[0,.5]};function hY(t){const i=$6e,r=new o7e,n={v0:0,v1:0};r.addPole(Ji(0,0));for(let o=0;on.size)),e.vvSize?(r.uniforms.add(new Oi("vvSizeMinSize",n=>n.vvSize.minSize),new Oi("vvSizeMaxSize",n=>n.vvSize.maxSize),new Oi("vvSizeOffset",n=>n.vvSize.offset),new Oi("vvSizeFactor",n=>n.vvSize.factor)),r.code.add(V` + `),r.uniforms.add(new cn("size",n=>n.size)),e.vvSize?(r.uniforms.add(new Oi("vvSizeMinSize",n=>n.vvSize.minSize),new Oi("vvSizeMaxSize",n=>n.vvSize.maxSize),new Oi("vvSizeOffset",n=>n.vvSize.offset),new Oi("vvSizeFactor",n=>n.vvSize.factor)),r.code.add(V` vec2 getSize() { return size * clamp(vvSizeOffset + ${i}.x * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize).xz; } `)):r.code.add(V`vec2 getSize(){ return size; -}`),e.vvOpacity?(r.constants.add("vvOpacityNumber","int",rY),r.uniforms.add(new Hu("vvOpacityValues",n=>n.vvOpacity.values,rY),new Hu("vvOpacityOpacities",n=>n.vvOpacity.opacityValues,rY)),r.code.add(V` +}`),e.vvOpacity?(r.constants.add("vvOpacityNumber","int",pY),r.uniforms.add(new Wu("vvOpacityValues",n=>n.vvOpacity.values,pY),new Wu("vvOpacityOpacities",n=>n.vvOpacity.opacityValues,pY)),r.code.add(V` vec4 applyOpacity(vec4 color) { float value = ${i}.z; if (value <= vvOpacityValues[0]) { @@ -3486,7 +3475,7 @@ return size; } `)):r.code.add(V`vec4 applyOpacity(vec4 color){ return color; -}`),e.vvColor?(r.constants.add("vvColorNumber","int",SO),r.uniforms.add(new Hu("vvColorValues",n=>n.vvColor.values,SO),new h6e("vvColorColors",n=>n.vvColor.colors,SO)),r.code.add(V` +}`),e.vvColor?(r.constants.add("vvColorNumber","int",PO),r.uniforms.add(new Wu("vvColorValues",n=>n.vvColor.values,PO),new a6e("vvColorColors",n=>n.vvColor.colors,PO)),r.code.add(V` vec4 getColor() { float value = ${i}.y; if (value <= vvColorValues[0]) { @@ -3504,7 +3493,7 @@ return color; } `)):r.code.add(V`vec4 getColor(){ return applyOpacity(vec4(1, 1, 1, 1)); -}`),t.include(W9),t.attributes.add(J.PROFILERIGHT,"vec4"),t.attributes.add(J.PROFILEUP,"vec4"),t.attributes.add(J.PROFILEVERTEXANDNORMAL,"vec4"),r.code.add(V`vec3 calculateVPos() { +}`),t.include(K9),t.attributes.add(J.PROFILERIGHT,"vec4"),t.attributes.add(J.PROFILEUP,"vec4"),t.attributes.add(J.PROFILEVERTEXANDNORMAL,"vec4"),r.code.add(V`vec3 calculateVPos() { vec2 size = getSize(); vec3 origin = position; vec3 right = profileRight.xyz; @@ -3538,7 +3527,7 @@ if(isCapVertex()) { normal += forward * profileUp.w; } return normal; -}`)}let _Pt=class extends t6{constructor(){super(...arguments),this.size=Ji(1,1)}};function g7e(t){const e=new Cr,{vertex:i,fragment:r}=e;switch(Kh(i,t),e.varyings.add("vpos","vec3"),e.include(vPt,t),t.output!==ue.Color&&t.output!==ue.Alpha||(e.include(Yu,t),e.include(KT,t),e.include(wP,t),e.varyings.add("vnormal","vec3"),e.varyings.add("vcolor","vec4"),t.multipassEnabled&&e.varyings.add("depth","float"),i.code.add(V` +}`)}let vPt=class extends o6{constructor(){super(...arguments),this.size=Ji(1,1)}};function p7e(t){const e=new Ar,{vertex:i,fragment:r}=e;switch(td(i,t),e.varyings.add("vpos","vec3"),e.include(yPt,t),t.output!==ue.Color&&t.output!==ue.Alpha||(e.include(Zu,t),e.include(rE,t),e.include(R5,t),e.varyings.add("vnormal","vec3"),e.varyings.add("vcolor","vec4"),t.multipassEnabled&&e.varyings.add("depth","float"),i.code.add(V` void main() { vpos = calculateVPos(); vnormal = normalize(localNormal()); @@ -3550,14 +3539,14 @@ return normal; vcolor = getColor(); } - `)),e.include(dd,t),t.output){case ue.Alpha:e.include(oo,t),r.uniforms.add(new ft("opacity",n=>n.opacity)),r.code.add(V` + `)),e.include(gd,t),t.output){case ue.Alpha:e.include(ao,t),r.uniforms.add(new ft("opacity",n=>n.opacity)),r.code.add(V` void main() { discardBySlice(vpos); ${t.multipassEnabled?"terrainDepthTest(depth);":""} float combinedOpacity = vcolor.a * opacity; fragColor = vec4(combinedOpacity); } - `);break;case ue.Color:e.include(oo,t),e.include(JT,t),e.include(o6,t),e.include(KT,t),e.include(j6e,t),Nm(r,t),a6(r),CP(r),r.uniforms.add(i.uniforms.get("localOrigin"),new Oi("ambient",n=>n.ambient),new Oi("diffuse",n=>n.diffuse),new Oi("specular",n=>n.specular),new ft("opacity",n=>n.opacity)),r.include(h1),a1(r),r.code.add(V` + `);break;case ue.Color:e.include(ao,t),e.include(iE,t),e.include(h6,t),e.include(rE,t),e.include(z6e,t),zm(r,t),d6(r),N5(r),r.uniforms.add(i.uniforms.get("localOrigin"),new Oi("ambient",n=>n.ambient),new Oi("diffuse",n=>n.diffuse),new Oi("specular",n=>n.specular),new ft("opacity",n=>n.opacity)),r.include(_1),m1(r),r.code.add(V` void main() { discardBySlice(vpos); ${t.multipassEnabled?"terrainDepthTest(depth);":""} @@ -3579,28 +3568,28 @@ return normal; fragColor = highlightSlice(fragColor, vpos); ${t.transparencyPassType===Jt.Color?"fragColor = premultiplyAlpha(fragColor);":""} } - `);break;case ue.Depth:case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:e.include(Yu,t),XT(e),e.varyings.add("depth","float"),i.code.add(V`void main() { + `);break;case ue.Depth:case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:e.include(Zu,t),eE(e),e.varyings.add("depth","float"),i.code.add(V`void main() { vpos = calculateVPos(); gl_Position = transformPositionWithDepth(proj, view, vpos, nearFar, depth); -}`),e.include(oo,t),e.include(E_,t),r.code.add(V`void main() { +}`),e.include(ao,t),e.include(I_,t),r.code.add(V`void main() { discardBySlice(vpos); outputDepth(depth); -}`);break;case ue.Normal:e.include(Yu,t),e.include(GL,t),S5(i),e.varyings.add("vnormal","vec3"),i.code.add(V`void main(void) { +}`);break;case ue.Normal:e.include(Zu,t),e.include(QL,t),IP(i),e.varyings.add("vnormal","vec3"),i.code.add(V`void main(void) { vpos = calculateVPos(); vnormal = normalize((viewNormal * vec4(localNormal(), 1.0)).xyz); gl_Position = transformPosition(proj, view, vpos); -}`),e.include(oo,t),r.code.add(V`void main() { +}`),e.include(ao,t),r.code.add(V`void main() { discardBySlice(vpos); vec3 normal = normalize(vnormal); if (gl_FrontFacing == false) normal = -normal; fragColor = vec4(vec3(0.5) + 0.5 * normal, 1.0); -}`);break;case ue.Highlight:e.include(Yu,t),e.include(GL,t),e.varyings.add("vnormal","vec3"),i.code.add(V`void main(void) { +}`);break;case ue.Highlight:e.include(Zu,t),e.include(QL,t),e.varyings.add("vnormal","vec3"),i.code.add(V`void main(void) { vpos = calculateVPos(); gl_Position = transformPosition(proj, view, vpos); -}`),e.include(oo,t),e.include(dx,t),r.code.add(V`void main() { +}`),e.include(ao,t),e.include(vx,t),r.code.add(V`void main() { discardBySlice(vpos); outputHighlight(); -}`)}return e}const bPt=Object.freeze(Object.defineProperty({__proto__:null,build:g7e},Symbol.toStringTag,{value:"Module"})),y7e=new Map([[J.POSITION,0],[J.PROFILERIGHT,1],[J.PROFILEUP,2],[J.PROFILEVERTEXANDNORMAL,3],[J.FEATUREVALUE,4]]);let wPt=class extends _Pt{constructor(){super(...arguments),this.ambient=nt(.2,.2,.2),this.diffuse=nt(.8,.8,.8),this.specular=nt(0,0,0),this.opacity=1,this.origin=W(),this.modelTransformation=null}},v7e=class _7e extends Hr{initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global,i.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result}initializeProgram(e){return new Ir(e.rctx,_7e.shader.get().build(this.configuration),y7e)}initializePipeline(){const e=this.configuration.transparencyPassType,i=this.configuration,r=e===Jt.NONE,n=e===Jt.FrontFace;return Ti({blending:i.output!==ue.Color&&i.output!==ue.Alpha||!i.transparent?null:r?vp:Y_(e),culling:i.hasSlicePlane&&!i.transparent&&i.doubleSidedMode!==Is.None?YIe:null,depthTest:{func:px(e)},depthWrite:r||n?rh:null,colorWrite:ji,stencilWrite:i.hasOccludees?Jy:null,stencilTest:i.hasOccludees?fx:null,polygonOffset:r||n?null:eG})}};v7e.shader=new Rr(bPt,()=>we(()=>Promise.resolve().then(()=>$Wt),void 0));let na=class extends hu{constructor(){super(...arguments),this.output=ue.Color,this.doubleSidedMode=Is.None,this.transparencyPassType=Jt.NONE,this.spherical=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.vvSize=!1,this.vvColor=!1,this.vvOpacity=!1,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.doublePrecisionRequiresObfuscation=!1}};y([fe({count:ue.COUNT})],na.prototype,"output",void 0),y([fe({count:Is.COUNT})],na.prototype,"doubleSidedMode",void 0),y([fe({count:Jt.COUNT})],na.prototype,"transparencyPassType",void 0),y([fe()],na.prototype,"spherical",void 0),y([fe()],na.prototype,"receiveShadows",void 0),y([fe()],na.prototype,"receiveAmbientOcclusion",void 0),y([fe()],na.prototype,"vvSize",void 0),y([fe()],na.prototype,"vvColor",void 0),y([fe()],na.prototype,"vvOpacity",void 0),y([fe()],na.prototype,"hasSlicePlane",void 0),y([fe()],na.prototype,"transparent",void 0),y([fe()],na.prototype,"hasOccludees",void 0),y([fe()],na.prototype,"multipassEnabled",void 0),y([fe()],na.prototype,"cullAboveGround",void 0),y([fe()],na.prototype,"doublePrecisionRequiresObfuscation",void 0),y([fe({constValue:!1})],na.prototype,"occlusionPass",void 0),y([fe({constValue:ei.Disabled})],na.prototype,"pbrMode",void 0),y([fe({constValue:!0})],na.prototype,"hasVvInstancing",void 0),y([fe({constValue:!1})],na.prototype,"useCustomDTRExponentForWater",void 0),y([fe({constValue:!1})],na.prototype,"useFillLights",void 0),y([fe({constValue:!1})],na.prototype,"hasColorTexture",void 0);let xPt=class b7e extends hx{constructor(e){super(e,new TPt),this.supportsEdges=!0,this._vertexAttributeLocations=y7e,this._configuration=new na,this._vertexBufferLayout=b7e.getVertexBufferLayout()}getConfiguration(e,i){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e!==ue.Color&&e!==ue.Alpha||(this._configuration.doubleSidedMode=this.parameters.doubleSided&&this.parameters.doubleSidedType==="normal"?Is.View:this.parameters.doubleSided&&this.parameters.doubleSidedType==="winding-order"?Is.WindingOrder:Is.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=i.ssao!=null),this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration.cullAboveGround=i.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==ue.Shadow&&e!==ue.ShadowExcludeHighlight&&e!==ue.ShadowHighlight||this.parameters.castShadows}isVisible(){return super.isVisible()&&this.parameters.opacity>0}intersect(e,i,r,n,s,o){const l=e;if(!o7e(l))return;const c=l.path,f=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSize){const{offset:L,factor:F,minSize:z,maxSize:k}=this.parameters.vvSize,U=c.sizeAttributeValue;f[0]*=Je(L[0]+U*F[0],z[0],k[0]),f[1]*=Je(L[2]+U*F[2],z[2],k[2])}const _=Math.max(f[0],f[1]),x=e.boundingInfo;if(x==null)return void this._intersectTriangles(c,f,n,s,o);const T=P2(x.bbMin[0]-_,x.bbMin[1]-_,x.bbMin[2]-_,x.bbMax[0]+_,x.bbMax[1]+_,x.bbMax[2]+_),A=[s[0]-n[0],s[1]-n[1],s[2]-n[2]],M=Math.sqrt(A[0]*A[0]+A[1]*A[1]+A[2]*A[2]),I=[M/A[0],M/A[1],M/A[2]];mle(T,n,I,r.tolerance)&&this._intersectTriangles(c,f,n,s,o)}_intersectTriangles(e,i,r,n,s){e.baked.size&&e.baked.size[0]===i[0]&&e.baked.size[1]===i[1]||e.baked.bake(i),e.baked.intersect(r,n,s)}createBufferWriter(){return new EP(this._vertexBufferLayout)}produces(e,i){switch(i){case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:if(!this.parameters.castShadows)return!1;case ue.Color:case ue.Alpha:case ue.Depth:case ue.Normal:case ue.Highlight:case ue.ObjectAndLayerIdColor:return e===(this.parameters.transparent?ke.TRANSPARENT_MATERIAL:ke.OPAQUE_MATERIAL)||e===ke.DRAPED_MATERIAL;default:return!1}}createGLMaterial(e){return new SPt(e)}static getVertexBufferLayout(){return ls().vec3f(J.POSITION).vec4f(J.PROFILERIGHT).vec4f(J.PROFILEUP).vec4f(J.PROFILEVERTEXANDNORMAL).vec4f(J.FEATUREVALUE)}},SPt=class extends cx{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){this.technique!=null&&e.shadowMap.enabled===this.technique.configuration.receiveShadows||this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output!==ue.Color&&this._output!==ue.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(v7e,e)}},TPt=class extends wPt{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}};const EPt=["polyline"];let CPt=class extends p1{constructor(e,i,r,n){super(e,i,r,n),this._intrinsicSize=Ji(1,1),this._upVectorAlignment=Ry.Path,this._stencilWidth=.1,this.usedMemory=0,this.ensureDrapedStatus(!1)}async doLoad(){var T,A,M,I,L;const e=this.symbolLayer.width!=null?this.symbolLayer.width:this.symbolLayer.height,i=this.symbolLayer.height!=null?this.symbolLayer.height:e;this._vvConvertOptions=new K9({size:!0,color:!0,rotation:!1,opacity:!0},[1,1,1],[e,1,i],this._context.renderCoordsHelper.unitInMeters),this._fastUpdates=((A=(T=this._context.renderer)==null?void 0:T.visualVariables)==null?void 0:A.length)>0?C5(this._context.renderer,this._vvConvertOptions):null;const r=this.symbolLayer.anchor||"center";this._upVectorAlignment=this.symbolLayer.profileRotation==="heading"?Ry.World:Ry.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=B5t[r];break;case"quad":this._profile=j5t[r]}switch(this.symbolLayer.join){case"round":this._extruder=new eY(0,N6e);break;case"bevel":this._extruder=new eY(0,1);break;case"miter":this._extruder=new eY(.8*Math.PI,1);break;default:this._extruder=new O5t}const s=this.symbolLayer.cap||"butt";switch(s){case"none":this._startCap=new Sve,this._endCap=new Sve;break;case"butt":default:this._startCap=new ZN(this._profile,0),this._endCap=new ZN(this._profile,0,!0);break;case"square":this._startCap=new ZN(this._profile,-.5),this._endCap=new ZN(this._profile,.5,!0);break;case"round":{const F=n==="quad";this._startCap=new Tve({profile:this._profile,flip:!1,breakNormals:F,subdivisions:nie}),this._endCap=new Tve({profile:this._profile,flip:!0,breakNormals:F,subdivisions:nie});break}}const o=(I=(M=this.symbolLayer)==null?void 0:M.material)==null?void 0:I.color,l=this._getCombinedOpacityAndColor(o),c=mc(l),f=l[3],_=f<1||this.needsDrivenTransparentPass,x={diffuse:c,ambient:c,opacity:f,transparent:_,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,cullFace:_||s==="none"?Ln.None:Ln.Back,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(or(this._intrinsicSize,e,i),!rie(this._intrinsicSize[0])||!rie(this._intrinsicSize[1])))throw new se("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");if((L=this._fastUpdates)!=null&&L.visualVariables.size||Gu(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates){const F={...x,...this._fastUpdates.materialParameters,size:GPe(this._intrinsicSize)};this._materials[0]=new xPt(F)}else x.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,x.normalType=Br.Compressed,this._materials[0]=new km(x);this._materials[0].setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._context.stage.add(this._materials[0])}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials[0]=null,this._materials.length=0}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,EPt,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(i),n=e.renderingInfo;return this._createAs3DShape(i,n,r,i.uid)}layerOpacityChanged(){var n,s,o;const e=(s=(n=this.symbolLayer)==null?void 0:n.material)==null?void 0:s.color,i=this._getCombinedOpacity(e),r=i<1||this.needsDrivenTransparentPass;(o=this._materials[0])==null||o.setParameters({opacity:i,transparent:r})}layerElevationInfoChanged(e,i){return this.updateGraphics3DGraphicElevationInfo(e,i,X2)}slicePlaneEnabledChanged(){var e;return(e=this._materials[0])==null||e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){var e;return(e=this._materials[0])==null||e.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,i){var r;for(const n in e.diff){if(n!=="visualVariables"||!A5(this._fastUpdates,i,this._vvConvertOptions))return To.RecreateSymbol;(r=this._materials[0])==null||r.setParameters(this._fastUpdates.materialParameters)}return To.FastUpdate}_getVertexData(e){let i=0;const r=e.paths,n=[],s=e.spatialReference,o=this._context.elevationProvider.spatialReference,l=this._context.renderCoordsHelper.spatialReference;for(const x of r)i+=x.length;const c=Ja(3*i);let f,_=0;for(const x of r){n.push({offset:_,numVertices:x.length});for(const T of x)c[_++]=T[0],c[_++]=T[1],c[_++]=e.hasZ?T[2]:0}return o==null||s.equals(o)||vn(c,s,0,c,o,0,i)?(o==null||o.equals(l)?f=yLe(c):(f=Ja(3*i),vn(c,o,0,f,l,0,i)),{pathVertexDataInfos:n,vertexDataES:c,vertexDataRS:f}):null}_createAs3DShape(e,i,r,n){var M,I,L;this.usedMemory=0;const s=e.geometry,o=this._getVertexData(s);if(o==null)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(o.pathVertexDataInfos.length===0)return s.paths.length!==0&&s.paths.some(F=>F.length>0)||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const l=new Array,c=s.spatialReference,f=ya(),_=this._context.renderCoordsHelper,x=new nae(o.vertexDataES);for(const F of o.pathVertexDataInfos){const z=F.numVertices;if(z<2)continue;const k=F.offset;if(this._context.clippingExtent!=null&&(Bn(f),cp(f,o.vertexDataES,k,z),!ym(f,this._context.clippingExtent)))continue;const U=new Array,j=k+3*z;for(let ce=k;ceMPt(F,z,U,j,this._upVectorAlignment),r);return A.alignedSampledElevation=0,A.needsElevationUpdates=X2(r.mode),A}};function w7e(t,e,i){const{origin:r,positions:n}=t;let s=t.offset;switch(e){default:case Ry.World:for(const o of t.vertices)io[0]=n[s++]+r[0],io[1]=n[s++]+r[1],io[2]=n[s++]+r[2],i.worldUpAtPosition(io,io),o.setFrameFromUpVector(io);break;case Ry.Path:io[0]=n[s]+r[0],io[1]=n[s+1]+r[1],io[2]=n[s+2]+r[2],i.worldUpAtPosition(io,io),U5t(t,io)}}function Rve(t,e,i){switch(t){case"symbol-value":return i;case"proportional":return e;default:return t}}function APt(t,e,i,r){let n=0;const{origin:s,vertices:o,positions:l,positionsES:c}=t,f=t.offset+3*o.length;for(let _=t.offset;_Math.abs(c)?(ao(e,KN,o,-c),Ye(e,e),Wt(i,e,o),Ye(i,i),De(i,i,-1)):(ao(i,QN,o,-l),Ye(i,i),Wt(e,i,o),Ye(e,e))}const hg=Qe(),KN=W(),QN=W(),oY=W();function RPt(t,e){Ie(ER,0,0,0);for(let i=0;if.color));const l=t.output===ue.Depth;l&&(e.include(E_,t),XT(e),B2(e)),i.code.add(V` +}`)}return e}const _Pt=Object.freeze(Object.defineProperty({__proto__:null,build:p7e},Symbol.toStringTag,{value:"Module"})),f7e=new Map([[J.POSITION,0],[J.PROFILERIGHT,1],[J.PROFILEUP,2],[J.PROFILEVERTEXANDNORMAL,3],[J.FEATUREVALUE,4]]);let bPt=class extends vPt{constructor(){super(...arguments),this.ambient=st(.2,.2,.2),this.diffuse=st(.8,.8,.8),this.specular=st(0,0,0),this.opacity=1,this.origin=W(),this.modelTransformation=null}},m7e=class g7e extends Hr{initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global,i.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result}initializeProgram(e){return new $r(e.rctx,g7e.shader.get().build(this.configuration),f7e)}initializePipeline(){const e=this.configuration.transparencyPassType,i=this.configuration,r=e===Jt.NONE,n=e===Jt.FrontFace;return Ti({blending:i.output!==ue.Color&&i.output!==ue.Alpha||!i.transparent?null:r?xp:Q_(e),culling:i.hasSlicePlane&&!i.transparent&&i.doubleSidedMode!==Ls.None?G4e:null,depthTest:{func:_x(e)},depthWrite:r||n?sh:null,colorWrite:ji,stencilWrite:i.hasOccludees?n1:null,stencilTest:i.hasOccludees?bx:null,polygonOffset:r||n?null:uG})}};m7e.shader=new Ir(_Pt,()=>we(()=>Promise.resolve().then(()=>mXt),void 0));let sa=class extends pu{constructor(){super(...arguments),this.output=ue.Color,this.doubleSidedMode=Ls.None,this.transparencyPassType=Jt.NONE,this.spherical=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.vvSize=!1,this.vvColor=!1,this.vvOpacity=!1,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.doublePrecisionRequiresObfuscation=!1}};y([fe({count:ue.COUNT})],sa.prototype,"output",void 0),y([fe({count:Ls.COUNT})],sa.prototype,"doubleSidedMode",void 0),y([fe({count:Jt.COUNT})],sa.prototype,"transparencyPassType",void 0),y([fe()],sa.prototype,"spherical",void 0),y([fe()],sa.prototype,"receiveShadows",void 0),y([fe()],sa.prototype,"receiveAmbientOcclusion",void 0),y([fe()],sa.prototype,"vvSize",void 0),y([fe()],sa.prototype,"vvColor",void 0),y([fe()],sa.prototype,"vvOpacity",void 0),y([fe()],sa.prototype,"hasSlicePlane",void 0),y([fe()],sa.prototype,"transparent",void 0),y([fe()],sa.prototype,"hasOccludees",void 0),y([fe()],sa.prototype,"multipassEnabled",void 0),y([fe()],sa.prototype,"cullAboveGround",void 0),y([fe()],sa.prototype,"doublePrecisionRequiresObfuscation",void 0),y([fe({constValue:!1})],sa.prototype,"occlusionPass",void 0),y([fe({constValue:ti.Disabled})],sa.prototype,"pbrMode",void 0),y([fe({constValue:!0})],sa.prototype,"hasVvInstancing",void 0),y([fe({constValue:!1})],sa.prototype,"useCustomDTRExponentForWater",void 0),y([fe({constValue:!1})],sa.prototype,"useFillLights",void 0),y([fe({constValue:!1})],sa.prototype,"hasColorTexture",void 0);let wPt=class y7e extends yx{constructor(e){super(e,new SPt),this.supportsEdges=!0,this._vertexAttributeLocations=f7e,this._configuration=new sa,this._vertexBufferLayout=y7e.getVertexBufferLayout()}getConfiguration(e,i){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e!==ue.Color&&e!==ue.Alpha||(this._configuration.doubleSidedMode=this.parameters.doubleSided&&this.parameters.doubleSidedType==="normal"?Ls.View:this.parameters.doubleSided&&this.parameters.doubleSidedType==="winding-order"?Ls.WindingOrder:Ls.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=i.ssao!=null),this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.multipassEnabled=i.multipassEnabled,this._configuration.cullAboveGround=i.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==ue.Shadow&&e!==ue.ShadowExcludeHighlight&&e!==ue.ShadowHighlight||this.parameters.castShadows}isVisible(){return super.isVisible()&&this.parameters.opacity>0}intersect(e,i,r,n,s,o){const a=e;if(!r7e(a))return;const c=a.path,p=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSize){const{offset:$,factor:F,minSize:z,maxSize:k}=this.parameters.vvSize,U=c.sizeAttributeValue;p[0]*=Je($[0]+U*F[0],z[0],k[0]),p[1]*=Je($[2]+U*F[2],z[2],k[2])}const _=Math.max(p[0],p[1]),x=e.boundingInfo;if(x==null)return void this._intersectTriangles(c,p,n,s,o);const S=D2(x.bbMin[0]-_,x.bbMin[1]-_,x.bbMin[2]-_,x.bbMax[0]+_,x.bbMax[1]+_,x.bbMax[2]+_),C=[s[0]-n[0],s[1]-n[1],s[2]-n[2]],M=Math.sqrt(C[0]*C[0]+C[1]*C[1]+C[2]*C[2]),P=[M/C[0],M/C[1],M/C[2]];Mle(S,n,P,r.tolerance)&&this._intersectTriangles(c,p,n,s,o)}_intersectTriangles(e,i,r,n,s){e.baked.size&&e.baked.size[0]===i[0]&&e.baked.size[1]===i[1]||e.baked.bake(i),e.baked.intersect(r,n,s)}createBufferWriter(){return new D5(this._vertexBufferLayout)}produces(e,i){switch(i){case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:if(!this.parameters.castShadows)return!1;case ue.Color:case ue.Alpha:case ue.Depth:case ue.Normal:case ue.Highlight:case ue.ObjectAndLayerIdColor:return e===(this.parameters.transparent?ke.TRANSPARENT_MATERIAL:ke.OPAQUE_MATERIAL)||e===ke.DRAPED_MATERIAL;default:return!1}}createGLMaterial(e){return new xPt(e)}static getVertexBufferLayout(){return ls().vec3f(J.POSITION).vec4f(J.PROFILERIGHT).vec4f(J.PROFILEUP).vec4f(J.PROFILEVERTEXANDNORMAL).vec4f(J.FEATUREVALUE)}},xPt=class extends fx{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){this.technique!=null&&e.shadowMap.enabled===this.technique.configuration.receiveShadows||this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output!==ue.Color&&this._output!==ue.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(m7e,e)}},SPt=class extends bPt{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}};const TPt=["polyline"];let EPt=class extends w1{constructor(e,i,r,n){super(e,i,r,n),this._intrinsicSize=Ji(1,1),this._upVectorAlignment=Fy.Path,this._stencilWidth=.1,this.usedMemory=0,this.ensureDrapedStatus(!1)}async doLoad(){var S,C,M,P,$;const e=this.symbolLayer.width!=null?this.symbolLayer.width:this.symbolLayer.height,i=this.symbolLayer.height!=null?this.symbolLayer.height:e;this._vvConvertOptions=new r6({size:!0,color:!0,rotation:!1,opacity:!0},[1,1,1],[e,1,i],this._context.renderCoordsHelper.unitInMeters),this._fastUpdates=((C=(S=this._context.renderer)==null?void 0:S.visualVariables)==null?void 0:C.length)>0?DP(this._context.renderer,this._vvConvertOptions):null;const r=this.symbolLayer.anchor||"center";this._upVectorAlignment=this.symbolLayer.profileRotation==="heading"?Fy.World:Fy.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=VOt[r];break;case"quad":this._profile=BOt[r]}switch(this.symbolLayer.join){case"round":this._extruder=new uY(0,I6e);break;case"bevel":this._extruder=new uY(0,1);break;case"miter":this._extruder=new uY(.8*Math.PI,1);break;default:this._extruder=new MOt}const s=this.symbolLayer.cap||"butt";switch(s){case"none":this._startCap=new Tve,this._endCap=new Tve;break;case"butt":default:this._startCap=new r8(this._profile,0),this._endCap=new r8(this._profile,0,!0);break;case"square":this._startCap=new r8(this._profile,-.5),this._endCap=new r8(this._profile,.5,!0);break;case"round":{const F=n==="quad";this._startCap=new Eve({profile:this._profile,flip:!1,breakNormals:F,subdivisions:die}),this._endCap=new Eve({profile:this._profile,flip:!0,breakNormals:F,subdivisions:die});break}}const o=(P=(M=this.symbolLayer)==null?void 0:M.material)==null?void 0:P.color,a=this._getCombinedOpacityAndColor(o),c=vc(a),p=a[3],_=p<1||this.needsDrivenTransparentPass,x={diffuse:c,ambient:c,opacity:p,transparent:_,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,cullFace:_||s==="none"?Ln.None:Ln.Back,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(or(this._intrinsicSize,e,i),!hie(this._intrinsicSize[0])||!hie(this._intrinsicSize[1])))throw new se("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");if(($=this._fastUpdates)!=null&&$.visualVariables.size||qu(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates){const F={...x,...this._fastUpdates.materialParameters,size:y5e(this._intrinsicSize)};this._materials[0]=new wPt(F)}else x.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,x.normalType=Br.Compressed,this._materials[0]=new Vm(x);this._materials[0].setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._context.stage.add(this._materials[0])}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials[0]=null,this._materials.length=0}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,TPt,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(i),n=e.renderingInfo;return this._createAs3DShape(i,n,r,i.uid)}layerOpacityChanged(){var n,s,o;const e=(s=(n=this.symbolLayer)==null?void 0:n.material)==null?void 0:s.color,i=this._getCombinedOpacity(e),r=i<1||this.needsDrivenTransparentPass;(o=this._materials[0])==null||o.setParameters({opacity:i,transparent:r})}layerElevationInfoChanged(e,i){return this.updateGraphics3DGraphicElevationInfo(e,i,ex)}slicePlaneEnabledChanged(){var e;return(e=this._materials[0])==null||e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){var e;return(e=this._materials[0])==null||e.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,i){var r;for(const n in e.diff){if(n!=="visualVariables"||!NP(this._fastUpdates,i,this._vvConvertOptions))return Eo.RecreateSymbol;(r=this._materials[0])==null||r.setParameters(this._fastUpdates.materialParameters)}return Eo.FastUpdate}_getVertexData(e){let i=0;const r=e.paths,n=[],s=e.spatialReference,o=this._context.elevationProvider.spatialReference,a=this._context.renderCoordsHelper.spatialReference;for(const x of r)i+=x.length;const c=Qa(3*i);let p,_=0;for(const x of r){n.push({offset:_,numVertices:x.length});for(const S of x)c[_++]=S[0],c[_++]=S[1],c[_++]=e.hasZ?S[2]:0}return o==null||s.equals(o)||un(c,s,0,c,o,0,i)?(o==null||o.equals(a)?p=pLe(c):(p=Qa(3*i),un(c,o,0,p,a,0,i)),{pathVertexDataInfos:n,vertexDataES:c,vertexDataRS:p}):null}_createAs3DShape(e,i,r,n){var M,P,$;this.usedMemory=0;const s=e.geometry,o=this._getVertexData(s);if(o==null)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(o.pathVertexDataInfos.length===0)return s.paths.length!==0&&s.paths.some(F=>F.length>0)||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const a=new Array,c=s.spatialReference,p=va(),_=this._context.renderCoordsHelper,x=new yae(o.vertexDataES);for(const F of o.pathVertexDataInfos){const z=F.numVertices;if(z<2)continue;const k=F.offset;if(this._context.clippingExtent!=null&&(Bn(p),pp(p,o.vertexDataES,k,z),!bm(p,this._context.clippingExtent)))continue;const U=new Array,j=k+3*z;for(let ce=k;ceAPt(F,z,U,j,this._upVectorAlignment),r);return C.alignedSampledElevation=0,C.needsElevationUpdates=ex(r.mode),C}};function v7e(t,e,i){const{origin:r,positions:n}=t;let s=t.offset;switch(e){default:case Fy.World:for(const o of t.vertices)ro[0]=n[s++]+r[0],ro[1]=n[s++]+r[1],ro[2]=n[s++]+r[2],i.worldUpAtPosition(ro,ro),o.setFrameFromUpVector(ro);break;case Fy.Path:ro[0]=n[s]+r[0],ro[1]=n[s+1]+r[1],ro[2]=n[s+2]+r[2],i.worldUpAtPosition(ro,ro),zOt(t,ro)}}function Ive(t,e,i){switch(t){case"symbol-value":return i;case"proportional":return e;default:return t}}function CPt(t,e,i,r){let n=0;const{origin:s,vertices:o,positions:a,positionsES:c}=t,p=t.offset+3*o.length;for(let _=t.offset;_Math.abs(c)?(lo(e,s8,o,-c),Ye(e,e),Wt(i,e,o),Ye(i,i),De(i,i,-1)):(lo(i,o8,o,-a),Ye(i,i),Wt(e,i,o),Ye(e,e))}const gg=Qe(),s8=W(),o8=W(),gY=W();function PPt(t,e){Ie(NR,0,0,0);for(let i=0;ip.color));const a=t.output===ue.Depth;a&&(e.include(I_,t),eE(e),W2(e)),i.code.add(V` void main(void) { vpos = position; forwardNormalizedVertexColor(); @@ -3608,9 +3597,9 @@ outputHighlight(); ${t.hasVertexColors?"vColor *= eColor;":t.vvColor?"vColor = eColor * interpolateVVColor(colorFeatureAttribute);":"vColor = eColor;"} ${o?"depth = (view * vec4(vpos, 1.0)).z;":""} - gl_Position = ${l?V`transformPositionWithDepth(proj, view, vpos, nearFar, linearDepth);`:V`transformPosition(proj, view, vpos);`} + gl_Position = ${a?V`transformPositionWithDepth(proj, view, vpos, nearFar, linearDepth);`:V`transformPosition(proj, view, vpos);`} } - `),e.include(oo,t),o&&e.include(dd,t),r.include(h1);const c=t.output===ue.Highlight;return c&&e.include(dx,t),r.code.add(V` + `),e.include(ao,t),o&&e.include(gd,t),r.include(_1);const c=t.output===ue.Highlight;return c&&e.include(vx,t),r.code.add(V` void main() { discardBySlice(vpos); ${o?"terrainDepthTest(depth);":""} @@ -3618,7 +3607,7 @@ outputHighlight(); ${t.output===ue.ObjectAndLayerIdColor?V`fColor.a = 1.0;`:""} - if (fColor.a < ${V.float(Cl)}) { + if (fColor.a < ${V.float(Ml)}) { discard; } @@ -3629,10 +3618,10 @@ outputHighlight(); ${t.output===ue.Depth?V`outputDepth(linearDepth);`:""}; ${t.output===ue.ObjectAndLayerIdColor?V`outputObjectAndLayerIdColor();`:""} } - `),e}const IPt=Object.freeze(Object.defineProperty({__proto__:null,build:S7e},Symbol.toStringTag,{value:"Module"}));let T7e=class E7e extends Hr{initializeProgram(e){return new Ir(e.rctx,E7e.shader.get().build(this.configuration),Er)}_createPipeline(e,i){const r=this.configuration,n=e===Jt.NONE,s=e===Jt.FrontFace;return Ti({blending:r.output!==ue.Color&&r.output!==ue.Alpha||!r.transparent?null:n?vp:Y_(e),culling:Mj(r.cullFace),depthTest:{func:px(e)},depthWrite:(n||s)&&r.writeDepth?rh:null,colorWrite:ji,stencilWrite:r.hasOccludees?Jy:null,stencilTest:r.hasOccludees?i?Z2:fx:null,polygonOffset:n||s?r.polygonOffset?$Pt:null:tG(r.enableOffset)})}initializePipeline(){return this._occludeePipelineState=this._createPipeline(this.configuration.transparencyPassType,!0),this._createPipeline(this.configuration.transparencyPassType,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}};T7e.shader=new Rr(IPt,()=>we(()=>Promise.resolve().then(()=>LWt),void 0));const $Pt={factor:1,units:1};let fl=class extends hu{constructor(){super(...arguments),this.output=ue.Color,this.cullFace=Ln.None,this.transparencyPassType=Jt.NONE,this.hasSlicePlane=!1,this.hasVertexColors=!1,this.transparent=!1,this.polygonOffset=!1,this.enableOffset=!0,this.writeDepth=!0,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.objectAndLayerIdColorInstanced=!1,this.vvColor=!1}};y([fe({count:ue.COUNT})],fl.prototype,"output",void 0),y([fe({count:Ln.COUNT})],fl.prototype,"cullFace",void 0),y([fe({count:Jt.COUNT})],fl.prototype,"transparencyPassType",void 0),y([fe()],fl.prototype,"hasSlicePlane",void 0),y([fe()],fl.prototype,"hasVertexColors",void 0),y([fe()],fl.prototype,"transparent",void 0),y([fe()],fl.prototype,"polygonOffset",void 0),y([fe()],fl.prototype,"enableOffset",void 0),y([fe()],fl.prototype,"writeDepth",void 0),y([fe()],fl.prototype,"hasOccludees",void 0),y([fe()],fl.prototype,"multipassEnabled",void 0),y([fe()],fl.prototype,"cullAboveGround",void 0),y([fe()],fl.prototype,"objectAndLayerIdColorInstanced",void 0),y([fe()],fl.prototype,"vvColor",void 0),y([fe({constValue:!1})],fl.prototype,"occlusionPass",void 0),y([fe({constValue:!0})],fl.prototype,"hasVvInstancing",void 0),y([fe({constValue:!1})],fl.prototype,"vvSize",void 0),y([fe({constValue:!1})],fl.prototype,"vvOpacity",void 0);let $ve=class extends Zle{constructor(e){super(e,new DPt),this.supportsEdges=!0,this._configuration=new fl}getConfiguration(e,i){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._isTransparent,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.enableOffset=i.camera.relativeElevation1/_.screenToPCSRatio)):s.add(J.BOUNDINGRECT,"mat3"),s.add(J.POSITION,"vec3"),s.add(J.UVMAPSPACE,"vec4"),t.vvColor&&s.add(J.COLORFEATUREATTRIBUTE,"float"),o.add("vColor","vec4"),o.add("vpos","vec3"),o.add("vuv","vec2"),i&&o.add("depth","float"),r.uniforms.add(new gr("uColor",f=>f.color));const l=t.style===Tl.ForwardDiagonal||t.style===Tl.BackwardDiagonal||t.style===Tl.DiagonalCross;l&&r.code.add(V` - const mat2 rotate45 = mat2(${V.float(Aie)}, ${V.float(-Lve)}, - ${V.float(Lve)}, ${V.float(Aie)}); - `),t.draped||(Nm(r,t),r.uniforms.add(new ft("worldToScreenPerDistanceRatio",(f,_)=>1/_.camera.perScreenPixelRatio)),r.code.add(V`vec3 projectPointToLineSegment(vec3 center, vec3 halfVector, vec3 point) { + `),e}const RPt=Object.freeze(Object.defineProperty({__proto__:null,build:b7e},Symbol.toStringTag,{value:"Module"}));let w7e=class x7e extends Hr{initializeProgram(e){return new $r(e.rctx,x7e.shader.get().build(this.configuration),Cr)}_createPipeline(e,i){const r=this.configuration,n=e===Jt.NONE,s=e===Jt.FrontFace;return Ti({blending:r.output!==ue.Color&&r.output!==ue.Alpha||!r.transparent?null:n?xp:Q_(e),culling:kj(r.cullFace),depthTest:{func:_x(e)},depthWrite:(n||s)&&r.writeDepth?sh:null,colorWrite:ji,stencilWrite:r.hasOccludees?n1:null,stencilTest:r.hasOccludees?i?tx:bx:null,polygonOffset:n||s?r.polygonOffset?IPt:null:hG(r.enableOffset)})}initializePipeline(){return this._occludeePipelineState=this._createPipeline(this.configuration.transparencyPassType,!0),this._createPipeline(this.configuration.transparencyPassType,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}};w7e.shader=new Ir(RPt,()=>we(()=>Promise.resolve().then(()=>gXt),void 0));const IPt={factor:1,units:1};let gl=class extends pu{constructor(){super(...arguments),this.output=ue.Color,this.cullFace=Ln.None,this.transparencyPassType=Jt.NONE,this.hasSlicePlane=!1,this.hasVertexColors=!1,this.transparent=!1,this.polygonOffset=!1,this.enableOffset=!0,this.writeDepth=!0,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.objectAndLayerIdColorInstanced=!1,this.vvColor=!1}};y([fe({count:ue.COUNT})],gl.prototype,"output",void 0),y([fe({count:Ln.COUNT})],gl.prototype,"cullFace",void 0),y([fe({count:Jt.COUNT})],gl.prototype,"transparencyPassType",void 0),y([fe()],gl.prototype,"hasSlicePlane",void 0),y([fe()],gl.prototype,"hasVertexColors",void 0),y([fe()],gl.prototype,"transparent",void 0),y([fe()],gl.prototype,"polygonOffset",void 0),y([fe()],gl.prototype,"enableOffset",void 0),y([fe()],gl.prototype,"writeDepth",void 0),y([fe()],gl.prototype,"hasOccludees",void 0),y([fe()],gl.prototype,"multipassEnabled",void 0),y([fe()],gl.prototype,"cullAboveGround",void 0),y([fe()],gl.prototype,"objectAndLayerIdColorInstanced",void 0),y([fe()],gl.prototype,"vvColor",void 0),y([fe({constValue:!1})],gl.prototype,"occlusionPass",void 0),y([fe({constValue:!0})],gl.prototype,"hasVvInstancing",void 0),y([fe({constValue:!1})],gl.prototype,"vvSize",void 0),y([fe({constValue:!1})],gl.prototype,"vvOpacity",void 0);let Lve=class extends cce{constructor(e){super(e,new LPt),this.supportsEdges=!0,this._configuration=new gl}getConfiguration(e,i){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._isTransparent,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.enableOffset=i.camera.relativeElevation1/_.screenToPCSRatio)):s.add(J.BOUNDINGRECT,"mat3"),s.add(J.POSITION,"vec3"),s.add(J.UVMAPSPACE,"vec4"),t.vvColor&&s.add(J.COLORFEATUREATTRIBUTE,"float"),o.add("vColor","vec4"),o.add("vpos","vec3"),o.add("vuv","vec2"),i&&o.add("depth","float"),r.uniforms.add(new gr("uColor",p=>p.color));const a=t.style===Cl.ForwardDiagonal||t.style===Cl.BackwardDiagonal||t.style===Cl.DiagonalCross;a&&r.code.add(V` + const mat2 rotate45 = mat2(${V.float(Die)}, ${V.float(-Dve)}, + ${V.float(Dve)}, ${V.float(Die)}); + `),t.draped||(zm(r,t),r.uniforms.add(new ft("worldToScreenPerDistanceRatio",(p,_)=>1/_.camera.perScreenPixelRatio)),r.code.add(V`vec3 projectPointToLineSegment(vec3 center, vec3 halfVector, vec3 point) { float projectedLength = dot(halfVector, point - center) / dot(halfVector, halfVector); return center + halfVector * clamp(projectedLength, -1.0, 1.0); }`),r.code.add(V`vec3 intersectRayPlane(vec3 rayDir, vec3 rayOrigin, vec3 planeNormal, vec3 planePoint) { @@ -3649,7 +3638,7 @@ return rayOrigin + t * rayDir; vec3 viewDir = - vec3(view[0][2], view[1][2], view[2][2]); float viewAngle = dot(viewDir, n); - float minViewAngle = ${V.float(NPt)}; + float minViewAngle = ${V.float(DPt)}; if (abs(viewAngle) < minViewAngle) { // view direction is (almost) parallel to plane -> clamp it to min angle @@ -3671,8 +3660,8 @@ return rayOrigin + t * rayDir; } `)),r.code.add(V` vec2 scaledUV() { - vec2 uv = uvMapSpace.xy ${l?" * rotate45":""}; - vec2 uvCellOrigin = uvMapSpace.zw ${l?" * rotate45":""}; + vec2 uv = uvMapSpace.xy ${a?" * rotate45":""}; + vec2 uvCellOrigin = uvMapSpace.zw ${a?" * rotate45":""}; ${t.draped?"":V` float distanceToCamera = boundingRectDistanceToCamera(); @@ -3688,7 +3677,7 @@ return rayOrigin + t * rayDir; vec2 uvOffset = mod(uvCellOrigin * discreteWorldToScreenRatio, ${V.float(t.patternSpacing)}); return uvOffset + (uv * discreteWorldToScreenRatio); } - `);const c=t.output===ue.Depth;return c&&(e.include(E_,t),XT(e),B2(e)),r.code.add(V` + `);const c=t.output===ue.Depth;return c&&(e.include(I_,t),eE(e),W2(e)),r.code.add(V` void main(void) { vuv = scaledUV(); vpos = position; @@ -3697,7 +3686,7 @@ return rayOrigin + t * rayDir; ${t.hasVertexColors?"vColor *= uColor;":t.vvColor?"vColor = uColor * interpolateVVColor(colorFeatureAttribute);":"vColor = uColor;"} gl_Position = ${c?V`transformPositionWithDepth(proj, view, vpos, nearFar, linearDepth);`:V`transformPosition(proj, view, vpos);`} } - `),e.include(oo,t),n.include(h1),t.draped&&n.uniforms.add(new ft("texelSize",(f,_)=>1/_.camera.pixelRatio)),t.output===ue.Highlight&&e.include(dx,t),i&&e.include(dd,t),t.output!==ue.Highlight&&(n.code.add(V` + `),e.include(ao,t),n.include(_1),t.draped&&n.uniforms.add(new ft("texelSize",(p,_)=>1/_.camera.pixelRatio)),t.output===ue.Highlight&&e.include(vx,t),i&&e.include(gd,t),t.output!==ue.Highlight&&(n.code.add(V` const float lineWidth = ${V.float(t.lineWidth)}; const float spacing = ${V.float(t.patternSpacing)}; const float spacingINV = ${V.float(1/t.patternSpacing)}; @@ -3744,11 +3733,11 @@ return accumulator; vec4 color = vColor; color = highlightSlice(color, vpos); - ${t.output!==ue.Highlight?V`color.a *= ${FPt(t)};`:""} + ${t.output!==ue.Highlight?V`color.a *= ${NPt(t)};`:""} ${t.output===ue.ObjectAndLayerIdColor?V`color.a = 1.0;`:""} - if (color.a < ${V.float(Cl)}) { + if (color.a < ${V.float(Ml)}) { discard; } @@ -3758,10 +3747,10 @@ return accumulator; ${t.output===ue.Highlight?V`outputHighlight();`:""} ${t.output===ue.Depth?V`outputDepth(linearDepth);`:""}; } - `),e}function FPt(t){function e(i){return t.draped?V`coverage(vuv.${i}, texelSize)`:V`sampleAA(vuv.${i})`}switch(t.style){case Tl.ForwardDiagonal:case Tl.Horizontal:return e("y");case Tl.BackwardDiagonal:case Tl.Vertical:return e("x");case Tl.DiagonalCross:case Tl.Cross:return V` + `),e}function NPt(t){function e(i){return t.draped?V`coverage(vuv.${i}, texelSize)`:V`sampleAA(vuv.${i})`}switch(t.style){case Cl.ForwardDiagonal:case Cl.Horizontal:return e("y");case Cl.BackwardDiagonal:case Cl.Vertical:return e("x");case Cl.DiagonalCross:case Cl.Cross:return V` 1.0 - (1.0 - ${e("x")}) * (1.0 - ${e("y")}) - `;default:return"0.0"}}const kPt=Object.freeze(Object.defineProperty({__proto__:null,build:C7e},Symbol.toStringTag,{value:"Module"}));let A7e=class M7e extends Hr{initializeProgram(e){return new Ir(e.rctx,M7e.shader.get().build(this.configuration),O7e)}_setPipelineState(e,i){const r=this.configuration,n=e===Jt.NONE,s=e===Jt.FrontFace;return Ti({blending:r.output===ue.Color||r.output===ue.Alpha?n?vp:Y_(e):null,culling:Mj(r.cullFace),depthTest:{func:px(e)},depthWrite:n?r.writeDepth?rh:null:Kj(e),colorWrite:ji,stencilWrite:r.hasOccludees?Jy:null,stencilTest:r.hasOccludees?i?Z2:fx:null,polygonOffset:n||s?r.polygonOffset?zPt:null:tG(r.enableOffset)})}initializePipeline(){return this._occludeePipelineState=this._setPipelineState(this.configuration.transparencyPassType,!0),this._setPipelineState(this.configuration.transparencyPassType,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}};A7e.shader=new Rr(kPt,()=>we(()=>Promise.resolve().then(()=>DWt),void 0));const zPt={factor:1,units:1};let ba=class extends hu{constructor(){super(...arguments),this.output=ue.Color,this.cullFace=Ln.None,this.transparencyPassType=Jt.NONE,this.hasSlicePlane=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.writeDepth=!0,this.hasOccludees=!1,this.enableOffset=!0,this.multipassEnabled=!1,this.cullAboveGround=!1,this.vvColor=!1}};y([fe({count:ue.COUNT})],ba.prototype,"output",void 0),y([fe({count:Ln.COUNT})],ba.prototype,"cullFace",void 0),y([fe({count:Tl.COUNT})],ba.prototype,"style",void 0),y([fe({count:Jt.COUNT})],ba.prototype,"transparencyPassType",void 0),y([fe()],ba.prototype,"hasSlicePlane",void 0),y([fe()],ba.prototype,"hasVertexColors",void 0),y([fe()],ba.prototype,"polygonOffset",void 0),y([fe()],ba.prototype,"writeDepth",void 0),y([fe()],ba.prototype,"hasOccludees",void 0),y([fe()],ba.prototype,"patternSpacing",void 0),y([fe()],ba.prototype,"lineWidth",void 0),y([fe()],ba.prototype,"enableOffset",void 0),y([fe()],ba.prototype,"draped",void 0),y([fe()],ba.prototype,"multipassEnabled",void 0),y([fe()],ba.prototype,"cullAboveGround",void 0),y([fe()],ba.prototype,"vvColor",void 0),y([fe({constValue:!1})],ba.prototype,"occlusionPass",void 0),y([fe({constValue:!1})],ba.prototype,"hasVvInstancing",void 0),y([fe({constValue:!1})],ba.prototype,"vvSize",void 0),y([fe({constValue:!1})],ba.prototype,"vvOpacity",void 0);const O7e=new Map([[J.POSITION,0],[J.COLOR,3],[J.UVMAPSPACE,4],[J.COLORFEATUREATTRIBUTE,5],[J.BOUNDINGRECT,6]]);let mce=class extends Zle{constructor(e){super(e,new BPt),this.supportsEdges=!0,this._vertexAttributeLocations=O7e,this._configuration=new ba}getConfiguration(e,i){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.style=this.parameters.style,this._configuration.patternSpacing=this.parameters.patternSpacing,this._configuration.lineWidth=this.parameters.lineWidth,this._configuration.draped=this.parameters.draped,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.enableOffset=i.camera.relativeElevation0)return;const e=(s=(n=this.symbolLayer)==null?void 0:n.material)==null?void 0:s.color,i=this._getCombinedOpacityAndColor(e);this._materials[Qs.Fill]=jPt(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,polygonOffset:!1,hasVertexColors:!0,writeLinearDepth:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...(o=this._fastUpdates)==null?void 0:o.materialParameters}),this._needsUV=this._materials[Qs.Fill]instanceof mce;const r=this.symbolLayer.outline;if(this._isValidOutline(r)){const l=_8e(r.pattern);this._materials[Qs.Outline]=new zM({width:Tr(r.size),color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:l,cap:bie(r.patternCap||"butt")})}this._context.stage.addMany(this._materials)}_isValidOutline(e){return(e==null?void 0:e.size)!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!=="style"||e.pattern.style!=="none")}destroy(){super.destroy(),this._context.stage.removeMany(this._materials),this._materials.length=0}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,YPt,this.symbolLayer.type))return null;const r=this._getVertexOpacityAndColor(e.renderingInfo,255),n=this.setGraphicElevationContext(i);return this.ensureDrapedStatus(n.mode==="on-the-ground"),this._createMaterials(),this.draped?this._createAsOverlay(i,r):this._createAs3DShape(i,r,n)}applyRendererDiff(e,i){var r;for(const n in e.diff){if(n!=="visualVariables"||!A5(this._fastUpdates,i,Dve))return To.RecreateSymbol;(r=this._materials[Qs.Fill])==null||r.setParameters(this._fastUpdates.materialParameters)}return To.FastUpdate}layerOpacityChanged(){var e,i;if(this._materials[Qs.Fill]!=null){const r=this._materials[Qs.Fill].parameters.color,n=(i=(e=this.symbolLayer)==null?void 0:e.material)==null?void 0:i.color,s=this._getCombinedOpacity(n);this._materials[Qs.Fill].setParameters({color:[r[0],r[1],r[2],s],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[Qs.Outline]!=null){const r=this._materials[Qs.Outline].parameters.color;this._materials[Qs.Outline].setParameters({color:[r[0],r[1],r[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,i,r){const n=this._elevationContext.mode,s=i6(R7e.elevationModeChangeTypes,r,n);if(s!==Ys.UPDATE)return s;const o=t0(n);return this.updateGraphics3DGraphicElevationInfo(e,i,()=>o)}slicePlaneEnabledChanged(){var e;if((e=this._materials[Qs.Fill])==null||e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[Qs.Outline]){const i={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[Qs.Outline].setParameters(i)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,i,r){var _;const n=VL(e.geometry);if(!n)return null;const s=ice(n,this._context.elevationProvider,this._context.renderCoordsHelper,r),o=new XPt(s,i,this._context.layer.uid,e.uid),l=o.renderData.position.length/3;if(this._needsUV&&(o.uvMapSpace=Rs(4*l,!0),o.boundingRect=Ja(9*l,!0),x7e(o.uvMapSpace,o.boundingRect,o.renderData.position,this._context.renderCoordsHelper)),o.objectAndLayerIdColor=(_=this._context.stage.renderView)==null?void 0:_.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[Qs.Outline]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,n.rings,"rings","FillSymbol3DLayer"),o.outGeometries.length===0)return null;const c=new X_({geometries:o.outGeometries,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:e.uid}),f=new d1(this,c,o.outGeometries,null,null,WPt,r);return f.alignedSampledElevation=o.renderData.sampledElevation,f.needsElevationUpdates=t0(r.mode),f}_createAs3DShapeFill(e,i){var n;const r=i.renderData.polygons;for(const{position:s,mapPositions:o,holeIndices:l,index:c,count:f}of r){if(this._context.clippingExtent!=null&&(Bn(y0),cp(y0,o),!ym(y0,this._context.clippingExtent)))continue;const _=hTt(o,l,this._context.elevationProvider.spatialReference);if(_.length===0)continue;const x=(n=this._fastUpdates)==null?void 0:n.visualVariables.color,T=Qye({material:this._materials[Qs.Fill],indices:_,mapPositions:o,attributeData:{position:s,color:x?null:i.color,colorFeature:x?Om(x.field,e):null,uvMapSpace:this._needsUV?SU(i.uvMapSpace,4*c,4*f):null,boundingRect:this._needsUV?Lf(i.boundingRect,9*c,9*f):null,objectAndLayerIdColor:i.objectAndLayerIdColor}});i.outGeometries.push(T)}}_createAs3DShapeOutline(e){if(this._materials[Qs.Outline]==null)return;const i=e.renderData.outlines;for(const{mapPositions:r,position:n}of i){if(this._context.clippingExtent!=null&&(Bn(y0),cp(y0,r),!ym(y0,this._context.clippingExtent)))continue;const s=wie(this._materials[Qs.Outline],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:n}},e.objectAndLayerIdColor);e.outGeometries.push(s)}}_createAsOverlay(e,i){var l;const r=VL(e.geometry);if(r==null)return null;this._materials[Qs.Fill].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[Qs.Outline]!=null&&(this._materials[Qs.Outline].renderPriority=this._renderPriority);const n=YNe(r,this._context.overlaySR),s=new ZPt(n,i,this._context.layer.uid,e.uid),o=s.renderData.position.length/3;return this._needsUV&&(s.uvMapSpace=Rs(4*o,!0),OPt(s.uvMapSpace,s.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),s.outBoundingBox=Bn(),s.objectAndLayerIdColor=(l=this._context.stage.renderView)==null?void 0:l.getObjectAndLayerIdColor(s),this._createAsOverlayFill(e,s),this._materials[Qs.Outline]&&this._createAsOverlayOutline(s),this._logGeometryCreationWarnings(s.renderData,r.rings,"rings","FillSymbol3DLayer"),s.outGeometries.length===0?null:new mG(this,s.outGeometries,s.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,i){var n;const r=i.renderData.polygons;for(const{position:s,holeIndices:o,index:l,count:c}of r){const f=Bn(y0);if(cp(f,s),!ym(f,this._context.clippingExtent))continue;const _=R5(s,o,3);if(_.length===0)continue;ZO(i.outBoundingBox,f);const x=(n=this._fastUpdates)==null?void 0:n.visualVariables.color,T=Qye({material:this._materials[Qs.Fill],indices:_,attributeData:{position:s,color:x?null:i.color,colorFeature:x?Om(x.field,e):null,uvMapSpace:this._needsUV?SU(i.uvMapSpace,4*l,4*c):null,objectAndLayerIdColor:i.objectAndLayerIdColor}});i.outGeometries.push(new $5(T,i))}}_createAsOverlayOutline(e){if(this._materials[Qs.Outline]==null)return;const i=e.renderData.outlines;for(let r=0;rthis._createAsOverlay(e,i),createAs3DShape:(e,i,r)=>this._createAs3DShape(e,i,r)}}};P7e.elevationModeChangeTypes={definedChanged:Ys.RECREATE,staysOnTheGround:Ys.NONE,onTheGroundChanged:Ys.RECREATE};const y0=ya();let XPt=class extends pG{constructor(e,i,r,n){super(e,r,n),this.color=i}},ZPt=class extends pG{constructor(e,i,r,n){super(e,r,n),this.color=i}};var Qs;(function(t){t[t.Fill=0]="Fill",t[t.Outline=1]="Outline"})(Qs||(Qs={}));let I7e=class{constructor(e,i="center",r=!1,n=yt(),s=Mi(0,0,0,-1),o="world",l=W(),c=0){this.verticalOffset=e,this.anchor=i,this.hasLabelVerticalOffset=r,this.screenOffset=n,this.centerOffset=s,this.centerOffsetUnits=o,this.translation=l,this.elevationOffset=c}},$7e=class{constructor(e,i="center",r="center",n=null,s=yt()){this.placement=e,this.horizontalPlacement=i,this.verticalPlacement=r,this.text=n,this.displaySize=s}};const JPt="arial-unicode-ms",Nve="woff2",Fve=new Map,L7e=new Set;let KPt=class{constructor(e,i){this.fontFace=e,this.promise=i}};async function QPt(t){const e=iRt(t),i=Fve.get(e);if(i)return i.promise;const r=new FontFace(t.family,`url('${Ar.fontsUrl}/woff2/${e}.${Nve}') format('${Nve}')`,{style:t.style,weight:t.weight}),n=document.fonts;if(n.has(r)&&r.status==="loading")return r.loaded;const s=r.load().then(()=>(n.add(r),r));return Fve.set(e,new KPt(r,s)),L7e.add(r),s}function eRt(t){return L7e.has(t)}function tRt(t){if(!t)return JPt;const e=t.toLowerCase().split(" ").join("-");switch(e){case"serif":return"noto-serif";case"sans-serif":return"arial-unicode-ms";case"monospace":return"ubuntu-mono";case"fantasy":return"cabin-sketch";case"cursive":return"redressed";default:return e}}function iRt(t){const e=rRt(t)+nRt(t);return tRt(t.family)+(e.length>0?e:"-regular")}function rRt(t){if(!t.weight)return"";switch(t.weight.toLowerCase()){case"bold":case"bolder":return"-bold"}return""}function nRt(t){if(!t.style)return"";switch(t.style.toLowerCase()){case"italic":case"oblique":return"-italic"}return""}let D7e=class N7e{constructor(e){this.definition=e,this.key=JSON.stringify(e),this.haloSize=Math.round(e.halo.size),this.textStyle=this._colorToRGBA(e.color),this.haloStyle=this._colorToRGB(e.halo.color),this.backgroundStyle=e.background.color[3]!==0?this._colorToRGBA(e.background.color):null}fontString(e){const i=this.definition.font,r="sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji";return`${i.style} ${i.weight} ${e}px ${i.family}, ${r}`}setFontProperties(e,i){e.font=this.fontString(i),e.textAlign="left",e.textBaseline="alphabetic"}_colorToRGB(e){return`rgb(${e.slice(0,3).map(i=>Math.floor(255*i)).toString()})`}_colorToRGBA(e){return`rgba(${e.slice(0,3).map(i=>Math.floor(255*i)).toString()},${e[3]})`}static async fromSymbol(e,i){var T,A,M,I,L;const r=(T=e==null?void 0:e.material)==null?void 0:T.color,n=qe.toUnitRGBA(r)??gp,s=e.size!=null?Tr(e.size):12,o=e.lineHeight,l=e.background!=null?qe.toUnitRGBA(e.background.color):gp,c={family:((A=e.font)==null?void 0:A.family)??"sans-serif",decoration:((M=e.font)==null?void 0:M.decoration)??"none",weight:((I=e.font)==null?void 0:I.weight)??"normal",style:((L=e.font)==null?void 0:L.style)??"normal"},f=e.halo,_=(f==null?void 0:f.color)!=null&&f.size>0?{size:Tr(f.size),color:qe.toUnitRGBA(f.color)}:{size:0,color:gp},x=new N7e({color:n,size:s,background:{color:l,padding:e.background!=null?[.65*s,.5*s]:[0,0],borderRadius:e.background!=null?s*(6/16):0},lineSpacingFactor:o,font:c,halo:_,pixelRatio:i});if(e.font){let F=!1;const z=x.fontString(s);try{F=(await document.fonts.load(z)).some(k=>!eRt(k))}catch{Ce.getLogger("esri.views.3d.webgl-engine.lib.TextRenderParameters").warnOnce(`Failed to preload font '${z}'. Some text symbology may be rendered using the default browser font.`)}if(!F&&!sRt.has(e.font.family))try{await QPt(e.font)}catch{}}return x}};const sRt=new Set(["Arial","Times New Roman","Courier New","serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]),Eb=4096;let iT=class extends ze{constructor(e){super(e),this.type=Ws.Texture,this.id=hp(),this.events=new Dn,this._glTexture=null,this._atlas=new lRt(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._stageObjects=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view._stage,this._stage.add(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._glTexture=Kt(this._glTexture),this.updating=!1,this.events.emit("unloaded")}get glTexture(){return this._glTexture}static get maxSize(){return L$=0,[Eb-Cb-L$,Eb-Cb-L$-kve]}load(e){if(this._glTexture)return this._glTexture;const i=new tn;return i.wrapMode=Bi.CLAMP_TO_EDGE,i.samplingMode=ki.LINEAR_MIPMAP_LINEAR,i.hasMipmap=!0,i.preMultiplyAlpha=!0,i.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._glTexture=new Ai(e,i,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(ni.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._glTexture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=en(this._frameWorker),this._glTexture&&(this._stage.remove(this),this._glTexture=Kt(this._glTexture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.setAttribute("width",e.width.toString()),this._canvas.setAttribute("height",e.height.toString())}_resizeAtlas(e,i){var s,o;const{width:r,height:n}=this._atlas;r===e&&n===i||(this._atlas.width=e,this._atlas.height=i,(s=this._glTexture)==null||s.resize(e,i),(o=this._glTexture)==null||o.updateData(0,0,0,r,n,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach(l=>{const c=this._stageObjects.get(l.textRenderer.key);c==null||c.forEach(f=>lY(f,l))}),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,i,r,n){const s=this._atlas;if(s.widths.width>=c.x+r);if(l==null){if(s.heightr.height)this._resizeAtlas(r.width,f);else if(r.widthlY(n,e))}get running(){return this.updating}runTask(e){if(this._glTexture==null)return Xl.YIELD;for(;this._needsRepack&&(this._canRepack||this._atlas.heightthis._processAddition(r)),e.madeProgress()}if(this._elementsToRender.size>0){for(const[i,r]of this._elementsToRender){if(e.done)break;this._renderElement(r),this._elementsToRender.delete(i),e.madeProgress()}this._glTexture.setData(this._canvas)}this.updating=this._elementsToRender.size>0}addTextTexture(e,i){const r=e.key;this._addStageObject(r,i);let n=this._elements.get(r);n==null&&(n=new aRt(this._atlas,e),this._processAddition(n),this.setDirty()),oRt(i,n),lY(i,n)}removeTextTexture(e,i){const r=e.key;if(!this._elements.get(r))return;this._removeStageObject(r,i);const n=this._stageObjects.get(r);n&&n.size!==0||this._elements.delete(r),(n==null?void 0:n.size)===0&&this._stageObjects.delete(r),this._canRepack=!0}setDirty(){this._glTexture&&(this.updating=!0)}get test(){const{_elements:e,_stageObjects:i,_atlas:r}=this,n=this;return{elements:e,stageObjects:i,atlas:r,resizeAtlas:(s,o)=>n._resizeAtlas(s,o),run:s=>n.runTask(s)}}};function oRt(t,e){t.geometries[0].setAttributeData(J.SIZE,[e.textRenderer.displayWidth,e.textRenderer.displayHeight]),t.geometryVertexAttributeUpdated(t.geometries[0],J.SIZE)}function lY(t,e){t.geometries[0].setAttributeData(J.UV0,e.uv),t.geometryVertexAttributeUpdated(t.geometries[0],J.UV0,!0)}y([w({constructOnly:!0})],iT.prototype,"view",void 0),y([w({type:Boolean})],iT.prototype,"updating",void 0),iT=y([Z("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],iT);const Cb=2,kve=2;let aRt=class{constructor(e,i){this._atlas=e,this.textRenderer=i,this._uv=Xi(),this._newPosition=[0,0]}get uv(){if(this._xOffset==null||this._yOffset==null)return gp;const{renderedWidth:e,renderedHeight:i}=this.textRenderer;return rs(this._uv,this._xOffset/this._atlas.width,(this._yOffset+i)/this._atlas.height,(this._xOffset+e)/this._atlas.width,this._yOffset/this._atlas.height)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}},lRt=class{constructor(e,i){this.width=e,this.height=i,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=L$}},zve=class{constructor(e){this.y=e,this.x=L$}},L$=0,cRt=class{constructor(e,i,r){this._renderer=new u8e(e,i,r,iT.maxSize)}get key(){return this._renderer.key}get baselineAnchorY(){return 1-this._renderer.firstRenderedBaselinePosition/this._renderer.renderedHeight}get displayWidth(){return this._renderer.displayWidth}get displayHeight(){return this._renderer.displayHeight}create(){const e=KU(uRt,this._renderer.renderedWidth,this._renderer.renderedHeight),i=e.getContext("2d");return i.save(),this._renderer.render(i,0,0),i.restore(),new OE(e,{wrap:{s:Bi.CLAMP_TO_EDGE,t:Bi.CLAMP_TO_EDGE},noUnpackFlip:!1,mipmap:!0,preMultiplyAlpha:!0})}};const uRt={canvas:null},hRt=[0,0,1];let dRt=class extends p1{constructor(e,i,r,n){super(e,i,r,n),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const e=iG(this.symbolLayer.size);if(e)throw new se("graphics3dtextsymbollayer:invalid-size",e)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await D7e.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const i=e.graphic,r=UL(i.geometry);if(r==null)return this.logger.warn(`unsupported geometry type for text symbol: ${i.geometry.type}`),null;const n=this.symbolLayer.text;if(n==null||n==="")return null;const s=Vse(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(s!=null&&!cOe(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:o}=this.symbolLayer,l=new I7e(s);IAt(o,l.screenOffset);const c=new $7e(l,this.symbolLayer.horizontalAlignment,RAt(o));return this._createAs3DShape(i,r,n,c)}createLabel(e,i,r,n,s){const o=e.graphic,l=UL(o.geometry);if(l==null)return this.logger.warn(`unsupported geometry type for label: ${o.geometry.type}`),null;const c=i.text;return!c||/^\s+$/.test(c)?null:this._createAs3DShape(o,l,c,i,r,n,s)}setGraphicElevationContext(e,i,r=0){return super.setGraphicElevationContext(e,i),i.addOffsetRenderUnits(r),i}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,i){return Uve(e,i,(r,n)=>{this.updateGraphicElevationContext(n,r)}),Ys.UPDATE}slicePlaneEnabledChanged(e,i){return Uve(e,i,r=>{for(const n of r.stageObject.geometries)n.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}updateGraphicElevationContext(e,i){const r=i.elevationContext;this.setGraphicElevationContext(e,r,i.metadata!=null?i.metadata.elevationOffset:0),i.needsElevationUpdates=t0(r.mode)||r.mode==="absolute-height"}_defaultElevationInfoNoZ(){return fRt}_createAs3DShape(e,i,r,n,s=null,o=null,l=()=>n.placement.elevationOffset){var ne;const c=this.setGraphicElevationContext(e,new VU,n.placement.elevationOffset),f=((ne=e.geometry)==null?void 0:ne.type)==="polyline",_=e.uid;let x=null,T=null;if(o==null){const re=d8e(n.horizontalPlacement);x=new cRt(r,re,this._textRenderParameters);let he=null;if(this._context.sharedResources.textures!=null){T=this._context.sharedResources.textures.fromData(x.key,()=>x.create()),T.texture.events.on("unloaded",()=>he==null?void 0:he.release());const ce=this._context.stage.renderView.textureRepository.acquire(T.texture.id);if(ce==null||pd(ce))return T.release(),null;he=ce}}const A=pRt(x,n),M={occlusionTest:!0,screenOffset:n.placement.screenOffset,anchorPosition:A,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:n.placement.centerOffsetUnits,drawInSecondSlot:!0};if(o?M.textureId=o.id:T&&(M.textureId=T.texture.id),n.placement.verticalOffset!=null){const{screenLength:re,minWorldLength:he,maxWorldLength:ce}=n.placement.verticalOffset;M.verticalOffset={screenLength:Tr(re),minWorldLength:he||0,maxWorldLength:ce??1/0}}if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:re,screenSizePerspectiveSettingsLabels:he}=this._context.sharedResources,ce=c8e(this._textRenderParameters);M.screenSizePerspective=he.overrideFontHeight(ce.maxHeight),M.screenSizePerspectiveAlignment=re}f&&(M.shaderPolygonOffset=1e-4),M.hasSlicePlane=this._context.slicePlaneEnabled;const I=(re,he)=>{const ce=JSON.stringify(he);let be=re.get(ce);return be==null&&(be=new O5(he),re.add(ce,be)),be},L=s?I(s,M):new O5(M),F=n.placement.translation,z=x?Ji(x.displayWidth,x.displayHeight):Wy,k=n.placement.centerOffset,U=Rte(L,hRt,F,null,z,k,[0,0],null),j=$le(this._context,i,U,c,_);if(j==null)return null;const H=(re,he,ce,be,ye,pe)=>{const Ee=l()||n.placement.elevationOffset,te=this.setGraphicElevationContext(e,he,Ee);return _T(re,te,ce,be,ye,pe)},Y=new d1(this,j.object,[U],s==null?[L]:null,T,H,c);Y.alignedSampledElevation=j.sampledElevation,Y.needsElevationUpdates=t0(c.mode)||c.mode==="absolute-height",Y.getScreenSize=(re=yt())=>(re[0]=x?x.displayWidth:n.displaySize[0],re[1]=x?x.displayHeight:n.displaySize[1],re);const Q=new D6e(n.placement.elevationOffset,r);return Y.metadata=Q,zL(Y,i,this._context.elevationProvider),Y}};function Uve(t,e,i){t&&t.forEach(r=>{const n=e(r);n!=null&&i(n,r.graphic)})}function pRt(t,e){if(e.verticalPlacement==="baseline"){const r=MAt[e.horizontalPlacement],n=t!=null?t.baselineAnchorY:0;return Ji(r,n)}const i=PAt(e.horizontalPlacement,e.verticalPlacement);return nk[i]}const fRt={mode:"relative-to-ground",offset:0},mRt={"calm-small":{waveStrength:.005,perturbationStrength:.02,textureRepeat:12,waveVelocity:.01},"rippled-small":{waveStrength:.02,perturbationStrength:.09,textureRepeat:32,waveVelocity:.07},"slight-small":{waveStrength:.05,perturbationStrength:.07,textureRepeat:28,waveVelocity:.1},"moderate-small":{waveStrength:.075,perturbationStrength:.07,textureRepeat:24,waveVelocity:.1},"calm-medium":{waveStrength:.003125,perturbationStrength:.01,textureRepeat:8,waveVelocity:.02},"rippled-medium":{waveStrength:.035,perturbationStrength:.015,textureRepeat:12,waveVelocity:.07},"slight-medium":{waveStrength:.06,perturbationStrength:.015,textureRepeat:8,waveVelocity:.12},"moderate-medium":{waveStrength:.09,perturbationStrength:.03,textureRepeat:4,waveVelocity:.12},"calm-large":{waveStrength:.01,perturbationStrength:0,textureRepeat:4,waveVelocity:.05},"rippled-large":{waveStrength:.025,perturbationStrength:.01,textureRepeat:8,waveVelocity:.11},"slight-large":{waveStrength:.06,perturbationStrength:.02,textureRepeat:3,waveVelocity:.13},"moderate-large":{waveStrength:.14,perturbationStrength:.03,textureRepeat:2,waveVelocity:.15}},gRt=["polyline","polygon","extent"];let Mie=class Q3 extends p1{constructor(e,i,r,n){super(e,i,r,n)}async doLoad(){}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,gRt,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(i);return this.ensureDrapedStatus(r.mode==="on-the-ground"),this.ensureMaterial(),this.draped?this._createAsOverlay(i):this._createAs3DShape(i,r,i.uid)}ensureMaterial(){if(this._materials[0])return;const e=new BNe,i=this.symbolLayer.color;i!=null&&(e.color=qe.toUnitRGBA(i));const r=this._getCombinedOpacity(i,{hasIntrinsicColor:!0});e.color=[e.color[0],e.color[1],e.color[2],r],e.transparent=r<1||this.needsDrivenTransparentPass,e.waveDirection=this.symbolLayer.waveDirection!=null?Q3.headingVectorFromAngle(this.symbolLayer.waveDirection):Ji(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=mRt[n];e.waveStrength=s.waveStrength,e.waveTextureRepeat=s.textureRepeat,e.waveVelocity=s.waveVelocity,e.flowStrength=s.perturbationStrength,e.hasSlicePlane=this._context.slicePlaneEnabled,e.isDraped=this.draped,this._materials[0]=new VNe(e),this._context.stage.add(this._materials[0])}layerOpacityChanged(){if(this._materials[0]==null)return;const e=this._materials[0].parameters.color,i=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=i<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],i],transparent:r})}layerElevationInfoChanged(e,i,r){const n=this._elevationContext.mode,s=i6(Q3.elevationModeChangeTypes,r,n);if(s!==Ys.UPDATE)return s;const o=t0(n);return this.updateGraphics3DGraphicElevationInfo(e,i,()=>o)}slicePlaneEnabledChanged(){var e;return(e=this._materials[0])==null||e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,i,r){var x;const n=VL(e.geometry);if(n==null)return null;const s=ice(n,this._context.elevationProvider,this._context.renderCoordsHelper,i),o=s.position.length/3,l=Ja(2*o);this._createUVCoordsFromVertices(l,s.mapPositions,o,this._context.elevationProvider.spatialReference);const c=new yRt(s,l,this._context.layer.uid,e.uid);if(c.objectAndLayerIdColor=(x=this._context.stage.renderView)==null?void 0:x.getObjectAndLayerIdColor(c),this._create3DShapeGeometries(c),this._logGeometryCreationWarnings(c.renderData,n.rings,"rings","WaterSymbol3DLayer"),c.outGeometries.length===0)return null;const f=new X_({geometries:c.outGeometries,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:r}),_=new d1(this,f,c.outGeometries,null,null,M6e,i);return _.alignedSampledElevation=c.renderData.sampledElevation,_.needsElevationUpdates=t0(i.mode),_}_createUVCoordsFromVertices(e,i,r,n){const s=ws(n);od(Ab);for(let c=0;cthis._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}};Mie.unitSizeOfTexture=100,Mie.elevationModeChangeTypes={definedChanged:Ys.RECREATE,staysOnTheGround:Ys.NONE,onTheGroundChanged:Ys.RECREATE};const e8=yt(),Ab=Ni(),Vve=yt(),Wx=ya();let yRt=class extends pG{constructor(e,i,r,n){super(e,r,n),this.uvCoords=i}},vRt=class extends pG{constructor(e,i,r,n){super(e,r,n),this.uvCoords=i}};function _Rt(t,e,i,r){var s;const n=((s=wRt[t.type])==null?void 0:s[e.type])||bRt[e.type];return n?new n(t,e,i,r):(Ce.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayerFactory").error("GraphicsLayerFactory#make",`unknown symbol type ${e.type}`),null)}const bRt={icon:_ie,object:E5t,line:b8e,path:CPt,fill:P7e,extrude:$Ct,text:dRt,water:Mie},wRt={"mesh-3d":{fill:eOt}};let xRt=class extends Ile{set symbol(e){this._symbol=e,e.symbolLayers.forEach((i,r)=>{const n=this.symbolLayers[r];n!=null&&(n.symbol=e,n.symbolLayer=i)})}get symbol(){return this._symbol}constructor(e,i,r){super(i.schedule),this._symbol=e,this._context=i,this._backgroundLayers=r,this._destroyed=!1,this.symbolLayers=new Array,this.referenced=0,this._extentPadding=0}async doLoad(e){let i=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(i=this._backgroundLayers.concat(i));const r=i.length;for(;this.symbolLayers.length{this.symbolLayers[s]=null,l.destroy()});c&&n.push(c),this.symbolLayers[s]=l}if(await JV(this.symbolLayers,async(s,o)=>{if(s!=null)try{await s.load(),this._extentPadding+=Math.max(this._extentPadding,s.extentPadding)}catch{this.symbolLayers[o]=null}}),n.forEach(s=>s.remove()),St(e),this.symbolLayers.length&&!this.symbolLayers.some(s=>!!s))throw new Error}getSymbolLayerSize(e){const i=this.symbolLayers[e];return i!=null?i.getCachedSize():null}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some(e=>e==null?void 0:e.queryForSnapping)}createGraphics3DGraphic(e,i){var o,l;const r=e.graphic,n=this.symbolLayers.map(c=>(c==null?void 0:c.createGraphics3DGraphic(e))??null),s=this._context.arcade||((l=(o=this._context.featureExpressionInfoContext)==null?void 0:o.arcade)==null?void 0:l.modules)||null;return new QSt(r,i||this,n,e.layer,s)}get complexity(){return Rle(this.symbolLayers.map(e=>e!=null?e.complexity:null))}globalPropertyChanged(e,i){const r=this.symbolLayers.length;for(let n=0;n{const c=l.layers[n];return c instanceof d1?c:null};if(s!=null&&!s.globalPropertyChanged(e,i,o))return!1}return!0}applyRendererDiff(e,i){return this.loadStatus!==ep.LOADED?To.RecreateSymbol:this.symbolLayers.reduce((r,n)=>r!==To.RecreateSymbol&&n!=null?Math.min(r,n.applyRendererDiff(e,i)):r,To.FastUpdate)}prepareSymbolPatch(e){if(this.loadStatus===ep.FAILED||e.diff.type!=="partial")return;const i=e.diff.diff;if(!i.symbolLayers||i.symbolLayers.type!=="partial")return;const r=i.symbolLayers.diff;this.symbolLayers.forEach((n,s)=>{if(n==null)return;const o=r[s];if(o){const l={diff:o,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};n.prepareSymbolLayerPatch(l),e.symbolStatePatches.push(...l.symbolLayerStatePatches),l.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push((c,f)=>{const _=c.layers[s];_!=null&&l.graphics3DGraphicPatches.forEach(x=>x(_,f))})}})}updateGeometry(e,i){return this._updateGeometryOrTransform(e,(r,n)=>r.updateGeometry(n,i))}updateTransform(e,i,r,n){return this._updateGeometryOrTransform(e,(s,o)=>s.updateTransform(o,i,r,n))}_updateGeometryOrTransform(e,i){for(let r=0;r{n!=null&&(n.loadStatus===ep.LOADING?e++:n.isFastUpdatesEnabled()?r++:i++)}),{loading:e,slow:i,fast:r}}async queryForSnapping(e,i,r,n){const s=this.symbolLayers.filter(ys).filter(l=>l.queryForSnapping!=null).map(l=>l.queryForSnapping(e,i,r,n)),o=await Promise.all(s);return St(n),o.flat()}destroy(){if(this.destroyed)console.error("Graphics3DSymbol.destroy called when already destroyed!");else{super.destroy();for(const e of this.symbolLayers)e!=null&&e.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}};const t8=new eTt;let SRt=class extends Ile{constructor(e,i,r){super(i),this.symbol=e,this._convert=r,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(e){return this.graphics3DSymbol!=null?this.graphics3DSymbol.getSymbolLayerSize(e):null}get symbolLayers(){return this.graphics3DSymbol!=null?this.graphics3DSymbol.symbolLayers:[]}get extentPadding(){return this.graphics3DSymbol!=null?this.graphics3DSymbol.extentPadding:0}async doLoad(e){const i=await this.symbol.fetchSymbol({signal:e});i.id=this.symbol.id,this.graphics3DSymbol=this._convert(i),this.graphics3DSymbol!=null&&await this.graphics3DSymbol.load()}createGraphics3DGraphic(e){return this.graphics3DSymbol!=null?this.graphics3DSymbol.createGraphics3DGraphic(e,this):null}get complexity(){return this.graphics3DSymbol!=null?this.graphics3DSymbol.complexity:yDe}globalPropertyChanged(e,i){return this.graphics3DSymbol!=null&&this.graphics3DSymbol.globalPropertyChanged(e,i)}applyRendererDiff(e,i){return this.graphics3DSymbol!=null?this.graphics3DSymbol.applyRendererDiff(e,i):To.RecreateSymbol}prepareSymbolPatch(e){this.graphics3DSymbol!=null&&this.graphics3DSymbol.prepareSymbolPatch(e)}updateGeometry(e,i){return this.graphics3DSymbol!=null&&this.graphics3DSymbol.updateGeometry(e,i)}updateTransform(e,i,r,n){var s;return((s=this.graphics3DSymbol)==null?void 0:s.updateTransform(e,i,r,n))??!1}onRemoveGraphic(){}getFastUpdateStatus(){return this.graphics3DSymbol!=null?this.graphics3DSymbol.getFastUpdateStatus():{loading:1,fast:0,slow:0}}destroy(){this.graphics3DSymbol!=null&&this.graphics3DSymbol.destroy(),this.graphics3DSymbol=void 0,super.destroy()}get destroyed(){return this.graphics3DSymbol===void 0}};function gce(t){return t instanceof SRt?t.graphics3DSymbol:t instanceof xRt?t:null}const YL=Ce.getLogger("esri.views.3d.layers.graphics.labelPlacement");let TRt=class{constructor(e,i,r,n=null){this.graphics3DGraphic=e,this.labelSymbol=i,this.labelClass=r,this.disablePlacement=n}};function Bve(t){const e=$Rt(t);if(e==null)return null;const i=ERt(t,e);if(i==null)return null;const r=i.anchor,n=!!e.hasLabelVerticalOffset,s=e.verticalOffset;return ARt(new I7e(s,r,n),i,t)}function ERt(t,e){if(e.anchor)return e;const i=t.labelClass.labelPlacement,r=bm[i],n=r||nV(t);return i&&!r&&YL.warnOncePerTick(`the requested label placement '${i}' is currently unsupported in SceneView.`),CRt(n,t)}function yce(t){const e=t.graphics3DGraphic.graphics3DSymbol,i=gce(e);return i!=null?i.symbol.symbolLayers.at(0):null}function CRt(t,e){const i=e.graphics3DGraphic.graphic.geometry;if(i==null)return null;if(e.disablePlacement!=null)return e.labelClass.labelPlacement?(YL.warnOncePerTick(jve(t==null?void 0:t.placement,e.disablePlacement.logEntityDescription)),nV(e)):t;const r=i.type;switch(r){case"polyline":case"polygon":case"extent":case"multipoint":if(e.labelClass.labelPlacement)return YL.warnOncePerTick(jve(t==null?void 0:t.placement,`'${r}' geometries`)),nV(e);break;case"point":case"mesh":return t}return t}function jve(t,e){return`the requested label placement '${t}' is currently unsupported for ${e} in SceneView.`}function nV(t){const e=t.graphics3DGraphic.graphic.geometry;if(e==null)return null;switch(e.type){case"polyline":case"extent":case"multipoint":return{placement:"center-center",normalizedOffset:Ka,anchor:"center"};case"polygon":{const i=yce(t);return i!=null&&i.type==="extrude"?bm["above-center"]:{placement:"center-center",normalizedOffset:Ka,anchor:"center"}}case"point":case"mesh":return bm["above-center"];default:return}}function ARt(t,e,i){const r=i.graphics3DGraphic.graphic.geometry;if(r==null)return null;switch(r.type){case"point":ORt(t,e,i);break;case"polygon":MRt(t,e,i);break;case"mesh":vce(t,e,i.graphics3DGraphic.layers[0])}const n=xAt-QU;return t.screenOffset[0]+=n*e.normalizedOffset[0],t.screenOffset[1]+=n*e.normalizedOffset[1],t}function MRt(t,e,i){const r=yce(i);if(r!=null)switch(r.type){case"extrude":{const n=i.graphics3DGraphic.layers[0];n!=null?(n.getBoundingBoxObjectSpace(D$),gm(D$,t.translation),t.translation[2]=sx(D$)/2):Ie(t.translation,0,0,0),vce(t,e,n);break}}}function ORt(t,e,i){const r=yce(i);if(r==null)return;const n=i.graphics3DGraphic.layers[0];switch(n!=null?n.getCenterObjectSpace(t.translation):Ie(t.translation,0,0,0),r.type){case"icon":case"text":PRt(t,e,i,n);break;case"object":vce(t,e,n)}}function PRt(t,e,i,r){const{graphics3DGraphic:n}=i,s=r!=null?r.getScreenSize():null;if(n.isDraped||s==null)t.hasLabelVerticalOffset||t.anchor==="center"||(bm[i.labelClass.labelPlacement]&&YL.warnOncePerTick(`the requested placement '${e.placement}' is currently unsupported for draped graphics`),t.anchor="center");else{const o=RRt(i);t.screenOffset[0]=s[0]/2*(e.normalizedOffset[0]-o[0]);const l=s[1]/2*(e.normalizedOffset[1]-o[1]);t.hasLabelVerticalOffset?(t.centerOffset[1]=l,t.centerOffsetUnits="screen"):t.screenOffset[1]=l}}function RRt(t,e=LRt){const{graphics3DGraphic:i}=t,r=i.layers[0],n=(r==null?void 0:r.stageObject.geometries[0].material)??null;if(n&&n instanceof O5){const s=n.parameters.anchorPosition;e[0]=2*(s[0]-.5),e[1]=2*(s[1]-.5)}else e[0]=0,e[1]=0;return e}function vce(t,e,i){const r=i!=null?i.getBoundingBoxObjectSpace(D$):D$,n=nt(r[3]-r[0],r[4]-r[1],r[5]-r[2]),s=Math.sqrt(n[0]*n[0]+n[1]*n[1]);t.centerOffset[0]=s/2*e.normalizedOffset[0];const o=t.translation[2],l=n[2]/2*e.normalizedOffset[1];t.translation[2]=0,t.elevationOffset=o+l;const c=rt(n);t.centerOffset[2]=c/2*e.normalizedOffset[2]}function IRt(t){return t==="above-center"}function $Rt(t){const e=t.labelClass.labelPlacement,{labelSymbol:i,graphics3DGraphic:r}=t,n=gce(r.graphics3DSymbol),s=(n==null?void 0:n.symbol.type)==="point-3d"?n.symbol:null,o=bm[e]||nV(t);return s!=null&&s.supportsCallout()&&s.hasVisibleVerticalOffset()&&!r.isDraped?{placement:null,hasLabelVerticalOffset:!1,verticalOffset:Gve(s.verticalOffset),anchor:null,normalizedOffset:null}:!i||!i.hasVisibleVerticalOffset()||s!=null&&s.supportsCallout()&&s.verticalOffset&&!r.isDraped?{placement:null,verticalOffset:null,anchor:null,normalizedOffset:null,hasLabelVerticalOffset:!1}:o&&IRt(o.placement)?{placement:"above-center",verticalOffset:Gve(i.verticalOffset),anchor:"bottom",normalizedOffset:[0,o.normalizedOffset[1],0],hasLabelVerticalOffset:!0}:(YL.errorOncePerTick("Callouts and vertical offset on labels are currently only supported with 'above-center' label placement (not with "+e+" placement)"),null)}function Gve(t){const{screenLength:e,minWorldLength:i,maxWorldLength:r}=t;return{screenLength:e,minWorldLength:i,maxWorldLength:r}}const bm={"above-center":{placement:"above-center",normalizedOffset:[0,1,0],anchor:"bottom"},"above-left":{placement:"above-left",normalizedOffset:[-1,1,0],anchor:"bottom-right"},"above-right":{placement:"above-right",normalizedOffset:[1,1,0],anchor:"bottom-left"},"below-center":{placement:"below-center",normalizedOffset:[0,-1,2],anchor:"top"},"below-left":{placement:"below-left",normalizedOffset:[-1,-1,0],anchor:"top-right"},"below-right":{placement:"below-right",normalizedOffset:[1,-1,0],anchor:"top-left"},"center-center":{placement:"center-center",normalizedOffset:[0,0,1],anchor:"center"},"center-left":{placement:"center-left",normalizedOffset:[-1,0,0],anchor:"right"},"center-right":{placement:"center-right",normalizedOffset:[1,0,0],anchor:"left"}},Hve={"above-center":["default","esriServerPointLabelPlacementAboveCenter"],"above-left":["esriServerPointLabelPlacementAboveLeft"],"above-right":["esriServerPointLabelPlacementAboveRight"],"below-center":["esriServerPointLabelPlacementBelowCenter"],"below-left":["esriServerPointLabelPlacementBelowLeft"],"below-right":["esriServerPointLabelPlacementBelowRight"],"center-center":["esriServerPointLabelPlacementCenterCenter"],"center-left":["esriServerPointLabelPlacementCenterLeft"],"center-right":["esriServerPointLabelPlacementCenterRight"]};for(const t in Hve){const e=Hve[t],i=bm[t];e.forEach(r=>{bm[r]=i})}Object.freeze&&(Object.freeze(bm),Object.keys(bm).forEach(t=>{var e;Object.freeze(bm[t]),Object.freeze((e=bm[t])==null?void 0:e.normalizedOffset)}));const LRt=[0,0],D$=ya();let qve=class{constructor(e){this._stage=e,this._materials=new Map}get(e){return this._materials.get(e)}add(e,i){this._materials.set(e,i),this._stage.add(i)}dispose(){this._stage.removeMany(Array.from(this._materials.values())),this._materials.clear()}},Wve=class{constructor(e,i){this.labelingContext=e,this.graphics3DGraphic=i,this.hasGraphics3DResources=!1,this.visible=!1,this.addedToTextureAtlas=!1,this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}},DRt=class{constructor(e,i,r,n,s){this.labelClass=e,this.graphics3DSymbol=i,this.graphics3DCalloutSymbolLayer=r,this.textRenderParameters=n,this.labelFunction=s,this.calloutSymbolLayerIndex=0}},NRt=class{constructor(e,i,r,n,s,o,l,c){this.layer=i,this.graphics3DCore=r,this.scaleVisibility=n,this.emptySymbolLabelSupported=s,this.elevationInfoOverride=o,this.disablePlacement=l,this.active=c,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new uNe(e,{pickable:!0,disableOctree:!0},i.uid)}destroy(){this.stageLayer.destroy()}},eS=class extends ze{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([_e(()=>{var e;return(e=this.view.state)==null?void 0:e.camera},()=>this.setDirty()),_e(()=>{var e;return(e=this.view.state)==null?void 0:e.rasterPixelRatio},()=>this._resetAllLabels()),this.view.resourceController.scheduler.registerTask(ni.LABELER,this)]),this._textTextureAtlas=new iT({view:this.view}),this._hudMaterialCollection=new qve(this.view._stage),this._calloutMaterialCollection=new qve(this.view._stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=Kt(this._textTextureAtlas),this._hudMaterialCollection=Kt(this._hudMaterialCollection),this._calloutMaterialCollection=Kt(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),v0.graphic=null,v0.renderingInfo=null,v0.layer=null}_activateLabelingContext(e){e.graphics.forEach((i,r)=>{const n=new Wve(e,i);this._labels.set(r,n),e.labelsToInitialize.set(r,n),i.setVisibilityFlag(Ya.LABEL,Hl.USER,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((i,r)=>{i.setVisibilityFlag(Ya.LABEL,Hl.USER,!1),this.setLabelGraphicVisibility(i,!1),this._labels.delete(r)}),e.active=!1}_addLabelTextureToAtlas(e){for(const i of e.graphics3DGraphic.labelLayers){if(!i._labelClass)continue;const r=e.textRenderers[i._labelIndex];r&&(this._textTextureAtlas.addTextTexture(r,i.stageObject),e.addedToTextureAtlas=!0)}}_removeLabelTextureFromAtlas(e){for(const i of e.graphics3DGraphic.labelLayers){if(!i._labelClass)continue;const r=e.textRenderers[i._labelIndex];r!=null&&(this._textTextureAtlas.removeTextTexture(r,i.stageObject),e.addedToTextureAtlas=!1)}}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),Xl.YIELD}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const i of this._labelingContexts)if(i.active)if(cY(i))this._dirty=!0;else if(uY(i.labelClassContexts)){if(i.labelClassContexts===null){this._deactivateLabelingContext(i);continue}this._createLabelClassContext(i),this._dirty=!0}else rp(i.labelsToInitialize,(r,n)=>(this._ensureGraphics3DResources(r)&&(this._labels.set(n,r),this.deconflictor.setDirty(),e.madeProgress()),(r.visible&&r.textInitialized||!r.visible&&r.hasGraphics3DResources)&&(i.labelsToInitialize.delete(n),e.madeProgress()),e.done))&&(this._dirty=!0);this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){var o,l;const i=(o=e.labelClassAbortController)==null?void 0:o.signal;e.layer.when&&await e.layer.when(),St(i),e.scaleVisibility&&e.scaleVisibility.updateScaleRangeActive();const r=e.graphics3DCore,n=r.layer,s=(l=n.labelingInfo)==null?void 0:l.filter(c=>!!c.symbol);!s||s.length===0||(await JV(s,async(c,f)=>{const _=c.symbol,x=gce(r.getOrCreateGraphics3DSymbol(_));if(x==null)return void Ce.getLogger(this).error("Failed to create Graphics3DSymbol for label");await x.load(),St(i);let T=null;Vse(_)&&_.hasVisibleCallout()&&(T=_St(_,r.symbolCreationContext),await T.load(),St(i));const A=await Ju(T6e(c,e.layer.fieldsIndex,this.view.spatialReference));if(St(i),A.ok===!0){const M=await this._createTextRenderParameters(x.symbol);St(i),e.labelClassContexts[f]=new DRt(c,x,T,M,A.value)}else Ce.getLogger(this).error(`Label expression failed to evaluate: ${A.error}`)}),St(i))}async _createLabelClassContext(e){return e.labelClassPromise==null&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(i=>{if(sn(i))throw i;e.labelClassContexts.length=0}).then(()=>{e.labelClassAbortController=null,this.notifyChange("updating")}).catch(()=>{}),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const i=e.symbolLayers.at(0);return(i==null?void 0:i.type)!=="text"?null:D7e.fromSymbol(i,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const r of e.labelClassContexts)--r.graphics3DSymbol.referenced;const i=e.labelClassAbortController;e.labelClassAbortController=new AbortController,gn(i),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,i,r,n,s,o){const l=new $7e(r,Y1e(r.anchor),OAt(r.anchor),e.text,Ji(e.displayWidth,e.displayHeight));return v0.graphic=i,v0.renderingInfo=null,v0.layer=n,s.createLabel(v0,l,this._hudMaterialCollection,this._textTextureAtlas,()=>{const c=Bve(o);return c?c.elevationOffset:null})}_createLineCalloutGraphic(e,i,r,n,s){v0.graphic=e,v0.layer=s;const o=n.screenOffset[0];return v0.renderingInfo=new ySt(null,i,n.translation,n.centerOffset,o,n.centerOffsetUnits,n.elevationOffset,this._calloutMaterialCollection),r.createGraphics3DGraphic(v0)}_ensureGraphics3DResources(e){var f;if(e.hasGraphics3DResources)return!1;const i=e.graphics3DGraphic;if(i.destroyed)return!1;this._ensureTextTextureResources(e);const r=e.labelingContext,n=r.labelClassContexts;if(uY(n)||!r.emptySymbolLabelSupported&&i.layers.length===0)return!1;let s=!1;const o=i.graphic,l=r.layer,c=i8(r.layer);for(let _=0;_n.set(o.graphic.uid,o));const s=o=>o.labelLayers[0];if(r.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,n,s),r.graphics3DCalloutSymbolLayer){const o=l=>l.labelLayers[r.calloutSymbolLayerIndex];r.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,n,o)}}}_visibilityInfoChange(e){const i=i8(e.layer);i&&!e.active&&this._activateLabelingContext(e),!i&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((i,r)=>{const n=this._labels.get(r);n&&(this._destroyGraphic(n,r),n.visible=!1,e.labelsToInitialize.set(r,n))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const i of this._labelingContexts)if(i.graphics3DCore===e)return i;return null}addGraphicsOwner(e,i,r){const n=r&&r.emptySymbolLabelSupported||!1,s=(r==null?void 0:r.elevationInfoOverride)||null,o=(r==null?void 0:r.disablePlacement)||null;if(this._findLabelingContext(e))return;const l=e.layer,c=new NRt(this.view._stage,l,e,i,n,s,o,i8(l));return this._labelingContexts.push(c),this.setDirty(),{addGraphic:f=>this._addGraphic(c,f),removeGraphic:f=>this._removeGraphic(c,f),featureReductionChange:()=>{},layerLabelsEnabled:()=>i8(c.layer),labelingInfoChange:f=>this._labelingInfoChange(c,f),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",c),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",c),visibilityInfoChange:()=>this._visibilityInfoChange(c),reset:()=>this._resetLabels(c),clear:()=>{}}}removeGraphicsOwner(e){const i=this._findLabelingContext(e);if(!i)return;const r=this._labelingContexts.indexOf(i);this._labelingContexts.splice(r,1),i.graphics.forEach(n=>this._removeGraphic(i,n)),i.destroy(),this.setDirty()}setLabelGraphicVisibility(e,i){const r=e.graphic.uid,n=this._labels.get(r);n&&n.visible!==i&&(i&&!n.addedToTextureAtlas?(this._addLabelTextureToAtlas(n),n.textInitialized||n.labelingContext.labelsToInitialize.set(r,n)):!i&&n.addedToTextureAtlas&&this._removeLabelTextureFromAtlas(n),n.visible=i,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){var e;return this._dirty||((e=this._textTextureAtlas)==null?void 0:e.updating)||this.deconflictor.updating||this._labelingContexts.some(i=>cY(i))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce((i,r)=>i+(cY(r)?0:1),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){return{textTextureAtlas:this._textTextureAtlas,resetAllLabels:()=>this._resetAllLabels()}}};function cY(t){return!!t.labelClassPromise&&!!t.labelClassAbortController}function uY(t){return!t||t.length===0}function i8(t){var e;return t.labelsVisible===!0&&!!((e=t.labelingInfo)!=null&&e.some(i=>!!i.symbol))}y([w({constructOnly:!0})],eS.prototype,"view",void 0),y([w({constructOnly:!0})],eS.prototype,"deconflictor",void 0),y([w()],eS.prototype,"_textTextureAtlas",void 0),y([w({type:Boolean,readOnly:!0})],eS.prototype,"updating",null),eS=y([Z("esri.views.3d.layers.graphics.Labeler")],eS);const v0=new vSt(null,null,null);let gI=class XA{constructor(e,i,r,n=null){this.lij=[0,0,0],this.extent=Ni(),this.resolution=0,this.loadPriority=0,this.measures={visibility:fc.VISIBLE_ON_SURFACE,screenRect:Ni(),distance:0,shouldSplit:!1},this.used=!1,n&&this.acquire(e,i,r,n)}acquire(e,i,r,n){this.tilingScheme=n,this.id=XA.id(e,i,r),this.lij[0]=e,this.lij[1]=i,this.lij[2]=r,n.getExtent(e,i,r,this.extent),this.resolution=n.resolutionAtLevel(e)}release(){this.tilingScheme=null}getChildren(e){const i=this.lij[0]+1,r=2*this.lij[1],n=2*this.lij[2];return e?(e[0].acquire(i,r,n,this.tilingScheme),e[1].acquire(i,r+1,n,this.tilingScheme),e[2].acquire(i,r,n+1,this.tilingScheme),e[3].acquire(i,r+1,n+1,this.tilingScheme),e):[new XA(i,r,n,this.tilingScheme),new XA(i,r+1,n,this.tilingScheme),new XA(i,r,n+1,this.tilingScheme),new XA(i,r+1,n+1,this.tilingScheme)]}copyMeasurementsFrom(e){this.measures.visibility=e.measures.visibility,this.measures.shouldSplit=e.measures.shouldSplit,this.measures.distance=e.measures.distance,d_(e.measures.screenRect,this.measures.screenRect)}static id(e,i,r){return`${e}/${i}/${r}`}};var fc;(function(t){t[t.INVISIBLE=0]="INVISIBLE",t[t.VISIBLE_WHEN_EXTENDED=1]="VISIBLE_WHEN_EXTENDED",t[t.VISIBLE_ON_SURFACE=2]="VISIBLE_ON_SURFACE"})(fc||(fc={}));const F7e=.5*Math.PI,FRt=F7e/Math.PI*180;let kRt=class{constructor(e){this._renderCoordsHelper=e.renderCoordsHelper,this._extent=new Array(4),this._planes=new Array(6),this._maxSpan=0,this._center={origin:W(),direction:W()};for(let i=0;i<4;i++)this._extent[i]={origin:W(),direction:W(),cap:{next:null,direction:W()}},this._planes[i]=Fi();this._planes[Rn.NEAR]=Fi(),this._planes[Rn.FAR]=Fi(),this._planesWithoutFar=this._planes.slice(0,5)}update(e,i,r,n=!0){const s=this._extent;this._toRenderBoundingExtent(e,i,r),Be(this._center.origin,s[0].origin,s[2].origin),De(this._center.origin,this._center.origin,.5),this._renderCoordsHelper.worldUpAtPosition(this._center.origin,this._center.direction),n||De(this._center.direction,this._center.direction,-1);for(let o=0;o<4;o++){const l=s[o];this._renderCoordsHelper.worldUpAtPosition(l.origin,l.direction);const c=s[o===3?0:o+1];l.cap.next=c.origin,R_(l.cap.direction,l.origin,c.origin),xL(l.direction,l.cap.direction,l.origin,this._planes[o]),n||De(l.direction,l.direction,-1)}xL(s[0].cap.direction,s[1].cap.direction,s[0].origin,this._planes[Rn.NEAR]),n?SQ(this._planes[Rn.NEAR],this._planes[Rn.FAR]):(uj(this._planes[Rn.FAR],this._planes[Rn.NEAR]),SQ(this._planes[Rn.NEAR],this._planes[Rn.NEAR])),this._maxSpan=Math.max(Math.abs(e[0]-e[2]),Math.abs(e[1]-e[3])),this._maxSpanSpatialReference=i,this._minGlobalAltitude=.9*Sr(this._maxSpanSpatialReference).radius}isVisibleInFrustum(e,i,r=!1){if(e==null)return!1;if(this._renderCoordsHelper.viewingMode===_t.Global){const s=this._maxSpanSpatialReference.isGeographic?FRt:F7e*i;if(this._maxSpan>s)return!0;if(e.altitude!=null&&e.altitude>=this._minGlobalAltitude)return this._isVisibleInFrustumGlobal(e)}if(this._maxSpan===0){const s=this._extent[0];return!(r||!e.intersectsRay(Sp(s.origin,s.direction)))}for(let s=0;si,this._frustum.update(e),this._shortenFrustumFarPlane(this._frustum),this._updateExtendedFrustum(e)}end(){this._cache.clear()}calculate(e){if(this._allTilesInvisible)return fc.INVISIBLE;const i=this._renderCoordsHelper.viewingMode===_t.Global&&e.lij[0]>=BRt&&e.lij[0](Math.PI+e.fovY)/2,this._allTilesInvisible||(this._hasExtendedFrustum=r>e.fovY/2,!this._hasExtendedFrustum))return;const n=this._extendedFrustumParameters(),s=this._extendedFrustum.mutablePoints;for(let o=0;o<4;o++){const l=n.pointIndices[o],c=s[l],f=this._renderCoordsHelper.getAltitude(c);if(n.needsAltitudeAdjustment(f)){switch(this._renderCoordsHelper.worldUpAtPosition(c,Td),l){case Gt.FAR_BOTTOM_LEFT:case Gt.FAR_TOP_LEFT:case Gt.NEAR_BOTTOM_LEFT:case Gt.NEAR_TOP_LEFT:TQ(this._extendedFrustum.planes[Rn.LEFT],Td,Td);break;case Gt.FAR_BOTTOM_RIGHT:case Gt.FAR_TOP_RIGHT:case Gt.NEAR_BOTTOM_RIGHT:case Gt.NEAR_TOP_RIGHT:TQ(this._extendedFrustum.planes[Rn.RIGHT],Td,Td)}De(Td,Td,n.direction),this._renderCoordsHelper.intersectInfiniteManifold(Sp(c,Td),n.zWithMargin,c)}}if(this._extendedFrustum.updatePoints(s),jl(s[Gt.NEAR_BOTTOM_LEFT],s[Gt.NEAR_BOTTOM_RIGHT],s[Gt.NEAR_TOP_RIGHT],Zve),jl(s[Gt.NEAR_BOTTOM_RIGHT],s[Gt.NEAR_TOP_RIGHT],s[Gt.NEAR_TOP_LEFT],Jve),Ve(Zve,Jve)<0){const o=this._extendedFrustum.mutablePoints;this._aboveGround?[o[Gt.NEAR_BOTTOM_LEFT],o[Gt.NEAR_BOTTOM_RIGHT]]=[o[Gt.NEAR_BOTTOM_RIGHT],o[Gt.NEAR_BOTTOM_LEFT]]:[o[Gt.NEAR_TOP_LEFT],o[Gt.NEAR_TOP_RIGHT]]=[o[Gt.NEAR_TOP_RIGHT],o[Gt.NEAR_TOP_LEFT]],this._extendedFrustum.updatePoints(o)}}_extendedFrustumParameters(){return this._aboveGround?this._extendedFrustumParametersAboveSurface():this._extendedFrustumParametersBelowSurface()}_extendedFrustumParametersAboveSurface(){const e=this._surfaceElevation-Xve;return{zWithMargin:e,pointIndices:qw.planePointIndices.bottom,direction:-1,needsAltitudeAdjustment:i=>i>e}}_extendedFrustumParametersBelowSurface(){const e=this._surfaceElevation+Xve;return{zWithMargin:e,pointIndices:qw.planePointIndices.top,direction:1,needsAltitudeAdjustment:i=>i{t.length!==4&&(t[0]=new gI,t[1]=new gI,t[2]=new gI,t[3]=new gI)},t=>{t[0].release(),t[1].release(),t[2].release(),t[3].release()});let qRt=class{constructor(e){this._camera=new ai,this._focusOnMap=[0,0],this._screenRect=Ni(),this._tileSize=e.tileSize,this._renderCoordsHelper=e.renderCoordsHelper,this._tilingScheme=e.tilingScheme,this._visibility=new VRt(e.renderCoordsHelper)}begin(e,i,r){this._camera.copyFrom(e),this._surfaceElevation=r,this._focusOnMap[0]=i.x,this._focusOnMap[1]=i.y,ose(0,0,e.fullWidth,e.fullHeight,this._screenRect),this._visibility.begin(this._camera,r)}end(){this._visibility.end()}updateTile(e){e.measures.visibility=this._visibility.calculate(e),e.measures.distance=Eet(e.extent,this._focusOnMap),e.measures.visibility!==fc.INVISIBLE&&this._updateScreenMeasure(e)}_updateScreenMeasure(e){const i=WRt,r=1<_)return void(e.measures.shouldSplit=!0);e.measures.shouldSplit=!1}_tileSizeWithBias(e){return e.measures.visibility===fc.VISIBLE_WHEN_EXTENDED?this._tileSize*YRt:this._tileSize}_computeScreenArea(e,i,r,n,s){const o=e.measures.visibility===fc.VISIBLE_WHEN_EXTENDED;this._projectToScreen(i,r,n,o,Mb),od(dY);for(let l=0;l<4;l++)nO(dY,Mb[l]);return g2(s,dY,s),Zme(Mb[0],Mb[1],Mb[2])+Zme(Mb[0],Mb[2],Mb[3])}_projectToScreen(e,i,r,n,s){this._tilingScheme.ensureMaxLod(e),this._tilingScheme.getExtent(e,i,r,CR),this._toRenderCoords(CR,0,3,Ob[0]),this._toRenderCoords(CR,2,3,Ob[1]),this._toRenderCoords(CR,2,1,Ob[2]),this._toRenderCoords(CR,0,1,Ob[3]),n&&(this._projectToPlane(Ob,this._camera.frustum[Rn.NEAR]),this._projectToPlane(Ob,this._camera.frustum[Rn.TOP]),this._projectToPlane(Ob,this._camera.frustum[Rn.BOTTOM]));for(let o=0;o<4;o++)this._camera.projectToRenderScreen(Ob[o],Qve),this._camera.renderToScreen(Qve,s[o])}_projectToPlane(e,i){for(let n=0;n<4;n++)MR[n]=fn(i,e[n]);const r=Math.max(MR[0],MR[1],MR[2],MR[3]);if(r>0){const n=De(AR,i,-r);for(let s=0;s<4;s++)Be(e[s],e[s],n)}}_toRenderCoords(e,i,r,n){return AR[0]=e[i],AR[1]=e[r],AR[2]=this._surfaceElevation,this._renderCoordsHelper.toRenderCoords(AR,this._tilingScheme.spatialReference,n),n}};const dY=Ni(),WRt=2,YRt=5,Mb=[ss(),ss(),ss(),ss()],CR=Ni(),AR=W(),Ob=[W(),W(),W(),W()],MR=[0,0,0,0],Qve=Za();function Qui(t,e,i){if(t==null||i==null)return!1;let r=!0;return oa[0]=t.xmin!=null?t.xmin:0,oa[1]=t.ymin!=null?t.ymin:0,oa[2]=t.zmin!=null?t.zmin:0,r=r&&vn(oa,t.spatialReference,0,e,i,0,1),oa[0]=t.xmax!=null?t.xmax:0,oa[1]=t.ymax!=null?t.ymax:0,oa[2]=t.zmax!=null?t.zmax:0,r=r&&vn(oa,t.spatialReference,0,e,i,3,1),t.xmin==null&&(e[0]=-1/0),t.ymin==null&&(e[1]=-1/0),t.zmin==null&&(e[2]=-1/0),t.xmax==null&&(e[3]=1/0),t.ymax==null&&(e[4]=1/0),t.zmax==null&&(e[5]=1/0),r}function k7e(t,e,i){if(t==null||i==null)return!1;let r=!0;return oa[0]=t.xmin!=null?t.xmin:0,oa[1]=t.ymin!=null?t.ymin:0,oa[2]=t.zmin!=null?t.zmin:0,r=r&&vn(oa,t.spatialReference,0,oa,i,0,1),e[0]=oa[0],e[1]=oa[1],oa[0]=t.xmax!=null?t.xmax:0,oa[1]=t.ymax!=null?t.ymax:0,oa[2]=t.zmax!=null?t.zmax:0,r=r&&vn(oa,t.spatialReference,0,oa,i,0,1),e[2]=oa[0],e[3]=oa[1],t.xmin==null&&(e[0]=-1/0),t.ymin==null&&(e[1]=-1/0),t.xmax==null&&(e[2]=1/0),t.ymax==null&&(e[3]=1/0),r}const oa=W();let _l=class extends ze{get tilingScheme(){const e=this.tilingSchemeOwner.tilingScheme;return e?e.clone():null}set filterExtent(e){if(e!=null&&!e.spatialReference.equals(this.viewState.spatialReference))return void Ce.getLogger(this).error("#extent","extent spatial reference needs to be in the same spatial reference as the view");const i=this._get("filterExtent");if(i===e||i!=null&&e&&i.equals(e))return;const r=e!=null?e.clone():null;this._set("filterExtent",r),this._setDirty()}get _filterExtentRect(){if(this.filterExtent==null)return null;const e=Ni();return k7e(this.filterExtent,e,this.tilingScheme.spatialReference),e}get _rootTileIds(){const{tilingScheme:e}=this;return this._filterExtentRect&&e?e.rootTilesInExtent(this._filterExtentRect):[[0,0,0]]}set suspended(e){e!==this._get("suspended")&&(this._set("suspended",e),this._setDirty())}get updating(){return this._dirty||!!this._pendingTiles}constructor(e){super(e),this.tiles=new it,this.tileSize=512,this._idToTile=new Map,this._clients=new Set,this._dirty=!1,this._pendingTiles=null,this._newTiles=new Pi}initialize(){this.addHandles([_e(()=>[this.tilingScheme,this.tileSize],()=>this._reset(),Li),_e(()=>{var e,i,r;return[this.tileSize,(e=this.cameraOnSurface)==null?void 0:e.location,this.tilingScheme,(i=this.viewState)==null?void 0:i.contentCamera,(r=this.focus)==null?void 0:r.location]},()=>this._setDirty(),kt)]),this.scheduler&&(this._frameWorker=this.scheduler.registerTask(ni.FEATURE_TILE_TREE,this))}destroy(){this._frameWorker=en(this._frameWorker)}addClient(){const e=hp();return this._clients.add(e),this._clients.size===1&&this._setDirty(),rr(()=>this._removeClient(e))}_removeClient(e){this._clients.delete(e),this._hasClients||this._clear()}get _hasClients(){return this._clients.size>0}_setDirty(){!this._hasClients||this.suspended||this._dirty||(this._frameWorker?(this._dirty=!0,this.notifyChange("updating")):this.runTask(ou))}_clear(){this.tiles.removeAll(),this._idToTile.clear(),this._reset(),this._dirty=!1,this.notifyChange("updating")}get running(){return this.updating}runTask(e){this._dirty=!1,this._pendingTiles||(this._startUpdate(),this._frameWorker!=null&&(this._frameWorker.priority=ni.FEATURE_TILE_TREE_ACTIVE)),this._subdivideTilesForView(e),this._pendingTiles||this._frameWorker==null||(this._frameWorker.priority=ni.FEATURE_TILE_TREE),this.notifyChange("updating")}_startUpdate(){if(this.suspended)return;if(!this.tilingScheme)return void this._clear();this._tileMeasurements||(this._tileMeasurements=new qRt({renderCoordsHelper:this.renderCoordsHelper,tilingScheme:this.tilingScheme,tileSize:this.tileSize}));const e=this.viewState.contentCamera;this._tileMeasurements.begin(e,this.focus.location,this.cameraOnSurface.location.z??0),this._pendingTiles=this._getRootTiles()}_reset(){this._newTiles.clear(),this._tileMeasurements=null,this._pendingTiles=null,this._setDirty()}_getRootTiles(){const{tilingScheme:e}=this;return this._rootTileIds.map(i=>new gI(i[0],i[1],i[2],e))}_purgeHorizonTiles(e){e.sort((i,r)=>{const n=i.measures.screenRect,s=r.measures.screenRect;return n[1]+n[3]-(s[1]+s[3])}),od(r8);for(let i=0;iXRt)return e.data.slice(i,e.length);return[]}_subdivideTilesForView(e){if(!this._pendingTiles)return;const{tilingScheme:i}=this;for(;this._pendingTiles.length>0&&!e.done;){const r=this._pendingTiles.pop();e.madeProgress(),this._filterExtentRect&&!P9(this._filterExtentRect,r.extent)||(this._tileMeasurements.updateTile(r),r.measures.visibility!==fc.INVISIBLE&&(r.measures.shouldSplit?(i.ensureMaxLod(r.lij[0]+1),this._pendingTiles.push(...r.getChildren())):this._newTiles.push(r)))}this._pendingTiles.length===0&&(this._updateTiles(this._purgeHorizonTiles(this._newTiles)),this._newTiles.clear(),this._tileMeasurements.end(),this._pendingTiles=null)}_updateTiles(e){for(const n of this.tiles.items)n.used=!1;const i=e.filter(n=>{const s=this._idToTile.get(n.id);return s?(s.copyMeasurementsFrom(n),s.used=!0):this._idToTile.set(n.id,n),!s}),r=this.tiles.items.filter(n=>!n.used&&(this._idToTile.delete(n.id),!0));this.tiles.removeMany(r),this.tiles.addMany(i),this._sortTiles()}_sortTiles(){this.viewState.fixedContentCamera||this.tiles.sort((e,i)=>e.measures.visibility!==i.measures.visibility?e.measures.visibility===fc.VISIBLE_ON_SURFACE?-1:1:e.measures.distance-i.measures.distance),this.tiles.forEach((e,i)=>e.loadPriority=i)}};y([w({constructOnly:!0})],_l.prototype,"scheduler",void 0),y([w({constructOnly:!0})],_l.prototype,"renderCoordsHelper",void 0),y([w({constructOnly:!0})],_l.prototype,"tilingSchemeOwner",void 0),y([w({constructOnly:!0})],_l.prototype,"cameraOnSurface",void 0),y([w({constructOnly:!0})],_l.prototype,"focus",void 0),y([w({constructOnly:!0})],_l.prototype,"viewState",void 0),y([w({constructOnly:!0})],_l.prototype,"terrain",void 0),y([w()],_l.prototype,"tiles",void 0),y([w()],_l.prototype,"tileSize",void 0),y([w({readOnly:!0})],_l.prototype,"tilingScheme",null),y([w()],_l.prototype,"filterExtent",null),y([w({readOnly:!0})],_l.prototype,"_filterExtentRect",null),y([w({readOnly:!0})],_l.prototype,"_rootTileIds",null),y([w({value:!1})],_l.prototype,"suspended",null),y([w({readOnly:!0})],_l.prototype,"updating",null),_l=y([Z("esri.views.3d.layers.support.FeatureTileTree3D")],_l);const r8=Ni(),XRt=10;let Fs=class extends ze{constructor(){super(...arguments),this._propertiesPool=new x_({camera:ai},this),this._lastSeenCameraProjectionValues=new ai,this.mode=Vr.ANIMATING,this._cssCamera=new ai,this._camera=new ai,this.rasterPixelRatio=1,this.contentPixelRatio=1,this.events=new Dn,this.viewingMode=_t.Global,this._cameraChanged=!1,this._updateQueue=new Array,this._processingUpdates=!1}init(e,i){this._set("viewingMode",e),this._set("spatialReference",i),this._set("constraints",new ev({mode:this.viewingMode}))}exit(){this.cameraController=null,this._propertiesPool.destroy(),this._propertiesPool=new x_({camera:ai},this)}destroy(){var e;this.cameraController=null,(e=this._propertiesPool)==null||e.destroy(),this._propertiesPool=null}createInitialCamera(){if(this.viewingMode===_t.Global){const e=Sr(this.spatialReference).radius;this.camera=new ai({eye:nt(4*e,0,0),center:nt(e,0,0),up:nt(0,0,1)})}else this.camera=new ai({eye:nt(0,0,100),center:nt(0,0,0),up:nt(0,1,0)})}get animation(){return this.cameraController instanceof $L&&this.cameraController.viewAnimation!=null?this.cameraController.viewAnimation:null}get camera(){return this._camera}get cssCamera(){const e=this._cssCamera.copyFrom(this.camera),{height:i,width:r,pixelRatio:n}=this.camera;return e.pixelRatio=1,e.height=Math.round(i/n),e.width=Math.round(r/n),e}set camera(e){e!==kp&&kp.copyFrom(e),kp.computeUp(this.viewingMode),this.events.emit("before-camera-change",kp);const i=this._camera;if(this._cameraProjectionChanged(this._lastSeenCameraProjectionValues,kp)&&(this._lastSeenCameraProjectionValues.copyFrom(kp),this.events.emit("camera-projection-changed",this._lastSeenCameraProjectionValues)),!i.equals(kp)&&(this._camera=this._propertiesPool.get("camera").copyFrom(kp),this._cameraChanged=!i.almostEquals(kp),this._cameraChanged)){const r=TSe(()=>{this._cameraChanged=!1,r.remove()})}}get pixelRatio(){return this.camera.pixelRatio}get alignPixelEnabled(){return this.pixelRatio===this.rasterPixelRatio&&this.mode===Vr.IDLE}get updating(){return this.mode!==Vr.IDLE}get contentCamera(){return this._contentCamera??this.camera}set contentCamera(e){this._contentCamera=e!=null?e.clone():null}get fixedContentCamera(){return this._contentCamera!=null}get isGlobal(){return this.viewingMode===_t.Global}get isLocal(){return this.viewingMode===_t.Local}get navigating(){return!(!this.cameraController||!this.cameraController.isInteractive)}get stationary(){return!this._cameraChanged&&!this.navigating}get cameraController(){return this._get("cameraController")}set cameraController(e){var i;this.stopActiveCameraController()?((i=this.cameraController)==null||i.destroy(),e&&(this.removeHandles(e_e),this.addHandles(Mo(()=>e.state===Cs.Finished||e.state===Cs.Stopped,()=>{this._set("cameraController",null),this.updateCamera(r=>e.onControllerEnd(r))},{sync:!0,once:!0}),e_e),e.onControllerStart(this.camera)),this._set("cameraController",e)):e&&(e.state=Cs.Rejected)}switchCameraController(e){return this.cameraController=e,e.state!==Cs.Rejected}stopActiveCameraController(){return!(this.cameraController&&!this.cameraController.stopController())}updateCamera(e){this._updateQueue.push(e),this._processUpdateQueue()}_processUpdateQueue(){if(this._updateQueue.length===0||this._processingUpdates)return;this._processingUpdates=!0;const e=this._updateQueue.shift();kp.copyFrom(this._get("camera")),e(kp),this.camera=kp,this._processingUpdates=!1,this._processUpdateQueue()}_cameraProjectionChanged(e,i){return e.fov!==i.fov||e.fullViewport[0]!==i.fullViewport[0]||e.fullViewport[1]!==i.fullViewport[1]||e.fullViewport[2]!==i.fullViewport[2]||e.fullViewport[3]!==i.fullViewport[3]||e.padding[er.TOP]!==i.padding[er.TOP]||e.padding[er.RIGHT]!==i.padding[er.RIGHT]||e.padding[er.BOTTOM]!==i.padding[er.BOTTOM]||e.padding[er.LEFT]!==i.padding[er.LEFT]}};y([w()],Fs.prototype,"mode",void 0),y([w({readOnly:!0,type:b5})],Fs.prototype,"animation",null),y([w({type:ai})],Fs.prototype,"camera",null),y([w({type:ai})],Fs.prototype,"cssCamera",null),y([w()],Fs.prototype,"_cssCamera",void 0),y([w()],Fs.prototype,"_camera",void 0),y([w({readOnly:!0})],Fs.prototype,"pixelRatio",null),y([w()],Fs.prototype,"rasterPixelRatio",void 0),y([w()],Fs.prototype,"contentPixelRatio",void 0),y([w({readOnly:!0})],Fs.prototype,"alignPixelEnabled",null),y([w({readOnly:!0})],Fs.prototype,"updating",null),y([w({})],Fs.prototype,"_contentCamera",void 0),y([w({type:ai})],Fs.prototype,"contentCamera",null),y([w({readOnly:!0})],Fs.prototype,"fixedContentCamera",null),y([w({readOnly:!0})],Fs.prototype,"constraints",void 0),y([w({readOnly:!0})],Fs.prototype,"events",void 0),y([w({readOnly:!0})],Fs.prototype,"isGlobal",null),y([w({readOnly:!0})],Fs.prototype,"isLocal",null),y([w({readOnly:!0})],Fs.prototype,"viewingMode",void 0),y([w({readOnly:!0})],Fs.prototype,"spatialReference",void 0),y([w()],Fs.prototype,"navigating",null),y([w()],Fs.prototype,"stationary",null),y([w()],Fs.prototype,"_cameraChanged",void 0),y([w()],Fs.prototype,"cameraController",null),Fs=y([Z("esri.views.3d.state.ViewState")],Fs);const ZRt=Fs,kp=new ai,e_e="ViewStateHandles";let JRt=class{constructor(e,i,r){this.viewingMode=e,this._forEachLayer=i,this._view=r,this._externalIntersectionHandlers=new Pi,this._tolerance=v5,this._tmpRay=Ko(),this._tmpRegion=Ni(),this._validateHUDIntersector=Tp(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,i,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),t_e(this.viewingMode),i,r)}intersectScreenFreePointFallback(e,i,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),i,r)}intersectRayFreePointFallback(e,i,r){return this.intersectRay(e,t_e(this.viewingMode),i,r)||this._intersectRayFreePointLocal(e,i)}intersectRay(e,i,r,n){return i.options.selectionMode=!1,i.options.store=tl.MIN,this.computeIntersection(e,i,n),!!i.results.min&&i.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,i,r=.5,n=.5){return e.getRenderCenter(o8,r,n),o8[0]+=.0466,o8[1]-=.0123,tle(e,o8,i)}intersectIntersectorScreen(e,i,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),i,r)}intersectToolIntersectorScreen(e,i,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,i,r)}intersectToolIntersectorRay(e,i,r){i.options.selectionMode=!0,this.computeIntersection(e,i,r);const n=i.results.min;this._view.basemapTerrain&&this._view.basemapTerrain.opaque||Gm(n)&&n.intersector!==ms.TERRAIN||(i.options.selectionMode=!1,this.computeIntersection(e,i,r))}setTolerance(e=v5){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((i,r)=>i.type===ms.TERRAIN?1:r.type===ms.TERRAIN?-1:0)}removeIntersectionHandler(e){this._externalIntersectionHandlers.removeUnordered(e)!=null&&this._externalIntersectionHandlers.sort((i,r)=>i.type===ms.TERRAIN?1:r.type===ms.TERRAIN?-1:0)}_getPickRay(e,i){const r=this._view.state.camera;return ele(r,e,i)}_intersectRayFreePointLocal(e,i){return this.viewingMode!==_t.Local||e==null||Be(i,e.origin,Ye(xt.get(),e.direction)),!1}intersectElevationFromScreen(e,i,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),i,r,n)}_intersectElevation(e,i,r=0,n=null){if(e==null)return null;const s=i!=null?i.mode:"absolute-height",o=(i==null?void 0:i.offset)??0,l=s!=="on-the-ground"?o+r:0,c=l/this._view.renderCoordsHelper.unitInMeters;if(s==="absolute-height"){if(this._view.renderCoordsHelper.intersectInfiniteManifold(e,l,s8)){const z=this._view.computeMapPointFromVec3d(s8);return z.z??(z.z=0),z.z-=o,z}return null}const f=this._view.state.camera,_=xt.get();f.projectToRenderScreen(e.origin,_);const x=new i_e(null,this._forEachLayer),T=this._view.slicePlane,A=T!=null?U0e(T):null,M=Tp(this.viewingMode);M.options.store=tl.MIN,M.options.verticalOffset=c;const I=e.origin,L=Be(xt.get(),I,e.direction);M.reset(I,L,f),M.point=_;const F=n?"type"in n&&n.type==="graphics"?z=>z.layerUid!==n.uid:z=>z.graphicUid!==n.uid:null;switch(s){case"relative-to-scene":{const z=k=>(!F||F(k))&&!!k.lastValidElevationBB;M.intersect(x.layers,_,this._tolerance,null,z),this._externalIntersectionHandlers.forAll(k=>{if(k.type===ms.I3S||k.type===ms.TERRAIN){const U=k.slicePlaneEnabled?A:null;k.intersect(M,U,M.rayBegin,M.rayEnd,_)}});break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll(z=>{if(z.isGround){const k=z.slicePlaneEnabled?A:null;z.intersect(M,k,M.rayBegin,M.rayEnd,_)}})}if(M.results.min.getIntersectionPoint(s8)){const z=this._view.computeMapPointFromVec3d(s8);return z.z=r,z}return null}computeIntersection(e,i,r){var M;if(e==null)return;const n=this._view.state.camera,s=xt.get();n.projectToRenderScreen(e.origin,s);const o=new i_e(r,this._forEachLayer);i.options.selectOpaqueTerrainOnly=!r||!("include"in r||"exclude"in r);const l=e.origin,c=Be(xt.get(),e.origin,e.direction);i.reset(l,c,n),i.intersect(o.layers,s,this._tolerance);const f=this._view.slicePlane,_=f!=null?U0e(f):null;i.intersect(o.sliceableLayers,s,this._tolerance,_);const x=r&&(r.requiresGroundFeedback||r.enableDraped);this._externalIntersectionHandlers.forAll(I=>{const L=I.layerUid,F=Array.isArray(L),z=F?L:[L];F&&(i.options.filteredLayerUids=[]);let k=!1;for(const U of z)o.filterLayerUid(U)?k=!0:F&&i.options.filteredLayerUids.push(U);if(i.options.isFiltered=!k,I.isGround&&x||!i.options.isFiltered){const U=I.slicePlaneEnabled?_:null;I.intersect(i,U,l,c,s)}});const T=xt.get(),A=this._view.basemapTerrain;if(r&&r.enableDraped&&A.spatialReference!=null&&i.results.ground.getIntersectionPoint(T)){const I=A.overlayManager.renderer,L=this._view.renderCoordsHelper.spatialReference,F=xt.get();this._view.renderCoordsHelper.fromRenderCoords(T,F,A.spatialReference),F[2]=((M=this._view.elevationProvider)==null?void 0:M.getElevation(T[0],T[1],T[2],L,"ground"))??0,I.intersect(i,F,i.results.ground,z=>o.filterRenderGeometry(z))}i.sortResults(),this._processHUDResults(i)}_processHUDResults(e){const i=e.results.hud;d_(this._tmpRegion,XZ);const r=this._view.state.camera,n=[],s=this._tmpRegion,o=F=>{const z=new QRt(F);r.projectToRenderScreen(F.target.center,z.screenPoint),z.screenPoint[0]=Math.floor(z.screenPoint[0]),z.screenPoint[1]=Math.floor(z.screenPoint[1]),n.push(z),nO(s,z.screenPoint)};e.sortResults(i.all),i.min.dist!=null&&o(i.min);for(const F of i.all)i.min.target.object!==F.target.object&&i.max.target.object!==F.target.object&&o(F);if(i.max.dist!=null&&i.max.target.object!==i.min.target.object&&o(i.max),!n.length)return;s[0]===s[2]&&(s[2]+=1),s[1]===s[3]&&(s[3]+=1);const l=r.fullWidth,c=r.fullHeight,f=Math.max(0,s[0]-yI),_=Math.max(0,s[1]-yI),x=Math.min(_c(s)+2*yI,l-f),T=Math.min(qu(s)+2*yI,c-_),A=new Uint8Array(x*T*4);this._view._stage.renderer.readHUDVisibility(f,_,x,T,A);let M=!0;const I=e.results.max.dist==null;let L=0;for(const F of n)for(const z of KRt)if(A[4*(Math.min(F.screenPoint[0]+z[0],l)-s[0]+(Math.min(F.screenPoint[1]+z[1],c)-s[1])*x)]){M&&(e.results.min.copy(F.result),M=!1),I&&e.results.max.copy(F.result),e.options.store===tl.ALL&&e.results.all.splice(L++,0,F.result);break}}};const yI=1,KRt=(()=>{const t=[],e=yI;for(let i=-e;i<=e;i++)for(let r=-e;r<=e;r++)t.push([r+e,i+e]);return t})();let QRt=class{constructor(e){this.result=e,this.screenPoint=Za()}},n8;function t_e(t){return n8&&n8.viewingMode===t||(n8=Tp(t)),n8}let i_e=class{constructor(e,i){this.layers=new Array,this.sliceableLayers=new Array,this.include=e==null?void 0:e.include,this.exclude=e==null?void 0:e.exclude,i(r=>{r.pickable&&this.filterLayerUid(r.apiLayerUid)&&(r.sliceable?this.sliceableLayers:this.layers).push(r)})}filterLayerUid(e){const{include:i,exclude:r}=this;return e==null?i==null&&r==null:(i==null||i.has(e))&&(r==null||!r.has(e))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}};function r_e(t){return typeof t=="object"&&"intersect"in t}const s8=W(),o8=Za();let shi=class{constructor(e,i){this.spatialReference=e,this._view=i}getElevation(e,i,r){return this._view.elevationProvider.getElevation(e,i,0,this.spatialReference,r)}async queryElevation(e,i,r,n,s){return this._view.elevationProvider.queryElevation(e,i,0,this.spatialReference,s,r,n)}},e4t=class{constructor(e,i,r,n){this.spatialReference=i,this._getElevationQueryProvider=r,this._queries=new Array,this._queryOptions={...n,ignoreInvisibleLayers:!0},this._frameTask=e.registerTask(ni.ELEVATION_QUERY,this)}destroy({completeTasks:e}={completeTasks:!1}){if(this._frameTask.remove(),this.running)if(e)this.runTask(ou);else for(const i of this._queries)i.result.reject(ur())}queryElevation(e,i,r,n=0){const s=Jl(),o={x:e,y:i,minDemResolution:n,result:s,signal:r};return this._queries.push(o),Yl(r,()=>{Gre(this._queries,o),s.reject(ur())}),s.promise}get running(){return this._queries.length>0}runTask(e){const i=this._queries;this._queries=[];const r=this._getElevationQueryProvider();if(!r)return i.forEach(_=>_.result.reject()),void e.madeProgress();const n=i.map(_=>[_.x,_.y]),s=i.reduce((_,x)=>Math.min(_,x.minDemResolution),1/0),o=new Cm({points:n,spatialReference:this.spatialReference}),l=i.length>1&&i.some(_=>!!_.signal)?new AbortController:null,c=l!=null?l.signal:i[0].signal;if(l!=null){let _=0;i.forEach(x=>Yl(x.signal,()=>{_++,x.result.reject(ur()),_===i.length&&l.abort()}))}const f={...this._queryOptions,minDemResolution:s,signal:c};r.queryElevation(o,f).then(_=>{i.forEach((x,T)=>{x.signal!=null&&x.signal.aborted?x.result.reject(ur()):x.result.resolve(_.geometry.points[T][2])})}).catch(_=>{i.forEach(x=>x.result.reject(_))}),e.madeProgress()}get test(){const e=this;return{update:()=>e._queries.length>0&&e.runTask(ou)}}},vI=class extends Dn.EventedMixin(ze){get spatialReference(){var e,i;return(i=(e=this.view)==null?void 0:e.basemapTerrain)==null?void 0:i.spatialReference}constructor(e){super(e),this._im=new Array,this._ground=new Array,this._scene=new Array,this.lastElevationQuery=null,this.elevationCacheEnabled=!1}destroy(){this._elevationQueryCached=et(this._elevationQueryCached)}enableElevationCache(e){e||(this.lastElevationQuery=null),this.elevationCacheEnabled=e}getElevation(e,i,r,n,s){if(this.elevationCacheEnabled&&this.lastElevationQuery!=null){const l=this.lastElevationQuery;if(e===l.x&&i===l.y&&r===l.z&&Zn(n,l.spatialReference)&&s===l.queryContext)return l.result}let o=null;return o=a8(o,this._im,e,i,r,n,s),o==null&&(o=a8(o,this._ground,e,i,r,n,s)),s==="scene"&&(o=a8(o,this._scene,e,i,r,n,s)),this.elevationCacheEnabled&&(this.lastElevationQuery={x:e,y:i,z:r,spatialReference:n,queryContext:s,result:o}),o}getSphereElevationBounds(e,i){let r=1/0,n=-1/0;for(const s of[this._im,this._ground,this._scene])s.forEach(o=>{if(o.getSphereElevationBounds){const l=o.getSphereElevationBounds(e,i);l!=null&&(r=Math.min(r,l.min),n=Math.max(n,l.max))}});return{min:r,max:n}}getRootElevationBounds(){let e=1/0,i=-1/0;for(const r of[this._im,this._ground,this._scene])r.forEach(n=>{if(n.getRootElevationBounds){const s=n.getRootElevationBounds();s!=null&&(e=Math.min(e,s.min),i=Math.max(i,s.max))}});return{min:e,max:i}}async queryElevation(e,i,r,n,s,o=null,l=0){const c=this._getElevationQuery(n);try{const f=await c.queryElevation(e,i,o,l);return s==="scene"?a8(f,this._scene,e,i,r,n,s):f}catch(f){return zo(f),this.getElevation(e,i,r,n,s)}}register(e,i){this.addHandles(i.on("elevation-change",r=>this.emit("elevation-change",r)),i),this._providersFromContext(e).push(i)}unregister(e){this.removeHandles(e);for(const i of[this._im,this._ground,this._scene]){const r=i.indexOf(e);r>-1&&i.splice(r,1)}}_providersFromContext(e){switch(e){case"ground":return this._ground;case"im":return this._im;case"scene":return this._scene}}_getElevationQuery(e=this.view.spatialReference){const i=this._elevationQueryCached;if(i!=null&&Zn(e,i.spatialReference))return i;i==null||i.destroy({completeTasks:!0});const{wkid:r,wkt:n,wkt2:s,latestWkid:o}=e,l=new e4t(this.view.resourceController.scheduler,new at({wkid:r,wkt:n,wkt2:s,latestWkid:o}),()=>{var c;return(c=this.view.map)==null?void 0:c.ground},{maximumAutoTileRequests:4});return this._elevationQueryCached=l,l}};function a8(t,e,i,r,n,s,o){for(const l of e){const c=l.getElevation(i,r,n,s,o);c!=null&&(t=t!=null?Math.max(c,t):c)}return t}y([w({constructOnly:!0})],vI.prototype,"view",void 0),y([w()],vI.prototype,"spatialReference",null),vI=y([Z("esri.views.3d.support.CombinedElevationProvider")],vI);let XL=class Oie{static isValidProfile(e){return e in Oie.profiles}static getDefaultProfile(){return Le("esri-iPhone")?"low":"medium"}static apply(e,i){const r=Oie.profiles[e];i.graphics3D.maxTotalNumberOfFeatures=r.graphics3D.maxTotalNumberOfFeatures,i.graphics3D.maxNumberOfDrawCalls=r.graphics3D.maxNumberOfDrawCalls,i.graphics3D.maxTotalNumberOfVertices=r.graphics3D.maxTotalNumberOfVertices,i.graphics3D.polygonLodFactor=r.graphics3D.polygonLodFactor,i.graphics3D.polylineLodFactor=r.graphics3D.polylineLodFactor,i.graphics3D.snapshotAvailable=r.graphics3D.snapshotAvailable,i.graphics3D.skipHighSymbolLods=r.graphics3D.skipHighSymbolLods,i.graphics3D.uncompressedTextureDownsamplingEnabled=r.graphics3D.uncompressedTextureDownsamplingEnabled;const n=i.sceneService.object,s=r.sceneService.object;n.lodFactor=s.lodFactor,n.lodCrossfadeinDuration=s.lodCrossfadeinDuration,n.lodCrossfadeoutDuration=s.lodCrossfadeoutDuration,n.lodCrossfadeUncoveredDuration=s.lodCrossfadeUncoveredDuration,i.sceneService.point.lodFactor=r.sceneService.point.lodFactor,i.sceneService.integratedMesh.lodFactor=r.sceneService.integratedMesh.lodFactor,i.sceneService.pointCloud.lodFactor=r.sceneService.pointCloud.lodFactor,i.sceneService.uncompressedTextureDownsamplingEnabled=r.sceneService.uncompressedTextureDownsamplingEnabled,i.tiledSurface.lodBias=r.tiledSurface.lodBias,i.tiledSurface.angledSplitBias=r.tiledSurface.angledSplitBias,i.tiledSurface.vtlContentZoom=r.tiledSurface.vtlContentZoom,i.tiledSurface.reduceTileLevelDifferences=r.tiledSurface.reduceTileLevelDifferences,i.tiledSurface.textureFadeDuration=r.tiledSurface.textureFadeDuration,i.heatmap.pixelRatio=r.heatmap.pixelRatio,i.heatmap.maxTotalNumberOfFeatures=r.heatmap.maxTotalNumberOfFeatures,i.fadeDuration=r.fadeDuration,i.antialiasingEnabled=r.antialiasingEnabled,i.physicallyBasedRenderingEnabled=r.physicalBasedRenderingEnabled,i.highQualityTransparency=r.highQualityTransparency,i.highResolutionAtmosphere=r.highResolutionAtmosphere,i.reflections=r.reflections,i.ambientOcclusion=r.ambientOcclusion,i.memoryLimit=r.memoryLimit,i.additionalCacheMemory=r.additionalCacheMemory,i.frameRate=r.frameRate,i.maximumPixelRatio=r.maximumPixelRatio}};XL.test={reset(){const t=z7e();for(const e of Object.keys(t))XL.profiles[e]=t[e]}};const OR={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430};function z7e(){const t=!!Le("esri-mobile"),e=!!Le("ios"),i=400;return{low:{graphics3D:{maxTotalNumberOfFeatures:25e3,maxNumberOfDrawCalls:8e3,maxTotalNumberOfVertices:255e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0,uncompressedTextureDownsamplingEnabled:!0},heatmap:{pixelRatio:.125,maxTotalNumberOfFeatures:25e3},sceneService:{object:{lodFactor:.2,lodCrossfadeinDuration:0,lodCrossfadeoutDuration:0,lodCrossfadeUncoveredDuration:0},point:{lodFactor:1},integratedMesh:{lodFactor:.6},pointCloud:{lodFactor:.5},uncompressedTextureDownsamplingEnabled:!0},tiledSurface:{lodBias:-1,angledSplitBias:.5,vtlContentZoom:.75,reduceTileLevelDifferences:!0,textureFadeDuration:0},fadeDuration:0,antialiasingEnabled:!1,physicalBasedRenderingEnabled:!1,highQualityTransparency:!1,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,memoryLimit:200+OR.IPhone12Pro,additionalCacheMemory:0,frameRate:0,maximumPixelRatio:1},medium:{graphics3D:{maxTotalNumberOfFeatures:1e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:625e4,polygonLodFactor:t?.8:1,polylineLodFactor:t?1.2:1.5,snapshotAvailable:!e,skipHighSymbolLods:!1,uncompressedTextureDownsamplingEnabled:t},heatmap:{pixelRatio:.25,maxTotalNumberOfFeatures:5e4},sceneService:{object:{lodFactor:1,lodCrossfadeinDuration:0,lodCrossfadeoutDuration:0,lodCrossfadeUncoveredDuration:i},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1},uncompressedTextureDownsamplingEnabled:t},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,reduceTileLevelDifferences:!Le("disable-feature:reduce-map-tile-levels"),textureFadeDuration:i},fadeDuration:i,antialiasingEnabled:!0,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,memoryLimit:t?600+OR.GalaxyS20:750+OR.FullHD,additionalCacheMemory:t?-100:150,frameRate:0,maximumPixelRatio:1},high:{graphics3D:{maxTotalNumberOfFeatures:1e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:125e5,polygonLodFactor:t?1.2:2,polylineLodFactor:t?1.2:2,snapshotAvailable:!e,skipHighSymbolLods:!1,uncompressedTextureDownsamplingEnabled:!1},heatmap:{pixelRatio:.5,maxTotalNumberOfFeatures:5e4},sceneService:{object:{lodFactor:1,lodCrossfadeinDuration:0,lodCrossfadeoutDuration:0,lodCrossfadeUncoveredDuration:i},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1},uncompressedTextureDownsamplingEnabled:!1},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,reduceTileLevelDifferences:!Le("disable-feature:reduce-map-tile-levels"),textureFadeDuration:i},fadeDuration:i,antialiasingEnabled:!0,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!0,reflections:!0,ambientOcclusion:!0,memoryLimit:t?900+OR.SurfacePro7:1500+OR.FullHDRetina,additionalCacheMemory:t?-150:0,frameRate:0,maximumPixelRatio:t?1:1/0}}}(function(t){t.profiles=z7e()})(XL||(XL={}));const lk=XL,U7e=new qe([0,255,255]),V7e=1,B7e=.25,j7e=new qe([0,0,0]),G7e=.4,H7e=.2;let Dg=class extends ze{constructor(){super(...arguments),this.color=U7e.clone(),this.haloColor=null,this.haloOpacity=V7e,this.fillOpacity=B7e,this.shadowOpacity=G7e,this.shadowColor=j7e.clone(),this.shadowDifference=H7e}};y([w({type:qe})],Dg.prototype,"color",void 0),y([w({type:qe})],Dg.prototype,"haloColor",void 0),y([w()],Dg.prototype,"haloOpacity",void 0),y([w()],Dg.prototype,"fillOpacity",void 0),y([w()],Dg.prototype,"shadowOpacity",void 0),y([w({type:qe})],Dg.prototype,"shadowColor",void 0),y([w()],Dg.prototype,"shadowDifference",void 0),Dg=y([Z("esri.views.3d.support.HighlightOptions")],Dg);const q7e=Dg;function _G(t,e){return e?{...e,query:{...t??{},...e.query}}:{query:t}}function d6(t){return typeof t=="string"?qs(t):Re(t)}function bG(t,e,i){const r={};for(const n in t){if(n==="declaredClass")continue;const s=t[n];if(s!=null&&typeof s!="function")if(Array.isArray(s)){r[n]=[];for(let o=0;oe.toJSON())}}function W7e(t,e,i){const r=ket(e);return t.map(n=>{const s=r.fromJSON(n);return s.spatialReference=i,s})}let tS=class extends Ue{constructor(e){super(e),this.geometries=[],this.outSpatialReference=null,this.transformation=null,this.transformForward=null}toJSON(){const e=this.geometries.map(n=>n.toJSON()),i=this.geometries[0],r={};return r.outSR=Cz(this.outSpatialReference),r.inSR=Cz(i.spatialReference),r.geometries=JSON.stringify({geometryType:R9(i),geometries:e}),this.transformation&&(r.transformation=this.transformation.wkid||JSON.stringify(this.transformation)),this.transformForward!=null&&(r.transformForward=this.transformForward),r}};y([w()],tS.prototype,"geometries",void 0),y([w({json:{read:{source:"outSR"}}})],tS.prototype,"outSpatialReference",void 0),y([w()],tS.prototype,"transformation",void 0),y([w()],tS.prototype,"transformForward",void 0),tS=y([Z("esri.rest.support.ProjectParameters")],tS);const wG=tS,i4t=$s(wG);async function _ce(t,e,i){e=i4t(e);const r=d6(t),n={...r.query,f:"json",...e.toJSON()},s=e.outSpatialReference,o=R9(e.geometries[0]),l=_G(n,i);return bi(r.path+"/project",l).then(({data:{geometries:c}})=>W7e(c,o,s))}async function bce(t=null,e){var n,s;if(Ar.geometryServiceUrl)return Ar.geometryServiceUrl;if(!t)throw new se("internal:geometry-service-url-not-configured");let i;i="portal"in t?t.portal||os.getDefault():t,await i.load({signal:e});const r=(s=(n=i.helperServices)==null?void 0:n.geometry)==null?void 0:s.url;if(!r)throw new se("internal:geometry-service-url-not-configured");return r}async function r4t(t,e,i=null,r){const n=await bce(i,r),s=new wG;s.geometries=[t],s.outSpatialReference=e;const o=await _ce(n,s,{signal:r});if(o&&Array.isArray(o)&&o.length===1)return o[0];throw new se("internal:geometry-service-projection-failed")}const n4t=Object.freeze(Object.defineProperty({__proto__:null,getGeometryServiceURL:bce,projectGeometry:r4t},Symbol.toStringTag,{value:"Module"}));let s4t=class{constructor(e,i){this.spatialReference=i,this.unitInMeters=ws(this.spatialReference,Sr(this.spatialReference).metersPerDegree);const r=e&&"portalItem"in e?e.portalItem:void 0;this._geometryServiceURLPromise=bce(r).catch(()=>{throw new se("mapcoordshelper:missing-geometry-service","Must specify geometryService in esri/config")})}async toGeographic(e){const i=await this._geometryServiceURLPromise;let r,n=!0;Array.isArray(e[0])&&typeof e[0]!="number"?r=e:(r=[e],n=!1);const s=r.map(c=>c instanceof mt?c:new mt(c,this.spatialReference)),o=new wG({geometries:s,outSpatialReference:at.WGS84}),l=(await _ce(i,o)).map(c=>c.type==="point"?[c.x,c.y]:void 0).filter(c=>!!c);return n?l:l[0]}},Gd=class extends ze{constructor(){super(...arguments),this.minTotalNumberOfFeatures=2e3,this.maxTotalNumberOfFeatures=5e4,this.maxNumberOfDrawCalls=17e3,this.maxTotalNumberOfVertices=17e5,this.snapshotAvailable=!0,this.polygonLodFactor=1,this.polylineLodFactor=1,this.skipHighSymbolLods=!1,this.uncompressedTextureDownsamplingEnabled=!1}};y([w()],Gd.prototype,"minTotalNumberOfFeatures",void 0),y([w()],Gd.prototype,"maxTotalNumberOfFeatures",void 0),y([w()],Gd.prototype,"maxNumberOfDrawCalls",void 0),y([w()],Gd.prototype,"maxTotalNumberOfVertices",void 0),y([w()],Gd.prototype,"snapshotAvailable",void 0),y([w()],Gd.prototype,"polygonLodFactor",void 0),y([w()],Gd.prototype,"polylineLodFactor",void 0),y([w()],Gd.prototype,"skipHighSymbolLods",void 0),y([w()],Gd.prototype,"uncompressedTextureDownsamplingEnabled",void 0),Gd=y([Z("esri.views.3d.support.QualitySettings.Graphics3DSettings")],Gd);let Iy=class extends ze{constructor(){super(...arguments),this.lodFactor=1}};y([w()],Iy.prototype,"lodFactor",void 0),Iy=y([Z("esri.views.3d.support.QualitySettings.LoDFactorSettings")],Iy);let sV=class extends Iy{constructor(){super(...arguments),this.lodCrossfadeinDuration=0,this.lodCrossfadeoutDuration=0,this.lodCrossfadeUncoveredDuration=0}};sV=y([Z("esri.views.3d.support.QualitySettings.LoDFactor3DObjectSettings")],sV);let Cv=class extends ze{constructor(){super(...arguments),this.object=new sV,this.point=new Iy,this.integratedMesh=new Iy,this.pointCloud=new Iy,this.uncompressedTextureDownsamplingEnabled=!1}};y([w({type:sV})],Cv.prototype,"object",void 0),y([w({type:Iy})],Cv.prototype,"point",void 0),y([w({type:Iy})],Cv.prototype,"integratedMesh",void 0),y([w({type:Iy})],Cv.prototype,"pointCloud",void 0),y([w()],Cv.prototype,"uncompressedTextureDownsamplingEnabled",void 0),Cv=y([Z("esri.views.3d.support.QualitySettings.SceneServiceSettings")],Cv);let Av=class extends ze{constructor(){super(...arguments),this.lodBias=0,this.angledSplitBias=1,this.vtlContentZoom=1,this.reduceTileLevelDifferences=!0,this.textureFadeDuration=400}};y([w()],Av.prototype,"lodBias",void 0),y([w()],Av.prototype,"angledSplitBias",void 0),y([w()],Av.prototype,"vtlContentZoom",void 0),y([w()],Av.prototype,"reduceTileLevelDifferences",void 0),y([w()],Av.prototype,"textureFadeDuration",void 0),Av=y([Z("esri.views.3d.support.QualitySettings.TiledSurfaceSettings")],Av);let UM=class extends ze{constructor(){super(...arguments),this.pixelRatio=1,this.maxTotalNumberOfFeatures=5e4}};y([w()],UM.prototype,"pixelRatio",void 0),y([w()],UM.prototype,"maxTotalNumberOfFeatures",void 0),UM=y([Z("esri.views.3d.support.QualitySettings.HeatmapSettings")],UM);let kl=class extends ze{constructor(){super(...arguments),this.graphics3D=new Gd,this.sceneService=new Cv,this.tiledSurface=new Av,this.heatmap=new UM,this.fadeDuration=400,this.antialiasingEnabled=!0,this.physicallyBasedRenderingEnabled=!1,this.highQualityTransparency=!0,this.highResolutionAtmosphere=!1,this.reflections=!1,this.ambientOcclusion=!1,this.memoryLimit=750,this.additionalCacheMemory=0,this.frameRate=void 0,this.maximumPixelRatio=1/0}};y([w({type:Gd})],kl.prototype,"graphics3D",void 0),y([w({type:Cv})],kl.prototype,"sceneService",void 0),y([w({type:Av})],kl.prototype,"tiledSurface",void 0),y([w({type:UM})],kl.prototype,"heatmap",void 0),y([w()],kl.prototype,"fadeDuration",void 0),y([w()],kl.prototype,"antialiasingEnabled",void 0),y([w()],kl.prototype,"physicallyBasedRenderingEnabled",void 0),y([w()],kl.prototype,"highQualityTransparency",void 0),y([w()],kl.prototype,"highResolutionAtmosphere",void 0),y([w()],kl.prototype,"reflections",void 0),y([w()],kl.prototype,"ambientOcclusion",void 0),y([w()],kl.prototype,"memoryLimit",void 0),y([w()],kl.prototype,"additionalCacheMemory",void 0),y([w()],kl.prototype,"frameRate",void 0),y([w()],kl.prototype,"maximumPixelRatio",void 0),kl=y([Z("esri.views.3d.support.QualitySettings.QualitySettings")],kl);const n_e=kl;function o4t(t){return q5(t)&&t.length>=3}function a4t(t){return(W5(t)||Array.isArray(t))&&t.length>=3}function l4t(t){return o4t(t)||a4t(t)}let c4t=class Pie{constructor(e,i,r,n){this.viewingMode=e,this.spatialReference=i,this.unitInMeters=r,this._coordinateSystem=n,this._tmpCoordinateSystem=Ift(n)}set extent(e){e&&$ft(this._coordinateSystem,e,this._coordinateSystem)}getAltitude(e){return Vft(this._coordinateSystem,e)}setAltitude(e,i,r=e){return C4e(this._coordinateSystem,r,i,e)}setAltitudeOfTransformation(e,i){Bft(this._coordinateSystem,i,e,i)}worldUpAtPosition(e,i){return Fft(this._coordinateSystem,e,i)}worldBasisAtPosition(e,i,r){return kft(this._coordinateSystem,e,i,r)}basisMatrixAtPosition(e,i){const r=this.worldBasisAtPosition(e,Ms.X,xt.get()),n=this.worldBasisAtPosition(e,Ms.Y,xt.get()),s=this.worldBasisAtPosition(e,Ms.Z,xt.get());return s1(i,r[0],r[1],r[2],0,n[0],n[1],n[2],0,s[0],s[1],s[2],0,0,0,0,1),i}headingAtPosition(e,i){const r=this.worldUpAtPosition(e,xt.get()),n=this.worldBasisAtPosition(e,Ms.Y,xt.get()),s=KPe(i,n,r);return pu(s)}intersectManifoldClosestSilhouette(e,i,r){return KH(this._coordinateSystem,i,this._tmpCoordinateSystem),Uft(this._tmpCoordinateSystem,e,r),r}intersectManifold(e,i,r){KH(this._coordinateSystem,i,this._tmpCoordinateSystem);const n=xt.get();return zft(this._tmpCoordinateSystem,e,n)?Ne(r,n):null}intersectInfiniteManifold(e,i,r){if(this.viewingMode===_t.Global)return this.intersectManifold(e,i,r);KH(this._coordinateSystem,i,this._tmpCoordinateSystem);const n=this._tmpCoordinateSystem.value,s=xt.get();return bE(n.plane,e,s)?Ne(r,s):null}toRenderCoords(e,i,r){return mU(e)?ud(e,i,this.spatialReference):el(e,i,r,this.spatialReference)}fromRenderCoords(e,i,r=null){return mU(i)?(r!=null&&(i.spatialReference=r),x8e(e,this.spatialReference,i)):l4t(i)?el(e,this.spatialReference,i,r)?i:null:w_(e,this.spatialReference,i)}static create(e,i){switch(e){case _t.Local:return new Pie(_t.Local,i,ws(i),Nft());case _t.Global:return new Pie(_t.Global,i,1,Dft(i))}}static renderUnitScaleFactor(e,i){return DZ(e)/DZ(i)}};var dy;(function(t){t[t.ELEVATION=0]="ELEVATION",t[t.BASEMAP=1]="BASEMAP",t[t.I3S_INDEX=2]="I3S_INDEX",t[t.I3S_DATA=3]="I3S_DATA",t[t.SYMBOLOGY=4]="SYMBOLOGY"})(dy||(dy={}));const u4t=(()=>{const t=new Array;return t[dy.ELEVATION]=10,t[dy.BASEMAP]=10,t[dy.I3S_INDEX]=10,t[dy.I3S_DATA]=10,t[dy.SYMBOLOGY]=5,t})(),h4t=30;function Y7e(t){return"usedMemory"in t&&"unloadedMemory"in t&&"ignoresMemoryFactor"in t}function d4t(t){return new Wc({view:t})}const s_e=.1,l8=1,pY=1,p4t=.75,f4t=.6,o_e=1.3;let Wc=class extends ze{constructor(e){super(e),this._quality=1,this._usedMemory=0,this._updating=!1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._memoryPredicted=0,this._cacheStorage=new qOe,this._warnMemoryUsage=null,this._numQualityChanges=0,this._maxMemory=750,this._additionalCacheMemory=0,this.addHandles(AT({prepare:()=>this._updateMemory()}))}destroy(){this._cacheStorage.destroy()}get maxMemory(){return this._maxMemory}set maxMemory(e){e==null||e<=0||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory1.1*pY||this._usedMemory>pY)&&(this._stableQuality>0?(this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality)):this._quality>s_e&&this._downscaleMemoryUsedpY)this._stableQuality=0,this._canFastRecover=!1,e=this._updateQuality(this._quality/o_e),this._downscaleMemoryUsed=this._memoryPredicted;else if(this._stableQuality!==this._quality)if(this._usedMemory!!e.updating)}_updateMemory(){var o,l,c,f,_;if(!this.view)return;(l=(o=this.view._stage)==null?void 0:o.renderer)==null||l.tick();let e=(((c=this.view.basemapTerrain)==null?void 0:c.usedMemory)??0)+(((_=(f=this.view._stage)==null?void 0:f.renderer)==null?void 0:_.usedMemory)??0),i=0;this.view.allLayerViews&&this.view.allLayerViews.forEach(x=>{if(Y7e(x)){const T=x.ignoresMemoryFactor?this._quality:1;e+=x.usedMemory*T,i+=x.unloadedMemory*T}});const r=this._warnMemoryUsage==null||Math.round(10*e)!==Math.round(10*this._warnMemoryUsage),n=1048576*this.maxMemory;if(e>n&&r){this._warnMemoryUsage=e;const x=A=>(A/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",T=Math.round(100*this._quality);Ce.getLogger(this).warn(`Memory Limit exceeded! Limit: ${x(n)} Current: ${x(e)} Projected: ${x(e+i)} Quality: ${T}%`)}this._usedMemory=e/n,this._memoryPredicted=(e+i)/n;const s=n-e;this._cacheStorage.maxSize=Math.max(0,s+1048576*this.additionalCacheMemory)}get test(){const e=this;return{cacheStorage:this._cacheStorage,resetQualityChanges:()=>{const i=e._numQualityChanges;return e._numQualityChanges=0,i}}}};y([w({constructOnly:!0})],Wc.prototype,"view",void 0),y([w()],Wc.prototype,"maxMemory",null),y([w()],Wc.prototype,"additionalCacheMemory",null),y([w({readOnly:!0})],Wc.prototype,"memoryFactor",null),y([w({readOnly:!0})],Wc.prototype,"updating",null),y([w({readOnly:!0})],Wc.prototype,"usedMemory",null),y([w({readOnly:!0})],Wc.prototype,"usedCacheMemory",null),y([w()],Wc.prototype,"_quality",void 0),y([w()],Wc.prototype,"_usedMemory",void 0),y([w()],Wc.prototype,"_updating",void 0),y([w()],Wc.prototype,"_stableQuality",void 0),y([w()],Wc.prototype,"_maxMemory",void 0),y([w()],Wc.prototype,"_additionalCacheMemory",void 0),Wc=y([Z("esri.views.3d.support.MemoryController")],Wc);let m4t=class{constructor(e){this.client=e,this._cancelled=!1,this.size=0,this.duration=0}},g4t=class{constructor(e){this.typeWorkerQuota=e,this.tasks=new Array,this.numWorkers=0,this.statistics=new y4t}},y4t=class{constructor(){this.requests=0,this.size=0,this.duration=0,this.speed=0}},v4t=class{constructor(e,i,r,n){this._workerFunc=e,this._callbackFunc=i,this._maxTotalNumWorkers=r,this._totalNumWorkers=0,this._clients=n.map(s=>new g4t(s))}destroy(){this._clients.length=0}hasQuota(e){const i=this._clients[e];return!!i&&(this._totalNumWorkersthis._taskCallback(r,n))):i.tasks.push(e))}cancel(e){this._taskFinished(e),e._cancelled=!0}_taskFinished(e){const i=this._clients[e.client];this._totalNumWorkers--,i&&(i.numWorkers--,i.statistics.requests++,i.statistics.size+=e.size||0,i.statistics.duration+=e.duration||0,i.statistics.speed=i.statistics.duration>0?i.statistics.size/i.statistics.duration:0,Xt(i.numWorkers>=0)),this._next()}_next(){for(const e of this._clients)if(e&&e.numWorkers0;)if(this._workerFunc(e.tasks.shift(),(i,r)=>this._taskCallback(i,r)))return e.numWorkers++,this._totalNumWorkers++,!0;return!1}_taskCallback(e,i){e._cancelled||(this._callbackFunc(e,i),this._taskFinished(e))}getStatsForType(e){const i=this._clients[e];return i?{quota:i.typeWorkerQuota,workers:i.numWorkers,queueSize:i.tasks.length,requestStats:i.statistics}:null}get test(){const e=this;return{set workerFunc(i){e._workerFunc=i}}}},ck=class extends ze{constructor(){super(...arguments),this._tasks=new Map,this._onLoadQueue=new Array,this._doneQueue=new Array,this.updating=!1}setup(e,i,r){this._loadQueue=new v4t((n,s)=>this._startLoading(n,s),(n,s)=>this._doneLoadingCB(n,s),e,i),r&&(this._frameTask=r.registerTask(ni.STREAM_DATA_LOADER,this))}destroy(){this._frameTask=en(this._frameTask),this._tasks.forEach(e=>gn(e.abortController)),this._loadQueue=et(this._loadQueue),this._onLoadQueue=null,this._doneQueue=null,this._tasks=null}hasDownloadSlots(e){return this._loadQueue.hasQuota(e)}request(e,i,r,n={}){const s=Jl();s.__signal=n!=null?n.signal:null;const o=this._createOrUpdateTask(e,i,r,n,s);return Yl(n,()=>this._cancelRequest(o,s)),s.promise}_createTask(e,i,r,n,s,o){const l=new x4t(e,i,r,n,s);return this._updateTask(l,o),this._tasks.set(s,l),this._tasks.size===1&&this._set("updating",!0),this._loadQueue.push(l),l}_cancelRequest(e,i){var r;Q$(e.resolvers,i),i.reject(ur()),e.resolvers.length===0&&(e.status===of.DOWNLOADING&&(e.status=of.CANCELLED,this._loadQueue.cancel(e),(r=e.abortController)==null||r.abort(),e.request=null,e.abortController=null),e.status=of.CANCELLED,this._tasks.delete(e.key),this._tasks.size===0&&this._set("updating",!1))}_updateTask(e,i){e.resolvers.push(i)}_createOrUpdateTask(e,i,r,n,s){const o=S4t((n==null?void 0:n.uid)||e,i,r),l=this._tasks.get(o);return l?(this._updateTask(l,s),l):this._createTask(e,n,i,r,o,s)}_doneLoadingCB(e,i){this._loadQueue&&(Xt(e.status===of.DOWNLOADING),e.status=of.DOWNLOADED,this._frameTask?this._doneQueue.push({task:e,err:i}):this._doneLoading(e,i))}get running(){return this._doneQueue.length>0||this._onLoadQueue.length>0}runTask(e){for(;!e.done&&this._onLoadQueue.length>0;){const i=this._onLoadQueue.shift();St(i.task.abortController),i.task.abortController=null,i.callback(i.task),e.madeProgress()}for(;!e.done&&this._doneQueue.length>0;){const i=this._doneQueue.shift();i.task.status!==of.DOWNLOADED&&(i.err=i.err||ur()),this._doneLoading(i.task,i.err),e.madeProgress()}}_doneLoading(e,i){if(i&&!sn(i)&&e.numRetries>0)return--e.numRetries,void this._loadQueue.push(e);let r=e.result instanceof HTMLImageElement?0:e.resolvers.length;for(const n of e.resolvers)if(i)sn(i)?n.reject(i):n.reject(new se("stream-data-loader:request-error",`Failed to request resource at '${e.url}'. ${i}`,{url:e.url,error:i}));else{--r;const s=r>0?Re(e.result):e.result;n.resolve(s)}this._tasks.delete(e.key),this._tasks.size===0&&this._set("updating",!1)}_startLoading(e,i){if(e.status===of.CANCELLED)return!1;let r,n;switch(e.startTime=performance.now(),e.status=of.DOWNLOADING,e.docType){case"binary":n="array-buffer",r=0;break;case"image":n="image";break;case"image+type":n="array-buffer";break;default:n="json"}e.abortController=new AbortController;const s=e.abortController.signal;e.request=bi(e.url,{...e.options,responseType:n,timeout:r,signal:s});let o=()=>{};const l=f=>{e.duration=performance.now()-e.startTime,e.size=f instanceof ArrayBuffer?f.byteLength:e.size||0,e.result=f,this._frameTask?this._onLoadQueue.push({callback:i,task:e}):(e.abortController=null,i(e))},c=f=>{e.status===of.DOWNLOADING&&i(e,f),o()};return e.docType!=="image+type"?(e.request.then(f=>l(f.data),c),!0):(e.request.then(f=>{const _=f.data,x=b4t(_);if(n="image",e.size=_.byteLength,x==="unknown")return e.request=bi(e.url,{responseType:n,timeout:r,signal:s}),void e.request.then(M=>l(M.data),c);const T=new Blob([_],{type:x}),A=window.URL.createObjectURL(T);o=()=>window.URL.revokeObjectURL(A),e.request=bi(A,{responseType:n,timeout:r,signal:s}),e.request.then(M=>l(new wce(M.data,x,o)),c)},c),!0)}get test(){return{loadQueue:this._loadQueue}}};y([w({readOnly:!0})],ck.prototype,"updating",void 0),ck=y([Z("esri.views.3d.support.StreamDataLoader")],ck);const _4t={numRetries:0};function b4t(t){if(t.byteLength<2)return"unknown";const e=new Uint8Array(t,0,t.byteLength);return e[0]===137&&e[1]===80?"image/png":e[0]===71&&e[1]===73?"image/gif":e[0]===66&&e[1]===77?"image/bmp":e[0]===255&&e[1]===216?"image/jpeg":"unknown"}let wce=class{constructor(e,i,r){this.image=e,this.type=i,this.release=r}get isOpaque(){return this.type==="image/jpeg"}};function w4t(t){return"image"in t&&"type"in t}let x4t=class extends m4t{constructor(e,i,r,n,s){super(n),this.url=e,this.options=i,this.docType=r,this.key=s,this.result=null,this.status=of.QUEUED,this.request=null,this.abortController=null,this.resolvers=new Array,this.startTime=0,this.numRetries=_4t.numRetries}};function S4t(t,e,i){return`${t}:${e}:${i}`}var of;(function(t){t[t.QUEUED=1]="QUEUED",t[t.DOWNLOADING=2]="DOWNLOADING",t[t.DOWNLOADED=3]="DOWNLOADED",t[t.CANCELLED=4]="CANCELLED"})(of||(of={}));let uk=class extends ze{constructor(){super(...arguments),this.updating=!1}};function T4t(t){return new U0({view:t})}y([w({readOnly:!0})],uk.prototype,"updating",void 0),uk=y([Z("esri.views.3d.support.ResourceControllerMain")],uk);let U0=class extends uk{constructor(){super(...arguments),this._immediateTask=g5,this._normalTask=g5,this._updatingObjects=m5([]),this._frameTask=null}get immediate(){return this._immediateTask}get normal(){return this._normalTask}initialize(){this._scheduler=Rpt(),this._memoryController=d4t(this.view),this._streamDataLoader=new ck,this._streamDataLoader.setup(h4t,u4t,this._scheduler),this.addHandles([_e(()=>{var e;return(e=this.view.state)==null?void 0:e.mode},e=>{e!=null&&(this._scheduler.state=e)},Li),_e(()=>this.view.stationary,()=>this._stationaryChangedHandler())]),this._frameTask=AT({update:e=>this._frame(e)}),this._immediateTask=this._scheduler.registerTask(ni.RESOURCE_CONTROLLER_IMMEDIATE),this._normalTask=this._scheduler.registerTask(ni.RESOURCE_CONTROLLER)}destroy(){this._immediateTask.remove(),this._normalTask.remove(),this._frameTask=en(this._frameTask),this._streamDataLoader=et(this._streamDataLoader),this._memoryController=et(this._memoryController),this._scheduler=et(this._scheduler),this.view=null}get updating(){var e,i,r,n;return!!((e=this._memoryController)!=null&&e.updating||(i=this._streamDataLoader)!=null&&i.updating||(r=this._immediateTask)!=null&&r.updating)||((n=this._updatingObjects)==null?void 0:n.value.some(s=>s.updating))}get scheduler(){return this._scheduler}get memoryController(){return this._memoryController}createStreamDataRequester(e){const i=this._streamDataLoader;return{request:(r,n,s)=>i.request(r,n,e,s),get busy(){return!i.hasDownloadSlots(e)}}}addUpdatingObject(e){const i=this._updatingObjects;return i.value=[...i.value,e],rr(()=>{i.value=i.value.filter(r=>r!==e)})}_frame(e){this.view.suspended||this.view.stateManager&&(this.view.stateManager.step(Qre(e.deltaTime)),!this._scheduler)||(this._memoryController.update(),this._scheduler.updateBudget(e)&&this._scheduler.frame())}_stationaryChangedHandler(){this.memoryController.resetStableQuality()}get test(){return{getQueueStats:e=>this._streamDataLoader.test.loadQueue.getStatsForType(e)}}};y([w()],U0.prototype,"view",void 0),y([w()],U0.prototype,"_scheduler",void 0),y([w()],U0.prototype,"_memoryController",void 0),y([w()],U0.prototype,"_streamDataLoader",void 0),y([w()],U0.prototype,"_immediateTask",void 0),y([w()],U0.prototype,"_normalTask",void 0),y([w()],U0.prototype,"_updatingObjects",void 0),y([w({readOnly:!0})],U0.prototype,"updating",null),U0=y([Z("esri.views.3d.support.ResourceControllerImpl")],U0);function E4t(t){return Y7e(t)}function C4t(t){return"performanceInfo"in t}var gc,ti;(function(t){t[t.INSIDE=0]="INSIDE",t[t.INTERSECTS=1]="INTERSECTS",t[t.OUTSIDE=2]="OUTSIDE"})(gc||(gc={})),function(t){t[t.NORTH=0]="NORTH",t[t.NORTH_EAST=1]="NORTH_EAST",t[t.EAST=2]="EAST",t[t.SOUTH_EAST=3]="SOUTH_EAST",t[t.SOUTH=4]="SOUTH",t[t.SOUTH_WEST=5]="SOUTH_WEST",t[t.WEST=6]="WEST",t[t.NORTH_WEST=7]="NORTH_WEST"}(ti||(ti={}));const RC=W(),A4t=W(),A1=W(),M1=W();function M4t(t,e,i=0){const r=t.extent;if(r==null)return!1;if(i===0)return CAe(r,e);const n=Math.min(r[2]-r[0],r[3]-r[1]);return Tet(r,e,i*n)}function c8(t,e,i,r){Ne(RC,i),RC[r]=e[r];const n=je(RC,RC,e),s=je(A4t,t,e),o=Ve(s,n),l=Ve(n,n);let c;c=o<=0?e:l<=o?i:Be(RC,e,De(n,n,o/l));const f=je(RC,t,c);return Math.PI/2-Math.atan(f[2]/Math.sqrt(f[0]*f[0]+f[1]*f[1]))}function O4t(t,e,i){const r=t.extent;if(r==null)return 0;A1[0]=r[0],A1[1]=r[1],A1[2]=i,M1[0]=r[2],M1[1]=r[3],M1[2]=i;let n=1/0,s=1/0;return e[0]M1[0]&&(n=c8(e,M1,A1,0)),e[1]M1[1]&&(s=c8(e,M1,A1,1)),Math.min(n,s)}function P4t(t,e,i){if(t==null)return lae();if(t.spatialReference.isGeographic&&!D2(t.spatialReference))return new se("tilingscheme:local-unsupported-spatial-reference","The tiling scheme spatial reference is not supported in local scenes");const r=Bu.checkUnsupported(t);if(r!=null)return r;if(i==null)return new se("tilingscheme:extent-not-exist","The layer does not provide a layer extent.");const n=R4t(t,i);if(n)return n;const s=t.spatialReference;return e==null||s.equals(e)||e.isWGS84&&s.isWebMercator?null:new se("tilingscheme:spatial-reference-mismatch","The tiling scheme does not match the spatial reference of the local scene")}function R4t(t,e){const i=t.lods,r=i[0].resolution*2**i[0].level,n=[r*t.size[0],r*t.size[1]],s=[t.origin.x,t.origin.y],o=ase(e),l=Ni();Bu.computeRowColExtent(o,n,s,l);const c=(l[2]-l[0])*(l[3]-l[1]);if(c>PM){const f=i[0].scale*2**i[0].level;let _=Math.max((o[3]-o[1])/t.size[1],(o[2]-o[0])/t.size[0])*f/r;const x=Math.floor(Math.log(_)/Math.log(10));return _=Math.ceil(_/10**x)*10**x,new se("tilingscheme:too-many-root-tiles","Scale of level 0 of the tiling scheme (1:"+Math.floor(f).toLocaleString()+") is too large for the layer's extent. Suggested scale: 1:"+_.toLocaleString()+".",{level0Scale:f,suggestedLevel0Scale:_,requiredNumRootTiles:c,allowedNumRootTiles:PM})}return null}const I4t=Object.freeze(Object.defineProperty({__proto__:null,checkIfTileInfoSupportedForViewSR:P4t,isInsideExtent:M4t,tiltToExtentEdge:O4t},Symbol.toStringTag,{value:"Module"}));function $4t(){return!0}function L4t(){return 0}function D4t(t,e){if(t==null)return lae();const i=t.lods.length-1,r=t.spatialReference,n=D2(r)||r1(r)||n1(r);if(r.isWebMercator){if(!Bu.makeWebMercatorAuxiliarySphere(i).compatibleWith(t))return new se("tilingscheme:incompatible-global-web-mercator","The tiling scheme is not compatible with the ArcGIS Online Web Mercator tiling scheme")}else{if(!n)return new se("tilingscheme:global-unsupported-spatial-reference","The tiling scheme spatial reference is not supported in global scenes");if(!Bu.makeGCSWithTileSize(t.spatialReference,t.size[0],i).compatibleWith(t))return t.spatialReference.isWGS84?new se("tilingscheme:incompatible-global-wgs84","The tiling scheme is not compatible with the ArcGIS Online WGS84 tiling scheme"):new se("tilingscheme:incompatible-global","The tiling scheme is not compatible with the ArcGIS Online tiling scheme")}return e==null||t.spatialReference.equals(e)?void 0:new se("tilingscheme:spatial-reference-mismatch","The tiling scheme does not match the spatial reference of the global scene")}const N4t=Object.freeze(Object.defineProperty({__proto__:null,checkIfTileInfoSupportedForViewSR:D4t,isInsideExtent:$4t,tiltToExtentEdge:L4t},Symbol.toStringTag,{value:"Module"})),F4t={[_t.Global]:N4t,[_t.Local]:I4t};function ry(t,e){t||console.warn("Terrain: "+e)}let pa=!1,oV=!1;function k4t(t){oV=t,pa=pa||t}function z4t(t){pa=t}function ot(t,e){var i;if(pa&&!t){const r=(i=new Error().stack)==null?void 0:i.slice(5);throw console.warn("Terrain internal: "+(e??"")+" at "+r),new Error("Assertion failed"+(e?": "+e:""))}}function Rie(t){return xG(t)?{fullExtent:t.fullExtent,minScale:t.layer.minScale,maxScale:t.layer.maxScale,tilemapCache:null}:t.layer}function aV(t){return(t==null?void 0:t.type)==="imagery-tile"||(t==null?void 0:t.type)==="wcs"}function xG(t){return(t==null?void 0:t.type)==="imagery-tile-3d"}function xce(t){return(t==null?void 0:t.type)==="tile-3d"}function L5(t){return(t==null?void 0:t.type)==="vector-tile-3d"}function X7e(t){return(t==null?void 0:t.type)==="wmts-3d"}function Iie(t){return(t==null?void 0:t.type)==="elevation-3d"}function PR(t){return(t==null?void 0:t.type)==="group"}function ZL(t){return t&&(xce(t)||X7e(t)||xG(t)||L5(t))}function $ie(t){return t&&(xce(t)||xG(t)||L5(t)||X7e(t))}function JL(t){return $ie(t)||Iie(t)}function U4t(t){var i;const e=(i=t==null?void 0:t.sourceLayerInfo)==null?void 0:i.data;return e!=null&&"type"in e&&e.type==="raster-tile"}function V4t(t){return Z7e(t==null?void 0:t.sourceLayerInfo)||!!(t!=null&&t.isVTLBackground)}function B4t(t){var i;const e=(i=t==null?void 0:t.sourceLayerInfo)==null?void 0:i.data;return e!=null&&"type"in e&&e.type==="tile-texture"}function j4t(t){var i;const e=(i=t==null?void 0:t.sourceLayerInfo)==null?void 0:i.data;return e instanceof HTMLImageElement||e instanceof wce||e instanceof HTMLCanvasElement||e instanceof ImageData}function Z7e(t){return(t==null?void 0:t.data)!=null&&"type"in t.data&&t.data.type==="vector-tile"}function CO(t){return t!=null&&"release"in t&&t.release(),null}function a_e(t){return t.fetchTile&&t.hasOverriddenFetchTile!==!1}function KL(t,e,i,r){return F4t[r].checkIfTileInfoSupportedForViewSR(t,i,e)}function SG(t,e,i){let r=null,n=null;if((t==null?void 0:t.type)==="wmts"){const s=J7e(t,e,i);r=s.tileInfo,n=s.fullExtent}else{n=aV(t)?t.getCompatibleFullExtent(e):t.fullExtent;const s=i===_t.Local;if(aV(t))r=t.getCompatibleTileInfo(e,n,s);else if((t==null?void 0:t.type)==="vector-tile"){const o=s&&!G4t(e)||H4t.force512VTL,l=t.tileInfo.spatialReference.isGeographic;r=o?t.tileInfo:t.tileInfo.getOrCreateCompatible(256,l?1:2)}else r=t.tileInfo}return r!=null&&n!=null&&KL(r,n,e,i)==null?{tileInfo:r,fullExtent:n}:null}function J7e(t,e,i){const r=Unt(t);if(r!=null){if(!it.isCollection(r))return{tileInfo:r.tileInfo,fullExtent:r.fullExtent};{const n=r.find(s=>KL(s.tileInfo,s.fullExtent,e,i)==null);if(n)return{tileInfo:n.tileInfo,fullExtent:n.fullExtent}}}return{tileInfo:null,fullExtent:null}}function G4t(t){return t.isWGS84||t.isWebMercator||DCe(t)||!VO(t)}const H4t={force512VTL:!1};function l_e(t){return"["+t[0]+","+t[1]+","+t[2]+"]"}function O1(t){return"("+t[0]+","+t[1]+","+t[2]+")"}function bf(t,e,i=Y4t){return Math.abs(t-e){(E4t(f)||JL(f))&&this.layerPerformanceInfos.push(new X4t(f,e))}),this.layerPerformanceInfos.sort((f,_)=>_.memory-f.memory)}},J4t=class{constructor(e){this._gltfLoading=new Map,this._wosrLoading=new Map,this._gltfMemCache=e("gltf-resources",()=>{}),this._wosrMemCache=e("wosr-resources",()=>{})}destroy(){this._gltfLoading.forEach(e=>e.abortController.abort()),this._wosrLoading.forEach(e=>e.abortController.abort()),this._gltfMemCache.destroy(),this._wosrMemCache.destroy()}loadGLTF(e,i,r){const n=r?`gltfPBR:${e}`:`gltf:${e}`,s=this._gltfMemCache.get(n);return s!=null?Promise.resolve(s):this._loadOnce(this._gltfLoading,this._gltfMemCache,n,o=>X8e(new W8e(o.streamDataRequester),e,o,r),i)}loadWOSR(e,i){const r=`wosr:${e}:${i.disableTextures}`,n=this._wosrMemCache.get(r);return n!=null?Promise.resolve(n):this._loadOnce(this._wosrLoading,this._wosrMemCache,r,s=>Z8e(e,s),i)}async _loadOnce(e,i,r,n,s){St(s);const o=Yl(s,()=>this._abortLoad(e,r));let l=e.get(r);if(l)l.refCount++;else{const c=new AbortController;l={refCount:1,abortController:c,promise:n({...s,signal:c.signal})},e.set(r,l)}try{const c=await l.promise;return i.put(r,c,c.size),e.delete(r),St(s),c}finally{en(o)}}_abortLoad(e,i){const r=e.get(i);r!=null&&--r.refCount>0||(e.delete(i),r!=null&&r.abortController.abort())}},VM=class extends ze{constructor(e,i){super({}),this._stage=e,this._textureRequests=new Map,this._frameTask=(i==null?void 0:i.registerTask(ni.TEXTURE_UNLOAD))??g5}normalizeCtorArgs(){return{}}destroy(){var e,i,r;super.destroy(),(e=this._frameTask)==null||e.remove(),(i=this._textureRequests)==null||i.forEach(n=>this._releaseTextureRequest(n)),(r=this._textureRequests)==null||r.clear()}get updating(){return this._frameTask.updating}fromData(e,i){const r=this.makeUid(e);let n=this._textureRequests.get(r);if(!n){const s=new K7e;s.texture=i(),this._stage&&(s.texture.load(this._stage.renderView.renderingContext),this._stage.add(s.texture)),this._textureRequests.set(r,s),n=s}return n.referenceCount++,{uid:r,texture:n.texture,release:()=>this._release(r)}}_release(e){const i=this._textureRequests.get(e);i?(i.referenceCount<1&&console.warn("TextureCollection: reference count is < 1 for "+e),i.referenceCount--,i.referenceCount<1&&this._frameTask.schedule(()=>this._releaseNow(e))):console.warn(`TextureCollection: texture doesn't exist: '${e}'`)}get test(){return{textureRequests:this._textureRequests}}_releaseNow(e){var r;if(!this._textureRequests)return;const i=this._textureRequests.get(e);!i||i.referenceCount>0||((r=i.texture)==null||r.unload(),this._releaseTextureRequest(i),this._textureRequests.delete(e))}_releaseTextureRequest(e){var i;e.texture?(i=this._stage)==null||i.remove(e.texture):e.abortController&&(e.abortController.abort(),e.abortController=null)}makeUid(e,i=null){return i!=null?`${e}.${i}px`:e}};y([w()],VM.prototype,"_frameTask",void 0),y([w()],VM.prototype,"updating",null),VM=y([Z("esri.views.3d.support.TextureCollection")],VM);let K7e=class{constructor(){this.referenceCount=0}},K4t=class extends VM{constructor(e,i,r){super(i,r),this._streamDataRequester=e}async fromUrl(e,i,r){St(r);const n=r!=null?r.signal:null,s=this.makeUid(e,i);let o=this._textureRequests.get(s);if(!o){const l=new AbortController,c=this._streamDataRequester.request(e,"image",{uid:s,signal:l.signal});o=new K7e,o.abortController=l;const f=o;this._textureRequests.set(s,o),o.textureAsync=c.then(async _=>{const x=this._createTexture(e,_,i);return f.texture=x,f.abortController=null,await x.load(this._stage.renderView.renderingContext),this._stage.add(x),{uid:s,texture:x,release:()=>this._release(s)}},_=>{throw f.abortController=null,_})}o.referenceCount++;try{return await oT(o.textureAsync,n)}catch(l){throw this._release(s),l}}_createTexture(e,i,r){var s;const n={width:i.width,height:i.height,wrap:{s:Bi.CLAMP_TO_EDGE,t:Bi.CLAMP_TO_EDGE},preMultiplyAlpha:!0,reloadable:!0};if(gEe(e)){if(r||i.width===0&&i.height===0){const o=i.width?i.height/i.width:1;r=r||64,o>1?(i.width=Math.round(r/o),i.height=r):(i.width=r,i.height=Math.round(r*o))}(s=this._stage.renderView)!=null&&s.renderingContext.driverTest.svgPremultipliesAlpha.result&&(n.preMultiplyAlpha=!1)}return new OE(i,n)}},Q4t=class{constructor(e){this.streamDataRequester=null,this._graphicsOwners=[],this._screenSizePerspectiveHandles=null,this.cimSymbolRasterizer=null,this._viewState=e.viewState,this._view=e.view,this._pointsOfInterest=e.pointsOfInterest,this.streamDataRequester=e.resourceController.createStreamDataRequester(dy.SYMBOLOGY),this.objectResourceCache=new J4t((r,n)=>e.resourceController.memoryController.newCache(r,n)),this.textures=new K4t(this.streamDataRequester,e.view._stage,e.resourceController.scheduler);const i=Sr(this._view.spatialReference).radius;this.screenSizePerspectiveSettings=R9e(e.viewingMode,i),this.screenSizePerspectiveSettingsLabels=b2t(e.viewingMode,i)}destroy(){this.textures.destroy(),this.streamDataRequester=null}addGraphicsOwner(e){if(!e)return rr();this._graphicsOwners.push(e);const i=_e(()=>{var r;return(r=e.layer)==null?void 0:r.screenSizePerspectiveEnabled},()=>this._updateScreenSizePerspectiveEnabled());return this._updateScreenSizePerspectiveEnabled(),rr(()=>{i.remove(),Q$(this._graphicsOwners,e),this._updateScreenSizePerspectiveEnabled()})}_updateScreenSizePerspectiveEnabled(){const e=this._graphicsOwners.some(i=>{var r;return((r=i.layer)==null?void 0:r.screenSizePerspectiveEnabled)===!0});if(e&&!this._screenSizePerspectiveHandles){this._screenSizePerspectiveHandles=new O_;const i=()=>this._updateScreenSizePerspectiveSettings();this._screenSizePerspectiveHandles.add([_e(()=>this._pointsOfInterest.centerOnSurfaceInfrequent.distance,i,Li),this._viewState.events.on("camera-projection-changed",i)]),this._updateScreenSizePerspectiveSettings()}else e||(this._screenSizePerspectiveHandles=et(this._screenSizePerspectiveHandles))}_updateScreenSizePerspectiveSettings(){const e=this._pointsOfInterest;u8.distance=e.centerOnSurfaceInfrequent.distance,u8.fovY=this._viewState.camera.fovY,this.screenSizePerspectiveSettings.update(u8),this.screenSizePerspectiveSettingsLabels.update(u8),this._view._stage.renderView.requestRender()}get test(){return{screenSizePerspectiveHandles:this._screenSizePerspectiveHandles}}};const u8={distance:0,fovY:0};let ZA=class{constructor(e,i,r=""){this.graphics=e,this._symbol=new t2({symbolLayers:new it([new e2({material:{color:i},outline:{color:[255,255,255],size:1},resource:{primitive:"circle"}}),new fE({text:r,halo:{color:"white",size:1/.75},material:{color:i},size:12})])})}show(e,i){if(i==null)return;this.hide();const r=new mt({x:e[0],y:e[1],z:e[2],spatialReference:i});this._graphic=new Ml({geometry:r,symbol:this._symbol}),this.graphics.add(this._graphic)}hide(){this._graphic!=null&&(this.graphics.remove(this._graphic),this._graphic=null)}},Ww=class extends ze{constructor(e){super(e)}};y([w({constructOnly:!0})],Ww.prototype,"renderCoordsHelper",void 0),y([w({constructOnly:!0})],Ww.prototype,"surface",void 0),y([w({constructOnly:!0})],Ww.prototype,"state",void 0),Ww=y([Z("esri.views.3d.support.PointOfInterest")],Ww);const eIt=Array;let V0=class extends Ww{constructor(e){super(e),this._dirty=!1,this._propertiesPool=new x_({location:mt,renderLocation:eIt},this),this._estimatedSurfaceAltitude=0,this._pendingElevationQueryController=null,this.renderLocation=W(),this._tmpPoint=new mt}initialize(){if(this.scheduler&&this.addHandles(this.scheduler.registerTask(this.task,this)),this.runTask(),this.map){const e=()=>this._setDirty();this.addHandles(Jr(()=>{var i,r;return(r=(i=this.map)==null?void 0:i.ground)==null?void 0:r.layers},"change",e,{onListenerAdd:e,onListenerRemove:e}))}this._updateRenderLocation()}destroy(){this._cancelPendingRequest(),this._propertiesPool=et(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const e=this._propertiesPool.get("location");return this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e,this.state.spatialReference),e}get scale(){const e=this._camera,i=Sn(e.eye,this.renderLocation),r={renderCoordsHelper:this.renderCoordsHelper,state:{camera:e}};return qT(r,i,0)}get updating(){return this._dirty||this._pendingElevationQueryController!=null}updateRenderLocation(){this._setDirty(),this._updateRenderLocation()}_setDirty(){this._dirty||(this._dirty=!0,this.notifyChange("updating"))}_cancelPendingRequest(){const e=this._pendingElevationQueryController;e&&(this._pendingElevationQueryController=null,e.abort(),this.notifyChange("updating"))}get running(){return!this._pendingElevationQueryController&&this._dirty}runTask(){var n;if(this._cancelPendingRequest(),this._dirty=!1,this.notifyChange("updating"),!((n=this.map)!=null&&n.ground))return this._updateSurfaceAltitude(0),Xl.YIELD;const e=this.state.spatialReference;this.renderCoordsHelper.fromRenderCoords(this._camera.eye,this._tmpPoint,e);const i=(this._tmpPoint.z??0)>tIt&&this.renderCoordsHelper.viewingMode===_t.Global&&(e.isWGS84||e.isWebMercator);let r=new AbortController;return this.map.ground.queryElevation(this._tmpPoint,{signal:r.signal,cache:this.cache,minDemResolution:i?iIt:0}).then(s=>this._updateSurfaceAltitude(s.geometry.z??0)).catch(s=>{sn(s)||this._updateSurfaceAltitude(0)}).catch(()=>{}).then(()=>{this._pendingElevationQueryController===r&&(this._pendingElevationQueryController=null,this.notifyChange("updating")),r=null}),this._pendingElevationQueryController=r,Xl.YIELD}_updateSurfaceAltitude(e){this._estimatedSurfaceAltitude!==e&&(this._estimatedSurfaceAltitude=e,this._updateRenderLocation())}_updateRenderLocation(){this.renderCoordsHelper.setAltitude(fY,this._estimatedSurfaceAltitude,this._camera.eye),jr(this._get("renderLocation"),fY)||(this._set("renderLocation",Ne(this._propertiesPool.get("renderLocation"),fY)),this.notifyChange("renderLocation"))}};y([w({constructOnly:!0})],V0.prototype,"scheduler",void 0),y([w({constructOnly:!0})],V0.prototype,"cache",void 0),y([w({constructOnly:!0})],V0.prototype,"task",void 0),y([w({readOnly:!0})],V0.prototype,"location",null),y([w({constructOnly:!0})],V0.prototype,"map",void 0),y([w({readOnly:!0})],V0.prototype,"renderLocation",void 0),y([w({readOnly:!0})],V0.prototype,"scale",null),y([w({readOnly:!0})],V0.prototype,"updating",null),V0=y([Z("esri.views.3d.support.CameraOnSurface")],V0);const fY=W(),tIt=1e5,iIt=1e6,rIt=Array;let af=class extends Ww{constructor(e){super(e),this._propertiesPool=new x_({location:mt,renderLocation:rIt},this),this._currentSurfaceAltitude=0,this._latestSurfaceAltitude=0,this.distance=0,this.renderLocation=W(),this.updating=!1}initialize(){this._frameWorker=this.scheduler.registerTask(this.task,this),this.runTask()}destroy(){this._frameWorker=en(this._frameWorker),this._propertiesPool=et(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const e=this._propertiesPool.get("location");return this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e,this.state.spatialReference),e}updateRenderLocation(){this.updating=!0,this._updateRenderLocation()}get estimatedSurfaceAltitude(){return this._latestSurfaceAltitude}get running(){return this.updating}runTask(){return this._latestSurfaceAltitude=this.estimateSurfaceAltitudeAtCenter(),this._updateRenderLocation(),this.updating=!1,Xl.YIELD}_updateRenderLocation(){const e=sIt;let i=this._calculateSurfaceIntersection(this._currentSurfaceAltitude,e);const r=this._currentSurfaceAltitude!==this._latestSurfaceAltitude;!i&&r&&(i=this._calculateSurfaceIntersection(this._latestSurfaceAltitude,e),i&&(this._currentSurfaceAltitude=this._latestSurfaceAltitude));const n=oIt;i&&this._latestSurfaceAltitudeChangesDistanceSignificantly(e,n)&&(Ne(e,n),this._currentSurfaceAltitude=this._latestSurfaceAltitude),i?this.distance=Sn(this._camera.eye,e):(De(e,this._camera.viewForward,this._get("distance")),Be(e,e,this._camera.eye)),jr(this._get("renderLocation"),e)||this._set("renderLocation",Ne(this._propertiesPool.get("renderLocation"),e))}_calculateSurfaceIntersection(e,i){var n,s;const r=this._camera;if(!this.renderCoordsHelper.intersectInfiniteManifold(r.ray,e,i))return!1;if(this.state.isGlobal){const o=Sr(this.renderCoordsHelper.spatialReference).radius,l=o+e,c=El(r.eye),f=co/4){const x=l-Math.sqrt(c);return De(i,r.viewForward,x),Be(i,i,r.eye),!0}}else{const o=(n=this.surface)!=null&&n.ready?this.surface.extent:null;o!=null&&mj(o,(s=this.surface)==null?void 0:s.spatialReference,RR,this.renderCoordsHelper.spatialReference)&&(i[0]=Je(i[0],RR[0],RR[2]),i[1]=Je(i[1],RR[1],RR[3]))}return!0}_latestSurfaceAltitudeChangesDistanceSignificantly(e,i){if(this._latestSurfaceAltitude===this._currentSurfaceAltitude||e==null)return!1;if(this._calculateSurfaceIntersection(this._latestSurfaceAltitude,i)){if(Tn.TESTS_DISABLE_OPTIMIZATIONS)return!0;const r=this._camera.eye,n=Sn(r,e),s=Sn(r,i);if(Math.abs(s-n)/n>nIt)return!0}return!1}};y([w({constructOnly:!0})],af.prototype,"scheduler",void 0),y([w({constructOnly:!0})],af.prototype,"task",void 0),y([w()],af.prototype,"distance",void 0),y([w({constructOnly:!0})],af.prototype,"estimateSurfaceAltitudeAtCenter",void 0),y([w({readOnly:!0})],af.prototype,"location",null),y([w({readOnly:!0})],af.prototype,"renderLocation",void 0),y([w()],af.prototype,"updating",void 0),af=y([Z("esri.views.3d.support.CenterOnSurface")],af);const nIt=.05,sIt=W(),oIt=W(),RR=Ni();let aIt=class{constructor(e){this._handles=new O_,this.events=new Dn,this._contentLayerViews=e.contentLayerViews,this._handles.add(this._contentLayerViews.on("change",i=>this._layerViewsChanged(i))),this._layerViewsChanged({added:this._contentLayerViews.toArray(),removed:[],moved:[],target:this._contentLayerViews})}destroy(){this._handles=et(this._handles),this._contentLayerViews.destroy()}_layerViewsChanged(e){e.added.forEach(i=>{i.declaredClass==="esri.views.3d.layers.SceneLayerView3D"&&this._handles.add(i.on("visible-geometry-changed",()=>this._contentChanged()),i.uid)}),e.removed.forEach(i=>this._handles.remove(i.uid))}_contentChanged(){this.events.emit("request-update",lIt)}};const lIt={},cIt=Array;let Ng=class extends Ww{constructor(e){super(e),this._propertiesPool=new x_({location:mt,renderLocation:cIt},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get("renderLocation")}initialize(){this.addHandles([_e(()=>this.centerOnSurface.renderLocation,()=>this.updateRenderLocation()),_e(()=>this.state.contentCamera,()=>this.updateRenderLocation())]),this.scheduler&&this.addHandles(this.scheduler.registerTask(ni.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool=et(this._propertiesPool)}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){const e=this._propertiesPool.get("location");return this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e,this.state.spatialReference),e}get running(){return this._dirty}runTask(){const e=this._get("renderLocation"),i=this.centerOnSurface.renderLocation,r=this.renderCoordsHelper,n=this.state.contentCamera;this._dirty=!1,r.worldUpAtPosition(i,p_e);const s=Math.max(0,(Math.acos(Ve(p_e,n.viewForward))-.5*Math.PI)*(n.aboveGround?1:-1));if(Number.isNaN(s)){if(!e||!M2(e,i)){const f=this._propertiesPool.get("renderLocation");Ne(f,i),this._set("renderLocation",f)}return Xl.YIELD}const o=1-Je(s/(.5*Math.PI),0,1),l=o*o*o;this._calculateScreenHorizontalEdgeOnSurface(f_e);const c=this._propertiesPool.get("renderLocation");return Qr(c,i,f_e,l),e&&M2(e,c)||this._set("renderLocation",c),Xl.YIELD}_calculateScreenHorizontalEdgeOnSurface(e){const i=this.state.contentCamera,r=i.getRenderCenter(Za());if(r[1]=i.aboveGround?i.padding[er.BOTTOM]:i.fullHeight-i.padding[er.TOP],this.estimateSurfaceIntersectionAtRenderPoint(r,e))return e;const n=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(i.unprojectFromRenderScreen(r,IR)){je(IR,IR,i.eye);const s=Ye(IR,IR);if(this.renderCoordsHelper.intersectInfiniteManifold(Sp(i.eye,s),n,e))return e}return this.renderCoordsHelper.setAltitude(e,n,i.eye)}updateRenderLocation(){this._dirty=!0}};y([w()],Ng.prototype,"_dirty",void 0),y([w({constructOnly:!0})],Ng.prototype,"scheduler",void 0),y([w({constructOnly:!0})],Ng.prototype,"centerOnSurface",void 0),y([w({constructOnly:!0})],Ng.prototype,"estimateSurfaceIntersectionAtRenderPoint",void 0),y([w({readOnly:!0})],Ng.prototype,"updating",null),y([w({readOnly:!0})],Ng.prototype,"location",null),y([w({readOnly:!0})],Ng.prototype,"renderLocation",void 0),Ng=y([Z("esri.views.3d.support.pointsOfInterest.Focus")],Ng);const p_e=W(),IR=W(),f_e=W();let iv=class extends ze{get surface(){var e;return(e=this.view.map)==null?void 0:e.ground}get surfaceView(){return this.view.basemapTerrain}get renderLocation(){if(!this.location)return null;const e=W();return this.view.renderCoordsHelper.toRenderCoords(this.location,e),e}constructor(e){super(e),this.location=null,this._updateController=null}initialize(){this.view.state.isLocal&&(this.addHandles([_e(()=>{var e,i;return[(e=this.surfaceView)==null?void 0:e.spatialReference,(i=this.surfaceView)==null?void 0:i.extent]},()=>this._update()),Jr(()=>{var e;return(e=this.surface)==null?void 0:e.layers},"change",()=>this._update())]),this._update())}_update(){var r;if(this._updateController&&(this._updateController.abort(),this._updateController=null),((r=this.surfaceView)==null?void 0:r.extent)==null||this.surfaceView.spatialReference==null)return void this._set("location",null);const e=lse(this.surfaceView.extent),i=new mt({x:e[0],y:e[1],z:0,spatialReference:this.surfaceView.spatialReference});this.surface&&this.surface.layers.length>0?(this._set("location",null),this._updateController=new AbortController,this.surface.queryElevation(i,{noDataValue:0,signal:this._updateController.signal,cache:this.cache}).then(n=>{this._updateController=null,this._set("location",n.geometry)}).catch(n=>{sn(n)||n&&n.name==="elevation-query:invalid-layer"||console.error("StableSurfaceCenter failed to update: ",n)})):this._set("location",i)}};y([w({constructOnly:!0})],iv.prototype,"view",void 0),y([w({constructOnly:!0})],iv.prototype,"cache",void 0),y([w()],iv.prototype,"surface",null),y([w()],iv.prototype,"surfaceView",null),y([w({readOnly:!0})],iv.prototype,"location",void 0),y([w({readOnly:!0})],iv.prototype,"renderLocation",null),iv=y([Z("esri.views.3d.terrain.StableSurfaceCenter")],iv);let rv=class extends ze{constructor(e){super(e),this._tileGeometryUpdateExtent=od(),this._tileGeometryUpdateSpatialReference=null,this.events=new Dn,this.updating=!1}initialize(){this.addHandles([this.surface.on("elevation-change",e=>this._tileGeometryChanged(e)),this.scheduler.registerTask(ni.SURFACE_GEOMETRY_UPDATES,this)])}get running(){return this.updating}runTask(){return this.updating&&(this._tileGeometryUpdateSpatialReference&&this._centerIntersectsExtent(this._tileGeometryUpdateExtent,this._tileGeometryUpdateSpatialReference)&&this.events.emit("request-update",uIt),od(this._tileGeometryUpdateExtent),this._set("updating",!1)),Xl.YIELD}_tileGeometryChanged(e){this._tileGeometryUpdateSpatialReference=e.spatialReference,g2(this._tileGeometryUpdateExtent,e.extent,this._tileGeometryUpdateExtent),this._set("updating",!0)}_furthestCenterOnSurface(){let e=this.centerOnSurfaces[0];for(let i=1;ie.distance&&(e=r)}return e}_centerIntersectsExtent(e,i){const r=this.state.contentCamera.eye,n=hIt,s=this._furthestCenterOnSurface();return this.renderCoordsHelper.fromRenderCoords(r,Yx,i),this.renderCoordsHelper.fromRenderCoords(s.renderLocation,Xx,i),Yx[0]this._estimateSurfaceAltitudeAtCenter(),o=this.view.resourceController.scheduler,l=(_=this.view.basemapTerrain)==null?void 0:_.elevationQueryCache,c={state:e,scheduler:o,surface:i,renderCoordsHelper:r};this._set("centerOnSurfaceInfrequent",new af({...c,task:ni.POINT_OF_INTEREST_INFREQUENT,estimateSurfaceAltitudeAtCenter:s})),this._set("centerOnSurfaceFrequent",new af({...c,task:ni.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:s})),this._set("centerOnContent",new af({...c,task:ni.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:()=>this._estimateContentAltitudeAtCenter()})),this._set("cameraOnSurface",new V0({...c,cache:l,task:ni.POINT_OF_INTEREST_INFREQUENT,map:n})),this._set("surfaceGeometryUpdates",new rv({...c,centerOnSurfaces:[this.centerOnSurfaceFrequent,this.centerOnContent,this.centerOnSurfaceInfrequent]})),this._set("contentGeometryUpdates",new aIt({contentLayerViews:this.view.allLayerViews,renderCoordsHelper:r})),this._set("surfaceOrigin",new iv({cache:l,view:this.view})),this._set("focus",new Ng({state:e,scheduler:o,surface:i,renderCoordsHelper:r,centerOnSurface:this.centerOnSurfaceFrequent,estimateSurfaceIntersectionAtRenderPoint:(x,T)=>this._estimateSurfaceIntersectionAtRenderPoint(x,this.view.state.contentCamera,T)})),this._pois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.cameraOnSurface,this.focus);const f=this.view.graphics;this._debugCenters.set(this.centerOnContent,new ZA(f,"red","CenterOnContent")),this._debugCenters.set(this.centerOnSurfaceFrequent,new ZA(f,"red","CenterOnSurface")),this._debugCenters.set(this.centerOnSurfaceInfrequent,new ZA(f,"red","CenterOnSurface")),this._debugCenters.set(this.cameraOnSurface,new ZA(f,"blue","CameraOnSurface")),this._debugCenters.set(this.focus,new ZA(f,"green","Focus")),this._handles.add([_e(()=>e.contentCamera,x=>this._cameraChanged(x),Li),_e(()=>i.extent,()=>this._updateCenterPointsOfInterest()),Mo(()=>!i.updating,()=>this._updateCenterPointsOfInterest(),Li),Jr(()=>this.surfaceGeometryUpdates.events,"request-update",()=>this._updateCenterPointsOfInterest()),Jr(()=>this.contentGeometryUpdates.events,"request-update",()=>this._updateCenterOnContent()),Mo(()=>Tn.SHOW_POI,x=>this._setDebug(x),ii)]),this._cameraChanged(this.view.state.contentCamera);for(const x of this._pois)x.runTask()}destroy(){this._setDebug(!1),this._handles.destroy(),this._propertiesPool.destroy();for(const e of this._pois)e.destroy();this.surfaceOrigin.destroy()}get updating(){var e;return!(!((e=this.surfaceGeometryUpdates)!=null&&e.updating)&&!this._pois.some(i=>i.updating))}get _centerRay(){return this._centerRayDirty&&(this._centerRayCached=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(this.view.state.contentCamera,this._tmpRay),this._centerRayDirty=!1),this._centerRayCached}_estimateContentAltitudeAtCenter(){if(!this._contentAltitudeAtCenterDirty)return this._contentAltitudeAtCenter;this._contentAltitudeAtCenterDirty=!1;const e=this._centerRay;return e==null||(this.view.sceneIntersectionHelper.intersectRay(e,this._contentIntersector,IC,fIt)?this._contentAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(IC):this._contentAltitudeAtCenter=this._estimateSurfaceAltitudeAtCenter()),this._contentAltitudeAtCenter}_estimateSurfaceAltitudeAtCenter(){if(!this.view.basemapTerrain)return 0;if(!this._surfaceAltitudeAtCenterDirty)return this._surfaceAltitudeAtCenter;this._surfaceAltitudeAtCenterDirty=!1;const e=this._centerRay;if(e==null)return this._surfaceAltitudeAtCenter;const i=e.origin,r=Be(IC,e.origin,e.direction);return this._surfaceIntersector.resetWithRay(e,this.view.state.contentCamera),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,i,r),this._surfaceIntersector.results.min.getIntersectionPoint(IC)&&(this._surfaceAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(IC)),this._surfaceAltitudeAtCenter}_estimateSurfaceIntersectionAtRenderPoint(e,i,r){const n=tle(i,e,pIt);if(n==null)return null;const s=n.origin,o=Be(IC,n.origin,n.direction);return this._surfaceIntersector.resetWithRay(n,i),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,s,o),this._surfaceIntersector.results.min.getIntersectionPoint(r)?r:null}_cameraChanged(e){this._updateCenterPointsOfInterest();const i=e.eye;jr(this.renderPointOfView,i)||this._set("renderPointOfView",Ne(this._propertiesPool.get("renderPointOfView"),i))}_updateCenterPointsOfInterest(){this._centerRayDirty=!0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenterDirty=!0;for(const e of this._pois)e.updateRenderLocation()}_updateCenterOnContent(){this._contentAltitudeAtCenterDirty=!0,this.centerOnContent.updateRenderLocation()}_setDebug(e){if(!e)return this._debugCenters.forEach(i=>i.hide()),void this._handles.remove("debug");for(const i of this._pois)this._handles.add(_e(()=>i.renderLocation,r=>{var n;return(n=this._debugCenters.get(i))==null?void 0:n.show(r,i.renderCoordsHelper.spatialReference)},ii),"debug")}get test(){return{update:()=>{this.surfaceGeometryUpdates.runTask();for(const e of this._pois)e.runTask()},surfaceGeometryUpdates:this.surfaceGeometryUpdates}}};y([w({readOnly:!0})],Nu.prototype,"centerOnContent",void 0),y([w({readOnly:!0})],Nu.prototype,"centerOnSurfaceFrequent",void 0),y([w({readOnly:!0})],Nu.prototype,"centerOnSurfaceInfrequent",void 0),y([w({readOnly:!0})],Nu.prototype,"cameraOnSurface",void 0),y([w({readOnly:!0})],Nu.prototype,"focus",void 0),y([w({readOnly:!0})],Nu.prototype,"renderPointOfView",void 0),y([w({readOnly:!0})],Nu.prototype,"surfaceOrigin",void 0),y([w({readOnly:!0})],Nu.prototype,"contentGeometryUpdates",void 0),y([w({readOnly:!0})],Nu.prototype,"surfaceGeometryUpdates",void 0),y([w({constructOnly:!0})],Nu.prototype,"view",void 0),y([w({readOnly:!0})],Nu.prototype,"updating",null),Nu=y([Z("esri.views.3d.support.PointsOfInterest")],Nu);const dIt=Array,IC=W(),pIt=Ko(),fIt={exclude:new Set([Gw])};let Q7e=class{constructor(e){this._store=e}destroy(){this._store.destroy()}get(e){return this._store.get(e)}put(e,i){this._store.put(e,i,i.values.byteLength+256)}},eFe=class{constructor(e,i,r,n){this._hasNoDataValues=null,this._minValue=null,this._maxValue=null,"pixelData"in e?(this.values=e.pixelData,this.width=e.width,this.height=e.height,this.noDataValue=e.noDataValue):(this.values=e,this.width=i,this.height=r,this.noDataValue=n)}get hasNoDataValues(){if(this._hasNoDataValues==null){const e=this.noDataValue;this._hasNoDataValues=this.values.includes(e)}return this._hasNoDataValues}get minValue(){return this._ensureBounds(),this._minValue}get maxValue(){return this._ensureBounds(),this._maxValue}_ensureBounds(){if(this._minValue!=null)return;const{noDataValue:e,values:i}=this;let r=1/0,n=-1/0,s=!0;for(const o of i)o===e?this._hasNoDataValues=!0:(r=on?o:n,s=!1);s?(this._minValue=0,this._maxValue=0):(this._minValue=r,this._maxValue=n>-3e38?n:0)}},tFe=class{constructor(e,i,r,n,s={}){this._mainMethod=i,this._transferLists=r,this._listeners=[],this._promise=pft(e,{...s,schedule:n}).then(o=>{if(this._thread===void 0){this._thread=o,this._promise=null,s.hasInitialize&&this.broadcast({},"initialize");for(const l of this._listeners)this._connectListener(l)}else o.close()}),this._promise.catch(o=>Ce.getLogger("esri.core.workers.WorkerHandle").error(`Failed to initialize ${e} worker: ${o}`))}on(e,i){const r={removed:!1,eventName:e,callback:i,threadHandle:null};return this._listeners.push(r),this._connectListener(r),rr(()=>{r.removed=!0,Gre(this._listeners,r),this._thread&&r.threadHandle!=null&&r.threadHandle.remove()})}destroy(){this._thread&&(this._thread.close(),this._thread=null),this._promise=null,this._listeners.length=0,this._transferLists={}}invoke(e,i){return this.invokeMethod(this._mainMethod,e,i)}invokeMethod(e,i,r){if(this._thread){const n=this._transferLists[e],s=n?n(i):[];return this._thread.invoke(e,i,{transferList:s,signal:r})}return this._promise?this._promise.then(()=>(St(r),this.invokeMethod(e,i,r))):Promise.reject(null)}broadcast(e,i){return this._thread?Promise.all(this._thread.broadcast(i,e)).then(()=>{}):this._promise?this._promise.then(()=>this.broadcast(e,i)):Promise.reject()}get promise(){return this._promise}_connectListener(e){this._thread&&this._thread.on(e.eventName,e.callback).then(i=>{e.removed||(e.threadHandle=i)})}},m_e=class extends tFe{constructor(e=null){super("LercWorker","_decode",{_decode:i=>[i.buffer]},e,{strategy:"dedicated"}),this.schedule=e,this.ref=0}decode(e,i,r){return e&&e.byteLength!==0?this.invoke({buffer:e,options:i},r):Promise.resolve(null)}release(){--this.ref<=0&&(N$.forEach((e,i)=>{e===this&&N$.delete(i)}),this.destroy())}};const N$=new Map;function iFe(t=null){let e=N$.get(t);return e||(t!=null?(e=new m_e(i=>t.immediate.schedule(i)),N$.set(t,e)):(e=new m_e,N$.set(null,e))),++e.ref,e}var zh,g_e,y_e;(function(t){t[t.FILL=1]="FILL",t[t.LINE=2]="LINE",t[t.SYMBOL=3]="SYMBOL",t[t.CIRCLE=4]="CIRCLE"})(zh||(zh={})),function(t){t[t.BACKGROUND=0]="BACKGROUND",t[t.FILL=1]="FILL",t[t.OUTLINE=2]="OUTLINE",t[t.LINE=3]="LINE",t[t.ICON=4]="ICON",t[t.CIRCLE=5]="CIRCLE",t[t.TEXT=6]="TEXT",t[t.TILEINFO=7]="TILEINFO"}(g_e||(g_e={})),function(t){t[t.PAINTER_CHANGED=0]="PAINTER_CHANGED",t[t.LAYOUT_CHANGED=1]="LAYOUT_CHANGED",t[t.LAYER_CHANGED=2]="LAYER_CHANGED",t[t.LAYER_REMOVED=3]="LAYER_REMOVED",t[t.SPRITES_CHANGED=4]="SPRITES_CHANGED"}(y_e||(y_e={}));let mIt=class{constructor(e){this.xTile=0,this.yTile=0,this.hash=0,this.priority=1,this.colliders=[],this.textVertexRanges=[],this.iconVertexRanges=[],this.tile=e}},Zhi=class{constructor(){this.tileSymbols=[],this.parts=[{startTime:0,startOpacity:0,targetOpacity:0,show:!1},{startTime:0,startOpacity:0,targetOpacity:0,show:!1}],this.show=!1}};function Khi(t,e,i,r,n,s){const o=i-n;if(o>=0)return(e>>o)+(r-(s<>o);const l=-o;return e-(s-(r<>l)<0){this.patternMap=new Map;for(let o=0;o0}triangleCount(){return this.lineIndexCount/3}doDestroy(){this.vao=Kt(this.vao)}doPrepareForRendering(e,i,r){const n=new Uint32Array(i),s=new Int32Array(n.buffer),o=n[r++],l=Yr.createVertex(e,Pr.STATIC_DRAW,new Int32Array(s.buffer,4*r,o));r+=o;const c=n[r++],f=Yr.createIndex(e,Pr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,c));r+=c;const _=this.layer.lineMaterial;this.vao=new Qf(e,_.getAttributeLocations(),_.getLayoutInfo(),{geometry:l},f)}},_It=class extends TG{constructor(e,i){super(e,i),this.type=zh.FILL,this.fillIndexStart=0,this.fillIndexCount=0,this.outlineIndexStart=0,this.outlineIndexCount=0;const r=new Uint32Array(e);let n=this.bufferDataOffset;this.fillIndexStart=r[n++],this.fillIndexCount=r[n++],this.outlineIndexStart=r[n++],this.outlineIndexCount=r[n++];const s=r[n++];if(s>0){this.patternMap=new Map;for(let o=0;o0||this.outlineIndexCount>0}triangleCount(){return(this.fillIndexCount+this.outlineIndexCount)/3}doDestroy(){this.fillVAO=Kt(this.fillVAO),this.outlineVAO=Kt(this.outlineVAO)}doPrepareForRendering(e,i,r){const n=new Uint32Array(i),s=new Int32Array(n.buffer),o=n[r++],l=Yr.createVertex(e,Pr.STATIC_DRAW,new Int32Array(s.buffer,4*r,o));r+=o;const c=n[r++],f=Yr.createIndex(e,Pr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,c));r+=c;const _=n[r++],x=Yr.createVertex(e,Pr.STATIC_DRAW,new Int32Array(s.buffer,4*r,_));r+=_;const T=n[r++],A=Yr.createIndex(e,Pr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,T));r+=T;const M=this.layer,I=M.fillMaterial,L=M.outlineMaterial;this.fillVAO=new Qf(e,I.getAttributeLocations(),I.getLayoutInfo(),{geometry:l},f),this.outlineVAO=new Qf(e,L.getAttributeLocations(),L.getLayoutInfo(),{geometry:x},A)}},bIt=class extends TG{constructor(e,i,r){super(e,i),this.type=zh.SYMBOL,this.iconPerPageElementsMap=new Map,this.glyphPerPageElementsMap=new Map,this.symbolInstances=[],this.isIconSDF=!1,this.opacityChanged=!1,this.lastOpacityUpdate=0,this.symbols=[];const n=new Uint32Array(e),s=new Int32Array(e),o=new Float32Array(e);let l=this.bufferDataOffset;this.isIconSDF=!!n[l++];const c=n[l++];for(let T=0;T0||this.glyphPerPageElementsMap.size>0}triangleCount(){let e=0;for(const[i,r]of this.iconPerPageElementsMap)e+=r[1];for(const[i,r]of this.glyphPerPageElementsMap)e+=r[1];return e/3}doDestroy(){this.iconVAO=Kt(this.iconVAO),this.textVAO=Kt(this.textVAO)}updateOpacityInfo(){if(!this.opacityChanged)return;this.opacityChanged=!1;const e=this.iconOpacity,i=this.iconVAO.vertexBuffers.opacity;e.length>0&&e.byteLength===i.byteLength&&i.setSubData(e,0,0,e.length);const r=this.textOpacity,n=this.textVAO.vertexBuffers.opacity;r.length>0&&r.byteLength===n.byteLength&&n.setSubData(r,0,0,r.length)}doPrepareForRendering(e,i,r){const n=new Uint32Array(i),s=new Int32Array(n.buffer),o=n[r++],l=Yr.createVertex(e,Pr.STATIC_DRAW,new Int32Array(s.buffer,4*r,o));r+=o;const c=n[r++],f=Yr.createIndex(e,Pr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,c));r+=c;const _=n[r++],x=Yr.createVertex(e,Pr.STATIC_DRAW,new Int32Array(s.buffer,4*r,_));r+=_;const T=n[r++],A=Yr.createIndex(e,Pr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,T));r+=T;const M=Yr.createVertex(e,Pr.STATIC_DRAW,this.iconOpacity.buffer),I=Yr.createVertex(e,Pr.STATIC_DRAW,this.textOpacity.buffer),L=this.layer,F=L.iconMaterial,z=L.textMaterial;this.iconVAO=new Qf(e,F.getAttributeLocations(),F.getLayoutInfo(),{geometry:l,opacity:M},f),this.textVAO=new Qf(e,z.getAttributeLocations(),z.getLayoutInfo(),{geometry:x,opacity:I},A)}},wIt=class extends TG{constructor(e,i){super(e,i),this.type=zh.CIRCLE,this.circleIndexStart=0,this.circleIndexCount=0;const r=new Uint32Array(e);let n=this.bufferDataOffset;this.circleIndexStart=r[n++],this.circleIndexCount=r[n++],this.bufferDataOffset=n}get memoryUsed(){var e,i;return(((e=this.data)==null?void 0:e.byteLength)??0)+(((i=this.vao)==null?void 0:i.usedMemory)??0)}hasData(){return this.circleIndexCount>0}triangleCount(){return this.circleIndexCount/3}doDestroy(){this.vao=Kt(this.vao)}doPrepareForRendering(e,i,r){const n=new Uint32Array(i),s=new Int32Array(n.buffer),o=n[r++],l=Yr.createVertex(e,Pr.STATIC_DRAW,new Int32Array(s.buffer,4*r,o));r+=o;const c=n[r++],f=Yr.createIndex(e,Pr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,c));r+=c;const _=this.layer.circleMaterial;this.vao=new Qf(e,_.getAttributeLocations(),_.getLayoutInfo(),{geometry:l},f)}};const adi=!0,ldi=32,v_e=200,xIt=1/Le("mapview-transitions-duration");let SIt=class extends Dn{constructor(){super(...arguments),this._fadeOutResolver=null,this._fadeInResolver=null,this._clips=null,this.computedVisible=!0,this.computedOpacity=1,this.fadeTransitionEnabled=!1,this.inFadeTransition=!1,this._isReady=!1,this._opacity=1,this.parent=null,this._stage=null,this._visible=!0}get clips(){return this._clips}set clips(e){this._clips=e,this.requestRender()}get isReady(){return this._isReady}get opacity(){return this._opacity}set opacity(e){this._opacity!==e&&(this._opacity=Math.min(1,Math.max(e,0)),this.requestRender())}get stage(){return this._stage}set stage(e){var r;if(this._stage===e)return;const i=this._stage;this._stage=e,e?(r=this._stage)!=null&&r.untrashDisplayObject(this)||(this.onAttach(),this.emit("attach")):i==null||i.trashDisplayObject(this)}get transforms(){return this._getTransforms()}_getTransforms(){return this._transforms==null&&(this._transforms=this._createTransforms()),this._transforms}get visible(){return this._visible}set visible(e){this._visible!==e&&(this._visible=e,this.requestRender())}get hasLabels(){return!1}get hasHighlight(){return!1}get hasBlending(){return!1}fadeIn(){return this._fadeInResolver||(this._fadeOutResolver&&(this._fadeOutResolver(),this._fadeOutResolver=null),this.opacity=1,this.computedOpacity=0,this.fadeTransitionEnabled=!0,this._fadeInResolver=Jl(),this.requestRender()),this._fadeInResolver.promise}fadeOut(){return this._fadeOutResolver||(this.opacity=0,this._fadeInResolver&&(this._fadeInResolver(),this._fadeInResolver=null),this.fadeTransitionEnabled=!0,this._fadeOutResolver=Jl(),this.requestRender()),this._fadeOutResolver.promise}endTransitions(){var e,i;(e=this._fadeInResolver)==null||e.call(this),this._fadeInResolver=null,(i=this._fadeOutResolver)==null||i.call(this),this._fadeOutResolver=null,this.computedOpacity=this.visible?this.opacity:0,this.requestRender()}beforeRender(e){this.updateTransitionProperties(e.deltaTime,e.state.scale),this.setTransform(e.state)}afterRender(e){this._fadeInResolver&&this.computedOpacity===this.opacity?(this._fadeInResolver(),this._fadeInResolver=null):this._fadeOutResolver&&this.computedOpacity===0&&(this._fadeOutResolver(),this._fadeOutResolver=null)}remove(){var e;(e=this.parent)==null||e.removeChild(this)}setTransform(e){}processRender(e){this.stage&&this.computedVisible&&this.doRender(e)}requestRender(){this.stage&&this.stage.requestRender()}processDetach(){this._fadeInResolver&&(this._fadeInResolver(),this._fadeInResolver=null),this._fadeOutResolver&&(this._fadeOutResolver(),this._fadeOutResolver=null),this.onDetach(),this.emit("detach")}updateTransitionProperties(e,i){if(this.fadeTransitionEnabled){const r=this._fadeOutResolver||!this.visible?0:this.opacity,n=this.computedOpacity;if(n===r)this.computedVisible=this.visible;else{const s=e*xIt;this.computedOpacity=n>r?Math.max(r,n-s):Math.min(r,n+s),this.computedVisible=this.computedOpacity>0;const o=r===this.computedOpacity;this.inFadeTransition=!o,o||this.requestRender()}}else this.computedOpacity=this.opacity,this.computedVisible=this.visible}onAttach(){}onDetach(){}doRender(e){}ready(){this._isReady||(this._isReady=!0,this.emit("isReady"),this.requestRender())}},iE=class iS{static getId(e,i,r,n){return typeof e=="object"?`${e.level}/${e.row}/${e.col}/${e.world}`:`${e}/${i}/${r}/${n}`}constructor(e,i,r,n){this.set(e,i,r,n)}get key(){return this}get id(){return this.toString()}set id(e){this.set(e)}get hash(){const e=4095&this.row,i=4095&this.col,r=63&this.level;return(3&this.world)<<30|i<<22|e<<8|r}acquire(e,i,r,n){this.set(e,i,r,n)}contains(e){const i=e.level-this.level;return i>=0&&this.row===e.row>>i&&this.col===e.col>>i&&this.world===e.world}equals(e){return this.level===e.level&&this.row===e.row&&this.col===e.col&&this.world===e.world}clone(){return new iS(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(e,i,r,n){if(e==null)this.level=0,this.row=0,this.col=0,this.world=0;else if(typeof e=="object")this.level=e.level||0,this.row=e.row||0,this.col=e.col||0,this.world=e.world||0;else if(typeof e=="string"){const[s,o,l,c]=e.split("/");this.level=parseFloat(s),this.row=parseFloat(o),this.col=parseFloat(l),this.world=parseFloat(c)}else this.level=+e,this.row=+i,this.col=+r,this.world=+n||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new iS(this.level-1,this.row>>1,this.col>>1,this.world)}getChildKeys(){const e=this.level+1,i=this.row<<1,r=this.col<<1,n=this.world;return[new iS(e,i,r,n),new iS(e,i,r+1,n),new iS(e,i+1,r,n),new iS(e,i+1,r+1,n)]}compareRowMajor(e){return this.rowe.row?1:this.cole.col?1:0}};iE.pool=new Ec(iE,null,null,25,50);let rFe=class extends SIt{constructor(e,i,r,n,s,o,l=s,c=o){super(),this.triangleCountReportedInDebug=0,this.triangleCount=0,this.texture=null,this.key=new iE(e),this.resolution=i,this.x=r,this.y=n,this.width=s,this.height=o,this.rangeX=l,this.rangeY=c}destroy(){this.texture&&(this.texture.dispose(),this.texture=null)}setTransform(e){const i=this.resolution/(e.resolution*e.pixelRatio),r=this.transforms.tileMat3,[n,s]=e.toScreenNoRotation([0,0],[this.x,this.y]),o=this.width/this.rangeX*i,l=this.height/this.rangeY*i;Toe(r,o,0,0,0,l,0,n,s,1),s5(this.transforms.dvs,e.displayViewMat3,r)}},mY=class nFe extends rFe{constructor(e,i,r,n,s,o,l,c=null){super(e,i,r,n,s,o,4096,4096),this.styleRepository=l,this._memCache=c,this.type="vector-tile",this._referenced=0,this._hasSymbolBuckets=!1,this._memoryUsedByLayerData=0,this.layerData=new Map,this.status="loading",this.allSymbolsFadingOut=!1,this.lastOpacityUpdate=0,this.symbols=new Map,this.isCoverage=!1,this.neededForCoverage=!1,this.decluttered=!1,this.parentTile=null,this.childrenTiles=new Set,this._processed=!1,this._referenced=1,this.id=e.id}get hasSymbolBuckets(){return this._hasSymbolBuckets}get isFading(){return this._hasSymbolBuckets&&performance.now()-this.lastOpacityUpdate0}dispose(){this.status!=="unloaded"&&(sFe.delete(this),nFe._destroyRenderBuckets(this.layerData),this.layerData=null,this._memoryUsedByLayerData=0,this.destroy(),this.status="unloaded")}release(){return--this._referenced==0&&(this.dispose(),this.stage=null,!0)}retain(){++this._referenced}get referenced(){return this._referenced}get memoryUsed(){return this._memoryUsedByLayerData+256}changeDataImpl(e){var r;let i=!1;if(e){const{bucketsWithData:n,emptyBuckets:s}=e,o=this._createRenderBuckets(n);if(s&&s.byteLength>0){const l=new Uint32Array(s);for(const c of l)this._deleteLayerData(c)}for(const[l,c]of o)this._deleteLayerData(l),c.type===zh.SYMBOL&&(this.symbols.set(l,c.symbols),i=!0),this._memoryUsedByLayerData+=c.memoryUsed,this.layerData.set(l,c);(r=this._memCache)==null||r.updateSize(this.key.id,this,this.memoryUsed)}this._hasSymbolBuckets=!1;for(const[n,s]of this.layerData)s.type===zh.SYMBOL&&(this._hasSymbolBuckets=!0);i&&this.emit("symbols-changed")}attachWithContext(e){this.stage={context:e,trashDisplayObject(i){i.processDetach()},untrashDisplayObject:()=>!1}}setTransform(e){super.setTransform(e);const i=this.resolution/(e.resolution*e.pixelRatio),r=this.width/this.rangeX*i,n=this.height/this.rangeY*i,s=[0,0];e.toScreen(s,[this.x,this.y]);const o=this.transforms.tileUnitsToPixels;Eoe(o),eU(o,o,s),Coe(o,o,Math.PI*e.rotation/180),Aoe(o,o,[r,n,1])}_createTransforms(){return{dvs:Tc(),tileMat3:Tc(),tileUnitsToPixels:Tc()}}static _destroyRenderBuckets(e){if(!e)return;const i=new Set;for(const r of e.values())i.has(r)||(r.destroy(),i.add(r));e.clear()}_createRenderBuckets(e){const i=new Map,r=new Map;for(const n of e){const s=this._deserializeBucket(n,r);for(const o of s.layerUIDs)i.set(o,s)}return i}_deserializeBucket(e,i){let r=i.get(e);if(r)return r;switch(new Uint32Array(e)[0]){case zh.FILL:r=new _It(e,this.styleRepository);break;case zh.LINE:r=new vIt(e,this.styleRepository);break;case zh.SYMBOL:r=new bIt(e,this.styleRepository,this);break;case zh.CIRCLE:r=new wIt(e,this.styleRepository)}return i.set(e,r),r}_deleteLayerData(e){if(!this.layerData.has(e))return;const i=this.layerData.get(e);this._memoryUsedByLayerData-=i.memoryUsed,i.destroy(),this.layerData.delete(e)}};const sFe=new Map;function TIt(){sFe.forEach((t,e)=>{console.log(` -${e.key}:`),t[0].forEach(i=>console.log(i)),console.log("========"),t[1].forEach(i=>console.log(i))})}const hdi={value:.5,readOnly:!0},EIt={readOnly:!0,value:.5,get(){return this.updating?this.updatingProgressValue:1}};let BM=class{constructor(e=0,i=0){this.min=e,this.max=i,this.level=0,this.hasNoDataValues=!1}copyFrom(e){this.min=e.min,this.max=e.max,this.level=e.level,this.hasNoDataValues=e.hasNoDataValues}},oFe=class{constructor(e,i){this.data=e,this.safeWidth=.99999999*(e.width-1),this.dx=(e.width-1)/(i[2]-i[0]),this.dy=(e.width-1)/(i[3]-i[1]),this.x0=i[0],this.y1=i[3]}},CIt=class{constructor(e,i,r){this.type="elevation",this.level=e[0],this.i=e[1],this.j=e[2],this.extent=i,this.samplerData=new oFe(r,i)}computeMinMaxValue(e,i,r,n){n.min=1/0,n.max=-1/0,n.hasNoDataValues=!1;const s=e-this.level;if(s<=0)return n;const o=2**s;if(!(Math.floor(i/o)===this.i&&Math.floor(r/o)===this.j))return n;let l=1/0,c=-1/0;const f=this.samplerData.data.width,_=this.samplerData.data.values,x=.5*EL;let T=(f-1)/o,A=(r-this.j*o)*T,M=(i-this.i*o)*T;if(T<1){const I=Math.floor(A),L=Math.floor(M),F=I+L*f,z=_[F],k=_[F+1],U=_[F+f],j=_[F+f+1];if(z+k+U+jthis.notifyChange("stencilEnabledExtents"))])}destroy(){}get layerViewsExtent(){return this._computeLayerViewsExtent()}get tiledLayersExtent(){return this._computeTiledLayersExtent()}get stencilEnabledExtents(){return this._computeStencilEnabledExtents()}_computeStencilEnabledExtents(){const e=[];return this.layerViews.forEach(i=>{const r=i.layer;if(r.operationalLayerType==="IntegratedMeshLayer"&&this.viewSpatialReference!=null){const n=aFe(r.fullExtent,this.viewSpatialReference);n!=null&&e.push(ase(n))}}),e}};function MIt(t,e){return t===_t.Global?new Lie(e):new Die(e)}y([w({readOnly:!0})],nf.prototype,"layerViewsExtent",null),y([w({readOnly:!0})],nf.prototype,"tiledLayersExtent",null),y([w({readOnly:!0})],nf.prototype,"stencilEnabledExtents",null),y([w()],nf.prototype,"viewSpatialReference",void 0),y([w()],nf.prototype,"tilingScheme",void 0),y([w()],nf.prototype,"defaultTiledLayersExtent",void 0),y([w({constructOnly:!0})],nf.prototype,"layers",void 0),y([w({constructOnly:!0})],nf.prototype,"layerViews",void 0),nf=y([Z("esri.views.3d.terrain.ExtentHelper")],nf);let Lie=class extends nf{_computeLayerViewsExtent(){return this._globalExtent}_computeTiledLayersExtent(){return this._globalExtent}get _globalExtent(){return this.viewSpatialReference.isWebMercator?yIe:X0t}};Lie=y([Z("esri.views.3d.terrain.ExtentHelperGlobal")],Lie);let Die=class extends nf{_computeLayerViewsExtent(){const e=od(),i=this.viewSpatialReference;this.layerViews.forEach(s=>{const o=s.layer;if(s.isResolved()&&(o.type!=="graphics"||!o.internal)){const l=aFe("fullExtentInLocalViewSpatialReference"in s&&s.fullExtentInLocalViewSpatialReference||s.layer.fullExtent,i);g2(e,l,e)}});const r=qZ(e)?e:null,n=this._get("layerViewsExtent");return uT(r,n)?n:r}_computeTiledLayersExtent(){const e=this.tilingScheme;if(!e)return null;const i=this.viewSpatialReference,r=od();this.layers.forEach(o=>{if(o.loaded&&oO(o)){const l=SG(o,i,_t.Local);if(l==null)return;const{tileInfo:c,fullExtent:f}=l;c!=null&&f!=null&&(aV(o)||e.compatibleWith(c)&&f.spatialReference.equals(e.spatialReference))&&g2(r,f,r)}}),g2(r,this.defaultTiledLayersExtent,r);const n=qZ(r)?r:null,s=this._get("tiledLayersExtent");return uT(n,s)?s:n}};function aFe(t,e){return t==null||t.spatialReference.equals(e)?t:o$(t,t.spatialReference,e)}Die=y([Z("esri.views.3d.terrain.ExtentHelperLocal")],Die);var Yi;(function(t){t[t.ELEVATION=0]="ELEVATION",t[t.MAP=1]="MAP"})(Yi||(Yi={}));const rS=[Yi.ELEVATION,Yi.MAP];function lFe(){var e;const t=(e=globalThis.require)==null?void 0:e.modules;if(t){const i=Object.keys(t);for(const r of i)r.includes(".glsl")&&delete t[r]}}const cFe=1.3,OIt=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let Pb,Ou=class extends ze{get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||Tn.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get _worldToPCSRatio(){return this._spatialReference!=null&&this._spatialReference.isGeographic&&!this.view.state.isLocal?Sr(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return cFe/this.view.resolutionScale}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccluded(){return this.renderer.rendersOccluded}constructor(e){super(e),this._spatialReference=null,this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._longitudeCyclical=null,this._latestOriginId=0,this._maxResolution=Le("esri-mobile")?2048:4096,this._animationTimeLast=0}initialize(){const e=this.view;this.renderer=new k0({view:e,worldToPCSRatio:this._worldToPCSRatio,spatialReference:this._spatialReference}),e._stage.renderer.renderPlugins.add(this.renderer);const i=()=>this.setDrawTexturesDirty();this._groundIntersector=Tp(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([_e(()=>this.renderer.hasHighlights,i),this.renderer.events.on("has-water",r=>{var n;return(n=e._stage)==null?void 0:n.renderer.setParameters({hasOverlayWater:r})}),this.renderer.events.on("renders-occluded",()=>{i(),this.notifyChange("rendersOccluded")}),this.renderer.events.on("content-changed",i),_e(()=>e.state.camera.pixelRatio,i),_e(()=>e.state.alignPixelEnabled,i),this.renderer.events.on("textures-disposed",()=>this.surface.requestRender()),_e(()=>{var r,n,s;return[(r=e.pointsOfInterest)==null?void 0:r.renderPointOfView,(s=(n=e.pointsOfInterest)==null?void 0:n.centerOnSurfaceFrequent)==null?void 0:s.location]},()=>this.setPlacementDirty()),_e(()=>{var r,n;return[(r=e.state)==null?void 0:r.pixelRatio,(n=e.state)==null?void 0:n.contentPixelRatio]},()=>this.setPlacementDirty(),Li),this.surface.on("elevation-change",()=>this.setPlacementDirty()),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(ni.OVERLAY,this),e._stage.renderView.events.on("force-camera-for-screenshot",r=>{this._updateOverlays(ou,r.camera,no.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(no.BACKGROUND,r)})]),e._stage.renderer.renderOverlay=r=>this._renderOverlay(r)}_renderOverlay(e){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._dispatchAnimationUpdate(e),this._drawOverlays(no.UPDATE,this.view.state)}destroy(){var e;(e=this.view)!=null&&e._stage&&(this.view._stage.renderer.renderPlugins.remove(this.renderer),this.view._stage.renderer.renderOverlay=()=>{}),Pb&&(Pb.hide(),Pb=null)}get hasOverlays(){return this.renderer.hasOverlays}setSpatialReference(e){this._spatialReference=e,this.renderer.spatialReference=e,this._longitudeCyclical=null;const i=this.view.renderSpatialReference;e!=null&&i!=null?(this._renderSR=i,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this._longitudeCyclical=e.isWebMercator?new F2(-20037508342787e-6,20037508342787e-6):new F2(-180,180),this.renderer.longitudeCyclical=this._longitudeCyclical),this.renderer&&(this.renderer.worldToPCSRatio=this._worldToPCSRatio)):this.renderer.disposeOverlays()}registerDrapeSource(e,i,r){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources);const n=this.renderer.createDrapeSourceRenderer(e,i,r);return this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("running"),n}registerGeometryDrapeSource(e){return this.registerDrapeSource(e,Bd)}_updateDrapeSourceExtent(e){this.renderer.overlays.length===2&&e.setDrapingExtent!=null&&this._spatialReference!=null&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("running"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.setDrawTexturesDirty()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this._updateOverlays(e,this.view.state.contentCamera,no.UPDATE)}_updateOverlays(e,i,r){if(!this._spatialReference)return Xl.YIELD;const n=this._computeOverlayResolution(i);this._computeOverlayExtents(i,n,dg),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,dg.stretch);const s=this._updateOverlay(ko.INNER,dg.inner,n,1*dg.pixelRatioAdjustment,dg.mapUnitsPerPixel),o=_c(dg.inner)/_c(dg.outer),l=this._updateOverlay(ko.OUTER,dg.outer,n,o*dg.pixelRatioAdjustment,dg.mapUnitsPerPixel);s!==Zg.EXTENT&&l!==Zg.EXTENT||(this._drapeSources.forEach(c=>this._updateDrapeSourceExtent(c)),this.surface.updateTileOverlayParams(r)),s===Zg.NONE&&l===Zg.NONE||this.setDrawTexturesDirty(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(e){const i=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*i,n=e.fullHeight/e.pixelRatio*i,s=Math.ceil(1.5*Math.max(r,n));return Math.min(yT(s),this._maxResolution)}_updateOverlay(e,i,r,n,s){if(this.renderer.overlays.length===0)return Zg.NONE;const o=this.renderer.overlays[e],l=o.mapUnitsPerPixel;if(o.mapUnitsPerPixel=s,o.pixelRatio=n,PIt(i,o.extent)&&r===o.resolution)return l===s?Zg.NONE:Zg.RERENDER_ONLY;d_(o.extent,i),o.resolution=r;const c=lse(o.extent);return o.renderLocalOrigin=HU(c[0],c[1],0,"OV_"+this._latestOriginId++),Zg.EXTENT}setTileParameters(e){const i=e.renderData.overlay;if(this.renderer.overlays.length>0){const r=this.renderer.overlays[ko.INNER],n=this.renderer.overlays[ko.OUTER],s=e.extent;this._rectInsideRect(r.extent,s)||this._rectanglesOverlap(s,r.extent)||this._rectanglesOverlap(s,n.extent)?(this._setTileOverlayData(s,ko.INNER,i),this._setTileOverlayData(s,ko.OUTER,i)):(this._clearTileOverlayData(ko.INNER,i),this._clearTileOverlayData(ko.OUTER,i))}else this._clearTileOverlayData(ko.INNER,i),this._clearTileOverlayData(ko.OUTER,i)}overlayPixelSizeInMapUnits(e,i){if(this.renderer.overlays.length===0)return i();const r=this.renderer.overlays[ko.INNER],n=this.renderer.overlays[ko.OUTER],s=this._pointIsInExtent(e,r.extent)?r:n;return(s.extent[2]-s.extent[0])/s.resolution}_setTileOverlayData(e,i,r){if(this.renderer.overlays.length===0)return;const n=this.renderer.overlays[i].extent,s=_c(n),o=qu(n);let l=e[0];if(this._longitudeCyclical){l=this._longitudeCyclical.minimalMonotonic(n[0],l);const c=this._longitudeCyclical.minimalMonotonic(n[0],e[2]);l>c&&(l=c-(e[2]-e[0]))}r.setScale(i,_c(e)/s,qu(e)/o),r.setOffset(i,(l-n[0])/s,(e[1]-n[1])/o)}_clearTileOverlayData(e,i){i.setScale(e,-1,-1),i.setOffset(e,-1,-1)}async reloadShaders(){lFe(),await this.renderer.reloadShaders(),this.setDrawTexturesDirty(),this.runTask(ou)}_dispatchAnimationUpdate(e){const i=e-this._animationTimeLast;if(i>=this.surface.view._stage.renderer.animationTimestep||this.view.state.forcedAnimationTime!=null||this._drawTexturesDirty||this._drawTexturesAnimateDirty){const r=i/this.surface.view._stage.renderer.animationTimeDilation,n=new K9e(this.view.state.camera,r,this.view.state.forcedAnimationTime);this.renderer.updateAnimation(n)&&(this._drawTexturesAnimateDirty=!0),this._animationTimeLast=e}}setDrawTexturesDirty(){this.renderer.hasOverlays?(this._contentUpdated=!0,this._drawTexturesDirty=!0,this.view._stage.renderView.requestRender()):this.setPlacementDirty()}_intersectGroundFromView(e,i,r,n){const s=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,LIt,i,r);if(s==null)return!1;const o=s.origin,l=Be(h8,s.origin,s.direction);return this._groundIntersector.reset(o,l,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,o,l),this._groundIntersector.results.min.getIntersectionPoint(n)}_findHorizonBasedPointOfInterest(e,i){let r=.5;const n=.55,s=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,c=Je(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:s+l,e.aboveGround?s-l:1/0),f=e.aboveGround;if(this.view.viewingMode==="global"){const _=h8;gP(aj(cj,Sr(this.view.spatialReference).radius+c),Sp(e.eye,e.viewForward),_),je(_,_,e.eye);const x=k2.normalize(KPe(e.viewForward,_,e.viewRight))/e.fovY+.5,T=x<=0||x>=1?.5:n;r=f?T*x:x+T*(1-x)}else{const _=.5*Math.PI-Math.acos(-e.viewForward[2]),x=Math.tan(_),T=Mi(0,x,1,0),A=lp(T,T,e.projectionMatrix)[1],M=Je(.5+.5*A,0,1);r=M===1||M===0?.5:f?M*n:1-(1-M)*n}return!!this._intersectGroundFromView(e,.5,r,i)&&vB(i,e.eye)=I&&(A=I,s[1]=0,this._spatialReference.isWebMercator&&(s[0]=0)));let L=1;M&&(L=1/Math.max(.2,Math.cos(Math.abs(Ei(s[1])))),A*L>180&&(L=180/A),r.mapUnitsPerPixel*=L);const F=Math.log(2)/12;A=Math.exp(Math.round(Math.log(A)/F)*F);const z=A*L,k=32,U=.5*i/(k*z),j=.5*i/(k*A);s[0]=Math.round(s[0]*U)/U,s[1]=Math.round(s[1]*j)/j;const H=r.inner;H[0]=s[0]-z,H[1]=s[1]-A,H[2]=s[0]+z,H[3]=s[1]+A,this._isSpherical&&this._shiftExtentToFitBounds(H,1/0,I);const Y=r.outer;if(6*z>_c(c))d_(Y,c);else if(Math.PI/2-Math.abs(l-Math.PI/2)<=.25*Math.PI)Y[0]=H[0]-z,Y[1]=H[1]-A,Y[2]=H[2]+z,Y[3]=H[3]+A;else{el(e.eye,this._renderSR,h8,this._spatialReference),Ps(Zx,s,h8);let ne=-Math.atan2(Zx[1],Zx[0])+.125*Math.PI;ne<0&&(ne+=2*Math.PI);const re=Math.floor(ne/(.25*Math.PI));UT(Zx,OIt[re],2*A),Zx[0]*=L,Zx[2]*=L,rse(Y,H,Zx)}if(this._isSpherical)Y[0]=this._longitudeCyclical.clamp(Y[0]),Y[2]=this._longitudeCyclical.clamp(Y[2]),Y[1]=Math.max(Y[1],-I),Y[3]=Math.min(Y[3],I);else{const ne=WZ(H,c,IIt),re=WZ(Y,c,$It);Nz(ne,re)&&(Y[2]=Y[0],Y[3]=Y[1])}const Q=Math.abs(H[2]-H[0])/i;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,Q),r.pixelRatioAdjustment=r.mapUnitsPerPixel/Q}_drawOverlays(e,i){if(!this.renderer.hasOverlays)return;if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const n=this.renderer.computeValidity();return this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(i),n!==this.renderer.computeValidity()&&this.surface.updateTileOverlayParams(no.UPDATE),r?(this.surface.requestRender(e),e===no.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(no.BACKGROUND),this.renderer}_rectanglesOverlap(e,i){return e!=null&&(this._longitudeCyclical?(this._longitudeCyclical.contains(i[0],i[2],e[0])||this._longitudeCyclical.contains(i[0],i[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],i[0]))&&!(e[1]>i[3]||e[3]e[1]&&i[3]=i[1]&&e.y<=i[3];const r=e.x,n=e.y;return r>i[0]&&ri[1]&&ni&&(n=i-e[2]),e[1]<-r?s=e[1]+r:e[3]>r&&(s=r-e[3]),Fz(e,n,s)}get test(){return{renderer:this.renderer,update:()=>this.runTask(ou)}}};function PIt(t,e){const r=Tn.TESTS_DISABLE_OPTIMIZATIONS?0:1e-5*Math.max(t[2]-t[0],t[3]-t[1],e[2]-e[0],e[3]-e[1]);return Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r}y([w()],Ou.prototype,"_spatialReference",void 0),y([w({readOnly:!0})],Ou.prototype,"running",null),y([w()],Ou.prototype,"_placementDirty",void 0),y([w()],Ou.prototype,"_contentUpdated",void 0),y([w()],Ou.prototype,"_isSpherical",null),y([w()],Ou.prototype,"_worldToPCSRatio",null),y([w({autoDestroy:!0})],Ou.prototype,"renderer",void 0),y([w({constructOnly:!0})],Ou.prototype,"view",void 0),y([w({constructOnly:!0})],Ou.prototype,"surface",void 0),y([w()],Ou.prototype,"suspended",null),y([w()],Ou.prototype,"updating",null),y([w({type:Boolean})],Ou.prototype,"rendersOccluded",null),Ou=y([Z("esri.views.3d.terrain.OverlayManager")],Ou);let RIt=class{constructor(){this.inner=Ni(),this.outer=Ni(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=cFe}};const Zx=Xi(),h8=W(),dg=new RIt,IIt=Ni(),$It=Ni(),LIt=Ko();var Zg;(function(t){t[t.NONE=0]="NONE",t[t.EXTENT=1]="EXTENT",t[t.RERENDER_ONLY=2]="RERENDER_ONLY"})(Zg||(Zg={}));let DIt=class{constructor(){this.indices=null,this.vertexAttributes=null,this.boundingBox=Bn(),this.indexCount=0,this.numVerticesPerSide=0,this.uvRange=[0,0,1,1],this.outerEdges=[null,null,null,null],this.innerEdges=[null,null,null,null]}release(){this.vertexAttributes=ir(this.vertexAttributes),this.indices=null}},__e=class{constructor(e,i,r,n,s){this.attributes=e,this.localOrigin=i,this.index0=r,this.stride=n,this.count=s}getVertexIndex(e){return this.getAttributeIndex(e)}getAttributeIndex(e){return ot(0<=e&&er[3]&&(r[3]=t),er[4]&&(r[4]=e),ir[5]&&(r[5]=i)}let NIt=class{constructor(){this.sinLonLUT=new Array(X4+1),this.cosLonLUT=new Array(X4+1),this.sinLatLUT=new Array(X4+1),this.cosLatLUT=new Array(X4+1)}update(e,i,r){const n=i[0],s=i[2];for(let o=0;o<=e;o++){const l=o/e,c=n*(1-l)+s*l;this.sinLonLUT[o]=Math.sin(c),this.cosLonLUT[o]=Math.cos(c);const f=r(l);this.sinLatLUT[o]=Math.sin(f),this.cosLatLUT[o]=Math.cos(f)}}},d8=class{constructor(){this.cornerTiles=[null,null,null,null],this.cornerTileSamplerVersions=[-1,-1,-1,-1]}},FIt=class{constructor(){this.cornerNeighborData=[new d8,new d8,new d8,new d8],this.edgeResolutions=[-1,-1,-1,-1],this.edgePeerNeighbors=[null,null,null,null],this.edgePeerNeighborSamplerVersions=[-1,-1,-1,-1],this.cornerPeerNeighbors=[null,null,null,null]}},kIt=class{constructor(){this.numVerticesPerSide=0,this.samplerData=null,this.clippingArea=null,this.wireframe=!1,this.samplerDataVersion=0,this.neighborData=new FIt}},uFe=class hk{constructor(e){this._getFadeDuration=e,this._fadeStart=0,this._delayedTime=0}clear(){this._current=et(this._current),this._next=et(this._next),this._waiting=et(this._waiting),this._delayed=et(this._delayed)}get current(){if(this._current==null)return null;if(!this._isFadingEnabled){const i=this._delayed||this._waiting||this._next||this._current;i!==this._current&&(this._current=null,this.clear(),this._current=i)}let e=hk.test.fadeMoment;if(this._delayed!=null&&(e=e||performance.now(),e>=this._delayedTime&&(this._push(this._delayed,r_.Immediate),this._delayed=null)),this._next!=null){e=e||performance.now();const i=this._fadeDuration,r=this._current!=null&&this._next.texture===this._current.texture,n=this._next.type!==ua.FADING,s=e-this._fadeStart>=i;(r||n||s)&&(et(this._current),this._current=this._next,this._next=this._waiting,this._waiting=null,this._fadeStart=this._alignFadeStart(e))}return this._current}get next(){return this._next}get fadeFactor(){if(this._next==null)return 1;const e=hk.test.fadeMoment||performance.now(),i=Math.max(0,e-this._fadeStart),r=this._fadeDuration;return i>r?0:1-i/r}get isFading(){return this._next!=null||this._delayed!=null}push(e,i=r_.Immediate){this._delayed=et(this._delayed),this._push(e,i)}_push(e,i){if(this._isFadingEnabled||this.clear(),this._current==null)return void(this._current=e);const r=hk.test.fadeMoment||performance.now();return i!==r_.Immediate?(this._delayed=e,void(this._delayedTime=r+i)):this._next==null?(this._next=e,void(this._fadeStart=this._alignFadeStart(r))):void(e!=null&&(et(this._waiting),this._waiting=e))}get _fadeDuration(){return this._waiting==null?this._getFadeDuration():.5*this._getFadeDuration()}_alignFadeStart(e){const i=this._getFadeDuration();return e+i-e%i}get _isFadingEnabled(){return this._getFadeDuration()>0}};var r_;uFe.test={fadeMoment:0},function(t){t[t.Immediate=0]="Immediate",t[t.Delayed=5e3]="Delayed"}(r_||(r_={}));var D5;(function(t){t[t.BACK_TO_FRONT=-1]="BACK_TO_FRONT",t[t.NONE=0]="NONE",t[t.FRONT_TO_BACK=1]="FRONT_TO_BACK"})(D5||(D5={}));let hFe=class{constructor(){this._queue=new Pi,this.remove=()=>{}}get done(){return this._queue.length===0&&(!this._last||this._last.isLeaf)}resetOne(e){this._queue.clear(),this._queue.push(e),this._last=void 0}reset(e=null){this._queue.clear(),e!=null&&this._queue.pushArray(e),this._last=void 0}skipSubtree(){this._last=void 0}next(){var i;const e=(i=this._last)==null?void 0:i.children;return e!=null&&e[0]&&this._queue.pushArray(e),this._last=this._queue.pop(),this._last}},zIt=class{constructor(){this._q=new Pi}get done(){return this._q.length===0}reset(e){if(this._q.clear(),e!=null){this._q.pushArray(e);for(let i=0;ir.xmax||n[3]>r.ymax)return!1}else if(r.xmin>n[2]||r.ymin>n[3]||r.xmax0&&s>1.00000001*o)return!1;const l=e.maxScale;return!(l>0&&s<.99999999*l)}function n_(t,e){const i=t.lij,r=e.lij;return i[0]-r[0]||i[1]-r[1]||i[2]-r[2]}function dFe(t,e,i=null){i==null||i.length===0?t===D5.BACK_TO_FRONT?e.sort(UIt):e.sort(VIt):e.sort((r,n)=>BIt(r,n,t,i))}function UIt(t,e){const i=e.screenDepth-t.screenDepth;if(i!==0)return i;const r=t.lij,n=e.lij;return r[0]-n[0]||r[1]-n[1]||r[2]-n[2]}function VIt(t,e){const i=t.screenDepth-e.screenDepth;if(i!==0)return i;const r=t.lij,n=e.lij;return r[0]-n[0]||r[1]-n[1]||r[2]-n[2]}function pFe(t,e,i){const r=t.screenDepth,n=e.screenDepth;return rn?i:n_(t,e)}function BIt(t,e,i,r){return w_e(t,r)===w_e(e,r)?pFe(t,e,i):t?i:-i}function w_e(t,e){for(const i of e)if(t.intersectsExtent(i))return!0;return!1}function jIt(t,e){const i=t.distanceToPOI-e.distanceToPOI;if(i!==0)return i;const r=t.lij,n=e.lij;return r[0]-n[0]||r[1]-n[1]||r[2]-n[2]}function GIt(t,e){const i=t.length;for(let r=0;r!0;let _=this.tile;const x=_.level;let T;const A=this._tileLayerInfo.upsampleInfo,M=A!=null?A.tile.level:-1,I=A!=null&&M-x>=l,L=n==null?void 0:n.tilemapCache,F=r.type==="vector-tile-3d"?r.schemaHelper:null;for(;_&&f(_,n,!1)&&_.level>=s;){const z=_.level,k=x-z,U=_.layerInfo[i][e];if(U.data&&k>=l){(!I||z>M)&&this._setUpsampleTile(_),U.dataInvalidated&&(T=_);break}const j=(F==null?void 0:F.getLevelRowColumn(_.lij))??_.lij;if((L==null?void 0:L.getAvailability(j[0],j[1],_.lij[2]))!=="unavailable"&&z<=o&&!U.data&&!U.dataMissing&&((!T||_.level===s||z%gIe==0||x-T.level=c))break;_=_.parent}if(T!=null&&x-T.level=i)return n;r=n}return r}_setUpsampleTile(e,i){this._tileLayerInfo.setUpsampleInfo(this.tile,e),this.tile.updateRenderData(this._layerClass,ua.FADING,i)}get test(){return{findNextDownload:()=>this._findNextDownload(),tileLayerInfo:this._tileLayerInfo}}},WIt=class extends Tce{get _desiredMinLevelDelta(){throw x_e}get _progressiveLevelModulo(){throw x_e}dispose(){}};const x_e=new Error("Abstract method called on TileAgent"),hh=new WIt;let fFe=class extends Tce{constructor(){super(...arguments),this._scaleRangeEnabled=!1}get _desiredMinLevelDelta(){return See(this.tile.level)-(this.tile.elevationLevel-this.tile.level)}get _progressiveLevelModulo(){return 0}},mFe=class extends Tce{constructor(){super(),this._scaleRangeEnabled=!0}get _desiredMinLevelDelta(){return 0}get _progressiveLevelModulo(){return gIe}};var ST,rE;(function(t){t[t.Stretch=0]="Stretch",t[t.Lut=1]="Lut",t[t.Hillshade=2]="Hillshade",t[t.COUNT=3]="COUNT"})(ST||(ST={})),function(t){t[t.Noop=0]="Noop",t[t.PerBand=1]="PerBand",t[t.COUNT=2]="COUNT"}(rE||(rE={}));function YIt(t){t.fragment.uniforms.add(new Zt("u_colormap",e=>e.u_colormap),new ft("u_colormapOffset",e=>e.colormap.u_colormapOffset),new ft("u_colormapMaxIndex",e=>e.colormap.u_colormapMaxIndex),new ft("u_opacity",e=>e.common.u_opacity)),t.fragment.code.add(V`vec4 colormap(vec4 currentPixel, bool isFloat) { + `;default:return"0.0"}}const FPt=Object.freeze(Object.defineProperty({__proto__:null,build:S7e},Symbol.toStringTag,{value:"Module"}));let T7e=class E7e extends Hr{initializeProgram(e){return new $r(e.rctx,E7e.shader.get().build(this.configuration),C7e)}_setPipelineState(e,i){const r=this.configuration,n=e===Jt.NONE,s=e===Jt.FrontFace;return Ti({blending:r.output===ue.Color||r.output===ue.Alpha?n?xp:Q_(e):null,culling:kj(r.cullFace),depthTest:{func:_x(e)},depthWrite:n?r.writeDepth?sh:null:lG(e),colorWrite:ji,stencilWrite:r.hasOccludees?n1:null,stencilTest:r.hasOccludees?i?tx:bx:null,polygonOffset:n||s?r.polygonOffset?kPt:null:hG(r.enableOffset)})}initializePipeline(){return this._occludeePipelineState=this._setPipelineState(this.configuration.transparencyPassType,!0),this._setPipelineState(this.configuration.transparencyPassType,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}};T7e.shader=new Ir(FPt,()=>we(()=>Promise.resolve().then(()=>yXt),void 0));const kPt={factor:1,units:1};let wa=class extends pu{constructor(){super(...arguments),this.output=ue.Color,this.cullFace=Ln.None,this.transparencyPassType=Jt.NONE,this.hasSlicePlane=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.writeDepth=!0,this.hasOccludees=!1,this.enableOffset=!0,this.multipassEnabled=!1,this.cullAboveGround=!1,this.vvColor=!1}};y([fe({count:ue.COUNT})],wa.prototype,"output",void 0),y([fe({count:Ln.COUNT})],wa.prototype,"cullFace",void 0),y([fe({count:Cl.COUNT})],wa.prototype,"style",void 0),y([fe({count:Jt.COUNT})],wa.prototype,"transparencyPassType",void 0),y([fe()],wa.prototype,"hasSlicePlane",void 0),y([fe()],wa.prototype,"hasVertexColors",void 0),y([fe()],wa.prototype,"polygonOffset",void 0),y([fe()],wa.prototype,"writeDepth",void 0),y([fe()],wa.prototype,"hasOccludees",void 0),y([fe()],wa.prototype,"patternSpacing",void 0),y([fe()],wa.prototype,"lineWidth",void 0),y([fe()],wa.prototype,"enableOffset",void 0),y([fe()],wa.prototype,"draped",void 0),y([fe()],wa.prototype,"multipassEnabled",void 0),y([fe()],wa.prototype,"cullAboveGround",void 0),y([fe()],wa.prototype,"vvColor",void 0),y([fe({constValue:!1})],wa.prototype,"occlusionPass",void 0),y([fe({constValue:!1})],wa.prototype,"hasVvInstancing",void 0),y([fe({constValue:!1})],wa.prototype,"vvSize",void 0),y([fe({constValue:!1})],wa.prototype,"vvOpacity",void 0);const C7e=new Map([[J.POSITION,0],[J.COLOR,3],[J.UVMAPSPACE,4],[J.COLORFEATUREATTRIBUTE,5],[J.BOUNDINGRECT,6]]);let Mce=class extends cce{constructor(e){super(e,new VPt),this.supportsEdges=!0,this._vertexAttributeLocations=C7e,this._configuration=new wa}getConfiguration(e,i){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.style=this.parameters.style,this._configuration.patternSpacing=this.parameters.patternSpacing,this._configuration.lineWidth=this.parameters.lineWidth,this._configuration.draped=this.parameters.draped,this._configuration.transparencyPassType=i.transparencyPassType,this._configuration.enableOffset=i.camera.relativeElevation0)return;const e=(s=(n=this.symbolLayer)==null?void 0:n.material)==null?void 0:s.color,i=this._getCombinedOpacityAndColor(e);this._materials[eo.Fill]=BPt(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,polygonOffset:!1,hasVertexColors:!0,writeLinearDepth:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...(o=this._fastUpdates)==null?void 0:o.materialParameters}),this._needsUV=this._materials[eo.Fill]instanceof Mce;const r=this.symbolLayer.outline;if(this._isValidOutline(r)){const a=g8e(r.pattern);this._materials[eo.Outline]=new WM({width:Er(r.size),color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:a,cap:Mie(r.patternCap||"butt")})}this._context.stage.addMany(this._materials)}_isValidOutline(e){return(e==null?void 0:e.size)!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!=="style"||e.pattern.style!=="none")}destroy(){super.destroy(),this._context.stage.removeMany(this._materials),this._materials.length=0}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,WPt,this.symbolLayer.type))return null;const r=this._getVertexOpacityAndColor(e.renderingInfo,255),n=this.setGraphicElevationContext(i);return this.ensureDrapedStatus(n.mode==="on-the-ground"),this._createMaterials(),this.draped?this._createAsOverlay(i,r):this._createAs3DShape(i,r,n)}applyRendererDiff(e,i){var r;for(const n in e.diff){if(n!=="visualVariables"||!NP(this._fastUpdates,i,Nve))return Eo.RecreateSymbol;(r=this._materials[eo.Fill])==null||r.setParameters(this._fastUpdates.materialParameters)}return Eo.FastUpdate}layerOpacityChanged(){var e,i;if(this._materials[eo.Fill]!=null){const r=this._materials[eo.Fill].parameters.color,n=(i=(e=this.symbolLayer)==null?void 0:e.material)==null?void 0:i.color,s=this._getCombinedOpacity(n);this._materials[eo.Fill].setParameters({color:[r[0],r[1],r[2],s],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[eo.Outline]!=null){const r=this._materials[eo.Outline].parameters.color;this._materials[eo.Outline].setParameters({color:[r[0],r[1],r[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,i,r){const n=this._elevationContext.mode,s=a6(M7e.elevationModeChangeTypes,r,n);if(s!==Ys.UPDATE)return s;const o=s0(n);return this.updateGraphics3DGraphicElevationInfo(e,i,()=>o)}slicePlaneEnabledChanged(){var e;if((e=this._materials[eo.Fill])==null||e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[eo.Outline]){const i={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[eo.Outline].setParameters(i)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,i,r){var _;const n=ZL(e.geometry);if(!n)return null;const s=mce(n,this._context.elevationProvider,this._context.renderCoordsHelper,r),o=new YPt(s,i,this._context.layer.uid,e.uid),a=o.renderData.position.length/3;if(this._needsUV&&(o.uvMapSpace=$s(4*a,!0),o.boundingRect=Qa(9*a,!0),_7e(o.uvMapSpace,o.boundingRect,o.renderData.position,this._context.renderCoordsHelper)),o.objectAndLayerIdColor=(_=this._context.stage.renderView)==null?void 0:_.getObjectAndLayerIdColor(o),this._createAs3DShapeFill(e,o),this._materials[eo.Outline]&&this._createAs3DShapeOutline(o),this._logGeometryCreationWarnings(o.renderData,n.rings,"rings","FillSymbol3DLayer"),o.outGeometries.length===0)return null;const c=new eb({geometries:o.outGeometries,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:e.uid}),p=new b1(this,c,o.outGeometries,null,null,qPt,r);return p.alignedSampledElevation=o.renderData.sampledElevation,p.needsElevationUpdates=s0(r.mode),p}_createAs3DShapeFill(e,i){var n;const r=i.renderData.polygons;for(const{position:s,mapPositions:o,holeIndices:a,index:c,count:p}of r){if(this._context.clippingExtent!=null&&(Bn(b0),pp(b0,o),!bm(b0,this._context.clippingExtent)))continue;const _=uSt(o,a,this._context.elevationProvider.spatialReference);if(_.length===0)continue;const x=(n=this._fastUpdates)==null?void 0:n.visualVariables.color,S=e1e({material:this._materials[eo.Fill],indices:_,mapPositions:o,attributeData:{position:s,color:x?null:i.color,colorFeature:x?Rm(x.field,e):null,uvMapSpace:this._needsUV?TU(i.uvMapSpace,4*c,4*p):null,boundingRect:this._needsUV?zf(i.boundingRect,9*c,9*p):null,objectAndLayerIdColor:i.objectAndLayerIdColor}});i.outGeometries.push(S)}}_createAs3DShapeOutline(e){if(this._materials[eo.Outline]==null)return;const i=e.renderData.outlines;for(const{mapPositions:r,position:n}of i){if(this._context.clippingExtent!=null&&(Bn(b0),pp(b0,r),!bm(b0,this._context.clippingExtent)))continue;const s=Oie(this._materials[eo.Outline],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:n}},e.objectAndLayerIdColor);e.outGeometries.push(s)}}_createAsOverlay(e,i){var a;const r=ZL(e.geometry);if(r==null)return null;this._materials[eo.Fill].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[eo.Outline]!=null&&(this._materials[eo.Outline].renderPriority=this._renderPriority);const n=HNe(r,this._context.overlaySR),s=new XPt(n,i,this._context.layer.uid,e.uid),o=s.renderData.position.length/3;return this._needsUV&&(s.uvMapSpace=$s(4*o,!0),MPt(s.uvMapSpace,s.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),s.outBoundingBox=Bn(),s.objectAndLayerIdColor=(a=this._context.stage.renderView)==null?void 0:a.getObjectAndLayerIdColor(s),this._createAsOverlayFill(e,s),this._materials[eo.Outline]&&this._createAsOverlayOutline(s),this._logGeometryCreationWarnings(s.renderData,r.rings,"rings","FillSymbol3DLayer"),s.outGeometries.length===0?null:new EG(this,s.outGeometries,s.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,i){var n;const r=i.renderData.polygons;for(const{position:s,holeIndices:o,index:a,count:c}of r){const p=Bn(b0);if(pp(p,s),!bm(p,this._context.clippingExtent))continue;const _=UP(s,o,3);if(_.length===0)continue;sP(i.outBoundingBox,p);const x=(n=this._fastUpdates)==null?void 0:n.visualVariables.color,S=e1e({material:this._materials[eo.Fill],indices:_,attributeData:{position:s,color:x?null:i.color,colorFeature:x?Rm(x.field,e):null,uvMapSpace:this._needsUV?TU(i.uvMapSpace,4*a,4*c):null,objectAndLayerIdColor:i.objectAndLayerIdColor}});i.outGeometries.push(new BP(S,i))}}_createAsOverlayOutline(e){if(this._materials[eo.Outline]==null)return;const i=e.renderData.outlines;for(let r=0;rthis._createAsOverlay(e,i),createAs3DShape:(e,i,r)=>this._createAs3DShape(e,i,r)}}};A7e.elevationModeChangeTypes={definedChanged:Ys.RECREATE,staysOnTheGround:Ys.NONE,onTheGroundChanged:Ys.RECREATE};const b0=va();let YPt=class extends SG{constructor(e,i,r,n){super(e,r,n),this.color=i}},XPt=class extends SG{constructor(e,i,r,n){super(e,r,n),this.color=i}};var eo;(function(t){t[t.Fill=0]="Fill",t[t.Outline=1]="Outline"})(eo||(eo={}));let O7e=class{constructor(e,i="center",r=!1,n=yt(),s=Mi(0,0,0,-1),o="world",a=W(),c=0){this.verticalOffset=e,this.anchor=i,this.hasLabelVerticalOffset=r,this.screenOffset=n,this.centerOffset=s,this.centerOffsetUnits=o,this.translation=a,this.elevationOffset=c}},P7e=class{constructor(e,i="center",r="center",n=null,s=yt()){this.placement=e,this.horizontalPlacement=i,this.verticalPlacement=r,this.text=n,this.displaySize=s}};const ZPt="arial-unicode-ms",Fve="woff2",kve=new Map,R7e=new Set;let JPt=class{constructor(e,i){this.fontFace=e,this.promise=i}};async function KPt(t){const e=t5t(t),i=kve.get(e);if(i)return i.promise;const r=new FontFace(t.family,`url('${Mr.fontsUrl}/woff2/${e}.${Fve}') format('${Fve}')`,{style:t.style,weight:t.weight}),n=document.fonts;if(n.has(r)&&r.status==="loading")return r.loaded;const s=r.load().then(()=>(n.add(r),r));return kve.set(e,new JPt(r,s)),R7e.add(r),s}function QPt(t){return R7e.has(t)}function e5t(t){if(!t)return ZPt;const e=t.toLowerCase().split(" ").join("-");switch(e){case"serif":return"noto-serif";case"sans-serif":return"arial-unicode-ms";case"monospace":return"ubuntu-mono";case"fantasy":return"cabin-sketch";case"cursive":return"redressed";default:return e}}function t5t(t){const e=i5t(t)+r5t(t);return e5t(t.family)+(e.length>0?e:"-regular")}function i5t(t){if(!t.weight)return"";switch(t.weight.toLowerCase()){case"bold":case"bolder":return"-bold"}return""}function r5t(t){if(!t.style)return"";switch(t.style.toLowerCase()){case"italic":case"oblique":return"-italic"}return""}let I7e=class $7e{constructor(e){this.definition=e,this.key=JSON.stringify(e),this.haloSize=Math.round(e.halo.size),this.textStyle=this._colorToRGBA(e.color),this.haloStyle=this._colorToRGB(e.halo.color),this.backgroundStyle=e.background.color[3]!==0?this._colorToRGBA(e.background.color):null}fontString(e){const i=this.definition.font,r="sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji";return`${i.style} ${i.weight} ${e}px ${i.family}, ${r}`}setFontProperties(e,i){e.font=this.fontString(i),e.textAlign="left",e.textBaseline="alphabetic"}_colorToRGB(e){return`rgb(${e.slice(0,3).map(i=>Math.floor(255*i)).toString()})`}_colorToRGBA(e){return`rgba(${e.slice(0,3).map(i=>Math.floor(255*i)).toString()},${e[3]})`}static async fromSymbol(e,i){var S,C,M,P,$;const r=(S=e==null?void 0:e.material)==null?void 0:S.color,n=qe.toUnitRGBA(r)??bp,s=e.size!=null?Er(e.size):12,o=e.lineHeight,a=e.background!=null?qe.toUnitRGBA(e.background.color):bp,c={family:((C=e.font)==null?void 0:C.family)??"sans-serif",decoration:((M=e.font)==null?void 0:M.decoration)??"none",weight:((P=e.font)==null?void 0:P.weight)??"normal",style:(($=e.font)==null?void 0:$.style)??"normal"},p=e.halo,_=(p==null?void 0:p.color)!=null&&p.size>0?{size:Er(p.size),color:qe.toUnitRGBA(p.color)}:{size:0,color:bp},x=new $7e({color:n,size:s,background:{color:a,padding:e.background!=null?[.65*s,.5*s]:[0,0],borderRadius:e.background!=null?s*(6/16):0},lineSpacingFactor:o,font:c,halo:_,pixelRatio:i});if(e.font){let F=!1;const z=x.fontString(s);try{F=(await document.fonts.load(z)).some(k=>!QPt(k))}catch{Ce.getLogger("esri.views.3d.webgl-engine.lib.TextRenderParameters").warnOnce(`Failed to preload font '${z}'. Some text symbology may be rendered using the default browser font.`)}if(!F&&!n5t.has(e.font.family))try{await KPt(e.font)}catch{}}return x}};const n5t=new Set(["Arial","Times New Roman","Courier New","serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]),Pb=4096;let lT=class extends ze{constructor(e){super(e),this.type=Ws.Texture,this.id=mp(),this.events=new Dn,this._glTexture=null,this._atlas=new a5t(256,256),this._needsRepack=!1,this._canRepack=!0,this._elementsToRender=new Map,this._elements=new Map,this._stageObjects=new Map,this.updating=!1}initialize(){this._canvas=document.createElement("canvas"),this._canvas.setAttribute("id","textAtlasCanvas"),this._canvas.setAttribute("style","display:none"),this._ctx=this._canvas.getContext("2d"),this._stage=this.view._stage,this._stage.add(this),this._updateCanvasElementSize(this._atlas),this._reset()}unload(){this._glTexture=Kt(this._glTexture),this.updating=!1,this.events.emit("unloaded")}get glTexture(){return this._glTexture}static get maxSize(){return G$=0,[Pb-Rb-G$,Pb-Rb-G$-zve]}load(e){if(this._glTexture)return this._glTexture;const i=new rn;return i.wrapMode=Bi.CLAMP_TO_EDGE,i.samplingMode=ki.LINEAR_MIPMAP_LINEAR,i.hasMipmap=!0,i.preMultiplyAlpha=!0,i.maxAnisotropy=e.parameters.maxMaxAnisotropy,this._glTexture=new Ai(e,i,this._canvas),this._frameWorker=this.view.resourceController.scheduler.registerTask(ni.TEXT_TEXTURE_ATLAS,this),this.setDirty(),this._glTexture}dispose(){this._elements.clear(),this._elementsToRender.clear(),this._frameWorker=en(this._frameWorker),this._glTexture&&(this._stage.remove(this),this._glTexture=Kt(this._glTexture)),this._canvas.width=0,this._canvas.height=0,this._canvas=null,this._ctx=null}_updateCanvasElementSize(e){this._canvas.setAttribute("width",e.width.toString()),this._canvas.setAttribute("height",e.height.toString())}_resizeAtlas(e,i){var s,o;const{width:r,height:n}=this._atlas;r===e&&n===i||(this._atlas.width=e,this._atlas.height=i,(s=this._glTexture)==null||s.resize(e,i),(o=this._glTexture)==null||o.updateData(0,0,0,r,n,this._canvas),this._updateCanvasElementSize(this._atlas),this._elements.forEach(a=>{const c=this._stageObjects.get(a.textRenderer.key);c==null||c.forEach(p=>vY(p,a))}),this._reset())}_reset(){this._elementsToRender.clear(),this._atlas.reset(),this._needsRepack=!0,this.setDirty()}_addAtlasElement(e,i,r,n){const s=this._atlas;if(s.widths.width>=c.x+r);if(a==null){if(s.heightr.height)this._resizeAtlas(r.width,p);else if(r.widthvY(n,e))}get running(){return this.updating}runTask(e){if(this._glTexture==null)return Jl.YIELD;for(;this._needsRepack&&(this._canRepack||this._atlas.heightthis._processAddition(r)),e.madeProgress()}if(this._elementsToRender.size>0){for(const[i,r]of this._elementsToRender){if(e.done)break;this._renderElement(r),this._elementsToRender.delete(i),e.madeProgress()}this._glTexture.setData(this._canvas)}this.updating=this._elementsToRender.size>0}addTextTexture(e,i){const r=e.key;this._addStageObject(r,i);let n=this._elements.get(r);n==null&&(n=new o5t(this._atlas,e),this._processAddition(n),this.setDirty()),s5t(i,n),vY(i,n)}removeTextTexture(e,i){const r=e.key;if(!this._elements.get(r))return;this._removeStageObject(r,i);const n=this._stageObjects.get(r);n&&n.size!==0||this._elements.delete(r),(n==null?void 0:n.size)===0&&this._stageObjects.delete(r),this._canRepack=!0}setDirty(){this._glTexture&&(this.updating=!0)}get test(){const{_elements:e,_stageObjects:i,_atlas:r}=this,n=this;return{elements:e,stageObjects:i,atlas:r,resizeAtlas:(s,o)=>n._resizeAtlas(s,o),run:s=>n.runTask(s)}}};function s5t(t,e){t.geometries[0].setAttributeData(J.SIZE,[e.textRenderer.displayWidth,e.textRenderer.displayHeight]),t.geometryVertexAttributeUpdated(t.geometries[0],J.SIZE)}function vY(t,e){t.geometries[0].setAttributeData(J.UV0,e.uv),t.geometryVertexAttributeUpdated(t.geometries[0],J.UV0,!0)}y([w({constructOnly:!0})],lT.prototype,"view",void 0),y([w({type:Boolean})],lT.prototype,"updating",void 0),lT=y([Z("esri.views.3d.webgl-engine.lib.TextTextureAtlas")],lT);const Rb=2,zve=2;let o5t=class{constructor(e,i){this._atlas=e,this.textRenderer=i,this._uv=Xi(),this._newPosition=[0,0]}get uv(){if(this._xOffset==null||this._yOffset==null)return bp;const{renderedWidth:e,renderedHeight:i}=this.textRenderer;return rs(this._uv,this._xOffset/this._atlas.width,(this._yOffset+i)/this._atlas.height,(this._xOffset+e)/this._atlas.width,this._yOffset/this._atlas.height)}setNewPosition(e){this._newPosition[0]=e.x,this._newPosition[1]=e.y}commitNewPosition(){return this._xOffset=this._newPosition[0],this._yOffset=this._newPosition[1],this._newPosition}get xOffset(){return this._xOffset}get yOffset(){return this._yOffset}},a5t=class{constructor(e,i){this.width=e,this.height=i,this.cursors=new Map,this.nextY=0}reset(){this.cursors.clear(),this.nextY=G$}},Uve=class{constructor(e){this.y=e,this.x=G$}},G$=0,l5t=class{constructor(e,i,r){this._renderer=new a8e(e,i,r,lT.maxSize)}get key(){return this._renderer.key}get baselineAnchorY(){return 1-this._renderer.firstRenderedBaselinePosition/this._renderer.renderedHeight}get displayWidth(){return this._renderer.displayWidth}get displayHeight(){return this._renderer.displayHeight}create(){const e=QU(c5t,this._renderer.renderedWidth,this._renderer.renderedHeight),i=e.getContext("2d");return i.save(),this._renderer.render(i,0,0),i.restore(),new DE(e,{wrap:{s:Bi.CLAMP_TO_EDGE,t:Bi.CLAMP_TO_EDGE},noUnpackFlip:!1,mipmap:!0,preMultiplyAlpha:!0})}};const c5t={canvas:null},u5t=[0,0,1];let h5t=class extends w1{constructor(e,i,r,n){super(e,i,r,n),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const e=dG(this.symbolLayer.size);if(e)throw new se("graphics3dtextsymbollayer:invalid-size",e)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await I7e.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const i=e.graphic,r=XL(i.geometry);if(r==null)return this.logger.warn(`unsupported geometry type for text symbol: ${i.geometry.type}`),null;const n=this.symbolLayer.text;if(n==null||n==="")return null;const s=Xse(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(s!=null&&!$Me(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:o}=this.symbolLayer,a=new O7e(s);RCt(o,a.screenOffset);const c=new P7e(a,this.symbolLayer.horizontalAlignment,PCt(o));return this._createAs3DShape(i,r,n,c)}createLabel(e,i,r,n,s){const o=e.graphic,a=XL(o.geometry);if(a==null)return this.logger.warn(`unsupported geometry type for label: ${o.geometry.type}`),null;const c=i.text;return!c||/^\s+$/.test(c)?null:this._createAs3DShape(o,a,c,i,r,n,s)}setGraphicElevationContext(e,i,r=0){return super.setGraphicElevationContext(e,i),i.addOffsetRenderUnits(r),i}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,i){return Vve(e,i,(r,n)=>{this.updateGraphicElevationContext(n,r)}),Ys.UPDATE}slicePlaneEnabledChanged(e,i){return Vve(e,i,r=>{for(const n of r.stageObject.geometries)n.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}updateGraphicElevationContext(e,i){const r=i.elevationContext;this.setGraphicElevationContext(e,r,i.metadata!=null?i.metadata.elevationOffset:0),i.needsElevationUpdates=s0(r.mode)||r.mode==="absolute-height"}_defaultElevationInfoNoZ(){return p5t}_createAs3DShape(e,i,r,n,s=null,o=null,a=()=>n.placement.elevationOffset){var ne;const c=this.setGraphicElevationContext(e,new BU,n.placement.elevationOffset),p=((ne=e.geometry)==null?void 0:ne.type)==="polyline",_=e.uid;let x=null,S=null;if(o==null){const ie=c8e(n.horizontalPlacement);x=new l5t(r,ie,this._textRenderParameters);let he=null;if(this._context.sharedResources.textures!=null){S=this._context.sharedResources.textures.fromData(x.key,()=>x.create()),S.texture.events.on("unloaded",()=>he==null?void 0:he.release());const ce=this._context.stage.renderView.textureRepository.acquire(S.texture.id);if(ce==null||yd(ce))return S.release(),null;he=ce}}const C=d5t(x,n),M={occlusionTest:!0,screenOffset:n.placement.screenOffset,anchorPosition:C,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:n.placement.centerOffsetUnits,drawInSecondSlot:!0};if(o?M.textureId=o.id:S&&(M.textureId=S.texture.id),n.placement.verticalOffset!=null){const{screenLength:ie,minWorldLength:he,maxWorldLength:ce}=n.placement.verticalOffset;M.verticalOffset={screenLength:Er(ie),minWorldLength:he||0,maxWorldLength:ce??1/0}}if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:ie,screenSizePerspectiveSettingsLabels:he}=this._context.sharedResources,ce=o8e(this._textRenderParameters);M.screenSizePerspective=he.overrideFontHeight(ce.maxHeight),M.screenSizePerspectiveAlignment=ie}p&&(M.shaderPolygonOffset=1e-4),M.hasSlicePlane=this._context.slicePlaneEnabled;const P=(ie,he)=>{const ce=JSON.stringify(he);let ve=ie.get(ce);return ve==null&&(ve=new kP(he),ie.add(ce,ve)),ve},$=s?P(s,M):new kP(M),F=n.placement.translation,z=x?Ji(x.displayWidth,x.displayHeight):e1,k=n.placement.centerOffset,U=zte($,u5t,F,null,z,k,[0,0],null),j=qle(this._context,i,U,c,_);if(j==null)return null;const G=(ie,he,ce,ve,ge,pe)=>{const Ee=a()||n.placement.elevationOffset,te=this.setGraphicElevationContext(e,he,Ee);return CT(ie,te,ce,ve,ge,pe)},Y=new b1(this,j.object,[U],s==null?[$]:null,S,G,c);Y.alignedSampledElevation=j.sampledElevation,Y.needsElevationUpdates=s0(c.mode)||c.mode==="absolute-height",Y.getScreenSize=(ie=yt())=>(ie[0]=x?x.displayWidth:n.displaySize[0],ie[1]=x?x.displayHeight:n.displaySize[1],ie);const Q=new R6e(n.placement.elevationOffset,r);return Y.metadata=Q,YL(Y,i,this._context.elevationProvider),Y}};function Vve(t,e,i){t&&t.forEach(r=>{const n=e(r);n!=null&&i(n,r.graphic)})}function d5t(t,e){if(e.verticalPlacement==="baseline"){const r=ACt[e.horizontalPlacement],n=t!=null?t.baselineAnchorY:0;return Ji(r,n)}const i=OCt(e.horizontalPlacement,e.verticalPlacement);return fk[i]}const p5t={mode:"relative-to-ground",offset:0},f5t={"calm-small":{waveStrength:.005,perturbationStrength:.02,textureRepeat:12,waveVelocity:.01},"rippled-small":{waveStrength:.02,perturbationStrength:.09,textureRepeat:32,waveVelocity:.07},"slight-small":{waveStrength:.05,perturbationStrength:.07,textureRepeat:28,waveVelocity:.1},"moderate-small":{waveStrength:.075,perturbationStrength:.07,textureRepeat:24,waveVelocity:.1},"calm-medium":{waveStrength:.003125,perturbationStrength:.01,textureRepeat:8,waveVelocity:.02},"rippled-medium":{waveStrength:.035,perturbationStrength:.015,textureRepeat:12,waveVelocity:.07},"slight-medium":{waveStrength:.06,perturbationStrength:.015,textureRepeat:8,waveVelocity:.12},"moderate-medium":{waveStrength:.09,perturbationStrength:.03,textureRepeat:4,waveVelocity:.12},"calm-large":{waveStrength:.01,perturbationStrength:0,textureRepeat:4,waveVelocity:.05},"rippled-large":{waveStrength:.025,perturbationStrength:.01,textureRepeat:8,waveVelocity:.11},"slight-large":{waveStrength:.06,perturbationStrength:.02,textureRepeat:3,waveVelocity:.13},"moderate-large":{waveStrength:.14,perturbationStrength:.03,textureRepeat:2,waveVelocity:.15}},m5t=["polyline","polygon","extent"];let Nie=class sS extends w1{constructor(e,i,r,n){super(e,i,r,n)}async doLoad(){}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const i=e.graphic;if(!this._validateGeometry(i.geometry,m5t,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(i);return this.ensureDrapedStatus(r.mode==="on-the-ground"),this.ensureMaterial(),this.draped?this._createAsOverlay(i):this._createAs3DShape(i,r,i.uid)}ensureMaterial(){if(this._materials[0])return;const e=new zNe,i=this.symbolLayer.color;i!=null&&(e.color=qe.toUnitRGBA(i));const r=this._getCombinedOpacity(i,{hasIntrinsicColor:!0});e.color=[e.color[0],e.color[1],e.color[2],r],e.transparent=r<1||this.needsDrivenTransparentPass,e.waveDirection=this.symbolLayer.waveDirection!=null?sS.headingVectorFromAngle(this.symbolLayer.waveDirection):Ji(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=f5t[n];e.waveStrength=s.waveStrength,e.waveTextureRepeat=s.textureRepeat,e.waveVelocity=s.waveVelocity,e.flowStrength=s.perturbationStrength,e.hasSlicePlane=this._context.slicePlaneEnabled,e.isDraped=this.draped,this._materials[0]=new kNe(e),this._context.stage.add(this._materials[0])}layerOpacityChanged(){if(this._materials[0]==null)return;const e=this._materials[0].parameters.color,i=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=i<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],i],transparent:r})}layerElevationInfoChanged(e,i,r){const n=this._elevationContext.mode,s=a6(sS.elevationModeChangeTypes,r,n);if(s!==Ys.UPDATE)return s;const o=s0(n);return this.updateGraphics3DGraphicElevationInfo(e,i,()=>o)}slicePlaneEnabledChanged(){var e;return(e=this._materials[0])==null||e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,i,r){var x;const n=ZL(e.geometry);if(n==null)return null;const s=mce(n,this._context.elevationProvider,this._context.renderCoordsHelper,i),o=s.position.length/3,a=Qa(2*o);this._createUVCoordsFromVertices(a,s.mapPositions,o,this._context.elevationProvider.spatialReference);const c=new g5t(s,a,this._context.layer.uid,e.uid);if(c.objectAndLayerIdColor=(x=this._context.stage.renderView)==null?void 0:x.getObjectAndLayerIdColor(c),this._create3DShapeGeometries(c),this._logGeometryCreationWarnings(c.renderData,n.rings,"rings","WaterSymbol3DLayer"),c.outGeometries.length===0)return null;const p=new eb({geometries:c.outGeometries,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:r}),_=new b1(this,p,c.outGeometries,null,null,T6e,i);return _.alignedSampledElevation=c.renderData.sampledElevation,_.needsElevationUpdates=s0(i.mode),_}_createUVCoordsFromVertices(e,i,r,n){const s=xs(n);ld(Ib);for(let c=0;cthis._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}};Nie.unitSizeOfTexture=100,Nie.elevationModeChangeTypes={definedChanged:Ys.RECREATE,staysOnTheGround:Ys.NONE,onTheGroundChanged:Ys.RECREATE};const a8=yt(),Ib=Ni(),Bve=yt(),Qx=va();let g5t=class extends SG{constructor(e,i,r,n){super(e,r,n),this.uvCoords=i}},y5t=class extends SG{constructor(e,i,r,n){super(e,r,n),this.uvCoords=i}};function v5t(t,e,i,r){var s;const n=((s=b5t[t.type])==null?void 0:s[e.type])||_5t[e.type];return n?new n(t,e,i,r):(Ce.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayerFactory").error("GraphicsLayerFactory#make",`unknown symbol type ${e.type}`),null)}const _5t={icon:Aie,object:TOt,line:y8e,path:EPt,fill:A7e,extrude:IEt,text:h5t,water:Nie},b5t={"mesh-3d":{fill:QAt}};let w5t=class extends Hle{set symbol(e){this._symbol=e,e.symbolLayers.forEach((i,r)=>{const n=this.symbolLayers[r];n!=null&&(n.symbol=e,n.symbolLayer=i)})}get symbol(){return this._symbol}constructor(e,i,r){super(i.schedule),this._symbol=e,this._context=i,this._backgroundLayers=r,this._destroyed=!1,this.symbolLayers=new Array,this.referenced=0,this._extentPadding=0}async doLoad(e){let i=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(i=this._backgroundLayers.concat(i));const r=i.length;for(;this.symbolLayers.length{this.symbolLayers[s]=null,a.destroy()});c&&n.push(c),this.symbolLayers[s]=a}if(await HB(this.symbolLayers,async(s,o)=>{if(s!=null)try{await s.load(),this._extentPadding+=Math.max(this._extentPadding,s.extentPadding)}catch{this.symbolLayers[o]=null}}),n.forEach(s=>s.remove()),St(e),this.symbolLayers.length&&!this.symbolLayers.some(s=>!!s))throw new Error}getSymbolLayerSize(e){const i=this.symbolLayers[e];return i!=null?i.getCachedSize():null}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some(e=>e==null?void 0:e.queryForSnapping)}createGraphics3DGraphic(e,i){var o,a;const r=e.graphic,n=this.symbolLayers.map(c=>(c==null?void 0:c.createGraphics3DGraphic(e))??null),s=this._context.arcade||((a=(o=this._context.featureExpressionInfoContext)==null?void 0:o.arcade)==null?void 0:a.modules)||null;return new K3t(r,i||this,n,e.layer,s)}get complexity(){return Gle(this.symbolLayers.map(e=>e!=null?e.complexity:null))}globalPropertyChanged(e,i){const r=this.symbolLayers.length;for(let n=0;n{const c=a.layers[n];return c instanceof b1?c:null};if(s!=null&&!s.globalPropertyChanged(e,i,o))return!1}return!0}applyRendererDiff(e,i){return this.loadStatus!==np.LOADED?Eo.RecreateSymbol:this.symbolLayers.reduce((r,n)=>r!==Eo.RecreateSymbol&&n!=null?Math.min(r,n.applyRendererDiff(e,i)):r,Eo.FastUpdate)}prepareSymbolPatch(e){if(this.loadStatus===np.FAILED||e.diff.type!=="partial")return;const i=e.diff.diff;if(!i.symbolLayers||i.symbolLayers.type!=="partial")return;const r=i.symbolLayers.diff;this.symbolLayers.forEach((n,s)=>{if(n==null)return;const o=r[s];if(o){const a={diff:o,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};n.prepareSymbolLayerPatch(a),e.symbolStatePatches.push(...a.symbolLayerStatePatches),a.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push((c,p)=>{const _=c.layers[s];_!=null&&a.graphics3DGraphicPatches.forEach(x=>x(_,p))})}})}updateGeometry(e,i){return this._updateGeometryOrTransform(e,(r,n)=>r.updateGeometry(n,i))}updateTransform(e,i,r,n){return this._updateGeometryOrTransform(e,(s,o)=>s.updateTransform(o,i,r,n))}_updateGeometryOrTransform(e,i){for(let r=0;r{n!=null&&(n.loadStatus===np.LOADING?e++:n.isFastUpdatesEnabled()?r++:i++)}),{loading:e,slow:i,fast:r}}async queryForSnapping(e,i,r,n){const s=this.symbolLayers.filter(ys).filter(a=>a.queryForSnapping!=null).map(a=>a.queryForSnapping(e,i,r,n)),o=await Promise.all(s);return St(n),o.flat()}destroy(){if(this.destroyed)console.error("Graphics3DSymbol.destroy called when already destroyed!");else{super.destroy();for(const e of this.symbolLayers)e!=null&&e.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}};const l8=new Q3t;let x5t=class extends Hle{constructor(e,i,r){super(i),this.symbol=e,this._convert=r,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(e){return this.graphics3DSymbol!=null?this.graphics3DSymbol.getSymbolLayerSize(e):null}get symbolLayers(){return this.graphics3DSymbol!=null?this.graphics3DSymbol.symbolLayers:[]}get extentPadding(){return this.graphics3DSymbol!=null?this.graphics3DSymbol.extentPadding:0}async doLoad(e){const i=await this.symbol.fetchSymbol({signal:e});i.id=this.symbol.id,this.graphics3DSymbol=this._convert(i),this.graphics3DSymbol!=null&&await this.graphics3DSymbol.load()}createGraphics3DGraphic(e){return this.graphics3DSymbol!=null?this.graphics3DSymbol.createGraphics3DGraphic(e,this):null}get complexity(){return this.graphics3DSymbol!=null?this.graphics3DSymbol.complexity:pDe}globalPropertyChanged(e,i){return this.graphics3DSymbol!=null&&this.graphics3DSymbol.globalPropertyChanged(e,i)}applyRendererDiff(e,i){return this.graphics3DSymbol!=null?this.graphics3DSymbol.applyRendererDiff(e,i):Eo.RecreateSymbol}prepareSymbolPatch(e){this.graphics3DSymbol!=null&&this.graphics3DSymbol.prepareSymbolPatch(e)}updateGeometry(e,i){return this.graphics3DSymbol!=null&&this.graphics3DSymbol.updateGeometry(e,i)}updateTransform(e,i,r,n){var s;return((s=this.graphics3DSymbol)==null?void 0:s.updateTransform(e,i,r,n))??!1}onRemoveGraphic(){}getFastUpdateStatus(){return this.graphics3DSymbol!=null?this.graphics3DSymbol.getFastUpdateStatus():{loading:1,fast:0,slow:0}}destroy(){this.graphics3DSymbol!=null&&this.graphics3DSymbol.destroy(),this.graphics3DSymbol=void 0,super.destroy()}get destroyed(){return this.graphics3DSymbol===void 0}};function Oce(t){return t instanceof x5t?t.graphics3DSymbol:t instanceof w5t?t:null}const r9=Ce.getLogger("esri.views.3d.layers.graphics.labelPlacement");let S5t=class{constructor(e,i,r,n=null){this.graphics3DGraphic=e,this.labelSymbol=i,this.labelClass=r,this.disablePlacement=n}};function jve(t){const e=I5t(t);if(e==null)return null;const i=T5t(t,e);if(i==null)return null;const r=i.anchor,n=!!e.hasLabelVerticalOffset,s=e.verticalOffset;return C5t(new O7e(s,r,n),i,t)}function T5t(t,e){if(e.anchor)return e;const i=t.labelClass.labelPlacement,r=Sm[i],n=r||sV(t);return i&&!r&&r9.warnOncePerTick(`the requested label placement '${i}' is currently unsupported in SceneView.`),E5t(n,t)}function Pce(t){const e=t.graphics3DGraphic.graphics3DSymbol,i=Oce(e);return i!=null?i.symbol.symbolLayers.at(0):null}function E5t(t,e){const i=e.graphics3DGraphic.graphic.geometry;if(i==null)return null;if(e.disablePlacement!=null)return e.labelClass.labelPlacement?(r9.warnOncePerTick(Gve(t==null?void 0:t.placement,e.disablePlacement.logEntityDescription)),sV(e)):t;const r=i.type;switch(r){case"polyline":case"polygon":case"extent":case"multipoint":if(e.labelClass.labelPlacement)return r9.warnOncePerTick(Gve(t==null?void 0:t.placement,`'${r}' geometries`)),sV(e);break;case"point":case"mesh":return t}return t}function Gve(t,e){return`the requested label placement '${t}' is currently unsupported for ${e} in SceneView.`}function sV(t){const e=t.graphics3DGraphic.graphic.geometry;if(e==null)return null;switch(e.type){case"polyline":case"extent":case"multipoint":return{placement:"center-center",normalizedOffset:el,anchor:"center"};case"polygon":{const i=Pce(t);return i!=null&&i.type==="extrude"?Sm["above-center"]:{placement:"center-center",normalizedOffset:el,anchor:"center"}}case"point":case"mesh":return Sm["above-center"];default:return}}function C5t(t,e,i){const r=i.graphics3DGraphic.graphic.geometry;if(r==null)return null;switch(r.type){case"point":M5t(t,e,i);break;case"polygon":A5t(t,e,i);break;case"mesh":Rce(t,e,i.graphics3DGraphic.layers[0])}const n=wCt-eV;return t.screenOffset[0]+=n*e.normalizedOffset[0],t.screenOffset[1]+=n*e.normalizedOffset[1],t}function A5t(t,e,i){const r=Pce(i);if(r!=null)switch(r.type){case"extrude":{const n=i.graphics3DGraphic.layers[0];n!=null?(n.getBoundingBoxObjectSpace(H$),_m(H$,t.translation),t.translation[2]=ux(H$)/2):Ie(t.translation,0,0,0),Rce(t,e,n);break}}}function M5t(t,e,i){const r=Pce(i);if(r==null)return;const n=i.graphics3DGraphic.layers[0];switch(n!=null?n.getCenterObjectSpace(t.translation):Ie(t.translation,0,0,0),r.type){case"icon":case"text":O5t(t,e,i,n);break;case"object":Rce(t,e,n)}}function O5t(t,e,i,r){const{graphics3DGraphic:n}=i,s=r!=null?r.getScreenSize():null;if(n.isDraped||s==null)t.hasLabelVerticalOffset||t.anchor==="center"||(Sm[i.labelClass.labelPlacement]&&r9.warnOncePerTick(`the requested placement '${e.placement}' is currently unsupported for draped graphics`),t.anchor="center");else{const o=P5t(i);t.screenOffset[0]=s[0]/2*(e.normalizedOffset[0]-o[0]);const a=s[1]/2*(e.normalizedOffset[1]-o[1]);t.hasLabelVerticalOffset?(t.centerOffset[1]=a,t.centerOffsetUnits="screen"):t.screenOffset[1]=a}}function P5t(t,e=$5t){const{graphics3DGraphic:i}=t,r=i.layers[0],n=(r==null?void 0:r.stageObject.geometries[0].material)??null;if(n&&n instanceof kP){const s=n.parameters.anchorPosition;e[0]=2*(s[0]-.5),e[1]=2*(s[1]-.5)}else e[0]=0,e[1]=0;return e}function Rce(t,e,i){const r=i!=null?i.getBoundingBoxObjectSpace(H$):H$,n=st(r[3]-r[0],r[4]-r[1],r[5]-r[2]),s=Math.sqrt(n[0]*n[0]+n[1]*n[1]);t.centerOffset[0]=s/2*e.normalizedOffset[0];const o=t.translation[2],a=n[2]/2*e.normalizedOffset[1];t.translation[2]=0,t.elevationOffset=o+a;const c=nt(n);t.centerOffset[2]=c/2*e.normalizedOffset[2]}function R5t(t){return t==="above-center"}function I5t(t){const e=t.labelClass.labelPlacement,{labelSymbol:i,graphics3DGraphic:r}=t,n=Oce(r.graphics3DSymbol),s=(n==null?void 0:n.symbol.type)==="point-3d"?n.symbol:null,o=Sm[e]||sV(t);return s!=null&&s.supportsCallout()&&s.hasVisibleVerticalOffset()&&!r.isDraped?{placement:null,hasLabelVerticalOffset:!1,verticalOffset:Hve(s.verticalOffset),anchor:null,normalizedOffset:null}:!i||!i.hasVisibleVerticalOffset()||s!=null&&s.supportsCallout()&&s.verticalOffset&&!r.isDraped?{placement:null,verticalOffset:null,anchor:null,normalizedOffset:null,hasLabelVerticalOffset:!1}:o&&R5t(o.placement)?{placement:"above-center",verticalOffset:Hve(i.verticalOffset),anchor:"bottom",normalizedOffset:[0,o.normalizedOffset[1],0],hasLabelVerticalOffset:!0}:(r9.errorOncePerTick("Callouts and vertical offset on labels are currently only supported with 'above-center' label placement (not with "+e+" placement)"),null)}function Hve(t){const{screenLength:e,minWorldLength:i,maxWorldLength:r}=t;return{screenLength:e,minWorldLength:i,maxWorldLength:r}}const Sm={"above-center":{placement:"above-center",normalizedOffset:[0,1,0],anchor:"bottom"},"above-left":{placement:"above-left",normalizedOffset:[-1,1,0],anchor:"bottom-right"},"above-right":{placement:"above-right",normalizedOffset:[1,1,0],anchor:"bottom-left"},"below-center":{placement:"below-center",normalizedOffset:[0,-1,2],anchor:"top"},"below-left":{placement:"below-left",normalizedOffset:[-1,-1,0],anchor:"top-right"},"below-right":{placement:"below-right",normalizedOffset:[1,-1,0],anchor:"top-left"},"center-center":{placement:"center-center",normalizedOffset:[0,0,1],anchor:"center"},"center-left":{placement:"center-left",normalizedOffset:[-1,0,0],anchor:"right"},"center-right":{placement:"center-right",normalizedOffset:[1,0,0],anchor:"left"}},qve={"above-center":["default","esriServerPointLabelPlacementAboveCenter"],"above-left":["esriServerPointLabelPlacementAboveLeft"],"above-right":["esriServerPointLabelPlacementAboveRight"],"below-center":["esriServerPointLabelPlacementBelowCenter"],"below-left":["esriServerPointLabelPlacementBelowLeft"],"below-right":["esriServerPointLabelPlacementBelowRight"],"center-center":["esriServerPointLabelPlacementCenterCenter"],"center-left":["esriServerPointLabelPlacementCenterLeft"],"center-right":["esriServerPointLabelPlacementCenterRight"]};for(const t in qve){const e=qve[t],i=Sm[t];e.forEach(r=>{Sm[r]=i})}Object.freeze&&(Object.freeze(Sm),Object.keys(Sm).forEach(t=>{var e;Object.freeze(Sm[t]),Object.freeze((e=Sm[t])==null?void 0:e.normalizedOffset)}));const $5t=[0,0],H$=va();let Wve=class{constructor(e){this._stage=e,this._materials=new Map}get(e){return this._materials.get(e)}add(e,i){this._materials.set(e,i),this._stage.add(i)}dispose(){this._stage.removeMany(Array.from(this._materials.values())),this._materials.clear()}},Yve=class{constructor(e,i){this.labelingContext=e,this.graphics3DGraphic=i,this.hasGraphics3DResources=!1,this.visible=!1,this.addedToTextureAtlas=!1,this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}},L5t=class{constructor(e,i,r,n,s){this.labelClass=e,this.graphics3DSymbol=i,this.graphics3DCalloutSymbolLayer=r,this.textRenderParameters=n,this.labelFunction=s,this.calloutSymbolLayerIndex=0}},D5t=class{constructor(e,i,r,n,s,o,a,c){this.layer=i,this.graphics3DCore=r,this.scaleVisibility=n,this.emptySymbolLabelSupported=s,this.elevationInfoOverride=o,this.disablePlacement=a,this.active=c,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new aNe(e,{pickable:!0,disableOctree:!0},i.uid)}destroy(){this.stageLayer.destroy()}},oS=class extends ze{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([_e(()=>{var e;return(e=this.view.state)==null?void 0:e.camera},()=>this.setDirty()),_e(()=>{var e;return(e=this.view.state)==null?void 0:e.rasterPixelRatio},()=>this._resetAllLabels()),this.view.resourceController.scheduler.registerTask(ni.LABELER,this)]),this._textTextureAtlas=new lT({view:this.view}),this._hudMaterialCollection=new Wve(this.view._stage),this._calloutMaterialCollection=new Wve(this.view._stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=Kt(this._textTextureAtlas),this._hudMaterialCollection=Kt(this._hudMaterialCollection),this._calloutMaterialCollection=Kt(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),w0.graphic=null,w0.renderingInfo=null,w0.layer=null}_activateLabelingContext(e){e.graphics.forEach((i,r)=>{const n=new Yve(e,i);this._labels.set(r,n),e.labelsToInitialize.set(r,n),i.setVisibilityFlag(Za.LABEL,Wl.USER,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((i,r)=>{i.setVisibilityFlag(Za.LABEL,Wl.USER,!1),this.setLabelGraphicVisibility(i,!1),this._labels.delete(r)}),e.active=!1}_addLabelTextureToAtlas(e){for(const i of e.graphics3DGraphic.labelLayers){if(!i._labelClass)continue;const r=e.textRenderers[i._labelIndex];r&&(this._textTextureAtlas.addTextTexture(r,i.stageObject),e.addedToTextureAtlas=!0)}}_removeLabelTextureFromAtlas(e){for(const i of e.graphics3DGraphic.labelLayers){if(!i._labelClass)continue;const r=e.textRenderers[i._labelIndex];r!=null&&(this._textTextureAtlas.removeTextTexture(r,i.stageObject),e.addedToTextureAtlas=!1)}}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),Jl.YIELD}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const i of this._labelingContexts)if(i.active)if(_Y(i))this._dirty=!0;else if(bY(i.labelClassContexts)){if(i.labelClassContexts===null){this._deactivateLabelingContext(i);continue}this._createLabelClassContext(i),this._dirty=!0}else ap(i.labelsToInitialize,(r,n)=>(this._ensureGraphics3DResources(r)&&(this._labels.set(n,r),this.deconflictor.setDirty(),e.madeProgress()),(r.visible&&r.textInitialized||!r.visible&&r.hasGraphics3DResources)&&(i.labelsToInitialize.delete(n),e.madeProgress()),e.done))&&(this._dirty=!0);this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){var o,a;const i=(o=e.labelClassAbortController)==null?void 0:o.signal;e.layer.when&&await e.layer.when(),St(i),e.scaleVisibility&&e.scaleVisibility.updateScaleRangeActive();const r=e.graphics3DCore,n=r.layer,s=(a=n.labelingInfo)==null?void 0:a.filter(c=>!!c.symbol);!s||s.length===0||(await HB(s,async(c,p)=>{const _=c.symbol,x=Oce(r.getOrCreateGraphics3DSymbol(_));if(x==null)return void Ce.getLogger(this).error("Failed to create Graphics3DSymbol for label");await x.load(),St(i);let S=null;Xse(_)&&_.hasVisibleCallout()&&(S=v3t(_,r.symbolCreationContext),await S.load(),St(i));const C=await ih(b6e(c,e.layer.fieldsIndex,this.view.spatialReference));if(St(i),C.ok===!0){const M=await this._createTextRenderParameters(x.symbol);St(i),e.labelClassContexts[p]=new L5t(c,x,S,M,C.value)}else Ce.getLogger(this).error(`Label expression failed to evaluate: ${C.error}`)}),St(i))}async _createLabelClassContext(e){return e.labelClassPromise==null&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(i=>{if(on(i))throw i;e.labelClassContexts.length=0}).then(()=>{e.labelClassAbortController=null,this.notifyChange("updating")}).catch(()=>{}),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const i=e.symbolLayers.at(0);return(i==null?void 0:i.type)!=="text"?null:I7e.fromSymbol(i,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const r of e.labelClassContexts)--r.graphics3DSymbol.referenced;const i=e.labelClassAbortController;e.labelClassAbortController=new AbortController,vn(i),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,i,r,n,s,o){const a=new P7e(r,X1e(r.anchor),MCt(r.anchor),e.text,Ji(e.displayWidth,e.displayHeight));return w0.graphic=i,w0.renderingInfo=null,w0.layer=n,s.createLabel(w0,a,this._hudMaterialCollection,this._textTextureAtlas,()=>{const c=jve(o);return c?c.elevationOffset:null})}_createLineCalloutGraphic(e,i,r,n,s){w0.graphic=e,w0.layer=s;const o=n.screenOffset[0];return w0.renderingInfo=new g3t(null,i,n.translation,n.centerOffset,o,n.centerOffsetUnits,n.elevationOffset,this._calloutMaterialCollection),r.createGraphics3DGraphic(w0)}_ensureGraphics3DResources(e){var p;if(e.hasGraphics3DResources)return!1;const i=e.graphics3DGraphic;if(i.destroyed)return!1;this._ensureTextTextureResources(e);const r=e.labelingContext,n=r.labelClassContexts;if(bY(n)||!r.emptySymbolLabelSupported&&i.layers.length===0)return!1;let s=!1;const o=i.graphic,a=r.layer,c=c8(r.layer);for(let _=0;_n.set(o.graphic.uid,o));const s=o=>o.labelLayers[0];if(r.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,n,s),r.graphics3DCalloutSymbolLayer){const o=a=>a.labelLayers[r.calloutSymbolLayerIndex];r.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,n,o)}}}_visibilityInfoChange(e){const i=c8(e.layer);i&&!e.active&&this._activateLabelingContext(e),!i&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((i,r)=>{const n=this._labels.get(r);n&&(this._destroyGraphic(n,r),n.visible=!1,e.labelsToInitialize.set(r,n))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const i of this._labelingContexts)if(i.graphics3DCore===e)return i;return null}addGraphicsOwner(e,i,r){const n=r&&r.emptySymbolLabelSupported||!1,s=(r==null?void 0:r.elevationInfoOverride)||null,o=(r==null?void 0:r.disablePlacement)||null;if(this._findLabelingContext(e))return;const a=e.layer,c=new D5t(this.view._stage,a,e,i,n,s,o,c8(a));return this._labelingContexts.push(c),this.setDirty(),{addGraphic:p=>this._addGraphic(c,p),removeGraphic:p=>this._removeGraphic(c,p),featureReductionChange:()=>{},layerLabelsEnabled:()=>c8(c.layer),labelingInfoChange:p=>this._labelingInfoChange(c,p),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",c),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",c),visibilityInfoChange:()=>this._visibilityInfoChange(c),reset:()=>this._resetLabels(c),clear:()=>{}}}removeGraphicsOwner(e){const i=this._findLabelingContext(e);if(!i)return;const r=this._labelingContexts.indexOf(i);this._labelingContexts.splice(r,1),i.graphics.forEach(n=>this._removeGraphic(i,n)),i.destroy(),this.setDirty()}setLabelGraphicVisibility(e,i){const r=e.graphic.uid,n=this._labels.get(r);n&&n.visible!==i&&(i&&!n.addedToTextureAtlas?(this._addLabelTextureToAtlas(n),n.textInitialized||n.labelingContext.labelsToInitialize.set(r,n)):!i&&n.addedToTextureAtlas&&this._removeLabelTextureFromAtlas(n),n.visible=i,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){var e;return this._dirty||((e=this._textTextureAtlas)==null?void 0:e.updating)||this.deconflictor.updating||this._labelingContexts.some(i=>_Y(i))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce((i,r)=>i+(_Y(r)?0:1),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){return{textTextureAtlas:this._textTextureAtlas,resetAllLabels:()=>this._resetAllLabels()}}};function _Y(t){return!!t.labelClassPromise&&!!t.labelClassAbortController}function bY(t){return!t||t.length===0}function c8(t){var e;return t.labelsVisible===!0&&!!((e=t.labelingInfo)!=null&&e.some(i=>!!i.symbol))}y([w({constructOnly:!0})],oS.prototype,"view",void 0),y([w({constructOnly:!0})],oS.prototype,"deconflictor",void 0),y([w()],oS.prototype,"_textTextureAtlas",void 0),y([w({type:Boolean,readOnly:!0})],oS.prototype,"updating",null),oS=y([Z("esri.views.3d.layers.graphics.Labeler")],oS);const w0=new y3t(null,null,null);let A4=class QA{constructor(e,i,r,n=null){this.lij=[0,0,0],this.extent=Ni(),this.resolution=0,this.loadPriority=0,this.measures={visibility:yc.VISIBLE_ON_SURFACE,screenRect:Ni(),distance:0,shouldSplit:!1},this.used=!1,n&&this.acquire(e,i,r,n)}acquire(e,i,r,n){this.tilingScheme=n,this.id=QA.id(e,i,r),this.lij[0]=e,this.lij[1]=i,this.lij[2]=r,n.getExtent(e,i,r,this.extent),this.resolution=n.resolutionAtLevel(e)}release(){this.tilingScheme=null}getChildren(e){const i=this.lij[0]+1,r=2*this.lij[1],n=2*this.lij[2];return e?(e[0].acquire(i,r,n,this.tilingScheme),e[1].acquire(i,r+1,n,this.tilingScheme),e[2].acquire(i,r,n+1,this.tilingScheme),e[3].acquire(i,r+1,n+1,this.tilingScheme),e):[new QA(i,r,n,this.tilingScheme),new QA(i,r+1,n,this.tilingScheme),new QA(i,r,n+1,this.tilingScheme),new QA(i,r+1,n+1,this.tilingScheme)]}copyMeasurementsFrom(e){this.measures.visibility=e.measures.visibility,this.measures.shouldSplit=e.measures.shouldSplit,this.measures.distance=e.measures.distance,__(e.measures.screenRect,this.measures.screenRect)}static id(e,i,r){return`${e}/${i}/${r}`}};var yc;(function(t){t[t.INVISIBLE=0]="INVISIBLE",t[t.VISIBLE_WHEN_EXTENDED=1]="VISIBLE_WHEN_EXTENDED",t[t.VISIBLE_ON_SURFACE=2]="VISIBLE_ON_SURFACE"})(yc||(yc={}));const L7e=.5*Math.PI,N5t=L7e/Math.PI*180;let F5t=class{constructor(e){this._renderCoordsHelper=e.renderCoordsHelper,this._extent=new Array(4),this._planes=new Array(6),this._maxSpan=0,this._center={origin:W(),direction:W()};for(let i=0;i<4;i++)this._extent[i]={origin:W(),direction:W(),cap:{next:null,direction:W()}},this._planes[i]=Fi();this._planes[In.NEAR]=Fi(),this._planes[In.FAR]=Fi(),this._planesWithoutFar=this._planes.slice(0,5)}update(e,i,r,n=!0){const s=this._extent;this._toRenderBoundingExtent(e,i,r),Be(this._center.origin,s[0].origin,s[2].origin),De(this._center.origin,this._center.origin,.5),this._renderCoordsHelper.worldUpAtPosition(this._center.origin,this._center.direction),n||De(this._center.direction,this._center.direction,-1);for(let o=0;o<4;o++){const a=s[o];this._renderCoordsHelper.worldUpAtPosition(a.origin,a.direction);const c=s[o===3?0:o+1];a.cap.next=c.origin,k_(a.cap.direction,a.origin,c.origin),PL(a.direction,a.cap.direction,a.origin,this._planes[o]),n||De(a.direction,a.direction,-1)}PL(s[0].cap.direction,s[1].cap.direction,s[0].origin,this._planes[In.NEAR]),n?AQ(this._planes[In.NEAR],this._planes[In.FAR]):(gj(this._planes[In.FAR],this._planes[In.NEAR]),AQ(this._planes[In.NEAR],this._planes[In.NEAR])),this._maxSpan=Math.max(Math.abs(e[0]-e[2]),Math.abs(e[1]-e[3])),this._maxSpanSpatialReference=i,this._minGlobalAltitude=.9*Tr(this._maxSpanSpatialReference).radius}isVisibleInFrustum(e,i,r=!1){if(e==null)return!1;if(this._renderCoordsHelper.viewingMode===_t.Global){const s=this._maxSpanSpatialReference.isGeographic?N5t:L7e*i;if(this._maxSpan>s)return!0;if(e.altitude!=null&&e.altitude>=this._minGlobalAltitude)return this._isVisibleInFrustumGlobal(e)}if(this._maxSpan===0){const s=this._extent[0];return!(r||!e.intersectsRay(Ap(s.origin,s.direction)))}for(let s=0;si,this._frustum.update(e),this._shortenFrustumFarPlane(this._frustum),this._updateExtendedFrustum(e)}end(){this._cache.clear()}calculate(e){if(this._allTilesInvisible)return yc.INVISIBLE;const i=this._renderCoordsHelper.viewingMode===_t.Global&&e.lij[0]>=V5t&&e.lij[0](Math.PI+e.fovY)/2,this._allTilesInvisible||(this._hasExtendedFrustum=r>e.fovY/2,!this._hasExtendedFrustum))return;const n=this._extendedFrustumParameters(),s=this._extendedFrustum.mutablePoints;for(let o=0;o<4;o++){const a=n.pointIndices[o],c=s[a],p=this._renderCoordsHelper.getAltitude(c);if(n.needsAltitudeAdjustment(p)){switch(this._renderCoordsHelper.worldUpAtPosition(c,Md),a){case Gt.FAR_BOTTOM_LEFT:case Gt.FAR_TOP_LEFT:case Gt.NEAR_BOTTOM_LEFT:case Gt.NEAR_TOP_LEFT:MQ(this._extendedFrustum.planes[In.LEFT],Md,Md);break;case Gt.FAR_BOTTOM_RIGHT:case Gt.FAR_TOP_RIGHT:case Gt.NEAR_BOTTOM_RIGHT:case Gt.NEAR_TOP_RIGHT:MQ(this._extendedFrustum.planes[In.RIGHT],Md,Md)}De(Md,Md,n.direction),this._renderCoordsHelper.intersectInfiniteManifold(Ap(c,Md),n.zWithMargin,c)}}if(this._extendedFrustum.updatePoints(s),Hl(s[Gt.NEAR_BOTTOM_LEFT],s[Gt.NEAR_BOTTOM_RIGHT],s[Gt.NEAR_TOP_RIGHT],Jve),Hl(s[Gt.NEAR_BOTTOM_RIGHT],s[Gt.NEAR_TOP_RIGHT],s[Gt.NEAR_TOP_LEFT],Kve),Ve(Jve,Kve)<0){const o=this._extendedFrustum.mutablePoints;this._aboveGround?[o[Gt.NEAR_BOTTOM_LEFT],o[Gt.NEAR_BOTTOM_RIGHT]]=[o[Gt.NEAR_BOTTOM_RIGHT],o[Gt.NEAR_BOTTOM_LEFT]]:[o[Gt.NEAR_TOP_LEFT],o[Gt.NEAR_TOP_RIGHT]]=[o[Gt.NEAR_TOP_RIGHT],o[Gt.NEAR_TOP_LEFT]],this._extendedFrustum.updatePoints(o)}}_extendedFrustumParameters(){return this._aboveGround?this._extendedFrustumParametersAboveSurface():this._extendedFrustumParametersBelowSurface()}_extendedFrustumParametersAboveSurface(){const e=this._surfaceElevation-Zve;return{zWithMargin:e,pointIndices:Kw.planePointIndices.bottom,direction:-1,needsAltitudeAdjustment:i=>i>e}}_extendedFrustumParametersBelowSurface(){const e=this._surfaceElevation+Zve;return{zWithMargin:e,pointIndices:Kw.planePointIndices.top,direction:1,needsAltitudeAdjustment:i=>i{t.length!==4&&(t[0]=new A4,t[1]=new A4,t[2]=new A4,t[3]=new A4)},t=>{t[0].release(),t[1].release(),t[2].release(),t[3].release()});let H5t=class{constructor(e){this._camera=new si,this._focusOnMap=[0,0],this._screenRect=Ni(),this._tileSize=e.tileSize,this._renderCoordsHelper=e.renderCoordsHelper,this._tilingScheme=e.tilingScheme,this._visibility=new U5t(e.renderCoordsHelper)}begin(e,i,r){this._camera.copyFrom(e),this._surfaceElevation=r,this._focusOnMap[0]=i.x,this._focusOnMap[1]=i.y,tse(0,0,e.fullWidth,e.fullHeight,this._screenRect),this._visibility.begin(this._camera,r)}end(){this._visibility.end()}updateTile(e){e.measures.visibility=this._visibility.calculate(e),e.measures.distance=yXe(e.extent,this._focusOnMap),e.measures.visibility!==yc.INVISIBLE&&this._updateScreenMeasure(e)}_updateScreenMeasure(e){const i=q5t,r=1<_)return void(e.measures.shouldSplit=!0);e.measures.shouldSplit=!1}_tileSizeWithBias(e){return e.measures.visibility===yc.VISIBLE_WHEN_EXTENDED?this._tileSize*W5t:this._tileSize}_computeScreenArea(e,i,r,n,s){const o=e.measures.visibility===yc.VISIBLE_WHEN_EXTENDED;this._projectToScreen(i,r,n,o,$b),ld(xY);for(let a=0;a<4;a++)lO(xY,$b[a]);return x2(s,xY,s),Jme($b[0],$b[1],$b[2])+Jme($b[0],$b[2],$b[3])}_projectToScreen(e,i,r,n,s){this._tilingScheme.ensureMaxLod(e),this._tilingScheme.getExtent(e,i,r,FR),this._toRenderCoords(FR,0,3,Lb[0]),this._toRenderCoords(FR,2,3,Lb[1]),this._toRenderCoords(FR,2,1,Lb[2]),this._toRenderCoords(FR,0,1,Lb[3]),n&&(this._projectToPlane(Lb,this._camera.frustum[In.NEAR]),this._projectToPlane(Lb,this._camera.frustum[In.TOP]),this._projectToPlane(Lb,this._camera.frustum[In.BOTTOM]));for(let o=0;o<4;o++)this._camera.projectToRenderScreen(Lb[o],e_e),this._camera.renderToScreen(e_e,s[o])}_projectToPlane(e,i){for(let n=0;n<4;n++)zR[n]=gn(i,e[n]);const r=Math.max(zR[0],zR[1],zR[2],zR[3]);if(r>0){const n=De(kR,i,-r);for(let s=0;s<4;s++)Be(e[s],e[s],n)}}_toRenderCoords(e,i,r,n){return kR[0]=e[i],kR[1]=e[r],kR[2]=this._surfaceElevation,this._renderCoordsHelper.toRenderCoords(kR,this._tilingScheme.spatialReference,n),n}};const xY=Ni(),q5t=2,W5t=5,$b=[ss(),ss(),ss(),ss()],FR=Ni(),kR=W(),Lb=[W(),W(),W(),W()],zR=[0,0,0,0],e_e=Ka();function odi(t,e,i){if(t==null||i==null)return!1;let r=!0;return aa[0]=t.xmin!=null?t.xmin:0,aa[1]=t.ymin!=null?t.ymin:0,aa[2]=t.zmin!=null?t.zmin:0,r=r&&un(aa,t.spatialReference,0,e,i,0,1),aa[0]=t.xmax!=null?t.xmax:0,aa[1]=t.ymax!=null?t.ymax:0,aa[2]=t.zmax!=null?t.zmax:0,r=r&&un(aa,t.spatialReference,0,e,i,3,1),t.xmin==null&&(e[0]=-1/0),t.ymin==null&&(e[1]=-1/0),t.zmin==null&&(e[2]=-1/0),t.xmax==null&&(e[3]=1/0),t.ymax==null&&(e[4]=1/0),t.zmax==null&&(e[5]=1/0),r}function D7e(t,e,i){if(t==null||i==null)return!1;let r=!0;return aa[0]=t.xmin!=null?t.xmin:0,aa[1]=t.ymin!=null?t.ymin:0,aa[2]=t.zmin!=null?t.zmin:0,r=r&&un(aa,t.spatialReference,0,aa,i,0,1),e[0]=aa[0],e[1]=aa[1],aa[0]=t.xmax!=null?t.xmax:0,aa[1]=t.ymax!=null?t.ymax:0,aa[2]=t.zmax!=null?t.zmax:0,r=r&&un(aa,t.spatialReference,0,aa,i,0,1),e[2]=aa[0],e[3]=aa[1],t.xmin==null&&(e[0]=-1/0),t.ymin==null&&(e[1]=-1/0),t.xmax==null&&(e[2]=1/0),t.ymax==null&&(e[3]=1/0),r}const aa=W();let wl=class extends ze{get tilingScheme(){const e=this.tilingSchemeOwner.tilingScheme;return e?e.clone():null}set filterExtent(e){if(e!=null&&!e.spatialReference.equals(this.viewState.spatialReference))return void Ce.getLogger(this).error("#extent","extent spatial reference needs to be in the same spatial reference as the view");const i=this._get("filterExtent");if(i===e||i!=null&&e&&i.equals(e))return;const r=e!=null?e.clone():null;this._set("filterExtent",r),this._setDirty()}get _filterExtentRect(){if(this.filterExtent==null)return null;const e=Ni();return D7e(this.filterExtent,e,this.tilingScheme.spatialReference),e}get _rootTileIds(){const{tilingScheme:e}=this;return this._filterExtentRect&&e?e.rootTilesInExtent(this._filterExtentRect):[[0,0,0]]}set suspended(e){e!==this._get("suspended")&&(this._set("suspended",e),this._setDirty())}get updating(){return this._dirty||!!this._pendingTiles}constructor(e){super(e),this.tiles=new tt,this.tileSize=512,this._idToTile=new Map,this._clients=new Set,this._dirty=!1,this._pendingTiles=null,this._newTiles=new Pi}initialize(){this.addHandles([_e(()=>[this.tilingScheme,this.tileSize],()=>this._reset(),Li),_e(()=>{var e,i,r;return[this.tileSize,(e=this.cameraOnSurface)==null?void 0:e.location,this.tilingScheme,(i=this.viewState)==null?void 0:i.contentCamera,(r=this.focus)==null?void 0:r.location]},()=>this._setDirty(),kt)]),this.scheduler&&(this._frameWorker=this.scheduler.registerTask(ni.FEATURE_TILE_TREE,this))}destroy(){this._frameWorker=en(this._frameWorker)}addClient(){const e=mp();return this._clients.add(e),this._clients.size===1&&this._setDirty(),rr(()=>this._removeClient(e))}_removeClient(e){this._clients.delete(e),this._hasClients||this._clear()}get _hasClients(){return this._clients.size>0}_setDirty(){!this._hasClients||this.suspended||this._dirty||(this._frameWorker?(this._dirty=!0,this.notifyChange("updating")):this.runTask(cu))}_clear(){this.tiles.removeAll(),this._idToTile.clear(),this._reset(),this._dirty=!1,this.notifyChange("updating")}get running(){return this.updating}runTask(e){this._dirty=!1,this._pendingTiles||(this._startUpdate(),this._frameWorker!=null&&(this._frameWorker.priority=ni.FEATURE_TILE_TREE_ACTIVE)),this._subdivideTilesForView(e),this._pendingTiles||this._frameWorker==null||(this._frameWorker.priority=ni.FEATURE_TILE_TREE),this.notifyChange("updating")}_startUpdate(){if(this.suspended)return;if(!this.tilingScheme)return void this._clear();this._tileMeasurements||(this._tileMeasurements=new H5t({renderCoordsHelper:this.renderCoordsHelper,tilingScheme:this.tilingScheme,tileSize:this.tileSize}));const e=this.viewState.contentCamera;this._tileMeasurements.begin(e,this.focus.location,this.cameraOnSurface.location.z??0),this._pendingTiles=this._getRootTiles()}_reset(){this._newTiles.clear(),this._tileMeasurements=null,this._pendingTiles=null,this._setDirty()}_getRootTiles(){const{tilingScheme:e}=this;return this._rootTileIds.map(i=>new A4(i[0],i[1],i[2],e))}_purgeHorizonTiles(e){e.sort((i,r)=>{const n=i.measures.screenRect,s=r.measures.screenRect;return n[1]+n[3]-(s[1]+s[3])}),ld(u8);for(let i=0;iY5t)return e.data.slice(i,e.length);return[]}_subdivideTilesForView(e){if(!this._pendingTiles)return;const{tilingScheme:i}=this;for(;this._pendingTiles.length>0&&!e.done;){const r=this._pendingTiles.pop();e.madeProgress(),this._filterExtentRect&&!I9(this._filterExtentRect,r.extent)||(this._tileMeasurements.updateTile(r),r.measures.visibility!==yc.INVISIBLE&&(r.measures.shouldSplit?(i.ensureMaxLod(r.lij[0]+1),this._pendingTiles.push(...r.getChildren())):this._newTiles.push(r)))}this._pendingTiles.length===0&&(this._updateTiles(this._purgeHorizonTiles(this._newTiles)),this._newTiles.clear(),this._tileMeasurements.end(),this._pendingTiles=null)}_updateTiles(e){for(const n of this.tiles.items)n.used=!1;const i=e.filter(n=>{const s=this._idToTile.get(n.id);return s?(s.copyMeasurementsFrom(n),s.used=!0):this._idToTile.set(n.id,n),!s}),r=this.tiles.items.filter(n=>!n.used&&(this._idToTile.delete(n.id),!0));this.tiles.removeMany(r),this.tiles.addMany(i),this._sortTiles()}_sortTiles(){this.viewState.fixedContentCamera||this.tiles.sort((e,i)=>e.measures.visibility!==i.measures.visibility?e.measures.visibility===yc.VISIBLE_ON_SURFACE?-1:1:e.measures.distance-i.measures.distance),this.tiles.forEach((e,i)=>e.loadPriority=i)}};y([w({constructOnly:!0})],wl.prototype,"scheduler",void 0),y([w({constructOnly:!0})],wl.prototype,"renderCoordsHelper",void 0),y([w({constructOnly:!0})],wl.prototype,"tilingSchemeOwner",void 0),y([w({constructOnly:!0})],wl.prototype,"cameraOnSurface",void 0),y([w({constructOnly:!0})],wl.prototype,"focus",void 0),y([w({constructOnly:!0})],wl.prototype,"viewState",void 0),y([w({constructOnly:!0})],wl.prototype,"terrain",void 0),y([w()],wl.prototype,"tiles",void 0),y([w()],wl.prototype,"tileSize",void 0),y([w({readOnly:!0})],wl.prototype,"tilingScheme",null),y([w()],wl.prototype,"filterExtent",null),y([w({readOnly:!0})],wl.prototype,"_filterExtentRect",null),y([w({readOnly:!0})],wl.prototype,"_rootTileIds",null),y([w({value:!1})],wl.prototype,"suspended",null),y([w({readOnly:!0})],wl.prototype,"updating",null),wl=y([Z("esri.views.3d.layers.support.FeatureTileTree3D")],wl);const u8=Ni(),Y5t=10;let ks=class extends ze{constructor(){super(...arguments),this._propertiesPool=new O_({camera:si},this),this._lastSeenCameraProjectionValues=new si,this.mode=Vr.ANIMATING,this._cssCamera=new si,this._camera=new si,this.rasterPixelRatio=1,this.contentPixelRatio=1,this.events=new Dn,this.viewingMode=_t.Global,this._cameraChanged=!1,this._updateQueue=new Array,this._processingUpdates=!1}init(e,i){this._set("viewingMode",e),this._set("spatialReference",i),this._set("constraints",new lv({mode:this.viewingMode}))}exit(){this.cameraController=null,this._propertiesPool.destroy(),this._propertiesPool=new O_({camera:si},this)}destroy(){var e;this.cameraController=null,(e=this._propertiesPool)==null||e.destroy(),this._propertiesPool=null}createInitialCamera(){if(this.viewingMode===_t.Global){const e=Tr(this.spatialReference).radius;this.camera=new si({eye:st(4*e,0,0),center:st(e,0,0),up:st(0,0,1)})}else this.camera=new si({eye:st(0,0,100),center:st(0,0,0),up:st(0,1,0)})}get animation(){return this.cameraController instanceof BL&&this.cameraController.viewAnimation!=null?this.cameraController.viewAnimation:null}get camera(){return this._camera}get cssCamera(){const e=this._cssCamera.copyFrom(this.camera),{height:i,width:r,pixelRatio:n}=this.camera;return e.pixelRatio=1,e.height=Math.round(i/n),e.width=Math.round(r/n),e}set camera(e){e!==jp&&jp.copyFrom(e),jp.computeUp(this.viewingMode),this.events.emit("before-camera-change",jp);const i=this._camera;if(this._cameraProjectionChanged(this._lastSeenCameraProjectionValues,jp)&&(this._lastSeenCameraProjectionValues.copyFrom(jp),this.events.emit("camera-projection-changed",this._lastSeenCameraProjectionValues)),!i.equals(jp)&&(this._camera=this._propertiesPool.get("camera").copyFrom(jp),this._cameraChanged=!i.almostEquals(jp),this._cameraChanged)){const r=rTe(()=>{this._cameraChanged=!1,r.remove()})}}get pixelRatio(){return this.camera.pixelRatio}get alignPixelEnabled(){return this.pixelRatio===this.rasterPixelRatio&&this.mode===Vr.IDLE}get updating(){return this.mode!==Vr.IDLE}get contentCamera(){return this._contentCamera??this.camera}set contentCamera(e){this._contentCamera=e!=null?e.clone():null}get fixedContentCamera(){return this._contentCamera!=null}get isGlobal(){return this.viewingMode===_t.Global}get isLocal(){return this.viewingMode===_t.Local}get navigating(){return!(!this.cameraController||!this.cameraController.isInteractive)}get stationary(){return!this._cameraChanged&&!this.navigating}get cameraController(){return this._get("cameraController")}set cameraController(e){var i;this.stopActiveCameraController()?((i=this.cameraController)==null||i.destroy(),e&&(this.removeHandles(t_e),this.addHandles(Oo(()=>e.state===As.Finished||e.state===As.Stopped,()=>{this._set("cameraController",null),this.updateCamera(r=>e.onControllerEnd(r))},{sync:!0,once:!0}),t_e),e.onControllerStart(this.camera)),this._set("cameraController",e)):e&&(e.state=As.Rejected)}switchCameraController(e){return this.cameraController=e,e.state!==As.Rejected}stopActiveCameraController(){return!(this.cameraController&&!this.cameraController.stopController())}updateCamera(e){this._updateQueue.push(e),this._processUpdateQueue()}_processUpdateQueue(){if(this._updateQueue.length===0||this._processingUpdates)return;this._processingUpdates=!0;const e=this._updateQueue.shift();jp.copyFrom(this._get("camera")),e(jp),this.camera=jp,this._processingUpdates=!1,this._processUpdateQueue()}_cameraProjectionChanged(e,i){return e.fov!==i.fov||e.fullViewport[0]!==i.fullViewport[0]||e.fullViewport[1]!==i.fullViewport[1]||e.fullViewport[2]!==i.fullViewport[2]||e.fullViewport[3]!==i.fullViewport[3]||e.padding[er.TOP]!==i.padding[er.TOP]||e.padding[er.RIGHT]!==i.padding[er.RIGHT]||e.padding[er.BOTTOM]!==i.padding[er.BOTTOM]||e.padding[er.LEFT]!==i.padding[er.LEFT]}};y([w()],ks.prototype,"mode",void 0),y([w({readOnly:!0,type:OP})],ks.prototype,"animation",null),y([w({type:si})],ks.prototype,"camera",null),y([w({type:si})],ks.prototype,"cssCamera",null),y([w()],ks.prototype,"_cssCamera",void 0),y([w()],ks.prototype,"_camera",void 0),y([w({readOnly:!0})],ks.prototype,"pixelRatio",null),y([w()],ks.prototype,"rasterPixelRatio",void 0),y([w()],ks.prototype,"contentPixelRatio",void 0),y([w({readOnly:!0})],ks.prototype,"alignPixelEnabled",null),y([w({readOnly:!0})],ks.prototype,"updating",null),y([w({})],ks.prototype,"_contentCamera",void 0),y([w({type:si})],ks.prototype,"contentCamera",null),y([w({readOnly:!0})],ks.prototype,"fixedContentCamera",null),y([w({readOnly:!0})],ks.prototype,"constraints",void 0),y([w({readOnly:!0})],ks.prototype,"events",void 0),y([w({readOnly:!0})],ks.prototype,"isGlobal",null),y([w({readOnly:!0})],ks.prototype,"isLocal",null),y([w({readOnly:!0})],ks.prototype,"viewingMode",void 0),y([w({readOnly:!0})],ks.prototype,"spatialReference",void 0),y([w()],ks.prototype,"navigating",null),y([w()],ks.prototype,"stationary",null),y([w()],ks.prototype,"_cameraChanged",void 0),y([w()],ks.prototype,"cameraController",null),ks=y([Z("esri.views.3d.state.ViewState")],ks);const X5t=ks,jp=new si,t_e="ViewStateHandles";let Z5t=class{constructor(e,i,r){this.viewingMode=e,this._forEachLayer=i,this._view=r,this._externalIntersectionHandlers=new Pi,this._tolerance=AP,this._tmpRay=Qo(),this._tmpRegion=Ni(),this._validateHUDIntersector=Mp(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,i,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),i_e(this.viewingMode),i,r)}intersectScreenFreePointFallback(e,i,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),i,r)}intersectRayFreePointFallback(e,i,r){return this.intersectRay(e,i_e(this.viewingMode),i,r)||this._intersectRayFreePointLocal(e,i)}intersectRay(e,i,r,n){return i.options.selectionMode=!1,i.options.store=rl.MIN,this.computeIntersection(e,i,n),!!i.results.min&&i.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,i,r=.5,n=.5){return e.getRenderCenter(p8,r,n),p8[0]+=.0466,p8[1]-=.0123,fle(e,p8,i)}intersectIntersectorScreen(e,i,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),i,r)}intersectToolIntersectorScreen(e,i,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,i,r)}intersectToolIntersectorRay(e,i,r){i.options.selectionMode=!0,this.computeIntersection(e,i,r);const n=i.results.min;this._view.basemapTerrain&&this._view.basemapTerrain.opaque||Xm(n)&&n.intersector!==ms.TERRAIN||(i.options.selectionMode=!1,this.computeIntersection(e,i,r))}setTolerance(e=AP){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((i,r)=>i.type===ms.TERRAIN?1:r.type===ms.TERRAIN?-1:0)}removeIntersectionHandler(e){this._externalIntersectionHandlers.removeUnordered(e)!=null&&this._externalIntersectionHandlers.sort((i,r)=>i.type===ms.TERRAIN?1:r.type===ms.TERRAIN?-1:0)}_getPickRay(e,i){const r=this._view.state.camera;return ple(r,e,i)}_intersectRayFreePointLocal(e,i){return this.viewingMode!==_t.Local||e==null||Be(i,e.origin,Ye(xt.get(),e.direction)),!1}intersectElevationFromScreen(e,i,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),i,r,n)}_intersectElevation(e,i,r=0,n=null){if(e==null)return null;const s=i!=null?i.mode:"absolute-height",o=(i==null?void 0:i.offset)??0,a=s!=="on-the-ground"?o+r:0,c=a/this._view.renderCoordsHelper.unitInMeters;if(s==="absolute-height"){if(this._view.renderCoordsHelper.intersectInfiniteManifold(e,a,d8)){const z=this._view.computeMapPointFromVec3d(d8);return z.z??(z.z=0),z.z-=o,z}return null}const p=this._view.state.camera,_=xt.get();p.projectToRenderScreen(e.origin,_);const x=new r_e(null,this._forEachLayer),S=this._view.slicePlane,C=S!=null?V0e(S):null,M=Mp(this.viewingMode);M.options.store=rl.MIN,M.options.verticalOffset=c;const P=e.origin,$=Be(xt.get(),P,e.direction);M.reset(P,$,p),M.point=_;const F=n?"type"in n&&n.type==="graphics"?z=>z.layerUid!==n.uid:z=>z.graphicUid!==n.uid:null;switch(s){case"relative-to-scene":{const z=k=>(!F||F(k))&&!!k.lastValidElevationBB;M.intersect(x.layers,_,this._tolerance,null,z),this._externalIntersectionHandlers.forAll(k=>{if(k.type===ms.I3S||k.type===ms.TERRAIN){const U=k.slicePlaneEnabled?C:null;k.intersect(M,U,M.rayBegin,M.rayEnd,_)}});break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll(z=>{if(z.isGround){const k=z.slicePlaneEnabled?C:null;z.intersect(M,k,M.rayBegin,M.rayEnd,_)}})}if(M.results.min.getIntersectionPoint(d8)){const z=this._view.computeMapPointFromVec3d(d8);return z.z=r,z}return null}computeIntersection(e,i,r){var M;if(e==null)return;const n=this._view.state.camera,s=xt.get();n.projectToRenderScreen(e.origin,s);const o=new r_e(r,this._forEachLayer);i.options.selectOpaqueTerrainOnly=!r||!("include"in r||"exclude"in r);const a=e.origin,c=Be(xt.get(),e.origin,e.direction);i.reset(a,c,n),i.intersect(o.layers,s,this._tolerance);const p=this._view.slicePlane,_=p!=null?V0e(p):null;i.intersect(o.sliceableLayers,s,this._tolerance,_);const x=r&&(r.requiresGroundFeedback||r.enableDraped);this._externalIntersectionHandlers.forAll(P=>{const $=P.layerUid,F=Array.isArray($),z=F?$:[$];F&&(i.options.filteredLayerUids=[]);let k=!1;for(const U of z)o.filterLayerUid(U)?k=!0:F&&i.options.filteredLayerUids.push(U);if(i.options.isFiltered=!k,P.isGround&&x||!i.options.isFiltered){const U=P.slicePlaneEnabled?_:null;P.intersect(i,U,a,c,s)}});const S=xt.get(),C=this._view.basemapTerrain;if(r&&r.enableDraped&&C.spatialReference!=null&&i.results.ground.getIntersectionPoint(S)){const P=C.overlayManager.renderer,$=this._view.renderCoordsHelper.spatialReference,F=xt.get();this._view.renderCoordsHelper.fromRenderCoords(S,F,C.spatialReference),F[2]=((M=this._view.elevationProvider)==null?void 0:M.getElevation(S[0],S[1],S[2],$,"ground"))??0,P.intersect(i,F,i.results.ground,z=>o.filterRenderGeometry(z))}i.sortResults(),this._processHUDResults(i)}_processHUDResults(e){const i=e.results.hud;__(this._tmpRegion,VZ);const r=this._view.state.camera,n=[],s=this._tmpRegion,o=F=>{const z=new K5t(F);r.projectToRenderScreen(F.target.center,z.screenPoint),z.screenPoint[0]=Math.floor(z.screenPoint[0]),z.screenPoint[1]=Math.floor(z.screenPoint[1]),n.push(z),lO(s,z.screenPoint)};e.sortResults(i.all),i.min.dist!=null&&o(i.min);for(const F of i.all)i.min.target.object!==F.target.object&&i.max.target.object!==F.target.object&&o(F);if(i.max.dist!=null&&i.max.target.object!==i.min.target.object&&o(i.max),!n.length)return;s[0]===s[2]&&(s[2]+=1),s[1]===s[3]&&(s[3]+=1);const a=r.fullWidth,c=r.fullHeight,p=Math.max(0,s[0]-M4),_=Math.max(0,s[1]-M4),x=Math.min(xc(s)+2*M4,a-p),S=Math.min(Yu(s)+2*M4,c-_),C=new Uint8Array(x*S*4);this._view._stage.renderer.readHUDVisibility(p,_,x,S,C);let M=!0;const P=e.results.max.dist==null;let $=0;for(const F of n)for(const z of J5t)if(C[4*(Math.min(F.screenPoint[0]+z[0],a)-s[0]+(Math.min(F.screenPoint[1]+z[1],c)-s[1])*x)]){M&&(e.results.min.copy(F.result),M=!1),P&&e.results.max.copy(F.result),e.options.store===rl.ALL&&e.results.all.splice($++,0,F.result);break}}};const M4=1,J5t=(()=>{const t=[],e=M4;for(let i=-e;i<=e;i++)for(let r=-e;r<=e;r++)t.push([r+e,i+e]);return t})();let K5t=class{constructor(e){this.result=e,this.screenPoint=Ka()}},h8;function i_e(t){return h8&&h8.viewingMode===t||(h8=Mp(t)),h8}let r_e=class{constructor(e,i){this.layers=new Array,this.sliceableLayers=new Array,this.include=e==null?void 0:e.include,this.exclude=e==null?void 0:e.exclude,i(r=>{r.pickable&&this.filterLayerUid(r.apiLayerUid)&&(r.sliceable?this.sliceableLayers:this.layers).push(r)})}filterLayerUid(e){const{include:i,exclude:r}=this;return e==null?i==null&&r==null:(i==null||i.has(e))&&(r==null||!r.has(e))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}};function n_e(t){return typeof t=="object"&&"intersect"in t}const d8=W(),p8=Ka();let ddi=class{constructor(e,i){this.spatialReference=e,this._view=i}getElevation(e,i,r){return this._view.elevationProvider.getElevation(e,i,0,this.spatialReference,r)}async queryElevation(e,i,r,n,s){return this._view.elevationProvider.queryElevation(e,i,0,this.spatialReference,s,r,n)}},Q5t=class{constructor(e,i,r,n){this.spatialReference=i,this._getElevationQueryProvider=r,this._queries=new Array,this._queryOptions={...n,ignoreInvisibleLayers:!0},this._frameTask=e.registerTask(ni.ELEVATION_QUERY,this)}destroy({completeTasks:e}={completeTasks:!1}){if(this._frameTask.remove(),this.running)if(e)this.runTask(cu);else for(const i of this._queries)i.result.reject(ur())}queryElevation(e,i,r,n=0){const s=ec(),o={x:e,y:i,minDemResolution:n,result:s,signal:r};return this._queries.push(o),Zl(r,()=>{cne(this._queries,o),s.reject(ur())}),s.promise}get running(){return this._queries.length>0}runTask(e){const i=this._queries;this._queries=[];const r=this._getElevationQueryProvider();if(!r)return i.forEach(_=>_.result.reject()),void e.madeProgress();const n=i.map(_=>[_.x,_.y]),s=i.reduce((_,x)=>Math.min(_,x.minDemResolution),1/0),o=new Mm({points:n,spatialReference:this.spatialReference}),a=i.length>1&&i.some(_=>!!_.signal)?new AbortController:null,c=a!=null?a.signal:i[0].signal;if(a!=null){let _=0;i.forEach(x=>Zl(x.signal,()=>{_++,x.result.reject(ur()),_===i.length&&a.abort()}))}const p={...this._queryOptions,minDemResolution:s,signal:c};r.queryElevation(o,p).then(_=>{i.forEach((x,S)=>{x.signal!=null&&x.signal.aborted?x.result.reject(ur()):x.result.resolve(_.geometry.points[S][2])})}).catch(_=>{i.forEach(x=>x.result.reject(_))}),e.madeProgress()}get test(){const e=this;return{update:()=>e._queries.length>0&&e.runTask(cu)}}},O4=class extends Dn.EventedMixin(ze){get spatialReference(){var e,i;return(i=(e=this.view)==null?void 0:e.basemapTerrain)==null?void 0:i.spatialReference}constructor(e){super(e),this._im=new Array,this._ground=new Array,this._scene=new Array,this.lastElevationQuery=null,this.elevationCacheEnabled=!1}destroy(){this._elevationQueryCached=et(this._elevationQueryCached)}enableElevationCache(e){e||(this.lastElevationQuery=null),this.elevationCacheEnabled=e}getElevation(e,i,r,n,s){if(this.elevationCacheEnabled&&this.lastElevationQuery!=null){const a=this.lastElevationQuery;if(e===a.x&&i===a.y&&r===a.z&&jn(n,a.spatialReference)&&s===a.queryContext)return a.result}let o=null;return o=f8(o,this._im,e,i,r,n,s),o==null&&(o=f8(o,this._ground,e,i,r,n,s)),s==="scene"&&(o=f8(o,this._scene,e,i,r,n,s)),this.elevationCacheEnabled&&(this.lastElevationQuery={x:e,y:i,z:r,spatialReference:n,queryContext:s,result:o}),o}getSphereElevationBounds(e,i){let r=1/0,n=-1/0;for(const s of[this._im,this._ground,this._scene])s.forEach(o=>{if(o.getSphereElevationBounds){const a=o.getSphereElevationBounds(e,i);a!=null&&(r=Math.min(r,a.min),n=Math.max(n,a.max))}});return{min:r,max:n}}getRootElevationBounds(){let e=1/0,i=-1/0;for(const r of[this._im,this._ground,this._scene])r.forEach(n=>{if(n.getRootElevationBounds){const s=n.getRootElevationBounds();s!=null&&(e=Math.min(e,s.min),i=Math.max(i,s.max))}});return{min:e,max:i}}async queryElevation(e,i,r,n,s,o=null,a=0){const c=this._getElevationQuery(n);try{const p=await c.queryElevation(e,i,o,a);return s==="scene"?f8(p,this._scene,e,i,r,n,s):p}catch(p){return Uo(p),this.getElevation(e,i,r,n,s)}}register(e,i){this.addHandles(i.on("elevation-change",r=>this.emit("elevation-change",r)),i),this._providersFromContext(e).push(i)}unregister(e){this.removeHandles(e);for(const i of[this._im,this._ground,this._scene]){const r=i.indexOf(e);r>-1&&i.splice(r,1)}}_providersFromContext(e){switch(e){case"ground":return this._ground;case"im":return this._im;case"scene":return this._scene}}_getElevationQuery(e=this.view.spatialReference){const i=this._elevationQueryCached;if(i!=null&&jn(e,i.spatialReference))return i;i==null||i.destroy({completeTasks:!0});const{wkid:r,wkt:n,wkt2:s,latestWkid:o}=e,a=new Q5t(this.view.resourceController.scheduler,new rt({wkid:r,wkt:n,wkt2:s,latestWkid:o}),()=>{var c;return(c=this.view.map)==null?void 0:c.ground},{maximumAutoTileRequests:4});return this._elevationQueryCached=a,a}};function f8(t,e,i,r,n,s,o){for(const a of e){const c=a.getElevation(i,r,n,s,o);c!=null&&(t=t!=null?Math.max(c,t):c)}return t}y([w({constructOnly:!0})],O4.prototype,"view",void 0),y([w()],O4.prototype,"spatialReference",null),O4=y([Z("esri.views.3d.support.CombinedElevationProvider")],O4);let n9=class Fie{static isValidProfile(e){return e in Fie.profiles}static getDefaultProfile(){return $e("esri-iPhone")?"low":"medium"}static apply(e,i){const r=Fie.profiles[e];i.graphics3D.maxTotalNumberOfFeatures=r.graphics3D.maxTotalNumberOfFeatures,i.graphics3D.maxNumberOfDrawCalls=r.graphics3D.maxNumberOfDrawCalls,i.graphics3D.maxTotalNumberOfVertices=r.graphics3D.maxTotalNumberOfVertices,i.graphics3D.polygonLodFactor=r.graphics3D.polygonLodFactor,i.graphics3D.polylineLodFactor=r.graphics3D.polylineLodFactor,i.graphics3D.snapshotAvailable=r.graphics3D.snapshotAvailable,i.graphics3D.skipHighSymbolLods=r.graphics3D.skipHighSymbolLods,i.graphics3D.uncompressedTextureDownsamplingEnabled=r.graphics3D.uncompressedTextureDownsamplingEnabled;const n=i.sceneService.object,s=r.sceneService.object;n.lodFactor=s.lodFactor,n.lodCrossfadeinDuration=s.lodCrossfadeinDuration,n.lodCrossfadeoutDuration=s.lodCrossfadeoutDuration,n.lodCrossfadeUncoveredDuration=s.lodCrossfadeUncoveredDuration,i.sceneService.point.lodFactor=r.sceneService.point.lodFactor,i.sceneService.integratedMesh.lodFactor=r.sceneService.integratedMesh.lodFactor,i.sceneService.pointCloud.lodFactor=r.sceneService.pointCloud.lodFactor,i.sceneService.uncompressedTextureDownsamplingEnabled=r.sceneService.uncompressedTextureDownsamplingEnabled,i.tiledSurface.lodBias=r.tiledSurface.lodBias,i.tiledSurface.angledSplitBias=r.tiledSurface.angledSplitBias,i.tiledSurface.vtlContentZoom=r.tiledSurface.vtlContentZoom,i.tiledSurface.reduceTileLevelDifferences=r.tiledSurface.reduceTileLevelDifferences,i.tiledSurface.textureFadeDuration=r.tiledSurface.textureFadeDuration,i.heatmap.pixelRatio=r.heatmap.pixelRatio,i.heatmap.maxTotalNumberOfFeatures=r.heatmap.maxTotalNumberOfFeatures,i.fadeDuration=r.fadeDuration,i.antialiasingEnabled=r.antialiasingEnabled,i.physicallyBasedRenderingEnabled=r.physicalBasedRenderingEnabled,i.highQualityTransparency=r.highQualityTransparency,i.highResolutionAtmosphere=r.highResolutionAtmosphere,i.reflections=r.reflections,i.ambientOcclusion=r.ambientOcclusion,i.memoryLimit=r.memoryLimit,i.additionalCacheMemory=r.additionalCacheMemory,i.frameRate=r.frameRate,i.maximumPixelRatio=r.maximumPixelRatio}};n9.test={reset(){const t=N7e();for(const e of Object.keys(t))n9.profiles[e]=t[e]}};const UR={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430};function N7e(){const t=!!$e("esri-mobile"),e=!!$e("ios"),i=400;return{low:{graphics3D:{maxTotalNumberOfFeatures:25e3,maxNumberOfDrawCalls:8e3,maxTotalNumberOfVertices:255e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0,uncompressedTextureDownsamplingEnabled:!0},heatmap:{pixelRatio:.125,maxTotalNumberOfFeatures:25e3},sceneService:{object:{lodFactor:.2,lodCrossfadeinDuration:0,lodCrossfadeoutDuration:0,lodCrossfadeUncoveredDuration:0},point:{lodFactor:1},integratedMesh:{lodFactor:.6},pointCloud:{lodFactor:.5},uncompressedTextureDownsamplingEnabled:!0},tiledSurface:{lodBias:-1,angledSplitBias:.5,vtlContentZoom:.75,reduceTileLevelDifferences:!0,textureFadeDuration:0},fadeDuration:0,antialiasingEnabled:!1,physicalBasedRenderingEnabled:!1,highQualityTransparency:!1,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,memoryLimit:200+UR.IPhone12Pro,additionalCacheMemory:0,frameRate:0,maximumPixelRatio:1},medium:{graphics3D:{maxTotalNumberOfFeatures:1e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:625e4,polygonLodFactor:t?.8:1,polylineLodFactor:t?1.2:1.5,snapshotAvailable:!e,skipHighSymbolLods:!1,uncompressedTextureDownsamplingEnabled:t},heatmap:{pixelRatio:.25,maxTotalNumberOfFeatures:5e4},sceneService:{object:{lodFactor:1,lodCrossfadeinDuration:0,lodCrossfadeoutDuration:0,lodCrossfadeUncoveredDuration:i},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1},uncompressedTextureDownsamplingEnabled:t},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,reduceTileLevelDifferences:!$e("disable-feature:reduce-map-tile-levels"),textureFadeDuration:i},fadeDuration:i,antialiasingEnabled:!0,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!1,reflections:!1,ambientOcclusion:!1,memoryLimit:t?600+UR.GalaxyS20:750+UR.FullHD,additionalCacheMemory:t?-100:150,frameRate:0,maximumPixelRatio:1},high:{graphics3D:{maxTotalNumberOfFeatures:1e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:125e5,polygonLodFactor:t?1.2:2,polylineLodFactor:t?1.2:2,snapshotAvailable:!e,skipHighSymbolLods:!1,uncompressedTextureDownsamplingEnabled:!1},heatmap:{pixelRatio:.5,maxTotalNumberOfFeatures:5e4},sceneService:{object:{lodFactor:1,lodCrossfadeinDuration:0,lodCrossfadeoutDuration:0,lodCrossfadeUncoveredDuration:i},point:{lodFactor:1},integratedMesh:{lodFactor:1},pointCloud:{lodFactor:1},uncompressedTextureDownsamplingEnabled:!1},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,reduceTileLevelDifferences:!$e("disable-feature:reduce-map-tile-levels"),textureFadeDuration:i},fadeDuration:i,antialiasingEnabled:!0,physicalBasedRenderingEnabled:!0,highQualityTransparency:!0,highResolutionAtmosphere:!0,reflections:!0,ambientOcclusion:!0,memoryLimit:t?900+UR.SurfacePro7:1500+UR.FullHDRetina,additionalCacheMemory:t?-150:0,frameRate:0,maximumPixelRatio:t?1:1/0}}}(function(t){t.profiles=N7e()})(n9||(n9={}));const vk=n9,F7e=new qe([0,255,255]),k7e=1,z7e=.25,U7e=new qe([0,0,0]),V7e=.4,B7e=.2;let zg=class extends ze{constructor(){super(...arguments),this.color=F7e.clone(),this.haloColor=null,this.haloOpacity=k7e,this.fillOpacity=z7e,this.shadowOpacity=V7e,this.shadowColor=U7e.clone(),this.shadowDifference=B7e}};y([w({type:qe})],zg.prototype,"color",void 0),y([w({type:qe})],zg.prototype,"haloColor",void 0),y([w()],zg.prototype,"haloOpacity",void 0),y([w()],zg.prototype,"fillOpacity",void 0),y([w()],zg.prototype,"shadowOpacity",void 0),y([w({type:qe})],zg.prototype,"shadowColor",void 0),y([w()],zg.prototype,"shadowDifference",void 0),zg=y([Z("esri.views.3d.support.HighlightOptions")],zg);const j7e=zg;function OG(t,e){return e?{...e,query:{...t??{},...e.query}}:{query:t}}function F5(t){return typeof t=="string"?Is(t):Pe(t)}function PG(t,e,i){const r={};for(const n in t){if(n==="declaredClass")continue;const s=t[n];if(s!=null&&typeof s!="function")if(Array.isArray(s)){r[n]=[];for(let o=0;oe.toJSON())}}function G7e(t,e,i){const r=PXe(e);return t.map(n=>{const s=r.fromJSON(n);return s.spatialReference=i,s})}let aS=class extends Ue{constructor(e){super(e),this.geometries=[],this.outSpatialReference=null,this.transformation=null,this.transformForward=null}toJSON(){const e=this.geometries.map(n=>n.toJSON()),i=this.geometries[0],r={};return r.outSR=YO(this.outSpatialReference),r.inSR=YO(i.spatialReference),r.geometries=JSON.stringify({geometryType:c5(i),geometries:e}),this.transformation&&(r.transformation=this.transformation.wkid||JSON.stringify(this.transformation)),this.transformForward!=null&&(r.transformForward=this.transformForward),r}};y([w()],aS.prototype,"geometries",void 0),y([w({json:{read:{source:"outSR"}}})],aS.prototype,"outSpatialReference",void 0),y([w()],aS.prototype,"transformation",void 0),y([w()],aS.prototype,"transformForward",void 0),aS=y([Z("esri.rest.support.ProjectParameters")],aS);const RG=aS,tRt=_s(RG);async function Ice(t,e,i){e=tRt(e);const r=F5(t),n={...r.query,f:"json",...e.toJSON()},s=e.outSpatialReference,o=c5(e.geometries[0]),a=OG(n,i);return yi(r.path+"/project",a).then(({data:{geometries:c}})=>G7e(c,o,s))}async function $ce(t=null,e){var n,s;if(Mr.geometryServiceUrl)return Mr.geometryServiceUrl;if(!t)throw new se("internal:geometry-service-url-not-configured");let i;i="portal"in t?t.portal||os.getDefault():t,await i.load({signal:e});const r=(s=(n=i.helperServices)==null?void 0:n.geometry)==null?void 0:s.url;if(!r)throw new se("internal:geometry-service-url-not-configured");return r}async function iRt(t,e,i=null,r){const n=await $ce(i,r),s=new RG;s.geometries=[t],s.outSpatialReference=e;const o=await Ice(n,s,{signal:r});if(o&&Array.isArray(o)&&o.length===1)return o[0];throw new se("internal:geometry-service-projection-failed")}const rRt=Object.freeze(Object.defineProperty({__proto__:null,getGeometryServiceURL:$ce,projectGeometry:iRt},Symbol.toStringTag,{value:"Module"}));let nRt=class{constructor(e,i){this.spatialReference=i,this.unitInMeters=xs(this.spatialReference,Tr(this.spatialReference).metersPerDegree);const r=e&&"portalItem"in e?e.portalItem:void 0;this._geometryServiceURLPromise=$ce(r).catch(()=>{throw new se("mapcoordshelper:missing-geometry-service","Must specify geometryService in esri/config")})}async toGeographic(e){const i=await this._geometryServiceURLPromise;let r,n=!0;Array.isArray(e[0])&&typeof e[0]!="number"?r=e:(r=[e],n=!1);const s=r.map(c=>c instanceof mt?c:new mt(c,this.spatialReference)),o=new RG({geometries:s,outSpatialReference:rt.WGS84}),a=(await Ice(i,o)).map(c=>c.type==="point"?[c.x,c.y]:void 0).filter(c=>!!c);return n?a:a[0]}},Yd=class extends ze{constructor(){super(...arguments),this.minTotalNumberOfFeatures=2e3,this.maxTotalNumberOfFeatures=5e4,this.maxNumberOfDrawCalls=17e3,this.maxTotalNumberOfVertices=17e5,this.snapshotAvailable=!0,this.polygonLodFactor=1,this.polylineLodFactor=1,this.skipHighSymbolLods=!1,this.uncompressedTextureDownsamplingEnabled=!1}};y([w()],Yd.prototype,"minTotalNumberOfFeatures",void 0),y([w()],Yd.prototype,"maxTotalNumberOfFeatures",void 0),y([w()],Yd.prototype,"maxNumberOfDrawCalls",void 0),y([w()],Yd.prototype,"maxTotalNumberOfVertices",void 0),y([w()],Yd.prototype,"snapshotAvailable",void 0),y([w()],Yd.prototype,"polygonLodFactor",void 0),y([w()],Yd.prototype,"polylineLodFactor",void 0),y([w()],Yd.prototype,"skipHighSymbolLods",void 0),y([w()],Yd.prototype,"uncompressedTextureDownsamplingEnabled",void 0),Yd=y([Z("esri.views.3d.support.QualitySettings.Graphics3DSettings")],Yd);let ky=class extends ze{constructor(){super(...arguments),this.lodFactor=1}};y([w()],ky.prototype,"lodFactor",void 0),ky=y([Z("esri.views.3d.support.QualitySettings.LoDFactorSettings")],ky);let oV=class extends ky{constructor(){super(...arguments),this.lodCrossfadeinDuration=0,this.lodCrossfadeoutDuration=0,this.lodCrossfadeUncoveredDuration=0}};oV=y([Z("esri.views.3d.support.QualitySettings.LoDFactor3DObjectSettings")],oV);let Lv=class extends ze{constructor(){super(...arguments),this.object=new oV,this.point=new ky,this.integratedMesh=new ky,this.pointCloud=new ky,this.uncompressedTextureDownsamplingEnabled=!1}};y([w({type:oV})],Lv.prototype,"object",void 0),y([w({type:ky})],Lv.prototype,"point",void 0),y([w({type:ky})],Lv.prototype,"integratedMesh",void 0),y([w({type:ky})],Lv.prototype,"pointCloud",void 0),y([w()],Lv.prototype,"uncompressedTextureDownsamplingEnabled",void 0),Lv=y([Z("esri.views.3d.support.QualitySettings.SceneServiceSettings")],Lv);let Dv=class extends ze{constructor(){super(...arguments),this.lodBias=0,this.angledSplitBias=1,this.vtlContentZoom=1,this.reduceTileLevelDifferences=!0,this.textureFadeDuration=400}};y([w()],Dv.prototype,"lodBias",void 0),y([w()],Dv.prototype,"angledSplitBias",void 0),y([w()],Dv.prototype,"vtlContentZoom",void 0),y([w()],Dv.prototype,"reduceTileLevelDifferences",void 0),y([w()],Dv.prototype,"textureFadeDuration",void 0),Dv=y([Z("esri.views.3d.support.QualitySettings.TiledSurfaceSettings")],Dv);let YM=class extends ze{constructor(){super(...arguments),this.pixelRatio=1,this.maxTotalNumberOfFeatures=5e4}};y([w()],YM.prototype,"pixelRatio",void 0),y([w()],YM.prototype,"maxTotalNumberOfFeatures",void 0),YM=y([Z("esri.views.3d.support.QualitySettings.HeatmapSettings")],YM);let zl=class extends ze{constructor(){super(...arguments),this.graphics3D=new Yd,this.sceneService=new Lv,this.tiledSurface=new Dv,this.heatmap=new YM,this.fadeDuration=400,this.antialiasingEnabled=!0,this.physicallyBasedRenderingEnabled=!1,this.highQualityTransparency=!0,this.highResolutionAtmosphere=!1,this.reflections=!1,this.ambientOcclusion=!1,this.memoryLimit=750,this.additionalCacheMemory=0,this.frameRate=void 0,this.maximumPixelRatio=1/0}};y([w({type:Yd})],zl.prototype,"graphics3D",void 0),y([w({type:Lv})],zl.prototype,"sceneService",void 0),y([w({type:Dv})],zl.prototype,"tiledSurface",void 0),y([w({type:YM})],zl.prototype,"heatmap",void 0),y([w()],zl.prototype,"fadeDuration",void 0),y([w()],zl.prototype,"antialiasingEnabled",void 0),y([w()],zl.prototype,"physicallyBasedRenderingEnabled",void 0),y([w()],zl.prototype,"highQualityTransparency",void 0),y([w()],zl.prototype,"highResolutionAtmosphere",void 0),y([w()],zl.prototype,"reflections",void 0),y([w()],zl.prototype,"ambientOcclusion",void 0),y([w()],zl.prototype,"memoryLimit",void 0),y([w()],zl.prototype,"additionalCacheMemory",void 0),y([w()],zl.prototype,"frameRate",void 0),y([w()],zl.prototype,"maximumPixelRatio",void 0),zl=y([Z("esri.views.3d.support.QualitySettings.QualitySettings")],zl);const s_e=zl;function sRt(t){return t5(t)&&t.length>=3}function oRt(t){return(i5(t)||Array.isArray(t))&&t.length>=3}function aRt(t){return sRt(t)||oRt(t)}let lRt=class kie{constructor(e,i,r,n){this.viewingMode=e,this.spatialReference=i,this.unitInMeters=r,this._coordinateSystem=n,this._tmpCoordinateSystem=wdt(n)}set extent(e){e&&xdt(this._coordinateSystem,e,this._coordinateSystem)}getAltitude(e){return Pdt(this._coordinateSystem,e)}setAltitude(e,i,r=e){return eIe(this._coordinateSystem,r,i,e)}setAltitudeOfTransformation(e,i){Rdt(this._coordinateSystem,i,e,i)}worldUpAtPosition(e,i){return Cdt(this._coordinateSystem,e,i)}worldBasisAtPosition(e,i,r){return Adt(this._coordinateSystem,e,i,r)}basisMatrixAtPosition(e,i){const r=this.worldBasisAtPosition(e,Os.X,xt.get()),n=this.worldBasisAtPosition(e,Os.Y,xt.get()),s=this.worldBasisAtPosition(e,Os.Z,xt.get());return d1(i,r[0],r[1],r[2],0,n[0],n[1],n[2],0,s[0],s[1],s[2],0,0,0,0,1),i}headingAtPosition(e,i){const r=this.worldUpAtPosition(e,xt.get()),n=this.worldBasisAtPosition(e,Os.Y,xt.get()),s=E5e(i,n,r);return mu(s)}intersectManifoldClosestSilhouette(e,i,r){return oq(this._coordinateSystem,i,this._tmpCoordinateSystem),Odt(this._tmpCoordinateSystem,e,r),r}intersectManifold(e,i,r){oq(this._coordinateSystem,i,this._tmpCoordinateSystem);const n=xt.get();return Mdt(this._tmpCoordinateSystem,e,n)?Ne(r,n):null}intersectInfiniteManifold(e,i,r){if(this.viewingMode===_t.Global)return this.intersectManifold(e,i,r);oq(this._coordinateSystem,i,this._tmpCoordinateSystem);const n=this._tmpCoordinateSystem.value,s=xt.get();return CE(n.plane,e,s)?Ne(r,s):null}toRenderCoords(e,i,r){return gU(e)?fd(e,i,this.spatialReference):il(e,i,r,this.spatialReference)}fromRenderCoords(e,i,r=null){return gU(i)?(r!=null&&(i.spatialReference=r),_8e(e,this.spatialReference,i)):aRt(i)?il(e,this.spatialReference,i,r)?i:null:M_(e,this.spatialReference,i)}static create(e,i){switch(e){case _t.Local:return new kie(_t.Local,i,xs(i),Edt());case _t.Global:return new kie(_t.Global,i,1,Tdt(i))}}static renderUnitScaleFactor(e,i){return RZ(e)/RZ(i)}};var yy;(function(t){t[t.ELEVATION=0]="ELEVATION",t[t.BASEMAP=1]="BASEMAP",t[t.I3S_INDEX=2]="I3S_INDEX",t[t.I3S_DATA=3]="I3S_DATA",t[t.SYMBOLOGY=4]="SYMBOLOGY"})(yy||(yy={}));const cRt=(()=>{const t=new Array;return t[yy.ELEVATION]=10,t[yy.BASEMAP]=10,t[yy.I3S_INDEX]=10,t[yy.I3S_DATA]=10,t[yy.SYMBOLOGY]=5,t})(),uRt=30;function H7e(t){return"usedMemory"in t&&"unloadedMemory"in t&&"ignoresMemoryFactor"in t}function hRt(t){return new Zc({view:t})}const o_e=.1,m8=1,SY=1,dRt=.75,pRt=.6,a_e=1.3;let Zc=class extends ze{constructor(e){super(e),this._quality=1,this._usedMemory=0,this._updating=!1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._memoryPredicted=0,this._cacheStorage=new vOe,this._warnMemoryUsage=null,this._numQualityChanges=0,this._maxMemory=750,this._additionalCacheMemory=0,this.addHandles(LT({prepare:()=>this._updateMemory()}))}destroy(){this._cacheStorage.destroy()}get maxMemory(){return this._maxMemory}set maxMemory(e){e==null||e<=0||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory1.1*SY||this._usedMemory>SY)&&(this._stableQuality>0?(this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality)):this._quality>o_e&&this._downscaleMemoryUsedSY)this._stableQuality=0,this._canFastRecover=!1,e=this._updateQuality(this._quality/a_e),this._downscaleMemoryUsed=this._memoryPredicted;else if(this._stableQuality!==this._quality)if(this._usedMemory!!e.updating)}_updateMemory(){var o,a,c,p,_;if(!this.view)return;(a=(o=this.view._stage)==null?void 0:o.renderer)==null||a.tick();let e=(((c=this.view.basemapTerrain)==null?void 0:c.usedMemory)??0)+(((_=(p=this.view._stage)==null?void 0:p.renderer)==null?void 0:_.usedMemory)??0),i=0;this.view.allLayerViews&&this.view.allLayerViews.forEach(x=>{if(H7e(x)){const S=x.ignoresMemoryFactor?this._quality:1;e+=x.usedMemory*S,i+=x.unloadedMemory*S}});const r=this._warnMemoryUsage==null||Math.round(10*e)!==Math.round(10*this._warnMemoryUsage),n=1048576*this.maxMemory;if(e>n&&r){this._warnMemoryUsage=e;const x=C=>(C/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",S=Math.round(100*this._quality);Ce.getLogger(this).warn(`Memory Limit exceeded! Limit: ${x(n)} Current: ${x(e)} Projected: ${x(e+i)} Quality: ${S}%`)}this._usedMemory=e/n,this._memoryPredicted=(e+i)/n;const s=n-e;this._cacheStorage.maxSize=Math.max(0,s+1048576*this.additionalCacheMemory)}get test(){const e=this;return{cacheStorage:this._cacheStorage,resetQualityChanges:()=>{const i=e._numQualityChanges;return e._numQualityChanges=0,i}}}};y([w({constructOnly:!0})],Zc.prototype,"view",void 0),y([w()],Zc.prototype,"maxMemory",null),y([w()],Zc.prototype,"additionalCacheMemory",null),y([w({readOnly:!0})],Zc.prototype,"memoryFactor",null),y([w({readOnly:!0})],Zc.prototype,"updating",null),y([w({readOnly:!0})],Zc.prototype,"usedMemory",null),y([w({readOnly:!0})],Zc.prototype,"usedCacheMemory",null),y([w()],Zc.prototype,"_quality",void 0),y([w()],Zc.prototype,"_usedMemory",void 0),y([w()],Zc.prototype,"_updating",void 0),y([w()],Zc.prototype,"_stableQuality",void 0),y([w()],Zc.prototype,"_maxMemory",void 0),y([w()],Zc.prototype,"_additionalCacheMemory",void 0),Zc=y([Z("esri.views.3d.support.MemoryController")],Zc);let fRt=class{constructor(e){this.client=e,this._cancelled=!1,this.size=0,this.duration=0}},mRt=class{constructor(e){this.typeWorkerQuota=e,this.tasks=new Array,this.numWorkers=0,this.statistics=new gRt}},gRt=class{constructor(){this.requests=0,this.size=0,this.duration=0,this.speed=0}},yRt=class{constructor(e,i,r,n){this._workerFunc=e,this._callbackFunc=i,this._maxTotalNumWorkers=r,this._totalNumWorkers=0,this._clients=n.map(s=>new mRt(s))}destroy(){this._clients.length=0}hasQuota(e){const i=this._clients[e];return!!i&&(this._totalNumWorkersthis._taskCallback(r,n))):i.tasks.push(e))}cancel(e){this._taskFinished(e),e._cancelled=!0}_taskFinished(e){const i=this._clients[e.client];this._totalNumWorkers--,i&&(i.numWorkers--,i.statistics.requests++,i.statistics.size+=e.size||0,i.statistics.duration+=e.duration||0,i.statistics.speed=i.statistics.duration>0?i.statistics.size/i.statistics.duration:0,Xt(i.numWorkers>=0)),this._next()}_next(){for(const e of this._clients)if(e&&e.numWorkers0;)if(this._workerFunc(e.tasks.shift(),(i,r)=>this._taskCallback(i,r)))return e.numWorkers++,this._totalNumWorkers++,!0;return!1}_taskCallback(e,i){e._cancelled||(this._callbackFunc(e,i),this._taskFinished(e))}getStatsForType(e){const i=this._clients[e];return i?{quota:i.typeWorkerQuota,workers:i.numWorkers,queueSize:i.tasks.length,requestStats:i.statistics}:null}get test(){const e=this;return{set workerFunc(i){e._workerFunc=i}}}},_k=class extends ze{constructor(){super(...arguments),this._tasks=new Map,this._onLoadQueue=new Array,this._doneQueue=new Array,this.updating=!1}setup(e,i,r){this._loadQueue=new yRt((n,s)=>this._startLoading(n,s),(n,s)=>this._doneLoadingCB(n,s),e,i),r&&(this._frameTask=r.registerTask(ni.STREAM_DATA_LOADER,this))}destroy(){this._frameTask=en(this._frameTask),this._tasks.forEach(e=>vn(e.abortController)),this._loadQueue=et(this._loadQueue),this._onLoadQueue=null,this._doneQueue=null,this._tasks=null}hasDownloadSlots(e){return this._loadQueue.hasQuota(e)}request(e,i,r,n={}){const s=ec();s.__signal=n!=null?n.signal:null;const o=this._createOrUpdateTask(e,i,r,n,s);return Zl(n,()=>this._cancelRequest(o,s)),s.promise}_createTask(e,i,r,n,s,o){const a=new wRt(e,i,r,n,s);return this._updateTask(a,o),this._tasks.set(s,a),this._tasks.size===1&&this._set("updating",!0),this._loadQueue.push(a),a}_cancelRequest(e,i){var r;uL(e.resolvers,i),i.reject(ur()),e.resolvers.length===0&&(e.status===hf.DOWNLOADING&&(e.status=hf.CANCELLED,this._loadQueue.cancel(e),(r=e.abortController)==null||r.abort(),e.request=null,e.abortController=null),e.status=hf.CANCELLED,this._tasks.delete(e.key),this._tasks.size===0&&this._set("updating",!1))}_updateTask(e,i){e.resolvers.push(i)}_createOrUpdateTask(e,i,r,n,s){const o=xRt((n==null?void 0:n.uid)||e,i,r),a=this._tasks.get(o);return a?(this._updateTask(a,s),a):this._createTask(e,n,i,r,o,s)}_doneLoadingCB(e,i){this._loadQueue&&(Xt(e.status===hf.DOWNLOADING),e.status=hf.DOWNLOADED,this._frameTask?this._doneQueue.push({task:e,err:i}):this._doneLoading(e,i))}get running(){return this._doneQueue.length>0||this._onLoadQueue.length>0}runTask(e){for(;!e.done&&this._onLoadQueue.length>0;){const i=this._onLoadQueue.shift();St(i.task.abortController),i.task.abortController=null,i.callback(i.task),e.madeProgress()}for(;!e.done&&this._doneQueue.length>0;){const i=this._doneQueue.shift();i.task.status!==hf.DOWNLOADED&&(i.err=i.err||ur()),this._doneLoading(i.task,i.err),e.madeProgress()}}_doneLoading(e,i){if(i&&!on(i)&&e.numRetries>0)return--e.numRetries,void this._loadQueue.push(e);let r=e.result instanceof HTMLImageElement?0:e.resolvers.length;for(const n of e.resolvers)if(i)on(i)?n.reject(i):n.reject(new se("stream-data-loader:request-error",`Failed to request resource at '${e.url}'. ${i}`,{url:e.url,error:i}));else{--r;const s=r>0?Pe(e.result):e.result;n.resolve(s)}this._tasks.delete(e.key),this._tasks.size===0&&this._set("updating",!1)}_startLoading(e,i){if(e.status===hf.CANCELLED)return!1;let r,n;switch(e.startTime=performance.now(),e.status=hf.DOWNLOADING,e.docType){case"binary":n="array-buffer",r=0;break;case"image":n="image";break;case"image+type":n="array-buffer";break;default:n="json"}e.abortController=new AbortController;const s=e.abortController.signal;e.request=yi(e.url,{...e.options,responseType:n,timeout:r,signal:s});let o=()=>{};const a=p=>{e.duration=performance.now()-e.startTime,e.size=p instanceof ArrayBuffer?p.byteLength:e.size||0,e.result=p,this._frameTask?this._onLoadQueue.push({callback:i,task:e}):(e.abortController=null,i(e))},c=p=>{e.status===hf.DOWNLOADING&&i(e,p),o()};return e.docType!=="image+type"?(e.request.then(p=>a(p.data),c),!0):(e.request.then(p=>{const _=p.data,x=_Rt(_);if(n="image",e.size=_.byteLength,x==="unknown")return e.request=yi(e.url,{responseType:n,timeout:r,signal:s}),void e.request.then(M=>a(M.data),c);const S=new Blob([_],{type:x}),C=window.URL.createObjectURL(S);o=()=>window.URL.revokeObjectURL(C),e.request=yi(C,{responseType:n,timeout:r,signal:s}),e.request.then(M=>a(new Lce(M.data,x,o)),c)},c),!0)}get test(){return{loadQueue:this._loadQueue}}};y([w({readOnly:!0})],_k.prototype,"updating",void 0),_k=y([Z("esri.views.3d.support.StreamDataLoader")],_k);const vRt={numRetries:0};function _Rt(t){if(t.byteLength<2)return"unknown";const e=new Uint8Array(t,0,t.byteLength);return e[0]===137&&e[1]===80?"image/png":e[0]===71&&e[1]===73?"image/gif":e[0]===66&&e[1]===77?"image/bmp":e[0]===255&&e[1]===216?"image/jpeg":"unknown"}let Lce=class{constructor(e,i,r){this.image=e,this.type=i,this.release=r}get isOpaque(){return this.type==="image/jpeg"}};function bRt(t){return"image"in t&&"type"in t}let wRt=class extends fRt{constructor(e,i,r,n,s){super(n),this.url=e,this.options=i,this.docType=r,this.key=s,this.result=null,this.status=hf.QUEUED,this.request=null,this.abortController=null,this.resolvers=new Array,this.startTime=0,this.numRetries=vRt.numRetries}};function xRt(t,e,i){return`${t}:${e}:${i}`}var hf;(function(t){t[t.QUEUED=1]="QUEUED",t[t.DOWNLOADING=2]="DOWNLOADING",t[t.DOWNLOADED=3]="DOWNLOADED",t[t.CANCELLED=4]="CANCELLED"})(hf||(hf={}));let bk=class extends ze{constructor(){super(...arguments),this.updating=!1}};function SRt(t){return new j0({view:t})}y([w({readOnly:!0})],bk.prototype,"updating",void 0),bk=y([Z("esri.views.3d.support.ResourceControllerMain")],bk);let j0=class extends bk{constructor(){super(...arguments),this._immediateTask=EP,this._normalTask=EP,this._updatingObjects=TP([]),this._frameTask=null}get immediate(){return this._immediateTask}get normal(){return this._normalTask}initialize(){this._scheduler=_ht(),this._memoryController=hRt(this.view),this._streamDataLoader=new _k,this._streamDataLoader.setup(uRt,cRt,this._scheduler),this.addHandles([_e(()=>{var e;return(e=this.view.state)==null?void 0:e.mode},e=>{e!=null&&(this._scheduler.state=e)},Li),_e(()=>this.view.stationary,()=>this._stationaryChangedHandler())]),this._frameTask=LT({update:e=>this._frame(e)}),this._immediateTask=this._scheduler.registerTask(ni.RESOURCE_CONTROLLER_IMMEDIATE),this._normalTask=this._scheduler.registerTask(ni.RESOURCE_CONTROLLER)}destroy(){this._immediateTask.remove(),this._normalTask.remove(),this._frameTask=en(this._frameTask),this._streamDataLoader=et(this._streamDataLoader),this._memoryController=et(this._memoryController),this._scheduler=et(this._scheduler),this.view=null}get updating(){var e,i,r,n;return!!((e=this._memoryController)!=null&&e.updating||(i=this._streamDataLoader)!=null&&i.updating||(r=this._immediateTask)!=null&&r.updating)||((n=this._updatingObjects)==null?void 0:n.value.some(s=>s.updating))}get scheduler(){return this._scheduler}get memoryController(){return this._memoryController}createStreamDataRequester(e){const i=this._streamDataLoader;return{request:(r,n,s)=>i.request(r,n,e,s),get busy(){return!i.hasDownloadSlots(e)}}}addUpdatingObject(e){const i=this._updatingObjects;return i.value=[...i.value,e],rr(()=>{i.value=i.value.filter(r=>r!==e)})}_frame(e){this.view.suspended||this.view.stateManager&&(this.view.stateManager.step(vne(e.deltaTime)),!this._scheduler)||(this._memoryController.update(),this._scheduler.updateBudget(e)&&this._scheduler.frame())}_stationaryChangedHandler(){this.memoryController.resetStableQuality()}get test(){return{getQueueStats:e=>this._streamDataLoader.test.loadQueue.getStatsForType(e)}}};y([w()],j0.prototype,"view",void 0),y([w()],j0.prototype,"_scheduler",void 0),y([w()],j0.prototype,"_memoryController",void 0),y([w()],j0.prototype,"_streamDataLoader",void 0),y([w()],j0.prototype,"_immediateTask",void 0),y([w()],j0.prototype,"_normalTask",void 0),y([w()],j0.prototype,"_updatingObjects",void 0),y([w({readOnly:!0})],j0.prototype,"updating",null),j0=y([Z("esri.views.3d.support.ResourceControllerImpl")],j0);function TRt(t){return H7e(t)}function ERt(t){return"performanceInfo"in t}var _c,ii;(function(t){t[t.INSIDE=0]="INSIDE",t[t.INTERSECTS=1]="INTERSECTS",t[t.OUTSIDE=2]="OUTSIDE"})(_c||(_c={})),function(t){t[t.NORTH=0]="NORTH",t[t.NORTH_EAST=1]="NORTH_EAST",t[t.EAST=2]="EAST",t[t.SOUTH_EAST=3]="SOUTH_EAST",t[t.SOUTH=4]="SOUTH",t[t.SOUTH_WEST=5]="SOUTH_WEST",t[t.WEST=6]="WEST",t[t.NORTH_WEST=7]="NORTH_WEST"}(ii||(ii={}));const FC=W(),CRt=W(),D1=W(),N1=W();function ARt(t,e,i=0){const r=t.extent;if(r==null)return!1;if(i===0)return VEe(r,e);const n=Math.min(r[2]-r[0],r[3]-r[1]);return gXe(r,e,i*n)}function g8(t,e,i,r){Ne(FC,i),FC[r]=e[r];const n=je(FC,FC,e),s=je(CRt,t,e),o=Ve(s,n),a=Ve(n,n);let c;c=o<=0?e:a<=o?i:Be(FC,e,De(n,n,o/a));const p=je(FC,t,c);return Math.PI/2-Math.atan(p[2]/Math.sqrt(p[0]*p[0]+p[1]*p[1]))}function MRt(t,e,i){const r=t.extent;if(r==null)return 0;D1[0]=r[0],D1[1]=r[1],D1[2]=i,N1[0]=r[2],N1[1]=r[3],N1[2]=i;let n=1/0,s=1/0;return e[0]N1[0]&&(n=g8(e,N1,D1,0)),e[1]N1[1]&&(s=g8(e,N1,D1,1)),Math.min(n,s)}function ORt(t,e,i){if(t==null)return wae();if(t.spatialReference.isGeographic&&!U2(t.spatialReference))return new se("tilingscheme:local-unsupported-spatial-reference","The tiling scheme spatial reference is not supported in local scenes");const r=Gu.checkUnsupported(t);if(r!=null)return r;if(i==null)return new se("tilingscheme:extent-not-exist","The layer does not provide a layer extent.");const n=PRt(t,i);if(n)return n;const s=t.spatialReference;return e==null||s.equals(e)||e.isWGS84&&s.isWebMercator?null:new se("tilingscheme:spatial-reference-mismatch","The tiling scheme does not match the spatial reference of the local scene")}function PRt(t,e){const i=t.lods,r=i[0].resolution*2**i[0].level,n=[r*t.size[0],r*t.size[1]],s=[t.origin.x,t.origin.y],o=ise(e),a=Ni();Gu.computeRowColExtent(o,n,s,a);const c=(a[2]-a[0])*(a[3]-a[1]);if(c>kM){const p=i[0].scale*2**i[0].level;let _=Math.max((o[3]-o[1])/t.size[1],(o[2]-o[0])/t.size[0])*p/r;const x=Math.floor(Math.log(_)/Math.log(10));return _=Math.ceil(_/10**x)*10**x,new se("tilingscheme:too-many-root-tiles","Scale of level 0 of the tiling scheme (1:"+Math.floor(p).toLocaleString()+") is too large for the layer's extent. Suggested scale: 1:"+_.toLocaleString()+".",{level0Scale:p,suggestedLevel0Scale:_,requiredNumRootTiles:c,allowedNumRootTiles:kM})}return null}const RRt=Object.freeze(Object.defineProperty({__proto__:null,checkIfTileInfoSupportedForViewSR:ORt,isInsideExtent:ARt,tiltToExtentEdge:MRt},Symbol.toStringTag,{value:"Module"}));function IRt(){return!0}function $Rt(){return 0}function LRt(t,e){if(t==null)return wae();const i=t.lods.length-1,r=t.spatialReference,n=U2(r)||u1(r)||h1(r);if(r.isWebMercator){if(!Gu.makeWebMercatorAuxiliarySphere(i).compatibleWith(t))return new se("tilingscheme:incompatible-global-web-mercator","The tiling scheme is not compatible with the ArcGIS Online Web Mercator tiling scheme")}else{if(!n)return new se("tilingscheme:global-unsupported-spatial-reference","The tiling scheme spatial reference is not supported in global scenes");if(!Gu.makeGCSWithTileSize(t.spatialReference,t.size[0],i).compatibleWith(t))return t.spatialReference.isWGS84?new se("tilingscheme:incompatible-global-wgs84","The tiling scheme is not compatible with the ArcGIS Online WGS84 tiling scheme"):new se("tilingscheme:incompatible-global","The tiling scheme is not compatible with the ArcGIS Online tiling scheme")}return e==null||t.spatialReference.equals(e)?void 0:new se("tilingscheme:spatial-reference-mismatch","The tiling scheme does not match the spatial reference of the global scene")}const DRt=Object.freeze(Object.defineProperty({__proto__:null,checkIfTileInfoSupportedForViewSR:LRt,isInsideExtent:IRt,tiltToExtentEdge:$Rt},Symbol.toStringTag,{value:"Module"})),NRt={[_t.Global]:DRt,[_t.Local]:RRt};function ly(t,e){t||console.warn("Terrain: "+e)}let fa=!1,aV=!1;function FRt(t){aV=t,fa=fa||t}function kRt(t){fa=t}function at(t,e){var i;if(fa&&!t){const r=(i=new Error().stack)==null?void 0:i.slice(5);throw console.warn("Terrain internal: "+(e??"")+" at "+r),new Error("Assertion failed"+(e?": "+e:""))}}function zie(t){return IG(t)?{fullExtent:t.fullExtent,minScale:t.layer.minScale,maxScale:t.layer.maxScale,tilemapCache:null}:t.layer}function lV(t){return(t==null?void 0:t.type)==="imagery-tile"||(t==null?void 0:t.type)==="wcs"}function IG(t){return(t==null?void 0:t.type)==="imagery-tile-3d"}function Dce(t){return(t==null?void 0:t.type)==="tile-3d"}function jP(t){return(t==null?void 0:t.type)==="vector-tile-3d"}function q7e(t){return(t==null?void 0:t.type)==="wmts-3d"}function Uie(t){return(t==null?void 0:t.type)==="elevation-3d"}function VR(t){return(t==null?void 0:t.type)==="group"}function s9(t){return t&&(Dce(t)||q7e(t)||IG(t)||jP(t))}function Vie(t){return t&&(Dce(t)||IG(t)||jP(t)||q7e(t))}function o9(t){return Vie(t)||Uie(t)}function zRt(t){var i;const e=(i=t==null?void 0:t.sourceLayerInfo)==null?void 0:i.data;return e!=null&&"type"in e&&e.type==="raster-tile"}function URt(t){return W7e(t==null?void 0:t.sourceLayerInfo)||!!(t!=null&&t.isVTLBackground)}function VRt(t){var i;const e=(i=t==null?void 0:t.sourceLayerInfo)==null?void 0:i.data;return e!=null&&"type"in e&&e.type==="tile-texture"}function BRt(t){var i;const e=(i=t==null?void 0:t.sourceLayerInfo)==null?void 0:i.data;return e instanceof HTMLImageElement||e instanceof Lce||e instanceof HTMLCanvasElement||e instanceof ImageData}function W7e(t){return(t==null?void 0:t.data)!=null&&"type"in t.data&&t.data.type==="vector-tile"}function $O(t){return t!=null&&"release"in t&&t.release(),null}function l_e(t){return t.fetchTile&&t.hasOverriddenFetchTile!==!1}function a9(t,e,i,r){return NRt[r].checkIfTileInfoSupportedForViewSR(t,i,e)}function $G(t,e,i){let r=null,n=null;if((t==null?void 0:t.type)==="wmts"){const s=Y7e(t,e,i);r=s.tileInfo,n=s.fullExtent}else{n=lV(t)?t.getCompatibleFullExtent(e):t.fullExtent;const s=i===_t.Local;if(lV(t))r=t.getCompatibleTileInfo(e,n,s);else if((t==null?void 0:t.type)==="vector-tile"){const o=s&&!jRt(e)||GRt.force512VTL,a=t.tileInfo.spatialReference.isGeographic;r=o?t.tileInfo:t.tileInfo.getOrCreateCompatible(256,a?1:2)}else r=t.tileInfo}return r!=null&&n!=null&&a9(r,n,e,i)==null?{tileInfo:r,fullExtent:n}:null}function Y7e(t,e,i){const r=Cit(t);if(r!=null){if(!tt.isCollection(r))return{tileInfo:r.tileInfo,fullExtent:r.fullExtent};{const n=r.find(s=>a9(s.tileInfo,s.fullExtent,e,i)==null);if(n)return{tileInfo:n.tileInfo,fullExtent:n.fullExtent}}}return{tileInfo:null,fullExtent:null}}function jRt(t){return t.isWGS84||t.isWebMercator||eEe(t)||!XO(t)}const GRt={force512VTL:!1};function c_e(t){return"["+t[0]+","+t[1]+","+t[2]+"]"}function F1(t){return"("+t[0]+","+t[1]+","+t[2]+")"}function Ef(t,e,i=WRt){return Math.abs(t-e){(TRt(p)||o9(p))&&this.layerPerformanceInfos.push(new YRt(p,e))}),this.layerPerformanceInfos.sort((p,_)=>_.memory-p.memory)}},ZRt=class{constructor(e){this._gltfLoading=new Map,this._wosrLoading=new Map,this._gltfMemCache=e("gltf-resources",()=>{}),this._wosrMemCache=e("wosr-resources",()=>{})}destroy(){this._gltfLoading.forEach(e=>e.abortController.abort()),this._wosrLoading.forEach(e=>e.abortController.abort()),this._gltfMemCache.destroy(),this._wosrMemCache.destroy()}loadGLTF(e,i,r){const n=r?`gltfPBR:${e}`:`gltf:${e}`,s=this._gltfMemCache.get(n);return s!=null?Promise.resolve(s):this._loadOnce(this._gltfLoading,this._gltfMemCache,n,o=>q8e(new G8e(o.streamDataRequester),e,o,r),i)}loadWOSR(e,i){const r=`wosr:${e}:${i.disableTextures}`,n=this._wosrMemCache.get(r);return n!=null?Promise.resolve(n):this._loadOnce(this._wosrLoading,this._wosrMemCache,r,s=>W8e(e,s),i)}async _loadOnce(e,i,r,n,s){St(s);const o=Zl(s,()=>this._abortLoad(e,r));let a=e.get(r);if(a)a.refCount++;else{const c=new AbortController;a={refCount:1,abortController:c,promise:n({...s,signal:c.signal})},e.set(r,a)}try{const c=await a.promise;return i.put(r,c,c.size),e.delete(r),St(s),c}finally{en(o)}}_abortLoad(e,i){const r=e.get(i);r!=null&&--r.refCount>0||(e.delete(i),r!=null&&r.abortController.abort())}},XM=class extends ze{constructor(e,i){super({}),this._stage=e,this._textureRequests=new Map,this._frameTask=(i==null?void 0:i.registerTask(ni.TEXTURE_UNLOAD))??EP}normalizeCtorArgs(){return{}}destroy(){var e,i,r;super.destroy(),(e=this._frameTask)==null||e.remove(),(i=this._textureRequests)==null||i.forEach(n=>this._releaseTextureRequest(n)),(r=this._textureRequests)==null||r.clear()}get updating(){return this._frameTask.updating}fromData(e,i){const r=this.makeUid(e);let n=this._textureRequests.get(r);if(!n){const s=new X7e;s.texture=i(),this._stage&&(s.texture.load(this._stage.renderView.renderingContext),this._stage.add(s.texture)),this._textureRequests.set(r,s),n=s}return n.referenceCount++,{uid:r,texture:n.texture,release:()=>this._release(r)}}_release(e){const i=this._textureRequests.get(e);i?(i.referenceCount<1&&console.warn("TextureCollection: reference count is < 1 for "+e),i.referenceCount--,i.referenceCount<1&&this._frameTask.schedule(()=>this._releaseNow(e))):console.warn(`TextureCollection: texture doesn't exist: '${e}'`)}get test(){return{textureRequests:this._textureRequests}}_releaseNow(e){var r;if(!this._textureRequests)return;const i=this._textureRequests.get(e);!i||i.referenceCount>0||((r=i.texture)==null||r.unload(),this._releaseTextureRequest(i),this._textureRequests.delete(e))}_releaseTextureRequest(e){var i;e.texture?(i=this._stage)==null||i.remove(e.texture):e.abortController&&(e.abortController.abort(),e.abortController=null)}makeUid(e,i=null){return i!=null?`${e}.${i}px`:e}};y([w()],XM.prototype,"_frameTask",void 0),y([w()],XM.prototype,"updating",null),XM=y([Z("esri.views.3d.support.TextureCollection")],XM);let X7e=class{constructor(){this.referenceCount=0}},JRt=class extends XM{constructor(e,i,r){super(i,r),this._streamDataRequester=e}async fromUrl(e,i,r){St(r);const n=r!=null?r.signal:null,s=this.makeUid(e,i);let o=this._textureRequests.get(s);if(!o){const a=new AbortController,c=this._streamDataRequester.request(e,"image",{uid:s,signal:a.signal});o=new X7e,o.abortController=a;const p=o;this._textureRequests.set(s,o),o.textureAsync=c.then(async _=>{const x=this._createTexture(e,_,i);return p.texture=x,p.abortController=null,await x.load(this._stage.renderView.renderingContext),this._stage.add(x),{uid:s,texture:x,release:()=>this._release(s)}},_=>{throw p.abortController=null,_})}o.referenceCount++;try{return await dT(o.textureAsync,n)}catch(a){throw this._release(s),a}}_createTexture(e,i,r){var s;const n={width:i.width,height:i.height,wrap:{s:Bi.CLAMP_TO_EDGE,t:Bi.CLAMP_TO_EDGE},preMultiplyAlpha:!0,reloadable:!0};if(zTe(e)){if(r||i.width===0&&i.height===0){const o=i.width?i.height/i.width:1;r=r||64,o>1?(i.width=Math.round(r/o),i.height=r):(i.width=r,i.height=Math.round(r*o))}(s=this._stage.renderView)!=null&&s.renderingContext.driverTest.svgPremultipliesAlpha.result&&(n.preMultiplyAlpha=!1)}return new DE(i,n)}},KRt=class{constructor(e){this.streamDataRequester=null,this._graphicsOwners=[],this._screenSizePerspectiveHandles=null,this.cimSymbolRasterizer=null,this._viewState=e.viewState,this._view=e.view,this._pointsOfInterest=e.pointsOfInterest,this.streamDataRequester=e.resourceController.createStreamDataRequester(yy.SYMBOLOGY),this.objectResourceCache=new ZRt((r,n)=>e.resourceController.memoryController.newCache(r,n)),this.textures=new JRt(this.streamDataRequester,e.view._stage,e.resourceController.scheduler);const i=Tr(this._view.spatialReference).radius;this.screenSizePerspectiveSettings=A9e(e.viewingMode,i),this.screenSizePerspectiveSettingsLabels=_wt(e.viewingMode,i)}destroy(){this.textures.destroy(),this.streamDataRequester=null}addGraphicsOwner(e){if(!e)return rr();this._graphicsOwners.push(e);const i=_e(()=>{var r;return(r=e.layer)==null?void 0:r.screenSizePerspectiveEnabled},()=>this._updateScreenSizePerspectiveEnabled());return this._updateScreenSizePerspectiveEnabled(),rr(()=>{i.remove(),uL(this._graphicsOwners,e),this._updateScreenSizePerspectiveEnabled()})}_updateScreenSizePerspectiveEnabled(){const e=this._graphicsOwners.some(i=>{var r;return((r=i.layer)==null?void 0:r.screenSizePerspectiveEnabled)===!0});if(e&&!this._screenSizePerspectiveHandles){this._screenSizePerspectiveHandles=new N_;const i=()=>this._updateScreenSizePerspectiveSettings();this._screenSizePerspectiveHandles.add([_e(()=>this._pointsOfInterest.centerOnSurfaceInfrequent.distance,i,Li),this._viewState.events.on("camera-projection-changed",i)]),this._updateScreenSizePerspectiveSettings()}else e||(this._screenSizePerspectiveHandles=et(this._screenSizePerspectiveHandles))}_updateScreenSizePerspectiveSettings(){const e=this._pointsOfInterest;y8.distance=e.centerOnSurfaceInfrequent.distance,y8.fovY=this._viewState.camera.fovY,this.screenSizePerspectiveSettings.update(y8),this.screenSizePerspectiveSettingsLabels.update(y8),this._view._stage.renderView.requestRender()}get test(){return{screenSizePerspectiveHandles:this._screenSizePerspectiveHandles}}};const y8={distance:0,fovY:0};let eM=class{constructor(e,i,r=""){this.graphics=e,this._symbol=new o2({symbolLayers:new tt([new s2({material:{color:i},outline:{color:[255,255,255],size:1},resource:{primitive:"circle"}}),new bE({text:r,halo:{color:"white",size:1/.75},material:{color:i},size:12})])})}show(e,i){if(i==null)return;this.hide();const r=new mt({x:e[0],y:e[1],z:e[2],spatialReference:i});this._graphic=new Ma({geometry:r,symbol:this._symbol}),this.graphics.add(this._graphic)}hide(){this._graphic!=null&&(this.graphics.remove(this._graphic),this._graphic=null)}},Qw=class extends ze{constructor(e){super(e)}};y([w({constructOnly:!0})],Qw.prototype,"renderCoordsHelper",void 0),y([w({constructOnly:!0})],Qw.prototype,"surface",void 0),y([w({constructOnly:!0})],Qw.prototype,"state",void 0),Qw=y([Z("esri.views.3d.support.PointOfInterest")],Qw);const QRt=Array;let G0=class extends Qw{constructor(e){super(e),this._dirty=!1,this._propertiesPool=new O_({location:mt,renderLocation:QRt},this),this._estimatedSurfaceAltitude=0,this._pendingElevationQueryController=null,this.renderLocation=W(),this._tmpPoint=new mt}initialize(){if(this.scheduler&&this.addHandles(this.scheduler.registerTask(this.task,this)),this.runTask(),this.map){const e=()=>this._setDirty();this.addHandles(Jr(()=>{var i,r;return(r=(i=this.map)==null?void 0:i.ground)==null?void 0:r.layers},"change",e,{onListenerAdd:e,onListenerRemove:e}))}this._updateRenderLocation()}destroy(){this._cancelPendingRequest(),this._propertiesPool=et(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const e=this._propertiesPool.get("location");return this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e,this.state.spatialReference),e}get scale(){const e=this._camera,i=Tn(e.eye,this.renderLocation),r={renderCoordsHelper:this.renderCoordsHelper,state:{camera:e}};return JT(r,i,0)}get updating(){return this._dirty||this._pendingElevationQueryController!=null}updateRenderLocation(){this._setDirty(),this._updateRenderLocation()}_setDirty(){this._dirty||(this._dirty=!0,this.notifyChange("updating"))}_cancelPendingRequest(){const e=this._pendingElevationQueryController;e&&(this._pendingElevationQueryController=null,e.abort(),this.notifyChange("updating"))}get running(){return!this._pendingElevationQueryController&&this._dirty}runTask(){var n;if(this._cancelPendingRequest(),this._dirty=!1,this.notifyChange("updating"),!((n=this.map)!=null&&n.ground))return this._updateSurfaceAltitude(0),Jl.YIELD;const e=this.state.spatialReference;this.renderCoordsHelper.fromRenderCoords(this._camera.eye,this._tmpPoint,e);const i=(this._tmpPoint.z??0)>eIt&&this.renderCoordsHelper.viewingMode===_t.Global&&(e.isWGS84||e.isWebMercator);let r=new AbortController;return this.map.ground.queryElevation(this._tmpPoint,{signal:r.signal,cache:this.cache,minDemResolution:i?tIt:0}).then(s=>this._updateSurfaceAltitude(s.geometry.z??0)).catch(s=>{on(s)||this._updateSurfaceAltitude(0)}).catch(()=>{}).then(()=>{this._pendingElevationQueryController===r&&(this._pendingElevationQueryController=null,this.notifyChange("updating")),r=null}),this._pendingElevationQueryController=r,Jl.YIELD}_updateSurfaceAltitude(e){this._estimatedSurfaceAltitude!==e&&(this._estimatedSurfaceAltitude=e,this._updateRenderLocation())}_updateRenderLocation(){this.renderCoordsHelper.setAltitude(TY,this._estimatedSurfaceAltitude,this._camera.eye),jr(this._get("renderLocation"),TY)||(this._set("renderLocation",Ne(this._propertiesPool.get("renderLocation"),TY)),this.notifyChange("renderLocation"))}};y([w({constructOnly:!0})],G0.prototype,"scheduler",void 0),y([w({constructOnly:!0})],G0.prototype,"cache",void 0),y([w({constructOnly:!0})],G0.prototype,"task",void 0),y([w({readOnly:!0})],G0.prototype,"location",null),y([w({constructOnly:!0})],G0.prototype,"map",void 0),y([w({readOnly:!0})],G0.prototype,"renderLocation",void 0),y([w({readOnly:!0})],G0.prototype,"scale",null),y([w({readOnly:!0})],G0.prototype,"updating",null),G0=y([Z("esri.views.3d.support.CameraOnSurface")],G0);const TY=W(),eIt=1e5,tIt=1e6,iIt=Array;let df=class extends Qw{constructor(e){super(e),this._propertiesPool=new O_({location:mt,renderLocation:iIt},this),this._currentSurfaceAltitude=0,this._latestSurfaceAltitude=0,this.distance=0,this.renderLocation=W(),this.updating=!1}initialize(){this._frameWorker=this.scheduler.registerTask(this.task,this),this.runTask()}destroy(){this._frameWorker=en(this._frameWorker),this._propertiesPool=et(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const e=this._propertiesPool.get("location");return this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e,this.state.spatialReference),e}updateRenderLocation(){this.updating=!0,this._updateRenderLocation()}get estimatedSurfaceAltitude(){return this._latestSurfaceAltitude}get running(){return this.updating}runTask(){return this._latestSurfaceAltitude=this.estimateSurfaceAltitudeAtCenter(),this._updateRenderLocation(),this.updating=!1,Jl.YIELD}_updateRenderLocation(){const e=nIt;let i=this._calculateSurfaceIntersection(this._currentSurfaceAltitude,e);const r=this._currentSurfaceAltitude!==this._latestSurfaceAltitude;!i&&r&&(i=this._calculateSurfaceIntersection(this._latestSurfaceAltitude,e),i&&(this._currentSurfaceAltitude=this._latestSurfaceAltitude));const n=sIt;i&&this._latestSurfaceAltitudeChangesDistanceSignificantly(e,n)&&(Ne(e,n),this._currentSurfaceAltitude=this._latestSurfaceAltitude),i?this.distance=Tn(this._camera.eye,e):(De(e,this._camera.viewForward,this._get("distance")),Be(e,e,this._camera.eye)),jr(this._get("renderLocation"),e)||this._set("renderLocation",Ne(this._propertiesPool.get("renderLocation"),e))}_calculateSurfaceIntersection(e,i){var n,s;const r=this._camera;if(!this.renderCoordsHelper.intersectInfiniteManifold(r.ray,e,i))return!1;if(this.state.isGlobal){const o=Tr(this.renderCoordsHelper.spatialReference).radius,a=o+e,c=Al(r.eye),p=co/4){const x=a-Math.sqrt(c);return De(i,r.viewForward,x),Be(i,i,r.eye),!0}}else{const o=(n=this.surface)!=null&&n.ready?this.surface.extent:null;o!=null&&wj(o,(s=this.surface)==null?void 0:s.spatialReference,BR,this.renderCoordsHelper.spatialReference)&&(i[0]=Je(i[0],BR[0],BR[2]),i[1]=Je(i[1],BR[1],BR[3]))}return!0}_latestSurfaceAltitudeChangesDistanceSignificantly(e,i){if(this._latestSurfaceAltitude===this._currentSurfaceAltitude||e==null)return!1;if(this._calculateSurfaceIntersection(this._latestSurfaceAltitude,i)){if(En.TESTS_DISABLE_OPTIMIZATIONS)return!0;const r=this._camera.eye,n=Tn(r,e),s=Tn(r,i);if(Math.abs(s-n)/n>rIt)return!0}return!1}};y([w({constructOnly:!0})],df.prototype,"scheduler",void 0),y([w({constructOnly:!0})],df.prototype,"task",void 0),y([w()],df.prototype,"distance",void 0),y([w({constructOnly:!0})],df.prototype,"estimateSurfaceAltitudeAtCenter",void 0),y([w({readOnly:!0})],df.prototype,"location",null),y([w({readOnly:!0})],df.prototype,"renderLocation",void 0),y([w()],df.prototype,"updating",void 0),df=y([Z("esri.views.3d.support.CenterOnSurface")],df);const rIt=.05,nIt=W(),sIt=W(),BR=Ni();let oIt=class{constructor(e){this._handles=new N_,this.events=new Dn,this._contentLayerViews=e.contentLayerViews,this._handles.add(this._contentLayerViews.on("change",i=>this._layerViewsChanged(i))),this._layerViewsChanged({added:this._contentLayerViews.toArray(),removed:[],moved:[],target:this._contentLayerViews})}destroy(){this._handles=et(this._handles),this._contentLayerViews.destroy()}_layerViewsChanged(e){e.added.forEach(i=>{i.declaredClass==="esri.views.3d.layers.SceneLayerView3D"&&this._handles.add(i.on("visible-geometry-changed",()=>this._contentChanged()),i.uid)}),e.removed.forEach(i=>this._handles.remove(i.uid))}_contentChanged(){this.events.emit("request-update",aIt)}};const aIt={},lIt=Array;let Ug=class extends Qw{constructor(e){super(e),this._propertiesPool=new O_({location:mt,renderLocation:lIt},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get("renderLocation")}initialize(){this.addHandles([_e(()=>this.centerOnSurface.renderLocation,()=>this.updateRenderLocation()),_e(()=>this.state.contentCamera,()=>this.updateRenderLocation())]),this.scheduler&&this.addHandles(this.scheduler.registerTask(ni.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool=et(this._propertiesPool)}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){const e=this._propertiesPool.get("location");return this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e,this.state.spatialReference),e}get running(){return this._dirty}runTask(){const e=this._get("renderLocation"),i=this.centerOnSurface.renderLocation,r=this.renderCoordsHelper,n=this.state.contentCamera;this._dirty=!1,r.worldUpAtPosition(i,f_e);const s=Math.max(0,(Math.acos(Ve(f_e,n.viewForward))-.5*Math.PI)*(n.aboveGround?1:-1));if(Number.isNaN(s)){if(!e||!L2(e,i)){const p=this._propertiesPool.get("renderLocation");Ne(p,i),this._set("renderLocation",p)}return Jl.YIELD}const o=1-Je(s/(.5*Math.PI),0,1),a=o*o*o;this._calculateScreenHorizontalEdgeOnSurface(m_e);const c=this._propertiesPool.get("renderLocation");return Qr(c,i,m_e,a),e&&L2(e,c)||this._set("renderLocation",c),Jl.YIELD}_calculateScreenHorizontalEdgeOnSurface(e){const i=this.state.contentCamera,r=i.getRenderCenter(Ka());if(r[1]=i.aboveGround?i.padding[er.BOTTOM]:i.fullHeight-i.padding[er.TOP],this.estimateSurfaceIntersectionAtRenderPoint(r,e))return e;const n=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(i.unprojectFromRenderScreen(r,jR)){je(jR,jR,i.eye);const s=Ye(jR,jR);if(this.renderCoordsHelper.intersectInfiniteManifold(Ap(i.eye,s),n,e))return e}return this.renderCoordsHelper.setAltitude(e,n,i.eye)}updateRenderLocation(){this._dirty=!0}};y([w()],Ug.prototype,"_dirty",void 0),y([w({constructOnly:!0})],Ug.prototype,"scheduler",void 0),y([w({constructOnly:!0})],Ug.prototype,"centerOnSurface",void 0),y([w({constructOnly:!0})],Ug.prototype,"estimateSurfaceIntersectionAtRenderPoint",void 0),y([w({readOnly:!0})],Ug.prototype,"updating",null),y([w({readOnly:!0})],Ug.prototype,"location",null),y([w({readOnly:!0})],Ug.prototype,"renderLocation",void 0),Ug=y([Z("esri.views.3d.support.pointsOfInterest.Focus")],Ug);const f_e=W(),jR=W(),m_e=W();let uv=class extends ze{get surface(){var e;return(e=this.view.map)==null?void 0:e.ground}get surfaceView(){return this.view.basemapTerrain}get renderLocation(){if(!this.location)return null;const e=W();return this.view.renderCoordsHelper.toRenderCoords(this.location,e),e}constructor(e){super(e),this.location=null,this._updateController=null}initialize(){this.view.state.isLocal&&(this.addHandles([_e(()=>{var e,i;return[(e=this.surfaceView)==null?void 0:e.spatialReference,(i=this.surfaceView)==null?void 0:i.extent]},()=>this._update()),Jr(()=>{var e;return(e=this.surface)==null?void 0:e.layers},"change",()=>this._update())]),this._update())}_update(){var r;if(this._updateController&&(this._updateController.abort(),this._updateController=null),((r=this.surfaceView)==null?void 0:r.extent)==null||this.surfaceView.spatialReference==null)return void this._set("location",null);const e=rse(this.surfaceView.extent),i=new mt({x:e[0],y:e[1],z:0,spatialReference:this.surfaceView.spatialReference});this.surface&&this.surface.layers.length>0?(this._set("location",null),this._updateController=new AbortController,this.surface.queryElevation(i,{noDataValue:0,signal:this._updateController.signal,cache:this.cache}).then(n=>{this._updateController=null,this._set("location",n.geometry)}).catch(n=>{on(n)||n&&n.name==="elevation-query:invalid-layer"||console.error("StableSurfaceCenter failed to update: ",n)})):this._set("location",i)}};y([w({constructOnly:!0})],uv.prototype,"view",void 0),y([w({constructOnly:!0})],uv.prototype,"cache",void 0),y([w()],uv.prototype,"surface",null),y([w()],uv.prototype,"surfaceView",null),y([w({readOnly:!0})],uv.prototype,"location",void 0),y([w({readOnly:!0})],uv.prototype,"renderLocation",null),uv=y([Z("esri.views.3d.terrain.StableSurfaceCenter")],uv);let hv=class extends ze{constructor(e){super(e),this._tileGeometryUpdateExtent=ld(),this._tileGeometryUpdateSpatialReference=null,this.events=new Dn,this.updating=!1}initialize(){this.addHandles([this.surface.on("elevation-change",e=>this._tileGeometryChanged(e)),this.scheduler.registerTask(ni.SURFACE_GEOMETRY_UPDATES,this)])}get running(){return this.updating}runTask(){return this.updating&&(this._tileGeometryUpdateSpatialReference&&this._centerIntersectsExtent(this._tileGeometryUpdateExtent,this._tileGeometryUpdateSpatialReference)&&this.events.emit("request-update",cIt),ld(this._tileGeometryUpdateExtent),this._set("updating",!1)),Jl.YIELD}_tileGeometryChanged(e){this._tileGeometryUpdateSpatialReference=e.spatialReference,x2(this._tileGeometryUpdateExtent,e.extent,this._tileGeometryUpdateExtent),this._set("updating",!0)}_furthestCenterOnSurface(){let e=this.centerOnSurfaces[0];for(let i=1;ie.distance&&(e=r)}return e}_centerIntersectsExtent(e,i){const r=this.state.contentCamera.eye,n=uIt,s=this._furthestCenterOnSurface();return this.renderCoordsHelper.fromRenderCoords(r,e3,i),this.renderCoordsHelper.fromRenderCoords(s.renderLocation,t3,i),e3[0]this._estimateSurfaceAltitudeAtCenter(),o=this.view.resourceController.scheduler,a=(_=this.view.basemapTerrain)==null?void 0:_.elevationQueryCache,c={state:e,scheduler:o,surface:i,renderCoordsHelper:r};this._set("centerOnSurfaceInfrequent",new df({...c,task:ni.POINT_OF_INTEREST_INFREQUENT,estimateSurfaceAltitudeAtCenter:s})),this._set("centerOnSurfaceFrequent",new df({...c,task:ni.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:s})),this._set("centerOnContent",new df({...c,task:ni.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:()=>this._estimateContentAltitudeAtCenter()})),this._set("cameraOnSurface",new G0({...c,cache:a,task:ni.POINT_OF_INTEREST_INFREQUENT,map:n})),this._set("surfaceGeometryUpdates",new hv({...c,centerOnSurfaces:[this.centerOnSurfaceFrequent,this.centerOnContent,this.centerOnSurfaceInfrequent]})),this._set("contentGeometryUpdates",new oIt({contentLayerViews:this.view.allLayerViews,renderCoordsHelper:r})),this._set("surfaceOrigin",new uv({cache:a,view:this.view})),this._set("focus",new Ug({state:e,scheduler:o,surface:i,renderCoordsHelper:r,centerOnSurface:this.centerOnSurfaceFrequent,estimateSurfaceIntersectionAtRenderPoint:(x,S)=>this._estimateSurfaceIntersectionAtRenderPoint(x,this.view.state.contentCamera,S)})),this._pois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.cameraOnSurface,this.focus);const p=this.view.graphics;this._debugCenters.set(this.centerOnContent,new eM(p,"red","CenterOnContent")),this._debugCenters.set(this.centerOnSurfaceFrequent,new eM(p,"red","CenterOnSurface")),this._debugCenters.set(this.centerOnSurfaceInfrequent,new eM(p,"red","CenterOnSurface")),this._debugCenters.set(this.cameraOnSurface,new eM(p,"blue","CameraOnSurface")),this._debugCenters.set(this.focus,new eM(p,"green","Focus")),this._handles.add([_e(()=>e.contentCamera,x=>this._cameraChanged(x),Li),_e(()=>i.extent,()=>this._updateCenterPointsOfInterest()),Oo(()=>!i.updating,()=>this._updateCenterPointsOfInterest(),Li),Jr(()=>this.surfaceGeometryUpdates.events,"request-update",()=>this._updateCenterPointsOfInterest()),Jr(()=>this.contentGeometryUpdates.events,"request-update",()=>this._updateCenterOnContent()),Oo(()=>En.SHOW_POI,x=>this._setDebug(x),Qt)]),this._cameraChanged(this.view.state.contentCamera);for(const x of this._pois)x.runTask()}destroy(){this._setDebug(!1),this._handles.destroy(),this._propertiesPool.destroy();for(const e of this._pois)e.destroy();this.surfaceOrigin.destroy()}get updating(){var e;return!(!((e=this.surfaceGeometryUpdates)!=null&&e.updating)&&!this._pois.some(i=>i.updating))}get _centerRay(){return this._centerRayDirty&&(this._centerRayCached=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(this.view.state.contentCamera,this._tmpRay),this._centerRayDirty=!1),this._centerRayCached}_estimateContentAltitudeAtCenter(){if(!this._contentAltitudeAtCenterDirty)return this._contentAltitudeAtCenter;this._contentAltitudeAtCenterDirty=!1;const e=this._centerRay;return e==null||(this.view.sceneIntersectionHelper.intersectRay(e,this._contentIntersector,kC,pIt)?this._contentAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(kC):this._contentAltitudeAtCenter=this._estimateSurfaceAltitudeAtCenter()),this._contentAltitudeAtCenter}_estimateSurfaceAltitudeAtCenter(){if(!this.view.basemapTerrain)return 0;if(!this._surfaceAltitudeAtCenterDirty)return this._surfaceAltitudeAtCenter;this._surfaceAltitudeAtCenterDirty=!1;const e=this._centerRay;if(e==null)return this._surfaceAltitudeAtCenter;const i=e.origin,r=Be(kC,e.origin,e.direction);return this._surfaceIntersector.resetWithRay(e,this.view.state.contentCamera),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,i,r),this._surfaceIntersector.results.min.getIntersectionPoint(kC)&&(this._surfaceAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(kC)),this._surfaceAltitudeAtCenter}_estimateSurfaceIntersectionAtRenderPoint(e,i,r){const n=fle(i,e,dIt);if(n==null)return null;const s=n.origin,o=Be(kC,n.origin,n.direction);return this._surfaceIntersector.resetWithRay(n,i),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,s,o),this._surfaceIntersector.results.min.getIntersectionPoint(r)?r:null}_cameraChanged(e){this._updateCenterPointsOfInterest();const i=e.eye;jr(this.renderPointOfView,i)||this._set("renderPointOfView",Ne(this._propertiesPool.get("renderPointOfView"),i))}_updateCenterPointsOfInterest(){this._centerRayDirty=!0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenterDirty=!0;for(const e of this._pois)e.updateRenderLocation()}_updateCenterOnContent(){this._contentAltitudeAtCenterDirty=!0,this.centerOnContent.updateRenderLocation()}_setDebug(e){if(!e)return this._debugCenters.forEach(i=>i.hide()),void this._handles.remove("debug");for(const i of this._pois)this._handles.add(_e(()=>i.renderLocation,r=>{var n;return(n=this._debugCenters.get(i))==null?void 0:n.show(r,i.renderCoordsHelper.spatialReference)},Qt),"debug")}get test(){return{update:()=>{this.surfaceGeometryUpdates.runTask();for(const e of this._pois)e.runTask()},surfaceGeometryUpdates:this.surfaceGeometryUpdates}}};y([w({readOnly:!0})],ku.prototype,"centerOnContent",void 0),y([w({readOnly:!0})],ku.prototype,"centerOnSurfaceFrequent",void 0),y([w({readOnly:!0})],ku.prototype,"centerOnSurfaceInfrequent",void 0),y([w({readOnly:!0})],ku.prototype,"cameraOnSurface",void 0),y([w({readOnly:!0})],ku.prototype,"focus",void 0),y([w({readOnly:!0})],ku.prototype,"renderPointOfView",void 0),y([w({readOnly:!0})],ku.prototype,"surfaceOrigin",void 0),y([w({readOnly:!0})],ku.prototype,"contentGeometryUpdates",void 0),y([w({readOnly:!0})],ku.prototype,"surfaceGeometryUpdates",void 0),y([w({constructOnly:!0})],ku.prototype,"view",void 0),y([w({readOnly:!0})],ku.prototype,"updating",null),ku=y([Z("esri.views.3d.support.PointsOfInterest")],ku);const hIt=Array,kC=W(),dIt=Qo(),pIt={exclude:new Set([Zw])};let Z7e=class{constructor(e){this._store=e}destroy(){this._store.destroy()}get(e){return this._store.get(e)}put(e,i){this._store.put(e,i,i.values.byteLength+256)}},J7e=class{constructor(e,i,r,n){this._hasNoDataValues=null,this._minValue=null,this._maxValue=null,"pixelData"in e?(this.values=e.pixelData,this.width=e.width,this.height=e.height,this.noDataValue=e.noDataValue):(this.values=e,this.width=i,this.height=r,this.noDataValue=n)}get hasNoDataValues(){if(this._hasNoDataValues==null){const e=this.noDataValue;this._hasNoDataValues=this.values.includes(e)}return this._hasNoDataValues}get minValue(){return this._ensureBounds(),this._minValue}get maxValue(){return this._ensureBounds(),this._maxValue}_ensureBounds(){if(this._minValue!=null)return;const{noDataValue:e,values:i}=this;let r=1/0,n=-1/0,s=!0;for(const o of i)o===e?this._hasNoDataValues=!0:(r=on?o:n,s=!1);s?(this._minValue=0,this._maxValue=0):(this._minValue=r,this._maxValue=n>-3e38?n:0)}},K7e=class{constructor(e,i,r,n,s={}){this._mainMethod=i,this._transferLists=r,this._listeners=[],this._promise=idt(e,{...s,schedule:n}).then(o=>{if(this._thread===void 0){this._thread=o,this._promise=null,s.hasInitialize&&this.broadcast({},"initialize");for(const a of this._listeners)this._connectListener(a)}else o.close()}),this._promise.catch(o=>Ce.getLogger("esri.core.workers.WorkerHandle").error(`Failed to initialize ${e} worker: ${o}`))}on(e,i){const r={removed:!1,eventName:e,callback:i,threadHandle:null};return this._listeners.push(r),this._connectListener(r),rr(()=>{r.removed=!0,cne(this._listeners,r),this._thread&&r.threadHandle!=null&&r.threadHandle.remove()})}destroy(){this._thread&&(this._thread.close(),this._thread=null),this._promise=null,this._listeners.length=0,this._transferLists={}}invoke(e,i){return this.invokeMethod(this._mainMethod,e,i)}invokeMethod(e,i,r){if(this._thread){const n=this._transferLists[e],s=n?n(i):[];return this._thread.invoke(e,i,{transferList:s,signal:r})}return this._promise?this._promise.then(()=>(St(r),this.invokeMethod(e,i,r))):Promise.reject(null)}broadcast(e,i){return this._thread?Promise.all(this._thread.broadcast(i,e)).then(()=>{}):this._promise?this._promise.then(()=>this.broadcast(e,i)):Promise.reject()}get promise(){return this._promise}_connectListener(e){this._thread&&this._thread.on(e.eventName,e.callback).then(i=>{e.removed||(e.threadHandle=i)})}},g_e=class extends K7e{constructor(e=null){super("LercWorker","_decode",{_decode:i=>[i.buffer]},e,{strategy:"dedicated"}),this.schedule=e,this.ref=0}decode(e,i,r){return e&&e.byteLength!==0?this.invoke({buffer:e,options:i},r):Promise.resolve(null)}release(){--this.ref<=0&&(q$.forEach((e,i)=>{e===this&&q$.delete(i)}),this.destroy())}};const q$=new Map;function Q7e(t=null){let e=q$.get(t);return e||(t!=null?(e=new g_e(i=>t.immediate.schedule(i)),q$.set(t,e)):(e=new g_e,q$.set(null,e))),++e.ref,e}var Bh,y_e,v_e;(function(t){t[t.FILL=1]="FILL",t[t.LINE=2]="LINE",t[t.SYMBOL=3]="SYMBOL",t[t.CIRCLE=4]="CIRCLE"})(Bh||(Bh={})),function(t){t[t.BACKGROUND=0]="BACKGROUND",t[t.FILL=1]="FILL",t[t.OUTLINE=2]="OUTLINE",t[t.LINE=3]="LINE",t[t.ICON=4]="ICON",t[t.CIRCLE=5]="CIRCLE",t[t.TEXT=6]="TEXT",t[t.TILEINFO=7]="TILEINFO"}(y_e||(y_e={})),function(t){t[t.PAINTER_CHANGED=0]="PAINTER_CHANGED",t[t.LAYOUT_CHANGED=1]="LAYOUT_CHANGED",t[t.LAYER_CHANGED=2]="LAYER_CHANGED",t[t.LAYER_REMOVED=3]="LAYER_REMOVED",t[t.SPRITES_CHANGED=4]="SPRITES_CHANGED"}(v_e||(v_e={}));let fIt=class{constructor(e){this.xTile=0,this.yTile=0,this.hash=0,this.priority=1,this.colliders=[],this.textVertexRanges=[],this.iconVertexRanges=[],this.tile=e}},rpi=class{constructor(){this.tileSymbols=[],this.parts=[{startTime:0,startOpacity:0,targetOpacity:0,show:!1},{startTime:0,startOpacity:0,targetOpacity:0,show:!1}],this.show=!1}};function spi(t,e,i,r,n,s){const o=i-n;if(o>=0)return(e>>o)+(r-(s<>o);const a=-o;return e-(s-(r<>a)<0){this.patternMap=new Map;for(let o=0;o0}triangleCount(){return this.lineIndexCount/3}doDestroy(){this.vao=Kt(this.vao)}doPrepareForRendering(e,i,r){const n=new Uint32Array(i),s=new Int32Array(n.buffer),o=n[r++],a=Yr.createVertex(e,Rr.STATIC_DRAW,new Int32Array(s.buffer,4*r,o));r+=o;const c=n[r++],p=Yr.createIndex(e,Rr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,c));r+=c;const _=this.layer.lineMaterial;this.vao=new r0(e,_.getAttributeLocations(),_.getLayoutInfo(),{geometry:a},p)}},vIt=class extends LG{constructor(e,i){super(e,i),this.type=Bh.FILL,this.fillIndexStart=0,this.fillIndexCount=0,this.outlineIndexStart=0,this.outlineIndexCount=0;const r=new Uint32Array(e);let n=this.bufferDataOffset;this.fillIndexStart=r[n++],this.fillIndexCount=r[n++],this.outlineIndexStart=r[n++],this.outlineIndexCount=r[n++];const s=r[n++];if(s>0){this.patternMap=new Map;for(let o=0;o0||this.outlineIndexCount>0}triangleCount(){return(this.fillIndexCount+this.outlineIndexCount)/3}doDestroy(){this.fillVAO=Kt(this.fillVAO),this.outlineVAO=Kt(this.outlineVAO)}doPrepareForRendering(e,i,r){const n=new Uint32Array(i),s=new Int32Array(n.buffer),o=n[r++],a=Yr.createVertex(e,Rr.STATIC_DRAW,new Int32Array(s.buffer,4*r,o));r+=o;const c=n[r++],p=Yr.createIndex(e,Rr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,c));r+=c;const _=n[r++],x=Yr.createVertex(e,Rr.STATIC_DRAW,new Int32Array(s.buffer,4*r,_));r+=_;const S=n[r++],C=Yr.createIndex(e,Rr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,S));r+=S;const M=this.layer,P=M.fillMaterial,$=M.outlineMaterial;this.fillVAO=new r0(e,P.getAttributeLocations(),P.getLayoutInfo(),{geometry:a},p),this.outlineVAO=new r0(e,$.getAttributeLocations(),$.getLayoutInfo(),{geometry:x},C)}},_It=class extends LG{constructor(e,i,r){super(e,i),this.type=Bh.SYMBOL,this.iconPerPageElementsMap=new Map,this.glyphPerPageElementsMap=new Map,this.symbolInstances=[],this.isIconSDF=!1,this.opacityChanged=!1,this.lastOpacityUpdate=0,this.symbols=[];const n=new Uint32Array(e),s=new Int32Array(e),o=new Float32Array(e);let a=this.bufferDataOffset;this.isIconSDF=!!n[a++];const c=n[a++];for(let S=0;S0||this.glyphPerPageElementsMap.size>0}triangleCount(){let e=0;for(const[i,r]of this.iconPerPageElementsMap)e+=r[1];for(const[i,r]of this.glyphPerPageElementsMap)e+=r[1];return e/3}doDestroy(){this.iconVAO=Kt(this.iconVAO),this.textVAO=Kt(this.textVAO)}updateOpacityInfo(){if(!this.opacityChanged)return;this.opacityChanged=!1;const e=this.iconOpacity,i=this.iconVAO.vertexBuffers.opacity;e.length>0&&e.byteLength===i.byteLength&&i.setSubData(e,0,0,e.length);const r=this.textOpacity,n=this.textVAO.vertexBuffers.opacity;r.length>0&&r.byteLength===n.byteLength&&n.setSubData(r,0,0,r.length)}doPrepareForRendering(e,i,r){const n=new Uint32Array(i),s=new Int32Array(n.buffer),o=n[r++],a=Yr.createVertex(e,Rr.STATIC_DRAW,new Int32Array(s.buffer,4*r,o));r+=o;const c=n[r++],p=Yr.createIndex(e,Rr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,c));r+=c;const _=n[r++],x=Yr.createVertex(e,Rr.STATIC_DRAW,new Int32Array(s.buffer,4*r,_));r+=_;const S=n[r++],C=Yr.createIndex(e,Rr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,S));r+=S;const M=Yr.createVertex(e,Rr.STATIC_DRAW,this.iconOpacity.buffer),P=Yr.createVertex(e,Rr.STATIC_DRAW,this.textOpacity.buffer),$=this.layer,F=$.iconMaterial,z=$.textMaterial;this.iconVAO=new r0(e,F.getAttributeLocations(),F.getLayoutInfo(),{geometry:a,opacity:M},p),this.textVAO=new r0(e,z.getAttributeLocations(),z.getLayoutInfo(),{geometry:x,opacity:P},C)}},bIt=class extends LG{constructor(e,i){super(e,i),this.type=Bh.CIRCLE,this.circleIndexStart=0,this.circleIndexCount=0;const r=new Uint32Array(e);let n=this.bufferDataOffset;this.circleIndexStart=r[n++],this.circleIndexCount=r[n++],this.bufferDataOffset=n}get memoryUsed(){var e,i;return(((e=this.data)==null?void 0:e.byteLength)??0)+(((i=this.vao)==null?void 0:i.usedMemory)??0)}hasData(){return this.circleIndexCount>0}triangleCount(){return this.circleIndexCount/3}doDestroy(){this.vao=Kt(this.vao)}doPrepareForRendering(e,i,r){const n=new Uint32Array(i),s=new Int32Array(n.buffer),o=n[r++],a=Yr.createVertex(e,Rr.STATIC_DRAW,new Int32Array(s.buffer,4*r,o));r+=o;const c=n[r++],p=Yr.createIndex(e,Rr.STATIC_DRAW,new Uint32Array(n.buffer,4*r,c));r+=c;const _=this.layer.circleMaterial;this.vao=new r0(e,_.getAttributeLocations(),_.getLayoutInfo(),{geometry:a},p)}};const fpi=!0,mpi=32,__e=200,wIt=1/$e("mapview-transitions-duration");let xIt=class extends Dn{constructor(){super(...arguments),this._fadeOutResolver=null,this._fadeInResolver=null,this._clips=null,this.computedVisible=!0,this.computedOpacity=1,this.fadeTransitionEnabled=!1,this.inFadeTransition=!1,this._isReady=!1,this._opacity=1,this.parent=null,this._stage=null,this._visible=!0}get clips(){return this._clips}set clips(e){this._clips=e,this.requestRender()}get isReady(){return this._isReady}get opacity(){return this._opacity}set opacity(e){this._opacity!==e&&(this._opacity=Math.min(1,Math.max(e,0)),this.requestRender())}get stage(){return this._stage}set stage(e){var r;if(this._stage===e)return;const i=this._stage;this._stage=e,e?(r=this._stage)!=null&&r.untrashDisplayObject(this)||(this.onAttach(),this.emit("attach")):i==null||i.trashDisplayObject(this)}get transforms(){return this._getTransforms()}_getTransforms(){return this._transforms==null&&(this._transforms=this._createTransforms()),this._transforms}get visible(){return this._visible}set visible(e){this._visible!==e&&(this._visible=e,this.requestRender())}get hasLabels(){return!1}get hasHighlight(){return!1}get hasBlending(){return!1}fadeIn(){return this._fadeInResolver||(this._fadeOutResolver&&(this._fadeOutResolver(),this._fadeOutResolver=null),this.opacity=1,this.computedOpacity=0,this.fadeTransitionEnabled=!0,this._fadeInResolver=ec(),this.requestRender()),this._fadeInResolver.promise}fadeOut(){return this._fadeOutResolver||(this.opacity=0,this._fadeInResolver&&(this._fadeInResolver(),this._fadeInResolver=null),this.fadeTransitionEnabled=!0,this._fadeOutResolver=ec(),this.requestRender()),this._fadeOutResolver.promise}endTransitions(){var e,i;(e=this._fadeInResolver)==null||e.call(this),this._fadeInResolver=null,(i=this._fadeOutResolver)==null||i.call(this),this._fadeOutResolver=null,this.computedOpacity=this.visible?this.opacity:0,this.requestRender()}beforeRender(e){this.updateTransitionProperties(e.deltaTime,e.state.scale),this.setTransform(e.state)}afterRender(e){this._fadeInResolver&&this.computedOpacity===this.opacity?(this._fadeInResolver(),this._fadeInResolver=null):this._fadeOutResolver&&this.computedOpacity===0&&(this._fadeOutResolver(),this._fadeOutResolver=null)}remove(){var e;(e=this.parent)==null||e.removeChild(this)}setTransform(e){}processRender(e){this.stage&&this.computedVisible&&this.doRender(e)}requestRender(){this.stage&&this.stage.requestRender()}processDetach(){this._fadeInResolver&&(this._fadeInResolver(),this._fadeInResolver=null),this._fadeOutResolver&&(this._fadeOutResolver(),this._fadeOutResolver=null),this.onDetach(),this.emit("detach")}updateTransitionProperties(e,i){if(this.fadeTransitionEnabled){const r=this._fadeOutResolver||!this.visible?0:this.opacity,n=this.computedOpacity;if(n===r)this.computedVisible=this.visible;else{const s=e*wIt;this.computedOpacity=n>r?Math.max(r,n-s):Math.min(r,n+s),this.computedVisible=this.computedOpacity>0;const o=r===this.computedOpacity;this.inFadeTransition=!o,o||this.requestRender()}}else this.computedOpacity=this.opacity,this.computedVisible=this.visible}onAttach(){}onDetach(){}doRender(e){}ready(){this._isReady||(this._isReady=!0,this.emit("isReady"),this.requestRender())}},oE=class lS{static getId(e,i,r,n){return typeof e=="object"?`${e.level}/${e.row}/${e.col}/${e.world}`:`${e}/${i}/${r}/${n}`}constructor(e,i,r,n){this.set(e,i,r,n)}get key(){return this}get id(){return this.toString()}set id(e){this.set(e)}get hash(){const e=4095&this.row,i=4095&this.col,r=63&this.level;return(3&this.world)<<30|i<<22|e<<8|r}acquire(e,i,r,n){this.set(e,i,r,n)}contains(e){const i=e.level-this.level;return i>=0&&this.row===e.row>>i&&this.col===e.col>>i&&this.world===e.world}equals(e){return this.level===e.level&&this.row===e.row&&this.col===e.col&&this.world===e.world}clone(){return new lS(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(e,i,r,n){if(e==null)this.level=0,this.row=0,this.col=0,this.world=0;else if(typeof e=="object")this.level=e.level||0,this.row=e.row||0,this.col=e.col||0,this.world=e.world||0;else if(typeof e=="string"){const[s,o,a,c]=e.split("/");this.level=parseFloat(s),this.row=parseFloat(o),this.col=parseFloat(a),this.world=parseFloat(c)}else this.level=+e,this.row=+i,this.col=+r,this.world=+n||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new lS(this.level-1,this.row>>1,this.col>>1,this.world)}getChildKeys(){const e=this.level+1,i=this.row<<1,r=this.col<<1,n=this.world;return[new lS(e,i,r,n),new lS(e,i,r+1,n),new lS(e,i+1,r,n),new lS(e,i+1,r+1,n)]}compareRowMajor(e){return this.rowe.row?1:this.cole.col?1:0}};oE.pool=new Ql(oE,null,null,25,50);let eFe=class extends xIt{constructor(e,i,r,n,s,o,a=s,c=o){super(),this.triangleCountReportedInDebug=0,this.triangleCount=0,this.texture=null,this.key=new oE(e),this.resolution=i,this.x=r,this.y=n,this.width=s,this.height=o,this.rangeX=a,this.rangeY=c}destroy(){this.texture&&(this.texture.dispose(),this.texture=null)}setTransform(e){const i=this.resolution/(e.resolution*e.pixelRatio),r=this.transforms.tileMat3,[n,s]=e.toScreenNoRotation([0,0],[this.x,this.y]),o=this.width/this.rangeX*i,a=this.height/this.rangeY*i;Loe(r,o,0,0,0,a,0,n,s,1),fP(this.transforms.dvs,e.displayViewMat3,r)}},EY=class tFe extends eFe{constructor(e,i,r,n,s,o,a,c=null){super(e,i,r,n,s,o,4096,4096),this.styleRepository=a,this._memCache=c,this.type="vector-tile",this._referenced=0,this._hasSymbolBuckets=!1,this._memoryUsedByLayerData=0,this.layerData=new Map,this.status="loading",this.allSymbolsFadingOut=!1,this.lastOpacityUpdate=0,this.symbols=new Map,this.isCoverage=!1,this.neededForCoverage=!1,this.decluttered=!1,this.parentTile=null,this.childrenTiles=new Set,this._processed=!1,this._referenced=1,this.id=e.id}get hasSymbolBuckets(){return this._hasSymbolBuckets}get isFading(){return this._hasSymbolBuckets&&performance.now()-this.lastOpacityUpdate<__e}get isHoldingForFade(){return this._hasSymbolBuckets&&(!this.allSymbolsFadingOut||performance.now()-this.lastOpacityUpdate<__e)}get wasRequested(){return this.status==="errored"||this.status==="loaded"||this.status==="reloading"}setData(e){this.changeDataImpl(e),this.requestRender(),this.ready(),this._processed=!0}deleteLayerData(e){var r;let i=!1;for(const n of e){const s=this.layerData.get(n);s&&(this._memoryUsedByLayerData-=s.memoryUsed,s.type===Bh.SYMBOL&&this.symbols.delete(n)&&(i=!0),s.destroy(),this.layerData.delete(n))}(r=this._memCache)==null||r.updateSize(this.key.id,this,this._memoryUsedByLayerData),i&&this.emit("symbols-changed"),this.requestRender()}processed(){return this._processed}hasData(){return this.layerData.size>0}dispose(){this.status!=="unloaded"&&(iFe.delete(this),tFe._destroyRenderBuckets(this.layerData),this.layerData=null,this._memoryUsedByLayerData=0,this.destroy(),this.status="unloaded")}release(){return--this._referenced==0&&(this.dispose(),this.stage=null,!0)}retain(){++this._referenced}get referenced(){return this._referenced}get memoryUsed(){return this._memoryUsedByLayerData+256}changeDataImpl(e){var r;let i=!1;if(e){const{bucketsWithData:n,emptyBuckets:s}=e,o=this._createRenderBuckets(n);if(s&&s.byteLength>0){const a=new Uint32Array(s);for(const c of a)this._deleteLayerData(c)}for(const[a,c]of o)this._deleteLayerData(a),c.type===Bh.SYMBOL&&(this.symbols.set(a,c.symbols),i=!0),this._memoryUsedByLayerData+=c.memoryUsed,this.layerData.set(a,c);(r=this._memCache)==null||r.updateSize(this.key.id,this,this.memoryUsed)}this._hasSymbolBuckets=!1;for(const[n,s]of this.layerData)s.type===Bh.SYMBOL&&(this._hasSymbolBuckets=!0);i&&this.emit("symbols-changed")}attachWithContext(e){this.stage={context:e,trashDisplayObject(i){i.processDetach()},untrashDisplayObject:()=>!1}}setTransform(e){super.setTransform(e);const i=this.resolution/(e.resolution*e.pixelRatio),r=this.width/this.rangeX*i,n=this.height/this.rangeY*i,s=[0,0];e.toScreen(s,[this.x,this.y]);const o=this.transforms.tileUnitsToPixels;Doe(o),Kz(o,o,s),Noe(o,o,Math.PI*e.rotation/180),Foe(o,o,[r,n,1])}_createTransforms(){return{dvs:Mc(),tileMat3:Mc(),tileUnitsToPixels:Mc()}}static _destroyRenderBuckets(e){if(!e)return;const i=new Set;for(const r of e.values())i.has(r)||(r.destroy(),i.add(r));e.clear()}_createRenderBuckets(e){const i=new Map,r=new Map;for(const n of e){const s=this._deserializeBucket(n,r);for(const o of s.layerUIDs)i.set(o,s)}return i}_deserializeBucket(e,i){let r=i.get(e);if(r)return r;switch(new Uint32Array(e)[0]){case Bh.FILL:r=new vIt(e,this.styleRepository);break;case Bh.LINE:r=new yIt(e,this.styleRepository);break;case Bh.SYMBOL:r=new _It(e,this.styleRepository,this);break;case Bh.CIRCLE:r=new bIt(e,this.styleRepository)}return i.set(e,r),r}_deleteLayerData(e){if(!this.layerData.has(e))return;const i=this.layerData.get(e);this._memoryUsedByLayerData-=i.memoryUsed,i.destroy(),this.layerData.delete(e)}};const iFe=new Map;function SIt(){iFe.forEach((t,e)=>{console.log(` +${e.key}:`),t[0].forEach(i=>console.log(i)),console.log("========"),t[1].forEach(i=>console.log(i))})}const vpi={value:.5,readOnly:!0},TIt={readOnly:!0,value:.5,get(){return this.updating?this.updatingProgressValue:1}};let ZM=class{constructor(e=0,i=0){this.min=e,this.max=i,this.level=0,this.hasNoDataValues=!1}copyFrom(e){this.min=e.min,this.max=e.max,this.level=e.level,this.hasNoDataValues=e.hasNoDataValues}},rFe=class{constructor(e,i){this.data=e,this.safeWidth=.99999999*(e.width-1),this.dx=(e.width-1)/(i[2]-i[0]),this.dy=(e.width-1)/(i[3]-i[1]),this.x0=i[0],this.y1=i[3]}},EIt=class{constructor(e,i,r){this.type="elevation",this.level=e[0],this.i=e[1],this.j=e[2],this.extent=i,this.samplerData=new rFe(r,i)}computeMinMaxValue(e,i,r,n){n.min=1/0,n.max=-1/0,n.hasNoDataValues=!1;const s=e-this.level;if(s<=0)return n;const o=2**s;if(!(Math.floor(i/o)===this.i&&Math.floor(r/o)===this.j))return n;let a=1/0,c=-1/0;const p=this.samplerData.data.width,_=this.samplerData.data.values,x=.5*LL;let S=(p-1)/o,C=(r-this.j*o)*S,M=(i-this.i*o)*S;if(S<1){const P=Math.floor(C),$=Math.floor(M),F=P+$*p,z=_[F],k=_[F+1],U=_[F+p],j=_[F+p+1];if(z+k+U+jthis.notifyChange("stencilEnabledExtents"))])}destroy(){}get layerViewsExtent(){return this._computeLayerViewsExtent()}get tiledLayersExtent(){return this._computeTiledLayersExtent()}get stencilEnabledExtents(){return this._computeStencilEnabledExtents()}_computeStencilEnabledExtents(){const e=[];return this.layerViews.forEach(i=>{const r=i.layer;if(r.operationalLayerType==="IntegratedMeshLayer"&&this.viewSpatialReference!=null){const n=nFe(r.fullExtent,this.viewSpatialReference);n!=null&&e.push(ise(n))}}),e}};function AIt(t,e){return t===_t.Global?new Bie(e):new jie(e)}y([w({readOnly:!0})],cf.prototype,"layerViewsExtent",null),y([w({readOnly:!0})],cf.prototype,"tiledLayersExtent",null),y([w({readOnly:!0})],cf.prototype,"stencilEnabledExtents",null),y([w()],cf.prototype,"viewSpatialReference",void 0),y([w()],cf.prototype,"tilingScheme",void 0),y([w()],cf.prototype,"defaultTiledLayersExtent",void 0),y([w({constructOnly:!0})],cf.prototype,"layers",void 0),y([w({constructOnly:!0})],cf.prototype,"layerViews",void 0),cf=y([Z("esri.views.3d.terrain.ExtentHelper")],cf);let Bie=class extends cf{_computeLayerViewsExtent(){return this._globalExtent}_computeTiledLayersExtent(){return this._globalExtent}get _globalExtent(){return this.viewSpatialReference.isWebMercator?p4e:Yft}};Bie=y([Z("esri.views.3d.terrain.ExtentHelperGlobal")],Bie);let jie=class extends cf{_computeLayerViewsExtent(){const e=ld(),i=this.viewSpatialReference;this.layerViews.forEach(s=>{const o=s.layer;if(s.isResolved()&&(o.type!=="graphics"||!o.internal)){const a=nFe("fullExtentInLocalViewSpatialReference"in s&&s.fullExtentInLocalViewSpatialReference||s.layer.fullExtent,i);x2(e,a,e)}});const r=kZ(e)?e:null,n=this._get("layerViewsExtent");return mT(r,n)?n:r}_computeTiledLayersExtent(){const e=this.tilingScheme;if(!e)return null;const i=this.viewSpatialReference,r=ld();this.layers.forEach(o=>{if(o.loaded&&pO(o)){const a=$G(o,i,_t.Local);if(a==null)return;const{tileInfo:c,fullExtent:p}=a;c!=null&&p!=null&&(lV(o)||e.compatibleWith(c)&&p.spatialReference.equals(e.spatialReference))&&x2(r,p,r)}}),x2(r,this.defaultTiledLayersExtent,r);const n=kZ(r)?r:null,s=this._get("tiledLayersExtent");return mT(n,s)?s:n}};function nFe(t,e){return t==null||t.spatialReference.equals(e)?t:g$(t,t.spatialReference,e)}jie=y([Z("esri.views.3d.terrain.ExtentHelperLocal")],jie);var Yi;(function(t){t[t.ELEVATION=0]="ELEVATION",t[t.MAP=1]="MAP"})(Yi||(Yi={}));const cS=[Yi.ELEVATION,Yi.MAP];function sFe(){var e;const t=(e=globalThis.require)==null?void 0:e.modules;if(t){const i=Object.keys(t);for(const r of i)r.includes(".glsl")&&delete t[r]}}const oFe=1.3,MIt=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let Db,Ru=class extends ze{get running(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||En.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!this.suspended&&this.surface.ready}get _isSpherical(){return this.view.state.isGlobal}get _worldToPCSRatio(){return this._spatialReference!=null&&this._spatialReference.isGeographic&&!this.view.state.isLocal?Tr(this._spatialReference).metersPerDegree:1}get _overlayStretch(){return oFe/this.view.resolutionScale}get suspended(){return this.surface.suspended}get updating(){return this.running||this.renderer.updating||this._contentUpdated}get rendersOccluded(){return this.renderer.rendersOccluded}constructor(e){super(e),this._spatialReference=null,this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._longitudeCyclical=null,this._latestOriginId=0,this._maxResolution=$e("esri-mobile")?2048:4096,this._animationTimeLast=0}initialize(){const e=this.view;this.renderer=new V0({view:e,worldToPCSRatio:this._worldToPCSRatio,spatialReference:this._spatialReference}),e._stage.renderer.renderPlugins.add(this.renderer);const i=()=>this.setDrawTexturesDirty();this._groundIntersector=Mp(this.view.state.viewingMode),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([_e(()=>this.renderer.hasHighlights,i),this.renderer.events.on("has-water",r=>{var n;return(n=e._stage)==null?void 0:n.renderer.setParameters({hasOverlayWater:r})}),this.renderer.events.on("renders-occluded",()=>{i(),this.notifyChange("rendersOccluded")}),this.renderer.events.on("content-changed",i),_e(()=>e.state.camera.pixelRatio,i),_e(()=>e.state.alignPixelEnabled,i),this.renderer.events.on("textures-disposed",()=>this.surface.requestRender()),_e(()=>{var r,n,s;return[(r=e.pointsOfInterest)==null?void 0:r.renderPointOfView,(s=(n=e.pointsOfInterest)==null?void 0:n.centerOnSurfaceFrequent)==null?void 0:s.location]},()=>this.setPlacementDirty()),_e(()=>{var r,n;return[(r=e.state)==null?void 0:r.pixelRatio,(n=e.state)==null?void 0:n.contentPixelRatio]},()=>this.setPlacementDirty(),Li),this.surface.on("elevation-change",()=>this.setPlacementDirty()),e.on("resize",()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(ni.OVERLAY,this),e._stage.renderView.events.on("force-camera-for-screenshot",r=>{this._updateOverlays(cu,r.camera,so.BACKGROUND),this.renderer.hasOverlays&&this._drawOverlays(so.BACKGROUND,r)})]),e._stage.renderer.renderOverlay=r=>this._renderOverlay(r)}_renderOverlay(e){if(this._contentUpdated=!1,this.renderer.processSyncDrapeSources(),this.renderer.hasOverlays)return this._dispatchAnimationUpdate(e),this._drawOverlays(so.UPDATE,this.view.state)}destroy(){var e;(e=this.view)!=null&&e._stage&&(this.view._stage.renderer.renderPlugins.remove(this.renderer),this.view._stage.renderer.renderOverlay=()=>{}),Db&&(Db.hide(),Db=null)}get hasOverlays(){return this.renderer.hasOverlays}setSpatialReference(e){this._spatialReference=e,this.renderer.spatialReference=e,this._longitudeCyclical=null;const i=this.view.renderSpatialReference;e!=null&&i!=null?(this._renderSR=i,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this._longitudeCyclical=e.isWebMercator?new B2(-20037508342787e-6,20037508342787e-6):new B2(-180,180),this.renderer.longitudeCyclical=this._longitudeCyclical),this.renderer&&(this.renderer.worldToPCSRatio=this._worldToPCSRatio)):this.renderer.disposeOverlays()}registerDrapeSource(e,i,r){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources);const n=this.renderer.createDrapeSourceRenderer(e,i,r);return this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange("running"),n}registerGeometryDrapeSource(e){return this.registerDrapeSource(e,qd)}_updateDrapeSourceExtent(e){this.renderer.overlays.length===2&&e.setDrapingExtent!=null&&this._spatialReference!=null&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange("running"))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.setDrawTexturesDirty()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this._updateOverlays(e,this.view.state.contentCamera,so.UPDATE)}_updateOverlays(e,i,r){if(!this._spatialReference)return Jl.YIELD;const n=this._computeOverlayResolution(i);this._computeOverlayExtents(i,n,yg),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources,yg.stretch);const s=this._updateOverlay(zo.INNER,yg.inner,n,1*yg.pixelRatioAdjustment,yg.mapUnitsPerPixel),o=xc(yg.inner)/xc(yg.outer),a=this._updateOverlay(zo.OUTER,yg.outer,n,o*yg.pixelRatioAdjustment,yg.mapUnitsPerPixel);s!==ty.EXTENT&&a!==ty.EXTENT||(this._drapeSources.forEach(c=>this._updateDrapeSourceExtent(c)),this.surface.updateTileOverlayParams(r)),s===ty.NONE&&a===ty.NONE||this.setDrawTexturesDirty(),this._placementDirty=!1,e.madeProgress()}_computeOverlayResolution(e){const i=this.view.state.contentPixelRatio*this.view.resolutionScale,r=e.fullWidth/e.pixelRatio*i,n=e.fullHeight/e.pixelRatio*i,s=Math.ceil(1.5*Math.max(r,n));return Math.min(TT(s),this._maxResolution)}_updateOverlay(e,i,r,n,s){if(this.renderer.overlays.length===0)return ty.NONE;const o=this.renderer.overlays[e],a=o.mapUnitsPerPixel;if(o.mapUnitsPerPixel=s,o.pixelRatio=n,OIt(i,o.extent)&&r===o.resolution)return a===s?ty.NONE:ty.RERENDER_ONLY;__(o.extent,i),o.resolution=r;const c=rse(o.extent);return o.renderLocalOrigin=qU(c[0],c[1],0,"OV_"+this._latestOriginId++),ty.EXTENT}setTileParameters(e){const i=e.renderData.overlay;if(this.renderer.overlays.length>0){const r=this.renderer.overlays[zo.INNER],n=this.renderer.overlays[zo.OUTER],s=e.extent;this._rectInsideRect(r.extent,s)||this._rectanglesOverlap(s,r.extent)||this._rectanglesOverlap(s,n.extent)?(this._setTileOverlayData(s,zo.INNER,i),this._setTileOverlayData(s,zo.OUTER,i)):(this._clearTileOverlayData(zo.INNER,i),this._clearTileOverlayData(zo.OUTER,i))}else this._clearTileOverlayData(zo.INNER,i),this._clearTileOverlayData(zo.OUTER,i)}overlayPixelSizeInMapUnits(e,i){if(this.renderer.overlays.length===0)return i();const r=this.renderer.overlays[zo.INNER],n=this.renderer.overlays[zo.OUTER],s=this._pointIsInExtent(e,r.extent)?r:n;return(s.extent[2]-s.extent[0])/s.resolution}_setTileOverlayData(e,i,r){if(this.renderer.overlays.length===0)return;const n=this.renderer.overlays[i].extent,s=xc(n),o=Yu(n);let a=e[0];if(this._longitudeCyclical){a=this._longitudeCyclical.minimalMonotonic(n[0],a);const c=this._longitudeCyclical.minimalMonotonic(n[0],e[2]);a>c&&(a=c-(e[2]-e[0]))}r.setScale(i,xc(e)/s,Yu(e)/o),r.setOffset(i,(a-n[0])/s,(e[1]-n[1])/o)}_clearTileOverlayData(e,i){i.setScale(e,-1,-1),i.setOffset(e,-1,-1)}async reloadShaders(){sFe(),await this.renderer.reloadShaders(),this.setDrawTexturesDirty(),this.runTask(cu)}_dispatchAnimationUpdate(e){const i=e-this._animationTimeLast;if(i>=this.surface.view._stage.renderer.animationTimestep||this.view.state.forcedAnimationTime!=null||this._drawTexturesDirty||this._drawTexturesAnimateDirty){const r=i/this.surface.view._stage.renderer.animationTimeDilation,n=new Y9e(this.view.state.camera,r,this.view.state.forcedAnimationTime);this.renderer.updateAnimation(n)&&(this._drawTexturesAnimateDirty=!0),this._animationTimeLast=e}}setDrawTexturesDirty(){this.renderer.hasOverlays?(this._contentUpdated=!0,this._drawTexturesDirty=!0,this.view._stage.renderView.requestRender()):this.setPlacementDirty()}_intersectGroundFromView(e,i,r,n){const s=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,$It,i,r);if(s==null)return!1;const o=s.origin,a=Be(v8,s.origin,s.direction);return this._groundIntersector.reset(o,a,e),this._groundIntersector.intersect([]),this.view.basemapTerrain.intersect(this._groundIntersector,null,o,a),this._groundIntersector.results.min.getIntersectionPoint(n)}_findHorizonBasedPointOfInterest(e,i){let r=.5;const n=.55,s=this.view.renderCoordsHelper.getAltitude(e.eye),o=this.view.pointsOfInterest.centerOnSurfaceFrequent,a=1e-5,c=Je(o.estimatedSurfaceAltitude,e.aboveGround?-1/0:s+a,e.aboveGround?s-a:1/0),p=e.aboveGround;if(this.view.viewingMode==="global"){const _=v8;C5(pj(mj,Tr(this.view.spatialReference).radius+c),Ap(e.eye,e.viewForward),_),je(_,_,e.eye);const x=j2.normalize(E5e(e.viewForward,_,e.viewRight))/e.fovY+.5,S=x<=0||x>=1?.5:n;r=p?S*x:x+S*(1-x)}else{const _=.5*Math.PI-Math.acos(-e.viewForward[2]),x=Math.tan(_),S=Mi(0,x,1,0),C=dp(S,S,e.projectionMatrix)[1],M=Je(.5+.5*C,0,1);r=M===1||M===0?.5:p?M*n:1-(1-M)*n}return!!this._intersectGroundFromView(e,.5,r,i)&&yB(i,e.eye)=P&&(C=P,s[1]=0,this._spatialReference.isWebMercator&&(s[0]=0)));let $=1;M&&($=1/Math.max(.2,Math.cos(Math.abs(Ei(s[1])))),C*$>180&&($=180/C),r.mapUnitsPerPixel*=$);const F=Math.log(2)/12;C=Math.exp(Math.round(Math.log(C)/F)*F);const z=C*$,k=32,U=.5*i/(k*z),j=.5*i/(k*C);s[0]=Math.round(s[0]*U)/U,s[1]=Math.round(s[1]*j)/j;const G=r.inner;G[0]=s[0]-z,G[1]=s[1]-C,G[2]=s[0]+z,G[3]=s[1]+C,this._isSpherical&&this._shiftExtentToFitBounds(G,1/0,P);const Y=r.outer;if(6*z>xc(c))__(Y,c);else if(Math.PI/2-Math.abs(a-Math.PI/2)<=.25*Math.PI)Y[0]=G[0]-z,Y[1]=G[1]-C,Y[2]=G[2]+z,Y[3]=G[3]+C;else{il(e.eye,this._renderSR,v8,this._spatialReference),Rs(i3,s,v8);let ne=-Math.atan2(i3[1],i3[0])+.125*Math.PI;ne<0&&(ne+=2*Math.PI);const ie=Math.floor(ne/(.25*Math.PI));jT(i3,MIt[ie],2*C),i3[0]*=$,i3[2]*=$,Kne(Y,G,i3)}if(this._isSpherical)Y[0]=this._longitudeCyclical.clamp(Y[0]),Y[2]=this._longitudeCyclical.clamp(Y[2]),Y[1]=Math.max(Y[1],-P),Y[3]=Math.min(Y[3],P);else{const ne=zZ(G,c,RIt),ie=zZ(Y,c,IIt);Oz(ne,ie)&&(Y[2]=Y[0],Y[3]=Y[1])}const Q=Math.abs(G[2]-G[0])/i;r.mapUnitsPerPixel=Math.max(r.mapUnitsPerPixel,Q),r.pixelRatioAdjustment=r.mapUnitsPerPixel/Q}_drawOverlays(e,i){if(!this.renderer.hasOverlays)return;if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;const r=this._drawTexturesDirty;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;const n=this.renderer.computeValidity();return this.renderer.releaseRenderTargets(),this.renderer.drawOverlays(i),n!==this.renderer.computeValidity()&&this.surface.updateTileOverlayParams(so.UPDATE),r?(this.surface.requestRender(e),e===so.UPDATE&&this.surface.requestUpdate()):this.surface.requestRender(so.BACKGROUND),this.renderer}_rectanglesOverlap(e,i){return e!=null&&(this._longitudeCyclical?(this._longitudeCyclical.contains(i[0],i[2],e[0])||this._longitudeCyclical.contains(i[0],i[2],e[2])||this._longitudeCyclical.contains(e[0],e[2],i[0]))&&!(e[1]>i[3]||e[3]e[1]&&i[3]=i[1]&&e.y<=i[3];const r=e.x,n=e.y;return r>i[0]&&ri[1]&&ni&&(n=i-e[2]),e[1]<-r?s=e[1]+r:e[3]>r&&(s=r-e[3]),Pz(e,n,s)}get test(){return{renderer:this.renderer,update:()=>this.runTask(cu)}}};function OIt(t,e){const r=En.TESTS_DISABLE_OPTIMIZATIONS?0:1e-5*Math.max(t[2]-t[0],t[3]-t[1],e[2]-e[0],e[3]-e[1]);return Math.abs(e[0]-t[0])<=r&&Math.abs(e[1]-t[1])<=r&&Math.abs(e[2]-t[2])<=r&&Math.abs(e[3]-t[3])<=r}y([w()],Ru.prototype,"_spatialReference",void 0),y([w({readOnly:!0})],Ru.prototype,"running",null),y([w()],Ru.prototype,"_placementDirty",void 0),y([w()],Ru.prototype,"_contentUpdated",void 0),y([w()],Ru.prototype,"_isSpherical",null),y([w()],Ru.prototype,"_worldToPCSRatio",null),y([w({autoDestroy:!0})],Ru.prototype,"renderer",void 0),y([w({constructOnly:!0})],Ru.prototype,"view",void 0),y([w({constructOnly:!0})],Ru.prototype,"surface",void 0),y([w()],Ru.prototype,"suspended",null),y([w()],Ru.prototype,"updating",null),y([w({type:Boolean})],Ru.prototype,"rendersOccluded",null),Ru=y([Z("esri.views.3d.terrain.OverlayManager")],Ru);let PIt=class{constructor(){this.inner=Ni(),this.outer=Ni(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=oFe}};const i3=Xi(),v8=W(),yg=new PIt,RIt=Ni(),IIt=Ni(),$It=Qo();var ty;(function(t){t[t.NONE=0]="NONE",t[t.EXTENT=1]="EXTENT",t[t.RERENDER_ONLY=2]="RERENDER_ONLY"})(ty||(ty={}));let LIt=class{constructor(){this.indices=null,this.vertexAttributes=null,this.boundingBox=Bn(),this.indexCount=0,this.numVerticesPerSide=0,this.uvRange=[0,0,1,1],this.outerEdges=[null,null,null,null],this.innerEdges=[null,null,null,null]}release(){this.vertexAttributes=ir(this.vertexAttributes),this.indices=null}},b_e=class{constructor(e,i,r,n,s){this.attributes=e,this.localOrigin=i,this.index0=r,this.stride=n,this.count=s}getVertexIndex(e){return this.getAttributeIndex(e)}getAttributeIndex(e){return at(0<=e&&er[3]&&(r[3]=t),er[4]&&(r[4]=e),ir[5]&&(r[5]=i)}let DIt=class{constructor(){this.sinLonLUT=new Array(o4+1),this.cosLonLUT=new Array(o4+1),this.sinLatLUT=new Array(o4+1),this.cosLatLUT=new Array(o4+1)}update(e,i,r){const n=i[0],s=i[2];for(let o=0;o<=e;o++){const a=o/e,c=n*(1-a)+s*a;this.sinLonLUT[o]=Math.sin(c),this.cosLonLUT[o]=Math.cos(c);const p=r(a);this.sinLatLUT[o]=Math.sin(p),this.cosLatLUT[o]=Math.cos(p)}}},_8=class{constructor(){this.cornerTiles=[null,null,null,null],this.cornerTileSamplerVersions=[-1,-1,-1,-1]}},NIt=class{constructor(){this.cornerNeighborData=[new _8,new _8,new _8,new _8],this.edgeResolutions=[-1,-1,-1,-1],this.edgePeerNeighbors=[null,null,null,null],this.edgePeerNeighborSamplerVersions=[-1,-1,-1,-1],this.cornerPeerNeighbors=[null,null,null,null]}},FIt=class{constructor(){this.numVerticesPerSide=0,this.samplerData=null,this.clippingArea=null,this.wireframe=!1,this.samplerDataVersion=0,this.neighborData=new NIt}},aFe=class wk{constructor(e){this._getFadeDuration=e,this._fadeStart=0,this._delayedTime=0}clear(){this._current=et(this._current),this._next=et(this._next),this._waiting=et(this._waiting),this._delayed=et(this._delayed)}get current(){if(this._current==null)return null;if(!this._isFadingEnabled){const i=this._delayed||this._waiting||this._next||this._current;i!==this._current&&(this._current=null,this.clear(),this._current=i)}let e=wk.test.fadeMoment;if(this._delayed!=null&&(e=e||performance.now(),e>=this._delayedTime&&(this._push(this._delayed,u_.Immediate),this._delayed=null)),this._next!=null){e=e||performance.now();const i=this._fadeDuration,r=this._current!=null&&this._next.texture===this._current.texture,n=this._next.type!==ha.FADING,s=e-this._fadeStart>=i;(r||n||s)&&(et(this._current),this._current=this._next,this._next=this._waiting,this._waiting=null,this._fadeStart=this._alignFadeStart(e))}return this._current}get next(){return this._next}get fadeFactor(){if(this._next==null)return 1;const e=wk.test.fadeMoment||performance.now(),i=Math.max(0,e-this._fadeStart),r=this._fadeDuration;return i>r?0:1-i/r}get isFading(){return this._next!=null||this._delayed!=null}push(e,i=u_.Immediate){this._delayed=et(this._delayed),this._push(e,i)}_push(e,i){if(this._isFadingEnabled||this.clear(),this._current==null)return void(this._current=e);const r=wk.test.fadeMoment||performance.now();return i!==u_.Immediate?(this._delayed=e,void(this._delayedTime=r+i)):this._next==null?(this._next=e,void(this._fadeStart=this._alignFadeStart(r))):void(e!=null&&(et(this._waiting),this._waiting=e))}get _fadeDuration(){return this._waiting==null?this._getFadeDuration():.5*this._getFadeDuration()}_alignFadeStart(e){const i=this._getFadeDuration();return e+i-e%i}get _isFadingEnabled(){return this._getFadeDuration()>0}};var u_;aFe.test={fadeMoment:0},function(t){t[t.Immediate=0]="Immediate",t[t.Delayed=5e3]="Delayed"}(u_||(u_={}));var GP;(function(t){t[t.BACK_TO_FRONT=-1]="BACK_TO_FRONT",t[t.NONE=0]="NONE",t[t.FRONT_TO_BACK=1]="FRONT_TO_BACK"})(GP||(GP={}));let lFe=class{constructor(){this._queue=new Pi,this.remove=()=>{}}get done(){return this._queue.length===0&&(!this._last||this._last.isLeaf)}resetOne(e){this._queue.clear(),this._queue.push(e),this._last=void 0}reset(e=null){this._queue.clear(),e!=null&&this._queue.pushArray(e),this._last=void 0}skipSubtree(){this._last=void 0}next(){var i;const e=(i=this._last)==null?void 0:i.children;return e!=null&&e[0]&&this._queue.pushArray(e),this._last=this._queue.pop(),this._last}},kIt=class{constructor(){this._q=new Pi}get done(){return this._q.length===0}reset(e){if(this._q.clear(),e!=null){this._q.pushArray(e);for(let i=0;ir.xmax||n[3]>r.ymax)return!1}else if(r.xmin>n[2]||r.ymin>n[3]||r.xmax0&&s>1.00000001*o)return!1;const a=e.maxScale;return!(a>0&&s<.99999999*a)}function h_(t,e){const i=t.lij,r=e.lij;return i[0]-r[0]||i[1]-r[1]||i[2]-r[2]}function cFe(t,e,i=null){i==null||i.length===0?t===GP.BACK_TO_FRONT?e.sort(zIt):e.sort(UIt):e.sort((r,n)=>VIt(r,n,t,i))}function zIt(t,e){const i=e.screenDepth-t.screenDepth;if(i!==0)return i;const r=t.lij,n=e.lij;return r[0]-n[0]||r[1]-n[1]||r[2]-n[2]}function UIt(t,e){const i=t.screenDepth-e.screenDepth;if(i!==0)return i;const r=t.lij,n=e.lij;return r[0]-n[0]||r[1]-n[1]||r[2]-n[2]}function uFe(t,e,i){const r=t.screenDepth,n=e.screenDepth;return rn?i:h_(t,e)}function VIt(t,e,i,r){return x_e(t,r)===x_e(e,r)?uFe(t,e,i):t?i:-i}function x_e(t,e){for(const i of e)if(t.intersectsExtent(i))return!0;return!1}function BIt(t,e){const i=t.distanceToPOI-e.distanceToPOI;if(i!==0)return i;const r=t.lij,n=e.lij;return r[0]-n[0]||r[1]-n[1]||r[2]-n[2]}function jIt(t,e){const i=t.length;for(let r=0;r!0;let _=this.tile;const x=_.level;let S;const C=this._tileLayerInfo.upsampleInfo,M=C!=null?C.tile.level:-1,P=C!=null&&M-x>=a,$=n==null?void 0:n.tilemapCache,F=r.type==="vector-tile-3d"?r.schemaHelper:null;for(;_&&p(_,n,!1)&&_.level>=s;){const z=_.level,k=x-z,U=_.layerInfo[i][e];if(U.data&&k>=a){(!P||z>M)&&this._setUpsampleTile(_),U.dataInvalidated&&(S=_);break}const j=(F==null?void 0:F.getLevelRowColumn(_.lij))??_.lij;if(($==null?void 0:$.getAvailability(j[0],j[1],_.lij[2]))!=="unavailable"&&z<=o&&!U.data&&!U.dataMissing&&((!S||_.level===s||z%d4e==0||x-S.level=c))break;_=_.parent}if(S!=null&&x-S.level=i)return n;r=n}return r}_setUpsampleTile(e,i){this._tileLayerInfo.setUpsampleInfo(this.tile,e),this.tile.updateRenderData(this._layerClass,ha.FADING,i)}get test(){return{findNextDownload:()=>this._findNextDownload(),tileLayerInfo:this._tileLayerInfo}}},qIt=class extends Fce{get _desiredMinLevelDelta(){throw S_e}get _progressiveLevelModulo(){throw S_e}dispose(){}};const S_e=new Error("Abstract method called on TileAgent"),ph=new qIt;let hFe=class extends Fce{constructor(){super(...arguments),this._scaleRangeEnabled=!1}get _desiredMinLevelDelta(){return Ree(this.tile.level)-(this.tile.elevationLevel-this.tile.level)}get _progressiveLevelModulo(){return 0}},dFe=class extends Fce{constructor(){super(),this._scaleRangeEnabled=!0}get _desiredMinLevelDelta(){return 0}get _progressiveLevelModulo(){return d4e}};var PT,aE;(function(t){t[t.Stretch=0]="Stretch",t[t.Lut=1]="Lut",t[t.Hillshade=2]="Hillshade",t[t.COUNT=3]="COUNT"})(PT||(PT={})),function(t){t[t.Noop=0]="Noop",t[t.PerBand=1]="PerBand",t[t.COUNT=2]="COUNT"}(aE||(aE={}));function WIt(t){t.fragment.uniforms.add(new Zt("u_colormap",e=>e.u_colormap),new ft("u_colormapOffset",e=>e.colormap.u_colormapOffset),new ft("u_colormapMaxIndex",e=>e.colormap.u_colormapMaxIndex),new ft("u_opacity",e=>e.common.u_opacity)),t.fragment.code.add(V`vec4 colormap(vec4 currentPixel, bool isFloat) { float colorIndex = isFloat ? currentPixel.r - u_colormapOffset : currentPixel.r * 255.0 - u_colormapOffset; vec4 result; if (currentPixel.a == 0.0 || colorIndex > u_colormapMaxIndex) { @@ -3771,7 +3760,7 @@ vec2 texelCoordinates = vec2((colorIndex + 0.5), 0.5); result = texelFetch(u_colormap, ivec2(texelCoordinates), 0); } return result; -}`)}function XIt(t){t.fragment.uniforms.add(new Zt("u_transformGrid",e=>e.u_transformGrid),new ln("u_transformSpacing",e=>e.common.u_transformSpacing),new ln("u_targetImageSize",e=>e.common.u_targetImageSize)),t.fragment.code.add(V`vec2 projectPixelLocation(vec2 coords) { +}`)}function YIt(t){t.fragment.uniforms.add(new Zt("u_transformGrid",e=>e.u_transformGrid),new cn("u_transformSpacing",e=>e.common.u_transformSpacing),new cn("u_targetImageSize",e=>e.common.u_targetImageSize)),t.fragment.code.add(V`vec2 projectPixelLocation(vec2 coords) { vec2 index_image = floor(coords * u_targetImageSize); vec2 oneTransformPixel = vec2(4.0, 1.0); vec2 index_transform = floor(index_image / u_transformSpacing) * oneTransformPixel; @@ -3790,11 +3779,11 @@ srcLocation.s = dot(ur_abc, vec3(pos, 1.0)); srcLocation.t = dot(ur_def, vec3(pos, 1.0)); } return srcLocation; -}`)}let gFe=class extends _n{constructor(){super(...arguments),this.scale=1,this.offset=Wy}};function yFe(t){t.attributes.add(J.POSITION,"vec2"),t.attributes.add(J.UV0,"vec2"),t.vertex.uniforms.add(new ft("scale",e=>e.scale)),t.vertex.uniforms.add(new ln("offset",e=>e.offset)),t.varyings.add("uv","vec2"),t.varyings.add("vuv","vec2"),t.vertex.code.add(V`void main(void) { +}`)}let pFe=class extends bn{constructor(){super(...arguments),this.scale=1,this.offset=e1}};function fFe(t){t.attributes.add(J.POSITION,"vec2"),t.attributes.add(J.UV0,"vec2"),t.vertex.uniforms.add(new ft("scale",e=>e.scale)),t.vertex.uniforms.add(new cn("offset",e=>e.offset)),t.varyings.add("uv","vec2"),t.varyings.add("vuv","vec2"),t.vertex.code.add(V`void main(void) { gl_Position = vec4(position, 0.0, 1.0); uv = uv0 * scale + offset; vuv = uv0; -}`)}let ZIt=class extends gFe{constructor(e,i,r){super(),this.common=e,this.u_image=i,this.u_transformGrid=r}};function JIt(t,e){t.include(XIt),t.fragment.uniforms.add(new Zt("u_image",r=>r.u_image),new Oy("u_flipY",r=>r.common.u_flipY),new Oy("u_applyTransform",r=>r.common.u_applyTransform));const{requireBilinearWithNN:i}=e;i&&t.fragment.uniforms.add(new ln("u_srcImageSize",r=>r.common.u_srcImageSize)),t.fragment.code.add(V`vec2 getPixelLocation(vec2 coords) { +}`)}let XIt=class extends pFe{constructor(e,i,r){super(),this.common=e,this.u_image=i,this.u_transformGrid=r}};function ZIt(t,e){t.include(YIt),t.fragment.uniforms.add(new Zt("u_image",r=>r.u_image),new Dy("u_flipY",r=>r.common.u_flipY),new Dy("u_applyTransform",r=>r.common.u_applyTransform));const{requireBilinearWithNN:i}=e;i&&t.fragment.uniforms.add(new cn("u_srcImageSize",r=>r.common.u_srcImageSize)),t.fragment.code.add(V`vec2 getPixelLocation(vec2 coords) { vec2 targetLocation = u_flipY ? vec2(coords.s, 1.0 - coords.t) : coords; if (!u_applyTransform) { return targetLocation; @@ -3829,7 +3818,7 @@ vec4 getPixel(vec2 pixelLocation) { return sampleBilinear(u_image, pixelLocation, u_srcImageSize); }`):t.fragment.code.add(V`vec4 getPixel(vec2 pixelLocation) { return texture(u_image, pixelLocation); -}`)}var gt;(function(t){t[t.Normal=0]="Normal",t[t.Average=1]="Average",t[t.Lighten=2]="Lighten",t[t.Lighter=3]="Lighter",t[t.Plus=4]="Plus",t[t.Screen=5]="Screen",t[t.ColorDodge=6]="ColorDodge",t[t.Darken=7]="Darken",t[t.Multiply=8]="Multiply",t[t.ColorBurn=9]="ColorBurn",t[t.Overlay=10]="Overlay",t[t.SoftLight=11]="SoftLight",t[t.HardLight=12]="HardLight",t[t.VividLight=13]="VividLight",t[t.Hue=14]="Hue",t[t.Saturation=15]="Saturation",t[t.Luminosity=16]="Luminosity",t[t.Color=17]="Color",t[t.DestinationOver=18]="DestinationOver",t[t.DestinationAtop=19]="DestinationAtop",t[t.DestinationIn=20]="DestinationIn",t[t.DestinationOut=21]="DestinationOut",t[t.SourceAtop=22]="SourceAtop",t[t.SourceIn=23]="SourceIn",t[t.SourceOut=24]="SourceOut",t[t.Xor=25]="Xor",t[t.Difference=26]="Difference",t[t.Exclusion=27]="Exclusion",t[t.Minus=28]="Minus",t[t.Invert=29]="Invert",t[t.Reflect=30]="Reflect",t[t.COUNT=31]="COUNT"})(gt||(gt={}));const Nie={normal:gt.Normal,average:gt.Average,lighten:gt.Lighten,lighter:gt.Lighter,screen:gt.Screen,plus:gt.Plus,"color-dodge":gt.ColorDodge,darken:gt.Darken,multiply:gt.Multiply,"color-burn":gt.ColorBurn,overlay:gt.Overlay,"soft-light":gt.SoftLight,"hard-light":gt.HardLight,"vivid-light":gt.VividLight,hue:gt.Hue,saturation:gt.Saturation,luminosity:gt.Luminosity,color:gt.Color,difference:gt.Difference,exclusion:gt.Exclusion,minus:gt.Minus,invert:gt.Invert,reflect:gt.Reflect,"destination-over":gt.DestinationOver,"destination-atop":gt.DestinationAtop,"destination-in":gt.DestinationIn,"destination-out":gt.DestinationOut,"source-atop":gt.SourceAtop,"source-in":gt.SourceIn,"source-out":gt.SourceOut,xor:gt.Xor};function KIt(t){return t===gt.DestinationOver||t===gt.DestinationAtop||t===gt.DestinationIn||t===gt.DestinationOut||t===gt.SourceAtop||t===gt.SourceIn||t===gt.SourceOut||t===gt.Xor}function Ece(t){t.code.add(V` +}`)}var gt;(function(t){t[t.Normal=0]="Normal",t[t.Average=1]="Average",t[t.Lighten=2]="Lighten",t[t.Lighter=3]="Lighter",t[t.Plus=4]="Plus",t[t.Screen=5]="Screen",t[t.ColorDodge=6]="ColorDodge",t[t.Darken=7]="Darken",t[t.Multiply=8]="Multiply",t[t.ColorBurn=9]="ColorBurn",t[t.Overlay=10]="Overlay",t[t.SoftLight=11]="SoftLight",t[t.HardLight=12]="HardLight",t[t.VividLight=13]="VividLight",t[t.Hue=14]="Hue",t[t.Saturation=15]="Saturation",t[t.Luminosity=16]="Luminosity",t[t.Color=17]="Color",t[t.DestinationOver=18]="DestinationOver",t[t.DestinationAtop=19]="DestinationAtop",t[t.DestinationIn=20]="DestinationIn",t[t.DestinationOut=21]="DestinationOut",t[t.SourceAtop=22]="SourceAtop",t[t.SourceIn=23]="SourceIn",t[t.SourceOut=24]="SourceOut",t[t.Xor=25]="Xor",t[t.Difference=26]="Difference",t[t.Exclusion=27]="Exclusion",t[t.Minus=28]="Minus",t[t.Invert=29]="Invert",t[t.Reflect=30]="Reflect",t[t.COUNT=31]="COUNT"})(gt||(gt={}));const Gie={normal:gt.Normal,average:gt.Average,lighten:gt.Lighten,lighter:gt.Lighter,screen:gt.Screen,plus:gt.Plus,"color-dodge":gt.ColorDodge,darken:gt.Darken,multiply:gt.Multiply,"color-burn":gt.ColorBurn,overlay:gt.Overlay,"soft-light":gt.SoftLight,"hard-light":gt.HardLight,"vivid-light":gt.VividLight,hue:gt.Hue,saturation:gt.Saturation,luminosity:gt.Luminosity,color:gt.Color,difference:gt.Difference,exclusion:gt.Exclusion,minus:gt.Minus,invert:gt.Invert,reflect:gt.Reflect,"destination-over":gt.DestinationOver,"destination-atop":gt.DestinationAtop,"destination-in":gt.DestinationIn,"destination-out":gt.DestinationOut,"source-atop":gt.SourceAtop,"source-in":gt.SourceIn,"source-out":gt.SourceOut,xor:gt.Xor};function JIt(t){return t===gt.DestinationOver||t===gt.DestinationAtop||t===gt.DestinationIn||t===gt.DestinationOut||t===gt.SourceAtop||t===gt.SourceIn||t===gt.SourceOut||t===gt.Xor}function kce(t){t.code.add(V` float lineFactorAtPosition(float value) { float pos = value * ${V.float(257)}; if(pos < 0.5 || pos > ${V.float(257-.5)}) { @@ -3856,7 +3845,7 @@ return texture(u_image, pixelLocation); vec3 gridColor(vec2 uv) { float line = lineFactor(uv) * 0.1 + 0.9; return vec3(1.0, 0.972, 0.918) * line; - }`)}function QIt(t,e){const i=e.blendMode;i!==gt.Normal&&(i===gt.Reflect&&t.code.add(V`float reflectBlend(in float cb, in float cl) { + }`)}function KIt(t,e){const i=e.blendMode;i!==gt.Normal&&(i===gt.Reflect&&t.code.add(V`float reflectBlend(in float cb, in float cl) { return (cl == 1.0) ? cl : min(cb * cb / (1.0 - cl), 1.0); }`),i!==gt.ColorDodge&&i!==gt.VividLight||t.code.add(V`float colorDodge(in float cb, in float cl) { return (cb == 0.0) ? 0.0 : (cl == 1.0) ? 1.0 : min(1.0, cb / (1.0 - cl)); @@ -3936,22 +3925,22 @@ return setLum(sbase > 0.0 ? (cbase - minbase) * ssat / sbase : vec3(0.0), clum); vec3 f = vec3(vividLight(cb.r, cl.r), vividLight(cb.g, cl.g), vividLight(cb.b, cl.b)); return vec4(f * ol * ob + cl * ol * (1.0 - ob) + cb * ob * (1.0 - ol), mix(ob, 1.0, ol));`:V``} } - `))}var Jo,up,am;(function(t){t[t.Composite=0]="Composite",t[t.ColorComposite=1]="ColorComposite",t[t.GridComposite=2]="GridComposite",t[t.GroupBackgroundComposite=3]="GroupBackgroundComposite",t[t.COUNT=4]="COUNT"})(Jo||(Jo={})),function(t){t[t.NotRequired=0]="NotRequired",t[t.Required=1]="Required",t[t.COUNT=2]="COUNT"}(up||(up={})),function(t){t[t.Off=0]="Off",t[t.On=1]="On",t[t.COUNT=2]="COUNT"}(am||(am={}));function vFe(t,e){const i=e.output===Jo.GridComposite,r=e.output===Jo.ColorComposite,n=e.output===Jo.GroupBackgroundComposite,s=e.output===Jo.Composite;i&&t.fragment.include(Ece),r&&t.fragment.uniforms.add(new Oi("backgroundColor",f=>f.backgroundColor));const o=e.baseOpacityMode===up.Required;o&&t.fragment.uniforms.add(new ft("baseOpacity",f=>f.baseOpacity)),s&&t.fragment.uniforms.add(new Zt("fboColor",f=>f.fboTexture));const l=e.blendMode!==gt.Normal,c=e.premultipliedSource===am.On;t.fragment.include(QIt,e),t.fragment.code.add(V` + `))}var Ko,fp,um;(function(t){t[t.Composite=0]="Composite",t[t.ColorComposite=1]="ColorComposite",t[t.GridComposite=2]="GridComposite",t[t.GroupBackgroundComposite=3]="GroupBackgroundComposite",t[t.COUNT=4]="COUNT"})(Ko||(Ko={})),function(t){t[t.NotRequired=0]="NotRequired",t[t.Required=1]="Required",t[t.COUNT=2]="COUNT"}(fp||(fp={})),function(t){t[t.Off=0]="Off",t[t.On=1]="On",t[t.COUNT=2]="COUNT"}(um||(um={}));function mFe(t,e){const i=e.output===Ko.GridComposite,r=e.output===Ko.ColorComposite,n=e.output===Ko.GroupBackgroundComposite,s=e.output===Ko.Composite;i&&t.fragment.include(kce),r&&t.fragment.uniforms.add(new Oi("backgroundColor",p=>p.backgroundColor));const o=e.baseOpacityMode===fp.Required;o&&t.fragment.uniforms.add(new ft("baseOpacity",p=>p.baseOpacity)),s&&t.fragment.uniforms.add(new Zt("fboColor",p=>p.fboTexture));const a=e.blendMode!==gt.Normal,c=e.premultipliedSource===um.On;t.fragment.include(KIt,e),t.fragment.code.add(V` vec4 getBackground(vec2 uv) { return ${o?V`baseOpacity *`:""} ${n?V`vec4(0.0, 0.0, 0.0, 0.0)`:r?V`vec4(backgroundColor, 1.0)`:i?V`vec4(gridColor(uv), 1.0)`:V`texelFetch(fboColor, ivec2(gl_FragCoord.xy), 0)`}; } vec4 blendLayers(vec4 bgColor, vec4 colorLayer, float opacity) { - ${l?V` + ${a?V` vec3 cl = colorLayer.a == 0.0 ? colorLayer.rgb : colorLayer.rgb / colorLayer.a; vec3 cb = bgColor.a == 0.0 ? bgColor.rgb : bgColor.rgb / bgColor.a; return applyBlendMode(clamp(cl, vec3(0.0), vec3(1.0)), colorLayer.a * opacity, cb, bgColor.a);`:V` float composeAlpha = colorLayer.a * opacity; return ${!c&&(s&&!o||n)?V`colorLayer * opacity;`:V`bgColor * (1.0 - composeAlpha) + colorLayer * opacity;`}`} - }`)}let p6=class extends ZIt{constructor(e,i,r,n,s,o){super(e,n,s),this.colormap=i,this.symbolizer=r,this.u_colormap=o,this.backgroundColor=Ka,this.fboTexture=null,this.baseOpacity=1}},_Fe=class extends p6{},bFe=class extends p6{};function wFe(t){const e=new Cr;return e.include(yFe),e.include(JIt,t),e.include(YIt,t),e.include(vFe,t),e.fragment.code.add(V`vec4 applyBackgroundBlend(vec4 layerColor) { + }`)}let y6=class extends XIt{constructor(e,i,r,n,s,o){super(e,n,s),this.colormap=i,this.symbolizer=r,this.u_colormap=o,this.backgroundColor=el,this.fboTexture=null,this.baseOpacity=1}},gFe=class extends y6{},yFe=class extends y6{};function vFe(t){const e=new Ar;return e.include(fFe),e.include(ZIt,t),e.include(WIt,t),e.include(mFe,t),e.fragment.code.add(V`vec4 applyBackgroundBlend(vec4 layerColor) { vec4 bgColor = getBackground(vuv); return blendLayers(bgColor, layerColor, u_opacity); -}`),t.colorizerType===ST.Stretch?t$t(e,t):t.colorizerType===ST.Lut?e$t(e):t.colorizerType===ST.Hillshade&&i$t(e,t),e}function e$t(t){t.fragment.code.add(V`void main() { +}`),t.colorizerType===PT.Stretch?e4t(e,t):t.colorizerType===PT.Lut?QIt(e):t.colorizerType===PT.Hillshade&&t4t(e,t),e}function QIt(t){t.fragment.code.add(V`void main() { vec2 pixelLocation = getPixelLocation(uv); if (isOutside(pixelLocation)) { fragColor = applyBackgroundBlend(vec4(0.0, 0.0, 0.0, 0.0)); @@ -3959,7 +3948,7 @@ return; } vec4 currentPixel = getPixel(pixelLocation); fragColor = applyBackgroundBlend(colormap(currentPixel, true)); -}`)}function t$t(t,e){t.fragment.uniforms.add(new s6("u_bandCount",r=>r.symbolizer.u_bandCount),new Hu("u_minCutOff",r=>r.symbolizer.u_minCutOff,3),new Hu("u_maxCutOff",r=>r.symbolizer.u_maxCutOff,3),new Hu("u_factor",r=>r.symbolizer.u_factor,3),new ft("u_minOutput",r=>r.symbolizer.u_minOutput),new ft("u_maxOutput",r=>r.symbolizer.u_maxOutput),new Oy("u_useGamma",r=>r.symbolizer.u_useGamma),new Hu("u_gamma",r=>r.symbolizer.u_gamma,3),new Hu("u_gammaCorrection",r=>r.symbolizer.u_gammaCorrection,3),new ft("u_opacity",r=>r.common.u_opacity)),t.fragment.code.add(V`float stretchOneValue(float val, float minCutOff, float maxCutOff, float minOutput, float maxOutput, float factor, bool useGamma, float gamma, float gammaCorrection) { +}`)}function e4t(t,e){t.fragment.uniforms.add(new u6("u_bandCount",r=>r.symbolizer.u_bandCount),new Wu("u_minCutOff",r=>r.symbolizer.u_minCutOff,3),new Wu("u_maxCutOff",r=>r.symbolizer.u_maxCutOff,3),new Wu("u_factor",r=>r.symbolizer.u_factor,3),new ft("u_minOutput",r=>r.symbolizer.u_minOutput),new ft("u_maxOutput",r=>r.symbolizer.u_maxOutput),new Dy("u_useGamma",r=>r.symbolizer.u_useGamma),new Wu("u_gamma",r=>r.symbolizer.u_gamma,3),new Wu("u_gammaCorrection",r=>r.symbolizer.u_gammaCorrection,3),new ft("u_opacity",r=>r.common.u_opacity)),t.fragment.code.add(V`float stretchOneValue(float val, float minCutOff, float maxCutOff, float minOutput, float maxOutput, float factor, bool useGamma, float gamma, float gammaCorrection) { if (val >= maxCutOff) { return maxOutput; } else if (val <= minCutOff) { @@ -3987,7 +3976,7 @@ return stretchedVal; } vec4 currentPixel = getPixel(pixelLocation); - ${e.stretchType===rE.Noop?V` + ${e.stretchType===aE.Noop?V` fragColor = applyBackgroundBlend(currentPixel);`:V` if (currentPixel.a == 0.0) { fragColor = applyBackgroundBlend(vec4(0.0, 0.0, 0.0, 0.0)); @@ -4002,7 +3991,7 @@ return stretchedVal; float blueVal = stretchOneValue(currentPixel.b, u_minCutOff[2], u_maxCutOff[2], u_minOutput, u_maxOutput, u_factor[2], u_useGamma, u_gamma[2], u_gammaCorrection[2]); fragColor = applyBackgroundBlend(vec4(redVal, greenVal, blueVal, currentPixel.a)); }`} - }`)}function i$t(t,e){const i=t.fragment;i.uniforms.add(new Zt("u_image",n=>n.u_image),new s6("u_hillshadeType",n=>n.symbolizer.u_hillshadeType),new Hu("u_sinZcosAs",n=>n.symbolizer.u_sinZcosAs,6),new Hu("u_sinZsinAs",n=>n.symbolizer.u_sinZsinAs,6),new Hu("u_cosZs",n=>n.symbolizer.u_cosZs,6),new Hu("u_weights",n=>n.symbolizer.u_weights,6),new ln("u_factor",n=>n.symbolizer.u_factor),new ft("u_minValue",n=>n.symbolizer.u_minValue),new ft("u_maxValue",n=>n.symbolizer.u_maxValue),new ln("u_srcImageSize",n=>n.common.u_srcImageSize)),i.include(h1),i.code.add(V`vec4 overlay(float val, float minValue, float maxValue, float hillshade, float alpha) { + }`)}function t4t(t,e){const i=t.fragment;i.uniforms.add(new Zt("u_image",n=>n.u_image),new u6("u_hillshadeType",n=>n.symbolizer.u_hillshadeType),new Wu("u_sinZcosAs",n=>n.symbolizer.u_sinZcosAs,6),new Wu("u_sinZsinAs",n=>n.symbolizer.u_sinZsinAs,6),new Wu("u_cosZs",n=>n.symbolizer.u_cosZs,6),new Wu("u_weights",n=>n.symbolizer.u_weights,6),new cn("u_factor",n=>n.symbolizer.u_factor),new ft("u_minValue",n=>n.symbolizer.u_minValue),new ft("u_maxValue",n=>n.symbolizer.u_maxValue),new cn("u_srcImageSize",n=>n.common.u_srcImageSize)),i.include(_1),i.code.add(V`vec4 overlay(float val, float minValue, float maxValue, float hillshade, float alpha) { val = clamp((val - minValue) / (maxValue - minValue), 0.0, 1.0); vec4 color = colormap(vec4(val, val, val, 1.0), false); vec3 hsv = rgb2hsv(color.rgb); @@ -4099,8 +4088,8 @@ fragColor = applyBackgroundBlend(vec4(hillshade, hillshade, hillshade, alpha));` alpha *= u_opacity; ${r} } - `)}const r$t=Object.freeze(Object.defineProperty({__proto__:null,ColorizerHillshadeUniforms:bFe,ColorizerStretchUniforms:_Fe,ColorizerUniforms:p6,build:wFe},Symbol.toStringTag,{value:"Module"}));function n$t(t,e,i="nearest",r=!1){var f;const n=!(r&&e.pixelType==="u8"),s=n?ga.FLOAT:ga.UNSIGNED_BYTE,o=e.pixels==null||e.pixels.length===0?null:n?e.getAsRGBAFloat():e.getAsRGBA(),l=(f=t.capabilities.textureFloat)==null?void 0:f.textureFloatLinear,c=new tn;return c.width=e.width,c.height=e.height,c.internalFormat=t.type===cr.WEBGL2&&n?zt.RGBA32F:ci.RGBA,c.samplingMode=!l||i!=="bilinear"&&i!=="cubic"?ki.NEAREST:ki.LINEAR,c.dataType=s,c.wrapMode=Bi.CLAMP_TO_EDGE,new Ai(t,c,o)}function s$t(t,e){const{spacing:i,offsets:r,coefficients:n,size:[s,o]}=e,l=i[0]>1,c=new tn;c.width=l?4*s:s,c.height=o,c.internalFormat=t.type===cr.WEBGL2?zt.RGBA32F:ci.RGBA,c.dataType=ga.FLOAT,c.samplingMode=ki.NEAREST,c.wrapMode=Bi.CLAMP_TO_EDGE;const f=new Float32Array(l?s*o*16:2*r.length);if(l&&n!=null)for(let _=0,x=0;_0?this._bandIds&&e.every((i,r)=>{var n;return!!((n=this._bandIds)!=null&&n[r])&&i===this._bandIds[r]})||(this._bandIds=e,this._dirty=!0):this._bandIds=null}get interpolation(){return this._interpolation||"nearest"}set interpolation(e){if(this._interpolation=e,this._rasterTexture!=null){const i=this._getRasterTextureInterpolation(e);this._rasterTexture.setSamplingMode(i==="bilinear"?ki.LINEAR:ki.NEAREST)}}get transformGrid(){return this._transformGrid}set transformGrid(e){this._transformGrid=e,this._transformGridTexture=Kt(this._transformGridTexture),this._memoryUsed=null}bind(e){return!!(this.source&&this.source.pixels&&this.source.pixels.length>0)&&((this._rasterTexture==null||this._dirty)&&this._updateRasterTexture(e,this.bandIds),this._rasterTexture!=null&&(this._updateColormapTexture(e),this.transformGrid&&this._transformGridTexture==null&&(this._transformGridTexture=s$t(e,this.transformGrid))),!0)}getUniforms(){const{symbolizerParameters:e,transformGrid:i,width:r,height:n,opacity:s}=this,o=o$t(i,[r,n],[this.source.width,this.source.height],s),l=a$t(e.colormap,e.colormapOffset),c=this.symbolizerParameters.type==="stretch"?l$t(this.symbolizerParameters):null,f=this.symbolizerParameters.type==="hillshade"?c$t(this.symbolizerParameters):null;return new p6(o,l,c||f,this._rasterTexture,this._transformGridTexture,this._colormapTexture)}get isBilinearWithStretchColorRamp(){const{symbolizerParameters:e}=this;return this.interpolation==="bilinear"&&e.colormap!=null&&e.type==="stretch"}get memoryUsage(){if(this._memoryUsed==null){const e=[this._rasterTexture,this._transformGridTexture,this._colormapTexture];this._memoryUsed=e.map(i=>i!=null?i.descriptor.width*i.descriptor.height*4:0).reduce((i,r)=>i+r,0)}return this._memoryUsed}release(){return this._rasterTexture=Kt(this._rasterTexture),this._transformGridTexture=Kt(this._transformGridTexture),this._colormapTexture=Kt(this._colormapTexture),this.source=null,this.transformGrid=null,this.rawPixelData=null,!0}_updateRasterTexture(e,i){const r=this.source?this.source.extractBands(i):null;if(!(r&&r.pixels&&r.pixels.length>0))return void(this._rasterTexture=Kt(this._rasterTexture));const n=i==null&&this.bandIds==null||i!=null&&this.bandIds!=null&&i.join("")===this.bandIds.join("");if(this._rasterTexture!=null&&n)return;this._rasterTexture=Kt(this._rasterTexture);const s=this._getRasterTextureInterpolation(this.interpolation);this._rasterTexture=n$t(e,r,s,this.isRendereredSource||this.hasStretchTypeNone())}hasStretchTypeNone(){return"stretchType"in this.symbolizerParameters&&this.symbolizerParameters.stretchType==="none"&&!this.symbolizerParameters.useGamma&&this.source.pixelType==="u8"}_getRasterTextureInterpolation(e){return this.symbolizerParameters.type==="lut"||e==="nearest"||e==="majority"||this.isBilinearWithStretchColorRamp?"nearest":"bilinear"}_updateColormapTexture(e){const i=this._colormap,r=this.symbolizerParameters.colormap;return r?i?r.length!==i.length||r.some((n,s)=>n!==i[s])?(this._colormapTexture=Kt(this._colormapTexture),this._colormapTexture=S_e(e,r),void(this._colormap=r)):void 0:(this._colormapTexture=S_e(e,r),void(this._colormap=r)):(this._colormapTexture=Kt(this._colormapTexture),void(this._colormap=null))}},dk=class{constructor(){this.waitingAgents=new Pi,this._upsampleInfo=null,this.loadingAgent=null,this.requestPromise=null,this.requestAbort=null,this.pendingUpdates=0}static acquire(e){const i=gY.acquire();return i._init(e),i}release(){this.dispose(),pk.delete(this),gY.release(this)}dispose(){this.loadingAgent=Kt(this.loadingAgent),this.abortRequest(),this._unsetUpsampleInfo(),this.pendingUpdates=0,this._data=CO(this._data)}static prune(){gY.prune(0)}_init(e){this.waitingAgents.clear(),this._data=CO(this._data),this.dataMissing=!1,this.dataInvalidated=!1,this._unsetUpsampleInfo(),this.abortRequest(),this.loadingAgent=null,this.pendingUpdates=0,this._pool=e,this.elevationBounds=null}invalidateSourceData(){this.dataInvalidated=!0,this.dataMissing=!1,this._unsetUpsampleInfo()}abortRequest(){this.requestAbort=gn(this.requestAbort),this.requestPromise=null}get upsampleInfo(){return this._upsampleInfo}_unsetUpsampleInfo(){this._upsampleInfo!=null&&(this._upsampleInfo.tile.unrefMapData(),this._pool.release(this._upsampleInfo),this._upsampleInfo=null)}setUpsampleInfo(e,i){if(e!==i&&i!=null){if(this._upsampleInfo==null)this._upsampleInfo=this._pool.acquire();else{if(this._upsampleInfo.tile===i)return;this._upsampleInfo.tile.unrefMapData()}i.refMapData(),HIt(e,i,this._upsampleInfo)}else this._unsetUpsampleInfo()}get data(){return this._data}set data(e){CO(this._data),this._data=e}};const gY=new Ec(dk,null,()=>{}),pk=new Map;function h$t(){pk.size>0&&(console.log(`${pk.size} live TilePerLayerInfo allocations:`),pk.forEach(t=>console.log(t,` -`)))}let _I=class{constructor(e,i){this._texture=e,this._cache=i,this.type="tile-texture",this._refCount=1}retain(){++this._refCount}release(){if(--this._refCount,this._refCount===0)if(this._cache){const e=`${this._texture.descriptor.width} ${this._texture.descriptor.pixelFormat}`;this._cache.put(e,this)}else this.dispose()}dispose(){this._texture.dispose()}get texture(){return this._texture}generateMipmap(){this._texture.generateMipmap()}get descriptor(){return this._texture.descriptor}get usedMemory(){return this._texture.gpuMemoryUsage}};var hi;(function(t){t[t.NONE=0]="NONE",t[t.SPLIT=1]="SPLIT",t[t.ELEVATION=2]="ELEVATION",t[t.MERGE=4]="MERGE",t[t.RENDERDATA=8]="RENDERDATA",t[t.GEOMETRY=16]="GEOMETRY",t[t.TEXTURE_NOFADING=32]="TEXTURE_NOFADING",t[t.TEXTURE_FADING=64]="TEXTURE_FADING"})(hi||(hi={}));const d$t=.1;let Cce=class{constructor(){this.lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this.renderData=null,this._dirty=!0,this._previouslyRendered=!1,this.extent=Ni(),this._elevationBounds=yt(),this.layerInfo=[[],[]],this.extentInRadians=Ni(),this.centerAtSeaLevel=W(),this._center=[W(),co(),W()],this.up=tse(),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=null,this._mapTileMemoryInternal=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=W()}static prune(){Ace.prune(0),Mce.prune(0),dk.prune()}get _isCached(){return!this.shouldLoad&&this._mapDataRefCount<=0}get maxTesselation(){return this._maxTesselation}get isWithinClippingArea(){return this._isWithinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBounds(){return this._elevationBounds}get level(){return this.lij[0]}get key(){return`${this.lij[0]}/${this.lij[1]}/${this.lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[Fo.MIDDLE][3]}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}computeVisibility(){this._dirty=!1;const e=this.parent,i=(e==null?void 0:e.frustumVisibility)??gc.INTERSECTS;this._frustumVisibility=i===gc.INSIDE?gc.INSIDE:i===gc.OUTSIDE?gc.OUTSIDE:this._calculateFrustumVisibilityStatus(this.surface.frustum);const r=this._frustumVisibility!==gc.OUTSIDE&&this._intersectsClippingArea;r!==this._visible&&(this._visible=r,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}get loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}get shouldLoad(){return this.isLeaf}init(e,i,r,n,s){this.lij[0]=e,this.lij[1]=i,this.lij[2]=r,this.ellipsoid=Sr(s.tilingScheme.spatialReference),s.tilingScheme.getExtent(e,i,r,this.extent),s.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,s.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[Fo.MIDDLE][3]=0,this.elevationLevel=e,n&&n.elevationBounds?Qo(this._elevationBounds,n.elevationBounds):or(this._elevationBounds,0,0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=n,this.unsetChildren(),this._surface=s,this.updateVisibility();for(const o of rS){const l=s.numLayers(o),c=this.layerInfo[o];for(const f of c)f.release();c.length=l;for(let f=0;f0&&this._surface.upsampleMapCache.put(this.key,this,e)}}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this._ensureUsedMemory()+(this._isCached?0:this._mapTileMemoryInternal)}get _cachedMemory(){return this._isCached?this._mapTileMemory:0}get _mapTileMemory(){return this._ensureUsedMemory(),this.layerInfo[Yi.MAP].reduce((e,i)=>e+(i instanceof mY?i.memoryUsed/i.referenced:0),this._mapTileMemoryInternal)}get _cpuImageMemorySize(){const i=this._surface.tilingScheme.pixelSize;return i*i*4}_ensureUsedMemory(){var r;if(this._usedMemory!=null)return this._usedMemory;this._usedMemory=this._baseUsedMemory,this._mapTileMemoryInternal=0;let e=0;for(const{data:n}of this.layerInfo[Yi.MAP])n instanceof mY?e+=this._getTerrainDataMemory(n):this._mapTileMemoryInternal+=this._getTerrainDataMemory(n);const i=this._cpuImageMemorySize;for(const n of this.layerInfo[Yi.ELEVATION])this._usedMemory+=n.data?i:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._mapTileMemoryInternal+=((r=this.renderData.texture)==null?void 0:r.usedMemory)??0),this._isCached&&this._surface.upsampleMapCache.updateSize(this.key,this,this._mapTileMemoryInternal+e),this._usedMemory}getUsedMemoryForLayer(e,i){const r=this.layerInfo[e][i];return r!=null&&r.data?e===Yi.MAP?this._isCached?0:this._getTerrainDataMemory(r.data):e===Yi.ELEVATION?this._cpuImageMemorySize:0:0}_getTerrainDataMemory(e){return e instanceof _I?e.texture.gpuMemoryUsage:e instanceof HTMLImageElement||e instanceof wce?this._cpuImageMemorySize:e instanceof u$t?e.memoryUsage:e instanceof mY?e.memoryUsed/e.referenced:0}updateScreenDepth(e){const i=this._center[Fo.MIDDLE],r=e,n=i[0],s=i[1],o=i[2],l=r[2]*n+r[6]*s+r[10]*o+r[14];this.screenDepth=l<0?0:l/(r[3]*n+r[7]*s+r[11]*o+r[15])}shouldSplit(e,i,r){if(!this.visible||e.frustum&&(!this._intersectsClippingArea||this._calculateFrustumVisibilityStatus(e.frustum)===gc.OUTSIDE))return hi.NONE;const n=this.level;je(f8,this._center[Fo.MIDDLE],i);let s=El(f8),o=f8,l=Fo.MIDDLE;je(yY,this._center[Fo.TOP],i);const c=El(yY);cs&&n{if(n0&&F<.001&&I/x-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-F>0)return hi.NONE;const z=r!=null?3-Math.min(_,2):1;if(A*z=e.maxLod)return M();if(n<7)return hi.SPLIT;De(ll,this.up,I),je(ll,ll,o);const k=El(ll);if(k<=this.radius*this.radius)return hi.SPLIT;De(ll,ll,this.radius/Math.sqrt(k)),Be(ll,ll,this._center[l]),je(ll,i,ll);const U=Math.min(1,(Math.abs(Ve(ll,this.up))+.5*L+this._curvatureHeight)/rt(ll)),j=d$t/e.angledSplitBias,H=e.fovY*x*2;return U*(this._edgeLen/H*z){n.requestPromise===s&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=s,s.then(o,o),!0}get isLeaf(){return this._children[0]==null}hasLij(e){return this.lij[0]===e[0]&&this.lij[1]===e[1]&&this.lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;const i=this._children;return i[0]?i[0].findByLij(e)||i[1].findByLij(e)||i[2].findByLij(e)||i[3].findByLij(e):null}distanceToSquared(e){return El(je(ll,this._center[Fo.MIDDLE],e))}containsPoint(e){const i=this.extent;return e[0]>=i[0]&&e[1]>=i[1]&&e[0]<=i[2]&&e[1]<=i[3]}containsPointXY(e,i){const r=this.extent;return e>=r[0]&&i>=r[1]&&e<=r[2]&&i<=r[3]}unrequestLayerData(e,i,r){const n=this.layerInfo[i][e],s=n.waitingAgents,o=s.removeUnordered(r)!=null;ry(o,"agent has not requested this piece of map data"),s.length<1&&(n.abortRequest(),this.setMemoryDirty())}dataArrived(e,i,r){const n=r!=null&&"type"in r&&r.type==="vector-tile",s=this.layerInfo[i][e];s.data=r,s.dataInvalidated=!1,s.waitingAgents.forAll(o=>o.dataArrived(this,n)),s.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,i,r){r.notInTilemap||console.error(`Tile ${this.lij.toString()} layer ${i}/${e} error ${r}`);const n=this.layerInfo[i][e];n.dataMissing=!0,n.waitingAgents.forAll(s=>s.dataMissing()),n.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,i,r){switch(r&&this.forEachLoadedNeighbor(n=>n.updateRenderData(e,i)),e){case Yi.MAP:return this._updateTexture(i);case Yi.ELEVATION:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===ua.FADING?hi.TEXTURE_NOFADING:hi.TEXTURE_FADING),this.setPendingUpdate(e===ua.FADING?hi.TEXTURE_FADING:hi.TEXTURE_NOFADING))}_updateGeometry(){this.setPendingUpdate(hi.GEOMETRY);for(const e of this.layerInfo[Yi.ELEVATION])e.pendingUpdates|=hi.GEOMETRY}invalidateLayerData(e,i){this.layerInfo[i][e].invalidateSourceData(),this.restartAgents(i)}computeElevationBounds(){const e=this._elevationBounds,i=e[0],r=e[1];or(e,1/0,-1/0);const n=this.layerInfo[Yi.ELEVATION];let s=!0;for(const o of n)o.elevationBounds!=null&&(e[0]=Math.min(e[0],o.elevationBounds.min),e[1]=Math.max(e[1],o.elevationBounds.max),o.elevationBounds.hasNoDataValues||(s=!1));s&&(e[0]=Math.min(e[0],0),e[1]=Math.max(e[1],0)),i===e[0]&&r===e[1]||(this.updateRadiusAndCenter(),this._surface.setTileTreeDirty())}_updateCenter(){const e=this._elevationBounds,i=.5*(e[0]+e[1]),r=this._center;De(ll,this.up,i),Be(r[Fo.MIDDLE],this.centerAtSeaLevel,ll),De(ll,this.up,e[0]),Be(r[Fo.TOP],this.centerAtSeaLevel,ll),De(ll,this.up,e[1]),Be(r[Fo.BOTTOM],this.centerAtSeaLevel,ll)}findElevationBoundsForLayer(e,i){const r=this.layerInfo[Yi.ELEVATION][e],n=See(this.level),s=Math.max(this.elevationLevel-n,0),o=r.elevationBounds;if(o!=null&&o.level>=i&&o.level<=s)return;const l=this._surface.layerViewByIndex(e,Yi.ELEVATION),c=Rie(l);if(!F$(this,c,!1))return;const f=f$t;let _=!1;const x=r.data;if(x&&x.level<=s){const T=r.data;f.min=T.samplerData.data.minValue,f.max=T.samplerData.data.maxValue,f.hasNoDataValues=T.samplerData.data.hasNoDataValues,f.level=this.level,_=!0}else{let T,A,M=0;for(let I=this._parent;I&&(!A||M-1?s[c]:dk.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,ua.FADING))}updateAgents(e){if(this.renderData){const i=this.layerInfo[e];for(const r of i)r.loadingAgent===hh&&(r.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of rS){const i=this._isSuspended(e);for(const r of this.layerInfo[e])r.loadingAgent&&r.loadingAgent!==hh&&(r.loadingAgent.setSuspension(i),r.loadingAgent===hh&&this.updateRenderData(e,ua.FADING))}}removeLayerAgent(e,i){const r=this.layerInfo[i][e];r.loadingAgent&&r.loadingAgent!==hh&&r.loadingAgent.dispose(),r.loadingAgent=null}agentDone(e,i){const r=this.layerInfo[i][e];r.loadingAgent=hh,r.data||r.upsampleInfo!=null||this._createOrUpdateAgents(e+1,i)}_hasBlendableAncestor(e){return e.blendMode!=="normal"||QO(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,i,r){var n,s,o;for(let l=e;l=e[0]&&e[2]>=i[2]&&i[1]>=e[1]&&e[3]>=i[3]}intersectsExtent(e){const i=this.extent;return i[2]>=e[0]&&e[2]>=i[0]&&i[3]>=e[1]&&e[3]>=i[1]}getElevationVerticesPerSide(e){const i=this.elevationLevel-this.level,r=Math.max(this.level-e,See(this.level)-i),n=Je(1+(this.maxTesselation>>r),2,this.maxTesselation+1),s=this.getDefaultVerticesPerSide();return Math.max(n,s)}get test(){return{cachedMemory:this._cachedMemory}}_findLIJ(e,i){if(!e)return null;const r=this.surface.rootTiles;if(r!=null){for(const n of r)if(m$t(n,e)){let s=n,o=e[0]-s.level-1;for(;o>=0&&!s.isLeaf&&!i(s);){const l=e[1]>>o&1,c=e[2]>>o&1;s=s.children[2*l+c],o--}return i(s)?s:null}}return null}findNeighborTile(e,i){const r=this.lij,n=this.getNeighborLIJ(r,e);return n?g$t(r,n)?i(this)?this:null:this._findLIJ(n,i):null}findCorner(e,i){const r=e===ti.NORTH_EAST?1:e===ti.NORTH_WEST?0:e===ti.SOUTH_WEST?2:3;let n=this;for(;n.children[0]&&(!i||!i(n));)n=n.children[r];return n}findNeighborCornerTileExact(e,i){var r;return((r=this.findNeighborTile(e,n=>i(n)||n.level===this.level))==null?void 0:r.findCorner(lV(e),i))||null}forAllSubtreeOnSide(e,i){const r=e===ti.NORTH?[0,1]:e===ti.NORTH_EAST?[1]:e===ti.EAST?[1,3]:e===ti.SOUTH_EAST?[3]:e===ti.SOUTH?[2,3]:e===ti.SOUTH_WEST?[2]:e===ti.WEST?[0,2]:[0],n=s=>{const o=s.children;!i(s)&&o[0]&&r.forEach(l=>n(o[l]))};n(this)}getNeighborEdgeStartVertexIndex(e,i){if(!i)return 0;const r=this.level-i.level;if(ot(!pa||r>=0),r===0)return 0;const n=2**r,s=(1&e)==1,o=s?0:1,l=i.lij[o+1]*n,c=this.lij[o+1],f=c-l,_=s?n-1-f:f;return pa&&(ot(l<=c&&cn.level===i||n.isLoaded;qv.forEach(n=>{const s=this.findNeighborTile(n,r);s!=null&&s!==this&&s.forAllSubtreeOnSide(Sce(n),o=>!!o.isLoaded&&(e(o,n),!0))}),cV.forEach(n=>{var o;const s=(o=this.findNeighborTile(n,r))==null?void 0:o.findCorner(lV(n),l=>l.isLoaded);ot(!s||Fie(this,s,n)),s!=null&&s.isLoaded&&e(s,n)})}getNeighborLIJ(e,i){const r=d_e(i)?-1:h_e(i)?1:0,n=c_e(i)?-1:u_e(i)?1:0,s=[e[0],e[1]+r,e[2]+n];return s[1]<0?null:this.surface.isGlobal?this.wrapLIJ(s):s[2]<0?null:s}wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}get westNeighborWestExtent(){return this.extent[0]*(this.isWestEnd?-1:1)}get eastNeighborEastExtent(){return this.extent[2]*(this.isEastEnd?-1:1)}get isEastEnd(){return this.lij[2]===this.surface.lijEastEnd(this.level)-1}get isWestEnd(){return this.lij[2]===0}get isNorthEnd(){return this.lij[1]===0}get isSouthEnd(){const e=this.surface.extent,i=(e==null?void 0:e[1])??null;return i!=null&&this.extent[1]+sl()>=i}checkGeometryWaterproofness(){var e;oV&&(ot(this.isLoaded),(e=this.renderData)==null||e.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const i=this.extent,r=this.surface.rootTilesExtent,n=.25*(i[2]-i[0]);if(d_e(e)&&i[3]+n>=r[3]||h_e(e)&&i[1]-n<=r[1])return!1;const s=this.surface.isGlobal;return!(!s&&c_e(e)&&i[0]-n<=r[0])&&!(!s&&u_e(e)&&i[2]+n>=r[2])}updateDistanceToPOI(e){const i=this._lastPOI;if(this.distanceToPOI>=0&&i[0]===e[0]&&i[1]===e[1]&&i[2]===e[2])return;Ne(this._lastPOI,e);const r=this._center[Fo.MIDDLE],n=e[0]-r[0],s=e[1]-r[1],o=e[2]-r[2];this.distanceToPOI=n*n+s*s+o*o}};function p$t(t,e,i,r){const n=i===Yi.ELEVATION?Mce.acquire():Ace.acquire();return n.init(t,e,i,r),n}function p8(t){t.dispose(),t instanceof fFe?Mce.release(t):t instanceof mFe&&Ace.release(t)}const Ace=new Ec(mFe),Mce=new Ec(fFe),f$t=new BM;var Fo;function m$t(t,e){const i=t.level,r=e[0];if(i>r)return!1;const n=r-i,s=Math.floor(e[1]/2**n),o=Math.floor(e[2]/2**n);return s===t.lij[1]&&o===t.lij[2]}function g$t(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function y$t(t,e,i){if(t==null||e==null)return!1;if(t.level===0&&e.level===0&&(t.isEastEnd&&e.isWestEnd&&i===ti.EAST||t.isWestEnd&&e.isEastEnd&&i===ti.WEST))return!0;const r=Math.max(1e-6*(t.extent[2]-t.extent[0]),1);switch(i){case ti.NORTH:return bf(t.extent[3],e.extent[1],r);case ti.SOUTH:return bf(t.extent[1],e.extent[3],r);case ti.EAST:return bf(t.extent[2],e.extent[0],r)||bf(t.extent[2],-e.extent[0],r);case ti.WEST:return bf(t.extent[0],e.extent[2],r)||bf(t.extent[0],-e.extent[2],r)}}function Fie(t,e,i){return t!=null&&e!=null&&e!==t&&(t.level>=e.level?E_e(t,e,i):E_e(e,t,lV(i)))}function E_e(t,e,i){ot(t.level>=e.level);const r=q4t(i),n=W4t(i),s=t.extent,o=e.extent,l=[r?s[0]:s[2],n?s[3]:s[1]],c=[r?o[2]:o[0],n?o[1]:o[3]],f=1e-5*(s[2]-s[0]),_=bf(l[0],c[0],f)||t.surface.isGlobal&&bf(l[0],-c[0],f),x=bf(l[1],c[1],f);if(_&&x)return!0;if(t.level===e.level||!_&&!x)return ot(!1),!1;const T=_?C_e(o[1],o[3],s[1],s[3],f):C_e(o[0],o[2],s[0],s[2],f);return ot(T),T}function C_e(t,e,i,r,n){return t-n<=i&&i<=r&&r<=e+n}(function(t){t[t.TOP=0]="TOP",t[t.MIDDLE=1]="MIDDLE",t[t.BOTTOM=2]="BOTTOM"})(Fo||(Fo={}));const f8=W(),yY=W(),vY=W(),ll=W();let v$t=class{constructor(){this._scales=Mi(-1,-1,-1,-1),this._offsets=Mi(-1,-1,-1,-1)}clear(){this._scales[0]=this._scales[1]=this._scales[2]=this._scales[3]=-1,this._offsets[0]=this._offsets[1]=this._offsets[2]=this._offsets[3]=-1}setScale(e,i,r){this._scales[2*e]=i,this._scales[2*e+1]=r}setOffset(e,i,r){this._offsets[2*e]=i,this._offsets[2*e+1]=r}get scales(){return this._scales}get offsets(){return this._offsets}};function _$t(t,e){t.varyings.add("tbnTangent","vec3"),t.varyings.add("tbnBiTangent","vec3"),e.spherical?t.vertex.code.add(V`void forwardVertexTangent(vec3 n) { + `)}const i4t=Object.freeze(Object.defineProperty({__proto__:null,ColorizerHillshadeUniforms:yFe,ColorizerStretchUniforms:gFe,ColorizerUniforms:y6,build:vFe},Symbol.toStringTag,{value:"Module"}));function r4t(t,e,i="nearest",r=!1){var p;const n=!(r&&e.pixelType==="u8"),s=n?ya.FLOAT:ya.UNSIGNED_BYTE,o=e.pixels==null||e.pixels.length===0?null:n?e.getAsRGBAFloat():e.getAsRGBA(),a=(p=t.capabilities.textureFloat)==null?void 0:p.textureFloatLinear,c=new rn;return c.width=e.width,c.height=e.height,c.internalFormat=t.type===cr.WEBGL2&&n?zt.RGBA32F:ci.RGBA,c.samplingMode=!a||i!=="bilinear"&&i!=="cubic"?ki.NEAREST:ki.LINEAR,c.dataType=s,c.wrapMode=Bi.CLAMP_TO_EDGE,new Ai(t,c,o)}function n4t(t,e){const{spacing:i,offsets:r,coefficients:n,size:[s,o]}=e,a=i[0]>1,c=new rn;c.width=a?4*s:s,c.height=o,c.internalFormat=t.type===cr.WEBGL2?zt.RGBA32F:ci.RGBA,c.dataType=ya.FLOAT,c.samplingMode=ki.NEAREST,c.wrapMode=Bi.CLAMP_TO_EDGE;const p=new Float32Array(a?s*o*16:2*r.length);if(a&&n!=null)for(let _=0,x=0;_0?this._bandIds&&e.every((i,r)=>{var n;return!!((n=this._bandIds)!=null&&n[r])&&i===this._bandIds[r]})||(this._bandIds=e,this._dirty=!0):this._bandIds=null}get interpolation(){return this._interpolation||"nearest"}set interpolation(e){if(this._interpolation=e,this._rasterTexture!=null){const i=this._getRasterTextureInterpolation(e);this._rasterTexture.setSamplingMode(i==="bilinear"?ki.LINEAR:ki.NEAREST)}}get transformGrid(){return this._transformGrid}set transformGrid(e){this._transformGrid=e,this._transformGridTexture=Kt(this._transformGridTexture),this._memoryUsed=null}bind(e){return!!(this.source&&this.source.pixels&&this.source.pixels.length>0)&&((this._rasterTexture==null||this._dirty)&&this._updateRasterTexture(e,this.bandIds),this._rasterTexture!=null&&(this._updateColormapTexture(e),this.transformGrid&&this._transformGridTexture==null&&(this._transformGridTexture=n4t(e,this.transformGrid))),!0)}getUniforms(){const{symbolizerParameters:e,transformGrid:i,width:r,height:n,opacity:s}=this,o=s4t(i,[r,n],[this.source.width,this.source.height],s),a=o4t(e.colormap,e.colormapOffset),c=this.symbolizerParameters.type==="stretch"?a4t(this.symbolizerParameters):null,p=this.symbolizerParameters.type==="hillshade"?l4t(this.symbolizerParameters):null;return new y6(o,a,c||p,this._rasterTexture,this._transformGridTexture,this._colormapTexture)}get isBilinearWithStretchColorRamp(){const{symbolizerParameters:e}=this;return this.interpolation==="bilinear"&&e.colormap!=null&&e.type==="stretch"}get memoryUsage(){if(this._memoryUsed==null){const e=[this._rasterTexture,this._transformGridTexture,this._colormapTexture];this._memoryUsed=e.map(i=>i!=null?i.descriptor.width*i.descriptor.height*4:0).reduce((i,r)=>i+r,0)}return this._memoryUsed}release(){return this._rasterTexture=Kt(this._rasterTexture),this._transformGridTexture=Kt(this._transformGridTexture),this._colormapTexture=Kt(this._colormapTexture),this.source=null,this.transformGrid=null,this.rawPixelData=null,!0}_updateRasterTexture(e,i){const r=this.source?this.source.extractBands(i):null;if(!(r&&r.pixels&&r.pixels.length>0))return void(this._rasterTexture=Kt(this._rasterTexture));const n=i==null&&this.bandIds==null||i!=null&&this.bandIds!=null&&i.join("")===this.bandIds.join("");if(this._rasterTexture!=null&&n)return;this._rasterTexture=Kt(this._rasterTexture);const s=this._getRasterTextureInterpolation(this.interpolation);this._rasterTexture=r4t(e,r,s,this.isRendereredSource||this.hasStretchTypeNone())}hasStretchTypeNone(){return"stretchType"in this.symbolizerParameters&&this.symbolizerParameters.stretchType==="none"&&!this.symbolizerParameters.useGamma&&this.source.pixelType==="u8"}_getRasterTextureInterpolation(e){return this.symbolizerParameters.type==="lut"||e==="nearest"||e==="majority"||this.isBilinearWithStretchColorRamp?"nearest":"bilinear"}_updateColormapTexture(e){const i=this._colormap,r=this.symbolizerParameters.colormap;return r?i?r.length!==i.length||r.some((n,s)=>n!==i[s])?(this._colormapTexture=Kt(this._colormapTexture),this._colormapTexture=T_e(e,r),void(this._colormap=r)):void 0:(this._colormapTexture=T_e(e,r),void(this._colormap=r)):(this._colormapTexture=Kt(this._colormapTexture),void(this._colormap=null))}},xk=class{constructor(){this.waitingAgents=new Pi,this._upsampleInfo=null,this.loadingAgent=null,this.requestPromise=null,this.requestAbort=null,this.pendingUpdates=0}static acquire(e){const i=CY.acquire();return i._init(e),i}release(){this.dispose(),Sk.delete(this),CY.release(this)}dispose(){this.loadingAgent=Kt(this.loadingAgent),this.abortRequest(),this._unsetUpsampleInfo(),this.pendingUpdates=0,this._data=$O(this._data)}static prune(){CY.prune(0)}_init(e){this.waitingAgents.clear(),this._data=$O(this._data),this.dataMissing=!1,this.dataInvalidated=!1,this._unsetUpsampleInfo(),this.abortRequest(),this.loadingAgent=null,this.pendingUpdates=0,this._pool=e,this.elevationBounds=null}invalidateSourceData(){this.dataInvalidated=!0,this.dataMissing=!1,this._unsetUpsampleInfo()}abortRequest(){this.requestAbort=vn(this.requestAbort),this.requestPromise=null}get upsampleInfo(){return this._upsampleInfo}_unsetUpsampleInfo(){this._upsampleInfo!=null&&(this._upsampleInfo.tile.unrefMapData(),this._pool.release(this._upsampleInfo),this._upsampleInfo=null)}setUpsampleInfo(e,i){if(e!==i&&i!=null){if(this._upsampleInfo==null)this._upsampleInfo=this._pool.acquire();else{if(this._upsampleInfo.tile===i)return;this._upsampleInfo.tile.unrefMapData()}i.refMapData(),GIt(e,i,this._upsampleInfo)}else this._unsetUpsampleInfo()}get data(){return this._data}set data(e){$O(this._data),this._data=e}};const CY=new Ql(xk,null,()=>{}),Sk=new Map;function u4t(){Sk.size>0&&(console.log(`${Sk.size} live TilePerLayerInfo allocations:`),Sk.forEach(t=>console.log(t,` +`)))}let P4=class{constructor(e,i){this._texture=e,this._cache=i,this.type="tile-texture",this._refCount=1}retain(){++this._refCount}release(){if(--this._refCount,this._refCount===0)if(this._cache){const e=`${this._texture.descriptor.width} ${this._texture.descriptor.pixelFormat}`;this._cache.put(e,this)}else this.dispose()}dispose(){this._texture.dispose()}get texture(){return this._texture}generateMipmap(){this._texture.generateMipmap()}get descriptor(){return this._texture.descriptor}get usedMemory(){return this._texture.gpuMemoryUsage}};var hi;(function(t){t[t.NONE=0]="NONE",t[t.SPLIT=1]="SPLIT",t[t.ELEVATION=2]="ELEVATION",t[t.MERGE=4]="MERGE",t[t.RENDERDATA=8]="RENDERDATA",t[t.GEOMETRY=16]="GEOMETRY",t[t.TEXTURE_NOFADING=32]="TEXTURE_NOFADING",t[t.TEXTURE_FADING=64]="TEXTURE_FADING"})(hi||(hi={}));const h4t=.1;let zce=class{constructor(){this.lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this.renderData=null,this._dirty=!0,this._previouslyRendered=!1,this.extent=Ni(),this._elevationBounds=yt(),this.layerInfo=[[],[]],this.extentInRadians=Ni(),this.centerAtSeaLevel=W(),this._center=[W(),uo(),W()],this.up=Zne(),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=null,this._mapTileMemoryInternal=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=W()}static prune(){Uce.prune(0),Vce.prune(0),xk.prune()}get _isCached(){return!this.shouldLoad&&this._mapDataRefCount<=0}get maxTesselation(){return this._maxTesselation}get isWithinClippingArea(){return this._isWithinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBounds(){return this._elevationBounds}get level(){return this.lij[0]}get key(){return`${this.lij[0]}/${this.lij[1]}/${this.lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[ko.MIDDLE][3]}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}computeVisibility(){this._dirty=!1;const e=this.parent,i=(e==null?void 0:e.frustumVisibility)??_c.INTERSECTS;this._frustumVisibility=i===_c.INSIDE?_c.INSIDE:i===_c.OUTSIDE?_c.OUTSIDE:this._calculateFrustumVisibilityStatus(this.surface.frustum);const r=this._frustumVisibility!==_c.OUTSIDE&&this._intersectsClippingArea;r!==this._visible&&(this._visible=r,this._surface.emit("tiles-visibility-changed"),this._surface.renderer.setDirty(),this.updateAgentSuspension())}get loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){const e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit("tiles-visibility-changed"),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}get shouldLoad(){return this.isLeaf}init(e,i,r,n,s){this.lij[0]=e,this.lij[1]=i,this.lij[2]=r,this.ellipsoid=Tr(s.tilingScheme.spatialReference),s.tilingScheme.getExtent(e,i,r,this.extent),s.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._isWithinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,s.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[ko.MIDDLE][3]=0,this.elevationLevel=e,n&&n.elevationBounds?ea(this._elevationBounds,n.elevationBounds):or(this._elevationBounds,0,0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=n,this.unsetChildren(),this._surface=s,this.updateVisibility();for(const o of cS){const a=s.numLayers(o),c=this.layerInfo[o];for(const p of c)p.release();c.length=a;for(let p=0;p0&&this._surface.upsampleMapCache.put(this.key,this,e)}}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this._ensureUsedMemory()+(this._isCached?0:this._mapTileMemoryInternal)}get _cachedMemory(){return this._isCached?this._mapTileMemory:0}get _mapTileMemory(){return this._ensureUsedMemory(),this.layerInfo[Yi.MAP].reduce((e,i)=>e+(i instanceof EY?i.memoryUsed/i.referenced:0),this._mapTileMemoryInternal)}get _cpuImageMemorySize(){const i=this._surface.tilingScheme.pixelSize;return i*i*4}_ensureUsedMemory(){var r;if(this._usedMemory!=null)return this._usedMemory;this._usedMemory=this._baseUsedMemory,this._mapTileMemoryInternal=0;let e=0;for(const{data:n}of this.layerInfo[Yi.MAP])n instanceof EY?e+=this._getTerrainDataMemory(n):this._mapTileMemoryInternal+=this._getTerrainDataMemory(n);const i=this._cpuImageMemorySize;for(const n of this.layerInfo[Yi.ELEVATION])this._usedMemory+=n.data?i:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._mapTileMemoryInternal+=((r=this.renderData.texture)==null?void 0:r.usedMemory)??0),this._isCached&&this._surface.upsampleMapCache.updateSize(this.key,this,this._mapTileMemoryInternal+e),this._usedMemory}getUsedMemoryForLayer(e,i){const r=this.layerInfo[e][i];return r!=null&&r.data?e===Yi.MAP?this._isCached?0:this._getTerrainDataMemory(r.data):e===Yi.ELEVATION?this._cpuImageMemorySize:0:0}_getTerrainDataMemory(e){return e instanceof P4?e.texture.gpuMemoryUsage:e instanceof HTMLImageElement||e instanceof Lce?this._cpuImageMemorySize:e instanceof c4t?e.memoryUsage:e instanceof EY?e.memoryUsed/e.referenced:0}updateScreenDepth(e){const i=this._center[ko.MIDDLE],r=e,n=i[0],s=i[1],o=i[2],a=r[2]*n+r[6]*s+r[10]*o+r[14];this.screenDepth=a<0?0:a/(r[3]*n+r[7]*s+r[11]*o+r[15])}shouldSplit(e,i,r){if(!this.visible||e.frustum&&(!this._intersectsClippingArea||this._calculateFrustumVisibilityStatus(e.frustum)===_c.OUTSIDE))return hi.NONE;const n=this.level;je(w8,this._center[ko.MIDDLE],i);let s=Al(w8),o=w8,a=ko.MIDDLE;je(AY,this._center[ko.TOP],i);const c=Al(AY);cs&&n{if(n0&&F<.001&&P/x-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-F>0)return hi.NONE;const z=r!=null?3-Math.min(_,2):1;if(C*z=e.maxLod)return M();if(n<7)return hi.SPLIT;De(ul,this.up,P),je(ul,ul,o);const k=Al(ul);if(k<=this.radius*this.radius)return hi.SPLIT;De(ul,ul,this.radius/Math.sqrt(k)),Be(ul,ul,this._center[a]),je(ul,i,ul);const U=Math.min(1,(Math.abs(Ve(ul,this.up))+.5*$+this._curvatureHeight)/nt(ul)),j=h4t/e.angledSplitBias,G=e.fovY*x*2;return U*(this._edgeLen/G*z){n.requestPromise===s&&(n.requestPromise=null,n.requestAbort=null)};return n.requestPromise=s,s.then(o,o),!0}get isLeaf(){return this._children[0]==null}hasLij(e){return this.lij[0]===e[0]&&this.lij[1]===e[1]&&this.lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;const i=this._children;return i[0]?i[0].findByLij(e)||i[1].findByLij(e)||i[2].findByLij(e)||i[3].findByLij(e):null}distanceToSquared(e){return Al(je(ul,this._center[ko.MIDDLE],e))}containsPoint(e){const i=this.extent;return e[0]>=i[0]&&e[1]>=i[1]&&e[0]<=i[2]&&e[1]<=i[3]}containsPointXY(e,i){const r=this.extent;return e>=r[0]&&i>=r[1]&&e<=r[2]&&i<=r[3]}unrequestLayerData(e,i,r){const n=this.layerInfo[i][e],s=n.waitingAgents,o=s.removeUnordered(r)!=null;ly(o,"agent has not requested this piece of map data"),s.length<1&&(n.abortRequest(),this.setMemoryDirty())}dataArrived(e,i,r){const n=r!=null&&"type"in r&&r.type==="vector-tile",s=this.layerInfo[i][e];s.data=r,s.dataInvalidated=!1,s.waitingAgents.forAll(o=>o.dataArrived(this,n)),s.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,i,r){r.notInTilemap||console.error(`Tile ${this.lij.toString()} layer ${i}/${e} error ${r}`);const n=this.layerInfo[i][e];n.dataMissing=!0,n.waitingAgents.forAll(s=>s.dataMissing()),n.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,i,r){switch(r&&this.forEachLoadedNeighbor(n=>n.updateRenderData(e,i)),e){case Yi.MAP:return this._updateTexture(i);case Yi.ELEVATION:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===ha.FADING?hi.TEXTURE_NOFADING:hi.TEXTURE_FADING),this.setPendingUpdate(e===ha.FADING?hi.TEXTURE_FADING:hi.TEXTURE_NOFADING))}_updateGeometry(){this.setPendingUpdate(hi.GEOMETRY);for(const e of this.layerInfo[Yi.ELEVATION])e.pendingUpdates|=hi.GEOMETRY}invalidateLayerData(e,i){this.layerInfo[i][e].invalidateSourceData(),this.restartAgents(i)}computeElevationBounds(){const e=this._elevationBounds,i=e[0],r=e[1];or(e,1/0,-1/0);const n=this.layerInfo[Yi.ELEVATION];let s=!0;for(const o of n)o.elevationBounds!=null&&(e[0]=Math.min(e[0],o.elevationBounds.min),e[1]=Math.max(e[1],o.elevationBounds.max),o.elevationBounds.hasNoDataValues||(s=!1));s&&(e[0]=Math.min(e[0],0),e[1]=Math.max(e[1],0)),i===e[0]&&r===e[1]||(this.updateRadiusAndCenter(),this._surface.setTileTreeDirty())}_updateCenter(){const e=this._elevationBounds,i=.5*(e[0]+e[1]),r=this._center;De(ul,this.up,i),Be(r[ko.MIDDLE],this.centerAtSeaLevel,ul),De(ul,this.up,e[0]),Be(r[ko.TOP],this.centerAtSeaLevel,ul),De(ul,this.up,e[1]),Be(r[ko.BOTTOM],this.centerAtSeaLevel,ul)}findElevationBoundsForLayer(e,i){const r=this.layerInfo[Yi.ELEVATION][e],n=Ree(this.level),s=Math.max(this.elevationLevel-n,0),o=r.elevationBounds;if(o!=null&&o.level>=i&&o.level<=s)return;const a=this._surface.layerViewByIndex(e,Yi.ELEVATION),c=zie(a);if(!W$(this,c,!1))return;const p=p4t;let _=!1;const x=r.data;if(x&&x.level<=s){const S=r.data;p.min=S.samplerData.data.minValue,p.max=S.samplerData.data.maxValue,p.hasNoDataValues=S.samplerData.data.hasNoDataValues,p.level=this.level,_=!0}else{let S,C,M=0;for(let P=this._parent;P&&(!C||M-1?s[c]:xk.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,ha.FADING))}updateAgents(e){if(this.renderData){const i=this.layerInfo[e];for(const r of i)r.loadingAgent===ph&&(r.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(const e of cS){const i=this._isSuspended(e);for(const r of this.layerInfo[e])r.loadingAgent&&r.loadingAgent!==ph&&(r.loadingAgent.setSuspension(i),r.loadingAgent===ph&&this.updateRenderData(e,ha.FADING))}}removeLayerAgent(e,i){const r=this.layerInfo[i][e];r.loadingAgent&&r.loadingAgent!==ph&&r.loadingAgent.dispose(),r.loadingAgent=null}agentDone(e,i){const r=this.layerInfo[i][e];r.loadingAgent=ph,r.data||r.upsampleInfo!=null||this._createOrUpdateAgents(e+1,i)}_hasBlendableAncestor(e){return e.blendMode!=="normal"||lP(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,i,r){var n,s,o;for(let a=e;a=e[0]&&e[2]>=i[2]&&i[1]>=e[1]&&e[3]>=i[3]}intersectsExtent(e){const i=this.extent;return i[2]>=e[0]&&e[2]>=i[0]&&i[3]>=e[1]&&e[3]>=i[1]}getElevationVerticesPerSide(e){const i=this.elevationLevel-this.level,r=Math.max(this.level-e,Ree(this.level)-i),n=Je(1+(this.maxTesselation>>r),2,this.maxTesselation+1),s=this.getDefaultVerticesPerSide();return Math.max(n,s)}get test(){return{cachedMemory:this._cachedMemory}}_findLIJ(e,i){if(!e)return null;const r=this.surface.rootTiles;if(r!=null){for(const n of r)if(f4t(n,e)){let s=n,o=e[0]-s.level-1;for(;o>=0&&!s.isLeaf&&!i(s);){const a=e[1]>>o&1,c=e[2]>>o&1;s=s.children[2*a+c],o--}return i(s)?s:null}}return null}findNeighborTile(e,i){const r=this.lij,n=this.getNeighborLIJ(r,e);return n?m4t(r,n)?i(this)?this:null:this._findLIJ(n,i):null}findCorner(e,i){const r=e===ii.NORTH_EAST?1:e===ii.NORTH_WEST?0:e===ii.SOUTH_WEST?2:3;let n=this;for(;n.children[0]&&(!i||!i(n));)n=n.children[r];return n}findNeighborCornerTileExact(e,i){var r;return((r=this.findNeighborTile(e,n=>i(n)||n.level===this.level))==null?void 0:r.findCorner(cV(e),i))||null}forAllSubtreeOnSide(e,i){const r=e===ii.NORTH?[0,1]:e===ii.NORTH_EAST?[1]:e===ii.EAST?[1,3]:e===ii.SOUTH_EAST?[3]:e===ii.SOUTH?[2,3]:e===ii.SOUTH_WEST?[2]:e===ii.WEST?[0,2]:[0],n=s=>{const o=s.children;!i(s)&&o[0]&&r.forEach(a=>n(o[a]))};n(this)}getNeighborEdgeStartVertexIndex(e,i){if(!i)return 0;const r=this.level-i.level;if(at(!fa||r>=0),r===0)return 0;const n=2**r,s=(1&e)==1,o=s?0:1,a=i.lij[o+1]*n,c=this.lij[o+1],p=c-a,_=s?n-1-p:p;return fa&&(at(a<=c&&cn.level===i||n.isLoaded;Qv.forEach(n=>{const s=this.findNeighborTile(n,r);s!=null&&s!==this&&s.forAllSubtreeOnSide(Nce(n),o=>!!o.isLoaded&&(e(o,n),!0))}),uV.forEach(n=>{var o;const s=(o=this.findNeighborTile(n,r))==null?void 0:o.findCorner(cV(n),a=>a.isLoaded);at(!s||Hie(this,s,n)),s!=null&&s.isLoaded&&e(s,n)})}getNeighborLIJ(e,i){const r=p_e(i)?-1:d_e(i)?1:0,n=u_e(i)?-1:h_e(i)?1:0,s=[e[0],e[1]+r,e[2]+n];return s[1]<0?null:this.surface.isGlobal?this.wrapLIJ(s):s[2]<0?null:s}wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}get westNeighborWestExtent(){return this.extent[0]*(this.isWestEnd?-1:1)}get eastNeighborEastExtent(){return this.extent[2]*(this.isEastEnd?-1:1)}get isEastEnd(){return this.lij[2]===this.surface.lijEastEnd(this.level)-1}get isWestEnd(){return this.lij[2]===0}get isNorthEnd(){return this.lij[1]===0}get isSouthEnd(){const e=this.surface.extent,i=(e==null?void 0:e[1])??null;return i!=null&&this.extent[1]+al()>=i}checkGeometryWaterproofness(){var e;aV&&(at(this.isLoaded),(e=this.renderData)==null||e.checkGeometryWaterproofness())}shouldHaveNeighbor(e){const i=this.extent,r=this.surface.rootTilesExtent,n=.25*(i[2]-i[0]);if(p_e(e)&&i[3]+n>=r[3]||d_e(e)&&i[1]-n<=r[1])return!1;const s=this.surface.isGlobal;return!(!s&&u_e(e)&&i[0]-n<=r[0])&&!(!s&&h_e(e)&&i[2]+n>=r[2])}updateDistanceToPOI(e){const i=this._lastPOI;if(this.distanceToPOI>=0&&i[0]===e[0]&&i[1]===e[1]&&i[2]===e[2])return;Ne(this._lastPOI,e);const r=this._center[ko.MIDDLE],n=e[0]-r[0],s=e[1]-r[1],o=e[2]-r[2];this.distanceToPOI=n*n+s*s+o*o}};function d4t(t,e,i,r){const n=i===Yi.ELEVATION?Vce.acquire():Uce.acquire();return n.init(t,e,i,r),n}function b8(t){t.dispose(),t instanceof hFe?Vce.release(t):t instanceof dFe&&Uce.release(t)}const Uce=new Ql(dFe),Vce=new Ql(hFe),p4t=new ZM;var ko;function f4t(t,e){const i=t.level,r=e[0];if(i>r)return!1;const n=r-i,s=Math.floor(e[1]/2**n),o=Math.floor(e[2]/2**n);return s===t.lij[1]&&o===t.lij[2]}function m4t(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function g4t(t,e,i){if(t==null||e==null)return!1;if(t.level===0&&e.level===0&&(t.isEastEnd&&e.isWestEnd&&i===ii.EAST||t.isWestEnd&&e.isEastEnd&&i===ii.WEST))return!0;const r=Math.max(1e-6*(t.extent[2]-t.extent[0]),1);switch(i){case ii.NORTH:return Ef(t.extent[3],e.extent[1],r);case ii.SOUTH:return Ef(t.extent[1],e.extent[3],r);case ii.EAST:return Ef(t.extent[2],e.extent[0],r)||Ef(t.extent[2],-e.extent[0],r);case ii.WEST:return Ef(t.extent[0],e.extent[2],r)||Ef(t.extent[0],-e.extent[2],r)}}function Hie(t,e,i){return t!=null&&e!=null&&e!==t&&(t.level>=e.level?C_e(t,e,i):C_e(e,t,cV(i)))}function C_e(t,e,i){at(t.level>=e.level);const r=HRt(i),n=qRt(i),s=t.extent,o=e.extent,a=[r?s[0]:s[2],n?s[3]:s[1]],c=[r?o[2]:o[0],n?o[1]:o[3]],p=1e-5*(s[2]-s[0]),_=Ef(a[0],c[0],p)||t.surface.isGlobal&&Ef(a[0],-c[0],p),x=Ef(a[1],c[1],p);if(_&&x)return!0;if(t.level===e.level||!_&&!x)return at(!1),!1;const S=_?A_e(o[1],o[3],s[1],s[3],p):A_e(o[0],o[2],s[0],s[2],p);return at(S),S}function A_e(t,e,i,r,n){return t-n<=i&&i<=r&&r<=e+n}(function(t){t[t.TOP=0]="TOP",t[t.MIDDLE=1]="MIDDLE",t[t.BOTTOM=2]="BOTTOM"})(ko||(ko={}));const w8=W(),AY=W(),MY=W(),ul=W();let y4t=class{constructor(){this._scales=Mi(-1,-1,-1,-1),this._offsets=Mi(-1,-1,-1,-1)}clear(){this._scales[0]=this._scales[1]=this._scales[2]=this._scales[3]=-1,this._offsets[0]=this._offsets[1]=this._offsets[2]=this._offsets[3]=-1}setScale(e,i,r){this._scales[2*e]=i,this._scales[2*e+1]=r}setOffset(e,i,r){this._offsets[2*e]=i,this._offsets[2*e+1]=r}get scales(){return this._scales}get offsets(){return this._offsets}};function v4t(t,e){t.varyings.add("tbnTangent","vec3"),t.varyings.add("tbnBiTangent","vec3"),e.spherical?t.vertex.code.add(V`void forwardVertexTangent(vec3 n) { tbnTangent = normalize(cross(vec3(0.0, 0.0, 1.0), n)); tbnBiTangent = normalize(cross(n, tbnTangent)); }`):t.vertex.code.add(V`void forwardVertexTangent(vec3 n) { @@ -4108,13 +4097,13 @@ tbnTangent = vec3(1.0, 0.0, 0.0); tbnBiTangent = normalize(cross(n, tbnTangent)); }`),t.fragment.code.add(V`mat3 getTBNMatrix(vec3 n) { return mat3(tbnTangent, tbnBiTangent, n); -}`)}var _y;(function(t){t[t.LayerOnly=0]="LayerOnly",t[t.ColorComposite=1]="ColorComposite",t[t.GridComposite=2]="GridComposite",t[t.COUNT=3]="COUNT"})(_y||(_y={}));let b$t=class extends Ole{constructor(){super(...arguments),this.overlayOpacity=1}};function w$t(t,e){const{vertex:i,fragment:r,varyings:n}=t;n.add("vtc","vec2"),i.uniforms.add(new A_e("texOffsetAndScale")),r.uniforms.add(new M_e("tex")),r.uniforms.add(new _Y("textureOpacities"));const s=e.textureFadingEnabled&&!e.renderOccluded;s&&(i.uniforms.add(new A_e("nextTexOffsetAndScale")),n.add("nvtc","vec2"),r.uniforms.add(new M_e("texNext")),r.uniforms.add(new _Y("nextTexOpacities")),r.uniforms.add(new x$t("fadeFactor")));const o=e.tileBlendInput===_y.ColorComposite,l=e.tileBlendInput===_y.GridComposite;l&&r.include(Ece),o&&r.uniforms.add(new _Y("backgroundColor")),i.code.add(V` +}`)}var Ey;(function(t){t[t.LayerOnly=0]="LayerOnly",t[t.ColorComposite=1]="ColorComposite",t[t.GridComposite=2]="GridComposite",t[t.COUNT=3]="COUNT"})(Ey||(Ey={}));let _4t=class extends Ble{constructor(){super(...arguments),this.overlayOpacity=1}};function b4t(t,e){const{vertex:i,fragment:r,varyings:n}=t;n.add("vtc","vec2"),i.uniforms.add(new M_e("texOffsetAndScale")),r.uniforms.add(new O_e("tex")),r.uniforms.add(new OY("textureOpacities"));const s=e.textureFadingEnabled&&!e.renderOccluded;s&&(i.uniforms.add(new M_e("nextTexOffsetAndScale")),n.add("nvtc","vec2"),r.uniforms.add(new O_e("texNext")),r.uniforms.add(new OY("nextTexOpacities")),r.uniforms.add(new w4t("fadeFactor")));const o=e.tileBlendInput===Ey.ColorComposite,a=e.tileBlendInput===Ey.GridComposite;a&&r.include(kce),o&&r.uniforms.add(new OY("backgroundColor")),i.code.add(V` void forwardTextureCoordinatesWithTransform(in vec2 uv) { vtc = uv * texOffsetAndScale.zw + texOffsetAndScale.xy; ${s?V`nvtc = uv * nextTexOffsetAndScale.zw + nextTexOffsetAndScale.xy;`:V``} }`),r.code.add(V` vec4 getColor(vec4 color, vec2 uv, vec3 opacities) { - ${l||o?V` + ${a||o?V` if (opacities.y <= 0.0) { return color * opacities.z * opacities.x; } @@ -4130,12 +4119,12 @@ vec4 nextColor = getColor(texture(texNext, nvtc), nvtc, nextTexOpacities); return mix(nextColor, color, fadeFactor); }`):r.code.add(V`vec4 getTileColor() { return getColor(texture(tex, vtc), vtc, textureOpacities); -}`)}let x$t=class extends Ls{constructor(e){super(e,"float")}},_Y=class extends Ls{constructor(e){super(e,"vec3")}},A_e=class extends Ls{constructor(e){super(e,"vec4")}},M_e=class extends Ls{constructor(e){super(e,"sampler2D")}},Oce=class extends b$t{};function xFe(t){const e=new Cr,{vertex:i,fragment:r,varyings:n}=e;e.include(W9),e.include(n6,t),e.include(My,t);const s=()=>{e.include(GL,t),i.code.add(V`vec3 getNormal() { +}`)}let w4t=class extends Ds{constructor(e){super(e,"float")}},OY=class extends Ds{constructor(e){super(e,"vec3")}},M_e=class extends Ds{constructor(e){super(e,"vec4")}},O_e=class extends Ds{constructor(e){super(e,"sampler2D")}},Bce=class extends _4t{};function _Fe(t){const e=new Ar,{vertex:i,fragment:r,varyings:n}=e;e.include(K9),e.include(c6,t),e.include(Ly,t);const s=()=>{e.include(QL,t),i.code.add(V`vec3 getNormal() { float z = 1.0 - abs(normalCompressed.x) - abs(normalCompressed.y); vec3 n = vec3(normalCompressed + vec2(normalCompressed.x >= 0.0 ? 1.0 : -1.0, normalCompressed.y >= 0.0 ? 1.0 : -1.0) * min(z, 0.0), z); return normalize(n); -}`)};Kh(i,t),e.include(Yu,t);const o=t.overlayMode!==vy.Disabled,l=o&&t.invisible;switch(t.output){case ue.Color:{e.include(w$t,t),e.include(JT,t),o&&e.include(mR,{...t,pbrMode:t.pbrMode===ei.Terrain?ei.TerrainWithWater:ei.Water});const c=t.overlayMode===vy.EnabledWithWater;c&&e.include(_$t,t),n.add("vnormal","vec3"),n.add("vpos","vec3"),n.add("vup","vec3"),s(),t.screenSizePerspective&&S5(i);const f=t.receiveShadows&&!t.renderOccluded;f&&e.include(wP,t),t.screenSizePerspective&&(n.add("screenSizeDistanceToCamera","float"),n.add("screenSizeCosAngle","float")),i.code.add(V` +}`)};td(i,t),e.include(Zu,t);const o=t.overlayMode!==Ty.Disabled,a=o&&t.invisible;switch(t.output){case ue.Color:{e.include(b4t,t),e.include(iE,t),o&&e.include(CR,{...t,pbrMode:t.pbrMode===ti.Terrain?ti.TerrainWithWater:ti.Water});const c=t.overlayMode===Ty.EnabledWithWater;c&&e.include(v4t,t),n.add("vnormal","vec3"),n.add("vpos","vec3"),n.add("vup","vec3"),s(),t.screenSizePerspective&&IP(i);const p=t.receiveShadows&&!t.renderOccluded;p&&e.include(R5,t),t.screenSizePerspective&&(n.add("screenSizeDistanceToCamera","float"),n.add("screenSizeCosAngle","float")),i.code.add(V` void main(void) { //Position vpos = position; @@ -4162,13 +4151,13 @@ return normalize(n); vec3 viewSpaceNormal = (viewNormal * vec4(normalize(positionWorld), 1.0)).xyz; screenSizeCosAngle = abs(viewSpaceNormal.z);`:""} - ${f?V`forwardLinearDepth();`:""} + ${p?V`forwardLinearDepth();`:""} } - `),e.include(oo,t),e.include(JT,t),e.include(o6,t),e.include(KT,t),Nm(r,t),a6(r),CP(r),r.uniforms.add(i.uniforms.get("localOrigin"),new Oi("viewDirection",(_,x)=>Ye(O_e,Ie(O_e,x.camera.viewMatrix[12],x.camera.viewMatrix[13],x.camera.viewMatrix[14])))),c&&r.uniforms.add(new Zt("ovWaterTex",(_,x)=>{var T;return(T=x.overlay)==null?void 0:T.getTexture(ns.WaterNormal)}),new W$e("view",(_,x)=>Qu(S$t,x.camera.viewMatrix,_.origin))),r.code.add(V`const float sliceOpacity = 0.2; + `),e.include(ao,t),e.include(iE,t),e.include(h6,t),e.include(rE,t),zm(r,t),d6(r),N5(r),r.uniforms.add(i.uniforms.get("localOrigin"),new Oi("viewDirection",(_,x)=>Ye(P_e,Ie(P_e,x.camera.viewMatrix[12],x.camera.viewMatrix[13],x.camera.viewMatrix[14])))),c&&r.uniforms.add(new Zt("ovWaterTex",(_,x)=>{var S;return(S=x.overlay)==null?void 0:S.getTexture(ns.WaterNormal)}),new j$e("view",(_,x)=>eh(x4t,x.camera.viewMatrix,_.origin))),r.code.add(V`const float sliceOpacity = 0.2; float lum(vec3 c) { return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5; -}`),B_(r),a1(r),r.code.add(V` +}`),W_(r),m1(r),r.code.add(V` void main() { vec3 normal = normalize(vnormal); float vndl = dot(normal, mainLightDirection); @@ -4203,7 +4192,7 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5; vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor; - ${t.pbrMode===ei.Terrain||t.pbrMode===ei.TerrainWithWater?V`fragColor = vec4(evaluateTerrainLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight, normalize(vpos - cameraPosition), vup), tileColor.a);`:V`fragColor = vec4(evaluateSceneLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight), tileColor.a);`} + ${t.pbrMode===ti.Terrain||t.pbrMode===ti.TerrainWithWater?V`fragColor = vec4(evaluateTerrainLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight, normalize(vpos - cameraPosition), vup), tileColor.a);`:V`fragColor = vec4(evaluateSceneLighting(normal, albedo, shadow, 1.0 - ssao, additionalLight), tileColor.a);`} ${c?V` vec4 overlayWaterMask = getOverlayColor(ovWaterTex, vtcOverlay); float waterNormalLength = length(overlayWaterMask); @@ -4249,61 +4238,61 @@ return (min(min(c.r, c.g), c.b) + max(max(c.r, c.g), c.b)) * 0.5; fragColor = mix(fragColor, vec4(1.0, 0.0, 0.0, 1.0), edgeFactor);`:""} fragColor = highlightSlice(fragColor, vpos); } - `)}break;case ue.Depth:l&&e.include(mR,t),e.include(E_,t),B2(e),XT(e),i.code.add(V` + `)}break;case ue.Depth:a&&e.include(CR,t),e.include(I_,t),W2(e),eE(e),i.code.add(V` void main(void) { - ${l?V`setOverlayVTC(getUV0());`:""} + ${a?V`setOverlayVTC(getUV0());`:""} gl_Position = transformPositionWithDepth(proj, view, position, nearFar, linearDepth); } `),r.code.add(V` void main() { - ${l?V`if (getCombinedOverlayColor().a == 0.0) { discard; }`:""} + ${a?V`if (getCombinedOverlayColor().a == 0.0) { discard; }`:""} outputDepth(linearDepth); } - `);break;case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:e.include(E_,t),B2(e),XT(e),i.code.add(V`void main(void) { + `);break;case ue.Shadow:case ue.ShadowHighlight:case ue.ShadowExcludeHighlight:e.include(I_,t),W2(e),eE(e),i.code.add(V`void main(void) { gl_Position = transformPositionWithDepth(proj, view, position, nearFar, linearDepth); }`),r.code.add(V`void main() { outputDepth(linearDepth); -}`);break;case ue.Normal:l&&e.include(mR,t),n.add("vnormal","vec3"),S5(i),s(),i.code.add(V` +}`);break;case ue.Normal:a&&e.include(CR,t),n.add("vnormal","vec3"),IP(i),s(),i.code.add(V` void main(void) { - ${l?V`setOverlayVTC(getUV0());`:""} + ${a?V`setOverlayVTC(getUV0());`:""} gl_Position = transformPosition(proj, view, position); vnormal = normalize((viewNormal * vec4(getNormal(), 1.0)).xyz); } `),r.code.add(V` void main() { - ${l?V`if (getCombinedOverlayColor().a == 0.0) { discard; }`:""} + ${a?V`if (getCombinedOverlayColor().a == 0.0) { discard; }`:""} vec3 normal = normalize(vnormal); if (gl_FrontFacing == false) { normal = -normal; } fragColor = vec4(vec3(0.5) + 0.5 * normal, 0.0); } - `);break;case ue.Highlight:o&&e.include(mR,t),i.code.add(V` + `);break;case ue.Highlight:o&&e.include(CR,t),i.code.add(V` void main() { ${o?V`setOverlayVTC(getUV0());`:""} gl_Position = transformPosition(proj, view, position); } - `),e.include(dx,t),r.code.add(V` + `),e.include(vx,t),r.code.add(V` void main() { ${o?V`if (getCombinedOverlayColor().a == 0.0) { discard; }`:""} outputHighlight(); } - `)}return t.output===ue.ObjectAndLayerIdColor&&(o?(e.include(mR,{...t,pbrMode:ei.Disabled}),i.code.add(V`void main(void) { + `)}return t.output===ue.ObjectAndLayerIdColor&&(o?(e.include(CR,{...t,pbrMode:ti.Disabled}),i.code.add(V`void main(void) { gl_Position = transformPosition(proj, view, position); setOverlayVTC(getUV0()); }`),r.code.add(V`void main() { fragColor = getOverlayColorTexel(vtcOverlay); }`)):(i.code.add(V`void main(void) {}`),r.code.add(V`void main() { fragColor = vec4(0.0); -}`))),e}const S$t=Qe(),O_e=W(),T$t=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:Oce,build:xFe},Symbol.toStringTag,{value:"Module"}));let SFe=class TFe extends Hr{constructor(){super(...arguments),this.useStencil=!1}initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global}initializeProgram(e){return new Ir(e.rctx,TFe.shader.get().build(this.configuration),EFe)}initializePipeline(){return this._stencilPipelineState=this._createPipeline(!0),this._createPipeline(!1)}_createPipeline(e){const i=this.configuration,r=i.backfaceCullingEnabled&&!i.renderOccluded;return Ti({blending:i.renderOccluded?hd(st.ONE,st.ONE_MINUS_SRC_ALPHA):null,culling:r?pae:null,depthTest:i.renderOccluded?null:{func:Zr.LESS},depthWrite:i.renderOccluded?null:rh,colorWrite:ji,stencilTest:e?m3t(Zu.IntegratedMeshMaskExcluded):null})}getPipeline(){return this.useStencil?this._stencilPipelineState:super.getPipeline()}};SFe.shader=new Rr(T$t,()=>we(()=>Promise.resolve().then(()=>NWt),void 0));const EFe=new Map([[J.POSITION,0],[J.UV0,1],[J.NORMALCOMPRESSED,2]]);let E$t=class{constructor(){this.geometry=new DIt,this.intersectionData=null,this.geometryState=null,this._textureRef=new uFe(()=>this.tile.surface.textureFadeDuration),this.overlay=new v$t,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._clippingAreaChanged=!1,this._wireframeChanged=!1,this._dirtyEdgeResolutions=15,this._dirtyEdges=15,this._dirtyCorners=15}get tile(){return this._tile}init(e){this.clear(),this._tile=e;const i=this.geometry;i.indices=null,i.vertexAttributes=null,Bn(i.boundingBox),i.indexCount=0,i.numVerticesPerSide=0,this.intersectionData=null,this.geometryState=new kIt,this.localOrigin=null,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureRef.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if((!this._vao||this._geometryStateChangedSinceLastUpdate||this._wireframeChanged||this._clippingAreaChanged||this._samplerDataChanged||this._numVerticesPerSideChanged||this._dirtyCorners||this._dirtyEdgeResolutions||this._dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),pa&&this.tile.intersectsClippingArea)for(let i=0;i<4;++i)ot(this.geometry.outerEdges[i].count===this.geometryState.neighborData.edgeResolutions[i]+1)}_calculateEdgeResolution(e,i){var c;const r=this.tile,n=this.geometryState.numVerticesPerSide-1;if(!r.surface.isGlobal){const f=r.surface.extent;if(f!=null&&(e===0&&r.extent[3]>f[3]||e===1&&r.extent[2]>f[2]||e===2&&r.extent[1]=0),x===0){const M=_.numVerticesPerSide-1;return Math.max(M,n)}const T=2**x,A=_.neighborData.edgeResolutions[(e+2)%4]/T;return Math.max(1,A)}ot(!i.isLeaf);let l=n;return i.forAllSubtreeOnSide(Sce(o),f=>f===r||(f.isLoaded?(l=Math.max(l,2**(f.level-s)),!0):(ot(!f.isLeaf),!1))),l}updateNeighborData(){var l;const e=this.tile;if(!e.intersectsClippingArea)return;const i=e.renderData.geometryState.neighborData,r=c=>(c.isLoaded||c.level===e.level)&&(c==null?void 0:c.intersectsClippingArea),n=i.edgePeerNeighbors,s=i.edgePeerNeighborSamplerVersions;for(let c=0;c<4;++c){const f=e.findNeighborTile(qv[c],r),_=DS(e,f),x=((l=_==null?void 0:_.renderData)==null?void 0:l.geometryState.samplerDataVersion)??-1,T=n[c],A=_!==DS(e,T),M=s[c]!==x;n[c]=f,(A||M)&&(s[c]=x,this._markEdgeDirty(c));const I=i.edgeResolutions[c],L=this._calculateEdgeResolution(c,f);ot(BT(L)),ot(L>=1),i.edgeResolutions[c]=L,I!==L&&this._markEdgeResolutionDirty(c)}const o=i.cornerPeerNeighbors;for(let c=0;c<4;++c){const f=e.findNeighborTile(cV[c],r);o[c]=f;const _=DS(e,n[c]),x=DS(e,n[(c+1)%4]),T=DS(e,f);b0[c]=T,b0[(c+1)%4]=x,b0[(c+2)%4]=e,b0[(c+3)%4]=_,ot(b0.some(L=>(L==null?void 0:L.isLoaded)||L===e));const A=b0.reduce((L,F)=>Math.min(L,(F==null?void 0:F.level)??1/0),1/0);b0.forEach((L,F)=>{L&&(L==null?void 0:L.level)>A&&(b0[F]=null)}),ot(b0.some(L=>(L==null?void 0:L.isLoaded)||L===e));const M=i.cornerNeighborData[c].cornerTiles,I=i.cornerNeighborData[c].cornerTileSamplerVersions;for(let L=0;L<4;++L){const F=b0[L],z=(F==null?void 0:F.renderData.geometryState.samplerDataVersion)??-1,k=M[L]!==F,U=!k&&I[L]!==z;(k||U)&&(M[L]=F,I[L]=z,this._markCornerDirty(c))}ot(M.some(L=>(L==null?void 0:L.isLoaded)||L===e))}pa&&ot(this.geometryState.neighborData.edgeResolutions.every(c=>c>0));for(let c=0;c<4;++c)b0[c]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;pa&&ot(!this.tile.intersectsClippingArea||this.geometryState.neighborData.edgeResolutions.every(c=>c>0)),this.intersectionData=null;const i=this.tile,r=this._vao,n=this.geometry.vertexAttributes,s=!r||!n||this._wireframeChanged||this._numVerticesPerSideChanged||this._samplerDataChanged||this._clippingAreaChanged||this._dirtyEdgeResolutions,o=!s&&(this._dirtyEdges!==0||this._dirtyEdgeResolutions!==0),l=!o&&this._dirtyCorners!==0;s?(this.releaseGeometry(),this._createGeometry(e)):o||l?i.updateEdgeElevations():l?i.updateCornerElevations():console.warn("Update for no reason?"),this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._dirtyEdgeResolutions=0,this._dirtyEdges=0,this._dirtyCorners=0,this._clippingAreaChanged=!1,this._wireframeChanged=!1}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,!!this._vao&&(this._vao=Kt(this._vao),this.geometry.release(),!0)}ensureTexture(e,i,r){const n=i?ci.RGBA:ci.RGB;return this._texture==null||this._texture.descriptor.width===e&&this._texture.descriptor.pixelFormat===n||this.releaseTexture(),this._texture==null&&(this._texture=r(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){this._texture!=null&&(this._texture.release(),this._texture=null,this.tile.setMemoryDirty())}_markCornerDirty(e){const i=1<0,f=c?n:null;return c&&(n.length=s),{changed:l,samplerData:f,maxTileLevel:o}}get estimatedGeometryMemoryUsage(){var i,r,n;const e=((i=this.intersectionData)==null?void 0:i.estimatedMemoryUsage)??0;return(((r=this.geometry.indices)==null?void 0:r.byteLength)??0)+(((n=this.geometry.vertexAttributes)==null?void 0:n.byteLength)??0)+e}get texture(){return this._texture}get test(){return{hasTexture:this._texture!=null}}checkGeometryWaterproofness(){if(!pa)return;const e=this.tile;if(!e.isLoaded||!e.intersectsClippingArea||e.level===0)return void ot(e==null?void 0:e.isLoaded);const i=e.surface.extent;if(i!=null&&!e.intersectsExtent(i))return;const r=qv.map((l,c)=>i!=null&&(c<2?-1:1)*(e.extent[3-c]-i[3-c])<0),n=e.level;ot(this._dirtyCorners===0),ot(this._dirtyEdges===0),ot(this._dirtyEdgeResolutions===0),ot(!this._numVerticesPerSideChanged),ot(!this._samplerDataChanged),ot(!this._clippingAreaChanged),ot(!this._wireframeChanged);const s=cV.map(l=>e.findNeighborCornerTileExact(l,c=>!c.intersectsClippingArea||c.isLoaded||c.level===e.level)??null).map(l=>l!=null&&l.intersectsClippingArea?l:null),o=this.geometryState.neighborData;for(let l=0;l<4;++l){const c=o.cornerPeerNeighbors[l],f=s[l];ot(f===c,`Tile[${e.lij}].corner[${l}] out of date: cur=[${c==null?void 0:c.lij}] exp=[${f==null?void 0:f.lij}]`)}qv.forEach((l,c)=>{if(r[c])return;const f=e.findNeighborTile(l,de=>(de.level===n||(de==null?void 0:de.isLoaded))&&(de==null?void 0:de.intersectsClippingArea));if(!f){const de=!e.surface.updatingRootTiles&&e.surface.rootTiles!=null&&e.surface.rootTiles.length>0&&e.shouldHaveNeighbor(l);return void ot(!de)}ot(f.isLoaded||f.level===e.level),ot(f===this.geometryState.neighborData.edgePeerNeighbors[c]);const _=n-f.level;if(!f.isLoaded)return ot(!f.isLeaf),void ot(_===0);const x=f.renderData;ot(y$t(e,f,l)),ot(_>=0);const T=2**_;if(_<0)return void ot(!1);const A=e.renderData,M=A.geometry,I=M.outerEdges[c],L=M.numVerticesPerSide-1,F=x.geometry;if(!F)return void ot(!1);const z=this.geometryState.neighborData.edgePeerNeighbors[c];if(z!=null&&z.isLoaded){const de=z.renderData;ot(z==z),ot(A.geometryState.neighborData.edgePeerNeighborSamplerVersions[c]===de.geometryState.samplerDataVersion),ot(this.geometryState.neighborData.edgePeerNeighborSamplerVersions[c]===de.geometryState.samplerDataVersion)}const k=(c+2)%4,U=F.outerEdges[k],j=I.count-1,H=U.count-1;ot(j*T===H,`Tile[${e.lij}]:e${c},res=${j} edgeRes mismatch with Neighbor[${f.lij}]:e${k},res=${H} (expected:${j*T})`);const Y=e.extent,Q=l===ti.NORTH||l===ti.SOUTH,ne=U.count-1,re=ne/2**_,he=I.count-1;if(re<1)return void ot(he===1);ot(re===he),ot(BT(re));const ce=F.numVerticesPerSide-1;ot(_>0||re===Math.max(ce,L));const be=e.getNeighborEdgeStartVertexIndex(c,f);ot(0<=be&&be0&&console.warn(` localOrigins: ${A.localOrigin} vs ${x.localOrigin} d=${$h(Rt)} [${Rt}]`),(()=>{const dt=Xr(pg),pt=Xr(fg);e.updateEdgeElevations(),f.updateEdgeElevations(),I.getVertexPos(pg,pe),U.getVertexPos(fg,Ee);const oi=W();xn(oi,pg,dt),$h(oi)>0&&console.warn(` XXX Tile[${e.lij}] edge out of date: ${dt} vs ${pg} d=${$h(oi)} [${oi}]`),xn(oi,fg,pt),$h(oi)>0&&console.warn(` XXX Neighbor[${f.lij}] edge out of date: ${pt} vs ${fg} d=${$h(oi)} [${oi}]`)})(),ot(Qt,`Mismatch in tile [${e.lij}].edge[${c}][${pe}/${I.count}] vs neighbor [${f.lij}].edge[${k}][${Ee}/${U.count}] ${O1(pg)} vs ${O1(fg)} dist=${Ge} h(t|n|d)=${ut}|${Ft}|${Ft-ut}`)}I.getNormal($C,pe),U.getNormal(LC,Ee),Ye(P_e,$C),Ye(R_e,LC);const At=Ve(P_e,R_e),ri=1-At<.01||!1||e===f;if(!ri){const Rt=W();xn(Rt,$C,LC);const dt=()=>`Mismatch in tile edge normal ${l_e(e.lij)} (${pe}/${I.count-1}) edge ${c} vs neighbor ${l_e(f.lij)} (${Ee}/${U.count-1}) nedge ${k} :${O1($C)} vs ${O1(LC)} dot = ${At} : ${O1(Rt)}`;console.warn("Mismatch in tile edge normal: ",dt());{e.updateEdgeElevations(),f.updateEdgeElevations();const pt=W(),oi=W();I.getNormal(pt,pe),U.getNormal(oi,Ee),M2($C,pt)||console.warn("Missing update in tile normal: ",O1($C)," => ",O1(pt)),M2(LC,oi)||console.warn("Missing update in neighbor normal: ",O1(LC)," => ",O1(oi))}ot(ri,dt())}}pe+=1,Ee+=1}})}};const pg=W(),fg=W(),$C=W(),LC=W(),P_e=W(),R_e=W(),C$t=1,b0=[null,null,null,null];function DS(t,e){return e!=null&&e.isLoaded||e===t?e:null}const A$t=65536;function M$t(t,e){const i=t.tile,{extent:r,extentInRadians:n,surface:s}=i,o=t.localOrigin,l=t.geometryState,c=s.isWebMercator,f=l.numVerticesPerSide,_=f-1,x=(f-2)**2,T=c&&(e===_f.HAS_SOUTH_POLE||e===_f.HAS_BOTH_POLES),A=c&&(e===_f.HAS_NORTH_POLE||e===_f.HAS_BOTH_POLES),M=6,I=((T?1:0)+(A?1:0))*M*(_+1),L=l.neighborData,F=L.edgeResolutions.reduce((Q,ne)=>Q+ne+1,0),z=x+I+F,k=s.renderer.tileGeometryCache.acquire(z),U=t.geometry;U.numVerticesPerSide=l.numVerticesPerSide,U.vertexAttributes=k;const j=U.boundingBox;Bn(j);const H=Pce(t);wl.update(_,n,H),O$t(t),DFe(t,x),CFe(t);const Y=[];if((()=>{let Q=x+F;const ne=o[0],re=o[1],he=o[2],ce=i.ellipsoid.radius,be=r[1],ye=r[3],pe=(Ee,te)=>{const le=te*f;Nf(-ne,-re,Ee*ce-he,j),Y.push({connectedRowOffset:le,connectedOuterEdgeOffset:Ee===1?0:2,rowOffset:Q,latitudeResolution:M});const de=OFe(Ee===-1?be:ye,ce),ve=Ee*Math.PI/2-de,Se=.99*(Ee===1?1:-1),Ae=ce+0,{position:Pe,uv0:Ge}=k,{typedBuffer:ut,typedBufferStride:Ft}=k.normalCompressed;for(let Qt=1;Qt<=M;++Qt){const At=de+ve*(Qt/M),ri=Math.cos(At),Rt=Math.sin(At);for(let dt=0;dt<=_;dt++){const pt=dt/_,oi=wl.sinLonLUT[dt],ht=wl.cosLonLUT[dt]*ri,Et=oi*ri,Dt=Rt,Tt=ht*Ae-ne,ie=Et*Ae-re,Ht=Dt*Ae-he;Nf(Tt,ie,Ht,j),Pe.setValues(Q,Tt,ie,Ht),Rm(Ge,Q,pt,Se),tE(ut,Q,ht,Et,Dt,Ft),++Q}}};T&&pe(-1,0),A&&pe(1,_)})(),LFe(U,l.numVerticesPerSide,Y,[0,f-1],[0,f-1],l.wireframe),t.intersectionData=null,pa)for(let Q=0;Q<4;++Q)ot(U.outerEdges[Q].count===L.edgeResolutions[Q]+1)}function O$t(t){const e=t.tile;if(!e.intersectsClippingArea)return;const i=t.geometryState,r=i.numVerticesPerSide,n=r-2,s=r-1,o=t.geometry,l=o.vertexAttributes,c=l.position,f=l.uv0,{typedBuffer:_,typedBufferStride:x}=l.normalCompressed,T=e.extent,A=T[0],M=T[2],I=T[1],L=T[3],F=e.ellipsoid.radius,z=i.samplerData,k=t.localOrigin,U=k[0],j=k[1],H=k[2],Y=c.typedBuffer,Q=c.typedBufferStride,ne=1/s,re=o.boundingBox;let he=0;if(1<=n){const ce=ne,be=I*(1-ce)+L*ce,ye=wl.sinLatLUT[1],pe=wl.cosLatLUT[1];for(let Ee=1;Ee<=n;Ee++){const te=Ee*ne,le=A*(1-te)+M*te,de=wl.sinLonLUT[Ee],ve=wl.cosLonLUT[Ee],Se=F+Os(le,be,z),Ae=Se*ve*pe-U,Pe=Se*de*pe-j,Ge=Se*ye-H;Nf(Ae,Pe,Ge,re);const ut=(Ee-1)*Q;Y[ut]=Ae,Y[ut+1]=Pe,Y[ut+2]=Ge,Rm(f,Ee-1,te,ce)}}for(let ce=1;ce<=n;ce++){const be=ce*ne,ye=I*(1-be)+L*be,pe=wl.sinLatLUT[ce],Ee=wl.cosLatLUT[ce],te=ce+1,le=te*ne,de=I*(1-le)+L*le,ve=wl.sinLatLUT[te],Se=wl.cosLatLUT[te],Ae=wl.sinLonLUT[0],Pe=wl.cosLonLUT[0],Ge=F+Os(A,ye,z);let ut=Pe*Ee*Ge-U,Ft=Ae*Ee*Ge-j,Qt=pe*Ge-H;const At=he*Q;let ri=Y[At],Rt=Y[At+1],dt=Y[At+2];for(let pt=1;pt<=n;pt++){const oi=pt*ne,ht=A*(1-oi)+M*oi,Et=wl.sinLonLUT[pt],Dt=wl.cosLonLUT[pt];let Tt=0,ie=0,Ht=0;if(pt1){const g=(he-n)*Q;li=Y[g],mi=Y[g+1],Lr=Y[g+2]}else{const g=wl.sinLatLUT[0],v=wl.cosLatLUT[0],b=F+Os(ht,I,z);li=Dt*v*b-U,mi=Et*v*b-j,Lr=g*b-H}const Dr=F+Os(ht,de,z),Ze=Dt*Se*Dr-U,xi=Et*Se*Dr-j,m=ve*Dr-H;if(celi.isLoaded||li.isLeaf||li.level===s.level);qt?qt.intersectsClippingArea&&(ot(!qt.isLoaded),ot(!qt.isLeaf),ot(qt.level===o)):ot((vt==null?void 0:vt.rootTiles)==null||!s.shouldHaveNeighbor(Bt))}}const Ae=ye===1?l[2]:l[0],Pe=le==null?void 0:le.extent,Ge=Pe&&pe?ye===1?Pe[0]:Pe[2]:Ae,ut=ye===0?l[3]:l[1],Ft=ye===1?1:0,Qt=ye===0?1:0,At=ye===1?x:_,ri=ye===0?A:T,Rt=Math.sin(At),dt=Math.cos(At),pt=Math.sin(ri),oi=Math.cos(ri),ht=Se==null?void 0:Se.samplerData,Et=de?(vt,Bt,qt)=>.5*(Os(vt,Bt,M)+Os(qt,Bt,ht)):(vt,Bt,qt)=>Os(vt,Bt,M),Dt=r.outerEdges[ye],Tt=e&&te>3?te-3:1,ie=M!=null&&M.some(vt=>vt!=null),Ht=ht!=null&&ht.some(vt=>vt!=null),hr=ie||Ht,Ke=1/Ee,Lt=Dt.index0;ot(!Pe||bf(Pe[2]-Pe[0],l[2]-l[0])),(()=>{const vt=ye===1?-1:ye===3?1:0,Bt=ye===0?-1:ye===2?1:0,qt=(l[2]-l[0])*Ke,li=vt*qt,mi=Bt*qt,Lr=pe?vt*((x-_)*Ke):0,Dr=pe?0:Bt*Ke,Ze=Qt,xi=pe?At+Lr:At,m=pe?Math.sin(xi):Rt,D=pe?Math.cos(xi):dt,E=pe?At-Lr:At,p=pe?Math.sin(E):Rt,h=pe?Math.cos(E):dt,a=pe?ri:k(Ze+Dr),u=pe?pt:Math.sin(a),d=pe?oi:Math.cos(a),g=pe?ri:k(Ze-Dr),v=pe?pt:Math.sin(g),b=pe?oi:Math.cos(g);let S=0,C=0,O=0;{const B=0*Ke,G=pe?Ae:I*(1-B)+L*B,K=pe?Ge:G,ee=pe?F*(1-B)+z*B:ut,q=pe?At:_*(1-B)+x*B,oe=pe?Rt:Math.sin(q),ge=pe?dt:Math.cos(q),me=pe?k(B):ri,Me=pe?Math.sin(me):pt,Te=pe?Math.cos(me):oi,Fe=c+Et(G,ee,K);S=ge*Te*Fe,C=oe*Te*Fe,O=Me*Fe}let R=0,$=0,N=0;{const B=1*Ke,G=pe?Ae:I*(1-B)+L*B,K=pe?Ge:G,ee=pe?F*(1-B)+z*B:ut,q=pe?At:_*(1-B)+x*B,oe=pe?Rt:Math.sin(q),ge=pe?dt:Math.cos(q),me=pe?k(B):ri,Me=pe?Math.sin(me):pt,Te=pe?Math.cos(me):oi,Fe=c+Et(G,ee,K);R=ge*Te*Fe,$=oe*Te*Fe,N=Me*Fe}for(let B=1;BI$t(r[1],r[3],n,s)}const i=e.extentInRadians;return r=>$$t(i[1],i[3],r)}function L$t(t,e){const i=t.tile,{extent:r,surface:n}=i,s=t.geometryState,o=r[0],l=r[1],c=r[2]-o,f=r[3]-l,_=s.clippingArea,x=_!=null?Math.max(0,(_[0]-o)/c):0,T=_!=null?Math.max(0,(_[1]-l)/f):0,A=_!=null?Math.min(1,(_[2]-o)/c):1,M=_!=null?Math.min(1,(_[3]-l)/f):1,I=s.numVerticesPerSide,L=(I-2)**2,F=L+s.neighborData.edgeResolutions.reduce((j,H)=>j+H+1,0),z=n.renderer.tileGeometryCache.acquire(F),k=t.geometry,U=k.boundingBox;Bn(U),k.numVerticesPerSide=s.numVerticesPerSide,k.vertexAttributes=z,rs(k.uvRange,x,T,A,M),D$t(t),DFe(t,L),PFe(t),LFe(k,s.numVerticesPerSide,[],[0,I-1],[0,I-1],s.wireframe),t.intersectionData=null}function D$t(t){const e=t.tile;if(!e.intersectsClippingArea)return;const i=e.surface,r=t.geometryState,n=r.samplerData,s=t.localOrigin,o=i.isWebMercatorOnPlateeCarree,l=r.clippingArea,c=l??Rce,f=e.extent,_=f[0],x=f[1],T=f[2],A=f[3],M=Math.max(_,c[0]),I=Math.min(T,c[2]),L=Math.max(x,c[1]),F=Math.min(A,c[3]),z=e.ellipsoid.radius,k=e.horizontalScale,U=r.numVerticesPerSide,j=U-1,H=U-2,Y=t.geometry,Q=Y.vertexAttributes,ne=Q.position,re=Q.uv0,{typedBuffer:he,typedBufferStride:ce}=Q.normalCompressed,be=Y.uvRange,ye=be[0],pe=be[1],Ee=be[2],te=be[3],le=Y.boundingBox,de=s[0],ve=s[1],Se=s[2],Ae=ne.typedBuffer,Pe=ne.typedBufferStride;let Ge=0;const ut=Je(x,L,F),Ft=o?(Math.PI/2-2*Math.atan(Math.exp(-ut/z)))*z:ut*k,Qt=1/j,At=Je(x*(1-Qt)+A*Qt,L,F);let ri=Ft,Rt=o?(Math.PI/2-2*Math.atan(Math.exp(-At/z)))*z:At*k;for(let dt=1;dt<=H;dt++){const pt=dt/j,oi=Je(x*(1-pt)+A*pt,L,F),ht=Je(pt,pe,te),Et=Rt,Dt=(dt-1)/j,Tt=Je(x*(1-Dt)+A*Dt,L,F),ie=ri,Ht=(dt+1)/j,hr=Je(x*(1-Ht)+A*Ht,L,F),Ke=o?(Math.PI/2-2*Math.atan(Math.exp(-hr/z)))*z:hr*k,Lt=Je(Ht,pe,te);ri=Rt,Rt=Ke;const vt=Je(_,M,I);let Bt=vt*k,qt=Os(vt,oi,n);const li=1/j,mi=Je(li,ye,Ee),Lr=Je(_*(1-mi)+T*mi,M,I);let Dr=mi,Ze=Lr,xi=Lr*k,m=Os(Lr,oi,n);if(dt===1){const D=xi-de,E=ri-ve,p=m-Se,h=0*Pe;Ae[h]=D,Ae[h+1]=E,Ae[h+2]=p,Nf(D,E,p,le);const a=Je(li,ye,Ee);Rm(re,Ge,a,ht)}for(let D=1;D<=H;D++){const E=xi,p=m,h=(D+1)/j,a=Je(h,ye,Ee),u=Je(_*(1-h)+T*h,M,I),d=Ze;Ze=u;{const $=Ge+1,N=$*Pe;if(dt===1||D===H){const B=u*k,G=Os(u,oi,n);if(dt===1&&Dc[3],_>c[2],xqt.isLoaded||qt.isLeaf||qt.level===n.level);s.updatingRootTiles||(Bt?Bt.intersectsClippingArea&&(ot(!Bt.isLoaded),ot(!Bt.isLeaf),ot(Bt.level===n.level)):ot((s==null?void 0:s.rootTiles)==null||!n.shouldHaveNeighbor(vt)))}const Ge=Je(pe===1?_:f,H,Y),ut=Je(pe===0?T:x,Q,ne),Ft=Pe==null?void 0:Pe.samplerData,Qt=M.outerEdges[pe],At=e&&le>3?le-3:1,ri=Je(pe===1?1:0,z,U),Rt=Je(pe===0?1:0,k,j),dt=Se?(vt,Bt)=>.5*(Os(vt,Bt,Ft)+Os(vt,Bt,ye)):(vt,Bt)=>Os(vt,Bt,ye),pt=(_-f)/te,oi=Ee?pe===1?pt:-pt:0,ht=Ee?0:pe===0?pt:-pt,Et=-oi,Dt=-ht;let Tt=0,ie=0,Ht=0;{const vt=0/te,Bt=Ee?Ge:Je(f*(1-vt)+_*vt,H,Y),qt=Ee?Je(x*(1-vt)+T*vt,Q,ne):ut,li=dt(Bt,qt);Tt=Bt*I,ie=L(qt),Ht=li}let hr=0,Ke=0,Lt=0;{const vt=1/te,Bt=Ee?Ge:Je(f*(1-vt)+_*vt,H,Y),qt=Ee?Je(x*(1-vt)+T*vt,Q,ne):ut,li=dt(Bt,qt);hr=Bt*I,Ke=L(qt),Lt=li}for(let vt=1;vtk$t(r,e):r=>z$t(r,i)}function LFe(t,e,i,r,n,s){const o=e-1,l=t.vertexAttributes.count,c=2*(Math.min(e-2,r[1])-Math.max(1,r[0]))*(Math.min(e-2,n[1])-Math.max(1,n[0])),f=qv.map((k,U)=>U===0&&n[1]1||U===3&&r[0]>1),_=t.outerEdges.reduce((k,U,j)=>k+(f[j]?0:o-2+U.count-1),0),x=i.reduce((k,U)=>k+o*(2*(U.latitudeResolution-1)+1),0),T=s?2:1,A=3*(c+_+x)*T,M=l>=A$t?new Uint32Array(A):new Uint16Array(A);let I=0;const L=e-2,F=o-2;ot(F>=0);const z=(k,U,j,H,Y,Q)=>{const ne=k*Y,re=Q[ne],he=Q[ne+1],ce=Q[ne+2],be=U*Y,ye=Q[be],pe=Q[be+1],Ee=Q[be+2],te=j*Y,le=Q[te],de=Q[te+1],ve=Q[te+2],Se=H*Y,Ae=Q[Se],Pe=Q[Se+1],Ge=Q[Se+2];return(ye-Ae)*(ye-Ae)+(pe-Pe)*(pe-Pe)+(Ee-Ge)*(Ee-Ge)>(re-le)*(re-le)+(he-de)*(he-de)+(ce-ve)*(ce-ve)};if(s){const k=(j,H,Y)=>{M[I++]=j,M[I++]=H,M[I++]=H,M[I++]=Y,M[I++]=Y,M[I++]=j,pa&&(ot(j{for(let j=Math.max(n[0],1)-1;j{for(let j=0;j<4;++j){const H=I;if(f[j])continue;const Y=t.outerEdges[j],Q=t.innerEdges[j];let ne=0,re=0;const he=Y.count,ce=Q.count;ot(ce===o-1);let be=0;const ye=j===1||j===2?(pe,Ee,te)=>k(pe,Ee,te):(pe,Ee,te)=>k(pe,te,Ee);for(;ne{const H=t.outerEdges[j.connectedOuterEdgeOffset];let Y=H.getVertexIndex(0),Q=H.stride;for(let ne=0;ne{const U=Math.max(n[0],1)-1,j=Math.min(n[1],e-2)-1,H=Math.max(r[0],1)-1,Y=Math.min(r[1],e-2)-1;for(let Q=U;Q{for(let U=0;U<4;++U){if(f[U])continue;const j=t.outerEdges[U],H=t.innerEdges[U];let Y=0,Q=0;const ne=j.count,re=H.count;ot(re===o-1);const he=U===1||U===2,ce=he?1:2,be=he?2:1,ye=j.index0,pe=j.stride,Ee=H.index0,te=H.stride;for(;Y{const j=t.outerEdges[U.connectedOuterEdgeOffset];let H=j.getVertexIndex(0),Y=j.stride;for(let Q=0;Q{const Et=x[oi===0?1:3],Dt=x[pt===0?0:2],Tt=Math.cos(Et),ie=Math.sin(Et),Ht=Math.sin(Dt),hr=Math.cos(Dt),Ke=_+ht;A=hr*Tt*Ke,M=Ht*Tt*Ke,I=ie*Ke},F=f?(()=>{const pt=t.geometryState.clippingArea,oi=c.extent,ht=pt!=null&&(oi[3]>pt[3]||oi[2]>pt[2]||oi[1]{const Ht=Dt===0?be[0]:be[2],hr=Tt===0?be[1]:be[3],Ke=ht?Je(Ht,pt[0],pt[2]):Ht,Lt=ht?Je(hr,pt[1],pt[3]):hr,vt=ie;A=Ke*T,M=Et(Lt),I=vt}})():L;let z=0,k=0,U=0,j=0,H=0,Y=0,Q=0,ne=0,re=0;const he=f&&t.tile.surface.isWebMercatorOnPlateeCarree,ce=(pt,oi,ht,Et,Dt)=>{let Tt=0,ie=0,Ht=0;if(f){const hr=oi*T,Ke=he?(Math.PI/2-2*Math.atan(Math.exp(-ht/_)))*_:ht*T;Tt=hr-A,ie=Ke-M,Ht=Et-I}else{const hr=Pce(pt),Ke=pt.tile,Lt=Ke.extent,vt=Ke.extentInRadians,Bt=(oi-Lt[0])/(Lt[2]-Lt[0]),qt=(ht-Lt[1])/(Lt[3]-Lt[1]),li=vt[0]*(1-Bt)+vt[2]*Bt,mi=hr(qt),Lr=Math.cos(mi),Dr=Math.sin(mi),Ze=Math.sin(li),xi=Math.cos(li),m=_+Et;Tt=xi*Lr*m-A,ie=Ze*Lr*m-M,Ht=Dr*m-I}switch(Dt){case 0:Q+=Tt,ne+=ie,re+=Ht;break;case 1:j-=Tt,H-=ie,Y-=Ht;break;case 2:Q-=Tt,ne-=ie,re-=Ht;break;case 3:j+=Tt,H+=ie,Y+=Ht}},be=c.extent,ye=e.clippingArea??Rce,pe=be[0],Ee=be[2],te=be[1],le=be[3],de=[le>ye[3],Ee>ye[2],teMath.max(ye[0],Math.min(ye[2],pt)),ut=pt=>Math.max(ye[1],Math.min(ye[3],pt)),Ft=s.uvRange[0],Qt=s.uvRange[1],At=s.uvRange[2],ri=s.uvRange[3],Rt=pt=>{var hr;const oi=n[pt].cornerTiles;z=0,k=0,U=1,j=0,H=0,Y=0,Q=0,ne=0,re=0;let ht=1/0;for(let Ke=0;Ke<4;++Ke)ht=Math.min(ht,((hr=oi[Ke])==null?void 0:hr.level)??1/0);for(let Ke=0;Ke<4;++Ke){const Lt=oi[Ke];$R[Ke]=(Lt==null?void 0:Lt.level)===ht?Lt:null}let Et=1,Dt=0;for(let Ke=0;Ke<4;++Ke){const Lt=$R[Ke];Lt&&(Et=Math.max(Et,Lt==null?void 0:Lt.renderData.geometryState.numVerticesPerSide),Dt=Lt.extent[2]-Lt.extent[0])}const Tt=Dt,ie=Et;ot(ie>1);const Ht=Tt/ie;for(let Ke=0;Ke<4;++Ke){const Lt=$R[(Ke+3)%4],vt=$R[Ke%4];if(!Lt&&!vt)continue;const Bt=Ke===0?1:Ke===1?2:Ke===2?3:0,qt=Ke===0?2:Ke===1?3:Ke===2?0:1;if(Lt&&vt){const li=bY[Ke][0]*Ht,mi=bY[Ke][1]*Ht,Lr=Lt.extent,Dr=Ge(Lr[Bt===0||Bt===1?2:0]+li),Ze=ut(Lr[Bt===0||Bt===3?3:1]+mi),xi=vt.extent,m=Ge(xi[qt===0||qt===1?2:0]+li),D=ut(xi[qt===0||qt===3?3:1]+mi),E=Lt.renderData,p=vt.renderData,h=Os(Dr,Ze,E.geometryState.samplerData),a=Os(m,D,p.geometryState.samplerData);ce(E,Dr,Ze,.5*(h+a),Ke)}else{const li=Lt??vt,mi=Lt?Bt:qt,Lr=li.extent,Dr=bY[Ke],Ze=Ge(Lr[mi===0||mi===1?2:0]+Dr[0]*Ht),xi=ut(Lr[mi===0||mi===3?3:1]+Dr[1]*Ht),m=li.renderData,D=Os(Ze,xi,m.geometryState.samplerData);ce(m,Ze,xi,D,Ke)}}if(!f){const Ke=Math.sqrt(A*A+M*M+I*I);z=A/Ke,k=M/Ke,U=I/Ke}if(f||U*U<.999){const Ke=Math.sqrt(j*j+H*H+Y*Y);j/=Ke,H/=Ke,Y/=Ke;const Lt=Math.sqrt(Q*Q+ne*ne+re*re);Q/=Lt,ne/=Lt,re/=Lt,z=Y*ne-H*re,k=j*re-Y*Q,U=H*Q-j*ne;const vt=1/Math.sqrt(z*z+k*k+U*U);z*=vt,k*=vt,U*=vt}};for(let pt=0;pt<4;++pt){const oi=pt,ht=(pt+1)%4,Et=pt===0||pt===1?1:0,Dt=pt===0||pt===3?1:0,Tt=Je(Et,Ft,At),ie=Je(Dt,Qt,ri),Ht=o[oi],hr=pt===0||pt===3?Ht.count-1:0,Ke=o[ht],Lt=pt===0||pt===1?Ke.count-1:0,vt=n[pt].cornerTiles;let Bt=-1;for(let mi=0;mi<4;++mi){const Lr=vt[mi];Lr&&(Bt===-1||n_(vt[Bt],Lr)>0)&&(Bt=mi)}const qt=Bt,li=vt[qt];if(li!==c){const mi=c.level-li.level,Lr=2**mi,Dr=[li.lij[0]+mi,li.lij[1]*Lr,li.lij[2]*Lr],Ze=[Dr[1]+Lr===c.lij[1],pt===0&&(qt===1||qt===0&&li!==vt[3])||pt===1&&(qt===0||qt===1&&li!==vt[2]),Dr[1]===c.lij[1]+1,pt===2&&(qt===3||qt===2&&li!==vt[1])||pt===3&&(qt===2||qt===3&&li!==vt[0])],xi=Ze.reduce((h,a)=>h+(a?1:0),0);ot(xi===1||xi===2);let m=-1,D=-1;const E=li.renderData;if(xi===1){const h=Ze.findIndex(u=>u);ot(0<=h&&h<=3),m=(h+2)%4;const a=t.geometryState.neighborData.edgeResolutions[h];D=c.getNeighborEdgeStartVertexIndex(h,li)*a+a*(h===0&&pt===0||h===1&&pt===0||h===2&&pt===1||h===3&&pt===3?1:0)}else{ot(Ze[1]||Ze[3]),m=Ze[1]?3:1;const h=E.geometryState.neighborData.edgeResolutions[m];D=pt===0||pt===3?0:h}const p=E.geometry.outerEdges[m];{const h=Ht.index0+hr*Ht.stride,a=Ke.index0+Lt*Ke.stride,u=p.index0+D*p.stride;{const d=p.attributes.position,g=d.typedBuffer,v=u*d.typedBufferStride,b=t.localOrigin,S=p.localOrigin,C=g[v]+S[0]-b[0],O=g[v+1]+S[1]-b[1],R=g[v+2]+S[2]-b[2];Nf(C,O,R,l);{const $=Ht.attributes.position,N=$.typedBuffer,B=h*$.typedBufferStride;N[B]=C,N[B+1]=O,N[B+2]=R}{const $=Ke.attributes.position,N=$.typedBuffer,B=a*$.typedBufferStride;N[B]=C,N[B+1]=O,N[B+2]=R}}Rm(Ht.attributes.uv0,h,Tt,ie),Rm(Ke.attributes.uv0,a,Tt,ie);{const d=p.attributes.normalCompressed.typedBuffer,g=u*p.attributes.normalCompressed.typedBufferStride;{const v=Ht.attributes.normalCompressed,b=v.typedBuffer,S=h*v.typedBufferStride;b[S]=d[g],b[S+1]=d[g+1]}{const v=Ke.attributes.normalCompressed,b=v.typedBuffer,S=a*v.typedBufferStride;b[S]=d[g],b[S+1]=d[g+1]}}}}else{const mi=de[oi],Lr=de[ht];let Dr;if(mi||Lr){const D=Je(pe*(1-Et)+Ee*Et,ve,Se),E=Je(te*(1-Dt)+le*Dt,Ae,Pe),p=e.samplerData;Dr=Os(D,E,p)}else Dr=U$t(vt);F(Et,Dt,Dr),Rt(pt);const Ze=A-r[0],xi=M-r[1],m=I-r[2];Nf(Ze,xi,m,l),Ht.setVertexFromValuesRawPositionUVNormal(hr,Ze,xi,m,Tt,ie,z,k,U),Ke.setVertexFromValuesRawPositionUVNormal(Lt,Ze,xi,m,Tt,ie,z,k,U)}}for(let pt=0;pt<4;++pt)$R[pt]=null}function U$t(t){var s,o;const e=t.reduce((l,c)=>Math.min(l,(c==null?void 0:c.level)??1/0),1/0);pa&&(ot(!t[0]||!t[2]||Fie(t[0],t[2],ti.SOUTH_WEST)),ot(!t[1]||!t[3]||Fie(t[1],t[3],ti.NORTH_WEST)));let i=0,r=0;for(let l=0;l<4;++l){const c=t[l];if(c&&c.level===e){const f=l===0||l===1,_=l===0||l===3,x=c.extent,T=x[f?0:2],A=x[_?1:3],M=(o=(s=c.renderData)==null?void 0:s.geometryState)==null?void 0:o.samplerData;r+=Os(T,A,M),i++}}const n=i?r/i:0;return ot(n!=null),n}function EG(t){const e=t.vao,i=t.geometry.vertexAttributes.position.typedBuffer;e.vertexBuffers.geometry.setSubData(i,0,0,i.length)}const bY=[[0,1],[1,0],[0,-1],[-1,0]],wl=new NIt,Rce=ose(-1/0,-1/0,1/0,1/0),$R=[null,null,null,null];function kFe(t,e,i){if(!e)return!1;const r=n_(t,e);return r>0||r===0&&i>=2}let V$t=class extends Cce{constructor(e,i,r,n,s){super(),this._horizontalScaleFactor=1,this._extentInRenderSR=Ni(),this._baseUsedMemory=900,this.init(e,i,r,n,s)}init(e,i,r,n,s){super.init(e,i,r,n,s);const o=s.view.renderSpatialReference,l=s.spatialReference,c=o!=null&&uL(o)&&l!=null&&l.isGeographic?this.ellipsoid.radius*Math.PI/180:1;this._horizontalScaleFactor=c;const f=this.surface.isWebMercatorOnPlateeCarree,_=this._extentInRenderSR,x=this.extent;if(f){const T=nt(x[0],x[1],0);el(T,at.WebMercator,T,at.PlateCarree);const A=nt(x[2],x[3],0);el(A,at.WebMercator,A,at.PlateCarree),_[0]=T[0],_[1]=T[1],_[2]=A[0],_[3]=A[1]}else for(let T=0;T<4;++T)_[T]=x[T]*c;this.centerAtSeaLevel[0]=.5*(_[0]+_[2]),this.centerAtSeaLevel[1]=.5*(_[1]+_[3]),this.centerAtSeaLevel[2]=0,this._edgeLen=Math.max(_[2]-_[0],_[3]-_[1]),this._edgeLen2=this._edgeLen*this._edgeLen,this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateCenter();const e=this._extentInRenderSR,i=.5*(e[2]-e[0]),r=.5*(e[3]-e[1]),n=Math.sqrt(i*i+r*r),s=.5*(this.elevationBounds[0]-this.elevationBounds[1]),o=Math.max(n,s);this._center[Fo.MIDDLE][3]=o}_calculateFrustumVisibilityStatus(e){const i=this._aabb(),r=i[0],n=i[1],s=i[2],o=i[3],l=i[4],c=i[5];let f=!0;for(let _=0;_<6;_++){const x=e[_],T=x[0],A=x[1],M=x[2],I=x[3];if(T*(T>0?r:o)+A*(A>0?n:l)+M*(M>0?s:c)+I>=0)return gc.OUTSIDE;f=f&&T*(T<0?r:o)+A*(A<0?n:l)+M*(M<0?s:c)+I<=0}return f?gc.INSIDE:gc.INTERSECTS}_aabb(){const e=this._extentInRenderSR;return Ort(e[0],e[1],this.elevationBounds[0],e[2],e[3],this.elevationBounds[1])}intersectsRay(e,i,r,n){return m8[0]=1/i[0],m8[1]=1/i[1],m8[2]=1/i[2],gle(this._aabb(),e,m8,r,n)}createGeometry(){L$t(this.renderData,this._horizontalScaleFactor),this.setMemoryDirty()}getDefaultVerticesPerSide(){return this.level<9?3:2}updateCornerElevations(){N$t(this.renderData,this._horizontalScaleFactor)}updateEdgeElevations(){F$t(this.renderData,this._horizontalScaleFactor)}get horizontalScale(){return this._horizontalScaleFactor}};const m8=W();let B$t=class{constructor(){this.extent=Xi(),this.minLevel=0,this.maxLevel=0,this.callback=null}},fk=class extends ze{constructor(){super(...arguments),this._queries=new Pi({initialSize:10}),this._queriesInvPtr=0,this._queryQueue=new Pi({initialSize:30}),this._queryPool=new Ec(B$t)}queryVisibleLevelRange(e,i,r,n){const s=this._queryPool.acquire();mm(s.extent,e),s.minLevel=i??-Number.MAX_VALUE,s.maxLevel=r??Number.MAX_VALUE,s.callback=n,this._queryQueue.push(s),this.notifyChange("updating")}get updating(){return this._queryQueue.length!==0}prepare(){for(;this._queries.length0;){const e=this._queryQueue.pop();this._queries.push(e)}this._queriesInvPtr=this._queries.length}process(){for(let e=0;e=this._queriesInvPtr),i.callback=null}this._queries.clear(),this.notifyChange("updating")}queriesForTile(e){const i=e.level;let r=0;for(;r=n.minLevel&&i<=n.maxLevel&&s[0]<=e.extent[2]&&s[2]>=e.extent[0]&&s[1]<=e.extent[3]&&s[3]>=e.extent[1]?(this._queries.swapElements(r,this._queriesInvPtr-1),this._queriesInvPtr--):r++}}};y([w()],fk.prototype,"updating",null),fk=y([Z("esri.views.3d.terrain.ScaleRangeQueries")],fk);function j$t(t,e,i,r){const n=Math.cos(i);t[0]=Math.cos(e)*n*r,t[1]=Math.sin(e)*n*r,t[2]=Math.sin(i)*r}let G$t=class extends Cce{constructor(e,i,r,n,s){super(),this._convexHull=new Array(24),this._boundingSphere=co(),this._baseUsedMemory=1816,this.init(e,i,r,n,s)}init(e,i,r,n,s){super.init(e,i,r,n,s);const o=this.ellipsoid.radius,l=this.extentInRadians[0],c=this.extentInRadians[1],f=this.extentInRadians[2],_=this.extentInRadians[3],x=ui(c,_,.5),T=ui(l,f,.5),A=e===0?0:Math.min(Math.abs(c),Math.abs(_));this._edgeLen=(f-l)*Math.cos(A)*o,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=o-Math.sqrt(o*o-this._edgeLen2/4),j$t(this.centerAtSeaLevel,T,x,this.ellipsoid.radius),Ye(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();const e=this._center;if(this.lij[0]===0)Ie(e[Fo.MIDDLE],0,0,0),Ie(e[Fo.TOP],0,0,0),Ie(e[Fo.BOTTOM],0,0,0),e[Fo.MIDDLE][3]=this.ellipsoid.radius+this.elevationBounds[1];else{this._updateCenter();const i=e[Fo.MIDDLE],r=this.convexHull;let n=0;for(let s=0;s<8;++s)n=Math.max(n,H$t(i,r,3*s));e[Fo.MIDDLE][3]=Math.sqrt(n)}}_calculateFrustumVisibilityStatus(e){if(!c2(e,this._boundingSphere))return gc.OUTSIDE;if(this.lij[0]<10)return gc.INTERSECTS;const i=this.convexHull,r=this.surface.view.state.camera.near;let n=!0;for(let s=0;s<_P;s++){const o=s===Rn.NEAR,l=e[s],c=l[0],f=l[1],_=l[2],x=l[3]-(o?r:0);let T=!1;for(let A=0;A<8;++A){const M=3*A;if(c*i[M]+f*i[M+1]+_*i[M+2]+x<0){if(T=!0,!n)break}else n=!1}if(!T)return gc.OUTSIDE}return n?gc.INSIDE:gc.INTERSECTS}computeElevationBounds(){super.computeElevationBounds(),this._updateBoundingVolumes()}createGeometry(){M$t(this.renderData,this._getPatchType()),this._updateBoundingVolumes(),this.setMemoryDirty()}_updateBoundingVolumes(){this._updateConvexHull(),this._updateBoundingSphere(),pa&&this._checkBVs()}_updateBoundingSphere(){const e=this._boundingSphere,i=e,r=this.elevationBounds,n=this.ellipsoid.radius,s=r[1];if(this.level===0)Ie(i,0,0,0),e[3]=n+s;else{const o=this.extentInRadians,l=.5*(o[0]+o[2]),c=o[1],f=o[3];Jx(L_e,l,c,n),Jx(D_e,l,f,n),Be(i,L_e,D_e);const _=.5*(r[0]+r[1]);De(i,i,(n+_)/$h(i));const x=this.convexHull;let T=0;const A=(I,L)=>{const F=I[0]-x[3*L],z=I[1]-x[3*L+1],k=I[2]-x[3*L+2];return Math.sqrt(F*F+z*z+k*k)};for(let I=0;I<8;++I){const L=A(i,I);T=Math.max(T,L)}const M=T;e[3]=M+2}}_updateConvexHull(){const e=this.extentInRadians,i=this.ellipsoid.radius;if(this.level===0)return;const r=this.elevationBounds,n=this._getPatchType(),s=this.surface.isWebMercator,o=s&&n===_f.HAS_NORTH_POLE,l=s&&n===_f.HAS_SOUTH_POLE,c=l||o,f=Math.PI/2,_=e[0],x=e[2],T=l?-f:e[1],A=o?f:e[3],M=.5*(_+x),I=r[0],L=i+(c?Math.min(0,I-1):I),F=(Ee,te,le)=>Jx(Ee,te,le,L),z=W(),k=W(),U=W(),j=W();F(z,_,T),F(k,_,A),F(U,x,A),F(j,x,T);const H=(Ee,te)=>{for(let le=0;le<3;++le)this._convexHull[3*te+le]=Ee[le]};H(z,0),H(k,1),H(U,2),H(j,3);const Y=r[1],Q=i+(c?Math.max(0,Y+1):Y),ne=W(),re=W(),he=W();Jx(re,M,A,L),Jx(he,M,T,L),Be(ne,re,he),Ye(ne,ne);const ce=W(),be=W(),ye=(Ee,te)=>{xn(be,Ee,te),Ye(be,be);const le=-Ve(Ee,ce)/Ve(be,ce);ot(le>=0),De(be,be,le),Be(Ee,Ee,be)};if(2**this.lij[0]>2*this.lij[1]){const Ee=he,te=W();Wt(te,$_e,Ee),Ye(te,te),Wt(ce,Ee,te),Ye(ce,ce),ot(bf(Ve(ce,Ee)/$h(Ee),0)),ye(z,k),ye(j,U),H(z,0),H(j,3)}else if(2**this.lij[0]!==2*this.lij[1]){const Ee=re,te=W();Wt(te,$_e,Ee),Ye(te,te),Wt(ce,te,Ee),Ye(ce,ce),ye(k,z),ye(U,j),H(k,1),H(U,2)}const pe=(Ee,te)=>{const le=Q/Ve(te,ne);for(let de=0;de<3;++de)this._convexHull[3*Ee+de]=te[de]*le};pe(4,z),pe(5,k),pe(6,U),pe(7,j)}_getPatchType(){const e=this.lij[1],i=e===0,r=e===(1<{for(let Dt=0;Dt<3;++Dt)ht[Dt]=x[3*Et+Dt]};{const ht=W(),Et=W(),Dt=W(),Tt=W(),ie=W(),Ht=(hr,Ke,Lt,vt)=>{T(Et,hr),T(Dt,Ke),T(Tt,Lt),xn(Et,Et,Dt),xn(Tt,Tt,Dt),Wt(ht,Et,Tt),Ye(ht,ht);const Bt=Ve(ht,Dt);T(ie,vt);const qt=Ve(ht,ie),li=Math.abs(qt-Bt);ot(bf(li,0),`Non coplanar ${hr},${Ke},${Lt},${vt} diff = ${li}`)};Ht(0,1,2,3),Ht(4,5,6,7),Ht(0,1,4,5),Ht(1,2,5,6),Ht(2,3,6,7),Ht(3,0,7,4)}const A=Ja(24),M=(ht,Et,Dt)=>{const Tt=4*ht;for(let ie=0;ie<3;++ie)A[Tt+ie]=Et[ie];A[Tt+3]=Dt},I=W(),L=W(),F=W(),z=W(),k=(ht,Et,Dt,Tt)=>{T(I,Et),T(L,Dt),T(F,Tt),xn(I,I,L),Ye(I,I),xn(F,F,L),Ye(F,F),Wt(z,I,F),Ye(z,z);const ie=Ve(z,L);M(ht,z,ie)};k(0,0,1,2),k(1,1,0,4),k(2,1,5,2),k(3,3,2,6),k(4,4,0,3),k(5,4,6,5);const U=1,j=(ht,Et,Dt,Tt)=>{const ie=4*ht;return A[ie]*Et+A[ie+1]*Dt+A[ie+2]*Tt-A[ie+3]},H=(ht,Et,Dt,Tt)=>j(ht,Et,Dt,Tt)>=-U,Y=(ht,Et)=>H(ht,Et[0],Et[1],Et[2]),Q=2**this.lij[0]>2*this.lij[1],ne=(ht,Et,Dt)=>Math.sqrt(zFe(ht,Et,Dt,r[0],r[1],r[2]))ne(ht[0],ht[1],ht[2]),he=(ht,Et)=>ne(ht[Et],ht[Et+1],ht[Et+2]),ce=this.extentInRadians,be=.5*(ce[0]+ce[2]),ye=ce[1],pe=ce[3],Ee=W(),te=W();Jx(Ee,be,pe,l),Jx(te,be,ye,l);const le=Q?"Upper":"Lower";let de=!0;for(let ht=0;ht<6;++ht){for(let Et=0;Et<8;++Et){const Dt=3*Et,Tt=H(ht,x[Dt],x[Dt+1],x[Dt+2]);de&&(de=Tt),ot(Tt,`Tile[${this.lij}] Convex hull point ${Et} outside of plane ${ht}`)}ot(Y(ht,te),`Tile[${this.lij}] (${le}) bottom mid outside of plane ${ht}`),ot(Y(ht,Ee),`Tile[${this.lij}] (${le}) top mid outside of plane ${ht}`)}ot(de,"Not all convex hull points are inside convex hull polyhedron"),ot(re(te),`Tile[${this.lij}] (${le}) bottom mid outside of bounding sphere`),ot(re(Ee),`Tile[${this.lij}] (${le}) top mid outside of bounding sphere`);for(let ht=0;ht<8;++ht){const Et=he(x,3*ht);ot(Et,`Tile[${this.lij}] Convex hull point ${ht} outside of bounding sphere`)}for(let ht=0;ht<6;++ht)for(let Et=0;Et<8;++Et){const Dt=3*Et;H(ht,x[Dt],x[Dt+1],x[Dt+2])||console.error(`Tile[${this.lij}] Convex hull point ${Et} outside of plane ${ht}`)}const ve=this.extentInRadians,Se=Math.max(ve[2]-ve[0],ve[3]-ve[1]),Ae=Math.round(Se*s),Pe=this.renderData;if(!Pe)return;const{geometry:Ge,localOrigin:ut}=Pe,Ft=(oi=Ge.vertexAttributes)==null?void 0:oi.position;if(!Ft)return;const Qt=Ft.count,At=W(),ri=Ge.numVerticesPerSide-2,Rt=ri*ri,dt=Pe.geometryState.neighborData,pt=dt.edgeResolutions.reduce((ht,Et)=>ht+Et+1,0);for(let ht=0;ht0;Ft.getVec(ht,n),Be(At,n,ut);const Ke=$h(At)-s;let Lt=0,vt=!1;const Bt=o[0]-Ke,qt=Ke-o[1],li=Bt>c,mi=qt>c,Lr=li||mi,Dr=()=>{const xi=Et?"internal":Dt&&!Tt?"edge":Tt?"corner":"pole";return`Tile[${this.lij}].vertex[${ht}]:${xi}`+(li?"(below)":mi?"(above)":"")+(hr?"(Neighbor)":"")},Ze=O9(At,r);if(Ze>=i+f){const xi=Ze-i;Lr||(console.error(`${Dr()} is out of the bounding sphere by ${xi.toFixed(0)} / ${i.toFixed(0)}[tol=${f}] h=${Ke.toFixed(0)} / [${o[0].toFixed(0)}..${o[1].toFixed(0)}] (${(xi/i).toFixed(0)})`),vt=!0)}for(let xi=0;xi<6;++xi)if(!H(xi,At[0],At[1],At[2])){const m=j(xi,At[0],At[1],At[2]),D=ht%ri,E=(ht-D)/ri;xi===0&&Bt||xi===5&&qt||(console.error(`${Dr()} (${D},${E})|${ri}] is out of the bounding trapezoid plane ${xi} h=${Math.round(Ke)} / [${Math.round(o[0])}..${Math.round(o[1])}] dist=${Math.round(m)} radii = ${Math.round(i)}/${Math.round(_)}} : maxL = ${Ae}`),++Lt)}if(vt||Lt>0)break}}get convexHull(){return this._convexHull}};const I_e=[128,64,64,32,16,8,8,4];function H$t(t,e,i){return zFe(t[0],t[1],t[2],e[i],e[i+1],e[i+2])}function zFe(t,e,i,r,n,s){const o=r-t,l=n-e,c=s-i;return o*o+l*l+c*c}const Jx=(t,e,i,r)=>{const n=Math.cos(e),s=Math.sin(e),o=Math.cos(i),l=Math.sin(i);t[0]=r*o*n,t[1]=r*o*s,t[2]=r*l},$_e=[0,0,1],L_e=W(),D_e=W();let B0=class extends ze{constructor(){super(...arguments),this.fovX=0,this.fovY=0,this.relativeWidthLimit=0,this.relativeHeightLimit=0,this.maxLod=0,this.angledSplitBias=0,this.aboveGround=!0}};y([w()],B0.prototype,"fovX",void 0),y([w()],B0.prototype,"fovY",void 0),y([w()],B0.prototype,"relativeWidthLimit",void 0),y([w()],B0.prototype,"relativeHeightLimit",void 0),y([w()],B0.prototype,"maxLod",void 0),y([w()],B0.prototype,"angledSplitBias",void 0),y([w()],B0.prototype,"aboveGround",void 0),y([w()],B0.prototype,"frustum",void 0),B0=y([Z("esri.views.3d.terrain.SplitLimits")],B0);const q$t=ls().vec3f(J.POSITION).vec2i16(J.UV0).vec2i16(J.NORMALCOMPRESSED,{glNormalized:!0});let W$t=class{constructor(e){this._storage=new G9((i,r)=>e.newCache(i,r),"TileGeometry")}acquire(e){const r=Math.ceil(e/4)*4,n=this._storage.pop(N_e(r));if(n)return n;const s=q$t.createBuffer(r);return s.release=()=>this._release(s),s}_release(e){const i=e.count;this._storage.put(N_e(i),e)}clear(){this._storage.clear()}destroy(){this._storage.destroy()}};function N_e(t){return t.toString()}let UFe=class extends nh{constructor(){super(...arguments),this.blendMode=gt.Normal}};y([fe({count:gt.COUNT})],UFe.prototype,"blendMode",void 0);let k$=class extends UFe{constructor(){super(...arguments),this.output=Jo.Composite,this.baseOpacityMode=up.NotRequired,this.premultipliedSource=am.Off}};y([fe({count:Jo.COUNT})],k$.prototype,"output",void 0),y([fe({count:up.COUNT})],k$.prototype,"baseOpacityMode",void 0),y([fe()],k$.prototype,"premultipliedSource",void 0);var K2;function VFe(t){const e=new Cr;if(e.include(yFe),t.background===K2.Only){const i=t.output===Jo.ColorComposite;return i?e.fragment.uniforms.add(new Oi("backgroundColor",r=>r.backgroundColor)):e.fragment.include(Ece),e.fragment.code.add(V` +}`))),e}const x4t=Qe(),P_e=W(),S4t=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:Bce,build:_Fe},Symbol.toStringTag,{value:"Module"}));let bFe=class wFe extends Hr{constructor(){super(...arguments),this.useStencil=!1}initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global}initializeProgram(e){return new $r(e.rctx,wFe.shader.get().build(this.configuration),xFe)}initializePipeline(){return this._stencilPipelineState=this._createPipeline(!0),this._createPipeline(!1)}_createPipeline(e){const i=this.configuration,r=i.backfaceCullingEnabled&&!i.renderOccluded;return Ti({blending:i.renderOccluded?md(ot.ONE,ot.ONE_MINUS_SRC_ALPHA):null,culling:r?Cae:null,depthTest:i.renderOccluded?null:{func:Zr.LESS},depthWrite:i.renderOccluded?null:sh,colorWrite:ji,stencilTest:e?fxt(Ku.IntegratedMeshMaskExcluded):null})}getPipeline(){return this.useStencil?this._stencilPipelineState:super.getPipeline()}};bFe.shader=new Ir(S4t,()=>we(()=>Promise.resolve().then(()=>vXt),void 0));const xFe=new Map([[J.POSITION,0],[J.UV0,1],[J.NORMALCOMPRESSED,2]]);let T4t=class{constructor(){this.geometry=new LIt,this.intersectionData=null,this.geometryState=null,this._textureRef=new aFe(()=>this.tile.surface.textureFadeDuration),this.overlay=new y4t,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._clippingAreaChanged=!1,this._wireframeChanged=!1,this._dirtyEdgeResolutions=15,this._dirtyEdges=15,this._dirtyCorners=15}get tile(){return this._tile}init(e){this.clear(),this._tile=e;const i=this.geometry;i.indices=null,i.vertexAttributes=null,Bn(i.boundingBox),i.indexCount=0,i.numVerticesPerSide=0,this.intersectionData=null,this.geometryState=new FIt,this.localOrigin=null,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureRef.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if((!this._vao||this._geometryStateChangedSinceLastUpdate||this._wireframeChanged||this._clippingAreaChanged||this._samplerDataChanged||this._numVerticesPerSideChanged||this._dirtyCorners||this._dirtyEdgeResolutions||this._dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),fa&&this.tile.intersectsClippingArea)for(let i=0;i<4;++i)at(this.geometry.outerEdges[i].count===this.geometryState.neighborData.edgeResolutions[i]+1)}_calculateEdgeResolution(e,i){var c;const r=this.tile,n=this.geometryState.numVerticesPerSide-1;if(!r.surface.isGlobal){const p=r.surface.extent;if(p!=null&&(e===0&&r.extent[3]>p[3]||e===1&&r.extent[2]>p[2]||e===2&&r.extent[1]=0),x===0){const M=_.numVerticesPerSide-1;return Math.max(M,n)}const S=2**x,C=_.neighborData.edgeResolutions[(e+2)%4]/S;return Math.max(1,C)}at(!i.isLeaf);let a=n;return i.forAllSubtreeOnSide(Nce(o),p=>p===r||(p.isLoaded?(a=Math.max(a,2**(p.level-s)),!0):(at(!p.isLeaf),!1))),a}updateNeighborData(){var a;const e=this.tile;if(!e.intersectsClippingArea)return;const i=e.renderData.geometryState.neighborData,r=c=>(c.isLoaded||c.level===e.level)&&(c==null?void 0:c.intersectsClippingArea),n=i.edgePeerNeighbors,s=i.edgePeerNeighborSamplerVersions;for(let c=0;c<4;++c){const p=e.findNeighborTile(Qv[c],r),_=VS(e,p),x=((a=_==null?void 0:_.renderData)==null?void 0:a.geometryState.samplerDataVersion)??-1,S=n[c],C=_!==VS(e,S),M=s[c]!==x;n[c]=p,(C||M)&&(s[c]=x,this._markEdgeDirty(c));const P=i.edgeResolutions[c],$=this._calculateEdgeResolution(c,p);at(HT($)),at($>=1),i.edgeResolutions[c]=$,P!==$&&this._markEdgeResolutionDirty(c)}const o=i.cornerPeerNeighbors;for(let c=0;c<4;++c){const p=e.findNeighborTile(uV[c],r);o[c]=p;const _=VS(e,n[c]),x=VS(e,n[(c+1)%4]),S=VS(e,p);S0[c]=S,S0[(c+1)%4]=x,S0[(c+2)%4]=e,S0[(c+3)%4]=_,at(S0.some($=>($==null?void 0:$.isLoaded)||$===e));const C=S0.reduce(($,F)=>Math.min($,(F==null?void 0:F.level)??1/0),1/0);S0.forEach(($,F)=>{$&&($==null?void 0:$.level)>C&&(S0[F]=null)}),at(S0.some($=>($==null?void 0:$.isLoaded)||$===e));const M=i.cornerNeighborData[c].cornerTiles,P=i.cornerNeighborData[c].cornerTileSamplerVersions;for(let $=0;$<4;++$){const F=S0[$],z=(F==null?void 0:F.renderData.geometryState.samplerDataVersion)??-1,k=M[$]!==F,U=!k&&P[$]!==z;(k||U)&&(M[$]=F,P[$]=z,this._markCornerDirty(c))}at(M.some($=>($==null?void 0:$.isLoaded)||$===e))}fa&&at(this.geometryState.neighborData.edgeResolutions.every(c=>c>0));for(let c=0;c<4;++c)S0[c]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;fa&&at(!this.tile.intersectsClippingArea||this.geometryState.neighborData.edgeResolutions.every(c=>c>0)),this.intersectionData=null;const i=this.tile,r=this._vao,n=this.geometry.vertexAttributes,s=!r||!n||this._wireframeChanged||this._numVerticesPerSideChanged||this._samplerDataChanged||this._clippingAreaChanged||this._dirtyEdgeResolutions,o=!s&&(this._dirtyEdges!==0||this._dirtyEdgeResolutions!==0),a=!o&&this._dirtyCorners!==0;s?(this.releaseGeometry(),this._createGeometry(e)):o||a?i.updateEdgeElevations():a?i.updateCornerElevations():console.warn("Update for no reason?"),this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._dirtyEdgeResolutions=0,this._dirtyEdges=0,this._dirtyCorners=0,this._clippingAreaChanged=!1,this._wireframeChanged=!1}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,!!this._vao&&(this._vao=Kt(this._vao),this.geometry.release(),!0)}ensureTexture(e,i,r){const n=i?ci.RGBA:ci.RGB;return this._texture==null||this._texture.descriptor.width===e&&this._texture.descriptor.pixelFormat===n||this.releaseTexture(),this._texture==null&&(this._texture=r(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){this._texture!=null&&(this._texture.release(),this._texture=null,this.tile.setMemoryDirty())}_markCornerDirty(e){const i=1<0,p=c?n:null;return c&&(n.length=s),{changed:a,samplerData:p,maxTileLevel:o}}get estimatedGeometryMemoryUsage(){var i,r,n;const e=((i=this.intersectionData)==null?void 0:i.estimatedMemoryUsage)??0;return(((r=this.geometry.indices)==null?void 0:r.byteLength)??0)+(((n=this.geometry.vertexAttributes)==null?void 0:n.byteLength)??0)+e}get texture(){return this._texture}get test(){return{hasTexture:this._texture!=null}}checkGeometryWaterproofness(){if(!fa)return;const e=this.tile;if(!e.isLoaded||!e.intersectsClippingArea||e.level===0)return void at(e==null?void 0:e.isLoaded);const i=e.surface.extent;if(i!=null&&!e.intersectsExtent(i))return;const r=Qv.map((a,c)=>i!=null&&(c<2?-1:1)*(e.extent[3-c]-i[3-c])<0),n=e.level;at(this._dirtyCorners===0),at(this._dirtyEdges===0),at(this._dirtyEdgeResolutions===0),at(!this._numVerticesPerSideChanged),at(!this._samplerDataChanged),at(!this._clippingAreaChanged),at(!this._wireframeChanged);const s=uV.map(a=>e.findNeighborCornerTileExact(a,c=>!c.intersectsClippingArea||c.isLoaded||c.level===e.level)??null).map(a=>a!=null&&a.intersectsClippingArea?a:null),o=this.geometryState.neighborData;for(let a=0;a<4;++a){const c=o.cornerPeerNeighbors[a],p=s[a];at(p===c,`Tile[${e.lij}].corner[${a}] out of date: cur=[${c==null?void 0:c.lij}] exp=[${p==null?void 0:p.lij}]`)}Qv.forEach((a,c)=>{if(r[c])return;const p=e.findNeighborTile(a,de=>(de.level===n||(de==null?void 0:de.isLoaded))&&(de==null?void 0:de.intersectsClippingArea));if(!p){const de=!e.surface.updatingRootTiles&&e.surface.rootTiles!=null&&e.surface.rootTiles.length>0&&e.shouldHaveNeighbor(a);return void at(!de)}at(p.isLoaded||p.level===e.level),at(p===this.geometryState.neighborData.edgePeerNeighbors[c]);const _=n-p.level;if(!p.isLoaded)return at(!p.isLeaf),void at(_===0);const x=p.renderData;at(g4t(e,p,a)),at(_>=0);const S=2**_;if(_<0)return void at(!1);const C=e.renderData,M=C.geometry,P=M.outerEdges[c],$=M.numVerticesPerSide-1,F=x.geometry;if(!F)return void at(!1);const z=this.geometryState.neighborData.edgePeerNeighbors[c];if(z!=null&&z.isLoaded){const de=z.renderData;at(z==z),at(C.geometryState.neighborData.edgePeerNeighborSamplerVersions[c]===de.geometryState.samplerDataVersion),at(this.geometryState.neighborData.edgePeerNeighborSamplerVersions[c]===de.geometryState.samplerDataVersion)}const k=(c+2)%4,U=F.outerEdges[k],j=P.count-1,G=U.count-1;at(j*S===G,`Tile[${e.lij}]:e${c},res=${j} edgeRes mismatch with Neighbor[${p.lij}]:e${k},res=${G} (expected:${j*S})`);const Y=e.extent,Q=a===ii.NORTH||a===ii.SOUTH,ne=U.count-1,ie=ne/2**_,he=P.count-1;if(ie<1)return void at(he===1);at(ie===he),at(HT(ie));const ce=F.numVerticesPerSide-1;at(_>0||ie===Math.max(ce,$));const ve=e.getNeighborEdgeStartVertexIndex(c,p);at(0<=ve&&ve0&&console.warn(` localOrigins: ${C.localOrigin} vs ${x.localOrigin} d=${Nh(It)} [${It}]`),(()=>{const dt=Xr(vg),pt=Xr(_g);e.updateEdgeElevations(),p.updateEdgeElevations(),P.getVertexPos(vg,pe),U.getVertexPos(_g,Ee);const ai=W();Sn(ai,vg,dt),Nh(ai)>0&&console.warn(` XXX Tile[${e.lij}] edge out of date: ${dt} vs ${vg} d=${Nh(ai)} [${ai}]`),Sn(ai,_g,pt),Nh(ai)>0&&console.warn(` XXX Neighbor[${p.lij}] edge out of date: ${pt} vs ${_g} d=${Nh(ai)} [${ai}]`)})(),at(ei,`Mismatch in tile [${e.lij}].edge[${c}][${pe}/${P.count}] vs neighbor [${p.lij}].edge[${k}][${Ee}/${U.count}] ${F1(vg)} vs ${F1(_g)} dist=${Ge} h(t|n|d)=${ut}|${Ft}|${Ft-ut}`)}P.getNormal(zC,pe),U.getNormal(UC,Ee),Ye(R_e,zC),Ye(I_e,UC);const Mt=Ve(R_e,I_e),ri=1-Mt<.01||!1||e===p;if(!ri){const It=W();Sn(It,zC,UC);const dt=()=>`Mismatch in tile edge normal ${c_e(e.lij)} (${pe}/${P.count-1}) edge ${c} vs neighbor ${c_e(p.lij)} (${Ee}/${U.count-1}) nedge ${k} :${F1(zC)} vs ${F1(UC)} dot = ${Mt} : ${F1(It)}`;console.warn("Mismatch in tile edge normal: ",dt());{e.updateEdgeElevations(),p.updateEdgeElevations();const pt=W(),ai=W();P.getNormal(pt,pe),U.getNormal(ai,Ee),L2(zC,pt)||console.warn("Missing update in tile normal: ",F1(zC)," => ",F1(pt)),L2(UC,ai)||console.warn("Missing update in neighbor normal: ",F1(UC)," => ",F1(ai))}at(ri,dt())}}pe+=1,Ee+=1}})}};const vg=W(),_g=W(),zC=W(),UC=W(),R_e=W(),I_e=W(),E4t=1,S0=[null,null,null,null];function VS(t,e){return e!=null&&e.isLoaded||e===t?e:null}const C4t=65536;function A4t(t,e){const i=t.tile,{extent:r,extentInRadians:n,surface:s}=i,o=t.localOrigin,a=t.geometryState,c=s.isWebMercator,p=a.numVerticesPerSide,_=p-1,x=(p-2)**2,S=c&&(e===Tf.HAS_SOUTH_POLE||e===Tf.HAS_BOTH_POLES),C=c&&(e===Tf.HAS_NORTH_POLE||e===Tf.HAS_BOTH_POLES),M=6,P=((S?1:0)+(C?1:0))*M*(_+1),$=a.neighborData,F=$.edgeResolutions.reduce((Q,ne)=>Q+ne+1,0),z=x+P+F,k=s.renderer.tileGeometryCache.acquire(z),U=t.geometry;U.numVerticesPerSide=a.numVerticesPerSide,U.vertexAttributes=k;const j=U.boundingBox;Bn(j);const G=jce(t);Sl.update(_,n,G),M4t(t),IFe(t,x),SFe(t);const Y=[];if((()=>{let Q=x+F;const ne=o[0],ie=o[1],he=o[2],ce=i.ellipsoid.radius,ve=r[1],ge=r[3],pe=(Ee,te)=>{const le=te*p;Vf(-ne,-ie,Ee*ce-he,j),Y.push({connectedRowOffset:le,connectedOuterEdgeOffset:Ee===1?0:2,rowOffset:Q,latitudeResolution:M});const de=CFe(Ee===-1?ve:ge,ce),be=Ee*Math.PI/2-de,Se=.99*(Ee===1?1:-1),Ae=ce+0,{position:Re,uv0:Ge}=k,{typedBuffer:ut,typedBufferStride:Ft}=k.normalCompressed;for(let ei=1;ei<=M;++ei){const Mt=de+be*(ei/M),ri=Math.cos(Mt),It=Math.sin(Mt);for(let dt=0;dt<=_;dt++){const pt=dt/_,ai=Sl.sinLonLUT[dt],ht=Sl.cosLonLUT[dt]*ri,Ct=ai*ri,Dt=It,Tt=ht*Ae-ne,re=Ct*Ae-ie,Ht=Dt*Ae-he;Vf(Tt,re,Ht,j),Re.setValues(Q,Tt,re,Ht),$m(Ge,Q,pt,Se),sE(ut,Q,ht,Ct,Dt,Ft),++Q}}};S&&pe(-1,0),C&&pe(1,_)})(),RFe(U,a.numVerticesPerSide,Y,[0,p-1],[0,p-1],a.wireframe),t.intersectionData=null,fa)for(let Q=0;Q<4;++Q)at(U.outerEdges[Q].count===$.edgeResolutions[Q]+1)}function M4t(t){const e=t.tile;if(!e.intersectsClippingArea)return;const i=t.geometryState,r=i.numVerticesPerSide,n=r-2,s=r-1,o=t.geometry,a=o.vertexAttributes,c=a.position,p=a.uv0,{typedBuffer:_,typedBufferStride:x}=a.normalCompressed,S=e.extent,C=S[0],M=S[2],P=S[1],$=S[3],F=e.ellipsoid.radius,z=i.samplerData,k=t.localOrigin,U=k[0],j=k[1],G=k[2],Y=c.typedBuffer,Q=c.typedBufferStride,ne=1/s,ie=o.boundingBox;let he=0;if(1<=n){const ce=ne,ve=P*(1-ce)+$*ce,ge=Sl.sinLatLUT[1],pe=Sl.cosLatLUT[1];for(let Ee=1;Ee<=n;Ee++){const te=Ee*ne,le=C*(1-te)+M*te,de=Sl.sinLonLUT[Ee],be=Sl.cosLonLUT[Ee],Se=F+Ps(le,ve,z),Ae=Se*be*pe-U,Re=Se*de*pe-j,Ge=Se*ge-G;Vf(Ae,Re,Ge,ie);const ut=(Ee-1)*Q;Y[ut]=Ae,Y[ut+1]=Re,Y[ut+2]=Ge,$m(p,Ee-1,te,ce)}}for(let ce=1;ce<=n;ce++){const ve=ce*ne,ge=P*(1-ve)+$*ve,pe=Sl.sinLatLUT[ce],Ee=Sl.cosLatLUT[ce],te=ce+1,le=te*ne,de=P*(1-le)+$*le,be=Sl.sinLatLUT[te],Se=Sl.cosLatLUT[te],Ae=Sl.sinLonLUT[0],Re=Sl.cosLonLUT[0],Ge=F+Ps(C,ge,z);let ut=Re*Ee*Ge-U,Ft=Ae*Ee*Ge-j,ei=pe*Ge-G;const Mt=he*Q;let ri=Y[Mt],It=Y[Mt+1],dt=Y[Mt+2];for(let pt=1;pt<=n;pt++){const ai=pt*ne,ht=C*(1-ai)+M*ai,Ct=Sl.sinLonLUT[pt],Dt=Sl.cosLonLUT[pt];let Tt=0,re=0,Ht=0;if(pt1){const g=(he-n)*Q;li=Y[g],mi=Y[g+1],Dr=Y[g+2]}else{const g=Sl.sinLatLUT[0],v=Sl.cosLatLUT[0],b=F+Ps(ht,P,z);li=Dt*v*b-U,mi=Ct*v*b-j,Dr=g*b-G}const Nr=F+Ps(ht,de,z),Ze=Dt*Se*Nr-U,xi=Ct*Se*Nr-j,m=be*Nr-G;if(celi.isLoaded||li.isLeaf||li.level===s.level);qt?qt.intersectsClippingArea&&(at(!qt.isLoaded),at(!qt.isLeaf),at(qt.level===o)):at((vt==null?void 0:vt.rootTiles)==null||!s.shouldHaveNeighbor(Bt))}}const Ae=ge===1?a[2]:a[0],Re=le==null?void 0:le.extent,Ge=Re&&pe?ge===1?Re[0]:Re[2]:Ae,ut=ge===0?a[3]:a[1],Ft=ge===1?1:0,ei=ge===0?1:0,Mt=ge===1?x:_,ri=ge===0?C:S,It=Math.sin(Mt),dt=Math.cos(Mt),pt=Math.sin(ri),ai=Math.cos(ri),ht=Se==null?void 0:Se.samplerData,Ct=de?(vt,Bt,qt)=>.5*(Ps(vt,Bt,M)+Ps(qt,Bt,ht)):(vt,Bt,qt)=>Ps(vt,Bt,M),Dt=r.outerEdges[ge],Tt=e&&te>3?te-3:1,re=M!=null&&M.some(vt=>vt!=null),Ht=ht!=null&&ht.some(vt=>vt!=null),hr=re||Ht,Ke=1/Ee,Lt=Dt.index0;at(!Re||Ef(Re[2]-Re[0],a[2]-a[0])),(()=>{const vt=ge===1?-1:ge===3?1:0,Bt=ge===0?-1:ge===2?1:0,qt=(a[2]-a[0])*Ke,li=vt*qt,mi=Bt*qt,Dr=pe?vt*((x-_)*Ke):0,Nr=pe?0:Bt*Ke,Ze=ei,xi=pe?Mt+Dr:Mt,m=pe?Math.sin(xi):It,D=pe?Math.cos(xi):dt,E=pe?Mt-Dr:Mt,f=pe?Math.sin(E):It,h=pe?Math.cos(E):dt,l=pe?ri:k(Ze+Nr),u=pe?pt:Math.sin(l),d=pe?ai:Math.cos(l),g=pe?ri:k(Ze-Nr),v=pe?pt:Math.sin(g),b=pe?ai:Math.cos(g);let T=0,A=0,O=0;{const B=0*Ke,H=pe?Ae:P*(1-B)+$*B,K=pe?Ge:H,ee=pe?F*(1-B)+z*B:ut,q=pe?Mt:_*(1-B)+x*B,oe=pe?It:Math.sin(q),ye=pe?dt:Math.cos(q),me=pe?k(B):ri,Me=pe?Math.sin(me):pt,Te=pe?Math.cos(me):ai,Fe=c+Ct(H,ee,K);T=ye*Te*Fe,A=oe*Te*Fe,O=Me*Fe}let I=0,L=0,N=0;{const B=1*Ke,H=pe?Ae:P*(1-B)+$*B,K=pe?Ge:H,ee=pe?F*(1-B)+z*B:ut,q=pe?Mt:_*(1-B)+x*B,oe=pe?It:Math.sin(q),ye=pe?dt:Math.cos(q),me=pe?k(B):ri,Me=pe?Math.sin(me):pt,Te=pe?Math.cos(me):ai,Fe=c+Ct(H,ee,K);I=ye*Te*Fe,L=oe*Te*Fe,N=Me*Fe}for(let B=1;BR4t(r[1],r[3],n,s)}const i=e.extentInRadians;return r=>I4t(i[1],i[3],r)}function $4t(t,e){const i=t.tile,{extent:r,surface:n}=i,s=t.geometryState,o=r[0],a=r[1],c=r[2]-o,p=r[3]-a,_=s.clippingArea,x=_!=null?Math.max(0,(_[0]-o)/c):0,S=_!=null?Math.max(0,(_[1]-a)/p):0,C=_!=null?Math.min(1,(_[2]-o)/c):1,M=_!=null?Math.min(1,(_[3]-a)/p):1,P=s.numVerticesPerSide,$=(P-2)**2,F=$+s.neighborData.edgeResolutions.reduce((j,G)=>j+G+1,0),z=n.renderer.tileGeometryCache.acquire(F),k=t.geometry,U=k.boundingBox;Bn(U),k.numVerticesPerSide=s.numVerticesPerSide,k.vertexAttributes=z,rs(k.uvRange,x,S,C,M),L4t(t),IFe(t,$),AFe(t),RFe(k,s.numVerticesPerSide,[],[0,P-1],[0,P-1],s.wireframe),t.intersectionData=null}function L4t(t){const e=t.tile;if(!e.intersectsClippingArea)return;const i=e.surface,r=t.geometryState,n=r.samplerData,s=t.localOrigin,o=i.isWebMercatorOnPlateeCarree,a=r.clippingArea,c=a??Gce,p=e.extent,_=p[0],x=p[1],S=p[2],C=p[3],M=Math.max(_,c[0]),P=Math.min(S,c[2]),$=Math.max(x,c[1]),F=Math.min(C,c[3]),z=e.ellipsoid.radius,k=e.horizontalScale,U=r.numVerticesPerSide,j=U-1,G=U-2,Y=t.geometry,Q=Y.vertexAttributes,ne=Q.position,ie=Q.uv0,{typedBuffer:he,typedBufferStride:ce}=Q.normalCompressed,ve=Y.uvRange,ge=ve[0],pe=ve[1],Ee=ve[2],te=ve[3],le=Y.boundingBox,de=s[0],be=s[1],Se=s[2],Ae=ne.typedBuffer,Re=ne.typedBufferStride;let Ge=0;const ut=Je(x,$,F),Ft=o?(Math.PI/2-2*Math.atan(Math.exp(-ut/z)))*z:ut*k,ei=1/j,Mt=Je(x*(1-ei)+C*ei,$,F);let ri=Ft,It=o?(Math.PI/2-2*Math.atan(Math.exp(-Mt/z)))*z:Mt*k;for(let dt=1;dt<=G;dt++){const pt=dt/j,ai=Je(x*(1-pt)+C*pt,$,F),ht=Je(pt,pe,te),Ct=It,Dt=(dt-1)/j,Tt=Je(x*(1-Dt)+C*Dt,$,F),re=ri,Ht=(dt+1)/j,hr=Je(x*(1-Ht)+C*Ht,$,F),Ke=o?(Math.PI/2-2*Math.atan(Math.exp(-hr/z)))*z:hr*k,Lt=Je(Ht,pe,te);ri=It,It=Ke;const vt=Je(_,M,P);let Bt=vt*k,qt=Ps(vt,ai,n);const li=1/j,mi=Je(li,ge,Ee),Dr=Je(_*(1-mi)+S*mi,M,P);let Nr=mi,Ze=Dr,xi=Dr*k,m=Ps(Dr,ai,n);if(dt===1){const D=xi-de,E=ri-be,f=m-Se,h=0*Re;Ae[h]=D,Ae[h+1]=E,Ae[h+2]=f,Vf(D,E,f,le);const l=Je(li,ge,Ee);$m(ie,Ge,l,ht)}for(let D=1;D<=G;D++){const E=xi,f=m,h=(D+1)/j,l=Je(h,ge,Ee),u=Je(_*(1-h)+S*h,M,P),d=Ze;Ze=u;{const L=Ge+1,N=L*Re;if(dt===1||D===G){const B=u*k,H=Ps(u,ai,n);if(dt===1&&Dc[3],_>c[2],xqt.isLoaded||qt.isLeaf||qt.level===n.level);s.updatingRootTiles||(Bt?Bt.intersectsClippingArea&&(at(!Bt.isLoaded),at(!Bt.isLeaf),at(Bt.level===n.level)):at((s==null?void 0:s.rootTiles)==null||!n.shouldHaveNeighbor(vt)))}const Ge=Je(pe===1?_:p,G,Y),ut=Je(pe===0?S:x,Q,ne),Ft=Re==null?void 0:Re.samplerData,ei=M.outerEdges[pe],Mt=e&&le>3?le-3:1,ri=Je(pe===1?1:0,z,U),It=Je(pe===0?1:0,k,j),dt=Se?(vt,Bt)=>.5*(Ps(vt,Bt,Ft)+Ps(vt,Bt,ge)):(vt,Bt)=>Ps(vt,Bt,ge),pt=(_-p)/te,ai=Ee?pe===1?pt:-pt:0,ht=Ee?0:pe===0?pt:-pt,Ct=-ai,Dt=-ht;let Tt=0,re=0,Ht=0;{const vt=0/te,Bt=Ee?Ge:Je(p*(1-vt)+_*vt,G,Y),qt=Ee?Je(x*(1-vt)+S*vt,Q,ne):ut,li=dt(Bt,qt);Tt=Bt*P,re=$(qt),Ht=li}let hr=0,Ke=0,Lt=0;{const vt=1/te,Bt=Ee?Ge:Je(p*(1-vt)+_*vt,G,Y),qt=Ee?Je(x*(1-vt)+S*vt,Q,ne):ut,li=dt(Bt,qt);hr=Bt*P,Ke=$(qt),Lt=li}for(let vt=1;vtF4t(r,e):r=>k4t(r,i)}function RFe(t,e,i,r,n,s){const o=e-1,a=t.vertexAttributes.count,c=2*(Math.min(e-2,r[1])-Math.max(1,r[0]))*(Math.min(e-2,n[1])-Math.max(1,n[0])),p=Qv.map((k,U)=>U===0&&n[1]1||U===3&&r[0]>1),_=t.outerEdges.reduce((k,U,j)=>k+(p[j]?0:o-2+U.count-1),0),x=i.reduce((k,U)=>k+o*(2*(U.latitudeResolution-1)+1),0),S=s?2:1,C=3*(c+_+x)*S,M=a>=C4t?new Uint32Array(C):new Uint16Array(C);let P=0;const $=e-2,F=o-2;at(F>=0);const z=(k,U,j,G,Y,Q)=>{const ne=k*Y,ie=Q[ne],he=Q[ne+1],ce=Q[ne+2],ve=U*Y,ge=Q[ve],pe=Q[ve+1],Ee=Q[ve+2],te=j*Y,le=Q[te],de=Q[te+1],be=Q[te+2],Se=G*Y,Ae=Q[Se],Re=Q[Se+1],Ge=Q[Se+2];return(ge-Ae)*(ge-Ae)+(pe-Re)*(pe-Re)+(Ee-Ge)*(Ee-Ge)>(ie-le)*(ie-le)+(he-de)*(he-de)+(ce-be)*(ce-be)};if(s){const k=(j,G,Y)=>{M[P++]=j,M[P++]=G,M[P++]=G,M[P++]=Y,M[P++]=Y,M[P++]=j,fa&&(at(j{for(let j=Math.max(n[0],1)-1;j{for(let j=0;j<4;++j){const G=P;if(p[j])continue;const Y=t.outerEdges[j],Q=t.innerEdges[j];let ne=0,ie=0;const he=Y.count,ce=Q.count;at(ce===o-1);let ve=0;const ge=j===1||j===2?(pe,Ee,te)=>k(pe,Ee,te):(pe,Ee,te)=>k(pe,te,Ee);for(;ne{const G=t.outerEdges[j.connectedOuterEdgeOffset];let Y=G.getVertexIndex(0),Q=G.stride;for(let ne=0;ne{const U=Math.max(n[0],1)-1,j=Math.min(n[1],e-2)-1,G=Math.max(r[0],1)-1,Y=Math.min(r[1],e-2)-1;for(let Q=U;Q{for(let U=0;U<4;++U){if(p[U])continue;const j=t.outerEdges[U],G=t.innerEdges[U];let Y=0,Q=0;const ne=j.count,ie=G.count;at(ie===o-1);const he=U===1||U===2,ce=he?1:2,ve=he?2:1,ge=j.index0,pe=j.stride,Ee=G.index0,te=G.stride;for(;Y{const j=t.outerEdges[U.connectedOuterEdgeOffset];let G=j.getVertexIndex(0),Y=j.stride;for(let Q=0;Q{const Ct=x[ai===0?1:3],Dt=x[pt===0?0:2],Tt=Math.cos(Ct),re=Math.sin(Ct),Ht=Math.sin(Dt),hr=Math.cos(Dt),Ke=_+ht;C=hr*Tt*Ke,M=Ht*Tt*Ke,P=re*Ke},F=p?(()=>{const pt=t.geometryState.clippingArea,ai=c.extent,ht=pt!=null&&(ai[3]>pt[3]||ai[2]>pt[2]||ai[1]{const Ht=Dt===0?ve[0]:ve[2],hr=Tt===0?ve[1]:ve[3],Ke=ht?Je(Ht,pt[0],pt[2]):Ht,Lt=ht?Je(hr,pt[1],pt[3]):hr,vt=re;C=Ke*S,M=Ct(Lt),P=vt}})():$;let z=0,k=0,U=0,j=0,G=0,Y=0,Q=0,ne=0,ie=0;const he=p&&t.tile.surface.isWebMercatorOnPlateeCarree,ce=(pt,ai,ht,Ct,Dt)=>{let Tt=0,re=0,Ht=0;if(p){const hr=ai*S,Ke=he?(Math.PI/2-2*Math.atan(Math.exp(-ht/_)))*_:ht*S;Tt=hr-C,re=Ke-M,Ht=Ct-P}else{const hr=jce(pt),Ke=pt.tile,Lt=Ke.extent,vt=Ke.extentInRadians,Bt=(ai-Lt[0])/(Lt[2]-Lt[0]),qt=(ht-Lt[1])/(Lt[3]-Lt[1]),li=vt[0]*(1-Bt)+vt[2]*Bt,mi=hr(qt),Dr=Math.cos(mi),Nr=Math.sin(mi),Ze=Math.sin(li),xi=Math.cos(li),m=_+Ct;Tt=xi*Dr*m-C,re=Ze*Dr*m-M,Ht=Nr*m-P}switch(Dt){case 0:Q+=Tt,ne+=re,ie+=Ht;break;case 1:j-=Tt,G-=re,Y-=Ht;break;case 2:Q-=Tt,ne-=re,ie-=Ht;break;case 3:j+=Tt,G+=re,Y+=Ht}},ve=c.extent,ge=e.clippingArea??Gce,pe=ve[0],Ee=ve[2],te=ve[1],le=ve[3],de=[le>ge[3],Ee>ge[2],teMath.max(ge[0],Math.min(ge[2],pt)),ut=pt=>Math.max(ge[1],Math.min(ge[3],pt)),Ft=s.uvRange[0],ei=s.uvRange[1],Mt=s.uvRange[2],ri=s.uvRange[3],It=pt=>{var hr;const ai=n[pt].cornerTiles;z=0,k=0,U=1,j=0,G=0,Y=0,Q=0,ne=0,ie=0;let ht=1/0;for(let Ke=0;Ke<4;++Ke)ht=Math.min(ht,((hr=ai[Ke])==null?void 0:hr.level)??1/0);for(let Ke=0;Ke<4;++Ke){const Lt=ai[Ke];GR[Ke]=(Lt==null?void 0:Lt.level)===ht?Lt:null}let Ct=1,Dt=0;for(let Ke=0;Ke<4;++Ke){const Lt=GR[Ke];Lt&&(Ct=Math.max(Ct,Lt==null?void 0:Lt.renderData.geometryState.numVerticesPerSide),Dt=Lt.extent[2]-Lt.extent[0])}const Tt=Dt,re=Ct;at(re>1);const Ht=Tt/re;for(let Ke=0;Ke<4;++Ke){const Lt=GR[(Ke+3)%4],vt=GR[Ke%4];if(!Lt&&!vt)continue;const Bt=Ke===0?1:Ke===1?2:Ke===2?3:0,qt=Ke===0?2:Ke===1?3:Ke===2?0:1;if(Lt&&vt){const li=PY[Ke][0]*Ht,mi=PY[Ke][1]*Ht,Dr=Lt.extent,Nr=Ge(Dr[Bt===0||Bt===1?2:0]+li),Ze=ut(Dr[Bt===0||Bt===3?3:1]+mi),xi=vt.extent,m=Ge(xi[qt===0||qt===1?2:0]+li),D=ut(xi[qt===0||qt===3?3:1]+mi),E=Lt.renderData,f=vt.renderData,h=Ps(Nr,Ze,E.geometryState.samplerData),l=Ps(m,D,f.geometryState.samplerData);ce(E,Nr,Ze,.5*(h+l),Ke)}else{const li=Lt??vt,mi=Lt?Bt:qt,Dr=li.extent,Nr=PY[Ke],Ze=Ge(Dr[mi===0||mi===1?2:0]+Nr[0]*Ht),xi=ut(Dr[mi===0||mi===3?3:1]+Nr[1]*Ht),m=li.renderData,D=Ps(Ze,xi,m.geometryState.samplerData);ce(m,Ze,xi,D,Ke)}}if(!p){const Ke=Math.sqrt(C*C+M*M+P*P);z=C/Ke,k=M/Ke,U=P/Ke}if(p||U*U<.999){const Ke=Math.sqrt(j*j+G*G+Y*Y);j/=Ke,G/=Ke,Y/=Ke;const Lt=Math.sqrt(Q*Q+ne*ne+ie*ie);Q/=Lt,ne/=Lt,ie/=Lt,z=Y*ne-G*ie,k=j*ie-Y*Q,U=G*Q-j*ne;const vt=1/Math.sqrt(z*z+k*k+U*U);z*=vt,k*=vt,U*=vt}};for(let pt=0;pt<4;++pt){const ai=pt,ht=(pt+1)%4,Ct=pt===0||pt===1?1:0,Dt=pt===0||pt===3?1:0,Tt=Je(Ct,Ft,Mt),re=Je(Dt,ei,ri),Ht=o[ai],hr=pt===0||pt===3?Ht.count-1:0,Ke=o[ht],Lt=pt===0||pt===1?Ke.count-1:0,vt=n[pt].cornerTiles;let Bt=-1;for(let mi=0;mi<4;++mi){const Dr=vt[mi];Dr&&(Bt===-1||h_(vt[Bt],Dr)>0)&&(Bt=mi)}const qt=Bt,li=vt[qt];if(li!==c){const mi=c.level-li.level,Dr=2**mi,Nr=[li.lij[0]+mi,li.lij[1]*Dr,li.lij[2]*Dr],Ze=[Nr[1]+Dr===c.lij[1],pt===0&&(qt===1||qt===0&&li!==vt[3])||pt===1&&(qt===0||qt===1&&li!==vt[2]),Nr[1]===c.lij[1]+1,pt===2&&(qt===3||qt===2&&li!==vt[1])||pt===3&&(qt===2||qt===3&&li!==vt[0])],xi=Ze.reduce((h,l)=>h+(l?1:0),0);at(xi===1||xi===2);let m=-1,D=-1;const E=li.renderData;if(xi===1){const h=Ze.findIndex(u=>u);at(0<=h&&h<=3),m=(h+2)%4;const l=t.geometryState.neighborData.edgeResolutions[h];D=c.getNeighborEdgeStartVertexIndex(h,li)*l+l*(h===0&&pt===0||h===1&&pt===0||h===2&&pt===1||h===3&&pt===3?1:0)}else{at(Ze[1]||Ze[3]),m=Ze[1]?3:1;const h=E.geometryState.neighborData.edgeResolutions[m];D=pt===0||pt===3?0:h}const f=E.geometry.outerEdges[m];{const h=Ht.index0+hr*Ht.stride,l=Ke.index0+Lt*Ke.stride,u=f.index0+D*f.stride;{const d=f.attributes.position,g=d.typedBuffer,v=u*d.typedBufferStride,b=t.localOrigin,T=f.localOrigin,A=g[v]+T[0]-b[0],O=g[v+1]+T[1]-b[1],I=g[v+2]+T[2]-b[2];Vf(A,O,I,a);{const L=Ht.attributes.position,N=L.typedBuffer,B=h*L.typedBufferStride;N[B]=A,N[B+1]=O,N[B+2]=I}{const L=Ke.attributes.position,N=L.typedBuffer,B=l*L.typedBufferStride;N[B]=A,N[B+1]=O,N[B+2]=I}}$m(Ht.attributes.uv0,h,Tt,re),$m(Ke.attributes.uv0,l,Tt,re);{const d=f.attributes.normalCompressed.typedBuffer,g=u*f.attributes.normalCompressed.typedBufferStride;{const v=Ht.attributes.normalCompressed,b=v.typedBuffer,T=h*v.typedBufferStride;b[T]=d[g],b[T+1]=d[g+1]}{const v=Ke.attributes.normalCompressed,b=v.typedBuffer,T=l*v.typedBufferStride;b[T]=d[g],b[T+1]=d[g+1]}}}}else{const mi=de[ai],Dr=de[ht];let Nr;if(mi||Dr){const D=Je(pe*(1-Ct)+Ee*Ct,be,Se),E=Je(te*(1-Dt)+le*Dt,Ae,Re),f=e.samplerData;Nr=Ps(D,E,f)}else Nr=z4t(vt);F(Ct,Dt,Nr),It(pt);const Ze=C-r[0],xi=M-r[1],m=P-r[2];Vf(Ze,xi,m,a),Ht.setVertexFromValuesRawPositionUVNormal(hr,Ze,xi,m,Tt,re,z,k,U),Ke.setVertexFromValuesRawPositionUVNormal(Lt,Ze,xi,m,Tt,re,z,k,U)}}for(let pt=0;pt<4;++pt)GR[pt]=null}function z4t(t){var s,o;const e=t.reduce((a,c)=>Math.min(a,(c==null?void 0:c.level)??1/0),1/0);fa&&(at(!t[0]||!t[2]||Hie(t[0],t[2],ii.SOUTH_WEST)),at(!t[1]||!t[3]||Hie(t[1],t[3],ii.NORTH_WEST)));let i=0,r=0;for(let a=0;a<4;++a){const c=t[a];if(c&&c.level===e){const p=a===0||a===1,_=a===0||a===3,x=c.extent,S=x[p?0:2],C=x[_?1:3],M=(o=(s=c.renderData)==null?void 0:s.geometryState)==null?void 0:o.samplerData;r+=Ps(S,C,M),i++}}const n=i?r/i:0;return at(n!=null),n}function DG(t){const e=t.vao,i=t.geometry.vertexAttributes.position.typedBuffer;e.vertexBuffers.geometry.setSubData(i,0,0,i.length)}const PY=[[0,1],[1,0],[0,-1],[-1,0]],Sl=new DIt,Gce=tse(-1/0,-1/0,1/0,1/0),GR=[null,null,null,null];function DFe(t,e,i){if(!e)return!1;const r=h_(t,e);return r>0||r===0&&i>=2}let U4t=class extends zce{constructor(e,i,r,n,s){super(),this._horizontalScaleFactor=1,this._extentInRenderSR=Ni(),this._baseUsedMemory=900,this.init(e,i,r,n,s)}init(e,i,r,n,s){super.init(e,i,r,n,s);const o=s.view.renderSpatialReference,a=s.spatialReference,c=o!=null&&yL(o)&&a!=null&&a.isGeographic?this.ellipsoid.radius*Math.PI/180:1;this._horizontalScaleFactor=c;const p=this.surface.isWebMercatorOnPlateeCarree,_=this._extentInRenderSR,x=this.extent;if(p){const S=st(x[0],x[1],0);il(S,rt.WebMercator,S,rt.PlateCarree);const C=st(x[2],x[3],0);il(C,rt.WebMercator,C,rt.PlateCarree),_[0]=S[0],_[1]=S[1],_[2]=C[0],_[3]=C[1]}else for(let S=0;S<4;++S)_[S]=x[S]*c;this.centerAtSeaLevel[0]=.5*(_[0]+_[2]),this.centerAtSeaLevel[1]=.5*(_[1]+_[3]),this.centerAtSeaLevel[2]=0,this._edgeLen=Math.max(_[2]-_[0],_[3]-_[1]),this._edgeLen2=this._edgeLen*this._edgeLen,this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateCenter();const e=this._extentInRenderSR,i=.5*(e[2]-e[0]),r=.5*(e[3]-e[1]),n=Math.sqrt(i*i+r*r),s=.5*(this.elevationBounds[0]-this.elevationBounds[1]),o=Math.max(n,s);this._center[ko.MIDDLE][3]=o}_calculateFrustumVisibilityStatus(e){const i=this._aabb(),r=i[0],n=i[1],s=i[2],o=i[3],a=i[4],c=i[5];let p=!0;for(let _=0;_<6;_++){const x=e[_],S=x[0],C=x[1],M=x[2],P=x[3];if(S*(S>0?r:o)+C*(C>0?n:a)+M*(M>0?s:c)+P>=0)return _c.OUTSIDE;p=p&&S*(S<0?r:o)+C*(C<0?n:a)+M*(M<0?s:c)+P<=0}return p?_c.INSIDE:_c.INTERSECTS}_aabb(){const e=this._extentInRenderSR;return itt(e[0],e[1],this.elevationBounds[0],e[2],e[3],this.elevationBounds[1])}intersectsRay(e,i,r,n){return x8[0]=1/i[0],x8[1]=1/i[1],x8[2]=1/i[2],Ole(this._aabb(),e,x8,r,n)}createGeometry(){$4t(this.renderData,this._horizontalScaleFactor),this.setMemoryDirty()}getDefaultVerticesPerSide(){return this.level<9?3:2}updateCornerElevations(){D4t(this.renderData,this._horizontalScaleFactor)}updateEdgeElevations(){N4t(this.renderData,this._horizontalScaleFactor)}get horizontalScale(){return this._horizontalScaleFactor}};const x8=W();let V4t=class{constructor(){this.extent=Xi(),this.minLevel=0,this.maxLevel=0,this.callback=null}},Tk=class extends ze{constructor(){super(...arguments),this._queries=new Pi({initialSize:10}),this._queriesInvPtr=0,this._queryQueue=new Pi({initialSize:30}),this._queryPool=new Ql(V4t)}queryVisibleLevelRange(e,i,r,n){const s=this._queryPool.acquire();ym(s.extent,e),s.minLevel=i??-Number.MAX_VALUE,s.maxLevel=r??Number.MAX_VALUE,s.callback=n,this._queryQueue.push(s),this.notifyChange("updating")}get updating(){return this._queryQueue.length!==0}prepare(){for(;this._queries.length0;){const e=this._queryQueue.pop();this._queries.push(e)}this._queriesInvPtr=this._queries.length}process(){for(let e=0;e=this._queriesInvPtr),i.callback=null}this._queries.clear(),this.notifyChange("updating")}queriesForTile(e){const i=e.level;let r=0;for(;r=n.minLevel&&i<=n.maxLevel&&s[0]<=e.extent[2]&&s[2]>=e.extent[0]&&s[1]<=e.extent[3]&&s[3]>=e.extent[1]?(this._queries.swapElements(r,this._queriesInvPtr-1),this._queriesInvPtr--):r++}}};y([w()],Tk.prototype,"updating",null),Tk=y([Z("esri.views.3d.terrain.ScaleRangeQueries")],Tk);function B4t(t,e,i,r){const n=Math.cos(i);t[0]=Math.cos(e)*n*r,t[1]=Math.sin(e)*n*r,t[2]=Math.sin(i)*r}let j4t=class extends zce{constructor(e,i,r,n,s){super(),this._convexHull=new Array(24),this._boundingSphere=uo(),this._baseUsedMemory=1816,this.init(e,i,r,n,s)}init(e,i,r,n,s){super.init(e,i,r,n,s);const o=this.ellipsoid.radius,a=this.extentInRadians[0],c=this.extentInRadians[1],p=this.extentInRadians[2],_=this.extentInRadians[3],x=ui(c,_,.5),S=ui(a,p,.5),C=e===0?0:Math.min(Math.abs(c),Math.abs(_));this._edgeLen=(p-a)*Math.cos(C)*o,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=o-Math.sqrt(o*o-this._edgeLen2/4),B4t(this.centerAtSeaLevel,S,x,this.ellipsoid.radius),Ye(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();const e=this._center;if(this.lij[0]===0)Ie(e[ko.MIDDLE],0,0,0),Ie(e[ko.TOP],0,0,0),Ie(e[ko.BOTTOM],0,0,0),e[ko.MIDDLE][3]=this.ellipsoid.radius+this.elevationBounds[1];else{this._updateCenter();const i=e[ko.MIDDLE],r=this.convexHull;let n=0;for(let s=0;s<8;++s)n=Math.max(n,G4t(i,r,3*s));e[ko.MIDDLE][3]=Math.sqrt(n)}}_calculateFrustumVisibilityStatus(e){if(!m2(e,this._boundingSphere))return _c.OUTSIDE;if(this.lij[0]<10)return _c.INTERSECTS;const i=this.convexHull,r=this.surface.view.state.camera.near;let n=!0;for(let s=0;s{const F=P[0]-x[3*$],z=P[1]-x[3*$+1],k=P[2]-x[3*$+2];return Math.sqrt(F*F+z*z+k*k)};for(let P=0;P<8;++P){const $=C(i,P);S=Math.max(S,$)}const M=S;e[3]=M+2}}_updateConvexHull(){const e=this.extentInRadians,i=this.ellipsoid.radius;if(this.level===0)return;const r=this.elevationBounds,n=this._getPatchType(),s=this.surface.isWebMercator,o=s&&n===Tf.HAS_NORTH_POLE,a=s&&n===Tf.HAS_SOUTH_POLE,c=a||o,p=Math.PI/2,_=e[0],x=e[2],S=a?-p:e[1],C=o?p:e[3],M=.5*(_+x),P=r[0],$=i+(c?Math.min(0,P-1):P),F=(Ee,te,le)=>r3(Ee,te,le,$),z=W(),k=W(),U=W(),j=W();F(z,_,S),F(k,_,C),F(U,x,C),F(j,x,S);const G=(Ee,te)=>{for(let le=0;le<3;++le)this._convexHull[3*te+le]=Ee[le]};G(z,0),G(k,1),G(U,2),G(j,3);const Y=r[1],Q=i+(c?Math.max(0,Y+1):Y),ne=W(),ie=W(),he=W();r3(ie,M,C,$),r3(he,M,S,$),Be(ne,ie,he),Ye(ne,ne);const ce=W(),ve=W(),ge=(Ee,te)=>{Sn(ve,Ee,te),Ye(ve,ve);const le=-Ve(Ee,ce)/Ve(ve,ce);at(le>=0),De(ve,ve,le),Be(Ee,Ee,ve)};if(2**this.lij[0]>2*this.lij[1]){const Ee=he,te=W();Wt(te,L_e,Ee),Ye(te,te),Wt(ce,Ee,te),Ye(ce,ce),at(Ef(Ve(ce,Ee)/Nh(Ee),0)),ge(z,k),ge(j,U),G(z,0),G(j,3)}else if(2**this.lij[0]!==2*this.lij[1]){const Ee=ie,te=W();Wt(te,L_e,Ee),Ye(te,te),Wt(ce,te,Ee),Ye(ce,ce),ge(k,z),ge(U,j),G(k,1),G(U,2)}const pe=(Ee,te)=>{const le=Q/Ve(te,ne);for(let de=0;de<3;++de)this._convexHull[3*Ee+de]=te[de]*le};pe(4,z),pe(5,k),pe(6,U),pe(7,j)}_getPatchType(){const e=this.lij[1],i=e===0,r=e===(1<{for(let Dt=0;Dt<3;++Dt)ht[Dt]=x[3*Ct+Dt]};{const ht=W(),Ct=W(),Dt=W(),Tt=W(),re=W(),Ht=(hr,Ke,Lt,vt)=>{S(Ct,hr),S(Dt,Ke),S(Tt,Lt),Sn(Ct,Ct,Dt),Sn(Tt,Tt,Dt),Wt(ht,Ct,Tt),Ye(ht,ht);const Bt=Ve(ht,Dt);S(re,vt);const qt=Ve(ht,re),li=Math.abs(qt-Bt);at(Ef(li,0),`Non coplanar ${hr},${Ke},${Lt},${vt} diff = ${li}`)};Ht(0,1,2,3),Ht(4,5,6,7),Ht(0,1,4,5),Ht(1,2,5,6),Ht(2,3,6,7),Ht(3,0,7,4)}const C=Qa(24),M=(ht,Ct,Dt)=>{const Tt=4*ht;for(let re=0;re<3;++re)C[Tt+re]=Ct[re];C[Tt+3]=Dt},P=W(),$=W(),F=W(),z=W(),k=(ht,Ct,Dt,Tt)=>{S(P,Ct),S($,Dt),S(F,Tt),Sn(P,P,$),Ye(P,P),Sn(F,F,$),Ye(F,F),Wt(z,P,F),Ye(z,z);const re=Ve(z,$);M(ht,z,re)};k(0,0,1,2),k(1,1,0,4),k(2,1,5,2),k(3,3,2,6),k(4,4,0,3),k(5,4,6,5);const U=1,j=(ht,Ct,Dt,Tt)=>{const re=4*ht;return C[re]*Ct+C[re+1]*Dt+C[re+2]*Tt-C[re+3]},G=(ht,Ct,Dt,Tt)=>j(ht,Ct,Dt,Tt)>=-U,Y=(ht,Ct)=>G(ht,Ct[0],Ct[1],Ct[2]),Q=2**this.lij[0]>2*this.lij[1],ne=(ht,Ct,Dt)=>Math.sqrt(NFe(ht,Ct,Dt,r[0],r[1],r[2]))ne(ht[0],ht[1],ht[2]),he=(ht,Ct)=>ne(ht[Ct],ht[Ct+1],ht[Ct+2]),ce=this.extentInRadians,ve=.5*(ce[0]+ce[2]),ge=ce[1],pe=ce[3],Ee=W(),te=W();r3(Ee,ve,pe,a),r3(te,ve,ge,a);const le=Q?"Upper":"Lower";let de=!0;for(let ht=0;ht<6;++ht){for(let Ct=0;Ct<8;++Ct){const Dt=3*Ct,Tt=G(ht,x[Dt],x[Dt+1],x[Dt+2]);de&&(de=Tt),at(Tt,`Tile[${this.lij}] Convex hull point ${Ct} outside of plane ${ht}`)}at(Y(ht,te),`Tile[${this.lij}] (${le}) bottom mid outside of plane ${ht}`),at(Y(ht,Ee),`Tile[${this.lij}] (${le}) top mid outside of plane ${ht}`)}at(de,"Not all convex hull points are inside convex hull polyhedron"),at(ie(te),`Tile[${this.lij}] (${le}) bottom mid outside of bounding sphere`),at(ie(Ee),`Tile[${this.lij}] (${le}) top mid outside of bounding sphere`);for(let ht=0;ht<8;++ht){const Ct=he(x,3*ht);at(Ct,`Tile[${this.lij}] Convex hull point ${ht} outside of bounding sphere`)}for(let ht=0;ht<6;++ht)for(let Ct=0;Ct<8;++Ct){const Dt=3*Ct;G(ht,x[Dt],x[Dt+1],x[Dt+2])||console.error(`Tile[${this.lij}] Convex hull point ${Ct} outside of plane ${ht}`)}const be=this.extentInRadians,Se=Math.max(be[2]-be[0],be[3]-be[1]),Ae=Math.round(Se*s),Re=this.renderData;if(!Re)return;const{geometry:Ge,localOrigin:ut}=Re,Ft=(ai=Ge.vertexAttributes)==null?void 0:ai.position;if(!Ft)return;const ei=Ft.count,Mt=W(),ri=Ge.numVerticesPerSide-2,It=ri*ri,dt=Re.geometryState.neighborData,pt=dt.edgeResolutions.reduce((ht,Ct)=>ht+Ct+1,0);for(let ht=0;ht0;Ft.getVec(ht,n),Be(Mt,n,ut);const Ke=Nh(Mt)-s;let Lt=0,vt=!1;const Bt=o[0]-Ke,qt=Ke-o[1],li=Bt>c,mi=qt>c,Dr=li||mi,Nr=()=>{const xi=Ct?"internal":Dt&&!Tt?"edge":Tt?"corner":"pole";return`Tile[${this.lij}].vertex[${ht}]:${xi}`+(li?"(below)":mi?"(above)":"")+(hr?"(Neighbor)":"")},Ze=R9(Mt,r);if(Ze>=i+p){const xi=Ze-i;Dr||(console.error(`${Nr()} is out of the bounding sphere by ${xi.toFixed(0)} / ${i.toFixed(0)}[tol=${p}] h=${Ke.toFixed(0)} / [${o[0].toFixed(0)}..${o[1].toFixed(0)}] (${(xi/i).toFixed(0)})`),vt=!0)}for(let xi=0;xi<6;++xi)if(!G(xi,Mt[0],Mt[1],Mt[2])){const m=j(xi,Mt[0],Mt[1],Mt[2]),D=ht%ri,E=(ht-D)/ri;xi===0&&Bt||xi===5&&qt||(console.error(`${Nr()} (${D},${E})|${ri}] is out of the bounding trapezoid plane ${xi} h=${Math.round(Ke)} / [${Math.round(o[0])}..${Math.round(o[1])}] dist=${Math.round(m)} radii = ${Math.round(i)}/${Math.round(_)}} : maxL = ${Ae}`),++Lt)}if(vt||Lt>0)break}}get convexHull(){return this._convexHull}};const $_e=[128,64,64,32,16,8,8,4];function G4t(t,e,i){return NFe(t[0],t[1],t[2],e[i],e[i+1],e[i+2])}function NFe(t,e,i,r,n,s){const o=r-t,a=n-e,c=s-i;return o*o+a*a+c*c}const r3=(t,e,i,r)=>{const n=Math.cos(e),s=Math.sin(e),o=Math.cos(i),a=Math.sin(i);t[0]=r*o*n,t[1]=r*o*s,t[2]=r*a},L_e=[0,0,1],D_e=W(),N_e=W();let H0=class extends ze{constructor(){super(...arguments),this.fovX=0,this.fovY=0,this.relativeWidthLimit=0,this.relativeHeightLimit=0,this.maxLod=0,this.angledSplitBias=0,this.aboveGround=!0}};y([w()],H0.prototype,"fovX",void 0),y([w()],H0.prototype,"fovY",void 0),y([w()],H0.prototype,"relativeWidthLimit",void 0),y([w()],H0.prototype,"relativeHeightLimit",void 0),y([w()],H0.prototype,"maxLod",void 0),y([w()],H0.prototype,"angledSplitBias",void 0),y([w()],H0.prototype,"aboveGround",void 0),y([w()],H0.prototype,"frustum",void 0),H0=y([Z("esri.views.3d.terrain.SplitLimits")],H0);const H4t=ls().vec3f(J.POSITION).vec2i16(J.UV0).vec2i16(J.NORMALCOMPRESSED,{glNormalized:!0});let q4t=class{constructor(e){this._storage=new X9((i,r)=>e.newCache(i,r),"TileGeometry")}acquire(e){const r=Math.ceil(e/4)*4,n=this._storage.pop(F_e(r));if(n)return n;const s=H4t.createBuffer(r);return s.release=()=>this._release(s),s}_release(e){const i=e.count;this._storage.put(F_e(i),e)}clear(){this._storage.clear()}destroy(){this._storage.destroy()}};function F_e(t){return t.toString()}let FFe=class extends oh{constructor(){super(...arguments),this.blendMode=gt.Normal}};y([fe({count:gt.COUNT})],FFe.prototype,"blendMode",void 0);let Y$=class extends FFe{constructor(){super(...arguments),this.output=Ko.Composite,this.baseOpacityMode=fp.NotRequired,this.premultipliedSource=um.Off}};y([fe({count:Ko.COUNT})],Y$.prototype,"output",void 0),y([fe({count:fp.COUNT})],Y$.prototype,"baseOpacityMode",void 0),y([fe()],Y$.prototype,"premultipliedSource",void 0);var rx;function kFe(t){const e=new Ar;if(e.include(fFe),t.background===rx.Only){const i=t.output===Ko.ColorComposite;return i?e.fragment.uniforms.add(new Oi("backgroundColor",r=>r.backgroundColor)):e.fragment.include(kce),e.fragment.code.add(V` void main() { fragColor = vec4(${i?V`backgroundColor`:V`gridColor(uv)`}, 1.0); } - `),e}return e.include(vFe,t),e.fragment.uniforms.add(new Zt("tex",i=>i.texture)),e.fragment.uniforms.add(new ft("opacity",i=>i.opacity)),e.fragment.code.add(V`void main() { + `),e}return e.include(mFe,t),e.fragment.uniforms.add(new Zt("tex",i=>i.texture)),e.fragment.uniforms.add(new ft("opacity",i=>i.opacity)),e.fragment.code.add(V`void main() { vec4 bgColor = getBackground(uv); fragColor = blendLayers(bgColor, texture(tex, uv), opacity); -}`),e}(function(t){t[t.BelowLayer=0]="BelowLayer",t[t.Only=1]="Only",t[t.COUNT=2]="COUNT"})(K2||(K2={}));const Y$t=Object.freeze(Object.defineProperty({__proto__:null,get BackgroundMode(){return K2},build:VFe},Symbol.toStringTag,{value:"Module"}));let X$t=class extends gFe{constructor(){super(...arguments),this.opacity=1,this.baseOpacity=1,this.texture=null,this.fboTexture=null,this.backgroundColor=Ka}},BFe=class jFe extends Hr{initializeProgram(e){return new Ir(e.rctx,jFe.shader.get().build(this.configuration),Er)}initializePipeline(){return Ti({blending:hd(st.ONE,st.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}};BFe.shader=new Rr(Y$t,()=>we(()=>Promise.resolve().then(()=>FWt),void 0));let GFe=class extends k${constructor(){super(...arguments),this.background=K2.BelowLayer}};y([fe()],GFe.prototype,"background",void 0);let wY=class{constructor(e,i,r,n,s,o){this.texture=e,this.type=i,e.retain(),this.offsetAndScale=Mi(r.offset[0],r.offset[1],r.scale,r.scale),this.opacities=nt(n,s,o)}destroy(){this.texture.release()}};function Rb(t,e){return[t,e]}function Kx(t,e,i){return t[0]=e,t[1]=i,t}function Z$t(t,e,i,r,n){return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}const w0=new iE("0/0/0/0");let J$t=class HFe{static create(e,i,r=null){const n=pp(e.spatialReference),s=i.origin||Rb(e.origin.x,e.origin.y),o=Rb(e.size[0]*i.resolution,e.size[1]*i.resolution),l=Rb(-1/0,-1/0),c=Rb(1/0,1/0),f=Rb(1/0,1/0);r!=null&&(Kx(l,Math.max(0,Math.floor((r.xmin-s[0])/o[0])),Math.max(0,Math.floor((s[1]-r.ymax)/o[1]))),Kx(c,Math.max(0,Math.floor((r.xmax-s[0])/o[0])),Math.max(0,Math.floor((s[1]-r.ymin)/o[1]))),Kx(f,c[0]-l[0]+1,c[1]-l[1]+1));const{cols:_,rows:x}=i;let T,A,M,I;return!r&&_&&x&&(Kx(l,_[0],x[0]),Kx(c,_[1],x[1]),Kx(f,_[1]-_[0]+1,x[1]-x[0]+1)),e.isWrappable?(T=Rb(Math.ceil(Math.round((n.valid[1]-n.valid[0])/i.resolution)/e.size[0]),f[1]),A=Rb(Math.floor((n.origin[0]-s[0])/o[0]),l[1]),M=Rb(T[0]+A[0]-1,c[1]),I=!0):(A=l,M=c,T=f,I=!1),new HFe(i.level,i.resolution,i.scale,s,l,c,f,o,A,M,T,I)}constructor(e,i,r,n,s,o,l,c,f,_,x,T){this.level=e,this.resolution=i,this.scale=r,this.origin=n,this.first=s,this.last=o,this.size=l,this.norm=c,this.worldStart=f,this.worldEnd=_,this.worldSize=x,this.wrap=T}normalizeCol(e){if(!this.wrap)return e;const i=this.worldSize[0];return e<0?i-1-Math.abs((e+1)%i):e%i}denormalizeCol(e,i){return this.wrap?this.worldSize[0]*i+e:e}getWorldForColumn(e){return this.wrap?Math.floor(e/this.worldSize[0]):0}getFirstColumnForWorld(e){return e*this.worldSize[0]+this.first[0]}getLastColumnForWorld(e){return e*this.worldSize[0]+this.first[0]+this.size[0]-1}getColumnForX(e){return(e-this.origin[0])/this.norm[0]}getXForColumn(e){return this.origin[0]+e*this.norm[0]}getRowForY(e){return(this.origin[1]-e)/this.norm[1]}getYForRow(e){return this.origin[1]-e*this.norm[1]}getTileBounds(e,i,r=!1){w0.set(i);const n=r?w0.col:this.denormalizeCol(w0.col,w0.world),s=w0.row;return Z$t(e,this.getXForColumn(n),this.getYForRow(s+1),this.getXForColumn(n+1),this.getYForRow(s)),e}getTileCoords(e,i,r=!1){w0.set(i);const n=r?w0.col:this.denormalizeCol(w0.col,w0.world);return Array.isArray(e)?Kx(e,this.getXForColumn(n),this.getYForRow(w0.row)):(e.x=this.getXForColumn(n),e.y=this.getYForRow(w0.row)),e}},kie=class{constructor(){this.spans=[]}acquire(e){this.lodInfo=e}release(){this.lodInfo=null,this.spans.length=0}forEach(e,i){const{spans:r,lodInfo:n}=this,{level:s}=n;if(r.length!==0)for(const{row:o,colFrom:l,colTo:c}of r)for(let f=l;f<=c;f++)e.call(i,s,o,n.normalizeCol(f),n.getWorldForColumn(f))}};kie.pool=new Ec(kie);let xY=class{constructor(e,i,r){this.row=e,this.colFrom=i,this.colTo=r}};const uo=new iE("0/0/0/0");let K$t=class qFe{static create(e,i){e[1]>i[1]&&([e,i]=[i,e]);const[r,n]=e,[s,o]=i,l=s-r,c=o-n,f=c!==0?l/c:0,_=(Math.ceil(n)-n)*f,x=(Math.floor(n)-n)*f;return new qFe(r,Math.floor(n),Math.ceil(o),f,l<0?_:x,l<0?x:_,l<0?s:r,l<0?r:s)}constructor(e,i,r,n,s,o,l,c){this.x=e,this.ymin=i,this.ymax=r,this.invM=n,this.leftAdjust=s,this.rightAdjust=o,this.leftBound=l,this.rightBound=c}incrRow(){this.x+=this.invM}getLeftCol(){return Math.max(this.x+this.leftAdjust,this.leftBound)}getRightCol(){return Math.min(this.x+this.rightAdjust,this.rightBound)}};const Ed=[[0,0],[0,0],[0,0],[0,0]],Q$t=1e-6;let cpi=class{constructor(e,i=null,r=e.lods[0].level,n=e.lods[e.lods.length-1].level){this.tileInfo=e,this.fullExtent=i,this.scales=[],this._infoByScale={},this._infoByLevel={};const s=e.lods.filter(l=>l.level>=r&&l.level<=n);this.minScale=s[0].scale,this.maxScale=s[s.length-1].scale;const o=this._lodInfos=s.map(l=>J$t.create(e,l,i));s.forEach((l,c)=>{this._infoByLevel[l.level]=o[c],this._infoByScale[l.scale]=o[c],this.scales[c]=l.scale},this),this._wrap=e.isWrappable}get spatialReference(){return this.tileInfo.spatialReference}getLODInfoAt(e){return this._infoByLevel[typeof e=="number"?e:e.level]}getTileBounds(e,i,r=!1){uo.set(i);const n=this._infoByLevel[uo.level];return n?n.getTileBounds(e,uo,r):e}getTileCoords(e,i,r=!1){uo.set(i);const n=this._infoByLevel[uo.level];return n?n.getTileCoords(e,uo,r):e}getTileCoverage(e,i=192,r=!0,n="closest"){if(!r&&(e.scale>this.minScale||e.scale100)return null;let L=[];for(c=x;c=0;F--){const z=L[F];f=Math.min(f,z.getLeftCol()),_=Math.max(_,z.getRightCol())}if(f=Math.floor(f),_=Math.floor(_),c>=s.first[1]&&c<=s.last[1])if(l)if(s.size[0]s.last[0]||_=0;F--){const z=L[F];z.ymax>=c?z.incrRow():L.splice(F,1)}}return o}getTileParentId(e){uo.set(e);const i=this._infoByLevel[uo.level],r=this._lodInfos.indexOf(i)-1;return r<0?null:(this._getTileIdAtLOD(uo,this._lodInfos[r],uo),uo.id)}getTileResolution(e){const i=this._infoByLevel[typeof e=="object"?e.level:e];return i?i.resolution:-1}getTileScale(e){const i=this._infoByLevel[e.level];return i?i.scale:-1}intersects(e,i){uo.set(i);const r=this._infoByLevel[uo.level],n=e.lodInfo;if(n.resolution>r.resolution){this._getTileIdAtLOD(uo,n,uo);const o=n.denormalizeCol(uo.col,uo.world);for(const l of e.spans)if(l.row===uo.row&&l.colFrom<=o&&l.colTo>=o)return!0}if(n.resolution(I[0]=Math.min(I[0],L.row),I[1]=Math.max(I[1],L.row),I[2]=Math.min(I[2],L.colFrom),I[3]=Math.max(I[3],L.colTo),I),[1/0,-1/0,1/0,-1/0]),_=r.denormalizeCol(uo.col,uo.world),x=n.getColumnForX(r.getXForColumn(_)),T=n.getRowForY(r.getYForRow(uo.row)),A=n.getColumnForX(r.getXForColumn(_+1))-1,M=n.getRowForY(r.getYForRow(uo.row+1))-1;return!(x>f||Al||Mo.row===uo.row&&o.colFrom<=s&&o.colTo>=s)}normalizeBounds(e,i,r){if(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],this._wrap){const n=pp(this.tileInfo.spatialReference),s=-r*(n.valid[1]-n.valid[0]);e[0]+=s,e[2]+=s}return e}getSmallestInfoForScale(e){const i=this.scales;if(this._infoByScale[e])return this._infoByScale[e];if(e>i[0])return this._infoByScale[i[0]];for(let r=1;ri[r]+Q$t)return this._infoByScale[i[r-1]];return this._infoByScale[i[i.length-1]]}getClosestInfoForScale(e){const i=this.scales;return this._infoByScale[e]||(e=i.reduce((r,n)=>Math.abs(n-e)=0;r--)if(e0&&(this._map.clear(),this._observable.notify())}delete(e){const i=this._map.delete(e);return i&&this._observable.notify(),i}entries(){return wi(this._observable),this._map.entries()}forEach(e,i){wi(this._observable),this._map.forEach((r,n)=>e.call(i,r,n,this),i)}get(e){return wi(this._observable),this._map.get(e)}has(e){return wi(this._observable),this._map.has(e)}keys(){return wi(this._observable),this._map.keys()}set(e,i){return this._map.set(e,i),this._observable.notify(),this}values(){return wi(this._observable),this._map.values()}[Symbol.iterator](){return wi(this._observable),this._map[Symbol.iterator]()}get[Symbol.toStringTag](){return this._map[Symbol.toStringTag]}},eLt=class{constructor(e,i){this.item=e,this.controller=i,this.promise=null}},WFe=class{constructor(e){this._schedule=null,this._task=null,this._deferreds=new SY,this._controllers=new SY,this._processingItems=new SY,this._pausedSignal=m5(!1),this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new cU(e.peeker),this.process=e.process;const i=e.scheduler;e.priority&&i&&(this._task=i.registerTask(e.priority,this))}destroy(){this.clear(),this._schedule=en(this._schedule),this._task=en(this._task)}get updating(){var e;return!!((e=this._task)!=null&&e.updating)||this.running}get length(){return this._processingItems.size+this._queue.length}abort(e){const i=this._controllers.get(e);i&&i.abort()}clear(){this._queue.clear();const e=[];this._controllers.forEach(i=>e.push(i)),this._controllers.clear(),e.forEach(i=>i.abort()),this._processingItems.clear(),this._cancelNext()}forEach(e){this._deferreds.forEach((i,r)=>e(r))}get(e){const i=this._deferreds.get(e);return i?i.promise:void 0}isOngoing(e){return this._processingItems.has(e)}has(e){return this._deferreds.has(e)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(e,i){const r=this.get(e);if(r)return r;const n=new AbortController;let s=null;i&&(s=Yl(i,()=>n.abort()));const o=()=>{const _=this._processingItems.get(e);_&&_.controller.abort(),l(),f.reject(ur())},l=()=>{c.remove(),s!=null&&s.remove(),this._deferreds.delete(e),this._controllers.delete(e),this._queue.remove(e),this._processingItems.delete(e),this._scheduleNext()},c=g9(n.signal,o),f=Jl();return this._deferreds.set(e,f),this._controllers.set(e,n),f.promise.then(l,l),this._queue.push(e),this._scheduleNext(),f.promise}last(){return this._queue.last()}peek(){return this._queue.peek()}popLast(){return this._queue.popLast()}reset(){const e=[];this._processingItems.forEach(i=>e.push(i)),this._processingItems.clear();for(const i of e)this._queue.push(i.item),i.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get running(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size0&&this._processingItems.size{this._schedule=null,this._next()}))}_next(){for(;this._queue.length>0&&this._processingItems.sizethis._processResult(n,s),s=>this._processError(n,s))):this._processResult(n,i)}get test(){return{update:e=>this.runTask(e)}}};function tLt(t,e){return t.length=0,e.forEach(i=>t.push(i)),t}const TY=new Set,g8=[],DC=new Map,F_e=[0,0];let Qx=class extends ze{constructor(e){super(e),this._keyToItem=new Map,this.concurrency=6,this.strategy="scale-first",this.tileInfoView=null}initialize(){const{concurrency:e,process:i,strategy:r}=this;this._queue=new WFe({concurrency:e,process:(n,s)=>{const o=this._keyToItem.get(n);return i(o,{signal:s})},peeker:r==="scale-first"?n=>this._peekByScaleFirst(n):n=>this._peekByCenterFirst(n)})}destroy(){this.clear(),this._queue=et(this._queue)}get length(){return this._queue?this._queue.length:0}get onGoingCount(){return this._keyToItem.size}abort(e){const i=typeof e=="string"?e:e.id;this._queue.abort(i)}clear(){this._queue.clear(),this._keyToItem.clear()}has(e){return typeof e=="string"?this._keyToItem.has(e):this._keyToItem.has(e.id)}isOngoing(e){const i=typeof e=="string"?e:e.id;return this.has(i)&&this._queue.isOngoing(i)}pause(){this._queue.pause()}push(e){const i=e.key.id;if(this._queue.has(i))return this._queue.get(i);const r=this._queue.push(i),n=()=>{this._keyToItem.delete(i)};return this._keyToItem.set(i,e),r.then(n,n),r}reset(){this._queue.reset()}resume(){this._queue.resume()}_peekByScaleFirst(e){if(!this.state)return e.values().next().value;const i=this.tileInfoView;let r=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY;e.forEach(_=>{const x=this._keyToItem.get(_),T=this.tileInfoView.getTileScale(x.key);DC.has(T)||(DC.set(T,[]),r=Math.max(T,r),n=Math.min(T,n)),DC.get(T).push(x.key),TY.add(T)});let s=this.state.scale;DC.has(s)||(tLt(g8,TY),g8.sort((_,x)=>_-x),s=g8.reduce((_,x)=>Math.abs(x-s){const T=l.denormalizeCol(_.col,_.world),A=l.denormalizeCol(x.col,x.world);return Math.sqrt((c-T)*(c-T)+(f-_.row)*(f-_.row))-Math.sqrt((c-A)*(c-A)+(f-x.row)*(f-x.row))}),TY.clear(),DC.clear(),o[0].id}_peekByCenterFirst(e){if(!this.state)return e.values().next().value;const i=this.tileInfoView,r=this.state.center;let n,s=Number.POSITIVE_INFINITY;return e.forEach(o=>{const l=this._keyToItem.get(o);i.getTileCoords(F_e,l.key);const c=Dm(F_e,r);c=2}function TLt(t){return Array.isArray(t)&&t.length>=2}function y8(t){return SLt(t)||TLt(t)}const v8={102100:{maxX:20037508342788905e-9,minX:-20037508342788905e-9,plus180Line:new xc({paths:[[[20037508342788905e-9,-20037508342788905e-9],[20037508342788905e-9,20037508342788905e-9]]],spatialReference:at.WebMercator}),minus180Line:new xc({paths:[[[-20037508342788905e-9,-20037508342788905e-9],[-20037508342788905e-9,20037508342788905e-9]]],spatialReference:at.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new xc({paths:[[[180,-180],[180,180]]],spatialReference:at.WGS84}),minus180Line:new xc({paths:[[[-180,-180],[-180,180]]],spatialReference:at.WGS84})}};function rT(t,e){return Math.ceil((t-e)/(2*e))}function JFe(t,e){const i=z$(t);for(const r of i)for(const n of r)n[0]+=e;return t}function z$(t){return xB(t)?t.rings:t.paths}async function ELt(t,e,i,r){const n=d6(t),s=e[0].spatialReference,o={...r,responseType:"json",query:{...n.query,f:"json",sr:Cz(s),target:JSON.stringify({geometryType:R9(e[0]),geometries:e}),cutter:JSON.stringify(i)}},l=await bi(n.path+"/cut",o),{cutIndexes:c,geometries:f=[]}=l.data;return{cutIndexes:c,geometries:f.map(_=>{const x=O2(_);return x.spatialReference=s,x})}}async function CLt(t,e,i){const r=typeof t=="string"?qs(t):t,n=e[0].spatialReference,s=R9(e[0]),o={...i,query:{...r.query,f:"json",sr:Cz(n),geometries:JSON.stringify(t4t(e))}},{data:l}=await bi(r.path+"/simplify",o);return W7e(l.geometries,s,n)}const KFe=Ce.getLogger("esri.geometry.support.normalizeUtils");function ALt(t){return t.type==="polygon"}function MLt(t){return t[0].type==="polygon"}function OLt(t){return t[0].type==="polyline"}function PLt(t,e){if(!(t instanceof xc||t instanceof Qa)){const n="straightLineDensify: the input geometry is neither polyline nor polygon";throw KFe.error(n),new se(n)}const i=z$(t),r=[];for(const n of i){const s=[];r.push(s),s.push([n[0][0],n[0][1]]);for(let o=0;o1){for(let z=1;z<=M-1;z++){const k=z*e,U=A*k+l,j=T*k+c;s.push([U,j])}const I=(x+Math.floor(M-1)*e)/2,L=A*I+l,F=T*I+c;s.push([L,F])}s.push([f,_])}}return ALt(t)?new Qa({rings:r,spatialReference:t.spatialReference}):new xc({paths:r,spatialReference:t.spatialReference})}function k_e(t,e,i){if(e){const r=PLt(t,1e6);t=HS(r,!0)}return i&&(t=JFe(t,i)),t}function z_e(t,e,i){if(Array.isArray(t)){const r=t[0];if(r>e){const n=rT(r,e);t[0]=r+n*(-2*e)}else if(re){const n=rT(r,e);t=t.clone().offset(n*(-2*e),0)}else if(r{if(f[0]<180)return!0;{let _=0;for(let T=0;T_?A:_}_=Number(_.toFixed(9));const x=-360*rT(_,180);for(let T=0;Tz_e(H,l,c)),M.push(j)}else if(U.type==="extent"){const j=U.clone()._normalize(!1,!1,s);M.push(j.rings?new Qa(j):j)}else if(U.extent){const j=U.extent,H=rT(j.xmin,c)*(2*l);let Y=H===0?U.clone():JFe(U.clone(),H);j.offset(H,0),j.intersects(_)&&j.xmax!==l?(T=j.xmax>T?j.xmax:T,Y=k_e(Y,o),A.push(Y),M.push("cut")):j.intersects(x)&&j.xmin!==c?(T=j.xmax*(2*l)>T?j.xmax*(2*l):T,Y=k_e(Y,o,360),A.push(Y),M.push("cut")):M.push(Y)}else M.push(U.clone());else M.push(U);else M.push(U);let I=rT(T,l),L=-90;const F=I,z=new xc;for(;I>0;){const U=360*I-180;z.addPath([[U,L],[U,-1*L]]),L*=-1,I--}if(A.length>0&&F>0){const U=RLt(A,await ELt(r,A,z,i)),j=[],H=[];for(let ne=0;ne1&&he.rings.length>=ce.rings.length?(j.push(he),H.push("simplify")):H.push(o?Ty(he):he)}}if(!j.length)return H;const Y=await CLt(r,j,i),Q=[];for(let ne=0;nes?l=Math.ceil(Math.abs(e-s)/o):es?c=Math.ceil(Math.abs(t-s)/o):ts?f-=o:_s.xmax)&&(kc[0]=$Lt(r,n[0],o)),uw(t,kc,l)}getScreenTransform(t,e){const{center:i}=this._viewpoint2D,r=this._get("pixelRatio")||1,n=this._get("size");return Dce(t,i,n,e,0,r),t}_update(){const{center:t,spatialReference:e,scale:i,rotation:r}=this._viewpoint2D,n=this._get("pixelRatio")||1,s=this._get("size"),o=new ih({targetGeometry:new mt(t[0],t[1],e),scale:i,rotation:r});if(this._set("viewpoint",o),!s||!e||!i)return;this.resolution=OG(o),this.rotation=r,this.scale=i,this.spatialReference=e,Qo(this.center,t);const l=s[0]!==0?2/s[0]:0,c=s[1]!==0?-2/s[1]:0;Toe(this.displayMat3,l,0,0,0,c,0,-1,1,1);const f=Eoe(this.viewMat3),_=vf(s[0]/2,s[1]/2),x=vf(-s[0]/2,-s[1]/2),T=mB(r);eU(f,f,_),Coe(f,f,T),eU(f,f,x),s5(this.displayViewMat3,this.displayMat3,f);const A=$ce(this.viewMat2d,_);return AG(A,A,T),MG(A,A,x),kLt(this.extent,o,s),VLt(this.transform,o,s,n),YFe(this.inverseTransform,this.transform),BLt(this.transformNoRotation,o,s,n),this.worldScreenWidth=GLt(this.spatialReference,this.resolution),this._set("id",this.id+1),this}};y([w({readOnly:!0})],pw.prototype,"id",void 0),y([w({value:1,json:{write:!0}})],pw.prototype,"pixelRatio",null),y([w({json:{write:!0}})],pw.prototype,"size",null),y([w()],pw.prototype,"spatialReference",void 0),y([w({type:ih,json:{write:!0}})],pw.prototype,"viewpoint",null),pw=zie=y([Z("esri.views.2d.ViewState")],pw);const HLt=pw;var Uie,Vie,U_e,V_e,B_e,j_e,G_e,H_e,q_e,W_e,Y_e,X_e,Z_e,J_e,K_e,Q_e,ebe,tbe,ibe,rbe,nbe,sbe,obe,abe,lbe,cbe,ube,hbe,dbe,pbe,fbe,mbe,gbe,ybe,vbe,_be,bbe,wbe,xbe,Sbe,Tbe,Ebe,Cbe,Abe,Mbe,Obe,Pbe,Rbe,Ibe,$be,Lbe,Dbe,Nbe,Fbe,kbe,zbe,Ube,Vbe,Bbe,jbe,Gbe;(function(t){t[t.BUTT=0]="BUTT",t[t.ROUND=1]="ROUND",t[t.SQUARE=2]="SQUARE",t[t.UNKNOWN=4]="UNKNOWN"})(Uie||(Uie={})),function(t){t[t.BEVEL=0]="BEVEL",t[t.ROUND=1]="ROUND",t[t.MITER=2]="MITER",t[t.UNKNOWN=4]="UNKNOWN"}(Vie||(Vie={})),function(t){t[t.SCREEN=0]="SCREEN",t[t.MAP=1]="MAP"}(U_e||(U_e={})),function(t){t[t.Tint=0]="Tint",t[t.Ignore=1]="Ignore",t[t.Multiply=99]="Multiply"}(V_e||(V_e={})),function(t){t.Both="Both",t.JustBegin="JustBegin",t.JustEnd="JustEnd",t.None="None"}(B_e||(B_e={})),function(t){t[t.Mosaic=0]="Mosaic",t[t.Centered=1]="Centered"}(j_e||(j_e={})),function(t){t[t.Normal=0]="Normal",t[t.Superscript=1]="Superscript",t[t.Subscript=2]="Subscript"}(G_e||(G_e={})),function(t){t[t.MSSymbol=0]="MSSymbol",t[t.Unicode=1]="Unicode"}(H_e||(H_e={})),function(t){t[t.Unspecified=0]="Unspecified",t[t.TrueType=1]="TrueType",t[t.PSOpenType=2]="PSOpenType",t[t.TTOpenType=3]="TTOpenType",t[t.Type1=4]="Type1"}(q_e||(q_e={})),function(t){t[t.Display=0]="Display",t[t.Map=1]="Map"}(W_e||(W_e={})),function(t){t.None="None",t.Loop="Loop",t.Oscillate="Oscillate"}(Y_e||(Y_e={})),function(t){t[t.Z=0]="Z",t[t.X=1]="X",t[t.Y=2]="Y"}(X_e||(X_e={})),function(t){t[t.XYZ=0]="XYZ",t[t.ZXY=1]="ZXY",t[t.YXZ=2]="YXZ"}(Z_e||(Z_e={})),function(t){t[t.Rectangle=0]="Rectangle",t[t.RoundedRectangle=1]="RoundedRectangle",t[t.Oval=2]="Oval"}(J_e||(J_e={})),function(t){t[t.None=0]="None",t[t.Alpha=1]="Alpha",t[t.Screen=2]="Screen",t[t.Multiply=3]="Multiply",t[t.Add=4]="Add"}(K_e||(K_e={})),function(t){t[t.TTB=0]="TTB",t[t.RTL=1]="RTL",t[t.BTT=2]="BTT"}(Q_e||(Q_e={})),function(t){t[t.None=0]="None",t[t.SignPost=1]="SignPost",t[t.FaceNearPlane=2]="FaceNearPlane"}(ebe||(ebe={})),function(t){t[t.Float=0]="Float",t[t.String=1]="String",t[t.Boolean=2]="Boolean"}(tbe||(tbe={})),function(t){t[t.Intersect=0]="Intersect",t[t.Subtract=1]="Subtract"}(ibe||(ibe={})),function(t){t.OpenEnded="OpenEnded",t.Block="Block",t.Crossed="Crossed"}(rbe||(rbe={})),function(t){t.FullGeometry="FullGeometry",t.PerpendicularFromFirstSegment="PerpendicularFromFirstSegment",t.ReversedFirstSegment="ReversedFirstSegment",t.PerpendicularToSecondSegment="PerpendicularToSecondSegment",t.SecondSegmentWithTicks="SecondSegmentWithTicks",t.DoublePerpendicular="DoublePerpendicular",t.OppositeToFirstSegment="OppositeToFirstSegment",t.TriplePerpendicular="TriplePerpendicular",t.HalfCircleFirstSegment="HalfCircleFirstSegment",t.HalfCircleSecondSegment="HalfCircleSecondSegment",t.HalfCircleExtended="HalfCircleExtended",t.OpenCircle="OpenCircle",t.CoverageEdgesWithTicks="CoverageEdgesWithTicks",t.GapExtentWithDoubleTicks="GapExtentWithDoubleTicks",t.GapExtentMidline="GapExtentMidline",t.Chevron="Chevron",t.PerpendicularWithArc="PerpendicularWithArc",t.ClosedHalfCircle="ClosedHalfCircle",t.TripleParallelExtended="TripleParallelExtended",t.ParallelWithTicks="ParallelWithTicks",t.Parallel="Parallel",t.PerpendicularToFirstSegment="PerpendicularToFirstSegment",t.ParallelOffset="ParallelOffset",t.OffsetOpposite="OffsetOpposite",t.OffsetSame="OffsetSame",t.CircleWithArc="CircleWithArc",t.DoubleJog="DoubleJog",t.PerpendicularOffset="PerpendicularOffset",t.LineExcludingLastSegment="LineExcludingLastSegment",t.MultivertexArrow="MultivertexArrow",t.CrossedArrow="CrossedArrow",t.ChevronArrow="ChevronArrow",t.ChevronArrowOffset="ChevronArrowOffset",t.PartialFirstSegment="PartialFirstSegment",t.Arch="Arch",t.CurvedParallelTicks="CurvedParallelTicks",t.Arc90Degrees="Arc90Degrees"}(nbe||(nbe={})),function(t){t.Mitered="Mitered",t.Bevelled="Bevelled",t.Rounded="Rounded",t.Square="Square",t.TrueBuffer="TrueBuffer"}(sbe||(sbe={})),function(t){t.ClosePath="ClosePath",t.ConvexHull="ConvexHull",t.RectangularBox="RectangularBox"}(obe||(obe={})),function(t){t.BeginningOfLine="BeginningOfLine",t.EndOfLine="EndOfLine"}(abe||(abe={})),function(t){t.Mitered="Mitered",t.Bevelled="Bevelled",t.Rounded="Rounded",t.Square="Square"}(lbe||(lbe={})),function(t){t.Fast="Fast",t.Accurate="Accurate"}(cbe||(cbe={})),function(t){t.BeginningOfLine="BeginningOfLine",t.EndOfLine="EndOfLine"}(ube||(ube={})),function(t){t.Sinus="Sinus",t.Square="Square",t.Triangle="Triangle",t.Random="Random"}(hbe||(hbe={})),function(t){t[t.None=0]="None",t[t.Default=1]="Default",t[t.Force=2]="Force"}(dbe||(dbe={})),function(t){t[t.Buffered=0]="Buffered",t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.AlongLine=3]="AlongLine"}(pbe||(pbe={})),function(t){t[t.Linear=0]="Linear",t[t.Rectangular=1]="Rectangular",t[t.Circular=2]="Circular",t[t.Buffered=3]="Buffered"}(fbe||(fbe={})),function(t){t[t.Discrete=0]="Discrete",t[t.Continuous=1]="Continuous"}(mbe||(mbe={})),function(t){t[t.AcrossLine=0]="AcrossLine",t[t.AloneLine=1]="AloneLine"}(gbe||(gbe={})),function(t){t[t.Left=0]="Left",t[t.Right=1]="Right",t[t.Center=2]="Center",t[t.Justify=3]="Justify"}(ybe||(ybe={})),function(t){t[t.Base=0]="Base",t[t.MidPoint=1]="MidPoint",t[t.ThreePoint=2]="ThreePoint",t[t.FourPoint=3]="FourPoint",t[t.Underline=4]="Underline",t[t.CircularCW=5]="CircularCW",t[t.CircularCCW=6]="CircularCCW"}(vbe||(vbe={})),function(t){t.Butt="Butt",t.Round="Round",t.Square="Square"}(_be||(_be={})),function(t){t.NoConstraint="NoConstraint",t.HalfPattern="HalfPattern",t.HalfGap="HalfGap",t.FullPattern="FullPattern",t.FullGap="FullGap",t.Custom="Custom"}(bbe||(bbe={})),function(t){t[t.None=-1]="None",t[t.Custom=0]="Custom",t[t.Circle=1]="Circle",t[t.OpenArrow=2]="OpenArrow",t[t.ClosedArrow=3]="ClosedArrow",t[t.Diamond=4]="Diamond"}(wbe||(wbe={})),function(t){t[t.ExtraLeading=0]="ExtraLeading",t[t.Multiple=1]="Multiple",t[t.Exact=2]="Exact"}(xbe||(xbe={})),function(t){t.Bevel="Bevel",t.Round="Round",t.Miter="Miter"}(Sbe||(Sbe={})),function(t){t[t.Default=0]="Default",t[t.String=1]="String",t[t.Numeric=2]="Numeric"}(Tbe||(Tbe={})),function(t){t[t.InsidePolygon=0]="InsidePolygon",t[t.PolygonCenter=1]="PolygonCenter",t[t.RandomlyInsidePolygon=2]="RandomlyInsidePolygon"}(Ebe||(Ebe={})),function(t){t[t.Tint=0]="Tint",t[t.Replace=1]="Replace",t[t.Multiply=2]="Multiply"}(Cbe||(Cbe={})),function(t){t[t.ClipAtBoundary=0]="ClipAtBoundary",t[t.RemoveIfCenterOutsideBoundary=1]="RemoveIfCenterOutsideBoundary",t[t.DoNotTouchBoundary=2]="DoNotTouchBoundary",t[t.DoNotClip=3]="DoNotClip"}(Abe||(Abe={})),function(t){t.NoConstraint="NoConstraint",t.WithMarkers="WithMarkers",t.WithFullGap="WithFullGap",t.WithHalfGap="WithHalfGap",t.Custom="Custom"}(Mbe||(Mbe={})),function(t){t.Fixed="Fixed",t.Random="Random",t.RandomFixedQuantity="RandomFixedQuantity"}(Obe||(Obe={})),function(t){t.LineMiddle="LineMiddle",t.LineBeginning="LineBeginning",t.LineEnd="LineEnd",t.SegmentMidpoint="SegmentMidpoint"}(Pbe||(Pbe={})),function(t){t.OnPolygon="OnPolygon",t.CenterOfMass="CenterOfMass",t.BoundingBoxCenter="BoundingBoxCenter"}(Rbe||(Rbe={})),function(t){t[t.Low=0]="Low",t[t.Medium=1]="Medium",t[t.High=2]="High"}(Ibe||(Ibe={})),function(t){t[t.MarkerCenter=0]="MarkerCenter",t[t.MarkerBounds=1]="MarkerBounds"}($be||($be={})),function(t){t[t.None=0]="None",t[t.PropUniform=1]="PropUniform",t[t.PropNonuniform=2]="PropNonuniform",t[t.DifUniform=3]="DifUniform",t[t.DifNonuniform=4]="DifNonuniform"}(Lbe||(Lbe={})),function(t){t.Tube="Tube",t.Strip="Strip",t.Wall="Wall"}(Dbe||(Dbe={})),function(t){t[t.Random=0]="Random",t[t.Increasing=1]="Increasing",t[t.Decreasing=2]="Decreasing",t[t.IncreasingThenDecreasing=3]="IncreasingThenDecreasing"}(Nbe||(Nbe={})),function(t){t[t.Relative=0]="Relative",t[t.Absolute=1]="Absolute"}(Fbe||(Fbe={})),function(t){t[t.Normal=0]="Normal",t[t.LowerCase=1]="LowerCase",t[t.Allcaps=2]="Allcaps"}(kbe||(kbe={})),function(t){t[t.LTR=0]="LTR",t[t.RTL=1]="RTL"}(zbe||(zbe={})),function(t){t.Draft="Draft",t.Picture="Picture",t.Text="Text"}(Ube||(Ube={})),function(t){t[t.Top=0]="Top",t[t.Center=1]="Center",t[t.Baseline=2]="Baseline",t[t.Bottom=3]="Bottom"}(Vbe||(Vbe={})),function(t){t[t.Right=0]="Right",t[t.Upright=1]="Upright"}(Bbe||(Bbe={})),function(t){t[t.Small=0]="Small",t[t.Medium=1]="Medium",t[t.Large=2]="Large"}(jbe||(jbe={})),function(t){t[t.Calm=0]="Calm",t[t.Rippled=1]="Rippled",t[t.Slight=2]="Slight",t[t.Moderate=3]="Moderate"}(Gbe||(Gbe={}));var Bie,FS,jie,hV,Gie,dV,Hie,kS,qie;(function(t){t[t.BACKGROUND=0]="BACKGROUND",t[t.FILL=1]="FILL",t[t.LINE=2]="LINE",t[t.SYMBOL=3]="SYMBOL",t[t.CIRCLE=4]="CIRCLE"})(Bie||(Bie={})),function(t){t[t.VISIBLE=0]="VISIBLE",t[t.NONE=1]="NONE"}(FS||(FS={})),function(t){t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.LINE_CENTER=2]="LINE_CENTER"}(jie||(jie={})),function(t){t[t.MAP=0]="MAP",t[t.VIEWPORT=1]="VIEWPORT",t[t.AUTO=2]="AUTO"}(hV||(hV={})),function(t){t[t.AUTO=0]="AUTO",t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT"}(Gie||(Gie={})),function(t){t[t.CENTER=0]="CENTER",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.TOP=3]="TOP",t[t.BOTTOM=4]="BOTTOM",t[t.TOP_LEFT=5]="TOP_LEFT",t[t.TOP_RIGHT=6]="TOP_RIGHT",t[t.BOTTOM_LEFT=7]="BOTTOM_LEFT",t[t.BOTTOM_RIGHT=8]="BOTTOM_RIGHT"}(dV||(dV={})),function(t){t[t.NONE=0]="NONE",t[t.UPPERCASE=1]="UPPERCASE",t[t.LOWERCASE=2]="LOWERCASE"}(Hie||(Hie={})),function(t){t[t.MAP=0]="MAP",t[t.VIEWPORT=1]="VIEWPORT"}(kS||(kS={})),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(qie||(qie={}));let x0=class{};x0.backgroundLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:FS.VISIBLE}},x0.fillLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:FS.VISIBLE}},x0.lineLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:FS.VISIBLE},"line-cap":{type:"enum",values:["butt","round","square"],default:Uie.BUTT},"line-join":{type:"enum",values:["bevel","round","miter"],default:Vie.MITER},"line-miter-limit":{type:"number",default:2},"line-round-limit":{type:"number",default:1.05}},x0.symbolLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:FS.VISIBLE},"symbol-avoid-edges":{type:"boolean",default:!1},"symbol-placement":{type:"enum",values:["point","line","line-center"],default:jie.POINT},"symbol-sort-key":{type:"number",default:-1},"symbol-spacing":{type:"number",minimum:1,default:250},"icon-allow-overlap":{type:"boolean",default:!1},"icon-anchor":{type:"enum",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],default:dV.CENTER},"icon-ignore-placement":{type:"boolean",default:!1},"icon-image":{type:"string"},"icon-keep-upright":{type:"boolean",default:!1},"icon-offset":{type:"array",value:"number",length:2,default:[0,0]},"icon-optional":{type:"boolean",default:!1},"icon-padding":{type:"number",minimum:0,default:2},"icon-rotate":{type:"number",default:0},"icon-rotation-alignment":{type:"enum",values:["map","viewport","auto"],default:hV.AUTO},"icon-size":{type:"number",minimum:0,default:1},"text-allow-overlap":{type:"boolean",default:!1},"text-anchor":{type:"enum",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],default:dV.CENTER},"text-field":{type:"string"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"]},"text-ignore-placement":{type:"boolean",default:!1},"text-justify":{type:"enum",values:["auto","left","center","right"],default:Gie.CENTER},"text-keep-upright":{type:"boolean",default:!0},"text-letter-spacing":{type:"number",default:0},"text-line-height":{type:"number",default:1.2},"text-max-angle":{type:"number",minimum:0,default:45},"text-max-width":{type:"number",minimum:0,default:10},"text-offset":{type:"array",value:"number",length:2,default:[0,0]},"text-optional":{type:"boolean",default:!1},"text-padding":{type:"number",minimum:0,default:2},"text-rotate":{type:"number",default:0},"text-rotation-alignment":{type:"enum",values:["map","viewport","auto"],default:hV.AUTO},"text-size":{type:"number",minimum:0,default:16},"text-transform":{type:"enum",values:["none","uppercase","lowercase"],default:Hie.NONE},"text-writing-mode":{type:"array",value:"enum",values:["horizontal","vertical"],default:[qie.HORIZONTAL]}},x0.circleLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:FS.VISIBLE}},x0.backgroundPaintDefinition={"background-color":{type:"color",default:[0,0,0,1]},"background-opacity":{type:"number",minimum:0,maximum:1,default:1},"background-pattern":{type:"string"}},x0.fillPaintDefinition={"fill-antialias":{type:"boolean",default:!0},"fill-color":{type:"color",default:[0,0,0,1]},"fill-opacity":{type:"number",minimum:0,maximum:1,default:1},"fill-outline-color":{type:"color",default:[0,0,0,0]},"fill-pattern":{type:"string"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0]},"fill-translate-anchor":{type:"enum",values:["map","viewport"],default:kS.MAP}},x0.linePaintDefinition={"line-blur":{type:"number",minimum:0,default:0},"line-color":{type:"color",default:[0,0,0,1]},"line-dasharray":{type:"array",value:"number",default:[]},"line-gap-width":{type:"number",minimum:0,default:0},"line-offset":{type:"number",default:0},"line-opacity":{type:"number",minimum:0,maximum:1,default:1},"line-pattern":{type:"string"},"line-translate":{type:"array",value:"number",length:2,default:[0,0]},"line-translate-anchor":{type:"enum",values:["map","viewport"],default:kS.MAP},"line-width":{type:"number",minimum:0,default:1}},x0.symbolPaintDefinition={"icon-color":{type:"color",default:[0,0,0,1]},"icon-halo-blur":{type:"number",minimum:0,default:0},"icon-halo-color":{type:"color",default:[0,0,0,0]},"icon-halo-width":{type:"number",minimum:0,default:0},"icon-opacity":{type:"number",minimum:0,maximum:1,default:1},"icon-translate":{type:"array",value:"number",length:2,default:[0,0]},"icon-translate-anchor":{type:"enum",values:["map","viewport"],default:kS.MAP},"text-color":{type:"color",default:[0,0,0,1]},"text-halo-blur":{type:"number",minimum:0,default:0},"text-halo-color":{type:"color",default:[0,0,0,0]},"text-halo-width":{type:"number",minimum:0,default:0},"text-opacity":{type:"number",minimum:0,maximum:1,default:1},"text-translate":{type:"array",value:"number",length:2,default:[0,0]},"text-translate-anchor":{type:"enum",values:["map","viewport"],default:kS.MAP}},x0.rasterPaintDefinition={"raster-opacity":{type:"number",minimum:0,maximum:1,default:1},"raster-hue-rotate":{type:"number",default:0},"raster-brightness-min":{type:"number",minimum:0,maximum:1,default:0},"raster-brightness-max":{type:"number",minimum:0,maximum:1,default:1},"raster-saturation":{type:"number",minimum:-1,maximum:1,default:0},"raster-contrast":{type:"number",minimum:-1,maximum:1,default:0},"raster-fade-duration":{type:"number",minimum:0,default:300}},x0.circlePaintDefinition={"circle-blur":{type:"number",minimum:0,default:0},"circle-color":{type:"color",default:[0,0,0,1]},"circle-opacity":{type:"number",minimum:0,maximum:1,default:1},"circle-radius":{type:"number",minimum:0,default:5},"circle-stroke-color":{type:"color",default:[0,0,0,1]},"circle-stroke-opacity":{type:"number",minimum:0,maximum:1,default:1},"circle-stroke-width":{type:"number",minimum:0,default:0},"circle-translate":{type:"array",value:"number",length:2,default:[0,0]},"circle-translate-anchor":{type:"enum",values:["map","viewport"],default:kS.MAP}};let qLt=class extends rFe{_createTransforms(){return{dvs:Tc(),tileMat3:Tc()}}};const WLt=.125;let YLt=class{constructor(){this._renderParams={context:null,drawPhase:1,state:new HLt({viewpoint:new ih({targetGeometry:new mt(0,0),scale:1,rotation:0}),size:[256,256]}),stationary:!0,pixelRatio:1,displayLevel:-1,requiredLevel:-1,globalOpacity:1,renderPass:"background",styleLayer:null,styleLayerUID:-1,painter:null,glyphMosaic:null,spriteMosaic:null,profiler:null,renderingOptions:null,requestRender:null,allowDelayedRender:!1,deltaTime:-1,timeline:null,time:0,hasClipping:!1,blendMode:null,dataUploadCounter:0,effects:null,inFadeTransition:!1,requireFBO:!1,highlightGradient:null,stencilSymbols:!0,is3D:!0,backgroundColor:null},this._backgroundTile=new qLt(new iE(0,0,0,0),0,0,0,512,512,4096,4096)}dispose(){this._renderParams=null}renderBackground(e,i,r,n,s,o,l,c,f,_){const x=this._backgroundTile;this._updateRenderParams(e,i,x,r,s,o,l,c,f,_),this._renderParams.stencilSymbols=!1,r.drawBackground(this._renderParams,x,n)}renderContent(e,i,r,n,s,o,l,c,f,_,x,T){this._stencilSymbols(e,i,r,n,s,o,l,Math.round(1/c),f,_,x,T);let A=1;r.stencilRef=A++,e.setStencilFunction(Zr.EQUAL,r.stencilRef,255),this._render(e,i,r,s,o,l,c,f,_,x,T),n.forAll(M=>{M.sourceLayerInfo.data.stencilRef=A++,this._renderSymbols(e,M.sourceLod,M.sourceLayerInfo.data,s,o,l,Math.round(1/c),M.offset,_,x,T)})}_stencilSymbols(e,i,r,n,s,o,l,c,f,_,x,T){let A=1;r.stencilRef=A++,e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1),e.setStencilTestEnabled(!0),e.setBlendingEnabled(!1),e.setColorMask(!1,!1,!1,!1),e.setStencilOp(bs.KEEP,bs.KEEP,bs.REPLACE),e.setStencilWriteMask(255),e.setStencilFunction(Zr.ALWAYS,r.stencilRef,255),this._stencilTileSymbols(e,i,r,s,o,l,c,f,_,x,T);for(const M of n.toArray()){const{sourceLod:I,offset:L,sourceLayerInfo:F}=M;F.data.stencilRef=A++,e.setStencilFunction(Zr.ALWAYS,F.data.stencilRef,255),this._stencilTileSymbols(e,I,F.data,s,o,l,c,L,_,x,T)}e.setStencilWriteMask(0),e.setBlendingEnabled(!0),e.setDepthTestEnabled(!0),e.setColorMask(!0,!0,!0,!0)}_renderSymbols(e,i,r,n,s,o,l,c,f,_,x){e.setStencilFunction(Zr.EQUAL,r.stencilRef,255),this._render(e,i,r,n,s,o,l,c,f,_,x,Bie.SYMBOL)}_render(e,i,r,n,s,o,l,c,f,_,x,T){this._updateRenderParams(e,i,r,n,o,l,c,f,_,x),this._renderParams.stencilSymbols=!1,n.drawTile(this._renderParams,r,s,T)}_stencilTileSymbols(e,i,r,n,s,o,l,c,f,_,x){this._updateRenderParams(e,i,r,n,o,l,c,f,_,x),this._renderParams.stencilSymbols=!0,r.triangleCount=0,n.drawSymbols(this._renderParams,r,s)}_updateRenderParams(e,i,r,n,s,o,l,c,f,_){"type"in r&&r.type==="vector-tile"&&!r.stage&&r.attachWithContext(e);const x=i[0]-s.getLevelShift(i[0]),T=this._renderParams;T.context=e,T.painter=n,T.glyphMosaic=n.glyphMosaic,T.spriteMosaic=n.spriteMosaic,T.pixelRatio=f*_,T.displayLevel=x,T.requiredLevel=x;const A=s.getScale(i[0]),[M,I]=s.getOffset(i,o*A),L=WLt*o*A/c,F=r.transforms.dvs;F[0]=L,F[4]=-L,F[6]=-1-M-l[0]*o*2,F[7]=1+I+(1-l[1])*o*2-2,T.state.size[0]=c/_,T.state.size[1]=c/_,T.state.pixelRatio=_}},QFe=class eke extends Hr{initializeProgram(e){return new Ir(e.rctx,eke.shader.get().build(this.configuration),Er)}initializePipeline(){return Ti({blending:hd(st.ONE,st.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}};QFe.shader=new Rr(r$t,()=>we(()=>Promise.resolve().then(()=>kWt),void 0));let bI=class extends k${constructor(){super(...arguments),this.colorizerType=ST.Stretch,this.stretchType=rE.Noop,this.applyColormap=!0,this.requireBilinearWithNN=!1}};y([fe({count:ST.COUNT})],bI.prototype,"colorizerType",void 0),y([fe({count:rE.COUNT})],bI.prototype,"stretchType",void 0),y([fe()],bI.prototype,"applyColormap",void 0),y([fe()],bI.prototype,"requireBilinearWithNN",void 0);let Hbe=class{constructor(e){this._rctx=e,this._fbos=new Map}get(e){return this._getPool(e)}dispose(){this._fbos.forEach(e=>e.dispose()),this._fbos.clear()}_getPool(e){const i=this._fbos.get(e);if(i)return i;const r=new Hm(this._rctx,new tn(e),new $F(Wa.DEPTH24_STENCIL8,e));return this._fbos.set(e,r),r}};const XLt=Ce.getLogger("esri.views.3d.terrain");let ZLt=class{constructor(e,i){this._rctx=e,this._techniqueRepository=i,this._fbos=[],this._vectorTileHelper=new YLt,this._bindParameters=new Pj(null,null),this._blendLayersTechniqueConfig=new GFe,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vaoQuad=u1(this._rctx,H9)}dispose(){this._fbos.forEach(Kt),this._fbos=null,this._vtFBO=Kt(this._vtFBO),this._vaoQuad=Kt(this._vaoQuad),this._vectorTileHelper=Kt(this._vectorTileHelper),this._backgroundTechnique=ir(this._backgroundTechnique),this._applyOpacityTechnique=ir(this._applyOpacityTechnique),this._blendLayersTechnique=ir(this._blendLayersTechnique)}_getBlendLayersTechnique(e,i,r,n=am.Off,s=K2.BelowLayer){return this._blendLayersTechniqueConfig.output=i,this._blendLayersTechniqueConfig.blendMode=e,this._blendLayersTechniqueConfig.baseOpacityMode=r,this._blendLayersTechniqueConfig.premultipliedSource=n,this._blendLayersTechniqueConfig.background=s,this._blendLayersTechnique=this._techniqueRepository.releaseAndAcquire(BFe,this._blendLayersTechniqueConfig,this._blendLayersTechnique),this._blendLayersTechnique}drawBackground(e,i){const r=this._getBlendLayersTechnique(gt.Normal,i?Jo.ColorComposite:Jo.GridComposite,up.NotRequired,am.Off,K2.Only),n=this._rctx.bindTechnique(r,e,this._bindParameters);this._render(n)}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(sr.TRIANGLE_STRIP,0,Kv(this._vaoQuad,"geometry"))}drawGroup(e,i,r,n,s,o=am.On){i===Jo.Composite&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const l=this._getBlendLayersTechnique(n,i,s,o),c=this._rctx.bindTechnique(l,e,this._bindParameters);this._render(c)}drawRasterData(e,i,r,n,s,o=am.Off){if(e.texture==null)return;e.fboTexture=i===Jo.GroupBackgroundComposite||n===gt.Normal&&s===up.NotRequired&&o===am.Off?null:this.switch(r).colorTexture;const l=this._getBlendLayersTechnique(n,i,s,o),c=this._rctx.bindTechnique(l,e,this._bindParameters);this._render(c)}drawImageryTileData(e,i,r,n,s,o){const l=o.sourceLayerInfo.data;if(!l.source||(o.tile.surface.layerViewByIndex(o.layerIndex,Yi.MAP).ensureSymbolizerParameters(l),!l.bind(this._rctx)))return;e.fboTexture=n===gt.Normal&&s===up.NotRequired?null:this.switch(r).colorTexture;const c=this._getRasterColorizerTechnique(l,i,n,s);l.opacity=e.opacity;const f=l.getUniforms();f.scale=o.scale,f.offset=o.offset,f.backgroundColor=e.backgroundColor,f.fboTexture=e.fboTexture,f.baseOpacity=e.baseOpacity;const _=this._rctx.bindTechnique(c,f,null);this._render(_)}_getRasterColorizerTechnique(e,i,r,n){const s=e.symbolizerParameters,o=["stretch","lut","hillshade"].indexOf(s.type);return this._rasterColorizerConfig==null&&(this._rasterColorizerConfig=new bI,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.output=i,this._rasterColorizerConfig.blendMode=r,this._rasterColorizerConfig.baseOpacityMode=n,this._rasterColorizerConfig.colorizerType=o,this._rasterColorizerConfig.applyColormap=!!s.colormap,this._rasterColorizerConfig.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?rE.Noop:rE.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(QFe,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}drawVectorData(e,i,r,n,s,o,l,c,f){const _=this._rctx,x=o.sourceLayerInfo.data,T=o.tile.surface.layerViewByIndex(o.layerIndex,Yi.MAP),A=s===up.Required||e.opacity<1||n!==gt.Normal||i!==Jo.Composite,M=A?am.On:am.Off,I=this._getBlendLayersTechnique(n,i,s,M);_.setPipelineState(I.getPipeline());let L=null,F=null;A?(F=this.currentFBO(r),this._vtFBO==null&&(this._vtFBO=new Hbe(this._rctx)),L=this._vtFBO.get(r),_.bindFramebuffer(L),this._clearCurrentFBO()):f&&_.clearSafe(In.DEPTH_BUFFER_BIT);try{this._vectorTileHelper.renderBackground(_,o.sourceLod,T.painter,T.layer.styleRepository,T.schemaHelper,Math.round(1/o.scale),o.offset,c,l,T.contentZoom),x&&this._vectorTileHelper.renderContent(_,o.sourceLod,x,o.vtlNeighborInfos,T.painter,T.layer.styleRepository,T.schemaHelper,Math.round(1/o.scale),o.offset,c,l,T.contentZoom)}catch(z){XLt.warnOnce("A render call containing vector tiles did not resolve correctly.",z)}return L==null||(_.bindFramebuffer(F),e.texture=L.colorTexture,e.offset=Wy,e.scale=1,this.drawRasterData(e,i,r,n,s,M),f)}copyFBOToTexture(e){const i=this._rctx,r=i.bindTexture(e.texture,Ai.TEXTURE_UNIT_FOR_UPDATES),n=e.descriptor;i.gl.copyTexImage2D(Hs.TEXTURE_2D,0,n.pixelFormat,0,0,n.width,n.height,0),e.generateMipmap(),i.bindTexture(r,Ai.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clearSafe(In.COLOR_BUFFER_BIT|In.DEPTH_BUFFER_BIT|In.STENCIL_BUFFER_BIT)}_initFBO(e,i,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,i,i),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,i=0,r=!0){if(this._current=i,i>=this._fbos.length)for(let n=this._fbos.length;n<=i;n++)this._fbos.push(new Hbe(this._rctx));this._initFBO(this._fbos[i].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const i=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),i}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){const i=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(i),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}},JLt=class{constructor(){this.sourceLod=[0,0,0],this.offset=[0,0],this.scale=1,this.layerIndex=0,this.isVTLBackground=!1,this.vtlNeighborInfos=new Pi({allocator:e=>e||new KLt})}},KLt=class{constructor(){this.sourceLayerInfo=null,this.sourceLod=[0,0,0],this.offset=[-1,0]}},QLt=class{constructor(e,i,r,n,s,o){this.start=e,this.end=i,this.blendMode=r,this.opacity=n,this.output=s,this.baseOpacity=o}},e9t=class{constructor(e,i,r,n){this._rctx=e,this.tileSize=i,this._techniques=r,this._cache=n,this._passParameters=new X$t,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._composition=new ZLt(this._rctx,this._techniques),this._ensureBackgroundTexture(this.tileSize)}dispose(){this._composition=Kt(this._composition),this._backgroundTexture=ir(this._backgroundTexture)}get backgroundIsGrid(){return this._backgroundColor==null}get backgroundColor(){return this._backgroundColor}updateTileTexture(e,i){if(!e.renderData)return;const r=e.surface,n=r.baseOpacity;let s=0,o=0,l=this.tileSize,c=!1,f=!1;const _=r.view.state.contentPixelRatio;let x=!1;pV.clear(),NC.length=0;const T=e.layerInfo[Yi.MAP];let A=0,M=null;for(;A0)&&(n=r_.Delayed);const s=e.renderData;s.textureReference==null&&(n=r_.Immediate),s.setTextureReference(new wY(r,ua.FADING,qbe,e.surface.baseOpacity,0,1),n)}_useLayerTexture(e,i){const r=e.surface.layerViewByIndex(i,Yi.MAP),n=Y7(r.layer),s=n?e.surface.baseOpacity:1,o=n?1:e.surface.baseOpacity,l=r.fullOpacity,c=EY(e,i,!1);return!!this._dataToTexture(c)&&(e.renderData.setTextureReference(new wY(c.sourceLayerInfo.data,ua.FADING,c,s,o,l)),!0)}_composeMapLayers(e,i,r,n,s,o,l,c,f){this._composition.ensureBuffer(s);const _=e.surface.baseOpacity;let x=!1,T=ki.LINEAR_MIPMAP_LINEAR,A=!1,M=0;for(let z=r;z>=0;z--){const k=e.surface.layerViewByIndex(z,Yi.MAP),U=L5(k),j=EY(e,z,U),H=k.layer.opacity;if(!j||H===0&&!f)continue;const Y=!Y7(k.layer)&&!x;Y&&(x=!0);let Q=!1;c.forEach(be=>{be.start===z&&(be.output=n?Jo.Composite:l&&Y?this.backgroundIsGrid?Jo.GridComposite:Jo.ColorComposite:Jo.Composite,be.baseOpacity=Y?_:1,NC.push(be),this._composition.openGroup(s),Q=!0)}),this._passParameters.baseOpacity=Y&&!Q&&_<1?_:1;const ne=this._passParameters.baseOpacity<1?up.Required:up.NotRequired,re=M===0,he=Q?Jo.GroupBackgroundComposite:l&&re?this.backgroundIsGrid?Jo.GridComposite:Jo.ColorComposite:Jo.Composite,ce=Nie[ZL(k)?k.layer.blendMode:"normal"];for(this._passParameters.opacity=H,V4t(j)?A=this._composition.drawVectorData(this._passParameters,he,s,ce,ne,j,o,this.tileSize,A):U4t(j)?(this._composition.drawImageryTileData(this._passParameters,he,s,ce,ne,j),this._hasNearestInterpolation(j)&&(T=ki.NEAREST)):this._dataToTexture(j)&&(this._passParameters.texture=j.sourceLayerInfo.data.texture,this._passParameters.offset=j.offset,this._passParameters.scale=j.scale,this._composition.drawRasterData(this._passParameters,he,s,ce,ne));NC.length>0&&NC[NC.length-1].end===z;){const be=NC.pop();this._passParameters.baseOpacity=be.baseOpacity;const ye=this._passParameters.baseOpacity<1?up.Required:up.NotRequired;this._passParameters.opacity=be.opacity,this._passParameters.offset=Wy,this._passParameters.scale=1,this._composition.drawGroup(this._passParameters,be.output,s,Nie[be.blendMode],ye)}M++}const I=e.renderData,L=f||x&&_<1,F=I.ensureTexture(s,L,()=>this._buildTexture(s,L,T));this._composition.copyFBOToTexture(F),this._composition.unbind(),I.setTextureReference(new wY(F,i,qbe,x?1:_,0,1))}_hasNearestInterpolation(e){const i=e.sourceLayerInfo.data;return!!i.source&&i.interpolation==="nearest"}_dataToTexture(e){if(j4t(e)){const i=e.sourceLayerInfo;i.data=this._buildTexture(i.data,!0),e.tile.setMemoryDirty()}return B4t(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,i,r=ki.LINEAR_MIPMAP_LINEAR){if(e==null)return null;const n=new tn;n.wrapMode=Bi.CLAMP_TO_EDGE,n.samplingMode=r,n.maxAnisotropy=this._maxAnisotropy,n.preMultiplyAlpha=!0,n.flipped=!0,n.hasMipmap=!0,i||(n.pixelFormat=ci.RGB);const s=this._rctx;let o;if(typeof e=="number"){n.width=n.height=e;const c=`${e} ${n.pixelFormat}`;o=this._cache.pop(c),o?o.retain():o=new _I(new Ai(s,n),this._cache)}else if(w4t(e)){n.isOpaque=e.isOpaque,n.isOpaque&&(n.pixelFormat=ci.RGB);const c=`${e} ${n.pixelFormat}`;o=this._cache.pop(c),o?(o.retain(),o.texture.setData(e.image)):o=new _I(new Ai(s,n,e.image),this._cache),e.release()}else try{n.width=e.width,n.height=e.height,o=new _I(new Ai(s,n,e))}catch{o=new _I(u$e(s)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const l=s.bindTexture(o.texture,Ai.TEXTURE_UNIT_FOR_UPDATES);return o.generateMipmap(),s.bindTexture(l,Ai.TEXTURE_UNIT_FOR_UPDATES),o}get test(){return{backgroundTexture:this._backgroundTexture}}};function EY(t,e,i){rc.layerIndex=e,rc.vtlNeighborInfos.clear();const r=t.layerInfo[Yi.MAP][e];if(or(rc.offset,0,0),rc.tile=t,rc.scale=1,rc.sourceLod=t.lij,rc.sourceLayerInfo=r,rc.isVTLBackground=i,r.data)return i&&t.forEachLoadedNeighbor((s,o)=>{if(s.level!==t.level)return;const l=s.layerInfo[Yi.MAP][e];if(!Z7e(l)||r.data===l.data)return;const c=rc.vtlNeighborInfos.pushNew();c.offset=nv[o],c.sourceLod=s.lij,c.sourceLayerInfo=l}),rc;const n=r.upsampleInfo;if(n){const s=n.tile.layerInfo[Yi.MAP][e];return rc.tile=n.tile,Qo(rc.offset,n.offset),rc.scale=n.scale,rc.sourceLod=n.tile.lij,rc.sourceLayerInfo=s,rc}return i?rc:null}function Wie(t){return t.uid}function tke(t){let e=t.blendMode!=="normal";return QO(t.parent)&&(e=tke(t.parent)||e),e}function ike(t,e){QO(t.parent)&&ike(t.parent,e);const i=Wie(t);if(i!=null&&i!==""){const r=pV.get(i);r?r.start=e:pV.set(i,new QLt(e,e,t.blendMode,t.opacity,Jo.Composite,1))}}const pV=new Map,NC=new Array,rc=new JLt,qbe={offset:[0,0],scale:1},nv=new Array;nv[ti.NORTH]=[0,-1],nv[ti.NORTH_EAST]=[-1,-1],nv[ti.EAST]=[-1,0],nv[ti.SOUTH_EAST]=[-1,1],nv[ti.SOUTH]=[0,1],nv[ti.SOUTH_WEST]=[1,1],nv[ti.WEST]=[1,0],nv[ti.NORTH_WEST]=[1,-1];const rke=200,CY=40,t9t=.8,i9t=10,wI=1e-6;function r9t(t,e,i){const r=e,n=i;let s=0,o=1/0;for(let l=0;l<3;++l){{const c=t[l];if(r[l]o)return!1}{const c=t[l+3];if(r[l]>c){if(n[l]>=-wI)return!1;const f=(c-r[l])/n[l];s=Math.max(s,f)}else if(n[l]>=wI){const f=(c-r[l])/n[l];o=Math.min(o,f)}if(s>o)return!1}}return!0}let Wbe=class{constructor(e,i,r,n,s){this.aabb=e,this.axis=i,this.d=r,this.midStartIndex=n,this.rightStartIndex=s}},Nce=class Yie{constructor(e,i,r,n){this.globalTriangleVertexIndices=e,this.firstTriangleIndex=i,this.positions=n,this._rayDirection=W(),this.bspNodeTree=new Array;const s=r-i,o=s<=nke?new Uint16Array(s):new Uint32Array(s);this.indices=o;for(let l=0;l{const A=o9t(o,l,_,x),M=x-_;if(M<=CY){const U=new Wbe(A,void 0,0,_,x);return this.bspNodeTree.push(U),U}const{axis:I,midValue:L}=a9t(A),F=s9t(o,l,_,x,I,L),z=(U,j)=>{if(T>c)return;const H=j-U;return H=t9t*M?void 0:f(U,j,T+1)},k=new Wbe(A,I,L,F.next,F.mid);return this.bspNodeTree.push(k),k.leftNode=z(_,F.next),k.rightNode=z(F.mid,x),k};f(0,s,0),this.triangleVertexIndices=c9t(o,e,i,r)}}intersectRayTriangleRange(e,i){{if(e>=i)return;const r=this.triangleVertexIndices,n=this.positions.data,s=this.positions.stride,o=this._rayOrigin,l=o[0],c=o[1],f=o[2],_=this._rayDirection,x=_[0],T=_[1],A=_[2];for(let M=e,I=3*e;M0){if(ve<0||ve>Ee)continue}else if(ve>0||ve0){if(Ge<0||ve+Ge>Ee)continue}else if(Ge>0||ve+Ge=0){const Ft=this.indices[M]+this.firstTriangleIndex,Qt=fle(Y,Q,ne,re,he,ce,n9t);this._callback(ut,Qt,Ft,!1)}}}Yie.numFacesTested+=i-e}intersectRay(e,i){Yie.numFacesTested=0;const r=nt(e.r0[0],e.r0[1],e.r0[2]),n=nt(e.r1[0],e.r1[1],e.r1[2]),s=n[0]-r[0],o=n[1]-r[1],l=n[2]-r[2];if(s*s+o*o+l*ll||s[o]>0){const c=e.rightStartIndex,f=r;if(c=s?--l:(t[l-1]=t[c],t[c]=f,++c)}return{next:o,mid:c}}function o9t(t,e,i,r){if(r<=i)return P2(NaN,NaN,NaN,NaN,NaN,NaN);{const n=6*t[i];for(let s=0;s<3;++s)FC[s]=e[n+0+s],kC[s]=e[n+3+s]}for(let n=i+1;ni?e>r?0:i>r?1:2:i>r?1:r>e?2:0;return{axis:n,midValue:(t[n]+t[n+3])/2}}function l9t(t,e,i,r,n){const s=i-e,o=new Float32Array(6*s);for(let l=0;lthis._produces()],[ke.TRANSPARENT_TERRAIN,()=>this._produces()],[ke.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new G9((o,l)=>s.newCache(o,l),"TileTexture"),this.tileGeometryCache=new W$t(s)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?PLe:Vj}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===ru.TransparentWithDraped||e===ru.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Gw}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?ZU:Wn.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,this._tileRenderer!=null&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,hi.TEXTURE_FADING)}updateTileTexture(e,i){this._tileRenderer!=null&&(this._tileRenderer.updateTileTexture(e,i===hi.TEXTURE_FADING?ua.FADING:ua.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(i))}updateTileGeometryState(e){for(const r of e.layerInfo[Yi.ELEVATION])r.pendingUpdates&=~hi.GEOMETRY;e.resetPendingUpdate(hi.GEOMETRY);const i=e.renderData.updateGeometryState();return i&&this.setDirty(),i}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const i=e.renderData;i&&(i.releaseGeometry(),this._renderDataPool.release(i),i.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const i=u9t-AY,r=Math.max(0,Math.floor((e.level-i)/AY)*AY);if(this._isGlobal&&r===0)return Ka;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=no.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=no.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=no.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new e9t(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=u$e(this._rctx)}uninitializeRenderContext(){this._emptyTex=Kt(this._emptyTex),this._tileRenderer=Kt(this._tileRenderer)}intersect(e,i,r,n){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==ru.Opaque)return;const s=h9t,o=d9t;je(s,n,r),Ie(o,1/s[0],1/s[1],1/s[2]);const l=e.results.min,c=e.results.max,f=e.results.ground,_=e.options.store===tl.MIN,x=!!e.results.ground.target,T=o0t(e.verticalOffset),A=e.tolerance;let M,I=_&&l.dist!=null?l.dist:1/0;const L=z=>{const k=z.renderData;if(!(k!=null&&k.vao))return;const U=k.geometry;NB(MY,U.boundingBox);const j=k.localOrigin;T!=null&&(T.localOrigin=j,T.applyToAabb(MY));const H=MY;if(zC[0]=r[0]-j[0],zC[1]=r[1]-j[1],zC[2]=r[2]-j[2],!gle(H,zC,o,A,I))return;const Y=(pe,Ee,te)=>{pe.set(this.type,z,Ee,te,gs),I=_&&l.dist!=null?l.dist:1/0},Q=(pe,Ee)=>{if(Ee!=null&&pe>=0&&(e.options.backfacesTerrain||Ve(Ee,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||i==null||i(r,n,pe))){if((f.dist==null||pec.dist)&&Y(c,pe,Ee)}},ne=p9t;je(ne,n,j);const re=U.indices,he=U.vertexAttributes,ce=he.getField(J.POSITION,Ea),be=new yP(ce.typedBuffer,3,he.stride/4),ye=U.indexCount/3;if(!T&&ye>rke){const pe=z.renderData;pe.intersectionData==null&&(pe.intersectionData=new Nce(re,0,ye,be)),pe.intersectionData.intersectRay({r0:zC,r1:ne},Q)}else Q9(zC,ne,0,ye,re,be,null,T,Q)},F=this._rootTiles;F!=null&&(()=>{const z=this._tileIterator;z.reset(F);const k=e.options.invisibleTerrain;for(let U=z.next();U;U=z.next())!(U.visible||k&&U.intersectsClippingArea)||T==null&&!U.intersectsRay(r,s,A,I)||x&&this._useStencilForTile(U)?z.skipSubtree():L(U)})()}processScaleRangeQueries(e,i){var r;if(!i.done)for(this._updatePatchGroups();e.updating&&!i.done;){e.prepare();for(const n of this._visiblePatchesByOrigin.values())for(const s of n)((r=s.renderData)==null?void 0:r.textureReference)!=null&&e.queriesForTile(s);e.process(),i.madeProgress()}}prepareTechnique(e){const i=Le("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;if(i!==this._castShadows&&(this._castShadows=i,this._patchesByOriginDirty=!0),e.bindParameters.slot===ke.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&ZU))return null}else{const r=this.transparency===ru.Opaque?ke.OPAQUE_TERRAIN:ke.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==r)return null}if(this.transparency===ru.Empty)return null;switch(e.output){case ue.Color:return this._techniqueConfiguration.hasScreenSpaceReflections=e.bindParameters.ssr.lastFrameColor!=null,this._techniqueConfiguration.hasCloudsReflections=e.bindParameters.cloudsFade.data!=null,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssao!=null,this._techniqueConfiguration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(ue.Color,e.bindParameters.slot===ke.OCCLUDED_TERRAIN);case ue.Shadow:case ue.ShadowExcludeHighlight:return this._castShadows?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(ue.Shadow,!1)):null;case ue.Depth:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(ue.Depth,!1);case ue.Normal:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(ue.Normal,!1);case ue.ObjectAndLayerIdColor:return this._updateTechnique(ue.ObjectAndLayerIdColor,!1);case ue.Highlight:return this._overlayRenderer.hasHighlights?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(ue.Highlight,!1)):null}return null}renderNode(e,i){switch(this._updatePatchGroups(),i.useStencil=!1,e.output){case ue.Color:{const r=e.bindParameters.slot===ke.OCCLUDED_TERRAIN?ns.Occluded:ns.Color;this._renderMaterialPass(e,i,r);break}case ue.Depth:case ue.Normal:this._renderAuxiliaryPass(e,i,ns.Color,this._visiblePatchesByOrigin);break;case ue.Highlight:this._renderAuxiliaryPass(e,i,ns.Highlight,this._visiblePatchesByOrigin);break;case ue.Shadow:case ue.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,i,null,this._allPatchesByOrigin);break;case ue.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,i,ns.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(this._tileRenderer==null)return;const i=this._tileRenderer;let r;if(e!=null){const n=qe.toUnitRGBA(e);r=nt(n[0]||0,n[1]||0,n[2]||0)}i.setBackground(r),this._allTiles.forAll(n=>i.updateTileTexture(n,ua.FADING)),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?_y.GridComposite:i.backgroundColor!=null?_y.ColorComposite:_y.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==D5.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),i=this._stencilEnabledLayerExtents;for(const r of e)dFe(this.renderOrder,r,i);e.sort((r,n)=>pFe(r[0],n[0],this.renderOrder)),this._visiblePatchesByOrigin=new Map(e.map(r=>[r[0].renderData.localOrigin,r])),this._patchSortingDirty=!1}}_rebuildPatchGroups(){var i;const e=this._rootTiles;if(e!=null){(i=e[0])==null||i.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const r of e)this._rebuildPatchGroupsForRootTile(r)}}_rebuildPatchGroupsForRootTile(e){const i=this._tileIterator;for(i.resetOne(e);!i.done;){const r=i.next(),n=r.renderData;if(!n){this._numTilesCulled++;continue}const s=n.localOrigin;if(this._castShadows){let l=this._allPatchesByOrigin.get(s);l||(l=new Array,this._allPatchesByOrigin.set(s,l)),l.push(r)}if(!r.visible){this._numTilesCulled++,i.skipSubtree();continue}let o=this._visiblePatchesByOrigin.get(s);o||(o=new Array,this._visiblePatchesByOrigin.set(s,o)),o.push(r),i.skipSubtree()}}_useStencilForTile(e){for(const i of this._stencilEnabledLayerExtents)if(e.intersectsExtent(i))return!0;return!1}_renderAuxiliaryPass(e,i,r,n){const s=e.rctx;this._passParameters.overlayContent=r,s.bindTechnique(i,this._passParameters,e.bindParameters);const o=this._stencilEnabledLayerExtents.length>0;n.forEach(l=>{const c=l[0].renderData.localOrigin;i.program.bindDraw(new fie(c),e.bindParameters,this._passParameters);for(let f=0;f0,c=r===ns.Occluded;c&&(o.bindTexture("tex",this._emptyTex),o.setUniform3fv("textureOpacities",Ka),o.setUniform4fv("texOffsetAndScale",gp));const f=((T=this._tileRenderer)==null?void 0:T.backgroundColor)!=null?this._tileRenderer.backgroundColor:Ka;this._techniqueConfiguration.tileBlendInput===_y.ColorComposite&&o.setUniform3fv("backgroundColor",f);const _=this.wireframe?sr.LINES:sr.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&o.bindTexture("texNext",this._emptyTex);const x=this._visiblePatchesByOrigin;for(const A of x.values()){const M=A[0].renderData.localOrigin;i.program.bindDraw(new fie(M),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const I of A){const L=I.renderData,F=L.textureReference;if(F!=null){if(!c){o.setUniform4fv("texOffsetAndScale",F.offsetAndScale),o.bindTexture("tex",F.texture.texture);const z=L.textureFadeFactor,k=z<1?L.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&k!=null&&z<1?(o.setUniform1f("fadeFactor",z),o.setUniform4fv("nextTexOffsetAndScale",k.offsetAndScale),o.setUniform3fv("nextTexOpacities",k.opacities),o.bindTexture("texNext",k.texture.texture)):o.setUniform1f("fadeFactor",1),L.textureIsFading&&this.setNeedsRender(),o.setUniform3fv("textureOpacities",F.opacities)}this._renderPatch(e,i,I,_,l,r),I.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,i,r,n,s,o){const l=r.renderData,c=l.vao,f=c==null?void 0:c.indexBuffer;if(f==null)return void(pa&&console.error("Rendered tile with no indices: ",r.lij," : ",l));const _=i.program;o==null||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(_,l.overlay),s&&(i.useStencil=this._useStencilForTile(r),e.rctx.setPipelineState(i.getPipeline()));const x=l.geometry.indexCount;e.rctx.bindVAO(c),_.assertCompatibleVertexAttributeLocations(c),e.rctx.drawElements(n,x,f.indexType,0)}_bindOverlayPatchData(e,i){e.setUniform4fv("overlayTexOffset",i.offsets),e.setUniform4fv("overlayTexScale",i.scales)}_updateTechnique(e,i){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=i,this._shaderTechnique=this._techniques.releaseAndAcquire(SFe,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};y([w({readOnly:!0})],j0.prototype,"_isGlobal",null),y([w({value:!1})],j0.prototype,"renderingDisabled",null),y([w({value:!0})],j0.prototype,"visible",null),y([w()],j0.prototype,"renderPatchBorders",null),y([w()],j0.prototype,"visualizeNormals",null),y([w()],j0.prototype,"cullBackFaces",null),y([w({value:D5.FRONT_TO_BACK})],j0.prototype,"renderOrder",null),y([w()],j0.prototype,"wireframe",null),j0=y([Z("esri.views.3d.terrain.TerrainRenderer")],j0);const h9t=W(),d9t=W(),zC=W(),p9t=W();let f9t=class{constructor(){this.numNodes=0,this.numLeaves=0,this.numVisible=0,this.numRendered=0,this.numSplit=0,this.numMerged=0,this.numRenderedPerLevel=new Array,this.numLoadedPerLevel=new Array}},Fg=class extends ze{constructor(e){super(e)}initialize(){this.addHandles([this.layers.on("change",()=>this._update()),_e(()=>this.extentHelper.layerViewsExtent,()=>this._setAdHocTilingScheme())]),this._update(),this.tilingSchemeLocked||this._setAdHocTilingScheme()}destroy(){this._waitTask=null,this.layers.destroy()}_update(){if(this._waitTask=null,this.tilingSchemeLocked)return;let e;if(this.layers.some(i=>!(!oO(i)||i.isRejected())&&!(i.isFulfilled()&&!m9t(i,this.viewSpatialReference,this.viewingMode))&&(e=i,!((i==null?void 0:i.type)==="vector-tile"||aV(i)))),e)if(e.isResolved()){const i=SG(e,this.viewSpatialReference,this.viewingMode);if(i!=null){const r=new Bu(i.tileInfo);this._lockTilingScheme(r)}}else this._updateWhen(e)}_updateWhen(e){const i=e.when().catch(()=>{}).then(()=>{i!==this._waitTask||this.destroyed||this._update()});this._waitTask=i}_lockTilingScheme(e){if(this.viewingMode===_t.Global){const i=e.levels.length-1;e.spatialReference.isWebMercator?e=Bu.makeWebMercatorAuxiliarySphere(i):D2(e.spatialReference)&&(e=Bu.makeGCSWithTileSize(e.spatialReference,e.pixelSize,i))}this.tilingSchemeLocked=!0,this.tilingScheme=e,this.extentHelper.tilingScheme=this.tilingScheme,this._updateTiledLayerExtent(),this.removeAllHandles(),this.addHandles(_e(()=>this.extentHelper.tiledLayersExtent,()=>this._updateTiledLayerExtent()))}_updateTiledLayerExtent(){this._set("extent",this.extentHelper.tiledLayersExtent)}_setAdHocTilingScheme(){if(this.viewingMode===_t.Global){const e=this.extentHelper.viewSpatialReference,i=D2(e)||r1(e)||n1(e);e.isWebMercator?this.tilingScheme=Bu.WebMercatorAuxiliarySphere:i&&(this.tilingScheme=Bu.makeGCSWithTileSize(e,256)),this._set("extent",this.extentHelper.layerViewsExtent)}else{const e=this.extentHelper.layerViewsExtent;e==null||uT(e,this.extent)||(this.tilingScheme=Bu.fromExtent(e,this.extentHelper.viewSpatialReference),this._set("extent",e))}}get test(){return{lockTilingScheme:e=>this._lockTilingScheme(e),done:!this._waitTask}}};function m9t(t,e,i){return SG(t,e,i)!=null}y([w()],Fg.prototype,"tilingScheme",void 0),y([w({readOnly:!0})],Fg.prototype,"extent",void 0),y([w({value:!1})],Fg.prototype,"tilingSchemeLocked",void 0),y([w({constructOnly:!0})],Fg.prototype,"viewSpatialReference",void 0),y([w({constructOnly:!0})],Fg.prototype,"layers",void 0),y([w({constructOnly:!0})],Fg.prototype,"extentHelper",void 0),y([w({constructOnly:!0})],Fg.prototype,"viewingMode",void 0),Fg=y([Z("esri.views.3d.terrain.TilingSchemeLogic")],Fg);let g9t=class{constructor(){this.offset=yt(),this.scale=0,this.tile=null}init(e,i,r,n){this.tile=e,this.offset[0]=i,this.offset[1]=r,this.scale=n}dispose(){this.tile=null,this.offset[0]=0,this.offset[1]=0,this.scale=0}};var gk;let Hi=gk=class extends Dn.EventedMixin(ze){constructor(t){var e,i;super(t),this._scaleRangeQueries=new fk,this._iteratorPool=new Ec(hFe,r=>r.remove=()=>this._iteratorPool.release(r)),this._postorderIterator=new zIt,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._usedMemory=null,this._performanceInfo=new f9t,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=W(),this._eyePosSurfaceSR=W(),this._splitLimits=new B0,this._frustum=OL(),this._viewProjectionMatrix=Qe(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new Rf,this._frameTask=g5,this._allTiles=new Pi,this._upsampleInfoPool=new Ec(g9t),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=Ni(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=at.WebMercator,this.visibleElevationBounds=new BM(1/0,-1/0),this.rootTileElevationBounds=new BM(1/0,-1/0),this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateeCarree=!1,this.overlayManager=new Ou({...t,surface:this}),this._isGlobal=!((i=(e=t.view)==null?void 0:e.state)!=null&&i.isLocal),this._tileConstructor=this._isGlobal?G$t:V$t}initialize(){const t=this.view,e=t.resourceController;this._lercDecoder=iFe(e);const i=e.memoryController;this._tileCache=new G9((c,f)=>i.newCache(c,f),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",c=>c.unloadMapData()),this._elevationQueryCache=new Q7e(i.newCache("elevation-query"));const r=this.overlayManager;this._renderer=new j0(r.renderer,t._stage,this._allTiles,Sr(t.spatialReference).radius,i),this.addHandles([_e(()=>r.rendersOccluded,c=>this._renderer.setRenderOccludedOverlay(c)),_e(()=>r.renderer.isEmpty,()=>this._evaluateTransparency()),_e(()=>this.renderer.visible,c=>this.suspended=!c)],"overlayManager"),this.addHandles([_e(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?ua.UNFADED:ua.IMMEDIATE)},kt),_e(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?ua.UNFADED:ua.IMMEDIATE),kt),_e(()=>this.backgroundColor,(c,f)=>{c!=null&&c.equals(f)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(c))},Li),_e(()=>this.snapLevel,()=>this._viewChanged=!0,Li),_e(()=>this.view.pointsOfInterest,c=>{this._renderer.pointsOfInterest=c,this._watchUpdatingTracking.removeAll(),c&&this._watchUpdatingTracking.add(()=>c.focus.renderLocation,()=>this._allTilesSorted=!1)}),_e(()=>Tn.TERRAIN_TILE_TREE_SHOW_TILES,c=>{c&&!this._treeDebugger?we(()=>import("./TerrainTileTree3DDebugger-Or7WvqAU.js"),__vite__mapDeps([232,233])).then(({TerrainTileTree3DDebugger:f})=>{!this._treeDebugger&&Tn.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new f({view:t}))}):c||(this._treeDebugger=et(this._treeDebugger))},ii)]);const{spatialReference:n}=t;this._extentHelper=MIt(this.viewingMode,{layers:t.map.allLayers,layerViews:t.allLayerViews,viewSpatialReference:n});const s=new GT({getCollections:()=>{var c,f;return(f=(c=t.defaultsFromMap)==null?void 0:c.mapCollections)==null?void 0:f.map(({layers:_})=>_)},getChildrenFunction:c=>c&&"layers"in c?c.layers:null}),o=new Fg({layers:s,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:n});this._set("tilingSchemeLogic",o),this._updateTilingScheme(),this._elevationDataRequester=e.createStreamDataRequester(dy.ELEVATION),this._mapDataRequester=e.createStreamDataRequester(dy.BASEMAP);const l=e.scheduler;this._frameTask=l.registerTask(ni.TERRAIN_SURFACE,this),this.addHandles([_e(()=>this._extentHelper.stencilEnabledExtents,c=>this._renderer.setStencilEnabledLayerExtents(c),ii),_e(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),Li),_e(()=>this.extent,()=>this._updateRootTiles(),ii),t.on("resize",()=>this._viewChangeUpdate()),_e(()=>{const c=t.state;return[this._lodBias,this.lodSnapping,t.quality,c.camera,c.contentCamera,c.fixedContentCamera]},()=>this._viewChangeUpdate(),kt),_e(()=>{var c,f;return(f=(c=t.qualitySettings)==null?void 0:c.tiledSurface)==null?void 0:f.textureFadeDuration},c=>this._renderer.textureFadingEnabled=c>0,ii),_e(()=>{var c;return(c=t.qualitySettings)==null?void 0:c.physicallyBasedRenderingEnabled},c=>this._renderer.pbrMode=c?ei.Terrain:ei.Disabled,ii),_e(()=>this._userClippingExtent,()=>this._updateClippingExtent(),Li)]),this.addHandles(t.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}destroy(){this._frameTask.remove(),this._watchUpdatingTracking.destroy(),this._lercDecoder=ir(this._lercDecoder),this._removeAllTiles(),this._set("tilingSchemeLogic",et(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((t,e)=>this._unregisterTiledLayerView(e)),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",et(this.overlayManager)),this._tileCache=et(this._tileCache),Cce.prune(),this._treeDebugger=et(this._treeDebugger),this._renderer=et(this._renderer),this._iteratorPool=et(this._iteratorPool),this._upsampleMapCache=et(this._upsampleMapCache),this._elevationQueryCache=et(this._elevationQueryCache),this._set("view",null),this._extentHelper=et(this._extentHelper),this._upsampleInfoPool=et(this._upsampleInfoPool),TIt(),h$t()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){var t,e;if(this.lodSnapping===E$.ON){const i=this.view,r=this.tilingScheme,n=(e=(t=i.pointsOfInterest)==null?void 0:t.cameraOnSurface)==null?void 0:e.scale;if(r&&n){const s=i.state.contentCamera;let o=Sj(i,s.eye,s.viewForward,s.up).tilt;o>90&&(o=180-o);const l=2*(o/90)**2,c=r.levelAtScale(n)-l,f=Math.min(c+i.qualitySettings.tiledSurface.lodBias,this._splitLimits.maxLod||1/0);return f<=0?null:f}}return null}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?E$.ON:E$.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:t}=this,{clippingArea:e}=this.view;if(e==null||t==null)return null;const i=Ni(),r=k7e(e,i,t)?i:null,n=this._get("extent");return uT(r,n)?n:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const t=WZ(this.groundExtent,this._userClippingExtent,Ni()),e=this._get("extent");return uT(t,e)?e:t}get groundExtent(){return this._tilingSchemeExtent!=null?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){var t;return(t=this.tilingSchemeLogic)==null?void 0:t.extent}get updating(){var t,e;return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this.running||(t=this._watchUpdatingTracking)!=null&&t.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||(e=this.overlayManager)!=null&&e.updating)}get running(){return(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){var t,e,i;return((i=(e=(t=this.view)==null?void 0:t.map)==null?void 0:e.ground)==null?void 0:i.opacity)??1}set baseOpacity(t){this.view.map.ground.opacity=t}get viewingMode(){return this.view.state.viewingMode}get ready(){return this._rootTiles!=null}set renderOrder(t){this._renderer.renderOrder=t,this._set("renderOrder",t)}get rootTiles(){return this._rootTiles}get spatialReference(){var t;return((t=this.tilingScheme)==null?void 0:t.spatialReference)??null}get backgroundColor(){var t,e,i;return(i=(e=(t=this.view)==null?void 0:t.map)==null?void 0:e.ground)==null?void 0:i.surfaceColor}set backgroundColor(t){this.view.map.ground.surfaceColor=t}set slicePlaneEnabled(t){this._renderer.slicePlaneEnabled=t,this._set("slicePlaneEnabled",t),this._evaluateTransparency()}get tilingSchemeLocked(){var t;return((t=this.tilingSchemeLogic)==null?void 0:t.tilingSchemeLocked)??!1}get wireframe(){var t;return(t=this._renderer)==null?void 0:t.wireframe}set wireframe(t){t!==this._renderer.wireframe&&(this._renderer.wireframe=t,this._updateAllTileGeometries())}get opaque(){return this._renderer.transparency===ru.Opaque}set suspended(t){this._set("suspended",t),this._viewChangeUpdate()}get textureFadeDuration(){return this.view.qualitySettings.tiledSurface.textureFadeDuration??0}intersect(t,e,i,r){this._renderer.intersect(t,e,i,r)}getElevation(t,e,i,r){const n=this._rootTiles;if(!(n!=null&&n.length)||n[0].layerInfo[Yi.ELEVATION].length===0)return null;const s=Su;return s[0]=t,s[1]=e,s[2]=i,el(s,r,s,this._spatialReference)?Xbe(n,s[0],s[1]):(Ce.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null)}getElevations(t,e,i){const r=this._rootTiles,n=r?r[0].layerInfo[Yi.ELEVATION].length:0;if(r!=null&&r.length&&n!==0)for(let s=0;sn[2]&&(s+=1),Su[1]{if(l&&epe(l.extent,Su))if(l.isLeaf||l.rendered)i=Math.min(i,l.elevationBounds[0]),r=Math.max(r,l.elevationBounds[1]);else for(const c of l.children)n(c)},s=this._rootTiles;if(s!=null)for(const l of s)n(l);return{min:i,max:r}}getRootElevationBounds(){return{min:this.rootTileElevationBounds.min,max:this.rootTileElevationBounds.max}}getSphereScale(t,e){if(!this.tilingScheme)return null;if(!ud(t,Su,this.spatialReference))return Ce.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;Su[3]=e;let i=null;const r=s=>{if(s&&epe(s.extent,Su)){const o=s.children;if(o[0]&&!s.rendered)for(const l of o)r(l);else{const l=this._getLodBiasCorrectedScale(s.level);i=i==null?l:Math.min(i,l)}}},n=this._rootTiles;if(n!=null)for(const s of n)r(s);return i}queryVisibleScaleRange(t,e,i,r){const n=e?this.tilingScheme.levelAtScale(e):0,s=i?this.tilingScheme.levelAtScale(i):1/0,o=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(t,n+o,s+o,r)}_evaluateTransparency(){var s,o;const t=this.baseOpacity,e=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._allSurfaceLayersTransparent()?e?ru.Empty:ru.TransparentWithDraped:t>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?ru.Opaque:ru.Semitransparent,n=i!==r;return n&&(this._renderer.transparency=r,(o=(s=this.view)==null?void 0:s._stage)==null||o.renderer.setParameters({terrainTransparency:this._renderer.transparency})),n}_updateTilingScheme(){var i,r,n;const t=this.tilingSchemeLogic.tilingScheme;if(t===this.tilingScheme)return;ry(!!t,"tiling scheme cannot be reset to undefined"),this._isGlobal=!((r=(i=this.view)==null?void 0:i.state)!=null&&r.isLocal),this.tilingScheme&&this._removeAllTiles();const e=(t==null?void 0:t.spatialReference)??at.WebMercator;this._spatialReference=e,this._isWebMercator=!!(e!=null&&e.isWebMercator),this._isWebMercatorOnPlateeCarree=this._isWebMercator&&uL((n=this.view)==null?void 0:n.renderSpatialReference),this._set("tilingScheme",t),this._updateClippingExtent(),t&&(this._updateTiledLayers(),this._renderer.setTileSize(t.pixelSize),this.overlayManager.setSpatialReference(t.spatialReference),this._updateRootTiles())}_acquireTile(t,e,i,r){const n=this._tileCache.pop(gk._tileMemcacheKey);return n?(n.init(t,e,i,r,this),n):new this._tileConstructor(t,e,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:t,tilingScheme:e}=this;if(!e)return;const i=_9t;let r=e.rootTilesInExtent(t,i,5*PM);if(this._rootTiles!=null){if(r.length>PM)return void Ce.getLogger(this).warn(Z0t);const n=this._rootTiles.map(o=>o.lij),s=Eje(n,r,Ybe);if(this._updatingRootTiles=!0,s.removed.length>0||s.added.length>0){const o=this._rootTiles.filter(l=>!(s.removed.findIndex(c=>Ybe(c,l.lij))>-1)||(this._purgeTile(l),!1));s.added.forEach(l=>o.push(this._newRootTile(l))),this._setRootTiles(o)}}else this._updatingRootTiles=!0,r.length>PM&&(Ce.getLogger(this).warn(J0t),r=e.rootTilesInExtent(t,i,PM)),this._setRootTiles(r.map(n=>this._newRootTile(n)));uT(i,this._rootTilesExtent)||(this._rootTilesExtent=Ni(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const t=this._allTiles.filter(e=>e.isLoaded&&e.intersectsClippingArea);t.forEach(e=>this._renderer.updateTileGeometryState(e)),t.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(t),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(t){if(t.length===0)return;t.sort(n_);const e=this.renderer;t.forEach(i=>e.updateGeometryIfNeeded(i)),t.forEach(i=>this._pendingTilesForElevationUpdateEvent.add(i))}_shouldSplit(t){return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)===hi.SPLIT}_newRootTile(t){const e=this._acquireTile(0,t[1],t[2],null);return this._shouldSplit(e)&&e.setPendingUpdate(hi.SPLIT),this._loadTile(e),this._markTileToUpdate(e),this._updateRootTileElevationBounds(),e}_setRootTiles(t){if(this._rootTiles=t,this._allTiles.clear(),t!=null){const e=this._iteratorPool.acquire();for(e.reset(t);!e.done;)this._allTiles.push(e.next());e.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(t)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(t){t.updateClippingStatus(this.extent)&&t.resetPendingUpdate(hi.GEOMETRY)&&this._updateTileGeometryState(t)}_updateTilesVisibility(t){if(t==null)return;const e=qIt(t),i=this.visibleElevationBounds;let r=e?i.min:1/0,n=e?i.max:-1/0;const s=this.extent,o=this._viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(t);!l.done;){const c=l.next();c.updateClippingStatus(s)&&c.resetPendingUpdate(hi.GEOMETRY)&&this._updateTileGeometryState(c),c.setPendingUpdate(hi.RENDERDATA),c.computeVisibility(),c.updateScreenDepth(o),c.renderData&&(r=Math.min(c.elevationBounds[0],r),n=Math.max(c.elevationBounds[1],n))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(n)&&(i.min!==r||i.max!==n)&&(this.visibleElevationBounds=new BM(r,n))}_updateRootTileElevationBounds(){let t=1/0,e=-1/0;const i=this._rootTiles;i!=null&&i.forEach(({elevationBounds:n})=>{t=Math.min(t,n[0]),e=Math.max(e,n[1])});const r=this.rootTileElevationBounds;r.min===t&&r.max===e||(this.rootTileElevationBounds=new BM(t,e))}_updateViewDependentParameters(){const{camera:t,contentCamera:e}=this.view.state,i=Math.tan(.5*e.fovX),r=Math.tan(.5*e.fovY),n=this.tilingScheme.pixelSize,s=2**-this._lodBias*t.pixelRatio;this._splitLimits.aboveGround=t.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=n/t.width*this.maxTextureScale*s,this._splitLimits.relativeHeightLimit=n/t.height*this.maxTextureScale*s,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=bU(this._splitLimits.frustum??OL(),e.frustum):this._splitLimits.frustum=null,bU(this._frustum,t.frustum),nn(this._viewProjectionMatrix,e.projectionMatrix,e.viewMatrix),Ne(this._eyePosRenderSR,e.eye),el(t.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateRenderData(t){t.rendered&&!t.shouldLoad&&(ske(t)?this._loadChildren(t):v9t(t)&&this._loadParent(t))}_updateTileGeometryState(t){t.updateVisibility(),this._renderer.updateTileGeometryState(t)&&this._markTileToUpdate(t),this._usedMemory=null}_markAllTileNeighborsForGeometryUpdate(t){t.forEachLoadedNeighbor(e=>this._pendingTilesToUpdate.add(e))}_updateTileTexture(t,e){const i=t.resetPendingUpdate(hi.TEXTURE_FADING)?hi.TEXTURE_FADING:!!t.resetPendingUpdate(hi.TEXTURE_NOFADING)&&hi.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(t,i),this._usedMemory=null,e.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const t=PY.extent;od(t),this._pendingTilesForElevationUpdateEvent.forEach(e=>g2(t,e.extent,t)),this._pendingTilesForElevationUpdateEvent.clear(),PY.spatialReference=this.spatialReference,this.emit("elevation-change",PY),this._shouldEmitChangeEvent=!1}runTask(t){this._handleLayerViewChanges(t),this._frameTask.processQueue(t),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,t),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(t),this._sortTiles(t);const e=!this.view.state.fixedContentCamera;this._mergeAndSplit(t,e),this._updateElevation(t),this._updateTextures(t),e||this._mergeAndSplit(t,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),t.done&&t.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue")}_updateAllTilesStatus(t){if(!this._viewChanged||!this._rootTiles||t.done)return;this._viewChanged=!1;const e=this._iteratorPool.acquire();e.reset(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,n=this._eyePosRenderSR;for(;!e.done;){const s=e.next(),o=s.shouldSplit(r,n,i);if(o!==hi.SPLIT){if(s.resetPendingUpdate(hi.SPLIT)&&s.updateAgentSuspension(),o===hi.ELEVATION&&s.updateAgents(Yi.ELEVATION),e.skipSubtree(),!s.isLeaf){s.setPendingUpdate(hi.MERGE),s.resetPendingUpdate(hi.SPLIT);const l=this._iteratorPool.acquire();l.resetOne(s);const c=this._viewProjectionMatrix;for(let f=l.next();!l.done;f=l.next())this._updateClippingStatus(f),f.updateVisibility(),f.updateScreenDepth(c);l.remove()}}else s.resetPendingUpdate(hi.MERGE),s.isLeaf&&(s.setPendingUpdate(hi.SPLIT),e.skipSubtree()),s.rendered&&s.setPendingUpdate(hi.RENDERDATA)}e.remove(),this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),t.madeProgress()}_sortTiles(t){t.done||this._allTilesSorted||(GIt(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),t.madeProgress())}_markTileToUpdate(t){ot(t.isLoaded),t.intersectsClippingArea&&(this._pendingTilesToUpdate.add(t),this._markAllTileNeighborsForGeometryUpdate(t))}_updatePendingTileGeometries(){const t=this._pendingTilesToUpdate,e=Array.from(t.keys()).filter(n=>n.isLoaded&&n.intersectsClippingArea);if(e.length===0)return void t.clear();const i=(n,s)=>{!(s!=null&&s.isLoaded)||!s.intersectsClippingArea||s.level{var T;const x=cV[_];i(s,(T=c[_])==null?void 0:T.findCorner(lV(x),A=>A.isLoaded))};for(let _=0;_<4;++_)if(l&1<<_){const x=o.geometryState.neighborData.edgePeerNeighbors[_];x&&(x==null?void 0:x.level)>=s.level&&x.forAllSubtreeOnSide(Sce(qv[_]),T=>!(!T.isLoaded||!T.intersectsClippingArea)&&(ot(t.has(T)||n_(s,T)<0),i(s,T),!0)),f((_+1)%4),f(_)}}t.clear(),this._updateTilesGeometries(e),this._shouldEmitChangeEvent=!0,pa&&oV&&this.checkAllTilesWaterproofness()}_mergeAndSplit(t,e){if(this.suspended||t.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let n=!1;for(;!t.done;){n=!0;let s=!1;const o=!this._allTiles.some(l=>{var f;if(!i&&!r&&!l.visible)return t.done;let c=l;if(l.resetPendingUpdate(hi.MERGE)){if(!e)return l.setPendingUpdate(hi.MERGE),t.done;for(;(f=c.parent)!=null&&f.resetPendingUpdate(hi.MERGE);)c=c.parent;this._mergeTile(c),s=!0,t.madeProgress()}else l.resetPendingUpdate(hi.SPLIT)&&(this._splitTile(l),s=!0,t.madeProgress());return!t.done&&c===l&&l.resetPendingUpdate(hi.RENDERDATA)&&(this._updateRenderData(l),t.madeProgress()),t.done});if(s&&(this._allTilesSorted=!1,this._allTilesDirty=!0),o){if(!i){i=!0;continue}if(!s)break}else this._allTilesDirty=!0}n?t.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._sortTiles(t)}_updateElevation(t){t.done||(this._allTiles.some(e=>(e.resetPendingUpdate(hi.GEOMETRY)&&(this._updateTileGeometryState(e),this._updateTileTexture(e,t),this._shortBatches&&this._updatePendingTileGeometries(),t.madeProgress()),t.done)),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(t){t.done||this._allTiles.some(e=>(this._updateTileTexture(e,t),t.done))}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams(no.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const t=this.view.quality;return this.view.qualitySettings.tiledSurface.lodBias-(1-t)*Y0t}_getLodBiasCorrectedScale(t){const e=this.tilingScheme.levels,i=Je(t-this._lodBias,0,e.length-1),r=i-Math.floor(i);return e[Math.floor(i)].scale*(1-r)+e[Math.ceil(i)].scale*r}_removeAllTiles(){this._rootTiles!=null&&(this._rootTiles.forEach(t=>this._purgeTile(t)),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.renderer.visible=!1}_purgeDescendantTiles(t){if(!t.children[0])return!1;let e=!1;for(let i=0;i<4;++i)e=this._purgeTile(t.children[i])||e;return t.unsetChildren(),e}_purgeTile(t){const e=this._purgeDescendantTiles(t)||t.rendered;return this._allTiles.removeUnordered(t),this._unloadTile(t),this._tileCache.put(gk._tileMemcacheKey,t),e}_unloadTile(t){this._pendingTilesToUpdate.delete(t),this._pendingTilesForElevationUpdateEvent.delete(t),t.unload(this._renderer)}_splitTile(t){ry(t.isLeaf,"tile that is already split should not be split again!");const e=t.level+1,i=2*t.lij[1],r=2*t.lij[2];t.setChildren(this._createTile(e,i,r,t),this._createTile(e,i,r+1,t),this._createTile(e,i+1,r,t),this._createTile(e,i+1,r+1,t)),t.setPendingUpdate(hi.RENDERDATA),t.updateAgentSuspension(),this._allTiles.pushArray(t.children),this._allTilesDirty=!0,++this._performanceInfo.numSplit}_emitTileScaleChange(t,e=t.level){_8.spatialReference=this.spatialReference,_8.extent=t.extent,_8.scale=this._getLodBiasCorrectedScale(e),this.emit("scale-change",_8)}_createTile(t,e,i,r){ry(!!r,"_createTile sanity check");const n=this._acquireTile(t,e,i,r);return n.updateClippingStatus(this.extent),n.updateScreenDepth(this._viewProjectionMatrix),this._shouldSplit(n)&&n.setPendingUpdate(hi.SPLIT),n}get _shortBatches(){return this.view.state.mode!==Vr.IDLE}_mergeTile(t){ry(!t.hasPendingUpdate(hi.SPLIT),"_mergeTile sanity check"),this._purgeDescendantTiles(t)&&(ry(!t.renderData,"_mergeTile sanity check"),this._loadTile(t),this._markTileToUpdate(t),this._emitTileScaleChange(t),this._shortBatches&&this._updatePendingTileGeometries()),this._allTilesDirty=!0,++this._performanceInfo.numMerged}_loadChildren(t){ry(t.rendered,"parent should be rendered"),this._unloadTile(t);const e=t.children;e.forEach(i=>this._loadTile(i)),e.forEach(i=>this._pendingTilesToUpdate.add(i)),this._markAllTileNeighborsForGeometryUpdate(t),this._emitTileScaleChange(t,t.level+1),this._shortBatches&&this._updatePendingTileGeometries()}_loadParent(t){const e=t.parent;this._unloadChildren(e),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e,e.level),this._shortBatches&&this._updatePendingTileGeometries()}_unloadChildren(t){const e=t.children;if(e[0])for(let i=0;i<4;++i){const r=e[i];this._unloadChildren(r),this._unloadTile(r)}}_loadTile(t){t.load(),t.setPendingUpdate(hi.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(t)}_elevationDataArrived(t,e,i){const r=new CIt(t.lij,t.extent,i);t.dataArrived(e,Yi.ELEVATION,r);const n=[t],s=t.level,o=this._iteratorPool.acquire();for(o.reset(n);!o.done;){const l=o.next();l.findElevationBoundsForLayer(e,s),l.computeElevationBounds()}s===0&&this._updateRootTileElevationBounds(),o.remove(),this._updateTilesVisibility(n)}_handleLayerViewChanges(t=ou){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let e=!1;const i=new Set;let r=-1;for(const n of this.view.allLayerViews.items)if(i.add(n.uid),JL(n)||PR(n))if(this._basemapLayerViewHandles.has(n.uid)&&!PR(n)){const s=this._layerClassFromLayerView(n),o=this._getLayerIdxByUID(s,n.uid);o!=null&&((o{i.has(s)||(this._unregisterTiledLayerView(s),e=!0)}),e&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),t.madeProgress()}_allSurfaceLayersTransparent(){var e,i;let t=((i=(e=this.view.map)==null?void 0:e.ground)==null?void 0:i.opacity)===0;for(const r of this.view.allLayerViews.items)if($ie(r)&&!Y7(r.layer)&&r.fullOpacity!==0)return t=!1,t;return t}_hasCompositeBlendMode(){for(const t of this.view.allLayerViews.items)if((ZL(t)||PR(t))&&KIt(Nie[t.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(t){return Iie(t)?Yi.ELEVATION:Yi.MAP}_registerTiledLayerView(t){const e=[];if((ZL(t)||PR(t))&&e.push(_e(()=>t.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(ua.UNFADED)})),!PR(t)){const i=this._layerClassFromLayerView(t);e.push(_e(()=>t.suspended,()=>this._updateTiledLayers())),e.push(_e(()=>t.fullOpacity,()=>this._updateTileTextures(ua.UNFADED))),e.push(_e(()=>"effectiveScaleRange"in t.layer?t.layer.effectiveScaleRange:null,()=>this._restartAllAgents(i))),e.push(t.on("data-changed",()=>{const r=this._getLayerIdxByUID(i,t.uid);r!=null&&this._invalidateLayerData(r,i)}))}this._unregisterTiledLayerView(t.uid),this._basemapLayerViewHandles.set(t.uid,e)}_unregisterTiledLayerView(t){const e=this._basemapLayerViewHandles.get(t);if(e){for(const i of e)i.remove();this._basemapLayerViewHandles.delete(t)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const t=this.view.allLayerViews,e=[[],[]];let i=null;t.forEach(r=>{if(!r.layer||r.suspended||!JL(r)||!r.fullExtent)return;const n=this._layerClassFromLayerView(r);if(n===Yi.MAP){const s=r.displayLevelRange.maxLevel;s!==1/0&&(i===null||s>i)&&(i=s)}e[n].push(r)});for(const r of rS){const n=this._layerViews[r],s=e[r];s.reverse();const o=s.length;let l=n.length!==o;const c=new Array(o),f=new Array(n.length);this._layerIndexByUid[r].clear();for(let _=0;_-1&&(f[T]=_)}if(l){const _=this._postorderIterator;for(_.reset(this._rootTiles);!_.done;)_.next().modifyLayers(f,c,r);this._layerViews[r]=s,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(t){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;){const i=e.next();i.restartAgents(t),t===Yi.ELEVATION&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(t,e){return this._layerViews[e][t]}numLayers(t){return this._layerViews[t].length}_updateTileTextures(t){this._allTiles.forAll(e=>{e.updateAgents(Yi.MAP),t===ua.IMMEDIATE?this.renderer.updateTileTexture(e,hi.TEXTURE_NOFADING):e.updateRenderData(Yi.MAP,t)}),this._evaluateTransparency()}_invalidateLayerData(t,e){this._allTiles.forAll(i=>i.removeLayerAgent(t,e)),this._allTiles.forAll(i=>i.invalidateLayerData(t,e))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(t=no.UPDATE){this.renderer.setNeedsRender(t)}requestUpdate(){++this._pendingUpdates==1&&(this._hasPendingUpdates=!0)}requestTileData(t,e,i,r){const n=this.layerViewByIndex(e,i),s=n.layer;return!s.tilemapCache||L5(n)?this._requestTileData(t,i,n,r):(++this._asyncWorkItems,s.tilemapCache.fetchAvailability(t.lij[0],t.lij[1],t.lij[2],{...r,timeout:6e3}).then(()=>--this._asyncWorkItems).catch(o=>{throw--this._asyncWorkItems,St(r),sn(o)||this._dataMissing(t,i,n,{notInTilemap:!0}),o}).then(()=>this._frameTask.schedule(()=>this._requestTileData(t,i,n,r),r.signal)))}_requestTileData(t,e,i,r){return e===Yi.ELEVATION?Iie(i)?this._requestElevationTileData(t,i,r):Promise.reject():$ie(i)?this._requestMapTileData(t,i,r):Promise.reject()}_requestElevationTileData(t,e,i){++this._asyncWorkItems;const r=o=>{if(xo(i))return;const l=this._layerIndexByUid[Yi.ELEVATION].get(e.uid);l!=null?(this._usedMemory=null,this.requestUpdate(),this._elevationDataArrived(t,l,o)):Ce.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",Yi.ELEVATION,t.lij.toString())},n=o=>{sn(o)||(this._dataMissing(t,Yi.ELEVATION,e,o),this.requestUpdate())};if(a_e(e.layer))return e.layer.fetchTile(t.lij[0],t.lij[1],t.lij[2],{noDataValue:EL,signal:i.signal}).then(o=>{if(!xo(i))return this._frameTask.schedule(()=>r(o),i.signal,n);Ce.getLogger(this).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true.")},n).finally(()=>{--this._asyncWorkItems});const s=e.getTileUrl(t.lij[0],t.lij[1],t.lij[2]);return this._elevationDataRequester.request(s,"binary",i).then(o=>this._lercDecoder.decode(o,{noDataValue:EL},i.signal)).then(o=>{o?r(new eFe(o)):n(new Error("LERC decoding failed"))},n).finally(()=>{--this._asyncWorkItems})}_requestMapTileData(t,e,i){++this._asyncWorkItems;const r=(f,_)=>{--this._asyncWorkItems,CO(_),xo(i)||(this._dataMissing(t,Yi.MAP,e,f),this.requestUpdate())},n=f=>_=>r(_,f),s=f=>this._frameTask.schedule(()=>{--this._asyncWorkItems,this.requestUpdate(),xo(i)?CO(f):this._mapTileDataArrived(t,e,f)},i.signal,n(f)).catch(n(f)),o=(f,_=null)=>this._frameTask.schedule(()=>r(f,_));if(L5(e)){const f=e.schemaHelper.getLevelRowColumn(t.lij);return e.fetchTile(f[0],f[1],f[2],i).then(s,o)}if(xG(e))return e.fetchTile(t.lij[0],t.lij[1],t.lij[2],i).then(s,o);if(xce(e)&&a_e(e.layer))return e.layer.fetchTile(t.lij[0],t.lij[1],t.lij[2],i).then(f=>{if(xo(i))return Ce.getLogger(this).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void o(ur());s(f)},o);let l=e.getTileUrl(t.lij[0],t.lij[1],t.lij[2]);kht(e.layer)&&e.layer.refreshTimestamp&&(l+=`${l.includes("?")?"&":"?"}_ts=${e.layer.refreshTimestamp}`);const c=e.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(l,c,i).then(s,o)}_mapTileDataArrived(t,e,i){const r=this._getLayerIdxByUID(Yi.MAP,e.uid);r!=null?t.dataArrived(r,Yi.MAP,i):(CO(i),Ce.getLogger(this).warn("TerrainSurface: received data from unknown layer"))}_getLayerIdxByUID(t,e){return this._layerIndexByUid[t].get(e)}_dataMissing(t,e,i,r){const n=this._getLayerIdxByUID(e,i.uid);n!=null?t.dataMissing(n,e,r):Ce.getLogger(this).warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(t){this._rootTiles&&this.overlayManager&&(this._allTiles.forAll(e=>{e.renderData&&this.overlayManager.setTileParameters(e)}),this._renderer.setNeedsRender(t))}get performanceInfo(){const t=this._performanceInfo;return t.numNodes=this._allTiles.length,t.numLeaves=t.numVisible=t.numRendered=t.numLoadedPerLevel.length=t.numRenderedPerLevel.length=0,this._allTiles.forAll(e=>{e.isLeaf&&t.numLeaves++;const i=e.level;e.renderData&&(t.numLoadedPerLevel[i]=(t.numLoadedPerLevel[i]||0)+1),e.visible&&(t.numVisible++,e.rendered&&(t.numRenderedPerLevel[i]=(t.numRenderedPerLevel[i]||0)+1,t.numRendered++))}),t}get usedMemory(){return this.tilingScheme?(this._usedMemory==null&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((t,e)=>t+e.usedMemory,0)):null}getUsedMemoryForLayerView(t){let e=0;const i=this._layerClassFromLayerView(t),r=this._getLayerIdxByUID(i,t.uid);return r!=null&&this._allTiles.forAll(n=>e+=n.getUsedMemoryForLayer(i,r)),e}getTile(t){if(t==null||this._rootTiles==null)return null;const e=t.split("/").map(o=>+o);if(e[0]===0)return this._rootTiles.find(o=>o.lij[1]===e[1]&&o.lij[2]===e[2]);const i=2**e[0],r=Math.floor(e[1]/i),n=Math.floor(e[2]/i);let s;if(this._rootTiles.some(o=>o.lij[1]===r&&o.lij[2]===n&&(s=o,!0)),s){let o=1<0&&l++,!s.children[l])return null;s=s.children[l],o>>=1}return ry(s.lij[0]===e[0]&&s.lij[1]===e[1]&&s.lij[2]===e[2],"not the right tile?"),s}return null}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(t){this._renderer.renderPatchBorders=t}get visualizeNormals(){return this._renderer.visualizeNormals}set visualizeNormals(t){this._renderer.visualizeNormals=t}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(t){this._renderer.renderingDisabled=t}get test(){const t=this;return{renderer:t._renderer,lercDecoder:t._lercDecoder,forceReload:()=>{t._rootTiles!=null&&t._rootTiles.length>0&&(t._mergeTile(t._rootTiles[0]),t._viewChangeUpdate())},getTiles:()=>t._allTiles.toArray(),getRenderedTiles(){OY.clear(),t._allTiles.forAll(i=>{i.visible&&i.rendered&&OY.push(i)});const e=OY.toArray();return dFe(t.renderOrder,e),e},lockTilingScheme(e,i){t._extentHelper.defaultTiledLayersExtent=i,t.tilingSchemeLogic.test.lockTilingScheme(e)}}}checkAllTilesWaterproofness(){if(!oV)return;const t=this._rootTiles;if(t==null)return;const e=s=>{var o,l,c;return((c=(l=(o=s==null?void 0:s.renderData)==null?void 0:o.geometry)==null?void 0:l.indices)==null?void 0:c.length)>0},i=(s,o)=>{e(s)&&console.error("Tile[",s.lij,"] has geometry although parent[",o.lij,"] has geom")},r=s=>{var o,l;if(s.intersectsClippingArea)if(s.renderData&&!s.renderData.geometryState&&console.error("Tile[",s.lij,"] has renderData but not geometryState"),s.renderData&&!s.renderData.geometry&&console.error("Tile[",s.lij,"] has renderData but not geometryInfo"),!((o=s.renderData)!=null&&o.geometry)||(((l=s.renderData.geometry.indices)==null?void 0:l.length)??0)>0||console.error("Tile[",s.lij,"] has renderData but no indices - geometryInfo: ",s.renderData.geometry),e(s)){s.checkGeometryWaterproofness();for(const c of s.children)i(c,s)}else if(s.isLeaf)console.error("Tile[",s.lij,"] has no geometry and no children, from root to leaf");else for(const c of s.children)r(c)},n=s=>{var f;const o=((f=s.parent)==null?void 0:f.visible)??!0,l=s.visible;s.computeVisibility();const c=s.visible;if(l!==c&&o&&console.error(" Tile[",s.lij,"] has out of date visibility: ",l," instead of ",c),!s.isLeaf)for(const _ of s.children)n(_)};for(const s of t)r(s),n(s)}get isGlobal(){return this._isGlobal}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateeCarree(){return this._isWebMercatorOnPlateeCarree}isEastEndWrap(t){return this.isGlobal&&t[2]===this.lijEastEnd(t[0])-1}isWestEndWrap(t){return this.isGlobal&&t[2]===0}lijEastEnd(t){return 2**(t+(this.spatialReference!=null&&this.spatialReference.isGeographic?1:0))}wrapEastWest(t){const e=this.lijEastEnd(t[0]),i=t[2];if(0<=i&&is.extentMidX?1:0)+(i{const o=this._ensureGeomRecord(e,s);n.forEach(({geometry:l,operation:c,states:f},_)=>{let x=!1;if(c===ds.UPDATE){const T=o.get(_);if(T){if(f&ca.TRANSFORMATION){const A=this.model.getObject(s);this.model.updateRenderGeometryTransformation(A,l,T)&&(x=!0)}x||i.updates.push({renderGeometry:T,updateType:f})}else Xt(!1,"ModelDirtySet.commitLayer: invalid update")}if(c===ds.REMOVE||x){const T=o.get(_);T?(i.removes.push(T),o.delete(_)):c===ds.REMOVE&&Xt(!1,"ModelDirtySet.commitLayer: invalid remove")}if(c===ds.ADD||x){const T=this.model.getObject(s);if(T!=null){const A=this.model.getRenderGeometry(T,l);i.adds.push(A),o.set(_,A)}}}),o.size===0&&this._residentGeomRecords.get(e).delete(s)}),this._residentGeomRecords.get(e).size===0&&this._residentGeomRecords.delete(e),this._dirtyGeomRecords.delete(e),this.dirty=this._hasDirtyGeometryRecords)}commitSyncUpdates(e,i){const r=this._dirtyGeomRecords.get(e);r&&r.forEach((n,s)=>{const o=this._ensureGeomRecord(e,s);n.forEach(({geometry:l,operation:c,states:f,sync:_},x)=>{let T=!1;if(c===ds.UPDATE&&_){const A=o.get(x);if(A){if(f&ca.TRANSFORMATION){const M=this.model.getObject(s);this.model.updateRenderGeometryTransformation(M,l,A)&&(T=!0)}T||i.updates.push({renderGeometry:A,updateType:f})}else Xt(!1,"ModelDirtySet.commitSyncUpdates: invalid update")}})})}getResidentRenderGeometries(e,i){const r=this._residentGeomRecords.get(e);r&&r.forEach(n=>n.forEach(s=>i.push(s)))}_objectStateChanged(e,i){for(const r of i.geometries)this._updateOrCreateDirtyRecord(i,r,null,ds.UPDATE,e)}visibilityChanged(e){this._objectStateChanged(ca.VISIBILITY,e)}highlightChanged(e){this._objectStateChanged(ca.HIGHLIGHT,e)}occlusionChanged(e){this._objectStateChanged(ca.OCCLUDEE,e)}attributesChanged({object:e,geometry:i,sync:r}){this._updateOrCreateDirtyRecord(e,i,null,ds.UPDATE,ca.GEOMETRY,r)}layerAdded(e){e.objects.forAll(i=>this._layerObjectAdded(e,i))}layerRemoved(e){e.objects.forAll(i=>this._layerObjectRemoved(e,i))}layerObjectAdded(e){this._layerObjectAdded(e.layer,e.object)}_layerObjectAdded(e,i){const r=e.id;for(const n of i.geometries)this._geometryAdded(i,n,r)}layerObjectRemoved(e){this._layerObjectRemoved(e.layer,e.object)}layerObjectsAdded(e){for(const i of e.objects)this._layerObjectAdded(e.layer,i)}layerObjectsRemoved(e){for(const i of e.objects)this._layerObjectRemoved(e.layer,i)}_layerObjectRemoved(e,i){const r=e.id;for(const n of i.geometries)this._geometryRemoved(i,n,r)}transformationChanged(e){const i=this._getParentLayerId(e),r=e.id;this._ensureGeomRecord(i,r).forEach(n=>{this._updateOrCreateDirtyRecord(e,n.geometry,i,ds.UPDATE,ca.TRANSFORMATION)})}shaderTransformationChanged(e){const i=this._getParentLayerId(e),r=e.id;this._ensureGeomRecord(i,r).forEach(n=>{n.objectShaderTransformationChanged(e.shaderTransformation)})}geometryAdded(e){this._geometryAdded(e.object,e.geometry)}_geometryAdded(e,i,r=null){this._updateOrCreateDirtyRecord(e,i,r,ds.ADD)}geometryRemoved(e){this._geometryRemoved(e.object,e.geometry)}_geometryRemoved(e,i,r=null){this._updateOrCreateDirtyRecord(e,i,r,ds.REMOVE)}_updateOrCreateDirtyRecord(e,i,r,n,s=ca.NONE,o=!1){r=r??this._getParentLayerId(e);const l=e.id,c=i.id,f=this._ensureDirtyRecord(r,l),_=f.get(c);if(_){const x=_.operation;x===ds.REMOVE&&n===ds.ADD&&_.states!==ca.NONE?_.operation=ds.UPDATE:x===ds.REMOVE&&n===ds.ADD||x===ds.ADD&&n===ds.REMOVE?f.delete(c):x!==ds.UPDATE||n!==ds.REMOVE&&n!==ds.UPDATE?(Xt((x===ds.REMOVE||x===ds.ADD)&&n===ds.UPDATE,"ModelDirtySet.objectGeometryAdded: inconsistent state"),_.states|=s):(_.operation=n,_.states|=s),_.sync=_.sync||o}else f.set(c,new b9t(n,i,s,o));this.dirty=this._hasDirtyGeometryRecords}_ensureGeomRecord(e,i){let r=this._residentGeomRecords.get(e);r||(r=new Map,this._residentGeomRecords.set(e,r));let n=r.get(i);return n||(n=new Map,r.set(i,n)),n}get _hasDirtyGeometryRecords(){return rp(this._dirtyGeomRecords,e=>rp(e,i=>i&&i.size>0))}_ensureDirtyRecord(e,i){let r=this._dirtyGeomRecords.get(e);r||(r=new Map,this._dirtyGeomRecords.set(e,r));let n=r.get(i);return n||(n=new Map,r.set(i,n)),n}_getParentLayerId(e){return e.parentLayer?e.parentLayer.id:LGe}formatDebugInfo(){const e=["ADD","UPD",void 0,"REM"];let i="";return this._dirtyGeomRecords.forEach((r,n)=>{r.forEach((s,o)=>{i.length>0&&(i+=` -`),i+=n+"."+o;const l=[];s.forEach(c=>{const f=c.operation;l[f]||(l[f]=[]),l[f].push(c.geometry.id)});for(let c=0;ci+r.size,0)},commit:i=>e._dirtyGeomRecords.forEach((r,n)=>e.commitLayer(n,i))}}};y([w({constructOnly:!0})],xI.prototype,"model",void 0),y([w()],xI.prototype,"dirty",void 0),xI=y([Z("esri.views.3d.webgl-engine.lib.ModelDirtySet")],xI);const w9t=xI;let yk=class extends ze{constructor(){super(...arguments),this.dirtySet=new w9t({model:this}),this._content=new Map,this._originFactory=new Yle(null)}getObject(e){return this._content.get(e)}add(e){const i=e.id;Xt(!this._content.has(i),"Model/Stage already contains object to be added"),this._content.set(i,e),WU(e)&&this.dirtySet.layerAdded(e)}remove(e){return!!this._content.has(e.id)&&(this._content.delete(e.id),WU(e)&&this.dirtySet.layerRemoved(e),!0)}addMany(e){for(const i of e)i&&(Xt(!this._content.has(i.id),"Model/Stage already contains object to be added"),this._content.set(i.id,i))}removeMany(e){for(const i of e)i&&(Xt(this._content.has(i.id),"Model/Stage doesn't contain object to be removed"),this._content.delete(i.id))}has(e){return this._content.has(e.id)}forEachOfType(e,i){this._content.forEach(r=>{r.type===e&&i(r)})}getRenderGeometry(e,i){const r=new $5(i,{castShadow:e.castShadow,objectShaderTransformation:e.shaderTransformation});r.transformation=e.getCombinedStaticTransformation(i,Zbe);const{localOrigin:n}=i;return r.localOrigin=n??this._originFactory.getOrigin(r.boundingSphere),r}updateRenderGeometryTransformation(e,i,r){if(e==null)return!1;r.transformation=e.getCombinedStaticTransformation(i,Zbe);const n=this._originFactory.getOrigin(r.boundingSphere);return r.localOrigin!==n}getStats(){const e={},i=Array.from(this._content.values());for(let r=0;rn.type===r).length;return{contentTypes:e,dirtySet:this.dirtySet.formatDebugInfo()}}get test(){return{content:Array.from(this._content.values())}}};y([w({constructOnly:!0})],yk.prototype,"dirtySet",void 0),yk=y([Z("esri.views.3d.webgl-engine.parts.Model")],yk);const Zbe=Qe();let x9t=class{constructor(e){this._totalCount=e,this._indexRanges=[0,e]}allVisible(){return this.componentCount()===this._totalCount}allInvisible(){return this._indexRanges.length===0}componentCount(){const e=this._indexRanges;let i=0;for(let r=0;r(t[l]>0?(s!==l-1&&(r.length&&r.push(i[s+1]-r[r.length-1]),r.push(i[l])),s=l):(o!==l-1&&(n.length&&n.push(i[o+1]-n[n.length-1]),n.push(i[l])),o=l),!0)),r.length&&r.push(i[s+1]-r[r.length-1]),n.length&&n.push(i[o+1]-n[n.length-1]),{highlightRanges:r,defaultRanges:n}}let SI=class extends ze{constructor(){super(...arguments),this.visible=AO.Hidden}destroy(){this.intersectionGeometry=et(this.intersectionGeometry)}};var AO;y([w({autoDestroy:!0})],SI.prototype,"renderable",void 0),y([w({autoDestroy:!0})],SI.prototype,"components",void 0),SI=y([Z("esri.views.3d.webgl-engine.collections.Component.ComponentObject")],SI),function(t){t[t.Hidden=0]="Hidden",t[t.Visible=1]="Visible"}(AO||(AO={}));function C9t(t,e,i,r){if(i>=e)return t;t==null&&(t=A9t());const n=t.isVisibleBit;let s=t.data;const o=ake(s),l=i/o|0,c=i-o*l,f=(e-1)/o|0,_=s,x=r===n;if(!(i<_.length*o)&&x){const T=l+1,A=Math.ceil(_.length*VV),M=f+1;let I=Math.max(T,A);I=Math.min(I,M),s=new Uint32Array(I),s.set(_)}return l{if(!oke(this._components.pickability,M))return!0;const I=this.getComponentAabb(M,$9t);if(o!=null){const k=o[M];s!=null?s.componentOffset=k:(e[2]=T-k,i[2]=A-k)}if(s!=null&&s.applyToAabb(I),!mle(I,e,x,r))return!0;const L=_[M]/3,F=_[M+1]/3,z=(k,U,j)=>l(M,k,qh(U,U,n),j);return s==null&&F-L>rke?(this._componentIntersectionData[M]==null&&(this._componentIntersectionData[M]=new Nce(this._indices,L,F,c)),this._componentIntersectionData[M].intersectRay({r0:e,r1:i},z)):Q9(e,i,L,F,f,c,void 0,s,z),!0})}_computePerComponentAabbs(){const e=this._components.count,i=Rs(6*e),r=this._indices,n=this._positions,s=this._components.offsets;let o=0;for(let l=0;l{const l=o.offsetObb!=null?o.offsetObb:o.obb,c=Ve(xn($d,l.center,r),s),f=pj(l,s);if(b8(i,c-f)&&b8(i,c+f))return;const _=B9t(l,n);if(_===-1)return;if(_===0)return P1.far=c+f,P1.near=c-f,void N5(i,P1);const x=w8.pushNew();x.near=c-f,x.far=c+f,x.mask=_,x.object=o});for(let o=0;o{let _=z9t;for(let x=0;x0;x++){if(!(l.mask&1<t||{near:1/0,far:-1/0,mask:0,object:null},deallocator:t=>(t.object=null,t)}),P1=f6(),Fu=W(),e3=W(),k9t=new Pi({deallocator:null}),z9t=new Pi({deallocator:null});function U9t(t,e,i){i.length=0;const r=e.length-3;RY(Fu,e,r);const n=fn(t,Fu);n<=0&&(i.push(Fu[0]),i.push(Fu[1]),i.push(Fu[2]));let s=0,o=n;for(;st.halfSize[0]?1:0)+3*($d[1]<-t.halfSize[1]?-1:$d[1]>t.halfSize[1]?1:0)+9*($d[2]<-t.halfSize[2]?-1:$d[2]>t.halfSize[2]?1:0)+13),s=Jbe[n];if(s===0)return s;rj(x8,t.quaternion),Aoe(x8,x8,t.halfSize);const o=(l,c)=>{const f=Jbe[n+c+1];return Ie(l,((1&f)<<1)-1,(2&f)-1,((4&f)>>1)-1),qh(l,l,x8),Be(l,t.center,l)};return i.length=0,ku(i,o(IY,0)),ku(i,o(Qbe,1)),ku(i,o($d,2)),ku(i,o(ewe,3)),r(i),s===1||(i.length=0,ku(i,IY),ku(i,ewe),ku(i,o($d,4)),ku(i,o(twe,5)),r(i),s===2||(i.length=0,ku(i,IY),ku(i,twe),ku(i,o($d,6)),ku(i,Qbe),r(i))),s}const Jbe=(()=>{const t=new Array(216);let e=0;const i=r=>{for(let n=0;n0)return-1;n===0&&(i|=1<r.renderable.material.submit(e,i,r))}queryShadowCasterDepthRange(e){return this._objects.visibleObjects.length?F9t(e,this._objects.visibleObjects):null}};function G9t(t){const e=ls().vec3f(J.POSITION);return t.normals&&e.vec2i16(J.NORMALCOMPRESSED,{glNormalized:!0}),t.textureCoordinates===So.Default?e.vec2f(J.UV0):t.textureCoordinates===So.Atlas&&(e.vec2f(J.UV0),e.vec4u16(J.UVREGION,{glNormalized:!0})),t.colors&&e.vec4u8(J.COLOR,{glNormalized:!0}),e}let H9t=class{constructor(){this.externalColor=Xi(),this.externalColorMixMode=Uo.Multiply,this.castShadows=!0,this.pickable=!0,this.elevationOffset=0}},q9t=class extends Ls{constructor(e,i){super(e,"int",Or.Draw,(r,n,s)=>r.setUniform1i(e,i(n,s)))}};var $y;(function(t){t[t.Uniform=0]="Uniform",t[t.Varying=1]="Varying",t[t.COUNT=2]="COUNT"})($y||($y={}));const kce=429496.7296;function cke(t,e){BL(t/kce*.5+.5,e)}function W9t(t,e){switch(e.componentData){case $y.Varying:return Y9t(t,e);case $y.Uniform:return X9t(t);case $y.COUNT:return;default:e.componentData}}function Y9t(t,e){const{vertex:i,fragment:r}=t;i.include(o0),i.uniforms.add(new $f("componentColorTex",s=>s.componentParameters.texture.texture)),t.attributes.add(J.COMPONENTINDEX,"float"),t.varyings.add("vExternalColorMixMode","mediump float"),t.varyings.add("vExternalColor","vec4");const n=e.output===ue.ObjectAndLayerIdColor;n&&t.varyings.add("vObjectAndLayerIdColor","vec4"),t.include(J6e),i.constants.add("elevationScale","float",2*kce),i.constants.add("stride","float",Le("enable-feature:objectAndLayerId-rendering")?3:2),i.code.add(V`vec2 getComponentTextureCoordinates(float componentIndex, float typeOffset) { +}`),e}(function(t){t[t.BelowLayer=0]="BelowLayer",t[t.Only=1]="Only",t[t.COUNT=2]="COUNT"})(rx||(rx={}));const W4t=Object.freeze(Object.defineProperty({__proto__:null,get BackgroundMode(){return rx},build:kFe},Symbol.toStringTag,{value:"Module"}));let Y4t=class extends pFe{constructor(){super(...arguments),this.opacity=1,this.baseOpacity=1,this.texture=null,this.fboTexture=null,this.backgroundColor=el}},zFe=class UFe extends Hr{initializeProgram(e){return new $r(e.rctx,UFe.shader.get().build(this.configuration),Cr)}initializePipeline(){return Ti({blending:md(ot.ONE,ot.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}};zFe.shader=new Ir(W4t,()=>we(()=>Promise.resolve().then(()=>_Xt),void 0));let VFe=class extends Y${constructor(){super(...arguments),this.background=rx.BelowLayer}};y([fe()],VFe.prototype,"background",void 0);let RY=class{constructor(e,i,r,n,s,o){this.texture=e,this.type=i,e.retain(),this.offsetAndScale=Mi(r.offset[0],r.offset[1],r.scale,r.scale),this.opacities=st(n,s,o)}destroy(){this.texture.release()}};function Nb(t,e){return[t,e]}function n3(t,e,i){return t[0]=e,t[1]=i,t}function X4t(t,e,i,r,n){return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}const T0=new oE("0/0/0/0");let Z4t=class BFe{static create(e,i,r=null){const n=gp(e.spatialReference),s=i.origin||Nb(e.origin.x,e.origin.y),o=Nb(e.size[0]*i.resolution,e.size[1]*i.resolution),a=Nb(-1/0,-1/0),c=Nb(1/0,1/0),p=Nb(1/0,1/0);r!=null&&(n3(a,Math.max(0,Math.floor((r.xmin-s[0])/o[0])),Math.max(0,Math.floor((s[1]-r.ymax)/o[1]))),n3(c,Math.max(0,Math.floor((r.xmax-s[0])/o[0])),Math.max(0,Math.floor((s[1]-r.ymin)/o[1]))),n3(p,c[0]-a[0]+1,c[1]-a[1]+1));const{cols:_,rows:x}=i;let S,C,M,P;return!r&&_&&x&&(n3(a,_[0],x[0]),n3(c,_[1],x[1]),n3(p,_[1]-_[0]+1,x[1]-x[0]+1)),e.isWrappable?(S=Nb(Math.ceil(Math.round((n.valid[1]-n.valid[0])/i.resolution)/e.size[0]),p[1]),C=Nb(Math.floor((n.origin[0]-s[0])/o[0]),a[1]),M=Nb(S[0]+C[0]-1,c[1]),P=!0):(C=a,M=c,S=p,P=!1),new BFe(i.level,i.resolution,i.scale,s,a,c,p,o,C,M,S,P)}constructor(e,i,r,n,s,o,a,c,p,_,x,S){this.level=e,this.resolution=i,this.scale=r,this.origin=n,this.first=s,this.last=o,this.size=a,this.norm=c,this.worldStart=p,this.worldEnd=_,this.worldSize=x,this.wrap=S}normalizeCol(e){if(!this.wrap)return e;const i=this.worldSize[0];return e<0?i-1-Math.abs((e+1)%i):e%i}denormalizeCol(e,i){return this.wrap?this.worldSize[0]*i+e:e}getWorldForColumn(e){return this.wrap?Math.floor(e/this.worldSize[0]):0}getFirstColumnForWorld(e){return e*this.worldSize[0]+this.first[0]}getLastColumnForWorld(e){return e*this.worldSize[0]+this.first[0]+this.size[0]-1}getColumnForX(e){return(e-this.origin[0])/this.norm[0]}getXForColumn(e){return this.origin[0]+e*this.norm[0]}getRowForY(e){return(this.origin[1]-e)/this.norm[1]}getYForRow(e){return this.origin[1]-e*this.norm[1]}getTileBounds(e,i,r=!1){T0.set(i);const n=r?T0.col:this.denormalizeCol(T0.col,T0.world),s=T0.row;return X4t(e,this.getXForColumn(n),this.getYForRow(s+1),this.getXForColumn(n+1),this.getYForRow(s)),e}getTileCoords(e,i,r=!1){T0.set(i);const n=r?T0.col:this.denormalizeCol(T0.col,T0.world);return Array.isArray(e)?n3(e,this.getXForColumn(n),this.getYForRow(T0.row)):(e.x=this.getXForColumn(n),e.y=this.getYForRow(T0.row)),e}},qie=class{constructor(){this.spans=[]}acquire(e){this.lodInfo=e}release(){this.lodInfo=null,this.spans.length=0}forEach(e,i){const{spans:r,lodInfo:n}=this,{level:s}=n;if(r.length!==0)for(const{row:o,colFrom:a,colTo:c}of r)for(let p=a;p<=c;p++)e.call(i,s,o,n.normalizeCol(p),n.getWorldForColumn(p))}};qie.pool=new Ql(qie);let IY=class{constructor(e,i,r){this.row=e,this.colFrom=i,this.colTo=r}};const ho=new oE("0/0/0/0");let J4t=class jFe{static create(e,i){e[1]>i[1]&&([e,i]=[i,e]);const[r,n]=e,[s,o]=i,a=s-r,c=o-n,p=c!==0?a/c:0,_=(Math.ceil(n)-n)*p,x=(Math.floor(n)-n)*p;return new jFe(r,Math.floor(n),Math.ceil(o),p,a<0?_:x,a<0?x:_,a<0?s:r,a<0?r:s)}constructor(e,i,r,n,s,o,a,c){this.x=e,this.ymin=i,this.ymax=r,this.invM=n,this.leftAdjust=s,this.rightAdjust=o,this.leftBound=a,this.rightBound=c}incrRow(){this.x+=this.invM}getLeftCol(){return Math.max(this.x+this.leftAdjust,this.leftBound)}getRightCol(){return Math.min(this.x+this.rightAdjust,this.rightBound)}};const Od=[[0,0],[0,0],[0,0],[0,0]],K4t=1e-6;let gfi=class{constructor(e,i=null,r=e.lods[0].level,n=e.lods[e.lods.length-1].level){this.tileInfo=e,this.fullExtent=i,this.scales=[],this._infoByScale={},this._infoByLevel={};const s=e.lods.filter(a=>a.level>=r&&a.level<=n);this.minScale=s[0].scale,this.maxScale=s[s.length-1].scale;const o=this._lodInfos=s.map(a=>Z4t.create(e,a,i));s.forEach((a,c)=>{this._infoByLevel[a.level]=o[c],this._infoByScale[a.scale]=o[c],this.scales[c]=a.scale},this),this._wrap=e.isWrappable}get spatialReference(){return this.tileInfo.spatialReference}getLODInfoAt(e){return this._infoByLevel[typeof e=="number"?e:e.level]}getTileBounds(e,i,r=!1){ho.set(i);const n=this._infoByLevel[ho.level];return n?n.getTileBounds(e,ho,r):e}getTileCoords(e,i,r=!1){ho.set(i);const n=this._infoByLevel[ho.level];return n?n.getTileCoords(e,ho,r):e}getTileCoverage(e,i=192,r=!0,n="closest"){if(!r&&(e.scale>this.minScale||e.scale100)return null;let $=[];for(c=x;c=0;F--){const z=$[F];p=Math.min(p,z.getLeftCol()),_=Math.max(_,z.getRightCol())}if(p=Math.floor(p),_=Math.floor(_),c>=s.first[1]&&c<=s.last[1])if(a)if(s.size[0]s.last[0]||_=0;F--){const z=$[F];z.ymax>=c?z.incrRow():$.splice(F,1)}}return o}getTileParentId(e){ho.set(e);const i=this._infoByLevel[ho.level],r=this._lodInfos.indexOf(i)-1;return r<0?null:(this._getTileIdAtLOD(ho,this._lodInfos[r],ho),ho.id)}getTileResolution(e){const i=this._infoByLevel[typeof e=="object"?e.level:e];return i?i.resolution:-1}getTileScale(e){const i=this._infoByLevel[e.level];return i?i.scale:-1}intersects(e,i){ho.set(i);const r=this._infoByLevel[ho.level],n=e.lodInfo;if(n.resolution>r.resolution){this._getTileIdAtLOD(ho,n,ho);const o=n.denormalizeCol(ho.col,ho.world);for(const a of e.spans)if(a.row===ho.row&&a.colFrom<=o&&a.colTo>=o)return!0}if(n.resolution(P[0]=Math.min(P[0],$.row),P[1]=Math.max(P[1],$.row),P[2]=Math.min(P[2],$.colFrom),P[3]=Math.max(P[3],$.colTo),P),[1/0,-1/0,1/0,-1/0]),_=r.denormalizeCol(ho.col,ho.world),x=n.getColumnForX(r.getXForColumn(_)),S=n.getRowForY(r.getYForRow(ho.row)),C=n.getColumnForX(r.getXForColumn(_+1))-1,M=n.getRowForY(r.getYForRow(ho.row+1))-1;return!(x>p||Ca||Mo.row===ho.row&&o.colFrom<=s&&o.colTo>=s)}normalizeBounds(e,i,r){if(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],this._wrap){const n=gp(this.tileInfo.spatialReference),s=-r*(n.valid[1]-n.valid[0]);e[0]+=s,e[2]+=s}return e}getSmallestInfoForScale(e){const i=this.scales;if(this._infoByScale[e])return this._infoByScale[e];if(e>i[0])return this._infoByScale[i[0]];for(let r=1;ri[r]+K4t)return this._infoByScale[i[r-1]];return this._infoByScale[i[i.length-1]]}getClosestInfoForScale(e){const i=this.scales;return this._infoByScale[e]||(e=i.reduce((r,n)=>Math.abs(n-e)=0;r--)if(e0&&(this._map.clear(),this._observable.notify())}delete(e){const i=this._map.delete(e);return i&&this._observable.notify(),i}entries(){return wi(this._observable),this._map.entries()}forEach(e,i){wi(this._observable),this._map.forEach((r,n)=>e.call(i,r,n,this),i)}get(e){return wi(this._observable),this._map.get(e)}has(e){return wi(this._observable),this._map.has(e)}keys(){return wi(this._observable),this._map.keys()}set(e,i){return this._map.set(e,i),this._observable.notify(),this}values(){return wi(this._observable),this._map.values()}[Symbol.iterator](){return wi(this._observable),this._map[Symbol.iterator]()}get[Symbol.toStringTag](){return this._map[Symbol.toStringTag]}},Q4t=class{constructor(e,i){this.item=e,this.controller=i,this.promise=null}},GFe=class{constructor(e){this._schedule=null,this._task=null,this._deferreds=new $Y,this._controllers=new $Y,this._processingItems=new $Y,this._pausedSignal=TP(!1),this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new aU(e.peeker),this.process=e.process;const i=e.scheduler;e.priority&&i&&(this._task=i.registerTask(e.priority,this))}destroy(){this.clear(),this._schedule=en(this._schedule),this._task=en(this._task)}get updating(){var e;return!!((e=this._task)!=null&&e.updating)||this.running}get length(){return this._processingItems.size+this._queue.length}abort(e){const i=this._controllers.get(e);i&&i.abort()}clear(){this._queue.clear();const e=[];this._controllers.forEach(i=>e.push(i)),this._controllers.clear(),e.forEach(i=>i.abort()),this._processingItems.clear(),this._cancelNext()}forEach(e){this._deferreds.forEach((i,r)=>e(r))}get(e){const i=this._deferreds.get(e);return i?i.promise:void 0}isOngoing(e){return this._processingItems.has(e)}has(e){return this._deferreds.has(e)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(e,i){const r=this.get(e);if(r)return r;const n=new AbortController;let s=null;i&&(s=Zl(i,()=>n.abort()));const o=()=>{const _=this._processingItems.get(e);_&&_.controller.abort(),a(),p.reject(ur())},a=()=>{c.remove(),s!=null&&s.remove(),this._deferreds.delete(e),this._controllers.delete(e),this._queue.remove(e),this._processingItems.delete(e),this._scheduleNext()},c=C9(n.signal,o),p=ec();return this._deferreds.set(e,p),this._controllers.set(e,n),p.promise.then(a,a),this._queue.push(e),this._scheduleNext(),p.promise}last(){return this._queue.last()}peek(){return this._queue.peek()}popLast(){return this._queue.popLast()}reset(){const e=[];this._processingItems.forEach(i=>e.push(i)),this._processingItems.clear();for(const i of e)this._queue.push(i.item),i.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get running(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size0&&this._processingItems.size{this._schedule=null,this._next()}))}_next(){for(;this._queue.length>0&&this._processingItems.sizethis._processResult(n,s),s=>this._processError(n,s))):this._processResult(n,i)}get test(){return{update:e=>this.runTask(e)}}};function e$t(t,e){return t.length=0,e.forEach(i=>t.push(i)),t}const LY=new Set,S8=[],VC=new Map,k_e=[0,0];let s3=class extends ze{constructor(e){super(e),this._keyToItem=new Map,this.concurrency=6,this.strategy="scale-first",this.tileInfoView=null}initialize(){const{concurrency:e,process:i,strategy:r}=this;this._queue=new GFe({concurrency:e,process:(n,s)=>{const o=this._keyToItem.get(n);return i(o,{signal:s})},peeker:r==="scale-first"?n=>this._peekByScaleFirst(n):n=>this._peekByCenterFirst(n)})}destroy(){this.clear(),this._queue=et(this._queue)}get length(){return this._queue?this._queue.length:0}get onGoingCount(){return this._keyToItem.size}abort(e){const i=typeof e=="string"?e:e.id;this._queue.abort(i)}clear(){this._queue.clear(),this._keyToItem.clear()}has(e){return typeof e=="string"?this._keyToItem.has(e):this._keyToItem.has(e.id)}isOngoing(e){const i=typeof e=="string"?e:e.id;return this.has(i)&&this._queue.isOngoing(i)}pause(){this._queue.pause()}push(e){const i=e.key.id;if(this._queue.has(i))return this._queue.get(i);const r=this._queue.push(i),n=()=>{this._keyToItem.delete(i)};return this._keyToItem.set(i,e),r.then(n,n),r}reset(){this._queue.reset()}resume(){this._queue.resume()}_peekByScaleFirst(e){if(!this.state)return e.values().next().value;const i=this.tileInfoView;let r=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY;e.forEach(_=>{const x=this._keyToItem.get(_),S=this.tileInfoView.getTileScale(x.key);VC.has(S)||(VC.set(S,[]),r=Math.max(S,r),n=Math.min(S,n)),VC.get(S).push(x.key),LY.add(S)});let s=this.state.scale;VC.has(s)||(e$t(S8,LY),S8.sort((_,x)=>_-x),s=S8.reduce((_,x)=>Math.abs(x-s){const S=a.denormalizeCol(_.col,_.world),C=a.denormalizeCol(x.col,x.world);return Math.sqrt((c-S)*(c-S)+(p-_.row)*(p-_.row))-Math.sqrt((c-C)*(c-C)+(p-x.row)*(p-x.row))}),LY.clear(),VC.clear(),o[0].id}_peekByCenterFirst(e){if(!this.state)return e.values().next().value;const i=this.tileInfoView,r=this.state.center;let n,s=Number.POSITIVE_INFINITY;return e.forEach(o=>{const a=this._keyToItem.get(o);i.getTileCoords(k_e,a.key);const c=km(k_e,r);c=2}function S$t(t){return Array.isArray(t)&&t.length>=2}function T8(t){return x$t(t)||S$t(t)}const E8={102100:{maxX:20037508342788905e-9,minX:-20037508342788905e-9,plus180Line:new Tc({paths:[[[20037508342788905e-9,-20037508342788905e-9],[20037508342788905e-9,20037508342788905e-9]]],spatialReference:rt.WebMercator}),minus180Line:new Tc({paths:[[[-20037508342788905e-9,-20037508342788905e-9],[-20037508342788905e-9,20037508342788905e-9]]],spatialReference:rt.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new Tc({paths:[[[180,-180],[180,180]]],spatialReference:rt.WGS84}),minus180Line:new Tc({paths:[[[-180,-180],[-180,180]]],spatialReference:rt.WGS84})}};function cT(t,e){return Math.ceil((t-e)/(2*e))}function YFe(t,e){const i=X$(t);for(const r of i)for(const n of r)n[0]+=e;return t}function X$(t){return gT(t)?t.rings:t.paths}async function T$t(t,e,i,r){const n=F5(t),s=e[0].spatialReference,o={...r,responseType:"json",query:{...n.query,f:"json",sr:YO(s),target:JSON.stringify({geometryType:c5(e[0]),geometries:e}),cutter:JSON.stringify(i)}},a=await yi(n.path+"/cut",o),{cutIndexes:c,geometries:p=[]}=a.data;return{cutIndexes:c,geometries:p.map(_=>{const x=Wy(_);return x.spatialReference=s,x})}}async function E$t(t,e,i){const r=typeof t=="string"?Is(t):t,n=e[0].spatialReference,s=c5(e[0]),o={...i,query:{...r.query,f:"json",sr:YO(n),geometries:JSON.stringify(eRt(e))}},{data:a}=await yi(r.path+"/simplify",o);return G7e(a.geometries,s,n)}const XFe=Ce.getLogger("esri.geometry.support.normalizeUtils");function C$t(t){return t.type==="polygon"}function A$t(t){return t[0].type==="polygon"}function M$t(t){return t[0].type==="polyline"}function O$t(t,e){if(!(t instanceof Tc||t instanceof tl)){const n="straightLineDensify: the input geometry is neither polyline nor polygon";throw XFe.error(n),new se(n)}const i=X$(t),r=[];for(const n of i){const s=[];r.push(s),s.push([n[0][0],n[0][1]]);for(let o=0;o1){for(let z=1;z<=M-1;z++){const k=z*e,U=C*k+a,j=S*k+c;s.push([U,j])}const P=(x+Math.floor(M-1)*e)/2,$=C*P+a,F=S*P+c;s.push([$,F])}s.push([p,_])}}return C$t(t)?new tl({rings:r,spatialReference:t.spatialReference}):new Tc({paths:r,spatialReference:t.spatialReference})}function z_e(t,e,i){if(e){const r=O$t(t,1e6);t=XS(r,!0)}return i&&(t=YFe(t,i)),t}function U_e(t,e,i){if(Array.isArray(t)){const r=t[0];if(r>e){const n=cT(r,e);t[0]=r+n*(-2*e)}else if(re){const n=cT(r,e);t=t.clone().offset(n*(-2*e),0)}else if(r{if(p[0]<180)return!0;{let _=0;for(let S=0;S_?C:_}_=Number(_.toFixed(9));const x=-360*cT(_,180);for(let S=0;SU_e(G,a,c)),M.push(j)}else if(U.type==="extent"){const j=U.clone()._normalize(!1,!1,s);M.push(j.rings?new tl(j):j)}else if(U.extent){const j=U.extent,G=cT(j.xmin,c)*(2*a);let Y=G===0?U.clone():YFe(U.clone(),G);j.offset(G,0),j.intersects(_)&&j.xmax!==a?(S=j.xmax>S?j.xmax:S,Y=z_e(Y,o),C.push(Y),M.push("cut")):j.intersects(x)&&j.xmin!==c?(S=j.xmax*(2*a)>S?j.xmax*(2*a):S,Y=z_e(Y,o,360),C.push(Y),M.push("cut")):M.push(Y)}else M.push(U.clone());else M.push(U);else M.push(U);let P=cT(S,a),$=-90;const F=P,z=new Tc;for(;P>0;){const U=360*P-180;z.addPath([[U,$],[U,-1*$]]),$*=-1,P--}if(C.length>0&&F>0){const U=P$t(C,await T$t(r,C,z,i)),j=[],G=[];for(let ne=0;ne1&&he.rings.length>=ce.rings.length?(j.push(he),G.push("simplify")):G.push(o?Py(he):he)}}if(!j.length)return G;const Y=await E$t(r,j,i),Q=[];for(let ne=0;nes?a=Math.ceil(Math.abs(e-s)/o):es?c=Math.ceil(Math.abs(t-s)/o):ts?p-=o:_s.xmax)&&(Vc[0]=R$t(r,n[0],o)),mw(t,Vc,a)}getScreenTransform(t,e){const{center:i}=this._viewpoint2D,r=this._get("pixelRatio")||1,n=this._get("size");return Yce(t,i,n,e,0,r),t}_update(){const{center:t,spatialReference:e,scale:i,rotation:r}=this._viewpoint2D,n=this._get("pixelRatio")||1,s=this._get("size"),o=new nh({targetGeometry:new mt(t[0],t[1],e),scale:i,rotation:r});if(this._set("viewpoint",o),!s||!e||!i)return;this.resolution=zG(o),this.rotation=r,this.scale=i,this.spatialReference=e,ea(this.center,t);const a=s[0]!==0?2/s[0]:0,c=s[1]!==0?-2/s[1]:0;Loe(this.displayMat3,a,0,0,0,c,0,-1,1,1);const p=Doe(this.viewMat3),_=Sf(s[0]/2,s[1]/2),x=Sf(-s[0]/2,-s[1]/2),S=fB(r);Kz(p,p,_),Noe(p,p,S),Kz(p,p,x),fP(this.displayViewMat3,this.displayMat3,p);const C=qce(this.viewMat2d,_);return FG(C,C,S),kG(C,C,x),N$t(this.extent,o,s),z$t(this.transform,o,s,n),HFe(this.inverseTransform,this.transform),U$t(this.transformNoRotation,o,s,n),this.worldScreenWidth=B$t(this.spatialReference,this.resolution),this._set("id",this.id+1),this}};y([w({readOnly:!0})],vw.prototype,"id",void 0),y([w({value:1,json:{write:!0}})],vw.prototype,"pixelRatio",null),y([w({json:{write:!0}})],vw.prototype,"size",null),y([w()],vw.prototype,"spatialReference",void 0),y([w({type:nh,json:{write:!0}})],vw.prototype,"viewpoint",null),vw=Wie=y([Z("esri.views.2d.ViewState")],vw);const j$t=vw;var Yie,Xie,V_e,B_e,j_e,G_e,H_e,q_e,W_e,Y_e,X_e,Z_e,J_e,K_e,Q_e,ebe,tbe,ibe,rbe,nbe,sbe,obe,abe,lbe,cbe,ube,hbe,dbe,pbe,fbe,mbe,gbe,ybe,vbe,_be,bbe,wbe,xbe,Sbe,Tbe,Ebe,Cbe,Abe,Mbe,Obe,Pbe,Rbe,Ibe,$be,Lbe,Dbe,Nbe,Fbe,kbe,zbe,Ube,Vbe,Bbe,jbe,Gbe,Hbe;(function(t){t[t.BUTT=0]="BUTT",t[t.ROUND=1]="ROUND",t[t.SQUARE=2]="SQUARE",t[t.UNKNOWN=4]="UNKNOWN"})(Yie||(Yie={})),function(t){t[t.BEVEL=0]="BEVEL",t[t.ROUND=1]="ROUND",t[t.MITER=2]="MITER",t[t.UNKNOWN=4]="UNKNOWN"}(Xie||(Xie={})),function(t){t[t.SCREEN=0]="SCREEN",t[t.MAP=1]="MAP"}(V_e||(V_e={})),function(t){t[t.Tint=0]="Tint",t[t.Ignore=1]="Ignore",t[t.Multiply=99]="Multiply"}(B_e||(B_e={})),function(t){t.Both="Both",t.JustBegin="JustBegin",t.JustEnd="JustEnd",t.None="None"}(j_e||(j_e={})),function(t){t[t.Mosaic=0]="Mosaic",t[t.Centered=1]="Centered"}(G_e||(G_e={})),function(t){t[t.Normal=0]="Normal",t[t.Superscript=1]="Superscript",t[t.Subscript=2]="Subscript"}(H_e||(H_e={})),function(t){t[t.MSSymbol=0]="MSSymbol",t[t.Unicode=1]="Unicode"}(q_e||(q_e={})),function(t){t[t.Unspecified=0]="Unspecified",t[t.TrueType=1]="TrueType",t[t.PSOpenType=2]="PSOpenType",t[t.TTOpenType=3]="TTOpenType",t[t.Type1=4]="Type1"}(W_e||(W_e={})),function(t){t[t.Display=0]="Display",t[t.Map=1]="Map"}(Y_e||(Y_e={})),function(t){t.None="None",t.Loop="Loop",t.Oscillate="Oscillate"}(X_e||(X_e={})),function(t){t[t.Z=0]="Z",t[t.X=1]="X",t[t.Y=2]="Y"}(Z_e||(Z_e={})),function(t){t[t.XYZ=0]="XYZ",t[t.ZXY=1]="ZXY",t[t.YXZ=2]="YXZ"}(J_e||(J_e={})),function(t){t[t.Rectangle=0]="Rectangle",t[t.RoundedRectangle=1]="RoundedRectangle",t[t.Oval=2]="Oval"}(K_e||(K_e={})),function(t){t[t.None=0]="None",t[t.Alpha=1]="Alpha",t[t.Screen=2]="Screen",t[t.Multiply=3]="Multiply",t[t.Add=4]="Add"}(Q_e||(Q_e={})),function(t){t[t.TTB=0]="TTB",t[t.RTL=1]="RTL",t[t.BTT=2]="BTT"}(ebe||(ebe={})),function(t){t[t.None=0]="None",t[t.SignPost=1]="SignPost",t[t.FaceNearPlane=2]="FaceNearPlane"}(tbe||(tbe={})),function(t){t[t.Float=0]="Float",t[t.String=1]="String",t[t.Boolean=2]="Boolean"}(ibe||(ibe={})),function(t){t[t.Intersect=0]="Intersect",t[t.Subtract=1]="Subtract"}(rbe||(rbe={})),function(t){t.OpenEnded="OpenEnded",t.Block="Block",t.Crossed="Crossed"}(nbe||(nbe={})),function(t){t.FullGeometry="FullGeometry",t.PerpendicularFromFirstSegment="PerpendicularFromFirstSegment",t.ReversedFirstSegment="ReversedFirstSegment",t.PerpendicularToSecondSegment="PerpendicularToSecondSegment",t.SecondSegmentWithTicks="SecondSegmentWithTicks",t.DoublePerpendicular="DoublePerpendicular",t.OppositeToFirstSegment="OppositeToFirstSegment",t.TriplePerpendicular="TriplePerpendicular",t.HalfCircleFirstSegment="HalfCircleFirstSegment",t.HalfCircleSecondSegment="HalfCircleSecondSegment",t.HalfCircleExtended="HalfCircleExtended",t.OpenCircle="OpenCircle",t.CoverageEdgesWithTicks="CoverageEdgesWithTicks",t.GapExtentWithDoubleTicks="GapExtentWithDoubleTicks",t.GapExtentMidline="GapExtentMidline",t.Chevron="Chevron",t.PerpendicularWithArc="PerpendicularWithArc",t.ClosedHalfCircle="ClosedHalfCircle",t.TripleParallelExtended="TripleParallelExtended",t.ParallelWithTicks="ParallelWithTicks",t.Parallel="Parallel",t.PerpendicularToFirstSegment="PerpendicularToFirstSegment",t.ParallelOffset="ParallelOffset",t.OffsetOpposite="OffsetOpposite",t.OffsetSame="OffsetSame",t.CircleWithArc="CircleWithArc",t.DoubleJog="DoubleJog",t.PerpendicularOffset="PerpendicularOffset",t.LineExcludingLastSegment="LineExcludingLastSegment",t.MultivertexArrow="MultivertexArrow",t.CrossedArrow="CrossedArrow",t.ChevronArrow="ChevronArrow",t.ChevronArrowOffset="ChevronArrowOffset",t.PartialFirstSegment="PartialFirstSegment",t.Arch="Arch",t.CurvedParallelTicks="CurvedParallelTicks",t.Arc90Degrees="Arc90Degrees"}(sbe||(sbe={})),function(t){t.Mitered="Mitered",t.Bevelled="Bevelled",t.Rounded="Rounded",t.Square="Square",t.TrueBuffer="TrueBuffer"}(obe||(obe={})),function(t){t.ClosePath="ClosePath",t.ConvexHull="ConvexHull",t.RectangularBox="RectangularBox"}(abe||(abe={})),function(t){t.BeginningOfLine="BeginningOfLine",t.EndOfLine="EndOfLine"}(lbe||(lbe={})),function(t){t.Mitered="Mitered",t.Bevelled="Bevelled",t.Rounded="Rounded",t.Square="Square"}(cbe||(cbe={})),function(t){t.Fast="Fast",t.Accurate="Accurate"}(ube||(ube={})),function(t){t.BeginningOfLine="BeginningOfLine",t.EndOfLine="EndOfLine"}(hbe||(hbe={})),function(t){t.Sinus="Sinus",t.Square="Square",t.Triangle="Triangle",t.Random="Random"}(dbe||(dbe={})),function(t){t[t.None=0]="None",t[t.Default=1]="Default",t[t.Force=2]="Force"}(pbe||(pbe={})),function(t){t[t.Buffered=0]="Buffered",t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.AlongLine=3]="AlongLine"}(fbe||(fbe={})),function(t){t[t.Linear=0]="Linear",t[t.Rectangular=1]="Rectangular",t[t.Circular=2]="Circular",t[t.Buffered=3]="Buffered"}(mbe||(mbe={})),function(t){t[t.Discrete=0]="Discrete",t[t.Continuous=1]="Continuous"}(gbe||(gbe={})),function(t){t[t.AcrossLine=0]="AcrossLine",t[t.AloneLine=1]="AloneLine"}(ybe||(ybe={})),function(t){t[t.Left=0]="Left",t[t.Right=1]="Right",t[t.Center=2]="Center",t[t.Justify=3]="Justify"}(vbe||(vbe={})),function(t){t[t.Base=0]="Base",t[t.MidPoint=1]="MidPoint",t[t.ThreePoint=2]="ThreePoint",t[t.FourPoint=3]="FourPoint",t[t.Underline=4]="Underline",t[t.CircularCW=5]="CircularCW",t[t.CircularCCW=6]="CircularCCW"}(_be||(_be={})),function(t){t.Butt="Butt",t.Round="Round",t.Square="Square"}(bbe||(bbe={})),function(t){t.NoConstraint="NoConstraint",t.HalfPattern="HalfPattern",t.HalfGap="HalfGap",t.FullPattern="FullPattern",t.FullGap="FullGap",t.Custom="Custom"}(wbe||(wbe={})),function(t){t[t.None=-1]="None",t[t.Custom=0]="Custom",t[t.Circle=1]="Circle",t[t.OpenArrow=2]="OpenArrow",t[t.ClosedArrow=3]="ClosedArrow",t[t.Diamond=4]="Diamond"}(xbe||(xbe={})),function(t){t[t.ExtraLeading=0]="ExtraLeading",t[t.Multiple=1]="Multiple",t[t.Exact=2]="Exact"}(Sbe||(Sbe={})),function(t){t.Bevel="Bevel",t.Round="Round",t.Miter="Miter"}(Tbe||(Tbe={})),function(t){t[t.Default=0]="Default",t[t.String=1]="String",t[t.Numeric=2]="Numeric"}(Ebe||(Ebe={})),function(t){t[t.InsidePolygon=0]="InsidePolygon",t[t.PolygonCenter=1]="PolygonCenter",t[t.RandomlyInsidePolygon=2]="RandomlyInsidePolygon"}(Cbe||(Cbe={})),function(t){t[t.Tint=0]="Tint",t[t.Replace=1]="Replace",t[t.Multiply=2]="Multiply"}(Abe||(Abe={})),function(t){t[t.ClipAtBoundary=0]="ClipAtBoundary",t[t.RemoveIfCenterOutsideBoundary=1]="RemoveIfCenterOutsideBoundary",t[t.DoNotTouchBoundary=2]="DoNotTouchBoundary",t[t.DoNotClip=3]="DoNotClip"}(Mbe||(Mbe={})),function(t){t.NoConstraint="NoConstraint",t.WithMarkers="WithMarkers",t.WithFullGap="WithFullGap",t.WithHalfGap="WithHalfGap",t.Custom="Custom"}(Obe||(Obe={})),function(t){t.Fixed="Fixed",t.Random="Random",t.RandomFixedQuantity="RandomFixedQuantity"}(Pbe||(Pbe={})),function(t){t.LineMiddle="LineMiddle",t.LineBeginning="LineBeginning",t.LineEnd="LineEnd",t.SegmentMidpoint="SegmentMidpoint"}(Rbe||(Rbe={})),function(t){t.OnPolygon="OnPolygon",t.CenterOfMass="CenterOfMass",t.BoundingBoxCenter="BoundingBoxCenter"}(Ibe||(Ibe={})),function(t){t[t.Low=0]="Low",t[t.Medium=1]="Medium",t[t.High=2]="High"}($be||($be={})),function(t){t[t.MarkerCenter=0]="MarkerCenter",t[t.MarkerBounds=1]="MarkerBounds"}(Lbe||(Lbe={})),function(t){t[t.None=0]="None",t[t.PropUniform=1]="PropUniform",t[t.PropNonuniform=2]="PropNonuniform",t[t.DifUniform=3]="DifUniform",t[t.DifNonuniform=4]="DifNonuniform"}(Dbe||(Dbe={})),function(t){t.Tube="Tube",t.Strip="Strip",t.Wall="Wall"}(Nbe||(Nbe={})),function(t){t[t.Random=0]="Random",t[t.Increasing=1]="Increasing",t[t.Decreasing=2]="Decreasing",t[t.IncreasingThenDecreasing=3]="IncreasingThenDecreasing"}(Fbe||(Fbe={})),function(t){t[t.Relative=0]="Relative",t[t.Absolute=1]="Absolute"}(kbe||(kbe={})),function(t){t[t.Normal=0]="Normal",t[t.LowerCase=1]="LowerCase",t[t.Allcaps=2]="Allcaps"}(zbe||(zbe={})),function(t){t[t.LTR=0]="LTR",t[t.RTL=1]="RTL"}(Ube||(Ube={})),function(t){t.Draft="Draft",t.Picture="Picture",t.Text="Text"}(Vbe||(Vbe={})),function(t){t[t.Top=0]="Top",t[t.Center=1]="Center",t[t.Baseline=2]="Baseline",t[t.Bottom=3]="Bottom"}(Bbe||(Bbe={})),function(t){t[t.Right=0]="Right",t[t.Upright=1]="Upright"}(jbe||(jbe={})),function(t){t[t.Small=0]="Small",t[t.Medium=1]="Medium",t[t.Large=2]="Large"}(Gbe||(Gbe={})),function(t){t[t.Calm=0]="Calm",t[t.Rippled=1]="Rippled",t[t.Slight=2]="Slight",t[t.Moderate=3]="Moderate"}(Hbe||(Hbe={}));var Zie,jS,Jie,dV,Kie,pV,Qie,GS,ere;(function(t){t[t.BACKGROUND=0]="BACKGROUND",t[t.FILL=1]="FILL",t[t.LINE=2]="LINE",t[t.SYMBOL=3]="SYMBOL",t[t.CIRCLE=4]="CIRCLE"})(Zie||(Zie={})),function(t){t[t.VISIBLE=0]="VISIBLE",t[t.NONE=1]="NONE"}(jS||(jS={})),function(t){t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.LINE_CENTER=2]="LINE_CENTER"}(Jie||(Jie={})),function(t){t[t.MAP=0]="MAP",t[t.VIEWPORT=1]="VIEWPORT",t[t.AUTO=2]="AUTO"}(dV||(dV={})),function(t){t[t.AUTO=0]="AUTO",t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT"}(Kie||(Kie={})),function(t){t[t.CENTER=0]="CENTER",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.TOP=3]="TOP",t[t.BOTTOM=4]="BOTTOM",t[t.TOP_LEFT=5]="TOP_LEFT",t[t.TOP_RIGHT=6]="TOP_RIGHT",t[t.BOTTOM_LEFT=7]="BOTTOM_LEFT",t[t.BOTTOM_RIGHT=8]="BOTTOM_RIGHT"}(pV||(pV={})),function(t){t[t.NONE=0]="NONE",t[t.UPPERCASE=1]="UPPERCASE",t[t.LOWERCASE=2]="LOWERCASE"}(Qie||(Qie={})),function(t){t[t.MAP=0]="MAP",t[t.VIEWPORT=1]="VIEWPORT"}(GS||(GS={})),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(ere||(ere={}));let E0=class{};E0.backgroundLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:jS.VISIBLE}},E0.fillLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:jS.VISIBLE}},E0.lineLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:jS.VISIBLE},"line-cap":{type:"enum",values:["butt","round","square"],default:Yie.BUTT},"line-join":{type:"enum",values:["bevel","round","miter"],default:Xie.MITER},"line-miter-limit":{type:"number",default:2},"line-round-limit":{type:"number",default:1.05}},E0.symbolLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:jS.VISIBLE},"symbol-avoid-edges":{type:"boolean",default:!1},"symbol-placement":{type:"enum",values:["point","line","line-center"],default:Jie.POINT},"symbol-sort-key":{type:"number",default:-1},"symbol-spacing":{type:"number",minimum:1,default:250},"icon-allow-overlap":{type:"boolean",default:!1},"icon-anchor":{type:"enum",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],default:pV.CENTER},"icon-ignore-placement":{type:"boolean",default:!1},"icon-image":{type:"string"},"icon-keep-upright":{type:"boolean",default:!1},"icon-offset":{type:"array",value:"number",length:2,default:[0,0]},"icon-optional":{type:"boolean",default:!1},"icon-padding":{type:"number",minimum:0,default:2},"icon-rotate":{type:"number",default:0},"icon-rotation-alignment":{type:"enum",values:["map","viewport","auto"],default:dV.AUTO},"icon-size":{type:"number",minimum:0,default:1},"text-allow-overlap":{type:"boolean",default:!1},"text-anchor":{type:"enum",values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],default:pV.CENTER},"text-field":{type:"string"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"]},"text-ignore-placement":{type:"boolean",default:!1},"text-justify":{type:"enum",values:["auto","left","center","right"],default:Kie.CENTER},"text-keep-upright":{type:"boolean",default:!0},"text-letter-spacing":{type:"number",default:0},"text-line-height":{type:"number",default:1.2},"text-max-angle":{type:"number",minimum:0,default:45},"text-max-width":{type:"number",minimum:0,default:10},"text-offset":{type:"array",value:"number",length:2,default:[0,0]},"text-optional":{type:"boolean",default:!1},"text-padding":{type:"number",minimum:0,default:2},"text-rotate":{type:"number",default:0},"text-rotation-alignment":{type:"enum",values:["map","viewport","auto"],default:dV.AUTO},"text-size":{type:"number",minimum:0,default:16},"text-transform":{type:"enum",values:["none","uppercase","lowercase"],default:Qie.NONE},"text-writing-mode":{type:"array",value:"enum",values:["horizontal","vertical"],default:[ere.HORIZONTAL]}},E0.circleLayoutDefinition={visibility:{type:"enum",values:["visible","none"],default:jS.VISIBLE}},E0.backgroundPaintDefinition={"background-color":{type:"color",default:[0,0,0,1]},"background-opacity":{type:"number",minimum:0,maximum:1,default:1},"background-pattern":{type:"string"}},E0.fillPaintDefinition={"fill-antialias":{type:"boolean",default:!0},"fill-color":{type:"color",default:[0,0,0,1]},"fill-opacity":{type:"number",minimum:0,maximum:1,default:1},"fill-outline-color":{type:"color",default:[0,0,0,0]},"fill-pattern":{type:"string"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0]},"fill-translate-anchor":{type:"enum",values:["map","viewport"],default:GS.MAP}},E0.linePaintDefinition={"line-blur":{type:"number",minimum:0,default:0},"line-color":{type:"color",default:[0,0,0,1]},"line-dasharray":{type:"array",value:"number",default:[]},"line-gap-width":{type:"number",minimum:0,default:0},"line-offset":{type:"number",default:0},"line-opacity":{type:"number",minimum:0,maximum:1,default:1},"line-pattern":{type:"string"},"line-translate":{type:"array",value:"number",length:2,default:[0,0]},"line-translate-anchor":{type:"enum",values:["map","viewport"],default:GS.MAP},"line-width":{type:"number",minimum:0,default:1}},E0.symbolPaintDefinition={"icon-color":{type:"color",default:[0,0,0,1]},"icon-halo-blur":{type:"number",minimum:0,default:0},"icon-halo-color":{type:"color",default:[0,0,0,0]},"icon-halo-width":{type:"number",minimum:0,default:0},"icon-opacity":{type:"number",minimum:0,maximum:1,default:1},"icon-translate":{type:"array",value:"number",length:2,default:[0,0]},"icon-translate-anchor":{type:"enum",values:["map","viewport"],default:GS.MAP},"text-color":{type:"color",default:[0,0,0,1]},"text-halo-blur":{type:"number",minimum:0,default:0},"text-halo-color":{type:"color",default:[0,0,0,0]},"text-halo-width":{type:"number",minimum:0,default:0},"text-opacity":{type:"number",minimum:0,maximum:1,default:1},"text-translate":{type:"array",value:"number",length:2,default:[0,0]},"text-translate-anchor":{type:"enum",values:["map","viewport"],default:GS.MAP}},E0.rasterPaintDefinition={"raster-opacity":{type:"number",minimum:0,maximum:1,default:1},"raster-hue-rotate":{type:"number",default:0},"raster-brightness-min":{type:"number",minimum:0,maximum:1,default:0},"raster-brightness-max":{type:"number",minimum:0,maximum:1,default:1},"raster-saturation":{type:"number",minimum:-1,maximum:1,default:0},"raster-contrast":{type:"number",minimum:-1,maximum:1,default:0},"raster-fade-duration":{type:"number",minimum:0,default:300}},E0.circlePaintDefinition={"circle-blur":{type:"number",minimum:0,default:0},"circle-color":{type:"color",default:[0,0,0,1]},"circle-opacity":{type:"number",minimum:0,maximum:1,default:1},"circle-radius":{type:"number",minimum:0,default:5},"circle-stroke-color":{type:"color",default:[0,0,0,1]},"circle-stroke-opacity":{type:"number",minimum:0,maximum:1,default:1},"circle-stroke-width":{type:"number",minimum:0,default:0},"circle-translate":{type:"array",value:"number",length:2,default:[0,0]},"circle-translate-anchor":{type:"enum",values:["map","viewport"],default:GS.MAP}};let G$t=class extends eFe{_createTransforms(){return{dvs:Mc(),tileMat3:Mc()}}};const H$t=.125;let q$t=class{constructor(){this._renderParams={context:null,drawPhase:1,state:new j$t({viewpoint:new nh({targetGeometry:new mt(0,0),scale:1,rotation:0}),size:[256,256]}),stationary:!0,pixelRatio:1,displayLevel:-1,requiredLevel:-1,globalOpacity:1,renderPass:"background",styleLayer:null,styleLayerUID:-1,painter:null,glyphMosaic:null,spriteMosaic:null,profiler:null,renderingOptions:null,requestRender:null,allowDelayedRender:!1,deltaTime:-1,timeline:null,time:0,hasClipping:!1,blendMode:null,dataUploadCounter:0,effects:null,inFadeTransition:!1,requireFBO:!1,highlightGradient:null,stencilSymbols:!0,is3D:!0,backgroundColor:null},this._backgroundTile=new G$t(new oE(0,0,0,0),0,0,0,512,512,4096,4096)}dispose(){this._renderParams=null}renderBackground(e,i,r,n,s,o,a,c,p,_){const x=this._backgroundTile;this._updateRenderParams(e,i,x,r,s,o,a,c,p,_),this._renderParams.stencilSymbols=!1,r.drawBackground(this._renderParams,x,n)}renderContent(e,i,r,n,s,o,a,c,p,_,x,S){this._stencilSymbols(e,i,r,n,s,o,a,Math.round(1/c),p,_,x,S);let C=1;r.stencilRef=C++,e.setStencilFunction(Zr.EQUAL,r.stencilRef,255),this._render(e,i,r,s,o,a,c,p,_,x,S),n.forAll(M=>{M.sourceLayerInfo.data.stencilRef=C++,this._renderSymbols(e,M.sourceLod,M.sourceLayerInfo.data,s,o,a,Math.round(1/c),M.offset,_,x,S)})}_stencilSymbols(e,i,r,n,s,o,a,c,p,_,x,S){let C=1;r.stencilRef=C++,e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1),e.setStencilTestEnabled(!0),e.setBlendingEnabled(!1),e.setColorMask(!1,!1,!1,!1),e.setStencilOp(ws.KEEP,ws.KEEP,ws.REPLACE),e.setStencilWriteMask(255),e.setStencilFunction(Zr.ALWAYS,r.stencilRef,255),this._stencilTileSymbols(e,i,r,s,o,a,c,p,_,x,S);for(const M of n.toArray()){const{sourceLod:P,offset:$,sourceLayerInfo:F}=M;F.data.stencilRef=C++,e.setStencilFunction(Zr.ALWAYS,F.data.stencilRef,255),this._stencilTileSymbols(e,P,F.data,s,o,a,c,$,_,x,S)}e.setStencilWriteMask(0),e.setBlendingEnabled(!0),e.setDepthTestEnabled(!0),e.setColorMask(!0,!0,!0,!0)}_renderSymbols(e,i,r,n,s,o,a,c,p,_,x){e.setStencilFunction(Zr.EQUAL,r.stencilRef,255),this._render(e,i,r,n,s,o,a,c,p,_,x,Zie.SYMBOL)}_render(e,i,r,n,s,o,a,c,p,_,x,S){this._updateRenderParams(e,i,r,n,o,a,c,p,_,x),this._renderParams.stencilSymbols=!1,n.drawTile(this._renderParams,r,s,S)}_stencilTileSymbols(e,i,r,n,s,o,a,c,p,_,x){this._updateRenderParams(e,i,r,n,o,a,c,p,_,x),this._renderParams.stencilSymbols=!0,r.triangleCount=0,n.drawSymbols(this._renderParams,r,s)}_updateRenderParams(e,i,r,n,s,o,a,c,p,_){"type"in r&&r.type==="vector-tile"&&!r.stage&&r.attachWithContext(e);const x=i[0]-s.getLevelShift(i[0]),S=this._renderParams;S.context=e,S.painter=n,S.glyphMosaic=n.glyphMosaic,S.spriteMosaic=n.spriteMosaic,S.pixelRatio=p*_,S.displayLevel=x,S.requiredLevel=x;const C=s.getScale(i[0]),[M,P]=s.getOffset(i,o*C),$=H$t*o*C/c,F=r.transforms.dvs;F[0]=$,F[4]=-$,F[6]=-1-M-a[0]*o*2,F[7]=1+P+(1-a[1])*o*2-2,S.state.size[0]=c/_,S.state.size[1]=c/_,S.state.pixelRatio=_}},JFe=class KFe extends Hr{initializeProgram(e){return new $r(e.rctx,KFe.shader.get().build(this.configuration),Cr)}initializePipeline(){return Ti({blending:md(ot.ONE,ot.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}};JFe.shader=new Ir(i4t,()=>we(()=>Promise.resolve().then(()=>bXt),void 0));let R4=class extends Y${constructor(){super(...arguments),this.colorizerType=PT.Stretch,this.stretchType=aE.Noop,this.applyColormap=!0,this.requireBilinearWithNN=!1}};y([fe({count:PT.COUNT})],R4.prototype,"colorizerType",void 0),y([fe({count:aE.COUNT})],R4.prototype,"stretchType",void 0),y([fe()],R4.prototype,"applyColormap",void 0),y([fe()],R4.prototype,"requireBilinearWithNN",void 0);let qbe=class{constructor(e){this._rctx=e,this._fbos=new Map}get(e){return this._getPool(e)}dispose(){this._fbos.forEach(e=>e.dispose()),this._fbos.clear()}_getPool(e){const i=this._fbos.get(e);if(i)return i;const r=new Zm(this._rctx,new rn(e),new jF(Xa.DEPTH24_STENCIL8,e));return this._fbos.set(e,r),r}};const W$t=Ce.getLogger("esri.views.3d.terrain");let Y$t=class{constructor(e,i){this._rctx=e,this._techniqueRepository=i,this._fbos=[],this._vectorTileHelper=new q$t,this._bindParameters=new Uj(null,null),this._blendLayersTechniqueConfig=new VFe,this._current=0,this._lastUsedIds=new Array,this._lastCreatedBufferId=0,this._onHoldIds=new Array,this._vaoQuad=v1(this._rctx,Z9)}dispose(){this._fbos.forEach(Kt),this._fbos=null,this._vtFBO=Kt(this._vtFBO),this._vaoQuad=Kt(this._vaoQuad),this._vectorTileHelper=Kt(this._vectorTileHelper),this._backgroundTechnique=ir(this._backgroundTechnique),this._applyOpacityTechnique=ir(this._applyOpacityTechnique),this._blendLayersTechnique=ir(this._blendLayersTechnique)}_getBlendLayersTechnique(e,i,r,n=um.Off,s=rx.BelowLayer){return this._blendLayersTechniqueConfig.output=i,this._blendLayersTechniqueConfig.blendMode=e,this._blendLayersTechniqueConfig.baseOpacityMode=r,this._blendLayersTechniqueConfig.premultipliedSource=n,this._blendLayersTechniqueConfig.background=s,this._blendLayersTechnique=this._techniqueRepository.releaseAndAcquire(zFe,this._blendLayersTechniqueConfig,this._blendLayersTechnique),this._blendLayersTechnique}drawBackground(e,i){const r=this._getBlendLayersTechnique(gt.Normal,i?Ko.ColorComposite:Ko.GridComposite,fp.NotRequired,um.Off,rx.Only),n=this._rctx.bindTechnique(r,e,this._bindParameters);this._render(n)}_render(e){this._rctx.bindVAO(this._vaoQuad),e.assertCompatibleVertexAttributeLocations(this._vaoQuad),this._rctx.drawArrays(sr.TRIANGLE_STRIP,0,s_(this._vaoQuad,"geometry"))}drawGroup(e,i,r,n,s,o=um.On){i===Ko.Composite&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(r).colorTexture),e.texture=this.currentFBO(r).colorTexture,this.closeGroup(r);const a=this._getBlendLayersTechnique(n,i,s,o),c=this._rctx.bindTechnique(a,e,this._bindParameters);this._render(c)}drawRasterData(e,i,r,n,s,o=um.Off){if(e.texture==null)return;e.fboTexture=i===Ko.GroupBackgroundComposite||n===gt.Normal&&s===fp.NotRequired&&o===um.Off?null:this.switch(r).colorTexture;const a=this._getBlendLayersTechnique(n,i,s,o),c=this._rctx.bindTechnique(a,e,this._bindParameters);this._render(c)}drawImageryTileData(e,i,r,n,s,o){const a=o.sourceLayerInfo.data;if(!a.source||(o.tile.surface.layerViewByIndex(o.layerIndex,Yi.MAP).ensureSymbolizerParameters(a),!a.bind(this._rctx)))return;e.fboTexture=n===gt.Normal&&s===fp.NotRequired?null:this.switch(r).colorTexture;const c=this._getRasterColorizerTechnique(a,i,n,s);a.opacity=e.opacity;const p=a.getUniforms();p.scale=o.scale,p.offset=o.offset,p.backgroundColor=e.backgroundColor,p.fboTexture=e.fboTexture,p.baseOpacity=e.baseOpacity;const _=this._rctx.bindTechnique(c,p,null);this._render(_)}_getRasterColorizerTechnique(e,i,r,n){const s=e.symbolizerParameters,o=["stretch","lut","hillshade"].indexOf(s.type);return this._rasterColorizerConfig==null&&(this._rasterColorizerConfig=new R4,this._rctx.gl.getExtension("WEBGL_color_buffer_float"),this._rctx.gl.getExtension("OES_texture_float")),this._rasterColorizerConfig.output=i,this._rasterColorizerConfig.blendMode=r,this._rasterColorizerConfig.baseOpacityMode=n,this._rasterColorizerConfig.colorizerType=o,this._rasterColorizerConfig.applyColormap=!!s.colormap,this._rasterColorizerConfig.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterColorizerConfig.stretchType=e.hasStretchTypeNone()?aE.Noop:aE.PerBand,this._rasterColorizerTechnique=this._techniqueRepository.releaseAndAcquire(JFe,this._rasterColorizerConfig,this._rasterColorizerTechnique),this._rasterColorizerTechnique}drawVectorData(e,i,r,n,s,o,a,c,p){const _=this._rctx,x=o.sourceLayerInfo.data,S=o.tile.surface.layerViewByIndex(o.layerIndex,Yi.MAP),C=s===fp.Required||e.opacity<1||n!==gt.Normal||i!==Ko.Composite,M=C?um.On:um.Off,P=this._getBlendLayersTechnique(n,i,s,M);_.setPipelineState(P.getPipeline());let $=null,F=null;C?(F=this.currentFBO(r),this._vtFBO==null&&(this._vtFBO=new qbe(this._rctx)),$=this._vtFBO.get(r),_.bindFramebuffer($),this._clearCurrentFBO()):p&&_.clearSafe($n.DEPTH_BUFFER_BIT);try{this._vectorTileHelper.renderBackground(_,o.sourceLod,S.painter,S.layer.styleRepository,S.schemaHelper,Math.round(1/o.scale),o.offset,c,a,S.contentZoom),x&&this._vectorTileHelper.renderContent(_,o.sourceLod,x,o.vtlNeighborInfos,S.painter,S.layer.styleRepository,S.schemaHelper,Math.round(1/o.scale),o.offset,c,a,S.contentZoom)}catch(z){W$t.warnOnce("A render call containing vector tiles did not resolve correctly.",z)}return $==null||(_.bindFramebuffer(F),e.texture=$.colorTexture,e.offset=e1,e.scale=1,this.drawRasterData(e,i,r,n,s,M),p)}copyFBOToTexture(e){const i=this._rctx,r=i.bindTexture(e.texture,Ai.TEXTURE_UNIT_FOR_UPDATES),n=e.descriptor;i.gl.copyTexImage2D(qs.TEXTURE_2D,0,n.pixelFormat,0,0,n.width,n.height,0),e.generateMipmap(),i.bindTexture(r,Ai.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clearSafe($n.COLOR_BUFFER_BIT|$n.DEPTH_BUFFER_BIT|$n.STENCIL_BUFFER_BIT)}_initFBO(e,i,r){this._rctx.bindFramebuffer(e),r&&(this._rctx.setViewport(0,0,i,i),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,i=0,r=!0){if(this._current=i,i>=this._fbos.length)for(let n=this._fbos.length;n<=i;n++)this._fbos.push(new qbe(this._rctx));this._initFBO(this._fbos[i].get(e),e,r)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){const i=this.currentFBO(e),r=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(r),i}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){const i=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(i),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}},X$t=class{constructor(){this.sourceLod=[0,0,0],this.offset=[0,0],this.scale=1,this.layerIndex=0,this.isVTLBackground=!1,this.vtlNeighborInfos=new Pi({allocator:e=>e||new Z$t})}},Z$t=class{constructor(){this.sourceLayerInfo=null,this.sourceLod=[0,0,0],this.offset=[-1,0]}},J$t=class{constructor(e,i,r,n,s,o){this.start=e,this.end=i,this.blendMode=r,this.opacity=n,this.output=s,this.baseOpacity=o}},K$t=class{constructor(e,i,r,n){this._rctx=e,this.tileSize=i,this._techniques=r,this._cache=n,this._passParameters=new Y4t,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._composition=new Y$t(this._rctx,this._techniques),this._ensureBackgroundTexture(this.tileSize)}dispose(){this._composition=Kt(this._composition),this._backgroundTexture=ir(this._backgroundTexture)}get backgroundIsGrid(){return this._backgroundColor==null}get backgroundColor(){return this._backgroundColor}updateTileTexture(e,i){if(!e.renderData)return;const r=e.surface,n=r.baseOpacity;let s=0,o=0,a=this.tileSize,c=!1,p=!1;const _=r.view.state.contentPixelRatio;let x=!1;fV.clear(),BC.length=0;const S=e.layerInfo[Yi.MAP];let C=0,M=null;for(;C0)&&(n=u_.Delayed);const s=e.renderData;s.textureReference==null&&(n=u_.Immediate),s.setTextureReference(new RY(r,ha.FADING,Wbe,e.surface.baseOpacity,0,1),n)}_useLayerTexture(e,i){const r=e.surface.layerViewByIndex(i,Yi.MAP),n=rF(r.layer),s=n?e.surface.baseOpacity:1,o=n?1:e.surface.baseOpacity,a=r.fullOpacity,c=DY(e,i,!1);return!!this._dataToTexture(c)&&(e.renderData.setTextureReference(new RY(c.sourceLayerInfo.data,ha.FADING,c,s,o,a)),!0)}_composeMapLayers(e,i,r,n,s,o,a,c,p){this._composition.ensureBuffer(s);const _=e.surface.baseOpacity;let x=!1,S=ki.LINEAR_MIPMAP_LINEAR,C=!1,M=0;for(let z=r;z>=0;z--){const k=e.surface.layerViewByIndex(z,Yi.MAP),U=jP(k),j=DY(e,z,U),G=k.layer.opacity;if(!j||G===0&&!p)continue;const Y=!rF(k.layer)&&!x;Y&&(x=!0);let Q=!1;c.forEach(ve=>{ve.start===z&&(ve.output=n?Ko.Composite:a&&Y?this.backgroundIsGrid?Ko.GridComposite:Ko.ColorComposite:Ko.Composite,ve.baseOpacity=Y?_:1,BC.push(ve),this._composition.openGroup(s),Q=!0)}),this._passParameters.baseOpacity=Y&&!Q&&_<1?_:1;const ne=this._passParameters.baseOpacity<1?fp.Required:fp.NotRequired,ie=M===0,he=Q?Ko.GroupBackgroundComposite:a&&ie?this.backgroundIsGrid?Ko.GridComposite:Ko.ColorComposite:Ko.Composite,ce=Gie[s9(k)?k.layer.blendMode:"normal"];for(this._passParameters.opacity=G,URt(j)?C=this._composition.drawVectorData(this._passParameters,he,s,ce,ne,j,o,this.tileSize,C):zRt(j)?(this._composition.drawImageryTileData(this._passParameters,he,s,ce,ne,j),this._hasNearestInterpolation(j)&&(S=ki.NEAREST)):this._dataToTexture(j)&&(this._passParameters.texture=j.sourceLayerInfo.data.texture,this._passParameters.offset=j.offset,this._passParameters.scale=j.scale,this._composition.drawRasterData(this._passParameters,he,s,ce,ne));BC.length>0&&BC[BC.length-1].end===z;){const ve=BC.pop();this._passParameters.baseOpacity=ve.baseOpacity;const ge=this._passParameters.baseOpacity<1?fp.Required:fp.NotRequired;this._passParameters.opacity=ve.opacity,this._passParameters.offset=e1,this._passParameters.scale=1,this._composition.drawGroup(this._passParameters,ve.output,s,Gie[ve.blendMode],ge)}M++}const P=e.renderData,$=p||x&&_<1,F=P.ensureTexture(s,$,()=>this._buildTexture(s,$,S));this._composition.copyFBOToTexture(F),this._composition.unbind(),P.setTextureReference(new RY(F,i,Wbe,x?1:_,0,1))}_hasNearestInterpolation(e){const i=e.sourceLayerInfo.data;return!!i.source&&i.interpolation==="nearest"}_dataToTexture(e){if(BRt(e)){const i=e.sourceLayerInfo;i.data=this._buildTexture(i.data,!0),e.tile.setMemoryDirty()}return VRt(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,i,r=ki.LINEAR_MIPMAP_LINEAR){if(e==null)return null;const n=new rn;n.wrapMode=Bi.CLAMP_TO_EDGE,n.samplingMode=r,n.maxAnisotropy=this._maxAnisotropy,n.preMultiplyAlpha=!0,n.flipped=!0,n.hasMipmap=!0,i||(n.pixelFormat=ci.RGB);const s=this._rctx;let o;if(typeof e=="number"){n.width=n.height=e;const c=`${e} ${n.pixelFormat}`;o=this._cache.pop(c),o?o.retain():o=new P4(new Ai(s,n),this._cache)}else if(bRt(e)){n.isOpaque=e.isOpaque,n.isOpaque&&(n.pixelFormat=ci.RGB);const c=`${e} ${n.pixelFormat}`;o=this._cache.pop(c),o?(o.retain(),o.texture.setData(e.image)):o=new P4(new Ai(s,n,e.image),this._cache),e.release()}else try{n.width=e.width,n.height=e.height,o=new P4(new Ai(s,n,e))}catch{o=new P4(o$e(s)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const a=s.bindTexture(o.texture,Ai.TEXTURE_UNIT_FOR_UPDATES);return o.generateMipmap(),s.bindTexture(a,Ai.TEXTURE_UNIT_FOR_UPDATES),o}get test(){return{backgroundTexture:this._backgroundTexture}}};function DY(t,e,i){oc.layerIndex=e,oc.vtlNeighborInfos.clear();const r=t.layerInfo[Yi.MAP][e];if(or(oc.offset,0,0),oc.tile=t,oc.scale=1,oc.sourceLod=t.lij,oc.sourceLayerInfo=r,oc.isVTLBackground=i,r.data)return i&&t.forEachLoadedNeighbor((s,o)=>{if(s.level!==t.level)return;const a=s.layerInfo[Yi.MAP][e];if(!W7e(a)||r.data===a.data)return;const c=oc.vtlNeighborInfos.pushNew();c.offset=dv[o],c.sourceLod=s.lij,c.sourceLayerInfo=a}),oc;const n=r.upsampleInfo;if(n){const s=n.tile.layerInfo[Yi.MAP][e];return oc.tile=n.tile,ea(oc.offset,n.offset),oc.scale=n.scale,oc.sourceLod=n.tile.lij,oc.sourceLayerInfo=s,oc}return i?oc:null}function tre(t){return t.uid}function QFe(t){let e=t.blendMode!=="normal";return lP(t.parent)&&(e=QFe(t.parent)||e),e}function eke(t,e){lP(t.parent)&&eke(t.parent,e);const i=tre(t);if(i!=null&&i!==""){const r=fV.get(i);r?r.start=e:fV.set(i,new J$t(e,e,t.blendMode,t.opacity,Ko.Composite,1))}}const fV=new Map,BC=new Array,oc=new X$t,Wbe={offset:[0,0],scale:1},dv=new Array;dv[ii.NORTH]=[0,-1],dv[ii.NORTH_EAST]=[-1,-1],dv[ii.EAST]=[-1,0],dv[ii.SOUTH_EAST]=[-1,1],dv[ii.SOUTH]=[0,1],dv[ii.SOUTH_WEST]=[1,1],dv[ii.WEST]=[1,0],dv[ii.NORTH_WEST]=[1,-1];const tke=200,NY=40,Q$t=.8,eLt=10,I4=1e-6;function tLt(t,e,i){const r=e,n=i;let s=0,o=1/0;for(let a=0;a<3;++a){{const c=t[a];if(r[a]o)return!1}{const c=t[a+3];if(r[a]>c){if(n[a]>=-I4)return!1;const p=(c-r[a])/n[a];s=Math.max(s,p)}else if(n[a]>=I4){const p=(c-r[a])/n[a];o=Math.min(o,p)}if(s>o)return!1}}return!0}let Ybe=class{constructor(e,i,r,n,s){this.aabb=e,this.axis=i,this.d=r,this.midStartIndex=n,this.rightStartIndex=s}},Xce=class ire{constructor(e,i,r,n){this.globalTriangleVertexIndices=e,this.firstTriangleIndex=i,this.positions=n,this._rayDirection=W(),this.bspNodeTree=new Array;const s=r-i,o=s<=ike?new Uint16Array(s):new Uint32Array(s);this.indices=o;for(let a=0;a{const C=nLt(o,a,_,x),M=x-_;if(M<=NY){const U=new Ybe(C,void 0,0,_,x);return this.bspNodeTree.push(U),U}const{axis:P,midValue:$}=sLt(C),F=rLt(o,a,_,x,P,$),z=(U,j)=>{if(S>c)return;const G=j-U;return G=Q$t*M?void 0:p(U,j,S+1)},k=new Ybe(C,P,$,F.next,F.mid);return this.bspNodeTree.push(k),k.leftNode=z(_,F.next),k.rightNode=z(F.mid,x),k};p(0,s,0),this.triangleVertexIndices=aLt(o,e,i,r)}}intersectRayTriangleRange(e,i){{if(e>=i)return;const r=this.triangleVertexIndices,n=this.positions.data,s=this.positions.stride,o=this._rayOrigin,a=o[0],c=o[1],p=o[2],_=this._rayDirection,x=_[0],S=_[1],C=_[2];for(let M=e,P=3*e;M0){if(be<0||be>Ee)continue}else if(be>0||be0){if(Ge<0||be+Ge>Ee)continue}else if(Ge>0||be+Ge=0){const Ft=this.indices[M]+this.firstTriangleIndex,ei=Ale(Y,Q,ne,ie,he,ce,iLt);this._callback(ut,ei,Ft,!1)}}}ire.numFacesTested+=i-e}intersectRay(e,i){ire.numFacesTested=0;const r=st(e.r0[0],e.r0[1],e.r0[2]),n=st(e.r1[0],e.r1[1],e.r1[2]),s=n[0]-r[0],o=n[1]-r[1],a=n[2]-r[2];if(s*s+o*o+a*aa||s[o]>0){const c=e.rightStartIndex,p=r;if(c=s?--a:(t[a-1]=t[c],t[c]=p,++c)}return{next:o,mid:c}}function nLt(t,e,i,r){if(r<=i)return D2(NaN,NaN,NaN,NaN,NaN,NaN);{const n=6*t[i];for(let s=0;s<3;++s)jC[s]=e[n+0+s],GC[s]=e[n+3+s]}for(let n=i+1;ni?e>r?0:i>r?1:2:i>r?1:r>e?2:0;return{axis:n,midValue:(t[n]+t[n+3])/2}}function oLt(t,e,i,r,n){const s=i-e,o=new Float32Array(6*s);for(let a=0;athis._produces()],[ke.TRANSPARENT_TERRAIN,()=>this._produces()],[ke.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new X9((o,a)=>s.newCache(o,a),"TileTexture"),this.tileGeometryCache=new q4t(s)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?CLe:Jj}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===ou.TransparentWithDraped||e===ou.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Zw}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?JU:Yn.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,this._tileRenderer!=null&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,hi.TEXTURE_FADING)}updateTileTexture(e,i){this._tileRenderer!=null&&(this._tileRenderer.updateTileTexture(e,i===hi.TEXTURE_FADING?ha.FADING:ha.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(i))}updateTileGeometryState(e){for(const r of e.layerInfo[Yi.ELEVATION])r.pendingUpdates&=~hi.GEOMETRY;e.resetPendingUpdate(hi.GEOMETRY);const i=e.renderData.updateGeometryState();return i&&this.setDirty(),i}updateGeometryIfNeeded(e){e.isLoaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const i=e.renderData;i&&(i.releaseGeometry(),this._renderDataPool.release(i),i.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const i=lLt-FY,r=Math.max(0,Math.floor((e.level-i)/FY)*FY);if(this._isGlobal&&r===0)return el;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=so.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=so.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=so.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new K$t(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=o$e(this._rctx)}uninitializeRenderContext(){this._emptyTex=Kt(this._emptyTex),this._tileRenderer=Kt(this._tileRenderer)}intersect(e,i,r,n){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==ou.Opaque)return;const s=cLt,o=uLt;je(s,n,r),Ie(o,1/s[0],1/s[1],1/s[2]);const a=e.results.min,c=e.results.max,p=e.results.ground,_=e.options.store===rl.MIN,x=!!e.results.ground.target,S=sft(e.verticalOffset),C=e.tolerance;let M,P=_&&a.dist!=null?a.dist:1/0;const $=z=>{const k=z.renderData;if(!(k!=null&&k.vao))return;const U=k.geometry;UB(kY,U.boundingBox);const j=k.localOrigin;S!=null&&(S.localOrigin=j,S.applyToAabb(kY));const G=kY;if(HC[0]=r[0]-j[0],HC[1]=r[1]-j[1],HC[2]=r[2]-j[2],!Ole(G,HC,o,C,P))return;const Y=(pe,Ee,te)=>{pe.set(this.type,z,Ee,te,gs),P=_&&a.dist!=null?a.dist:1/0},Q=(pe,Ee)=>{if(Ee!=null&&pe>=0&&(e.options.backfacesTerrain||Ve(Ee,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||i==null||i(r,n,pe))){if((p.dist==null||pec.dist)&&Y(c,pe,Ee)}},ne=hLt;je(ne,n,j);const ie=U.indices,he=U.vertexAttributes,ce=he.getField(J.POSITION,Ca),ve=new A5(ce.typedBuffer,3,he.stride/4),ge=U.indexCount/3;if(!S&&ge>tke){const pe=z.renderData;pe.intersectionData==null&&(pe.intersectionData=new Xce(ie,0,ge,ve)),pe.intersectionData.intersectRay({r0:HC,r1:ne},Q)}else n6(HC,ne,0,ge,ie,ve,null,S,Q)},F=this._rootTiles;F!=null&&(()=>{const z=this._tileIterator;z.reset(F);const k=e.options.invisibleTerrain;for(let U=z.next();U;U=z.next())!(U.visible||k&&U.intersectsClippingArea)||S==null&&!U.intersectsRay(r,s,C,P)||x&&this._useStencilForTile(U)?z.skipSubtree():$(U)})()}processScaleRangeQueries(e,i){var r;if(!i.done)for(this._updatePatchGroups();e.updating&&!i.done;){e.prepare();for(const n of this._visiblePatchesByOrigin.values())for(const s of n)((r=s.renderData)==null?void 0:r.textureReference)!=null&&e.queriesForTile(s);e.process(),i.madeProgress()}}prepareTechnique(e){const i=$e("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;if(i!==this._castShadows&&(this._castShadows=i,this._patchesByOriginDirty=!0),e.bindParameters.slot===ke.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&JU))return null}else{const r=this.transparency===ou.Opaque?ke.OPAQUE_TERRAIN:ke.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==r)return null}if(this.transparency===ou.Empty)return null;switch(e.output){case ue.Color:return this._techniqueConfiguration.hasScreenSpaceReflections=e.bindParameters.ssr.lastFrameColor!=null,this._techniqueConfiguration.hasCloudsReflections=e.bindParameters.cloudsFade.data!=null,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssao!=null,this._techniqueConfiguration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(ue.Color,e.bindParameters.slot===ke.OCCLUDED_TERRAIN);case ue.Shadow:case ue.ShadowExcludeHighlight:return this._castShadows?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(ue.Shadow,!1)):null;case ue.Depth:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(ue.Depth,!1);case ue.Normal:return this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(ue.Normal,!1);case ue.ObjectAndLayerIdColor:return this._updateTechnique(ue.ObjectAndLayerIdColor,!1);case ue.Highlight:return this._overlayRenderer.hasHighlights?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(ue.Highlight,!1)):null}return null}renderNode(e,i){switch(this._updatePatchGroups(),i.useStencil=!1,e.output){case ue.Color:{const r=e.bindParameters.slot===ke.OCCLUDED_TERRAIN?ns.Occluded:ns.Color;this._renderMaterialPass(e,i,r);break}case ue.Depth:case ue.Normal:this._renderAuxiliaryPass(e,i,ns.Color,this._visiblePatchesByOrigin);break;case ue.Highlight:this._renderAuxiliaryPass(e,i,ns.Highlight,this._visiblePatchesByOrigin);break;case ue.Shadow:case ue.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,i,null,this._allPatchesByOrigin);break;case ue.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,i,ns.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(this._tileRenderer==null)return;const i=this._tileRenderer;let r;if(e!=null){const n=qe.toUnitRGBA(e);r=st(n[0]||0,n[1]||0,n[2]||0)}i.setBackground(r),this._allTiles.forAll(n=>i.updateTileTexture(n,ha.FADING)),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?Ey.GridComposite:i.backgroundColor!=null?Ey.ColorComposite:Ey.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==GP.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),i=this._stencilEnabledLayerExtents;for(const r of e)cFe(this.renderOrder,r,i);e.sort((r,n)=>uFe(r[0],n[0],this.renderOrder)),this._visiblePatchesByOrigin=new Map(e.map(r=>[r[0].renderData.localOrigin,r])),this._patchSortingDirty=!1}}_rebuildPatchGroups(){var i;const e=this._rootTiles;if(e!=null){(i=e[0])==null||i.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const r of e)this._rebuildPatchGroupsForRootTile(r)}}_rebuildPatchGroupsForRootTile(e){const i=this._tileIterator;for(i.resetOne(e);!i.done;){const r=i.next(),n=r.renderData;if(!n){this._numTilesCulled++;continue}const s=n.localOrigin;if(this._castShadows){let a=this._allPatchesByOrigin.get(s);a||(a=new Array,this._allPatchesByOrigin.set(s,a)),a.push(r)}if(!r.visible){this._numTilesCulled++,i.skipSubtree();continue}let o=this._visiblePatchesByOrigin.get(s);o||(o=new Array,this._visiblePatchesByOrigin.set(s,o)),o.push(r),i.skipSubtree()}}_useStencilForTile(e){for(const i of this._stencilEnabledLayerExtents)if(e.intersectsExtent(i))return!0;return!1}_renderAuxiliaryPass(e,i,r,n){const s=e.rctx;this._passParameters.overlayContent=r,s.bindTechnique(i,this._passParameters,e.bindParameters);const o=this._stencilEnabledLayerExtents.length>0;n.forEach(a=>{const c=a[0].renderData.localOrigin;i.program.bindDraw(new xie(c),e.bindParameters,this._passParameters);for(let p=0;p0,c=r===ns.Occluded;c&&(o.bindTexture("tex",this._emptyTex),o.setUniform3fv("textureOpacities",el),o.setUniform4fv("texOffsetAndScale",bp));const p=((S=this._tileRenderer)==null?void 0:S.backgroundColor)!=null?this._tileRenderer.backgroundColor:el;this._techniqueConfiguration.tileBlendInput===Ey.ColorComposite&&o.setUniform3fv("backgroundColor",p);const _=this.wireframe?sr.LINES:sr.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&o.bindTexture("texNext",this._emptyTex);const x=this._visiblePatchesByOrigin;for(const C of x.values()){const M=C[0].renderData.localOrigin;i.program.bindDraw(new xie(M),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const P of C){const $=P.renderData,F=$.textureReference;if(F!=null){if(!c){o.setUniform4fv("texOffsetAndScale",F.offsetAndScale),o.bindTexture("tex",F.texture.texture);const z=$.textureFadeFactor,k=z<1?$.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&k!=null&&z<1?(o.setUniform1f("fadeFactor",z),o.setUniform4fv("nextTexOffsetAndScale",k.offsetAndScale),o.setUniform3fv("nextTexOpacities",k.opacities),o.bindTexture("texNext",k.texture.texture)):o.setUniform1f("fadeFactor",1),$.textureIsFading&&this.setNeedsRender(),o.setUniform3fv("textureOpacities",F.opacities)}this._renderPatch(e,i,P,_,a,r),P.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,i,r,n,s,o){const a=r.renderData,c=a.vao,p=c==null?void 0:c.indexBuffer;if(p==null)return void(fa&&console.error("Rendered tile with no indices: ",r.lij," : ",a));const _=i.program;o==null||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(_,a.overlay),s&&(i.useStencil=this._useStencilForTile(r),e.rctx.setPipelineState(i.getPipeline()));const x=a.geometry.indexCount;e.rctx.bindVAO(c),_.assertCompatibleVertexAttributeLocations(c),e.rctx.drawElements(n,x,p.indexType,0)}_bindOverlayPatchData(e,i){e.setUniform4fv("overlayTexOffset",i.offsets),e.setUniform4fv("overlayTexScale",i.scales)}_updateTechnique(e,i){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=i,this._shaderTechnique=this._techniques.releaseAndAcquire(bFe,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};y([w({readOnly:!0})],q0.prototype,"_isGlobal",null),y([w({value:!1})],q0.prototype,"renderingDisabled",null),y([w({value:!0})],q0.prototype,"visible",null),y([w()],q0.prototype,"renderPatchBorders",null),y([w()],q0.prototype,"visualizeNormals",null),y([w()],q0.prototype,"cullBackFaces",null),y([w({value:GP.FRONT_TO_BACK})],q0.prototype,"renderOrder",null),y([w()],q0.prototype,"wireframe",null),q0=y([Z("esri.views.3d.terrain.TerrainRenderer")],q0);const cLt=W(),uLt=W(),HC=W(),hLt=W();let dLt=class{constructor(){this.numNodes=0,this.numLeaves=0,this.numVisible=0,this.numRendered=0,this.numSplit=0,this.numMerged=0,this.numRenderedPerLevel=new Array,this.numLoadedPerLevel=new Array}},Vg=class extends ze{constructor(e){super(e)}initialize(){this.addHandles([this.layers.on("change",()=>this._update()),_e(()=>this.extentHelper.layerViewsExtent,()=>this._setAdHocTilingScheme())]),this._update(),this.tilingSchemeLocked||this._setAdHocTilingScheme()}destroy(){this._waitTask=null,this.layers.destroy()}_update(){if(this._waitTask=null,this.tilingSchemeLocked)return;let e;if(this.layers.some(i=>!(!pO(i)||i.isRejected())&&!(i.isFulfilled()&&!pLt(i,this.viewSpatialReference,this.viewingMode))&&(e=i,!((i==null?void 0:i.type)==="vector-tile"||lV(i)))),e)if(e.isResolved()){const i=$G(e,this.viewSpatialReference,this.viewingMode);if(i!=null){const r=new Gu(i.tileInfo);this._lockTilingScheme(r)}}else this._updateWhen(e)}_updateWhen(e){const i=e.when().catch(()=>{}).then(()=>{i!==this._waitTask||this.destroyed||this._update()});this._waitTask=i}_lockTilingScheme(e){if(this.viewingMode===_t.Global){const i=e.levels.length-1;e.spatialReference.isWebMercator?e=Gu.makeWebMercatorAuxiliarySphere(i):U2(e.spatialReference)&&(e=Gu.makeGCSWithTileSize(e.spatialReference,e.pixelSize,i))}this.tilingSchemeLocked=!0,this.tilingScheme=e,this.extentHelper.tilingScheme=this.tilingScheme,this._updateTiledLayerExtent(),this.removeAllHandles(),this.addHandles(_e(()=>this.extentHelper.tiledLayersExtent,()=>this._updateTiledLayerExtent()))}_updateTiledLayerExtent(){this._set("extent",this.extentHelper.tiledLayersExtent)}_setAdHocTilingScheme(){if(this.viewingMode===_t.Global){const e=this.extentHelper.viewSpatialReference,i=U2(e)||u1(e)||h1(e);e.isWebMercator?this.tilingScheme=Gu.WebMercatorAuxiliarySphere:i&&(this.tilingScheme=Gu.makeGCSWithTileSize(e,256)),this._set("extent",this.extentHelper.layerViewsExtent)}else{const e=this.extentHelper.layerViewsExtent;e==null||mT(e,this.extent)||(this.tilingScheme=Gu.fromExtent(e,this.extentHelper.viewSpatialReference),this._set("extent",e))}}get test(){return{lockTilingScheme:e=>this._lockTilingScheme(e),done:!this._waitTask}}};function pLt(t,e,i){return $G(t,e,i)!=null}y([w()],Vg.prototype,"tilingScheme",void 0),y([w({readOnly:!0})],Vg.prototype,"extent",void 0),y([w({value:!1})],Vg.prototype,"tilingSchemeLocked",void 0),y([w({constructOnly:!0})],Vg.prototype,"viewSpatialReference",void 0),y([w({constructOnly:!0})],Vg.prototype,"layers",void 0),y([w({constructOnly:!0})],Vg.prototype,"extentHelper",void 0),y([w({constructOnly:!0})],Vg.prototype,"viewingMode",void 0),Vg=y([Z("esri.views.3d.terrain.TilingSchemeLogic")],Vg);let fLt=class{constructor(){this.offset=yt(),this.scale=0,this.tile=null}init(e,i,r,n){this.tile=e,this.offset[0]=i,this.offset[1]=r,this.scale=n}dispose(){this.tile=null,this.offset[0]=0,this.offset[1]=0,this.scale=0}};var Ck;let Hi=Ck=class extends Dn.EventedMixin(ze){constructor(t){var e,i;super(t),this._scaleRangeQueries=new Tk,this._iteratorPool=new Ql(lFe,r=>r.remove=()=>this._iteratorPool.release(r)),this._postorderIterator=new kIt,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._usedMemory=null,this._performanceInfo=new dLt,this._viewChanged=!1,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=W(),this._eyePosSurfaceSR=W(),this._splitLimits=new H0,this._frustum=kL(),this._viewProjectionMatrix=Qe(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new Nf,this._frameTask=EP,this._allTiles=new Pi,this._upsampleInfoPool=new Ql(fLt),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=Ni(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=rt.WebMercator,this.visibleElevationBounds=new ZM(1/0,-1/0),this.rootTileElevationBounds=new ZM(1/0,-1/0),this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateeCarree=!1,this.overlayManager=new Ru({...t,surface:this}),this._isGlobal=!((i=(e=t.view)==null?void 0:e.state)!=null&&i.isLocal),this._tileConstructor=this._isGlobal?j4t:U4t}initialize(){const t=this.view,e=t.resourceController;this._lercDecoder=Q7e(e);const i=e.memoryController;this._tileCache=new X9((c,p)=>i.newCache(c,p),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",c=>c.unloadMapData()),this._elevationQueryCache=new Z7e(i.newCache("elevation-query"));const r=this.overlayManager;this._renderer=new q0(r.renderer,t._stage,this._allTiles,Tr(t.spatialReference).radius,i),this.addHandles([_e(()=>r.rendersOccluded,c=>this._renderer.setRenderOccludedOverlay(c)),_e(()=>r.renderer.isEmpty,()=>this._evaluateTransparency()),_e(()=>this.renderer.visible,c=>this.suspended=!c)],"overlayManager"),this.addHandles([_e(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?ha.UNFADED:ha.IMMEDIATE)},kt),_e(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?ha.UNFADED:ha.IMMEDIATE),kt),_e(()=>this.backgroundColor,(c,p)=>{c!=null&&c.equals(p)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(c))},Li),_e(()=>this.snapLevel,()=>this._viewChanged=!0,Li),_e(()=>this.view.pointsOfInterest,c=>{this._renderer.pointsOfInterest=c,this._watchUpdatingTracking.removeAll(),c&&this._watchUpdatingTracking.add(()=>c.focus.renderLocation,()=>this._allTilesSorted=!1)}),_e(()=>En.TERRAIN_TILE_TREE_SHOW_TILES,c=>{c&&!this._treeDebugger?we(()=>import("./TerrainTileTree3DDebugger-3kUE1gqF.js"),__vite__mapDeps([212,213])).then(({TerrainTileTree3DDebugger:p})=>{!this._treeDebugger&&En.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new p({view:t}))}):c||(this._treeDebugger=et(this._treeDebugger))},Qt)]);const{spatialReference:n}=t;this._extentHelper=AIt(this.viewingMode,{layers:t.map.allLayers,layerViews:t.allLayerViews,viewSpatialReference:n});const s=new YT({getCollections:()=>{var c,p;return(p=(c=t.defaultsFromMap)==null?void 0:c.mapCollections)==null?void 0:p.map(({layers:_})=>_)},getChildrenFunction:c=>c&&"layers"in c?c.layers:null}),o=new Vg({layers:s,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:n});this._set("tilingSchemeLogic",o),this._updateTilingScheme(),this._elevationDataRequester=e.createStreamDataRequester(yy.ELEVATION),this._mapDataRequester=e.createStreamDataRequester(yy.BASEMAP);const a=e.scheduler;this._frameTask=a.registerTask(ni.TERRAIN_SURFACE,this),this.addHandles([_e(()=>this._extentHelper.stencilEnabledExtents,c=>this._renderer.setStencilEnabledLayerExtents(c),Qt),_e(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),Li),_e(()=>this.extent,()=>this._updateRootTiles(),Qt),t.on("resize",()=>this._viewChangeUpdate()),_e(()=>{const c=t.state;return[this._lodBias,this.lodSnapping,t.quality,c.camera,c.contentCamera,c.fixedContentCamera]},()=>this._viewChangeUpdate(),kt),_e(()=>{var c,p;return(p=(c=t.qualitySettings)==null?void 0:c.tiledSurface)==null?void 0:p.textureFadeDuration},c=>this._renderer.textureFadingEnabled=c>0,Qt),_e(()=>{var c;return(c=t.qualitySettings)==null?void 0:c.physicallyBasedRenderingEnabled},c=>this._renderer.pbrMode=c?ti.Terrain:ti.Disabled,Qt),_e(()=>this._userClippingExtent,()=>this._updateClippingExtent(),Li)]),this.addHandles(t.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}destroy(){this._frameTask.remove(),this._watchUpdatingTracking.destroy(),this._lercDecoder=ir(this._lercDecoder),this._removeAllTiles(),this._set("tilingSchemeLogic",et(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((t,e)=>this._unregisterTiledLayerView(e)),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",et(this.overlayManager)),this._tileCache=et(this._tileCache),zce.prune(),this._treeDebugger=et(this._treeDebugger),this._renderer=et(this._renderer),this._iteratorPool=et(this._iteratorPool),this._upsampleMapCache=et(this._upsampleMapCache),this._elevationQueryCache=et(this._elevationQueryCache),this._set("view",null),this._extentHelper=et(this._extentHelper),this._upsampleInfoPool=et(this._upsampleInfoPool),SIt(),u4t()}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){var t,e;if(this.lodSnapping===D$.ON){const i=this.view,r=this.tilingScheme,n=(e=(t=i.pointsOfInterest)==null?void 0:t.cameraOnSurface)==null?void 0:e.scale;if(r&&n){const s=i.state.contentCamera;let o=$j(i,s.eye,s.viewForward,s.up).tilt;o>90&&(o=180-o);const a=2*(o/90)**2,c=r.levelAtScale(n)-a,p=Math.min(c+i.qualitySettings.tiledSurface.lodBias,this._splitLimits.maxLod||1/0);return p<=0?null:p}}return null}get lodSnapping(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences?D$.ON:D$.OFF}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get mapTileRequester(){return this._mapDataRequester}get _userClippingExtent(){const{spatialReference:t}=this,{clippingArea:e}=this.view;if(e==null||t==null)return null;const i=Ni(),r=D7e(e,i,t)?i:null,n=this._get("extent");return mT(r,n)?n:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const t=zZ(this.groundExtent,this._userClippingExtent,Ni()),e=this._get("extent");return mT(t,e)?e:t}get groundExtent(){return this._tilingSchemeExtent!=null?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){var t;return(t=this.tilingSchemeLogic)==null?void 0:t.extent}get updating(){var t,e;return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this.running||(t=this._watchUpdatingTracking)!=null&&t.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||(e=this.overlayManager)!=null&&e.updating)}get running(){return(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries.updating||this._frameTask.updating)&&this.ready&&!this.suspended}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){var t,e,i;return((i=(e=(t=this.view)==null?void 0:t.map)==null?void 0:e.ground)==null?void 0:i.opacity)??1}set baseOpacity(t){this.view.map.ground.opacity=t}get viewingMode(){return this.view.state.viewingMode}get ready(){return this._rootTiles!=null}set renderOrder(t){this._renderer.renderOrder=t,this._set("renderOrder",t)}get rootTiles(){return this._rootTiles}get spatialReference(){var t;return((t=this.tilingScheme)==null?void 0:t.spatialReference)??null}get backgroundColor(){var t,e,i;return(i=(e=(t=this.view)==null?void 0:t.map)==null?void 0:e.ground)==null?void 0:i.surfaceColor}set backgroundColor(t){this.view.map.ground.surfaceColor=t}set slicePlaneEnabled(t){this._renderer.slicePlaneEnabled=t,this._set("slicePlaneEnabled",t),this._evaluateTransparency()}get tilingSchemeLocked(){var t;return((t=this.tilingSchemeLogic)==null?void 0:t.tilingSchemeLocked)??!1}get wireframe(){var t;return(t=this._renderer)==null?void 0:t.wireframe}set wireframe(t){t!==this._renderer.wireframe&&(this._renderer.wireframe=t,this._updateAllTileGeometries())}get opaque(){return this._renderer.transparency===ou.Opaque}set suspended(t){this._set("suspended",t),this._viewChangeUpdate()}get textureFadeDuration(){return this.view.qualitySettings.tiledSurface.textureFadeDuration??0}intersect(t,e,i,r){this._renderer.intersect(t,e,i,r)}getElevation(t,e,i,r){const n=this._rootTiles;if(!(n!=null&&n.length)||n[0].layerInfo[Yi.ELEVATION].length===0)return null;const s=Eu;return s[0]=t,s[1]=e,s[2]=i,il(s,r,s,this._spatialReference)?Zbe(n,s[0],s[1]):(Ce.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null)}getElevations(t,e,i){const r=this._rootTiles,n=r?r[0].layerInfo[Yi.ELEVATION].length:0;if(r!=null&&r.length&&n!==0)for(let s=0;sn[2]&&(s+=1),Eu[1]{if(a&&ode(a.extent,Eu))if(a.isLeaf||a.rendered)i=Math.min(i,a.elevationBounds[0]),r=Math.max(r,a.elevationBounds[1]);else for(const c of a.children)n(c)},s=this._rootTiles;if(s!=null)for(const a of s)n(a);return{min:i,max:r}}getRootElevationBounds(){return{min:this.rootTileElevationBounds.min,max:this.rootTileElevationBounds.max}}getSphereScale(t,e){if(!this.tilingScheme)return null;if(!fd(t,Eu,this.spatialReference))return Ce.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;Eu[3]=e;let i=null;const r=s=>{if(s&&ode(s.extent,Eu)){const o=s.children;if(o[0]&&!s.rendered)for(const a of o)r(a);else{const a=this._getLodBiasCorrectedScale(s.level);i=i==null?a:Math.min(i,a)}}},n=this._rootTiles;if(n!=null)for(const s of n)r(s);return i}queryVisibleScaleRange(t,e,i,r){const n=e?this.tilingScheme.levelAtScale(e):0,s=i?this.tilingScheme.levelAtScale(i):1/0,o=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(t,n+o,s+o,r)}_evaluateTransparency(){var s,o;const t=this.baseOpacity,e=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._allSurfaceLayersTransparent()?e?ou.Empty:ou.TransparentWithDraped:t>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?ou.Opaque:ou.Semitransparent,n=i!==r;return n&&(this._renderer.transparency=r,(o=(s=this.view)==null?void 0:s._stage)==null||o.renderer.setParameters({terrainTransparency:this._renderer.transparency})),n}_updateTilingScheme(){var i,r,n;const t=this.tilingSchemeLogic.tilingScheme;if(t===this.tilingScheme)return;ly(!!t,"tiling scheme cannot be reset to undefined"),this._isGlobal=!((r=(i=this.view)==null?void 0:i.state)!=null&&r.isLocal),this.tilingScheme&&this._removeAllTiles();const e=(t==null?void 0:t.spatialReference)??rt.WebMercator;this._spatialReference=e,this._isWebMercator=!!(e!=null&&e.isWebMercator),this._isWebMercatorOnPlateeCarree=this._isWebMercator&&yL((n=this.view)==null?void 0:n.renderSpatialReference),this._set("tilingScheme",t),this._updateClippingExtent(),t&&(this._updateTiledLayers(),this._renderer.setTileSize(t.pixelSize),this.overlayManager.setSpatialReference(t.spatialReference),this._updateRootTiles())}_acquireTile(t,e,i,r){const n=this._tileCache.pop(Ck._tileMemcacheKey);return n?(n.init(t,e,i,r,this),n):new this._tileConstructor(t,e,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:t,tilingScheme:e}=this;if(!e)return;const i=yLt;let r=e.rootTilesInExtent(t,i,5*kM);if(this._rootTiles!=null){if(r.length>kM)return void Ce.getLogger(this).warn(Xft);const n=this._rootTiles.map(o=>o.lij),s=uGe(n,r,Xbe);if(this._updatingRootTiles=!0,s.removed.length>0||s.added.length>0){const o=this._rootTiles.filter(a=>!(s.removed.findIndex(c=>Xbe(c,a.lij))>-1)||(this._purgeTile(a),!1));s.added.forEach(a=>o.push(this._newRootTile(a))),this._setRootTiles(o)}}else this._updatingRootTiles=!0,r.length>kM&&(Ce.getLogger(this).warn(Zft),r=e.rootTilesInExtent(t,i,kM)),this._setRootTiles(r.map(n=>this._newRootTile(n)));mT(i,this._rootTilesExtent)||(this._rootTilesExtent=Ni(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const t=this._allTiles.filter(e=>e.isLoaded&&e.intersectsClippingArea);t.forEach(e=>this._renderer.updateTileGeometryState(e)),t.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(t),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(t){if(t.length===0)return;t.sort(h_);const e=this.renderer;t.forEach(i=>e.updateGeometryIfNeeded(i)),t.forEach(i=>this._pendingTilesForElevationUpdateEvent.add(i))}_shouldSplit(t){return t.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)===hi.SPLIT}_newRootTile(t){const e=this._acquireTile(0,t[1],t[2],null);return this._shouldSplit(e)&&e.setPendingUpdate(hi.SPLIT),this._loadTile(e),this._markTileToUpdate(e),this._updateRootTileElevationBounds(),e}_setRootTiles(t){if(this._rootTiles=t,this._allTiles.clear(),t!=null){const e=this._iteratorPool.acquire();for(e.reset(t);!e.done;)this._allTiles.push(e.next());e.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(t)}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(t){t.updateClippingStatus(this.extent)&&t.resetPendingUpdate(hi.GEOMETRY)&&this._updateTileGeometryState(t)}_updateTilesVisibility(t){if(t==null)return;const e=HIt(t),i=this.visibleElevationBounds;let r=e?i.min:1/0,n=e?i.max:-1/0;const s=this.extent,o=this._viewProjectionMatrix;this.setTileTreeDirty();const a=this._iteratorPool.acquire();for(a.reset(t);!a.done;){const c=a.next();c.updateClippingStatus(s)&&c.resetPendingUpdate(hi.GEOMETRY)&&this._updateTileGeometryState(c),c.setPendingUpdate(hi.RENDERDATA),c.computeVisibility(),c.updateScreenDepth(o),c.renderData&&(r=Math.min(c.elevationBounds[0],r),n=Math.max(c.elevationBounds[1],n))}a.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(n)&&(i.min!==r||i.max!==n)&&(this.visibleElevationBounds=new ZM(r,n))}_updateRootTileElevationBounds(){let t=1/0,e=-1/0;const i=this._rootTiles;i!=null&&i.forEach(({elevationBounds:n})=>{t=Math.min(t,n[0]),e=Math.max(e,n[1])});const r=this.rootTileElevationBounds;r.min===t&&r.max===e||(this.rootTileElevationBounds=new ZM(t,e))}_updateViewDependentParameters(){const{camera:t,contentCamera:e}=this.view.state,i=Math.tan(.5*e.fovX),r=Math.tan(.5*e.fovY),n=this.tilingScheme.pixelSize,s=2**-this._lodBias*t.pixelRatio;this._splitLimits.aboveGround=t.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=n/t.width*this.maxTextureScale*s,this._splitLimits.relativeHeightLimit=n/t.height*this.maxTextureScale*s,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=wU(this._splitLimits.frustum??kL(),e.frustum):this._splitLimits.frustum=null,wU(this._frustum,t.frustum),sn(this._viewProjectionMatrix,e.projectionMatrix,e.viewMatrix),Ne(this._eyePosRenderSR,e.eye),il(t.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateRenderData(t){t.rendered&&!t.shouldLoad&&(rke(t)?this._loadChildren(t):gLt(t)&&this._loadParent(t))}_updateTileGeometryState(t){t.updateVisibility(),this._renderer.updateTileGeometryState(t)&&this._markTileToUpdate(t),this._usedMemory=null}_markAllTileNeighborsForGeometryUpdate(t){t.forEachLoadedNeighbor(e=>this._pendingTilesToUpdate.add(e))}_updateTileTexture(t,e){const i=t.resetPendingUpdate(hi.TEXTURE_FADING)?hi.TEXTURE_FADING:!!t.resetPendingUpdate(hi.TEXTURE_NOFADING)&&hi.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(t,i),this._usedMemory=null,e.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const t=UY.extent;ld(t),this._pendingTilesForElevationUpdateEvent.forEach(e=>x2(t,e.extent,t)),this._pendingTilesForElevationUpdateEvent.clear(),UY.spatialReference=this.spatialReference,this.emit("elevation-change",UY),this._shouldEmitChangeEvent=!1}runTask(t){this._handleLayerViewChanges(t),this._frameTask.processQueue(t),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,t),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(t),this._sortTiles(t);const e=!this.view.state.fixedContentCamera;this._mergeAndSplit(t,e),this._updateElevation(t),this._updateTextures(t),e||this._mergeAndSplit(t,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),t.done&&t.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue")}_updateAllTilesStatus(t){if(!this._viewChanged||!this._rootTiles||t.done)return;this._viewChanged=!1;const e=this._iteratorPool.acquire();e.reset(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,n=this._eyePosRenderSR;for(;!e.done;){const s=e.next(),o=s.shouldSplit(r,n,i);if(o!==hi.SPLIT){if(s.resetPendingUpdate(hi.SPLIT)&&s.updateAgentSuspension(),o===hi.ELEVATION&&s.updateAgents(Yi.ELEVATION),e.skipSubtree(),!s.isLeaf){s.setPendingUpdate(hi.MERGE),s.resetPendingUpdate(hi.SPLIT);const a=this._iteratorPool.acquire();a.resetOne(s);const c=this._viewProjectionMatrix;for(let p=a.next();!a.done;p=a.next())this._updateClippingStatus(p),p.updateVisibility(),p.updateScreenDepth(c);a.remove()}}else s.resetPendingUpdate(hi.MERGE),s.isLeaf&&(s.setPendingUpdate(hi.SPLIT),e.skipSubtree()),s.rendered&&s.setPendingUpdate(hi.RENDERDATA)}e.remove(),this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),t.madeProgress()}_sortTiles(t){t.done||this._allTilesSorted||(jIt(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&this._treeDebugger.update(),t.madeProgress())}_markTileToUpdate(t){at(t.isLoaded),t.intersectsClippingArea&&(this._pendingTilesToUpdate.add(t),this._markAllTileNeighborsForGeometryUpdate(t))}_updatePendingTileGeometries(){const t=this._pendingTilesToUpdate,e=Array.from(t.keys()).filter(n=>n.isLoaded&&n.intersectsClippingArea);if(e.length===0)return void t.clear();const i=(n,s)=>{!(s!=null&&s.isLoaded)||!s.intersectsClippingArea||s.level{var S;const x=uV[_];i(s,(S=c[_])==null?void 0:S.findCorner(cV(x),C=>C.isLoaded))};for(let _=0;_<4;++_)if(a&1<<_){const x=o.geometryState.neighborData.edgePeerNeighbors[_];x&&(x==null?void 0:x.level)>=s.level&&x.forAllSubtreeOnSide(Nce(Qv[_]),S=>!(!S.isLoaded||!S.intersectsClippingArea)&&(at(t.has(S)||h_(s,S)<0),i(s,S),!0)),p((_+1)%4),p(_)}}t.clear(),this._updateTilesGeometries(e),this._shouldEmitChangeEvent=!0,fa&&aV&&this.checkAllTilesWaterproofness()}_mergeAndSplit(t,e){if(this.suspended||t.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let n=!1;for(;!t.done;){n=!0;let s=!1;const o=!this._allTiles.some(a=>{var p;if(!i&&!r&&!a.visible)return t.done;let c=a;if(a.resetPendingUpdate(hi.MERGE)){if(!e)return a.setPendingUpdate(hi.MERGE),t.done;for(;(p=c.parent)!=null&&p.resetPendingUpdate(hi.MERGE);)c=c.parent;this._mergeTile(c),s=!0,t.madeProgress()}else a.resetPendingUpdate(hi.SPLIT)&&(this._splitTile(a),s=!0,t.madeProgress());return!t.done&&c===a&&a.resetPendingUpdate(hi.RENDERDATA)&&(this._updateRenderData(a),t.madeProgress()),t.done});if(s&&(this._allTilesSorted=!1,this._allTilesDirty=!0),o){if(!i){i=!0;continue}if(!s)break}else this._allTilesDirty=!0}n?t.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._sortTiles(t)}_updateElevation(t){t.done||(this._allTiles.some(e=>(e.resetPendingUpdate(hi.GEOMETRY)&&(this._updateTileGeometryState(e),this._updateTileTexture(e,t),this._shortBatches&&this._updatePendingTileGeometries(),t.madeProgress()),t.done)),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(t){t.done||this._allTiles.some(e=>(this._updateTileTexture(e,t),t.done))}_updateClippingExtent(){this.spatialReference&&(this.updateTileOverlayParams(so.UPDATE),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const t=this.view.quality;return this.view.qualitySettings.tiledSurface.lodBias-(1-t)*Wft}_getLodBiasCorrectedScale(t){const e=this.tilingScheme.levels,i=Je(t-this._lodBias,0,e.length-1),r=i-Math.floor(i);return e[Math.floor(i)].scale*(1-r)+e[Math.ceil(i)].scale*r}_removeAllTiles(){this._rootTiles!=null&&(this._rootTiles.forEach(t=>this._purgeTile(t)),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.renderer.visible=!1}_purgeDescendantTiles(t){if(!t.children[0])return!1;let e=!1;for(let i=0;i<4;++i)e=this._purgeTile(t.children[i])||e;return t.unsetChildren(),e}_purgeTile(t){const e=this._purgeDescendantTiles(t)||t.rendered;return this._allTiles.removeUnordered(t),this._unloadTile(t),this._tileCache.put(Ck._tileMemcacheKey,t),e}_unloadTile(t){this._pendingTilesToUpdate.delete(t),this._pendingTilesForElevationUpdateEvent.delete(t),t.unload(this._renderer)}_splitTile(t){ly(t.isLeaf,"tile that is already split should not be split again!");const e=t.level+1,i=2*t.lij[1],r=2*t.lij[2];t.setChildren(this._createTile(e,i,r,t),this._createTile(e,i,r+1,t),this._createTile(e,i+1,r,t),this._createTile(e,i+1,r+1,t)),t.setPendingUpdate(hi.RENDERDATA),t.updateAgentSuspension(),this._allTiles.pushArray(t.children),this._allTilesDirty=!0,++this._performanceInfo.numSplit}_emitTileScaleChange(t,e=t.level){C8.spatialReference=this.spatialReference,C8.extent=t.extent,C8.scale=this._getLodBiasCorrectedScale(e),this.emit("scale-change",C8)}_createTile(t,e,i,r){ly(!!r,"_createTile sanity check");const n=this._acquireTile(t,e,i,r);return n.updateClippingStatus(this.extent),n.updateScreenDepth(this._viewProjectionMatrix),this._shouldSplit(n)&&n.setPendingUpdate(hi.SPLIT),n}get _shortBatches(){return this.view.state.mode!==Vr.IDLE}_mergeTile(t){ly(!t.hasPendingUpdate(hi.SPLIT),"_mergeTile sanity check"),this._purgeDescendantTiles(t)&&(ly(!t.renderData,"_mergeTile sanity check"),this._loadTile(t),this._markTileToUpdate(t),this._emitTileScaleChange(t),this._shortBatches&&this._updatePendingTileGeometries()),this._allTilesDirty=!0,++this._performanceInfo.numMerged}_loadChildren(t){ly(t.rendered,"parent should be rendered"),this._unloadTile(t);const e=t.children;e.forEach(i=>this._loadTile(i)),e.forEach(i=>this._pendingTilesToUpdate.add(i)),this._markAllTileNeighborsForGeometryUpdate(t),this._emitTileScaleChange(t,t.level+1),this._shortBatches&&this._updatePendingTileGeometries()}_loadParent(t){const e=t.parent;this._unloadChildren(e),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e,e.level),this._shortBatches&&this._updatePendingTileGeometries()}_unloadChildren(t){const e=t.children;if(e[0])for(let i=0;i<4;++i){const r=e[i];this._unloadChildren(r),this._unloadTile(r)}}_loadTile(t){t.load(),t.setPendingUpdate(hi.RENDERDATA),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager&&this.overlayManager.hasOverlays&&this.overlayManager.setTileParameters(t)}_elevationDataArrived(t,e,i){const r=new EIt(t.lij,t.extent,i);t.dataArrived(e,Yi.ELEVATION,r);const n=[t],s=t.level,o=this._iteratorPool.acquire();for(o.reset(n);!o.done;){const a=o.next();a.findElevationBoundsForLayer(e,s),a.computeElevationBounds()}s===0&&this._updateRootTileElevationBounds(),o.remove(),this._updateTilesVisibility(n)}_handleLayerViewChanges(t=cu){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let e=!1;const i=new Set;let r=-1;for(const n of this.view.allLayerViews.items)if(i.add(n.uid),o9(n)||VR(n))if(this._basemapLayerViewHandles.has(n.uid)&&!VR(n)){const s=this._layerClassFromLayerView(n),o=this._getLayerIdxByUID(s,n.uid);o!=null&&((o{i.has(s)||(this._unregisterTiledLayerView(s),e=!0)}),e&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),t.madeProgress()}_allSurfaceLayersTransparent(){var e,i;let t=((i=(e=this.view.map)==null?void 0:e.ground)==null?void 0:i.opacity)===0;for(const r of this.view.allLayerViews.items)if(Vie(r)&&!rF(r.layer)&&r.fullOpacity!==0)return t=!1,t;return t}_hasCompositeBlendMode(){for(const t of this.view.allLayerViews.items)if((s9(t)||VR(t))&&JIt(Gie[t.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(t){return Uie(t)?Yi.ELEVATION:Yi.MAP}_registerTiledLayerView(t){const e=[];if((s9(t)||VR(t))&&e.push(_e(()=>t.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(ha.UNFADED)})),!VR(t)){const i=this._layerClassFromLayerView(t);e.push(_e(()=>t.suspended,()=>this._updateTiledLayers())),e.push(_e(()=>t.fullOpacity,()=>this._updateTileTextures(ha.UNFADED))),e.push(_e(()=>"effectiveScaleRange"in t.layer?t.layer.effectiveScaleRange:null,()=>this._restartAllAgents(i))),e.push(t.on("data-changed",()=>{const r=this._getLayerIdxByUID(i,t.uid);r!=null&&this._invalidateLayerData(r,i)}))}this._unregisterTiledLayerView(t.uid),this._basemapLayerViewHandles.set(t.uid,e)}_unregisterTiledLayerView(t){const e=this._basemapLayerViewHandles.get(t);if(e){for(const i of e)i.remove();this._basemapLayerViewHandles.delete(t)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const t=this.view.allLayerViews,e=[[],[]];let i=null;t.forEach(r=>{if(!r.layer||r.suspended||!o9(r)||!r.fullExtent)return;const n=this._layerClassFromLayerView(r);if(n===Yi.MAP){const s=r.displayLevelRange.maxLevel;s!==1/0&&(i===null||s>i)&&(i=s)}e[n].push(r)});for(const r of cS){const n=this._layerViews[r],s=e[r];s.reverse();const o=s.length;let a=n.length!==o;const c=new Array(o),p=new Array(n.length);this._layerIndexByUid[r].clear();for(let _=0;_-1&&(p[S]=_)}if(a){const _=this._postorderIterator;for(_.reset(this._rootTiles);!_.done;)_.next().modifyLayers(p,c,r);this._layerViews[r]=s,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&this._viewChangeUpdate()}_restartAllAgents(t){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;){const i=e.next();i.restartAgents(t),t===Yi.ELEVATION&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(t,e){return this._layerViews[e][t]}numLayers(t){return this._layerViews[t].length}_updateTileTextures(t){this._allTiles.forAll(e=>{e.updateAgents(Yi.MAP),t===ha.IMMEDIATE?this.renderer.updateTileTexture(e,hi.TEXTURE_NOFADING):e.updateRenderData(Yi.MAP,t)}),this._evaluateTransparency()}_invalidateLayerData(t,e){this._allTiles.forAll(i=>i.removeLayerAgent(t,e)),this._allTiles.forAll(i=>i.invalidateLayerData(t,e))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(t=so.UPDATE){this.renderer.setNeedsRender(t)}requestUpdate(){++this._pendingUpdates==1&&(this._hasPendingUpdates=!0)}requestTileData(t,e,i,r){const n=this.layerViewByIndex(e,i),s=n.layer;return!s.tilemapCache||jP(n)?this._requestTileData(t,i,n,r):(++this._asyncWorkItems,s.tilemapCache.fetchAvailability(t.lij[0],t.lij[1],t.lij[2],{...r,timeout:6e3}).then(()=>--this._asyncWorkItems).catch(o=>{throw--this._asyncWorkItems,St(r),on(o)||this._dataMissing(t,i,n,{notInTilemap:!0}),o}).then(()=>this._frameTask.schedule(()=>this._requestTileData(t,i,n,r),r.signal)))}_requestTileData(t,e,i,r){return e===Yi.ELEVATION?Uie(i)?this._requestElevationTileData(t,i,r):Promise.reject():Vie(i)?this._requestMapTileData(t,i,r):Promise.reject()}_requestElevationTileData(t,e,i){++this._asyncWorkItems;const r=o=>{if(So(i))return;const a=this._layerIndexByUid[Yi.ELEVATION].get(e.uid);a!=null?(this._usedMemory=null,this.requestUpdate(),this._elevationDataArrived(t,a,o)):Ce.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",Yi.ELEVATION,t.lij.toString())},n=o=>{on(o)||(this._dataMissing(t,Yi.ELEVATION,e,o),this.requestUpdate())};if(l_e(e.layer))return e.layer.fetchTile(t.lij[0],t.lij[1],t.lij[2],{noDataValue:LL,signal:i.signal}).then(o=>{if(!So(i))return this._frameTask.schedule(()=>r(o),i.signal,n);Ce.getLogger(this).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true.")},n).finally(()=>{--this._asyncWorkItems});const s=e.getTileUrl(t.lij[0],t.lij[1],t.lij[2]);return this._elevationDataRequester.request(s,"binary",i).then(o=>this._lercDecoder.decode(o,{noDataValue:LL},i.signal)).then(o=>{o?r(new J7e(o)):n(new Error("LERC decoding failed"))},n).finally(()=>{--this._asyncWorkItems})}_requestMapTileData(t,e,i){++this._asyncWorkItems;const r=(p,_)=>{--this._asyncWorkItems,$O(_),So(i)||(this._dataMissing(t,Yi.MAP,e,p),this.requestUpdate())},n=p=>_=>r(_,p),s=p=>this._frameTask.schedule(()=>{--this._asyncWorkItems,this.requestUpdate(),So(i)?$O(p):this._mapTileDataArrived(t,e,p)},i.signal,n(p)).catch(n(p)),o=(p,_=null)=>this._frameTask.schedule(()=>r(p,_));if(jP(e)){const p=e.schemaHelper.getLevelRowColumn(t.lij);return e.fetchTile(p[0],p[1],p[2],i).then(s,o)}if(IG(e))return e.fetchTile(t.lij[0],t.lij[1],t.lij[2],i).then(s,o);if(Dce(e)&&l_e(e.layer))return e.layer.fetchTile(t.lij[0],t.lij[1],t.lij[2],i).then(p=>{if(So(i))return Ce.getLogger(this).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),void o(ur());s(p)},o);let a=e.getTileUrl(t.lij[0],t.lij[1],t.lij[2]);Ect(e.layer)&&e.layer.refreshTimestamp&&(a+=`${a.includes("?")?"&":"?"}_ts=${e.layer.refreshTimestamp}`);const c=e.hasMixedImageFormats?"image+type":"image";return this._mapDataRequester.request(a,c,i).then(s,o)}_mapTileDataArrived(t,e,i){const r=this._getLayerIdxByUID(Yi.MAP,e.uid);r!=null?t.dataArrived(r,Yi.MAP,i):($O(i),Ce.getLogger(this).warn("TerrainSurface: received data from unknown layer"))}_getLayerIdxByUID(t,e){return this._layerIndexByUid[t].get(e)}_dataMissing(t,e,i,r){const n=this._getLayerIdxByUID(e,i.uid);n!=null?t.dataMissing(n,e,r):Ce.getLogger(this).warn("TerrainSurface: received data from unknown layer")}updateTileOverlayParams(t){this._rootTiles&&this.overlayManager&&(this._allTiles.forAll(e=>{e.renderData&&this.overlayManager.setTileParameters(e)}),this._renderer.setNeedsRender(t))}get performanceInfo(){const t=this._performanceInfo;return t.numNodes=this._allTiles.length,t.numLeaves=t.numVisible=t.numRendered=t.numLoadedPerLevel.length=t.numRenderedPerLevel.length=0,this._allTiles.forAll(e=>{e.isLeaf&&t.numLeaves++;const i=e.level;e.renderData&&(t.numLoadedPerLevel[i]=(t.numLoadedPerLevel[i]||0)+1),e.visible&&(t.numVisible++,e.rendered&&(t.numRenderedPerLevel[i]=(t.numRenderedPerLevel[i]||0)+1,t.numRendered++))}),t}get usedMemory(){return this.tilingScheme?(this._usedMemory==null&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((t,e)=>t+e.usedMemory,0)):null}getUsedMemoryForLayerView(t){let e=0;const i=this._layerClassFromLayerView(t),r=this._getLayerIdxByUID(i,t.uid);return r!=null&&this._allTiles.forAll(n=>e+=n.getUsedMemoryForLayer(i,r)),e}getTile(t){if(t==null||this._rootTiles==null)return null;const e=t.split("/").map(o=>+o);if(e[0]===0)return this._rootTiles.find(o=>o.lij[1]===e[1]&&o.lij[2]===e[2]);const i=2**e[0],r=Math.floor(e[1]/i),n=Math.floor(e[2]/i);let s;if(this._rootTiles.some(o=>o.lij[1]===r&&o.lij[2]===n&&(s=o,!0)),s){let o=1<0&&a++,!s.children[a])return null;s=s.children[a],o>>=1}return ly(s.lij[0]===e[0]&&s.lij[1]===e[1]&&s.lij[2]===e[2],"not the right tile?"),s}return null}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(t){this._renderer.renderPatchBorders=t}get visualizeNormals(){return this._renderer.visualizeNormals}set visualizeNormals(t){this._renderer.visualizeNormals=t}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(t){this._renderer.renderingDisabled=t}get test(){const t=this;return{renderer:t._renderer,lercDecoder:t._lercDecoder,forceReload:()=>{t._rootTiles!=null&&t._rootTiles.length>0&&(t._mergeTile(t._rootTiles[0]),t._viewChangeUpdate())},getTiles:()=>t._allTiles.toArray(),getRenderedTiles(){zY.clear(),t._allTiles.forAll(i=>{i.visible&&i.rendered&&zY.push(i)});const e=zY.toArray();return cFe(t.renderOrder,e),e},lockTilingScheme(e,i){t._extentHelper.defaultTiledLayersExtent=i,t.tilingSchemeLogic.test.lockTilingScheme(e)}}}checkAllTilesWaterproofness(){if(!aV)return;const t=this._rootTiles;if(t==null)return;const e=s=>{var o,a,c;return((c=(a=(o=s==null?void 0:s.renderData)==null?void 0:o.geometry)==null?void 0:a.indices)==null?void 0:c.length)>0},i=(s,o)=>{e(s)&&console.error("Tile[",s.lij,"] has geometry although parent[",o.lij,"] has geom")},r=s=>{var o,a;if(s.intersectsClippingArea)if(s.renderData&&!s.renderData.geometryState&&console.error("Tile[",s.lij,"] has renderData but not geometryState"),s.renderData&&!s.renderData.geometry&&console.error("Tile[",s.lij,"] has renderData but not geometryInfo"),!((o=s.renderData)!=null&&o.geometry)||(((a=s.renderData.geometry.indices)==null?void 0:a.length)??0)>0||console.error("Tile[",s.lij,"] has renderData but no indices - geometryInfo: ",s.renderData.geometry),e(s)){s.checkGeometryWaterproofness();for(const c of s.children)i(c,s)}else if(s.isLeaf)console.error("Tile[",s.lij,"] has no geometry and no children, from root to leaf");else for(const c of s.children)r(c)},n=s=>{var p;const o=((p=s.parent)==null?void 0:p.visible)??!0,a=s.visible;s.computeVisibility();const c=s.visible;if(a!==c&&o&&console.error(" Tile[",s.lij,"] has out of date visibility: ",a," instead of ",c),!s.isLeaf)for(const _ of s.children)n(_)};for(const s of t)r(s),n(s)}get isGlobal(){return this._isGlobal}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateeCarree(){return this._isWebMercatorOnPlateeCarree}isEastEndWrap(t){return this.isGlobal&&t[2]===this.lijEastEnd(t[0])-1}isWestEndWrap(t){return this.isGlobal&&t[2]===0}lijEastEnd(t){return 2**(t+(this.spatialReference!=null&&this.spatialReference.isGeographic?1:0))}wrapEastWest(t){const e=this.lijEastEnd(t[0]),i=t[2];if(0<=i&&is.extentMidX?1:0)+(i{const o=this._ensureGeomRecord(e,s);n.forEach(({geometry:a,operation:c,states:p},_)=>{let x=!1;if(c===ds.UPDATE){const S=o.get(_);if(S){if(p&ua.TRANSFORMATION){const C=this.model.getObject(s);this.model.updateRenderGeometryTransformation(C,a,S)&&(x=!0)}x||i.updates.push({renderGeometry:S,updateType:p})}else Xt(!1,"ModelDirtySet.commitLayer: invalid update")}if(c===ds.REMOVE||x){const S=o.get(_);S?(i.removes.push(S),o.delete(_)):c===ds.REMOVE&&Xt(!1,"ModelDirtySet.commitLayer: invalid remove")}if(c===ds.ADD||x){const S=this.model.getObject(s);if(S!=null){const C=this.model.getRenderGeometry(S,a);i.adds.push(C),o.set(_,C)}}}),o.size===0&&this._residentGeomRecords.get(e).delete(s)}),this._residentGeomRecords.get(e).size===0&&this._residentGeomRecords.delete(e),this._dirtyGeomRecords.delete(e),this.dirty=this._hasDirtyGeometryRecords)}commitSyncUpdates(e,i){const r=this._dirtyGeomRecords.get(e);r&&r.forEach((n,s)=>{const o=this._ensureGeomRecord(e,s);n.forEach(({geometry:a,operation:c,states:p,sync:_},x)=>{let S=!1;if(c===ds.UPDATE&&_){const C=o.get(x);if(C){if(p&ua.TRANSFORMATION){const M=this.model.getObject(s);this.model.updateRenderGeometryTransformation(M,a,C)&&(S=!0)}S||i.updates.push({renderGeometry:C,updateType:p})}else Xt(!1,"ModelDirtySet.commitSyncUpdates: invalid update")}})})}getResidentRenderGeometries(e,i){const r=this._residentGeomRecords.get(e);r&&r.forEach(n=>n.forEach(s=>i.push(s)))}_objectStateChanged(e,i){for(const r of i.geometries)this._updateOrCreateDirtyRecord(i,r,null,ds.UPDATE,e)}visibilityChanged(e){this._objectStateChanged(ua.VISIBILITY,e)}highlightChanged(e){this._objectStateChanged(ua.HIGHLIGHT,e)}occlusionChanged(e){this._objectStateChanged(ua.OCCLUDEE,e)}attributesChanged({object:e,geometry:i,sync:r}){this._updateOrCreateDirtyRecord(e,i,null,ds.UPDATE,ua.GEOMETRY,r)}layerAdded(e){e.objects.forAll(i=>this._layerObjectAdded(e,i))}layerRemoved(e){e.objects.forAll(i=>this._layerObjectRemoved(e,i))}layerObjectAdded(e){this._layerObjectAdded(e.layer,e.object)}_layerObjectAdded(e,i){const r=e.id;for(const n of i.geometries)this._geometryAdded(i,n,r)}layerObjectRemoved(e){this._layerObjectRemoved(e.layer,e.object)}layerObjectsAdded(e){for(const i of e.objects)this._layerObjectAdded(e.layer,i)}layerObjectsRemoved(e){for(const i of e.objects)this._layerObjectRemoved(e.layer,i)}_layerObjectRemoved(e,i){const r=e.id;for(const n of i.geometries)this._geometryRemoved(i,n,r)}transformationChanged(e){const i=this._getParentLayerId(e),r=e.id;this._ensureGeomRecord(i,r).forEach(n=>{this._updateOrCreateDirtyRecord(e,n.geometry,i,ds.UPDATE,ua.TRANSFORMATION)})}shaderTransformationChanged(e){const i=this._getParentLayerId(e),r=e.id;this._ensureGeomRecord(i,r).forEach(n=>{n.objectShaderTransformationChanged(e.shaderTransformation)})}geometryAdded(e){this._geometryAdded(e.object,e.geometry)}_geometryAdded(e,i,r=null){this._updateOrCreateDirtyRecord(e,i,r,ds.ADD)}geometryRemoved(e){this._geometryRemoved(e.object,e.geometry)}_geometryRemoved(e,i,r=null){this._updateOrCreateDirtyRecord(e,i,r,ds.REMOVE)}_updateOrCreateDirtyRecord(e,i,r,n,s=ua.NONE,o=!1){r=r??this._getParentLayerId(e);const a=e.id,c=i.id,p=this._ensureDirtyRecord(r,a),_=p.get(c);if(_){const x=_.operation;x===ds.REMOVE&&n===ds.ADD&&_.states!==ua.NONE?_.operation=ds.UPDATE:x===ds.REMOVE&&n===ds.ADD||x===ds.ADD&&n===ds.REMOVE?p.delete(c):x!==ds.UPDATE||n!==ds.REMOVE&&n!==ds.UPDATE?(Xt((x===ds.REMOVE||x===ds.ADD)&&n===ds.UPDATE,"ModelDirtySet.objectGeometryAdded: inconsistent state"),_.states|=s):(_.operation=n,_.states|=s),_.sync=_.sync||o}else p.set(c,new vLt(n,i,s,o));this.dirty=this._hasDirtyGeometryRecords}_ensureGeomRecord(e,i){let r=this._residentGeomRecords.get(e);r||(r=new Map,this._residentGeomRecords.set(e,r));let n=r.get(i);return n||(n=new Map,r.set(i,n)),n}get _hasDirtyGeometryRecords(){return ap(this._dirtyGeomRecords,e=>ap(e,i=>i&&i.size>0))}_ensureDirtyRecord(e,i){let r=this._dirtyGeomRecords.get(e);r||(r=new Map,this._dirtyGeomRecords.set(e,r));let n=r.get(i);return n||(n=new Map,r.set(i,n)),n}_getParentLayerId(e){return e.parentLayer?e.parentLayer.id:_He}formatDebugInfo(){const e=["ADD","UPD",void 0,"REM"];let i="";return this._dirtyGeomRecords.forEach((r,n)=>{r.forEach((s,o)=>{i.length>0&&(i+=` +`),i+=n+"."+o;const a=[];s.forEach(c=>{const p=c.operation;a[p]||(a[p]=[]),a[p].push(c.geometry.id)});for(let c=0;ci+r.size,0)},commit:i=>e._dirtyGeomRecords.forEach((r,n)=>e.commitLayer(n,i))}}};y([w({constructOnly:!0})],$4.prototype,"model",void 0),y([w()],$4.prototype,"dirty",void 0),$4=y([Z("esri.views.3d.webgl-engine.lib.ModelDirtySet")],$4);const _Lt=$4;let Ak=class extends ze{constructor(){super(...arguments),this.dirtySet=new _Lt({model:this}),this._content=new Map,this._originFactory=new ace(null)}getObject(e){return this._content.get(e)}add(e){const i=e.id;Xt(!this._content.has(i),"Model/Stage already contains object to be added"),this._content.set(i,e),YU(e)&&this.dirtySet.layerAdded(e)}remove(e){return!!this._content.has(e.id)&&(this._content.delete(e.id),YU(e)&&this.dirtySet.layerRemoved(e),!0)}addMany(e){for(const i of e)i&&(Xt(!this._content.has(i.id),"Model/Stage already contains object to be added"),this._content.set(i.id,i))}removeMany(e){for(const i of e)i&&(Xt(this._content.has(i.id),"Model/Stage doesn't contain object to be removed"),this._content.delete(i.id))}has(e){return this._content.has(e.id)}forEachOfType(e,i){this._content.forEach(r=>{r.type===e&&i(r)})}getRenderGeometry(e,i){const r=new BP(i,{castShadow:e.castShadow,objectShaderTransformation:e.shaderTransformation});r.transformation=e.getCombinedStaticTransformation(i,Jbe);const{localOrigin:n}=i;return r.localOrigin=n??this._originFactory.getOrigin(r.boundingSphere),r}updateRenderGeometryTransformation(e,i,r){if(e==null)return!1;r.transformation=e.getCombinedStaticTransformation(i,Jbe);const n=this._originFactory.getOrigin(r.boundingSphere);return r.localOrigin!==n}getStats(){const e={},i=Array.from(this._content.values());for(let r=0;rn.type===r).length;return{contentTypes:e,dirtySet:this.dirtySet.formatDebugInfo()}}get test(){return{content:Array.from(this._content.values())}}};y([w({constructOnly:!0})],Ak.prototype,"dirtySet",void 0),Ak=y([Z("esri.views.3d.webgl-engine.parts.Model")],Ak);const Jbe=Qe();let bLt=class{constructor(e){this._totalCount=e,this._indexRanges=[0,e]}allVisible(){return this.componentCount()===this._totalCount}allInvisible(){return this._indexRanges.length===0}componentCount(){const e=this._indexRanges;let i=0;for(let r=0;r(t[a]>0?(s!==a-1&&(r.length&&r.push(i[s+1]-r[r.length-1]),r.push(i[a])),s=a):(o!==a-1&&(n.length&&n.push(i[o+1]-n[n.length-1]),n.push(i[a])),o=a),!0)),r.length&&r.push(i[s+1]-r[r.length-1]),n.length&&n.push(i[o+1]-n[n.length-1]),{highlightRanges:r,defaultRanges:n}}let L4=class extends ze{constructor(){super(...arguments),this.visible=LO.Hidden}destroy(){this.intersectionGeometry=et(this.intersectionGeometry)}};var LO;y([w({autoDestroy:!0})],L4.prototype,"renderable",void 0),y([w({autoDestroy:!0})],L4.prototype,"components",void 0),L4=y([Z("esri.views.3d.webgl-engine.collections.Component.ComponentObject")],L4),function(t){t[t.Hidden=0]="Hidden",t[t.Visible=1]="Visible"}(LO||(LO={}));function TLt(t,e,i,r){if(i>=e)return t;t==null&&(t=ELt());const n=t.isVisibleBit;let s=t.data;const o=ske(s),a=i/o|0,c=i-o*a,p=(e-1)/o|0,_=s,x=r===n;if(!(i<_.length*o)&&x){const S=a+1,C=Math.ceil(_.length*KV),M=p+1;let P=Math.max(S,C);P=Math.min(P,M),s=new Uint32Array(P),s.set(_)}return a{if(!nke(this._components.pickability,M))return!0;const P=this.getComponentAabb(M,RLt);if(o!=null){const k=o[M];s!=null?s.componentOffset=k:(e[2]=S-k,i[2]=C-k)}if(s!=null&&s.applyToAabb(P),!Mle(P,e,x,r))return!0;const $=_[M]/3,F=_[M+1]/3,z=(k,U,j)=>a(M,k,Xh(U,U,n),j);return s==null&&F-$>tke?(this._componentIntersectionData[M]==null&&(this._componentIntersectionData[M]=new Xce(this._indices,$,F,c)),this._componentIntersectionData[M].intersectRay({r0:e,r1:i},z)):n6(e,i,$,F,p,c,void 0,s,z),!0})}_computePerComponentAabbs(){const e=this._components.count,i=$s(6*e),r=this._indices,n=this._positions,s=this._components.offsets;let o=0;for(let a=0;a{const a=o.offsetObb!=null?o.offsetObb:o.obb,c=Ve(Sn(Fd,a.center,r),s),p=_j(a,s);if(A8(i,c-p)&&A8(i,c+p))return;const _=ULt(a,n);if(_===-1)return;if(_===0)return k1.far=c+p,k1.near=c-p,void HP(i,k1);const x=M8.pushNew();x.near=c-p,x.far=c+p,x.mask=_,x.object=o});for(let o=0;o{let _=FLt;for(let x=0;x0;x++){if(!(a.mask&1<t||{near:1/0,far:-1/0,mask:0,object:null},deallocator:t=>(t.object=null,t)}),k1=v6(),zu=W(),o3=W(),NLt=new Pi({deallocator:null}),FLt=new Pi({deallocator:null});function kLt(t,e,i){i.length=0;const r=e.length-3;VY(zu,e,r);const n=gn(t,zu);n<=0&&(i.push(zu[0]),i.push(zu[1]),i.push(zu[2]));let s=0,o=n;for(;st.halfSize[0]?1:0)+3*(Fd[1]<-t.halfSize[1]?-1:Fd[1]>t.halfSize[1]?1:0)+9*(Fd[2]<-t.halfSize[2]?-1:Fd[2]>t.halfSize[2]?1:0)+13),s=Kbe[n];if(s===0)return s;cj(O8,t.quaternion),Foe(O8,O8,t.halfSize);const o=(a,c)=>{const p=Kbe[n+c+1];return Ie(a,((1&p)<<1)-1,(2&p)-1,((4&p)>>1)-1),Xh(a,a,O8),Be(a,t.center,a)};return i.length=0,Uu(i,o(BY,0)),Uu(i,o(ewe,1)),Uu(i,o(Fd,2)),Uu(i,o(twe,3)),r(i),s===1||(i.length=0,Uu(i,BY),Uu(i,twe),Uu(i,o(Fd,4)),Uu(i,o(iwe,5)),r(i),s===2||(i.length=0,Uu(i,BY),Uu(i,iwe),Uu(i,o(Fd,6)),Uu(i,ewe),r(i))),s}const Kbe=(()=>{const t=new Array(216);let e=0;const i=r=>{for(let n=0;n0)return-1;n===0&&(i|=1<r.renderable.material.submit(e,i,r))}queryShadowCasterDepthRange(e){return this._objects.visibleObjects.length?DLt(e,this._objects.visibleObjects):null}};function BLt(t){const e=ls().vec3f(J.POSITION);return t.normals&&e.vec2i16(J.NORMALCOMPRESSED,{glNormalized:!0}),t.textureCoordinates===To.Default?e.vec2f(J.UV0):t.textureCoordinates===To.Atlas&&(e.vec2f(J.UV0),e.vec4u16(J.UVREGION,{glNormalized:!0})),t.colors&&e.vec4u8(J.COLOR,{glNormalized:!0}),e}let jLt=class{constructor(){this.externalColor=Xi(),this.externalColorMixMode=Vo.Multiply,this.castShadows=!0,this.pickable=!0,this.elevationOffset=0}},GLt=class extends Ds{constructor(e,i){super(e,"int",Pr.Draw,(r,n,s)=>r.setUniform1i(e,i(n,s)))}};var zy;(function(t){t[t.Uniform=0]="Uniform",t[t.Varying=1]="Varying",t[t.COUNT=2]="COUNT"})(zy||(zy={}));const Jce=429496.7296;function ake(t,e){JL(t/Jce*.5+.5,e)}function HLt(t,e){switch(e.componentData){case zy.Varying:return qLt(t,e);case zy.Uniform:return WLt(t);case zy.COUNT:return;default:e.componentData}}function qLt(t,e){const{vertex:i,fragment:r}=t;i.include(c0),i.uniforms.add(new kf("componentColorTex",s=>s.componentParameters.texture.texture)),t.attributes.add(J.COMPONENTINDEX,"float"),t.varyings.add("vExternalColorMixMode","mediump float"),t.varyings.add("vExternalColor","vec4");const n=e.output===ue.ObjectAndLayerIdColor;n&&t.varyings.add("vObjectAndLayerIdColor","vec4"),t.include(W6e),i.constants.add("elevationScale","float",2*Jce),i.constants.add("stride","float",$e("enable-feature:objectAndLayerId-rendering")?3:2),i.code.add(V`vec2 getComponentTextureCoordinates(float componentIndex, float typeOffset) { float index = componentIndex * stride + typeOffset; float texSize = float(textureSize(componentColorTex, 0).x); float coordX = mod(index, texSize); @@ -4352,7 +4341,7 @@ return vec2(coordX, coordY) + 0.5; void outputObjectAndLayerIdColor() { ${n?V`fragColor = vObjectAndLayerIdColor;`:""} } -`)}function X9t(t){const{vertex:e,fragment:i}=t;e.uniforms.add(new qU("externalColor",r=>r.componentParameters.externalColor)),i.uniforms.add(new q9t("externalColorMixMode",r=>r.componentParameters.externalColorMixMode)),t.varyings.add("vExternalColor","vec4"),e.code.add(V`float readElevationOffset() { +`)}function WLt(t){const{vertex:e,fragment:i}=t;e.uniforms.add(new WU("externalColor",r=>r.componentParameters.externalColor)),i.uniforms.add(new GLt("externalColorMixMode",r=>r.componentParameters.externalColorMixMode)),t.varyings.add("vExternalColor","vec4"),e.code.add(V`float readElevationOffset() { return 0.0; } vec4 forwardExternalColor(out bool castShadows) { @@ -4362,7 +4351,7 @@ return externalColor; }`),i.code.add(V`void readExternalColor(out vec4 color, out int colorMixMode) { color = vExternalColor; colorMixMode = externalColorMixMode; -}`)}var op;function Z9t(t,e){const i=t.vertex;switch(i.code.add(V`#define VERTEX_DISCARD_CUTOFF (1.0 - 1.0 / 255.0)`),e.vertexDiscardMode){case op.None:i.code.add(V`#define vertexDiscardByOpacity(_opacity_) {}`);break;case op.Opaque:i.code.add(V`#define vertexDiscardByOpacity(_opacity_) { if (_opacity_ > VERTEX_DISCARD_CUTOFF) { gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; } }`);break;case op.Transparent:i.code.add(V`#define vertexDiscardByOpacity(_opacity_) { if (_opacity_ <= VERTEX_DISCARD_CUTOFF) { gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; } }`);break;case op.COUNT:break;default:e.vertexDiscardMode}}(function(t){t[t.None=0]="None",t[t.Transparent=1]="Transparent",t[t.Opaque=2]="Opaque",t[t.COUNT=3]="COUNT"})(op||(op={}));var Ly;function Gpi(t){return t&&r1(t)?Ly.Mars:t&&n1(t)?Ly.Moon:Ly.Earth}(function(t){t[t.Earth=1]="Earth",t[t.Mars=2]="Mars",t[t.Moon=3]="Moon",t[t.COUNT=4]="COUNT"})(Ly||(Ly={}));var ip;(function(t){t[t.None=0]="None",t[t.NoOverlay=1]="NoOverlay",t[t.ColorOverlay=2]="ColorOverlay",t[t.ColorOverlayWithWater=3]="ColorOverlayWithWater",t[t.COUNT=4]="COUNT"})(ip||(ip={}));let lr=class extends nh{constructor(){super(...arguments),this.output=ue.Color,this.textureCoordinateType=So.None,this.componentData=$y.Uniform,this.cullFace=Ln.Back,this.vertexDiscardMode=op.None,this.doubleSidedMode=Is.WindingOrder,this.alphaDiscardMode=mn.Opaque,this.integratedMeshMode=ip.None,this.transparencyPassType=Jt.NONE,this.ellipsoidMode=Ly.Earth,this.pbrMode=ei.Disabled,this.normalType=Br.Attribute,this.spherical=!1,this.doublePrecisionRequiresObfuscation=!1,this.hasVertexColors=!1,this.hasNormals=!1,this.hasSlicePlane=!1,this.hasColorTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.blendingEnabled=!0,this.hasScreenSpaceReflections=!1,this.hasPolygonOffset=!1,this.hasMetallicRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.hasCloudsReflections=!0,this.snowCover=!1,this.objectAndLayerIdColor=!1}};y([fe({count:ue.COUNT})],lr.prototype,"output",void 0),y([fe({count:So.COUNT})],lr.prototype,"textureCoordinateType",void 0),y([fe({count:$y.COUNT})],lr.prototype,"componentData",void 0),y([fe({count:Ln.COUNT})],lr.prototype,"cullFace",void 0),y([fe({count:op.COUNT})],lr.prototype,"vertexDiscardMode",void 0),y([fe({count:Is.COUNT})],lr.prototype,"doubleSidedMode",void 0),y([fe({count:mn.COUNT})],lr.prototype,"alphaDiscardMode",void 0),y([fe({count:ip.COUNT})],lr.prototype,"integratedMeshMode",void 0),y([fe({count:Jt.COUNT})],lr.prototype,"transparencyPassType",void 0),y([fe({count:Ly.COUNT})],lr.prototype,"ellipsoidMode",void 0),y([fe({count:ei.COUNT})],lr.prototype,"pbrMode",void 0),y([fe({count:Br.COUNT})],lr.prototype,"normalType",void 0),y([fe()],lr.prototype,"spherical",void 0),y([fe()],lr.prototype,"doublePrecisionRequiresObfuscation",void 0),y([fe()],lr.prototype,"hasVertexColors",void 0),y([fe()],lr.prototype,"hasNormals",void 0),y([fe()],lr.prototype,"hasSlicePlane",void 0),y([fe()],lr.prototype,"hasColorTexture",void 0),y([fe()],lr.prototype,"receiveAmbientOcclusion",void 0),y([fe()],lr.prototype,"receiveShadows",void 0),y([fe()],lr.prototype,"blendingEnabled",void 0),y([fe()],lr.prototype,"hasScreenSpaceReflections",void 0),y([fe()],lr.prototype,"hasPolygonOffset",void 0),y([fe()],lr.prototype,"hasMetallicRoughnessTexture",void 0),y([fe()],lr.prototype,"hasEmissionTexture",void 0),y([fe()],lr.prototype,"hasOcclusionTexture",void 0),y([fe()],lr.prototype,"hasNormalTexture",void 0),y([fe()],lr.prototype,"hasOccludees",void 0),y([fe()],lr.prototype,"multipassEnabled",void 0),y([fe()],lr.prototype,"cullAboveGround",void 0),y([fe()],lr.prototype,"hasCloudsReflections",void 0),y([fe()],lr.prototype,"snowCover",void 0),y([fe()],lr.prototype,"objectAndLayerIdColor",void 0),y([fe({constValue:!1})],lr.prototype,"occlusionPass",void 0),y([fe({constValue:Or.Draw})],lr.prototype,"pbrTextureBindType",void 0),y([fe({constValue:!0})],lr.prototype,"hasSliceHighlight",void 0),y([fe({constValue:!1})],lr.prototype,"hasSliceInVertexProgram",void 0),y([fe({constValue:!1})],lr.prototype,"useCustomDTRExponentForWater",void 0),y([fe({constValue:!1})],lr.prototype,"hasVertexTangents",void 0),y([fe({constValue:!0})],lr.prototype,"supportsTextureAtlas",void 0),y([fe({constValue:!1})],lr.prototype,"highStepCount",void 0),y([fe({constValue:!1})],lr.prototype,"instancedDoublePrecision",void 0),y([fe({constValue:!1})],lr.prototype,"hasModelTransformation",void 0),y([fe({constValue:!0})],lr.prototype,"useFillLights",void 0),y([fe({constValue:!1})],lr.prototype,"objectAndLayerIdColorInstanced",void 0);function iwe(t,e){t.include(ME,e),t.fragment.include(kL);const i=t.fragment;i.uniforms.add(new qU("baseColor",r=>r.baseColor)),i.uniforms.add(new bT("objectOpacity",r=>r.objectOpacity)),e.hasVertexColors?i.code.add(V`vec3 _baseColor() { +}`)}var up;function YLt(t,e){const i=t.vertex;switch(i.code.add(V`#define VERTEX_DISCARD_CUTOFF (1.0 - 1.0 / 255.0)`),e.vertexDiscardMode){case up.None:i.code.add(V`#define vertexDiscardByOpacity(_opacity_) {}`);break;case up.Opaque:i.code.add(V`#define vertexDiscardByOpacity(_opacity_) { if (_opacity_ > VERTEX_DISCARD_CUTOFF) { gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; } }`);break;case up.Transparent:i.code.add(V`#define vertexDiscardByOpacity(_opacity_) { if (_opacity_ <= VERTEX_DISCARD_CUTOFF) { gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; } }`);break;case up.COUNT:break;default:e.vertexDiscardMode}}(function(t){t[t.None=0]="None",t[t.Transparent=1]="Transparent",t[t.Opaque=2]="Opaque",t[t.COUNT=3]="COUNT"})(up||(up={}));var Uy;function Jfi(t){return t&&u1(t)?Uy.Mars:t&&h1(t)?Uy.Moon:Uy.Earth}(function(t){t[t.Earth=1]="Earth",t[t.Mars=2]="Mars",t[t.Moon=3]="Moon",t[t.COUNT=4]="COUNT"})(Uy||(Uy={}));var op;(function(t){t[t.None=0]="None",t[t.NoOverlay=1]="NoOverlay",t[t.ColorOverlay=2]="ColorOverlay",t[t.ColorOverlayWithWater=3]="ColorOverlayWithWater",t[t.COUNT=4]="COUNT"})(op||(op={}));let lr=class extends oh{constructor(){super(...arguments),this.output=ue.Color,this.textureCoordinateType=To.None,this.componentData=zy.Uniform,this.cullFace=Ln.Back,this.vertexDiscardMode=up.None,this.doubleSidedMode=Ls.WindingOrder,this.alphaDiscardMode=yn.Opaque,this.integratedMeshMode=op.None,this.transparencyPassType=Jt.NONE,this.ellipsoidMode=Uy.Earth,this.pbrMode=ti.Disabled,this.normalType=Br.Attribute,this.spherical=!1,this.doublePrecisionRequiresObfuscation=!1,this.hasVertexColors=!1,this.hasNormals=!1,this.hasSlicePlane=!1,this.hasColorTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.blendingEnabled=!0,this.hasScreenSpaceReflections=!1,this.hasPolygonOffset=!1,this.hasMetallicRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.hasCloudsReflections=!0,this.snowCover=!1,this.objectAndLayerIdColor=!1}};y([fe({count:ue.COUNT})],lr.prototype,"output",void 0),y([fe({count:To.COUNT})],lr.prototype,"textureCoordinateType",void 0),y([fe({count:zy.COUNT})],lr.prototype,"componentData",void 0),y([fe({count:Ln.COUNT})],lr.prototype,"cullFace",void 0),y([fe({count:up.COUNT})],lr.prototype,"vertexDiscardMode",void 0),y([fe({count:Ls.COUNT})],lr.prototype,"doubleSidedMode",void 0),y([fe({count:yn.COUNT})],lr.prototype,"alphaDiscardMode",void 0),y([fe({count:op.COUNT})],lr.prototype,"integratedMeshMode",void 0),y([fe({count:Jt.COUNT})],lr.prototype,"transparencyPassType",void 0),y([fe({count:Uy.COUNT})],lr.prototype,"ellipsoidMode",void 0),y([fe({count:ti.COUNT})],lr.prototype,"pbrMode",void 0),y([fe({count:Br.COUNT})],lr.prototype,"normalType",void 0),y([fe()],lr.prototype,"spherical",void 0),y([fe()],lr.prototype,"doublePrecisionRequiresObfuscation",void 0),y([fe()],lr.prototype,"hasVertexColors",void 0),y([fe()],lr.prototype,"hasNormals",void 0),y([fe()],lr.prototype,"hasSlicePlane",void 0),y([fe()],lr.prototype,"hasColorTexture",void 0),y([fe()],lr.prototype,"receiveAmbientOcclusion",void 0),y([fe()],lr.prototype,"receiveShadows",void 0),y([fe()],lr.prototype,"blendingEnabled",void 0),y([fe()],lr.prototype,"hasScreenSpaceReflections",void 0),y([fe()],lr.prototype,"hasPolygonOffset",void 0),y([fe()],lr.prototype,"hasMetallicRoughnessTexture",void 0),y([fe()],lr.prototype,"hasEmissionTexture",void 0),y([fe()],lr.prototype,"hasOcclusionTexture",void 0),y([fe()],lr.prototype,"hasNormalTexture",void 0),y([fe()],lr.prototype,"hasOccludees",void 0),y([fe()],lr.prototype,"multipassEnabled",void 0),y([fe()],lr.prototype,"cullAboveGround",void 0),y([fe()],lr.prototype,"hasCloudsReflections",void 0),y([fe()],lr.prototype,"snowCover",void 0),y([fe()],lr.prototype,"objectAndLayerIdColor",void 0),y([fe({constValue:!1})],lr.prototype,"occlusionPass",void 0),y([fe({constValue:Pr.Draw})],lr.prototype,"pbrTextureBindType",void 0),y([fe({constValue:!0})],lr.prototype,"hasSliceHighlight",void 0),y([fe({constValue:!1})],lr.prototype,"hasSliceInVertexProgram",void 0),y([fe({constValue:!1})],lr.prototype,"useCustomDTRExponentForWater",void 0),y([fe({constValue:!1})],lr.prototype,"hasVertexTangents",void 0),y([fe({constValue:!0})],lr.prototype,"supportsTextureAtlas",void 0),y([fe({constValue:!1})],lr.prototype,"highStepCount",void 0),y([fe({constValue:!1})],lr.prototype,"instancedDoublePrecision",void 0),y([fe({constValue:!1})],lr.prototype,"hasModelTransformation",void 0),y([fe({constValue:!0})],lr.prototype,"useFillLights",void 0),y([fe({constValue:!1})],lr.prototype,"objectAndLayerIdColorInstanced",void 0);function rwe(t,e){t.include(LE,e),t.fragment.include(WL);const i=t.fragment;i.uniforms.add(new WU("baseColor",r=>r.baseColor)),i.uniforms.add(new AT("objectOpacity",r=>r.objectOpacity)),e.hasVertexColors?i.code.add(V`vec3 _baseColor() { return baseColor.rgb * vColor.rgb; } float _baseOpacity() { @@ -4388,19 +4377,19 @@ externalColor.a, externalColorMixMode ); return vec4(color, opacity); -}`)}function rwe(t,e){const i=t.fragment;switch(e.doubleSidedMode){case Is.None:i.code.add(V`vec3 _adjustDoublesided(vec3 normal) { +}`)}function nwe(t,e){const i=t.fragment;switch(e.doubleSidedMode){case Ls.None:i.code.add(V`vec3 _adjustDoublesided(vec3 normal) { return normal; -}`);break;case Is.View:t.include(gO,e),i.code.add(V`vec3 _adjustDoublesided(vec3 normal) { +}`);break;case Ls.View:t.include(SO,e),i.code.add(V`vec3 _adjustDoublesided(vec3 normal) { return dot(normal, vPositionWorldCameraRelative) > 0.0 ? -normal : normal; -}`);break;case Is.WindingOrder:i.code.add(V`vec3 _adjustDoublesided(vec3 normal) { +}`);break;case Ls.WindingOrder:i.code.add(V`vec3 _adjustDoublesided(vec3 normal) { return gl_FrontFacing ? normal : -normal; -}`);break;default:e.doubleSidedMode;case Is.COUNT:}switch(e.normalType){case Br.Attribute:case Br.Compressed:t.include(nG,e),i.code.add(V`vec3 shadingNormalWorld() { +}`);break;default:e.doubleSidedMode;case Ls.COUNT:}switch(e.normalType){case Br.Attribute:case Br.Compressed:t.include(fG,e),i.code.add(V`vec3 shadingNormalWorld() { return _adjustDoublesided(normalize(vNormalWorld)); } vec3 shadingNormal_view() { vec3 normal = normalize(vNormalView); return gl_FrontFacing ? normal : -normal; -}`);break;case Br.ScreenDerivative:t.include(gO,e),i.code.add(V`vec3 shadingNormalWorld() { +}`);break;case Br.ScreenDerivative:t.include(SO,e),i.code.add(V`vec3 shadingNormalWorld() { return normalize(cross( dFdx(vPositionWorldCameraRelative), dFdy(vPositionWorldCameraRelative) @@ -4408,18 +4397,18 @@ dFdy(vPositionWorldCameraRelative) } vec3 shadingNormal_view() { return normalize(cross(dFdx(vPosition_view),dFdy(vPosition_view))); -}`);break;case Br.Ground:e.spherical?(t.include(gO,e),i.code.add(V`vec3 shadingNormalWorld() { +}`);break;case Br.Ground:e.spherical?(t.include(SO,e),i.code.add(V`vec3 shadingNormalWorld() { return normalize(positionWorld()); }`)):i.code.add(V`vec3 shadingNormalWorld() { return vec3(0.0, 0.0, 1.0); }`),i.code.add(V`vec3 shadingNormal_view() { return normalize(cross(dFdx(vPosition_view),dFdy(vPosition_view))).xyz; -}`);break;default:e.normalType;case Br.COUNT:}}function J9t(t,e){const i=t.fragment;if(e.hasColorTexture&&(e.output===ue.Color||e.alphaDiscardMode!==mn.Opaque)){t.include(bae,e);const r=e.textureCoordinateType===So.Atlas;i.uniforms.add(new $f("baseColorTexture",n=>n.texture)),r?(t.include(m$e),i.code.add(V`vec4 readBaseColorTexture() { +}`);break;default:e.normalType;case Br.COUNT:}}function XLt(t,e){const i=t.fragment;if(e.hasColorTexture&&(e.output===ue.Color||e.alphaDiscardMode!==yn.Opaque)){t.include($ae,e);const r=e.textureCoordinateType===To.Atlas;i.uniforms.add(new kf("baseColorTexture",n=>n.texture)),r?(t.include(h$e),i.code.add(V`vec4 readBaseColorTexture() { return textureAtlasLookup(baseColorTexture, vuv0, vuvRegion); }`)):i.code.add(V`vec4 readBaseColorTexture() { return texture(baseColorTexture, vuv0); -}`)}else i.code.add(V`vec4 readBaseColorTexture() { return vec4(1.0); }`)}function uke(t){const e=new Cr;e.include(gO,t),e.include(nG,t),e.include(ME,t),e.include(My,t),e.include(wP,t),e.include(W9t,t),e.include(_3t,t),e.include(K2t,t),e.include(J9t,t),e.include(Z9t,t);const{vertex:i,fragment:r}=e;t.pbrMode!==ei.Normal&&t.pbrMode!==ei.Schematic||(e.include(xae,t),t.hasNormalTexture&&e.include(iDe,t));const n=t.output===ue.Shadow||t.output===ue.ShadowHighlight||t.output===ue.ShadowExcludeHighlight;n&&t.componentData===$y.Varying?i.code.add(V`#define discardShadows(castShadows) { if(!castShadows) { gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; } }`):i.code.add(V`#define discardShadows(castShadows) {}`);const s=t.integratedMeshMode===ip.ColorOverlay||t.integratedMeshMode===ip.ColorOverlayWithWater,o=s&&t.output===ue.Color&&t.pbrMode===ei.WaterOnIntegratedMesh;return s&&(e.include(JT,t),e.include(ATt,t),t.spherical?i.code.add(V` - const float invEllipsoidRadius = ${V.float(1/(t.ellipsoidMode===Ly.Earth?Mr.radius:t.ellipsoidMode===Ly.Mars?Sy.radius:u_.radius))}; +}`)}else i.code.add(V`vec4 readBaseColorTexture() { return vec4(1.0); }`)}function lke(t){const e=new Ar;e.include(SO,t),e.include(fG,t),e.include(LE,t),e.include(Ly,t),e.include(R5,t),e.include(HLt,t),e.include(vxt,t),e.include(Jwt,t),e.include(XLt,t),e.include(YLt,t);const{vertex:i,fragment:r}=e;t.pbrMode!==ti.Normal&&t.pbrMode!==ti.Schematic||(e.include(Dae,t),t.hasNormalTexture&&e.include(K6e,t));const n=t.output===ue.Shadow||t.output===ue.ShadowHighlight||t.output===ue.ShadowExcludeHighlight;n&&t.componentData===zy.Varying?i.code.add(V`#define discardShadows(castShadows) { if(!castShadows) { gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; } }`):i.code.add(V`#define discardShadows(castShadows) {}`);const s=t.integratedMeshMode===op.ColorOverlay||t.integratedMeshMode===op.ColorOverlayWithWater,o=s&&t.output===ue.Color&&t.pbrMode===ti.WaterOnIntegratedMesh;return s&&(e.include(iE,t),e.include(CSt,t),t.spherical?i.code.add(V` + const float invEllipsoidRadius = ${V.float(1/(t.ellipsoidMode===Uy.Earth?Or.radius:t.ellipsoidMode===Uy.Mars?My.radius:y_.radius))}; vec2 projectOverlay(vec3 pos) { return pos.xy / (1.0 + invEllipsoidRadius * pos.z); } @@ -4433,7 +4422,7 @@ return texture(baseColorTexture, vuv0); ${t.output===ue.ObjectAndLayerIdColor?V`externalColor.a = 1.0;`:""} - if (externalColor.a < ${V.float(Cl)}) { + if (externalColor.a < ${V.float(Ml)}) { // Discard this vertex gl_Position = vec4(1e38, 1e38, 1e38, 1.0); return; @@ -4454,7 +4443,7 @@ return texture(baseColorTexture, vuv0); tbnBiTangent = vec3(0.0, 1.0, 0.0);`:""} ${s?V`setOverlayVTC(projectOverlay(position));`:""} } - `),t.output===ue.Alpha&&(r.include(Kf),e.include(dd,t),e.include(iwe,t),s&&r.uniforms.add(new Zt("ovColorTex",(l,c)=>uie(l,c))),r.code.add(V` + `),t.output===ue.Alpha&&(r.include(i0),e.include(gd,t),e.include(rwe,t),s&&r.uniforms.add(new Zt("ovColorTex",(a,c)=>vie(a,c))),r.code.add(V` void main() { discardBySlice(vPositionWorldCameraRelative); ${t.multipassEnabled?V`terrainDepthTest(vPosition_view.z);`:""} @@ -4477,9 +4466,9 @@ return texture(baseColorTexture, vuv0); fragColor = vec4(materialColor.a); } - `)),t.output===ue.Color&&(r.include(Kf),e.include(dd,t),e.include(iwe,t),e.include(rwe,t),e.include(JT,t),t.receiveShadows?(e.include(lG,t),r.code.add(V`float evaluateShadow() { + `)),t.output===ue.Color&&(r.include(i0),e.include(gd,t),e.include(rwe,t),e.include(nwe,t),e.include(iE,t),t.receiveShadows?(e.include(vG,t),r.code.add(V`float evaluateShadow() { return readShadowMap(vPositionWorldCameraRelative, linearDepth); -}`)):r.code.add(V`float evaluateShadow() { return 0.0; }`),s&&r.uniforms.add(new Zt("ovColorTex",(l,c)=>uie(l,c))),r.code.add(V` +}`)):r.code.add(V`float evaluateShadow() { return 0.0; }`),s&&r.uniforms.add(new Zt("ovColorTex",(a,c)=>vie(a,c))),r.code.add(V` void main() { discardBySlice(vPositionWorldCameraRelative); ${t.multipassEnabled?V`terrainDepthTest(vPosition_view.z);`:""} @@ -4497,8 +4486,8 @@ return readShadowMap(vPositionWorldCameraRelative, linearDepth); externalColorMixMode ); ${s?V`vec4 overlayColor = getOverlayColor(ovColorTex, vtcOverlay);`:""} - `),t.pbrMode===ei.Normal||t.pbrMode===ei.Schematic?(a1(r),r.code.add(V` - ${t.pbrMode===ei.Normal?V` + `),t.pbrMode===ti.Normal||t.pbrMode===ti.Schematic?(m1(r),r.code.add(V` + ${t.pbrMode===ti.Normal?V` applyPBRFactors(); if (int(externalColorMixMode) == 3) { mrr = vec3(0.0, 0.6, 0.2); @@ -4525,8 +4514,8 @@ vec3 shadingNormal = computeTextureNormal(tangentSpace, vuv0);`):r.code.add(V`ve vec3 additionalLight = evaluateAdditionalLighting(ssao, positionWorld()); vec4 shadedColor = vec4(evaluateSceneLightingPBR(shadingNormal, materialColor.rgb, evaluateShadow(), ssao, additionalLight, viewDir, normalGround, mrr, emission, additionalIrradiance), materialColor.a); - `)):(t.receiveShadows?r.code.add(V`float shadow = evaluateShadow();`):t.spherical?(CP(r),r.code.add(V`float additionalAmbientScale = additionalDirectedAmbientLight(positionWorld()); -float shadow = lightingGlobalFactor * (1.0 - additionalAmbientScale);`)):r.code.add(V`float shadow = 0.0;`),o&&r.uniforms.add(new Zt("ovNormalTex",(l,c)=>{var f;return(f=c.overlay)==null?void 0:f.getTexture(ns.WaterNormal)})),t.snowCover&&r.code.add(V`vec3 surfaceNormal = normalize(cross(dFdx(vPositionWorldCameraRelative), dFdy(vPositionWorldCameraRelative))); + `)):(t.receiveShadows?r.code.add(V`float shadow = evaluateShadow();`):t.spherical?(N5(r),r.code.add(V`float additionalAmbientScale = additionalDirectedAmbientLight(positionWorld()); +float shadow = lightingGlobalFactor * (1.0 - additionalAmbientScale);`)):r.code.add(V`float shadow = 0.0;`),o&&r.uniforms.add(new Zt("ovNormalTex",(a,c)=>{var p;return(p=c.overlay)==null?void 0:p.getTexture(ns.WaterNormal)})),t.snowCover&&r.code.add(V`vec3 surfaceNormal = normalize(cross(dFdx(vPositionWorldCameraRelative), dFdy(vPositionWorldCameraRelative))); float snow = smoothstep(0.5, 0.55, dot(surfaceNormal, normalize(positionWorld()))); materialColor.rgb = mix(materialColor.rgb, vec3(1), snow);`),r.code.add(V` float ambientOcclusion = evaluateAmbientOcclusion(); @@ -4549,12 +4538,12 @@ materialColor.rgb = mix(materialColor.rgb, vec3(1), snow);`),r.code.add(V` fragColor = highlightSlice(shadedColor, vPositionWorldCameraRelative); ${t.transparencyPassType===Jt.Color?"fragColor = premultiplyAlpha(fragColor);":""} } - `)),(t.output===ue.Depth||n)&&(e.include(E_,t),r.code.add(V`void main() { + `)),(t.output===ue.Depth||n)&&(e.include(I_,t),r.code.add(V`void main() { discardBySlice(vPositionWorldCameraRelative); vec4 textureColor = readBaseColorTexture(); discardOrAdjustAlpha(textureColor); outputDepth(linearDepth); -}`)),t.output===ue.Normal&&(e.include(rwe,t),r.code.add(V` +}`)),t.output===ue.Normal&&(e.include(nwe,t),r.code.add(V` void main() { discardBySlice(vPositionWorldCameraRelative); @@ -4575,7 +4564,7 @@ outputDepth(linearDepth); ${s?V`fragColor = getOverlayColorTexel(vtcOverlay);`:"outputObjectAndLayerIdColor();"} } - `),t.output===ue.Highlight&&(e.include(dx),r.code.add(V` + `),t.output===ue.Highlight&&(e.include(vx),r.code.add(V` void main() { discardBySlice(vPositionWorldCameraRelative); @@ -4591,12 +4580,12 @@ outputDepth(linearDepth); outputHighlight(); } - `)),e}const K9t=Object.freeze(Object.defineProperty({__proto__:null,build:uke},Symbol.toStringTag,{value:"Module"}));let hke=class dke extends Hr{initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global,i.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result}initializeProgram(e){return new Ir(e.rctx,dke.shader.get().build(this.configuration),pke)}_setPipelineState(e){const i=this.configuration,r=i.integratedMeshMode!==ip.None,n=e===Jt.NONE,s=e===Jt.FrontFace;return Ti({blending:i.output!==ue.Color&&i.output!==ue.Alpha||!i.blendingEnabled?null:n?vp:Y_(e),culling:Mj(i.cullFace),depthTest:{func:px(e)},depthWrite:n||s?rh:null,colorWrite:ji,stencilWrite:r||i.hasOccludees?Jy:null,stencilTest:r?g3t(Zu.IntegratedMeshMaskExcluded):i.hasOccludees?fx:null,polygonOffset:n||s?i.hasPolygonOffset?{factor:2,units:2}:null:eG})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}};hke.shader=new Rr(K9t,()=>we(()=>Promise.resolve().then(()=>zWt),void 0));const pke=new Map([[J.POSITION,0],[J.NORMAL,1],[J.NORMALCOMPRESSED,1],[J.COLOR,2],[J.UV0,3],[J.UVREGION,4],[J.COMPONENTINDEX,5]]);let Q9t=class extends _n{constructor(){super(...arguments),this._dirty=!0}_setDirty(){this._dirty=!0}_setClean(){if(this._dirty=!1,this._parameterBlocks!=null)for(const e of this._parameterBlocks)this[e]._setClean()}get dirty(){return this._dirty||this._checkParameterBlocksDirty()}_checkParameterBlocksDirty(){if(this._parameterBlocks==null)return!1;for(const e of this._parameterBlocks)if(this[e].dirty)return!0;return!1}},zce=class{constructor(){this._dirty=!0}_setDirty(){this._dirty=!0}_setClean(){this._dirty=!1}get dirty(){return this._dirty}};function Vs(t={}){return(e,i)=>{const r=e._parameterCount??0;if(e._parameterCount=r+1,t.vectorOps){const n=t.vectorOps;Object.defineProperty(e,i,{get(){return this[r]},set(s){const o=this[r];if(o==null)this[r]=s;else{if(n.equals(o,s))return;n.copy(o,s)}this._setDirty()}})}else Object.defineProperty(e,i,{get(){return this[r]},set(n){this[r]!==n&&(t.dispose&&this[r]&&this[r].dispose(),this[r]=n,this._setDirty())}})}}function nwe(){return(t,e)=>{const i=t._parameterCount??0;t._parameterCount=i+1,t._parameterBlocks=t._parameterBlocks||[],t._parameterBlocks.push(i),Object.defineProperty(t,e,{get(){return this[i]},set(r){this[i]!==r&&(this[i]=r,this._setDirty())}})}}let PG=class{constructor(e){this._low=W(),this._high=W(),e&&this.set(e)}get low(){return this._low}get high(){return this._high}set(e){Ne(this._low,Ne(swe,e));const i=xn(swe,e,this._low);Ne(this._high,i)}get(e){return Be(e,this._low,this._high)}getLowScaled(e){return De(e,this._low,1)}};const swe=Bs();let Fa=class extends Q9t{constructor(e,i){super(),this.toMapSpace=i,this.baseColor=Mi(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=mc(sG),this.emissiveFactor=nt(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.objectOpacity=1,this.commonMaterialParameters=new vk,this.componentParameters=new U$,this.textureAlphaCutoff=UU,this.alphaDiscardMode=mn.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=Ly.Earth,this.hasOccludees=!1,this._techniqueConfiguration=new lr;const r=new PG(e.position),n=hDe(e.rotationScale);_E(n,n),this.transformNormalGlobalFromModel=EPe(Xf(n,n)),this.transformWorldFromModelTL=r.low,this.transformWorldFromModelTH=r.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this._technique=ir(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return this.baseColorTexture!=null?this.baseColorTexture.glTexture:null}get textureMetallicRoughness(){return this.metallicRoughnessTexture!=null?this.metallicRoughnessTexture.glTexture:null}get textureEmissive(){return this.emissionTexture!=null?this.emissionTexture.glTexture:null}get textureOcclusion(){return this.occlusionTexture!=null?this.occlusionTexture.glTexture:null}get textureNormal(){return this.normalTexture!=null?this.normalTexture.glTexture:null}prepareTechnique(e,i,r,n){const s=this._techniqueConfiguration;s.hasVertexColors=n.colors,s.hasNormals=n.normals,s.textureCoordinateType=n.textureCoordinates,s.hasMetallicRoughnessTexture=this.metallicRoughnessTexture!=null,s.hasEmissionTexture=this.emissionTexture!=null,s.hasOcclusionTexture=this.occlusionTexture!=null,s.hasNormalTexture=this.normalTexture!=null,s.transparencyPassType=i.identifier===Hh.Material&&r.transparencyPassType!=null?r.transparencyPassType:Jt.NONE,s.multipassEnabled=i.identifier===Hh.Material&&r.multipassEnabled,s.cullAboveGround=i.identifier===Hh.Material&&r.multipassTerrain.cullAboveGround,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?Is.View:Is.None,s.hasColorTexture=this.baseColorTexture!=null;const o=this._computeWhichMaterialPass();if(s.blendingEnabled=o===Jc.Transparent||o===Jc.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?i6t(r)?t6t(r)?ip.ColorOverlayWithWater:ip.ColorOverlay:ip.NoOverlay:ip.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===ip.ColorOverlayWithWater?ei.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?ei.Schematic:ei.Normal:ei.Disabled,s.normalType=s.integratedMeshMode===ip.None?s.hasNormals?Br.Compressed:Br.ScreenDerivative:Br.Ground,s.hasSlicePlane=r.slicePlane!=null&&this.commonMaterialParameters.hasSlicePlane,i.identifier===Hh.ShadowMap)s.output=ue.Shadow,s.vertexDiscardMode=op.None;else if(i.identifier===Hh.Highlight)s.output=ue.Highlight,s.vertexDiscardMode=op.None;else{switch(o===Jc.OpaqueAndTransparent?s.vertexDiscardMode=i.transparent?op.Opaque:op.Transparent:s.vertexDiscardMode=op.None,s.output=i.output,s.receiveAmbientOcclusion=!1,s.receiveShadows=!1,i.output){case ue.Color:s.receiveAmbientOcclusion=r.ssao!=null,s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.hasScreenSpaceReflections=r.ssr.lastFrameColor!=null,s.hasCloudsReflections=r.cloudsFade.data!=null;break;case ue.Alpha:s.hasOccludees=r.hasOccludees;break;case ue.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=this.hasSnowCover(r)}return this._technique=e.releaseAndAcquire(hke,s,this._technique),this._setClean(),this._technique}hasSnowCover(e){return e.weather!=null&&e.weatherVisible&&e.weather.type==="snowy"&&e.weather.snowCover==="enabled"}submit(e,i,r){if(this.objectOpacity===0)return;const n=r.renderable.geometry,s=r.components,o=r.renderable.meta.cameraDepthSquared,l=s.geometryRanges,c=s.highlightRanges,f=s.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case Jc.Opaque:e.materialOpaque.submitDraw(this,n,l,o);break;case Jc.Transparent:e.materialTransparent.submitDraw(this,n,l,o);break;case Jc.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,n,l,o),e.materialTransparent.submitDraw(this,n,l,o);break;case Jc.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,n,l,o),e6t(i)&&e.highlightIntegratedMesh.submitDraw(this,n,l,o)}const _=this.componentParameters.castShadows!==Ta.None;_&&e.shadowMap.submitDraw(this,n,l,o),c!=null&&(e.highlight.submitDraw(this,n,c,o),_&&e.highlightShadowMap.submitDraw(this,n,c,o)),_&&f!=null&&e.defaultShadowMap.submitDraw(this,n,f,o)}_computeWhichMaterialPass(){return this.isIntegratedMesh?Jc.IntegratedMesh:this.objectOpacity<1?Jc.Transparent:this.componentParameters.opaqueOverride===Ta.All?Jc.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===mn.Blend||this.alphaDiscardMode===mn.MaskBlend?Jc.Transparent:this.componentParameters.transparent===Ta.None?Jc.Opaque:this.componentParameters.transparent===Ta.All?Jc.Transparent:Jc.OpaqueAndTransparent}};var Jc,Ta;y([Vs({vectorOps:xAe})],Fa.prototype,"baseColor",void 0),y([Vs()],Fa.prototype,"usePBR",void 0),y([Vs()],Fa.prototype,"hasParametersFromSource",void 0),y([Vs({vectorOps:Jde})],Fa.prototype,"mrrFactors",void 0),y([Vs({vectorOps:Jde})],Fa.prototype,"emissiveFactor",void 0),y([Vs({dispose:!0})],Fa.prototype,"baseColorTexture",void 0),y([Vs({dispose:!0})],Fa.prototype,"metallicRoughnessTexture",void 0),y([Vs({dispose:!0})],Fa.prototype,"emissionTexture",void 0),y([Vs({dispose:!0})],Fa.prototype,"occlusionTexture",void 0),y([Vs({dispose:!0})],Fa.prototype,"normalTexture",void 0),y([Vs()],Fa.prototype,"objectOpacity",void 0),y([nwe()],Fa.prototype,"commonMaterialParameters",void 0),y([nwe()],Fa.prototype,"componentParameters",void 0),y([Vs()],Fa.prototype,"textureAlphaCutoff",void 0),y([Vs()],Fa.prototype,"alphaDiscardMode",void 0),y([Vs()],Fa.prototype,"isIntegratedMesh",void 0),y([Vs()],Fa.prototype,"polygonOffsetEnabled",void 0),y([Vs()],Fa.prototype,"ellipsoidMode",void 0),y([Vs()],Fa.prototype,"hasOccludees",void 0),function(t){t[t.Opaque=0]="Opaque",t[t.Transparent=1]="Transparent",t[t.OpaqueAndTransparent=2]="OpaqueAndTransparent",t[t.IntegratedMesh=3]="IntegratedMesh"}(Jc||(Jc={}));let vk=class extends zce{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=Ln.Back,this.hasSlicePlane=!0}};y([Vs()],vk.prototype,"doubleSided",void 0),y([Vs()],vk.prototype,"cullFace",void 0),y([Vs()],vk.prototype,"hasSlicePlane",void 0);let U$=class extends zce{constructor(){super(...arguments),this.externalColor=Mi(1,1,1,1),this.externalColorMixMode=Uo.Multiply,this.castShadows=Ta.All}get transparent(){return this.externalColor[3]<1?Ta.All:Ta.None}get opaqueOverride(){return this.externalColorMixMode===Uo.Replace&&this.externalColor[3]===1?Ta.All:Ta.None}get visible(){return this.externalColor[3]>0?Ta.All:Ta.None}get type(){return $y.Uniform}};y([Vs({vectorOps:xAe})],U$.prototype,"externalColor",void 0),y([Vs()],U$.prototype,"externalColorMixMode",void 0),y([Vs()],U$.prototype,"castShadows",void 0),function(t){t[t.All=0]="All",t[t.Some=1]="Some",t[t.None=2]="None"}(Ta||(Ta={}));let TI=class extends zce{constructor(){super(...arguments),this.texture=null,this.transparent=Ta.None,this.opaqueOverride=Ta.None,this.castShadows=Ta.None}get type(){return $y.Varying}};function e6t(t){var e;return((e=t.overlay)==null?void 0:e.getTexture(ns.Highlight))!=null}function t6t(t){var e;return((e=t.overlay)==null?void 0:e.getTexture(ns.WaterNormal))!=null}function i6t(t){var e;return((e=t.overlay)==null?void 0:e.getTexture(ns.ColorNoRasterImage))!=null}y([Vs()],TI.prototype,"texture",void 0),y([Vs()],TI.prototype,"transparent",void 0),y([Vs()],TI.prototype,"opaqueOverride",void 0),y([Vs()],TI.prototype,"castShadows",void 0);const fV=ls().vec3f(J.POSITION).u16(J.COMPONENTINDEX),fke=ls().vec2u8(J.SIDENESS),r6t=md(fke),Zie=ls().vec3f(J.POSITION0).vec3f(J.POSITION1).vec3f(J.NORMAL).u16(J.COMPONENTINDEX).u8(J.VARIANTOFFSET,{glNormalized:!0}).u8(J.VARIANTSTROKE).u8(J.VARIANTEXTENSION,{glNormalized:!0}),Jie=ls().vec3f(J.POSITION0).vec3f(J.POSITION1).vec3f(J.NORMALA).vec3f(J.NORMALB).u16(J.COMPONENTINDEX).u8(J.VARIANTOFFSET,{glNormalized:!0}).u8(J.VARIANTSTROKE).u8(J.VARIANTEXTENSION,{glNormalized:!0}),mke=new Map([[J.POSITION0,0],[J.POSITION1,1],[J.COMPONENTINDEX,2],[J.VARIANTOFFSET,3],[J.VARIANTSTROKE,4],[J.VARIANTEXTENSION,5],[J.NORMAL,6],[J.NORMALA,6],[J.NORMALB,7],[J.SIDENESS,8]]);function owe(t,e,i){const r=e/3,n=new Uint32Array(i+1),s=new Uint32Array(i+1),o=(F,z)=>{F{if(F{const k=2*F,U=z-F;for(let j=1;j=0&&f[k+2*Q]>H;Q--)f[k+2*Q+2]=f[k+2*Q],f[k+2*Q+3]=f[k+2*Q+1];f[k+2*Q+2]=H,f[k+2*Q+3]=Y}};for(let F=0;FF===t[3*z]?0:F===t[3*z+1]?1:F===t[3*z+2]?2:-1,I=(F,z)=>{const k=M(F,z);A[3*z+k]=-1},L=(F,z,k,U)=>{const j=M(F,z);A[3*z+j]=U;const H=M(k,U);A[3*U+H]=z};for(let F=0;F{n.getVec(L[4*Ee],x),n.getVec(L[4*Ee+1],T),te[Ee]=Sn(x,T)}),ne.sort((pe,Ee)=>re[Ee]-re[pe]);const he=new Array,ce=new Array;for(let pe=0;pee}function u6t(t,e){const i=Ca(t.cosAngle),r=Kie.fwd,n=Kie.ortho;return R_(r,t.position1,t.position0),i*(Ve(Wt(n,t.faceNormal0,t.faceNormal1),r)>0?-1:1)>e}function h6t(t){const e=t.faces.length/3,i=t.faces,r=t.neighbors;let n=0;for(let l=0;l0?this._recycledIndices.pop():this.availableCount?this._nextIndex++:void 0}release(e){this._recycledIndices.push(e)}},_6t=class{constructor(e,i=1){this._rctx=e,this._fieldCount=i,this.textureWidth=4096,this._dirty=!0;const r=new tn(this.textureWidth,1);r.samplingMode=ki.NEAREST,r.wrapMode=Bi.CLAMP_TO_EDGE,this._texture=new Ai(this._rctx,r),this._data=new Ac(new ArrayBuffer(4*this.textureWidth))}dispose(){this._texture.dispose(),this._texture=void 0,this._data=void 0}setData(e,i,r,n,s,o){const l=e*this._fieldCount+i;this._dirty=!0,this._data.set(l,0,r),this._data.set(l,1,n),this._data.set(l,2,s),this._data.set(l,3,o)}setDataElement(e,i,r,n){const s=e*this._fieldCount+i;this._dirty=!0,this._data.set(s,r,n)}getDataElement(e,i,r){const n=e*this._fieldCount+i;return this._dirty=!0,this._data.get(n,r)}resizeToFit(e){const i=(e+1)*this._fieldCount;if(i>this._data.count){const r=Math.ceil(i/this.textureWidth)*this.textureWidth,n=new Ac(new ArrayBuffer(4*r));n.typedBuffer.set(this._data.typedBuffer),this._data=n}}updateTexture(){if(!this._dirty)return;const e=this._texture.descriptor.width,i=this._texture.descriptor.height;this._data.count>e*i&&this._texture.resize(e,this._data.count/e),this._texture.setData(this._data.typedBuffer),this._dirty=!1}get texture(){return this._texture}};const yke=65536;let b6t=class{constructor(e,i=1){this.textureBuffer=new _6t(e,i),this._indexManager=new v6t(yke)}dispose(){this.textureBuffer.dispose(),this.textureBuffer=void 0}get availableCount(){return this._indexManager.availableCount}get activeCount(){return this._indexManager.activeCount}acquireIndex(){const e=this._indexManager.acquire();return this.textureBuffer.resizeToFit(e),e}releaseIndex(e){this._indexManager.release(e)}},vke=class{constructor(e,i=1){this._rctx=e,this._fieldCount=i,this._buffers=[]}garbageCollect(){this._buffers=this._buffers.filter(e=>e.activeCount!==0||(e.dispose(),!1))}destroy(){this._buffers.forEach(e=>e.dispose()),this._buffers=[]}getBuffer(e){for(const r of this._buffers)if(r.availableCount>=e)return r;if(e>yke)return null;const i=new b6t(this._rctx,this._fieldCount);return this._buffers.push(i),i}updateTextures(){for(const e of this._buffers)e.textureBuffer.updateTexture()}};const uwe=Ce.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let w6t=class{constructor(e,i){this._renderManager=e,this._viewingMode=i,this._objects=[new Pi,new Pi],this._renderSubmit=new j9t(this),this._renderManager.register(this._renderSubmit),this._hasObjectAndLayerId=Le("enable-feature:objectAndLayerId-rendering"),this._componentBufferManager=new vke(e.rctx,2+(this._hasObjectAndLayerId?1:0))}destroy(){Xt(this._objects[AO.Hidden].length===0&&this._objects[AO.Visible].length===0,"ObjectCollection should be empty upon disposal"),this._componentBufferManager.destroy();const e=this._objects.flatMap(i=>i.toArray());for(const i of e)i==null||i.destroy()}createObject(e){const i=new SI;return i.toMapSpace=e.toMapSpace,i.transform=e.transform,i.obb=$fe(e.obb),i.components=new T9t(this._componentBufferManager,Py(e.geometry.componentOffsets)),i.renderable=this._createRenderable(e,i.components),i.intersectionGeometry=new R9t(e.geometry.positionData,i.components),this._objects[i.visible].push(i),i}destroyObject(e){const i=e;this._objects[i.visible].removeUnordered(i),i.destroy(),this._notifyDirty()}setObjectVisibility(e,i){const r=e;i!==r.visible&&(this._objects[r.visible].removeUnordered(r),this._objects[i].push(r),r.visible=i,this._notifyDirty())}preSubmit(e){const i=e.camera.eye;this.visibleObjects.forAll(r=>r.renderable.meta.cameraDepthSquared=Co(i,r.obb.center))}getMaterial(e){return e.renderable.material}updateMaterial(e,i){const r=e.renderable.material;i(r),r.dirty&&this._notifyDirty()}setAllComponentVisibilities(e,i){const r=e;r.components.visibility.reset(i),r.components.visibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,i){return e.components.visibility.forEachComponent(i)}getComponentCount(e){const i=e,r=i.components.visibility.componentCount();return{visible:r,invisible:i.components.count-r}}setComponentData(e,i){const r=e,n=r.renderable.material,s=r.components,o=s.materialDataBuffer,l=s.materialDataIndices,c=new H9t,f=o.textureBuffer,_=new Uint8Array(4),x=new Uint32Array(_.buffer);let T=0,A=0,M=0,I=s.verticalOffsets,L=1/0,F=-1/0,z=!1,k=!1,U=0;for(let j=0;j0&&U!==x[0]),U=x[0],k||(k=c.elevationOffset!==0),k&&I==null&&(I=new Array(j).fill(0)),I!=null&&(I[j]=c.elevationOffset),L=Math.min(L,c.elevationOffset),F=Math.max(F,c.elevationOffset),cke(c.elevationOffset,_),f.setData(l[j],1,_[0],_[1],_[2],_[3]);const H=c.objectAndLayerIdColor;H!=null&&f.setData(l[j],2,H[0],H[1],H[2],H[3]),c.pickable!==oke(s.pickability,j)&&(s.pickability=C9t(s.pickability,s.count,j,c.pickable))}s.verticalOffsets=k?I:null,r.offsetObb=k?yRe(r.obb,L,F,this._viewingMode,r.offsetObb!=null?r.offsetObb:$fe(r.obb)):null,z||k||this._hasObjectAndLayerId?(n.componentParameters=new TI,n.componentParameters.castShadows=LY(M,s.count),n.componentParameters.transparent=LY(T,s.count),n.componentParameters.opaqueOverride=LY(A,s.count),n.componentParameters.texture=f,f.updateTexture()):(n.componentParameters=new U$,n.componentParameters.castShadows=c.castShadows?Ta.All:Ta.None,n.componentParameters.externalColor=c.externalColor,n.componentParameters.externalColorMixMode=c.externalColorMixMode),this._notifyDirty()}getComponentAabb(e,i,r,n=!1){e.intersectionGeometry.getComponentAabb(i,r);const s=e,o=s.components.verticalOffsets;if(n||o==null)return r;const l=o[i];if(this._viewingMode===_t.Local||l===0)return r[2]+=l,r[5]+=l,r;const c=s0t(l);return c.localOrigin=s.transform.position,c.applyToAabb(r)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,i,r){return e.intersectionGeometry.getComponentPositions(i,r)}intersect(e,i,r,n,s,o){const l=e;s!=null&&(s.localOrigin=l.transform.position);const c=_E(hwe,l.transform.rotationScale);xn(E8,i,l.transform.position),xn(C8,r,l.transform.position),qh(E8,E8,c),qh(C8,C8,c);const f=Xf(hwe,c);return l.intersectionGeometry.intersect(E8,C8,n,f,s,l.components.verticalOffsets,o)}addEdges(e,i,r,n){const s=e,{indices:o,positions:l}=s.intersectionGeometry,c=s.components.offsets;return i.addComponentObject(e,s.transform,{center:s.obb.center,radius:eht(s.obb)},l,o,c,r,n)}async extractEdgeInformation(e,i,r){const n=e,s=n.components.visibility;if(s.allInvisible())return{buffer:y6t.createBuffer(0),origin:[0,0,0]};const{indices:o,positions:l}=n.intersectionGeometry,c=n.components.offsets,f=fV.createBuffer(l.length/3);h6(f.position.typedBuffer,l,f.position.typedBufferStride,3),tNe(f.position,f.position,n.transform.rotationScale),this._setComponentIndices(f.componentIndex,o,c);const _=f.count,x=this._computeVisibilityIndices(o,s,c,_);return{origin:Xr(n.transform.position),buffer:await i.extractComponentsEdgeLocations({indices:x,indicesLength:x.length,skipDeduplicate:!0,data:f,writerSettings:{reducedPrecision:!1,variants:0}},r)}}_setComponentIndices(e,i,r){let n=0;for(let s=0;s(s+=r[f]-r[c],!0));const o=zf(e)?new Array(s):(e==null?void 0:e.BYTES_PER_ELEMENT)===2||n<=65536?new Uint16Array(s):new Uint32Array(s);let l=0;return i.forEachComponentRange((c,f)=>{const _=r[c],x=r[f];for(let T=_;T1)return r.highlightCounts[i]=n-1,void(r.highlightCounts[r.count]=s-1);r.highlightCounts[i]=0,r.highlightsDirty(),this._notifyDirty(),s===1?r.highlightCounts=null:r.highlightCounts[r.count]=s-1}else uwe.warn("Removing non-existing highlight.")}clearHighlights(e){const i=e.components;i.highlightCounts!=null&&(i.highlightCounts=null,i.highlightsDirty(),this._notifyDirty())}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._objects[AO.Visible]}_createRenderable(e,i){const r=this._renderManager.rctx,n=e.geometry,s=n.vertices.layoutParameters,o=Yr.createVertex(r,Pr.STATIC_DRAW,n.vertices.data),l=n.indices?Yr.createIndex(r,Pr.STATIC_DRAW,n.indices):null,c=md(G9t(s)),f=new Uint16Array(n.vertices.count);for(let I=0;Ii.texture)),t.hasOpacityFactor&&e.fragment.uniforms.add(new ft("opacity",i=>i.opacity)),e.fragment.code.add(V` + `)),e}const ZLt=Object.freeze(Object.defineProperty({__proto__:null,build:lke},Symbol.toStringTag,{value:"Module"}));let cke=class uke extends Hr{initializeConfiguration(e,i){i.spherical=e.viewingMode===_t.Global,i.doublePrecisionRequiresObfuscation=e.rctx.driverTest.doublePrecisionRequiresObfuscation.result}initializeProgram(e){return new $r(e.rctx,uke.shader.get().build(this.configuration),hke)}_setPipelineState(e){const i=this.configuration,r=i.integratedMeshMode!==op.None,n=e===Jt.NONE,s=e===Jt.FrontFace;return Ti({blending:i.output!==ue.Color&&i.output!==ue.Alpha||!i.blendingEnabled?null:n?xp:Q_(e),culling:kj(i.cullFace),depthTest:{func:_x(e)},depthWrite:n||s?sh:null,colorWrite:ji,stencilWrite:r||i.hasOccludees?n1:null,stencilTest:r?mxt(Ku.IntegratedMeshMaskExcluded):i.hasOccludees?bx:null,polygonOffset:n||s?i.hasPolygonOffset?{factor:2,units:2}:null:uG})}initializePipeline(){return this._setPipelineState(this.configuration.transparencyPassType)}};cke.shader=new Ir(ZLt,()=>we(()=>Promise.resolve().then(()=>wXt),void 0));const hke=new Map([[J.POSITION,0],[J.NORMAL,1],[J.NORMALCOMPRESSED,1],[J.COLOR,2],[J.UV0,3],[J.UVREGION,4],[J.COMPONENTINDEX,5]]);let JLt=class extends bn{constructor(){super(...arguments),this._dirty=!0}_setDirty(){this._dirty=!0}_setClean(){if(this._dirty=!1,this._parameterBlocks!=null)for(const e of this._parameterBlocks)this[e]._setClean()}get dirty(){return this._dirty||this._checkParameterBlocksDirty()}_checkParameterBlocksDirty(){if(this._parameterBlocks==null)return!1;for(const e of this._parameterBlocks)if(this[e].dirty)return!0;return!1}},Kce=class{constructor(){this._dirty=!0}_setDirty(){this._dirty=!0}_setClean(){this._dirty=!1}get dirty(){return this._dirty}};function Bs(t={}){return(e,i)=>{const r=e._parameterCount??0;if(e._parameterCount=r+1,t.vectorOps){const n=t.vectorOps;Object.defineProperty(e,i,{get(){return this[r]},set(s){const o=this[r];if(o==null)this[r]=s;else{if(n.equals(o,s))return;n.copy(o,s)}this._setDirty()}})}else Object.defineProperty(e,i,{get(){return this[r]},set(n){this[r]!==n&&(t.dispose&&this[r]&&this[r].dispose(),this[r]=n,this._setDirty())}})}}function swe(){return(t,e)=>{const i=t._parameterCount??0;t._parameterCount=i+1,t._parameterBlocks=t._parameterBlocks||[],t._parameterBlocks.push(i),Object.defineProperty(t,e,{get(){return this[i]},set(r){this[i]!==r&&(this[i]=r,this._setDirty())}})}}let UG=class{constructor(e){this._low=W(),this._high=W(),e&&this.set(e)}get low(){return this._low}get high(){return this._high}set(e){Ne(this._low,Ne(owe,e));const i=Sn(owe,e,this._low);Ne(this._high,i)}get(e){return Be(e,this._low,this._high)}getLowScaled(e){return De(e,this._low,1)}};const owe=js();let ka=class extends JLt{constructor(e,i){super(),this.toMapSpace=i,this.baseColor=Mi(1,1,1,1),this.usePBR=!1,this.hasParametersFromSource=!1,this.mrrFactors=vc(mG),this.emissiveFactor=st(0,0,0),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null,this.objectOpacity=1,this.commonMaterialParameters=new Mk,this.componentParameters=new Z$,this.textureAlphaCutoff=VU,this.alphaDiscardMode=yn.Opaque,this.isIntegratedMesh=!1,this.polygonOffsetEnabled=!1,this.ellipsoidMode=Uy.Earth,this.hasOccludees=!1,this._techniqueConfiguration=new lr;const r=new UG(e.position),n=aDe(e.rotationScale);EE(n,n),this.transformNormalGlobalFromModel=KPe(Qf(n,n)),this.transformWorldFromModelTL=r.low,this.transformWorldFromModelTH=r.high,this.transformWorldFromModelRS=e.rotationScale}dispose(){this._technique=ir(this._technique),this.baseColorTexture=null,this.metallicRoughnessTexture=null,this.emissionTexture=null,this.occlusionTexture=null,this.normalTexture=null}get texture(){return this.baseColorTexture!=null?this.baseColorTexture.glTexture:null}get textureMetallicRoughness(){return this.metallicRoughnessTexture!=null?this.metallicRoughnessTexture.glTexture:null}get textureEmissive(){return this.emissionTexture!=null?this.emissionTexture.glTexture:null}get textureOcclusion(){return this.occlusionTexture!=null?this.occlusionTexture.glTexture:null}get textureNormal(){return this.normalTexture!=null?this.normalTexture.glTexture:null}prepareTechnique(e,i,r,n){const s=this._techniqueConfiguration;s.hasVertexColors=n.colors,s.hasNormals=n.normals,s.textureCoordinateType=n.textureCoordinates,s.hasMetallicRoughnessTexture=this.metallicRoughnessTexture!=null,s.hasEmissionTexture=this.emissionTexture!=null,s.hasOcclusionTexture=this.occlusionTexture!=null,s.hasNormalTexture=this.normalTexture!=null,s.transparencyPassType=i.identifier===Yh.Material&&r.transparencyPassType!=null?r.transparencyPassType:Jt.NONE,s.multipassEnabled=i.identifier===Yh.Material&&r.multipassEnabled,s.cullAboveGround=i.identifier===Yh.Material&&r.multipassTerrain.cullAboveGround,s.ellipsoidMode=this.ellipsoidMode,s.componentData=this.componentParameters.type,s.cullFace=this.commonMaterialParameters.cullFace,s.doubleSidedMode=this.commonMaterialParameters.doubleSided?Ls.View:Ls.None,s.hasColorTexture=this.baseColorTexture!=null;const o=this._computeWhichMaterialPass();if(s.blendingEnabled=o===eu.Transparent||o===eu.OpaqueAndTransparent,s.alphaDiscardMode=this.alphaDiscardMode,s.integratedMeshMode=this.isIntegratedMesh?e9t(r)?QLt(r)?op.ColorOverlayWithWater:op.ColorOverlay:op.NoOverlay:op.None,s.hasPolygonOffset=this.polygonOffsetEnabled,s.pbrMode=s.integratedMeshMode===op.ColorOverlayWithWater?ti.WaterOnIntegratedMesh:this.usePBR?this.hasParametersFromSource?ti.Schematic:ti.Normal:ti.Disabled,s.normalType=s.integratedMeshMode===op.None?s.hasNormals?Br.Compressed:Br.ScreenDerivative:Br.Ground,s.hasSlicePlane=r.slicePlane!=null&&this.commonMaterialParameters.hasSlicePlane,i.identifier===Yh.ShadowMap)s.output=ue.Shadow,s.vertexDiscardMode=up.None;else if(i.identifier===Yh.Highlight)s.output=ue.Highlight,s.vertexDiscardMode=up.None;else{switch(o===eu.OpaqueAndTransparent?s.vertexDiscardMode=i.transparent?up.Opaque:up.Transparent:s.vertexDiscardMode=up.None,s.output=i.output,s.receiveAmbientOcclusion=!1,s.receiveShadows=!1,i.output){case ue.Color:s.receiveAmbientOcclusion=r.ssao!=null,s.hasOccludees=r.hasOccludees,s.receiveShadows=r.shadowMap.ready,s.hasScreenSpaceReflections=r.ssr.lastFrameColor!=null,s.hasCloudsReflections=r.cloudsFade.data!=null;break;case ue.Alpha:s.hasOccludees=r.hasOccludees;break;case ue.ObjectAndLayerIdColor:s.objectAndLayerIdColor=!0}s.snowCover=this.hasSnowCover(r)}return this._technique=e.releaseAndAcquire(cke,s,this._technique),this._setClean(),this._technique}hasSnowCover(e){return e.weather!=null&&e.weatherVisible&&e.weather.type==="snowy"&&e.weather.snowCover==="enabled"}submit(e,i,r){if(this.objectOpacity===0)return;const n=r.renderable.geometry,s=r.components,o=r.renderable.meta.cameraDepthSquared,a=s.geometryRanges,c=s.highlightRanges,p=s.defaultShadowMapRanges;switch(this._computeWhichMaterialPass()){case eu.Opaque:e.materialOpaque.submitDraw(this,n,a,o);break;case eu.Transparent:e.materialTransparent.submitDraw(this,n,a,o);break;case eu.OpaqueAndTransparent:e.materialOpaque.submitDraw(this,n,a,o),e.materialTransparent.submitDraw(this,n,a,o);break;case eu.IntegratedMesh:e.materialIntegratedMesh.submitDraw(this,n,a,o),KLt(i)&&e.highlightIntegratedMesh.submitDraw(this,n,a,o)}const _=this.componentParameters.castShadows!==Ea.None;_&&e.shadowMap.submitDraw(this,n,a,o),c!=null&&(e.highlight.submitDraw(this,n,c,o),_&&e.highlightShadowMap.submitDraw(this,n,c,o)),_&&p!=null&&e.defaultShadowMap.submitDraw(this,n,p,o)}_computeWhichMaterialPass(){return this.isIntegratedMesh?eu.IntegratedMesh:this.objectOpacity<1?eu.Transparent:this.componentParameters.opaqueOverride===Ea.All?eu.Opaque:this.baseColor[3]<1||this.alphaDiscardMode===yn.Blend||this.alphaDiscardMode===yn.MaskBlend?eu.Transparent:this.componentParameters.transparent===Ea.None?eu.Opaque:this.componentParameters.transparent===Ea.All?eu.Transparent:eu.OpaqueAndTransparent}};var eu,Ea;y([Bs({vectorOps:FEe})],ka.prototype,"baseColor",void 0),y([Bs()],ka.prototype,"usePBR",void 0),y([Bs()],ka.prototype,"hasParametersFromSource",void 0),y([Bs({vectorOps:rde})],ka.prototype,"mrrFactors",void 0),y([Bs({vectorOps:rde})],ka.prototype,"emissiveFactor",void 0),y([Bs({dispose:!0})],ka.prototype,"baseColorTexture",void 0),y([Bs({dispose:!0})],ka.prototype,"metallicRoughnessTexture",void 0),y([Bs({dispose:!0})],ka.prototype,"emissionTexture",void 0),y([Bs({dispose:!0})],ka.prototype,"occlusionTexture",void 0),y([Bs({dispose:!0})],ka.prototype,"normalTexture",void 0),y([Bs()],ka.prototype,"objectOpacity",void 0),y([swe()],ka.prototype,"commonMaterialParameters",void 0),y([swe()],ka.prototype,"componentParameters",void 0),y([Bs()],ka.prototype,"textureAlphaCutoff",void 0),y([Bs()],ka.prototype,"alphaDiscardMode",void 0),y([Bs()],ka.prototype,"isIntegratedMesh",void 0),y([Bs()],ka.prototype,"polygonOffsetEnabled",void 0),y([Bs()],ka.prototype,"ellipsoidMode",void 0),y([Bs()],ka.prototype,"hasOccludees",void 0),function(t){t[t.Opaque=0]="Opaque",t[t.Transparent=1]="Transparent",t[t.OpaqueAndTransparent=2]="OpaqueAndTransparent",t[t.IntegratedMesh=3]="IntegratedMesh"}(eu||(eu={}));let Mk=class extends Kce{constructor(){super(...arguments),this.doubleSided=!1,this.cullFace=Ln.Back,this.hasSlicePlane=!0}};y([Bs()],Mk.prototype,"doubleSided",void 0),y([Bs()],Mk.prototype,"cullFace",void 0),y([Bs()],Mk.prototype,"hasSlicePlane",void 0);let Z$=class extends Kce{constructor(){super(...arguments),this.externalColor=Mi(1,1,1,1),this.externalColorMixMode=Vo.Multiply,this.castShadows=Ea.All}get transparent(){return this.externalColor[3]<1?Ea.All:Ea.None}get opaqueOverride(){return this.externalColorMixMode===Vo.Replace&&this.externalColor[3]===1?Ea.All:Ea.None}get visible(){return this.externalColor[3]>0?Ea.All:Ea.None}get type(){return zy.Uniform}};y([Bs({vectorOps:FEe})],Z$.prototype,"externalColor",void 0),y([Bs()],Z$.prototype,"externalColorMixMode",void 0),y([Bs()],Z$.prototype,"castShadows",void 0),function(t){t[t.All=0]="All",t[t.Some=1]="Some",t[t.None=2]="None"}(Ea||(Ea={}));let D4=class extends Kce{constructor(){super(...arguments),this.texture=null,this.transparent=Ea.None,this.opaqueOverride=Ea.None,this.castShadows=Ea.None}get type(){return zy.Varying}};function KLt(t){var e;return((e=t.overlay)==null?void 0:e.getTexture(ns.Highlight))!=null}function QLt(t){var e;return((e=t.overlay)==null?void 0:e.getTexture(ns.WaterNormal))!=null}function e9t(t){var e;return((e=t.overlay)==null?void 0:e.getTexture(ns.ColorNoRasterImage))!=null}y([Bs()],D4.prototype,"texture",void 0),y([Bs()],D4.prototype,"transparent",void 0),y([Bs()],D4.prototype,"opaqueOverride",void 0),y([Bs()],D4.prototype,"castShadows",void 0);const mV=ls().vec3f(J.POSITION).u16(J.COMPONENTINDEX),dke=ls().vec2u8(J.SIDENESS),t9t=_d(dke),nre=ls().vec3f(J.POSITION0).vec3f(J.POSITION1).vec3f(J.NORMAL).u16(J.COMPONENTINDEX).u8(J.VARIANTOFFSET,{glNormalized:!0}).u8(J.VARIANTSTROKE).u8(J.VARIANTEXTENSION,{glNormalized:!0}),sre=ls().vec3f(J.POSITION0).vec3f(J.POSITION1).vec3f(J.NORMALA).vec3f(J.NORMALB).u16(J.COMPONENTINDEX).u8(J.VARIANTOFFSET,{glNormalized:!0}).u8(J.VARIANTSTROKE).u8(J.VARIANTEXTENSION,{glNormalized:!0}),pke=new Map([[J.POSITION0,0],[J.POSITION1,1],[J.COMPONENTINDEX,2],[J.VARIANTOFFSET,3],[J.VARIANTSTROKE,4],[J.VARIANTEXTENSION,5],[J.NORMAL,6],[J.NORMALA,6],[J.NORMALB,7],[J.SIDENESS,8]]);function awe(t,e,i){const r=e/3,n=new Uint32Array(i+1),s=new Uint32Array(i+1),o=(F,z)=>{F{if(F{const k=2*F,U=z-F;for(let j=1;j=0&&p[k+2*Q]>G;Q--)p[k+2*Q+2]=p[k+2*Q],p[k+2*Q+3]=p[k+2*Q+1];p[k+2*Q+2]=G,p[k+2*Q+3]=Y}};for(let F=0;FF===t[3*z]?0:F===t[3*z+1]?1:F===t[3*z+2]?2:-1,P=(F,z)=>{const k=M(F,z);C[3*z+k]=-1},$=(F,z,k,U)=>{const j=M(F,z);C[3*z+j]=U;const G=M(k,U);C[3*U+G]=z};for(let F=0;F{n.getVec($[4*Ee],x),n.getVec($[4*Ee+1],S),te[Ee]=Tn(x,S)}),ne.sort((pe,Ee)=>ie[Ee]-ie[pe]);const he=new Array,ce=new Array;for(let pe=0;pee}function l9t(t,e){const i=Aa(t.cosAngle),r=ore.fwd,n=ore.ortho;return k_(r,t.position1,t.position0),i*(Ve(Wt(n,t.faceNormal0,t.faceNormal1),r)>0?-1:1)>e}function c9t(t){const e=t.faces.length/3,i=t.faces,r=t.neighbors;let n=0;for(let a=0;a0?this._recycledIndices.pop():this.availableCount?this._nextIndex++:void 0}release(e){this._recycledIndices.push(e)}},y9t=class{constructor(e,i=1){this._rctx=e,this._fieldCount=i,this.textureWidth=4096,this._dirty=!0;const r=new rn(this.textureWidth,1);r.samplingMode=ki.NEAREST,r.wrapMode=Bi.CLAMP_TO_EDGE,this._texture=new Ai(this._rctx,r),this._data=new Pc(new ArrayBuffer(4*this.textureWidth))}dispose(){this._texture.dispose(),this._texture=void 0,this._data=void 0}setData(e,i,r,n,s,o){const a=e*this._fieldCount+i;this._dirty=!0,this._data.set(a,0,r),this._data.set(a,1,n),this._data.set(a,2,s),this._data.set(a,3,o)}setDataElement(e,i,r,n){const s=e*this._fieldCount+i;this._dirty=!0,this._data.set(s,r,n)}getDataElement(e,i,r){const n=e*this._fieldCount+i;return this._dirty=!0,this._data.get(n,r)}resizeToFit(e){const i=(e+1)*this._fieldCount;if(i>this._data.count){const r=Math.ceil(i/this.textureWidth)*this.textureWidth,n=new Pc(new ArrayBuffer(4*r));n.typedBuffer.set(this._data.typedBuffer),this._data=n}}updateTexture(){if(!this._dirty)return;const e=this._texture.descriptor.width,i=this._texture.descriptor.height;this._data.count>e*i&&this._texture.resize(e,this._data.count/e),this._texture.setData(this._data.typedBuffer),this._dirty=!1}get texture(){return this._texture}};const mke=65536;let v9t=class{constructor(e,i=1){this.textureBuffer=new y9t(e,i),this._indexManager=new g9t(mke)}dispose(){this.textureBuffer.dispose(),this.textureBuffer=void 0}get availableCount(){return this._indexManager.availableCount}get activeCount(){return this._indexManager.activeCount}acquireIndex(){const e=this._indexManager.acquire();return this.textureBuffer.resizeToFit(e),e}releaseIndex(e){this._indexManager.release(e)}},gke=class{constructor(e,i=1){this._rctx=e,this._fieldCount=i,this._buffers=[]}garbageCollect(){this._buffers=this._buffers.filter(e=>e.activeCount!==0||(e.dispose(),!1))}destroy(){this._buffers.forEach(e=>e.dispose()),this._buffers=[]}getBuffer(e){for(const r of this._buffers)if(r.availableCount>=e)return r;if(e>mke)return null;const i=new v9t(this._rctx,this._fieldCount);return this._buffers.push(i),i}updateTextures(){for(const e of this._buffers)e.textureBuffer.updateTexture()}};const hwe=Ce.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");let _9t=class{constructor(e,i){this._renderManager=e,this._viewingMode=i,this._objects=[new Pi,new Pi],this._renderSubmit=new VLt(this),this._renderManager.register(this._renderSubmit),this._hasObjectAndLayerId=$e("enable-feature:objectAndLayerId-rendering"),this._componentBufferManager=new gke(e.rctx,2+(this._hasObjectAndLayerId?1:0))}destroy(){Xt(this._objects[LO.Hidden].length===0&&this._objects[LO.Visible].length===0,"ObjectCollection should be empty upon disposal"),this._componentBufferManager.destroy();const e=this._objects.flatMap(i=>i.toArray());for(const i of e)i==null||i.destroy()}createObject(e){const i=new L4;return i.toMapSpace=e.toMapSpace,i.transform=e.transform,i.obb=Tfe(e.obb),i.components=new xLt(this._componentBufferManager,Ny(e.geometry.componentOffsets)),i.renderable=this._createRenderable(e,i.components),i.intersectionGeometry=new OLt(e.geometry.positionData,i.components),this._objects[i.visible].push(i),i}destroyObject(e){const i=e;this._objects[i.visible].removeUnordered(i),i.destroy(),this._notifyDirty()}setObjectVisibility(e,i){const r=e;i!==r.visible&&(this._objects[r.visible].removeUnordered(r),this._objects[i].push(r),r.visible=i,this._notifyDirty())}preSubmit(e){const i=e.camera.eye;this.visibleObjects.forAll(r=>r.renderable.meta.cameraDepthSquared=Ao(i,r.obb.center))}getMaterial(e){return e.renderable.material}updateMaterial(e,i){const r=e.renderable.material;i(r),r.dirty&&this._notifyDirty()}setAllComponentVisibilities(e,i){const r=e;r.components.visibility.reset(i),r.components.visibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,i){return e.components.visibility.forEachComponent(i)}getComponentCount(e){const i=e,r=i.components.visibility.componentCount();return{visible:r,invisible:i.components.count-r}}setComponentData(e,i){const r=e,n=r.renderable.material,s=r.components,o=s.materialDataBuffer,a=s.materialDataIndices,c=new jLt,p=o.textureBuffer,_=new Uint8Array(4),x=new Uint32Array(_.buffer);let S=0,C=0,M=0,P=s.verticalOffsets,$=1/0,F=-1/0,z=!1,k=!1,U=0;for(let j=0;j0&&U!==x[0]),U=x[0],k||(k=c.elevationOffset!==0),k&&P==null&&(P=new Array(j).fill(0)),P!=null&&(P[j]=c.elevationOffset),$=Math.min($,c.elevationOffset),F=Math.max(F,c.elevationOffset),ake(c.elevationOffset,_),p.setData(a[j],1,_[0],_[1],_[2],_[3]);const G=c.objectAndLayerIdColor;G!=null&&p.setData(a[j],2,G[0],G[1],G[2],G[3]),c.pickable!==nke(s.pickability,j)&&(s.pickability=TLt(s.pickability,s.count,j,c.pickable))}s.verticalOffsets=k?P:null,r.offsetObb=k?G5e(r.obb,$,F,this._viewingMode,r.offsetObb!=null?r.offsetObb:Tfe(r.obb)):null,z||k||this._hasObjectAndLayerId?(n.componentParameters=new D4,n.componentParameters.castShadows=GY(M,s.count),n.componentParameters.transparent=GY(S,s.count),n.componentParameters.opaqueOverride=GY(C,s.count),n.componentParameters.texture=p,p.updateTexture()):(n.componentParameters=new Z$,n.componentParameters.castShadows=c.castShadows?Ea.All:Ea.None,n.componentParameters.externalColor=c.externalColor,n.componentParameters.externalColorMixMode=c.externalColorMixMode),this._notifyDirty()}getComponentAabb(e,i,r,n=!1){e.intersectionGeometry.getComponentAabb(i,r);const s=e,o=s.components.verticalOffsets;if(n||o==null)return r;const a=o[i];if(this._viewingMode===_t.Local||a===0)return r[2]+=a,r[5]+=a,r;const c=nft(a);return c.localOrigin=s.transform.position,c.applyToAabb(r)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,i,r){return e.intersectionGeometry.getComponentPositions(i,r)}intersect(e,i,r,n,s,o){const a=e;s!=null&&(s.localOrigin=a.transform.position);const c=EE(dwe,a.transform.rotationScale);Sn(I8,i,a.transform.position),Sn($8,r,a.transform.position),Xh(I8,I8,c),Xh($8,$8,c);const p=Qf(dwe,c);return a.intersectionGeometry.intersect(I8,$8,n,p,s,a.components.verticalOffsets,o)}addEdges(e,i,r,n){const s=e,{indices:o,positions:a}=s.intersectionGeometry,c=s.components.offsets;return i.addComponentObject(e,s.transform,{center:s.obb.center,radius:Vlt(s.obb)},a,o,c,r,n)}async extractEdgeInformation(e,i,r){const n=e,s=n.components.visibility;if(s.allInvisible())return{buffer:m9t.createBuffer(0),origin:[0,0,0]};const{indices:o,positions:a}=n.intersectionGeometry,c=n.components.offsets,p=mV.createBuffer(a.length/3);g6(p.position.typedBuffer,a,p.position.typedBufferStride,3),KDe(p.position,p.position,n.transform.rotationScale),this._setComponentIndices(p.componentIndex,o,c);const _=p.count,x=this._computeVisibilityIndices(o,s,c,_);return{origin:Xr(n.transform.position),buffer:await i.extractComponentsEdgeLocations({indices:x,indicesLength:x.length,skipDeduplicate:!0,data:p,writerSettings:{reducedPrecision:!1,variants:0}},r)}}_setComponentIndices(e,i,r){let n=0;for(let s=0;s(s+=r[p]-r[c],!0));const o=Gf(e)?new Array(s):(e==null?void 0:e.BYTES_PER_ELEMENT)===2||n<=65536?new Uint16Array(s):new Uint32Array(s);let a=0;return i.forEachComponentRange((c,p)=>{const _=r[c],x=r[p];for(let S=_;S1)return r.highlightCounts[i]=n-1,void(r.highlightCounts[r.count]=s-1);r.highlightCounts[i]=0,r.highlightsDirty(),this._notifyDirty(),s===1?r.highlightCounts=null:r.highlightCounts[r.count]=s-1}else hwe.warn("Removing non-existing highlight.")}clearHighlights(e){const i=e.components;i.highlightCounts!=null&&(i.highlightCounts=null,i.highlightsDirty(),this._notifyDirty())}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._objects[LO.Visible]}_createRenderable(e,i){const r=this._renderManager.rctx,n=e.geometry,s=n.vertices.layoutParameters,o=Yr.createVertex(r,Rr.STATIC_DRAW,n.vertices.data),a=n.indices?Yr.createIndex(r,Rr.STATIC_DRAW,n.indices):null,c=_d(BLt(s)),p=new Uint16Array(n.vertices.count);for(let P=0;Pi.texture)),t.hasOpacityFactor&&e.fragment.uniforms.add(new ft("opacity",i=>i.opacity)),e.fragment.code.add(V` void main() { fragColor = texture(tex, uv) ${t.hasOpacityFactor?"* opacity":""}; - }`),e}const S6t=Object.freeze(Object.defineProperty({__proto__:null,CompositingPassParameters:RG,build:_ke},Symbol.toStringTag,{value:"Module"}));var yc;(function(t){t[t.None=0]="None",t[t.Alpha=1]="Alpha",t[t.PremultipliedAlpha=2]="PremultipliedAlpha",t[t.COUNT=3]="COUNT"})(yc||(yc={}));let _V=class extends nh{constructor(){super(...arguments),this.alphaMode=yc.None,this.hasOpacityFactor=!1}};y([fe({count:yc.COUNT})],_V.prototype,"alphaMode",void 0),y([fe()],_V.prototype,"hasOpacityFactor",void 0);let Vce=class bke extends Hr{initializeProgram(e){return new Ir(e.rctx,bke.shader.get().build(this.configuration),Er)}initializePipeline(){switch(this.configuration.alphaMode){case yc.None:return Ti({colorWrite:ji});case yc.Alpha:return Ti({blending:Ol(st.SRC_ALPHA,st.ONE,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),colorWrite:ji});case yc.PremultipliedAlpha:case yc.COUNT:return Ti({blending:hd(st.ONE,st.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}}};Vce.shader=new Rr(S6t,()=>we(()=>Promise.resolve().then(()=>UWt),void 0));let Bce=class extends _n{};function wke(){const t=new Cr;return t.include(Pc),t.fragment.uniforms.add(new Zt("tex",e=>e.texture)),t.fragment.code.add(V`void main() { + }`),e}const w9t=Object.freeze(Object.defineProperty({__proto__:null,CompositingPassParameters:VG,build:yke},Symbol.toStringTag,{value:"Module"}));var bc;(function(t){t[t.None=0]="None",t[t.Alpha=1]="Alpha",t[t.PremultipliedAlpha=2]="PremultipliedAlpha",t[t.COUNT=3]="COUNT"})(bc||(bc={}));let bV=class extends oh{constructor(){super(...arguments),this.alphaMode=bc.None,this.hasOpacityFactor=!1}};y([fe({count:bc.COUNT})],bV.prototype,"alphaMode",void 0),y([fe()],bV.prototype,"hasOpacityFactor",void 0);let eue=class vke extends Hr{initializeProgram(e){return new $r(e.rctx,vke.shader.get().build(this.configuration),Cr)}initializePipeline(){switch(this.configuration.alphaMode){case bc.None:return Ti({colorWrite:ji});case bc.Alpha:return Ti({blending:Pl(ot.SRC_ALPHA,ot.ONE,ot.ONE_MINUS_SRC_ALPHA,ot.ONE_MINUS_SRC_ALPHA),colorWrite:ji});case bc.PremultipliedAlpha:case bc.COUNT:return Ti({blending:md(ot.ONE,ot.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}}};eue.shader=new Ir(w9t,()=>we(()=>Promise.resolve().then(()=>xXt),void 0));let tue=class extends bn{};function _ke(){const t=new Ar;return t.include($c),t.fragment.uniforms.add(new Zt("tex",e=>e.texture)),t.fragment.code.add(V`void main() { fragColor = vec4(1.0 - texture(tex, uv).a); -}`),t}const T6t=Object.freeze(Object.defineProperty({__proto__:null,HUDCompositingPassParameters:Bce,build:wke},Symbol.toStringTag,{value:"Module"}));let xke=class Ske extends Hr{initializeProgram(e){return new Ir(e.rctx,Ske.shader.get().build(),Er)}initializePipeline(){return Ti({colorWrite:{r:!1,g:!0,b:!1,a:!1}})}};xke.shader=new Rr(T6t,()=>we(()=>Promise.resolve().then(()=>VWt),void 0));let jce=class extends _n{};function Tke(){const t=new Cr;return t.include(Pc),t.fragment.uniforms.add(new Zt("colorTexture",e=>e.colorTexture),new Zt("alphaTexture",e=>e.alphaTexture),new Zt("frontFaceTexture",e=>e.frontFaceTexture)),t.fragment.code.add(V`void main() { +}`),t}const x9t=Object.freeze(Object.defineProperty({__proto__:null,HUDCompositingPassParameters:tue,build:_ke},Symbol.toStringTag,{value:"Module"}));let bke=class wke extends Hr{initializeProgram(e){return new $r(e.rctx,wke.shader.get().build(),Cr)}initializePipeline(){return Ti({colorWrite:{r:!1,g:!0,b:!1,a:!1}})}};bke.shader=new Ir(x9t,()=>we(()=>Promise.resolve().then(()=>SXt),void 0));let iue=class extends bn{};function xke(){const t=new Ar;return t.include($c),t.fragment.uniforms.add(new Zt("colorTexture",e=>e.colorTexture),new Zt("alphaTexture",e=>e.alphaTexture),new Zt("frontFaceTexture",e=>e.frontFaceTexture)),t.fragment.code.add(V`void main() { vec4 srcColor = texture(colorTexture, uv); if(srcColor.a <= 1e-5){ discard; @@ -4604,10 +4593,10 @@ discard; float srcAlpha = texture(alphaTexture, uv).r; vec4 frontFace = texture(frontFaceTexture, uv); fragColor = vec4(mix(srcColor.rgb/srcColor.a, frontFace.rgb, frontFace.a), 1.0 - srcAlpha); -}`),t}const E6t=Object.freeze(Object.defineProperty({__proto__:null,OITCompositingPassParameters:jce,build:Tke},Symbol.toStringTag,{value:"Module"}));let Eke=class Cke extends Hr{initializeProgram(e){return new Ir(e.rctx,Cke.shader.get().build(),Er)}initializePipeline(){return Ti({blending:Ol(st.SRC_ALPHA,st.ONE,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}};Eke.shader=new Rr(E6t,()=>we(()=>Promise.resolve().then(()=>BWt),void 0));let C6t=class{constructor(e,i){this._rctx=e,this._techniqueRepository=i,this._configuration=new _V,this._passParameters=new RG,this._oitParameters=new jce,this._hudParameters=new Bce}compositeOIT(e,i,r,n){this._oitParameters.colorTexture=i,this._oitParameters.alphaTexture=r,this._oitParameters.frontFaceTexture=n;const s=this._techniqueRepository.acquire(Eke);this._rctx.bindTechnique(s,this._oitParameters,e),this._rctx.screen.draw(),s.release()}compositeHUD(e,i){this._hudParameters.texture=i;const r=this._techniqueRepository.acquire(xke);this._rctx.bindTechnique(r,this._hudParameters,e),this._rctx.screen.draw(),r.release()}composite(e,i,r=yc.None,n=1){this._configuration.alphaMode=r,this._configuration.hasOpacityFactor=n!==1,this._passParameters.texture=i,this._passParameters.opacity=n;const s=this._techniqueRepository.acquire(Vce,this._configuration);this._rctx.bindTechnique(s,this._passParameters,e),this._rctx.screen.draw(),s.release()}};const A6t=1e4,Qie=100,M6t=500,O6t=500,P6t=.1;function R6t(t,e,i){return jle(e,t)*(i[1]-i[0])+i[0]}function I6t(t,e,i){let r=0;if(!e.some(s=>(r+=s.numGeometries,r>=A6t)))return U6t.compute(t,e);const n=f6();return i.forAll(s=>N5(n,$6t(t,s))),n}function $6t(t,e){if(!e.visible)return;const i=f6(),r=e.getSpatialQueryAccelerator();return r?L6t(i,t,r):D6t(i,t,e.objects),i}function L6t(t,e,i){const r=e.eye,n=e.viewForward,s=e.frustum,o=c=>c.visible,l=i.objectCount;if(l{ere(t,e,c),hf.far=t.near,f.setRange(hf)},s,o),QL(hf,Math.max(t.far,e.near),e.far),i.forEachInDepthRange(r,n,_m.DepthOrder.BACK_TO_FRONT,hf,(c,f)=>{ere(t,e,c),hf.near=t.far,f.setRange(hf)},s,o);else{const c=Math.max(Math.min(l,O6t),Math.ceil(l*P6t)),f=i.findClosest(n,_m.DepthOrder.FRONT_TO_BACK,s,o,c),_=i.findClosest(n,_m.DepthOrder.BACK_TO_FRONT,s,o,c);f&&_&&(dwe(t,e,f.boundingVolumeWorldSpace.bounds),dwe(t,e,_.boundingVolumeWorldSpace.bounds))}}function D6t(t,e,i){VC.clear(),i.forAll(r=>{r.visible&&r.geometries.length!==0&&VC.add(r)}),VC.empty||(VC.sort(e),QL(hf,e.near,Math.min(t.near,e.far)),VC.forEachInDepthRange(hf,_m.DepthOrder.FRONT_TO_BACK,(r,n)=>{n{t.far=Math.max(t.far,s)}))}function ere(t,e,i){if(!i.visible||!c2(e.frustum,i.boundingVolumeWorldSpace.bounds))return;const r=i.transformation,n=z6t;i.geometries.forEach(s=>{nn(n,r,s.transformation);const o=l5(n);Ake(t,e,s.boundingInfo,n,o)})}function Ake(t,e,i,r,n){if(i==null)return;bt(tu,i.center,r);const{eye:s,viewForward:o}=e,l=o[0]*(tu[0]-s[0])+o[1]*(tu[1]-s[1])+o[2]*(tu[2]-s[2]);if(tu[3]=i.radius*n,!(l-tu[3]>t.near&&l+tu[3]Qie&&i.getChildren())for(const c of i.getChildren())Ake(t,e,c,r,n);else tre.unionDepthRangeWithAABB(t,e.viewProjectionMatrix,r,i.bbMin,i.bbMax)}function dwe(t,e,i){const r=e.eye,n=e.viewForward,s=(i[0]-r[0])*n[0]+(i[1]-r[1])*n[1]+(i[2]-r[2])*n[2];t.near=Math.min(t.near,s-i[3]),t.far=Math.max(t.far,s+i[3])}let N6t=class{constructor(){this._items=new Pi({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return this._items.length===0}clear(){this._items.clear()}add(e){this._items.pushNew().object=e}sort(e){const i=e.eye,r=e.viewForward;this._items.forAll(n=>{const s=n.object.boundingVolumeWorldSpace.bounds,o=(s[0]-i[0])*r[0]+(s[1]-i[1])*r[1]+(s[2]-i[2])*r[2];n.distance=o,n.near=o-s[3],n.far=o+s[3]}),this._items.sort((n,s)=>n.distance-s.distance)}forEachInDepthRange(e,i,r){if(i===_m.DepthOrder.FRONT_TO_BACK)for(let n=0;ne.far||r(s.object,s.near,s.far)}else for(let n=this._items.length-1;n>=0;--n){const s=this._items.data[n];s.fare.far||r(s.object,s.near,s.far)}}},F6t=class{constructor(){this._view=Qe(),this._viewProj=Qe(),this._frustum=OL(),this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange={near:0,far:0}}compute(e,i){this._reset(),Ao(this._view,e.viewMatrix),nn(this._viewProj,e.projectionMatrix,this._view),bU(this._frustum,e.frustum);const r=this._view,n=r[2],s=r[6],o=r[10],l=r[14];i.forAll(T=>T.forEachGeometry(A=>{if(!A.visible||!A.castShadow)return;const M=A.boundingSphere,I=n*M[0]+s*M[1]+o*M[2]+l,L=I-M[3],F=I+M[3];this._geometries.push(A),this._near.push(-F),this._far.push(-L)}));const c=new Fce;if(this._geometries.length===0)return c;for(let T=0;Tc.far&&(c.far=this._near[T]),this._near[T]>2&&this._far[T]=f.near?c.near=this._near[T]:this._nearCandidates[_++]=T),this._far[T]>c.far&&(this._far[T]<=f.far?c.far=this._far[T]:this._farCandidates[x++]=T);if(this._nearCandidates.length===0&&this._farCandidates.length===0)return c;this._nearCandidates.sort((T,A)=>this._near[T]this._near[A]?1:0),this._farCandidates.sort((T,A)=>this._far[T]this._far[A]?-1:0);for(let T=0;Tc.far){const M=this._geometries[A],I=M.boundingInfo;this._includeFarBoundingInfoRec(I,M.shaderTransformation,c)}}return this._reset(),c}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_includeNearBoundingInfoRec(e,i,r){if(e==null)return;const n=e.center;bt(tu,n,i);const s=l5(i),o=tu[0],l=tu[1],c=tu[2],f=e.radius*s,_=this._frustum;if(_[0][0]*o+_[0][1]*l+_[0][2]*c+_[0][3]>f||_[1][0]*o+_[1][1]*l+_[1][2]*c+_[1][3]>f||_[2][0]*o+_[2][1]*l+_[2][2]*c+_[2][3]>f||_[3][0]*o+_[3][1]*l+_[3][2]*c+_[3][3]>f)return;const x=this._view[2]*o+this._view[6]*l+this._view[10]*c+this._view[14],T=x+f;if(!(-(x-f)<2||-T>=r.near))if(-T>this._looseRange.near)r.near=-T;else{if(f>Qie){const A=e.getChildren();if(A!==void 0){for(const M of A)this._includeNearBoundingInfoRec(M,i,r);return}}tre.unionDepthRangeWithAABB(r,this._viewProj,i,e.bbMin,e.bbMax)}}_includeFarBoundingInfoRec(e,i,r){if(e==null)return;let n=e.radius;const s=e.center;bt(tu,s,i);const o=l5(i),l=tu[0],c=tu[1],f=tu[2];n*=o;const _=this._frustum;if(_[0][0]*l+_[0][1]*c+_[0][2]*f+_[0][3]>n||_[1][0]*l+_[1][1]*c+_[1][2]*f+_[1][3]>n||_[2][0]*l+_[2][1]*c+_[2][2]*f+_[2][3]>n||_[3][0]*l+_[3][1]*c+_[3][2]*f+_[3][3]>n)return;const x=this._view[2]*l+this._view[6]*c+this._view[10]*f+this._view[14]-n;if(!(-x<=r.far))if(-xQie){const T=e.getChildren();if(T!==void 0){for(const A of T)this._includeFarBoundingInfoRec(A,i,r);return}}tre.unionDepthRangeWithAABB(r,this._viewProj,i,e.bbMin,e.bbMax)}}},k6t=class{constructor(){this._modelViewProj=Qe(),this._clipPosition=[Xi(),Xi(),Xi(),Xi(),Xi(),Xi(),Xi(),Xi()]}unionDepthRangeWithAABB(e,i,r,n,s){const o=this._modelViewProj;nn(o,i,r);let l=!1;for(let c=0;c<8;++c){const f=this._clipPosition[c],_=c===0||c===3||c===4||c===7?n[0]:s[0],x=c===0||c===1||c===4||c===5?n[1]:s[1],T=c<4?n[2]:s[2];f[0]=o[0]*_+o[4]*x+o[8]*T+o[12],f[1]=o[1]*_+o[5]*x+o[9]*T+o[13],f[2]=o[2]*_+o[6]*x+o[10]*T+o[14],f[3]=o[3]*_+o[7]*x+o[11]*T+o[15]}for(let c=0;c<12;++c){const f=this._clipPosition[DY[c][0]],_=this._clipPosition[DY[c][1]],x=this._clipPosition[DY[c][2]],T=this._clipTriangle(f,_,x);let A=!0;for(let M=0;M=2){A=!1;break}if(!A){l=!0;for(let M=0;M=-e[3]:i===1?e[1]>=-e[3]:i===2?e[0]<=e[3]:i===3?e[1]<=e[3]:void Xt(!1)}_intersect(e,i,r){let n=0;return r===0?n=(-e[3]-e[0])/(i[0]-e[0]+i[3]-e[3]):r===1?n=(-e[3]-e[1])/(i[1]-e[1]+i[3]-e[3]):r===2?n=(e[3]-e[0])/(i[0]-e[0]-i[3]+e[3]):r===3&&(n=(e[3]-e[1])/(i[1]-e[1]-i[3]+e[3])),_B(Xi(),e,i,n)}_clipTriangle(e,i,r){let n=[e,i,r];for(let s=0;s<4;++s){const o=n;n=[];for(let l=0;lG6t(e,i))),t.varyings.add("vUV","vec2"),t.vertex.code.add(V`void main(void) { +}`),t}const S9t=Object.freeze(Object.defineProperty({__proto__:null,OITCompositingPassParameters:iue,build:xke},Symbol.toStringTag,{value:"Module"}));let Ske=class Tke extends Hr{initializeProgram(e){return new $r(e.rctx,Tke.shader.get().build(),Cr)}initializePipeline(){return Ti({blending:Pl(ot.SRC_ALPHA,ot.ONE,ot.ONE_MINUS_SRC_ALPHA,ot.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}};Ske.shader=new Ir(S9t,()=>we(()=>Promise.resolve().then(()=>TXt),void 0));let T9t=class{constructor(e,i){this._rctx=e,this._techniqueRepository=i,this._configuration=new bV,this._passParameters=new VG,this._oitParameters=new iue,this._hudParameters=new tue}compositeOIT(e,i,r,n){this._oitParameters.colorTexture=i,this._oitParameters.alphaTexture=r,this._oitParameters.frontFaceTexture=n;const s=this._techniqueRepository.acquire(Ske);this._rctx.bindTechnique(s,this._oitParameters,e),this._rctx.screen.draw(),s.release()}compositeHUD(e,i){this._hudParameters.texture=i;const r=this._techniqueRepository.acquire(bke);this._rctx.bindTechnique(r,this._hudParameters,e),this._rctx.screen.draw(),r.release()}composite(e,i,r=bc.None,n=1){this._configuration.alphaMode=r,this._configuration.hasOpacityFactor=n!==1,this._passParameters.texture=i,this._passParameters.opacity=n;const s=this._techniqueRepository.acquire(eue,this._configuration);this._rctx.bindTechnique(s,this._passParameters,e),this._rctx.screen.draw(),s.release()}};const E9t=1e4,are=100,C9t=500,A9t=500,M9t=.1;function O9t(t,e,i){return ice(e,t)*(i[1]-i[0])+i[0]}function P9t(t,e,i){let r=0;if(!e.some(s=>(r+=s.numGeometries,r>=E9t)))return k9t.compute(t,e);const n=v6();return i.forAll(s=>HP(n,R9t(t,s))),n}function R9t(t,e){if(!e.visible)return;const i=v6(),r=e.getSpatialQueryAccelerator();return r?I9t(i,t,r):$9t(i,t,e.objects),i}function I9t(t,e,i){const r=e.eye,n=e.viewForward,s=e.frustum,o=c=>c.visible,a=i.objectCount;if(a{lre(t,e,c),gf.far=t.near,p.setRange(gf)},s,o),l9(gf,Math.max(t.far,e.near),e.far),i.forEachInDepthRange(r,n,xm.DepthOrder.BACK_TO_FRONT,gf,(c,p)=>{lre(t,e,c),gf.near=t.far,p.setRange(gf)},s,o);else{const c=Math.max(Math.min(a,A9t),Math.ceil(a*M9t)),p=i.findClosest(n,xm.DepthOrder.FRONT_TO_BACK,s,o,c),_=i.findClosest(n,xm.DepthOrder.BACK_TO_FRONT,s,o,c);p&&_&&(pwe(t,e,p.boundingVolumeWorldSpace.bounds),pwe(t,e,_.boundingVolumeWorldSpace.bounds))}}function $9t(t,e,i){WC.clear(),i.forAll(r=>{r.visible&&r.geometries.length!==0&&WC.add(r)}),WC.empty||(WC.sort(e),l9(gf,e.near,Math.min(t.near,e.far)),WC.forEachInDepthRange(gf,xm.DepthOrder.FRONT_TO_BACK,(r,n)=>{n{t.far=Math.max(t.far,s)}))}function lre(t,e,i){if(!i.visible||!m2(e.frustum,i.boundingVolumeWorldSpace.bounds))return;const r=i.transformation,n=F9t;i.geometries.forEach(s=>{sn(n,r,s.transformation);const o=yP(n);Eke(t,e,s.boundingInfo,n,o)})}function Eke(t,e,i,r,n){if(i==null)return;bt(nu,i.center,r);const{eye:s,viewForward:o}=e,a=o[0]*(nu[0]-s[0])+o[1]*(nu[1]-s[1])+o[2]*(nu[2]-s[2]);if(nu[3]=i.radius*n,!(a-nu[3]>t.near&&a+nu[3]are&&i.getChildren())for(const c of i.getChildren())Eke(t,e,c,r,n);else cre.unionDepthRangeWithAABB(t,e.viewProjectionMatrix,r,i.bbMin,i.bbMax)}function pwe(t,e,i){const r=e.eye,n=e.viewForward,s=(i[0]-r[0])*n[0]+(i[1]-r[1])*n[1]+(i[2]-r[2])*n[2];t.near=Math.min(t.near,s-i[3]),t.far=Math.max(t.far,s+i[3])}let L9t=class{constructor(){this._items=new Pi({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return this._items.length===0}clear(){this._items.clear()}add(e){this._items.pushNew().object=e}sort(e){const i=e.eye,r=e.viewForward;this._items.forAll(n=>{const s=n.object.boundingVolumeWorldSpace.bounds,o=(s[0]-i[0])*r[0]+(s[1]-i[1])*r[1]+(s[2]-i[2])*r[2];n.distance=o,n.near=o-s[3],n.far=o+s[3]}),this._items.sort((n,s)=>n.distance-s.distance)}forEachInDepthRange(e,i,r){if(i===xm.DepthOrder.FRONT_TO_BACK)for(let n=0;ne.far||r(s.object,s.near,s.far)}else for(let n=this._items.length-1;n>=0;--n){const s=this._items.data[n];s.fare.far||r(s.object,s.near,s.far)}}},D9t=class{constructor(){this._view=Qe(),this._viewProj=Qe(),this._frustum=kL(),this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange={near:0,far:0}}compute(e,i){this._reset(),Mo(this._view,e.viewMatrix),sn(this._viewProj,e.projectionMatrix,this._view),wU(this._frustum,e.frustum);const r=this._view,n=r[2],s=r[6],o=r[10],a=r[14];i.forAll(S=>S.forEachGeometry(C=>{if(!C.visible||!C.castShadow)return;const M=C.boundingSphere,P=n*M[0]+s*M[1]+o*M[2]+a,$=P-M[3],F=P+M[3];this._geometries.push(C),this._near.push(-F),this._far.push(-$)}));const c=new Zce;if(this._geometries.length===0)return c;for(let S=0;Sc.far&&(c.far=this._near[S]),this._near[S]>2&&this._far[S]=p.near?c.near=this._near[S]:this._nearCandidates[_++]=S),this._far[S]>c.far&&(this._far[S]<=p.far?c.far=this._far[S]:this._farCandidates[x++]=S);if(this._nearCandidates.length===0&&this._farCandidates.length===0)return c;this._nearCandidates.sort((S,C)=>this._near[S]this._near[C]?1:0),this._farCandidates.sort((S,C)=>this._far[S]this._far[C]?-1:0);for(let S=0;Sc.far){const M=this._geometries[C],P=M.boundingInfo;this._includeFarBoundingInfoRec(P,M.shaderTransformation,c)}}return this._reset(),c}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_includeNearBoundingInfoRec(e,i,r){if(e==null)return;const n=e.center;bt(nu,n,i);const s=yP(i),o=nu[0],a=nu[1],c=nu[2],p=e.radius*s,_=this._frustum;if(_[0][0]*o+_[0][1]*a+_[0][2]*c+_[0][3]>p||_[1][0]*o+_[1][1]*a+_[1][2]*c+_[1][3]>p||_[2][0]*o+_[2][1]*a+_[2][2]*c+_[2][3]>p||_[3][0]*o+_[3][1]*a+_[3][2]*c+_[3][3]>p)return;const x=this._view[2]*o+this._view[6]*a+this._view[10]*c+this._view[14],S=x+p;if(!(-(x-p)<2||-S>=r.near))if(-S>this._looseRange.near)r.near=-S;else{if(p>are){const C=e.getChildren();if(C!==void 0){for(const M of C)this._includeNearBoundingInfoRec(M,i,r);return}}cre.unionDepthRangeWithAABB(r,this._viewProj,i,e.bbMin,e.bbMax)}}_includeFarBoundingInfoRec(e,i,r){if(e==null)return;let n=e.radius;const s=e.center;bt(nu,s,i);const o=yP(i),a=nu[0],c=nu[1],p=nu[2];n*=o;const _=this._frustum;if(_[0][0]*a+_[0][1]*c+_[0][2]*p+_[0][3]>n||_[1][0]*a+_[1][1]*c+_[1][2]*p+_[1][3]>n||_[2][0]*a+_[2][1]*c+_[2][2]*p+_[2][3]>n||_[3][0]*a+_[3][1]*c+_[3][2]*p+_[3][3]>n)return;const x=this._view[2]*a+this._view[6]*c+this._view[10]*p+this._view[14]-n;if(!(-x<=r.far))if(-xare){const S=e.getChildren();if(S!==void 0){for(const C of S)this._includeFarBoundingInfoRec(C,i,r);return}}cre.unionDepthRangeWithAABB(r,this._viewProj,i,e.bbMin,e.bbMax)}}},N9t=class{constructor(){this._modelViewProj=Qe(),this._clipPosition=[Xi(),Xi(),Xi(),Xi(),Xi(),Xi(),Xi(),Xi()]}unionDepthRangeWithAABB(e,i,r,n,s){const o=this._modelViewProj;sn(o,i,r);let a=!1;for(let c=0;c<8;++c){const p=this._clipPosition[c],_=c===0||c===3||c===4||c===7?n[0]:s[0],x=c===0||c===1||c===4||c===5?n[1]:s[1],S=c<4?n[2]:s[2];p[0]=o[0]*_+o[4]*x+o[8]*S+o[12],p[1]=o[1]*_+o[5]*x+o[9]*S+o[13],p[2]=o[2]*_+o[6]*x+o[10]*S+o[14],p[3]=o[3]*_+o[7]*x+o[11]*S+o[15]}for(let c=0;c<12;++c){const p=this._clipPosition[HY[c][0]],_=this._clipPosition[HY[c][1]],x=this._clipPosition[HY[c][2]],S=this._clipTriangle(p,_,x);let C=!0;for(let M=0;M=2){C=!1;break}if(!C){a=!0;for(let M=0;M=-e[3]:i===1?e[1]>=-e[3]:i===2?e[0]<=e[3]:i===3?e[1]<=e[3]:void Xt(!1)}_intersect(e,i,r){let n=0;return r===0?n=(-e[3]-e[0])/(i[0]-e[0]+i[3]-e[3]):r===1?n=(-e[3]-e[1])/(i[1]-e[1]+i[3]-e[3]):r===2?n=(e[3]-e[0])/(i[0]-e[0]-i[3]+e[3]):r===3&&(n=(e[3]-e[1])/(i[1]-e[1]-i[3]+e[3])),vB(Xi(),e,i,n)}_clipTriangle(e,i,r){let n=[e,i,r];for(let s=0;s<4;++s){const o=n;n=[];for(let a=0;aB9t(e,i))),t.varyings.add("vUV","vec2"),t.vertex.code.add(V`void main(void) { vUV = position; gl_Position = vec4(drawPosition.xy + vec2(position - 0.5) * drawPosition.zw, 0.0, 1.0); -}`),t.fragment.uniforms.add(new Zt("textureInput",e=>e.textures.input)),t.fragment.uniforms.add(new Zt("textureMask",e=>e.textures.mask)),t.fragment.uniforms.add(new Zt("textureOverlay",e=>e.textures.overlay)),t.fragment.uniforms.add(new Oy("maskEnabled",e=>e.magnifier.maskEnabled)),t.fragment.uniforms.add(new Oy("overlayEnabled",e=>e.magnifier.overlayEnabled)),t.fragment.code.add(V`const float barrelFactor = 1.1; +}`),t.fragment.uniforms.add(new Zt("textureInput",e=>e.textures.input)),t.fragment.uniforms.add(new Zt("textureMask",e=>e.textures.mask)),t.fragment.uniforms.add(new Zt("textureOverlay",e=>e.textures.overlay)),t.fragment.uniforms.add(new Dy("maskEnabled",e=>e.magnifier.maskEnabled)),t.fragment.uniforms.add(new Dy("overlayEnabled",e=>e.magnifier.overlayEnabled)),t.fragment.code.add(V`const float barrelFactor = 1.1; vec2 barrel(vec2 uv) { vec2 uvn = uv * 2.0 - 1.0; if (uvn.x == 0.0 && uvn.y == 0.0) { @@ -4622,11 +4611,11 @@ float mask = maskEnabled ? texture(textureMask, vUV).a : 1.0; vec4 inputColor = texture(textureInput, barrel(vUV)) * mask; vec4 overlayColor = overlayEnabled ? texture(textureOverlay, vUV) : vec4(0); fragColor = overlayColor + (1.0 - overlayColor.a) * inputColor; -}`),t}function G6t(t,e){const i=e.camera.pixelRatio,r=t.magnifier.offset.x*i,n=t.magnifier.offset.y*i;dm(t.magnifier.position,pwe);const s=e.camera.screenToRender(pwe,H6t),o=Math.ceil(i*t.magnifier.size),l=e.camera.fullWidth,c=e.camera.fullHeight;return rs(q6t,(s[0]+r)/l*2-1,(s[1]-n)/c*2-1,o/l*2,o/c*2)}const pwe=ss(),H6t=gse(),q6t=Xi();async function W6t(t){const e=we(()=>import("./mask-svg-t31ntHky.js"),__vite__mapDeps([])),i=we(()=>import("./overlay-svg-nrczOnQN.js"),__vite__mapDeps([])),r=C_((await e).default,{signal:t}),n=C_((await i).default,{signal:t}),s={mask:await r,overlay:await n};return St(t),s}let JA=class extends ze{constructor(){super(...arguments),this._magnifier=null,this._imageSources=null,this._imageLoadTask=null,this._resources=null,this._passParameters=new B6t,this.events=new Dn,this.attributeLocations=new Map([[J.POSITION,0]]),this._tmpScreenPoint=ss(),this._tmpRenderPoint=gse()}get updating(){return this._imageSources==null&&this._imageLoadTask!=null&&!this._imageLoadTask.task.finished}get magnifier(){return this._magnifier}set magnifier(e){if(e===this._magnifier)return;this.removeAllHandles(),this._magnifier=e;const i=()=>{this._updateResourceLoading(),this.events.emit("request-render")};this._magnifier!=null&&this.addHandles(_e(()=>{var r;return(r=this._magnifier)==null?void 0:r.version},i)),i()}get enabled(){return this._validMagnifier!=null}get _validMagnifier(){return this._magnifier!=null&&this._magnifier.visible&&this._magnifier.position!=null&&this._magnifier.size>0?this._magnifier:null}get _factor(){return this._magnifier!=null&&this._magnifier.factor||1}destroy(){this._magnifier=null,this._imageLoadTask!=null&&(this._imageLoadTask.task.abort(),this._imageLoadTask=null),this._disposeResources()}render(e,i){const r=this._validMagnifier;if(r==null)return;const n=i.camera.pixelRatio,s=Math.ceil(n*r.size);if(this._updateResources(e,s),this._resources==null)return;const o=this._passParameters.textures,l=Math.ceil(1/this._factor*s);o.input.resize(l,l),dm(r.position,this._tmpScreenPoint);const c=i.camera.screenToRender(this._tmpScreenPoint,this._tmpRenderPoint),f=i.camera.fullWidth,_=i.camera.fullHeight,x=.5*l,T=.5*l;c[0]=Je(c[0],x,f-x-1),c[1]=Je(c[1],T,_-T-1);const A=Math.floor(c[0]-x),M=Math.floor(c[1]-T),I=this._resources.program;I.bindTexture("textureInput",o.input),e.gl.copyTexImage2D(o.input.descriptor.target,0,o.input.descriptor.pixelFormat,A,M,l,l,0),this._passParameters.magnifier=r,e.useProgram(I),I.bindPass(this._passParameters,i),e.bindVAO(this._resources.vao),e.setPipelineState(this._resources.pipelineState),e.drawArrays(sr.TRIANGLE_STRIP,0,4)}_updateResourceLoading(){const e=this._validMagnifier;if(e==null)return;const i=e.maskUrl,r=e.overlayUrl;this._imageLoadTask==null||this._imageLoadTask.maskUrl===i&&this._imageLoadTask.overlayUrl===r||(this._imageLoadTask.task.abort(),this._imageLoadTask=null,this._imageSources=null),this._imageSources==null&&this._imageLoadTask==null&&(this._imageLoadTask={maskUrl:i,overlayUrl:r,task:Cc(async n=>{const s=i==null||r==null?W6t(n):null,o=i!=null?C_(i,{signal:n}):s.then(c=>c.mask),l=r!=null?C_(r,{signal:n}):s.then(c=>c.overlay);this._imageSources={mask:await o,overlay:await l},this._disposeResources(),this.events.emit("request-render")})},this._imageLoadTask.task.promise.then(()=>this.notifyChange("updating"),()=>this.notifyChange("updating")))}_updateResources(e,i){if(!this.enabled)return void this._disposeResources();if(this._resources!=null){if(this._passParameters.textures.size!==i){const n=this._createTextureResources(e,i);if(n==null)return void this._disposeResources();this._disposeTextureResources(this._passParameters.textures),this._passParameters.textures=n}return}const r=this._createTextureResources(e,i);r!=null&&(this._resources={program:this._createProgram(e),vao:u1(e,yae,this.attributeLocations,0,1),pipelineState:Ti({blending:hd(st.ONE,st.ONE_MINUS_SRC_ALPHA),depthTest:null,depthWrite:null,colorWrite:ji})},this._passParameters.textures=r)}_disposeResources(){this._resources!=null&&(this._disposeTextureResources(this._passParameters.textures),this._resources.program.dispose(),this._resources.vao.dispose(),this._resources=null)}_disposeTextureResources(e){e.mask.dispose(),e.overlay.dispose(),e.input.dispose()}_createTextureResources(e,i){if(this._imageSources==null)return null;this._imageSources.overlay.width=i,this._imageSources.overlay.height=i,this._imageSources.mask.width=i,this._imageSources.mask.height=i;const r=new tn;r.internalFormat=ci.RGBA,r.wrapMode=Bi.CLAMP_TO_EDGE,r.flipped=!0,r.preMultiplyAlpha=!gEe(this._imageSources.overlay.src)||!e.driverTest.svgPremultipliesAlpha.result;const n=new Ai(e,r,this._imageSources.overlay);r.pixelFormat=r.internalFormat=ci.ALPHA,r.preMultiplyAlpha=!1;const s=new Ai(e,r,this._imageSources.mask);return r.pixelFormat=r.internalFormat=ci.RGBA,r.flipped=!1,{input:new Ai(e,r),mask:s,overlay:n,size:i}}_createProgram(e){return new Ir(e,j6t(),this.attributeLocations)}};y([w()],JA.prototype,"_imageSources",void 0),y([w()],JA.prototype,"_imageLoadTask",void 0),y([w({readOnly:!0})],JA.prototype,"updating",null),JA=y([Z("esri/views/3d/webgl-engine/lib/MagnifierHelper")],JA);let Y6t=class{constructor(){this.declaredClass="esri.views.3d.webgl-engine.lib.ObjectAndLayerIdRenderHelper",this.colorZero=new Ac(new ArrayBuffer(4)),this._uidToRenderColor=new Map,this._colorToUID=new Map,this._layerUidToGraphicsUidToObjectId=new Map,this._layerUidToId=new Map,this._layerUidToPopupEnabled=new Map}setUidToObjectAndLayerId(e,i,r,n,s,o=null,l=null,c=null){if(!(e&&i&&r&&n)||(this._layerUidToId.set(n,r),this._layerUidToPopupEnabled.set(n,s),!s))return;let f=this._layerUidToGraphicsUidToObjectId.get(n);f||(f=new Map,this._layerUidToGraphicsUidToObjectId.set(n,f)),f.set(i,{objectId:e,attributeNodeId:o,attributeIndex:l,subLayerId:c})}getObjectAndLayerIdColor(e){const i=this.getObjectAndLayerIdColorArray(e);return Mi(i.get(0,1),i.get(0,2),i.get(0,3),255)}getObjectAndLayerIdColorArray(e){if(!e.layerUid||!e.graphicUid)return this.colorZero;const i=this._layerUidToPopupEnabled.get(e.layerUid);if(i===void 0)return Ce.getLogger(this).warn("popupEnabled is undefined for layerUid "+e.layerUid),this.colorZero;if(i===!1)return this.colorZero;let r=this._uidToRenderColor.get(e.layerUid);r||(r=new Map,this._uidToRenderColor.set(e.layerUid,r));let n=r.get(e.graphicUid);if(!n){for(;!n;){const o=Math.floor(16777214*Math.random())+1;this._colorToUID.has(o)||(n=o)}if(n>16777215)throw new Error("Object ID Overflow");r.set(e.graphicUid,n),this._colorToUID.set(n,e)}const s=new ArrayBuffer(4);return new DataView(s).setUint32(0,n,!1),new Ac(s)}getColorToObjectAndLayerIdMapping(){const e=new Map;for(const[i,r]of this._colorToUID.entries()){const n=this._layerUidToGraphicsUidToObjectId.get(r.layerUid);let s=null;n?(s=n.get(r.graphicUid),s||Ce.getLogger(this).warn("getColorMapping: no entry found for graphicsId "+r.graphicUid)):Ce.getLogger(this).warn("getColorMapping: no entry found for layerUid "+r.layerUid);const o=this._layerUidToId.get(r.layerUid);o||Ce.getLogger(this).warn("no layerId found for uid "+r.layerUid),s&&o&&e.set(i,s.attributeNodeId?{type:"object-and-layer-and-i3s-id",oid:s.objectId,lid:o,attrId:s.attributeNodeId,attrIdx:s.attributeIndex,subLayerId:s.subLayerId}:{type:"object-and-layer-id",oid:s.objectId,lid:o})}return e}};var e9;(function(t){t[t.FrontToBack=0]="FrontToBack",t[t.BackToFront=1]="BackToFront"})(e9||(e9={}));let Ib=class{constructor(e,i,r=e9.FrontToBack){this._rctx=e,this._techniqueRepository=i,this._sorting=r,this._draws=new Pi({initialSize:32,allocator:n=>n||{material:null,geometry:null,geometryRanges:null,bindDrawParams:null,depthSquaredHint:0,indexType:0}}),this._previouslyBoundDraw=new Map}submitDraw(e,i,r,n){const s=this._draws.pushNew();s.geometry=i,s.geometryRanges=r,s.material=e,s.depthSquaredHint=n,s.indexType=(i.indexed?i.vao.indexBuffer.indexType:null)??0}prepare(e,i){return this._draws.map(r=>r.material.prepareTechnique(this._techniqueRepository,e,i,r.geometry.parameters))}dispatch(e,i,r){const n=this._rctx;this._previouslyBoundDraw.clear();let s=null;const o=this._draws.length;for(let l=0;l{const n=e*(i.depthSquaredHint-r.depthSquaredHint);return n!==0?n:i.geometry.vao.byteSize-r.geometry.vao.byteSize})}get count(){return this._draws.length}};const _k=new Map;_k.set(Yt.UNSIGNED_BYTE,1),_k.set(Yt.UNSIGNED_SHORT,2),_k.set(Yt.UNSIGNED_INT,4);let ire=class extends kvt{constructor(){super({}),this._passes=null,this.produces=new Map([[ke.OPAQUE_MATERIAL,e=>this._produces(e)],[ke.TRANSPARENT_MATERIAL,e=>!!(this._passes&&this._passes.materialTransparent.count>0)&&this._produces(e)],[ke.INTEGRATED_MESH,e=>this._produces(e)]]),this._materialPassParameters=new wTt,this._shadowPassParameters=new xTt,this._highlightPassParameters=new STt,this._systems=new Set}initializeRenderContext(e){this._context=e;const i=e.renderContext.rctx,r=e.techniqueRepository;this._passes={materialOpaque:new Ib(i,r),materialTransparent:new Ib(i,r,e9.BackToFront),materialIntegratedMesh:new Ib(i,r),shadowMap:new Ib(i,r),highlight:new Ib(i,r),highlightIntegratedMesh:new Ib(i,r),highlightShadowMap:new Ib(i,r),defaultShadowMap:new Ib(i,r)}}get rctx(){return this._context.renderContext.rctx}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear()}register(e){this._systems.add(e)}_produces(e){return this._systems.size!==0&&this._passes!==null&&(e===ue.Highlight?this._passes.highlight.count>0||this._passes.highlightIntegratedMesh.count>0:e!==ue.ShadowHighlight||this._passes.highlight.count>0)}prepareRender(e){if(this._systems.size!==0&&this._passes!==null){for(const i of Object.values(this._passes))i.prepareSubmit();this._systems.forEach(i=>i.submit(this._passes,e.bindParameters));for(const i of Object.values(this._passes))i.finishSubmit();this._context.techniqueRepository.frameUpdate()}}prepareTechniques(e){if(this._systems.size===0)return null;const i=e.output===ue.Shadow||e.output===ue.ShadowHighlight||e.output===ue.ShadowExcludeHighlight?this._shadowPassParameters:e.output===ue.Highlight?this._highlightPassParameters:this._materialPassParameters,r=e.bindParameters;return this._updateParameters(r.camera,i,r.slot===ke.TRANSPARENT_MATERIAL),this._materialPassParameters.output=e.output,this._invoke(e,(n,s)=>n.prepare(s,e.bindParameters))}renderNode(e,i){this._invoke(e,(r,n)=>r.dispatch(n,e.bindParameters,i))}_invoke(e,i){if(this._passes===null)return null;switch(e.bindParameters.slot){case ke.OPAQUE_MATERIAL:switch(e.output){case ue.Color:case ue.Depth:case ue.Normal:case ue.ObjectAndLayerIdColor:return i(this._passes.materialOpaque,this._materialPassParameters);case ue.Highlight:return i(this._passes.highlight,this._highlightPassParameters);case ue.Shadow:return i(this._passes.shadowMap,this._shadowPassParameters);case ue.ShadowHighlight:return i(this._passes.highlightShadowMap,this._shadowPassParameters);case ue.ShadowExcludeHighlight:return i(this._passes.defaultShadowMap,this._shadowPassParameters)}break;case ke.TRANSPARENT_MATERIAL:switch(e.output){case ue.Color:case ue.Alpha:case ue.Depth:case ue.Normal:case ue.ObjectAndLayerIdColor:return i(this._passes.materialTransparent,this._materialPassParameters)}break;case ke.INTEGRATED_MESH:switch(e.output){case ue.Color:case ue.Depth:case ue.Normal:case ue.ObjectAndLayerIdColor:return i(this._passes.materialIntegratedMesh,this._materialPassParameters);case ue.Highlight:return i(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}}return null}notifyDirty(){this._context.requestRender()}queryDepthRange(e){const i=new Fce;return this._systems.forEach(r=>N5(i,r.queryShadowCasterDepthRange(e))),i}_updateParameters(e,i,r){const n=e.viewInverseTransposeMatrix;Ie(NY,n[3],n[7],n[11]),FY.set(NY),Ne(i.transformWorldFromViewTH,FY.high),Ne(i.transformWorldFromViewTL,FY.low),Ne(i.slicePlaneLocalOrigin,NY),Yf(i.transformViewFromCameraRelativeRS,e.viewMatrix),Ao(i.transformProjFromView,e.projectionMatrix),i.identifier===Hh.Material&&(this._materialPassParameters.transparent=r,Xf(fwe,i.transformViewFromCameraRelativeRS),_E(i.transformNormalViewFromGlobal,fwe))}};ire=y([Z("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],ire);const NY=W(),fwe=as(),FY=new PG;let X6t=class{constructor(e=null,i=null,r=null){this.composite=e,this.normal=i,this.highlight=r}},bk=class extends ze{constructor(e){super({}),this._context=e,this._renderPlugins=new Pi,this._slots=new Array;for(let i=0;i{if(i!=null&&i.aborted)throw e.uninitializeRenderContext(),ur();this._renderPlugins.push(e),e.produces.forEach((s,o)=>{this._slots[o].push(e)}),this._context.requestRender(),this.notifyChange("updating")},n=e.initializeRenderContext(this._context,i);if(pd(n))return n.then(r);r()}remove(e){if(this._renderPlugins.removeUnordered(e)!=null){for(let i=0;ir!==e);e.uninitializeRenderContext(),this._context.requestRender(),this.notifyChange("updating")}}prepareRender(){this._renderPlugins.forAll(e=>{e.prepareRender&&e.prepareRender(this._context.renderContext)})}updateAnimation(e){let i=!1;return this._renderPlugins.forAll(r=>{r.updateAnimation&&(i=r.updateAnimation(e)||i)}),i}renderFeatureChanged(){this._renderPlugins.forAll(e=>{e.renderFeatureChanged&&e.renderFeatureChanged()})}prepare(e){this._context.renderContext.bindParameters.slot=e,this._slots[e].forEach(i=>{const r=i.produces.get(e);r&&r(ue.Color)&&(mwe(i)&&i.prepareTechnique(this._context.renderContext),gwe(i)&&i.prepareTechniques(this._context.renderContext))})}_getRenderables(e){this._context.renderContext.bindParameters.slot=e;const i=new Map;return this._slots[e].forEach(r=>{const n=r.produces.get(e);if(n&&n(ue.Color)&&(!r.isDecoration||this._context.renderContext.bindParameters.decorations!==Xh.OFF))if(mwe(r)){const s=r.prepareTechnique(this._context.renderContext);s!=null&&i.set(r,s)}else if(gwe(r)){const s=r.prepareTechniques(this._context.renderContext);s!=null&&i.set(r,s)}else i.set(r,null)}),i}render(e,i=null,r=null){return this._getRenderables(e).forEach((n,s)=>r=s.renderNode(this._context.renderContext,n,i,r)),r}renderComposition(e,i){const r=this._getRenderables(e);let n=null;return r.forEach((s,o)=>{const l=o.renderNode(this._context.renderContext,s,i,null);n==null||n.release(),n=l,i.composite=n}),n}queryDepthRange(e){const i=new Fce;return this._renderPlugins.forAll(r=>{var s;const n=(s=r.queryDepthRange)==null?void 0:s.call(r,e);N5(i,n)}),i}get updating(){return this._renderPlugins.some(e=>e.running)}produces(e,i=ue.Color){return this._slots[e].some(r=>{const n=r.produces.get(e);return!!n&&n(i)})}consumes(e){return this._renderPlugins.some(i=>i.consumes().required.includes(e))}get hasDecorations(){return this._renderPlugins.some(e=>e.isDecoration)}get renderOccludedFlags(){return this._renderPlugins.reduce((e,i)=>e|i.renderOccludedFlags,Wn.None)}get usedMemory(){return this._renderPlugins.reduce((e,i)=>e+(i.usedMemory??0),0)}};function mwe(t){return"prepareTechnique"in t}function gwe(t){return"prepareTechniques"in t}y([w({readOnly:!0})],bk.prototype,"updating",null),bk=y([Z("esri.views.3d.webgl-engine.lib.RenderPluginManager")],bk);let KA=class extends CE{constructor(e){super(e),this._context=null,this.opacity=1,this.alphaMode=yc.None,this._blitConfiguration=new _V,this._blitParameters=new RG,this.produces=new Map([[ke.BLIT,()=>this._context!=null]])}consumes(){return RLe}initializeRenderContext(e){this._context=e}uninitializeRenderContext(){this._context=null}destroy(){}renderNode(e,i,r,n){var l;const s=(l=r==null?void 0:r.composite)==null?void 0:l.colorTexture;if(!this._context||!s)return n;const o=this._context.techniqueRepository.acquire(Vce,this._blitConfiguration);return o!=null&&o.compiled?(e.rctx.bindFramebuffer(n==null?void 0:n.fbo),this._blitParameters.texture=s,this._blitParameters.opacity=this.opacity,e.rctx.bindTechnique(o,this._blitParameters,e.bindParameters),e.rctx.screen.draw(),o.release(),n):(this._context.requestRender(),n)}};y([w()],KA.prototype,"_context",void 0),y([w()],KA.prototype,"opacity",void 0),y([w()],KA.prototype,"alphaMode",void 0),KA=y([Z("esri.views.3d.webgl-engine.effects.blit.Blit")],KA);let Gce=class extends _n{};function Mke(){const t=new Cr,{outputs:e,fragment:i}=t;return t.include(Pc),i.uniforms.add(new $f("textureInput",r=>r.input)),i.constants.add("outlineSize","int",Math.ceil(IG/2)),e.add("fragGrid","vec2"),i.code.add(V` +}`),t}function B9t(t,e){const i=e.camera.pixelRatio,r=t.magnifier.offset.x*i,n=t.magnifier.offset.y*i;mm(t.magnifier.position,fwe);const s=e.camera.screenToRender(fwe,j9t),o=Math.ceil(i*t.magnifier.size),a=e.camera.fullWidth,c=e.camera.fullHeight;return rs(G9t,(s[0]+r)/a*2-1,(s[1]-n)/c*2-1,o/a*2,o/c*2)}const fwe=ss(),j9t=hse(),G9t=Xi();async function H9t(t){const e=we(()=>import("./mask-svg-t31ntHky.js"),__vite__mapDeps([])),i=we(()=>import("./overlay-svg-nrczOnQN.js"),__vite__mapDeps([])),r=$_((await e).default,{signal:t}),n=$_((await i).default,{signal:t}),s={mask:await r,overlay:await n};return St(t),s}let tM=class extends ze{constructor(){super(...arguments),this._magnifier=null,this._imageSources=null,this._imageLoadTask=null,this._resources=null,this._passParameters=new U9t,this.events=new Dn,this.attributeLocations=new Map([[J.POSITION,0]]),this._tmpScreenPoint=ss(),this._tmpRenderPoint=hse()}get updating(){return this._imageSources==null&&this._imageLoadTask!=null&&!this._imageLoadTask.task.finished}get magnifier(){return this._magnifier}set magnifier(e){if(e===this._magnifier)return;this.removeAllHandles(),this._magnifier=e;const i=()=>{this._updateResourceLoading(),this.events.emit("request-render")};this._magnifier!=null&&this.addHandles(_e(()=>{var r;return(r=this._magnifier)==null?void 0:r.version},i)),i()}get enabled(){return this._validMagnifier!=null}get _validMagnifier(){return this._magnifier!=null&&this._magnifier.visible&&this._magnifier.position!=null&&this._magnifier.size>0?this._magnifier:null}get _factor(){return this._magnifier!=null&&this._magnifier.factor||1}destroy(){this._magnifier=null,this._imageLoadTask!=null&&(this._imageLoadTask.task.abort(),this._imageLoadTask=null),this._disposeResources()}render(e,i){const r=this._validMagnifier;if(r==null)return;const n=i.camera.pixelRatio,s=Math.ceil(n*r.size);if(this._updateResources(e,s),this._resources==null)return;const o=this._passParameters.textures,a=Math.ceil(1/this._factor*s);o.input.resize(a,a),mm(r.position,this._tmpScreenPoint);const c=i.camera.screenToRender(this._tmpScreenPoint,this._tmpRenderPoint),p=i.camera.fullWidth,_=i.camera.fullHeight,x=.5*a,S=.5*a;c[0]=Je(c[0],x,p-x-1),c[1]=Je(c[1],S,_-S-1);const C=Math.floor(c[0]-x),M=Math.floor(c[1]-S),P=this._resources.program;P.bindTexture("textureInput",o.input),e.gl.copyTexImage2D(o.input.descriptor.target,0,o.input.descriptor.pixelFormat,C,M,a,a,0),this._passParameters.magnifier=r,e.useProgram(P),P.bindPass(this._passParameters,i),e.bindVAO(this._resources.vao),e.setPipelineState(this._resources.pipelineState),e.drawArrays(sr.TRIANGLE_STRIP,0,4)}_updateResourceLoading(){const e=this._validMagnifier;if(e==null)return;const i=e.maskUrl,r=e.overlayUrl;this._imageLoadTask==null||this._imageLoadTask.maskUrl===i&&this._imageLoadTask.overlayUrl===r||(this._imageLoadTask.task.abort(),this._imageLoadTask=null,this._imageSources=null),this._imageSources==null&&this._imageLoadTask==null&&(this._imageLoadTask={maskUrl:i,overlayUrl:r,task:Oc(async n=>{const s=i==null||r==null?H9t(n):null,o=i!=null?$_(i,{signal:n}):s.then(c=>c.mask),a=r!=null?$_(r,{signal:n}):s.then(c=>c.overlay);this._imageSources={mask:await o,overlay:await a},this._disposeResources(),this.events.emit("request-render")})},this._imageLoadTask.task.promise.then(()=>this.notifyChange("updating"),()=>this.notifyChange("updating")))}_updateResources(e,i){if(!this.enabled)return void this._disposeResources();if(this._resources!=null){if(this._passParameters.textures.size!==i){const n=this._createTextureResources(e,i);if(n==null)return void this._disposeResources();this._disposeTextureResources(this._passParameters.textures),this._passParameters.textures=n}return}const r=this._createTextureResources(e,i);r!=null&&(this._resources={program:this._createProgram(e),vao:v1(e,Pae,this.attributeLocations,0,1),pipelineState:Ti({blending:md(ot.ONE,ot.ONE_MINUS_SRC_ALPHA),depthTest:null,depthWrite:null,colorWrite:ji})},this._passParameters.textures=r)}_disposeResources(){this._resources!=null&&(this._disposeTextureResources(this._passParameters.textures),this._resources.program.dispose(),this._resources.vao.dispose(),this._resources=null)}_disposeTextureResources(e){e.mask.dispose(),e.overlay.dispose(),e.input.dispose()}_createTextureResources(e,i){if(this._imageSources==null)return null;this._imageSources.overlay.width=i,this._imageSources.overlay.height=i,this._imageSources.mask.width=i,this._imageSources.mask.height=i;const r=new rn;r.internalFormat=ci.RGBA,r.wrapMode=Bi.CLAMP_TO_EDGE,r.flipped=!0,r.preMultiplyAlpha=!zTe(this._imageSources.overlay.src)||!e.driverTest.svgPremultipliesAlpha.result;const n=new Ai(e,r,this._imageSources.overlay);r.pixelFormat=r.internalFormat=ci.ALPHA,r.preMultiplyAlpha=!1;const s=new Ai(e,r,this._imageSources.mask);return r.pixelFormat=r.internalFormat=ci.RGBA,r.flipped=!1,{input:new Ai(e,r),mask:s,overlay:n,size:i}}_createProgram(e){return new $r(e,V9t(),this.attributeLocations)}};y([w()],tM.prototype,"_imageSources",void 0),y([w()],tM.prototype,"_imageLoadTask",void 0),y([w({readOnly:!0})],tM.prototype,"updating",null),tM=y([Z("esri/views/3d/webgl-engine/lib/MagnifierHelper")],tM);let q9t=class{constructor(){this.declaredClass="esri.views.3d.webgl-engine.lib.ObjectAndLayerIdRenderHelper",this.colorZero=new Pc(new ArrayBuffer(4)),this._uidToRenderColor=new Map,this._colorToUID=new Map,this._layerUidToGraphicsUidToObjectId=new Map,this._layerUidToId=new Map,this._layerUidToPopupEnabled=new Map}setUidToObjectAndLayerId(e,i,r,n,s,o=null,a=null,c=null){if(!(e&&i&&r&&n)||(this._layerUidToId.set(n,r),this._layerUidToPopupEnabled.set(n,s),!s))return;let p=this._layerUidToGraphicsUidToObjectId.get(n);p||(p=new Map,this._layerUidToGraphicsUidToObjectId.set(n,p)),p.set(i,{objectId:e,attributeNodeId:o,attributeIndex:a,subLayerId:c})}getObjectAndLayerIdColor(e){const i=this.getObjectAndLayerIdColorArray(e);return Mi(i.get(0,1),i.get(0,2),i.get(0,3),255)}getObjectAndLayerIdColorArray(e){if(!e.layerUid||!e.graphicUid)return this.colorZero;const i=this._layerUidToPopupEnabled.get(e.layerUid);if(i===void 0)return Ce.getLogger(this).warn("popupEnabled is undefined for layerUid "+e.layerUid),this.colorZero;if(i===!1)return this.colorZero;let r=this._uidToRenderColor.get(e.layerUid);r||(r=new Map,this._uidToRenderColor.set(e.layerUid,r));let n=r.get(e.graphicUid);if(!n){for(;!n;){const o=Math.floor(16777214*Math.random())+1;this._colorToUID.has(o)||(n=o)}if(n>16777215)throw new Error("Object ID Overflow");r.set(e.graphicUid,n),this._colorToUID.set(n,e)}const s=new ArrayBuffer(4);return new DataView(s).setUint32(0,n,!1),new Pc(s)}getColorToObjectAndLayerIdMapping(){const e=new Map;for(const[i,r]of this._colorToUID.entries()){const n=this._layerUidToGraphicsUidToObjectId.get(r.layerUid);let s=null;n?(s=n.get(r.graphicUid),s||Ce.getLogger(this).warn("getColorMapping: no entry found for graphicsId "+r.graphicUid)):Ce.getLogger(this).warn("getColorMapping: no entry found for layerUid "+r.layerUid);const o=this._layerUidToId.get(r.layerUid);o||Ce.getLogger(this).warn("no layerId found for uid "+r.layerUid),s&&o&&e.set(i,s.attributeNodeId?{type:"object-and-layer-and-i3s-id",oid:s.objectId,lid:o,attrId:s.attributeNodeId,attrIdx:s.attributeIndex,subLayerId:s.subLayerId}:{type:"object-and-layer-id",oid:s.objectId,lid:o})}return e}};var c9;(function(t){t[t.FrontToBack=0]="FrontToBack",t[t.BackToFront=1]="BackToFront"})(c9||(c9={}));let Fb=class{constructor(e,i,r=c9.FrontToBack){this._rctx=e,this._techniqueRepository=i,this._sorting=r,this._draws=new Pi({initialSize:32,allocator:n=>n||{material:null,geometry:null,geometryRanges:null,bindDrawParams:null,depthSquaredHint:0,indexType:0}}),this._previouslyBoundDraw=new Map}submitDraw(e,i,r,n){const s=this._draws.pushNew();s.geometry=i,s.geometryRanges=r,s.material=e,s.depthSquaredHint=n,s.indexType=(i.indexed?i.vao.indexBuffer.indexType:null)??0}prepare(e,i){return this._draws.map(r=>r.material.prepareTechnique(this._techniqueRepository,e,i,r.geometry.parameters))}dispatch(e,i,r){const n=this._rctx;this._previouslyBoundDraw.clear();let s=null;const o=this._draws.length;for(let a=0;a{const n=e*(i.depthSquaredHint-r.depthSquaredHint);return n!==0?n:i.geometry.vao.byteSize-r.geometry.vao.byteSize})}get count(){return this._draws.length}};const Ok=new Map;Ok.set(Yt.UNSIGNED_BYTE,1),Ok.set(Yt.UNSIGNED_SHORT,2),Ok.set(Yt.UNSIGNED_INT,4);let ure=class extends F1t{constructor(){super({}),this._passes=null,this.produces=new Map([[ke.OPAQUE_MATERIAL,e=>this._produces(e)],[ke.TRANSPARENT_MATERIAL,e=>!!(this._passes&&this._passes.materialTransparent.count>0)&&this._produces(e)],[ke.INTEGRATED_MESH,e=>this._produces(e)]]),this._materialPassParameters=new bSt,this._shadowPassParameters=new wSt,this._highlightPassParameters=new xSt,this._systems=new Set}initializeRenderContext(e){this._context=e;const i=e.renderContext.rctx,r=e.techniqueRepository;this._passes={materialOpaque:new Fb(i,r),materialTransparent:new Fb(i,r,c9.BackToFront),materialIntegratedMesh:new Fb(i,r),shadowMap:new Fb(i,r),highlight:new Fb(i,r),highlightIntegratedMesh:new Fb(i,r),highlightShadowMap:new Fb(i,r),defaultShadowMap:new Fb(i,r)}}get rctx(){return this._context.renderContext.rctx}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear()}register(e){this._systems.add(e)}_produces(e){return this._systems.size!==0&&this._passes!==null&&(e===ue.Highlight?this._passes.highlight.count>0||this._passes.highlightIntegratedMesh.count>0:e!==ue.ShadowHighlight||this._passes.highlight.count>0)}prepareRender(e){if(this._systems.size!==0&&this._passes!==null){for(const i of Object.values(this._passes))i.prepareSubmit();this._systems.forEach(i=>i.submit(this._passes,e.bindParameters));for(const i of Object.values(this._passes))i.finishSubmit();this._context.techniqueRepository.frameUpdate()}}prepareTechniques(e){if(this._systems.size===0)return null;const i=e.output===ue.Shadow||e.output===ue.ShadowHighlight||e.output===ue.ShadowExcludeHighlight?this._shadowPassParameters:e.output===ue.Highlight?this._highlightPassParameters:this._materialPassParameters,r=e.bindParameters;return this._updateParameters(r.camera,i,r.slot===ke.TRANSPARENT_MATERIAL),this._materialPassParameters.output=e.output,this._invoke(e,(n,s)=>n.prepare(s,e.bindParameters))}renderNode(e,i){this._invoke(e,(r,n)=>r.dispatch(n,e.bindParameters,i))}_invoke(e,i){if(this._passes===null)return null;switch(e.bindParameters.slot){case ke.OPAQUE_MATERIAL:switch(e.output){case ue.Color:case ue.Depth:case ue.Normal:case ue.ObjectAndLayerIdColor:return i(this._passes.materialOpaque,this._materialPassParameters);case ue.Highlight:return i(this._passes.highlight,this._highlightPassParameters);case ue.Shadow:return i(this._passes.shadowMap,this._shadowPassParameters);case ue.ShadowHighlight:return i(this._passes.highlightShadowMap,this._shadowPassParameters);case ue.ShadowExcludeHighlight:return i(this._passes.defaultShadowMap,this._shadowPassParameters)}break;case ke.TRANSPARENT_MATERIAL:switch(e.output){case ue.Color:case ue.Alpha:case ue.Depth:case ue.Normal:case ue.ObjectAndLayerIdColor:return i(this._passes.materialTransparent,this._materialPassParameters)}break;case ke.INTEGRATED_MESH:switch(e.output){case ue.Color:case ue.Depth:case ue.Normal:case ue.ObjectAndLayerIdColor:return i(this._passes.materialIntegratedMesh,this._materialPassParameters);case ue.Highlight:return i(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}}return null}notifyDirty(){this._context.requestRender()}queryDepthRange(e){const i=new Zce;return this._systems.forEach(r=>HP(i,r.queryShadowCasterDepthRange(e))),i}_updateParameters(e,i,r){const n=e.viewInverseTransposeMatrix;Ie(qY,n[3],n[7],n[11]),WY.set(qY),Ne(i.transformWorldFromViewTH,WY.high),Ne(i.transformWorldFromViewTL,WY.low),Ne(i.slicePlaneLocalOrigin,qY),Kf(i.transformViewFromCameraRelativeRS,e.viewMatrix),Mo(i.transformProjFromView,e.projectionMatrix),i.identifier===Yh.Material&&(this._materialPassParameters.transparent=r,Qf(mwe,i.transformViewFromCameraRelativeRS),EE(i.transformNormalViewFromGlobal,mwe))}};ure=y([Z("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],ure);const qY=W(),mwe=as(),WY=new UG;let W9t=class{constructor(e=null,i=null,r=null){this.composite=e,this.normal=i,this.highlight=r}},Pk=class extends ze{constructor(e){super({}),this._context=e,this._renderPlugins=new Pi,this._slots=new Array;for(let i=0;i{if(i!=null&&i.aborted)throw e.uninitializeRenderContext(),ur();this._renderPlugins.push(e),e.produces.forEach((s,o)=>{this._slots[o].push(e)}),this._context.requestRender(),this.notifyChange("updating")},n=e.initializeRenderContext(this._context,i);if(yd(n))return n.then(r);r()}remove(e){if(this._renderPlugins.removeUnordered(e)!=null){for(let i=0;ir!==e);e.uninitializeRenderContext(),this._context.requestRender(),this.notifyChange("updating")}}prepareRender(){this._renderPlugins.forAll(e=>{e.prepareRender&&e.prepareRender(this._context.renderContext)})}updateAnimation(e){let i=!1;return this._renderPlugins.forAll(r=>{r.updateAnimation&&(i=r.updateAnimation(e)||i)}),i}renderFeatureChanged(){this._renderPlugins.forAll(e=>{e.renderFeatureChanged&&e.renderFeatureChanged()})}prepare(e){this._context.renderContext.bindParameters.slot=e,this._slots[e].forEach(i=>{const r=i.produces.get(e);r&&r(ue.Color)&&(gwe(i)&&i.prepareTechnique(this._context.renderContext),ywe(i)&&i.prepareTechniques(this._context.renderContext))})}_getRenderables(e){this._context.renderContext.bindParameters.slot=e;const i=new Map;return this._slots[e].forEach(r=>{const n=r.produces.get(e);if(n&&n(ue.Color)&&(!r.isDecoration||this._context.renderContext.bindParameters.decorations!==Kh.OFF))if(gwe(r)){const s=r.prepareTechnique(this._context.renderContext);s!=null&&i.set(r,s)}else if(ywe(r)){const s=r.prepareTechniques(this._context.renderContext);s!=null&&i.set(r,s)}else i.set(r,null)}),i}render(e,i=null,r=null){return this._getRenderables(e).forEach((n,s)=>r=s.renderNode(this._context.renderContext,n,i,r)),r}renderComposition(e,i){const r=this._getRenderables(e);let n=null;return r.forEach((s,o)=>{const a=o.renderNode(this._context.renderContext,s,i,null);n==null||n.release(),n=a,i.composite=n}),n}queryDepthRange(e){const i=new Zce;return this._renderPlugins.forAll(r=>{var s;const n=(s=r.queryDepthRange)==null?void 0:s.call(r,e);HP(i,n)}),i}get updating(){return this._renderPlugins.some(e=>e.running)}produces(e,i=ue.Color){return this._slots[e].some(r=>{const n=r.produces.get(e);return!!n&&n(i)})}consumes(e){return this._renderPlugins.some(i=>i.consumes().required.includes(e))}get hasDecorations(){return this._renderPlugins.some(e=>e.isDecoration)}get renderOccludedFlags(){return this._renderPlugins.reduce((e,i)=>e|i.renderOccludedFlags,Yn.None)}get usedMemory(){return this._renderPlugins.reduce((e,i)=>e+(i.usedMemory??0),0)}};function gwe(t){return"prepareTechnique"in t}function ywe(t){return"prepareTechniques"in t}y([w({readOnly:!0})],Pk.prototype,"updating",null),Pk=y([Z("esri.views.3d.webgl-engine.lib.RenderPluginManager")],Pk);let iM=class extends gx{constructor(e){super(e),this._context=null,this.opacity=1,this.alphaMode=bc.None,this._blitConfiguration=new bV,this._blitParameters=new VG,this.produces=new Map([[ke.BLIT,()=>this._context!=null]])}consumes(){return ALe}initializeRenderContext(e){this._context=e}uninitializeRenderContext(){this._context=null}destroy(){}renderNode(e,i,r,n){var a;const s=(a=r==null?void 0:r.composite)==null?void 0:a.colorTexture;if(!this._context||!s)return n;const o=this._context.techniqueRepository.acquire(eue,this._blitConfiguration);return o!=null&&o.compiled?(e.rctx.bindFramebuffer(n==null?void 0:n.fbo),this._blitParameters.texture=s,this._blitParameters.opacity=this.opacity,e.rctx.bindTechnique(o,this._blitParameters,e.bindParameters),e.rctx.screen.draw(),o.release(),n):(this._context.requestRender(),n)}};y([w()],iM.prototype,"_context",void 0),y([w()],iM.prototype,"opacity",void 0),y([w()],iM.prototype,"alphaMode",void 0),iM=y([Z("esri.views.3d.webgl-engine.effects.blit.Blit")],iM);let rue=class extends bn{};function Cke(){const t=new Ar,{outputs:e,fragment:i}=t;return t.include($c),i.uniforms.add(new kf("textureInput",r=>r.input)),i.constants.add("outlineSize","int",Math.ceil(BG/2)),e.add("fragGrid","vec2"),i.code.add(V` void main() { float red = 0.0; float green = 1.0; - int cellSize = ${V.int(tm)}; + int cellSize = ${V.int(nm)}; vec2 texelSize = 1.0 / vec2(textureSize(textureInput, 0)); vec2 offset = floor(gl_FragCoord.xy) * vec2(float(cellSize)); @@ -4645,7 +4634,7 @@ fragColor = overlayColor + (1.0 - overlayColor.a) * inputColor; } } fragGrid = vec2(red, green); - }`),t}const tm=32,IG=9,Hce=.4,Z6t=Object.freeze(Object.defineProperty({__proto__:null,HighlightDownsampleDrawParameters:Gce,blurSize:Hce,build:Mke,gridCellPixelSize:tm,outlineSize:IG},Symbol.toStringTag,{value:"Module"}));function Oke(){const t=new Cr,{vertex:e,fragment:i}=t,r=e.code,n=i.code;return t.attributes.add(J.POSITION,"vec2"),t.varyings.add("uv","vec2"),t.attributes.add(J.UV0,"vec2"),e.uniforms.add(new Zt("coverageTex",s=>s.coverageTexture),new ln("coverageRounding",s=>s.coverageRounding)),r.add(V`void main() { + }`),t}const nm=32,BG=9,nue=.4,Y9t=Object.freeze(Object.defineProperty({__proto__:null,HighlightDownsampleDrawParameters:rue,blurSize:nue,build:Cke,gridCellPixelSize:nm,outlineSize:BG},Symbol.toStringTag,{value:"Module"}));function Ake(){const t=new Ar,{vertex:e,fragment:i}=t,r=e.code,n=i.code;return t.attributes.add(J.POSITION,"vec2"),t.varyings.add("uv","vec2"),t.attributes.add(J.UV0,"vec2"),e.uniforms.add(new Zt("coverageTex",s=>s.coverageTexture),new cn("coverageRounding",s=>s.coverageRounding)),r.add(V`void main() { vec4 cov = texture(coverageTex, uv0 * coverageRounding); if (cov.r == 0.0) { gl_Position = vec4(0.0); @@ -4653,7 +4642,7 @@ return; } gl_Position = vec4(position, 0.0, 1.0); uv = position.xy * 0.5 + vec2(0.5); -}`),i.uniforms.add(new Zt("tex",s=>s.blurTexture),new Zt("highlightTexture",s=>s.highlightTexture),new gr("uColor",s=>s.color),new gr("haloColor",s=>s.haloColor),new gr("opacities",s=>rs(J6t,s.haloOpacity,s.haloOpacityOccluded,s.fillOpacity,s.fillOpacityOccluded))),i.constants.add("outlineSize","float",IG),i.constants.add("blurSize","float",Hce),n.add(V`void main() { +}`),i.uniforms.add(new Zt("tex",s=>s.blurTexture),new Zt("highlightTexture",s=>s.highlightTexture),new gr("uColor",s=>s.color),new gr("haloColor",s=>s.haloColor),new gr("opacities",s=>rs(X9t,s.haloOpacity,s.haloOpacityOccluded,s.fillOpacity,s.fillOpacityOccluded))),i.constants.add("outlineSize","float",BG),i.constants.add("blurSize","float",nue),n.add(V`void main() { vec4 blurredHighlightValue = texture(tex, uv); float highlightIntensity = blurredHighlightValue.a; if (highlightIntensity == 0.0) { @@ -4675,14 +4664,14 @@ float outlineFactor = smoothstep(0.0, inner, highlightIntensity); float fillFactor = any(notEqual(origin_color, vec4(0.0, 0.0, 0.0, 0.0))) ? 1.0 : 0.0; float intensity = outlineIntensity * outlineFactor * (1.0 - fillFactor) + fillIntensity * fillFactor; fragColor = vec4(mix(haloColor.rgb, uColor.rgb, fillFactor), intensity); -}`),t}const J6t=Xi(),K6t=Object.freeze(Object.defineProperty({__proto__:null,build:Oke},Symbol.toStringTag,{value:"Module"}));let Pke=class Rke extends Hr{initializeProgram(e){return new Ir(e.rctx,Rke.shader.get().build(),Er)}initializePipeline(){return Ti({blending:Ol(st.SRC_ALPHA,st.ONE,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}};Pke.shader=new Rr(K6t,()=>we(()=>Promise.resolve().then(()=>jWt),void 0));let qce=class extends _n{constructor(){super(...arguments),this.blurSize=yt()}};function Ike(){const t=new Cr,{attributes:e,varyings:i,vertex:r,fragment:n}=t;return e.add(J.POSITION,"vec2"),e.add(J.UV0,"vec2"),i.add("blurCoordinate","vec3"),r.uniforms.add(new Zt("coverageTex",s=>s.coverageTexture),new ln("coverageRounding",s=>s.coverageRounding)),r.code.add(V`void main() { +}`),t}const X9t=Xi(),Z9t=Object.freeze(Object.defineProperty({__proto__:null,build:Ake},Symbol.toStringTag,{value:"Module"}));let Mke=class Oke extends Hr{initializeProgram(e){return new $r(e.rctx,Oke.shader.get().build(),Cr)}initializePipeline(){return Ti({blending:Pl(ot.SRC_ALPHA,ot.ONE,ot.ONE_MINUS_SRC_ALPHA,ot.ONE_MINUS_SRC_ALPHA),colorWrite:ji})}};Mke.shader=new Ir(Z9t,()=>we(()=>Promise.resolve().then(()=>EXt),void 0));let sue=class extends bn{constructor(){super(...arguments),this.blurSize=yt()}};function Pke(){const t=new Ar,{attributes:e,varyings:i,vertex:r,fragment:n}=t;return e.add(J.POSITION,"vec2"),e.add(J.UV0,"vec2"),i.add("blurCoordinate","vec3"),r.uniforms.add(new Zt("coverageTex",s=>s.coverageTexture),new cn("coverageRounding",s=>s.coverageRounding)),r.code.add(V`void main() { gl_Position = vec4(position, 0.0, 1.0); vec4 cov = texture(coverageTex, uv0 * coverageRounding); if (cov.r == 0.0) { gl_Position = vec4(0.0); } blurCoordinate = vec3(gl_Position.xy * 0.5 + vec2(0.5), cov.g); -}`),n.uniforms.add(new rDe("blurSize",s=>s.blurSize),new $f("tex",s=>s.blurInputTexture)),n.code.add(V`void main() { +}`),n.uniforms.add(new Q6e("blurSize",s=>s.blurSize),new kf("tex",s=>s.blurInputTexture)),n.code.add(V`void main() { vec2 uv = blurCoordinate.xy; vec4 center = texture(tex, uv); if (blurCoordinate.z == 1.0) { @@ -4695,7 +4684,7 @@ sum += texture(tex, uv + blurSize * 3.294215) * 0.093913; sum += texture(tex, uv - blurSize * 3.294215) * 0.093913; fragColor = sum; } -}`),t}const Q6t=Object.freeze(Object.defineProperty({__proto__:null,HighlightBlurDrawParameters:qce,build:Ike},Symbol.toStringTag,{value:"Module"}));let $ke=class Lke extends Hr{initializeProgram(e){return new Ir(e.rctx,Lke.shader.get().build(),Er)}initializePipeline(){return Ti({colorWrite:ji})}};$ke.shader=new Rr(Q6t,()=>we(()=>Promise.resolve().then(()=>GWt),void 0));let Dke=class Nke extends Hr{initializeProgram(e){return new Ir(e.rctx,Nke.shader.get().build(),Er)}initializePipeline(){return Ti({colorWrite:ji})}};Dke.shader=new Rr(Z6t,()=>we(()=>Promise.resolve().then(()=>HWt),void 0));let eDt=class extends _n{constructor(){super(...arguments),this.color=Mi(1,0,1,1),this.haloColor=Mi(1,0,1,1),this.haloOpacity=1,this.haloOpacityOccluded=.25,this.fillOpacity=.2,this.fillOpacityOccluded=.05,this.coverageRounding=Ji(1,1)}},EI=class extends CE{constructor(e){super(e),this._context=null,this._passParameters=new eDt,this._downsampleDrawParameters=new Gce,this._blurDrawParameters=new qce,this._blurColorFormat=Le("mac")?xr.RGBA:xr.RGBA4,this._grid={coverage:null,vao:null,verticalCellCount:0,horizontalCellCount:0,viewportWidth:0,viewportHeight:0},this.produces=new Map([[ke.HIGHLIGHT,()=>!0]])}consumes(){return ILe}initializeRenderContext(e){this._context=e,this._blurTechnique==null&&(this._blurTechnique=this._context.techniqueRepository.acquire($ke)),this._downsampleTechnique==null&&(this._downsampleTechnique=this._context.techniqueRepository.acquire(Dke)),this._applyTechnique==null&&(this._applyTechnique=this._context.techniqueRepository.acquire(Pke)),this.addHandles([_e(()=>this.view.highlightOptions.color,i=>{this._passParameters.color=AL(i??U7e),this.view.highlightOptions.haloColor||(this._passParameters.haloColor=this._passParameters.color),this._context.requestRender()},kt),_e(()=>this.view.highlightOptions.haloColor,i=>{this._passParameters.haloColor=i!=null?AL(i):this._passParameters.color,this._context.requestRender()},kt),_e(()=>this.view.highlightOptions.haloOpacity,i=>{this._passParameters.haloOpacity=i??V7e,this._passParameters.haloOpacityOccluded=.25*this._passParameters.haloOpacity,this._context.requestRender()},kt),_e(()=>this.view.highlightOptions.fillOpacity,i=>{this._passParameters.fillOpacity=i??B7e,this._passParameters.fillOpacityOccluded=.25*this._passParameters.fillOpacity,this._context.requestRender()},kt)])}uninitializeRenderContext(){this._context=null}dispose(){this._blurTechnique=ir(this._blurTechnique),this._downsampleTechnique=ir(this._downsampleTechnique),this._applyTechnique=ir(this._applyTechnique),this._grid.coverage=ir(this._grid.coverage),this._grid.vao=Kt(this._grid.vao)}renderNode(e,i,r,n){var U,j;const s=(U=r==null?void 0:r.highlight)==null?void 0:U.colorTexture;if(!this._context||!s)return;if(!(this._blurTechnique.compiled&&this._downsampleTechnique.compiled&&this._applyTechnique.compiled))return void this._context.requestRender();const o=e.bindParameters.camera,l=o.fullWidth,c=o.fullHeight,f=o.pixelRatio,_=Math.ceil(l/f),x=Math.ceil(c/f),T=this._context.fbos,A=T.rctx;this._gridUpdateResources(s),this._gridComputeCoverage(s,e.bindParameters),this._passParameters.highlightTexture=s,this._passParameters.coverageTexture=(j=this._grid.coverage)==null?void 0:j.colorTexture;const{width:M,height:I}=s.descriptor;or(this._passParameters.coverageRounding,M/(Math.ceil(M/tm)*tm),I/(Math.ceil(I/tm)*tm));const L=A.bindTechnique(this._blurTechnique,this._passParameters,e.bindParameters),F=this._grid.vao;A.bindVAO(F);const z=T.acquire(this._blurColorFormat,_,x);A.bindFramebuffer(z.fbo),A.setViewport(0,0,_,x),A.clear(In.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=s,or(this._blurDrawParameters.blurSize,1/_,0),L.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),A.drawArrays(this._blurTechnique.primitiveType,0,Kv(F,"geometry"));const k=T.acquire(this._blurColorFormat,_,x);A.bindFramebuffer(k.fbo),A.clear(In.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=z.colorTexture,or(this._blurDrawParameters.blurSize,0,1/x),L.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),A.drawArrays(this._blurTechnique.primitiveType,0,Kv(F,"geometry")),A.bindFramebuffer(n==null?void 0:n.fbo),A.setViewport4fv(o.fullViewport),this._passParameters.blurTexture=k.colorTexture,A.bindTechnique(this._applyTechnique,this._passParameters,e.bindParameters),A.drawArrays(this._applyTechnique.primitiveType,0,Kv(F,"geometry")),k.release(),z.release()}_gridUpdateResources(e){var T;if(!this._context)return;const i=this._context.fbos.rctx,r=this._grid,n=Math.ceil(e.descriptor.height/tm),s=Math.ceil(e.descriptor.width/tm);if(r.vao&&r.verticalCellCount===n&&r.horizontalCellCount===s)return;r.verticalCellCount=n,r.horizontalCellCount=s;const o=n+1,l=s+1,c=1/n,f=1/s,_=new Float32Array(6*4*o*l);let x=0;for(let A=0;An.shadowMap.getSnapshot(I5.Default)),new Zt("highlightDepthTex",(r,n)=>n.shadowMap.getSnapshot(I5.Highlight)),new Zt("depthMap",(r,n)=>{var s;return(s=n.linearDepth)==null?void 0:s.colorTexture}),new Zt("highlightTexture",r=>r.highlight),new gr("uColor",r=>r.shadowColor),new ln("nearFar",(r,n)=>n.camera.nearFar),new ft("opacity",r=>r.shadowOpacity),new ft("occludedOpacity",r=>r.occludedShadowOpacity),new ft("terminationFactor",r=>r.opacityElevation*r.dayNightTerminator),new Oi("lightingMainDirectionView",(r,n)=>Ye(vwe,bt(vwe,n.lighting.mainLight.direction,n.camera.viewInverseTransposeMatrix))),new _s("inverseViewMatrix",(r,n)=>Vo(ywe,Qu(ywe,n.camera.viewMatrix,n.camera.center)))),i.constants.add("unoccludedHighlightFlag","vec4",ble),i.code.add(V` +}`),t}const J9t=Object.freeze(Object.defineProperty({__proto__:null,HighlightBlurDrawParameters:sue,build:Pke},Symbol.toStringTag,{value:"Module"}));let Rke=class Ike extends Hr{initializeProgram(e){return new $r(e.rctx,Ike.shader.get().build(),Cr)}initializePipeline(){return Ti({colorWrite:ji})}};Rke.shader=new Ir(J9t,()=>we(()=>Promise.resolve().then(()=>CXt),void 0));let $ke=class Lke extends Hr{initializeProgram(e){return new $r(e.rctx,Lke.shader.get().build(),Cr)}initializePipeline(){return Ti({colorWrite:ji})}};$ke.shader=new Ir(Y9t,()=>we(()=>Promise.resolve().then(()=>AXt),void 0));let K9t=class extends bn{constructor(){super(...arguments),this.color=Mi(1,0,1,1),this.haloColor=Mi(1,0,1,1),this.haloOpacity=1,this.haloOpacityOccluded=.25,this.fillOpacity=.2,this.fillOpacityOccluded=.05,this.coverageRounding=Ji(1,1)}},N4=class extends gx{constructor(e){super(e),this._context=null,this._passParameters=new K9t,this._downsampleDrawParameters=new rue,this._blurDrawParameters=new sue,this._blurColorFormat=$e("mac")?Sr.RGBA:Sr.RGBA4,this._grid={coverage:null,vao:null,verticalCellCount:0,horizontalCellCount:0,viewportWidth:0,viewportHeight:0},this.produces=new Map([[ke.HIGHLIGHT,()=>!0]])}consumes(){return MLe}initializeRenderContext(e){this._context=e,this._blurTechnique==null&&(this._blurTechnique=this._context.techniqueRepository.acquire(Rke)),this._downsampleTechnique==null&&(this._downsampleTechnique=this._context.techniqueRepository.acquire($ke)),this._applyTechnique==null&&(this._applyTechnique=this._context.techniqueRepository.acquire(Mke)),this.addHandles([_e(()=>this.view.highlightOptions.color,i=>{this._passParameters.color=NL(i??F7e),this.view.highlightOptions.haloColor||(this._passParameters.haloColor=this._passParameters.color),this._context.requestRender()},kt),_e(()=>this.view.highlightOptions.haloColor,i=>{this._passParameters.haloColor=i!=null?NL(i):this._passParameters.color,this._context.requestRender()},kt),_e(()=>this.view.highlightOptions.haloOpacity,i=>{this._passParameters.haloOpacity=i??k7e,this._passParameters.haloOpacityOccluded=.25*this._passParameters.haloOpacity,this._context.requestRender()},kt),_e(()=>this.view.highlightOptions.fillOpacity,i=>{this._passParameters.fillOpacity=i??z7e,this._passParameters.fillOpacityOccluded=.25*this._passParameters.fillOpacity,this._context.requestRender()},kt)])}uninitializeRenderContext(){this._context=null}dispose(){this._blurTechnique=ir(this._blurTechnique),this._downsampleTechnique=ir(this._downsampleTechnique),this._applyTechnique=ir(this._applyTechnique),this._grid.coverage=ir(this._grid.coverage),this._grid.vao=Kt(this._grid.vao)}renderNode(e,i,r,n){var U,j;const s=(U=r==null?void 0:r.highlight)==null?void 0:U.colorTexture;if(!this._context||!s)return;if(!(this._blurTechnique.compiled&&this._downsampleTechnique.compiled&&this._applyTechnique.compiled))return void this._context.requestRender();const o=e.bindParameters.camera,a=o.fullWidth,c=o.fullHeight,p=o.pixelRatio,_=Math.ceil(a/p),x=Math.ceil(c/p),S=this._context.fbos,C=S.rctx;this._gridUpdateResources(s),this._gridComputeCoverage(s,e.bindParameters),this._passParameters.highlightTexture=s,this._passParameters.coverageTexture=(j=this._grid.coverage)==null?void 0:j.colorTexture;const{width:M,height:P}=s.descriptor;or(this._passParameters.coverageRounding,M/(Math.ceil(M/nm)*nm),P/(Math.ceil(P/nm)*nm));const $=C.bindTechnique(this._blurTechnique,this._passParameters,e.bindParameters),F=this._grid.vao;C.bindVAO(F);const z=S.acquire(this._blurColorFormat,_,x);C.bindFramebuffer(z.fbo),C.setViewport(0,0,_,x),C.clear($n.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=s,or(this._blurDrawParameters.blurSize,1/_,0),$.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),C.drawArrays(this._blurTechnique.primitiveType,0,s_(F,"geometry"));const k=S.acquire(this._blurColorFormat,_,x);C.bindFramebuffer(k.fbo),C.clear($n.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=z.colorTexture,or(this._blurDrawParameters.blurSize,0,1/x),$.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),C.drawArrays(this._blurTechnique.primitiveType,0,s_(F,"geometry")),C.bindFramebuffer(n==null?void 0:n.fbo),C.setViewport4fv(o.fullViewport),this._passParameters.blurTexture=k.colorTexture,C.bindTechnique(this._applyTechnique,this._passParameters,e.bindParameters),C.drawArrays(this._applyTechnique.primitiveType,0,s_(F,"geometry")),k.release(),z.release()}_gridUpdateResources(e){var S;if(!this._context)return;const i=this._context.fbos.rctx,r=this._grid,n=Math.ceil(e.descriptor.height/nm),s=Math.ceil(e.descriptor.width/nm);if(r.vao&&r.verticalCellCount===n&&r.horizontalCellCount===s)return;r.verticalCellCount=n,r.horizontalCellCount=s;const o=n+1,a=s+1,c=1/n,p=1/s,_=new Float32Array(6*4*o*a);let x=0;for(let C=0;Cn.shadowMap.getSnapshot(VP.Default)),new Zt("highlightDepthTex",(r,n)=>n.shadowMap.getSnapshot(VP.Highlight)),new Zt("depthMap",(r,n)=>{var s;return(s=n.linearDepth)==null?void 0:s.colorTexture}),new Zt("highlightTexture",r=>r.highlight),new gr("uColor",r=>r.shadowColor),new cn("nearFar",(r,n)=>n.camera.nearFar),new ft("opacity",r=>r.shadowOpacity),new ft("occludedOpacity",r=>r.occludedShadowOpacity),new ft("terminationFactor",r=>r.opacityElevation*r.dayNightTerminator),new Oi("lightingMainDirectionView",(r,n)=>Ye(_we,bt(_we,n.lighting.mainLight.direction,n.camera.viewInverseTransposeMatrix))),new bs("inverseViewMatrix",(r,n)=>Bo(vwe,eh(vwe,n.camera.viewMatrix,n.camera.center)))),i.constants.add("unoccludedHighlightFlag","vec4",$le),i.code.add(V` vec3 normalFromDepth(vec3 pixelPos, vec2 fragCoord, ivec2 iuv) { float leftPixelDepth = linearDepthFromRGBA(texelFetch(depthMap, iuv + ivec2(-1, 0), 0), nearFar); float rightPixelDepth = linearDepthFromRGBA(texelFetch(depthMap, iuv + ivec2(1, 0), 0), nearFar); @@ -4723,7 +4712,7 @@ fragColor = sum; void main(void) { vec4 highlightInfo = texture(highlightTexture, uv); float visiblyHighlighted = (1.0 - clamp(distance(unoccludedHighlightFlag, highlightInfo), 0.0, 1.0)) * highlightInfo.a; - if (visiblyHighlighted > ${V.float(tDt)}) { + if (visiblyHighlighted > ${V.float(Q9t)}) { discard; } @@ -4772,12 +4761,12 @@ fragColor = sum; bool shadowDefault = depthDefault < lvpos.z; vec3 normal = normalFromDepth(currentPixelPos.xyz, gl_FragCoord.xy, iuv); - bool shaded = dot(normal, lightingMainDirectionView) < ${V.float(iDt)}; + bool shaded = dot(normal, lightingMainDirectionView) < ${V.float(e6t)}; float fragOpacity = (shadowDefault || shaded) ? occludedOpacity : opacity; fragColor = vec4(uColor.rgb, uColor.a * fragOpacity * terminationFactor); } - `),e}const ywe=Qe(),vwe=W(),rDt=Object.freeze(Object.defineProperty({__proto__:null,build:Fke},Symbol.toStringTag,{value:"Module"}));let nDt=class extends Ole{constructor(){super(...arguments),this.shadowColor=Mi(1,0,1,1),this.shadowOpacity=.2,this.occludedShadowOpacity=.1,this.opacityElevation=1,this.dayNightTerminator=1}},kke=class zke extends Hr{constructor(e){super(e,new Wce,()=>this.destroy())}initializeProgram(e){return new Ir(e.rctx,zke.shader.get().build(this.configuration),Er)}initializePipeline(){return Ti({blending:Ol(st.SRC_ALPHA,st.ONE,st.ONE_MINUS_SRC_ALPHA,st.ONE_MINUS_SRC_ALPHA),colorWrite:ji,depthTest:null,depthWrite:null})}get primitiveType(){return sr.TRIANGLE_STRIP}};kke.shader=new Rr(rDt,()=>we(()=>Promise.resolve().then(()=>qWt),void 0));const sDt=.001953125,oDt=4e4,aDt=5e4;let QA=class extends CE{constructor(e){super(e),this._maxOpacity=1,this._passParameters=new nDt,this._drawParameters=new D3t,this._shadowDifference=.2,this._context=null,this.produces=new Map([[ke.SHADOW_HIGHLIGHT,()=>this._isVisible]])}consumes(){return ILe}initializeRenderContext(e){this._context=e,this.addHandles([_e(()=>this.view.highlightOptions.shadowOpacity,i=>{this._passParameters.shadowOpacity=i??G7e,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()},kt),_e(()=>this.view.highlightOptions.shadowDifference,i=>{this._shadowDifference=i??H7e,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()},kt),_e(()=>this.view.highlightOptions.shadowColor,i=>{this._passParameters.shadowColor=AL(i??j7e),this._updateMaxOpacity()},kt)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_updateMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3]}uninitializeRenderContext(){this._context=null}enable(){this._context&&this._technique==null&&(this._technique=this._context.techniqueRepository.acquire(kke))}renderNode(e,i,r,n){var f,_;const s=(f=r==null?void 0:r.highlight)==null?void 0:f.colorTexture;if(!(this._context&&r&&s&&this._isVisible))return;if(!((_=this._technique)!=null&&_.compiled))return void this._context.requestRender();const o=e.bindParameters;if(!o.shadowMap.enabled||!o.linearDepth)return;const l=e.rctx,c=this._technique;this._passParameters.highlight=s,this._drawParameters.origin=o.camera.center,l.bindFramebuffer(n==null?void 0:n.fbo),l.bindTechnique(c,this._passParameters,o).bindDraw(this._drawParameters,o,this._passParameters),l.screen.draw()}updateParameters(e,i){this._passParameters.opacityElevation=1-pL(oDt,aDt,e.relativeElevation);const r=this.viewingMode===_t.Global?Ye(_we,e.center):Ie(_we,0,0,1),n=Ve(r,i);this._passParameters.dayNightTerminator=pL(0,1,Je(30*n,0,1)),this._isVisible&&this.enable()}get _isVisible(){const{opacityElevation:e,dayNightTerminator:i}=this._passParameters;return this._maxOpacity*e*i>=sDt}};y([w()],QA.prototype,"_context",void 0),y([w()],QA.prototype,"view",void 0),y([w()],QA.prototype,"viewingMode",void 0),QA=y([Z("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],QA);const _we=W(),BC={maxSearchSteps:8,maxDistanceAreaTex:16};function Uke(){const t=new Cr;return t.include(Pc),t.fragment.uniforms.add(new Zt("edgesTexture",e=>e.inputTexture)),t.fragment.uniforms.add(new Zt("areaTexture",e=>e.areaTexture)),t.fragment.uniforms.add(new Zt("searchTexture",e=>e.searchTexture)),t.fragment.code.add(V` + `),e}const vwe=Qe(),_we=W(),t6t=Object.freeze(Object.defineProperty({__proto__:null,build:Dke},Symbol.toStringTag,{value:"Module"}));let i6t=class extends Ble{constructor(){super(...arguments),this.shadowColor=Mi(1,0,1,1),this.shadowOpacity=.2,this.occludedShadowOpacity=.1,this.opacityElevation=1,this.dayNightTerminator=1}},Nke=class Fke extends Hr{constructor(e){super(e,new oue,()=>this.destroy())}initializeProgram(e){return new $r(e.rctx,Fke.shader.get().build(this.configuration),Cr)}initializePipeline(){return Ti({blending:Pl(ot.SRC_ALPHA,ot.ONE,ot.ONE_MINUS_SRC_ALPHA,ot.ONE_MINUS_SRC_ALPHA),colorWrite:ji,depthTest:null,depthWrite:null})}get primitiveType(){return sr.TRIANGLE_STRIP}};Nke.shader=new Ir(t6t,()=>we(()=>Promise.resolve().then(()=>MXt),void 0));const r6t=.001953125,n6t=4e4,s6t=5e4;let rM=class extends gx{constructor(e){super(e),this._maxOpacity=1,this._passParameters=new i6t,this._drawParameters=new Lxt,this._shadowDifference=.2,this._context=null,this.produces=new Map([[ke.SHADOW_HIGHLIGHT,()=>this._isVisible]])}consumes(){return MLe}initializeRenderContext(e){this._context=e,this.addHandles([_e(()=>this.view.highlightOptions.shadowOpacity,i=>{this._passParameters.shadowOpacity=i??V7e,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()},kt),_e(()=>this.view.highlightOptions.shadowDifference,i=>{this._shadowDifference=i??B7e,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()},kt),_e(()=>this.view.highlightOptions.shadowColor,i=>{this._passParameters.shadowColor=NL(i??U7e),this._updateMaxOpacity()},kt)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_updateMaxOpacity(){const e=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=e*this._passParameters.shadowColor[3]}uninitializeRenderContext(){this._context=null}enable(){this._context&&this._technique==null&&(this._technique=this._context.techniqueRepository.acquire(Nke))}renderNode(e,i,r,n){var p,_;const s=(p=r==null?void 0:r.highlight)==null?void 0:p.colorTexture;if(!(this._context&&r&&s&&this._isVisible))return;if(!((_=this._technique)!=null&&_.compiled))return void this._context.requestRender();const o=e.bindParameters;if(!o.shadowMap.enabled||!o.linearDepth)return;const a=e.rctx,c=this._technique;this._passParameters.highlight=s,this._drawParameters.origin=o.camera.center,a.bindFramebuffer(n==null?void 0:n.fbo),a.bindTechnique(c,this._passParameters,o).bindDraw(this._drawParameters,o,this._passParameters),a.screen.draw()}updateParameters(e,i){this._passParameters.opacityElevation=1-bL(n6t,s6t,e.relativeElevation);const r=this.viewingMode===_t.Global?Ye(bwe,e.center):Ie(bwe,0,0,1),n=Ve(r,i);this._passParameters.dayNightTerminator=bL(0,1,Je(30*n,0,1)),this._isVisible&&this.enable()}get _isVisible(){const{opacityElevation:e,dayNightTerminator:i}=this._passParameters;return this._maxOpacity*e*i>=r6t}};y([w()],rM.prototype,"_context",void 0),y([w()],rM.prototype,"view",void 0),y([w()],rM.prototype,"viewingMode",void 0),rM=y([Z("esri.views.3d.webgl-engine.effects.highlight.ShadowHighlight")],rM);const bwe=W(),YC={maxSearchSteps:8,maxDistanceAreaTex:16};function kke(){const t=new Ar;return t.include($c),t.fragment.uniforms.add(new Zt("edgesTexture",e=>e.inputTexture)),t.fragment.uniforms.add(new Zt("areaTexture",e=>e.areaTexture)),t.fragment.uniforms.add(new Zt("searchTexture",e=>e.searchTexture)),t.fragment.code.add(V` #define SMAA_AREATEX_PIXEL_SIZE ( 1.0 / vec2( 160.0, 560.0 ) ) #define SMAA_AREATEX_SUBTEX_SIZE ( 1.0 / 7.0 ) @@ -4792,7 +4781,7 @@ fragColor = sum; float searchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end, vec2 resolution ) { vec2 e = vec2( 0.0, 1.0 ); - for ( int i = 0; i < ${V.int(BC.maxSearchSteps)}; i ++ ) { + for ( int i = 0; i < ${V.int(YC.maxSearchSteps)}; i ++ ) { e = texture( edgesTex, texcoord, 0.0 ).rg; texcoord -= vec2( 2.0, 0.0 ) * resolution; if ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break; @@ -4806,7 +4795,7 @@ fragColor = sum; float searchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end, vec2 resolution ) { vec2 e = vec2( 0.0, 1.0 ); - for ( int i = 0; i < ${V.int(BC.maxSearchSteps)}; i ++ ) { + for ( int i = 0; i < ${V.int(YC.maxSearchSteps)}; i ++ ) { e = texture( edgesTex, texcoord, 0.0 ).rg; texcoord += vec2( 2.0, 0.0 ) * resolution; if ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break; @@ -4820,7 +4809,7 @@ fragColor = sum; float searchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end, vec2 resolution ) { vec2 e = vec2( 1.0, 0.0 ); - for ( int i = 0; i < ${V.int(BC.maxSearchSteps)}; i ++ ) { + for ( int i = 0; i < ${V.int(YC.maxSearchSteps)}; i ++ ) { e = texture( edgesTex, texcoord, 0.0 ).rg; texcoord += vec2( 0.0, 2.0 ) * resolution; if ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break; @@ -4834,7 +4823,7 @@ fragColor = sum; float searchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end, vec2 resolution ) { vec2 e = vec2( 1.0, 0.0 ); - for ( int i = 0; i < ${V.int(BC.maxSearchSteps)}; i ++ ) { + for ( int i = 0; i < ${V.int(YC.maxSearchSteps)}; i ++ ) { e = texture( edgesTex, texcoord, 0.0 ).rg; texcoord -= vec2( 0.0, 2.0 ) * resolution; if ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break; @@ -4847,7 +4836,7 @@ fragColor = sum; } vec2 getArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) { - vec2 texcoord = float( ${V.int(BC.maxDistanceAreaTex)} ) * round( 4.0 * vec2( e1, e2 ) ) + dist; + vec2 texcoord = float( ${V.int(YC.maxDistanceAreaTex)} ) * round( 4.0 * vec2( e1, e2 ) ) + dist; texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE ); texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset; return texture( areaTex, texcoord, 0.0 ).rg; @@ -4860,7 +4849,7 @@ fragColor = sum; vec4 offsets[2]; offsets[0] = uv.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 ); offsets[1] = uv.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 ); - vec4 maxOffset = vec4( offsets[0].xz, offsets[1].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( ${V.int(BC.maxSearchSteps)} ); + vec4 maxOffset = vec4( offsets[0].xz, offsets[1].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( ${V.int(YC.maxSearchSteps)} ); ivec4 subsampleIndices = ivec4(0.0); vec4 weights = vec4(0.0); @@ -4903,7 +4892,7 @@ fragColor = sum; } fragColor = weights; } - `),t}const lDt=Object.freeze(Object.defineProperty({__proto__:null,build:Uke},Symbol.toStringTag,{value:"Module"}));let Vke=class Bke extends Hr{initializeProgram(e){return new Ir(e.rctx,Bke.shader.get().build(),Er)}initializePipeline(){return Ti({colorWrite:ji})}};Vke.shader=new Rr(lDt,()=>we(()=>Promise.resolve().then(()=>WWt),void 0));function jke(){const t=new Cr;return t.include(Pc),t.fragment.uniforms.add(new Zt("blendWeightsTexture",e=>e.inputTexture),new Zt("colorTexture",e=>e.color)),t.fragment.code.add(V`void main() { + `),t}const o6t=Object.freeze(Object.defineProperty({__proto__:null,build:kke},Symbol.toStringTag,{value:"Module"}));let zke=class Uke extends Hr{initializeProgram(e){return new $r(e.rctx,Uke.shader.get().build(),Cr)}initializePipeline(){return Ti({colorWrite:ji})}};zke.shader=new Ir(o6t,()=>we(()=>Promise.resolve().then(()=>OXt),void 0));function Vke(){const t=new Ar;return t.include($c),t.fragment.uniforms.add(new Zt("blendWeightsTexture",e=>e.inputTexture),new Zt("colorTexture",e=>e.color)),t.fragment.code.add(V`void main() { vec2 resolution = 1.0 / vec2(textureSize(colorTexture, 0)); vec4 offsets = vec4(uv.x + resolution.x, uv.y, uv.x, uv.y - resolution.y); vec4 a; @@ -4926,7 +4915,7 @@ vec4 Cop = texture( colorTexture, uv + sign( offset ) * resolution.xy, 0.0 ); float s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y ); fragColor = mix(C, Cop, s); } -}`),t}const cDt=Object.freeze(Object.defineProperty({__proto__:null,build:jke},Symbol.toStringTag,{value:"Module"}));let Gke=class Hke extends Hr{initializeProgram(e){return new Ir(e.rctx,Hke.shader.get().build(),Er)}initializePipeline(){return Ti({colorWrite:ji})}};Gke.shader=new Rr(cDt,()=>we(()=>Promise.resolve().then(()=>YWt),void 0));const bwe={threshold:.05,localConstrastAdaption:2};function qke(){const t=new Cr;return t.include(Pc),t.fragment.uniforms.add(new Zt("colorTexture",e=>e.color)),t.outputs.add("fragEdges","vec2"),t.fragment.code.add(V` +}`),t}const a6t=Object.freeze(Object.defineProperty({__proto__:null,build:Vke},Symbol.toStringTag,{value:"Module"}));let Bke=class jke extends Hr{initializeProgram(e){return new $r(e.rctx,jke.shader.get().build(),Cr)}initializePipeline(){return Ti({colorWrite:ji})}};Bke.shader=new Ir(a6t,()=>we(()=>Promise.resolve().then(()=>PXt),void 0));const wwe={threshold:.05,localConstrastAdaption:2};function Gke(){const t=new Ar;return t.include($c),t.fragment.uniforms.add(new Zt("colorTexture",e=>e.color)),t.outputs.add("fragEdges","vec2"),t.fragment.code.add(V` float absMax3(vec3 v) { vec3 t = abs(v); return max(max(t.r, t.g), t.b); @@ -4949,7 +4938,7 @@ fragColor = mix(C, Cop, s); vec3 Ctop = texture(colorTexture, offsets[0].zw).rgb; delta.y = absMax3(C - Ctop); - vec2 edges = step(vec2(${V.float(bwe.threshold)}), delta.xy); + vec2 edges = step(vec2(${V.float(wwe.threshold)}), delta.xy); // discard if there is no edge: if (dot(edges, vec2(1.0)) == 0.0) { @@ -4977,11 +4966,11 @@ fragColor = mix(C, Cop, s); maxDelta = max(max(maxDelta, delta.z), delta.w); // Local contrast adaptation in action: - edges *= step(maxDelta, float(${V.float(bwe.localConstrastAdaption)}) * delta.xy); + edges *= step(maxDelta, float(${V.float(wwe.localConstrastAdaption)}) * delta.xy); fragEdges = edges; } - `),t}const uDt=Object.freeze(Object.defineProperty({__proto__:null,build:qke},Symbol.toStringTag,{value:"Module"}));let Wke=class Yke extends Hr{initializeProgram(e){return new Ir(e.rctx,Yke.shader.get().build(),Er)}initializePipeline(){return Ti({colorWrite:ji})}};Wke.shader=new Rr(uDt,()=>we(()=>Promise.resolve().then(()=>XWt),void 0));let hDt=class extends _n{},sS=class extends CE{constructor(e){super(e),this._context=null,this._areaTexture=null,this._searchTexture=null,this._isEnabled=!1,this._smaaParameters=new hDt,this.produces=new Map([[ke.ANTIALIASING,()=>this._isEnabled&&this._context!=null]])}consumes(){return RLe}get updating(){return this._abortController!=null}initializeRenderContext(e){this._context=e,this.addHandles([_e(()=>this.view.qualitySettings.antialiasingEnabled,i=>{var r;return i||(r=this._context)!=null&&r.isFeatureEnabled(Zo.Antialiasing)?this.enable():this.disable()},kt)])}renderFeatureChanged(){var e;this.view.qualitySettings.antialiasingEnabled||(e=this._context)!=null&&e.isFeatureEnabled(Zo.Antialiasing)?this.enable():this.disable()}uninitializeRenderContext(){this.disable(),this._context=null}enable(){if(this._isEnabled||!this._context||this._abortController)return;if(this._edgeTechnique==null&&(this._edgeTechnique=this._context.techniqueRepository.acquire(Wke)),this._blendTechnique==null&&(this._blendTechnique=this._context.techniqueRepository.acquire(Vke)),this._blurTechnique==null&&(this._blurTechnique=this._context.techniqueRepository.acquire(Gke)),this._areaTexture&&this._searchTexture)return void(this._isEnabled=!0);this._abortController=new AbortController;const e=this._abortController.signal;we(()=>import("./SMAAData-j7UWeZ7Z.js"),__vite__mapDeps([])).then(i=>this._loadTextures(this._context,i,e)).then(()=>{var i;(i=this._context)==null||i.requestRender(),this._abortController=null}).catch(i=>{sn(i)||this._disposeTextures()})}_loadTextures(e,i,r){return St(r),e?Promise.all([C_(i.areaTexture).then(n=>wwe(e.fbos.rctx,ki.LINEAR,ci.RGB,n)),C_(i.searchTexure).then(n=>wwe(e.fbos.rctx,ki.NEAREST,ci.LUMINANCE,n))]).then(([n,s])=>{xo(r)?(n.dispose(),s.dispose(),St(r)):(this._areaTexture=n,this._searchTexture=s,this._isEnabled=!0)}):Promise.reject()}_disposeTextures(){this._areaTexture=Kt(this._areaTexture),this._searchTexture=Kt(this._searchTexture)}disable(){this._abortController=gn(this._abortController),this._isEnabled=!1}destroy(){this.disable(),this._disposeTextures()}renderNode(e,i,r,n){var T,A,M,I;const s=(T=r==null?void 0:r.composite)==null?void 0:T.colorTexture;if(!(this._isEnabled&&this._context&&r&&s))return n;if(!((A=this._edgeTechnique)!=null&&A.compiled&&((M=this._blendTechnique)!=null&&M.compiled)&&((I=this._blurTechnique)!=null&&I.compiled)))return this._context.requestRender(),n;const o=s.descriptor.width,l=s.descriptor.height,c=this._context.fbos,f=e.rctx;f.setViewport(0,0,o,l);const _=c.acquire(xr.RG,o,l);f.bindFramebuffer(_.fbo),f.setClearColor(0,0,0,1),f.clear(In.COLOR_BUFFER_BIT),this._smaaParameters.color=s,f.bindTechnique(this._edgeTechnique,this._smaaParameters),f.screen.draw();const x=c.acquire(xr.RGBA,o,l);return f.bindFramebuffer(x.fbo),f.setClearColor(0,0,1,1),f.clear(In.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=_.colorTexture,this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,f.bindTechnique(this._blendTechnique,this._smaaParameters),f.screen.draw(),f.bindFramebuffer(n==null?void 0:n.fbo),_.release(),f.setClearColor(0,1,0,1),f.clear(In.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=x.colorTexture,f.bindTechnique(this._blurTechnique,this._smaaParameters),f.screen.draw(),x.release(),n}};function wwe(t,e,i,r){const n=new tn;return n.pixelFormat=i,n.wrapMode=Bi.CLAMP_TO_EDGE,n.width=r.width,n.height=r.height,n.samplingMode=e,new Ai(t,n,r)}y([w()],sS.prototype,"view",void 0),y([w()],sS.prototype,"_context",void 0),y([w()],sS.prototype,"_abortController",void 0),y([w({readOnly:!0})],sS.prototype,"updating",null),sS=y([Z("esri.views.3d.webgl-engine.effects.smaa.SMAA")],sS);let dDt=class{constructor(){this._step=Twe,this._dilation=1,this._firstIdleTime=0}frame(e,i){if(i?this._firstIdleTime===0&&(this._firstIdleTime=performance.now()):this._firstIdleTime=0,Le("disable-feature:high-quality-idle"))this._dilation=1;else{const n=i?performance.now()-this._firstIdleTime:0;if(n>=xwe+fDt)return this._step=1/0,void(this._dilation=1);this._dilation=n>=xwe?mDt:1}const r=Je(e/pDt,Twe,yDt);this._step===1/0?this._step=r:this._step=this._step*Swe+r*(1-Swe)}get value(){return this._step}get timeDilation(){return this._dilation}clear(){this._step=this._firstIdleTime=0}};const pDt=.5,xwe=12e4,fDt=1e4,mDt=10,Swe=.9,gDt=30,Twe=1e3/1,yDt=1e3/gDt;let vDt=class{constructor(e,i){this._fbos=e,this.compositingHelper=i,this._width=4,this._height=4}dispose(){this._color=ir(this._color),this.releaseBuffers()}get framebuffer(){return this.color.detachDepth(),this.color.attachDepth(this.depth),this.color.fbo}get colorTexture(){return this.color.colorTexture}get depthTexture(){return this.depth.attachment}initializeFrame(e,i,r){this._fbos.interactive=!r;const n=this._fbos.rctx;this._width=e.fullWidth,this._height=e.fullHeight,KS(this,n.parameters.maxTextureSize);const s=this._color;return this._color=null,this.releaseBuffers(),this.bindFbo(),n.setClearStencil(0),n.setClearColor(i[0],i[1],i[2],i[3]),n.clearSafe(In.COLOR_BUFFER_BIT|In.DEPTH_BUFFER_BIT|In.STENCIL_BUFFER_BIT),s}releaseBuffers(){var e;(e=this._color)==null||e.detachDepth(),this._depth=ir(this._depth)}renderHUDVisibility(e,i,r){return(e==null?void 0:e.fbo.width)===this._width&&(e==null?void 0:e.fbo.height)===this._height||(e==null||e.release(),e=this._fbos.acquire(xr.RGBA4,this._width,this._height)),e.attachDepth(r||this.depth),this._fbos.rctx.bindFramebuffer(e.fbo),this.renderToFBO(i,_Dt),e.detachDepth(),e}compositeToHUDVisibility(e,i){var r;this._fbos.rctx.bindFramebuffer((r=e.hudVisibility)==null?void 0:r.fbo),this.compositingHelper.compositeHUD(e,i)}renderOITPass(e,i,r){let n,s;switch(i){case Jt.Color:n=this._fbos.acquire(xr.RGBA16F,this._width,this._height),s=[0,0,0,0];break;case Jt.Alpha:n=this._fbos.acquire(xr.R16F,this._width,this._height),s=[1,1,1,1];break;case Jt.FrontFace:n=this._fbos.acquire(xr.RGBA,this._width,this._height),s=[0,0,0,0]}return r?(n.acquireDepth(la.DEPTH16_BUFFER),this._fbos.rctx.bindFramebuffer(n.fbo),this.renderToFBO(e,s,!0,!0),n.releaseDepth()):(n.attachDepth(this.depth),this._fbos.rctx.bindFramebuffer(n.fbo),this.renderToFBO(e,s),n.detachDepth()),n}compositeToFramebuffer(e,i,r,n){this.bindFbo(),this.compositingHelper.composite(e,i,r,n)}compositeTransparentOntoOpaque(e,i,r,n,s){s?(this._fbos.rctx.bindFramebuffer(s.fbo),this._fbos.rctx.setClearColor(0,0,0,1e-13),this._fbos.rctx.clearSafe(In.COLOR_BUFFER_BIT)):this.bindFbo(),this.compositingHelper.compositeOIT(e,i.colorTexture,r.colorTexture,n.colorTexture)}renderDepthDetached(e){this._bindTarget(this.color),e(),this._bindTarget(this.color,this.depth)}renderToCachedFBO(e,i,r,n=xr.RGBA,s=la.DEPTH16_BUFFER,o=this._width,l=this._height,c=null){return(e==null?void 0:e.fbo.width)===o&&(e==null?void 0:e.fbo.height)===l||(e=ir(e)),e=e??this._fbos.acquire(n,o,l),s!=null&&e.acquireDepth(s),c==null||c.forEach(f=>{e.acquireColor(f.format,f.attachment)}),this._fbos.rctx.bindFramebuffer(e.fbo),this.renderToFBO(i,r,!0,!0),e}renderToFBO(e,i,r=!1,n=!1){const s=this._fbos.rctx;let o=0;if(i){const c=Math.max(1e-13,i[3]);s.setClearColor(i[0],i[1],i[2],c),o|=In.COLOR_BUFFER_BIT}r&&(o|=In.DEPTH_BUFFER_BIT),n===!1?n=0:(n===!0&&(n=255),o|=In.STENCIL_BUFFER_BIT),o&&s.clearSafe(o,n),e(),s.gl.flush()}renderToTargets(e,i,r,n,s=!1,o=!1){this._bindTarget(i,r),this.renderToFBO(e,n,s,o),i.detachDepth()}bindFbo(){this._bindTarget(this.color,this.depth)}_bindTarget(e,i){e.detachDepth(),e.attachDepth(i),this._fbos.rctx.bindFramebuffer(e.fbo)}get width(){return this._width}get height(){return this._height}get color(){return this._color||(this._color=this._fbos.acquire(xr.RGBA,this._width,this._height)),this._color}get depth(){return this._depth||(this._depth=this._fbos.acquireDepth(la.DEPTH_STENCIL_TEXTURE,this._width,this._height)),this._depth}};const _Dt=[0,1,0,1],m6=255,bDt=1/m6;function Xke(t){const e=new Cr,i=e.fragment;return i.include(o0),i.include(Kf),e.include(oG),e.include(Pc),e.include(lG,t),i.uniforms.add(new Zt("depthMap",(r,n)=>{var s;return(s=n.linearDepth)==null?void 0:s.colorTexture}),new _s("inverseViewMatrix",(r,n)=>Vo(Ewe,Qu(Ewe,n.camera.viewMatrix,n.camera.center))),new ln("nearFar",(r,n)=>n.camera.nearFar)),i.constants.add("sampleValue","float",bDt),e.outputs.add("sampleCount","float"),i.code.add(V`void main(void) { + `),t}const l6t=Object.freeze(Object.defineProperty({__proto__:null,build:Gke},Symbol.toStringTag,{value:"Module"}));let Hke=class qke extends Hr{initializeProgram(e){return new $r(e.rctx,qke.shader.get().build(),Cr)}initializePipeline(){return Ti({colorWrite:ji})}};Hke.shader=new Ir(l6t,()=>we(()=>Promise.resolve().then(()=>RXt),void 0));let c6t=class extends bn{},hS=class extends gx{constructor(e){super(e),this._context=null,this._areaTexture=null,this._searchTexture=null,this._isEnabled=!1,this._smaaParameters=new c6t,this.produces=new Map([[ke.ANTIALIASING,()=>this._isEnabled&&this._context!=null]])}consumes(){return ALe}get updating(){return this._abortController!=null}initializeRenderContext(e){this._context=e,this.addHandles([_e(()=>this.view.qualitySettings.antialiasingEnabled,i=>{var r;return i||(r=this._context)!=null&&r.isFeatureEnabled(Jo.Antialiasing)?this.enable():this.disable()},kt)])}renderFeatureChanged(){var e;this.view.qualitySettings.antialiasingEnabled||(e=this._context)!=null&&e.isFeatureEnabled(Jo.Antialiasing)?this.enable():this.disable()}uninitializeRenderContext(){this.disable(),this._context=null}enable(){if(this._isEnabled||!this._context||this._abortController)return;if(this._edgeTechnique==null&&(this._edgeTechnique=this._context.techniqueRepository.acquire(Hke)),this._blendTechnique==null&&(this._blendTechnique=this._context.techniqueRepository.acquire(zke)),this._blurTechnique==null&&(this._blurTechnique=this._context.techniqueRepository.acquire(Bke)),this._areaTexture&&this._searchTexture)return void(this._isEnabled=!0);this._abortController=new AbortController;const e=this._abortController.signal;we(()=>import("./SMAAData-j7UWeZ7Z.js"),__vite__mapDeps([])).then(i=>this._loadTextures(this._context,i,e)).then(()=>{var i;(i=this._context)==null||i.requestRender(),this._abortController=null}).catch(i=>{on(i)||this._disposeTextures()})}_loadTextures(e,i,r){return St(r),e?Promise.all([$_(i.areaTexture).then(n=>xwe(e.fbos.rctx,ki.LINEAR,ci.RGB,n)),$_(i.searchTexure).then(n=>xwe(e.fbos.rctx,ki.NEAREST,ci.LUMINANCE,n))]).then(([n,s])=>{So(r)?(n.dispose(),s.dispose(),St(r)):(this._areaTexture=n,this._searchTexture=s,this._isEnabled=!0)}):Promise.reject()}_disposeTextures(){this._areaTexture=Kt(this._areaTexture),this._searchTexture=Kt(this._searchTexture)}disable(){this._abortController=vn(this._abortController),this._isEnabled=!1}destroy(){this.disable(),this._disposeTextures()}renderNode(e,i,r,n){var S,C,M,P;const s=(S=r==null?void 0:r.composite)==null?void 0:S.colorTexture;if(!(this._isEnabled&&this._context&&r&&s))return n;if(!((C=this._edgeTechnique)!=null&&C.compiled&&((M=this._blendTechnique)!=null&&M.compiled)&&((P=this._blurTechnique)!=null&&P.compiled)))return this._context.requestRender(),n;const o=s.descriptor.width,a=s.descriptor.height,c=this._context.fbos,p=e.rctx;p.setViewport(0,0,o,a);const _=c.acquire(Sr.RG,o,a);p.bindFramebuffer(_.fbo),p.setClearColor(0,0,0,1),p.clear($n.COLOR_BUFFER_BIT),this._smaaParameters.color=s,p.bindTechnique(this._edgeTechnique,this._smaaParameters),p.screen.draw();const x=c.acquire(Sr.RGBA,o,a);return p.bindFramebuffer(x.fbo),p.setClearColor(0,0,1,1),p.clear($n.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=_.colorTexture,this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,p.bindTechnique(this._blendTechnique,this._smaaParameters),p.screen.draw(),p.bindFramebuffer(n==null?void 0:n.fbo),_.release(),p.setClearColor(0,1,0,1),p.clear($n.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=x.colorTexture,p.bindTechnique(this._blurTechnique,this._smaaParameters),p.screen.draw(),x.release(),n}};function xwe(t,e,i,r){const n=new rn;return n.pixelFormat=i,n.wrapMode=Bi.CLAMP_TO_EDGE,n.width=r.width,n.height=r.height,n.samplingMode=e,new Ai(t,n,r)}y([w()],hS.prototype,"view",void 0),y([w()],hS.prototype,"_context",void 0),y([w()],hS.prototype,"_abortController",void 0),y([w({readOnly:!0})],hS.prototype,"updating",null),hS=y([Z("esri.views.3d.webgl-engine.effects.smaa.SMAA")],hS);let u6t=class{constructor(){this._step=Ewe,this._dilation=1,this._firstIdleTime=0}frame(e,i){if(i?this._firstIdleTime===0&&(this._firstIdleTime=performance.now()):this._firstIdleTime=0,$e("disable-feature:high-quality-idle"))this._dilation=1;else{const n=i?performance.now()-this._firstIdleTime:0;if(n>=Swe+d6t)return this._step=1/0,void(this._dilation=1);this._dilation=n>=Swe?p6t:1}const r=Je(e/h6t,Ewe,m6t);this._step===1/0?this._step=r:this._step=this._step*Twe+r*(1-Twe)}get value(){return this._step}get timeDilation(){return this._dilation}clear(){this._step=this._firstIdleTime=0}};const h6t=.5,Swe=12e4,d6t=1e4,p6t=10,Twe=.9,f6t=30,Ewe=1e3/1,m6t=1e3/f6t;let g6t=class{constructor(e,i){this._fbos=e,this.compositingHelper=i,this._width=4,this._height=4}dispose(){this._color=ir(this._color),this.releaseBuffers()}get framebuffer(){return this.color.detachDepth(),this.color.attachDepth(this.depth),this.color.fbo}get colorTexture(){return this.color.colorTexture}get depthTexture(){return this.depth.attachment}initializeFrame(e,i,r){this._fbos.interactive=!r;const n=this._fbos.rctx;this._width=e.fullWidth,this._height=e.fullHeight,nT(this,n.parameters.maxTextureSize);const s=this._color;return this._color=null,this.releaseBuffers(),this.bindFbo(),n.setClearStencil(0),n.setClearColor(i[0],i[1],i[2],i[3]),n.clearSafe($n.COLOR_BUFFER_BIT|$n.DEPTH_BUFFER_BIT|$n.STENCIL_BUFFER_BIT),s}releaseBuffers(){var e;(e=this._color)==null||e.detachDepth(),this._depth=ir(this._depth)}renderHUDVisibility(e,i,r){return(e==null?void 0:e.fbo.width)===this._width&&(e==null?void 0:e.fbo.height)===this._height||(e==null||e.release(),e=this._fbos.acquire(Sr.RGBA4,this._width,this._height)),e.attachDepth(r||this.depth),this._fbos.rctx.bindFramebuffer(e.fbo),this.renderToFBO(i,y6t),e.detachDepth(),e}compositeToHUDVisibility(e,i){var r;this._fbos.rctx.bindFramebuffer((r=e.hudVisibility)==null?void 0:r.fbo),this.compositingHelper.compositeHUD(e,i)}renderOITPass(e,i,r){let n,s;switch(i){case Jt.Color:n=this._fbos.acquire(Sr.RGBA16F,this._width,this._height),s=[0,0,0,0];break;case Jt.Alpha:n=this._fbos.acquire(Sr.R16F,this._width,this._height),s=[1,1,1,1];break;case Jt.FrontFace:n=this._fbos.acquire(Sr.RGBA,this._width,this._height),s=[0,0,0,0]}return r?(n.acquireDepth(ca.DEPTH16_BUFFER),this._fbos.rctx.bindFramebuffer(n.fbo),this.renderToFBO(e,s,!0,!0),n.releaseDepth()):(n.attachDepth(this.depth),this._fbos.rctx.bindFramebuffer(n.fbo),this.renderToFBO(e,s),n.detachDepth()),n}compositeToFramebuffer(e,i,r,n){this.bindFbo(),this.compositingHelper.composite(e,i,r,n)}compositeTransparentOntoOpaque(e,i,r,n,s){s?(this._fbos.rctx.bindFramebuffer(s.fbo),this._fbos.rctx.setClearColor(0,0,0,1e-13),this._fbos.rctx.clearSafe($n.COLOR_BUFFER_BIT)):this.bindFbo(),this.compositingHelper.compositeOIT(e,i.colorTexture,r.colorTexture,n.colorTexture)}renderDepthDetached(e){this._bindTarget(this.color),e(),this._bindTarget(this.color,this.depth)}renderToCachedFBO(e,i,r,n=Sr.RGBA,s=ca.DEPTH16_BUFFER,o=this._width,a=this._height,c=null){return(e==null?void 0:e.fbo.width)===o&&(e==null?void 0:e.fbo.height)===a||(e=ir(e)),e=e??this._fbos.acquire(n,o,a),s!=null&&e.acquireDepth(s),c==null||c.forEach(p=>{e.acquireColor(p.format,p.attachment)}),this._fbos.rctx.bindFramebuffer(e.fbo),this.renderToFBO(i,r,!0,!0),e}renderToFBO(e,i,r=!1,n=!1){const s=this._fbos.rctx;let o=0;if(i){const c=Math.max(1e-13,i[3]);s.setClearColor(i[0],i[1],i[2],c),o|=$n.COLOR_BUFFER_BIT}r&&(o|=$n.DEPTH_BUFFER_BIT),n===!1?n=0:(n===!0&&(n=255),o|=$n.STENCIL_BUFFER_BIT),o&&s.clearSafe(o,n),e(),s.gl.flush()}renderToTargets(e,i,r,n,s=!1,o=!1){this._bindTarget(i,r),this.renderToFBO(e,n,s,o),i.detachDepth()}bindFbo(){this._bindTarget(this.color,this.depth)}_bindTarget(e,i){e.detachDepth(),e.attachDepth(i),this._fbos.rctx.bindFramebuffer(e.fbo)}get width(){return this._width}get height(){return this._height}get color(){return this._color||(this._color=this._fbos.acquire(Sr.RGBA,this._width,this._height)),this._color}get depth(){return this._depth||(this._depth=this._fbos.acquireDepth(ca.DEPTH_STENCIL_TEXTURE,this._width,this._height)),this._depth}};const y6t=[0,1,0,1],_6=255,v6t=1/_6;function Wke(t){const e=new Ar,i=e.fragment;return i.include(c0),i.include(i0),e.include(gG),e.include($c),e.include(vG,t),i.uniforms.add(new Zt("depthMap",(r,n)=>{var s;return(s=n.linearDepth)==null?void 0:s.colorTexture}),new bs("inverseViewMatrix",(r,n)=>Bo(Cwe,eh(Cwe,n.camera.viewMatrix,n.camera.center))),new cn("nearFar",(r,n)=>n.camera.nearFar)),i.constants.add("sampleValue","float",v6t),e.outputs.add("sampleCount","float"),i.code.add(V`void main(void) { float depth = rgba2float(texture(depthMap, uv)); if (depth == 0.0) { discard; @@ -5010,7 +4999,7 @@ if (!shadow) { discard; } sampleCount = sampleValue; -}`),e}const Ewe=Qe(),wDt=Object.freeze(Object.defineProperty({__proto__:null,ShadowCastMaxSamples:m6,build:Xke},Symbol.toStringTag,{value:"Module"}));var s_;(function(t){t[t.Gradient=0]="Gradient",t[t.Threshold=1]="Threshold",t[t.COUNT=2]="COUNT"})(s_||(s_={}));let rre=class extends nh{constructor(){super(...arguments),this.visualization=s_.Gradient,this.bandsEnabled=!1}};y([fe({count:s_.COUNT})],rre.prototype,"visualization",void 0),y([fe()],rre.prototype,"bandsEnabled",void 0);let Yce=class extends _n{constructor(e){super(),this._data=e,this.sampleScale=0,this.opacityFromElevation=1,this.color=U9(xDt),this.bandSize=.1,this.threshold=.5}get shadowCastMap(){return this._data.shadowCastTexture}};const xDt=Mi(.01,0,.25,1);function Zke(t){const e=new Cr,i=e.fragment;i.include(o0),i.include(Kf),e.include(oG),e.include(Pc);const{visualization:r,bandsEnabled:n}=t;i.constants.add("inverseSampleValue","float",m6),i.uniforms.add(new Zt("shadowCastMap",l=>l.shadowCastMap),new ft("sampleScale",l=>l.sampleScale),new ft("opacityFromElevation",l=>l.opacityFromElevation),new gr("uColor",l=>l.color));const s=r===s_.Gradient,o=r===s_.Threshold;return s&&n?i.uniforms.add(new ft("bandSize",l=>l.bandSize)):o&&i.uniforms.add(new ft("threshold",l=>l.threshold)),i.code.add(V` +}`),e}const Cwe=Qe(),_6t=Object.freeze(Object.defineProperty({__proto__:null,ShadowCastMaxSamples:_6,build:Wke},Symbol.toStringTag,{value:"Module"}));var d_;(function(t){t[t.Gradient=0]="Gradient",t[t.Threshold=1]="Threshold",t[t.COUNT=2]="COUNT"})(d_||(d_={}));let hre=class extends oh{constructor(){super(...arguments),this.visualization=d_.Gradient,this.bandsEnabled=!1}};y([fe({count:d_.COUNT})],hre.prototype,"visualization",void 0),y([fe()],hre.prototype,"bandsEnabled",void 0);let aue=class extends bn{constructor(e){super(),this._data=e,this.sampleScale=0,this.opacityFromElevation=1,this.color=G9(b6t),this.bandSize=.1,this.threshold=.5}get shadowCastMap(){return this._data.shadowCastTexture}};const b6t=Mi(.01,0,.25,1);function Yke(t){const e=new Ar,i=e.fragment;i.include(c0),i.include(i0),e.include(gG),e.include($c);const{visualization:r,bandsEnabled:n}=t;i.constants.add("inverseSampleValue","float",_6),i.uniforms.add(new Zt("shadowCastMap",a=>a.shadowCastMap),new ft("sampleScale",a=>a.sampleScale),new ft("opacityFromElevation",a=>a.opacityFromElevation),new gr("uColor",a=>a.color));const s=r===d_.Gradient,o=r===d_.Threshold;return s&&n?i.uniforms.add(new ft("bandSize",a=>a.bandSize)):o&&i.uniforms.add(new ft("threshold",a=>a.threshold)),i.code.add(V` void main(void) { float record = texture(shadowCastMap, uv).r; float pixelSamples = record * inverseSampleValue; @@ -5029,14 +5018,14 @@ sampleCount = sampleValue; fragColor = vec4(uColor.xyz, uColor.a * opacityFromElevation ${s?V`* strength`:""}); } - `),e}const SDt=Object.freeze(Object.defineProperty({__proto__:null,ShadowCastVisualizePassParameters:Yce,build:Zke},Symbol.toStringTag,{value:"Module"}));let Jke=class Kke extends Hr{constructor(e,i){super(e,i,()=>this.destroy())}initializeProgram(e){return new Ir(e.rctx,Kke.shader.get().build(this.configuration),Er)}initializePipeline(){return Ti({blending:vp,colorWrite:ji,depthTest:null,depthWrite:null})}get primitiveType(){return sr.TRIANGLE_STRIP}};Jke.shader=new Rr(SDt,()=>we(()=>Promise.resolve().then(()=>ZWt),void 0));const TDt=4e4,EDt=5e4,Qke=1/512;let wk=class extends ze{constructor(e,i,r,n){super({}),this._techniqueRepository=e,this._rctx=i,this._data=r,this._requestRender=n,this._passParameters=new Yce(this._data),this._techniqueConfig=new rre,this._enabled=!1,this._vao=u1(i)}normalizeCtorArgs(){return{}}dispose(){this._stop(),this._vao=Kt(this._vao),this._techniqueRepository.release(this._technique),this._technique=null}get _visualizeShadowCastTechnique(){return this._technique=this._techniqueRepository.releaseAndAcquire(Jke,this._techniqueConfig,this._technique),this._technique}render(e){if(!this._showVisualization)return;this._passParameters.sampleScale=1/this._data.computedSamples;const i=this._visualizeShadowCastTechnique;this._rctx.bindVAO(this._vao),this._rctx.bindTechnique(i,this._passParameters,e),this._rctx.drawArrays(i.primitiveType,0,Kv(this._vao,"geometry"))}setOptions(e){e.enabled!==void 0&&this._setEnabled(e.enabled),e.color!==void 0&&this._setColor(e.color),e.threshold!==void 0&&(this._threshold=e.threshold),e.visualization!==void 0&&(this._visualization=e.visualization),e.bandSize!==void 0&&(this._bandSize=e.bandSize),e.bandsEnabled!==void 0&&(this._bandsEnabled=e.bandsEnabled)}get opacityFromElevation(){return this._passParameters.opacityFromElevation}set opacityFromElevation(e){this._passParameters.opacityFromElevation!==e&&(this._passParameters.opacityFromElevation=e,this.notifyChange("opacityFromElevation"))}get _showVisualization(){return this._enabled&&this._data.computedSamples>0&&this.opacityFromElevation>Qke}get _threshold(){return this._passParameters.threshold}set _threshold(e){this._threshold!==e&&(this._passParameters.threshold=e,this._requestRenderIfRunning())}get _visualization(){return this._techniqueConfig.visualization}set _visualization(e){e!==this._visualization&&(this._techniqueConfig.visualization=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}get _bandSize(){return this._passParameters.bandSize}set _bandSize(e){e!==this._bandSize&&(this._passParameters.bandSize=e,this._requestRenderIfRunning())}get _bandsEnabled(){return this._techniqueConfig.bandsEnabled}set _bandsEnabled(e){e!==this._bandsEnabled&&(this._techniqueConfig.bandsEnabled=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}_setColor(e){const i=this._passParameters.color;rO(e,i)||(mm(this._passParameters.color,e),this._requestRenderIfRunning())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfRunning(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};y([w()],wk.prototype,"opacityFromElevation",null),wk=y([Z("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],wk);let eze=class tze extends Hr{constructor(e){super(e,new Wce,()=>this.destroy())}initializeProgram(e){return new Ir(e.rctx,tze.shader.get().build(this.configuration),Er)}initializePipeline(){return Ti({blending:Ol(st.ONE,st.ONE,st.ONE,st.ONE),colorWrite:ji,depthTest:null,depthWrite:null})}get primitiveType(){return sr.TRIANGLE_STRIP}};eze.shader=new Rr(wDt,()=>we(()=>Promise.resolve().then(()=>JWt),void 0));let Pu=class extends ze{constructor(e,i,r,n,s,o){super({}),this.fbos=e,this._stage=r,this._prepareForShadowMapPass=n,this._renderToShadowMap=s,this._requestRender=o,this._progress=0,this._sampleCount=0,this._passParameters=new Ole,this._cachedLightDirections=[],this._depthRange=Xie,this._previewing=!1,this._cameraForcedForScreenshot=!1,this._shadowAccumulatorKey="shadowAccumulator",this._rctx=e.rctx,this._bindParameters=new Pj(new Xle(e,r.viewingMode),null),this._bindParameters.shadowMap.enabled=!0,this._vao=u1(this._rctx),this._accumulationRenderer=new wk(i,this._rctx,this,o);const l=this._stage.view.resourceController.scheduler;this.addHandles([l.registerTask(ni.SHADOW_ACCUMULATOR,this),_e(()=>r.renderView,c=>{this.removeHandles(Cwe),c!=null&&this.addHandles(c.events.on("force-camera-for-screenshot",()=>this._cameraForcedForScreenshot=!0),Cwe)},kt),_e(()=>this._previewing,()=>this._requestRenderIfEnabled(),Li)],this._shadowAccumulatorKey)}normalizeCtorArgs(){return{}}dispose(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=Kt(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=Kt(this._fbo),this._vao=Kt(this._vao),this._accumulationTechniqueCached=ir(this._accumulationTechniqueCached),this._cachedLightDirections.length=0,this._sampleCount=0}get computedSamples(){return this._progress}get shadowCastTexture(){var e;return(e=this._fbo)==null?void 0:e.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get _accumulationTechnique(){if(this._accumulationTechniqueCached==null){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode};this._accumulationTechniqueCached=new eze(e)}return this._accumulationTechniqueCached}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return this._fbo!=null&&this._sampleCount>0}get canAccumulate(){var e;return((e=this._bindParameters.linearDepth)==null?void 0:e.colorTexture)!==null&&this._depthRange!==Xie&&this._opacityFromElevation>Qke}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const i=this._cachedLightDirections;if(Fy(i,e,M2))return;const r=Math.min(m6,e.length);i.length=r,this._sampleCount=r;for(let n=0;n0}runTask(e){for(this._prepareForShadowMapPass(this._bindParameters);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}renderAccumulation(e,i,r,n){if(this._depthRange=i,this._updateCamera(r),this._bindParameters.contentCamera=n,this._bindParameters.linearDepth=e,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!this.isAccumulating||!this.canAccumulate)return;(this._previewing||this._progress===0||this._cameraForcedForScreenshot)&&this._clear();const s=this._cameraForcedForScreenshot?this._sampleCount:Math.min(CDt,this._sampleCount-this._progress);for(let o=0;o=this._fbo.width||i<0||i>=this._fbo.height?0:(this._fbo.readPixels(e,i,1,1,ci.RED,ga.UNSIGNED_BYTE,Awe),Awe[0]/this._progress)}_enable(){this._progress=0;const e=new tn;e.pixelFormat=ci.RED,e.internalFormat=zt.R8,e.wrapMode=Bi.CLAMP_TO_EDGE,this._fbo=new Hm(this._rctx,e)}_disable(){this._fbo=Kt(this._fbo)}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe(In.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){this._renderToShadowMap(this._bindParameters,this._lightDirections[this._progress++],this._depthRange);const e=this._accumulationTechnique;this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._passParameters,this._bindParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,Kv(this._vao,"geometry"))}_updateCamera(e){!e.equals(this._bindParameters.camera)&&this._fbo&&(this._bindParameters.camera.copyFrom(e),this._fbo.resize(e.fullWidth,e.fullHeight),this._opacityFromElevation=1-pL(TDt,EDt,e.relativeElevation))}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){const e=this;return{lightDirections:this._lightDirections,get isDone(){return e._isDoneAccumulating},get isActive(){return e._isActive}}}};y([w()],Pu.prototype,"_progress",void 0),y([w()],Pu.prototype,"_sampleCount",void 0),y([w()],Pu.prototype,"_fbo",void 0),y([w()],Pu.prototype,"_depthRange",void 0),y([w()],Pu.prototype,"_previewing",void 0),y([w()],Pu.prototype,"_accumulationRenderer",void 0),y([w()],Pu.prototype,"_isRefining",null),y([w()],Pu.prototype,"_isActive",null),y([w()],Pu.prototype,"canAccumulate",null),y([w()],Pu.prototype,"_isDoneAccumulating",null),y([w()],Pu.prototype,"_opacityFromElevation",null),y([w()],Pu.prototype,"running",null),Pu=y([Z("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],Pu);const CDt=6,Cwe="renderView",Awe=new Uint8Array(1),Mwe=U_();let ADt=class{constructor(){this._plane=U_()}get isEnabled(){return!b4e(this.plane,Mwe)}get plane(){return this._plane}set plane(e){wE(e||Mwe,this._plane)}};function MDt(t,e){const i=-t[0],r=-t[1],n=-t[2],s=e[3],o=e[7],l=e[11],c=e[15];e[0]+=s*i,e[1]+=s*r,e[2]+=s*n,e[4]+=o*i,e[5]+=o*r,e[6]+=o*n,e[8]+=l*i,e[9]+=l*r,e[10]+=l*n,e[12]+=c*i,e[13]+=c*r,e[14]+=c*n}function ODt(t,e){const i=t[0],r=t[1],n=t[2];e[12]+=i*e[0]+r*e[4]+n*e[8],e[13]+=i*e[1]+r*e[5]+n*e[9],e[14]+=i*e[2]+r*e[6]+n*e[10],e[14]+=i*e[3]+r*e[7]+n*e[11]}let PDt=class{constructor(e){this._factory=e,this._originData=new Map}acquire(e){return this.register(this._factory.getOrigin(e))}register(e){const i=this._originData.get(e.id)||new RDt(e);return i.refCount++,this._originData.has(i.origin.id)||this._originData.set(i.origin.id,i),i}release(e){e.refCount--,e.refCount===0&&this._originData.delete(e.origin.id)}updateViewMatrices(e){this._originData.forEach(i=>{Ao(i.viewMatrix,e),ODt(i.origin.vec3,i.viewMatrix)})}},RDt=class{constructor(e){this.origin=e,this.refCount=0,this.viewMatrix=Qe()}},IDt=class extends Z$e{constructor(e,i){super(),this.distanceFalloffFactor=e,this.transparency=i,this.transformNormalViewFromGlobal=as()}},$Dt=class extends J$e{constructor(){super(...arguments),this.transformNormalViewFromGlobal=as(),this.slicePlaneLocalOrigin=W(),this.transformNormalGlobalFromModel=as()}};function LDt(t){const e=V`bool isNaN( float val ) + `),e}const w6t=Object.freeze(Object.defineProperty({__proto__:null,ShadowCastVisualizePassParameters:aue,build:Yke},Symbol.toStringTag,{value:"Module"}));let Xke=class Zke extends Hr{constructor(e,i){super(e,i,()=>this.destroy())}initializeProgram(e){return new $r(e.rctx,Zke.shader.get().build(this.configuration),Cr)}initializePipeline(){return Ti({blending:xp,colorWrite:ji,depthTest:null,depthWrite:null})}get primitiveType(){return sr.TRIANGLE_STRIP}};Xke.shader=new Ir(w6t,()=>we(()=>Promise.resolve().then(()=>IXt),void 0));const x6t=4e4,S6t=5e4,Jke=1/512;let Rk=class extends ze{constructor(e,i,r,n){super({}),this._techniqueRepository=e,this._rctx=i,this._data=r,this._requestRender=n,this._passParameters=new aue(this._data),this._techniqueConfig=new hre,this._enabled=!1,this._vao=v1(i)}normalizeCtorArgs(){return{}}dispose(){this._stop(),this._vao=Kt(this._vao),this._techniqueRepository.release(this._technique),this._technique=null}get _visualizeShadowCastTechnique(){return this._technique=this._techniqueRepository.releaseAndAcquire(Xke,this._techniqueConfig,this._technique),this._technique}render(e){if(!this._showVisualization)return;this._passParameters.sampleScale=1/this._data.computedSamples;const i=this._visualizeShadowCastTechnique;this._rctx.bindVAO(this._vao),this._rctx.bindTechnique(i,this._passParameters,e),this._rctx.drawArrays(i.primitiveType,0,s_(this._vao,"geometry"))}setOptions(e){e.enabled!==void 0&&this._setEnabled(e.enabled),e.color!==void 0&&this._setColor(e.color),e.threshold!==void 0&&(this._threshold=e.threshold),e.visualization!==void 0&&(this._visualization=e.visualization),e.bandSize!==void 0&&(this._bandSize=e.bandSize),e.bandsEnabled!==void 0&&(this._bandsEnabled=e.bandsEnabled)}get opacityFromElevation(){return this._passParameters.opacityFromElevation}set opacityFromElevation(e){this._passParameters.opacityFromElevation!==e&&(this._passParameters.opacityFromElevation=e,this.notifyChange("opacityFromElevation"))}get _showVisualization(){return this._enabled&&this._data.computedSamples>0&&this.opacityFromElevation>Jke}get _threshold(){return this._passParameters.threshold}set _threshold(e){this._threshold!==e&&(this._passParameters.threshold=e,this._requestRenderIfRunning())}get _visualization(){return this._techniqueConfig.visualization}set _visualization(e){e!==this._visualization&&(this._techniqueConfig.visualization=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}get _bandSize(){return this._passParameters.bandSize}set _bandSize(e){e!==this._bandSize&&(this._passParameters.bandSize=e,this._requestRenderIfRunning())}get _bandsEnabled(){return this._techniqueConfig.bandsEnabled}set _bandsEnabled(e){e!==this._bandsEnabled&&(this._techniqueConfig.bandsEnabled=e,this._techniqueRepository.release(this._technique),this._technique=null,this._requestRenderIfRunning())}_setColor(e){const i=this._passParameters.color;aO(e,i)||(ym(this._passParameters.color,e),this._requestRenderIfRunning())}_setEnabled(e){e!==this._enabled&&(e?this._start():this._stop())}_requestRenderIfRunning(){this._enabled&&this._requestRender()}_start(){this._enabled=!0,this._requestRender()}_stop(){this._enabled=!1,this._requestRender()}};y([w()],Rk.prototype,"opacityFromElevation",null),Rk=y([Z("esri.views.3d.webgl-engine.lib.ShadowCastRenderer")],Rk);let Kke=class Qke extends Hr{constructor(e){super(e,new oue,()=>this.destroy())}initializeProgram(e){return new $r(e.rctx,Qke.shader.get().build(this.configuration),Cr)}initializePipeline(){return Ti({blending:Pl(ot.ONE,ot.ONE,ot.ONE,ot.ONE),colorWrite:ji,depthTest:null,depthWrite:null})}get primitiveType(){return sr.TRIANGLE_STRIP}};Kke.shader=new Ir(_6t,()=>we(()=>Promise.resolve().then(()=>$Xt),void 0));let Iu=class extends ze{constructor(e,i,r,n,s,o){super({}),this.fbos=e,this._stage=r,this._prepareForShadowMapPass=n,this._renderToShadowMap=s,this._requestRender=o,this._progress=0,this._sampleCount=0,this._passParameters=new Ble,this._cachedLightDirections=[],this._depthRange=rre,this._previewing=!1,this._cameraForcedForScreenshot=!1,this._shadowAccumulatorKey="shadowAccumulator",this._rctx=e.rctx,this._bindParameters=new Uj(new lce(e,r.viewingMode),null),this._bindParameters.shadowMap.enabled=!0,this._vao=v1(this._rctx),this._accumulationRenderer=new Rk(i,this._rctx,this,o);const a=this._stage.view.resourceController.scheduler;this.addHandles([a.registerTask(ni.SHADOW_ACCUMULATOR,this),_e(()=>r.renderView,c=>{this.removeHandles(Awe),c!=null&&this.addHandles(c.events.on("force-camera-for-screenshot",()=>this._cameraForcedForScreenshot=!0),Awe)},kt),_e(()=>this._previewing,()=>this._requestRenderIfEnabled(),Li)],this._shadowAccumulatorKey)}normalizeCtorArgs(){return{}}dispose(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this._accumulationRenderer=Kt(this._accumulationRenderer),this._bindParameters.shadowMap.dispose(),this._fbo=Kt(this._fbo),this._vao=Kt(this._vao),this._accumulationTechniqueCached=ir(this._accumulationTechniqueCached),this._cachedLightDirections.length=0,this._sampleCount=0}get computedSamples(){return this._progress}get shadowCastTexture(){var e;return(e=this._fbo)==null?void 0:e.colorTexture}get isAccumulating(){return this._isPreviewing||this._isRefining}get _accumulationTechnique(){if(this._accumulationTechniqueCached==null){const e={rctx:this._rctx,viewingMode:this._stage.viewingMode};this._accumulationTechniqueCached=new Kke(e)}return this._accumulationTechniqueCached}get _isRefining(){return this._isActive&&!this._isDoneAccumulating&&!this._previewing}get _isPreviewing(){return this._isActive&&this._previewing}get _isActive(){return this._fbo!=null&&this._sampleCount>0}get canAccumulate(){var e;return((e=this._bindParameters.linearDepth)==null?void 0:e.colorTexture)!==null&&this._depthRange!==rre&&this._opacityFromElevation>Jke}get _isDoneAccumulating(){return this._progress>=this._sampleCount}get _lightDirections(){return this._cachedLightDirections}set _lightDirections(e){const i=this._cachedLightDirections;if(jy(i,e,L2))return;const r=Math.min(_6,e.length);i.length=r,this._sampleCount=r;for(let n=0;n0}runTask(e){for(this._prepareForShadowMapPass(this._bindParameters);!e.done&&!this._isDoneAccumulating;)this._accumulateShadow(),e.madeProgress();this._requestRender()}renderAccumulation(e,i,r,n){if(this._depthRange=i,this._updateCamera(r),this._bindParameters.contentCamera=n,this._bindParameters.linearDepth=e,this._passParameters.origin=this._bindParameters.camera.center,this.notifyChange("canAccumulate"),!this.isAccumulating||!this.canAccumulate)return;(this._previewing||this._progress===0||this._cameraForcedForScreenshot)&&this._clear();const s=this._cameraForcedForScreenshot?this._sampleCount:Math.min(T6t,this._sampleCount-this._progress);for(let o=0;o=this._fbo.width||i<0||i>=this._fbo.height?0:(this._fbo.readPixels(e,i,1,1,ci.RED,ya.UNSIGNED_BYTE,Mwe),Mwe[0]/this._progress)}_enable(){this._progress=0;const e=new rn;e.pixelFormat=ci.RED,e.internalFormat=zt.R8,e.wrapMode=Bi.CLAMP_TO_EDGE,this._fbo=new Zm(this._rctx,e)}_disable(){this._fbo=Kt(this._fbo)}_invalidate(){this._progress=0,this._requestRenderIfEnabled()}_clear(){this._rctx.bindFramebuffer(this._fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clearSafe($n.COLOR_BUFFER_BIT),this._progress=0}_accumulateShadow(){this._renderToShadowMap(this._bindParameters,this._lightDirections[this._progress++],this._depthRange);const e=this._accumulationTechnique;this._rctx.bindFramebuffer(this._fbo),this._rctx.bindTechnique(e,this._passParameters,this._bindParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(e.primitiveType,0,s_(this._vao,"geometry"))}_updateCamera(e){!e.equals(this._bindParameters.camera)&&this._fbo&&(this._bindParameters.camera.copyFrom(e),this._fbo.resize(e.fullWidth,e.fullHeight),this._opacityFromElevation=1-bL(x6t,S6t,e.relativeElevation))}_requestRenderIfEnabled(){this._fbo&&this._requestRender()}get test(){const e=this;return{lightDirections:this._lightDirections,get isDone(){return e._isDoneAccumulating},get isActive(){return e._isActive}}}};y([w()],Iu.prototype,"_progress",void 0),y([w()],Iu.prototype,"_sampleCount",void 0),y([w()],Iu.prototype,"_fbo",void 0),y([w()],Iu.prototype,"_depthRange",void 0),y([w()],Iu.prototype,"_previewing",void 0),y([w()],Iu.prototype,"_accumulationRenderer",void 0),y([w()],Iu.prototype,"_isRefining",null),y([w()],Iu.prototype,"_isActive",null),y([w()],Iu.prototype,"canAccumulate",null),y([w()],Iu.prototype,"_isDoneAccumulating",null),y([w()],Iu.prototype,"_opacityFromElevation",null),y([w()],Iu.prototype,"running",null),Iu=y([Z("esri.views.3d.webgl-engine.lib.ShadowAccumulator")],Iu);const T6t=6,Awe="renderView",Mwe=new Uint8Array(1),Owe=H_();let E6t=class{constructor(){this._plane=H_()}get isEnabled(){return!YRe(this.plane,Owe)}get plane(){return this._plane}set plane(e){AE(e||Owe,this._plane)}};function C6t(t,e){const i=-t[0],r=-t[1],n=-t[2],s=e[3],o=e[7],a=e[11],c=e[15];e[0]+=s*i,e[1]+=s*r,e[2]+=s*n,e[4]+=o*i,e[5]+=o*r,e[6]+=o*n,e[8]+=a*i,e[9]+=a*r,e[10]+=a*n,e[12]+=c*i,e[13]+=c*r,e[14]+=c*n}function A6t(t,e){const i=t[0],r=t[1],n=t[2];e[12]+=i*e[0]+r*e[4]+n*e[8],e[13]+=i*e[1]+r*e[5]+n*e[9],e[14]+=i*e[2]+r*e[6]+n*e[10],e[14]+=i*e[3]+r*e[7]+n*e[11]}let M6t=class{constructor(e){this._factory=e,this._originData=new Map}acquire(e){return this.register(this._factory.getOrigin(e))}register(e){const i=this._originData.get(e.id)||new O6t(e);return i.refCount++,this._originData.has(i.origin.id)||this._originData.set(i.origin.id,i),i}release(e){e.refCount--,e.refCount===0&&this._originData.delete(e.origin.id)}updateViewMatrices(e){this._originData.forEach(i=>{Mo(i.viewMatrix,e),A6t(i.origin.vec3,i.viewMatrix)})}},O6t=class{constructor(e){this.origin=e,this.refCount=0,this.viewMatrix=Qe()}},P6t=class extends q$e{constructor(e,i){super(),this.distanceFalloffFactor=e,this.transparency=i,this.transformNormalViewFromGlobal=as()}},R6t=class extends W$e{constructor(){super(...arguments),this.transformNormalViewFromGlobal=as(),this.slicePlaneLocalOrigin=W(),this.transformNormalGlobalFromModel=as()}};function I6t(t){const e=V`bool isNaN( float val ) { return ( val < 0.0 || 0.0 < val || val == 0.0 ) ? false : true; -}`;t.code.add(e)}const DDt=Ji(.5,-4e-4);function NDt(t,e){const i=t.vertex;i.include(LDt),i.constants.add("depthBias","vec2",DDt),i.uniforms.add(new ln("inverseViewport",(r,n)=>n.inverseViewport)),e.legacy?(i.uniforms.add(new _s("proj",(r,n)=>n.camera.projectionMatrix)),i.code.add(V`vec2 calculateProjectedBiasXY(vec4 projPos, vec3 globalNormal) { +}`;t.code.add(e)}const $6t=Ji(.5,-4e-4);function L6t(t,e){const i=t.vertex;i.include(I6t),i.constants.add("depthBias","vec2",$6t),i.uniforms.add(new cn("inverseViewport",(r,n)=>n.inverseViewport)),e.legacy?(i.uniforms.add(new bs("proj",(r,n)=>n.camera.projectionMatrix)),i.code.add(V`vec2 calculateProjectedBiasXY(vec4 projPos, vec3 globalNormal) { float offsetXY = depthBias.x; vec4 projNormal = proj * localView * vec4(globalNormal, 0.0); return offsetXY * projPos.w * 2.0 * inverseViewport * normalize(projNormal.xyz).xy; -}`)):(i.uniforms.add(new Wm("transformNormalViewFromGlobal",r=>r.transformNormalViewFromGlobal),new _s("transformProjFromView",r=>r.transformProjFromView)),i.code.add(V`vec2 calculateProjectedBiasXY(vec4 projPos, vec3 globalNormal) { +}`)):(i.uniforms.add(new Km("transformNormalViewFromGlobal",r=>r.transformNormalViewFromGlobal),new bs("transformProjFromView",r=>r.transformProjFromView)),i.code.add(V`vec2 calculateProjectedBiasXY(vec4 projPos, vec3 globalNormal) { float offsetXY = depthBias.x; vec4 projNormal = transformProjFromView * vec4(transformNormalViewFromGlobal * globalNormal, 0.0); return offsetXY * projPos.w * 2.0 * inverseViewport * normalize(projNormal.xyz).xy; @@ -5051,7 +5040,7 @@ projPos.xy += offsetXY; } projPos.z += _calculateProjectedBiasZ(projPos); return projPos; -}`)}function FDt(t,e){const i=t.fragment;i.constants.add("coverageTestThreshold","float",.01),e.antialiasing?i.code.add(V`#define discardByCoverage(radius, coverage) { if (coverage < coverageTestThreshold) discard; }`):i.code.add(V`#define discardByCoverage(radius, coverage) { float coverageLimit = radius <= 0.5 ? coverageTestThreshold : 0.75; if (coverage < coverageLimit) discard; }`)}function kDt(t,e){const i=t.vertex;e.silhouette?(i.code.add(V`bool isSilhouetteEdge(vec3 viewDir, vec3 normalA, vec3 normalB) { +}`)}function D6t(t,e){const i=t.fragment;i.constants.add("coverageTestThreshold","float",.01),e.antialiasing?i.code.add(V`#define discardByCoverage(radius, coverage) { if (coverage < coverageTestThreshold) discard; }`):i.code.add(V`#define discardByCoverage(radius, coverage) { float coverageLimit = radius <= 0.5 ? coverageTestThreshold : 0.75; if (coverage < coverageLimit) discard; }`)}function N6t(t,e){const i=t.vertex;e.silhouette?(i.code.add(V`bool isSilhouetteEdge(vec3 viewDir, vec3 normalA, vec3 normalB) { float faceAVisible = dot(viewDir, normalA); float faceBVisible = dot(viewDir, normalB); return faceAVisible * faceBVisible < 0.0; @@ -5075,9 +5064,9 @@ gl_Position = vec4(10.0, 10.0, 10.0, 1.0); return true; }`)):i.code.add(V`bool discardNonSilhouetteEdges(vec3 viewPos, vec3 worldPos) { return false; -}`)}function zDt(t,e){const i=t.vertex;i.include(o0),i.uniforms.add(new ft("distanceFalloffFactor",r=>r.distanceFalloffFactor)),i.code.add(V`float distanceBasedPerspectiveFactor(float distance) { +}`)}function F6t(t,e){const i=t.vertex;i.include(c0),i.uniforms.add(new ft("distanceFalloffFactor",r=>r.distanceFalloffFactor)),i.code.add(V`float distanceBasedPerspectiveFactor(float distance) { return clamp(sqrt(distanceFalloffFactor / distance), 0.0, 1.0); -}`),i.uniforms.add(new $f("componentDataTex",r=>r.componentDataTexture)),t.attributes.add(J.COMPONENTINDEX,"float"),i.constants.add("componentColorFieldOffset","float",0),i.constants.add("componentOtherFieldOffset","float",1),i.constants.add("componentVerticalOffsetFieldOffset","float",2),i.constants.add("componentFieldCount","float",3),i.constants.add("lineWidthFractionFactor","float",8),i.constants.add("extensionLengthOffset","float",128),i.constants.add("verticalOffsetScale","float",2*kce),i.code.add(V`vec2 _componentTextureCoords(float componentIndex, float fieldOffset) { +}`),i.uniforms.add(new kf("componentDataTex",r=>r.componentDataTexture)),t.attributes.add(J.COMPONENTINDEX,"float"),i.constants.add("componentColorFieldOffset","float",0),i.constants.add("componentOtherFieldOffset","float",1),i.constants.add("componentVerticalOffsetFieldOffset","float",2),i.constants.add("componentFieldCount","float",3),i.constants.add("lineWidthFractionFactor","float",8),i.constants.add("extensionLengthOffset","float",128),i.constants.add("verticalOffsetScale","float",2*Jce),i.code.add(V`vec2 _componentTextureCoords(float componentIndex, float fieldOffset) { float fieldIndex = componentFieldCount * componentIndex + fieldOffset; float texSize = float(textureSize(componentDataTex, 0).x); float colIndex = mod(fieldIndex, texSize); @@ -5110,7 +5099,7 @@ return (model * vec4(normal, 0.0)).xyz; } vec3 _modelToViewNormal(vec3 normal) { return (localView * model * vec4(normal, 0.0)).xyz; -}`):(i.uniforms.add(new ML("transformNormalGlobalFromModel",r=>r.transformNormalGlobalFromModel)),i.code.add(V`vec3 _modelToWorldNormal(vec3 normal) { +}`):(i.uniforms.add(new FL("transformNormalGlobalFromModel",r=>r.transformNormalGlobalFromModel)),i.code.add(V`vec3 _modelToWorldNormal(vec3 normal) { return transformNormalGlobalFromModel * normal; }`)),e.silhouette?(t.attributes.add(J.NORMALA,"vec3"),t.attributes.add(J.NORMALB,"vec3"),i.code.add(V`vec3 worldNormal() { return _modelToWorldNormal(normalize(normalA + normalB)); @@ -5119,7 +5108,7 @@ return _modelToWorldNormal(normal); }`)),e.legacy?i.code.add(V`void worldAndViewFromModelPosition(vec3 modelPos, float verticalOffset, out vec3 worldPos, out vec3 viewPos) { worldPos = (model * vec4(modelPos, 1.0)).xyz; viewPos = (localView * vec4(worldPos, 1.0)).xyz; -}`):(i.include(Pae,e),i.uniforms.add(new Wm("transformViewFromCameraRelativeRS",r=>r.transformViewFromCameraRelativeRS),new ML("transformWorldFromModelRS",r=>r.transformWorldFromModelRS),new yp("transformWorldFromModelTL",r=>r.transformWorldFromModelTL),new yp("transformWorldFromModelTH",r=>r.transformWorldFromModelTH),new Oi("transformWorldFromViewTL",r=>r.transformWorldFromViewTL),new Oi("transformWorldFromViewTH",r=>r.transformWorldFromViewTH)),i.code.add(V` +}`):(i.include(jae,e),i.uniforms.add(new Km("transformViewFromCameraRelativeRS",r=>r.transformViewFromCameraRelativeRS),new FL("transformWorldFromModelRS",r=>r.transformWorldFromModelRS),new wp("transformWorldFromModelTL",r=>r.transformWorldFromModelTL),new wp("transformWorldFromModelTH",r=>r.transformWorldFromModelTH),new Oi("transformWorldFromViewTL",r=>r.transformWorldFromViewTL),new Oi("transformWorldFromViewTH",r=>r.transformWorldFromViewTH)),i.code.add(V` void worldAndViewFromModelPosition(vec3 modelPos, float verticalOffset, out vec3 worldPos, out vec3 viewPos) { vec3 rotatedModelPosition = transformWorldFromModelRS * modelPos; @@ -5139,11 +5128,11 @@ viewPos = (localView * vec4(worldPos, 1.0)).xyz; viewPos = transformViewFromCameraRelativeRS * worldPos; } - `)),i.uniforms.add(new _s("transformProjFromView",(r,n)=>n.camera.projectionMatrix)),i.code.add(V`vec4 projFromViewPosition(vec3 position) { + `)),i.uniforms.add(new bs("transformProjFromView",(r,n)=>n.camera.projectionMatrix)),i.code.add(V`vec4 projFromViewPosition(vec3 position) { return transformProjFromView * vec4(position, 1.0); }`),i.code.add(V`float calculateExtensionLength(float extensionLength, float lineLength) { return extensionLength / (log2(max(1.0, 256.0 / lineLength)) * 0.2 + 1.0); -}`)}function UDt(t){return t.mode===da.SKETCH||t.mode===da.MIXED}var da,zS;(function(t){t[t.SOLID=0]="SOLID",t[t.SKETCH=1]="SKETCH",t[t.MIXED=2]="MIXED",t[t.COUNT=3]="COUNT"})(da||(da={})),function(t){t[t.REGULAR=0]="REGULAR",t[t.SILHOUETTE=1]="SILHOUETTE"}(zS||(zS={}));function Xce(t,e){const i=t.vertex;switch(t.attributes.add(J.SIDENESS,"vec2"),e.mode===da.MIXED?i.code.add(V`struct UnpackedAttributes { +}`)}function k6t(t){return t.mode===pa.SKETCH||t.mode===pa.MIXED}var pa,HS;(function(t){t[t.SOLID=0]="SOLID",t[t.SKETCH=1]="SKETCH",t[t.MIXED=2]="MIXED",t[t.COUNT=3]="COUNT"})(pa||(pa={})),function(t){t[t.REGULAR=0]="REGULAR",t[t.SILHOUETTE=1]="SILHOUETTE"}(HS||(HS={}));function lue(t,e){const i=t.vertex;switch(t.attributes.add(J.SIDENESS,"vec2"),e.mode===pa.MIXED?i.code.add(V`struct UnpackedAttributes { vec2 sideness; vec2 sidenessNorm; float lineWidthPixels; @@ -5154,7 +5143,7 @@ vec2 sideness; vec2 sidenessNorm; float lineWidthPixels; float extensionLengthPixels; -};`),e.mode){case da.MIXED:i.code.add(V`UnpackedAttributes unpackAttributes(ComponentData component) { +};`),e.mode){case pa.MIXED:i.code.add(V`UnpackedAttributes unpackAttributes(ComponentData component) { vec2 sidenessNorm = sideness; vec2 sideness = sidenessNorm * 2.0 - 1.0; float fType = component.type; @@ -5164,24 +5153,24 @@ if (fType <= 0.0) { extensionLengthPixels *= variantExtension * 2.0 - 1.0; } return UnpackedAttributes(sideness, sidenessNorm, lineWidth, extensionLengthPixels, fType); -}`);break;case da.SKETCH:i.code.add(V`UnpackedAttributes unpackAttributes(ComponentData component) { +}`);break;case pa.SKETCH:i.code.add(V`UnpackedAttributes unpackAttributes(ComponentData component) { vec2 sidenessNorm = sideness; vec2 sideness = sidenessNorm * 2.0 - 1.0; float extensionLengthPixels = component.extensionLength; extensionLengthPixels *= variantExtension * 2.0 - 1.0; float lineWidth = component.lineWidth; return UnpackedAttributes(sideness, sidenessNorm, lineWidth, extensionLengthPixels); -}`);break;case da.SOLID:i.code.add(V`UnpackedAttributes unpackAttributes(ComponentData component) { +}`);break;case pa.SOLID:i.code.add(V`UnpackedAttributes unpackAttributes(ComponentData component) { vec2 sidenessNorm = sideness; vec2 sideness = sidenessNorm * 2.0 - 1.0; float extensionLengthPixels = component.extensionLength; float lineWidth = component.lineWidth; return UnpackedAttributes(sideness, sidenessNorm, lineWidth, extensionLengthPixels); -}`);break;case da.COUNT:break;default:e.mode}}function VDt(t,e){const i=t.vertex;switch(t.include(Xce,e),e.mode){case da.SOLID:i.code.add(V`float calculateLineAmplitude(UnpackedAttributes unpackedAttributes) { +}`);break;case pa.COUNT:break;default:e.mode}}function z6t(t,e){const i=t.vertex;switch(t.include(lue,e),e.mode){case pa.SOLID:i.code.add(V`float calculateLineAmplitude(UnpackedAttributes unpackedAttributes) { return 0.0; -}`);break;case da.SKETCH:i.uniforms.add(new bT("strokesAmplitude",r=>r.strokesTexture.amplitude)),i.code.add(V`float calculateLineAmplitude(UnpackedAttributes unpackedAttributes) { +}`);break;case pa.SKETCH:i.uniforms.add(new AT("strokesAmplitude",r=>r.strokesTexture.amplitude)),i.code.add(V`float calculateLineAmplitude(UnpackedAttributes unpackedAttributes) { return strokesAmplitude; -}`);break;case da.MIXED:i.uniforms.add(new bT("strokesAmplitude",r=>r.strokesTexture.amplitude)),i.code.add(V`float calculateLineAmplitude(UnpackedAttributes unpackedAttributes) { +}`);break;case pa.MIXED:i.uniforms.add(new AT("strokesAmplitude",r=>r.strokesTexture.amplitude)),i.code.add(V`float calculateLineAmplitude(UnpackedAttributes unpackedAttributes) { float type = unpackedAttributes.type; if (type <= 0.0) { return strokesAmplitude; @@ -5189,23 +5178,23 @@ return strokesAmplitude; else { return 0.0; } -}`)}}function BDt(t,e){t.include(Xce,e);const{vertex:i,fragment:r}=t;switch(UDt(e)&&(i.uniforms.add(new $f("strokesTexture",n=>n.strokesTexture.texture)),i.uniforms.add(new bT("strokesLog2Resolution",n=>Math.log2(n.strokesTexture.resolution)),new bT("strokeVariants",n=>n.strokesTexture.variants)),t.varyings.add("vStrokeUV","vec2"),r.uniforms.add(new $f("strokesTexture",n=>n.strokesTexture.texture),new bT("strokesNormalizationScale",n=>n.strokesTexture.normalizationScale)),i.code.add(V`void calculateStyleOutputsSketch(float lineLength, UnpackedAttributes unpackedAttributes) { +}`)}}function U6t(t,e){t.include(lue,e);const{vertex:i,fragment:r}=t;switch(k6t(e)&&(i.uniforms.add(new kf("strokesTexture",n=>n.strokesTexture.texture)),i.uniforms.add(new AT("strokesLog2Resolution",n=>Math.log2(n.strokesTexture.resolution)),new AT("strokeVariants",n=>n.strokesTexture.variants)),t.varyings.add("vStrokeUV","vec2"),r.uniforms.add(new kf("strokesTexture",n=>n.strokesTexture.texture),new AT("strokesNormalizationScale",n=>n.strokesTexture.normalizationScale)),i.code.add(V`void calculateStyleOutputsSketch(float lineLength, UnpackedAttributes unpackedAttributes) { vec2 sidenessNorm = unpackedAttributes.sidenessNorm; float lineIndex = clamp(ceil(log2(lineLength)), 0.0, strokesLog2Resolution); vStrokeUV = vec2(exp2(lineIndex) * sidenessNorm.y, lineIndex * strokeVariants + variantStroke + 0.5) / vec2(textureSize(strokesTexture, 0)); vStrokeUV.x += variantOffset; -}`),t.fragment.include(o0),r.code.add(V`float calculateLineOffsetSketch() { +}`),t.fragment.include(c0),r.code.add(V`float calculateLineOffsetSketch() { float offsetNorm = rgba2float(texture(strokesTexture, vStrokeUV)); return (offsetNorm - 0.5) * strokesNormalizationScale; } float calculateLinePressureSketch() { return rgba2float(texture(strokesTexture, vStrokeUV + vec2(0.0, 0.5))); -}`)),e.mode){case da.SOLID:i.code.add(V`void calculateStyleOutputs(UnpackedAttributes unpackedAttributes) {}`),r.code.add(V`float calculateLineOffset() { +}`)),e.mode){case pa.SOLID:i.code.add(V`void calculateStyleOutputs(UnpackedAttributes unpackedAttributes) {}`),r.code.add(V`float calculateLineOffset() { return 0.0; } float calculateLinePressure() { return 1.0; -}`);break;case da.SKETCH:i.code.add(V`void calculateStyleOutputs(UnpackedAttributes unpackedAttributes) +}`);break;case pa.SKETCH:i.code.add(V`void calculateStyleOutputs(UnpackedAttributes unpackedAttributes) { calculateStyleOutputsSketch(vLineLengthPixels, unpackedAttributes); }`),r.code.add(V`float calculateLineOffset() { @@ -5213,7 +5202,7 @@ return calculateLineOffsetSketch(); } float calculateLinePressure() { return calculateLinePressureSketch(); -}`);break;case da.MIXED:t.varyings.add("vType","float"),i.code.add(V`void calculateStyleOutputs(UnpackedAttributes unpackedAttributes) +}`);break;case pa.MIXED:t.varyings.add("vType","float"),i.code.add(V`void calculateStyleOutputs(UnpackedAttributes unpackedAttributes) { vType = unpackedAttributes.type; if (unpackedAttributes.type <= 0.0) { @@ -5234,7 +5223,7 @@ return calculateLinePressureSketch(); else { return 1.0; } -}`)}}function ize(t){const e=new Cr,{vertex:i,fragment:r}=e;return t.legacy&&i.uniforms.add(new Owe("model"),new Owe("localView")),e.include(NDt,t),e.include(zDt,t),e.include(VDt,t),e.include(Xce,t),e.include(BDt,t),e.include(oo,t),e.include(kDt,t),e.include(FDt,t),e.include(dd,t),e.varyings.add("vColor","vec4"),e.varyings.add("vRadius","float"),e.varyings.add("vPosition","vec3"),e.varyings.add("vWorldPosition","vec3"),t.multipassEnabled&&e.varyings.add("vViewPos","vec3"),e.varyings.add("vLineLengthPixels","float"),e.varyings.add("vSizeFalloffFactor","float"),i.uniforms.add(new ln("pixelToNDC",(n,s)=>or(jDt,2/s.camera.fullViewport[2],2/s.camera.fullViewport[3])),new gr("viewport",(n,s)=>s.camera.fullViewport),new ft("pixelRatio",(n,s)=>s.camera.pixelRatio)),e.attributes.add(J.POSITION0,"vec3"),e.attributes.add(J.POSITION1,"vec3"),e.attributes.add(J.VARIANTOFFSET,"float"),e.attributes.add(J.VARIANTSTROKE,"float"),e.attributes.add(J.VARIANTEXTENSION,"float"),i.code.add(V` +}`)}}function eze(t){const e=new Ar,{vertex:i,fragment:r}=e;return t.legacy&&i.uniforms.add(new Pwe("model"),new Pwe("localView")),e.include(L6t,t),e.include(F6t,t),e.include(z6t,t),e.include(lue,t),e.include(U6t,t),e.include(ao,t),e.include(N6t,t),e.include(D6t,t),e.include(gd,t),e.varyings.add("vColor","vec4"),e.varyings.add("vRadius","float"),e.varyings.add("vPosition","vec3"),e.varyings.add("vWorldPosition","vec3"),t.multipassEnabled&&e.varyings.add("vViewPos","vec3"),e.varyings.add("vLineLengthPixels","float"),e.varyings.add("vSizeFalloffFactor","float"),i.uniforms.add(new cn("pixelToNDC",(n,s)=>or(V6t,2/s.camera.fullViewport[2],2/s.camera.fullViewport[3])),new gr("viewport",(n,s)=>s.camera.fullViewport),new ft("pixelRatio",(n,s)=>s.camera.pixelRatio)),e.attributes.add(J.POSITION0,"vec3"),e.attributes.add(J.POSITION1,"vec3"),e.attributes.add(J.VARIANTOFFSET,"float"),e.attributes.add(J.VARIANTSTROKE,"float"),e.attributes.add(J.VARIANTEXTENSION,"float"),i.code.add(V` const float opaqueCutoff = 1.0 / 255.0; void calculateGeometricOutputs(vec3 viewPosV0, vec3 viewPosV1, vec3 worldPosV0, vec3 worldPosV1, vec3 worldNormal, UnpackedAttributes unpackedAttributes) { @@ -5312,11 +5301,11 @@ return 1.0; vLineLengthPixels = extendedLineLengthPixels; // discard short edges below a certain length threshold - ${t.mode===da.SKETCH?V` + ${t.mode===pa.SKETCH?V` if (lineLengthPixels <= 3.0) { gl_Position = vec4(10.0, 10.0, 10.0, 1.0); return; - }`:t.mode===da.MIXED?V` + }`:t.mode===pa.MIXED?V` if (lineLengthPixels <= 3.0 && unpackedAttributes.type <= 0.0) { gl_Position = vec4(10.0, 10.0, 10.0, 1.0); return; @@ -5381,7 +5370,7 @@ return 1.0; fragColor = vec4(vColor.rgb, vColor.a * coverage); } - `),e}const jDt=yt();let Owe=class extends Ls{constructor(e){super(e,"mat4")}};const GDt=Object.freeze(Object.defineProperty({__proto__:null,build:ize},Symbol.toStringTag,{value:"Module"}));let rze=class nze extends Hr{initializeProgram(e){return new Ir(e.rctx,nze.shader.get().build(this.configuration),mke)}initializePipeline(e){return e.blendMinMax?Ti({blending:Ol(st.ONE,st.ONE,st.ZERO,st.ONE,Xy.ADD,e.blendMinMax.MAX),depthTest:{func:Zr.LEQUAL},colorWrite:ji}):Ti({depthTest:{func:Zr.LEQUAL},depthWrite:rh,colorWrite:ji})}};rze.shader=new Rr(GDt,()=>we(()=>Promise.resolve().then(()=>KWt),void 0));let G0=class extends hu{constructor(){super(...arguments),this.mode=da.SOLID,this.hasSlicePlane=!1,this.silhouette=!1,this.legacy=!1,this.antialiasing=!1,this.doublePrecisionRequiresObfuscation=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.spherical=!1}};y([fe({count:da.COUNT})],G0.prototype,"mode",void 0),y([fe()],G0.prototype,"hasSlicePlane",void 0),y([fe()],G0.prototype,"silhouette",void 0),y([fe()],G0.prototype,"legacy",void 0),y([fe()],G0.prototype,"antialiasing",void 0),y([fe()],G0.prototype,"doublePrecisionRequiresObfuscation",void 0),y([fe()],G0.prototype,"multipassEnabled",void 0),y([fe()],G0.prototype,"cullAboveGround",void 0),y([fe()],G0.prototype,"spherical",void 0),y([fe({constValue:!1})],G0.prototype,"occlusionPass",void 0);const HDt=8,kY=128,qDt={type:"uber",hasSlicePlane:!1,strokesTexture:null,legacy:!0,spherical:!0},WDt={solid:da.SOLID,sketch:da.SKETCH,uber:da.MIXED};let zY=class sze{constructor(e,i,r){this._rctx=e,this._shaderTechniqueRepository=i,this._configuration=new G0,this.refCount=0,this._renderables=new Set,this._sortedRenderables={[Wi.TRANSPARENT]:{[Wi.TRANSPARENT]:new Pi,[Wi.OPAQUE]:new Pi},[Wi.OPAQUE]:{[Wi.TRANSPARENT]:new Pi,[Wi.OPAQUE]:new Pi}},this._renderablesDirty=!1,this._drawParameters=new $Dt,this._settings={...qDt,...r},this.key=sze.getKey(this._settings.type,this._settings.hasSlicePlane,this._settings.legacy);const n=this._settings.strokesTexture.variants;this.writerSettings={variants:n,reducedPrecision:Tn.TESTS_DISABLE_OPTIMIZATIONS},this._configuration.legacy=this._settings.legacy,this._configuration.mode=WDt[this._settings.type],this._configuration.silhouette=!1,this._configuration.antialiasing=!!this._rctx.capabilities.blendMinMax,this._configuration.hasSlicePlane=this._settings.hasSlicePlane,this._configuration.doublePrecisionRequiresObfuscation=e.driverTest.doublePrecisionRequiresObfuscation.result,this._configuration.spherical=r.spherical}dispose(){this._technique=ir(this._technique)}addRenderable(e){this._renderables.add(e),this._renderablesDirty=!0}removeRenderable(e){this._renderables.delete(e),this._renderablesDirty=!0}setRenderablesDirty(){this._renderablesDirty=!0}forEachRenderable(e,i){this._renderablesDirty&&this._sortRenderables();const r=this._sortedRenderables[i];r[Wi.TRANSPARENT].forAll(e),r[Wi.OPAQUE].forAll(e)}updateTechnique(e,i){return this._configuration.multipassEnabled=!!e.multipassEnabled,this._configuration.cullAboveGround=!!e.multipassTerrain.cullAboveGround,this._configuration.silhouette=i,this._technique=this._shaderTechniqueRepository.releaseAndAcquire(rze,this._configuration,this._technique),this._technique}bindRegularEdges(e,i){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(i,!1),e,i)}bindSilhouetteEdges(e,i){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(i,!0),e,i)}renderRegularEdges(e,i,r,n,s){this._render(e,i,i.regular.vao,r,n,s)}renderSilhouetteEdges(e,i,r,n,s){this._render(e,i,i.silhouette.vao,r,n,s)}_render(e,i,r,n,s,o){o>0&&(this._bindDraw(e,i,n,s),this._rctx.bindVAO(r),this._rctx.drawArraysInstanced(sr.TRIANGLE_FAN,0,4,o))}_bindDraw(e,i,r,n){if(this._drawParameters.componentDataTexture=i.components.buffer.textureBuffer.texture,this._drawParameters.strokesTexture=this._settings.strokesTexture,"origin"in i.transform)this._lastOriginId!==i.transform.origin.origin.id&&(e.setUniformMatrix4fv("localView",i.transform.origin.viewMatrix),this._lastOriginId=i.transform.origin.origin.id),e.setUniformMatrix4fv("model",i.transform.modelMatrix),this._drawParameters.slicePlaneLocalOrigin=i.transform.origin.origin.vec3;else{const s=new PG(i.transform.position),o=Xf(Pwe,_E(Pwe,i.transform.rotationScale));this._drawParameters.transformWorldFromModelTL=s.low,this._drawParameters.transformWorldFromModelTH=s.high,this._drawParameters.transformWorldFromModelRS=i.transform.rotationScale,this._drawParameters.transformNormalGlobalFromModel=o;const l=n.camera.viewInverseTransposeMatrix;Ie(this._drawParameters.slicePlaneLocalOrigin,l[3],l[7],l[11])}e.bindDraw(this._drawParameters,n,r)}_sortRenderables(){this._renderablesDirty=!1,this._sortedRenderables[Wi.TRANSPARENT][Wi.TRANSPARENT].clear(),this._sortedRenderables[Wi.TRANSPARENT][Wi.OPAQUE].clear(),this._sortedRenderables[Wi.OPAQUE][Wi.TRANSPARENT].clear(),this._sortedRenderables[Wi.OPAQUE][Wi.OPAQUE].clear(),this._renderables.forEach(i=>{i.objectTransparency!==Wi.INVISIBLE&&i.edgeTransparency!==Wi.INVISIBLE&&this._sortedRenderables[i.objectTransparency][i.edgeTransparency].push(i)});const e=(i,r)=>"origin"in i.transform?"origin"in r.transform?i.transform.origin.origin.idr.transform.origin.origin.id?1:0:1:0;this._sortedRenderables[Wi.TRANSPARENT][Wi.TRANSPARENT].sort(e),this._sortedRenderables[Wi.TRANSPARENT][Wi.OPAQUE].sort(e),this._sortedRenderables[Wi.OPAQUE][Wi.TRANSPARENT].sort(e),this._sortedRenderables[Wi.OPAQUE][Wi.OPAQUE].sort(e)}static getKey(e,i,r){return`edges-t:${e}:${i}:${r}`}};const Pwe=Tc();function Yfi(t,e){return e.push(t.buffer),{buffer:t.buffer,layout:new k1t(t.layout)}}function A8(t){return new pLe(t.layout).createView(t.buffer)}let YDt=class extends tFe{constructor(e){super("EdgeProcessingWorker","extract",{extract:i=>[i.dataBuffer],extractComponentsEdgeLocations:i=>[i.dataBuffer],extractEdgeLocations:i=>[i.dataBuffer]},e)}async process(e,i,r){if(r)return f6t(e);const n=await this.invoke(new UY(e),i);return this._unpackOutput(n)}async extractEdgeLocations(e,i){const r=await this.invokeMethod("extractEdgeLocations",new UY(e),i);return A8(r)}async extractComponentsEdgeLocations(e,i){const r=await this.invokeMethod("extractComponentsEdgeLocations",new UY(e),i);return A8(r)}_unpackOutput(e){return{regular:{instancesData:A8(e.regular.instancesData),lodInfo:{lengths:new Float32Array(e.regular.lodInfo.lengths)}},silhouette:{instancesData:A8(e.silhouette.instancesData),lodInfo:{lengths:new Float32Array(e.silhouette.lodInfo.lengths)}},averageEdgeLength:e.averageEdgeLength}}},UY=class{constructor(e){this.dataBuffer=e.data.buffer,this.writerSettings=e.writerSettings,this.skipDeduplicate=e.skipDeduplicate,this.indices=zf(e.indices)?e.indices:e.indices.buffer,this.indicesType=zf(e.indices)?"Array":HV(e.indices)?"Uint32Array":"Uint16Array",this.indicesLength=e.indicesLength}};function XDt(t){const i=LR.resolution,r=i/2,n=new Uint8Array(4*i*i),s=4*i*r,o=LR.amplitude,l=2*o,c=4*i,f=Math.log2(i)+1,_=LR.strokes.length;let x=(f-1)*_*c;for(const{distance:A,pressure:M}of LR.strokes){let I=A,L=M,F=x;for(let z=0;z0}function KDt(t){return t.size*t.color[3]>0}function Nwe(t,e,i,r){for(let n=0;nthis._discardObjectEntry(e)),this._perObjectData.clear(),this._strokesTexture=Kt(this._strokesTexture),this._componentColorManager=et(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject=Kt(this._verticesBufferObject),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",rNt))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,i,r,n,s,o,l,c){if(this.hasObject(e))return this.getObjectMemoryUsage(e);let f;const _=new kwe(new Promise(T=>f=T),r.center,r.radius);this._perObjectData.set(e,_);const x=await this._updatingHandles.addPromise(this._addComponentGeometry(i,_,n,s,o,l,c));return this.setNeedsRender(),f(),x}async addOrUpdateObject3D(e,i,r,n){if(this.destroyed)return void Ce.getLogger(this).warn("Attempt to add an object to a destroyed instance");const s=this._perObjectData.get(e);let o;(s==null?void 0:s.renderables.length)>0&&this._perObjectDataEvictionCache.add(s);const l=e.boundingVolumeWorldSpace.bounds,c=new kwe(new Promise(_=>o=_),l,Zv(l));this._perObjectData.set(e,c);const f=new Array;if(r.mergeGeometries&&e.geometries.length>1&&QDt(e))f.push(this._addObjectMergedGeometries(e,c,i,r,n));else for(let _=0;_1)return!1;const[s]=n,o=s.transform;if(!(o instanceof VY))return!1;const[l]=r;if(l.localOrigin!==o.origin.origin)return!1;const c=Qe(),f=this._computeModelTransformWithLocalOrigin(e,l,c);return s.transform=new VY(c,f),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.renderables.length&&(e.renderables.forEach(i=>this._removeRenderable(i)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._perObjectData.has(e)}async updateAllComponentOpacities(e,i){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(r==null)return;const n=i instanceof Array?s=>i[s]:()=>i;r.renderables.forEach(s=>{const o=s.components.meta.length;for(let l=0;lr+n.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,i,r,n){const s=e instanceof X_,o=!!r.hasSlicePlane,l=$we(i),c=zY.getKey(l,o,s),f=await this._updatingHandles.addPromise(this._getObjectEntry(e));f!=null&&(f.renderables.forEach(_=>{if(c!==_.rendererKey){const x=this._renderers.get(_.rendererKey),T=this._acquireRenderer(l,o,s);x.removeRenderable(_),--x.refCount,_.rendererKey=c,T.addRenderable(_)}for(let x=0;x{const s=n.components.meta;for(let o=0;on.visible=i),this.setNeedsRender())}removeObject(e){const i=this._perObjectData.get(e);i&&(this._perObjectData.delete(e),this._discardObjectEntry(i))}async _getObjectEntry(e){const i=this._perObjectData.get(e);if(!i)throw new Error("no object");return await i.loaded,i.loaded==null?null:i}render(e,i){if(this._componentColorManager==null)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,n=W(),s=new PG;let o=0,l=0;if(this._renderers.forEach(f=>{if(f.refCount===0)return this._renderers.delete(f.key),void f.dispose();let _=!0,x=!0;f.forEachRenderable(T=>{T.visible&&(o+=T.statistics.averageEdgeLength,l++,_&&T.regular&&(f.updateTechnique(e,!1),_=!1),x&&T.silhouette&&(f.updateTechnique(e,!0),x=!1))},i)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),l===0)return;const c=new IDt(40*o/l,i);Ie(n,r[3],r[7],r[11]),s.set(n),Ne(c.transformWorldFromViewTH,s.high),Ne(c.transformWorldFromViewTL,s.low),Yf(c.transformViewFromCameraRelativeRS,e.camera.viewMatrix),Xf(Bwe,c.transformViewFromCameraRelativeRS),_E(c.transformNormalViewFromGlobal,Bwe),c.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach(f=>{this._renderRegularEdges(f,e,c),this._renderSilhouetteEdges(f,e,c)})}_updateTransparency(e){const i=Lwe(e.components.meta),r=Dwe(e.components.meta);i===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=i,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,i,r){e.getCombinedShaderTransformation(i,r);const n=i.localOrigin!=null?this._localOrigins.register(i.localOrigin):this._localOrigins.acquire(Ie(this._tmpModelPosition,r[12],r[13],r[14]));return i.localOrigin=n.origin,MDt(n.origin.vec3,r),n}_updateComponentBuffer(e){const{meta:i,buffer:r}=e,n=new Uint8Array(4);for(let s=0;sthis._verticesBufferObject!=null?new tNt(new qm(this.rctx,mke,{vertices:r6t,instances:_===zS.REGULAR?gV.glLayout:yV.glLayout},{vertices:this._verticesBufferObject,instances:Yr.createVertex(this.rctx,Pr.STATIC_DRAW,_===zS.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)}),_===zS.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo):null,l=e.regular.lodInfo.lengths.length>0?o(zS.REGULAR):null,c=e.silhouette.lodInfo.lengths.length>0?o(zS.SILHOUETTE):null,f=((l==null?void 0:l.vao.usedMemory)??0)+((c==null?void 0:c.vao.usedMemory)??0);return new iNt(l,c,{gpuMemoryUsage:f,externalMemoryUsage:s,averageEdgeLength:e.averageEdgeLength},r,Lwe(i.meta),Dwe(i.meta),i,n)}async _addGeometry(e,i,r,n,s,o){if(r.edgeIndicesLength<=0)return;const l=r.attributes.get(J.POSITION),c=Qe(),f=this._computeModelTransformWithLocalOrigin(e,r,c),_=new Vwe(l,c,f);return this._addPositionData(i,_,r.edgeIndicesLength,n,s,o)}async _addPositionData(e,i,r,n,s,o=!1){if(e.loaded==null)return;const l=this._createComponentBuffers([n]);if(l==null)return;const c=this._acquireRenderer(n.type,!!s.hasSlicePlane,!0),{modelTransform:f,origin:_}=i,x=i.position.indices,T=i.position,A=T.data.length/T.size,M=fV.createBuffer(A);for(let F=0;F{if(k.edgeIndicesLength<=0||!k.material.supportsEdges)return!1;!c&&k.localOrigin&&(c=k);const U=k.attributes.get(J.POSITION);return f+=U.data.length/U.size,l+=k.edgeIndicesLength,!0});if(_.length===0)return;const x=f>=65536?Uint32Array:Uint16Array,T=l?new x(l):null,A=[];let M=0;_.forEach(k=>{const U=k.attributes.get(J.POSITION),j=U.indices;let H=o.get(U.data);if(H==null){H=A.length/3;for(let Y=0;Y{xn(n,o.center,i);const l=Ve(n,r),c=o.radius,f=l<-c?1/0:l_.distanceToCamera=f)};this._perObjectData.forEach(s),this._perObjectDataEvictionCache.forEach(s)}_renderRegularEdges(e,i,r){const n=e.bindRegularEdges(r,i),s=r.transparency,o=i.camera.perScreenPixelRatio;e.forEachRenderable(l=>{if(!zwe(l)||!l.visible)return;const c=M8(l.regular.lod.lengths,l.distanceToCamera,o);e.renderRegularEdges(n,l,r,i,c)},s)}_renderSilhouetteEdges(e,i,r){const n=e.bindSilhouetteEdges(r,i),s=r.transparency,o=i.camera.perScreenPixelRatio;e.forEachRenderable(l=>{if(!Uwe(l)||!l.visible)return;const c=M8(l.silhouette.lod.lengths,l.distanceToCamera,o);e.renderSilhouetteEdges(n,l,r,i,c)},s)}get test(){return{hasRenderedPrimitives:e=>{let i=!1;const r=e.perScreenPixelRatio,n=(s,o)=>s.forEachRenderable(l=>{l.visible&&!i&&(zwe(l)&&(i=M8(l.regular.lod.lengths,l.distanceToCamera,r)>0),!i&&Uwe(l)&&(i=M8(l.silhouette.lod.lengths,l.distanceToCamera,r)>0))},o);return this._renderers.forEach(s=>{i||(n(s,Wi.OPAQUE),n(s,Wi.TRANSPARENT))}),i},getObjectData:e=>this._perObjectData.get(e)}}};function Fwe(t){t!=null&&(t.vao.vertexBuffers.instances.dispose(),t.vao.disposeVAOOnly(),t.vao=null)}function QDt(t){let e=null,i=null;for(let r=0;r{this.loaded!=null&&(this.loaded=!0)})}},eNt=class{constructor(e,i){this.buffer=e,this.meta=i}},tNt=class{constructor(e,i){this.vao=e,this.lod=i}},VY=class{constructor(e,i){this.modelMatrix=e,this.origin=i}};class iNt{constructor(e,i,r,n,s,o,l,c){this.regular=e,this.silhouette=i,this.statistics=r,this.transform=n,this.edgeTransparency=s,this.objectTransparency=o,this.components=l,this.rendererKey=c,this.distanceToCamera=0,this.visible=!0}}function zwe(t){return t.regular!=null}function Uwe(t){return t.silhouette!=null}function M8(t,e,i){const r=e*i,n=D3e(t,r,!0);return n===-1?rPromise.reject();function Ym(t){return window.WebGL2RenderingContext&&t instanceof window.WebGL2RenderingContext}let jwe=class{constructor(e,i,r,n,s,o,l,c,f){this.createQuery=e,this.deleteQuery=i,this.resultAvailable=r,this.getResult=n,this.disjoint=s,this.beginTimeElapsed=o,this.endTimeElapsed=l,this.createTimestamp=c,this.timestampBits=f}},sv=!1;function nNt(t,e){if(e.disjointTimerQuery)return null;let i=t.getExtension("EXT_disjoint_timer_query_webgl2");return i&&Ym(t)?new jwe(()=>t.createQuery(),r=>{t.deleteQuery(r),sv=!1},r=>t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),r=>t.getQueryParameter(r,t.QUERY_RESULT),()=>t.getParameter(i.GPU_DISJOINT_EXT),r=>{sv||(sv=!0,t.beginQuery(i.TIME_ELAPSED_EXT,r))},()=>{t.endQuery(i.TIME_ELAPSED_EXT),sv=!1},r=>i.queryCounterEXT(r,i.TIMESTAMP_EXT),()=>t.getQuery(i.TIMESTAMP_EXT,i.QUERY_COUNTER_BITS_EXT)):(i=t.getExtension("EXT_disjoint_timer_query"),i?new jwe(()=>i.createQueryEXT(),r=>{i.deleteQueryEXT(r),sv=!1},r=>i.getQueryObjectEXT(r,i.QUERY_RESULT_AVAILABLE_EXT),r=>i.getQueryObjectEXT(r,i.QUERY_RESULT_EXT),()=>t.getParameter(i.GPU_DISJOINT_EXT),r=>{sv||(sv=!0,i.beginQueryEXT(i.TIME_ELAPSED_EXT,r))},()=>{i.endQueryEXT(i.TIME_ELAPSED_EXT),sv=!1},r=>i.queryCounterEXT(r,i.TIMESTAMP_EXT),()=>i.getQueryEXT(i.TIMESTAMP_EXT,i.QUERY_COUNTER_BITS_EXT)):null)}function sNt(t,e){const i=t.capabilities.disjointTimerQuery;return i==null?null:new oNt(i,e)}let oNt=class{constructor(e,i){this._timer=e,this._queryPool=new Array,this._queryResults=new Map,this._currentQuery=null,i.forEach(r=>{const n=this._timer.createQuery(),s=this._timer.createQuery();this._queryPool.push(n,s),this._queryResults.set(r,null)})}start(){sv||(this._currentQuery=this._queryPool.pop(),this._currentQuery!=null&&(this._timer.disjoint(),this._timer.beginTimeElapsed(this._currentQuery)))}stop(e){if(this._timer.disjoint()||this._currentQuery==null||!this._queryResults.has(e))return this.abort(),null;this._timer.endTimeElapsed();const i=this._queryResults.get(e);if(i==null)return this._queryResults.set(e,this._currentQuery),this._currentQuery=null,null;if(!this._timer.resultAvailable(i))return this._queryPool.unshift(this._currentQuery),this._currentQuery=null,null;const r=this._timer.getResult(i)/1e6;return this._queryPool.unshift(i),this._queryResults.set(e,this._currentQuery),this._currentQuery=null,r}abort(){this._currentQuery!=null&&(this._timer.deleteQuery(this._currentQuery),this._queryPool.unshift(this._timer.createQuery()),this._currentQuery=null)}dispose(){this._currentQuery!=null&&this._timer.deleteQuery(this._currentQuery),this._queryPool.forEach(e=>{this._timer.deleteQuery(e)}),this._queryResults.forEach(e=>{e!=null&&this._timer.deleteQuery(e)})}};var Gn;(function(t){t.OVERLAY="overlay",t.PREPARE="prepare",t.SHADOW_MAP="shadow map",t.LINEAR_DEPTH="linear depth",t.ACCUMULATED_SHADOWS="accumulated shadows",t.OBJECT_AND_LAYER_ID_COLOR="object/layer id color",t.SSAO="SSAO",t.OPAQUE="opaque",t.OPAQUE_EDGES="opaque edges",t.VOXEL="voxel",t.TRANSPARENT="transparent",t.TRANSPARENT_EDGES="transparent edges",t.HUD_VISIBILITY="HUD visibility",t.TRANSPARENT_TERRAIN="transparent terrain",t.ENVIRONMENT="environment",t.LASER_LINES="laser lines",t.OCCLUDED="occluded",t.ANTIALIASING="antialiasing",t.HIGHLIGHTS="highlights",t.HUD="HUD",t.HUD_OCCLUDED="HUD occluded",t.FINISH="finish"})(Gn||(Gn={}));const Gwe="Total";let aNt=class{constructor(e){this._rctx=e,this._startTimeStampCPU=0,this._lastTimeStampCPU=0,this._totalCPUTime=new zv(Gwe),this._cpuTimeSamplers=new Map(Object.values(Gn).map(i=>[i,new zv(i)])),this._enableGPUTimer=0,this._totalGPUTime=new zv("GPU"),this._gpuTimeSamplers=new Map(Object.values(Gn).map(i=>[i,new zv(i)])),this._totalTime=0,this._totalFrameCount=0}get totalCPUTimeSampler(){return this._totalCPUTime}get cpuTimeSamplers(){return Array.from(this._cpuTimeSamplers.values())}get totalGPUTimeSampler(){return this._totalGPUTime}get gpuTimeSamplers(){return Array.from(this._gpuTimeSamplers.values())}get gpuSamplingEnabled(){return this._gpuTimerPool!=null}get totalTime(){return this._totalTime}get totalFrameCount(){return this._totalFrameCount}get elapsedTime(){return performance.now()-this._startTimeStampCPU}enableGPUPerformanceInfo(){if(this._gpuTimerPool==null){const i=[...Object.values(Gn),Gwe];this._gpuTimerPool=sNt(this._rctx,i)}if(this._gpuTimerPool==null)return{hasGPUTimerSupport:!1,remove:()=>{}};++this._enableGPUTimer;let e=!1;return{hasGPUTimerSupport:!0,remove:()=>{e||(e=!0,--this._enableGPUTimer,this._enableGPUTimer===0&&(this._gpuTimerPool=Kt(this._gpuTimerPool)))}}}startFrame(){this._startTimeStampCPU=this._lastTimeStampCPU=performance.now(),this._gpuTimerPool&&this._gpuTimerPool.start()}advance(e){const i=performance.now();if(this._cpuTimeSamplers.get(e).record(i-this._lastTimeStampCPU),this._lastTimeStampCPU=i,this._gpuTimerPool){const r=this._gpuTimerPool.stop(e);this._gpuTimeSamplers.get(e).record(r),this._gpuTimerPool.start()}}finishFrame(){if(this._gpuTimerPool){const i=this._gpuTimerPool.stop(Gn.FINISH);this._gpuTimeSamplers.get(Gn.FINISH).record(i),this._rctx.gl.flush()}const e=performance.now()-this._startTimeStampCPU;this._totalTime=this._totalTime+e,this._totalCPUTime.record(e),this._gpuTimerPool&&this._totalGPUTime.record(this.gpuTimeSamplers.reduce((i,r)=>i+(r.last||0),0)),++this._totalFrameCount}},Ld=class extends ze{get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,i=!Le("disable-feature:high-quality-idle")){this._renderStateFeatures=Gq(i,e),this.notifyChange("_renderStateFeatures"),this._renderPlugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,i=this._state){return this._renderStateFeatures.get(i,e)??!1}setFeatureEnabled(e,i,r){this._renderStateFeatures.set(i,e,r),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(Zo.HighQualityTransparency)}get hasReflections(){return this.hasWater&&(this._ssrEnabled||this.isFeatureEnabled(Zo.WaterReflection))}get hasDecorations(){return this._materialRenderersHas.decorations||this._renderPlugins.hasDecorations}get hasHighlights(){return this._materialRenderersHas.highlights||this._renderPlugins.produces(ke.OPAQUE_MATERIAL,ue.Highlight)||this._renderPlugins.produces(ke.DRAPED_MATERIAL,ue.Highlight)}get hasShadowHighlights(){return this._materialRenderersHas.highlights||this._renderPlugins.produces(ke.OPAQUE_MATERIAL,ue.ShadowHighlight)}get _magnifierEnabled(){return this._bindParameters.decorations===Xh.ON&&this._magnifierHelper.enabled}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(Zo.HighResolutionAtmosphere)}get hasWater(){return this._materialRenderersHas.water||this._hasOverlayWater}constructor(e,i,r,n,s,o,l,c){super({}),this._stage=e,this._techniqueRepository=n,this._rctx=s,this._compositingHelper=o,this._magnifierHelper=l,this._requestRender=c,this._materialRenderers=new Pi,this._needsTransparentPass=!1,this._materialRenderersHas={hudElements:!1,highlights:!1,water:!1,decorations:!1,occludees:!1},this._hasOverlayWater=!1,this.renderOverlay=f=>{},this._isRendering=!1,this._backgroundColor=Mi(0,0,0,1),this._sliceHelper=new ADt,this._state=Vr.IDLE,this._highQualityTransparencyEnabled=!0,this._terrainTransparency=ru.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new dDt,this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new X6t,this._releaseGeometryLinearDepth=f=>f==null?void 0:f.release(),this._geometryLinearDepthFormat=la.DEPTH16_BUFFER,this.fboCache=new vyt(s),this._renderStateFeatures=Gq(!Le("disable-feature:high-quality-idle"),e.view.qualityProfile),this._offscreen=new vDt(this.fboCache,this._compositingHelper),this.performanceInfo=new aNt(this._rctx),this._shadowMap=new Xle(this.fboCache,e.viewingMode),this._highlight=new EI({view:e.view}),this._shadowHighlight=new QA({view:e.view,viewingMode:e.viewingMode}),this._shadowAccumulator=new Pu(this.fboCache,n,e,f=>{const _=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(f.camera,f.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=_},(f,_,x)=>{f.shadowMap.start(f.camera,_,x,!0,this._stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(ue.Shadow,f.shadowMap),f.shadowMap.finish(),f.camera.setGLViewport(this._rctx),this._prepare(f.camera,f.contentCamera)},c),this._ssao=new uI({view:this._stage.view}),this._renderContext=new WEt(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._renderPlugins=new bk({renderContext:this._renderContext,techniqueRepository:n,textureRepository:r,materialRepository:i,requestRender:c,controller:e,fbos:this.fboCache,isFeatureEnabled:f=>this.isFeatureEnabled(f)}),this.renderPassManager=new ire,this._renderPlugins.add(this.renderPassManager),this._smaa=new sS({view:this._stage.view}),this._renderPlugins.add(this._smaa),this._blit=new KA({opacity:1,alphaMode:yc.None}),this._renderPlugins.add(this._blit),this._renderPlugins.add(this._ssao),this._renderPlugins.add(this._highlight),this._renderPlugins.add(this._shadowHighlight),this.addHandles([_e(()=>this._stage.view.state.camera,()=>c(),kt),_e(()=>Tn.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,f=>{this._renderHiddenTransparentEdges=f?()=>this._renderEdges(Wi.TRANSPARENT):()=>{},c()},ii),_e(()=>{var f;return(f=this._stage.view.environment.background)==null?void 0:f.color},f=>{const _=f?AL(f):gp;rs(this._backgroundColor,_[0]*_[3],_[1]*_[3],_[2]*_[3],_[3]),c()},kt)])}normalizeCtorArgs(){return{}}destroy(){this._smaa.destroy(),this._blit.destroy(),this._gpuTimerHandle=en(this._gpuTimerHandle),this._materialRenderers.forAll(e=>e.dispose()),this._materialRenderers.clear(),this._offscreen.dispose(),this._shadowMap.dispose(),this._ssao.destroy(),this._highlight.dispose(),this._shadowHighlight.destroy(),this._shadowAccumulator.dispose(),this._edgeView=et(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),_Le.prune()}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=ir(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.linearDepth=ir(this._bindParameters.multipassTerrain.linearDepth),this._bindParameters.multipassGeometry.linearDepth=ir(this._bindParameters.multipassGeometry.linearDepth)}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.linearDepth=ir(this._bindParameters.linearDepth),this._bindParameters.hudVisibility=ir(this._bindParameters.hudVisibility)}get updating(){return this._smaa.updating||this._edgeView!=null&&this._edgeView.updating||this._shadowAccumulator.running||this._renderPlugins.updating||!this.isCameraFinal}ensureEdgeView(){if(this._edgeView==null){const e=this._stage.view.resourceController;this._edgeView=new H0({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:lNt(e)}),this.addHandles(_e(()=>{var i;return(i=this._edgeView)==null?void 0:i.updating},()=>this._requestRender(),Li)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return CB(this._bindParameters.ssr.reprojectionMatrix,gs)}set _reprojectionMatrix(e){jre(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){var e;return!!((e=this._shadowMap)!=null&&e.enabled)}setParameters(e){var n;const{_shadowMap:i,_bindParameters:r}=this;if(((n=e.qualitySettings)==null?void 0:n.reflections)!==void 0&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),e.shadowMap!==void 0&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowMapMaxCascades!==void 0&&i.maxCascades!==e.shadowMapMaxCascades&&(i.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment!=null){e.environment.weather!=null&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const s=e.environment.lighting.type!=="virtual";r.enableFillLights!==s&&(r.enableFillLights=s,this._requestRender())}e.highQualityTransparency!==void 0&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),e.hasOverlayWater!==void 0&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),e.slicePlane!==void 0&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),e.terrainTransparency!==void 0&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),e.shadowCastOptions!==void 0&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,i){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:n,updates:s}=e;if(r.length===0&&n.length===0&&s.length===0)return;const o=NNe(e);let l=!1;o.forEach((c,f)=>{if(i.done)return;let _=this._materialRenderers.find(x=>x.material===f);if(_==null&&c.adds.length>0){const x=new A$({material:f});x.initializeRenderContext(this._renderPlugins._context),_=x,this._materialRenderers.push(_)}_&&(_.modify(c),_.isEmpty&&(l=!0)),c.removes.forEach(x=>e.removes.removeUnordered(x)),c.adds.forEach(x=>e.adds.removeUnordered(x)),c.updates.forEach(x=>e.updates.removeUnordered(x)),i.madeProgress()}),l&&this._materialRenderers.filterInPlace(c=>!c.isEmpty||(c.dispose(),!1)),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const e=this._materialRenderersHas;e.decorations=!1,e.highlights=!1,e.hudElements=!1,e.water=!1,e.occludees=!1,this._materialRenderers.forAll(i=>{e.highlights||(e.highlights=i.hasHighlights),e.occludees||(e.occludees=i.hasOccludees),e.water||(e.water=i.hasWater),e.decorations||(e.decorations=i.isDecoration),e.hudElements||(e.hudElements=i.material.produces(ke.LINE_CALLOUTS_HUD_DEPTH,ue.Color)||i.material.produces(ke.HUD_MATERIAL,ue.Color)||i.material.produces(ke.LABEL_MATERIAL,ue.Color))}),this._bindParameters.hasOccludees=e.occludees}updateAnimation(e){const i=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll(r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==i&&(this._gpuTimerHandle=i?en(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,i,r,n,s){const o=e!=null;this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.frame(),this._disposeBindBuffers();const l=this._offscreen,{camera:c,contentCamera:f,mode:_,alignPixelEnabled:x}=r;this._state=_,this._bindParameters.overlay=this.renderOverlay(s),this.performanceInfo.advance(Gn.OVERLAY),this._renderContext.time=s,this._bindParameters.transparencyPassType=Jt.NONE,this._bindParameters.alignPixelEnabled=x,this._bindParameters.decorations=n;const T=U_(this._sliceHelper.plane);n===Xh.OFF&&(this._sliceHelper.plane=null),c.setGLViewport(this._rctx);const A=l.initializeFrame(c,this._backgroundColor,o);this.hasReflections?this._bindParameters.ssr.lastFrameColor=A:A==null||A.release(),this._prepare(c,f),this._renderPlugins.prepareRender(),this.performanceInfo.advance(Gn.PREPARE);const M=this._computeDepthRange(c);this._renderShadowMap(c,this._bindParameters.lighting.mainLight.direction,M),this.performanceInfo.advance(Gn.SHADOW_MAP),this._ensureBindParameters(c,f);const I=this._renderPlugins.produces(ke.OPAQUE_TERRAIN)&&(this._terrainTransparency===ru.Semitransparent||this._terrainTransparency===ru.TransparentWithDraped),L=this._highQualityTransparency&&I,F=this._needsTransparentPass||this._renderPlugins.produces(ke.TRANSPARENT_MATERIAL);this._prepareShaders(L,F),this._renderLinearDepth(),this.performanceInfo.advance(Gn.LINEAR_DEPTH),this._renderShadowAccumulation(M,c,f),this.performanceInfo.advance(Gn.ACCUMULATED_SHADOWS),this._ensureBindParametersSSR(s),this._renderSSAO(),this.performanceInfo.advance(Gn.SSAO),this._renderContext.output=ue.Color,l.bindFbo(),this._renderOpaqueGeometry(),this._renderPlugins.render(ke.ENVIRONMENT_OPAQUE),this.performanceInfo.advance(Gn.OPAQUE),this._renderTerrainLinearDepth(L),this._setMultipassTerrain(L),this._renderEdges(Wi.OPAQUE),this.performanceInfo.advance(Gn.OPAQUE_EDGES),l.bindFbo(),this._renderPlugins.render(ke.VOXEL),this.performanceInfo.advance(Gn.VOXEL),this._renderHiddenTransparentEdges(),F&&(this._oitEnabled?this._renderOITPass(jM.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(Gn.TRANSPARENT);const z=this._renderGeometryLinearDepth(L);this._renderHUDVisibility(z),L||this._renderInternalSlot(ke.LINE_CALLOUTS),this.performanceInfo.advance(Gn.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(i),this.performanceInfo.advance(Gn.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(Wi.TRANSPARENT,z),this._releaseGeometryLinearDepth(z),this.performanceInfo.advance(Gn.TRANSPARENT_EDGES);const k=I?this._renderTransparentTerrain():null;k&&this._bindParameters.hudVisibility&&(L?this._renderLineCallouts(Ih.Occluded):l.compositeToHUDVisibility(this._bindParameters,k.colorTexture),this._renderHUD(Ih.Occluded,l.color),this.performanceInfo.advance(Gn.HUD_OCCLUDED)),this.performanceInfo.advance(Gn.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),k&&(l.compositeToFramebuffer(this._bindParameters,k.colorTexture,yc.PremultipliedAlpha,1),k.release(),L&&(this._renderEdges(Wi.OPAQUE),this.performanceInfo.advance(Gn.OPAQUE_EDGES),F&&(this._oitEnabled?this._renderOITPass(jM.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(Gn.TRANSPARENT),this._renderEdges(Wi.TRANSPARENT),this.performanceInfo.advance(Gn.TRANSPARENT_EDGES))),this._bindParameters.ssao=ir(this._bindParameters.ssao),L&&this._renderLineCallouts(Ih.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),l.bindFbo(),this._renderInternalSlot(ke.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderPlugins.render(ke.ENVIRONMENT_TRANSPARENT),this.performanceInfo.advance(Gn.ENVIRONMENT),this._renderLaserlines(),this.performanceInfo.advance(Gn.LASER_LINES),this._renderOccluded(),this.performanceInfo.advance(Gn.OCCLUDED);const U=this._magnifierEnabled&&e==null?this.fboCache.acquire(xr.RGBA,this._offscreen.width,this._offscreen.height):null,j=this._renderComposite(U??e,this._offscreen.color)??e;this.performanceInfo.advance(Gn.ANTIALIASING),this._renderHUD(Ih.NotOccluded,j),this.performanceInfo.advance(Gn.HUD),this._renderHighlights(j,this._bindParameters),this.performanceInfo.advance(Gn.HIGHLIGHTS),this._magnifierEnabled&&this._magnifierHelper.render(this._rctx,this._bindParameters),j!==e&&(this._rctx.bindFramebuffer(e==null?void 0:e.fbo),this._compositingHelper.composite(this._bindParameters,U==null?void 0:U.colorTexture,yc.None)),U!==e&&(U==null||U.release()),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=T,this._isRendering=!1,this.performanceInfo.finishFrame(),o&&(this._releaseFBOs(),this._disposeOffscreenBuffers())}_prepareShaders(e,i){this._renderContext.output=ue.Color,this._prepareOpaqueGeometrySlots(),this._setMultipassTerrain(e),this._renderPlugins.prepare(ke.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._prepareInternalSlots(this._materialRenderers,ke.LINE_CALLOUTS),i&&this._prepareTransparencySlots(),this._prepareInternalSlots(this._materialRenderers,ke.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderPlugins.prepare(ke.ENVIRONMENT_TRANSPARENT),this._renderPlugins.prepare(ke.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(e){if(e==null||!Le("enable-feature:objectAndLayerId-rendering"))return;const i=this._renderContext.output;this._rctx.bindFramebuffer(e.fbo),this._offscreen.renderToFBO(()=>this._renderAllGeometry(ue.ObjectAndLayerIdColor),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e.fbo),this._offscreen.renderToFBO(()=>{this._bindParameters.hudRenderStyle=Ih.NotOccluded,this._renderInternalSlot(ke.HUD_MATERIAL)},void 0,!0,!0),this._renderContext.output=i}finish(e){this._hasAnimations||this._animationTimestep.clear();const i=this.performanceInfo.gpuSamplingEnabled,r=e===no.BACKGROUND;if(r||i){const n=r?this.performanceInfo.elapsedTime:0,s=i?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),o=Math.max(n,s);this._animationTimestep.frame(o,r)}}readDepthPixels(e,i,r){var l;const n=(l=this._bindParameters.linearDepth)==null?void 0:l.fbo;if(n!=null&&n.colorTexture)return void n.readPixels(i[0],i[1],i[2],i[3],ci.RGBA,ga.UNSIGNED_BYTE,r);const s=this.fboCache.acquire(xr.RGBA,this._offscreen.width,this._offscreen.height).acquireDepth(la.DEPTH16_BUFFER);this._rctx.bindFramebuffer(s.fbo),this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const o=In.COLOR_BUFFER_BIT|In.DEPTH_BUFFER_BIT|In.STENCIL_BUFFER_BIT;this._rctx.clearSafe(o),this._renderAllGeometry(ue.Depth),s.fbo.readPixels(i[0],i[1],i[2],i[3],ci.RGBA,ga.UNSIGNED_BYTE,r),s.release()}readHUDVisibility(e,i,r,n,s){var o;(o=this._bindParameters.hudVisibility)==null||o.fbo.readPixels(e,i,r,n,ci.RGBA,ga.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e,i){const r=this._edgeView;if(r!=null&&r.shouldRender()){const{width:n,height:s,depth:o}=this._offscreen,l=this.fboCache.acquire(xr.RGBA,n,s),c=()=>r.render(this._bindParameters,e);this._offscreen.renderToTargets(c,l,i??o,Hwe),this._offscreen.compositeToFramebuffer(this._bindParameters,l.colorTexture,yc.Alpha,1),l.release()}}_renderShadowMap(e,i,r){const n=this._shadowMap;n.enabled&&(n.start(e,i,r,this.isFeatureEnabled(Zo.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(e,i),this._needsShadowHighlight?(this._renderShadowCascades(ue.ShadowHighlight,this._shadowMap),n.moveSnapshot(I5.Highlight),n.clear(),this._renderShadowCascades(ue.ShadowExcludeHighlight,this._shadowMap),n.copySnapshot(I5.Default),this._renderShadowCascades(ue.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(ue.Shadow),n.finish(),e.setGLViewport(this._rctx))}_renderShadowCascades(e,i=this._shadowMap){for(const r of i.cascades)r.camera.setGLViewport(this._rctx),this._prepare(r.camera,r.camera),this._renderAllGeometry(e)}get _needsLinearDepth(){return this._renderPlugins.consumes(ue.Depth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?(this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,()=>this._renderAllGeometry(ue.Depth),[0,0,0,0],xr.RGBA,la.DEPTH_STENCIL_BUFFER),this._bindParameters.linearDepth.releaseDepth(),this._offscreen.bindFbo()):this._bindParameters.linearDepth=ir(this._bindParameters.linearDepth)}_renderTerrainLinearDepth(e){if(e){const i=this._renderContext.output;this._renderContext.output=ue.Depth,this._bindParameters.multipassTerrain.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassTerrain.linearDepth,()=>this._renderTransparentTerrain(),[-1e10,-1e10,-1e10,1]),this._bindParameters.multipassTerrain.linearDepth.releaseDepth(),this._renderContext.output=i}else this._bindParameters.multipassTerrain.linearDepth=ir(this._bindParameters.multipassTerrain.linearDepth)}_renderGeometryLinearDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.linearDepth=ir(this._bindParameters.multipassGeometry.linearDepth));const i=this._renderContext.output;return this._bindParameters.multipassGeometry.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassGeometry.linearDepth,()=>this._renderOpaqueGeometryAndTransparentMaterial(ue.Depth),[1,1,1,1],xr.RGBA,this._geometryLinearDepthFormat),this._renderContext.output=i,this._bindParameters.multipassGeometry.linearDepth.detachDepth()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return Xie;const i=I6t(e,this._materialRenderers,this._stage.layers);return N5(i,this._renderPlugins.queryDepthRange(e)),i.near=Math.max(e.near,i.near),i.far=Math.min(e.far,i.far),i}_renderAllGeometry(e){this._renderContext.output=e,this._renderPlugins.prepare(ke.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._renderPlugins.prepare(ke.TRANSPARENT_MATERIAL),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderSSAO(){if(!this._renderPlugins.produces(ke.SSAO))return;const e=this._offscreen.renderToCachedFBO(null,()=>this._renderAllGeometry(ue.Normal),[0,0,0,0],xr.RGBA4,la.DEPTH24_BUFFER);e.releaseDepth(),this._offscreen.bindFbo(),this._pluginInput.normal=e,this._bindParameters.ssao=this._renderPlugins.render(ke.SSAO,this._pluginInput),e.release()}_prepareOpaqueGeometrySlots(){this._renderPlugins.prepare(ke.INTEGRATED_MESH),this._renderPlugins.prepare(ke.OPAQUE_TERRAIN),this._renderPlugins.prepare(ke.OPAQUE_MATERIAL),this._renderPlugins.prepare(ke.ENVIRONMENT_OPAQUE),this._prepareInternalSlots(this._materialRenderers,ke.OPAQUE_MATERIAL)}_renderOpaqueGeometry(){this._renderPlugins.render(ke.INTEGRATED_MESH),this._renderPlugins.render(ke.OPAQUE_TERRAIN),this._renderInternalSlot(ke.OPAQUE_MATERIAL),this._renderPlugins.render(ke.OPAQUE_MATERIAL)}_renderTransparentMaterial(){this._renderInternalSlot(ke.TRANSPARENT_MATERIAL),this._renderPlugins.render(ke.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){if(!this._renderPlugins.produces(ke.TRANSPARENT_TERRAIN))return;const e=()=>this._renderPlugins.render(ke.TRANSPARENT_TERRAIN,null);if(this._renderContext.output!==ue.Color)return void e();const{width:i,height:r,depth:n}=this._offscreen,s=this.fboCache.acquire(xr.RGBA,i,r);return this._offscreen.renderToTargets(e,s,n,[0,0,0,0]),s}_renderHUDVisibility(e){this._shouldRenderInternalSlot(this._materialRenderers,ke.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,()=>this._renderInternalSlot(ke.OCCLUSION_PIXELS),e),this._offscreen.bindFbo()):this._bindParameters.hudVisibility=ir(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===Ih.Occluded){const i=()=>this._renderInternalSlot(ke.LINE_CALLOUTS),{width:r,height:n,color:s}=this._offscreen,o=this.fboCache.acquireDepth(la.DEPTH16_BUFFER,r,n);this._offscreen.renderToTargets(i,s,o,void 0,!0,!0),o.release()}else this._renderInternalSlot(ke.LINE_CALLOUTS)}_renderLaserlines(){if(this._renderPlugins.render(ke.LASERLINES),this._renderPlugins.produces(ke.LASERLINES_CONTRAST_CONTROL)){const e=this._offscreen,{width:i,height:r,depth:n}=e,s=this.fboCache.acquire(xr.RGBA,i,r),o=()=>this._renderPlugins.render(ke.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(o,s,n,Hwe),e.compositeToFramebuffer(this._bindParameters,s.colorTexture,yc.PremultipliedAlpha,1),s.release()}}_renderHUD(e,i){if(this._materialRenderersHas.hudElements)if(this._oitEnabled){const r=this._renderOITPass(jM.HUD,e);this._rctx.bindFramebuffer(i==null?void 0:i.fbo),this._compositingHelper.composite(this._bindParameters,r.colorTexture,yc.PremultipliedAlpha),r.release()}else if(e===Ih.Occluded){const r=()=>this._renderHUDElements(e),{width:n,height:s,color:o}=this._offscreen,l=this.fboCache.acquireDepth(la.DEPTH16_BUFFER,n,s);this._offscreen.renderToTargets(r,o,l,void 0,!0,!0),l.release()}else this._rctx.bindFramebuffer(null),i==null||i.acquireDepth(la.DEPTH16_BUFFER),this._rctx.bindFramebuffer(i==null?void 0:i.fbo),this._renderHUDElements(e),i==null||i.releaseDepth()}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._prepareInternalSlots(this._materialRenderers,ke.LINE_CALLOUTS_HUD_DEPTH,ke.HUD_MATERIAL,ke.LABEL_MATERIAL),this._renderInternalSlot(ke.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(ke.HUD_MATERIAL),this._renderInternalSlot(ke.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._renderPlugins.produces(ke.SHADOW_HIGHLIGHT)&&this.hasShadowHighlights}_renderHighlights(e,i){if(!this.hasHighlights||i.decorations===Xh.OFF)return;const r=()=>{this._renderAllGeometry(ue.Highlight),this._rctx.clearSafe(In.DEPTH_BUFFER_BIT),this._renderHUDElements(Ih.Both)},n=this._offscreen.renderToCachedFBO(null,r,[0,0,0,0],xr.RGBA4,la.DEPTH_STENCIL_BUFFER);n.releaseDepth(),this._needsShadowHighlight&&(this._pluginInput.highlight=n,this._renderPlugins.render(ke.SHADOW_HIGHLIGHT,this._pluginInput,e)),this._renderPlugins.produces(ke.HIGHLIGHT)&&(this._pluginInput.composite=null,this._pluginInput.normal=null,this._pluginInput.highlight=n,this._renderPlugins.render(ke.HIGHLIGHT,this._pluginInput,e)),n.release()}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,i,r){var n;this._needsShadowCast&&((n=this._bindParameters.linearDepth)!=null&&n.colorTexture)&&this._shadowAccumulator.renderAccumulation(this._bindParameters.linearDepth,e,i,r)}_prepareTransparencySlots(){this._renderContext.output=ue.Alpha,this._bindParameters.transparencyPassType=Jt.Alpha,this._prepareInternalSlots(this._materialRenderers,ke.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(ke.TRANSPARENT_MATERIAL),this._renderContext.output=ue.Color,this._bindParameters.transparencyPassType=Jt.Color,this._prepareInternalSlots(this._materialRenderers,ke.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(ke.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=Jt.FrontFace,this._prepareInternalSlots(this._materialRenderers,ke.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(ke.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=Jt.NONE}_renderOITPass(e,i=Ih.Both){const r=e===jM.HUD,n=r?this.fboCache.acquire(xr.RGBA,this._offscreen.width,this._offscreen.height):null,s=r?()=>this._renderHUDElements(i):()=>this._renderTransparentMaterial(),o=this._renderContext.output;this._renderContext.output=ue.Alpha,this._bindParameters.transparencyPassType=Jt.Alpha;const l=this._offscreen.renderOITPass(s,Jt.Alpha,r);this._renderContext.output=ue.Color,this._bindParameters.transparencyPassType=Jt.Color;const c=this._offscreen.renderOITPass(s,Jt.Color,r);this._bindParameters.transparencyPassType=Jt.FrontFace;const f=this._offscreen.renderOITPass(s,Jt.FrontFace,r);return this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,c,l,f,n),n==null||n.releaseDepth(),f.release(),c.release(),l.release(),this._bindParameters.transparencyPassType=Jt.NONE,this._renderContext.output=o,n}_renderOccluded(){let e=0;Cd.clear(),this._materialRenderers.forAll(o=>{o.material&&o.material.isVisible()&&o.material.parameters.renderOccluded===Wn.OccludeAndTransparentStencil&&(e|=o.material.parameters.renderOccluded,Cd.push(o))});const i=this._offscreen,r=(o,l,c,f,_)=>{if(!(e&l))return;const{width:x,height:T,depth:A}=i,M=this.fboCache.acquire(xr.RGBA,x,T);i.renderToTargets(c,M,A,[0,0,0,0],f,_),i.compositeToFramebuffer(this._bindParameters,M.colorTexture,yc.PremultipliedAlpha,o),M.release()};Cd.length!==0&&(this._prepareInternalSlots(Cd,ke.OCCLUDER_MATERIAL,ke.TRANSPARENT_OCCLUDER_MATERIAL),this._renderInternalSlot(ke.OCCLUDER_MATERIAL,Cd),r(.5,Wn.OccludeAndTransparentStencil,()=>this._renderInternalSlot(ke.TRANSPARENT_OCCLUDER_MATERIAL,Cd),!1,!1)),Cd.clear(),this._materialRenderers.forAll(o=>{o.material&&o.material.isVisible()&&(o.material.parameters.renderOccluded===Wn.OccludeAndTransparent||o.material.parameters.renderOccluded===Wn.Transparent||o.material.parameters.renderOccluded===Wn.Opaque)&&(e|=o.material.parameters.renderOccluded,Cd.push(o))});const n=this._renderPlugins.renderOccludedFlags;if(e|=n,!e)return;const s=o=>{this._renderContext.renderOccludedMask=o,this._prepareInternalSlots(Cd,ke.OPAQUE_MATERIAL,ke.TRANSPARENT_MATERIAL,ke.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),n>Wn.Occlude&&this._renderPlugins.render(ke.OCCLUDED_TERRAIN),this._renderInternalSlot(ke.OPAQUE_MATERIAL,Cd),this._renderInternalSlot(ke.TRANSPARENT_MATERIAL,Cd),this._renderInternalSlot(ke.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Cd),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=ue.Color,r(.5,Wn.OccludeAndTransparent,()=>s(Wn.OccludeAndTransparent),!0,Zu.OutlineVisualElementMask),r(.5,Wn.Transparent,()=>s(Wn.Transparent),!0,Zu.OutlineVisualElementMask),r(1,Wn.Opaque,()=>s(Wn.Opaque),!0,Zu.OutlineVisualElementMask),Cd.clear()}_renderComposite(e,i){this._renderPlugins.consumes(ue.CompositeColor)&&(this._pluginInput.composite=i);let r=null;const n=this._renderPlugins.produces(ke.COMPOSITE);n&&(r=this._renderPlugins.renderComposition(ke.COMPOSITE,this._pluginInput),this._pluginInput.composite=r);const s=this._renderPlugins.produces(ke.ANTIALIASING),o=this._renderPlugins.render(s?ke.ANTIALIASING:ke.BLIT,this._pluginInput,e);return n&&(r==null||r.release()),o}_prepare(e,i){this._needsTransparentPass=this._materialRenderers.some(r=>r.material.produces(ke.TRANSPARENT_MATERIAL,ue.Color)),this._bindParameters.camera=e,this._bindParameters.contentCamera=i}_ensureBindParameters(e,i){this._bindParameters.camera=e,this._bindParameters.contentCamera=i;const r=this._renderContext.offscreenRenderingHelper;this._bindParameters.mainColor=r.colorTexture,this._bindParameters.mainDepth=r.depthTexture}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){this._ssrEnableTime==null&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=gs:(Vo(Wwe,this._bindParameters.camera.viewMatrix),Vo(qwe,this._bindParameters.camera.projectionMatrix),nn(jC,Wwe,qwe),nn(jC,this._renderContext.lastFrameCamera.viewMatrix,jC),nn(jC,this._renderContext.lastFrameCamera.projectionMatrix,jC),this._reprojectionMatrix=jC);const i=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=i>0?Math.min(i,e-this._ssrEnableTime)/i:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=gs,this._ssrEnableTime=null}_shouldRenderInternalSlot(e,i){return this._bindParameters.slot=i,e.some(r=>r.prepareTechnique(this._renderContext)!=null)}_prepareInternalSlots(e,...i){for(const r of i)this._bindParameters.slot=r,e.forAll(n=>n.prepareTechnique(this._renderContext)!=null)}_renderInternalSlot(e,i=this._materialRenderers){this._bindParameters.slot=e,i.forAll(r=>{const n=r.prepareTechnique(this._renderContext);n&&r.renderNode(this._renderContext,n)})}get memoryInfo(){return{fbos:this.fboCache.usedMemory,vaos:this._materialRenderers.reduce((e,i)=>e+i.usedMemory,0),plugins:this._renderPlugins.usedMemory}}getMemoryForMaterial(e){if(e==null)return 0;const i=this._materialRenderers.find(r=>r.material===e);return(i==null?void 0:i.usedMemory)??0}get usedMemory(){var e;return this.fboCache.usedMemory+(((e=this.edgeView)==null?void 0:e.usedMemory)??0)+this._renderPlugins.usedMemory}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=Gq(),this._renderPlugins.renderFeatureChanged(),this._requestRender()},releaseGeometryLinearDepth(i){e._releaseGeometryLinearDepth=i??(r=>r==null?void 0:r.release()),e._geometryLinearDepthFormat=i?la.DEPTH_STENCIL_TEXTURE:la.DEPTH16_BUFFER},getFramebufferTexture:i=>{var r,n;switch(i){case GM.Color:return e._offscreen.colorTexture;case GM.LinearDepth:return(r=e._bindParameters.linearDepth)==null?void 0:r.colorTexture;case GM.ShadowMap:return e._shadowMap.depthTexture;case GM.HudVisibility:return(n=e._bindParameters.hudVisibility)==null?void 0:n.colorTexture}}}}};var jM,GM;y([w()],Ld.prototype,"_renderPlugins",void 0),y([w()],Ld.prototype,"_shadowAccumulator",void 0),y([w()],Ld.prototype,"_state",void 0),y([w()],Ld.prototype,"_renderStateFeatures",void 0),y([w({readOnly:!0})],Ld.prototype,"fullResolutionAtmosphere",null),y([w()],Ld.prototype,"_smaa",void 0),y([w()],Ld.prototype,"_blit",void 0),y([w({autoDestroy:!0})],Ld.prototype,"_edgeView",void 0),y([w()],Ld.prototype,"updating",null),y([w()],Ld.prototype,"isCameraFinal",null),Ld=y([Z("esri.views.3d.webgl-engine.lib.Renderer")],Ld),function(t){t[t.Geometry=0]="Geometry",t[t.HUD=1]="HUD"}(jM||(jM={})),function(t){t[t.Color=0]="Color",t[t.LinearDepth=1]="LinearDepth",t[t.ShadowMap=2]="ShadowMap",t[t.HudVisibility=3]="HudVisibility"}(GM||(GM={}));const Hwe=[0,0,0,0],Cd=new Pi,qwe=Qe(),Wwe=Qe(),jC=Qe();function lNt(t){return e=>t.immediate.schedule(e)}let cNt=class{constructor(e){this._rctx=e,this._vao=wyt(e)}destroy(){this._vao=Kt(this._vao)}draw(){this._vao!=null&&(this._rctx.bindVAO(this._vao),this._rctx.drawArrays(sr.TRIANGLES,0,3))}get test(){var e,i,r,n;return{cachedWebGLObjects:BY((e=this._vao)==null?void 0:e.glName)+BY((r=(i=this._vao)==null?void 0:i.indexBuffer)==null?void 0:r.glName)+BY((n=this._vao)==null?void 0:n.vertexBuffers.geometry)}}};function BY(t){return t!=null?1:0}let aze=class lze{constructor(e){this._rctx=e,this._indexBuffer=this._createIndexbuffer(),this._program=this._createHelperProgram()}static getShaderSources(){return{vertex:`#version 300 es + `),e}const V6t=yt();let Pwe=class extends Ds{constructor(e){super(e,"mat4")}};const B6t=Object.freeze(Object.defineProperty({__proto__:null,build:eze},Symbol.toStringTag,{value:"Module"}));let tze=class ize extends Hr{initializeProgram(e){return new $r(e.rctx,ize.shader.get().build(this.configuration),pke)}initializePipeline(e){return e.blendMinMax?Ti({blending:Pl(ot.ONE,ot.ONE,ot.ZERO,ot.ONE,i1.ADD,e.blendMinMax.MAX),depthTest:{func:Zr.LEQUAL},colorWrite:ji}):Ti({depthTest:{func:Zr.LEQUAL},depthWrite:sh,colorWrite:ji})}};tze.shader=new Ir(B6t,()=>we(()=>Promise.resolve().then(()=>LXt),void 0));let W0=class extends pu{constructor(){super(...arguments),this.mode=pa.SOLID,this.hasSlicePlane=!1,this.silhouette=!1,this.legacy=!1,this.antialiasing=!1,this.doublePrecisionRequiresObfuscation=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.spherical=!1}};y([fe({count:pa.COUNT})],W0.prototype,"mode",void 0),y([fe()],W0.prototype,"hasSlicePlane",void 0),y([fe()],W0.prototype,"silhouette",void 0),y([fe()],W0.prototype,"legacy",void 0),y([fe()],W0.prototype,"antialiasing",void 0),y([fe()],W0.prototype,"doublePrecisionRequiresObfuscation",void 0),y([fe()],W0.prototype,"multipassEnabled",void 0),y([fe()],W0.prototype,"cullAboveGround",void 0),y([fe()],W0.prototype,"spherical",void 0),y([fe({constValue:!1})],W0.prototype,"occlusionPass",void 0);const j6t=8,YY=128,G6t={type:"uber",hasSlicePlane:!1,strokesTexture:null,legacy:!0,spherical:!0},H6t={solid:pa.SOLID,sketch:pa.SKETCH,uber:pa.MIXED};let XY=class rze{constructor(e,i,r){this._rctx=e,this._shaderTechniqueRepository=i,this._configuration=new W0,this.refCount=0,this._renderables=new Set,this._sortedRenderables={[Wi.TRANSPARENT]:{[Wi.TRANSPARENT]:new Pi,[Wi.OPAQUE]:new Pi},[Wi.OPAQUE]:{[Wi.TRANSPARENT]:new Pi,[Wi.OPAQUE]:new Pi}},this._renderablesDirty=!1,this._drawParameters=new R6t,this._settings={...G6t,...r},this.key=rze.getKey(this._settings.type,this._settings.hasSlicePlane,this._settings.legacy);const n=this._settings.strokesTexture.variants;this.writerSettings={variants:n,reducedPrecision:En.TESTS_DISABLE_OPTIMIZATIONS},this._configuration.legacy=this._settings.legacy,this._configuration.mode=H6t[this._settings.type],this._configuration.silhouette=!1,this._configuration.antialiasing=!!this._rctx.capabilities.blendMinMax,this._configuration.hasSlicePlane=this._settings.hasSlicePlane,this._configuration.doublePrecisionRequiresObfuscation=e.driverTest.doublePrecisionRequiresObfuscation.result,this._configuration.spherical=r.spherical}dispose(){this._technique=ir(this._technique)}addRenderable(e){this._renderables.add(e),this._renderablesDirty=!0}removeRenderable(e){this._renderables.delete(e),this._renderablesDirty=!0}setRenderablesDirty(){this._renderablesDirty=!0}forEachRenderable(e,i){this._renderablesDirty&&this._sortRenderables();const r=this._sortedRenderables[i];r[Wi.TRANSPARENT].forAll(e),r[Wi.OPAQUE].forAll(e)}updateTechnique(e,i){return this._configuration.multipassEnabled=!!e.multipassEnabled,this._configuration.cullAboveGround=!!e.multipassTerrain.cullAboveGround,this._configuration.silhouette=i,this._technique=this._shaderTechniqueRepository.releaseAndAcquire(tze,this._configuration,this._technique),this._technique}bindRegularEdges(e,i){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(i,!1),e,i)}bindSilhouetteEdges(e,i){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(i,!0),e,i)}renderRegularEdges(e,i,r,n,s){this._render(e,i,i.regular.vao,r,n,s)}renderSilhouetteEdges(e,i,r,n,s){this._render(e,i,i.silhouette.vao,r,n,s)}_render(e,i,r,n,s,o){o>0&&(this._bindDraw(e,i,n,s),this._rctx.bindVAO(r),this._rctx.drawArraysInstanced(sr.TRIANGLE_FAN,0,4,o))}_bindDraw(e,i,r,n){if(this._drawParameters.componentDataTexture=i.components.buffer.textureBuffer.texture,this._drawParameters.strokesTexture=this._settings.strokesTexture,"origin"in i.transform)this._lastOriginId!==i.transform.origin.origin.id&&(e.setUniformMatrix4fv("localView",i.transform.origin.viewMatrix),this._lastOriginId=i.transform.origin.origin.id),e.setUniformMatrix4fv("model",i.transform.modelMatrix),this._drawParameters.slicePlaneLocalOrigin=i.transform.origin.origin.vec3;else{const s=new UG(i.transform.position),o=Qf(Rwe,EE(Rwe,i.transform.rotationScale));this._drawParameters.transformWorldFromModelTL=s.low,this._drawParameters.transformWorldFromModelTH=s.high,this._drawParameters.transformWorldFromModelRS=i.transform.rotationScale,this._drawParameters.transformNormalGlobalFromModel=o;const a=n.camera.viewInverseTransposeMatrix;Ie(this._drawParameters.slicePlaneLocalOrigin,a[3],a[7],a[11])}e.bindDraw(this._drawParameters,n,r)}_sortRenderables(){this._renderablesDirty=!1,this._sortedRenderables[Wi.TRANSPARENT][Wi.TRANSPARENT].clear(),this._sortedRenderables[Wi.TRANSPARENT][Wi.OPAQUE].clear(),this._sortedRenderables[Wi.OPAQUE][Wi.TRANSPARENT].clear(),this._sortedRenderables[Wi.OPAQUE][Wi.OPAQUE].clear(),this._renderables.forEach(i=>{i.objectTransparency!==Wi.INVISIBLE&&i.edgeTransparency!==Wi.INVISIBLE&&this._sortedRenderables[i.objectTransparency][i.edgeTransparency].push(i)});const e=(i,r)=>"origin"in i.transform?"origin"in r.transform?i.transform.origin.origin.idr.transform.origin.origin.id?1:0:1:0;this._sortedRenderables[Wi.TRANSPARENT][Wi.TRANSPARENT].sort(e),this._sortedRenderables[Wi.TRANSPARENT][Wi.OPAQUE].sort(e),this._sortedRenderables[Wi.OPAQUE][Wi.TRANSPARENT].sort(e),this._sortedRenderables[Wi.OPAQUE][Wi.OPAQUE].sort(e)}static getKey(e,i,r){return`edges-t:${e}:${i}:${r}`}};const Rwe=Mc();function tmi(t,e){return e.push(t.buffer),{buffer:t.buffer,layout:new Fyt(t.layout)}}function L8(t){return new cLe(t.layout).createView(t.buffer)}let q6t=class extends K7e{constructor(e){super("EdgeProcessingWorker","extract",{extract:i=>[i.dataBuffer],extractComponentsEdgeLocations:i=>[i.dataBuffer],extractEdgeLocations:i=>[i.dataBuffer]},e)}async process(e,i,r){if(r)return d9t(e);const n=await this.invoke(new ZY(e),i);return this._unpackOutput(n)}async extractEdgeLocations(e,i){const r=await this.invokeMethod("extractEdgeLocations",new ZY(e),i);return L8(r)}async extractComponentsEdgeLocations(e,i){const r=await this.invokeMethod("extractComponentsEdgeLocations",new ZY(e),i);return L8(r)}_unpackOutput(e){return{regular:{instancesData:L8(e.regular.instancesData),lodInfo:{lengths:new Float32Array(e.regular.lodInfo.lengths)}},silhouette:{instancesData:L8(e.silhouette.instancesData),lodInfo:{lengths:new Float32Array(e.silhouette.lodInfo.lengths)}},averageEdgeLength:e.averageEdgeLength}}},ZY=class{constructor(e){this.dataBuffer=e.data.buffer,this.writerSettings=e.writerSettings,this.skipDeduplicate=e.skipDeduplicate,this.indices=Gf(e.indices)?e.indices:e.indices.buffer,this.indicesType=Gf(e.indices)?"Array":iB(e.indices)?"Uint32Array":"Uint16Array",this.indicesLength=e.indicesLength}};function W6t(t){const i=HR.resolution,r=i/2,n=new Uint8Array(4*i*i),s=4*i*r,o=HR.amplitude,a=2*o,c=4*i,p=Math.log2(i)+1,_=HR.strokes.length;let x=(p-1)*_*c;for(const{distance:C,pressure:M}of HR.strokes){let P=C,$=M,F=x;for(let z=0;z0}function Z6t(t){return t.size*t.color[3]>0}function Fwe(t,e,i,r){for(let n=0;nthis._discardObjectEntry(e)),this._perObjectData.clear(),this._strokesTexture=Kt(this._strokesTexture),this._componentColorManager=et(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject=Kt(this._verticesBufferObject),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",tDt))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,i,r,n,s,o,a,c){if(this.hasObject(e))return this.getObjectMemoryUsage(e);let p;const _=new zwe(new Promise(S=>p=S),r.center,r.radius);this._perObjectData.set(e,_);const x=await this._updatingHandles.addPromise(this._addComponentGeometry(i,_,n,s,o,a,c));return this.setNeedsRender(),p(),x}async addOrUpdateObject3D(e,i,r,n){if(this.destroyed)return void Ce.getLogger(this).warn("Attempt to add an object to a destroyed instance");const s=this._perObjectData.get(e);let o;(s==null?void 0:s.renderables.length)>0&&this._perObjectDataEvictionCache.add(s);const a=e.boundingVolumeWorldSpace.bounds,c=new zwe(new Promise(_=>o=_),a,r_(a));this._perObjectData.set(e,c);const p=new Array;if(r.mergeGeometries&&e.geometries.length>1&&J6t(e))p.push(this._addObjectMergedGeometries(e,c,i,r,n));else for(let _=0;_1)return!1;const[s]=n,o=s.transform;if(!(o instanceof JY))return!1;const[a]=r;if(a.localOrigin!==o.origin.origin)return!1;const c=Qe(),p=this._computeModelTransformWithLocalOrigin(e,a,c);return s.transform=new JY(c,p),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.renderables.length&&(e.renderables.forEach(i=>this._removeRenderable(i)),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._perObjectData.has(e)}async updateAllComponentOpacities(e,i){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(r==null)return;const n=i instanceof Array?s=>i[s]:()=>i;r.renderables.forEach(s=>{const o=s.components.meta.length;for(let a=0;ar+n.statistics.gpuMemoryUsage,0):0}async updateAllComponentMaterials(e,i,r,n){const s=e instanceof eb,o=!!r.hasSlicePlane,a=Lwe(i),c=XY.getKey(a,o,s),p=await this._updatingHandles.addPromise(this._getObjectEntry(e));p!=null&&(p.renderables.forEach(_=>{if(c!==_.rendererKey){const x=this._renderers.get(_.rendererKey),S=this._acquireRenderer(a,o,s);x.removeRenderable(_),--x.refCount,_.rendererKey=c,S.addRenderable(_)}for(let x=0;x{const s=n.components.meta;for(let o=0;on.visible=i),this.setNeedsRender())}removeObject(e){const i=this._perObjectData.get(e);i&&(this._perObjectData.delete(e),this._discardObjectEntry(i))}async _getObjectEntry(e){const i=this._perObjectData.get(e);if(!i)throw new Error("no object");return await i.loaded,i.loaded==null?null:i}render(e,i){if(this._componentColorManager==null)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,n=W(),s=new UG;let o=0,a=0;if(this._renderers.forEach(p=>{if(p.refCount===0)return this._renderers.delete(p.key),void p.dispose();let _=!0,x=!0;p.forEachRenderable(S=>{S.visible&&(o+=S.statistics.averageEdgeLength,a++,_&&S.regular&&(p.updateTechnique(e,!1),_=!1),x&&S.silhouette&&(p.updateTechnique(e,!0),x=!1))},i)}),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),a===0)return;const c=new P6t(40*o/a,i);Ie(n,r[3],r[7],r[11]),s.set(n),Ne(c.transformWorldFromViewTH,s.high),Ne(c.transformWorldFromViewTL,s.low),Kf(c.transformViewFromCameraRelativeRS,e.camera.viewMatrix),Qf(jwe,c.transformViewFromCameraRelativeRS),EE(c.transformNormalViewFromGlobal,jwe),c.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach(p=>{this._renderRegularEdges(p,e,c),this._renderSilhouetteEdges(p,e,c)})}_updateTransparency(e){const i=Dwe(e.components.meta),r=Nwe(e.components.meta);i===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=i,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,i,r){e.getCombinedShaderTransformation(i,r);const n=i.localOrigin!=null?this._localOrigins.register(i.localOrigin):this._localOrigins.acquire(Ie(this._tmpModelPosition,r[12],r[13],r[14]));return i.localOrigin=n.origin,C6t(n.origin.vec3,r),n}_updateComponentBuffer(e){const{meta:i,buffer:r}=e,n=new Uint8Array(4);for(let s=0;sthis._verticesBufferObject!=null?new Q6t(new Jm(this.rctx,pke,{vertices:t9t,instances:_===HS.REGULAR?yV.glLayout:vV.glLayout},{vertices:this._verticesBufferObject,instances:Yr.createVertex(this.rctx,Rr.STATIC_DRAW,_===HS.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)}),_===HS.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo):null,a=e.regular.lodInfo.lengths.length>0?o(HS.REGULAR):null,c=e.silhouette.lodInfo.lengths.length>0?o(HS.SILHOUETTE):null,p=((a==null?void 0:a.vao.usedMemory)??0)+((c==null?void 0:c.vao.usedMemory)??0);return new eDt(a,c,{gpuMemoryUsage:p,externalMemoryUsage:s,averageEdgeLength:e.averageEdgeLength},r,Dwe(i.meta),Nwe(i.meta),i,n)}async _addGeometry(e,i,r,n,s,o){if(r.edgeIndicesLength<=0)return;const a=r.attributes.get(J.POSITION),c=Qe(),p=this._computeModelTransformWithLocalOrigin(e,r,c),_=new Bwe(a,c,p);return this._addPositionData(i,_,r.edgeIndicesLength,n,s,o)}async _addPositionData(e,i,r,n,s,o=!1){if(e.loaded==null)return;const a=this._createComponentBuffers([n]);if(a==null)return;const c=this._acquireRenderer(n.type,!!s.hasSlicePlane,!0),{modelTransform:p,origin:_}=i,x=i.position.indices,S=i.position,C=S.data.length/S.size,M=mV.createBuffer(C);for(let F=0;F{if(k.edgeIndicesLength<=0||!k.material.supportsEdges)return!1;!c&&k.localOrigin&&(c=k);const U=k.attributes.get(J.POSITION);return p+=U.data.length/U.size,a+=k.edgeIndicesLength,!0});if(_.length===0)return;const x=p>=65536?Uint32Array:Uint16Array,S=a?new x(a):null,C=[];let M=0;_.forEach(k=>{const U=k.attributes.get(J.POSITION),j=U.indices;let G=o.get(U.data);if(G==null){G=C.length/3;for(let Y=0;Y{Sn(n,o.center,i);const a=Ve(n,r),c=o.radius,p=a<-c?1/0:a_.distanceToCamera=p)};this._perObjectData.forEach(s),this._perObjectDataEvictionCache.forEach(s)}_renderRegularEdges(e,i,r){const n=e.bindRegularEdges(r,i),s=r.transparency,o=i.camera.perScreenPixelRatio;e.forEachRenderable(a=>{if(!Uwe(a)||!a.visible)return;const c=D8(a.regular.lod.lengths,a.distanceToCamera,o);e.renderRegularEdges(n,a,r,i,c)},s)}_renderSilhouetteEdges(e,i,r){const n=e.bindSilhouetteEdges(r,i),s=r.transparency,o=i.camera.perScreenPixelRatio;e.forEachRenderable(a=>{if(!Vwe(a)||!a.visible)return;const c=D8(a.silhouette.lod.lengths,a.distanceToCamera,o);e.renderSilhouetteEdges(n,a,r,i,c)},s)}get test(){return{hasRenderedPrimitives:e=>{let i=!1;const r=e.perScreenPixelRatio,n=(s,o)=>s.forEachRenderable(a=>{a.visible&&!i&&(Uwe(a)&&(i=D8(a.regular.lod.lengths,a.distanceToCamera,r)>0),!i&&Vwe(a)&&(i=D8(a.silhouette.lod.lengths,a.distanceToCamera,r)>0))},o);return this._renderers.forEach(s=>{i||(n(s,Wi.OPAQUE),n(s,Wi.TRANSPARENT))}),i},getObjectData:e=>this._perObjectData.get(e)}}};function kwe(t){t!=null&&(t.vao.vertexBuffers.instances.dispose(),t.vao.disposeVAOOnly(),t.vao=null)}function J6t(t){let e=null,i=null;for(let r=0;r{this.loaded!=null&&(this.loaded=!0)})}},K6t=class{constructor(e,i){this.buffer=e,this.meta=i}},Q6t=class{constructor(e,i){this.vao=e,this.lod=i}},JY=class{constructor(e,i){this.modelMatrix=e,this.origin=i}};class eDt{constructor(e,i,r,n,s,o,a,c){this.regular=e,this.silhouette=i,this.statistics=r,this.transform=n,this.edgeTransparency=s,this.objectTransparency=o,this.components=a,this.rendererKey=c,this.distanceToCamera=0,this.visible=!0}}function Uwe(t){return t.regular!=null}function Vwe(t){return t.silhouette!=null}function D8(t,e,i){const r=e*i,n=fSe(t,r,!0);return n===-1?rPromise.reject();function Qm(t){return window.WebGL2RenderingContext&&t instanceof window.WebGL2RenderingContext}let Gwe=class{constructor(e,i,r,n,s,o,a,c,p){this.createQuery=e,this.deleteQuery=i,this.resultAvailable=r,this.getResult=n,this.disjoint=s,this.beginTimeElapsed=o,this.endTimeElapsed=a,this.createTimestamp=c,this.timestampBits=p}},pv=!1;function iDt(t,e){if(e.disjointTimerQuery)return null;let i=t.getExtension("EXT_disjoint_timer_query_webgl2");return i&&Qm(t)?new Gwe(()=>t.createQuery(),r=>{t.deleteQuery(r),pv=!1},r=>t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),r=>t.getQueryParameter(r,t.QUERY_RESULT),()=>t.getParameter(i.GPU_DISJOINT_EXT),r=>{pv||(pv=!0,t.beginQuery(i.TIME_ELAPSED_EXT,r))},()=>{t.endQuery(i.TIME_ELAPSED_EXT),pv=!1},r=>i.queryCounterEXT(r,i.TIMESTAMP_EXT),()=>t.getQuery(i.TIMESTAMP_EXT,i.QUERY_COUNTER_BITS_EXT)):(i=t.getExtension("EXT_disjoint_timer_query"),i?new Gwe(()=>i.createQueryEXT(),r=>{i.deleteQueryEXT(r),pv=!1},r=>i.getQueryObjectEXT(r,i.QUERY_RESULT_AVAILABLE_EXT),r=>i.getQueryObjectEXT(r,i.QUERY_RESULT_EXT),()=>t.getParameter(i.GPU_DISJOINT_EXT),r=>{pv||(pv=!0,i.beginQueryEXT(i.TIME_ELAPSED_EXT,r))},()=>{i.endQueryEXT(i.TIME_ELAPSED_EXT),pv=!1},r=>i.queryCounterEXT(r,i.TIMESTAMP_EXT),()=>i.getQueryEXT(i.TIMESTAMP_EXT,i.QUERY_COUNTER_BITS_EXT)):null)}function rDt(t,e){const i=t.capabilities.disjointTimerQuery;return i==null?null:new nDt(i,e)}let nDt=class{constructor(e,i){this._timer=e,this._queryPool=new Array,this._queryResults=new Map,this._currentQuery=null,i.forEach(r=>{const n=this._timer.createQuery(),s=this._timer.createQuery();this._queryPool.push(n,s),this._queryResults.set(r,null)})}start(){pv||(this._currentQuery=this._queryPool.pop(),this._currentQuery!=null&&(this._timer.disjoint(),this._timer.beginTimeElapsed(this._currentQuery)))}stop(e){if(this._timer.disjoint()||this._currentQuery==null||!this._queryResults.has(e))return this.abort(),null;this._timer.endTimeElapsed();const i=this._queryResults.get(e);if(i==null)return this._queryResults.set(e,this._currentQuery),this._currentQuery=null,null;if(!this._timer.resultAvailable(i))return this._queryPool.unshift(this._currentQuery),this._currentQuery=null,null;const r=this._timer.getResult(i)/1e6;return this._queryPool.unshift(i),this._queryResults.set(e,this._currentQuery),this._currentQuery=null,r}abort(){this._currentQuery!=null&&(this._timer.deleteQuery(this._currentQuery),this._queryPool.unshift(this._timer.createQuery()),this._currentQuery=null)}dispose(){this._currentQuery!=null&&this._timer.deleteQuery(this._currentQuery),this._queryPool.forEach(e=>{this._timer.deleteQuery(e)}),this._queryResults.forEach(e=>{e!=null&&this._timer.deleteQuery(e)})}};var Hn;(function(t){t.OVERLAY="overlay",t.PREPARE="prepare",t.SHADOW_MAP="shadow map",t.LINEAR_DEPTH="linear depth",t.ACCUMULATED_SHADOWS="accumulated shadows",t.OBJECT_AND_LAYER_ID_COLOR="object/layer id color",t.SSAO="SSAO",t.OPAQUE="opaque",t.OPAQUE_EDGES="opaque edges",t.VOXEL="voxel",t.TRANSPARENT="transparent",t.TRANSPARENT_EDGES="transparent edges",t.HUD_VISIBILITY="HUD visibility",t.TRANSPARENT_TERRAIN="transparent terrain",t.ENVIRONMENT="environment",t.LASER_LINES="laser lines",t.OCCLUDED="occluded",t.ANTIALIASING="antialiasing",t.HIGHLIGHTS="highlights",t.HUD="HUD",t.HUD_OCCLUDED="HUD occluded",t.FINISH="finish"})(Hn||(Hn={}));const Hwe="Total";let sDt=class{constructor(e){this._rctx=e,this._startTimeStampCPU=0,this._lastTimeStampCPU=0,this._totalCPUTime=new Wv(Hwe),this._cpuTimeSamplers=new Map(Object.values(Hn).map(i=>[i,new Wv(i)])),this._enableGPUTimer=0,this._totalGPUTime=new Wv("GPU"),this._gpuTimeSamplers=new Map(Object.values(Hn).map(i=>[i,new Wv(i)])),this._totalTime=0,this._totalFrameCount=0}get totalCPUTimeSampler(){return this._totalCPUTime}get cpuTimeSamplers(){return Array.from(this._cpuTimeSamplers.values())}get totalGPUTimeSampler(){return this._totalGPUTime}get gpuTimeSamplers(){return Array.from(this._gpuTimeSamplers.values())}get gpuSamplingEnabled(){return this._gpuTimerPool!=null}get totalTime(){return this._totalTime}get totalFrameCount(){return this._totalFrameCount}get elapsedTime(){return performance.now()-this._startTimeStampCPU}enableGPUPerformanceInfo(){if(this._gpuTimerPool==null){const i=[...Object.values(Hn),Hwe];this._gpuTimerPool=rDt(this._rctx,i)}if(this._gpuTimerPool==null)return{hasGPUTimerSupport:!1,remove:()=>{}};++this._enableGPUTimer;let e=!1;return{hasGPUTimerSupport:!0,remove:()=>{e||(e=!0,--this._enableGPUTimer,this._enableGPUTimer===0&&(this._gpuTimerPool=Kt(this._gpuTimerPool)))}}}startFrame(){this._startTimeStampCPU=this._lastTimeStampCPU=performance.now(),this._gpuTimerPool&&this._gpuTimerPool.start()}advance(e){const i=performance.now();if(this._cpuTimeSamplers.get(e).record(i-this._lastTimeStampCPU),this._lastTimeStampCPU=i,this._gpuTimerPool){const r=this._gpuTimerPool.stop(e);this._gpuTimeSamplers.get(e).record(r),this._gpuTimerPool.start()}}finishFrame(){if(this._gpuTimerPool){const i=this._gpuTimerPool.stop(Hn.FINISH);this._gpuTimeSamplers.get(Hn.FINISH).record(i),this._rctx.gl.flush()}const e=performance.now()-this._startTimeStampCPU;this._totalTime=this._totalTime+e,this._totalCPUTime.record(e),this._gpuTimerPool&&this._totalGPUTime.record(this.gpuTimeSamplers.reduce((i,r)=>i+(r.last||0),0)),++this._totalFrameCount}},kd=class extends ze{get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,i=!$e("disable-feature:high-quality-idle")){this._renderStateFeatures=eW(i,e),this.notifyChange("_renderStateFeatures"),this._renderPlugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,i=this._state){return this._renderStateFeatures.get(i,e)??!1}setFeatureEnabled(e,i,r){this._renderStateFeatures.set(i,e,r),this.notifyChange("_renderStateFeatures"),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(Jo.HighQualityTransparency)}get hasReflections(){return this.hasWater&&(this._ssrEnabled||this.isFeatureEnabled(Jo.WaterReflection))}get hasDecorations(){return this._materialRenderersHas.decorations||this._renderPlugins.hasDecorations}get hasHighlights(){return this._materialRenderersHas.highlights||this._renderPlugins.produces(ke.OPAQUE_MATERIAL,ue.Highlight)||this._renderPlugins.produces(ke.DRAPED_MATERIAL,ue.Highlight)}get hasShadowHighlights(){return this._materialRenderersHas.highlights||this._renderPlugins.produces(ke.OPAQUE_MATERIAL,ue.ShadowHighlight)}get _magnifierEnabled(){return this._bindParameters.decorations===Kh.ON&&this._magnifierHelper.enabled}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(Jo.HighResolutionAtmosphere)}get hasWater(){return this._materialRenderersHas.water||this._hasOverlayWater}constructor(e,i,r,n,s,o,a,c){super({}),this._stage=e,this._techniqueRepository=n,this._rctx=s,this._compositingHelper=o,this._magnifierHelper=a,this._requestRender=c,this._materialRenderers=new Pi,this._needsTransparentPass=!1,this._materialRenderersHas={hudElements:!1,highlights:!1,water:!1,decorations:!1,occludees:!1},this._hasOverlayWater=!1,this.renderOverlay=p=>{},this._isRendering=!1,this._backgroundColor=Mi(0,0,0,1),this._sliceHelper=new E6t,this._state=Vr.IDLE,this._highQualityTransparencyEnabled=!0,this._terrainTransparency=ou.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new u6t,this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new W9t,this._releaseGeometryLinearDepth=p=>p==null?void 0:p.release(),this._geometryLinearDepthFormat=ca.DEPTH16_BUFFER,this.fboCache=new ygt(s),this._renderStateFeatures=eW(!$e("disable-feature:high-quality-idle"),e.view.qualityProfile),this._offscreen=new g6t(this.fboCache,this._compositingHelper),this.performanceInfo=new sDt(this._rctx),this._shadowMap=new lce(this.fboCache,e.viewingMode),this._highlight=new N4({view:e.view}),this._shadowHighlight=new rM({view:e.view,viewingMode:e.viewingMode}),this._shadowAccumulator=new Iu(this.fboCache,n,e,p=>{const _=this.shadowsEnabled;this._shadowMap.enabled=!0,this._prepare(p.camera,p.contentCamera),this._renderPlugins.prepareRender(),this._shadowMap.enabled=_},(p,_,x)=>{p.shadowMap.start(p.camera,_,x,!0,this._stage.view.qualitySettings.maximumPixelRatio),this._renderShadowCascades(ue.Shadow,p.shadowMap),p.shadowMap.finish(),p.camera.setGLViewport(this._rctx),this._prepare(p.camera,p.contentCamera)},c),this._ssao=new w4({view:this._stage.view}),this._renderContext=new qTt(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._renderPlugins=new Pk({renderContext:this._renderContext,techniqueRepository:n,textureRepository:r,materialRepository:i,requestRender:c,controller:e,fbos:this.fboCache,isFeatureEnabled:p=>this.isFeatureEnabled(p)}),this.renderPassManager=new ure,this._renderPlugins.add(this.renderPassManager),this._smaa=new hS({view:this._stage.view}),this._renderPlugins.add(this._smaa),this._blit=new iM({opacity:1,alphaMode:bc.None}),this._renderPlugins.add(this._blit),this._renderPlugins.add(this._ssao),this._renderPlugins.add(this._highlight),this._renderPlugins.add(this._shadowHighlight),this.addHandles([_e(()=>this._stage.view.state.camera,()=>c(),kt),_e(()=>En.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,p=>{this._renderHiddenTransparentEdges=p?()=>this._renderEdges(Wi.TRANSPARENT):()=>{},c()},Qt),_e(()=>{var p;return(p=this._stage.view.environment.background)==null?void 0:p.color},p=>{const _=p?NL(p):bp;rs(this._backgroundColor,_[0]*_[3],_[1]*_[3],_[2]*_[3],_[3]),c()},kt)])}normalizeCtorArgs(){return{}}destroy(){this._smaa.destroy(),this._blit.destroy(),this._gpuTimerHandle=en(this._gpuTimerHandle),this._materialRenderers.forAll(e=>e.dispose()),this._materialRenderers.clear(),this._offscreen.dispose(),this._shadowMap.dispose(),this._ssao.destroy(),this._highlight.dispose(),this._shadowHighlight.destroy(),this._shadowAccumulator.dispose(),this._edgeView=et(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),mLe.prune()}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=ir(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.linearDepth=ir(this._bindParameters.multipassTerrain.linearDepth),this._bindParameters.multipassGeometry.linearDepth=ir(this._bindParameters.multipassGeometry.linearDepth)}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.linearDepth=ir(this._bindParameters.linearDepth),this._bindParameters.hudVisibility=ir(this._bindParameters.hudVisibility)}get updating(){return this._smaa.updating||this._edgeView!=null&&this._edgeView.updating||this._shadowAccumulator.running||this._renderPlugins.updating||!this.isCameraFinal}ensureEdgeView(){if(this._edgeView==null){const e=this._stage.view.resourceController;this._edgeView=new Y0({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:oDt(e)}),this.addHandles(_e(()=>{var i;return(i=this._edgeView)==null?void 0:i.updating},()=>this._requestRender(),Li)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return TB(this._bindParameters.ssr.reprojectionMatrix,gs)}set _reprojectionMatrix(e){lne(this._bindParameters.ssr.reprojectionMatrix,e)&&this.notifyChange("isCameraFinal")}get shadowsEnabled(){var e;return!!((e=this._shadowMap)!=null&&e.enabled)}setParameters(e){var n;const{_shadowMap:i,_bindParameters:r}=this;if(((n=e.qualitySettings)==null?void 0:n.reflections)!==void 0&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),e.shadowMap!==void 0&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowMapMaxCascades!==void 0&&i.maxCascades!==e.shadowMapMaxCascades&&(i.maxCascades=e.shadowMapMaxCascades,this._requestRender()),e.environment!=null){e.environment.weather!=null&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const s=e.environment.lighting.type!=="virtual";r.enableFillLights!==s&&(r.enableFillLights=s,this._requestRender())}e.highQualityTransparency!==void 0&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),e.hasOverlayWater!==void 0&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),e.slicePlane!==void 0&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),e.terrainTransparency!==void 0&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),e.shadowCastOptions!==void 0&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get renderPlugins(){return this._renderPlugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,i){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:r,removes:n,updates:s}=e;if(r.length===0&&n.length===0&&s.length===0)return;const o=$Ne(e);let a=!1;o.forEach((c,p)=>{if(i.done)return;let _=this._materialRenderers.find(x=>x.material===p);if(_==null&&c.adds.length>0){const x=new F$({material:p});x.initializeRenderContext(this._renderPlugins._context),_=x,this._materialRenderers.push(_)}_&&(_.modify(c),_.isEmpty&&(a=!0)),c.removes.forEach(x=>e.removes.removeUnordered(x)),c.adds.forEach(x=>e.adds.removeUnordered(x)),c.updates.forEach(x=>e.updates.removeUnordered(x)),i.madeProgress()}),a&&this._materialRenderers.filterInPlace(c=>!c.isEmpty||(c.dispose(),!1)),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const e=this._materialRenderersHas;e.decorations=!1,e.highlights=!1,e.hudElements=!1,e.water=!1,e.occludees=!1,this._materialRenderers.forAll(i=>{e.highlights||(e.highlights=i.hasHighlights),e.occludees||(e.occludees=i.hasOccludees),e.water||(e.water=i.hasWater),e.decorations||(e.decorations=i.isDecoration),e.hudElements||(e.hudElements=i.material.produces(ke.LINE_CALLOUTS_HUD_DEPTH,ue.Color)||i.material.produces(ke.HUD_MATERIAL,ue.Color)||i.material.produces(ke.LABEL_MATERIAL,ue.Color))}),this._bindParameters.hasOccludees=e.occludees}updateAnimation(e){const i=this._hasAnimations;return this._hasAnimations=!1,this._materialRenderers.forAll(r=>this._hasAnimations=r.updateAnimation(e)||this._hasAnimations),this._hasAnimations=this._renderPlugins.updateAnimation(e)||this._hasAnimations,this._hasAnimations!==i&&(this._gpuTimerHandle=i?en(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,i,r,n,s){const o=e!=null;this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.frame(),this._disposeBindBuffers();const a=this._offscreen,{camera:c,contentCamera:p,mode:_,alignPixelEnabled:x}=r;this._state=_,this._bindParameters.overlay=this.renderOverlay(s),this.performanceInfo.advance(Hn.OVERLAY),this._renderContext.time=s,this._bindParameters.transparencyPassType=Jt.NONE,this._bindParameters.alignPixelEnabled=x,this._bindParameters.decorations=n;const S=H_(this._sliceHelper.plane);n===Kh.OFF&&(this._sliceHelper.plane=null),c.setGLViewport(this._rctx);const C=a.initializeFrame(c,this._backgroundColor,o);this.hasReflections?this._bindParameters.ssr.lastFrameColor=C:C==null||C.release(),this._prepare(c,p),this._renderPlugins.prepareRender(),this.performanceInfo.advance(Hn.PREPARE);const M=this._computeDepthRange(c);this._renderShadowMap(c,this._bindParameters.lighting.mainLight.direction,M),this.performanceInfo.advance(Hn.SHADOW_MAP),this._ensureBindParameters(c,p);const P=this._renderPlugins.produces(ke.OPAQUE_TERRAIN)&&(this._terrainTransparency===ou.Semitransparent||this._terrainTransparency===ou.TransparentWithDraped),$=this._highQualityTransparency&&P,F=this._needsTransparentPass||this._renderPlugins.produces(ke.TRANSPARENT_MATERIAL);this._prepareShaders($,F),this._renderLinearDepth(),this.performanceInfo.advance(Hn.LINEAR_DEPTH),this._renderShadowAccumulation(M,c,p),this.performanceInfo.advance(Hn.ACCUMULATED_SHADOWS),this._ensureBindParametersSSR(s),this._renderSSAO(),this.performanceInfo.advance(Hn.SSAO),this._renderContext.output=ue.Color,a.bindFbo(),this._renderOpaqueGeometry(),this._renderPlugins.render(ke.ENVIRONMENT_OPAQUE),this.performanceInfo.advance(Hn.OPAQUE),this._renderTerrainLinearDepth($),this._setMultipassTerrain($),this._renderEdges(Wi.OPAQUE),this.performanceInfo.advance(Hn.OPAQUE_EDGES),a.bindFbo(),this._renderPlugins.render(ke.VOXEL),this.performanceInfo.advance(Hn.VOXEL),this._renderHiddenTransparentEdges(),F&&(this._oitEnabled?this._renderOITPass(JM.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(Hn.TRANSPARENT);const z=this._renderGeometryLinearDepth($);this._renderHUDVisibility(z),$||this._renderInternalSlot(ke.LINE_CALLOUTS),this.performanceInfo.advance(Hn.HUD_VISIBILITY),this._renderObjectAndLayerIdColor(i),this.performanceInfo.advance(Hn.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(Wi.TRANSPARENT,z),this._releaseGeometryLinearDepth(z),this.performanceInfo.advance(Hn.TRANSPARENT_EDGES);const k=P?this._renderTransparentTerrain():null;k&&this._bindParameters.hudVisibility&&($?this._renderLineCallouts(Dh.Occluded):a.compositeToHUDVisibility(this._bindParameters,k.colorTexture),this._renderHUD(Dh.Occluded,a.color),this.performanceInfo.advance(Hn.HUD_OCCLUDED)),this.performanceInfo.advance(Hn.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),k&&(a.compositeToFramebuffer(this._bindParameters,k.colorTexture,bc.PremultipliedAlpha,1),k.release(),$&&(this._renderEdges(Wi.OPAQUE),this.performanceInfo.advance(Hn.OPAQUE_EDGES),F&&(this._oitEnabled?this._renderOITPass(JM.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(Hn.TRANSPARENT),this._renderEdges(Wi.TRANSPARENT),this.performanceInfo.advance(Hn.TRANSPARENT_EDGES))),this._bindParameters.ssao=ir(this._bindParameters.ssao),$&&this._renderLineCallouts(Dh.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),a.bindFbo(),this._renderInternalSlot(ke.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderPlugins.render(ke.ENVIRONMENT_TRANSPARENT),this.performanceInfo.advance(Hn.ENVIRONMENT),this._renderLaserlines(),this.performanceInfo.advance(Hn.LASER_LINES),this._renderOccluded(),this.performanceInfo.advance(Hn.OCCLUDED);const U=this._magnifierEnabled&&e==null?this.fboCache.acquire(Sr.RGBA,this._offscreen.width,this._offscreen.height):null,j=this._renderComposite(U??e,this._offscreen.color)??e;this.performanceInfo.advance(Hn.ANTIALIASING),this._renderHUD(Dh.NotOccluded,j),this.performanceInfo.advance(Hn.HUD),this._renderHighlights(j,this._bindParameters),this.performanceInfo.advance(Hn.HIGHLIGHTS),this._magnifierEnabled&&this._magnifierHelper.render(this._rctx,this._bindParameters),j!==e&&(this._rctx.bindFramebuffer(e==null?void 0:e.fbo),this._compositingHelper.composite(this._bindParameters,U==null?void 0:U.colorTexture,bc.None)),U!==e&&(U==null||U.release()),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=S,this._isRendering=!1,this.performanceInfo.finishFrame(),o&&(this._releaseFBOs(),this._disposeOffscreenBuffers())}_prepareShaders(e,i){this._renderContext.output=ue.Color,this._prepareOpaqueGeometrySlots(),this._setMultipassTerrain(e),this._renderPlugins.prepare(ke.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._prepareInternalSlots(this._materialRenderers,ke.LINE_CALLOUTS),i&&this._prepareTransparencySlots(),this._prepareInternalSlots(this._materialRenderers,ke.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._renderPlugins.prepare(ke.ENVIRONMENT_TRANSPARENT),this._renderPlugins.prepare(ke.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(e){if(e==null||!$e("enable-feature:objectAndLayerId-rendering"))return;const i=this._renderContext.output;this._rctx.bindFramebuffer(e.fbo),this._offscreen.renderToFBO(()=>this._renderAllGeometry(ue.ObjectAndLayerIdColor),[0,0,0,0],!0,!0),this._rctx.bindFramebuffer(e.fbo),this._offscreen.renderToFBO(()=>{this._bindParameters.hudRenderStyle=Dh.NotOccluded,this._renderInternalSlot(ke.HUD_MATERIAL)},void 0,!0,!0),this._renderContext.output=i}finish(e){this._hasAnimations||this._animationTimestep.clear();const i=this.performanceInfo.gpuSamplingEnabled,r=e===so.BACKGROUND;if(r||i){const n=r?this.performanceInfo.elapsedTime:0,s=i?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),o=Math.max(n,s);this._animationTimestep.frame(o,r)}}readDepthPixels(e,i,r){var a;const n=(a=this._bindParameters.linearDepth)==null?void 0:a.fbo;if(n!=null&&n.colorTexture)return void n.readPixels(i[0],i[1],i[2],i[3],ci.RGBA,ya.UNSIGNED_BYTE,r);const s=this.fboCache.acquire(Sr.RGBA,this._offscreen.width,this._offscreen.height).acquireDepth(ca.DEPTH16_BUFFER);this._rctx.bindFramebuffer(s.fbo),this._ensureBindParameters(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const o=$n.COLOR_BUFFER_BIT|$n.DEPTH_BUFFER_BIT|$n.STENCIL_BUFFER_BIT;this._rctx.clearSafe(o),this._renderAllGeometry(ue.Depth),s.fbo.readPixels(i[0],i[1],i[2],i[3],ci.RGBA,ya.UNSIGNED_BYTE,r),s.release()}readHUDVisibility(e,i,r,n,s){var o;(o=this._bindParameters.hudVisibility)==null||o.fbo.readPixels(e,i,r,n,ci.RGBA,ya.UNSIGNED_BYTE,s)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e,i){const r=this._edgeView;if(r!=null&&r.shouldRender()){const{width:n,height:s,depth:o}=this._offscreen,a=this.fboCache.acquire(Sr.RGBA,n,s),c=()=>r.render(this._bindParameters,e);this._offscreen.renderToTargets(c,a,i??o,qwe),this._offscreen.compositeToFramebuffer(this._bindParameters,a.colorTexture,bc.Alpha,1),a.release()}}_renderShadowMap(e,i,r){const n=this._shadowMap;n.enabled&&(n.start(e,i,r,this.isFeatureEnabled(Jo.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(e,i),this._needsShadowHighlight?(this._renderShadowCascades(ue.ShadowHighlight,this._shadowMap),n.moveSnapshot(VP.Highlight),n.clear(),this._renderShadowCascades(ue.ShadowExcludeHighlight,this._shadowMap),n.copySnapshot(VP.Default),this._renderShadowCascades(ue.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(ue.Shadow),n.finish(),e.setGLViewport(this._rctx))}_renderShadowCascades(e,i=this._shadowMap){for(const r of i.cascades)r.camera.setGLViewport(this._rctx),this._prepare(r.camera,r.camera),this._renderAllGeometry(e)}get _needsLinearDepth(){return this._renderPlugins.consumes(ue.Depth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast}_renderLinearDepth(){this._needsLinearDepth?(this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,()=>this._renderAllGeometry(ue.Depth),[0,0,0,0],Sr.RGBA,ca.DEPTH_STENCIL_BUFFER),this._bindParameters.linearDepth.releaseDepth(),this._offscreen.bindFbo()):this._bindParameters.linearDepth=ir(this._bindParameters.linearDepth)}_renderTerrainLinearDepth(e){if(e){const i=this._renderContext.output;this._renderContext.output=ue.Depth,this._bindParameters.multipassTerrain.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassTerrain.linearDepth,()=>this._renderTransparentTerrain(),[-1e10,-1e10,-1e10,1]),this._bindParameters.multipassTerrain.linearDepth.releaseDepth(),this._renderContext.output=i}else this._bindParameters.multipassTerrain.linearDepth=ir(this._bindParameters.multipassTerrain.linearDepth)}_renderGeometryLinearDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.linearDepth=ir(this._bindParameters.multipassGeometry.linearDepth));const i=this._renderContext.output;return this._bindParameters.multipassGeometry.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassGeometry.linearDepth,()=>this._renderOpaqueGeometryAndTransparentMaterial(ue.Depth),[1,1,1,1],Sr.RGBA,this._geometryLinearDepthFormat),this._renderContext.output=i,this._bindParameters.multipassGeometry.linearDepth.detachDepth()}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return rre;const i=P9t(e,this._materialRenderers,this._stage.layers);return HP(i,this._renderPlugins.queryDepthRange(e)),i.near=Math.max(e.near,i.near),i.far=Math.min(e.far,i.far),i}_renderAllGeometry(e){this._renderContext.output=e,this._renderPlugins.prepare(ke.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._renderPlugins.prepare(ke.TRANSPARENT_MATERIAL),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderSSAO(){if(!this._renderPlugins.produces(ke.SSAO))return;const e=this._offscreen.renderToCachedFBO(null,()=>this._renderAllGeometry(ue.Normal),[0,0,0,0],Sr.RGBA4,ca.DEPTH24_BUFFER);e.releaseDepth(),this._offscreen.bindFbo(),this._pluginInput.normal=e,this._bindParameters.ssao=this._renderPlugins.render(ke.SSAO,this._pluginInput),e.release()}_prepareOpaqueGeometrySlots(){this._renderPlugins.prepare(ke.INTEGRATED_MESH),this._renderPlugins.prepare(ke.OPAQUE_TERRAIN),this._renderPlugins.prepare(ke.OPAQUE_MATERIAL),this._renderPlugins.prepare(ke.ENVIRONMENT_OPAQUE),this._prepareInternalSlots(this._materialRenderers,ke.OPAQUE_MATERIAL)}_renderOpaqueGeometry(){this._renderPlugins.render(ke.INTEGRATED_MESH),this._renderPlugins.render(ke.OPAQUE_TERRAIN),this._renderInternalSlot(ke.OPAQUE_MATERIAL),this._renderPlugins.render(ke.OPAQUE_MATERIAL)}_renderTransparentMaterial(){this._renderInternalSlot(ke.TRANSPARENT_MATERIAL),this._renderPlugins.render(ke.TRANSPARENT_MATERIAL)}_renderTransparentTerrain(){if(!this._renderPlugins.produces(ke.TRANSPARENT_TERRAIN))return;const e=()=>this._renderPlugins.render(ke.TRANSPARENT_TERRAIN,null);if(this._renderContext.output!==ue.Color)return void e();const{width:i,height:r,depth:n}=this._offscreen,s=this.fboCache.acquire(Sr.RGBA,i,r);return this._offscreen.renderToTargets(e,s,n,[0,0,0,0]),s}_renderHUDVisibility(e){this._shouldRenderInternalSlot(this._materialRenderers,ke.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,()=>this._renderInternalSlot(ke.OCCLUSION_PIXELS),e),this._offscreen.bindFbo()):this._bindParameters.hudVisibility=ir(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===Dh.Occluded){const i=()=>this._renderInternalSlot(ke.LINE_CALLOUTS),{width:r,height:n,color:s}=this._offscreen,o=this.fboCache.acquireDepth(ca.DEPTH16_BUFFER,r,n);this._offscreen.renderToTargets(i,s,o,void 0,!0,!0),o.release()}else this._renderInternalSlot(ke.LINE_CALLOUTS)}_renderLaserlines(){if(this._renderPlugins.render(ke.LASERLINES),this._renderPlugins.produces(ke.LASERLINES_CONTRAST_CONTROL)){const e=this._offscreen,{width:i,height:r,depth:n}=e,s=this.fboCache.acquire(Sr.RGBA,i,r),o=()=>this._renderPlugins.render(ke.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(o,s,n,qwe),e.compositeToFramebuffer(this._bindParameters,s.colorTexture,bc.PremultipliedAlpha,1),s.release()}}_renderHUD(e,i){if(this._materialRenderersHas.hudElements)if(this._oitEnabled){const r=this._renderOITPass(JM.HUD,e);this._rctx.bindFramebuffer(i==null?void 0:i.fbo),this._compositingHelper.composite(this._bindParameters,r.colorTexture,bc.PremultipliedAlpha),r.release()}else if(e===Dh.Occluded){const r=()=>this._renderHUDElements(e),{width:n,height:s,color:o}=this._offscreen,a=this.fboCache.acquireDepth(ca.DEPTH16_BUFFER,n,s);this._offscreen.renderToTargets(r,o,a,void 0,!0,!0),a.release()}else this._rctx.bindFramebuffer(null),i==null||i.acquireDepth(ca.DEPTH16_BUFFER),this._rctx.bindFramebuffer(i==null?void 0:i.fbo),this._renderHUDElements(e),i==null||i.releaseDepth()}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._prepareInternalSlots(this._materialRenderers,ke.LINE_CALLOUTS_HUD_DEPTH,ke.HUD_MATERIAL,ke.LABEL_MATERIAL),this._renderInternalSlot(ke.LINE_CALLOUTS_HUD_DEPTH),this._renderInternalSlot(ke.HUD_MATERIAL),this._renderInternalSlot(ke.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._renderPlugins.produces(ke.SHADOW_HIGHLIGHT)&&this.hasShadowHighlights}_renderHighlights(e,i){if(!this.hasHighlights||i.decorations===Kh.OFF)return;const r=()=>{this._renderAllGeometry(ue.Highlight),this._rctx.clearSafe($n.DEPTH_BUFFER_BIT),this._renderHUDElements(Dh.Both)},n=this._offscreen.renderToCachedFBO(null,r,[0,0,0,0],Sr.RGBA4,ca.DEPTH_STENCIL_BUFFER);n.releaseDepth(),this._needsShadowHighlight&&(this._pluginInput.highlight=n,this._renderPlugins.render(ke.SHADOW_HIGHLIGHT,this._pluginInput,e)),this._renderPlugins.produces(ke.HIGHLIGHT)&&(this._pluginInput.composite=null,this._pluginInput.normal=null,this._pluginInput.highlight=n,this._renderPlugins.render(ke.HIGHLIGHT,this._pluginInput,e)),n.release()}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,i,r){var n;this._needsShadowCast&&((n=this._bindParameters.linearDepth)!=null&&n.colorTexture)&&this._shadowAccumulator.renderAccumulation(this._bindParameters.linearDepth,e,i,r)}_prepareTransparencySlots(){this._renderContext.output=ue.Alpha,this._bindParameters.transparencyPassType=Jt.Alpha,this._prepareInternalSlots(this._materialRenderers,ke.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(ke.TRANSPARENT_MATERIAL),this._renderContext.output=ue.Color,this._bindParameters.transparencyPassType=Jt.Color,this._prepareInternalSlots(this._materialRenderers,ke.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(ke.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=Jt.FrontFace,this._prepareInternalSlots(this._materialRenderers,ke.TRANSPARENT_MATERIAL),this._renderPlugins.prepare(ke.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=Jt.NONE}_renderOITPass(e,i=Dh.Both){const r=e===JM.HUD,n=r?this.fboCache.acquire(Sr.RGBA,this._offscreen.width,this._offscreen.height):null,s=r?()=>this._renderHUDElements(i):()=>this._renderTransparentMaterial(),o=this._renderContext.output;this._renderContext.output=ue.Alpha,this._bindParameters.transparencyPassType=Jt.Alpha;const a=this._offscreen.renderOITPass(s,Jt.Alpha,r);this._renderContext.output=ue.Color,this._bindParameters.transparencyPassType=Jt.Color;const c=this._offscreen.renderOITPass(s,Jt.Color,r);this._bindParameters.transparencyPassType=Jt.FrontFace;const p=this._offscreen.renderOITPass(s,Jt.FrontFace,r);return this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,c,a,p,n),n==null||n.releaseDepth(),p.release(),c.release(),a.release(),this._bindParameters.transparencyPassType=Jt.NONE,this._renderContext.output=o,n}_renderOccluded(){let e=0;Pd.clear(),this._materialRenderers.forAll(o=>{o.material&&o.material.isVisible()&&o.material.parameters.renderOccluded===Yn.OccludeAndTransparentStencil&&(e|=o.material.parameters.renderOccluded,Pd.push(o))});const i=this._offscreen,r=(o,a,c,p,_)=>{if(!(e&a))return;const{width:x,height:S,depth:C}=i,M=this.fboCache.acquire(Sr.RGBA,x,S);i.renderToTargets(c,M,C,[0,0,0,0],p,_),i.compositeToFramebuffer(this._bindParameters,M.colorTexture,bc.PremultipliedAlpha,o),M.release()};Pd.length!==0&&(this._prepareInternalSlots(Pd,ke.OCCLUDER_MATERIAL,ke.TRANSPARENT_OCCLUDER_MATERIAL),this._renderInternalSlot(ke.OCCLUDER_MATERIAL,Pd),r(.5,Yn.OccludeAndTransparentStencil,()=>this._renderInternalSlot(ke.TRANSPARENT_OCCLUDER_MATERIAL,Pd),!1,!1)),Pd.clear(),this._materialRenderers.forAll(o=>{o.material&&o.material.isVisible()&&(o.material.parameters.renderOccluded===Yn.OccludeAndTransparent||o.material.parameters.renderOccluded===Yn.Transparent||o.material.parameters.renderOccluded===Yn.Opaque)&&(e|=o.material.parameters.renderOccluded,Pd.push(o))});const n=this._renderPlugins.renderOccludedFlags;if(e|=n,!e)return;const s=o=>{this._renderContext.renderOccludedMask=o,this._prepareInternalSlots(Pd,ke.OPAQUE_MATERIAL,ke.TRANSPARENT_MATERIAL,ke.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),n>Yn.Occlude&&this._renderPlugins.render(ke.OCCLUDED_TERRAIN),this._renderInternalSlot(ke.OPAQUE_MATERIAL,Pd),this._renderInternalSlot(ke.TRANSPARENT_MATERIAL,Pd),this._renderInternalSlot(ke.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Pd),this._renderContext.resetRenderOccludedMask()};this._renderContext.output=ue.Color,r(.5,Yn.OccludeAndTransparent,()=>s(Yn.OccludeAndTransparent),!0,Ku.OutlineVisualElementMask),r(.5,Yn.Transparent,()=>s(Yn.Transparent),!0,Ku.OutlineVisualElementMask),r(1,Yn.Opaque,()=>s(Yn.Opaque),!0,Ku.OutlineVisualElementMask),Pd.clear()}_renderComposite(e,i){this._renderPlugins.consumes(ue.CompositeColor)&&(this._pluginInput.composite=i);let r=null;const n=this._renderPlugins.produces(ke.COMPOSITE);n&&(r=this._renderPlugins.renderComposition(ke.COMPOSITE,this._pluginInput),this._pluginInput.composite=r);const s=this._renderPlugins.produces(ke.ANTIALIASING),o=this._renderPlugins.render(s?ke.ANTIALIASING:ke.BLIT,this._pluginInput,e);return n&&(r==null||r.release()),o}_prepare(e,i){this._needsTransparentPass=this._materialRenderers.some(r=>r.material.produces(ke.TRANSPARENT_MATERIAL,ue.Color)),this._bindParameters.camera=e,this._bindParameters.contentCamera=i}_ensureBindParameters(e,i){this._bindParameters.camera=e,this._bindParameters.contentCamera=i;const r=this._renderContext.offscreenRenderingHelper;this._bindParameters.mainColor=r.colorTexture,this._bindParameters.mainDepth=r.depthTexture}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){this._ssrEnableTime==null&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=gs:(Bo(Ywe,this._bindParameters.camera.viewMatrix),Bo(Wwe,this._bindParameters.camera.projectionMatrix),sn(XC,Ywe,Wwe),sn(XC,this._renderContext.lastFrameCamera.viewMatrix,XC),sn(XC,this._renderContext.lastFrameCamera.projectionMatrix,XC),this._reprojectionMatrix=XC);const i=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=i>0?Math.min(i,e-this._ssrEnableTime)/i:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=gs,this._ssrEnableTime=null}_shouldRenderInternalSlot(e,i){return this._bindParameters.slot=i,e.some(r=>r.prepareTechnique(this._renderContext)!=null)}_prepareInternalSlots(e,...i){for(const r of i)this._bindParameters.slot=r,e.forAll(n=>n.prepareTechnique(this._renderContext)!=null)}_renderInternalSlot(e,i=this._materialRenderers){this._bindParameters.slot=e,i.forAll(r=>{const n=r.prepareTechnique(this._renderContext);n&&r.renderNode(this._renderContext,n)})}get memoryInfo(){return{fbos:this.fboCache.usedMemory,vaos:this._materialRenderers.reduce((e,i)=>e+i.usedMemory,0),plugins:this._renderPlugins.usedMemory}}getMemoryForMaterial(e){if(e==null)return 0;const i=this._materialRenderers.find(r=>r.material===e);return(i==null?void 0:i.usedMemory)??0}get usedMemory(){var e;return this.fboCache.usedMemory+(((e=this.edgeView)==null?void 0:e.usedMemory)??0)+this._renderPlugins.usedMemory}get test(){const e=this;return{offscreen:this._offscreen,shadowMap:this._shadowMap,highlight:this._highlight,lighting:this._bindParameters.lighting,materialRenderers:this._materialRenderers,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{e._renderStateFeatures=eW(),this._renderPlugins.renderFeatureChanged(),this._requestRender()},releaseGeometryLinearDepth(i){e._releaseGeometryLinearDepth=i??(r=>r==null?void 0:r.release()),e._geometryLinearDepthFormat=i?ca.DEPTH_STENCIL_TEXTURE:ca.DEPTH16_BUFFER},getFramebufferTexture:i=>{var r,n;switch(i){case KM.Color:return e._offscreen.colorTexture;case KM.LinearDepth:return(r=e._bindParameters.linearDepth)==null?void 0:r.colorTexture;case KM.ShadowMap:return e._shadowMap.depthTexture;case KM.HudVisibility:return(n=e._bindParameters.hudVisibility)==null?void 0:n.colorTexture}}}}};var JM,KM;y([w()],kd.prototype,"_renderPlugins",void 0),y([w()],kd.prototype,"_shadowAccumulator",void 0),y([w()],kd.prototype,"_state",void 0),y([w()],kd.prototype,"_renderStateFeatures",void 0),y([w({readOnly:!0})],kd.prototype,"fullResolutionAtmosphere",null),y([w()],kd.prototype,"_smaa",void 0),y([w()],kd.prototype,"_blit",void 0),y([w({autoDestroy:!0})],kd.prototype,"_edgeView",void 0),y([w()],kd.prototype,"updating",null),y([w()],kd.prototype,"isCameraFinal",null),kd=y([Z("esri.views.3d.webgl-engine.lib.Renderer")],kd),function(t){t[t.Geometry=0]="Geometry",t[t.HUD=1]="HUD"}(JM||(JM={})),function(t){t[t.Color=0]="Color",t[t.LinearDepth=1]="LinearDepth",t[t.ShadowMap=2]="ShadowMap",t[t.HudVisibility=3]="HudVisibility"}(KM||(KM={}));const qwe=[0,0,0,0],Pd=new Pi,Wwe=Qe(),Ywe=Qe(),XC=Qe();function oDt(t){return e=>t.immediate.schedule(e)}let aDt=class{constructor(e){this._rctx=e,this._vao=bgt(e)}destroy(){this._vao=Kt(this._vao)}draw(){this._vao!=null&&(this._rctx.bindVAO(this._vao),this._rctx.drawArrays(sr.TRIANGLES,0,3))}get test(){var e,i,r,n;return{cachedWebGLObjects:KY((e=this._vao)==null?void 0:e.glName)+KY((r=(i=this._vao)==null?void 0:i.indexBuffer)==null?void 0:r.glName)+KY((n=this._vao)==null?void 0:n.vertexBuffers.geometry)}}};function KY(t){return t!=null?1:0}let sze=class oze{constructor(e){this._rctx=e,this._indexBuffer=this._createIndexbuffer(),this._program=this._createHelperProgram()}static getShaderSources(){return{vertex:`#version 300 es precision highp float; void main(void) { @@ -5393,21 +5382,21 @@ return 1.0; void main(void) { fragColor = vec4(0.0, 0.0, 0.0, 1.0); - }`}}_createHelperProgram(){const e=lze.getShaderSources();return this._rctx.programCache.acquire(e.vertex,e.fragment,new Map([]))}_createIndexbuffer(){return Yr.createIndex(this._rctx,Pr.STATIC_DRAW,new Uint32Array([0]))}run(){this._program.compiled&&this._indexBuffer&&(this._rctx.bindVAO(null),this._rctx.useProgram(this._program),this._rctx.bindBuffer(this._indexBuffer,fi.ELEMENT_ARRAY_BUFFER),this._rctx.drawElements(sr.POINTS,1,Yt.UNSIGNED_INT,0))}dispose(){this._program.dispose(),this._indexBuffer.dispose()}get test(){var e;return{cachedWebGLObjects:(e=this._indexBuffer)!=null&&e.glName?1:0}}},Ywe=class{constructor(){this.blend=!1,this.blendColor={r:0,g:0,b:0,a:0},this.blendFunction={srcRGB:st.ONE,dstRGB:st.ZERO,srcAlpha:st.ONE,dstAlpha:st.ZERO},this.blendEquation={mode:Xy.ADD,modeAlpha:Xy.ADD},this.colorMask={r:!0,g:!0,b:!0,a:!0},this.faceCulling=!1,this.cullFace=vm.BACK,this.frontFace=x5.CCW,this.scissorTest=!1,this.scissorRect={x:0,y:0,width:0,height:0},this.depthTest=!1,this.depthFunction=Zr.LESS,this.clearDepth=1,this.depthWrite=!0,this.depthRange={zNear:0,zFar:1},this.viewport=null,this.stencilTest=!1,this.polygonOffsetFill=!1,this.polygonOffset=[0,0],this.stencilFunction={face:vm.FRONT_AND_BACK,func:Zr.ALWAYS,ref:0,mask:1},this.clearStencil=0,this.stencilWriteMask=1,this.stencilOperation={face:vm.FRONT_AND_BACK,fail:bs.KEEP,zFail:bs.KEEP,zPass:bs.KEEP},this.clearColor={r:0,g:0,b:0,a:0},this.program=null,this.vertexBuffer=null,this.indexBuffer=null,this.uniformBuffer=null,this.pixelPackBuffer=null,this.pixelUnpackBuffer=null,this.copyReadBuffer=null,this.copyWriteBuffer=null,this.uniformBufferBindingPoints=new Array,this.readFramebuffer=null,this.drawFramebuffer=null,this.renderbuffer=null,this.activeTexture=0,this.textureUnitMap=new Array,this.vertexArrayObject=null}},uNt=class{constructor(e){this._allocations=new Map,e?Error.stackTraceLimit=1/0:(this.add=()=>{},this.remove=()=>{})}add(e){this._allocations.set(e,new Error().stack)}remove(e){this._allocations.delete(e)}get information(){let e="";if(this._allocations.size>0){e+=`${this._allocations.size} live object allocations: + }`}}_createHelperProgram(){const e=oze.getShaderSources();return this._rctx.programCache.acquire(e.vertex,e.fragment,new Map([]))}_createIndexbuffer(){return Yr.createIndex(this._rctx,Rr.STATIC_DRAW,new Uint32Array([0]))}run(){this._program.compiled&&this._indexBuffer&&(this._rctx.bindVAO(null),this._rctx.useProgram(this._program),this._rctx.bindBuffer(this._indexBuffer,fi.ELEMENT_ARRAY_BUFFER),this._rctx.drawElements(sr.POINTS,1,Yt.UNSIGNED_INT,0))}dispose(){this._program.dispose(),this._indexBuffer.dispose()}get test(){var e;return{cachedWebGLObjects:(e=this._indexBuffer)!=null&&e.glName?1:0}}},Xwe=class{constructor(){this.blend=!1,this.blendColor={r:0,g:0,b:0,a:0},this.blendFunction={srcRGB:ot.ONE,dstRGB:ot.ZERO,srcAlpha:ot.ONE,dstAlpha:ot.ZERO},this.blendEquation={mode:i1.ADD,modeAlpha:i1.ADD},this.colorMask={r:!0,g:!0,b:!0,a:!0},this.faceCulling=!1,this.cullFace=wm.BACK,this.frontFace=RP.CCW,this.scissorTest=!1,this.scissorRect={x:0,y:0,width:0,height:0},this.depthTest=!1,this.depthFunction=Zr.LESS,this.clearDepth=1,this.depthWrite=!0,this.depthRange={zNear:0,zFar:1},this.viewport=null,this.stencilTest=!1,this.polygonOffsetFill=!1,this.polygonOffset=[0,0],this.stencilFunction={face:wm.FRONT_AND_BACK,func:Zr.ALWAYS,ref:0,mask:1},this.clearStencil=0,this.stencilWriteMask=1,this.stencilOperation={face:wm.FRONT_AND_BACK,fail:ws.KEEP,zFail:ws.KEEP,zPass:ws.KEEP},this.clearColor={r:0,g:0,b:0,a:0},this.program=null,this.vertexBuffer=null,this.indexBuffer=null,this.uniformBuffer=null,this.pixelPackBuffer=null,this.pixelUnpackBuffer=null,this.copyReadBuffer=null,this.copyWriteBuffer=null,this.uniformBufferBindingPoints=new Array,this.readFramebuffer=null,this.drawFramebuffer=null,this.renderbuffer=null,this.activeTexture=0,this.textureUnitMap=new Array,this.vertexArrayObject=null}},lDt=class{constructor(e){this._allocations=new Map,e?Error.stackTraceLimit=1/0:(this.add=()=>{},this.remove=()=>{})}add(e){this._allocations.set(e,new Error().stack)}remove(e){this._allocations.delete(e)}get information(){let e="";if(this._allocations.size>0){e+=`${this._allocations.size} live object allocations: `;const i=new Map;this._allocations.forEach(r=>{i.set(r,(i.get(r)??0)+1)}),i.forEach((r,n)=>{const s=n.split(` `);s.shift(),s.shift(),e+=`${r}: ${s.shift()} `,s.forEach(o=>e+=` ${o} -`)})}return e}};const hNt={RECORD_ALLOCATIONS:!1};let dNt=class{constructor(){for(this._current=new Array,this._allocations=new uNt(hNt.RECORD_ALLOCATIONS);this._current.length<_o.COUNT;)this._current.push(0)}increment(e,i,r=1){this._current[e]+=r,this._allocations.add(i)}decrement(e,i,r=1){this._current[e]-=r,this._allocations.remove(i)}get current(){return this._current}get total(){return this.current.reduce((e,i,r)=>e+(r<_o.UNCOUNTED?i:0),0)}get resourceInformation(){let e="";if(this.total>0){e+=`Live objects: -`;for(let i=0;i<_o.COUNT;++i){const r=this._current[i];r>0&&(e+=`${_o[i]}: ${r} -`)}}return e+=this._allocations.information,e}},pNt=class{constructor(e,i,r){const n=i.textureFilterAnisotropic,s=r.maxAnisotropy??1/0;this.versionString=e.getParameter(e.VERSION),this.maxVertexTextureImageUnits=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxVertexAttributes=e.getParameter(e.MAX_VERTEX_ATTRIBS),this.maxMaxAnisotropy=n?Math.min(e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY),s):1,this.maxTextureImageUnits=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxRenderbufferSize=e.getParameter(e.MAX_RENDERBUFFER_SIZE),this.maxViewportDims=e.getParameter(e.MAX_VIEWPORT_DIMS),Ym(e)?(this.maxUniformBufferBindings=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS),this.maxVertexUniformBlocks=e.getParameter(e.MAX_VERTEX_UNIFORM_BLOCKS),this.maxFragmentUniformBlocks=e.getParameter(e.MAX_FRAGMENT_UNIFORM_BLOCKS),this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.uniformBufferOffsetAlignment=e.getParameter(e.UNIFORM_BUFFER_OFFSET_ALIGNMENT),this.maxArrayTextureLayers=e.getParameter(e.MAX_ARRAY_TEXTURE_LAYERS),this.maxSamples=e.getParameter(e.MAX_SAMPLES)):(this.maxUniformBufferBindings=0,this.maxVertexUniformBlocks=0,this.maxFragmentUniformBlocks=0,this.maxUniformBlockSize=0,this.uniformBufferOffsetAlignment=1,this.maxArrayTextureLayers=1,this.maxSamples=1)}};const fNt=["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"];var Xwe,cze={exports:{}};(Xwe=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"])!==void 0&&(cze.exports=Xwe);const mNt=oP(cze.exports);var Zwe,nre={exports:{}};nre.exports,Zwe=nre,function(t){var e=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"];e!==void 0&&(Zwe.exports=e)}();const Jwe=oP(nre.exports);var uze={exports:{}};(function(t){(function(e){var i=function(){return["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT","textureSize","texelFetch"]}();i!==void 0&&(t.exports=i)})()})(uze);const gNt=oP(uze.exports);var S0=999,Kwe=9999,jY=0,GY=1,Qwe=2,e2e=3,t2e=4,O8=5,yNt=6,vNt=7,_Nt=8,i2e=9,bNt=10,r2e=11,wNt=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function xNt(){var t,e,i,r=0,n=0,s=S0,o=[],l=[],c=1,f=0,_=0,x=!1,T=!1,A="";return function(ce){return l=[],ce!==null?I(ce.replace?ce.replace(/\r\n/g,` -`):ce):L()};function M(ce){ce.length&&l.push({type:wNt[s],data:ce,position:_,line:c,column:f})}function I(ce){var be;for(r=0,i=(A+=ce).length;t=A[r],r0)continue;ye=ce.slice(0,1).join("")}return M(ye),_+=ye.length,(o=o.slice(ye.length)).length}}function Q(){return/[^a-fA-F0-9]/.test(t)?(M(o.join("")),s=S0,r):(o.push(t),e=t,r+1)}function ne(){return t==="."||/[eE]/.test(t)?(o.push(t),s=O8,e=t,r+1):t==="x"&&o.length===1&&o[0]==="0"?(s=r2e,o.push(t),e=t,r+1):/[^\d]/.test(t)?(M(o.join("")),s=S0,r):(o.push(t),e=t,r+1)}function re(){return t==="f"&&(o.push(t),e=t,r+=1),/[eE]/.test(t)||t==="-"&&/[eE]/.test(e)?(o.push(t),e=t,r+1):/[^\d]/.test(t)?(M(o.join("")),s=S0,r):(o.push(t),e=t,r+1)}function he(){if(/[^\d\w_]/.test(t)){var ce=o.join("");return s=mNt.indexOf(ce)>-1?_Nt:gNt.indexOf(ce)>-1?vNt:yNt,M(o.join("")),s=S0,r}return o.push(t),e=t,r+1}}function SNt(t){var e=xNt(),i=[];return i=(i=i.concat(e(t))).concat(e(null))}function TNt(t){return SNt(t)}function ENt(t){return t.map(e=>e.type!=="eof"?e.data:"").join("")}const HY=new Set(["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"]);function CNt(t,e="100",i="300 es"){const r=/^\s*\#version\s+([0-9]+(\s+[a-zA-Z]+)?)\s*/;for(const n of t)if(n.type==="preprocessor"){const s=r.exec(n.data);if(s){const o=s[1].replaceAll(/\s\s+/g," ");if(o===i)return o;if(o===e)return n.data="#version "+i,e;throw new Error("unknown glsl version: "+o)}}return t.splice(0,0,{type:"preprocessor",data:"#version "+i},{type:"whitespace",data:` -`}),null}function ANt(t,e){for(let i=e-1;i>=0;i--){const r=t[i];if(r.type!=="whitespace"&&r.type!=="block-comment"){if(r.type!=="keyword")break;if(r.data==="attribute"||r.data==="in")return!0}}return!1}function CI(t,e,i,r){r=r||i;for(const n of t)if(n.type==="ident"&&n.data===i)return r in e?e[r]++:e[r]=0,CI(t,e,r+"_"+e[r],r);return i}function hze(t,e,i="afterVersion"){function r(c,f){for(let _=f;_c=0;--l){const c=i[l];if(c.type==="preprocessor"){const f=c.data.match(/\#extension\s+(.*)\:/);if(f&&f[1]&&HY.has(f[1].trim())){const T=i[l+1];i.splice(l,T&&T.type==="whitespace"?2:1)}const _=c.data.match(/\#ifdef\s+(.*)/);_&&_[1]&&HY.has(_[1].trim())&&(c.data="#if 1");const x=c.data.match(/\#ifndef\s+(.*)/);x&&x[1]&&HY.has(x[1].trim())&&(c.data="#if 0")}}return RNt(t,ENt(i))}function RNt(t,e){return e}const INt=4294967295;let $Nt=class{constructor(e,i,r,n,s=new Map){this._context=e,this._locations=n,this._uniformBlockBindings=s,this._refCount=1,this._compiled=!1,this._linesOfCode=0,this._nameToUniformLocation=new Map,this._nameToUniform1=new Map,this._nameToUniform1v=new Map,this._nameToUniform2=new Map,this._nameToUniform3=new Map,this._nameToUniform4=new Map,this._nameToUniformMatrix3=new Map,this._nameToUniformMatrix4=new Map,e||console.error("RenderingContext isn't initialized!"),i.length===0&&console.error("Shaders source should not be empty!"),this._context.type===cr.WEBGL2&&(i=n2e(i,tp.VERTEX_SHADER),r=n2e(r,tp.FRAGMENT_SHADER)),this._vShader=s2e(this._context,tp.VERTEX_SHADER,i),this._fShader=s2e(this._context,tp.FRAGMENT_SHADER,r),this._vShader&&this._fShader||console.error("Error loading shaders!"),this._context.instanceCounter.increment(_o.Shader,this),Fee()&&(this.vertexShader=i,this.fragmentShader=r);const o=this._context.gl,l=o.createProgram();if(o.attachShader(l,this._vShader),o.attachShader(l,this._fShader),this._locations.forEach((c,f)=>o.bindAttribLocation(l,c,f)),o.linkProgram(l),Fee()&&!o.getProgramParameter(l,o.LINK_STATUS)&&console.error(`Could not link shader -validated: ${o.getProgramParameter(l,o.VALIDATE_STATUS)}, gl error ${o.getError()}, vertex: ${o.getShaderParameter(this._vShader,o.COMPILE_STATUS)}, fragment: ${o.getShaderParameter(this._fShader,o.COMPILE_STATUS)}, info log: ${o.getProgramInfoLog(l)}, vertex source: ${this.vertexShader}, fragment source: ${this.fragmentShader}`),this._context.type===cr.WEBGL2){const c=o;for(const[f,_]of this._uniformBlockBindings){const x=c.getUniformBlockIndex(l,f);x0)return;const e=this._context.gl,i=this._context.instanceCounter;this._nameToUniformLocation.forEach(r=>r&&i.decrement(_o.Uniform,r)),this._nameToUniformLocation.clear(),this._vShader&&(this._linesOfCode>0&&(i.decrement(_o.LinesOfCode,this._vShader,this._linesOfCode),this._linesOfCode=0),e.deleteShader(this._vShader),this._vShader=null,i.decrement(_o.Shader,this)),this._fShader&&(e.deleteShader(this._fShader),this._fShader=null),this._glName&&(e.deleteProgram(this._glName),this._glName=null,i.decrement(_o.Program,this))}ref(){++this._refCount}_getUniformLocation(e){const i=this._nameToUniformLocation.get(e);if(i!==void 0)return i;if(this.glName){const r=this._context.gl.getUniformLocation(this.glName,e);return this._nameToUniformLocation.set(e,r),r&&this._context.instanceCounter.increment(_o.Uniform,r),r}return null}hasUniform(e){return this._getUniformLocation(e)!=null}setUniform1i(e,i){const r=this._nameToUniform1.get(e);r!==void 0&&i===r||(this._context.gl.uniform1i(this._getUniformLocation(e),i),this._nameToUniform1.set(e,i))}setUniform1iv(e,i){mg(this._nameToUniform1v,e,i)&&this._context.gl.uniform1iv(this._getUniformLocation(e),i)}setUniform2iv(e,i){mg(this._nameToUniform2,e,i)&&this._context.gl.uniform2iv(this._getUniformLocation(e),i)}setUniform3iv(e,i){mg(this._nameToUniform3,e,i)&&this._context.gl.uniform3iv(this._getUniformLocation(e),i)}setUniform4iv(e,i){mg(this._nameToUniform4,e,i)&&this._context.gl.uniform4iv(this._getUniformLocation(e),i)}setUniform1f(e,i){const r=this._nameToUniform1.get(e);r!==void 0&&i===r||(this._context.gl.uniform1f(this._getUniformLocation(e),i),this._nameToUniform1.set(e,i))}setUniform1fv(e,i){mg(this._nameToUniform1v,e,i)&&this._context.gl.uniform1fv(this._getUniformLocation(e),i)}setUniform2f(e,i,r){const n=this._nameToUniform2.get(e);n===void 0?(this._context.gl.uniform2f(this._getUniformLocation(e),i,r),this._nameToUniform2.set(e,[i,r])):i===n[0]&&r===n[1]||(this._context.gl.uniform2f(this._getUniformLocation(e),i,r),n[0]=i,n[1]=r)}setUniform2fv(e,i){mg(this._nameToUniform2,e,i)&&this._context.gl.uniform2fv(this._getUniformLocation(e),i)}setUniform3f(e,i,r,n){const s=this._nameToUniform3.get(e);s===void 0?(this._context.gl.uniform3f(this._getUniformLocation(e),i,r,n),this._nameToUniform3.set(e,[i,r,n])):i===s[0]&&r===s[1]&&n===s[2]||(this._context.gl.uniform3f(this._getUniformLocation(e),i,r,n),s[0]=i,s[1]=r,s[2]=n)}setUniform3fv(e,i){mg(this._nameToUniform3,e,i)&&this._context.gl.uniform3fv(this._getUniformLocation(e),i)}setUniform4f(e,i,r,n,s){const o=this._nameToUniform4.get(e);o===void 0?(this._context.gl.uniform4f(this._getUniformLocation(e),i,r,n,s),this._nameToUniform4.set(e,[i,r,n,s])):o!==void 0&&i===o[0]&&r===o[1]&&n===o[2]&&s===o[3]||(this._context.gl.uniform4f(this._getUniformLocation(e),i,r,n,s),o[0]=i,o[1]=r,o[2]=n,o[3]=s)}setUniform4fv(e,i){mg(this._nameToUniform4,e,i)&&this._context.gl.uniform4fv(this._getUniformLocation(e),i)}setUniformMatrix3fv(e,i,r=!1){mg(this._nameToUniformMatrix3,e,i)&&this._context.gl.uniformMatrix3fv(this._getUniformLocation(e),r,i)}setUniformMatrix4fv(e,i,r=!1){mg(this._nameToUniformMatrix4,e,i)&&this._context.gl.uniformMatrix4fv(this._getUniformLocation(e),r,i)}stop(){}};function s2e(t,e,i){const r=t.gl,n=r.createShader(e);return r.shaderSource(n,i),r.compileShader(n),Fee()&&!r.getShaderParameter(n,r.COMPILE_STATUS)&&(console.error("Compile error in ".concat(e===tp.VERTEX_SHADER?"vertex":"fragment"," shader")),console.error(r.getShaderInfoLog(n)),console.error(LNt(i))),n}function LNt(t){let e=2;return t.replaceAll(` +`)})}return e}};const cDt={RECORD_ALLOCATIONS:!1};let uDt=class{constructor(){for(this._current=new Array,this._allocations=new lDt(cDt.RECORD_ALLOCATIONS);this._current.lengthe+(r0){e+=`Live objects: +`;for(let i=0;i0&&(e+=`${bo[i]}: ${r} +`)}}return e+=this._allocations.information,e}},hDt=class{constructor(e,i,r){const n=i.textureFilterAnisotropic,s=r.maxAnisotropy??1/0;this.versionString=e.getParameter(e.VERSION),this.maxVertexTextureImageUnits=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this.maxVertexAttributes=e.getParameter(e.MAX_VERTEX_ATTRIBS),this.maxMaxAnisotropy=n?Math.min(e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY),s):1,this.maxTextureImageUnits=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),this.maxRenderbufferSize=e.getParameter(e.MAX_RENDERBUFFER_SIZE),this.maxViewportDims=e.getParameter(e.MAX_VIEWPORT_DIMS),Qm(e)?(this.maxUniformBufferBindings=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS),this.maxVertexUniformBlocks=e.getParameter(e.MAX_VERTEX_UNIFORM_BLOCKS),this.maxFragmentUniformBlocks=e.getParameter(e.MAX_FRAGMENT_UNIFORM_BLOCKS),this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.uniformBufferOffsetAlignment=e.getParameter(e.UNIFORM_BUFFER_OFFSET_ALIGNMENT),this.maxArrayTextureLayers=e.getParameter(e.MAX_ARRAY_TEXTURE_LAYERS),this.maxSamples=e.getParameter(e.MAX_SAMPLES)):(this.maxUniformBufferBindings=0,this.maxVertexUniformBlocks=0,this.maxFragmentUniformBlocks=0,this.maxUniformBlockSize=0,this.uniformBufferOffsetAlignment=1,this.maxArrayTextureLayers=1,this.maxSamples=1)}};const dDt=["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"];var Zwe,aze={exports:{}};(Zwe=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"])!==void 0&&(aze.exports=Zwe);const pDt=h5(aze.exports);var Jwe,dre={exports:{}};dre.exports,Jwe=dre,function(t){var e=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"];e!==void 0&&(Jwe.exports=e)}();const Kwe=h5(dre.exports);var lze={exports:{}};(function(t){(function(e){var i=function(){return["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT","textureSize","texelFetch"]}();i!==void 0&&(t.exports=i)})()})(lze);const fDt=h5(lze.exports);var C0=999,Qwe=9999,QY=0,eX=1,e2e=2,t2e=3,i2e=4,N8=5,mDt=6,gDt=7,yDt=8,r2e=9,vDt=10,n2e=11,_Dt=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function bDt(){var t,e,i,r=0,n=0,s=C0,o=[],a=[],c=1,p=0,_=0,x=!1,S=!1,C="";return function(ce){return a=[],ce!==null?P(ce.replace?ce.replace(/\r\n/g,` +`):ce):$()};function M(ce){ce.length&&a.push({type:_Dt[s],data:ce,position:_,line:c,column:p})}function P(ce){var ve;for(r=0,i=(C+=ce).length;t=C[r],r0)continue;ge=ce.slice(0,1).join("")}return M(ge),_+=ge.length,(o=o.slice(ge.length)).length}}function Q(){return/[^a-fA-F0-9]/.test(t)?(M(o.join("")),s=C0,r):(o.push(t),e=t,r+1)}function ne(){return t==="."||/[eE]/.test(t)?(o.push(t),s=N8,e=t,r+1):t==="x"&&o.length===1&&o[0]==="0"?(s=n2e,o.push(t),e=t,r+1):/[^\d]/.test(t)?(M(o.join("")),s=C0,r):(o.push(t),e=t,r+1)}function ie(){return t==="f"&&(o.push(t),e=t,r+=1),/[eE]/.test(t)||t==="-"&&/[eE]/.test(e)?(o.push(t),e=t,r+1):/[^\d]/.test(t)?(M(o.join("")),s=C0,r):(o.push(t),e=t,r+1)}function he(){if(/[^\d\w_]/.test(t)){var ce=o.join("");return s=pDt.indexOf(ce)>-1?yDt:fDt.indexOf(ce)>-1?gDt:mDt,M(o.join("")),s=C0,r}return o.push(t),e=t,r+1}}function wDt(t){var e=bDt(),i=[];return i=(i=i.concat(e(t))).concat(e(null))}function xDt(t){return wDt(t)}function SDt(t){return t.map(e=>e.type!=="eof"?e.data:"").join("")}const tX=new Set(["GL_OES_standard_derivatives","GL_EXT_frag_depth","GL_EXT_draw_buffers","GL_EXT_shader_texture_lod"]);function TDt(t,e="100",i="300 es"){const r=/^\s*\#version\s+([0-9]+(\s+[a-zA-Z]+)?)\s*/;for(const n of t)if(n.type==="preprocessor"){const s=r.exec(n.data);if(s){const o=s[1].replaceAll(/\s\s+/g," ");if(o===i)return o;if(o===e)return n.data="#version "+i,e;throw new Error("unknown glsl version: "+o)}}return t.splice(0,0,{type:"preprocessor",data:"#version "+i},{type:"whitespace",data:` +`}),null}function EDt(t,e){for(let i=e-1;i>=0;i--){const r=t[i];if(r.type!=="whitespace"&&r.type!=="block-comment"){if(r.type!=="keyword")break;if(r.data==="attribute"||r.data==="in")return!0}}return!1}function F4(t,e,i,r){r=r||i;for(const n of t)if(n.type==="ident"&&n.data===i)return r in e?e[r]++:e[r]=0,F4(t,e,r+"_"+e[r],r);return i}function cze(t,e,i="afterVersion"){function r(c,p){for(let _=p;_c=0;--a){const c=i[a];if(c.type==="preprocessor"){const p=c.data.match(/\#extension\s+(.*)\:/);if(p&&p[1]&&tX.has(p[1].trim())){const S=i[a+1];i.splice(a,S&&S.type==="whitespace"?2:1)}const _=c.data.match(/\#ifdef\s+(.*)/);_&&_[1]&&tX.has(_[1].trim())&&(c.data="#if 1");const x=c.data.match(/\#ifndef\s+(.*)/);x&&x[1]&&tX.has(x[1].trim())&&(c.data="#if 0")}}return ODt(t,SDt(i))}function ODt(t,e){return e}const PDt=4294967295;let RDt=class{constructor(e,i,r,n,s=new Map){this._context=e,this._locations=n,this._uniformBlockBindings=s,this._refCount=1,this._compiled=!1,this._linesOfCode=0,this._nameToUniformLocation=new Map,this._nameToUniform1=new Map,this._nameToUniform1v=new Map,this._nameToUniform2=new Map,this._nameToUniform3=new Map,this._nameToUniform4=new Map,this._nameToUniformMatrix3=new Map,this._nameToUniformMatrix4=new Map,e||console.error("RenderingContext isn't initialized!"),i.length===0&&console.error("Shaders source should not be empty!"),this._context.type===cr.WEBGL2&&(i=s2e(i,sp.VERTEX_SHADER),r=s2e(r,sp.FRAGMENT_SHADER)),this._vShader=o2e(this._context,sp.VERTEX_SHADER,i),this._fShader=o2e(this._context,sp.FRAGMENT_SHADER,r),this._vShader&&this._fShader||console.error("Error loading shaders!"),this._context.instanceCounter.increment(bo.Shader,this),Hee()&&(this.vertexShader=i,this.fragmentShader=r);const o=this._context.gl,a=o.createProgram();if(o.attachShader(a,this._vShader),o.attachShader(a,this._fShader),this._locations.forEach((c,p)=>o.bindAttribLocation(a,c,p)),o.linkProgram(a),Hee()&&!o.getProgramParameter(a,o.LINK_STATUS)&&console.error(`Could not link shader +validated: ${o.getProgramParameter(a,o.VALIDATE_STATUS)}, gl error ${o.getError()}, vertex: ${o.getShaderParameter(this._vShader,o.COMPILE_STATUS)}, fragment: ${o.getShaderParameter(this._fShader,o.COMPILE_STATUS)}, info log: ${o.getProgramInfoLog(a)}, vertex source: ${this.vertexShader}, fragment source: ${this.fragmentShader}`),this._context.type===cr.WEBGL2){const c=o;for(const[p,_]of this._uniformBlockBindings){const x=c.getUniformBlockIndex(a,p);x0)return;const e=this._context.gl,i=this._context.instanceCounter;this._nameToUniformLocation.forEach(r=>r&&i.decrement(bo.Uniform,r)),this._nameToUniformLocation.clear(),this._vShader&&(this._linesOfCode>0&&(i.decrement(bo.LinesOfCode,this._vShader,this._linesOfCode),this._linesOfCode=0),e.deleteShader(this._vShader),this._vShader=null,i.decrement(bo.Shader,this)),this._fShader&&(e.deleteShader(this._fShader),this._fShader=null),this._glName&&(e.deleteProgram(this._glName),this._glName=null,i.decrement(bo.Program,this))}ref(){++this._refCount}_getUniformLocation(e){const i=this._nameToUniformLocation.get(e);if(i!==void 0)return i;if(this.glName){const r=this._context.gl.getUniformLocation(this.glName,e);return this._nameToUniformLocation.set(e,r),r&&this._context.instanceCounter.increment(bo.Uniform,r),r}return null}hasUniform(e){return this._getUniformLocation(e)!=null}setUniform1i(e,i){const r=this._nameToUniform1.get(e);r!==void 0&&i===r||(this._context.gl.uniform1i(this._getUniformLocation(e),i),this._nameToUniform1.set(e,i))}setUniform1iv(e,i){bg(this._nameToUniform1v,e,i)&&this._context.gl.uniform1iv(this._getUniformLocation(e),i)}setUniform2iv(e,i){bg(this._nameToUniform2,e,i)&&this._context.gl.uniform2iv(this._getUniformLocation(e),i)}setUniform3iv(e,i){bg(this._nameToUniform3,e,i)&&this._context.gl.uniform3iv(this._getUniformLocation(e),i)}setUniform4iv(e,i){bg(this._nameToUniform4,e,i)&&this._context.gl.uniform4iv(this._getUniformLocation(e),i)}setUniform1f(e,i){const r=this._nameToUniform1.get(e);r!==void 0&&i===r||(this._context.gl.uniform1f(this._getUniformLocation(e),i),this._nameToUniform1.set(e,i))}setUniform1fv(e,i){bg(this._nameToUniform1v,e,i)&&this._context.gl.uniform1fv(this._getUniformLocation(e),i)}setUniform2f(e,i,r){const n=this._nameToUniform2.get(e);n===void 0?(this._context.gl.uniform2f(this._getUniformLocation(e),i,r),this._nameToUniform2.set(e,[i,r])):i===n[0]&&r===n[1]||(this._context.gl.uniform2f(this._getUniformLocation(e),i,r),n[0]=i,n[1]=r)}setUniform2fv(e,i){bg(this._nameToUniform2,e,i)&&this._context.gl.uniform2fv(this._getUniformLocation(e),i)}setUniform3f(e,i,r,n){const s=this._nameToUniform3.get(e);s===void 0?(this._context.gl.uniform3f(this._getUniformLocation(e),i,r,n),this._nameToUniform3.set(e,[i,r,n])):i===s[0]&&r===s[1]&&n===s[2]||(this._context.gl.uniform3f(this._getUniformLocation(e),i,r,n),s[0]=i,s[1]=r,s[2]=n)}setUniform3fv(e,i){bg(this._nameToUniform3,e,i)&&this._context.gl.uniform3fv(this._getUniformLocation(e),i)}setUniform4f(e,i,r,n,s){const o=this._nameToUniform4.get(e);o===void 0?(this._context.gl.uniform4f(this._getUniformLocation(e),i,r,n,s),this._nameToUniform4.set(e,[i,r,n,s])):o!==void 0&&i===o[0]&&r===o[1]&&n===o[2]&&s===o[3]||(this._context.gl.uniform4f(this._getUniformLocation(e),i,r,n,s),o[0]=i,o[1]=r,o[2]=n,o[3]=s)}setUniform4fv(e,i){bg(this._nameToUniform4,e,i)&&this._context.gl.uniform4fv(this._getUniformLocation(e),i)}setUniformMatrix3fv(e,i,r=!1){bg(this._nameToUniformMatrix3,e,i)&&this._context.gl.uniformMatrix3fv(this._getUniformLocation(e),r,i)}setUniformMatrix4fv(e,i,r=!1){bg(this._nameToUniformMatrix4,e,i)&&this._context.gl.uniformMatrix4fv(this._getUniformLocation(e),r,i)}stop(){}};function o2e(t,e,i){const r=t.gl,n=r.createShader(e);return r.shaderSource(n,i),r.compileShader(n),Hee()&&!r.getShaderParameter(n,r.COMPILE_STATUS)&&(console.error("Compile error in ".concat(e===sp.VERTEX_SHADER?"vertex":"fragment"," shader")),console.error(r.getShaderInfoLog(n)),console.error(IDt(i))),n}function IDt(t){let e=2;return t.replaceAll(` `,()=>` -`+DNt(e++)+":")}function DNt(t){return t>=1e3?t.toString():(" "+t).slice(-3)}function mg(t,e,i){const r=t.get(e);return r?jre(r,i):(t.set(e,Array.from(i)),!0)}let NNt=class{constructor(e){this._rctx=e,this._store=new TP}dispose(){this._store.forEach(e=>e.forEach(i=>i.dispose())),this._store.clear()}acquire(e,i,r,n){const s=this._store.get(e,i);if(s!=null)return s.ref(),s;const o=new $Nt(this._rctx,e,i,r,n);return o.ref(),this._store.set(e,i,o),o}get test(){let e=0;return this._store.forEach(i=>i.forEach(r=>e+=r.hasGLName?2:1)),{cachedWebGLProgramObjects:e}}},g6=class{constructor(){this._result=!1}dispose(){this._program=Kt(this._program)}get result(){return this._program!=null&&(this._result=this._test(this._program),this.dispose()),this._result}},FNt=class extends g6{constructor(e){super(),this._rctx=e,this._helperProgram=null,this._rctx.type===cr.WEBGL2&&Le("mac")&&Le("chrome")&&(this._program=this._prepareProgram(),this._helperProgram=this._prepareHelperProgram())}dispose(){var e;super.dispose(),(e=this._helperProgram)==null||e.dispose(),this._helperProgram=null}_test(e){const i=this._rctx,r=i.getBoundFramebufferObject(),{x:n,y:s,width:o,height:l}=i.getViewport();i.resetState();const c=new tn(1);c.wrapMode=Bi.CLAMP_TO_EDGE,c.samplingMode=ki.NEAREST;const f=new Hm(i,c),_=Yr.createIndex(this._rctx,Pr.STATIC_DRAW,new Uint8Array([0]));i.bindFramebuffer(f),i.setViewport(0,0,1,1),i.useProgram(this._helperProgram),i.bindBuffer(_,fi.ELEMENT_ARRAY_BUFFER),i.drawElements(sr.POINTS,1,Yt.UNSIGNED_BYTE,0),i.useProgram(e),i.bindVAO(null),i.drawArrays(sr.TRIANGLES,0,258);const x=new Uint8Array(4);return f.readPixels(0,0,1,1,ci.RGBA,ga.UNSIGNED_BYTE,x),i.setViewport(n,s,o,l),i.bindFramebuffer(r),f.dispose(),_.dispose(),x[0]===255}_prepareProgram(){const i=`#version 300 es +`+$Dt(e++)+":")}function $Dt(t){return t>=1e3?t.toString():(" "+t).slice(-3)}function bg(t,e,i){const r=t.get(e);return r?lne(r,i):(t.set(e,Array.from(i)),!0)}let LDt=class{constructor(e){this._rctx=e,this._store=new L5}dispose(){this._store.forEach(e=>e.forEach(i=>i.dispose())),this._store.clear()}acquire(e,i,r,n){const s=this._store.get(e,i);if(s!=null)return s.ref(),s;const o=new RDt(this._rctx,e,i,r,n);return o.ref(),this._store.set(e,i,o),o}get test(){let e=0;return this._store.forEach(i=>i.forEach(r=>e+=r.hasGLName?2:1)),{cachedWebGLProgramObjects:e}}},b6=class{constructor(){this._result=!1}dispose(){this._program=Kt(this._program)}get result(){return this._program!=null&&(this._result=this._test(this._program),this.dispose()),this._result}},DDt=class extends b6{constructor(e){super(),this._rctx=e,this._helperProgram=null,this._rctx.type===cr.WEBGL2&&$e("mac")&&$e("chrome")&&(this._program=this._prepareProgram(),this._helperProgram=this._prepareHelperProgram())}dispose(){var e;super.dispose(),(e=this._helperProgram)==null||e.dispose(),this._helperProgram=null}_test(e){const i=this._rctx,r=i.getBoundFramebufferObject(),{x:n,y:s,width:o,height:a}=i.getViewport();i.resetState();const c=new rn(1);c.wrapMode=Bi.CLAMP_TO_EDGE,c.samplingMode=ki.NEAREST;const p=new Zm(i,c),_=Yr.createIndex(this._rctx,Rr.STATIC_DRAW,new Uint8Array([0]));i.bindFramebuffer(p),i.setViewport(0,0,1,1),i.useProgram(this._helperProgram),i.bindBuffer(_,fi.ELEMENT_ARRAY_BUFFER),i.drawElements(sr.POINTS,1,Yt.UNSIGNED_BYTE,0),i.useProgram(e),i.bindVAO(null),i.drawArrays(sr.TRIANGLES,0,258);const x=new Uint8Array(4);return p.readPixels(0,0,1,1,ci.RGBA,ya.UNSIGNED_BYTE,x),i.setViewport(n,s,o,a),i.bindFramebuffer(r),p.dispose(),_.dispose(),x[0]===255}_prepareProgram(){const i=`#version 300 es precision highp float; out float triangleId; @@ -5433,7 +5422,7 @@ validated: ${o.getProgramParameter(l,o.VALIDATE_STATUS)}, gl error ${o.getError( void main(void) { fragColor = triangleId == ${V.float(85)} ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0); } - `;return this._rctx.programCache.acquire(i,r,new Map([]))}_prepareHelperProgram(){const e=aze.getShaderSources();return this._rctx.programCache.acquire(e.vertex,e.fragment,new Map([]))}},kNt=class extends g6{constructor(e){super(),this._rctx=e,this._program=o2e(this._rctx,!1),this._obfuscated=o2e(this._rctx,!0)}dispose(){super.dispose(),this._obfuscated=Kt(this._obfuscated)}_test(e){if(Le("force-double-precision-obfuscation"))return!0;if(this._obfuscated==null)return!1;const i=this._runProgram(e),r=this._runProgram(this._obfuscated);return i!==0&&(r===0||i/r>5)}_runProgram(e){const i=this._rctx;i.resetState();const r=new tn(1);r.wrapMode=Bi.CLAMP_TO_EDGE,r.samplingMode=ki.NEAREST;const n=new Hm(i,r),s=Yr.createVertex(i,Pr.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),o=new Qf(i,new Map([["position",0]]),{geometry:[new Al("position",2,Yt.UNSIGNED_SHORT,0,4)]},{geometry:s}),l=nt(5633261287538229e-9,2626832878767164e-9,1.4349880495278358e6),c=nt(563327146742708e-8,2.6268736381334523e6,1434963231608387e-9),f=new Float32Array(6);Hee(l,f,3);const _=new Float32Array(6);Hee(c,_,3),i.useProgram(e),e.setUniform3f("u_highA",f[0],f[2],f[4]),e.setUniform3f("u_lowA",f[1],f[3],f[5]),e.setUniform3f("u_highB",_[0],_[2],_[4]),e.setUniform3f("u_lowB",_[1],_[3],_[5]),i.bindFramebuffer(n),i.setViewport(0,0,1,1),i.bindVAO(o),i.drawArrays(sr.TRIANGLE_STRIP,0,4);const x=new Uint8Array(4);n.readPixels(0,0,1,1,ci.RGBA,ga.UNSIGNED_BYTE,x),o.dispose(),n.dispose();const T=(l[2]-c[2])/25,A=jle(x);return Math.abs(T-A)}};function o2e(t,e){const i=` + `;return this._rctx.programCache.acquire(i,r,new Map([]))}_prepareHelperProgram(){const e=sze.getShaderSources();return this._rctx.programCache.acquire(e.vertex,e.fragment,new Map([]))}},NDt=class extends b6{constructor(e){super(),this._rctx=e,this._program=a2e(this._rctx,!1),this._obfuscated=a2e(this._rctx,!0)}dispose(){super.dispose(),this._obfuscated=Kt(this._obfuscated)}_test(e){if($e("force-double-precision-obfuscation"))return!0;if(this._obfuscated==null)return!1;const i=this._runProgram(e),r=this._runProgram(this._obfuscated);return i!==0&&(r===0||i/r>5)}_runProgram(e){const i=this._rctx;i.resetState();const r=new rn(1);r.wrapMode=Bi.CLAMP_TO_EDGE,r.samplingMode=ki.NEAREST;const n=new Zm(i,r),s=Yr.createVertex(i,Rr.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),o=new r0(i,new Map([["position",0]]),{geometry:[new Ol("position",2,Yt.UNSIGNED_SHORT,0,4)]},{geometry:s}),a=st(5633261287538229e-9,2626832878767164e-9,1.4349880495278358e6),c=st(563327146742708e-8,2.6268736381334523e6,1434963231608387e-9),p=new Float32Array(6);Qee(a,p,3);const _=new Float32Array(6);Qee(c,_,3),i.useProgram(e),e.setUniform3f("u_highA",p[0],p[2],p[4]),e.setUniform3f("u_lowA",p[1],p[3],p[5]),e.setUniform3f("u_highB",_[0],_[2],_[4]),e.setUniform3f("u_lowB",_[1],_[3],_[5]),i.bindFramebuffer(n),i.setViewport(0,0,1,1),i.bindVAO(o),i.drawArrays(sr.TRIANGLE_STRIP,0,4);const x=new Uint8Array(4);n.readPixels(0,0,1,1,ci.RGBA,ya.UNSIGNED_BYTE,x),o.dispose(),n.dispose();const S=(a[2]-c[2])/25,C=ice(x);return Math.abs(S-C)}};function a2e(t,e){const i=` precision highp float; @@ -5516,7 +5505,7 @@ validated: ${o.getProgramParameter(l,o.VALIDATE_STATUS)}, gl error ${o.getError( void main() { gl_FragColor = v_color; } - `;return t.programCache.acquire(i,r,new Map([["position",0]]))}let zNt=class extends g6{constructor(e){var n,s,o,l,c;if(super(),this._rctx=e,!e.gl)return;if(e.type===cr.WEBGL1)return void(this._result=!(!((n=e.capabilities.textureFloat)!=null&&n.textureFloat)||!((s=e.capabilities.colorBufferFloat)!=null&&s.textureFloat)));if(!((o=e.capabilities.textureFloat)!=null&&o.textureFloat&&((l=e.capabilities.colorBufferFloat)!=null&&l.textureFloat)&&((c=e.capabilities.colorBufferFloat)!=null&&c.floatBlend)))return;const i=` + `;return t.programCache.acquire(i,r,new Map([["position",0]]))}let FDt=class extends b6{constructor(e){var n,s,o,a,c;if(super(),this._rctx=e,!e.gl)return;if(e.type===cr.WEBGL1)return void(this._result=!(!((n=e.capabilities.textureFloat)!=null&&n.textureFloat)||!((s=e.capabilities.colorBufferFloat)!=null&&s.textureFloat)));if(!((o=e.capabilities.textureFloat)!=null&&o.textureFloat&&((a=e.capabilities.colorBufferFloat)!=null&&a.textureFloat)&&((c=e.capabilities.colorBufferFloat)!=null&&c.floatBlend)))return;const i=` precision highp float; attribute vec2 a_pos; @@ -5529,7 +5518,7 @@ validated: ${o.getProgramParameter(l,o.VALIDATE_STATUS)}, gl error ${o.getError( void main() { gl_FragColor = vec4(0.5, 0.5, 0.5, 0.5); } - `;this._program=e.programCache.acquire(i,r,new Map([["a_pos",0]]))}_test(e){const i=this._rctx,r=new tn(1);r.wrapMode=Bi.CLAMP_TO_EDGE,r.dataType=ga.FLOAT,r.internalFormat=zt.RGBA32F,r.samplingMode=ki.NEAREST;const n=new Hm(i,r),s=Yr.createVertex(i,Pr.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),o=new Qf(i,new Map([["a_pos",0]]),{geometry:[new Al("a_pos",2,Yt.UNSIGNED_SHORT,0,4)]},{geometry:s});i.useProgram(e);const l=i.getBoundFramebufferObject(),{x:c,y:f,width:_,height:x}=i.getViewport();i.bindFramebuffer(n),i.setViewport(0,0,1,1),i.bindVAO(o),i.drawArrays(sr.TRIANGLE_STRIP,0,4);const T=Ti({blending:f6e});i.setPipelineState(T),i.drawArrays(sr.TRIANGLE_STRIP,0,4);const A=i.gl.getError();return i.setViewport(c,f,_,x),i.bindFramebuffer(l),o.dispose(),n.dispose(),A!==1282||(console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."),!1)}},UNt=class extends g6{constructor(e){super(),this._rctx=e;const i=` + `;this._program=e.programCache.acquire(i,r,new Map([["a_pos",0]]))}_test(e){const i=this._rctx,r=new rn(1);r.wrapMode=Bi.CLAMP_TO_EDGE,r.dataType=ya.FLOAT,r.internalFormat=zt.RGBA32F,r.samplingMode=ki.NEAREST;const n=new Zm(i,r),s=Yr.createVertex(i,Rr.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),o=new r0(i,new Map([["a_pos",0]]),{geometry:[new Ol("a_pos",2,Yt.UNSIGNED_SHORT,0,4)]},{geometry:s});i.useProgram(e);const a=i.getBoundFramebufferObject(),{x:c,y:p,width:_,height:x}=i.getViewport();i.bindFramebuffer(n),i.setViewport(0,0,1,1),i.bindVAO(o),i.drawArrays(sr.TRIANGLE_STRIP,0,4);const S=Ti({blending:u6e});i.setPipelineState(S),i.drawArrays(sr.TRIANGLE_STRIP,0,4);const C=i.gl.getError();return i.setViewport(c,p,_,x),i.bindFramebuffer(a),o.dispose(),n.dispose(),C!==1282||(console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."),!1)}},kDt=class extends b6{constructor(e){super(),this._rctx=e;const i=` precision highp float; attribute vec2 a_pos; uniform highp sampler2D u_texture; @@ -5554,7 +5543,7 @@ validated: ${o.getProgramParameter(l,o.VALIDATE_STATUS)}, gl error ${o.getError( void main() { gl_FragColor = v_color; } - `;this._program=e.programCache.acquire(i,r,new Map([["a_pos",0]]))}_test(e){const i=this._rctx,r=new tn(1);r.wrapMode=Bi.CLAMP_TO_EDGE,r.samplingMode=ki.NEAREST;const n=new Hm(i,r),s=new Uint8Array(4),o=Yr.createVertex(i,Pr.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),l=new Qf(i,new Map([["a_position",0]]),{geometry:[new Al("a_position",2,Yt.SHORT,0,4)]},{geometry:o});i.useProgram(e);const c=new Ai(i,r,new Uint8Array([2,255,0,0]));e.setUniform1i("u_texture",0),i.bindTexture(c,0);const f=i.getBoundFramebufferObject();i.bindFramebuffer(n),i.useProgram(e);const{x:_,y:x,width:T,height:A}=i.getViewport();i.setViewport(0,0,1,1),i.bindVAO(l),i.drawArrays(sr.TRIANGLE_STRIP,0,4),i.setViewport(_,x,T,A),n.readPixels(0,0,1,1,ci.RGBA,ga.UNSIGNED_BYTE,s),l.dispose(),n.dispose();const M=s[0]!==255||s[1]!==255||s[2]!==255||s[3]!==255;return M&&Ce.getLogger("esri.views.webgl.testSamplerPrecision").warn(`A problem was detected with your graphics driver. Your driver does not appear to honor sampler precision specifiers, which may result in rendering issues due to numerical instability. We recommend ensuring that your drivers have been updated to the latest version. Applying lowp sampler workaround. [${s[0]}.${s[1]}.${s[2]}.${s[3]}]`),i.bindFramebuffer(f),M}};new Al("a_pos",2,Yt.BYTE,0,2);new Al("a_pos",2,Yt.BYTE,0,4),new Al("a_tex",2,Yt.BYTE,2,4);const VNt={geometry:[new Al("a_pos",2,Yt.UNSIGNED_SHORT,0,4)]};let BNt=class extends g6{constructor(e){super(),this._rctx=e;const i=` + `;this._program=e.programCache.acquire(i,r,new Map([["a_pos",0]]))}_test(e){const i=this._rctx,r=new rn(1);r.wrapMode=Bi.CLAMP_TO_EDGE,r.samplingMode=ki.NEAREST;const n=new Zm(i,r),s=new Uint8Array(4),o=Yr.createVertex(i,Rr.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),a=new r0(i,new Map([["a_position",0]]),{geometry:[new Ol("a_position",2,Yt.SHORT,0,4)]},{geometry:o});i.useProgram(e);const c=new Ai(i,r,new Uint8Array([2,255,0,0]));e.setUniform1i("u_texture",0),i.bindTexture(c,0);const p=i.getBoundFramebufferObject();i.bindFramebuffer(n),i.useProgram(e);const{x:_,y:x,width:S,height:C}=i.getViewport();i.setViewport(0,0,1,1),i.bindVAO(a),i.drawArrays(sr.TRIANGLE_STRIP,0,4),i.setViewport(_,x,S,C),n.readPixels(0,0,1,1,ci.RGBA,ya.UNSIGNED_BYTE,s),a.dispose(),n.dispose();const M=s[0]!==255||s[1]!==255||s[2]!==255||s[3]!==255;return M&&Ce.getLogger("esri.views.webgl.testSamplerPrecision").warn(`A problem was detected with your graphics driver. Your driver does not appear to honor sampler precision specifiers, which may result in rendering issues due to numerical instability. We recommend ensuring that your drivers have been updated to the latest version. Applying lowp sampler workaround. [${s[0]}.${s[1]}.${s[2]}.${s[3]}]`),i.bindFramebuffer(p),M}};new Ol("a_pos",2,Yt.BYTE,0,2);new Ol("a_pos",2,Yt.BYTE,0,4),new Ol("a_tex",2,Yt.BYTE,2,4);const zDt={geometry:[new Ol("a_pos",2,Yt.UNSIGNED_SHORT,0,4)]};let UDt=class extends b6{constructor(e){super(),this._rctx=e;const i=` precision highp float; attribute vec2 a_pos; @@ -5574,18 +5563,29 @@ validated: ${o.getProgramParameter(l,o.VALIDATE_STATUS)}, gl error ${o.getError( void main() { gl_FragColor = texture2D(u_texture, v_uv); } - `;this._program=e.programCache.acquire(i,r,new Map([["a_pos",0]]))}dispose(){super.dispose()}_test(e){const i=this._rctx;if(!i.gl)return e.dispose(),!0;const r=new tn(1);r.wrapMode=Bi.CLAMP_TO_EDGE,r.samplingMode=ki.NEAREST;const n=new Hm(i,r),s=Yr.createVertex(i,Pr.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),o=new Qf(i,new Map([["a_pos",0]]),VNt,{geometry:s}),l=new tn;l.samplingMode=ki.LINEAR,l.wrapMode=Bi.CLAMP_TO_EDGE;const c=new Ai(i,l,AI);i.useProgram(e),i.bindTexture(c,0),e.setUniform1i("u_texture",0);const f=i.getBoundFramebufferObject(),{x:_,y:x,width:T,height:A}=i.getViewport();i.bindFramebuffer(n),i.setViewport(0,0,1,1),i.setClearColor(0,0,0,0),i.setBlendingEnabled(!1),i.clearSafe(In.COLOR_BUFFER_BIT),i.bindVAO(o),i.drawArrays(sr.TRIANGLE_STRIP,0,4);const M=new Uint8Array(4);return n.readPixels(0,0,1,1,ci.RGBA,ga.UNSIGNED_BYTE,M),o.dispose(),n.dispose(),c.dispose(),i.setViewport(_,x,T,A),i.bindFramebuffer(f),M[0]!==255}};const AI=new Image;AI.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",AI.width=5,AI.height=5,AI.decode();let jNt=class{constructor(e){this.rctx=e,this.floatBufferBlend=new zNt(e),this.svgPremultipliesAlpha=new BNt(e),this.doublePrecisionRequiresObfuscation=new kNt(e),this.ignoresSamplerPrecision=new UNt(e),this.drawArraysRequiresIndicesTypeReset=new FNt(e)}dispose(){this.ignoresSamplerPrecision.dispose(),this.doublePrecisionRequiresObfuscation.dispose(),this.svgPremultipliesAlpha.dispose(),this.floatBufferBlend.dispose(),this.drawArraysRequiresIndicesTypeReset.dispose()}};function GNt(t,e){if(e.disjointTimerQuery)return null;if(Ym(t))return{drawBuffers:t.drawBuffers.bind(t),MAX_DRAW_BUFFERS:t.MAX_DRAW_BUFFERS,MAX_COLOR_ATTACHMENTS:t.MAX_COLOR_ATTACHMENTS};if(e.drawBuffers)return null;const i=t.getExtension("WEBGL_draw_buffers");return i?{drawBuffers:i.drawBuffersWEBGL.bind(i),MAX_DRAW_BUFFERS:i.MAX_DRAW_BUFFERS_WEBGL,MAX_COLOR_ATTACHMENTS:i.MAX_COLOR_ATTACHMENTS_WEBGL}:null}function HNt(t,e){if(e.compressedTextureETC)return null;const i=t.getExtension("WEBGL_compressed_texture_etc");return i?{COMPRESSED_R11_EAC:i.COMPRESSED_R11_EAC,COMPRESSED_SIGNED_R11_EAC:i.COMPRESSED_SIGNED_R11_EAC,COMPRESSED_RG11_EAC:i.COMPRESSED_RG11_EAC,COMPRESSED_SIGNED_RG11_EAC:i.COMPRESSED_SIGNED_RG11_EAC,COMPRESSED_RGB8_ETC2:i.COMPRESSED_RGB8_ETC2,COMPRESSED_SRGB8_ETC2:i.COMPRESSED_SRGB8_ETC2,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,COMPRESSED_RGBA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC}:null}function qNt(t,e){if(e.compressedTextureS3TC)return null;const i=t.getExtension("WEBGL_compressed_texture_s3tc");return i?{COMPRESSED_RGB_S3TC_DXT1:i.COMPRESSED_RGB_S3TC_DXT1_EXT,COMPRESSED_RGBA_S3TC_DXT1:i.COMPRESSED_RGBA_S3TC_DXT1_EXT,COMPRESSED_RGBA_S3TC_DXT3:i.COMPRESSED_RGBA_S3TC_DXT3_EXT,COMPRESSED_RGBA_S3TC_DXT5:i.COMPRESSED_RGBA_S3TC_DXT5_EXT}:null}function WNt(t,e){if(Ym(t))return{MIN:t.MIN,MAX:t.MAX};if(e.blendMinMax)return null;{const i=t.getExtension("EXT_blend_minmax");return i?{MIN:i.MIN_EXT,MAX:i.MAX_EXT}:null}}function YNt(t,e){if(e.textureFilterAnisotropic)return null;const i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");return i?{MAX_TEXTURE_MAX_ANISOTROPY:i.MAX_TEXTURE_MAX_ANISOTROPY_EXT,TEXTURE_MAX_ANISOTROPY:i.TEXTURE_MAX_ANISOTROPY_EXT}:null}function XNt(t,e){if(Ym(t))return{textureFloat:!0,textureFloatLinear:!e.textureFloatLinear&&!!t.getExtension("OES_texture_float_linear"),textureHalfFloat:!0,textureHalfFloatLinear:!0,HALF_FLOAT:t.HALF_FLOAT,R16F:t.R16F,RG16F:t.RG16F,RGBA16F:t.RGBA16F,R32F:t.R32F,RG32F:t.RG32F,RGBA32F:t.RGBA32F,R11F_G11F_B10F:t.R11F_G11F_B10F,RGB16F:t.RGB16F};if(t instanceof WebGLRenderingContext){const i=!e.textureHalfFloat&&t.getExtension("OES_texture_half_float");return{textureFloat:!e.textureFloat&&!!t.getExtension("OES_texture_float"),textureFloatLinear:!e.textureFloatLinear&&!!t.getExtension("OES_texture_float_linear"),textureHalfFloat:!!i,textureHalfFloatLinear:!e.textureHalfFloatLinear&&!!t.getExtension("OES_texture_half_float_linear"),HALF_FLOAT:i?i.HALF_FLOAT_OES:void 0}}return null}function ZNt(t,e){if(Ym(t)){const i=!e.colorBufferHalfFloat&&t.getExtension("EXT_color_buffer_half_float")||!e.colorBufferFloat&&t.getExtension("EXT_color_buffer_float"),r=!e.colorBufferFloat&&t.getExtension("EXT_color_buffer_float"),n=!e.floatBlend&&!e.colorBufferFloat&&t.getExtension("EXT_float_blend");return i||r||n?{textureFloat:!!r,textureHalfFloat:!!i,floatBlend:!!n,R16F:t.R16F,RG16F:t.RG16F,RGBA16F:t.RGBA16F,R32F:t.R32F,RG32F:t.RG32F,RGBA32F:t.RGBA32F,R11F_G11F_B10F:t.R11F_G11F_B10F,RGB16F:t.RGB16F}:null}if(t instanceof WebGLRenderingContext){const i=!e.colorBufferHalfFloat&&t.getExtension("EXT_color_buffer_half_float"),r=!e.colorBufferFloat&&t.getExtension("WEBGL_color_buffer_float"),n=!e.floatBlend&&!e.colorBufferFloat&&t.getExtension("EXT_float_blend");return i||r||n?{textureFloat:!!r,textureHalfFloat:!!i,floatBlend:!!n,RGBA16F:i?i.RGBA16F_EXT:void 0,RGB16F:i?i.RGB16F_EXT:void 0,RGBA32F:r?r.RGBA32F_EXT:void 0}:null}return null}function a2e(t,e,i,r,n){if(r&&Ym(t))return!0;if(e[i])return!1;for(const s of n)if(t.getExtension(s))return!0;return!1}function JNt(t,e){if(!Ym(t)||e.textureNorm16)return null;const i=t.getExtension("EXT_texture_norm16");return i?{R16:i.R16_EXT,RG16:i.RG16_EXT,RGB16:i.RGB16_EXT,RGBA16:i.RGBA16_EXT,R16_SNORM:i.R16_SNORM_EXT,RG16_SNORM:i.RG16_SNORM_EXT,RGB16_SNORM:i.RGB16_SNORM_EXT,RGBA16_SNORM:i.RGBA16_SNORM_EXT}:null}function KNt(t,e){const i=e.loseContext&&t.getExtension("WEBGL_lose_context");return i?{loseRenderingContext:()=>i.loseContext()}:null}function QNt(t,e){if(Ym(t))return{createVertexArray:t.createVertexArray.bind(t),deleteVertexArray:t.deleteVertexArray.bind(t),bindVertexArray:t.bindVertexArray.bind(t)};if(e.vao)return null;const i=t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object");return i?{createVertexArray:i.createVertexArrayOES.bind(i),deleteVertexArray:i.deleteVertexArrayOES.bind(i),bindVertexArray:i.bindVertexArrayOES.bind(i)}:null}let e8t=class{constructor(e,i){this._gl=e,this._vertexArrayObject=null,this._compressedTextureETC=null,this._compressedTextureS3TC=null,this._textureFilterAnisotropic=null,this._textureFloat=null,this._colorBufferFloat=null,this._minMaxBlending=null,this._loseContext=null,this._drawBuffers=null,this._textureNorm16=null,this._depthTexture=null,this._textureFloatLinear=null,this._disabledExtensions=i.disabledExtensions||{},this._debugWebGLExtensions=i.debugWebGLExtensions||{}}get drawBuffers(){return this._drawBuffers||(this._drawBuffers=GNt(this._gl,this._disabledExtensions)),this._drawBuffers}get vao(){return this._vertexArrayObject||(this._vertexArrayObject=QNt(this._gl,this._disabledExtensions)),this._vertexArrayObject}get compressedTextureETC(){return this._compressedTextureETC||(this._compressedTextureETC=HNt(this._gl,this._disabledExtensions)),this._compressedTextureETC}get compressedTextureS3TC(){return this._compressedTextureS3TC||(this._compressedTextureS3TC=qNt(this._gl,this._disabledExtensions)),this._compressedTextureS3TC}get textureFilterAnisotropic(){return this._textureFilterAnisotropic||(this._textureFilterAnisotropic=YNt(this._gl,this._disabledExtensions)),this._textureFilterAnisotropic}get disjointTimerQuery(){return this._disjointTimerQuery||(this._disjointTimerQuery=nNt(this._gl,this._disabledExtensions)),this._disjointTimerQuery}get textureFloat(){return this._textureFloat||(this._textureFloat=XNt(this._gl,this._disabledExtensions)),this._textureFloat}get colorBufferFloat(){return this._colorBufferFloat||(this._colorBufferFloat=ZNt(this._gl,this._disabledExtensions)),this._colorBufferFloat}get blendMinMax(){return this._minMaxBlending||(this._minMaxBlending=WNt(this._gl,this._disabledExtensions)),this._minMaxBlending}get depthTexture(){return this._depthTexture===null&&(this._depthTexture=a2e(this._gl,this._disabledExtensions,"depthTexture",!0,["WEBGL_depth_texture","MOZ_WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"])),this._depthTexture}get loseContext(){return this._loseContext||(this._loseContext=KNt(this._gl,this._debugWebGLExtensions)),this._loseContext}get textureNorm16(){return this._textureNorm16||(this._textureNorm16=JNt(this._gl,this._disabledExtensions)),this._textureNorm16}get textureFloatLinear(){return this._textureFloatLinear===null&&(this._textureFloatLinear=a2e(this._gl,this._disabledExtensions,"textureFloatLinear",!1,["OES_texture_float_linear"])),this._textureFloatLinear}enable(e){return this[e]}},t8t=class{constructor(e,i){this.gl=e,this.instanceCounter=new dNt,this.programCache=new NNt(this),this._state=new Ywe,this._numOfDrawCalls=0,this._numOfTriangles=0,this.type=Ym(e)?cr.WEBGL2:cr.WEBGL1,this._loadExtensions(),this.configure(i)}get gl2(){return this.type===cr.WEBGL1?null:this.gl}configure(e){this._capabilities=new e8t(this.gl,e),this._parameters=new pNt(this.gl,this._capabilities,e),Ai.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const i=this.gl.getParameter(this.gl.VIEWPORT);this._state=new Ywe,this._state.viewport={x:i[0],y:i[1],width:i[2],height:i[3]},this._stateTracker=new tyt({setBlending:r=>{if(r){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(r.opRgb,r.opAlpha),this.setBlendFunctionSeparate(r.srcRgb,r.dstRgb,r.srcAlpha,r.dstAlpha);const n=r.color;this.setBlendColor(n.r,n.g,n.b,n.a)}else this.setBlendingEnabled(!1)},setCulling:r=>{r?(this.setFaceCullingEnabled(!0),this.setCullFace(r.face),this.setFrontFace(r.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:r=>{r?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(r.factor,r.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:r=>{r?(this.setDepthTestEnabled(!0),this.setDepthFunction(r.func)):this.setDepthTestEnabled(!1)},setStencilTest:r=>{if(r){this.setStencilTestEnabled(!0);const n=r.function;this.setStencilFunction(n.func,n.ref,n.mask);const s=r.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:r=>{r?(this.setDepthWriteEnabled(!0),this.setDepthRange(r.zNear,r.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:r=>{r?this.setColorMask(r.r,r.g,r.b,r.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:r=>{r?this.setStencilWriteMask(r.mask):this.setStencilWriteMask(0)},setDrawBuffers:r=>{const{drawBuffers:n}=this._capabilities;if(r)n==null||n.drawBuffers(r.buffers);else{const{drawFramebuffer:s}=this._state;s===null||s.colorAttachments.length===0?n==null||n.drawBuffers([Dee.BACK]):n==null||n.drawBuffers([zu.COLOR_ATTACHMENT0])}}}),this.enforceState(),Kt(this._driverTest),this._driverTest=new jNt(this)}dispose(){Kt(this._driverTest),this.programCache.dispose(),this.bindVAO(null),this.unbindBuffer(fi.ARRAY_BUFFER),this.unbindBuffer(fi.ELEMENT_ARRAY_BUFFER),this.type===cr.WEBGL2&&(this.unbindBuffer(fi.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(fi.PIXEL_PACK_BUFFER),this.unbindBuffer(fi.PIXEL_UNPACK_BUFFER),this.unbindBuffer(fi.COPY_READ_BUFFER),this.unbindBuffer(fi.COPY_WRITE_BUFFER)),this._state.textureUnitMap.length=0,om()&&console.log(this.instanceCounter.resourceInformation)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}setPipelineState(e){this._stateTracker.setPipeline(e)}setBlendingEnabled(e){this._state.blend!==e&&(e===!0?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=e,this._stateTracker.invalidateBlending())}externalProgramUpdate(){var e;(e=this._state.program)==null||e.stop(),this._state.program=null}externalTextureUnitUpdate(e,i){for(let r=0;r=0&&(this._state.activeTexture=i)}externalVertexArrayObjectUpdate(){const e=this.capabilities.vao;e&&(e.bindVertexArray(null),this._state.vertexArrayObject=null),this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(e,i,r,n){e===this._state.blendColor.r&&i===this._state.blendColor.g&&r===this._state.blendColor.b&&n===this._state.blendColor.a||(this.gl.blendColor(e,i,r,n),this._state.blendColor.r=e,this._state.blendColor.g=i,this._state.blendColor.b=r,this._state.blendColor.a=n,this._stateTracker.invalidateBlending())}setBlendFunction(e,i){e===this._state.blendFunction.srcRGB&&i===this._state.blendFunction.dstRGB||(this.gl.blendFunc(e,i),this._state.blendFunction.srcRGB=e,this._state.blendFunction.srcAlpha=e,this._state.blendFunction.dstRGB=i,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(e,i,r,n){this._state.blendFunction.srcRGB===e&&this._state.blendFunction.srcAlpha===r&&this._state.blendFunction.dstRGB===i&&this._state.blendFunction.dstAlpha===n||(this.gl.blendFuncSeparate(e,i,r,n),this._state.blendFunction.srcRGB=e,this._state.blendFunction.srcAlpha=r,this._state.blendFunction.dstRGB=i,this._state.blendFunction.dstAlpha=n,this._stateTracker.invalidateBlending())}setBlendEquation(e){this._state.blendEquation.mode!==e&&(this.gl.blendEquation(e),this._state.blendEquation.mode=e,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(e,i){this._state.blendEquation.mode===e&&this._state.blendEquation.modeAlpha===i||(this.gl.blendEquationSeparate(e,i),this._state.blendEquation.mode=e,this._state.blendEquation.modeAlpha=i,this._stateTracker.invalidateBlending())}setColorMask(e,i,r,n){this._state.colorMask.r===e&&this._state.colorMask.g===i&&this._state.colorMask.b===r&&this._state.colorMask.a===n||(this.gl.colorMask(e,i,r,n),this._state.colorMask.r=e,this._state.colorMask.g=i,this._state.colorMask.b=r,this._state.colorMask.a=n,this._stateTracker.invalidateColorWrite())}setClearColor(e,i,r,n){this._state.clearColor.r===e&&this._state.clearColor.g===i&&this._state.clearColor.b===r&&this._state.clearColor.a===n||(this.gl.clearColor(e,i,r,n),this._state.clearColor.r=e,this._state.clearColor.g=i,this._state.clearColor.b=r,this._state.clearColor.a=n)}setFaceCullingEnabled(e){this._state.faceCulling!==e&&(e===!0?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=e,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(e){this._state.polygonOffsetFill!==e&&(e===!0?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=e,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(e,i){this._state.polygonOffset[0]===e&&this._state.polygonOffset[1]===i||(this._state.polygonOffset[0]=e,this._state.polygonOffset[1]=i,this.gl.polygonOffset(e,i),this._stateTracker.invalidatePolygonOffset())}setCullFace(e){this._state.cullFace!==e&&(this.gl.cullFace(e),this._state.cullFace=e,this._stateTracker.invalidateCulling())}setFrontFace(e){this._state.frontFace!==e&&(this.gl.frontFace(e),this._state.frontFace=e,this._stateTracker.invalidateCulling())}setScissorTestEnabled(e){this._state.scissorTest!==e&&(e===!0?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=e)}setScissorRect(e,i,r,n){this._state.scissorRect.x===e&&this._state.scissorRect.y===i&&this._state.scissorRect.width===r&&this._state.scissorRect.height===n||(this.gl.scissor(e,i,r,n),this._state.scissorRect.x=e,this._state.scissorRect.y=i,this._state.scissorRect.width=r,this._state.scissorRect.height=n)}setDepthTestEnabled(e){this._state.depthTest!==e&&(e===!0?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=e,this._stateTracker.invalidateDepthTest())}setClearDepth(e){this._state.clearDepth!==e&&(this.gl.clearDepth(e),this._state.clearDepth=e)}setDepthFunction(e){this._state.depthFunction!==e&&(this.gl.depthFunc(e),this._state.depthFunction=e,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(e){this._state.depthWrite!==e&&(this.gl.depthMask(e),this._state.depthWrite=e,this._stateTracker.invalidateDepthWrite())}setDepthRange(e,i){this._state.depthRange.zNear===e&&this._state.depthRange.zFar===i||(this.gl.depthRange(e,i),this._state.depthRange.zNear=e,this._state.depthRange.zFar=i,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(e){this._state.stencilTest!==e&&(e===!0?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=e,this._stateTracker.invalidateStencilTest())}setClearStencil(e){e!==this._state.clearStencil&&(this.gl.clearStencil(e),this._state.clearStencil=e)}setStencilFunction(e,i,r){this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===i&&this._state.stencilFunction.mask===r||(this.gl.stencilFunc(e,i,r),this._state.stencilFunction.face=vm.FRONT_AND_BACK,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=i,this._state.stencilFunction.mask=r,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(e,i,r,n){this._state.stencilFunction.face===e&&this._state.stencilFunction.func===i&&this._state.stencilFunction.ref===r&&this._state.stencilFunction.mask===n||(this.gl.stencilFuncSeparate(e,i,r,n),this._state.stencilFunction.face=e,this._state.stencilFunction.func=i,this._state.stencilFunction.ref=r,this._state.stencilFunction.mask=n,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(e){this._state.stencilWriteMask!==e&&(this.gl.stencilMask(e),this._state.stencilWriteMask=e,this._stateTracker.invalidateStencilWrite())}setStencilOp(e,i,r){this._state.stencilOperation.face===vm.FRONT_AND_BACK&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===i&&this._state.stencilOperation.zPass===r||(this.gl.stencilOp(e,i,r),this._state.stencilOperation.face=vm.FRONT_AND_BACK,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=i,this._state.stencilOperation.zPass=r,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(e,i,r,n){this._state.stencilOperation.face===e&&this._state.stencilOperation.fail===i&&this._state.stencilOperation.zFail===r&&this._state.stencilOperation.zPass===n||(this.gl.stencilOpSeparate(e,i,r,n),this._state.stencilOperation.face=e,this._state.stencilOperation.fail=i,this._state.stencilOperation.zFail=r,this._state.stencilOperation.zPass=n,this._stateTracker.invalidateStencilTest())}setActiveTexture(e,i=!1){const r=this._state.activeTexture;return e>=0&&(i||e!==this._state.activeTexture)&&(this.gl.activeTexture(cq+e),this._state.activeTexture=e),r}clear(e){e&&this.gl.clear(e)}clearSafe(e,i=255){e&&(e&In.COLOR_BUFFER_BIT&&this.setColorMask(!0,!0,!0,!0),e&In.DEPTH_BUFFER_BIT&&this.setDepthWriteEnabled(!0),e&In.STENCIL_BUFFER_BIT&&this.setStencilWriteMask(i),this.gl.clear(e))}drawArrays(e,i,r){om()&&(this._numOfDrawCalls++,this._numOfTriangles+=l2e(e,r)),this.gl.drawArrays(e,i,r),cy(this.gl)}drawArraysInstanced(e,i,r,n){var s;(s=this.gl2)==null||s.drawArraysInstanced(e,i,r,n),cy(this.gl)}drawElements(e,i,r,n){if(om()&&(this._numOfDrawCalls++,this._numOfTriangles+=l2e(e,i)),this.gl.drawElements(e,i,r,n),om()){const s=syt(this);if(s){const o=this.getBoundVAO(),l=o==null?void 0:o.indexBuffer,c=o==null?void 0:o.vertexBuffers,f={indexBuffer:l,vertexBuffers:c},_={mode:e,count:i,type:r,offset:n},x=(l==null?void 0:l.size)??0,T=n+i,A=x=this.parameters.maxTextureImageUnits||i<0)&&console.error("Input texture unit is out of range of available units!");const n=this._state.textureUnitMap[i];return(e==null?void 0:e.glName)==null?(n!=null&&(this.setActiveTexture(i,r),this.gl.bindTexture(n.descriptor.target,null)),this._state.textureUnitMap[i]=null,n):r||n!==e?(this.setActiveTexture(i,r),this.gl.bindTexture(e.descriptor.target,e.glName),e.applyChanges(),this._state.textureUnitMap[i]=e,n):(e.isDirty&&(this.setActiveTexture(i,r),e.applyChanges()),n)}unbindTexture(e){if(e!=null)for(let i=0;i=this.parameters.maxUniformBufferBindings||i<0)return console.error("Uniform buffer binding point is out of range!"),null;const r=this._state.uniformBufferBindingPoints;let n=r[i];return n==null&&(n={buffer:null,offset:0,size:0},r[i]=n),n}bindBufferBase(e,i,r){const n=this._getBufferBinding(e,i);n!=null&&(n.buffer===r&&n.offset===0&&n.size===0||(this.gl.bindBufferBase(e,i,r?r.glName:null),n.buffer=r,n.offset=0,n.size=0))}bindBufferRange(e,i,r,n,s){const o=this._getBufferBinding(e,i);if(o!=null&&!(o.buffer===r&&o.offset===n&&o.size===s)){if(n%this._parameters.uniformBufferOffsetAlignment!=0)return void console.error("Uniform buffer binding offset is not a multiple of the context offset alignment");this.gl.bindBufferRange(e,i,r.glName,n,s),o.buffer=r,o.offset=n,o.size=s}}bindUBO(e,i,r,n){i!=null?(om()&&(n??i.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),i.initialize(),r!==void 0&&n!==void 0?this.bindBufferRange(fi.UNIFORM_BUFFER,e,i.buffer,r,n):this.bindBufferBase(fi.UNIFORM_BUFFER,e,i.buffer)):this.bindBufferBase(fi.UNIFORM_BUFFER,e,null)}unbindUBO(e){for(let i=0,r=this._state.uniformBufferBindingPoints.length;i0||this.dispose()}ref(){++this._refCount}dispose(){var e;super.dispose(),(e=this._appleAmdDriverHelper)==null||e.dispose(),this.screen.destroy()}bindTechnique(e,i,r,n){return this.useProgram(e.program),this.setPipelineState(e.getPipeline(!!n)),e.program.bindPass(i,r),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??(this._appleAmdDriverHelper=new aze(this)),this._appleAmdDriverHelper.run())}get test(){var e;return{cachedWebGLObjects:this.programCache.test.cachedWebGLProgramObjects+this.screen.test.cachedWebGLObjects+(((e=this._appleAmdDriverHelper)==null?void 0:e.test.cachedWebGLObjects)??0)}}};function c2e(t){return!!t.frameUpdate}let eM=class extends ze{constructor(e,i,r){super({}),this._stage=e,this._techniqueRepository=i,this._rctx=r,this._textures=new Map,this._loadingCount=0,this._frameUpdates=new Map,this.events=new Dn,this._frameTask=e.view.resourceController.scheduler.registerTask(ni.TEXTURE_UNLOAD)}normalizeCtorArgs(){return{}}destroy(){this._frameTask.remove(),this._stage.forEachOfType(Ws.Texture,e=>e.unload())}get updating(){return this._loadingCount>0||this._frameTask.updating}get textureTechnique(){return this._textureTechnique==null&&(this._textureTechnique=this._techniqueRepository.acquire(Kle,new Qle)),this._textureTechnique}acquire(e){const i=this._textures.get(e);return i?(i.ref(),i.loadingPromise??i):this._createNewRef(e)}update(){let e=!1;this._frameUpdates.forEach(i=>{const r=i.texture.frameUpdate(i.previousToken);r>=0&&r!==i.previousToken&&(i.previousToken=r,e=!0)}),e&&this.events.emit("changed",no.BACKGROUND)}_createNewRef(e){const i=this._stage.getObject(e);if(i==null)return Xt(i!==void 0),null;const r=i.events.on("unloaded",()=>{r.remove(),this._onTextureUnloaded(e)}),n=new r8t(e,()=>{this._frameTask.schedule(()=>{n.isUnreferenced&&i.unload()})});return this._textures.set(e,n),n.ref(),i.glTexture?(this._updateGLTexture(n,i.glTexture),c2e(i)&&this._frameUpdates.set(e,{texture:i,previousToken:-1}),n):(this._loadingCount++,n.loadingPromise=this._stage.schedule(()=>{const s=i.load(this._rctx),o=c=>(this._loadingCount--,n.loadingPromise=null,this._updateGLTexture(n,c),c2e(i)&&this._frameUpdates.set(e,{texture:i,previousToken:-1}),n),l=c=>(this._loadingCount--,n.loadingPromise=null,sn(c)||Ce.getLogger(this).error(c),null);return pd(s)?s.then(o,l):o(s)}),n.loadingPromise)}_updateGLTexture(e,i){e.glTexture=i,this.events.emit("changed",no.UPDATE)}_onTextureUnloaded(e){this._textures.delete(e),this._frameUpdates.delete(e)}};y([w()],eM.prototype,"_loadingCount",void 0),y([w()],eM.prototype,"_frameTask",void 0),y([w()],eM.prototype,"updating",null),eM=y([Z("esri.views.3d.webgl-engine.lib.TextureRepository")],eM);let r8t=class{constructor(e,i){this.id=e,this._release=i,this._refCount=0}get isUnreferenced(){return this._refCount===0}ref(){++this._refCount}release(){--this._refCount,this._refCount>0||(this._refCount!==0?(Ce.getLogger("esri.views.3d.webgl-engine.lib.TextureRepository.RefCountedTextureImpl").error("Cannot dereference texture that has no references!"),this._refCount=0):this._release())}};function n8t(t,e){return new dNe(i=>NEt(i,t),i=>i,e)}let MI=class extends ze{constructor(){super(...arguments),this._passParameters=new s8t,this._resourcesTask=null}get passParameters(){return this._passParameters}destroy(){this._resourcesTask=gn(this._resourcesTask),this._passParameters.waveNormal=Kt(this._passParameters.waveNormal),this._passParameters.wavePerturbation=Kt(this._passParameters.wavePerturbation)}get updating(){return!!this._resourcesTask&&!this._resourcesTask.finished}ensureResources(e){return this._resourcesTask||(this._resourcesTask=Cc(async i=>{await Promise.allSettled([this._loadImageResource(e,Wr("esri/images/materials/water/normals.jpg"),r=>this._passParameters.waveNormal=r,i),this._loadImageResource(e,Wr("esri/images/materials/water/perturbation.jpg"),r=>this._passParameters.wavePerturbation=r,i)])})),this._resourcesTask.finished?U2.LOADED:U2.LOADING}async _loadImageResource(e,i,r,n){try{const s=await C_(i,{signal:n});St(n);const o=new tn(s.width,s.height);o.pixelFormat=ci.RGB,o.samplingMode=ki.LINEAR_MIPMAP_LINEAR,o.hasMipmap=!0,o.maxAnisotropy=8,r(new Ai(e,o,s))}catch(s){Ce.getLogger(this).error("Failed to load water material normal texture.",s)}}};y([w()],MI.prototype,"_resourcesTask",void 0),y([w({type:Boolean,readOnly:!0})],MI.prototype,"updating",null),MI=y([Z("esri.views.3d.webgl-engine.materials.internal.WaterTextureRepository")],MI);let s8t=class extends _n{};const u2e=2048,o8t=1.5,a8t=8;function l8t(t,e){const{format:i,quality:r,rotation:n,disableDecorations:s}=t||{},o=Zce(t,e.padding),l=m8t(t,{width:e.width-o.left-o.right,height:e.height-o.top-o.bottom}),{width:c,height:f}=f8t(t,l),_=v8t(i),x=S8t[_];return{format:_,quality:Je(r??x,0,100),area:l,width:c,height:f,rotation:n,disableDecorations:!!s,ignoreBackground:!!(t!=null&&t.ignoreBackground),ignorePadding:!!(t!=null&&t.ignorePadding)}}function c8t(t,e){const i=l8t(t,e),r=i.area,n=i.width/r.width,s=Zce(i,e.padding),o=s.left+s.right,l=s.top+s.bottom,c=e.width-o,f=e.height-l,_=Math.floor(c*n+o),x=Math.floor(f*n+l),T=(t==null?void 0:t.layers)??[],A=i.ignoreBackground,M=i.ignorePadding;return{framebufferWidth:_,framebufferHeight:x,region:{x:Math.floor(r.x*n)+s.left,y:Math.floor(r.y*n)+s.top,width:i.width,height:i.height},format:i.format,quality:i.quality,rotation:i.rotation,pixelRatio:n,layers:T,disableDecorations:i.disableDecorations,ignoreBackground:A,ignorePadding:M,objectAndLayerIdColor:!1}}function qY(t,e,i){const{ctx:r,canvas:n}=dze(t,i),s=r.getImageData(0,0,t.width,t.height),o=h8t(n,e);return pze(n),{dataUrl:o,data:s}}function WY(t,e){const{ctx:i,canvas:r}=dze(t,e),n=i.getImageData(0,0,t.width,t.height);return pze(r),n}function dze(t,e){const i=u8t();e.premultipliedAlpha&&b8t(t),i.width=t.width,i.height=t.height;const r=i.getContext("2d",{willReadFrequently:!0});return r.putImageData(t,0,0),e.flipY&&_8t(r),{ctx:r,canvas:i}}function pze(t){t.width=0,t.height=0}function u8t(){return YY==null&&(YY=document.createElement("canvas")),YY}let YY=null;function h8t(t,e){const i=w8t[e.format],r=e.quality/100;return t.toDataURL(i,r)}function d8t(t,e,i,r=0,n=0,s=t.width-r,o=t.height-n,l=!1){const{data:c}=t,{width:f,height:_,data:x}=e,T=s/f,A=o/_,M=Math.ceil(T/2),I=Math.ceil(A/2),L=t.width;for(let F=0;F<_;F++)for(let z=0;z=1)continue;let le=2*te*te*te-3*te*te+1;const de=4*(r+pe+(n+he)*L);ne+=le*c[de+3],j+=le,!i&&c[de+3]<255&&(le=le*c[de+3]/255),H+=le*c[de],Y+=le*c[de+1],Q+=le*c[de+2],U+=le}}x[k]=H/U,x[k+1]=Y/U,x[k+2]=Q/U,x[k+3]=ne/j}return e}function p8t(t,e,i){if(!e)return t;const{framebufferWidth:r,framebufferHeight:n,pixelRatio:s,region:o}=t,l=Zce(t,i),c=l.left+l.right,f=l.top+l.bottom,_=r-c,x=n-f,T=Math.min(a8t,Math.min((u2e-c)/_,(u2e-f)/x));return Ts){const f=Math.floor(n.width/o),_=n.height-f;return{x:n.x,y:Math.floor(n.y+_/2),width:n.width,height:f}}const l=Math.floor(n.height*o),c=n.width-l;return{x:Math.floor(n.x+c/2),y:n.y,width:l,height:n.height}}function y8t(t,e){if((e==null?void 0:e.width)==null||e.height==null)return t;const i=e.width/e.height,r=t.width/t.height;if(r===i)return t;if(r0){const s=255/n;e[r]=e[r]*s,e[r+1]=e[r+1]*s,e[r+2]=e[r+2]*s}}}const w8t={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg"},h2e=98,x8t="png",S8t={png:100,jpg:h2e,jpeg:h2e},T8t={top:0,right:0,bottom:0,left:0};let E8t=class{constructor(e,i,r){this.parameters=e,this.frameHasDecorations=i,this.fbos=r}},C8t=class{constructor(e,i,r){this._rctx=e,this._renderFunctions=i,this._forceCameraHook=r,this.supersample=!0,this._screenshotQueue=new Array}destroy(){this._rctx=null}async takeScreenshot(e){await this._renderFunctions.prepareOverlay(),this._renderFunctions.requestRenderScene(no.BACKGROUND);const i=Jl();return this._screenshotQueue.push({settings:e,resolver:i}),i.promise}update(e,i){for(const r of this._screenshotQueue){if(this._rctx==null){r.resolver.reject();continue}const n={...r.settings,pixelRatio:r.settings.pixelRatio*e.parameters.camera.pixelRatio},s=this._renderScreenshot(e,n,i);r.resolver(s)}this._screenshotQueue.length=0}_renderScreenshotOverlay(e,i,r){e.width=i.width,e.height=i.height;const n=e.getContext("2d"),s=r.pixelRatio;return n.save(),n.translate(0,i.height),n.scale(1,-1),r.region&&n.translate(-r.region.x,-r.region.y),n.scale(s,s),i=this._renderFunctions.renderOverlay(e,r.disableDecorations?Xh.OFF:Xh.ON,i),n.restore(),i}_readbackScreenshot(e,i){return e.resample?this._readbackScreenshotResampled({...e,resample:e.resample},i):this._readbackScreenshotImmediate(e,i)}_readbackScreenshotResampled(e,i){const{framebufferWidth:r,framebufferHeight:n,region:s,resample:o}=e,l=this._ensureScreenshotEncodeCanvas();let c=VW(r,n,l);this._rctx.gl.readPixels(0,0,r,n,ci.RGBA,Yt.UNSIGNED_BYTE,new Uint8Array(c.data.buffer)),i(),c=this._renderScreenshotOverlay(l,c,{...e,region:void 0});const f=VW(s.width,s.height,l);return d8t(c,f,!0,o.region.x,n-(o.region.y+o.region.height),o.region.width,o.region.height)}_readbackScreenshotImmediate(e,i){const{framebufferHeight:r,region:n}=e,s=this._ensureScreenshotEncodeCanvas(),o=VW(n.width,n.height,s);return this._rctx.gl.readPixels(n.x,r-(n.y+n.height),n.width,n.height,ci.RGBA,Yt.UNSIGNED_BYTE,new Uint8Array(o.data.buffer)),i(),this._renderScreenshotOverlay(s,o,e)}_renderScreenshot(e,i,r){const n=e.parameters.camera,s={width:i.framebufferWidth,height:i.framebufferHeight};KS(s,Math.min(this._rctx.parameters.maxTextureSize,this._rctx.parameters.maxRenderbufferSize));let o=!1;const l=i.disableDecorations&&e.frameHasDecorations,c=s.width!==n.fullWidth||s.height!==n.fullHeight,f=i.ignorePadding&&n.pixelRatio!==i.pixelRatio,_=c||l||f||i.objectAndLayerIdColor;let x=null;i.objectAndLayerIdColor&&(x=e.fbos.acquire(xr.RGBA,s.width,s.height),x.acquireDepth(la.DEPTH_STENCIL_BUFFER));let T=null;if(_){const L=n.clone();if(i.ignorePadding){const j=U9(L.padding);for(let H=0;H<4;H++)j[H]=Math.round(j[H]/L.pixelRatio*i.pixelRatio);L.padding=j}L.fullWidth=s.width,L.fullHeight=s.height,L.pixelRatio=i.pixelRatio;const F=n.fovX-L.fovX,z=n.fovY-L.fovY;F<0&&F{this._rctx.bindFramebuffer(null),T==null||T.release()};this._rctx.bindFramebuffer(T==null?void 0:T.fbo);const M=this._readbackScreenshot(i,A);let I=null;if(i.objectAndLayerIdColor){const L=()=>{this._rctx.bindFramebuffer(null),x==null||x.release()};this._rctx.bindFramebuffer(x==null?void 0:x.fbo),I=this._readbackScreenshot(i,L),this._rctx.bindFramebuffer(null)}if(_&&!this._rctx.contextAttributes.alpha)for(let L=3;L{var n;return(n=this.waterTextureRepository)==null?void 0:n.updating},()=>this.requestRender(),ii),_e(()=>e.view.qualityProfile,n=>{var s;return(s=this.renderer)==null?void 0:s.updateRenderFeatures(n)},kt),this._magnifierHelper.events.on("request-render",()=>this.requestRender())]);const{memoryController:i}=e.view.resourceController;this.stippleTextureRepository=HTt(this._rctx,i),this.markerTextureRepository=n8t(this._rctx,i),this._shaderTechniqueRepository=new oNe({rctx:this._rctx,viewingMode:e.viewingMode,stippleTextureRepository:this.stippleTextureRepository,waterTextureRepository:this.waterTextureRepository,markerTextureRepository:this.markerTextureRepository}),this._textureRepository=new eM(e,this._shaderTechniqueRepository,this._rctx),this.addHandles(this._textureRepository.events.on("changed",n=>this.requestRender(n))),this._materialRepository=new aNe(this._textureRepository,this._shaderTechniqueRepository,()=>this.requestRender(),()=>this.requestRender()),this._compositingHelper=new C6t(this._rctx,this._shaderTechniqueRepository),this.renderer=new Ld(e,this._materialRepository,this._textureRepository,this._shaderTechniqueRepository,this._rctx,this._compositingHelper,this._magnifierHelper,n=>this.requestRender(n));const r={renderScene:(n,s,o,l,c)=>this.renderer.render(n,s,o,l,c),requestRenderScene:n=>this.requestRender(n),prepareOverlay:()=>e.options.screenshot.prepareOverlay(),renderOverlay:(n,s,o)=>e.options.screenshot.renderOverlay(n,s,o)};this._screenshotManager=new C8t(this._rctx,r,n=>this.events.emit("force-camera-for-screenshot",n)),this._registerFrameTask(e)}normalizeCtorArgs(){return{}}destroy(){this._container.contains(this._canvas)&&this._container.removeChild(this._canvas),this._frameTask=en(this._frameTask),this._shaderTechniqueRepository=et(this._shaderTechniqueRepository)}requestRender(e=no.UPDATE){this._needsRender=!0,e===no.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textureRepository.updating||this.waterTextureRepository.updating||this._magnifierHelper.updating}get textureRepository(){return this._textureRepository}get compositingHelper(){return this._compositingHelper}set magnifier(e){this._magnifierHelper.magnifier=e}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then(i=>i[0])}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,i,r,n,s,o=s){const l=n.constrainWindowSize(i,r,s*n.pixelRatio,o*n.pixelRatio),c=this._ensureDepthBuffer(l);this.renderer.readDepthPixels(n,l,c);let f=Number.MAX_VALUE;for(let _=0;_x&&x!==n.nearFar[0]&&x!==n.nearFar[1]&&(f=x)}if(e){const _=e.pickDepth(i*n.pixelRatio,r*n.pixelRatio,n);_!=null&&f>_&&_!==n.nearFar[0]&&_!==n.nearFar[1]&&(f=_)}return f===Number.MAX_VALUE?void 0:f}_ensureDepthBuffer(e){const i=4*e[2]*e[3];return(this._tmpDepthBuffer==null||this._tmpDepthBuffer.byteLength{r=this.updating,n=this._needsUpdate?no.UPDATE:no.BACKGROUND,e.commitSyncLayers();const c=l-this._lastAnimationUpdate;if(c>this.renderer.animationTimestep||i.forcedAnimationTime!=null||r||this._needsRender){const f=c/this.renderer.animationTimeDilation,_=new K9e(i.camera,f,i.forcedAnimationTime);this.renderer.updateAnimation(_)&&this.requestRender(no.BACKGROUND),this._lastAnimationUpdate=l}},render:({time:l})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&i.camera.fullWidth>0&&i.camera.fullHeight>0){const c=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,this.renderer.render(null,null,i,Xh.ON,l),s=!0,c&&this.renderer.hasReflections&&(this.requestRender(no.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:l})=>{const c=this.renderer.hasSlicePlane||this._magnifierHelper.enabled||this.renderer.hasDecorations||this.renderer.hasHighlights,f=new E8t(i,c,this.renderer.fboCache);this._textureRepository.update(),this._screenshotManager.update(f,l)},finish:()=>{s&&(this.renderer.finish(i.mode===Vr.IDLE?n:no.UPDATE),s=!1)}};this._frameTask=AT(o)}_initializeContext(e){const i=e.options;this._canvas=i.canvas,this._canvas||(this._canvas=document.createElement("canvas")),this._canvas.setAttribute("style","width: 100%; height:100%; display:block;");const r={alpha:i.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:i.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:i.preserveDrawingBuffer??!1},n=ryt("3d",this._canvas,r);n!=null&&Ym(n)?(this._rctx=this._newRenderingContext(n,e),this._loadShaderOnlyExtensions(),!i.alpha&&this._rctx.contextAttributes.alpha&&Ce.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested"),!this._rctx.contextAttributes.alpha&&Le("safari")>=11&&(this._container.style.backgroundColor="black"),this._container.appendChild(this._canvas)):Ce.getLogger(this).error("A WebGL2 context could not be created.")}_newRenderingContext(e,i){const r={disabledExtensions:i.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:i.options.debugWebGLExtensions||{},maxAnisotropy:8},n=(s,o)=>i.view.resourceController.memoryController.newCache(s,o);return new i8t(e,r,n)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloat")}getObjectAndLayerIdColor(e){return this.objectAndLayerIdRenderHelper!=null?this.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor(e):null}get componentObjectCollection(){return this._componentObjectCollection==null&&(this._componentObjectCollection=new w6t(this.renderer.renderPassManager,this._viewingMode)),this._componentObjectCollection}set componentObjectCollection(e){this._componentObjectCollection=e}};y([w({type:Boolean,readOnly:!0})],ml.prototype,"updating",null),y([w({autoDestroy:!0})],ml.prototype,"_rctx",void 0),y([w({autoDestroy:!0})],ml.prototype,"_container",void 0),y([w({autoDestroy:!0})],ml.prototype,"_canvas",void 0),y([w({autoDestroy:!0})],ml.prototype,"stippleTextureRepository",void 0),y([w({autoDestroy:!0})],ml.prototype,"markerTextureRepository",void 0),y([w({autoDestroy:!0})],ml.prototype,"waterTextureRepository",void 0),y([w({autoDestroy:!0})],ml.prototype,"_magnifierHelper",void 0),y([w({readOnly:!0})],ml.prototype,"objectAndLayerIdRenderHelper",void 0),y([w({autoDestroy:!0})],ml.prototype,"_textureRepository",void 0),y([w({autoDestroy:!0,readOnly:!0})],ml.prototype,"renderer",void 0),y([w({autoDestroy:!0})],ml.prototype,"_screenshotManager",void 0),y([w()],ml.prototype,"componentObjectCollection",null),y([w({autoDestroy:!0})],ml.prototype,"_componentObjectCollection",void 0),y([w()],ml.prototype,"_needsUpdate",void 0),y([w()],ml.prototype,"_needsWaterReflectionUpdate",void 0),ml=y([Z("esri.views.3d.webgl-engine.parts.RenderView")],ml);let Dd=class extends ze{constructor(e){super(e),this._model=new yk,this._layers=new Pi,this._asyncChangeSet=new pie,this._syncChangeSet=new pie,this._layerSyncSet=new Set}initialize(){this._set("renderView",new ml(this)),this._frameTask=this.view.resourceController.scheduler.registerTask(ni.STAGE,this),this.addHandles(this._frameTask)}get viewingMode(){return this.view.state.viewingMode}get updating(){return this.running||this.renderView.updating||this._frameTask.updating}get renderer(){var e;return(e=this.renderView)==null?void 0:e.renderer}add(e){this._model.add(e),WU(e)&&this._addLayer(e),this.renderView.requestRender()}remove(e){e!=null&&!this.destroyed&&this._model.remove(e)&&(WU(e)&&this._removeLayer(e),this.renderView.requestRender())}addMany(e){e!=null&&(this._model.addMany(e),this.renderView.requestRender())}removeMany(e){var i,r;e!=null&&((i=this._model)==null||i.removeMany(e),(r=this.renderView)==null||r.requestRender())}forEachOfType(e,i){this._model.forEachOfType(e,i)}handleEvent(e,i){this.destroyed||(this._model.dirtySet[e](i),this.renderView.requestRender())}get running(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty}runTask(e){this._frameTask.processQueue(e),this._commit(e)}_commit(e){const i=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll(r=>{if(e.done)return;const n=this._layerSyncSet.has(r.id)||r.updatePolicy===b2.SYNC,s=n?this._syncChangeSet:this._asyncChangeSet;i.commitLayer(r.id,s),this._layerSyncSet.delete(r.id),s.empty||(this.renderer.modify(s,n?ou:e),this.renderView.requestRender(),e.madeProgress())}),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,ou),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll(r=>{e.done||this._layerSyncSet.has(r.id)||r.updatePolicy!==b2.ASYNC||(i.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))}),this._layerSyncSet.clear(),this.notifyChange("running")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forAll(i=>{this._layerSyncSet.has(i.id)||i.updatePolicy===b2.SYNC?(e.commitLayer(i.id,this._syncChangeSet),this._layerSyncSet.delete(i.id)):e.commitSyncUpdates(i.id,this._syncChangeSet)});for(const i of this._layerSyncSet)e.commitLayer(i,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,ou),this.renderView.requestRender())}_commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,ou),this.renderView.requestRender())}schedule(e,i){return this._frameTask.schedule(e,i)}reschedule(e,i){return this._frameTask.reschedule(e,i)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}getObject(e){return this._model.getObject(e)}get layers(){return this._layers}_addLayer(e){this._layers.includes(e)||this._layers.push(e)}_removeLayer(e){this._commitLayer(e),this._layers.removeUnordered(e)!=null&&(this._model.dirtySet.getResidentRenderGeometries(e.id,this._syncChangeSet.removes),this.renderer.modify(this._syncChangeSet,ou))}addRenderPlugin(e,i){const r=this.renderer.renderPlugins.add(e,i),n=()=>{r_e(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(pd(r))return r.then(n);n()}removeRenderPlugin(e){this.destroyed||(r_e(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.renderPlugins.remove(e))}get performanceInfo(){return this._model.getStats()}get test(){const e=this;return{getCount:i=>e._model.test.content.filter(r=>r.type===i).length,model:e._model}}};Dd.DebugSettings={endFrameContentValidation:!1},y([w({constructOnly:!0})],Dd.prototype,"view",void 0),y([w({constructOnly:!0})],Dd.prototype,"options",void 0),y([w({readOnly:!0})],Dd.prototype,"viewingMode",null),y([w({constructOnly:!0})],Dd.prototype,"container",void 0),y([w({readOnly:!0})],Dd.prototype,"updating",null),y([w({constructOnly:!0})],Dd.prototype,"_model",void 0),y([w({autoDestroy:!0})],Dd.prototype,"renderView",void 0),y([w({readOnly:!0})],Dd.prototype,"renderer",null),y([w({readOnly:!0})],Dd.prototype,"running",null),Dd=y([Z("esri.views.3d.webgl-engine.Stage")],Dd);let $0i=class extends vj{constructor(e,i,r,n){super(i,r),this.point=e,this.createGraphic=n}};function fze(t){return Gm(t)&&t.intersector===ms.PCL&&!!t.target}let D0i=class extends M4e{constructor(e,i,r,n,s){super(e),this.layerUid=e,this.sublayerUid=i,this.nodeIndex=r,this.componentIndex=n,this.triangleNr=s}},F0i=class extends vj{constructor(e,i,r){super(i,null),this.point=e,this.createVoxelGraphic=r}};function $G(t){return Gm(t)&&t.intersector===ms.I3S&&!!t.target}function mze(t){return Gm(t)&&t.intersector===ms.VOXEL&&!!t.target}function d2e(t,e){var i,r;return _j(t)||bj(t)?i9((i=t.target)==null?void 0:i.object,e):eCt(t)?(r=e.map)==null?void 0:r.ground:fze(t)||$G(t)||DNe(t)||mze(t)?i9(t.target,e):null}function A8t(t,e){const i=sre(t,e);return i!=null&&i.type==="graphic"?i.graphic:null}function sre(t,e){var i;if(t==null)return null;if(_j(t)||bj(t))return p2e((i=t.target)==null?void 0:i.object,e);if(fze(t)){const r=t.target.createGraphic();return{type:"graphic",graphic:r,layer:r.layer}}if(mze(t)){const r=t.target.createVoxelGraphic();return{type:"graphic",graphic:r,layer:r.layer}}return DNe(t)||pce(t)?p2e(t.target,e):$G(t)?M8t(t.target,e):null}function p2e(t,e){if((t==null?void 0:t.graphicUid)==null)return null;const i=i9(t,e);if(i==null)return null;if(i===e.graphics)return e.graphicsView==null||typeof t.graphicUid!="number"?null:e.graphicsView.getHit(t.graphicUid);const r=e.allLayerViews.find(n=>n.layer===i);return!r||r.suspended||t.graphicUid==null?null:"getHit"in r?r.getHit(t.graphicUid):null}function M8t(t,e){const i=i9(t,e);if(i==null)return null;const r=e.allLayerViews.find(n=>n.layer===i);return r&&!r.suspended&&"getGraphicFromIntersectorTarget"in r?P8t(r.getGraphicFromIntersectorTarget(t)):null}function O8t(t,e){const i=i9(t,e);if(i==null)return null;const r=e.allLayerViews.find(n=>n.layer===i);return r&&!r.suspended&&"getAABBFromIntersectorTarget"in r?r.getAABBFromIntersectorTarget(t):null}function P8t(t){return t!=null?{type:"graphic",graphic:t,layer:t.layer}:null}function i9(t,e){return(t==null?void 0:t.layerUid)==null?null:e.graphicsView!=null&&t.layerUid===e.graphicsView.processor.layer.id?e.graphics:e.map.findLayerByUid(t.layerUid)}function z0i(t,e){if(_j(t)||bj(t))return Zv(t.target.object.boundingVolumeWorldSpace.bounds);if(pce(t)){XAe(P8,t.transformation);const i=Math.max(P8[0],P8[1],P8[2]);return t.target.baseBoundingSphere.radius*i}if($G(t)){const i=O8t(t.target,e);return i?.5*jMe(i):null}return null}function U0i(t){return!_j(t)&&!bj(t)&&(pce(t)?t.target.numLodLevels>1:!!$G(t))}const P8=W();async function R8t(t,e){if(t.type==="2d")return t.hitTest(e);const i=await t.hitTest(e);if(i.results.length===0)return i;const r=(i.results[0].distance??0)*(1+I8t),n=i.results.findIndex(s=>(s.distance??0)>r);return n!==-1&&(i.results=i.results.slice(0,n)),i}const I8t=.05;function $8t(t){return(t==null?void 0:t.type)==="graphic"}function L8t(t){return t.find($8t)??null}function D8t(t){return t&&typeof t.highlight=="function"}function N8t(t){return t&&typeof t.maskOccludee=="function"}function V0i(t,e,i){return t==null||t>i&&(e===0||t0||e!=null&&e>0}function j0i(t){const e=t.effectiveScaleRange;return{minScale:(e==null?void 0:e.minScale)??0,maxScale:(e==null?void 0:e.maxScale)??0}}let XY,ZY;function F8t(t){const e=s$e(t);for(;e.length>1;){const i=f2e(e.shift());if(i.available)return i}return f2e(e.shift())}function f2e(t){switch(t){case cr.WEBGL1:return k8t();case cr.WEBGL2:return z8t()}}function k8t(){return XY||(XY=B8t()),XY}function z8t(){return ZY||(ZY=j8t()),ZY}let gze=class{constructor(){this.available=!1,this.majorPerformanceCaveat=!1,this.maxTextureSize=0,this.supportsVertexShaderSamplers=!1,this.supportsHighPrecisionFragment=!1,this.supportsElementIndexUint=!1,this.supportsStandardDerivatives=!1,this.supportsInstancedArrays=!1,this.supportsTextureFloat=!1,this.supportsTextureHalfFloat=!1,this.supportsColorBufferFloat=!1,this.supportsColorBufferFloatBlend=!1,this.supportsColorBufferHalfFloat=!1}},U8t=class extends gze{constructor(){super(...arguments),this.type=cr.WEBGL1}},V8t=class extends gze{constructor(){super(...arguments),this.type=cr.WEBGL2,this.supportsElementIndexUint=!0,this.supportsStandardDerivatives=!0,this.supportsInstancedArrays=!0,this.supportsTextureFloat=!0,this.supportsTextureHalfFloat=!0}};function yze(t,e){if(t===cr.WEBGL1&&typeof WebGLRenderingContext>"u"||t===cr.WEBGL2&&typeof WebGL2RenderingContext>"u")return null;const i=document.createElement("canvas");if(!i)return null;let r=kee(i,t,{failIfMajorPerformanceCaveat:!0});if(r==null&&(r=kee(i,t),r!=null&&(e.majorPerformanceCaveat=!0)),r==null)return r;if(t===cr.WEBGL1){const s=r.getParameter(r.VERSION),o=s==null?void 0:s.match(/^WebGL\s+([\d.]*)/);if(o){const l=parseFloat(o[1]);e.available=l>=.94}}else e.available=!0;e.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),e.supportsVertexShaderSamplers=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;const n=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);return n&&(e.supportsHighPrecisionFragment=n.precision>0),r}function B8t(){const t=new U8t,e=yze(cr.WEBGL1,t);return e==null||(t.supportsElementIndexUint=e.getExtension("OES_element_index_uint")!==null,t.supportsStandardDerivatives=e.getExtension("OES_standard_derivatives")!==null,t.supportsInstancedArrays=e.getExtension("ANGLE_instanced_arrays")!==null,t.supportsTextureFloat=e.getExtension("OES_texture_float")!==null,t.supportsTextureHalfFloat=e.getExtension("OES_texture_half_float")!==null,t.supportsColorBufferFloat=e.getExtension("WEBGL_color_buffer_float")!==null,t.supportsColorBufferFloatBlend=e.getExtension("EXT_float_blend")!==null,t.supportsColorBufferHalfFloat=e.getExtension("EXT_color_buffer_half_float")!==null),t}function j8t(){const t=new V8t,e=yze(cr.WEBGL2,t);return e==null||(t.supportsColorBufferFloat=e.getExtension("EXT_color_buffer_float")!==null,t.supportsColorBufferFloatBlend=e.getExtension("EXT_float_blend")!==null,t.supportsColorBufferHalfFloat=t.supportsColorBufferFloat||e.getExtension("EXT_color_buffer_half_float")!==null),t}function G8t(t){const e=F8t(t);if(!e.available)return new se("webgl:required",t==="3d"?"WebGL2 is required but not supported.":"WebGL is required but not supported.",new Error().stack);if(t==="3d"&&e.majorPerformanceCaveat)return new se("webgl:major-performance-caveat-detected","Your WebGL implementation doesn't seem to support hardware accelerated rendering. Check your browser settings or if your GPU is in a blocklist.");if(!e.supportsHighPrecisionFragment)return new se("webgl:high-precision-fragment-required","WebGL support for high precision fragment shaders is required but not supported.");if(!e.supportsVertexShaderSamplers)return new se("webgl:vertex-shader-samplers-required","WebGL support for vertex shader samplers is required but not supported.");if(e.type===cr.WEBGL1){if(!e.supportsElementIndexUint)return new se("webgl:element-index-uint-required","WebGL support for uint vertex indices is required but not supported.");if(!e.supportsStandardDerivatives)return new se("webgl:standard-derivatives-required","WebGL support for standard derivatives is required but not supported.");if(!e.supportsInstancedArrays)return new se("webgl:instanced-arrays-required","WebGL support for instanced rendering is required but not supported.")}return null}function H8t(t){return t&&"nodeType"in t}function q8t(t){return t&&typeof t.render=="function"}const m2e={component:"esri-component"};let oS=class extends ze{constructor(){super(...arguments),this.widget=null}destroy(){var e;this.node=null,(e=this.widget)==null||e.destroy()}get id(){var e,i;return this._get("id")??((e=this.widget)==null?void 0:e.id)??((i=this.node)==null?void 0:i.id)}set id(e){this._set("id",e)}set node(e){const i=this._get("node");e!==i&&(e&&e.classList.add(m2e.component),i&&i.classList.remove(m2e.component),this._set("node",e))}castNode(e){var i;return(i=this.widget)==null||i.destroy(),e?typeof e=="string"||H8t(e)?(this._set("widget",null),x9(e)):(q8t(e)&&!e.domNode&&(e.domNode=document.createElement("div")),this._set("widget",e),e.domNode):(this._set("widget",null),null)}};y([w()],oS.prototype,"id",null),y([w()],oS.prototype,"node",null),y([Ci("node")],oS.prototype,"castNode",null),y([w({readOnly:!0})],oS.prototype,"widget",void 0),oS=y([Z("esri.views.ui.Component")],oS);const xk=oS,vze="calcite-mode-";function W8t(){return getComputedStyle(document.body).getPropertyValue("--esri-calcite-mode-name").replaceAll(/\s|'|"/g,"")}function _ze(){return W8t().startsWith("dark")}function Y8t(){return`${vze}${_ze()?"dark":"light"}`}function X8t(t){Z8t(t),t.classList.add(Y8t())}function Z8t(t){Array.from(t.classList).forEach(e=>{e.startsWith(vze)&&t.classList.remove(e)})}const J8t={left:0,top:0,bottom:0,right:0},bze={bottom:30,top:15,right:15,left:15},R1="esri-ui",ph={ui:R1,corner:`${R1}-corner`,innerContainer:`${R1}-inner-container`,manualContainer:`${R1}-manual-container`,cornerContainer:`${R1}-corner-container`,topLeft:`${R1}-top-left`,topRight:`${R1}-top-right`,bottomLeft:`${R1}-bottom-left`,bottomRight:`${R1}-bottom-right`};function K8t(t){return t&&!t._started&&typeof t.postMixInProperties=="function"&&typeof t.buildRendering=="function"&&typeof t.postCreate=="function"&&typeof t.startup=="function"}function R8(t){return t===0?"0":`${t}px`}function JY(t){const e=typeof t=="object"&&t!==null&&Object.getPrototypeOf(t);return(e===null||e===Object.prototype)&&("component"in t||"index"in t||"position"in t)?t:null}function KY(t,{top:e,bottom:i,left:r,right:n}){t.style.top=e,t.style.bottom=i,t.style.left=r,t.style.right=n}let kg=class extends Dn.EventedAccessor{constructor(e){super(e),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=new Array,this._componentMap=new Map,this._locale=fa(),this.view=null,this._applyViewPadding=()=>{const i=this.container;i&&KY(i,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{const i=this._innerContainer;i&&KY(i,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([_e(()=>{var e;return[(e=this.view)==null?void 0:e.padding,this.container]},this._applyViewPadding,ii),_e(()=>this.padding,this._applyUIPadding,ii),_e(()=>[this.container,this._locale],([e,i])=>{e&&e.setAttribute("lang",i)},ii),oE(e=>{this._locale=e})])}destroy(){this.container=null;for(const e of this._components)e.destroy();this._components.length=0,this._componentMap.clear()}set container(e){const i=this._get("container");e!==i&&(e&&(e.classList.add(ph.ui),X8t(e),this._attachContainers(e)),i&&(i.classList.remove(ph.ui),KY(i,{top:"",bottom:"",left:"",right:""}),CEe(i)),this._set("container",e))}get height(){var s;const e=((s=this.view)==null?void 0:s.height)??0;if(e===0)return e;const i=this._getViewPadding(),{top:r,bottom:n}=i;return Math.max(e-r-n,0)}get padding(){return this._get("padding")}set padding(e){this._overrideIfSome("padding",e)}castPadding(e){return typeof e=="number"?{bottom:e,top:e,right:e,left:e}:{...bze,...e}}get width(){var s;const e=((s=this.view)==null?void 0:s.width)??0;if(e===0)return e;const i=this._getViewPadding(),{left:r,right:n}=i;return Math.max(e-r-n,0)}add(e,i){let r,n,s;if(Array.isArray(e))return void e.forEach(l=>this.add(l,i));const o=JY(e);o&&({index:r,position:i,component:e,key:n}=o),i&&typeof i=="object"&&({index:r,key:n,position:i,internal:s}=i),!e||i&&!this._isValidPosition(i)||this._add(e,i,r,n,s)}remove(e,i){var n;if(!e)return;if(Array.isArray(e))return e.map(s=>this.remove(s,i));const r=this._find(e);if(r){if(this._componentMap.has(r)&&((n=this._componentMap.get(r))==null?void 0:n.key)!==i)return;const s=this._components.indexOf(r),o=r.node.parentNode;return o==null||o.removeChild(r.node),this._componentMap.delete(r),this._components.splice(s,1)[0]}}empty(e,i={removeInternal:!1}){if(Array.isArray(e)){for(const s of e)this.empty(s,i);return}const r=this._positionNameToContainerLookup[e??"manual"],n=Array.prototype.slice.call(r.children).map(s=>this._findByNode(s)).filter(s=>{var o;return s==null?!1:!(((o=this._componentMap.get(s))==null?void 0:o.internal)??!1)||i.removeInternal});for(const s of n)this.remove(s)}move(e,i){if(Array.isArray(e)&&e.forEach(o=>this.move(o,i)),!e)return;let r;const n=JY(e)||JY(i);if(n&&(r=n.index,i=n.position,e=n.component||e),i&&!this._isValidPosition(i))return;const s=this.remove(e);s&&this.add(s,{position:i,index:r})}find(e){if(!e)return null;const i=this._findById(e);return i&&(i.widget||i.node)}getComponents(e,i={includeInternal:!1}){return e?Array.isArray(e)?e.flatMap(r=>this._getComponentsAtPosition(r,i)):this._getComponentsAtPosition(e,i):this._components.filter(r=>{var n;return i.includeInternal||!((n=this._componentMap.get(r))!=null&&n.internal)}).map(({widget:r,node:n})=>r??n)}getPosition(e){for(const i in this._positionNameToContainerLookup)if(this._positionNameToContainerLookup[i].contains(e))return i;return null}_add(e,i,r,n,s){e instanceof xk||(e=new xk({node:e})),this._place({component:e,position:i,index:r}),this._components.push(e),this._componentMap.set(e,{key:n,internal:s})}_find(e){return e?e instanceof xk?this._findByComponent(e):typeof e=="string"?this._findById(e):this._findByNode(e.domNode||e):null}_getViewPadding(){var e;return((e=this.view)==null?void 0:e.padding)??J8t}_attachContainers(e){e.appendChild(this._innerContainer),e.appendChild(this._manualContainer)}_initContainers(){const e=document.createElement("div");e.classList.add(ph.innerContainer,ph.cornerContainer);const i=document.createElement("div");i.classList.add(ph.innerContainer,ph.manualContainer);const r=document.createElement("div");r.classList.add(ph.topLeft,ph.corner),e.appendChild(r);const n=document.createElement("div");n.classList.add(ph.topRight,ph.corner),e.appendChild(n);const s=document.createElement("div");s.classList.add(ph.bottomLeft,ph.corner),e.appendChild(s);const o=document.createElement("div");o.classList.add(ph.bottomRight,ph.corner),e.appendChild(o),this._innerContainer=e,this._manualContainer=i;const l=RT();this._cornerNameToContainerLookup={"top-left":r,"top-right":n,"bottom-left":s,"bottom-right":o,"top-leading":l?n:r,"top-trailing":l?r:n,"bottom-leading":l?o:s,"bottom-trailing":l?s:o},this._positionNameToContainerLookup={manual:i,...this._cornerNameToContainerLookup}}_isValidPosition(e){return!!this._positionNameToContainerLookup[e]}_place(e){const i=e.position??"manual",{component:r,index:n}=e,s=this._positionNameToContainerLookup[i],o=n!=null&&n>-1;if(K8t(r.widget)&&r.widget.startup(),!o)return void s.appendChild(r.node);const l=Array.from(s.children);if(n===0)return void(s.firstChild?hde(r.node,s.firstChild):s.appendChild(r.node));n>=l.length?s.appendChild(r.node):hde(r.node,l[n])}_toPixelPosition(e){return{top:R8(e.top),left:R8(e.left),right:R8(e.right),bottom:R8(e.bottom)}}_findByComponent(e){return this._components.find(i=>i===e)??null}_findById(e){return this._components.find(({id:i})=>i===e)??null}_findByNode(e){return this._components.find(({node:i})=>i===e)??null}_getComponentsAtPosition(e,i){const r=this._positionNameToContainerLookup[e];return Array.prototype.slice.call(r.children).map(n=>this._findByNode(n)).filter(ys).filter(n=>{var s;return i.includeInternal||!((s=this._componentMap.get(n))!=null&&s.internal)}).map(({widget:n,node:s})=>n??s)}};y([w()],kg.prototype,"_locale",void 0),y([w()],kg.prototype,"container",null),y([w()],kg.prototype,"height",null),y([w({value:bze})],kg.prototype,"padding",null),y([Ci("padding")],kg.prototype,"castPadding",null),y([w()],kg.prototype,"view",void 0),y([w()],kg.prototype,"width",null),kg=y([Z("esri.views.ui.UI")],kg);const Q8t=kg;function g2e(t,e){return t&&"copyright"in t&&(!e||typeof t.originOf=="function"&&t.originOf("copyright")==="user")}function e7t(t,e){return t.length!==e.length||t.some((i,r)=>i.text!==e[r].text)}function I8(t,e,i){!i||!e||t.find(r=>r.layerView===e&&r.text===i)||t.push({text:i,layerView:e})}function t7t(t){return t.type==="bing-maps"}const $b=[];let tM=class extends ze{constructor(e){super(e),this._clear=()=>{this._fetchedAttributionData.clear(),this._pendingAttributions.clear(),this.removeHandles("suspension"),this.notifyChange("state")},this._pendingAttributions=new Set,this._fetchedAttributionData=new Map,this.items=new it,this.view=null,this._allLayerViewsChange=i=>{var n;this.removeHandles("suspension");const r=(n=this.view)==null?void 0:n.allLayerViews;r&&this.addHandles(r.map(s=>_e(()=>{var o;return[s.suspended,(o=s.layer)==null?void 0:o.attributionVisible]},()=>this._updateAttributionItems())).toArray(),"suspension"),i!=null&&i.removed&&i.removed.forEach(s=>{this._pendingAttributions.delete(s),this._fetchedAttributionData.delete(s)}),this._updateAttributionItems()},this.addHandles([Jr(()=>{var i;return(i=this.view)==null?void 0:i.allLayerViews},"change",i=>this._allLayerViewsChange(i),{onListenerAdd:()=>this._allLayerViewsChange(),onListenerRemove:this._clear}),Mo(()=>{var i;return((i=this.view)==null?void 0:i.stationary)===!0},()=>this._updateAttributionItems())])}destroy(){this.view=null,this._fetchedAttributionData.clear(),this._pendingAttributions.clear(),this.items.removeAll()}get state(){var e;return(e=this.view)!=null&&e.ready?this._pendingAttributions.size>0?"loading":"ready":"disabled"}_updateAttributionItems(){const e=this.view,i=e==null?void 0:e.allLayerViews;$b.length=0,e&&i?(i.forEach(r=>{var o,l;if(r.suspended||!((o=r.layer)!=null&&o.attributionVisible))return;const n=r.layer;if(g2e(n,"user"))return void I8($b,r,n.copyright);if(n.hasAttributionData){if(this._fetchedAttributionData.has(r)){const c=this._fetchedAttributionData.get(r);return void(c?I8($b,r,this._getDynamicAttribution(c,e,n)):g2e(n)&&I8($b,r,n.copyright))}return void this._fetchAttributionData(r)}const s="portalItem"in n?(l=n.portalItem)==null?void 0:l.accessInformation:void 0;I8($b,r,s||n.copyright)}),e7t(this.items,$b)&&(this.items.removeAll(),this.items.addMany($b)),$b.length=0,this.notifyChange("state")):this._clear()}async _fetchAttributionData(e){if(this._pendingAttributions.has(e))return;this._pendingAttributions.add(e);const i=await Ju(e.layer.fetchAttributionData());if(this._pendingAttributions.has(e)){const r=i.ok?this._createContributionIndex(i.value,t7t(e.layer)):null;this._pendingAttributions.delete(e),this._fetchedAttributionData.set(e,r)}this._updateAttributionItems()}_createContributionIndex(e,i){const r=e.contributors,n={};if(!r)return n;for(let s=0;s{const T=x.id,A=!f.has(T)&&c&&x.extent&&Qne(x.extent,c);return A&&f.add(T),A}).sort((x,T)=>T.score-x.score||x.objectId-T.objectId).map(x=>x.attribution).join(", "):""}};y([w({readOnly:!0,type:it})],tM.prototype,"items",void 0),y([w({readOnly:!0})],tM.prototype,"state",null),y([w()],tM.prototype,"view",void 0),tM=y([Z("esri.widgets.Attribution.AttributionViewModel")],tM);const wze=tM,tt={anchor:"esri-widget__anchor",anchorDisabled:"esri-widget__anchor--disabled",button:"esri-button",buttonDisabled:"esri-button--disabled",buttonHalf:"esri-button--half",buttonSecondary:"esri-button--secondary",buttonSmall:"esri-button--small",buttonTertiary:"esri-button--tertiary",buttonThird:"esri-button--third",disabled:"esri-disabled",disabledElement:"esri-disabled-element",empty:"esri-widget__content--empty",emptyIllustration:"esri-widget__content-illustration--empty",heading:"esri-widget__heading",hidden:"esri-hidden",input:"esri-input",interactive:"esri-interactive",loader:"esri-widget__loader",loaderAnimation:"esri-widget__loader-animation",loaderText:"esri-widget__loader-text",menu:"esri-menu",menuHeader:"esri-menu__header",menuItem:"esri-menu__list-item",menuItemActive:"esri-menu__list-item--active",menuItemFocus:"esri-menu__list-item--focus",menuList:"esri-menu__list",noBookmarksIcon:"esri-widget__no-bookmark-icon",panel:"esri-widget--panel",panelHeightOnly:"esri-widget--panel-height-only",primaryTick:"primary-tick",primaryTickAmPm:"primary-tick__ampm",primaryTickLabel:"primary-tick__label",rotating:"esri-rotating",secondaryTick:"secondary-tick",select:"esri-select",table:"esri-widget__table",widget:"esri-widget",widgetButton:"esri-widget--button",widgetButtonActive:"esri-widget--button-active",widgetDisabled:"esri-widget--disabled"};function bo(){return function(t,e){if(!t[e])throw new TypeError(`Cannot auto bind undefined function '${String(e)}'`);return{value:r7t(t[e])}}}function i7t(t){const e=t==null?void 0:t.type;return t instanceof KeyboardEvent||e==="keyup"||e==="keydown"||e==="keypress"}function r7t(t){return function(e,...i){i7t(e)?bM(e.key)&&(e.preventDefault(),e.stopPropagation(),e.target.click()):t.call(this,e,...i)}}const GC="esri-attribution",t3={base:GC,poweredBy:`${GC}__powered-by`,sources:`${GC}__sources`,open:`${GC}--open`,sourcesOpen:`${GC}__sources--open`,link:`${GC}__link`,widgetIcon:si.description};let Yc=class extends cn{constructor(e,i){super(e,i),this._isOpen=!1,this._attributionTextOverflowed=!1,this._prevSourceNodeHeight=0,this._resizeObserver=new ResizeObserver(r=>r.forEach(({target:n})=>this._checkSourceTextOverflow(n))),this.iconClass=t3.widgetIcon,this.icon=null,this.itemDelimiter=" | ",this.messages=null,this.viewModel=new wze}initialize(){this.addHandles(Jr(()=>{var e;return(e=this.viewModel)==null?void 0:e.items},"change",()=>this.scheduleRender()))}destroy(){var e;(e=this._resizeObserver)==null||e.disconnect()}get _isInteractive(){return this._isOpen||this._attributionTextOverflowed}get attributionText(){return this.viewModel.items.reduce((e,i)=>(e.includes(i.text)||e.push(i.text),e),[]).join(this.itemDelimiter)}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e={[t3.open]:this._isOpen};return X("div",{bind:this,class:this.classes(t3.base,tt.widget,e),dir:"ltr",onclick:this._toggleState,onkeydown:this._toggleState},this._renderSourcesNode(),this._renderPoweredBy())}_renderPoweredBy(){return X("div",{class:t3.poweredBy},"Powered by"," ",X("a",{class:t3.link,href:"http://www.esri.com/",rel:"noreferrer",target:"_blank"},"Esri"))}_renderSourcesNode(){const e=this._isOpen,i=this._isInteractive,r=i?0:void 0,{attributionText:n}=this,s={[t3.sourcesOpen]:e,[tt.interactive]:i};return X("div",{afterCreate:this._afterSourcesNodeCreate,bind:this,class:this.classes(t3.sources,s),innerHTML:n,tabIndex:r})}_afterSourcesNodeCreate(e){this._prevSourceNodeHeight=e.clientWidth,this._resizeObserver.observe(e)}_checkSourceTextOverflow(e){let i=!1;const{clientHeight:r,clientWidth:n,scrollWidth:s}=e,o=s>n,l=this._attributionTextOverflowed!==o;if(this._attributionTextOverflowed=o,l&&(i=!0),this._isOpen){const c=r{let e=class extends t{constructor(...i){super(...i),this.goToOverride=null,this.view=null}callGoTo(i){const{view:r}=this;return ky(r),this.goToOverride?this.goToOverride(r,i):r.goTo(i.target,i.options)}};return y([w()],e.prototype,"goToOverride",void 0),y([w()],e.prototype,"view",void 0),e=y([Z("esri.widgets.support.GoTo")],e),e},o7t="esri.widgets.CompassViewModel";let aS=class extends LG(ze){constructor(e){super(e),this.orientation={x:0,y:0,z:0},this.view=null,this._updateForCamera=this._updateForCamera.bind(this),this._updateForRotation=this._updateForRotation.bind(this),this._updateRotationWatcher=this._updateRotationWatcher.bind(this)}initialize(){this.addHandles(_e(()=>this.view,this._updateRotationWatcher,ii))}destroy(){this.view=null}get canShowNorth(){return s7t(this.view)}get state(){var e;return!((e=this.view)!=null&&e.ready)||this.view.type==="2d"&&!this.view.constraints.rotationEnabled?"disabled":this.canShowNorth?"compass":"rotation"}reset(){var i,r;if(!((i=this.view)!=null&&i.ready))return;const e={};((r=this.view)==null?void 0:r.type)==="2d"?e.rotation=0:e.heading=0,this.callGoTo({target:e})}_updateForRotation(e){e!=null&&(this.orientation={z:e})}_updateForCamera(e){if(!e)return;const i=-e.heading;this.orientation={x:0,y:0,z:i}}_updateRotationWatcher(e){this.removeAllHandles(),e&&this.addHandles(e.type==="2d"?_e(()=>e==null?void 0:e.rotation,this._updateForRotation,ii):_e(()=>e==null?void 0:e.camera,this._updateForCamera,ii))}};y([w({readOnly:!0})],aS.prototype,"canShowNorth",null),y([w()],aS.prototype,"orientation",void 0),y([w({readOnly:!0})],aS.prototype,"state",null),y([w()],aS.prototype,"view",void 0),aS=y([Z(o7t)],aS);const xze=aS,y2e="esri-compass",QY={base:y2e,widgetIcon:si.locateCircled,iconContainer:`${y2e}__icon-container`};let zg=class extends cn{constructor(e,i){super(e,i),this.iconClass=QY.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new xze,this._reset=()=>{this.viewModel.reset()},this._toRotationTransform=r=>({transform:`rotateZ(${r.z}deg)`})}loadDependencies(){return Pl({button:()=>we(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([234,235,236,237,238,239,240,241,242,243,244,245,246,247])),icon:()=>we(()=>import("./calcite-icon-itD416se.js"),__vite__mapDeps([248,245,242]))})}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}reset(){return this.viewModel.reset()}render(){const{orientation:e,state:i}=this.viewModel,r=i==="rotation"?"arrow-up":"compass-needle",{messages:n}=this;return X("div",{class:this.classes(QY.base,tt.widget)},X("calcite-button",{"aria-label":n.reset,class:tt.widgetButton,disabled:i==="disabled",kind:"neutral",onclick:this._reset,round:!0,scale:"s",title:n.reset},X("div",{"aria-hidden":"true",class:QY.iconContainer,title:n.reset},X("calcite-icon",{icon:r,scale:"m",styles:this._toRotationTransform(e)}))))}};y([w()],zg.prototype,"goToOverride",null),y([w()],zg.prototype,"iconClass",void 0),y([w()],zg.prototype,"icon",void 0),y([w()],zg.prototype,"label",null),y([w(),Gr("esri/widgets/Compass/t9n/Compass")],zg.prototype,"messages",void 0),y([w()],zg.prototype,"view",null),y([w({type:xze})],zg.prototype,"viewModel",void 0),zg=y([Z("esri.widgets.Compass")],zg);const a7t=zg,HC="esri-navigation-toggle",I1={base:HC,widgetIcon:si.pan2,button:`${HC}__button`,activeButton:`${HC}__button--active`,panButton:`${HC}__button--pan`,rotateButton:`${HC}__button--rotate`,isLayoutHorizontal:`${HC}--horizontal`};let iM=class extends ze{constructor(e){super(e),this.navigationMode="pan",this.view=null}initialize(){this.addHandles(Mo(()=>{var e;return(e=this.view)==null?void 0:e.inputManager},()=>this._setNavigationMode()))}destroy(){this.view=null}get state(){var e,i;return(e=this.view)!=null&&e.ready&&((i=this.view)==null?void 0:i.type)==="3d"?"ready":"disabled"}toggle(){this.state!=="disabled"&&(this.navigationMode=this.navigationMode!=="pan"?"pan":"rotate",this._setNavigationMode())}_setNavigationMode(){var i;const e=(i=this.view)==null?void 0:i.inputManager;e&&(e.primaryDragAction=this.navigationMode==="pan"?"pan":"rotate")}};y([w({readOnly:!0})],iM.prototype,"state",null),y([w()],iM.prototype,"navigationMode",void 0),y([w()],iM.prototype,"view",void 0),iM=y([Z("esri.widgets.NavigationToggleViewModel")],iM);const Sze=iM;let q0=class extends cn{constructor(e,i){super(e,i),this.iconClass=I1.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new Sze}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}set layout(e){e!=="horizontal"&&(e="vertical"),this._set("layout",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}toggle(){return this.viewModel.toggle()}render(){var c,f;const e=((c=this.viewModel)==null?void 0:c.state)==="disabled",i=((f=this.viewModel)==null?void 0:f.navigationMode)==="pan",r={[tt.disabled]:e,[I1.isLayoutHorizontal]:this.layout==="horizontal"},n={[I1.activeButton]:i},s={[I1.activeButton]:!i},o=e?-1:0,l=this.messages.toggle;return X("div",{"aria-label":l,bind:this,class:this.classes(I1.base,tt.widget,r),onclick:this._toggle,onkeydown:this._toggle,tabIndex:o,title:l},X("div",{class:this.classes(I1.button,tt.widgetButton,I1.panButton,n)},X("span",{class:si.pan})),X("div",{class:this.classes(I1.button,tt.widgetButton,I1.rotateButton,s)},X("span",{class:si.rotate})))}_toggle(){this.toggle()}};y([w()],q0.prototype,"iconClass",void 0),y([w()],q0.prototype,"icon",void 0),y([w()],q0.prototype,"label",null),y([w({value:"vertical"})],q0.prototype,"layout",null),y([w(),Gr("esri/widgets/NavigationToggle/t9n/NavigationToggle")],q0.prototype,"messages",void 0),y([w()],q0.prototype,"view",null),y([w({type:Sze})],q0.prototype,"viewModel",void 0),y([bo()],q0.prototype,"_toggle",null),q0=y([Z("esri.widgets.NavigationToggle")],q0);const l7t=q0,$l="esri-feature",c7t={base:$l,container:`${$l}__size-container`,title:`${$l}__title`,main:`${$l}__main-container`,btn:`${$l}__button`,icon:`${$l}__icon`,content:`${$l}__content`,contentNode:`${$l}__content-node`,contentNodeText:`${$l}__content-node--text`,contentElement:`${$l}__content-element`,text:`${$l}__text`,lastEditedInfo:`${$l}__last-edited-info`,fields:`${$l}__fields`,fieldHeader:`${$l}__field-header`,fieldData:`${$l}__field-data`,fieldDataDate:`${$l}__field-data--date`,loadingSpinnerContainer:`${$l}__loading-container`,spinner:`${$l}__loading-spinner`};let ov=class extends cn{constructor(){super(...arguments),this.enabled=!0,this.iconClass=null,this.icon=null,this.title=""}render(){const e=this.enabled?0:-1,i={[tt.disabled]:!this.enabled,[tt.interactive]:this.enabled};return X("div",{bind:this,class:this.classes(tt.widgetButton,tt.widget,i),onclick:this._triggerAction,onkeydown:this._triggerAction,role:"button",tabIndex:e,title:this.title},X("span",{"aria-hidden":"true",class:this.classes(c7t.icon,this.iconClass??""),role:"presentation"}),X("span",{class:si.fontFallbackText},this.title))}_triggerAction(){this.action.call(this)}};y([w()],ov.prototype,"action",void 0),y([w()],ov.prototype,"enabled",void 0),y([w()],ov.prototype,"iconClass",void 0),y([w()],ov.prototype,"icon",void 0),y([w()],ov.prototype,"title",void 0),y([bo()],ov.prototype,"_triggerAction",null),ov=y([Z("esri.widgets.IconButton")],ov);const v2e=ov;let lS=class extends ze{get canZoomIn(){var r,n,s;if(!((r=this.view)==null?void 0:r.ready))return!1;const i=(s=(n=this.view)==null?void 0:n.constraints)==null?void 0:s.effectiveMaxScale;return i===0||this._scale>i}get canZoomOut(){var n;const{view:e}=this;if(!(e==null?void 0:e.ready))return!1;const r=(n=e.constraints)==null?void 0:n.effectiveMinScale;return r===0||this._scale{this.components.forEach(r=>{const n=this._find(r),s=n==null?void 0:n.widget;p7t(s)&&(s.view=i)})},this._componentsWatcher=(i,r)=>{this._removeComponents(r),this._addComponents(i),this._adjustPadding(i)}}initialize(){this.addHandles([_e(()=>this.components,this._componentsWatcher,ii),_e(()=>this.view,this._updateViewAwareWidgets,ii)])}_add(e,i,r,n,s){let o=e;if(typeof e=="string"&&this._defaultPositionLookup[e]){if(this._find(e))return;o=this._createComponent(e)}super._add(o,i,r,n,s)}_removeComponents(e){e.forEach(i=>{const r=this._find(i);r&&(this.remove(r),r.destroy())})}_adjustPadding(e){if(!e.includes("attribution")&&!this._isOverridden("padding")){const{top:i}=this.padding;this.padding=i}}_addComponents(e){this.constructed&&e.forEach(i=>this.add(this._createComponent(i),this._defaultPositionLookup[i]))}_createComponent(e){const i=this._createWidget(e);return new xk({id:e,node:i})}_createWidget(e){const{view:i}=this;switch(e){case"attribution":return new n7t({view:i});case"compass":return new a7t({view:i});case"navigation-toggle":return new l7t({view:i});case"zoom":return new d7t({view:i})}}};y([w()],Sk.prototype,"components",void 0),Sk=y([Z("esri.views.ui.DefaultUI")],Sk);const Eze=Sk;let Tk=class extends Eze{constructor(e){super(e),this.components=["attribution","zoom","navigation-toggle","compass"]}};y([w()],Tk.prototype,"components",void 0),Tk=y([Z("esri.views.ui.3d.DefaultUI3D")],Tk);const Cze=Tk;let Nt=class extends qft(pmt(Jft(Pmt))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new x_({slicePlane:p4e},this),this._resourceController=T4t(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new iie({view:this}),this.labeler=new eS({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new y5,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new IS,this.environmentManager=new N0,this.floors=new it,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new $mt({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ZRt,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Cze,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlightOptions=new q7e,dft(),e!=null&&e.environment||(this._defaults.environment=new UA,this.environment=this._defaults.environment);const i=(r=null)=>{r!=null&&r.type===wn.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach(async n=>{try{await n.when()}catch{}this._updatingChanged()}))};this.addHandles([Jr(()=>{var r;return(r=this.map)==null?void 0:r.allLayers},"after-changes",r=>i(r),{onListenerAdd:()=>i(),onListenerRemove:()=>i(),sync:!0}),this.allLayerViews.on("after-changes",r=>this._updateUpdatingMonitors(r)),_e(()=>this.map,r=>{r&&"load"in r&&r.load&&r.load().catch(()=>{})})]),this.inputManager=new m2t({view:this}),this.stateManager=new ra({view:this})}initialize(){this.groundView=new tmt({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.addHandles(Jr(()=>{var i;return(i=this.map)==null?void 0:i.allLayers},"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,i=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=i)},ii),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,i=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=i)},ii),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,i=>AGe(i>0?1e3/Math.ceil(i):0),ii),this.updatingHandles.add(()=>{var i;return(i=this.map)==null?void 0:i.ground},e,kt),this.updatingHandles.add(()=>{var i,r;return(r=(i=this.map)==null?void 0:i.ground)==null?void 0:r.opacity},()=>this._updateDefaultHitTestOptions(),kt),this.addHandles(_e(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),Li))}destroy(){var e;this.destroyed||(this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=et(this.sharedSymbolResources),this._set("labeler",et(this.labeler)),this._set("deconflictor",et(this.deconflictor)),this._resourceController=et(this._resourceController),this._set("stateManager",et(this.stateManager)),this._set("inputManager",et(this.inputManager)),this.state.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",et(this.environmentManager)),this._set("environment",et(this.environment)),this.groundView=et(this.groundView),this._exitBasemapTerrain(),(e=this._stage)==null||e.destroy())}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){var e;return(e=this.basemapTerrain)==null?void 0:e.spatialReference}get animation(){var e;return(e=this.state)==null?void 0:e.animation}get camera(){var e;return(e=this.stateManager)==null?void 0:e.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){var e;return(e=this.stateManager)==null?void 0:e.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){var e;return(e=this.stateManager)==null?void 0:e.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if(this.viewingMode==="global")return null;const e=this.map;let i=this._userClippingArea||ihe(e,"clippingArea");return!this._userClippingArea&&!ihe(e,"clippingEnabled")||i==null?(this._clippingArea=null,null):i instanceof Vi?this.spatialReference&&(i=$8(i,this.spatialReference),i==null)?(Ce.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(i=i.clone(),i.intersection(this._groundAndLayersExtent)==null&&(i.xmin=i.xmax,i.ymin=i.ymax),i.zmin=void 0,i.zmax=void 0,i.equals(this._clippingArea)||(this._clippingArea=i),this._clippingArea):(Ce.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&this.viewingMode==="global"&&e!=null?Ce.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===_t.Global)return null;const e=this.renderSpatialReference,i=this.dataExtent;return i==null||e==null||i.spatialReference.equals(e)?i:$8(i,e)}get dataExtent(){let e=this._groundAndLayersExtent;const i=this.spatialReference||at.WGS84,r=$8(this.clippingArea,i);r!=null&&(e=e!=null?e.intersection(r):r);const n=this._get("dataExtent");return e!=null&&e.equals(n)?n:e}get _groundAndLayersExtent(){const e=this.spatialReference||at.WGS84;let i;const r=o=>{const l=$8(o,e);l!=null&&(i!=null?i.union(l):i=l.clone())},n=this.basemapTerrain;if(n!=null&&n.spatialReference){const o=n.groundExtent;r(new Vi({xmin:o[0],ymin:o[1],zmin:0,xmax:o[2],ymax:o[3],zmax:0,spatialReference:n.spatialReference}))}if(this.map){const o=l=>{l.fullExtent==null||l.type==="graphics"&&l.internal||r(l.fullExtent)};this.map.allLayers.forEach(l=>o(l))}if(i==null)return null;i.hasZ?(i.zmin=Math.min(0,i.zmin??0),i.zmax=Math.max(0,i.zmax??0)):(i.zmin=0,i.zmax=0);const s=this._get("_groundAndLayersExtent");return i.equals(s)?s:i}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof UA?e:e instanceof f5?this.environment!=null?this.environment.cloneWithWebsceneEnvironment(e):UA.fromWebsceneEnvironment(e):$s(UA,e):new UA}get extent(){var e;return(e=this.stateManager)==null?void 0:e.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){var e;return(e=this.stateManager)==null?void 0:e.screenCenter}get frustum(){var e;return(e=this.stateManager)==null?void 0:e.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){var e;return this.navigating||(((e=this.toolViewManager)==null?void 0:e.interacting)??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state==null||this.state.stationary)}get navigating(){var e;return((e=this.state)==null?void 0:e.navigating)??!1}get padding(){var e;return(e=this.stateManager)==null?void 0:e.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){lk.isValidProfile(e)&&(lk.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||lk.getDefaultProfile()}set slicePlane(e){if(this._stage!=null&&this._stage.renderer.setParameters({slicePlane:e}),e==null)return void this._set("slicePlane",null);const i=this._propertiesPool.get("slicePlane");wE(e,i),this._set("slicePlane",i)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return this.spatialReference!=null?TRe(this.scale,this.spatialReference):0}get scale(){var e;return(e=this.stateManager)==null?void 0:e.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return e!=null?N_.deriveUnitFromSR(e,this.spatialReference):null}get updating(){var s,o,l,c;if(this.destroyed)return!1;let e=0,i=this.layerViewManager.updating,r=i?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(f=>{if(f.isFulfilled()){if(f.updating){if(i=!0,f.suspended||JL(f))return;++r,e+=f.updatingProgress}}else++r});for(const f of this._updatingObjects)f!=null&&f.updating&&(r+=.1,e+=.5*.1);for(const f of this._updatingObjectsWithProgress)f!=null&&f.updating&&(++r,e+=f.updatingProgress);const n=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(i=!!(i||r>0||this.updatingHandles.updating||!this.ready||!this.stationary||n||this._createGraphicsViewController||(s=this.inputManager)!=null&&s.updating||(l=(o=this.map)==null?void 0:o.allLayers)!=null&&l.some(f=>!f.isFulfilled())||(c=this.textures)!=null&&c.updating),i?(this._numUpdating=Math.max(r,this._numUpdating),e+=this._numUpdating-r):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=i?0:1,this._get("updatingProgress")!==e){const f=performance.now();if(e<1){const _=Math.min((f-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-_)+e*_}this._set("updatingProgress",e),this._lastUpdateTime=i&&e<1?f:0}return i}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){var r;const e=this._predeterminedViewingMode;if(e!=null)return u$(e);const i=this.spatialReference;return i?((r=this.defaultsFromMap)==null?void 0:r.viewingMode)!=null&&i.equals(this.defaultsFromMap.spatialReference)?u$(this.defaultsFromMap.viewingMode):p5(i,_t.Global)?"global":"local":"global"}set viewingMode(e){this.ready?Ce.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){var e;return(e=this.stateManager)==null?void 0:e.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){var e,i;return((i=(e=this._resourceController)==null?void 0:e.memoryController)==null?void 0:i.memoryFactor)??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Z4t(this)}on(e,i,r,n){return this.viewEvents.on(e,i,r,n)||super.on(e,i)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,i){if(!this.ready)return Ce.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const r=i?this.externalToInternalIntersectOptions(i):this._defaultToMapOptions,n=r.graphics!=null&&(r.graphics.include!=null||r.graphics.exclude!=null),s=nme(e)?rme(this,e):e,o=dm(s);r.enableDraped=r.include&&!r.include.has(Gw)||r.exclude&&r.exclude.has(Gw);const l=this.sceneIntersectionHelper,c=Tp(this.state.viewingMode);if(c.options.selectionMode=!0,c.options.store=n?tl.ALL:tl.MIN,l.intersectIntersectorScreen(o,c,r),n){for(const f of c.results.all){const _=sre(f,this);if(_==null)return this._intersectResultToMapPoint(f);if(_.type!=="graphic"||this._testGraphicUidFilter(r.graphics,_.graphic))return this._intersectResultToMapPoint(f)}return null}return this._intersectResultToMapPoint(c.results.min)}toScreen(e){if(!this.ready)return Ce.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const i=(e.z==null?my(this.elevationProvider,e):null)??0;return ud(e,qC,this.renderSpatialReference,i),this.state.camera.projectToScreen(qC,tX),Ku(tX[0],tX[1])}pixelSizeAt(e){return this.ready?e?(ud(e,qC,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(qC)):0:(Ce.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const i=this.basemapTerrain.overlayManager;return i?i.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e)):1}hitTest(e,i){if(!this.ready)return Ce.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const r=nme(e)?rme(this,e):e,n=ss(r.x,r.y),s=i?this.externalToInternalIntersectOptions(i):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const o=Tp(this.state.viewingMode);o.options.selectionMode=!0,o.options.store=tl.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(n,o,s);const l=this._intersectResultsToHits(o.results.all,s.graphics),c=o.results.ground,f=d2e(c,this),_=f!=null&&"type"in f&&f.type==="integrated-mesh"?f:null,x={screenPoint:r,results:l,ground:{mapPoint:this._intersectResultToMapPoint(c),distance:Gm(c)?c.distanceInRenderSpace:0,layer:_}};return Tn.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(x.intersector=o),Promise.resolve(x)}async popupHitTest(e){const{results:i,ground:r}=await R8t(this,e);let n=null;return!(i.length===0||Math.abs((i[0].distance??0)-r.distance)<1e-5)||r.layer&&r.layer.type==="integrated-mesh"||(n=r.mapPoint),{results:i,screenPoint:e,mapPoint:n}}goTo(e,i){return this.updatingHandles.addPromise(this.stateManager.goTo(e,i))}async whenAnalysisView(e){if(e.parent==null)throw new se("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const i=this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshot(i);return qY(r,i,this._pixelFormat())}async _takeScreenshot(e){const i=this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshot(i);return WY(r,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const i=this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshotWithOID(i);return[WY(r[0],this._pixelFormat()),WY(r[1],this._pixelFormat())]}_completeSettings(e){const i=c8t(e,this);return i.pixelRatio/=this.state.pixelRatio,p8t(i,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){return{takeScreenshot:e=>this._takeScreenshot(e),takeScreenshotWithObjectAndLayerId:e=>this._takeScreenshotWithObjectAndLayerId(e)}}async takeScreenshotWithObjectAndLayerId(e){if(!Le("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");const i=this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshotWithOID(i),n=qY(r[0],i,this._pixelFormat()),s=this._completeSettings(e);return s.format="png",[n,qY(r[1],s,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){if(this._stage.renderView.objectAndLayerIdRenderHelper==null)throw new Error("has enable-feature:objectAndLayerId-rendering must be true");return this._stage.renderView.objectAndLayerIdRenderHelper.getColorToObjectAndLayerIdMapping()}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return hme.importLayerView(e)}hasLayerViewModule(e){return hme.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){var e,i,r;return this.map&&"initialViewProperties"in this.map&&((e=this.map.initialViewProperties)==null?void 0:e.spatialReference)||((i=this.defaultsFromMap)==null?void 0:i.spatialReference)||((r=this.defaultsFromMap)==null?void 0:r.ready)&&this._initialDefaultSpatialReference||null}async validate(){let e=G8t(this.type);const i=Le("safari");if(i&&i<9&&(e=new se("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:i})),e!=null)throw Ce.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){var i;const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?(i=this.map.initialViewProperties)==null?void 0:i.viewingMode:null)??null;return e!=null?Afe(e):null}getSpatialReferenceSupport({spatialReference:e,layer:i}){const r=this._predeterminedViewingMode;if(r!=null)return this._validateSpatialReferenceForViewingMode(e,i,r)?{constraints:this._makeSpatialReferenceConstraints(e,i,r)}:null;const n=this._validateSpatialReferenceForViewingMode(e,i,_t.Local),s=this._validateSpatialReferenceForViewingMode(e,i,_t.Global);return n||s?n&&s?{constraints:this._makeSpatialReferenceConstraints(e,i,null)}:n?{constraints:this._makeSpatialReferenceConstraints(e,i,_t.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,i,_t.Global)}:null}_validateSpatialReferenceForViewingMode(e,i,r){return!!p5(e,r)&&(i==null||!!Ipe(i)||(!oO(i)||SG(i,e,r)!=null)&&(!Rpe(i)||r!==_t.Global))}_makeSpatialReferenceConstraints(e,i,r){if(i==null)return[{spatialReference:e,viewingMode:r}];const n=e.isWebMercator,s=e.isWGS84;return Ipe(i)&&(n||s)?!s||r===_t.Local||KL(i.tileInfo,i.fullExtent,e,_t.Global)===null?[{spatialReference:e,viewingMode:r},{spatialReference:at.WebMercator,viewingMode:r}]:[{spatialReference:n?at.WGS84:at.WebMercator,viewingMode:r}]:oO(i)||Rpe(i)||!n&&!s?oO(i)&&n&&r!==_t.Global?[{spatialReference:e,viewingMode:r},{spatialReference:at.WGS84,viewingMode:_t.Local}]:[{spatialReference:e,viewingMode:r}]:[{spatialReference:e,viewingMode:r},{spatialReference:n?at.WGS84:at.WebMercator,viewingMode:r}]}_validateSpatialReference(e){const i=this.getSpatialReferenceSupport({spatialReference:e})!=null,r=this._predeterminedViewingMode;return i||(r!=null?Ce.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${u$(r)} viewing mode.`):e.isGeographic&&Ce.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),i}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}computeMapPointFromVec3d(e,i){let r=this.spatialReference||at.WGS84;return el(e,this.renderSpatialReference,e,r)||(r=at.WGS84,el(e,this.renderSpatialReference,e,r)),i?(i.x=e[0],i.y=e[1],i.z=e[2],i.spatialReference=r):i=new mt(e,r),i}trackGraphicState(e){if(!e.graphic)return Ce.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const i=this.getViewForGraphic(e.graphic);let r=null,n=!1;const s=o=>{var l;!n&&o!=null&&"processor"in o&&((l=o.processor)==null?void 0:l.type)==="graphics-3d"&&o.processor.graphicsCore&&(r=o.processor.graphicsCore.trackGraphicState(e))};return i!=null?s(i):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(o=>s(o),()=>{}).catch(()=>{}),rr(()=>{n=!0,r!=null&&(r.remove(),r=null)})}highlight(e){if(Array.isArray(e))return id(e.map(r=>this.highlight(r)));if(it.isCollection(e))return id(e.toArray().map(r=>this.highlight(r)));const i=this.getViewForGraphic(e);return i&&"highlight"in i?i.highlight(e):rr()}maskOccludee(e){if(!e)return Ce.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const i=this.getViewForGraphic(e);let r=null,n=!1;const s=o=>{!n&&o!=null&&N8t(o)&&(r=o.maskOccludee(e))};return i!=null?s(i):this.whenViewForGraphic(e,{waitForLayer:!0}).then(o=>s(o),()=>{}).catch(()=>{}),rr(()=>{n=!0,r!=null&&(r.remove(),r=null)})}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find(i=>i.layer===e.layer):null}graphicChanged(e){this.graphicsView!=null&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,i){if(e.layer===this)return await rd(()=>this.graphicsView),this.graphicsView;if(!e.layer||!this.map)throw new se("no-view-for-graphic");return i&&i.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise((r,n)=>{const s=this.map.allLayers.on("change",o=>{o.added.includes(e.layer)&&(s.remove(),this.whenLayerView(e.layer).then(r,n))})}):this.whenLayerView(e.layer)}externalToInternalIntersectOptions(e){const i=this._externalToInternalRenderItems(e.include,V$.INCLUDE),r=this._externalToInternalRenderItems(e.exclude,V$.EXCLUDE);return{include:i.layerUids,exclude:r.layerUids,graphics:{include:i.graphicUids,exclude:r.graphicUids}}}_intersectResultToMapPoint(e,i){return e.getIntersectionPoint(qC)?(i=this.computeMapPointFromVec3d(qC,i),e.intersector===ms.TERRAIN&&this.basemapTerrain&&(i.z=my(this.basemapTerrain,i)??0),i):null}_intersectResultsToHits(e,i){const r=new Array;let n=null;for(let s=0;s{var r;const i=(r=this.basemapTerrain)==null?void 0:r.extent;if(this.clippingArea||i)if(i&&this.basemapTerrain.spatialReference){const n=this.basemapTerrain.extent!=null&&this.basemapTerrain.spatialReference!=null?rl(bB(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;this.clippingArea!=null?this.featureTiles.filterExtent=this.clippingArea.intersection(n):this.featureTiles.filterExtent=n}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add(()=>Tn.FEATURE_TILE_TREE_SHOW_TILES,i=>{i&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(we(()=>import("./FeatureTileTree3DDebugger-ZBfyCqfy.js"),__vite__mapDeps([249,233]))).then(({FeatureTileTree3DDebugger:r})=>{!this._featureTreeDebugger&&Tn.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new r({view:this}))}):i||!this._featureTreeDebugger||Tn.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)},kt),this.updatingHandles.add(()=>this.clippingArea,e,kt),this.updatingHandles.add(()=>this.basemapTerrain.extent,e,kt)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new s4t(this.map,e));const i=this.state.isGlobal,r=jft(i,e);r!==this.renderSpatialReference&&(this._set("renderCoordsHelper",c4t.create(this.state.viewingMode,r)),i||this.addHandles(_e(()=>{var n;return(n=this.basemapTerrain)==null?void 0:n.extent},n=>{const s=this.renderCoordsHelper.spatialReference;n==null||n[0]===0&&n[1]===0&&n[2]===0&&n[3]===0||!mj(n,this.basemapTerrain.spatialReference,_2e,s)||(this.renderCoordsHelper.extent=_2e)},Li),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(v5/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){e!=null&&e.type===wn.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach(i=>{i.destroyed||(this.addHandles(_e(()=>[i.updating,i.updatingProgress],()=>this._updatingChanged(),Li),"updatingMonitors"),i.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,i,r){if(!this.overlay||!this.overlay.hasVisibleItems)return r;const n=e.getContext("2d");return n.putImageData(r,0,0),this.overlay.renderCanvas(e,{disableDecorations:i===Xh.OFF}),n.getImageData(0,0,r.width,r.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(n,s,o)=>this._renderScreenshotOverlay(n,s,o)}},i=new JRt(this.state.viewingMode,n=>this._stage.layers.forAll(n),this);this._set("sceneIntersectionHelper",i);const r=x9(this.surface);this._stage=new Dd({view:this,options:e,container:r}),this._stage.renderer.setParameters({slicePlane:this.slicePlane}),this.addHandles([this.updatingHandles.add(()=>this.qualitySettings.highQualityTransparency,n=>this._stage.renderer.setParameters({highQualityTransparency:n}),ii),_e(()=>this.magnifier,n=>this._stage.renderView.magnifier=n,kt),this.on("pointer-move",()=>{var n;return(n=this._stage)==null?void 0:n.renderer.resetAnimation()}),Y5(this._stage.renderView.canvas,"webglcontextlost",n=>this.fatalError=new se("webgl-context-lost",n.statusMessage))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(v5/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=et(this._stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Q4t({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController||this.graphics.length===0)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const i=(await we(()=>import("./GraphicsView3D-6FUUKif_.js"),__vite__mapDeps([250,188,180,95,90,91]))).default;St(e),await rd(()=>{var r;return(r=this.basemapTerrain)==null?void 0:r.ready},e),this._set("graphicsView",new i({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),this.graphicsView!=null&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){var r;const e=Afe(this.viewingMode);if(e===_t.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(Jr(()=>this.graphics,"after-changes",()=>this._createGraphicsViewIfNeeded()),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const{map:n}=this,s=n&&"initialViewProperties"in n?(r=n.initialViewProperties)==null?void 0:r.environment:void 0;s&&(this.environment=s)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect(),this._set("textures",new VM(this._stage,this.resourceController.scheduler));const i=this._resolveWhenReady;this._resolveWhenReady=[],i.forEach(n=>n(this))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._set("textures",et(this.textures)),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Gw);for(const e of this.map.allLayers.items)e.type==="integrated-mesh"&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Gw);for(const e of this.map.allLayers.items)e.type==="integrated-mesh"&&e.opacity<1&&this._defaultHitTestOptions.exclude.add(e.uid)}}};function DR(t,e){t.layerUids||(t.layerUids=new Set),t.layerUids.add(e)}function f7t(t,e){t.graphicUids||(t.graphicUids=new Set),t.graphicUids.add(e)}function $8(t,e){return t!=null&&th(t.spatialReference,e)?rl(t,e):null}var V$;Nt.type="3d",y([w()],Nt.prototype,"_userClippingArea",void 0),y([w()],Nt.prototype,"_resourceController",void 0),y([w()],Nt.prototype,"_stage",void 0),y([w({readOnly:!0})],Nt.prototype,"deconflictor",void 0),y([w({readOnly:!0})],Nt.prototype,"labeler",void 0),y([w(Pz(y5,"analyses"))],Nt.prototype,"analyses",void 0),y([w({type:b5,readOnly:!0})],Nt.prototype,"animation",null),y([w({readOnly:!0})],Nt.prototype,"basemapTerrain",void 0),y([w({readOnly:!0})],Nt.prototype,"elevationProvider",void 0),y([w()],Nt.prototype,"camera",null),y([w({type:cd})],Nt.prototype,"contentCamera",null),y([w({readOnly:!0})],Nt.prototype,"canvas",void 0),y([w({type:mt})],Nt.prototype,"center",null),y([w({type:Vi})],Nt.prototype,"clippingArea",null),y([w({type:IS})],Nt.prototype,"constraints",void 0),y([w({type:Vi,readOnly:!0})],Nt.prototype,"renderDataExtent",null),y([w({type:Vi,readOnly:!0})],Nt.prototype,"dataExtent",null),y([w({type:Vi,readOnly:!0})],Nt.prototype,"_groundAndLayersExtent",null),y([w({value:null,type:UA})],Nt.prototype,"environment",null),y([Ci("environment")],Nt.prototype,"castEnvironment",null),y([w({readOnly:!0})],Nt.prototype,"environmentManager",void 0),y([w({type:Vi})],Nt.prototype,"extent",null),y([w()],Nt.prototype,"floors",void 0),y([w()],Nt.prototype,"screenCenter",null),y([w()],Nt.prototype,"frustum",null),y([w({type:Number,readOnly:!0})],Nt.prototype,"fullOpacity",void 0),y([w({readOnly:!0})],Nt.prototype,"graphicsView",void 0),y([w({readOnly:!0})],Nt.prototype,"analysisViewManager",void 0),y([w()],Nt.prototype,"groundView",void 0),y([w({type:Boolean})],Nt.prototype,"initialExtentRequired",null),y([w()],Nt.prototype,"_defaultsFromMapSettings",null),y([w()],Nt.prototype,"interacting",null),y([w()],Nt.prototype,"stationary",null),y([w()],Nt.prototype,"navigating",null),y([w()],Nt.prototype,"map",void 0),y([w({readOnly:!0})],Nt.prototype,"mapCoordsHelper",void 0),y([w()],Nt.prototype,"padding",null),y([w({type:Nu,readOnly:!0})],Nt.prototype,"pointsOfInterest",void 0),y([w({type:_l,readOnly:!0})],Nt.prototype,"featureTiles",void 0),y([w()],Nt.prototype,"_featureTreeDebugger",void 0),y([w({type:Boolean})],Nt.prototype,"screenSizePerspectiveEnabled",void 0),y([w({constructOnly:!0})],Nt.prototype,"deactivatedWebGLExtensions",void 0),y([w({constructOnly:!0})],Nt.prototype,"debugWebGLExtensions",void 0),y([w({constructOnly:!0})],Nt.prototype,"renderCanvas",void 0),y([w({constructOnly:!0})],Nt.prototype,"state",void 0),y([w({readOnly:!0})],Nt.prototype,"inputManager",void 0),y([w({readOnly:!0})],Nt.prototype,"stateManager",void 0),y([w({type:["low","medium","high"]})],Nt.prototype,"qualityProfile",null),y([w({type:n_e,get(){let t=this._get("qualitySettings");return t||(t=new n_e,lk.apply(this.qualityProfile,t)),t}})],Nt.prototype,"qualitySettings",void 0),y([w()],Nt.prototype,"slicePlane",null),y([w({readOnly:!0})],Nt.prototype,"typeSpecificPreconditionsReady",null),y([w({readOnly:!0})],Nt.prototype,"renderCoordsHelper",void 0),y([w({readOnly:!0})],Nt.prototype,"sceneIntersectionHelper",void 0),y([w({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Nt.prototype,"resolution",null),y([w({type:Number})],Nt.prototype,"scale",null),y([w()],Nt.prototype,"heightModelInfo",null),y([w()],Nt.prototype,"spatialReference",void 0),y([w({type:Boolean,constructOnly:!0})],Nt.prototype,"alphaCompositingEnabled",void 0),y([w({constructOnly:!0})],Nt.prototype,"preserveDrawingBufferEnabled",void 0),y([w({type:Boolean})],Nt.prototype,"supersampleScreenshotsEnabled",void 0),y([w({readOnly:!0})],Nt.prototype,"type",void 0),y([w(),Ci(t=>t instanceof Eze?t:MT(Cze,t))],Nt.prototype,"ui",void 0),y([w({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],Nt.prototype,"updating",null),y([w()],Nt.prototype,"_updatingObjects",null),y([w()],Nt.prototype,"_updatingObjectsWithProgress",null),y([w({type:Number,readOnly:!0,dependsOn:["updating"]})],Nt.prototype,"updatingProgress",void 0),y([w({type:["global","local"]})],Nt.prototype,"viewingMode",null),y([w({type:ih})],Nt.prototype,"viewpoint",null),y([w({type:Number})],Nt.prototype,"zoom",null),y([w({type:q7e})],Nt.prototype,"highlightOptions",void 0),y([w({readOnly:!0})],Nt.prototype,"quality",null),y([w({readOnly:!0})],Nt.prototype,"resolutionScale",null),y([w()],Nt.prototype,"textures",void 0),Nt=y([Z("esri.views.SceneView")],Nt),function(t){t[t.INCLUDE=0]="INCLUDE",t[t.EXCLUDE=1]="EXCLUDE"}(V$||(V$={}));const qC=W(),tX=ss(),_2e=Ni(),Aze=Nt,Mze=(t,...e)=>new Bpt({portalItem:{id:t},layers:[...e]}),Oze=t=>new Aze({map:t,container:"viewDiv",qualityProfile:"high"});var ore;let mw=ore=class extends lP{constructor(t){super(t),this.displayValueEnabled=!1,this.max=1,this.min=0,this.step=.1,this.type="slider",this.value=null}clone(){return new ore({active:this.active,className:this.className,disabled:this.disabled,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible,displayValueEnabled:this.displayValueEnabled,max:this.max,min:this.min,step:this.step,value:this.value})}};y([w()],mw.prototype,"displayValueEnabled",void 0),y([w()],mw.prototype,"max",void 0),y([w()],mw.prototype,"min",void 0),y([w()],mw.prototype,"step",void 0),y([w()],mw.prototype,"value",void 0),mw=ore=y([Z("esri.support.Action.ActionSlider")],mw);const m7t=mw,Pze={hide:"hide",hideChildren:"hide-children"};function bV(t){if(t)return t.listMode!=null?t.listMode:void 0}function g7t(t){return t!=null&&"minScale"in t&&t.minScale!=null?t.minScale:void 0}function y7t(t){return t!=null&&"maxScale"in t&&t.maxScale!=null?t.maxScale:void 0}function v7t(t){if(!t)return"inherited";const e=T7t(Jce(t)?t.layer:t);return e!=null?e?"independent":"inherited":"visibilityMode"in t&&t.visibilityMode!=null?t.visibilityMode:"independent"}function Rze(t){if(t&&(!("type"in t)||t.type!=="wmts")&&t.listMode!==Pze.hideChildren)return"sublayers"in t?"sublayers":"layers"in t?"layers":void 0}function _7t(t){const e=(t!=null&&t.layer&&Jce(t.layer)?t.layer.layer:void 0)??(t==null?void 0:t.layer);return!!e&&(E7t(e)??!0)}function b7t(t){return bV(t)!==Pze.hide}function w7t(t,e){if(!t||e==null||isNaN(e))return!1;const i=g7t(t),r=y7t(t),n=i!=null&&!isNaN(i)&&i>0&&e>i,s=r!=null&&!isNaN(r)&&r>0&&e{const n="uid"in i?e.indexOf(i.uid):-1,s="uid"in r?e.indexOf(r.uid):-1;return n>s?-1:n{var s;return((s=n.layer)==null?void 0:s.uid)===i}):null}function S7t(t){const e=Jce(t)?t:null,i=t==null?void 0:t.parent,r=i!=null&&"type"in i&&i.type==="map-image"?e==null?void 0:e.source:null,n="";return r&&i?{layer:i,title:n,sublayerIds:[r.mapLayerId]}:{layer:t,title:n}}function Jce(t){return t!=null&&"layer"in t&&t.layer!=null}function T7t(t){const e=$ze(t);return e!=null&&"supportsSublayerVisibility"in e?e.supportsSublayerVisibility:void 0}function E7t(t){const e=$ze(t);return e!=null&&"supportsDynamicLayers"in e?e.supportsDynamicLayers:void 0}function $ze(t){return t&&"capabilities"in t&&t.capabilities!=null&&"exportMap"in t.capabilities?t.capabilities.exportMap:void 0}function Kce(t){return e=>{e.hasOwnProperty("_delegatedEventNames")||(e._delegatedEventNames=e._delegatedEventNames?e._delegatedEventNames.slice():[]);const i=e._delegatedEventNames,r=Array.isArray(t)?t:C7t(t);i.push(...r)}}function C7t(t){return t.split(",").map(e=>e.trim())}function B$(t){return t&&typeof t.render=="function"}function A7t(t){return t&&typeof t.postMixInProperties=="function"&&typeof t.buildRendering=="function"&&typeof t.postCreate=="function"&&typeof t.startup=="function"}const Lze="esri-layer-list-panel",NR=`${Lze}__content`,$1={base:Lze,content:NR,contentLegend:`${NR}--legend`,contentString:`${NR}--string`,contentElement:`${NR}--html-element`,contentWidget:`${NR}--widget`},M7t="legends";let Kp=class extends I_(cn){constructor(e,i){super(e,i),this._legend=null,this.content=null,this.image=null,this.listItem=null,this.open=!1,this.visible=!0}initialize(){this.addHandles(_e(()=>this.content,e=>this._createLegend(e),ii))}destroy(){this._legend=et(this._legend)}get className(){const{image:e}=this,i=this._getFirstWidget();return this._get("className")||(!e&&i?i.iconClass??"":"")}set className(e){this._override("className",e)}get disabled(){var n;const{listItem:e,_legend:i,content:r}=this;return!e||!(Array.isArray(r)&&r.length>1)&&!!i&&(!((n=i.activeLayerInfos)!=null&&n.length)||!e.visibleAtCurrentScale||!e.visible)}set disabled(e){this._overrideIfSome("disabled",e)}get title(){const e=this._getFirstWidget();return this._get("title")||((e==null?void 0:e.label)??"")}set title(e){this._override("title",e)}render(){return X("div",{class:$1.base},this._renderContents())}_renderContent(e){const{_legend:i,disabled:r}=this;return!e||r?null:e==="legend"&&i?X("div",{class:this.classes($1.content,$1.contentLegend),key:i},i.render()):typeof e=="string"?X("div",{class:this.classes($1.content,$1.contentString),innerHTML:e,key:e}):B$(e)?X("div",{class:this.classes($1.content,$1.contentWidget),key:e},e.render()):e instanceof HTMLElement?X("div",{afterCreate:this._attachToNode,bind:e,class:this.classes($1.content,$1.contentElement),key:e}):null}_renderContents(){const{content:e}=this;return Array.isArray(e)?e.map(i=>this._renderContent(i)):this._renderContent(e)}_getLegendOptions(){const{listItem:e}=this;if(!e)return{};const{layer:i,view:r}=e;return i&&r?{view:r,layerInfos:[S7t(i)]}:{}}async _createLegend(e){if(!this._hasLegend(e)||this._legend)return;const{default:i}=await we(()=>Promise.resolve().then(()=>Vzt),void 0),{listItem:r}=this,n=new i(this._getLegendOptions());this._legend=n,this.notifyChange("className"),this.notifyChange("title");const s=_e(()=>{var o,l;return[r==null?void 0:r.view,r==null?void 0:r.layer,(o=r==null?void 0:r.layer)==null?void 0:o.source,(l=r==null?void 0:r.layer)==null?void 0:l.parent]},()=>this._updateLegend(n),ii);this.addHandles(s,M7t),this.scheduleRender()}_hasLegend(e){const i="legend";return e===i||e!=null&&!!Array.isArray(e)&&e.includes(i)}_attachToNode(e){e.appendChild(this)}_updateLegend(e){e.set(this._getLegendOptions()),this.scheduleRender()}_getWidget(e){return e==="legend"?this._legend:B$(e)?e:null}_getFirstWidget(){const{content:e}=this;if(Array.isArray(e)){let i=null;return e.some(r=>{const n=this._getWidget(r);return n&&(i=n),!!n}),i}return this._getWidget(e)}};y([w()],Kp.prototype,"_legend",void 0),y([w()],Kp.prototype,"className",null),y([w()],Kp.prototype,"content",void 0),y([w()],Kp.prototype,"disabled",null),y([w()],Kp.prototype,"image",void 0),y([w()],Kp.prototype,"listItem",void 0),y([w()],Kp.prototype,"title",null),y([w()],Kp.prototype,"open",void 0),y([w()],Kp.prototype,"visible",void 0),Kp=y([Z("esri.widgets.LayerList.ListItemPanel")],Kp);const Dze=Kp;var OI;const O7t=it.ofType({key:"type",defaultKeyValue:"button",base:lP,typeMap:{button:cP,toggle:LB,slider:m7t}}),Nze=it.ofType(O7t),L8="layer",rX="child-list-mode",P7t="hide",R7t="esri.widgets.LayerList.ListItem";let ks=OI=class extends I_(ze){constructor(t){super(t),this.actionsSections=new Nze,this.actionsOpen=!1,this.checkPublishStatusEnabled=!1,this.children=new(it.ofType(OI)),this.childrenSortable=!0,this.hidden=!1,this.layer=null,this.layerView=null,this.listItemCreatedFunction=null,this.open=!1,this.panel=null,this.parent=null,this.sortable=!0,this.view=null}initialize(){if(this.addHandles([_e(()=>this.layer,t=>this._watchLayerProperties(t),ii),_e(()=>this.checkPublishStatusEnabled,t=>this._updateChildrenPublishing(t),ii),_e(()=>this.view,t=>this._updateChildrenView(t),ii),_e(()=>this.panel,t=>this._setListItemOnPanel(t),ii),_e(()=>[this.layer,this.view],()=>this._getLayerView(),ii)]),typeof this.listItemCreatedFunction=="function"){const t={item:this};this.listItemCreatedFunction.call(null,t)}}destroy(){this.view=null}get connectionStatus(){const{layerView:t,publishing:e}=this;if(!e&&t&&"connectionStatus"in t)return t.connectionStatus}get error(){var t;return(t=this.layer)==null?void 0:t.loadError}get incompatible(){const{layerView:t}=this;return!(!t||!("spatialReferenceSupported"in t))&&!t.spatialReferenceSupported}castPanel(t){var e;return(e=this.panel)!=null&&e.open&&!t.hasOwnProperty("open")&&(t.open=!0),t?new Dze(t):null}get title(){const t=au(this,"layer.layer");return(!t||t&&au(this,"layer.layer.loaded"))&&au(this,"layer.title")||au(this,"layer.attributes.title")||""}set title(t){this._override("title",t)}get publishing(){var i;const{layer:t,checkPublishStatusEnabled:e}=this;return e&&t&&"publishingInfo"in t&&((i=t.publishingInfo)==null?void 0:i.status)==="publishing"}get updating(){const{layerView:t,connectionStatus:e,layer:i,publishing:r}=this;return!r&&!e&&(t?t.updating:(i==null?void 0:i.loadStatus)==="loading"||!1)}get visible(){var t;return(t=this.layer)==null?void 0:t.visible}set visible(t){const e=this.layer;e&&(e.visible=t)}get visibleAtCurrentScale(){var t;return!w7t(this.layer,(t=this.view)==null?void 0:t.scale)}get visibilityMode(){return v7t(this.layer)}clone(){return new OI({actionsSections:this.actionsSections.clone(),actionsOpen:this.actionsOpen,checkPublishStatusEnabled:this.checkPublishStatusEnabled,children:this.children.clone(),layer:this.layer,listItemCreatedFunction:this.listItemCreatedFunction,open:this.open,panel:this.panel,title:this.title,view:this.view,visible:this.visible})}_setListItemOnPanel(t){t&&(t.listItem=this)}_updateChildrenPublishing(t){const e=this.children;e&&e.forEach(i=>i.checkPublishStatusEnabled=t)}_updateChildrenView(t){const e=this.children;e&&e.forEach(i=>i.view=t)}_addChildren(t){if(this.removeHandles(rX),this.children.removeAll(),!t)return;t.forEach(i=>{this.addHandles(_e(()=>i.listMode,()=>this._addChildren(t)),rX)});const e=t.filter(i=>bV(i)!==P7t);this.children.addMany(this._makeChildren(e))}_watchSublayerChanges(t){t&&this.addHandles(t.on("change",()=>{this._addChildren(t)}),L8)}_initializeChildLayers(t){this._addChildren(t),this._watchSublayerChanges(t)}_makeChildren(t){return t.map(e=>b7t(e)?new OI({layer:e,checkPublishStatusEnabled:this.checkPublishStatusEnabled,listItemCreatedFunction:this.listItemCreatedFunction,parent:this,view:this.view}):null).filter(ys).reverse()}_watchLayerProperties(t){if(this.removeHandles(L8),this.removeHandles(rX),!t)return;if(this.addHandles(_e(()=>t.listMode,()=>this._watchLayerProperties(t)),L8),bV(t)==="hide-children")return void this.children.removeAll();const e=Rze(t);e&&this.addHandles(_e(()=>t[e],i=>{t.hasOwnProperty(e)&&this._initializeChildLayers(i)},ii),L8)}async _getLayerView(){const{layer:t,view:e}=this;if(t&&e)try{const i=await e.whenLayerView(t);if(i.layer!==this.layer)return;this._set("layerView",i)}catch{}}};y([w({type:Nze})],ks.prototype,"actionsSections",void 0),y([w()],ks.prototype,"actionsOpen",void 0),y([w()],ks.prototype,"checkPublishStatusEnabled",void 0),y([w({type:it})],ks.prototype,"children",void 0),y([w()],ks.prototype,"childrenSortable",void 0),y([w({readOnly:!0})],ks.prototype,"connectionStatus",null),y([w({readOnly:!0})],ks.prototype,"error",null),y([w()],ks.prototype,"hidden",void 0),y([w({readOnly:!0})],ks.prototype,"incompatible",null),y([w()],ks.prototype,"layer",void 0),y([w({readOnly:!0})],ks.prototype,"layerView",void 0),y([w()],ks.prototype,"listItemCreatedFunction",void 0),y([w()],ks.prototype,"open",void 0),y([w({type:Dze})],ks.prototype,"panel",void 0),y([Ci("panel")],ks.prototype,"castPanel",null),y([w()],ks.prototype,"parent",void 0),y([w()],ks.prototype,"sortable",void 0),y([w()],ks.prototype,"title",null),y([w({readOnly:!0})],ks.prototype,"publishing",null),y([w({readOnly:!0})],ks.prototype,"updating",null),y([w()],ks.prototype,"view",void 0),y([w()],ks.prototype,"visible",null),y([w({readOnly:!0})],ks.prototype,"visibleAtCurrentScale",null),y([w({readOnly:!0})],ks.prototype,"visibilityMode",null),ks=OI=y([Z(R7t)],ks);const Qce=ks,T0={view:"view",viewLayers:"view-layers",mapLayers:"map-layers",layerViews:"layer-views",layerListMode:"layer-list-mode"},I7t="hide",Fze=it.ofType(Qce);let gw=class extends Dn.EventedAccessor{constructor(e){super(e),this.checkPublishStatusEnabled=!1,this.listItemCreatedFunction=null,this.operationalItems=new Fze,this.view=null}initialize(){this.addHandles([_e(()=>{var e;return[this.view,(e=this.view)==null?void 0:e.ready]},()=>this._viewHandles(),ii),_e(()=>[this.listItemCreatedFunction,this.checkPublishStatusEnabled],()=>this._recompileList())],T0.view)}destroy(){this.view=null,this.operationalItems.removeAll()}get state(){const{view:e}=this;return e!=null&&e.ready?"ready":e?"loading":"disabled"}triggerAction(e,i){e&&!e.disabled&&this.emit("trigger-action",{action:e,item:i})}moveListItem(e,i,r,n){var A,M;const s=e==null?void 0:e.layer;if(!s)return;const o=(M=(A=this.view)==null?void 0:A.map)==null?void 0:M.layers,l=i?b2e(i):o,c=r?b2e(r):o;if(!l||!c)return;const{operationalItems:f}=this,_=(i==null?void 0:i.children)||f,x=(r==null?void 0:r.children)||f,T=c.length-n;e.parent=r||null,_.includes(e)&&_.remove(e),l.includes(s)&&l.remove(s),x.includes(e)||x.add(e,T),c.includes(s)||c.add(s,T)}_createLayerViewHandles(e){this.removeHandles(T0.layerViews),this._compileList(),e&&this.addHandles(e.on("change",()=>this._compileList()),T0.layerViews)}_createMapLayerHandles(e){this.removeHandles(T0.mapLayers),this._compileList(),e&&this.addHandles(e.on("change",()=>this._compileList()),T0.mapLayers)}_createListItem(e){const{view:i,listItemCreatedFunction:r,checkPublishStatusEnabled:n}=this;return new Qce({checkPublishStatusEnabled:n,layer:e,listItemCreatedFunction:r,view:i})}_removeAllItems(){this.operationalItems.removeAll()}_getViewableLayers(e){if(e)return e.filter(i=>bV(i)!==I7t)}_watchLayersListMode(e){this.removeHandles(T0.layerListMode),e&&e.forEach(i=>{"listMode"in i&&this.addHandles(_e(()=>i.listMode,()=>this._compileList()),T0.layerListMode)})}_compileList(){var r,n;const e=(n=(r=this.view)==null?void 0:r.map)==null?void 0:n.layers;this._watchLayersListMode(e);const i=this._getViewableLayers(e);i!=null&&i.length?(this._createNewItems(i),this._removeItems(i),this._sortItems(i)):this._removeAllItems()}_createNewItems(e){const{operationalItems:i}=this;e.forEach(r=>{i.find(n=>n.layer===r)||i.add(this._createListItem(r))})}_removeItems(e){const{operationalItems:i}=this,r=[];i.forEach(n=>{n&&e&&e.includes(n.layer)||r.push(n)}),i.removeMany(r)}_sortItems(e){const{operationalItems:i}=this;i.sort((r,n)=>{const s=e.indexOf(r.layer),o=e.indexOf(n.layer);return s>o?-1:s{var i,r;return(r=(i=this.view)==null?void 0:i.map)==null?void 0:r.allLayers},i=>this._createMapLayerHandles(i),ii),_e(()=>{var i;return(i=this.view)==null?void 0:i.allLayerViews},i=>this._createLayerViewHandles(i),ii)],T0.viewLayers)}};y([w()],gw.prototype,"checkPublishStatusEnabled",void 0),y([w()],gw.prototype,"listItemCreatedFunction",void 0),y([w({type:Fze})],gw.prototype,"operationalItems",void 0),y([w({readOnly:!0})],gw.prototype,"state",null),y([w()],gw.prototype,"view",void 0),gw=y([Z("esri.widgets.LayerList.LayerListViewModel")],gw);const kze=gw;/**! + `;this._program=e.programCache.acquire(i,r,new Map([["a_pos",0]]))}dispose(){super.dispose()}_test(e){const i=this._rctx;if(!i.gl)return e.dispose(),!0;const r=new rn(1);r.wrapMode=Bi.CLAMP_TO_EDGE,r.samplingMode=ki.NEAREST;const n=new Zm(i,r),s=Yr.createVertex(i,Rr.STATIC_DRAW,new Uint16Array([0,0,1,0,0,1,1,1])),o=new r0(i,new Map([["a_pos",0]]),zDt,{geometry:s}),a=new rn;a.samplingMode=ki.LINEAR,a.wrapMode=Bi.CLAMP_TO_EDGE;const c=new Ai(i,a,k4);i.useProgram(e),i.bindTexture(c,0),e.setUniform1i("u_texture",0);const p=i.getBoundFramebufferObject(),{x:_,y:x,width:S,height:C}=i.getViewport();i.bindFramebuffer(n),i.setViewport(0,0,1,1),i.setClearColor(0,0,0,0),i.setBlendingEnabled(!1),i.clearSafe($n.COLOR_BUFFER_BIT),i.bindVAO(o),i.drawArrays(sr.TRIANGLE_STRIP,0,4);const M=new Uint8Array(4);return n.readPixels(0,0,1,1,ci.RGBA,ya.UNSIGNED_BYTE,M),o.dispose(),n.dispose(),c.dispose(),i.setViewport(_,x,S,C),i.bindFramebuffer(p),M[0]!==255}};const k4=new Image;k4.src="data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A",k4.width=5,k4.height=5,k4.decode();let VDt=class{constructor(e){this.rctx=e,this.floatBufferBlend=new FDt(e),this.svgPremultipliesAlpha=new UDt(e),this.doublePrecisionRequiresObfuscation=new NDt(e),this.ignoresSamplerPrecision=new kDt(e),this.drawArraysRequiresIndicesTypeReset=new DDt(e)}dispose(){this.ignoresSamplerPrecision.dispose(),this.doublePrecisionRequiresObfuscation.dispose(),this.svgPremultipliesAlpha.dispose(),this.floatBufferBlend.dispose(),this.drawArraysRequiresIndicesTypeReset.dispose()}};function BDt(t,e){if(e.disjointTimerQuery)return null;if(Qm(t))return{drawBuffers:t.drawBuffers.bind(t),MAX_DRAW_BUFFERS:t.MAX_DRAW_BUFFERS,MAX_COLOR_ATTACHMENTS:t.MAX_COLOR_ATTACHMENTS};if(e.drawBuffers)return null;const i=t.getExtension("WEBGL_draw_buffers");return i?{drawBuffers:i.drawBuffersWEBGL.bind(i),MAX_DRAW_BUFFERS:i.MAX_DRAW_BUFFERS_WEBGL,MAX_COLOR_ATTACHMENTS:i.MAX_COLOR_ATTACHMENTS_WEBGL}:null}function jDt(t,e){if(e.compressedTextureETC)return null;const i=t.getExtension("WEBGL_compressed_texture_etc");return i?{COMPRESSED_R11_EAC:i.COMPRESSED_R11_EAC,COMPRESSED_SIGNED_R11_EAC:i.COMPRESSED_SIGNED_R11_EAC,COMPRESSED_RG11_EAC:i.COMPRESSED_RG11_EAC,COMPRESSED_SIGNED_RG11_EAC:i.COMPRESSED_SIGNED_RG11_EAC,COMPRESSED_RGB8_ETC2:i.COMPRESSED_RGB8_ETC2,COMPRESSED_SRGB8_ETC2:i.COMPRESSED_SRGB8_ETC2,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,COMPRESSED_RGBA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC}:null}function GDt(t,e){if(e.compressedTextureS3TC)return null;const i=t.getExtension("WEBGL_compressed_texture_s3tc");return i?{COMPRESSED_RGB_S3TC_DXT1:i.COMPRESSED_RGB_S3TC_DXT1_EXT,COMPRESSED_RGBA_S3TC_DXT1:i.COMPRESSED_RGBA_S3TC_DXT1_EXT,COMPRESSED_RGBA_S3TC_DXT3:i.COMPRESSED_RGBA_S3TC_DXT3_EXT,COMPRESSED_RGBA_S3TC_DXT5:i.COMPRESSED_RGBA_S3TC_DXT5_EXT}:null}function HDt(t,e){if(Qm(t))return{MIN:t.MIN,MAX:t.MAX};if(e.blendMinMax)return null;{const i=t.getExtension("EXT_blend_minmax");return i?{MIN:i.MIN_EXT,MAX:i.MAX_EXT}:null}}function qDt(t,e){if(e.textureFilterAnisotropic)return null;const i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");return i?{MAX_TEXTURE_MAX_ANISOTROPY:i.MAX_TEXTURE_MAX_ANISOTROPY_EXT,TEXTURE_MAX_ANISOTROPY:i.TEXTURE_MAX_ANISOTROPY_EXT}:null}function WDt(t,e){if(Qm(t))return{textureFloat:!0,textureFloatLinear:!e.textureFloatLinear&&!!t.getExtension("OES_texture_float_linear"),textureHalfFloat:!0,textureHalfFloatLinear:!0,HALF_FLOAT:t.HALF_FLOAT,R16F:t.R16F,RG16F:t.RG16F,RGBA16F:t.RGBA16F,R32F:t.R32F,RG32F:t.RG32F,RGBA32F:t.RGBA32F,R11F_G11F_B10F:t.R11F_G11F_B10F,RGB16F:t.RGB16F};if(t instanceof WebGLRenderingContext){const i=!e.textureHalfFloat&&t.getExtension("OES_texture_half_float");return{textureFloat:!e.textureFloat&&!!t.getExtension("OES_texture_float"),textureFloatLinear:!e.textureFloatLinear&&!!t.getExtension("OES_texture_float_linear"),textureHalfFloat:!!i,textureHalfFloatLinear:!e.textureHalfFloatLinear&&!!t.getExtension("OES_texture_half_float_linear"),HALF_FLOAT:i?i.HALF_FLOAT_OES:void 0}}return null}function YDt(t,e){if(Qm(t)){const i=!e.colorBufferHalfFloat&&t.getExtension("EXT_color_buffer_half_float")||!e.colorBufferFloat&&t.getExtension("EXT_color_buffer_float"),r=!e.colorBufferFloat&&t.getExtension("EXT_color_buffer_float"),n=!e.floatBlend&&!e.colorBufferFloat&&t.getExtension("EXT_float_blend");return i||r||n?{textureFloat:!!r,textureHalfFloat:!!i,floatBlend:!!n,R16F:t.R16F,RG16F:t.RG16F,RGBA16F:t.RGBA16F,R32F:t.R32F,RG32F:t.RG32F,RGBA32F:t.RGBA32F,R11F_G11F_B10F:t.R11F_G11F_B10F,RGB16F:t.RGB16F}:null}if(t instanceof WebGLRenderingContext){const i=!e.colorBufferHalfFloat&&t.getExtension("EXT_color_buffer_half_float"),r=!e.colorBufferFloat&&t.getExtension("WEBGL_color_buffer_float"),n=!e.floatBlend&&!e.colorBufferFloat&&t.getExtension("EXT_float_blend");return i||r||n?{textureFloat:!!r,textureHalfFloat:!!i,floatBlend:!!n,RGBA16F:i?i.RGBA16F_EXT:void 0,RGB16F:i?i.RGB16F_EXT:void 0,RGBA32F:r?r.RGBA32F_EXT:void 0}:null}return null}function l2e(t,e,i,r,n){if(r&&Qm(t))return!0;if(e[i])return!1;for(const s of n)if(t.getExtension(s))return!0;return!1}function XDt(t,e){if(!Qm(t)||e.textureNorm16)return null;const i=t.getExtension("EXT_texture_norm16");return i?{R16:i.R16_EXT,RG16:i.RG16_EXT,RGB16:i.RGB16_EXT,RGBA16:i.RGBA16_EXT,R16_SNORM:i.R16_SNORM_EXT,RG16_SNORM:i.RG16_SNORM_EXT,RGB16_SNORM:i.RGB16_SNORM_EXT,RGBA16_SNORM:i.RGBA16_SNORM_EXT}:null}function ZDt(t,e){const i=e.loseContext&&t.getExtension("WEBGL_lose_context");return i?{loseRenderingContext:()=>i.loseContext()}:null}function JDt(t,e){if(Qm(t))return{createVertexArray:t.createVertexArray.bind(t),deleteVertexArray:t.deleteVertexArray.bind(t),bindVertexArray:t.bindVertexArray.bind(t)};if(e.vao)return null;const i=t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object");return i?{createVertexArray:i.createVertexArrayOES.bind(i),deleteVertexArray:i.deleteVertexArrayOES.bind(i),bindVertexArray:i.bindVertexArrayOES.bind(i)}:null}let KDt=class{constructor(e,i){this._gl=e,this._vertexArrayObject=null,this._compressedTextureETC=null,this._compressedTextureS3TC=null,this._textureFilterAnisotropic=null,this._textureFloat=null,this._colorBufferFloat=null,this._minMaxBlending=null,this._loseContext=null,this._drawBuffers=null,this._textureNorm16=null,this._depthTexture=null,this._textureFloatLinear=null,this._disabledExtensions=i.disabledExtensions||{},this._debugWebGLExtensions=i.debugWebGLExtensions||{}}get drawBuffers(){return this._drawBuffers||(this._drawBuffers=BDt(this._gl,this._disabledExtensions)),this._drawBuffers}get vao(){return this._vertexArrayObject||(this._vertexArrayObject=JDt(this._gl,this._disabledExtensions)),this._vertexArrayObject}get compressedTextureETC(){return this._compressedTextureETC||(this._compressedTextureETC=jDt(this._gl,this._disabledExtensions)),this._compressedTextureETC}get compressedTextureS3TC(){return this._compressedTextureS3TC||(this._compressedTextureS3TC=GDt(this._gl,this._disabledExtensions)),this._compressedTextureS3TC}get textureFilterAnisotropic(){return this._textureFilterAnisotropic||(this._textureFilterAnisotropic=qDt(this._gl,this._disabledExtensions)),this._textureFilterAnisotropic}get disjointTimerQuery(){return this._disjointTimerQuery||(this._disjointTimerQuery=iDt(this._gl,this._disabledExtensions)),this._disjointTimerQuery}get textureFloat(){return this._textureFloat||(this._textureFloat=WDt(this._gl,this._disabledExtensions)),this._textureFloat}get colorBufferFloat(){return this._colorBufferFloat||(this._colorBufferFloat=YDt(this._gl,this._disabledExtensions)),this._colorBufferFloat}get blendMinMax(){return this._minMaxBlending||(this._minMaxBlending=HDt(this._gl,this._disabledExtensions)),this._minMaxBlending}get depthTexture(){return this._depthTexture===null&&(this._depthTexture=l2e(this._gl,this._disabledExtensions,"depthTexture",!0,["WEBGL_depth_texture","MOZ_WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"])),this._depthTexture}get loseContext(){return this._loseContext||(this._loseContext=ZDt(this._gl,this._debugWebGLExtensions)),this._loseContext}get textureNorm16(){return this._textureNorm16||(this._textureNorm16=XDt(this._gl,this._disabledExtensions)),this._textureNorm16}get textureFloatLinear(){return this._textureFloatLinear===null&&(this._textureFloatLinear=l2e(this._gl,this._disabledExtensions,"textureFloatLinear",!1,["OES_texture_float_linear"])),this._textureFloatLinear}enable(e){return this[e]}},QDt=class{constructor(e,i){this.gl=e,this.instanceCounter=new uDt,this.programCache=new LDt(this),this._state=new Xwe,this._numOfDrawCalls=0,this._numOfTriangles=0,this.type=Qm(e)?cr.WEBGL2:cr.WEBGL1,this._loadExtensions(),this.configure(i)}get gl2(){return this.type===cr.WEBGL1?null:this.gl}configure(e){this._capabilities=new KDt(this.gl,e),this._parameters=new hDt(this.gl,this._capabilities,e),Ai.TEXTURE_UNIT_FOR_UPDATES=this._parameters.maxTextureImageUnits-1;const i=this.gl.getParameter(this.gl.VIEWPORT);this._state=new Xwe,this._state.viewport={x:i[0],y:i[1],width:i[2],height:i[3]},this._stateTracker=new egt({setBlending:r=>{if(r){this.setBlendingEnabled(!0),this.setBlendEquationSeparate(r.opRgb,r.opAlpha),this.setBlendFunctionSeparate(r.srcRgb,r.dstRgb,r.srcAlpha,r.dstAlpha);const n=r.color;this.setBlendColor(n.r,n.g,n.b,n.a)}else this.setBlendingEnabled(!1)},setCulling:r=>{r?(this.setFaceCullingEnabled(!0),this.setCullFace(r.face),this.setFrontFace(r.mode)):this.setFaceCullingEnabled(!1)},setPolygonOffset:r=>{r?(this.setPolygonOffsetFillEnabled(!0),this.setPolygonOffset(r.factor,r.units)):this.setPolygonOffsetFillEnabled(!1)},setDepthTest:r=>{r?(this.setDepthTestEnabled(!0),this.setDepthFunction(r.func)):this.setDepthTestEnabled(!1)},setStencilTest:r=>{if(r){this.setStencilTestEnabled(!0);const n=r.function;this.setStencilFunction(n.func,n.ref,n.mask);const s=r.operation;this.setStencilOp(s.fail,s.zFail,s.zPass)}else this.setStencilTestEnabled(!1)},setDepthWrite:r=>{r?(this.setDepthWriteEnabled(!0),this.setDepthRange(r.zNear,r.zFar)):this.setDepthWriteEnabled(!1)},setColorWrite:r=>{r?this.setColorMask(r.r,r.g,r.b,r.a):this.setColorMask(!1,!1,!1,!1)},setStencilWrite:r=>{r?this.setStencilWriteMask(r.mask):this.setStencilWriteMask(0)},setDrawBuffers:r=>{const{drawBuffers:n}=this._capabilities;if(r)n==null||n.drawBuffers(r.buffers);else{const{drawFramebuffer:s}=this._state;s===null||s.colorAttachments.length===0?n==null||n.drawBuffers([jee.BACK]):n==null||n.drawBuffers([Vu.COLOR_ATTACHMENT0])}}}),this.enforceState(),Kt(this._driverTest),this._driverTest=new VDt(this)}dispose(){Kt(this._driverTest),this.programCache.dispose(),this.bindVAO(null),this.unbindBuffer(fi.ARRAY_BUFFER),this.unbindBuffer(fi.ELEMENT_ARRAY_BUFFER),this.type===cr.WEBGL2&&(this.unbindBuffer(fi.UNIFORM_BUFFER),this._state.uniformBufferBindingPoints.length=0,this.unbindBuffer(fi.PIXEL_PACK_BUFFER),this.unbindBuffer(fi.PIXEL_UNPACK_BUFFER),this.unbindBuffer(fi.COPY_READ_BUFFER),this.unbindBuffer(fi.COPY_WRITE_BUFFER)),this._state.textureUnitMap.length=0,cm()&&console.log(this.instanceCounter.resourceInformation)}get driverTest(){return this._driverTest}get contextAttributes(){return this.gl.getContextAttributes()}get parameters(){return this._parameters}setPipelineState(e){this._stateTracker.setPipeline(e)}setBlendingEnabled(e){this._state.blend!==e&&(e===!0?this.gl.enable(this.gl.BLEND):this.gl.disable(this.gl.BLEND),this._state.blend=e,this._stateTracker.invalidateBlending())}externalProgramUpdate(){var e;(e=this._state.program)==null||e.stop(),this._state.program=null}externalTextureUnitUpdate(e,i){for(let r=0;r=0&&(this._state.activeTexture=i)}externalVertexArrayObjectUpdate(){const e=this.capabilities.vao;e&&(e.bindVertexArray(null),this._state.vertexArrayObject=null),this._state.vertexBuffer=null,this._state.indexBuffer=null}externalVertexBufferUpdate(){this._state.vertexBuffer=null}externalIndexBufferUpdate(){this._state.indexBuffer=null}setBlendColor(e,i,r,n){e===this._state.blendColor.r&&i===this._state.blendColor.g&&r===this._state.blendColor.b&&n===this._state.blendColor.a||(this.gl.blendColor(e,i,r,n),this._state.blendColor.r=e,this._state.blendColor.g=i,this._state.blendColor.b=r,this._state.blendColor.a=n,this._stateTracker.invalidateBlending())}setBlendFunction(e,i){e===this._state.blendFunction.srcRGB&&i===this._state.blendFunction.dstRGB||(this.gl.blendFunc(e,i),this._state.blendFunction.srcRGB=e,this._state.blendFunction.srcAlpha=e,this._state.blendFunction.dstRGB=i,this._state.blendFunction.dstAlpha=i,this._stateTracker.invalidateBlending())}setBlendFunctionSeparate(e,i,r,n){this._state.blendFunction.srcRGB===e&&this._state.blendFunction.srcAlpha===r&&this._state.blendFunction.dstRGB===i&&this._state.blendFunction.dstAlpha===n||(this.gl.blendFuncSeparate(e,i,r,n),this._state.blendFunction.srcRGB=e,this._state.blendFunction.srcAlpha=r,this._state.blendFunction.dstRGB=i,this._state.blendFunction.dstAlpha=n,this._stateTracker.invalidateBlending())}setBlendEquation(e){this._state.blendEquation.mode!==e&&(this.gl.blendEquation(e),this._state.blendEquation.mode=e,this._state.blendEquation.modeAlpha=e,this._stateTracker.invalidateBlending())}setBlendEquationSeparate(e,i){this._state.blendEquation.mode===e&&this._state.blendEquation.modeAlpha===i||(this.gl.blendEquationSeparate(e,i),this._state.blendEquation.mode=e,this._state.blendEquation.modeAlpha=i,this._stateTracker.invalidateBlending())}setColorMask(e,i,r,n){this._state.colorMask.r===e&&this._state.colorMask.g===i&&this._state.colorMask.b===r&&this._state.colorMask.a===n||(this.gl.colorMask(e,i,r,n),this._state.colorMask.r=e,this._state.colorMask.g=i,this._state.colorMask.b=r,this._state.colorMask.a=n,this._stateTracker.invalidateColorWrite())}setClearColor(e,i,r,n){this._state.clearColor.r===e&&this._state.clearColor.g===i&&this._state.clearColor.b===r&&this._state.clearColor.a===n||(this.gl.clearColor(e,i,r,n),this._state.clearColor.r=e,this._state.clearColor.g=i,this._state.clearColor.b=r,this._state.clearColor.a=n)}setFaceCullingEnabled(e){this._state.faceCulling!==e&&(e===!0?this.gl.enable(this.gl.CULL_FACE):this.gl.disable(this.gl.CULL_FACE),this._state.faceCulling=e,this._stateTracker.invalidateCulling())}setPolygonOffsetFillEnabled(e){this._state.polygonOffsetFill!==e&&(e===!0?this.gl.enable(this.gl.POLYGON_OFFSET_FILL):this.gl.disable(this.gl.POLYGON_OFFSET_FILL),this._state.polygonOffsetFill=e,this._stateTracker.invalidatePolygonOffset())}setPolygonOffset(e,i){this._state.polygonOffset[0]===e&&this._state.polygonOffset[1]===i||(this._state.polygonOffset[0]=e,this._state.polygonOffset[1]=i,this.gl.polygonOffset(e,i),this._stateTracker.invalidatePolygonOffset())}setCullFace(e){this._state.cullFace!==e&&(this.gl.cullFace(e),this._state.cullFace=e,this._stateTracker.invalidateCulling())}setFrontFace(e){this._state.frontFace!==e&&(this.gl.frontFace(e),this._state.frontFace=e,this._stateTracker.invalidateCulling())}setScissorTestEnabled(e){this._state.scissorTest!==e&&(e===!0?this.gl.enable(this.gl.SCISSOR_TEST):this.gl.disable(this.gl.SCISSOR_TEST),this._state.scissorTest=e)}setScissorRect(e,i,r,n){this._state.scissorRect.x===e&&this._state.scissorRect.y===i&&this._state.scissorRect.width===r&&this._state.scissorRect.height===n||(this.gl.scissor(e,i,r,n),this._state.scissorRect.x=e,this._state.scissorRect.y=i,this._state.scissorRect.width=r,this._state.scissorRect.height=n)}setDepthTestEnabled(e){this._state.depthTest!==e&&(e===!0?this.gl.enable(this.gl.DEPTH_TEST):this.gl.disable(this.gl.DEPTH_TEST),this._state.depthTest=e,this._stateTracker.invalidateDepthTest())}setClearDepth(e){this._state.clearDepth!==e&&(this.gl.clearDepth(e),this._state.clearDepth=e)}setDepthFunction(e){this._state.depthFunction!==e&&(this.gl.depthFunc(e),this._state.depthFunction=e,this._stateTracker.invalidateDepthTest())}setDepthWriteEnabled(e){this._state.depthWrite!==e&&(this.gl.depthMask(e),this._state.depthWrite=e,this._stateTracker.invalidateDepthWrite())}setDepthRange(e,i){this._state.depthRange.zNear===e&&this._state.depthRange.zFar===i||(this.gl.depthRange(e,i),this._state.depthRange.zNear=e,this._state.depthRange.zFar=i,this._stateTracker.invalidateDepthWrite())}setStencilTestEnabled(e){this._state.stencilTest!==e&&(e===!0?this.gl.enable(this.gl.STENCIL_TEST):this.gl.disable(this.gl.STENCIL_TEST),this._state.stencilTest=e,this._stateTracker.invalidateStencilTest())}setClearStencil(e){e!==this._state.clearStencil&&(this.gl.clearStencil(e),this._state.clearStencil=e)}setStencilFunction(e,i,r){this._state.stencilFunction.func===e&&this._state.stencilFunction.ref===i&&this._state.stencilFunction.mask===r||(this.gl.stencilFunc(e,i,r),this._state.stencilFunction.face=wm.FRONT_AND_BACK,this._state.stencilFunction.func=e,this._state.stencilFunction.ref=i,this._state.stencilFunction.mask=r,this._stateTracker.invalidateStencilTest())}setStencilFunctionSeparate(e,i,r,n){this._state.stencilFunction.face===e&&this._state.stencilFunction.func===i&&this._state.stencilFunction.ref===r&&this._state.stencilFunction.mask===n||(this.gl.stencilFuncSeparate(e,i,r,n),this._state.stencilFunction.face=e,this._state.stencilFunction.func=i,this._state.stencilFunction.ref=r,this._state.stencilFunction.mask=n,this._stateTracker.invalidateStencilTest())}setStencilWriteMask(e){this._state.stencilWriteMask!==e&&(this.gl.stencilMask(e),this._state.stencilWriteMask=e,this._stateTracker.invalidateStencilWrite())}setStencilOp(e,i,r){this._state.stencilOperation.face===wm.FRONT_AND_BACK&&this._state.stencilOperation.fail===e&&this._state.stencilOperation.zFail===i&&this._state.stencilOperation.zPass===r||(this.gl.stencilOp(e,i,r),this._state.stencilOperation.face=wm.FRONT_AND_BACK,this._state.stencilOperation.fail=e,this._state.stencilOperation.zFail=i,this._state.stencilOperation.zPass=r,this._stateTracker.invalidateStencilTest())}setStencilOpSeparate(e,i,r,n){this._state.stencilOperation.face===e&&this._state.stencilOperation.fail===i&&this._state.stencilOperation.zFail===r&&this._state.stencilOperation.zPass===n||(this.gl.stencilOpSeparate(e,i,r,n),this._state.stencilOperation.face=e,this._state.stencilOperation.fail=i,this._state.stencilOperation.zFail=r,this._state.stencilOperation.zPass=n,this._stateTracker.invalidateStencilTest())}setActiveTexture(e,i=!1){const r=this._state.activeTexture;return e>=0&&(i||e!==this._state.activeTexture)&&(this.gl.activeTexture(_q+e),this._state.activeTexture=e),r}clear(e){e&&this.gl.clear(e)}clearSafe(e,i=255){e&&(e&$n.COLOR_BUFFER_BIT&&this.setColorMask(!0,!0,!0,!0),e&$n.DEPTH_BUFFER_BIT&&this.setDepthWriteEnabled(!0),e&$n.STENCIL_BUFFER_BIT&&this.setStencilWriteMask(i),this.gl.clear(e))}drawArrays(e,i,r){cm()&&(this._numOfDrawCalls++,this._numOfTriangles+=c2e(e,r)),this.gl.drawArrays(e,i,r),fy(this.gl)}drawArraysInstanced(e,i,r,n){var s;(s=this.gl2)==null||s.drawArraysInstanced(e,i,r,n),fy(this.gl)}drawElements(e,i,r,n){if(cm()&&(this._numOfDrawCalls++,this._numOfTriangles+=c2e(e,i)),this.gl.drawElements(e,i,r,n),cm()){const s=ngt(this);if(s){const o=this.getBoundVAO(),a=o==null?void 0:o.indexBuffer,c=o==null?void 0:o.vertexBuffers,p={indexBuffer:a,vertexBuffers:c},_={mode:e,count:i,type:r,offset:n},x=(a==null?void 0:a.size)??0,S=n+i,C=x=this.parameters.maxTextureImageUnits||i<0)&&console.error("Input texture unit is out of range of available units!");const n=this._state.textureUnitMap[i];return(e==null?void 0:e.glName)==null?(n!=null&&(this.setActiveTexture(i,r),this.gl.bindTexture(n.descriptor.target,null)),this._state.textureUnitMap[i]=null,n):r||n!==e?(this.setActiveTexture(i,r),this.gl.bindTexture(e.descriptor.target,e.glName),e.applyChanges(),this._state.textureUnitMap[i]=e,n):(e.isDirty&&(this.setActiveTexture(i,r),e.applyChanges()),n)}unbindTexture(e){if(e!=null)for(let i=0;i=this.parameters.maxUniformBufferBindings||i<0)return console.error("Uniform buffer binding point is out of range!"),null;const r=this._state.uniformBufferBindingPoints;let n=r[i];return n==null&&(n={buffer:null,offset:0,size:0},r[i]=n),n}bindBufferBase(e,i,r){const n=this._getBufferBinding(e,i);n!=null&&(n.buffer===r&&n.offset===0&&n.size===0||(this.gl.bindBufferBase(e,i,r?r.glName:null),n.buffer=r,n.offset=0,n.size=0))}bindBufferRange(e,i,r,n,s){const o=this._getBufferBinding(e,i);if(o!=null&&!(o.buffer===r&&o.offset===n&&o.size===s)){if(n%this._parameters.uniformBufferOffsetAlignment!=0)return void console.error("Uniform buffer binding offset is not a multiple of the context offset alignment");this.gl.bindBufferRange(e,i,r.glName,n,s),o.buffer=r,o.offset=n,o.size=s}}bindUBO(e,i,r,n){i!=null?(cm()&&(n??i.byteLength)>this._parameters.maxUniformBlockSize&&console.error("Attempting to bind more data than the maximum uniform block size"),i.initialize(),r!==void 0&&n!==void 0?this.bindBufferRange(fi.UNIFORM_BUFFER,e,i.buffer,r,n):this.bindBufferBase(fi.UNIFORM_BUFFER,e,i.buffer)):this.bindBufferBase(fi.UNIFORM_BUFFER,e,null)}unbindUBO(e){for(let i=0,r=this._state.uniformBufferBindingPoints.length;i0||this.dispose()}ref(){++this._refCount}dispose(){var e;super.dispose(),(e=this._appleAmdDriverHelper)==null||e.dispose(),this.screen.destroy()}bindTechnique(e,i,r,n){return this.useProgram(e.program),this.setPipelineState(e.getPipeline(!!n)),e.program.bindPass(i,r),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??(this._appleAmdDriverHelper=new sze(this)),this._appleAmdDriverHelper.run())}get test(){var e;return{cachedWebGLObjects:this.programCache.test.cachedWebGLProgramObjects+this.screen.test.cachedWebGLObjects+(((e=this._appleAmdDriverHelper)==null?void 0:e.test.cachedWebGLObjects)??0)}}};function u2e(t){return!!t.frameUpdate}let nM=class extends ze{constructor(e,i,r){super({}),this._stage=e,this._techniqueRepository=i,this._rctx=r,this._textures=new Map,this._loadingCount=0,this._frameUpdates=new Map,this.events=new Dn,this._frameTask=e.view.resourceController.scheduler.registerTask(ni.TEXTURE_UNLOAD)}normalizeCtorArgs(){return{}}destroy(){this._frameTask.remove(),this._stage.forEachOfType(Ws.Texture,e=>e.unload())}get updating(){return this._loadingCount>0||this._frameTask.updating}get textureTechnique(){return this._textureTechnique==null&&(this._textureTechnique=this._techniqueRepository.acquire(hce,new dce)),this._textureTechnique}acquire(e){const i=this._textures.get(e);return i?(i.ref(),i.loadingPromise??i):this._createNewRef(e)}update(){let e=!1;this._frameUpdates.forEach(i=>{const r=i.texture.frameUpdate(i.previousToken);r>=0&&r!==i.previousToken&&(i.previousToken=r,e=!0)}),e&&this.events.emit("changed",so.BACKGROUND)}_createNewRef(e){const i=this._stage.getObject(e);if(i==null)return Xt(i!==void 0),null;const r=i.events.on("unloaded",()=>{r.remove(),this._onTextureUnloaded(e)}),n=new tNt(e,()=>{this._frameTask.schedule(()=>{n.isUnreferenced&&i.unload()})});return this._textures.set(e,n),n.ref(),i.glTexture?(this._updateGLTexture(n,i.glTexture),u2e(i)&&this._frameUpdates.set(e,{texture:i,previousToken:-1}),n):(this._loadingCount++,n.loadingPromise=this._stage.schedule(()=>{const s=i.load(this._rctx),o=c=>(this._loadingCount--,n.loadingPromise=null,this._updateGLTexture(n,c),u2e(i)&&this._frameUpdates.set(e,{texture:i,previousToken:-1}),n),a=c=>(this._loadingCount--,n.loadingPromise=null,on(c)||Ce.getLogger(this).error(c),null);return yd(s)?s.then(o,a):o(s)}),n.loadingPromise)}_updateGLTexture(e,i){e.glTexture=i,this.events.emit("changed",so.UPDATE)}_onTextureUnloaded(e){this._textures.delete(e),this._frameUpdates.delete(e)}};y([w()],nM.prototype,"_loadingCount",void 0),y([w()],nM.prototype,"_frameTask",void 0),y([w()],nM.prototype,"updating",null),nM=y([Z("esri.views.3d.webgl-engine.lib.TextureRepository")],nM);let tNt=class{constructor(e,i){this.id=e,this._release=i,this._refCount=0}get isUnreferenced(){return this._refCount===0}ref(){++this._refCount}release(){--this._refCount,this._refCount>0||(this._refCount!==0?(Ce.getLogger("esri.views.3d.webgl-engine.lib.TextureRepository.RefCountedTextureImpl").error("Cannot dereference texture that has no references!"),this._refCount=0):this._release())}};function iNt(t,e){return new cNe(i=>DTt(i,t),i=>i,e)}let z4=class extends ze{constructor(){super(...arguments),this._passParameters=new rNt,this._resourcesTask=null}get passParameters(){return this._passParameters}destroy(){this._resourcesTask=vn(this._resourcesTask),this._passParameters.waveNormal=Kt(this._passParameters.waveNormal),this._passParameters.wavePerturbation=Kt(this._passParameters.wavePerturbation)}get updating(){return!!this._resourcesTask&&!this._resourcesTask.finished}ensureResources(e){return this._resourcesTask||(this._resourcesTask=Oc(async i=>{await Promise.allSettled([this._loadImageResource(e,Wr("esri/images/materials/water/normals.jpg"),r=>this._passParameters.waveNormal=r,i),this._loadImageResource(e,Wr("esri/images/materials/water/perturbation.jpg"),r=>this._passParameters.wavePerturbation=r,i)])})),this._resourcesTask.finished?H2.LOADED:H2.LOADING}async _loadImageResource(e,i,r,n){try{const s=await $_(i,{signal:n});St(n);const o=new rn(s.width,s.height);o.pixelFormat=ci.RGB,o.samplingMode=ki.LINEAR_MIPMAP_LINEAR,o.hasMipmap=!0,o.maxAnisotropy=8,r(new Ai(e,o,s))}catch(s){Ce.getLogger(this).error("Failed to load water material normal texture.",s)}}};y([w()],z4.prototype,"_resourcesTask",void 0),y([w({type:Boolean,readOnly:!0})],z4.prototype,"updating",null),z4=y([Z("esri.views.3d.webgl-engine.materials.internal.WaterTextureRepository")],z4);let rNt=class extends bn{};const h2e=2048,nNt=1.5,sNt=8;function oNt(t,e){const{format:i,quality:r,rotation:n,disableDecorations:s}=t||{},o=cue(t,e.padding),a=pNt(t,{width:e.width-o.left-o.right,height:e.height-o.top-o.bottom}),{width:c,height:p}=dNt(t,a),_=gNt(i),x=wNt[_];return{format:_,quality:Je(r??x,0,100),area:a,width:c,height:p,rotation:n,disableDecorations:!!s,ignoreBackground:!!(t!=null&&t.ignoreBackground),ignorePadding:!!(t!=null&&t.ignorePadding)}}function aNt(t,e){const i=oNt(t,e),r=i.area,n=i.width/r.width,s=cue(i,e.padding),o=s.left+s.right,a=s.top+s.bottom,c=e.width-o,p=e.height-a,_=Math.floor(c*n+o),x=Math.floor(p*n+a),S=(t==null?void 0:t.layers)??[],C=i.ignoreBackground,M=i.ignorePadding;return{framebufferWidth:_,framebufferHeight:x,region:{x:Math.floor(r.x*n)+s.left,y:Math.floor(r.y*n)+s.top,width:i.width,height:i.height},format:i.format,quality:i.quality,rotation:i.rotation,pixelRatio:n,layers:S,disableDecorations:i.disableDecorations,ignoreBackground:C,ignorePadding:M,objectAndLayerIdColor:!1}}function iX(t,e,i){const{ctx:r,canvas:n}=uze(t,i),s=r.getImageData(0,0,t.width,t.height),o=cNt(n,e);return hze(n),{dataUrl:o,data:s}}function rX(t,e){const{ctx:i,canvas:r}=uze(t,e),n=i.getImageData(0,0,t.width,t.height);return hze(r),n}function uze(t,e){const i=lNt();e.premultipliedAlpha&&vNt(t),i.width=t.width,i.height=t.height;const r=i.getContext("2d",{willReadFrequently:!0});return r.putImageData(t,0,0),e.flipY&&yNt(r),{ctx:r,canvas:i}}function hze(t){t.width=0,t.height=0}function lNt(){return nX==null&&(nX=document.createElement("canvas")),nX}let nX=null;function cNt(t,e){const i=_Nt[e.format],r=e.quality/100;return t.toDataURL(i,r)}function uNt(t,e,i,r=0,n=0,s=t.width-r,o=t.height-n,a=!1){const{data:c}=t,{width:p,height:_,data:x}=e,S=s/p,C=o/_,M=Math.ceil(S/2),P=Math.ceil(C/2),$=t.width;for(let F=0;F<_;F++)for(let z=0;z=1)continue;let le=2*te*te*te-3*te*te+1;const de=4*(r+pe+(n+he)*$);ne+=le*c[de+3],j+=le,!i&&c[de+3]<255&&(le=le*c[de+3]/255),G+=le*c[de],Y+=le*c[de+1],Q+=le*c[de+2],U+=le}}x[k]=G/U,x[k+1]=Y/U,x[k+2]=Q/U,x[k+3]=ne/j}return e}function hNt(t,e,i){if(!e)return t;const{framebufferWidth:r,framebufferHeight:n,pixelRatio:s,region:o}=t,a=cue(t,i),c=a.left+a.right,p=a.top+a.bottom,_=r-c,x=n-p,S=Math.min(sNt,Math.min((h2e-c)/_,(h2e-p)/x));return Ss){const p=Math.floor(n.width/o),_=n.height-p;return{x:n.x,y:Math.floor(n.y+_/2),width:n.width,height:p}}const a=Math.floor(n.height*o),c=n.width-a;return{x:Math.floor(n.x+c/2),y:n.y,width:a,height:n.height}}function mNt(t,e){if((e==null?void 0:e.width)==null||e.height==null)return t;const i=e.width/e.height,r=t.width/t.height;if(r===i)return t;if(r0){const s=255/n;e[r]=e[r]*s,e[r+1]=e[r+1]*s,e[r+2]=e[r+2]*s}}}const _Nt={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg"},d2e=98,bNt="png",wNt={png:100,jpg:d2e,jpeg:d2e},xNt={top:0,right:0,bottom:0,left:0};let SNt=class{constructor(e,i,r){this.parameters=e,this.frameHasDecorations=i,this.fbos=r}},TNt=class{constructor(e,i,r){this._rctx=e,this._renderFunctions=i,this._forceCameraHook=r,this.supersample=!0,this._screenshotQueue=new Array}destroy(){this._rctx=null}async takeScreenshot(e){await this._renderFunctions.prepareOverlay(),this._renderFunctions.requestRenderScene(so.BACKGROUND);const i=ec();return this._screenshotQueue.push({settings:e,resolver:i}),i.promise}update(e,i){for(const r of this._screenshotQueue){if(this._rctx==null){r.resolver.reject();continue}const n={...r.settings,pixelRatio:r.settings.pixelRatio*e.parameters.camera.pixelRatio},s=this._renderScreenshot(e,n,i);r.resolver(s)}this._screenshotQueue.length=0}_renderScreenshotOverlay(e,i,r){e.width=i.width,e.height=i.height;const n=e.getContext("2d"),s=r.pixelRatio;return n.save(),n.translate(0,i.height),n.scale(1,-1),r.region&&n.translate(-r.region.x,-r.region.y),n.scale(s,s),i=this._renderFunctions.renderOverlay(e,r.disableDecorations?Kh.OFF:Kh.ON,i),n.restore(),i}_readbackScreenshot(e,i){return e.resample?this._readbackScreenshotResampled({...e,resample:e.resample},i):this._readbackScreenshotImmediate(e,i)}_readbackScreenshotResampled(e,i){const{framebufferWidth:r,framebufferHeight:n,region:s,resample:o}=e,a=this._ensureScreenshotEncodeCanvas();let c=JW(r,n,a);this._rctx.gl.readPixels(0,0,r,n,ci.RGBA,Yt.UNSIGNED_BYTE,new Uint8Array(c.data.buffer)),i(),c=this._renderScreenshotOverlay(a,c,{...e,region:void 0});const p=JW(s.width,s.height,a);return uNt(c,p,!0,o.region.x,n-(o.region.y+o.region.height),o.region.width,o.region.height)}_readbackScreenshotImmediate(e,i){const{framebufferHeight:r,region:n}=e,s=this._ensureScreenshotEncodeCanvas(),o=JW(n.width,n.height,s);return this._rctx.gl.readPixels(n.x,r-(n.y+n.height),n.width,n.height,ci.RGBA,Yt.UNSIGNED_BYTE,new Uint8Array(o.data.buffer)),i(),this._renderScreenshotOverlay(s,o,e)}_renderScreenshot(e,i,r){const n=e.parameters.camera,s={width:i.framebufferWidth,height:i.framebufferHeight};nT(s,Math.min(this._rctx.parameters.maxTextureSize,this._rctx.parameters.maxRenderbufferSize));let o=!1;const a=i.disableDecorations&&e.frameHasDecorations,c=s.width!==n.fullWidth||s.height!==n.fullHeight,p=i.ignorePadding&&n.pixelRatio!==i.pixelRatio,_=c||a||p||i.objectAndLayerIdColor;let x=null;i.objectAndLayerIdColor&&(x=e.fbos.acquire(Sr.RGBA,s.width,s.height),x.acquireDepth(ca.DEPTH_STENCIL_BUFFER));let S=null;if(_){const $=n.clone();if(i.ignorePadding){const j=G9($.padding);for(let G=0;G<4;G++)j[G]=Math.round(j[G]/$.pixelRatio*i.pixelRatio);$.padding=j}$.fullWidth=s.width,$.fullHeight=s.height,$.pixelRatio=i.pixelRatio;const F=n.fovX-$.fovX,z=n.fovY-$.fovY;F<0&&F{this._rctx.bindFramebuffer(null),S==null||S.release()};this._rctx.bindFramebuffer(S==null?void 0:S.fbo);const M=this._readbackScreenshot(i,C);let P=null;if(i.objectAndLayerIdColor){const $=()=>{this._rctx.bindFramebuffer(null),x==null||x.release()};this._rctx.bindFramebuffer(x==null?void 0:x.fbo),P=this._readbackScreenshot(i,$),this._rctx.bindFramebuffer(null)}if(_&&!this._rctx.contextAttributes.alpha)for(let $=3;${var n;return(n=this.waterTextureRepository)==null?void 0:n.updating},()=>this.requestRender(),Qt),_e(()=>e.view.qualityProfile,n=>{var s;return(s=this.renderer)==null?void 0:s.updateRenderFeatures(n)},kt),this._magnifierHelper.events.on("request-render",()=>this.requestRender())]);const{memoryController:i}=e.view.resourceController;this.stippleTextureRepository=GSt(this._rctx,i),this.markerTextureRepository=iNt(this._rctx,i),this._shaderTechniqueRepository=new rNe({rctx:this._rctx,viewingMode:e.viewingMode,stippleTextureRepository:this.stippleTextureRepository,waterTextureRepository:this.waterTextureRepository,markerTextureRepository:this.markerTextureRepository}),this._textureRepository=new nM(e,this._shaderTechniqueRepository,this._rctx),this.addHandles(this._textureRepository.events.on("changed",n=>this.requestRender(n))),this._materialRepository=new nNe(this._textureRepository,this._shaderTechniqueRepository,()=>this.requestRender(),()=>this.requestRender()),this._compositingHelper=new T9t(this._rctx,this._shaderTechniqueRepository),this.renderer=new kd(e,this._materialRepository,this._textureRepository,this._shaderTechniqueRepository,this._rctx,this._compositingHelper,this._magnifierHelper,n=>this.requestRender(n));const r={renderScene:(n,s,o,a,c)=>this.renderer.render(n,s,o,a,c),requestRenderScene:n=>this.requestRender(n),prepareOverlay:()=>e.options.screenshot.prepareOverlay(),renderOverlay:(n,s,o)=>e.options.screenshot.renderOverlay(n,s,o)};this._screenshotManager=new TNt(this._rctx,r,n=>this.events.emit("force-camera-for-screenshot",n)),this._registerFrameTask(e)}normalizeCtorArgs(){return{}}destroy(){this._container.contains(this._canvas)&&this._container.removeChild(this._canvas),this._frameTask=en(this._frameTask),this._shaderTechniqueRepository=et(this._shaderTechniqueRepository)}requestRender(e=so.UPDATE){this._needsRender=!0,e===so.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textureRepository.updating||this.waterTextureRepository.updating||this._magnifierHelper.updating}get textureRepository(){return this._textureRepository}get compositingHelper(){return this._compositingHelper}set magnifier(e){this._magnifierHelper.magnifier=e}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then(i=>i[0])}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,i,r,n,s,o=s){const a=n.constrainWindowSize(i,r,s*n.pixelRatio,o*n.pixelRatio),c=this._ensureDepthBuffer(a);this.renderer.readDepthPixels(n,a,c);let p=Number.MAX_VALUE;for(let _=0;_x&&x!==n.nearFar[0]&&x!==n.nearFar[1]&&(p=x)}if(e){const _=e.pickDepth(i*n.pixelRatio,r*n.pixelRatio,n);_!=null&&p>_&&_!==n.nearFar[0]&&_!==n.nearFar[1]&&(p=_)}return p===Number.MAX_VALUE?void 0:p}_ensureDepthBuffer(e){const i=4*e[2]*e[3];return(this._tmpDepthBuffer==null||this._tmpDepthBuffer.byteLength{r=this.updating,n=this._needsUpdate?so.UPDATE:so.BACKGROUND,e.commitSyncLayers();const c=a-this._lastAnimationUpdate;if(c>this.renderer.animationTimestep||i.forcedAnimationTime!=null||r||this._needsRender){const p=c/this.renderer.animationTimeDilation,_=new Y9e(i.camera,p,i.forcedAnimationTime);this.renderer.updateAnimation(_)&&this.requestRender(so.BACKGROUND),this._lastAnimationUpdate=a}},render:({time:a})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&i.camera.fullWidth>0&&i.camera.fullHeight>0){const c=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,this.renderer.render(null,null,i,Kh.ON,a),s=!0,c&&this.renderer.hasReflections&&(this.requestRender(so.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:a})=>{const c=this.renderer.hasSlicePlane||this._magnifierHelper.enabled||this.renderer.hasDecorations||this.renderer.hasHighlights,p=new SNt(i,c,this.renderer.fboCache);this._textureRepository.update(),this._screenshotManager.update(p,a)},finish:()=>{s&&(this.renderer.finish(i.mode===Vr.IDLE?n:so.UPDATE),s=!1)}};this._frameTask=LT(o)}_initializeContext(e){const i=e.options;this._canvas=i.canvas,this._canvas||(this._canvas=document.createElement("canvas")),this._canvas.setAttribute("style","width: 100%; height:100%; display:block;");const r={alpha:i.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:i.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:i.preserveDrawingBuffer??!1},n=igt("3d",this._canvas,r);n!=null&&Qm(n)?(this._rctx=this._newRenderingContext(n,e),this._loadShaderOnlyExtensions(),!i.alpha&&this._rctx.contextAttributes.alpha&&Ce.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested"),!this._rctx.contextAttributes.alpha&&$e("safari")>=11&&(this._container.style.backgroundColor="black"),this._container.appendChild(this._canvas)):Ce.getLogger(this).error("A WebGL2 context could not be created.")}_newRenderingContext(e,i){const r={disabledExtensions:i.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:i.options.debugWebGLExtensions||{},maxAnisotropy:8},n=(s,o)=>i.view.resourceController.memoryController.newCache(s,o);return new eNt(e,r,n)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloat")}getObjectAndLayerIdColor(e){return this.objectAndLayerIdRenderHelper!=null?this.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor(e):null}get componentObjectCollection(){return this._componentObjectCollection==null&&(this._componentObjectCollection=new _9t(this.renderer.renderPassManager,this._viewingMode)),this._componentObjectCollection}set componentObjectCollection(e){this._componentObjectCollection=e}};y([w({type:Boolean,readOnly:!0})],yl.prototype,"updating",null),y([w({autoDestroy:!0})],yl.prototype,"_rctx",void 0),y([w({autoDestroy:!0})],yl.prototype,"_container",void 0),y([w({autoDestroy:!0})],yl.prototype,"_canvas",void 0),y([w({autoDestroy:!0})],yl.prototype,"stippleTextureRepository",void 0),y([w({autoDestroy:!0})],yl.prototype,"markerTextureRepository",void 0),y([w({autoDestroy:!0})],yl.prototype,"waterTextureRepository",void 0),y([w({autoDestroy:!0})],yl.prototype,"_magnifierHelper",void 0),y([w({readOnly:!0})],yl.prototype,"objectAndLayerIdRenderHelper",void 0),y([w({autoDestroy:!0})],yl.prototype,"_textureRepository",void 0),y([w({autoDestroy:!0,readOnly:!0})],yl.prototype,"renderer",void 0),y([w({autoDestroy:!0})],yl.prototype,"_screenshotManager",void 0),y([w()],yl.prototype,"componentObjectCollection",null),y([w({autoDestroy:!0})],yl.prototype,"_componentObjectCollection",void 0),y([w()],yl.prototype,"_needsUpdate",void 0),y([w()],yl.prototype,"_needsWaterReflectionUpdate",void 0),yl=y([Z("esri.views.3d.webgl-engine.parts.RenderView")],yl);let zd=class extends ze{constructor(e){super(e),this._model=new Ak,this._layers=new Pi,this._asyncChangeSet=new wie,this._syncChangeSet=new wie,this._layerSyncSet=new Set}initialize(){this._set("renderView",new yl(this)),this._frameTask=this.view.resourceController.scheduler.registerTask(ni.STAGE,this),this.addHandles(this._frameTask)}get viewingMode(){return this.view.state.viewingMode}get updating(){return this.running||this.renderView.updating||this._frameTask.updating}get renderer(){var e;return(e=this.renderView)==null?void 0:e.renderer}add(e){this._model.add(e),YU(e)&&this._addLayer(e),this.renderView.requestRender()}remove(e){e!=null&&!this.destroyed&&this._model.remove(e)&&(YU(e)&&this._removeLayer(e),this.renderView.requestRender())}addMany(e){e!=null&&(this._model.addMany(e),this.renderView.requestRender())}removeMany(e){var i,r;e!=null&&((i=this._model)==null||i.removeMany(e),(r=this.renderView)==null||r.requestRender())}forEachOfType(e,i){this._model.forEachOfType(e,i)}handleEvent(e,i){this.destroyed||(this._model.dirtySet[e](i),this.renderView.requestRender())}get running(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty}runTask(e){this._frameTask.processQueue(e),this._commit(e)}_commit(e){const i=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll(r=>{if(e.done)return;const n=this._layerSyncSet.has(r.id)||r.updatePolicy===C2.SYNC,s=n?this._syncChangeSet:this._asyncChangeSet;i.commitLayer(r.id,s),this._layerSyncSet.delete(r.id),s.empty||(this.renderer.modify(s,n?cu:e),this.renderView.requestRender(),e.madeProgress())}),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,cu),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll(r=>{e.done||this._layerSyncSet.has(r.id)||r.updatePolicy!==C2.ASYNC||(i.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))}),this._layerSyncSet.clear(),this.notifyChange("running")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forAll(i=>{this._layerSyncSet.has(i.id)||i.updatePolicy===C2.SYNC?(e.commitLayer(i.id,this._syncChangeSet),this._layerSyncSet.delete(i.id)):e.commitSyncUpdates(i.id,this._syncChangeSet)});for(const i of this._layerSyncSet)e.commitLayer(i,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,cu),this.renderView.requestRender())}_commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,cu),this.renderView.requestRender())}schedule(e,i){return this._frameTask.schedule(e,i)}reschedule(e,i){return this._frameTask.reschedule(e,i)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}getObject(e){return this._model.getObject(e)}get layers(){return this._layers}_addLayer(e){this._layers.includes(e)||this._layers.push(e)}_removeLayer(e){this._commitLayer(e),this._layers.removeUnordered(e)!=null&&(this._model.dirtySet.getResidentRenderGeometries(e.id,this._syncChangeSet.removes),this.renderer.modify(this._syncChangeSet,cu))}addRenderPlugin(e,i){const r=this.renderer.renderPlugins.add(e,i),n=()=>{n_e(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(yd(r))return r.then(n);n()}removeRenderPlugin(e){this.destroyed||(n_e(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.renderPlugins.remove(e))}get performanceInfo(){return this._model.getStats()}get test(){const e=this;return{getCount:i=>e._model.test.content.filter(r=>r.type===i).length,model:e._model}}};zd.DebugSettings={endFrameContentValidation:!1},y([w({constructOnly:!0})],zd.prototype,"view",void 0),y([w({constructOnly:!0})],zd.prototype,"options",void 0),y([w({readOnly:!0})],zd.prototype,"viewingMode",null),y([w({constructOnly:!0})],zd.prototype,"container",void 0),y([w({readOnly:!0})],zd.prototype,"updating",null),y([w({constructOnly:!0})],zd.prototype,"_model",void 0),y([w({autoDestroy:!0})],zd.prototype,"renderView",void 0),y([w({readOnly:!0})],zd.prototype,"renderer",null),y([w({readOnly:!0})],zd.prototype,"running",null),zd=y([Z("esri.views.3d.webgl-engine.Stage")],zd);let Umi=class extends Mj{constructor(e,i,r,n){super(i,r),this.point=e,this.createGraphic=n}};function dze(t){return Xm(t)&&t.intersector===ms.PCL&&!!t.target}let Bmi=class extends TIe{constructor(e,i,r,n,s){super(e),this.layerUid=e,this.sublayerUid=i,this.nodeIndex=r,this.componentIndex=n,this.triangleNr=s}},Gmi=class extends Mj{constructor(e,i,r){super(i,null),this.point=e,this.createVoxelGraphic=r}};function jG(t){return Xm(t)&&t.intersector===ms.I3S&&!!t.target}function pze(t){return Xm(t)&&t.intersector===ms.VOXEL&&!!t.target}function p2e(t,e){var i,r;return Oj(t)||Pj(t)?h9((i=t.target)==null?void 0:i.object,e):QTt(t)?(r=e.map)==null?void 0:r.ground:dze(t)||jG(t)||INe(t)||pze(t)?h9(t.target,e):null}function ENt(t,e){const i=pre(t,e);return i!=null&&i.type==="graphic"?i.graphic:null}function pre(t,e){var i;if(t==null)return null;if(Oj(t)||Pj(t))return f2e((i=t.target)==null?void 0:i.object,e);if(dze(t)){const r=t.target.createGraphic();return{type:"graphic",graphic:r,layer:r.layer}}if(pze(t)){const r=t.target.createVoxelGraphic();return{type:"graphic",graphic:r,layer:r.layer}}return INe(t)||Cce(t)?f2e(t.target,e):jG(t)?CNt(t.target,e):null}function f2e(t,e){if((t==null?void 0:t.graphicUid)==null)return null;const i=h9(t,e);if(i==null)return null;if(i===e.graphics)return e.graphicsView==null||typeof t.graphicUid!="number"?null:e.graphicsView.getHit(t.graphicUid);const r=e.allLayerViews.find(n=>n.layer===i);return!r||r.suspended||t.graphicUid==null?null:"getHit"in r?r.getHit(t.graphicUid):null}function CNt(t,e){const i=h9(t,e);if(i==null)return null;const r=e.allLayerViews.find(n=>n.layer===i);return r&&!r.suspended&&"getGraphicFromIntersectorTarget"in r?MNt(r.getGraphicFromIntersectorTarget(t)):null}function ANt(t,e){const i=h9(t,e);if(i==null)return null;const r=e.allLayerViews.find(n=>n.layer===i);return r&&!r.suspended&&"getAABBFromIntersectorTarget"in r?r.getAABBFromIntersectorTarget(t):null}function MNt(t){return t!=null?{type:"graphic",graphic:t,layer:t.layer}:null}function h9(t,e){return(t==null?void 0:t.layerUid)==null?null:e.graphicsView!=null&&t.layerUid===e.graphicsView.processor.layer.id?e.graphics:e.map.findLayerByUid(t.layerUid)}function qmi(t,e){if(Oj(t)||Pj(t))return r_(t.target.object.boundingVolumeWorldSpace.bounds);if(Cce(t)){hCe(F8,t.transformation);const i=Math.max(F8[0],F8[1],F8[2]);return t.target.baseBoundingSphere.radius*i}if(jG(t)){const i=ANt(t.target,e);return i?.5*pMe(i):null}return null}function Wmi(t){return!Oj(t)&&!Pj(t)&&(Cce(t)?t.target.numLodLevels>1:!!jG(t))}const F8=W();async function ONt(t,e){if(t.type==="2d")return t.hitTest(e);const i=await t.hitTest(e);if(i.results.length===0)return i;const r=(i.results[0].distance??0)*(1+PNt),n=i.results.findIndex(s=>(s.distance??0)>r);return n!==-1&&(i.results=i.results.slice(0,n)),i}const PNt=.05;function RNt(t){return(t==null?void 0:t.type)==="graphic"}function INt(t){return t.find(RNt)??null}function $Nt(t){return t&&typeof t.highlight=="function"}function LNt(t){return t&&typeof t.maskOccludee=="function"}function Ymi(t,e,i){return t==null||t>i&&(e===0||t0||e!=null&&e>0}function Zmi(t){const e=t.effectiveScaleRange;return{minScale:(e==null?void 0:e.minScale)??0,maxScale:(e==null?void 0:e.maxScale)??0}}let sX,oX;function DNt(t){const e=t$e(t);for(;e.length>1;){const i=m2e(e.shift());if(i.available)return i}return m2e(e.shift())}function m2e(t){switch(t){case cr.WEBGL1:return NNt();case cr.WEBGL2:return FNt()}}function NNt(){return sX||(sX=UNt()),sX}function FNt(){return oX||(oX=VNt()),oX}let fze=class{constructor(){this.available=!1,this.majorPerformanceCaveat=!1,this.maxTextureSize=0,this.supportsVertexShaderSamplers=!1,this.supportsHighPrecisionFragment=!1,this.supportsElementIndexUint=!1,this.supportsStandardDerivatives=!1,this.supportsInstancedArrays=!1,this.supportsTextureFloat=!1,this.supportsTextureHalfFloat=!1,this.supportsColorBufferFloat=!1,this.supportsColorBufferFloatBlend=!1,this.supportsColorBufferHalfFloat=!1}},kNt=class extends fze{constructor(){super(...arguments),this.type=cr.WEBGL1}},zNt=class extends fze{constructor(){super(...arguments),this.type=cr.WEBGL2,this.supportsElementIndexUint=!0,this.supportsStandardDerivatives=!0,this.supportsInstancedArrays=!0,this.supportsTextureFloat=!0,this.supportsTextureHalfFloat=!0}};function mze(t,e){if(t===cr.WEBGL1&&typeof WebGLRenderingContext>"u"||t===cr.WEBGL2&&typeof WebGL2RenderingContext>"u")return null;const i=document.createElement("canvas");if(!i)return null;let r=qee(i,t,{failIfMajorPerformanceCaveat:!0});if(r==null&&(r=qee(i,t),r!=null&&(e.majorPerformanceCaveat=!0)),r==null)return r;if(t===cr.WEBGL1){const s=r.getParameter(r.VERSION),o=s==null?void 0:s.match(/^WebGL\s+([\d.]*)/);if(o){const a=parseFloat(o[1]);e.available=a>=.94}}else e.available=!0;e.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),e.supportsVertexShaderSamplers=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;const n=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);return n&&(e.supportsHighPrecisionFragment=n.precision>0),r}function UNt(){const t=new kNt,e=mze(cr.WEBGL1,t);return e==null||(t.supportsElementIndexUint=e.getExtension("OES_element_index_uint")!==null,t.supportsStandardDerivatives=e.getExtension("OES_standard_derivatives")!==null,t.supportsInstancedArrays=e.getExtension("ANGLE_instanced_arrays")!==null,t.supportsTextureFloat=e.getExtension("OES_texture_float")!==null,t.supportsTextureHalfFloat=e.getExtension("OES_texture_half_float")!==null,t.supportsColorBufferFloat=e.getExtension("WEBGL_color_buffer_float")!==null,t.supportsColorBufferFloatBlend=e.getExtension("EXT_float_blend")!==null,t.supportsColorBufferHalfFloat=e.getExtension("EXT_color_buffer_half_float")!==null),t}function VNt(){const t=new zNt,e=mze(cr.WEBGL2,t);return e==null||(t.supportsColorBufferFloat=e.getExtension("EXT_color_buffer_float")!==null,t.supportsColorBufferFloatBlend=e.getExtension("EXT_float_blend")!==null,t.supportsColorBufferHalfFloat=t.supportsColorBufferFloat||e.getExtension("EXT_color_buffer_half_float")!==null),t}function BNt(t){const e=DNt(t);if(!e.available)return new se("webgl:required",t==="3d"?"WebGL2 is required but not supported.":"WebGL is required but not supported.",new Error().stack);if(t==="3d"&&e.majorPerformanceCaveat)return new se("webgl:major-performance-caveat-detected","Your WebGL implementation doesn't seem to support hardware accelerated rendering. Check your browser settings or if your GPU is in a blocklist.");if(!e.supportsHighPrecisionFragment)return new se("webgl:high-precision-fragment-required","WebGL support for high precision fragment shaders is required but not supported.");if(!e.supportsVertexShaderSamplers)return new se("webgl:vertex-shader-samplers-required","WebGL support for vertex shader samplers is required but not supported.");if(e.type===cr.WEBGL1){if(!e.supportsElementIndexUint)return new se("webgl:element-index-uint-required","WebGL support for uint vertex indices is required but not supported.");if(!e.supportsStandardDerivatives)return new se("webgl:standard-derivatives-required","WebGL support for standard derivatives is required but not supported.");if(!e.supportsInstancedArrays)return new se("webgl:instanced-arrays-required","WebGL support for instanced rendering is required but not supported.")}return null}function jNt(t){return t&&"nodeType"in t}function GNt(t){return t&&typeof t.render=="function"}const g2e={component:"esri-component"};let dS=class extends ze{constructor(){super(...arguments),this.widget=null}destroy(){var e;this.node=null,(e=this.widget)==null||e.destroy()}get id(){var e,i;return this._get("id")??((e=this.widget)==null?void 0:e.id)??((i=this.node)==null?void 0:i.id)}set id(e){this._set("id",e)}set node(e){const i=this._get("node");e!==i&&(e&&e.classList.add(g2e.component),i&&i.classList.remove(g2e.component),this._set("node",e))}castNode(e){var i;return(i=this.widget)==null||i.destroy(),e?typeof e=="string"||jNt(e)?(this._set("widget",null),W9(e)):(GNt(e)&&!e.domNode&&(e.domNode=document.createElement("div")),this._set("widget",e),e.domNode):(this._set("widget",null),null)}};y([w()],dS.prototype,"id",null),y([w()],dS.prototype,"node",null),y([Ci("node")],dS.prototype,"castNode",null),y([w({readOnly:!0})],dS.prototype,"widget",void 0),dS=y([Z("esri.views.ui.Component")],dS);const Ik=dS,gze="calcite-mode-";function HNt(){return getComputedStyle(document.body).getPropertyValue("--esri-calcite-mode-name").replaceAll(/\s|'|"/g,"")}function yze(){return HNt().startsWith("dark")}function qNt(){return`${gze}${yze()?"dark":"light"}`}function WNt(t){YNt(t),t.classList.add(qNt())}function YNt(t){Array.from(t.classList).forEach(e=>{e.startsWith(gze)&&t.classList.remove(e)})}const XNt={left:0,top:0,bottom:0,right:0},vze={bottom:30,top:15,right:15,left:15},z1="esri-ui",mh={ui:z1,corner:`${z1}-corner`,innerContainer:`${z1}-inner-container`,manualContainer:`${z1}-manual-container`,cornerContainer:`${z1}-corner-container`,topLeft:`${z1}-top-left`,topRight:`${z1}-top-right`,bottomLeft:`${z1}-bottom-left`,bottomRight:`${z1}-bottom-right`};function ZNt(t){return t&&!t._started&&typeof t.postMixInProperties=="function"&&typeof t.buildRendering=="function"&&typeof t.postCreate=="function"&&typeof t.startup=="function"}function k8(t){return t===0?"0":`${t}px`}function aX(t){const e=typeof t=="object"&&t!==null&&Object.getPrototypeOf(t);return(e===null||e===Object.prototype)&&("component"in t||"index"in t||"position"in t)?t:null}function lX(t,{top:e,bottom:i,left:r,right:n}){t.style.top=e,t.style.bottom=i,t.style.left=r,t.style.right=n}let Bg=class extends Dn.EventedAccessor{constructor(e){super(e),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=new Array,this._componentMap=new Map,this._locale=ma(),this.view=null,this._applyViewPadding=()=>{const i=this.container;i&&lX(i,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{const i=this._innerContainer;i&&lX(i,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([_e(()=>{var e;return[(e=this.view)==null?void 0:e.padding,this.container]},this._applyViewPadding,Qt),_e(()=>this.padding,this._applyUIPadding,Qt),_e(()=>[this.container,this._locale],([e,i])=>{e&&e.setAttribute("lang",i)},Qt),fE(e=>{this._locale=e})])}destroy(){this.container=null;for(const e of this._components)e.destroy();this._components.length=0,this._componentMap.clear()}set container(e){const i=this._get("container");e!==i&&(e&&(e.classList.add(mh.ui),WNt(e),this._attachContainers(e)),i&&(i.classList.remove(mh.ui),lX(i,{top:"",bottom:"",left:"",right:""}),LRe(i)),this._set("container",e))}get height(){var s;const e=((s=this.view)==null?void 0:s.height)??0;if(e===0)return e;const i=this._getViewPadding(),{top:r,bottom:n}=i;return Math.max(e-r-n,0)}get padding(){return this._get("padding")}set padding(e){this._overrideIfSome("padding",e)}castPadding(e){return typeof e=="number"?{bottom:e,top:e,right:e,left:e}:{...vze,...e}}get width(){var s;const e=((s=this.view)==null?void 0:s.width)??0;if(e===0)return e;const i=this._getViewPadding(),{left:r,right:n}=i;return Math.max(e-r-n,0)}add(e,i){let r,n,s;if(Array.isArray(e))return void e.forEach(a=>this.add(a,i));const o=aX(e);o&&({index:r,position:i,component:e,key:n}=o),i&&typeof i=="object"&&({index:r,key:n,position:i,internal:s}=i),!e||i&&!this._isValidPosition(i)||this._add(e,i,r,n,s)}remove(e,i){var n;if(!e)return;if(Array.isArray(e))return e.map(s=>this.remove(s,i));const r=this._find(e);if(r){if(this._componentMap.has(r)&&((n=this._componentMap.get(r))==null?void 0:n.key)!==i)return;const s=this._components.indexOf(r),o=r.node.parentNode;return o==null||o.removeChild(r.node),this._componentMap.delete(r),this._components.splice(s,1)[0]}}empty(e,i={removeInternal:!1}){if(Array.isArray(e)){for(const s of e)this.empty(s,i);return}const r=this._positionNameToContainerLookup[e??"manual"],n=Array.prototype.slice.call(r.children).map(s=>this._findByNode(s)).filter(s=>{var o;return s==null?!1:!(((o=this._componentMap.get(s))==null?void 0:o.internal)??!1)||i.removeInternal});for(const s of n)this.remove(s)}move(e,i){if(Array.isArray(e)&&e.forEach(o=>this.move(o,i)),!e)return;let r;const n=aX(e)||aX(i);if(n&&(r=n.index,i=n.position,e=n.component||e),i&&!this._isValidPosition(i))return;const s=this.remove(e);s&&this.add(s,{position:i,index:r})}find(e){if(!e)return null;const i=this._findById(e);return i&&(i.widget||i.node)}getComponents(e,i={includeInternal:!1}){return e?Array.isArray(e)?e.flatMap(r=>this._getComponentsAtPosition(r,i)):this._getComponentsAtPosition(e,i):this._components.filter(r=>{var n;return i.includeInternal||!((n=this._componentMap.get(r))!=null&&n.internal)}).map(({widget:r,node:n})=>r??n)}getPosition(e){for(const i in this._positionNameToContainerLookup)if(this._positionNameToContainerLookup[i].contains(e))return i;return null}_add(e,i,r,n,s){e instanceof Ik||(e=new Ik({node:e})),this._place({component:e,position:i,index:r}),this._components.push(e),this._componentMap.set(e,{key:n,internal:s})}_find(e){return e?e instanceof Ik?this._findByComponent(e):typeof e=="string"?this._findById(e):this._findByNode(e.domNode||e):null}_getViewPadding(){var e;return((e=this.view)==null?void 0:e.padding)??XNt}_attachContainers(e){e.appendChild(this._innerContainer),e.appendChild(this._manualContainer)}_initContainers(){const e=document.createElement("div");e.classList.add(mh.innerContainer,mh.cornerContainer);const i=document.createElement("div");i.classList.add(mh.innerContainer,mh.manualContainer);const r=document.createElement("div");r.classList.add(mh.topLeft,mh.corner),e.appendChild(r);const n=document.createElement("div");n.classList.add(mh.topRight,mh.corner),e.appendChild(n);const s=document.createElement("div");s.classList.add(mh.bottomLeft,mh.corner),e.appendChild(s);const o=document.createElement("div");o.classList.add(mh.bottomRight,mh.corner),e.appendChild(o),this._innerContainer=e,this._manualContainer=i;const a=ZT();this._cornerNameToContainerLookup={"top-left":r,"top-right":n,"bottom-left":s,"bottom-right":o,"top-leading":a?n:r,"top-trailing":a?r:n,"bottom-leading":a?o:s,"bottom-trailing":a?s:o},this._positionNameToContainerLookup={manual:i,...this._cornerNameToContainerLookup}}_isValidPosition(e){return!!this._positionNameToContainerLookup[e]}_place(e){const i=e.position??"manual",{component:r,index:n}=e,s=this._positionNameToContainerLookup[i],o=n!=null&&n>-1;if(ZNt(r.widget)&&r.widget.startup(),!o)return void s.appendChild(r.node);const a=Array.from(s.children);if(n===0)return void(s.firstChild?g0e(r.node,s.firstChild):s.appendChild(r.node));n>=a.length?s.appendChild(r.node):g0e(r.node,a[n])}_toPixelPosition(e){return{top:k8(e.top),left:k8(e.left),right:k8(e.right),bottom:k8(e.bottom)}}_findByComponent(e){return this._components.find(i=>i===e)??null}_findById(e){return this._components.find(({id:i})=>i===e)??null}_findByNode(e){return this._components.find(({node:i})=>i===e)??null}_getComponentsAtPosition(e,i){const r=this._positionNameToContainerLookup[e];return Array.prototype.slice.call(r.children).map(n=>this._findByNode(n)).filter(ys).filter(n=>{var s;return i.includeInternal||!((s=this._componentMap.get(n))!=null&&s.internal)}).map(({widget:n,node:s})=>n??s)}};y([w()],Bg.prototype,"_locale",void 0),y([w()],Bg.prototype,"container",null),y([w()],Bg.prototype,"height",null),y([w({value:vze})],Bg.prototype,"padding",null),y([Ci("padding")],Bg.prototype,"castPadding",null),y([w()],Bg.prototype,"view",void 0),y([w()],Bg.prototype,"width",null),Bg=y([Z("esri.views.ui.UI")],Bg);const JNt=Bg,KNt={handleInterceptedEvent:(t,e,i,r)=>(t.scheduleRender(),e.properties[`on${r.type}`].apply(e.properties.bind||i,[r]))},QNt={namespace:void 0,performanceLogger:()=>{},eventHandlerInterceptor:void 0,styleApplyer:(t,e,i)=>{e.charAt(0)==="-"?t.style.setProperty(e,i):t.style[e]=i}},e8t=t=>({...QNt,...t}),t8t=(t,e)=>{const i=[];for(;t&&t!==e;)i.push(t),t=t.parentNode;return i},i8t=(t,e)=>t.find(e),y2e=(t,e,i=!1)=>{let r=t;return e.forEach((n,s)=>{const o=r!=null&&r.children?i8t(r.children,a=>a.domNode===n):void 0;i&&!o&&s!==e.length-1||(r=o)}),r},r8t=t=>{let e;const i={...KNt,...t},r=e8t(i),n=r.performanceLogger;let s,o=!0,a=!1;const c=[],p=[],_=(S,C,M)=>{var F;let P;r.eventHandlerInterceptor=(z,k,U,j)=>function(G){let Y;n("domEvent",G);const Q=t8t(G.currentTarget,P.domNode),ne=Q.some(he=>{var ce;return customElements.get((ce=he==null?void 0:he.tagName)==null?void 0:ce.toLowerCase())});if(G.eventPhase===Event.CAPTURING_PHASE||!ne)Q.reverse(),Y=y2e(P.getLastRender(),Q);else{const he=G.composedPath(),ce=he.slice(he.indexOf(G.currentTarget),he.indexOf(P.domNode)).reverse();Y=y2e(P.getLastRender(),ce,!0)}let ie;return Y&&(ie=i.handleInterceptedEvent(e,Y,this,G)),n("domEventProcessed",G),ie},(F=i.postProcessProjectionOptions)==null||F.call(i,r);const $=M();P=S(C,$,r),r.eventHandlerInterceptor=void 0,c.push(P),p.push(M),i.afterFirstVNodeRendered&&i.afterFirstVNodeRendered(P,$)};let x=()=>{if(s=void 0,o){o=!1,n("renderStart",void 0);for(let S=0;S{s||a||(s=requestAnimationFrame(x))},stop:()=>{s&&(cancelAnimationFrame(s),s=void 0),a=!0},resume:()=>{a=!1,o=!0,e.scheduleRender()},append:(S,C)=>{_(f2.append,S,C)},insertBefore:(S,C)=>{_(f2.insertBefore,S,C)},merge:(S,C)=>{_(f2.merge,S,C)},replace:(S,C)=>{_(f2.replace,S,C)},detach:S=>{for(let C=0;C{const e=new URL(t,tc.$resourcesUrl$);return e.origin!==S6.location.origin?e.href:e.pathname},s8t=t=>tc.$resourcesUrl$=t,lE=(t,e="")=>()=>{},_2e="http://www.w3.org/1999/xlink",b2e={},o8t="http://www.w3.org/2000/svg",a8t="http://www.w3.org/1999/xhtml",l8t=t=>t!=null,hue=t=>(t=typeof t,t==="object"||t==="function");function c8t(t){var e,i,r;return(r=(i=(e=t.head)===null||e===void 0?void 0:e.querySelector('meta[name="csp-nonce"]'))===null||i===void 0?void 0:i.getAttribute("content"))!==null&&r!==void 0?r:void 0}const wze=(t,e,...i)=>{let r=null,n=null,s=null,o=!1,a=!1;const c=[],p=x=>{for(let S=0;Sx[S]).join(" "))}}if(typeof t=="function")return t(e===null?{}:e,c,d8t);const _=xV(t,null);return _.$attrs$=e,c.length>0&&(_.$children$=c),_.$key$=n,_.$name$=s,_},xV=(t,e)=>{const i={$flags$:0,$tag$:t,$text$:e,$elm$:null,$children$:null};return i.$attrs$=null,i.$key$=null,i.$name$=null,i},u8t={},h8t=t=>t&&t.$tag$===u8t,d8t={forEach:(t,e)=>t.map(w2e).forEach(e),map:(t,e)=>t.map(w2e).map(e).map(p8t)},w2e=t=>({vattrs:t.$attrs$,vchildren:t.$children$,vkey:t.$key$,vname:t.$name$,vtag:t.$tag$,vtext:t.$text$}),p8t=t=>{if(typeof t.vtag=="function"){const i=Object.assign({},t.vattrs);return t.vkey&&(i.key=t.vkey),t.vname&&(i.name=t.vname),wze(t.vtag,i,...t.vchildren||[])}const e=xV(t.vtag,t.vtext);return e.$attrs$=t.vattrs,e.$children$=t.vchildren,e.$key$=t.vkey,e.$name$=t.vname,e},f8t=t=>V8t.map(e=>e(t)).find(e=>!!e),m8t=(t,e)=>t!=null&&!hue(t)?e&4?t==="false"?!1:t===""||!!t:e&2?parseFloat(t):e&1?String(t):t:t,g8t=t=>t,igi=(t,e,i)=>{const r=g8t(t);return{emit:n=>y8t(r,e,{bubbles:!!(i&4),composed:!!(i&2),cancelable:!!(i&1),detail:n})}},y8t=(t,e,i)=>{const r=tc.ce(e,i);return t.dispatchEvent(r),r},x2e=new WeakMap,v8t=(t,e,i)=>{let r=TV.get(t);G8t&&i?(r=r||new CSSStyleSheet,typeof r=="string"?r=e:r.replaceSync(e)):r=e,TV.set(t,r)},_8t=(t,e,i,r)=>{var n;let s=xze(e,i);const o=TV.get(s);if(t=t.nodeType===11?t:Lm,o)if(typeof o=="string"){t=t.head||t;let a=x2e.get(t),c;if(a||x2e.set(t,a=new Set),!a.has(s)){{c=Lm.createElement("style"),c.innerHTML=o;const p=(n=tc.$nonce$)!==null&&n!==void 0?n:c8t(Lm);p!=null&&c.setAttribute("nonce",p),t.insertBefore(c,t.querySelector("link"))}a&&a.add(s)}}else t.adoptedStyleSheets.includes(o)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,o]);return s},b8t=t=>{const e=t.$cmpMeta$,i=t.$hostElement$,r=e.$flags$,n=lE("attachStyles",e.$tagName$),s=_8t(i.shadowRoot?i.shadowRoot:i.getRootNode(),e,t.$modeName$);r&10&&(i["s-sc"]=s,i.classList.add(s+"-h"),r&2&&i.classList.add(s+"-s")),n()},xze=(t,e)=>"sc-"+(e&&t.$flags$&32?t.$tagName$+"-"+e:t.$tagName$),S2e=(t,e,i,r,n,s)=>{if(i!==r){let o=A2e(t,e),a=e.toLowerCase();if(e==="class"){const c=t.classList,p=T2e(i),_=T2e(r);c.remove(...p.filter(x=>x&&!_.includes(x))),c.add(..._.filter(x=>x&&!p.includes(x)))}else if(e==="style"){for(const c in i)(!r||r[c]==null)&&(c.includes("-")?t.style.removeProperty(c):t.style[c]="");for(const c in r)(!i||r[c]!==i[c])&&(c.includes("-")?t.style.setProperty(c,r[c]):t.style[c]=r[c])}else if(e!=="key")if(e==="ref")r&&r(t);else if(!t.__lookupSetter__(e)&&e[0]==="o"&&e[1]==="n")e[2]==="-"?e=e.slice(3):A2e(S6,a)?e=a.slice(2):e=a[2]+e.slice(3),i&&tc.rel(t,e,i,!1),r&&tc.ael(t,e,r,!1);else{const c=hue(r);if((o||c&&r!==null)&&!n)try{if(t.tagName.includes("-"))t[e]=r;else{const _=r??"";e==="list"?o=!1:(i==null||t[e]!=_)&&(t[e]=_)}}catch{}let p=!1;a!==(a=a.replace(/^xlink\:?/,""))&&(e=a,p=!0),r==null||r===!1?(r!==!1||t.getAttribute(e)==="")&&(p?t.removeAttributeNS(_2e,e):t.removeAttribute(e)):(!o||s&4||n)&&!c&&(r=r===!0?"":r,p?t.setAttributeNS(_2e,e,r):t.setAttribute(e,r))}}},w8t=/\s/,T2e=t=>t?t.split(w8t):[],Sze=(t,e,i,r)=>{const n=e.$elm$.nodeType===11&&e.$elm$.host?e.$elm$.host:e.$elm$,s=t&&t.$attrs$||b2e,o=e.$attrs$||b2e;for(r in s)r in o||S2e(n,r,s[r],void 0,i,e.$flags$);for(r in o)S2e(n,r,s[r],o[r],i,e.$flags$)},SV=(t,e,i,r)=>{const n=e.$children$[i];let s=0,o,a,c;if(bze||(uue=!0,n.$tag$==="slot"&&(oM&&r.classList.add(oM+"-s"),n.$flags$|=n.$children$?2:1)),n.$text$!==null)o=n.$elm$=Lm.createTextNode(n.$text$);else if(n.$flags$&1)o=n.$elm$=Lm.createTextNode("");else{if(rp||(rp=n.$tag$==="svg"),o=n.$elm$=Lm.createElementNS(rp?o8t:a8t,n.$flags$&2?"slot-fb":n.$tag$),rp&&n.$tag$==="foreignObject"&&(rp=!1),Sze(null,n,rp),l8t(oM)&&o["s-si"]!==oM&&o.classList.add(o["s-si"]=oM),n.$children$)for(s=0;s{tc.$flags$|=1;const i=t.childNodes;for(let r=i.length-1;r>=0;r--){const n=i[r];n["s-hn"]!==GG&&n["s-ol"]&&(Cze(n).insertBefore(n,due(n)),n["s-ol"].remove(),n["s-ol"]=void 0,uue=!0),e&&d9(n,e)}tc.$flags$&=-2},Tze=(t,e,i,r,n,s)=>{let o=t["s-cr"]&&t["s-cr"].parentNode||t,a;for(o.shadowRoot&&o.tagName===GG&&(o=o.shadowRoot);n<=s;++n)r[n]&&(a=SV(null,i,n,t),a&&(r[n].$elm$=a,o.insertBefore(a,due(e))))},Eze=(t,e,i,r,n)=>{for(;e<=i;++e)(r=t[e])&&(n=r.$elm$,Oze(r),wV=!0,n["s-ol"]?n["s-ol"].remove():d9(n,!0),n.remove())},x8t=(t,e,i,r)=>{let n=0,s=0,o=0,a=0,c=e.length-1,p=e[0],_=e[c],x=r.length-1,S=r[0],C=r[x],M,P;for(;n<=c&&s<=x;)if(p==null)p=e[++n];else if(_==null)_=e[--c];else if(S==null)S=r[++s];else if(C==null)C=r[--x];else if(z8(p,S))aM(p,S),p=e[++n],S=r[++s];else if(z8(_,C))aM(_,C),_=e[--c],C=r[--x];else if(z8(p,C))(p.$tag$==="slot"||C.$tag$==="slot")&&d9(p.$elm$.parentNode,!1),aM(p,C),t.insertBefore(p.$elm$,_.$elm$.nextSibling),p=e[++n],C=r[--x];else if(z8(_,S))(p.$tag$==="slot"||C.$tag$==="slot")&&d9(_.$elm$.parentNode,!1),aM(_,S),t.insertBefore(_.$elm$,p.$elm$),_=e[--c],S=r[++s];else{for(o=-1,a=n;a<=c;++a)if(e[a]&&e[a].$key$!==null&&e[a].$key$===S.$key$){o=a;break}o>=0?(P=e[o],P.$tag$!==S.$tag$?M=SV(e&&e[s],i,o,t):(aM(P,S),e[o]=void 0,M=P.$elm$),S=r[++s]):(M=SV(e&&e[s],i,s,t),S=r[++s]),M&&Cze(p.$elm$).insertBefore(M,due(p.$elm$))}n>c?Tze(t,r[x+1]==null?null:r[x+1].$elm$,i,r,s,x):s>x&&Eze(e,n,c)},z8=(t,e)=>t.$tag$===e.$tag$?t.$tag$==="slot"?t.$name$===e.$name$:t.$key$===e.$key$:!1,due=t=>t&&t["s-ol"]||t,Cze=t=>(t["s-ol"]?t["s-ol"]:t).parentNode,aM=(t,e)=>{const i=e.$elm$=t.$elm$,r=t.$children$,n=e.$children$,s=e.$tag$,o=e.$text$;let a;o===null?(rp=s==="svg"?!0:s==="foreignObject"?!1:rp,s==="slot"||Sze(t,e,rp),r!==null&&n!==null?x8t(i,r,e,n):n!==null?(t.$text$!==null&&(i.textContent=""),Tze(i,null,e,n,0,n.length-1)):r!==null&&Eze(r,0,r.length-1),rp&&s==="svg"&&(rp=!1)):(a=i["s-cr"])?a.parentNode.textContent=o:t.$text$!==o&&(i.data=o)},Aze=t=>{const e=t.childNodes;let i,r,n,s,o,a;for(r=0,n=e.length;r{let e,i,r,n,s,o,a=0;const c=t.childNodes,p=c.length;for(;a=0;o--)i=r[o],!i["s-cn"]&&!i["s-nr"]&&i["s-hn"]!==e["s-hn"]&&(E2e(i,n)?(s=fm.find(_=>_.$nodeToRelocate$===i),wV=!0,i["s-sn"]=i["s-sn"]||n,s?s.$slotRefNode$=e:fm.push({$slotRefNode$:e,$nodeToRelocate$:i}),i["s-sr"]&&fm.map(_=>{E2e(_.$nodeToRelocate$,i["s-sn"])&&(s=fm.find(x=>x.$nodeToRelocate$===i),s&&!_.$slotRefNode$&&(_.$slotRefNode$=s.$slotRefNode$))})):fm.some(_=>_.$nodeToRelocate$===i)||fm.push({$nodeToRelocate$:i}));e.nodeType===1&&Mze(e)}},E2e=(t,e)=>t.nodeType===1?t.getAttribute("slot")===null&&e===""||t.getAttribute("slot")===e:t["s-sn"]===e?!0:e==="",Oze=t=>{t.$attrs$&&t.$attrs$.ref&&t.$attrs$.ref(null),t.$children$&&t.$children$.map(Oze)},S8t=(t,e)=>{const i=t.$hostElement$,r=t.$cmpMeta$,n=t.$vnode$||xV(null,null),s=h8t(e)?e:wze(null,null,e);GG=i.tagName,r.$attrsToReflect$&&(s.$attrs$=s.$attrs$||{},r.$attrsToReflect$.map(([o,a])=>s.$attrs$[a]=i[o])),s.$tag$=null,s.$flags$|=4,t.$vnode$=s,s.$elm$=n.$elm$=i.shadowRoot||i,oM=i["s-sc"],_ze=i["s-cr"],bze=(r.$flags$&1)!==0,wV=!1,aM(n,s);{if(tc.$flags$|=1,uue){Mze(s.$elm$);let o,a,c,p,_,x,S=0;for(;S{},pue=(t,e)=>(t.$flags$|=16,T8t(t,t.$ancestorComponent$),q8t(()=>E8t(t,e))),E8t=(t,e)=>{const i=t.$hostElement$,r=lE("scheduleUpdate",t.$cmpMeta$.$tagName$),n=i;let s;return e?s=DO(n,"componentWillLoad"):s=DO(n,"componentWillUpdate"),s=C2e(s,()=>DO(n,"componentWillRender")),r(),C2e(s,()=>C8t(t,n,e))},C8t=async(t,e,i)=>{const r=t.$hostElement$,n=lE("update",t.$cmpMeta$.$tagName$);r["s-rc"],i&&b8t(t);const s=lE("render",t.$cmpMeta$.$tagName$);A8t(t,e,r),s(),n(),M8t(t)},A8t=(t,e,i)=>{try{v2e=e,e=e.render&&e.render(),t.$flags$&=-17,t.$flags$|=2,(sM.hasRenderFn||sM.reflect)&&(sM.vdomRender||sM.reflect)&&(sM.hydrateServerSide||S8t(t,e))}catch(a){x6(a,t.$hostElement$)}return v2e=null,null},M8t=t=>{const e=t.$cmpMeta$.$tagName$,i=t.$hostElement$,r=lE("postUpdate",e),n=i;t.$ancestorComponent$,DO(n,"componentDidRender"),t.$flags$&64?(DO(n,"componentDidUpdate"),r()):(t.$flags$|=64,DO(n,"componentDidLoad"),r())},rgi=t=>{{const e=w6(t),i=e.$hostElement$.isConnected;return i&&(e.$flags$&18)===2&&pue(e,!1),i}},DO=(t,e,i)=>{if(t&&t[e])try{return t[e](i)}catch(r){x6(r)}},C2e=(t,e)=>t&&t.then?t.then(e):e(),O8t=(t,e)=>w6(t).$instanceValues$.get(e),P8t=(t,e,i,r)=>{const n=w6(t),s=t,o=n.$instanceValues$.get(e),a=n.$flags$,c=s;i=m8t(i,r.$members$[e][0]);const p=Number.isNaN(o)&&Number.isNaN(i);if(i!==o&&!p){n.$instanceValues$.set(e,i);{if(r.$watchers$&&a&128){const x=r.$watchers$[e];x&&x.map(S=>{try{c[S](i,o,e)}catch(C){x6(C,s)}})}if((a&18)===2){if(c.componentShouldUpdate&&c.componentShouldUpdate(i,o,e)===!1)return;pue(n,!1)}}}},R8t=(t,e,i)=>{if(e.$members$){t.watchers&&(e.$watchers$=t.watchers);const r=Object.entries(e.$members$),n=t.prototype;r.map(([s,[o]])=>{(o&31||o&32)&&Object.defineProperty(n,s,{get(){return O8t(this,s)},set(a){P8t(this,s,a,e)},configurable:!0,enumerable:!0})});{const s=new Map;n.attributeChangedCallback=function(o,a,c){tc.jmp(()=>{const p=s.get(o);if(this.hasOwnProperty(p))c=this[p],delete this[p];else if(n.hasOwnProperty(p)&&typeof this[p]=="number"&&this[p]==c)return;this[p]=c===null&&typeof this[p]=="boolean"?!1:c})},t.observedAttributes=r.filter(([o,a])=>a[0]&15).map(([o,a])=>{const c=a[1]||o;return s.set(c,o),a[0]&512&&e.$attrsToReflect$.push([o,c]),c})}}return t},I8t=async(t,e,i,r,n)=>{if(!(e.$flags$&32)&&(n=t.constructor,e.$flags$|=32,customElements.whenDefined(i.$tagName$).then(()=>e.$flags$|=128),n.style)){let o=n.style;typeof o!="string"&&(o=o[e.$modeName$=f8t(t)]);const a=xze(i,e.$modeName$);if(!TV.has(a)){const c=lE("registerStyles",i.$tagName$);v8t(a,o,!!(i.$flags$&1)),c()}}e.$ancestorComponent$,pue(e,!0)},$8t=t=>{},L8t=t=>{if(!(tc.$flags$&1)){const e=w6(t),i=e.$cmpMeta$,r=lE("connectedCallback",i.$tagName$);e.$flags$&1?(Pze(t,e,i.$listeners$),$8t(e.$lazyInstance$)):(e.$flags$|=1,i.$flags$&12&&D8t(t),i.$members$&&Object.entries(i.$members$).map(([n,[s]])=>{if(s&31&&t.hasOwnProperty(n)){const o=t[n];delete t[n],t[n]=o}}),I8t(t,e,i)),r()}},D8t=t=>{const e=t["s-cr"]=Lm.createComment("");e["s-cn"]=!0,t.insertBefore(e,t.firstChild)},N8t=t=>{if(!(tc.$flags$&1)){const e=w6(t);e.$rmListeners$&&(e.$rmListeners$.map(i=>i()),e.$rmListeners$=void 0)}},ngi=(t,e)=>{const i={$flags$:e[0],$tagName$:e[1]};i.$members$=e[2],i.$listeners$=e[3],i.$watchers$=t.$watchers$,i.$attrsToReflect$=[];const r=t.prototype.connectedCallback,n=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__registerHost(){U8t(this,i)},connectedCallback(){L8t(this),r&&r.call(this)},disconnectedCallback(){N8t(this),n&&n.call(this)},__attachShadow(){this.attachShadow({mode:"open",delegatesFocus:!!(i.$flags$&16)})}}),t.is=i.$tagName$,R8t(t,i)},sgi=(t,e)=>e,Pze=(t,e,i,r)=>{i&&i.map(([n,s,o])=>{const a=k8t(t,n),c=F8t(e,o),p=z8t(n);tc.ael(a,s,c,p),(e.$rmListeners$=e.$rmListeners$||[]).push(()=>tc.rel(a,s,c,p))})},F8t=(t,e)=>i=>{try{sM.lazyLoad||t.$hostElement$[e](i)}catch(r){x6(r)}},k8t=(t,e)=>e&4?Lm:e&8?S6:e&16?Lm.body:t,z8t=t=>B8t?{passive:(t&1)!==0,capture:(t&2)!==0}:(t&2)!==0,Rze=new WeakMap,w6=t=>Rze.get(t),U8t=(t,e)=>{const i={$flags$:0,$hostElement$:t,$cmpMeta$:e,$instanceValues$:new Map};return Pze(t,i,e.$listeners$),Rze.set(t,i)},A2e=(t,e)=>e in t,x6=(t,e)=>(0,console.error)(t,e),TV=new Map,V8t=[],S6=typeof window<"u"?window:{},Lm=S6.document||{head:{}},ogi=S6.HTMLElement||class{},tc={$flags$:0,$resourcesUrl$:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,i,r)=>t.addEventListener(e,i,r),rel:(t,e,i,r)=>t.removeEventListener(e,i,r),ce:(t,e)=>new CustomEvent(t,e)},B8t=(()=>{let t=!1;try{Lm.addEventListener("e",null,Object.defineProperty({},"passive",{get(){t=!0}}))}catch{}return t})(),j8t=t=>Promise.resolve(t),G8t=(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})(),mre=[],Ize=[],$ze=(t,e)=>i=>{t.push(i),fre||(fre=!0,e&&tc.$flags$&4?H8t(gre):tc.raf(gre))},M2e=t=>{for(let e=0;e{M2e(mre),M2e(Ize),(fre=mre.length>0)&&tc.raf(gre)},H8t=t=>j8t().then(t),agi=$ze(mre,!1),q8t=$ze(Ize,!0);/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. + * v1.11.0 + */const Lze="calcite-mode-auto",Dze="calcite-mode-dark",W8t="calcite-mode-light",O2e={autoMode:Lze,darkMode:Dze,lightMode:W8t,rtl:"calcite--rtl",calciteAnimate:"calcite-animate",calciteAnimateIn:"calcite-animate__in",calciteAnimateInUp:"calcite-animate__in-up",calciteAnimateInDown:"calcite-animate__in-down",calciteAnimateInRight:"calcite-animate__in-right",calciteAnimateInLeft:"calcite-animate__in-left",calciteAnimateInScale:"calcite-animate__in-scale"};/*! +* tabbable 6.2.0 +* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE +*/var Nze=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],EV=Nze.join(","),Fze=typeof Element>"u",cE=Fze?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,CV=!Fze&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t==null?void 0:t.ownerDocument},AV=function t(e,i){var r;i===void 0&&(i=!0);var n=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=n===""||n==="true",o=s||i&&e&&t(e.parentNode);return o},Y8t=function(e){var i,r=e==null||(i=e.getAttribute)===null||i===void 0?void 0:i.call(e,"contenteditable");return r===""||r==="true"},kze=function(e,i,r){if(AV(e))return[];var n=Array.prototype.slice.apply(e.querySelectorAll(EV));return i&&cE.call(e,EV)&&n.unshift(e),n=n.filter(r),n},zze=function t(e,i,r){for(var n=[],s=Array.from(e);s.length;){var o=s.shift();if(!AV(o,!1))if(o.tagName==="SLOT"){var a=o.assignedElements(),c=a.length?a:o.children,p=t(c,!0,r);r.flatten?n.push.apply(n,p):n.push({scopeParent:o,candidates:p})}else{var _=cE.call(o,EV);_&&r.filter(o)&&(i||!e.includes(o))&&n.push(o);var x=o.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(o),S=!AV(x,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(x&&S){var C=t(x===!0?o.children:x.children,!0,r);r.flatten?n.push.apply(n,C):n.push({scopeParent:o,candidates:C})}else s.unshift.apply(s,o.children)}}return n},Uze=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Vze=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Y8t(e))&&!Uze(e)?0:e.tabIndex},X8t=function(e,i){var r=Vze(e);return r<0&&i&&!Uze(e)?0:r},Z8t=function(e,i){return e.tabIndex===i.tabIndex?e.documentOrder-i.documentOrder:e.tabIndex-i.tabIndex},Bze=function(e){return e.tagName==="INPUT"},J8t=function(e){return Bze(e)&&e.type==="hidden"},K8t=function(e){var i=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return i},Q8t=function(e,i){for(var r=0;rsummary:first-of-type"),o=s?e.parentElement:e;if(cE.call(o,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof n=="function"){for(var a=e;e;){var c=e.parentElement,p=CV(e);if(c&&!c.shadowRoot&&n(c)===!0)return P2e(e);e.assignedSlot?e=e.assignedSlot:!c&&p!==e.ownerDocument?e=p.host:e=c}e=a}if(r7t(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return P2e(e);return!1},s7t=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var i=e.parentElement;i;){if(i.tagName==="FIELDSET"&&i.disabled){for(var r=0;r=0)},a7t=function t(e){var i=[],r=[];return e.forEach(function(n,s){var o=!!n.scopeParent,a=o?n.scopeParent:n,c=X8t(a,o),p=o?t(n.candidates):a;c===0?o?i.push.apply(i,p):i.push(a):r.push({documentOrder:s,tabIndex:c,item:n,isScope:o,content:p})}),r.sort(Z8t).reduce(function(n,s){return s.isScope?n.push.apply(n,s.content):n.push(s.content),n},[]).concat(i)},l7t=function(e,i){i=i||{};var r;return i.getShadowRoot?r=zze([e],i.includeContainer,{filter:yre.bind(null,i),flatten:!1,getShadowRoot:i.getShadowRoot,shadowRootFilter:o7t}):r=kze(e,i.includeContainer,yre.bind(null,i)),a7t(r)},lgi=function(e,i){i=i||{};var r;return i.getShadowRoot?r=zze([e],i.includeContainer,{filter:MV.bind(null,i),flatten:!0,getShadowRoot:i.getShadowRoot}):r=kze(e,i.includeContainer,MV.bind(null,i)),r},cgi=function(e,i){if(i=i||{},!e)throw new Error("No node provided");return cE.call(e,EV)===!1?!1:yre(i,e)},c7t=Nze.concat("iframe").join(","),ugi=function(e,i){if(i=i||{},!e)throw new Error("No node provided");return cE.call(e,c7t)===!1?!1:MV(i,e)};const u7t={getShadowRoot:!0};function hgi(t){return Array.isArray(t)?t:Array.from(t)}function dgi(t){const e=Gze(t,`.${O2e.darkMode}, .${O2e.lightMode}`);return e!=null&&e.classList.contains("calcite-mode-dark")?"dark":"light"}function pgi(t){const e="dir",i=`[${e}]`,r=Gze(t,i);return r?r.getAttribute(e):"ltr"}function fue(t){return t.getRootNode()}function fgi(t){const e=fue(t);return"host"in e?e:null}function jze(t){return t.host||null}function mgi(t,{selector:e,id:i}){function r(n){if(!n)return null;n.assignedSlot&&(n=n.assignedSlot);const s=fue(n),o=i?"getElementById"in s?s.getElementById(i):null:e?s.querySelector(e):null,a=jze(s);return o||(a?r(a):null)}return r(t)}function Gze(t,e){function i(r){return r?r.closest(e)||i(jze(fue(r))):null}return i(t)}function h7t(t,e){return Hze(t,e)}function Hze(t,e){if(!t)return;const i=e(t);if(i!==void 0)return i;const{parentNode:r}=t;return Hze(r instanceof ShadowRoot?r.host:r,e)}function ggi(t,e){return!!h7t(e,i=>i===t?!0:void 0)}function d7t(t){return typeof(t==null?void 0:t.setFocus)=="function"}async function p7t(t){if(t)return d7t(t)?t.setFocus():t.focus()}function ygi(t){t&&(l7t(t,u7t)[0]||t).focus()}const p9=":not([slot])";function vgi(t,e,i){e&&!Array.isArray(e)&&typeof e!="string"&&(i=e,e=null);const r=e?Array.isArray(e)?e.map(n=>`[slot="${n}"]`).join(","):`[slot="${e}"]`:p9;return i!=null&&i.all?f7t(t,r,i):m7t(t,r,i)}function qze(t,e){return t?Array.from(t.children||[]).filter(i=>i==null?void 0:i.matches(e)):[]}function f7t(t,e,i){let r=e===p9?qze(t,p9):Array.from(t.querySelectorAll(e));r=i&&i.direct===!1?r:r.filter(s=>s.parentElement===t),r=i!=null&&i.matches?r.filter(s=>s==null?void 0:s.matches(i.matches)):r;const n=i==null?void 0:i.selector;return n?r.map(s=>Array.from(s.querySelectorAll(n))).reduce((s,o)=>[...s,...o],[]).filter(s=>!!s):r}function m7t(t,e,i){let r=e===p9?qze(t,p9)[0]||null:t.querySelector(e);r=i&&i.direct===!1||(r==null?void 0:r.parentElement)===t?r:null,r=i!=null&&i.matches?r!=null&&r.matches(i.matches)?r:null:r;const n=i==null?void 0:i.selector;return n?r==null?void 0:r.querySelector(n):r}function _gi(t,e){return Array.from(t.children).filter(i=>i.matches(e))}function bgi(t,e,i){if(typeof e=="string"&&e!=="")return e;if(e==="")return t[i]}function wgi(t,e){return!(e.left>t.right||e.rightt.bottom||e.bottome.nodeType===Node.TEXT_NODE).map(e=>e.textContent).join("").trim()}function y7t(t){return!!g7t(t)}function v7t(t){return t.target.assignedNodes({flatten:!0})}function _7t(t){return!!b7t(t).length}function b7t(t){return t.target.assignedElements({flatten:!0})}function Tgi(t){return!!(t.isPrimary&&t.button===0)}const Egi=(t,e,i,r=!0)=>{const n=t.indexOf(e),s=n===0,o=n===t.length-1;r&&(i=i==="previous"&&s?"last":i==="next"&&o?"first":i);let a;return i==="previous"?a=t[n-1]||t[r?t.length-1:n]:i==="next"?a=t[n+1]||t[r?0:n]:i==="last"?a=t[t.length-1]:a=t[0],p7t(a),a};function Cgi(t,e){if(t.parentNode!==e.parentNode)return!1;const i=Array.from(t.parentNode.children);return i.indexOf(t)t.contains(Dze)||t.contains(Lze)&&e?"dark":"light",r=o=>document.body.dispatchEvent(new CustomEvent("calciteModeChange",{bubbles:!0,detail:{mode:o}})),n=o=>{s!==o&&r(o),s=o};let s=i();r(s),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",o=>n(o.matches?"dark":"light")),new MutationObserver(()=>n(i())).observe(document.body,{attributes:!0,attributeFilter:["class"]})}function w7t(){typeof window<"u"&&typeof location<"u"&&typeof document<"u"&&window.location===location&&window.document===document&&(document.readyState==="interactive"?R2e():document.addEventListener("DOMContentLoaded",()=>R2e(),{once:!0}))}const x7t=w7t;x7t();let Wze;function S7t(){try{n8t(".")}catch{s8t(Wh(Wr(Wze)))}}function Il(t){var i;const e=[];for(const r of Object.keys(t))customElements.get(`calcite-${r}`)||e.push((i=t[r])==null?void 0:i.call(t));return e.length>0?Promise.all(e):null}Wze="components/assets";const Yze=Symbol("widget"),Xze=Symbol("widget-test-data"),T7t=[],E7t={},OV=new WeakMap;function Zze(t,e){let i=e.children;if(i!=null&&i.length)for(let n=0;nJze(t))),queueMicrotask(()=>{o[Xze].projector.renderNow()})}function A7t(t,e,i,{widgetProperties:r}){var s;const n=OV.get(t);n&&(n.set(r),(s=n.afterUpdate)==null||s.call(n,n,t))}function Jze(t){var i;const e=OV.get(t);e&&((i=e.afterRemoved)==null||i.call(e,e,t),e.destroy(),OV.delete(t))}function PV(t){return typeof t=="function"&&t[Yze]}const oi={arrowDown:"esri-icon-arrow-down",arrowUp:"esri-icon-arrow-up",basemap:"esri-icon-basemap",bookmark:"esri-icon-bookmark",calendar:"esri-icon-calendar",checkMark:"esri-icon-check-mark",checkboxUnchecked:"esri-icon-checkbox-unchecked",close:"esri-icon-close",collapse:"esri-icon-collapse",defaultAction:"esri-icon-default-action",description:"esri-icon-description",directions:"esri-icon-directions",dockBottom:"esri-icon-dock-bottom",dockLeft:"esri-icon-dock-left",dockRight:"esri-icon-dock-right",down:"esri-icon-down",downArrow:"esri-icon-down-arrow",download:"esri-icon-download",dragHorizontal:"esri-icon-drag-horizontal",dragVertical:"esri-icon-drag-vertical",duplicate:"esri-icon-duplicate",edit:"esri-icon-edit",elevationProfile:"esri-icon-elevation-profile",environmentSettings:"esri-icon-environment-settings",erase:"esri-icon-erase",error:"esri-icon-error",expand:"esri-icon-expand",fontFallbackText:"esri-icon-font-fallback-text",forward:"esri-icon-forward",gear:"esri-icon-gear",handleHorizontal:"esri-icon-handle-horizontal",handleVertical:"esri-icon-handle-vertical",home:"esri-icon-home",icon:"esri-icon",launchLinkExternal:"esri-icon-launch-link-external",layerList:"esri-icon-layer-list",layers:"esri-icon-layers",left:"esri-icon-left",leftArrows:"esri-icon-left-arrow",leftTriangleArrow:"esri-icon-left-triangle-arrow",lineOfSight:"esri-icon-line-of-sight",link:"esri-icon-link",linkExternal:"esri-icon-link-external",linkHorizontal:"esri-icon-link-horizontal",loadingIndicator:"esri-icon-loading-indicator",locate:"esri-icon-locate",locateCircled:"esri-icon-locate-circled",locked:"esri-icon-locked",mapPin:"esri-icon-map-pin",maximize:"esri-icon-maximize",measure:"esri-icon-measure",measureArea:"esri-icon-measure-area",measureBuildingHeightShadow:"esri-icon-measure-building-height-shadow",measureLine:"esri-icon-measure-line",menu:"esri-icon-menu",minimize:"esri-icon-minimize",minus:"esri-icon-minus",nonVisible:"esri-icon-non-visible",northNavigation:"esri-icon-north-navigation",noticeTriangle:"esri-icon-notice-triangle",organization:"esri-icon-organization",pan:"esri-icon-pan",pan2:"esri-icon-pan2",partlyCloudy:"esri-icon-partly-cloudy",pause:"esri-icon-pause",play:"esri-icon-play",playCircled:"esri-icon-play-circled",plus:"esri-icon-plus",polyline:"esri-icon-polyline",printer:"esri-icon-printer",radioChecked:"esri-icon-radio-checked",radioUnchecked:"esri-icon-radio-unchecked",refresh:"esri-icon-refresh",reverse:"esri-icon-reverse",right:"esri-icon-right",rightArrow:"esri-icon-right-arrow",rightTriangleArrow:"esri-icon-right-triangle-arrow",rotate:"esri-icon-rotate",save:"esri-icon-save",search:"esri-icon-search",settings2:"esri-icon-settings2",slice:"esri-icon-slice",swap:"esri-icon-swap",table:"esri-icon-table",timeClock:"esri-icon-time-clock",tracking:"esri-icon-tracking",trash:"esri-icon-trash",unlockedLinkHorizontal:"esri-icon-unlocked-link-horizontal",up:"esri-icon-up",upArrow:"esri-icon-up-arrow",upDownArrows:"esri-icon-up-down-arrows",urbanModel:"esri-icon-urban-model",vertexGps:"esri-icon-vertex-gps",visible:"esri-icon-visible",zoomInFixed:"esri-icon-zoom-in-fixed",zoomInMagnifyingGlass:"esri-icon-zoom-in-magnifying-glass",zoomOutFixed:"esri-icon-zoom-out-fixed",zoomToObject:"esri-icon-zoom-to-object"},I2e=new Set;function M7t(t){I2e.add(t),t.finally(()=>I2e.delete(t))}var Kze;const O7t="esri.widgets.Widget";let P7t=0;const R7t={widgetIcon:oi.checkboxUnchecked};function Qze(t,e){for(const i in e)t[i]!=null&&(typeof t[i]=="object"&&typeof e[i]=="object"?Qze(t[i],e==null?void 0:e[i]):t[i]=e[i]);return t}const I7t=r8t({postProcessProjectionOptions(t){const e=t.eventHandlerInterceptor,i=/capture$/i;t.eventHandlerInterceptor=(r,n,s,o)=>{const a=e==null?void 0:e(r,n,s,o),c=i.test(r);if(!((r=r.replace(i,"")).toLowerCase()in s)||c){const p=r[2].toLowerCase()+r.slice(3),_=C=>a==null?void 0:a.call(s,C);s.addEventListener(p,_,c);const x=()=>s.removeEventListener(p,_,c),S=o.afterRemoved;o.afterRemoved=C=>{S==null||S(C),x()}}return a}},handleInterceptedEvent(t,e,i,r){const{eventPhase:n,type:s}=r,o=n===Event.CAPTURING_PHASE;let a=`on${s}${o?"capture":""}`;const c=e.properties;(c&&a in c||(a=`on${s[0].toUpperCase()}${s.slice(1)}${o?"Capture":""}`,c&&a in c))&&(mIe(),t.scheduleRender(),c[a].call(c.bind||i,r))}});let cX=!1,za=class extends $9(Dn.EventedAccessor){constructor(e,i){super(e,i),this._attached=!1,this._projector=I7t,this._readyForTrueRender=!1,this.iconClass=R7t.widgetIcon,this.icon=null,this.key=this,this._loadLocale=n5(async()=>{var a;if((a=this._messageBundleProps)!=null&&a.length){const c=await Promise.allSettled(this._messageBundleProps.map(async({bundlePath:p,propertyName:_})=>{if(this.destroyed)return;let x=await gE(p);this.uiStrings&&Object.keys(this.uiStrings)&&(x=Qze(Pe(x),this.uiStrings)),this[_]=x}));if(this.destroyed)return;for(const p of c)p.status==="rejected"&&Ce.getLogger(this).error("widget-intl:locale-error",this.declaredClass,p.reason)}await this.loadLocale()}),S7t();const r="esri-widget-uid-"+Zf(),n=this.render.bind(this);this._trackingTarget=new sB(()=>this.scheduleRender());const s=()=>{var x;if(!this._readyForTrueRender||this.destroyed)return null;const a=n();let{properties:c}=a;c||(a.properties=c={});const{key:p}=c;if(p||(c.key=r),PV(a.vnodeSelector)){if(!this.visible)return{vnodeSelector:"div",properties:{key:`${r}-hidden`,class:"",styles:{display:"none"}},domNode:null,children:void 0,text:void 0}}else this.visible?c.styles||(c.styles={}):(c.class="",c.styles={display:"none"}),c.styles.display||(c.styles.display="");let _=0;return(x=a.children)==null||x.forEach(S=>{if(PV(S.vnodeSelector))return;let{properties:C}=S;C||(S.properties=C={}),C.key||(C.key=`${this.id}--${_++}`)}),Zze(this,a)};this.render=()=>{if(cX)return s();let a=Mpt(this)??null;if(a)return a;this._trackingTarget.clear(),cX=!0;try{a=g_(this._trackingTarget,s)}catch(c){throw console.error(c),c}finally{cX=!1}return a&&Opt(this,a),a};const o=this.beforeFirstRender();o?this._resourcesFetch=o.then(()=>{this._readyForTrueRender=!0,this._postInitialize()}):(this._resourcesFetch=Promise.resolve().then(()=>{this._postInitialize()}),this._readyForTrueRender=!0),this.addResolvingPromise(this._resourcesFetch),M7t(this._resourcesFetch)}normalizeCtorArgs(e,i){const r={...e};return i&&(r.container=i),r}postInitialize(){}beforeFirstRender(){var i;const e=this.loadDependencies();return(i=this._messageBundleProps)!=null&&i.length||e?Promise.all([e,this._loadLocale()]).then(()=>{}).catch(aZ):null}loadDependencies(){return null}loadLocale(){return null}destroy(){this.destroyed||(et(this._trackingTarget),et(this.viewModel),this._detach(this.container),this._set("container",null),this._emitter.clear(),this.render=()=>null,this._projector=null,cq(this))}set container(e){this._get("container")||this._set("container",e)}castContainer(e){return W9(e)}get domNode(){return this.container}set domNode(e){this.container=e}get id(){var e;return this._get("id")||((e=this.container)==null?void 0:e.id)||Date.now().toString(16)+"-widget-"+P7t++}set id(e){e&&this._set("id",e)}get label(){return this.declaredClass.split(".").pop()}set label(e){this._overrideIfSome("label",e)}get renderable(){return this._resourcesFetch}get visible(){return this._get("visible")}set visible(e){this._set("visible",e)}get[(Kze=Yze,Xze)](){return{projector:this._projector}}render(){throw new Error("not implemented")}scheduleRender(){this.destroyed||(cq(this),this._projector.scheduleRender())}own(e){uSe(Ce.getLogger(this.declaredClass),"`Widget.own()` is deprecated in favor of Widget.addHandles()'",{replacement:"Widget.addHandles()",version:"4.28"}),this.addHandles(e)}classes(...e){return rT.apply(this,e)}renderNow(){cq(this),this._projector.renderNow()}_postInitialize(){var i;if(this.destroyed)return;this.scheduleRender(),(i=this._delegatedEventNames)!=null&&i.length&&this.addHandles(_e(()=>this.viewModel,(r,n)=>{n&&this.removeHandles("delegated-events"),r&&rB(r)&&this.addHandles(this._delegatedEventNames.map(s=>r5(r,s,o=>{this.emit(s,o)})),"delegated-events")},kt)),this.postInitialize();const e=async()=>{await this._loadLocale().catch(aZ),this.scheduleRender()};this.addHandles([fE(e),_e(()=>this.uiStrings,e),Oo(()=>this.container,r=>{this.destroyed||this._attach(r)},{initial:!0,once:!0})])}_attach(e){e&&(this._projector.merge(e,this.render),this._attached=!0)}_detach(e){var i;this._attached&&(this._projector.detach(this.render),this._attached=!1),(i=e==null?void 0:e.parentNode)==null||i.removeChild(e)}};za[Kze]=!0,y([w()],za.prototype,"_readyForTrueRender",void 0),y([w({value:null})],za.prototype,"container",null),y([Ci("container")],za.prototype,"castContainer",null),y([w()],za.prototype,"iconClass",void 0),y([w()],za.prototype,"icon",void 0),y([w()],za.prototype,"id",null),y([w()],za.prototype,"label",null),y([w()],za.prototype,"renderable",null),y([w()],za.prototype,"uiStrings",void 0),y([w()],za.prototype,"viewModel",void 0),y([w({value:!0})],za.prototype,"visible",null),y([w()],za.prototype,"key",void 0),y([w()],za.prototype,"children",void 0),y([w()],za.prototype,"afterCreate",void 0),y([w()],za.prototype,"afterUpdate",void 0),y([w()],za.prototype,"afterRemoved",void 0),za=y([Z(O7t)],za);const hn=za;function $2e(t,e){return t&&"copyright"in t&&(!e||typeof t.originOf=="function"&&t.originOf("copyright")==="user")}function $7t(t,e){return t.length!==e.length||t.some((i,r)=>i.text!==e[r].text)}function U8(t,e,i){!i||!e||t.find(r=>r.layerView===e&&r.text===i)||t.push({text:i,layerView:e})}function L7t(t){return t.type==="bing-maps"}const kb=[];let lM=class extends ze{constructor(e){super(e),this._clear=()=>{this._fetchedAttributionData.clear(),this._pendingAttributions.clear(),this.removeHandles("suspension"),this.notifyChange("state")},this._pendingAttributions=new Set,this._fetchedAttributionData=new Map,this.items=new tt,this.view=null,this._allLayerViewsChange=i=>{var n;this.removeHandles("suspension");const r=(n=this.view)==null?void 0:n.allLayerViews;r&&this.addHandles(r.map(s=>_e(()=>{var o;return[s.suspended,(o=s.layer)==null?void 0:o.attributionVisible]},()=>this._updateAttributionItems())).toArray(),"suspension"),i!=null&&i.removed&&i.removed.forEach(s=>{this._pendingAttributions.delete(s),this._fetchedAttributionData.delete(s)}),this._updateAttributionItems()},this.addHandles([Jr(()=>{var i;return(i=this.view)==null?void 0:i.allLayerViews},"change",i=>this._allLayerViewsChange(i),{onListenerAdd:()=>this._allLayerViewsChange(),onListenerRemove:this._clear}),Oo(()=>{var i;return((i=this.view)==null?void 0:i.stationary)===!0},()=>this._updateAttributionItems())])}destroy(){this.view=null,this._fetchedAttributionData.clear(),this._pendingAttributions.clear(),this.items.removeAll()}get state(){var e;return(e=this.view)!=null&&e.ready?this._pendingAttributions.size>0?"loading":"ready":"disabled"}_updateAttributionItems(){const e=this.view,i=e==null?void 0:e.allLayerViews;kb.length=0,e&&i?(i.forEach(r=>{var o,a;if(r.suspended||!((o=r.layer)!=null&&o.attributionVisible))return;const n=r.layer;if($2e(n,"user"))return void U8(kb,r,n.copyright);if(n.hasAttributionData){if(this._fetchedAttributionData.has(r)){const c=this._fetchedAttributionData.get(r);return void(c?U8(kb,r,this._getDynamicAttribution(c,e,n)):$2e(n)&&U8(kb,r,n.copyright))}return void this._fetchAttributionData(r)}const s="portalItem"in n?(a=n.portalItem)==null?void 0:a.accessInformation:void 0;U8(kb,r,s||n.copyright)}),$7t(this.items,kb)&&(this.items.removeAll(),this.items.addMany(kb)),kb.length=0,this.notifyChange("state")):this._clear()}async _fetchAttributionData(e){if(this._pendingAttributions.has(e))return;this._pendingAttributions.add(e);const i=await ih(e.layer.fetchAttributionData());if(this._pendingAttributions.has(e)){const r=i.ok?this._createContributionIndex(i.value,L7t(e.layer)):null;this._pendingAttributions.delete(e),this._fetchedAttributionData.set(e,r)}this._updateAttributionItems()}_createContributionIndex(e,i){const r=e.contributors,n={};if(!r)return n;for(let s=0;s{const S=x.id,C=!p.has(S)&&c&&x.extent&&Xne(x.extent,c);return C&&p.add(S),C}).sort((x,S)=>S.score-x.score||x.objectId-S.objectId).map(x=>x.attribution).join(", "):""}};y([w({readOnly:!0,type:tt})],lM.prototype,"items",void 0),y([w({readOnly:!0})],lM.prototype,"state",null),y([w()],lM.prototype,"view",void 0),lM=y([Z("esri.widgets.Attribution.AttributionViewModel")],lM);const eUe=lM,it={anchor:"esri-widget__anchor",anchorDisabled:"esri-widget__anchor--disabled",button:"esri-button",buttonDisabled:"esri-button--disabled",buttonHalf:"esri-button--half",buttonSecondary:"esri-button--secondary",buttonSmall:"esri-button--small",buttonTertiary:"esri-button--tertiary",buttonThird:"esri-button--third",disabled:"esri-disabled",disabledElement:"esri-disabled-element",empty:"esri-widget__content--empty",emptyIllustration:"esri-widget__content-illustration--empty",heading:"esri-widget__heading",hidden:"esri-hidden",input:"esri-input",interactive:"esri-interactive",loader:"esri-widget__loader",loaderAnimation:"esri-widget__loader-animation",loaderText:"esri-widget__loader-text",menu:"esri-menu",menuHeader:"esri-menu__header",menuItem:"esri-menu__list-item",menuItemActive:"esri-menu__list-item--active",menuItemFocus:"esri-menu__list-item--focus",menuList:"esri-menu__list",noBookmarksIcon:"esri-widget__no-bookmark-icon",panel:"esri-widget--panel",panelHeightOnly:"esri-widget--panel-height-only",primaryTick:"primary-tick",primaryTickAmPm:"primary-tick__ampm",primaryTickLabel:"primary-tick__label",rotating:"esri-rotating",secondaryTick:"secondary-tick",select:"esri-select",table:"esri-widget__table",widget:"esri-widget",widgetButton:"esri-widget--button",widgetButtonActive:"esri-widget--button-active",widgetDisabled:"esri-widget--disabled"};function wo(){return function(t,e){if(!t[e])throw new TypeError(`Cannot auto bind undefined function '${String(e)}'`);return{value:N7t(t[e])}}}function D7t(t){const e=t==null?void 0:t.type;return t instanceof KeyboardEvent||e==="keyup"||e==="keydown"||e==="keypress"}function N7t(t){return function(e,...i){D7t(e)?NM(e.key)&&(e.preventDefault(),e.stopPropagation(),e.target.click()):t.call(this,e,...i)}}function Gr(t){return(e,i)=>{e.hasOwnProperty("_messageBundleProps")||(e._messageBundleProps=e._messageBundleProps?e._messageBundleProps.slice():[]),e._messageBundleProps.push({bundlePath:t,propertyName:i})}}var F7t=function(t){return{vnodeSelector:"",properties:void 0,children:void 0,text:t.toString(),domNode:null}},tUe=function(t,e){for(var i=0,r=t.length;ir.forEach(({target:n})=>this._checkSourceTextOverflow(n))),this.iconClass=a3.widgetIcon,this.icon=null,this.itemDelimiter=" | ",this.messages=null,this.viewModel=new eUe}initialize(){this.addHandles(Jr(()=>{var e;return(e=this.viewModel)==null?void 0:e.items},"change",()=>this.scheduleRender()))}destroy(){var e;(e=this._resizeObserver)==null||e.disconnect()}get _isInteractive(){return this._isOpen||this._attributionTextOverflowed}get attributionText(){return this.viewModel.items.reduce((e,i)=>(e.includes(i.text)||e.push(i.text),e),[]).join(this.itemDelimiter)}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e={[a3.open]:this._isOpen};return X("div",{bind:this,class:this.classes(a3.base,it.widget,e),dir:"ltr",onclick:this._toggleState,onkeydown:this._toggleState},this._renderSourcesNode(),this._renderPoweredBy())}_renderPoweredBy(){return X("div",{class:a3.poweredBy},"Powered by"," ",X("a",{class:a3.link,href:"http://www.esri.com/",rel:"noreferrer",target:"_blank"},"Esri"))}_renderSourcesNode(){const e=this._isOpen,i=this._isInteractive,r=i?0:void 0,{attributionText:n}=this,s={[a3.sourcesOpen]:e,[it.interactive]:i};return X("div",{afterCreate:this._afterSourcesNodeCreate,bind:this,class:this.classes(a3.sources,s),innerHTML:n,tabIndex:r})}_afterSourcesNodeCreate(e){this._prevSourceNodeHeight=e.clientWidth,this._resizeObserver.observe(e)}_checkSourceTextOverflow(e){let i=!1;const{clientHeight:r,clientWidth:n,scrollWidth:s}=e,o=s>n,a=this._attributionTextOverflowed!==o;if(this._attributionTextOverflowed=o,a&&(i=!0),this._isOpen){const c=r{let e=class extends t{constructor(...i){super(...i),this.goToOverride=null,this.view=null}callGoTo(i){const{view:r}=this;return Gy(r),this.goToOverride?this.goToOverride(r,i):r.goTo(i.target,i.options)}};return y([w()],e.prototype,"goToOverride",void 0),y([w()],e.prototype,"view",void 0),e=y([Z("esri.widgets.support.GoTo")],e),e},V7t="esri.widgets.CompassViewModel";let pS=class extends HG(ze){constructor(e){super(e),this.orientation={x:0,y:0,z:0},this.view=null,this._updateForCamera=this._updateForCamera.bind(this),this._updateForRotation=this._updateForRotation.bind(this),this._updateRotationWatcher=this._updateRotationWatcher.bind(this)}initialize(){this.addHandles(_e(()=>this.view,this._updateRotationWatcher,Qt))}destroy(){this.view=null}get canShowNorth(){return U7t(this.view)}get state(){var e;return!((e=this.view)!=null&&e.ready)||this.view.type==="2d"&&!this.view.constraints.rotationEnabled?"disabled":this.canShowNorth?"compass":"rotation"}reset(){var i,r;if(!((i=this.view)!=null&&i.ready))return;const e={};((r=this.view)==null?void 0:r.type)==="2d"?e.rotation=0:e.heading=0,this.callGoTo({target:e})}_updateForRotation(e){e!=null&&(this.orientation={z:e})}_updateForCamera(e){if(!e)return;const i=-e.heading;this.orientation={x:0,y:0,z:i}}_updateRotationWatcher(e){this.removeAllHandles(),e&&this.addHandles(e.type==="2d"?_e(()=>e==null?void 0:e.rotation,this._updateForRotation,Qt):_e(()=>e==null?void 0:e.camera,this._updateForCamera,Qt))}};y([w({readOnly:!0})],pS.prototype,"canShowNorth",null),y([w()],pS.prototype,"orientation",void 0),y([w({readOnly:!0})],pS.prototype,"state",null),y([w()],pS.prototype,"view",void 0),pS=y([Z(V7t)],pS);const iUe=pS,L2e="esri-compass",uX={base:L2e,widgetIcon:oi.locateCircled,iconContainer:`${L2e}__icon-container`};let jg=class extends hn{constructor(e,i){super(e,i),this.iconClass=uX.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new iUe,this._reset=()=>{this.viewModel.reset()},this._toRotationTransform=r=>({transform:`rotateZ(${r.z}deg)`})}loadDependencies(){return Il({button:()=>we(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([214,215,216,217,218,219,220,221,222,223,224,225,226,227])),icon:()=>we(()=>import("./calcite-icon-ZhRmLRGh.js"),__vite__mapDeps([228,225,222]))})}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}reset(){return this.viewModel.reset()}render(){const{orientation:e,state:i}=this.viewModel,r=i==="rotation"?"arrow-up":"compass-needle",{messages:n}=this;return X("div",{class:this.classes(uX.base,it.widget)},X("calcite-button",{"aria-label":n.reset,class:it.widgetButton,disabled:i==="disabled",kind:"neutral",onclick:this._reset,round:!0,scale:"s",title:n.reset},X("div",{"aria-hidden":"true",class:uX.iconContainer,title:n.reset},X("calcite-icon",{icon:r,scale:"m",styles:this._toRotationTransform(e)}))))}};y([w()],jg.prototype,"goToOverride",null),y([w()],jg.prototype,"iconClass",void 0),y([w()],jg.prototype,"icon",void 0),y([w()],jg.prototype,"label",null),y([w(),Gr("esri/widgets/Compass/t9n/Compass")],jg.prototype,"messages",void 0),y([w()],jg.prototype,"view",null),y([w({type:iUe})],jg.prototype,"viewModel",void 0),jg=y([Z("esri.widgets.Compass")],jg);const B7t=jg,JC="esri-navigation-toggle",U1={base:JC,widgetIcon:oi.pan2,button:`${JC}__button`,activeButton:`${JC}__button--active`,panButton:`${JC}__button--pan`,rotateButton:`${JC}__button--rotate`,isLayoutHorizontal:`${JC}--horizontal`};let cM=class extends ze{constructor(e){super(e),this.navigationMode="pan",this.view=null}initialize(){this.addHandles(Oo(()=>{var e;return(e=this.view)==null?void 0:e.inputManager},()=>this._setNavigationMode()))}destroy(){this.view=null}get state(){var e,i;return(e=this.view)!=null&&e.ready&&((i=this.view)==null?void 0:i.type)==="3d"?"ready":"disabled"}toggle(){this.state!=="disabled"&&(this.navigationMode=this.navigationMode!=="pan"?"pan":"rotate",this._setNavigationMode())}_setNavigationMode(){var i;const e=(i=this.view)==null?void 0:i.inputManager;e&&(e.primaryDragAction=this.navigationMode==="pan"?"pan":"rotate")}};y([w({readOnly:!0})],cM.prototype,"state",null),y([w()],cM.prototype,"navigationMode",void 0),y([w()],cM.prototype,"view",void 0),cM=y([Z("esri.widgets.NavigationToggleViewModel")],cM);const rUe=cM;let X0=class extends hn{constructor(e,i){super(e,i),this.iconClass=U1.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new rUe}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}set layout(e){e!=="horizontal"&&(e="vertical"),this._set("layout",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}toggle(){return this.viewModel.toggle()}render(){var c,p;const e=((c=this.viewModel)==null?void 0:c.state)==="disabled",i=((p=this.viewModel)==null?void 0:p.navigationMode)==="pan",r={[it.disabled]:e,[U1.isLayoutHorizontal]:this.layout==="horizontal"},n={[U1.activeButton]:i},s={[U1.activeButton]:!i},o=e?-1:0,a=this.messages.toggle;return X("div",{"aria-label":a,bind:this,class:this.classes(U1.base,it.widget,r),onclick:this._toggle,onkeydown:this._toggle,tabIndex:o,title:a},X("div",{class:this.classes(U1.button,it.widgetButton,U1.panButton,n)},X("span",{class:oi.pan})),X("div",{class:this.classes(U1.button,it.widgetButton,U1.rotateButton,s)},X("span",{class:oi.rotate})))}_toggle(){this.toggle()}};y([w()],X0.prototype,"iconClass",void 0),y([w()],X0.prototype,"icon",void 0),y([w()],X0.prototype,"label",null),y([w({value:"vertical"})],X0.prototype,"layout",null),y([w(),Gr("esri/widgets/NavigationToggle/t9n/NavigationToggle")],X0.prototype,"messages",void 0),y([w()],X0.prototype,"view",null),y([w({type:rUe})],X0.prototype,"viewModel",void 0),y([wo()],X0.prototype,"_toggle",null),X0=y([Z("esri.widgets.NavigationToggle")],X0);const j7t=X0,Ll="esri-feature",G7t={base:Ll,container:`${Ll}__size-container`,title:`${Ll}__title`,main:`${Ll}__main-container`,btn:`${Ll}__button`,icon:`${Ll}__icon`,content:`${Ll}__content`,contentNode:`${Ll}__content-node`,contentNodeText:`${Ll}__content-node--text`,contentElement:`${Ll}__content-element`,text:`${Ll}__text`,lastEditedInfo:`${Ll}__last-edited-info`,fields:`${Ll}__fields`,fieldHeader:`${Ll}__field-header`,fieldData:`${Ll}__field-data`,fieldDataDate:`${Ll}__field-data--date`,loadingSpinnerContainer:`${Ll}__loading-container`,spinner:`${Ll}__loading-spinner`};let fv=class extends hn{constructor(){super(...arguments),this.enabled=!0,this.iconClass=null,this.icon=null,this.title=""}render(){const e=this.enabled?0:-1,i={[it.disabled]:!this.enabled,[it.interactive]:this.enabled};return X("div",{bind:this,class:this.classes(it.widgetButton,it.widget,i),onclick:this._triggerAction,onkeydown:this._triggerAction,role:"button",tabIndex:e,title:this.title},X("span",{"aria-hidden":"true",class:this.classes(G7t.icon,this.iconClass??""),role:"presentation"}),X("span",{class:oi.fontFallbackText},this.title))}_triggerAction(){this.action.call(this)}};y([w()],fv.prototype,"action",void 0),y([w()],fv.prototype,"enabled",void 0),y([w()],fv.prototype,"iconClass",void 0),y([w()],fv.prototype,"icon",void 0),y([w()],fv.prototype,"title",void 0),y([wo()],fv.prototype,"_triggerAction",null),fv=y([Z("esri.widgets.IconButton")],fv);const D2e=fv;let fS=class extends ze{get canZoomIn(){var r,n,s;if(!((r=this.view)==null?void 0:r.ready))return!1;const i=(s=(n=this.view)==null?void 0:n.constraints)==null?void 0:s.effectiveMaxScale;return i===0||this._scale>i}get canZoomOut(){var n;const{view:e}=this;if(!(e==null?void 0:e.ready))return!1;const r=(n=e.constraints)==null?void 0:n.effectiveMinScale;return r===0||this._scale{this.components.forEach(r=>{const n=this._find(r),s=n==null?void 0:n.widget;Y7t(s)&&(s.view=i)})},this._componentsWatcher=(i,r)=>{this._removeComponents(r),this._addComponents(i),this._adjustPadding(i)}}initialize(){this.addHandles([_e(()=>this.components,this._componentsWatcher,Qt),_e(()=>this.view,this._updateViewAwareWidgets,Qt)])}_add(e,i,r,n,s){let o=e;if(typeof e=="string"&&this._defaultPositionLookup[e]){if(this._find(e))return;o=this._createComponent(e)}super._add(o,i,r,n,s)}_removeComponents(e){e.forEach(i=>{const r=this._find(i);r&&(this.remove(r),r.destroy())})}_adjustPadding(e){if(!e.includes("attribution")&&!this._isOverridden("padding")){const{top:i}=this.padding;this.padding=i}}_addComponents(e){this.constructed&&e.forEach(i=>this.add(this._createComponent(i),this._defaultPositionLookup[i]))}_createComponent(e){const i=this._createWidget(e);return new Ik({id:e,node:i})}_createWidget(e){const{view:i}=this;switch(e){case"attribution":return new z7t({view:i});case"compass":return new B7t({view:i});case"navigation-toggle":return new j7t({view:i});case"zoom":return new W7t({view:i})}}};y([w()],$k.prototype,"components",void 0),$k=y([Z("esri.views.ui.DefaultUI")],$k);const sUe=$k;let Lk=class extends sUe{constructor(e){super(e),this.components=["attribution","zoom","navigation-toggle","compass"]}};y([w()],Lk.prototype,"components",void 0),Lk=y([Z("esri.views.ui.3d.DefaultUI3D")],Lk);const oUe=Lk;let Nt=class extends Ddt(d0t(Zpt(O0t))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new O_({slicePlane:VRe},this),this._resourceController=SRt(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new uie({view:this}),this.labeler=new oS({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new CP,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new kS,this.environmentManager=new z0,this.floors=new tt,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new I0t({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new X5t,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new oUe,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlightOptions=new j7e,tdt(),e!=null&&e.environment||(this._defaults.environment=new GA,this.environment=this._defaults.environment);const i=(r=null)=>{r!=null&&r.type===xn.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach(async n=>{try{await n.when()}catch{}this._updatingChanged()}))};this.addHandles([Jr(()=>{var r;return(r=this.map)==null?void 0:r.allLayers},"after-changes",r=>i(r),{onListenerAdd:()=>i(),onListenerRemove:()=>i(),sync:!0}),this.allLayerViews.on("after-changes",r=>this._updateUpdatingMonitors(r)),_e(()=>this.map,r=>{r&&"load"in r&&r.load&&r.load().catch(()=>{})})]),this.inputManager=new fwt({view:this}),this.stateManager=new na({view:this})}initialize(){this.groundView=new e0t({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.addHandles(Jr(()=>{var i;return(i=this.map)==null?void 0:i.allLayers},"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,i=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=i)},Qt),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,i=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=i)},Qt),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,i=>dHe(i>0?1e3/Math.ceil(i):0),Qt),this.updatingHandles.add(()=>{var i;return(i=this.map)==null?void 0:i.ground},e,kt),this.updatingHandles.add(()=>{var i,r;return(r=(i=this.map)==null?void 0:i.ground)==null?void 0:r.opacity},()=>this._updateDefaultHitTestOptions(),kt),this.addHandles(_e(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),Li))}destroy(){var e;this.destroyed||(this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=et(this.sharedSymbolResources),this._set("labeler",et(this.labeler)),this._set("deconflictor",et(this.deconflictor)),this._resourceController=et(this._resourceController),this._set("stateManager",et(this.stateManager)),this._set("inputManager",et(this.inputManager)),this.state.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",et(this.environmentManager)),this._set("environment",et(this.environment)),this.groundView=et(this.groundView),this._exitBasemapTerrain(),(e=this._stage)==null||e.destroy())}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){var e;return(e=this.basemapTerrain)==null?void 0:e.spatialReference}get animation(){var e;return(e=this.state)==null?void 0:e.animation}get camera(){var e;return(e=this.stateManager)==null?void 0:e.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){var e;return(e=this.stateManager)==null?void 0:e.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){var e;return(e=this.stateManager)==null?void 0:e.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if(this.viewingMode==="global")return null;const e=this.map;let i=this._userClippingArea||bhe(e,"clippingArea");return!this._userClippingArea&&!bhe(e,"clippingEnabled")||i==null?(this._clippingArea=null,null):i instanceof Vi?this.spatialReference&&(i=V8(i,this.spatialReference),i==null)?(Ce.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(i=i.clone(),i.intersection(this._groundAndLayersExtent)==null&&(i.xmin=i.xmax,i.ymin=i.ymax),i.zmin=void 0,i.zmax=void 0,i.equals(this._clippingArea)||(this._clippingArea=i),this._clippingArea):(Ce.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&this.viewingMode==="global"&&e!=null?Ce.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===_t.Global)return null;const e=this.renderSpatialReference,i=this.dataExtent;return i==null||e==null||i.spatialReference.equals(e)?i:V8(i,e)}get dataExtent(){let e=this._groundAndLayersExtent;const i=this.spatialReference||rt.WGS84,r=V8(this.clippingArea,i);r!=null&&(e=e!=null?e.intersection(r):r);const n=this._get("dataExtent");return e!=null&&e.equals(n)?n:e}get _groundAndLayersExtent(){const e=this.spatialReference||rt.WGS84;let i;const r=o=>{const a=V8(o,e);a!=null&&(i!=null?i.union(a):i=a.clone())},n=this.basemapTerrain;if(n!=null&&n.spatialReference){const o=n.groundExtent;r(new Vi({xmin:o[0],ymin:o[1],zmin:0,xmax:o[2],ymax:o[3],zmax:0,spatialReference:n.spatialReference}))}if(this.map){const o=a=>{a.fullExtent==null||a.type==="graphics"&&a.internal||r(a.fullExtent)};this.map.allLayers.forEach(a=>o(a))}if(i==null)return null;i.hasZ?(i.zmin=Math.min(0,i.zmin??0),i.zmax=Math.max(0,i.zmax??0)):(i.zmin=0,i.zmax=0);const s=this._get("_groundAndLayersExtent");return i.equals(s)?s:i}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof GA?e:e instanceof SP?this.environment!=null?this.environment.cloneWithWebsceneEnvironment(e):GA.fromWebsceneEnvironment(e):_s(GA,e):new GA}get extent(){var e;return(e=this.stateManager)==null?void 0:e.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){var e;return(e=this.stateManager)==null?void 0:e.screenCenter}get frustum(){var e;return(e=this.stateManager)==null?void 0:e.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){var e;return this.navigating||(((e=this.toolViewManager)==null?void 0:e.interacting)??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state==null||this.state.stationary)}get navigating(){var e;return((e=this.state)==null?void 0:e.navigating)??!1}get padding(){var e;return(e=this.stateManager)==null?void 0:e.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){vk.isValidProfile(e)&&(vk.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||vk.getDefaultProfile()}set slicePlane(e){if(this._stage!=null&&this._stage.renderer.setParameters({slicePlane:e}),e==null)return void this._set("slicePlane",null);const i=this._propertiesPool.get("slicePlane");AE(e,i),this._set("slicePlane",i)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return this.spatialReference!=null?J5e(this.scale,this.spatialReference):0}get scale(){var e;return(e=this.stateManager)==null?void 0:e.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return e!=null?B_.deriveUnitFromSR(e,this.spatialReference):null}get updating(){var s,o,a,c;if(this.destroyed)return!1;let e=0,i=this.layerViewManager.updating,r=i?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(p=>{if(p.isFulfilled()){if(p.updating){if(i=!0,p.suspended||o9(p))return;++r,e+=p.updatingProgress}}else++r});for(const p of this._updatingObjects)p!=null&&p.updating&&(r+=.1,e+=.5*.1);for(const p of this._updatingObjectsWithProgress)p!=null&&p.updating&&(++r,e+=p.updatingProgress);const n=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(i=!!(i||r>0||this.updatingHandles.updating||!this.ready||!this.stationary||n||this._createGraphicsViewController||(s=this.inputManager)!=null&&s.updating||(a=(o=this.map)==null?void 0:o.allLayers)!=null&&a.some(p=>!p.isFulfilled())||(c=this.textures)!=null&&c.updating),i?(this._numUpdating=Math.max(r,this._numUpdating),e+=this._numUpdating-r):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=i?0:1,this._get("updatingProgress")!==e){const p=performance.now();if(e<1){const _=Math.min((p-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-_)+e*_}this._set("updatingProgress",e),this._lastUpdateTime=i&&e<1?p:0}return i}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){var r;const e=this._predeterminedViewingMode;if(e!=null)return b$(e);const i=this.spatialReference;return i?((r=this.defaultsFromMap)==null?void 0:r.viewingMode)!=null&&i.equals(this.defaultsFromMap.spatialReference)?b$(this.defaultsFromMap.viewingMode):xP(i,_t.Global)?"global":"local":"global"}set viewingMode(e){this.ready?Ce.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){var e;return(e=this.stateManager)==null?void 0:e.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){var e,i;return((i=(e=this._resourceController)==null?void 0:e.memoryController)==null?void 0:i.memoryFactor)??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new XRt(this)}on(e,i,r,n){return this.viewEvents.on(e,i,r,n)||super.on(e,i)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,i){if(!this.ready)return Ce.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const r=i?this.externalToInternalIntersectOptions(i):this._defaultToMapOptions,n=r.graphics!=null&&(r.graphics.include!=null||r.graphics.exclude!=null),s=sme(e)?nme(this,e):e,o=mm(s);r.enableDraped=r.include&&!r.include.has(Zw)||r.exclude&&r.exclude.has(Zw);const a=this.sceneIntersectionHelper,c=Mp(this.state.viewingMode);if(c.options.selectionMode=!0,c.options.store=n?rl.ALL:rl.MIN,a.intersectIntersectorScreen(o,c,r),n){for(const p of c.results.all){const _=pre(p,this);if(_==null)return this._intersectResultToMapPoint(p);if(_.type!=="graphic"||this._testGraphicUidFilter(r.graphics,_.graphic))return this._intersectResultToMapPoint(p)}return null}return this._intersectResultToMapPoint(c.results.min)}toScreen(e){if(!this.ready)return Ce.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const i=(e.z==null?wy(this.elevationProvider,e):null)??0;return fd(e,KC,this.renderSpatialReference,i),this.state.camera.projectToScreen(KC,dX),Qu(dX[0],dX[1])}pixelSizeAt(e){return this.ready?e?(fd(e,KC,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(KC)):0:(Ce.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const i=this.basemapTerrain.overlayManager;return i?i.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e)):1}hitTest(e,i){if(!this.ready)return Ce.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const r=sme(e)?nme(this,e):e,n=ss(r.x,r.y),s=i?this.externalToInternalIntersectOptions(i):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const o=Mp(this.state.viewingMode);o.options.selectionMode=!0,o.options.store=rl.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(n,o,s);const a=this._intersectResultsToHits(o.results.all,s.graphics),c=o.results.ground,p=p2e(c,this),_=p!=null&&"type"in p&&p.type==="integrated-mesh"?p:null,x={screenPoint:r,results:a,ground:{mapPoint:this._intersectResultToMapPoint(c),distance:Xm(c)?c.distanceInRenderSpace:0,layer:_}};return En.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(x.intersector=o),Promise.resolve(x)}async popupHitTest(e){const{results:i,ground:r}=await ONt(this,e);let n=null;return!(i.length===0||Math.abs((i[0].distance??0)-r.distance)<1e-5)||r.layer&&r.layer.type==="integrated-mesh"||(n=r.mapPoint),{results:i,screenPoint:e,mapPoint:n}}goTo(e,i){return this.updatingHandles.addPromise(this.stateManager.goTo(e,i))}async whenAnalysisView(e){if(e.parent==null)throw new se("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const i=this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshot(i);return iX(r,i,this._pixelFormat())}async _takeScreenshot(e){const i=this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshot(i);return rX(r,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const i=this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshotWithOID(i);return[rX(r[0],this._pixelFormat()),rX(r[1],this._pixelFormat())]}_completeSettings(e){const i=aNt(e,this);return i.pixelRatio/=this.state.pixelRatio,hNt(i,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){return{takeScreenshot:e=>this._takeScreenshot(e),takeScreenshotWithObjectAndLayerId:e=>this._takeScreenshotWithObjectAndLayerId(e)}}async takeScreenshotWithObjectAndLayerId(e){if(!$e("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");const i=this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshotWithOID(i),n=iX(r[0],i,this._pixelFormat()),s=this._completeSettings(e);return s.format="png",[n,iX(r[1],s,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){if(this._stage.renderView.objectAndLayerIdRenderHelper==null)throw new Error("has enable-feature:objectAndLayerId-rendering must be true");return this._stage.renderView.objectAndLayerIdRenderHelper.getColorToObjectAndLayerIdMapping()}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return dme.importLayerView(e)}hasLayerViewModule(e){return dme.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){var e,i,r;return this.map&&"initialViewProperties"in this.map&&((e=this.map.initialViewProperties)==null?void 0:e.spatialReference)||((i=this.defaultsFromMap)==null?void 0:i.spatialReference)||((r=this.defaultsFromMap)==null?void 0:r.ready)&&this._initialDefaultSpatialReference||null}async validate(){let e=BNt(this.type);const i=$e("safari");if(i&&i<9&&(e=new se("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:i})),e!=null)throw Ce.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){var i;const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?(i=this.map.initialViewProperties)==null?void 0:i.viewingMode:null)??null;return e!=null?vfe(e):null}getSpatialReferenceSupport({spatialReference:e,layer:i}){const r=this._predeterminedViewingMode;if(r!=null)return this._validateSpatialReferenceForViewingMode(e,i,r)?{constraints:this._makeSpatialReferenceConstraints(e,i,r)}:null;const n=this._validateSpatialReferenceForViewingMode(e,i,_t.Local),s=this._validateSpatialReferenceForViewingMode(e,i,_t.Global);return n||s?n&&s?{constraints:this._makeSpatialReferenceConstraints(e,i,null)}:n?{constraints:this._makeSpatialReferenceConstraints(e,i,_t.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,i,_t.Global)}:null}_validateSpatialReferenceForViewingMode(e,i,r){return!!xP(e,r)&&(i==null||!!Spe(i)||(!pO(i)||$G(i,e,r)!=null)&&(!xpe(i)||r!==_t.Global))}_makeSpatialReferenceConstraints(e,i,r){if(i==null)return[{spatialReference:e,viewingMode:r}];const n=e.isWebMercator,s=e.isWGS84;return Spe(i)&&(n||s)?!s||r===_t.Local||a9(i.tileInfo,i.fullExtent,e,_t.Global)===null?[{spatialReference:e,viewingMode:r},{spatialReference:rt.WebMercator,viewingMode:r}]:[{spatialReference:n?rt.WGS84:rt.WebMercator,viewingMode:r}]:pO(i)||xpe(i)||!n&&!s?pO(i)&&n&&r!==_t.Global?[{spatialReference:e,viewingMode:r},{spatialReference:rt.WGS84,viewingMode:_t.Local}]:[{spatialReference:e,viewingMode:r}]:[{spatialReference:e,viewingMode:r},{spatialReference:n?rt.WGS84:rt.WebMercator,viewingMode:r}]}_validateSpatialReference(e){const i=this.getSpatialReferenceSupport({spatialReference:e})!=null,r=this._predeterminedViewingMode;return i||(r!=null?Ce.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${b$(r)} viewing mode.`):e.isGeographic&&Ce.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),i}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}computeMapPointFromVec3d(e,i){let r=this.spatialReference||rt.WGS84;return il(e,this.renderSpatialReference,e,r)||(r=rt.WGS84,il(e,this.renderSpatialReference,e,r)),i?(i.x=e[0],i.y=e[1],i.z=e[2],i.spatialReference=r):i=new mt(e,r),i}trackGraphicState(e){if(!e.graphic)return Ce.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const i=this.getViewForGraphic(e.graphic);let r=null,n=!1;const s=o=>{var a;!n&&o!=null&&"processor"in o&&((a=o.processor)==null?void 0:a.type)==="graphics-3d"&&o.processor.graphicsCore&&(r=o.processor.graphicsCore.trackGraphicState(e))};return i!=null?s(i):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(o=>s(o),()=>{}).catch(()=>{}),rr(()=>{n=!0,r!=null&&(r.remove(),r=null)})}highlight(e){if(Array.isArray(e))return sd(e.map(r=>this.highlight(r)));if(tt.isCollection(e))return sd(e.toArray().map(r=>this.highlight(r)));const i=this.getViewForGraphic(e);return i&&"highlight"in i?i.highlight(e):rr()}maskOccludee(e){if(!e)return Ce.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const i=this.getViewForGraphic(e);let r=null,n=!1;const s=o=>{!n&&o!=null&&LNt(o)&&(r=o.maskOccludee(e))};return i!=null?s(i):this.whenViewForGraphic(e,{waitForLayer:!0}).then(o=>s(o),()=>{}).catch(()=>{}),rr(()=>{n=!0,r!=null&&(r.remove(),r=null)})}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find(i=>i.layer===e.layer):null}graphicChanged(e){this.graphicsView!=null&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,i){if(e.layer===this)return await dd(()=>this.graphicsView),this.graphicsView;if(!e.layer||!this.map)throw new se("no-view-for-graphic");return i&&i.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise((r,n)=>{const s=this.map.allLayers.on("change",o=>{o.added.includes(e.layer)&&(s.remove(),this.whenLayerView(e.layer).then(r,n))})}):this.whenLayerView(e.layer)}externalToInternalIntersectOptions(e){const i=this._externalToInternalRenderItems(e.include,K$.INCLUDE),r=this._externalToInternalRenderItems(e.exclude,K$.EXCLUDE);return{include:i.layerUids,exclude:r.layerUids,graphics:{include:i.graphicUids,exclude:r.graphicUids}}}_intersectResultToMapPoint(e,i){return e.getIntersectionPoint(KC)?(i=this.computeMapPointFromVec3d(KC,i),e.intersector===ms.TERRAIN&&this.basemapTerrain&&(i.z=wy(this.basemapTerrain,i)??0),i):null}_intersectResultsToHits(e,i){const r=new Array;let n=null;for(let s=0;s{var r;const i=(r=this.basemapTerrain)==null?void 0:r.extent;if(this.clippingArea||i)if(i&&this.basemapTerrain.spatialReference){const n=this.basemapTerrain.extent!=null&&this.basemapTerrain.spatialReference!=null?sl(_B(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;this.clippingArea!=null?this.featureTiles.filterExtent=this.clippingArea.intersection(n):this.featureTiles.filterExtent=n}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add(()=>En.FEATURE_TILE_TREE_SHOW_TILES,i=>{i&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(we(()=>import("./FeatureTileTree3DDebugger-y_91jAgc.js"),__vite__mapDeps([229,213]))).then(({FeatureTileTree3DDebugger:r})=>{!this._featureTreeDebugger&&En.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new r({view:this}))}):i||!this._featureTreeDebugger||En.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)},kt),this.updatingHandles.add(()=>this.clippingArea,e,kt),this.updatingHandles.add(()=>this.basemapTerrain.extent,e,kt)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new nRt(this.map,e));const i=this.state.isGlobal,r=Idt(i,e);r!==this.renderSpatialReference&&(this._set("renderCoordsHelper",lRt.create(this.state.viewingMode,r)),i||this.addHandles(_e(()=>{var n;return(n=this.basemapTerrain)==null?void 0:n.extent},n=>{const s=this.renderCoordsHelper.spatialReference;n==null||n[0]===0&&n[1]===0&&n[2]===0&&n[3]===0||!wj(n,this.basemapTerrain.spatialReference,N2e,s)||(this.renderCoordsHelper.extent=N2e)},Li),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(AP/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){e!=null&&e.type===xn.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach(i=>{i.destroyed||(this.addHandles(_e(()=>[i.updating,i.updatingProgress],()=>this._updatingChanged(),Li),"updatingMonitors"),i.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,i,r){if(!this.overlay||!this.overlay.hasVisibleItems)return r;const n=e.getContext("2d");return n.putImageData(r,0,0),this.overlay.renderCanvas(e,{disableDecorations:i===Kh.OFF}),n.getImageData(0,0,r.width,r.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(n,s,o)=>this._renderScreenshotOverlay(n,s,o)}},i=new Z5t(this.state.viewingMode,n=>this._stage.layers.forAll(n),this);this._set("sceneIntersectionHelper",i);const r=W9(this.surface);this._stage=new zd({view:this,options:e,container:r}),this._stage.renderer.setParameters({slicePlane:this.slicePlane}),this.addHandles([this.updatingHandles.add(()=>this.qualitySettings.highQualityTransparency,n=>this._stage.renderer.setParameters({highQualityTransparency:n}),Qt),_e(()=>this.magnifier,n=>this._stage.renderView.magnifier=n,kt),this.on("pointer-move",()=>{var n;return(n=this._stage)==null?void 0:n.renderer.resetAnimation()}),r5(this._stage.renderView.canvas,"webglcontextlost",n=>this.fatalError=new se("webgl-context-lost",n.statusMessage))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(AP/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=et(this._stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new KRt({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController||this.graphics.length===0)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const i=(await we(()=>import("./GraphicsView3D-o82vqKJR.js"),__vite__mapDeps([230,145,137,51,46,47]))).default;St(e),await dd(()=>{var r;return(r=this.basemapTerrain)==null?void 0:r.ready},e),this._set("graphicsView",new i({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),this.graphicsView!=null&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){var r;const e=vfe(this.viewingMode);if(e===_t.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(Jr(()=>this.graphics,"after-changes",()=>this._createGraphicsViewIfNeeded()),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const{map:n}=this,s=n&&"initialViewProperties"in n?(r=n.initialViewProperties)==null?void 0:r.environment:void 0;s&&(this.environment=s)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect(),this._set("textures",new XM(this._stage,this.resourceController.scheduler));const i=this._resolveWhenReady;this._resolveWhenReady=[],i.forEach(n=>n(this))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._set("textures",et(this.textures)),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Zw);for(const e of this.map.allLayers.items)e.type==="integrated-mesh"&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Zw);for(const e of this.map.allLayers.items)e.type==="integrated-mesh"&&e.opacity<1&&this._defaultHitTestOptions.exclude.add(e.uid)}}};function qR(t,e){t.layerUids||(t.layerUids=new Set),t.layerUids.add(e)}function X7t(t,e){t.graphicUids||(t.graphicUids=new Set),t.graphicUids.add(e)}function V8(t,e){return t!=null&&rh(t.spatialReference,e)?sl(t,e):null}var K$;Nt.type="3d",y([w()],Nt.prototype,"_userClippingArea",void 0),y([w()],Nt.prototype,"_resourceController",void 0),y([w()],Nt.prototype,"_stage",void 0),y([w({readOnly:!0})],Nt.prototype,"deconflictor",void 0),y([w({readOnly:!0})],Nt.prototype,"labeler",void 0),y([w(pz(CP,"analyses"))],Nt.prototype,"analyses",void 0),y([w({type:OP,readOnly:!0})],Nt.prototype,"animation",null),y([w({readOnly:!0})],Nt.prototype,"basemapTerrain",void 0),y([w({readOnly:!0})],Nt.prototype,"elevationProvider",void 0),y([w()],Nt.prototype,"camera",null),y([w({type:pd})],Nt.prototype,"contentCamera",null),y([w({readOnly:!0})],Nt.prototype,"canvas",void 0),y([w({type:mt})],Nt.prototype,"center",null),y([w({type:Vi})],Nt.prototype,"clippingArea",null),y([w({type:kS})],Nt.prototype,"constraints",void 0),y([w({type:Vi,readOnly:!0})],Nt.prototype,"renderDataExtent",null),y([w({type:Vi,readOnly:!0})],Nt.prototype,"dataExtent",null),y([w({type:Vi,readOnly:!0})],Nt.prototype,"_groundAndLayersExtent",null),y([w({value:null,type:GA})],Nt.prototype,"environment",null),y([Ci("environment")],Nt.prototype,"castEnvironment",null),y([w({readOnly:!0})],Nt.prototype,"environmentManager",void 0),y([w({type:Vi})],Nt.prototype,"extent",null),y([w()],Nt.prototype,"floors",void 0),y([w()],Nt.prototype,"screenCenter",null),y([w()],Nt.prototype,"frustum",null),y([w({type:Number,readOnly:!0})],Nt.prototype,"fullOpacity",void 0),y([w({readOnly:!0})],Nt.prototype,"graphicsView",void 0),y([w({readOnly:!0})],Nt.prototype,"analysisViewManager",void 0),y([w()],Nt.prototype,"groundView",void 0),y([w({type:Boolean})],Nt.prototype,"initialExtentRequired",null),y([w()],Nt.prototype,"_defaultsFromMapSettings",null),y([w()],Nt.prototype,"interacting",null),y([w()],Nt.prototype,"stationary",null),y([w()],Nt.prototype,"navigating",null),y([w()],Nt.prototype,"map",void 0),y([w({readOnly:!0})],Nt.prototype,"mapCoordsHelper",void 0),y([w()],Nt.prototype,"padding",null),y([w({type:ku,readOnly:!0})],Nt.prototype,"pointsOfInterest",void 0),y([w({type:wl,readOnly:!0})],Nt.prototype,"featureTiles",void 0),y([w()],Nt.prototype,"_featureTreeDebugger",void 0),y([w({type:Boolean})],Nt.prototype,"screenSizePerspectiveEnabled",void 0),y([w({constructOnly:!0})],Nt.prototype,"deactivatedWebGLExtensions",void 0),y([w({constructOnly:!0})],Nt.prototype,"debugWebGLExtensions",void 0),y([w({constructOnly:!0})],Nt.prototype,"renderCanvas",void 0),y([w({constructOnly:!0})],Nt.prototype,"state",void 0),y([w({readOnly:!0})],Nt.prototype,"inputManager",void 0),y([w({readOnly:!0})],Nt.prototype,"stateManager",void 0),y([w({type:["low","medium","high"]})],Nt.prototype,"qualityProfile",null),y([w({type:s_e,get(){let t=this._get("qualitySettings");return t||(t=new s_e,vk.apply(this.qualityProfile,t)),t}})],Nt.prototype,"qualitySettings",void 0),y([w()],Nt.prototype,"slicePlane",null),y([w({readOnly:!0})],Nt.prototype,"typeSpecificPreconditionsReady",null),y([w({readOnly:!0})],Nt.prototype,"renderCoordsHelper",void 0),y([w({readOnly:!0})],Nt.prototype,"sceneIntersectionHelper",void 0),y([w({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Nt.prototype,"resolution",null),y([w({type:Number})],Nt.prototype,"scale",null),y([w()],Nt.prototype,"heightModelInfo",null),y([w()],Nt.prototype,"spatialReference",void 0),y([w({type:Boolean,constructOnly:!0})],Nt.prototype,"alphaCompositingEnabled",void 0),y([w({constructOnly:!0})],Nt.prototype,"preserveDrawingBufferEnabled",void 0),y([w({type:Boolean})],Nt.prototype,"supersampleScreenshotsEnabled",void 0),y([w({readOnly:!0})],Nt.prototype,"type",void 0),y([w(),Ci(t=>t instanceof sUe?t:DT(oUe,t))],Nt.prototype,"ui",void 0),y([w({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],Nt.prototype,"updating",null),y([w()],Nt.prototype,"_updatingObjects",null),y([w()],Nt.prototype,"_updatingObjectsWithProgress",null),y([w({type:Number,readOnly:!0,dependsOn:["updating"]})],Nt.prototype,"updatingProgress",void 0),y([w({type:["global","local"]})],Nt.prototype,"viewingMode",null),y([w({type:nh})],Nt.prototype,"viewpoint",null),y([w({type:Number})],Nt.prototype,"zoom",null),y([w({type:j7e})],Nt.prototype,"highlightOptions",void 0),y([w({readOnly:!0})],Nt.prototype,"quality",null),y([w({readOnly:!0})],Nt.prototype,"resolutionScale",null),y([w()],Nt.prototype,"textures",void 0),Nt=y([Z("esri.views.SceneView")],Nt),function(t){t[t.INCLUDE=0]="INCLUDE",t[t.EXCLUDE=1]="EXCLUDE"}(K$||(K$={}));const KC=W(),dX=ss(),N2e=Ni(),aUe=Nt,lUe=(t,...e)=>new Pht({portalItem:{id:t},layers:[...e]}),cUe=t=>new aUe({map:t,container:"viewDiv",qualityProfile:"high"});var vre;let bw=vre=class extends v5{constructor(t){super(t),this.displayValueEnabled=!1,this.max=1,this.min=0,this.step=.1,this.type="slider",this.value=null}clone(){return new vre({active:this.active,className:this.className,disabled:this.disabled,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible,displayValueEnabled:this.displayValueEnabled,max:this.max,min:this.min,step:this.step,value:this.value})}};y([w()],bw.prototype,"displayValueEnabled",void 0),y([w()],bw.prototype,"max",void 0),y([w()],bw.prototype,"min",void 0),y([w()],bw.prototype,"step",void 0),y([w()],bw.prototype,"value",void 0),bw=vre=y([Z("esri.support.Action.ActionSlider")],bw);const Z7t=bw,uUe={hide:"hide",hideChildren:"hide-children"};function RV(t){if(t)return t.listMode!=null?t.listMode:void 0}function J7t(t){return t!=null&&"minScale"in t&&t.minScale!=null?t.minScale:void 0}function K7t(t){return t!=null&&"maxScale"in t&&t.maxScale!=null?t.maxScale:void 0}function Q7t(t){if(!t)return"inherited";const e=sFt(mue(t)?t.layer:t);return e!=null?e?"independent":"inherited":"visibilityMode"in t&&t.visibilityMode!=null?t.visibilityMode:"independent"}function hUe(t){if(t&&(!("type"in t)||t.type!=="wmts")&&t.listMode!==uUe.hideChildren)return"sublayers"in t?"sublayers":"layers"in t?"layers":void 0}function eFt(t){const e=(t!=null&&t.layer&&mue(t.layer)?t.layer.layer:void 0)??(t==null?void 0:t.layer);return!!e&&(oFt(e)??!0)}function tFt(t){return RV(t)!==uUe.hide}function iFt(t,e){if(!t||e==null||isNaN(e))return!1;const i=J7t(t),r=K7t(t),n=i!=null&&!isNaN(i)&&i>0&&e>i,s=r!=null&&!isNaN(r)&&r>0&&e{const n="uid"in i?e.indexOf(i.uid):-1,s="uid"in r?e.indexOf(r.uid):-1;return n>s?-1:n{var s;return((s=n.layer)==null?void 0:s.uid)===i}):null}function nFt(t){const e=mue(t)?t:null,i=t==null?void 0:t.parent,r=i!=null&&"type"in i&&i.type==="map-image"?e==null?void 0:e.source:null,n="";return r&&i?{layer:i,title:n,sublayerIds:[r.mapLayerId]}:{layer:t,title:n}}function mue(t){return t!=null&&"layer"in t&&t.layer!=null}function sFt(t){const e=pUe(t);return e!=null&&"supportsSublayerVisibility"in e?e.supportsSublayerVisibility:void 0}function oFt(t){const e=pUe(t);return e!=null&&"supportsDynamicLayers"in e?e.supportsDynamicLayers:void 0}function pUe(t){return t&&"capabilities"in t&&t.capabilities!=null&&"exportMap"in t.capabilities?t.capabilities.exportMap:void 0}function gue(t){return e=>{e.hasOwnProperty("_delegatedEventNames")||(e._delegatedEventNames=e._delegatedEventNames?e._delegatedEventNames.slice():[]);const i=e._delegatedEventNames,r=Array.isArray(t)?t:aFt(t);i.push(...r)}}function aFt(t){return t.split(",").map(e=>e.trim())}function Q$(t){return t&&typeof t.render=="function"}function lFt(t){return t&&typeof t.postMixInProperties=="function"&&typeof t.buildRendering=="function"&&typeof t.postCreate=="function"&&typeof t.startup=="function"}const fUe="esri-layer-list-panel",WR=`${fUe}__content`,V1={base:fUe,content:WR,contentLegend:`${WR}--legend`,contentString:`${WR}--string`,contentElement:`${WR}--html-element`,contentWidget:`${WR}--widget`},cFt="legends";let nf=class extends z_(hn){constructor(e,i){super(e,i),this._legend=null,this.content=null,this.image=null,this.listItem=null,this.open=!1,this.visible=!0}initialize(){this.addHandles(_e(()=>this.content,e=>this._createLegend(e),Qt))}destroy(){this._legend=et(this._legend)}get className(){const{image:e}=this,i=this._getFirstWidget();return this._get("className")||(!e&&i?i.iconClass??"":"")}set className(e){this._override("className",e)}get disabled(){var n;const{listItem:e,_legend:i,content:r}=this;return!e||!(Array.isArray(r)&&r.length>1)&&!!i&&(!((n=i.activeLayerInfos)!=null&&n.length)||!e.visibleAtCurrentScale||!e.visible)}set disabled(e){this._overrideIfSome("disabled",e)}get title(){const e=this._getFirstWidget();return this._get("title")||((e==null?void 0:e.label)??"")}set title(e){this._override("title",e)}render(){return X("div",{class:V1.base},this._renderContents())}_renderContent(e){const{_legend:i,disabled:r}=this;return!e||r?null:e==="legend"&&i?X("div",{class:this.classes(V1.content,V1.contentLegend),key:i},i.render()):typeof e=="string"?X("div",{class:this.classes(V1.content,V1.contentString),innerHTML:e,key:e}):Q$(e)?X("div",{class:this.classes(V1.content,V1.contentWidget),key:e},e.render()):e instanceof HTMLElement?X("div",{afterCreate:this._attachToNode,bind:e,class:this.classes(V1.content,V1.contentElement),key:e}):null}_renderContents(){const{content:e}=this;return Array.isArray(e)?e.map(i=>this._renderContent(i)):this._renderContent(e)}_getLegendOptions(){const{listItem:e}=this;if(!e)return{};const{layer:i,view:r}=e;return i&&r?{view:r,layerInfos:[nFt(i)]}:{}}async _createLegend(e){if(!this._hasLegend(e)||this._legend)return;const{default:i}=await we(()=>Promise.resolve().then(()=>xUt),void 0),{listItem:r}=this,n=new i(this._getLegendOptions());this._legend=n,this.notifyChange("className"),this.notifyChange("title");const s=_e(()=>{var o,a;return[r==null?void 0:r.view,r==null?void 0:r.layer,(o=r==null?void 0:r.layer)==null?void 0:o.source,(a=r==null?void 0:r.layer)==null?void 0:a.parent]},()=>this._updateLegend(n),Qt);this.addHandles(s,cFt),this.scheduleRender()}_hasLegend(e){const i="legend";return e===i||e!=null&&!!Array.isArray(e)&&e.includes(i)}_attachToNode(e){e.appendChild(this)}_updateLegend(e){e.set(this._getLegendOptions()),this.scheduleRender()}_getWidget(e){return e==="legend"?this._legend:Q$(e)?e:null}_getFirstWidget(){const{content:e}=this;if(Array.isArray(e)){let i=null;return e.some(r=>{const n=this._getWidget(r);return n&&(i=n),!!n}),i}return this._getWidget(e)}};y([w()],nf.prototype,"_legend",void 0),y([w()],nf.prototype,"className",null),y([w()],nf.prototype,"content",void 0),y([w()],nf.prototype,"disabled",null),y([w()],nf.prototype,"image",void 0),y([w()],nf.prototype,"listItem",void 0),y([w()],nf.prototype,"title",null),y([w()],nf.prototype,"open",void 0),y([w()],nf.prototype,"visible",void 0),nf=y([Z("esri.widgets.LayerList.ListItemPanel")],nf);const mUe=nf;var U4;const uFt=tt.ofType({key:"type",defaultKeyValue:"button",base:v5,typeMap:{button:_5,toggle:kB,slider:Z7t}}),gUe=tt.ofType(uFt),B8="layer",fX="child-list-mode",hFt="hide",dFt="esri.widgets.LayerList.ListItem";let zs=U4=class extends z_(ze){constructor(t){super(t),this.actionsSections=new gUe,this.actionsOpen=!1,this.checkPublishStatusEnabled=!1,this.children=new(tt.ofType(U4)),this.childrenSortable=!0,this.hidden=!1,this.layer=null,this.layerView=null,this.listItemCreatedFunction=null,this.open=!1,this.panel=null,this.parent=null,this.sortable=!0,this.view=null}initialize(){if(this.addHandles([_e(()=>this.layer,t=>this._watchLayerProperties(t),Qt),_e(()=>this.checkPublishStatusEnabled,t=>this._updateChildrenPublishing(t),Qt),_e(()=>this.view,t=>this._updateChildrenView(t),Qt),_e(()=>this.panel,t=>this._setListItemOnPanel(t),Qt),_e(()=>[this.layer,this.view],()=>this._getLayerView(),Qt)]),typeof this.listItemCreatedFunction=="function"){const t={item:this};this.listItemCreatedFunction.call(null,t)}}destroy(){this.view=null}get connectionStatus(){const{layerView:t,publishing:e}=this;if(!e&&t&&"connectionStatus"in t)return t.connectionStatus}get error(){var t;return(t=this.layer)==null?void 0:t.loadError}get incompatible(){const{layerView:t}=this;return!(!t||!("spatialReferenceSupported"in t))&&!t.spatialReferenceSupported}castPanel(t){var e;return(e=this.panel)!=null&&e.open&&!t.hasOwnProperty("open")&&(t.open=!0),t?new mUe(t):null}get title(){const t=uu(this,"layer.layer");return(!t||t&&uu(this,"layer.layer.loaded"))&&uu(this,"layer.title")||uu(this,"layer.attributes.title")||""}set title(t){this._override("title",t)}get publishing(){var i;const{layer:t,checkPublishStatusEnabled:e}=this;return e&&t&&"publishingInfo"in t&&((i=t.publishingInfo)==null?void 0:i.status)==="publishing"}get updating(){const{layerView:t,connectionStatus:e,layer:i,publishing:r}=this;return!r&&!e&&(t?t.updating:(i==null?void 0:i.loadStatus)==="loading"||!1)}get visible(){var t;return(t=this.layer)==null?void 0:t.visible}set visible(t){const e=this.layer;e&&(e.visible=t)}get visibleAtCurrentScale(){var t;return!iFt(this.layer,(t=this.view)==null?void 0:t.scale)}get visibilityMode(){return Q7t(this.layer)}clone(){return new U4({actionsSections:this.actionsSections.clone(),actionsOpen:this.actionsOpen,checkPublishStatusEnabled:this.checkPublishStatusEnabled,children:this.children.clone(),layer:this.layer,listItemCreatedFunction:this.listItemCreatedFunction,open:this.open,panel:this.panel,title:this.title,view:this.view,visible:this.visible})}_setListItemOnPanel(t){t&&(t.listItem=this)}_updateChildrenPublishing(t){const e=this.children;e&&e.forEach(i=>i.checkPublishStatusEnabled=t)}_updateChildrenView(t){const e=this.children;e&&e.forEach(i=>i.view=t)}_addChildren(t){if(this.removeHandles(fX),this.children.removeAll(),!t)return;t.forEach(i=>{this.addHandles(_e(()=>i.listMode,()=>this._addChildren(t)),fX)});const e=t.filter(i=>RV(i)!==hFt);this.children.addMany(this._makeChildren(e))}_watchSublayerChanges(t){t&&this.addHandles(t.on("change",()=>{this._addChildren(t)}),B8)}_initializeChildLayers(t){this._addChildren(t),this._watchSublayerChanges(t)}_makeChildren(t){return t.map(e=>tFt(e)?new U4({layer:e,checkPublishStatusEnabled:this.checkPublishStatusEnabled,listItemCreatedFunction:this.listItemCreatedFunction,parent:this,view:this.view}):null).filter(ys).reverse()}_watchLayerProperties(t){if(this.removeHandles(B8),this.removeHandles(fX),!t)return;if(this.addHandles(_e(()=>t.listMode,()=>this._watchLayerProperties(t)),B8),RV(t)==="hide-children")return void this.children.removeAll();const e=hUe(t);e&&this.addHandles(_e(()=>t[e],i=>{t.hasOwnProperty(e)&&this._initializeChildLayers(i)},Qt),B8)}async _getLayerView(){const{layer:t,view:e}=this;if(t&&e)try{const i=await e.whenLayerView(t);if(i.layer!==this.layer)return;this._set("layerView",i)}catch{}}};y([w({type:gUe})],zs.prototype,"actionsSections",void 0),y([w()],zs.prototype,"actionsOpen",void 0),y([w()],zs.prototype,"checkPublishStatusEnabled",void 0),y([w({type:tt})],zs.prototype,"children",void 0),y([w()],zs.prototype,"childrenSortable",void 0),y([w({readOnly:!0})],zs.prototype,"connectionStatus",null),y([w({readOnly:!0})],zs.prototype,"error",null),y([w()],zs.prototype,"hidden",void 0),y([w({readOnly:!0})],zs.prototype,"incompatible",null),y([w()],zs.prototype,"layer",void 0),y([w({readOnly:!0})],zs.prototype,"layerView",void 0),y([w()],zs.prototype,"listItemCreatedFunction",void 0),y([w()],zs.prototype,"open",void 0),y([w({type:mUe})],zs.prototype,"panel",void 0),y([Ci("panel")],zs.prototype,"castPanel",null),y([w()],zs.prototype,"parent",void 0),y([w()],zs.prototype,"sortable",void 0),y([w()],zs.prototype,"title",null),y([w({readOnly:!0})],zs.prototype,"publishing",null),y([w({readOnly:!0})],zs.prototype,"updating",null),y([w()],zs.prototype,"view",void 0),y([w()],zs.prototype,"visible",null),y([w({readOnly:!0})],zs.prototype,"visibleAtCurrentScale",null),y([w({readOnly:!0})],zs.prototype,"visibilityMode",null),zs=U4=y([Z(dFt)],zs);const yue=zs,A0={view:"view",viewLayers:"view-layers",mapLayers:"map-layers",layerViews:"layer-views",layerListMode:"layer-list-mode"},pFt="hide",yUe=tt.ofType(yue);let ww=class extends Dn.EventedAccessor{constructor(e){super(e),this.checkPublishStatusEnabled=!1,this.listItemCreatedFunction=null,this.operationalItems=new yUe,this.view=null}initialize(){this.addHandles([_e(()=>{var e;return[this.view,(e=this.view)==null?void 0:e.ready]},()=>this._viewHandles(),Qt),_e(()=>[this.listItemCreatedFunction,this.checkPublishStatusEnabled],()=>this._recompileList())],A0.view)}destroy(){this.view=null,this.operationalItems.removeAll()}get state(){const{view:e}=this;return e!=null&&e.ready?"ready":e?"loading":"disabled"}triggerAction(e,i){e&&!e.disabled&&this.emit("trigger-action",{action:e,item:i})}moveListItem(e,i,r,n){var C,M;const s=e==null?void 0:e.layer;if(!s)return;const o=(M=(C=this.view)==null?void 0:C.map)==null?void 0:M.layers,a=i?F2e(i):o,c=r?F2e(r):o;if(!a||!c)return;const{operationalItems:p}=this,_=(i==null?void 0:i.children)||p,x=(r==null?void 0:r.children)||p,S=c.length-n;e.parent=r||null,_.includes(e)&&_.remove(e),a.includes(s)&&a.remove(s),x.includes(e)||x.add(e,S),c.includes(s)||c.add(s,S)}_createLayerViewHandles(e){this.removeHandles(A0.layerViews),this._compileList(),e&&this.addHandles(e.on("change",()=>this._compileList()),A0.layerViews)}_createMapLayerHandles(e){this.removeHandles(A0.mapLayers),this._compileList(),e&&this.addHandles(e.on("change",()=>this._compileList()),A0.mapLayers)}_createListItem(e){const{view:i,listItemCreatedFunction:r,checkPublishStatusEnabled:n}=this;return new yue({checkPublishStatusEnabled:n,layer:e,listItemCreatedFunction:r,view:i})}_removeAllItems(){this.operationalItems.removeAll()}_getViewableLayers(e){if(e)return e.filter(i=>RV(i)!==pFt)}_watchLayersListMode(e){this.removeHandles(A0.layerListMode),e&&e.forEach(i=>{"listMode"in i&&this.addHandles(_e(()=>i.listMode,()=>this._compileList()),A0.layerListMode)})}_compileList(){var r,n;const e=(n=(r=this.view)==null?void 0:r.map)==null?void 0:n.layers;this._watchLayersListMode(e);const i=this._getViewableLayers(e);i!=null&&i.length?(this._createNewItems(i),this._removeItems(i),this._sortItems(i)):this._removeAllItems()}_createNewItems(e){const{operationalItems:i}=this;e.forEach(r=>{i.find(n=>n.layer===r)||i.add(this._createListItem(r))})}_removeItems(e){const{operationalItems:i}=this,r=[];i.forEach(n=>{n&&e&&e.includes(n.layer)||r.push(n)}),i.removeMany(r)}_sortItems(e){const{operationalItems:i}=this;i.sort((r,n)=>{const s=e.indexOf(r.layer),o=e.indexOf(n.layer);return s>o?-1:s{var i,r;return(r=(i=this.view)==null?void 0:i.map)==null?void 0:r.allLayers},i=>this._createMapLayerHandles(i),Qt),_e(()=>{var i;return(i=this.view)==null?void 0:i.allLayerViews},i=>this._createLayerViewHandles(i),Qt)],A0.viewLayers)}};y([w()],ww.prototype,"checkPublishStatusEnabled",void 0),y([w()],ww.prototype,"listItemCreatedFunction",void 0),y([w({type:yUe})],ww.prototype,"operationalItems",void 0),y([w({readOnly:!0})],ww.prototype,"state",null),y([w()],ww.prototype,"view",void 0),ww=y([Z("esri.widgets.LayerList.LayerListViewModel")],ww);const vUe=ww;/**! * Sortable 1.15.1 * @author RubaXa * @author owenm * @license MIT - */function w2e(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),i.push.apply(i,r)}return i}function Qy(t){for(var e=1;e=0)&&(i[n]=t[n]);return i}function D7t(t,e){if(t==null)return{};var i=L7t(t,e),r,n;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}var N7t="1.15.1";function o_(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var Z_=o_(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),y6=o_(/Edge/i),x2e=o_(/firefox/i),j$=o_(/safari/i)&&!o_(/chrome/i)&&!o_(/android/i),zze=o_(/iP(ad|od|hone)/i),Uze=o_(/chrome/i)&&o_(/android/i),Vze={capture:!1,passive:!1};function Hn(t,e,i){t.addEventListener(e,i,!Z_&&Vze)}function On(t,e,i){t.removeEventListener(e,i,!Z_&&Vze)}function wV(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function F7t(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function ny(t,e,i,r){if(t){i=i||document;do{if(e!=null&&(e[0]===">"?t.parentNode===i&&wV(t,e):wV(t,e))||r&&t===i)return t;if(t===i)break}while(t=F7t(t))}return null}var S2e=/\s+/g;function Nd(t,e,i){if(t&&e)if(t.classList)t.classList[i?"add":"remove"](e);else{var r=(" "+t.className+" ").replace(S2e," ").replace(" "+e+" "," ");t.className=(r+(i?" "+e:"")).replace(S2e," ")}}function Ii(t,e,i){var r=t&&t.style;if(r){if(i===void 0)return document.defaultView&&document.defaultView.getComputedStyle?i=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(i=t.currentStyle),e===void 0?i:i[e];!(e in r)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),r[e]=i+(typeof i=="string"?"":"px")}}function MO(t,e){var i="";if(typeof t=="string")i=t;else do{var r=Ii(t,"transform");r&&r!=="none"&&(i=r+" "+i)}while(!e&&(t=t.parentNode));var n=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return n&&new n(i)}function Bze(t,e,i){if(t){var r=t.getElementsByTagName(e),n=0,s=r.length;if(i)for(;n=s:o=n<=s,!o)return r;if(r===Dy())break;r=d2(r,!1)}return!1}function F5(t,e,i,r){for(var n=0,s=0,o=t.children;s2&&arguments[2]!==void 0?arguments[2]:{},n=r.evt,s=D7t(r,H7t);v6.pluginEvent.bind(tr)(e,i,Qy({dragEl:Ot,parentEl:sa,ghostEl:wr,rootEl:Lo,nextEl:cS,lastDownEl:Ck,cloneEl:Yo,cloneHidden:Yw,dragStarted:PI,putSortable:uc,activeSortable:tr.active,originalEvent:n,oldIndex:HM,oldDraggableIndex:H$,newIndex:Hd,newDraggableIndex:kw,hideGhostForTarget:Zze,unhideGhostForTarget:Jze,cloneNowHidden:function(){Yw=!0},cloneNowShown:function(){Yw=!1},dispatchSortableEvent:function(l){Ru({sortable:i,name:l,originalEvent:n})}},s))};function Ru(t){G7t(Qy({putSortable:uc,cloneEl:Yo,targetEl:Ot,rootEl:Lo,oldIndex:HM,oldDraggableIndex:H$,newIndex:Hd,newDraggableIndex:kw},t))}var Ot,sa,wr,Lo,cS,Ck,Yo,Yw,HM,Hd,H$,kw,D8,uc,nM=!1,xV=!1,SV=[],i3,E0,oX,aX,C2e,A2e,PI,YC,q$,W$=!1,N8=!1,Ak,zc,lX=[],are=!1,TV=[],DG=typeof document<"u",F8=zze,M2e=y6||Z_?"cssFloat":"float",q7t=DG&&!Uze&&!zze&&"draggable"in document.createElement("div"),Wze=function(){if(DG){if(Z_)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Yze=function(e,i){var r=Ii(e),n=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),s=F5(e,0,i),o=F5(e,1,i),l=s&&Ii(s),c=o&&Ii(o),f=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+Ha(s).width,_=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+Ha(o).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(s&&l.float&&l.float!=="none"){var x=l.float==="left"?"left":"right";return o&&(c.clear==="both"||c.clear===x)?"vertical":"horizontal"}return s&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||f>=n&&r[M2e]==="none"||o&&r[M2e]==="none"&&f+_>n)?"vertical":"horizontal"},W7t=function(e,i,r){var n=r?e.left:e.top,s=r?e.right:e.bottom,o=r?e.width:e.height,l=r?i.left:i.top,c=r?i.right:i.bottom,f=r?i.width:i.height;return n===l||s===c||n+o/2===l+f/2},Y7t=function(e,i){var r;return SV.some(function(n){var s=n[ap].options.emptyInsertThreshold;if(!(!s||eue(n))){var o=Ha(n),l=e>=o.left-s&&e<=o.right+s,c=i>=o.top-s&&i<=o.bottom+s;if(l&&c)return r=n}}),r},Xze=function(e){function i(s,o){return function(l,c,f,_){var x=l.options.group.name&&c.options.group.name&&l.options.group.name===c.options.group.name;if(s==null&&(o||x))return!0;if(s==null||s===!1)return!1;if(o&&s==="clone")return s;if(typeof s=="function")return i(s(l,c,f,_),o)(l,c,f,_);var T=(o?l:c).options.group.name;return s===!0||typeof s=="string"&&s===T||s.join&&s.indexOf(T)>-1}}var r={},n=e.group;(!n||Ek(n)!="object")&&(n={name:n}),r.name=n.name,r.checkPull=i(n.pull,!0),r.checkPut=i(n.put),r.revertClone=n.revertClone,e.group=r},Zze=function(){!Wze&&wr&&Ii(wr,"display","none")},Jze=function(){!Wze&&wr&&Ii(wr,"display","")};DG&&!Uze&&document.addEventListener("click",function(t){if(xV)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),xV=!1,!1},!0);var r3=function(e){if(Ot){e=e.touches?e.touches[0]:e;var i=Y7t(e.clientX,e.clientY);if(i){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);r.target=r.rootEl=i,r.preventDefault=void 0,r.stopPropagation=void 0,i[ap]._onDragOver(r)}}},X7t=function(e){Ot&&Ot.parentNode[ap]._isOutsideThisEl(e.target)};function tr(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=A_({},e),t[ap]=this;var i={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Yze(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(o,l){o.setData("Text",l.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:tr.supportPointer!==!1&&"PointerEvent"in window&&!j$,emptyInsertThreshold:5};v6.initializePlugins(this,t,i);for(var r in i)!(r in e)&&(e[r]=i[r]);Xze(e);for(var n in this)n.charAt(0)==="_"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this));this.nativeDraggable=e.forceFallback?!1:q7t,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Hn(t,"pointerdown",this._onTapStart):(Hn(t,"mousedown",this._onTapStart),Hn(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Hn(t,"dragover",this),Hn(t,"dragenter",this)),SV.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),A_(this,V7t())}tr.prototype={constructor:tr,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(YC=null)},_getDirection:function(e,i){return typeof this.options.direction=="function"?this.options.direction.call(this,e,i,Ot):this.options.direction},_onTapStart:function(e){if(e.cancelable){var i=this,r=this.el,n=this.options,s=n.preventOnFilter,o=e.type,l=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,c=(l||e).target,f=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||c,_=n.filter;if(rFt(r),!Ot&&!(/mousedown|pointerdown/.test(o)&&e.button!==0||n.disabled)&&!f.isContentEditable&&!(!this.nativeDraggable&&j$&&c&&c.tagName.toUpperCase()==="SELECT")&&(c=ny(c,n.draggable,r,!1),!(c&&c.animated)&&Ck!==c)){if(HM=lf(c),H$=lf(c,n.draggable),typeof _=="function"){if(_.call(this,e,c,this)){Ru({sortable:i,rootEl:f,name:"filter",targetEl:c,toEl:r,fromEl:r}),fh("filter",i,{evt:e}),s&&e.cancelable&&e.preventDefault();return}}else if(_&&(_=_.split(",").some(function(x){if(x=ny(f,x.trim(),r,!1),x)return Ru({sortable:i,rootEl:x,name:"filter",targetEl:c,fromEl:r,toEl:r}),fh("filter",i,{evt:e}),!0}),_)){s&&e.cancelable&&e.preventDefault();return}n.handle&&!ny(f,n.handle,r,!1)||this._prepareDragStart(e,l,c)}}},_prepareDragStart:function(e,i,r){var n=this,s=n.el,o=n.options,l=s.ownerDocument,c;if(r&&!Ot&&r.parentNode===s){var f=Ha(r);if(Lo=s,Ot=r,sa=Ot.parentNode,cS=Ot.nextSibling,Ck=r,D8=o.group,tr.dragged=Ot,i3={target:Ot,clientX:(i||e).clientX,clientY:(i||e).clientY},C2e=i3.clientX-f.left,A2e=i3.clientY-f.top,this._lastX=(i||e).clientX,this._lastY=(i||e).clientY,Ot.style["will-change"]="all",c=function(){if(fh("delayEnded",n,{evt:e}),tr.eventCanceled){n._onDrop();return}n._disableDelayedDragEvents(),!x2e&&n.nativeDraggable&&(Ot.draggable=!0),n._triggerDragStart(e,i),Ru({sortable:n,name:"choose",originalEvent:e}),Nd(Ot,o.chosenClass,!0)},o.ignore.split(",").forEach(function(_){Bze(Ot,_.trim(),cX)}),Hn(l,"dragover",r3),Hn(l,"mousemove",r3),Hn(l,"touchmove",r3),Hn(l,"mouseup",n._onDrop),Hn(l,"touchend",n._onDrop),Hn(l,"touchcancel",n._onDrop),x2e&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Ot.draggable=!0),fh("delayStart",this,{evt:e}),o.delay&&(!o.delayOnTouchOnly||i)&&(!this.nativeDraggable||!(y6||Z_))){if(tr.eventCanceled){this._onDrop();return}Hn(l,"mouseup",n._disableDelayedDrag),Hn(l,"touchend",n._disableDelayedDrag),Hn(l,"touchcancel",n._disableDelayedDrag),Hn(l,"mousemove",n._delayedDragTouchMoveHandler),Hn(l,"touchmove",n._delayedDragTouchMoveHandler),o.supportPointer&&Hn(l,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(c,o.delay)}else c()}},_delayedDragTouchMoveHandler:function(e){var i=e.touches?e.touches[0]:e;Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Ot&&cX(Ot),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;On(e,"mouseup",this._disableDelayedDrag),On(e,"touchend",this._disableDelayedDrag),On(e,"touchcancel",this._disableDelayedDrag),On(e,"mousemove",this._delayedDragTouchMoveHandler),On(e,"touchmove",this._delayedDragTouchMoveHandler),On(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,i){i=i||e.pointerType=="touch"&&e,!this.nativeDraggable||i?this.options.supportPointer?Hn(document,"pointermove",this._onTouchMove):i?Hn(document,"touchmove",this._onTouchMove):Hn(document,"mousemove",this._onTouchMove):(Hn(Ot,"dragend",this),Hn(Lo,"dragstart",this._onDragStart));try{document.selection?Mk(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,i){if(nM=!1,Lo&&Ot){fh("dragStarted",this,{evt:i}),this.nativeDraggable&&Hn(document,"dragover",X7t);var r=this.options;!e&&Nd(Ot,r.dragClass,!1),Nd(Ot,r.ghostClass,!0),tr.active=this,e&&this._appendGhost(),Ru({sortable:this,name:"start",originalEvent:i})}else this._nulling()},_emulateDragOver:function(){if(E0){this._lastX=E0.clientX,this._lastY=E0.clientY,Zze();for(var e=document.elementFromPoint(E0.clientX,E0.clientY),i=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(E0.clientX,E0.clientY),e!==i);)i=e;if(Ot.parentNode[ap]._isOutsideThisEl(e),i)do{if(i[ap]){var r=void 0;if(r=i[ap]._onDragOver({clientX:E0.clientX,clientY:E0.clientY,target:e,rootEl:i}),r&&!this.options.dragoverBubble)break}e=i}while(i=i.parentNode);Jze()}},_onTouchMove:function(e){if(i3){var i=this.options,r=i.fallbackTolerance,n=i.fallbackOffset,s=e.touches?e.touches[0]:e,o=wr&&MO(wr,!0),l=wr&&o&&o.a,c=wr&&o&&o.d,f=F8&&zc&&E2e(zc),_=(s.clientX-i3.clientX+n.x)/(l||1)+(f?f[0]-lX[0]:0)/(l||1),x=(s.clientY-i3.clientY+n.y)/(c||1)+(f?f[1]-lX[1]:0)/(c||1);if(!tr.active&&!nM){if(r&&Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))=0&&(Ru({rootEl:sa,name:"add",toEl:sa,fromEl:Lo,originalEvent:e}),Ru({sortable:this,name:"remove",toEl:sa,originalEvent:e}),Ru({rootEl:sa,name:"sort",toEl:sa,fromEl:Lo,originalEvent:e}),Ru({sortable:this,name:"sort",toEl:sa,originalEvent:e})),uc&&uc.save()):Hd!==HM&&Hd>=0&&(Ru({sortable:this,name:"update",toEl:sa,originalEvent:e}),Ru({sortable:this,name:"sort",toEl:sa,originalEvent:e})),tr.active&&((Hd==null||Hd===-1)&&(Hd=HM,kw=H$),Ru({sortable:this,name:"end",toEl:sa,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){fh("nulling",this),Lo=Ot=sa=wr=cS=Yo=Ck=Yw=i3=E0=PI=Hd=kw=HM=H$=YC=q$=uc=D8=tr.dragged=tr.ghost=tr.clone=tr.active=null,TV.forEach(function(e){e.checked=!0}),TV.length=oX=aX=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Ot&&(this._onDragOver(e),Z7t(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],i,r=this.el.children,n=0,s=r.length,o=this.options;nn.right+s||t.clientY>r.bottom&&t.clientX>r.left:t.clientY>n.bottom+s||t.clientX>r.right&&t.clientY>r.top}function eFt(t,e,i,r,n,s,o,l){var c=r?t.clientY:t.clientX,f=r?i.height:i.width,_=r?i.top:i.left,x=r?i.bottom:i.right,T=!1;if(!o){if(l&&Ak_+f*s/2:cx-Ak)return-q$}else if(c>_+f*(1-n)/2&&cx-f*s/2)?c>_+f/2?1:-1:0}function tFt(t){return lf(Ot)Qze(r))}const pX="root",$2e={statusIndicators:!0,errors:!1};let zs=class extends cn{constructor(e,i){super(e,i),this._sortableNodes=new Map,this._sortableMap=new Map,this._focusSortUid=null,this._tooltipReferenceMap=new Map,this.visibleItems=null,this.iconClass=vi.widgetIcon,this.icon=null,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.selectionEnabled=!1,this.selectedItems=new sFt,this.style="classic",this.viewModel=new kze,this.visibleElements={...$2e},this._onSortableSort=({to:r,from:n,item:s,newIndex:o})=>{n&&r&&(n===r?this._sortLayers(this._sortableMap.get(n.dataset.group)):this._moveLayerFromChildList({to:r,from:n,item:s,newIndex:o}))},this._sortableCanSort=(r,n)=>!(!r.el.dataset.group||!n.el.dataset.group),this._sortableCanPull=(r,n,s)=>{const{listItemCanGiveFunction:o}=this,l={selected:Ll(s),from:Ll(n.el),to:Ll(r.el)};return!this._sortableCanSort(r,n)||typeof o!="function"||o.call(null,l)},this._sortableCanPut=(r,n,s)=>{const{listItemCanReceiveFunction:o}=this,l={selected:Ll(s),from:Ll(n.el),to:Ll(r.el)};return!this._sortableCanSort(r,n)||typeof o!="function"||o.call(null,l)},this._onSortableEnd=({oldIndex:r,from:n,to:s,item:o})=>{n!==s&&n.insertBefore(o,n.children[r])}}initialize(){const e=this.operationalItems;this._setVisibleItems(e),this.addHandles([Jr(()=>this.operationalItems,"change",()=>this._itemsChanged(e)),_e(()=>this.visibleElements,()=>this._itemsChanged(e)),_e(()=>this.selectionEnabled,()=>this._toggleAllSorting(),ii)])}loadDependencies(){return Pl({icon:()=>we(()=>import("./calcite-icon-itD416se.js"),__vite__mapDeps([248,245,242])),tooltip:()=>we(()=>import("./calcite-tooltip-DucKIjb_.js"),__vite__mapDeps([251,252,253,247,254,255]))})}destroy(){this._destroySortables(),this._tooltipReferenceMap.clear()}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...$2e,...e}}triggerAction(e,i){return this.viewModel.triggerAction(e,i)}render(){var l;const{visibleItems:e,style:i}=this,r=(l=this.viewModel)==null?void 0:l.state,n={[vi.newUI]:i==="modern",[tt.hidden]:r==="loading",[tt.disabled]:r==="disabled"},s=this._renderItemTooltips(),o=this._renderItems();return X("div",{class:this.classes(vi.base,tt.widget,tt.panel,n)},e.length?[s,o]:this._renderNoItems())}_renderItemTooltip(e){const{_tooltipReferenceMap:i,messages:r}=this;return e?X("calcite-tooltip",{referenceElement:i.get(e.uid)},r.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){const{incompatible:i,children:r}=e;return[i?this._renderItemTooltip(e):null,...!i&&r?r.toArray().map(n=>this._renderItemTooltipNodes(n)):[]]}_renderItemTooltips(){return this.visibleItems.toArray().map(e=>this._renderItemTooltipNodes(e))??[]}_renderNoItems(){return X("div",{class:vi.noItems},this.messages.noItemsToDisplay)}_renderItems(){const{visibleItems:e,selectionEnabled:i,messages:r}=this;return X("ul",{afterCreate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,afterUpdate:this._sortNodeCreated,"aria-label":r.widgetLabel,bind:this,class:this.classes(vi.list,vi.listRoot,vi.listIndependent),"data-group":pX,role:i?"listbox":void 0},e.map(n=>this._renderItem(n,null)).toArray())}_renderActionsMenuIcon(e,i){const{messagesCommon:r}=this,n={[vi.actionsMenuItemActive]:e.actionsOpen};return X("div",{"aria-controls":i,"aria-label":r.options,bind:this,class:this.classes(vi.actionsMenuItem,n),"data-item":e,key:"actions-menu-toggle",onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,role:"button",tabIndex:0,title:r.options},X("span",{"aria-hidden":"true",class:si.handleHorizontal}))}_renderActionsMenu(e,i,r,n){const{panel:s}=e,o=s&&s.visible?this._renderPanelButton(s):null,l=r===1&&this._getSingleActionButton(i),c=l?this._renderAction({item:e,action:l,singleAction:!0}):null,f=!l&&r?this._renderActionsMenuIcon(e,n):null;return f||o||l?X("div",{class:vi.actionsMenu,key:"actions-menu"},o,c,f):null}_renderChildList(e,i){var T;const{selectionEnabled:r}=this,{visibilityMode:n,children:s}=e,o=this._hasChildren(e),l=!o&&r&&((T=e.layer)==null?void 0:T.type)==="group",{exclusive:c,inherited:f}=FR,_={[vi.listEmpty]:!o,[vi.listExclusive]:n===c,[vi.listInherited]:n===f,[vi.listIndependent]:n!==f&&n!==c},x={[vi.listEmptyState]:!0,[vi.listEmptyStateDragEnabled]:r};return o||l?o?X("ul",{afterCreate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,afterUpdate:this._sortNodeCreated,"aria-expanded":e.open?"true":"false",bind:this,class:this.classes(vi.list,_),"data-group":e.uid,"data-item":e,hidden:!e.open&&!l||null,id:i,key:"list-items",role:r?"listbox":n===c?"radiogroup":"group"},s==null?void 0:s.map(A=>this._renderItem(A,e)).toArray()):X("div",{afterCreate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,afterUpdate:this._sortNodeCreated,bind:this,class:this.classes(x),"data-group":e.uid,"data-item":e,id:i,key:"list-items"},this.messages.noItemsToDisplay):null}_renderChildrenToggle(e,i){const{messagesCommon:r}=this,n=this._hasChildren(e),s={[vi.childToggleOpen]:e.open},o=e.open?r.collapse:r.expand;return n?X("span",{"aria-controls":i,"aria-label":o,class:this.classes(vi.childToggle,s),"data-item":e,key:"toggle-children",onclick:this._toggleChildrenClick,onkeydown:this._toggleChildrenClick,role:"button",tabIndex:0,title:o},X("span",{"aria-hidden":"true",class:this.classes(vi.childClosed,si.rightTriangleArrow)}),X("span",{"aria-hidden":"true",class:this.classes(vi.childOpened,si.downArrow)}),X("span",{"aria-hidden":"true",class:this.classes(vi.childClosed_RTL,si.leftTriangleArrow)})):null}_renderItemMessage(e){return e.error?X("div",{class:vi.message,key:"esri-layer-list__error",role:"alert"},X("span",{"aria-hidden":"true",class:si.noticeTriangle}),this.messages.layerError):e.incompatible?X("div",{class:vi.message,key:"esri-layer-list__incompatible",role:"alert"},X("span",{afterCreate:i=>this._setTooltipReference(i,e),"aria-hidden":"true",bind:this,class:si.noticeTriangle,tabIndex:0}),this.messages.layerIncompatible):null}_renderItemContent(e,i,r){const{id:n}=this,s=`${n}_${e.uid}`,o=`${s}_actions`,l=`${s}__list`,{panel:c}=e,f=this._filterActions(e.actionsSections),_=this._countActions(f);return[X("div",{class:vi.itemContainer,key:"list-item-container"},this._renderChildrenToggle(e,l),this._renderLabel(e,i,r),this._renderActionsMenu(e,f,_,o)),this._renderItemMessage(e),_?this._renderActionsSections(e,f,o):null,c&&c.open&&!c.disabled?c.render():null,this._renderChildList(e,l)]}_renderItem(e,i){var x;const{style:r,id:n,selectionEnabled:s,selectedItems:o}=this,l=`${`${n}_${e.uid}`}__title`,c=this._hasMessage(e),f=this._hasChildren(e),_={[vi.itemChildren]:f,[vi.itemMessage]:!!c,[vi.itemInvisible]:r==="modern"&&!e.visible,[vi.itemInvisibleAtScale]:!e.visibleAtCurrentScale,[vi.itemSelectable]:s};if(s){const T={[I2e]:(x=e.layer)==null?void 0:x.uid,[R2e]:(!e.sortable).toString()};return X("li",{afterCreate:this._focusListItem,afterUpdate:this._focusListItem,"aria-labelledby":l,"aria-selected":iX(e,o)?"true":"false",bind:this,class:this.classes(vi.item,_),"data-group":i?i.uid:pX,"data-item":e,key:`item-with-selection-${e.uid}`,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,role:"option",tabIndex:0,...T},this._renderItemContent(e,i,l))}return X("li",{afterCreate:this._focusListItem,afterUpdate:this._focusListItem,"aria-labelledby":l,bind:this,class:this.classes(vi.item,_),key:`item-no-selection-${e.uid}`},this._renderItemContent(e,i,l))}_renderConnectionIcon(e){const{connectionStatus:i}=e;return i!=null?X("calcite-icon",{icon:i==="connected"?"beacon":"offline",scale:"s"}):null}_renderItemStatus(e,i){const{visibleElements:r}=this;if(!r.statusIndicators)return null;const{connectionStatus:n,publishing:s,updating:o}=e,l=o&&!i,c=!!n;return X("span",{class:this.classes({[vi.statusIndicator]:!0,[vi.publishing]:s,[vi.updating]:l,[vi.connectionStatus]:c,[vi.connectionStatusConnected]:c&&n==="connected"}),key:"layer-item-status"},this._renderConnectionIcon(e))}_renderItemTitle(e,i){const{messages:r}=this;if(!e)return null;const n=e.title||r.untitledLayer,s=e.visibleAtCurrentScale?n:`${n} (${r.layerInvisibleAtScale})`;return X("span",{"aria-label":s,class:vi.title,id:i,key:"layer-title-container",title:s},n)}_renderItemToggleIcon({visible:e},i){const{style:r}=this,{exclusive:n}=FR,s=i==null?void 0:i.visibilityMode,o=r==="modern",l=s===n,c={[vi.toggleVisibleIcon]:o,[vi.toggleIcon]:o&&!l,[vi.radioIcon]:o&&l,[si.radioChecked]:l&&e,[si.radioUnchecked]:l&&!e,[si.visible]:!l&&e,[si.nonVisible]:!l&&!e};return X("span",{"aria-hidden":"true",class:this.classes(c),key:"item-toggle-icon"})}_renderItemToggle(e,i,r){const{selectionEnabled:n,messages:s}=this,{exclusive:o}=FR,l=i==null?void 0:i.visibilityMode,c=l===o?"radio":"switch";return X("span",n?{"aria-checked":e.visible?"true":"false","aria-labelledby":r,bind:this,class:vi.toggleVisible,"data-item":e,"data-parent-visibility":l,key:"item-toggle-selection-enabled",onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,role:c,tabIndex:0,title:s.layerVisibility}:{class:vi.toggleVisible,key:"item-toggle"},this._renderItemToggleIcon(e,i))}_renderLabel(e,i,r){const{selectionEnabled:n,style:s,messages:o}=this,{inherited:l,exclusive:c}=FR,f=i==null?void 0:i.visibilityMode,_=f===c?"radio":"switch",x=this._renderItemTitle(e,r),T=this._renderItemStatus(e,i),A=this._renderItemToggle(e,i,r),M=s==="modern"?[x,T,A]:[A,x,T],I=X("div",n?{class:vi.label,key:`item-label-no-selection-${e.uid}`}:{"aria-checked":e.visible?"true":"false","aria-labelledby":r,bind:this,class:vi.label,"data-item":e,"data-parent-visibility":f,key:`item-label-with-selection-${e.uid}`,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,role:_,tabIndex:0,title:o.layerVisibility},M);return f===l||e.error?X("div",{class:vi.label,key:`item-label-container-${e.uid}`},this._renderItemTitle(e,r),this._renderItemStatus(e,i)):I}_renderPanelButton(e){const{className:i,open:r,title:n,image:s,disabled:o}=e,l=s||i?i:si.defaultAction,c=this._getIconImageStyles(e),f={[vi.actionsMenuItemActive]:r&&!o},_={[vi.actionImage]:!!c["background-image"],[tt.disabledElement]:e.disabled};return l&&(_[l]=!!l),X("div",{"aria-disabled":e.disabled.toString(),"aria-label":n,bind:this,class:this.classes(vi.actionsMenuItem,f),"data-panel":e,key:`panel-${e.uid}`,onclick:this._triggerPanel,onkeydown:this._triggerPanel,role:"button",tabIndex:e.disabled?void 0:0,title:n},X("span",{class:this.classes(_),styles:c}))}_renderActionsSections(e,i,r){const n=i.toArray().map((s,o)=>X("ul",{class:vi.actionsList,key:`${e}-action-section-${o}`},this._renderActionSection(e,s)));return X("div",{"aria-expanded":e.actionsOpen?"true":"false",class:vi.actions,hidden:!e.actionsOpen||null,id:r,key:"actions-section",role:"group"},n)}_renderActionSection(e,i){return(i&&i.toArray()).map(r=>this._renderAction({item:e,action:r}))}_renderActionIcon(e){const{active:i,className:r}=e,n=this._getIconImageStyles(e),s=e.type!=="button"||e.image||r?r:si.defaultAction,o={[vi.actionImage]:!i&&!!n["background-image"],[si.loadingIndicator]:i,[tt.rotating]:i};return s&&!i&&(o[s]=!0),X("span",{"aria-hidden":"true",class:this.classes(vi.actionIcon,o),key:"action-icon",styles:n})}_renderActionTitle(e,i){return i?null:X("span",{class:vi.actionTitle,key:"action-title"},e)}_renderAction(e){const{item:i,action:r,singleAction:n}=e,{active:s,disabled:o,title:l}=r,c={[vi.actionsMenuItem]:n&&r.type==="button",[vi.action]:s||!n&&r.type!=="toggle",[vi.actionToggle]:!s&&r.type==="toggle",[vi.actionToggleOn]:!s&&r.type==="toggle"&&r.value,[tt.disabledElement]:o},f=[this._renderActionIcon(r),this._renderActionTitle(l,n)];return n?X("div",{"aria-label":l??void 0,bind:this,classes:c,"data-action":r,"data-item":i,key:`single-action-${r.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,role:"button",tabIndex:0,title:l??void 0},f):X("li",{"aria-label":l??void 0,bind:this,classes:c,"data-action":r,"data-item":i,key:`action-${r.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,role:"button",tabIndex:0,title:l??void 0},f)}_setTooltipReference(e,i){this._tooltipReferenceMap.set(i.uid,e),this.scheduleRender()}_hasMessage(e){return!!e.error||e.incompatible}_hasChildren(e){return!!e.children.length&&!this._hasMessage(e)}_sortNodeRemoved(e){const{_sortableMap:i}=this,r=e.dataset.group,n=i.get(r);n&&n.destroy(),i.delete(r)}_destroySortables(){const{_sortableMap:e,_sortableNodes:i}=this;e.forEach(r=>r&&r.destroy()),e.clear(),i.clear()}_moveLayerFromChildList({to:e,from:i,item:r,newIndex:n}){const s=Ll(r),o=Ll(e),l=Ll(i);this.viewModel.moveListItem(s,l,o,n)}_sortLayers(e){var n,s;if(!e)return;const i=Ll(e.el),r=e.toArray();i?x7t(i,r):Ize((s=(n=this.view)==null?void 0:n.map)==null?void 0:s.layers,r)}_toggleSorting(e,i){const{_sortableMap:r,selectionEnabled:n}=this,s=r.get(i),o=Ll(e),l=(i===pX||(o==null?void 0:o.childrenSortable)&&_7t(o))&&n;if(s)s.option("disabled",!l);else if(l){const c=tr.create(e,{dataIdAttr:I2e,group:{name:i,pull:this._sortableCanPull,put:this._sortableCanPut},filter:`[${R2e}="true"]`,fallbackTolerance:4,onSort:this._onSortableSort,onEnd:this._onSortableEnd,disabled:!l,chosenClass:vi.sortableChosen});r.set(i,c)}}_toggleAllSorting(){this._sortableNodes.forEach((e,i)=>this._toggleSorting(e,i))}_sortNodeCreated(e){const i=e.dataset.group;i&&(this._sortableNodes.set(i,e),this._toggleSorting(e,i))}_setVisibleItems(e){this.visibleItems=e.filter(i=>!i.hidden&&(this.visibleElements.errors||!i.error))}_getSingleActionButton(e){return e.reduce(i=>i).filter(i=>i&&i.type==="button").at(0)}_focusListItem(e){var n;const{_focusSortUid:i}=this;if(!e||!i)return;const r=Ll(e);((n=r==null?void 0:r.layer)==null?void 0:n.uid)===i&&(e.focus(),this._focusSortUid=null)}_watchActionSectionChanges(e){this.addHandles(e.on("change",this.scheduleRender.bind(this)),Lb.actionSection),e.forEach(i=>this._renderOnActionChanges(i))}_renderOnActionChanges(e){e.type!=="toggle"?e.type!=="slider"?this.addHandles(_e(()=>[e==null?void 0:e.className,e==null?void 0:e.image,e==null?void 0:e.id,e==null?void 0:e.title,e==null?void 0:e.visible],()=>this.scheduleRender(),ii),Lb.actions):this.addHandles(_e(()=>[e==null?void 0:e.className,e==null?void 0:e.id,e==null?void 0:e.title,e==null?void 0:e.visible,e==null?void 0:e.value,e==null?void 0:e.displayValueEnabled,e==null?void 0:e.max,e==null?void 0:e.min,e==null?void 0:e.step],()=>this.scheduleRender(),ii),Lb.actions):this.addHandles(_e(()=>[e==null?void 0:e.className,e==null?void 0:e.image,e==null?void 0:e.id,e==null?void 0:e.title,e==null?void 0:e.visible,e==null?void 0:e.value],()=>this.scheduleRender(),ii),Lb.actions)}_renderOnItemChanges(e){this.addHandles([_e(()=>{var i,r,n;return[e==null?void 0:e.actionsOpen,e==null?void 0:e.visible,e==null?void 0:e.open,e==null?void 0:e.updating,e==null?void 0:e.connectionStatus,e==null?void 0:e.publishing,e==null?void 0:e.title,e==null?void 0:e.visibleAtCurrentScale,e==null?void 0:e.error,e==null?void 0:e.visibilityMode,e==null?void 0:e.panel,(i=e==null?void 0:e.panel)==null?void 0:i.title,(r=e==null?void 0:e.panel)==null?void 0:r.content,(n=e==null?void 0:e.panel)==null?void 0:n.className,e==null?void 0:e.sortable,e==null?void 0:e.childrenSortable]},()=>this.scheduleRender(),kt),_e(()=>[e==null?void 0:e.hidden,e==null?void 0:e.error],()=>this._setVisibleItems(this.operationalItems)),e.actionsSections.on("change",()=>this.scheduleRender()),e.children.on("change",()=>this.scheduleRender())],Lb.items),e.children.forEach(i=>this._renderOnItemChanges(i)),e.actionsSections.forEach(i=>this._watchActionSectionChanges(i))}_itemsChanged(e){this.removeHandles(Lb.items),this.removeHandles(Lb.actions),this.removeHandles(Lb.actionSection),e.forEach(i=>this._renderOnItemChanges(i)),this._tooltipReferenceMap.clear(),this._setVisibleItems(e),this.scheduleRender()}_filterActions(e){return e.map(i=>i.filter(r=>r.visible))}_countActions(e){return e.reduce((i,r)=>i+r.length,0)}_getIconImageStyles(e){const i=e.declaredClass==="esri.widgets.LayerList.ListItemPanel"||e.declaredClass==="esri.support.Action.ActionButton"||e.declaredClass==="esri.support.Action.ActionToggle"?e.image:null;return{"background-image":i?`url("${i}")`:void 0}}_selectionKeydown(e){var M,I,L,F;const i=["ArrowDown","ArrowUp"],r=Sf(e);if(!i.includes(r))return void this._toggleSelection(e);e.stopPropagation();const n=e.currentTarget,s=Ll(n),{_sortableMap:o,selectedItems:l}=this,c=n.dataset.group,f=o.get(c);if(!f||!s)return;const _=iX(s,l),x=f.toArray(),T=e.target,A=x.indexOf(T.dataset[oFt]);if(A!==-1){if(r==="ArrowDown"){const z=A+1;if(z>=x.length)return;_?(P2e(x,A,z),f.sort(x),this._sortLayers(f),this._focusSortUid=(M=s.layer)==null?void 0:M.uid):(this._focusSortUid=(I=s.layer)==null?void 0:I.uid,this.scheduleRender())}if(r==="ArrowUp"){const z=A-1;if(z<=-1)return;_?(P2e(x,A,z),f.sort(x),this._sortLayers(f),this._focusSortUid=(L=s.layer)==null?void 0:L.uid):(this._focusSortUid=(F=s.layer)==null?void 0:F.uid,this.scheduleRender())}}}_toggleActionsOpen(e){const i=Ll(e.currentTarget);if(!i)return;const{actionsOpen:r}=i,n=!r;n&&this.operationalItems.forEach(s=>Qze(s)),i.actionsOpen=n,e.stopPropagation()}_triggerPanel(e){const i=aFt(e.currentTarget);e.stopPropagation(),i&&!i.disabled&&(i.open=!i.open)}_triggerAction(e){const i=e.currentTarget,r=lFt(i),n=Ll(i);r&&n&&(r.type==="toggle"&&(r.value=!r.value),this.triggerAction(r,n),e.stopPropagation())}_toggleVisibility(e){const i=e.currentTarget,r=i.getAttribute("data-parent-visibility"),n=Ll(i);n&&(r===FR.exclusive&&n.visible||(n.visible=!n.visible),e.stopPropagation())}_toggleChildrenClick(e){const i=Ll(e.currentTarget);i&&(i.open=!i.open,e.stopPropagation())}_toggleSelection(e){var l,c;e.stopPropagation();const{multipleSelectionEnabled:i,selectedItems:r}=this,n=Ll(e.currentTarget);if(!n)return;const s=iX(n,r),{length:o}=r;if(!i)return o&&!(s&&o===1)?(r.removeAll(),void r.add(n)):void(s?(l=r.remove)==null?void 0:l.call(r,s):r.add(n));s?(c=r.remove)==null||c.call(r,s):r.add(n)}get test(){return{visibleItems:this.visibleItems}}};function Ll(t){return t==null?void 0:t["data-item"]}function aFt(t){return t==null?void 0:t["data-panel"]}function lFt(t){return t==null?void 0:t["data-action"]}y([w()],zs.prototype,"visibleItems",void 0),y([w()],zs.prototype,"iconClass",void 0),y([w()],zs.prototype,"icon",void 0),y([w()],zs.prototype,"label",null),y([w()],zs.prototype,"listItemCanGiveFunction",void 0),y([w()],zs.prototype,"listItemCanReceiveFunction",void 0),y([w()],zs.prototype,"listItemCreatedFunction",null),y([w(),Gr("esri/widgets/LayerList/t9n/LayerList")],zs.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],zs.prototype,"messagesCommon",void 0),y([w()],zs.prototype,"multipleSelectionEnabled",void 0),y([w()],zs.prototype,"operationalItems",null),y([w()],zs.prototype,"selectionEnabled",void 0),y([w()],zs.prototype,"selectedItems",void 0),y([w()],zs.prototype,"style",void 0),y([w()],zs.prototype,"view",null),y([Kce("trigger-action"),w({type:kze})],zs.prototype,"viewModel",void 0),y([w()],zs.prototype,"visibleElements",void 0),y([Ci("visibleElements")],zs.prototype,"castVisibleElements",null),y([bo()],zs.prototype,"_toggleActionsOpen",null),y([bo()],zs.prototype,"_triggerPanel",null),y([bo()],zs.prototype,"_triggerAction",null),y([bo()],zs.prototype,"_toggleVisibility",null),y([bo()],zs.prototype,"_toggleChildrenClick",null),y([bo()],zs.prototype,"_toggleSelection",null),zs=y([Z("esri.widgets.LayerList")],zs);const eUe=zs;let yw=class extends ze{constructor(e){super(e),this._viewpointHandle=null,this.group=null}initialize(){this.addHandles(Jr(()=>{var e;return(e=this.view)==null?void 0:e.ui},"expand",e=>{const{target:i}=e;i&&i!==this&&i.expanded&&i.group&&i.group===this.group&&this._collapse()}))}destroy(){this._viewpointHandle=null,this.view=null}set autoCollapse(e){this._set("autoCollapse",e),this._watchViewpoint()}set expanded(e){var n;const i=!!e;this._set("expanded",i);const r=(n=this.view)==null?void 0:n.ui;r&&r.emit("expand",{target:this}),this._viewpointHandleChange(i)}get state(){var e;return(e=this.view)!=null&&e.ready?"ready":"disabled"}set view(e){this._get("view")!==e&&(this._set("view",e),e&&Mo(()=>e.ready,()=>{this.view===e&&this._watchViewpoint()},{once:!0,initial:!0}))}_viewpointHandleChange(e){this._viewpointHandle&&(e?Mo(()=>{var i;return(i=this.view)==null?void 0:i.stationary},()=>{var i;return(i=this._viewpointHandle)==null?void 0:i.resume()},{once:!0,initial:!0}):this._viewpointHandle.pause())}_watchViewpoint(){const e="viewpoint";this.removeHandles(e),this._viewpointHandle=null;const{autoCollapse:i,view:r}=this;if(!r||!i)return;const n=LHe(()=>r.type==="3d"?r.camera:r.viewpoint,()=>this._collapse());this.addHandles(n,e),this._viewpointHandle=n}_collapse(){this.expanded=!1}};y([w({value:!1})],yw.prototype,"autoCollapse",null),y([w({value:!1})],yw.prototype,"expanded",null),y([w()],yw.prototype,"group",void 0),y([w({readOnly:!0})],yw.prototype,"state",null),y([w({value:null})],yw.prototype,"view",null),yw=y([Z("esri.widgets.Expand.ExpandViewModel")],yw);const tUe=yw,mh="esri-expand",Uc={base:mh,modeAuto:`${mh}--auto`,modeDrawer:`${mh}--drawer`,modeFloating:`${mh}--floating`,container:`${mh}__container`,containerExpanded:`${mh}__container--expanded`,panel:`${mh}__panel`,icon:"esri-collapse__icon",iconExpanded:`${mh}__icon--expanded`,iconNumber:`${mh}__icon-number`,iconNumberExpanded:`${mh}__icon-number--expanded`,content:`${mh}__content`,contentExpanded:`${mh}__content--expanded`,expandMask:`${mh}__mask`,expandMaskExpanded:`${mh}__mask--expanded`};let ho=class extends cn{constructor(e,i){super(e,i),this.closeOnEsc=!0,this.collapseIcon=null,this.collapseTooltip="",this.content="",this.expandTooltip="",this.iconClass=null,this.icon=null,this.iconNumber=0,this.messages=null,this.messagesCommon=null,this.mode="auto",this.viewModel=new tUe,this._handleKeyDown=r=>{const{closeOnEsc:n,_toggleButtonEl:s,expanded:o}=this;!o||!n||r.target===s||r.key!=="Escape"||(typeof n=="function"?n(r):n)&&(this.expanded=!1,s==null||s.focus())}}loadDependencies(){return Pl({icon:()=>we(()=>import("./calcite-icon-itD416se.js"),__vite__mapDeps([248,245,242]))})}get contentId(){return`${this.id}_controls_content`}get expandTitle(){const{expanded:e,messagesCommon:i,collapseTooltip:r,expandTooltip:n}=this;return(e?r||(i==null?void 0:i.collapse):n||(i==null?void 0:i.expand))??""}get autoCollapse(){return this.viewModel.autoCollapse}set autoCollapse(e){this.viewModel.autoCollapse=e}get collapseIconClass(){return si.collapse}set collapseIconClass(e){this._overrideIfSome("collapseIconClass",e)}get expanded(){return this.viewModel.expanded}set expanded(e){this.viewModel.expanded=e}get expandIconClass(){return B$(this.content)?this.content.iconClass:si.expand}set expandIconClass(e){this._overrideIfSome("expandIconClass",e)}get expandIcon(){return B$(this.content)?this.content.icon:void 0}set expandIcon(e){this._overrideIfSome("expandIcon",e)}get group(){return this.viewModel.group}set group(e){this.viewModel.group=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}expand(){this.viewModel.expanded=!0}collapse(){this.viewModel.expanded=!1}toggle(){this.viewModel.expanded=!this.viewModel.expanded}render(){const{mode:e}=this,i={[Uc.modeAuto]:e==="auto",[Uc.modeDrawer]:e==="drawer",[Uc.modeFloating]:e==="floating"};return X("div",{class:this.classes(Uc.base,tt.widget,i),onkeydown:this._handleKeyDown},this._renderMask(),this._renderContainer())}_renderContainer(){const{expanded:e}=this,i={[Uc.containerExpanded]:e};return X("div",{class:this.classes(Uc.container,i)},this._renderPanel(),this._renderContent())}_renderMask(){const{expanded:e}=this,i={[Uc.expandMaskExpanded]:e};return X("div",{bind:this,class:this.classes(Uc.expandMask,i),onclick:this._toggle})}_renderBadgeNumber(){const{expanded:e,iconNumber:i}=this;return i&&!e?X("span",{class:Uc.iconNumber,key:"expand__icon-number"},i):null}_renderPanelNumber(){const{iconNumber:e,expanded:i}=this;return e&&i?X("span",{class:this.classes(Uc.iconNumber,Uc.iconNumberExpanded),key:"expand__expand-icon-number"},e):null}_renderIcon(){const e=(this.expanded?this.collapseIcon:this.expandIcon)??"";return X("calcite-icon",{icon:e,key:"icon",scale:"s"})}_renderLegacyIcon(){const{collapseIconClass:e,expandIconClass:i,expanded:r}=this,n={[Uc.iconExpanded]:r};return i!=null&&(n[i]=!r),e!=null&&(n[e]=e===i||r),X("span",{"aria-hidden":"true",class:this.classes(Uc.icon,n),key:"legacy-icon"})}_renderTitle(){return X("span",{class:si.fontFallbackText},this.expandTitle)}_renderExpandButton(){const{expanded:e,expandTitle:i,expandIcon:r,collapseIcon:n,contentId:s}=this;return X("div",{afterCreate:this._storeToggleButtonEl,"aria-controls":s,"aria-expanded":e?"true":"false",bind:this,class:tt.widgetButton,onclick:this._toggle,onkeydown:this._toggle,role:"button",tabIndex:0,title:i},this._renderBadgeNumber(),!e&&r!=null||e&&n!=null?this._renderIcon():this._renderLegacyIcon(),this._renderTitle())}_renderPanel(){return X("div",{class:Uc.panel},this._renderExpandButton(),this._renderPanelNumber())}_renderContent(){const{expanded:e,contentId:i,content:r}=this,n={[Uc.contentExpanded]:e},s={id:i,role:"region",class:this.classes(Uc.content,n)};return typeof r=="string"?X("div",{innerHTML:r,key:"content__string",...s}):B$(r)?X("div",{key:"content__widget",...s},r.render()):r instanceof HTMLElement?X("div",{afterCreate:this._attachToNode,bind:r,key:"content__html-element",...s}):A7t(r)?X("div",{afterCreate:this._attachToNode,bind:r.domNode,key:"content__node",...s}):null}_toggle(){this.toggle()}_attachToNode(e){const i=this;e.appendChild(i)}_storeToggleButtonEl(e){this._toggleButtonEl=e}};y([w({readOnly:!0})],ho.prototype,"contentId",null),y([w({readOnly:!0})],ho.prototype,"expandTitle",null),y([w()],ho.prototype,"autoCollapse",null),y([w()],ho.prototype,"closeOnEsc",void 0),y([w()],ho.prototype,"collapseIconClass",null),y([w()],ho.prototype,"collapseIcon",void 0),y([w()],ho.prototype,"collapseTooltip",void 0),y([w()],ho.prototype,"content",void 0),y([w()],ho.prototype,"expanded",null),y([w()],ho.prototype,"expandIconClass",null),y([w()],ho.prototype,"expandIcon",null),y([w()],ho.prototype,"expandTooltip",void 0),y([w()],ho.prototype,"group",null),y([w()],ho.prototype,"iconClass",void 0),y([w()],ho.prototype,"icon",void 0),y([w()],ho.prototype,"iconNumber",void 0),y([w()],ho.prototype,"label",null),y([w(),Gr("esri/widgets/Expand/t9n/Expand")],ho.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],ho.prototype,"messagesCommon",void 0),y([w()],ho.prototype,"mode",void 0),y([w()],ho.prototype,"view",null),y([w({type:tUe})],ho.prototype,"viewModel",void 0),y([bo()],ho.prototype,"_toggle",null),ho=y([Z("esri.widgets.Expand")],ho);async function cFt(t,e={}){const{basemap:i,view:r}=t;await i.load(e),hFt(i),await pFt(i,r,e),St(e)}async function uFt(t,e={}){var o;const{basemap:i,view:r}=t;if(St(e),!r||"spatialReferenceLocked"in r&&!r.spatialReferenceLocked||(await i.load(e),St(e),i.baseLayers.length===0))return;const n=i.baseLayers.at(0);if(!oO(n))return;if(i.spatialReference){if(r.spatialReference.equals(i.spatialReference))return;L2e()}await n.load(e),St(e);const s=(("supportedSpatialReferences"in n?n.supportedSpatialReferences:null)||["tileInfo"in n?(o=n.tileInfo)==null?void 0:o.spatialReference:null]).filter(ys);s.length!==0&&s.every(l=>!r.spatialReference.equals(l))&&L2e()}function L2e(){throw new se("basemap-compatibility:incompatible-spatial-reference","Basemap spatial reference is not compatible with the view")}function hFt(t){if(t.baseLayers.length===0&&t.referenceLayers.length===0)return;const e=t.baseLayers.concat(t.referenceLayers).toArray().filter(i=>!Fnt(i)).map(i=>dFt(i));if(e.length)throw e[0]}function dFt(t){return new se("basemap-compatibility:unsupported-basemap-layer-type","Unsupported basemap layer type ${operationalLayerType}",{layer:t,operationalLayerType:t.operationalLayerType||"unknown"})}async function pFt(t,e,i){if(t.baseLayers.length===0)return;const r=t.baseLayers.at(0);if(kOe(r)){try{await r.load(i)}catch(n){const s="basemap-compatibility:unknown-error",o="Unknown basemap compatibility error",{name:l=s,message:c=o,details:f}=n;throw new se(l,c,f)}fFt(r,e)}}function fFt(t,e){var c;const i=e.state.viewingMode;if(!i)return;let r,n;if((t==null?void 0:t.type)==="wmts"){const f=J7e(t,e.spatialReference,i);if(f.tileInfo==null)throw new se("basemapgalleryitem:tiling-scheme-incompatible","Basemap tiling scheme is incompatible with the view");r=f.tileInfo,n=f.fullExtent}else r=t.tileInfo,n=t.fullExtent;if(r==null)return;if(!p5(r.spatialReference,i))throw new se(`basemapgalleryitem:spatial-reference-unsupported-${u$(i)}`,`Basemap spatial reference is unsupported in ${u$(i)} mode`);const s=r.spatialReference.isGeographic,o=(t==null?void 0:t.type)==="vector-tile"?r.getOrCreateCompatible(256,s?1:2):null;if(i===_t.Global){let f=KL(r,n,null,i);if(f&&(t==null?void 0:t.type)==="vector-tile"&&n!=null&&o&&!KL(o,n,null,i)&&(f=null),f){const _=r.spatialReference.isWebMercator?"web-mercator":"wgs84";throw new se(`basemapgalleryitem:tiling-scheme-unsupported-${_}-global`,"Basemap tiling scheme is unsupported in global mode",{error:f})}}else if(Bu.checkUnsupported(r))throw new se("basemapgalleryitem:tiling-scheme-unsupported-local","Basemap tiling scheme is unsupported in local mode");const l=(c=e.basemapTerrain)==null?void 0:c.tilingScheme;if(l&&!l.compatibleWith(r)&&((t==null?void 0:t.type)!=="vector-tile"||!o||!l.compatibleWith(o)))throw new se("basemapgalleryitem:tiling-scheme-incompatible","Basemap tiling scheme is incompatible with the view")}let Vg=class extends I_(ze){constructor(e){super(e),this.compatibilityFunction=null,this.error=null,this.state="loading",this.view=null}initialize(){const e=()=>this.refresh();this.addHandles([_e(()=>{var i;return(i=this.basemap)==null?void 0:i.loadStatus},e),_e(()=>this.compatibilityFunction,e),_e(()=>{var i;return this.view&&"basemapTerrain"in this.view&&((i=this.view.basemapTerrain)==null?void 0:i.tilingScheme)},e),_e(()=>{var i;return(i=this.view)==null?void 0:i.ready},e),_e(()=>{var i;return(i=this.view)==null?void 0:i.spatialReference},e)]),this.refresh()}destroy(){this._cancelRefresh(),this.basemap=null,this.compatibilityFunction=null,this.view=null}get _spatialReferenceTask(){return Bdt(this.view,this.basemap)}set basemap(e){e&&e.load().catch(()=>{}),this._set("basemap",e)}get spatialReference(){return this._spatialReferenceTask.spatialReference}refresh(){var n;this._cancelRefresh(),this._set("state","loading");const e=(n=this.basemap)==null?void 0:n.loadStatus;if(e!=="loaded"&&e!=="failed")return;if(!this.compatibilityFunction)return void(e==="loaded"?(this._set("state","ready"),this._set("error",null)):(this._set("state","error"),this._set("error",this.basemap.loadError)));const i=new AbortController,{signal:r}=i;this.compatibilityFunction(this,{signal:r}).then(()=>rd(()=>!this._spatialReferenceTask.updating,r)).then(()=>{this._set("state","ready"),this._set("error",null)}).catch(s=>{sn(s)||(this._set("state","error"),this._set("error",s))}),this._refreshController=i}_cancelRefresh(){this._refreshController&&(this._refreshController.abort(),this._refreshController=null)}};y([w({readOnly:!0})],Vg.prototype,"_spatialReferenceTask",null),y([w()],Vg.prototype,"basemap",null),y([w()],Vg.prototype,"compatibilityFunction",void 0),y([w({readOnly:!0})],Vg.prototype,"error",void 0),y([w({readOnly:!0})],Vg.prototype,"spatialReference",null),y([w({readOnly:!0})],Vg.prototype,"state",void 0),y([w()],Vg.prototype,"view",void 0),Vg=y([Z("esri.widgets.BasemapGallery.support.BasemapGalleryItem")],Vg);const iUe=Vg,rUe=it.ofType(Ay);let $I=class extends ze{constructor(e){super(e),this.basemaps=new rUe}destroy(){this.basemaps.forEach(e=>e.destroy())}get state(){return"ready"}refresh(){}};y([w({type:rUe})],$I.prototype,"basemaps",void 0),y([w({readOnly:!0})],$I.prototype,"state",null),$I=y([Z("esri.widgets.BasemapGallery.support.LocalBasemapsSource")],$I);const nUe=$I,sUe=it.ofType(Ay);let Bg=class extends jf.LoadableMixin(S9(nUe)){constructor(e){super(e),this._lastPortalBasemapFetchController=null,this.basemaps=new sUe,this.filterFunction=null,this.portal=os.getDefault(),this.query=null,this.updateBasemapsCallback=null,this.viewType=null}initialize(){this.addHandles([_e(()=>{var e,i,r;return[this.filterFunction,this.loadStatus,(e=this.portal)==null?void 0:e.basemapGalleryGroupQuery,(i=this.portal)==null?void 0:i.basemapGalleryGroupQuery3D,(r=this.portal)==null?void 0:r.user,this.query,this.updateBasemapsCallback]},()=>this.refresh(),ii)])}destroy(){this.filterFunction=null,this.portal=null,this.basemaps.forEach(e=>e.destroy())}get state(){return this.loadStatus==="not-loaded"?"not-loaded":this.loadStatus==="loading"||this._lastPortalBasemapFetchController?"loading":"ready"}load(e){return this.addResolvingPromise(this.portal.load(e)),Promise.resolve(this)}async refresh(){if(this.loadStatus!=="loaded")return;this._lastPortalBasemapFetchController&&(this._lastPortalBasemapFetchController.abort(),this._lastPortalBasemapFetchController=null);const e=this.portal,i=new AbortController;this._lastPortalBasemapFetchController=i,this.notifyChange("state");try{const r=await e.fetchBasemaps(this._toQueryString(this.query),{signal:i.signal,include3d:this.viewType==="3d"||void 0});await this._updateBasemaps(r)}catch(r){if(sn(r))throw r;Ce.getLogger(this).warn(new se("basemap-source:fetch-basemaps-error","Could not fetch basemaps from portal.",{error:r})),await this._updateBasemaps()}this._lastPortalBasemapFetchController=null,this.notifyChange("state")}_toQueryString(e){return e&&typeof e!="string"?Object.keys(e).map(i=>`${i}:${e[i]}`).join(" AND "):e}async _updateBasemaps(e=[]){let i=await this._filterBasemaps(e);i=this.updateBasemapsCallback?this.updateBasemapsCallback(i):i,this.basemaps.removeAll(),this.basemaps.addMany(i)}async _filterBasemaps(e){if(!this.filterFunction)return e;const i=e.map(this.filterFunction),r=await Promise.all(i);return e.filter((n,s)=>r[s])}};y([w({readOnly:!0,type:sUe})],Bg.prototype,"basemaps",void 0),y([w()],Bg.prototype,"filterFunction",void 0),y([w({type:os})],Bg.prototype,"portal",void 0),y([w()],Bg.prototype,"query",void 0),y([w({readOnly:!0})],Bg.prototype,"state",null),y([w()],Bg.prototype,"updateBasemapsCallback",void 0),y([w()],Bg.prototype,"viewType",void 0),Bg=y([Z("esri.widgets.BasemapGallery.support.PortalBasemapsSource")],Bg);const LI=Bg,oUe=it.ofType(iUe);function mFt(t){return t&&t.declaredClass==="esri.portal.Portal"}function gFt(t){return t&&!(t instanceof LI)&&(!!t.portal||!!t.query)}function yFt(t){return t&&"basemaps"in t&&"state"in t&&"refresh"in t}let Iu=class extends jf{constructor(e){super(e),this._loadingProjectionEngine=!1,this._originalActiveBasemap=null,this.includeCurrentBasemap=!1,this.items=new oUe,this.source=new LI,this.view=null}initialize(){const e=()=>this._recreateItems();this.addHandles([_e(()=>{var i;return[this.view,(i=this.view)==null?void 0:i.ready]},()=>{var i;(i=this.view)!=null&&i.ready&&(this._originalActiveBasemap=this.activeBasemap)},{initial:!0}),_e(()=>this.state==="ready"?this.compatibilityFunction:null,()=>this._updateItems()),_e(()=>[this._effectiveIncludeCurrentBasemap,this._originalActiveBasemap],e),Jr(()=>{var i;return(i=this.source)==null?void 0:i.basemaps},"change",e,{onListenerAdd:e}),Mo(()=>this.view,()=>{var i;this.source instanceof LI&&(this.source.viewType=(i=this.view)==null?void 0:i.type)},{once:!0})])}destroy(){var i;const e=this.source.basemaps.find(r=>r===this.activeBasemap);e&&this.source.basemaps.remove(e),(i=this.source)==null||i.destroy()}get _effectiveIncludeCurrentBasemap(){var e;return this.includeCurrentBasemap&&((e=this.source)==null?void 0:e.basemaps.every(i=>i.loadStatus!=="loading"))}get activeBasemap(){var e,i;return((i=(e=this.view)==null?void 0:e.map)==null?void 0:i.basemap)??null}set activeBasemap(e){var s,o;const i=this.view;if(!(i!=null&&i.map))return;const r=typeof e=="string"?Ay.fromId(e):e;if(!r||!i.ready)return i.map.basemap=r,void this._clearOverride("activeBasemap");const n=r.spatialReference||((o=(s=this.items)==null?void 0:s.find(l=>this.basemapEquals(r,l.basemap)))==null?void 0:o.spatialReference);if(n&&"spatialReferenceLocked"in i&&!i.spatialReferenceLocked){const l=i.spatialReference;if(n!=null&&!Zn(l,n)&&!th(i.spatialReference,n)&&!ox())return this._override("activeBasemap",r),this._loadingProjectionEngine=!0,void g_().then(()=>{this._get("activeBasemap")===e&&(i.map.basemap=e,i.spatialReference=n,this._clearOverride("activeBasemap"))},()=>{}).then(()=>{this._loadingProjectionEngine=!1});i.map.basemap=r,this._clearOverride("activeBasemap"),n==null||Zn(i.spatialReference,n)||(i.spatialReference=n)}else i.map.basemap=r,this._clearOverride("activeBasemap")}get activeBasemapIndex(){const{state:e,activeBasemap:i}=this;return e!=="ready"?-1:this._findBasemapIndex(i)}get compatibilityFunction(){var e;return((e=this.view)==null?void 0:e.type)==="3d"?cFt:uFt}set compatibilityFunction(e){this._overrideIfSome("compatibilityFunction",e)}castSource(e){return Array.isArray(e)||it.isCollection(e)?new nUe({basemaps:e}):mFt(e)?new LI({portal:e}):gFt(e)?new LI(e):yFt(e)?e:null}get state(){var e;return(e=this.view)!=null&&e.ready&&this.source?this._loadingProjectionEngine?"loading":"ready":"disabled"}basemapEquals(e,i){return Udt(e,i)}refresh(){this._recreateItems()}load(e){return this.addResolvingPromise(jf.isLoadable(this.source)?this.source.load(e):null),Promise.resolve(this)}_findBasemapIndex(e){const{items:i}=this,r=i.findIndex(n=>n.basemap===e);return r===-1?i.findIndex(n=>this.basemapEquals(n.basemap,e)):r}_recreateItems(){var l;const e=(l=this.source)==null?void 0:l.basemaps,{view:i,compatibilityFunction:r}=this,n=new Map(this.items.map(c=>[c.basemap,c]));function s(c){const f=n.get(c);return f?(n.delete(c),f):new iUe({basemap:c,compatibilityFunction:r,view:i})}this.items.removeAll(),e&&this.items.addMany(e.map(s));const o=this._findBasemapIndex(this._originalActiveBasemap)!==-1;this._effectiveIncludeCurrentBasemap&&!o&&this._originalActiveBasemap!=null&&this.items.unshift(s(this._originalActiveBasemap)),n.forEach(c=>c.destroy())}_updateItems(){for(const e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};y([w()],Iu.prototype,"_effectiveIncludeCurrentBasemap",null),y([w()],Iu.prototype,"_loadingProjectionEngine",void 0),y([w()],Iu.prototype,"_originalActiveBasemap",void 0),y([w()],Iu.prototype,"activeBasemap",null),y([w({readOnly:!0})],Iu.prototype,"activeBasemapIndex",null),y([w()],Iu.prototype,"compatibilityFunction",null),y([w()],Iu.prototype,"includeCurrentBasemap",void 0),y([w({readOnly:!0,type:oUe})],Iu.prototype,"items",void 0),y([w()],Iu.prototype,"source",void 0),y([Ci("source")],Iu.prototype,"castSource",null),y([w({readOnly:!0})],Iu.prototype,"state",null),y([w()],Iu.prototype,"view",void 0),Iu=y([Z("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],Iu);const vFt=Iu,Ad="esri-basemap-gallery",gh={base:Ad,widgetIcon:si.basemap,sourceLoading:`${Ad}--source-loading`,layoutGrid:`${Ad}--grid`,narrowItems:`${Ad}--narrow-items`,loader:`${Ad}__loader`,item:`${Ad}__item`,itemContainer:`${Ad}__item-container`,itemContent:`${Ad}__item-content`,itemTitle:`${Ad}__item-title`,itemTagsContainer:`${Ad}__item-tags-container`,itemThumbnail:`${Ad}__item-thumbnail`,selectedItem:`${Ad}__item--selected`,itemError:`${Ad}__item--error`};function Im({level:t,class:e,...i},r){const n=aUe(t);return X(`h${n}`,{...i,"aria-level":String(n),class:GS(tt.heading,e),role:"heading"},r)}function aUe(t){return Je(Math.ceil(t),1,6)}function _Ft(t,e=1){return aUe(t+e)}const fX={small:200,default:280,wide:420};let oc=class extends cn{constructor(e,i){super(e,i),this.disabled=!1,this.headingLevel=2,this.iconClass=gh.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new vFt,this._focusBasemapItemEnabled=!1,this._container=null,this._width=0,this._onContainerCreated=r=>{this._container=r}}initialize(){this.addHandles([aB(()=>this._container,({contentRect:e})=>{this._width=e.width}),Mo(()=>this.source,()=>this.viewModel.load(),{sync:!0,initial:!0,once:!0})])}loadDependencies(){return Pl({scrim:()=>we(()=>import("./calcite-scrim-iUD6Tmec.js"),__vite__mapDeps([256,257,240,241,242,244,246,247])),chip:()=>we(()=>import("./calcite-chip-MkTbFpRn.js"),__vite__mapDeps([258,259,242,239,244,240,241,237,243,245]))})}get activeBasemap(){return this.viewModel.activeBasemap}set activeBasemap(e){this.viewModel.activeBasemap=e}get includeCurrentBasemap(){return this.viewModel.includeCurrentBasemap}set includeCurrentBasemap(e){this.viewModel.includeCurrentBasemap=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get source(){return this.viewModel.source}set source(e){this.viewModel.source=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e=this.source.state==="loading",i=this.disabled||this.viewModel.state==="disabled",r=this.viewModel.items,n={[gh.sourceLoading]:e,[tt.disabled]:i},s=this._width;s<=fX.small||s>=fX.wide?n[gh.layoutGrid]=!0:s0?X("ul",{"aria-disabled":this.disabled,"aria-label":this.label,bind:this,class:gh.itemContainer,key:"item-container",onkeydown:this._handleKeyDown,role:"radiogroup"},r.map((c,f)=>this._renderBasemapGalleryItem(c,f)).toArray()):X("div",{class:tt.empty,key:"empty-message"},X(Im,{level:this.headingLevel},this.messages.noBasemaps));return X("div",{afterCreate:this._onContainerCreated,class:this.classes(gh.base,tt.widget,tt.panelHeightOnly,n),key:"container"},this._width===0?null:[o,l])}_getRoundRobinIndex(e,i){return(e+i)%i}_handleKeyDown(e){const{key:i}=e;if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(i))return;e.preventDefault();const{items:r,activeBasemapIndex:n}=this.viewModel,s=i==="ArrowUp"||i==="ArrowLeft"?this._getRoundRobinIndex(Math.max(n-1,-1),r.length):this._getRoundRobinIndex(n+1,r.length),o=r.at(s);(o==null?void 0:o.state)==="ready"&&(this.viewModel.activeBasemap=o.basemap),this._focusBasemapItemEnabled=!0}_focusBasemapItem(e){this._focusBasemapItemEnabled&&e.tabIndex===0&&(e.focus(),this._focusBasemapItemEnabled=!1)}_handleClick(e){const i=e.currentTarget["data-item"];i.state==="ready"&&(this.viewModel.activeBasemap=i.basemap)}_renderBasemapGalleryItem(e,i){var I,L;const r=Hdt(e.basemap)||Wr("esri/themes/base/images/basemap-toggle-64.svg"),n=e.basemap.title,s=(I=e.basemap.portalItem)==null?void 0:I.snippet,o=((L=e.error)==null?void 0:L.message)||s||n,{viewModel:{state:l,activeBasemapIndex:c}}=this,f=this.disabled||l==="disabled",_=c===i,x=_||c===-1&&i===0?0:-1,T=l==="loading",A={[gh.selectedItem]:_,[gh.itemError]:e.state==="error"},M=`basemapgallery-item-${e.uid}`;return X("li",{afterUpdate:this._focusBasemapItem,"aria-checked":_.toString(),"aria-disabled":f.toString(),"aria-labelledby":M,bind:this,class:this.classes(gh.item,A),"data-item":e,key:e.uid,onclick:this._handleClick,onkeydown:this._handleClick,role:"radio",tabIndex:x,title:o},X("img",{alt:"",class:gh.itemThumbnail,src:r}),X("div",{class:gh.itemContent,key:"content"},X("div",{class:gh.itemTitle,key:"title"},X("span",{id:M},n)),Ndt(e.basemap)?this._renderTags(e.basemap):null),e.state==="loading"||_&&T?X("calcite-scrim",null,X("span",{"aria-hidden":"true",class:tt.loaderAnimation,key:"loader",role:"presentation"})):null)}_renderTags(e){return X("div",{class:gh.itemTagsContainer,key:"tag"},this._render3DTag(),Fdt(e)?this._renderBetaTag():null)}_render3DTag(){const{messages:e}=this;return X("calcite-chip",{key:"tag-3d",scale:"s",value:e.tag3D},this.messages.tag3D)}_renderBetaTag(){const{messages:e}=this;return X("calcite-chip",{appearance:"outline-fill",key:"tag-beta",scale:"s",value:e.tagBeta},this.messages.tagBeta)}};y([w()],oc.prototype,"activeBasemap",null),y([w()],oc.prototype,"disabled",void 0),y([w()],oc.prototype,"headingLevel",void 0),y([w()],oc.prototype,"iconClass",void 0),y([w()],oc.prototype,"icon",void 0),y([w()],oc.prototype,"label",null),y([w(),Gr("esri/widgets/BasemapGallery/t9n/BasemapGallery")],oc.prototype,"messages",void 0),y([w()],oc.prototype,"source",null),y([w()],oc.prototype,"view",null),y([w()],oc.prototype,"viewModel",void 0),y([w()],oc.prototype,"_focusBasemapItemEnabled",void 0),y([w()],oc.prototype,"_container",void 0),y([w()],oc.prototype,"_width",void 0),y([bo()],oc.prototype,"_handleClick",null),oc=y([Z("esri.widgets.BasemapGallery")],oc);const bFt=oc,kn="esri-slider",Nr={base:kn,widgetIcon:si.edit,reversed:`${kn}--reversed`,horizontalLayout:`${kn}--horizontal`,verticalLayout:`${kn}--vertical`,contentElement:`${kn}__content`,extraContentElement:`${kn}__extra-content`,trackElement:`${kn}__track`,ticksContainerElement:`${kn}__ticks`,tickElement:`${kn}__tick`,tickLabelElement:`${kn}__tick-label`,maxElement:`${kn}__max`,minElement:`${kn}__min`,maxElementInteractive:`${kn}__max--interactive`,minElementInteractive:`${kn}__min--interactive`,rangeElementActive:`${kn}__range--active`,rangeInput:`${kn}__range-input`,anchorElement:`${kn}__anchor`,movingAnchorElement:`${kn}__anchor--moving`,lastMovedAnchorElement:`${kn}__anchor--moved`,anchorElementActive:`${kn}__anchor--active`,anchorElementIndexPrefix:`${kn}__anchor-`,segmentElement:`${kn}__segment`,segmentElementIndexPrefix:`${kn}__segment-`,segmentElementInteractive:`${kn}__segment--interactive`,segmentElementActive:`${kn}__segment--active`,effectiveSegmentElement:`${kn}__effective-segment`,effectiveMaxSegmentElement:`${kn}__effective-max-segment`,effectiveMinSegmentElement:`${kn}__effective-min-segment`,thumbElement:`${kn}__thumb`,labelElement:`${kn}__label`,labelElementInteractive:`${kn}__label--interactive`,labelInput:`${kn}__label-input`};let $u=class extends ze{constructor(e){super(e),this.precision=4,this.thumbsConstrained=!0}set effectiveMax(e){this.setEffectiveMax(e)}set effectiveMin(e){this.setEffectiveMin(e)}set labelFormatFunction(e){this._set("labelFormatFunction",e)}set inputFormatFunction(e){this._set("inputFormatFunction",e)}set inputParseFunction(e){this._set("inputParseFunction",e)}get labels(){const{max:e,min:i,values:r}=this,n=r!=null&&r.length?r.map((s,o)=>this.getLabelForValue(s,"value",o)):[];return{max:this.getLabelForValue(e,"max"),min:this.getLabelForValue(i,"min"),values:n}}set max(e){this.setMax(e)}set min(e){this.setMin(e)}get state(){const{max:e,min:i}=this;return e!=null&&i!=null&&e>i?"ready":"disabled"}set values(e){const{max:i,min:r}=this,n=this.values;n&&e&&n.length===e.length&&n.every((s,o)=>s===e[o])||(this._set("values",null),e!=null&&e.length&&(r!=null&&e.some(s=>ss>i)&&(this.max=Math.max(...e))),this._set("values",e))}toPrecision(e){return parseFloat(e.toFixed(this.precision))}defaultLabelFormatFunction(e){const{max:i,min:r,precision:n}=this,s=i!=null&&r!=null&&i-r>10?2:n;return parseFloat(e.toFixed(s)).toString()}defaultInputFormatFunction(e){return e.toString()}defaultInputParseFunction(e){return parseFloat(e)}getBounds(){const{effectiveMax:e,effectiveMin:i,max:r,min:n}=this;return{min:i!=null&&n!=null?Math.max(n,i):n,max:e!=null&&r!=null?Math.min(r,e):r}}getBoundsForValueAtIndex(e){const{thumbsConstrained:i,values:r}=this,{min:n,max:s}=this.getBounds();if(i&&r){const o=e-1,l=e+1;return{min:r[o]!=null?r[o]:n,max:r[l]!=null?r[l]:s}}return{min:n,max:s}}getLabelForValue(e,i,r){return e==null?null:this.labelFormatFunction?this.labelFormatFunction(e,i,r):this.defaultLabelFormatFunction(e)}setMax(e){const{max:i,values:r}=this;if(e==null)return void this._set("max",null);if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for property 'max' is NaN.");const n=this.toPrecision(e);if(i!==n&&(this._set("max",n),r==null?void 0:r.length))for(let s=0;sr[s]&&this.setValue(s,n)}setEffectiveMax(e){if(e==null)return void this._set("effectiveMax",null);if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for property 'effectiveMax' is NaN.");const i=this.toPrecision(e);this.effectiveMax!==i&&this._set("effectiveMax",this._applyBoundsToValue(i))}setEffectiveMin(e){if(e==null)return void this._set("effectiveMin",null);if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for property 'effectiveMin' is NaN.");const i=this.toPrecision(e);this.effectiveMin!==i&&this._set("effectiveMin",this._applyBoundsToValue(i))}setValue(e,i){if(isNaN(i))return void this._logError("slider:invalid-value","Supplied value for member of property 'values' is NaN.");const{values:r}=this;if(r==null)return void this._logError("slider:invalid-value","Supplied value for member of property 'values' is null.");const n=r[e],s=this.toPrecision(i);if(n===s)return;const o=[...r];o[e]=s,this._set("values",o),this.notifyChange("labels")}_applyBoundsToValue(e){const{max:i,min:r}=this;return r!=null&&ei?i:e}_logError(e,i,r){Ce.getLogger(this).error(new se(e,i,r))}};y([w()],$u.prototype,"effectiveMax",null),y([w()],$u.prototype,"effectiveMin",null),y([w()],$u.prototype,"labelFormatFunction",null),y([w()],$u.prototype,"inputFormatFunction",null),y([w()],$u.prototype,"inputParseFunction",null),y([w({readOnly:!0})],$u.prototype,"labels",null),y([w()],$u.prototype,"max",null),y([w()],$u.prototype,"min",null),y([w()],$u.prototype,"precision",void 0),y([w({readOnly:!0})],$u.prototype,"state",null),y([w()],$u.prototype,"thumbsConstrained",void 0),y([w()],$u.prototype,"values",null),$u=y([Z("esri.widgets.Slider.SliderViewModel")],$u);const lUe=$u,yh={showInput:"Enter",hideInput1:"Enter",hideInput2:"Escape",hideInput3:"Tab",moveAnchorUp:"ArrowUp",moveAnchorDown:"ArrowDown",moveAnchorLeft:"ArrowLeft",moveAnchorRight:"ArrowRight",moveAnchorToMax:"End",moveAnchorToMin:"Home"},D2e={labels:!1,rangeLabels:!1};let kr=class extends cn{constructor(e,i){super(e,i),this._activeLabelInputIndex=null,this._anchorElements=[],this._dragged=!1,this._dragStartInfo=null,this._focusedAnchorIndex=null,this._isMinInputActive=!1,this._isMaxInputActive=!1,this._lastMovedHandleIndex=null,this._positionPrecision=5,this._segmentDragStartInfo=null,this._trackHeight=null,this._trackWidth=null,this._zIndices=[],this._zIndexOffset=3,this.disabled=!1,this.draggableSegmentsEnabled=!0,this.effectiveSegmentElements=new it,this.extraNodes=[],this.inputCreatedFunction=null,this.labelElements=new it,this.labelInputsEnabled=!1,this.maxLabelElement=null,this.messages=null,this.minLabelElement=null,this.rangeLabelInputsEnabled=!1,this.segmentElements=new it,this.snapOnClickEnabled=!0,this.steps=null,this.syncedSegmentsEnabled=!1,this.thumbCreatedFunction=null,this.thumbElements=new it,this.tickElements=new it,this.trackElement=null,this.viewModel=new lUe,this.visibleElements={...D2e},this._onAnchorPointerDown=this._onAnchorPointerDown.bind(this),this._onAnchorPointerMove=this._onAnchorPointerMove.bind(this),this._onAnchorPointerUp=this._onAnchorPointerUp.bind(this),this._onLabelPointerDown=this._onLabelPointerDown.bind(this),this._onLabelPointerUp=this._onLabelPointerUp.bind(this),this._onSegmentPointerDown=this._onSegmentPointerDown.bind(this),this._onSegmentPointerMove=this._onSegmentPointerMove.bind(this),this._onSegmentPointerUp=this._onSegmentPointerUp.bind(this),this._onTrackPointerDown=this._onTrackPointerDown.bind(this),this._onTrackPointerMove=this._onTrackPointerMove.bind(this),this._onTrackPointerUp=this._onTrackPointerUp.bind(this)}destroy(){document.removeEventListener("pointerup",this._onLabelPointerUp),document.removeEventListener("pointermove",this._onLabelPointerMove),document.removeEventListener("pointerup",this._onAnchorPointerUp),document.removeEventListener("pointermove",this._onAnchorPointerMove),this.labelElements.removeAll(),this.labelElements.destroy(),this.segmentElements.removeAll(),this.segmentElements.destroy(),this.effectiveSegmentElements.removeAll(),this.effectiveSegmentElements.destroy(),this.thumbElements.removeAll(),this.thumbElements.destroy(),this.tickElements.removeAll(),this.tickElements.destroy()}get effectiveMax(){return this.viewModel.effectiveMax}set effectiveMax(e){this.viewModel.effectiveMax=e}get effectiveMin(){return this.viewModel.effectiveMin}set effectiveMin(e){this.viewModel.effectiveMin=e}get inputFormatFunction(){return this.viewModel.inputFormatFunction}set inputFormatFunction(e){this.viewModel.inputFormatFunction=e}get inputParseFunction(){return this.viewModel.inputParseFunction}set inputParseFunction(e){this.viewModel.inputParseFunction=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get labelFormatFunction(){return this.viewModel.labelFormatFunction}set labelFormatFunction(e){this.viewModel.labelFormatFunction=e}get labels(){return this.viewModel.labels}set layout(e){["vertical","vertical-reversed","horizontal","horizontal-reversed"].includes(e)||(e="horizontal"),this._set("layout",e)}get max(){return this.viewModel.max}set max(e){this.viewModel.max=e}get min(){return this.viewModel.min}set min(e){this.viewModel.min=e}get precision(){return this.viewModel.precision}set precision(e){this.viewModel.precision=e}get state(){const{_activeLabelInputIndex:e,_isMaxInputActive:i,_isMinInputActive:r,_dragStartInfo:n,_segmentDragStartInfo:s,disabled:o,viewModel:l}=this;return o?"disabled":e===null&&!i&&!r?n!=null||s!=null?"dragging":l.state:"editing"}get thumbsConstrained(){return this.viewModel.thumbsConstrained}set thumbsConstrained(e){this.viewModel.thumbsConstrained=e}set tickConfigs(e){this._set("tickConfigs",e),this.scheduleRender()}get values(){return this.viewModel.values}set values(e){this.viewModel.values=e}castVisibleElements(e){return{...D2e,...e}}render(){const{label:e}=this,i=this.classes(Nr.base,tt.widget,this._isHorizontalLayout()?Nr.horizontalLayout:Nr.verticalLayout,this._isReversedLayout()?Nr.reversed:null,this._isDisabled()?tt.disabled:null);return this._storeTrackDimensions(),X("div",{afterCreate:this._afterContainerCreate,"aria-label":e,bind:this,class:i,"touch-action":"none"},this._renderContent())}toNextStep(e){this._toStep(e,1)}toPreviousStep(e){this._toStep(e,-1)}getCurrentPosition(){var e;return this._positionFromValue(((e=this.values)==null?void 0:e[0])??0)}_renderContent(){const{max:e,min:i}=this;if(!(i==null||e==null||i>=e))return[this._renderMin(),this._renderSliderContainer(),this._renderMax()]}_renderSliderContainer(){return X("div",{bind:this,class:Nr.contentElement,key:"slider-container"},this._renderTrackElement(),this._renderTicksContainer(),this._renderExtraContentElements())}_renderTrackElement(){return X("div",{afterCreate:this._afterTrackCreate,afterRemoved:this._afterTrackRemoved,bind:this,class:Nr.trackElement,"touch-action":"none"},this._renderEffectiveSegmentElements(),this._renderSegmentElements(),this._renderAnchorElements())}_renderEffectiveSegmentElements(){var c;if(!this.trackElement||!((c=this.values)!=null&&c.length))return;const e=this.effectiveMax!=null,i=this.effectiveMin!=null;if(!e&&!i)return;const{max:r,min:n,viewModel:s}=this,o=s.getBounds(),l=[];return i&&l.push(this._renderEffectiveSegmentElement(n,o.min,!0)),e&&l.push(this._renderEffectiveSegmentElement(o.max,r,!1)),l}_renderSegmentElements(){var r;if(!this.trackElement||!((r=this.values)!=null&&r.length))return;const e=this.values.length,i=[];for(let n=0;n<=e;n++)i.push(this._renderSegmentElement(n));return i}_renderSegmentElement(e){const{_trackHeight:i,_trackWidth:r,draggableSegmentsEnabled:n,id:s,state:o}=this,l=this.values,c=this._isHorizontalLayout(),f=c?r:i,_=this.viewModel.getBounds(),x=this._positionFromValue(_.max),T=this._positionFromValue(_.min),A=e===(l==null?void 0:l.length)?null:e,M=e===0?null:e-1,I=A!=null,L=M!=null;let F,z;const k=[...l].sort((Q,ne)=>Q-ne);this._isReversedLayout()?(F=L?this._positionFromValue(k[M]):T,z=I?this._positionFromValue(k[A]):x):(F=I?this._positionFromValue(k[A]):x,z=L?this._positionFromValue(k[M]):T);const U=this._applyPrecisionToPosition(100*z/f),j=(F-z)/f,H=c?`transform: translate(${U}%, 0px) scale(${j}, 1);`:`transform: translate(0px, ${U}%) scale(1, ${j});`,Y=this.classes(Nr.segmentElement,Nr.segmentElementIndexPrefix+e,n&&I&&L&&o!=="disabled"?Nr.segmentElementInteractive:null);return X("div",{afterCreate:this._afterSegmentCreate,afterRemoved:this._afterSegmentRemoved,bind:this,class:Y,"data-max-thumb-index":A,"data-min-thumb-index":M,"data-segment-index":e,key:`${s}-segment-${e}`,style:H,"touch-action":"none"})}_renderEffectiveSegmentElement(e,i,r){const{_trackHeight:n,_trackWidth:s,layout:o}=this,l=this._positionFromValue(e),c=this._positionFromValue(i),f=this._isHorizontalLayout(),_=f?s:n,x=this._applyPrecisionToPosition(100*l/_);let T=null;if(o==="horizontal"){const I=r?_-c:c,L=l===_?0:x;T=`clip-path: inset(0% ${c===_?0:this._applyPrecisionToPosition(I/_*100)}% 0% ${L}%);`}else{const I=(c-l)/_;T=f?`transform: translate(${x}%, 0px) scale(${I}, 1);`:`transform: translate(0px, ${x}%) scale(1, ${I});`}const A=r?Nr.effectiveMinSegmentElement:Nr.effectiveMaxSegmentElement,M=this.classes(Nr.segmentElement,Nr.effectiveSegmentElement,A);return X("div",{afterCreate:this._afterEffectiveSegmentCreate,afterRemoved:this._afterEffectiveSegmentRemoved,bind:this,class:M,style:T,"touch-action":"none"})}_renderAnchorElements(){const{trackElement:e,values:i}=this;if(i!=null&&i.length)return this._zIndices=i.map((r,n)=>{const s=this._positionFromValue(r),o=this._positionToPercent(s),l=(this._isHorizontalLayout()?o>50:o<50)?-1:1;return this._zIndexOffset+(i.length+l*n)}),e&&i&&i.length?i.map((r,n)=>this._renderAnchorElement(r,n)):null}_renderAnchorElement(e,i){const r=this._positionFromValue(e),n=this._valueFromPosition(r);if(n==null||isNaN(n))return;const{_dragStartInfo:s,_lastMovedHandleIndex:o,id:l,layout:c,visibleElements:{labels:f}}=this,_=this.values,x=s&&s.index===i,T=o===i,A=this.classes(Nr.anchorElement,Nr.anchorElementIndexPrefix+i,x?Nr.movingAnchorElement:null,T?Nr.lastMovedAnchorElement:null),M=this.labels.values[i],I=this._getStyleForAnchor(e,i,x||T),{min:L,max:F}=this.viewModel.getBoundsForValueAtIndex(i),{disabled:z,messages:k}=this,U=_.length===2?By(i===0?k.rangeMinimum:k.rangeMaximum,{value:e}):M,j=_.length===1?null:i===0?`${l}-handle-${i+1}`:i===_.length-1?`${l}-handle-${i-1}`:`${l}-handle-${i-1} ${l}-handle-${i+1}`;return X("div",{afterCreate:this._afterAnchorCreate,afterRemoved:this._afterAnchorRemoved,afterUpdate:this._afterAnchorUpdate,"aria-controls":j,"aria-label":k.sliderValue,"aria-labelledby":f?`${l}-label-${i}`:null,"aria-orientation":c,"aria-valuemax":F==null?void 0:F.toString(),"aria-valuemin":L==null?void 0:L.toString(),"aria-valuenow":e.toString(),"aria-valuetext":U,bind:this,class:A,"data-thumb-index":i,"data-value":e,id:`${l}-handle-${i}`,key:`${l}-handle-${i}`,onkeydown:this._onAnchorKeyDown,role:"slider",style:I,tabIndex:z?-1:0,"touch-action":"none"},X("span",{afterCreate:this._afterThumbCreate,afterRemoved:this._afterThumbRemoved,bind:this,class:Nr.thumbElement,"data-thumb-index":i,"touch-action":"none"}),this.renderThumbLabel(i))}renderThumbLabel(e){const{id:i,labels:r,labelInputsEnabled:n,state:s}=this,o=this.visibleElements.labels,l=r.values[e],c=this.classes(Nr.labelElement,o?null:tt.hidden,n&&s!=="disabled"?Nr.labelElementInteractive:null);return X("span",{afterCreate:this._afterLabelCreate,afterRemoved:this._afterLabelRemoved,"aria-hidden":(!o).toString(),bind:this,class:c,"data-thumb-index":e,id:`${i}-label-${e}`,key:`${i}-label-${e}`,role:n?"button":null,"touch-action":"none"},this._activeLabelInputIndex===e?this._renderValueInput(e):l)}_renderValueInput(e){const{disabled:i,values:r}=this;if(r==null)return;const n=r[e];return X("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.sliderValue,bind:this,class:Nr.labelInput,"data-input-index":e,"data-input-type":"thumb",key:`value-input-${e}`,onblur:this._onLabelInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:i?-1:0,type:"text",value:this._formatInputValue(n,"value",e)})}_renderMax(){const{_isMaxInputActive:e,labels:i,rangeLabelInputsEnabled:r,state:n}=this,s=this.visibleElements.rangeLabels,o=this.classes(Nr.maxElement,{[tt.hidden]:!s,[Nr.maxElementInteractive]:r&&n!=="disabled",[Nr.rangeElementActive]:e});return X("div",{afterCreate:this._afterMaxLabelCreate,"aria-hidden":(!s).toString(),bind:this,class:o,onclick:this._onMaxLabelClick,onkeydown:this._onMaxLabelKeyDown,role:r?"button":null,tabIndex:!this.disabled&&r?0:-1},e?this._renderMaxInput():i.max)}_renderMin(){const{_isMinInputActive:e,labels:i,rangeLabelInputsEnabled:r,state:n}=this,s=this.visibleElements.rangeLabels,o=this.classes(Nr.minElement,{[tt.hidden]:!s,[Nr.minElementInteractive]:r&&n!=="disabled",[Nr.rangeElementActive]:e});return X("div",{afterCreate:this._afterMinLabelCreate,"aria-hidden":(!s).toString(),bind:this,class:o,onclick:this._onMinLabelClick,onkeydown:this._onMinLabelKeyDown,role:r?"button":null,tabIndex:!this.disabled&&r?0:-1},e?this._renderMinInput():i.min)}_renderMaxInput(){return X("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.maximumValue,bind:this,class:Nr.rangeInput,"data-input-type":"max",onblur:this._onMaxInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:this.disabled?-1:0,type:"text",value:this._formatInputValue(this.max,"max")})}_renderMinInput(){return X("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.minimumValue,bind:this,class:Nr.rangeInput,"data-input-type":"min",onblur:this._onMinInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:this.disabled?-1:0,type:"text",value:this._formatInputValue(this.min,"min")})}_renderExtraContentElements(){return X("div",{bind:this,class:Nr.extraContentElement},this.extraNodes)}_renderTicksContainer(){if(this.tickConfigs&&this.trackElement&&(this._trackHeight!==0||this._trackWidth!==0))return this.tickConfigs.map((e,i)=>X("div",{class:this.classes(Nr.ticksContainerElement),key:"ticks-container"},this._renderTicks(e,i)))}_renderTicks(e,i){const{mode:r,values:n}=e;if(this.tickElements.at(i)||this.tickElements.add(new it,i),r==="position"){const l=Array.isArray(n)?n:[n];return this._calculateTickPositions(l).map((c,f)=>this._renderTickGroup(e,f,i,c))}if(r==="percent"&&Array.isArray(n)){const l=this.min??0,c=(this.max??0)-l,f=n.map(_=>this._applyPrecisionToPosition(_/100*c+l));return this._calculateTickPositions(f).map((_,x)=>this._renderTickGroup(e,x,i,_))}const s=Array.isArray(n)&&n.length?n[0]:isNaN(n)?null:n,o=this._getTickCounts(s,e);return this._calculateEquidistantTickPositions(o).map((l,c)=>this._renderTickGroup(e,c,i,l))}_renderTickGroup(e,i,r,n){const s=e.mode==="position"?Array.isArray(e.values)?e.values[i]:e.values:this._valueFromPosition(n);if(s!=null&&!isNaN(s))return X("div",{afterCreate:this._afterTickGroupCreate,afterRemoved:this._afterTickGroupRemoved,bind:this,"data-config":e,"data-position":n,"data-tick-config-index":r,"data-tick-group-index":i,"data-value":s,key:`tick-group-${i}`,onclick:this._onTickGroupClick},this._renderTickLine(e,i,r,s),e.labelsVisible?this._renderTickLabel(e,i,r,s):null)}_renderTickLine(e,i,r,n){return X("div",{afterCreate:this._afterTickLineCreate,"aria-valuenow":n.toString(),bind:this,class:Nr.tickElement,"data-config":e,"data-tick-config-index":r,"data-tick-group-index":i,"data-value":n,key:`tick-label-${i}`,style:this._getPositionStyleForElement(n)})}_renderTickLabel(e,i,r,n){const s=e.labelFormatFunction?e.labelFormatFunction(n,"tick",i):this.viewModel.getLabelForValue(n,"tick",i);return X("div",{afterCreate:this._afterTickLabelCreate,"aria-label":s,"aria-valuenow":n.toString(),"aria-valuetext":s,bind:this,class:Nr.tickLabelElement,"data-config":e,"data-tick-config-index":r,"data-tick-group-index":i,"data-value":n,key:`tick-label-${i}`,style:`transform: translate(-50%); ${this._getPositionStyleForElement(n)}`},s)}_afterContainerCreate(e){this.addHandles(aB(e,()=>this.scheduleRender()))}_afterTrackCreate(e){this._set("trackElement",e),e.addEventListener("pointerdown",this._onTrackPointerDown),this.scheduleRender()}_afterTrackRemoved(e){e.removeEventListener("pointerdown",this._onTrackPointerDown),document.removeEventListener("pointermove",this._onTrackPointerMove),document.removeEventListener("pointerup",this._onTrackPointerUp)}_afterSegmentCreate(e){this.segmentElements.add(e),e.addEventListener("pointerdown",this._onSegmentPointerDown)}_afterSegmentRemoved(e){this.segmentElements.remove(e),e.removeEventListener("pointerdown",this._onSegmentPointerDown)}_afterEffectiveSegmentCreate(e){this.effectiveSegmentElements.add(e)}_afterEffectiveSegmentRemoved(e){this.effectiveSegmentElements.remove(e)}_afterAnchorCreate(e){if(this._anchorElements.push(e),e.addEventListener("pointerdown",this._onAnchorPointerDown),this.thumbCreatedFunction){const i=kR(e),r=mX(e),n=this.thumbElements.at(i),s=this.labelElements.at(i)||null;this.thumbCreatedFunction(i,r,n,s)}}_afterAnchorUpdate(e){this._focusedAnchorIndex!=null&&kR(e)===this._focusedAnchorIndex&&(e.focus(),this._focusedAnchorIndex=null)}_afterAnchorRemoved(e){const i=this._anchorElements.indexOf(e,0);i>-1&&this._anchorElements.splice(i,1),e.removeEventListener("pointerdown",this._onAnchorPointerDown)}_afterThumbCreate(e){this.thumbElements.add(e)}_afterThumbRemoved(e){this.thumbElements.remove(e)}_afterLabelCreate(e){this.labelElements.add(e),e.addEventListener("pointerdown",this._onLabelPointerDown),e.addEventListener("pointerup",this._onLabelPointerUp)}_afterLabelRemoved(e){this.labelElements.remove(e),e.removeEventListener("pointerdown",this._onLabelPointerDown),e.removeEventListener("pointerup",this._onLabelPointerUp)}_afterInputCreate(e){if(e.focus(),e.select(),this.inputCreatedFunction){const i=e.getAttribute("data-input-type"),r=i==="thumb"?wFt(e):null;this.inputCreatedFunction(e,i,r)}}_afterTickLineCreate(e){const i=zR(e),r=z8(e),n=this.tickElements.at(i),s=n.at(r);s?s.tickElement=e:n.add({groupElement:null,tickElement:e,labelElement:null},r)}_afterTickLabelCreate(e){const i=zR(e),r=z8(e),n=this.tickElements.at(i),s=n.at(r);s?s.labelElement=e:n.add({groupElement:null,labelElement:e,tickElement:null},r)}_afterTickGroupRemoved(e){const i=zR(e),r=this.tickElements.items[i],n=r==null?void 0:r.find(s=>s.groupElement===e);n&&r.remove(n)}_afterTickGroupCreate(e){var r,n;const i=N2e(e);if(i!=null&&i.tickCreatedFunction){const s=zR(e),o=z8(e),l=mX(e),c=(n=(r=this.tickElements)==null?void 0:r.at(s))==null?void 0:n.at(o);if(c){c.groupElement=e;const f=c.tickElement||null,_=c.labelElement||null;i.tickCreatedFunction(l,f,_)}}}_afterMaxLabelCreate(e){this._set("maxLabelElement",e)}_afterMinLabelCreate(e){this._set("minLabelElement",e)}_onAnchorKeyDown(e){if(this._isDisabled()||this.state==="editing")return;const{target:i}=e,r=Sf(e),n=this.values,s=kR(i),o=this._anchorElements[s],l=n[s],c=[yh.moveAnchorUp,yh.moveAnchorDown,yh.moveAnchorLeft,yh.moveAnchorRight];if(r===yh.showInput&&this.labelInputsEnabled)this._activeLabelInputIndex=s,this.notifyChange("state");else if(c.includes(r)){e.preventDefault();const{steps:f}=this,_=r===yh.moveAnchorUp||r===yh.moveAnchorRight?1:-1;if(f!=null)this._toStep(s,this._isReversedLayout()?-1*_:_);else{const{precision:T}=this,A=this._getPositionOfElement(o),M=this._valueFromPosition(A),I=this._isHorizontalLayout()?_:-1*_;let L;L=T===0?this._positionFromValue(M+I):T===1?this._positionFromValue(M+.1*I):A+I,this._toPosition(s,L)}const x=this.values[s];l!==x&&this._emitThumbChangeEvent({index:s,oldValue:l,value:x})}else if(r===yh.moveAnchorToMax||r===yh.moveAnchorToMin){e.preventDefault();const{min:f,max:_}=this._getAnchorBoundsInPixels(s),x=this._isPositionInverted()?r===yh.moveAnchorToMax?f:_:r===yh.moveAnchorToMin?f:_;this._toPosition(s,x);const T=this.values[s];l!==T&&this._emitThumbChangeEvent({index:s,oldValue:l,value:T})}}_onAnchorPointerDown(e){if(this._isDisabled())return;const{target:i,clientX:r,clientY:n}=e,s=kR(i);s!=null&&(e.preventDefault(),this._anchorElements[s]&&this._anchorElements[s].focus(),this._storeTrackDimensions(),this._dragStartInfo={clientX:r,clientY:n,index:s,position:this._getPositionOfElement(this._anchorElements[s])},this.notifyChange("state"),document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove))}_onAnchorPointerMove(e){if(this.state==="editing"||!this._dragStartInfo)return;e.preventDefault();const{values:i,_anchorElements:r,_dragged:n,_dragStartInfo:s,_dragStartInfo:{index:o,position:l}}=this,{clientX:c,clientY:f}=e,_=n?"drag":"start",x=r[o],T=this._getPositionOfElement(x),A=this._applyPrecisionToPosition(this._isHorizontalLayout()?l+c-s.clientX:l+f-s.clientY);if(T===A)return;const M=i[o];this._dragged=!0,this._toPosition(o,A);const I=this.values[o];n?M!==I&&this._emitThumbDragEvent({index:o,state:_,value:I}):this._emitThumbDragEvent({index:o,state:_,value:M})}_onAnchorPointerUp(e){if(document.removeEventListener("pointerup",this._onAnchorPointerUp),document.removeEventListener("pointermove",this._onAnchorPointerMove),!this._dragStartInfo)return;e.preventDefault();const{index:i}=this._dragStartInfo,r=this._dragged,n=this.values[i];this._dragged=!1,this._dragStartInfo=null,this._lastMovedHandleIndex=i,this.notifyChange("state"),r?this._emitThumbDragEvent({index:i,state:"stop",value:n}):(this.scheduleRender(),this.state!=="editing"&&this._emitThumbClickEvent({index:i,value:n}))}_onTrackPointerDown(e){const{_dragStartInfo:i,snapOnClickEnabled:r,state:n,values:s}=this;if(this._isDisabled()||n==="editing"||i||(document.addEventListener("pointermove",this._onTrackPointerMove),document.addEventListener("pointerup",this._onTrackPointerUp),!r||!(s!=null&&s.length)))return;const{steps:o}=this,{clientX:l,clientY:c}=e,f=this._getCursorPositionFromEvent(e),_=this._valueFromPosition(f),x=this._getIndexOfNearestValue(_),T=s[x],A=s.some((F,z)=>F===T&&z!==x)&&_>T?s.lastIndexOf(T):x;if(A==null)return;const M=s[A],I=o!=null?this._calculateNearestStepPosition(f):f;this._toPosition(A,I),this._dragged=!0,this._dragStartInfo={clientX:l,clientY:c,index:A,position:I},this._focusedAnchorIndex=A,this.notifyChange("state"),this._emitThumbDragEvent({index:A,state:"start",value:M});const L=this.values[A];M!==L&&this._emitThumbDragEvent({index:A,state:"drag",value:L}),document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove)}_onTrackPointerMove(e){e.preventDefault(),this._dragged=!0}_onTrackPointerUp(e){if(e.preventDefault(),document.removeEventListener("pointermove",this._onTrackPointerMove),document.removeEventListener("pointerup",this._onTrackPointerUp),this.snapOnClickEnabled||(this._dragged=!1),!this._dragged){const i=this._getCursorPositionFromEvent(e),r=this._valueFromPosition(i);this._emitTrackClickEvent({value:r})}}_onSegmentPointerDown(e){var c,f;e.preventDefault();const i=e.target,r=xFt(i),n=SFt(i),s=TFt(i);if(this._isDisabled()||n==null||s==null)return;e.stopPropagation(),this._storeTrackDimensions(),document.addEventListener("pointerup",this._onSegmentPointerUp);const o=this._getAnchorDetails(n),l=this._getAnchorDetails(s);this.syncedSegmentsEnabled?(this.segmentElements.forEach(_=>_.classList.add(Nr.segmentElementActive)),this._anchorElements.forEach(_=>_.classList.add(Nr.anchorElementActive))):(this.segmentElements.at(r).classList.add(Nr.segmentElementActive),(c=this._anchorElements[o.index])==null||c.classList.add(Nr.anchorElementActive),(f=this._anchorElements[l.index])==null||f.classList.add(Nr.anchorElementActive)),this._segmentDragStartInfo={cursorPosition:this._getCursorPositionFromEvent(e),index:r,details:this._normalizeSegmentDetails({min:o,max:l})},this.draggableSegmentsEnabled&&(document.addEventListener("pointermove",this._onSegmentPointerMove),this.notifyChange("state"),this._emitSegmentDragEvent({index:r,state:"start",thumbIndices:[n,s]}))}_onSegmentPointerMove(e){if(!this._segmentDragStartInfo)return;e.preventDefault();const{_trackHeight:i,_trackWidth:r,_segmentDragStartInfo:{index:n,cursorPosition:s,details:{min:o,max:l}}}=this,{index:c,position:f,value:_}=o,{index:x,position:T,value:A}=l;this._dragged=!0;const M=this._getCursorPositionFromEvent(e);if(M===s)return;const I=this._positionToPercent(s),L=this._positionToPercent(M)-I,F=this._positionToPercent(f)+L,z=this._positionToPercent(T)+L,{min:k}=this._getAnchorBoundsAsPercents(c),{max:U}=this._getAnchorBoundsAsPercents(x);let j=!1,H=!1;if(FU&&(H=!0),j){const{min:ye,max:pe}=this.viewModel.getBoundsForValueAtIndex(c),Ee=this._isPositionInverted()?pe:ye,te=Ee,le=A+(Ee-_),de=le-this.values[x];return void(this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(de):this._updateAnchorValues([c,x],[te,le]))}if(H){const{min:ye,max:pe}=this.viewModel.getBoundsForValueAtIndex(x),Ee=this._isPositionInverted()?ye:pe,te=Ee,le=_+(Ee-A),de=le-this.values[c];return void(this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(de):this._updateAnchorValues([c,x],[le,te]))}const Y=this._isHorizontalLayout()?r:i,Q=z/100*Y,ne=F/100*Y,re=this.values,he=[re[c],re[x]],ce=this._getValueForAnchorAtPosition(c,ne),be=this._getValueForAnchorAtPosition(x,Q);this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(ce-he[0]):this._updateAnchorValues([c,x],[ce,be]),[this.values[c],this.values[x]].every((ye,pe)=>ye===he[pe])||this._emitSegmentDragEvent({index:n,state:"drag",thumbIndices:[c,x]})}_onSegmentPointerUp(e){if(e.preventDefault(),document.removeEventListener("pointerup",this._onSegmentPointerUp),document.removeEventListener("pointermove",this._onSegmentPointerMove),!this._segmentDragStartInfo)return;const{_dragged:i}=this,r=this.min,n=this.max,s=this.values,{index:o,details:{min:{index:l},max:{index:c}}}=this._segmentDragStartInfo;if(this.segmentElements.forEach(f=>f.classList.remove(Nr.segmentElementActive)),this._anchorElements.forEach(f=>f.classList.remove(Nr.anchorElementActive)),this.draggableSegmentsEnabled){const f=n-r,_=s[l],x=s[c];this._lastMovedHandleIndex=_===x?_>f/2?l:c:null,this._dragged=!1,this._segmentDragStartInfo=null,this.notifyChange("state"),this._emitSegmentDragEvent({index:o,state:"stop",thumbIndices:[l,c]})}if(!i){const f=this._getCursorPositionFromEvent(e),_=this._valueFromPosition(f);this._emitSegmentClickEvent({index:o,value:_,thumbIndices:[l,c]})}}_onTickGroupClick(e){const i=e.target;if(N2e(i)){const r=zR(i),n=z8(i),s=mX(i);this._emitTickClickEvent({configIndex:r,groupIndex:n,value:s})}}_storeTrackDimensions(){if(this.trackElement){const e=this._getDimensions(this.trackElement);this._trackHeight=e.height,this._trackWidth=e.width}}_onLabelPointerDown(){this._isDisabled()||(this._dragged=!1,document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove))}_onLabelPointerMove(){this._isDisabled()||(this._dragged=!0)}_onLabelPointerUp(e){if(this._isDisabled())return;const i=kR(e.target);this.labelInputsEnabled&&!this._dragged&&i!=null&&(this._activeLabelInputIndex=i),this._dragged=!1,this.notifyChange("state"),document.removeEventListener("pointerup",this._onLabelPointerUp),document.removeEventListener("pointermove",this._onLabelPointerMove)}_onLabelInputBlur(e){const{_activeLabelInputIndex:i,values:r,viewModel:n}=this,s=e.target.value;if(this._activeLabelInputIndex=null,this.notifyChange("state"),!s||i==null||r==null)return;const o=this._parseInputValue(s,"value",i),l=r[i],{min:c,max:f}=this.viewModel.getBoundsForValueAtIndex(i);if(of)return;n.setValue(i,o);const _=this.values[i];l!==_&&this._emitThumbChangeEvent({index:i,oldValue:l,value:_})}_onInputKeyDown(e){var _;if(this._isDisabled())return;const{target:i}=e,r=Sf(e),{hideInput1:n,hideInput2:s,hideInput3:o}=yh,{_activeLabelInputIndex:l,_anchorElements:c}=this,f=i;if(r===n||r===s||r===o){e.stopPropagation();const x=l;f.blur(),x!=null?c[x].focus():(_=f.parentElement)==null||_.focus()}}_onMaxLabelClick(){this._isDisabled()||(this._emitRangeLabelClickEvent({type:"max-click",value:this.max}),this.rangeLabelInputsEnabled&&(this._isMaxInputActive=!0,this.notifyChange("state")))}_onMaxLabelKeyDown(e){this._isDisabled()||Sf(e)!==yh.showInput||(this._isMaxInputActive=!0,this.notifyChange("state"))}_onMaxInputBlur(e){const i=e.target.value;if(this._isMaxInputActive=!1,this.notifyChange("state"),!i)return;const r=this.max,n=this._parseInputValue(i,"max");n<=this.min||(this.viewModel.set("max",n),this.max!==r&&this._emitMaxChangeEvent({oldValue:r,value:this.max}))}_onMinLabelClick(){this._isDisabled()||(this._emitRangeLabelClickEvent({type:"min-click",value:this.min}),this.rangeLabelInputsEnabled&&(this._isMinInputActive=!0,this.notifyChange("state")))}_onMinLabelKeyDown(e){this._isDisabled()||Sf(e)!==yh.showInput||(this._isMinInputActive=!0,this.notifyChange("state"))}_onMinInputBlur(e){const i=e.target.value;if(this._isMinInputActive=!1,this.notifyChange("state"),!i)return;const r=this.min,n=this._parseInputValue(i,"min");n>=this.max||(this.viewModel.set("min",n),this.min!==r&&this._emitMinChangeEvent({oldValue:r,value:this.min}))}_isDisabled(){return this.disabled||this.state==="disabled"}_positionFromValue(e){const{_trackHeight:i,_trackWidth:r}=this,n=this.min??0,s=this.max??0,o=s-n;if(o===0||e==null)return 0;const l=this._isHorizontalLayout();let c=parseFloat(l?(r*(e-n)/o).toFixed(2):(i*(s-e)/o).toFixed(2));return this._isReversedLayout()&&(c=l?r-c:i-c),c}_valueFromPosition(e){const{_trackHeight:i,_trackWidth:r,precision:n}=this,s=this.min??0,o=this.max??0,l=o-s;let c=this._isHorizontalLayout()?e*l/r+s:l*(1e3-e/i*1e3)/1e3+s;return this._isReversedLayout()&&(c=o+s-c),parseFloat(c.toFixed(n))}_positionToPercent(e){const{_trackHeight:i,_trackWidth:r}=this,n=100*e/(this._isHorizontalLayout()?r:i);return this._applyPrecisionToPosition(n)}_applyPrecisionToPosition(e){return parseFloat(e.toFixed(this._positionPrecision))}_isPositionInverted(){const{layout:e}=this;return e==="horizontal-reversed"||e==="vertical"}_isHorizontalLayout(){return this.layout.includes("horizontal")}_isReversedLayout(){return this.layout.includes("reversed")}_normalizeSegmentDetails(e){if(this._isPositionInverted()){const{min:i,max:r}=e;return{min:r,max:i}}return e}_parseInputValue(e,i,r){return this.inputParseFunction?this.inputParseFunction(e,i,r):this.viewModel.defaultInputParseFunction(e)}_formatInputValue(e,i,r){return this.inputFormatFunction?this.inputFormatFunction(e,i,r):this.viewModel.defaultInputFormatFunction(e)}_getAnchorDetails(e){const i=this.values,r=[...i].sort((s,o)=>s-o)[e],n=i.indexOf(r);return{index:n,position:this._getPositionOfElement(this._anchorElements[n]),value:r}}_updateAnchorStyle(e,i){const r=this._anchorElements[e];r&&(this._isHorizontalLayout()?r.style.left=`${i}`:r.style.top=`${i}`)}_getStyleForAnchor(e,i,r){var o;const n=this._getPositionStyleForElement(e);if(((o=this.values)==null?void 0:o.length)===1)return`${n}`;const s=this._zIndices[i];return`${n}; z-index: ${r?this._zIndexOffset+s:s}`}_getPositionStyleForElement(e){const i=this._positionFromValue(e),r=this._positionToPercent(i);return`${this._isHorizontalLayout()?"left":"top"}: ${r}%`}_getPositionOfElement(e){const i=this._getDimensions(e.offsetParent),r=this._getDimensions(e);return this._isHorizontalLayout()?this._applyPrecisionToPosition(r.left-i.left):this._applyPrecisionToPosition(r.top-i.top)}_updateAnchorValues(e,i){e.forEach((r,n)=>this._toValue(r,i[n]))}_updateAnchorValuesByDifference(e){const{min:i,max:r,values:n}=this;n==null||n.forEach((s,o)=>this._toValue(o,Math.max(Math.min(s+e,r),i)))}_toValue(e,i){this.steps!=null&&(i=this._getStepValues()[this._getIndexOfNearestStepValue(i)]),this._updateAnchorStyle(e,this._getPositionStyleForElement(i)),this.viewModel.setValue(e,i)}_toPosition(e,i){const r=this.steps!=null?this._getStepValueForAnchorAtPosition(e,i):this._getValueForAnchorAtPosition(e,i);this._updateAnchorStyle(e,this._getPositionStyleForElement(r)),this.viewModel.setValue(e,r)}_getValueForAnchorAtPosition(e,i){const{min:r,max:n}=this._getAnchorBoundsInPixels(e),{min:s,max:o}=this.viewModel.getBoundsForValueAtIndex(e);let l,c,f=null;return this._isPositionInverted()?(l=s,c=o):(l=o,c=s),f=i>n?l:io?f=o:fMath.abs(n-e)i?i:l)}return s}_toStep(e,i){const r=this.values[e],n=this._getStepValues(),s=n.indexOf(r);let o=null;if(s>-1){let l=n[s+i];isNaN(l)&&(l=n[s]);const c=this._positionFromValue(l);o=this._getStepValueForAnchorAtPosition(e,c)}else o=n[this._getIndexOfNearestStepValue(r)+i];this.viewModel.setValue(e,o)}_getIndexOfNearestStepValue(e){const{steps:i}=this;if(i==null)return null;const r=this._getStepValues(),n=r.reduce((s,o)=>Math.abs(o-e)this._positionFromValue(i))}_calculateEquidistantTickPositions(e){const{_trackWidth:i,_trackHeight:r}=this,n=this._isHorizontalLayout()?i:r,s=n/(e-1),o=[];if(e===1)return[n/2];for(let l=0;l{const t=document.createElement("div"),e=document.createElement("calcite-slider");return e.min=0,e.max=100,e.step=1,e.value=100,e.labelHandles=!0,[t,e]},r9=-1;let jg=class extends ze{constructor(e){super(e),this._from=null,this._to=null,this._final=null,this._current=[],this._time=0,this.duration=Le("mapview-transitions-duration"),this.effects=[]}set effect(e){if(this._get("effect")!==(e=e||"")){this._set("effect",e);try{this._transitionTo(F2e(e))}catch(i){this._transitionTo([]),Ce.getLogger(this).warn("Invalid Effect",{effect:e,error:i})}}}get hasEffects(){return this.transitioning||!!this.effects.length}set scale(e){this._updateForScale(e)}get transitioning(){return this._to!==null}canTransitionTo(e){try{return this.scale>0&&k2e(this._current,F2e(e),this.scale)}catch{return!1}}transitionStep(e,i){this._applyTimeTransition(e),this._updateForScale(i)}endTransitions(){this._applyTimeTransition(this.duration)}_transitionTo(e){this.scale>0&&k2e(this._current,e,this.scale)?(this._final=e,this._to=Re(e),EFt(this._current,this._to,this.scale),this._from=Re(this._current),this._time=0):(this._from=this._to=this._final=null,this._current=e),this._set("effects",this._current[0]?Re(this._current[0].effects):[])}_applyTimeTransition(e){if(!(this._to&&this._from&&this._current&&this._final))return;this._time+=e;const i=Math.min(1,this._time/this.duration);for(let r=0;r=i[0].scale)s=n=i[0].effects;else if(e<=i[r].scale)s=n=i[r].effects;else for(let l=0;l=e&&f.scale<=e){o=(e-c.scale)/(f.scale-c.scale),n=c.effects,s=f.effects;break}}for(let l=0;l1||e.length>1)&&i<=0)&&dMe(t[0].effects,e[0].effects)}function EFt(t,e,i){const r=t.length>e.length?t:e,n=t.length>e.length?e:t,s=n[n.length-1],o=(s==null?void 0:s.scale)??i,l=(s==null?void 0:s.effects)??[];for(let c=n.length;cr!=="").map(r=>`'${r}'`);return i.push("''"),`${e} IN (${i.join(",")}) OR ${e} IS NULL`}function xmi(t,e,i){return e.flatten(({sublayers:n})=>n).length!==t.length?!0:!!t.some(n=>n.originIdOf("minScale")>i||n.originIdOf("maxScale")>i||n.originIdOf("renderer")>i||n.originIdOf("labelingInfo")>i||n.originIdOf("opacity")>i||n.originIdOf("labelsVisible")>i||n.originIdOf("source")>i)||!hUe(t,e)}function OFt(t,e,i){return!!t.some(r=>{const n=r.source;return!(!n||n.type==="map-layer"&&n.mapLayerId===r.id&&(n.gdbVersion==null||n.gdbVersion===i))||r.originIdOf("renderer")>Di.SERVICE||r.originIdOf("labelingInfo")>Di.SERVICE||r.originIdOf("opacity")>Di.SERVICE||r.originIdOf("labelsVisible")>Di.SERVICE})||!hUe(t,e)}function hUe(t,e){if(!(t!=null&&t.length)||e==null)return!0;const i=e.slice().reverse().flatten(({sublayers:s})=>s&&s.toArray().reverse()).map(s=>s.id).toArray();if(t.length>i.length)return!1;let r=0;const n=i.length;for(const{id:s}of t){for(;r=n)return!1}return!0}function Smi(t){return!!t&&t.some(e=>{var i;return e.minScale!=null||((i=e.layerDefinition)==null?void 0:i.minScale)!=null})}const PFt={visible:"visibleSublayers",definitionExpression:"layerDefs",labelingInfo:"hasDynamicLayers",labelsVisible:"hasDynamicLayers",opacity:"hasDynamicLayers",minScale:"visibleSublayers",maxScale:"visibleSublayers",renderer:"hasDynamicLayers",source:"hasDynamicLayers"};let Fd=class extends ze{constructor(e){super(e),this.floors=null,this.scale=0}destroy(){this.layer=null}get dynamicLayers(){if(!this.hasDynamicLayers)return null;const e=this.visibleSublayers.map(i=>{const r=z2e(this.floors,i);return i.toExportImageJSON(r)});return e.length?JSON.stringify(e):null}get hasDynamicLayers(){return this.layer&&OFt(this.visibleSublayers,this.layer.serviceSublayers,this.layer.gdbVersion)}set layer(e){this._get("layer")!==e&&(this._set("layer",e),this.removeHandles("layer"),e&&this.addHandles([e.allSublayers.on("change",()=>this.notifyChange("visibleSublayers")),e.on("sublayer-update",i=>this.notifyChange(PFt[i.propertyName]))],"layer"))}get layers(){const e=this.visibleSublayers;return e?e.length?"show:"+e.map(i=>i.id).join(","):"show:-1":null}get layerDefs(){var r;const e=!!((r=this.floors)!=null&&r.length),i=this.visibleSublayers.filter(n=>n.definitionExpression!=null||e&&n.floorInfo!=null);return i.length?JSON.stringify(i.reduce((n,s)=>{const o=z2e(this.floors,s),l=PB(o,s.definitionExpression);return l!=null&&(n[s.id]=l),n},{})):null}get version(){this.commitProperty("layers"),this.commitProperty("layerDefs"),this.commitProperty("dynamicLayers"),this.commitProperty("timeExtent");const e=this.layer;return e&&(e.commitProperty("dpi"),e.commitProperty("imageFormat"),e.commitProperty("imageTransparency"),e.commitProperty("gdbVersion")),(this._get("version")||0)+1}get visibleSublayers(){const e=[];if(!this.layer)return e;const i=this.layer.sublayers,r=this.scale,n=o=>{o.visible&&(r===0||Rht(r,o.minScale,o.maxScale))&&(o.sublayers?o.sublayers.forEach(n):e.unshift(o))};i&&i.forEach(n);const s=this._get("visibleSublayers");return!s||s.length!==e.length||s.some((o,l)=>e[l]!==o)?e:s}toJSON(){const e=this.layer;let i={dpi:e.dpi,format:e.imageFormat,transparent:e.imageTransparency,gdbVersion:e.gdbVersion||null};return this.hasDynamicLayers&&this.dynamicLayers?i.dynamicLayers=this.dynamicLayers:i={...i,layers:this.layers,layerDefs:this.layerDefs},i}};y([w({readOnly:!0})],Fd.prototype,"dynamicLayers",null),y([w()],Fd.prototype,"floors",void 0),y([w({readOnly:!0})],Fd.prototype,"hasDynamicLayers",null),y([w()],Fd.prototype,"layer",null),y([w({readOnly:!0})],Fd.prototype,"layers",null),y([w({readOnly:!0})],Fd.prototype,"layerDefs",null),y([w({type:Number})],Fd.prototype,"scale",void 0),y([w(vot)],Fd.prototype,"timeExtent",void 0),y([w({readOnly:!0})],Fd.prototype,"version",null),y([w({readOnly:!0})],Fd.prototype,"visibleSublayers",null),Fd=y([Z("esri.layers.mixins.ExportImageParameters")],Fd);const RFt=9999999e31,IFt=2e-7,$Ft={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767],u32:[0,4294967295],s32:[-2147483648,2147483647],f32:[-34028234663852886e22,34028234663852886e22],f64:[-Number.MAX_VALUE,Number.MAX_VALUE],unknown:void 0,c64:void 0,c128:void 0};function hre(t){return $Ft[t]??[-34028234663852886e22,34028234663852886e22]}function Emi(t,e,i){var T,A;if(t.depthCount&&t.depthCount>1)return;const{pixels:r,statistics:n,pixelType:s}=t,o=r[0].length,l=t.bandMasks??[],c=t.mask??new Uint8Array(o).fill(255),f=s==="f32"||s==="f64",_=hre(s);let x=!1;for(let M=0;MI+Number.EPSILON||F=RFt?IFt*Math.abs(I):s==="f32"?2**-23:Number.EPSILON);for(let H=0;H1?l:null,t.mask=c),x&&"updateStatistics"in t&&t.updateStatistics()}function dUe(t){return t==null||t.type==="simple"||t.type==="unique-value"||t.type==="class-breaks"||t.type==="dictionary"||t.type==="heatmap"}function Cmi(t,e){if(t==null)return null;if(!dUe(t))return new se("renderer-conversion-3d:unsupported-renderer",`Unsupported renderer of type '${t.type||t.declaredClass}'`,{renderer:t});switch(t.type){case"simple":return LFt(t);case"unique-value":return DFt(t,e);case"class-breaks":return NFt(t);case"dictionary":case"heatmap":return null}return null}function rue(t,e){if(!e)return null;let i;if(i=Array.isArray(e)?e:[e],i.length>0){const r=i.map(s=>s.details.symbol.type||s.details.symbol.declaredClass).filter(s=>!!s);r.sort();const n=[];return r.forEach((s,o)=>{o!==0&&s===r[o-1]||n.push(s)}),new se("renderer-conversion-3d:unsupported-symbols",`Renderer contains symbols (${n.join(", ")}) which are not supported in 3D`,{renderer:t,symbolErrors:i})}return null}function LFt(t){return rue(t,e5(t.symbol).error)}function DFt(t,e){var s;const i={..._A,...e},r=(s=t.uniqueValueInfos)==null?void 0:s.map(o=>e5(o.symbol,i).error).filter(ys),n=e5(t.defaultSymbol,i);return n.error&&(r==null||r.unshift(n.error)),rue(t,r)}function NFt(t){const e=t.classBreakInfos.map(r=>e5(r.symbol).error).filter(ys),i=e5(t.defaultSymbol);return i.error&&e.unshift(i.error),rue(t,e)}function FFt(t){return Ase(t)||zit(t)||Uit(t)}function kFt(t,e){const{format:i,timeZoneOptions:r,fieldType:n}=e??{};let s,o;if(r&&({timeZone:s,timeZoneName:o}=qWe(r.layerTimeZone,r.datesInUnknownTimezone,r.viewTimeZone,oA(i||"short-date-short-time"),n)),typeof t=="string"&&isNaN(Date.parse(n==="time-only"?`1970-01-01T${t}Z`:t)))return t;switch(n){case"date-only":{const l=oA(i||"short-date");return typeof t=="string"?ZWe(t,{...l}):js(t,{...l,timeZone:Vy})}case"time-only":{const l=oA(i||"short-time");return typeof t=="string"?JWe(t,l):js(t,{...l,timeZone:Vy})}case"timestamp-offset":{if(!s&&typeof t=="string"&&new Date(t).toISOString()!==t)return t;const l=i||r?oA(i||"short-date-short-time"):void 0,c=l?{...l,timeZone:s,timeZoneName:o}:void 0;return typeof t=="string"?KWe(t,c):js(t,c)}default:{const l=i||r?oA(i||"short-date-short-time"):void 0;return js(typeof t=="string"?new Date(t):t,l?{...l,timeZone:s,timeZoneName:o}:void 0)}}}var nl;(function(t){t[t.size=22]="size",t[t.lineWidth=50]="lineWidth",t[t.maxSize=120]="maxSize",t[t.maxOutlineSize=80]="maxOutlineSize",t[t.tallSymbolWidth=20]="tallSymbolWidth"})(nl||(nl={}));const Y$={fill:[{type:"path",path:"M -10,-10 L 10,0 L 10,10 L -10,10 L -10,-10 Z"}],squareFill:[{type:"path",path:"M -10,-10 L 10,-10 L 10,10 L -10,10 L -10,-10 Z"}],meshSymbol3DFill:[{type:"path",path:"M -10,-8 L 6,0 L 6,6 L -10,6 L -10,-8 Z"},{type:"path",path:"M -10,-8 L -7,-10 L 9,-2 L 6,0 L -10,-8 Z"},{type:"path",path:"M 6,0 L 9,-2 L 9,4 L 6,6 L 6,0 Z"}],pathSymbol3DLayer:[{type:"path",path:"M 3,12 L 12,0 L 11,-2 L -4,5 L -1,5 L 1,7 L 3,10 L 3,12 Z"},{type:"circle",cx:-2,cy:10,r:5}],extrudeSymbol3DLayer:[{type:"path",path:"M -7,-5 L -2,0 L -2,7 L -7,3 L -7,-5 Z"},{type:"path",path:"M -2,0 L -2,7 L 10,-3 L 10,-10 L -2,0 Z"},{type:"path",path:"M -7,-5 L -2,0 L 10,-10 L -2,-10 L -7,-5 Z"}],cone:[{type:"path",path:"M 0,-10 L -8,5 L -4,6.5 L 0,7 L 4,6.5 L 8,5 Z"}],tallCone:[{type:"path",path:"M 0,-9 L -3.5,7 L -1.5,7.8 L 0,8 L 1.5,7.8 L 3.5,7 L 0,-9 Z"}],invertedCone:[{type:"path",path:"M 0,7 L -8,-8 L 8,-8 Z"},{type:"path",path:"M -8,-8 L -4,-9.5 L 0,-10 L 4,-9.5 L 8,-8 L 4,-6.5 L 0,-6 L -4,-6.5 Z"}],cube:[{type:"path",path:"M -10,-7 L 0,-12 L 10,-7 L 0,-2 L -10,-7 Z"},{type:"path",path:"M -10,-7 L 0,-2 L 0,12 L -10,7 L -10,-7 Z"},{type:"path",path:"M 0,-2 L 10,-7 L 10,7 L 0,12 L 0,-2 Z"}],tallCube:[{type:"path",path:"M -3.5,-8.5 L 0,-9.5 L 3.5,-8.5 L 0,-7.5 L -3.5,-8.5 Z"},{type:"path",path:"M -3.5,-8.5 L 0,-7.5 L 0,9 L -3.5,8 L -3.5,-8.5 Z"},{type:"path",path:"M 0,-7.5 L 3.5,-8.5 L 3.5,8 L 0,9 L 0,-7.5 Z"}],cylinder:[{type:"path",path:"M -8,-9 L -8,7 L -4,8.5 L 0,9 L 4,8.5 L 8,7 L 8,-9 Z"},{type:"ellipse",cx:0,cy:-9,rx:8,ry:2}],tallCylinder:[{type:"path",path:"M -3.5,-9 L -3.5,7 L -1.5,7.8 L 0,8 L 1.5,7.8 L 3.5,7 L 3.5,-9 Z"},{type:"ellipse",cx:0,cy:-9,rx:3.5,ry:1}],diamond:[{type:"path",path:"M 0,-10 L 10,-1 L -1,1 L 0,-10 Z"},{type:"path",path:"M 0,-10 L -1,1 L -8,-1 L 0,-10 Z"},{type:"path",path:"M -1,1 L 0,10 L -8,-1 L -1,1 Z"},{type:"path",path:"M -1,0 L 0,10 L 10,-1 L -1,1 Z"}],tetrahedron:[{type:"path",path:"M 0,-10 L 10,7 L 0,0 L 0,-10 Z"},{type:"path",path:"M 0,-10 L 0,0 L -8,7 L 0,-10 Z"},{type:"path",path:"M 10,7 L 0,0 L -8,7 L 10,7 Z"}]};function zFt(t,e,i){const r=nl.size;let n=r,s=r;t<1?n*=.75:t>1&&(s*=1.25);const o=0,l=0;let c=r,f=r;return e&&i&&(n=s=c=f=0),[{type:"path",path:[{command:"M",values:[c,o]},{command:"L",values:[i?c:.875*c,o]},{command:"L",values:[i?n-.5*c:l,s-.5*f]},{command:"L",values:[n-.5*c,s-.5*f]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[c,o]},{command:"L",values:[c,e?o:.125*f]},{command:"L",values:[n-.5*c,e?s-.5*f:f]},{command:"L",values:[n-.5*c,s-.5*f]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[n-.5*c,s-.5*f]},{command:"L",values:[i?n-.5*c:l,s-.5*f]},{command:"L",values:[i?n-.5*c:l,e?s-.5*f:f]},{command:"L",values:[n-.5*c,e?s-.5*f:f]},{command:"Z",values:[]}]}]}function UFt(t){const e=nl.size,i=.5*t,r=0,n=0;return[{type:"path",path:[{command:"M",values:[n,.7*e*.5]},{command:"L",values:[.3*e,.7*e]},{command:"L",values:[.3*e,.7*e+i]},{command:"L",values:[n,.7*e+i-.7*e*.5]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[.3*e,.7*e]},{command:"L",values:[.3*e,.7*e+i]},{command:"L",values:[e,i]},{command:"L",values:[e,r]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[.3*e,r]},{command:"L",values:[e,r]},{command:"L",values:[.3*e,.7*e]},{command:"L",values:[n,.7*e*.5]},{command:"Z",values:[]}]}]}function VFt(){return[{type:"path",path:"M80,80.2v-27c-1.5,0.7-2.8,1.6-3.9,2.8c-1.8,2.1-4.4,3.3-7.1,3.5c-2.7-0.1-5.3-1.4-7.1-3.4c-2.2-2.3-4.7-3.6-7.4-3.6s-5.1,1.3-7.3,3.6c-1.8,2.1-4.4,3.3-7.2,3.4c-2.7-0.1-5.3-1.4-7.1-3.4c-2.2-2.3-4.7-3.6-7.4-3.6s-5.1,1.3-7.4,3.6c-1.8,2.1-4.4,3.3-7.2,3.4C8.3,59.3,5.7,58,3.9,56c-1.1-1.2-2.4-2.1-3.9-2.8v27"},{type:"path",path:"M11,59.4c2.7-0.1,5.3-1.4,7.1-3.4c2.2-2.3,4.7-3.6,7.4-3.6s5.1,1.3,7.4,3.6c1.8,2,4.4,3.3,7.2,3.4c2.7-0.1,5.3-1.4,7.1-3.4c2.2-2.3,4.7-3.6,7.3-3.6s5.1,1.3,7.4,3.6c1.8,2.1,4.4,3.3,7.2,3.4c2.7-0.1,5.3-1.4,7.1-3.4c1.1-1.2,2.4-2.1,3.9-2.8v-24c-1.5,0.7-2.8,1.6-3.9,2.8c-1.8,2.1-4.4,3.3-7.1,3.5c-2.7-0.1-5.3-1.4-7.1-3.4c-2.2-2.3-4.7-3.6-7.4-3.6s-5.1,1.3-7.3,3.6c-1.8,2.1-4.4,3.3-7.2,3.4c-2.7-0.1-5.3-1.4-7.1-3.4c-2.2-2.3-4.7-3.6-7.4-3.6s-5.1,1.3-7.4,3.6c-1.8,2.1-4.4,3.3-7.2,3.4c-2.7-0.1-5.3-1.4-7.1-3.4c-1.1-1.2-2.4-2.1-3.9-2.8v24c1.5,0.7,2.8,1.6,3.9,2.8C5.7,58,8.3,59.3,11,59.4z"},{type:"path",path:"M11,35.4c2.7-0.1,5.3-1.4,7.1-3.4c2.2-2.3,4.7-3.6,7.4-3.6s5.1,1.3,7.4,3.6c1.8,2,4.4,3.3,7.2,3.4c2.7-0.1,5.3-1.4,7.1-3.4c2.2-2.3,4.7-3.6,7.3-3.6s5.1,1.3,7.4,3.6c1.8,2.1,4.4,3.3,7.2,3.4c2.7-0.1,5.3-1.4,7.1-3.4c1.1-1.2,2.4-2.1,3.9-2.8V3.6c-1.5,0.7-2.8,1.6-3.9,2.8c-2.2,2.1-4.6,3.4-7.1,3.4s-5-1.3-7.1-3.4s-4.7-3.6-7.4-3.6s-5.1,1.3-7.3,3.6S42.5,9.9,40,9.9s-5-1.3-7.1-3.4s-4.7-3.6-7.4-3.6s-5.1,1.3-7.3,3.6c-1.8,2.1-4.4,3.3-7.2,3.4c-2.5,0-5-1.3-7.1-3.4C2.8,5.3,1.4,4.3,0,3.6v25.6c1.5,0.7,2.8,1.6,3.9,2.8C5.7,34.1,8.3,35.3,11,35.4z"}]}function BFt(t,e){let i=e?nl.tallSymbolWidth:t;const r=t,n=e?4:6;i<=nl.size?i-=.5*n:i-=n;const s=0,o=0,l=e?.35*i:.5*i;return[{type:"path",path:[{command:"M",values:[.5*i,s]},{command:"L",values:[i,.5*l]},{command:"L",values:[.5*i,l]},{command:"L",values:[o,.5*l]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[s,.5*l]},{command:"L",values:[.5*i,l]},{command:"L",values:[.5*i,r]},{command:"L",values:[o,r-.5*l]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[.5*i,l]},{command:"L",values:[.5*i,r]},{command:"L",values:[i,r-.5*l]},{command:"L",values:[i,.5*l]},{command:"Z",values:[]}]}]}function jFt(t,e){let i=e?nl.tallSymbolWidth:t;const r=t,n=e?4:6;i<=nl.size?i-=.5*n:i-=n;const s=.5*i,o=.15*i,l=0,c=r-o;return[{type:"ellipse",cx:.5*i,cy:c,rx:s,ry:o},{type:"path",path:[{command:"M",values:[l,o]},{command:"L",values:[l,c]},{command:"L",values:[i,c]},{command:"L",values:[i,o]},{command:"Z",values:[]}]},{type:"ellipse",cx:.5*i,cy:o,rx:s,ry:o}]}function GFt(t,e){let i=e?nl.tallSymbolWidth:t;const r=t,n=e?4:6;i<=nl.size?i-=.5*n:i-=n;const s=.15*i,o=r-s;return[{type:"ellipse",cx:.5*i,cy:o,rx:.5*i,ry:s},{type:"path",path:[{command:"M",values:[.5*i,0]},{command:"L",values:[i,o]},{command:"L",values:[0,o]},{command:"Z",values:[]}]}]}function HFt(t){let e=t;const i=t,r=6;e=4?"auto":"optimizeLegibility",KFt={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},QFt=/([A-DF-Za-df-z])|([-+]?\d*[.]?\d+(?:[eE][-+]?\d+)?)/g;let No={},zn={};const V2e={solid:"none",shortdash:[4,1],shortdot:[1,1],shortdashdot:[4,1,1,1],shortdashdotdot:[4,1,1,1,1,1],dot:[1,3],dash:[4,3],longdash:[8,3],dashdot:[4,3,1,3],longdashdot:[8,3,1,3],longdashdotdot:[8,3,1,3,1,3]},ekt=Math.PI;let tkt=1;function qM(t,e){const i=t*(ekt/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function pUe(t){return t.map(e=>`${e.command} ${e.values.join(" ")}`).join(" ").trim()}function nue(t,e,i,r){if(t){if(t.type==="circle")return X("circle",{cx:t.cx,cy:t.cy,fill:e,"fill-rule":"evenodd",r:t.r,stroke:i.color,"stroke-dasharray":i.dashArray,"stroke-dashoffset":i.dashOffset,"stroke-linecap":i.cap,"stroke-linejoin":i.join,"stroke-miterlimit":"4","stroke-width":i.width});if(t.type==="ellipse")return X("ellipse",{cx:t.cx,cy:t.cy,fill:e,"fill-rule":"evenodd",rx:t.rx,ry:t.ry,stroke:i.color,"stroke-dasharray":i.dashArray,"stroke-linecap":i.cap,"stroke-linejoin":i.join,"stroke-miterlimit":"4","stroke-width":i.width});if(t.type==="rect")return X("rect",{fill:e,"fill-rule":"evenodd",height:t.height,stroke:i.color,"stroke-dasharray":i.dashArray,"stroke-linecap":i.cap,"stroke-linejoin":i.join,"stroke-miterlimit":"4","stroke-width":i.width,width:t.width,x:t.x,y:t.y});if(t.type==="image")return X("image",{height:t.height,href:t.src,preserveAspectRatio:"none",width:t.width,x:t.x,y:t.y});if(t.type==="path"){const n=typeof t.path!="string"?pUe(t.path):t.path;return X("path",{d:n,fill:e,"fill-rule":"evenodd",stroke:i.color,"stroke-dasharray":i.dashArray,"stroke-linecap":i.cap,"stroke-linejoin":i.join,"stroke-miterlimit":"4","stroke-width":i.width})}if(t.type==="text")return ky(r),X("text",{"dominant-baseline":r.dominantBaseline,fill:e,"fill-rule":"evenodd","font-family":r.font.family,"font-size":r.font.size,"font-style":r.font.style,"font-variant":r.font.variant,"font-weight":r.font.weight,kerning:r.kerning,rotate:r.rotate,stroke:i.color,"stroke-dasharray":i.dashArray,"stroke-linecap":i.cap,"stroke-linejoin":i.join,"stroke-miterlimit":"4","stroke-width":i.width,"text-anchor":r.align,"text-decoration":r.decoration,"text-rendering":JFt,x:t.x,y:t.y},t.text)}return null}function sue(t){const e={fill:"none",pattern:null,linearGradient:null};if(t){if("type"in t&&t.type==="pattern"){const i="patternId-"+ ++XFt;e.fill=`url(#${i})`,e.pattern={id:i,x:t.x,y:t.y,width:t.width,height:t.height,image:{x:0,y:0,width:t.width,height:t.height,href:t.src}}}else if("type"in t&&t.type==="linear"){const i="linearGradientId-"+ ++ZFt;e.fill=`url(#${i})`,e.linearGradient={id:i,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stops:t.colors.map(r=>({offset:r.offset,color:r.color&&new qe(r.color).toString()}))}}else if(t){const i=new qe(t);e.fill=i.toString()}}return e}function oue(t){const e={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};if(t&&(t.width!=null&&(e.width=t.width),t.cap&&(e.cap=t.cap),t.join&&(e.join=t.join.toString()),t.color&&(e.color=new qe(t.color).toString()),t.dashArray&&(e.dashArray=t.dashArray),t.dashArray&&(e.dashOffset=t.dashoffset),t.style)){let i=null;if(t.style in V2e&&(i=V2e[t.style]),Array.isArray(i)){i=i.slice(0);const r=t.width??0;for(let n=0;nX("stop",{key:`${s}-stop`,offset:n.offset,"stop-color":n.color}));return X("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2},r)}return null}function ikt(t,e){if(!t||t.length===0)return null;const i=[];for(const r of t){const{shape:n,fill:s,stroke:o,font:l}=r,c=sue(s),f=oue(o),_=n.type==="text"?fUe(n,l):null,x=nue(n,c.fill,f,_);x&&i.push(x)}return X("mask",{id:e,maskUnits:"userSpaceOnUse"},X("g",null,i))}function B2e(t,e,i){return MG(t,CG(t),[e,i])}function j2e(t,e,i,r,n){return Ice(t,CG(t),[e,i]),t[4]=t[4]*e-r*e+r,t[5]=t[5]*i-n*i+n,t}function rkt(t,e,i,r){const n=e%360*Math.PI/180;AG(t,CG(t),n);const s=Math.cos(n),o=Math.sin(n),l=t[4],c=t[5];return t[4]=l*s-c*o+r*o-i*s+i,t[5]=c*s+l*o-i*o-r*s+r,t}function Tu(t,e){No&&"left"in No?(No.left!=null&&No.left>t&&(No.left=t),(No.right==null||No.righte)&&(No.top=e),(No.bottom==null||No.bottom=r&&(n={action:t,args:e.slice(0,e.length-e.length%r)},i.push(n),G2e(n)):(n={action:t,args:[]},i.push(n),G2e(n)))}function nkt(t){const e=(typeof t.path!="string"?pUe(t.path):t.path).match(QFt),i=[];if(No={},zn={},!e)return null;let r="",n=[];const s=e.length;for(let l=0;li?e:i;let U=1,j=1;isNaN(k)||(z>1?(U=k/x,j=k/z/T):(j=k/T,U=k*z/x)),NS(M,M,j2e(A,U,j,f,_)),I=!0}const L=t.x+(x-r)/2,F=t.y+(T-r)/2;if(NS(M,M,B2e(A,f-L,_-F)),!I&&(x>e||T>i)){const z=x/e>T/i,k=(z?e:i)/(z?x:T);NS(M,M,j2e(A,k,k,L,F))}return s&&NS(M,M,rkt(A,s,L,F)),l&&NS(M,M,B2e(A,l[0],l[1])),`matrix(${M[0]},${M[1]},${M[2]},${M[3]},${M[4]},${M[5]})`}function skt(t,e,i){const r=t==null?void 0:t.effects.find(f=>f.type==="bloom");if(!r)return null;const{strength:n,radius:s}=r,o=n>0?s:0,l=(n+o)*e,c=4*n+1;return X("filter",{filterUnits:"userSpaceOnUse",height:"300%",id:`bloom${i}`,width:"300%",x:"-100%",y:"-100%"},X("feMorphology",{in:"SourceGraphic",operator:"dilate",radius:(n+.5*o)*(5**(e/100)*(.4+e/100)),result:"dilate"}),X("feGaussianBlur",{in:"dilate",result:"blur",stdDeviation:l/25}),X("feGaussianBlur",{in:"blur",result:"intensityBlur",stdDeviation:l/50}),X("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},X("feFuncR",{slope:c,type:"linear"}),X("feFuncG",{slope:c,type:"linear"}),X("feFuncB",{slope:c,type:"linear"})),X("feMerge",null,X("feMergeNode",{in:"intensityBlur"}),X("feMergeNode",{in:"intensityBrightness"}),X("feGaussianBlur",{stdDeviation:n/10})))}function vUe(t,e,i,r={}){var _;const n=[],s=[],o=++tkt,l=skt(r.effectView,e,o);let c=null;if(l){const x=(_=r.effectView)==null?void 0:_.effects.find(I=>I.type==="bloom"),T=(x.strength?x.strength+x.radius/2:0)/3,A=e+e*T,M=i+i*T;c=[Math.max(A,10),Math.max(M,10)]}for(let x=0;x!!o.length))return null;const s=(i==null?void 0:i.node)||document.createElement("div");return i.opacity!=null&&(s.style.opacity=i.opacity.toString()),i.effectView!=null&&(s.style.filter=WL(i.effectView)),okt(s,()=>vUe(t,r,n,i)),s}function akt(t,e){t=Math.ceil(t),e=Math.ceil(e);const i=document.createElement("canvas");i.width=t,i.height=e,i.style.width=t+"px",i.style.height=e+"px";const r=i.getContext("2d");return r.clearRect(0,0,t,e),r}function lkt(t,e,i){return t?bi(t,{responseType:"image"}).then(r=>{const n=r.data,s=n.width,o=n.height,l=s/o;let c=e;if(i){const f=Math.max(s,o);c=Math.min(c,f)}return{image:n,width:l<=1?Math.ceil(c*l):c,height:l<=1?c:Math.ceil(c/l)}}):Promise.reject(new se("renderUtils: imageDataSize","href not provided."))}function ckt(t,e){return!(!t||e==="ignore")&&(e!=="multiply"||t.r!==255||t.g!==255||t.b!==255||t.a!==1)}function ukt(t,e,i,r,n){switch(n){case"multiply":t[e]*=i[0],t[e+1]*=i[1],t[e+2]*=i[2],t[e+3]*=i[3];break;default:{const s=Cj({r:t[e],g:t[e+1],b:t[e+2]});s.h=r.h,s.s=r.s,s.v=s.v/100*r.v;const o=SE(s);t[e]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]*=i[3];break}}}function hkt(t,e,i,r,n){return lkt(t,e,n).then(s=>{const o=s.width??e,l=s.height??e;if(s.image&&ckt(i,r)){let c=s.image.width,f=s.image.height;Le("edge")&&/\.svg$/i.test(t)&&(c-=1,f-=1);const _=akt(o,l);_.drawImage(s.image,0,0,c,f,0,0,o,l);const x=_.getImageData(0,0,o,l),T=[i.r/255,i.g/255,i.b/255,i.a],A=Cj(i);for(let M=0;M({url:t,width:e,height:e}))}const _Ue="esri-relationship-ramp",XC=`${_Ue}--diamond`,Db=`${_Ue}--square`,dkt="http://www.w3.org/2000/svg",Ts={diamondContainer:`${XC}__container`,diamondLeftCol:`${XC}__left-column`,diamondRightCol:`${XC}__right-column`,diamondMidCol:`${XC}__middle-column`,diamondMidColLabel:`${XC}__middle-column--label`,diamondMidColRamp:`${XC}__middle-column--ramp`,squareTable:`${Db}__table`,squareTableRow:`${Db}__table-row`,squareTableCell:`${Db}__table-cell`,squareTableLabel:`${Db}__table-label`,squareTableLabelLeftBottom:`${Db}__table-label--left-bottom`,squareTableLabelRightBottom:`${Db}__table-label--right-bottom`,squareTableLabelLeftTop:`${Db}__table-label--left-top`,squareTableLabelRightTop:`${Db}__table-label--right-top`};function bUe(t,e,i={}){const{focus:r,labels:n}=t,s=!!r,o=pkt(t,e,i),l={justifyContent:"center"},c=RT();return s?X("div",{class:Ts.diamondContainer,styles:l},X("div",{class:Ts.diamondLeftCol},c?n.right:n.left),X("div",{class:Ts.diamondMidCol},X("div",{class:Ts.diamondMidColLabel},n.top),o,X("div",{class:Ts.diamondMidColLabel},n.bottom)),X("div",{class:Ts.diamondRightCol},c?n.left:n.right)):X("div",{class:Ts.squareTable},X("div",{class:Ts.squareTableRow},X("div",{class:GS(Ts.squareTableCell,Ts.squareTableLabel,Ts.squareTableLabelRightBottom)},c?n.top:n.left),X("div",{class:Ts.squareTableCell}),X("div",{class:GS(Ts.squareTableCell,Ts.squareTableLabel,Ts.squareTableLabelLeftBottom)},c?n.left:n.top)),X("div",{class:Ts.squareTableRow},X("div",{class:Ts.squareTableCell}),o,X("div",{class:Ts.squareTableCell})),X("div",{class:Ts.squareTableRow},X("div",{class:GS(Ts.squareTableCell,Ts.squareTableLabel,Ts.squareTableLabelRightTop)},c?n.right:n.bottom),X("div",{class:Ts.squareTableCell}),X("div",{class:GS(Ts.squareTableCell,Ts.squareTableLabel,Ts.squareTableLabelLeftTop)},c?n.bottom:n.right)))}function W2e(t,e,i){const r=`${i}_arrowStart`,n=`${i}_arrowEnd`,s=t==="left",o={markerStart:null,markerEnd:null};switch(e){case"HL":s?o.markerStart=`url(#${n})`:o.markerEnd=`url(#${r})`;break;case"LL":o.markerStart=`url(#${n})`;break;case"LH":s?o.markerEnd=`url(#${r})`:o.markerStart=`url(#${n})`;break;default:o.markerEnd=`url(#${r})`}return o}function pkt(t,e,i={}){const{focus:r,numClasses:n,colors:s,rotation:o}=t,{opacity:l,effectList:c,ariaLabel:f}=i,_=i.size??60,x=!!r,T=Math.sqrt(_**2+_**2)+(x?0:5),A=[],M=[],I=[],L=(_||75)/n;for(let ce=0;cenull);if(o&&"thumbnail"in o&&((s=o.thumbnail)!=null&&s.url))return o.thumbnail.url}return i}function gX(t,e=1){const i=t.a,r=Cj(t),n=r.h,s=r.s/e,o=100-(100-r.v)/e,{r:l,g:c,b:f}=SE({h:n,s,v:o});return[l,c,f,i]}function CV(t){var e;return t.type==="water"?t.color==null?null:t.color:((e=t.material)==null?void 0:e.color)==null?null:t.material.color}function Pn(t,e=0){const i=CV(t);if(!i){if(t.type==="fill")return null;const n=eAt.r,s=x2(n,e);return[s,s,s,100]}const r=i.toRgba();for(let n=0;n<3;n++)r[n]=x2(r[n],e);return r}async function wUe(t,e){const i=t.style;return i==="none"?null:{type:"pattern",x:0,y:0,src:await QCt(Wr(`esri/symbols/patterns/${i}.png`),e.toCss(!0)),width:5,height:5}}function X2e(t){return t.outline?WM(t):{color:"rgba(0, 0, 0, 1)",width:1.5}}function lue(t,e){const i=CV(t);if(!i)return null;let r="rgba(";return r+=x2(i.r,e)+",",r+=x2(i.g,e)+",",r+=x2(i.b,e)+",",r+i.a+");"}function fre(t,e){const i=lue(t,e);return i?"pattern"in t&&t.pattern!=null&&t.pattern.type==="style"&&t.pattern.style==="none"?null:{color:i,width:Math.min(t.size?Tr(t.size):.75,aue),style:"pattern"in t&&t.pattern!=null&&t.pattern.type==="style"?nce(t.pattern.style):null,cap:"cap"in t?t.cap:null,join:"join"in t?t.join==="miter"?Tr(2):t.join:null}:{}}function U8(t,e,i){const r=i!=null?.75*i:0;return{type:"linear",x1:r?.25*r:0,y1:r?.5*r:0,x2:r||4,y2:r?.5*r:4,colors:[{color:t,offset:0},{color:e,offset:1}]}}function mkt(t){const e=t.depth,i=t.height,r=t.width;return r!==0&&e!==0&&i!==0&&r===e&&r!=null&&i!=null&&r{var L,F;if(A.type!=="icon"&&A.type!=="object")return;const M=A.type==="icon"?A.size&&Tr(A.size):0,I=i||M?Math.ceil(Math.min(i||M,r||Pk)):US;if((L=A==null?void 0:A.resource)!=null&&L.href){const z=fkt(t,A).then(k=>{var H;const U=(H=A==null?void 0:A.material)==null?void 0:H.color,j=ykt(A);return hkt(k,I,U,j,n)}).then(k=>{const U=k.width,j=k.height;return l=Math.max(l,U),c=Math.max(c,j),[{shape:{type:"image",x:0,y:0,width:U,height:j,src:k.url},fill:null,stroke:null}]});o.push(z)}else{let z=I;A.type==="icon"&&_&&i&&(z=I*(M/_));const k=(e==null?void 0:e.symbolConfig)==="tall"||((F=e==null?void 0:e.symbolConfig)==null?void 0:F.isTall)||A.type==="object"&&mkt(A);l=Math.max(l,k?pre:z),c=Math.max(c,z),o.push(Promise.resolve(gkt(A,z,k)))}});const x=await Promise.allSettled(o),T=[];return x.forEach(A=>{A.status==="fulfilled"?T.push(A.value):A.reason&&Ce.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!",A.reason)}),_6(T,[l,c],{node:e==null?void 0:e.node,scale:!1,opacity:e==null?void 0:e.opacity,ariaLabel:e==null?void 0:e.ariaLabel})}function _kt(t,e){const i=t.symbolLayers,r=[],n=fG(t),s=FG(e),o=(e!=null&&e.maxSize?Tr(e.maxSize):null)||aue;let l,c=0,f=0;return i.forEach((_,x)=>{if(!_||_.type!=="line"&&_.type!=="path")return;const T=[];switch(_.type){case"line":{const A=fre(_,0);if(A==null)break;const M=(A==null?void 0:A.width)||0;x===0&&(l=M);const I=Math.min(s||M,o),L=x===0?I:s?I*(M/l):I,F=L>Y2e/2?2*L:Y2e;f=Math.max(f,L),c=Math.max(c,F),A.width=L,T.push({shape:{type:"path",path:[{command:"M",values:[0,.5*f]},{command:"L",values:[c,.5*f]}]},stroke:A});break}case"path":{const A=Math.min(s||US,o),M=Pn(_,0),I=Pn(_,-.2),L=lue(_,-.4),F=L?{color:L,width:1}:{};if(_.profile==="quad"){const z=_.width,k=_.height,U=zFt(z&&k?z/k:1,k===0,z===0),j={...F,join:"bevel"};T.push({shape:U[0],fill:I,stroke:j},{shape:U[1],fill:I,stroke:j},{shape:U[2],fill:M,stroke:j})}else T.push({shape:Y$.pathSymbol3DLayer[0],fill:I,stroke:F},{shape:Y$.pathSymbol3DLayer[1],fill:M,stroke:F});f=Math.max(f,A),c=f}}r.push(T)}),Promise.resolve(_6(r,[c,f],{node:e==null?void 0:e.node,scale:n,opacity:e==null?void 0:e.opacity,ariaLabel:e==null?void 0:e.ariaLabel}))}async function bkt(t,e){const i=t.type==="mesh-3d",r=t.symbolLayers,n=FG(e),s=e!=null&&e.maxSize?Tr(e.maxSize):null,o=n||US,l=[];let c=0,f=0,_=!1;for(let x=0;x{s[l.value]={label:l.label,fill:Tkt(l.symbol)}});const o=[];for(let l=0;lM+I,0)===100,_=[0];for(let M=0;Mz.addColorStop(H*U,j.toString())),M.fillStyle=z,M.fillRect(0,0,x,T)}else{const z=n?x/t.length:x,k=n?T:T/t.length;let U=0,j=0;for(const H of t)M.fillStyle=H.toString(),M.fillRect(U,j,z,k),U=n?U+z:0,j=n?0:j+k}const F=document.createElement("div");return F.style.width=`${l}px`,F.style.height=`${c}px`,Okt(F,e==null?void 0:e.effectList),F.appendChild(A),F}function Okt(t,e){if(!e)return;t.style.filter=WL(e);const i=e.effects;if(i){for(const r of i)if((r==null?void 0:r.type)==="drop-shadow"){r.offsetX<0?t.style.marginLeft=`${Math.abs(r.offsetX)}px`:t.style.marginRight=`${r.offsetX}px`;break}}}async function SUe(t,e){switch(t.type){case"web-style":{const{previewWebStyleSymbol:i}=await we(()=>import("./previewWebStyleSymbol--GeGTS2s.js"),__vite__mapDeps([]));return i(t,SUe,e)}case"label-3d":case"line-3d":case"mesh-3d":case"point-3d":case"polygon-3d":{const{previewSymbol3D:i}=await we(()=>Promise.resolve().then(()=>xkt),void 0);return i(t,e)}case"simple-marker":case"simple-line":case"simple-fill":case"picture-marker":case"picture-fill":case"text":{const{previewSymbol2D:i}=await we(()=>import("./previewSymbol2D-V05bql6S.js"),__vite__mapDeps([]));return i(t,e)}case"cim":{const{previewCIMSymbol:i}=await we(()=>import("./previewCIMSymbol-ZetpgWRs.js"),__vite__mapDeps([260,231,142,121,122,145,155,230,206]));return i(t,e)}default:return}}function TUe(t){return t&&"opacity"in t?t.opacity*TUe(t.parent):1}async function Mmi(t,e){var k;if(!t)return;const i=t.sourceLayer,r=(e!=null&&e.useSourceLayer?i:t.layer)??i,n=TUe(r);if(t.symbol!=null&&(e==null||e.ignoreGraphicSymbol!==!0)){const U=t.symbol.type==="web-style"?await yAt(t.symbol,{...e,cache:e!=null?e.webStyleCache:null}):t.symbol.clone();return kW(U,null,n),U}const s=(e!=null?e.renderer:null)??(r&&"renderer"in r?r.renderer:null);let o=s&&"getSymbolAsync"in s?await s.getSymbolAsync(t,e):null;if(!o)return;if(o=o.type==="web-style"?await o.fetchSymbol({...e,cache:e!=null?e.webStyleCache:null}):o.clone(),!s||!("visualVariables"in s)||!((k=s.visualVariables)!=null&&k.length))return kW(o,null,n),o;if("arcadeRequiredForVisualVariables"in s&&s.arcadeRequiredForVisualVariables&&(e==null?void 0:e.arcade)==null){const U={...e};U.arcade=await p_(),e=U}const{getColor:l,getOpacity:c,getAllSizes:f,getRotationAngle:_}=await we(()=>Promise.resolve().then(()=>yE),void 0),x=[],T=[],A=[],M=[];for(const U of s.visualVariables)switch(U.type){case"color":x.push(U);break;case"opacity":T.push(U);break;case"rotation":M.push(U);break;case"size":U.target||A.push(U)}const I=!!x.length&&x[x.length-1],L=I?l(I,t,e):null,F=!!T.length&&T[T.length-1];let z=F?c(F,t,e):null;if(n!=null&&(z=z!=null?z*n:n),kW(o,L,z),A.length){const U=f(A,t,e);await mAt(o,U)}for(const U of M)gAt(o,_(U,t,e),U.axis);return o}const Pkt=(t,e)=>{const i=t.featuresTilingScheme.getClosestInfoForScale(t.scale).level;return e!=null&&e.levels?e.levels[i]:null};function Rkt(t,e){if(!t||!("visualVariables"in t)||!t.visualVariables)return null;const i=t.visualVariables.find(n=>n.type==="size"),r=Pkt(e,i);return r?new Yse({field:i.field,minSize:r[2].size,minDataValue:r[2].value,maxSize:r[3].size,maxDataValue:r[3].value}):null}const Ikt=/^-?(\d+)(\.(\d+))?$/i;function $kt(t,e){return t-e}function Lkt(t,e){let i,r;return i=Number(t.toFixed(e)),i0;c||(l=Math.abs(l));const f=AV(o);return c?(f.integer+=l,l>f.fractional?f.fractional=0:f.fractional-=l):(f.fractional+=l,l>f.integer?f.integer=1:f.integer-=l),f}}return{integer:0,fractional:0}}function Rk(t,e,i,r){const n={previous:null,next:null};if(i!=null){const s=t-i,o=e-i-s;n.previous=Math.floor(Math.abs(100*o/s))}if(r!=null){const s=r-t,o=r-e-s;n.next=Math.floor(Math.abs(100*o/s))}return n}function MV(t,e={}){const i=t.slice(0),{tolerance:r=2,strictBounds:n=!1,indexes:s=i.map((o,l)=>l)}=e;s.sort($kt);for(let o=0;oo.type==="color");if(!e)return null;let i=null,r=null;if(e.stops){if(e.stops.length===1)return e.stops[0].color;i=e.stops[0].value,r=e.stops[e.stops.length-1].value}const n=i!=null&&r!=null?i+(r-i)/2:0,{getColor:s}=await we(()=>Promise.resolve().then(()=>yE),void 0);return s(e,n)??null}async function MUe(t,e){const i=t.trailCap,r=t.trailWidth||1,n=e||await mre(t)||t.color;return new Oc({cap:i,color:n,width:r})}function Q2e(t){return t!=null&&typeof t=="object"&&"min"in t&&"max"in t}const zkt=new qe([64,64,64]);function OUe(t,e){const i=[],r=t.length-1;return t.length===5?i.push(0,2,4):i.push(0,r),t.map((n,s)=>i.includes(s)?AUe(n,s,r,e):null)}async function gre(t,e,i){let r=!1,n=[],s=[];if(t.stops){const f=t.stops;n=f.map(_=>_.value),r=f.some(_=>!!_.label),r&&(s=f.map(_=>_.label))}const o=n[0],l=n[n.length-1];if(o==null&&l==null)return null;const c=r?null:OUe(n,i);return(await Promise.all(n.map(async(f,_)=>({value:f,color:t.type==="opacity"?await Ukt(f,t,e):(await we(()=>Promise.resolve().then(()=>yE),void 0)).getColor(t,f),label:r?s[_]:(c==null?void 0:c[_])??""})))).reverse()}async function Ukt(t,e,i){const r=new qe(i??zkt),n=(await we(()=>Promise.resolve().then(()=>yE),void 0)).getOpacity(e,t);return n!=null&&(r.a=n),r}function Vkt(t){let e=!1,i=[],r=[];i=t.map(l=>l.value),e=t.some(l=>!!l.label),e&&(r=t.map(l=>l.label??""));const n=i[0],s=i[i.length-1];if(n==null&&s==null)return null;const o=e?null:OUe(i);return i.map((l,c)=>({value:l,color:PUe(l,t),label:e?r[c]:(o==null?void 0:o[c])??""})).reverse()}function PUe(t,e){const{startIndex:i,endIndex:r,weight:n}=Bkt(t,e);if(i===r)return e[i].color;const s=qe.blendColors(e[i].color,e[r].color,n);return new qe(s)}function Bkt(t,e){let i=0,r=e.length-1;return e.some((n,s)=>t{n===0?i.push({value:e.max,color:new qe(r.toColor),label:"high"}):i.push({value:null,color:new qe(r.toColor),label:""}),n===t.colorRamps.length-1?i.push({value:e.min,color:new qe(r.fromColor),label:"low"}):i.push({value:null,color:new qe(r.fromColor),label:""})});else{let r,n;t&&t.type==="algorithmic"?(r=t.fromColor,n=t.toColor):(r=[0,0,0,1],n=[255,255,255,1]),i=[{value:e.max,color:new qe(n),label:"high"},{value:e.min,color:new qe(r),label:"low"}]}return i}function RUe(t){if(!t.colorStops)return[];const e=[...t.colorStops].filter(r=>{var n;return((n=r.color)==null?void 0:n.a)>0});let i=e.length-1;if(e&&e[0]){const r=e[i];r&&r.ratio!==1&&(e.push(new i$({ratio:1,color:r.color})),i++)}return e.map((r,n)=>{var o,l;let s="";return n===0?s=((o=t.legendOptions)==null?void 0:o.minLabel)||"low":n===i&&(s=((l=t.legendOptions)==null?void 0:l.maxLabel)||"high"),{color:r.color,label:s,ratio:r.ratio}}).reverse()}const yre=30,vre=12,IUe=[255,255,255],$Ue=[200,200,200],YM=[128,128,128],Gkt=20,Hkt=5;function qkt(t){return t.declaredClass==="esri.symbols.SimpleMarkerSymbol"}function Wkt(t){return t.declaredClass==="esri.symbols.PictureMarkerSymbol"}function Ykt(t){return t.declaredClass==="esri.symbols.SimpleLineSymbol"}function Xkt(t){return t.declaredClass==="esri.symbols.TextSymbol"}function Zkt(t,e){const i=t.length-1;return t.map((r,n)=>AUe(r,n,i,e))}async function Jkt(t,e,i,r,n,s,o){const l=e.legendOptions,c=l==null?void 0:l.customValues,f=o||await ezt(t,i),_=e.stops,x=!!f,T=!!c,A=e.minSize!=null&&e.maxSize!=null,M=_&&_.length>1,I=!!e.target;if(!x||!T&&!(A||M&&!I))return;const L=fG(f);let F=!1,z=null,k=null;z=L&&!M?MV([e.minDataValue,e.maxDataValue]):c??await izt(e,f,r,n==null?void 0:n.type);const U=t==null?void 0:t.authoringInfo,j=(U==null?void 0:U.type)==="univariate-color-size",H=j&&(U==null?void 0:U.univariateTheme)==="above-and-below";if(!z&&M&&(z=_.map(re=>re.value),F=_.some(re=>!!re.label),t.type==="flow"&&(z=MV(z)),F&&(k=_.map(re=>re.label))),L&&z!=null&&(z==null?void 0:z.length)>2&&!H&&(z=[z[0],z[z.length-1]]),!z)return null;j&&(z==null?void 0:z.length)!==5&&(z=NUe({minSize:z[0],maxSize:z[z.length-1]}));const Y=L?Kkt(t,z):null,Q=rAt(f),ne=F?null:Zkt(z,s);return(await Promise.all(z.map(async(re,he)=>{const ce=L?Y[he]:await sM(e,f,re,r,n==null?void 0:n.type);return{value:re,symbol:szt(H&&t.type==="class-breaks"?Qkt(t,he):f,ce),label:F?k[he]:ne[he],size:ce,outlineSize:Q}}))).reverse()}function Kkt(t,e){const i=t==null?void 0:t.authoringInfo,r=(i==null?void 0:i.type)==="univariate-color-size";let n=[vre,yre];if(r){const s=e[0],o=e[e.length-1],l=vre,c=yre;n=e.map(f=>l+(f-s)/(o-s)*(c-l))}return r&&(i==null?void 0:i.univariateTheme)==="below"&&n.reverse(),n}function Qkt(t,e){const i=t.classBreakInfos,r=i.length,n=r<2||!(e>=2)?i[0].symbol.clone():i[r-1].symbol.clone();return t.visualVariables.some(s=>s.type==="color")&&(n.type.includes("3d")?LUe(n):DUe(n)),n}async function ezt(t,e){var n,s;if(t.type==="flow")return MUe(t,e);if(t.type==="pie-chart")return new cu({color:null,outline:(n=t.outline)!=null&&n.width?t.outline:new Oc});let i=null,r=null;if(t.type==="simple")i=t.symbol;else if(t.type==="class-breaks"){const o=t.classBreakInfos;i=o&&o[0]&&o[0].symbol,r=o.length>1}else if(t.type==="unique-value"){const o=t.uniqueValueInfos;i=(s=o==null?void 0:o[0])==null?void 0:s.symbol,r=o!=null&&o.length>1}return!i||tzt(i)?null:(i=i.clone(),(e||r)&&(i.type.includes("3d")?LUe(i):DUe(i)),i)}function tzt(t){return t?Hy(t)?!!t.symbolLayers&&t.symbolLayers.some(e=>e&&e.type==="fill"):t.type.includes("fill"):!1}function LUe(t){t.type==="line-3d"?t.symbolLayers.forEach(e=>{e.material={color:YM}}):t.symbolLayers.forEach(e=>{var i;e.type!=="icon"||(i=e.resource)!=null&&i.href?e.material={color:$Ue}:(e.material={color:IUe},e.outline={color:YM,size:1.5})})}function DUe(t){var i,r;const e=_ze();t.type==="cim"?i8e(t,new qe($Ue)):t.type.includes("line")?t.color=YM:(t.color=e?YM:IUe,t.type==="simple-marker"&&(t.outline?((r=(i=t.outline)==null?void 0:i.color)==null?void 0:r.toHex())==="#ffffff"&&(t.outline.color=YM):t.outline={color:YM,width:1.5}))}async function izt(t,e,i,r){const n=(await we(()=>Promise.resolve().then(()=>yE),void 0)).getSizeRangeAtScale(t,i,r),s=n&&NUe(n);if(!n||!s)return;let o=s.map(l=>rzt(l,t,n));o=MV(o);for(let l=1;l=n?l=o:l=(t-r)/(n-r)*(o-s)+s,l}async function nzt(t,e,i,r,n,s){const o=await sM(t,e,i,n,s),l=await sM(t,e,r,n,s),c=AV(i),f=c.fractional,_=Gkt;let x=c.integer,T=null,A=null;i>0&&i<1&&(T=10**f,x=AV(i*=T).integer);for(let M=x-1;M>=0;M--){const I=10**M;let L=Math.floor(i/I)*I,F=Math.ceil(i/I)*I;T!=null&&(L/=T,F/=T);let z=(L+F)/2;[,z]=MV([L,z,F],{indexes:[1]});const k=await sM(t,e,L,n,s),U=await sM(t,e,F,n,s),j=await sM(t,e,z,n,s),H=Rk(o,k,l,null),Y=Rk(o,U,l,null),Q=Rk(o,j,l,null);let ne=H.previous<=_,re=Y.previous<=_;if(ne&&re&&(H.previous<=Y.previous?(ne=!0,re=!1):(re=!0,ne=!1)),ne?A=[L,k]:re?A=[F,U]:Q.previous<=_&&(A=[z,j]),A)break}return A}async function sM(t,e,i,r,n){const{getSize:s}=await we(()=>Promise.resolve().then(()=>yE),void 0);return s(t,i,{scale:r,view:n,shape:e.type==="simple-marker"?e.style:null})}function szt(t,e){const i=t.clone();if(Hy(i))fG(i)||i.symbolLayers.forEach(r=>{r.type!=="fill"&&(r.size=e)});else if(qkt(i))i.size=e;else if(Wkt(i)){const r=i.width,n=i.height;i.height=e,i.width=e*(r/n)}else Ykt(i)?i.width=e:Xkt(i)&&i.font&&(i.font.size=e);return i}Ce.getLogger("esri.renderers.support.utils");async function Md(t,e,i){XV(t,e,()=>[]).push(...i)}async function Omi(t){var i,r;const e=new Map;if(!t)return e;if("visualVariables"in t&&t.visualVariables){const n=t.visualVariables.filter(s=>s.type==="color");for(const s of n){const o=(await gre(s)??[]).map(l=>l.color);await Md(e,s.field||s.valueExpression,o)}}if(t.type==="heatmap"){const n=RUe(t).map(s=>s.color);await Md(e,t.field||t.valueExpression,n)}else if(t.type==="pie-chart"){for(const n of t.attributes)await Md(e,n.field||n.valueExpression,[n.color]);await Md(e,"default",[(i=t==null?void 0:t.othersCategory)==null?void 0:i.color,_C(t.backgroundFillSymbol,null)])}else if(t.type==="dot-density"){for(const n of t.attributes)await Md(e,n.field||n.valueExpression,[n.color]);await Md(e,"default",[t.backgroundColor])}else if(t.type==="unique-value")if(((r=t.authoringInfo)==null?void 0:r.type)==="predominance")for(const n of t.uniqueValueInfos??[])await Md(e,n.value.toString(),[_C(n.symbol,null)]);else{const n=(t.uniqueValueInfos??[]).map(f=>_C(f.symbol,null)),{field:s,field2:o,field3:l,valueExpression:c}=t;(s||c)&&await Md(e,s||c,n),o&&await Md(e,o,n),l&&await Md(e,l,n)}else if(t.type==="class-breaks"){const n=t.classBreakInfos.map(l=>_C(l.symbol,null)),{field:s,valueExpression:o}=t;await Md(e,s??o,n)}else t.type==="simple"&&await Md(e,"default",[_C(t.symbol,null)]);return"defaultSymbol"in t&&t.defaultSymbol&&await Md(e,"default",[_C(t.defaultSymbol,null)]),e.forEach((n,s)=>{const o=c9(n.filter(Boolean),(l,c)=>JSON.stringify(l)===JSON.stringify(c));e.set(s,o)}),e}function ozt(t){const i=Math.floor(Math.log10(Math.abs(t)))+1,r=i<4||i>6?4:i,n=1e6,s=Math.abs(t)>=n?"compact":"standard";return nd(t,{notation:s,minimumSignificantDigits:2,maximumSignificantDigits:r})}const azt="https://utility.arcgis.com/sharing/tools/legend",lzt="esri.layers.ImageryLayer",czt="esri.layers.ImageryTileLayer",uzt="esri.layers.WCSLayer",V8=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,hzt=new yn({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),B8=new cu({size:6,outline:{color:[128,128,128,.5],width:.5}}),dzt=new Bm({style:"solid"});function _re(t){return t.type==="flow"}function FUe(t){return t.type==="vector-field"}function kUe(t){return t.type==="raster-colormap"}function zUe(t){return t.type==="raster-stretch"}function UUe(t){return t.type==="raster-shaded-relief"}function oM(t){return t.declaredClass==="esri.renderers.SimpleRenderer"}function aM(t){return t.declaredClass==="esri.renderers.ClassBreaksRenderer"}function Ik(t){return t.declaredClass==="esri.renderers.UniqueValueRenderer"}function VUe(t){return t.declaredClass==="esri.renderers.HeatmapRenderer"}function pzt(t){return cue(t)||uue(t)||hue(t)||fzt(t)}function fzt(t){return t.declaredClass==="esri.renderers.PointCloudRGBRenderer"}function cue(t){return t.declaredClass==="esri.renderers.PointCloudClassBreaksRenderer"}function uue(t){return t.declaredClass==="esri.renderers.PointCloudStretchRenderer"}function hue(t){return t.declaredClass==="esri.renderers.PointCloudUniqueValueRenderer"}function BUe(t){return t.declaredClass==="esri.renderers.DotDensityRenderer"}function jUe(t){return t.declaredClass==="esri.renderers.PieChartRenderer"}function mzt(t,e){return oM(t)||aM(t)||Ik(t)||VUe(t)||BUe(t)||jUe(t)?e.type==="2d"||dUe(t):zUe(t)||kUe(t)||UUe(t)||cue(t)||uue(t)||hue(t)||FUe(t)||_re(t)}function gzt(t){return t.declaredClass==="esri.layers.BuildingSceneLayer"}function yX(t){return t.declaredClass==="esri.layers.SubtypeGroupLayer"}function yzt(t){return t.declaredClass==="esri.layers.VoxelLayer"}function vzt(t){return t.declaredClass==="esri.layers.WMSLayer"}function _zt(t){return t.declaredClass==="esri.layers.WMTSLayer"}function vX(t){return t.declaredClass==="esri.layers.MapImageLayer"}function exe(t){return t.declaredClass==="esri.layers.TileLayer"}function JC(t){return t.declaredClass===lzt}function j8(t){return t.declaredClass===czt}function bzt(t){return t.declaredClass===uzt}function wzt(t){return t.type==="stretch-ramp"}function xzt(t){const e="authoringInfo"in t?t==null?void 0:t.authoringInfo:null;return(e==null?void 0:e.type)==="univariate-color-size"}function Szt(t){const e="authoringInfo"in t?t==null?void 0:t.authoringInfo:null;return(e==null?void 0:e.type)==="univariate-color-size"&&(e==null?void 0:e.univariateTheme)==="above-and-below"}function txe(t){return"sublayers"in t}async function L1(t,e){const i=await lE("esri/widgets/Legend/t9n/Legend");return t!=="previewTemplateAriaLabel"||e||(t="previewAriaLabel"),By(i[t],{label:e})}const Tzt=new cu({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let KC={},ka=class extends ze{constructor(t){super(t),this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._webStyleSymbolCache=new Map,this._dotDensityUrlCache=new Map,this._scaleDrivenSizeVariable=null,this._hasClusterSizeVariable=!1,this.children=new it,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const t=()=>this.notifyChange("ready");this.addHandles([Jr(()=>this.children,"change",e=>{const{added:i,removed:r}=e;i.forEach(n=>{const s=`activeLayerInfo-ready-watcher-${n.layer.uid}`;this.addHandles(_e(()=>n.ready,t,ii),s)}),r.forEach(n=>this.removeHandles(n.layer.uid)),t()})]),this.keepCacheOnDestroy||(KC={})}destroy(){this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(KC=null)}get effectList(){const t=this.layer;let e=null;return"effect"in t&&t.effect&&(e=new jg,e.effect=t.effect,e.endTransitions(),e.scale=this.scale),e}get opacity(){var n;const t=this.layer.opacity,e=(n=this.parent)==null?void 0:n.opacity,i=this.layer.parent,r=i&&"uid"in i?this._getParentLayerOpacity(i):null;return e!=null?e*t:r!=null?r*t:t}get ready(){return this.layer===null||(this.children.length>0?this._isGroupActive():this.legendElements.length>0)}get scale(){var t;return((t=this.view)==null?void 0:t.scale)??0}get isScaleDriven(){const t=this.layer;if(t===null)return!1;if("effect"in t&&t.effect&&Array.isArray(t.effect))return!0;if("featureReduction"in t&&t.featureReduction){if(t.featureReduction.type==="cluster")return!0;if(t.featureReduction.type==="binning"&&"renderer"in t.featureReduction&&t.featureReduction.renderer)return this._isRendererScaleDriven(t.featureReduction.renderer)}return"renderer"in t&&t.renderer?this._isRendererScaleDriven(t.renderer):this._isLayerScaleDriven(this.layer)}get version(){return this._get("version")+1}async buildLegendElementsForFeatureCollections(t){if(!(!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView()))return this.legendElements=[],void this.notifyChange("ready");const e=Array.from(t,i=>{var r;if(W7(i))return this._getRendererLegendElements(i.renderer,{title:i.title});if((r=i.featureSet)!=null&&r.features.length){const n=i.layerDefinition,s=n==null?void 0:n.drawingInfo,o=s&&kst(s.renderer),l=hzt.read(n.geometryType);return o?this._getRendererLegendElements(o,{title:i.name,geometryType:l}):(Ce.getLogger(this).warn("drawingInfo not available!"),null)}return null});try{const i=[],r=await Promise.allSettled(e);for(const n of r)if(n.status==="fulfilled")for(const s of n.value??[])i.push(s);this.legendElements=i,this.notifyChange("ready")}catch(i){Ce.getLogger(this).warn("error while building legend for layer!",i)}}async buildLegendElementsForRenderer(t){try{const e=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=e?await this._getRendererLegendElements(t):[],this.notifyChange("ready")}catch(e){Ce.getLogger(this).warn("error while building legend for layer!",e)}}async buildLegendElementsForFeatureReduction(t){try{const e=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=e?await this._getLegendElementsForFeatureReduction(t):[],this.notifyChange("ready")}catch(e){Ce.getLogger(this).warn("error while building legend for layer!",e)}}async buildLegendElementsForTools(){var e,i;const t=this.layer;if(yzt(t))this._constructLegendElementsForVoxellayer();else if(_zt(t))this._constructLegendElementsForWMTSlayer();else if(vzt(t))await this._constructLegendElementsForWMSSublayers();else if(gzt(t))await this._constructLegendElementsForBuildingSceneLayer();else if(vX(t)||exe(t)||yX(t))await this._constructLegendElementsForSublayers();else{this.removeHandles("imageryLayers-watcher");let r="default";if(JC(t)){const n=t;r=(((e=n==null?void 0:n.rasterFunction)==null?void 0:e.functionName)||"default")+"_"+((i=t.bandIds)!=null&&i.length?t.bandIds.join(""):"###")}await this._getLegendLayers(`${t.uid}-${r}`).then(async n=>{this.legendElements=[],this.notifyChange("ready");const s=n.map(async o=>{if(JC(t)||j8(t)){const c=_e(()=>["renderingRule"in t&&t.rasterFunction,t.bandIds],()=>X5(async()=>{KC.default=null,t.renderer?await this.buildLegendElementsForRenderer(t.renderer):await this.buildLegendElementsForTools()})());this.addHandles(c,"imageryLayers-watcher")}const l=this._generateSymbolTableElementForLegendLayer(o);l&&l.infos.length&&(JC(t)&&(l.title=t.title),this.legendElements.push(l)),this.notifyChange("ready")});await Promise.allSettled(s)}).catch(n=>{Ce.getLogger(this).warn("Request to server for legend has failed!",n)})}}async _isLayerInCurrentView(){const t=this.layer,e=this.layerView,i=e&&"createQuery"in e&&"queryFeatureCount"in e;if(!i&&!(e&&"createQuery"in t&&"queryFeatureCount"in t))return!0;await rd(()=>!e.updating);const r=i?"createQuery"in e&&e.createQuery():"createQuery"in t&&t.createQuery();return r?(r.geometry=this.view.extent,(i?"queryFeatureCount"in e&&await e.queryFeatureCount(r):"queryFeatureCount"in t&&await t.queryFeatureCount(r))!==0):!0}_getParentLayerOpacity(t){let e=1;const i=t.parent;return i&&"uid"in i&&(e=this._getParentLayerOpacity(i)),t.opacity*e}_isGroupActive(){const t=this.children;return!!t.length&&t.some(e=>e.ready)}_isRendererScaleDriven(t){if(t.type==="dot-density")return!0;const e="valueExpression"in t?t.valueExpression:null;if(V8.test(e))return!0;const i="visualVariables"in t?t.visualVariables:null;return!!(i!=null&&i.some(r=>this._isScaleDrivenSizeVariable(r)))||this._hasScaleDrivenSymbols(t)}_hasScaleDrivenSymbols(t){var e;switch(t.type){case"simple":return this._isScaleDrivenSymbol(t.symbol);case"class-breaks":return this._isScaleDrivenSymbol(t.defaultSymbol)||t.classBreakInfos.some(i=>this._isScaleDrivenSymbol(i.symbol));case"unique-value":return this._isScaleDrivenSymbol(t.defaultSymbol)||!!((e=t.uniqueValueInfos)!=null&&e.some(i=>this._isScaleDrivenSymbol(i.symbol)))}return!1}_isScaleDrivenSymbol(t){if((t==null?void 0:t.type)==="cim"){const{primitiveOverrides:e,minScale:i,maxScale:r}=t.data,n=(e==null?void 0:e.some(s=>{var o;return/\$view\.scale/.test(((o=s.valueExpressionInfo)==null?void 0:o.expression)||"")}))??!1;return i!=null||r!=null||n}return!1}_isScaleDrivenSizeVariable(t){if(t&&t.type!=="size")return!1;const e=t,i=e.minSize,r=e.maxSize;return!(typeof i!="object"||!i||!this._isScaleDrivenSizeVariable(i))||!(typeof r!="object"||!r||!this._isScaleDrivenSizeVariable(r))||!!e.expression||V8.test(e.valueExpression)}_isLayerScaleDriven(t){if("minScale"in t&&t.minScale>0||"maxScale"in t&&t.maxScale>0)return!0;if("sublayers"in t&&t.sublayers)return t.sublayers.some(i=>this._isLayerScaleDriven(i));const e=t.parent;if(t.loaded===!1&&e&&vX(e)&&"source"in t&&t.source&&t.source.type==="map-layer"){for(const i of e.sourceJSON.layers??[])if(i.id===t.source.mapLayerId&&(i.minScale>0||i.maxScale>0))return!0}return!1}async _constructLegendElementsForVoxellayer(){var s;this.legendElements=[],this.removeHandles("voxel-style-watcher"),this.removeHandles("voxel-current-variable");const t=this.layer;this.addHandles(_e(()=>t.currentVariableId,()=>this._constructLegendElementsForVoxellayer()),"voxel-current-variable"),this.addHandles(_e(()=>t.getVariableStyles(),()=>this._constructLegendElementsForVoxellayer()),"voxel-style-watcher");const e=t.getVariableStyle(null),i=[];if(e){if((s=e.uniqueValues)!=null&&s.length){const o=[];e.uniqueValues.forEach(l=>{l.enabled&&o.push({label:l.label||`${l.value}`,value:l.value,symbol:new Bm({color:l.color,outline:null})})}),o.length&&i.push({type:"symbol-table",title:e.label,infos:o})}else if(e.transferFunction){const{colorStops:o,stretchRange:l}=e.transferFunction,c=o.toArray().reverse(),f=l.map((x,T)=>`${T===0?EUe:CUe} ${ozt(x)}`).reverse(),_=c.map(x=>({color:x.color,value:null,label:null}));_[0].label=f[0],_[_.length-1].label=f[1],i.push({type:"color-ramp",title:e.label,infos:_,preview:uS(c.map(x=>x.color),{ariaLabel:await L1("previewColorRampAriaLabel")})})}}const r=t.opacity,n=i.reduce((o,l)=>[...o,...this._getAllInfos(l)],[]).filter(o=>!!(o!=null&&o.symbol)).map(o=>this._getSymbolPreview(o,r));await Promise.allSettled(n),this.legendElements=i,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this.legendElements=[],this.removeHandles("wmts-activeLayer-watcher");const t=this.layer.activeLayer;if(this.addHandles(_e(()=>{const{layer:e}=this;return e&&"activeLayer"in e&&e.activeLayer},()=>this._constructLegendElementsForWMTSlayer()),"wmts-activeLayer-watcher"),t.styleId&&t.styles){let e=null;t.styles.some(i=>t.styleId===i.id&&(e=i.legendUrl,!0)),e&&(this.legendElements=[{type:"symbol-table",title:t.title,infos:[{src:e,opacity:this.opacity}]}])}this.notifyChange("ready")}async _constructLegendElementsForWMSSublayers(){this.legendElements=[],this.removeHandles("wms-sublayers-watcher");const t=this.layer;let e=null;(t.customParameters||t.customLayerParameters)&&(e={...t.customParameters,...t.customLayerParameters}),this.addHandles(_e(()=>{const{layer:i}=this;return i&&"sublayers"in i&&i.sublayers},()=>this._constructLegendElementsForWMSSublayers()),"wms-sublayers-watcher"),this.legendElements=await this._generateLegendElementsForWMSSublayers(t.sublayers,e),this.notifyChange("ready")}async _generateLegendElementsForWMSSublayers(t,e){const i=[];this.addHandles(t.on("change",()=>this._constructLegendElementsForWMSSublayers()),"wms-sublayers-watcher");const r=t.toArray();for(const n of r){const s=_e(()=>[n.title,n.visible,n.legendEnabled],()=>this._constructLegendElementsForWMSSublayers());if(this.addHandles(s,"wms-sublayers-watcher"),!this.respectLayerVisibility||n.visible&&n.legendEnabled){const o=await this._generateSymbolTableElementForWMSSublayer(n,e);o!=null&&o.infos.length&&i.unshift(o)}}return i}async _generateSymbolTableElementForWMSSublayer(t,e){if(!t.legendUrl&&t.sublayers){const i=(await this._generateLegendElementsForWMSSublayers(t.sublayers,e)).filter(r=>r);return{type:"symbol-table",title:t.title,infos:i}}return this._generateSymbolTableElementForLegendUrl(t,e)}async _generateSymbolTableElementForLegendUrl(t,e){var o;let i=t.legendUrl;if(!i)return;const r={type:"symbol-table",title:t.title||t.name||String(t.id??""),infos:[]};e&&(i=tO(i,e));let n=null;const s=(o=t.layer)==null?void 0:o.opacity;try{n=(await bi(i,{responseType:"image"})).data,n&&(n.style.opacity=s)}catch{}return r.infos.push({src:i,preview:n,opacity:s}),r}_getLegendLayers(t,e){const i=KC&&KC[t];return i?Promise.resolve(i):this._legendRequest(e).then(r=>{const n=r.layers;return KC[t]=n,n})}_legendRequest(t){var n;const e=this.layer;let i={f:"json",dynamicLayers:t};if(JC(e)){const s=e.exportImageServiceParameters.rasterFunction;if(s&&(i.renderingRule=JSON.stringify(((n=s.functionDefinition)==null?void 0:n.toJSON())||s.toJSON())),e.bandIds&&(i.bandIds=e.bandIds.join()),e.raster||e.viewId||e.customParameters){const{raster:o,viewId:l,customParameters:c}=e;i={raster:o,viewId:l,...i,...c}}}let r=e.url.replace(/(\/)+$/,"");if("version"in e&&+e.version>=10.01){const s=r.indexOf("?");s>-1?r=r.substring(0,s)+"/legend"+r.substring(s):r+="/legend"}else{const s=r.toLowerCase().indexOf("/rest/"),o=r.substring(0,s)+r.substring(s+5,r.length);r=azt+"?soapUrl="+encodeURI(o)+"&returnbytes=true"}return bi(r,{query:i}).then(s=>s.data)}async _constructLegendElementsForBuildingSceneLayer(){this.legendElements=[],this.removeHandles("sublayers-watcher");const t=this.layer;this.addHandles(_e(()=>t.sublayers,()=>this._constructLegendElementsForBuildingSceneLayer()),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForBuildingSublayers(t.sublayers,this.opacity),this.notifyChange("ready")}catch(e){Ce.getLogger(this).warn("Request to server for legend has failed!",e)}}async _generateLegendElementsForBuildingSublayers(t,e){let i=[];this.addHandles(t.on("change",()=>this._constructLegendElementsForBuildingSceneLayer()),"sublayers-watcher");const r=t.toArray();for(const n of r){const s=_e(()=>["renderer"in n&&n.renderer,n.opacity,n.title,n.visible],()=>this._constructLegendElementsForBuildingSceneLayer());if(this.addHandles(s,"sublayers-watcher"),!this.respectLayerVisibility||n.visible){const o=(n==null?void 0:n.opacity)!=null?n.opacity:null,l=o!=null?o*e:e;if(n.type==="building-group"){const c={type:"symbol-table",title:n.title,infos:[]},f=await this._generateLegendElementsForBuildingSublayers(n.sublayers,l);c.infos.push(...f),i=[c,...i]}else n.renderer&&(i=[...await this._getRendererLegendElements(n.renderer,{title:n.title,opacity:l,sublayer:n}),...i])}}return i.filter(n=>!!n&&(!("infos"in n)||!n.infos||n.infos.length>0))}async _constructLegendElementsForSublayers(){this.legendElements=[],this.removeHandles("sublayers-watcher");const t=this.layer;if(vX(t)||exe(t)||yX(t)){this.addHandles(_e(()=>t.sublayers,()=>this._constructLegendElementsForSublayers),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForSublayers(t.sublayers,this.opacity),this.notifyChange("ready")}catch(e){Ce.getLogger(this).warn("Request to server for legend has failed!",e)}}}async _generateLegendElementsForSublayers(t,e,i){const r=this.layer;let n=[];this.addHandles(t.on("change",()=>this._constructLegendElementsForSublayers()),"sublayers-watcher");let s=t.toArray();!i&&this.sublayerIds&&this.sublayerIds.length&&(s=yX(r)?this.sublayerIds.map(o=>r.findSublayerForSubtypeCode(o)).filter(ys):this.sublayerIds.map(o=>r.findSublayerById(o)).filter(ys));for(const o of s){const l=_e(()=>[o.renderer,o.opacity,o.title,o.visible,o.legendEnabled],()=>this._constructLegendElementsForSublayers());if(this.addHandles(l,"sublayers-watcher"),!this.respectLayerVisibility||o.visible&&o.legendEnabled&&this._isSublayerInScale(o)){const c=(o==null?void 0:o.opacity)!=null?o.opacity:null,f=c!=null?c*e:e,_=!txe(o)||o.originIdOf("renderer")>Di.SERVICE&&!o.sublayers;if(o.renderer&&_)await o.load(),n=[...await this._getRendererLegendElements(o.renderer,{title:o.title,opacity:f,sublayer:o}),...n];else if(txe(o)){const x=await this._generateSymbolTableElementForSublayer(o,f,i);x&&n.unshift(x)}}}return n.filter(o=>!!o&&(!("infos"in o)||!o.infos||o.infos.length>0))}async _generateSymbolTableElementForSublayer(t,e,i){if(!i){i=new Map;const n=this.layer,s=t.source;let o=null;if(!(!s||s.type==="map-layer"&&s.mapLayerId===t.id&&(!s.gdbVersion||s.gdbVersion===("gdbVersion"in n&&n.gdbVersion)))||t.originIdOf("renderer")>Di.SERVICE||t.originIdOf("labelingInfo")>Di.SERVICE||t.originIdOf("labelsVisible")>Di.SERVICE){const c=new Fd({layer:this.layer});o=c.hasDynamicLayers?c.dynamicLayers:null,c.destroy()}const l=o||`${n.uid}-default`;(await this._getLegendLayers(l,o)).forEach(c=>i.set(c.layerId,c))}const r=i.get(t.id);if((!r||r!=null&&r.subLayerIds&&r.defaultVisibility)&&t.sublayers){const n=await this._generateLegendElementsForSublayers(t.sublayers,e,i);return{type:"symbol-table",title:t.title,infos:n}}return this._generateSymbolTableElementForLegendLayer(r,t,e)}_generateSymbolTableElementForLegendLayer(t,e,i){if(!(t!=null&&t.legend)||this.respectLayerVisibility&&!this._isLegendLayerInScale(t,e))return null;const r=e==null?void 0:e.renderer;let n=(e==null?void 0:e.title)||t.layerName;if(r&&(!e||(e==null?void 0:e.originIdOf("renderer"))>Di.SERVICE)){const l=(e==null?void 0:e.title)||this._getRendererTitle(r,e);l&&(n&&typeof l!="string"&&"title"in l&&(l.title=n),n=l)}const s={type:"symbol-table",title:n,legendType:t.legendType||null,infos:[]},o=e?this._sanitizeLegendForSublayer(t.legend.slice(),e):t.legend;return t.legendGroups&&t.legendGroups.length>0?t.legendGroups.forEach(l=>{var f;const c={type:"symbol-table",title:l.heading,legendType:t.legendType||null,infos:this._generateSymbolTableElementInfosForLegendLayer(o.filter(_=>_.groupId===l.id),t.layerId,i)};((f=c.infos)==null?void 0:f.length)>0&&s.infos.push(c)}):s.infos=this._generateSymbolTableElementInfosForLegendLayer(o,t.layerId,i),s.infos.length>0?s:null}_generateSymbolTableElementInfosForLegendLayer(t,e,i){return t.map(r=>{let n=r.url;if(r.imageData&&r.imageData.length>0)n=`data:image/png;base64,${r.imageData}`;else{if(n.indexOf("http")===0)return null;n=ZYe(`${this.layer.url}/${e}/images/${n}`)}return{label:r.label,src:n,opacity:i??this.opacity,width:r.width,height:r.height}}).filter(ys)}_isSublayerInScale(t){const e=t.minScale||0,i=t.maxScale||0;return!(e>0&&ethis.scale)}_isLegendLayerInScale(t,e){const i=e||this.layer;let r=null,n=null,s=!0;return!i.minScale&&i.minScale!==0||!i.maxScale&&i.maxScale!==0?(t.minScale===0&&i.tileInfo&&(r=i.tileInfo.lods[0].scale),t.maxScale===0&&i.tileInfo&&(n=i.tileInfo.lods[i.tileInfo.lods.length-1].scale)):(r=Math.min(i.minScale,t.minScale)||i.minScale||t.minScale,n=Math.max(i.maxScale,t.maxScale)),(r>0&&rthis.scale)&&(s=!1),s}_sanitizeLegendForSublayer(t,e){if("version"in this.layer&&+this.layer.version<10.1||t.length===0)return t;const i=e.renderer,r=t.some(o=>o.values);let n=0,s=null;return r&&t.some((o,l)=>(o.values||(n=l,s=o,s.label||(s.label="others")),s!=null)),i?i.type==="unique-value"?s&&(t.splice(n,1),t.push(s)):i.type==="class-breaks"&&(s&&t.splice(n,1),t.reverse(),s&&t.push(s)):s&&(t.splice(n,1),t.push(s)),t}async _getRendererLegendElements(t,e={}){if(!mzt(t,this.view))return Ce.getLogger(this).warn(`Renderer of type '${t.type}' not supported!`),[];if(pzt(t))return this._constructPointCloudRendererLegendElements(t,e);if(BUe(t))return this._constructDotDensityRendererLegendElements(t);const i=await this._loadRenderer(t);return jUe(i)?this._constructPieChartRendererLegendElements(i):this._constructRendererLegendElements(i,e)}async _getLegendElementsForFeatureReduction(t){let e=null;return t.type==="binning"?e=t.renderer:t.type==="cluster"&&(e=this._getClusterRenderer(t)),e?this._getRendererLegendElements(e):[]}_getPointCloudRendererTitle(t){var e;return(((e=t.legendOptions)==null?void 0:e.title)||t.field)??""}async _constructPointCloudRendererLegendElements(t,e={}){var l;const i=e.title,r=[];let n=null,s=null;if(cue(t))n={type:"symbol-table",title:i||this._getPointCloudRendererTitle(t),infos:[]},t.colorClassBreakInfos.forEach(c=>{n.infos.unshift({label:c.label||c.minValue+" - "+c.maxValue,value:[c.minValue,c.maxValue],symbol:this._getAppliedCloneSymbol(B8,c.color)})});else if(uue(t)){const c=t.stops;let f=null;if(c!=null&&c.length&&(c.length===1&&(f=c[0].color),!f)){const x=c[0].value,T=c[c.length-1].value;x!=null&&T!=null&&(f=PUe(x+(T-x)/2,c))}n={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(B8,f||B8.color)}]};const _=Vkt(t.stops??[])??[];s={type:"color-ramp",title:i||this._getPointCloudRendererTitle(t),infos:_,preview:uS(_.map(x=>x.color),{ariaLabel:await L1("previewColorRampAriaLabel")})}}else hue(t)&&(n={type:"symbol-table",title:i||this._getPointCloudRendererTitle(t),infos:[]},(l=t.colorUniqueValueInfos)==null||l.forEach(c=>{n.infos.push({label:c.label||c.values.join(", "),value:c.values.join(", "),symbol:this._getAppliedCloneSymbol(B8,c.color)})}));n&&n.infos.length&&r.push(n),s&&s.infos.length&&r.push(s);const o=r.reduce((c,f)=>[...c,...f.infos??[]],[]).filter(c=>!!c.symbol).map(c=>this._getSymbolPreview(c,this.opacity,{symbolConfig:{applyColorModulation:!!t.colorModulation}}));return await Promise.allSettled(o),r}async _getElementInfoForDotDensity(t,e){const{color:i,label:r,valueExpressionTitle:n}=e,{backgroundColor:s,outline:o,dotSize:l}=t,c=this.effectList,f=c==null?void 0:c.effects.map(F=>F.toJSON()),_=Uz(f),x=await L1("previewTemplateAriaLabel",r||n),T=l+"-"+i+"-"+s+"-"+(o&&JSON.stringify(o.toJSON()))+"-"+_,A=this._dotDensityUrlCache,M=A.has(T)?A.get(T):Akt(t,i,{ariaLabel:x});A.set(T,M);const I={shape:{type:"image",x:0,y:0,width:M.width,height:M.height,src:M.src},fill:null,stroke:null,offset:[0,0]},L=_6([[I]],[M.width,M.height],{effectView:this.effectList,ariaLabel:x});return{opacity:1,src:M.src,preview:L,width:M.width,height:M.height}}async _constructDotDensityRendererLegendElements(t){var n;const e=t.calculateDotValue(this.view.scale),i=(n=t.legendOptions)==null?void 0:n.unit,r={type:"symbol-table",title:{value:e&&Math.round(e),unit:i||""},infos:[]};for(const s of t.attributes){const o=await this._getElementInfoForDotDensity(t,s);o.label=s.label||s.valueExpressionTitle||s.field,r.infos.push(o)}return[r]}async _constructPieChartRendererLegendElements(t){var c,f,_,x;const e=this.layer.opacity,i=[];let r=null;const n=t.outline;t.attributes.forEach(T=>{const A=new cu({color:T.color,outline:n}),M=T.label||T.valueExpressionTitle||T.field;i.push({label:M,symbol:A})});const s=i.length?[...i]:[];if((c=t.othersCategory)!=null&&c.color&&((f=t.othersCategory)==null?void 0:f.threshold)!==0){const T=new cu({color:t.othersCategory.color,outline:n});r=t.othersCategory.label||"Other",i.push({label:r,symbol:T})}if((_=t.defaultColor)!=null&&_.a){const T=new cu({color:t.defaultColor,outline:n});i.push({label:t.defaultLabel,symbol:T})}const o=await this._getVisualVariableLegendElements(t,this.layer)||[];if(i.length){o.unshift({type:"symbol-table",title:null,infos:i});const T=s.filter(M=>M.label!==r).map(M=>M.symbol.color).filter(Boolean),A=Mkt(T,{holePercentage:t.holePercentage,backgroundColor:(x=t.backgroundFillSymbol)==null?void 0:x.color,effectList:this.effectList,outline:n,ariaLabel:await L1("previewPieChartAriaLabel")});o.unshift({type:"pie-chart-ramp",title:this._getRendererTitle(t,this.layer),infos:i,preview:A})}const l=o.reduce((T,A)=>[...T,...this._getAllInfos(A)],[]).filter(T=>!!(T!=null&&T.symbol)&&!(T!=null&&T.preview)).map(T=>this._getSymbolPreview(T,e,{effectList:this.effectList}));return await Promise.allSettled(l),o}async _constructRendererLegendElements(t,e={}){var I,L,F,z,k;const{title:i,sublayer:r}=e,n=r||this.layer;this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const s=await this._getVisualVariableLegendElements(t,n)||[],o={type:"symbol-table",title:i||this._getRendererTitle(t,n),infos:[]};let l=null,c=!1;const f=new Set;if(_re(t)&&!this._hasSizeRamp){const U=await MUe(t);o.infos.push({label:null,symbol:U})}else if(xzt(t)){let U=i;const j=Szt(t)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",H=s.findIndex(he=>he.type==="color-ramp"),Y=H!==-1?s.splice(H,1)[0]:null,Q=s.findIndex(he=>he.type==="size-ramp"),ne=Q!==-1?s.splice(Q,1)[0]:null,re=[];Y&&(U=Y.title,re.push(Y)),ne&&(U=ne.title,re.push(ne)),re.length>0&&s.push({type:j,title:U,infos:re})}else if(VUe(t)){const U=RUe(t);s.push({type:"heatmap-ramp",title:i||this._getRendererTitle(t,n),infos:U,preview:uS(U.map(j=>j.color),{effectList:this.effectList,ariaLabel:await L1("previewColorRampAriaLabel")})})}else if(Ik(t)){const U=t&&t.authoringInfo;if(U&&U.type==="relationship"){const{numClasses:j,field1:H,field2:Y}=U,Q=U.focus;if(j&&H&&Y){const ne=[H,Y];let re=xUe(Q)||0;for(const ce of ne){const{field:be,normalizationField:ye,label:pe}=ce,Ee=pe||{field:this._getFieldAlias(be,n),normField:ye&&this._getFieldAlias(ye,n)},te=Tzt.clone();te.angle=re,o.infos.push({label:Ee,symbol:te}),f.add(te),re+=90}const he=Ckt({focus:Q,numClasses:j,infos:t.uniqueValueInfos??[]});s.unshift(he)}}else if(JC(this.layer)||j8(this.layer))(I=t.uniqueValueInfos)==null||I.forEach(j=>{j.symbol&&o.infos.push({label:j.label||j.value,value:j.value,symbol:j.symbol})});else{const{field:j,field2:H,field3:Y,fieldDelimiter:Q,valueExpression:ne,defaultSymbol:re}=t,he=!(!j&&!ne||!H&&!Y),ce=[];if((L=t.uniqueValueGroups)==null||L.forEach(be=>{var pe;const ye={type:"symbol-table",title:be.heading,infos:[]};(pe=be.classes)==null||pe.forEach(Ee=>{const{symbol:te,values:le}=Ee;if(te){const de=[],ve=[];for(const Pe of le??[]){const{value:Ge,value2:ut,value3:Ft}=Pe,Qt=[],At=[];(j||ne)&&(Qt.push(Ge),At.push(this._getDomainName(j,Ge,n))),H&&(Qt.push(ut),At.push(this._getDomainName(H,ut,n))),Y&&(Qt.push(Ft),At.push(this._getDomainName(Y,Ft,n))),de.push(he?Qt.join(Q||""):Qt[0]),ve.push(At.join(" - "))}const Se=de.join(", ");let Ae=Ee.label;if(!Ae){const Pe=ve.filter(Boolean);Ae=Pe.length?Pe.join(", "):Se}ye.infos.push({label:Ae,value:Se,symbol:te})}}),ye.infos.length&&ce.push(ye)}),ce.length){const be=ce[0];ce.length===1&&"title"in be&&!be.title?o.infos.push(...be.infos??[]):(re&&(ce.push({type:"symbol-table",infos:[{label:t.defaultLabel||"others",symbol:re}]}),c=!0),o.infos.push(...ce)),i||(F=t.legendOptions)!=null&&F.title||t.valueExpressionTitle||(o.title=null)}}t.defaultSymbol&&!c&&(o.infos.push({label:t.defaultLabel||"others",symbol:t.defaultSymbol}),c=!0)}else if(aM(t))l=this._isUnclassedRenderer(t),(!l||!this._hasSizeRamp)&&(t.classBreakInfos.forEach(U=>{U.symbol&&o.infos.unshift({label:U.label||(l?null:U.minValue+" - "+U.maxValue),value:[U.minValue,U.maxValue],symbol:U.symbol})}),l&&(o.title=null),this._updateInfosforClassedSizeRenderer(t,o.infos)),t.defaultSymbol&&!l&&(o.infos.push({label:t.defaultLabel||"others",symbol:t.defaultSymbol}),c=!0);else if(zUe(t))if(j8(this.layer)||bzt(this.layer)){const U=await this._constructTileImageryStretchRendererElements(t);wzt(U)?s.push(U):o.infos=U}else{const U=this.layer;let j,H;if((z=t.statistics)!=null&&z.length){const re=t.statistics[0];Q2e(re)?(j=re.min,H=re.max):[j,H]=re}let Y=[],Q=U.serviceRasterInfo;if(U.rasterFunction)try{Q=await U.generateRasterInfo(U.rasterFunction)}catch{}const ne=hre(Q.pixelType);if(Q.bandCount===1){const re=((k=U.bandIds)==null?void 0:k[0])||0;j=j??(Q.statistics?Q.statistics[re].min:ne[0]),H=H??(Q.statistics?Q.statistics[re].max:ne[1]),j||H?s.push(await this._getStretchLegendElements(t,{min:j,max:H})):this._getServerSideLegend()}else if(U.bandIds&&U.bandIds.length===1)j=j??(Q.statistics?Q.statistics[U.bandIds[0]].min:ne[0]),H=H??(Q.statistics?Q.statistics[U.bandIds[0]].max:ne[1]),j||H?s.push(await this._getStretchLegendElements(t,{min:j,max:H})):this._getServerSideLegend();else if(Q.bandCount>=3){const{bandInfos:re}=Q,{bandIds:he}=U;re.length>=Q.bandCount?(he==null?void 0:he.length)===3?(Y=he.map(ce=>re[ce].name),o.infos=this._createSymbolTableElementMultiBand(Y)):U.format==="lerc"?(Y=[0,1,2].map(ce=>re[ce].name),o.infos=this._createSymbolTableElementMultiBand(Y)):this._getServerSideLegend():U.format==="lerc"?(Y=["band1","band2","band3"],o.infos=this._createSymbolTableElementMultiBand(Y)):this._getServerSideLegend()}else this._getServerSideLegend()}else if(kUe(t))t.colormapInfos.forEach(U=>{o.infos.push({label:U.label,value:U.value,symbol:this._getAppliedCloneSymbol(dzt,U.color)})});else if(oM(t)){let U=t.symbol;switch(e.geometryType){case"point":U="pointSymbol"in n?n.pointSymbol:null;break;case"polyline":U="lineSymbol"in n?n.lineSymbol:null;break;case"polygon":U="polygonSymbol"in n?n.polygonSymbol:null}const j=this._hasClusterSizeVariable&&this._getClusterSymbol()||!this._hasSizeRamp;t.symbol&&j&&o.infos.push({label:t.label,symbol:U})}else if(FUe(t)){t.outputUnit&&(this.title="("+t.toJSON().outputUnit+")"),o.title=t.attributeField;const U=t.getClassBreakInfos();U!=null&&U.length?U.forEach(j=>{o.infos.push({label:j.minValue+" - "+j.maxValue,symbol:j.symbol})}):o.infos.push({label:t.attributeField,symbol:t.getDefaultSymbol()})}else UUe(t)&&s.push(await this._getStretchLegendElements(t,{min:0,max:255}));const _=t.defaultSymbol;!_||c||oM(t)||l&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||s.push({type:"symbol-table",infos:[{label:t.defaultLabel||"others",symbol:_}]}),o.infos.length&&s.unshift(o);const x=e.opacity==null?this.opacity:e.opacity,T=this._isTallSymbol("visualVariables"in t?t.visualVariables:null),A=JC(this.layer)||j8(this.layer),M=s.reduce((U,j)=>[...U,...this._getAllInfos(j)],[]).filter(U=>!!(U!=null&&U.symbol)).filter(U=>{if(U.symbol.type==="cim"){const{minScale:j,maxScale:H}=U.symbol.data;if(j&&jthis.scale)return!1}return!0}).map(U=>this._getSymbolPreview(U,x,{isDefault:U.symbol===_,applyScaleDrivenSize:!f.has(U.symbol),symbolConfig:{isTall:T,isSquareFill:A},effectList:f.has(U.symbol)?null:this.effectList}));return t=null,await Promise.allSettled(M),s}_getServerSideLegend(){setTimeout(()=>this.buildLegendElementsForTools(),0)}_getAllInfos(t){const e=t==null?void 0:t.infos;return e?e.reduce((i,r)=>i.concat(this._getAllInfos(r)),[]):[t]}async _constructTileImageryStretchRendererElements(t){var l,c,f;const e=this.layer,i=e.symbolizer.rasterInfo??e.raster.rasterInfo;let r,n;const s=(l=t==null?void 0:t.statistics)!=null&&l.length?t.statistics:i==null?void 0:i.statistics;if(s){const _=s[0];Q2e(_)?(r=_.min,n=_.max):[r,n]=_}else{const _=hre(i.pixelType);r=_[0],n=_[1]}if(e.hasStandardTime()&&(r=e.getStandardTimeValue(r),n=e.getStandardTimeValue(n)),i.bandCount===1||((c=e.bandIds)==null?void 0:c.length)===1)return this._getStretchLegendElements(t,{min:r,max:n});const o=((f=e==null?void 0:e.bandIds)!=null&&f.length?e.bandIds:Array.from(Array(Math.min(i.bandCount,3)).keys())).map(_=>i.bandInfos[_].name);return o.length<3?o.push(o[1]):o.length>3&&o.splice(3),this._createSymbolTableElementMultiBand(o)}async _getStretchLegendElements(t,e){const i=t.colorRamp,r=jkt(i,e);return{type:"stretch-ramp",title:"",infos:r,preview:uS(r.map(n=>n.color),{ariaLabel:await L1("previewColorRampAriaLabel")})}}_getClusterSymbol(){var r;const t=this.layer,e="featureReduction"in t&&t.featureReduction,i=e&&"symbol"in e&&e.renderer;return i&&((r=i==null?void 0:i.authoringInfo)==null?void 0:r.isAutoGenerated)!==!0?null:e&&"symbol"in e?e.symbol:null}async _getSizeLegendElement(t,e,i,r){return{type:"size-ramp",title:this._hasClusterSizeVariable?this._getClusterTitle(e):t,infos:await Jkt(i,e,await mre(i),this.scale,this.view,r,this._hasClusterSizeVariable?this._getClusterSymbol():null)}}_createSymbolTableElementMultiBand(t){const e=[],i=["red","green","blue"];return t.forEach((r,n)=>{e.push({label:{colorName:i[n],bandName:r},src:kkt[n],opacity:this.opacity??1})}),e}_updateInfosforClassedSizeRenderer(t,e){const i=t.authoringInfo&&t.authoringInfo.type==="class-breaks-size",r=t.classBreakInfos.some(n=>fG(n.symbol));if(i&&r){const n=yre,s=vre,o=t.classBreakInfos.length,l=(n-s)/(o>1?o-1:o);e.forEach((c,f)=>{c.size=n-l*f})}}_isTallSymbol(t){let e=!1,i=!1;if(t)for(let r=0;rPromise.resolve().then(()=>yE),void 0);r=c(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:t.symbol.type==="simple-marker"?t.symbol.style:null})}const n=!(i!=null&&i.isDefault)&&this._hasSizeRamp||!(!this._scaleDrivenSizeVariable||!(i!=null&&i.applyScaleDrivenSize));return SUe(t.symbol,{size:r,opacity:e,scale:!1,symbolConfig:i==null?void 0:i.symbolConfig,effectView:i==null?void 0:i.effectList,style:"legend",cimOptions:{allowScalingUp:n,viewParams:this.isScaleDriven?{viewingMode:((s=this.view)==null?void 0:s.type)==="2d"?"map":(o=this.view)==null?void 0:o.viewingMode,scale:(l=this.view)==null?void 0:l.scale}:null},ariaLabel:t.label&&typeof t.label!="string"?null:await L1("previewTemplateAriaLabel",t.label)}).then(c=>(t.preview=c,t)).catch(()=>(t.preview=null,t))}_getClusterRenderer(t){var n,s;this._hasClusterSizeVariable=!1;const e="renderer"in this.layer?this.layer.renderer:null,i=((n=t.renderer)==null?void 0:n.clone())||(e==null?void 0:e.clone()),r=Rkt(this.layerView._effectiveRenderer,this.view);if(r&&i!=null&&"visualVariables"in i&&!((s=i.visualVariables)==null?void 0:s.some(l=>l.type==="size"&&l.target!=="outline"&&!V8.test(l.valueExpression)))){if("clusterMinSize"in t&&"clusterMaxSize"in t){const{clusterMinSize:c,clusterMaxSize:f}=t;r.legendOptions=new POe({showLegend:c!==f})}const l=i.visualVariables||[];i.visualVariables=l.concat([r]),this._hasClusterSizeVariable=!0}return i}async _loadRenderer(t){const e=[],i=t.clone(),r=await mre(i);if(aM(i)||Ik(i)){const n=(i.classBreakInfos||i.uniqueValueInfos).map(s=>this._fetchSymbol(s.symbol,r).then(o=>{s.symbol=o}).catch(()=>{s.symbol=null}));Array.prototype.push.apply(e,n)}return e.push(this._fetchSymbol(i.symbol||i.defaultSymbol,i.defaultSymbol?null:r).then(n=>{this._applySymbolToRenderer(i,n,oM(i))}).catch(()=>{this._applySymbolToRenderer(i,null,oM(i))})),await Promise.allSettled(e),i}_applySymbolToRenderer(t,e,i){i?t.symbol=e:t.defaultSymbol=e}async _fetchSymbol(t,e){if(!t)throw new Error;if(t.type==="web-style"){const i=this._webStyleSymbolCache;try{const r=await(this.view.type==="2d"?t.fetchCIMSymbol({cache:i}):t.fetchSymbol({cache:i}));return this._getAppliedCloneSymbol(r,e)}catch{throw Ce.getLogger(this).warn("Fetching web-style failed!"),new Error}}return this._getAppliedCloneSymbol(t,e)}_getAppliedCloneSymbol(t,e){if(!t||!e)return t;const i=t.clone(),r=e&&e.toRgba();return i.type.includes("3d")?this._applyColorTo3dSymbol(i,r):i.type==="cim"?i8e(i,e):i.color&&(i.color=new qe(r||i.color)),i}_applyColorTo3dSymbol(t,e){e&&t.symbolLayers.forEach(i=>{i&&(i.material||(i.material={}),i.material.color=new qe(e))})}async _getVisualVariableLegendElements(t,e){var _;if(!("visualVariables"in t)||!t.visualVariables||t.type==="vector-field")return null;const i=t.visualVariables,r=[],n=[],s=[];for(const x of i)x.type==="color"?r.push(x):x.type==="size"?n.push(x):x.type==="opacity"&&s.push(x);const o=[...r,...n,...s];let l,c;if(r.length===0&&aM(t)&&t.classBreakInfos&&t.classBreakInfos.length===1){const x=t.classBreakInfos[0];l=x&&x.symbol}if(r.length===0&&oM(t)&&(l=t.symbol),l)if(l.type.includes("3d")){const x=l.symbolLayers.at(0);x.type==="water"?x.color!=null&&(c=x.color):((_=x.material)==null?void 0:_.color)!=null&&(c=x.material.color)}else l.url||(c=l.color);const f=this.effectList;return(await Promise.all(o.map(async x=>{if(!x.legendOptions||x.legendOptions.showLegend!==!1){const T=_re(t)?x.field:this._getRampTitle(x,e);let A=null;const M=this._getDateFormatOptions(e,x);if(x.type==="color"){const I=await gre(x,null,M)??[];A={type:"color-ramp",title:T,infos:I,preview:uS(I.map(L=>L.color),{effectList:f,ariaLabel:await L1("previewColorRampAriaLabel")})},this._hasColorRamp||(this._hasColorRamp=I.length>0)}else if(x.type==="size"&&x.target!=="outline")V8.test(x.valueExpression)?this._hasClusterSizeVariable||(this._scaleDrivenSizeVariable=x):(A=await this._getSizeLegendElement(T,x,t,M),this._hasSizeRamp||(this._hasSizeRamp=!(A.infos==null||!A.infos.length)));else if(x.type==="opacity"){const I=await gre(x,c,M)??[];A={type:"opacity-ramp",title:T,infos:I,preview:uS(I.map(L=>L.color),{effectList:f,ariaLabel:await L1("previewColorRampAriaLabel")})},this._hasOpacityRamp||(this._hasOpacityRamp=I.length>0)}return A&&A.infos?A:null}}))).filter(ys)}_getFieldInfo(t,e){var i,r;if(!e.field)return null;if("featureReduction"in t)switch((i=t.featureReduction)==null?void 0:i.type){case"cluster":case"binning":{const n=t.featureReduction.fields.find(({name:s})=>s.toLowerCase()===e.field.toLowerCase());return n&&"getField"in t?t.getField(n.onStatisticField):null}}return"getField"in t?(r=t.getField)==null?void 0:r.call(t,e.field):null}_getDateFormat(t,e){var r,n,s;const i="popupTemplate"in t?(r=t.popupTemplate)==null?void 0:r.fieldInfos:null;if(i!=null&&i.length&&e)return(s=(n=i.find(o=>{var l;return((l=o.fieldName)==null?void 0:l.toLowerCase())===e.toLowerCase()}))==null?void 0:n.format)==null?void 0:s.dateFormat}_getDateFormatOptions(t,e){var n,s,o,l;const i=this._getFieldInfo(t,e);if(!i||!FFt(i)&&!CMe(i))return null;let r=this._getDateFormat(t,i.name);if(!r&&i.type==="date"){let c=0,f=0;e.stops?(c=((s=(n=e.stops)==null?void 0:n.at(0))==null?void 0:s.value)??c,f=((l=(o=e.stops)==null?void 0:o.at(-1))==null?void 0:l.value)??f):"minDataValue"in e&&"maxDataValue"in e&&(c=e.minDataValue??c,f=e.maxDataValue??f),r=f-c>2*FK.days?"short-date":"short-date-short-time"}return{fieldType:i.type,format:r,timeZoneOptions:{layerTimeZone:"preferredTimeZone"in t?t.preferredTimeZone:null,viewTimeZone:this.view.timeZone,datesInUnknownTimezone:"datesInUnknownTimezone"in t&&t.datesInUnknownTimezone}}}_getDomainName(t,e,i){var r;if(t&&typeof t!="function"){const n="getField"in i&&((r=i.getField)==null?void 0:r.call(i,t)),s=n&&"getFieldDomain"in i&&i.getFieldDomain?i.getFieldDomain(n.name):null;return(s==null?void 0:s.type)==="coded-value"?s.getName(e):null}return null}_getClusterTitle(t){const e=this.layer,i=t.field;if("featureReduction"in e&&e.featureReduction&&e.featureReduction.type==="cluster"){const r=e.featureReduction,n="popupTemplate"in r&&r.popupTemplate,s=n&&n.fieldInfos;if(s){for(const o of s)if(o.fieldName===i)return i==="cluster_count"?o.label||{showCount:!0}:o.label}}return{showCount:!0}}_getRampTitle(t,e){var f,_;let i=t.field,r=t.normalizationField,n=!1,s=!1,o=!1,l=null;i=typeof i=="function"?null:i,r=typeof r=="function"?null:r;const c=(f=t.legendOptions)==null?void 0:f.title;if(c!=null)l=c;else if(t.valueExpressionTitle)l=t.valueExpressionTitle;else{if("renderer"in e&&e.renderer&&"authoringInfo"in e.renderer&&((_=e.renderer.authoringInfo)!=null&&_.visualVariables)){const x=e.renderer.authoringInfo.visualVariables;for(let T=0;T${_}<${this._getFieldAlias(c,e)}>`,f&&(x=`${x}${_}<${this._getFieldAlias(f,e)}>`)),x}let o=null;return(r||n)&&(o={field:r&&this._getFieldAlias(r,e),normField:n&&this._getFieldAlias(n,e),normByPct:s}),o}_getFieldAlias(t,e){var _;const i="popupTemplate"in e?e.popupTemplate:null,r=i==null?void 0:i.fieldInfos;let n;r&&r.some(x=>t===x.fieldName&&(n=x,!0));let s=null;"getField"in e&&e.getField?s=e.getField(t):"fieldsIndex"in e&&e.fieldsIndex&&(s=e.fieldsIndex.get(t));let o=null;const l="featureReduction"in e&&e.featureReduction;l&&(!n&&"popupTemplate"in l&&((_=l.popupTemplate)!=null&&_.fieldInfos)&&l.popupTemplate.fieldInfos.some(x=>{var T;return(t==null?void 0:t.toLowerCase())===((T=x.fieldName)==null?void 0:T.toLowerCase())&&(n=x,!0)}),"fields"in l&&l.fields&&(o=l.fields.find(x=>{var T;return((T=x.name)==null?void 0:T.toLowerCase())===(t==null?void 0:t.toLowerCase())})));const c=n||s||o;let f=null;return c&&(f=(n==null?void 0:n.label)||(s==null?void 0:s.alias)||(o==null?void 0:o.alias)||"name"in c&&c.name||"fieldName"in c&&c.fieldName||null),f}_isUnclassedRenderer(t){const e=t.visualVariables;let i=!1;return aM(t)&&t.classBreakInfos&&t.classBreakInfos.length===1&&e&&(i=t.field?e.some(r=>!(!r||t.field!==r.field||(t.normalizationField||r.normalizationField)&&t.normalizationField!==r.normalizationField)):!!e.length),i}};y([w()],ka.prototype,"children",void 0),y([w({readOnly:!0})],ka.prototype,"effectList",null),y([w()],ka.prototype,"layerView",void 0),y([w()],ka.prototype,"layer",void 0),y([w()],ka.prototype,"legendElements",void 0),y([w({readOnly:!0})],ka.prototype,"opacity",null),y([w()],ka.prototype,"parent",void 0),y([w({readOnly:!0,dependsOn:[]})],ka.prototype,"ready",null),y([w()],ka.prototype,"hideLayersNotInCurrentView",void 0),y([w()],ka.prototype,"keepCacheOnDestroy",void 0),y([w()],ka.prototype,"respectLayerVisibility",void 0),y([w({readOnly:!0})],ka.prototype,"scale",null),y([w()],ka.prototype,"sublayerIds",void 0),y([w({readOnly:!0})],ka.prototype,"isScaleDriven",null),y([w()],ka.prototype,"title",void 0),y([w({readOnly:!0,dependsOn:["ready"],value:0})],ka.prototype,"version",null),y([w()],ka.prototype,"view",void 0),ka=y([Z("esri.widgets.Legend.support.ActiveLayerInfo")],ka);const GUe=ka,n3={state:"state",view:"view",allLayerViews:"all-layer-views",legendProperties:"legend-properties"},HUe=it.ofType(GUe),Ezt=new Set(["esri.layers.BuildingSceneLayer","esri.layers.CSVLayer","esri.layers.FeatureLayer","esri.layers.GeoJSONLayer","esri.layers.GeoRSSLayer","esri.layers.GroupLayer","esri.layers.HeatmapLayer","esri.layers.ImageryLayer","esri.layers.ImageryTileLayer","esri.layers.MapImageLayer","esri.layers.OGCFeatureLayer","esri.layers.PointCloudLayer","esri.layers.StreamLayer","esri.layers.SceneLayer","esri.layers.SubtypeGroupLayer","esri.layers.TileLayer","esri.layers.VoxelLayer","esri.layers.WFSLayer","esri.layers.WMSLayer","esri.layers.WMTSLayer","esri.layers.WCSLayer","esri.layers.LinkChartLayer","esri.layers.knowledgeGraph.KnowledgeGraphSublayer"]),qUe="view.basemapView.baseLayerViews",WUe="view.groundView.layerViews",YUe="view.basemapView.referenceLayerViews",Czt=[qUe,WUe,"view.layerViews",YUe];let Qp=class extends ze{constructor(e){super(e),this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new it,this.activeLayerInfos=new HUe,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.layerInfos=[],this.view=null}initialize(){this.addHandles(_e(()=>this.view,()=>this._viewHandles(),ii),n3.view),this.addHandles(oE(()=>this._refresh()))}destroy(){this._destroyViewActiveLayerInfos(),this.view=null}get state(){var e;return(e=this.view)!=null&&e.ready?"ready":"disabled"}_viewHandles(){this.removeHandles(n3.state),this.view&&this.addHandles(_e(()=>this.state,()=>this._stateHandles(),ii),n3.state)}_stateHandles(){this._resetAll(),this.state==="ready"&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this.removeHandles([n3.allLayerViews,n3.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this.removeHandles(e);const i=this._activeLayerInfosByLayerViewId[e];delete this._activeLayerInfosByLayerViewId[e],i!=null&&i.parent&&i.parent.children.remove(i)}_watchPropertiesAndAllLayerViews(){const{view:e}=this;if(!e)return;const{allLayerViews:i}=e;i.length&&this._refresh(),this.addHandles(i.on("change",r=>this._allLayerViewsChangeHandle(r)),n3.allLayerViews),this.addHandles(_e(()=>[this.layerInfos,this.basemapLegendVisible,this.groundLegendVisible],()=>this._propertiesChangeHandle()),n3.legendProperties)}_allLayerViewsChangeHandle(e){e.removed.forEach(i=>this._destroyViewActiveLayerInfo(i.uid)),this._refresh()}_propertiesChangeHandle(){this._destroyViewActiveLayerInfos(),this._refresh()}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.removeAll(),this._generateLayerViews().filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this),this._sortActiveLayerInfos(this.activeLayerInfos)}_sortActiveLayerInfos(e){const i=this.view;if(e.length<2||!i)return;const r=[];e.forEach(s=>{if(!s.parent){const o=s.layer.parent,l=o&&"uid"in o&&this._layerViewByLayerId[o.uid],c=l&&this._activeLayerInfosByLayerViewId[l.uid];c&&e.includes(c)&&(r.push(s),s.parent=c,c.children.add(s),this._sortActiveLayerInfos(c.children))}}),e.removeMany(r);const n={};i.allLayerViews.forEach((s,o)=>n[s.layer.uid]=o),e.sort((s,o)=>{const l=n[s.layer.uid]||0;return(n[o.layer.uid]||0)-l})}_generateLayerViews(){const e=[];return Czt.filter(this._filterLayerViews,this).map(i=>au(this,i)).filter(i=>i!=null).forEach(this._collectLayerViews("layerViews",e)),e}_filterLayerViews(e){const i=!this.basemapLegendVisible&&(e===qUe||e===YUe),r=!this.groundLegendVisible&&e===WUe;return!i&&!r}_collectLayerViews(e,i){const r=n=>(n&&n.forEach(s=>{i.push(s),r(s[e])}),i);return r}_filterLayerViewsByLayerInfos(e){const i=this.layerInfos;return!i||!i.length||i.some(r=>this._hasLayerInfo(r,e))}_hasLayerInfo(e,i){const r=this._isLayerUIDMatching(e.layer,i.layer.uid);return r&&(this._layerInfosByLayerViewId[i.uid]=e),r}_isLayerUIDMatching(e,i){return e&&(e.uid===i||this._hasLayerUID(e.layers,i))}_hasLayerUID(e,i){return e&&e.some(r=>this._isLayerUIDMatching(r,i))}_isLayerViewSupported(e){return!!Ezt.has(e.layer.declaredClass)&&(this._layerViewByLayerId[e.layer.uid]=e,!0)}_generateActiveLayerInfo(e){this._isLayerActive(e)?this._buildActiveLayerInfo(e):(this.removeHandles(e.uid),this.addHandles(_e(()=>{var i;return[e.legendEnabled,(i=e.layer)==null?void 0:i.legendEnabled]},()=>this._layerActiveHandle(e)),e.uid))}_layerActiveHandle(e){this._isLayerActive(e)&&(this.removeHandles(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){var i;return!this.respectLayerVisibility||e.legendEnabled&&((i=e.layer)==null?void 0:i.legendEnabled)}_buildActiveLayerInfo(e){var l;const i=e.layer,r=e.uid,n=this._layerInfosByLayerViewId[r];let s=this._activeLayerInfosByLayerViewId[r];if(!s){const c=(n==null?void 0:n.title)!==void 0&&n.layer.uid===i.uid;s=new GUe({layer:i,layerView:e,title:c?n.title:i.title,view:this.view,respectLayerVisibility:this.respectLayerVisibility,hideLayersNotInCurrentView:this.hideLayersNotInCurrentView,keepCacheOnDestroy:this.keepCacheOnDestroy,sublayerIds:(n==null?void 0:n.sublayerIds)||[]}),this._activeLayerInfosByLayerViewId[r]=s}const o=i.parent&&"uid"in i.parent?this._layerViewByLayerId[(l=i.parent)==null?void 0:l.uid]:null;if(s.parent=this._activeLayerInfosByLayerViewId[o==null?void 0:o.uid],!this.hasHandles(r)){const c=[_e(()=>i.title,f=>this._titleHandle(f,s)),_e(()=>[i.opacity,"renderer"in i&&i.renderer,"pointSymbol"in i&&i.pointSymbol,"lineSymbol"in i&&i.lineSymbol,"polygonSymbol"in i&&i.polygonSymbol],()=>this._constructLegendElements(s)),Mo(()=>{var f;return((f=this.view)==null?void 0:f.stationary)===!0},()=>this._scaleHandle(s),ii),_e(()=>e._effectiveRenderer,()=>this._constructLegendElements(s)),_e(()=>"effect"in i&&i.effect,()=>this._constructLegendElements(s)),Mo(()=>{var f;return(f=this.view)==null?void 0:f.timeZone},()=>this._constructLegendElements(s),ii)];if(this.respectLayerVisibility){const f=_e(()=>e.legendEnabled,x=>this._legendEnabledHandle(x,s)),_=_e(()=>i.legendEnabled,x=>this._legendEnabledHandle(x,s));c.push(f,_)}this.addHandles(c,r)}s.isScaleDriven||this._constructLegendElements(s),this._addActiveLayerInfo(s)}_titleHandle(e,i){i.title=e,this._constructLegendElements(i)}_legendEnabledHandle(e,i){e?this._addActiveLayerInfo(i):this._removeActiveLayerInfo(i)}_scaleHandle(e){(e.isScaleDriven||e.hideLayersNotInCurrentView)&&this._constructLegendElements(e)}_addActiveLayerInfo(e){var n;const{layerView:i,layer:r}=e;if(this._isLayerActive(i)&&!this.activeLayerInfos.includes(e)){const s=e.parent;if(s)s.children.includes(e)||s.children.push(e),this._sortActiveLayerInfos(s.children);else{const o=(n=this.layerInfos)==null?void 0:n.some(l=>l.layer.uid===r.uid);r.parent&&"uid"in r.parent&&!o?this._activeLayerInfosWithNoParent.add(e):(this.activeLayerInfos.add(e),this._sortActiveLayerInfos(this.activeLayerInfos))}if(this._activeLayerInfosWithNoParent.length){const o=[];this._activeLayerInfosWithNoParent.forEach(l=>{const c=l.layer.parent,f=c&&"uid"in c?this._layerViewByLayerId[c==null?void 0:c.uid]:null,_=this._activeLayerInfosByLayerViewId[f==null?void 0:f.uid];_&&(o.push(l),l.parent=_)}),o.length&&(this._activeLayerInfosWithNoParent.removeMany(o),o.forEach(l=>this._addActiveLayerInfo(l)))}}}_removeActiveLayerInfo(e){const i=e.parent;i?i.children.remove(e):this.activeLayerInfos.remove(e)}_constructLegendElements(e){const i=e.layer;"featureCollections"in i&&i.featureCollections?e.buildLegendElementsForFeatureCollections(i.featureCollections):"featureReduction"in i&&i.featureReduction&&"renderer"in i.featureReduction&&(i.featureReduction.type==="binning"||i.featureReduction.type==="cluster")?e.buildLegendElementsForFeatureReduction(i.featureReduction):"renderer"in i&&i.renderer&&!("sublayers"in i)?e.buildLegendElementsForRenderer(i.renderer):"url"in i&&i.url?e.buildLegendElementsForTools():e.children.forEach(r=>this._constructLegendElements(r))}};y([w({type:HUe})],Qp.prototype,"activeLayerInfos",void 0),y([w()],Qp.prototype,"basemapLegendVisible",void 0),y([w()],Qp.prototype,"groundLegendVisible",void 0),y([w()],Qp.prototype,"hideLayersNotInCurrentView",void 0),y([w()],Qp.prototype,"keepCacheOnDestroy",void 0),y([w()],Qp.prototype,"respectLayerVisibility",void 0),y([w()],Qp.prototype,"layerInfos",void 0),y([w({readOnly:!0})],Qp.prototype,"state",null),y([w()],Qp.prototype,"view",void 0),Qp=y([Z("esri.widgets.Legend.LegendViewModel")],Qp);const Azt=Qp,Cn="esri-legend--card",QC="esri-legend",pi={activated:`${Cn}__carousel-indicator--activated`,base:Cn,stacked:`${QC}--stacked`,carouselTitle:`${Cn}__carousel-title`,indicator:`${Cn}__carousel-indicator`,intervalSeparator:`${Cn}__interval-separator`,imageryLayerStretchedImage:`${Cn}__imagery-layer-image--stretched`,imageLabel:`${Cn}__image-label`,layerCaption:`${Cn}__layer-caption`,labelElement:`${Cn}__label-element`,layerRow:`${Cn}__layer-row`,labelCell:`${Cn}__label-cell`,message:`${Cn}__message`,rampLabel:`${Cn}__ramp-label`,section:`${Cn}__section`,relationshipSection:`${Cn}__relationship-section`,serviceCaptionText:`${Cn}__service-caption-text`,serviceContent:`${Cn}__service-content`,service:`${Cn}__service`,groupLayer:`${Cn}__group-layer`,groupLayerChild:`${Cn}__group-layer-child`,symbol:`${Cn}__symbol`,sizeRampRow:`${Cn}__size-ramp-row`,symbolRow:`${Cn}__symbol-row`,symbolCell:`${Cn}__symbol-cell`,indicatorContainer:`${Cn}__carousel-indicator-container`,intervalSeparatorsContainer:`${Cn}__interval-separators-container`,relationshipLabelContainer:`${Cn}__relationship-label-container`,labelContainer:`${Cn}__label-container`,serviceCaptionContainer:`${Cn}__service-caption-container`,symbolContainer:`${Cn}__symbol-container`,sizeRampContainer:`${Cn}__size-ramp-container`,sizeRampPreview:`${Cn}__size-ramp-preview`,pieChartRampPreview:`${Cn}__pie-chart-ramp-preview`,rampContainer:`${QC}__ramps`,sizeRampHorizontal:`${QC}__size-ramp--horizontal`,rampLabelsContainer:`${QC}__ramp-labels`,layerInfo:`${QC}__layer-cell ${QC}__layer-cell--info`,univariateAboveAndBelowColorRamp:"esri-univariate-above-and-below-ramp__color--card"},Mzt=pz(),XUe=10,due=20,kG=10,pue=20,fue={univariateAboveAndBelowSymbol:"esri-univariate-above-and-below-ramp__symbol",colorRamp:"esri-legend__color-ramp"};function Ozt(t="vertical"){const e="stroke:rgb(200, 200, 200);stroke-width:1";return t==="vertical"?X("svg",{height:"4",width:"10"},X("line",{style:e,x1:"0",x2:"10",y1:"2",y2:"2"})):X("svg",{height:"10",width:"10"},X("line",{style:e,x1:"5",x2:"5",y1:"0",y2:"10"}))}function Pzt(t,e="vertical"){const i=document.createElement("div");return i.style.height=`${due}px`,i.className=fue.univariateAboveAndBelowSymbol,t!=null&&(i.style.opacity=t.toString()),Mzt.append(i,Ozt.bind(null,e)),i}function ZUe(t,e,i="vertical",r){t.infos.forEach((n,s)=>{if(r&&s===2)n.preview=Pzt(e,i);else{const o=Tr(n.size)+(i==="horizontal"?pue:kG),l=n.preview,c=(l==null?void 0:l.tagName.toLowerCase())==="div",f=c?l:document.createElement("div");f.className=fue.univariateAboveAndBelowSymbol,i==="horizontal"?f.style.width=`${o}px`:f.style.height=`${o}px`,!c&&l&&f.appendChild(l),n.preview=f}})}function OV(t,e="classic"){const i=t.infos;return e==="classic"?(Tr(i[0].size)+kG)/2:(Tr(i[0].size)-Tr(i[i.length-1].size))/2}function OO(t,e){if(!t)return null;const i=t.infos.map(n=>n.color),r=uS(e.type==="full"?i:e.type==="above"?i.slice(0,3):i.slice(2,5),{width:e.width,height:e.height,align:e.rampAlignment,effectList:e.effectList,ariaLabel:e.ariaLabel});return r.className=fue.colorRamp,e.opacity!=null&&(r.style.opacity=e.opacity.toString()),r}function bre(t,e,i,r="vertical"){let n=0;const s=t.infos,o=Math.floor(s.length/2),l=e==="full"||e==="above"?0:o,c=e==="full"||e==="below"?s.length-1:o;for(let f=l;f<=c;f++)i&&f===o?n+=r==="horizontal"?XUe:due:n+=Tr(s[f].size)+(r==="horizontal"?pue:kG);return Math.round(n)}function PO(t,e,i,r="vertical"){const n=bre(t,e,i,r),s=t.infos,o=Math.floor(s.length/2),l=e==="full"||e==="above"?0:o,c=e==="full"||e==="below"?s.length-1:o,f=e==="full"?s[l].size+s[c].size:e==="above"?s[l].size:s[c].size,_=i?r==="vertical"?due:XUe:0,x=r==="vertical"?kG*(e==="full"?2:1):pue*(e==="full"?2:1);return Math.round(n-(Tr(f)/2+_/2+x/2))}function JUe(t,e,i="vertical"){const r=t.infos;let n=r.find(({type:o})=>o==="size-ramp"),s=r.find(({type:o})=>o==="color-ramp");return n&&(n={...n},n.infos=[...n.infos],ZUe(n,e,i,!0)),s&&(s={...s},s.infos=[...s.infos]),i==="horizontal"&&(n==null||n.infos.reverse(),s==null||s.infos.reverse()),{sizeRampElement:n,colorRampElement:s}}function KUe(t,e="vertical"){const i=t.infos;let r=i.find(({type:s})=>s==="size-ramp"),n=i.find(({type:s})=>s==="color-ramp");return r&&(r={...r},r.infos=[...r.infos],ZUe(r,null,e,!1)),n&&(n={...n},n.infos=[...n.infos]),e==="horizontal"&&(r==null||r.infos.reverse(),n==null||n.infos.reverse()),{sizeRampElement:r,colorRampElement:n}}function Rzt(t,e){return e}function xl(t){const e=this;t.appendChild(e)}function p2(t,e,i){if(!e)return;if(typeof e=="number")return e;if(typeof e=="string")return Gje(e);if("value"in e||"unit"in e)return By(t.dotValue,e);if("colorName"in e&&"bandName"in e)return t[e.colorName]+": "+(t[e.bandName]||e.bandName);if("showCount"in e)return e.showCount?t.clusterCountTitle:void 0;let r=null;return Rzt(e,i)?r=e.ratioPercentTotal?"showRatioPercentTotal":e.ratioPercent?"showRatioPercent":e.ratio?"showRatio":e.normField?"showNormField":e.field?"showField":null:QUe(e,i)&&(r=e.normField?"showNormField":e.normByPct?"showNormPct":e.field?"showField":null),r?By(r==="showField"?"{field}":t[r],{field:e.field,normField:e.normField}):void 0}function QUe(t,e){return!e}function eVe(t,e){return!!(e&&e==="Stretched"&&t.version>=10.3&&t.declaredClass==="esri.layers.ImageryLayer")}function tVe(t,e){var i;return t.label?e[t.label]+": "+(typeof t.value=="string"?t.value:nd(t.value??0,{style:"decimal",notation:(i=t.value)!=null&&i.toString().toLowerCase().includes("e")?"scientific":"standard"})):""}const Izt=25,$zt=25,Lzt=768,Dzt=100;var X$;(function(t){t.Auto="auto",t.Stack="stack",t.SideBySide="side-by-side"})(X$||(X$={}));const Nzt="#ddd",eA=window.devicePixelRatio;function Fzt(t){var e,i;if(t){if(t.type.includes("3d")){const r=(e=t.symbolLayers)==null?void 0:e.length;if(!r)return;const n=t.symbolLayers.at(r-1),s=(i=n.resource)==null?void 0:i.primitive;return s==="circle"||s==="cross"||s==="kite"||s==="sphere"||s==="cube"||s==="diamond"}{const r=t.style;return r==="circle"||r==="diamond"||r==="cross"}}}function kzt(t){var e;if(t){if(t.type.includes("3d")){const i=(e=t.symbolLayers)==null?void 0:e.length;if(!i)return;const r=t.symbolLayers.at(i-1).get("resource.primitive");return r==="triangle"||r==="cone"||r==="tetrahedron"}return t.style==="triangle"}}let W0=class extends cn{constructor(e,i){super(e,i),this._hasIndicators=!1,this._selectedSectionName=null,this._sectionNames=[],this._sectionMap=new Map,this.activeLayerInfos=null,this.headingLevel=3,this.layout=X$.Stack,this.messages=null,this.messagesCommon=null,this.type="card",this.view=null}initialize(){this.addHandles(_e(()=>this.activeLayerInfos,e=>{this.removeAllHandles(),this._watchForSectionChanges(e)}))}render(){const{view:e}=this;this._hasIndicators=this.layout===X$.Auto&&e&&e.container.clientWidth<=Lzt||this.layout===X$.Stack;const i=this.activeLayerInfos,r=i&&i.toArray().map(f=>this._renderLegendForLayer(f)).filter(f=>!!f);this._hasIndicators?this._selectedSectionName&&this._sectionNames.includes(this._selectedSectionName)||(this._selectedSectionName=this._sectionNames&&this._sectionNames[0]):this._selectedSectionName=null;const n=this._sectionNames.length,s=this._sectionNames.map((f,_)=>{const x=By(this.messagesCommon.pagination.pageText,{index:_+1,total:n});return X("div",{"aria-controls":`${f}-panel`,"aria-label":x,"aria-selected":(this._selectedSectionName===f).toString(),bind:this,class:this.classes(pi.indicator,{[pi.activated]:this._selectedSectionName===f}),"data-section-name":f,id:f,key:f,onclick:this._selectSection,onkeydown:this._focusSection,role:"tab",tabIndex:this._selectedSectionName===f?0:-1,title:x})}),o=this._hasIndicators&&n>1?X("div",{class:pi.indicatorContainer,key:"carousel-navigation",role:"tablist"},s):null,l=this._hasIndicators?this._sectionMap.get(this._selectedSectionName):r&&r.length?r:null,c={[pi.stacked]:this._hasIndicators};return X("div",{class:this.classes(pi.base,c)},l||X("div",{class:pi.message},this.messages.noLegend),o)}_selectSection(e){const i=e.target.getAttribute("data-section-name");i&&(this._selectedSectionName=i)}_focusSection(e){switch(e.key){case"ArrowLeft":case"ArrowRight":this._switchSectionOnArrowPress(e);break;case"Enter":case" ":this._selectSection(e)}}_switchSectionOnArrowPress(e){const i=e.key,r=i==="ArrowLeft"?-1:1,n=e.target.getAttribute("data-section-name"),s=this._sectionNames.indexOf(n),o=this._sectionNames;let l=null;s!==-1&&(o[s+r]?l=document.getElementById(o[s+r]):i==="ArrowLeft"?l=document.getElementById(o[o.length-1]):i==="ArrowRight"&&(l=document.getElementById(o[0])),l==null||l.focus())}_watchForSectionChanges(e){if(this._generateSectionNames(),e){e.forEach(r=>{const n=`activeLayerInfo-${r.layer.uid}-version-change`;this.removeHandles(n),this._watchForSectionChanges(r.children),this.addHandles(_e(()=>r.version,()=>this._generateSectionNames()),n)});const i="activeLayerInfos-collection-change";this.removeHandles(i),this.addHandles(e.on("change",()=>this._watchForSectionChanges(e)),i)}}_generateSectionNames(){this._sectionNames.length=0,this._selectedSectionName=null,this.activeLayerInfos&&this.activeLayerInfos.forEach(this._generateSectionNamesForActiveLayerInfo,this)}_getSectionName(e,i,r){return`${this.id}${e.uid}-type-${i.type}-${r}`}_generateSectionNamesForActiveLayerInfo(e){e.children.forEach(this._generateSectionNamesForActiveLayerInfo,this),e.legendElements&&e.legendElements.forEach((i,r)=>{this._sectionNames.push(this._getSectionName(e.layer,i,r))})}_renderLegendForLayer(e){if(!e.ready)return null;if(e.children.length){const i=e.children.map(r=>this._renderLegendForLayer(r)).toArray();return X("div",{class:this.classes(pi.service,pi.groupLayer),key:e.layer.uid},X("div",{class:pi.serviceCaptionContainer},e.title),i)}{const i=e.legendElements;if(i&&!i.length)return null;const r=i.some(o=>o.type==="relationship-ramp"),n=i.map((o,l)=>this._renderLegendForElement(o,e,l,r)).filter(o=>!!o);if(!n.length)return null;const s={[pi.groupLayerChild]:!!e.parent};return X("div",{class:this.classes(pi.service,s),key:e.layer.uid},X("div",{class:pi.serviceCaptionContainer},X("div",{class:pi.serviceCaptionText},e.title)),X("div",{class:pi.serviceContent},n))}}_renderLegendForElement(e,i,r,n=!1,s=!1){var I;const o=e.type==="color-ramp",l=e.type==="opacity-ramp",c=i.layer;let f=null;if(typeof e.title=="string")f=e.title;else if(e.title){const L=e.title,F=p2(this.messages,L,o||l);f=L.title?`${L.title} (${F})`:F}const _=this._getSectionName(c,e,r),x=this._hasIndicators&&!s?X("div",null,X(Im,{class:pi.carouselTitle,level:this.headingLevel},i.title),X(Im,{class:pi.layerCaption,level:_Ft(this.headingLevel)},f)):f?X(Im,{class:pi.layerCaption,level:this.headingLevel},f):null,T=i.effectList;let A=null;switch(e.type){case"symbol-table":{const L=e.infos.map((F,z)=>this._renderLegendForElementInfo(F,i,e.legendType,z)).filter(F=>!!F);if(L.length){const F=(I=L[0].properties.classes)==null?void 0:I[pi.symbolRow],z={[pi.labelContainer]:!F&&!n,[pi.relationshipLabelContainer]:n};A=X("div",{class:this.classes(z)},L)}break}case"color-ramp":case"opacity-ramp":case"heatmap-ramp":case"stretch-ramp":A=this._renderLegendForRamp(e,c.opacity,T);break;case"size-ramp":A=this._renderSizeRamp(e,c.opacity);break;case"pie-chart-ramp":A=this._renderPieChartRamp(e);break;case"relationship-ramp":A=bUe(e,this.id,{opacity:c.opacity,effectList:T,ariaLabel:this.messages.previewRelationshipRampAriaLabel});break;case"univariate-above-and-below-ramp":A=this._renderUnivariateAboveAndBelowRamp(e,c.opacity,T);break;case"univariate-color-size-ramp":A=this._renderUnivariateColorSizeRamp(e,c.opacity,T)}if(!A)return null;const M=X("div",{"aria-labelledby":_,class:pi.section,id:`${_}-panel`,key:_,role:"tabpanel",tabIndex:0},[x,A]);return s||this._sectionMap.set(_,M),M}_renderPieChartRamp(e){return X("div",{afterCreate:xl,bind:e.preview,class:pi.pieChartRampPreview})}_renderUnivariateAboveAndBelowRamp(e,i,r){var j;const{sizeRampElement:n,colorRampElement:s}=JUe(e,i,"horizontal");if(!n)return null;const o=bre(n,"full",!0,"horizontal"),l=PO(n,"above",!0,"horizontal"),c=PO(n,"below",!0,"horizontal"),f=12,_=(j=this.messages)==null?void 0:j.previewColorRampAriaLabel,x=OO(s,{width:l,height:f,rampAlignment:"horizontal",opacity:i,type:"above",effectList:r,ariaLabel:_}),T=OO(s,{width:c,height:f,rampAlignment:"horizontal",opacity:i,type:"below",effectList:r,ariaLabel:_}),A=OV(n,"card"),M=n.infos.map(H=>H.label),I=M.length-1,L=M.map((H,Y)=>Y===0||Y===I?X("div",{key:Y},H):null),F={display:"flex",flexDirection:"column"},z={display:"flex",flexDirection:"row"},k={marginTop:"3px",display:"flex"};RT(this.container)?k.marginRight=`${A}px`:k.marginLeft=`${A}px`;const U={width:`${o}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return X("div",{class:pi.layerRow,key:"size-ramp-preview",styles:F},X("div",{class:this.classes(pi.symbolContainer,pi.sizeRampHorizontal),styles:z},n.infos.map((H,Y)=>X("div",{afterCreate:xl,bind:H.preview,class:pi.symbol,key:Y}))),x?X("div",{class:pi.univariateAboveAndBelowColorRamp,key:"color-ramp-preview",styles:k},X("div",{afterCreate:xl,bind:x}),X("div",{afterCreate:xl,bind:T})):null,X("div",{class:pi.layerInfo},X("div",{class:pi.rampLabelsContainer,styles:U},L)))}_renderUnivariateColorSizeRamp(e,i,r){var L;const{sizeRampElement:n,colorRampElement:s}=KUe(e,"horizontal");if(!n)return null;const o=bre(n,"full",!1,"horizontal"),l=PO(n,"full",!1,"horizontal"),c=OO(s,{width:l,height:12,rampAlignment:"horizontal",opacity:i,type:"full",effectList:r,ariaLabel:(L=this.messages)==null?void 0:L.previewColorRampAriaLabel}),f=OV(n,"card"),_=n.infos.length-1,x=n.infos.map((F,z)=>z===0||z===_?X("div",{key:z},F.label):null),T={display:"flex",flexDirection:"column"},A={display:"flex",flexDirection:"row"},M={marginTop:"3px",display:"flex"};RT(this.container)?M.marginRight=`${f}px`:M.marginLeft=`${f}px`;const I={width:`${o}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return X("div",{class:pi.layerRow,key:"size-ramp-preview",styles:T},X("div",{class:this.classes(pi.symbolContainer,pi.sizeRampHorizontal),styles:A},n.infos.map((F,z)=>X("div",{afterCreate:xl,bind:F.preview,class:pi.symbol,key:z}))),X("div",{class:pi.univariateAboveAndBelowColorRamp,key:"color-ramp-preview",styles:M},X("div",{afterCreate:xl,bind:c})),X("div",{class:pi.layerInfo},X("div",{class:pi.rampLabelsContainer,styles:I},x)))}_renderLegendForElementInfo(e,i,r,n){var c,f,_,x,T;const s=i.layer;if(e.type)return this._renderLegendForElement(e,i,n,!1,!0);const o=eVe(s,r),l=p2(this.messages,e.label,!1)??"";if(e.preview){if(!((c=e.symbol)!=null&&c.type.includes("simple-fill"))){if(!e.label)return X("div",{afterCreate:xl,bind:e.preview,key:n});const re={[pi.symbolCell]:this._hasIndicators};return X("div",{class:this.classes(pi.layerRow,{[pi.symbolRow]:this._hasIndicators}),key:n},X("div",{afterCreate:xl,bind:e.preview,class:this.classes(re)}),X("div",{class:this.classes(pi.imageLabel,{[pi.labelCell]:this._hasIndicators})},l))}let A=255,M=255,I=255,L=0,F=255,z=255,k=255,U=0;const j=(f=e.symbol.color)==null?void 0:f.a,H=(x=(_=e.symbol.outline)==null?void 0:_.color)==null?void 0:x.a;j&&(A=e.symbol.color.r,M=e.symbol.color.g,I=e.symbol.color.b,L=e.symbol.color.a*s.opacity),H&&(F=e.symbol.outline.color.r,z=e.symbol.outline.color.g,k=e.symbol.outline.color.b,U=e.symbol.outline.color.a*s.opacity);const Y=((T=e.symbol.color)==null?void 0:T.isBright)??!0,Q=Y?"rgba(255, 255, 255, .6)":"rgba(0, 0, 0, .6)",ne={background:j?`rgba(${A}, ${M}, ${I}, ${L})`:"none",color:Y?"black":"white",textShadow:`-1px -1px 0 ${Q}, + */function k2e(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),i.push.apply(i,r)}return i}function o1(t){for(var e=1;e=0)&&(i[n]=t[n]);return i}function gFt(t,e){if(t==null)return{};var i=mFt(t,e),r,n;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(n=0;n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}var yFt="1.15.1";function p_(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var tb=p_(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),T6=p_(/Edge/i),z2e=p_(/firefox/i),eL=p_(/safari/i)&&!p_(/chrome/i)&&!p_(/android/i),_Ue=p_(/iP(ad|od|hone)/i),bUe=p_(/chrome/i)&&p_(/android/i),wUe={capture:!1,passive:!1};function qn(t,e,i){t.addEventListener(e,i,!tb&&wUe)}function Pn(t,e,i){t.removeEventListener(e,i,!tb&&wUe)}function IV(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function vFt(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function cy(t,e,i,r){if(t){i=i||document;do{if(e!=null&&(e[0]===">"?t.parentNode===i&&IV(t,e):IV(t,e))||r&&t===i)return t;if(t===i)break}while(t=vFt(t))}return null}var U2e=/\s+/g;function Ud(t,e,i){if(t&&e)if(t.classList)t.classList[i?"add":"remove"](e);else{var r=(" "+t.className+" ").replace(U2e," ").replace(" "+e+" "," ");t.className=(r+(i?" "+e:"")).replace(U2e," ")}}function Ii(t,e,i){var r=t&&t.style;if(r){if(i===void 0)return document.defaultView&&document.defaultView.getComputedStyle?i=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(i=t.currentStyle),e===void 0?i:i[e];!(e in r)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),r[e]=i+(typeof i=="string"?"":"px")}}function NO(t,e){var i="";if(typeof t=="string")i=t;else do{var r=Ii(t,"transform");r&&r!=="none"&&(i=r+" "+i)}while(!e&&(t=t.parentNode));var n=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return n&&new n(i)}function xUe(t,e,i){if(t){var r=t.getElementsByTagName(e),n=0,s=r.length;if(i)for(;n=s:o=n<=s,!o)return r;if(r===Vy())break;r=v2(r,!1)}return!1}function qP(t,e,i,r){for(var n=0,s=0,o=t.children;s2&&arguments[2]!==void 0?arguments[2]:{},n=r.evt,s=gFt(r,CFt);E6.pluginEvent.bind(tr)(e,i,o1({dragEl:Pt,parentEl:oa,ghostEl:xr,rootEl:Do,nextEl:mS,lastDownEl:Nk,cloneEl:Xo,cloneHidden:e2,dragStarted:V4,putSortable:pc,activeSortable:tr.active,originalEvent:n,oldIndex:QM,oldDraggableIndex:iL,newIndex:Xd,newDraggableIndex:jw,hideGhostForTarget:PUe,unhideGhostForTarget:RUe,cloneNowHidden:function(){e2=!0},cloneNowShown:function(){e2=!1},dispatchSortableEvent:function(a){$u({sortable:i,name:a,originalEvent:n})}},s))};function $u(t){EFt(o1({putSortable:pc,cloneEl:Xo,targetEl:Pt,rootEl:Do,oldIndex:QM,oldDraggableIndex:iL,newIndex:Xd,newDraggableIndex:jw},t))}var Pt,oa,xr,Do,mS,Nk,Xo,e2,QM,Xd,iL,jw,j8,pc,hM=!1,$V=!1,LV=[],l3,M0,yX,vX,j2e,G2e,V4,eA,rL,nL=!1,G8=!1,Fk,Bc,_X=[],_re=!1,DV=[],qG=typeof document<"u",H8=_Ue,H2e=T6||tb?"cssFloat":"float",AFt=qG&&!bUe&&!_Ue&&"draggable"in document.createElement("div"),AUe=function(){if(qG){if(tb)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),MUe=function(e,i){var r=Ii(e),n=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),s=qP(e,0,i),o=qP(e,1,i),a=s&&Ii(s),c=o&&Ii(o),p=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Wa(s).width,_=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+Wa(o).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(s&&a.float&&a.float!=="none"){var x=a.float==="left"?"left":"right";return o&&(c.clear==="both"||c.clear===x)?"vertical":"horizontal"}return s&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||p>=n&&r[H2e]==="none"||o&&r[H2e]==="none"&&p+_>n)?"vertical":"horizontal"},MFt=function(e,i,r){var n=r?e.left:e.top,s=r?e.right:e.bottom,o=r?e.width:e.height,a=r?i.left:i.top,c=r?i.right:i.bottom,p=r?i.width:i.height;return n===a||s===c||n+o/2===a+p/2},OFt=function(e,i){var r;return LV.some(function(n){var s=n[hp].options.emptyInsertThreshold;if(!(!s||vue(n))){var o=Wa(n),a=e>=o.left-s&&e<=o.right+s,c=i>=o.top-s&&i<=o.bottom+s;if(a&&c)return r=n}}),r},OUe=function(e){function i(s,o){return function(a,c,p,_){var x=a.options.group.name&&c.options.group.name&&a.options.group.name===c.options.group.name;if(s==null&&(o||x))return!0;if(s==null||s===!1)return!1;if(o&&s==="clone")return s;if(typeof s=="function")return i(s(a,c,p,_),o)(a,c,p,_);var S=(o?a:c).options.group.name;return s===!0||typeof s=="string"&&s===S||s.join&&s.indexOf(S)>-1}}var r={},n=e.group;(!n||Dk(n)!="object")&&(n={name:n}),r.name=n.name,r.checkPull=i(n.pull,!0),r.checkPut=i(n.put),r.revertClone=n.revertClone,e.group=r},PUe=function(){!AUe&&xr&&Ii(xr,"display","none")},RUe=function(){!AUe&&xr&&Ii(xr,"display","")};qG&&!bUe&&document.addEventListener("click",function(t){if($V)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),$V=!1,!1},!0);var c3=function(e){if(Pt){e=e.touches?e.touches[0]:e;var i=OFt(e.clientX,e.clientY);if(i){var r={};for(var n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);r.target=r.rootEl=i,r.preventDefault=void 0,r.stopPropagation=void 0,i[hp]._onDragOver(r)}}},PFt=function(e){Pt&&Pt.parentNode[hp]._isOutsideThisEl(e.target)};function tr(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=L_({},e),t[hp]=this;var i={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return MUe(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(o,a){o.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:tr.supportPointer!==!1&&"PointerEvent"in window&&!eL,emptyInsertThreshold:5};E6.initializePlugins(this,t,i);for(var r in i)!(r in e)&&(e[r]=i[r]);OUe(e);for(var n in this)n.charAt(0)==="_"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this));this.nativeDraggable=e.forceFallback?!1:AFt,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?qn(t,"pointerdown",this._onTapStart):(qn(t,"mousedown",this._onTapStart),qn(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(qn(t,"dragover",this),qn(t,"dragenter",this)),LV.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),L_(this,xFt())}tr.prototype={constructor:tr,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(eA=null)},_getDirection:function(e,i){return typeof this.options.direction=="function"?this.options.direction.call(this,e,i,Pt):this.options.direction},_onTapStart:function(e){if(e.cancelable){var i=this,r=this.el,n=this.options,s=n.preventOnFilter,o=e.type,a=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,c=(a||e).target,p=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||c,_=n.filter;if(kFt(r),!Pt&&!(/mousedown|pointerdown/.test(o)&&e.button!==0||n.disabled)&&!p.isContentEditable&&!(!this.nativeDraggable&&eL&&c&&c.tagName.toUpperCase()==="SELECT")&&(c=cy(c,n.draggable,r,!1),!(c&&c.animated)&&Nk!==c)){if(QM=pf(c),iL=pf(c,n.draggable),typeof _=="function"){if(_.call(this,e,c,this)){$u({sortable:i,rootEl:p,name:"filter",targetEl:c,toEl:r,fromEl:r}),gh("filter",i,{evt:e}),s&&e.cancelable&&e.preventDefault();return}}else if(_&&(_=_.split(",").some(function(x){if(x=cy(p,x.trim(),r,!1),x)return $u({sortable:i,rootEl:x,name:"filter",targetEl:c,fromEl:r,toEl:r}),gh("filter",i,{evt:e}),!0}),_)){s&&e.cancelable&&e.preventDefault();return}n.handle&&!cy(p,n.handle,r,!1)||this._prepareDragStart(e,a,c)}}},_prepareDragStart:function(e,i,r){var n=this,s=n.el,o=n.options,a=s.ownerDocument,c;if(r&&!Pt&&r.parentNode===s){var p=Wa(r);if(Do=s,Pt=r,oa=Pt.parentNode,mS=Pt.nextSibling,Nk=r,j8=o.group,tr.dragged=Pt,l3={target:Pt,clientX:(i||e).clientX,clientY:(i||e).clientY},j2e=l3.clientX-p.left,G2e=l3.clientY-p.top,this._lastX=(i||e).clientX,this._lastY=(i||e).clientY,Pt.style["will-change"]="all",c=function(){if(gh("delayEnded",n,{evt:e}),tr.eventCanceled){n._onDrop();return}n._disableDelayedDragEvents(),!z2e&&n.nativeDraggable&&(Pt.draggable=!0),n._triggerDragStart(e,i),$u({sortable:n,name:"choose",originalEvent:e}),Ud(Pt,o.chosenClass,!0)},o.ignore.split(",").forEach(function(_){xUe(Pt,_.trim(),bX)}),qn(a,"dragover",c3),qn(a,"mousemove",c3),qn(a,"touchmove",c3),qn(a,"mouseup",n._onDrop),qn(a,"touchend",n._onDrop),qn(a,"touchcancel",n._onDrop),z2e&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Pt.draggable=!0),gh("delayStart",this,{evt:e}),o.delay&&(!o.delayOnTouchOnly||i)&&(!this.nativeDraggable||!(T6||tb))){if(tr.eventCanceled){this._onDrop();return}qn(a,"mouseup",n._disableDelayedDrag),qn(a,"touchend",n._disableDelayedDrag),qn(a,"touchcancel",n._disableDelayedDrag),qn(a,"mousemove",n._delayedDragTouchMoveHandler),qn(a,"touchmove",n._delayedDragTouchMoveHandler),o.supportPointer&&qn(a,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(c,o.delay)}else c()}},_delayedDragTouchMoveHandler:function(e){var i=e.touches?e.touches[0]:e;Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Pt&&bX(Pt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Pn(e,"mouseup",this._disableDelayedDrag),Pn(e,"touchend",this._disableDelayedDrag),Pn(e,"touchcancel",this._disableDelayedDrag),Pn(e,"mousemove",this._delayedDragTouchMoveHandler),Pn(e,"touchmove",this._delayedDragTouchMoveHandler),Pn(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,i){i=i||e.pointerType=="touch"&&e,!this.nativeDraggable||i?this.options.supportPointer?qn(document,"pointermove",this._onTouchMove):i?qn(document,"touchmove",this._onTouchMove):qn(document,"mousemove",this._onTouchMove):(qn(Pt,"dragend",this),qn(Do,"dragstart",this._onDragStart));try{document.selection?kk(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,i){if(hM=!1,Do&&Pt){gh("dragStarted",this,{evt:i}),this.nativeDraggable&&qn(document,"dragover",PFt);var r=this.options;!e&&Ud(Pt,r.dragClass,!1),Ud(Pt,r.ghostClass,!0),tr.active=this,e&&this._appendGhost(),$u({sortable:this,name:"start",originalEvent:i})}else this._nulling()},_emulateDragOver:function(){if(M0){this._lastX=M0.clientX,this._lastY=M0.clientY,PUe();for(var e=document.elementFromPoint(M0.clientX,M0.clientY),i=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(M0.clientX,M0.clientY),e!==i);)i=e;if(Pt.parentNode[hp]._isOutsideThisEl(e),i)do{if(i[hp]){var r=void 0;if(r=i[hp]._onDragOver({clientX:M0.clientX,clientY:M0.clientY,target:e,rootEl:i}),r&&!this.options.dragoverBubble)break}e=i}while(i=i.parentNode);RUe()}},_onTouchMove:function(e){if(l3){var i=this.options,r=i.fallbackTolerance,n=i.fallbackOffset,s=e.touches?e.touches[0]:e,o=xr&&NO(xr,!0),a=xr&&o&&o.a,c=xr&&o&&o.d,p=H8&&Bc&&B2e(Bc),_=(s.clientX-l3.clientX+n.x)/(a||1)+(p?p[0]-_X[0]:0)/(a||1),x=(s.clientY-l3.clientY+n.y)/(c||1)+(p?p[1]-_X[1]:0)/(c||1);if(!tr.active&&!hM){if(r&&Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))=0&&($u({rootEl:oa,name:"add",toEl:oa,fromEl:Do,originalEvent:e}),$u({sortable:this,name:"remove",toEl:oa,originalEvent:e}),$u({rootEl:oa,name:"sort",toEl:oa,fromEl:Do,originalEvent:e}),$u({sortable:this,name:"sort",toEl:oa,originalEvent:e})),pc&&pc.save()):Xd!==QM&&Xd>=0&&($u({sortable:this,name:"update",toEl:oa,originalEvent:e}),$u({sortable:this,name:"sort",toEl:oa,originalEvent:e})),tr.active&&((Xd==null||Xd===-1)&&(Xd=QM,jw=iL),$u({sortable:this,name:"end",toEl:oa,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){gh("nulling",this),Do=Pt=oa=xr=mS=Xo=Nk=e2=l3=M0=V4=Xd=jw=QM=iL=eA=rL=pc=j8=tr.dragged=tr.ghost=tr.clone=tr.active=null,DV.forEach(function(e){e.checked=!0}),DV.length=yX=vX=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Pt&&(this._onDragOver(e),RFt(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],i,r=this.el.children,n=0,s=r.length,o=this.options;nn.right+s||t.clientY>r.bottom&&t.clientX>r.left:t.clientY>n.bottom+s||t.clientX>r.right&&t.clientY>r.top}function DFt(t,e,i,r,n,s,o,a){var c=r?t.clientY:t.clientX,p=r?i.height:i.width,_=r?i.top:i.left,x=r?i.bottom:i.right,S=!1;if(!o){if(a&&Fk_+p*s/2:cx-Fk)return-rL}else if(c>_+p*(1-n)/2&&cx-p*s/2)?c>_+p/2?1:-1:0}function NFt(t){return pf(Pt)$Ue(r))}const TX="root",Z2e={statusIndicators:!0,errors:!1};let Us=class extends hn{constructor(e,i){super(e,i),this._sortableNodes=new Map,this._sortableMap=new Map,this._focusSortUid=null,this._tooltipReferenceMap=new Map,this.visibleItems=null,this.iconClass=_i.widgetIcon,this.icon=null,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.selectionEnabled=!1,this.selectedItems=new UFt,this.style="classic",this.viewModel=new vUe,this.visibleElements={...Z2e},this._onSortableSort=({to:r,from:n,item:s,newIndex:o})=>{n&&r&&(n===r?this._sortLayers(this._sortableMap.get(n.dataset.group)):this._moveLayerFromChildList({to:r,from:n,item:s,newIndex:o}))},this._sortableCanSort=(r,n)=>!(!r.el.dataset.group||!n.el.dataset.group),this._sortableCanPull=(r,n,s)=>{const{listItemCanGiveFunction:o}=this,a={selected:Dl(s),from:Dl(n.el),to:Dl(r.el)};return!this._sortableCanSort(r,n)||typeof o!="function"||o.call(null,a)},this._sortableCanPut=(r,n,s)=>{const{listItemCanReceiveFunction:o}=this,a={selected:Dl(s),from:Dl(n.el),to:Dl(r.el)};return!this._sortableCanSort(r,n)||typeof o!="function"||o.call(null,a)},this._onSortableEnd=({oldIndex:r,from:n,to:s,item:o})=>{n!==s&&n.insertBefore(o,n.children[r])}}initialize(){const e=this.operationalItems;this._setVisibleItems(e),this.addHandles([Jr(()=>this.operationalItems,"change",()=>this._itemsChanged(e)),_e(()=>this.visibleElements,()=>this._itemsChanged(e)),_e(()=>this.selectionEnabled,()=>this._toggleAllSorting(),Qt)])}loadDependencies(){return Il({icon:()=>we(()=>import("./calcite-icon-ZhRmLRGh.js"),__vite__mapDeps([228,225,222])),tooltip:()=>we(()=>import("./calcite-tooltip-ewJ_kzN3.js"),__vite__mapDeps([231,232,233,227,234,235]))})}destroy(){this._destroySortables(),this._tooltipReferenceMap.clear()}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...Z2e,...e}}triggerAction(e,i){return this.viewModel.triggerAction(e,i)}render(){var a;const{visibleItems:e,style:i}=this,r=(a=this.viewModel)==null?void 0:a.state,n={[_i.newUI]:i==="modern",[it.hidden]:r==="loading",[it.disabled]:r==="disabled"},s=this._renderItemTooltips(),o=this._renderItems();return X("div",{class:this.classes(_i.base,it.widget,it.panel,n)},e.length?[s,o]:this._renderNoItems())}_renderItemTooltip(e){const{_tooltipReferenceMap:i,messages:r}=this;return e?X("calcite-tooltip",{referenceElement:i.get(e.uid)},r.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){const{incompatible:i,children:r}=e;return[i?this._renderItemTooltip(e):null,...!i&&r?r.toArray().map(n=>this._renderItemTooltipNodes(n)):[]]}_renderItemTooltips(){return this.visibleItems.toArray().map(e=>this._renderItemTooltipNodes(e))??[]}_renderNoItems(){return X("div",{class:_i.noItems},this.messages.noItemsToDisplay)}_renderItems(){const{visibleItems:e,selectionEnabled:i,messages:r}=this;return X("ul",{afterCreate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,afterUpdate:this._sortNodeCreated,"aria-label":r.widgetLabel,bind:this,class:this.classes(_i.list,_i.listRoot,_i.listIndependent),"data-group":TX,role:i?"listbox":void 0},e.map(n=>this._renderItem(n,null)).toArray())}_renderActionsMenuIcon(e,i){const{messagesCommon:r}=this,n={[_i.actionsMenuItemActive]:e.actionsOpen};return X("div",{"aria-controls":i,"aria-label":r.options,bind:this,class:this.classes(_i.actionsMenuItem,n),"data-item":e,key:"actions-menu-toggle",onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,role:"button",tabIndex:0,title:r.options},X("span",{"aria-hidden":"true",class:oi.handleHorizontal}))}_renderActionsMenu(e,i,r,n){const{panel:s}=e,o=s&&s.visible?this._renderPanelButton(s):null,a=r===1&&this._getSingleActionButton(i),c=a?this._renderAction({item:e,action:a,singleAction:!0}):null,p=!a&&r?this._renderActionsMenuIcon(e,n):null;return p||o||a?X("div",{class:_i.actionsMenu,key:"actions-menu"},o,c,p):null}_renderChildList(e,i){var S;const{selectionEnabled:r}=this,{visibilityMode:n,children:s}=e,o=this._hasChildren(e),a=!o&&r&&((S=e.layer)==null?void 0:S.type)==="group",{exclusive:c,inherited:p}=YR,_={[_i.listEmpty]:!o,[_i.listExclusive]:n===c,[_i.listInherited]:n===p,[_i.listIndependent]:n!==p&&n!==c},x={[_i.listEmptyState]:!0,[_i.listEmptyStateDragEnabled]:r};return o||a?o?X("ul",{afterCreate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,afterUpdate:this._sortNodeCreated,"aria-expanded":e.open?"true":"false",bind:this,class:this.classes(_i.list,_),"data-group":e.uid,"data-item":e,hidden:!e.open&&!a||null,id:i,key:"list-items",role:r?"listbox":n===c?"radiogroup":"group"},s==null?void 0:s.map(C=>this._renderItem(C,e)).toArray()):X("div",{afterCreate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,afterUpdate:this._sortNodeCreated,bind:this,class:this.classes(x),"data-group":e.uid,"data-item":e,id:i,key:"list-items"},this.messages.noItemsToDisplay):null}_renderChildrenToggle(e,i){const{messagesCommon:r}=this,n=this._hasChildren(e),s={[_i.childToggleOpen]:e.open},o=e.open?r.collapse:r.expand;return n?X("span",{"aria-controls":i,"aria-label":o,class:this.classes(_i.childToggle,s),"data-item":e,key:"toggle-children",onclick:this._toggleChildrenClick,onkeydown:this._toggleChildrenClick,role:"button",tabIndex:0,title:o},X("span",{"aria-hidden":"true",class:this.classes(_i.childClosed,oi.rightTriangleArrow)}),X("span",{"aria-hidden":"true",class:this.classes(_i.childOpened,oi.downArrow)}),X("span",{"aria-hidden":"true",class:this.classes(_i.childClosed_RTL,oi.leftTriangleArrow)})):null}_renderItemMessage(e){return e.error?X("div",{class:_i.message,key:"esri-layer-list__error",role:"alert"},X("span",{"aria-hidden":"true",class:oi.noticeTriangle}),this.messages.layerError):e.incompatible?X("div",{class:_i.message,key:"esri-layer-list__incompatible",role:"alert"},X("span",{afterCreate:i=>this._setTooltipReference(i,e),"aria-hidden":"true",bind:this,class:oi.noticeTriangle,tabIndex:0}),this.messages.layerIncompatible):null}_renderItemContent(e,i,r){const{id:n}=this,s=`${n}_${e.uid}`,o=`${s}_actions`,a=`${s}__list`,{panel:c}=e,p=this._filterActions(e.actionsSections),_=this._countActions(p);return[X("div",{class:_i.itemContainer,key:"list-item-container"},this._renderChildrenToggle(e,a),this._renderLabel(e,i,r),this._renderActionsMenu(e,p,_,o)),this._renderItemMessage(e),_?this._renderActionsSections(e,p,o):null,c&&c.open&&!c.disabled?c.render():null,this._renderChildList(e,a)]}_renderItem(e,i){var x;const{style:r,id:n,selectionEnabled:s,selectedItems:o}=this,a=`${`${n}_${e.uid}`}__title`,c=this._hasMessage(e),p=this._hasChildren(e),_={[_i.itemChildren]:p,[_i.itemMessage]:!!c,[_i.itemInvisible]:r==="modern"&&!e.visible,[_i.itemInvisibleAtScale]:!e.visibleAtCurrentScale,[_i.itemSelectable]:s};if(s){const S={[X2e]:(x=e.layer)==null?void 0:x.uid,[Y2e]:(!e.sortable).toString()};return X("li",{afterCreate:this._focusListItem,afterUpdate:this._focusListItem,"aria-labelledby":a,"aria-selected":pX(e,o)?"true":"false",bind:this,class:this.classes(_i.item,_),"data-group":i?i.uid:TX,"data-item":e,key:`item-with-selection-${e.uid}`,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,role:"option",tabIndex:0,...S},this._renderItemContent(e,i,a))}return X("li",{afterCreate:this._focusListItem,afterUpdate:this._focusListItem,"aria-labelledby":a,bind:this,class:this.classes(_i.item,_),key:`item-no-selection-${e.uid}`},this._renderItemContent(e,i,a))}_renderConnectionIcon(e){const{connectionStatus:i}=e;return i!=null?X("calcite-icon",{icon:i==="connected"?"beacon":"offline",scale:"s"}):null}_renderItemStatus(e,i){const{visibleElements:r}=this;if(!r.statusIndicators)return null;const{connectionStatus:n,publishing:s,updating:o}=e,a=o&&!i,c=!!n;return X("span",{class:this.classes({[_i.statusIndicator]:!0,[_i.publishing]:s,[_i.updating]:a,[_i.connectionStatus]:c,[_i.connectionStatusConnected]:c&&n==="connected"}),key:"layer-item-status"},this._renderConnectionIcon(e))}_renderItemTitle(e,i){const{messages:r}=this;if(!e)return null;const n=e.title||r.untitledLayer,s=e.visibleAtCurrentScale?n:`${n} (${r.layerInvisibleAtScale})`;return X("span",{"aria-label":s,class:_i.title,id:i,key:"layer-title-container",title:s},n)}_renderItemToggleIcon({visible:e},i){const{style:r}=this,{exclusive:n}=YR,s=i==null?void 0:i.visibilityMode,o=r==="modern",a=s===n,c={[_i.toggleVisibleIcon]:o,[_i.toggleIcon]:o&&!a,[_i.radioIcon]:o&&a,[oi.radioChecked]:a&&e,[oi.radioUnchecked]:a&&!e,[oi.visible]:!a&&e,[oi.nonVisible]:!a&&!e};return X("span",{"aria-hidden":"true",class:this.classes(c),key:"item-toggle-icon"})}_renderItemToggle(e,i,r){const{selectionEnabled:n,messages:s}=this,{exclusive:o}=YR,a=i==null?void 0:i.visibilityMode,c=a===o?"radio":"switch";return X("span",n?{"aria-checked":e.visible?"true":"false","aria-labelledby":r,bind:this,class:_i.toggleVisible,"data-item":e,"data-parent-visibility":a,key:"item-toggle-selection-enabled",onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,role:c,tabIndex:0,title:s.layerVisibility}:{class:_i.toggleVisible,key:"item-toggle"},this._renderItemToggleIcon(e,i))}_renderLabel(e,i,r){const{selectionEnabled:n,style:s,messages:o}=this,{inherited:a,exclusive:c}=YR,p=i==null?void 0:i.visibilityMode,_=p===c?"radio":"switch",x=this._renderItemTitle(e,r),S=this._renderItemStatus(e,i),C=this._renderItemToggle(e,i,r),M=s==="modern"?[x,S,C]:[C,x,S],P=X("div",n?{class:_i.label,key:`item-label-no-selection-${e.uid}`}:{"aria-checked":e.visible?"true":"false","aria-labelledby":r,bind:this,class:_i.label,"data-item":e,"data-parent-visibility":p,key:`item-label-with-selection-${e.uid}`,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,role:_,tabIndex:0,title:o.layerVisibility},M);return p===a||e.error?X("div",{class:_i.label,key:`item-label-container-${e.uid}`},this._renderItemTitle(e,r),this._renderItemStatus(e,i)):P}_renderPanelButton(e){const{className:i,open:r,title:n,image:s,disabled:o}=e,a=s||i?i:oi.defaultAction,c=this._getIconImageStyles(e),p={[_i.actionsMenuItemActive]:r&&!o},_={[_i.actionImage]:!!c["background-image"],[it.disabledElement]:e.disabled};return a&&(_[a]=!!a),X("div",{"aria-disabled":e.disabled.toString(),"aria-label":n,bind:this,class:this.classes(_i.actionsMenuItem,p),"data-panel":e,key:`panel-${e.uid}`,onclick:this._triggerPanel,onkeydown:this._triggerPanel,role:"button",tabIndex:e.disabled?void 0:0,title:n},X("span",{class:this.classes(_),styles:c}))}_renderActionsSections(e,i,r){const n=i.toArray().map((s,o)=>X("ul",{class:_i.actionsList,key:`${e}-action-section-${o}`},this._renderActionSection(e,s)));return X("div",{"aria-expanded":e.actionsOpen?"true":"false",class:_i.actions,hidden:!e.actionsOpen||null,id:r,key:"actions-section",role:"group"},n)}_renderActionSection(e,i){return(i&&i.toArray()).map(r=>this._renderAction({item:e,action:r}))}_renderActionIcon(e){const{active:i,className:r}=e,n=this._getIconImageStyles(e),s=e.type!=="button"||e.image||r?r:oi.defaultAction,o={[_i.actionImage]:!i&&!!n["background-image"],[oi.loadingIndicator]:i,[it.rotating]:i};return s&&!i&&(o[s]=!0),X("span",{"aria-hidden":"true",class:this.classes(_i.actionIcon,o),key:"action-icon",styles:n})}_renderActionTitle(e,i){return i?null:X("span",{class:_i.actionTitle,key:"action-title"},e)}_renderAction(e){const{item:i,action:r,singleAction:n}=e,{active:s,disabled:o,title:a}=r,c={[_i.actionsMenuItem]:n&&r.type==="button",[_i.action]:s||!n&&r.type!=="toggle",[_i.actionToggle]:!s&&r.type==="toggle",[_i.actionToggleOn]:!s&&r.type==="toggle"&&r.value,[it.disabledElement]:o},p=[this._renderActionIcon(r),this._renderActionTitle(a,n)];return n?X("div",{"aria-label":a??void 0,bind:this,classes:c,"data-action":r,"data-item":i,key:`single-action-${r.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,role:"button",tabIndex:0,title:a??void 0},p):X("li",{"aria-label":a??void 0,bind:this,classes:c,"data-action":r,"data-item":i,key:`action-${r.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,role:"button",tabIndex:0,title:a??void 0},p)}_setTooltipReference(e,i){this._tooltipReferenceMap.set(i.uid,e),this.scheduleRender()}_hasMessage(e){return!!e.error||e.incompatible}_hasChildren(e){return!!e.children.length&&!this._hasMessage(e)}_sortNodeRemoved(e){const{_sortableMap:i}=this,r=e.dataset.group,n=i.get(r);n&&n.destroy(),i.delete(r)}_destroySortables(){const{_sortableMap:e,_sortableNodes:i}=this;e.forEach(r=>r&&r.destroy()),e.clear(),i.clear()}_moveLayerFromChildList({to:e,from:i,item:r,newIndex:n}){const s=Dl(r),o=Dl(e),a=Dl(i);this.viewModel.moveListItem(s,a,o,n)}_sortLayers(e){var n,s;if(!e)return;const i=Dl(e.el),r=e.toArray();i?rFt(i,r):dUe((s=(n=this.view)==null?void 0:n.map)==null?void 0:s.layers,r)}_toggleSorting(e,i){const{_sortableMap:r,selectionEnabled:n}=this,s=r.get(i),o=Dl(e),a=(i===TX||(o==null?void 0:o.childrenSortable)&&eFt(o))&&n;if(s)s.option("disabled",!a);else if(a){const c=tr.create(e,{dataIdAttr:X2e,group:{name:i,pull:this._sortableCanPull,put:this._sortableCanPut},filter:`[${Y2e}="true"]`,fallbackTolerance:4,onSort:this._onSortableSort,onEnd:this._onSortableEnd,disabled:!a,chosenClass:_i.sortableChosen});r.set(i,c)}}_toggleAllSorting(){this._sortableNodes.forEach((e,i)=>this._toggleSorting(e,i))}_sortNodeCreated(e){const i=e.dataset.group;i&&(this._sortableNodes.set(i,e),this._toggleSorting(e,i))}_setVisibleItems(e){this.visibleItems=e.filter(i=>!i.hidden&&(this.visibleElements.errors||!i.error))}_getSingleActionButton(e){return e.reduce(i=>i).filter(i=>i&&i.type==="button").at(0)}_focusListItem(e){var n;const{_focusSortUid:i}=this;if(!e||!i)return;const r=Dl(e);((n=r==null?void 0:r.layer)==null?void 0:n.uid)===i&&(e.focus(),this._focusSortUid=null)}_watchActionSectionChanges(e){this.addHandles(e.on("change",this.scheduleRender.bind(this)),zb.actionSection),e.forEach(i=>this._renderOnActionChanges(i))}_renderOnActionChanges(e){e.type!=="toggle"?e.type!=="slider"?this.addHandles(_e(()=>[e==null?void 0:e.className,e==null?void 0:e.image,e==null?void 0:e.id,e==null?void 0:e.title,e==null?void 0:e.visible],()=>this.scheduleRender(),Qt),zb.actions):this.addHandles(_e(()=>[e==null?void 0:e.className,e==null?void 0:e.id,e==null?void 0:e.title,e==null?void 0:e.visible,e==null?void 0:e.value,e==null?void 0:e.displayValueEnabled,e==null?void 0:e.max,e==null?void 0:e.min,e==null?void 0:e.step],()=>this.scheduleRender(),Qt),zb.actions):this.addHandles(_e(()=>[e==null?void 0:e.className,e==null?void 0:e.image,e==null?void 0:e.id,e==null?void 0:e.title,e==null?void 0:e.visible,e==null?void 0:e.value],()=>this.scheduleRender(),Qt),zb.actions)}_renderOnItemChanges(e){this.addHandles([_e(()=>{var i,r,n;return[e==null?void 0:e.actionsOpen,e==null?void 0:e.visible,e==null?void 0:e.open,e==null?void 0:e.updating,e==null?void 0:e.connectionStatus,e==null?void 0:e.publishing,e==null?void 0:e.title,e==null?void 0:e.visibleAtCurrentScale,e==null?void 0:e.error,e==null?void 0:e.visibilityMode,e==null?void 0:e.panel,(i=e==null?void 0:e.panel)==null?void 0:i.title,(r=e==null?void 0:e.panel)==null?void 0:r.content,(n=e==null?void 0:e.panel)==null?void 0:n.className,e==null?void 0:e.sortable,e==null?void 0:e.childrenSortable]},()=>this.scheduleRender(),kt),_e(()=>[e==null?void 0:e.hidden,e==null?void 0:e.error],()=>this._setVisibleItems(this.operationalItems)),e.actionsSections.on("change",()=>this.scheduleRender()),e.children.on("change",()=>this.scheduleRender())],zb.items),e.children.forEach(i=>this._renderOnItemChanges(i)),e.actionsSections.forEach(i=>this._watchActionSectionChanges(i))}_itemsChanged(e){this.removeHandles(zb.items),this.removeHandles(zb.actions),this.removeHandles(zb.actionSection),e.forEach(i=>this._renderOnItemChanges(i)),this._tooltipReferenceMap.clear(),this._setVisibleItems(e),this.scheduleRender()}_filterActions(e){return e.map(i=>i.filter(r=>r.visible))}_countActions(e){return e.reduce((i,r)=>i+r.length,0)}_getIconImageStyles(e){const i=e.declaredClass==="esri.widgets.LayerList.ListItemPanel"||e.declaredClass==="esri.support.Action.ActionButton"||e.declaredClass==="esri.support.Action.ActionToggle"?e.image:null;return{"background-image":i?`url("${i}")`:void 0}}_selectionKeydown(e){var M,P,$,F;const i=["ArrowDown","ArrowUp"],r=Mf(e);if(!i.includes(r))return void this._toggleSelection(e);e.stopPropagation();const n=e.currentTarget,s=Dl(n),{_sortableMap:o,selectedItems:a}=this,c=n.dataset.group,p=o.get(c);if(!p||!s)return;const _=pX(s,a),x=p.toArray(),S=e.target,C=x.indexOf(S.dataset[VFt]);if(C!==-1){if(r==="ArrowDown"){const z=C+1;if(z>=x.length)return;_?(W2e(x,C,z),p.sort(x),this._sortLayers(p),this._focusSortUid=(M=s.layer)==null?void 0:M.uid):(this._focusSortUid=(P=s.layer)==null?void 0:P.uid,this.scheduleRender())}if(r==="ArrowUp"){const z=C-1;if(z<=-1)return;_?(W2e(x,C,z),p.sort(x),this._sortLayers(p),this._focusSortUid=($=s.layer)==null?void 0:$.uid):(this._focusSortUid=(F=s.layer)==null?void 0:F.uid,this.scheduleRender())}}}_toggleActionsOpen(e){const i=Dl(e.currentTarget);if(!i)return;const{actionsOpen:r}=i,n=!r;n&&this.operationalItems.forEach(s=>$Ue(s)),i.actionsOpen=n,e.stopPropagation()}_triggerPanel(e){const i=BFt(e.currentTarget);e.stopPropagation(),i&&!i.disabled&&(i.open=!i.open)}_triggerAction(e){const i=e.currentTarget,r=jFt(i),n=Dl(i);r&&n&&(r.type==="toggle"&&(r.value=!r.value),this.triggerAction(r,n),e.stopPropagation())}_toggleVisibility(e){const i=e.currentTarget,r=i.getAttribute("data-parent-visibility"),n=Dl(i);n&&(r===YR.exclusive&&n.visible||(n.visible=!n.visible),e.stopPropagation())}_toggleChildrenClick(e){const i=Dl(e.currentTarget);i&&(i.open=!i.open,e.stopPropagation())}_toggleSelection(e){var a,c;e.stopPropagation();const{multipleSelectionEnabled:i,selectedItems:r}=this,n=Dl(e.currentTarget);if(!n)return;const s=pX(n,r),{length:o}=r;if(!i)return o&&!(s&&o===1)?(r.removeAll(),void r.add(n)):void(s?(a=r.remove)==null?void 0:a.call(r,s):r.add(n));s?(c=r.remove)==null||c.call(r,s):r.add(n)}get test(){return{visibleItems:this.visibleItems}}};function Dl(t){return t==null?void 0:t["data-item"]}function BFt(t){return t==null?void 0:t["data-panel"]}function jFt(t){return t==null?void 0:t["data-action"]}y([w()],Us.prototype,"visibleItems",void 0),y([w()],Us.prototype,"iconClass",void 0),y([w()],Us.prototype,"icon",void 0),y([w()],Us.prototype,"label",null),y([w()],Us.prototype,"listItemCanGiveFunction",void 0),y([w()],Us.prototype,"listItemCanReceiveFunction",void 0),y([w()],Us.prototype,"listItemCreatedFunction",null),y([w(),Gr("esri/widgets/LayerList/t9n/LayerList")],Us.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],Us.prototype,"messagesCommon",void 0),y([w()],Us.prototype,"multipleSelectionEnabled",void 0),y([w()],Us.prototype,"operationalItems",null),y([w()],Us.prototype,"selectionEnabled",void 0),y([w()],Us.prototype,"selectedItems",void 0),y([w()],Us.prototype,"style",void 0),y([w()],Us.prototype,"view",null),y([gue("trigger-action"),w({type:vUe})],Us.prototype,"viewModel",void 0),y([w()],Us.prototype,"visibleElements",void 0),y([Ci("visibleElements")],Us.prototype,"castVisibleElements",null),y([wo()],Us.prototype,"_toggleActionsOpen",null),y([wo()],Us.prototype,"_triggerPanel",null),y([wo()],Us.prototype,"_triggerAction",null),y([wo()],Us.prototype,"_toggleVisibility",null),y([wo()],Us.prototype,"_toggleChildrenClick",null),y([wo()],Us.prototype,"_toggleSelection",null),Us=y([Z("esri.widgets.LayerList")],Us);const LUe=Us;let xw=class extends ze{constructor(e){super(e),this._viewpointHandle=null,this.group=null}initialize(){this.addHandles(Jr(()=>{var e;return(e=this.view)==null?void 0:e.ui},"expand",e=>{const{target:i}=e;i&&i!==this&&i.expanded&&i.group&&i.group===this.group&&this._collapse()}))}destroy(){this._viewpointHandle=null,this.view=null}set autoCollapse(e){this._set("autoCollapse",e),this._watchViewpoint()}set expanded(e){var n;const i=!!e;this._set("expanded",i);const r=(n=this.view)==null?void 0:n.ui;r&&r.emit("expand",{target:this}),this._viewpointHandleChange(i)}get state(){var e;return(e=this.view)!=null&&e.ready?"ready":"disabled"}set view(e){this._get("view")!==e&&(this._set("view",e),e&&Oo(()=>e.ready,()=>{this.view===e&&this._watchViewpoint()},{once:!0,initial:!0}))}_viewpointHandleChange(e){this._viewpointHandle&&(e?Oo(()=>{var i;return(i=this.view)==null?void 0:i.stationary},()=>{var i;return(i=this._viewpointHandle)==null?void 0:i.resume()},{once:!0,initial:!0}):this._viewpointHandle.pause())}_watchViewpoint(){const e="viewpoint";this.removeHandles(e),this._viewpointHandle=null;const{autoCollapse:i,view:r}=this;if(!r||!i)return;const n=Ftt(()=>r.type==="3d"?r.camera:r.viewpoint,()=>this._collapse());this.addHandles(n,e),this._viewpointHandle=n}_collapse(){this.expanded=!1}};y([w({value:!1})],xw.prototype,"autoCollapse",null),y([w({value:!1})],xw.prototype,"expanded",null),y([w()],xw.prototype,"group",void 0),y([w({readOnly:!0})],xw.prototype,"state",null),y([w({value:null})],xw.prototype,"view",null),xw=y([Z("esri.widgets.Expand.ExpandViewModel")],xw);const DUe=xw,yh="esri-expand",jc={base:yh,modeAuto:`${yh}--auto`,modeDrawer:`${yh}--drawer`,modeFloating:`${yh}--floating`,container:`${yh}__container`,containerExpanded:`${yh}__container--expanded`,panel:`${yh}__panel`,icon:"esri-collapse__icon",iconExpanded:`${yh}__icon--expanded`,iconNumber:`${yh}__icon-number`,iconNumberExpanded:`${yh}__icon-number--expanded`,content:`${yh}__content`,contentExpanded:`${yh}__content--expanded`,expandMask:`${yh}__mask`,expandMaskExpanded:`${yh}__mask--expanded`};let po=class extends hn{constructor(e,i){super(e,i),this.closeOnEsc=!0,this.collapseIcon=null,this.collapseTooltip="",this.content="",this.expandTooltip="",this.iconClass=null,this.icon=null,this.iconNumber=0,this.messages=null,this.messagesCommon=null,this.mode="auto",this.viewModel=new DUe,this._handleKeyDown=r=>{const{closeOnEsc:n,_toggleButtonEl:s,expanded:o}=this;!o||!n||r.target===s||r.key!=="Escape"||(typeof n=="function"?n(r):n)&&(this.expanded=!1,s==null||s.focus())}}loadDependencies(){return Il({icon:()=>we(()=>import("./calcite-icon-ZhRmLRGh.js"),__vite__mapDeps([228,225,222]))})}get contentId(){return`${this.id}_controls_content`}get expandTitle(){const{expanded:e,messagesCommon:i,collapseTooltip:r,expandTooltip:n}=this;return(e?r||(i==null?void 0:i.collapse):n||(i==null?void 0:i.expand))??""}get autoCollapse(){return this.viewModel.autoCollapse}set autoCollapse(e){this.viewModel.autoCollapse=e}get collapseIconClass(){return oi.collapse}set collapseIconClass(e){this._overrideIfSome("collapseIconClass",e)}get expanded(){return this.viewModel.expanded}set expanded(e){this.viewModel.expanded=e}get expandIconClass(){return Q$(this.content)?this.content.iconClass:oi.expand}set expandIconClass(e){this._overrideIfSome("expandIconClass",e)}get expandIcon(){return Q$(this.content)?this.content.icon:void 0}set expandIcon(e){this._overrideIfSome("expandIcon",e)}get group(){return this.viewModel.group}set group(e){this.viewModel.group=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}expand(){this.viewModel.expanded=!0}collapse(){this.viewModel.expanded=!1}toggle(){this.viewModel.expanded=!this.viewModel.expanded}render(){const{mode:e}=this,i={[jc.modeAuto]:e==="auto",[jc.modeDrawer]:e==="drawer",[jc.modeFloating]:e==="floating"};return X("div",{class:this.classes(jc.base,it.widget,i),onkeydown:this._handleKeyDown},this._renderMask(),this._renderContainer())}_renderContainer(){const{expanded:e}=this,i={[jc.containerExpanded]:e};return X("div",{class:this.classes(jc.container,i)},this._renderPanel(),this._renderContent())}_renderMask(){const{expanded:e}=this,i={[jc.expandMaskExpanded]:e};return X("div",{bind:this,class:this.classes(jc.expandMask,i),onclick:this._toggle})}_renderBadgeNumber(){const{expanded:e,iconNumber:i}=this;return i&&!e?X("span",{class:jc.iconNumber,key:"expand__icon-number"},i):null}_renderPanelNumber(){const{iconNumber:e,expanded:i}=this;return e&&i?X("span",{class:this.classes(jc.iconNumber,jc.iconNumberExpanded),key:"expand__expand-icon-number"},e):null}_renderIcon(){const e=(this.expanded?this.collapseIcon:this.expandIcon)??"";return X("calcite-icon",{icon:e,key:"icon",scale:"s"})}_renderLegacyIcon(){const{collapseIconClass:e,expandIconClass:i,expanded:r}=this,n={[jc.iconExpanded]:r};return i!=null&&(n[i]=!r),e!=null&&(n[e]=e===i||r),X("span",{"aria-hidden":"true",class:this.classes(jc.icon,n),key:"legacy-icon"})}_renderTitle(){return X("span",{class:oi.fontFallbackText},this.expandTitle)}_renderExpandButton(){const{expanded:e,expandTitle:i,expandIcon:r,collapseIcon:n,contentId:s}=this;return X("div",{afterCreate:this._storeToggleButtonEl,"aria-controls":s,"aria-expanded":e?"true":"false",bind:this,class:it.widgetButton,onclick:this._toggle,onkeydown:this._toggle,role:"button",tabIndex:0,title:i},this._renderBadgeNumber(),!e&&r!=null||e&&n!=null?this._renderIcon():this._renderLegacyIcon(),this._renderTitle())}_renderPanel(){return X("div",{class:jc.panel},this._renderExpandButton(),this._renderPanelNumber())}_renderContent(){const{expanded:e,contentId:i,content:r}=this,n={[jc.contentExpanded]:e},s={id:i,role:"region",class:this.classes(jc.content,n)};return typeof r=="string"?X("div",{innerHTML:r,key:"content__string",...s}):Q$(r)?X("div",{key:"content__widget",...s},r.render()):r instanceof HTMLElement?X("div",{afterCreate:this._attachToNode,bind:r,key:"content__html-element",...s}):lFt(r)?X("div",{afterCreate:this._attachToNode,bind:r.domNode,key:"content__node",...s}):null}_toggle(){this.toggle()}_attachToNode(e){const i=this;e.appendChild(i)}_storeToggleButtonEl(e){this._toggleButtonEl=e}};y([w({readOnly:!0})],po.prototype,"contentId",null),y([w({readOnly:!0})],po.prototype,"expandTitle",null),y([w()],po.prototype,"autoCollapse",null),y([w()],po.prototype,"closeOnEsc",void 0),y([w()],po.prototype,"collapseIconClass",null),y([w()],po.prototype,"collapseIcon",void 0),y([w()],po.prototype,"collapseTooltip",void 0),y([w()],po.prototype,"content",void 0),y([w()],po.prototype,"expanded",null),y([w()],po.prototype,"expandIconClass",null),y([w()],po.prototype,"expandIcon",null),y([w()],po.prototype,"expandTooltip",void 0),y([w()],po.prototype,"group",null),y([w()],po.prototype,"iconClass",void 0),y([w()],po.prototype,"icon",void 0),y([w()],po.prototype,"iconNumber",void 0),y([w()],po.prototype,"label",null),y([w(),Gr("esri/widgets/Expand/t9n/Expand")],po.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],po.prototype,"messagesCommon",void 0),y([w()],po.prototype,"mode",void 0),y([w()],po.prototype,"view",null),y([w({type:DUe})],po.prototype,"viewModel",void 0),y([wo()],po.prototype,"_toggle",null),po=y([Z("esri.widgets.Expand")],po);async function GFt(t,e={}){const{basemap:i,view:r}=t;await i.load(e),qFt(i),await YFt(i,r,e),St(e)}async function HFt(t,e={}){var o;const{basemap:i,view:r}=t;if(St(e),!r||"spatialReferenceLocked"in r&&!r.spatialReferenceLocked||(await i.load(e),St(e),i.baseLayers.length===0))return;const n=i.baseLayers.at(0);if(!pO(n))return;if(i.spatialReference){if(r.spatialReference.equals(i.spatialReference))return;J2e()}await n.load(e),St(e);const s=(("supportedSpatialReferences"in n?n.supportedSpatialReferences:null)||["tileInfo"in n?(o=n.tileInfo)==null?void 0:o.spatialReference:null]).filter(ys);s.length!==0&&s.every(a=>!r.spatialReference.equals(a))&&J2e()}function J2e(){throw new se("basemap-compatibility:incompatible-spatial-reference","Basemap spatial reference is not compatible with the view")}function qFt(t){if(t.baseLayers.length===0&&t.referenceLayers.length===0)return;const e=t.baseLayers.concat(t.referenceLayers).toArray().filter(i=>!Sit(i)).map(i=>WFt(i));if(e.length)throw e[0]}function WFt(t){return new se("basemap-compatibility:unsupported-basemap-layer-type","Unsupported basemap layer type ${operationalLayerType}",{layer:t,operationalLayerType:t.operationalLayerType||"unknown"})}async function YFt(t,e,i){if(t.baseLayers.length===0)return;const r=t.baseLayers.at(0);if(uOe(r)){try{await r.load(i)}catch(n){const s="basemap-compatibility:unknown-error",o="Unknown basemap compatibility error",{name:a=s,message:c=o,details:p}=n;throw new se(a,c,p)}XFt(r,e)}}function XFt(t,e){var c;const i=e.state.viewingMode;if(!i)return;let r,n;if((t==null?void 0:t.type)==="wmts"){const p=Y7e(t,e.spatialReference,i);if(p.tileInfo==null)throw new se("basemapgalleryitem:tiling-scheme-incompatible","Basemap tiling scheme is incompatible with the view");r=p.tileInfo,n=p.fullExtent}else r=t.tileInfo,n=t.fullExtent;if(r==null)return;if(!xP(r.spatialReference,i))throw new se(`basemapgalleryitem:spatial-reference-unsupported-${b$(i)}`,`Basemap spatial reference is unsupported in ${b$(i)} mode`);const s=r.spatialReference.isGeographic,o=(t==null?void 0:t.type)==="vector-tile"?r.getOrCreateCompatible(256,s?1:2):null;if(i===_t.Global){let p=a9(r,n,null,i);if(p&&(t==null?void 0:t.type)==="vector-tile"&&n!=null&&o&&!a9(o,n,null,i)&&(p=null),p){const _=r.spatialReference.isWebMercator?"web-mercator":"wgs84";throw new se(`basemapgalleryitem:tiling-scheme-unsupported-${_}-global`,"Basemap tiling scheme is unsupported in global mode",{error:p})}}else if(Gu.checkUnsupported(r))throw new se("basemapgalleryitem:tiling-scheme-unsupported-local","Basemap tiling scheme is unsupported in local mode");const a=(c=e.basemapTerrain)==null?void 0:c.tilingScheme;if(a&&!a.compatibleWith(r)&&((t==null?void 0:t.type)!=="vector-tile"||!o||!a.compatibleWith(o)))throw new se("basemapgalleryitem:tiling-scheme-incompatible","Basemap tiling scheme is incompatible with the view")}let Hg=class extends z_(ze){constructor(e){super(e),this.compatibilityFunction=null,this.error=null,this.state="loading",this.view=null}initialize(){const e=()=>this.refresh();this.addHandles([_e(()=>{var i;return(i=this.basemap)==null?void 0:i.loadStatus},e),_e(()=>this.compatibilityFunction,e),_e(()=>{var i;return this.view&&"basemapTerrain"in this.view&&((i=this.view.basemapTerrain)==null?void 0:i.tilingScheme)},e),_e(()=>{var i;return(i=this.view)==null?void 0:i.ready},e),_e(()=>{var i;return(i=this.view)==null?void 0:i.spatialReference},e)]),this.refresh()}destroy(){this._cancelRefresh(),this.basemap=null,this.compatibilityFunction=null,this.view=null}get _spatialReferenceTask(){return Put(this.view,this.basemap)}set basemap(e){e&&e.load().catch(()=>{}),this._set("basemap",e)}get spatialReference(){return this._spatialReferenceTask.spatialReference}refresh(){var n;this._cancelRefresh(),this._set("state","loading");const e=(n=this.basemap)==null?void 0:n.loadStatus;if(e!=="loaded"&&e!=="failed")return;if(!this.compatibilityFunction)return void(e==="loaded"?(this._set("state","ready"),this._set("error",null)):(this._set("state","error"),this._set("error",this.basemap.loadError)));const i=new AbortController,{signal:r}=i;this.compatibilityFunction(this,{signal:r}).then(()=>dd(()=>!this._spatialReferenceTask.updating,r)).then(()=>{this._set("state","ready"),this._set("error",null)}).catch(s=>{on(s)||(this._set("state","error"),this._set("error",s))}),this._refreshController=i}_cancelRefresh(){this._refreshController&&(this._refreshController.abort(),this._refreshController=null)}};y([w({readOnly:!0})],Hg.prototype,"_spatialReferenceTask",null),y([w()],Hg.prototype,"basemap",null),y([w()],Hg.prototype,"compatibilityFunction",void 0),y([w({readOnly:!0})],Hg.prototype,"error",void 0),y([w({readOnly:!0})],Hg.prototype,"spatialReference",null),y([w({readOnly:!0})],Hg.prototype,"state",void 0),y([w()],Hg.prototype,"view",void 0),Hg=y([Z("esri.widgets.BasemapGallery.support.BasemapGalleryItem")],Hg);const NUe=Hg,FUe=tt.ofType($y);let G4=class extends ze{constructor(e){super(e),this.basemaps=new FUe}destroy(){this.basemaps.forEach(e=>e.destroy())}get state(){return"ready"}refresh(){}};y([w({type:FUe})],G4.prototype,"basemaps",void 0),y([w({readOnly:!0})],G4.prototype,"state",null),G4=y([Z("esri.widgets.BasemapGallery.support.LocalBasemapsSource")],G4);const kUe=G4,zUe=tt.ofType($y);let qg=class extends Wf.LoadableMixin($9(kUe)){constructor(e){super(e),this._lastPortalBasemapFetchController=null,this.basemaps=new zUe,this.filterFunction=null,this.portal=os.getDefault(),this.query=null,this.updateBasemapsCallback=null,this.viewType=null}initialize(){this.addHandles([_e(()=>{var e,i,r;return[this.filterFunction,this.loadStatus,(e=this.portal)==null?void 0:e.basemapGalleryGroupQuery,(i=this.portal)==null?void 0:i.basemapGalleryGroupQuery3D,(r=this.portal)==null?void 0:r.user,this.query,this.updateBasemapsCallback]},()=>this.refresh(),Qt)])}destroy(){this.filterFunction=null,this.portal=null,this.basemaps.forEach(e=>e.destroy())}get state(){return this.loadStatus==="not-loaded"?"not-loaded":this.loadStatus==="loading"||this._lastPortalBasemapFetchController?"loading":"ready"}load(e){return this.addResolvingPromise(this.portal.load(e)),Promise.resolve(this)}async refresh(){if(this.loadStatus!=="loaded")return;this._lastPortalBasemapFetchController&&(this._lastPortalBasemapFetchController.abort(),this._lastPortalBasemapFetchController=null);const e=this.portal,i=new AbortController;this._lastPortalBasemapFetchController=i,this.notifyChange("state");try{const r=await e.fetchBasemaps(this._toQueryString(this.query),{signal:i.signal,include3d:this.viewType==="3d"||void 0});await this._updateBasemaps(r)}catch(r){if(on(r))throw r;Ce.getLogger(this).warn(new se("basemap-source:fetch-basemaps-error","Could not fetch basemaps from portal.",{error:r})),await this._updateBasemaps()}this._lastPortalBasemapFetchController=null,this.notifyChange("state")}_toQueryString(e){return e&&typeof e!="string"?Object.keys(e).map(i=>`${i}:${e[i]}`).join(" AND "):e}async _updateBasemaps(e=[]){let i=await this._filterBasemaps(e);i=this.updateBasemapsCallback?this.updateBasemapsCallback(i):i,this.basemaps.removeAll(),this.basemaps.addMany(i)}async _filterBasemaps(e){if(!this.filterFunction)return e;const i=e.map(this.filterFunction),r=await Promise.all(i);return e.filter((n,s)=>r[s])}};y([w({readOnly:!0,type:zUe})],qg.prototype,"basemaps",void 0),y([w()],qg.prototype,"filterFunction",void 0),y([w({type:os})],qg.prototype,"portal",void 0),y([w()],qg.prototype,"query",void 0),y([w({readOnly:!0})],qg.prototype,"state",null),y([w()],qg.prototype,"updateBasemapsCallback",void 0),y([w()],qg.prototype,"viewType",void 0),qg=y([Z("esri.widgets.BasemapGallery.support.PortalBasemapsSource")],qg);const H4=qg,UUe=tt.ofType(NUe);function ZFt(t){return t&&t.declaredClass==="esri.portal.Portal"}function JFt(t){return t&&!(t instanceof H4)&&(!!t.portal||!!t.query)}function KFt(t){return t&&"basemaps"in t&&"state"in t&&"refresh"in t}let Lu=class extends Wf{constructor(e){super(e),this._loadingProjectionEngine=!1,this._originalActiveBasemap=null,this.includeCurrentBasemap=!1,this.items=new UUe,this.source=new H4,this.view=null}initialize(){const e=()=>this._recreateItems();this.addHandles([_e(()=>{var i;return[this.view,(i=this.view)==null?void 0:i.ready]},()=>{var i;(i=this.view)!=null&&i.ready&&(this._originalActiveBasemap=this.activeBasemap)},{initial:!0}),_e(()=>this.state==="ready"?this.compatibilityFunction:null,()=>this._updateItems()),_e(()=>[this._effectiveIncludeCurrentBasemap,this._originalActiveBasemap],e),Jr(()=>{var i;return(i=this.source)==null?void 0:i.basemaps},"change",e,{onListenerAdd:e}),Oo(()=>this.view,()=>{var i;this.source instanceof H4&&(this.source.viewType=(i=this.view)==null?void 0:i.type)},{once:!0})])}destroy(){var i;const e=this.source.basemaps.find(r=>r===this.activeBasemap);e&&this.source.basemaps.remove(e),(i=this.source)==null||i.destroy()}get _effectiveIncludeCurrentBasemap(){var e;return this.includeCurrentBasemap&&((e=this.source)==null?void 0:e.basemaps.every(i=>i.loadStatus!=="loading"))}get activeBasemap(){var e,i;return((i=(e=this.view)==null?void 0:e.map)==null?void 0:i.basemap)??null}set activeBasemap(e){var s,o;const i=this.view;if(!(i!=null&&i.map))return;const r=typeof e=="string"?$y.fromId(e):e;if(!r||!i.ready)return i.map.basemap=r,void this._clearOverride("activeBasemap");const n=r.spatialReference||((o=(s=this.items)==null?void 0:s.find(a=>this.basemapEquals(r,a.basemap)))==null?void 0:o.spatialReference);if(n&&"spatialReferenceLocked"in i&&!i.spatialReferenceLocked){const a=i.spatialReference;if(n!=null&&!jn(a,n)&&!rh(i.spatialReference,n)&&!hx())return this._override("activeBasemap",r),this._loadingProjectionEngine=!0,void S_().then(()=>{this._get("activeBasemap")===e&&(i.map.basemap=e,i.spatialReference=n,this._clearOverride("activeBasemap"))},()=>{}).then(()=>{this._loadingProjectionEngine=!1});i.map.basemap=r,this._clearOverride("activeBasemap"),n==null||jn(i.spatialReference,n)||(i.spatialReference=n)}else i.map.basemap=r,this._clearOverride("activeBasemap")}get activeBasemapIndex(){const{state:e,activeBasemap:i}=this;return e!=="ready"?-1:this._findBasemapIndex(i)}get compatibilityFunction(){var e;return((e=this.view)==null?void 0:e.type)==="3d"?GFt:HFt}set compatibilityFunction(e){this._overrideIfSome("compatibilityFunction",e)}castSource(e){return Array.isArray(e)||tt.isCollection(e)?new kUe({basemaps:e}):ZFt(e)?new H4({portal:e}):JFt(e)?new H4(e):KFt(e)?e:null}get state(){var e;return(e=this.view)!=null&&e.ready&&this.source?this._loadingProjectionEngine?"loading":"ready":"disabled"}basemapEquals(e,i){return Mut(e,i)}refresh(){this._recreateItems()}load(e){return this.addResolvingPromise(Wf.isLoadable(this.source)?this.source.load(e):null),Promise.resolve(this)}_findBasemapIndex(e){const{items:i}=this,r=i.findIndex(n=>n.basemap===e);return r===-1?i.findIndex(n=>this.basemapEquals(n.basemap,e)):r}_recreateItems(){var a;const e=(a=this.source)==null?void 0:a.basemaps,{view:i,compatibilityFunction:r}=this,n=new Map(this.items.map(c=>[c.basemap,c]));function s(c){const p=n.get(c);return p?(n.delete(c),p):new NUe({basemap:c,compatibilityFunction:r,view:i})}this.items.removeAll(),e&&this.items.addMany(e.map(s));const o=this._findBasemapIndex(this._originalActiveBasemap)!==-1;this._effectiveIncludeCurrentBasemap&&!o&&this._originalActiveBasemap!=null&&this.items.unshift(s(this._originalActiveBasemap)),n.forEach(c=>c.destroy())}_updateItems(){for(const e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};y([w()],Lu.prototype,"_effectiveIncludeCurrentBasemap",null),y([w()],Lu.prototype,"_loadingProjectionEngine",void 0),y([w()],Lu.prototype,"_originalActiveBasemap",void 0),y([w()],Lu.prototype,"activeBasemap",null),y([w({readOnly:!0})],Lu.prototype,"activeBasemapIndex",null),y([w()],Lu.prototype,"compatibilityFunction",null),y([w()],Lu.prototype,"includeCurrentBasemap",void 0),y([w({readOnly:!0,type:UUe})],Lu.prototype,"items",void 0),y([w()],Lu.prototype,"source",void 0),y([Ci("source")],Lu.prototype,"castSource",null),y([w({readOnly:!0})],Lu.prototype,"state",null),y([w()],Lu.prototype,"view",void 0),Lu=y([Z("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],Lu);const QFt=Lu,Rd="esri-basemap-gallery",vh={base:Rd,widgetIcon:oi.basemap,sourceLoading:`${Rd}--source-loading`,layoutGrid:`${Rd}--grid`,narrowItems:`${Rd}--narrow-items`,loader:`${Rd}__loader`,item:`${Rd}__item`,itemContainer:`${Rd}__item-container`,itemContent:`${Rd}__item-content`,itemTitle:`${Rd}__item-title`,itemTagsContainer:`${Rd}__item-tags-container`,itemThumbnail:`${Rd}__item-thumbnail`,selectedItem:`${Rd}__item--selected`,itemError:`${Rd}__item--error`};function Dm({level:t,class:e,...i},r){const n=VUe(t);return X(`h${n}`,{...i,"aria-level":String(n),class:rT(it.heading,e),role:"heading"},r)}function VUe(t){return Je(Math.ceil(t),1,6)}function ekt(t,e=1){return VUe(t+e)}const EX={small:200,default:280,wide:420};let cc=class extends hn{constructor(e,i){super(e,i),this.disabled=!1,this.headingLevel=2,this.iconClass=vh.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new QFt,this._focusBasemapItemEnabled=!1,this._container=null,this._width=0,this._onContainerCreated=r=>{this._container=r}}initialize(){this.addHandles([Cj(()=>this._container,({contentRect:e})=>{this._width=e.width}),Oo(()=>this.source,()=>this.viewModel.load(),{sync:!0,initial:!0,once:!0})])}loadDependencies(){return Il({scrim:()=>we(()=>import("./calcite-scrim-eUqm3Zfl.js"),__vite__mapDeps([236,237,220,221,222,224,226,227])),chip:()=>we(()=>import("./calcite-chip-SaUQXOua.js"),__vite__mapDeps([238,239,222,219,224,220,221,217,223,225]))})}get activeBasemap(){return this.viewModel.activeBasemap}set activeBasemap(e){this.viewModel.activeBasemap=e}get includeCurrentBasemap(){return this.viewModel.includeCurrentBasemap}set includeCurrentBasemap(e){this.viewModel.includeCurrentBasemap=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get source(){return this.viewModel.source}set source(e){this.viewModel.source=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const e=this.source.state==="loading",i=this.disabled||this.viewModel.state==="disabled",r=this.viewModel.items,n={[vh.sourceLoading]:e,[it.disabled]:i},s=this._width;s<=EX.small||s>=EX.wide?n[vh.layoutGrid]=!0:s0?X("ul",{"aria-disabled":this.disabled,"aria-label":this.label,bind:this,class:vh.itemContainer,key:"item-container",onkeydown:this._handleKeyDown,role:"radiogroup"},r.map((c,p)=>this._renderBasemapGalleryItem(c,p)).toArray()):X("div",{class:it.empty,key:"empty-message"},X(Dm,{level:this.headingLevel},this.messages.noBasemaps));return X("div",{afterCreate:this._onContainerCreated,class:this.classes(vh.base,it.widget,it.panelHeightOnly,n),key:"container"},this._width===0?null:[o,a])}_getRoundRobinIndex(e,i){return(e+i)%i}_handleKeyDown(e){const{key:i}=e;if(!["ArrowUp","ArrowDown","ArrowRight","ArrowLeft"].includes(i))return;e.preventDefault();const{items:r,activeBasemapIndex:n}=this.viewModel,s=i==="ArrowUp"||i==="ArrowLeft"?this._getRoundRobinIndex(Math.max(n-1,-1),r.length):this._getRoundRobinIndex(n+1,r.length),o=r.at(s);(o==null?void 0:o.state)==="ready"&&(this.viewModel.activeBasemap=o.basemap),this._focusBasemapItemEnabled=!0}_focusBasemapItem(e){this._focusBasemapItemEnabled&&e.tabIndex===0&&(e.focus(),this._focusBasemapItemEnabled=!1)}_handleClick(e){const i=e.currentTarget["data-item"];i.state==="ready"&&(this.viewModel.activeBasemap=i.basemap)}_renderBasemapGalleryItem(e,i){var P,$;const r=$ut(e.basemap)||Wr("esri/themes/base/images/basemap-toggle-64.svg"),n=e.basemap.title,s=(P=e.basemap.portalItem)==null?void 0:P.snippet,o=(($=e.error)==null?void 0:$.message)||s||n,{viewModel:{state:a,activeBasemapIndex:c}}=this,p=this.disabled||a==="disabled",_=c===i,x=_||c===-1&&i===0?0:-1,S=a==="loading",C={[vh.selectedItem]:_,[vh.itemError]:e.state==="error"},M=`basemapgallery-item-${e.uid}`;return X("li",{afterUpdate:this._focusBasemapItem,"aria-checked":_.toString(),"aria-disabled":p.toString(),"aria-labelledby":M,bind:this,class:this.classes(vh.item,C),"data-item":e,key:e.uid,onclick:this._handleClick,onkeydown:this._handleClick,role:"radio",tabIndex:x,title:o},X("img",{alt:"",class:vh.itemThumbnail,src:r}),X("div",{class:vh.itemContent,key:"content"},X("div",{class:vh.itemTitle,key:"title"},X("span",{id:M},n)),Tut(e.basemap)?this._renderTags(e.basemap):null),e.state==="loading"||_&&S?X("calcite-scrim",null,X("span",{"aria-hidden":"true",class:it.loaderAnimation,key:"loader",role:"presentation"})):null)}_renderTags(e){return X("div",{class:vh.itemTagsContainer,key:"tag"},this._render3DTag(),Eut(e)?this._renderBetaTag():null)}_render3DTag(){const{messages:e}=this;return X("calcite-chip",{key:"tag-3d",scale:"s",value:e.tag3D},this.messages.tag3D)}_renderBetaTag(){const{messages:e}=this;return X("calcite-chip",{appearance:"outline-fill",key:"tag-beta",scale:"s",value:e.tagBeta},this.messages.tagBeta)}};y([w()],cc.prototype,"activeBasemap",null),y([w()],cc.prototype,"disabled",void 0),y([w()],cc.prototype,"headingLevel",void 0),y([w()],cc.prototype,"iconClass",void 0),y([w()],cc.prototype,"icon",void 0),y([w()],cc.prototype,"label",null),y([w(),Gr("esri/widgets/BasemapGallery/t9n/BasemapGallery")],cc.prototype,"messages",void 0),y([w()],cc.prototype,"source",null),y([w()],cc.prototype,"view",null),y([w()],cc.prototype,"viewModel",void 0),y([w()],cc.prototype,"_focusBasemapItemEnabled",void 0),y([w()],cc.prototype,"_container",void 0),y([w()],cc.prototype,"_width",void 0),y([wo()],cc.prototype,"_handleClick",null),cc=y([Z("esri.widgets.BasemapGallery")],cc);const tkt=cc,kn="esri-slider",Fr={base:kn,widgetIcon:oi.edit,reversed:`${kn}--reversed`,horizontalLayout:`${kn}--horizontal`,verticalLayout:`${kn}--vertical`,contentElement:`${kn}__content`,extraContentElement:`${kn}__extra-content`,trackElement:`${kn}__track`,ticksContainerElement:`${kn}__ticks`,tickElement:`${kn}__tick`,tickLabelElement:`${kn}__tick-label`,maxElement:`${kn}__max`,minElement:`${kn}__min`,maxElementInteractive:`${kn}__max--interactive`,minElementInteractive:`${kn}__min--interactive`,rangeElementActive:`${kn}__range--active`,rangeInput:`${kn}__range-input`,anchorElement:`${kn}__anchor`,movingAnchorElement:`${kn}__anchor--moving`,lastMovedAnchorElement:`${kn}__anchor--moved`,anchorElementActive:`${kn}__anchor--active`,anchorElementIndexPrefix:`${kn}__anchor-`,segmentElement:`${kn}__segment`,segmentElementIndexPrefix:`${kn}__segment-`,segmentElementInteractive:`${kn}__segment--interactive`,segmentElementActive:`${kn}__segment--active`,effectiveSegmentElement:`${kn}__effective-segment`,effectiveMaxSegmentElement:`${kn}__effective-max-segment`,effectiveMinSegmentElement:`${kn}__effective-min-segment`,thumbElement:`${kn}__thumb`,labelElement:`${kn}__label`,labelElementInteractive:`${kn}__label--interactive`,labelInput:`${kn}__label-input`};let Du=class extends ze{constructor(e){super(e),this.precision=4,this.thumbsConstrained=!0}set effectiveMax(e){this.setEffectiveMax(e)}set effectiveMin(e){this.setEffectiveMin(e)}set labelFormatFunction(e){this._set("labelFormatFunction",e)}set inputFormatFunction(e){this._set("inputFormatFunction",e)}set inputParseFunction(e){this._set("inputParseFunction",e)}get labels(){const{max:e,min:i,values:r}=this,n=r!=null&&r.length?r.map((s,o)=>this.getLabelForValue(s,"value",o)):[];return{max:this.getLabelForValue(e,"max"),min:this.getLabelForValue(i,"min"),values:n}}set max(e){this.setMax(e)}set min(e){this.setMin(e)}get state(){const{max:e,min:i}=this;return e!=null&&i!=null&&e>i?"ready":"disabled"}set values(e){const{max:i,min:r}=this,n=this.values;n&&e&&n.length===e.length&&n.every((s,o)=>s===e[o])||(this._set("values",null),e!=null&&e.length&&(r!=null&&e.some(s=>ss>i)&&(this.max=Math.max(...e))),this._set("values",e))}toPrecision(e){return parseFloat(e.toFixed(this.precision))}defaultLabelFormatFunction(e){const{max:i,min:r,precision:n}=this,s=i!=null&&r!=null&&i-r>10?2:n;return parseFloat(e.toFixed(s)).toString()}defaultInputFormatFunction(e){return e.toString()}defaultInputParseFunction(e){return parseFloat(e)}getBounds(){const{effectiveMax:e,effectiveMin:i,max:r,min:n}=this;return{min:i!=null&&n!=null?Math.max(n,i):n,max:e!=null&&r!=null?Math.min(r,e):r}}getBoundsForValueAtIndex(e){const{thumbsConstrained:i,values:r}=this,{min:n,max:s}=this.getBounds();if(i&&r){const o=e-1,a=e+1;return{min:r[o]!=null?r[o]:n,max:r[a]!=null?r[a]:s}}return{min:n,max:s}}getLabelForValue(e,i,r){return e==null?null:this.labelFormatFunction?this.labelFormatFunction(e,i,r):this.defaultLabelFormatFunction(e)}setMax(e){const{max:i,values:r}=this;if(e==null)return void this._set("max",null);if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for property 'max' is NaN.");const n=this.toPrecision(e);if(i!==n&&(this._set("max",n),r==null?void 0:r.length))for(let s=0;sr[s]&&this.setValue(s,n)}setEffectiveMax(e){if(e==null)return void this._set("effectiveMax",null);if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for property 'effectiveMax' is NaN.");const i=this.toPrecision(e);this.effectiveMax!==i&&this._set("effectiveMax",this._applyBoundsToValue(i))}setEffectiveMin(e){if(e==null)return void this._set("effectiveMin",null);if(isNaN(e))return void this._logError("slider:invalid-value","Supplied value for property 'effectiveMin' is NaN.");const i=this.toPrecision(e);this.effectiveMin!==i&&this._set("effectiveMin",this._applyBoundsToValue(i))}setValue(e,i){if(isNaN(i))return void this._logError("slider:invalid-value","Supplied value for member of property 'values' is NaN.");const{values:r}=this;if(r==null)return void this._logError("slider:invalid-value","Supplied value for member of property 'values' is null.");const n=r[e],s=this.toPrecision(i);if(n===s)return;const o=[...r];o[e]=s,this._set("values",o),this.notifyChange("labels")}_applyBoundsToValue(e){const{max:i,min:r}=this;return r!=null&&ei?i:e}_logError(e,i,r){Ce.getLogger(this).error(new se(e,i,r))}};y([w()],Du.prototype,"effectiveMax",null),y([w()],Du.prototype,"effectiveMin",null),y([w()],Du.prototype,"labelFormatFunction",null),y([w()],Du.prototype,"inputFormatFunction",null),y([w()],Du.prototype,"inputParseFunction",null),y([w({readOnly:!0})],Du.prototype,"labels",null),y([w()],Du.prototype,"max",null),y([w()],Du.prototype,"min",null),y([w()],Du.prototype,"precision",void 0),y([w({readOnly:!0})],Du.prototype,"state",null),y([w()],Du.prototype,"thumbsConstrained",void 0),y([w()],Du.prototype,"values",null),Du=y([Z("esri.widgets.Slider.SliderViewModel")],Du);const BUe=Du,_h={showInput:"Enter",hideInput1:"Enter",hideInput2:"Escape",hideInput3:"Tab",moveAnchorUp:"ArrowUp",moveAnchorDown:"ArrowDown",moveAnchorLeft:"ArrowLeft",moveAnchorRight:"ArrowRight",moveAnchorToMax:"End",moveAnchorToMin:"Home"},K2e={labels:!1,rangeLabels:!1};let kr=class extends hn{constructor(e,i){super(e,i),this._activeLabelInputIndex=null,this._anchorElements=[],this._dragged=!1,this._dragStartInfo=null,this._focusedAnchorIndex=null,this._isMinInputActive=!1,this._isMaxInputActive=!1,this._lastMovedHandleIndex=null,this._positionPrecision=5,this._segmentDragStartInfo=null,this._trackHeight=null,this._trackWidth=null,this._zIndices=[],this._zIndexOffset=3,this.disabled=!1,this.draggableSegmentsEnabled=!0,this.effectiveSegmentElements=new tt,this.extraNodes=[],this.inputCreatedFunction=null,this.labelElements=new tt,this.labelInputsEnabled=!1,this.maxLabelElement=null,this.messages=null,this.minLabelElement=null,this.rangeLabelInputsEnabled=!1,this.segmentElements=new tt,this.snapOnClickEnabled=!0,this.steps=null,this.syncedSegmentsEnabled=!1,this.thumbCreatedFunction=null,this.thumbElements=new tt,this.tickElements=new tt,this.trackElement=null,this.viewModel=new BUe,this.visibleElements={...K2e},this._onAnchorPointerDown=this._onAnchorPointerDown.bind(this),this._onAnchorPointerMove=this._onAnchorPointerMove.bind(this),this._onAnchorPointerUp=this._onAnchorPointerUp.bind(this),this._onLabelPointerDown=this._onLabelPointerDown.bind(this),this._onLabelPointerUp=this._onLabelPointerUp.bind(this),this._onSegmentPointerDown=this._onSegmentPointerDown.bind(this),this._onSegmentPointerMove=this._onSegmentPointerMove.bind(this),this._onSegmentPointerUp=this._onSegmentPointerUp.bind(this),this._onTrackPointerDown=this._onTrackPointerDown.bind(this),this._onTrackPointerMove=this._onTrackPointerMove.bind(this),this._onTrackPointerUp=this._onTrackPointerUp.bind(this)}destroy(){document.removeEventListener("pointerup",this._onLabelPointerUp),document.removeEventListener("pointermove",this._onLabelPointerMove),document.removeEventListener("pointerup",this._onAnchorPointerUp),document.removeEventListener("pointermove",this._onAnchorPointerMove),this.labelElements.removeAll(),this.labelElements.destroy(),this.segmentElements.removeAll(),this.segmentElements.destroy(),this.effectiveSegmentElements.removeAll(),this.effectiveSegmentElements.destroy(),this.thumbElements.removeAll(),this.thumbElements.destroy(),this.tickElements.removeAll(),this.tickElements.destroy()}get effectiveMax(){return this.viewModel.effectiveMax}set effectiveMax(e){this.viewModel.effectiveMax=e}get effectiveMin(){return this.viewModel.effectiveMin}set effectiveMin(e){this.viewModel.effectiveMin=e}get inputFormatFunction(){return this.viewModel.inputFormatFunction}set inputFormatFunction(e){this.viewModel.inputFormatFunction=e}get inputParseFunction(){return this.viewModel.inputParseFunction}set inputParseFunction(e){this.viewModel.inputParseFunction=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get labelFormatFunction(){return this.viewModel.labelFormatFunction}set labelFormatFunction(e){this.viewModel.labelFormatFunction=e}get labels(){return this.viewModel.labels}set layout(e){["vertical","vertical-reversed","horizontal","horizontal-reversed"].includes(e)||(e="horizontal"),this._set("layout",e)}get max(){return this.viewModel.max}set max(e){this.viewModel.max=e}get min(){return this.viewModel.min}set min(e){this.viewModel.min=e}get precision(){return this.viewModel.precision}set precision(e){this.viewModel.precision=e}get state(){const{_activeLabelInputIndex:e,_isMaxInputActive:i,_isMinInputActive:r,_dragStartInfo:n,_segmentDragStartInfo:s,disabled:o,viewModel:a}=this;return o?"disabled":e===null&&!i&&!r?n!=null||s!=null?"dragging":a.state:"editing"}get thumbsConstrained(){return this.viewModel.thumbsConstrained}set thumbsConstrained(e){this.viewModel.thumbsConstrained=e}set tickConfigs(e){this._set("tickConfigs",e),this.scheduleRender()}get values(){return this.viewModel.values}set values(e){this.viewModel.values=e}castVisibleElements(e){return{...K2e,...e}}render(){const{label:e}=this,i=this.classes(Fr.base,it.widget,this._isHorizontalLayout()?Fr.horizontalLayout:Fr.verticalLayout,this._isReversedLayout()?Fr.reversed:null,this._isDisabled()?it.disabled:null);return this._storeTrackDimensions(),X("div",{afterCreate:this._afterContainerCreate,"aria-label":e,bind:this,class:i,"touch-action":"none"},this._renderContent())}toNextStep(e){this._toStep(e,1)}toPreviousStep(e){this._toStep(e,-1)}getCurrentPosition(){var e;return this._positionFromValue(((e=this.values)==null?void 0:e[0])??0)}_renderContent(){const{max:e,min:i}=this;if(!(i==null||e==null||i>=e))return[this._renderMin(),this._renderSliderContainer(),this._renderMax()]}_renderSliderContainer(){return X("div",{bind:this,class:Fr.contentElement,key:"slider-container"},this._renderTrackElement(),this._renderTicksContainer(),this._renderExtraContentElements())}_renderTrackElement(){return X("div",{afterCreate:this._afterTrackCreate,afterRemoved:this._afterTrackRemoved,bind:this,class:Fr.trackElement,"touch-action":"none"},this._renderEffectiveSegmentElements(),this._renderSegmentElements(),this._renderAnchorElements())}_renderEffectiveSegmentElements(){var c;if(!this.trackElement||!((c=this.values)!=null&&c.length))return;const e=this.effectiveMax!=null,i=this.effectiveMin!=null;if(!e&&!i)return;const{max:r,min:n,viewModel:s}=this,o=s.getBounds(),a=[];return i&&a.push(this._renderEffectiveSegmentElement(n,o.min,!0)),e&&a.push(this._renderEffectiveSegmentElement(o.max,r,!1)),a}_renderSegmentElements(){var r;if(!this.trackElement||!((r=this.values)!=null&&r.length))return;const e=this.values.length,i=[];for(let n=0;n<=e;n++)i.push(this._renderSegmentElement(n));return i}_renderSegmentElement(e){const{_trackHeight:i,_trackWidth:r,draggableSegmentsEnabled:n,id:s,state:o}=this,a=this.values,c=this._isHorizontalLayout(),p=c?r:i,_=this.viewModel.getBounds(),x=this._positionFromValue(_.max),S=this._positionFromValue(_.min),C=e===(a==null?void 0:a.length)?null:e,M=e===0?null:e-1,P=C!=null,$=M!=null;let F,z;const k=[...a].sort((Q,ne)=>Q-ne);this._isReversedLayout()?(F=$?this._positionFromValue(k[M]):S,z=P?this._positionFromValue(k[C]):x):(F=P?this._positionFromValue(k[C]):x,z=$?this._positionFromValue(k[M]):S);const U=this._applyPrecisionToPosition(100*z/p),j=(F-z)/p,G=c?`transform: translate(${U}%, 0px) scale(${j}, 1);`:`transform: translate(0px, ${U}%) scale(1, ${j});`,Y=this.classes(Fr.segmentElement,Fr.segmentElementIndexPrefix+e,n&&P&&$&&o!=="disabled"?Fr.segmentElementInteractive:null);return X("div",{afterCreate:this._afterSegmentCreate,afterRemoved:this._afterSegmentRemoved,bind:this,class:Y,"data-max-thumb-index":C,"data-min-thumb-index":M,"data-segment-index":e,key:`${s}-segment-${e}`,style:G,"touch-action":"none"})}_renderEffectiveSegmentElement(e,i,r){const{_trackHeight:n,_trackWidth:s,layout:o}=this,a=this._positionFromValue(e),c=this._positionFromValue(i),p=this._isHorizontalLayout(),_=p?s:n,x=this._applyPrecisionToPosition(100*a/_);let S=null;if(o==="horizontal"){const P=r?_-c:c,$=a===_?0:x;S=`clip-path: inset(0% ${c===_?0:this._applyPrecisionToPosition(P/_*100)}% 0% ${$}%);`}else{const P=(c-a)/_;S=p?`transform: translate(${x}%, 0px) scale(${P}, 1);`:`transform: translate(0px, ${x}%) scale(1, ${P});`}const C=r?Fr.effectiveMinSegmentElement:Fr.effectiveMaxSegmentElement,M=this.classes(Fr.segmentElement,Fr.effectiveSegmentElement,C);return X("div",{afterCreate:this._afterEffectiveSegmentCreate,afterRemoved:this._afterEffectiveSegmentRemoved,bind:this,class:M,style:S,"touch-action":"none"})}_renderAnchorElements(){const{trackElement:e,values:i}=this;if(i!=null&&i.length)return this._zIndices=i.map((r,n)=>{const s=this._positionFromValue(r),o=this._positionToPercent(s),a=(this._isHorizontalLayout()?o>50:o<50)?-1:1;return this._zIndexOffset+(i.length+a*n)}),e&&i&&i.length?i.map((r,n)=>this._renderAnchorElement(r,n)):null}_renderAnchorElement(e,i){const r=this._positionFromValue(e),n=this._valueFromPosition(r);if(n==null||isNaN(n))return;const{_dragStartInfo:s,_lastMovedHandleIndex:o,id:a,layout:c,visibleElements:{labels:p}}=this,_=this.values,x=s&&s.index===i,S=o===i,C=this.classes(Fr.anchorElement,Fr.anchorElementIndexPrefix+i,x?Fr.movingAnchorElement:null,S?Fr.lastMovedAnchorElement:null),M=this.labels.values[i],P=this._getStyleForAnchor(e,i,x||S),{min:$,max:F}=this.viewModel.getBoundsForValueAtIndex(i),{disabled:z,messages:k}=this,U=_.length===2?Zy(i===0?k.rangeMinimum:k.rangeMaximum,{value:e}):M,j=_.length===1?null:i===0?`${a}-handle-${i+1}`:i===_.length-1?`${a}-handle-${i-1}`:`${a}-handle-${i-1} ${a}-handle-${i+1}`;return X("div",{afterCreate:this._afterAnchorCreate,afterRemoved:this._afterAnchorRemoved,afterUpdate:this._afterAnchorUpdate,"aria-controls":j,"aria-label":k.sliderValue,"aria-labelledby":p?`${a}-label-${i}`:null,"aria-orientation":c,"aria-valuemax":F==null?void 0:F.toString(),"aria-valuemin":$==null?void 0:$.toString(),"aria-valuenow":e.toString(),"aria-valuetext":U,bind:this,class:C,"data-thumb-index":i,"data-value":e,id:`${a}-handle-${i}`,key:`${a}-handle-${i}`,onkeydown:this._onAnchorKeyDown,role:"slider",style:P,tabIndex:z?-1:0,"touch-action":"none"},X("span",{afterCreate:this._afterThumbCreate,afterRemoved:this._afterThumbRemoved,bind:this,class:Fr.thumbElement,"data-thumb-index":i,"touch-action":"none"}),this.renderThumbLabel(i))}renderThumbLabel(e){const{id:i,labels:r,labelInputsEnabled:n,state:s}=this,o=this.visibleElements.labels,a=r.values[e],c=this.classes(Fr.labelElement,o?null:it.hidden,n&&s!=="disabled"?Fr.labelElementInteractive:null);return X("span",{afterCreate:this._afterLabelCreate,afterRemoved:this._afterLabelRemoved,"aria-hidden":(!o).toString(),bind:this,class:c,"data-thumb-index":e,id:`${i}-label-${e}`,key:`${i}-label-${e}`,role:n?"button":null,"touch-action":"none"},this._activeLabelInputIndex===e?this._renderValueInput(e):a)}_renderValueInput(e){const{disabled:i,values:r}=this;if(r==null)return;const n=r[e];return X("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.sliderValue,bind:this,class:Fr.labelInput,"data-input-index":e,"data-input-type":"thumb",key:`value-input-${e}`,onblur:this._onLabelInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:i?-1:0,type:"text",value:this._formatInputValue(n,"value",e)})}_renderMax(){const{_isMaxInputActive:e,labels:i,rangeLabelInputsEnabled:r,state:n}=this,s=this.visibleElements.rangeLabels,o=this.classes(Fr.maxElement,{[it.hidden]:!s,[Fr.maxElementInteractive]:r&&n!=="disabled",[Fr.rangeElementActive]:e});return X("div",{afterCreate:this._afterMaxLabelCreate,"aria-hidden":(!s).toString(),bind:this,class:o,onclick:this._onMaxLabelClick,onkeydown:this._onMaxLabelKeyDown,role:r?"button":null,tabIndex:!this.disabled&&r?0:-1},e?this._renderMaxInput():i.max)}_renderMin(){const{_isMinInputActive:e,labels:i,rangeLabelInputsEnabled:r,state:n}=this,s=this.visibleElements.rangeLabels,o=this.classes(Fr.minElement,{[it.hidden]:!s,[Fr.minElementInteractive]:r&&n!=="disabled",[Fr.rangeElementActive]:e});return X("div",{afterCreate:this._afterMinLabelCreate,"aria-hidden":(!s).toString(),bind:this,class:o,onclick:this._onMinLabelClick,onkeydown:this._onMinLabelKeyDown,role:r?"button":null,tabIndex:!this.disabled&&r?0:-1},e?this._renderMinInput():i.min)}_renderMaxInput(){return X("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.maximumValue,bind:this,class:Fr.rangeInput,"data-input-type":"max",onblur:this._onMaxInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:this.disabled?-1:0,type:"text",value:this._formatInputValue(this.max,"max")})}_renderMinInput(){return X("input",{afterCreate:this._afterInputCreate,"aria-label":this.messages.minimumValue,bind:this,class:Fr.rangeInput,"data-input-type":"min",onblur:this._onMinInputBlur,onkeydown:this._onInputKeyDown,required:!0,tabIndex:this.disabled?-1:0,type:"text",value:this._formatInputValue(this.min,"min")})}_renderExtraContentElements(){return X("div",{bind:this,class:Fr.extraContentElement},this.extraNodes)}_renderTicksContainer(){if(this.tickConfigs&&this.trackElement&&(this._trackHeight!==0||this._trackWidth!==0))return this.tickConfigs.map((e,i)=>X("div",{class:this.classes(Fr.ticksContainerElement),key:"ticks-container"},this._renderTicks(e,i)))}_renderTicks(e,i){const{mode:r,values:n}=e;if(this.tickElements.at(i)||this.tickElements.add(new tt,i),r==="position"){const a=Array.isArray(n)?n:[n];return this._calculateTickPositions(a).map((c,p)=>this._renderTickGroup(e,p,i,c))}if(r==="percent"&&Array.isArray(n)){const a=this.min??0,c=(this.max??0)-a,p=n.map(_=>this._applyPrecisionToPosition(_/100*c+a));return this._calculateTickPositions(p).map((_,x)=>this._renderTickGroup(e,x,i,_))}const s=Array.isArray(n)&&n.length?n[0]:isNaN(n)?null:n,o=this._getTickCounts(s,e);return this._calculateEquidistantTickPositions(o).map((a,c)=>this._renderTickGroup(e,c,i,a))}_renderTickGroup(e,i,r,n){const s=e.mode==="position"?Array.isArray(e.values)?e.values[i]:e.values:this._valueFromPosition(n);if(s!=null&&!isNaN(s))return X("div",{afterCreate:this._afterTickGroupCreate,afterRemoved:this._afterTickGroupRemoved,bind:this,"data-config":e,"data-position":n,"data-tick-config-index":r,"data-tick-group-index":i,"data-value":s,key:`tick-group-${i}`,onclick:this._onTickGroupClick},this._renderTickLine(e,i,r,s),e.labelsVisible?this._renderTickLabel(e,i,r,s):null)}_renderTickLine(e,i,r,n){return X("div",{afterCreate:this._afterTickLineCreate,"aria-valuenow":n.toString(),bind:this,class:Fr.tickElement,"data-config":e,"data-tick-config-index":r,"data-tick-group-index":i,"data-value":n,key:`tick-label-${i}`,style:this._getPositionStyleForElement(n)})}_renderTickLabel(e,i,r,n){const s=e.labelFormatFunction?e.labelFormatFunction(n,"tick",i):this.viewModel.getLabelForValue(n,"tick",i);return X("div",{afterCreate:this._afterTickLabelCreate,"aria-label":s,"aria-valuenow":n.toString(),"aria-valuetext":s,bind:this,class:Fr.tickLabelElement,"data-config":e,"data-tick-config-index":r,"data-tick-group-index":i,"data-value":n,key:`tick-label-${i}`,style:`transform: translate(-50%); ${this._getPositionStyleForElement(n)}`},s)}_afterContainerCreate(e){this.addHandles(Cj(e,()=>this.scheduleRender()))}_afterTrackCreate(e){this._set("trackElement",e),e.addEventListener("pointerdown",this._onTrackPointerDown),this.scheduleRender()}_afterTrackRemoved(e){e.removeEventListener("pointerdown",this._onTrackPointerDown),document.removeEventListener("pointermove",this._onTrackPointerMove),document.removeEventListener("pointerup",this._onTrackPointerUp)}_afterSegmentCreate(e){this.segmentElements.add(e),e.addEventListener("pointerdown",this._onSegmentPointerDown)}_afterSegmentRemoved(e){this.segmentElements.remove(e),e.removeEventListener("pointerdown",this._onSegmentPointerDown)}_afterEffectiveSegmentCreate(e){this.effectiveSegmentElements.add(e)}_afterEffectiveSegmentRemoved(e){this.effectiveSegmentElements.remove(e)}_afterAnchorCreate(e){if(this._anchorElements.push(e),e.addEventListener("pointerdown",this._onAnchorPointerDown),this.thumbCreatedFunction){const i=XR(e),r=CX(e),n=this.thumbElements.at(i),s=this.labelElements.at(i)||null;this.thumbCreatedFunction(i,r,n,s)}}_afterAnchorUpdate(e){this._focusedAnchorIndex!=null&&XR(e)===this._focusedAnchorIndex&&(e.focus(),this._focusedAnchorIndex=null)}_afterAnchorRemoved(e){const i=this._anchorElements.indexOf(e,0);i>-1&&this._anchorElements.splice(i,1),e.removeEventListener("pointerdown",this._onAnchorPointerDown)}_afterThumbCreate(e){this.thumbElements.add(e)}_afterThumbRemoved(e){this.thumbElements.remove(e)}_afterLabelCreate(e){this.labelElements.add(e),e.addEventListener("pointerdown",this._onLabelPointerDown),e.addEventListener("pointerup",this._onLabelPointerUp)}_afterLabelRemoved(e){this.labelElements.remove(e),e.removeEventListener("pointerdown",this._onLabelPointerDown),e.removeEventListener("pointerup",this._onLabelPointerUp)}_afterInputCreate(e){if(e.focus(),e.select(),this.inputCreatedFunction){const i=e.getAttribute("data-input-type"),r=i==="thumb"?ikt(e):null;this.inputCreatedFunction(e,i,r)}}_afterTickLineCreate(e){const i=ZR(e),r=W8(e),n=this.tickElements.at(i),s=n.at(r);s?s.tickElement=e:n.add({groupElement:null,tickElement:e,labelElement:null},r)}_afterTickLabelCreate(e){const i=ZR(e),r=W8(e),n=this.tickElements.at(i),s=n.at(r);s?s.labelElement=e:n.add({groupElement:null,labelElement:e,tickElement:null},r)}_afterTickGroupRemoved(e){const i=ZR(e),r=this.tickElements.items[i],n=r==null?void 0:r.find(s=>s.groupElement===e);n&&r.remove(n)}_afterTickGroupCreate(e){var r,n;const i=Q2e(e);if(i!=null&&i.tickCreatedFunction){const s=ZR(e),o=W8(e),a=CX(e),c=(n=(r=this.tickElements)==null?void 0:r.at(s))==null?void 0:n.at(o);if(c){c.groupElement=e;const p=c.tickElement||null,_=c.labelElement||null;i.tickCreatedFunction(a,p,_)}}}_afterMaxLabelCreate(e){this._set("maxLabelElement",e)}_afterMinLabelCreate(e){this._set("minLabelElement",e)}_onAnchorKeyDown(e){if(this._isDisabled()||this.state==="editing")return;const{target:i}=e,r=Mf(e),n=this.values,s=XR(i),o=this._anchorElements[s],a=n[s],c=[_h.moveAnchorUp,_h.moveAnchorDown,_h.moveAnchorLeft,_h.moveAnchorRight];if(r===_h.showInput&&this.labelInputsEnabled)this._activeLabelInputIndex=s,this.notifyChange("state");else if(c.includes(r)){e.preventDefault();const{steps:p}=this,_=r===_h.moveAnchorUp||r===_h.moveAnchorRight?1:-1;if(p!=null)this._toStep(s,this._isReversedLayout()?-1*_:_);else{const{precision:S}=this,C=this._getPositionOfElement(o),M=this._valueFromPosition(C),P=this._isHorizontalLayout()?_:-1*_;let $;$=S===0?this._positionFromValue(M+P):S===1?this._positionFromValue(M+.1*P):C+P,this._toPosition(s,$)}const x=this.values[s];a!==x&&this._emitThumbChangeEvent({index:s,oldValue:a,value:x})}else if(r===_h.moveAnchorToMax||r===_h.moveAnchorToMin){e.preventDefault();const{min:p,max:_}=this._getAnchorBoundsInPixels(s),x=this._isPositionInverted()?r===_h.moveAnchorToMax?p:_:r===_h.moveAnchorToMin?p:_;this._toPosition(s,x);const S=this.values[s];a!==S&&this._emitThumbChangeEvent({index:s,oldValue:a,value:S})}}_onAnchorPointerDown(e){if(this._isDisabled())return;const{target:i,clientX:r,clientY:n}=e,s=XR(i);s!=null&&(e.preventDefault(),this._anchorElements[s]&&this._anchorElements[s].focus(),this._storeTrackDimensions(),this._dragStartInfo={clientX:r,clientY:n,index:s,position:this._getPositionOfElement(this._anchorElements[s])},this.notifyChange("state"),document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove))}_onAnchorPointerMove(e){if(this.state==="editing"||!this._dragStartInfo)return;e.preventDefault();const{values:i,_anchorElements:r,_dragged:n,_dragStartInfo:s,_dragStartInfo:{index:o,position:a}}=this,{clientX:c,clientY:p}=e,_=n?"drag":"start",x=r[o],S=this._getPositionOfElement(x),C=this._applyPrecisionToPosition(this._isHorizontalLayout()?a+c-s.clientX:a+p-s.clientY);if(S===C)return;const M=i[o];this._dragged=!0,this._toPosition(o,C);const P=this.values[o];n?M!==P&&this._emitThumbDragEvent({index:o,state:_,value:P}):this._emitThumbDragEvent({index:o,state:_,value:M})}_onAnchorPointerUp(e){if(document.removeEventListener("pointerup",this._onAnchorPointerUp),document.removeEventListener("pointermove",this._onAnchorPointerMove),!this._dragStartInfo)return;e.preventDefault();const{index:i}=this._dragStartInfo,r=this._dragged,n=this.values[i];this._dragged=!1,this._dragStartInfo=null,this._lastMovedHandleIndex=i,this.notifyChange("state"),r?this._emitThumbDragEvent({index:i,state:"stop",value:n}):(this.scheduleRender(),this.state!=="editing"&&this._emitThumbClickEvent({index:i,value:n}))}_onTrackPointerDown(e){const{_dragStartInfo:i,snapOnClickEnabled:r,state:n,values:s}=this;if(this._isDisabled()||n==="editing"||i||(document.addEventListener("pointermove",this._onTrackPointerMove),document.addEventListener("pointerup",this._onTrackPointerUp),!r||!(s!=null&&s.length)))return;const{steps:o}=this,{clientX:a,clientY:c}=e,p=this._getCursorPositionFromEvent(e),_=this._valueFromPosition(p),x=this._getIndexOfNearestValue(_),S=s[x],C=s.some((F,z)=>F===S&&z!==x)&&_>S?s.lastIndexOf(S):x;if(C==null)return;const M=s[C],P=o!=null?this._calculateNearestStepPosition(p):p;this._toPosition(C,P),this._dragged=!0,this._dragStartInfo={clientX:a,clientY:c,index:C,position:P},this._focusedAnchorIndex=C,this.notifyChange("state"),this._emitThumbDragEvent({index:C,state:"start",value:M});const $=this.values[C];M!==$&&this._emitThumbDragEvent({index:C,state:"drag",value:$}),document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove)}_onTrackPointerMove(e){e.preventDefault(),this._dragged=!0}_onTrackPointerUp(e){if(e.preventDefault(),document.removeEventListener("pointermove",this._onTrackPointerMove),document.removeEventListener("pointerup",this._onTrackPointerUp),this.snapOnClickEnabled||(this._dragged=!1),!this._dragged){const i=this._getCursorPositionFromEvent(e),r=this._valueFromPosition(i);this._emitTrackClickEvent({value:r})}}_onSegmentPointerDown(e){var c,p;e.preventDefault();const i=e.target,r=rkt(i),n=nkt(i),s=skt(i);if(this._isDisabled()||n==null||s==null)return;e.stopPropagation(),this._storeTrackDimensions(),document.addEventListener("pointerup",this._onSegmentPointerUp);const o=this._getAnchorDetails(n),a=this._getAnchorDetails(s);this.syncedSegmentsEnabled?(this.segmentElements.forEach(_=>_.classList.add(Fr.segmentElementActive)),this._anchorElements.forEach(_=>_.classList.add(Fr.anchorElementActive))):(this.segmentElements.at(r).classList.add(Fr.segmentElementActive),(c=this._anchorElements[o.index])==null||c.classList.add(Fr.anchorElementActive),(p=this._anchorElements[a.index])==null||p.classList.add(Fr.anchorElementActive)),this._segmentDragStartInfo={cursorPosition:this._getCursorPositionFromEvent(e),index:r,details:this._normalizeSegmentDetails({min:o,max:a})},this.draggableSegmentsEnabled&&(document.addEventListener("pointermove",this._onSegmentPointerMove),this.notifyChange("state"),this._emitSegmentDragEvent({index:r,state:"start",thumbIndices:[n,s]}))}_onSegmentPointerMove(e){if(!this._segmentDragStartInfo)return;e.preventDefault();const{_trackHeight:i,_trackWidth:r,_segmentDragStartInfo:{index:n,cursorPosition:s,details:{min:o,max:a}}}=this,{index:c,position:p,value:_}=o,{index:x,position:S,value:C}=a;this._dragged=!0;const M=this._getCursorPositionFromEvent(e);if(M===s)return;const P=this._positionToPercent(s),$=this._positionToPercent(M)-P,F=this._positionToPercent(p)+$,z=this._positionToPercent(S)+$,{min:k}=this._getAnchorBoundsAsPercents(c),{max:U}=this._getAnchorBoundsAsPercents(x);let j=!1,G=!1;if(FU&&(G=!0),j){const{min:ge,max:pe}=this.viewModel.getBoundsForValueAtIndex(c),Ee=this._isPositionInverted()?pe:ge,te=Ee,le=C+(Ee-_),de=le-this.values[x];return void(this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(de):this._updateAnchorValues([c,x],[te,le]))}if(G){const{min:ge,max:pe}=this.viewModel.getBoundsForValueAtIndex(x),Ee=this._isPositionInverted()?ge:pe,te=Ee,le=_+(Ee-C),de=le-this.values[c];return void(this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(de):this._updateAnchorValues([c,x],[le,te]))}const Y=this._isHorizontalLayout()?r:i,Q=z/100*Y,ne=F/100*Y,ie=this.values,he=[ie[c],ie[x]],ce=this._getValueForAnchorAtPosition(c,ne),ve=this._getValueForAnchorAtPosition(x,Q);this.syncedSegmentsEnabled?this._updateAnchorValuesByDifference(ce-he[0]):this._updateAnchorValues([c,x],[ce,ve]),[this.values[c],this.values[x]].every((ge,pe)=>ge===he[pe])||this._emitSegmentDragEvent({index:n,state:"drag",thumbIndices:[c,x]})}_onSegmentPointerUp(e){if(e.preventDefault(),document.removeEventListener("pointerup",this._onSegmentPointerUp),document.removeEventListener("pointermove",this._onSegmentPointerMove),!this._segmentDragStartInfo)return;const{_dragged:i}=this,r=this.min,n=this.max,s=this.values,{index:o,details:{min:{index:a},max:{index:c}}}=this._segmentDragStartInfo;if(this.segmentElements.forEach(p=>p.classList.remove(Fr.segmentElementActive)),this._anchorElements.forEach(p=>p.classList.remove(Fr.anchorElementActive)),this.draggableSegmentsEnabled){const p=n-r,_=s[a],x=s[c];this._lastMovedHandleIndex=_===x?_>p/2?a:c:null,this._dragged=!1,this._segmentDragStartInfo=null,this.notifyChange("state"),this._emitSegmentDragEvent({index:o,state:"stop",thumbIndices:[a,c]})}if(!i){const p=this._getCursorPositionFromEvent(e),_=this._valueFromPosition(p);this._emitSegmentClickEvent({index:o,value:_,thumbIndices:[a,c]})}}_onTickGroupClick(e){const i=e.target;if(Q2e(i)){const r=ZR(i),n=W8(i),s=CX(i);this._emitTickClickEvent({configIndex:r,groupIndex:n,value:s})}}_storeTrackDimensions(){if(this.trackElement){const e=this._getDimensions(this.trackElement);this._trackHeight=e.height,this._trackWidth=e.width}}_onLabelPointerDown(){this._isDisabled()||(this._dragged=!1,document.addEventListener("pointerup",this._onAnchorPointerUp),document.addEventListener("pointermove",this._onAnchorPointerMove))}_onLabelPointerMove(){this._isDisabled()||(this._dragged=!0)}_onLabelPointerUp(e){if(this._isDisabled())return;const i=XR(e.target);this.labelInputsEnabled&&!this._dragged&&i!=null&&(this._activeLabelInputIndex=i),this._dragged=!1,this.notifyChange("state"),document.removeEventListener("pointerup",this._onLabelPointerUp),document.removeEventListener("pointermove",this._onLabelPointerMove)}_onLabelInputBlur(e){const{_activeLabelInputIndex:i,values:r,viewModel:n}=this,s=e.target.value;if(this._activeLabelInputIndex=null,this.notifyChange("state"),!s||i==null||r==null)return;const o=this._parseInputValue(s,"value",i),a=r[i],{min:c,max:p}=this.viewModel.getBoundsForValueAtIndex(i);if(op)return;n.setValue(i,o);const _=this.values[i];a!==_&&this._emitThumbChangeEvent({index:i,oldValue:a,value:_})}_onInputKeyDown(e){var _;if(this._isDisabled())return;const{target:i}=e,r=Mf(e),{hideInput1:n,hideInput2:s,hideInput3:o}=_h,{_activeLabelInputIndex:a,_anchorElements:c}=this,p=i;if(r===n||r===s||r===o){e.stopPropagation();const x=a;p.blur(),x!=null?c[x].focus():(_=p.parentElement)==null||_.focus()}}_onMaxLabelClick(){this._isDisabled()||(this._emitRangeLabelClickEvent({type:"max-click",value:this.max}),this.rangeLabelInputsEnabled&&(this._isMaxInputActive=!0,this.notifyChange("state")))}_onMaxLabelKeyDown(e){this._isDisabled()||Mf(e)!==_h.showInput||(this._isMaxInputActive=!0,this.notifyChange("state"))}_onMaxInputBlur(e){const i=e.target.value;if(this._isMaxInputActive=!1,this.notifyChange("state"),!i)return;const r=this.max,n=this._parseInputValue(i,"max");n<=this.min||(this.viewModel.set("max",n),this.max!==r&&this._emitMaxChangeEvent({oldValue:r,value:this.max}))}_onMinLabelClick(){this._isDisabled()||(this._emitRangeLabelClickEvent({type:"min-click",value:this.min}),this.rangeLabelInputsEnabled&&(this._isMinInputActive=!0,this.notifyChange("state")))}_onMinLabelKeyDown(e){this._isDisabled()||Mf(e)!==_h.showInput||(this._isMinInputActive=!0,this.notifyChange("state"))}_onMinInputBlur(e){const i=e.target.value;if(this._isMinInputActive=!1,this.notifyChange("state"),!i)return;const r=this.min,n=this._parseInputValue(i,"min");n>=this.max||(this.viewModel.set("min",n),this.min!==r&&this._emitMinChangeEvent({oldValue:r,value:this.min}))}_isDisabled(){return this.disabled||this.state==="disabled"}_positionFromValue(e){const{_trackHeight:i,_trackWidth:r}=this,n=this.min??0,s=this.max??0,o=s-n;if(o===0||e==null)return 0;const a=this._isHorizontalLayout();let c=parseFloat(a?(r*(e-n)/o).toFixed(2):(i*(s-e)/o).toFixed(2));return this._isReversedLayout()&&(c=a?r-c:i-c),c}_valueFromPosition(e){const{_trackHeight:i,_trackWidth:r,precision:n}=this,s=this.min??0,o=this.max??0,a=o-s;let c=this._isHorizontalLayout()?e*a/r+s:a*(1e3-e/i*1e3)/1e3+s;return this._isReversedLayout()&&(c=o+s-c),parseFloat(c.toFixed(n))}_positionToPercent(e){const{_trackHeight:i,_trackWidth:r}=this,n=100*e/(this._isHorizontalLayout()?r:i);return this._applyPrecisionToPosition(n)}_applyPrecisionToPosition(e){return parseFloat(e.toFixed(this._positionPrecision))}_isPositionInverted(){const{layout:e}=this;return e==="horizontal-reversed"||e==="vertical"}_isHorizontalLayout(){return this.layout.includes("horizontal")}_isReversedLayout(){return this.layout.includes("reversed")}_normalizeSegmentDetails(e){if(this._isPositionInverted()){const{min:i,max:r}=e;return{min:r,max:i}}return e}_parseInputValue(e,i,r){return this.inputParseFunction?this.inputParseFunction(e,i,r):this.viewModel.defaultInputParseFunction(e)}_formatInputValue(e,i,r){return this.inputFormatFunction?this.inputFormatFunction(e,i,r):this.viewModel.defaultInputFormatFunction(e)}_getAnchorDetails(e){const i=this.values,r=[...i].sort((s,o)=>s-o)[e],n=i.indexOf(r);return{index:n,position:this._getPositionOfElement(this._anchorElements[n]),value:r}}_updateAnchorStyle(e,i){const r=this._anchorElements[e];r&&(this._isHorizontalLayout()?r.style.left=`${i}`:r.style.top=`${i}`)}_getStyleForAnchor(e,i,r){var o;const n=this._getPositionStyleForElement(e);if(((o=this.values)==null?void 0:o.length)===1)return`${n}`;const s=this._zIndices[i];return`${n}; z-index: ${r?this._zIndexOffset+s:s}`}_getPositionStyleForElement(e){const i=this._positionFromValue(e),r=this._positionToPercent(i);return`${this._isHorizontalLayout()?"left":"top"}: ${r}%`}_getPositionOfElement(e){const i=this._getDimensions(e.offsetParent),r=this._getDimensions(e);return this._isHorizontalLayout()?this._applyPrecisionToPosition(r.left-i.left):this._applyPrecisionToPosition(r.top-i.top)}_updateAnchorValues(e,i){e.forEach((r,n)=>this._toValue(r,i[n]))}_updateAnchorValuesByDifference(e){const{min:i,max:r,values:n}=this;n==null||n.forEach((s,o)=>this._toValue(o,Math.max(Math.min(s+e,r),i)))}_toValue(e,i){this.steps!=null&&(i=this._getStepValues()[this._getIndexOfNearestStepValue(i)]),this._updateAnchorStyle(e,this._getPositionStyleForElement(i)),this.viewModel.setValue(e,i)}_toPosition(e,i){const r=this.steps!=null?this._getStepValueForAnchorAtPosition(e,i):this._getValueForAnchorAtPosition(e,i);this._updateAnchorStyle(e,this._getPositionStyleForElement(r)),this.viewModel.setValue(e,r)}_getValueForAnchorAtPosition(e,i){const{min:r,max:n}=this._getAnchorBoundsInPixels(e),{min:s,max:o}=this.viewModel.getBoundsForValueAtIndex(e);let a,c,p=null;return this._isPositionInverted()?(a=s,c=o):(a=o,c=s),p=i>n?a:io?p=o:pMath.abs(n-e)i?i:a)}return s}_toStep(e,i){const r=this.values[e],n=this._getStepValues(),s=n.indexOf(r);let o=null;if(s>-1){let a=n[s+i];isNaN(a)&&(a=n[s]);const c=this._positionFromValue(a);o=this._getStepValueForAnchorAtPosition(e,c)}else o=n[this._getIndexOfNearestStepValue(r)+i];this.viewModel.setValue(e,o)}_getIndexOfNearestStepValue(e){const{steps:i}=this;if(i==null)return null;const r=this._getStepValues(),n=r.reduce((s,o)=>Math.abs(o-e)this._positionFromValue(i))}_calculateEquidistantTickPositions(e){const{_trackWidth:i,_trackHeight:r}=this,n=this._isHorizontalLayout()?i:r,s=n/(e-1),o=[];if(e===1)return[n/2];for(let a=0;a{const t=document.createElement("div"),e=document.createElement("calcite-slider");return e.min=0,e.max=100,e.step=1,e.value=100,e.labelHandles=!0,[t,e]},f9=-1;let Wg=class extends ze{constructor(e){super(e),this._from=null,this._to=null,this._final=null,this._current=[],this._time=0,this.duration=$e("mapview-transitions-duration"),this.effects=[]}set effect(e){if(this._get("effect")!==(e=e||"")){this._set("effect",e);try{this._transitionTo(exe(e))}catch(i){this._transitionTo([]),Ce.getLogger(this).warn("Invalid Effect",{effect:e,error:i})}}}get hasEffects(){return this.transitioning||!!this.effects.length}set scale(e){this._updateForScale(e)}get transitioning(){return this._to!==null}canTransitionTo(e){try{return this.scale>0&&txe(this._current,exe(e),this.scale)}catch{return!1}}transitionStep(e,i){this._applyTimeTransition(e),this._updateForScale(i)}endTransitions(){this._applyTimeTransition(this.duration)}_transitionTo(e){this.scale>0&&txe(this._current,e,this.scale)?(this._final=e,this._to=Pe(e),okt(this._current,this._to,this.scale),this._from=Pe(this._current),this._time=0):(this._from=this._to=this._final=null,this._current=e),this._set("effects",this._current[0]?Pe(this._current[0].effects):[])}_applyTimeTransition(e){if(!(this._to&&this._from&&this._current&&this._final))return;this._time+=e;const i=Math.min(1,this._time/this.duration);for(let r=0;r=i[0].scale)s=n=i[0].effects;else if(e<=i[r].scale)s=n=i[r].effects;else for(let a=0;a=e&&p.scale<=e){o=(e-c.scale)/(p.scale-c.scale),n=c.effects,s=p.effects;break}}for(let a=0;a1||e.length>1)&&i<=0)&&MCe(t[0].effects,e[0].effects)}function okt(t,e,i){const r=t.length>e.length?t:e,n=t.length>e.length?e:t,s=n[n.length-1],o=(s==null?void 0:s.scale)??i,a=(s==null?void 0:s.effects)??[];for(let c=n.length;cr!=="").map(r=>`'${r}'`);return i.push("''"),`${e} IN (${i.join(",")}) OR ${e} IS NULL`}function tyi(t,e,i){return e.flatten(({sublayers:n})=>n).length!==t.length?!0:!!t.some(n=>n.originIdOf("minScale")>i||n.originIdOf("maxScale")>i||n.originIdOf("renderer")>i||n.originIdOf("labelingInfo")>i||n.originIdOf("opacity")>i||n.originIdOf("labelsVisible")>i||n.originIdOf("source")>i)||!HUe(t,e)}function ukt(t,e,i){return!!t.some(r=>{const n=r.source;return!(!n||n.type==="map-layer"&&n.mapLayerId===r.id&&(n.gdbVersion==null||n.gdbVersion===i))||r.originIdOf("renderer")>Di.SERVICE||r.originIdOf("labelingInfo")>Di.SERVICE||r.originIdOf("opacity")>Di.SERVICE||r.originIdOf("labelsVisible")>Di.SERVICE})||!HUe(t,e)}function HUe(t,e){if(!(t!=null&&t.length)||e==null)return!0;const i=e.slice().reverse().flatten(({sublayers:s})=>s&&s.toArray().reverse()).map(s=>s.id).toArray();if(t.length>i.length)return!1;let r=0;const n=i.length;for(const{id:s}of t){for(;r=n)return!1}return!0}function iyi(t){return!!t&&t.some(e=>{var i;return e.minScale!=null||((i=e.layerDefinition)==null?void 0:i.minScale)!=null})}const hkt={visible:"visibleSublayers",definitionExpression:"layerDefs",labelingInfo:"hasDynamicLayers",labelsVisible:"hasDynamicLayers",opacity:"hasDynamicLayers",minScale:"visibleSublayers",maxScale:"visibleSublayers",renderer:"hasDynamicLayers",source:"hasDynamicLayers"};let Vd=class extends ze{constructor(e){super(e),this.floors=null,this.scale=0}destroy(){this.layer=null}get dynamicLayers(){if(!this.hasDynamicLayers)return null;const e=this.visibleSublayers.map(i=>{const r=ixe(this.floors,i);return i.toExportImageJSON(r)});return e.length?JSON.stringify(e):null}get hasDynamicLayers(){return this.layer&&ukt(this.visibleSublayers,this.layer.serviceSublayers,this.layer.gdbVersion)}set layer(e){this._get("layer")!==e&&(this._set("layer",e),this.removeHandles("layer"),e&&this.addHandles([e.allSublayers.on("change",()=>this.notifyChange("visibleSublayers")),e.on("sublayer-update",i=>this.notifyChange(hkt[i.propertyName]))],"layer"))}get layers(){const e=this.visibleSublayers;return e?e.length?"show:"+e.map(i=>i.id).join(","):"show:-1":null}get layerDefs(){var r;const e=!!((r=this.floors)!=null&&r.length),i=this.visibleSublayers.filter(n=>n.definitionExpression!=null||e&&n.floorInfo!=null);return i.length?JSON.stringify(i.reduce((n,s)=>{const o=ixe(this.floors,s),a=MB(o,s.definitionExpression);return a!=null&&(n[s.id]=a),n},{})):null}get version(){this.commitProperty("layers"),this.commitProperty("layerDefs"),this.commitProperty("dynamicLayers"),this.commitProperty("timeExtent");const e=this.layer;return e&&(e.commitProperty("dpi"),e.commitProperty("imageFormat"),e.commitProperty("imageTransparency"),e.commitProperty("gdbVersion")),(this._get("version")||0)+1}get visibleSublayers(){const e=[];if(!this.layer)return e;const i=this.layer.sublayers,r=this.scale,n=o=>{o.visible&&(r===0||vct(r,o.minScale,o.maxScale))&&(o.sublayers?o.sublayers.forEach(n):e.unshift(o))};i&&i.forEach(n);const s=this._get("visibleSublayers");return!s||s.length!==e.length||s.some((o,a)=>e[a]!==o)?e:s}toJSON(){const e=this.layer;let i={dpi:e.dpi,format:e.imageFormat,transparent:e.imageTransparency,gdbVersion:e.gdbVersion||null};return this.hasDynamicLayers&&this.dynamicLayers?i.dynamicLayers=this.dynamicLayers:i={...i,layers:this.layers,layerDefs:this.layerDefs},i}};y([w({readOnly:!0})],Vd.prototype,"dynamicLayers",null),y([w()],Vd.prototype,"floors",void 0),y([w({readOnly:!0})],Vd.prototype,"hasDynamicLayers",null),y([w()],Vd.prototype,"layer",null),y([w({readOnly:!0})],Vd.prototype,"layers",null),y([w({readOnly:!0})],Vd.prototype,"layerDefs",null),y([w({type:Number})],Vd.prototype,"scale",void 0),y([w(ont)],Vd.prototype,"timeExtent",void 0),y([w({readOnly:!0})],Vd.prototype,"version",null),y([w({readOnly:!0})],Vd.prototype,"visibleSublayers",null),Vd=y([Z("esri.layers.mixins.ExportImageParameters")],Vd);const dkt=9999999e31,pkt=2e-7,fkt={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767],u32:[0,4294967295],s32:[-2147483648,2147483647],f32:[-34028234663852886e22,34028234663852886e22],f64:[-Number.MAX_VALUE,Number.MAX_VALUE],unknown:void 0,c64:void 0,c128:void 0};function Sre(t){return fkt[t]??[-34028234663852886e22,34028234663852886e22]}function nyi(t,e,i){var S,C;if(t.depthCount&&t.depthCount>1)return;const{pixels:r,statistics:n,pixelType:s}=t,o=r[0].length,a=t.bandMasks??[],c=t.mask??new Uint8Array(o).fill(255),p=s==="f32"||s==="f64",_=Sre(s);let x=!1;for(let M=0;MP+Number.EPSILON||F=dkt?pkt*Math.abs(P):s==="f32"?2**-23:Number.EPSILON);for(let G=0;G1?a:null,t.mask=c),x&&"updateStatistics"in t&&t.updateStatistics()}function qUe(t){return t==null||t.type==="simple"||t.type==="unique-value"||t.type==="class-breaks"||t.type==="dictionary"||t.type==="heatmap"}function syi(t,e){if(t==null)return null;if(!qUe(t))return new se("renderer-conversion-3d:unsupported-renderer",`Unsupported renderer of type '${t.type||t.declaredClass}'`,{renderer:t});switch(t.type){case"simple":return mkt(t);case"unique-value":return gkt(t,e);case"class-breaks":return ykt(t);case"dictionary":case"heatmap":return null}return null}function wue(t,e){if(!e)return null;let i;if(i=Array.isArray(e)?e:[e],i.length>0){const r=i.map(s=>s.details.symbol.type||s.details.symbol.declaredClass).filter(s=>!!s);r.sort();const n=[];return r.forEach((s,o)=>{o!==0&&s===r[o-1]||n.push(s)}),new se("renderer-conversion-3d:unsupported-symbols",`Renderer contains symbols (${n.join(", ")}) which are not supported in 3D`,{renderer:t,symbolErrors:i})}return null}function mkt(t){return wue(t,cP(t.symbol).error)}function gkt(t,e){var s;const i={...xA,...e},r=(s=t.uniqueValueInfos)==null?void 0:s.map(o=>cP(o.symbol,i).error).filter(ys),n=cP(t.defaultSymbol,i);return n.error&&(r==null||r.unshift(n.error)),wue(t,r)}function ykt(t){const e=t.classBreakInfos.map(r=>cP(r.symbol).error).filter(ys),i=cP(t.defaultSymbol);return i.error&&e.unshift(i.error),wue(t,e)}function vkt(t){return Lse(t)||het(t)||det(t)}function _kt(t,e){const{format:i,timeZoneOptions:r,fieldType:n}=e??{};let s,o;if(r&&({timeZone:s,timeZoneName:o}=QKe(r.layerTimeZone,r.datesInUnknownTimezone,r.viewTimeZone,pA(i||"short-date-short-time"),n)),typeof t=="string"&&isNaN(Date.parse(n==="time-only"?`1970-01-01T${t}Z`:t)))return t;switch(n){case"date-only":{const a=pA(i||"short-date");return typeof t=="string"?rQe(t,{...a}):Gs(t,{...a,timeZone:Xy})}case"time-only":{const a=pA(i||"short-time");return typeof t=="string"?nQe(t,a):Gs(t,{...a,timeZone:Xy})}case"timestamp-offset":{if(!s&&typeof t=="string"&&new Date(t).toISOString()!==t)return t;const a=i||r?pA(i||"short-date-short-time"):void 0,c=a?{...a,timeZone:s,timeZoneName:o}:void 0;return typeof t=="string"?sQe(t,c):Gs(t,c)}default:{const a=i||r?pA(i||"short-date-short-time"):void 0;return Gs(typeof t=="string"?new Date(t):t,a?{...a,timeZone:s,timeZoneName:o}:void 0)}}}var ol;(function(t){t[t.size=22]="size",t[t.lineWidth=50]="lineWidth",t[t.maxSize=120]="maxSize",t[t.maxOutlineSize=80]="maxOutlineSize",t[t.tallSymbolWidth=20]="tallSymbolWidth"})(ol||(ol={}));const sL={fill:[{type:"path",path:"M -10,-10 L 10,0 L 10,10 L -10,10 L -10,-10 Z"}],squareFill:[{type:"path",path:"M -10,-10 L 10,-10 L 10,10 L -10,10 L -10,-10 Z"}],meshSymbol3DFill:[{type:"path",path:"M -10,-8 L 6,0 L 6,6 L -10,6 L -10,-8 Z"},{type:"path",path:"M -10,-8 L -7,-10 L 9,-2 L 6,0 L -10,-8 Z"},{type:"path",path:"M 6,0 L 9,-2 L 9,4 L 6,6 L 6,0 Z"}],pathSymbol3DLayer:[{type:"path",path:"M 3,12 L 12,0 L 11,-2 L -4,5 L -1,5 L 1,7 L 3,10 L 3,12 Z"},{type:"circle",cx:-2,cy:10,r:5}],extrudeSymbol3DLayer:[{type:"path",path:"M -7,-5 L -2,0 L -2,7 L -7,3 L -7,-5 Z"},{type:"path",path:"M -2,0 L -2,7 L 10,-3 L 10,-10 L -2,0 Z"},{type:"path",path:"M -7,-5 L -2,0 L 10,-10 L -2,-10 L -7,-5 Z"}],cone:[{type:"path",path:"M 0,-10 L -8,5 L -4,6.5 L 0,7 L 4,6.5 L 8,5 Z"}],tallCone:[{type:"path",path:"M 0,-9 L -3.5,7 L -1.5,7.8 L 0,8 L 1.5,7.8 L 3.5,7 L 0,-9 Z"}],invertedCone:[{type:"path",path:"M 0,7 L -8,-8 L 8,-8 Z"},{type:"path",path:"M -8,-8 L -4,-9.5 L 0,-10 L 4,-9.5 L 8,-8 L 4,-6.5 L 0,-6 L -4,-6.5 Z"}],cube:[{type:"path",path:"M -10,-7 L 0,-12 L 10,-7 L 0,-2 L -10,-7 Z"},{type:"path",path:"M -10,-7 L 0,-2 L 0,12 L -10,7 L -10,-7 Z"},{type:"path",path:"M 0,-2 L 10,-7 L 10,7 L 0,12 L 0,-2 Z"}],tallCube:[{type:"path",path:"M -3.5,-8.5 L 0,-9.5 L 3.5,-8.5 L 0,-7.5 L -3.5,-8.5 Z"},{type:"path",path:"M -3.5,-8.5 L 0,-7.5 L 0,9 L -3.5,8 L -3.5,-8.5 Z"},{type:"path",path:"M 0,-7.5 L 3.5,-8.5 L 3.5,8 L 0,9 L 0,-7.5 Z"}],cylinder:[{type:"path",path:"M -8,-9 L -8,7 L -4,8.5 L 0,9 L 4,8.5 L 8,7 L 8,-9 Z"},{type:"ellipse",cx:0,cy:-9,rx:8,ry:2}],tallCylinder:[{type:"path",path:"M -3.5,-9 L -3.5,7 L -1.5,7.8 L 0,8 L 1.5,7.8 L 3.5,7 L 3.5,-9 Z"},{type:"ellipse",cx:0,cy:-9,rx:3.5,ry:1}],diamond:[{type:"path",path:"M 0,-10 L 10,-1 L -1,1 L 0,-10 Z"},{type:"path",path:"M 0,-10 L -1,1 L -8,-1 L 0,-10 Z"},{type:"path",path:"M -1,1 L 0,10 L -8,-1 L -1,1 Z"},{type:"path",path:"M -1,0 L 0,10 L 10,-1 L -1,1 Z"}],tetrahedron:[{type:"path",path:"M 0,-10 L 10,7 L 0,0 L 0,-10 Z"},{type:"path",path:"M 0,-10 L 0,0 L -8,7 L 0,-10 Z"},{type:"path",path:"M 10,7 L 0,0 L -8,7 L 10,7 Z"}]};function bkt(t,e,i){const r=ol.size;let n=r,s=r;t<1?n*=.75:t>1&&(s*=1.25);const o=0,a=0;let c=r,p=r;return e&&i&&(n=s=c=p=0),[{type:"path",path:[{command:"M",values:[c,o]},{command:"L",values:[i?c:.875*c,o]},{command:"L",values:[i?n-.5*c:a,s-.5*p]},{command:"L",values:[n-.5*c,s-.5*p]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[c,o]},{command:"L",values:[c,e?o:.125*p]},{command:"L",values:[n-.5*c,e?s-.5*p:p]},{command:"L",values:[n-.5*c,s-.5*p]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[n-.5*c,s-.5*p]},{command:"L",values:[i?n-.5*c:a,s-.5*p]},{command:"L",values:[i?n-.5*c:a,e?s-.5*p:p]},{command:"L",values:[n-.5*c,e?s-.5*p:p]},{command:"Z",values:[]}]}]}function wkt(t){const e=ol.size,i=.5*t,r=0,n=0;return[{type:"path",path:[{command:"M",values:[n,.7*e*.5]},{command:"L",values:[.3*e,.7*e]},{command:"L",values:[.3*e,.7*e+i]},{command:"L",values:[n,.7*e+i-.7*e*.5]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[.3*e,.7*e]},{command:"L",values:[.3*e,.7*e+i]},{command:"L",values:[e,i]},{command:"L",values:[e,r]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[.3*e,r]},{command:"L",values:[e,r]},{command:"L",values:[.3*e,.7*e]},{command:"L",values:[n,.7*e*.5]},{command:"Z",values:[]}]}]}function xkt(){return[{type:"path",path:"M80,80.2v-27c-1.5,0.7-2.8,1.6-3.9,2.8c-1.8,2.1-4.4,3.3-7.1,3.5c-2.7-0.1-5.3-1.4-7.1-3.4c-2.2-2.3-4.7-3.6-7.4-3.6s-5.1,1.3-7.3,3.6c-1.8,2.1-4.4,3.3-7.2,3.4c-2.7-0.1-5.3-1.4-7.1-3.4c-2.2-2.3-4.7-3.6-7.4-3.6s-5.1,1.3-7.4,3.6c-1.8,2.1-4.4,3.3-7.2,3.4C8.3,59.3,5.7,58,3.9,56c-1.1-1.2-2.4-2.1-3.9-2.8v27"},{type:"path",path:"M11,59.4c2.7-0.1,5.3-1.4,7.1-3.4c2.2-2.3,4.7-3.6,7.4-3.6s5.1,1.3,7.4,3.6c1.8,2,4.4,3.3,7.2,3.4c2.7-0.1,5.3-1.4,7.1-3.4c2.2-2.3,4.7-3.6,7.3-3.6s5.1,1.3,7.4,3.6c1.8,2.1,4.4,3.3,7.2,3.4c2.7-0.1,5.3-1.4,7.1-3.4c1.1-1.2,2.4-2.1,3.9-2.8v-24c-1.5,0.7-2.8,1.6-3.9,2.8c-1.8,2.1-4.4,3.3-7.1,3.5c-2.7-0.1-5.3-1.4-7.1-3.4c-2.2-2.3-4.7-3.6-7.4-3.6s-5.1,1.3-7.3,3.6c-1.8,2.1-4.4,3.3-7.2,3.4c-2.7-0.1-5.3-1.4-7.1-3.4c-2.2-2.3-4.7-3.6-7.4-3.6s-5.1,1.3-7.4,3.6c-1.8,2.1-4.4,3.3-7.2,3.4c-2.7-0.1-5.3-1.4-7.1-3.4c-1.1-1.2-2.4-2.1-3.9-2.8v24c1.5,0.7,2.8,1.6,3.9,2.8C5.7,58,8.3,59.3,11,59.4z"},{type:"path",path:"M11,35.4c2.7-0.1,5.3-1.4,7.1-3.4c2.2-2.3,4.7-3.6,7.4-3.6s5.1,1.3,7.4,3.6c1.8,2,4.4,3.3,7.2,3.4c2.7-0.1,5.3-1.4,7.1-3.4c2.2-2.3,4.7-3.6,7.3-3.6s5.1,1.3,7.4,3.6c1.8,2.1,4.4,3.3,7.2,3.4c2.7-0.1,5.3-1.4,7.1-3.4c1.1-1.2,2.4-2.1,3.9-2.8V3.6c-1.5,0.7-2.8,1.6-3.9,2.8c-2.2,2.1-4.6,3.4-7.1,3.4s-5-1.3-7.1-3.4s-4.7-3.6-7.4-3.6s-5.1,1.3-7.3,3.6S42.5,9.9,40,9.9s-5-1.3-7.1-3.4s-4.7-3.6-7.4-3.6s-5.1,1.3-7.3,3.6c-1.8,2.1-4.4,3.3-7.2,3.4c-2.5,0-5-1.3-7.1-3.4C2.8,5.3,1.4,4.3,0,3.6v25.6c1.5,0.7,2.8,1.6,3.9,2.8C5.7,34.1,8.3,35.3,11,35.4z"}]}function Skt(t,e){let i=e?ol.tallSymbolWidth:t;const r=t,n=e?4:6;i<=ol.size?i-=.5*n:i-=n;const s=0,o=0,a=e?.35*i:.5*i;return[{type:"path",path:[{command:"M",values:[.5*i,s]},{command:"L",values:[i,.5*a]},{command:"L",values:[.5*i,a]},{command:"L",values:[o,.5*a]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[s,.5*a]},{command:"L",values:[.5*i,a]},{command:"L",values:[.5*i,r]},{command:"L",values:[o,r-.5*a]},{command:"Z",values:[]}]},{type:"path",path:[{command:"M",values:[.5*i,a]},{command:"L",values:[.5*i,r]},{command:"L",values:[i,r-.5*a]},{command:"L",values:[i,.5*a]},{command:"Z",values:[]}]}]}function Tkt(t,e){let i=e?ol.tallSymbolWidth:t;const r=t,n=e?4:6;i<=ol.size?i-=.5*n:i-=n;const s=.5*i,o=.15*i,a=0,c=r-o;return[{type:"ellipse",cx:.5*i,cy:c,rx:s,ry:o},{type:"path",path:[{command:"M",values:[a,o]},{command:"L",values:[a,c]},{command:"L",values:[i,c]},{command:"L",values:[i,o]},{command:"Z",values:[]}]},{type:"ellipse",cx:.5*i,cy:o,rx:s,ry:o}]}function Ekt(t,e){let i=e?ol.tallSymbolWidth:t;const r=t,n=e?4:6;i<=ol.size?i-=.5*n:i-=n;const s=.15*i,o=r-s;return[{type:"ellipse",cx:.5*i,cy:o,rx:.5*i,ry:s},{type:"path",path:[{command:"M",values:[.5*i,0]},{command:"L",values:[i,o]},{command:"L",values:[0,o]},{command:"Z",values:[]}]}]}function Ckt(t){let e=t;const i=t,r=6;e=4?"auto":"optimizeLegibility",$kt={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},Lkt=/([A-DF-Za-df-z])|([-+]?\d*[.]?\d+(?:[eE][-+]?\d+)?)/g;let Fo={},zn={};const nxe={solid:"none",shortdash:[4,1],shortdot:[1,1],shortdashdot:[4,1,1,1],shortdashdotdot:[4,1,1,1,1,1],dot:[1,3],dash:[4,3],longdash:[8,3],dashdot:[4,3,1,3],longdashdot:[8,3,1,3],longdashdotdot:[8,3,1,3,1,3]},Dkt=Math.PI;let Nkt=1;function eO(t,e){const i=t*(Dkt/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function WUe(t){return t.map(e=>`${e.command} ${e.values.join(" ")}`).join(" ").trim()}function xue(t,e,i,r){if(t){if(t.type==="circle")return X("circle",{cx:t.cx,cy:t.cy,fill:e,"fill-rule":"evenodd",r:t.r,stroke:i.color,"stroke-dasharray":i.dashArray,"stroke-dashoffset":i.dashOffset,"stroke-linecap":i.cap,"stroke-linejoin":i.join,"stroke-miterlimit":"4","stroke-width":i.width});if(t.type==="ellipse")return X("ellipse",{cx:t.cx,cy:t.cy,fill:e,"fill-rule":"evenodd",rx:t.rx,ry:t.ry,stroke:i.color,"stroke-dasharray":i.dashArray,"stroke-linecap":i.cap,"stroke-linejoin":i.join,"stroke-miterlimit":"4","stroke-width":i.width});if(t.type==="rect")return X("rect",{fill:e,"fill-rule":"evenodd",height:t.height,stroke:i.color,"stroke-dasharray":i.dashArray,"stroke-linecap":i.cap,"stroke-linejoin":i.join,"stroke-miterlimit":"4","stroke-width":i.width,width:t.width,x:t.x,y:t.y});if(t.type==="image")return X("image",{height:t.height,href:t.src,preserveAspectRatio:"none",width:t.width,x:t.x,y:t.y});if(t.type==="path"){const n=typeof t.path!="string"?WUe(t.path):t.path;return X("path",{d:n,fill:e,"fill-rule":"evenodd",stroke:i.color,"stroke-dasharray":i.dashArray,"stroke-linecap":i.cap,"stroke-linejoin":i.join,"stroke-miterlimit":"4","stroke-width":i.width})}if(t.type==="text")return Gy(r),X("text",{"dominant-baseline":r.dominantBaseline,fill:e,"fill-rule":"evenodd","font-family":r.font.family,"font-size":r.font.size,"font-style":r.font.style,"font-variant":r.font.variant,"font-weight":r.font.weight,kerning:r.kerning,rotate:r.rotate,stroke:i.color,"stroke-dasharray":i.dashArray,"stroke-linecap":i.cap,"stroke-linejoin":i.join,"stroke-miterlimit":"4","stroke-width":i.width,"text-anchor":r.align,"text-decoration":r.decoration,"text-rendering":Ikt,x:t.x,y:t.y},t.text)}return null}function Sue(t){const e={fill:"none",pattern:null,linearGradient:null};if(t){if("type"in t&&t.type==="pattern"){const i="patternId-"+ ++Pkt;e.fill=`url(#${i})`,e.pattern={id:i,x:t.x,y:t.y,width:t.width,height:t.height,image:{x:0,y:0,width:t.width,height:t.height,href:t.src}}}else if("type"in t&&t.type==="linear"){const i="linearGradientId-"+ ++Rkt;e.fill=`url(#${i})`,e.linearGradient={id:i,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stops:t.colors.map(r=>({offset:r.offset,color:r.color&&new qe(r.color).toString()}))}}else if(t){const i=new qe(t);e.fill=i.toString()}}return e}function Tue(t){const e={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};if(t&&(t.width!=null&&(e.width=t.width),t.cap&&(e.cap=t.cap),t.join&&(e.join=t.join.toString()),t.color&&(e.color=new qe(t.color).toString()),t.dashArray&&(e.dashArray=t.dashArray),t.dashArray&&(e.dashOffset=t.dashoffset),t.style)){let i=null;if(t.style in nxe&&(i=nxe[t.style]),Array.isArray(i)){i=i.slice(0);const r=t.width??0;for(let n=0;nX("stop",{key:`${s}-stop`,offset:n.offset,"stop-color":n.color}));return X("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2},r)}return null}function Fkt(t,e){if(!t||t.length===0)return null;const i=[];for(const r of t){const{shape:n,fill:s,stroke:o,font:a}=r,c=Sue(s),p=Tue(o),_=n.type==="text"?YUe(n,a):null,x=xue(n,c.fill,p,_);x&&i.push(x)}return X("mask",{id:e,maskUnits:"userSpaceOnUse"},X("g",null,i))}function sxe(t,e,i){return kG(t,NG(t),[e,i])}function oxe(t,e,i,r,n){return Hce(t,NG(t),[e,i]),t[4]=t[4]*e-r*e+r,t[5]=t[5]*i-n*i+n,t}function kkt(t,e,i,r){const n=e%360*Math.PI/180;FG(t,NG(t),n);const s=Math.cos(n),o=Math.sin(n),a=t[4],c=t[5];return t[4]=a*s-c*o+r*o-i*s+i,t[5]=c*s+a*o-i*o-r*s+r,t}function Cu(t,e){Fo&&"left"in Fo?(Fo.left!=null&&Fo.left>t&&(Fo.left=t),(Fo.right==null||Fo.righte)&&(Fo.top=e),(Fo.bottom==null||Fo.bottom=r&&(n={action:t,args:e.slice(0,e.length-e.length%r)},i.push(n),axe(n)):(n={action:t,args:[]},i.push(n),axe(n)))}function zkt(t){const e=(typeof t.path!="string"?WUe(t.path):t.path).match(Lkt),i=[];if(Fo={},zn={},!e)return null;let r="",n=[];const s=e.length;for(let a=0;ai?e:i;let U=1,j=1;isNaN(k)||(z>1?(U=k/x,j=k/z/S):(j=k/S,U=k*z/x)),BS(M,M,oxe(C,U,j,p,_)),P=!0}const $=t.x+(x-r)/2,F=t.y+(S-r)/2;if(BS(M,M,sxe(C,p-$,_-F)),!P&&(x>e||S>i)){const z=x/e>S/i,k=(z?e:i)/(z?x:S);BS(M,M,oxe(C,k,k,$,F))}return s&&BS(M,M,kkt(C,s,$,F)),a&&BS(M,M,sxe(C,a[0],a[1])),`matrix(${M[0]},${M[1]},${M[2]},${M[3]},${M[4]},${M[5]})`}function Ukt(t,e,i){const r=t==null?void 0:t.effects.find(p=>p.type==="bloom");if(!r)return null;const{strength:n,radius:s}=r,o=n>0?s:0,a=(n+o)*e,c=4*n+1;return X("filter",{filterUnits:"userSpaceOnUse",height:"300%",id:`bloom${i}`,width:"300%",x:"-100%",y:"-100%"},X("feMorphology",{in:"SourceGraphic",operator:"dilate",radius:(n+.5*o)*(5**(e/100)*(.4+e/100)),result:"dilate"}),X("feGaussianBlur",{in:"dilate",result:"blur",stdDeviation:a/25}),X("feGaussianBlur",{in:"blur",result:"intensityBlur",stdDeviation:a/50}),X("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},X("feFuncR",{slope:c,type:"linear"}),X("feFuncG",{slope:c,type:"linear"}),X("feFuncB",{slope:c,type:"linear"})),X("feMerge",null,X("feMergeNode",{in:"intensityBlur"}),X("feMergeNode",{in:"intensityBrightness"}),X("feGaussianBlur",{stdDeviation:n/10})))}function KUe(t,e,i,r={}){var _;const n=[],s=[],o=++Nkt,a=Ukt(r.effectView,e,o);let c=null;if(a){const x=(_=r.effectView)==null?void 0:_.effects.find(P=>P.type==="bloom"),S=(x.strength?x.strength+x.radius/2:0)/3,C=e+e*S,M=i+i*S;c=[Math.max(C,10),Math.max(M,10)]}for(let x=0;x!!o.length))return null;const s=(i==null?void 0:i.node)||document.createElement("div");return i.opacity!=null&&(s.style.opacity=i.opacity.toString()),i.effectView!=null&&(s.style.filter=i9(i.effectView)),Vkt(s,()=>KUe(t,r,n,i)),s}function Bkt(t,e){t=Math.ceil(t),e=Math.ceil(e);const i=document.createElement("canvas");i.width=t,i.height=e,i.style.width=t+"px",i.style.height=e+"px";const r=i.getContext("2d");return r.clearRect(0,0,t,e),r}function jkt(t,e,i){return t?yi(t,{responseType:"image"}).then(r=>{const n=r.data,s=n.width,o=n.height,a=s/o;let c=e;if(i){const p=Math.max(s,o);c=Math.min(c,p)}return{image:n,width:a<=1?Math.ceil(c*a):c,height:a<=1?c:Math.ceil(c/a)}}):Promise.reject(new se("renderUtils: imageDataSize","href not provided."))}function Gkt(t,e){return!(!t||e==="ignore")&&(e!=="multiply"||t.r!==255||t.g!==255||t.b!==255||t.a!==1)}function Hkt(t,e,i,r,n){switch(n){case"multiply":t[e]*=i[0],t[e+1]*=i[1],t[e+2]*=i[2],t[e+3]*=i[3];break;default:{const s=Nj({r:t[e],g:t[e+1],b:t[e+2]});s.h=r.h,s.s=r.s,s.v=s.v/100*r.v;const o=PE(s);t[e]=o.r,t[e+1]=o.g,t[e+2]=o.b,t[e+3]*=i[3];break}}}function qkt(t,e,i,r,n){return jkt(t,e,n).then(s=>{const o=s.width??e,a=s.height??e;if(s.image&&Gkt(i,r)){let c=s.image.width,p=s.image.height;$e("edge")&&/\.svg$/i.test(t)&&(c-=1,p-=1);const _=Bkt(o,a);_.drawImage(s.image,0,0,c,p,0,0,o,a);const x=_.getImageData(0,0,o,a),S=[i.r/255,i.g/255,i.b/255,i.a],C=Nj(i);for(let M=0;M({url:t,width:e,height:e}))}const QUe="esri-relationship-ramp",tA=`${QUe}--diamond`,Ub=`${QUe}--square`,Wkt="http://www.w3.org/2000/svg",Es={diamondContainer:`${tA}__container`,diamondLeftCol:`${tA}__left-column`,diamondRightCol:`${tA}__right-column`,diamondMidCol:`${tA}__middle-column`,diamondMidColLabel:`${tA}__middle-column--label`,diamondMidColRamp:`${tA}__middle-column--ramp`,squareTable:`${Ub}__table`,squareTableRow:`${Ub}__table-row`,squareTableCell:`${Ub}__table-cell`,squareTableLabel:`${Ub}__table-label`,squareTableLabelLeftBottom:`${Ub}__table-label--left-bottom`,squareTableLabelRightBottom:`${Ub}__table-label--right-bottom`,squareTableLabelLeftTop:`${Ub}__table-label--left-top`,squareTableLabelRightTop:`${Ub}__table-label--right-top`};function eVe(t,e,i={}){const{focus:r,labels:n}=t,s=!!r,o=Ykt(t,e,i),a={justifyContent:"center"},c=ZT();return s?X("div",{class:Es.diamondContainer,styles:a},X("div",{class:Es.diamondLeftCol},c?n.right:n.left),X("div",{class:Es.diamondMidCol},X("div",{class:Es.diamondMidColLabel},n.top),o,X("div",{class:Es.diamondMidColLabel},n.bottom)),X("div",{class:Es.diamondRightCol},c?n.left:n.right)):X("div",{class:Es.squareTable},X("div",{class:Es.squareTableRow},X("div",{class:rT(Es.squareTableCell,Es.squareTableLabel,Es.squareTableLabelRightBottom)},c?n.top:n.left),X("div",{class:Es.squareTableCell}),X("div",{class:rT(Es.squareTableCell,Es.squareTableLabel,Es.squareTableLabelLeftBottom)},c?n.left:n.top)),X("div",{class:Es.squareTableRow},X("div",{class:Es.squareTableCell}),o,X("div",{class:Es.squareTableCell})),X("div",{class:Es.squareTableRow},X("div",{class:rT(Es.squareTableCell,Es.squareTableLabel,Es.squareTableLabelRightTop)},c?n.right:n.bottom),X("div",{class:Es.squareTableCell}),X("div",{class:rT(Es.squareTableCell,Es.squareTableLabel,Es.squareTableLabelLeftTop)},c?n.bottom:n.right)))}function uxe(t,e,i){const r=`${i}_arrowStart`,n=`${i}_arrowEnd`,s=t==="left",o={markerStart:null,markerEnd:null};switch(e){case"HL":s?o.markerStart=`url(#${n})`:o.markerEnd=`url(#${r})`;break;case"LL":o.markerStart=`url(#${n})`;break;case"LH":s?o.markerEnd=`url(#${r})`:o.markerStart=`url(#${n})`;break;default:o.markerEnd=`url(#${r})`}return o}function Ykt(t,e,i={}){const{focus:r,numClasses:n,colors:s,rotation:o}=t,{opacity:a,effectList:c,ariaLabel:p}=i,_=i.size??60,x=!!r,S=Math.sqrt(_**2+_**2)+(x?0:5),C=[],M=[],P=[],$=(_||75)/n;for(let ce=0;cenull);if(o&&"thumbnail"in o&&((s=o.thumbnail)!=null&&s.url))return o.thumbnail.url}return i}function AX(t,e=1){const i=t.a,r=Nj(t),n=r.h,s=r.s/e,o=100-(100-r.v)/e,{r:a,g:c,b:p}=PE({h:n,s,v:o});return[a,c,p,i]}function FV(t){var e;return t.type==="water"?t.color==null?null:t.color:((e=t.material)==null?void 0:e.color)==null?null:t.material.color}function Rn(t,e=0){const i=FV(t);if(!i){if(t.type==="fill")return null;const n=QEt.r,s=M2(n,e);return[s,s,s,100]}const r=i.toRgba();for(let n=0;n<3;n++)r[n]=M2(r[n],e);return r}async function tVe(t,e){const i=t.style;return i==="none"?null:{type:"pattern",x:0,y:0,src:await KEt(Wr(`esri/symbols/patterns/${i}.png`),e.toCss(!0)),width:5,height:5}}function dxe(t){return t.outline?tO(t):{color:"rgba(0, 0, 0, 1)",width:1.5}}function Cue(t,e){const i=FV(t);if(!i)return null;let r="rgba(";return r+=M2(i.r,e)+",",r+=M2(i.g,e)+",",r+=M2(i.b,e)+",",r+i.a+");"}function Cre(t,e){const i=Cue(t,e);return i?"pattern"in t&&t.pattern!=null&&t.pattern.type==="style"&&t.pattern.style==="none"?null:{color:i,width:Math.min(t.size?Er(t.size):.75,Eue),style:"pattern"in t&&t.pattern!=null&&t.pattern.type==="style"?yce(t.pattern.style):null,cap:"cap"in t?t.cap:null,join:"join"in t?t.join==="miter"?Er(2):t.join:null}:{}}function Y8(t,e,i){const r=i!=null?.75*i:0;return{type:"linear",x1:r?.25*r:0,y1:r?.5*r:0,x2:r||4,y2:r?.5*r:4,colors:[{color:t,offset:0},{color:e,offset:1}]}}function Zkt(t){const e=t.depth,i=t.height,r=t.width;return r!==0&&e!==0&&i!==0&&r===e&&r!=null&&i!=null&&r{var $,F;if(C.type!=="icon"&&C.type!=="object")return;const M=C.type==="icon"?C.size&&Er(C.size):0,P=i||M?Math.ceil(Math.min(i||M,r||Uk)):qS;if(($=C==null?void 0:C.resource)!=null&&$.href){const z=Xkt(t,C).then(k=>{var G;const U=(G=C==null?void 0:C.material)==null?void 0:G.color,j=Kkt(C);return qkt(k,P,U,j,n)}).then(k=>{const U=k.width,j=k.height;return a=Math.max(a,U),c=Math.max(c,j),[{shape:{type:"image",x:0,y:0,width:U,height:j,src:k.url},fill:null,stroke:null}]});o.push(z)}else{let z=P;C.type==="icon"&&_&&i&&(z=P*(M/_));const k=(e==null?void 0:e.symbolConfig)==="tall"||((F=e==null?void 0:e.symbolConfig)==null?void 0:F.isTall)||C.type==="object"&&Zkt(C);a=Math.max(a,k?Ere:z),c=Math.max(c,z),o.push(Promise.resolve(Jkt(C,z,k)))}});const x=await Promise.allSettled(o),S=[];return x.forEach(C=>{C.status==="fulfilled"?S.push(C.value):C.reason&&Ce.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!",C.reason)}),C6(S,[a,c],{node:e==null?void 0:e.node,scale:!1,opacity:e==null?void 0:e.opacity,ariaLabel:e==null?void 0:e.ariaLabel})}function ezt(t,e){const i=t.symbolLayers,r=[],n=TG(t),s=YG(e),o=(e!=null&&e.maxSize?Er(e.maxSize):null)||Eue;let a,c=0,p=0;return i.forEach((_,x)=>{if(!_||_.type!=="line"&&_.type!=="path")return;const S=[];switch(_.type){case"line":{const C=Cre(_,0);if(C==null)break;const M=(C==null?void 0:C.width)||0;x===0&&(a=M);const P=Math.min(s||M,o),$=x===0?P:s?P*(M/a):P,F=$>hxe/2?2*$:hxe;p=Math.max(p,$),c=Math.max(c,F),C.width=$,S.push({shape:{type:"path",path:[{command:"M",values:[0,.5*p]},{command:"L",values:[c,.5*p]}]},stroke:C});break}case"path":{const C=Math.min(s||qS,o),M=Rn(_,0),P=Rn(_,-.2),$=Cue(_,-.4),F=$?{color:$,width:1}:{};if(_.profile==="quad"){const z=_.width,k=_.height,U=bkt(z&&k?z/k:1,k===0,z===0),j={...F,join:"bevel"};S.push({shape:U[0],fill:P,stroke:j},{shape:U[1],fill:P,stroke:j},{shape:U[2],fill:M,stroke:j})}else S.push({shape:sL.pathSymbol3DLayer[0],fill:P,stroke:F},{shape:sL.pathSymbol3DLayer[1],fill:M,stroke:F});p=Math.max(p,C),c=p}}r.push(S)}),Promise.resolve(C6(r,[c,p],{node:e==null?void 0:e.node,scale:n,opacity:e==null?void 0:e.opacity,ariaLabel:e==null?void 0:e.ariaLabel}))}async function tzt(t,e){const i=t.type==="mesh-3d",r=t.symbolLayers,n=YG(e),s=e!=null&&e.maxSize?Er(e.maxSize):null,o=n||qS,a=[];let c=0,p=0,_=!1;for(let x=0;x{s[a.value]={label:a.label,fill:szt(a.symbol)}});const o=[];for(let a=0;aM+P,0)===100,_=[0];for(let M=0;Mz.addColorStop(G*U,j.toString())),M.fillStyle=z,M.fillRect(0,0,x,S)}else{const z=n?x/t.length:x,k=n?S:S/t.length;let U=0,j=0;for(const G of t)M.fillStyle=G.toString(),M.fillRect(U,j,z,k),U=n?U+z:0,j=n?0:j+k}const F=document.createElement("div");return F.style.width=`${a}px`,F.style.height=`${c}px`,uzt(F,e==null?void 0:e.effectList),F.appendChild(C),F}function uzt(t,e){if(!e)return;t.style.filter=i9(e);const i=e.effects;if(i){for(const r of i)if((r==null?void 0:r.type)==="drop-shadow"){r.offsetX<0?t.style.marginLeft=`${Math.abs(r.offsetX)}px`:t.style.marginRight=`${r.offsetX}px`;break}}}async function rVe(t,e){switch(t.type){case"web-style":{const{previewWebStyleSymbol:i}=await we(()=>import("./previewWebStyleSymbol-UL5fXUcj.js"),__vite__mapDeps([]));return i(t,rVe,e)}case"label-3d":case"line-3d":case"mesh-3d":case"point-3d":case"polygon-3d":{const{previewSymbol3D:i}=await we(()=>Promise.resolve().then(()=>rzt),void 0);return i(t,e)}case"simple-marker":case"simple-line":case"simple-fill":case"picture-marker":case"picture-fill":case"text":{const{previewSymbol2D:i}=await we(()=>import("./previewSymbol2D-GOMXlSDG.js"),__vite__mapDeps([]));return i(t,e)}case"cim":{const{previewCIMSymbol:i}=await we(()=>import("./previewCIMSymbol-mCxoLtDl.js"),__vite__mapDeps([240,211,97,77,78,100,110,210,163]));return i(t,e)}default:return}}function nVe(t){return t&&"opacity"in t?t.opacity*nVe(t.parent):1}async function ayi(t,e){var k;if(!t)return;const i=t.sourceLayer,r=(e!=null&&e.useSourceLayer?i:t.layer)??i,n=nVe(r);if(t.symbol!=null&&(e==null||e.ignoreGraphicSymbol!==!0)){const U=t.symbol.type==="web-style"?await gCt(t.symbol,{...e,cache:e!=null?e.webStyleCache:null}):t.symbol.clone();return YW(U,null,n),U}const s=(e!=null?e.renderer:null)??(r&&"renderer"in r?r.renderer:null);let o=s&&"getSymbolAsync"in s?await s.getSymbolAsync(t,e):null;if(!o)return;if(o=o.type==="web-style"?await o.fetchSymbol({...e,cache:e!=null?e.webStyleCache:null}):o.clone(),!s||!("visualVariables"in s)||!((k=s.visualVariables)!=null&&k.length))return YW(o,null,n),o;if("arcadeRequiredForVisualVariables"in s&&s.arcadeRequiredForVisualVariables&&(e==null?void 0:e.arcade)==null){const U={...e};U.arcade=await b_(),e=U}const{getColor:a,getOpacity:c,getAllSizes:p,getRotationAngle:_}=await we(()=>Promise.resolve().then(()=>SE),void 0),x=[],S=[],C=[],M=[];for(const U of s.visualVariables)switch(U.type){case"color":x.push(U);break;case"opacity":S.push(U);break;case"rotation":M.push(U);break;case"size":U.target||C.push(U)}const P=!!x.length&&x[x.length-1],$=P?a(P,t,e):null,F=!!S.length&&S[S.length-1];let z=F?c(F,t,e):null;if(n!=null&&(z=z!=null?z*n:n),YW(o,$,z),C.length){const U=p(C,t,e);await fCt(o,U)}for(const U of M)mCt(o,_(U,t,e),U.axis);return o}const hzt=(t,e)=>{const i=t.featuresTilingScheme.getClosestInfoForScale(t.scale).level;return e!=null&&e.levels?e.levels[i]:null};function dzt(t,e){if(!t||!("visualVariables"in t)||!t.visualVariables)return null;const i=t.visualVariables.find(n=>n.type==="size"),r=hzt(e,i);return r?new soe({field:i.field,minSize:r[2].size,minDataValue:r[2].value,maxSize:r[3].size,maxDataValue:r[3].value}):null}const pzt=/^-?(\d+)(\.(\d+))?$/i;function fzt(t,e){return t-e}function mzt(t,e){let i,r;return i=Number(t.toFixed(e)),i0;c||(a=Math.abs(a));const p=kV(o);return c?(p.integer+=a,a>p.fractional?p.fractional=0:p.fractional-=a):(p.fractional+=a,a>p.integer?p.integer=1:p.integer-=a),p}}return{integer:0,fractional:0}}function Vk(t,e,i,r){const n={previous:null,next:null};if(i!=null){const s=t-i,o=e-i-s;n.previous=Math.floor(Math.abs(100*o/s))}if(r!=null){const s=r-t,o=r-e-s;n.next=Math.floor(Math.abs(100*o/s))}return n}function zV(t,e={}){const i=t.slice(0),{tolerance:r=2,strictBounds:n=!1,indexes:s=i.map((o,a)=>a)}=e;s.sort(fzt);for(let o=0;oo.type==="color");if(!e)return null;let i=null,r=null;if(e.stops){if(e.stops.length===1)return e.stops[0].color;i=e.stops[0].value,r=e.stops[e.stops.length-1].value}const n=i!=null&&r!=null?i+(r-i)/2:0,{getColor:s}=await we(()=>Promise.resolve().then(()=>SE),void 0);return s(e,n)??null}async function lVe(t,e){const i=t.trailCap,r=t.trailWidth||1,n=e||await Are(t)||t.color;return new Ic({cap:i,color:n,width:r})}function gxe(t){return t!=null&&typeof t=="object"&&"min"in t&&"max"in t}const bzt=new qe([64,64,64]);function cVe(t,e){const i=[],r=t.length-1;return t.length===5?i.push(0,2,4):i.push(0,r),t.map((n,s)=>i.includes(s)?aVe(n,s,r,e):null)}async function Mre(t,e,i){let r=!1,n=[],s=[];if(t.stops){const p=t.stops;n=p.map(_=>_.value),r=p.some(_=>!!_.label),r&&(s=p.map(_=>_.label))}const o=n[0],a=n[n.length-1];if(o==null&&a==null)return null;const c=r?null:cVe(n,i);return(await Promise.all(n.map(async(p,_)=>({value:p,color:t.type==="opacity"?await wzt(p,t,e):(await we(()=>Promise.resolve().then(()=>SE),void 0)).getColor(t,p),label:r?s[_]:(c==null?void 0:c[_])??""})))).reverse()}async function wzt(t,e,i){const r=new qe(i??bzt),n=(await we(()=>Promise.resolve().then(()=>SE),void 0)).getOpacity(e,t);return n!=null&&(r.a=n),r}function xzt(t){let e=!1,i=[],r=[];i=t.map(a=>a.value),e=t.some(a=>!!a.label),e&&(r=t.map(a=>a.label??""));const n=i[0],s=i[i.length-1];if(n==null&&s==null)return null;const o=e?null:cVe(i);return i.map((a,c)=>({value:a,color:uVe(a,t),label:e?r[c]:(o==null?void 0:o[c])??""})).reverse()}function uVe(t,e){const{startIndex:i,endIndex:r,weight:n}=Szt(t,e);if(i===r)return e[i].color;const s=qe.blendColors(e[i].color,e[r].color,n);return new qe(s)}function Szt(t,e){let i=0,r=e.length-1;return e.some((n,s)=>t{n===0?i.push({value:e.max,color:new qe(r.toColor),label:"high"}):i.push({value:null,color:new qe(r.toColor),label:""}),n===t.colorRamps.length-1?i.push({value:e.min,color:new qe(r.fromColor),label:"low"}):i.push({value:null,color:new qe(r.fromColor),label:""})});else{let r,n;t&&t.type==="algorithmic"?(r=t.fromColor,n=t.toColor):(r=[0,0,0,1],n=[255,255,255,1]),i=[{value:e.max,color:new qe(n),label:"high"},{value:e.min,color:new qe(r),label:"low"}]}return i}function hVe(t){if(!t.colorStops)return[];const e=[...t.colorStops].filter(r=>{var n;return((n=r.color)==null?void 0:n.a)>0});let i=e.length-1;if(e&&e[0]){const r=e[i];r&&r.ratio!==1&&(e.push(new d$({ratio:1,color:r.color})),i++)}return e.map((r,n)=>{var o,a;let s="";return n===0?s=((o=t.legendOptions)==null?void 0:o.minLabel)||"low":n===i&&(s=((a=t.legendOptions)==null?void 0:a.maxLabel)||"high"),{color:r.color,label:s,ratio:r.ratio}}).reverse()}const Ore=30,Pre=12,dVe=[255,255,255],pVe=[200,200,200],iO=[128,128,128],Ezt=20,Czt=5;function Azt(t){return t.declaredClass==="esri.symbols.SimpleMarkerSymbol"}function Mzt(t){return t.declaredClass==="esri.symbols.PictureMarkerSymbol"}function Ozt(t){return t.declaredClass==="esri.symbols.SimpleLineSymbol"}function Pzt(t){return t.declaredClass==="esri.symbols.TextSymbol"}function Rzt(t,e){const i=t.length-1;return t.map((r,n)=>aVe(r,n,i,e))}async function Izt(t,e,i,r,n,s,o){const a=e.legendOptions,c=a==null?void 0:a.customValues,p=o||await Dzt(t,i),_=e.stops,x=!!p,S=!!c,C=e.minSize!=null&&e.maxSize!=null,M=_&&_.length>1,P=!!e.target;if(!x||!S&&!(C||M&&!P))return;const $=TG(p);let F=!1,z=null,k=null;z=$&&!M?zV([e.minDataValue,e.maxDataValue]):c??await Fzt(e,p,r,n==null?void 0:n.type);const U=t==null?void 0:t.authoringInfo,j=(U==null?void 0:U.type)==="univariate-color-size",G=j&&(U==null?void 0:U.univariateTheme)==="above-and-below";if(!z&&M&&(z=_.map(ie=>ie.value),F=_.some(ie=>!!ie.label),t.type==="flow"&&(z=zV(z)),F&&(k=_.map(ie=>ie.label))),$&&z!=null&&(z==null?void 0:z.length)>2&&!G&&(z=[z[0],z[z.length-1]]),!z)return null;j&&(z==null?void 0:z.length)!==5&&(z=gVe({minSize:z[0],maxSize:z[z.length-1]}));const Y=$?$zt(t,z):null,Q=iCt(p),ne=F?null:Rzt(z,s);return(await Promise.all(z.map(async(ie,he)=>{const ce=$?Y[he]:await dM(e,p,ie,r,n==null?void 0:n.type);return{value:ie,symbol:Uzt(G&&t.type==="class-breaks"?Lzt(t,he):p,ce),label:F?k[he]:ne[he],size:ce,outlineSize:Q}}))).reverse()}function $zt(t,e){const i=t==null?void 0:t.authoringInfo,r=(i==null?void 0:i.type)==="univariate-color-size";let n=[Pre,Ore];if(r){const s=e[0],o=e[e.length-1],a=Pre,c=Ore;n=e.map(p=>a+(p-s)/(o-s)*(c-a))}return r&&(i==null?void 0:i.univariateTheme)==="below"&&n.reverse(),n}function Lzt(t,e){const i=t.classBreakInfos,r=i.length,n=r<2||!(e>=2)?i[0].symbol.clone():i[r-1].symbol.clone();return t.visualVariables.some(s=>s.type==="color")&&(n.type.includes("3d")?fVe(n):mVe(n)),n}async function Dzt(t,e){var n,s;if(t.type==="flow")return lVe(t,e);if(t.type==="pie-chart")return new du({color:null,outline:(n=t.outline)!=null&&n.width?t.outline:new Ic});let i=null,r=null;if(t.type==="simple")i=t.symbol;else if(t.type==="class-breaks"){const o=t.classBreakInfos;i=o&&o[0]&&o[0].symbol,r=o.length>1}else if(t.type==="unique-value"){const o=t.uniqueValueInfos;i=(s=o==null?void 0:o[0])==null?void 0:s.symbol,r=o!=null&&o.length>1}return!i||Nzt(i)?null:(i=i.clone(),(e||r)&&(i.type.includes("3d")?fVe(i):mVe(i)),i)}function Nzt(t){return t?Ky(t)?!!t.symbolLayers&&t.symbolLayers.some(e=>e&&e.type==="fill"):t.type.includes("fill"):!1}function fVe(t){t.type==="line-3d"?t.symbolLayers.forEach(e=>{e.material={color:iO}}):t.symbolLayers.forEach(e=>{var i;e.type!=="icon"||(i=e.resource)!=null&&i.href?e.material={color:pVe}:(e.material={color:dVe},e.outline={color:iO,size:1.5})})}function mVe(t){var i,r;const e=yze();t.type==="cim"?QNe(t,new qe(pVe)):t.type.includes("line")?t.color=iO:(t.color=e?iO:dVe,t.type==="simple-marker"&&(t.outline?((r=(i=t.outline)==null?void 0:i.color)==null?void 0:r.toHex())==="#ffffff"&&(t.outline.color=iO):t.outline={color:iO,width:1.5}))}async function Fzt(t,e,i,r){const n=(await we(()=>Promise.resolve().then(()=>SE),void 0)).getSizeRangeAtScale(t,i,r),s=n&&gVe(n);if(!n||!s)return;let o=s.map(a=>kzt(a,t,n));o=zV(o);for(let a=1;a=n?a=o:a=(t-r)/(n-r)*(o-s)+s,a}async function zzt(t,e,i,r,n,s){const o=await dM(t,e,i,n,s),a=await dM(t,e,r,n,s),c=kV(i),p=c.fractional,_=Ezt;let x=c.integer,S=null,C=null;i>0&&i<1&&(S=10**p,x=kV(i*=S).integer);for(let M=x-1;M>=0;M--){const P=10**M;let $=Math.floor(i/P)*P,F=Math.ceil(i/P)*P;S!=null&&($/=S,F/=S);let z=($+F)/2;[,z]=zV([$,z,F],{indexes:[1]});const k=await dM(t,e,$,n,s),U=await dM(t,e,F,n,s),j=await dM(t,e,z,n,s),G=Vk(o,k,a,null),Y=Vk(o,U,a,null),Q=Vk(o,j,a,null);let ne=G.previous<=_,ie=Y.previous<=_;if(ne&&ie&&(G.previous<=Y.previous?(ne=!0,ie=!1):(ie=!0,ne=!1)),ne?C=[$,k]:ie?C=[F,U]:Q.previous<=_&&(C=[z,j]),C)break}return C}async function dM(t,e,i,r,n){const{getSize:s}=await we(()=>Promise.resolve().then(()=>SE),void 0);return s(t,i,{scale:r,view:n,shape:e.type==="simple-marker"?e.style:null})}function Uzt(t,e){const i=t.clone();if(Ky(i))TG(i)||i.symbolLayers.forEach(r=>{r.type!=="fill"&&(r.size=e)});else if(Azt(i))i.size=e;else if(Mzt(i)){const r=i.width,n=i.height;i.height=e,i.width=e*(r/n)}else Ozt(i)?i.width=e:Pzt(i)&&i.font&&(i.font.size=e);return i}Ce.getLogger("esri.renderers.support.utils");async function Id(t,e,i){oB(t,e,()=>[]).push(...i)}async function lyi(t){var i,r;const e=new Map;if(!t)return e;if("visualVariables"in t&&t.visualVariables){const n=t.visualVariables.filter(s=>s.type==="color");for(const s of n){const o=(await Mre(s)??[]).map(a=>a.color);await Id(e,s.field||s.valueExpression,o)}}if(t.type==="heatmap"){const n=hVe(t).map(s=>s.color);await Id(e,t.field||t.valueExpression,n)}else if(t.type==="pie-chart"){for(const n of t.attributes)await Id(e,n.field||n.valueExpression,[n.color]);await Id(e,"default",[(i=t==null?void 0:t.othersCategory)==null?void 0:i.color,EC(t.backgroundFillSymbol,null)])}else if(t.type==="dot-density"){for(const n of t.attributes)await Id(e,n.field||n.valueExpression,[n.color]);await Id(e,"default",[t.backgroundColor])}else if(t.type==="unique-value")if(((r=t.authoringInfo)==null?void 0:r.type)==="predominance")for(const n of t.uniqueValueInfos??[])await Id(e,n.value.toString(),[EC(n.symbol,null)]);else{const n=(t.uniqueValueInfos??[]).map(p=>EC(p.symbol,null)),{field:s,field2:o,field3:a,valueExpression:c}=t;(s||c)&&await Id(e,s||c,n),o&&await Id(e,o,n),a&&await Id(e,a,n)}else if(t.type==="class-breaks"){const n=t.classBreakInfos.map(a=>EC(a.symbol,null)),{field:s,valueExpression:o}=t;await Id(e,s??o,n)}else t.type==="simple"&&await Id(e,"default",[EC(t.symbol,null)]);return"defaultSymbol"in t&&t.defaultSymbol&&await Id(e,"default",[EC(t.defaultSymbol,null)]),e.forEach((n,s)=>{const o=_9(n.filter(Boolean),(a,c)=>JSON.stringify(a)===JSON.stringify(c));e.set(s,o)}),e}function Vzt(t){const i=Math.floor(Math.log10(Math.abs(t)))+1,r=i<4||i>6?4:i,n=1e6,s=Math.abs(t)>=n?"compact":"standard";return hd(t,{notation:s,minimumSignificantDigits:2,maximumSignificantDigits:r})}const Bzt="https://utility.arcgis.com/sharing/tools/legend",jzt="esri.layers.ImageryLayer",Gzt="esri.layers.ImageryTileLayer",Hzt="esri.layers.WCSLayer",X8=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,qzt=new tn({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),Z8=new du({size:6,outline:{color:[128,128,128,.5],width:.5}}),Wzt=new qm({style:"solid"});function Rre(t){return t.type==="flow"}function yVe(t){return t.type==="vector-field"}function vVe(t){return t.type==="raster-colormap"}function _Ve(t){return t.type==="raster-stretch"}function bVe(t){return t.type==="raster-shaded-relief"}function pM(t){return t.declaredClass==="esri.renderers.SimpleRenderer"}function fM(t){return t.declaredClass==="esri.renderers.ClassBreaksRenderer"}function Bk(t){return t.declaredClass==="esri.renderers.UniqueValueRenderer"}function wVe(t){return t.declaredClass==="esri.renderers.HeatmapRenderer"}function Yzt(t){return Aue(t)||Mue(t)||Oue(t)||Xzt(t)}function Xzt(t){return t.declaredClass==="esri.renderers.PointCloudRGBRenderer"}function Aue(t){return t.declaredClass==="esri.renderers.PointCloudClassBreaksRenderer"}function Mue(t){return t.declaredClass==="esri.renderers.PointCloudStretchRenderer"}function Oue(t){return t.declaredClass==="esri.renderers.PointCloudUniqueValueRenderer"}function xVe(t){return t.declaredClass==="esri.renderers.DotDensityRenderer"}function SVe(t){return t.declaredClass==="esri.renderers.PieChartRenderer"}function Zzt(t,e){return pM(t)||fM(t)||Bk(t)||wVe(t)||xVe(t)||SVe(t)?e.type==="2d"||qUe(t):_Ve(t)||vVe(t)||bVe(t)||Aue(t)||Mue(t)||Oue(t)||yVe(t)||Rre(t)}function Jzt(t){return t.declaredClass==="esri.layers.BuildingSceneLayer"}function MX(t){return t.declaredClass==="esri.layers.SubtypeGroupLayer"}function Kzt(t){return t.declaredClass==="esri.layers.VoxelLayer"}function Qzt(t){return t.declaredClass==="esri.layers.WMSLayer"}function eUt(t){return t.declaredClass==="esri.layers.WMTSLayer"}function OX(t){return t.declaredClass==="esri.layers.MapImageLayer"}function yxe(t){return t.declaredClass==="esri.layers.TileLayer"}function rA(t){return t.declaredClass===jzt}function J8(t){return t.declaredClass===Gzt}function tUt(t){return t.declaredClass===Hzt}function iUt(t){return t.type==="stretch-ramp"}function rUt(t){const e="authoringInfo"in t?t==null?void 0:t.authoringInfo:null;return(e==null?void 0:e.type)==="univariate-color-size"}function nUt(t){const e="authoringInfo"in t?t==null?void 0:t.authoringInfo:null;return(e==null?void 0:e.type)==="univariate-color-size"&&(e==null?void 0:e.univariateTheme)==="above-and-below"}function vxe(t){return"sublayers"in t}async function B1(t,e){const i=await gE("esri/widgets/Legend/t9n/Legend");return t!=="previewTemplateAriaLabel"||e||(t="previewAriaLabel"),Zy(i[t],{label:e})}const sUt=new du({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let nA={},Ua=class extends ze{constructor(t){super(t),this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._webStyleSymbolCache=new Map,this._dotDensityUrlCache=new Map,this._scaleDrivenSizeVariable=null,this._hasClusterSizeVariable=!1,this.children=new tt,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const t=()=>this.notifyChange("ready");this.addHandles([Jr(()=>this.children,"change",e=>{const{added:i,removed:r}=e;i.forEach(n=>{const s=`activeLayerInfo-ready-watcher-${n.layer.uid}`;this.addHandles(_e(()=>n.ready,t,Qt),s)}),r.forEach(n=>this.removeHandles(n.layer.uid)),t()})]),this.keepCacheOnDestroy||(nA={})}destroy(){this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(nA=null)}get effectList(){const t=this.layer;let e=null;return"effect"in t&&t.effect&&(e=new Wg,e.effect=t.effect,e.endTransitions(),e.scale=this.scale),e}get opacity(){var n;const t=this.layer.opacity,e=(n=this.parent)==null?void 0:n.opacity,i=this.layer.parent,r=i&&"uid"in i?this._getParentLayerOpacity(i):null;return e!=null?e*t:r!=null?r*t:t}get ready(){return this.layer===null||(this.children.length>0?this._isGroupActive():this.legendElements.length>0)}get scale(){var t;return((t=this.view)==null?void 0:t.scale)??0}get isScaleDriven(){const t=this.layer;if(t===null)return!1;if("effect"in t&&t.effect&&Array.isArray(t.effect))return!0;if("featureReduction"in t&&t.featureReduction){if(t.featureReduction.type==="cluster")return!0;if(t.featureReduction.type==="binning"&&"renderer"in t.featureReduction&&t.featureReduction.renderer)return this._isRendererScaleDriven(t.featureReduction.renderer)}return"renderer"in t&&t.renderer?this._isRendererScaleDriven(t.renderer):this._isLayerScaleDriven(this.layer)}get version(){return this._get("version")+1}async buildLegendElementsForFeatureCollections(t){if(!(!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView()))return this.legendElements=[],void this.notifyChange("ready");const e=Array.from(t,i=>{var r;if(iF(i))return this._getRendererLegendElements(i.renderer,{title:i.title});if((r=i.featureSet)!=null&&r.features.length){const n=i.layerDefinition,s=n==null?void 0:n.drawingInfo,o=s&&Trt(s.renderer),a=qzt.read(n.geometryType);return o?this._getRendererLegendElements(o,{title:i.name,geometryType:a}):(Ce.getLogger(this).warn("drawingInfo not available!"),null)}return null});try{const i=[],r=await Promise.allSettled(e);for(const n of r)if(n.status==="fulfilled")for(const s of n.value??[])i.push(s);this.legendElements=i,this.notifyChange("ready")}catch(i){Ce.getLogger(this).warn("error while building legend for layer!",i)}}async buildLegendElementsForRenderer(t){try{const e=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=e?await this._getRendererLegendElements(t):[],this.notifyChange("ready")}catch(e){Ce.getLogger(this).warn("error while building legend for layer!",e)}}async buildLegendElementsForFeatureReduction(t){try{const e=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=e?await this._getLegendElementsForFeatureReduction(t):[],this.notifyChange("ready")}catch(e){Ce.getLogger(this).warn("error while building legend for layer!",e)}}async buildLegendElementsForTools(){var e,i;const t=this.layer;if(Kzt(t))this._constructLegendElementsForVoxellayer();else if(eUt(t))this._constructLegendElementsForWMTSlayer();else if(Qzt(t))await this._constructLegendElementsForWMSSublayers();else if(Jzt(t))await this._constructLegendElementsForBuildingSceneLayer();else if(OX(t)||yxe(t)||MX(t))await this._constructLegendElementsForSublayers();else{this.removeHandles("imageryLayers-watcher");let r="default";if(rA(t)){const n=t;r=(((e=n==null?void 0:n.rasterFunction)==null?void 0:e.functionName)||"default")+"_"+((i=t.bandIds)!=null&&i.length?t.bandIds.join(""):"###")}await this._getLegendLayers(`${t.uid}-${r}`).then(async n=>{this.legendElements=[],this.notifyChange("ready");const s=n.map(async o=>{if(rA(t)||J8(t)){const c=_e(()=>["renderingRule"in t&&t.rasterFunction,t.bandIds],()=>n5(async()=>{nA.default=null,t.renderer?await this.buildLegendElementsForRenderer(t.renderer):await this.buildLegendElementsForTools()})());this.addHandles(c,"imageryLayers-watcher")}const a=this._generateSymbolTableElementForLegendLayer(o);a&&a.infos.length&&(rA(t)&&(a.title=t.title),this.legendElements.push(a)),this.notifyChange("ready")});await Promise.allSettled(s)}).catch(n=>{Ce.getLogger(this).warn("Request to server for legend has failed!",n)})}}async _isLayerInCurrentView(){const t=this.layer,e=this.layerView,i=e&&"createQuery"in e&&"queryFeatureCount"in e;if(!i&&!(e&&"createQuery"in t&&"queryFeatureCount"in t))return!0;await dd(()=>!e.updating);const r=i?"createQuery"in e&&e.createQuery():"createQuery"in t&&t.createQuery();return r?(r.geometry=this.view.extent,(i?"queryFeatureCount"in e&&await e.queryFeatureCount(r):"queryFeatureCount"in t&&await t.queryFeatureCount(r))!==0):!0}_getParentLayerOpacity(t){let e=1;const i=t.parent;return i&&"uid"in i&&(e=this._getParentLayerOpacity(i)),t.opacity*e}_isGroupActive(){const t=this.children;return!!t.length&&t.some(e=>e.ready)}_isRendererScaleDriven(t){if(t.type==="dot-density")return!0;const e="valueExpression"in t?t.valueExpression:null;if(X8.test(e))return!0;const i="visualVariables"in t?t.visualVariables:null;return!!(i!=null&&i.some(r=>this._isScaleDrivenSizeVariable(r)))||this._hasScaleDrivenSymbols(t)}_hasScaleDrivenSymbols(t){var e;switch(t.type){case"simple":return this._isScaleDrivenSymbol(t.symbol);case"class-breaks":return this._isScaleDrivenSymbol(t.defaultSymbol)||t.classBreakInfos.some(i=>this._isScaleDrivenSymbol(i.symbol));case"unique-value":return this._isScaleDrivenSymbol(t.defaultSymbol)||!!((e=t.uniqueValueInfos)!=null&&e.some(i=>this._isScaleDrivenSymbol(i.symbol)))}return!1}_isScaleDrivenSymbol(t){if((t==null?void 0:t.type)==="cim"){const{primitiveOverrides:e,minScale:i,maxScale:r}=t.data,n=(e==null?void 0:e.some(s=>{var o;return/\$view\.scale/.test(((o=s.valueExpressionInfo)==null?void 0:o.expression)||"")}))??!1;return i!=null||r!=null||n}return!1}_isScaleDrivenSizeVariable(t){if(t&&t.type!=="size")return!1;const e=t,i=e.minSize,r=e.maxSize;return!(typeof i!="object"||!i||!this._isScaleDrivenSizeVariable(i))||!(typeof r!="object"||!r||!this._isScaleDrivenSizeVariable(r))||!!e.expression||X8.test(e.valueExpression)}_isLayerScaleDriven(t){if("minScale"in t&&t.minScale>0||"maxScale"in t&&t.maxScale>0)return!0;if("sublayers"in t&&t.sublayers)return t.sublayers.some(i=>this._isLayerScaleDriven(i));const e=t.parent;if(t.loaded===!1&&e&&OX(e)&&"source"in t&&t.source&&t.source.type==="map-layer"){for(const i of e.sourceJSON.layers??[])if(i.id===t.source.mapLayerId&&(i.minScale>0||i.maxScale>0))return!0}return!1}async _constructLegendElementsForVoxellayer(){var s;this.legendElements=[],this.removeHandles("voxel-style-watcher"),this.removeHandles("voxel-current-variable");const t=this.layer;this.addHandles(_e(()=>t.currentVariableId,()=>this._constructLegendElementsForVoxellayer()),"voxel-current-variable"),this.addHandles(_e(()=>t.getVariableStyles(),()=>this._constructLegendElementsForVoxellayer()),"voxel-style-watcher");const e=t.getVariableStyle(null),i=[];if(e){if((s=e.uniqueValues)!=null&&s.length){const o=[];e.uniqueValues.forEach(a=>{a.enabled&&o.push({label:a.label||`${a.value}`,value:a.value,symbol:new qm({color:a.color,outline:null})})}),o.length&&i.push({type:"symbol-table",title:e.label,infos:o})}else if(e.transferFunction){const{colorStops:o,stretchRange:a}=e.transferFunction,c=o.toArray().reverse(),p=a.map((x,S)=>`${S===0?sVe:oVe} ${Vzt(x)}`).reverse(),_=c.map(x=>({color:x.color,value:null,label:null}));_[0].label=p[0],_[_.length-1].label=p[1],i.push({type:"color-ramp",title:e.label,infos:_,preview:gS(c.map(x=>x.color),{ariaLabel:await B1("previewColorRampAriaLabel")})})}}const r=t.opacity,n=i.reduce((o,a)=>[...o,...this._getAllInfos(a)],[]).filter(o=>!!(o!=null&&o.symbol)).map(o=>this._getSymbolPreview(o,r));await Promise.allSettled(n),this.legendElements=i,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this.legendElements=[],this.removeHandles("wmts-activeLayer-watcher");const t=this.layer.activeLayer;if(this.addHandles(_e(()=>{const{layer:e}=this;return e&&"activeLayer"in e&&e.activeLayer},()=>this._constructLegendElementsForWMTSlayer()),"wmts-activeLayer-watcher"),t.styleId&&t.styles){let e=null;t.styles.some(i=>t.styleId===i.id&&(e=i.legendUrl,!0)),e&&(this.legendElements=[{type:"symbol-table",title:t.title,infos:[{src:e,opacity:this.opacity}]}])}this.notifyChange("ready")}async _constructLegendElementsForWMSSublayers(){this.legendElements=[],this.removeHandles("wms-sublayers-watcher");const t=this.layer;let e=null;(t.customParameters||t.customLayerParameters)&&(e={...t.customParameters,...t.customLayerParameters}),this.addHandles(_e(()=>{const{layer:i}=this;return i&&"sublayers"in i&&i.sublayers},()=>this._constructLegendElementsForWMSSublayers()),"wms-sublayers-watcher"),this.legendElements=await this._generateLegendElementsForWMSSublayers(t.sublayers,e),this.notifyChange("ready")}async _generateLegendElementsForWMSSublayers(t,e){const i=[];this.addHandles(t.on("change",()=>this._constructLegendElementsForWMSSublayers()),"wms-sublayers-watcher");const r=t.toArray();for(const n of r){const s=_e(()=>[n.title,n.visible,n.legendEnabled],()=>this._constructLegendElementsForWMSSublayers());if(this.addHandles(s,"wms-sublayers-watcher"),!this.respectLayerVisibility||n.visible&&n.legendEnabled){const o=await this._generateSymbolTableElementForWMSSublayer(n,e);o!=null&&o.infos.length&&i.unshift(o)}}return i}async _generateSymbolTableElementForWMSSublayer(t,e){if(!t.legendUrl&&t.sublayers){const i=(await this._generateLegendElementsForWMSSublayers(t.sublayers,e)).filter(r=>r);return{type:"symbol-table",title:t.title,infos:i}}return this._generateSymbolTableElementForLegendUrl(t,e)}async _generateSymbolTableElementForLegendUrl(t,e){var o;let i=t.legendUrl;if(!i)return;const r={type:"symbol-table",title:t.title||t.name||String(t.id??""),infos:[]};e&&(i=oO(i,e));let n=null;const s=(o=t.layer)==null?void 0:o.opacity;try{n=(await yi(i,{responseType:"image"})).data,n&&(n.style.opacity=s)}catch{}return r.infos.push({src:i,preview:n,opacity:s}),r}_getLegendLayers(t,e){const i=nA&&nA[t];return i?Promise.resolve(i):this._legendRequest(e).then(r=>{const n=r.layers;return nA[t]=n,n})}_legendRequest(t){var n;const e=this.layer;let i={f:"json",dynamicLayers:t};if(rA(e)){const s=e.exportImageServiceParameters.rasterFunction;if(s&&(i.renderingRule=JSON.stringify(((n=s.functionDefinition)==null?void 0:n.toJSON())||s.toJSON())),e.bandIds&&(i.bandIds=e.bandIds.join()),e.raster||e.viewId||e.customParameters){const{raster:o,viewId:a,customParameters:c}=e;i={raster:o,viewId:a,...i,...c}}}let r=e.url.replace(/(\/)+$/,"");if("version"in e&&+e.version>=10.01){const s=r.indexOf("?");s>-1?r=r.substring(0,s)+"/legend"+r.substring(s):r+="/legend"}else{const s=r.toLowerCase().indexOf("/rest/"),o=r.substring(0,s)+r.substring(s+5,r.length);r=Bzt+"?soapUrl="+encodeURI(o)+"&returnbytes=true"}return yi(r,{query:i}).then(s=>s.data)}async _constructLegendElementsForBuildingSceneLayer(){this.legendElements=[],this.removeHandles("sublayers-watcher");const t=this.layer;this.addHandles(_e(()=>t.sublayers,()=>this._constructLegendElementsForBuildingSceneLayer()),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForBuildingSublayers(t.sublayers,this.opacity),this.notifyChange("ready")}catch(e){Ce.getLogger(this).warn("Request to server for legend has failed!",e)}}async _generateLegendElementsForBuildingSublayers(t,e){let i=[];this.addHandles(t.on("change",()=>this._constructLegendElementsForBuildingSceneLayer()),"sublayers-watcher");const r=t.toArray();for(const n of r){const s=_e(()=>["renderer"in n&&n.renderer,n.opacity,n.title,n.visible],()=>this._constructLegendElementsForBuildingSceneLayer());if(this.addHandles(s,"sublayers-watcher"),!this.respectLayerVisibility||n.visible){const o=(n==null?void 0:n.opacity)!=null?n.opacity:null,a=o!=null?o*e:e;if(n.type==="building-group"){const c={type:"symbol-table",title:n.title,infos:[]},p=await this._generateLegendElementsForBuildingSublayers(n.sublayers,a);c.infos.push(...p),i=[c,...i]}else n.renderer&&(i=[...await this._getRendererLegendElements(n.renderer,{title:n.title,opacity:a,sublayer:n}),...i])}}return i.filter(n=>!!n&&(!("infos"in n)||!n.infos||n.infos.length>0))}async _constructLegendElementsForSublayers(){this.legendElements=[],this.removeHandles("sublayers-watcher");const t=this.layer;if(OX(t)||yxe(t)||MX(t)){this.addHandles(_e(()=>t.sublayers,()=>this._constructLegendElementsForSublayers),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForSublayers(t.sublayers,this.opacity),this.notifyChange("ready")}catch(e){Ce.getLogger(this).warn("Request to server for legend has failed!",e)}}}async _generateLegendElementsForSublayers(t,e,i){const r=this.layer;let n=[];this.addHandles(t.on("change",()=>this._constructLegendElementsForSublayers()),"sublayers-watcher");let s=t.toArray();!i&&this.sublayerIds&&this.sublayerIds.length&&(s=MX(r)?this.sublayerIds.map(o=>r.findSublayerForSubtypeCode(o)).filter(ys):this.sublayerIds.map(o=>r.findSublayerById(o)).filter(ys));for(const o of s){const a=_e(()=>[o.renderer,o.opacity,o.title,o.visible,o.legendEnabled],()=>this._constructLegendElementsForSublayers());if(this.addHandles(a,"sublayers-watcher"),!this.respectLayerVisibility||o.visible&&o.legendEnabled&&this._isSublayerInScale(o)){const c=(o==null?void 0:o.opacity)!=null?o.opacity:null,p=c!=null?c*e:e,_=!vxe(o)||o.originIdOf("renderer")>Di.SERVICE&&!o.sublayers;if(o.renderer&&_)await o.load(),n=[...await this._getRendererLegendElements(o.renderer,{title:o.title,opacity:p,sublayer:o}),...n];else if(vxe(o)){const x=await this._generateSymbolTableElementForSublayer(o,p,i);x&&n.unshift(x)}}}return n.filter(o=>!!o&&(!("infos"in o)||!o.infos||o.infos.length>0))}async _generateSymbolTableElementForSublayer(t,e,i){if(!i){i=new Map;const n=this.layer,s=t.source;let o=null;if(!(!s||s.type==="map-layer"&&s.mapLayerId===t.id&&(!s.gdbVersion||s.gdbVersion===("gdbVersion"in n&&n.gdbVersion)))||t.originIdOf("renderer")>Di.SERVICE||t.originIdOf("labelingInfo")>Di.SERVICE||t.originIdOf("labelsVisible")>Di.SERVICE){const c=new Vd({layer:this.layer});o=c.hasDynamicLayers?c.dynamicLayers:null,c.destroy()}const a=o||`${n.uid}-default`;(await this._getLegendLayers(a,o)).forEach(c=>i.set(c.layerId,c))}const r=i.get(t.id);if((!r||r!=null&&r.subLayerIds&&r.defaultVisibility)&&t.sublayers){const n=await this._generateLegendElementsForSublayers(t.sublayers,e,i);return{type:"symbol-table",title:t.title,infos:n}}return this._generateSymbolTableElementForLegendLayer(r,t,e)}_generateSymbolTableElementForLegendLayer(t,e,i){if(!(t!=null&&t.legend)||this.respectLayerVisibility&&!this._isLegendLayerInScale(t,e))return null;const r=e==null?void 0:e.renderer;let n=(e==null?void 0:e.title)||t.layerName;if(r&&(!e||(e==null?void 0:e.originIdOf("renderer"))>Di.SERVICE)){const a=(e==null?void 0:e.title)||this._getRendererTitle(r,e);a&&(n&&typeof a!="string"&&"title"in a&&(a.title=n),n=a)}const s={type:"symbol-table",title:n,legendType:t.legendType||null,infos:[]},o=e?this._sanitizeLegendForSublayer(t.legend.slice(),e):t.legend;return t.legendGroups&&t.legendGroups.length>0?t.legendGroups.forEach(a=>{var p;const c={type:"symbol-table",title:a.heading,legendType:t.legendType||null,infos:this._generateSymbolTableElementInfosForLegendLayer(o.filter(_=>_.groupId===a.id),t.layerId,i)};((p=c.infos)==null?void 0:p.length)>0&&s.infos.push(c)}):s.infos=this._generateSymbolTableElementInfosForLegendLayer(o,t.layerId,i),s.infos.length>0?s:null}_generateSymbolTableElementInfosForLegendLayer(t,e,i){return t.map(r=>{let n=r.url;if(r.imageData&&r.imageData.length>0)n=`data:image/png;base64,${r.imageData}`;else{if(n.indexOf("http")===0)return null;n=iWe(`${this.layer.url}/${e}/images/${n}`)}return{label:r.label,src:n,opacity:i??this.opacity,width:r.width,height:r.height}}).filter(ys)}_isSublayerInScale(t){const e=t.minScale||0,i=t.maxScale||0;return!(e>0&&ethis.scale)}_isLegendLayerInScale(t,e){const i=e||this.layer;let r=null,n=null,s=!0;return!i.minScale&&i.minScale!==0||!i.maxScale&&i.maxScale!==0?(t.minScale===0&&i.tileInfo&&(r=i.tileInfo.lods[0].scale),t.maxScale===0&&i.tileInfo&&(n=i.tileInfo.lods[i.tileInfo.lods.length-1].scale)):(r=Math.min(i.minScale,t.minScale)||i.minScale||t.minScale,n=Math.max(i.maxScale,t.maxScale)),(r>0&&rthis.scale)&&(s=!1),s}_sanitizeLegendForSublayer(t,e){if("version"in this.layer&&+this.layer.version<10.1||t.length===0)return t;const i=e.renderer,r=t.some(o=>o.values);let n=0,s=null;return r&&t.some((o,a)=>(o.values||(n=a,s=o,s.label||(s.label="others")),s!=null)),i?i.type==="unique-value"?s&&(t.splice(n,1),t.push(s)):i.type==="class-breaks"&&(s&&t.splice(n,1),t.reverse(),s&&t.push(s)):s&&(t.splice(n,1),t.push(s)),t}async _getRendererLegendElements(t,e={}){if(!Zzt(t,this.view))return Ce.getLogger(this).warn(`Renderer of type '${t.type}' not supported!`),[];if(Yzt(t))return this._constructPointCloudRendererLegendElements(t,e);if(xVe(t))return this._constructDotDensityRendererLegendElements(t);const i=await this._loadRenderer(t);return SVe(i)?this._constructPieChartRendererLegendElements(i):this._constructRendererLegendElements(i,e)}async _getLegendElementsForFeatureReduction(t){let e=null;return t.type==="binning"?e=t.renderer:t.type==="cluster"&&(e=this._getClusterRenderer(t)),e?this._getRendererLegendElements(e):[]}_getPointCloudRendererTitle(t){var e;return(((e=t.legendOptions)==null?void 0:e.title)||t.field)??""}async _constructPointCloudRendererLegendElements(t,e={}){var a;const i=e.title,r=[];let n=null,s=null;if(Aue(t))n={type:"symbol-table",title:i||this._getPointCloudRendererTitle(t),infos:[]},t.colorClassBreakInfos.forEach(c=>{n.infos.unshift({label:c.label||c.minValue+" - "+c.maxValue,value:[c.minValue,c.maxValue],symbol:this._getAppliedCloneSymbol(Z8,c.color)})});else if(Mue(t)){const c=t.stops;let p=null;if(c!=null&&c.length&&(c.length===1&&(p=c[0].color),!p)){const x=c[0].value,S=c[c.length-1].value;x!=null&&S!=null&&(p=uVe(x+(S-x)/2,c))}n={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(Z8,p||Z8.color)}]};const _=xzt(t.stops??[])??[];s={type:"color-ramp",title:i||this._getPointCloudRendererTitle(t),infos:_,preview:gS(_.map(x=>x.color),{ariaLabel:await B1("previewColorRampAriaLabel")})}}else Oue(t)&&(n={type:"symbol-table",title:i||this._getPointCloudRendererTitle(t),infos:[]},(a=t.colorUniqueValueInfos)==null||a.forEach(c=>{n.infos.push({label:c.label||c.values.join(", "),value:c.values.join(", "),symbol:this._getAppliedCloneSymbol(Z8,c.color)})}));n&&n.infos.length&&r.push(n),s&&s.infos.length&&r.push(s);const o=r.reduce((c,p)=>[...c,...p.infos??[]],[]).filter(c=>!!c.symbol).map(c=>this._getSymbolPreview(c,this.opacity,{symbolConfig:{applyColorModulation:!!t.colorModulation}}));return await Promise.allSettled(o),r}async _getElementInfoForDotDensity(t,e){const{color:i,label:r,valueExpressionTitle:n}=e,{backgroundColor:s,outline:o,dotSize:a}=t,c=this.effectList,p=c==null?void 0:c.effects.map(F=>F.toJSON()),_=Lz(p),x=await B1("previewTemplateAriaLabel",r||n),S=a+"-"+i+"-"+s+"-"+(o&&JSON.stringify(o.toJSON()))+"-"+_,C=this._dotDensityUrlCache,M=C.has(S)?C.get(S):lzt(t,i,{ariaLabel:x});C.set(S,M);const P={shape:{type:"image",x:0,y:0,width:M.width,height:M.height,src:M.src},fill:null,stroke:null,offset:[0,0]},$=C6([[P]],[M.width,M.height],{effectView:this.effectList,ariaLabel:x});return{opacity:1,src:M.src,preview:$,width:M.width,height:M.height}}async _constructDotDensityRendererLegendElements(t){var n;const e=t.calculateDotValue(this.view.scale),i=(n=t.legendOptions)==null?void 0:n.unit,r={type:"symbol-table",title:{value:e&&Math.round(e),unit:i||""},infos:[]};for(const s of t.attributes){const o=await this._getElementInfoForDotDensity(t,s);o.label=s.label||s.valueExpressionTitle||s.field,r.infos.push(o)}return[r]}async _constructPieChartRendererLegendElements(t){var c,p,_,x;const e=this.layer.opacity,i=[];let r=null;const n=t.outline;t.attributes.forEach(S=>{const C=new du({color:S.color,outline:n}),M=S.label||S.valueExpressionTitle||S.field;i.push({label:M,symbol:C})});const s=i.length?[...i]:[];if((c=t.othersCategory)!=null&&c.color&&((p=t.othersCategory)==null?void 0:p.threshold)!==0){const S=new du({color:t.othersCategory.color,outline:n});r=t.othersCategory.label||"Other",i.push({label:r,symbol:S})}if((_=t.defaultColor)!=null&&_.a){const S=new du({color:t.defaultColor,outline:n});i.push({label:t.defaultLabel,symbol:S})}const o=await this._getVisualVariableLegendElements(t,this.layer)||[];if(i.length){o.unshift({type:"symbol-table",title:null,infos:i});const S=s.filter(M=>M.label!==r).map(M=>M.symbol.color).filter(Boolean),C=czt(S,{holePercentage:t.holePercentage,backgroundColor:(x=t.backgroundFillSymbol)==null?void 0:x.color,effectList:this.effectList,outline:n,ariaLabel:await B1("previewPieChartAriaLabel")});o.unshift({type:"pie-chart-ramp",title:this._getRendererTitle(t,this.layer),infos:i,preview:C})}const a=o.reduce((S,C)=>[...S,...this._getAllInfos(C)],[]).filter(S=>!!(S!=null&&S.symbol)&&!(S!=null&&S.preview)).map(S=>this._getSymbolPreview(S,e,{effectList:this.effectList}));return await Promise.allSettled(a),o}async _constructRendererLegendElements(t,e={}){var P,$,F,z,k;const{title:i,sublayer:r}=e,n=r||this.layer;this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const s=await this._getVisualVariableLegendElements(t,n)||[],o={type:"symbol-table",title:i||this._getRendererTitle(t,n),infos:[]};let a=null,c=!1;const p=new Set;if(Rre(t)&&!this._hasSizeRamp){const U=await lVe(t);o.infos.push({label:null,symbol:U})}else if(rUt(t)){let U=i;const j=nUt(t)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",G=s.findIndex(he=>he.type==="color-ramp"),Y=G!==-1?s.splice(G,1)[0]:null,Q=s.findIndex(he=>he.type==="size-ramp"),ne=Q!==-1?s.splice(Q,1)[0]:null,ie=[];Y&&(U=Y.title,ie.push(Y)),ne&&(U=ne.title,ie.push(ne)),ie.length>0&&s.push({type:j,title:U,infos:ie})}else if(wVe(t)){const U=hVe(t);s.push({type:"heatmap-ramp",title:i||this._getRendererTitle(t,n),infos:U,preview:gS(U.map(j=>j.color),{effectList:this.effectList,ariaLabel:await B1("previewColorRampAriaLabel")})})}else if(Bk(t)){const U=t&&t.authoringInfo;if(U&&U.type==="relationship"){const{numClasses:j,field1:G,field2:Y}=U,Q=U.focus;if(j&&G&&Y){const ne=[G,Y];let ie=iVe(Q)||0;for(const ce of ne){const{field:ve,normalizationField:ge,label:pe}=ce,Ee=pe||{field:this._getFieldAlias(ve,n),normField:ge&&this._getFieldAlias(ge,n)},te=sUt.clone();te.angle=ie,o.infos.push({label:Ee,symbol:te}),p.add(te),ie+=90}const he=azt({focus:Q,numClasses:j,infos:t.uniqueValueInfos??[]});s.unshift(he)}}else if(rA(this.layer)||J8(this.layer))(P=t.uniqueValueInfos)==null||P.forEach(j=>{j.symbol&&o.infos.push({label:j.label||j.value,value:j.value,symbol:j.symbol})});else{const{field:j,field2:G,field3:Y,fieldDelimiter:Q,valueExpression:ne,defaultSymbol:ie}=t,he=!(!j&&!ne||!G&&!Y),ce=[];if(($=t.uniqueValueGroups)==null||$.forEach(ve=>{var pe;const ge={type:"symbol-table",title:ve.heading,infos:[]};(pe=ve.classes)==null||pe.forEach(Ee=>{const{symbol:te,values:le}=Ee;if(te){const de=[],be=[];for(const Re of le??[]){const{value:Ge,value2:ut,value3:Ft}=Re,ei=[],Mt=[];(j||ne)&&(ei.push(Ge),Mt.push(this._getDomainName(j,Ge,n))),G&&(ei.push(ut),Mt.push(this._getDomainName(G,ut,n))),Y&&(ei.push(Ft),Mt.push(this._getDomainName(Y,Ft,n))),de.push(he?ei.join(Q||""):ei[0]),be.push(Mt.join(" - "))}const Se=de.join(", ");let Ae=Ee.label;if(!Ae){const Re=be.filter(Boolean);Ae=Re.length?Re.join(", "):Se}ge.infos.push({label:Ae,value:Se,symbol:te})}}),ge.infos.length&&ce.push(ge)}),ce.length){const ve=ce[0];ce.length===1&&"title"in ve&&!ve.title?o.infos.push(...ve.infos??[]):(ie&&(ce.push({type:"symbol-table",infos:[{label:t.defaultLabel||"others",symbol:ie}]}),c=!0),o.infos.push(...ce)),i||(F=t.legendOptions)!=null&&F.title||t.valueExpressionTitle||(o.title=null)}}t.defaultSymbol&&!c&&(o.infos.push({label:t.defaultLabel||"others",symbol:t.defaultSymbol}),c=!0)}else if(fM(t))a=this._isUnclassedRenderer(t),(!a||!this._hasSizeRamp)&&(t.classBreakInfos.forEach(U=>{U.symbol&&o.infos.unshift({label:U.label||(a?null:U.minValue+" - "+U.maxValue),value:[U.minValue,U.maxValue],symbol:U.symbol})}),a&&(o.title=null),this._updateInfosforClassedSizeRenderer(t,o.infos)),t.defaultSymbol&&!a&&(o.infos.push({label:t.defaultLabel||"others",symbol:t.defaultSymbol}),c=!0);else if(_Ve(t))if(J8(this.layer)||tUt(this.layer)){const U=await this._constructTileImageryStretchRendererElements(t);iUt(U)?s.push(U):o.infos=U}else{const U=this.layer;let j,G;if((z=t.statistics)!=null&&z.length){const ie=t.statistics[0];gxe(ie)?(j=ie.min,G=ie.max):[j,G]=ie}let Y=[],Q=U.serviceRasterInfo;if(U.rasterFunction)try{Q=await U.generateRasterInfo(U.rasterFunction)}catch{}const ne=Sre(Q.pixelType);if(Q.bandCount===1){const ie=((k=U.bandIds)==null?void 0:k[0])||0;j=j??(Q.statistics?Q.statistics[ie].min:ne[0]),G=G??(Q.statistics?Q.statistics[ie].max:ne[1]),j||G?s.push(await this._getStretchLegendElements(t,{min:j,max:G})):this._getServerSideLegend()}else if(U.bandIds&&U.bandIds.length===1)j=j??(Q.statistics?Q.statistics[U.bandIds[0]].min:ne[0]),G=G??(Q.statistics?Q.statistics[U.bandIds[0]].max:ne[1]),j||G?s.push(await this._getStretchLegendElements(t,{min:j,max:G})):this._getServerSideLegend();else if(Q.bandCount>=3){const{bandInfos:ie}=Q,{bandIds:he}=U;ie.length>=Q.bandCount?(he==null?void 0:he.length)===3?(Y=he.map(ce=>ie[ce].name),o.infos=this._createSymbolTableElementMultiBand(Y)):U.format==="lerc"?(Y=[0,1,2].map(ce=>ie[ce].name),o.infos=this._createSymbolTableElementMultiBand(Y)):this._getServerSideLegend():U.format==="lerc"?(Y=["band1","band2","band3"],o.infos=this._createSymbolTableElementMultiBand(Y)):this._getServerSideLegend()}else this._getServerSideLegend()}else if(vVe(t))t.colormapInfos.forEach(U=>{o.infos.push({label:U.label,value:U.value,symbol:this._getAppliedCloneSymbol(Wzt,U.color)})});else if(pM(t)){let U=t.symbol;switch(e.geometryType){case"point":U="pointSymbol"in n?n.pointSymbol:null;break;case"polyline":U="lineSymbol"in n?n.lineSymbol:null;break;case"polygon":U="polygonSymbol"in n?n.polygonSymbol:null}const j=this._hasClusterSizeVariable&&this._getClusterSymbol()||!this._hasSizeRamp;t.symbol&&j&&o.infos.push({label:t.label,symbol:U})}else if(yVe(t)){t.outputUnit&&(this.title="("+t.toJSON().outputUnit+")"),o.title=t.attributeField;const U=t.getClassBreakInfos();U!=null&&U.length?U.forEach(j=>{o.infos.push({label:j.minValue+" - "+j.maxValue,symbol:j.symbol})}):o.infos.push({label:t.attributeField,symbol:t.getDefaultSymbol()})}else bVe(t)&&s.push(await this._getStretchLegendElements(t,{min:0,max:255}));const _=t.defaultSymbol;!_||c||pM(t)||a&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||s.push({type:"symbol-table",infos:[{label:t.defaultLabel||"others",symbol:_}]}),o.infos.length&&s.unshift(o);const x=e.opacity==null?this.opacity:e.opacity,S=this._isTallSymbol("visualVariables"in t?t.visualVariables:null),C=rA(this.layer)||J8(this.layer),M=s.reduce((U,j)=>[...U,...this._getAllInfos(j)],[]).filter(U=>!!(U!=null&&U.symbol)).filter(U=>{if(U.symbol.type==="cim"){const{minScale:j,maxScale:G}=U.symbol.data;if(j&&jthis.scale)return!1}return!0}).map(U=>this._getSymbolPreview(U,x,{isDefault:U.symbol===_,applyScaleDrivenSize:!p.has(U.symbol),symbolConfig:{isTall:S,isSquareFill:C},effectList:p.has(U.symbol)?null:this.effectList}));return t=null,await Promise.allSettled(M),s}_getServerSideLegend(){setTimeout(()=>this.buildLegendElementsForTools(),0)}_getAllInfos(t){const e=t==null?void 0:t.infos;return e?e.reduce((i,r)=>i.concat(this._getAllInfos(r)),[]):[t]}async _constructTileImageryStretchRendererElements(t){var a,c,p;const e=this.layer,i=e.symbolizer.rasterInfo??e.raster.rasterInfo;let r,n;const s=(a=t==null?void 0:t.statistics)!=null&&a.length?t.statistics:i==null?void 0:i.statistics;if(s){const _=s[0];gxe(_)?(r=_.min,n=_.max):[r,n]=_}else{const _=Sre(i.pixelType);r=_[0],n=_[1]}if(e.hasStandardTime()&&(r=e.getStandardTimeValue(r),n=e.getStandardTimeValue(n)),i.bandCount===1||((c=e.bandIds)==null?void 0:c.length)===1)return this._getStretchLegendElements(t,{min:r,max:n});const o=((p=e==null?void 0:e.bandIds)!=null&&p.length?e.bandIds:Array.from(Array(Math.min(i.bandCount,3)).keys())).map(_=>i.bandInfos[_].name);return o.length<3?o.push(o[1]):o.length>3&&o.splice(3),this._createSymbolTableElementMultiBand(o)}async _getStretchLegendElements(t,e){const i=t.colorRamp,r=Tzt(i,e);return{type:"stretch-ramp",title:"",infos:r,preview:gS(r.map(n=>n.color),{ariaLabel:await B1("previewColorRampAriaLabel")})}}_getClusterSymbol(){var r;const t=this.layer,e="featureReduction"in t&&t.featureReduction,i=e&&"symbol"in e&&e.renderer;return i&&((r=i==null?void 0:i.authoringInfo)==null?void 0:r.isAutoGenerated)!==!0?null:e&&"symbol"in e?e.symbol:null}async _getSizeLegendElement(t,e,i,r){return{type:"size-ramp",title:this._hasClusterSizeVariable?this._getClusterTitle(e):t,infos:await Izt(i,e,await Are(i),this.scale,this.view,r,this._hasClusterSizeVariable?this._getClusterSymbol():null)}}_createSymbolTableElementMultiBand(t){const e=[],i=["red","green","blue"];return t.forEach((r,n)=>{e.push({label:{colorName:i[n],bandName:r},src:_zt[n],opacity:this.opacity??1})}),e}_updateInfosforClassedSizeRenderer(t,e){const i=t.authoringInfo&&t.authoringInfo.type==="class-breaks-size",r=t.classBreakInfos.some(n=>TG(n.symbol));if(i&&r){const n=Ore,s=Pre,o=t.classBreakInfos.length,a=(n-s)/(o>1?o-1:o);e.forEach((c,p)=>{c.size=n-a*p})}}_isTallSymbol(t){let e=!1,i=!1;if(t)for(let r=0;rPromise.resolve().then(()=>SE),void 0);r=c(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:t.symbol.type==="simple-marker"?t.symbol.style:null})}const n=!(i!=null&&i.isDefault)&&this._hasSizeRamp||!(!this._scaleDrivenSizeVariable||!(i!=null&&i.applyScaleDrivenSize));return rVe(t.symbol,{size:r,opacity:e,scale:!1,symbolConfig:i==null?void 0:i.symbolConfig,effectView:i==null?void 0:i.effectList,style:"legend",cimOptions:{allowScalingUp:n,viewParams:this.isScaleDriven?{viewingMode:((s=this.view)==null?void 0:s.type)==="2d"?"map":(o=this.view)==null?void 0:o.viewingMode,scale:(a=this.view)==null?void 0:a.scale}:null},ariaLabel:t.label&&typeof t.label!="string"?null:await B1("previewTemplateAriaLabel",t.label)}).then(c=>(t.preview=c,t)).catch(()=>(t.preview=null,t))}_getClusterRenderer(t){var n,s;this._hasClusterSizeVariable=!1;const e="renderer"in this.layer?this.layer.renderer:null,i=((n=t.renderer)==null?void 0:n.clone())||(e==null?void 0:e.clone()),r=dzt(this.layerView._effectiveRenderer,this.view);if(r&&i!=null&&"visualVariables"in i&&!((s=i.visualVariables)==null?void 0:s.some(a=>a.type==="size"&&a.target!=="outline"&&!X8.test(a.valueExpression)))){if("clusterMinSize"in t&&"clusterMaxSize"in t){const{clusterMinSize:c,clusterMaxSize:p}=t;r.legendOptions=new iOe({showLegend:c!==p})}const a=i.visualVariables||[];i.visualVariables=a.concat([r]),this._hasClusterSizeVariable=!0}return i}async _loadRenderer(t){const e=[],i=t.clone(),r=await Are(i);if(fM(i)||Bk(i)){const n=(i.classBreakInfos||i.uniqueValueInfos).map(s=>this._fetchSymbol(s.symbol,r).then(o=>{s.symbol=o}).catch(()=>{s.symbol=null}));Array.prototype.push.apply(e,n)}return e.push(this._fetchSymbol(i.symbol||i.defaultSymbol,i.defaultSymbol?null:r).then(n=>{this._applySymbolToRenderer(i,n,pM(i))}).catch(()=>{this._applySymbolToRenderer(i,null,pM(i))})),await Promise.allSettled(e),i}_applySymbolToRenderer(t,e,i){i?t.symbol=e:t.defaultSymbol=e}async _fetchSymbol(t,e){if(!t)throw new Error;if(t.type==="web-style"){const i=this._webStyleSymbolCache;try{const r=await(this.view.type==="2d"?t.fetchCIMSymbol({cache:i}):t.fetchSymbol({cache:i}));return this._getAppliedCloneSymbol(r,e)}catch{throw Ce.getLogger(this).warn("Fetching web-style failed!"),new Error}}return this._getAppliedCloneSymbol(t,e)}_getAppliedCloneSymbol(t,e){if(!t||!e)return t;const i=t.clone(),r=e&&e.toRgba();return i.type.includes("3d")?this._applyColorTo3dSymbol(i,r):i.type==="cim"?QNe(i,e):i.color&&(i.color=new qe(r||i.color)),i}_applyColorTo3dSymbol(t,e){e&&t.symbolLayers.forEach(i=>{i&&(i.material||(i.material={}),i.material.color=new qe(e))})}async _getVisualVariableLegendElements(t,e){var _;if(!("visualVariables"in t)||!t.visualVariables||t.type==="vector-field")return null;const i=t.visualVariables,r=[],n=[],s=[];for(const x of i)x.type==="color"?r.push(x):x.type==="size"?n.push(x):x.type==="opacity"&&s.push(x);const o=[...r,...n,...s];let a,c;if(r.length===0&&fM(t)&&t.classBreakInfos&&t.classBreakInfos.length===1){const x=t.classBreakInfos[0];a=x&&x.symbol}if(r.length===0&&pM(t)&&(a=t.symbol),a)if(a.type.includes("3d")){const x=a.symbolLayers.at(0);x.type==="water"?x.color!=null&&(c=x.color):((_=x.material)==null?void 0:_.color)!=null&&(c=x.material.color)}else a.url||(c=a.color);const p=this.effectList;return(await Promise.all(o.map(async x=>{if(!x.legendOptions||x.legendOptions.showLegend!==!1){const S=Rre(t)?x.field:this._getRampTitle(x,e);let C=null;const M=this._getDateFormatOptions(e,x);if(x.type==="color"){const P=await Mre(x,null,M)??[];C={type:"color-ramp",title:S,infos:P,preview:gS(P.map($=>$.color),{effectList:p,ariaLabel:await B1("previewColorRampAriaLabel")})},this._hasColorRamp||(this._hasColorRamp=P.length>0)}else if(x.type==="size"&&x.target!=="outline")X8.test(x.valueExpression)?this._hasClusterSizeVariable||(this._scaleDrivenSizeVariable=x):(C=await this._getSizeLegendElement(S,x,t,M),this._hasSizeRamp||(this._hasSizeRamp=!(C.infos==null||!C.infos.length)));else if(x.type==="opacity"){const P=await Mre(x,c,M)??[];C={type:"opacity-ramp",title:S,infos:P,preview:gS(P.map($=>$.color),{effectList:p,ariaLabel:await B1("previewColorRampAriaLabel")})},this._hasOpacityRamp||(this._hasOpacityRamp=P.length>0)}return C&&C.infos?C:null}}))).filter(ys)}_getFieldInfo(t,e){var i,r;if(!e.field)return null;if("featureReduction"in t)switch((i=t.featureReduction)==null?void 0:i.type){case"cluster":case"binning":{const n=t.featureReduction.fields.find(({name:s})=>s.toLowerCase()===e.field.toLowerCase());return n&&"getField"in t?t.getField(n.onStatisticField):null}}return"getField"in t?(r=t.getField)==null?void 0:r.call(t,e.field):null}_getDateFormat(t,e){var r,n,s;const i="popupTemplate"in t?(r=t.popupTemplate)==null?void 0:r.fieldInfos:null;if(i!=null&&i.length&&e)return(s=(n=i.find(o=>{var a;return((a=o.fieldName)==null?void 0:a.toLowerCase())===e.toLowerCase()}))==null?void 0:n.format)==null?void 0:s.dateFormat}_getDateFormatOptions(t,e){var n,s,o,a;const i=this._getFieldInfo(t,e);if(!i||!vkt(i)&&!ZAe(i))return null;let r=this._getDateFormat(t,i.name);if(!r&&i.type==="date"){let c=0,p=0;e.stops?(c=((s=(n=e.stops)==null?void 0:n.at(0))==null?void 0:s.value)??c,p=((a=(o=e.stops)==null?void 0:o.at(-1))==null?void 0:a.value)??p):"minDataValue"in e&&"maxDataValue"in e&&(c=e.minDataValue??c,p=e.maxDataValue??p),r=p-c>2*VK.days?"short-date":"short-date-short-time"}return{fieldType:i.type,format:r,timeZoneOptions:{layerTimeZone:"preferredTimeZone"in t?t.preferredTimeZone:null,viewTimeZone:this.view.timeZone,datesInUnknownTimezone:"datesInUnknownTimezone"in t&&t.datesInUnknownTimezone}}}_getDomainName(t,e,i){var r;if(t&&typeof t!="function"){const n="getField"in i&&((r=i.getField)==null?void 0:r.call(i,t)),s=n&&"getFieldDomain"in i&&i.getFieldDomain?i.getFieldDomain(n.name):null;return(s==null?void 0:s.type)==="coded-value"?s.getName(e):null}return null}_getClusterTitle(t){const e=this.layer,i=t.field;if("featureReduction"in e&&e.featureReduction&&e.featureReduction.type==="cluster"){const r=e.featureReduction,n="popupTemplate"in r&&r.popupTemplate,s=n&&n.fieldInfos;if(s){for(const o of s)if(o.fieldName===i)return i==="cluster_count"?o.label||{showCount:!0}:o.label}}return{showCount:!0}}_getRampTitle(t,e){var p,_;let i=t.field,r=t.normalizationField,n=!1,s=!1,o=!1,a=null;i=typeof i=="function"?null:i,r=typeof r=="function"?null:r;const c=(p=t.legendOptions)==null?void 0:p.title;if(c!=null)a=c;else if(t.valueExpressionTitle)a=t.valueExpressionTitle;else{if("renderer"in e&&e.renderer&&"authoringInfo"in e.renderer&&((_=e.renderer.authoringInfo)!=null&&_.visualVariables)){const x=e.renderer.authoringInfo.visualVariables;for(let S=0;S${_}<${this._getFieldAlias(c,e)}>`,p&&(x=`${x}${_}<${this._getFieldAlias(p,e)}>`)),x}let o=null;return(r||n)&&(o={field:r&&this._getFieldAlias(r,e),normField:n&&this._getFieldAlias(n,e),normByPct:s}),o}_getFieldAlias(t,e){var _;const i="popupTemplate"in e?e.popupTemplate:null,r=i==null?void 0:i.fieldInfos;let n;r&&r.some(x=>t===x.fieldName&&(n=x,!0));let s=null;"getField"in e&&e.getField?s=e.getField(t):"fieldsIndex"in e&&e.fieldsIndex&&(s=e.fieldsIndex.get(t));let o=null;const a="featureReduction"in e&&e.featureReduction;a&&(!n&&"popupTemplate"in a&&((_=a.popupTemplate)!=null&&_.fieldInfos)&&a.popupTemplate.fieldInfos.some(x=>{var S;return(t==null?void 0:t.toLowerCase())===((S=x.fieldName)==null?void 0:S.toLowerCase())&&(n=x,!0)}),"fields"in a&&a.fields&&(o=a.fields.find(x=>{var S;return((S=x.name)==null?void 0:S.toLowerCase())===(t==null?void 0:t.toLowerCase())})));const c=n||s||o;let p=null;return c&&(p=(n==null?void 0:n.label)||(s==null?void 0:s.alias)||(o==null?void 0:o.alias)||"name"in c&&c.name||"fieldName"in c&&c.fieldName||null),p}_isUnclassedRenderer(t){const e=t.visualVariables;let i=!1;return fM(t)&&t.classBreakInfos&&t.classBreakInfos.length===1&&e&&(i=t.field?e.some(r=>!(!r||t.field!==r.field||(t.normalizationField||r.normalizationField)&&t.normalizationField!==r.normalizationField)):!!e.length),i}};y([w()],Ua.prototype,"children",void 0),y([w({readOnly:!0})],Ua.prototype,"effectList",null),y([w()],Ua.prototype,"layerView",void 0),y([w()],Ua.prototype,"layer",void 0),y([w()],Ua.prototype,"legendElements",void 0),y([w({readOnly:!0})],Ua.prototype,"opacity",null),y([w()],Ua.prototype,"parent",void 0),y([w({readOnly:!0,dependsOn:[]})],Ua.prototype,"ready",null),y([w()],Ua.prototype,"hideLayersNotInCurrentView",void 0),y([w()],Ua.prototype,"keepCacheOnDestroy",void 0),y([w()],Ua.prototype,"respectLayerVisibility",void 0),y([w({readOnly:!0})],Ua.prototype,"scale",null),y([w()],Ua.prototype,"sublayerIds",void 0),y([w({readOnly:!0})],Ua.prototype,"isScaleDriven",null),y([w()],Ua.prototype,"title",void 0),y([w({readOnly:!0,dependsOn:["ready"],value:0})],Ua.prototype,"version",null),y([w()],Ua.prototype,"view",void 0),Ua=y([Z("esri.widgets.Legend.support.ActiveLayerInfo")],Ua);const TVe=Ua,u3={state:"state",view:"view",allLayerViews:"all-layer-views",legendProperties:"legend-properties"},EVe=tt.ofType(TVe),oUt=new Set(["esri.layers.BuildingSceneLayer","esri.layers.CSVLayer","esri.layers.FeatureLayer","esri.layers.GeoJSONLayer","esri.layers.GeoRSSLayer","esri.layers.GroupLayer","esri.layers.HeatmapLayer","esri.layers.ImageryLayer","esri.layers.ImageryTileLayer","esri.layers.MapImageLayer","esri.layers.OGCFeatureLayer","esri.layers.PointCloudLayer","esri.layers.StreamLayer","esri.layers.SceneLayer","esri.layers.SubtypeGroupLayer","esri.layers.TileLayer","esri.layers.VoxelLayer","esri.layers.WFSLayer","esri.layers.WMSLayer","esri.layers.WMTSLayer","esri.layers.WCSLayer","esri.layers.LinkChartLayer","esri.layers.knowledgeGraph.KnowledgeGraphSublayer"]),CVe="view.basemapView.baseLayerViews",AVe="view.groundView.layerViews",MVe="view.basemapView.referenceLayerViews",aUt=[CVe,AVe,"view.layerViews",MVe];let sf=class extends ze{constructor(e){super(e),this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new tt,this.activeLayerInfos=new EVe,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.layerInfos=[],this.view=null}initialize(){this.addHandles(_e(()=>this.view,()=>this._viewHandles(),Qt),u3.view),this.addHandles(fE(()=>this._refresh()))}destroy(){this._destroyViewActiveLayerInfos(),this.view=null}get state(){var e;return(e=this.view)!=null&&e.ready?"ready":"disabled"}_viewHandles(){this.removeHandles(u3.state),this.view&&this.addHandles(_e(()=>this.state,()=>this._stateHandles(),Qt),u3.state)}_stateHandles(){this._resetAll(),this.state==="ready"&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this.removeHandles([u3.allLayerViews,u3.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this.removeHandles(e);const i=this._activeLayerInfosByLayerViewId[e];delete this._activeLayerInfosByLayerViewId[e],i!=null&&i.parent&&i.parent.children.remove(i)}_watchPropertiesAndAllLayerViews(){const{view:e}=this;if(!e)return;const{allLayerViews:i}=e;i.length&&this._refresh(),this.addHandles(i.on("change",r=>this._allLayerViewsChangeHandle(r)),u3.allLayerViews),this.addHandles(_e(()=>[this.layerInfos,this.basemapLegendVisible,this.groundLegendVisible],()=>this._propertiesChangeHandle()),u3.legendProperties)}_allLayerViewsChangeHandle(e){e.removed.forEach(i=>this._destroyViewActiveLayerInfo(i.uid)),this._refresh()}_propertiesChangeHandle(){this._destroyViewActiveLayerInfos(),this._refresh()}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.removeAll(),this._generateLayerViews().filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this),this._sortActiveLayerInfos(this.activeLayerInfos)}_sortActiveLayerInfos(e){const i=this.view;if(e.length<2||!i)return;const r=[];e.forEach(s=>{if(!s.parent){const o=s.layer.parent,a=o&&"uid"in o&&this._layerViewByLayerId[o.uid],c=a&&this._activeLayerInfosByLayerViewId[a.uid];c&&e.includes(c)&&(r.push(s),s.parent=c,c.children.add(s),this._sortActiveLayerInfos(c.children))}}),e.removeMany(r);const n={};i.allLayerViews.forEach((s,o)=>n[s.layer.uid]=o),e.sort((s,o)=>{const a=n[s.layer.uid]||0;return(n[o.layer.uid]||0)-a})}_generateLayerViews(){const e=[];return aUt.filter(this._filterLayerViews,this).map(i=>uu(this,i)).filter(i=>i!=null).forEach(this._collectLayerViews("layerViews",e)),e}_filterLayerViews(e){const i=!this.basemapLegendVisible&&(e===CVe||e===MVe),r=!this.groundLegendVisible&&e===AVe;return!i&&!r}_collectLayerViews(e,i){const r=n=>(n&&n.forEach(s=>{i.push(s),r(s[e])}),i);return r}_filterLayerViewsByLayerInfos(e){const i=this.layerInfos;return!i||!i.length||i.some(r=>this._hasLayerInfo(r,e))}_hasLayerInfo(e,i){const r=this._isLayerUIDMatching(e.layer,i.layer.uid);return r&&(this._layerInfosByLayerViewId[i.uid]=e),r}_isLayerUIDMatching(e,i){return e&&(e.uid===i||this._hasLayerUID(e.layers,i))}_hasLayerUID(e,i){return e&&e.some(r=>this._isLayerUIDMatching(r,i))}_isLayerViewSupported(e){return!!oUt.has(e.layer.declaredClass)&&(this._layerViewByLayerId[e.layer.uid]=e,!0)}_generateActiveLayerInfo(e){this._isLayerActive(e)?this._buildActiveLayerInfo(e):(this.removeHandles(e.uid),this.addHandles(_e(()=>{var i;return[e.legendEnabled,(i=e.layer)==null?void 0:i.legendEnabled]},()=>this._layerActiveHandle(e)),e.uid))}_layerActiveHandle(e){this._isLayerActive(e)&&(this.removeHandles(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){var i;return!this.respectLayerVisibility||e.legendEnabled&&((i=e.layer)==null?void 0:i.legendEnabled)}_buildActiveLayerInfo(e){var a;const i=e.layer,r=e.uid,n=this._layerInfosByLayerViewId[r];let s=this._activeLayerInfosByLayerViewId[r];if(!s){const c=(n==null?void 0:n.title)!==void 0&&n.layer.uid===i.uid;s=new TVe({layer:i,layerView:e,title:c?n.title:i.title,view:this.view,respectLayerVisibility:this.respectLayerVisibility,hideLayersNotInCurrentView:this.hideLayersNotInCurrentView,keepCacheOnDestroy:this.keepCacheOnDestroy,sublayerIds:(n==null?void 0:n.sublayerIds)||[]}),this._activeLayerInfosByLayerViewId[r]=s}const o=i.parent&&"uid"in i.parent?this._layerViewByLayerId[(a=i.parent)==null?void 0:a.uid]:null;if(s.parent=this._activeLayerInfosByLayerViewId[o==null?void 0:o.uid],!this.hasHandles(r)){const c=[_e(()=>i.title,p=>this._titleHandle(p,s)),_e(()=>[i.opacity,"renderer"in i&&i.renderer,"pointSymbol"in i&&i.pointSymbol,"lineSymbol"in i&&i.lineSymbol,"polygonSymbol"in i&&i.polygonSymbol],()=>this._constructLegendElements(s)),Oo(()=>{var p;return((p=this.view)==null?void 0:p.stationary)===!0},()=>this._scaleHandle(s),Qt),_e(()=>e._effectiveRenderer,()=>this._constructLegendElements(s)),_e(()=>"effect"in i&&i.effect,()=>this._constructLegendElements(s)),Oo(()=>{var p;return(p=this.view)==null?void 0:p.timeZone},()=>this._constructLegendElements(s),Qt)];if(this.respectLayerVisibility){const p=_e(()=>e.legendEnabled,x=>this._legendEnabledHandle(x,s)),_=_e(()=>i.legendEnabled,x=>this._legendEnabledHandle(x,s));c.push(p,_)}this.addHandles(c,r)}s.isScaleDriven||this._constructLegendElements(s),this._addActiveLayerInfo(s)}_titleHandle(e,i){i.title=e,this._constructLegendElements(i)}_legendEnabledHandle(e,i){e?this._addActiveLayerInfo(i):this._removeActiveLayerInfo(i)}_scaleHandle(e){(e.isScaleDriven||e.hideLayersNotInCurrentView)&&this._constructLegendElements(e)}_addActiveLayerInfo(e){var n;const{layerView:i,layer:r}=e;if(this._isLayerActive(i)&&!this.activeLayerInfos.includes(e)){const s=e.parent;if(s)s.children.includes(e)||s.children.push(e),this._sortActiveLayerInfos(s.children);else{const o=(n=this.layerInfos)==null?void 0:n.some(a=>a.layer.uid===r.uid);r.parent&&"uid"in r.parent&&!o?this._activeLayerInfosWithNoParent.add(e):(this.activeLayerInfos.add(e),this._sortActiveLayerInfos(this.activeLayerInfos))}if(this._activeLayerInfosWithNoParent.length){const o=[];this._activeLayerInfosWithNoParent.forEach(a=>{const c=a.layer.parent,p=c&&"uid"in c?this._layerViewByLayerId[c==null?void 0:c.uid]:null,_=this._activeLayerInfosByLayerViewId[p==null?void 0:p.uid];_&&(o.push(a),a.parent=_)}),o.length&&(this._activeLayerInfosWithNoParent.removeMany(o),o.forEach(a=>this._addActiveLayerInfo(a)))}}}_removeActiveLayerInfo(e){const i=e.parent;i?i.children.remove(e):this.activeLayerInfos.remove(e)}_constructLegendElements(e){const i=e.layer;"featureCollections"in i&&i.featureCollections?e.buildLegendElementsForFeatureCollections(i.featureCollections):"featureReduction"in i&&i.featureReduction&&"renderer"in i.featureReduction&&(i.featureReduction.type==="binning"||i.featureReduction.type==="cluster")?e.buildLegendElementsForFeatureReduction(i.featureReduction):"renderer"in i&&i.renderer&&!("sublayers"in i)?e.buildLegendElementsForRenderer(i.renderer):"url"in i&&i.url?e.buildLegendElementsForTools():e.children.forEach(r=>this._constructLegendElements(r))}};y([w({type:EVe})],sf.prototype,"activeLayerInfos",void 0),y([w()],sf.prototype,"basemapLegendVisible",void 0),y([w()],sf.prototype,"groundLegendVisible",void 0),y([w()],sf.prototype,"hideLayersNotInCurrentView",void 0),y([w()],sf.prototype,"keepCacheOnDestroy",void 0),y([w()],sf.prototype,"respectLayerVisibility",void 0),y([w()],sf.prototype,"layerInfos",void 0),y([w({readOnly:!0})],sf.prototype,"state",null),y([w()],sf.prototype,"view",void 0),sf=y([Z("esri.widgets.Legend.LegendViewModel")],sf);const lUt=sf,An="esri-legend--card",sA="esri-legend",pi={activated:`${An}__carousel-indicator--activated`,base:An,stacked:`${sA}--stacked`,carouselTitle:`${An}__carousel-title`,indicator:`${An}__carousel-indicator`,intervalSeparator:`${An}__interval-separator`,imageryLayerStretchedImage:`${An}__imagery-layer-image--stretched`,imageLabel:`${An}__image-label`,layerCaption:`${An}__layer-caption`,labelElement:`${An}__label-element`,layerRow:`${An}__layer-row`,labelCell:`${An}__label-cell`,message:`${An}__message`,rampLabel:`${An}__ramp-label`,section:`${An}__section`,relationshipSection:`${An}__relationship-section`,serviceCaptionText:`${An}__service-caption-text`,serviceContent:`${An}__service-content`,service:`${An}__service`,groupLayer:`${An}__group-layer`,groupLayerChild:`${An}__group-layer-child`,symbol:`${An}__symbol`,sizeRampRow:`${An}__size-ramp-row`,symbolRow:`${An}__symbol-row`,symbolCell:`${An}__symbol-cell`,indicatorContainer:`${An}__carousel-indicator-container`,intervalSeparatorsContainer:`${An}__interval-separators-container`,relationshipLabelContainer:`${An}__relationship-label-container`,labelContainer:`${An}__label-container`,serviceCaptionContainer:`${An}__service-caption-container`,symbolContainer:`${An}__symbol-container`,sizeRampContainer:`${An}__size-ramp-container`,sizeRampPreview:`${An}__size-ramp-preview`,pieChartRampPreview:`${An}__pie-chart-ramp-preview`,rampContainer:`${sA}__ramps`,sizeRampHorizontal:`${sA}__size-ramp--horizontal`,rampLabelsContainer:`${sA}__ramp-labels`,layerInfo:`${sA}__layer-cell ${sA}__layer-cell--info`,univariateAboveAndBelowColorRamp:"esri-univariate-above-and-below-ramp__color--card"},cUt=dU(),OVe=10,Pue=20,XG=10,Rue=20,Iue={univariateAboveAndBelowSymbol:"esri-univariate-above-and-below-ramp__symbol",colorRamp:"esri-legend__color-ramp"};function uUt(t="vertical"){const e="stroke:rgb(200, 200, 200);stroke-width:1";return t==="vertical"?X("svg",{height:"4",width:"10"},X("line",{style:e,x1:"0",x2:"10",y1:"2",y2:"2"})):X("svg",{height:"10",width:"10"},X("line",{style:e,x1:"5",x2:"5",y1:"0",y2:"10"}))}function hUt(t,e="vertical"){const i=document.createElement("div");return i.style.height=`${Pue}px`,i.className=Iue.univariateAboveAndBelowSymbol,t!=null&&(i.style.opacity=t.toString()),cUt.append(i,uUt.bind(null,e)),i}function PVe(t,e,i="vertical",r){t.infos.forEach((n,s)=>{if(r&&s===2)n.preview=hUt(e,i);else{const o=Er(n.size)+(i==="horizontal"?Rue:XG),a=n.preview,c=(a==null?void 0:a.tagName.toLowerCase())==="div",p=c?a:document.createElement("div");p.className=Iue.univariateAboveAndBelowSymbol,i==="horizontal"?p.style.width=`${o}px`:p.style.height=`${o}px`,!c&&a&&p.appendChild(a),n.preview=p}})}function UV(t,e="classic"){const i=t.infos;return e==="classic"?(Er(i[0].size)+XG)/2:(Er(i[0].size)-Er(i[i.length-1].size))/2}function FO(t,e){if(!t)return null;const i=t.infos.map(n=>n.color),r=gS(e.type==="full"?i:e.type==="above"?i.slice(0,3):i.slice(2,5),{width:e.width,height:e.height,align:e.rampAlignment,effectList:e.effectList,ariaLabel:e.ariaLabel});return r.className=Iue.colorRamp,e.opacity!=null&&(r.style.opacity=e.opacity.toString()),r}function Ire(t,e,i,r="vertical"){let n=0;const s=t.infos,o=Math.floor(s.length/2),a=e==="full"||e==="above"?0:o,c=e==="full"||e==="below"?s.length-1:o;for(let p=a;p<=c;p++)i&&p===o?n+=r==="horizontal"?OVe:Pue:n+=Er(s[p].size)+(r==="horizontal"?Rue:XG);return Math.round(n)}function kO(t,e,i,r="vertical"){const n=Ire(t,e,i,r),s=t.infos,o=Math.floor(s.length/2),a=e==="full"||e==="above"?0:o,c=e==="full"||e==="below"?s.length-1:o,p=e==="full"?s[a].size+s[c].size:e==="above"?s[a].size:s[c].size,_=i?r==="vertical"?Pue:OVe:0,x=r==="vertical"?XG*(e==="full"?2:1):Rue*(e==="full"?2:1);return Math.round(n-(Er(p)/2+_/2+x/2))}function RVe(t,e,i="vertical"){const r=t.infos;let n=r.find(({type:o})=>o==="size-ramp"),s=r.find(({type:o})=>o==="color-ramp");return n&&(n={...n},n.infos=[...n.infos],PVe(n,e,i,!0)),s&&(s={...s},s.infos=[...s.infos]),i==="horizontal"&&(n==null||n.infos.reverse(),s==null||s.infos.reverse()),{sizeRampElement:n,colorRampElement:s}}function IVe(t,e="vertical"){const i=t.infos;let r=i.find(({type:s})=>s==="size-ramp"),n=i.find(({type:s})=>s==="color-ramp");return r&&(r={...r},r.infos=[...r.infos],PVe(r,null,e,!1)),n&&(n={...n},n.infos=[...n.infos]),e==="horizontal"&&(r==null||r.infos.reverse(),n==null||n.infos.reverse()),{sizeRampElement:r,colorRampElement:n}}function dUt(t,e){return e}function Tl(t){const e=this;t.appendChild(e)}function _2(t,e,i){if(!e)return;if(typeof e=="number")return e;if(typeof e=="string")return OGe(e);if("value"in e||"unit"in e)return Zy(t.dotValue,e);if("colorName"in e&&"bandName"in e)return t[e.colorName]+": "+(t[e.bandName]||e.bandName);if("showCount"in e)return e.showCount?t.clusterCountTitle:void 0;let r=null;return dUt(e,i)?r=e.ratioPercentTotal?"showRatioPercentTotal":e.ratioPercent?"showRatioPercent":e.ratio?"showRatio":e.normField?"showNormField":e.field?"showField":null:$Ve(e,i)&&(r=e.normField?"showNormField":e.normByPct?"showNormPct":e.field?"showField":null),r?Zy(r==="showField"?"{field}":t[r],{field:e.field,normField:e.normField}):void 0}function $Ve(t,e){return!e}function LVe(t,e){return!!(e&&e==="Stretched"&&t.version>=10.3&&t.declaredClass==="esri.layers.ImageryLayer")}function DVe(t,e){var i;return t.label?e[t.label]+": "+(typeof t.value=="string"?t.value:hd(t.value??0,{style:"decimal",notation:(i=t.value)!=null&&i.toString().toLowerCase().includes("e")?"scientific":"standard"})):""}const pUt=25,fUt=25,mUt=768,gUt=100;var oL;(function(t){t.Auto="auto",t.Stack="stack",t.SideBySide="side-by-side"})(oL||(oL={}));const yUt="#ddd",oA=window.devicePixelRatio;function vUt(t){var e,i;if(t){if(t.type.includes("3d")){const r=(e=t.symbolLayers)==null?void 0:e.length;if(!r)return;const n=t.symbolLayers.at(r-1),s=(i=n.resource)==null?void 0:i.primitive;return s==="circle"||s==="cross"||s==="kite"||s==="sphere"||s==="cube"||s==="diamond"}{const r=t.style;return r==="circle"||r==="diamond"||r==="cross"}}}function _Ut(t){var e;if(t){if(t.type.includes("3d")){const i=(e=t.symbolLayers)==null?void 0:e.length;if(!i)return;const r=t.symbolLayers.at(i-1).get("resource.primitive");return r==="triangle"||r==="cone"||r==="tetrahedron"}return t.style==="triangle"}}let Z0=class extends hn{constructor(e,i){super(e,i),this._hasIndicators=!1,this._selectedSectionName=null,this._sectionNames=[],this._sectionMap=new Map,this.activeLayerInfos=null,this.headingLevel=3,this.layout=oL.Stack,this.messages=null,this.messagesCommon=null,this.type="card",this.view=null}initialize(){this.addHandles(_e(()=>this.activeLayerInfos,e=>{this.removeAllHandles(),this._watchForSectionChanges(e)}))}render(){const{view:e}=this;this._hasIndicators=this.layout===oL.Auto&&e&&e.container.clientWidth<=mUt||this.layout===oL.Stack;const i=this.activeLayerInfos,r=i&&i.toArray().map(p=>this._renderLegendForLayer(p)).filter(p=>!!p);this._hasIndicators?this._selectedSectionName&&this._sectionNames.includes(this._selectedSectionName)||(this._selectedSectionName=this._sectionNames&&this._sectionNames[0]):this._selectedSectionName=null;const n=this._sectionNames.length,s=this._sectionNames.map((p,_)=>{const x=Zy(this.messagesCommon.pagination.pageText,{index:_+1,total:n});return X("div",{"aria-controls":`${p}-panel`,"aria-label":x,"aria-selected":(this._selectedSectionName===p).toString(),bind:this,class:this.classes(pi.indicator,{[pi.activated]:this._selectedSectionName===p}),"data-section-name":p,id:p,key:p,onclick:this._selectSection,onkeydown:this._focusSection,role:"tab",tabIndex:this._selectedSectionName===p?0:-1,title:x})}),o=this._hasIndicators&&n>1?X("div",{class:pi.indicatorContainer,key:"carousel-navigation",role:"tablist"},s):null,a=this._hasIndicators?this._sectionMap.get(this._selectedSectionName):r&&r.length?r:null,c={[pi.stacked]:this._hasIndicators};return X("div",{class:this.classes(pi.base,c)},a||X("div",{class:pi.message},this.messages.noLegend),o)}_selectSection(e){const i=e.target.getAttribute("data-section-name");i&&(this._selectedSectionName=i)}_focusSection(e){switch(e.key){case"ArrowLeft":case"ArrowRight":this._switchSectionOnArrowPress(e);break;case"Enter":case" ":this._selectSection(e)}}_switchSectionOnArrowPress(e){const i=e.key,r=i==="ArrowLeft"?-1:1,n=e.target.getAttribute("data-section-name"),s=this._sectionNames.indexOf(n),o=this._sectionNames;let a=null;s!==-1&&(o[s+r]?a=document.getElementById(o[s+r]):i==="ArrowLeft"?a=document.getElementById(o[o.length-1]):i==="ArrowRight"&&(a=document.getElementById(o[0])),a==null||a.focus())}_watchForSectionChanges(e){if(this._generateSectionNames(),e){e.forEach(r=>{const n=`activeLayerInfo-${r.layer.uid}-version-change`;this.removeHandles(n),this._watchForSectionChanges(r.children),this.addHandles(_e(()=>r.version,()=>this._generateSectionNames()),n)});const i="activeLayerInfos-collection-change";this.removeHandles(i),this.addHandles(e.on("change",()=>this._watchForSectionChanges(e)),i)}}_generateSectionNames(){this._sectionNames.length=0,this._selectedSectionName=null,this.activeLayerInfos&&this.activeLayerInfos.forEach(this._generateSectionNamesForActiveLayerInfo,this)}_getSectionName(e,i,r){return`${this.id}${e.uid}-type-${i.type}-${r}`}_generateSectionNamesForActiveLayerInfo(e){e.children.forEach(this._generateSectionNamesForActiveLayerInfo,this),e.legendElements&&e.legendElements.forEach((i,r)=>{this._sectionNames.push(this._getSectionName(e.layer,i,r))})}_renderLegendForLayer(e){if(!e.ready)return null;if(e.children.length){const i=e.children.map(r=>this._renderLegendForLayer(r)).toArray();return X("div",{class:this.classes(pi.service,pi.groupLayer),key:e.layer.uid},X("div",{class:pi.serviceCaptionContainer},e.title),i)}{const i=e.legendElements;if(i&&!i.length)return null;const r=i.some(o=>o.type==="relationship-ramp"),n=i.map((o,a)=>this._renderLegendForElement(o,e,a,r)).filter(o=>!!o);if(!n.length)return null;const s={[pi.groupLayerChild]:!!e.parent};return X("div",{class:this.classes(pi.service,s),key:e.layer.uid},X("div",{class:pi.serviceCaptionContainer},X("div",{class:pi.serviceCaptionText},e.title)),X("div",{class:pi.serviceContent},n))}}_renderLegendForElement(e,i,r,n=!1,s=!1){var P;const o=e.type==="color-ramp",a=e.type==="opacity-ramp",c=i.layer;let p=null;if(typeof e.title=="string")p=e.title;else if(e.title){const $=e.title,F=_2(this.messages,$,o||a);p=$.title?`${$.title} (${F})`:F}const _=this._getSectionName(c,e,r),x=this._hasIndicators&&!s?X("div",null,X(Dm,{class:pi.carouselTitle,level:this.headingLevel},i.title),X(Dm,{class:pi.layerCaption,level:ekt(this.headingLevel)},p)):p?X(Dm,{class:pi.layerCaption,level:this.headingLevel},p):null,S=i.effectList;let C=null;switch(e.type){case"symbol-table":{const $=e.infos.map((F,z)=>this._renderLegendForElementInfo(F,i,e.legendType,z)).filter(F=>!!F);if($.length){const F=(P=$[0].properties.classes)==null?void 0:P[pi.symbolRow],z={[pi.labelContainer]:!F&&!n,[pi.relationshipLabelContainer]:n};C=X("div",{class:this.classes(z)},$)}break}case"color-ramp":case"opacity-ramp":case"heatmap-ramp":case"stretch-ramp":C=this._renderLegendForRamp(e,c.opacity,S);break;case"size-ramp":C=this._renderSizeRamp(e,c.opacity);break;case"pie-chart-ramp":C=this._renderPieChartRamp(e);break;case"relationship-ramp":C=eVe(e,this.id,{opacity:c.opacity,effectList:S,ariaLabel:this.messages.previewRelationshipRampAriaLabel});break;case"univariate-above-and-below-ramp":C=this._renderUnivariateAboveAndBelowRamp(e,c.opacity,S);break;case"univariate-color-size-ramp":C=this._renderUnivariateColorSizeRamp(e,c.opacity,S)}if(!C)return null;const M=X("div",{"aria-labelledby":_,class:pi.section,id:`${_}-panel`,key:_,role:"tabpanel",tabIndex:0},[x,C]);return s||this._sectionMap.set(_,M),M}_renderPieChartRamp(e){return X("div",{afterCreate:Tl,bind:e.preview,class:pi.pieChartRampPreview})}_renderUnivariateAboveAndBelowRamp(e,i,r){var j;const{sizeRampElement:n,colorRampElement:s}=RVe(e,i,"horizontal");if(!n)return null;const o=Ire(n,"full",!0,"horizontal"),a=kO(n,"above",!0,"horizontal"),c=kO(n,"below",!0,"horizontal"),p=12,_=(j=this.messages)==null?void 0:j.previewColorRampAriaLabel,x=FO(s,{width:a,height:p,rampAlignment:"horizontal",opacity:i,type:"above",effectList:r,ariaLabel:_}),S=FO(s,{width:c,height:p,rampAlignment:"horizontal",opacity:i,type:"below",effectList:r,ariaLabel:_}),C=UV(n,"card"),M=n.infos.map(G=>G.label),P=M.length-1,$=M.map((G,Y)=>Y===0||Y===P?X("div",{key:Y},G):null),F={display:"flex",flexDirection:"column"},z={display:"flex",flexDirection:"row"},k={marginTop:"3px",display:"flex"};ZT(this.container)?k.marginRight=`${C}px`:k.marginLeft=`${C}px`;const U={width:`${o}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return X("div",{class:pi.layerRow,key:"size-ramp-preview",styles:F},X("div",{class:this.classes(pi.symbolContainer,pi.sizeRampHorizontal),styles:z},n.infos.map((G,Y)=>X("div",{afterCreate:Tl,bind:G.preview,class:pi.symbol,key:Y}))),x?X("div",{class:pi.univariateAboveAndBelowColorRamp,key:"color-ramp-preview",styles:k},X("div",{afterCreate:Tl,bind:x}),X("div",{afterCreate:Tl,bind:S})):null,X("div",{class:pi.layerInfo},X("div",{class:pi.rampLabelsContainer,styles:U},$)))}_renderUnivariateColorSizeRamp(e,i,r){var $;const{sizeRampElement:n,colorRampElement:s}=IVe(e,"horizontal");if(!n)return null;const o=Ire(n,"full",!1,"horizontal"),a=kO(n,"full",!1,"horizontal"),c=FO(s,{width:a,height:12,rampAlignment:"horizontal",opacity:i,type:"full",effectList:r,ariaLabel:($=this.messages)==null?void 0:$.previewColorRampAriaLabel}),p=UV(n,"card"),_=n.infos.length-1,x=n.infos.map((F,z)=>z===0||z===_?X("div",{key:z},F.label):null),S={display:"flex",flexDirection:"column"},C={display:"flex",flexDirection:"row"},M={marginTop:"3px",display:"flex"};ZT(this.container)?M.marginRight=`${p}px`:M.marginLeft=`${p}px`;const P={width:`${o}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return X("div",{class:pi.layerRow,key:"size-ramp-preview",styles:S},X("div",{class:this.classes(pi.symbolContainer,pi.sizeRampHorizontal),styles:C},n.infos.map((F,z)=>X("div",{afterCreate:Tl,bind:F.preview,class:pi.symbol,key:z}))),X("div",{class:pi.univariateAboveAndBelowColorRamp,key:"color-ramp-preview",styles:M},X("div",{afterCreate:Tl,bind:c})),X("div",{class:pi.layerInfo},X("div",{class:pi.rampLabelsContainer,styles:P},x)))}_renderLegendForElementInfo(e,i,r,n){var c,p,_,x,S;const s=i.layer;if(e.type)return this._renderLegendForElement(e,i,n,!1,!0);const o=LVe(s,r),a=_2(this.messages,e.label,!1)??"";if(e.preview){if(!((c=e.symbol)!=null&&c.type.includes("simple-fill"))){if(!e.label)return X("div",{afterCreate:Tl,bind:e.preview,key:n});const ie={[pi.symbolCell]:this._hasIndicators};return X("div",{class:this.classes(pi.layerRow,{[pi.symbolRow]:this._hasIndicators}),key:n},X("div",{afterCreate:Tl,bind:e.preview,class:this.classes(ie)}),X("div",{class:this.classes(pi.imageLabel,{[pi.labelCell]:this._hasIndicators})},a))}let C=255,M=255,P=255,$=0,F=255,z=255,k=255,U=0;const j=(p=e.symbol.color)==null?void 0:p.a,G=(x=(_=e.symbol.outline)==null?void 0:_.color)==null?void 0:x.a;j&&(C=e.symbol.color.r,M=e.symbol.color.g,P=e.symbol.color.b,$=e.symbol.color.a*s.opacity),G&&(F=e.symbol.outline.color.r,z=e.symbol.outline.color.g,k=e.symbol.outline.color.b,U=e.symbol.outline.color.a*s.opacity);const Y=((S=e.symbol.color)==null?void 0:S.isBright)??!0,Q=Y?"rgba(255, 255, 255, .6)":"rgba(0, 0, 0, .6)",ne={background:j?`rgba(${C}, ${M}, ${P}, ${$})`:"none",color:Y?"black":"white",textShadow:`-1px -1px 0 ${Q}, 1px -1px 0 ${Q}, -1px 1px 0 ${Q}, - 1px 1px 0 ${Q}`,border:H?`1px solid rgba(${F}, ${z}, ${k}, ${U})`:"none",filter:WL(i.effectList)??void 0};return X("div",{class:pi.layerRow,key:n},X("div",{class:pi.labelElement,styles:ne},l))}if(e.src){const A=this._renderImage(e,s,o);return X("div",{class:pi.layerRow,key:n},A,X("div",{class:pi.imageLabel},l))}}_renderImage(e,i,r){const{label:n,src:s,opacity:o}=e,l={[pi.imageryLayerStretchedImage]:r,[pi.symbol]:!r},c={opacity:`${o??i.opacity}`};return X("img",{alt:p2(this.messages,n,!1),"aria-label":p2(this.messages,n,!1),border:0,class:this.classes(l),height:e.height,src:s,styles:c,width:e.width})}_renderSizeRampLines(e){const i=e.infos,r=i[0],n=i[i.length-1],s=r.symbol,o=this._hasIndicators,l=Tr(r.size+r.outlineSize)*eA,c=Tr(n.size+n.outlineSize)*eA,f=o?l:l+50*eA,_=o?l/2+50*eA:l,x=kzt(s),T=Fzt(s),A=document.createElement("canvas");A.width=f,A.height=_,A.style.width=A.width/eA+"px",A.style.height=A.height/eA+"px";const M=A.getContext("2d");if(o){M.beginPath();const I=0,L=0,F=f/2-c/2,z=_;M.moveTo(I,L),M.lineTo(F,z);const k=f,U=0,j=f/2+c/2,H=_;M.moveTo(k,U),M.lineTo(j,H)}else{M.beginPath();const I=0,L=_/2-c/2,F=f,z=0;M.moveTo(I,L),M.lineTo(F,z);const k=0,U=_/2+c/2,j=f,H=_;M.moveTo(k,U),M.lineTo(j,H)}return M.strokeStyle=Nzt,M.stroke(),X("div",{afterCreate:xl,bind:A,styles:o?{display:"flex",marginTop:`-${x?0:T?l/2:0}px`,marginBottom:`-${x?c:T?c/2:0}px`}:{display:"flex",marginRight:`-${x?0:T?l/2:0}px`,marginLeft:`-${x?0:T?c/2:0}px`}})}_renderSizeRamp(e,i){const r=e.infos,n=r[0].label,s=r[r.length-1].label;let o=r[0].preview,l=r[r.length-1].preview;const c=this._hasIndicators,f={"flex-direction":c?"column":"row-reverse"};o&&(o=o.cloneNode(!0),o.style.display="flex"),l&&(l=l.cloneNode(!0),l.style.display="flex");const _={opacity:i!=null?`${i}`:""};return X("div",{class:this.classes(pi.layerRow,{[pi.sizeRampRow]:c})},X("div",{class:pi.rampLabel},c?n:s),X("div",{class:pi.sizeRampContainer,styles:f},X("div",{afterCreate:xl,bind:o,class:pi.sizeRampPreview,styles:_}),this._renderSizeRampLines(e),X("div",{afterCreate:xl,bind:l,class:pi.sizeRampContainer,styles:_})),X("div",{class:pi.rampLabel},c?s:n))}_getRampStopLabel(e,i){switch(i){case"heatmap-ramp":return this.messages[e.label];case"stretch-ramp":return tVe(e,this.messages);default:return e.label}}_renderLegendForRamp(e,i,r){const n=e.infos,s=e.type,o=s==="heatmap-ramp",l=n.length-1,c=$zt,f=l>2&&!o?Izt*l:Dzt,_=f+20,x=10,T=n.slice(0).reverse(),A=T.length-1,M=T.length%2!=0?T[T.length/2|0]:null,I=M&&X("div",{class:pi.intervalSeparatorsContainer},X("div",{class:pi.intervalSeparator},"|"),X("div",{class:pi.rampLabel},this._getRampStopLabel(M,s))),L=[[{shape:{type:"path",path:`M0 ${c/2} L${x} 0 L${x} ${c} Z`},fill:T[0].color,stroke:{width:0}},{shape:{type:"rect",x,y:0,width:f,height:c},fill:{type:"linear",x1:x,y1:0,x2:f+x,y2:0,colors:T.map((U,j)=>({color:U.color,offset:o&&"ratio"in U?U.ratio:j/l}))},stroke:{width:0}},{shape:{type:"path",path:`M${f+x} 0 L${_} ${c/2} L${f+x} ${c} Z`},fill:T[A].color,stroke:{width:0}}]],F=vUe(L,_,c),z={filter:WL(r)??void 0,opacity:i==null?void 0:`${i}`},k={justifyContent:"center"};return X("div",{class:pi.layerRow,styles:k},X("div",{class:pi.rampLabel},this._getRampStopLabel(T[0],s)),X("div",{class:pi.symbolContainer},X("div",{styles:z},F),I),X("div",{class:pi.rampLabel},this._getRampStopLabel(T[A],s)))}};y([w()],W0.prototype,"activeLayerInfos",void 0),y([w()],W0.prototype,"headingLevel",void 0),y([w()],W0.prototype,"layout",void 0),y([w(),Gr("esri/widgets/Legend/t9n/Legend")],W0.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],W0.prototype,"messagesCommon",void 0),y([w({readOnly:!0})],W0.prototype,"type",void 0),y([w()],W0.prototype,"view",void 0),y([bo()],W0.prototype,"_selectSection",null),W0=y([Z("esri.widgets.Legend.styles.Card")],W0);const _X=W0,Un="esri-legend",qi={service:`${Un}__service`,label:`${Un}__service-label`,layer:`${Un}__layer`,groupLayer:`${Un}__group-layer`,groupLayerChild:`${Un}__group-layer-child`,layerTable:`${Un}__layer-table`,layerTableSizeRamp:`${Un}__layer-table--size-ramp`,layerChildTable:`${Un}__layer-child-table`,layerCaption:`${Un}__layer-caption`,layerBody:`${Un}__layer-body`,layerRow:`${Un}__layer-row`,layerCell:`${Un}__layer-cell`,layerInfo:`${Un}__layer-cell ${Un}__layer-cell--info`,imageryLayerStretchedImage:`${Un}__imagery-layer-image--stretched`,imageryLayerCellStretched:`${Un}__imagery-layer-cell--stretched`,imageryLayerInfoStretched:`${Un}__imagery-layer-info--stretched`,symbolContainer:`${Un}__layer-cell ${Un}__layer-cell--symbols`,symbol:`${Un}__symbol`,rampContainer:`${Un}__ramps`,sizeRamp:`${Un}__size-ramp`,colorRamp:`${Un}__color-ramp`,opacityRamp:`${Un}__opacity-ramp`,borderlessRamp:`${Un}__borderless-ramp`,rampTick:`${Un}__ramp-tick`,rampFirstTick:`${Un}__ramp-tick-first`,rampLastTick:`${Un}__ramp-tick-last`,rampLabelsContainer:`${Un}__ramp-labels`,rampLabel:`${Un}__ramp-label`,message:`${Un}__message`,univariateAboveAndBelowLabel:"esri-univariate-above-and-below-ramp__label"},zzt=`${Un}__`,Uzt=24,ixe={display:"flex",alignItems:"flex-start"},bX={marginLeft:"3px"},tA={display:"table-cell",verticalAlign:"middle"};let hS=class extends cn{constructor(e,i){super(e,i),this.activeLayerInfos=null,this.headingLevel=3,this.messages=null,this.type="classic"}render(){const e=this.activeLayerInfos,i=e&&e.toArray().map(r=>this._renderLegendForLayer(r)).filter(r=>!!r);return X("div",null,i&&i.length?i:X("div",{class:qi.message},this.messages.noLegend))}_renderLegendForLayer(e){if(!e.ready)return null;const i=!!e.children.length,r=`${zzt}${e.layer.uid}-version-${e.version}`,n=e.title?Im({level:this.headingLevel,class:this.classes(tt.heading,qi.label)},e.title):null;if(i){const s=e.children.map(o=>this._renderLegendForLayer(o)).toArray();return X("div",{class:this.classes(qi.service,qi.groupLayer),key:r},n,s)}{const s=e.legendElements;if(s&&!s.length)return null;const o=s.map(c=>this._renderLegendForElement(c,e.layer,e.effectList)).filter(c=>!!c);if(!o.length)return null;const l={[qi.groupLayerChild]:!!e.parent};return X("div",{class:this.classes(qi.service,l),key:r},n,X("div",{class:qi.layer},o))}}_renderLegendForElement(e,i,r,n){const s=e.type==="color-ramp",o=e.type==="opacity-ramp",l=e.type==="size-ramp";let c=null;if(e.type==="symbol-table"||l){const M=e.infos.map(I=>this._renderLegendForElementInfo(I,i,r,l,e.legendType)).filter(I=>!!I);M.length&&(c=X("div",{class:qi.layerBody},M))}else e.type==="color-ramp"||e.type==="opacity-ramp"||e.type==="heatmap-ramp"||e.type==="stretch-ramp"?c=this._renderLegendForRamp(e,i.opacity):e.type==="relationship-ramp"?c=bUe(e,this.id,{opacity:i.opacity,effectList:r,ariaLabel:this.messages.previewRelationshipRampAriaLabel}):e.type==="pie-chart-ramp"?c=this._renderPieChartRamp(e):e.type==="univariate-above-and-below-ramp"?c=this._renderUnivariateAboveAndBelowRamp(e,i.opacity,r):e.type==="univariate-color-size-ramp"&&(c=this._renderUnivariateColorSizeRamp(e,i.opacity,r));if(!c)return null;const f=e.title;let _=null;if(typeof f=="string")_=f;else if(f){const M=p2(this.messages,f,s||o);_=QUe(f,s||o)&&f.title?`${f.title} (${M})`:M}const x=n?qi.layerChildTable:qi.layerTable,T=_?X("div",{class:qi.layerCaption},_):null,A={[qi.layerTableSizeRamp]:l||!n};return X("div",{class:this.classes(x,A)},T,c)}_renderPieChartRamp(e){return X("div",{afterCreate:xl,bind:e.preview})}_renderUnivariateAboveAndBelowRamp(e,i,r){var H;const{sizeRampElement:n,colorRampElement:s}=JUe(e,i);if(!n)return null;const o=(H=this.messages)==null?void 0:H.previewColorRampAriaLabel,l=PO(n,"above",!0),c=PO(n,"below",!0),f=12,_=OO(s,{width:f,height:l,rampAlignment:"vertical",opacity:i,type:"above",effectList:r,ariaLabel:o}),x=OO(s,{width:f,height:c,rampAlignment:"vertical",opacity:i,type:"below",effectList:r,ariaLabel:o}),T=OV(n),A=n.infos.map(Y=>Y.label),M=A.map((Y,Q)=>Q===0?X("div",{class:Y?_?qi.univariateAboveAndBelowLabel:qi.rampLabel:void 0,key:Q},Y):Q===2?X("div",null):null),I=A.length-1,L=Math.floor(A.length/2),F=A.map((Y,Q)=>Q===L||Q===I?X("div",{class:Y?_?qi.univariateAboveAndBelowLabel:qi.rampLabel:void 0,key:Q},Y):null),z={display:"table-cell",verticalAlign:"middle"},k={marginTop:`${T}px`},U={height:`${l}px`},j={height:`${c}px`};return X("div",{key:"univariate-above-and-below-ramp-preview",styles:ixe},X("div",{class:qi.layerBody},n.infos.map((Y,Q)=>X("div",{class:this.classes(qi.layerRow,qi.sizeRamp)},X("div",{afterCreate:xl,bind:Y.preview,class:qi.symbol,styles:z}),_||Q%2!=0?null:X("div",{class:qi.layerInfo},A[Q])))),_?X("div",{key:"color-ramp-preview",styles:k},X("div",{styles:bX},X("div",{styles:tA},X("div",{afterCreate:xl,bind:_,class:qi.rampContainer})),X("div",{styles:tA},X("div",{class:qi.rampLabelsContainer,styles:U},M))),X("div",{styles:bX},X("div",{styles:tA},X("div",{afterCreate:xl,bind:x,class:qi.rampContainer})),X("div",{styles:tA},X("div",{class:qi.rampLabelsContainer,styles:j},F)))):null)}_renderUnivariateColorSizeRamp(e,i,r){var I;const{sizeRampElement:n,colorRampElement:s}=KUe(e);if(!n)return null;const o=OV(n),l=12,c=PO(n,"full",!1),f=OO(s,{width:l,height:c,rampAlignment:"vertical",opacity:i,type:"full",effectList:r,ariaLabel:(I=this.messages)==null?void 0:I.previewColorRampAriaLabel}),_=n.infos.length-1,x=n.infos.map((L,F)=>F===0||F===_?X("div",{class:L.label?s?qi.univariateAboveAndBelowLabel:qi.rampLabel:void 0,key:F},L.label):null),T={display:"table-cell",verticalAlign:"middle"},A={marginTop:`${o}px`},M={height:`${c}px`};return X("div",{key:"univariate-above-and-below-ramp-preview",styles:ixe},X("div",{class:qi.layerBody},n.infos.map(L=>X("div",{class:this.classes(qi.layerRow,qi.sizeRamp)},X("div",{afterCreate:xl,bind:L.preview,class:qi.symbol,styles:T})))),X("div",{key:"color-ramp-preview",styles:A},X("div",{styles:bX},X("div",{styles:tA},X("div",{afterCreate:xl,bind:f,class:qi.rampContainer})),X("div",{styles:tA},X("div",{class:qi.rampLabelsContainer,styles:M},x)))))}_renderLegendForRamp(e,i){const r=e.infos,n=e.type==="opacity-ramp",s=e.type==="heatmap-ramp",o=e.type==="stretch-ramp",l=e.preview,c=n?qi.opacityRamp:"";l.className=`${qi.colorRamp} ${c}`,i!=null&&(l.style.opacity=i.toString());const f=r.map(T=>X("div",{class:T.label?qi.rampLabel:void 0},s?this.messages[T.label]||T.label:o?tVe(T,this.messages):T.label)),_={width:`${Uzt}px`},x={height:l.style.height};return X("div",{class:qi.layerRow},X("div",{class:qi.symbolContainer,styles:_},X("div",{afterCreate:xl,bind:l,class:qi.rampContainer})),X("div",{class:qi.layerInfo},X("div",{class:qi.rampLabelsContainer,styles:x},f)))}_renderLegendForElementInfo(e,i,r,n,s){if(e.type)return this._renderLegendForElement(e,i,r,!0);let o=null;const l=eVe(i,s);if(e.preview?o=X("div",{afterCreate:xl,bind:e.preview,class:qi.symbol}):e.src&&(o=this._renderImage(e,i,l)),!o)return null;const c={[qi.imageryLayerInfoStretched]:l},f={[qi.imageryLayerInfoStretched]:l,[qi.sizeRamp]:!l&&n};return X("div",{class:qi.layerRow},X("div",{class:this.classes(qi.symbolContainer,f)},o),X("div",{class:this.classes(qi.layerInfo,c)},p2(this.messages,e.label,!1)||""))}_renderImage(e,i,r){const{label:n,src:s,opacity:o}=e,l={[qi.imageryLayerStretchedImage]:r,[qi.symbol]:!r},c={opacity:`${o??i.opacity}`};return X("img",{alt:p2(this.messages,n,!1),"aria-label":p2(this.messages,n,!1),border:0,class:this.classes(l),height:e.height,src:s,styles:c,width:e.width})}};y([w()],hS.prototype,"activeLayerInfos",void 0),y([w()],hS.prototype,"headingLevel",void 0),y([w(),Gr("esri/widgets/Legend/t9n/Legend")],hS.prototype,"messages",void 0),y([w({readOnly:!0})],hS.prototype,"type",void 0),hS=y([Z("esri.widgets.Legend.styles.Classic")],hS);const iA=hS,rxe={base:"esri-legend",widgetIcon:si.layerList};let gl=class extends cn{constructor(e,i){super(e,i),this.headingLevel=3,this.iconClass=rxe.widgetIcon,this.icon=null,this.messages=null,this.style=new iA,this.viewModel=new Azt}initialize(){this.addHandles([Jr(()=>this.view,"resize",()=>this.scheduleRender()),Jr(()=>this.activeLayerInfos,"change",()=>this._refreshActiveLayerInfos(this.activeLayerInfos)),_e(()=>this.headingLevel,e=>{const{style:i}=this;i&&(i.headingLevel=e)}),_e(()=>this.style,(e,i)=>{i&&e!==i&&i.destroy(),e&&(e.activeLayerInfos=this.activeLayerInfos,e.type==="card"&&(e.view=this.view),e.headingLevel=this.headingLevel)},ii)])}get activeLayerInfos(){return this.viewModel.activeLayerInfos}set activeLayerInfos(e){this.viewModel.activeLayerInfos=e}get basemapLegendVisible(){return this.viewModel.basemapLegendVisible}set basemapLegendVisible(e){this.viewModel.basemapLegendVisible=e}get groundLegendVisible(){return this.viewModel.groundLegendVisible}set groundLegendVisible(e){this.viewModel.groundLegendVisible=e}get hideLayersNotInCurrentView(){return this.viewModel.hideLayersNotInCurrentView}set hideLayersNotInCurrentView(e){this.viewModel.hideLayersNotInCurrentView=e}get keepCacheOnDestroy(){return this.viewModel.keepCacheOnDestroy}set keepCacheOnDestroy(e){this.viewModel.keepCacheOnDestroy=e}get respectLayerVisibility(){return this.viewModel.respectLayerVisibility}set respectLayerVisibility(e){this.viewModel.respectLayerVisibility=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}castStyle(e){if(e instanceof _X||e instanceof iA)return e;if(typeof e=="string")return e==="card"?new _X:new iA;if(e&&typeof e.type=="string"){const i={...e};return delete i.type,new(e.type==="card"?_X:iA)(i)}return new iA}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){return X("div",{class:this.classes(rxe.base,tt.widget,this.style instanceof iA?tt.panel:null)},this.style.render())}_refreshActiveLayerInfos(e){e.forEach(i=>{this.removeHandles(`version_${i.layer.uid}`),this._renderOnActiveLayerInfoChange(i)}),this.scheduleRender()}_renderOnActiveLayerInfoChange(e){const i=_e(()=>e.version,()=>this.scheduleRender());this.addHandles(i,`version_${e.layer.uid}`);const r=Jr(()=>e.children,"change",()=>e.children.forEach(n=>this._renderOnActiveLayerInfoChange(n)),ii);this.addHandles(r,`version_${e.layer.uid}`),e.children.forEach(n=>this._renderOnActiveLayerInfoChange(n))}};y([w()],gl.prototype,"activeLayerInfos",null),y([w()],gl.prototype,"basemapLegendVisible",null),y([w()],gl.prototype,"groundLegendVisible",null),y([w()],gl.prototype,"headingLevel",void 0),y([w()],gl.prototype,"hideLayersNotInCurrentView",null),y([w()],gl.prototype,"keepCacheOnDestroy",null),y([w()],gl.prototype,"respectLayerVisibility",null),y([w()],gl.prototype,"iconClass",void 0),y([w()],gl.prototype,"icon",void 0),y([w()],gl.prototype,"label",null),y([w()],gl.prototype,"layerInfos",null),y([w(),Gr("esri/widgets/Legend/t9n/Legend")],gl.prototype,"messages",void 0),y([w()],gl.prototype,"style",void 0),y([Ci("style")],gl.prototype,"castStyle",null),y([w()],gl.prototype,"view",null),y([w()],gl.prototype,"viewModel",void 0),gl=y([Z("esri.widgets.Legend")],gl);const iVe=gl,Vzt=Object.freeze(Object.defineProperty({__proto__:null,default:iVe},Symbol.toStringTag,{value:"Module"})),rVe=(t,e,i)=>new iVe({view:t,layerInfos:[{layer:e}],container:i}),nVe=()=>{const t=document.createElement("div");return t.classList.add("esri-widget"),t},Bzt=["be99602fc02d448eb859a0b426c0d5b6","b6517d264b8f467fa5b14c382dfdf87a","c5773442e91c48c392f28af6600169d0","1bc7e98137fe44129dd6653bef1920d0","287be80ff31d4c8babc48b2f959214f5","4ee7ecad357844bba5b95001de39f1e3","e5c6a086a5ae4d1991d4ca35733fe0ed"],jzt=t=>new eUe({view:t,container:"layers-container",listItemCreatedFunction:async e=>{const i=e.item;await i.layer.when();const[r,n]=cUe(),s=nVe();rVe(t,i.layer,s),r.append(n,s),(i.title==="Kataster"||i.title==="Kitsendused"||i.title==="Kitsendusi põhjustavad objektid"||i.title==="Geoloogia WMS")&&(i.hidden=!0),(i.layer.type!=="group"||i.title==="Taimkate analüütiline"||i.title==="Taimkate realistlik")&&(i.panel={content:r,className:"esri-icon-legend",open:!1,title:"Legend and layer opacity"}),n.addEventListener("calciteSliderInput",()=>{const l=n.value/100;i.layer.opacity=l}),i.layer.type!=="group"&&(i.actionsSections=[[{title:"Layer information",className:"esri-icon-description",id:"information"}]]),["Nõmme","Pärnu","Tallinn","Tartu","Kuressaare","Kohtuhoone tekstuuriga (Tallinn)"].includes(i.title)&&i.actionsSections.items[0].push({title:"Zoom to extent",className:"esri-icon-zoom-out-fixed",id:"zoomTo"})}}),Gzt=t=>new eUe({view:t,container:"wms-layers-container",listItemCreatedFunction:async e=>{const i=e.item;await i.layer.when();const[r,n]=cUe(),s=nVe();rVe(t,i.layer,s),r.append(n,s),i.title!=="Kataster"&&i.title!=="Kitsendused"&&i.title!=="Kitsendusi põhjustavad objektid"&&i.title!=="Geoloogia WMS"&&(i.hidden=!0),i.layer.type!=="group"&&(i.panel={content:r,className:"esri-icon-legend",open:!1,title:"Legend and layer opacity"}),n.addEventListener("calciteSliderInput",()=>{const o=n.value/100;i.layer.opacity=o}),i.title!=="Geoloogia WMS"&&(i.actionsSections=[[{title:"Layer information",className:"esri-icon-description",id:"information"}]])}}),Hzt=t=>new bFt({view:t,container:"basemaps-container",icon:"layer-basemap",source:Bzt.map(e=>new Ay({portalItem:{id:e}}))}),qzt=(t,e)=>{t.watch("activeBasemap",()=>{const i=t.activeBasemap.title==="Ortofoto";e.watch("zoom",()=>{e.map.layers.forEach(r=>{r.title==="Ortofoto WMS"&&(r.visible=i&&e.zoom>=12.5)})})})},nxe=(t,e)=>{t.on("trigger-action",i=>{const r=i.item.layer,n=i.action.id;n==="information"&&window.open(r.url),n==="zoomTo"&&e.goTo(r.fullExtent.extent)})};function Wzt(t,e){const i=sVe(e);return[t[0].toFixed(i),t[1].toFixed(i)]}function sVe(t){return t>=500?6:t<500&&t>=50?7:t<50&&t>=5?8:9}function Yzt(t,e){const i=t.includes(",")?",":" ",[r,n,s]=t.split(i).map(l=>{const c=l.trim();return c?Number(c):null});if(!PV(r)||!PV(n))return null;const o=new mt({x:r,y:n,spatialReference:e||at.WGS84});return s&&(o.z=s,o.hasZ=!0),o}function PV(t){return typeof t=="number"&&isFinite(t)}function wre(t){return!!t&&PV(t.x)&&PV(t.y)}function sxe(t,e){if(t.spatialReference.isGeographic&&e){const[i,r]=Wzt([t.x,t.y],e);return`${i}, ${r}`}return`${t.x.toFixed(3)}, ${t.y.toFixed(3)}`}const Xzt=["dd","dms","ddm","mgrs","usng","utm"];function Zzt(t){return Xzt.includes(t)}const wX={ar:[".",","],bg:[","," "],bs:[",","."],ca:[",","."],cs:[","," "],da:[",","."],de:[",","."],"de-ch":[".","’"],el:[",","."],en:[".",","],"en-au":[".",","],es:[",","."],"es-mx":[".",","],et:[","," "],fi:[","," "],fr:[","," "],"fr-ch":[","," "],he:[".",","],hi:[".",",","#,##,##0.###"],hr:[",","."],hu:[","," "],id:[",","."],it:[",","."],"it-ch":[".","’"],ja:[".",","],ko:[".",","],lt:[","," "],lv:[","," "],mk:[",","."],nb:[","," "],nl:[",","."],pl:[","," "],pt:[",","."],"pt-pt":[","," "],ro:[",","."],ru:[","," "],sk:[","," "],sl:[",","."],sr:[",","."],sv:[","," "],th:[".",","],tr:[",","."],uk:[","," "],vi:[",","."],zh:[".",","]};function zG(t=fa()){let e=(t=t.toLowerCase())in wX;if(!e){const s=t.split("-");s.length>1&&s[0]in wX&&(t=s[0],e=!0),e||(t="en")}const[i,r,n="#,##0.###"]=wX[t];return{decimal:i,group:r,pattern:n}}function Jzt(t,e){const i=zG((e={...e}).locale);e.customs=i;const r=e.pattern||i.pattern;return isNaN(t)||Math.abs(t)===1/0?null:Kzt(t,r,e)}const oVe=/[#0,]*[#0](?:\.0*#*)?/;function Kzt(t,e,i){const r=(i=i||{}).customs.group,n=i.customs.decimal,s=e.split(";"),o=s[0];if((e=s[t<0?1:0]||"-"+o).includes("%"))t*=100;else if(e.includes("‰"))t*=1e3;else{if(e.includes("¤"))throw new Error("currency notation not supported");if(e.includes("E"))throw new Error("exponential notation not supported")}const l=oVe,c=o.match(l);if(!c)throw new Error("unable to find a number expression in pattern: "+e);return i.fractional===!1&&(i.places=0),e.replace(l,Qzt(t,c[0],{decimal:n,group:r,places:i.places,round:i.round}))}function Qzt(t,e,i){(i=i||{}).places===!0&&(i.places=0),i.places===1/0&&(i.places=6);const r=e.split("."),n=typeof i.places=="string"&&i.places.indexOf(",");let s=i.places;n?s=i.places.substring(n+1):+s>=0||(s=(r[1]||[]).length),i.round<0||(t=Number(t.toFixed(Number(s))));const o=String(Math.abs(t)).split("."),l=o[1]||"";if(r[1]||i.places){n&&(i.places=i.places.substring(0,n));const M=i.places!==void 0?i.places:r[1]&&r[1].lastIndexOf("0")+1;+M>l.length&&(o[1]=l.padEnd(Number(M),"0")),+so[0].length&&(o[0]=o[0].padStart(f,"0")),c.includes("#")||(o[0]=o[0].substr(o[0].length-f)));let _,x,T=r[0].lastIndexOf(",");if(T!==-1){_=r[0].length-T-1;const M=r[0].substr(0,T);T=M.lastIndexOf(","),T!==-1&&(x=M.length-T-1)}const A=[];for(let M=o[0];M;){const I=M.length-_;A.push(I>0?M.substr(I):M),M=I>0?M.slice(0,I):"",x&&(_=x,x=void 0)}return o[0]=A.reverse().join(i.group||","),o.join(i.decimal||".")}function eUt(t){const e=zG((t=t||{}).locale),i=t.pattern||e.pattern,r=e.group,n=e.decimal;let s=1;if(i.includes("%"))s/=100;else if(i.includes("‰"))s/=1e3;else if(i.includes("¤"))throw new Error("currency notation not supported");const o=i.split(";");return o.length===1&&o.push("-"+o[0]),{regexp:n9(o,c=>(c="(?:"+Xre(c,".")+")").replace(oVe,f=>{const _={signed:!1,separator:t.strict?r:[r,""],fractional:t.fractional,decimal:n,exponent:!1},x=f.split(".");let T=t.places;x.length===1&&s!==1&&(x[1]="###"),x.length===1||T===0?_.fractional=!1:(T===void 0&&(T=t.pattern?x[1].lastIndexOf("0")+1:1/0),T&&t.fractional==null&&(_.fractional=!0),!t.places&&+T1&&(_.groupSize=A.pop().length,A.length>1&&(_.groupSize2=A.pop().length)),"("+iUt(_)+")"}),!0).replaceAll(/[\xa0 ]/g,"[\\s\\xa0]"),group:r,decimal:n,factor:s}}function tUt(t,e){const i=eUt(e),r=new RegExp("^"+i.regexp+"$").exec(t);if(!r)return NaN;let n=r[1];if(!r[1]){if(!r[2])return NaN;n=r[2],i.factor*=-1}return n=n.replaceAll(new RegExp("["+i.group+"\\s\\xa0]","g"),"").replace(i.decimal,"."),Number(n)*i.factor}function iUt(t){"places"in(t=t||{})||(t.places=1/0),typeof t.decimal!="string"&&(t.decimal="."),"fractional"in t&&!String(t.places).startsWith("0")||(t.fractional=[!0,!1]),"exponent"in t||(t.exponent=[!0,!1]),"eSigned"in t||(t.eSigned=[!0,!1]);const e=oxe(t),i=n9(t.fractional,n=>{let s="";return n&&t.places!==0&&(s="\\"+t.decimal,t.places===1/0?s="(?:"+s+"\\d+)?":s+="\\d{"+t.places+"}"),s},!0);let r=e+i;return i&&(r="(?:(?:"+r+")|(?:"+i+"))"),r+n9(t.exponent,n=>n?"([eE]"+oxe({signed:t.eSigned})+")":"")}function oxe(t){return"signed"in(t=t||{})||(t.signed=[!0,!1]),"separator"in t?"groupSize"in t||(t.groupSize=3):t.separator="",n9(t.signed,e=>e?"[-+]":"",!0)+n9(t.separator,e=>{if(!e)return"(?:\\d+)";(e=Xre(e))===" "?e="\\s":e===" "&&(e="\\s\\xa0");const i=t.groupSize,r=t.groupSize2;if(r){const n="(?:0|[1-9]\\d{0,"+(r-1)+"}(?:["+e+"]\\d{"+r+"})*["+e+"]\\d{"+i+"})";return i-r>0?"(?:"+n+"|(?:0|[1-9]\\d{0,"+(i-1)+"}))":n}return"(?:0|[1-9]\\d{0,"+(i-1)+"}(?:["+e+"]\\d{"+i+"})*)"},!0)}const n9=(t,e,i)=>{if(!(t instanceof Array))return e(t);const r=[];for(let n=0;n"("+(e?"?:":"")+t+")";function nUt(t,e){const i=[];t=(t=(t=t.replaceAll(/[\u00B0\u00BA]/g,"^")).replaceAll("′","'")).replaceAll("″",'"');const r=mx(e);return lT.dmsToGeog(r,1,[t],i)?new mt(i[0][0],i[0][1],e||at.WGS84):null}function sUt(t,e,i){const r=[],n=aVe(i);if(n===-1)return console.warn(`invalid conversionMode: ${i}`),null;const s=mx(e);return Nh.mgrsToGeogExtended(s,1,[t],n,r)?new mt(r[0][0],r[0][1],e||at.WGS84):null}function oUt(t,e){const i=[];!e&&/\(.+27/.test(t)&&(e=at.GCS_NAD_1927);const r=mx(e);return lL.usngToGeog(r,1,[t],i)?new mt(i[0][0],i[0][1],e||at.WGS84):null}function aUt(t,e,i){const r=[],n=lVe(i);if(n===-1)return console.warn(`invalid conversionMode: ${i}`),null;const s=mx(e);return h_.utmToGeog(s,1,[t],n,r)?new mt(r[0][0],r[0][1],e||at.WGS84):null}function lUt(t,e,i=0){const r=[[t.x,t.y]],n=[],s=mx(t.spatialReference);let o=0;switch(e){case"dd":o=lT.geogToDd(s,1,r,i,n);break;case"ddm":o=lT.geogToDdm(s,1,r,i,n);break;case"dms":o=lT.geogToDms(s,1,r,i,n);break;default:return console.warn(`invalid format: ${e}`),null}return o?n[0]:null}function cUt(t,e,i=0,r=!1){const n=[[t.x,t.y]],s=[],o=mx(t.spatialReference);let l=aVe(e);return l===-1?(console.warn(`invalid conversionMode: ${e}`),null):(r&&(l|=Nh.PE_MGRS_ADD_SPACES),Nh.geogToMgrsExtended(o,1,n,i,!1,l,s)?s[0]:null)}function uUt(t,e=0,i=!1){const r=[[t.x,t.y]],n=[],s=mx(t.spatialReference);return lL.geogToUsng(s,1,r,e,!1,i,n)?n[0]:null}function hUt(t,e,i=!1){const r=[[t.x,t.y]],n=[],s=mx(t.spatialReference);let o=lVe(e);return o===-1?(console.warn(`invalid conversionMode: ${e}`),null):(i&&(o|=h_.PE_UTM_OPTS_ADD_SPACES),h_.geogToUtm(s,1,r,o,n)?n[0]:null)}function mx(t){let e=null;if(t||(t=at.WGS84),t.wkid){if(e=aL.geogcs(t.wkid),!e)throw new se("coordinate-formatter:invalid-spatial-reference","wkid is not valid")}else{if(!t.wkt2&&!t.wkt)throw new se("coordinate-formatter:invalid-spatial-reference","wkid and wkt are missing");if(e=aL.fromString(to.PE_TYPE_GEOGCS,t.wkt2||t.wkt),!e)throw new se("coordinate-formatter:invalid-spatial-reference","wkt is not valid")}return e}function aVe(t){let e=-1;switch(t){case"automatic":e=Nh.PE_MGRS_STYLE_AUTO;break;case"new-180-in-zone-01":e=Nh.PE_MGRS_STYLE_NEW|Nh.PE_MGRS_180_ZONE_1_PLUS;break;case"new-180-in-zone-60":e=Nh.PE_MGRS_STYLE_NEW;break;case"old-180-in-zone-01":e=Nh.PE_MGRS_STYLE_OLD|Nh.PE_MGRS_180_ZONE_1_PLUS;break;case"old-180-in-zone-60":e=Nh.PE_MGRS_STYLE_OLD}return e}function lVe(t){let e=-1;switch(t){case"latitude-band-indicators":e=h_.PE_UTM_OPTS_NONE;break;case"north-south-indicators":e=h_.PE_UTM_OPTS_NS}return e}let Lu=class extends ze{constructor(e){super(e),this.conversionInfo=null,this.coordinateSegments=null,this._currentPattern=void 0,this.defaultPattern=null,this.name=null,this.viewModel=null}get currentPattern(){return(this._currentPattern||this.defaultPattern)??""}set currentPattern(e){this._currentPattern=e}get label(){return this.name??""}set label(e){this._overrideIfSome("label",e)}get hasDisplayProperties(){return!(!this.defaultPattern||!this.coordinateSegments)}get spatialReference(){var e;return this.name==="basemap"?this._viewSpatialReference:((e=this.conversionInfo)==null?void 0:e.spatialReference)??at.WGS84}set spatialReference(e){this._overrideIfSome("spatialReference",e)}get _viewSpatialReference(){var e,i;return((i=(e=this.viewModel)==null?void 0:e.view)==null?void 0:i.spatialReference)??at.WGS84}get _additionalCharactersPattern(){const e=this.coordinateSegments;if(!e)return null;const i=e.map(n=>n.alias),r=this.currentPattern.replaceAll(new RegExp(`["nsew${i.join()}]`,"gi"),"").replaceAll(" ","");return new RegExp(`[${r}]`,"g")}get test(){return{additionalCharactersPattern:this._additionalCharactersPattern}}async convert(e){var n;if(!wre(e))throw new se("format:invalid-point","Could not convert invalid point.",{point:e});const i=(n=this.conversionInfo)==null?void 0:n.convert;if(i)return Promise.resolve().then(()=>i(e));const r=await this._project(e,this.spatialReference);return{location:r,coordinate:await this._getCoordinate(r)}}getConversionStrategy(){var i,r;const e=this._viewSpatialReference;return(i=this.conversionInfo)!=null&&i.convert||(r=this.viewModel)!=null&&r.formatterAvailable||this.name==="xy"&&(e.isWebMercator||e.isWGS84)||this.name==="basemap"?"client":"server"}getDisplayCoordinate(e){if(!e)return null;if(!this.coordinateSegments||!this.currentPattern)return e;let i=this.currentPattern;const r=this._getSegmentMatches(e,!1);for(let n=this.coordinateSegments.length-1;n>=0;n--){const s=this.coordinateSegments[n];i=i.replace(s.alias,r[n])}return i}parseUserInput(e){const{defaultPattern:i,_additionalCharactersPattern:r,coordinateSegments:n}=this;if(!i||!r)return"";let s=i.replace(r,"");e=e.replace(r,"");const o=this._getSegmentMatches(e,!0);if(n)for(let l=n.length-1;l>=0;l--){const c=n[l];s=s.replace(c.alias,o[l])}return s}_getSegmentMatches(e,i){const r=new Array,{coordinateSegments:n}=this;if(!n)return r;for(let s=0;sF!=null&&Object.keys(T).includes(F),I=new RegExp(`\\d{1,2}[\\.|\\${l}]?\\d*`,"i"),L=new RegExp(`\\d{1,3}[\\.|\\${l}]?\\d*`,"i");e.forEach(F=>{const{name:z}=F;if(z==="dd"?F.coordinateSegments=[{alias:"Y",description:"degrees latitude",searchPattern:I,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.north,description:"north/south indicator",searchPattern:_,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[rA[k]]}},{alias:"X",description:"degrees longitude",searchPattern:L,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.east,description:"east/west indicator",searchPattern:x,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[rA[k]]}}]:z==="ddm"?F.coordinateSegments=[{alias:"Y",description:"degrees latitude",searchPattern:I,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"A",description:"minutes latitude",searchPattern:I,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.north,description:"north/south indicator",searchPattern:_,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[rA[k]]}},{alias:"X",description:"degrees longitude",searchPattern:L,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"B",description:"minutes longitude",searchPattern:I,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.east,description:"east/west indicator",searchPattern:x,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[rA[k]]}}]:z==="dms"?F.coordinateSegments=[{alias:"Y",description:"degrees latitude",searchPattern:I,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"A",description:"minutes latitude",searchPattern:I,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"B",description:"seconds latitude",searchPattern:I,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.north,description:"north/south indicator",searchPattern:_,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[rA[k]]}},{alias:"X",description:"degrees longitude",searchPattern:L,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"C",description:"minutes longitude",searchPattern:I,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"D",description:"seconds longitude",searchPattern:I,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.east,description:"east/west indicator",searchPattern:x,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[rA[k]]}}]:(F.name==="xy"||F.name==="basemap")&&(F.coordinateSegments=[{alias:"X",description:"easting",searchPattern:f,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"Y",description:"northing",searchPattern:f,substitution:{input:k=>is(k),output:k=>ts(k)}}]),M(z)){const k=i?A[z]:T[z];F.defaultPattern=k,F.currentPattern=k}})}function pUt(){const t=new RegExp("N|S","i"),e=new RegExp("E|W","i");return[new av({name:"basemap",coordinateSegments:[{alias:"X",description:"easting",searchPattern:G8,substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"Y",description:"northing",searchPattern:G8,substitution:{input:i=>is(i),output:i=>ts(i)}}],defaultPattern:"X, Y",viewModel:null}),new av({name:"dd",coordinateSegments:[{alias:"Y",description:"degrees latitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\${dS}]?\\d*(?=\\D*?[N|S])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"N",description:"north/south indicator",searchPattern:t},{alias:"X",description:"degrees longitude",searchPattern:new RegExp(`\\d{1,3}[\\.|\\${dS}]?\\d*(?=\\D*?[E|W|])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"E",description:"east/west indicator",searchPattern:e}],defaultPattern:`Y${Do}N, X${Do}E`,viewModel:null}),new av({name:"ddm",coordinateSegments:[{alias:"Y",description:"degrees latitude",searchPattern:new RegExp("\\d{1,2}(?=.*?\\s+.*?[N|S])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"A",description:"minutes latitude",searchPattern:new RegExp(`\\d{1,2}[\\.\\${dS}]?\\d*(?=.*?[N|S])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"N",description:"north/south indicator",searchPattern:t},{alias:"X",description:"degrees longitude",searchPattern:new RegExp("\\d{1,3}(?=\\D*?\\s+.*?[E|W])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"B",description:"minutes longitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\|${dS}]?\\d*(?=.*?[E|W])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"E",description:"east/west indicator",searchPattern:e}],defaultPattern:`Y${Do} A'N, X${Do} B'E`,viewModel:null}),new av({name:"dms",coordinateSegments:[{alias:"Y",description:"degrees latitude",searchPattern:new RegExp("\\d{1,2}(?=.*?\\s+.*?[N|S])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"A",description:"minutes latitude",searchPattern:new RegExp("\\d{1,2}(?=.*?[N|S])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"B",description:"seconds latitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\${dS}]?\\d*(?=.*?[N|S])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"N",description:"north/south indicator",searchPattern:t},{alias:"X",description:"degrees longitude",searchPattern:new RegExp("\\d{1,3}(?=.*?\\s+.*?[E|W])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"C",description:"minutes longitude",searchPattern:new RegExp("\\d{1,2}(?=.*?[E|W])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"D",description:"seconds longitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\${dS}]?\\d*(?=.*?[E|W])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"E",description:"east/west indicator",searchPattern:e}],defaultPattern:`Y${Do} A' B"N, X${Do} C' D"E`,viewModel:null}),new av({name:"xy",coordinateSegments:[{alias:"X",description:"longitude",searchPattern:G8,substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"Y",description:"latitude",searchPattern:G8,substitution:{input:i=>is(i),output:i=>ts(i)}}],defaultPattern:`X${Do}, Y${Do}`,viewModel:null}),new av({name:"mgrs",coordinateSegments:[{alias:"Z",description:"grid zone",searchPattern:/\d{1,2}\w|[abyz]/i},{alias:"S",description:"grid square",searchPattern:/\w{2}/},{alias:"X",description:"easting",searchPattern:/^\d{5}(?=.?\d{5}$)|^\d{4}(?=.?\d{4}$)|^\d{3}(?=.?\d{3}$)|^\d{2}(?=.?\d{2}$)|^\d(?=.?\d$)/},{alias:"Y",description:"northing",searchPattern:/^\d{1,5}/}],defaultPattern:"Z S X Y",viewModel:null}),new av({name:"usng",coordinateSegments:[{alias:"Z",description:"grid zone",searchPattern:/\d{1,2}\w|[abyz]/i},{alias:"S",description:"grid square",searchPattern:/\w{2}/},{alias:"X",description:"easting",searchPattern:/^\d{5}(?=.?\d{5}$)|^\d{4}(?=.?\d{4}$)|^\d{3}(?=.?\d{3}$)|^\d{2}(?=.?\d{2}$)|^\d(?=.?\d$)/},{alias:"Y",description:"northing",searchPattern:/^\d{1,5}/}],defaultPattern:"Z S X Y",viewModel:null}),new av({name:"utm",coordinateSegments:[{alias:"Z",description:"zone number",searchPattern:/\d{1,2}|[abyz]/i},{alias:"B",description:"latitude band",searchPattern:/^\D/},{alias:"X",description:"easting",searchPattern:/\d{1,7}(?=\s*\d{7}$)/},{alias:"Y",description:"northing",searchPattern:/\d{1,7}/}],defaultPattern:"ZB X Y",viewModel:null})]}function ts(t){const e=t.match(dUt),i=e?e[0]:"",r=t.includes(".")?t.split(".")[1].length:0;return i+Jzt(Number(t),{pattern:"###0.###",places:r,round:-1})}function is(t){return tUt(t)}const H8={default:"default",crosshair:"crosshair"},fUt=new mt([0,0,500]),mUt="xy",gUt=["mgrs","utm","usng","dd","dms","ddm"],lxe="esri__coordinateConversionWidgetState",gg={conversions:"conversions",formats:"formats",view:"view",viewChange:"view-change"},yUt="esri/images/search/search-symbol-32.png";let ac=class extends LG(Dn.EventedAccessor){constructor(e){super(e),this._conversionPromise=null,this._locationGraphic=null,this._pointerCount=0,this.conversions=new it,this.formats=new it,this.formatterAvailable=!1,this.messages=null,this.filteredFormats=new it,this.locationSymbol=new dP({url:Wr(yUt),width:24,height:24}),this.storageEnabled=!0,this.storageType="session",this.view=null,this._saveWidgetState=this._saveWidgetState.bind(this),this._handleFormatChange=this._handleFormatChange.bind(this),this._handleConversionChange=this._handleConversionChange.bind(this),this._handleViewChange=this._handleViewChange.bind(this),this._onClick=this._onClick.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this)}initialize(){const e=async()=>this.messages=await lE("esri/widgets/CoordinateConversion/t9n/CoordinateConversion");this.formats.addMany(pUt()),e().then(()=>{if(!this.destroyed&&(axe(this.messages,this.formats),this.storageEnabled&&this._loadWidgetState(),this.formats.forEach(i=>{i.viewModel=this,this.addHandles(_e(()=>i.currentPattern,this._saveWidgetState),i.name??"unnamed-format")}),this.addHandles(this.conversions.on("change",this._handleConversionChange),gg.conversions),this.addHandles(this.formats.on("change",this._handleFormatChange),gg.formats),this.addHandles(oE(()=>{e().then(()=>{axe(this.messages,this.formats)})})),g_().then(()=>{this.formatterAvailable=!0}).catch(i=>{Ce.getLogger(this).error(new se("coordinate-conversion:projection-load-failed","Failed to load the projection module.",{error:i})),this.formatterAvailable=!1,this._filterFormatsAndConversions()}).then(()=>this.addHandles(_e(()=>this.view,this._handleViewChange,ii),gg.viewChange)),this.conversions.length===0)){const i=this.formats.find(r=>r.name===mUt)||this.formats.at(0);this.conversions.add(new BS({format:i}))}})}destroy(){this.removeHandles(),this._cleanUpView(this.view),this.view=null}castConversions(e){return this._castToConversions(e)}set currentLocation(e){this._set("currentLocation",e),this._updateConversions()}get currentLocation(){return this._get("currentLocation")||null}set mode(e){switch(e){case"capture":this.currentLocation=null,this._startCaptureMode(),this._set("mode",e);break;case"live":this._startLiveMode(),this._set("mode",e)}}get mode(){return this._get("mode")||"live"}get state(){const{messages:e,view:i}=this,r=i==null?void 0:i.ready;return e?r?"ready":i?"loading":"disabled":"disabled"}get storage(){const{storageType:e}=this;return e==="session"?sessionStorage:localStorage}get waitingForConversions(){return this._conversionPromise!=null}setLocation(e){var r,n;if(this._locationGraphic&&((r=this.view)==null||r.graphics.remove(this._locationGraphic)),!e)return;const i=e.clone();i.hasZ&&(i.z=void 0),this._locationGraphic=new Ml({geometry:i,symbol:this.locationSymbol}),(n=this.view)==null||n.graphics.add(this._locationGraphic)}async convert(e,i){if(!wre(i))throw new se("coordinate-conversion:invalid-point","Invalid point cannot be converted.",{point:i});return Promise.resolve().then(()=>e.convert(i))}async goToLocation(e){var s,o,l;const{view:i}=this;if(!i)throw new se("coordinate-conversion:go-to-failed","no view");const r=i.type==="3d"?i.clippingArea:null,n=(o=(s=i.map)==null?void 0:s.basemap)==null?void 0:o.baseLayers;if(r||(n==null?void 0:n.length)>0){const c=r??((l=n.at(0))==null?void 0:l.fullExtent);if(c!=null&&!c.contains(e))throw new se("coordinate-conversion:go-to-failed","Point outside basemap extent.",{point:e})}return this.callGoTo({target:e})}pause(){this.currentLocation=null,this.removeHandles(gg.view),this.view&&(this.view.cursor=H8.default,this._locationGraphic&&this.view.graphics.remove(this._locationGraphic))}async previewConversion(e,i=this.currentLocation||fUt){return(await cxe(e,i)).displayCoordinate}resume(){this.mode==="capture"?this._startCaptureMode():this._startLiveMode()}reverseConvert(e,i){return i.reverseConvert(e)}async updateConversions(e,i){if((i==null?void 0:i.type)!=="point")throw this._clearConversions(this.conversions),new se("coordinate-conversion:invalid-input-point","Point is invalid, conversions cannot be updated.",{point:i});return this._convertMany(e,i)}_castToConversions(e){const i=new it;return e.forEach(r=>{let n=null;if(r instanceof BS)n=r;else if(typeof r=="string"){const s=this.formats.find(o=>o.name===r);s&&(n=new BS({format:s}))}n&&i.add(n)}),i}_cleanUpView(e){e&&(this._locationGraphic&&e.graphics.remove(this._locationGraphic),this.removeHandles(gg.view),e.cursor=H8.default)}_clearConversions(e){e.forEach(i=>{i.position={location:null,coordinate:null}})}async _convertMany(e,i){return Promise.all(e.map(r=>cxe(r,i)))}_handleConversionChange(e){for(const i of e.added){const{format:r}=i;r&&(r.viewModel=this,this.currentLocation&&(this._set("waitingForConversions",!0),this.convert(r,this.currentLocation).then(n=>{i.position=n,this._set("waitingForConversions",!1)})))}this._saveWidgetState()}_handleFormatChange(e){e.added.forEach(i=>{this.addHandles(_e(()=>i.currentPattern,this._saveWidgetState),i.name??"unnamed-format"),i.viewModel=this}),e.removed.forEach(i=>{i.viewModel=null;const r=this.conversions.filter(n=>n.format===i);this.conversions.removeMany(r),i.name&&this.removeHandles(i.name)})}_loadWidgetState(){try{const e=JSON.parse(this.storage.getItem(lxe));e&&this._setWidgetState(e)}catch(e){Ce.getLogger(this).error(new se("coordinate-conversion:invalid-session-storage-json","Could not read from storage.",{error:e}))}}_startCaptureMode(){this.removeHandles(gg.view),this.view&&(this.view.cursor=H8.crosshair,this.currentLocation&&this.setLocation(this.currentLocation),this.addHandles(this.view.on("click",this._onClick),gg.view))}_startLiveMode(){this._pointerCount=0,this.removeHandles(gg.view),this.view&&(this.view.cursor=H8.default,this._locationGraphic&&this.view.graphics.remove(this._locationGraphic),this.addHandles([this.view.on("pointer-down",this._onPointerDown),this.view.on("pointer-up",this._onPointerUp),this.view.on("pointer-move",this._onPointerMove)],gg.view))}_handleViewChange(e,i){i&&i!==e&&this._cleanUpView(i),e&&(this.mode==="capture"?this._startCaptureMode():this._startLiveMode(),i&&this._filterFormatsAndConversions())}_onClick(e){var i;if(e.button===0){const r=(i=this.view)==null?void 0:i.toMap(e),n=r==null?void 0:r.normalize();this.setLocation(n),this.currentLocation=n}}_onPointerDown(e){var r;const{pointerType:i}=e;if(this._pointerCount++,(i==="touch"||i==="pen")&&this._pointerCount===1){const n=(r=this.view)==null?void 0:r.toMap(e);this.currentLocation=n==null?void 0:n.normalize()}}_onPointerMove(e){var r;const{pointerType:i}=e;if(i==="mouse"||this._pointerCount===1){const n=(r=this.view)==null?void 0:r.toMap(e);this.currentLocation=n==null?void 0:n.normalize()}}_onPointerUp(){this._pointerCount--}_setWidgetState(e){try{e.formats.forEach(i=>{const r=this.formats.find(n=>n.name===i.name);r&&e.locale===fa()&&i.currentPattern&&(r.currentPattern=i.currentPattern),r&&i.index>=0&&this.conversions.add(new BS({format:r}))})}catch(i){Ce.getLogger(this).warn(new se("coordinate-conversion:session-storage-read-error","Could not get widget state from stored JSON.",{error:i}))}}_saveWidgetState(){if(!this.storageEnabled)return;const e=this._toJSON();try{this.storage.setItem(lxe,JSON.stringify({formats:e,locale:fa()}))}catch(i){Ce.getLogger(this).error(new se("coordinate-conversion:local-storage-write-error","Could not write to localStorage.",{error:i}))}}async _updateConversions(){try{await this.updateConversions(this.conversions.toArray(),this.currentLocation)}catch{}}_toJSON(){return this.formats.filter(e=>{const i=e.name;return i==="xy"||i==="basemap"||Zzt(i)}).map(e=>({name:e.name,currentPattern:e.currentPattern,defaultPattern:e.defaultPattern,index:this.conversions.findIndex(i=>i.format===e)})).sort((e,i)=>e.index-i.index).toArray()}_filterFormatsAndConversions(){const{formatterAvailable:e,conversions:i,formats:r}=this;e||this.addHandles(Mo(()=>{var n;return(n=this.view)==null?void 0:n.spatialReference},n=>{const s=n.isWebMercator||n.isWGS84,o=r.filter(f=>{const{name:_}=f;return!!vUt(_)||_==="xy"&&!s}),l=this.filteredFormats.filter(f=>f.name==="xy"&&s&&!this.formats.includes(f)),c=i.filter(f=>o.includes(f.format));r.removeMany(o),i.removeMany(c),this.filteredFormats.addMany(o.filter(f=>!this.filteredFormats.includes(f))),r.addMany(l)},{once:!0,initial:!0}),gg.view)}};async function cxe(t,e){var i;try{t.position=await((i=t.format)==null?void 0:i.convert(e))}catch{t.position=null}return t}function vUt(t){return gUt.includes(t)}y([w()],ac.prototype,"conversions",void 0),y([Ci("conversions")],ac.prototype,"castConversions",null),y([w({type:mt})],ac.prototype,"currentLocation",null),y([w()],ac.prototype,"formats",void 0),y([w()],ac.prototype,"messages",void 0),y([w()],ac.prototype,"mode",null),y([w()],ac.prototype,"filteredFormats",void 0),y([w({readOnly:!0})],ac.prototype,"state",null),y([w()],ac.prototype,"locationSymbol",void 0),y([w({readOnly:!0,dependsOn:["storageType"]})],ac.prototype,"storage",null),y([w()],ac.prototype,"storageEnabled",void 0),y([w()],ac.prototype,"storageType",void 0),y([w({readOnly:!0})],ac.prototype,"waitingForConversions",null),y([w()],ac.prototype,"view",void 0),ac=y([Z("esri.widgets.CoordinateConversion.CoordinateConversionViewModel")],ac);const cVe=ac,Jn="esri-coordinate-conversion",Zi={base:Jn,captureMode:`${Jn}--capture-mode`,noBasemap:`${Jn}--no-basemap`,popup:`${Jn}__popup`,clipboardPopup:`${Jn}__clipboard-popup`,conversionList:`${Jn}__conversion-list`,conversionRow:`${Jn}__row`,coordDisplay:`${Jn}__display`,expanded:`${Jn}__conversions-view--expanded`,expandDown:`${Jn}__conversions-view--expand-down`,expandUp:`${Jn}__conversions-view--expand-up`,conversionsView:`${Jn}__conversions-view`,primarySelect:`${Jn}__select-primary`,rowSelect:`${Jn}__select-row`,toolDisplay:`${Jn}__tools`,modeToggle:`${Jn}__mode-toggle`,rowButton:`${Jn}__row-button`,backButton:`${Jn}__back-button`,convertButton:`${Jn}__button`,convertButtonSpan:`${Jn}__convert-button-span`,coordinateInput:`${Jn}__input-coordinate`,inputForm:`${Jn}__input-form`,inputFormGroup:`${Jn}__input-group`,rejectInput:`${Jn}__input-coordinate--rejected`,sectionHeading:`${Jn}__heading`,patternInput:`${Jn}__pattern-input`,settings:`${Jn}__settings`,settingsFormGroup:`${Jn}__settings-group`,settingsFormGroupHorizontal:`${Jn}__settings-group-horizontal`,previewCoordinate:`${Jn}__preview-coordinate`},uxe={settingsButton:!0,inputButton:!0,captureButton:!0,expandButton:!0},_Ut=750,bUt=2500;let xs=class extends cn{constructor(e,i){super(e,i),this._popupMessage=null,this._popupTimeoutId=void 0,this._clipboardPopupTimeoutId=void 0,this._coordinateInput=null,this._badInput=!1,this._goToEnabled=!1,this._conversionFormat=null,this._settingsFormat=null,this._previewConversion=null,this._expanded=!1,this._clipboardPopupVisible=!1,this._popupVisible=!1,this._settingsVisible=!1,this._inputVisible=!1,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.orientation="auto",this.viewModel=new cVe,this.visibleElements={...uxe}}get conversions(){return this.viewModel.conversions}set conversions(e){this.viewModel.conversions=e}get currentLocation(){return this.viewModel.currentLocation}set currentLocation(e){this.viewModel.currentLocation=e}get formats(){return this.viewModel.formats}set formats(e){this.viewModel.formats=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}set multipleConversions(e){e===!1&&(this._expanded=!1,this.conversions.splice(1,this.conversions.length-1)),this._set("multipleConversions",e)}get multipleConversions(){const e=this._get("multipleConversions");return typeof e!="boolean"||e}get locationSymbol(){return this.viewModel.locationSymbol}set locationSymbol(e){this.viewModel.locationSymbol=e}get storageEnabled(){return this.viewModel.storageEnabled}set storageEnabled(e){this.viewModel.storageEnabled=e}get storageType(){return this.viewModel.storageType}set storageType(e){this.viewModel.storageType=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...uxe,...e}}reverseConvert(e,i){return this.viewModel.reverseConvert(e,i)}render(){var c,f;const e=(c=this.viewModel)==null?void 0:c.state,i=e==="disabled"?X("div",{key:"esri-coordinate__no-basemap"},(f=this.messages)==null?void 0:f.noBasemap):null,r=!i&&this._inputVisible?this._renderInputForm():null,n=!i&&this._settingsVisible?this._renderSettings():null,s=i||r||n?null:this._renderConversionsView(),o=this._popupVisible?this._renderPopup():null,l={[Zi.captureMode]:this.mode==="capture",[tt.disabled]:e==="loading",[Zi.noBasemap]:e==="disabled"};return X("div",{class:this.classes(Zi.base,tt.widget,l)},o,i,s,n,r)}_addConversion(e){const i=e.target,r=q8(i.options[i.options.selectedIndex]),n=hxe(i);if(r==null||n==null)return;const s=new BS({format:r});i.options.selectedIndex=0,n>=0?(this.conversions.removeAt(n),this.conversions.add(s,n)):this.conversions.add(s)}_findSettingsFormat(){return this._settingsFormat||this.conversions.reduceRight((e,i)=>{const r=i.format;return r!=null&&r.hasDisplayProperties?r:e},null)||this.formats.find(e=>e.hasDisplayProperties)}_hidePopup(){this._popupTimeoutId&&(clearTimeout(this._popupTimeoutId),this._popupTimeoutId=void 0),this._popupVisible=!1,this._popupMessage=null,this.scheduleRender()}_hideClipboardPopup(){this._clipboardPopupTimeoutId&&(clearTimeout(this._clipboardPopupTimeoutId),this._clipboardPopupTimeoutId=void 0),this._clipboardPopupVisible=!1,this.scheduleRender()}_onConvertComplete(){this._inputVisible=!1,this._coordinateInput.value=""}_onCopy(e){var r,n;const i=(r=wUt(e.currentTarget))==null?void 0:r.displayCoordinate;i!=null&&((n=e.clipboardData)==null||n.setData("text/plain",i),this._showClipboardPopup(),e.preventDefault())}_processUserInput(e){const i=Sf(e),r=this.viewModel;if(i!=="Enter"&&i)this._badInput&&(this._badInput=!1);else{const n=q8(this._coordinateInput);if(!n)return;const s=this._coordinateInput.value;this._reverseConvert(s,n).then(o=>{this.mode==="capture"?r.resume():this.mode="capture",this.currentLocation=o,r.setLocation(o),this._onConvertComplete()}).catch(o=>{var l;Ce.getLogger(this).error(o),this._showPopup((l=this.messages)==null?void 0:l.invalidCoordinate),this._badInput=!0})}}async _reverseConvert(e,i){const r=this.viewModel,n=await i.reverseConvert(e);return this._goToEnabled&&n&&r.goToLocation(n).catch(s=>{var o;Ce.getLogger(this).warn(s),this._showPopup((o=this.messages)==null?void 0:o.locationOffBasemap)}),n}_setInputFormat(e){const i=e.target,r=q8(i[i.options.selectedIndex]);r!=null&&(this._conversionFormat=r)}_setPreviewConversion(){var r,n;const e=this._findSettingsFormat(),i=this.viewModel;if(e){const s=this.conversions.find(o=>o.format===e);this._previewConversion=new BS({format:e,position:{location:this.currentLocation,coordinate:(r=s==null?void 0:s.position)==null?void 0:r.coordinate}}),(n=this._previewConversion.position)!=null&&n.coordinate||i.previewConversion(this._previewConversion)}}_setSettingsFormat(e){const i=e.target,r=q8(i[i.options.selectedIndex]);r!=null&&(this._settingsFormat=r,this._setPreviewConversion())}_showClipboardPopup(){this._clipboardPopupVisible?clearTimeout(this._clipboardPopupTimeoutId):this._clipboardPopupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hideClipboardPopup()},_Ut)}_showPopup(e,i=bUt){this._popupMessage=e,this._popupVisible?clearTimeout(this._popupTimeoutId):this._popupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hidePopup()},i)}_toggleGoTo(){this._goToEnabled=!this._goToEnabled}_updateCurrentPattern(e){e.stopPropagation();const i=e.target,r=this._findSettingsFormat();r&&(r.currentPattern=i.value)}_renderConversion(e,i){const{messages:r}=this;if(!r)return X("li",null);const{format:n}=e,s=(n==null?void 0:n.label)??"",o=`${this.id}__list-item-${i}`,l=`${s} ${r.conversionOutputSuffix}`,c=i===0,f=c||this._expanded,_=c?this._renderFirstConversion(e):this._renderTools(i,e,o),x=c&&!e.displayCoordinate?r.noLocation:e.displayCoordinate,T=X("div",{"aria-label":x,class:Zi.coordDisplay,"data-conversion":e,role:"listitem",tabIndex:0,title:x??""},x),A=this._renderOptions(this.formats.filter(M=>M!==n));return f?X("li",{"aria-label":l,class:Zi.conversionRow,id:o,key:e,role:"group",tabIndex:0,title:l},X("select",{"aria-controls":o,"aria-label":r.selectFormat,bind:this,class:this.classes(tt.select,Zi.rowSelect),"data-index":i,onchange:this._addConversion,title:r.selectFormat},X("option",{"aria-label":s,selected:!0,title:s},s.toUpperCase()),A),T,_):null}_renderCopyButton(e){const i=this._clipboardPopupVisible&&this._renderClipboardPopup(),{messagesCommon:r}=this;return r?X("li",{"aria-label":r.copy,bind:this,class:this.classes(tt.widgetButton,Zi.rowButton),"data-conversion":e,onclick:this._copyCoordinateOutput,oncopy:this._onCopy,onkeydown:this._copyCoordinateOutput,role:"button",tabIndex:0,title:r.copy},i,X("span",{"aria-hidden":"true",class:si.duplicate})):X("li",null)}_renderFirstConversion(e){const i=this.id,r={[si.down]:!this._expanded,[si.up]:this._expanded},{messages:n,messagesCommon:s,multipleConversions:o,visibleElements:l}=this;if(!s||!n)return X("ul",null);const c=this.mode==="live"?n.captureMode:n.liveMode,f=this._expanded?s.collapse:s.expand,_=e.displayCoordinate&&this.mode==="capture"?this._renderCopyButton(e):null,x=o&&l.expandButton&&X("li",{"aria-controls":`${i}__${Zi.conversionList}`,"aria-label":f,bind:this,class:tt.widgetButton,key:"esri-coordinate-conversion__expand-button",onclick:this._toggleExpand,onkeydown:this._toggleExpand,role:"button",tabIndex:0,title:f},X("span",{"aria-hidden":"true",class:this.classes(r)})),T=!o&&l.captureButton&&X("li",{"aria-label":c,bind:this,class:this.classes(tt.widgetButton,Zi.modeToggle),key:"esri-coordinate-conversion__mode-toggle",onclick:this._toggleMode,onkeydown:this._toggleMode,role:"button",tabIndex:0,title:c},X("span",{"aria-hidden":"true",class:si.mapPin}));return X("ul",{class:Zi.toolDisplay},_,x,T)}_renderInputForm(){const e=this._conversionFormat||this.conversions.at(0).format,i=this.formats.findIndex(x=>x.name===(e==null?void 0:e.name)),r=this.id,n=`${r}__${Zi.coordinateInput}`,s=`${r}__${Zi.coordinateInput}__header`,o=this._renderOptions(this.formats,!0,i),l={[Zi.rejectInput]:this._badInput},{messages:c,messagesCommon:f,headingLevel:_}=this;return f&&c?X("div",{"aria-labelledby":s,class:Zi.inputForm,key:"esri-coordinate-conversion__input-form",role:"search"},X("div",{class:Zi.sectionHeading},X("div",{"aria-label":f.back,bind:this,class:this.classes(tt.widgetButton,Zi.backButton),onclick:this._toggleInputVisibility,onkeydown:this._toggleInputVisibility,role:"button",tabIndex:0,title:f.back},this._renderBackIcon()),X(Im,{class:tt.heading,id:s,level:_},c.inputCoordTitle)),X("div",{class:Zi.inputFormGroup},X("select",{"aria-controls":n,"aria-label":c.selectFormat,bind:this,class:this.classes(tt.select,Zi.rowSelect),onchange:this._setInputFormat,title:c.selectFormat},o),X("input",{afterCreate:Vv,"aria-labelledby":s,"aria-required":"true",bind:this,class:this.classes(Zi.coordinateInput,tt.input,l),"data-format":e,"data-node-ref":"_coordinateInput",id:n,onkeydown:this._processUserInput,placeholder:c.inputCoordTitle,role:"textbox",spellcheck:!1,title:c.inputCoordTitle,type:"text"})),X("div",{class:Zi.inputFormGroup},X("label",{"aria-label":c.goTo},X("input",{bind:this,checked:this._goToEnabled,onclick:this._toggleGoTo,title:c.goTo,type:"checkbox"}),c.goTo),X("button",{"aria-label":c.convert,bind:this,class:this.classes(Zi.convertButton,tt.button),onclick:this._processUserInput,title:c.convert,type:"button"},X("span",{class:Zi.convertButtonSpan},c.convert)))):X("div",null)}_renderConversionsView(){const{messages:e}=this;if(!e)return X("div",null);const i=`${this.id}__${Zi.conversionList}`,r=this._renderPrimaryTools(),n=this._renderOptions(this.formats),s=this.conversions.map((c,f)=>this._renderConversion(c,f)).toArray(),o=this._expanded?X("div",{class:Zi.conversionRow},X("select",{"aria-controls":i,"aria-label":e.addConversion,bind:this,class:this.classes(tt.select,Zi.primarySelect),"data-index":-1,onchange:this._addConversion,title:e.addConversion},X("option",{disabled:!0,selected:!0,value:""},e.addConversion),n),r):null,l={[Zi.expanded]:this._expanded,[Zi.expandUp]:this.orientation==="expand-up",[Zi.expandDown]:this.orientation==="expand-down"};return X("div",{class:this.classes(Zi.conversionsView,l),key:"esri-coordinate-conversion__main-view"},X("ul",{"aria-expanded":this._expanded?"true":"false",class:Zi.conversionList,id:i},s),o)}_renderOptions(e,i,r){var o;const n=this.conversions.at(0),s=(o=n.format)==null?void 0:o.name;return e.map((l,c)=>{const f=!(i||!n)&&(s===l.name||this.conversions.map(_=>{var x;return(x=_.format)==null?void 0:x.name}).includes(l.name));return X("option",{"aria-label":l.label,"data-format":l,disabled:f,key:l.name??"unnamed-format",selected:c===r,value:l.label},l.label.toUpperCase())}).toArray()}_renderPopup(){return X("div",{class:Zi.popup,role:"alert"},this._popupMessage)}_renderClipboardPopup(){const{messages:e}=this;return e?X("div",{class:this.classes(Zi.popup,Zi.clipboardPopup),role:"alert"},e.copySuccessMessage):X("div",null)}_renderPrimaryTools(){const{messages:e,visibleElements:i}=this;if(!e)return X("ul",null);const r=this.mode==="live"?e.captureMode:e.liveMode,n=i.inputButton&&X("li",{bind:this,class:tt.widgetButton,onclick:this._toggleInputVisibility,onkeydown:this._toggleInputVisibility,role:"button",tabIndex:0,title:e.inputCoordTitle},X("span",{"aria-hidden":"true",class:si.edit})),s=i.captureButton&&X("li",{bind:this,class:this.classes(tt.widgetButton,Zi.modeToggle),onclick:this._toggleMode,onkeydown:this._toggleMode,role:"button",tabIndex:0,title:r},X("span",{"aria-hidden":"true",class:si.mapPin})),o=i.settingsButton&&X("li",{bind:this,class:tt.widgetButton,onclick:this._toggleSettingsVisibility,onkeydown:this._toggleSettingsVisibility,role:"button",tabIndex:0,title:e.settingsTitle},X("span",{"aria-hidden":"true",class:si.settings2}));return X("ul",{class:Zi.toolDisplay},n,s,o)}_renderSettings(){var A;const e=this.id,i=`${e}__${Zi.patternInput}`,r=`${e}__${Zi.patternInput}__header`,n=`${e}__${Zi.previewCoordinate}`,s=this.formats.filter(M=>M.hasDisplayProperties),o=this._findSettingsFormat(),l=o?s.indexOf(o):-1,c=this._renderOptions(s,!0,l),f=o==null?void 0:o.currentPattern,{messages:_,messagesCommon:x,headingLevel:T}=this;return x&&_?X("div",{"aria-labelledby":r,class:Zi.settings,key:Zi.settings},X("div",{class:Zi.sectionHeading},X("div",{bind:this,class:this.classes(tt.widgetButton,Zi.backButton),onclick:this._toggleSettingsVisibility,onkeydown:this._toggleSettingsVisibility,role:"button",tabIndex:0,title:x.back},this._renderBackIcon()),X(Im,{class:tt.heading,id:r,level:T},_.settingsTitle)),X("div",{class:Zi.settingsFormGroup},X("label",{for:i},_.changeCoordinateDisplay),X("select",{"aria-label":_.selectFormat,bind:this,class:tt.select,onchange:this._setSettingsFormat,title:_.selectFormat},c),X("div",{class:Zi.settingsFormGroupHorizontal},X("input",{"aria-controls":n,bind:this,class:this.classes(Zi.patternInput,tt.input),id:i,oninput:this._updateCurrentPattern,spellcheck:!1,title:_.changeCoordinateDisplay,type:"text",value:f}),X("div",{"aria-controls":i,bind:this,class:tt.widgetButton,onclick:this._setDefaultPattern,onkeydown:this._setDefaultPattern,role:"button",tabIndex:0,title:_.defaultPattern},X("span",{"aria-hidden":"true",class:si.refresh})))),X("div",{class:Zi.settingsFormGroup},X("label",null,x.preview,X("div",{class:Zi.previewCoordinate,id:n,tabIndex:0},(A=this._previewConversion)==null?void 0:A.displayCoordinate)))):X("div",null)}_renderBackIcon(){return X("span",{"aria-hidden":"true",class:RT(this.container)?si.rightArrow:si.leftArrows})}_renderTools(e,i,r){const n=i.displayCoordinate&&this.mode==="capture"?this._renderCopyButton(i):null,{messages:s}=this;return s?X("ul",{class:Zi.toolDisplay,role:"listitem"},n,X("li",{"aria-controls":r,"aria-label":s.removeConversion,bind:this,class:this.classes(tt.widgetButton,Zi.rowButton),"data-index":e,key:`${r}__${tt.widgetButton}`,onclick:this._removeConversion,onkeydown:this._removeConversion,role:"button",tabIndex:0,title:s.removeConversion},X("span",{"aria-hidden":"true",class:si.close}))):X("ul",null)}_copyCoordinateOutput(e){const i=e.target;if(!("createTextRange"in document.body)){const r=window.getSelection(),n=document.createRange();n.selectNodeContents(i),r==null||r.removeAllRanges(),r==null||r.addRange(n)}document.execCommand("copy")}_removeConversion(e){const i=hxe(e.currentTarget);i!=null&&this.conversions.removeAt(i)}_setDefaultPattern(e){e.stopPropagation();const i=this._findSettingsFormat();i&&(i.currentPattern=i.defaultPattern)}_toggleExpand(){this._expanded=!this._expanded}_toggleInputVisibility(){this._inputVisible=!this._inputVisible,this._popupVisible&&this._hidePopup(),this._inputVisible?this.viewModel.pause():this.viewModel.resume()}_toggleMode(){this.mode=this.mode==="live"?"capture":"live"}_toggleSettingsVisibility(){this._settingsVisible=!this._settingsVisible,this._popupVisible&&this._hidePopup(),this._settingsVisible?(this._setPreviewConversion(),this.viewModel.pause()):this.viewModel.resume()}};function hxe(t){return t["data-index"]}function q8(t){return t["data-format"]}function wUt(t){return t["data-conversion"]}y([w()],xs.prototype,"conversions",null),y([w()],xs.prototype,"currentLocation",null),y([w()],xs.prototype,"formats",null),y([w()],xs.prototype,"goToOverride",null),y([w()],xs.prototype,"headingLevel",void 0),y([w()],xs.prototype,"label",null),y([w(),Gr("esri/widgets/CoordinateConversion/t9n/CoordinateConversion")],xs.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],xs.prototype,"messagesCommon",void 0),y([w()],xs.prototype,"mode",null),y([w()],xs.prototype,"orientation",void 0),y([w()],xs.prototype,"multipleConversions",null),y([w()],xs.prototype,"locationSymbol",null),y([w()],xs.prototype,"storageEnabled",null),y([w()],xs.prototype,"storageType",null),y([w()],xs.prototype,"view",null),y([w({type:cVe})],xs.prototype,"viewModel",void 0),y([w()],xs.prototype,"visibleElements",void 0),y([Ci("visibleElements")],xs.prototype,"castVisibleElements",null),y([bo()],xs.prototype,"_copyCoordinateOutput",null),y([bo()],xs.prototype,"_removeConversion",null),y([bo()],xs.prototype,"_setDefaultPattern",null),y([bo()],xs.prototype,"_toggleExpand",null),y([bo()],xs.prototype,"_toggleInputVisibility",null),y([bo()],xs.prototype,"_toggleMode",null),y([bo()],xs.prototype,"_toggleSettingsVisibility",null),xs=y([Z("esri.widgets.CoordinateConversion")],xs);const xUt=xs,xX=/-?\d+[\.]?\d*/,SUt=t=>new xUt({view:t}),TUt=()=>new av({name:"XYZ",conversionInfo:{convert:function(t){const e=t,i=e.x.toFixed(2),r=e.y.toFixed(2),n=e.z.toFixed(2);return{location:e,coordinate:`${i}, ${r}, ${n}`}},reverseConvert:function(t){const e=t.split(",");return new mt({x:parseFloat(e[0]),y:parseFloat(e[1]),z:parseFloat(e[2]),spatialReference:{wkid:3301}})}},coordinateSegments:[{alias:"X",description:"Longitude",searchPattern:xX},{alias:"Y",description:"Latitude",searchPattern:xX},{alias:"Z",description:"Elevation",searchPattern:xX}],defaultPattern:"X, Y, Z"});let EUt=0,lv=class extends P_(Xs(I_(ze))){constructor(e){super(e),this.id=`${Date.now().toString(16)}-analysis-${EUt++}`,this.title=null}get parent(){return this._get("parent")}set parent(e){const i=this.parent;if(i!=null)switch(i.type){case"line-of-sight":case"dimension":i.releaseAnalysis(this);break;case"2d":case"3d":i.analyses.includes(this)&&i.analyses.remove(this)}this._set("parent",e)}get isEditable(){return this.requiredPropertiesForEditing.every(ys)}};y([w({type:String,constructOnly:!0,clonable:!1})],lv.prototype,"id",void 0),y([w({type:String})],lv.prototype,"title",void 0),y([w({constructOnly:!0})],lv.prototype,"type",void 0),y([w({clonable:!1,value:null})],lv.prototype,"parent",null),y([w({readOnly:!0})],lv.prototype,"isEditable",null),y([w({readOnly:!0})],lv.prototype,"requiredPropertiesForEditing",void 0),lv=y([Z("esri.analysis.Analysis")],lv);const uVe=lv;function hVe(t,e){return dxe(t)===dxe(e)}function dxe(t){if(t==null)return null;const e=t.layer!=null?t.layer.id:"";let i=null;return i=t.objectId!=null?t.objectId:t.layer!=null&&"objectIdField"in t.layer&&t.layer.objectIdField!=null&&t.attributes!=null?t.attributes[t.layer.objectIdField]:t.uid,i==null?null:`o-${e}-${i}`}const dVe={json:{write:{writer:CUt,target:{"feature.layerId":{type:[Number,String]},"feature.objectId":{type:[Number,String]}}},origins:{"web-scene":{read:AUt}}}};function CUt(t,e){var i;((i=t==null?void 0:t.layer)==null?void 0:i.objectIdField)!=null&&t.attributes!=null&&(e.feature={layerId:t.layer.id,objectId:t.attributes[t.layer.objectIdField]})}function AUt(t){if(t.layerId!=null&&t.objectId!=null)return{uid:null,layer:{id:t.layerId,objectIdField:"ObjectId"},attributes:{ObjectId:t.objectId}}}let lM=class extends P_(Xs(ze)){constructor(e){super(e),this.position=null,this.elevationInfo=null,this.feature=null}equals(e){return FO(this.position,e.position)&&FO(this.elevationInfo,e.elevationInfo)&&hVe(this.feature,e.feature)}};y([w({type:mt,json:{write:{isRequired:!0}}})],lM.prototype,"position",void 0),y([w({type:BB}),Dv()],lM.prototype,"elevationInfo",void 0),y([w(dVe)],lM.prototype,"feature",void 0),lM=y([Z("esri.analysis.LineOfSightAnalysisObserver")],lM);const pVe=lM;let cM=class extends P_(QZ){constructor(e){super(e),this.position=null,this.elevationInfo=null,this.feature=null}equals(e){return FO(this.position,e.position)&&FO(this.elevationInfo,e.elevationInfo)&&hVe(this.feature,e.feature)}};y([w({type:mt}),Dv()],cM.prototype,"position",void 0),y([w({type:BB}),Dv()],cM.prototype,"elevationInfo",void 0),y([w(dVe)],cM.prototype,"feature",void 0),cM=y([Z("esri.analysis.LineOfSightAnalysisTarget")],cM);const fVe=cM,xre=it.ofType(fVe);let cv=class extends uVe{constructor(e){super(e),this.type="line-of-sight",this.observer=null,this.extent=null}initialize(){this.addHandles(_e(()=>this._computeExtent(),e=>{(e==null?void 0:e.pending)==null&&this._set("extent",e!=null?e.extent:null)},kt))}get targets(){return this._get("targets")||new xre}set targets(e){this._set("targets",sd(e,this.targets,xre))}get spatialReference(){var e;return((e=this.observer)==null?void 0:e.position)!=null?this.observer.position.spatialReference:null}get requiredPropertiesForEditing(){var e;return[(e=this.observer)==null?void 0:e.position]}async waitComputeExtent(){const e=this._computeExtent();return e!=null?e.pending:Promise.resolve()}_computeExtent(){var o;const e=this.spatialReference;if(((o=this.observer)==null?void 0:o.position)==null||e==null)return null;const i=l=>xoe(l.position,l.elevationInfo)==="absolute-height",r=this.observer.position,n=P2(r.x,r.y,r.z,r.x,r.y,r.z);for(const l of this.targets)if(l.position!=null){const c=$5e(l.position,e);if(c.pending!=null)return{pending:c.pending,extent:null};if(c.geometry!=null){const{x:f,y:_,z:x}=c.geometry;qf(n,[f,_,x])}}const s=Trt(n,e);return i(this.observer)&&this.targets.every(i)||(s.zmin=void 0,s.zmax=void 0),{pending:null,extent:s}}clear(){this.observer=null,this.targets.removeAll()}};y([w({type:["line-of-sight"]})],cv.prototype,"type",void 0),y([w({type:pVe,json:{read:!0,write:!0}})],cv.prototype,"observer",void 0),y([w({cast:nP,type:xre,nonNullable:!0,json:{read:!0,write:!0}})],cv.prototype,"targets",null),y([w({value:null,readOnly:!0})],cv.prototype,"extent",void 0),y([w({readOnly:!0})],cv.prototype,"spatialReference",null),y([w({readOnly:!0})],cv.prototype,"requiredPropertiesForEditing",null),cv=y([Z("esri.analysis.LineOfSightAnalysis")],cv);const mVe=cv;let pS=class extends ze{constructor(e){super(e),this.location=null,this.intersectedLocation=null,this.intersectedGraphic=null,this.visible=void 0}};y([w({type:mt})],pS.prototype,"location",void 0),y([w({type:mt})],pS.prototype,"intersectedLocation",void 0),y([w({type:Ml})],pS.prototype,"intersectedGraphic",void 0),y([w({type:Boolean})],pS.prototype,"visible",void 0),pS=y([Z("esri.widgets.lineOfSight.LineOfSightTarget")],pS);const gVe=pS;var RO;(function(t){t[t.PENDING=0]="PENDING",t[t.WAIT_FOR_VIEW_READY=1]="WAIT_FOR_VIEW_READY",t[t.RUNNING=2]="RUNNING"})(RO||(RO={}));let hc=class extends ze{constructor(e={}){super(e),this.view=null,this.analysisView=null,this._reconnectViewTask=null,this._forceInteractiveHandle=null,this._parentChangeFromReconnect=!1,this._startUserOperation=null,this.logger=Ce.getLogger(this);const i=e==null?void 0:e.analysis;i!=null?this.analysis=i:(this._set("analysis",this.constructAnalysis()),this._set("isAnalysisOwner",!0)),(e==null?void 0:e.visible)!=null&&(this.visible=e.visible)}normalizeCtorArgs(e){const{analysis:i,...r}=e;return r}initialize(){this.addHandles([_e(()=>({readyAndNotSupported:this.view!=null&&this.view.ready&&!this.supported}),({readyAndNotSupported:e})=>{e&&this.logger.errorOnce(this.unsupportedErrorMessage)},kt),_e(()=>{var e;return(e=this.analysis)==null?void 0:e.parent},e=>{this._parentChangeFromReconnect||e===this.view||this._set("isAnalysisOwner",!1);const i=!this._parentChangeFromReconnect;this._parentChangeFromReconnect=!1,i&&this._scheduleViewReconnect()},Li),_e(()=>({view:this.view,ready:this.view!=null&&this.view.ready,supported:this.supported}),({view:e},i)=>{const r=i==null?void 0:i.view;e!==r&&(this._startUserOperation=gn(this._startUserOperation),this._disconnectFromView(r)),this._scheduleViewReconnect()},kt)])}destroy(){this._reconnectViewTask=gn(this._reconnectViewTask),this._startUserOperation=gn(this._startUserOperation),this.analysisView!=null&&(this.analysisView.visible=void 0),this._disconnectFromView(this.view),this._set("view",null),this.analysis!=null&&this.isAnalysisOwner&&(this.analysis.destroy(),this._set("analysis",null))}get supported(){return this.view==null||this.view.type===this.supportedViewType}set visible(e){this._set("visible",e),this.analysisView!=null&&(this.analysisView.visible=e)}get active(){return this.tool!=null&&this.tool.active}get disabled(){return this.view==null||!this.view.ready||!this.supported}set analysis(e){e!==this._get("analysis")&&(this._startUserOperation=gn(this._startUserOperation),this._disconnectFromView(this.view),this._setExternalAnalysis(e),this._scheduleViewReconnect())}get ready(){return this.analysisView!=null&&!this.connectingToView}get connectingToView(){return this._reconnectViewTask!=null}get isAnalysisOwner(){return this._get("isAnalysisOwner")}get tool(){return this.analysisView!=null?this.analysisView.tool:null}clear(){this._startUserOperation=gn(this._startUserOperation),this._resetInteractiveCreationState(),this.tool!=null&&this.view!=null&&this.view.activeTool===this.tool&&(this.view.activeTool=null)}async start(){this.clear();const e={task:null,abort:null,state:RO.PENDING},i=Cc(async r=>{if(e.state=RO.WAIT_FOR_VIEW_READY,await rd(()=>this.ready,r),e.state=RO.RUNNING,this.analysisView==null||this.view==null)return;const n=this.analysisView.tool;n!=null&&(this.view.activeTool=n,Mo(()=>n.created,()=>{n.active&&this.view!=null&&(this.view.activeTool=null)},{initial:!0,once:!0}))});return e.task=i,e.abort=()=>i.abort(),this._startUserOperation=e,i.promise}onConnectToAnalysisView(e){}onDisconnectFromAnalysisView(){}_scheduleViewReconnect(){this._reconnectViewTask=gn(this._reconnectViewTask);const e=Cc(async i=>{try{await this._reconnectView(i)}catch(r){if(St(i),!sn(r))return void this.logger.warn("Failed to use analysis in view model",r);throw r}finally{e===this._reconnectViewTask&&(this._reconnectViewTask=null)}});this._reconnectViewTask=e}async _reconnectView(e){const{view:i}=this,r=i!=null&&i.ready&&this.supported,n=this.analysis;if(this._startUserOperation=pxe(this._startUserOperation),this._disconnectFromView(i),r&&i!=null&&n!=null){if(this.isAnalysisOwner){if(n.parent!=null)return void this.logger.errorOnce("expected owned analysis to have null parent when connecting to view");this._parentChangeFromReconnect=!0,i.analyses.add(n)}this.analysisView=await i.whenAnalysisView(n),xo(e)?this._startUserOperation=pxe(this._startUserOperation):(this.analysisView.visible=this.visible,this._forceInteractiveHandle=this.analysisView.forceInteractiveForViewModel(),this.addHandles(this._forceInteractiveHandle),this.onConnectToAnalysisView(this.analysisView))}}_disconnectFromView(e){e!=null&&this.isAnalysisOwner&&e.analyses.includes(this.analysis)&&(this._parentChangeFromReconnect=!0,this.analysis.clear(),e.analyses.remove(this.analysis)),this.onDisconnectFromAnalysisView(),this._forceInteractiveHandle=en(this._forceInteractiveHandle),this.analysisView=null}_setExternalAnalysis(e){this.analysisView==null||this.isAnalysisOwner||(this.analysisView.visible=void 0,this._forceInteractiveHandle=en(this._forceInteractiveHandle)),this.analysisView=null,this._set("isAnalysisOwner",!1),this._set("analysis",e),this._parentChangeFromReconnect=!1}_resetInteractiveCreationState(){this.analysis.clear(),this.tool!=null&&this.tool.resetCreated()}get testInfo(){return{analysisView:this.analysisView}}};function pxe(t){return t!=null&&t.state>=RO.RUNNING?(t.abort(),null):t}y([w()],hc.prototype,"supported",null),y([w()],hc.prototype,"view",void 0),y([w({type:Boolean,value:!0})],hc.prototype,"visible",null),y([w()],hc.prototype,"active",null),y([w()],hc.prototype,"disabled",null),y([w({nonNullable:!0})],hc.prototype,"analysis",null),y([w()],hc.prototype,"analysisView",void 0),y([w()],hc.prototype,"ready",null),y([w()],hc.prototype,"connectingToView",null),y([w({readOnly:!0})],hc.prototype,"isAnalysisOwner",null),y([w()],hc.prototype,"_reconnectViewTask",void 0),y([w()],hc.prototype,"_forceInteractiveHandle",void 0),y([w()],hc.prototype,"tool",null),hc=y([Z("esri.widgets.support.AnalysisViewModel")],hc);const Sre=it.ofType(gVe);let fS=class extends hc{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="LineOfSightViewModel is only supported in 3D views.",this._vmTargetsToConnection=new Map,this._analysisTargetsToConnection=new Map}initialize(){this.addHandles([this.targets.on("after-add",e=>this._onViewModelTargetAdded(e.item)),this.targets.on("after-remove",e=>this._onViewModelTargetRemoved(e.item)),_e(()=>this.analysis,e=>this._onAnalysisChange(e),kt)])}destroy(){this._analysisTargetsToConnection.forEach(e=>e.remove())}get state(){return this.disabled||!this.ready?"disabled":this.tool==null?"ready":this.tool.state}get observer(){const{observer:e}=this.analysis;return(e==null?void 0:e.position)==null?null:this._convertAnalysisPointToAbsoluteHeight(e.position,e.elevationInfo)}set observer(e){let i=null;e&&(i=e.clone(),i.hasZ||(i.z=0)),this.analysis.observer=new pVe({position:i})}get targets(){return this._get("targets")||new Sre}set targets(e){this._set("targets",sd(e,this.targets,Sre))}continue(){this.tool!=null&&this.tool.continue()}stop(){this.tool!=null&&this.tool.stop()}get testInfo(){return{analysisView:this.analysisView,getAnalysisTargetFromViewModelTarget:e=>{var i;return(i=this._vmTargetsToConnection.get(e))==null?void 0:i.analysisTarget}}}constructAnalysis(){return new mVe}async onConnectToAnalysisView(e){this.addHandles([e.on("result-changed",i=>{const r=this._analysisTargetsToConnection.get(i.target);r&&(i.result!=null?(r.viewModelTarget.intersectedGraphic=i.result.intersectedGraphic,r.viewModelTarget.intersectedLocation=i.result.intersectedLocation,r.viewModelTarget.visible=i.result.visible):(r.viewModelTarget.intersectedGraphic=null,r.viewModelTarget.intersectedLocation=null,r.viewModelTarget.visible=void 0))})],"view")}onDisconnectFromAnalysisView(){this.removeHandles("view")}_onViewModelTargetAdded(e){if(this._vmTargetsToConnection.get(e))return;const i=new fVe({position:e.location});this._connectViewModelWithAnalysisTarget(e,i),this.analysis.targets.add(i)}_onViewModelTargetRemoved(e){const i=this._vmTargetsToConnection.get(e);i&&(i.remove(),this.analysis.targets.remove(i.analysisTarget))}_onAnalysisTargetAdded(e){if(this._analysisTargetsToConnection.get(e))return;const{position:i}=e,r=new gVe({location:i?this._convertAnalysisPointToAbsoluteHeight(i,e.elevationInfo):null});this._connectViewModelWithAnalysisTarget(r,e),this.targets.add(r)}_onAnalysisTargetRemoved(e){const i=this._analysisTargetsToConnection.get(e);i&&(i.remove(),this.targets.remove(i.viewModelTarget))}_connectViewModelWithAnalysisTarget(e,i){let r=!1;const n=id([_e(()=>({position:i.position,elevationInfo:i.elevationInfo}),({position:o,elevationInfo:l})=>{r||(r=!0,e.location=o?this._convertAnalysisPointToAbsoluteHeight(o,l):null,r=!1)},Li),_e(()=>e.location,o=>{if(!r){r=!0;let l=null;o&&(l=o.clone(),l.hasZ||(l.z=0)),i.position=l,i.elevationInfo=null,r=!1}},Li)]),s={analysisTarget:i,viewModelTarget:e,remove:()=>{n.remove(),this._vmTargetsToConnection.delete(e),this._analysisTargetsToConnection.delete(i)}};this._vmTargetsToConnection.set(e,s),this._analysisTargetsToConnection.set(i,s)}_onAnalysisChange(e){const i="analysis";this.removeHandles(i),this.addHandles([this.analysis.targets.on("after-add",r=>this._onAnalysisTargetAdded(r.item)),this.analysis.targets.on("after-remove",r=>this._onAnalysisTargetRemoved(r.item))],i),this.targets.removeAll(),e.targets.forEach(r=>{this._onAnalysisTargetAdded(r)})}_convertAnalysisPointToAbsoluteHeight(e,i){const r=e.clone();if(this.view!=null){const n=vPe(e.hasZ,i);r.z=bPe(this.view,e,n,ma)}return r}};y([w({type:mVe})],fS.prototype,"analysis",void 0),y([w({readOnly:!0})],fS.prototype,"state",null),y([w()],fS.prototype,"observer",null),y([w({type:Sre,cast:nP,nonNullable:!0})],fS.prototype,"targets",null),fS=y([Z("esri.widgets.lineOfSight.LineOfSightViewModel")],fS);const yVe=fS,sy="esri-line-of-sight",Nb={base:sy,actions:`${sy}__actions`,container:`${sy}__container`,error:`${sy}__error`,hint:`${sy}__hint`,hintText:`${sy}__hint-text`,newAnalysisButton:`${sy}__new-analysis-button`,widgetIcon:si.lineOfSight},W8={newAnalysisButton:`${sy}__new-button`,continueButton:`${sy}__continue-button`,doneButton:`${sy}__done-button`};let ef=class extends cn{constructor(e,i){super(e,i),this.iconClass=Nb.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new yVe,this._onNewAnalysis=()=>{$m(this.viewModel.start())},this._onDone=()=>{this.viewModel.stop()},this._onContinue=()=>{this.viewModel.continue()}}loadDependencies(){return Pl({button:()=>we(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([234,235,236,237,238,239,240,241,242,243,244,245,246,247]))})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){return X("div",{class:this.classes(Nb.base,tt.widget,tt.panel),role:"presentation"},this._renderContainerNode())}_renderContainerNode(){if(!this.visible)return null;if(!this.viewModel.supported)return this._renderUnsupportedMessage();let e=null;const i=[this._renderNewAnalysisButton()];return this.viewModel.state==="creating"?(e=this._renderHint(),i.unshift(this._renderDoneButton())):this.viewModel.state==="created"&&this.viewModel.targets.length>0&&i.unshift(this._renderContinueButton()),X("div",{class:Nb.container},e,X("div",{class:Nb.actions},i))}_renderUnsupportedMessage(){return X("div",{class:Nb.error,key:"esri-line-of-sight__unsupported"},X("p",null,this.messages.unsupported))}_renderHint(){return X("div",{class:Nb.hint,key:"esri-line-of-sight__hint"},X("p",{class:Nb.hintText},this.messages.hint))}_renderNewAnalysisButton(){return this._renderButton({className:Nb.newAnalysisButton,id:W8.newAnalysisButton,label:this.messages.newAnalysis,onClick:this._onNewAnalysis,primary:!0})}_renderDoneButton(){return this._renderButton({id:W8.doneButton,label:this.messages.done,onClick:this._onDone,primary:!1})}_renderContinueButton(){return this._renderButton({id:W8.newAnalysisButton,label:this.messages.continueAnalysis,onClick:this._onContinue,primary:!1})}_renderButton({className:e,id:i,label:r,onClick:n,primary:s}){const o=this.viewModel.state==="disabled";return X("calcite-button",{appearance:s?"solid":"outline-fill",class:e,"data-id":i,disabled:o,key:i,onclick:n},r)}get test(){return{IDS:W8}}};y([w()],ef.prototype,"active",null),y([w({constructOnly:!0,nonNullable:!0})],ef.prototype,"analysis",null),y([w()],ef.prototype,"iconClass",void 0),y([w()],ef.prototype,"icon",void 0),y([w()],ef.prototype,"label",null),y([w(),Gr("esri/widgets/LineOfSight/t9n/LineOfSight")],ef.prototype,"messages",void 0),y([w()],ef.prototype,"view",null),y([w({type:yVe})],ef.prototype,"viewModel",void 0),y([w()],ef.prototype,"visible",null),ef=y([Z("esri.widgets.LineOfSight")],ef);const MUt=ef,OUt=t=>new MUt({view:t,container:"line-of-sight-container"}),PUt=t=>{document.getElementById("LoSstartBtn").addEventListener("click",i=>{const r=document.getElementById("xLOSstart").value,n=document.getElementById("yLOSstart").value,s=document.getElementById("zLoSstart").value;console.log("X-coordinate:",r),console.log("Y-coordinate:",n),console.log("Z-coordinate:",s)})},Ds="esri-search",Kn={base:Ds,widgetIcon:si.search,hasMultipleSources:`${Ds}--multiple-sources`,isLoading:`${Ds}--loading`,isSearching:`${Ds}--searching`,showSuggestions:`${Ds}--show-suggestions`,showSources:`${Ds}--sources`,showWarning:`${Ds}--warning`,container:`${Ds}__container`,input:`${Ds}__input`,inputContainer:`${Ds}__input-container`,form:`${Ds}__form`,submitButton:`${Ds}__submit-button`,sourcesButton:`${Ds}__sources-button`,sourcesButtonDown:`${Ds}__sources-button--down`,sourcesButtonUp:`${Ds}__sources-button--up`,clearButton:`${Ds}__clear-button`,sourceName:`${Ds}__source-name`,suggestionsMenu:`${Ds}__suggestions-menu`,suggestionList:`${Ds}__suggestions-list`,suggestionListCurrentLocation:`${Ds}__suggestions-list--current-location`,sourcesMenu:`${Ds}__sources-menu`,source:`${Ds}__source`,warningMenu:`${Ds}__warning-menu`,warningMenuBody:`${Ds}__warning-body`,warningMenuHeader:`${Ds}__warning-header`,warningMenuText:`${Ds}__warning-text`,noValueText:`${Ds}__no-value-text`},s3="esri-search-result-renderer",o3={base:s3,showMoreResults:`${s3}__more-results--show-more-results`,moreResults:`${s3}__more-results`,moreResultsList:`${s3}__more-results-list`,moreResultsHeader:`${s3}__more-results-header`,moreResultsItem:`${s3}__more-results-item`,moreResultsListHeader:`${s3}__more-results-list-header`};let wa=class extends I_(Ue){constructor(e){super(e),this.autoNavigate=null,this.filter=null,this.getResults=null,this.getSuggestions=null,this.maxResults=null,this.maxSuggestions=null,this.minSuggestCharacters=null,this.outFields=null,this.placeholder="",this.popupEnabled=null,this.popupTemplate=null,this.prefix="",this.resultGraphicEnabled=null,this.resultSymbol=null,this.suggestionsEnabled=null,this.suffix="",this.withinViewEnabled=!1,this.zoomScale=null}};y([w()],wa.prototype,"autoNavigate",void 0),y([w()],wa.prototype,"filter",void 0),y([w()],wa.prototype,"getResults",void 0),y([w()],wa.prototype,"getSuggestions",void 0),y([w()],wa.prototype,"maxResults",void 0),y([w()],wa.prototype,"maxSuggestions",void 0),y([w()],wa.prototype,"minSuggestCharacters",void 0),y([w()],wa.prototype,"outFields",void 0),y([w()],wa.prototype,"placeholder",void 0),y([w()],wa.prototype,"popupEnabled",void 0),y([w()],wa.prototype,"popupTemplate",void 0),y([w()],wa.prototype,"prefix",void 0),y([w()],wa.prototype,"resultGraphicEnabled",void 0),y([w()],wa.prototype,"resultSymbol",void 0),y([w()],wa.prototype,"suggestionsEnabled",void 0),y([w()],wa.prototype,"suffix",void 0),y([w()],wa.prototype,"withinViewEnabled",void 0),y([w()],wa.prototype,"zoomScale",void 0),wa=y([Z("esri.widgets.Search.SearchSource")],wa);const UG=wa,fxe=Ce.getLogger("esri.widgets.Search.support.geometryUtils");function RUt(t,e){var r,n;if(!e)return fxe.error("missing-parameter: view is missing."),Promise.reject(new se("searchgeometryutils:missing-parameter","view is missing."));if(!t)return fxe.error("missing-parameter: point is missing."),Promise.reject(new se("searchgeometryutils:missing-parameter","point is missing."));if(t.hasZ||e.type==="2d")return Promise.resolve(t);const i=(r=e==null?void 0:e.map)==null?void 0:r.ground;return i!=null&&i.layers.length?i.queryElevation(t,{cache:(n=e.basemapTerrain)==null?void 0:n.elevationQueryCache}).then(s=>s.geometry):Promise.resolve(t)}function mxe(t){if(t==null)return null;switch(t.type){case"point":return t;case"extent":return t.center;case"polygon":return t.centroid;case"multipoint":return t.getPoint(0);case"polyline":return t.getPoint(0,0)}return null}function mue(t,e,i){return t==null?null:t.type==="extent"?t:t.type==="multipoint"||t.type==="polygon"||t.type==="polyline"?t.extent:t.type==="point"?vVe(t,e,i):void 0}function Tre(t,e,i){return t==null||e==null?null:vVe(t.center,e,i)}function vVe(t,e,i){const r=t.hasZ?t.z:void 0;return e!=null&&e.map?(i!=null?Pht(e,i):e.extent).clone().centerAt(t).set({zmax:r,zmin:r}):new Vi({xmin:t.x-.25,ymin:t.y-.25,xmax:t.x+.25,ymax:t.y+.25,spatialReference:t.spatialReference,zmin:r,zmax:r})}const IUt=/https?:\/\/services.*\.arcgis\.com/i,$Ut=/(?:\{([^}]+)\})/g,IO=Ce.getLogger("esri.widgets.Search.support.layerSearchUtils");function LUt(t,e){const{exactMatch:i=!1,location:r,maxResults:n,spatialReference:s,source:o,sourceIndex:l,suggestResult:c,view:f}=t,{layer:_,filter:x,zoomScale:T}=o,A=f==null?void 0:f.scale,M=_Ve(o,f),I=e==null?void 0:e.signal;return wVe(_).then(()=>{const L=_.popupTemplate;return L?L.getRequiredFields(_.fieldsIndex):null}).then(L=>{var he,ce,be,ye;const{objectIdField:F,returnZ:z}=_,k=AVe(o);if(!gue(_,k))throw IO.error("invalid-field: displayField is invalid."),new se("getResults():invalid-field","displayField is invalid.");const U=L&&L.length?L:[k],j=o.outFields||U,H=bVe(j);if(j.includes(F)||H||j.push(F),(he=_.floorInfo)!=null&&he.floorField&&j.push(_.floorInfo.floorField),!(H||RV(_,j)))throw IO.error("invalid-field: outField is invalid."),new se("getResults():invalid-field","outField is invalid.");const Y=_.createQuery(),{orderByFields:Q}=o;if(Q&&(Y.orderByFields=Q),s){Y.outSpatialReference=s;const pe=1/ws(s);pe&&(Y.maxAllowableOffset=pe)}const ne=_.geometryType==="mesh"||_.geometryType==="multipatch",re=((be=(ce=_.capabilities)==null?void 0:ce.data)==null?void 0:be.supportsZ)&&!ne;if(Y.returnZ=re&&z!==!1,Y.returnGeometry=!0,Y.multipatchOption=ne?"xyFootprint":null,j&&(Y.outFields=j),r)Y.geometry=r;else if(c.key)Y.objectIds=[c.key];else{const pe=o.searchFields||[k];if(!RV(_,pe))throw IO.error("invalid-field: search field is invalid."),new se("getResults():invalid-field","search field is invalid.");if(CVe(_)&&(Y.num=n),M&&(Y.geometry=M),!((ye=c.text)==null?void 0:ye.trim()))return[];const te=c.text,{prefix:le="",suffix:de=""}=o,ve=MVe(`${le}${te}${de}`);EVe(_)&&SVe(_,pe)&&!i&&te&&(Y.fullText=TVe({text:te,searchFields:pe}));const Se=OVe({searchTerm:ve,layer:_,searchFields:pe,filter:x,exactMatch:i,query:Y,type:"search"});if(Y.where=Se,!xVe(Y))return[]}return _.queryFeatures(Y,{signal:I}).then(pe=>WUt(pe,f,o,l,k,A,T))})}function DUt(t,e){const{source:i,spatialReference:r,view:n,suggestTerm:s,maxSuggestions:o,sourceIndex:l,exactMatch:c}=t,{layer:f,filter:_}=i,x=e==null?void 0:e.signal,T=_Ve(i,n);return wVe(f).then(()=>{if(!CVe(f))return[];const A=AVe(i),M=i.searchFields||[A],I=[];i.suggestionTemplate?i.suggestionTemplate.replaceAll($Ut,(re,he)=>(I.push(he),re)):I.push(A);const L=bVe(I);I.includes(f.objectIdField)||L||I.push(f.objectIdField);const F=gue(f,A),z=L||RV(f,I),k=RV(f,M);if(!F)throw IO.error("invalid-field: displayField is invalid."),new se("getSuggestions():invalid-field","displayField is invalid.");if(!z)throw IO.error("invalid-field: outField is invalid."),new se("getSuggestions():invalid-field","outField is invalid.");if(!k)throw IO.error("invalid-field: search field is invalid."),new se("getSuggestions():invalid-field","search field is invalid.");const U=f.createQuery(),{orderByFields:j}=i;if(j&&(U.orderByFields=j),U.outSpatialReference=r,U.returnGeometry=!1,U.num=o,U.outFields=I,T&&(U.geometry=T),!s.trim())return[];const{prefix:H="",suffix:Y=""}=i,Q=MVe(`${H}${s}${Y}`);EVe(f)&&SVe(f,M)&&!c&&s&&(U.fullText=TVe({text:s,searchFields:M}));const ne=OVe({searchTerm:Q,layer:f,searchFields:M,filter:_,exactMatch:c,query:U,type:"suggest"});return U.where=ne,xVe(U)?f.queryFeatures(U,{signal:x}).then(re=>GUt(re,i,l,A)):[]})}function _Ve(t,e){const{filter:i,withinViewEnabled:r}=t,n=e==null?void 0:e.extent;return(i==null?void 0:i.geometry)??(r&&n?n:void 0)}function bVe(t){return t&&t.includes("*")}async function wVe(t){t&&await t.load()}function xVe(t){return!(!t.fullText&&!t.where)}function SVe(t,e){const i=t==null?void 0:t.indexes;return!i||!(e!=null&&e.length)?!1:i.filter(r=>r.indexType==="FullText").some(r=>{var s;const n=((s=r.fields)==null?void 0:s.split(",").map(o=>o.trim().toLowerCase()))||[];return e.every(o=>n.includes(o.toLowerCase()))})}function TVe({text:t,searchFields:e}){return t.trim().split(" ").filter(i=>!!i.trim()).map(i=>new nPe({onFields:e,searchTerm:i,searchType:"prefix"}))}function EVe(t){var e,i;return((i=(e=t==null?void 0:t.capabilities)==null?void 0:e.query)==null?void 0:i.supportsFullTextSearch)??!1}function CVe(t){var e,i;return((i=(e=t==null?void 0:t.capabilities)==null?void 0:e.query)==null?void 0:i.supportsPagination)??!1}function NUt(t){var e,i,r;return((r=(i=(e=t==null?void 0:t.fieldsIndex)==null?void 0:e.fields)==null?void 0:i.find(n=>n.type==="string"))==null?void 0:r.name)??""}function AVe(t){return t.displayField||t.layer.displayField||NUt(t.layer)}function RV(t,e){return!(!t||!(e!=null&&e.length))&&e.every(i=>gue(t,i))}function gue(t,e){return!!t.getField(e)}function FUt(t){for(let e=0;e255)return!0;return!1}function kUt(t,e,i){let r=null;const{codedValues:n}=t;return n&&n.some(s=>{const o=s.name,l=i?o:o.toLowerCase();return(i?e:e.toLowerCase())===l&&(r=s.code.toString(),!0)}),r}function MVe(t){return t.replaceAll("'","''")}function UR(t,e){const i=e==null?void 0:e.where;return i?`(${t}) AND (${i})`:t}function zUt({currentTerm:t,field:e,filter:i,exactMatch:r,url:n,type:s}){const o=e==null?void 0:e.type,l=e==null?void 0:e.name;if(o==="string"||o==="date"||o==="global-id"){const c=IUt.test(n??""),f=c&&FUt(t)?"N":"";return UR(r&&s==="search"?`${l} = ${f}'${t}'`:c?`${l} LIKE ${f}${`'${t}%'`}`:`${`LOWER(${l})`} LIKE ${f}${`'${t.toLowerCase()}%'`}`,i)}if(o==="oid"||o==="small-integer"||o==="integer"||o==="single"||o==="double"){const c=Number(t);return isNaN(c)?null:UR(`${l} = ${c}`,i)}return UR(`${l} = ${t}`,i)}function UUt(t,e){return t?` OR (${e})`:`(${e})`}function OVe({searchTerm:t,layer:e,searchFields:i,filter:r,exactMatch:n,query:s,type:o}){const{definitionExpression:l,url:c}=e;let f="";return!s.fullText&&t&&i&&i.forEach(_=>{const x=e.getField(_),T=typeof e.getFieldDomain=="function"&&e.getFieldDomain(_),A=(T&&T.type==="coded-value"?kUt(T,t,n):null)||t||null;if(A!==null){const M=zUt({currentTerm:A,field:x,filter:r,exactMatch:n,url:c,type:o});M&&(f+=UUt(f,M))}}),l&&f?`(${l}) AND (${f})`:l||f}function VUt(t,e){let i=null;const{codedValues:r}=t;return r&&r.length&&r.some(n=>n.code===e&&(i=n.name,!0)),i}function BUt(t,e){return t[Object.keys(t).find(i=>i.toLowerCase()===e.toLowerCase())]}function PVe(t,e,i){const r=t.sourceLayer,{attributes:n}=t,s=typeof r.getFieldDomain=="function"&&r.getFieldDomain(i);if(e)return By(e,n);if(i&&n){const o=r.getField(i),l=BUt(n,i);return l==null?"":s&&s.type==="coded-value"?VUt(s,l)??"":(o==null?void 0:o.type)==="date"?js(new Date(l)):typeof l=="number"?l.toString():typeof l!="string"?"":l.trim()}return""}function jUt(t,e,i,r){const n=t.sourceLayer,{attributes:s}=t,{objectIdField:o}=n,l=o?s[o]:null;return{text:PVe(t,e.suggestionTemplate,r),key:l,sourceIndex:i}}function GUt(t,e,i,r){return t.features.map(n=>jUt(n,e,i,r))}function HUt(t){return t!=null&&t.minScale!=null&&t.maxScale!=null}function qUt(t,e,i,r,n,s,o){const l=t.clone(),c=t.sourceLayer,f=c==null?void 0:c.objectIdField,_=f?t.attributes[f]:null,x=PVe(t,i.searchTemplate,n);s!=null&&HUt(c)&&(c.minScale&&c.minScales&&(s=c.maxScale));const T=mue(l.geometry,e,s),A=typeof o=="number"?Tre(Re(T),e,o):T,M=t.clone();return A!=null&&(M.geometry=Qa.fromExtent(A)),{extent:A,target:M,feature:l,key:_,name:x,sourceIndex:r}}function WUt(t,e,i,r,n,s,o){return t.features.map(l=>qUt(l,e,i,r,n,s,o))}var Ere;let Y0=Ere=class extends UG{constructor(t){super(t),this.displayField=null,this.exactMatch=null,this.orderByFields=null,this.searchFields=null,this.searchTemplate=null,this.suggestionTemplate=null,this.getResults=(e,i)=>LUt({source:this,...e},i),this.getSuggestions=(e,i)=>DUt({source:this,...e},i)}set layer(t){this._set("layer",t),t&&t.load().catch(()=>{})}get name(){return this._getLayerTitle()??""}set name(t){this._overrideIfSome("name",t)}clone(){return new Ere({autoNavigate:this.autoNavigate,filter:this.filter,maxResults:this.maxResults,maxSuggestions:this.maxSuggestions,minSuggestCharacters:this.minSuggestCharacters,outFields:this.outFields?Re(this.outFields):null,placeholder:this.placeholder,popupEnabled:this.popupEnabled,prefix:this.prefix,resultGraphicEnabled:this.resultGraphicEnabled,resultSymbol:this.resultSymbol?this.resultSymbol.clone():null,suggestionsEnabled:this.suggestionsEnabled,suffix:this.suffix,withinViewEnabled:this.withinViewEnabled,displayField:this.displayField,exactMatch:this.exactMatch,layer:this.layer,searchFields:this.searchFields?Re(this.searchFields):null,suggestionTemplate:this.suggestionTemplate,zoomScale:this.zoomScale})}_getFirstStringField(){var t,e;return((e=(t=this.layer.fieldsIndex)==null?void 0:t.fields.find(i=>i.type==="string"))==null?void 0:e.name)??""}_getDisplayField(){return this.displayField||this.layer.displayField||this._getFirstStringField()}_getSearchFieldsString(){const{layer:t,searchFields:e}=this;return t.loaded?`: ${(e||[this._getDisplayField()]).map(i=>{const r=t.getField(i);return(r==null?void 0:r.alias)||i}).join(", ")}`:""}_getLayerTitle(){const{layer:t}=this;if(!t)return;const{title:e}=t;return e?`${e}${this._getSearchFieldsString()}`:void 0}};y([w({json:{read:{source:"field.name"},write:{target:"field.name"}}})],Y0.prototype,"displayField",void 0),y([w({json:{read:{source:"field.exactMatch"},write:{target:"field.exactMatch"}}})],Y0.prototype,"exactMatch",void 0),y([w({value:null})],Y0.prototype,"layer",null),y([w()],Y0.prototype,"name",null),y([w({type:[String],json:{write:!0}})],Y0.prototype,"orderByFields",void 0),y([w()],Y0.prototype,"searchFields",void 0),y([w()],Y0.prototype,"searchTemplate",void 0),y([w()],Y0.prototype,"suggestionTemplate",void 0),Y0=Ere=y([Z("esri.widgets.Search.LayerSearchSource")],Y0);const uM=Y0;function YUt(t){return!!t&&typeof t.x=="number"&&typeof t.y=="number"}function XUt(t){return t&&typeof t.xmin=="number"&&typeof t.ymin=="number"&&typeof t.xmax=="number"&&typeof t.ymax=="number"}let vw=class extends Ue{constructor(e){super(e),this.address=null,this.attributes=null,this.extent=null,this.location=null,this.score=null}};y([w({type:String,json:{write:!0}})],vw.prototype,"address",void 0),y([w({type:Object,json:{write:!0}})],vw.prototype,"attributes",void 0),y([w({type:Vi,json:{write:!0}})],vw.prototype,"extent",void 0),y([w({type:mt,json:{write:!0}})],vw.prototype,"location",void 0),y([w({type:Number,json:{write:!0}})],vw.prototype,"score",void 0),vw=y([Z("esri.rest.support.AddressCandidate")],vw);const RVe=vw,yue={type:String,json:{read:{source:"token"},write:{target:"token"}}};let lc=class extends Ue{constructor(e){super(e),this.address=null,this.apiKey=null,this.categories=null,this.countryCode=null,this.forStorage=null,this.location=null,this.locationType=null,this.magicKey=null,this.maxLocations=null,this.outFields=null,this.outSpatialReference=null,this.searchExtent=null}};y([w({type:Object,json:{write:!0}})],lc.prototype,"address",void 0),y([w(yue)],lc.prototype,"apiKey",void 0),y([w({type:[String],json:{read:{source:"category",reader:t=>t?t.split(","):null},write:{target:"category",writer:(t,e)=>{e.category=t?t.join(","):null}}}})],lc.prototype,"categories",void 0),y([w({type:String,json:{write:!0}})],lc.prototype,"countryCode",void 0),y([w({type:Boolean,json:{write:!0}})],lc.prototype,"forStorage",void 0),y([w({type:mt,json:{write:{writer:(t,e)=>{e.location=t?t.clone().normalize():null}}}})],lc.prototype,"location",void 0),y([w({type:String,json:{write:!0}})],lc.prototype,"locationType",void 0),y([w({type:String,json:{write:!0}})],lc.prototype,"magicKey",void 0),y([w({type:Number,json:{write:!0}})],lc.prototype,"maxLocations",void 0),y([w({type:[String],json:{write:{writer:(t,e)=>{e.outFields=t?t.join(","):null}}}})],lc.prototype,"outFields",void 0),y([w({type:at,json:{read:{source:"outSR"},write:{target:"outSR"}}})],lc.prototype,"outSpatialReference",void 0),y([w({type:Vi,json:{write:{writer:(t,e)=>{const i=t?t.shiftCentralMeridian():null;e.searchExtent=i}}}})],lc.prototype,"searchExtent",void 0),lc=y([Z("esri.rest.support.AddressToLocationsParameters")],lc),lc.from=$s(lc);const IVe=lc;async function ZUt(t,e,i){e=IVe.from(e);const r=d6(t),{address:n,...s}=e.toJSON(),o={...n,...s,f:"json"},l=bG({...r.query,...o}),c=_G(l,i),f=`${r.path}/findAddressCandidates`;return bi(f,c).then(JUt)}function JUt({data:t}){if(!t)return[];const{candidates:e,spatialReference:i}=t;return e?e.map(r=>{if(!r)return;const{extent:n,location:s}=r,o=!n||XUt(n);return YUt(s)&&o?(n&&(n.spatialReference=i),s&&(s.spatialReference=i),RVe.fromJSON(r)):void 0}):[]}let uv=class extends Ue{constructor(e){super(e),this.apiKey=null,this.location=null,this.locationType=null,this.outSpatialReference=null}};y([w(yue)],uv.prototype,"apiKey",void 0),y([w({type:mt,json:{write:{writer:(t,e)=>{const i=t?t.clone().normalize():null,r=i!==void 0;e.location=r?i:null}}}})],uv.prototype,"location",void 0),y([w({type:String,json:{write:!0}})],uv.prototype,"locationType",void 0),y([w({type:at,json:{read:{source:"outSR"},write:{target:"outSR"}}})],uv.prototype,"outSpatialReference",void 0),uv=y([Z("esri.rest.support.LocationToAddressParameters")],uv),uv.from=$s(uv);const $Ve=uv;async function KUt(t,e,i){e=$Ve.from(e);const r=d6(t),n={...e.toJSON(),f:"json"},s=bG({...r.query,...n}),o=_G(s,i),l=`${r.path}/reverseGeocode`;return bi(l,o).then(QUt)}function QUt({data:t}){if(!t)return;const{address:e,location:i}=t,r=(e==null?void 0:e.Match_addr)||"";return RVe.fromJSON({address:r,attributes:e||{},location:i,score:100})}let hM=class extends Ue{constructor(e){super(e),this.isCollection=null,this.magicKey=null,this.text=null}};y([w({type:Boolean,json:{write:!0}})],hM.prototype,"isCollection",void 0),y([w({type:String,json:{write:!0}})],hM.prototype,"magicKey",void 0),y([w({type:String,json:{write:!0}})],hM.prototype,"text",void 0),hM=y([Z("esri.rest.support.SuggestionCandidate")],hM);const eVt=hM;let kd=class extends Ue{constructor(e){super(e),this.apiKey=null,this.categories=null,this.countryCode=null,this.location=null,this.maxSuggestions=null,this.outSpatialReference=null,this.searchExtent=null,this.text=null}};y([w(yue)],kd.prototype,"apiKey",void 0),y([w({type:[String],json:{read:{source:"category",reader:t=>t?t.split(","):null},write:{target:"category",writer:(t,e)=>{e.category=t?t.join(","):null}}}})],kd.prototype,"categories",void 0),y([w({type:String,json:{write:!0}})],kd.prototype,"countryCode",void 0),y([w({type:mt,json:{write:{writer:(t,e)=>{e.location=t?t.clone().normalize():null}}}})],kd.prototype,"location",void 0),y([w({type:Number,json:{write:!0}})],kd.prototype,"maxSuggestions",void 0),y([w({type:at,json:{read:{source:"outSR"},write:{target:"outSR"}}})],kd.prototype,"outSpatialReference",void 0),y([w({type:Vi,json:{write:{writer:(t,e)=>{const i=t?t.shiftCentralMeridian():null;e.searchExtent=JSON.stringify(i)}}}})],kd.prototype,"searchExtent",void 0),y([w({type:String,json:{write:!0}})],kd.prototype,"text",void 0),kd=y([Z("esri.rest.support.SuggestLocationsParameters")],kd),kd.from=$s(kd);const LVe=kd;async function tVt(t,e,i){const r=d6(t),n={...(e=LVe.from(e)).toJSON(),f:"json"},s=bG({...r.query,...n}),o=_G(s,i),l=`${r.path}/suggest`;return bi(l,o).then(iVt)}function iVt(t){const{data:e}=t;if(!e)return[];const{suggestions:i}=e;return i?i.map(r=>new eVt(r)):[]}const rVt="Single Line Input",nVt=3e5;function sVt(t,e){return t.location?uVt(t,e):hVt(t,e)}function DVe(t,e){var r;if(e.localSearchDisabled)return null;const i=t==null?void 0:t.scale;return typeof i=="number"&&i<=nVt?(r=t==null?void 0:t.extent)==null?void 0:r.center:null}async function oVt(t,e){const{source:i,spatialReference:r,view:n,suggestTerm:s,maxSuggestions:o,sourceIndex:l}=t,c=new LVe,{apiKey:f,url:_}=i,x=NVe(i,n),T=e==null?void 0:e.signal;if(!_)return null;f&&(c.apiKey=f),i.categories&&(c.categories=i.categories),r&&(c.outSpatialReference=r);const A=DVe(n,i);if(A&&(c.location=A),!s.trim())return null;const{prefix:M="",suffix:I=""}=i,L=`${M}${s}${I}`;return c.text=L,x&&(c.searchExtent=x),c.maxSuggestions=o,i.countryCode&&(c.countryCode=i.countryCode),tVt(_,c,{signal:T}).then(F=>pVt(F,l))}function aVt(t){return!!t&&/(?:geocode\-api\.arcgis\.com\/arcgis\/rest\/services\/world\/geocodeserver).*/i.test(t)}function lVt(t){return!!t&&/(?:\/servers\/[\da-z\.-]+\/rest\/services\/world\/geocodeserver).*/i.test(t)}function gxe(t){return!!t&&/(?:arcgis\.com\/arcgis\/rest\/services\/world\/geocodeserver).*/i.test(t)}const cVt="https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer";async function uVt(t,e){const{source:i,spatialReference:r,location:n,sourceIndex:s,view:o}=t,{apiKey:l,url:c,zoomScale:f,defaultZoomScale:_}=i;if(c==null)return[];const x=o==null?void 0:o.scale,T=e==null?void 0:e.signal,A=new $Ve;A.location=n,l&&(A.apiKey=l),r&&(A.outSpatialReference=r);try{return FVe([await KUt(c,A,{signal:T})],{sourceIndex:s,scale:x,view:o,zoomScale:f,defaultZoomScale:_})}catch{return[]}}function NVe(t,e){const{filter:i,withinViewEnabled:r}=t,n=e==null?void 0:e.scale,s=e==null?void 0:e.extent,o=i==null?void 0:i.geometry;return mue(o,e,n)||(r&&s?s:void 0)}async function hVt(t,e){var Y;const{source:i,suggestResult:r,spatialReference:n,view:s,maxResults:o,sourceIndex:l}=t,c=i==null?void 0:i.zoomScale,f=i==null?void 0:i.defaultZoomScale;if(!((Y=r.text)==null?void 0:Y.trim()))return null;const x=!r.key&&i.prefix?i.prefix:"",T=!r.key&&i.suffix?i.suffix:"",A=`${x}${r.text}${T}`,M=new IVe,{apiKey:I,url:L}=i,F=s==null?void 0:s.scale,z=NVe(i,s),k=e==null?void 0:e.signal;if(I&&(M.apiKey=I),!L)return null;i.categories&&(M.categories=i.categories),i.locationType&&(M.locationType=i.locationType),n&&(M.outSpatialReference=n);const U=DVe(s,i);U&&(M.location=U),M.maxLocations=o,z&&(M.searchExtent=z),i.countryCode&&(M.countryCode=i.countryCode);const{key:j}=r,H=`${j}`;return j&&(M.magicKey=H),M.address={},M.address[i.singleLineFieldName||rVt]=A,i.outFields&&(M.outFields=i.outFields),ZUt(L,M,{signal:k}).then(Q=>FVe(Q,{key:H,scale:F,sourceIndex:l,view:s,zoomScale:c,defaultZoomScale:f}))}function dVt(t,e){return{text:t.text,key:t.magicKey,sourceIndex:e}}function pVt(t,e){return t.map(i=>dVt(i,e))}function fVt(t,e){const{key:i,scale:r,sourceIndex:n,view:s,zoomScale:o,defaultZoomScale:l}=e,{attributes:c,extent:f,location:_,address:x}=t,T=new Ml({geometry:_,attributes:c}),A=f||_,M=mue(A,s,r),I=typeof o=="number"?Tre(M,s,o):typeof l=="number"&&(A==null?void 0:A.type)==="point"?Tre(M,s,l):M,L=_?`${_.x},${_.y}`:"",F=x||L,z=T.clone();return I!=null&&(z.geometry=Qa.fromExtent(I)),{extent:I,feature:T,target:z,key:i,name:F,sourceIndex:n}}function FVe(t,e){return t.filter(Boolean).map(i=>fVt(i,e))}var Cre;const mVt="esri.widgets.Search.LocatorSearchSource";let Xc=Cre=class extends UG{constructor(t){super(t),this.apiKey=null,this.categories=null,this.countryCode=null,this.defaultZoomScale=null,this.localSearchDisabled=!1,this.locationType=null,this.name="",this.placeholder="",this.searchTemplate="",this.singleLineFieldName=null,this.suggestionsEnabled=null,this.url=null,this.zoomScale=null,this.getResults=(e,i)=>sVt({source:this,...e},i),this.getSuggestions=(e,i)=>oVt({source:this,...e},i)}clone(){return new Cre({apiKey:this.apiKey,autoNavigate:this.autoNavigate,filter:this.filter,maxResults:this.maxResults,maxSuggestions:this.maxSuggestions,minSuggestCharacters:this.minSuggestCharacters,outFields:this.outFields?Re(this.outFields):null,placeholder:this.placeholder,popupEnabled:this.popupEnabled,prefix:this.prefix,resultGraphicEnabled:this.resultGraphicEnabled,resultSymbol:this.resultSymbol?this.resultSymbol.clone():null,suggestionsEnabled:this.suggestionsEnabled,suffix:this.suffix,withinViewEnabled:this.withinViewEnabled,categories:this.categories?Re(this.categories):null,countryCode:this.countryCode,locationType:this.locationType,searchTemplate:this.searchTemplate,singleLineFieldName:this.singleLineFieldName,zoomScale:this.zoomScale})}};y([w()],Xc.prototype,"apiKey",void 0),y([w()],Xc.prototype,"categories",void 0),y([w()],Xc.prototype,"countryCode",void 0),y([w({json:{write:!0}})],Xc.prototype,"defaultZoomScale",void 0),y([w()],Xc.prototype,"localSearchDisabled",void 0),y([w()],Xc.prototype,"locationType",void 0),y([w({json:{write:!0}})],Xc.prototype,"name",void 0),y([w({json:{write:!0}})],Xc.prototype,"placeholder",void 0),y([w()],Xc.prototype,"searchTemplate",void 0),y([w({json:{write:!0}})],Xc.prototype,"singleLineFieldName",void 0),y([w({json:{read:{source:"suggest"},write:{target:"suggest"}}})],Xc.prototype,"suggestionsEnabled",void 0),y([w({json:{write:!0}})],Xc.prototype,"url",void 0),y([w({json:{write:!0}})],Xc.prototype,"zoomScale",void 0),Xc=Cre=y([Z(mVt)],Xc);const kVe=Xc,zVe=Ce.getLogger("esri.widgets.support.geolocationUtils"),gVt={maximumAge:0,timeout:15e3,enableHighAccuracy:!0};function yVt(){const t=Le("esri-geolocation");return t||zVe.warn("geolocation-unsupported","Geolocation unsupported."),t}function vVt(){const t=window.isSecureContext;return t||zVe.warn("insecure-context","Geolocation requires a secure origin."),t}function Are(){return yVt()&&vVt()}function UVe(t){return t||(t=gVt),new Promise((i,r)=>{setTimeout(()=>r(new se("geolocation:timeout","getting the current geolocation position timed out")),15e3),navigator.geolocation.getCurrentPosition(i,r,t??void 0)})}function VVe(t,e){const{position:i,view:r}=t,n=_Vt(i),s=n==null?void 0:n.coords;if(!s)throw new se("geometry-service:no-coords","Geolocation has no coordinates");return wVt(bVt(s),r,e)}function _Vt(t){const e=t&&t.coords||{},i={accuracy:e.accuracy,altitude:e.altitude,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading,latitude:e.latitude,longitude:e.longitude,speed:e.speed};return t&&{coords:i,timestamp:t.timestamp}}function bVt({longitude:t,latitude:e,altitude:i}){return new mt({longitude:t,latitude:e,z:i||void 0,spatialReference:{wkid:4326}})}function wVt(t,e,i){if(!e)return Promise.resolve(t);const r=e.spatialReference;return r.isWGS84?Promise.resolve(t):r.isWebMercator?Promise.resolve(Ty(t)):xVt(i).then(n=>{if(!n)throw new se("geometry-service:missing-url","Geometry service URL is missing");const s=new wG({geometries:[t],outSpatialReference:r});return _ce(n,s,i).then(o=>o[0])})}function xVt(t){if(Ar.geometryServiceUrl)return Promise.resolve(Ar.geometryServiceUrl);const e=os.getDefault();return e.load(t).catch(()=>{}).then(()=>{var i,r;return(r=(i=e.helperServices)==null?void 0:i.geometry)==null?void 0:r.url})}function Vc(t,e){return t.hasOwnProperty(e)&&t[e]!=null&&t[e]!==""}const SVt=()=>lE("esri/widgets/Search/t9n/Search"),BVe="esri.widgets.Search.SearchViewModel",D1=Ce.getLogger(BVe),yxe="highlight",$k=it.ofType({key:t=>t.layer?"layer":"locator",base:UG,typeMap:{layer:uM,locator:kVe}}),vxe=at.WGS84,TVt="esri/images/search/search-symbol-32.png",EVt=/<[\s\S]*?>/g,dM=-1;let vr=class extends LG(Dn.EventedMixin(ze)){constructor(e){super(e),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new $k,this.defaultSymbols={point:new dP({url:Wr(TVt),size:24,width:24,height:24}),polyline:new Oc({color:[130,130,130,1],width:2}),polygon:new Bm({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=os.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new $k,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const i=await SVt();this.messages=i,this.defaultPopupTemplate=new hE({title:i.searchResult,content:"{Match_addr}"})};e(),this.addHandles([_e(()=>[this.includeDefaultSources,this.view,this.portal],()=>this._update(),ii),oE(e)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return this.allSources.length===1||!this.searchAllEnabled?0:dM}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){var e;return(e=this.messages)==null?void 0:e.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:i,includeDefaultSources:r}=this,n=typeof r=="function"?r.call(null,{sources:e,defaultSources:i}):r?i.concat(e):e,s=this._get("allSources")||new $k;return s.removeAll(),s.addMany(n.filter(Boolean)),s}get locationEnabled(){return this._get("locationEnabled")||Are()}set locationEnabled(e){if(e===void 0)return void this._clearOverride("locationEnabled");const i=Are();if(e&&!i){const r=new se("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});D1.error(r)}this._override("locationEnabled",!!e&&i)}get placeholder(){const{allSources:e,activeSourceIndex:i,allPlaceholder:r}=this;if(i===dM)return r??"";const n=e.at(i);return(n==null?void 0:n.placeholder)??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),e===""&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":this.allSources.length===0?"disabled":"ready"}get updating(){return this._updatingPromise!=null}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup();const{view:e,resultGraphic:i}=this;e&&i&&e.graphics.remove(i),this._set("resultGraphic",null)}search(e,i){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),n=(async()=>{var s;try{await this.when();const o=await this._getResultsFromSources(r,i);if((s=i==null?void 0:i.signal)!=null&&s.aborted)return null;const l={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(l,o,r);const c=this._getFirstResult(l.results),f=r.location&&c?c.name:r.text,_=f==null?void 0:f.replace(EVt,"");return this._set("searchTerm",_),(r.key&&typeof r.sourceIndex=="number"||r.location)&&this._set("selectedSuggestion",r),this._set("results",l.results),this._set("resultCount",l.results.reduce((x,T)=>{var A;return x+(((A=T.results)==null?void 0:A.length)??0)},0)),this.emit("search-complete",l),await this._selectFirstResult(c),l}finally{this._clearSearching()}})();return this._searching=n,n}async searchNearby(e){if(!this.locationEnabled){const r=new se("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw D1.error(r),r}const i=(async()=>{try{const r=await UVe(),n=await VVe({position:r,view:this.view},e);return await this.search(n,e)}finally{this._clearSearching()}})();return this._searching=i,i}async select(e){if(this.clearGraphics(),!e){const ne=new se("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});throw D1.error(ne),ne}const{view:i}=this,r=Vc(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),n=r!=null?this.allSources.at(r):null;if(!n){const ne=new se("select:missing-source","Cannot select without a source.",{source:n});throw D1.error(ne),ne}const s=n instanceof uM?this._getLayerSourcePopupTemplate(n):n.popupTemplate,o=n.resultSymbol||this._getDefaultSymbol(e),l=Vc(n,"resultGraphicEnabled")?n.resultGraphicEnabled:this.resultGraphicEnabled,c=Vc(n,"autoNavigate")?n.autoNavigate:this.autoNavigate,f=(Vc(n,"popupEnabled")?n.popupEnabled:this.popupEnabled)?s||this.popupTemplate||this.defaultPopupTemplate:null,{feature:_}=e;if(!_){const ne=new se("select:missing-feature","Cannot select without a feature.",{feature:_});throw D1.error(ne),ne}const{attributes:x,geometry:T,layer:A,sourceLayer:M}=_,I=mxe(T),L={layerViewQuery:this._getLayerView(_),elevationQuery:i&&I!=null?RUt(I,i).catch(()=>I):Promise.resolve(I)},F=await Uv(L),z=F.layerViewQuery.value,k=F.elevationQuery.value;o instanceof mE&&(o.text=e.name);const U=i&&c?e.target||e.extent:null;await(U!=null?this._goToSearchResult(U):Promise.resolve());const H=z?_:new Ml({geometry:T,symbol:o,attributes:x,layer:A,sourceLayer:M,popupTemplate:f}),Y=i==null?void 0:i.popup,Q=Y&&H.getEffectivePopupTemplate(Y.defaultPopupTemplateEnabled);return Q&&await i.openPopup({features:[H],location:k}),z&&D8t(z)&&!Q&&this._highlightFeature({graphic:H,layerView:z}),!z&&l&&i&&i.graphics.push(H),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",H),this.emit("select-result",{result:e,source:n,sourceIndex:r}),e}async suggest(e,i,r){const n=e||this.searchTerm;this.emit("suggest-start",{searchTerm:n}),await this._suggestTimer(i,r);const s=await this._suggestImmediate(n,r);return this._set("suggestions",s==null?void 0:s.results),this._set("suggestionCount",(s==null?void 0:s.results.reduce((o,l)=>{var c;return o+(((c=l.results)==null?void 0:c.length)??0)},0))??null),this.emit("suggest-complete",s),s}async when(){await rd(()=>!this.updating)}async _update(){const{portal:e,view:i}=this;if(this.includeDefaultSources){const r=this._updatingPromise=Uv([e==null?void 0:e.load(),i==null?void 0:i.when()]);if(this.destroyed||(await r,r!==this._updatingPromise))return}await rd(()=>this.messages),this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){var i,r;const e=(r=(i=this.portal)==null?void 0:i.helperServices)==null?void 0:r.geocode;return e?e.map(n=>{var c;if(n.placefinding===!1)return;const s=Ar.apiKey&&gxe(n.url)?{url:cVt}:null,o=kVe.fromJSON({...n,...s}),l=o.url;if(gxe(l)||lVt(l)||aVt(l)){const f=o.outFields??["Addr_type","Match_addr","StAddr","City"],_=(o.placeholder||((c=this.messages)==null?void 0:c.placeholder))??"",x=typeof o.defaultZoomScale=="number"?o.defaultZoomScale:2500;o.singleLineFieldName="SingleLine",o.outFields=f,o.placeholder=_,o.defaultZoomScale=x}return o.singleLineFieldName?o:void 0}).filter(ys):[]}_destroyFeatureLayers(){this._createdFeatureLayers.forEach(e=>e==null?void 0:e.destroy()),this._createdFeatureLayers=[]}_getLayerSources(e,i){var n;const r=(n=this.view)==null?void 0:n.map;return e.map(s=>{const o=r.findLayerById(s.id);if(!o)return;const l=this._getLayerJSON(s),c=uM.fromJSON(l);return c.placeholder=i,this._getLayer(o,l).then(f=>{c.layer=f}),c}).filter(ys).toArray()}_getTableSources(e,i){var n;const r=(n=this.view)==null?void 0:n.map;return e.map(s=>{if(!s.id)return;const o=r.findTableById(s.id);if(!o)return;const l=this._getLayerJSON(s),c=uM.fromJSON(l);return c.placeholder=i,this._getLayer(o,l).then(f=>{c.layer=f}),c}).filter(ys).toArray()}_convertApplicationProperties(){var l,c,f;const e=(l=this.view)==null?void 0:l.map,i=(f=(c=e==null?void 0:e.applicationProperties)==null?void 0:c.viewing)==null?void 0:f.search;if(!i)return[];const{enabled:r,hintText:n,layers:s,tables:o}=i;return r?[...this._getLayerSources(s,n),...this._getTableSources(o,n)]:[]}async _getSubLayer(e,i){var s;if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find(o=>o.id===i.subLayer);if(!r)throw new Error;const n=await((s=r.createFeatureLayer)==null?void 0:s.call(r));if(!n)throw new Error;return this._createdFeatureLayers.push(n),n}async _getBuildingSubLayer(e,i){await e.load();const r=e.allSublayers.find(n=>n.id===i.subLayer);if((r==null?void 0:r.type)!=="building-component")throw new Error;if(await r.load(),r.associatedLayer==null)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,i){if(e.type==="feature"||e.type==="scene"||e.type==="csv"||e.type==="geojson"||e.type==="ogc-feature")return e;if(e.type==="map-image")try{return await this._getSubLayer(e,i)}catch{const n=new se("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return D1.error(n),null}return e.type==="building-scene"?this._getBuildingSubLayer(e,i):null}_getLayerJSON(e){return typeof e.toJSON=="function"?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:i}=this;this._destroyFeatureLayers(),e.removeAll(),i&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){var s;const e=(s=this.view)==null?void 0:s.popup,{resultGraphic:i}=this;if(!e||!i)return;const r="selectedFeature"in e,n=r?e.selectedFeature:null;r&&n&&n===i&&e.close()}_suggestTimer(e,i){const r=e??this.suggestionDelay;return T2(r,null,i==null?void 0:i.signal)}_createLocationForSearch(e){return e instanceof Ml?mxe(e.geometry):e instanceof mt?e:Array.isArray(e)&&e.length===2?new mt({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&Vc(e,"key")&&Vc(e,"text")&&Vc(e,"sourceIndex"))return e;const i=this._createLocationForSearch(e),r=typeof e=="string"?e:this.searchTerm,{selectedSuggestion:n,selectedResult:s}=this,o=!e&&n&&s,l=o&&n.key===s.key&&n.sourceIndex===s.sourceIndex,c=o&&n.location;return l||c?n:{location:i,text:i?"":r,sourceIndex:null,key:null}}_getFirstResult(e){let i=null;return e&&e.some(r=>{const{results:n}=r,s=n==null?void 0:n[0],o=!!s;return o&&(i=s),o}),i}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,i){var s;await this.when();const r=await this._getSuggestionsFromSources(e,i);if((s=i==null?void 0:i.signal)!=null&&s.aborted)return null;const n={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(n,r),n}_formatSourceResponse(e,i,r){const n=(i==null?void 0:i.value)||[],s=i==null?void 0:i.error,o=this.allSources.at(r);if(s){const l={sourceIndex:r,source:o,error:s};e.errors.push(l),D1.error(s),e.numErrors++}else{const l={sourceIndex:r,source:o,results:n};e.results.push(l),e.numResults+=n.length}}_formatResponse(e,i,r){if(i)if(e.activeSourceIndex===dM){const n=r&&Vc(r,"sourceIndex")&&r.sourceIndex!==-1?r.sourceIndex:void 0;i.forEach((s,o)=>{const l=n!==void 0?n:o;this._formatSourceResponse(e,s,l)})}else this._formatSourceResponse(e,i[0],e.activeSourceIndex)}async _getResultsFromSources(e,i){const{allSources:r}=this,n=!e.location&&Vc(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,s=[];if(!r.length){const o=new se("search:no-sources-defined","At least one source is required.",{allSources:r});throw D1.error(o),o}return n===dM?r.forEach((o,l)=>{s.push(this._getResultsFromSource(e,l,i))}):s.push(this._getResultsFromSource(e,n,i)),Uv(s)}async _getSuggestionsFromSources(e,i){const{allSources:r,activeSourceIndex:n}=this,s=[];if(!r.length){const o=new se("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw D1.error(o),o}return n===dM?r.forEach((o,l)=>{s.push(this._getSuggestionsFromSource(e,l,i))}):s.push(this._getSuggestionsFromSource(e,n,i)),Uv(s)}async _getResultsFromSource(e,i,r){var _,x;const n=i!=null?this.allSources.at(i):null;if(!n)return null;const{location:s=null}=e,o=((_=this.view)==null?void 0:_.spatialReference)||vxe,l=Vc(n,"maxResults")?n.maxResults:this.maxResults,c=!!(n instanceof uM&&Vc(n,"exactMatch"))&&n.exactMatch,{view:f}=this;return(x=n.getResults)==null?void 0:x.call(n,{view:f,sourceIndex:i,location:s,suggestResult:e,spatialReference:o,exactMatch:c,maxResults:l},r)}async _getSuggestionsFromSource(e,i,r){var c,f;const n=this.allSources.at(i);if(!n)return null;e??(e="");const s=Vc(n,"suggestionsEnabled")?n.suggestionsEnabled:this.suggestionsEnabled,o=e==null?void 0:e.length,l=Vc(n,"minSuggestCharacters")?n.minSuggestCharacters:this.minSuggestCharacters;if(s&&e.trim()&&o>=l){const _=((c=this.view)==null?void 0:c.spatialReference)||vxe,x=Vc(n,"maxSuggestions")?n.maxSuggestions:this.maxSuggestions,{view:T}=this,A=!!(n instanceof uM&&Vc(n,"exactMatch"))&&n.exactMatch;return(f=n.getSuggestions)==null?void 0:f.call(n,{view:T,sourceIndex:i,suggestTerm:e,spatialReference:_,maxSuggestions:x,exactMatch:A},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:i}=e;if(i)return Vc(e,"popupTemplate")?e.popupTemplate:i.popupTemplate}_getSourceIndexOfResult(e){const i=this.results;if(!i)return null;let r=null;return i.some(n=>n.results.some(s=>s===e&&(r=n.sourceIndex,!0))),r}async _goToSearchResult(e){this._abortGoTo();const i=new AbortController;this._gotoController=i;const r={target:{target:e},options:{signal:i.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){var n;const{defaultSymbols:i}=this,r=(n=e.feature)==null?void 0:n.geometry;if(r==null)return null;switch(r.type){case"point":case"multipoint":return i.point;case"polyline":return i.polyline;case"extent":case"polygon":return i.polygon;default:return null}}_removeHighlight(){this.removeHandles(yxe)}async _getLayerView(e){var n,s;const{view:i}=this;if(!e||!i||((n=e.layer)==null?void 0:n.type)==="building-component"||((s=e.layer)==null?void 0:s.type)==="subtype-sublayer")return null;const{layer:r}=e;return r?(await i.when(),i.whenLayerView(r)):null}_highlightFeature(e){const{graphic:i,layerView:r}=e,{attributes:n,layer:s}=i,{objectIdField:o}=s,l=(o&&(n==null?void 0:n[o]))??null,c=r.highlight(l??i);this.addHandles(c,yxe)}_setResultFloor(e){var s,o,l;const{view:i}=this,r=(s=e.feature)==null?void 0:s.attributes,n=(o=e.feature)==null?void 0:o.sourceLayer;if(n&&"floorInfo"in n&&((l=n==null?void 0:n.floorInfo)!=null&&l.floorField)&&r){const c=r[n.floorInfo.floorField];i==null||i.emit("select-result-floor",c)}}};vr.ALL_INDEX=dM,y([w()],vr.prototype,"_searching",void 0),y([w()],vr.prototype,"_updatingPromise",void 0),y([w({readOnly:!0,value:null})],vr.prototype,"activeSource",null),y([w()],vr.prototype,"activeSourceIndex",null),y([w()],vr.prototype,"allPlaceholder",null),y([w({readOnly:!0})],vr.prototype,"allSources",null),y([w()],vr.prototype,"autoNavigate",void 0),y([w()],vr.prototype,"autoSelect",void 0),y([w()],vr.prototype,"defaultPopupTemplate",void 0),y([w({readOnly:!0})],vr.prototype,"defaultSources",void 0),y([w()],vr.prototype,"defaultSymbols",void 0),y([w()],vr.prototype,"includeDefaultSources",void 0),y([w()],vr.prototype,"locationEnabled",null),y([w()],vr.prototype,"maxInputLength",void 0),y([w()],vr.prototype,"maxResults",void 0),y([w()],vr.prototype,"maxSuggestions",void 0),y([w()],vr.prototype,"messages",void 0),y([w()],vr.prototype,"minSuggestCharacters",void 0),y([w({readOnly:!0})],vr.prototype,"placeholder",null),y([w()],vr.prototype,"popupEnabled",void 0),y([w({type:hE})],vr.prototype,"popupTemplate",void 0),y([w({type:os})],vr.prototype,"portal",void 0),y([w()],vr.prototype,"resultCount",void 0),y([w()],vr.prototype,"resultGraphicEnabled",void 0),y([w({readOnly:!0})],vr.prototype,"resultGraphic",void 0),y([w({readOnly:!0})],vr.prototype,"results",void 0),y([w({readOnly:!0})],vr.prototype,"selectedSuggestion",void 0),y([w()],vr.prototype,"searchAllEnabled",void 0),y([w({readOnly:!0})],vr.prototype,"selectedResult",void 0),y([w()],vr.prototype,"searchTerm",null),y([w({type:$k})],vr.prototype,"sources",void 0),y([w({readOnly:!0})],vr.prototype,"state",null),y([w()],vr.prototype,"suggestionDelay",void 0),y([w()],vr.prototype,"suggestionCount",void 0),y([w({readOnly:!0})],vr.prototype,"suggestions",void 0),y([w()],vr.prototype,"suggestionsEnabled",void 0),y([w({readOnly:!0})],vr.prototype,"updating",null),y([w()],vr.prototype,"view",void 0),y([w()],vr.prototype,"clear",null),vr=y([Z(BVe)],vr);const XM=vr;let _w=class extends cn{constructor(e,i){super(e,i),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}destroy(){this.viewModel=null}render(){const e={[o3.showMoreResults]:this.showMoreResultsOpen};return X("div",{class:this.classes(o3.base,tt.widget)},X("div",{class:this.classes(o3.moreResults,e),key:"esri-search-renderer__container"},this._renderSearchResultName(),this._renderMoreResults()))}_renderMoreResults(){return X("div",{key:"esri-search-renderer__more-results"},this._renderMoreResultsButton(),this._renderMoreResultsLists())}_renderSearchResultName(){var r;const e=(r=this.viewModel)==null?void 0:r.selectedResult,i=(e==null?void 0:e.name)||"";return X("div",{class:o3.moreResultsItem,key:"esri-search-renderer__result-name"},i)}_renderMoreResultsLists(){const{viewModel:e}=this;if(!e)return[];const i=e.results;if((e.resultCount??0)<2)return null;const r=i==null?void 0:i.map(n=>this._renderMoreResultsList(n));return X("div",{class:o3.moreResultsList,key:"esri-search-renderer__more-results-container"},r)}_renderMoreResultsButton(){const{messages:e,viewModel:i}=this;return i?(i.resultCount??0)<2?null:X("div",{class:o3.moreResultsItem,key:"esri-search-renderer__more-results-button"},X("a",{bind:this,class:tt.anchor,href:"#",onclick:this._showMoreResultsClick,onkeydown:this._showMoreResultsClick},this.showMoreResultsOpen?e.hideMoreResults:e.showMoreResults)):null}_renderMoreResultsHeader(e,i){return X("div",{class:o3.moreResultsListHeader,key:`esri-search-result-renderer__header-${i}`},e)}_renderMoreResultsList(e){var x,T,A;const{results:i}=e,r=(i==null?void 0:i.length)??0,n=r>0,s=(x=this.viewModel)==null?void 0:x.selectedResult,o=r===1&&i[0]===s,l=this._getSourceName(e.source,e.sourceIndex),c=(((A=(T=this.viewModel)==null?void 0:T.results)==null?void 0:A.length)??0)>1&&!o?this._renderMoreResultsHeader(l,e.sourceIndex):null,f=n&&i.map((M,I)=>this._renderMoreResultsListItem(M,I)),_=n&&!o?X("ul",{key:`esri-search-result-renderer__list-${e.sourceIndex}`},f):null;return n?X("div",{key:`esri-search-result-renderer__results-${e.sourceIndex}`},c,_):null}_renderMoreResultsListItem(e,i){var n;const r=(n=this.viewModel)==null?void 0:n.selectedResult;return e!==r?X("li",{key:`esri-search-result-renderer__list-item-${i}`},X("a",{bind:this,class:tt.anchor,"data-result":e,href:"#",onclick:this._selectResultClick,onkeydown:this._selectResultClick,tabIndex:0},e.name)):null}_showMoreResultsClick(e){var r,n;e.preventDefault(),this.showMoreResultsOpen=!this.showMoreResultsOpen;const i=(n=(r=this.viewModel)==null?void 0:r.view)==null?void 0:n.popup;i&&"reposition"in i&&i.reposition()}_selectResultClick(e){var r;e.preventDefault();const i=e.currentTarget["data-result"];(r=this.viewModel)==null||r.select(i)}_getSourceName(e,i){return i===XM.ALL_INDEX?this.messages.all:e.name}};y([w(),Gr("esri/widgets/Search/t9n/Search")],_w.prototype,"messages",void 0),y([w()],_w.prototype,"showMoreResultsOpen",void 0),y([w()],_w.prototype,"viewModel",void 0),y([bo()],_w.prototype,"_showMoreResultsClick",null),y([bo()],_w.prototype,"_selectResultClick",null),_w=y([Z("esri.widgets.Search.SearchResultRenderer")],_w);const CVt=_w,AVt=/<[a-z/][\s\S]*>/i,MVt=(t,e)=>{const i=Xre(e).split(/\s/),r=new RegExp(`(${i.join("|")})`,"gi");return t.replace(r,n=>`${n}`)};let _r=class extends cn{constructor(e,i){super(e,i),this._activeMenuItemIndex=-1,this._inputNode=null,this._menuItemCount=0,this._sourceMenuButtonNode=null,this._sourceListNode=null,this._suggestionListNode=null,this._searchResultRenderer=new CVt,this._suggestController=null,this._searchController=null,this._locateFailed=!1,this._container=null,this.activeMenu="none",this.disabled=!1,this.iconClass=Kn.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.viewModel=new XM,this._clearActiveMenu=()=>{this.activeMenu="none"},this._removeActiveMenu=r=>{var s;const n=r.relatedTarget;n&&((s=this._container)!=null&&s.contains(n))||this._clearActiveMenu()},this.addHandles([_e(()=>this.searchTerm,r=>{var n,s;(r&&this.activeMenu==="warning"||!r&&!((s=(n=this.viewModel)==null?void 0:n.selectedSuggestion)!=null&&s.location))&&this._clearActiveMenu()}),Jr(()=>{var r;return(r=this.viewModel)==null?void 0:r.allSources},"change",()=>this._watchSourceChanges()),_e(()=>this.activeMenu,()=>this._resetActiveMenuItemIndex(),ii),_e(()=>{var r;return(r=this.viewModel)==null?void 0:r.defaultPopupTemplate},r=>{r&&(r.content=this._renderSearchResultsContent.bind(this))},ii)])}destroy(){this._cancelSuggest(),this._cancelSearch(),this._searchResultRenderer=et(this._searchResultRenderer)}get displayedSearchTerm(){return`${this.viewModel.searchTerm}`.trim()}get inputId(){return this._buildId("input")}get suggestionsMenuId(){return this._buildId("suggest-menu")}get sourceMenuId(){return this._buildId("source-menu")}get sourceMenuButtonId(){return this._buildId("source-menu-button")}get activeSource(){var e;return(e=this.viewModel)==null?void 0:e.activeSource}get activeSourceIndex(){return this.viewModel.activeSourceIndex}set activeSourceIndex(e){this.viewModel.activeSourceIndex=e}get allPlaceholder(){return this.viewModel.allPlaceholder}set allPlaceholder(e){this.viewModel.allPlaceholder=e}get allSources(){return this.viewModel.allSources}get autoNavigate(){return this.viewModel.autoNavigate}set autoNavigate(e){this.viewModel.autoNavigate=e}get autoSelect(){return this.viewModel.autoSelect}set autoSelect(e){this.viewModel.autoSelect=e}get defaultSources(){return this.viewModel.defaultSources}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get includeDefaultSources(){return this.viewModel.includeDefaultSources}set includeDefaultSources(e){this.viewModel.includeDefaultSources=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get locationEnabled(){return this.viewModel.locationEnabled}set locationEnabled(e){this.viewModel.locationEnabled=e}get maxResults(){return this.viewModel.maxResults}set maxResults(e){this.viewModel.maxResults=e}get maxSuggestions(){return this.viewModel.maxSuggestions}set maxSuggestions(e){this.viewModel.maxSuggestions=e}get minSuggestCharacters(){return this.viewModel.minSuggestCharacters}set minSuggestCharacters(e){this.viewModel.minSuggestCharacters=e}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get portal(){var e;return(e=this.viewModel)==null?void 0:e.portal}set portal(e){this.viewModel&&(this.viewModel.portal=e)}get resultGraphic(){return this.viewModel.resultGraphic}set resultGraphic(e){this.viewModel.resultGraphic=e}get resultGraphicEnabled(){return this.viewModel.resultGraphicEnabled}set resultGraphicEnabled(e){this.viewModel.resultGraphicEnabled=e}get results(){return this.viewModel.results}get searchAllEnabled(){return this.viewModel.searchAllEnabled}set searchAllEnabled(e){this.viewModel.searchAllEnabled=e}get searchTerm(){return this.viewModel.searchTerm}set searchTerm(e){this.viewModel.searchTerm=e}get selectedResult(){return this.viewModel.selectedResult}get sources(){return this.viewModel.sources}set sources(e){this.viewModel.sources=e}get suggestions(){return this.viewModel.suggestions}get suggestionsEnabled(){return this.viewModel.suggestionsEnabled}set suggestionsEnabled(e){this.viewModel.suggestionsEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}clear(){this.viewModel.clear()}focus(){var e;(e=this._inputNode)==null||e.focus(),this.emit("search-focus")}blur(){var e;(e=this._inputNode)==null||e.blur(),this.emit("search-blur")}async search(e){this._clearActiveMenu(),this._cancelSuggest(),this._cancelSearch();const i=new AbortController,{signal:r}=i;this._searchController=i;try{const n=await this.viewModel.search(e,{signal:r});return this._searchController!==i?void 0:(this.activeMenu=n!=null&&n.numResults?"none":"warning",this._searchController=null,n)}catch{return this._searchController!==i?void 0:(this._clearActiveMenu(),void(this._searchController=null))}}async suggest(e){this._cancelSuggest();const i=new AbortController,{signal:r}=i;this._suggestController=i;try{const n=await this.viewModel.suggest(e,null,{signal:r});return this._suggestController!==i?void 0:(this._suggestController=null,n!=null&&n.numResults&&this._openSuggestionMenu(),this._scrollToTopSuggestion(),n)}catch{return this._suggestController!==i||(this._suggestController=null),null}}render(){const{state:e}=this.viewModel,i={[tt.disabled]:e==="disabled",[tt.widgetDisabled]:this.disabled};return X("div",{class:this.classes(Kn.base,tt.widget,i)},e==="loading"?this._renderLoader():this._renderContainer())}_renderSubmitButton(){const{messages:e,disabled:i}=this;return X("button",{"aria-label":e.searchButtonTitle,bind:this,class:this.classes(Kn.submitButton,tt.widgetButton),disabled:i,key:"esri-search__submit-button",onclick:this._handleSearchButtonClick,title:e.searchButtonTitle,type:"button"},X("span",{"aria-hidden":"true",class:si.search}))}_renderWarningMenu(){return X("div",{class:this.classes(tt.menu,Kn.warningMenu),key:"esri-search__error-menu"},X("div",{class:Kn.warningMenuBody},this._renderWarning()))}_renderSourceMenuButton(){const{messages:e,activeMenu:i,sourceMenuId:r,sourceMenuButtonId:n,disabled:s}=this,{activeSourceIndex:o,allSources:l}=this.viewModel;return l.length>1?X("button",{afterCreate:Vv,"aria-controls":r,"aria-expanded":(i==="source").toString(),"aria-haspopup":"true","aria-label":e.searchIn,bind:this,class:this.classes(Kn.sourcesButton,tt.widgetButton),"data-node-ref":"_sourceMenuButtonNode",disabled:s,id:n,key:"esri-search__source-menu-button",onclick:this._handleSourcesMenuToggleClick,onfocus:this._handleSourcesMenuToggleFocus,title:e.searchIn,type:"button"},X("span",{"aria-hidden":"true",class:this.classes(si.downArrow,Kn.sourcesButtonDown)}),X("span",{"aria-hidden":"true",class:this.classes(si.upArrow,Kn.sourcesButtonUp)}),X("span",{class:Kn.sourceName},this._getSourceName(o))):null}_renderSourcesList(){const{allSources:e,searchAllEnabled:i}=this.viewModel,{_activeMenuItemIndex:r,activeMenu:n,sourceMenuId:s,sourceMenuButtonId:o}=this,l=n==="source"&&r>-1?this._buildId("source-item",r):null;return e.length>1?X("ul",{afterCreate:Vv,"aria-activedescendant":l,"aria-labelledby":o,bind:this,class:tt.menuList,"data-node-ref":"_sourceListNode",id:s,onkeydown:this._handleSourceMenuKeydown,onkeyup:this._handleSourceMenuKeyup,role:"menu",tabIndex:-1},i?this._renderSource(XM.ALL_INDEX):null,e.map((c,f)=>this._renderSource(f)).toArray()):null}_renderSourcesMenu(){const{allSources:e}=this.viewModel;return e.length>1?X("div",{class:this.classes(tt.menu,Kn.sourcesMenu),key:"esri-search__source-menu"},this._renderSourcesList()):null}_renderLoader(){const{messages:e,messagesCommon:i,disabled:r}=this;return X("div",{class:tt.loader,key:"base-loader",tabIndex:r?-1:void 0},X("span",{"aria-hidden":"true",class:tt.loaderAnimation}),X("span",{class:si.fontFallbackText},e.searchButtonTitle),X("span",{class:tt.loaderText},i.loading))}_renderContainer(){const{allSources:e,state:i}=this.viewModel,{activeMenu:r}=this,n={[Kn.hasMultipleSources]:e.length>1,[Kn.isLoading]:i==="loading",[Kn.isSearching]:i==="searching",[Kn.showWarning]:r==="warning",[Kn.showSources]:r==="source",[Kn.showSuggestions]:r==="suggestion"};return X("div",{afterCreate:s=>{this._container=s,s.addEventListener("focusout",this._removeActiveMenu)},afterRemoved:s=>{s.removeEventListener("focusout",this._removeActiveMenu)},class:this.classes(n,Kn.container),key:"base-container",tabIndex:-1},this._renderSourceMenuButton(),this._renderSourcesMenu(),this._renderInputContainer(),this._renderSubmitButton(),this._renderWarningMenu())}_renderClearButton(){return this.searchTerm?X("button",{bind:this,class:this.classes(Kn.clearButton,tt.widgetButton),disabled:this.disabled,key:"esri-search__clear-button",onclick:this._handleClearButtonClick,onfocus:this._clearActiveMenu,title:this.messages.clearButtonTitle,type:"button"},X("span",{"aria-hidden":"true",class:si.close})):null}_renderLocationGroup(){const{messages:e,locationEnabled:i,displayedSearchTerm:r}=this,n=i&&!r,s=this.activeMenu==="suggestion"&&this._activeMenuItemIndex===0;return n?X("ul",{class:this.classes(tt.menuList,Kn.suggestionList,Kn.suggestionListCurrentLocation),key:"esri-search__suggestion-list-current-location",role:"group"},X("li",{"aria-selected":(this.activeMenu==="suggestion"&&this._activeMenuItemIndex===0).toString(),bind:this,class:this.classes(tt.menuItem,s?tt.menuItemFocus:null),"data-current-location-item":!0,id:this._buildId("suggestion-item",0),onclick:this._handleUseCurrentLocationClick,role:"option"},X("span",{"aria-hidden":"true",class:si.locateCircled})," ",e.useCurrentLocation)):null}_renderInput(){const{activeMenu:e,locationEnabled:i,displayedSearchTerm:r,messages:n,suggestionsMenuId:s,inputId:o,_activeMenuItemIndex:l,disabled:c}=this,{maxInputLength:f,placeholder:_,searchTerm:x,suggestionCount:T}=this.viewModel,A=!(!(i&&!r)&&!T),M=e==="suggestion"&&l>-1?this._buildId("suggestion-item",l):null;return X("input",{afterCreate:Vv,"aria-activedescendant":M,"aria-autocomplete":"list","aria-controls":A?s:null,"aria-expanded":(A&&e==="suggestion").toString(),"aria-haspopup":"listbox","aria-label":n.searchButtonTitle,autocomplete:"off",bind:this,class:this.classes(tt.input,Kn.input),"data-node-ref":"_inputNode",disabled:c,id:o,maxlength:f,onblur:this.blur,onclick:this._openSuggestionMenu,onfocus:this.focus,oninput:this._handleInputPaste,onkeyup:this._handleInputKeyup,onpaste:this._handleInputPaste,placeholder:_,role:"combobox",title:x?"":_,type:"text",value:x})}_renderForm(){return X("form",{bind:this,class:Kn.form,disabled:this.disabled,key:"esri-search__form",onsubmit:this._formSubmit,role:"search"},this._renderInput())}_renderSuggestList(e){const{sourceIndex:i}=e,{results:r}=e;return(r==null?void 0:r.length)?X("ul",{class:this.classes(tt.menuList,Kn.suggestionList),key:`esri-search__suggestion-list-${i}`,role:"group"},r==null?void 0:r.map(s=>this._renderSuggestion(s,this._menuItemCount++))):null}_renderSuggestionsGroup(){const{suggestions:e}=this.viewModel;return e?e.map(i=>[this._renderSuggestionHeader(i),this._renderSuggestList(i)]):[]}_renderSuggestionsMenu(){const{displayedSearchTerm:e,locationEnabled:i,suggestionsMenuId:r,inputId:n}=this,{suggestionCount:s}=this.viewModel,o=i&&!e||s;return this._menuItemCount=0,o?X("div",{afterCreate:Vv,"aria-labelledby":n,bind:this,class:this.classes(tt.menu,Kn.suggestionsMenu),"data-node-ref":"_suggestionListNode",id:r,key:"esri-search__suggestions-menu",role:"listbox"},this._renderLocationGroup(),this._renderSuggestionsGroup()):null}_renderInputContainer(){return X("div",{class:Kn.inputContainer,key:"esri-search__input-container"},this._renderForm(),this._renderSuggestionsMenu(),this._renderClearButton())}_renderSuggestionHeader(e){var l;const{allSources:i,activeSourceIndex:r}=this.viewModel,{sourceIndex:n}=e,s=(l=e.results)==null?void 0:l.length,o=i.length>1&&r===XM.ALL_INDEX;return s&&o?X("div",{class:tt.menuHeader,key:`esri-search__suggestion-header-${n}`},this._getSourceName(n)):null}_renderSuggestion(e,i){const{_activeMenuItemIndex:r,viewModel:{searchTerm:n}}=this;if(!n)return;const s=this.activeMenu==="suggestion"&&r===i;return X("li",{"aria-selected":(this.activeMenu==="suggestion"&&this._activeMenuItemIndex===i).toString(),bind:this,class:this.classes(tt.menuItem,s?tt.menuItemFocus:null),"data-suggestion":e,id:this._buildId("suggestion-item",i),innerHTML:this._getSuggestResultHTML(e.text,n),key:`esri-search__suggestion_${i}`,onclick:this._handleSuggestionClick,role:"option"})}_renderSource(e){const{activeSourceIndex:i,searchAllEnabled:r}=this.viewModel,n={[tt.menuItemActive]:e===i,[tt.menuItemFocus]:this.activeMenu==="source"&&e===(r?this._activeMenuItemIndex-1:this._activeMenuItemIndex)},s=r?e+1:e;return X("li",{"aria-checked":(e===i).toString(),bind:this,class:this.classes(Kn.source,tt.menuItem,n),"data-source-index":e,id:this._buildId("source-item",s),key:`esri-search__source-${e}`,onclick:this._handleSourceClick,role:"menuitemradio"},this._getSourceName(e))}_renderNoResultsWarning(e){const{messages:i}=this,r=e?By(i.noResultsFoundForValue,{value:`"${e}"`}):i.noResultsFound;return X("div",{key:"esri-search__no_results"},X("div",{class:Kn.warningMenuHeader},i.noResults),X("div",{class:Kn.warningMenuText},r))}_renderEmptySearchWarning(){const{messages:e}=this;return X("div",{key:"esri-search__empty-search"},X("span",{"aria-hidden":"true",class:si.noticeTriangle}),X("span",{class:Kn.noValueText},e.emptyValue))}_renderLocateWarning(){const{messages:e}=this;return X("div",{key:"esri-search__locate-error"},X("span",{"aria-hidden":"true",class:si.noticeTriangle}),X("span",{class:Kn.noValueText},e.locateError))}_renderWarning(){var n;const{displayedSearchTerm:e,_locateFailed:i}=this,{viewModel:r}=this;return i?this._renderLocateWarning():(n=r.selectedSuggestion)!=null&&n.location||e?this._renderNoResultsWarning(e):this._renderEmptySearchWarning()}_resetActiveMenuItemIndex(){this._activeMenuItemIndex=-1}_buildId(e,i){return`${this.id}-${e}${i===void 0?"":`-${i}`}`}_watchSourceChanges(){const{viewModel:{allSources:e}}=this,i="sources";this.removeHandles(i),e.forEach(r=>this.addHandles(_e(()=>r.name,()=>this.scheduleRender()),i))}_handleSourcesMenuToggleFocus(){this.activeMenu!=="source"&&this._clearActiveMenu()}_handleSourcesMenuToggleClick(){var i;const e=this.activeMenu==="source";this.activeMenu=e?"none":"source",this.renderNow(),this.activeMenu==="source"&&((i=this._sourceListNode)==null||i.focus())}_handleClearButtonClick(){this.viewModel.clear(),this._focus()}_handleSearchButtonClick(){this.search()}_handleSuggestionClick(e){const i=_xe(e.currentTarget);i&&(this._focus(),this.search(i))}_handleUseCurrentLocationClick(){this._useCurrentLocation()}_useCurrentLocation(){this._focus("none"),this._cancelSuggest(),this._cancelSearch();const e=new AbortController,{signal:i}=e;this._searchController=e,(async()=>{try{const r=await this.viewModel.searchNearby({signal:i});this.activeMenu=r!=null&&r.numResults?"none":"warning"}catch{this._locateFailed=!0,this.activeMenu="warning"}finally{this._searchController=null}})()}_handleSourceClick(e){this._setSourceFromMenuItem(e.currentTarget)}_setSourceFromMenuItem(e){var r;if(!e)return;const i=OVt(e);i!=null&&(this.viewModel.activeSourceIndex=i,this._clearActiveMenu(),(r=this._sourceMenuButtonNode)==null||r.focus())}_cancelSuggest(){this._suggestController=gn(this._suggestController)}_cancelSearch(){this._searchController=gn(this._searchController),this._locateFailed=!1}_handleInputKeyup(e){var s;const i=Sf(e);if(e.ctrlKey||e.metaKey||i==="Copy"||i==="ArrowLeft"||i==="ArrowRight"||i==="Shift")return;if(i==="Tab"||i==="Escape"||e.shiftKey&&i==="Tab")return this._cancelSuggest(),void(i==="Escape"&&this._clearActiveMenu());const r=i==="Home"||i==="End"||i==="ArrowUp"||i==="ArrowDown";if(i==="Enter"&&this._activeMenuItemIndex<0)return void this._cancelSuggest();const n=(s=this._suggestionListNode)==null?void 0:s.getElementsByTagName("li");if(n!=null&&n.length){if(this.activeMenu!=="suggestion"&&this._openSuggestionMenu(),r)return e.preventDefault(),this._cancelSuggest(),void this._handleItemNavigation(i,n,this._suggestionListNode);const o=n[this._activeMenuItemIndex];if(i==="Enter"&&o){const l=_xe(o);return void(l?(this._focus(),this.search(l)):PVt(o)&&this._useCurrentLocation())}}this.viewModel.searchTerm&&this.suggest()}_handleItemNavigation(e,i,r){const n=this._activeMenuItemIndex;e==="Home"&&(this._activeMenuItemIndex=0),e==="End"&&(this._activeMenuItemIndex=i.length-1),e==="ArrowUp"&&(this._activeMenuItemIndex=this._activeMenuItemIndex<=0?i.length-1:this._activeMenuItemIndex-1),e==="ArrowDown"&&(this._activeMenuItemIndex=this._activeMenuItemIndex===i.length-1?0:this._activeMenuItemIndex+1),n!==this._activeMenuItemIndex&&r&&EZe(i[this._activeMenuItemIndex],r)}_scrollToTopSuggestion(){this._suggestionListNode&&(this._suggestionListNode.scrollTop=0)}_openSuggestionMenu(){this.activeMenu="suggestion"}_handleInputPaste(e){const i=e.target;this.viewModel.searchTerm!==i.value&&(this.viewModel.searchTerm=i.value),this.viewModel.searchTerm&&this.suggest()}_handleSourceMenuKeydown(e){var r;const i=Sf(e);if(bM(i)){e.preventDefault();const n=(r=this._sourceListNode)==null?void 0:r.getElementsByTagName("li"),s=n==null?void 0:n[this._activeMenuItemIndex];this._setSourceFromMenuItem(s)}else i!=="ArrowUp"&&i!=="ArrowDown"&&i!=="End"&&i!=="Home"||e.preventDefault()}_handleSourceMenuKeyup(e){var s,o,l;const i=Sf(e),r=i==="ArrowUp"||i==="ArrowDown"||i==="End"||i==="Home";if(r&&e.preventDefault(),i==="Escape")return this._clearActiveMenu(),void((s=this._sourceMenuButtonNode)==null?void 0:s.focus());const n=(o=this._sourceListNode)==null?void 0:o.getElementsByTagName("li");return n&&n.length!==0&&r?(this.activeMenu!=="source"&&(this.activeMenu="source"),void this._handleItemNavigation(i,n,(l=this._sourceListNode)==null?void 0:l.parentElement)):void 0}_focus(e){this.focus(),e&&(this.activeMenu=e)}_formSubmit(e){e.preventDefault(),this._activeMenuItemIndex===-1&&this.search()}_getSourceName(e){const{messages:i}=this,r=this.viewModel,{allSources:n}=r,s=n.at(e);return e===XM.ALL_INDEX?i.all:s&&s.name||i.untitledSource}_getSuggestResultHTML(e,i){return e?AVt.test(e)?e:MVt(e,i):this.messages.untitledResult}_renderSearchResultsContent(){return this._searchResultRenderer.showMoreResultsOpen=!1,this._searchResultRenderer.viewModel=this.viewModel,this._searchResultRenderer}};function _xe(t){return t==null?void 0:t["data-suggestion"]}function OVt(t){return t==null?void 0:t["data-source-index"]}function PVt(t){return!!(t!=null&&t["data-current-location-item"])}y([w()],_r.prototype,"_activeMenuItemIndex",void 0),y([w()],_r.prototype,"displayedSearchTerm",null),y([w({readOnly:!0})],_r.prototype,"inputId",null),y([w({readOnly:!0})],_r.prototype,"suggestionsMenuId",null),y([w({readOnly:!0})],_r.prototype,"sourceMenuId",null),y([w({readOnly:!0})],_r.prototype,"sourceMenuButtonId",null),y([w()],_r.prototype,"activeMenu",void 0),y([w({readOnly:!0})],_r.prototype,"activeSource",null),y([w()],_r.prototype,"activeSourceIndex",null),y([w()],_r.prototype,"allPlaceholder",null),y([w({readOnly:!0})],_r.prototype,"allSources",null),y([w()],_r.prototype,"autoNavigate",null),y([w()],_r.prototype,"autoSelect",null),y([w({readOnly:!0})],_r.prototype,"defaultSources",null),y([w()],_r.prototype,"disabled",void 0),y([w()],_r.prototype,"goToOverride",null),y([w()],_r.prototype,"iconClass",void 0),y([w()],_r.prototype,"icon",void 0),y([w()],_r.prototype,"includeDefaultSources",null),y([w()],_r.prototype,"label",null),y([w()],_r.prototype,"locationEnabled",null),y([w()],_r.prototype,"maxResults",null),y([w()],_r.prototype,"maxSuggestions",null),y([w(),Gr("esri/widgets/Search/t9n/Search")],_r.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],_r.prototype,"messagesCommon",void 0),y([w()],_r.prototype,"minSuggestCharacters",null),y([w()],_r.prototype,"popupEnabled",null),y([w()],_r.prototype,"popupTemplate",null),y([w()],_r.prototype,"portal",null),y([w()],_r.prototype,"resultGraphic",null),y([w()],_r.prototype,"resultGraphicEnabled",null),y([w({readOnly:!0})],_r.prototype,"results",null),y([w()],_r.prototype,"searchAllEnabled",null),y([w()],_r.prototype,"searchTerm",null),y([w({readOnly:!0})],_r.prototype,"selectedResult",null),y([w()],_r.prototype,"sources",null),y([w({readOnly:!0})],_r.prototype,"suggestions",null),y([w()],_r.prototype,"suggestionsEnabled",null),y([w()],_r.prototype,"view",null),y([Kce(["search-complete","search-clear","search-start","select-result","suggest-start","suggest-complete"]),w({type:XM})],_r.prototype,"viewModel",void 0),_r=y([Z("esri.widgets.Search")],_r);const RVt=_r;function IVt(t,e){for(var i=0;ir[n]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var jVe={exports:{}};(function(t,e){function i(){function n(m){if(typeof m=="number")return ie.Tc.Zg(m);if(m==null)return null;if(mi[m]!=null)return ie.Tc.Zg(mi[m]);throw Error("Unrecognised Unit Type")}function s(m){if(typeof m=="number")return ie.Tc.Zg(m);if(m==null)return null;if(Lr[m]!=null)return ie.Tc.Zg(Lr[m]);throw Error("Unrecognised Unit Type")}function o(m){if(m)switch(m){case"loxodrome":return 1;case"great-elliptic":return 2;case"normal-section":return 3;case"shape-preserving":return 4}return 0}function l(m,D,E,p){if(E==null||E.B())return null;switch(E.getType()){case ie.qn.Point:return m.exportPoint(D,E,p);case ie.qn.Polygon:return m.exportPolygon(D,E,p);case ie.qn.Polyline:return m.exportPolyline(D,E,p);case ie.qn.MultiPoint:return m.exportMultipoint(D,E,p);case ie.qn.Envelope:return m.exportExtent(D,E,p)}return null}function c(m,D,E,p){if(E.getType()!==ie.qn.Point)throw Error("Geometry not Point");return m.exportPoint(D,E,p)}function f(m,D,E){return m.convertToGEGeometry(D,E)}function _(m){var D=m.wkid;m=m.wkt2||m.wkt;var E=Dr.get(D||m);return E==null&&(D!==-1&&D!=null?(E=ie.Eg.create(D),Dr.set(D,E)):m&&(E=ie.Eg.qP(m),Dr.set(m,E)),xi.has(D||m)&&E.VW(xi.get(D||m))),E}function x(m){var D,E,p;if(m==null)return null;var h=_(m);return m=h.Hd(),h=h.Kn(),(D={}).tolerance=h,D.unitType=m==null?-1:m.od,D.unitID=m==null?-1:m.Ec(),D.unitBaseFactor=m==null?0:m.ai,D.unitSquareDerivative=m==null?0:(p=(E=ie.Tc.aG(m))===null||E===void 0?void 0:E.Ec())!==null&&p!==void 0?p:0,D}function T(m,D,E,p){return E==null?null:(E=ie.$b.clip(f(m,Ze,E),f(m,Ze,p),_(D)),l(m,Ze,E,D))}function A(m,D,E,p){E=ie.$b.dl(f(m,Ze,E),f(m,Ze,p),_(D)),p=[];for(var h=0;h>6)>>1},p.Rn=function(h){return(32&h)!=0},p.US=function(h){return(128&h)!=0},p.yd=function(h){return(256&h)!=0},p.xj=function(h){return(512&h)!=0},p.Hc=function(h){return(1024&h)!=0},p.prototype.Of=function(){var h=this.Ia();return this.copyTo(h),h},p.prototype.mg=function(){return null},p.jg=function(h){var a=h.Ia();return h.copyTo(a),a},p.prototype.vc=function(){0<=this.VA&&(this.VA+=2147483649)},p.Ax=function(h){var a=h.getType();if(p.xj(a))return h.I();if(h.B())return 0;if(a==197)return 4;if(a==33)return 1;if(p.yd(a))return 2;throw m.i.fa("missing type")},p}();m.aa=E})(ie||(ie={})),Ht=ie||(ie={}),hr=function(){function m(){this.y=this.x=0}return m.construct=function(D,E){var p=new m;return p.x=D,p.y=E,p},m.al=function(D){var E=new m;return E.x=D.x,E.y=D.y,E},m.prototype.ma=function(D,E){this.x=D,this.y=E},m.prototype.L=function(D){this.x=D.x,this.y=D.y},m.prototype.fq=function(D,E){return this.x===D&&this.y===E},m.prototype.Rz=function(D){return 2220446049250313e-31>=Math.abs(this.x-D.x)&&2220446049250313e-31>=Math.abs(this.y-D.y)},m.prototype.qb=function(D){return this.x===D.x&&this.y===D.y},m.prototype.Nb=function(D){return D==this||D instanceof m&&this.x==D.x&&this.y==D.y},m.prototype.sub=function(D){this.x-=D.x,this.y-=D.y},m.prototype.uc=function(D,E){this.x=D.x-E.x,this.y=D.y-E.y},m.prototype.add=function(D,E){E!==void 0?(this.x=D.x+E.x,this.y=D.y+E.y):(this.x+=D.x,this.y+=D.y)},m.prototype.Sq=function(){this.x=-this.x,this.y=-this.y},m.prototype.mt=function(D){this.x=-D.x,this.y=-D.y},m.prototype.NS=function(D,E,p){this.x=D.x*(1-p)+E.x*p,this.y=D.y*(1-p)+E.y*p},m.prototype.Ct=function(D,E){this.x=this.x*D+E.x,this.y=this.y*D+E.y},m.prototype.HW=function(D,E,p){this.x=E.x*D+p.x,this.y=E.y*D+p.y},m.prototype.scale=function(D){this.x*=D,this.y*=D},m.prototype.compare=function(D){return this.yD.y?1:this.xD.x?1:0},m.prototype.normalize=function(){var D=this.length();D==0&&(this.x=1,this.y=0),this.x/=D,this.y/=D},m.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},m.prototype.Sk=function(){return this.x*this.x+this.y*this.y},m.tb=function(D,E){return Math.sqrt(this.yc(D,E))},m.Oy=function(D,E,p,h){return D-=p,E-=h,Math.sqrt(D*D+E*E)},m.prototype.Qh=function(D){return this.x*D.x+this.y*D.y},m.prototype.fD=function(D){return Math.abs(this.x*D.x)+Math.abs(this.y*D.y)},m.prototype.wi=function(D){return this.x*D.y-this.y*D.x},m.prototype.Bt=function(D,E){var p=-this.x*E+this.y*D;this.x=this.x*D+this.y*E,this.y=p},m.prototype.Hv=function(){var D=this.x;this.x=-this.y,this.y=D},m.prototype.MG=function(D){this.x=-D.y,this.y=D.x},m.prototype.ar=function(){var D=this.x;this.x=this.y,this.y=-D},m.prototype.qu=function(){return 0(D=D.wi(E))?1:0(p=h.value())?-1:0p?-1:0=a?p+(h-p)*a:h-(h-p)*(1-a)},E.OG=function(p,h,a,u){.5>=a?(u.x=p.x+(h.x-p.x)*a,u.y=p.y+(h.y-p.y)*a):(u.x=h.x-(h.x-p.x)*(1-a),u.y=h.y-(h.y-p.y)*(1-a))},E.lT=function(p,h,a,u,d,g){.5>=d?(g.x=p+(a-p)*d,g.y=h+(u-h)*d):(g.x=a-(a-p)*(1-d),g.y=u-(u-h)*(1-d))},E}()}(ie||(ie={})),function(m){var D=function(E){function p(){var h=E.call(this)||this;return h.sa=0,h.na=0,h.pa=0,h.la=0,h.ka=null,h}return Ke(p,E),p.prototype.ac=function(){return m.h.construct(this.sa,this.na)},p.prototype.Yp=function(h){h.x=this.sa,h.y=this.na},p.prototype.Dc=function(h){this.em(0,h)},p.prototype.ZB=function(h,a){this.em(0,m.h.construct(h,a))},p.prototype.To=function(h){this.hD(0,h)},p.prototype.setStart=function(h){this.uD(0,h)},p.prototype.wv=function(h,a){return this.Od(0,h,a)},p.prototype.YB=function(h,a,u){this.tn(0,h,a,u)},p.prototype.wc=function(){return m.h.construct(this.pa,this.la)},p.prototype.Tr=function(h){h.x=this.pa,h.y=this.la},p.prototype.Qc=function(h){this.em(1,h)},p.prototype.Ql=function(h,a){this.em(1,m.h.construct(h,a))},p.prototype.Po=function(h){this.hD(1,h)},p.prototype.setEnd=function(h){this.uD(1,h)},p.prototype.gv=function(h,a){return this.Od(1,h,a)},p.prototype.OB=function(h,a,u){this.tn(1,h,a,u)},p.prototype.Db=function(){return 1},p.prototype.B=function(){return this.Ac()},p.prototype.Oa=function(){},p.prototype.Ke=function(){return 0},p.prototype.Ea=function(h,a,u,d,g){return this.KM(h,a,u,d,g)},p.prototype.isIntersecting=function(h,a){return this.zr(h,a,!1)!=0},p.prototype.qs=function(h,a){return this.ru(h,a,!1)},p.prototype.ru=function(){return null},p.prototype.Ac=function(){return!1},p.prototype.ay=function(h){if(this.vc(),this.ka==null&&0=m.ra.Va(a))throw m.i.ce();var d=this.description.Pf(a);return 0<=d?(this.ka!=null&&this.ay(this.description.Ae.length-2),this.ka[p.Gg(this.description,h)+this.description.$j(d)-2+u]):m.ra.se(a)},p.prototype.tn=function(h,a,u,d){if(this.vc(),u>=m.ra.Va(a))throw m.i.ce();var g=this.description.Pf(a);0>g&&(this.re(a),g=this.description.Pf(a)),a==0?h!=0?u!=0?this.la=d:this.pa=d:u!=0?this.na=d:this.sa=d:(this.ka==null&&this.ay(this.description.Ae.length-2),this.ka[p.Gg(this.description,h)+this.description.$j(g)-2+u]=d)},p.prototype.copyTo=function(h){if(h.getType()!=this.getType())throw m.i.N();h.description=this.description,h.ay(this.description.Ae.length-2),p.gM(this.ka,h.ka,2*(this.description.Ae.length-2)),h.sa=this.sa,h.na=this.na,h.pa=this.pa,h.la=this.la,h.vc(),this.op(h)},p.prototype.Tg=function(h,a){var u=new m.Nc;return this.Ac()?(u.Oa(),u):(u.oa=this.Od(0,h,a),u.va=u.oa,u.Lk(this.Od(1,h,a)),u)},p.prototype.ZI=function(h){this.Ac()?h.Oa():(h.oa=this.Od(0,0,0),h.va=h.oa,h.Lk(this.Od(1,0,0)))},p.prototype.Tw=function(h,a){a.Nf(this.description),a.Cb(this.hc(h));for(var u=1,d=this.description.Aa;ua||a>=this.wa)throw m.i.fa("index out of bounds");this.mc(),u.Nf(this.description),u.B()&&u.un();for(var d=0;da||a>=this.I())throw m.i.ce();this.mc(),this.za[0].tc(2*a,u)},h.prototype.Na=function(a){var u=new m.h;return this.D(a,u),u},h.prototype.Gc=function(a,u){this.za[0].tc(2*a,u)},h.prototype.Cb=function(a,u,d){if(0>a||a>=this.wa)throw m.i.ce();this.mc();var g=this.za[0];d!==void 0?(g.write(2*a,u),g.write(2*a+1,d)):g.Tt(2*a,u),this.Pc(1993)},h.prototype.Cz=function(){if(void 0>=this.I())throw m.i.ce();this.mc();var a=this.za[0],u=new m.Nd;return u.x=a.read(NaN),u.y=a.read(NaN),u.z=this.hasAttribute(1)?this.za[1].eg():m.ra.se(1),u},h.prototype.dC=function(a){if(0>a||a>=this.I())throw m.i.ce();this.re(1),this.mc(),this.Pc(1993);var u=this.za[0];u.write(2*a,(void 0).x),u.write(2*a+1,(void 0).y),this.za[1].pr(a,(void 0).z)},h.prototype.Uc=function(a,u,d){if(0>u||u>=this.wa)throw m.i.ce();var g=m.ra.Va(a);if(d>=g)throw m.i.ce();this.mc();var v=this.description.Pf(a);return 0<=v?this.za[v].eg(u*g+d):m.ra.se(a)},h.prototype.yF=function(a,u){return this.Uc(a,u)},h.prototype.setAttribute=function(a,u,d,g){if(0>u||u>=this.wa)throw m.i.ce();var v=m.ra.Va(a);if(d>=v)throw m.i.ce();this.re(a),this.mc(),a=this.description.Pf(a),this.Pc(1993),this.za[a].pr(u*v+d,g)},h.prototype.ub=function(a){return this.wx(),this.re(a),this.mc(),this.za[this.description.Pf(a)]},h.prototype.hn=function(a,u){if(u!=null&&m.ra.Tp(a)!=u.Tp())throw m.i.N();this.re(a),a=this.description.Pf(a),this.za==null&&(this.za=m.Yc.qI(this.description.Aa)),this.za[a]=u,this.Pc(16777215)},h.prototype.sn=function(a){var u=null;if(this.za!=null){var d=m.ee.Iw(a,this.description);u=[];for(var g=0,v=a.Aa;gthis.wa+5?(5*this.wa+3)/4:this.wa),this.za[a].resize(g*d,m.ra.se(u))),ga)throw m.i.N();a!=this.wa&&(this.wa=a,this.Pc(65535))},h.prototype.om=function(a){if(!this.ak(1)){if(!this.ak(2))return 0;if(this.QT>=a)return this.ak(8)?1:2}return-1},h.prototype.Ch=function(a,u){if(this.QT=u,a==-1)this.Lf(1,!0),this.Lf(8,!0);else if(this.Lf(1,!1),this.Lf(8,!0),a==0)this.Lf(2,!1),this.Lf(4,!1);else if(a==1)this.Lf(2,!0),this.Lf(4,!1);else{if(a!=2)throw m.i.fa("internal error.");this.Lf(2,!0),this.Lf(4,!0)}},h.prototype.lM=function(){this.Bb!=null&&(this.Bb=null)},h.prototype.kD=function(a,u,d,g){if(0>a||a>=this.wa||0>u||u>=this.wa)throw m.i.fa("index out of bounds");this.mc(),g.Nf(this.description),g.B()&&g.un();for(var v=0;va||a>=this.wa)throw m.i.ce();this.mc();var u=new m.Sa;u.Nf(this.description),u.B()&&u.un();for(var d=0;da||a>=this.wa)throw m.i.ce();if(u.B())throw m.i.N();this.mc();for(var d=u.description,g=0;gm.O.bB(this.Tm)>>1:h!=-1)?p=h:u=v,h=!0;;){if(0>u){if((v=g[7*p])==-1){u=p,a=this.ob.Ll([-1,-1,p,a,this.gl(),-1,-1]),(g=this.ob.o)[7*p]=a;break}p=v}else{if((v=g[7*p+1])==-1){u=g[7*p+6],a=this.ob.Ll([-1,-1,p,a,this.gl(),-1,-1]),(g=this.ob.o)[7*p+1]=a;break}p=v}h&&(u*=-1,h=!1)}return this.oy(a,g),g[7*a+2]===-1&&(g[7*d]=a),this.vp(u,a,d,g),a},E.prototype.FF=function(){return this.iR(this.Qe)},E.prototype.vd=function(p,h){h=h==-1?this.Qe:h,this.Rv?this.LP(p,h):this.iY(p,h)},E.prototype.search=function(p,h){for(h=this.sv(h);h!=-1;){var a=this.Zn.compare(this,p,h);if(a==0)return h;h=0>a?this.ll(h):this.Xp(h)}return-1},E.prototype.IW=function(p){for(var h=this.sv(-1),a=-1;h!=-1;){var u=p.compare(this,h);if(u==0)return h;0>u?h=this.ll(h):(a=h,h=this.Xp(h))}return a},E.prototype.uJ=function(p){for(var h=this.sv(-1),a=-1;h!=-1;){var u=p.compare(this,h);if(u==0)return h;0>u?(a=h,h=this.ll(h)):h=this.Xp(h)}return a},E.prototype.ja=function(p){return this.ob.T(p,3)},E.prototype.ll=function(p){return this.ob.T(p,0)},E.prototype.Xp=function(p){return this.ob.T(p,1)},E.prototype.getParent=function(p){return this.ob.T(p,2)},E.prototype.lb=function(p){return this.ob.T(p,6)},E.prototype.we=function(p){return this.ob.T(p,5)},E.prototype.rc=function(p){return p==-1?this.kl(this.Qe):this.kl(p)},E.prototype.Fc=function(p){return p==-1?this.Zr(this.Qe):this.Zr(p)},E.prototype.ZR=function(p){return p==-1?this.bG(this.Qe):this.bG(p)},E.prototype.Sj=function(p,h){this.NB(p,h)},E.prototype.sv=function(p){return p==-1?this.YF(this.Qe):this.YF(p)},E.prototype.clear=function(){this.ob.mj(!1),this.Qe=-1},E.prototype.size=function(p){return p==-1?this.$F(this.Qe):this.$F(p)},E.prototype.KN=function(p,h){for(var a=h[7*p],u=h[7*p+1],d=h[7*p+4];a!=-1||u!=-1;){var g=a!=-1?h[7*a+4]:2147483647;if(u=u!=-1?h[7*u+4]:2147483647,d<=Math.min(g,u))break;g<=u?this.sJ(a,h):this.rJ(p,h),a=h[7*p],u=h[7*p+1]}},E.prototype.oy=function(p,h){if(this.Rv)for(var a=h[7*p+4],u=h[7*p+2];u!=-1&&h[7*u+4]>a;)h[7*u]==p?this.sJ(p,h):this.rJ(u,h),u=h[7*p+2]},E.prototype.rJ=function(p,h){var a=h[7*p+1];h[7*a+2]=h[7*p+2],h[7*p+2]=a;var u=h[7*a];h[7*p+1]=u,u!=-1&&(h[7*u+2]=p),h[7*a]=p,(u=h[7*a+2])!=-1&&(h[7*u]==p?h[7*u]=a:h[7*u+1]=a)},E.prototype.sJ=function(p,h){var a=h[7*p+2];h[7*p+2]=h[7*a+2],h[7*a+2]=p;var u=h[7*p+1];h[7*a]=u,u!=-1&&(h[7*u+2]=a),h[7*p+1]=a,(u=h[7*p+2])!=-1&&(h[7*u]===a?h[7*u]=p:h[7*u+1]=p)},E.prototype.Pk=function(p,h){this.ob.S(p,2,h)},E.prototype.TB=function(p,h){this.ob.S(p,0,h)},E.prototype.XB=function(p,h){this.ob.S(p,1,h)},E.prototype.WB=function(p,h){this.ob.S(p,5,h)},E.prototype.ex=function(p,h){this.ob.S(p,6,h)},E.prototype.XJ=function(p,h){this.ob.S(h,0,p)},E.prototype.rX=function(p){this.ob.S(p,4,0)},E.prototype.uX=function(p,h){this.ob.S(h,5,p)},E.prototype.YF=function(p){return p==-1?-1:this.ob.T(p,0)},E.prototype.kl=function(p){return p==-1?-1:this.ob.T(p,1)},E.prototype.Zr=function(p){return p==-1?-1:this.ob.T(p,2)},E.prototype.iR=function(p){return p==-1?-1:this.ob.T(p,3)},E.prototype.$F=function(p){return p==-1?0:this.ob.T(p,4)},E.prototype.bG=function(p){return this.ob.T(p,5)},E.prototype.Pw=function(){return this.ob.Ll([-1,-1,-1,void 0,this.gl(),-1,-1])},E.prototype.fl=function(p){p!=-1&&this.ob.jd(p)},E.prototype.gl=function(){return this.Tm=m.O.bB(this.Tm),1073741823&this.Tm},E.prototype.FD=function(p,h,a){var u=this.ob.o;if(a==-1||u[7*a]==-1)return p=this.ob.Ll([-1,-1,-1,p,this.gl(),-1,-1]),(u=this.ob.o)[7*a]=p,this.vp(-1,p,a,u),p;for(var d=a==-1?-1:u[7*a];;){var g=h==-1?1:this.Zn.compare(this,p,d);if(0>g){if((g=this.ll(d))==-1){h=d,p=this.ob.Ll([-1,-1,d,p,this.gl(),-1,-1]),(u=this.ob.o)[7*d]=p;break}d=g}else{if(h==1&&g==0)return u[7*a+3]=d,-1;if((g=u[7*d+1])==-1){h=u[7*d+6],p=this.ob.Ll([-1,-1,d,p,this.gl(),-1,-1]),(u=this.ob.o)[7*d+1]=p;break}d=g}}return this.oy(p,u),u[7*p+2]===-1&&(u[7*a]=p),this.vp(h,p,a,u),p},E.prototype.vp=function(p,h,a,u){if(p!=-1){var d=u[7*p+5];u[7*p+5]=h}else d=a==-1?-1:u[7*a+2];u[7*h+5]=d,d!=-1&&(u[7*d+6]=h),u[7*h+6]=p,p==(a==-1?-1:u[7*a+1])&&(u[7*a+1]=h),p==-1&&(u[7*a+2]=h),u[7*a+4]=(a==-1?0:u[7*a+4])+1},E.prototype.AB=function(p,h){var a=this.ob.o,u=a[7*p+5];p=a[7*p+6],u!=-1?a[7*u+6]=p:a[7*h+1]=p,p!=-1?a[7*p+5]=u:a[7*h+2]=u,a[7*h+4]=h===-1?-1:a[7*h+4]-1},E.prototype.iY=function(p,h){this.AB(p,h);var a=this.ll(p),u=this.Xp(p),d=this.getParent(p),g=p;if(a!=-1&&u!=-1){this.Tm=m.O.bB(this.Tm);var v=1073741823=p.oa:p.va>=this.oa},E.prototype.move=function(p){this.B()||(this.oa+=p,this.va+=p)},E.prototype.normalize=function(){if(!isNaN(this.oa)){if(this.oa>this.va){var p=this.oa;this.oa=this.va,this.va=p}isNaN(this.va)&&this.Oa()}},E.prototype.Oa=function(){this.va=this.oa=NaN},E.prototype.B=function(){return isNaN(this.oa)},E.prototype.Zb=function(p){typeof p=="number"?this.B()?this.va=this.oa=p:this.Lk(p):p.B()||(this.B()?(this.oa=p.oa,this.va=p.va):(this.oa>p.oa&&(this.oa=p.oa),this.vathis.va&&this.Oa()))},E.prototype.Lk=function(p){pthis.va&&(this.va=p)},E.prototype.contains=function(p){return typeof p=="number"?p>=this.oa&&p<=this.va:p.oa>=this.oa&&p.va<=this.va},E.prototype.Ea=function(p){this.B()||p.B()?this.Oa():(this.oap.va&&(this.va=p.va),this.oa>this.va&&this.Oa())},E.prototype.W=function(p){this.B()||(this.oa-=p,this.va+=p,this.vah?(this.oa=h,this.va=p):(this.oa=p,this.va=h)},E.prototype.It=function(p){return m.O.Rk(p,this.oa,this.va)},E.prototype.R=function(){return this.va-this.oa},E.prototype.sf=function(){return .5*(this.oa+this.va)},E.prototype.Nb=function(p){return p==this||p instanceof E&&(!(!this.B()||!p.B())||this.oa==p.oa&&this.va==p.va)},E.prototype.cc=function(){return m.O.uj(m.O.uj())},E}();m.Nc=D}(ie||(ie={})),function(m){var D=new m.Nc,E=new m.Nc,p=function(){this.ne=null,this.pb=-1,this.sb=new m.yb,this.qA=55555555,this.Tv=this.Vv=!1,this.Uf=new m.Nc,this.Uf.KB(0,0)};m.IY=p;var h=function(){function a(u,d,g){this.g=u,this.Hk=NaN,this.NH=this.Kq=0,this.OH=NaN,this.qa=d,this.Nq=10*d,this.PH=this.QH=NaN,this.rg=!1,this.Dm=this.gt=this.Lo=this.Xs=this.Ws=-1,this.gA=g,this.TA=new p,this.YH=new p,m.O.truncate(3*u.fd/2)}return a.prototype.mG=function(u,d,g,v){u.ne=v===null?null:v[g[5*d]],u.Tv=u.ne!=null,u.Tv||((v=g[5*d+2])!==-1&&this.g.mW(g[5*d],g[5*v],u.sb),u.ne=u.sb,u.Uf.KB(u.sb.sa,u.sb.pa),u.Uf.va+=this.qa,u.sb.rI(),u.Vv=u.sb.la==u.sb.na,u.Vv||(u.qA=(u.sb.pa-u.sb.sa)/(u.sb.la-u.sb.na)))},a.prototype.OO=function(u,d){var g=u.zr(d,this.qa,!0);return g!=0?g==2?this.Qy():this.xi():(u.Yp(vt),u.Tr(Bt),d.Yp(qt),d.Tr(li),Lt.ma(this.Kq,this.Hk),vt.qb(qt)&&this.Hk==vt.y?0>Bt.compare(li)?Lt.L(Bt):Lt.L(li):vt.qb(li)&&this.Hk==vt.y?0>Bt.compare(qt)?Lt.L(Bt):Lt.L(qt):qt.qb(Bt)&&this.Hk==qt.y?0>vt.compare(li)?Lt.L(vt):Lt.L(li):Bt.qb(li)&&this.Hk==Bt.y&&(0>vt.compare(qt)?Lt.L(vt):Lt.L(qt)),u.Pe(Lt.y,Lt.x)g&&0>u?-1:0d.pa){if(d.pa>d.sa&&d.la-d.na<2*this.qa&&u.vi(d.pa,d.la,this.qa))return this.xi()}else if((d.la-d.na)/(d.pa-d.sa)*(u.pa-u.sa)d.sa&&d.la-d.na<2*this.qa&&u.vi(d.pa,d.la,this.qa))return this.xi()}else if((d.la-d.na)/(d.pa-d.sa)*(u.sa-u.pa)v&&0>g?-1:0d+S?g:v.vi(u.sa,u.na,this.qa)?this.xi():bd+S?g:v.vi(u.pa,u.la,this.qa)?this.xi():bb?1:0)},a.prototype.Kr=function(){this.rg=!1},a.prototype.rm=function(){return this.Ni},a.prototype.$J=function(u,d){this.Hk=u,this.Kq=d,this.gt=this.Lo=this.Xs=this.Ws=-1},a.prototype.compare=function(u,d,g){return this.rg?-1:(u=u.ja(g),this.Dm=g,this.RE(d,d,u,u))},a.prototype.RE=function(u,d,g,v){if(this.Lo==d)var b=this.TA;else this.Lo=d,b=this.TA,this.TA.pb=u,this.mG(b,d,this.g.td.o,this.g.We);if(S==null){this.gt=v;var S=this.YH;this.YH.pb=g,this.mG(S,v,this.g.td.o,this.g.We)}return b.Tv||S.Tv?this.NO(d,v,b,S):b.Uf.vathis.Uf.va)return 1;if(this.ie.na==this.ie.la)return this.Dm=p,this.rg=!0,0;this.ie.rI(),a=this.ie.ac(),(h=new m.h).uc(this.ie.wc(),a),h.ar();var u=new m.h;return u.uc(this.Gq,a),a=h.Qh(u),(a/=h.length())<10*-this.qa?-1:a>10*this.qa?1:this.ie.qs(this.Gq,this.qa)&&((h=Math.abs(a))a?-1:1},E}();m.aM=D}(ie||(ie={})),function(m){function D(p,h,a,u){a=new Float64Array(p.subarray(a,u)),p.set(a,h)}var E=function(){function p(h){this.Pb=this.pk=!1,this.o=null;var a=h;2>a&&(a=2),this.o=new Float64Array(a),this.size=h}return p.prototype.rotate=function(h,a,u){if(this.Pb)throw m.i.fa("invalid_call");if(au||h>u)throw m.i.N();h!=a&&u!=a&&(this.ni(h,a-h,1),this.ni(a,u-a,1),this.ni(h,u-h,1))},p.qf=function(h,a){var u=new p(h),d=u.o;if(2>h&&(h=2),a!==0)for(var g=0;ga&&(u.size=a),2>(a=u.size)&&(a=2),u.o=new Float64Array(a),u.o.set(h.o.length<=a?h.o:h.o.subarray(0,a),0),u},p.prototype.Jb=function(h){0>=h||(this.o==null?this.o=new Float64Array(h):h<=this.o.length||(0this.o.length&&(u=m.O.truncate(64>h?Math.max(2*h,4):5*h/4),(u=new Float64Array(u)).set(this.o),this.o=u),u=this.o;for(var d=this.size;dthis.o.length)&&this.resize(h),this.pk)throw m.i.fa("invalid call. Attribute Stream is locked and cannot be resized.");this.size=h},p.prototype.pr=function(h,a){this.write(h,a)},p.prototype.An=function(h,a,u){for(var d=this.size;ad||u>g&&d!=g)return!1;for(u>d&&(u=d);ag||u%g!=0))throw m.i.N();var v=this.size;if(this.resize(v+u),d)this.o.set(h.o.subarray(a,a+u),v);else{d=u;for(var b=0;bv||d%v!=0))throw m.i.N();var S=this.size-b;if(Sv&&(v=this.size),this.size+2*d>this.o.length?this.resize(this.size+2*d):this.size+=2*d,D(this.o,h+2*d,h,h+(v-h)),g)for(g=0;gh||0>a||0>d||!g&&(0>=v||a%v!=0)||u.sizethis.size)throw m.i.Hb();0u||a%u!=0)throw m.i.Hb();for(var d=a>>1,g=0;ga||0>u||0>a||u+a>this.size)throw m.i.N();for(var d=a;dh||0>a||0>d)throw m.i.N();if(a!=0)for(this.size<(a<<1)+h&&this.resize((a<<1)+h),g||(h+=a-1<<1),g=g?2:-2,a+=d;dh||0>a)throw m.i.N();if(a!=0){this.size<(a<<1)+h&&this.resize((a<<1)+h),a+=0;for(var d=0;dh||0>a||0>d||this.sizeh||0>a||this.size<(a>>1)+h)throw m.i.N();if(a!=0){a=0+a;for(var d=0;da&&(a=2),this.o=new Int32Array(a),this.size=h}return p.prototype.rotate=function(h,a,u){if(this.Pb)throw m.i.fa("invalid_call");if(au||h>u)throw m.i.N();h!=a&&u!=a&&(this.ni(h,a-h,1),this.ni(a,u-a,1),this.ni(h,u-h,1))},p.qf=function(h,a){var u=new p(h),d=u.o;if(2>h&&(h=2),a!==0)for(var g=0;ga&&(u.size=a),2>(a=u.size)&&(a=2),u.o=new Int32Array(a),u.o.set(h.o.length<=a?h.o:h.o.subarray(0,a),0),u},p.prototype.Jb=function(h){0>=h||(this.o==null?this.o=new Int32Array(h):h<=this.o.length||(0this.o.length&&(u=m.O.truncate(64>h?Math.max(2*h,4):5*h/4),(u=new Int32Array(u)).set(this.o),this.o=u),u=this.o;for(var d=this.size;dthis.o.length)&&this.resize(h),this.pk)throw m.i.fa("invalid call. Attribute Stream is locked and cannot be resized.");this.size=h},p.prototype.pr=function(h,a){this.write(h,a)},p.prototype.An=function(h,a,u){for(var d=this.size;ad||u>g&&d!=g)return!1;for(u>d&&(u=d);ag||u%g!=0))throw m.i.N();var v=this.size;if(this.resize(v+u),d)this.o.set(h.o.subarray(a,a+u),v);else{d=u;for(var b=0;bv||d%v!=0))throw m.i.N();if(D(this.o,h+d,h,h+(b-h)),this.o==a.o&&hv&&(v=this.size),this.size+2*d>this.o.length?this.resize(this.size+2*d):this.size+=2*d,D(this.o,h+2*d,h,h+(v-h)),g)for(g=0;gh||0>a||0>d||!g&&(0>=v||a%v!=0)||u.sizethis.size)throw m.i.Hb();0u||a%u!=0)throw m.i.Hb();for(var d=a>>1,g=0;ga||0>u||0>a||u+a>this.size)throw m.i.N();for(var d=a;dh||0>a||0>d)throw m.i.N();if(a!=0)for(this.size<(a<<1)+h&&this.resize((a<<1)+h),g||(h+=a-1<<1),g=g?2:-2,a+=d;dh||0>a||0>d||this.sizea-h?p.rG(this.o,h,a,u):p.qB(this.o,h,a-1,u)},p.prototype.Tp=function(){return 2},p.prototype.Fc=function(){return this.o[this.size-1]},p.prototype.If=function(){this.resize(this.size-1)},p.prototype.bX=function(h){this.o[this.size-1]=h},p.prototype.SV=function(h){h=a&&0=u))for(;;){if(9>u-a){p.rG(h,a,u+1,d);break}var g=h[a];p.tx(h,a,u);for(var v=a,b=a;b=d(h[b],g)&&(p.tx(h,v,b),v+=1);p.tx(h,v,u),v-aa&&(a=2),this.o=new Int8Array(a),this.size=h}return p.prototype.rotate=function(h,a,u){if(this.Pb)throw m.i.fa("invalid_call");if(au||h>u)throw m.i.N();h!=a&&u!=a&&(this.ni(h,a-h,1),this.ni(a,u-a,1),this.ni(h,u-h,1))},p.qf=function(h,a){var u=new p(h),d=u.o;if(2>h&&(h=2),a!==0)for(var g=0;ga&&(u.size=a),2>(a=u.size)&&(a=2),u.o=new Int8Array(a),u.o.set(h.o.length<=a?h.o:h.o.subarray(0,a),0),u},p.prototype.Jb=function(h){0>=h||(this.o==null?this.o=new Int8Array(h):h<=this.o.length||(0this.o.length&&(u=m.O.truncate(64>h?Math.max(2*h,4):5*h/4),(u=new Int8Array(u)).set(this.o),this.o=u),u=this.o;for(var d=this.size;dthis.o.length)&&this.resize(h),this.pk)throw m.i.fa("invalid call. Attribute Stream is locked and cannot be resized.");this.size=h},p.prototype.pr=function(h,a){this.write(h,a)},p.prototype.An=function(h,a,u){for(var d=this.size;ad||u>g&&d!=g)return!1;for(u>d&&(u=d);ag||u%g!=0))throw m.i.N();var v=this.size;if(this.resize(v+u),d)this.o.set(h.o.subarray(a,a+u),v);else{d=u;for(var b=0;bv||d%v!=0))throw m.i.N();if(D(this.o,h+d,h,h+(b-h)),this.o==a.o&&hv&&(v=this.size),this.size+2*d>this.o.length?this.resize(this.size+2*d):this.size+=2*d,D(this.o,h+2*d,h,h+(v-h)),g)for(g=0;gh||0>a||0>d||!g&&(0>=v||a%v!=0)||u.sizethis.size)throw m.i.Hb();0u||a%u!=0)throw m.i.Hb();for(var d=a>>1,g=0;ga||0>u||0>a||u+a>this.size)throw m.i.N();for(var d=a;dh||0>a||0>d)throw m.i.N();if(a!=0)for(this.size<(a<<1)+h&&this.resize((a<<1)+h),g||(h+=a-1<<1),g=g?2:-2,a+=d;dh||0>a||0>d||this.sizep?-p:p},E.ti=function(p){return 3552713678800501e-30>p},E.KC=function(p,h,a){return E.P(p-h)<=a*(1+(E.P(p)+E.P(h))/2)},E.Y=function(p,h){return E.KC(p,h,3552713678800501e-30)},E.FL=function(p){return 3552713678800501e-30>=E.P(p)},E.Cd=function(p){return E.FL(p)},E}();m.s=D,m.F=function(){function E(){}return E.gp=function(p,h){var a=0;return(p=D.P(p))+(h=D.P(h))!=0&&(p>h?(a=h/p,a=p*Math.sqrt(1+a*a)):(a=p/h,a=h*Math.sqrt(1+a*a))),a},E.Wq=function(p,h,a,u,d){for(var g=[0,0,0],v=[0,0,0],b=0;2>=b;b++)h[b]-=p[b],a[b]-=h[b];a=g[1]*v[2]-g[2]*v[1],h=g[2]*v[0]-g[0]*v[2],g=g[0]*v[1]-g[1]*v[0],p=-1*(a*p[0]+h*p[1]+g*p[2]),u[0]=a,u[1]=h,u[2]=g,u[3]=p,v=E.on(u),u[0]/=v,u[1]/=v,u[2]/=v,u[3]/=v,d!=0&&(v=D.Cd(g)?D.Cd(p)?D.Mb(1,h):-D.Mb(1,p):D.Mb(1,g),v*=D.Mb(1,d),u[0]*=v,u[1]*=v,u[2]*=v,u[3]*=v)},E.zx=function(p,h,a){a[0]=p[1]*h[2]-h[1]*p[2],a[1]=p[2]*h[0]-h[2]*p[0],a[2]=p[0]*h[1]-h[0]*p[1]},E.St=function(p,h){return p[0]*h[0]+p[1]*h[1]+p[2]*h[2]},E.on=function(p){return E.gp(E.gp(p[0],p[1]),p[2])},E.cl=function(p,h,a,u,d,g,v,b){p=E.n(p,h,a);var S=Math.cos(a);g.u=(p+d)*S*Math.cos(u),v.u=(p+d)*S*Math.sin(u),b.u=(p*(1-h)+d)*Math.sin(a)},E.jO=function(p,h,a,u,d,g,v){var b=E.gp(h,a),S=1*Math.sqrt(1-p),C=S/1;if(D.Y(b,0))g.u=0,d.u=D.Mb(1.570796326794897,u),v.u=D.P(u)-S;else{g.u=Math.atan2(a,h),a=Math.atan2(1*u,S*b),g=Math.cos(a);var O=Math.sin(a);h=S*p/(1-p),p*=1,a=Math.atan2(u+h*O*O*O,b-p*g*g*g),3.141592653589793p){var a=Math.sqrt(1-p),u=(1-a)/(1+a),d=u*u,g=u*d,v=u*g,b=u*v,S=u*b,C=u*S,O=1.572916666666667*g-3.2578125*b+4.295068359375*C;p=2.142578125*v-6.071484375*S,a=3.129296875*b-11.249837239583334*C;var R=4.775276692708333*S,$=7.958636765252976*C,N=Math.cos(2*h);return h+Math.sin(2*h)*(1.5*u-.84375*g+.525390625*b-.2688395182291667*C-O+a-$+N*(2*(1.3125*d-1.71875*v+1.650146484375*S)-4*p+6*R+N*(4*O-12*a+24*$+N*(8*p-32*R+N*(16*a-80*$+N*(32*R+64*N*$))))))}for(a=1-p,u=p/2,g=(d=D.P(h))*E.Zu(p)/(1.570796326794897*a),v=9999,S=d,d=0;1e-16d;d++)C=E.w(p,S),b=S-(O=(b=(E.kG(S,p)-u*Math.sin(2*S)/C)/a-g)/(C=1/(C*C*C))),v=D.P(O),S=b;return 0<=h?S:-S},E.qW=function(p,h){return D.ti(h)?p:p*E.Zu(h)/1.570796326794897},E.ba=function(p){return 0>(p=E.pF(p,6.283185307179586))?p+6.283185307179586:3.141592653589793>D.P(p)||D.Y(D.P(p),3.141592653589793)?p:p-6.283185307179586},E.pF=function(p,h){return p-Math.floor(p/h)*h},E.Ah=function(p,h){if(.006884661117170036>h){var a=(h=(1-(h=Math.sqrt(1-h)))/(1+h))*h,u=a*a;return p/(1+h)*(1+.25*a+.015625*u+.00390625*a*u)*1.570796326794897}return p*E.Zu(h)},E.Vq=function(p,h){var a=D.Mb(1,Math.sin(h));return h=1.570796326794897>=(h=D.P(E.pF(h,3.141592653589793)))?h:3.141592653589793-h,(D.Y(h,1.570796326794897)?h:Math.atan(Math.sqrt(1-p)*Math.tan(h)))*a},E.q=function(p,h,a){if(.006884661117170036>h){var u=(h=(1-(h=Math.sqrt(1-h)))/(1+h))*h,d=h*u,g=h*d,v=h*g,b=h*v,S=h*b,C=-.7291666666666666*d+.2278645833333333*v+.03987630208333334*S,O=.615234375*g-.21533203125*b,R=-.54140625*v+.20302734375*S,$=.48876953125*b,N=-.4488699776785715*S,B=Math.cos(2*a);return p/(1+h)*((1+.25*u+.015625*g+.00390625*b)*a+Math.sin(2*a)*(-1.5*h+.1875*d+.0234375*v+.00732421875*S-C+R-N+B*(2*(.9375*u-.234375*g-.03662109375*b)-4*O+6*$+B*(4*C-12*R+24*N+B*(8*O-32*$+B*(16*R-80*N+B*(32*$+64*B*N)))))))}return p*(E.kG(a,h)-.5*h*Math.sin(2*a)/E.w(h,a))},E.w=function(p,h){return h=Math.sin(h),Math.sqrt(1-p*h*h)},E.Zu=function(p){return D.KC(p,1,2220446049250313e-31)?1:1>p?E.Xw(0,1-p)-p/3*E.Uw(0,1-p):NaN},E.kG=function(p,h){var a=D.Mb(1,p);p=D.P(p);var u=Math.floor(p/1.570796326794897);if(1D.P(u)&&1e-4>D.P(d)&&1e-4>D.P(g));)g=Math.sqrt(b),h+=p/((a=Math.sqrt(S))*(S+(g=Math.sqrt(v)*(g+a)+g*a))),p*=.25,v=.25*(v+g),b=.25*(b+g),S=.25*(S+g);return b=(v=u*d)-(S=g*g),3*h+p*(1+(S=v-6*S)*(.10227272727272728*S-.2142857142857143-.1730769230769231*g*(u=S+b+b))+g*(.1666666666666667*u+g*(-.4090909090909091*b+.1153846153846154*g*v)))/(a*Math.sqrt(a))},E.Xw=function(p,h){for(var a,u,d,g,v=1;u=2-((a=(p+h+v)/3)+p)/a,d=2-(a+h)/a,g=2-(a+v)/a,!(1e-4>D.P(u)&&1e-4>D.P(d)&&1e-4>D.P(g));v=.25*(v+a))a=Math.sqrt(h),u=Math.sqrt(v),p=.25*(p+(a=Math.sqrt(p)*(a+u)+a*u)),h=.25*(h+a);return(1+(.04166666666666666*(p=u*d-g*g)-.1-.06818181818181818*(h=u*d*g))*p+.07142857142857142*h)/Math.sqrt(a)},E.Qw=function(p,h){if(D.ti(p)||h==0||D.Y(D.P(h),1.570796326794897))return h;if(.006884661117170036>p){var a=p*p,u=p*a,d=p*u,g=p*d,v=p*g,b=p*v,S=-(.02708333333333333*u+.03430059523809524*d+.03149181547619048*g+.02634359154541446*v+.02156896735835538*b),C=.007669890873015873*d+.01299603174603175*g+.0148051353064374*v+.01454454953803912*b,O=-(.002275545634920635*g+.004830845032667949*v+.006558395368616723*b),R=.0006957236677288761*v+.001775193002406544*b,$=-.000217324089394402*b,N=Math.cos(2*h);return h+Math.sin(2*h)*(-(.5*p+.2083333333333333*a+.09375*u+.04878472222222222*d+.02916666666666667*g+.01938905423280423*v+.01388255931712963*b)-S+O-$+N*(2*(.1041666666666667*a+.0875*u+.06050347222222222*d+.04151785714285714*g+.02958958540013228*v+.02203667534722222*b)-4*C+6*R+N*(4*S-12*O+24*$+N*(8*C-32*R+N*(16*O-80*$+N*(32*R+64*N*$))))))}return h==0||D.Y(D.P(h),1.570796326794897)?a=h:(d=(u=Math.sqrt(p))*Math.sin(h),a=Math.tan(.7853981633974483+h/2)*Math.pow((1-d)/(1+d),u/2),a=2*Math.atan(a)-1.570796326794897),a},E.yO=function(p,h){if(D.ti(p)||h==0||D.Y(D.P(h),1.570796326794897))return h;if(.006884661117170036>p){var a=p*(R=p*(O=p*(N=p*p))),u=p*($=p*a),d=.05833333333333333*O+.07232142857142858*R+.05634300595238095*a+.0355325796406526*$+.020235546186067*u,g=.02653149801587302*R+.04379960317460317*a+.0429211791776896*$+.03255384637546096*u,v=.01294022817460318*a+.02668104344536636*$+.03155651254609588*u,b=.00659454790965208*$+.0163075268674227*u,S=.003463473736911237*u,C=Math.cos(2*h);return h+Math.sin(2*h)*(.5*p+.2083333333333333*N+.08333333333333333*O+.03611111111111111*R+.01875*a+.01195601851851852*$+.008863673941798942*u-d+v-S+C*(2*(.1458333333333333*N+.1208333333333333*O+.07039930555555556*R+.03616071428571429*a+.01839451058201058*$+.01017113095238095*u)-4*g+6*b+C*(4*d-12*v+24*S+C*(8*g-32*b+C*(16*v-80*S+C*(32*b+64*C*S))))))}var O=Math.sqrt(p),R=O/2,$=Math.tan(.7853981633974483+h/2);p=0,d=1;for(var N=h;d!=0;N=u)a=O*Math.sin(N),u=$*Math.pow((1+a)/(1-a),R),u=2*Math.atan(u)-1.570796326794897,p++,(D.Y(u,N)||3e4this.Kk&&(this.Kk=0);var a=this.Ue.getType();if(this.jH=a==m.Sc.PE_TYPE_PROJCS?2:1,a==m.Sc.PE_TYPE_PROJCS&&!p.loadConstants())throw m.i.N("PeProjcs.loadConstants failed");h=a==m.Sc.PE_TYPE_GEOGCS?this.Ue:this.Ue.getGeogcs(),a!=m.Sc.PE_TYPE_GEOGCS&&m.pf.getCode(h),this.Eo=p.getUnit(),this.RH=h.getPrimem().getLongitude(),this.wH=p=h.getUnit().getUnitFactor(),p=Math.PI/(180*p),1e-10>Math.abs(p-1)&&(p=1),this.GA=p,a&m.Sc.PE_TYPE_PROJCS?(h=this.Ue,this.HA=1/h.getUnit().getUnitFactor(),this.sw=.001/this.Ue.getUnit().getUnitFactor(),this.tw=m.Cg.generate(h,m.Cg.PE_PCSINFO_OPTION_NONE),this.zl=this.tw.isPannableRectangle(),this.bA=m.zb.qN(this.tw.getCentralMeridian(),this.GA)):(this.KA=this.zl=!0,this.HA=0,a=1/h.getUnit().getUnitFactor(),this.sw=.001/h.getDatum().getSpheroid().getAxis()*a,this.bA=0),this.zl&&(this.xx(),this.DK(),this.nY(),this.CK(),this.lY(),this.mY())}return E.prototype.$r=function(){return this.Kk},E.prototype.kk=function(){return this.tw},E.Py=function(p,h){return p==h||p!=null&&h!=null&&p.Kk==0&&h.Kk==0&&p.As===h.As},E.prototype.Wc=function(){return this.zl},E.prototype.gh=function(p){p.K(this.so)},E.prototype.pv=function(){return this.so.v},E.prototype.ov=function(){return this.so.C},E.prototype.GR=function(p){p.K(this.uw)},E.prototype.lY=function(){var p=this.Ue.getType();if(p==m.Sc.PE_TYPE_PROJCS){p=this.Ue;var h=this.kk().getCentralMeridian(),a=p.getGeogcs();if(a==null)throw m.i.fa("internal error");h=[[h+(a=1/a.getUnit().getUnitFactor()*Math.PI),0]],m.ej.geogToProj(p,1,h),h=h[0][0],a=p.getParameters()[m.Sc.PE_PARM_X0].getValue();var u=this.ml();p=new m.l,u.A(p),h=(u=Math.abs(h-a))+a,a=-1*u+a,u=p.H,p=p.G;var d=new m.l;d.K(a,p,h,u),this.so==null&&(this.so=d)}else{if(p!=m.Sc.PE_TYPE_GEOGCS)throw m.i.fa("internal error");a=1/this.Ue.getUnit().getUnitFactor()*Math.PI,(p=new m.l).K(-a,-a/2,a,a/2),this.so==null&&(this.so=p)}},E.prototype.mY=function(){var p=this.Ue.getType();if(p==m.Sc.PE_TYPE_PROJCS){var h=this.Ue;if(p=this.kk().getCentralMeridian(),(h=h.getGeogcs())==null)throw m.i.fa("internal error");h=1/h.getUnit().getUnitFactor()*Math.PI;var a=this.Vr(),u=new m.l;a.A(u),(a=new m.l).K(p-h,u.G,p+h,u.H),this.uw==null&&(this.uw=a)}else{if(p!=m.Sc.PE_TYPE_GEOGCS)throw m.i.fa("internal error");h=1/this.Ue.getUnit().getUnitFactor()*Math.PI,(p=new m.l).K(-h,-h/2,h,h/2),this.uw==null&&(this.uw=p)}},E.prototype.bf=function(){return this.GA},E.prototype.pm=function(){return this.HA},E.prototype.Vr=function(){if(this.zl)return this.ul;var p=this.ul;return p??(this.xx(),this.ul)},E.prototype.Wr=function(){return this.zl?null:(this.ul!=null||this.xx(),this.YG)},E.prototype.xx=function(){if(this.Ue.getType()==m.Sc.PE_TYPE_PROJCS){var p=this.Ue,h=p.getGeogcs(),a=p.horizonGcsGenerate();if(a!=null){var u=a[0].getNump(),d=a[0].getKind();p=0S&&(a=-400*g,O.K(a,O.G,a+5*b,O.H)),a=new m.Fh(O),this.ul==null&&(this.ul=a,this.Iv=p);else{if(S=new m.Da,b=this.kk().isGcsHorizonMultiOverlap(),O=m.gu.bF(h,m.hu.Integer64),b){for(S=new m.gL,C=m.Gh.local().V(S,O,null),$=0;$this.ss&&(this.ss=0),this.Eo=h=this.KT.getUnit(),this.IH=1/h.getUnitFactor(),m.pf.getCode(p)}return E.Py=function(p,h){return p==h||p!=null&&h!=null&&p.ss==0&&h.ss==0&&p.As===h.As},E.prototype.$r=function(){return this.ss},E}();m.PL=D}(ie||(ie={})),function(m){m.Yg=function(){function D(){}return D.tb=function(E,p,h,a,u,d,g,v){if(d!=null||g!=null||v!=null){a=m.F.ba(a),p=m.F.ba(p),h=m.F.ba(h),u=m.F.ba(u),1.570796326794897h?a:m.F.ba(3.141592653589793-a):Math.atan2(O*N,S*R-C*O*$)),v!=null&&(m.s.Y(m.s.P(u),1.570796326794897)?v.u=0>u?p:m.F.ba(3.141592653589793-p):(v.u=Math.atan2(S*N,R*S*$-O*C),v.u=m.F.ba(v.u+3.141592653589793)))}}},D.rf=function(E,p,h,a,u,d,g){if(d!=null||g!=null){p=m.F.ba(p),h=m.F.ba(h),1.570796326794897R?u:m.F.ba(3.141592653589793-u):p:m.s.Y(m.s.P(h),1.570796326794897)&&m.s.Y(E,3.141592653589793)?0>h?u:m.F.ba(3.141592653589793-u):m.F.ba(p+Math.atan2(O*b,S*a-C*O*v)))}},D}()}(ie||(ie={})),function(m){m.Wk=function(){function D(){}return D.tb=function(E,p,h,a,u,d,g,v,b){var S=new m.ga(0),C=new m.ga(0),O=[0,0,0],R=[0,0,0],$=[0,0,0],N=new m.ga(0),B=new m.ga(0),G=new m.ga(0),K=new m.ga(0),ee=new m.ga(0);if(g!=null||v!=null||b!=null)if(m.s.ti(p))m.Yg.tb(E,h,a,u,d,g,v,b);else{u=m.F.ba(u),h=m.F.ba(h);var q=m.F.ba(u-h);if(m.s.Y(a,d)&&(m.s.Y(h,u)||m.s.Y(m.s.P(a),1.570796326794897)))g!=null&&(g.u=0),v!=null&&(v.u=0),b!=null&&(b.u=0);else{if(m.s.Y(a,-d)){if(m.s.Y(m.s.P(a),1.570796326794897))return g!=null&&(g.u=2*m.F.Ah(E,p)),v!=null&&(v.u=0q){oe=1;var ge=h;h=u,u=ge,ge=a,a=d,d=ge}q=m.F.ot(p,a);var me=m.F.ot(p,d);v==null&&b==null||(m.Yg.tb(E,h,q,u,me,null,S,C),S=Math.atan2(Math.sin(S.u)*Math.cos(a-q),Math.cos(S.u)),C=Math.atan2(Math.sin(C.u)*Math.cos(d-me),Math.cos(C.u)),oe!=0&&(ge=S,S=C,C=ge),v!=null&&(v.u=S),b!=null&&(b.u=C)),g!=null&&(m.F.cl(1,p,a,h,0,G,K,ee),O[0]=G.u,O[1]=K.u,O[2]=ee.u,m.F.cl(1,p,d,u,0,G,K,ee),R[0]=G.u,R[1]=K.u,R[2]=ee.u,$[0]=O[1]*R[2]-R[1]*O[2],$[1]=-(O[0]*R[2]-R[0]*O[2]),$[2]=O[0]*R[1]-R[0]*O[1],p=1-m.F.w(p,m.F.Vq(p,m.F.Qj(p,Math.acos($[2]/Math.sqrt($[0]*$[0]+$[1]*$[1]+$[2]*$[2]))))),p*=2-p,v=Math.atan2(-$[1],-$[0]),$=m.F.ba(v-1.570796326794897),v=m.F.ba(v+1.570796326794897),$=m.s.P(m.F.ba(h-$))<=m.s.P(m.F.ba(h-v))?$:v,m.Yg.tb(1,$,0,h,q,N,null,null),m.Yg.tb(1,$,0,u,me,B,null,null),3.141592653589793u&&(u=m.s.P(u),d=m.F.ba(d+3.141592653589793)),h=m.F.ba(h),a=m.F.ba(a),1.570796326794897=m.s.P(d)?1:-1);d=m.F.ba(h+Math.atan(Math.tan(d)*-Math.sin(G))),m.Yg.tb(E,d,0,h,G,null,C,null),G=m.s.P(1.570796326794897-m.s.P(C.u)),G=m.F.Qj(p,G),G=1-m.F.w(p,m.F.Vq(p,G)),G*=2-G,m.F.cl(1,p,0,d,0,$,N,B),O[0]=$.u,O[1]=N.u,O[2]=B.u,m.F.cl(1,p,a,h,0,$,N,B),R[0]=$.u,R[1]=N.u,R[2]=B.u,a=Math.acos((O[0]*R[0]+O[1]*R[1]+O[2]*R[2])/Math.sqrt(R[0]*R[0]+R[1]*R[1]+R[2]*R[2])),a=m.F.Qj(G,a),u=0<(a=m.F.q(E,G,a)+u*K)?C.u:m.F.ba(C.u+3.141592653589793),E=m.s.P(a)/m.F.Ah(E,G)*1.570796326794897,E=m.F.Rq(G,E),E=m.F.ot(G,E),m.Yg.rf(1,d,0,E,u,g,S),v!=null&&(b=S.u),v!=null&&(v.u=m.F.Qj(p,b))}},D}()}(ie||(ie={})),function(m){m.cu=function(){function D(){}return D.tb=function(E,p,h,a,u,d,g,v,b){var S=0,C=0,O=0;if(g!=null||v!=null||b!=null)if(m.s.ti(p))m.Yg.tb(E,h,a,u,d,g,v,b);else{var R=m.F.ba(u-h);if(m.s.Y(a,d)&&(m.s.Cd(R)||m.s.Y(m.s.P(a),1.570796326794897)))g!=null&&(g.u=0),v!=null&&(v.u=0),b!=null&&(b.u=0);else{if(m.s.Y(a,-d)){if(m.s.Y(m.s.P(a),1.570796326794897))return g!=null&&(g.u=2*m.F.Ah(E,p)),v!=null&&(v.u=0=Te&&!m.s.Y(Fe,oe));if(Me!=0)$=(N*=S)*(256+N*(N*(74-47*N)-128))/1024,g!=null&&(g.u=B*(1+N*(4096+N*(N*(320-175*N)-768))/16384)*(Mt-$*Xe*(C+$/4*(We*(2*O-1)-$/6*C*(4*Xe*Xe-3)*(4*O-3))))),v!=null&&(v.u=m.s.Y(m.s.P(a),1.570796326794897)?0>a?u:m.F.ba(3.141592653589793-u):Math.atan2(ee*me,p*q-K*ee*ge)),b!=null&&(m.s.Y(m.s.P(d),1.570796326794897)?b.u=0>d?h:m.F.ba(3.141592653589793-h):(b.u=Math.atan2(p*me,p*q*ge-K*ee),b.u=m.F.ba(b.u+3.141592653589793)));else{oe=m.s.Mb(3.141592653589793,R),We=K*q-p*ee,Mt=Math.acos(We),Xe=Math.sin(Mt),S=1,Te=lt=0;do O=lt,ge=1-.25*(lt=$*(S*=S)*(1+$+$*$))+.1875*(C=$*$*(ge=S*S)*(1+2.25*$))-.1953125*(Me=$*$*$*ge*S),lt=.25*lt-.25*C+.29296875*Me,me=.03125*C-.05859375*Me,Me*=.00651041666666667,C=We-2*K*q/S,1=Te&&!m.s.Y(O,lt));g!=null&&(ge=1+(N*=S*=S)*(4096+N*(N*(320-175*N)-768))/16384,m.s.Y(a,-d)?g.u=3.141592653589793*B*ge:(C=We-2*K*q/S,S=Math.acos(C),We=Math.cos(2*S),Fe=Math.cos(3*S),g.u=B*(ge*Mt+N*(N*(128+N*(35*N-60))-512)/2048*Xe*C+N*(5*N-4)/6144*N*N*Math.sin(2*Mt)*We+Me*Math.sin(3*Mt)*Fe+-762939453125e-16*N*N*N*N*Math.sin(4*Mt)*Math.cos(4*S)))),v!=null&&(m.s.Cd(a)&&m.s.Cd(d)?(S=Math.sqrt(1-lt*lt),v.u=Math.acos(S),0>R&&(v.u*=-1)):m.s.Y(m.s.P(a),1.570796326794897)?v.u=0>a?u:m.F.ba(3.141592653589793-u):(g=lt/p,B=Math.sqrt(1-g*g),0>p*q-K*ee*Math.cos(oe)&&(B*=-1),v.u=Math.atan2(g,B),m.s.Y(a,-d)&&m.s.P(m.F.ba(h-u))>3.141592653589793*(1-$*Math.cos(a))&&(0m.s.P(v.u)||0>a&&1.570796326794897d?h:m.F.ba(3.141592653589793-h):(R=lt/ee,g=Math.sqrt(1-R*R),B=Math.sin(oe/2),0>Math.sin(G-E)-2*p*q*B*B&&(g*=-1),b.u=Math.atan2(R,g),b.u=m.F.ba(b.u+3.141592653589793),m.s.Y(a,-d)&&!m.s.Cd(a)&&!m.s.Y(m.s.P(a),1.570796326794897)&&m.s.P(m.F.ba(h-u))>3.141592653589793*(1-$*Math.cos(a))&&(v!=null?B=v.u:(g=lt/p,B=Math.sqrt(1-g*g),0>p*q-K*ee*Math.cos(oe)&&(B*=-1),B=Math.atan2(g,B),m.s.Y(a,-d)&&m.s.P(m.F.ba(h-u))>3.141592653589793*(1-$*Math.cos(a))&&(0m.s.P(B)||0>a&&1.570796326794897=m.s.P(B)&&1.570796326794897m.s.P(b.u))&&(b.u=-1*m.F.ba(b.u+3.141592653589793))))}}}},D.rf=function(E,p,h,a,u,d,g,v){if(g!=null||v!=null)if(m.s.ti(p))m.Yg.rf(E,h,a,u,d,g,v);else if(d=m.F.ba(d),m.s.Y(m.s.P(a),1.570796326794897)||m.s.Cd(d)||m.s.Y(m.s.P(d),3.141592653589793))m.Wk.rf(E,p,h,a,u,d,g,v);else{var b=m.s.P(d)==1.570796326794897?0:Math.cos(d),S=m.s.P(d)==3.141592653589793?0:Math.sin(d);m.s.Y(m.s.P(a),1.570796326794897)&&(h=0),d=1-Math.sqrt(1-p);var C=m.F.Vq(p,a);a=m.s.P(C)==1.570796326794897?0:Math.cos(C);var O=Math.sin(C);C=Math.atan2(Math.tan(C),b);var R=a*S,$=R*R,N=1-$,B=p/(1-p)*N,G=(p=B*(256+B*(B*(74-47*B)-128))/1024)/4,K=p/6,ee=u/(E*(1-d)*(1+B*(4096+B*(B*(320-175*B)-768))/16384)),q=ee;do{var oe=q;u=m.s.P(q)==1.570796326794897?0:Math.cos(q);var ge=(B=m.s.P(q)==3.141592653589793?0:Math.sin(q))*B;q=p*B*((E=Math.cos(2*C+q))+G*(u*(2*(q=E*E)-1)-K*E*(4*ge-3)*(4*q-3)))+ee}while(!m.s.Y(oe,q));u=m.s.P(q)==1.570796326794897?0:Math.cos(q),B=m.s.P(q)==3.141592653589793?0:Math.sin(q),g!=null&&(S=Math.atan2(B*S,a*u-O*B*b),N=d/16*N*(4+d*(4-3*N)),E=Math.cos(2*C+q),g.u=m.F.ba(h+(S-(1-N)*d*R*(q+N*B*(E+N*u*(2*E*E-1)))))),v!=null&&(N=O*B-a*u*b,N=(1-d)*Math.sqrt($+N*N),v.u=Math.atan2(O*u+a*B*b,N))}},D}()}(ie||(ie={})),function(m){m.PC=function(){function D(){}return D.tb=function(E,p,h,a,u,d,g,v,b){var S=m.F.ba(u-h),C=m.s.Y(m.s.P(a),1.570796326794897),O=m.s.Y(m.s.P(d),1.570796326794897);if(m.s.Y(a,d)&&(m.s.Cd(S)||C))g!=null&&(g.u=0),v!=null&&(v.u=0),b!=null&&(b.u=0);else{if(m.s.ti(p)){var R=Math.sin(a),$=Math.sin(d);R=Math.sqrt((1+R)/(1-R)),$=Math.sqrt((1+$)/(1-$)),R=Math.log($)-Math.log(R),R=Math.atan2(S,R),g!=null&&(g.u=m.s.Y(a,d)?m.s.P(E*Math.cos(a)*S):m.s.P((E*d-E*a)/Math.cos(R)))}else $=m.F.Qw(p,d),R=Math.sin(m.F.Qw(p,a)),$=Math.sin($),R=Math.sqrt((1+R)/(1-R)),$=Math.sqrt((1+$)/(1-$)),R=Math.log($)-Math.log(R),R=Math.atan2(S,R),g!=null&&(m.s.Y(a,d)?g.u=m.s.P(E*S*Math.cos(a)/m.F.w(p,a)):(S=m.F.q(E,p,a),E=m.F.q(E,p,d),g.u=m.s.P((E-S)/Math.cos(R))));v==null&&b==null||(g=m.F.ba(R+3.141592653589793),C&&O||!C&&!O||(C?R=0>a?u:m.F.ba(3.141592653589793-u):O&&(g=0>d?h:m.F.ba(3.141592653589793-h))),v!=null&&(v.u=R),b!=null&&(b.u=g))}},D.rf=function(E,p,h,a,u,d,g,v){d=m.F.ba(d),0>u&&(u=m.s.P(u),d=m.F.ba(d+3.141592653589793)),m.s.ti(p)?m.s.Y(m.s.P(a),1.570796326794897)?(h=0>a?d:m.F.ba(3.141592653589793-d),3.141592653589793>=(d=u/E%6.283185307179586)?E=a-m.s.Mb(d,a):(h=m.F.ba(h+3.141592653589793),E=-a+m.s.Mb(d-3.141592653589793,a))):m.s.Y(m.s.P(d),1.570796326794897)?(h=m.F.ba(h+m.s.Mb(u,d)/(E*Math.cos(a))),E=a):(E=a+u*Math.cos(d)/E,1.570796326794897a?d:m.F.ba(3.141592653589793-d),d=u/m.F.qW(E,p),3.141592653589793>=(d%=6.283185307179586)?E=a-m.s.Mb(d,a):(h=m.F.ba(h+3.141592653589793),E=-a+m.s.Mb(d-3.141592653589793,a)),E=m.F.Rq(p,E)):m.s.Y(m.s.P(d),1.570796326794897)?(h=m.F.ba(h+m.s.Mb(u,d)*m.F.w(p,a)/(E*Math.cos(a))),E=a):(E=1.570796326794897*(u*Math.cos(d)+m.F.q(E,p,a))/m.F.Ah(E,p),1.570796326794897Math.PI||Math.abs(a.y)>.5*Math.PI||Math.abs(u.y)>.5*Math.PI||(Math.abs(a.y)==.5*Math.PI||Math.abs(u.y)==.5*Math.PI)&&a.x!=u.x)return NaN;if(d=p.cB(d,Math.min(a.x,u.x),Math.max(a.x,u.x)),!new m.Nc(a.x,u.x).contains(d))return NaN;var g=D.construct(a);if(u=D.construct(u),g=p.Yu(h,g),u=p.Yu(h,u),(u=g.cF(u)).z.qg())return a.y;var v=new m.Wb;v.set(u.x),v.jm(u.z),v.No(-1);var b=new m.Wb;b.set(u.y),b.jm(u.z),b.No(-1);var S=new m.Wb;return S.set(b),S.Ag(b),(g=new m.Wb).set(v),g.Ag(v),g.add(S),g.sqrt(),g.qg()||v.qg()&&b.qg()?a.y:(a=Math.atan2(b.value(),v.value()),a=Math.atan2(g.value()*Math.cos(a-d),1-h),d=p.DP(h,m.h.construct(d,a)),h=new m.Nd(d.x,d.y,-d.z),d=u.value().Qh(d),h=u.value().Qh(h),Math.abs(h)Math.PI||Math.abs(a.y)>.5*Math.PI||Math.abs(u.y)>.5*Math.PI||(Math.abs(a.y)==.5*Math.PI||Math.abs(u.y)==.5*Math.PI)&&a.x!=u.x||Math.abs(d)>=.5*Math.PI||0d&&u.y>d||0>a.y&&0>u.y&&a.yMath.abs(g[1]-a.x)&&(a=g[0],g[0]=g[1],g[1]=a)),d))},p.cB=function(h,a,u){return h>u?h-=2*(a=Math.ceil((h-u)/(2*Math.PI)))*Math.PI:hu.x?(u.x-=u.x%360,-180>u.x&&(u.x+=360)):180u.y&&(u.y=-90);for(var d=-180,g=180,v=(E=5*h)-1,b=(p=(E+31)/32)-1;0<=b;b--)for(var S=v-32*b,C=Math.min(32,E-32*b),O=1;O=R?(a[b]|=1<=R?(a[b]|=1<>d&31;if(31<(d+=5)){var b=37-d;v&=(1<p)for(g=0;g=p[0]?p:'"'+p.trim()+'"'}var E=[];m.XC=function(){function p(){}return p.EQ=function(h){try{for(var a=0;ah||h>this.Aa)throw m.i.N();return this.bg[h]},p.prototype.Pf=function(h){return this.uh[h]},p.lz=function(h){return p.JM[h]},p.Tp=function(h){return p.SM[h]},p.Va=function(h){return p.rM[h]},p.prototype.hasAttribute=function(h){return 0<=this.uh[h]},p.prototype.iG=function(){return this.hasAttribute(1)},p.se=function(h){return p.eD[h]},p.prototype.LR=function(h){return this.Vs[h]},p.DG=function(h,a){return p.eD[h]===a},p.prototype.Nb=function(h){return this===h},p.prototype.An=function(){for(var h=m.O.Th(this.bg[0]),a=1;a++v&&E(g,S,d.eu),C[0]?b?S=v:(C=g.c,S=g.e+S+1):++S;C.lengthg.Bd&&C[0]?"-":"")+(1S?"e":"e+")+S:g.toString()}function E(g,v,b,S){var C=g.c,O=g.e+v+1;if(b===1?S=5<=C[O]:b===2?S=5O||C[O+1]!==void 0||1&C[O-1]):b===3?S=S||C[O]!==void 0||0>O:(S=!1,b!==0&&p("!Big.RM!")),1>O||!C[0])S?(g.e=-v,g.c=[1]):g.c=[g.e=0];else{if(C.length=O--,S)for(;9<++C[O];)C[O]=0,O--||(++g.e,C.unshift(1));for(O=C.length;!C[--O];C.pop());}return g}function p(g){throw(g=Error(g)).name="BigError",g}var h=-7,a=21,u=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d=function(){function g(v){if(v instanceof g)this.Bd=v.Bd,this.e=v.e,this.c=v.c.slice();else{var b,S,C;for(v===0&&0>1/v?v="-0":u.test(v+="")||p(NaN),this.Bd=v.charAt(0)=="-"?(v=v.slice(1),-1):1,-1<(b=v.indexOf("."))&&(v=v.replace(".","")),0<(S=v.search(/e/i))?(0>b&&(b=S),b+=+v.slice(S+1),v=v.substring(0,S)):0>b&&(b=v.length),S=0;v.charAt(S)=="0";S++);if(S==(C=v.length))this.c=[this.e=0];else{for(;v.charAt(--C)=="0";);for(this.e=b-S-1,this.c=[],b=0;S<=C;this.c[b++]=+v.charAt(S++));}}}return g.prototype.abs=function(){var v=new g(this);return v.Bd=1,v},g.prototype.cmp=function(v){var b=this.c,S=(v=new g(v)).c,C=this.Bd,O=v.Bd,R=this.e,$=v.e;if(!b[0]||!S[0])return b[0]?C:S[0]?-O:0;if(C!=O)return C;if(v=0>C,R!=$)return R>($^v)?1:-1;for(C=-1,O=(R=b.length)<($=S.length)?R:$;++C(S[C]^v)?1:-1;return R==$?0:R>($^v)?1:-1},g.prototype.jm=function(v){var b=this.c,S=(v=new g(v)).c,C=this.Bd==v.Bd?1:-1,O=g.rr;if((O!==~~O||0>O||1e6me?0:me,N.unshift(0);ee++$;$++){if(R!=(ee=K.length))var Me=R>ee?1:-1;else{var Te=-1;for(Me=0;++TeK[Te]?1:-1;break}}if(!(0>Me))break;for(v=ee==R?S:N;ee;){if(K[--ee]me&&E(q,O,g.eu,K[0]!==void 0),q},g.prototype.fS=function(){return 0this.cmp(0)},g.prototype.jt=function(v){var b,S=this.Bd,C=(v=new g(v)).Bd;if(S!=C)return v.Bd=-C,this.tI(v);var O=this.c.slice(),R=this.e,$=v.c,N=v.e;if(!O[0]||!$[0])return $[0]?(v.Bd=-C,v):new g(O[0]?this:0);if(S=R-N){for((b=0>S)?(S=-S,R=O):(N=R,R=$),R.reverse(),C=S;C--;R.push(0));R.reverse()}else for(R=((b=O.length<$.length)?O:$).length,S=C=0;CS;){if(O[--R]<$[R]){for(b=R;b&&!O[--b];O[b]=9);--O[b],O[R]+=10}O[R]-=$[R]}for(;O[--C]==0;O.pop());for(;O[0]==0;)O.shift(),--N;return O[0]||(v.Bd=1,O=[N=0]),v.c=O,v.e=N,v},g.prototype.tI=function(v){var b=this.Bd,S=(v=new g(v)).Bd;if(b!=S)return v.Bd=-S,this.jt(v);S=this.e;var C=this.c,O=v.e,R=v.c;if(!C[0]||!R[0])return R[0]?v:new g(C[0]?this:0*b);if(C=C.slice(),b=S-O){for(0C.length-R.length&&(S=R,R=C,C=S),b=R.length,S=0;b;)S=(C[--b]=C[b]+R[b]+S)/10|0,C[b]%=10;for(S&&(C.unshift(S),++O),b=C.length;C[--b]==0;C.pop());return v.c=C,v.e=O,v},g.prototype.pow=function(v){var b=this,S=new g(1),C=S,O=0>v;for((v!==~~v||-1e6>v||1e6>=1;)b=b.lr(b);return O?S.jm(C):C},g.prototype.round=function(v,b){var S=this;return v==null?v=0:(v!==~~v||0>v||1e6b&&p(NaN),(b=Math.sqrt(this.toString()))==0||b==1/0?((b=v.join("")).length+S&1||(b+="0"),(v=new g(Math.sqrt(b).toString())).e=((S+1)/2|0)-(0>S||1&S)):v=new g(b.toString()),b=v.e+(g.rr+=4);do S=v,v=C.lr(S.tI(this.jm(S)));while(S.c.slice(0,b).join("")!==v.c.slice(0,b).join(""));return E(v,g.rr-=4,g.eu),v},g.prototype.lr=function(v){var b=this.c,S=(v=new g(v)).c,C=b.length,O=S.length,R=this.e,$=v.e;if(v.Bd=this.Bd==v.Bd?1:-1,!b[0]||!S[0])return new g(0*v.Bd);if(v.e=R+$,CR;)O=N[$]+S[R]*b[$-R-1]+O,N[$--]=O%10,O=O/10|0;N[$]=(N[$]+O)%10}for(O&&++v.e,N[0]||N.shift(),R=N.length;!N[--R];N.pop());return v.c=N,v},g.prototype.toString=function(){var v=this.e,b=this.c.join(""),S=b.length;if(v<=h||v>=a)b=b.charAt(0)+(1v?"e":"e+")+v;else if(0>v){for(;++v;b="0"+b);b="0."+b}else if(0S)for(v-=S;v--;b+="0");else vthis.Bd&&this.c[0]?"-"+b:b},g.prototype.toExponential=function(v){return v==null?v=this.c.length-1:(v!==~~v||0>v||1e6=v&&(C=D(this,this.e+v),0>this.Bd&&this.c[0]&&0>C.indexOf("-")&&(C="-"+C));return h=b,a=S,C||p("!toFix!"),C},g.prototype.toPrecision=function(v){return v==null?this.toString():((v!==~~v||1>v||1e6d.get(R)?(d.set(b,2147483647),b=R):d.set(R,2147483647),S++;else{if(!(1&S))d.set(b,2147483647);else if(h)return a!=null&&(a[0]=!0),null;v.L(O),b=R,S=1}if(!(1&S))d.set(b,2147483647);else if(h)return a!=null&&(a[0]=!0),null;if(!h)for(d.Vd(0,d.size,function(N,B){return N-B}),R=0,$=d.size;R<$&&d.get(R)!=2147483647;R++)p.ve(d.get(R),C),u.add(C)}}return h?null:u},E}()}(ie||(ie={})),function(m){var D=function(){function E(){this.yf=new m.ia(0),this.ys=new m.ia(0),this.EH=1,this.Es=NaN}return E.prototype.sort=function(p,h,a,u){if(32>a-h)u.nr(h,a,p);else{var d=!0;try{for(var g=1/0,v=-1/0,b=h;bv&&(v=S)}if(this.reset(a-h,g,v,a-h)){for(b=h;bd&&u.nr(h+d,h+a,p);100p||a==h)&&(p=Math.min(E.hL,p),this.yf.Jb(p),this.yf.resize(p),this.yf.Wj(0,0,this.yf.size),this.EH=h,this.ys.resize(u),this.Es=(a-h)/(p-1),!0)},E.prototype.zF=function(p){return m.O.truncate((p-this.EH)/this.Es)},E.hL=65536,E}();m.Xt=D}(ie||(ie={})),function(m){var D,E;(E=D||(D={}))[E.enum_line=1]="enum_line",E[E.enum_arc=2]="enum_arc",E[E.enum_dummy=4]="enum_dummy",E[E.enum_concave_dip=8]="enum_concave_dip",E[E.enum_connection=3]="enum_connection";var p=function(){function g(){}return g.Qu=function(v,b,S,C,O,R){var $=new g;return $.Im=new m.h,$.Vm=new m.h,$.aw=new m.h,$.Im.L(v),$.Vm.L(b),$.aw.L(S),$.Co=C,$.qh=O,$.sh=R,$},g.construct=function(v,b,S,C){var O=new g;return O.Im=new m.h,O.Vm=new m.h,O.aw=new m.h,O.Im.L(v),O.Vm.L(b),O.aw.Rc(),O.Co=4,O.qh=S,O.sh=C,O},g}(),h=function(){function g(v,b,S,C,O,R){this.Yv=null,this.ya=0,this.EA=v,this.bI=this.$H=0,this.Ka=b,this.Mj=S,this.vk=C,this.Dq=O,this.Ub=R}return g.prototype.next=function(){for(var v=new m.Sa;;){if(this.ya==this.EA.I())return null;if(this.EA.ve(this.ya,v),this.ya++,!v.B())break}var b=!1;if(this.Yv==null&&(this.$H=v.Lg(),this.bI=v.ih(),this.Yv=d.buffer(v,this.Ka,this.Mj,this.vk,this.Dq,this.Ub),b=!0),this.yaC)throw m.i.N();if(v.B())return new m.Da(v.description);var $=new m.l;return v.xc($),0=O&&(O=96),R.rb=Math.abs(R.Ka),R.Kv=R.rb!=0?1/R.rb:0,isNaN(C)||C==0?C=1e-5*R.rb:C>.5*R.rb&&(C=.5*R.rb),12>O&&(O=12),(v=Math.abs(b)*(1-Math.cos(Math.PI/O)))>C?C=v:(v=Math.PI/Math.acos(1-C/Math.abs(b)))(O=m.O.truncate(v))&&(O=12,C=Math.abs(b)*(1-Math.cos(Math.PI/O))),R.vk=C,R.Dq=O,R.tA=Math.min(R.ct,.25*C),R.lE()},g.prototype.cv=function(){if(this.Id==null)this.Id=[];else if(this.Id.length!==0)return;var v=this.qE();v=m.O.truncate((v+3)/4);var b=.5*Math.PI/v;this.oA=b;for(var S=0;S<4*v;S++)this.Id.push(null);var C=Math.cos(b);b=Math.sin(b);var O=m.h.construct(0,1);for(S=0;S=this.Ka&&(v=new m.l,this.X.A(v),v.R()<=2*-this.Ka||v.ca()<=2*this.Ka))return new m.Da(this.X.description)}switch(this.X.getType()){case 33:return this.PN();case 550:return this.ON();case 1607:return this.RN();case 1736:return this.QN();case 197:return this.LN();default:throw m.i.Qa()}},g.prototype.RN=function(){if(this.EG(this.X)){var v=new m.Sa;this.X.ve(0,v);var b=new m.l;return this.X.A(b),v.Cb(b.sf()),this.Gu(v)}return this.X=this.WV(this.X),v=new a(this,this.oq),m.Gh.local().V(v,this.Mj,this.Ub).next()},g.prototype.QN=function(){if(this.Ka==0)return this.X;var v=m.Yl.local();if(this.cv(),this.X=v.V(this.X,null,!1,this.Ub),0>this.Ka){var b=this.X;return b=this.py(b,0,b.da()),v.V(b,this.Mj,!1,this.Ub)}return this.EG(this.X)?(v=new m.Sa,this.X.ve(0,v),b=new m.l,this.X.A(b),v.Cb(b.sf()),this.Gu(v)):(v=new u(this),m.Gh.local().V(v,this.Mj,this.Ub).next())},g.prototype.py=function(v,b,S){for(var C=new m.Da(v.description);bv.Ja(b))){var O=v.Ir(b),R=new m.l;if(v.Rj(b,R),0=this.Ka){if(this.Ka==0)v.ad(this.X,!1);else{var b=new m.Fh;this.X.bn(b),b.W(this.Ka,this.Ka),v.ad(b,!1)}return v}return v.ad(this.X,!1),this.X=v,this.jE(v,0)},g.prototype.jE=function(v,b){this.cv();var S=new m.Da(v.description),C=new m.h,O=new m.h,R=new m.h,$=new m.h,N=new m.h,B=new m.h,G=new m.h,K=new m.h,ee=v.Ja(b),q=v.Ba(b),oe=0;for(b=v.Ja(b);oev.Ja(b))return null;if(this.FG(v,b)&&0(v=-1>v?4:2*Math.PI/Math.acos(v)+.5)?v=4:v>this.Dq&&(v=this.Dq),m.O.truncate(v)},g.prototype.GD=function(v,b,S,C,O){this.cv();var R=new m.h;R.uc(S,b),R.scale(this.Kv);var $=new m.h;$.uc(C,b),$.scale(this.Kv),0>(R=Math.atan2(R.y,R.x)/this.oA)&&(R=this.Id.length+R),R=this.Id.length-R,0>($=Math.atan2($.y,$.x)/this.oA)&&($=this.Id.length+$),($=this.Id.length-$)R.I($))return 0>O||(O=v,R=new m.Sa,O.ve(O.Ba(b),R),this.yu(S,R)),1;var N=R.Na(R.Xa(R.Ob($))),B=new m.Dd;if(B.gg(-N.x,-N.y),R.Oc(B),C&&(this.tQ(R,$,O),2>R.I($)))return 0>O||(O=v,R=new m.Sa,O.ve(O.Ba(b),R),this.yu(S,R)),1;this.Zd.length=0;var G=R.Ob($);b=R.Xa(G);var K=O==1?R.Ma(b):R.U(b);v=O==1?R.U(b):R.Ma(b);var ee=!0;C=new m.h,$=new m.h;var q=new m.h,oe=new m.h,ge=new m.h,me=new m.h,Me=new m.h,Te=new m.h,Fe=new m.h,Xe=new m.h,We=this.rb;G=R.Ja(G);for(var Mt=0;MtK||0>ee&&K==0?this.Zd.push(p.Qu(oe,ge,C,2,this.Zd.length+1,this.Zd.length-1)):oe.qb(ge)||(this.Zd.push(p.construct(oe,C,this.Zd.length+1,this.Zd.length-1,"dummy")),this.Zd.push(p.construct(C,ge,this.Zd.length+1,this.Zd.length-1,"dummy"))),me.add($,Fe),this.Zd.push(p.Qu(ge,me,C,1,this.Zd.length+1,this.Zd.length-1)),oe.L(me),Xe.L(Fe),q.L(C),C.L($),Te.L(Me),K=b,b=v,ee=!1,v=O==1?R.U(b):R.Ma(b);return this.Zd[this.Zd.length-1].qh=0,this.Zd[0].sh=this.Zd.length-1,this.YV(S),B.gg(N.x,N.y),S.YD(B,S.da()-1),1},g.prototype.YV=function(v){for(var b=this.zO(),S=!0,C=b+1,O=b;C!=b;O=C){var R=this.Zd[O];C=R.qh!=-1?R.qh:(O+1)%this.Zd.length,R.Co!=0&&(S&&v.Lt(R.Im),R.Co==2?this.GD(v,R.aw,R.Im,R.Vm,!0):v.Ci(R.Vm),S=!1)}},g.prototype.zO=function(){this.Ks==null&&(this.Ks=[null,null,null,null,null,null,null,null,null]);for(var v=0,b=0,S=this.Zd.length;b=this.rb)return!0}return!1},g.prototype.tQ=function(v,b,S){for(var C=0;1>C;C++){var O=!1,R=v.Ob(b),$=v.Ja(R);if($==0)break;var N=$;if(3>$)break;!v.dc(R)&&(N=$-1),R=v.Xa(R),$=0di||0>Ct&&di==0||!this.Fv(oe,ee,q)||(Me.L(q),rn=!1,++lt,O=!0),rn){if(0.5*this.vk?(me.add(oe,ee),me.scale(.5),Xe.normalize(),Xe.ar(),We.L(Xe),We.scale(Mt-lt),me.add(We),v.mf($,me)):v.pd($,!0),lt=0}oe.L(ee),G=R}ee.L(q),$=R,R=B,B=0b?(this.oq=!1,v):(this.oq=!0,m.Fg.Mk(v,this.ct,!1,!0,this.Ub))},g.prototype.yu=function(v,b){if(b=b.D(),this.Id!=null&&this.Id.length!==0){var S=new m.h;S.L(this.Id[0]),S.Ct(this.rb,b),v.Lt(S);for(var C=1,O=this.Id.length;C=a?1:-1;case 1:if(p.G=a?1:-1;case 2:if(p.v>=a&&p.C>a)break;return p.C<=a?1:-1;case 3:if(!(p.G>=a&&p.H>a))return p.H<=a?1:-1}return 0},E.prototype.Ay=function(p,h){return p.getType()==1736?this.Cy(p,h):this.Dy(p)},E.prototype.Cy=function(p,h){if(this.Ca.R()==0||this.Ca.ca()==0)return p.Ia();var a=new m.l;p.xc(a),this.X=this.g.Ib(p);var u=new m.l,d=new m.l,g=new m.h,v=new m.h,b=[0,0,0,0,0,0,0,0,0],S=[0,0,0,0,0,0,0,0,0];new m.ig;var C=new m.yb,O=new m.ia(0);O.Jb(Math.min(100,p.I()));for(var R=!1,$=0;!R&&4>$;$++){var N=!1,B=(1&$)!=0,G=0;switch($){case 0:G=this.Ca.v,N=a.v<=G&&a.C>=G;break;case 1:G=this.Ca.G,N=a.G<=G&&a.H>=G;break;case 2:G=this.Ca.C,N=a.v<=G&&a.C>=G;break;case 3:G=this.Ca.H,N=a.G<=G&&a.H>=G}if(N)for(R=!0,N=this.g.Ob(this.X);N!=-1;){var K=-1,ee=-1,q=this.g.Xa(N),oe=q;do{var ge=this.g.bc(oe);ge==null&&(ge=C,this.g.D(oe,g),ge.Dc(g),this.g.D(this.g.U(oe),v),ge.Qc(v)),ge.A(u);var me=this.Lh(u,$,G),Me=0,Te=-1;if(me==-1){Me=0<(ge=ge.cq(B,G,b,S))?this.g.Ul(oe,S,ge):0,Me+=1;var Fe=oe,Xe=this.g.U(Fe);for(ge=0;gethis.g.Ja(N)?this.g.Zq(N):this.g.Rb(N)}}return R?p.Ia():(this.FB(),0S;S++){var C=!1,O=(1&S)!=0,R=0;switch(S){case 0:R=this.Ca.v,C=b.v<=R&&b.C>=R;break;case 1:R=this.Ca.G,C=b.G<=R&&b.H>=R;break;case 2:R=this.Ca.C,C=b.v<=R&&b.C>=R;break;case 3:R=this.Ca.H,C=b.G<=R&&b.H>=R}if(C){C=v,v=p.Ia(),(C=C.Ga()).Zi();for(var $,N=new m.h;C.$a();)for(var B,G=!0;C.Ha();){var K=C.ha();K.A(h);var ee=this.Lh(h,S,R);if(ee==-1){if(0<(ee=K.cq(O,R,u,d))){var q=0;$=K.ac();for(var oe=0;oe<=ee;oe++)if(q!=(B=oe=(S=m.O.truncate(Math.min(Math.ceil(S/p),2048)))))){for(var C=1;Cd.size)){var O=this;d.Vd(0,d.size,function(me,Me){return O.Mh(me,Me)}),a=new m.h,g=new m.h,v=new m.h,g.Rc();var R=-1;b=new m.ia(0),S=new m.ia(0),C=this.g.Gd();for(var $=this.g.Gd(),N=0,B=d.size;Nthis.Mh(R,ee)&&(this.g.D(ee,a),p?a.y==h:a.x==h)&&(b.add(R),q=!0,this.g.Ra(R,$,1)),0>this.Mh(R,G)&&(this.g.D(G,a),p?a.y==h:a.x==h)&&(q||b.add(R),this.g.Ra(R,C,1))}for(K=0,q=b.size;Kthis.Mh(B,K)&&(this.g.D(K,b),p?b.y==h:b.x==h)&&(G=K),K=-1;var ee=this.g.Ma(B);if(0>this.Mh(B,ee)&&(this.g.D(ee,b),p?b.y==h:b.x==h)&&(K=ee),G!=-1&&K!=-1)this.Kh(B,u,d),this.g.pd(B,!1),this.Kh(G,u,d),this.g.pd(G,!1),O=!0;else if(G!=-1||K!=-1){for(ee=N+1;eethis.Mh(q,oe)&&(this.g.D(oe,b),p?b.y==h:b.x==h)&&(ge=oe),oe=this.g.Ma(q);var me=-1;if(0>this.Mh(q,oe)&&(this.g.D(oe,b),p?b.y==h:b.x==h)&&(me=oe),ge!=-1&&me!=-1){this.Kh(q,u,d),this.g.pd(q,!1),this.Kh(ge,u,d),this.g.pd(ge,!1),O=!0;break}if(G!=-1&&me!=-1){this.zt(u,B,G,q,me,d),O=!0;break}if(K!=-1&&ge!=-1){this.zt(u,q,ge,B,K,d),O=!0;break}}}if(O)break}}}if(!O)break}R=g,S.L(a)}}this.g.Td(d)},E.prototype.Kh=function(p,h,a){a=this.g.Pa(p,a),h.set(a,-1),a=this.g.Pa(p,this.ji),this.dd.set(a,-1),(h=this.g.bd(p))!=-1&&this.g.Xa(h)==p&&(this.g.Jf(h,-1),this.g.Wg(h,-1))},E.prototype.zt=function(p,h,a,u,d,g){this.g.Bc(h,u),this.g.Cc(u,h),this.g.Cc(a,d),this.g.Bc(d,a),this.Kh(u,p,g),this.g.mi(u,!1),this.Kh(d,p,g),this.g.mi(d,!0)},E.prototype.Ty=function(){for(var p=0,h=this.dd.size;p=b?(a=this.g.Pa(v,this.ji),this.dd.set(a,-1),v=this.g.pd(v,!1),b==2&&(a=this.g.Pa(v,this.ji),this.dd.set(a,-1),this.g.pd(v,!1)),b=g,g=this.g.Rb(g),this.g.Jf(b,-1),this.g.$q(b)):(this.g.cp(g,!1),this.g.Wg(g,this.g.Ma(v)),this.g.Vj(g,b),d+=b,u++,g=this.g.Rb(g))}}for(p=0,h=this.dd.size;p=b?(a=this.g.Pa(v,this.ji),this.dd.set(a,-1),v=this.g.pd(v,!1),b==2&&(0<=(a=this.g.Pa(v,this.ji))&&this.dd.set(a,-1),this.g.pd(v,!1)),b=g,this.g.Jf(b,-1),this.g.$q(b)):(this.g.kn(g,!0),this.g.Vj(g,b),this.g.Jf(g,v),this.g.Wg(g,this.g.Ma(v)),this.g.cp(g,!1),d+=b,u++)}for(this.g.Rl(this.X,u),this.g.Tj(this.X,d),p=0,h=this.g.ld;h!=-1;h=this.g.ue(h))p+=this.g.I(h);this.g.bC(p)},E.By=function(p,h,a){return new E(h).Ay(p,a)},E.clip=function(p,h,a,u){if(p.B())return p;if(h.B())return p.Ia();if((a=p.getType())==33)return u=p.D(),h.contains(u)?p:p.Ia();if(a==197)return u=new m.l,p.A(u),u.Ea(h)?(h=new m.Fh,p.copyTo(h),h.Xo(u),h):p.Ia();var d=new m.l;if(p.xc(d),h.contains(d))return p;if(!h.isIntersecting(d))return p.Ia();if((d=p.Bb)!=null&&(d=d.Fk)!=null){if((d=d.Ro(h))==1){if(a!=1736)throw m.i.Qa();return(p=new m.Da(p.description)).tp(h),p}if(d==0)return p.Ia()}switch(a){case 550:a=null,d=p.I();for(var g=p.ub(0),v=0,b=0;b=a?1:-1;case 1:if(p.G=a?1:-1;case 2:if(p.v>=a&&p.C>a)break;return p.C<=a?1:-1;case 3:if(!(p.G>=a&&p.H>a))return p.H<=a?1:-1}return 0},E.prototype.Ay=function(p,h){return p.getType()==1736?this.Cy(p,h):this.Dy(p)},E.prototype.Cy=function(p,h){if(this.Ca.R()==0||this.Ca.ca()==0)return p.Ia();var a=new m.l;p.xc(a),this.X=this.g.Ib(p);var u=new m.l,d=new m.l,g=new m.h,v=new m.h,b=[0,0,0,0,0,0,0,0,0],S=[0,0,0,0,0,0,0,0,0],C=new m.yb,O=new m.ia(0);O.Jb(256);for(var R=!1,$=0;!R&&4>$;$++){var N=!1,B=(1&$)!=0,G=0;switch($){case 0:G=this.Ca.v,N=a.v<=G&&a.C>=G;break;case 1:G=this.Ca.G,N=a.G<=G&&a.H>=G;break;case 2:G=this.Ca.C,N=a.v<=G&&a.C>=G;break;case 3:G=this.Ca.H,N=a.G<=G&&a.H>=G}if(N)for(R=!0,N=this.g.Ob(this.X);N!=-1;){var K=!0,ee=-1,q=-1,oe=this.g.Xa(N),ge=oe;do{var me=this.g.bc(ge);me==null&&(me=C,this.g.D(ge,g),me.Dc(g),this.g.D(this.g.U(ge),v),me.Qc(v)),me.A(u);var Me=this.Lh(u,$,G),Te=0,Fe=-1;if(Me==-1){Te=0<(me=me.cq(B,G,b,S))?this.g.LX(ge,S,me):0,Te+=1;var Xe=ge,We=this.g.U(Xe);for(me=0;me$;$++){var N=!1,B=(1&$)!=0,G=0;switch($){case 0:G=this.Ca.v,N=b.v<=G&&b.C>=G;break;case 1:G=this.Ca.G,N=b.G<=G&&b.H>=G;break;case 2:G=this.Ca.C,N=b.v<=G&&b.C>=G;break;case 3:G=this.Ca.H,N=b.G<=G&&b.H>=G}if(N)for(N=v,v=p.Ia(),(N=N.Ga()).Zi();N.$a();)for(var K,ee=!0;N.Ha();){var q=N.ha();q.A(h);var oe=this.Lh(h,$,G);if(oe==-1){if(0<(oe=q.cq(B,G,u,d))){var ge=0;q.Yp(S);for(var me=0;me<=oe;me++)if(ge!=(K=meu.x&&(u.x+=p)}else R=h.y-this.Ca.G,d.y=m.lc.sign(a.y-h.y),u.y=p*m.lc.Cn(Math.floor(Math.abs(R/p)),R)+this.Ca.G,0>u.y&&(u.y+=p);R=O!=0?a.y-h.y:a.x-h.x;var $=Math.abs(R);if(65536<$/p)throw m.i.fa("internal error");if(0<$){$=m.O.truncate($/p)+2,g.length<$&&(g=m.O.lg($));for(var N=$=0;;N++){var B=new m.h;if(B.x=u.x+d.x*N*p,B.y=u.y+d.y*N*p,1<=(B=(O!=0?B.y-h.y:B.x-h.x)/R))break;0>=B||(g[$]=B,$++)}$!=0&&this.g.Ul(S,g,$)}}S=C}while(S!=b)}},E.prototype.Vl=function(p,h){for(var a=-1,u=new m.h,d=null,g=this.g.Ob(this.X);g!=-1;g=this.g.Rb(g))for(var v=this.g.Xa(g),b=0,S=this.g.Ja(g);bd.size)){var O=this;d.Vd(0,d.size,function(me,Me){return O.Mh(me,Me)}),a=new m.h,g=new m.h,v=new m.h,g.Rc();var R=-1;b=new m.ia(0),S=new m.ia(0),C=null;for(var $=this.g.Gd(),N=this.g.Gd(),B=0,G=d.size;Bg.compare(a)&&(p?a.y==h:a.x==h)&&(b.add(R),oe=!0,this.g.Ra(R,N,1)),this.g.D(K,a),0>g.compare(a)&&(p?a.y==h:a.x==h)&&(oe||b.add(R),this.g.Ra(R,$,1))}for(ee=0,oe=b.size;eeS.compare(b)&&(p?b.y==h:b.x==h)&&(G=K),K=-1;var ee=this.g.Ma(B);if(this.g.D(ee,b),0>S.compare(b)&&(p?b.y==h:b.x==h)&&(K=ee),G!=-1&&K!=-1)this.Kh(B,u,d),this.g.pd(B,!1),this.Kh(G,u,d),this.g.pd(G,!1),O=!0;else if(G!=-1||K!=-1){for(ee=N+1;eeS.compare(b)&&(p?b.y==h:b.x==h)&&(ge=oe),oe=this.g.Ma(q);var me=-1;if(this.g.D(oe,b),0>S.compare(b)&&(p?b.y==h:b.x==h)&&(me=oe),ge!=-1&&me!=-1){this.Kh(q,u,d),this.g.pd(q,!1),this.Kh(ge,u,d),this.g.pd(ge,!1),O=!0;break}if(G!=-1&&me!=-1){this.zt(u,B,G,q,me,d),O=!0;break}if(K!=-1&&ge!=-1){this.zt(u,q,ge,B,K,d),O=!0;break}}}if(O)break}}}if(!O)break}R=g,S.L(a)}this.g.Td(d)}},E.prototype.Kh=function(p,h,a){a=this.g.Pa(p,a),h.set(a,-1),a=this.g.Pa(p,this.ji),this.dd.set(a,-1),(h=this.g.bd(p))!=-1&&this.g.Xa(h)==p&&(this.g.Jf(h,-1),this.g.Wg(h,-1))},E.prototype.zt=function(p,h,a,u,d,g){this.g.Bc(h,u),this.g.Cc(u,h),this.g.Cc(a,d),this.g.Bc(d,a),this.Kh(u,p,g),this.g.mi(u,!1),this.Kh(d,p,g),this.g.mi(d,!0)},E.prototype.Ty=function(){for(var p=0,h=this.dd.size;p=b?(a=this.g.Pa(v,this.ji),this.dd.set(a,-1),v=this.g.pd(v,!1),b==2&&(0<=(a=this.g.Pa(v,this.ji))&&this.dd.set(a,-1),this.g.pd(v,!1)),b=g,this.g.Jf(b,-1),this.g.$q(b)):(this.g.kn(g,!0),this.g.Vj(g,b),this.g.Jf(g,v),this.g.Wg(g,this.g.Ma(v)),this.g.cp(g,!1),d+=b,u++)}for(this.g.Rl(this.X,u),this.g.Tj(this.X,d),p=0,h=this.g.ld;h!=-1;h=this.g.ue(h))p+=this.g.I(h);this.g.bC(p)},E.By=function(p,h,a,u){return new E(h,u).Ay(p,a)},E.clip=function(p,h,a,u,d){return E.Nu(p,h,null,a,u,d)},E.Nu=function(p,h,a,u,d,g){var v=p.getType();if(v==33)return d=p.D(),h.contains(d)?p:p.Ia();if(v==197)return d=new m.l,p.A(d),d.Ea(h)?(h=new m.Fh,p.copyTo(h),h.Xo(d),h):p.Ia();if(p.B())return p;if(h.B())return p.Ia();var b=new m.l;if(p.xc(b),h.contains(b))return p;if(!h.isIntersecting(b))return p.Ia();if((a!=null||isNaN(u))&&m.ta.ty(a,h,!1),!m.aa.xj(v))throw m.i.N();if((a=p.Bb)!=null&&(a=a.Fk)!=null){if((a=a.Ro(h))==1){if(v!=1736)throw m.i.fa("internal error");return(p=new m.Da(p.description)).tp(h),p}if(a==0)return p.Ia()}switch(v){case 550:for(g=null,v=p.I(),a=p.ub(0),u=0,d=new m.h,b=0;b=b;b+=1)for(var S=0;1>=S;S+=1){var C=h.jG(g+b,v+S),O=this.xl.rR(C);O!=-1&&(this.pq[d]=O,this.xs[d]=C,d++)}for(g=d-1;1<=g;g--)for(O=this.pq[g],v=g-1;0<=v;v--)if(O==this.pq[v]){this.xs[v]=-1,g!=--d&&(this.xs[g]=this.xs[d],this.pq[g]=this.pq[d]);break}for(v=0;vv.Db())throw m.i.N();return b==0||v.B()?v:((R=new g(R)).ko=v,R.Ka=b,R.qa=O,R.Ki=S,R.CA=C,R.Rx())},g.prototype.eM=function(){var v=this.ko,b=v.ac(),S=v.wc(),C=new m.h;return C.uc(S,b),C.normalize(),C.Hv(),C.scale(this.Ka),b.add(C),S.add(C),C=v.Ia(),v.Dc(b),v.Qc(S),C},g.prototype.dM=function(){var v=this.ko;if(0R&&(0this.Ka?-E:E,-1B&&(.017453292519943295>(G=2*Math.acos(B))&&(G=.017453292519943295),1<($=m.O.truncate(E/G+1.5))&&(N/=$)),G=q+h,q=a.Pd(R,this.Ka,G),v==0&&(q.type|=1024),this.fc(q,v),B=this.Ka/Math.cos(N/2),G+=N/2,(q=a.Pd(R,B,G)).type|=1024,this.fc(q);0<--$;)G+=N,(q=a.Pd(R,B,G)).type|=1024,this.fc(q);(q=a.Pd(R,this.Ka,oe-h)).type|=1024,this.fc(q)}else if(this.Ki==1)q=a.Pd(R,this.Ka,q+h),this.fc(q,v),q=a.Pd(R,this.Ka,oe-h),this.fc(q);else if(this.Ki==0)for(B=1-S/Math.abs(this.Ka),$=1,N=oe-h-(q+h),-1B&&(.017453292519943295>(G=2*Math.acos(B))&&(G=.017453292519943295),1<($=m.O.truncate(Math.abs(N)/G+1.5))&&(N/=$)),B=this.Ka/Math.cos(.5*N),G=q+h+.5*N,q=a.Pd(R,B,G),this.fc(q,v);0<--$;)G+=N,q=a.Pd(R,B,G),this.fc(q);else this.Ki==2?(B=$.x-R.x,G=$.y-R.y,.99999999<($=(B*(K=N.x-R.x)+G*(ee=N.y-R.y))/Math.sqrt(B*B+G*G)/Math.sqrt(K*K+ee*ee))?(q=a.Pd(R,1.4142135623730951*this.Ka,oe-.25*E),this.fc(q,v),q=a.Pd(R,1.4142135623730951*this.Ka,oe+.25*E),this.fc(q)):($=Math.abs(this.Ka/Math.sin(.5*Math.acos($))))>(N=Math.abs(this.CA*this.Ka))?(B=.5*(oe-q),B=this.Ka/Math.abs(Math.sin(B)),q=a.Pd(R,B,.5*(q+oe)),oe=m.h.construct(q.x,q.y),q=m.h.construct(R.x,R.y),(R=new m.h).uc(oe,q),(oe=new m.h).HW(N/R.length(),R,q),q=($-N)*Math.abs(this.Ka)/Math.sqrt($*$-this.Ka*this.Ka),0q&&(oe-=p),$=q-oe(B=1.4142135623730951*this.Ka)?q+.25*E:q+.75*E,q=a.Pd(R,B,G),this.fc(q,v),G=0>B?oe-.25*E:oe-.75*E,q=a.Pd(R,B,G),this.fc(q)):(B=.5*(oe-q),B=this.Ka/Math.abs(Math.sin(B)),oeb))for(var S=0;S=C+1;b--)(S=a.al(v.Na(b))).type|=1024,this.wg.push(S);if(this.mE())if(2<=this.Yb.length){for(v=-1,(O=(1024&this.Yb[this.gf-1].type)!=0)||(v=0),b=1;b=Math.min(S.x,C.x)&&Math.max(S.x,C.x)>=Math.min(v.x,b.x)&&Math.max(v.y,b.y)>=Math.min(S.y,C.y)&&Math.max(S.y,C.y)>=Math.min(v.y,b.y)},g.prototype.xQ=function(v,b,S,C,O){O.bE=!1;var R=(b.y-v.y)*(C.x-S.x)-(b.x-v.x)*(C.y-S.y),$=(S.y-v.y)*(b.x-v.x)-(S.x-v.x)*(b.y-v.y);if(0<=(R=R==0?2:$/R)&&1>=R){var N=R;if(R=(C.y-S.y)*(b.x-v.x)-(C.x-S.x)*(b.y-v.y),$=(v.y-S.y)*(C.x-S.x)-(v.x-S.x)*(C.y-S.y),0<=(R=R==0?2:$/R)&&1>=R)return O.an=a.TO(v.x+R*(b.x-v.x),v.y+R*(b.y-v.y)),O.an.Uh=S.Uh+N*(C.Uh-S.Uh),N!=0&&N!=1||R!=0&&R!=1||(O.bE=!0),O.VY=R,O.WY=N,!((N==0||N==1)&&0R||(R==0||R==1)&&0N)}return!1},g.prototype.QO=function(v){for(;this.Yb[v].shv-(g*=2))return!0;d=new m.h;var b=new m.h,S=new m.h;u.tc(g,d),u.tc(g+2,b),u.tc(g+4,S);var C=a.Wu(b,S,d);if(C.ps()||!a.um(C.value()))return!1;var O=m.h.construct(b.x,b.y),R=new m.h;for(g+=6;gv;v++){u.mB(v,g);var b=this.Cr(g);if(b!=-1){u.Hf(v,d);var S=this.g.fc(this.Ss,d);this.Fa.Sj(b,S)}}},a.prototype.oN=function(u){var d=new m.Sa,g=u.ac();if((g=this.Cr(g))!=-1){u.To(d);var v=this.g.fc(this.Ss,d);this.Fa.Sj(g,v)}g=u.wc(),(g=this.Cr(g))!=-1&&(u.Po(d),u=this.g.fc(this.Ss,d),this.Fa.Sj(g,u))},a.prototype.nN=function(u){var d=u.D();(d=this.Cr(d))!=-1&&(u=this.g.fc(this.Ss,u),this.Fa.Sj(d,u))},a.prototype.Cr=function(u){var d=-1;if(this.Fa.size(-1)==0)return this.Fa.addElement(-4,-1);if(this.Fa.size(-1)==1){var g=this.g.Na(this.Fa.ja(this.Fa.rc(-1)));return u.Rz(g)||(d=this.Fa.xn(-5)),d}return this.pC(u)},a.prototype.pC=function(u){var d=-1;do{var g=this.Fa.rc(-1),v=this.Fa.Fc(-1),b=this.Fa.ja(g),S=this.Fa.ja(v),C=new m.h,O=new m.h;if(this.Xh.D(b,C),this.Xh.D(S,O),b=m.h.Uq(O,u,C),a.um(b))d=this.Fa.xn(-1),(C=this.nC(u,v,g))!=g&&this.oC(u,g,this.Fa.we(C));else if(a.CG(b)){O=this.Fa.sv(-1);var R=this.Fa.rc(-1),$=this.Fa.Fc(-1);for(b=new m.h,S=new m.h;R!=this.Fa.we($);){var N=this.Fa.ja(O);this.Xh.D(N,b),N=m.h.Uq(b,u,C),a.CG(N)?($=O,O=this.Fa.ll(O)):(R=O,O=this.Fa.Xp(O))}if(O=$,C=R,N=this.Fa.ja(O),R=this.Fa.ja(C),this.Xh.D(N,b),this.Xh.D(R,S),C!=g&&(b=m.h.Uq(S,u,b),!a.um(b)))continue;d=this.Fa.zu(C,O,-2,!1),this.oC(u,O,v),this.nC(u,C,g)}else this.sb==null&&(this.sb=new m.yb),this.sb.Dc(O),this.sb.Qc(C),0>(C=this.sb.fe(u,!0))?(C=this.Fa.we(v),this.Fa.vd(v,-1),d=this.Fa.xn(-3),this.nC(u,C,g)):1u},a.CG=function(u){return 0d)throw m.i.fa("Internal Error: max number of iterations exceeded");var b=this.nM(h);if(u=u||b,this.tH&&(b=this.g.Gp(h,!0,!1)!=0,u=u||b),b=!1,(g==0||v||m.$t.kI(!0,this.g,p,null,this.nd))&&(b=this.sM(a),u=u||b),!b)break;m.mp.zp(this.nd)}return u},E}();m.Tk=D}(ie||(ie={})),function(m){var D=function(){function p(h){this.$d=this.Mc=null,this.Ys=0,this.Ub=h,this.cA=!0}return p.prototype.uv=function(h,a){var u=this.g.bc(h);if(u==null){if(!this.g.ed(h,a))return null;u=a}return u},p.prototype.Xq=function(){var h;h===void 0&&(h=!1),this.Ys++,(h||!(4095&this.Ys))&&(this.Ys=0,m.mp.zp(this.Ub))},p.prototype.nP=function(){var h=this.g.Yq(!1),a=!1,u=new m.yb,d=new m.yb,g=new m.l;g.Oa();var v=new m.l;v.Oa();for(var b=new m.Sa,S=new m.TC,C=h.next();C!=-1;C=h.next()){m.mp.zp(this.Ub);var O=null,R=!1;if(!m.aa.Rn(this.g.ic(h.ck))){if((O=this.uv(C,u))==null)continue;if(O.A(g),g.W(this.qa,this.qa),O.Bi(this.qa)){if(!O.Bi(0))continue;R=!0,O=null}}var $=this.g.Yq(h),N=$.next();for(N!=-1&&(N=$.next());N!=-1;N=$.next()){var B=null,G=!1;if(!m.aa.Rn(this.g.ic($.ck))){if((B=this.uv(N,d))==null)continue;if(B.A(v),B.Bi(this.qa)){if(!B.Bi(0))continue;G=!0,B=null}}var K=0,ee=0;if(O!=null&&B!=null)g.HG(v)&&(S.Oo(O),S.Oo(B),S.Ea(this.qa,!1),0<(K=S.ol(0))+(ee=S.ol(1))&&(this.g.jr(C,S,0,!0),this.g.jr(N,S,1,!0)),S.clear());else if(O!=null){var q=new m.h;if(this.g.D(N,q),g.contains(q)){if(S.Oo(O),this.g.Vi(N,b),S.Kz(this.qa,b,!1),0<(K=S.ol(0)))if(this.g.jr(C,S,0,!0),G){for(G=-1,q=this.g.U(N);q!=-1&&q!=N&&(G=q,(B=this.uv(q,d))!=null&&B.Bi(0));q=this.g.U(q));for(q=N;q!=-1&&(this.g.Dh(q,S.Bf),q!=G);q=this.g.U(q));}else this.g.Dh(N,S.Bf);S.clear()}}else{if(B==null)continue;if(q=new m.h,this.g.D(C,q),v.W(this.qa,this.qa),v.contains(q)){if(S.Oo(B),this.g.Vi(C,b),S.Kz(this.qa,b,!1),0<(ee=S.ol(0)))if(this.g.jr(N,S,0,!0),R){for(G=-1,q=this.g.U(C);q!=-1&&q!=C&&(G=q,(B=this.uv(q,d))!=null&&B.Bi(0));q=this.g.U(q));for(q=C;q!=-1&&(this.g.Dh(q,S.Bf),q!=G);q=this.g.U(q));}else this.g.Dh(C,S.Bf);S.clear()}}if(K+ee!=0){if(K!=0){if((O=this.g.bc(C))==null){if(!this.g.ed(C,u))continue;O=u,u.A(g)}else O.A(g);if(O.Bi(this.qa))break}a=!0}}}return a},p.prototype.oP=function(){return this.QU()},p.prototype.QU=function(){return new m.RC().PX(this.g,this.qa)},p.prototype.lI=function(){var h=!1;this.Mc==null&&(this.Mc=new m.Yj);var a=new m.ia(0);a.Jb(this.g.fd+1);for(var u=this.g.Yq(),d=u.next();d!=-1;d=u.next())a.add(d);this.g.nx(a,a.size),a.add(-1),u=this.g.Gd(),d=this.g.Gd(),this.$d=new m.UC(this.g,this.qa,!this.cA),this.Mc.Vo(this.$d);var g=new m.ia(0),v=new m.ia(0),b=0;new m.h;var S=this.g.td;this.g.vb.mc();for(var C,O,R=this.g.vb.za[0].o,$=a.get(b++);$!=-1;){var N=C=R[2*(O=S.T($,0))],B=O=R[2*O+1];do{var G=S.T($,2),K=S.T($,1);if(G!=-1){var ee=S.T(G,0),q=R[2*ee];0>(B<(ee=R[2*ee+1])?-1:B>ee?1:Nq?1:0)&&(v.add($),v.add(G))}K!=-1&&(q=R[2*(ee=S.T(K,0))],0>(B<(ee=R[2*ee+1])?-1:B>ee?1:Nq?1:0)&&(v.add(K),v.add(K))),(q=this.g.Pa($,u))!=-1&&(g.add(q),this.g.Ra($,u,-1)),(q=this.g.Pa($,d))!=-1&&(g.add(q),this.g.Ra($,d,-1)),($=a.get(b++))!==-1&&(N=R[2*(B=S.T($,0))],B=R[2*B+1])}while($!=-1&&N===C&&B===O);for(N=g.size==1&&v.size==2,q=B=-1,G=0,K=g.size;Gh.fd?h=a.nP():a.oP())},p.V=function(h,a,u){return p.fQ(h,h.IF(),a,u)},p.kI=function(h,a,u,d,g){if(!p.yE(a))return!1;var v=new p(g);if(v.g=a,v.qa=u,v.cA=h,v.lI())return d!=null&&d.Wt(v.Ni),!0;var b=new m.Dd;return b.$B(),a.Oc(b),(v=new p(g)).g=a,v.qa=u,v.cA=h,h=v.lI(),b.$B(),a.Oc(b),!!h&&(d!=null&&d.Wt(v.Ni),!0)},p.Ml=function(h,a){return!(16>(h=h.I()))&&2*h+Math.log(h)*Math.LOG10E/Math.log(2)*a<1*h*a},p.lP=function(h,a,u,d){var g=a.getType();if(m.aa.Hc(g))return new p(d).mP(h,a,u);throw m.i.fa("crack_A_with_B")},p.prototype.mP=function(h,a,u){var d=new m.l;h.xc(d);var g=new m.l;if(a.xc(g),g.W(u,u),!g.isIntersecting(d))return h;var v=h.Bb,b=null;v!=null&&(b=v.Fb),p.Ml(h,h.I())&&(b=m.ta.jj(h,g));var S=b!=null?b.getIterator():null,C=a.Ga();a=h.Ga();var O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(g=[];C.$a();)for(;C.Ha();){var R=C.ha();if(b!=null){for(S.Uo(R,u),v=S.next();v!=-1;v=S.next())if(this.Xq(),a.Vb(b.ja(v),-1),a.Ha()){var $=(v=a.ha()).Ea(R,null,O,null,u);for(v=0;v<$;++v){var N=O[v];if(N!=0&&N!=1){var B=a.wb(),G=new E;G.t=N,G.index=B,g.push(G)}}}}else{var K=new m.l;if(R.xc(K),K.W(u,u),d.isIntersecting(K)){for(a.Zi();a.$a();)for(;a.Ha();)if(this.Xq(),v=a.ha(),N=new m.l,v.xc(N),N.isIntersecting(K))for($=v.Ea(R,null,O,null,u),v=0;v<$;++v)(N=O[v])!=0&&N!=1&&(B=a.wb(),(G=new E).t=N,G.index=B,g.push(G))}}}if(g.length==0)return h;for(g=g.sort(E.Ey),h=h.Ia(),a.Zi();a.$a()&&!a.Ha(););for(u=a.ha(),d=new m.ig,b=-1,v=0,S=g.length;va.t?1:h.ta.index?1:-1},p}()}(ie||(ie={})),function(m){var D;(D=m.KK||(m.KK={}))[D.Left=0]="Left",D[D.Right=1]="Right",D[D.Coincident=2]="Coincident",D[D.Undefined=3]="Undefined",D[D.Uncut=4]="Uncut";var E=function(a,u,d,g,v,b,S,C,O,R,$){this.X=a,this.bt=u,this.Ns=d,this.tg=g,this.Lm=R,this.Al=$};m.uY=E;var p=function(){function a(u,d){this.JH=u,this.Hi=d}return a.prototype.qM=function(u,d){var g=new m.h;this.Hi.D(u,g);var v=new m.h;return this.Hi.D(d,v),(g=g.compare(v))!=0?g:(u=this.Hi.Pa(u,this.JH))<(d=this.Hi.Pa(d,this.JH))?-1:u==d?0:1},a}(),h=function(a,u,d,g,v,b,S,C,O){this.tg=a,this.Ns=u,this.OA=d,this.UH=g,this.Ei=v,this.Al=b,this.Lm=S,this.VH=C,this.OT=O};m.tY=h,m.LK=function(){function a(){}return a.JK=function(u,d,g,v,b,S){if(d.B())u=new E(d,4,-1,-1,NaN,4,-1,-1,NaN,-1,-1),b.push(u);else if(g.B())u=new E(d,4,-1,-1,NaN,4,-1,-1,NaN,-1,-1),b.push(u);else{var C=new m.gd;if(C.Ib(d),C.Ib(g),m.Tk.V(C,v,S,!0),C.fd==0)u=new E(d.Ia(),4,-1,-1,NaN,4,-1,-1,NaN,-1,-1),b.push(u);else{for(d=0,g=C.Gd(),v=C.ld;v!=-1;v=C.ue(v))for(S=C.Ob(v);S!=-1;S=C.Rb(S))for(var O=C.Xa(S),R=0,$=C.Ja(S);R<$;O=C.U(O),R++)C.Ra(O,g,d++);d=a.HM(g,C),a.cM(u,d,C,b)}}},a.HM=function(u,d){for(var g=d.fd,v=new m.ia(0),b=d.ld;b!=-1;b=d.ue(b))for(var S=d.Ob(b);S!=-1;S=d.Rb(S))for(var C=d.Xa(S),O=0,R=d.Ja(S);O(B=B.Ea(O,null,$,N,0))&&(v=new h(b,v,$[0],NaN,B,C,S,N[0],NaN),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1)),!0},a.wM=function(u,d,g,v,b,S,C){var O=new m.yb,R=new m.yb,$=[0,0],N=[0,0],B=d.bc(b);return B==null&&(d.ed(b,O),B=O),(O=d.bc(C))==null&&(d.ed(C,R),O=R),2>(B=B.Ea(O,null,$,N,0))&&(v=new h(b,v,$[0],NaN,B,C,S,N[0],NaN),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1),!0)},a.xM=function(u,d,g,v,b,S,C,O){var R=new m.yb,$=new m.yb,N=[0,0],B=[0,0],G=d.bc(b);return G==null&&(d.ed(b,R),G=R),(R=d.bc(C))==null&&(d.ed(C,$),R=$),(G=G.Ea(R,null,N,B,0))==2?(v=new h(b,v,N[0],N[1],G,C,S,B[0],B[1]),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1),!0):($=!1,b==O&&(v=new h(b,v,N[0],NaN,G,C,S,B[0],NaN),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1),$=!0),$)},a.yM=function(u,d,g,v,b,S,C,O){var R=new m.yb,$=new m.yb,N=[0,0],B=[0,0],G=d.bc(b);return G==null&&(d.ed(b,R),G=R),(R=d.bc(C))==null&&(d.ed(C,$),R=$),(G=G.Ea(R,null,N,B,0))==2?(v=new h(b,v,N[0],N[1],G,C,S,B[0],B[1]),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1),!0):($=!1,b==O&&(v=new h(b,v,N[0],NaN,G,C,S,B[0],NaN),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1),$=!0),$)},a.cM=function(u,d,g,v){var b=[];b[0]=new m.h,b[1]=new m.h,b[2]=new m.h,b[3]=new m.h;var S=new m.h,C=new m.h,O=new m.h,R=new m.h,$=null;v!=null&&($=new m.ig).Or();var N=0,B=null,G=new m.yb;new m.yb;for(var K=g.Ob(g.ld);K!=-1;K=g.Rb(K)){for(var ee=4,q=-1,oe=-1,ge=-1,me=-1,Me=NaN,Te=!0,Fe=!1,Xe=!0,We=!0,Mt=!0,lt=0,yi=K,di=0,Ct=g.Xa(K),rn=g.Ja(K),cs=0;cs=d.length-2||d[N+2].Ns!=q)&&(ee=0):ee=1):((zi!=Gi||Kr&&Gi==0)&&(v!=null?(dr=new E(B,3,q,nr,zi,ee,yi,oe,di,pr,Ri),v.push(dr)):null.add(lt)),ee=1):ee!=0?((zi!=Gi||Kr&&Gi==0)&&(v!=null?(dr=new E(B,0,q,nr,zi,ee,yi,oe,di,pr,Ri),v.push(dr)):null.add(lt)),jo?(N>=d.length-2||d[N+2].Ns!=q)&&(ee=1):ee=0):((zi!=Gi||Kr&&Gi==0)&&(v!=null?(dr=new E(B,3,q,nr,zi,ee,yi,oe,di,pr,Ri),v.push(dr)):null.add(lt)),ee=0),(zi!=Gi||Kr&&Gi==0)&&(Gi=zi,yi=q,oe=nr,di=zi,ge=pr,me=Ri,Me=Aa,Te=Xe=!1,We=Mt=!0))}}N++}Gi!=1&&(Mt&&(v!=null?B=new m.Ta:lt=0),v!=null?(on.ah(Gi,1,$),B.oc($.get(),We)):lt++,We=Mt=!1,Xe=!0)}Xe&&(zi=1,nr=g.rj(K),nr=g.Ma(nr),Ri=pr=-1,Aa=NaN,Te?v!=null?(dr=new E(B,4,q,nr,zi,ee,yi,oe,di,pr,Ri),v.push(dr)):null.add(lt):(Te=ee==1?0:ee==0?1:3,v!=null?(dr=new E(B,Te,q,nr,zi,ee,yi,oe,di,pr,Ri),v.push(dr)):null.add(lt)))}},a.CM=function(u,d,g,v,b,S){var C=g[v].VH;if(C==1)return a.AM(u,d,g,v,b,S);if(C==0)return a.BM(u,d,g,v,b,S);throw m.i.Qa()},a.AM=function(u,d,g,v,b,S){var C=new m.yb,O=g[v].tg,R=g[v].Lm,$=g[v].Al,N=-1,B=-1,G=-1,K=-1;if(!u&&0.01*h&&(u*=1+(1+(p=p.xb/h))*p),this.pb=a,this.xb=u+2220446049250313e-31*Math.abs(a)},E.prototype.sqrt=function(){if(0<=this.pb){var p=Math.sqrt(this.pb),h=this.pb>10*this.xb?.5*this.xb/p:this.pb>this.xb?p-Math.sqrt(this.pb-this.xb):Math.max(p,Math.sqrt(this.pb+this.xb)-p);h+=2220446049250313e-31*Math.abs(p)}else this.pb<-1*this.xb?h=p=NaN:(p=0,h=Math.sqrt(this.xb));this.pb=p,this.xb=h},E.prototype.sin=function(p){var h=Math.sin(p.pb),a=Math.cos(p.pb);this.pb=h,h=Math.abs(h),this.xb=(Math.abs(a)+.5*h*p.xb)*p.xb+2220446049250313e-31*h},E.prototype.cos=function(p){var h=Math.sin(p.pb),a=Math.cos(p.pb);this.pb=a,a=Math.abs(a),this.xb=(Math.abs(h)+.5*a*p.xb)*p.xb+2220446049250313e-31*a},E.prototype.qg=function(){return Math.abs(this.pb)<=this.xb},E.prototype.ps=function(){return this.qg()&&this.xb!=0},E}();m.Wb=D}(ie||(ie={}));var Lt=new ie.h,vt=new ie.h,Bt=new ie.h,qt=new ie.h,li=new ie.h;(function(m){var D,E;(E=D||(D={}))[E.closedPath=1]="closedPath",E[E.exteriorPath=2]="exteriorPath",E[E.ringAreaValid=4]="ringAreaValid";var p=function(){function h(a,u,d,g,v,b,S){u!==void 0?(this.ib=a,this.ck=u,this.bl=d,this.ii=g,this.ya=b,this.hA=S,this.ew=v):(this.ib=a.ib,this.ck=a.ck,this.bl=a.bl,this.ii=a.ii,this.ya=a.ya,this.hA=a.hA,this.ew=a.ew),this.bH=!0}return h.prototype.next=function(){return this.bH?(this.bH=!1,this.ii):this.ii!=-1?(this.ii=this.ib.U(this.ii),this.ya++,this.ii!=-1&&this.ii!=this.ew?this.ii:this.$T()):-1},h.prototype.$T=function(){for(this.bl=this.ib.Rb(this.bl),this.ya=0;this.ck!=-1;){for(;this.bl!=-1;this.bl=this.ib.Rb(this.bl))if(this.ew=this.ii=this.ib.Xa(this.bl),this.ii!=-1)return this.ii;if(this.ck=this.ib.ue(this.ck),this.ck==-1)break;this.hA&&!m.aa.Hc(this.ib.ic(this.ck))||(this.bl=this.ib.Ob(this.ck))}return-1},h.AP=function(a,u,d,g,v,b,S){return new h(a,u,d,g,v,b,S)},h}();m.zY=p,D=function(){function h(){this.jo=this.Am=this.wk=this.cd=this.Ck=this.vo=this.Oi=this.md=this.bi=this.Sg=this.We=this.Il=null,this.qw=this.ld=-1,this.fd=0,this.fA=!1,this.ht=this.it=this.vb=null}return h.prototype.Sh=function(a){return this.We!=null?this.We[a]:null},h.prototype.Xg=function(a,u){if(this.We==null){if(u==null)return;this.We=[];for(var d=0,g=this.vb.I();d=this.Oi.size&&(a=16>u?16:m.O.truncate(3*u/2),this.Oi.resize(a),this.vo.resize(a)),this.Oi.set(u,0),this.vo.set(u,0),u},h.prototype.sF=function(a){this.md.jd(a)},h.prototype.Vy=function(a){this.td.jd(a),this.fd--},h.prototype.oI=function(a){this.md==null&&(this.md=new m.$c(8),this.td=new m.$c(5),this.Oi=new m.be(0),this.vo=new m.be(0));var u=this.td.Ce(),d=0<=a?a:u;if(this.td.S(u,0,d),0>a){if(d>=this.vb.I()){if(a=16>d?16:m.O.truncate(3*d/2),this.vb.resize(a),this.We!=null)for(var g=0;gu.Ja(g))){var b=this.vf(a,-1);this.kn(b,u.dc(g));for(var S=u.Ba(g),C=u.Vc(g);Sa.Ja(u))return d;this.Il.Fd(a,a.Ba(u),a.Vc(u)),this.it=this.vb.ub(0);var g=this.vf(d,-1);this.kn(g,a.dc(u)||!0);var v=this.We!=null&&a.Ve!=null,b=a.Ba(u);for(u=a.Vc(u);b=u.size&&u.resize(Math.max(m.O.truncate(1.25*a),16),-1),u.write(a,d)},h.prototype.KF=function(a,u){return(a=this.JF(a))<(u=this.wk[u]).size?u.read(a):-1},h.prototype.aF=function(){this.wk==null&&(this.wk=[]);for(var a=0;aO:2>O)?(S=this.Zq(S),g=0$){var N=$;C!=null&&(N=0N){var B=N;if(C!=null&&(B=0g||v>this.fd-1)throw m.i.N("invalid call");if(g>v&&!this.dc(a))throw m.i.N("cannot iterate across an open path");for(a=0;u!=d;u=this.U(u))g=this.Ua(u),(v=this.Sh(g))!=null?a+=v.Qb():(v=this.Ua(this.U(u)),a+=this.vb.yr(g,v));return a},h.prototype.Dh=function(a,u){var d=this.Ua(a);this.vb.Ht(d,u),(d=this.Sh(d))!=null&&d.setStart(u),(a=this.Ma(a))!=-1&&(a=this.Ua(a),this.Sh(a)!=null&&d.setEnd(u))},h.prototype.Vi=function(a,u){a=this.Ua(a),this.vb.ve(a,u)},h.prototype.mf=function(a,u){this.Cb(a,u.x,u.y)},h.prototype.Cb=function(a,u,d){var g=this.Ua(a);this.vb.Cb(g,u,d),(g=this.Sh(g))!=null&&g.ZB(u,d),(a=this.Ma(a))!=-1&&(a=this.Ua(a),this.Sh(a)!=null&&g.Ql(u,d))},h.prototype.D=function(a,u){this.vb.D(this.td.T(a,0),u)},h.prototype.Gc=function(a,u){this.vb.za[0].tc(2*this.td.T(a,0),u)},h.prototype.Na=function(a){var u=new m.h;return this.vb.D(this.td.T(a,0),u),u},h.prototype.dG=function(a,u){this.it.tc(2*a,u)},h.prototype.Uc=function(a,u,d){return this.vb.Uc(a,this.Ua(u),d)},h.prototype.setAttribute=function(a,u,d,g){this.vb.setAttribute(a,this.Ua(u),d,g)},h.prototype.Ua=function(a){return this.td.T(a,0)},h.prototype.ih=function(){var a=new m.h;return this.D(void 0,a),a.y},h.prototype.fq=function(a,u){a=this.Ua(a),u=this.Ua(u);var d=this.vb.za[0].o;return d[2*a]===d[2*u]&&d[2*a+1]===d[2*u+1]},h.prototype.Dv=function(a,u){a=this.Ua(a);var d=this.vb.za[0].o;return d[2*a]===u.x&&d[2*a+1]===u.y},h.prototype.vX=function(a,u){if(1>u&&(u=1),this.Sg==null){if(u==1)return;this.Sg=m.Yc.Dn(this.vb.I(),1)}(a=this.Ua(a))>=this.Sg.size&&this.Sg.resize(a+1,1),this.Sg.write(a,u)},h.prototype.cG=function(a){return a=this.Ua(a),this.Sg==null||a>=this.Sg.size?1:this.Sg.read(a)},h.prototype.Ra=function(a,u,d){u=this.bi[u],a=this.Ua(a),u.sizev?1:bC?1:0})},h.prototype.jS=function(){for(var a=this.ld;a!=-1;a=this.ue(a))if(!m.aa.Hc(this.ic(a)))return!0;return!1},h.prototype.hC=function(a,u){for(var d=this.Ob(a),g=this.Ob(u),v=this.kv(a),b=this.kv(u),S=this.Ob(a);S!=-1;S=this.Rb(S))this.gx(S,u);for(S=this.Ob(u);S!=-1;S=this.Rb(S))this.gx(S,a);this.Zo(a,g),this.Zo(u,d),this.$o(a,b),this.$o(u,v),d=this.I(a),g=this.da(a),v=this.da(u),this.Tj(a,this.I(u)),this.Tj(u,d),this.Rl(a,v),this.Rl(u,g),d=this.cd.T(a,2),this.cd.S(a,2,this.cd.T(u,2)),this.cd.S(u,2,d)},h}(),m.gd=D})(ie||(ie={})),function(m){var D=function(E){function p(h,a,u,d){var g=E.call(this)||this;return g.$=new m.l,h===void 0?g.UE():typeof h=="number"?g.VO(h,a,u,d):h instanceof m.Sa?a!==void 0?g.Qu(h,a,u):g.WO(h):h instanceof m.ra?a!==void 0?g.YO(h,a):g.XO(h):h instanceof m.l?g.UO(h):g.UE(),g}return Ke(p,E),p.prototype.Qu=function(h,a,u){this.description=m.ee.og(),this.$.Oa(),h.B()||this.tu(h,a,u)},p.prototype.UO=function(h){this.description=m.ee.og(),this.$.K(h),this.$.normalize()},p.prototype.XO=function(h){if(h==null)throw m.i.N();this.description=h,this.$.Oa()},p.prototype.YO=function(h,a){if(h==null)throw m.i.N();this.description=h,this.$.K(a),this.$.normalize()},p.prototype.UE=function(){this.description=m.ee.og(),this.$.Oa()},p.prototype.WO=function(h){this.description=m.ee.og(),this.$.Oa(),h.B()||this.tu(h)},p.prototype.VO=function(h,a,u,d){this.description=m.ee.og(),this.K(h,a,u,d)},p.prototype.K=function(h,a,u,d){if(this.vc(),typeof h=="number")this.$.K(h,a,u,d);else for(this.Oa(),a=0,u=h.length;a=m.ra.Va(a))throw m.i.N();var d=this.description.Pf(a);return this.ou(),0<=d?this.ka[this.kR(this.description,h)+this.description.LR(d)-2+u]:m.ra.se(a)},p.prototype.ou=function(){if(this.vc(),this.ka==null&&2=m.ra.Va(a))throw m.i.ce();var d=this.description.Pf(a);return 0<=d?(this.ou(),this.ka[p.Gg(this.description,h)+this.description.$j(d)-2+u]):m.ra.se(a)},p.prototype.vD=function(h,a,u,d){if(this.vc(),a==0)h!=0?u!=0?this.$.H=d:this.$.C=d:u!=0?this.$.G=d:this.$.v=d;else{if(u>=m.ra.Va(a))throw m.i.ce();if(!this.hasAttribute(a)){if(m.ra.DG(a,d))return;this.re(a)}a=this.description.Pf(a),this.ou(),this.ka[p.Gg(this.description,h)+this.description.$j(a)-2+u]=d}},p.Gg=function(h,a){return a*(h.Ae.length-2)},p.prototype.Ea=function(h){this.vc();var a=new m.l;return h.A(a),this.$.Ea(a)},p.prototype.isIntersecting=function(h){return h instanceof m.l?this.$.isIntersecting(h):this.$.isIntersecting(h.$)},p.prototype.Ju=function(h,a){this.vc(),h.B()?this.Oa():a!==void 0?this.tu(h,a):this.$.Ju(h.Lg(),h.ih())},p.prototype.offset=function(h,a){this.vc(),this.$.offset(h,a)},p.prototype.normalize=function(){this.vc(),this.$.normalize()},p.prototype.sf=function(h){if(h===void 0){if(h=new m.Sa(this.description),this.B())return h;for(a=this.description.Aa,u=1;uthis.C&&(this.C=u.x),u.ythis.H&&(this.H=u.y)}}else if(p==null||p.length==0)this.Oa();else for(u=p[0],this.K(u.x,u.y),a=1;ap?this.v=p:this.Ch?this.G=h:this.Hp?this.v=p:this.Ch?this.G=h:this.Hthis.C||this.G>this.H)&&this.Oa())},E.prototype.scale=function(p){0>p&&this.Oa(),this.B()||(this.v*=p,this.C*=p,this.G*=p,this.H*=p)},E.prototype.zoom=function(p,h){this.B()||this.K(this.sf(),p*this.R(),h*this.ca())},E.prototype.isIntersecting=function(p){return!this.B()&&!p.B()&&(this.v<=p.v?this.C>=p.v:p.C>=this.v)&&(this.G<=p.G?this.H>=p.G:p.H>=this.G)},E.prototype.HG=function(p){return(this.v<=p.v?this.C>=p.v:p.C>=this.v)&&(this.G<=p.G?this.H>=p.G:p.H>=this.G)},E.prototype.Ea=function(p){return!this.B()&&!p.B()&&(p.v>this.v&&(this.v=p.v),p.Cthis.G&&(this.G=p.G),p.Hp.length)throw m.i.N();p[0]!=null?p[0].ma(this.v,this.G):p[0]=m.h.construct(this.v,this.G),p[1]!=null?p[1].ma(this.v,this.H):p[1]=m.h.construct(this.v,this.H),p[2]!=null?p[2].ma(this.C,this.H):p[2]=m.h.construct(this.C,this.H),p[3]!=null?p[3].ma(this.C,this.G):p[3]=m.h.construct(this.C,this.G)},E.prototype.wF=function(){return this.B()?0:this.R()*this.ca()},E.prototype.yR=function(){return this.B()?0:2*(this.R()+this.ca())},E.prototype.gk=function(){return(this.C+this.v)/2},E.prototype.Jp=function(){return(this.H+this.G)/2},E.prototype.R=function(){return this.C-this.v},E.prototype.ca=function(){return this.H-this.G},E.prototype.move=function(p,h){this.B()||(this.v+=p,this.G+=h,this.C+=p,this.H+=h)},E.prototype.Ju=function(p,h){if(h!==void 0)this.move(p-this.gk(),h-this.Jp());else if(p instanceof m.h)this.Ju(p.x,p.y);else{if(!(p instanceof m.Sa))throw m.i.N();h=(this.C-this.v)/2;var a=(this.H-this.G)/2;this.v=p.Lg()-h,this.C=p.Lg()+h,this.G=p.ih()-a,this.H=p.ih()+a}},E.prototype.offset=function(p,h){this.v+=p,this.C+=p,this.G+=h,this.H+=h},E.prototype.normalize=function(){if(!this.B()){var p=Math.min(this.v,this.C),h=Math.max(this.v,this.C);this.v=p,this.C=h,p=Math.min(this.G,this.H),h=Math.max(this.G,this.H),this.G=p,this.H=h}},E.prototype.dn=function(p){p.ma(this.v,this.G)},E.prototype.$I=function(p){p.ma(this.C,this.G)},E.prototype.cJ=function(p){p.ma(this.v,this.H)},E.prototype.en=function(p){p.ma(this.C,this.H)},E.prototype.fT=function(){return this.B()||this.v<=this.C&&this.G<=this.H},E.prototype.sf=function(){return m.h.construct((this.C+this.v)/2,(this.H+this.G)/2)},E.prototype.mz=function(){return m.h.construct(this.v,this.G)},E.prototype.contains=function(p,h){if(h!==void 0)return p>=this.v&&p<=this.C&&h>=this.G&&h<=this.H;if(p instanceof m.Sa)return this.contains(p.Lg(),p.ih());if(p instanceof m.h)return this.contains(p.x,p.y);if(p instanceof E)return p.v>=this.v&&p.C<=this.C&&p.G>=this.G&&p.H<=this.H;throw m.i.N()},E.prototype.hm=function(p,h){if(h!==void 0)return p>this.v&&pthis.G&&hthis.v&&p.Cthis.G&&p.H>>32);var h=m.O.Th(p);return p=this.C,p=m.O.truncate(p^p>>>32),h=m.O.Th(p,h),p=this.G,p=m.O.truncate(p^p>>>32),h=m.O.Th(p,h),p=this.H,p=m.O.truncate(p^p>>>32),m.O.Th(p,h)},E.prototype.xr=function(){return this.B()?2220446049250313e-29:2220446049250313e-29*(Math.abs(this.v)+Math.abs(this.C)+Math.abs(this.G)+Math.abs(this.H)+1)},E.prototype.zy=function(p,h){var a=this.Zj(p),u=this.Zj(h);if(a&u)return 0;if(!(a|u))return 4;var d=(a!=0?1:0)|(u!=0?2:0);do{var g=h.x-p.x,v=h.y-p.y;if(g>v?a&E.YC?(a&E.ju?(p.y+=v*(this.v-p.x)/g,p.x=this.v):(p.y+=v*(this.C-p.x)/g,p.x=this.C),a=this.Zj(p)):u&E.YC?(u&E.ju?(h.y+=v*(this.v-h.x)/g,h.x=this.v):(h.y+=v*(this.C-h.x)/g,h.x=this.C),u=this.Zj(h)):a!=0?(a&E.ku?(p.x+=g*(this.G-p.y)/v,p.y=this.G):(p.x+=g*(this.H-p.y)/v,p.y=this.H),a=this.Zj(p)):(u&E.ku?(h.x+=g*(this.G-h.y)/v,h.y=this.G):(h.x+=g*(this.H-h.y)/v,h.y=this.H),u=this.Zj(h)):a&E.ZC?(a&E.ku?(p.x+=g*(this.G-p.y)/v,p.y=this.G):(p.x+=g*(this.H-p.y)/v,p.y=this.H),a=this.Zj(p)):u&E.ZC?(u&E.ku?(h.x+=g*(this.G-h.y)/v,h.y=this.G):(h.x+=g*(this.H-h.y)/v,h.y=this.H),u=this.Zj(h)):a!=0?(a&E.ju?(p.y+=v*(this.v-p.x)/g,p.x=this.v):(p.y+=v*(this.C-p.x)/g,p.x=this.C),a=this.Zj(p)):(u&E.ju?(h.y+=v*(this.v-h.x)/g,h.x=this.v):(h.y+=v*(this.C-h.x)/g,h.x=this.C),u=this.Zj(h)),(a&u)!=0)return 0}while(a|u);return d},E.prototype.Zj=function(p){return(p.xthis.C?1:0)<<1|(p.ythis.H?1:0)<<3},E.prototype.Bi=function(p){return!this.B()&&(this.R()<=p||this.ca()<=p)},E.prototype.tb=function(p){return p instanceof m.h?Math.sqrt(this.iK(p)):Math.sqrt(this.px(p))},E.prototype.px=function(p){var h=0,a=0,u=this.v-p.C;return u>h&&(h=u),(u=this.G-p.H)>a&&(a=u),(u=p.v-this.C)>h&&(h=u),(u=p.G-this.H)>a&&(a=u),h*h+a*a},E.prototype.iK=function(p){var h=0,a=0,u=this.v-p.x;return u>h&&(h=u),(u=this.G-p.y)>a&&(a=u),(u=p.x-this.C)>h&&(h=u),(u=p.y-this.H)>a&&(a=u),h*h+a*a},E.prototype.cn=function(p){this.B()?p.Oa():p.K(this.v,this.C)},E.ju=1,E.ku=4,E.YC=3,E.ZC=12,E}();m.l=D}(ie||(ie={})),function(m){var D,E;(E=D||(D={}))[E.initialize=0]="initialize",E[E.initializeRed=1]="initializeRed",E[E.initializeBlue=2]="initializeBlue",E[E.initializeRedBlue=3]="initializeRedBlue",E[E.sweep=4]="sweep",E[E.sweepBruteForce=5]="sweepBruteForce",E[E.sweepRedBlueBruteForce=6]="sweepRedBlueBruteForce",E[E.sweepRedBlue=7]="sweepRedBlue",E[E.sweepRed=8]="sweepRed",E[E.sweepBlue=9]="sweepBlue",E[E.iterate=10]="iterate",E[E.iterateRed=11]="iterateRed",E[E.iterateBlue=12]="iterateBlue",E[E.iterateBruteForce=13]="iterateBruteForce",E[E.iterateRedBlueBruteForce=14]="iterateRedBlueBruteForce",E[E.resetRed=15]="resetRed",E[E.resetBlue=16]="resetBlue";var p=function(){function h(a,u){this.ci=a,this.dH=u}return h.prototype.nr=function(a,u,d){this.ci.JX(d,a,u,this.dH)},h.prototype.$p=function(a){return this.ci.Rr(a,this.dH)},h}();D=function(){function h(){this.ow=this.oo=this.ff=this.rd=null,this.wq=new m.l,this.Am=this.Hj=this.Ij=this.Ad=this.Ef=this.Ld=this.cw=this.fo=this.qd=this.Eb=null,this.Xb=-1,this.qa=0,this.Nk()}return h.prototype.kr=function(){this.Nk(),this.Pv=!0,this.Eb==null?(this.fo=new m.ia(0),this.Eb=[]):(this.fo.Bh(0),this.Eb.length=0)},h.prototype.ad=function(a,u){if(!this.Pv)throw m.i.Hb();var d=new m.l;d.K(u),this.fo.add(a),this.Eb.push(d)},h.prototype.Fp=function(){if(!this.Pv)throw m.i.Hb();this.Pv=!1,this.Eb!=null&&0this.Eb.length)return this.pe=this.Eb.length,this.Xb=5,!0;this.rd==null&&(this.rd=new m.sr(!0),this.oo=this.rd.getIterator(),this.Ld=new m.ia(0)),this.rd.kr();for(var a=0;athis.Eb.length||10>this.qd.length)return this.pe=this.Eb.length,this.Xb=6,!0;this.rd==null&&(this.rd=new m.sr(!0),this.oo=this.rd.getIterator(),this.Ld=new m.ia(0)),this.rd.kr();for(var a=0;athis.Eb.length||10>this.qd.length)return this.pe=this.Eb.length,this.Xb=6,!0;this.ff==null&&(this.ff=new m.sr(!0),this.ow=this.ff.getIterator(),this.Ef=new m.ia(0)),this.ff.kr();for(var a=0;athis.Eb.length||10>this.qd.length)return this.pe=this.Eb.length,this.Xb=6,!0;this.rd==null&&(this.rd=new m.sr(!0),this.oo=this.rd.getIterator(),this.Ld=new m.ia(0)),this.ff==null&&(this.ff=new m.sr(!0),this.ow=this.ff.getIterator(),this.Ef=new m.ia(0)),this.rd.kr();for(var a=0;a>1;return h.eq(a)?(this.rd.remove(u),this.pe!=0||(this.Af=this.Vf=-1,this.Ic=!0,!1)):(this.oo.EB(this.Eb[u].v,this.Eb[u].C,this.qa),this.Vf=u,this.Xb=10,!0)},h.prototype.QX=function(){return--this.pe==-1?(this.Af=this.Vf=-1,this.Ic=!0,!1):(this.Rg=this.Vf=this.pe,this.Xb=13,!0)},h.prototype.RX=function(){return--this.pe==-1?(this.Af=this.Vf=-1,this.Ic=!0,!1):(this.Vf=this.pe,this.Rg=this.qd.length,this.Xb=14,!0)},h.prototype.SX=function(){var a=this.Ld.get(this.pe-1),u=this.Ef.get(this.Rg-1),d=this.Rr(a,!0),g=this.Rr(u,!1);return d>g?this.ux():d>1;if(h.eq(a))return this.Df!=-1&&this.Ij.get(u)!=-1?(this.Ad.jd(this.Df,this.Ij.get(u)),this.Ij.set(u,-1)):this.rd.remove(u),this.pe!=0||(this.Af=this.Vf=-1,this.Ic=!0,!1);if(this.Cf!=-1&&0>1;if(h.eq(a))return this.Cf!=-1&&this.Hj.get(u)!=-1?(this.Ad.jd(this.Cf,this.Hj.get(u)),this.Hj.set(u,-1)):this.ff.remove(u),this.Rg!=0||(this.Af=this.Vf=-1,this.Ic=!0,!1);if(this.Df!=-1&&0>1;return this.rd.vj(a),this.Xb=4,!0},h.prototype.jT=function(){if(this.Vf=this.oo.next(),this.Vf!=-1)return!1;this.Af=this.Vf=-1;var a=this.Ef.get(this.Rg)>>1;return this.ff.vj(a),this.Xb=7,!0},h.prototype.gT=function(){if(this.Af=this.ow.next(),this.Af!=-1)return!1;var a=this.Ld.get(this.pe)>>1;return this.rd.vj(a),this.Xb=7,!0},h.prototype.hT=function(){if(--this.Rg==-1)return this.Xb=5,!0;this.wq.K(this.Eb[this.pe]);var a=this.Eb[this.Rg];return this.wq.W(this.qa,this.qa),!this.wq.isIntersecting(a)||(this.Af=this.Rg,!1)},h.prototype.iT=function(){if(--this.Rg==-1)return this.Xb=6,!0;this.wq.K(this.Eb[this.pe]);var a=this.qd[this.Rg];return this.wq.W(this.qa,this.qa),!this.wq.isIntersecting(a)||(this.Af=this.Rg,!1)},h.prototype.kJ=function(){return this.rd==null?(this.Ic=!0,!1):(this.pe=this.Ld.size,0>1],h.eq(a)?u.G-d:u.H+d):(u=this.qd[a>>1],h.eq(a)?u.G-d:u.H+d)},h}(),m.xC=D}(ie||(ie={})),function(m){var D=function(){function E(){}return E.construct=function(p,h,a,u,d,g){var v=new E;return v.v=p,v.G=h,v.Ye=a,v.C=u,v.H=d,v.Bg=g,v},E.prototype.Oa=function(){this.Ye=this.v=NaN},E.prototype.B=function(){return isNaN(this.v)},E.prototype.XS=function(){return isNaN(this.Ye)},E.prototype.K=function(p,h,a,u,d,g){u!==void 0?typeof p=="number"?(this.v=p,this.G=h,this.Ye=a,this.C=u,this.H=d,this.Bg=g):(this.v=p.x-.5*h,this.C=this.v+h,this.G=p.y-.5*a,this.H=this.G+a,this.Ye=p.z-.5*u,this.Bg=this.Ye+u):(this.v=p,this.G=h,this.Ye=a,this.C=p,this.H=h,this.Bg=a)},E.prototype.move=function(p){this.v+=p.x,this.G+=p.y,this.Ye+=p.z,this.C+=p.x,this.H+=p.y,this.Bg+=p.z},E.prototype.copyTo=function(p){p.v=this.v,p.G=this.G,p.C=this.C,p.H=this.H},E.prototype.Lk=function(p,h,a){this.v>p?this.v=p:this.Ch?this.G=h:this.Ha?this.Ye=a:this.Bgp.length)throw m.i.N();p[0]=new m.Nd(this.v,this.G,this.Ye),p[1]=new m.Nd(this.v,this.H,this.Ye),p[2]=new m.Nd(this.C,this.H,this.Ye),p[3]=new m.Nd(this.C,this.G,this.Ye),p[4]=new m.Nd(this.v,this.G,this.Bg),p[5]=new m.Nd(this.v,this.H,this.Bg),p[6]=new m.Nd(this.C,this.H,this.Bg),p[7]=new m.Nd(this.C,this.G,this.Bg)},E.prototype.Zw=function(p){if(p==null||p.length==0)this.Oa();else{var h=p[0];for(this.K(h.x,h.y,h.z),h=1;hthis.FA;){var b=this.sd.ha();if(d.L(b.ac()),g.L(b.wc()),d.scale(this.Wa.ec),g.scale(this.Wa.ec),m.cj.Mu(d,g)?d.x=g.x:m.cj.Ku(d,g)&&(g.x=d.x),this.uk.length=0,m.cj.tF(this.Wa.Tb,this.Wa.kc,this.Wa.ze,d,g,this.Wa.QA,this.Wa.Zs,v,this.Nj,this.Gs,this.uk,this.bw),this.co!=null&&(b=this.uk.slice(0),this.co.qG(this.co.da()-1,b,b.length-1)),m.cj.Lu(d,g)?(this.qq.Oa(),this.Wa.sy(d,this.sl,this.qq),this.Xn=!0):(this.qq.Oa(),this.Xn=this.xy(v[0],this.qq)),this.Xn){if(this.sd.li(),this.sd.Ez()){this.sd.li(),this.sd.ha();break}this.sd.DW();break}a==null&&(a=new m.Da).Yk(null,0),this.OD(a),u++}if(this.bw[0]=0,0=this.Nj[0]){var v=this.di+1.570796326794897;d=v+3.141592653589793-(this.di-this.Nj[0])}else d=(v=this.di+1.570796326794897)+3.141592653589793-(6.283185307179586-(this.Nj[0]-this.di));var b=!(this.di>=this.Nj[0]&&3.141592653589793>=this.di-this.Nj[0])&&!(this.div;)C-=6.283185307179586;Cu.x-this.sk[0]?this.sk[0]-=6.283185307179586:3.141592653589793v?S.xX():S.$n=v,d=a.getType(),m.aa.yd(d)?((d=new m.Ta(a.description)).oc(a,!0),a=d,d=1607):d==197&&(d=new m.l,a.A(d),d.R()<=S.qa||d.ca()<=S.qa?((d=new m.Ta(a.description)).ad(a,!1),a=d,d=1607):((d=new m.Da(a.description)).ad(a,!1),a=d,d=1736)),S.yX(),m.aa.Rn(d)||S.zX(),S.rb<=.5*S.$n)return d!=1736?new m.Da(a.description):S.Wv?a:m.cj.Qr(a,S.Qg,S.ze,S.QA,-1,b);if(0>S.Ka&&d!=1736)return new m.Da(a.description);if(S.Wv&&m.aa.Hc(d)?(u=m.cj.Qr(a,u,4,NaN,S.$n,b),a=m.cb.zh(u,S.Qg,S.Jc)):a=m.cb.zh(a,S.Qg,S.Jc),(a=m.Hh.lj(a,S.Jc)).B())return new m.Da(a.description);switch(!S.Wv&&m.aa.Hc(d)&&(a=m.cj.pI(S.ec,a)),a=h.KX(a,S.Jc),d){case 1736:u=S.UN(a);break;case 1607:u=S.VN(a);break;case 550:u=S.SN(a);break;case 33:u=S.TN(a);break;default:throw m.i.fa("corrupted_geometry")}return(S=m.cb.zh(u,S.Jc,S.Qg)).Jl(a.description),S},h.prototype.UN=function(a){var u=new m.Da;a=new E(this,a,u),a=m.Gh.local().V(a,this.Jc,this.Ub).next(),a=m.ip.nj(a,this.Jc,2);var d=new m.Dd;return d.scale(1/this.ec,1/this.ec),u.Oc(d),u=m.ip.nj(u,this.Jc,2),0<=this.Ka?m.Gh.local().V(u,a,this.Jc,this.Ub):m.kp.local().V(u,a,this.Jc,this.Ub)},h.prototype.VN=function(a){return a=new E(this,a,null),a=m.Gh.local().V(a,this.Jc,this.Ub).next(),m.ip.nj(a,this.Jc,2)},h.prototype.SN=function(a){return a=new D(this,a),a=m.Gh.local().V(a,this.Jc,this.Ub).next(),m.ip.nj(a,this.Jc,2)},h.prototype.TN=function(a){(a=a.D()).scale(this.ec);var u=new m.Da;return this.sy(a,!1,u),m.ip.nj(u,this.Jc,2)},h.prototype.xy=function(a,u,d,g,v,b){var S=a[0],C=a[a.length-1],O=S.y>C.y?S.y:C.y,R=m.F.q(this.Tb,this.kc,S.ya.Ke()&&(this.UV(a),!0)},h.prototype.OI=function(a,u,d){var g=d.I(),v=0b.x?(b=this.zq,g.gg(-this.Js,0)):(b=-this.zq,g.gg(this.Js,0)),u.add(a,!1),a.Oa(),d.add(u,!1),d.Oc(g),v=new m.l,d.A(v),v.W((this.Js-v.R())/2,0),v.G=-this.zq,v.H=this.zq;for(var C=0;C=S));)m.kb.yi(a,u,v.x,v.y,g,me,G,K),O?q.ma(G.u,K.u):(ee.ma(G.u,K.u),h.gJ(v.x,ee.x,oe.x,R),q.ma(R[0]+ee.x,ee.y),oe.L(q)),q.scale(d),$.wf(0,-1,q),b=me,me=ge++*C}},h.dJ=function(a,u,d,g,v,b,S,C,O,R){var $=new m.h,N=new m.h,B=new m.ga(0),G=new m.ga(0);for(m.kb.yi(a,u,g.x,g.y,d,v,B,G),$.ma(B.u,G.u),m.kb.yi(a,u,g.x,g.y,d,b,B,G),N.ma(B.u,G.u),d=new m.ga(0),m.kb.Xy(a,u,S.x,S.y,$.x,$.y,d),O[0]=d.u,m.kb.Xy(a,u,S.x,S.y,N.x,N.y,d),R[0]=d.u;O[0]<=R[0];)O[0]+=6.283185307179586;for(;O[0]>R[0];)O[0]-=6.283185307179586;for(;O[0]>=C;)O[0]-=6.283185307179586,R[0]-=6.283185307179586;for(;O[0]b[$]?1:0}),u=a.Ia(),C=0;Cthis.rb/a&&(a=this.rb/500),.01>a&&(a=.01),this.$n=a},h}();m.VK=p}(ie||(ie={})),function(m){var D=function(){function E(){}return E.Mf=function(p,h){var a=new m.h;a.L(h),p.push(a)},E.up=function(p,h){p.add(h.x),p.add(h.y)},E.hB=function(p){p.Bh(p.size-2)},E.oB=function(p,h){h.ma(p.get(p.size-2),p.get(p.size-1))},E.Qr=function(p,h,a,u,d,g){if(p==null)throw m.i.N();var v=p.getType();if(p.B()||m.aa.Rn(v))return p;var b=new E;b.Qg=h,b.Jc=m.cb.sc(h);var S=m.cb.vv(b.Jc);if(b.Ub=g,b.Tb=m.cb.ev(b.Jc),b.kc=S*(2-S),b.ec=b.Jc.Hd().ai,b.Aq=b.Jc.Kn(),b.Zs=b.Aq*b.ec,b.AA=u,b.zA=d,b.ze=a,v==197?(a=new m.Da(p.description)).ad(p,!1):m.aa.yd(v)?(a=new m.Ta(p.description)).oc(p,!0):a=p,b.ze!=4){if((h=b.Qg.Nb(b.Jc)==0?m.cb.zh(a,b.Qg,b.Jc):m.Hh.lj(a,b.Jc)).B())return h;h=E.pI(b.ec,h),h=b.Zy(h),h=m.ip.nj(h,b.Jc,b.ze),b=m.cb.zh(h,b.Jc,b.Qg)}else{if(m.Eg.Sb(h)==2?(p=m.cb.ml(),(h=m.Xj.local().V(a,p,h,g))==p&&(h=new m.Da,p.copyTo(h))):h=m.Hh.lj(a,b.Jc),h.B())return h;b=b.CX(h)}return b},E.pI=function(p,h){var a=new m.l;if(h.xc(a),3.141592653589793>a.R()*p)return h;var u=!1;a=h.Ga();for(var d=new m.h,g=new m.h;a.$a();)for(;a.Ha();){var v=a.ha();if(d.L(v.ac()),g.L(v.wc()),d.scale(p),g.scale(p),3.141592653589793g.x-d.x)for(;-6.283185307179586>g.x-d.x;)g.x+=6.283185307179586;E.Wi(g.x,NaN,G),R.L(g)}else C.L(g),E.AU(C),E.Wi(C.x,B,G),R.ma(G[0]+C.x,C.y);.5>Math.abs(R.x-g.x)&&R.L(g),S?(v.Tw(0,N),$.L(O),$.scale(1/p),N.Cb($),(b=a.vm())?u.nf(N):u.lineTo(N),a.Qn()&&!h.dc(a.gb)&&(v.Tw(1,N),$.L(R),$.scale(1/p),N.Cb($),u.lineTo(N))):((b=a.vm())&&u.Hz(null,0),v=u.da()-1,$.L(O),$.scale(1/p),u.wf(v,-1,$),a.Qn()&&!h.dc(a.gb)&&($.L(R),$.scale(1/p),u.wf(v,-1,$)))}return u},E.tF=function(p,h,a,u,d,g,v,b,S,C,O,R){var $=new m.h,N=new m.h,B=0ee&&(ee+=6.283185307179586),0>(G=G.u)&&(G+=6.283185307179586),S!=null&&(S[0]=K),C!=null&&(C[0]=ee),O!=null&&(O[0]=G),C=S=NaN,R!=null&&(S=((C=m.F.Ah(p,h))-(O=m.F.q(p,h,u.y)))/K,C=(C+O)/K),O=E.Mu(u,d),G=E.Ku(u,d),ee=O||G;var q=E.FE(u,d,b),oe=new m.ga(0),ge=new m.ga(0),me=new m.h,Me=new m.h,Te=new m.h;E.Wi(u.x,NaN,N);var Fe=[N[0]];if(K<=g)E.Mf($,u),E.Wi(d.x,NaN,N),R!=null&&R.add(0),ee?(O&&E.kB(u,d,R,$),G&&E.iB(u,d,R,$)):q?E.jB(u,d,B,S,C,R,$):0Te.x&&(N[0]+=6.283185307179586,Te.ma(N[0]+me.x,me.y)):We.xv.x?v.x+=6.283185307179586:3.141592653589793yi;yi++)if(We=Xe[yi]*C+(1-Xe[yi])*S,m.kb.oj(p,h,u.x,u.y,We*d,g,K,ee,a),me.ma(K.u,ee.u),yi==0&&(lt=We,Me.L(me)),E.WW(oe,me,ge,Fe),Fe.hc(Fe.fe(me,!0),Te),m.kb.wd(p,h,me.x,me.y,Te.x,Te.y,q,null,null,2),q.u>O){Mt=!0;break}Mt?(ge.L(Me),C=lt,E.up(v,ge),b.add(C)):(E.hB(v),b.En(b.size-1,1,b.size-1),0=v&&on.u<=g&&3.141592653589793>Math.abs(B.x-G.x)||u.Ux(Mt,lt)<=d));Fe++){var Kr=rn[Fe]*lt+(1-rn[Fe])*Mt;if(u.hc(Kr,R),Te?K.ma(R.x*a,R.y*a):(Me[0][0]=R.x,Me[0][1]=R.y,m.cb.vt(),K.x=Me[0][0]*a,K.y=Me[0][1]*a),Fe==0&&(jo=Kr,N.L(R),q.L(K),0g||3.141592653589793<=Math.abs(B.x-G.x)))){dr=!0;break}if(yi&&0g||3.141592653589793<=Math.abs(B.x-K.x)){dr=!0;break}}else if(0v){dr=!0;break}if(yi){if(m.kb.wd(p,h,me.x,me.y,ee.x,ee.y,Ri,null,null,2),Ri.u>v){dr=!0;break}if(m.kb.wd(p,h,ee.x,ee.y,K.x,K.y,Aa,null,null,2),Aa.u>v){dr=!0;break}}}}dr?(O.L(N),G.L(q),lt=jo,E.up(Xe,O),E.up(di,G),Ct.add(lt)):(E.hB(Xe),E.hB(di),Ct.En(Ct.size-1,1,Ct.size-1),E.Mf(S,O),We+=on.u,b!=null&&b.add(We),0Math.abs(h.x-p.x)?(u.Dc(p),3.141592653589793<=a.x-p.x?u.Ql(a.x-6.283185307179586,a.y):3.141592653589793<=p.x-a.x?u.Ql(a.x+6.283185307179586,a.y):u.Ql(a.x,a.y)):(u.Dc(a),3.141592653589793<=p.x-a.x?u.Ql(p.x-6.283185307179586,p.y):3.141592653589793<=a.x-p.x?u.Ql(p.x+6.283185307179586,p.y):u.Ql(p.x,p.y))},E.YJ=function(p,h){for(var a=0;ap.x)for(;-3.141592653589793>p.x;)p.x+=6.283185307179586;if(3.141592653589793E.v+u&&gE?-E:E},D.Mb=function(E,p){return 0<=p?D.P(E):-D.P(E)},D.Y=function(E,p){return E==p||D.P(E-p)<=D.JC*(1+(D.P(E)+D.P(p))/2)},D.Cd=function(E){return E==0||D.P(E)<=D.JC},D.Ah=function(E,p){var h=(p=(1-(p=Math.sqrt(1-p)))/(1+p))*p;return E/(1+p)*(1+h*(.25+h*(.015625+1/256*h)))*D.EL},D.EL=1.5707963267948966,D.JC=3552713678800501e-30,D}()}(ie||(ie={})),function(m){var D=function(p){this.Wf=p,this.Kk=this.Wf.getCode(),0>this.Kk&&(this.Kk=0)};m.DY=D;var E=function(){function p(h){h===void 0&&(h=null),this.Cj=null,this.Un=!1,h!==null&&(this.Cj=new D(h))}return p.prototype.Ec=function(){return this.Cj!=null?this.Cj.Kk:0},p.prototype.Of=function(){var h=new p;return this.copyTo(h),h},p.prototype.copyTo=function(h){h.Cj=this.Cj,h.Un=this.Un},p.prototype.Qz=function(){this.Un=!this.Un},p.prototype.qm=function(){return this.Cj!=null?this.Cj.Wf:null},p.prototype.LJ=function(h){if(0>=h)throw m.i.N();if(h!=this.Ec()){if((h=m.pf.geogtran(h))==null)throw m.i.N("Geogtran not found.");this.Cj=new D(h)}},p.prototype.Bz=function(){return this.Cj==null?null:this.Cj.Wf.toString()},p.prototype.tX=function(h){if(h==null)throw m.i.N();var a=null;try{a=m.pf.fromString(m.Sc.PE_TYPE_GEOGTRAN,h)}catch{throw m.i.N()}this.Cj=new D(a)},p.prototype.Nb=function(h){return h==this||!(!(h instanceof p)||(0>=this.Ec()||this.Ec()!=h.Ec())&&!this.qm().isEqual(h.qm()))&&this.Un==h.Un},p.prototype.toString=function(){var h="GeographicTransformation: "+this.Bz();return 200p.I())},E.BE=function(p){return!(p.B()||p.getType()!=1607&&p.getType()!=1736||20>p.I())},E}();m.Uk=D}(ie||(ie={})),function(m){m.$b=function(){function D(){}return D.TT=function(E){var p=new m.Da;return p.sx(E.es(),E.gs()),p.yj(E.es(),E.fs()),p.yj(E.ds(),E.fs()),p.yj(E.ds(),E.gs()),p},D.zh=function(E,p){return E===null?null:m.Hx.local().V(E,p,null)},D.jY=function(E,p){var h=m.Gh.local();return E=new m.Zc(E),h.V(E,p,null).next()},D.im=function(E,p,h){return m.kp.local().V(E,p,h,null)},D.ep=function(E,p,h){return m.Kx.local().V(E,p,h,null)},D.VX=function(E,p,h){var a=m.Kx.local();for(E=new m.Zc(E),p=new m.Zc(p),h=a.V(E,p,h,null),a=[];(p=h.next())!=null;)a.push(p);return a},D.Nb=function(E,p,h){return m.dj.local().V(3,E,p,h,null)},D.TP=function(E,p,h){return m.dj.local().V(4,E,p,h,null)},D.RS=function(E,p,h){var a=m.Xj.local();for(E=new m.Zc(E),p=new m.Zc(p),h=a.V(E,p,h,null),a=[];(p=h.next())!=null;)a.push(p);return a},D.QP=function(E,p,h){var a=m.kp.local();for(E=new m.Zc(E),p=new m.Zc(p),h=a.V(E,p,h,null),a=[];(p=h.next())!=null;)a.push(p);return a},D.Ea=function(E,p,h){return m.Xj.local().V(E,p,h,null)},D.QS=function(E,p,h){if((E=m.Xj.local().V(E,p,h,null,1))===null)return[];if(E.getType()===550){for(p=[],h=0;hE.Db())return 0;var a=null;if(p!=null){if(a=p.Hd(),h!=null&&a.Ec()!=h.Ec()&&a.od!=h.od)throw m.i.Xk()}else if(h!=null)throw m.i.N();E.getType()==1736||E.getType()==197?p=E.mg():m.aa.yd(E.getType())?(p=new m.Ta(E.description)).oc(E,!0):p=E,E=0,p=p.Ga();for(var u=new m.h,d=new m.h;p.$a();)for(;p.Ha();){var g=p.ha();g.Yp(u),g.Tr(d),E+=m.h.tb(u,d)}return a!==null&&h!==null&&(E=m.Tc.Nh(E,a,h)),E},D.fP=function(E){return E.points!==void 0?D.mS(E,E.hasZ!==void 0&&E.hasZ,E.hasM!==void 0&&E.hasM):E.rings!==void 0?D.lG(E.rings,E.hasZ!==void 0&&E.hasZ,E.hasM!==void 0&&E.hasM,"P"):E.paths!==void 0?D.lG(E.paths,E.hasZ!==void 0&&E.hasZ,E.hasM!==void 0&&E.hasM,"L"):E.x!==void 0?D.nS(E):E.xmin!==void 0?D.lS(E):null},D.nS=function(E){if(E.x==null||E.x=="NaN")return new m.Sa;var p=new m.Sa(E.x,E.y);return E.z!==void 0&&E.z!==null&&p.wX(E.z),E.m!==void 0&&E.m!==null&&p.hX(E.m),p},D.lS=function(E){if(E.xmin==null||E.xmin=="NaN")return new m.Fh;var p=new m.Fh(E.xmin,E.ymin,E.xmax,E.ymax);return E.zmin!==void 0&&E.zmin!==null&&p.setInterval(1,0,E.zmin,E.zmax),E.mmin!==void 0&&E.mmin!==null&&p.setInterval(2,0,E.mmin,E.mmax),p},D.mS=function(E,p,h){var a=0,u=new m.de,d=3*E.points.length;d%2!=0&&d++,2>d&&(d=2);var g=m.O.truncate(3*E.points.length/2);4>g?g=4:16>g&&(g=16),d=m.Yc.Dn(d,0);var v=m.Yc.Dn(g);g=m.Yc.Dn(g);for(var b=0;b=d?(R[$]=!1,C+=1,v.add(S),b.add(u),S+=N):R[$]=!0}for((a=3*S)%2!=0&&a++,2>a&&(a=2),4>($=m.O.truncate(3*S/2))?$=4:16>$&&($=16),a=m.Yc.Dn(a,0),u=m.Yc.Dn($),d=m.Yc.Dn($),$=N=0;$v)throw m.i.N();this.Qi.oa=g-b,this.Qi.va=v+b,this.hi.resize(0),this.he=0,this.sg[0]=0},d.prototype.Uo=function(g,v){this.Qi.oa=g-v,this.Qi.va=g+v,this.hi.resize(0),this.he=0,this.sg[0]=0},d.prototype.next=function(){if(!this.Ya.lq)throw m.i.Hb();if(0>this.he)return-1;for(var g=!0;g;)switch(this.sg[this.he]){case 1:g=this.FU();break;case 2:g=this.GU();break;case 3:g=this.HU();break;case 4:g=this.IU();break;case 5:g=this.GW();break;case 6:g=this.kT();break;case 7:g=this.tN();break;case 0:g=this.Gz();break;default:throw m.i.Qa()}return this.Og!=-1?this.Mp()>>1:-1},d.construct=function(g){var v=new d;return v.Ya=g,v.hi.Jb(20),v.he=-1,v},d.prototype.Gz=function(){return this.Og=this.vH=this.Mi=this.Lc=-1,this.Ya.me!=null&&0=this.Qi.oa?(this.ei=this.QR(),!1):(this.he--,!0)},d.prototype.tN=function(){return this.Og=this.ei,this.Og!=-1&&u.gq(this.Mp())?(this.ei=this.SF(),!1):(this.he--,!0)},d.prototype.SF=function(){return this.Ya.Sf?this.Ya.$f.lb(this.Og):this.Ya.Ti.lb(this.Og)},d.prototype.QR=function(){return this.Ya.Sf?this.Ya.$f.we(this.Og):this.Ya.Ti.we(this.Og)},d.prototype.Mp=function(){return this.Ya.Sf?this.Ya.$f.ja(this.Og):this.Ya.Ti.getData(this.Og)},d}();m.EY=a;var u=function(){function d(g){this.Am=this.$h=this.$f=this.Ti=this.Km=this.Ej=this.me=this.Fj=null,this.Sf=g,this.lq=this.Sv=!1}return d.prototype.kr=function(){this.Nk(!0)},d.prototype.Br=function(g,v){if(!this.Sv)throw m.i.Hb();this.Fj.push(new m.Nc(g,v))},d.prototype.Fp=function(){if(!this.Sv)throw m.i.fa("invalid call");this.Sv=!1,this.lq=!0,this.Sf||(this.vS(),this.Zv=this.Fj.length)},d.prototype.vj=function(g){if(!this.Sf||!this.lq)throw m.i.N("invalid call");if(this.kf==-1){var v=this.Fj.length;if(this.iA){var b=new m.ia(0);b.Jb(2*v),this.bJ(b),this.$h.Jb(2*v),this.$h.resize(0),this.aJ(b),this.Km.resize(v,-1),this.Km.Wj(-1,0,v),this.iA=!1}else this.Km.Wj(-1,0,v);this.kf=this.Tu()}v=this.pG(g<<1,this.kf),b=this.$f.addElement(1+(g<<1),this.xz(v)),this.VJ(v,b),this.Km.set(g,v),this.Zv++},d.prototype.remove=function(g){if(!this.Sf||!this.lq)throw m.i.fa("invalid call");var v=this.Km.get(g);if(v==-1)throw m.i.N("the interval does not exist in the interval tree");this.Km.set(g,-1),this.Zv--;var b=this.xz(v),S=this.$f.ZR(b);this.$f.vd(this.wR(v),b),this.$f.vd(this.TR(v),b),(g=this.$f.size(b))==0&&(this.$f.MP(b),this.ZJ(S,-1)),this.Ej.jd(v),b=this.UF(S);var C=this.qj(S),O=this.lk(S);for(v=0;!(0>1);C!=-1?this.VJ(C,this.Ti.addElement(this.xz(C),S)):(C=this.pG(S,this.kf),b.set(S>>1,C))}},d.prototype.pG=function(g,v){var b=v,S=v,C=-1,O=0,R=this.$h.size-1,$=0,N=g>>1,B=NaN,G=NaN,K=!0,ee=this.DR(N);for(N=this.AR(N);K;){Oq&&(qq)v!=-1&&(v==b?(S=b,B=q,G=(v=this.lk(b))!=-1?this.Np(v):NaN):G>1];return d.gq(g)?v.oa:v.va},d}();m.sr=u}(ie||(ie={})),function(m){var D=function(){function E(p){if(p==null)throw m.i.fa("Invalid arguement");this.hf=p;var h=p.nR();h.hS()?p.ef.IG()?this.lo=m.si.PannableFold:this.lo=m.si.Clip:this.lo=m.si.DontClip,h.iS()?p.Yf.IG()?this.Qm=m.si.PannableFold:this.Qm=m.si.Clip:this.Qm=m.si.DontClip,this.Bm=h.Jr,this.mH=h.Vu,p=this.hf.sH,this.aH=p.hs(2147483648),this.Uv=p.hs(1073741824)}return E.zh=function(p,h,a){return h.ww.zh(p,a)},E.Rt=function(p,h,a,u){return p.ww.Rt(h,a,u)},E.Qt=function(p,h,a,u){if(a=0>a?h.length:a,(p=p.ww.Rt(h,a,u))==a)return p;for(var d=h=0;dd.H){var N=m.l.construct(b.v-1,d.G,b.C+1,d.H);if(($=m.ri.Nu($,N,a,NaN,0,h)).B())return $}b.R()>2*d.R()&&($=m.zb.Hp($,-2*d.R(),2*d.R(),a,!0,0,!0,h))}b=this.mH,(d=!isNaN(b))&&($=m.Xl.local().V($,b,h)),N=C?u.kk():null;var B=NaN;S&&(B=a.zi());var G=u.Wr()!=null;if(this.aH)S&&(m.zb.ur(a,B,$,v),d&&(S=a.hh(),b*=(B=a.sc().hh())/S)),m.zb.tr(this.hf,$,R,v),d&&(S=a.sc().hh(),b*=(B=u.sc().hh())/S),a=$;else{var K=new m.Ta($.description);K.DD($),S&&(m.zb.ur(a,B,K,v),d&&(S=a.hh(),b*=(B=a.sc().hh())/S)),m.zb.tr(this.hf,K,R,v),d&&(S=a.sc().pm(),b*=(B=u.sc().pm())/S),R=NaN,C?(N=u.kk(),R=u.zi()):isNaN(this.Bm)||(R=this.Bm),S=E.tv(a)|E.tv(u),B=10*O.Xd(0),this.Uv&&(S=3,B=0),a=m.zb.UQ($,a,K,O,R,h,S,B)}return G&&(a=m.zb.XD(a,u,h)),C&&(g||(C=O.Oe().R(),a.Tg(0,0).R()>=C-O.Xd(0)&&(O=N.getNorthPoleLocation(),C=N.getSouthPoleLocation(),$=N.getNorthPoleGeometry(),N=N.getSouthPoleGeometry(),R=0,$==m.Cg.PE_POLE_POINT&&O!=m.Cg.PE_POLE_OUTSIDE_BOUNDARY&&(R=1),N==m.Cg.PE_POLE_POINT&&C!=m.Cg.PE_POLE_OUTSIDE_BOUNDARY&&(R|=2),R!==0&&(g=!0))),a=m.zb.Mz(a,u,this.Qm,h),d&&(a=m.Xl.local().V(a,b,h)),m.zb.Lx(u,a,v)),a.B()||(g&&(a=m.Yl.local().V(a,u,!1,h)),p!=null&&(a=p.Zk(a,!1),this.wp(p,m.bm.reverse,a),a=p.$k(a,!1))),a},E.tv=function(p){if(p.Sb()!=2)return 0;var h=0,a=p.kk();p=a.getNorthPoleLocation();var u=a.getSouthPoleLocation(),d=a.getNorthPoleGeometry();return a=a.getSouthPoleGeometry(),d==m.Cg.PE_POLE_POINT&&p!=m.Cg.PE_POLE_OUTSIDE_BOUNDARY&&(h=1),a==m.Cg.PE_POLE_POINT&&u!=m.Cg.PE_POLE_OUTSIDE_BOUNDARY&&(h|=2),h},E.prototype.hW=function(p,h){var a=this.hf.ef,u=this.hf.Yf,d=a.Sb(),g=u.Sb(),v=m.O.Fu(Math.min(p.I(),64)),b=m.Ta.jg(p);d==3&&(d=(a=(p=a.Ji).fk()).Sb(),b=p.$k(b,!0),this.wp(p,m.bm.forward,b),b=p.Zk(b,!0)),p=null,g==3&&(g=(u=(p=u.Ji).fk()).Sb());var S=d==2;d=(g=g==2)?u.sc():u;var C=!g&&!this.Uv;if(S){if((b=m.zb.UI(b,a,this.lo,h)).B())return b}else{var O=new m.l;b.xc(O);var R=a.Oe();if((O.GR.H)&&(O=m.l.construct(O.v-1,R.G,O.C+1,R.H),(b=m.ri.Nu(b,O,a,NaN,0,h)).B()))return b}var $=NaN;S&&($=a.zi()),O=u.Wr()!=null,R=this.mH;var N=!isNaN(R);if(N&&(b=m.Xl.local().V(b,R,h)),this.aH)S&&m.zb.ur(a,$,b,v),N&&(S=a.hh(),R*=($=a.sc().hh())/S),m.zb.tr(this.hf,b,C,v),N&&(S=a.sc().hh(),R*=($=u.sc().hh())/S),a=b;else{var B=new m.Ta(b.description);B.DD(b),S&&(m.zb.ur(a,$,B,v),N&&(S=a.hh(),R*=($=a.sc().hh())/S)),m.zb.tr(this.hf,B,C,v),N&&(S=a.sc().hh(),R*=($=u.sc().hh())/S),C=NaN,g?C=u.zi():isNaN(this.Bm)||(C=this.Bm),S=E.tv(a)|E.tv(u),$=10*d.Xd(0),this.Uv&&(S=3,$=0),a=m.zb.VQ(b,a,B,d,C,h,S,$)}return O&&(a=m.zb.XD(a,u,h)),g&&(a=m.zb.Mz(a,u,this.Qm,h),N&&(a=m.Xl.local().V(a,R,h)),m.zb.Lx(u,a,v)),a.B()||p!=null&&(a=p.Zk(a,!1),this.wp(p,m.bm.reverse,a),a=p.$k(a,!1)),a},E.prototype.eW=function(p,h){var a=(p.ca()+p.R())/400;return a!=0?(a=m.Xl.local().V(p,a,h),a=this.VI(a,h),h=p.Ia(),a.bn(h)):(h=new m.Sa(p.Ip()),a=this.XI(h),h=p.Ia(),a.B()?h.Oa():(p.copyTo(h),p=a.D(),h.K(p.x,p.y,p.x,p.y))),h},E.prototype.fW=function(p,h){p=m.aa.jg(p);var a=this.hf.ef,u=this.hf.Yf,d=a.Sb(),g=u.Sb(),v=m.O.Fu(Math.min(p.I(),64));if(d==3){var b=a.Ji;d=(a=b.fk()).Sb(),p=b.Zk(p,!0),this.wp(b,m.bm.forward,p),p=b.$k(p,!0)}if(d==2){if(this.lo==m.si.Clip?p=m.Xj.local().V(p,a.ml(),a,h):a.Wc()&&(d=new m.l,p.xc(d),a.Oe().contains(d)||(this.lo==m.si.PannableFold&&(p=m.zb.lj(p,a)),m.zb.Jt(p,a.Oe(),a.Xd(0),!0),p=m.zb.Fn(p,a,0,!0,0,h))),p.B())return p;m.zb.ur(a,0,p,v)}else m.zb.Jt(p,a.Oe(),a.Xd(0),!0);return m.zb.tr(this.hf,p,!1,v),a=0,d=!1,b=null,g==3&&(d=!0,g=(u=(b=u.Ji).fk()).Sb()),(g=g==2)?a=u.zi():isNaN(this.Bm)||(a=this.Bm),g&&this.Qm!=m.si.Clip||(p=m.zb.Fn(p,u.sc(),a,!1,0,h)),g&&(p=m.zb.Mz(p,u,this.Qm,h),m.zb.Lx(u,p,v),p.B())||d&&(p=b.Zk(p,!0),this.wp(b,m.bm.reverse,p),p=b.$k(p,!0)),p},E.prototype.wp=function(p,h,a){var u=a.I();if(u!=0){for(var d=a.ub(0),g=m.O.lg(200,0),v=[],b=0;bd.v+g&&bh?this.wv(a,u):this.gv(a,u);case 1:var d=this.wv(a,u);return a=this.gv(a,u),m.lc.hq(d,a,h);case 2:throw m.i.fa("not implemented")}throw m.i.Qa()},p.prototype.fe=function(h,a){var u=this.pa-this.sa,d=this.la-this.na,g=u*u+d*d;return g==0?.5:(h=((h.x-this.sa)*u+(h.y-this.na)*d)/g,a||(0>h?h=0:1(a=(a-this.na)/h)||1(a=(a-this.sa)/h)||1(a=8881784197001252e-31*(Math.abs(u.x*a.y)+Math.abs(u.y*a.x)))?-1:h<-a?1:0},p.prototype.rp=function(h,a,u,d){var g=this.sa,v=this.na,b=h-g,S=a-v;if((b=Math.sqrt(b*b+S*S))<=Math.max(u,6661338147750939e-31*b))return d&&b==0?NaN:0;if(b=h-this.pa,S=a-this.la,(b=Math.sqrt(b*b+S*S))<=Math.max(u,6661338147750939e-31*b))return d&&b==0?NaN:1;if(b=this.pa-this.sa,S=this.la-this.na,0<(d=Math.sqrt(b*b+S*S))){var C=1/d,O=h-g,R=a-v,$=O*(b*=C)+R*(S*=C),N=17763568394002505e-31*(Math.abs(O*b)+Math.abs(R*S)),B=b;if(b=-S,S=B,$<-(N=Math.max(u,N))||$>d+N)return NaN;if(Math.abs(O*b+R*S)<=Math.max(u,17763568394002505e-31*(Math.abs(O*b)+Math.abs(R*S)))&&(.5>=(b=m.O.Rk($*C,0,1))?(S=this.sa+(this.pa-this.sa)*b,d=this.na+(this.la-this.na)*b):(S=this.pa-(this.pa-this.sa)*(1-b),d=this.la-(this.la-this.na)*(1-b)),m.h.Oy(S,d,h,a)<=u)){if(.5>b){if(m.h.Oy(S,d,g,v)<=u)return 0}else if(m.h.Oy(S,d,this.pa,this.la)<=u)return 1;return b}}return NaN},p.prototype.Nb=function(h){return h!=null&&(h==this||h.constructor===this.constructor&&this.FM(h))},p.prototype.rD=function(h,a,u){var d=u?this.sa:this.pa;u=u?this.na:this.la;var g=new m.h;return g.x=h.pa-d,g.y=h.la-u,!(a.Qh(g)>6661338147750939e-31*a.fD(g))||(g.x=h.sa-d,g.y=h.na-u,a.Qh(g)<=6661338147750939e-31*a.fD(g))},p.prototype.qD=function(h){var a=new m.h;return a.x=this.pa-this.sa,a.y=this.la-this.na,!!this.rD(h,a,!1)&&(a.Sq(),!!this.rD(h,a,!0))},p.NM=function(h,a){var u=h.uu(a.sa,a.na),d=h.uu(a.pa,a.la);return!(0>u&&0>d||0u&&0>d||0(d=a.Qb())?h.qD(a):a.qD(h)))},p.LM=function(h,a,u){var d=m.h.construct(NaN,NaN),g=h.pa-h.sa,v=h.la-h.na,b=a.pa-a.sa,S=a.la-a.na,C=b*v-g*S;if(C==0)return d;var O=8881784197001252e-31*(Math.abs(b*v)+Math.abs(g*S)),R=a.sa-h.sa,$=a.na-h.na,N=b*$-R*S,B=N/C,G=Math.abs(C);return B<-(b=(8881784197001252e-31*(Math.abs(b*$)+Math.abs(R*S))*G+O*Math.abs(N))/(C*C)+2220446049250313e-31*Math.abs(B))||B>1+b||(b=(S=g*$-R*v)/C)<-(g=(8881784197001252e-31*(Math.abs(g*$)+Math.abs(R*v))*G+O*Math.abs(S))/(C*C)+2220446049250313e-31*Math.abs(b))||b>1+g||(B=m.O.Rk(B,0,1),g=m.O.Rk(b,0,1),v=h.hc(B),C=a.hc(g),(O=new m.h).uc(v,C),O.length()>u&&(O.add(v,C),O.scale(.5),B=h.fe(O,!1),g=a.fe(O,!1),h=h.hc(B),a=a.hc(g),h.sub(a),h.length()>u)||d.ma(B,g)),d},p.OM=function(h,a,u,d){var g=0;if((h.sa==a.sa&&h.na==a.na||h.sa==a.pa&&h.na==a.la)&&(g++,!d))return 1;if(h.pa==a.sa&&h.la==a.na||h.pa==a.pa&&h.la==a.la){if(++g==2)return 2;if(!d)return 1}return a.vi(h.sa,h.na,u)||a.vi(h.pa,h.la,u)||h.vi(a.sa,a.na,u)||h.vi(a.pa,a.la,u)?1:d&&g!=0||p.NM(h,a)==0?0:1},p.Zx=function(h,a,u,d,g,v){var b=0,S=h.rp(a.sa,a.na,v,!1),C=h.rp(a.pa,a.la,v,!1),O=a.rp(h.sa,h.na,v,!1),R=a.rp(h.pa,h.la,v,!1);return isNaN(S)||(d!=null&&(d[b]=S),g!=null&&(g[b]=0),u!=null&&(u[b]=m.h.construct(a.sa,a.na)),b++),isNaN(C)||(d!=null&&(d[b]=C),g!=null&&(g[b]=1),u!=null&&(u[b]=m.h.construct(a.pa,a.la)),b++),b==2||isNaN(O)||S==0&&O==0||C==0&&O==1||(d!=null&&(d[b]=0),g!=null&&(g[b]=O),u!=null&&(u[b]=m.h.construct(h.sa,h.na)),b++),b==2||isNaN(R)||S==1&&R==0||C==1&&R==1||(d!=null&&(d[b]=1),g!=null&&(g[b]=R),u!=null&&(u[b]=m.h.construct(a.pa,a.la)),b++),0d[1]&&(h=d[0],d[0]=d[1],d[1]=h,g!=null&&(d=g[0],g[0]=g[1],g[1]=d),u!=null&&(g=m.h.construct(u[0].x,u[0].y),u[0]=u[1],u[1]=g)),b):(b=p.LM(h,a,v),isNaN(b.x)?0:(u!=null&&(u[0]=h.hc(b.x)),d!=null&&(d[0]=b.x),g!=null&&(g[0]=b.y),1))},p.prototype.eG=function(){return 0},p.prototype.op=function(){},p.prototype.toString=function(){return"Line: ["+this.sa.toString()+", "+this.na.toString()+", "+this.pa.toString()+", "+this.la.toString()+"]"},p}(m.SC);m.yb=D}(ie||(ie={})),function(m){var D=function(){function E(){this.Jm=[],this.ya=-1}return E.prototype.La=function(){return this.ya},E.prototype.next=function(){if(this.Jm!=null&&this.Jm.length!=0){this.ya++;var p=this.Jm[0];return this.Jm=1>=this.Jm.length?[]:this.Jm.slice(1),p}return this.Jm=null},E.prototype.ZX=function(p){this.Jm.push(p)},E.prototype.qe=function(){},E}();m.gL=D}(ie||(ie={})),function(m){var D;(D=m.SL||(m.SL={}))[D.enumFillRuleOddEven=0]="enumFillRuleOddEven",D[D.enumFillRuleWinding=1]="enumFillRuleWinding";var E=function(p){function h(a,u){var d=p.call(this)||this;if(d.xf=!1,d.Eq=null,d.sq=0,d.rq=0,d.Aj=null,d.Mg=!1,d.nb=null,d.mb=null,d.Ve=null,d.Lj=null,d.Sd=null,d.tq=0,d.gb=0,d.xq=0,u===void 0)d.xf=a,d.Mg=!1,d.tq=0,d.sq=0,d.rq=0,d.wa=0,d.description=m.ee.og();else{if(u==null)throw m.i.N();d.xf=a,d.Mg=!1,d.tq=0,d.sq=0,d.rq=0,d.wa=0,d.description=u}return d.Aj=null,d.gb=0,d}return Ke(h,p),h.prototype.tm=function(){return 0u)throw m.i.Qa();if(this.dc(a)){if(this.mb==null)throw m.i.Qa();var d=this.wa,g=this.Ba(a),v=this.Vc(a);this.dm(this.wa+1),this.mc();for(var b=0,S=this.description.Aa;ba;u--)d=this.nb.read(u),this.nb.write(u,d+1);this.mb.KE(a,1)}},h.prototype.Ap=function(){if(this.wx(),a===void 0){this.Mg=!1;var a=this.da()-1}var u=this.mb.read(a);this.mb.write(a,1|u),this.Ve!=null&&(a=this.Vc(a)-1,this.Ve.write(a,1),this.Lj.write(a,-1))},h.prototype.dc=function(a){return(1&this.mb.read(a))!=0},h.prototype.Nn=function(a){if(this.dc(a))return!0;var u=this.Ba(a);return!(u>(a=this.Vc(a)-1))&&(u=this.Na(u),a=this.Na(a),u.qb(a))},h.prototype.yv=function(a){return(2&this.mb.read(a))!=0},h.prototype.oc=function(a,u){if(this.Jl(a.description),a.getType()!=322)throw m.i.Qa();var d=new m.Sa;(u||this.B())&&(a.To(d),this.nf(d)),a.Po(d),this.lineTo(d)},h.prototype.tp=function(a){var u=this.wa==0;this.sx(a.v,a.G),this.yj(a.v,a.H),this.yj(a.C,a.H),this.yj(a.C,a.G),this.Ap(),this.Mg=!1,u&&this.Lf(256,!1)},h.prototype.ad=function(a,u){if(!a.B()){for(var d=this.wa==0,g=new m.Sa(this.description),v=0;4>v;v++)a.Hf(u?4-v-1:v,g),v==0?this.nf(g):this.lineTo(g);this.Ap(),this.Mg=!1,d&&!u&&this.Lf(256,!1)}},h.prototype.add=function(a,u){for(var d=0;du&&(u=a.da()-1),u>=a.da()||0>d||0>g||g>a.rv(u))throw m.i.fa("index out of bounds");if(g!=0){var b=a.dc(u)&&d+g==a.rv(u);if(!b||g!=1){if(this.Mg=!1,this.Jl(a.description),d=a.Ba(u)+d+1,v&&(g++,d--),b&&g--,b=this.wa,this.dm(this.wa+g),this.mc(),v){if(g==0)return;this.nb.add(this.wa),v=a.mb.read(u),v&=-5,this.xf&&(v|=1),this.mb.write(this.mb.size-1,v),this.mb.add(0)}else this.nb.write(this.mb.size-1,this.wa);v=0;for(var S=this.description.Aa;vR||a.za[R]==null?this.za[v].Ln(O*b,m.ra.se(C),g*O,O*b):this.za[v].Mn(O*b,a.za[R],O*d,g*O,!0,O,O*b)}if(this.tm()||a.yv(u))throw m.i.Qa();this.Pc(1993)}}},h.prototype.oJ=function(){for(var a=0,u=this.da();a=this.da())throw m.i.N();var u=this.Ba(a),d=this.Ja(a);a=this.dc(a)?1:0;for(var g=0,v=this.description.Aa;ga&&(a=u-1),a>=u)throw m.i.N();for(var d=this.Ba(a),g=this.Ja(a),v=0,b=this.description.Aa;v=u.da())throw m.i.N();var v=this.da();if(a>v)throw m.i.N();0>a&&(a=v),0>d&&(d=u.da()-1),this.Mg=!1,this.Jl(u.description),u.mc();var b=u.Ba(d),S=u.Ja(d),C=this.wa,O=u.dc(d)&&!g?1:0;this.dm(this.wa+S),this.mc();for(var R=a=a+1;g--)b=this.nb.read(g-1),this.nb.write(g,b+S);for(u.yv(d),this.mb.add(0),g=v-1;g>=a+1;g--)v=this.mb.read(g),v&=-5,this.mb.write(g+1,v);v=u.JR().read(d),v&=-5,this.xf&&(v|=1),this.mb.write(a,v)},h.prototype.Hz=function(a,u){var d=-1,g=this.da();if(d>g)throw m.i.N();0>d&&(d=g),this.Mg=!1;var v=this.wa;this.dm(this.wa+u),this.mc();var b=d=d+1;v--)b=this.nb.read(v-1),this.nb.write(v,b+u);for(this.mb.add(0),v=g-1;v>=d+1;v--)u=this.mb.read(v),u&=-5,this.mb.write(v+1,u);this.xf&&this.mb.write(d,1)},h.prototype.qG=function(a,u,d){var g=-1;if(0>a&&(a=this.da()),a>this.da()||g>this.Ja(a)||d>u.length)throw m.i.fa("index out of bounds");if(d!=0){a==this.da()&&(this.nb.add(this.wa),this.xf?this.mb.add(1):this.mb.add(0)),0>g&&(g=this.Ja(a)),this.mc();var v=this.wa;this.dm(this.wa+d),this.mc();for(var b=0,S=this.description.Aa;ba&&(a=this.da()),a>=g||u>this.Ja(a))throw m.i.fa("index out of bounds");a==this.da()&&(this.nb.add(this.wa),this.xf?this.mb.add(1):this.mb.add(0)),0>u&&(u=this.Ja(a));var v=this.wa;this.dm(this.wa+1),this.mc();var b=this.Ba(a);this.za[0].vj(2*(b+u),d,2*v),d=1;for(var S=this.description.Aa;da&&(a=d-1),a>=d||u>=this.Ja(a))throw m.i.fa("index out of bounds");this.mc();var g=this.Ba(a);0>u&&(u=this.Ja(a)-1),u=g+u,g=0;for(var v=this.description.Aa;g=a+1;d--)u=this.nb.read(d),this.nb.write(d,u-1);this.wa--,this.Pg--,this.Pc(1993)},h.prototype.uE=function(a,u,d){var g=this.Ba(a)+u;if((d=this.Ba(d)+void 0)g||d>this.I()-1)throw m.i.N();u=0,(a=this.Ga()).Vb(g);do{for(;a.Ha()&&(g=a.ha(),a.wb()!=d);)u+=g=g.Qb();if(a.wb()==d)break}while(a.$a());return u},h.prototype.fO=function(a,u,d){if(u=this.Ba(a)+u,d=this.Ba(a)+d,0>u||d>this.I()-1)throw m.i.N();var g=this.Ga();if(u>d){if(!this.dc(a))throw m.i.N("cannot iterate across an open path");g.JB()}var v=a=0;g.Vb(u);do v+=a,a=g.ha().Qb();while(g.wb()!=d);return v},h.prototype.mg=function(){return m.pi.gm(this,null)},h.prototype.KS=function(a,u,d){for(var g=a;gu){var b=this.tm(),S=0;u=this.wa}else b=this.yv(u),S=this.Ba(u),u=this.Vc(u);for(;S=this.Ba(u))return u;u--}else u++;if(0<=u&&u=this.Ba(u)&&ad){for(u=0;uu;){var g=u+(d-u>>1);if(a=(u=this.Vc(g))))return this.gb=g;u=g+1}}return this.gb=u},h.prototype.yz=function(){var a=this.I();if(!this.xf){a-=this.da();for(var u=0,d=this.da();ud.RR()))return!0;this.Bb.yD(null)}return d=m.Nx.create(this,a,u),this.Bb.yD(d),!0},h.prototype.cc=function(){var a=p.prototype.cc.call(this);if(!this.Ac()){var u=this.da();this.nb!=null&&this.nb.An(a,0,u+1),this.mb!=null&&this.mb.An(a,0,u)}return a},h.prototype.ZF=function(a){return this.Ve!=null?this.Ve.read(a):1},h.prototype.bc=function(a,u,d){var g=this.sz(a);if(a==this.Vc(g)-1&&!this.dc(g))throw m.i.fa("index out of bounds");this.mc();var v=this.Ve,b=1;if(v!=null&&(b=7&v.read(a)),b!==1)throw m.i.Qa();if(u.Or(),u=u.get(),d?u.Nf(m.ee.og()):u.Nf(this.description),g=a==this.Vc(g)-1&&this.dc(g)?this.Ba(g):a+1,v=new m.h,this.D(a,v),u.Dc(v),this.D(g,v),u.Qc(v),!d)for(d=1,v=this.description.Aa;d=this.da())throw m.i.N();if(this.B())u.Oa();else{if(this.yv(a))throw m.i.fa("not implemented");var d=this.ub(0),g=new m.h,v=new m.l;v.Oa();var b=this.Ba(a);for(a=this.Vc(a);bthis.I())&&(a=m.ta.nE(this),this.Bb.WM(a),!0)},h.prototype.hM=function(){if(this.Bb==null&&(this.Bb=new m.Uk),this.Bb.zo==null){this.Bb.xD(null);var a=m.ta.YN(this);this.Bb.xD(a)}},h.prototype.Yo=function(a){this.xq=a},h.prototype.In=function(){return this.xq},h.prototype.DD=function(a){if(this==a)throw m.i.fa("MultiPathImpl.add");for(var u=this.da(),d=0;d=(u=this.Vc(u))||au?h.I():u,0>a||a>h.I()||ua?u:a,0>u||0>a)throw m.i.N();if(a!=0){u=a-0,a=this.wa,this.resize(this.wa+u);for(var d=0;dh||h>=this.I())throw m.i.fa("index out of bounds");this.mc();for(var a=0,u=this.description.Aa;aa||a>=this.wa||uh?h:E},D.Th=function(E,p){var h=5381;return((h=((h=((h=p!==void 0?(p<<5)+p+(255&E):(h<<5)+h+(255&E))<<5)+h+(E>>8&255))<<5)+h+(E>>16&255))<<5)+h+(E>>24&255)&2147483647},D.uj=function(){throw Error("Not Implemented")},D.bB=function(E){return D.aU(E)+12345&2147483647},D.XG=function(E){var p=32,h=E%D.Qx|0,a=E/D.Qx|0;return(p&=63)==0?E:(32>p?(E=h>>>p|a<<32-p,p=a>>p):(E=a>>p-32,p=0<=a?0:-1),p*D.Qx+(E>>>0))},D.aU=function(E){var p=1103515245,h=65535&p;return((p-h)*(E|=0)|0)+(h*E|0)|0},D.truncate=function(E){return 0>E?-1*Math.floor(Math.abs(E)):Math.floor(E)},D.MAX_SAFE_INTEGER=Math.pow(2,53)-1,D.MIN_SAFE_INTEGER=-D.MAX_SAFE_INTEGER,D.VC=65536,D.Qx=D.VC*D.VC,D}()}(ie||(ie={})),function(m){var D;(D=m.CL||(m.CL={}))[D.Project=0]="Project",D[D.Union=1]="Union",D[D.Difference=2]="Difference",D[D.Proximity2D=3]="Proximity2D",D[D.Relate=4]="Relate",D[D.Equals=5]="Equals",D[D.Disjoint=6]="Disjoint",D[D.Intersects=7]="Intersects",D[D.Within=8]="Within",D[D.Contains=9]="Contains",D[D.Crosses=10]="Crosses",D[D.Touches=11]="Touches",D[D.Overlaps=12]="Overlaps",D[D.Buffer=13]="Buffer",D[D.Distance=14]="Distance",D[D.Intersection=15]="Intersection",D[D.Clip=16]="Clip",D[D.Cut=17]="Cut",D[D.DensifyByLength=18]="DensifyByLength",D[D.DensifyByAngle=19]="DensifyByAngle",D[D.LabelPoint=20]="LabelPoint",D[D.GeodesicBuffer=21]="GeodesicBuffer",D[D.GeodeticDensifyByLength=22]="GeodeticDensifyByLength",D[D.ShapePreservingDensify=23]="ShapePreservingDensify",D[D.GeodeticLength=24]="GeodeticLength",D[D.GeodeticArea=25]="GeodeticArea",D[D.Simplify=26]="Simplify",D[D.SimplifyOGC=27]="SimplifyOGC",D[D.Offset=28]="Offset",D[D.Generalize=29]="Generalize",D[D.SymmetricDifference=30]="SymmetricDifference",D[D.ConvexHull=31]="ConvexHull",D[D.Boundary=32]="Boundary",D[D.SimpleRelation=33]="SimpleRelation";var E=function(){function p(){}return p.prototype.getType=function(){return null},p.prototype.wn=function(){},p.prototype.Iu=function(){return!1},p}();m.Je=E}(ie||(ie={})),function(m){var D=function(E){function p(){return E!==null&&E.apply(this,arguments)||this}return Ke(p,E),p.prototype.getType=function(){return 13},p.local=function(){return p.instance===null&&(p.instance=new p),p.instance},p.prototype.V=function(h,a,u,d,g){return h instanceof m.aa?(g=new m.Zc(h),this.V(g,a,[u],!1,d).next()):d===!0?(u=new m.BC(h,a,u,!1,g),m.Gh.local().V(u,a,g)):new m.BC(h,a,u,!1,g)},p.instance=null,p}(m.Je);m.AC=D}(ie||(ie={})),function(m){var D=function(){function E(p,h,a,u,d){this.ya=-1,this.Rd=p,this.$z=h,this.Cs=a,this.tT=new m.l,this.tT.Oa(),this.eo=-1,this.Ub=d}return E.prototype.next=function(){for(var p;(p=this.Rd.next())!=null;)return this.ya=this.Rd.La(),this.eo+1=p.I():p.da()==1&&(2>=p.I()||m.Zt.JG(p,0)))},E}();m.DC=D}(ie||(ie={})),function(m){var D=function(E){function p(){return E!==null&&E.apply(this,arguments)||this}return Ke(p,E),p.prototype.getType=function(){return 17},p.local=function(){return p.instance===null&&(p.instance=new p),p.instance},p.prototype.V=function(h,a,u,d,g){return new m.nL(h,a,u,d,g)},p.instance=null,p}(m.Je);m.mL=D}(ie||(ie={})),function(m){var D=function(){function E(p,h,a,u,d){if(this.Tf=null,h==null||a==null)throw m.i.fa("invalid argument");this.qT=p,this.nA=h,this.lH=a,p=m.ta.mv(h,a),this.qa=m.ta.Wd(u,p,!0),this.kH=-1,this.nd=d}return E.prototype.La=function(){return 0},E.prototype.next=function(){return this.RQ(),++this.kHthis.Tf.length&&(this.Tf.length=0)},E.prototype.SQ=function(){var p=new m.ia(0),h=new m.gd,a=h.aF(),u=h.Ib(this.nA),d=h.Ib(this.lH),g=new m.Fg;try{g.Ft(h,this.qa,this.nd),g.dl(a,u,d,p);var v=h.Ne(u),b=new m.Da,S=new m.Da;for(this.Tf.length=0,this.Tf.push(b),this.Tf.push(S),u=0;u=a)throw m.i.N();return new m.oL(h,a,u)},p.instance=null,p}(m.Je);m.Xl=D}(ie||(ie={})),function(m){var D=function(){function E(p,h){this.ya=-1,this.Rd=p,this.Ps=h}return E.prototype.La=function(){return this.ya},E.prototype.next=function(){var p;return(p=this.Rd.next())!=null?(this.ya=this.Rd.La(),this.NP(p)):null},E.prototype.NP=function(p){if(p.B()||1>p.Db())return p;var h=p.getType();if(h==1736||h==1607)return this.Ny(p);if(m.aa.yd(h))return this.PP(p);if(h==197)return this.OP(p);throw m.i.Qa()},E.prototype.PP=function(p){if(p.Qb()<=this.Ps)return p;var h=new m.Ta(p.description);return h.oc(p,!0),this.Ny(h)},E.prototype.OP=function(p){var h=new m.Da(p.description);h.ad(p,!1);var a=new m.l;return p.A(a),p=a.ca(),a.R()<=this.Ps&&p<=this.Ps?h:this.Ny(h)},E.prototype.Ny=function(p){for(var h=p.Ia(),a=p.Ga();a.$a();)for(var u=!0;a.Ha();){var d=a.ha();if(d.getType()!=322)throw m.i.fa("not implemented");var g=a.On(),v=d.Qb();if(v>this.Ps){var b=Math.ceil(v/this.Ps);v=new m.Sa(p.description),u&&(d.To(v),h.nf(v));var S=u=1/b,C=0;for(--b;Cv)return h;var b=h.getType(),S=a.getType(),C=new m.l,O=new m.l,R=new m.l;h.A(C),a.A(O),R.K(C),R.Zb(O);var $=(R=m.ta.Wd(u,R,!0))*Math.sqrt(2)*1.00001,N=new m.l;if(N.K(C),N.W($,$),!N.isIntersecting(O))return h;if(g==1&&v==2)return p.KV(h,a,S,u,d);if(b==33)switch(m.Vk.yd(S)?(u=new m.Ta(a.description),u.oc(a,!0)):u=a,S){case 1736:return p.XU(h,u,R);case 1607:return p.YU(h,u,R);case 550:return p.VU(h,u,R);case 197:return p.UU(h,u,R);case 33:return p.WU(h,u,R);default:throw m.i.N()}else if(b==550)switch(S){case 1736:return p.nU(h,a,R);case 197:return p.lU(h,a,R);case 33:return p.mU(h,a,R)}return m.Fg.im(h,a,u,d)},p.XU=function(h,a,u){return m.hd.KG(a,h,u)==0?h:h.Ia()},p.YU=function(h,a,u){var d=h.D();a=a.Ga();for(var g=u*Math.sqrt(2)*1.00001,v=g*g,b=new m.l;a.$a();)for(;a.Ha();){var S=a.ha();if(S.A(b),b.W(g,g),b.contains(d)){if(S.qs(d,u))return h.Ia();var C=S.ac();if(m.h.yc(d,C)<=v||(C=S.wc(),m.h.yc(d,C)<=v))return h.Ia()}}return h},p.VU=function(h,a,u){var d=a.ub(0);a=a.I();var g=h.D(),v=new m.h;u=u*Math.sqrt(2)*1.00001,u*=u;for(var b=0;ba.I()?this.gE(h,a,u):(this.Nt(),h=this.gE(a,h,u),this.Nt(),h):h.getType()==550&&m.aa.Hc(a.getType())?(h=this.hE(a,h,u),this.Nt(),h):a.getType()==550&&m.aa.Hc(h.getType())?this.hE(h,a,u):h.getType()==550&&a.getType()==550?h.I()>a.I()?this.iE(h,a):(this.Nt(),h=this.iE(a,h),this.Nt(),h):0},p.prototype.gE=function(h,a,u){var d=h.Ga(),g=a.Ga(),v=new m.l,b=new m.l,S=17976931348623157e292;if(!u&&this.pY(h,a,d,g))return 0;for(;d.$a();)for(;d.Ha();)if((h=d.ha()).A(v),!(v.px(this.oh)>S)){for(;g.$a();)for(;g.Ha();)if((a=g.ha()).A(b),v.px(b)v)){for(var O=0;Od)){for(var O=0;Op.Ja(h))){var d=p.Ba(h),g=p.Vc(h)-1,v=p.ub(0),b=p.dc(h),S=new m.ia(0);S.Jb(p.Ja(h)+1);var C=new m.ia(0);for(C.Jb(p.Ja(h)+1),S.add(b?d:g),S.add(d),d=new m.h;1this.DH&&b>g&&(d=u,g=b)}return d},E.prototype.qe=function(){},E}();m.sL=D}(ie||(ie={})),function(m){var D=function(E){function p(){return E!==null&&E.apply(this,arguments)||this}return Ke(p,E),p.prototype.getType=function(){return 29},p.prototype.V=function(h,a,u,d){return h instanceof m.aa?(h=new m.Zc(h),this.V(h,a,u,d).next()):new m.sL(h,a,u,d)},p.local=function(){return p.instance===null&&(p.instance=new p),p.instance},p.instance=null,p}(m.Je);m.EC=D}(ie||(ie={})),function(m){var D=function(E){function p(){return E!==null&&E.apply(this,arguments)||this}return Ke(p,E),p.prototype.getType=function(){return 21},p.local=function(){return p.instance===null&&(p.instance=new p),p.instance},p.prototype.V=function(h,a,u,d,g,v,b,S){return h instanceof m.aa?(S=new m.Zc(h),this.V(S,a,u,[d],g,v,!1,b).next()):b===!0?(u=new m.GC(h,a,u,d,g,!1,!1,S),m.Gh.local().V(u,a,S)):new m.GC(h,a,u,d,g,!1,!1,S)},p.instance=null,p}(m.Je);m.FC=D}(ie||(ie={})),function(m){var D=function(){function E(p,h,a,u,d,g,v,b){if(g)throw m.i.Ie();if(h==null)throw m.i.N();this.ya=-1,this.Ms=p,this.vg=h,this.ze=a,this.Cs=u,this.$n=d,this.eo=-1,this.Ub=b,this.uT=new m.l,this.uT.Oa()}return E.prototype.next=function(){for(var p;(p=this.Ms.next())!=null;)return this.ya=this.Ms.La(),this.eo+1h.Db())return 0;if(u==4)throw m.i.Ie();var d=m.cb.sc(a),g=m.cb.vv(d),v=m.cb.ev(d);g*=2-g;var b=d.Hd().ai,S=h.getType();if(S==1736||S==197)var C=h.mg();else m.aa.yd(S)?(C=new m.Ta(h.description)).oc(h,!0):C=h;if(d.Nb(a)==0){if(m.cb.Wc(a)){C=m.Hh.lj(C,a),S==1607&&C==h&&(C=m.aa.jg(h)),h=new m.Nc,m.cb.gh(a).cn(h),S=0;for(var O=C.I();S=this.Fi||7d||a==0&&h==550&&this.Dj==33?this.nJ():E.HB(p,u);if((this.Fi==-1||this.Fi==4)&&h==197&&this.Dj==197)return a=this.Se,h=new m.l,p.A(h),u=new m.l,a.A(u),h.Ea(u),a=new m.Fh,p.copyTo(a),a.Xo(h),a;if(h==197&&m.aa.tf(this.Dj)==0||this.Dj==197&&m.aa.tf(h)==0)return u=h==197?p:this.Se,p=h==197?this.Se:p,h=new m.l,u.A(h),m.Ud.clip(p,h,a,0);if(m.aa.tf(h)==0&&0b&&(b=a.yz()),g=a.I()+u.I(),b*u.I()>Math.log(g)*g*4)return null;g=null,b=u.Ga(),S!=null&&S.Fb!=null&&(g=S.Fb),g==null&&20q){if(g!=null)for(u==null?u=g.vR(oe,d):u.Uo(oe,d),q=u.next();q!=-1;q=u.next()){b.Vb(g.ja(q)),q=b.ha();var ge=oe.Ea(q,null,C,null,d);for(q=0;qee?($=S.wb()-a.Ba(K),N=1,ee=ee==0?3:2):N++:(p.oc(me,ee==0),ee=1);break;case 0:ee=0,$=-1,N=0;break;default:return null}me=Te}}}else{if(0>(q=this.QD(h,oe.ac(),d)))return null;q==1?(2>ee&&($=S.wb()-a.Ba(K),ee=ee==0?3:2),N++):($=-1,N=0)}O.clear(!1)}else q!=0&&q==1&&(ee==0?(ee=3,$=S.wb()-a.Ba(K)):ee==1?(ee=2,$=S.wb()-a.Ba(K)):N++)}2<=ee&&(p.Dr(a,K,$,N,ee==3),$=-1)}return p},E.prototype.QD=function(p,h,a){return m.Dg.wm(p,h,a)},E.prototype.RD=function(p,h,a){var u=h.ac();h=h.wc();var d=m.Dg.wm(p,u,a),g=m.Dg.wm(p,h,a);return d==1&&g==0||d==0&&g==1?-1:d==0||g==0?0:d==1||g==1?1:((d=new m.h).add(u,h),d.scale(.5),(p=m.Dg.wm(p,d,a))==0?0:p==1?1:-1)},E.HB=function(p,h){return h?p:p.Ia()},E.prototype.nJ=function(){return this.yH==null&&(this.yH=this.Se.Ia()),this.yH},E.prototype.qe=function(){},E}();m.HC=D}(ie||(ie={})),function(m){var D=function(E){function p(){return E!==null&&E.apply(this,arguments)||this}return Ke(p,E),p.prototype.getType=function(){return 28},p.local=function(){return p.instance===null&&(p.instance=new p),p.instance},p.prototype.V=function(h,a,u,d,g,v,b){return h instanceof m.aa?(h=new m.Zc(h),this.V(h,a,u,d,g,v,b).next()):new m.xL(h,a,u,d,g,v,b)},p.instance=null,p}(m.Je);m.IC=D}(ie||(ie={})),function(m){var D=function(){function E(p,h,a,u,d,g,v){this.ya=-1,this.Rd=p,this.Mj=h,this.Ka=a,this.Ki=u,this.CA=d,this.uH=g,this.nd=v}return E.prototype.next=function(){var p=this.Rd.next();return p!=null?(this.ya=this.Rd.La(),this.jL(p)):null},E.prototype.La=function(){return this.ya},E.prototype.jL=function(p){var h=0>=this.uH?m.ta.kj(this.Mj,p,!1):this.uH;return m.IK.V(p,this.Ka,this.Ki,this.CA,h,this.nd)},E.prototype.qe=function(){},E}();m.xL=D}(ie||(ie={})),function(m){var D;(D=m.NK||(m.NK={}))[D.clipToDomainOnly=1]="clipToDomainOnly",D[D.clipWithHorizon=2]="clipWithHorizon",D[D.foldAndClipWithHorizon=3]="foldAndClipWithHorizon";var E=function(p){function h(){return p!==null&&p.apply(this,arguments)||this}return Ke(h,p),h.prototype.getType=function(){return 0},h.local=function(){return h.instance===null&&(h.instance=new h),h.instance},h.prototype.V=function(a,u,d){return a instanceof m.aa?(a=new m.Zc(a),this.V(a,u,d).next()):new m.yL(a,u,d)},h.prototype.transform=function(a,u,d,g){return m.bu.transform(a,u,d,g,!0)},h.prototype.Qt=function(a,u,d,g){return m.bu.Qt(a,u,d,g)},h.instance=null,h}(m.Je);m.Hx=E}(ie||(ie={})),function(m){var D=function(){function E(p,h,a){this.ya=-1,this.Rd=p,this.MT=h,this.nd=a}return E.prototype.next=function(){var p=this.Rd.next();return p!=null?(this.ya=this.Rd.La(),m.bu.zh(p,this.MT,this.nd)):null},E.prototype.La=function(){return this.ya},E.prototype.qe=function(){},E}();m.yL=D}(ie||(ie={})),function(m){var D=function(){function p(){}return p.prototype.reset=function(){this.ph=this.xk=-1,this.us=this.kq=!1},p.prototype.AQ=function(h,a,u){for(h.Vb(a,u);h.Ha();){var d=h.ha();if((d=d.Qb())!=0)return h.wb()}for(h.Vb(a,u);h.Ez();)if((d=(d=h.li()).Qb())!=0)return h.wb();return-1},p.prototype.BQ=function(h,a){for(h.Vb(a,-1);h.Ez();)if(h.li().Qb()!=0)return h.wb();return-1},p.prototype.zQ=function(h,a){for(h.Vb(a,-1),h.ha();h.Ha();)if(h.ha().Qb()!=0)return h.wb();return-1},p.prototype.yQ=function(h,a,u,d){if(this.xk=this.AQ(a,u,d),this.xk!=-1){a.Vb(this.xk,-1);var g=a.ha(),v=g.hc(g.fe(h,!1));if(u=m.h.yc(v,h),(d=new m.h).L(v),d.sub(g.ac()),(v=new m.h).L(h),v.sub(g.ac()),this.kq=0>d.wi(v),this.ph=this.zQ(a,this.xk),this.ph!=-1){a.Vb(this.ph,-1);var b=(g=a.ha()).fe(h,!1);b=g.hc(b);var S=m.h.yc(b,h);S>u?this.ph=-1:(d.L(b),d.sub(g.ac()),v.L(h),v.sub(g.ac()),this.us=0>d.wi(v))}this.ph==-1&&(this.ph=this.BQ(a,this.xk),this.ph!=-1&&(a.Vb(this.ph,-1),b=(g=a.ha()).fe(h,!1),b=g.hc(b),(S=m.h.yc(b,h))>u?this.ph=-1:(d.L(b),d.sub(g.ac()),v.L(h),v.sub(g.ac()),this.us=0>d.wi(v),h=this.xk,this.xk=this.ph,this.ph=h,h=this.kq,this.kq=this.us,this.us=h)))}},p.prototype.cO=function(h,a,u,d,g){return u=u.Ga(),this.yQ(h,u,d,g),this.xk!=-1&&this.ph==-1?this.kq:this.xk!=-1&&this.ph!=-1?this.kq==this.us?this.kq:(u.Vb(this.xk,-1),h=u.ha().kg(),u.Vb(this.ph,-1),a=u.ha().kg(),0<=h.wi(a)):a},p}(),E=function(p){function h(){return p!==null&&p.apply(this,arguments)||this}return Ke(h,p),h.local=function(){return h.instance===null&&(h.instance=new h),h.instance},h.prototype.getType=function(){return 3},h.prototype.nz=function(a,u,d){var g;if(g===void 0&&(g=!1),a.B())return new m.$l;u=u.D();var v=a,b=a.getType();switch(b==197&&((v=new m.Da).ad(a,!1),b=1736),b){case 33:return this.xI(v,u);case 550:return this.jI(v,u);case 1607:case 1736:return this.bU(v,u,d,g);default:throw m.i.fa("not implemented")}},h.prototype.oz=function(a,u){if(a.B())return new m.$l;u=u.D();var d=a,g=a.getType();switch(g==197&&((d=new m.Da).ad(a,!1),g=1736),g){case 33:return this.xI(d,u);case 550:case 1607:case 1736:return this.jI(d,u);default:throw m.i.fa("not implemented")}},h.prototype.pz=function(a,u,d,g){if(0>g)throw m.i.N();if(a.B())return[];u=u.D();var v=a,b=a.getType();switch(b==197&&((v=new m.Da).ad(a,!1),b=1736),b){case 33:return this.TU(v,u,d,g);case 550:case 1607:case 1736:return this.tU(v,u,d,g);default:throw m.i.fa("not implemented")}},h.prototype.bU=function(a,u,d,g){if(a.getType()==1736&&d&&(d=new m.l,a.A(d),d=m.ta.Wd(null,d,!1),(g?m.hd.Yd(a,u,0):m.hd.Yd(a,u,d))!=0)){var v=new m.$l(u,0,0);return g&&v.WJ(!0),v}var b=a.Ga();v=new m.h;for(var S=d=-1,C=17976931348623157e292,O=0;b.$a();)for(;b.Ha();){var R=b.ha();R=R.hc(R.fe(u,!1));var $=m.h.yc(R,u);$m.h.Uq(u,R.ac(),R.wc()),1=u||(a.length=g),a.slice(0)},h.instance=null,h}(m.Je);m.Ix=E}(ie||(ie={})),function(m){var D=function(E){function p(){return E!==null&&E.apply(this,arguments)||this}return Ke(p,E),p.prototype.getType=function(){return 4},p.prototype.V=function(h,a,u,d,g){return m.am.yB(h,a,u,d,g)},p.local=function(){return p.instance===null&&(p.instance=new p),p.instance},p.prototype.Iu=function(h){return m.Vt.wy(h)},p.prototype.wn=function(h,a,u){m.Vt.CD(h,a,u)},p.instance=null,p}(m.Je);m.zL=D}(ie||(ie={})),function(m){var D=function(E){function p(){return E!==null&&E.apply(this,arguments)||this}return Ke(p,E),p.prototype.getType=function(){return 33},p.prototype.V=function(h,a,u,d,g){return h===1073741824?!m.ud.zB(a,u,d,4,g):m.ud.zB(a,u,d,h,g)},p.local=function(){return p.instance===null&&(p.instance=new p),p.instance},p.prototype.Iu=function(h){return m.Vt.wy(h)},p.prototype.wn=function(h,a,u){m.Vt.CD(h,a,u)},p.instance=null,p}(m.Je);m.dj=D}(ie||(ie={})),function(m){var D=function(){function E(p,h,a,u){if(this.nd=u,this.rT=a,this.ya=-1,p==null)throw m.i.N();this.yk=p,this.Mj=h}return E.prototype.next=function(){var p;if((p=this.yk.next())!=null){if(this.ya=this.yk.La(),this.nd!=null&&!this.nd.progress(-1,-1))throw m.i.fu("user_canceled");return this.eC(p)}return null},E.prototype.La=function(){return this.ya},E.prototype.eC=function(p){if(p==null)throw m.i.N();return m.Jx.cK(p,this.Mj,this.rT,this.nd)},E.prototype.qe=function(){},E}();m.AL=D}(ie||(ie={})),function(m){var D=function(E){function p(){return E!==null&&E.apply(this,arguments)||this}return Ke(p,E),p.prototype.getType=function(){return 26},p.prototype.V=function(h,a,u,d){return h instanceof m.aa?(h=new m.Zc(h),this.V(h,a,u,d).next()):new m.AL(h,a,u,d)},p.prototype.rs=function(h,a,u,d,g){return 0<(d!==void 0?m.Jx.rs(h,a,u,d,g):m.Jx.rs(h,a,!1,null,u))},p.local=function(){return p.instance===null&&(p.instance=new p),p.instance},p.instance=null,p}(m.Je);m.Yl=D}(ie||(ie={})),function(m){var D=function(){function g(){this.yq=0}return g.prototype.nX=function(v){this.yq&=-2,this.yq|=v?1:0},g.prototype.Wp=function(){return(1&this.yq)!=0},g.prototype.XF=function(){return this.Wp()?0:1},g}();m.xY=D;var E=function(){},p=function(g,v,b,S){this.x=g,this.y=v,this.Ai=b,this.xm=S},h=function(){function g(v){this.Be=v}return g.prototype.compare=function(v,b,S){return v=v.ja(S),b=this.Be.lf.read(2*b),0>(b-=v=this.Be.lf.read(2*v))?-1:0R?1:0},g}(),u=function(){function g(v,b){this.YI=new m.h,this.parent=v,this.dS=b}return g.prototype.nr=function(v,b,S){var C=this.parent,O=this.dS;S.Vd(v,b,function(R,$){return C.Mh(R,$,O)})},g.prototype.$p=function(v){return v=this.parent.gi.get(v),this.parent.lf.tc(2*(v>>1),this.YI),this.YI.y+(1&v?this.parent.Oj:-this.parent.Oj)},g}(),d=function(){function g(v,b,S,C,O){this.nH=v.description,this.X=v,this.Qg=b,this.Oj=m.ta.kj(this.Qg,v,!1),this.Bo=m.ta.kj(this.Qg,v,!0),this.xA=S,this.oT=this.nH.Aa,this.hb=[],this.po=[],this.mh=new m.jp,this.fb=new m.Yj,this.ke=new m.Md,this.ZG=this.ql=O}return g.prototype.eT=function(){return this.ZG=!0,(!m.aa.Hc(this.X.getType())||this.GE()&&this.DE(!1))&&this.mO()?m.aa.Hc(this.X.getType())?this.pO()?this.X.getType()==1607?this.rO()?2:0:this.sO()?this.tO():0:0:2:0},g.prototype.kC=function(v,b){var S=this.lf.read(2*v);v=this.lf.read(2*v+1);var C=this.lf.read(2*b);b=this.lf.read(2*b+1);var O=!m.Yt.Cv(S,v,C,b,this.Oj*this.Oj);return O||this.X.Db()!=0&&S==C&&v==b},g.prototype.GE=function(){for(var v=this.X,b=v.xf?3:2,S=0,C=v.da();Sthis.Oj)){if(v&&C){var R=O.wv(1,0);if(O=O.wv(1,0),Math.abs(O-R)>b)continue}return this.ke=new m.Md(2,S.wb(),-1),!1}}return!0},g.prototype.mO=function(){var v=this.X,b=null;m.aa.Hc(this.X.getType())&&(b=this.X);var S=(this.ZG||this.ql)&&b!=null,C=v.I();this.lf=v.ub(0),this.gi=new m.ia(0),this.gi.Jb(2*C),this.fi=new m.ia(0),this.fi.Jb(2*C),S&&(this.Fl==null&&(this.Fl=new m.ia(0)),this.Fl.Jb(C));for(var O=v=0;O=b.Vc(v);)v++;this.Fl.add(v)}for(new m.Xt().sort(this.fi,0,2*C,new u(this,S)),this.fb.clear(),this.fb.Vo(new h(this)),this.fb.De(C),b=0,C*=2;b>1,(1&v)==0){if(v=this.fb.addElement(S,-1),(O=this.fb.we(v))!=-1&&!this.kC(this.fb.ja(O),S))return this.ke=new m.Md(3,S,this.fb.ja(O)),!1;var R=this.fb.lb(v);if(R!=-1&&!this.kC(this.fb.ja(R),S))return this.ke=new m.Md(3,S,this.fb.ja(R)),!1}else if(v=this.fb.search(S,-1),O=this.fb.we(v),R=this.fb.lb(v),this.fb.vd(v,-1),O!=-1&&R!=-1&&!this.kC(this.fb.ja(O),this.fb.ja(R)))return this.ke=new m.Md(3,this.fb.ja(O),this.fb.ja(R)),!1;return!0},g.prototype.pO=function(){return 10>this.X.I()?this.nO():this.oO()},g.prototype.oO=function(){var v=new m.gd;v.Ib(this.X);var b=new m.Md;return!m.$t.kI(!1,v,this.Oj,b,this.nd)||(b.Jo=v.Ua(b.Jo),b.Ko=v.Ua(b.Ko),this.ke.Wt(b),!1)},g.prototype.nO=function(){var v=this.X,b=v.Ga();for(v=v.Ga();b.$a();)for(;b.Ha();){var S=b.ha();if(!b.Qn()||!b.$S()){v.BW(b);do for(;v.Ha();){var C=v.ha();if((C=S.zr(C,this.Oj,!0))!=0)return this.ke=new m.Md(C==2?5:4,b.wb(),v.wb()),!1}while(v.$a())}}return!0},g.prototype.sO=function(){var v=this.X;this.hb.length=0,this.po.length=0,this.Zf=v.Ga(),this.Zf.JB();var b=new m.ia(0);b.Jb(10);var S=NaN,C=0,O=0;for(v=2*v.I();O>=1;var $=this.lf.read(2*R),N=this.lf.read(2*R+1);if(b.size!=0&&($!=S||N!=C)){if(!this.RI(b))return!1;b!=null&&b.clear(!1)}b.add(R),S=$,C=N}}return!!this.RI(b)},g.prototype.rO=function(){for(var v=this.X,b=Array(v.da()),S=0,C=v.da();S>1;this.lf.tc(2*R,O);var $=b[S=this.Fl.get(R)],N=v.Ba(S),B=v.Vc(S)-1;C.el=R==N||R==B,C.ny=this.ql?!$&&C.el:C.el,C.Ai=S,C.x=O.x,C.y=O.y,C.xm=R;for(var G=new E,K=1,ee=this.fi.size;K>1,this.lf.tc(2*R,O),(S=this.Fl.get(R))!=C.Ai&&($=b[S],N=v.Ba(S),B=v.Vc(S)-1);var q=R==N||R==B,oe=this.ql?!$&&C.el:C.el;if(G.x=O.x,G.y=O.y,G.Ai=S,G.xm=R,G.ny=oe,G.el=q,G.x==C.x&&G.y==C.y){if(this.ql){if(!(G.ny&&C.ny||G.Ai==C.Ai&&(G.el||C.el)))return this.ke=new m.Md(8,G.xm,C.xm),!1}else if(!G.el||!C.el)return this.ke=new m.Md(5,G.xm,C.xm),!1}S=C,C=G,G=S}return!0},g.prototype.JE=function(){for(var v=this.X,b=[],S=-1,C=!1,O=0,R=v.da();O>1;this.lf.tc(2*$,C),O=this.Fl.get($),S=new p(C.x,C.y,O,$,b[O]),v=[];var N=1;for(R=this.fi.size;N>1,this.lf.tc(2*$,C),O=this.Fl.get($),(O=new p(C.x,C.y,O,$,b[O])).x==S.x&&O.y==S.y){if(O.Ai==S.Ai)return this.ke=new m.Md(9,O.xm,S.xm),!1;0<=b[O.Ai]&&b[O.Ai]==b[S.Ai]&&(v.length!=0&&v[v.length-1]==S||v.push(S),v.push(O))}S=O}if(v.length==0)return!0;for(O=new m.jp(!0),m.O.$u(b,-1),C=-1,(N=new m.h).Rc(),S=0,R=v.length;S=v.Ke())return this.ke=new m.Md(6,v.da()==1?1:-1,-1),0;if(v.da()==1)return this.ql&&!this.JE()?0:2;this.to=m.ia.qf(v.da(),0),this.JA=m.ia.qf(v.da(),-1);for(var b=-1,S=0,C=0,O=v.da();CR?0:256),0b||S>=1,(C=this.lf.read(2*S+1))!=this.Mo&&v.size!=0){if(!this.ut(v))return 0;v!=null&&v.clear(!1)}v.add(S),this.Mo=C}return 0O.la){var $=this.Zf.wb(),N=this.Su(O,C,this.Zf.gb,!0);0v.Ja(b.gb))){S.EW();for(var G,K,ee=!0;b.Ha();){var q=b.ha(),oe=S.li();if(b.wb()>S.wb())break;ee&&(N.add(b.wb()),B.add(S.ik()),ee=!1),K=N.Fc();var ge=b.ik();if(1this.Bo?N.add(b.ik()):R&&(G=v.Uc(1,N.Fc(),0),q=q.gv(1,0),Math.abs(q-G)>$&&N.add(b.ik())),K>this.Bo?B.add(S.wb()):R&&(G=v.Uc(1,B.Fc(),0),q=oe.gv(1,0),Math.abs(q-G)>$&&B.add(S.wb()))}if(N.Fc()B.size?N.If():B.If():(N.Fc()!=B.Fc()&&B.If(),B.If()),2<=B.size+N.size){for(ee=new m.Sa,oe=0,q=N.size;oe>1;var O=C>>1,R=new m.h,$=new m.h;return this.lf.tc(2*b,R),R.y+=1&v?this.Oj:-this.Oj,this.lf.tc(2*O,$),$.y+=1&C?this.Oj:-this.Oj,(v=R.compare($))==0&&S?0>(S=this.Fl.get(b)-this.Fl.get(O))?-1:0O.x)return 1;if(C.yO.y)return 1;for(C=1;CB)return 1}}return 0},g.prototype.PO=function(v,b){var S=this.Ou(v,b);return S==0?vb?1:0v?h:a;if(h.B())return a;if(a.B())return h;var b=new m.l,S=new m.l,C=new m.l;return h.A(b),a.A(S),C.K(b),C.Zb(S),b=m.ta.Wd(u,C,!0),S=h.getType(),C=a.getType(),S==33&&C==33?p.aV(h,a,b):S!=C?0v?h:a:S==550?p.iI(h,a,b):p.iI(a,h,b):m.Fg.ep(h,a,u,d)},p.aV=function(h,a,u){u=u*Math.sqrt(2)*1.00001,u*=u;var d=h.D(),g=a.D(),v=new m.de(h.description);return m.h.yc(d,g)>u&&(v.add(h),v.add(a)),v},p.iI=function(h,a,u){var d=h.ub(0),g=h.I(),v=a.D(),b=h.Ia();u=u*Math.sqrt(2)*1.00001;var S=new m.l;if(h.A(S),S.W(u,u),S.contains(v)){u*=u,S=!1;for(var C=[],O=0;Othis.zk||0>this.bo)throw m.i.Qa();if(this.AH[this.bo])break}return this.ya++,this.fG(this.bo)}return this.ya=0,this.bo=this.zk,this.fG(this.zk)},h.prototype.La=function(){return this.ya},h.prototype.qK=function(){if(this.Ic)return!0;var a=null;if(this.Rd!=null&&(a=this.Rd.next())==null&&(this.Ic=!0,this.Rd=null),m.mp.zp(this.Ub),a!=null){var u=a.Db();this.AH[u]=!0,u>=this.zk&&!this.jA&&(this.ND(u,!1,a),u>this.zk&&!this.jA&&this.zW(u))}if(0this.Do.length)for(var v=0,b=Math.max(2,a+1);vu?m.F.Wq(O,C,S,R,0):m.F.Wq(O,S,C,R,0),N=[0,0,0],B=[0,0,0];var ee=[0,0,0];S=[0,0,0],$=[0,0,0];var q=Math.acos(R[2]/1),oe=1-p,ge=Math.tan(q),me=1+ge*ge/oe,Me=2*O[2]*ge/oe;for(oe=(-Me+(ge=Math.sqrt(Me*Me-4*me*(O[2]*O[2]/oe-1))))/(me*=2),Me=(-Me-ge)/me,ge=Math.tan(q),q=(oe+Me)/2,O=((me=ge*oe+O[2])+(ge*Me+O[2]))/2,ge=m.F.gp(oe-q,me-O),oe=O/K*1.570796326794897,Me=0;100>Me&&(me=(me=m.F.w(p,oe))*me/Math.cos(oe)*(Math.sin(oe)-O*me/(1-p)),!m.s.Cd(me));Me++)oe-=me;O=m.F.n(1,p,oe)*Math.cos(oe),ge=1-ge/(O=Math.sqrt((O-q)*(O+q))),ge*=2-ge,me=m.F.on(N),q=m.F.on(B),oe=m.F.on(ee);var Te=m.F.St(ee,N);Me=m.F.St(ee,B),m.F.zx(ee,N,S),m.F.zx(ee,B,$),N=Math.acos(Te/(oe*me)),B=Math.acos(Me/(oe*q)),B*=m.s.Mb(1,m.F.St(S,$)),(1.570796326794897<=m.s.P(N)&&1.570796326794897<=m.s.P(B)||3.141592653589793$&&0>u)&&(u=m.F.ba(u+3.141592653589793)),g!=null&&(g.u=S),v!=null&&(v.u=$),b!=null&&(b.u=u)}}},D.rf=function(E,p,h,a,u,d,g,v){var b=[0,0,0],S=[0,0,0],C=[0,0,0],O=[0,0,0],R=[0,0,0],$=[0,0,0],N=[0,0,0],B=[0,0,0,0],G=new m.ga(0),K=new m.ga(0),ee=new m.ga(0),q=new m.ga(0),oe=new m.ga(0),ge=new m.ga(0);if(g!=null&&v!=null)if(m.s.ti(p))m.Yg.rf(E,h,a,u,d,g,v);else if(m.s.Cd(u))g!=null&&(g.u=h),v!=null&&(v.u=a);else if(d=m.F.ba(d),0>u&&(u=m.s.P(u),d=m.F.ba(d+3.141592653589793)),h=m.F.ba(h),a=m.F.ba(a),1.570796326794897d?m.F.Wq(N,R,b,B,0):m.F.Wq(N,b,R,B,0),b=Math.acos(B[2]/1),B=Math.atan2(-B[1],-B[0]),a=1-p,oe=1+(R=Math.tan(b))*R/a,a=(-(q=2*N[2]*R/a)+(R=Math.sqrt(q*q-4*oe*(N[2]*N[2]/a-1))))/(oe*=2),q=(-q-R)/oe,R=Math.tan(b),b=(a+q)/2,N=((oe=R*a+N[2])+(R*q+N[2]))/2,R=m.F.gp(a-b,oe-N),me=N/me*1.570796326794897,a=0;100>a&&(q=(q=m.F.w(p,me))*q/Math.cos(me)*(Math.sin(me)-N*q/(1-p)),!m.s.Cd(q));a++)me-=q;me=m.F.n(1,p,me)*Math.cos(me),N=1-R/(me=Math.sqrt((me-b)*(me+b))),N*=2-N,$=Math.acos(m.F.St($,S)/(m.F.on($)*m.F.on(S))),$*=m.s.Mb(1,S[0]),d=(m.F.q(me,N,m.F.Qj(N,$))+E*m.s.Mb(1,d))/m.F.Ah(me,N),d=m.F.ba(1.570796326794897*d),d=m.F.Rq(N,d),m.F.n(me,N,d),R=m.F.ba(B+h),h=Math.cos(R),d=Math.sin(R),C[0]=O[0]*h+O[1]*-d,C[1]=O[0]*d+O[1]*h,C[2]=O[2],m.F.jO(p,C[0],C[1],C[2],ee,K,G),g!=null&&(g.u=K.u),v!=null&&(v.u=ee.u)}},D}()}(ie||(ie={})),function(m){var D=function(){function u(d){this.Ya=null,this.wt=new m.h,this.xt=new m.h,this.g=d}return u.prototype.compare=function(d,g,v){return this.g.Gc(g,this.wt),this.g.Gc(d.ja(v),this.xt),this.wt.compare(this.xt)},u}(),E=function(){function u(d){this.Bf=new m.h,this.Dk=new m.h,this.g=d}return u.prototype.Dh=function(d){this.Bf.L(d)},u.prototype.compare=function(d,g){return this.g.Gc(d.ja(g),this.Dk),this.Bf.compare(this.Dk)},u}(),p=function(u){function d(g){var v=u.call(this,g.g,g.qa,!1)||this;return v.ib=g,v}return Ke(d,u),d.prototype.compare=function(g,v,b){if(this.rg)return-1;var S=this.ib.Qd.Jn(this.ib.Rh(v));g=g.ja(b);var C=this.ib.Qd.Jn(this.ib.Rh(g));return this.Dm=b,this.RE(v,S,g,C)},d}(m.UC),h=function(u){function d(g){var v=u.call(this,g.g,g.qa)||this;return v.ib=g,v}return Ke(d,u),d.prototype.compare=function(g,v){return this.rg?-1:(g=this.ib.Qd.Jn(this.ib.Rh(g.ja(v))),this.Dm=v,this.SE(v,g))},d}(m.aM),a=function(){function u(){this.Mc=this.df=this.jo=this.Qd=this.lh=this.zd=this.hb=this.g=null,this.Ng=!1,this.vh=this.Nm=this.ie=this.Gk=this.nh=this.Ak=this.Ff=this.$d=null,this.xh=this.Jq=this.UA=this.qa=0,this.Xv=this.Wn=!1,this.yo=new m.h,this.Pi=new m.h,this.hb=new m.$c(8),this.zd=new m.$c(5),this.lh=new m.au,this.Qd=new m.au,this.Ng=!1,this.vh=new m.h,this.vh.ma(0,0),this.qa=0,this.xh=-1,this.Wn=!1,this.g=null,this.df=new m.Yj,this.Mc=new m.Yj,this.nh=new m.ia(0),this.Gk=new m.TC,this.Ff=new m.ia(0),this.Ak=new m.ia(0),this.jo=new m.Sa}return u.prototype.PX=function(d,g){var v=new m.Dd;return v.$B(),d.Oc(v),this.er(d),this.Wn=!1,this.qa=g,this.UA=g*g,g=this.jC(),d.Oc(v),g||(this.qQ(),g||this.jC()),this.xh!=-1&&(this.g.Td(this.xh),this.xh=-1),this.g=null,this.Wn},u.prototype.TX=function(d,g){this.er(d),this.Wn=!1,this.qa=g,this.UA=g*g,this.Ng=!1,this.jC(),this.Ng||(this.Ng=d.Gp(g,!0,!1)==1),this.xh!=-1&&(this.g.Td(this.xh),this.xh=-1),this.g=null},u.prototype.pg=function(d,g){return this.hb.T(d,0+g)},u.prototype.LB=function(d,g,v){this.hb.S(d,0+g,v)},u.prototype.Rh=function(d){return this.hb.T(d,2)},u.prototype.ZW=function(d,g){this.hb.S(d,2,g)},u.prototype.RF=function(d,g){return this.hb.T(d,3+g)},u.prototype.Pp=function(d){return this.hb.T(d,7)},u.prototype.Pl=function(d,g){this.hb.S(d,7,g)},u.prototype.Rp=function(d,g){return this.hb.T(d,3+this.Op(d,g))},u.prototype.fr=function(d,g,v){this.hb.S(d,3+this.Op(d,g),v)},u.prototype.NR=function(d,g){return this.hb.T(d,5+this.Op(d,g))},u.prototype.hr=function(d,g,v){this.hb.S(d,5+this.Op(d,g),v)},u.prototype.Sr=function(d){return this.zd.T(d,0)},u.prototype.UW=function(d,g){this.zd.S(d,0,g)},u.prototype.ez=function(d){return this.zd.T(d,4)},u.prototype.cr=function(d,g){this.zd.S(d,4,g)},u.prototype.il=function(d){return this.zd.T(d,1)},u.prototype.ln=function(d,g){this.zd.S(d,1,g)},u.prototype.dz=function(d){return this.zd.T(d,3)},u.prototype.Et=function(d,g){this.zd.S(d,3,g)},u.prototype.Ym=function(d){var g=this.zd.Ce(),v=this.lh.Ph();return this.UW(g,v),d!=-1?(this.lh.addElement(v,d),this.g.Ra(d,this.xh,g),this.cr(g,this.g.Ua(d))):this.cr(g,-1),g},u.prototype.HP=function(d){this.zd.jd(d)},u.prototype.LD=function(d,g){this.lh.addElement(this.Sr(d),g),this.g.Ra(g,this.xh,d)},u.prototype.nt=function(d){var g=this.hb.Ce(),v=this.Qd.Ph();return this.ZW(g,v),d!=-1&&this.Qd.addElement(v,d),g},u.prototype.MD=function(d,g){this.Qd.addElement(this.Rh(d),g)},u.prototype.Uu=function(d){this.hb.jd(d),0<=(d=this.nh.lF(d))&&this.nh.SV(d)},u.prototype.hj=function(d,g){if(this.pg(d,0)==-1)this.LB(d,0,g);else{if(this.pg(d,1)!=-1)throw m.i.Qa();this.LB(d,1,g)}this.ky(d,g)},u.prototype.ky=function(d,g){var v=this.il(g);if(v!=-1){var b=this.Rp(v,g);this.hr(b,g,d),this.fr(d,g,b),this.fr(v,g,d),this.hr(d,g,v)}else this.hr(d,g,d),this.fr(d,g,d),this.ln(g,d)},u.prototype.Op=function(d,g){return this.pg(d,0)==g?0:1},u.prototype.Xm=function(d,g){var v,b=this.dz(g);if(b!=-1&&(this.df.vd(b,-1),this.Et(g,-1)),(b=this.il(g))!=-1){var S=v=b;do{var C=!1,O=this.Op(v,g),R=this.RF(v,O);if(this.pg(v,O+1&1)==d){if(this.Xu(v),this.Qd.bh(this.Rh(v)),this.Uu(v),v==R){b=-1;break}b==v&&(b=this.il(g),S=R,C=!0)}v=R}while(v!=S||C);if(b!=-1){do O=this.Op(v,g),R=this.RF(v,O),this.LB(v,O,d),v=R;while(v!=S);(v=this.il(d))!=-1?(S=this.Rp(v,d),C=this.Rp(b,d),S==v?(this.ln(d,b),this.ky(v,d),this.ln(d,v)):C==b&&this.ky(b,d),this.fr(b,d,S),this.hr(S,d,b),this.fr(v,d,C),this.hr(C,d,v)):this.ln(d,b)}}for(b=this.Sr(d),v=this.Sr(g),S=this.lh.rc(v);S!=-1;S=this.lh.lb(S))this.g.Ra(this.lh.ja(S),this.xh,d);this.lh.Hy(b,v),this.HP(g)},u.prototype.UT=function(d,g){var v=this.pg(d,0),b=this.pg(d,1),S=this.pg(g,0),C=this.pg(g,1);this.Qd.Hy(this.Rh(d),this.Rh(g)),g==this.il(v)&&this.ln(v,d),g==this.il(b)&&this.ln(b,d),this.Xu(g),this.Uu(g),v==S&&b==C||b==S&&v==C||(this.Hn(v,this.yo),this.Hn(S,this.Pi),this.yo.qb(this.Pi)?(v!=S&&this.Xm(v,S),b!=C&&this.Xm(b,C)):(b!=S&&this.Xm(b,S),v!=C&&this.Xm(v,C)))},u.prototype.Xu=function(d){var g=this.pg(d,1);this.dF(d,this.pg(d,0)),this.dF(d,g)},u.prototype.dF=function(d,g){var v=this.Rp(d,g),b=this.NR(d,g),S=this.il(g);v!=d?(this.fr(b,g,v),this.hr(v,g,b),S==d&&this.ln(g,v)):this.ln(g,-1)},u.prototype.WD=function(d,g,v){var b=this.Qd.rc(d),S=this.Qd.ja(b);d=this.Le(S);var C=this.Le(this.g.U(S));for(this.g.jr(S,g,v,!0),b=this.Qd.lb(b);b!=-1;b=this.Qd.lb(b)){S=this.Qd.ja(b);var O=this.Le(S)==d;this.g.jr(S,g,v,O)}b=g.Vp(v,0).ac(),g=g.Vp(v,g.ol(v)-1).wc(),this.BK(d,b),this.BK(C,g)},u.prototype.ZE=function(d,g,v){var b=this.Rh(d),S=this.pg(d,0),C=this.pg(d,1),O=this.nt(-1);for(this.nh.add(O),this.Pl(O,-3),this.Ff.add(O),this.hj(O,S),d=1,g=g.ol(v);dthis.ez(O)&&this.cr(O,this.g.Ua(C))),O=this.Ff.get(d),d-=2,this.MD(O,C),C=this.g.U(C);while(0<=d)}this.Ff.clear(!1)},u.prototype.Le=function(d){return this.g.Pa(d,this.xh)},u.prototype.TI=function(d,g,v){var b=this.pg(g,0),S=new m.h;this.Hn(b,S);var C=new m.h,O=this.pg(g,1);this.Hn(O,C);var R=v.ol(d),$=v.Vp(d,0),N=new m.h;if($.Yp(N),!S.qb(N)){if(!this.Ng){var B=S.compare(this.vh);0>B*(N=N.compare(this.vh))&&(this.Ng=!0)}this.vF(b,this.Ff),this.Ak.add(b)}for(!this.Ng&&1$.compare(this.vh))&&(this.Ng=!0)),d=($=v.Vp(d,R-1)).wc(),C.qb(d)||(this.Ng||0>(B=C.compare(this.vh))*(N=d.compare(this.vh))&&(this.Ng=!0),this.vF(O,this.Ff),this.Ak.add(O)),this.Ff.add(g),C=0,O=this.Ff.size;CMath.max(100,this.g.fd)){this.nh.clear(!1),this.Ng=!0;break}var d=this.nh.Fc();this.nh.If(),this.Pl(d,-1),this.WS(d)!=-1&&this.wS(d),this.Vn=!1}},u.prototype.wS=function(d){if(this.Vn){var g=this.Mc.zu(this.MH,this.GH,d,!0);this.Vn=!1}else g=this.Mc.KD(d);g==-1?this.UT(this.Mc.ja(this.Mc.FF()),d):(this.Pl(d,g),this.$d.rg&&(this.$d.Kr(),this.oF(this.$d.Dm,g)))},u.prototype.WS=function(d){var g=this.pg(d,0);if(d=this.pg(d,1),this.Hn(g,this.yo),this.Hn(d,this.Pi),m.h.yc(this.yo,this.Pi)<=this.UA)return this.Ng=!0,-1;var v=this.yo.compare(this.vh),b=this.Pi.compare(this.vh);return 0>=v&&0=b&&0d&&(this.re(h),d=this.description.Pf(h)),this.ka==null&&this.un(),this.ka[this.description.$j(d)+a]=u},p.prototype.getType=function(){return 33},p.prototype.Db=function(){return 0},p.prototype.Oa=function(){this.vc(),this.ka!=null&&(this.ka[0]=NaN,this.ka[1]=NaN)},p.prototype.sn=function(h){if(this.ka!=null){for(var a=m.ee.Iw(h,this.description),u=[],d=0,g=0,v=h.Aa;g>>32),h=m.O.Th(d,h)}return h},p.prototype.mg=function(){return null},p}(m.aa);m.Sa=D}(ie||(ie={})),function(m){var D=function(){function E(p,h,a){p!==void 0&&(this.x=p,this.y=h,this.z=a)}return E.construct=function(p,h,a){var u=new E;return u.x=p,u.y=h,u.z=a,u},E.prototype.K=function(p,h,a){this.x=p,this.y=h,this.z=a},E.prototype.lx=function(){this.z=this.y=this.x=0},E.prototype.normalize=function(){var p=this.length();p==0&&(this.x/=p,this.y/=p,this.z/=p)},E.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},E.prototype.sub=function(p){return new E(this.x-p.x,this.y-p.y,this.z-p.z)},E.prototype.Ag=function(p){new E(this.x*p,this.y*p,this.z*p)},E.prototype.Qh=function(p){return this.x*p.x+this.y*p.y+this.z*p.z},E}();m.Nd=D}(ie||(ie={})),function(m){var D=function(){function E(p,h,a){this.Gw=this.DA=null,this.Xf=h,this.FT=h.y-a,this.ET=h.y+a,this.Ew=0,this.dA=p,this.qa=a,this.RT=a*a,this.eA=a!=0,this.Lv=!1}return E.prototype.result=function(){return this.Ew!=0?1:0},E.prototype.ZM=function(p){return p=p.hc(p.fe(this.Xf,!1)),m.h.yc(p,this.Xf)<=this.RT},E.prototype.fF=function(p){if(!this.eA&&(this.dA&&this.Xf.qb(p.ac())||this.Xf.qb(p.wc())))this.Lv=!0;else if(p.na==this.Xf.y&&p.na==p.la){if(this.dA&&!this.eA){var h=Math.max(p.sa,p.pa);this.Xf.x>Math.min(p.sa,p.pa)&&this.Xf.xh?a=!0:this.Xf.x>=Math.min(p.sa,p.pa)&&(a=0p.wc().y?1:-1)}}},E.prototype.SI=function(p){var h=p.Tg(0,1);if(h.oa>this.ET||h.vathis.Xf.y||h.va(p=p.I()))&&2*p+Math.log(p)/Math.log(2)*h<1*p*h},E}();m.Dg=D}(ie||(ie={})),function(m){var D=function(E){function p(h){return E.call(this,!0,h)||this}return Ke(p,E),p.prototype.Ia=function(){return new p(this.description)},p.prototype.Db=function(){return 2},p.prototype.getType=function(){return 1736},p.prototype.xG=function(h,a,u){this.JS(h,a,u)},p.prototype.qR=function(){this.FR()},p}(m.Vk);m.Da=D}(ie||(ie={})),function(m){(function(D){D[D.PiPOutside=0]="PiPOutside",D[D.PiPInside=1]="PiPInside",D[D.PiPBoundary=2]="PiPBoundary"})(m.RL||(m.RL={})),m.hd=function(){function D(){}return D.KG=function(E,p,h){return(E=m.Dg.bT(E,p,h))==0?0:E==1?1:2},D.Yd=function(E,p,h){return(E=m.Dg.wm(E,p,h))==0?0:E==1?1:2},D.WX=function(E,p,h,a,u){if(p.lengthp?(0>p?p+=360:360<=p&&(p-=360),p):(0>(p=m.lc.RK(p))&&(p+=360),p)},E.gP=function(p){return 180<(p=E.hP(p))&&(p-=360),p},E.oW=57.29577951308232,E}();m.qr=D,m.Hh=function(){function E(){}return E.lj=function(p,h){var a=new m.l;p.A(a);var u=m.cb.gh(h),d=new m.l;return d.K(u),d.v=a.v,d.C=a.C,d.W(.01*d.ca(),0),h=m.ta.Wd(h,a,!1),d.contains(a)?p:m.Ud.clip(p,d,h,0)},E.ks=function(p,h,a,u,d){if(!m.cb.Wc(h))throw m.i.N();var g=m.ta.kj(h,p,!1),v=m.cb.gh(h),b=m.cb.sc(h),S=b.Hd().ai,C=m.cb.vv(b);b=m.cb.ev(b),C*=2-C;var O=new m.Nc;v.cn(O);var R=[[0,0],[0,0]];if(m.Eg.Sb(h)==2?u?(R[0][0]=E.Zm(d,O),R[0][1]=v.Jp(),m.cb.vt(),v=R[0][0]*S):(R[0][0]=v.gk(),R[0][1]=d,m.cb.vt(),v=R[0][1]*S):v=d*S,!u&&v!=0)throw m.i.N();var $=new m.ga,N=new m.gd;p=N.Ib(p);for(var B=[0],G=new m.h,K=new m.h,ee=new m.h,q=new m.h,oe=new m.h,ge=new m.h,me=N.Ob(p);me!=-1;me=N.Rb(me)){var Me=N.Xa(me);N.D(Me,ee);for(var Te=!1,Fe=Me=N.U(Me);Fe!=-1;Fe=N.U(Fe)){if(Fe==Me){if(Te)break;Te=!0}if(N.D(Fe,q),u&&gg||gg||!u&&g<-ee.y&&q.y>g||g<-q.y&&ee.y>g)do if(!(Math.abs(ee.x-q.x)>=.5*O.R())){if(m.Eg.Sb(h)==2?(R[0][0]=E.Zm(ee.x,O),R[0][1]=ee.y,R[1][0]=E.Zm(q.x,O),R[1][1]=q.y,m.cb.dW(),oe.x=R[0][0]*S,oe.y=R[0][1]*S,ge.x=R[1][0]*S,ge.y=R[1][1]*S):(oe.x=ee.x*S,oe.y=ee.y*S,ge.x=q.x*S,ge.y=q.y*S),ge.x=6.283185307179586*(q.x-ee.x)/O.R()+oe.x,u){if(K.x=v,K.y=E.Nz(b,C,oe,ge,v,a),isNaN(K.y))break}else{if(K.x=E.Lz(b,C,oe,ge,a),isNaN(K.x))break;K.y=0}m.kb.wd(b,C,oe.x,oe.y,ge.x,ge.y,$,null,null,a);var Xe=$.u;m.kb.wd(b,C,oe.x,oe.y,K.x,K.y,$,null,null,a);var We=$.u;m.Eg.Sb(h)==2?(R[0][0]=K.x/S,R[0][1]=K.y/S,m.cb.bR(),u?(G.y=R[0][1],G.x=d):(G.x=E.os(R[0][0],ee.x,q.x,O),G.y=d)):u?(G.x=d,G.y=K.y/S):(G.x=E.os(K.x/S,ee.x,q.x,O),G.y=d),B[0]=0u.x)var v=u;else v=a,a=u;u=new m.ga(0);var b=new m.ga(0),S=new m.ga(0);m.kb.wd(p,h,v.x,v.y,a.x,a.y,b,u,null,g);var C=b.u,O=0,R=1,$=new m.h;for($.L(v);C*(R-O)>1e-12*p;){var N=.5*(O+R);if(m.kb.oj(p,h,v.x,v.y,C*N,u.u,b,S,g),$.x=b.u,$.y=S.u,$.x==d)break;if(E.Sn(v.x,$.x,d))R=N;else{if(!E.Sn(a.x,$.x,d))return NaN;O=N}}return $.y},E.Sn=function(p,h,a){return p=D.Cp(p),h=D.mx(p,D.Cp(h)),(a=D.mx(p,D.Cp(a)))==0||0h&&0>a&&a>=h},E.Zm=function(p,h){var a=h.va-h.oa;return h.It(p-Math.floor((p-h.oa)/a)*a)},E.os=function(p,h,a,u){var d=new m.Nc;for(d.K(h,a),a=u.R(),p=Math.floor((p-h)/a)*a+p,d=d.sf();Math.abs(p-d)>Math.abs(p+a-d);)p+=a;return p},E.Lz=function(p,h,a,u,d){if(a.y>u.y)var g=u;else g=a,a=u;if((u=new m.Nc).K(g.y,a.y),!u.contains(0)||3.141592653589793<=Math.abs(g.x-a.x))return NaN;if(g.x==a.x)return g.x;var v=new m.ga(0),b=new m.ga(0),S=new m.ga(0);m.kb.wd(p,h,g.x,g.y,a.x,a.y,b,v,null,d);var C=b.u,O=0,R=1,$=new m.h;for($.L(g);C*(R-O)>1e-12*p;){var N=.5*(O+R);if(m.kb.oj(p,h,g.x,g.y,C*N,v.u,b,S,d),$.x=b.u,$.y=S.u,u.K(g.y,$.y),$.y==0)break;if(u.contains(0))R=N;else{if(u.K(a.y,$.y),!u.contains(0))return NaN;O=N}}return $.x},E.Hp=function(p,h,a,u,d,g,v){var b=new m.l;if(p.A(b),b.B())return p;var S=new m.Nc;b.cn(S);var C=new m.Nc;if(C.K(h,h+a),C.contains(S)&&C.va!=S.va)return p;var O=new m.l;O.K(b);var R=p.getType();if(R==33)return((b=(O=d?p:p.Of()).Lg())=C.va||v&&b==C.va)&&(b+=Math.ceil((C.oa-b)/a)*a,b=C.It(b),O.cC(b)),O;if(R==550){for(u=(O=d?p:p.Of()).ub(0),R=2*O.I(),p=!1,d=0;d=C.va||v&&b==C.va)&&(p=!0,b+=Math.ceil((C.oa-b)/a)*a,b=C.It(b),u.write(d,b));return p&&O.Pc(1993),O}if(C.contains(S))return p;if(R==197)return a=d?p:p.Of(),b.Ea(O),a.Xo(b),a;var $=.1*Math.max(b.ca(),b.R());for(O.W(0,$),v=p,C=u.Xd(0),p=m.Gh.local(),d=new m.Dd;;){var N=Math.floor((S.oa-h)/a),B=Math.ceil((S.va-h)/a);if(!(3O.v;)($=m.Ud.clip(v,O,C,0)).A(S),(R==1607?!$.B()&&(S.R()>C||S.ca()>C):!$.B()&&(R!=1736||S.R()>C))&&($.Oc(d),$.A(S),h.A(g),g.W(C,C),g.isIntersecting(S)&&R==1736?h=p.V(h,$,u,null):h.add($,!1)),O.move(a,0),d.shift(-a,0);return h},E.WI=function(p,h,a,u){var d=new m.de(a.description);d.Fd(a,0,-1),d=m.cb.zh(d,p,h);var g=a.I();if(u.Oa(),!m.cb.Wc(p)||g!=d.I())return!1;var v=new m.l;a.A(v);var b=new m.l;if(d.A(b),v=v.R(),b=b.R(),v!=0&&b!=0){if(b/=v,p=m.cb.gh(h).R()/m.cb.gh(p).R(),1e-10=a[d]?u[d]=a[d].toUpperCase():a[d];return u.join()}return a.toString(m.Sc.PE_STR_AUTH_TOP)},h.ur=function(a,u,d,g){var v=g.length,b=d.I();if(b!=0){var S=d.ub(0),C=Math.min(b,v),O=0,R=a.eh();isNaN(u)&&(u=0);for(var $=a.Wc(),N=179*(a=$?a.sc().Oe().R():0)/360;0K*m.lc.sign(ee)&&Math.abs(G)>N&&(g[B][0]+=-K*a)}S.uC(O<<1,C,g),O+=C,b-=C,C=Math.min(b,v)}d.Pc(1993)}},h.IL=function(a,u,d,g){var v=0,b=a.eh();isNaN(v)&&(v=0);var S=a.Wc(),C=a.bf();a=360*C,C*=179;for(var O=g.length,R=0;Ree*m.lc.sign(G)&&Math.abs(K)>C&&(g[$][0]-=ee*a)}m.ta.Iy(u,R,g,N),R+=N}}},h.Lx=function(a,u,d){var g=d.length,v=u.I();if(!(1>v)){var b=u.ub(0),S=Math.min(v,g),C=0,O=a.eh(),R=a.Wc(),$=R?a.Oe().R():0,N=179*$/360,B=0;for(R&&(B=a.zi());0K*m.lc.sign(ee)&&Math.abs(G)>N&&(d[a][0]+=-K*$)}b.uC(C<<1,S,d),C+=S,v-=S,S=Math.min(v,g)}u.Pc(1993)}},h.HL=function(a,u,d,g){if(d!=0){var v=a.eh(),b=a.Wc(),S=b?a.Oe().R():0,C=179*S/360,O=0;for(b&&(O=a.zi()),a=0;aG*m.lc.sign(u[N].x-O)&&Math.abs(B)>C&&(g[R][0]-=G*S)}m.ta.Iy(u,a,g,$),a+=$}}}},h.tr=function(a,u,d,g){var v=u.I();if(v!=0){var b=u.ub(0),S=a.ef,C=a.Yf,O=S.sc().Qp(),R=C.sc().Qp(),$=S.bf(),N=C.bf();if((a=a.Wf)==null||a.count()==0){for(d=O/R,g=(S.Up()-C.Up())*N,R=-90*$,a=90*$,O=!1,N=1,S=2*v;Nq?g[N][1]=q:g[N][1]<-q&&(g[N][1]=-q));for($=0;$N){if(me){var Ri=Fe+(on+11*$&&(me=!1)}me||(zi=nr+(Mt-=m.lc.Cn(R,zi-lt)),++yi,cs=Mt!=0,Gi.x=zi)}else di||m.ta.AG(rn,Ct,Gi,Te)&&(di=!0);cs&&Xe.write(2*on,zi),lt=zi,rn.L(Ct),Ct.L(Gi)}0a?S=1:0>=C&&0.99*C&&(S=-1)):S=-1),S!=0&&((u=new m.Da(v.description)).tp(O),(u=m.Xl.local().V(u,d,b)).add(v,!1),q=!0,v=u),q&&(v=m.Yl.local().V(v,g,!1,b)),v},h.vQ=function(a,u,d,g,v){var b=d.I(),S=d.Na(0),C=d.Na(b-1);v=(g=h.dv(g,v)).R(),S=m.lc.sign(C.x-S.x);var O=new m.l;d.xc(O);var R=g.gk();if(C=R-v,R+=v,0<=S){var $=Math.ceil((C-O.v)/v);for($*=v;C>O.v+$;)$+=v;for(;CO.v+$;)$+=v;N=$,720C;)1024<=ee&&(ee=0),B.move($,0),G.Gb=$,d.Oc(G),K+=$,g.v<=K&&g.C>=K&&(v=O.I()-1),d.Cb(0,N),N=d.Na(b-1),O.Dr(d,0,0,b-1,!1);return d=new m.Da(O.description),b=0S?b:!b)?(S=m.h.construct(C.x,g.H),d.Ci(S),S=m.h.construct(g.gk(),g.H),d.Ci(S),g=m.h.construct(a.x,g.H)):(S=m.h.construct(C.x,g.G),d.Ci(S),S=m.h.construct(g.gk(),g.G),d.Ci(S),g=m.h.construct(a.x,g.G)),d.Ci(g),d.xG(0,u,0),d.kO(v),d},h.uQ=function(a,u,d,g,v){var b=new m.Da(a.description);b.add(a,!1),b.DB(0,b.I()-1);var S=new m.l;b.xc(S);var C=(d=h.dv(u,d)).R(),O=Math.ceil((d.v-S.v)/C);for(O*=C;d.v>S.v+O;)O+=C;for(;d.vS.C)return v&&(v=b.Ke(),u=(b=m.Yl.local().V(b,u,!0,g)).Ke(),(u=m.lc.sign(v)!=m.lc.sign(u))&&b.oJ()),b;for((a=new m.Da(a.description)).add(b,!1),v=v||S.R()>C-u.Xd(0);S.v=d){C=!0;break}if(2&v&&R.y<=-d){C=!0;break}}if(!C)return!1;b=!1,a&&(b=u.Nn(0)),S=(a=new m.gd).Ib(u),C=a.Ob(S);var $=-1,N=!0,B=new m.h;B.Rc(),O=new m.Sa;for(var G=-1,K=a.Xa(C);K!=-1;K=a.U(K)){R=a.Na(K);var ee=1&v&&90<=R.y?1:0;if(ee|=2&v&&R.y<=-d?2:0,0<$&&$!=ee){if(B.x!=R.x){B.x=R.x,a.Vi(a.Ma(K),O);var q=a.wj(C,K,O);a.mf(q,B)}if(b)for(G=G!=-1?a.U(G):a.Xa(C),q=a.Ma(K);G!=q;)G=a.pd(G,!1);G=-1}0C){if(new m.l().K(B.v-S,-C,B.C+S,C),(v=m.ri.Nu(v,u,a,NaN,0,g)).B())return v;v.A(B)}if(K&&(u.HB.H))return v.Ia();if(B.R()>R&&(v=h.Hp(v,$-O,R,a,!0,0,!0,g)).A(B),(C=h.eO(B.v,B.C,u.v,u.C,R))!=0&&B.move(C,0),B.C>u.C||B.vu.C)for(;B.v>=u.C;)B.move(-R,0),C-=R;for(;B.vC;C++){if(ee?S=m.aa.Hc(b)?m.ri.clip(v,u,d,N,g):m.ri.clip(v,u,d,0,g):(S=m.Xj.local().V(v,G,a,g))==G&&(S=m.aa.jg(S)),u.v<=B.v&&u.C>=B.C||u.v>=B.v&&u.C<=B.C)return S;K[C]=S,C==0&&(B.move(-R,0),(S=new m.Dd).gg(-R,0),v.Oc(S))}if(b==550)K[0].Fd(K[1],0,-1);else if(m.aa.Hc(b))K[0].add(K[1],!1);else{if(b!=33)throw m.i.fa("intersect_with_GCS_horizon: unexpected geometry type");K[0].B()&&(K[0]=K[1])}return K[0]}if(u.HB.H)return v;for(b=0;!v.B()&&B.C>u.v;)b!=0&&((S=new m.Dd).gg(b,0),v.Oc(S)),m.dj.local().V(4,v,G,a,g)||G==(v=m.kp.local().V(v,G,a,g))&&(v=m.aa.jg(v)),b!=0&&((N=new m.Dd).gg(-b,0),v.Oc(N)),b-=R,B.move(-R,0);return v},h.yG=function(a,u,d,g){if(u!=0&&g!=D.DontClip)if(g==D.PannableFold){g=d.HR();for(var v=u,b=0;bg.H||a[b].yS||a[b].y<-S)&&(a[b].Rc(),v--);if(v!=0){(v=new m.l).Zw(a,u),S=d.Vr();var O=d.hv();b=S.getType()==197;var R=new m.l;if(S.A(R),!O||!(R.Hv.H))if(O)if(h.av(a,u,R.gk()-C,g),v=u,b)for(b=0;b=R||S&&$==R)&&($+=Math.ceil((u-$)/d)*d,$=m.O.Rk($,u,R),g.cC($)),g}if(a.B()||($=new m.l,a.A($),$.B()))return a;var N=new m.Nc;$.cn(N);var B=new m.Nc;if(B.K(u,R),B.contains(N))return a;if((R=new m.l).K($),O===550){for(C=(g=v?a:a.Of()).ub(0),O=2*g.I(),R=!1,u=0;u=B.va||S&&$==B.va)&&(R=!0,$+=Math.ceil((B.oa-$)/d)*d,$=B.It($),C.write(u,$));return R&&g.Pc(1993),g}if(O==197)return d=v?a:a.Of(),$.Ea(R),d.Xo($),d;var G=.1*Math.max($.ca(),$.R());for(R.W(0,G),S=a,B=g.Xd(0),a=m.Gh.local(),v=new m.Dd;;){var K=Math.floor((N.oa-u)/d),ee=Math.ceil((N.va-u)/d);if(!(3R.v;)(G=m.ri.clip(S,R,B,0,C)).A(N),(O==1607?!G.B()&&(N.R()>B||N.ca()>B):!G.B()&&(O!=1736||N.R()>B))&&(G.Oc(v),G.A(N),u.A(b),b.W(B,B),b.isIntersecting(N)&&O==1736?u=a.V(u,G,g,null):u.add(G,!1)),R.move(d,0),v.shift(-d,0);return u},h.av=function(a,u,d,g){for(var v=d+g,b=0;bv||S==v)||(S+=Math.ceil((d-S)/g)*g,S=m.O.Rk(S,d,v),a[b].x=S)}},h.Fn=function(a,u,d,g,v,b){if(!u.Wc())throw m.i.fa("fold_into_360_degree_range");if(a.B())return a;if(u.Sb()==2){d=u.pv();var S=u.ov()-d}else{var C=u.bf();S=360*C,d-=180*C}return h.Hp(a,d,S,u,g,v,!0,b)},h.qF=function(a,u,d,g){if(d.Sb()==2)g=d.pv(),d=d.ov()-g;else{var v=d.bf();d=360*v,g-=180*v}h.av(a,u,g,d)},h.lj=function(a,u){var d=u.Oe();if(a.getType()==33){var g=a.ih();return d.G<=g&&g<=d.H?a:a.Ia()}g=new m.l,a.A(g);var v=new m.l;return v.K(d),v.v=g.v,v.C=g.C,v.W(.01*v.ca(),0),d=m.ta.uy(u,g),v.contains(g)?a:m.ri.clip(a,v,d,0,null)},h.ir=function(a,u,d){return a>u.C&&a-u.Cd.H?a[v].Rc():a[v].x=h.ir(a[v].x,d,g)},h.Jt=function(a,u,d,g){if(!a.B()){var v=a.getType();if(!g||v!=1736)if(m.aa.xj(v)){g=a.ub(0),v=0;for(var b=a.I();vg||gg)||!b&&(S!=0||g<-Me.y&&Te.y>g||g<-Te.y&&Me.y>g))do if(!(Math.abs(Me.x-Te.x)>=.5*N.R())){if(d.Sb()==2?(G[0][0]=h.Zm(Me.x,N),G[0][1]=Me.y,G[1][0]=h.Zm(Te.x,N),G[1][1]=Te.y,m.ej.projToGeogCenter(B,2,G,0),Fe.x=G[0][0]*O,Fe.y=G[0][1]*O,Xe.y=G[1][1]*O):(Fe.x=Me.x*O,Fe.y=Me.y*O,Xe.y=Te.y*O),Xe.x=2*(Te.x-Me.x)*Math.PI/N.R()+Fe.x,b){if(oe.x=C,oe.y=h.Nz(R,$,Fe,Xe,C,v),isNaN(oe.y))break;me[0]=oe;var yi=1}else if(v==p.GreatElliptic){var di=[0,0];if((yi=m.Ox.Oz($,Fe,Xe,C,di))==0)break;oe.x=di[0],oe.y=C,me[0]=oe,yi==2&&(ge.x=di[1],ge.y=C,me[1]=ge)}else{if(oe.x=h.Lz(R,$,Fe,Xe,v),isNaN(oe.x))break;oe.y=0,me[0]=oe,yi=1}var Ct=-1;for(di=0;diee[0]||(Ct=a.Ma(lt),a.Ul(Ct,ee,1),a.Cb(a.U(Ct),q.x,q.y),Ct=ee[0])}}while(!1);Me.L(Te)}}},h.Zm=function(a,u){var d=u.va-u.oa;return u.It(a-Math.floor((a-u.oa)/d)*d)},h.os=function(a,u,d,g){var v=new m.Nc;for(v.K(u,d),d=g.R(),a=Math.floor((a-u)/d)*d+a,v=v.sf();Math.abs(a-v)>Math.abs(a+d-v);)a+=d;return a},h.Sn=function(a,u,d){return a=m.qr.Cp(a),u=m.qr.mx(a,m.qr.Cp(u)),(d=m.qr.mx(a,m.qr.Cp(d)))==0||0u&&0>d&&d>=u},h.Nz=function(a,u,d,g,v,b){if(b==p.GreatElliptic)return m.Ox.SS(u,d,g,v);if(Math.abs(d.x-g.x)>=Math.PI||!h.Sn(d.x,g.x,v))return NaN;if(d.x>g.x)var S=g;else S=d,d=g;g=new m.ga;var C=new m.ga,O=new m.ga;m.kb.wd(a,u,S.x,S.y,d.x,d.y,C,g,null,b);var R=C.u,$=0,N=1,B=new m.h;for(B.L(S);R*(N-$)>1e-12*a;){var G=.5*($+N);if(m.kb.oj(a,u,S.x,S.y,R*G,g.u,C,O,b),B.x=C.u,B.y=O.u,B.x==v)break;if(h.Sn(S.x,B.x,v))N=G;else{if(!h.Sn(d.x,B.x,v))return NaN;$=G}}return B.y},h.Lz=function(a,u,d,g,v){if(v==p.GreatElliptic)return a=[0,0],m.Ox.Oz(u,d,g,0,a),a[0];if(d.y>g.y)var b=g;else b=d,d=g;if((g=new m.Nc).K(b.y,d.y),!g.contains(0)||Math.abs(b.x-d.x)>=Math.PI)return NaN;if(b.x==d.x)return b.x;var S=new m.ga,C=new m.ga,O=new m.ga;m.kb.wd(a,u,b.x,b.y,d.x,d.y,C,S,null,v);var R=C.u,$=0,N=1,B=new m.h;for(B.L(b);R*(N-$)>1e-12*a;){var G=.5*($+N);if(m.kb.oj(a,u,b.x,b.y,R*G,S.u,C,O,v),B.x=C.u,B.y=O.u,g.K(b.y,B.y),B.y==0)break;if(g.contains(0))N=G;else{if(g.K(d.y,B.y),!g.contains(0))return NaN;$=G}}return B.x},h.WI=function(a,u,d,g){if(!a.ef.Wc())return!1;var v=new m.de(u.description);if(v.Fd(u,0,-1),g=m.Hx.local().V(v,a,g),v=u.I(),d.Oa(),v!=g.I())return!1;var b=new m.l;u.A(b);var S=new m.l;if(g.A(S),b=b.R(),S=S.R(),b!=0&&S!=0){if(S/=b,a=a.Yf.gh().R()/a.ef.gh().R(),1e-10=180*u&&(a-=360*u),a},h.UI=function(a,u,d,g){if(d==D.Clip){var v=u.ml();v.getType()==197?(d=new m.l,v.A(d),v=m.ta.uy(u,d),a=m.ri.clip(a,d,v,5e4*u.pm(),g)):m.dj.local().V(1,v,a,u,g)||(a=m.Xj.local().V(a,v,u,g))==v&&(a=m.Vk.jg(a))}else u.Wc()&&(g=new m.l,a.xc(g),u.Oe().contains(g)||(h.Jt(a,u.Oe(),u.Xd(0),!0),d==D.PannableFold&&(a=h.lj(a,u)),a=h.Fn(a,u,0,!0,1e5*u.pm(),null)));return a},h.XD=function(a,u,d){var g=u.Wr();if(g==null)return a;var v=(u=u.sc()).Oe().R(),b=new m.l;a.xc(b);var S=new m.Nc;b.cn(S),b=g.Ga(),g=null;for(var C=new m.Dd;b.$a();)for(;b.Ha();){var O=b.ha(),R=O.Tg(0,0),$=new m.Nc;for($.K(R.oa,R.va),R=0;$.va>S.oa;)$.move(-v),--R;for(;$.oa<=S.va;){if($.isIntersecting(S)){g==null&&(g=new m.Ta);var N=m.yb.cP(O.ac(),O.wc());R!=0&&(C.gg(R*v,0),N.Oc(C)),g.oc(N,!0)}$.move(v),++R}}return g!=null?(u=m.ta.gO(u,g),u=m.ta.Er(u),m.$t.lP(a,g,u,d)):a},h.eO=function(a,u,d,g,v){return a>=d&&u<=g?0:h.tE(.5*(u+a),d,g,v)},h.tE=function(a,u,d,g){return m.lc.round((.5*(d+u)-a)/g)*g},h.VQ=function(a,u,d,g,v,b,S,C){var O=h.dv(g,v),R=O.R(),$=R/360,N=h.pE*$,B=a.ub(0),G=u.Wc(),K=G?R/u.Oe().R():0;u=a.Ia();for(var ee=0,q=d.da();eeN){if(oe){var pr=Me+cs-1,Ri=Me;(!Te||cs+11*$&&(G=!1)}oe||(nr=Gi+(Xe-=m.lc.Cn(R,nr-We)),++Mt,rn=Xe!=0,on.x=nr)}else yi||m.ta.AG(di,Ct,on,lt)&&(yi=!0);rn&&Fe.write(2*cs,nr),We=nr,di.L(Ct),Ct.L(on)}Mt!=0&&ge.Pc(1993),oe=ge.Na(0),me=ge.Na(me-1),m.h.tb(oe,me),ge=h.wQ(ge,g,isNaN(v)?0:v,b),u.add(ge,!1)}return a=g.Xd(0),d=O.R()/180,h.Jt(u,O,.1*a,!1),m.ri.clip(u,O,a,d,b)},h.wQ=function(a,u,d,g){return h.Fn(a,u,d,!0,0,g)},h.OS=function(a,u,d,g){var v=a.getType();if(v==1736)for(u=u!=null?u.Xd(0):0,v=0;vd)for(var v=new m.Sa,b=0;bd)for(var v=new m.Sa,b=0;bthis.Io},p.prototype.fz=function(){if(this.B())throw m.i.fa("invalid call");return new m.Sa(this.Bs.x,this.Bs.y)},p.prototype.Ua=function(){if(this.B())throw m.i.fa("invalid call");return this.Io},p.prototype.hz=function(){if(this.B())throw m.i.fa("invalid call");return this.Ka},p.prototype.Sz=function(){return(1&this.nw)!=0},p.prototype.ey=function(h,a,u,d){this.Bs.x=h,this.Bs.y=a,this.Io=u,this.Ka=d},p}();m.$l=E}(ie||(ie={})),function(m){var D=function(){function p(){}return p.prototype.Uo=function(h,a){if(this.th.resize(0),this.Ii.length=0,this.tk=-1,h.xc(this.Ek),this.Ek.W(a,a),this.Ek.isIntersecting(this.Fb.Ca)){var u=h.getType();(this.vs=m.aa.yd(u))?(this.TH=h.ac(),this.SH=h.wc(),this.qa=a):this.qa=NaN,this.th.add(this.Fb.kf),this.Ii.push(this.Fb.Ca),this.Qs=this.Fb.Ur(this.Fb.kf)}else this.Qs=-1},p.prototype.Xi=function(h,a){this.th.resize(0),this.Ii.length=0,this.tk=-1,this.Ek.K(h),this.Ek.W(a,a),this.qa=NaN,this.Ek.isIntersecting(this.Fb.Ca)?(this.th.add(this.Fb.kf),this.Ii.push(this.Fb.Ca),this.Qs=this.Fb.Ur(this.Fb.kf),this.vs=!1):this.Qs=-1},p.prototype.next=function(){if(this.th.size==0)return-1;this.tk=this.Qs;var h=null,a=null,u=null,d=null;this.vs&&(h=new m.h,a=new m.h,u=new m.l);for(var g=!1;!g;){for(;this.tk!=-1;){var v=this.Fb.bz(this.Fb.fv(this.tk));if(v.isIntersecting(this.Ek)){if(!this.vs){g=!0;break}if(h.L(this.TH),a.L(this.SH),u.K(v),u.W(this.qa,this.qa),0b;b++){var S=this.Fb.Lp(v,b);if(S!=-1&&0>d);g==0?(a.v=.5*(a.v+a.C),a.G=.5*(a.G+a.H)):g==1?(a.C=.5*(a.v+a.C),a.G=.5*(a.G+a.H)):(g==2?a.C=.5*(a.v+a.C):a.v=.5*(a.v+a.C),a.H=.5*(a.G+a.H))}return a},p.prototype.WR=function(h){return this.Az(h)},p.prototype.vR=function(h,a){return D.bP(this,h,a)},p.prototype.MF=function(h,a){return D.aP(this,h,a)},p.prototype.getIterator=function(){return D.$O(this)},p.prototype.Nk=function(h,a){if(0>a||32<2*a)throw m.i.N("invalid height");this.BT=a,this.Ca.K(h),this.kf=this.jf.Ce(),this.jx(this.kf,0),this.ax(this.kf,0),this.NJ(this.kf,0),this.KJ(this.kf,0)},p.prototype.zv=function(h,a,u,d,g,v,b){if(!d.contains(a))return u==0?-1:this.zv(h,a,0,this.Ca,this.kf,v,b);if(!v)for(var S=g;S!=-1;S=this.IR(S))this.jx(S,this.Az(S)+1);(S=new m.l).K(d),d=g;var C=[];for(C[0]=new m.l,C[1]=new m.l,C[2]=new m.l,C[3]=new m.l;uR;R++)if(C[R].contains(a)){O=!0;var $=this.Lp(d,R);$==-1&&($=this.rP(d,R)),this.jx($,this.Az($)+1),d=$,S.K(C[R]);break}if(!O)break}return this.sS(h,a,u,S,d,v,g,b)},p.prototype.sS=function(h,a,u,d,g,v,b,S){var C=this.NF(g);if(v){if(g==b)return S;this.SP(S),v=S}else v=this.tP(),this.NB(v,h),this.KW(this.fv(v),a);return this.mX(v,g),C!=-1?(this.hx(v,C),this.bx(C,v)):this.GJ(g,v),this.SB(g,v),this.ax(g,this.lv(g)+1),this.hO(g)&&this.MQ(u,d,g),v},p.prototype.SP=function(h){var a=this.WF(h),u=this.NF(a),d=this.OR(h),g=this.nv(h);this.Ur(a)==h?(g!=-1?this.hx(g,-1):this.SB(a,-1),this.GJ(a,g)):u==h?(this.bx(d,-1),this.SB(a,d)):(this.hx(g,d),this.bx(d,g)),this.hx(h,-1),this.bx(h,-1),this.ax(a,this.lv(a)-1)},p.EJ=function(h,a){var u=.5*(h.v+h.C),d=.5*(h.G+h.H);a[0].K(u,d,h.C,h.H),a[1].K(h.v,d,u,h.H),a[2].K(h.v,h.G,u,d),a[3].K(u,h.G,h.C,d)},p.prototype.hO=function(h){return this.lv(h)==8&&!this.gG(h)},p.prototype.MQ=function(h,a,u){var d=this.Ur(u);do{var g=this.fv(d),v=this.Zh.T(d,0);g=this.bz(g),this.zv(v,g,h,a,u,!0,d),d=v=this.nv(d)}while(d!=-1)},p.prototype.iO=function(h){return 8<=this.lv(h)||this.gG(h)},p.prototype.gG=function(h){return this.Lp(h,0)!=-1||this.Lp(h,1)!=-1||this.Lp(h,2)!=-1||this.Lp(h,3)!=-1},p.prototype.rP=function(h,a){var u=this.jf.Ce();return this.OW(h,a,u),this.jx(u,0),this.ax(u,0),this.Pk(u,h),this.KJ(u,this.jv(h)+1),this.NJ(u,a<<2*this.jv(h)|this.QF(h)),u},p.prototype.tP=function(){var h=this.Zh.Ce();if(0>4)]|=this.iH<<2*(15&g)},h}();m.HY=E;var p=function(){function h(a,u,d){this.Vh=null,this.SA=this.Ik=this.cI=this.aI=this.Es=this.qH=this.Gf=this.Um=0,this.Ri=this.Jk=this.vl=null,this.Fz(a,u,d)}return h.create=function(a,u,d){if(!h.zE(a))throw m.i.N();return h.wP(a,u,d)},h.pW=function(a){switch(a){case 0:a=1024;break;case 1:a=16384;break;case 2:a=262144;break;default:throw m.i.fa("Internal Error")}return a},h.zE=function(a){return!(a.B()||a.getType()!=1607&&a.getType()!=1736)},h.prototype.rQ=function(a,u){u=u.Ga();for(var d=new m.h,g=new m.h;u.$a();)for(;u.Ha();){var v=u.ha();if(v.getType()!=322)throw m.i.fa("Internal Error");a.Eh(v.ac(),d),a.Eh(v.wc(),g),this.Ri.jy(d.x,d.y,g.x,g.y)}this.Ri.iJ(m.Px.Cx)},h.prototype.sQ=function(){throw m.i.fa("Internal Error")},h.prototype.Ry=function(a,u){for(var d=1;4>d;d++)a.jy(u[d-1].x,u[d-1].y,u[d].x,u[d].y);a.jy(u[3].x,u[3].y,u[0].x,u[0].y),this.Ri.iJ(m.Px.Cx)},h.prototype.rK=function(a,u,d){for(var g=[null,null,null,null],v=0;v(G=v.length());G==0?v.ma(1,0):(K||$.L(O),v.scale(d/G),b.ma(-v.y,v.x),S.ma(v.y,-v.x),C.sub(v),O.add(v),g[0].add(C,b),g[1].add(C,S),g[2].add(O,S),g[3].add(O,b),K?N=!0:this.Ry(a,g))}else N&&(this.Ry(a,g),N=!1),B=!0}N&&this.Ry(a,g)}},h.prototype.sC=function(a){return m.O.truncate(a*this.qH+this.aI)},h.prototype.tC=function(a){return m.O.truncate(a*this.Es+this.cI)},h.wP=function(a,u,d){return new h(a,u,d)},h.prototype.Fz=function(a,u,d){this.Gf=Math.max(m.O.truncate(2*Math.sqrt(d)+.5),64),this.Um=m.O.truncate((2*this.Gf+31)/32),this.vl=new m.l,this.Ik=u,d=0;for(var g=this.Gf,v=this.Um;8<=g;)d+=g*v,g=m.O.truncate(g/2),v=m.O.truncate((2*g+31)/32);this.Vh=m.O.lg(d,0),this.Ri=new m.Px,d=new E(this.Vh,this.Um,this),this.Ri.AX(this.Gf,this.Gf,d),a.A(this.vl),this.vl.W(u,u),g=new m.l;var b=u*(v=m.l.construct(1,1,this.Gf-2,this.Gf-2)).R();switch(u*=v.ca(),g.K(this.vl.sf(),Math.max(b,this.vl.R()),Math.max(u,this.vl.ca())),this.SA=this.Ik,this.Jk=new m.Dd,this.Jk.pS(g,v),new m.Dd,a.getType()){case 550:d.setColor(this.Ri,2),this.sQ();break;case 1607:d.setColor(this.Ri,2),this.rK(this.Ri,a,this.SA);break;case 1736:d.setColor(this.Ri,1),this.rQ(this.Jk,a),d.setColor(this.Ri,2),this.rK(this.Ri,a,this.SA)}this.qH=this.Jk.bb,this.Es=this.Jk.ab,this.aI=this.Jk.Gb,this.cI=this.Jk.Lb,this.XN()},h.prototype.XN=function(){this.Ri.flush();for(var a=0,u=this.Gf*this.Um,d=this.Gf,g=m.O.truncate(this.Gf/2),v=this.Um,b=m.O.truncate((2*g+31)/32);8>4;R=2*(15&R);var B=$>>4;$=2*(15&$);var G=this.Vh[a+v*S+N]>>R&3;G|=this.Vh[a+v*S+B]>>$&3,G|=this.Vh[a+v*C+N]>>R&3,G|=this.Vh[a+v*C+B]>>$&3,this.Vh[u+b*d+(O>>4)]|=G<<2*(15&O)}d=g,v=b,a=u,g=m.O.truncate(d/2),b=m.O.truncate((2*g+31)/32),u=a+v*d}},h.prototype.So=function(a,u){return this.vl.contains(a,u)?(a=this.sC(a),u=this.tC(u),0>a||a>=this.Gf||0>u||u>=this.Gf||(u=this.Vh[this.Um*u+(a>>4)]>>2*(15&a)&3)==0?0:u==1?1:2):0},h.prototype.Ro=function(a){if(!a.Ea(this.vl))return 0;var u=this.sC(a.v),d=this.sC(a.C),g=this.tC(a.G);if(a=this.tC(a.H),0>u&&(u=0),0>g&&(g=0),d>=this.Gf&&(d=this.Gf-1),a>=this.Gf&&(a=this.Gf-1),u>d||g>a)return 0;for(var v=Math.max(d-u,1)*Math.max(a-g,1),b=0,S=this.Um,C=this.Gf,O=0;;){if(32>v||16>C){for(v=g;v<=a;v++)for(var R=u;R<=d;R++)if(1<(O=this.Vh[b+S*v+(R>>4)]>>2*(15&R)&3))return 2;if(O==0)return 0;if(O==1)return 1}b+=S*C,C=m.O.truncate(C/2),S=m.O.truncate((2*C+31)/32),u=m.O.truncate(u/2),g=m.O.truncate(g/2),d=m.O.truncate(d/2),a=m.O.truncate(a/2),v=Math.max(d-u,1)*Math.max(a-g,1)}},h.prototype.RR=function(){return this.Gf*this.Um},h}();m.Nx=p}(ie||(ie={})),function(m){var D;(D=m.VL||(m.VL={}))[D.contains=1]="contains",D[D.within=2]="within",D[D.equals=3]="equals",D[D.disjoint=4]="disjoint",D[D.touches=8]="touches",D[D.crosses=16]="crosses",D[D.overlaps=32]="overlaps",D[D.unknown=0]="unknown",D[D.intersects=1073741824]="intersects";var E=function(){function h(){}return h.construct=function(a,u,d,g,v,b,S,C){var O=new h;return O.pw=a,O.Mm=u,O.Kj=d,O.Si=g,O.BH=v,O.SY=b,O.TY=S,O.UY=C,O},h}();m.Vt=function(){function h(){}return h.CD=function(a,u,d){if(h.wy(a)){var g=m.ta.kj(u,a,!1);u=!1,m.Uk.CE(a)&&(u=u||a.lu(g,d)),(g=a.getType())!=1736&&g!=1607||!m.Uk.AE(a)||d==0||(u=u||a.fj(d)),g!=1736&&g!=1607||!m.Uk.BE(a)||d==0||u||a.hM()}},h.wy=function(a){return m.Uk.CE(a)||m.Uk.AE(a)||m.Uk.BE(a)},h}();var p=function(){function h(){this.rh=[]}return h.zB=function(a,u,d,g,v){var b=a.getType(),S=u.getType();if(b==197){if(S==197)return h.tW(a,u,d,g);if(S==33)return g==2?g=1:g==1&&(g=2),h.hJ(u,a,d,g)}else if(b==33){if(S==197)return h.hJ(a,u,d,g);if(S==33)return h.vW(a,u,d,g)}if(a.B()||u.B())return g==4;var C=new m.l;a.A(C);var O=new m.l;u.A(O);var R=new m.l;if(R.K(C),R.Zb(O),d=m.ta.Wd(d,R,!1),h.dk(C,O,d))return g==4;switch(C=!1,m.Vk.yd(b)&&((b=new m.Ta(a.description)).oc(a,!0),a=b,b=1607),m.Vk.yd(S)&&((S=new m.Ta(u.description)).oc(u,!0),u=S,S=1607),b!=197&&S!=197?(a.Db()4*Math.max(a.I(),u.I())*d)&&h.Wz(a,u,d,!0)))},h.kV=function(a,u,d){var g=h.qc(a,u,!0);return g==4||g!=1&&g!=2&&g!=1073741824&&h.EI(a,u,d)},h.vV=function(a,u,d){var g=h.qc(a,u,!1);return g!=4&&g!=1&&g!=2&&h.II(a,u,d,null)},h.qV=function(a,u,d,g){var v=h.qc(a,u,!1);return v!=4&&v!=1&&v!=2&&h.FI(a,u,d,g)},h.Sw=function(a,u,d,g){var v=new m.l,b=new m.l;return a.A(v),u.A(b),!!h.zc(v,b,d)&&(v=h.qc(a,u,!1))!=4&&v!=2&&(v==1||h.BI(a,u,d,g))},h.lV=function(a,u,d){var g=h.qc(a,u,!0);return g==4||g!=1&&g!=1073741824&&h.EI(a,u,d)},h.wV=function(a,u,d,g){var v=h.qc(a,u,!1);return v!=4&&v!=1&&h.JI(a,u,d,g)},h.gV=function(a,u,d){var g=h.qc(a,u,!1);return g!=4&&g!=1&&h.DI(a,u,d,null)},h.fB=function(a,u,d,g){var v=new m.l,b=new m.l;return a.A(v),u.A(b),!!h.zc(v,b,d)&&(v=h.qc(a,u,!1))!=4&&(v==1||h.CI(a,u,d,g))},h.jV=function(a,u,d){return m.hd.KG(a,u,d)==0},h.uV=function(a,u,d){return u=u.D(),h.HI(a,u,d)},h.dV=function(a,u,d){return u=u.D(),h.AI(a,u,d)},h.iV=function(a,u,d){var g=h.qc(a,u,!1);if(g==4)return!0;if(g==1)return!1;g=new m.l,a.A(g),g.W(d,d);for(var v=new m.h,b=0;bd&&b.R()>d||b.ca()<=d&&b.R()<=d)&&(v=new m.Ta,b=new m.Sa,u.Hf(0,b),v.nf(b),u.Hf(2,b),v.lineTo(b),h.DI(a,v,d,g))},h.IV=function(a,u,d){var g=new m.l,v=new m.l;return a.A(g),u.A(v),!(!h.ek(g,v,d)||h.qc(a,u,!1)==4)&&(!!h.dI(a,u,d)||h.Wz(a,u,d,!1))},h.GV=function(a,u,d){return this.qc(a,u,!1)==4||!!new m.Zl(a,u,d,!0).next()&&!this.UG(a,u,d)},h.NI=function(a,u,d){if(h.qc(a,u,!1)==4)return!1;var g=new m.be(0);if(h.Xz(a,u,d,g)!=0)return!1;for(var v=new m.de,b=0;bd&&v.R()>d)&&h.ek(g,v,d)},h.DV=function(a,u,d){var g=new m.l,v=new m.l;return a.A(g),u.A(v),!h.zc(v,g,d)&&!h.TG(a,v,d)},h.OV=function(a,u,d){var g=new m.l,v=new m.l;if(a.A(g),u.A(v),v.ca()<=d&&v.R()<=d)return v=u.Ip(),h.Zz(a,v,d);if(v.ca()<=d||v.R()<=d)return v=new m.Ta,g=new m.Sa,u.Hf(0,g),v.nf(g),u.Hf(2,g),v.lineTo(g),h.NI(a,v,d);a=a.Ga(),u=new m.l,g=new m.l,u.K(v),g.K(v),u.W(-d,-d),g.W(d,d),v=!1;for(var b=new m.l,S=new m.l;a.$a();)for(;a.Ha();){if(a.ha().A(b),S.K(u),S.Ea(b),!S.B()&&(S.ca()>d||S.R()>d))return!1;S.K(g),S.Ea(b),S.B()||(v=!0)}return v},h.LV=function(a,u,d){var g=new m.l,v=new m.l;return a.A(g),u.A(v),!(h.zc(g,v,d)||h.zc(v,g,d)||h.zc(v,g,d)||v.ca()>d&&v.R()>d||v.ca()<=d&&v.R()<=d)&&(g=new m.Ta,v=new m.Sa,u.Hf(0,v),g.nf(v),u.Hf(2,v),g.lineTo(v),h.WG(a,g,d))},h.RV=function(a,u,d){var g=new m.l,v=new m.l;if(a.A(g),u.A(v),!h.zc(v,g,d)||v.ca()<=d&&v.R()<=d)return!1;if(v.ca()<=d||v.R()<=d)return h.zc(v,g,d);a=a.Ga(),(u=new m.l).K(v),u.W(-d,-d),v=!1,g=new m.l;for(var b=new m.l;a.$a();)for(;a.Ha();)a.ha().A(g),u.hm(g)?v=!0:(b.K(u),b.Ea(g),!b.B()&&(b.ca()>d||b.R()>d)&&(v=!0));return v},h.yV=function(a,u,d){var g=new m.l,v=new m.l;return u.A(v),a.A(g),!(!h.zc(g,v,d)||v.ca()>d&&v.R()>d)&&(v.ca()<=d&&v.R()<=d?(u=u.Ip(),h.SG(a,u,d)):(g=new m.Ta,v=new m.Sa,u.Hf(0,v),g.nf(v),u.Hf(2,v),g.lineTo(v),h.ym(g,a,d,!1)))},h.BV=function(a,u,d){var g=new m.l,v=new m.l;if(a.A(g),u.A(v),h.zc(v,g,d)||v.ca()<=d&&v.R()<=d)return!1;if(v.ca()<=d||v.R()<=d)return g=new m.Ta,v=new m.Sa,u.Hf(0,v),g.nf(v),u.Hf(2,v),g.lineTo(v),h.LI(a,g,d);a=a.Ga(),u=new m.l,(g=new m.l).K(v),u.K(v),g.W(-d,-d),u.W(d,d);for(var b=v=!1,S=new m.l,C=new m.l;a.$a();)for(;a.Ha();)if(a.ha().A(S),b||u.contains(S)||(b=!0),v||(C.K(g),C.Ea(S),!C.B()&&(C.ca()>d||C.R()>d)&&(v=!0)),v&&b)return!0;return!1},h.iU=function(a,u,d){var g=new m.l,v=new m.l;return a.A(g),u.A(v),!!h.ek(g,v,d)&&(!!h.jU(a,u,d)||h.YA(a,u,d,!1,!0,!1))},h.gU=function(a,u,d){return!h.gI(a,u,d)},h.oU=function(a,u,d){return h.YA(a,u,d,!1,!1,!0)},h.eI=function(a,u,d){var g=new m.l,v=new m.l;return a.A(g),u.A(v),!!h.zc(g,v,d)&&h.YA(u,a,d,!0,!1,!1)},h.Mw=function(a,u,d){d*=d;for(var g=new m.h,v=new m.h,b=0;bd||v.R()>d)&&h.ek(g,v,d)},h.fU=function(a,u,d){var g=new m.l,v=new m.l;if(a.A(g),u.A(v),h.zc(v,g,d))return!1;for((u=new m.l).K(v),u.W(d,d),d=new m.h,v=0;vd?b.W(0,-d):b.W(-d,0);for(var C=0;Cd){if(u.y>b.G&&u.yb.v&&u.xd?g.W(0,-d):g.W(-d,0),b.W(d,d);for(var S=new m.h,C=0;Cd?S.y>g.G&&S.yg.v&&S.xd||v.R()>d)&&(u=u.Ip(),!h.kt(a,u,d))},h.eU=function(a,u,d){var g=new m.l,v=new m.l;if(a.A(g),u.A(v),h.zc(v,g,d)||v.ca()<=d&&v.R()<=d)return!1;if(v.ca()<=d||v.R()<=d){u=new m.l,g=new m.l,u.K(v),v.ca()>d?u.W(0,-d):u.W(-d,0),g.K(v),g.W(d,d);for(var b=new m.h,S=!1,C=!1,O=0;Od?b.y>u.G&&b.yu.v&&b.xd*d},h.uI=function(a,u,d){return h.wI(a,u,d)},h.vI=function(a,u,d){var g=new m.l;return g.K(a),h.ek(g,u,d)},h.Rw=function(a,u,d){var g=new m.l;return g.K(u),g.W(d,d),!g.contains(a)},h.dB=function(a,u,d){if(u.ca()<=d&&u.R()<=d)return!1;var g=new m.l,v=new m.l;if(g.K(u),g.W(d,d),!g.contains(a))return!1;if(u.ca()<=d||u.R()<=d){if(v.K(u),u.ca()>d?v.W(0,-d):v.W(-d,0),u.ca()>d){if(a.y>v.G&&a.yv.v&&a.xd?g.W(0,-d):g.W(-d,0);var v=!1;return u.ca()>d?a.y>g.G&&a.yg.v&&a.xd&&a.R()>d&&(u.ca()<=d||u.R()<=d)?g=u:(g=a,a=u),g.ca()<=d||g.R()<=d){if(a.ca()<=d||a.R()<=d){u=new m.yb;var v=new m.yb,b=[0,0],S=[0,0],C=new m.h;return g.dn(C),u.Dc(C),g.en(C),u.Qc(C),a.dn(C),v.Dc(C),a.en(C),v.Qc(C),u.Ea(v,null,b,S,d),u.Ea(v,null,null,null,d)==1&&(b[0]==0||b[1]==1||S[0]==0||S[1]==1)}return u=new m.l,v=new m.l,u.K(a),u.W(-d,-d),v.K(u),v.Ea(g),!(!v.B()&&(v.ca()>d||v.R()>d))}return a.W(d,d),(v=new m.l).K(g),v.Ea(a),!(v.B()||!v.B()&&v.ca()>d&&v.R()>d)},h.bQ=function(a,u,d){if(h.zc(a,u,d)||h.zc(u,a,d)||a.ca()<=d&&a.R()<=d||u.ca()<=d&&u.R()<=d)return!1;if(a.ca()<=d||a.R()<=d){if(u.ca()>d&&u.R()>d)return!1;var g=new m.yb,v=new m.yb,b=[0,0],S=[0,0],C=new m.h;return a.dn(C),g.Dc(C),a.en(C),g.Qc(C),u.dn(C),v.Dc(C),u.en(C),v.Qc(C),g.Ea(v,null,b,S,d),g.Ea(v,null,null,null,d)==2&&(0b[1])&&(0S[1])}return!(u.ca()<=d||u.R()<=d)&&((g=new m.l).K(a),g.Ea(u),!(g.B()||g.ca()<=d||g.R()<=d))},h.jF=function(a,u,d){if(!h.zc(a,u,d))return!1;if(a.ca()<=d&&a.R()<=d)return a=a.sf(),h.eB(a,u,d);if(u.ca()<=d&&u.R()<=d)return u=u.sf(),h.eB(u,a,d);if(a.ca()<=d||a.R()<=d)return h.zc(a,u,d);if(u.ca()<=d||u.R()<=d){var g=new m.l;return g.K(a),g.W(-d,-d),g.hm(u)?!0:((a=new m.l).K(g),a.Ea(u),!(a.B()||a.ca()<=d&&a.R()<=d))}return h.zc(a,u,d)},h.aQ=function(a,u,d){if(h.zc(a,u,d)||h.zc(u,a,d)||a.ca()<=d&&a.R()<=d||u.ca()<=d&&u.R()<=d||u.ca()>d&&u.R()>d&&a.ca()>d&&a.R()>d)return!1;if(a.ca()>d&&a.R()>d)var g=u;else g=a,a=u;if(a.ca()>d&&a.R()>d){u=new m.l;var v=new m.l;return v.K(a),v.W(-d,-d),u.K(v),u.Ea(g),!(u.B()||u.ca()<=d&&u.R()<=d)}u=new m.yb,v=new m.yb;var b=[0,0],S=[0,0],C=new m.h;return g.dn(C),u.Dc(C),g.en(C),u.Qc(C),a.dn(C),v.Dc(C),a.en(C),v.Qc(C),u.Ea(v,null,b,S,d),u.Ea(v,null,null,null,d)==1&&0b[1]&&0S[1]},h.EI=function(a,u,d){var g=new m.l,v=new m.l,b=new m.Zl(a,u,d,!0);if(!b.next())return!0;if(this.UG(a,u,d))return!1;var S=a,C=null;u.getType()==1736&&(C=u);var O=!1,R=!1;do{var $=b.nl(),N=b.hl();if(N=u.Na(u.Ba(N)),g.K(b.uz()),g.W(d,d),g.contains(N)&&(N=m.hd.Yd(S,N,0))!=0||u.getType()==1736&&($=a.Na(a.Ba($)),v.K(b.az()),v.W(d,d),v.contains($)&&(N=m.hd.Yd(C,$,0))!=0))return!1;O||(!m.Dg.Ml(a,u.da()-1)||a.Bb!=null&&a.Bb.Fb!=null?S=a:(S=new m.Da,a.copyTo(S),S.fj(1)),O=!0),u.getType()!=1736||R||(R=u,!m.Dg.Ml(R,a.da()-1)||u.Bb!=null&&u.Bb.Fb!=null?C=u:(C=new m.Da,R.copyTo(C),C.fj(1)),R=!0)}while(b.next());return!0},h.zc=function(a,u,d){var g=new m.l;return g.K(a),g.W(d,d),g.contains(u)},h.ls=function(a,u,d){var g=new m.l;return g.K(u),g.W(d,d),u=new m.h,a.dn(u),!g.contains(u)||(a.$I(u),!g.contains(u)||(a.cJ(u),!g.contains(u)||(a.en(u),!g.contains(u))))},h.dI=function(a,u,d){if(a.da()!=u.da()||a.I()!=u.I())return!1;var g=new m.h,v=new m.h,b=!0;d*=d;for(var S=0;Sd){b=!1;break}if(!b)break}return!!b},h.jU=function(a,u,d){if(a.I()!=u.I())return!1;var g=new m.h,v=new m.h,b=!0;d*=d;for(var S=0;Sd){b=!1;break}return!!b},h.YA=function(a,u,d,g,v,b){var S=!1;if(a.I()>u.I()){g&&(g=!1,S=!0);var C=u}else C=a,a=u;if(u=null,v||b||S){u=new m.pn(a.I());for(var O=0;Ou.I())var g=u;else g=a,a=u;u=new m.l;var v=new m.l,b=new m.l;g.A(u),a.A(v),u.W(d,d),v.W(d,d),b.K(u),b.Ea(v),v=new m.h;for(var S=new m.h,C=d*d,O=m.ta.oE(a,b),R=O.getIterator(),$=0;$d)return!1;if(q*(1-(ge=b.Si))<=d||ge==1)break}if(q*(1-ge)>d)return!1;R=0,$.resize(0),N.rh.length=0}}return S},h.WG=function(a,u,d){if(1>h.Xz(a,u,d,null))return!1;var g=new m.l,v=new m.l;a.A(g),u.A(v);var b=h.ls(g,v,d);return g=h.ls(v,g,d),!(!b||!g)||(b&&!g?!h.ym(u,a,d,!1):g&&!b?!h.ym(a,u,d,!1):!h.ym(a,u,d,!1)&&!h.ym(u,a,d,!1))},h.Xz=function(a,u,d,g){function v(Ct,rn){return B.QE(Ct,rn)}if(a.yz()>u.yz())var b=u,S=a;else b=a,S=u;a=b.Ga(),u=S.Ga();var C=[0,0],O=[0,0],R=-1,$=0,N=new m.ia(0),B=new h,G=new m.l,K=new m.l,ee=new m.l;b.A(G),S.A(K),G.W(d,d),K.W(d,d),ee.K(G),ee.Ea(K),b=null,g!=null&&(b=new m.h);var q=K=K=null,oe=S.Bb;for(oe!=null?(K=oe.Fb,q=oe.zo,K==null&&(K=m.ta.jj(S,ee))):K=m.ta.jj(S,ee),S=K.getIterator(),oe=null,q!=null&&(oe=q.getIterator());a.$a();)for(q=0;a.Ha();){var ge=a.ha();if(ge.A(G),G.isIntersecting(ee)){if(oe!=null&&(oe.Xi(G,d),oe.next()==-1))continue;var me=ge.Qb();S.Uo(ge,d);for(var Me=S.next();Me!=-1;Me=S.next()){var Te=K.ja(Me);u.Vb(Te);var Fe=u.ha(),Xe=Fe.Qb(),We=ge.Ea(Fe,null,C,O,d);if(0d)return 1;var yi=me*(Mt-Me);if(u.Ha()){if(Fe=u.ha(),(We=ge.Ea(Fe,null,C,null,d))==2){We=C[0];var di=C[1];if(yi+(We=me*(di-We))>d)return 1}u.Vb(Te),u.ha()}if(!u.vm()){if(u.li(),Fe=u.li(),(We=ge.Ea(Fe,null,C,null,d))==2&&(We=C[0],yi+(We=me*((di=C[1])-We))>d))return 1;u.Vb(Te),u.ha()}if(a.Ha()){if(Te=a.wb(),(We=(ge=a.ha()).Ea(Fe,null,C,null,d))==2&&(We=C[0],yi+(We=me*((di=C[1])-We))>d))return 1;a.Vb(Te),a.ha()}if(!a.vm()){if(Te=a.wb(),a.li(),(We=(ge=a.li()).Ea(Fe,null,C,null,d))==2&&(We=C[0],yi+(We=Xe*((di=C[1])-We))>d))return 1;a.Vb(Te),a.ha()}Fe=E.construct(a.wb(),a.gb,Me,Mt,u.wb(),u.gb,R,lt),B.rh.push(Fe),N.add(N.size)}R=0,g!=null&&(ge.hc(Me,b),g.add(b.x),g.add(b.y))}}if($d)q=me*(Fe.Si-Fe.Kj),ge=Fe.Si,Me=Fe.Mm;else{if(Fe.Mm!=Me?(q=me*(Fe.Si-Fe.Kj),Me=Fe.Mm):q+=me*(Fe.Si-Fe.Kj),q>d)return 1;if((ge=Fe.Si)==1)break}me*(1-ge)>d&&(q=0),$=0,N.resize(0),B.rh.length=0}}}return R},h.UG=function(a,u,d){var g=a.Ga(),v=u.Ga();for(a=new m.Zl(a,u,d,!1);a.next();){u=a.nl();var b=a.hl();if(g.Vb(u),v.Vb(b),u=g.ha(),0d)return!1;$=!0}else if(B!=0){if($=C[0],N=O[0],0<$&&1>$&&0N)return!1;$=!0}}return!!$&&(b=new m.l,S=new m.l,v=new m.l,a.A(b),u.A(S),b.W(1e3*d,1e3*d),S.W(1e3*d,1e3*d),v.K(b),v.Ea(S),!(10d&&(O=!0,R&&$))return!0}else if(q!=0&&(q=G[0],oe=K[0],0q&&0oe))return!0}if(v=new m.l,N=new m.l,v.K(b),v.W(1e3*d,1e3*d),N.K(S),N.W(1e3*d,1e3*d),C.K(v),C.Ea(N),b="",b=O?b+"**":b+"T*",R){if(10$&&0N)))return g[0]=!0,!1}if(!R){for(g[0]=!0,S=new m.l,a.A(S),S.W(d,d),O=a,R=!1,C=new m.l,g=0,v=u.da();gR&&0<$&&1>$)return!1;R=!0}}return!!R&&(b=new m.l,S=new m.l,v=new m.l,a.A(b),u.A(S),b.W(1e3*d,1e3*d),S.W(1e3*d,1e3*d),v.K(b),v.Ea(S),!(10R&&0<$&&1>$)return!0;R=!0}}return!!R&&(b=new m.l,S=new m.l,C=new m.l,O=new m.l,v=new m.l,a.A(b),u.A(S),h.ls(S,b,d)?(C.K(b),C.W(1e3*d,1e3*d),O.K(S),O.W(1e3*d,1e3*d),v.K(C),v.Ea(O),!(10b;b++){var S=g.charAt(b);if(S!="*"&&S!="T"&&S!="F"&&S!="0"&&S!="1"&&S!="2")throw m.i.fa("relation string")}if((b=this.MR(g,a.Db(),u.Db()))!=0)return m.ud.zB(a,u,d,b,v);b=new m.l,a.A(b),S=new m.l,u.A(S);var C=new m.l;if(C.K(b),C.Zb(S),d=m.ta.Wd(d,C,!1),a=this.WE(a,d),u=this.WE(u,d),a.B()||u.B())return this.uW(a,u,g);switch(b=a.getType(),S=u.getType(),C=!1,b){case 1736:switch(S){case 1736:C=this.rt(a,u,d,g,v);break;case 1607:C=this.$m(a,u,d,g,v);break;case 33:C=this.qt(a,u,d,g);break;case 550:C=this.pt(a,u,d,g,v)}break;case 1607:switch(S){case 1736:C=this.$m(u,a,d,this.Zp(g),v);break;case 1607:C=this.gB(a,u,d,g,v);break;case 33:C=this.tt(a,u,d,g,v);break;case 550:C=this.st(a,u,d,g,v)}break;case 33:switch(S){case 1736:C=this.qt(u,a,d,this.Zp(g));break;case 1607:C=this.tt(u,a,d,this.Zp(g),v);break;case 33:C=this.$U(a,u,d,g);break;case 550:C=this.lt(u,a,d,this.Zp(g))}break;case 550:switch(S){case 1736:C=this.pt(u,a,d,this.Zp(g),v);break;case 1607:C=this.st(u,a,d,this.Zp(g),v);break;case 550:C=this.ZA(a,u,d,g,v);break;case 33:C=this.lt(a,u,d,g)}break;default:C=!1}return C},h.rt=function(a,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.xJ();var S=new m.l,C=new m.l;return a.A(S),u.A(C),g=!1,m.ud.dk(S,C,d)&&(b.Cu(a,u),g=!0),g||((S=m.ud.qc(a,u,!1))==4?(b.Cu(a,u),g=!0):S==1?(b.ly(u),g=!0):S==2&&(b.ZD(a),g=!0)),g||(a=(g=new m.gd).Ib(a),u=g.Ib(u),b.Wo(g,d,v),b.Bp(a,u),b.j.Ug()),h.fg(b.J,b.Xc)},h.Sw=function(a,u,d,g){var v=new h;v.Yi(),v.bj("T*****F**"),v.xJ();var b=new m.l,S=new m.l;a.A(b),u.A(S);var C=!1;return m.ud.dk(b,S,d)&&(v.Cu(a,u),C=!0),C||((b=m.ud.qc(a,u,!1))==4?(v.Cu(a,u),C=!0):b==1?(v.ly(u),C=!0):b==2&&(v.ZD(a),C=!0)),C?this.fg(v.J,v.Xc):(a=(C=new m.gd).Ib(a),b=C.Ib(u),m.Tk.V(C,d,g,!1),d=C.Ne(b).mg(),C.Gp(0,!0,!0),m.rn.V(C,a,-1,!1,g),C.I(a)!=0&&(m.rn.V(C,b,-1,!1,g),v.er(C,g),(u=C.I(b)==0)||(v.Bp(a,b),v.j.Ug(),b=this.fg(v.J,v.Xc))?(a=C.Ne(a),a=(C=new m.gd).Ib(a),b=C.Ib(d),v.er(C,g),v.le=0,v.Yi(),v.bj(u?"T*****F**":"******F**"),v.IB(),v.Bp(a,b),v.j.Ug(),this.fg(v.J,v.Xc)):b))},h.$m=function(a,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.IB();var S=new m.l,C=new m.l;return a.A(S),u.A(C),g=!1,m.ud.dk(S,C,d)&&(b.Du(a,u),g=!0),g||((S=m.ud.qc(a,u,!1))==4?(b.Du(a,u),g=!0):S==1&&(b.$D(u),g=!0)),g||(a=(g=new m.gd).Ib(a),u=g.Ib(u),b.Wo(g,d,v),b.kh=b.j.Dp(),h.Jw(u,b.j,b.kh),b.Bp(a,u),b.j.Ep(b.kh),b.j.Ug()),h.fg(b.J,b.Xc)},h.fB=function(a,u,d,g){var v=new h;v.Yi(),v.bj("T*****F**"),v.IB();var b=new m.l,S=new m.l;a.A(b),u.A(S);var C=!1;return m.ud.dk(b,S,d)&&(v.Du(a,u),C=!0),C||((b=m.ud.qc(a,u,!1))==4?(v.Du(a,u),C=!0):b==1&&(v.$D(u),C=!0)),C?this.fg(v.J,v.Xc):(a=(C=new m.gd).Ib(a),u=C.Ib(u),v.Wo(C,d,g),C.I(a)!=0&&(v.Bp(a,u),v.j.Ug(),this.fg(v.J,v.Xc)))},h.pt=function(a,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.yJ();var S=new m.l,C=new m.l;return a.A(S),u.A(C),g=!1,m.ud.dk(S,C,d)&&(b.Eu(a),g=!0),g||((S=m.ud.qc(a,u,!1))==4?(b.Eu(a),g=!0):S==1&&(b.zN(),g=!0)),g||(a=(g=new m.gd).Ib(a),u=g.Ib(u),b.Wo(g,d,v),b.Gy(a,u),b.j.Ug()),h.fg(b.J,b.Xc)},h.gB=function(a,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.eX(),g=new m.l;var S=new m.l;a.A(g),u.A(S);var C=!1;return m.ud.dk(g,S,d)&&(b.PG(a,u),C=!0),C||m.ud.qc(a,u,!1)!=4||(b.PG(a,u),C=!0),C||(a=(g=new m.gd).Ib(a),u=g.Ib(u),b.Wo(g,d,v),b.Yh=b.j.Dp(),b.kh=b.j.Dp(),h.Jw(a,b.j,b.Yh),h.Jw(u,b.j,b.kh),b.Bp(a,u),b.j.Ep(b.Yh),b.j.Ep(b.kh),b.j.Ug()),h.fg(b.J,b.Xc)},h.st=function(a,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.MJ(),g=new m.l;var S=new m.l;a.A(g),u.A(S);var C=!1;return m.ud.dk(g,S,d)&&(b.Vz(a),C=!0),C||m.ud.qc(a,u,!1)!=4||(b.Vz(a),C=!0),C||(a=(g=new m.gd).Ib(a),u=g.Ib(u),b.Wo(g,d,v),b.Yh=b.j.Dp(),h.Jw(a,b.j,b.Yh),b.Gy(a,u),b.j.Ep(b.Yh),b.j.Ug()),h.fg(b.J,b.Xc)},h.ZA=function(a,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.RJ(),g=new m.l;var S=new m.l;a.A(g),u.A(S);var C=!1;return m.ud.dk(g,S,d)&&(b.yI(),C=!0),C||(a=(g=new m.gd).Ib(a),u=g.Ib(u),b.Wo(g,d,v),b.Gy(a,u),b.j.Ug()),h.fg(b.J,b.Xc)},h.qt=function(a,u,d,g){var v=new h;v.Yi(),v.bj(g),v.yJ();var b=new m.l;a.A(b),u=u.D();var S=!1;return m.ud.Rw(u,b,d)&&(v.Eu(a),S=!0),S||((d=m.hd.Yd(a,u,d))==1?(v.J[0]=0,v.J[2]=2,v.J[3]=-1,v.J[5]=1,v.J[6]=-1):d==2?(v.J[6]=-1,a.Ke()!=0?(v.J[0]=-1,v.J[3]=0,v.J[2]=2,v.J[5]=1):(v.J[0]=0,v.J[3]=-1,v.J[5]=-1,d=new m.l,a.A(d),v.J[2]=d.ca()==0&&d.R()==0?-1:1)):v.Eu(a)),this.fg(v.J,g)},h.tt=function(a,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.MJ();var S=new m.l;a.A(S),g=u.D();var C=!1;if(m.ud.Rw(g,S,d)&&(b.Vz(a),C=!0),!C){S=null;var O=C=!1;(b.ea[0]||b.ea[6])&&(m.ud.Yz(a,g,d)?(b.ea[0]&&(S=m.pi.gm(a,v),O=!m.ud.kt(S,g,d),C=!0,b.J[0]=O?-1:0),b.J[6]=-1):(b.J[0]=-1,b.J[6]=0)),b.ea[3]&&(S!=null&&S.B()?b.J[3]=-1:(C||(S==null&&(S=m.pi.gm(a,v)),O=!m.ud.kt(S,g,d),C=!0),b.J[3]=O?0:-1)),b.ea[5]&&(S!=null&&S.B()?b.J[5]=-1:C&&!O?b.J[5]=0:(S==null&&(S=m.pi.gm(a,v)),v=m.ud.Nw(S,u,d),b.J[5]=v?-1:0)),b.ea[2]&&(a.Qb()!=0?b.J[2]=1:((v=new m.de(a.description)).Fd(a,0,a.I()),a=m.ud.Nw(v,u,d),b.J[2]=a?-1:0))}return this.fg(b.J,b.Xc)},h.lt=function(a,u,d,g){var v=new h;v.Yi(),v.bj(g),v.RJ();var b=new m.l;a.A(b),u=u.D();var S=!1;if(m.ud.Rw(u,b,d)&&(v.yI(),S=!0),!S){b=!1,S=!0,d*=d;for(var C=0;Cb;b++)v[b]=-1;return m.h.yc(a,u)<=d*d?v[0]=0:(v[2]=0,v[6]=0),v[8]=2,h.fg(v,g)},h.fg=function(a,u){for(var d=0;9>d;d++)switch(u.charAt(d)){case"T":if(a[d]==-1)return!1;break;case"F":if(a[d]!=-1)return!1;break;case"0":if(a[d]!=0)return!1;break;case"1":if(a[d]!=1)return!1;break;case"2":if(a[d]!=2)return!1}return!0},h.uW=function(a,u,d){var g=[-1,-1,-1,-1,-1,-1,-1,-1,-1];if(a.B()&&u.B()){for(var v=0;9>v;v++)g[v]=-1;return this.fg(g,d)}return v=!1,a.B()&&(a=u,v=!0),g[0]=-1,g[1]=-1,g[3]=-1,g[4]=-1,g[6]=-1,g[7]=-1,g[8]=2,u=a.getType(),m.aa.Hc(u)?u==1736?a.Ke()!=0?(g[2]=2,g[5]=1):(g[5]=-1,u=new m.l,a.A(u),g[2]=u.ca()==0&&u.R()==0?0:1):(u=a.Qb()!=0,g[2]=u?1:0,g[5]=m.pi.aq(a)?0:-1):(g[2]=0,g[5]=-1),v&&this.vK(g),this.fg(g,d)},h.MR=function(a,u,d){return h.dQ(a)?3:h.UP(a)?4:h.cY(a,u,d)?8:h.CP(a,u,d)?16:h.eP(a)?1:h.EU(a,u,d)?32:0},h.dQ=function(a){return a.charAt(0)=="T"&&a.charAt(1)=="*"&&a.charAt(2)=="F"&&a.charAt(3)=="*"&&a.charAt(4)=="*"&&a.charAt(5)=="F"&&a.charAt(6)=="F"&&a.charAt(7)=="F"&&a.charAt(8)=="*"},h.UP=function(a){return a.charAt(0)=="F"&&a.charAt(1)=="F"&&a.charAt(2)=="*"&&a.charAt(3)=="F"&&a.charAt(4)=="F"&&a.charAt(5)=="*"&&a.charAt(6)=="*"&&a.charAt(7)=="*"&&a.charAt(8)=="*"},h.cY=function(a,u,d){return(u!=0||d!=0)&&((u!=2||d!=2)&&(a.charAt(0)=="F"&&a.charAt(1)=="*"&&a.charAt(2)=="*"&&a.charAt(3)=="T"&&a.charAt(4)=="*"&&a.charAt(5)=="*"&&a.charAt(6)=="*"&&a.charAt(7)=="*"&&a.charAt(8)=="*"||u==1&&d==1&&a.charAt(0)=="F"&&a.charAt(1)=="T"&&a.charAt(2)=="*"&&a.charAt(3)=="*"&&a.charAt(4)=="*"&&a.charAt(5)=="*"&&a.charAt(6)=="*"&&a.charAt(7)=="*"&&a.charAt(8)=="*")||d!=0&&a.charAt(0)=="F"&&a.charAt(1)=="*"&&a.charAt(2)=="*"&&a.charAt(3)=="*"&&a.charAt(4)=="T"&&a.charAt(5)=="*"&&a.charAt(6)=="*"&&a.charAt(7)=="*"&&a.charAt(8)=="*")},h.CP=function(a,u,d){return u>d?a.charAt(0)=="T"&&a.charAt(1)=="*"&&a.charAt(2)=="*"&&a.charAt(3)=="*"&&a.charAt(4)=="*"&&a.charAt(5)=="*"&&a.charAt(6)=="T"&&a.charAt(7)=="*"&&a.charAt(8)=="*":u==1&&d==1&&a.charAt(0)=="0"&&a.charAt(1)=="*"&&a.charAt(2)=="*"&&a.charAt(3)=="*"&&a.charAt(4)=="*"&&a.charAt(5)=="*"&&a.charAt(6)=="*"&&a.charAt(7)=="*"&&a.charAt(8)=="*"},h.eP=function(a){return a.charAt(0)=="T"&&a.charAt(1)=="*"&&a.charAt(2)=="*"&&a.charAt(3)=="*"&&a.charAt(4)=="*"&&a.charAt(5)=="*"&&a.charAt(6)=="F"&&a.charAt(7)=="F"&&a.charAt(8)=="*"},h.EU=function(a,u,d){if(u==d){if(u!=1)return a.charAt(0)=="T"&&a.charAt(1)=="*"&&a.charAt(2)=="T"&&a.charAt(3)=="*"&&a.charAt(4)=="*"&&a.charAt(5)=="*"&&a.charAt(6)=="T"&&a.charAt(7)=="*"&&a.charAt(8)=="*";if(a.charAt(0)=="1"&&a.charAt(1)=="*"&&a.charAt(2)=="T"&&a.charAt(3)=="*"&&a.charAt(4)=="*"&&a.charAt(5)=="*"&&a.charAt(6)=="T"&&a.charAt(7)=="*"&&a.charAt(8)=="*")return!0}return!1},h.Jw=function(a,u,d){a=u.La(a);for(var g=u.Re;g!=-1;g=u.Rf(g))if(u.xd(g)&a){var v=u.Me(g);if(v==-1)u.nn(g,d,0);else{var b=v,S=0;do u.dh(b)&a&&S++,b=u.jc(u.xa(b));while(b!=v);u.nn(g,d,S)}}},h.Zp=function(a){var u=""+a.charAt(0);return u+=a.charAt(3),u+=a.charAt(6),u+=a.charAt(1),u+=a.charAt(4),u+=a.charAt(7),u+=a.charAt(2),(u+=a.charAt(5))+a.charAt(8)},h.prototype.Yi=function(){for(var a=0;9>a;a++)this.J[a]=-2,this.Za[a]=-2},h.vK=function(a){var u=a[1],d=a[2],g=a[5];a[1]=a[3],a[2]=a[6],a[5]=a[7],a[3]=u,a[6]=d,a[7]=g},h.prototype.bj=function(a){for(this.Xc=a,a=0;9>a;a++)this.Xc.charAt(a)!="*"?(this.ea[a]=!0,this.le++):this.ea[a]=!1},h.prototype.UJ=function(){for(var a=0;9>a;a++)this.ea[a]&&this.J[a]==-2&&(this.J[a]=-1,this.ea[a]=!1)},h.prototype.pc=function(a){return this.J[a]!=-2&&(this.J[a]==-1?(this.ea[a]=!1,this.le--,!0):this.Xc.charAt(a)!="T"&&this.Xc.charAt(a)!="F"?!(this.J[a]b?1:0},h.prototype.reset=function(){this.yA=-1},h}(),p=function(){function h(){this.Wm=this.Gl=null,this.fb=new m.Yj,this.fb.RP(),this.$d=new E(this),this.fb.Vo(this.$d)}return h.prototype.HQ=function(){var a=!1;if(this.fw&&(a=this.IQ()),this.g.da(this.X)==1){var u=this.g.Ob(this.X);return a=this.g.wz(u),this.g.PB(u,!0),0>a&&(a=this.g.Xa(u),this.g.pJ(a),this.g.Wg(u,this.g.Ma(a)),!0)}for(this.El=this.g.Ky(),this.wo=this.g.Ky(),u=this.g.Ob(this.X);u!=-1;u=this.g.Rb(u))this.g.gr(u,this.El,0),this.g.gr(u,this.wo,-1);u=new m.ia(0),this.yh=NaN;var d=new m.h;this.et=this.g.da(this.X),this.ro=this.g.Gd(),this.Rs=this.g.Gd();for(var g=this.Gl.rc(this.Gl.je);g!=-1;g=this.Gl.lb(g)){var v=this.Gl.getData(g);if(this.g.Gc(v,d),d.y!=this.yh&&u.size!=0&&(a=this.ut(u)||a,this.$d.reset(),u.clear(!1)),u.add(v),this.yh=d.y,this.et==0)break}for(0=this.MA.length&&this.MA.push(new m.ig);var h=this.MA[this.Cw];return this.Cw++,h},p.prototype.clear=function(){this.wB(this.mo),this.wB(this.$s),this.wB(this.yw),this.Cw=0},p.prototype.Oo=function(h){this.mo.push(this.Ow(h))},p.prototype.ol=function(h){return h==0?this.$s.length:this.yw.length},p.prototype.Vp=function(h,a){return this.SR(h,a).$i},p.prototype.Ea=function(h,a){if(this.mo.length!=2)throw m.i.Qa();this.qa=h;var u=m.lc.ox(.01*h),d=!1,g=this.mo[0],v=this.mo[1];if(a||5&g.$i.zr(v.$i,h,!0)){if(g.$i.getType()==322){var b=g.$i;if(v.$i.getType()==322){a=v.$i;var S=m.yb.Zx(b,a,null,this.Fq,this.Bk,h);if(S==0)throw m.yb.Zx(b,a,null,this.Fq,this.Bk,h),m.i.Qa();h=Array(9),m.O.$u(h,null);for(var C=0;Cu&&(d=!0)):$>B?(b.hc(O,K),O=new m.h,a.hc(R,O),m.h.yc(K,O)>u&&(d=!0)):(a.hc(R,K),$=new m.h,b.hc(O,$),m.h.yc(K,$)>u&&(d=!0)),h[C]=K}for(g=0,v=-1,C=0;C<=S;C++)(G=Cthis.Bk[1]&&(G=this.Bk[0],this.Bk[0]=this.Bk[1],this.Bk[1]=G,C=b[0],b[0]=b[1],b[1]=C),g=0,v=-1,C=0;C<=S;C++)(G=C=v;v++){if((a=1>v?this.Fq[v]:1)!=u){var b=this.aB();h.ah(u,a,b),g!=-1&&b.get().Dc(d),v!=1&&b.get().Qc(d),u=a,this.$s.push(this.Ow(b.get()))}g=v}this.Bf.Cb(d)}},p}();m.TC=E}(ie||(ie={})),function(m){var D=function(){function E(p){this.Ds=this.rk=this.sb=null,this.ag=0,this.zm=!1,this.zf=-1,this.Cl=this.Jd=0,this.gb=-1,this.ib=p,this.ag=this.Wx(this.Cl),this.zm=!1,this.rk=null,this.Ds=new m.h}return E.prototype.BW=function(p){if(this.ib!=p.ib)throw m.i.Hb();this.zf=p.zf,this.Jd=p.Jd,this.gb=p.gb,this.Cl=p.Cl,this.ag=p.ag,this.zm=p.zm,this.rk=null},E.prototype.ha=function(){if(this.zf!=this.Jd&&this.BD(),this.zm)this.Jd=(this.Jd+1)%this.ag;else{if(this.Jd==this.ag)throw m.i.ce();this.Jd++}return this.rk},E.prototype.li=function(){if(this.zm)this.Jd=(this.ag+this.Jd-1)%this.ag;else{if(this.Jd==0)throw m.i.ce();this.Jd--}return this.Jd!=this.zf&&this.BD(),this.rk},E.prototype.DW=function(){this.zf=-1,this.Jd=0},E.prototype.EW=function(){this.Jd=this.ag,this.zf=-1},E.prototype.Vb=function(p,h){if(h===void 0&&(h=-1),0<=this.gb&&this.gb=a&&p=this.ib.Ba(h)&&p=this.ib.da())&&(this.zf=-1,this.Jd=0,this.ag=this.Wx(this.gb),this.ib.Ba(this.gb),this.ib.dc(this.gb),this.Cl++,!0)},E.prototype.Zi=function(){this.ag=this.Jd=this.zf=-1,this.Cl=0,this.gb=-1},E.prototype.Wx=function(p){if(this.ib.Ac())return 0;var h=1;return this.ib.dc(p)&&(h=0),this.ib.Ja(p)-h},E.prototype.On=function(){return this.zf==this.ag-1&&this.ib.dc(this.gb)},E.prototype.JB=function(){this.zm=!0},E.prototype.wb=function(){return this.ib.nb.o[this.gb]+this.zf},E.prototype.IM=function(){return this.ib.Ba(this.gb)},E.prototype.ik=function(){return this.On()?this.ib.Ba(this.gb):this.wb()+1},E.prototype.vm=function(){return this.zf==0},E.prototype.Qn=function(){return this.zf==this.ag-1},E.prototype.Ha=function(){return this.Jdthis.Jd||this.Jd>=this.ag)throw m.i.ce();this.zf=this.Jd;var p=this.wb();this.ib.mc();var h=this.ib.Ve,a=1;switch(h!=null&&(a=7&h.read(p)),h=this.ib.description,a){case 1:this.sb==null&&(this.sb=new m.yb),this.rk=this.sb;break;case 2:throw m.i.fa("internal error");default:throw m.i.Qa()}this.rk.Nf(h),a=this.ik(),this.ib.Gc(p,this.Ds),this.rk.Dc(this.Ds),this.ib.Gc(a,this.Ds),this.rk.Qc(this.Ds);for(var u=1,d=h.Aa;ud&&(g=h,h=u,u=g,g=a,a=d,d=g,g=-1),!(0>d||a>=this.pl)){0>h&&0>u?u=h=-1:h>=this.oi&&u>=this.oi&&(u=h=this.oi);var v=(u-h)/(d-a);d>this.pl&&(u=v*((d=this.pl)-a)+h),0>a&&(h=v*(0-a)+h,a=0);var b=Math.max(this.oi+1,8388607);-8388607>h?(a=(0-h)/v+a,h=0):h>b&&(a=(this.oi-h)/v+a,h=this.oi),-8388607>u?d=(0-h)/v+a:u>b&&(d=(this.oi-h)/v+a),(a=m.O.truncate(a))!=(d=m.O.truncate(d))&&((u=new D).x=m.O.truncate(4294967296*h),u.y=a,u.H=d,u.WP=m.O.truncate(4294967296*v),u.dir=g,this.Wl==null&&(this.Wl=m.O.lg(this.pl,null)),u.next=this.Wl[u.y],this.Wl[u.y]=u,u.ythis.Kw&&(this.Kw=u.H),this.Tq++)}}},p.prototype.sN=function(){if(this.Jh!=null){for(var h=!1,a=null,u=this.Jh;u!=null;)if(u.y++,u.y==u.H){var d=u;u=u.next,a!=null?a.next=u:this.Jh=u,d.next=null}else u.x+=u.WP,a!=null&&a.x>u.x&&(h=!0),a=u,u=u.next;h&&(this.Jh=this.fK(this.Jh))}},p.prototype.lN=function(h){if(!(h>=this.pl)){var a=this.Wl[h];if(a!=null){this.Wl[h]=null,a=this.fK(a),this.Tq-=this.gK,h=this.Jh;for(var u=!0,d=a,g=null;h!=null&&d!=null;)h.x>d.x?(u&&(this.Jh=d),u=d.next,d.next=h,g!=null&&(g.next=d),g=d,d=u):(u=h.next,h.next=d,g!=null&&(g.next=h),g=h,h=u),u=!1;this.Jh==null&&(this.Jh=a)}}},p.eK=function(h,a){return 0>h?0:h>a?a:h},p.prototype.ZP=function(){if(this.Jh!=null){for(var h=0,a=this.Jh,u=m.O.truncate(m.O.XG(a.x)),d=a.next;d!=null;d=d.next)if(h=this.kF?1^h:h+d.dir,d.x>a.x){var g=m.O.truncate(m.O.XG(d.x));h!=0&&(a=p.eK(u,this.oi),(u=p.eK(g,this.oi))>a&&athis.Kf[1].x&&(h=this.Kf[0],this.Kf[0]=this.Kf[1],this.Kf[1]=h):p.AN(this.Kf,a,function(g,v){return g==v?0:g.xv.x?1:0}),h=this.Kf[0],this.Kf[0]=null,u=h,d=1;dthis.Wh.size)break;var S=this;for(this.xe.Vd(0,this.xe.size,function(C,O){return S.pM(C,O)}),a=0,u=this.xe.size;aG?1:Kee?1:0)==0&&(K=($=S[C*$+3])<(N=S[C*N+3])?-1:$==N?0:1),K}),this.Pq=this.g.Gd(),this.oe=new m.jp,this.RA=this.oe.Ph(0),this.oe.fn(a),d=0;dS;S++){for(C=$[S],O=a[S],R=S-1;0<=R&&$[R]>C;)$[R+1]=$[R],a[R+1]=a[R],R--;$[R+1]=C,a[R+1]=O}return $=0,a[0]!=0&&($|=1),a[1]!=0&&($|=2),a[2]!=0&&($|=4),a[3]!=0&&($|=8),($==5||$==10)&&(p==h?p?(this.g.Bc(b,u),this.g.Cc(u,b),this.g.Bc(d,v),this.g.Cc(v,d)):(this.g.Cc(b,u),this.g.Bc(u,b),this.g.Cc(d,v),this.g.Bc(v,d)):p?(this.g.Cc(u,g),this.g.Bc(g,u),this.g.Cc(v,d),this.g.Bc(d,v)):(this.g.Bc(u,g),this.g.Cc(g,u),this.g.Bc(v,d),this.g.Cc(d,v)),!0)},E.prototype.tD=function(p,h,a,u,d,g){this.MY?this.VM():this.UM(p,h,a,u,d,g)},E.prototype.VM=function(){throw m.i.fa("not implemented.")},E.prototype.UM=function(p,h,a,u,d,g){if(p!=h)p?(this.g.Bc(a,d),this.g.Cc(d,a),this.g.Bc(g,u),this.g.Cc(u,g),this.vn(d,a),this.ui(d,!0),this.g.mi(d,!0),this.bk(a),this.vn(g,u),this.ui(g,!0),this.g.mi(g,!1)):(this.g.Bc(d,a),this.g.Cc(a,d),this.g.Bc(u,g),this.g.Cc(g,u),this.vn(d,a),this.ui(d,!0),this.g.mi(d,!1),this.bk(a),this.vn(g,u),this.ui(g,!0),this.g.mi(g,!0)),this.bk(u);else{var v=p?a:u,b=h?d:g;for(p=p?u:a,h=h?g:d,d=!1,this.g.Bc(v,b),this.g.Bc(b,v),this.g.Cc(p,h),this.g.Cc(h,p),g=h;g!=b;)a=this.g.Ma(g),u=this.g.U(g),this.g.Cc(g,u),this.g.Bc(g,a),d=d||g==v,g=u;d||(a=this.g.Ma(b),u=this.g.U(b),this.g.Cc(b,u),this.g.Bc(b,a)),this.vn(b,v),this.ui(b,!0),this.g.mi(b,!1),this.bk(v),this.vn(h,p),this.ui(h,!0),this.g.mi(h,!1),this.bk(p)}},E.prototype.cD=function(){for(var p=!1,h=this.g.Ob(this.X);h!=-1;){for(var a=this.g.Xa(h),u=0,d=this.g.Ja(h);uthis.g.Ja(h)){for(p=this.g.Xa(h),u=0,d=this.g.Ja(h);u=h)throw m.i.N("Invalid or unsupported wkid: "+h);var a=new p;return a.dg=h,a},p.qP=function(h){if(h==null||h.length==0)throw m.i.N("Cannot create SpatialReference from null or empty text.");var a=new p;return a.wh=h,a},p.prototype.Nb=function(h){return this==h||h!=null&&this.constructor==h.constructor&&this.dg==h.dg&&(this.dg!=0||this.wh===h.wh)},p.prototype.toString=function(){return"[ tol: "+this.Kn()+"; wkid: "+this.Ec()+"; wkt: "+this.Bz()+"]"},p.prototype.cc=function(){if(this.pp!=="")return this.pp;var h=this.toString();if(Array.prototype.reduce)return this.pp="S"+h.split("").reduce(function(d,g){return(d=(d<<5)-d+g.charCodeAt(0))&d},0);var a=0;if(h.length===0)return"";for(var u=0;u=h.length)throw m.i.N();var a=null;try{a=m.NC.fromString(h)}catch{a=null}return a==null?null:p.bD(a,!0)},p.prototype.by=function(h){this.Kd=h,this.Eo=this.Kd.Hd()},p.prototype.gy=function(h){this.KH=h,this.ST=this.KH!=null?this.KH.Eo:null},p.prototype.Wc=function(){return this.Sb()!=0&&this.Sb()!=3&&this.Kd.Wc()},p.prototype.IG=function(){return this.Sb()!=0&&(this.Sb()==3?this.Ji.fk().Wc():this.Kd.Wc())},p.prototype.eh=function(){return this.Kd!=null?this.Kd.Ue:null},p.prototype.pm=function(){return this.Kd.pm()},p.prototype.bf=function(){return this.Kd.bf()},p.prototype.hh=function(){return this.Kd!=null?this.Kd.sw:NaN},p.prototype.Up=function(){return this.Kd.Up()},p.prototype.Wr=function(){return this.Kd.Wr()},p.prototype.kk=function(){return this.Kd.kk()},p.prototype.kS=function(h){return m.OC.Py(this.Kd,h.Kd)},p.prototype.ml=function(){return this.Kd.ml()},p.prototype.Vr=function(){return this.Kd.Vr()},p.prototype.zi=function(){return this.Sb()==3?this.Ji.fk().zi():this.Kd.zi()},p.prototype.gh=function(){if(!this.Wc())throw m.i.N("!isPannable()");var h=new m.l;return this.Kd.gh(h),h},p.prototype.Oe=function(){if(!this.Wc())throw m.i.N("!isPannable()");return this.Kd.so},p.prototype.HR=function(){if(!this.Wc())throw m.i.N("!isPannable()");var h=new m.l;return this.Kd.GR(h),h},p.prototype.pv=function(){if(!this.Wc())throw m.i.N("!isPannable()");return this.Kd.pv()},p.prototype.ov=function(){if(!this.Wc())throw m.i.N("!isPannable()");return this.Kd.ov()},p.prototype.Xr=function(){return this.Ji!=null?this.Ji.fk().Xr():this.Kd.Xr()},p.prototype.PQ=function(){return this.Kd.hv()},p.prototype.Qp=function(){return this.Eo.getUnitFactor()},p.prototype.vz=function(h){return this.Hq.vz(h)},p.prototype.sc=function(){var h=this.Sb();if(h==1)return this;if(h==3)return this.Ji.fk().sc();if(h==0||h===4)throw m.i.fa("invalid call");if(this.jw!==null)return this.jw;if((h=this.eh().getGeogcs())==null)throw m.i.Qa();return this.jw=p.bF(h,this.Hq.VF())},p.bF=function(h,a){if(h==null)throw m.i.N("null pointer.");var u=new p;return h=p.mu(h,!0),u.Hq.Xx(h,null,a),u.by(h),u.gy(null),u.dg=h.$r(),u},p.prototype.Sb=function(){var h=this.eh();if(h!=null)switch(h.getType()){case m.Sc.PE_TYPE_GEOGCS:return 1;case m.Sc.PE_TYPE_PROJCS:return 2}return 4},p.prototype.hv=function(){return this.Kd.hv()},p.mu=function(h,a){var u=h.getCode();if(0>=u&&0<(u=m.pf.getCode(h))){if((h=m.pf.coordsys(u))==null)throw m.i.N("Text to wkid mapping had failed: "+u);return p.mu(h,a)}if(a&&0=u?h:m.pf.coordsys(u),h=new m.OC(h),p.lK[a]=h,0=h)throw m.i.N("Invalid or unsupported wkid: "+h);var a=p.qx[h];if(a!=null)return a;if((a=m.pf.coordsys(h))==null)throw m.i.N("Invalid or unsupported wkid: "+h);return(a=p.mu(a,!1)).$r()!=h&&(p.qx[h]=a),a},p.kM=function(h){if(h==null||h===void 0||h.length==0)throw m.i.N("Cannot create SpatialReference from null or empty text.");var a=null;try{a=m.pf.fromString(m.Sc.PE_TYPE_COORDSYS,h)}catch(u){throw m.i.N("Cannot create SpatialReference from text. "+u.message)}if(a===null)throw m.i.N("Cannot create SpatialReference from text. ");return p.mu(a,!0)},p.bD=function(h,a){var u,d=h.getCode();if(0>=d&&0<(d=m.pf.getCode(h))){if((d=m.pf.vertcs(d))===null)throw m.i.N();return p.bD(d,a)}if(a&&0=d||(u=m.pf.vertcs(d)),u===null)throw m.i.N();return u=new m.PL(u),p.mK[h]=u,0a&&(this.Pj=a/(d-this.Fm)),u=this.Gm+u,(g=m.O.truncate((u-this.Gm)*this.Pj))>a&&(this.Pj=a/(u-this.Gm))}},h.prototype.aC=function(a){switch(a){case 0:this.Ik=void 0;case 1:this.Mq=void 0;case 2:this.Lq=void 0}},h.prototype.Kn=function(a){switch(a){case 0:return this.Ik;case 1:return this.Mq;case 2:return this.Lq}return 0},h.prototype.vz=function(a){if(this.Rm==D.FloatingPoint)return 0;switch(a){case 0:return 1/this.Pj;case 1:case 2:return 1/this.Fo;default:return 0}},h.prototype.toString=function(){var a="SRPD [m_toleranceXY: "+this.Ik.toString();return(a=(a=(a=(a=(a=(a=(a=(a=(a=a+";m_falseX: "+this.Fm.toString())+";m_falseY: "+this.Gm.toString())+";m_unitsXY: "+this.Pj.toString())+";m_falseZ: "+this.sA.toString())+";m_unitsZ: "+this.Fo.toString())+";m_falseM: "+this.rA.toString())+";m_toleranceZ: "+this.Mq.toString())+";m_toleranceM: "+this.Lq.toString())+";m_precision: "+this.Rm.toString())+"] "},h}();m.ZL=p}(ie||(ie={})),function(m){function D(d,g){return 89.99999g&&(g=-89.99999),g*=.017453292519943,[111319.49079327169*d,31890685e-1*Math.log((1+Math.sin(g))/(1-Math.sin(g)))]}function E(d,g,v){return d=d/6378137*57.29577951308232,v?[d,57.29577951308232*(1.5707963267948966-2*Math.atan(Math.exp(-1*g/6378137)))]:[d-360*Math.floor((d+180)/360),57.29577951308232*(1.5707963267948966-2*Math.atan(Math.exp(-1*g/6378137)))]}function p(d,g,v){var b=d.Of();if(d.getType()===33)g=g(b.Lg(),b.ih()),b.Cb(g[0],g[1]);else if(d.getType()===197){var S=g(d.es(),d.gs(),v);g=g(d.ds(),d.fs(),v),b.K(S[0],S[1],g[0],g[1])}else for(S=new m.h,d=0;dv&&(v=637.100877141506);for(var b,S=[],C=0;Cthis.Hg&&this.Dz(p)},E.prototype.tx=function(p,h){p*=this.stride,h*=this.stride;for(var a=0;athis.ns.va)return 1;g=d.na==d.la;var v=u.na==u.la;if(g||v){if(g&&v)return 0;if(d.na==u.na&&d.sa==u.sa)return g?1:-1;if(d.la==u.la&&d.pa==u.pa)return g?-1:1}return(g=d.Pe(this.yh,this.ms.oa))==(v=u.Pe(this.yh,this.ns.oa))&&((v=.5*((g=Math.min(d.la,u.la))+this.yh))==this.yh&&(v=g),g=d.Pe(v,this.ms.oa),v=u.Pe(v,this.ns.oa)),gv?1:0},a.prototype.aK=function(u){this.yh=u},a}(),h=function(){function a(u){this.ib=u,this.WH=new m.ig,this.Bf=new m.h,this.wA=new m.Nc}return a.prototype.kX=function(u){this.Bf.L(u)},a.prototype.compare=function(u,d){return this.ib.pB(u.ja(d),this.WH),u=this.WH.get(),this.wA.K(u.sa,u.pa),this.Bf.xthis.wA.va?1:(u=u.Pe(this.Bf.y,this.Bf.x),this.Bf.xu?1:0)},a}();D=function(){function a(){this.hH=this.Di=this.Gi=this.kA=this.Yn=this.ye=this.Kc=this.jh=this.ge=null,this.Go=this.xg=-1,this.gH=!0,this.pA=!1,this.lA=NaN,this.Ni=new m.Md,this.bO=2147483647,this.aO=m.O.truncate(-2147483648),this.cg=this.ae=this.Hl=this.Cq=this.Cm=this.Bq=this.Os=this.Re=-1,this.wa=0}return a.prototype.yy=function(u){this.lA=u},a.prototype.Ym=function(){this.ge==null&&(this.ge=new m.$c(8));var u=this.ge.Ce();return this.ge.S(u,1,0),u},a.prototype.vU=function(){this.Kc==null&&(this.Kc=new m.$c(8));var u=this.Kc.Ce();this.Kc.S(u,2,0),this.Kc.S(u,3,0);var d=this.Kc.Ce();return this.Kc.S(d,2,0),this.Kc.S(d,3,0),this.JJ(u,d),this.JJ(d,u),u},a.prototype.mI=function(){this.ye==null&&(this.ye=new m.$c(8));var u=this.ye.Ce();return this.ye.S(u,2,0),u},a.prototype.TW=function(u,d){this.ge.S(u,7,d)},a.prototype.mn=function(u,d){this.ge.S(u,2,d)},a.prototype.SW=function(u,d){this.ge.S(u,1,d)},a.prototype.lX=function(u,d){this.ge.S(u,3,d)},a.prototype.iX=function(u,d){this.ge.S(u,4,d)},a.prototype.cr=function(u,d){this.ge.S(u,5,d)},a.prototype.eR=function(u){return this.ge.T(u,5)},a.prototype.RW=function(u,d){this.ge.S(u,6,d)},a.prototype.cN=function(u,d){this.RW(d,u)},a.prototype.IJ=function(u,d){this.Kc.S(u,1,d)},a.prototype.JJ=function(u,d){this.Kc.S(u,4,d)},a.prototype.Tl=function(u,d){this.Kc.S(u,5,d)},a.prototype.Sl=function(u,d){this.Kc.S(u,6,d)},a.prototype.$W=function(u,d){this.Kc.S(u,2,d)},a.prototype.$w=function(u,d){this.Kc.S(u,3,d)},a.prototype.LF=function(u){return this.Kc.T(u,3)},a.prototype.Gt=function(u,d){this.Kc.S(u,7,d)},a.prototype.EK=function(u,d){if(this.mm(u)!=-1)for(d=d?-1:u,u=this.mm(u);u!=-1;u=this.js(u))this.g.Ra(this.tj(u),this.Cq,d)},a.prototype.yx=function(u,d){u!=-1&&(this.EK(u,d),this.EK(this.xa(u),d))},a.prototype.Dt=function(u,d){this.ye.S(u,1,d)},a.prototype.Vg=function(u,d){this.ye.S(u,2,d)},a.prototype.jn=function(u,d){this.ye.S(u,3,d),this.NW(u,this.dR(d)),this.MW(d,u)},a.prototype.MW=function(u,d){this.ye.S(u,4,d)},a.prototype.NW=function(u,d){this.ye.S(u,5,d)},a.prototype.DJ=function(u,d){this.ye.S(u,6,d)},a.prototype.BJ=function(u,d){this.ye.S(u,7,d)},a.prototype.AJ=function(u,d){this.Yn.write(u,d)},a.prototype.CJ=function(u,d){this.kA.write(u,d)},a.prototype.kY=function(u){var d=0,g=0,v=this.AF(u),b=new m.h,S=new m.h,C=new m.h;this.Yr(v,b),S.L(b);var O=v;do this.lm(O,C),g+=m.h.tb(S,C),this.$e(this.xa(O))!=u&&(d+=(C.x-b.x-(S.x-b.x))*(C.y-b.y+(S.y-b.y))*.5),S.L(C),O=this.jc(O);while(O!=v);this.Yn.write(u,d),this.kA.write(u,g)},a.prototype.PU=function(u,d){var g=new p(this),v=new m.Yj;v.De(m.O.truncate(this.wa/2)),v.Vo(g);for(var b=new m.ia(0),S=this.$g(),C=null,O=0,R=new m.h,$=this.Re;$!=-1;$=this.Rf($)){if(!(255&++O)&&d!=null&&!d.progress(-1,-1))throw m.i.WC();var N=this.Me($);if(N!=-1){if(b.Bh(0),!this.gY(v,S,b,N)){this.D($,R),g.aK(R.y);var B=N;do{var G=this.Ab(B,S);G!=-1&&(v.vd(G,-1),this.Kb(B,S,-2)),B=this.jc(this.xa(B))}while(N!=B);B=N;do(G=this.Ab(B,S))==-1&&(G=v.addElement(B,-1),b.add(G)),B=this.jc(this.xa(B));while(N!=B)}for(N=b.size-1;0<=N;N--)G=b.get(N),B=v.ja(G),this.Kb(this.xa(B),S,G),this.OU(v,G,u)}else this.cz($)==-1&&(C==null&&(C=new h(this)),this.D($,R),C.kX(R),B=v.IW(C),N=this.Hl,B!=-1&&(G=v.ja(B),this.$e(G)==this.$e(this.xa(G))&&(G=this.OF(v,B)),G!=-1&&(N=this.$e(G))),this.cN(N,$))}this.Jg(S)},a.prototype.OU=function(u,d,g){var v=u.ja(d),b=this.$e(v);if(this.Gn(b)==-1){var S=this.OF(u,d),C=this.xa(v),O=this.$e(C);this.Kp(b),this.Kp(O);var R=this.Gn(b),$=this.Gn(O);if(S==-1&&R==-1&&(O==b?(this.jn(O,this.Hl),R=$=this.Hl):($==-1&&(this.jn(O,this.Hl),$=this.Hl),this.jn(b,O),R=O)),S!=-1){var N=this.$e(S);$==-1&&(0>=this.Kp(N)?($=this.Gn(N),this.jn(O,$)):(this.jn(O,N),$=N),O==b&&(R=$))}R==-1&&this.hY(b,O),g==0?this.jW(u,d,v,S,b,O):g==5?this.kW(u,d,v,C,b,O):g==4&&this.iW(v,S,b,O)}},a.prototype.jW=function(u,d,g,v,b,S){var C=this.hk(b);if(v!=-1){var O=this.hk(S),R=this.hk(this.$e(v));v=C&O&R,R^=R&this.dh(g),(R|=v)!=0&&(this.Vg(S,O|R),this.Vg(b,R|C),C=C||R)}for(d=u.lb(d);d!=-1&&(v=u.ja(d),g=this.$e(this.xa(v)),b=this.hk(g),S=this.dh(v),O=this.$e(v),v=b&(R=this.hk(O))&C,C^=C&S,(C|=v)!=0);d=u.lb(d))this.Vg(g,b|C),this.Vg(O,R|C)},a.prototype.kW=function(u,d,g,v,b,S){if(b!=S){g=this.Ab(g,this.cg),g+=this.Ab(v,this.cg),v=0;var C=new m.ia(0),O=new m.ia(0);O.add(0);for(var R=u.rc(-1);R!=d;R=u.lb(R)){var $=u.ja(R),N=this.xa($),B=this.$e($),G=this.$e(N);if(B!=G){if($=this.Ab($,this.cg),v+=$+=this.Ab(N,this.cg),N=!1,C.size!=0&&C.Fc()==G&&(O.If(),C.If(),N=!0),this.Gn(G)==-1)throw m.i.Qa();N&&this.Gn(G)==B||(O.add(v),C.add(B))}}v+=g,C.size!=0&&C.Fc()==S&&(O.If(),C.If()),v!=0?O.Fc()==0&&(u=this.g.ld,u=this.La(u),this.Vg(b,u)):O.Fc()!=0&&(u=this.g.ld,u=this.La(u),this.Vg(b,u))}},a.prototype.iW=function(u,d,g,v){var b=this.La(this.g.ld);if(d==-1)this.Vg(v,this.Go),1&(u=this.Ab(u,this.xg))?this.Vg(g,b):this.Vg(g,this.Go);else{var S=this.hk(v);S==0?(S=this.hk(this.$e(d)),this.Vg(v,S),1&(u=this.Ab(u,this.xg))?this.Vg(g,S==b?this.Go:b):this.Vg(g,S)):1&(u=this.Ab(u,this.xg))?this.Vg(g,S==b?this.Go:b):this.Vg(g,S)}},a.prototype.gY=function(u,d,g,v){var b=v,S=-1,C=-1,O=0;do{if(O==2)return!1;var R=this.Ab(b,d);if(R!=-1){if(S!=-1)return!1;S=R}else{if(C!=-1)return!1;C=b}O++,b=this.jc(this.xa(b))}while(v!=b);return C!=-1&&S!=-1&&(this.Kb(u.ja(S),d,-2),u.Sj(S,C),g.add(S),!0)},a.prototype.hY=function(u,d){var g=this.Kp(u);if(g!=0){var v=this.Kp(d);0v||0>g&&0$.compare(b)?R=1:S=-1,this.Kb(B,this.ae,0),this.Kb(N,this.ae,0),this.Kb(N,this.cg,R),this.Kb(B,this.cg,S)):u==7?(this.Kb(B,this.ae,this.Go),this.Kb(N,this.ae,O==1736?C:0)):u==4&&(this.Kb(B,this.ae,0),this.Kb(N,this.ae,0),this.Kb(N,this.xg,1),this.Kb(B,this.xg,1)),O=O==1736?this.aO:0,this.$w(N,C|O),this.$w(B,C|O)}}}}},a.prototype.VT=function(u,d){var g=this.mm(d);if(g!=-1){var v=this.mm(u);this.jh.S(g,1,v),this.Gt(u,g),this.Gt(d,-1)}u=this.xa(u),d=this.xa(d),(g=this.mm(d))!=-1&&(v=this.mm(u),this.jh.S(g,1,v),this.Gt(u,g),this.Gt(d,-1))},a.prototype.IX=function(u){function d(ge,me){return v.HO(ge,me)}var g=new m.ia(0);g.Jb(10);for(var v=this,b=this.Re;b!=-1;b=this.Rf(b)){g.clear(!1);var S=this.Me(b);if(S!=-1){var C=S;do g.add(C),C=this.jc(this.xa(C));while(C!=S);if(1h.Db())return E.ki(E.Xe(h.Ia()),p,"&")}return g=new E,v=(d=new m.gd).Ib(E.Xe(p)),h=d.Ib(E.Xe(h)),g.Ft(d,a,u),u=g.Av(v,h),p=E.ki(d.Ne(u),p,"&"),m.aa.Hc(p.getType())&&(p.Ch(2,a),p.getType()==1736&&p.fm()),p},E.bW=function(p,h,a){if(p.B()||h.B())return p.Ia();var u=[null],d=[0],g=h.Db()==2;if(h.Db()!=1&&h.Db()!=2)throw m.i.Qa();return u[0]=p.D(),g?m.hd.sK(h,u,1,a,d):m.hd.tK(h,u,1,a,d),d[0]==0?p.Ia():p},E.prototype.LU=function(p,h,a,u,d){if(p.B())return p;var g=new m.gd;return p=g.Ib(p),this.Mk(g,p,h,a,u,d)},E.prototype.NU=function(p,h,a,u,d,g){if(d&&p.ic(h)!=550){var v=new m.RC;v.TX(p,a),v.Ng?(m.Tk.V(p,a,g,!0),d=!1):this.j.yy(a)}else m.Tk.V(p,a,g,!0),d=!1;if(u&&p.ic(h)!=550?this.j.wJ(p,h,g):this.j.vJ(p,h,g),this.j.pA)return this.j.Ug(),this.j=null,this.Mk(p,h,a,u,!1,g);if(this.j.yy(NaN),g=this.j.La(h),this.bq(g+1),this.Gj[g]=!0,p.ic(h)==1736||u&&p.ic(h)!=550)return p.Yo(h,0),h=this.Ot(h,-1,-1),(p=p.Ne(h)).Yo(0),d?p.Ch(1,0):(p.Ch(2,a),p.fm()),p;if(p.ic(h)==1607)return h=this.Pt(-1),p=p.Ne(h),d||p.Ch(2,a),p;if(p.ic(h)==550)return h=this.mr(),p=p.Ne(h),d||p.Ch(2,a),p;throw m.i.Qa()},E.prototype.Mk=function(p,h,a,u,d,g){this.j=new m.iu;try{return this.NU(p,h,a,u,d,g)}finally{this.j.Ug()}},E.Mk=function(p,h,a,u,d){return new E().LU(p,h,a,u,d)},E.prototype.MU=function(p,h,a,u){this.Mv=p,this.j=new m.iu,p=h.In(a);var d=h.ic(a);if(p!=1||d==550?this.j.vJ(h,a,u):this.j.wJ(h,a,u),!this.j.pA)if(this.j.yy(NaN),u=this.j.La(a),this.bq(u+1),this.Gj[u]=!0,h.ic(a)==1736||p==1&&h.ic(a)!=550)h.Yo(a,0),u=this.Ot(a,-1,-1),h.hC(u,a),h.BB(u);else if(h.ic(a)==1607)u=this.Pt(-1),h.hC(u,a),h.BB(u);else{if(h.ic(a)!=550)throw m.i.fa("internal error");u=this.mr(),h.hC(u,a),h.BB(u)}},E.prototype.im=function(p,h){var a=m.aa.tf(this.j.g.ic(p)),u=m.aa.tf(this.j.g.ic(h));if(a>u)return p;var d=this.j.La(p),g=this.j.La(h);if(this.bq(1+(d|g)),this.Gj[this.j.La(p)]=!0,a==2&&u==2)return this.Ot(p,h,-1);if(a==1&&u==2||a==1&&u==1)return this.Pt(-1);if(a==0)return this.mr();throw m.i.Qa()},E.prototype.Av=function(p,h){var a=m.aa.tf(this.j.g.ic(p)),u=m.aa.tf(this.j.g.ic(h)),d=this.j.La(p),g=this.j.La(h);if(this.bq(1+(d|g)),this.Gj[this.j.La(p)|this.j.La(h)]=!0,d=-1,1h.Db())return E.ki(E.Xe(p),p,"-");var d=new m.l;p.A(d);var g=new m.l;if(h.A(g),!d.isIntersecting(g))return E.ki(E.Xe(p),p,"-");var v=new m.l;return v.K(d),v.Zb(g),a=m.ta.Wd(a,v,!0),g=new E,v=(d=new m.gd).Ib(E.Xe(p)),h=d.Ib(E.Xe(h)),g.Ft(d,a,u),u=g.im(v,h),u=d.Ne(u),p=E.ki(u,p,"-"),m.aa.Hc(p.getType())&&(p.Ch(2,a),p.getType()==1736&&p.fm()),p},E.VP=function(p,h,a){if(2>p.length)throw m.i.N("not enough geometries to dissolve");for(var u=0,d=0,g=p.length;dC?E.Xe(p[O]):(p=u==2,h=m.ta.Wd(u==0?h:null,v,!0),new E().Mk(b,S,h,p,!0,a))},E.Pz=function(p,h,a,u){var d=[null,null,null],g=new m.l;p.A(g);var v=new m.l;h.A(v);var b=new m.l;if(b.K(g),b.Zb(v),a=m.ta.Wd(a,b,!0),(b=new m.l).K(v),v=m.ta.Er(a),b.W(v,v),!g.isIntersecting(b)){if(p.Db()<=h.Db())return d[(p=E.ki(E.Xe(p.Ia()),p,"&")).Db()]=p,d;if(p.Db()>h.Db())return d[(p=E.ki(E.Xe(h.Ia()),p,"&")).Db()]=p,d}for(v=new E,b=(g=new m.gd).Ib(E.Xe(p)),h=g.Ib(E.Xe(h)),v.Ft(g,a,u),u=v.Pz(b,h),h=0;hh.Db())return E.ki(E.Xe(p),p,"^");if(p.Db()a;a++)h[a]=new m.h;p.nB(h),this.fY(h,h),p.Zw(h,4)}},E.prototype.fY=function(p,h){for(var a=0;a(h=.5*h.Sk())?Math.sqrt(u):Math.sqrt(h))},E.prototype.RB=function(){this.bb=1,this.jb=this.Gb=this.eb=0,this.ab=1,this.Lb=0},E.prototype.isIdentity=function(p){if(p!==void 0){var h=m.h.construct(0,1);return this.Eh(h,h),h.sub(m.h.construct(0,1)),h.Sk()>p*p?!1:(h.ma(0,0),this.Eh(h,h),!(h.Sk()>p*p)&&(h.ma(1,0),this.Eh(h,h),h.sub(m.h.construct(1,0)),h.Sk()<=p*p))}return this.bb==1&&this.ab==1&&this.eb==0&&this.Gb==0&&this.jb==0&&this.Lb==0},E.prototype.Bi=function(p){return Math.abs(this.bb*this.ab-this.jb*this.eb)<=2*p*(Math.abs(this.bb*this.ab)+Math.abs(this.jb*this.eb))},E.prototype.gg=function(p,h){this.bb=1,this.eb=0,this.Gb=p,this.jb=0,this.ab=1,this.Lb=h},E.prototype.setScale=function(p,h){h!==void 0?(this.bb=p,this.jb=this.Gb=this.eb=0,this.ab=h,this.Lb=0):this.setScale(p,p)},E.prototype.$B=function(){this.bb=0,this.eb=1,this.Gb=0,this.jb=1,this.Lb=this.ab=0},E.prototype.setRotate=function(p){this.pX(Math.cos(p),Math.sin(p))},E.prototype.pX=function(p,h){this.bb=p,this.eb=-h,this.Gb=0,this.jb=h,this.ab=p,this.Lb=0},E.prototype.shift=function(p,h){this.Gb+=p,this.Lb+=h},E.prototype.scale=function(p,h){this.bb*=p,this.eb*=p,this.Gb*=p,this.jb*=h,this.ab*=h,this.Lb*=h},E.prototype.flipX=function(p,h){this.bb=-this.bb,this.eb=-this.eb,this.Gb=p+h-this.Gb},E.prototype.flipY=function(p,h){this.jb=-this.jb,this.ab=-this.ab,this.Lb=p+h-this.Lb},E.prototype.rotate=function(p){var h=new E;h.setRotate(p),this.multiply(h)},E.prototype.inverse=function(p){if(p!==void 0){var h=this.bb*this.ab-this.eb*this.jb;h==0?p.lx():(h=1/h,p.Gb=(this.eb*this.Lb-this.Gb*this.ab)*h,p.Lb=(this.Gb*this.jb-this.bb*this.Lb)*h,p.bb=this.ab*h,p.eb=-this.eb*h,p.jb=-this.jb*h,p.ab=this.bb*h)}else this.inverse(this)},E}();m.Dd=D}(ie||(ie={})),function(m){var D=function(){function E(){}return E.prototype.lx=function(){this.hg=this.Lb=this.Gb=this.He=this.Fe=this.Ee=this.Ge=this.ab=this.eb=this.Ze=this.jb=this.bb=0},E.prototype.setScale=function(p,h,a){this.bb=p,this.eb=this.Ze=this.jb=0,this.ab=h,this.Fe=this.Ee=this.Ge=0,this.He=a,this.hg=this.Lb=this.Gb=0},E.prototype.setTranslate=function(p,h,a){this.bb=1,this.eb=this.Ze=this.jb=0,this.ab=1,this.Fe=this.Ee=this.Ge=0,this.He=1,this.Gb=p,this.Lb=h,this.hg=a},E.prototype.translate=function(p,h,a){this.Gb+=p,this.Lb+=h,this.hg+=a},E.prototype.mC=function(p){if(!p.B()){for(var h=new m.Nd[8],a=0;8>a;a++)h[a]=new m.Nd;p.nB(h),this.transform(h,8,h),p.Zw(h)}},E.prototype.transform=function(p,h,a){for(var u=0;uu;u++)a.uh[u]=-1;a.uh[a.bg[0]]=0}return a.jq=!0,a}return Ke(h,p),h.prototype.re=function(a){this.hasAttribute(a)||(this.uh[a]=0,this.jD())},h.prototype.removeAttribute=function(a){if(a==0)throw m.i.N("Position attribue cannot be removed");this.hasAttribute(a)&&(this.uh[a]=-1,this.jD())},h.prototype.reset=function(){this.bg[0]=0,this.Aa=1;for(var a=0;aa;a++)0<=this.uh[a]&&(this.bg[u]=a,this.uh[a]=u,u++,this.Aa++);this.jq=!0},h.prototype.cc=function(){return this.jq&&(this.wl=this.An(),this.jq=!1),this.wl},h.prototype.Nb=function(a){if(a==null)return!1;if(a==this)return!0;if(!(a instanceof h)||a.Aa!=this.Aa)return!1;for(var u=0;ug;g++)!a.hasAttribute(g)&&u.hasAttribute(g)&&(d==null&&(d=new h(a)),d.re(g));return d!=null?d.EF():a},h}(m.ra);m.ee=D;var E=function(){function p(){this.map=[];var h=new D;this.add(h),(h=new D).re(1),this.add(h)}return p.kz=function(){return p.bL},p.prototype.$R=function(){return p.ft},p.prototype.add=function(h){var a=h.cc();if(p.ft!=null&&p.ft.cc()==a&&h.GG(p.ft))return p.ft;if(p.Dw!=null&&p.Dw.cc()==a&&h.GG(p.Dw))return p.Dw;var u=null;return this.map[a]!==void 0&&(u=this.map[a]),u==null&&((u=h.tM()).Aa==1?p.ft=u:u.Aa==2&&u.kd(1)==1?p.Dw=u:this.map[a]=u),u},p.bL=new p,p}()}(ie||(ie={}));var mi={feet:9002,kilometers:9036,meters:9001,miles:9093,"nautical-miles":9030,yards:9096},Lr={acres:109402,ares:109463,hectares:109401,"square-feet":109405,"square-kilometers":109414,"square-meters":109404,"square-miles":109439,"square-yards":109442},Dr=new(function(){function m(){this.RM=50,this.np=new Map,this.gj=[]}return m.prototype.clear=function(){this.gj.length=0,this.np.clear()},m.prototype.delete=function(D){return!!this.np.delete(D)&&(this.gj.splice(this.gj.indexOf(D),1),!0)},m.prototype.get=function(D){var E=this.np.get(D);if(E!==void 0)return this.gj[0]!==D&&(this.gj.splice(this.gj.indexOf(D),1),this.gj.unshift(D)),E},m.prototype.has=function(D){return this.np.has(D)},m.prototype.set=function(D,E){return this.get(D)!==void 0&&this.delete(D),this.gj.unshift(D),this.np.set(D,E),this.oM(),this},m.prototype.oM=function(){for(;this.gj.length&&this.gj.length>this.RM;){var D=this.gj.pop();this.np.delete(D)}},m}()),Ze=((Tt={}).convertJSONToGeometry=function(m){return ie.$b.fP(m)},Tt.hasM=function(m){return m.hasAttribute(ie.Ih.M)},Tt.hasZ=function(m){return m.hasAttribute(ie.Ih.Z)},Tt.getPointX=function(m){return m.Lg()},Tt.getPointY=function(m){return m.ih()},Tt.getPointZ=function(m){return m.bS()},Tt.getPointM=function(m){return m.zR()},Tt.getXMin=function(m){return m.es()},Tt.getYMin=function(m){return m.gs()},Tt.getXMax=function(m){return m.ds()},Tt.getYMax=function(m){return m.fs()},Tt.getZExtent=function(m){return m.Tg(ie.Ih.Z,0)},Tt.getMExtent=function(m){return m.Tg(ie.Ih.M,0)},Tt.exportPaths=function(m){var D=[],E=m.da(),p=null,h=null,a=m.hasAttribute(ie.Ih.Z),u=m.hasAttribute(ie.Ih.M);a&&(p=m.ub(ie.Ih.Z)),u&&(h=m.ub(ie.Ih.M));for(var d=new ie.h,g=0;gnew UG({placeholder:"Search address",getSuggestions:async t=>{const e=t.suggestTerm,i=`${bxe}?address=${encodeURIComponent(e)}`;return(await bi(i,{responseType:"json"})).data.addresses.map(n=>({text:n.pikkaadress,magicKey:n.unik}))},getResults:async t=>{const e=t.suggestResult.text,i=`${bxe}?address=${encodeURIComponent(e)}`;return(await bi(i,{responseType:"json"})).data.addresses.map(s=>{const o=new Ml({geometry:new mt({x:s.viitepunkt_l,y:s.viitepunkt_b})});return{extent:HVe(o.geometry,30,"meters").extent,feature:o,name:`${s.pikkaadress}`}})}}),ABt=(t,e)=>new RVt({view:t,sources:[e],includeDefaultSources:!1,container:"in-ads-container"});function SX(t){switch(t){case Xn.SUPPORTED:break;case Xn.GRAPHICS_LAYER_MISSING:return"not owned by a graphics layer";case Xn.GEOMETRY_MISSING:return"no geometry";case Xn.GEOMETRY_TYPE_UNSUPPORTED:return"the geometry type is not supported";case Xn.ELEVATION_MODE_UNSUPPORTED:return"the elevation mode is not supported";case Xn.SYMBOL_TYPE_UNSUPPORTED:return"the symbol type is not supported"}return""}var Xn;(function(t){t[t.SUPPORTED=0]="SUPPORTED",t[t.GRAPHICS_LAYER_MISSING=1]="GRAPHICS_LAYER_MISSING",t[t.GEOMETRY_MISSING=2]="GEOMETRY_MISSING",t[t.GEOMETRY_TYPE_UNSUPPORTED=3]="GEOMETRY_TYPE_UNSUPPORTED",t[t.ELEVATION_MODE_UNSUPPORTED=4]="ELEVATION_MODE_UNSUPPORTED",t[t.SYMBOL_TYPE_UNSUPPORTED=5]="SYMBOL_TYPE_UNSUPPORTED"})(Xn||(Xn={}));function MBt(t){var e;if(((e=t.layer)==null?void 0:e.type)!=="graphics")return Xn.GRAPHICS_LAYER_MISSING;if(t.geometry==null)return Xn.GEOMETRY_MISSING;switch(t.geometry.type){case"polygon":case"point":case"polyline":case"mesh":break;default:return Xn.GEOMETRY_TYPE_UNSUPPORTED}return tj(t)!=="on-the-ground"&&ij(t)?Xn.ELEVATION_MODE_UNSUPPORTED:Xn.SUPPORTED}function qVe(t){if(!t)return null;if(uB(t)&&t.wkid){const i=Cot[t.wkid];if(i)return i}const e=t.wkt2||t.wkt;if(e){const i=OBt(e);if(i)return i}return null}function OBt(t){const e=Tot.exec(t);if(!e||e.length!==2)return null;const i=e[1].split(",");if(!i||i.length<3)return null;const r=parseFloat(i[1]),n=parseFloat(i[2]);return isNaN(r)||isNaN(n)?null:{a:r,f:n===0?0:1/n}}function VG(t){const e=qVe(t??at.WGS84);if(PBt(e))return e;const i=e.a*(1-e.f);return Object.assign(e,{b:i,eSq:1-(i/e.a)**2,radius:(2*e.a+i)/3,densificationRatio:1e4/((2*e.a+i)/3)})}function PBt(t){return t!=null&&"b"in t&&"eSq"in t&&"radius"in t}function Y8(t,e,i){const{a:r,eSq:n}=VG(i),s=Math.sqrt(n),o=Math.sin(e[1]*kh),l=r*e[0]*kh;let c;return n>0?c=r*((1-n)*(o/(1-n*(o*o))-1/(2*s)*Math.log((1-s*o)/(1+s*o))))*.5:c=r*o,t[0]=l,t[1]=c,t}function BG(t){return qVe(t)!==null}function igi(t,e="square-meters"){if(t.some(o=>!BG(o.spatialReference)))throw new se("geodesic-areas:invalid-spatial-reference","the input geometries spatial reference is not supported");const i=[];for(let o=0;o!BG(r.spatialReference)))throw new se("geodesic-lengths:invalid-spatial-reference","the input geometries spatial reference is not supported");const i=[];for(let r=0;r1){for(let z=1;z<=F-1;z++)$O(s,M,I,z*e,i),c.push(s.slice(0));$O(s,M,I,(L+Math.floor(F-1)*e)/2,i),c.push(s.slice(0))}$O(s,M,I,L,i),c.push(s.slice(0)),x=s[0],T=s[1]}}return t.type==="polyline"?new xc({paths:n,spatialReference:i}):new Qa({rings:n,spatialReference:i})}let WVe=class{constructor(e=0,i=void 0,r=void 0){this.distance=e,this.azimuth=i,this.reverseAzimuth=r}};function $O(t,e,i,r,n){const s=e[0],o=e[1],l=s*kh,c=o*kh,f=(i??0)*kh,{a:_,b:x,f:T}=VG(n),A=Math.sin(f),M=Math.cos(f),I=(1-T)*Math.tan(c),L=1/Math.sqrt(1+I*I),F=I*L,z=Math.atan2(I,M),k=L*A,U=k*k,j=1-U,H=j*(_*_-x*x)/(x*x),Y=1+H/16384*(4096+H*(H*(320-175*H)-768)),Q=H/1024*(256+H*(H*(74-47*H)-128));let ne,re,he,ce,be=r/(x*Y),ye=2*Math.PI;for(;Math.abs(be-ye)>1e-12;)he=Math.cos(2*z+be),ne=Math.sin(be),re=Math.cos(be),ce=Q*ne*(he+Q/4*(re*(2*he*he-1)-Q/6*he*(4*ne*ne-3)*(4*he*he-3))),ye=be,be=r/(x*Y)+ce;const pe=F*ne-L*re*M,Ee=Math.atan2(F*re+L*ne*M,(1-T)*Math.sqrt(U+pe*pe)),te=Math.atan2(ne*A,L*re-F*ne*M),le=T/16*j*(4+T*(4-3*j)),de=Ee/kh,ve=(l+(te-(1-le)*T*k*(be+le*ne*(he+le*re*(2*he*he-1)))))/kh;return t[0]=ve,t[1]=de,t}function _ue(t,e,i,r){const n=e[0]*kh,s=e[1]*kh,o=i[0]*kh,l=i[1]*kh,{a:c,b:f,f:_,radius:x}=VG(r),T=o-n,A=Math.atan((1-_)*Math.tan(s)),M=Math.atan((1-_)*Math.tan(l)),I=Math.sin(A),L=Math.cos(A),F=Math.sin(M),z=Math.cos(M);let k,U,j,H,Y,Q,ne,re,he,ce,be=1e3,ye=T;do{if(ne=Math.sin(ye),re=Math.cos(ye),j=Math.sqrt(z*ne*(z*ne)+(L*F-I*z*re)*(L*F-I*z*re)),j===0)return t.distance=0,t.azimuth=void 0,t.reverseAzimuth=void 0,t;Y=I*F+L*z*re,Q=Math.atan2(j,Y),he=L*z*ne/j,U=1-he*he,H=Y-2*I*F/U,isNaN(H)&&(H=0),ce=_/16*U*(4+_*(4-3*U)),k=ye,ye=T+(1-ce)*_*he*(Q+ce*j*(H+ce*Y*(2*H*H-1)))}while(Math.abs(ye-k)>1e-12&&--be>0);if(be===0){const ve=x,Se=Math.acos(Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos(o-n))*ve,Ae=o-n,Pe=Math.sin(Ae)*Math.cos(l),Ge=Math.cos(s)*Math.sin(l)-Math.sin(s)*Math.cos(l)*Math.cos(Ae),ut=Math.atan2(Pe,Ge);return t.azimuth=ut/kh,t.distance=Se,t.reverseAzimuth=void 0,t}const pe=U*(c*c-f*f)/(f*f),Ee=pe/1024*(256+pe*(pe*(74-47*pe)-128)),te=f*(1+pe/16384*(4096+pe*(pe*(320-175*pe)-768)))*(Q-Ee*j*(H+Ee/4*(Y*(2*H*H-1)-Ee/6*H*(4*j*j-3)*(4*H*H-3)))),le=Math.atan2(z*Math.sin(ye),L*F-I*z*Math.cos(ye)),de=Math.atan2(L*Math.sin(ye),L*F*Math.cos(ye)-I*z);return t.azimuth=le/kh,t.distance=te,t.reverseAzimuth=de/kh,t}var Mre;let bw=Mre=class extends Qa{constructor(...t){super(...t),this.center=null,this.geodesic=!1,this.numberOfPoints=60,this.radius=1e3,this.radiusUnit="meters"}normalizeCtorArgs(t,e){let i;if(t!=null&&t.center)i=t;else{if(t!=null&&t.rings)return super.normalizeCtorArgs(t,e);i={center:t}}return{...super.normalizeCtorArgs(),...i,...e}}initialize(){const t=this.center,e=this.numberOfPoints;if(this.hasZ=(t==null?void 0:t.hasZ)??!1,this.rings.length!==0||!t)return;const i=Ur(this.radius,this.radiusUnit,"meters"),r=t.spatialReference;let n,s="geographic";if(r.isWebMercator?s="webMercator":((r.wkid&&ae[r.wkid])!=null||(r.wkt2||r.wkt)&&Kne(r.wkt2||r.wkt))&&(s="projected"),this.geodesic){let o;switch(s){case"webMercator":o=HS(t);break;case"projected":console.error("Creating a geodesic circle requires the center to be specified in web mercator or geographic coordinate system");break;case"geographic":o=t}n=this._createGeodesicCircle(o,i,e),s==="webMercator"&&(n=Ty(n))}else{let o;s==="webMercator"||s==="projected"?o=i/jCe(t.spatialReference):s==="geographic"&&(o=UCe(i,"meters",Sr(t.spatialReference).radius)),n=this._createPlanarCircle(t,o,e)}this.spatialReference=n.spatialReference,this.addRing(n.rings[0])}clone(){const{center:t,numberOfPoints:e,radius:i,radiusUnit:r,geodesic:n}=this;return new Mre({center:t==null?void 0:t.clone(),numberOfPoints:e,radius:i,radiusUnit:r,geodesic:n})}_createGeodesicCircle(t,e,i){let r=0;const n=[];for(;r<360;){const s=[0,0],o=[t.x,t.y];$O(s,o,r,e),this.hasZ&&s.push(t.z),n.push(s),r+=360/i}return n.push(n[0]),new Qa(n)}_createPlanarCircle(t,e,i){const r=[],n=2*Math.PI/i;for(let s=0;sr.type==="object")?Xn.SYMBOL_TYPE_UNSUPPORTED:tj(t)!=="on-the-ground"&&ij(t)?Xn.ELEVATION_MODE_UNSUPPORTED:Xn.SUPPORTED}function wxe(t,e,i){if(!e||!(t!=null&&t.map))return;const{map:r}=t,n=r.layers.find(s=>s===e);n||r.add(e,i),n&&i!=null&&r.layers.reorder(n,i)}function sgi(t,e){const i=(e==null?void 0:e.type)==="subtype-sublayer"?e.parent:e;return t.allLayerViews.find(r=>{const n=r.layer;return n===i||"sublayers"in n&&n.sublayers!=null&&n.sublayers.includes(i)})}const Oa={redo:"r",undo:"z",center:"Alt",constraint:"Shift",cancel:"Escape",delete:["Backspace","Delete"],complete:"Enter",vertexAdd:"f",pan:" "},xxe={toggle:"Control"},ogi={enterInputMode:"Tab",commit:"Enter",discard:"Escape",next:"Tab"};let Lk=class extends ze{constructor(e){super(e),this.enabled=!1}};y([w({type:Boolean,nonNullable:!0})],Lk.prototype,"enabled",void 0),Lk=y([Z("esri.views.interactive.sketch.SketchLabelOptions")],Lk);const XVe=Lk;let Z$=class extends ze{constructor(e){super(e),this.mode="absolute-height"}toJSON(){return{mode:this.mode}}};y([w({type:String,nonNullable:!0})],Z$.prototype,"mode",void 0),Z$=y([Z("esri.widgets.Sketch.SketchTooltipOptions.ElevationOptions")],Z$);let Oh=class extends ze{constructor(e){super(e),this.area=!0,this.distance=!0,this.elevation=!0,this.helpMessage=!1,this.orientation=!0,this.radius=!0,this.rotation=!0,this.scale=!0,this.size=!0,this.totalLength=!0}toJSON(){return{area:this.area,distance:this.distance,elevation:this.elevation,helpMessage:this.helpMessage,orientation:this.orientation,radius:this.radius,rotation:this.rotation,scale:this.scale,size:this.size,totalLength:this.totalLength}}};y([w({type:Boolean,nonNullable:!0})],Oh.prototype,"area",void 0),y([w({type:Boolean,nonNullable:!0})],Oh.prototype,"distance",void 0),y([w({type:Boolean,nonNullable:!0})],Oh.prototype,"elevation",void 0),y([w({type:Boolean,nonNullable:!0})],Oh.prototype,"helpMessage",void 0),y([w({type:Boolean,nonNullable:!0})],Oh.prototype,"orientation",void 0),y([w({type:Boolean,nonNullable:!0})],Oh.prototype,"radius",void 0),y([w({type:Boolean,nonNullable:!0})],Oh.prototype,"rotation",void 0),y([w({type:Boolean,nonNullable:!0})],Oh.prototype,"scale",void 0),y([w({type:Boolean,nonNullable:!0})],Oh.prototype,"size",void 0),y([w({type:Boolean,nonNullable:!0})],Oh.prototype,"totalLength",void 0),Oh=y([Z("esri.widgets.Sketch.SketchTooltipOptions.VisibleElements")],Oh);let ww=class extends ze{constructor(e){super(e),this.enabled=!1,this.inputEnabled=!1,this.elevation=new Z$,this.visibleElements=new Oh,this.visualVariables=null}toJSON(){return{enabled:this.enabled,elevation:this.elevation,visibleElements:this.visibleElements}}};y([w({type:Boolean,nonNullable:!0})],ww.prototype,"enabled",void 0),y([w({type:Boolean,nonNullable:!0})],ww.prototype,"inputEnabled",void 0),y([w({type:Z$,nonNullable:!0})],ww.prototype,"elevation",void 0),y([w({type:Oh,nonNullable:!0})],ww.prototype,"visibleElements",void 0),y([w()],ww.prototype,"visualVariables",void 0),ww=y([Z("esri.widgets.Sketch.SketchTooltipOptions")],ww);const ZVe=ww;function hgi(t,e,i){return nt(t,e,i)}function dgi(t){return t}function Q2(t,e,i){return nt(t,e,i)}function z5(t){return Xr(t)}function so(t,e,{coordinateHelper:i,elevationInfo:r}){return t?DI(i.vectorToDehydratedPoint(t,DBt),e,r):null}function DI(t,e,i){if(t==null)return null;if(e==null)return nt(t.x,t.y,t.z??0);if(e.type==="2d")return nt(t.x,t.y,0);const r=bPe(e,t,i,ma)??0;return nt(t.x,t.y,r)}function pgi(t,e){return Xu(t[0],t[1],t[2],e)}const DBt=Xu(0,0,0,null);let wm=class extends Ue{constructor(){super(...arguments),this.enabled=!0}};y([w({type:Boolean})],wm.prototype,"enabled",void 0),wm=y([Z("esri.views.interactive.snapping.Settings.DefaultSnappingAlgorithm")],wm);let Js=class extends Ue{constructor(e){super(e),this.lineSnapper=new wm,this.parallelLineSnapper=new wm,this.rightAngleSnapper=new wm,this.rightAngleTriangleSnapper=new wm,this.shortLineThreshold=15,this.distance=5,this.pointThreshold=1e-6,this.intersectionParallelLineThreshold=1e-6,this.parallelLineThreshold=1e-6,this.verticalLineThreshold=.1,this.touchSensitivityMultiplier=1.5,this.pointOnLineThreshold=1e-6,this.orange=new qe([255,127,0]),this.orangeTransparent=new qe([255,127,0,.5]),this.lineHintWidthReference=3,this.lineHintWidthTarget=3,this.lineHintFadedExtensions=.3,this.parallelLineHintWidth=2,this.parallelLineHintLength=24,this.parallelLineHintOffset=1.5,this.rightAngleHintSize=24,this.rightAngleHintOutlineSize=1.5,this.satisfiesConstraintScreenThreshold=1}};y([w({type:wm,constructOnly:!0,nonNullable:!0,json:{write:!0}})],Js.prototype,"lineSnapper",void 0),y([w({type:wm,constructOnly:!0,nonNullable:!0,json:{write:!0}})],Js.prototype,"parallelLineSnapper",void 0),y([w({type:wm,constructOnly:!0,nonNullable:!0,json:{write:!0}})],Js.prototype,"rightAngleSnapper",void 0),y([w({type:wm,constructOnly:!0,nonNullable:!0,json:{write:!0}})],Js.prototype,"rightAngleTriangleSnapper",void 0),y([w({type:Number,nonNullable:!0,range:{min:-1,max:50,step:1},json:{write:!0}})],Js.prototype,"shortLineThreshold",void 0),y([w({type:Number,nonNullable:!0,range:{min:-1,max:50,step:1},json:{write:!0}})],Js.prototype,"distance",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1e-5},json:{write:!0}})],Js.prototype,"pointThreshold",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1e-5},json:{write:!0}})],Js.prototype,"intersectionParallelLineThreshold",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1e-5},json:{write:!0}})],Js.prototype,"parallelLineThreshold",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],Js.prototype,"verticalLineThreshold",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:10},json:{write:!0}})],Js.prototype,"touchSensitivityMultiplier",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1e-5},json:{write:!0}})],Js.prototype,"pointOnLineThreshold",void 0),y([w({type:qe,nonNullable:!0})],Js.prototype,"orange",void 0),y([w({type:qe,nonNullable:!0})],Js.prototype,"orangeTransparent",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:10},json:{write:!0}})],Js.prototype,"lineHintWidthReference",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:10},json:{write:!0}})],Js.prototype,"lineHintWidthTarget",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],Js.prototype,"lineHintFadedExtensions",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:10},json:{write:!0}})],Js.prototype,"parallelLineHintWidth",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:50},json:{write:!0}})],Js.prototype,"parallelLineHintLength",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:5},json:{write:!0}})],Js.prototype,"parallelLineHintOffset",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:46},json:{write:!0}})],Js.prototype,"rightAngleHintSize",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:6},json:{write:!0}})],Js.prototype,"rightAngleHintOutlineSize",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:5},json:{write:!0}})],Js.prototype,"satisfiesConstraintScreenThreshold",void 0),Js=y([Z("esri.views.interactive.snapping.Settings.Defaults")],Js);const a_=new Js;var Wl;(function(t){t[t.FEATURE=1]="FEATURE",t[t.SELF=2]="SELF",t[t.ALL=3]="ALL"})(Wl||(Wl={}));function TX(t,e){return t[0]*e[1]-t[1]*e[0]}function NBt(t,e,i){const r=fs(i,e)/Yy(i);return Gu(t,i,r)}function EX(t,e,i,r,n=i){return Ps(TT,r,i),Ps(IV,e,n),NBt(U5,IV,TT),df(t,n,U5)}function FBt(t,e,i,r){Ps(TT,e,i);const n=r/j9(TT);return If(t,i,TT,n)}function ggi(t,e){const i=t.start,r=t.end,n=e.start,s=e.end,o=Ps(TT,r,i),l=Ps(JVe,s,n),c=TX(o,l);if(Math.abs(c)<=zBt)return[];const f=Ps(IV,i,n),_=TX(l,f)/c,x=TX(o,f)/c;if(_>=0){if(x>=0||e.type===lo.LINE)return[If(U5,i,o,_)]}else if(t.type===lo.LINE&&(x>=0||e.type===lo.LINE))return[If(U5,i,o,_)];return[]}function kBt(t,e,i){const r=[],n=Ps(TT,t.end,t.start),s=Ps(JVe,t.start,e),o=Yy(n),l=2*fs(n,s),c=l*l-4*o*(Yy(s)-i*i);if(c===0){const f=-l/(2*o);(t.type===lo.LINE||f>=0)&&r.push(If(U5,t.start,n,f))}else if(c>0){const f=Math.sqrt(c),_=(-l+f)/(2*o);(t.type===lo.LINE||_>=0)&&r.push(If(U5,t.start,n,_));const x=(-l-f)/(2*o);(t.type===lo.LINE||x>=0)&&r.push(If(IV,t.start,n,x))}return r}var lo;(function(t){t[t.RAY=0]="RAY",t[t.LINE=1]="LINE"})(lo||(lo={}));const zBt=1e-6,TT=yt(),JVe=yt(),IV=yt(),U5=yt();function bue({start:t,end:e,type:i},r,n){const s=[],o=Ps(PE,e,t),l=Ps(AP,t,r),c=Yy(o),f=2*fs(o,l),_=f*f-4*c*(Yy(l)-n*n);if(_===0){const x=-f/(2*c);(i===bp.PLANE||x>=0)&&s.push(If(yt(),t,o,x))}else if(_>0){const x=Math.sqrt(_),T=(-f+x)/(2*c);(i===bp.PLANE||T>=0)&&s.push(If(yt(),t,o,T));const A=(-f-x)/(2*c);(i===bp.PLANE||A>=0)&&s.push(If(yt(),t,o,A))}return s}function KVe(t,e){const i=t.start,r=t.end,n=Ps(PE,r,i),s=Ie(AP,-n[1],n[0],0),o=e.start,l=e.end,c=xn(Sue,l,o),f=Ve(c,s),_=Ie(aBe,i[0],i[1],0),x=xn(lBe,_,o),T=Ve(x,s);if(Math.abs(f){const t=W(),e=W(),i=W();return({start:r,end:n},{center:s,radius:o,normal:l,slicePlane:c})=>{const f=W(),_=z_(s,l,HBt);if(Eo(EQ(_,r),0)&&Eo(EQ(_,n),0)){lRe(l,t,e);const x=(M,I)=>(je(i,I,s),or(M,Ve(i,t),Ve(i,e)),M),T=kBt({start:x(oBe,r),end:x(GBt,n),type:lo.LINE},Wy,o),A=[];for(const[M,I]of T){const L=Ne(W(),s);ao(L,L,t,M),ao(L,L,e,I),c&&!S2(c,L)||A.push(L)}return A}return uRe(_,r,n,f)?!Eo(Sn(f,s),o)||c&&!S2(c,f)?[]:[f]:[]}})();function rBe({start:t,end:e,type:i},r,n){const s=[],o=je(PE,e,t),l=Ps(AP,t,r),c=Yy(o),f=2*fs(o,l),_=f*f-4*c*(Yy(l)-n*n);if(_===0){const x=-f/(2*c);(i===lo.LINE||x>=0)&&s.push(ao(W(),t,o,x))}else if(_>0){const x=Math.sqrt(_),T=(-f+x)/(2*c);(i===lo.LINE||T>=0)&&s.push(ao(W(),t,o,T));const A=(-f-x)/(2*c);(i===lo.LINE||A>=0)&&s.push(ao(W(),t,o,A))}return s}function nBe(t,e){const i=t.start,r=t.end,n=e.start,s=e.end,o=xn(PE,r,i),l=xn(AP,s,n),c=xn(Sue,n,i),f=Wt(aBe,o,l),_=Ve(c,f);if(!Ey(_,0,by))return[];const x=HO(f);if(Ey(x,0,by))return[];const T=Wt(lBe,c,l),A=Ve(T,f)/x,M=ao(cBe,i,o,A);if(t.type===lo.RAY){const I=xn(LV,M,i);if(Ve(o,I)<-by)return[]}if(e.type===lo.RAY){const I=xn(LV,M,n);if(Ve(l,I)<-by)return[]}return[Xr(M)]}function VBt({start:t,end:e,type:i},r){const n=xn(PE,r,t),s=xn(AP,e,t),o=Wt(Sue,s,n);if(HO(o)/HO(s)e+r)return[];if(xS2(t,i))}function S2(t,e){return zoe(t,e)}var bp;(function(t){t[t.PLANE=0]="PLANE",t[t.HALF_PLANE=1]="HALF_PLANE"})(bp||(bp={}));const jBt={[bp.PLANE]:lo.LINE,[bp.HALF_PLANE]:lo.RAY},by=1e-6,oBe=yt(),GBt=yt(),PE=W(),AP=W(),Sue=W(),aBe=W(),lBe=W(),cBe=W(),LV=W(),HBt=Fi(),Tue={start:W(),end:W(),type:lo.LINE},qBt={start:W(),end:W(),type:lo.LINE};class f1{intersect(e){return hv(this,e)}closestPoints(e){return[this.closestTo(e)]}}class MP extends f1{constructor(e){super(),this.point=e}equals(e){return this===e||Jg(e)&&jr(this.point,e.point)}closestTo(){return z5(this.point)}}class Eue extends f1{constructor(e,i,r){super(),this.start=e,this.end=i,this.lineLike={start:e,end:i,type:r}}equals(e){return this===e||Kg(e)&&this.lineLike.type===e.lineLike.type&&jr(this.start,e.start)&&jr(this.end,e.end)}closestTo(e){const i=wue(e,this.lineLike);return i}}let Cue=class extends Eue{constructor(e,i){super(e,i,lo.LINE)}},WBt=class extends Eue{constructor(e,i){super(e,i,lo.RAY)}};class uBe extends f1{constructor(e){super(),this.constraints=e}equals(e){return this===e||Ore(e)&&Fy(this.constraints,e.constraints,(i,r)=>i.equals(r))}closestTo(e){let i,r=1/0;for(const n of this.constraints){const s=n.closestTo(e),o=Co(e,s);oi===this?[]:i.closestPoints(e))}}class hBe extends f1{constructor(e,i){super(),this.center=e,this.radius=i}equals(e){return this===e||ey(e)&&this.center[0]===e.center[0]&&this.center[1]===e.center[1]&&this.radius===e.radius}closestTo(e){const i=tBe(e,this.center,this.radius);return i}}let Aue=class extends f1{constructor(e,i){super(),this.center=e,this.radius=i}equals(e){return this===e||pv(e)&&jr(this.center,e.center)&&this.radius===e.radius}closestTo(e){const i=tBe(e,this.center,this.radius);return i[2]=this.center[2],i}asCircle(){return new Mue(z5(this.center),this.radius,Q2(0,0,1))}};class Mue extends f1{constructor(e,i,r,n=void 0){super(),this.center=e,this.radius=i,this.normal=r,this.slicePlane=n}equals(e){return this===e||xw(e)&&jr(this.center,e.center)&&jr(this.normal,e.normal)&&this.radius===e.radius}closestTo(e){const{center:i,radius:r}=this;Uoe(this.getPlane(YBt),e,CX);const n=xn(CX,CX,i),s=El(n);if(Eo(s,0))return z5(e);const o=r/Math.sqrt(s),l=ao(W(),i,n,o),{slicePlane:c}=this;if(c&&!S2(c,l)){const f=Pue(c,this);return(f==null?void 0:f.closestTo(e))??z5(e)}return l}getPlane(e=Fi()){return z_(this.center,this.normal,e)}}const CX=W(),YBt=Fi();class XBt extends f1{constructor(e){super(),this.z=e}equals(e){return this===e||dv(e)&&this.z===e.z}closestTo(e){return nt(e[0],e[1],this.z)}getPlane(e=Fi()){return Ie(Sxe,0,0,this.z),z_(Sxe,fB,e)}}const Sxe=W();class Oue extends f1{constructor(e,i,r){super(),this.start=e,this.end=i,this.planeLike={start:e,end:i,type:r}}equals(e){return this===e||Qg(e)&&this.planeLike.type===e.planeLike.type&&jr(this.start,e.start)&&jr(this.end,e.end)}closestTo(e){return eBe(e,this.planeLike)}closestEndTo(e){const{start:i,end:r}=this;return Math.sign(fs(Ps(ZBt,r,i),Ps(JBt,e,i)))>0?r:i}getPlane(e=Fi()){const i=Ne(Txe,this.end);return i[2]+=1,jl(this.start,this.end,i,e)}getSlicePlane(e=Fi()){const{start:i,end:r,type:n}=this.planeLike;if(n===bp.PLANE)return;const s=Ie(Txe,i[0],i[1],0),o=Ie(Exe,r[0],r[1],0),l=je(Exe,o,s);return z_(s,l,e),e}}const ZBt=yt(),JBt=yt(),Txe=W(),Exe=W();class dBe extends Oue{constructor(e,i){super(e,i,bp.HALF_PLANE)}}class pBe extends Oue{constructor(e,i){super(e,i,bp.PLANE)}}class KBt extends f1{constructor(e,i){super(),this.sphere=Noe(e,i)}equals(e){return this===e||fv(e)&&eRe(this.sphere,e.sphere)}closestTo(e){const i=lj(this.sphere,e,W());return i}get center(){return this.sphere}get radius(){return this.sphere[3]}}class fBe extends f1{constructor(e,i,r){super(),this.start=e,this.end=i,this.getZ=r,this.planeLike={start:e,end:i,type:bp.PLANE}}equals(e){return this===e||DV(e)&&jr(this.start,e.start)&&jr(this.end,e.end)&&this.getZ===e.getZ}closestTo(e){return QBt(this,e)}addIfOnTheGround(e,i){for(const r of i){const n=this.getZ(r[0],r[1])??0;Eo(r[2],n)&&(r[2]=n,e.push(r))}}}function QBt(t,e){const i=eBe(e,t.planeLike);return i[2]=t.getZ(i[0],i[1])??gBe,i}function hv(t,e){if(Ore(t)){const i=[];for(const r of t.constraints){const n=r.intersect(e);n&&i.push(n)}return Rue(i)}if(Ore(e))return hv(e,t);if(DV(t))return Cxe(t,e);if(DV(e))return Cxe(e,t);if(Jg(t)){const{point:i}=t,r=e.closestTo(i);return M2(r,i)?t:void 0}if(Kg(t)){if(Jg(e))return hv(e,t);if(Kg(e))return xm(nBe(t.lineLike,e.lineLike));if(dv(e))return ejt(t,e);if(Qg(e))return xm(KVe(e.planeLike,t.lineLike));if(ey(e))return xm(rBe(t.lineLike,e.center,e.radius));if(xw(e))return xm(iBe(t.lineLike,e));if(pv(e))return tjt(t,e);if(fv(e))return ijt(t,e)}else if(dv(t)){if(Jg(e)||Kg(e))return hv(e,t);if(dv(e))return rjt(t,e);if(Qg(e))return njt(t,e);if(ey(e))return sjt(t,e);if(xw(e))return ajt(t,e);if(pv(e))return ojt(t,e);if(fv(e))return ljt(t,e)}else if(Qg(t)){if(Jg(e)||Kg(e)||dv(e))return hv(e,t);if(Qg(e))return AX(QVe(t.planeLike,e.planeLike));if(ey(e))return AX(bue(t.planeLike,e.center,e.radius));if(xw(e))return ujt(t,e);if(pv(e))return cjt(t,e);if(fv(e))return hjt(t,e)}else if(ey(t)){if(Jg(e)||Kg(e)||dv(e)||Qg(e))return hv(e,t);if(ey(e))return AX(xue(t.center,t.radius,e.center,e.radius));if(xw(e))return void 0;if(pv(e))return djt(t,e);if(fv(e))return void 0}else if(xw(t)){if(Jg(e)||Kg(e)||dv(e)||Qg(e)||ey(e))return hv(e,t);if(xw(e))return void 0;if(pv(e))return e.asCircle(),void 0;if(fv(e))return void 0}else if(pv(t)){if(Jg(e)||Kg(e)||dv(e)||Qg(e)||ey(e)||xw(e))return hv(e,t);if(pv(e))return pjt(e,t);if(fv(e))return void 0}else if(fv(t)){if(Jg(e)||Kg(e)||dv(e)||Qg(e)||ey(e)||pv(e))return hv(e,t);if(fv(e))return void 0}}const ejt=(()=>{const t=Fi();return(e,i)=>{const{start:r,end:n}=e;if(sBe(r,n)&&Eo(r[2],i.z))return e;const s=W();return uRe(i.getPlane(t),r,n,s)?new MP(s):void 0}})();function tjt({lineLike:t},{center:e,radius:i}){const r=e[2];return xm(rBe(t,e,i).filter(n=>Eo(n[2],r)))}function ijt({lineLike:t},{sphere:e}){return xm(iRe(e,t.start,t.end))}const Pue=(()=>{const t=Ko(),e=Fi(),i={start:W(),end:W(),type:lo.LINE};return(r,n,s)=>{const{normal:o,center:l,radius:c}=n,f=Ve(o,r),_=Eo(EQ(r,l),0);if(Eo(f,1))return _?n:void 0;if(n.getPlane(e),_&&Eo(f,0)&&Cfe(r)&&Cfe(e)){if(Eo(c,0))return!s||S2(s,l)?new MP(z5(l)):void 0;const T=Xr(l);T[2]+=c;const A=Xr(l);A[2]-=c;const M=[];return s&&!S2(s,T)||M.push(T),s&&!S2(s,A)||M.push(A),xm(M)}if(!Nut(r,e,t))return;Ne(i.start,t.origin),Be(i.end,t.origin,t.direction);const x=iBe(i,n);return xm(s?BBt(s,x):x)}})();function rjt(t,e){return Eo(t.z,e.z)?t:void 0}function njt({z:t},{planeLike:e}){const[i,r]=e.start,[n,s]=e.end,o=Q2(i,r,t),l=Q2(n,s,t);return e.type===bp.PLANE?new Cue(o,l):new WBt(o,l)}function sjt(t,e){const[i,r]=e.center;return new Aue(Q2(i,r,t.z),e.radius)}function ojt(t,e){return Eo(e.center[2],t.z)?e:void 0}const ajt=(()=>{const t=Fi();return(e,i)=>Pue(e.getPlane(t),i)})();function ljt(t,{center:e,radius:i}){const r=Math.abs(e[2]-t.z);if(r>i&&!Eo(r,i))return;const n=Q2(e[0],e[1],t.z),s=Math.sqrt(i**2-r**2);return Eo(s,0)?void 0:new Aue(n,s)}const cjt=(()=>{const t=Fi();return(e,{center:i,radius:r})=>{const n=bue(e.planeLike,i,r),s=i[2];e.getSlicePlane(t);const o=[];for(const[l,c]of n){const f=[l,c,s];S2(t,f)&&o.push(f)}return xm(o)}})(),ujt=(()=>{const t=Fi(),e=Fi();return(i,r)=>Pue(i.getPlane(t),r,i.getSlicePlane(e))})(),hjt=(()=>{const t=Fi();return(e,{center:i,radius:r})=>{const n=e.getPlane(t),s=fn(n,i),o=Math.abs(s);if(o>r&&!Eo(o,r))return;const l=Xr(n),c=ao(W(),i,l,s),f=Math.sqrt(r**2-s**2);return Eo(f,0)?new MP(Uoe(n,i,W())):new Mue(c,f,l,e.getSlicePlane())}})();function djt(t,e){const i=Jf(t.center,e.center);return Eo(i,0)&&Eo(t.radius,e.radius)?e:mBe(xue(t.center,t.radius,e.center,e.radius),e.center[2])}function pjt(t,e){if(!sBe(t.center,e.center))return;const i=Jf(t.center,e.center);return Eo(i,0)&&Eo(t.radius,e.radius)?t:mBe(xue(t.center,t.radius,e.center,e.radius),t.center[2])}function Cxe(t,e){const{planeLike:i,getZ:r}=t,n=[];if(Jg(e))t.addIfOnTheGround(n,UBt(i,e.point));else if(Kg(e))t.addIfOnTheGround(n,KVe(i,e.lineLike));else if(ey(e))for(const[s,o]of bue(i,e.center,e.radius)){const l=r(s,o);l!=null&&n.push(nt(s,o,l))}else if(Qg(e)||DV(e))for(const[s,o]of QVe(i,e.planeLike)){const l=r(s,o)??gBe;n.push(nt(s,o,l))}return xm(n)}function AX(t){return Rue(t.map(([e,i])=>{const r=Q2(e,i,0),n=Q2(e,i,1);return new Cue(r,n)}))}function xm(t){return Rue(t.map(e=>e?new MP(e):void 0))}function mBe(t,e){return xm(t.map(([i,r])=>[i,r,e]))}function Rue(t){if(t.length!==0)return t.length===1?t[0]??void 0:new uBe(t.filter(ys))}function Ore(t){return t instanceof uBe}function Jg(t){return t instanceof MP}function Kg(t){return t instanceof Eue}function dv(t){return t instanceof XBt}function Qg(t){return t instanceof Oue}function ey(t){return t instanceof hBe}function pv(t){return t instanceof Aue}function xw(t){return t instanceof Mue}function fv(t){return t instanceof KBt}function DV(t){return t instanceof fBe}const gBe=0;var Pre;const MX=new yn({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),OX=new yn({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let Gg=Pre=class extends Ue{constructor(t){super(t),this.where=null,this.geometry=null,this.spatialRelationship="intersects",this.distance=void 0,this.objectIds=null,this.units=null,this.timeExtent=null}createQuery(t={}){const{where:e,geometry:i,spatialRelationship:r,timeExtent:n,objectIds:s,units:o,distance:l}=this;return new F_({geometry:Re(i),objectIds:Re(s),spatialRelationship:r,timeExtent:Re(n),where:e,units:o,distance:l,...t})}clone(){const{where:t,geometry:e,spatialRelationship:i,timeExtent:r,objectIds:n,units:s,distance:o}=this;return new Pre({geometry:Re(e),objectIds:Re(n),spatialRelationship:i,timeExtent:Re(r),where:t,units:s,distance:o})}};y([w({type:String,json:{write:!0}})],Gg.prototype,"where",void 0),y([w({types:I9,json:{write:!0}})],Gg.prototype,"geometry",void 0),y([w({type:MX.apiValues,json:{name:"spatialRel",read:{reader:MX.read},write:{allowNull:!1,writer:MX.write,overridePolicy(){return{enabled:this.geometry!=null}}}}})],Gg.prototype,"spatialRelationship",void 0),y([w({type:Number,json:{write:{overridePolicy(t){return{enabled:t!=null&&this.geometry!=null}}}}})],Gg.prototype,"distance",void 0),y([w({type:[Number],json:{write:!0}})],Gg.prototype,"objectIds",void 0),y([w({type:OX.apiValues,json:{read:OX.read,write:{writer:OX.write,overridePolicy(t){return{enabled:t!=null&&this.geometry!=null}}}}})],Gg.prototype,"units",void 0),y([w({type:D_,json:{write:!0}})],Gg.prototype,"timeExtent",void 0),Gg=Pre=y([Z("esri.layers.support.FeatureFilter")],Gg);const Dk=Gg;function RE(t,e){const i=t.x-e.x,r=t.y-e.y;return i*i+r*r}function fjt(t,e){return Math.sqrt(RE(t,e))}function Iue(t,e){e.sort((i,r)=>Co(i.targetPoint,t)-Co(r.targetPoint,t))}var i0;function bgi({point:t,distance:e,returnEdge:i,vertexMode:r,coordinateHelper:{spatialReference:n},filter:s},o,l){return l=l!=null?l.clone():new F_({where:"1=1"}),s&&(l.geometry=s.geometry,l.distance=s.distance,l.spatialRelationship=s.spatialRelationship,l.where=PB(l.where,s.where),l.timeExtent=uot(l.timeExtent,s.timeExtent),l.objectIds=mjt(l.objectIds,s.objectIds)),{point:Xu(t[0],t[1],t[2],n.toJSON()),mode:o,distance:e,returnEdge:i,vertexMode:r,query:l.toJSON()}}function mjt(t,e){return t||e?e?t?Array.from(IGe(new Set(t),new Set(e))):e:t:null}function NV(t,e,i){return{left:so(t.leftVertex.pos,e,i),right:so(t.rightVertex.pos,e,i)}}function wgi(t){return t.createQuery()}function gjt(t,e=()=>{}){const i=_e(()=>({view:t.view,snappingOptions:t.snappingOptions}),({view:r,snappingOptions:n})=>{const s="snapping-toggle",o=Es.TOOL;if(t.removeHandles(s),r&&n!=null){const l=[r.on("key-down",c=>{c.key!==xxe.toggle||c.repeat||(n.enabledToggled=!0,e())},o),r.on("key-up",c=>{c.key===xxe.toggle&&(n.enabledToggled=!1,e())},o),r.on("pointer-move",c=>{const f=c.native.ctrlKey;n.enabledToggled!==f&&(n.enabledToggled=f,e())},o)];t.addHandles(l,s)}},kt);t.addHandles(i)}function yjt(t){var e;return t!=null&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.WebMap"&&"utilityNetworks"in t&&!!((e=t==null?void 0:t.utilityNetworks)!=null&&e.length)}(function(t){t[t.TARGET=0]="TARGET",t[t.REFERENCE=1]="REFERENCE",t[t.REFERENCE_EXTENSION=2]="REFERENCE_EXTENSION"})(i0||(i0={}));let tf=class extends ze{get layerView(){var e,i;return(i=(e=this.view)==null?void 0:e.allLayerViews)==null?void 0:i.find(r=>r.layer===this.layer)}get valid(){return this._valid}get subtypeFilter(){var n,s;const{layer:e}=this;if(!znt(e)||!((n=e.subtypes)!=null&&n.length))return{mode:"not-in-use",filter:null};const i=((s=e.fieldsIndex.get(e.subtypeField))==null?void 0:s.name)??e.subtypeField,r=e.sublayers.filter(o=>o.visible).map(o=>o.subtypeCode);return r.length?r.length===e.subtypes.length?{mode:"all-visible",filter:null}:r.length===1?{mode:"in-use",filter:`${i} = ${r.getItemAt(0)}`}:{mode:"in-use",filter:`${i} IN (${r.join(", ")})`}:{mode:"none-visible",filter:null}}get floorFilter(){const{view:e,layer:i}=this;return e&&i?MFt({view:e,layer:i}):null}constructor(e){super(e),this.rulesTable=null,this._valid=!1}initialize(){if(!this.snappingSource||!this.layer)return;const{layer:e,snappingSource:i}=this;if("refresh"in e){const r=e;this.addHandles(r.on("refresh",()=>i.refresh()))}this.loadRules(),this.addHandles([_e(()=>i.updating,r=>i.layerSource.updating=r,kt),_e(()=>i.availability,r=>i.layerSource.availability=r,kt)])}getFetchCandidatesParameters(e,i,r){var _,x;if(!this.valid)return[];const{layer:n,layerView:s,floorFilter:o,rulesTable:l,subtypeFilter:c}=this,f={distance:r,mode:((_=this.view)==null?void 0:_.type)??"2d",point:e,coordinateHelper:i.coordinateHelper,...this._types,filter:s&&"filter"in s?s.filter:null};if(o&&(f.filter=PX(f.filter,o)),c.mode!=="not-in-use"&&c.mode!=="all-visible"){if(c.mode==="none-visible")return[];f.filter?f.filter.where=PB(f.filter.where,c.mode):f.filter=new Dk({where:c.filter})}if(l){const T=i.feature,A=T==null?void 0:T.sourceLayer;if(!(T&&W7(n)&&n.layerId&&W7(A)&&l.loadStatus==="loaded"))return[];const M=[],I=n.layerId,L=(x=l.getFeatureSQL(A,T))==null?void 0:x[I];if(!L)return[];const F=L.anyVertex;let z=L.endVertex;return z&&F&&z===F&&(z=""),z&&M.push({...f,returnEdge:!1,vertexMode:"ends",filter:PX(f.filter,z)}),F&&M.push({...f,returnEdge:!1,vertexMode:"all",filter:PX(f.filter,F)}),M}return[f]}async loadRules(){var r,n;const{layer:e,view:i}=this;if(e&&i&&yjt(i==null?void 0:i.map)&&W7(e)){const s=(r=i.map.utilityNetworks)==null?void 0:r.find(o=>o.isUtilityLayer(e));if(s)try{this.rulesTable=await s.getRulesTable(),await((n=this.rulesTable)==null?void 0:n.load()),this._valid=!0}catch{return void Ce.getLogger("esri.views.interactive.snapping.FeatureSnappingSourceInfo").error("Failed to load rules table for snapping source",e.title)}}else this._valid=!0}get _types(){return{returnEdge:!0,vertexMode:"all"}}remove(){this.destroy()}destroy(){var e;(e=this.snappingSource)==null||e.destroy()}};function PX(t,e){return t==null?new Dk({where:e}):t.where?new Dk({where:PB(t.where,e)}):new Dk({where:e})}y([w({constructOnly:!0})],tf.prototype,"layer",void 0),y([w({constructOnly:!0})],tf.prototype,"snappingSource",void 0),y([w({constructOnly:!0})],tf.prototype,"view",void 0),y([w()],tf.prototype,"layerView",null),y([w()],tf.prototype,"rulesTable",void 0),y([w()],tf.prototype,"valid",null),y([w()],tf.prototype,"subtypeFilter",null),y([w()],tf.prototype,"floorFilter",null),y([w()],tf.prototype,"_valid",void 0),tf=y([Z("esri.views.interactive.snapping.FeatureSnappingSourceInfo")],tf);let OP=class{constructor(e,i,r,n){this.targetPoint=e,this.constraint=i,this.isDraped=r,this.domain=n}},$ue=class extends OP{constructor({targetPoint:e,objectId:i,constraint:r,isDraped:n}){super(e,r,n,Wl.FEATURE),this.objectId=i}},jG=class{constructor(e,i){this.isDraped=e,this.domain=i}},e1=class yBe extends jG{constructor(e,i,r,n,s=Wl.ALL,o=!0,l=!0){super(n,s),this.type=e,this.lineStart=i,this.lineEnd=r,this.fadeLeft=o,this.fadeRight=l}equals(e){return e instanceof yBe&&this.type===e.type&&jr(this.lineStart,e.lineStart)&&jr(this.lineEnd,e.lineEnd)&&this.fadeLeft===e.fadeLeft&&this.fadeRight===e.fadeRight}get length(){return Sn(this.lineStart,this.lineEnd)}},vjt=class extends $ue{constructor(e){super({...e,isDraped:!0,constraint:new fBe(e.edgeStart,e.edgeEnd,e.getGroundElevation)})}get hints(){return[new e1(i0.REFERENCE,this.constraint.start,this.constraint.end,this.isDraped,this.domain)]}},_jt=class extends $ue{constructor(e){super({...e,constraint:new Cue(e.edgeStart,e.edgeEnd)})}get hints(){return[new e1(i0.REFERENCE,this.constraint.start,this.constraint.end,this.isDraped,this.domain)]}},vBe=class _Be extends jG{constructor(e,i,r,n,s=Wl.ALL){super(n,s),this.previousVertex=e,this.centerVertex=i,this.nextVertex=r}equals(e){return e instanceof _Be&&jr(this.previousVertex,e.previousVertex)&&jr(this.centerVertex,e.centerVertex)&&jr(this.nextVertex,e.nextVertex)}},bBe=class extends OP{constructor({targetPoint:e,constraint:i,previousVertex:r,otherVertex:n,otherVertexType:s,objectId:o,isDraped:l}){super(e,i,l,Wl.SELF),this.previousVertex=r,this.otherVertex=n,this.otherVertexType=s,this.objectId=o}get hints(){const e=this.previousVertex,i=this.otherVertexType===V5.CENTER?this.otherVertex:this.targetPoint,r=this.otherVertexType===V5.CENTER?this.targetPoint:this.otherVertex;return[new e1(i0.TARGET,i,r,this.isDraped,this.domain),new e1(i0.REFERENCE,e,i,this.isDraped,this.domain),new vBe(this.previousVertex,i,r,this.isDraped,this.domain)]}};var V5;(function(t){t[t.NEXT=0]="NEXT",t[t.CENTER=1]="CENTER"})(V5||(V5={}));function Ogi(t,e,i,r){i.projectToRenderScreen(t,Axe),i.projectToRenderScreen(e,Mxe),Ps(r,Mxe,Axe),w5(r,r)}function bjt(t,e,i,r,n=W()){const s=Ne(Rre,t);return s[2]=wPe(r,s,e,i)||0,r.renderCoordsHelper.toRenderCoords(s,e,n),n}function du(t,e,i,r){return r.type==="2d"?(Z8.x=t[0],Z8.y=t[1],Z8.spatialReference=e,r.toScreen(Z8)):(bjt(t,e,i,r,Rre),r.state.camera.projectToScreen(Rre,RX),Ku(RX[0],RX[1]))}const Z8=Xu(0,0,0,null),Rre=W(),Axe=Za(),Mxe=Za(),RX=ss();let Sw=class extends ze{get updating(){return this._snappingSources.some(e=>e==null||e.valid&&e.snappingSource.updating)||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=Wl.FEATURE,this._updatingHandles=new Rf,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){const e=NHe(()=>{var i;return(i=this.options)==null?void 0:i.featureSources},(i,r)=>this._createSourceInfo(i,r));this._snappingSources=e,this.addHandles(Jre(e))}destroy(){this._set("options",null),this._updatingHandles.destroy()}async fetchCandidates(e,i,r,n){var c;if(!(i&this._domain&&this.options!=null&&this.options.effectiveFeatureEnabled))return[];const s=[],o=this._computeScreenSizeDistanceParameters(e,r);for(const f of this._snappingSources){if(f==null||!f.valid||!f.snappingSource.layerSource.enabled||(c=f.layerView)!=null&&c.suspended)continue;const _=f.getFetchCandidatesParameters(e,r,o);for(const x of _)s.push(f.snappingSource.fetchCandidates(x,n).then(T=>T.filter(A=>!this._candidateIsExcluded(f.snappingSource,A,r.excludeFeature))))}const l=(await ZX(s)).flat();return this._addRightAngleCandidates(l,e,o,r),St(n),Iue(e,l),l}_addRightAngleCandidates(e,i,r,n){var x,T,A,M,I,L,F,z;const s=n.vertexHandle!=null?(T=(x=n.vertexHandle.rightEdge)==null?void 0:x.rightVertex)==null?void 0:T.pos:n.editGeometryOperations!=null&&n.editGeometryOperations.data.type==="polygon"?(M=(A=n.editGeometryOperations.data.components[0])==null?void 0:A.getFirstVertex())==null?void 0:M.pos:null,o=n.vertexHandle!=null?(L=(I=n.vertexHandle.leftEdge)==null?void 0:I.leftVertex)==null?void 0:L.pos:n.editGeometryOperations!=null?(z=(F=n.editGeometryOperations.data.components[0])==null?void 0:F.getLastVertex())==null?void 0:z.pos:null,{view:l}=this,c=so(s,l,n),f=so(o,l,n),_=e.length;for(let k=0;k<_;k++)this._addRightAngleCandidate(e[k],f,i,r,e),this._addRightAngleCandidate(e[k],c,i,r,e)}_addRightAngleCandidate(e,i,r,n,s){if(i==null||!wjt(e))return;const o=e.constraint.closestTo(i),l=(o[0]-r[0])/n.x,c=(o[1]-r[1])/n.y,{start:f,end:_}=e.constraint;if(l*l+c*c<=1){const x=new bBe({targetPoint:o,otherVertex:i,otherVertexType:V5.NEXT,previousVertex:Jf(o,f)>Jf(o,_)?f:_,constraint:new dBe(i,o),objectId:e.objectId,isDraped:e.isDraped});s.push(x)}}_computeScreenSizeDistanceParameters(e,i){let r=this.options!=null?this.options.distance*(i.pointer==="touch"?this.options.touchSensitivityMultiplier:1):0;return this.view==null?{x:r,y:r,z:r,distance:r}:this.view.type==="2d"?(r*=this.view.resolution,{x:r,y:r,z:r,distance:r}):this._computeScreenSizeDistanceParameters3D(e,r,this.view,i)}_computeScreenSizeDistanceParameters3D(e,i,r,n){const{spatialReference:s}=n;r.renderCoordsHelper.toRenderCoords(e,s,Oxe);const o=r.state.camera.computeScreenPixelSizeAt(Oxe),l=o*r.renderCoordsHelper.unitInMeters,c=l/ws(s),f=l/Bf(s),_=i*c,x=i*f,T=du(e,s,ma,r),A=T?IX(T,e,c,0,0,r,n):0,M=T?IX(T,e,0,c,0,r,n):0,I=T?IX(T,e,0,0,f,r,n):0;return{x:A===0?0:_/A,y:M===0?0:_/M,z:I===0?0:x/I,distance:o*i}}_candidateIsExcluded(e,i,r){if(r==null)return!1;const n=this._getCandidateObjectId(i);if(n==null)return!1;const s=e.layerSource.layer;return s.type==="graphics"?r.uid===n:r.sourceLayer===s&&!(!r.attributes||!("objectIdField"in s))&&r.attributes[s.objectIdField]===n}_getCandidateObjectId(e){return e instanceof $ue?e.objectId:null}async _createSourceInfo(e,i){const r=e.layer;r.loaded||(await r.load(),St(i));const{view:n}=this,s=await this._createFeatureSnappingSourceType(e);return St(i),new tf(s==null?{}:{snappingSource:s,view:n,layer:r})}async _createFeatureSnappingSourceType(e){switch(e.layer.type){case"feature":case"geojson":case"csv":case"oriented-imagery":case"subtype-group":case"wfs":return this._createFeatureSnappingSourceFeatureLayer(e);case"graphics":return this._createFeatureSnappingSourceGraphicsLayer(e);case"map-notes":return this._createFeatureSnappingSourceMapNotesLayer(e);case"scene":case"building-scene":return this._createFeatureSnappingSourceSceneLayer(e)}return null}async _createFeatureSnappingSourceSceneLayer(e){const{view:i}=this;return i==null||i.type!=="3d"?null:new(await this._getSourceModule("scene")).SceneLayerSnappingSource({layerSource:e,view:i})}async _createFeatureSnappingSourceFeatureLayer(e){var i;switch((i=e.layer.source)==null?void 0:i.type){case"feature-layer":case"oriented-imagery":return new(await this._getSourceModule("featureService")).FeatureServiceSnappingSource({spatialReference:this.spatialReference,view:this.view,layerSource:e});case"memory":case"csv":case"geojson":case"wfs":return e.layer.geometryType==="mesh"?null:new(await this._getSourceModule("featureCollection")).FeatureCollectionSnappingSource({layerSource:e,view:this.view})}return null}async _createFeatureSnappingSourceGraphicsLayer(e){return new(await this._getSourceModule("graphics")).GraphicsSnappingSource({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _createFeatureSnappingSourceMapNotesLayer(e){return new(await this._getSourceModule("notes")).GraphicsSnappingSource({getGraphicsLayers:()=>{var i;return((i=e.layer.sublayers)==null?void 0:i.toArray())??[]},spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _getSourceModule(e){const i=this._sourceModules[e];if(i.loader==null){const r=this._loadSourceModule(e),n={module:null,loader:r};this._sourceModules[e]=n;const s=await r,o={module:s,loader:r};return this._sourceModules[e]=o,s}return i.module==null?i.loader:i.module}_loadSourceModule(e){const i=this._updatingHandles;switch(e){case"featureService":return i.addPromise(we(()=>import("./FeatureServiceSnappingSource-El1DZ1LB.js"),__vite__mapDeps([261,262,263,4,233])));case"featureCollection":return i.addPromise(we(()=>import("./FeatureCollectionSnappingSource-AwpfuxVk.js"),__vite__mapDeps([264,262,263,4,135])));case"graphics":case"notes":return i.addPromise(we(()=>import("./GraphicsSnappingSource-FqTOI9A3.js"),__vite__mapDeps([265,104,88,89,90,91,92,39,40,93,66,94,73,95,262,263,4,135])));case"scene":return i.addPromise(we(()=>import("./SceneLayerSnappingSource-u6yw_bMd.js"),__vite__mapDeps([266,263,4])))}}get test(){return{snappingSources:this._snappingSources}}};function wjt(t){return(t instanceof _jt||t instanceof vjt)&&!xjt(t)}function xjt({constraint:{start:t,end:e}}){const i=Co(t,e),r=Jf(t,e);return ithis.squaredShortLineThreshold}isVertical(e,i){return Jf(e,i)new e1(i0.REFERENCE,e.edge.left,e.edge.right,this.isDraped,this.domain,e.fadeLeft,e.fadeRight))]}addReferenceLine(e){const i={edge:e,fadeLeft:!0,fadeRight:!0};this._referenceLines.forEach(r=>{jr(e.right,r.edge.left)&&(r.fadeLeft=!1,i.fadeRight=!1),jr(e.right,r.edge.right)&&(r.fadeRight=!1,i.fadeRight=!1),jr(e.left,r.edge.right)&&(r.fadeRight=!1,i.fadeLeft=!1),jr(e.left,r.edge.left)&&(r.fadeLeft=!1,i.fadeLeft=!1)}),this._referenceLines.push(i)}},Ojt=class extends GG{snapNewVertex(e,i){const r=i.editGeometryOperations.data.components[0],n=r.edges.length,s=r.vertices.length,o=[];if(n<2)return o;const{view:l}=this,c=du(e,i.spatialReference,ma,l),f=so(r.vertices[s-1].pos,l,i),_=so(r.vertices[0].pos,l,i),x=r.edges[n-1];let T=x;do{if(this.edgeExceedsShortLineThreshold(T,i)){const A=NV(T,l,i);this._checkEdgeForParallelLines(A,f,e,c,i,o),this._checkEdgeForParallelLines(A,_,e,c,i,o)}T=T.leftVertex.leftEdge}while(T&&T!==x);return o}snapExistingVertex(e,i){const r=[],n=i.vertexHandle,s=n.component;if(s.edges.length<3)return r;const{view:o}=this,l=du(e,i.spatialReference,ma,o),c=n.leftEdge,f=n.rightEdge,_=s.vertices[0],x=so(_.pos,o,i),T=s.vertices.length,A=s.vertices[T-1],M=so(A.pos,o,i),I=s.edges[0];let L=I;do{if(L!==c&&L!==f&&this.edgeExceedsShortLineThreshold(L,i)){const F=NV(L,o,i);c&&this._checkEdgeForParallelLines(F,so(c.leftVertex.pos,o,i),e,l,i,r),f&&this._checkEdgeForParallelLines(F,so(f.rightVertex.pos,o,i),e,l,i,r),n===_?this._checkEdgeForParallelLines(F,M,e,l,i,r):n===A&&this._checkEdgeForParallelLines(F,x,e,l,i,r)}L=L.rightVertex.rightEdge}while(L&&L!==I);return r}_checkEdgeForParallelLines(e,i,r,n,s,o){var T;const l=e.left,c=e.right;if(EX(a3,i,l,c),Jf(a3,i){const{effectiveFeatureEnabled:e,effectiveSelfEnabled:i,touchSensitivityMultiplier:r,distance:n}=this.options;return{effectiveFeatureEnabled:e,effectiveSelfEnabled:i,touchSensitivityMultiplier:r,distance:n}},()=>{this.doneSnapping(),this.emit("changed")},Li),_e(()=>this.options,e=>{for(const i of this._engines)i.options=e},Li),_e(()=>({viewReady:this.view.ready,viewSpatialReference:this.view.spatialReference,snappingEnginesFactory:this.snappingEnginesFactory}),({viewReady:e,snappingEnginesFactory:i})=>this._recreateEngines(e,i),kt)])}destroy(){this._destroyEngines()}get updating(){return this._engines.some(e=>e.updating)}_recreateEngines(e,i){if(this._destroyEngines(),!e)return;const{view:r,options:n}=this;this._engines=i(r,n)}_destroyEngines(){for(const e of this._engines)e.destroy();this._engines=[]}get _squaredMouseProximityTreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){const{distance:e,touchSensitivityMultiplier:i}=this.options,r=e*i;return r*r}get _squaredSatisfiesConstraintThreshold(){return a_.satisfiesConstraintScreenThreshold*a_.satisfiesConstraintScreenThreshold}snap(e){return kjt(e)?this._snapMultiPoint(e):this._snapSinglePoint(e)}update(e){const{point:i,context:r}=e;this._removeVisualization();const n=this._currentMainCandidate;if(n==null)return i;const s=this._selectUpdateInput(e);if(s==null)return i;const{spatialReference:o}=r,l=rl(s,o);if(l==null)return i;const{view:c}=this,{elevationInfo:f,visualizer:_}=r,x=[],T=DI(l,c,f),A=n.constraint.closestTo(T);if(!this._arePointsWithinScreenThreshold(T,A,r))return this._resetSnappingState(),i;n.targetPoint=A,x.push(...n.hints);for(const M of this._currentOtherActiveCandidates)M.targetPoint=A,x.push(...M.hints);return _!=null&&this.addHandles(_.draw(x,{spatialReference:o,elevationInfo:zjt(r),view:c,selfSnappingZ:r.selfSnappingZ}),Q8),Pxe(A,c,{z:i.z,m:i.m,spatialReference:i.spatialReference,elevationInfo:f})}doneSnapping(){this._removeVisualization(),this._resetSnappingState()}_selectUpdateInput({point:e,scenePoint:i}){switch(this._currentSnappedType){case Mv.MAIN:return e;case Mv.SCENE:return i}}_resetSnappingState(){this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=Mv.MAIN}_removeVisualization(){this.removeHandles(Q8)}async _snapSinglePoint({point:e,context:i,signal:r}){const{view:n}=this,{elevationInfo:s}=i,o=DI(e,n,s),l=await this._fetchCandidates(o,Wl.ALL,i,r);return this._createSnapResult(o,Mv.MAIN,l,n,i,{z:e.z,m:e.m,spatialReference:e.spatialReference,elevationInfo:s},r)}async _snapMultiPoint({point:e,scenePoint:i,context:r,signal:n}){const{view:s}=this,{coordinateHelper:o,elevationInfo:l,spatialReference:c}=r;await y_(i.spatialReference,c);const f=rl(i,c),_=DI(f,s,l),x=await this._fetchCandidates(_,Wl.FEATURE,r,n);if(x.length>0){const M=await this._fetchCandidates(_,Wl.SELF,r,n);return this._createSnapResult(_,Mv.SCENE,[...x,...M],s,r,{z:f.z,m:f.m,spatialReference:f.spatialReference,elevationInfo:l},n)}const T=DI(e,s,l),A=await this._fetchCandidates(T,Wl.SELF,r,n);return this._createSnapResult(T,Mv.MAIN,A,s,r,{z:o.hasZ()&&e.hasZ?e.z??0:void 0,m:o.hasM()&&e.hasM?e.m??0:void 0,spatialReference:e.spatialReference,elevationInfo:l},n)}async _fetchCandidates(e,i,r,n){return(await Promise.all(this._engines.map(s=>s.fetchCandidates(e,i,r,n)))).flat()}_createSnapResult(e,i,r,n,s,o,l){return{get valid(){return!xo(l)},apply:()=>{const{spatialReference:c}=s,{snappedPoint:f,hints:_}=this._processCandidates(e,i,r,s);return this._removeVisualization(),s.visualizer!=null&&this.addHandles(s.visualizer.draw(_,{spatialReference:c,elevationInfo:ma,view:n,selfSnappingZ:s.selfSnappingZ}),Q8),Pxe(f,n,o)}}}_processCandidates(e,i,r,n){if(r.length<1)return this.doneSnapping(),{snappedPoint:e,hints:[]};this._currentSnappedType!==i&&this._resetSnappingState(),Iue(e,r);const s=this._currentMainCandidate;if(s!=null){const o=this._findOldConstraintInNewCandidates(s,r);if(o>=0){if(!(r[o]instanceof K8))return this._intersectWithOtherCandidates(o,r,e,i,n);if(this._arePointsWithinScreenThreshold(e,s.targetPoint,n))return this._updateSnappingCandidate(s,i,r,n)}}return this._intersectWithOtherCandidates(0,r,e,i,n)}_findOldConstraintInNewCandidates(e,i){return e instanceof K8?this._findOldCandidateIndex(i,e.first)>=0&&this._findOldCandidateIndex(i,e.second)>=0?0:-1:this._findOldCandidateIndex(i,e)}_intersectWithOtherCandidates(e,i,r,n,s){const{coordinateHelper:o}=s,l=i[e],c=[];for(let f=0;f0&&(c.sort((f,_)=>f[1]-_[1]),c[0][1]0}canRedo(){return this.history.redo.length>0}complete(){this._reset(),this.onEnd(),this.emit("complete")}cancel(){this.cancelled=!0,this.complete()}_reset(){var e;(e=this.activeComponent)==null||e.reset()}refreshComponent(){const e=this.activeComponent;e&&(e.type!=="box"&&e.type!=="reshape"&&e.type!=="graphic-mover"||e.refresh())}set undo(e){this._set("undo",()=>{this.canUndo()&&e()})}set redo(e){this._set("redo",()=>{this.canRedo()&&e()})}};y([w()],dc.prototype,"activeComponent",void 0),y([w()],dc.prototype,"cancelled",void 0),y([w()],dc.prototype,"history",void 0),y([w()],dc.prototype,"tool",null),y([w()],dc.prototype,"type",void 0),y([w()],dc.prototype,"canUndo",null),y([w()],dc.prototype,"canRedo",null),y([w()],dc.prototype,"onEnd",void 0),y([w()],dc.prototype,"undo",null),y([w()],dc.prototype,"redo",null),y([w()],dc.prototype,"toggleTool",void 0),y([w()],dc.prototype,"addToSelection",void 0),y([w()],dc.prototype,"removeFromSelection",void 0),dc=y([Z("esri.widgets.Sketch.support.OperationHandle")],dc);let Nk=class extends dc{};y([w()],Nk.prototype,"activeComponent",void 0),Nk=y([Z("esri.widgets.Sketch.support.CreateOperationHandle")],Nk);let $v=class extends dc{};y([w()],$v.prototype,"activeComponent",void 0),$v=y([Z("esri.widgets.Sketch.support.UpdateOperationHandle")],$v);const Rxe={defaultZ:0},VR={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0},tool:"transform"};let Us=class extends Dn.EventedAccessor{constructor(e){super(e),this._numUpdating=0,this._internalGraphicsLayer=new jse({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.labelOptions=new XVe,this.layer=null,this.pointSymbol=new cu({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new Bm({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new Oc({color:[130,130,130,1],width:2}),this.meshSymbol=new F9({symbolLayers:new it([new uP])}),this._snappingManager=null,this.tooltipOptions=new ZVe,this.updateGraphics=new it,this.updateOnGraphicClick=!0,this.vertexSymbol=new cu({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._originalPopupEnabled=null,this.defaultCreateOptions=Rxe,this.defaultUpdateOptions=VR,this.snappingOptions=new Lue}initialize(){this.addHandles([Jr(()=>{var e,i;return(i=(e=this.view)==null?void 0:e.map)==null?void 0:i.layers},"change",e=>{e.removed.includes(this.layer)&&this.cancel()}),Jr(()=>{var e;return(e=this.layer)==null?void 0:e.graphics},"change",e=>{if(this._operationHandle!=null)for(const i of e.removed)this.updateGraphics.includes(i)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(i):this._operationHandle.cancel())}),_e(()=>{var e;return((e=this.layer)==null?void 0:e.elevationInfo)??null},e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)},kt),_e(()=>this.view,e=>{et(this._snappingManager),e&&(this._snappingManager=new X0({view:e,options:this.snappingOptions}),e.type==="2d"?we(()=>import("./editingTools-1yHclJT1.js"),__vite__mapDeps([267,2,3,4,268,7,8,5,9,10,11,6,215,269,221,217,270,214,12,13])):e.type==="3d"&&(we(()=>import("./editingTools-eh7FxppI.js"),__vite__mapDeps([271,217,219,269,221,215,17,18,19,20,21,22,23,24,25,3,4,272,223,27,268,7,8,5,9,10,11,6,270,214,227,26,12,13,273,229,170,216,222,274])),we(()=>import("./GraphicsLayerView3D-TqJxY2EU.js"),__vite__mapDeps([187,161,179,188,180,95,90,91,169,163]))))},kt),_e(()=>{var e;return(e=this.view)==null?void 0:e.spatialReference},(e,i)=>{e&&i&&!e.equals(i)&&this.cancel()})]),gjt(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._snappingManager=et(this._snappingManager),this._set("view",null),this.emit("destroy")}get _defaultUpdateTool(){var e;return((e=this.view)==null?void 0:e.type)==="3d"?"move":"transform"}get updating(){return this._numUpdating>0||this._snappingManager!=null&&this._snappingManager.updating}get activeTool(){var e;return((e=this._operationHandle)==null?void 0:e.tool)??null}get activeComponent(){var e;return((e=this._operationHandle)==null?void 0:e.activeComponent)??null}get createGraphic(){return this.activeComponent==null||this.activeComponent.type!=="draw-3d"&&this.activeComponent.type!=="draw-2d"?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...Rxe,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...VR,...e,reshapeOptions:{...VR.reshapeOptions,...e==null?void 0:e.reshapeOptions},highlightOptions:{...VR.highlightOptions,...e==null?void 0:e.highlightOptions}})}set snappingOptions(e){this._snappingManager!=null&&(this._snappingManager.options=e),this._set("snappingOptions",e)}get state(){var r;const e=!(!((r=this.view)!=null&&r.ready)||!this.layer),i=this._operationHandle;return e&&i?"active":e?"ready":"disabled"}get view(){return this._get("view")}set view(e){const i=this._get("view");if(i){const{container:n,map:s}=i;n&&(i.cursor=null),s==null||s.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const r="view-ready";this.removeHandles(r),e&&this.addHandles(Mo(()=>e.ready,n=>{this.removeHandles(this._viewHandlesKey),n&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},kt),r),this._set("view",e)}cancel(){this._moduleLoaderAbortController=gn(this._moduleLoaderAbortController),this._viewReadyAbortController=gn(this._viewReadyAbortController),this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle&&this._operationHandle.complete()}delete(){const{state:e,updateGraphics:i}=this;if(e==="active"&&i.length){const{activeTool:r,layer:n}=this,s=i.toArray();n.removeMany(s),this.cancel(),this._emitDeleteEvent({graphics:s,tool:r})}}duplicate(){if(this.state==="active"&&this.updateGraphics.length){const e=this.updateGraphics.map(i=>i.clone()).toArray();return this.layer.addMany(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,i){this.cancel(),await this._waitViewReady();const{view:r,layer:n}=this;if(!r||this.state==="disabled")throw n||this._logMissingLayer(),ur();if(r.activeTool!=null&&(r.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");wxe(r,this._internalGraphicsLayer);const s=await this._setupCreateOperation(e,i);if(s==null||this.destroyed)return void r.map.remove(this._internalGraphicsLayer);const o=()=>{var l;if(s===this._operationHandle){const c=this.createGraphic,f=this._operationHandle.cancelled;this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),(l=this.view)!=null&&l.map&&this.view.map.remove(this._internalGraphicsLayer),s.cancelled||c==null||n.add(c),this.emit("create",{graphic:c,state:f?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"})}};s.on("complete",o),this._operationHandle=s,r.ready&&r.focus()}async update(e,i){this.cancel(),await this._waitViewReady();const{layer:r,view:n,state:s}=this;if(!n||s==="disabled")throw r||this._logMissingLayer(),ur();n.activeTool!=null&&(n.activeTool=null);const o=Array.isArray(e)?e:[e];if(e==null||!(o!=null&&o.length))return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(o.some(c=>c.layer!==r?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):c.geometry==null&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0)))return;const l=await this._setupUpdateOperation(o,i);this.destroyed||l==null||Pa(l)||(wxe(n,this._internalGraphicsLayer),this._setUpdateOperationHandle(l,i),this.emit("update",{graphics:o,state:"start",aborted:!1,tool:l.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const i=this.view;if(i){this._beginAsyncOperation(),e=Array.isArray(e)?e:[e];for(const r of e)r.geometry==null||r.geometry.type==="mesh"||Zn(r.geometry.spatialReference,i.spatialReference)||(th(r.geometry.spatialReference,i.spatialReference)||ox()||await g_(),r.geometry=rl(r.geometry,i.spatialReference));this._endAsyncOperation()}else this._logMissingView()}undo(){var e;this.canUndo()&&((e=this._operationHandle)==null||e.undo())}redo(){var e;this.canRedo()&&((e=this._operationHandle)==null||e.redo())}canUndo(){return!(!this._operationHandle||!this._operationHandle.canUndo())}canRedo(){return!(!this._operationHandle||!this._operationHandle.canRedo())}toggleUpdateTool(){this._operationHandle&&this._operationHandle.toggleTool&&this._operationHandle.toggleTool()}async _getFirstHit(e){const i=this.view;if(!i)return this._logMissingView(),null;if(i.type==="2d"){const s=[];i.map.allLayers.forEach(l=>{l.type!=="vector-tile"&&l.type!=="imagery"||s.push(l)});const o=await i.hitTest(e,{exclude:s});return L8t(o.results)}const r=[i.map.ground];i.map.allLayers.forEach(s=>{s.type==="integrated-mesh"&&r.push(s)});const n=await i.hitTest(e,{exclude:r});if(n.results.length>0){const s=n.results[0];if(s!=null&&s.type==="graphic"&&s.graphic&&(!n.ground.mapPoint||i.map.ground.opacity<1||n.ground.distance-(s.distance??0)>-Math.min(3*n.ground.distance,i.viewingMode==="global"?Sr(i.renderCoordsHelper.spatialReference).radius/i.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return s}return null}_generateViewHandles(e){return[e.on("immediate-click",async i=>{var o;const r=this.state==="active"&&((o=this._operationHandle)==null?void 0:o.type)==="create";if(this.state==="disabled"||r||!this.updateOnGraphicClick)return;this._beginAsyncOperation();const n=await i.async(()=>this._getFirstHit(sf(i)));let s=null;if(n!=null){const l=n.graphic;this.updateGraphics.includes(l)||l.layer===this.layer?(i.stopPropagation(),s=l):e.type!=="2d"||this._isComponentGraphic(l)||this.state!=="active"||this.cancel()}else this.state==="active"&&this.cancel();s==null||this.updateGraphics.includes(s)||await this.update([s],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}}),this._endAsyncOperation()},Es.WIDGET)]}async _setupCreateOperation(e,i){const r=this.view;if(!r)return this._logMissingView(),null;const n={hasZ:r.type==="3d",...this.defaultCreateOptions,...i},s=await this._setupDrawGraphicTool(e,r,n);return s==null?null:(r.tools.add(s),r.activeTool=s,this._setupCreateOperationHandle(s))}async _setupDrawGraphicTool(e,i,r){if(e==="multipoint"&&i.type==="3d")return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!i)return this._logMissingView(),null;const n=e!=="rectangle",s=e!=="rectangle",o={view:i,mode:e==="rectangle"||e==="circle"?"hybrid":"click",...r,snapToScene:!1,geometryType:e,graphicSymbol:this._getGraphicSymbolFromTool(e),snappingManager:this._snappingManager,forceUniformSize:s,centered:n};return i.type==="2d"?this._makeDrawGraphicTool2D(o):this._makeDrawGraphicTool3D(o)}async _makeDrawGraphicTool2D(e){const i=await this._requireModule(we(()=>import("./editingTools-1yHclJT1.js"),__vite__mapDeps([267,2,3,4,268,7,8,5,9,10,11,6,215,269,221,217,270,214,12,13])));return Pa(i)||this.destroyed?null:new i.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:Vjt(e.geometryType)?this.activeFillSymbol:null,tooltipOptions:this.tooltipOptions})}async _makeDrawGraphicTool3D(e){const i=await this._requireModule(we(()=>import("./editingTools-eh7FxppI.js"),__vite__mapDeps([271,217,219,269,221,215,17,18,19,20,21,22,23,24,25,3,4,272,223,27,268,7,8,5,9,10,11,6,270,214,227,26,12,13,273,229,170,216,222,274])));if(Pa(i)||this.destroyed)return null;const{elevationInfo:r}=this.layer;return new i.module.DrawGraphicTool3D({...e,elevationInfo:r,snapToScene:r==null||r.mode==="absolute-height",labelOptions:this.labelOptions,tooltipOptions:this.tooltipOptions})}_setupCreateOperationHandle(e){const i=this.view;if(!i)return this._logMissingView(),null;let r=null;const n=e.forceUniformSize,s=e.centered,o=[i.on("key-down",c=>{if(c.key===Oa.pan)c.stopPropagation(),c.repeat||(e.enabled=!1);else if(c.key===Oa.complete)c.stopPropagation(),e.completeCreateOperation();else if(c.key!==Oa.vertexAdd||c.repeat)c.key===Oa.undo?(c.stopPropagation(),l.undo()):c.key===Oa.redo?(c.stopPropagation(),l.redo()):c.key!==Oa.constraint||e.geometryType!=="rectangle"&&e.geometryType!=="circle"||c.repeat?c.key===Oa.center&&(c.repeat||(e.centered=!s,c.stopPropagation())):(e.forceUniformSize=!n,c.stopPropagation());else{const f=e.drawOperation.geometryType;f!=="polyline"&&f!=="polygon"&&f!=="multipoint"||(c.stopPropagation(),e.drawOperation.commitStagedVertex())}},Es.WIDGET),i.on("key-up",c=>{c.key===Oa.pan?e.enabled=!0:c.key!==Oa.constraint||e.geometryType!=="rectangle"&&e.geometryType!=="circle"?c.key===Oa.center&&(e.centered=s,c.stopPropagation()):(e.forceUniformSize=n,c.stopPropagation())},Es.WIDGET),e.on("vertex-add",c=>{switch(r=r==null?"start":"active",c.operation){case"apply":this.emit("create",{graphic:e.graphic,state:r,tool:this.activeTool,toolEventInfo:c,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",c=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:c.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",c=>{switch(c.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:c,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",c=>{this._set("createGraphic",c.graphic),r="complete",c.aborted?l&&l.cancel():l&&l.complete()}),_e(()=>this._getGraphicSymbolFromTool(e.geometryType),c=>{e.graphicSymbol=c})],l=new Nk({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{var c;o.forEach(f=>f.remove()),o.length=0,(c=i.tools)==null||c.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return l}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":return this.polygonSymbol;case"mesh":return this.meshSymbol}}async _setupUpdateOperation(e,i){var l;const{layer:r,view:n}=this;if(!n)return this._logMissingView(),null;const s={tool:this._defaultUpdateTool,...this.defaultUpdateOptions,...i,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...i==null?void 0:i.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...i==null?void 0:i.highlightOptions}};let o=s.tool;for(const c of e)r.remove(c),r.add(c);if(n.type==="3d"){if(e.length===0)return null;switch(o){case"move":return this._setupMove3DOperation(e,s,n,o);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const c=X8(e[0]);return c===Xn.SUPPORTED?this._setupReshape3DOperation(e[0],s,n):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${SX(c)}).`),null)}case"transform":return this._setupGraphicTransform3DOperation(e,s,n)}}switch(o){case"move":return this._setupMove2DOperation(e,s,n);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const c=X8(e[0]);return c===Xn.SUPPORTED?this._setupTransformOrReshape2DOperation(e,o,s,n):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${SX(c)}).`),null)}case"transform":if(e.length===1){const c=(l=e[0].geometry)==null?void 0:l.type;c!=="point"&&c!=="multipoint"||(o="reshape")}return this._setupTransformOrReshape2DOperation(e,o,s,n)}}async _setupMove3DOperation(e,i,r,n,s=!1){for(const _ of e){const x=MBt(_);if(x!==Xn.SUPPORTED)return this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${SX(x)}).`),null}const o=await this._requireModule(we(()=>import("./editingTools-eh7FxppI.js"),__vite__mapDeps([271,217,219,269,221,215,17,18,19,20,21,22,23,24,25,3,4,272,223,27,268,7,8,5,9,10,11,6,270,214,227,26,12,13,273,229,170,216,222,274])));if(Pa(o))return o;const l=new o.module.GraphicMoveTool({view:r,enableZ:i.enableZ,snappingManager:this._snappingManager,tooltipOptions:this.tooltipOptions});r.tools.add(l),l.graphics.addMany(e),s||this.updateGraphics.addMany(e);const c=[],f=new $v({activeComponent:l,tool:n,type:"update",onEnd:()=>{var _;c.forEach(x=>x.remove()),c.length=0,(_=r.tools)==null||_.remove(l),l.destroyed||l.destroy()},undo:()=>{e7(f,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:n})},redo:()=>{t7(f,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:n})},addToSelection:_=>{this.updateGraphics.push(_),l.graphics.push(_),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[_],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:_=>{const x=this.updateGraphics.indexOf(_);f.history.undo.forEach(T=>T.updates.splice(x,1)),f.history.redo.forEach(T=>T.updates.splice(x,1)),this.updateGraphics.remove(_),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[_],type:"selection-change"},type:"update"}),this.updateGraphics.length!==0?l.graphics.remove(_):f.complete()},toggleTool:async()=>{if(this.updateGraphics.length!==1||i.toggleToolOnClick===!1||n!=="transform")return;const _=this.updateGraphics.at(0);if(X8(_)!==Xn.SUPPORTED)return;f.onEnd(),f.destroy();const x=await this._setupReshape3DOperation(_,i,r,!0);Pa(x)||this._setUpdateOperationHandle(x,i)}});return c.push(...this._getHandlesForComponent(f,i),r.on("immediate-click",_=>this._getCommonUpdateOperationClickHandlers(f,_,i),Es.WIDGET),r.on("key-down",_=>{this._getCommonUpdateOperationKeyDownHandlers(f,_)},Es.WIDGET)),f}_setupGraphicTransform3DOperation(e,i,r,n=!1){if(e.length===1&&LBt(e[0])===Xn.SUPPORTED){const s=e[0],o=s.geometry;if(o!=null&&(o.type==="point"||o.type==="mesh"))return this._setupPointTransform3DOperation(s,i,r);if(o!=null&&(o.type==="polygon"||o.type==="polyline"))return this._setupPolyTransform3DOperation(s,i,r,n)}return this._setupMove3DOperation(e,i,r,"transform",n)}async _setupPointTransform3DOperation(e,i,r){const n="transform",{enableRotation:s,enableScaling:o,enableZ:l}=i,c=await this._requireModule(we(()=>import("./editingTools-eh7FxppI.js"),__vite__mapDeps([271,217,219,269,221,215,17,18,19,20,21,22,23,24,25,3,4,272,223,27,268,7,8,5,9,10,11,6,270,214,227,26,12,13,273,229,170,216,222,274])));if(Pa(c))return c;const f=new c.module.GraphicTransformTool({graphic:e,view:r,enableRotation:s,enableScaling:o,enableZ:l,snappingManager:this._snappingManager,tooltipOptions:this.tooltipOptions});r.tools.add(f),this.updateGraphics.add(e);const _=[],x=new $v({activeComponent:f,tool:n,type:"update",onEnd:()=>{var T;_.forEach(A=>A.remove()),_.length=0,(T=r.tools)==null||T.remove(f),f.destroyed||f.destroy()},undo:()=>{e7(x,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:n})},redo:()=>{t7(x,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:n})},addToSelection:async T=>{this.updateGraphics.add(T),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[T],removed:[],type:"selection-change"},type:"update"}),x.onEnd(),x.destroy();const A=await this._setupMove3DOperation(this.updateGraphics.toArray(),i,r,"transform",!0);Pa(A)||this._setUpdateOperationHandle(A,i)},removeFromSelection:T=>{this.updateGraphics.remove(T),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[T],type:"selection-change"},type:"update"}),x.complete()},toggleTool:()=>{}});return _.push(...this._getHandlesForComponent(x,i),r.on("immediate-click",T=>this._getCommonUpdateOperationClickHandlers(x,T,i),Es.WIDGET),r.on("key-down",T=>{this._getCommonUpdateOperationKeyDownHandlers(x,T)},Es.WIDGET)),x}async _setupPolyTransform3DOperation(e,i,r,n=!1){const s="transform",{enableRotation:o,enableScaling:l,enableZ:c,preserveAspectRatio:f}=i,_=await this._requireModule(we(()=>import("./editingTools-eh7FxppI.js"),__vite__mapDeps([271,217,219,269,221,215,17,18,19,20,21,22,23,24,25,3,4,272,223,27,268,7,8,5,9,10,11,6,270,214,227,26,12,13,273,229,170,216,222,274])));if(Pa(_))return _;const x=new _.module.ExtentTransformTool({graphic:e,view:r,enableRotation:o,enableScaling:l,enableZ:c,preserveAspectRatio:f,tooltipOptions:this.tooltipOptions});r.tools.add(x),n||this.updateGraphics.add(e);const T=[],A=new $v({activeComponent:x,tool:s,type:"update",onEnd:()=>{var M;T.forEach(I=>I.remove()),T.length=0,(M=r.tools)==null||M.remove(x),x.destroyed||x.destroy()},canUndo:()=>x.canUndo,undo:()=>{x.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s})},canRedo:()=>x.canRedo,redo:()=>{x.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s})},addToSelection:async M=>{this.updateGraphics.add(M),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[M],removed:[],type:"selection-change"},type:"update"}),A.onEnd(),A.destroy();const I=await this._setupMove3DOperation(this.updateGraphics.toArray(),i,r,"transform",!0);Pa(I)||this._setUpdateOperationHandle(I,i)},removeFromSelection:M=>{this.updateGraphics.remove(M),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[M],type:"selection-change"},type:"update"}),A.complete()},toggleTool:async()=>{if(this.updateGraphics.length!==1||i.toggleToolOnClick===!1)return;const M=this.updateGraphics.at(0);if(X8(M)!==Xn.SUPPORTED)return;A.onEnd(),A.destroy();const I=await this._setupReshape3DOperation(M,i,r,!0);Pa(I)||this._setUpdateOperationHandle(I,i)}});return T.push(...this._getHandlesForComponent(A,i),r.on("immediate-click",M=>this._getCommonUpdateOperationClickHandlers(A,M,i),Es.WIDGET),r.on("key-down",M=>this._getCommonUpdateOperationKeyDownHandlers(A,M),Es.WIDGET),r.on("key-down",M=>{M.key!==Oa.constraint||M.repeat||(x.preserveAspectRatio=!x.preserveAspectRatio,M.stopPropagation())},Es.WIDGET),r.on("key-up",M=>{M.key===Oa.constraint&&(x.preserveAspectRatio=!x.preserveAspectRatio,M.stopPropagation())},Es.WIDGET)),A}async _setupMove2DOperation(e,i,r){const n="move";this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const s=await this._getGraphicMover(e,i,r);if(Pa(s))return s;const o=new $v({activeComponent:s,tool:n,type:"update",onEnd:()=>{var _;this._displayDefaultCursor(),f.forEach(x=>x.remove()),c.forEach(x=>x.remove()),f=[],c=[],s.destroy(),(_=this._internalGraphicsLayer)==null||_.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const _=this.updateGraphics.toArray();e7(o,_),o.refreshComponent(),this._emitUndoEvent({graphics:_,tool:n})},redo:()=>{const _=this.updateGraphics.toArray();t7(o,_),o.refreshComponent(),this._emitRedoEvent({graphics:_,tool:n})},addToSelection:async _=>{await this._updateSpatialReference(_),this.updateGraphics.push(_),s.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[_],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:_=>{const x=this.updateGraphics.indexOf(_);o.history.undo.forEach(A=>A.updates.splice(x,1)),o.history.redo.forEach(A=>A.updates.splice(x,1)),this.updateGraphics.remove(_);const T=this.updateGraphics.toArray();this.emit("update",{graphics:T,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[_],type:"selection-change"},type:"update"}),this.updateGraphics.length!==0?s.graphics=T:o.complete()}});let l=!1,c=[r.on("immediate-click",_=>this._getCommonUpdateOperationClickHandlers(o,_,i),Es.WIDGET),r.on("key-down",_=>{this._getCommonUpdateOperationKeyDownHandlers(o,_),_.key!==Oa.constraint||_.repeat||(l=!0,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},Es.WIDGET),r.on("key-up",_=>{_.key===Oa.constraint&&l&&(l=!1,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},Es.WIDGET)],f=this._getHandlesForComponent(o,i);return o}async _setupReshape3DOperation(e,i,r,n=!1){const s="reshape",o=await this._requireModule(we(()=>import("./editingTools-eh7FxppI.js"),__vite__mapDeps([271,217,219,269,221,215,17,18,19,20,21,22,23,24,25,3,4,272,223,27,268,7,8,5,9,10,11,6,270,214,227,26,12,13,273,229,170,216,222,274])));if(Pa(o))return o;const l=i.reshapeOptions,c=new o.module.GraphicReshapeTool({view:r,graphic:e,enableZVertex:i.enableZ&&(l==null?void 0:l.vertexOperation)==="move",enableZShape:i.enableZ&&(l==null?void 0:l.shapeOperation)==="move",enableMoveGraphic:(l==null?void 0:l.shapeOperation)==="move"||(l==null?void 0:l.shapeOperation)==="move-xy",enableMidpoints:(l==null?void 0:l.edgeOperation)==="split",enableEdgeOffset:(l==null?void 0:l.edgeOperation)==="offset",snappingManager:this._snappingManager,labelOptions:this.labelOptions,tooltipOptions:this.tooltipOptions});r.tools.add(c),n||this.updateGraphics.add(e);const f=[],_=new $v({activeComponent:c,tool:s,type:"update",onEnd:()=>{var x;f.forEach(T=>T.remove()),f.length=0,(x=r.tools)==null||x.remove(c),c.destroyed||c.destroy()},canUndo:()=>c.canUndo,undo:()=>{c.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s})},canRedo:()=>c.canRedo,redo:()=>{c.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s})},addToSelection:async x=>{this.updateGraphics.add(x),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[x],removed:[],type:"selection-change"},type:"update"}),_.onEnd(),_.destroy();const T=await this._setupMove3DOperation(this.updateGraphics.toArray(),i,r,"transform",!0);Pa(T)||this._setUpdateOperationHandle(T,i)},removeFromSelection:x=>{this.updateGraphics.remove(x),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[x],type:"selection-change"},type:"update"}),_.complete()},toggleTool:async()=>{if(i.toggleToolOnClick===!1)return;_.onEnd(),_.destroy();const x=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),i,r,!0);Pa(x)||this._setUpdateOperationHandle(x,i)}});return f.push(...this._getHandlesForComponent(_,i),r.on("immediate-click",x=>this._getCommonUpdateOperationClickHandlers(_,x,i),Es.WIDGET),r.on("key-down",x=>{this._getCommonUpdateOperationKeyDownHandlers(_,x)},Es.WIDGET)),_}async _setupTransformOrReshape2DOperation(e,i,r,n){this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const s=i==="transform"?await this._getBox(e,r,n):await this._getReshape(e,r,n);if(Pa(s))return s;const o=new $v({activeComponent:s,type:"update",onEnd:()=>{c.forEach(f=>f.remove()),l.forEach(f=>f.remove()),c=[],l=[],o.activeComponent&&!o.activeComponent.destroyed&&o.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{e7(o,this.updateGraphics.toArray()),o.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:o.tool})},redo:()=>{t7(o,this.updateGraphics.toArray()),o.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:o.tool})},addToSelection:async f=>{let _=o.activeComponent;if((_==null?void 0:_.type)==="reshape"){const x=[...this.updateGraphics,f];this.updateGraphics.removeAll(),o.onEnd(),o.destroy();const T=await this._setupMove2DOperation(x,r,n);if(Pa(T))return;this._setUpdateOperationHandle(T,r)}else this.updateGraphics.add(f),_.graphics=this.updateGraphics.toArray(),_.refresh(),o.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[f],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async f=>{const _=this.updateGraphics.indexOf(f);o.history.undo.forEach(T=>T.updates.splice(_,1)),o.history.redo.forEach(T=>T.updates.splice(_,1)),this.updateGraphics.remove(f);const x=this.updateGraphics.toArray();if(x.length===0)o.complete();else{const T=x[0].geometry;x.length!==1||T==null||T.type!=="point"&&T.type!=="multipoint"?o.activeComponent.graphics=x:o.toggleTool()}this.emit("update",{graphics:x,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[f],type:"selection-change"},type:"update"})},toggleTool:async()=>{var T;if(this.updateGraphics.length>1)return;const f=this.updateGraphics.at(0),_=f.geometry;if(_!=null&&(o.tool==="reshape"&&(_.type==="point"||_.type==="multipoint")||o.tool==="transform"&&_.type==="extent"))return;let x=null;o.tool==="transform"?x=await this._getReshape([f],r,n):o.tool==="reshape"&&(x=await this._getBox([f],r,n)),Pa(x)||((T=o.activeComponent)==null||T.destroy(),o.activeComponent=x,o.activeComponent&&(c.forEach(A=>A.remove()),c=this._getHandlesForComponent(o,r)))}});let l=[n.on("immediate-click",f=>this._getCommonUpdateOperationClickHandlers(o,f,r),Es.WIDGET),n.on("key-down",f=>{if(this._getCommonUpdateOperationKeyDownHandlers(o,f),f.key===Oa.constraint&&!f.repeat&&o){const _=o.activeComponent;_&&_.type==="box"&&(_.preserveAspectRatio=!_.preserveAspectRatio)}},Es.WIDGET),n.on("key-up",f=>{if(f.key===Oa.constraint&&o){const _=o.activeComponent;_&&_.type==="box"&&(_.preserveAspectRatio=!_.preserveAspectRatio)}},Es.WIDGET)],c=this._getHandlesForComponent(o,r);return o}async _getGraphicMover(e,i,r){const{enableMoveAllGraphics:n,highlightOptions:s}=i,o=await this._requireModule(we(()=>import("./GraphicMover-DhG5Ib7v.js").then(l=>l.G),__vite__mapDeps([275,10,157,12,13])));return Pa(o)?o:new o.module.default({enableMoveAllGraphics:n,highlightsEnabled:!!(s!=null&&s.enabled),indicatorsEnabled:!1,graphics:e,view:r,callbacks:{onGraphicMoveStart:({dx:l,dy:c,graphic:f})=>{this._displayGrabbingCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:l,dy:c,mover:f,type:"move-start"},type:"update"})},onGraphicMove:({dx:l,dy:c,graphic:f})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:l,dy:c,mover:f,type:"move"},type:"update"}),onGraphicMoveStop:({dx:l,dy:c,graphic:f})=>{this._displayPointerCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:l,dy:c,mover:f,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayPointerCursor(),onGraphicPointerOut:()=>this._displayDefaultCursor()}})}async _getBox(e,i,r){const{enableRotation:n,enableScaling:s,highlightOptions:o,preserveAspectRatio:l}=i,c=await this._requireModule(we(()=>import("./Box-gJ8-sOXE.js"),__vite__mapDeps([276,10,275,157,12,13,277,274,269,221,215,217,273])));return Pa(c)?c:new c.module.default({graphics:e,enableRotation:n,enableScaling:s,highlightsEnabled:!!(o!=null&&o.enabled),preserveAspectRatio:l,layer:this._internalGraphicsLayer,view:r,tooltipOptions:this.tooltipOptions,callbacks:{onMoveStart:f=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...f},type:"update"}),onMove:f=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...f},type:"update"}),onMoveStop:f=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...f},type:"update"}),onScaleStart:f=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...f},type:"update"}),onScale:f=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...f},type:"update"}),onScaleStop:f=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...f},type:"update"}),onRotateStart:f=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...f},type:"update"}),onRotate:f=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...f},type:"update"}),onRotateStop:f=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...f},type:"update"})}})}async _getReshape(e,i,r){var c,f,_;const n=((c=i.reshapeOptions)==null?void 0:c.edgeOperation)==="split",s=((f=i.reshapeOptions)==null?void 0:f.shapeOperation)==="move",o=!!((_=i.highlightOptions)!=null&&_.enabled),l=await this._requireModule(we(()=>import("./Reshape-J0NI6bzM.js"),__vite__mapDeps([278,2,3,4,10,275,157,12,13,277,5,269,221,215,217,273,270,214])));return Pa(l)?l:new l.module.default({enableMidpoints:n,enableMovement:s,graphic:e[0],highlightsEnabled:o,layer:this._internalGraphicsLayer,snappingManager:this._snappingManager,tooltipOptions:this.tooltipOptions,view:r,callbacks:{onReshapeStart:x=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...x},type:"update"}),onReshape:x=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...x},type:"update"}),onReshapeStop:({mover:x,type:T})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:x,type:T},type:"update"}),onMoveStart:({dx:x,dy:T,mover:A,type:M})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:x,dy:T,mover:A,type:M},type:"update"}),onMove:({dx:x,dy:T,mover:A,type:M})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:x,dy:T,mover:A,type:M},type:"update"}),onMoveStop:({dx:x,dy:T,mover:A,type:M})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:x,dy:T,mover:A,type:M},type:"update"}),onVertexAdd:({added:x,type:T,vertices:A})=>{const M=x.map(I=>Zde(I.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:M,vertices:A,type:T},type:"update"})},onVertexRemove:({removed:x,type:T,vertices:A})=>{const M=x.map(I=>Zde(I.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:M,vertices:A,type:T},type:"update"})}}})}_getHandlesForComponent(e,i){const r=e.activeComponent;if(!r)return[];switch(r.type){case"graphic-mover":return[r.on("graphic-click",({graphic:n,viewEvent:s})=>{var o;(o=s.native)!=null&&o.shiftKey&&(s.stopPropagation(),e.removeFromSelection(n))}),r.on("graphic-move-start",n=>e.addToHistory(N1(n.allGraphics)))];case"box":return[r.on("graphic-click",n=>this._onTransformOrReshape2DGraphicClick(e,i,n)),r.on("move-start",n=>e.addToHistory(N1(n.graphics))),r.on("rotate-start",n=>e.addToHistory(N1(n.graphics))),r.on("scale-start",n=>e.addToHistory(N1(n.graphics)))];case"reshape":return[r.on("graphic-click",n=>this._onTransformOrReshape2DGraphicClick(e,i,n)),r.on("move-start",n=>e.addToHistory(N1([n.mover]))),r.on("reshape-start",n=>e.addToHistory(N1([n.graphic]))),r.on("vertex-add",n=>e.addToHistory(N1([n.oldGraphic]))),r.on("vertex-remove",n=>e.addToHistory(N1([n.oldGraphic])))];case"move-3d":return[r.on("graphic-move-start",n=>{e.addToHistory(N1(n.allGraphics)),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:n.allGraphics.length>0?n.allGraphics[0]:null,type:"move-start"},type:"update"})}),r.on("graphic-move",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:n.dx,dy:n.dy,mover:n.allGraphics.length>0?n.allGraphics[0]:null,type:"move"},type:"update"})}),r.on("graphic-move-stop",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:n.allGraphics.length>0?n.allGraphics[0]:null,type:"move-stop"},type:"update"})}),r.on("immediate-click",n=>{n.shiftKey?this._toggleSelection([n.graphic],e,i):e.toggleTool()})];case"transform-3d":return[r.on("record-undo",({record:n})=>{e.addToHistory({updates:[n]})}),r.on("graphic-translate-start",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,dx:n.dxScreen,dy:n.dyScreen,type:"move-start"},type:"update"})}),r.on("graphic-translate-stop",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,dx:n.dxScreen,dy:n.dyScreen,type:"move-stop"},type:"update"})}),r.on("graphic-rotate-start",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,angle:n.angle,type:"rotate-start"},type:"update"})}),r.on("graphic-rotate-stop",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,angle:n.angle,type:"rotate-stop"},type:"update"})}),r.on("graphic-scale-start",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,xScale:n.xScale,yScale:n.yScale,type:"scale-start"},type:"update"})}),r.on("graphic-scale-stop",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,xScale:n.xScale,yScale:n.yScale,type:"scale-stop"},type:"update"})}),r.on("graphic-translate",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,dx:n.dxScreen,dy:n.dyScreen,type:"move"},type:"update"})}),r.on("graphic-rotate",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,angle:n.angle,type:"rotate"},type:"update"})}),r.on("graphic-scale",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,xScale:n.xScale,yScale:n.yScale,type:"scale"},type:"update"})}),r.on("immediate-click",n=>{n.shiftKey?this._toggleSelection([n.graphic],e,i):e.toggleTool()})];case"reshape-3d":return[r.on("reshape",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:n,type:"update"})}),r.on("move",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:n,type:"update"})}),r.on("vertex-add",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:n,type:"update"})}),r.on("vertex-remove",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:n,type:"update"})}),r.on("immediate-click",n=>{n.shiftKey?this._toggleSelection([n.graphic],e,i):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,i,r){var o;const{graphic:n,viewEvent:s}=r;return(o=s.native)!=null&&o.shiftKey&&n.layer===this.layer?(s.stopPropagation(),e.removeFromSelection(n)):i.toggleToolOnClick?(s.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,i){var s;this._operationHandle=e;const r=(s=this.view)==null?void 0:s.map;this._disablePopup(i);const n=()=>{if(e===this._operationHandle){const o=this.updateGraphics.toArray(),l=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),r&&r.remove(this._internalGraphicsLayer),this._restorePopup(i),this.emit("update",{graphics:o,state:"complete",aborted:e.cancelled,tool:l,toolEventInfo:null,type:"update"})}};e.on("complete",n)}async _getCommonUpdateOperationClickHandlers(e,i,r){const n=sf(i),s=await i.async(()=>this._getFirstHit(n));if(s==null)return void e.complete();if(i.native.shiftKey&&this._toggleSelection([s.graphic],e,r))return void i.stopPropagation();this.updateGraphics.includes(s.graphic)?i.stopPropagation():e.complete()}_toggleSelection(e,i,r){const n=!!r.multipleSelectionEnabled;return e.some(s=>s!=null&&!(!n||s.layer!==this.layer)&&(this.updateGraphics.includes(s)?i.removeFromSelection(s):i.addToSelection(s),!0))}_getCommonUpdateOperationKeyDownHandlers(e,i){if(!e)return;const r=i.key;r===Oa.undo&&e.canUndo()?(i.stopPropagation(),e.undo()):r===Oa.redo&&e.canRedo()?(i.stopPropagation(),e.redo()):r===Oa.cancel?(i.stopPropagation(),e.cancel()):this.allowDeleteKey&&Oa.delete.includes(r)&&this._onDeleteKey(i)}_onDeleteKey(e){var n;if(!this._operationHandle||this._operationHandle.type!=="update")return;const i=this.activeComponent,r=this.updateGraphics.toArray();i!=null&&i.type!=="reshape-3d"&&(i.type!=="reshape"||r.length===1&&((n=r[0].geometry)==null?void 0:n.type)==="point")&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){var e,i;this._internalGraphicsLayer&&((i=(e=this.view)==null?void 0:e.map)==null||i.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=et(this._internalGraphicsLayer))}_isComponentGraphic(e){var r;const{activeComponent:i}=this;return!(!e||i==null)&&(((r=e.attributes)==null?void 0:r.esriSketchTool)||i.type==="draw-2d"&&i.graphic===e||(i.type==="box"||i.type==="reshape")&&i.isUIGraphic(e))}_displayPointerCursor(){var e;(e=this.view)!=null&&e.container&&this.view.cursor!=="pointer"&&(this.view.cursor="pointer")}_displayGrabbingCursor(){var e;(e=this.view)!=null&&e.container&&this.view.cursor!=="grabbing"&&(this.view.cursor="grabbing")}_displayDefaultCursor(){var e;(e=this.view)!=null&&e.container&&this.view.cursor!==null&&(this.view.cursor=null)}_logError(e,i,r){Ce.getLogger(this).error(new se(e,i,r))}async _requireModule(e){const i=new AbortController;this._moduleLoaderAbortController=i;const r=await e;return this._moduleLoaderAbortController!==i||i.signal.aborted?{requireError:"aborted"}:{module:r}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}get test(){return{operationHandle:this._operationHandle,snappingManager:this._snappingManager,defaultUpdateOptions:VR}}wait(){return rd(()=>!this.updating)}_beginAsyncOperation(){this._numUpdating+=1,this.notifyChange("updating")}_endAsyncOperation(){this._numUpdating-=1,this.notifyChange("updating")}_disablePopupEnabled(e){var i;return((i=this.view)==null?void 0:i.type)!=="3d"||this.updateOnGraphicClick||((e==null?void 0:e.toggleToolOnClick)??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&this._originalPopupEnabled==null&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&this._originalPopupEnabled!=null&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(gn(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await oT(rd(()=>e==null?void 0:e.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",Ixe("view"))}_logMissingLayer(){this._logError(Ujt,Ixe("layer"))}};y([w()],Us.prototype,"updating",null),y([w()],Us.prototype,"_operationHandle",void 0),y([w({readOnly:!0})],Us.prototype,"activeTool",null),y([w()],Us.prototype,"activeFillSymbol",void 0),y([w()],Us.prototype,"activeLineSymbol",void 0),y([w()],Us.prototype,"activeVertexSymbol",void 0),y([w()],Us.prototype,"allowDeleteKey",void 0),y([w({readOnly:!0})],Us.prototype,"createGraphic",null),y([w()],Us.prototype,"defaultCreateOptions",null),y([w()],Us.prototype,"defaultUpdateOptions",null),y([w({type:XVe,nonNullable:!0})],Us.prototype,"labelOptions",void 0),y([w()],Us.prototype,"layer",void 0),y([w({types:py})],Us.prototype,"pointSymbol",void 0),y([w({types:py})],Us.prototype,"polygonSymbol",void 0),y([w({types:py})],Us.prototype,"polylineSymbol",void 0),y([w()],Us.prototype,"meshSymbol",void 0),y([w({type:Lue,nonNullable:!0})],Us.prototype,"snappingOptions",null),y([w()],Us.prototype,"_snappingManager",void 0),y([w({readOnly:!0})],Us.prototype,"state",null),y([w({type:ZVe,nonNullable:!0})],Us.prototype,"tooltipOptions",void 0),y([w({readOnly:!0})],Us.prototype,"updateGraphics",void 0),y([w()],Us.prototype,"updateOnGraphicClick",void 0),y([w({types:py})],Us.prototype,"vertexSymbol",void 0),y([w({value:null})],Us.prototype,"view",null),Us=y([Z("esri.widgets.Sketch.SketchViewModel")],Us);const Ujt="sketch:missing-property",Ixe=t=>`Property '${t}' is missing on SketchViewModel.`;function Vjt(t){return t==="polygon"||t==="rectangle"||t==="circle"}function e7(t,e){SBe("undo",t.history.undo,t.history.redo,e)}function t7(t,e){SBe("redo",t.history.redo,t.history.undo,e)}function SBe(t,e,i,r){const n=e.pop();if(!n)return;const s=n.updates,o=[];r.forEach((l,c)=>{const f=s[c];f!=null&&("geometry"in f&&f.geometry!=null&&(o.push({geometry:l.geometry}),l.geometry=f.geometry),"symbol"in f&&f.symbol!=null&&(o.push({symbol:l.symbol}),l.symbol=f.symbol),"undo"in f&&(o.push(f),f[t](l)))}),i.push({updates:o})}function N1(t){return{updates:t.map(e=>({geometry:e.geometry}))}}function Pa(t){return"requireError"in t&&t.requireError==="aborted"}const TBe=Us,Due=[82,82,122,.9],Nue=[255,255,255,.8],Bjt={type:"polygon-3d",symbolLayers:[{type:"extrude",size:10,material:{color:Nue},edges:{type:"solid",size:"3px",color:Due}}]},jjt={type:"line-3d",symbolLayers:[{type:"line",size:"10px",material:{color:Nue}},{type:"line",size:"3px",material:{color:Due}}]},Gjt={type:"point-3d",symbolLayers:[{type:"icon",size:"30px",resource:{primitive:"kite"},outline:{color:Due,size:"3px"},material:{color:Nue}}]},Hjt=(t,e)=>{const i=document.getElementById("startbuttons"),r=document.getElementById("actionbuttons"),n=document.getElementById("edgeoperationbuttons"),s=document.getElementById("extrudeSliderContainer"),o=new NG({container:"extrudeSlider",precision:1,min:0,max:500,steps:1,values:[10],visibleElements:{rangeLabels:!0}}),l=new TBe({layer:e,view:t,pointSymbol:Gjt,polygonSymbol:Bjt,polylineSymbol:jjt,defaultCreateOptions:{hasZ:!0},snappingOptions:{enabled:!0,featureSources:[{layer:e}]},tooltipOptions:{enabled:!0},labelOptions:{enabled:!0},defaultUpdateOptions:{tool:"transform",enableScaling:!0,enableZ:!0}});l.on("create",H=>{H.state==="complete"&&(i.style.display="inline",r.style.display="none",l.update(H.graphic)),H.state==="cancel"&&(i.style.display="inline",r.style.display="none")}),l.on("update",H=>{H.state==="start"&&(i.style.display="none",r.style.display="inline",(H.graphics[0].geometry.type==="polygon"||H.graphics[0].geometry.type==="polyline")&&(n.style.display="inline"),H.graphics[0].geometry.type==="polyline"&&(s.style.display="none")),H.state==="complete"&&(i.style.display="inline",r.style.display="none",n.style.display="none")});const c=Array.prototype.slice.call(document.getElementsByClassName("starttool")),f=document.getElementById("cancel"),_=document.getElementById("done");c.forEach(H=>{H.addEventListener("click",Y=>{l.create(Y.target.getAttribute("data-type")),i.style.display="none",r.style.display="inline"})}),f.addEventListener("click",H=>{l.cancel()}),_.addEventListener("click",H=>{l.updateGraphics.length!==0?l.complete():l.cancel()}),o.on(["thumb-change","thumb-drag"],x);function x(H){const Y=H.value;document.getElementById("extrude").innerHTML=Y;const Q=l.layer.graphics.getItemAt(l.layer.graphics.length-1),ne=Q.symbol.clone();ne.symbolLayers.items[0].size=Y,Q.symbol=ne}let T="split",A="move";const M=document.getElementById("none-edge-button"),I=document.getElementById("split-edge-button"),L=document.getElementById("offset-edge-button");M.onclick=F,I.onclick=F,L.onclick=F;function F(H){T=H.target.value;const Y=document.getElementsByClassName("edge-button");for(const Q of Y)Q.classList.remove("edge-button-selected");this.classList.add("edge-button-selected"),j({reshapeOptions:{edgeOperation:T,shapeOperation:A}})}const z=document.getElementById("none-shape-button"),k=document.getElementById("move-shape-button");z.onclick=U,k.onclick=U;function U(H){A=H.target.value;const Y=document.getElementsByClassName("shape-button");for(const Q of Y)Q.classList.remove("shape-button-selected");this.classList.add("shape-button-selected"),j({reshapeOptions:{edgeOperation:T,shapeOperation:A}})}function j(H){l.defaultUpdateOptions={...l.defaultUpdateOptions,...H},l.activeTool&&(l.activeTool==="transform"||l.activeTool==="move"||l.activeTool==="reshape")&&(H.tool=l.activeTool,l.update(l.updateGraphics.toArray(),H))}},mv="esri-daylight",$X=`${mv}__container`,nA="esri-slider",Bc={base:mv,widgetIcon:si.environmentSettings,datePickerCalendarToggle:"esri-date-picker__calendar-toggle",dayContainer:`${$X} ${mv}__day-container`,dateContainer:`${$X} ${mv}__date-container`,containerDisabled:`${$X}--disabled`,slider:nA,sliderShadowOff:`${nA}--shadow-off`,sliderShadowOn:`${nA}--shadow-on`,sliderAmPmOn:`${nA}--ampm-on`,sliderDateOff:`${nA}--date-off`,sliderDateOn:`${nA}--date-on`,playPauseButton:`${mv}__play-pause-button`,seasonPicker:`${mv}__season-picker`,panelError:`${mv}__panel--error`,sunLightingCheckbox:`${mv}__sun-lighting-checkbox`,shadowsCheckbox:`${mv}__shadows-checkbox`};var wy;(function(t){t[t.NORTHERN=0]="NORTHERN",t[t.SOUTHERN=1]="SOUTHERN"})(wy||(wy={}));const qjt={spring:{dayOfMonth:20,month:2},summer:{dayOfMonth:21,month:5},fall:{dayOfMonth:23,month:8},winter:{dayOfMonth:21,month:11}},Ire=["spring","summer","fall","winter"];function NI(t,e,i){const r=Fue(e,i),{dayOfMonth:n,month:s}=qjt[r],o=new Date(t.getTime());return o.setMonth(s,n),o}function Wjt(t,e){return Fue(Yjt(t),e)}function Yjt(t){const e=t.getTime(),i=NI(t,"spring",wy.NORTHERN).getTime(),r=NI(t,"summer",wy.NORTHERN).getTime(),n=NI(t,"fall",wy.NORTHERN).getTime(),s=NI(t,"winter",wy.NORTHERN).getTime();return e>=i&&e=r&&e=n&&e=x&&c<=T?I=c-x<=12e5?18e5-(c-x)/12e5*16e5:T-c<=12e5/2?3e5-(T-c)/12e5*2*1e5:2e5:c>=A&&c<=M?I=c-A<=12e5/2?3e5-(c-A)/12e5*2*1e5:M-c<=12e5?18e5-(M-c)/12e5*16e5:2e5:(c_)&&(I=18e5),I}let nT=class extends lUe{constructor(){super(...arguments),this.utcOffset=null,this.timezonePickerOpen=!1}};y([w()],nT.prototype,"utcOffset",void 0),y([w()],nT.prototype,"timezonePickerOpen",void 0),nT=y([Z("esri.widgets.Daylight.support.SliderWithDropdownViewModel")],nT);let FI=class extends ze{constructor(){super(...arguments),this.state="ready",this.value=new Date}};y([w()],FI.prototype,"state",void 0),y([w()],FI.prototype,"value",void 0),FI=y([Z("esri.widgets.support.DateTimeElementViewModel")],FI);const Qjt=FI;let $re=class extends Qjt{constructor(e){super(e)}};$re=y([Z("esri.widgets.support.DatePickerViewModel")],$re);const HG=$re,eGt={hour:"2-digit",minute:"2-digit",timeZone:"UTC"},tGt={hour:"numeric",timeZone:"UTC"};function Lre(t,e){let i;if(e==="tick"){const n=Math.round(Gs(t,"minutes","hours"));i=new Date(Gs(n,"hours","milliseconds"))}else i=new Date(6e4*t);let r=js(i,eGt);return t!==0&&r==="00:00"&&(r="24:00"),e==="tick"&&r.includes(" ")&&(r=js(i,tGt),r=r.replace(":00","")),r}function iGt(t,e,i,r){if(e==null||i==null)return null;const n=G2.getTimes(t,e,i),s=n.sunrise,o=n.sunset,l=Pf(t,r,"hours"),c=Pf(s,r,"hours"),f=Pf(o,r,"hours");if(l.getUTCDate()!==c.getUTCDate()||l.getUTCDate()!==f.getUTCDate()){const _=l.getTime()-c.getTime()>0?1:-1;s.setUTCDate(s.getUTCDate()+_),o.setUTCDate(o.getUTCDate()+_)}return{sunrise:s,sunset:o}}function rGt(t){return[{utcOffset:-12,short:"UTC-12",long:t.timezoneDateline},{utcOffset:-11,short:"UTC-11",long:t.timezoneSamoa},{utcOffset:-10,short:t.timezoneHAST,long:t.timezoneHawaii},{utcOffset:-9,short:t.timezoneAKST,long:t.timezoneAlaska},{utcOffset:-8,short:t.timezonePST,long:t.timezoneBaja},{utcOffset:-7,short:t.timezoneMST,long:t.timezoneMountain},{utcOffset:-7,short:t.timezoneMST,long:t.timezoneLaPaz},{utcOffset:-7,short:t.timezoneMST,long:t.timezoneArizona},{utcOffset:-6,short:t.timezoneCST,long:t.timezoneSaskatchewan},{utcOffset:-6,short:t.timezoneCST,long:t.timezoneCentralAmerica},{utcOffset:-6,short:t.timezoneCST,long:t.timezoneCentralTime},{utcOffset:-6,short:t.timezoneCST,long:t.timezoneMexico},{utcOffset:-5,short:t.timezoneEST,long:t.timezoneEasternUS},{utcOffset:-5,short:t.timezoneEST,long:t.timezoneLima},{utcOffset:-5,short:t.timezoneEST,long:t.timezoneIndiana},{utcOffset:-4,short:null,long:t.timezoneAtlantic},{utcOffset:-4,short:null,long:t.timezoneCuiaba},{utcOffset:-4,short:null,long:t.timezoneSantiago},{utcOffset:-4,short:null,long:t.timezoneManaus},{utcOffset:-4,short:null,long:t.timezoneAsuncion},{utcOffset:-3,short:null,long:t.timezoneBrasilia},{utcOffset:-3,short:null,long:t.timezoneGreenland},{utcOffset:-3,short:null,long:t.timezoneMontevideo},{utcOffset:-3,short:null,long:t.timezoneCayenne},{utcOffset:-3,short:null,long:t.timezoneBuenosAires},{utcOffset:-2,short:null,long:t.timezoneMidAtlantic},{utcOffset:-1,short:null,long:t.timezoneAzores},{utcOffset:-1,short:null,long:t.timezoneCaboVerde},{utcOffset:0,short:null,long:t.timezoneDublin},{utcOffset:0,short:null,long:t.timezoneReykjavik},{utcOffset:0,short:null,long:t.timezoneCasablanca},{utcOffset:1,short:t.timezoneCET,long:t.timezoneBelgrade},{utcOffset:1,short:t.timezoneCET,long:t.timezoneSarajevo},{utcOffset:1,short:t.timezoneCET,long:t.timezoneBrussels},{utcOffset:1,short:t.timezoneCET,long:t.timezoneWCAfrica},{utcOffset:1,short:t.timezoneCET,long:t.timezoneAmsterdam},{utcOffset:1,short:t.timezoneCET,long:t.timezoneWindhoek},{utcOffset:2,short:t.timezoneEET,long:t.timezoneMinsk},{utcOffset:2,short:t.timezoneEET,long:t.timezoneCairo},{utcOffset:2,short:t.timezoneEET,long:t.timezoneHelsinki},{utcOffset:2,short:t.timezoneEET,long:t.timezoneAthens},{utcOffset:2,short:t.timezoneEET,long:t.timezoneJerusalem},{utcOffset:2,short:t.timezoneEET,long:t.timezoneAmman},{utcOffset:2,short:t.timezoneEET,long:t.timezoneBeirut},{utcOffset:2,short:t.timezoneEET,long:t.timezoneHarare},{utcOffset:2,short:t.timezoneEET,long:t.timezoneDamascus},{utcOffset:2,short:t.timezoneEET,long:t.timezoneIstanbul},{utcOffset:3,short:t.timezoneMSK,long:t.timezoneKuwait},{utcOffset:3,short:t.timezoneMSK,long:t.timezoneBaghdad},{utcOffset:3,short:t.timezoneMSK,long:t.timezoneNairobi},{utcOffset:3,short:t.timezoneMSK,long:t.timezoneKaliningrad},{utcOffset:4,short:t.timezoneGST,long:t.timezoneMoscow},{utcOffset:4,short:t.timezoneGST,long:t.timezoneMuscat},{utcOffset:4,short:t.timezoneGST,long:t.timezoneBaku},{utcOffset:4,short:t.timezoneGST,long:t.timezoneYerevan},{utcOffset:4,short:t.timezoneGST,long:t.timezoneTbilisi},{utcOffset:4,short:t.timezoneGST,long:t.timezonePortLouis},{utcOffset:5,short:null,long:t.timezoneTashkent},{utcOffset:5,short:null,long:t.timezoneIslamabad},{utcOffset:6,short:null,long:t.timezoneEkaterinburg},{utcOffset:6,short:null,long:t.timezoneAstana},{utcOffset:6,short:null,long:t.timezoneDhaka},{utcOffset:7,short:t.timezoneICT,long:t.timezoneNovosibirsk},{utcOffset:7,short:t.timezoneICT,long:t.timezoneBangkok},{utcOffset:8,short:t.timezoneCCT,long:t.timezoneKrasnoyarsk},{utcOffset:8,short:t.timezoneCCT,long:t.timezoneBeijing},{utcOffset:8,short:t.timezoneCCT,long:t.timezoneSingapore},{utcOffset:8,short:t.timezoneCCT,long:t.timezoneTaipei},{utcOffset:8,short:t.timezoneCCT,long:t.timezonePerth},{utcOffset:8,short:t.timezoneCCT,long:t.timezoneUlaanbaatar},{utcOffset:9,short:t.timezoneJST,long:t.timezoneIrkutsk},{utcOffset:9,short:t.timezoneJST,long:t.timezoneSeoul},{utcOffset:9,short:t.timezoneJST,long:t.timezoneOsaka},{utcOffset:10,short:t.timezoneAEST,long:t.timezoneYakutsk},{utcOffset:10,short:t.timezoneAEST,long:t.timezoneCanberra},{utcOffset:10,short:t.timezoneAEST,long:t.timezoneBrisbane},{utcOffset:10,short:t.timezoneAEST,long:t.timezoneHobart},{utcOffset:10,short:t.timezoneAEST,long:t.timezoneGuam},{utcOffset:11,short:null,long:t.timezoneVladivostok},{utcOffset:11,short:null,long:t.timezoneSolomon},{utcOffset:12,short:t.timezoneNZST,long:t.timezoneMagadan},{utcOffset:12,short:t.timezoneNZST,long:t.timezoneFiji},{utcOffset:12,short:t.timezoneNZST,long:t.timezoneAuckland},{utcOffset:12,short:t.timezoneNZST,long:t.timezoneNukualofa}].map(({utcOffset:e,short:i,long:r})=>{const n=e>0?`UTC+${e}`:e<0?`UTC${e}`:"GMT";return i?{utcOffset:e,short:i,shortWithUTC:`${n} (${i})`,long:r}:{utcOffset:e,short:n,shortWithUTC:n,long:r}})}const EBe="esri.widgets.Daylight.DaylightViewModel";let hs=class extends ze{constructor(e){super(e),this.view=null,this.datePickerViewModel=new HG,this.timeSliderViewModel=new nT({min:0,max:1439,values:[0],labelFormatFunction:Lre,inputFormatFunction:Lre}),this.lightingUpdateInterval=200,this._oldLighting=null,this.playSpeedMultiplier=1,this._lastTime=null,this._sunrise=null,this._sunset=null,this._cachedLightingDateUTC=new Date(0),this._cachedDisplayUTCOffset=0,this._firstInteraction=!0,this._lastLightingUpdate=0,this._lightingUpdateHandle=null}initialize(){this.addHandles([Mo(()=>this.view,e=>e.when(()=>this._updateLighting()),ii),_e(()=>{const e=this._lighting;return(e==null?void 0:e.type)==="sun"?i7(e):null},e=>this._scheduleLightingUpdate(e)),Jr(()=>this._lighting,"timezone-will-change",e=>this._timezoneWillChange(e),{onListenerAdd:()=>this._timezoneWillChange(null)}),_e(()=>{var e;return((e=this.view)==null?void 0:e.stationary)===!0},()=>{(this.dayPlaying||this.yearPlaying)&&this._updateSunriseAndSunset()},ii),_e(()=>{const e=this.timeSliderViewModel;return{vm:e,state:e.state,sliderPosition:this.timeSliderPosition}},({vm:e,state:i,sliderPosition:r})=>{i==="ready"&&e.setValue(0,r)}),_e(()=>{var e;return(e=this.timeSliderViewModel)==null?void 0:e.utcOffset},e=>{e!=null&&(this.utcOffset=e)}),_e(()=>({utcOffset:this.utcOffset,sliderViewModel:this.timeSliderViewModel}),({utcOffset:e,sliderViewModel:i})=>{i&&(i.utcOffset=e)},kt),_e(()=>this.timeSliderViewModel.timezonePickerOpen,()=>this.stopPlaying()),_e(()=>this.timeSliderViewModel.values,e=>this._setTimeSliderPosition((e==null?void 0:e[0])??0,{forceLightingUpdate:!1})),_e(()=>this.datePickerViewModel.value,e=>{this.dayPlaying=!1,this.localDate=e}),_e(()=>this.localDate,e=>{this.datePickerViewModel.value.valueOf()!==e.getTime()&&this.datePickerViewModel.set("value",e)})])}destroy(){this._cancelLightingUpdate(),this.view=null}get isSupported(){return this.view==null||this.view.type==="3d"}get utcOffset(){return this._cachedDisplayUTCOffset}set utcOffset(e){e!==this.utcOffset&&this._lighting!=null&&this._lighting.type!=="virtual"&&(this._lighting.displayUTCOffset=e,this._updateLighting())}get localDate(){return cot(this._lightingDateDisplay)}set localDate(e){tF(e)&&e.getTime()!==this.localDate.getTime()&&(this._lightingDateDisplay=lot(this._lightingDateDisplay,e))}get timeSliderPosition(){return Jjt(this._lightingDateDisplay)}set timeSliderPosition(e){this._setTimeSliderPosition(e,{forceLightingUpdate:!0})}_setTimeSliderPosition(e,i){Math.abs(e-this.timeSliderPosition)<=1/60||(this.stopPlaying(),this._enableDirectShadowsIfFirstInteraction(),i.forceLightingUpdate&&(this._cancelLightingUpdate(),this._updateLighting()),this._lightingDateDisplay=Zjt(this._lightingDateDisplay,e))}_timezoneFromCamera(e,i){if(i==null||!e.cameraTrackingEnabled)return 0;const r=bee([i.longitude,i.latitude]);return r==null?0:Math.round(r.hours+r.minutes/60+r.seconds/3600)}get directShadowsEnabled(){var e;return((e=this._lighting)==null?void 0:e.directShadowsEnabled)??!1}set directShadowsEnabled(e){const i=this._lighting;i&&(i.directShadowsEnabled=e)}get sunLightingEnabled(){return this._lightingType==="sun"}set sunLightingEnabled(e){const i=this._environment;if(e===this._get("sunLightingEnabled")||i==null)return;const r=i.lighting,n=this._oldLighting;this._oldLighting=r;const s={directShadowsEnabled:r.directShadowsEnabled,cameraTrackingEnabled:r.cameraTrackingEnabled},o=e?"sun":"virtual";let l;l=n!=null&&n.type===o?n:e?new Rv:new $M,l.set(s),i.lighting=l,e||(this.stopPlaying(),this.timeSliderViewModel.timezonePickerOpen=!1)}set playingState(e){this.playingState!==e&&(this._set("playingState",e),e!=="none"&&this.sunLightingEnabled&&(this._updateSunriseAndSunset(),this._lastTime=Date.now(),this._play(),this._enableDirectShadowsIfFirstInteraction()))}get dayPlaying(){return this.playingState==="day"}set dayPlaying(e){e?this.playingState="day":this.dayPlaying&&(this.playingState="none")}get yearPlaying(){return this.playingState==="year"}set yearPlaying(e){e?this.playingState="year":this.yearPlaying&&(this.playingState="none")}get currentSeason(){return Wjt(this.localDate,this._currentHemisphere)}set currentSeason(e){this.stopPlaying();const i=Fue(e,this._currentHemisphere);this.localDate=NI(this.localDate,i,wy.NORTHERN)}get _currentHemisphere(){var i,r,n;const e=(n=(r=(i=this.view)==null?void 0:i.camera)==null?void 0:r.position)==null?void 0:n.latitude;return e==null||e>=0?wy.NORTHERN:wy.SOUTHERN}get _environment(){var e;return(e=this.view)==null?void 0:e.environment}get _lighting(){var e;return(e=this._environment)==null?void 0:e.lighting}get _lightingType(){var e;return(e=this._lighting)==null?void 0:e.type}get _lightingDateDisplay(){return Pf(this._cachedLightingDateUTC,this._cachedDisplayUTCOffset,"hours")}set _lightingDateDisplay(e){const i=this._lighting;if(i==null||!this.sunLightingEnabled||i.type==="virtual"||!tF(e))return;const r=i7(i),n=Pf(e,-this._cachedDisplayUTCOffset,"hours");n.getTime()!==r.getTime()&&(i.date=n,this._updateLighting())}stopPlaying(){this.playingState="none"}toggleDayPlaying(){this.dayPlaying=!this.dayPlaying}toggleYearPlaying(){this.yearPlaying=!this.yearPlaying}toggleSunLightingEnabled(){this.stopPlaying(),this.sunLightingEnabled=!this.sunLightingEnabled}toggleDirectShadowsEnabled(){this.stopPlaying(),this.directShadowsEnabled=!this.directShadowsEnabled}_enableDirectShadowsIfFirstInteraction(){this._firstInteraction&&(this._firstInteraction=!1,this.directShadowsEnabled=!0)}_updateLighting(e){var l;const i=Date.now();this._lastLightingUpdate=i;const{view:r}=this,n=this._lighting;if(r==null||n==null||n.type==="virtual")return;e??(e=i7(n));const s=n.displayUTCOffset,o=s!==null?s:this._timezoneFromCamera(n,(l=r.camera)==null?void 0:l.position);this._cachedLightingDateUTC.getTime()!==e.getTime()&&(this._cachedLightingDateUTC=new Date(e.getTime())),this._cachedDisplayUTCOffset!==o&&(this._cachedDisplayUTCOffset=o)}_timezoneWillChange(e){const i=this._lighting;if(i==null||i.type==="virtual"||!i.cameraTrackingEnabled)return;let r;if(e)r=e.timezoneOffset;else{if(i.displayUTCOffset!=null)return;r=Rv.calculateTimezoneOffset(i.positionTimezoneInfo)}i.displayUTCOffset=r,this._scheduleLightingUpdate()}_scheduleLightingUpdate(e){if(e&&(this._lightingUpdateHandle=en(this._lightingUpdateHandle),!tF(e))||this._lightingUpdateHandle)return;const i=Date.now()-this._lastLightingUpdate,r=this.lightingUpdateInterval-i;let n=null;const s=()=>{this._updateLighting(e),this._lightingUpdateHandle===n&&(this._lightingUpdateHandle=null)};if(r<=0)this._lightingUpdateHandle=n=tx(s);else{const o=setTimeout(s,r);this._lightingUpdateHandle=n=rr(()=>clearTimeout(o))}}_cancelLightingUpdate(){this._lightingUpdateHandle=en(this._lightingUpdateHandle)}_play(){const e=this._lighting;if(e==null||!this.sunLightingEnabled||e.type==="virtual")return;const i=i7(e);if(this.dayPlaying||this.yearPlaying){const r=Date.now()-(this._lastTime??0);if(this.dayPlaying){this._lastTime=Date.now();const n=Kjt(this._sunrise,this._sunset,i)*this.playSpeedMultiplier/100*r;if(n>0){let s=new Date(i.getTime()+n);const o=e.displayUTCOffset??0;((s.getUTCHours()+o)%24+24)%24<((i.getUTCHours()+o)%24+24)%24&&(s=new Date(i.getTime()+n-864e5)),e.date=s}}else if(r>1e3){this._lastTime=Date.now();const n=(i.getUTCMonth()+1)%12,s=new Date(i.getTime());s.setUTCMonth(n),e.date=s}requestAnimationFrame(()=>this._play())}}_updateSunriseAndSunset(){var c,f;const e=this._lighting;if(e==null||e.type==="virtual"||!this.sunLightingEnabled)return;const i=(f=(c=this.view)==null?void 0:c.camera)==null?void 0:f.position;if(i==null)return;const{latitude:r,longitude:n}=i,{date:s,displayUTCOffset:o}=e,l=iGt(s,r,n,o??0);l&&(this._sunrise=new Date(l.sunrise),this._sunset=new Date(l.sunset))}};function i7(t){return tF(t.date)||(Ce.getLogger(EBe).warn("Invalid date. Reverting to the current date/time."),t.date=new Date),t.date}y([w({type:Aze})],hs.prototype,"view",void 0),y([w({type:HG,nonNullable:!0})],hs.prototype,"datePickerViewModel",void 0),y([w({type:nT,nonNullable:!0})],hs.prototype,"timeSliderViewModel",void 0),y([w()],hs.prototype,"isSupported",null),y([w()],hs.prototype,"lightingUpdateInterval",void 0),y([w()],hs.prototype,"utcOffset",null),y([w()],hs.prototype,"localDate",null),y([w()],hs.prototype,"timeSliderPosition",null),y([w()],hs.prototype,"directShadowsEnabled",null),y([w()],hs.prototype,"sunLightingEnabled",null),y([w({type:["none","day","year"],value:"none"})],hs.prototype,"playingState",null),y([w()],hs.prototype,"dayPlaying",null),y([w()],hs.prototype,"yearPlaying",null),y([w()],hs.prototype,"playSpeedMultiplier",void 0),y([w()],hs.prototype,"currentSeason",null),y([w()],hs.prototype,"_lastTime",void 0),y([w()],hs.prototype,"_sunrise",void 0),y([w()],hs.prototype,"_sunset",void 0),y([w()],hs.prototype,"_cachedLightingDateUTC",void 0),y([w()],hs.prototype,"_cachedDisplayUTCOffset",void 0),y([w()],hs.prototype,"_firstInteraction",void 0),y([w()],hs.prototype,"_currentHemisphere",null),y([w()],hs.prototype,"_environment",null),y([w()],hs.prototype,"_lighting",null),y([w()],hs.prototype,"_lightingType",null),y([w()],hs.prototype,"_lightingDateDisplay",null),hs=y([Z(EBe)],hs);const CBe=hs;let gv=class extends ze{constructor(e){super(e),this.header=!0,this.playButtons=!0,this.datePicker=!0,this.timezone=!0,this.sunLightingToggle=!0,this.shadowsToggle=!0}};y([w({type:Boolean,nonNullable:!0})],gv.prototype,"header",void 0),y([w({type:Boolean,nonNullable:!0})],gv.prototype,"playButtons",void 0),y([w({type:Boolean,nonNullable:!0})],gv.prototype,"datePicker",void 0),y([w({type:Boolean,nonNullable:!0})],gv.prototype,"timezone",void 0),y([w({type:Boolean,nonNullable:!0})],gv.prototype,"sunLightingToggle",void 0),y([w({type:Boolean,nonNullable:!0})],gv.prototype,"shadowsToggle",void 0),gv=y([Z("esri.widgets.Daylight.VisibleElements")],gv);const ABe=gv,r7="esri-timezone-picker",BR={base:r7,trigger:`${r7}__trigger`,itemTitle:`${r7}__item-title`,itemDescription:`${r7}__item_description`};let qd=class extends cn{constructor(e,i){super(e,i),this.value=null,this.onChange=null,this.open=!1,this.onOpen=null,this.onClose=null,this._selectedId=null,this._onOpen=()=>{var r;this.open=!0,(r=this.onOpen)==null||r.call(this)},this._onClose=()=>{var r;this.open=!1,(r=this.onClose)==null||r.call(this)},this._killEvent=r=>(r.stopPropagation(),!0),this._onChange=r=>{var l,c,f;const n=r.target,s=(l=n.selectedItems)==null?void 0:l[0].getAttribute("data-id"),o=(c=$xe(this._gmtOffsets,s))==null?void 0:c.utcOffset;o&&(this._selectedId=s,(f=this.onChange)==null||f.call(this,o))}}loadDependencies(){return Pl({button:()=>we(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([234,235,236,237,238,239,240,241,242,243,244,245,246,247])),dropdown:()=>we(()=>import("./calcite-dropdown-caxGPYrb.js"),__vite__mapDeps([279,252,253,247,237,241,239,242,254])),"dropdown-group":()=>we(()=>import("./calcite-dropdown-group-bJt5U1w-.js"),__vite__mapDeps([280,242,281])),"dropdown-item":()=>we(()=>import("./calcite-dropdown-item-HvBJs5CH.js"),__vite__mapDeps([282,281,239,243,245,242]))})}render(){const e=this._messages;if(!e)return X("div",{class:BR.base,key:"empty"});const i=this._selectedItem,r=Dre(i);return X("div",{class:BR.base,key:"container",onpointerdown:this._killEvent},X("calcite-dropdown",{open:this.open,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",onCalciteDropdownClose:this._onClose,onCalciteDropdownOpen:this._onOpen,onCalciteDropdownSelect:this._onChange},X("calcite-button",{appearance:"transparent",class:BR.trigger,key:"trigger",kind:"neutral",scale:"s",slot:"trigger",tabIndex:0,title:e.chooseTimezone},(i==null?void 0:i.short)??""),X("calcite-dropdown-group",{selectionMode:"single"},this._gmtOffsets.map(n=>{const s=Dre(n);return X("calcite-dropdown-item",{"data-id":s,key:s,selected:r===s},X("div",{class:BR.itemTitle,key:"title"},n.shortWithUTC),X("div",{class:BR.itemDescription,key:"description"},n.long))}))))}get _gmtOffsets(){const e=this._messages;return e?rGt(e):[]}get _selectedItem(){const e=this._gmtOffsets,i=this.value,r=$xe(e,this._selectedId);return(r==null?void 0:r.utcOffset)===i?r:nGt(e,i)}};function $xe(t,e){return t.find(i=>Dre(i)===e)}function nGt(t,e){return t.find(i=>i.utcOffset===e)}function Dre(t){return t?`${t.utcOffset}-${t.long}`:void 0}y([w()],qd.prototype,"value",void 0),y([w()],qd.prototype,"onChange",void 0),y([w()],qd.prototype,"open",void 0),y([w()],qd.prototype,"onOpen",void 0),y([w()],qd.prototype,"onClose",void 0),y([w(),Gr("esri/widgets/support/t9n/timezone")],qd.prototype,"_messages",void 0),y([w()],qd.prototype,"_gmtOffsets",null),y([w()],qd.prototype,"_selectedItem",null),y([w()],qd.prototype,"_selectedId",void 0),qd=y([Z("esri.widgets.support.TimezonePicker")],qd);const LX="esri-slider-with-dropdown",n7={label:"esri-slider__label",box:`${LX}__box`,boxDropDownOn:`${LX}__box--drop-down-on`,boxDropDownOff:`${LX}__box--drop-down-off`};let fM=class extends NG{constructor(e,i){super(e,i),this.viewModel=new nT,this.showDropDown=!0,this._labelWidth=0,this._onLabelAfterCreate=r=>{const n="label-size-observer";this.removeHandles(n),this.addHandles(aB(r,({contentRect:s})=>{this._labelWidth=s.width}),n)},this._getLabelStyles=()=>{if(!this.trackElement)return;const r=this._trackWidth,n=this._labelWidth/2,s=this.getCurrentPosition(),o=s-n,l=s+n;let c=-n;return o<0?c+=-o:l>r&&(c+=r-l),{left:`${c}px`}},this._onTimezoneChange=r=>{this.viewModel.utcOffset=r},this._onTimezonePickerOpen=()=>{this.viewModel.timezonePickerOpen=!0},this._onTimezonePickerClose=()=>{this.viewModel.timezonePickerOpen=!1}}renderThumbLabel(e){const{showDropDown:i,viewModel:r}=this;return X("div",{afterCreate:this._onLabelAfterCreate,class:this.classes({[n7.box]:!0,[n7.label]:!0,[n7.boxDropDownOn]:i,[n7.boxDropDownOff]:!i}),key:"thumb-label",styles:this._getLabelStyles()},super.renderThumbLabel(e),i?X(qd,{open:r.timezonePickerOpen,value:r.utcOffset,onChange:this._onTimezoneChange,onClose:this._onTimezonePickerClose,onOpen:this._onTimezonePickerOpen}):null)}};y([w()],fM.prototype,"viewModel",void 0),y([w()],fM.prototype,"showDropDown",void 0),y([w()],fM.prototype,"_labelWidth",void 0),fM=y([Z("esri.widgets.Daylight.support.SliderWithDropdown")],fM);const sGt=fM;function oGt(t,e){const i=ZTe(e),r=Date.now(),n=i.formatToParts(r),s=new Set;n.filter(({type:f})=>f==="literal").forEach(({value:f})=>s.add(f));let o=0;const l={};for(;n.length>0;){const{type:f,value:_}=n.shift();for(let x=0;x<_.length;x++,o++){const T=t.charAt(o);if(s.has(T)){o++;break}if(f==="literal")break;l[f]||(l[f]=[]),l[f].push(T)}}const c={};try{c.day=DX(l.day.join("")),c.month=DX(l.month.join("")),c.year=DX((l.year||l.relatedYear).join(""))}catch{throw Lxe(e)}if(isNaN(c.day)||isNaN(c.month)||isNaN(c.year))throw Lxe(e);return c}function DX(t){const e=[/٠/g,/١/g,/٢/g,/٣/g,/٤/g,/٥/g,/٦/g,/٧/g,/٨/g,/٩/g];for(let i=0;i<10;i++)t=t.replace(e[i],i.toString());return Number(t)}function Lxe(t){return new se(`could not parse date input, expecting the following format: ${js(Date.now(),t)}`)}const jR={ar:6,"ar-dz":6,"ar-kw":6,"ar-ly":6,"ar-ma":1,"ar-sa":7,"ar-tn":1,bg:1,bs:1,ca:1,cs:1,da:1,de:1,"de-at":1,"de-ch":1,el:1,"en-au":1,"en-ca":7,"en-gb":1,"en-ie":1,"en-il":7,"en-in":7,"en-nz":1,"en-sg":7,es:1,"es-do":7,"es-mx":7,"es-us":7,et:1,fi:1,fr:1,"fr-ca":7,"fr-ch":1,he:7,hr:1,hu:1,id:7,it:1,"it-ch":1,ja:7,ko:7,lt:1,lv:1,nb:1,nl:1,"nl-be":1,pl:1,pt:7,"pt-br":7,ro:1,ru:1,sk:1,sl:1,sr:1,"sr-cyrl":1,sv:1,th:7,tr:1,uk:1,vi:1,"zh-cn":1,"zh-hk":7,"zh-mo":7,"zh-tw":7},aGt="Locale"in Intl&&"weekInfo"in Intl.Locale.prototype;function MBe(t){if(t=t.toLowerCase(),jR[t])return jR[t];if(aGt)try{const i=new Intl.Locale(t).weekInfo.firstDay;return jR[t]=i,i}catch{}const e=lne(t);return jR[e]?jR[e]:7}function lGt(t,e){return(e+7-MBe(t))%7}var Qh="top",r0="bottom",n0="right",ed="left",kue="auto",b6=[Qh,r0,n0,ed],B5="start",s9="end",cGt="clippingParents",OBe="viewport",GR="popper",uGt="reference",Dxe=b6.reduce(function(t,e){return t.concat([e+"-"+B5,e+"-"+s9])},[]),PBe=[].concat(b6,[kue]).reduce(function(t,e){return t.concat([e,e+"-"+B5,e+"-"+s9])},[]),hGt="beforeRead",dGt="read",pGt="afterRead",fGt="beforeMain",mGt="main",gGt="afterMain",yGt="beforeWrite",vGt="write",_Gt="afterWrite",bGt=[hGt,dGt,pGt,fGt,mGt,gGt,yGt,vGt,_Gt];function t1(t){return t?(t.nodeName||"").toLowerCase():null}function Ep(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function nE(t){var e=Ep(t).Element;return t instanceof e||t instanceof Element}function Ff(t){var e=Ep(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function zue(t){if(typeof ShadowRoot>"u")return!1;var e=Ep(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function wGt(t){var e=t.state;Object.keys(e.elements).forEach(function(i){var r=e.styles[i]||{},n=e.attributes[i]||{},s=e.elements[i];!Ff(s)||!t1(s)||(Object.assign(s.style,r),Object.keys(n).forEach(function(o){var l=n[o];l===!1?s.removeAttribute(o):s.setAttribute(o,l===!0?"":l)}))})}function xGt(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach(function(r){var n=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:i[r]),l=o.reduce(function(c,f){return c[f]="",c},{});!Ff(n)||!t1(n)||(Object.assign(n.style,l),Object.keys(s).forEach(function(c){n.removeAttribute(c)}))})}}const SGt={name:"applyStyles",enabled:!0,phase:"write",fn:wGt,effect:xGt,requires:["computeStyles"]};function Ny(t){return t.split("-")[0]}var ET=Math.max,FV=Math.min,j5=Math.round;function Nre(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function RBe(){return!/^((?!chrome|android).)*safari/i.test(Nre())}function G5(t,e,i){e===void 0&&(e=!1),i===void 0&&(i=!1);var r=t.getBoundingClientRect(),n=1,s=1;e&&Ff(t)&&(n=t.offsetWidth>0&&j5(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&j5(r.height)/t.offsetHeight||1);var o=nE(t)?Ep(t):window,l=o.visualViewport,c=!RBe()&&i,f=(r.left+(c&&l?l.offsetLeft:0))/n,_=(r.top+(c&&l?l.offsetTop:0))/s,x=r.width/n,T=r.height/s;return{width:x,height:T,top:_,right:f+x,bottom:_+T,left:f,x:f,y:_}}function Uue(t){var e=G5(t),i=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:r}}function IBe(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&zue(i)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function M_(t){return Ep(t).getComputedStyle(t)}function TGt(t){return["table","td","th"].indexOf(t1(t))>=0}function gx(t){return((nE(t)?t.ownerDocument:t.document)||window.document).documentElement}function qG(t){return t1(t)==="html"?t:t.assignedSlot||t.parentNode||(zue(t)?t.host:null)||gx(t)}function Nxe(t){return!Ff(t)||M_(t).position==="fixed"?null:t.offsetParent}function EGt(t){var e=/firefox/i.test(Nre()),i=/Trident/i.test(Nre());if(i&&Ff(t)){var r=M_(t);if(r.position==="fixed")return null}var n=qG(t);for(zue(n)&&(n=n.host);Ff(n)&&["html","body"].indexOf(t1(n))<0;){var s=M_(n);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return n;n=n.parentNode}return null}function w6(t){for(var e=Ep(t),i=Nxe(t);i&&TGt(i)&&M_(i).position==="static";)i=Nxe(i);return i&&(t1(i)==="html"||t1(i)==="body"&&M_(i).position==="static")?e:i||EGt(t)||e}function Vue(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function J$(t,e,i){return ET(t,FV(e,i))}function CGt(t,e,i){var r=J$(t,e,i);return r>i?i:r}function $Be(){return{top:0,right:0,bottom:0,left:0}}function LBe(t){return Object.assign({},$Be(),t)}function DBe(t,e){return e.reduce(function(i,r){return i[r]=t,i},{})}var AGt=function(e,i){return e=typeof e=="function"?e(Object.assign({},i.rects,{placement:i.placement})):e,LBe(typeof e!="number"?e:DBe(e,b6))};function MGt(t){var e,i=t.state,r=t.name,n=t.options,s=i.elements.arrow,o=i.modifiersData.popperOffsets,l=Ny(i.placement),c=Vue(l),f=[ed,n0].indexOf(l)>=0,_=f?"height":"width";if(!(!s||!o)){var x=AGt(n.padding,i),T=Uue(s),A=c==="y"?Qh:ed,M=c==="y"?r0:n0,I=i.rects.reference[_]+i.rects.reference[c]-o[c]-i.rects.popper[_],L=o[c]-i.rects.reference[c],F=w6(s),z=F?c==="y"?F.clientHeight||0:F.clientWidth||0:0,k=I/2-L/2,U=x[A],j=z-T[_]-x[M],H=z/2-T[_]/2+k,Y=J$(U,H,j),Q=c;i.modifiersData[r]=(e={},e[Q]=Y,e.centerOffset=Y-H,e)}}function OGt(t){var e=t.state,i=t.options,r=i.element,n=r===void 0?"[data-popper-arrow]":r;n!=null&&(typeof n=="string"&&(n=e.elements.popper.querySelector(n),!n)||IBe(e.elements.popper,n)&&(e.elements.arrow=n))}const PGt={name:"arrow",enabled:!0,phase:"main",fn:MGt,effect:OGt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function H5(t){return t.split("-")[1]}var RGt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function IGt(t,e){var i=t.x,r=t.y,n=e.devicePixelRatio||1;return{x:j5(i*n)/n||0,y:j5(r*n)/n||0}}function Fxe(t){var e,i=t.popper,r=t.popperRect,n=t.placement,s=t.variation,o=t.offsets,l=t.position,c=t.gpuAcceleration,f=t.adaptive,_=t.roundOffsets,x=t.isFixed,T=o.x,A=T===void 0?0:T,M=o.y,I=M===void 0?0:M,L=typeof _=="function"?_({x:A,y:I}):{x:A,y:I};A=L.x,I=L.y;var F=o.hasOwnProperty("x"),z=o.hasOwnProperty("y"),k=ed,U=Qh,j=window;if(f){var H=w6(i),Y="clientHeight",Q="clientWidth";if(H===Ep(i)&&(H=gx(i),M_(H).position!=="static"&&l==="absolute"&&(Y="scrollHeight",Q="scrollWidth")),H=H,n===Qh||(n===ed||n===n0)&&s===s9){U=r0;var ne=x&&H===j&&j.visualViewport?j.visualViewport.height:H[Y];I-=ne-r.height,I*=c?1:-1}if(n===ed||(n===Qh||n===r0)&&s===s9){k=n0;var re=x&&H===j&&j.visualViewport?j.visualViewport.width:H[Q];A-=re-r.width,A*=c?1:-1}}var he=Object.assign({position:l},f&&RGt),ce=_===!0?IGt({x:A,y:I},Ep(i)):{x:A,y:I};if(A=ce.x,I=ce.y,c){var be;return Object.assign({},he,(be={},be[U]=z?"0":"",be[k]=F?"0":"",be.transform=(j.devicePixelRatio||1)<=1?"translate("+A+"px, "+I+"px)":"translate3d("+A+"px, "+I+"px, 0)",be))}return Object.assign({},he,(e={},e[U]=z?I+"px":"",e[k]=F?A+"px":"",e.transform="",e))}function $Gt(t){var e=t.state,i=t.options,r=i.gpuAcceleration,n=r===void 0?!0:r,s=i.adaptive,o=s===void 0?!0:s,l=i.roundOffsets,c=l===void 0?!0:l,f={placement:Ny(e.placement),variation:H5(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:n,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Fxe(Object.assign({},f,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Fxe(Object.assign({},f,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const LGt={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:$Gt,data:{}};var s7={passive:!0};function DGt(t){var e=t.state,i=t.instance,r=t.options,n=r.scroll,s=n===void 0?!0:n,o=r.resize,l=o===void 0?!0:o,c=Ep(e.elements.popper),f=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&f.forEach(function(_){_.addEventListener("scroll",i.update,s7)}),l&&c.addEventListener("resize",i.update,s7),function(){s&&f.forEach(function(_){_.removeEventListener("scroll",i.update,s7)}),l&&c.removeEventListener("resize",i.update,s7)}}const NGt={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:DGt,data:{}};var FGt={left:"right",right:"left",bottom:"top",top:"bottom"};function Fk(t){return t.replace(/left|right|bottom|top/g,function(e){return FGt[e]})}var kGt={start:"end",end:"start"};function kxe(t){return t.replace(/start|end/g,function(e){return kGt[e]})}function Bue(t){var e=Ep(t),i=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:i,scrollTop:r}}function jue(t){return G5(gx(t)).left+Bue(t).scrollLeft}function zGt(t,e){var i=Ep(t),r=gx(t),n=i.visualViewport,s=r.clientWidth,o=r.clientHeight,l=0,c=0;if(n){s=n.width,o=n.height;var f=RBe();(f||!f&&e==="fixed")&&(l=n.offsetLeft,c=n.offsetTop)}return{width:s,height:o,x:l+jue(t),y:c}}function UGt(t){var e,i=gx(t),r=Bue(t),n=(e=t.ownerDocument)==null?void 0:e.body,s=ET(i.scrollWidth,i.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),o=ET(i.scrollHeight,i.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),l=-r.scrollLeft+jue(t),c=-r.scrollTop;return M_(n||i).direction==="rtl"&&(l+=ET(i.clientWidth,n?n.clientWidth:0)-s),{width:s,height:o,x:l,y:c}}function Gue(t){var e=M_(t),i=e.overflow,r=e.overflowX,n=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+n+r)}function NBe(t){return["html","body","#document"].indexOf(t1(t))>=0?t.ownerDocument.body:Ff(t)&&Gue(t)?t:NBe(qG(t))}function K$(t,e){var i;e===void 0&&(e=[]);var r=NBe(t),n=r===((i=t.ownerDocument)==null?void 0:i.body),s=Ep(r),o=n?[s].concat(s.visualViewport||[],Gue(r)?r:[]):r,l=e.concat(o);return n?l:l.concat(K$(qG(o)))}function Fre(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function VGt(t,e){var i=G5(t,!1,e==="fixed");return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}function zxe(t,e,i){return e===OBe?Fre(zGt(t,i)):nE(e)?VGt(e,i):Fre(UGt(gx(t)))}function BGt(t){var e=K$(qG(t)),i=["absolute","fixed"].indexOf(M_(t).position)>=0,r=i&&Ff(t)?w6(t):t;return nE(r)?e.filter(function(n){return nE(n)&&IBe(n,r)&&t1(n)!=="body"}):[]}function jGt(t,e,i,r){var n=e==="clippingParents"?BGt(t):[].concat(e),s=[].concat(n,[i]),o=s[0],l=s.reduce(function(c,f){var _=zxe(t,f,r);return c.top=ET(_.top,c.top),c.right=FV(_.right,c.right),c.bottom=FV(_.bottom,c.bottom),c.left=ET(_.left,c.left),c},zxe(t,o,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function FBe(t){var e=t.reference,i=t.element,r=t.placement,n=r?Ny(r):null,s=r?H5(r):null,o=e.x+e.width/2-i.width/2,l=e.y+e.height/2-i.height/2,c;switch(n){case Qh:c={x:o,y:e.y-i.height};break;case r0:c={x:o,y:e.y+e.height};break;case n0:c={x:e.x+e.width,y:l};break;case ed:c={x:e.x-i.width,y:l};break;default:c={x:e.x,y:e.y}}var f=n?Vue(n):null;if(f!=null){var _=f==="y"?"height":"width";switch(s){case B5:c[f]=c[f]-(e[_]/2-i[_]/2);break;case s9:c[f]=c[f]+(e[_]/2-i[_]/2);break}}return c}function o9(t,e){e===void 0&&(e={});var i=e,r=i.placement,n=r===void 0?t.placement:r,s=i.strategy,o=s===void 0?t.strategy:s,l=i.boundary,c=l===void 0?cGt:l,f=i.rootBoundary,_=f===void 0?OBe:f,x=i.elementContext,T=x===void 0?GR:x,A=i.altBoundary,M=A===void 0?!1:A,I=i.padding,L=I===void 0?0:I,F=LBe(typeof L!="number"?L:DBe(L,b6)),z=T===GR?uGt:GR,k=t.rects.popper,U=t.elements[M?z:T],j=jGt(nE(U)?U:U.contextElement||gx(t.elements.popper),c,_,o),H=G5(t.elements.reference),Y=FBe({reference:H,element:k,strategy:"absolute",placement:n}),Q=Fre(Object.assign({},k,Y)),ne=T===GR?Q:H,re={top:j.top-ne.top+F.top,bottom:ne.bottom-j.bottom+F.bottom,left:j.left-ne.left+F.left,right:ne.right-j.right+F.right},he=t.modifiersData.offset;if(T===GR&&he){var ce=he[n];Object.keys(re).forEach(function(be){var ye=[n0,r0].indexOf(be)>=0?1:-1,pe=[Qh,r0].indexOf(be)>=0?"y":"x";re[be]+=ce[pe]*ye})}return re}function GGt(t,e){e===void 0&&(e={});var i=e,r=i.placement,n=i.boundary,s=i.rootBoundary,o=i.padding,l=i.flipVariations,c=i.allowedAutoPlacements,f=c===void 0?PBe:c,_=H5(r),x=_?l?Dxe:Dxe.filter(function(M){return H5(M)===_}):b6,T=x.filter(function(M){return f.indexOf(M)>=0});T.length===0&&(T=x);var A=T.reduce(function(M,I){return M[I]=o9(t,{placement:I,boundary:n,rootBoundary:s,padding:o})[Ny(I)],M},{});return Object.keys(A).sort(function(M,I){return A[M]-A[I]})}function HGt(t){if(Ny(t)===kue)return[];var e=Fk(t);return[kxe(t),e,kxe(e)]}function qGt(t){var e=t.state,i=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var n=i.mainAxis,s=n===void 0?!0:n,o=i.altAxis,l=o===void 0?!0:o,c=i.fallbackPlacements,f=i.padding,_=i.boundary,x=i.rootBoundary,T=i.altBoundary,A=i.flipVariations,M=A===void 0?!0:A,I=i.allowedAutoPlacements,L=e.options.placement,F=Ny(L),z=F===L,k=c||(z||!M?[Fk(L)]:HGt(L)),U=[L].concat(k).reduce(function(Ge,ut){return Ge.concat(Ny(ut)===kue?GGt(e,{placement:ut,boundary:_,rootBoundary:x,padding:f,flipVariations:M,allowedAutoPlacements:I}):ut)},[]),j=e.rects.reference,H=e.rects.popper,Y=new Map,Q=!0,ne=U[0],re=0;re=0,pe=ye?"width":"height",Ee=o9(e,{placement:he,boundary:_,rootBoundary:x,altBoundary:T,padding:f}),te=ye?be?n0:ed:be?r0:Qh;j[pe]>H[pe]&&(te=Fk(te));var le=Fk(te),de=[];if(s&&de.push(Ee[ce]<=0),l&&de.push(Ee[te]<=0,Ee[le]<=0),de.every(function(Ge){return Ge})){ne=he,Q=!1;break}Y.set(he,de)}if(Q)for(var ve=M?3:1,Se=function(ut){var Ft=U.find(function(Qt){var At=Y.get(Qt);if(At)return At.slice(0,ut).every(function(ri){return ri})});if(Ft)return ne=Ft,"break"},Ae=ve;Ae>0;Ae--){var Pe=Se(Ae);if(Pe==="break")break}e.placement!==ne&&(e.modifiersData[r]._skip=!0,e.placement=ne,e.reset=!0)}}const WGt={name:"flip",enabled:!0,phase:"main",fn:qGt,requiresIfExists:["offset"],data:{_skip:!1}};function Uxe(t,e,i){return i===void 0&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function Vxe(t){return[Qh,n0,r0,ed].some(function(e){return t[e]>=0})}function YGt(t){var e=t.state,i=t.name,r=e.rects.reference,n=e.rects.popper,s=e.modifiersData.preventOverflow,o=o9(e,{elementContext:"reference"}),l=o9(e,{altBoundary:!0}),c=Uxe(o,r),f=Uxe(l,n,s),_=Vxe(c),x=Vxe(f);e.modifiersData[i]={referenceClippingOffsets:c,popperEscapeOffsets:f,isReferenceHidden:_,hasPopperEscaped:x},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":_,"data-popper-escaped":x})}const XGt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:YGt};function ZGt(t,e,i){var r=Ny(t),n=[ed,Qh].indexOf(r)>=0?-1:1,s=typeof i=="function"?i(Object.assign({},e,{placement:t})):i,o=s[0],l=s[1];return o=o||0,l=(l||0)*n,[ed,n0].indexOf(r)>=0?{x:l,y:o}:{x:o,y:l}}function JGt(t){var e=t.state,i=t.options,r=t.name,n=i.offset,s=n===void 0?[0,0]:n,o=PBe.reduce(function(_,x){return _[x]=ZGt(x,e.rects,s),_},{}),l=o[e.placement],c=l.x,f=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=f),e.modifiersData[r]=o}const KGt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:JGt};function QGt(t){var e=t.state,i=t.name;e.modifiersData[i]=FBe({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const eHt={name:"popperOffsets",enabled:!0,phase:"read",fn:QGt,data:{}};function tHt(t){return t==="x"?"y":"x"}function iHt(t){var e=t.state,i=t.options,r=t.name,n=i.mainAxis,s=n===void 0?!0:n,o=i.altAxis,l=o===void 0?!1:o,c=i.boundary,f=i.rootBoundary,_=i.altBoundary,x=i.padding,T=i.tether,A=T===void 0?!0:T,M=i.tetherOffset,I=M===void 0?0:M,L=o9(e,{boundary:c,rootBoundary:f,padding:x,altBoundary:_}),F=Ny(e.placement),z=H5(e.placement),k=!z,U=Vue(F),j=tHt(U),H=e.modifiersData.popperOffsets,Y=e.rects.reference,Q=e.rects.popper,ne=typeof I=="function"?I(Object.assign({},e.rects,{placement:e.placement})):I,re=typeof ne=="number"?{mainAxis:ne,altAxis:ne}:Object.assign({mainAxis:0,altAxis:0},ne),he=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ce={x:0,y:0};if(H){if(s){var be,ye=U==="y"?Qh:ed,pe=U==="y"?r0:n0,Ee=U==="y"?"height":"width",te=H[U],le=te+L[ye],de=te-L[pe],ve=A?-Q[Ee]/2:0,Se=z===B5?Y[Ee]:Q[Ee],Ae=z===B5?-Q[Ee]:-Y[Ee],Pe=e.elements.arrow,Ge=A&&Pe?Uue(Pe):{width:0,height:0},ut=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:$Be(),Ft=ut[ye],Qt=ut[pe],At=J$(0,Y[Ee],Ge[Ee]),ri=k?Y[Ee]/2-ve-At-Ft-re.mainAxis:Se-At-Ft-re.mainAxis,Rt=k?-Y[Ee]/2+ve+At+Qt+re.mainAxis:Ae+At+Qt+re.mainAxis,dt=e.elements.arrow&&w6(e.elements.arrow),pt=dt?U==="y"?dt.clientTop||0:dt.clientLeft||0:0,oi=(be=he==null?void 0:he[U])!=null?be:0,ht=te+ri-oi-pt,Et=te+Rt-oi,Dt=J$(A?FV(le,ht):le,te,A?ET(de,Et):de);H[U]=Dt,ce[U]=Dt-te}if(l){var Tt,ie=U==="x"?Qh:ed,Ht=U==="x"?r0:n0,hr=H[j],Ke=j==="y"?"height":"width",Lt=hr+L[ie],vt=hr-L[Ht],Bt=[Qh,ed].indexOf(F)!==-1,qt=(Tt=he==null?void 0:he[j])!=null?Tt:0,li=Bt?Lt:hr-Y[Ke]-Q[Ke]-qt+re.altAxis,mi=Bt?hr+Y[Ke]+Q[Ke]-qt-re.altAxis:vt,Lr=A&&Bt?CGt(li,hr,mi):J$(A?li:Lt,hr,A?mi:vt);H[j]=Lr,ce[j]=Lr-hr}e.modifiersData[r]=ce}}const rHt={name:"preventOverflow",enabled:!0,phase:"main",fn:iHt,requiresIfExists:["offset"]};function nHt(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function sHt(t){return t===Ep(t)||!Ff(t)?Bue(t):nHt(t)}function oHt(t){var e=t.getBoundingClientRect(),i=j5(e.width)/t.offsetWidth||1,r=j5(e.height)/t.offsetHeight||1;return i!==1||r!==1}function aHt(t,e,i){i===void 0&&(i=!1);var r=Ff(e),n=Ff(e)&&oHt(e),s=gx(e),o=G5(t,n,i),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!i)&&((t1(e)!=="body"||Gue(s))&&(l=sHt(e)),Ff(e)?(c=G5(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):s&&(c.x=jue(s))),{x:o.left+l.scrollLeft-c.x,y:o.top+l.scrollTop-c.y,width:o.width,height:o.height}}function lHt(t){var e=new Map,i=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function n(s){i.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(l){if(!i.has(l)){var c=e.get(l);c&&n(c)}}),r.push(s)}return t.forEach(function(s){i.has(s.name)||n(s)}),r}function cHt(t){var e=lHt(t);return bGt.reduce(function(i,r){return i.concat(e.filter(function(n){return n.phase===r}))},[])}function uHt(t){var e;return function(){return e||(e=new Promise(function(i){Promise.resolve().then(function(){e=void 0,i(t())})})),e}}function hHt(t){var e=t.reduce(function(i,r){var n=i[r.name];return i[r.name]=n?Object.assign({},n,r,{options:Object.assign({},n.options,r.options),data:Object.assign({},n.data,r.data)}):r,i},{});return Object.keys(e).map(function(i){return e[i]})}var Bxe={placement:"bottom",modifiers:[],strategy:"absolute"};function jxe(){for(var t=arguments.length,e=new Array(t),i=0;i{this._rootNode=r},this._afterContentCreate=r=>{this._contentNode=r},this._updatePosition=()=>{this._popper!=null&&this._popper.update()}}initialize(){this.when(()=>{this.destroyed||(this._projector.append(document.body,this.render),this._renderAttached=!0)}),this.addHandles([_e(()=>[this.open,this.anchorElement],()=>this._buildPopper(),ii),_e(()=>[this.placement,this.offset],()=>this._setPopperOptions(),ii)])}destroy(){this.owner=null,this.anchorElement=null,this.renderContentFunction=null,this._renderAttached&&(this._projector.detach(this.render),this._renderAttached=!1),this._rootNode!=null&&(vXe(this._rootNode),this._rootNode=null),this._contentNode=null,this._popper!=null&&(this._popper.destroy(),this._popper=null)}set container(e){}set owner(e){this._set("owner",e)}get placement(){return"top"}set placement(e){mHt.has(e)?this._override("placement",e):this._clearOverride("placement")}get test(){return{rootNode:this._rootNode}}render(){var n;const{open:e,owner:i,renderContentFunction:r}=this;return X("div",{afterCreate:this._afterRootCreate,class:this.classes(Hxe.base,e?Hxe.open:null),lang:fa(),styles:gHt},X("div",{afterCreate:this._afterContentCreate,afterUpdate:this._updatePosition,dir:wZe((n=this.owner)==null?void 0:n.container)},e?r==null?void 0:r.call(i):null))}_buildPopper(){this._popper!=null&&(this._popper.destroy(),this._popper=null);const e=this._contentNode;if(e==null||!this.open||!this.renderContentFunction)return;const i=this._getAnchor();i&&(this._popper=fHt(i,e),this._setPopperOptions())}_setPopperOptions(){const{placement:e,offset:i,_popper:r}=this;r!=null&&(r.setOptions({placement:e,modifiers:[{name:"offset",options:{offset:i}}]}),r.forceUpdate())}_getAnchor(){const{anchorElement:e}=this;return x9(typeof e=="function"?e():e)}};y([w()],Hg.prototype,"anchorElement",void 0),y([w()],Hg.prototype,"container",null),y([w()],Hg.prototype,"offset",void 0),y([w()],Hg.prototype,"open",void 0),y([w()],Hg.prototype,"owner",null),y([w()],Hg.prototype,"placement",null),y([w()],Hg.prototype,"renderContentFunction",void 0),Hg=y([Z("esri.widgets.support.Popover")],Hg);const kBe=Hg,Ra="esri-date-picker",Po={base:Ra,datePicker:`${Ra}__calendar`,monthPicker:`${Ra}__month-picker`,dayPicker:`${Ra}__day-picker`,week:`${Ra}__week-item`,nearbyMonth:`${Ra}__day-item--nearby-month`,activeDay:`${Ra}__day-item--active`,today:`${Ra}__day-item--today`,selectedDay:`${Ra}__day-item--selected`,day:`${Ra}__day-item`,dayHeader:`${Ra}__day-item--header`,yearPicker:`${Ra}__year-picker`,selectedYear:`${Ra}__year-picker-item--selected`,year:`${Ra}__year-picker-item`,monthDropdown:`${Ra}__month-dropdown`,date:`${Ra}__date`,datePickerToggle:`${Ra}__calendar-toggle`,dateInput:`${Ra}__input`,dateTextInput:`${Ra}__text-input`,leadingIcon:`${Ra}__icon--leading`},yHt=new Set([" ","ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","Home","PageDown","PageUp"]);let yl=class extends cn{constructor(e,i){super(e,i),this._calendarNode=null,this._inputOrButtonNode=null,this._rootNode=null,this._requestDayPickerFocusOnCreate=!1,this._activeDate=null,this._calendarPopover=new kBe({owner:this,placement:"bottom-start",anchorElement:()=>this._rootNode,renderContentFunction:this._renderCalendar}),this._isOpen=!1,this.dateInputEnabled=!1,this.messages=null,this.commitOnMonthChange=!1,this.viewModel=new HG,this.disabled=!1,this.timeZone=void 0,this.toggle=this.toggle.bind(this)}initialize(){this.addHandles(_e(()=>{var e;return{viewModel:this.viewModel,value:(e=this.viewModel)==null?void 0:e.value}},({viewModel:e,value:i})=>{!this.destroyed&&e&&this.onChange!=null&&this.onChange(i)},Li))}destroy(){this._calendarPopover.destroy()}get _dateTimeFormatOptions(){return{year:"numeric",month:"2-digit",day:"2-digit",timeZone:this.timeZone||void 0}}get value(){return this.viewModel.value}set value(e){this.viewModel.value=e}get isOpen(){return this._isOpen}render(){return X("div",{afterCreate:Vv,bind:this,class:this.classes(Po.base,tt.widget),"data-node-ref":"_rootNode"},this.dateInputEnabled?this._renderInputAndButtonMode():this._renderButtonOnlyMode())}toggle(){this._isOpen?this.close():this.open()}open(e=!0){this._activeDate=$i.fromJSDate(this.viewModel.value),this._isOpen=!0,this._calendarPopover.open=!0,this._requestDayPickerFocusOnCreate=e}close(e=!0){var i;this._activeDate=null,this._isOpen=!1,this._calendarPopover.open=!1,e&&((i=this._inputOrButtonNode)==null||i.focus())}_renderButtonOnlyMode(){const e=js(this.viewModel.value,this._dateTimeFormatOptions),{disabled:i,_isOpen:r,messages:n}=this;return X("div",{afterCreate:Vv,"aria-controls":r?this._getCalendarId():null,"aria-expanded":r.toString(),"aria-haspopup":"true","aria-label":n.setDate,"aria-pressed":r.toString(),bind:this,class:this.classes(tt.widgetButton,tt.select,Po.datePickerToggle),"data-node-ref":"_inputOrButtonNode",key:`date-button-${i}`,onclick:this.toggle,onkeydown:this._handleDateButtonKeyDown,role:"button",tabIndex:i?void 0:0},X("span",{class:Po.date},e))}_renderInputAndButtonMode(){const e=js(this.viewModel.value,this._dateTimeFormatOptions),{_isOpen:i,messages:r}=this;return X("div",{class:this.classes(Po.dateInput)},X("input",{afterCreate:Vv,"aria-controls":i?this._getCalendarId():null,"aria-haspopup":"true","aria-label":r.setDate,bind:this,class:this.classes(Po.dateTextInput,tt.input),"data-node-ref":"_inputOrButtonNode",key:"date-input",onblur:this._handleDateInputBlur,onclick:this._handleDateInputClick,onkeydown:this._handleDateInputKeyDown,type:"text",value:e}),X("span",{"aria-hidden":"true",class:this.classes(Po.leadingIcon,si.calendar)}))}_handleDateInputClick(){this.open(!1)}_handleDateInputKeyDown(e){const{key:i}=e;this._isOpen?i==="Enter"?this._handleDateText(e):i==="Escape"&&this.close():i==="ArrowDown"&&(this.open(),e.preventDefault())}_handleDateButtonKeyDown(e){const{key:i,shiftKey:r}=e;this._isOpen&&i==="Tab"&&r?this.close():bM(i)&&this.toggle()}_handleDateInputBlur(e){this._isOpen||this._handleDateText(e)}_handleDateText(e){const i=e.currentTarget;let r;try{r=oGt(i.value,this._dateTimeFormatOptions)}catch(s){return Ce.getLogger(this).warn(s),void(i.value=js(this.viewModel.value,this._dateTimeFormatOptions))}const n=$i.fromObject(r);n.isValid?(this.viewModel.value=n.toJSDate(),this._activeDate=n):i.value=js(this.viewModel.value,this._dateTimeFormatOptions)}_handleDatePickerKeydown(e){Sf(e)==="Escape"&&(this.close(),e.preventDefault(),e.stopPropagation())}_renderCalendar(){const e=this._activeDate;if(!e)return null;const i=$i.fromJSDate(this.viewModel.value);return X("div",{afterCreate:Vv,bind:this,class:this.classes(Po.datePicker,tt.widget),"data-node-ref":"_calendarNode",id:this._getCalendarId(),key:"esri-date-picker__calendar",onfocusout:this._onCalendarFocusOut,onkeydown:this._handleDatePickerKeydown,tabIndex:-1},this._renderMonthPicker(e),this._renderDayPicker(e,i),this._renderYearPicker(e))}_getCalendarId(){return`date-picker__calendar--${this.id}`}_onCalendarFocusOut(e){var r,n;const i=e.relatedTarget;i&&i instanceof Node&&((r=this._calendarNode)!=null&&r.contains(i)||(n=this._rootNode)!=null&&n.contains(i))||this.close(!1)}_renderMonthPicker(e){const i=RT(this.container),r=i?si.right:si.left,n=i?si.left:si.right,s=KR.months("long",{locale:fa()}).map((c,f)=>{const _=e.month-1===f;return X("option",{selected:_,value:f.toString()},c)}),{disabled:o,messages:l}=this;return X("div",{class:Po.monthPicker},X("div",{"aria-label":l.goToPreviousMonth,bind:this,class:tt.button,key:`previous-month-${o}`,onclick:this._setPreviousMonth,onkeydown:this._handlePreviousMonthKeyDown,role:"button",tabIndex:o?void 0:0,title:l.goToPreviousMonth},X("span",{"aria-hidden":"true",class:r})),X("select",{"aria-label":l.selectMonth,"aria-live":"assertive",bind:this,class:this.classes(Po.monthDropdown,tt.select),disabled:o,id:`${this.id}__month-picker`,onchange:this._setMonth,onkeydown:this._setMonth,title:l.selectMonth},s),X("div",{"aria-label":l.goToNextMonth,bind:this,class:tt.button,key:`next-month-${o}`,onclick:this._setNextMonth,onkeydown:this._setNextMonth,role:"button",tabIndex:o?void 0:0,title:l.goToNextMonth},X("span",{"aria-hidden":"true",class:n})))}_renderDayPicker(e,i){const r=this._getWeekLabels(),n=this._getDayId(e),s=this._renderMonth(e,i),{id:o,disabled:l}=this;return X("div",{afterCreate:this._handleDayPickerCreate,"aria-activedescendant":n,"aria-labelledby":`${o}__month-picker ${o}__selected-year`,bind:this,class:Po.dayPicker,id:`${o}__day-picker`,key:`day-picker-${l}`,onkeydown:this._handleDayPickerKeydown,role:"grid",tabIndex:l?void 0:0},X("div",{class:Po.week,role:"row"},r.map(c=>X("div",{"aria-label":c.name,class:this.classes(Po.day,Po.dayHeader),role:"columnheader",title:c.name},c.abbr))),s)}_getDayId(e){return`${this.id}__${js(e.valueOf(),this._dateTimeFormatOptions)}`}_handleDayPickerCreate(e){this._requestDayPickerFocusOnCreate&&(this._requestDayPickerFocusOnCreate=!1,e.focus())}_getWeekLabels(){const e=[],i={weekday:"long"},r={weekday:"narrow"};let n=$i.now().set({weekday:MBe(fa())});for(let s=0;s<7;s++)e.push({name:js(n.valueOf(),i),abbr:js(n.valueOf(),r)}),n=n.plus({day:1});return e}_handleDayPickerKeydown(e){const{ctrlKey:i,shiftKey:r}=e,n=Sf(e);if(!yHt.has(n))return;let s=this._activeDate;if(s){if(n==="ArrowLeft")s=s.minus({day:1});else if(n==="ArrowRight")s=s.plus({day:1});else if(n==="ArrowUp")s=s.minus({week:1});else if(n==="ArrowDown")s=s.plus({week:1});else if(n==="PageUp"){const o=r?"year":"month";s=s.minus({[o]:1})}else if(n==="PageDown"){const o=r?"year":"month";s=s.plus({[o]:1})}else if(n==="Home"){const o=i?"year":"month";s=s.startOf(o)}else if(n==="End"){const o=i?"year":"month";s=s.endOf(o)}else bM(n)&&(this.viewModel.value=s.toJSDate(),this.close());this._activeDate=s,e.preventDefault(),e.stopPropagation()}}_renderMonth(e,i){const r=$i.now(),n=e.startOf("month"),s=e.endOf("month"),o=6,l=7;let c=n.minus({day:lGt(fa(),n.weekday)});const f=[];for(let _=0;_{this.viewModel.toggleDayPlaying()},this._onYearPlayClick=()=>{this.viewModel.toggleYearPlaying()},this._onSeasonChange=r=>{this.viewModel.currentSeason=r.target.value},this._onSunLightingCheckboxChange=()=>{this.viewModel.toggleSunLightingEnabled()},this._onShadowCheckboxChange=()=>{this.viewModel.toggleDirectShadowsEnabled()}}get label(){var e;return((e=this.messages)==null?void 0:e.title)??""}set label(e){this._overrideIfSome("label",e)}get playSpeedMultiplier(){return this.viewModel.playSpeedMultiplier}set playSpeedMultiplier(e){this.viewModel.playSpeedMultiplier=e}get timeSliderSteps(){var e;return((e=this._timeSlider)==null?void 0:e.steps)??5}set timeSliderSteps(e){this._timeSlider.steps=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get test(){return{datePicker:this._datePicker}}get _useAmPm(){const e=this._timeSlider.viewModel.getLabelForValue(0,"tick");return e!=null&&qxe.test(e)}postInitialize(){this.viewModel.isSupported&&this.addHandles([_e(()=>this.viewModel.datePickerViewModel,e=>this._datePicker.viewModel=e,kt),_e(()=>this.viewModel.timeSliderViewModel,e=>this._timeSlider.viewModel=e,kt),_e(()=>{var e;return(e=this.visibleElements)==null?void 0:e.timezone},e=>this._timeSlider.showDropDown=e,kt),_e(()=>!this.viewModel.sunLightingEnabled,e=>{this._datePicker.disabled=e,this._timeSlider.disabled=e},kt),Mo(()=>!this.visible,()=>{var e;return(e=this._datePicker)==null?void 0:e.close(!1)},Li)])}destroy(){this._datePicker.destroy(),this._timeSlider.destroy()}render(){const{messages:e,viewModel:i,visibleElements:r}=this,n=i.isSupported;return X("div",{class:this.classes(Bc.base,tt.widget)},n?X(WI,null,r.header?X(Im,{level:this.headingLevel},e.title):null,this._renderTimeOptions(),r.datePicker?this._renderDateOrSeason():null,r.sunLightingToggle?this._renderSunLightingToggle():null,r.shadowsToggle?this._renderShadowsToggle():null):X("div",{class:Bc.panelError,key:"unsupported"},X("p",null,e.unsupported)))}loadDependencies(){return Pl({button:()=>we(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([234,235,236,237,238,239,240,241,242,243,244,245,246,247])),checkbox:()=>we(()=>import("./calcite-checkbox-OaFCWd7i.js"),__vite__mapDeps([283,236,247,237,241,238,239])),label:()=>we(()=>import("./calcite-label-lSeWOYbm.js"),__vite__mapDeps([284,238])),option:()=>we(()=>import("./calcite-option-LMeeGK3H.js"),__vite__mapDeps([285,242])),select:()=>we(()=>import("./calcite-select-0Yw6DsYN.js"),__vite__mapDeps([286,236,237,238,239,242,243,245]))})}_renderTimeOptions(){const{viewModel:e,visibleElements:i,messages:r}=this,{directShadowsEnabled:n,dayPlaying:s}=e,o=!e.sunLightingEnabled;return X("div",{class:this.classes(Bc.dayContainer,{[Bc.sliderShadowOn]:n,[Bc.sliderShadowOff]:!n,[Bc.sliderDateOn]:i.datePicker,[Bc.sliderDateOff]:!i.datePicker,[Bc.sliderAmPmOn]:this._useAmPm,[Bc.containerDisabled]:o}),key:"daylight-time-options"},this._timeSlider.render(),i.playButtons?this._renderPlayPauseButton({playing:s,disabled:o,label:r.playDay,onClick:this._onPlayDayClick}):null)}_renderDateOptions(){const{viewModel:e,visibleElements:i,messages:r}=this,{yearPlaying:n}=e,s=!e.sunLightingEnabled;return X("div",{class:this.classes(Bc.dateContainer,s&&Bc.containerDisabled),key:"daylight-date"},this._datePicker.render(),i.playButtons?this._renderPlayPauseButton({playing:n,disabled:s,label:r.playYear,onClick:this._onYearPlayClick}):null)}_renderPlayPauseButton({playing:e,disabled:i,label:r,onClick:n}){return X("calcite-button",{appearance:"solid",class:Bc.playPauseButton,disabled:i,iconStart:e?"pause-f":"play-f",label:r,onclick:n,round:!0,title:r,type:"button"})}_renderSeasonSelect(){const{messages:e,viewModel:i}=this,r=!i.sunLightingEnabled;return X("calcite-select",{class:this.classes(Bc.seasonPicker),disabled:r,label:e.season,onCalciteSelectChange:this._onSeasonChange},Ire.map(n=>X("calcite-option",{selected:i.currentSeason===n,value:n},e[n])))}_renderDateOrSeason(){return this.dateOrSeason==="date"?this._renderDateOptions():this._renderSeasonSelect()}_renderSunLightingToggle(){var i;const e=(i=this.messages)==null?void 0:i.sunLightingToggle;return X("calcite-label",{key:"date-time-toggle",layout:"inline",scale:"s",title:e==null?void 0:e.tooltip},X("calcite-checkbox",{checked:this.viewModel.sunLightingEnabled,class:Bc.sunLightingCheckbox,onCalciteCheckboxChange:this._onSunLightingCheckboxChange}),e==null?void 0:e.label)}_renderShadowsToggle(){const e=this.messages.shadowsToggle;return X("calcite-label",{key:"shadow-toggle",layout:"inline",scale:"s",title:e==null?void 0:e.tooltip},X("calcite-checkbox",{checked:this.viewModel.directShadowsEnabled,class:Bc.shadowsCheckbox,onCalciteCheckboxChange:this._onShadowCheckboxChange}),e.label)}_onPrimaryTickCreated(e,i,r){i.classList.add(...NX,tt.primaryTick),r.classList.add(...NX,tt.primaryTickLabel),r.onclick=i.onclick=this._makeGoToTime(e);const n=r.textContent,s=n!=null&&qxe.exec(n);s&&(r.innerHTML=`${s[1]}

${s[2]}
`)}_onSecondaryTickCreated(e,i){i.classList.add(...NX,tt.secondaryTick),i.onclick=this._makeGoToTime(e)}_makeGoToTime(e){return()=>{this.viewModel.timeSliderPosition=e}}};y([w(),Gr("esri/widgets/Daylight/t9n/Daylight")],zl.prototype,"messages",void 0),y([w(),Gr("esri/widgets/support/t9n/timezone")],zl.prototype,"timezoneMessages",void 0),y([w()],zl.prototype,"headingLevel",void 0),y([w()],zl.prototype,"iconClass",void 0),y([w()],zl.prototype,"icon",void 0),y([w()],zl.prototype,"label",null),y([w()],zl.prototype,"playSpeedMultiplier",null),y([w()],zl.prototype,"timeSliderSteps",null),y([w()],zl.prototype,"view",null),y([w({type:CBe})],zl.prototype,"viewModel",void 0),y([w({type:ABe,nonNullable:!0})],zl.prototype,"visibleElements",void 0),y([w({cast:t=>t==="season"||t==="date"?t:(Ce.getLogger(Wxe).warn(`"${t}" is not a valid option. Acceptable values are only "date" or "season". Defaulting to "${kre}".`),kre)})],zl.prototype,"dateOrSeason",void 0),y([w()],zl.prototype,"_timeSlider",void 0),y([w()],zl.prototype,"_useAmPm",null),y([w()],zl.prototype,"_datePicker",void 0),zl=y([Z(Wxe)],zl);const NX=["esri-interactive","esri-widget__anchor"],vHt=zl,_Ht=t=>new vHt({view:t,visible:!0,container:"daylight-container"});function Sm(t){let e,i,r=[],n=!1;function s(...o){return n&&e===this&&bHt(o,r)||(i=t.apply(this,o),e=this,r=o,n=!0),i}return s}function bHt(t,e){if(t.length!==e.length)return!1;for(let i=0;i{l=0,t.apply(r,o)},f=(..._)=>{n&&n.apply(r,_),o=_,s?l||(l=setTimeout(c,s)):c()};return f.remove=()=>{l&&(clearTimeout(l),l=0)},f.forceUpdate=()=>{l&&(clearTimeout(l),c())},f.hasPendingUpdates=()=>!!l,f}var jh,Ga;(function(t){t.Disabled="disabled",t.Ready="ready",t.Creating="creating",t.Created="created",t.Selecting="selecting",t.Selected="selected"})(jh||(jh={})),function(t){t.NoValidInput="no-valid-input",t.NoVisibleProfiles="no-visible-profiles",t.InvalidGeometry="invalid-geometry",t.TooComplex="too-complex",t.InvalidElevationInfo="invalid-elevation-info",t.UnknownError="unknown-error",t.RefinedButNoChartData="refined-but-no-chart-data",t.None="none"}(Ga||(Ga={}));let UBe={noDataValue:-5e5,defaultQueryOptions:()=>({noDataValue:UBe.noDataValue,demResolution:"auto",maximumAutoTileRequests:150,ignoreInvisibleLayers:!0}),updateThrottleMillis:100,delayAfterPreviewMillis:500,defaultDemResolution:Ur(10,"centimeters","meters"),densificationMaxSamples:3e3,largeChartSamples:1e4,maxTotalSamples:1e5,maxChartRatio:300,minSlopeSampleDistance:10,formatPrecision:1,portraitModePixelBreakpoint:400,profileLinesStyle3D:{width:3,outlineSize:0,falloff:0,outlineColor:YB([1,1,1,0]),renderOccluded:Wn.Opaque},hoveredPointsStyle:{size:14,borderStyle:"solid",borderWidth:3,borderColor:"#ffffff",boxShadow:"0px 0px 0px 5px rgba(255,255,255,0.2)"}};function kf(){return UBe}const xHt=" ― ",SHt={progress:1,hasZ:!1,samples:[],statistics:null,spatialReference:null},VBe="ProfileGenerationError";var Af;(function(t){t.TooComplex="too-complex",t.InvalidGeometry="invalid-geometry",t.InvalidElevationInfo="invalid-elevation-info",t.ElevationQueryError="elevation-query-error"})(Af||(Af={}));let LO=class extends Error{constructor(e){super("profile could not be generated",{cause:e}),this.type=VBe}};function THt(t){return t.type===VBe}async function EHt(t,e,i,r,n,s,o){let l,c,f;const _=t.spatialReference,x=_.isGeographic||_.isWebMercator;let T=0;if(!x){const{planarLength:M}=await we(()=>import("./geometryEngineAsync-QjQc0riy.js"),__vite__mapDeps([]));St(o),T=await M(t,"meters"),St(o)}const A=1/ws(r);if(x||T>=n.geodesicDistanceThreshold){await y_([{source:_,dest:r},{source:_,dest:at.WGS84}],o);const M=NHt(t);l=RBt([M],"meters")[0];const I=Yxe(l,n);if(Jxe(t,l,I)>s)throw new LO(Af.TooComplex);const L=Xxe(M,e,i);({densifiedPath:c,distances:f}=OHt(L,I,A)),c=rl(c,r)}else{await y_([{source:_,dest:r}],o),l=T;const M=Yxe(l,n);if(Jxe(t,l,M)>s)throw new LO(Af.TooComplex);const I=Xxe(t,e,i);({densifiedPath:c,distances:f}=MHt(I,M,A)),St(o),c=rl(c,r)}return{densifiedPath:c,pathLength:l*A,distances:f}}function Yxe(t,e){const i=t/e.densificationMaxSamples;return Math.max(e.samplingDistance,i)}function Xxe(t,e,i){if(e==null)return Zxe(t);const r=t.spatialReference,n=e.mode,s=e.offset??0;let o=null;switch(i.type){case"2d":o=CHt(t,n,s);break;case"3d":o=AHt(t,n,s,i)}return o==null?Zxe(t):new xc({hasZ:!0,hasM:!1,spatialReference:r,paths:BBe(t.paths,o)})}function CHt({hasZ:t},e,i){return e==="absolute-height"?t?([r,n,s])=>[r,n,s+i]:([r,n])=>[r,n,i]:null}function AHt({spatialReference:t,hasZ:e},i,r,{elevationProvider:n}){const s=(o,l,c,f)=>(n==null?void 0:n.getElevation(o,l,c,t,f))??0;switch(i){case"on-the-ground":return([o,l])=>[o,l,s(o,l,0,"ground")];case"absolute-height":return e?([o,l,c])=>[o,l,c+r]:([o,l])=>[o,l,r];case"relative-to-ground":return e?([o,l,c])=>[o,l,c+s(o,l,c,"ground")+r]:([o,l])=>[o,l,s(o,l,0,"ground")+r];case"relative-to-scene":return e?([o,l,c])=>[o,l,c+s(o,l,c,"scene")+r]:([o,l])=>[o,l,s(o,l,0,"scene")+r];default:return null}}function Zxe(t){return t.hasZ?new xc({hasZ:!1,hasM:!1,spatialReference:t.spatialReference,paths:BBe(t.paths,([e,i])=>[e,i])}):t}function BBe(t,e){const i=t.length,r=new Array(i);for(let n=0;n0&&t.paths.every(e=>e.length>=2)}function x6(t){return t!=null&&t.type==="polyline"}function jBe(t,e,i,r,n){const{spatialReference:s,hasZ:o}=t,l={from:null,to:null,distance:0,azimuth:0,reverseAzimuth:0,spatialReference:s,metersPerSR:ws(s)},c=[],f=[];let _=0;for(let x=0;xe+i.length,0)}function Jxe(t,e,i){return GBe(t)+Math.floor(e/i)+Math.max(0,t.paths.reduce(r=>1+r,0)-1)}function FHt(t,e){const i=t.length;if(i===0)return null;const r=t[0],n=r.sampledZ;let s=n,o=n,l=0,c=0,f=null,_=null,x=n??0,T=0,A=0,M=n!=null?1:0,I=0,L=0;const F=ws(e),z=Bf(e),k=kf().minSlopeSampleDistance/F,U=2*k,j=new Kxe,H=new Kxe,Y=()=>{ne(),j.copy(H),H.reset()},Q=(re,he)=>{Y(),re>0&&re-j.start<=U&&(re=j.start+k),H.restart(re,he)},ne=()=>{if(j.isHole||H.isHole)return;const re=H.avgElevation-j.avgElevation,he=H.start-j.start,ce=re*z,be=he*F,ye=Ur(Math.atan2(ce,be),"radians","degrees");ye>0?(T+=ye,f=Wv(f,ye),I++):ye<0&&(A-=ye,_=Wv(_,-ye),L++)};r.sampledZ!=null&&Q(r.distance,r.sampledZ);for(let re=1;re=k?Q(ce.distance,be):H.insert(be);const ye=he.sampledZ;if(ye!=null){const pe=be-ye;pe>0?l+=pe:pe<0&&(c-=pe)}}return Y(),M===0?null:{maxDistance:t[i-1].distance,minElevation:s,maxElevation:o,avgElevation:M===0?null:x/M,elevationGain:l,elevationLoss:c,maxPositiveSlope:f,maxNegativeSlope:_,avgPositiveSlope:I===0?null:T/I,avgNegativeSlope:L===0?null:A/L}}function kHt(t){const e=t.filter(ys),i=e.length;if(i===0)return null;const r=e[0];if(i===1)return r;let n=r.maxDistance,s=r.minElevation,o=r.maxElevation,l=r.maxPositiveSlope,c=r.maxNegativeSlope;for(let f=1;f=e||(i.push(t),e-t<2))return i;const r=e-1;i.push(r);const n=zre(t+1,r);for(;;){const s=n.next();if(s.done)break;i.push(s.value)}return i}function*zre(t,e){if(t>=e)return;const i=t+Math.floor((e-t)/2);yield i;const r=zre(t,i),n=zre(i+1,e);for(;;){const s=r.next(),o=n.next();if(s.done&&o.done)break;s.done||(yield s.value),o.done||(yield o.value)}}async function*UHt(t,e){const{view:i,geometry:r,elevationInfo:n,providers:s,options:o}=t,l=i.spatialReference;if(!l||r==null||!Hue(r))throw new LO(Af.InvalidGeometry);const c=s.length;if(c===0)return null;const f=Math.round(o.maxTotalSamples/c);if(GBe(r)>f)throw new LO(Af.TooComplex);const _=await EHt(r,n,i,l,o,f,e);let x=0;const T=new Array(c),A=new Array(c);for(let L=0;Lo.maxTotalSamples)throw new LO(Af.TooComplex);const M=await Promise.all(A.map(L=>{const F=L.next();return F.done===!0?Promise.resolve(null):F.value}));St(e);for(let L=0;L{var F;return(F=L.return)==null?void 0:F.call(L)})}for(const{resultPromise:L,index:F}of I)T[F]=await L,St(e),yield T;for(const L of T)L!=null&&(L.progress=1);yield T}function*VHt(t,e){const{densificationResult:i}=t,r={...t,abortOptions:e,densificationResult:i},n=HBe(0,r.result.samples.length),s=n.slice(0,r.provider.numSamplesForPreview);yield Qxe(r,s,!0);const o=L3e(n,r.provider.numSamplesPerChunk);for(const l of o)yield Qxe(r,l,!1)}async function Qxe({densificationResult:t,result:e,provider:i,queue:r,abortOptions:n,cache:s},o,l){const{densifiedPath:c,pathLength:f}=t,_=e.spatialReference,{samples:x}=e,T=[];for(let A=0;A{St(e.queryOptions);try{await jHt(e)}catch(i){XX(i)}}})}async function jHt({geometry:t,provider:e,indices:i,preview:r,result:n,queryOptions:s}){if(i.length===0)return;const o=(await XHt(e,t,s)).geometry,{hasZ:l,points:c}=o,f=s.noDataValue,{samples:_}=n;for(let x=0;x({stationary:i,visibleProfiles:r,generationParameters:n})),this._getGenerationParametersMemoized=Sm((i,r,n,s,o,l,c)=>x6(r)&&Hue(r)&&s!=null?{view:i,geometry:r,elevationInfo:n,options:l,queue:s,cache:o,slicePlane:c}:null),this._getElevationInfoMemoized=Sm((i,r)=>({mode:i,offset:r})),this._getOptionsMemoized=Sm((i,r,n)=>{const{densificationMaxSamples:s,maxTotalSamples:o}=kf();return{geodesicDistanceThreshold:i,samplingDistance:r,densificationMaxSamples:Math.round(s/n),maxTotalSamples:o}}),this._updateThrottled=kV(i=>$m(this._update(i)),kf().updateThrottleMillis)}initialize(){const e=this.viewModel;this.addHandles([_e(()=>e.profiles.toArray(),i=>{this._abortUpdate(),this._paramsPerProfile.clear(),this.removeHandles(t3e),this.addHandles(i.map(r=>id([r.attach(this.viewModel),r.on("change",()=>{this._invalidateProfile(r)})])),t3e)},kt),this._updateThrottled,_e(()=>this._updateParameters,this._updateThrottled,kt)])}destroy(){this._paramsPerProfile.clear()}get _updateParameters(){const{viewModel:e}=this,i=e.view;return this._getUpdateParametersMemoized(i==null||i.stationary,this.viewModel.visibleProfiles,this._generationParameters)}get _generationParameters(){const{view:e,input:i,queue:r,tileCache:n}=this.viewModel;return e!=null&&e.ready?this._getGenerationParametersMemoized(e,i==null?void 0:i.geometry,this._elevationInfo,r,n,this._options,e.type==="3d"?e.slicePlane:null):null}get _elevationInfo(){const e=this.viewModel.input,i=e?ij(e)?null:_Pe(e):null;return i!=null?this._getElevationInfoMemoized(i.mode,i.offset):null}get _options(){const e=this.viewModel,i=e.visibleProfiles.length;let r=e.minDemResolution??kf().defaultDemResolution;return r=parseFloat(r.toFixed(2)),this._getOptionsMemoized(e.geodesicDistanceThreshold,r,i)}async _update({stationary:e,visibleProfiles:i,generationParameters:r}){this._abortUpdate(),e&&(r!=null?this._updateTask=Cc(async n=>{this.viewModel.error=null;const s=i.filter(l=>!this._isProfileValid(l,r)),o=UHt({...r,providers:s},{signal:n});try{for await(const l of o){St(n),this._clearInvalidResults(r);for(let c=0;c{c.result=null})}}):this._clearResults())}_abortUpdate(){this._updateTask=gn(this._updateTask)}_isProfileValid(e,i){return this._paramsPerProfile.has(e)&&this._paramsPerProfile.get(e)===i}_invalidateProfile(e){this._paramsPerProfile.delete(e),this._updateThrottled(this._updateParameters)}_clearInvalidResults(e){for(const i of this.viewModel.profiles.items)this._isProfileValid(i,e)||(i.result=null,this._paramsPerProfile.delete(i))}_clearResults(){for(const e of this.viewModel.profiles.items)e.result=null,this._paramsPerProfile.delete(e)}};y([w({nonNullable:!0})],Tw.prototype,"viewModel",void 0),y([w()],Tw.prototype,"_updateParameters",null),y([w()],Tw.prototype,"_generationParameters",null),y([w()],Tw.prototype,"_elevationInfo",null),y([w()],Tw.prototype,"_options",null),Tw=y([Z("esri.widgets.ElevationProfile.ElevationProfileController")],Tw);function ZHt(t,e){if(t==null||e==null)return null;const{samples:i,spatialReference:r}=t,{distance:n,elevation:s}=e,o=ws(r),l=Bf(r),c=i.length,f=new Array(c);for(let _=0;_ZHt(i,r)),this._getStatisticsMemoized=Sm((i,r)=>JHt(i,r)),this.viewVisualizationEnabled=!0,this.result=null,this.effectiveUnits=null,this.numSamplesForPreview=30,this.numSamplesPerChunk=200,this.chartFillEnabled=!0,this.chartStrokeWidth=1.5,this.chartStrokeOffsetY=0,this._viewModel=null}get progress(){return this.result!=null&&this.visible?this.result.progress:0}get samples(){return this._getSamplesMemoized(this.result,this.effectiveUnits)}get statistics(){return this._getStatisticsMemoized(this.result,this.effectiveUnits)}get hoveredPoint(){var i;const e=(i=this._viewModel)==null?void 0:i.hoveredChartPosition;return e!=null?this._getPoint(e):null}get available(){return!0}get hasZ(){const e=this.result;return e!=null&&e.hasZ}get minDemResolution(){return kf().defaultDemResolution}queryElevation(){throw new Error("not implemented")}attach(e){return this._viewModel=e,id([_e(()=>e.effectiveUnits,i=>{this.effectiveUnits=i},kt),_e(()=>[e.input],()=>this._onChange(),Li)])}toggleVisibility(e){this.visible=e===void 0?!this.visible:e}_onChange(){this.emit("change")}_getPoint(e){const{samples:i,result:r}=this;if(i==null||r==null)return null;const n=i.length;if(n===0)return null;const s=i[n-1].distance,o=Pje(i,e*s,_=>_.distance);if(o==null)return null;const{x:l,y:c,z:f}=o;return f==null?null:new mt({x:l,y:c,z:f,spatialReference:r.spatialReference})}};y([w({nonNullable:!0})],Wo.prototype,"id",void 0),y([w({nonNullable:!0})],Wo.prototype,"title",void 0),y([w({type:qe,nonNullable:!0})],Wo.prototype,"color",void 0),y([w({nonNullable:!0})],Wo.prototype,"visible",void 0),y([w({readOnly:!0})],Wo.prototype,"progress",null),y([w({readOnly:!0})],Wo.prototype,"samples",null),y([w({readOnly:!0})],Wo.prototype,"statistics",null),y([w()],Wo.prototype,"hoveredPoint",null),y([w()],Wo.prototype,"viewVisualizationEnabled",void 0),y([w()],Wo.prototype,"available",null),y([w()],Wo.prototype,"result",void 0),y([w()],Wo.prototype,"effectiveUnits",void 0),y([w()],Wo.prototype,"numSamplesForPreview",void 0),y([w()],Wo.prototype,"numSamplesPerChunk",void 0),y([w()],Wo.prototype,"chartFillEnabled",void 0),y([w()],Wo.prototype,"chartStrokeWidth",void 0),y([w()],Wo.prototype,"chartStrokeOffsetY",void 0),y([w({readOnly:!0})],Wo.prototype,"hasZ",null),y([w({readOnly:!0})],Wo.prototype,"minDemResolution",null),y([w()],Wo.prototype,"_viewModel",void 0),Wo=y([Z("esri.widgets.ElevationProfile.ElevationProfileLine")],Wo);const S6=Wo;function WBe(t){if(t==null)return null;if(t instanceof h5)return YBe(t);const e=t.tileInfo;if(e==null)return null;const i=Sje(e.lods);return i==null?null:i.resolution*ws(e.spatialReference)}function YBe(t){if(t==null)return null;const e=t.layers.items.map(KHt).filter(ys);return $3e(e)??null}function KHt(t){return t&&"tileInfo"in t?WBe(t):null}let qg=class extends S6{constructor(e){super(e),this.type="ground",this.color=new qe("#ff7f00"),this.viewVisualizationEnabled=!0,this.numSamplesForPreview=50,this.numSamplesPerChunk=1e3,this._getQueryElevationDependencies=Sm((i,r)=>({ground:i,groundLayers:r}))}get available(){const e=this._ground;return e!=null&&e.layers.some(i=>i.visible)}get minDemResolution(){return YBe(this._ground)}get _queryElevationDependencies(){return this._getQueryElevationDependencies(this._ground,this._groundLayers)}get _ground(){var e,i,r;return(r=(i=(e=this._viewModel)==null?void 0:e.view)==null?void 0:i.map)==null?void 0:r.ground}get _groundLayers(){var e,i;return((i=(e=this._ground)==null?void 0:e.layers)==null?void 0:i.toArray())??[]}async queryElevation(e,i){const r=this._queryElevationDependencies;if(r==null)throw new Error("ElevationProfileLineGround: no dependencies");const{ground:n}=r;if(n==null)throw new Error("No ground configured in the view");const s=await n.queryElevation(e,i),o=Bf(e.spatialReference),l=Bf(n.layers.at(0).spatialReference);if(o!==l){const c=s.geometry;c.points=c.points.map(([f,_,x])=>[f,_,x===i.noDataValue?x:x*l/o])}return s}attach(e){return id([super.attach(e),_e(()=>this._queryElevationDependencies,()=>this._onChange())])}};y([w({type:qe,nonNullable:!0})],qg.prototype,"color",void 0),y([w()],qg.prototype,"viewVisualizationEnabled",void 0),y([w()],qg.prototype,"available",null),y([w({readOnly:!0})],qg.prototype,"minDemResolution",null),y([w()],qg.prototype,"_queryElevationDependencies",null),y([w()],qg.prototype,"_ground",null),y([w()],qg.prototype,"_groundLayers",null),qg=y([Z("esri.widgets.ElevationProfile.ElevationProfileLineGround")],qg);const XBe=qg;let i3e=class{constructor(e,i=null){if(this.tile=e,i!=null&&e!=null){const r=e.extent;this._samplerData=new oFe(i,r)}}get zmin(){return this._samplerData!=null?this._samplerData.data.minValue:0}get zmax(){return this._samplerData!=null?this._samplerData.data.maxValue:0}sample(e,i){if(this._samplerData==null)return;const{safeWidth:r,data:n,dx:s,dy:o,y1:l,x0:c}=this._samplerData,{width:f,values:_,noDataValue:x}=n,T=r3e(o*(l-i),0,r),A=r3e(s*(e-c),0,r),M=Math.floor(T),I=Math.floor(A),L=M*f+I,F=L+f,z=_[L],k=_[F],U=_[L+1],j=_[F+1];if(z!==x&&k!==x&&U!==x&&j!==x){const H=A-I,Y=z+(U-z)*H;return Y+(k+(j-k)*H-Y)*(T-M)}}};function r3e(t,e,i){return ti?i:t}let QHt=class{async queryAll(e,i,r){if(!(e=r&&r.ignoreInvisibleLayers?e.filter(f=>f.visible):e.slice()).length)throw new se("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");const n=sT.fromGeometry(i);let s=!1;r&&r.returnSampleInfo||(s=!0);const o={...l7,...r,returnSampleInfo:!0},l=await this.query(e[e.length-1],n,o),c=await this._queryAllContinue(e,l,o);return c.geometry=c.geometry.export(),s&&delete c.sampleInfo,c}async query(e,i,r){if(!e)throw new se("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||!(i instanceof sT)&&i.type!=="point"&&i.type!=="multipoint"&&i.type!=="polyline")throw new se("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const n={...l7,...r},s=new eqt(e,i.spatialReference,n),o=n.signal;return await e.load({signal:o}),await this._createGeometryDescriptor(s,i,o),await this._selectTiles(s,o),await this._populateElevationTiles(s,o),this._sampleGeometryWithElevation(s),this._createQueryResult(s,o)}async createSampler(e,i,r){if(!e)throw new se("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||i.type!=="extent")throw new se("elevation-query:invalid-extent","Invalid or undefined extent");const n={...l7,...r};return this._createSampler(e,i,n)}async createSamplerAll(e,i,r){if(!(e=r&&r.ignoreInvisibleLayers?e.filter(o=>o.visible):e.slice()).length)throw new se("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");if(!i||i.type!=="extent")throw new se("elevation-query:invalid-extent","Invalid or undefined extent");const n={...l7,...r,returnSampleInfo:!0},s=await this._createSampler(e[e.length-1],i,n);return this._createSamplerAllContinue(e,i,s,n)}async _createSampler(e,i,r,n){const s=r.signal;await e.load({signal:s});const o=i.spatialReference,l=e.tileInfo.spatialReference;o.equals(l)||(await y_([{source:o,dest:l}],{signal:s}),i=rl(i,l));const c=new tqt(e,i,r,n);return await this._selectTiles(c,s),await this._populateElevationTiles(c,s),new Z0e(c.elevationTiles,c.layer.tileInfo,c.options.noDataValue)}async _createSamplerAllContinue(e,i,r,n){if(e.pop(),!e.length)return r;const s=r.samplers.map(f=>ase(f.extent)),o=await this._createSampler(e[e.length-1],i,n,s);if(o.samplers.length===0)return r;const l=r.samplers.concat(o.samplers),c=new Z0e(l,n.noDataValue);return this._createSamplerAllContinue(e,i,c,n)}async _queryAllContinue(e,i,r){const n=e.pop(),s=i.geometry.coordinates,o=i.sampleInfo;ky(o);const l=[],c=[];for(let T=0;T=0?A.source||(A.source=n):e.length&&(l.push(s[T]),c.push(T))}if(!e.length||l.length===0)return i;const f=i.geometry.clone(l),_=await this.query(e[e.length-1],f,r),x=_.sampleInfo;if(!x)throw new Error("no sampleInfo");return c.forEach((T,A)=>{s[T].z=_.geometry.coordinates[A].z,o[T].demResolution=x[A].demResolution}),this._queryAllContinue(e,i,r)}async _createQueryResult(e,i){const r=await e.geometry.project(e.outSpatialReference,i);ky(r);const n={geometry:r.export(),noDataValue:e.options.noDataValue};return e.options.returnSampleInfo&&(n.sampleInfo=this._extractSampleInfo(e)),e.geometry.coordinates.forEach(s=>{s.tile=null,s.elevationTile=null}),n}async _createGeometryDescriptor(e,i,r){let n;const s=e.layer.tileInfo.spatialReference;if(i instanceof sT?n=await i.project(s,r):(await y_([{source:i.spatialReference,dest:s}],{signal:r}),n=rl(i,s)),!n)throw new se("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${s.wkid}'`);e.geometry=sT.fromGeometry(n)}async _selectTiles(e,i){e.type==="geometry"&&this._preselectOutsideLayerExtent(e);const r=e.options.demResolution;if(typeof r=="number")this._selectTilesClosestResolution(e,r);else if(r==="finest-contiguous")await this._selectTilesFinestContiguous(e,i);else{if(r!=="auto")throw new se("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${r}', expected a number, "finest-contiguous" or "auto"`);await this._selectTilesAuto(e,i)}}_preselectOutsideLayerExtent(e){if(e.layer.fullExtent==null)return;const i=new i3e(null);i.sample=()=>e.options.noDataValue,e.outsideExtentTile=i;const r=e.layer.fullExtent;e.geometry.coordinates.forEach(n=>{const s=n.x,o=n.y;(sr.xmax||or.ymax)&&(n.elevationTile=i)})}_selectTilesClosestResolution(e,i){const r=this._findNearestDemResolutionLODIndex(e,i);e.selectTilesAtLOD(r)}_findNearestDemResolutionLODIndex(e,i){const{tileInfo:r,tilemapCache:n}=e.layer,s=i/ws(r.spatialReference),o=a9(r,n);let l=o[0],c=0;for(let f=1;fs.fetchAvailability(l.level,l.row,l.col,{signal:r}))),r);else if(await this._populateElevationTiles(e,r),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new se("elevation-query:has-unavailable-tiles")}catch(l){zo(l),await this._selectTilesFinestContiguousAt(e,i-1,r)}}async _populateElevationTiles(e,i){const r=e.getTilesToFetch(),n={},s=e.options.cache,o=e.options.noDataValue,l=r.map(async c=>{if(c.id==null)return;const f=`${e.layer.uid}:${c.id}:${o}`,_=s!=null?s.get(f):null,x=_??await e.layer.fetchTile(c.level,c.row,c.col,{noDataValue:o,signal:i});s!=null&&s.put(f,x),n[c.id]=new i3e(c,x)});await oT(Promise.allSettled(l),i),e.populateElevationTiles(n)}async _selectTilesAuto(e,i){this._selectTilesAutoFinest(e),this._reduceTilesForMaximumRequests(e);const r=e.layer.tilemapCache;if(!r||Vre(r))return this._selectTilesAutoPrefetchUpsample(e,i);const n=e.getTilesToFetch(),s={},o=n.map(async l=>{const c=new Tj(null,0,0,0,Ni()),f=await Ju(r.fetchAvailabilityUpsample(l.level,l.row,l.col,c,{signal:i}));f.ok!==!1?l.id!=null&&(s[l.id]=c):zo(f.error)});await oT(Promise.all(o),i),e.remapTiles(s)}_reduceTilesForMaximumRequests(e){const i=e.layer.tileInfo;let r=0;const n={},s=c=>{c.id!=null&&(c.id in n?n[c.id]++:(n[c.id]=1,r++))},o=c=>{if(c.id==null)return;const f=n[c.id];f===1?(delete n[c.id],r--):n[c.id]=f-1};e.forEachTileToFetch(s,o);let l=!0;for(;l&&(l=!1,e.forEachTileToFetch(c=>{r<=e.options.maximumAutoTileRequests||(o(c),i.upsampleTile(c)&&(l=!0),s(c))},o),l););}_selectTilesAutoFinest(e){const{tileInfo:i,tilemapCache:r}=e.layer,n=Ure(i,r,e.options.minDemResolution);e.selectTilesAtLOD(n,e.options.maximumAutoTileRequests)}async _selectTilesAutoPrefetchUpsample(e,i){const r=e.layer.tileInfo;await this._populateElevationTiles(e,i);let n=!1;e.forEachTileToFetch((s,o)=>{r.upsampleTile(s)?n=!0:o()}),n&&await this._selectTilesAutoPrefetchUpsample(e,i)}_sampleGeometryWithElevation(e){e.geometry.coordinates.forEach(i=>{const r=i.elevationTile;let n=e.options.noDataValue;if(r){const s=r.sample(i.x,i.y);s!=null?n=s:i.elevationTile=null}i.z=n})}_extractSampleInfo(e){const i=e.layer.tileInfo,r=ws(i.spatialReference);return e.geometry.coordinates.map(n=>{let s=-1;return n.elevationTile&&n.elevationTile!==e.outsideExtentTile&&(s=i.lodAt(n.elevationTile.tile.level).resolution*r),{demResolution:s}})}},sT=class kk{export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const i=new kk;return i.geometry=this.geometry,i.spatialReference=this.spatialReference,i.coordinates=e||this.coordinates.map(r=>r.clone()),i._exporter=this._exporter,i}async project(e,i){if(this.spatialReference.equals(e))return this.clone();await y_([{source:this.spatialReference,dest:e}],{signal:i});const r=new Cm({spatialReference:this.spatialReference,points:this.coordinates.map(l=>[l.x,l.y])}),n=rl(r,e);if(!n)return null;const s=this.coordinates.map((l,c)=>{const f=l.clone(),_=n.points[c];return f.x=_[0],f.y=_[1],f}),o=this.clone(s);return o.spatialReference=e,o}static fromGeometry(e){const i=new kk;if(i.geometry=e,i.spatialReference=e.spatialReference,e instanceof kk)i.coordinates=e.coordinates.map(r=>r.clone()),i._exporter=(r,n)=>{const s=e.clone(r);return s.spatialReference=n,s};else switch(e.type){case"point":{const r=e,{hasZ:n,hasM:s}=r;i.coordinates=n&&s?[new zp(r.x,r.y,r.z,r.m)]:n?[new zp(r.x,r.y,r.z)]:s?[new zp(r.x,r.y,null,r.m)]:[new zp(r.x,r.y)],i._exporter=(o,l)=>e.hasM?new mt(o[0].x,o[0].y,o[0].z,o[0].m,l):new mt(o[0].x,o[0].y,o[0].z,l);break}case"multipoint":{const r=e,{hasZ:n,hasM:s}=r;i.coordinates=n&&s?r.points.map(o=>new zp(o[0],o[1],o[2],o[3])):n?r.points.map(o=>new zp(o[0],o[1],o[2])):s?r.points.map(o=>new zp(o[0],o[1],null,o[2])):r.points.map(o=>new zp(o[0],o[1])),i._exporter=(o,l)=>e.hasM?new Cm({points:o.map(c=>[c.x,c.y,c.z,c.m]),hasZ:!0,hasM:!0,spatiaReference:l}):new Cm(o.map(c=>[c.x,c.y,c.z]),l);break}case"polyline":{const r=e,n=[],s=[],{hasZ:o,hasM:l}=e;let c=0;for(const f of r.paths)if(s.push([c,c+f.length]),c+=f.length,o&&l)for(const _ of f)n.push(new zp(_[0],_[1],_[2],_[3]));else if(o)for(const _ of f)n.push(new zp(_[0],_[1],_[2]));else if(l)for(const _ of f)n.push(new zp(_[0],_[1],null,_[2]));else for(const _ of f)n.push(new zp(_[0],_[1]));i.coordinates=n,i._exporter=(f,_)=>{const x=e.hasM?f.map(A=>[A.x,A.y,A.z,A.m]):f.map(A=>[A.x,A.y,A.z]),T=s.map(A=>x.slice(A[0],A[1]));return new xc({paths:T,hasM:e.hasM,hasZ:!0,spatialReference:_})};break}}return i}},zp=class ZBe{constructor(e,i,r=null,n=null,s=null,o=null){this.x=e,this.y=i,this.z=r,this.m=n,this.tile=s,this.elevationTile=o}clone(){return new ZBe(this.x,this.y,this.z,this.m)}},JBe=class{constructor(e,i){this.layer=e,this.options=i}},eqt=class extends JBe{constructor(e,i,r){super(e,r),this.outSpatialReference=i,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach(i=>i.tile=null);else{const{tileInfo:i,tilemapCache:r}=this.layer,n=a9(i,r)[e].level;this.geometry.coordinates.forEach(s=>s.tile=i.tileAt(n,s.x,s.y))}}allElevationTilesFetched(){return!this.geometry.coordinates.some(e=>!e.elevationTile)}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){var i;for(const r of this.geometry.coordinates)!r.elevationTile&&((i=r.tile)!=null&&i.id)&&(r.elevationTile=e[r.tile.id])}remapTiles(e){var i;for(const r of this.geometry.coordinates){const n=(i=r.tile)==null?void 0:i.id;r.tile=n?e[n]:null}}getTilesToFetch(){var r;const e={},i=[];for(const n of this.geometry.coordinates){const s=n.tile;if(!s)continue;const o=(r=n.tile)==null?void 0:r.id;n.elevationTile||!o||e[o]||(e[o]=s,i.push(s))}return i}forEachTileToFetch(e){for(const i of this.geometry.coordinates)i.tile&&!i.elevationTile&&e(i.tile,()=>{i.tile=null})}},tqt=class extends JBe{constructor(e,i,r,n){super(e,r),this.type="extent",this.elevationTiles=[],this._candidateTiles=[],this._fetchedCandidates=new Set,this.extent=i.intersection(e.fullExtent),this.maskExtents=n}selectTilesAtLOD(e,i){const r=this._maximumLodForRequests(i),n=Math.min(r,e);n<0?this._candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(n)}_maximumLodForRequests(e){const{tileInfo:i,tilemapCache:r}=this.layer,n=a9(i,r);if(!e)return n.length-1;const s=this.extent;if(s==null)return-1;for(let o=n.length-1;o>=0;o--){const l=n[o],c=l.resolution*i.size[0],f=l.resolution*i.size[1];if(Math.ceil(s.width/c)*Math.ceil(s.height/f)<=e)return o}return-1}allElevationTilesFetched(){return this._candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this._fetchedCandidates.clear()}populateElevationTiles(e){for(const i of this._candidateTiles){const r=i.id&&e[i.id];r&&(this._fetchedCandidates.add(i),this.elevationTiles.push(r))}}remapTiles(e){this._candidateTiles=this._uniqueNonOverlappingTiles(this._candidateTiles.map(i=>e[i.id]))}getTilesToFetch(){return this._candidateTiles}forEachTileToFetch(e,i){const r=this._candidateTiles;this._candidateTiles=[],r.forEach(n=>{if(this._fetchedCandidates.has(n))return void(i&&i(n));let s=!1;e(n,()=>s=!0),s?i&&i(n):this._candidateTiles.push(n)}),this._candidateTiles=this._uniqueNonOverlappingTiles(this._candidateTiles,i)}_uniqueNonOverlappingTiles(e,i){const r={},n=[];for(const o of e){const l=o.id;l&&!r[l]?(r[l]=o,n.push(o)):i&&i(o)}const s=n.sort((o,l)=>o.level-l.level);return s.filter((o,l)=>{for(let c=0;ce.extent&&Nz(i,e.extent))}};function Ure(t,e,i=0){const r=a9(t,e);let n=r.length-1;if(i>0){const s=i/ws(t.spatialReference),o=r.findIndex(l=>l.resolution0&&(n=o-1)}return n}const l7={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0};function a9(t,e){const i=t.lods;if(Vre(e)){const{effectiveMinLOD:r,effectiveMaxLOD:n}=e;return i.filter(s=>s.level>=r&&s.level<=n)}return i}function Vre(t){return(t==null?void 0:t.tileInfo)!=null}const zV=Object.freeze(Object.defineProperty({__proto__:null,ElevationQuery:QHt,GeometryDescriptor:sT,getFinestLodIndex:Ure},Symbol.toStringTag,{value:"Module"}));let yv=class extends S6{constructor(e){super(e),this.type="input",this.color=new qe("#00c8c8"),this.viewVisualizationEnabled=!1,this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this.chartFillEnabled=!1,this.chartStrokeOffsetY=-1,this._getQueryElevationDependencies=Sm((i,r,n,s,o)=>i?{elevationInfo:i,visibleLayers:r,view:n,stationary:s,spatialReference:o}:null)}get queryElevationDependencies(){var i;const e=(i=this._viewModel)==null?void 0:i.view;return e==null?null:this._getQueryElevationDependencies(this._elevationInfo,this._visibleLayers,e,e.stationary,e.spatialReference)}get available(){var e;return!((e=this._viewModel)!=null&&e.inputIsSketched)}get _elevationInfo(){var i;const e=(i=this._viewModel)==null?void 0:i.input;return e?_Pe(e):null}get _visibleLayers(){var e,i,r,n;return((n=(r=(i=(e=this._viewModel)==null?void 0:e.view)==null?void 0:i.map)==null?void 0:r.allLayers)==null?void 0:n.filter(s=>s.visible).toArray())??[]}async queryElevation(e,{noDataValue:i,signal:r}){const n=this.queryElevationDependencies;if(n==null)throw new Error("ElevationProfileLineInput: no dependencies");const{view:s,elevationInfo:o,spatialReference:l}=n;if(o.mode==="on-the-ground"&&s.type==="3d"&&l){const c=await sT.fromGeometry(e).project(l,r);if(!c)return{geometry:e,noDataValue:i};const f=s.elevationProvider;return c.coordinates.forEach(_=>{_.z=f.getElevation(_.x,_.y,0,l,"ground")??0}),{geometry:c.export(),noDataValue:i}}return{geometry:e,noDataValue:i}}attach(e){const i=()=>this._onChange();return id([super.attach(e),_e(()=>this.queryElevationDependencies,i),Jr(()=>e.elevationProvider,"elevation-change",i,{onListenerAdd:i,onListenerRemove:i})])}};y([w({type:qe,nonNullable:!0})],yv.prototype,"color",void 0),y([w()],yv.prototype,"viewVisualizationEnabled",void 0),y([w()],yv.prototype,"queryElevationDependencies",null),y([w()],yv.prototype,"available",null),y([w()],yv.prototype,"_elevationInfo",null),y([w()],yv.prototype,"_visibleLayers",null),yv=y([Z("esri.widgets.ElevationProfile.ElevationProfileLineInput")],yv);const iqt=yv;let Ew=class extends S6{constructor(e){super(e),this.type="query",this.color=new qe("#db334a"),this.viewVisualizationEnabled=!0,this.source=null,this.numSamplesForPreview=50,this.numSamplesPerChunk=500}get minDemResolution(){return WBe(this.source)}get available(){const e=this.source;return!!e&&(e.visible==null||e.visible)&&(e.layers==null||e.layers.some(i=>i.visible))}queryElevation(e,i){if(!this.source)throw new Error("No source configured for the elevation profile line");return this.source.queryElevation(e,i)}attach(e){return id([super.attach(e),_e(()=>this.source,()=>this._onChange(),Li)])}};y([w({type:qe,nonNullable:!0})],Ew.prototype,"color",void 0),y([w()],Ew.prototype,"viewVisualizationEnabled",void 0),y([w()],Ew.prototype,"source",void 0),y([w({readOnly:!0})],Ew.prototype,"minDemResolution",null),y([w()],Ew.prototype,"available",null),Ew=y([Z("esri.widgets.ElevationProfile.ElevationProfileLineQuery")],Ew);const rqt=Ew,nqt=2e5;let Du=class extends S6{constructor(e){super(e),this.type="view",this.color=new qe("#cf4ccf"),this.viewVisualizationEnabled=!0,this.include=null,this.exclude=null,this.numSamplesForPreview=50,this.numSamplesPerChunk=25,this._getQueryElevationDependencies=Sm((i,r,n,s,o,l,c)=>({inputGraphicUid:i!=null?KBe(i):null,visibleLayers:r,maxIntersectionDistance:n,intersectOptions:s,view:o,stationary:l,spatialReference:c})),this._vecA=Xi(),this._vecB=Xi(),this._ray=Ko()}get minDemResolution(){var r,n,s;const e=(r=this._viewModel)==null?void 0:r.view;if(e==null||e.type!=="3d")return null;const i=(s=(n=e.pointsOfInterest)==null?void 0:n.focus)==null?void 0:s.renderLocation;return i?e.state.camera.computeRenderPixelSizeAt(i)*Bf(e.spatialReference):null}get queryElevationDependencies(){var i;const e=this._view;return e?this._getQueryElevationDependencies((i=this._viewModel)==null?void 0:i.input,this._visibleLayers,this._maxIntersectionDistance,this._intersectOptions,e,e.stationary,e.spatialReference):null}get _visibleLayers(){var e,i,r;return((r=(i=(e=this._view)==null?void 0:e.map)==null?void 0:i.allLayers)==null?void 0:r.filter(n=>n.visible).toArray())??[]}get _intersectOptions(){const e=this._view;if(e==null||e.destroyed)return{};const i=e.externalToInternalIntersectOptions({include:this.include,exclude:this.exclude}),r=e.externalToInternalIntersectOptions({exclude:this._pointCloudLayers});return i.exclude=vSe(i.exclude,r.exclude),i}get _pointCloudLayers(){const e=this._view;return e==null?[]:e.allLayerViews.toArray().filter(i=>{var r;return((r=i.layer)==null?void 0:r.type)==="point-cloud"}).map(i=>i.layer)}get _view(){var i;const e=(i=this._viewModel)==null?void 0:i.view;return e!=null&&e.type==="3d"?e:null}get _maxIntersectionDistance(){const e=this._view;return e!=null&&e.renderCoordsHelper?Sr(e.spatialReference).radius/e.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY}get _intersector(){const e=this._view;if(e==null)return null;const i=Tp(e.state.viewingMode),r=i.options;return r.hud=!1,r.invisibleTerrain=!1,r.backfacesTerrain=!1,r.selectionMode=!1,r.store=tl.ALL,i}async queryElevation(e,{noDataValue:i,signal:r}){const n=this.queryElevationDependencies;if(n==null)throw new Error("ElevationProfileLineInput: no dependencies");const s=this._intersector;if(s==null)throw new Error("ElevationProfileLineInput: no view");const{intersectOptions:o,view:l,spatialReference:c}=n,f=l.renderCoordsHelper,_=l.sceneIntersectionHelper,x=this._vecA,T=this._vecA,A=this._vecB,M=this._ray;if(!c)return{geometry:e,noDataValue:i};const I=await sT.fromGeometry(e).project(c,r);if(!I)return{geometry:e,noDataValue:i};const L=I.coordinates,F=L.length;for(let z=0;zthis._onChange();return id([super.attach(e),_e(()=>this.queryElevationDependencies,i),Jr(()=>e.elevationProvider,"elevation-change",i,{onListenerAdd:i,onListenerRemove:i})])}};function sqt({view:t,inputGraphicUid:e,maxIntersectionDistance:i},r){for(const n of r){if(n.distanceInRenderSpace!=null&&n.distanceInRenderSpace>i)continue;const s=A8t(n,t);if(s==null||KBe(s)!==e)return n}return null}function KBe(t){if(t.layer&&"objectIdField"in t.layer){const e=t.attributes[t.layer.objectIdField];if(e)return`o-${t.layer.id}-${e}`}return`u-${t.uid}`}y([w({type:qe,nonNullable:!0})],Du.prototype,"color",void 0),y([w()],Du.prototype,"viewVisualizationEnabled",void 0),y([w()],Du.prototype,"include",void 0),y([w()],Du.prototype,"exclude",void 0),y([w({readOnly:!0})],Du.prototype,"minDemResolution",null),y([w()],Du.prototype,"queryElevationDependencies",null),y([w()],Du.prototype,"_visibleLayers",null),y([w()],Du.prototype,"_intersectOptions",null),y([w()],Du.prototype,"_pointCloudLayers",null),y([w()],Du.prototype,"_view",null),y([w()],Du.prototype,"_maxIntersectionDistance",null),y([w()],Du.prototype,"_intersector",null),Du=y([Z("esri.widgets.ElevationProfile.ElevationProfileLineView")],Du);const oqt=Du,aqt={base:S6,key:"type",typeMap:{ground:XBe,input:iqt,query:rqt,view:oqt},errorContext:"elevation-profile-line"},lqt=it.ofType(aqt);var ps,Wd;function cqt(t){return t==="2d"?new nx({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5,color:[0,0,0,255]},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5,color:[255,255,255,255]}]}}}):new Oc({color:[0,0,0,0]})}(function(t){t.Ready="ready",t.Creating="creating",t.Reshaping="reshaping",t.ReshapingDisabled="rehsaping-disabled",t.Selecting="selecting",t.Selected="selected"})(ps||(ps={})),function(t){t.View="view",t.Main="main",t.Interaction="interaction"}(Wd||(Wd={}));let Ud=class extends ze{constructor(e){super(e),this.state=ps.Ready,this._pendingStartOptions=null,this._previousInputInfo=null,this._shouldRemoveLastPoint=!1,this._sketchedGraphics=new WeakSet,this._creationToolPromise=null,this._updateToolPromise=null,this._updateDisabled=!1}initialize(){this.addHandles(_e(()=>({view:this.tool.viewModel.view,visible:this.tool.visible}),({view:e,visible:i})=>{e!=null&&i?this._attach(e):this._detach()},kt),Wd.View)}destroy(){this._detach()}get canStopCreating(){const e=this._geometry,i=this._shouldRemoveLastPoint?3:2;return x6(e)&&e.paths.length>0&&e.paths[0].length>=i}get _input(){return this.tool.viewModel.input}set _input(e){this.tool.viewModel.input=e}get _geometry(){var e;return(e=this._input)==null?void 0:e.geometry}get _visibleAndEditable(){return this.tool.visible&&this.tool.editable}get _view(){return this.tool.viewModel.view}get test(){return{sketchVM:this._sketchVM,toolPromise:Promise.all([this._creationToolPromise??Promise.resolve(),this._updateToolPromise??Promise.resolve()])}}start(e={mode:"sketch"}){if(!this.tool.editable)return;const i=this._view;if(i!=null&&i.ready)switch(this._pendingStartOptions=null,this._stopInteraction(),this._previousInputInfo==null&&this._storePreviousInput(this._input),this._setSketchedGraphic(null),e.mode){case"sketch":this._set("state",ps.Creating),this._startCreationInteraction();break;case"select":this._set("state",ps.Selecting),this._startSelectionInteraction()}else this._pendingStartOptions=e}stop(){this._pendingStartOptions=null,this._stopInteractionAndUpdate(),this._clearPreviousInput()}cancel(){this._pendingStartOptions=null,this._stopInteractionAndUpdate(),this._restorePreviousInput()}clear(){this._stopInteractionAndUpdate(),this._set("state",ps.Ready),this._clearPreviousInput(),this._input=null,this._pendingStartOptions=null}isSketchedGraphic(e){return e!=null&&this._sketchedGraphics.has(e)}_attach(e){this._detach();const i={mode:e.type==="3d"?"relative-to-ground":"on-the-ground",offset:null};this._graphicsLayer=new jse({listMode:"hide",internal:!0,elevationInfo:i});const r=cqt(e.type);this._sketchVM=new TBe({layer:this._graphicsLayer,view:e,defaultCreateOptions:{mode:"click",hasZ:!1},updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:"none"},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"reshape"},polylineSymbol:r,activeLineSymbol:r}),this.addHandles([Mo(()=>e.ready,()=>{const n=this._pendingStartOptions;n&&this.start(n)},kt),_e(()=>[this._input,this._visibleAndEditable],()=>this._update(),kt),_e(()=>({map:e.map,graphicsLayer:this._graphicsLayer}),({map:n,graphicsLayer:s})=>{n!=null&&s!=null&&n.add(s),this._update()},kt)],Wd.Main)}_detach(){var r;this.removeHandles(Wd.Main),this._sketchVM=et(this._sketchVM),this._creationToolPromise=null,this._updateToolPromise=null;const e=(r=this._view)==null?void 0:r.map,i=this._graphicsLayer;e!=null&&i!=null&&e.remove(i),this._graphicsLayer=et(this._graphicsLayer),this._shouldRemoveLastPoint=!1,this._set("state",ps.Ready)}_startCreationInteraction(){this._stopInteractionAndUpdate();const e=this._view,i=this._sketchVM;if(e==null||i==null)return;this._shouldRemoveLastPoint=!1;const r=i.on("create",s=>{var l;const o=s.graphic;switch(s.state){case"complete":this._shouldRemoveLastPoint=!1,this._setSketchedGraphic(o),this._stopInteractionAndUpdate(),this._clearPreviousInput();break;case"cancel":this.cancel();break;case"active":this._setSketchedGraphic(o),((l=s.toolEventInfo)==null?void 0:l.type)==="cursor-update"&&(this._shouldRemoveLastPoint=!0);break;case"start":this._setSketchedGraphic(o)}}),n=()=>{var l;r.remove();const s=this.canStopCreating,o=(l=this._geometry)==null?void 0:l.clone();i.cancel(),this._creationToolPromise=null,o!=null&&s?this._shouldRemoveLastPoint&&this._setSketchedGraphic(new Ml({geometry:uqt(o)})):this._input=null};this.removeHandles(Wd.Interaction),this.addHandles(rr(n),Wd.Interaction),this._creationToolPromise=$m(i.create("polyline"))}_startReshapeInteraction(){this._stopInteraction();const e=this._view,i=this._sketchVM;if(e==null||i==null)return;const r=i.on("update",o=>{const l=o.graphics[0];switch(o.state){case"complete":this._setSketchedGraphic(l),this._stopInteractionAndUpdate(),this._clearPreviousInput();break;case"active":case"start":this._setSketchedGraphic(l)}}),n=()=>{r.remove(),i.cancel(),this._updateToolPromise=null};this.removeHandles(Wd.Interaction),this.addHandles(rr(n),Wd.Interaction);const s=this._input;s&&(s.visible=!0,this._updateToolPromise=$m(i.update(s,{tool:"reshape"})))}_startSelectionInteraction(){this._stopInteraction();const e=this._view;if(e==null)return;const i=e.cursor,r=rr(()=>e.cursor=i);e.cursor="crosshair",e.closePopup();let n=null;const s=rr(()=>gn(n)),o=e.on("immediate-click",c=>{c.preventDefault(),c.stopPropagation(),gn(n),n=Cc(async f=>{const{results:_}=await e.hitTest(c);St(f);const x=_.filter(T=>T.type==="graphic"&&T.graphic!=null).map(T=>T.graphic).find(T=>T.geometry!=null&&T.geometry.type==="polyline");x&&(this._input=x,this._clearPreviousInput(),this._stopInteractionAndUpdate())})}),l=e.on("key-down",c=>{c.key==="Escape"&&this.cancel()});this.removeHandles(Wd.Interaction),this.addHandles([o,l,s,r],Wd.Interaction),e.ready&&e.focus()}_stopInteraction(){this.removeHandles(Wd.Interaction)}_stopInteractionAndUpdate(){this.hasHandles(Wd.Interaction)&&(this._updateDisabled=!0,this._stopInteraction(),this._updateDisabled=!1,this._triggerUpdate())}_triggerUpdate(){this._set("state",ps.Ready),this._update()}_update(){if(this._updateDisabled)return;const e=this.state;if(e!==ps.Selecting){if(this._visibleAndEditable){if(e===ps.Creating||e===ps.Reshaping&&this.isSketchedGraphic(this._input))return}else this.cancel();this._set("state",this._getNextState()),this._updateVisuals()}else this.stop()}_getNextState(){return this._input==null?ps.Ready:this.isSketchedGraphic(this._input)?this.state===ps.Creating?ps.Creating:this._visibleAndEditable?ps.Reshaping:ps.ReshapingDisabled:ps.Selected}_updateVisuals(){switch(this.state){case ps.Creating:break;case ps.Reshaping:this._startReshapeInteraction();break;case ps.ReshapingDisabled:{this._stopInteractionAndUpdate();const e=this._input;e!=null&&this.isSketchedGraphic(e)&&(e.visible=!1);break}case ps.Ready:case ps.Selected:this._stopInteractionAndUpdate();case ps.Selecting:}this._updateSketchedGraphic()}_storePreviousInput(e){this._previousInputInfo={graphic:e}}_restorePreviousInput(){const e=this._previousInputInfo;e!=null&&(this._clearPreviousInput(),this._input=e.graphic,this._triggerUpdate())}_clearPreviousInput(){this._previousInputInfo=null}_updateSketchedGraphic(){const e=this._graphicsLayer;if(e==null)return;const i=e.graphics,r=this._input;if(r==null||!this.isSketchedGraphic(r))return void i.removeAll();if(i.indexOf(r)===-1)i.removeAll(),i.add(r);else if(i.length!==1){const n=i.filter(s=>s!==r);i.removeMany(n)}}_setSketchedGraphic(e){e!=null&&this._sketchedGraphics.add(e),this._input=e,this._updateSketchedGraphic()}};function uqt(t){if(x6(t)){const e=t.clone();return e.paths=[e.paths[0].slice(0,-1)],e}return t}y([w({nonNullable:!0})],Ud.prototype,"state",void 0),y([w({nonNullable:!0})],Ud.prototype,"tool",void 0),y([w()],Ud.prototype,"canStopCreating",null),y([w()],Ud.prototype,"_graphicsLayer",void 0),y([w()],Ud.prototype,"_sketchVM",void 0),y([w()],Ud.prototype,"_input",null),y([w()],Ud.prototype,"_geometry",null),y([w()],Ud.prototype,"_visibleAndEditable",null),y([w()],Ud.prototype,"_view",null),y([w()],Ud.prototype,"_shouldRemoveLastPoint",void 0),Ud=y([Z("esri.widgets.ElevationProfile.ElevationProfileInteraction")],Ud);let zk=class extends ze{constructor(e){super(e),this._implementation=null,this._loadingTask=null}initialize(){this.addHandles(_e(()=>{var e;return{tool:this.tool,view:this.tool.viewModel.view,visible:this.tool.visible&&!!((e=this.tool.viewModel.view)!=null&&e.ready)}},({tool:e,view:i,visible:r})=>{i!=null&&r?this._show(i,e):this._hide()},kt))}destroy(){this._hide()}_show(e,i){this._loadingTask=gn(this._loadingTask),this._loadingTask=Cc(async r=>{if(e.type==="2d"){const n=we(()=>import("./ElevationProfileView2D-KdZmS2un.js"),__vite__mapDeps([287,288,158])),s=(await oT(n,r)).ElevationProfileView2D;this._implementation=new s(e,i)}else if(e.type==="3d"){const n=we(()=>import("./ElevationProfileView3D-bd56oGje.js"),__vite__mapDeps([289,288,158,272,18,19,20,21,22])),s=(await oT(n,r)).ElevationProfileView3D;this._implementation=new s(e,i)}})}_hide(){this._loadingTask=gn(this._loadingTask),this._implementation=et(this._implementation)}};y([w()],zk.prototype,"tool",void 0),zk=y([Z("esri.widgets.ElevationProfile.support.ElevationProfileView")],zk);let vv=class extends ze{constructor(e){super(e),this.editable=!0,this.visible=!0,this.highlightEnabled=!0}initialize(){this.view=new zk({tool:this}),this.interaction=new Ud({tool:this})}destroy(){this.interaction.destroy(),this.view.destroy()}get state(){var i;switch((i=this.interaction)==null?void 0:i.state){case ps.Ready:return jh.Ready;case ps.Creating:return jh.Creating;case ps.Selecting:return jh.Selecting;case ps.Selected:return jh.Selected;case ps.Reshaping:case ps.ReshapingDisabled:return jh.Created}}};y([w({nonNullable:!0})],vv.prototype,"viewModel",void 0),y([w()],vv.prototype,"view",void 0),y([w()],vv.prototype,"interaction",void 0),y([w()],vv.prototype,"editable",void 0),y([w()],vv.prototype,"visible",void 0),y([w()],vv.prototype,"highlightEnabled",void 0),vv=y([Z("esri.widgets.ElevationProfile.ElevationProfileTool")],vv);let un=class extends ze{constructor(e){super(e),this.view=null,this.input=null,this._getEffectiveUnitsMemoized=Sm((i,r)=>({distance:i,elevation:r})),this.geodesicDistanceThreshold=1e5,this.hoveredChartPosition=null,this.uniformChartScaling=!1,this.defaultUnit=null,this.queue=null,this._currentTileCache=null,this.error=null,this._defaultProfileLineGround=new XBe,this._userUnitOptions=null,this._userUnit=null,e!=null&&e.profiles||(this.profiles=new it([this._defaultProfileLineGround]))}initialize(){this.addHandles(_e(()=>this.view,e=>{var n;if(e==null)return void Ce.getLogger(this).warnOnce("no view. Widget will be disabled until a view is provided.");this.removeHandles(n3e);const i=e.type==="3d"?e.resourceController:void 0;(n=this.queue)==null||n.destroy(),this.queue=BHt(i==null?void 0:i.scheduler);const r=i==null?void 0:i.addUpdatingObject(this);r&&this.addHandles(r,n3e)},kt)),this.tool=new vv({viewModel:this}),this._controller=new Tw({viewModel:this})}destroy(){this._defaultProfileLineGround=et(this._defaultProfileLineGround),this._controller=et(this._controller),this._currentTileCache=et(this._currentTileCache),this.tool=et(this.tool),this.queue=et(this.queue)}get profiles(){return this._get("profiles")}set profiles(e){const i=this._get("profiles"),r=e??new it;this._set("profiles",sd(r,i))}get state(){const e=this.view;return e!=null&&e.ready?this.tool.state:jh.Disabled}get progress(){let e=0,i=0;for(const r of this.visibleProfiles)e++,i+=r.progress;return e>0?i/e:0}set unitOptions(e){this._userUnitOptions=e,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(e){this._userUnit=e?this._findSelectableUnit(e,this._userUnit):null,this.notifyChange("unit")}get unit(){return this._userUnit?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}get effectiveUnits(){const e=zHt(this.visibleProfiles.map(n=>n.result)),i=DKe(e.maxDistance,"meters",this.unit),r=NKe(e.maxElevation,"meters",this.unit);return this._getEffectiveUnitsMemoized(i,r)}get highlightEnabled(){return this.tool.highlightEnabled}set highlightEnabled(e){this.tool.highlightEnabled=e}get hasVertices(){var i;const e=(i=this.input)==null?void 0:i.geometry;return x6(e)&&e.paths.reduce((r,n)=>r+n.length,0)>0}get hoveredPoints(){return this.input!=null&&this.visible&&this.tool.editable?this.visibleProfiles.map(e=>{const i=e.hoveredPoint;return i!=null?{hoveredPoint:i,color:e.color}:null}).filter(ys):[]}get statistics(){return kHt(this.visibleProfiles.map(e=>e.statistics))}get chartData(){if(this.input==null)return null;const{effectiveUnits:e,progress:i,statistics:r,visibleProfiles:n,uniformChartScaling:s}=this,o=n.filter(l=>l.hasZ).map(l=>({id:l.id,type:l.type,title:l.title,color:l.color,samples:l.samples,progress:l.progress,chartFillEnabled:l.chartFillEnabled,chartStrokeWidth:l.chartStrokeWidth,chartStrokeOffsetY:l.chartStrokeOffsetY,viewVisualizationEnabled:l.viewVisualizationEnabled}));return o.length===0?null:{lines:o,effectiveUnits:e,statistics:r,refined:i===1,dynamicElevationRange:n.some(l=>l.type==="view"),uniformScaling:s}}get visibleProfiles(){return this.profiles.toArray().filter(e=>e.available&&e.visible)}get minDemResolutions(){const e=[];for(const{minDemResolution:i}of this.visibleProfiles)i!=null&&e.push(i);return e}get minDemResolution(){return $3e(this.minDemResolutions)}get errorState(){var i;const e=(i=this.input)==null?void 0:i.geometry;if(!Hue(e))return Ga.NoValidInput;if(this.error!=null){if(THt(this.error))switch(this.error.cause){case Af.TooComplex:return Ga.TooComplex;case Af.InvalidGeometry:return Ga.InvalidGeometry;case Af.InvalidElevationInfo:return Ga.InvalidElevationInfo;case Af.ElevationQueryError:return Ga.NoValidInput}return Ga.UnknownError}return this.visibleProfiles.length===0?Ga.NoVisibleProfiles:this.chartData==null&&this.progress===1?Ga.RefinedButNoChartData:Ga.None}get tileCache(){var i;this._currentTileCache=et(this._currentTileCache);const e=this.view;if(e!=null&&(e==null?void 0:e.type)==="3d"){const r=(i=e.basemapTerrain)==null?void 0:i.elevationQueryCache;if(r!=null)return r}return this._currentTileCache==null&&(this._currentTileCache=new Q7e(new qB(20*N2.MEGABYTES))),this._currentTileCache}get visible(){return this.tool.visible}set visible(e){this.tool.visible=e}get inputIsSketched(){return this.tool.interaction.isSketchedGraphic(this.input)}get elevationProvider(){const e=this.view;return e!=null&&e.type==="3d"?e.elevationProvider:null}get updating(){var r;const{progress:e}=this,i=!!((r=this.queue)!=null&&r.updating);return e>0&&e<1||i}start(e){this.tool.interaction.start(e)}stop(){this.tool.interaction.stop()}cancel(){this.tool.interaction.cancel()}clear(){this.tool.interaction.clear()}_findSelectableUnit(e,i){const r=this.unitOptions;return e!=null&&r.includes(e)?e:i?this._findSelectableUnit(i):r[0]}_filteredOrAllUnits(e){const i=(e??[]).filter(r=>dL.includes(r));return i.length===0?dL.slice():i}};y([w()],un.prototype,"view",void 0),y([w({type:Ml})],un.prototype,"input",void 0),y([w({type:lqt,nonNullable:!0})],un.prototype,"profiles",null),y([w({readOnly:!0})],un.prototype,"state",null),y([w({readOnly:!0})],un.prototype,"progress",null),y([w()],un.prototype,"unitOptions",null),y([w()],un.prototype,"unit",null),y([w({readOnly:!0})],un.prototype,"effectiveUnits",null),y([w({type:Number})],un.prototype,"geodesicDistanceThreshold",void 0),y([w()],un.prototype,"hoveredChartPosition",void 0),y([w()],un.prototype,"uniformChartScaling",void 0),y([w()],un.prototype,"highlightEnabled",null),y([w({readOnly:!0})],un.prototype,"hoveredPoints",null),y([w({readOnly:!0})],un.prototype,"statistics",null),y([w()],un.prototype,"chartData",null),y([w()],un.prototype,"visibleProfiles",null),y([w()],un.prototype,"minDemResolutions",null),y([w({readOnly:!0})],un.prototype,"minDemResolution",null),y([w({readOnly:!0})],un.prototype,"errorState",null),y([w(ZCe)],un.prototype,"defaultUnit",void 0),y([w()],un.prototype,"queue",void 0),y([w()],un.prototype,"tileCache",null),y([w()],un.prototype,"tool",void 0),y([w()],un.prototype,"visible",null),y([w()],un.prototype,"error",void 0),y([w()],un.prototype,"inputIsSketched",null),y([w()],un.prototype,"elevationProvider",null),y([w()],un.prototype,"updating",null),y([w()],un.prototype,"_defaultProfileLineGround",void 0),y([w()],un.prototype,"_userUnitOptions",void 0),y([w()],un.prototype,"_controller",void 0),y([w()],un.prototype,"_userUnit",void 0),un=y([Z("esri.widgets.ElevationProfile.ElevationProfileViewModel")],un);const n3e=Symbol("updating-object"),QBe=un;let Z0=class extends ze{constructor(){super(...arguments),this.legend=!0,this.chart=!0,this.clearButton=!0,this.settingsButton=!0,this.sketchButton=!0,this.selectButton=!0,this.unitSelector=!0,this.uniformChartScalingToggle=!0}};y([w()],Z0.prototype,"legend",void 0),y([w()],Z0.prototype,"chart",void 0),y([w()],Z0.prototype,"clearButton",void 0),y([w()],Z0.prototype,"settingsButton",void 0),y([w()],Z0.prototype,"sketchButton",void 0),y([w()],Z0.prototype,"selectButton",void 0),y([w()],Z0.prototype,"unitSelector",void 0),y([w()],Z0.prototype,"uniformChartScalingToggle",void 0),Z0=y([Z("esri.widgets.ElevationProfile.ElevationProfileVisibleElements")],Z0);const eje=Z0;function hqt(t,e){return{type:DT(e),value:t,unit:e}}function dqt(t,e){return{type:DT(e),value:t,unit:e}}function pqt(t,e){return{type:DT(e),value:t,unit:e}}function Wue(t,e,i="arithmetic"){return{type:DT(e),value:t,unit:e,rotationType:i}}function xyi(t,e){const i=fqt(t,e);return t.type==="angle"?Wue(i,e,t.rotationType):hqt(i,e)}function fqt(t,e){return Ur(t.value,t.unit,e)}function Syi(t,e){return t==null?e:e==null||t.value>Ur(e.value,e.unit,t.unit)?t:e}function Tyi(t,e){return t==null?null:{...t,value:t.value*e}}function mqt(t,e,i){if(e===i)return t;switch(i){case"arithmetic":case"geographic":return 90-t}}const Eyi=dqt(0,"meters"),Cyi=pqt(0,"square-meters");Wue(0,"radians");const Ayi=Wue(0,"degrees");function tje(t,e,i){return t.units[e][i]}function ex(t,e,i,r=2,n="abbr"){return`${nd(e,{minimumFractionDigits:r,maximumFractionDigits:r,signDisplay:e>0?"never":"exceptZero"})} ${tje(t,i,n)}`}function WG(t,e,i,r=2,n="abbr"){return`${nd(e,{minimumFractionDigits:r,maximumFractionDigits:r,signDisplay:"exceptZero"})} ${tje(t,i,n)}`}function Myi(t,e,i,r=2,n="abbr"){const s=Yne(e,i);return ex(t,Ur(e,i,s),s,r,n)}function Oyi(t,e,i,r=2,n="abbr"){const s=Yne(e,i);return WG(t,Ur(e,i,s),s,r,n)}function Pyi(t,e,i,r=2,n="abbr"){const s=Xne(e,i);return ex(t,Ur(e,i,s),s,r,n)}function Ryi(t,e,i,r=2,n="abbr"){const s=Xne(e,i);return WG(t,Ur(e,i,s),s,r,n)}function Iyi(t,e,i,r=2,n="abbr"){const s=Zne(e,i);return ex(t,Ur(e,i,s),s,r,n)}function $yi(t,e,i,r=2,n="abbr"){const s=Zne(e,i);return WG(t,Ur(e,i,s),s,r,n)}function Lyi(t,e,i,r=2,n="abbr"){const s=Jne(e,i);return ex(t,Ur(e,i,s),s,r,n)}function Dyi(t,e,i,r=2,n="abbr"){const s=Jne(e,i);return WG(t,Ur(e,i,s),s,r,n)}function Nyi(t,e,i,r=2,n="abbr"){const s=FKe(e,i);return ex(t,Ur(e,i,s),s,r,n)}function Fyi(t,e,i,r=2,n="abbr"){const s=kKe(e,i);return ex(t,Ur(e,i,s),s,r,n)}function s3e(t,e,i,r,n){n=n??2;let s=d5.normalize(mqt(Ur(t,e,"degrees"),i,r),0,!0);const o={style:"unit",unitDisplay:"narrow",unit:"degree",maximumFractionDigits:n,minimumFractionDigits:n,signDisplay:s>0?"never":"exceptZero"};return s=ije(s,o),nd(s,o)}function kyi(t,e,i,r,n){i!==r&&(t=-t);const s={style:"unit",unitDisplay:"narrow",unit:"degree",maximumFractionDigits:n=n??2,minimumFractionDigits:n,signDisplay:"exceptZero"};let o=Ur(t,e,"degrees")%360;return o=ije(o,s),nd(o,s)}const o3e=new Map;function ije(t,e){const i=JSON.stringify(e);let r=o3e.get(i);return r||(r=new Intl.NumberFormat("en-US",e),o3e.set(i,r)),/\-?\+?360/.test(r.format(t))?0:t}const a3e=["B","kB","MB","GB","TB"];function zyi(t,e){let i=(e=Math.round(e))===0?0:Math.floor(Math.log(e)/Math.log(N2.KILOBYTES));i=Je(i,0,a3e.length-1);const r=nd(e/N2.KILOBYTES**i,{maximumFractionDigits:2});return h9(t.units.bytes[a3e[i]],{fileSize:r})}const gqt=100;let gS=class extends cn{constructor(e,i){super(e,i),this._updateLayout=r=>{const n=r.parentElement,s=r.style.display;n==null||n.removeChild(r),document.body.appendChild(r),r.style.display="block";let o=80;for(const l of r.childNodes)l instanceof HTMLElement&&(o=Math.max(o,l.offsetWidth));document.body.removeChild(r),n==null||n.appendChild(r),r.style.display=s,r.style.setProperty("--max-width",`${o}px`)},this._updateLayoutThrottled=kV(this._updateLayout,gqt)}loadDependencies(){return Pl({icon:()=>we(()=>import("./calcite-icon-itD416se.js"),__vite__mapDeps([248,245,242]))})}initialize(){this.addHandles(this._updateLayoutThrottled)}render(){return X("div",{afterCreate:this._updateLayout,afterUpdate:this._updateLayoutThrottled,bind:this,class:qR.base},this._renderStatistics())}_renderStatistics(){var i;const e=(i=this._messages)==null?void 0:i.statistics;return e?[this._renderDistanceStatistic("maxDistance",e.maxDistance),this._renderElevationStatistic("elevationGain",e.gain),this._renderElevationStatistic("elevationLoss",e.loss),this._renderElevationStatistic("minElevation",e.minElevation),this._renderElevationStatistic("maxElevation",e.maxElevation),this._renderElevationStatistic("avgElevation",e.avgElevation),this._renderSlopeStatistic("maxPositiveSlope","maxNegativeSlope",e.maxSlope),this._renderSlopeStatistic("avgPositiveSlope","avgNegativeSlope",e.avgSlope)]:[]}_renderDistanceStatistic(e,i){const r=kf().formatPrecision,n=this._renderValue(e,s=>{const o=this.effectiveUnits.distance;return ex(this._messagesUnits,s,o,r)});return this._renderStatistic(i,n)}_renderElevationStatistic(e,i){const r=kf().formatPrecision,n=this._renderValue(e,s=>{const o=this.effectiveUnits.elevation;return ex(this._messagesUnits,s,o,r)});return this._renderStatistic(i,n)}_renderSlopeStatistic(e,i,r){const n=kf().formatPrecision,s=X("div",{class:qR.slopeValue,key:"slope-up"},X("calcite-icon",{icon:"arrow-up",scale:"s"}),this._renderValue(e,o=>s3e(o,"degrees","geographic","geographic",n)),X("calcite-icon",{icon:"arrow-down",scale:"s"}),this._renderValue(i,o=>s3e(o,"degrees","geographic","geographic",n)));return this._renderStatistic(r,s)}_renderStatistic(e,i){return X("div",{class:qR.statistic},X("label",{class:qR.statisticLabel},e),X("div",{class:qR.statisticValue},i))}_renderValue(e,i){const r=this.line,n=r.progress===1?r.statistics:null,s=n==null?void 0:n[e];return s!=null?i(s):xHt}};y([w()],gS.prototype,"effectiveUnits",void 0),y([w()],gS.prototype,"line",void 0),y([w(),Gr("esri/widgets/ElevationProfile/t9n/ElevationProfile")],gS.prototype,"_messages",void 0),y([w(),Gr("esri/core/t9n/Units")],gS.prototype,"_messagesUnits",void 0),gS=y([Z("esri.widgets.ElevationProfile.Statistics")],gS);function l3e(t,{profiles:e}){const i=t.title;if(i!=null)return i;switch(t.type){case"ground":return e.ground;case"input":return e.input;case"query":return e.query;case"view":return e.view;default:return""}}let J0=class extends cn{constructor(e,i){super(e,i),this.checkboxVisible=!0,this.expanded=!1}loadDependencies(){return Pl({action:()=>we(()=>import("./calcite-action-mEzyoc-Z.js"),__vite__mapDeps([290,291,247,237,239,240,241,242,243,244,245,246])),checkbox:()=>we(()=>import("./calcite-checkbox-OaFCWd7i.js"),__vite__mapDeps([283,236,247,237,241,238,239])),label:()=>we(()=>import("./calcite-label-lSeWOYbm.js"),__vite__mapDeps([284,238])),tooltip:()=>we(()=>import("./calcite-tooltip-DucKIjb_.js"),__vite__mapDeps([251,252,253,247,254,255]))})}initialize(){this._statistics=new gS(this._statisticsProps),this.addHandles(_e(()=>this._statisticsProps,e=>this._statistics.set(e)))}destroy(){this._statistics=et(this._statistics)}render(){const e=this.expanded;return X("div",{class:this.classes(k1.base,{[k1.disabled]:this.disabled,[k1.expanded]:e}),key:this},this._renderColorIndicator(),X("div",{class:k1.header,key:"header"},this._renderLabelWithCheckbox(),this._renderCollapseToggleButton()),e?X("div",{class:k1.content,key:"content"},this._statistics.render()):null)}get disabled(){return!this.line.available}get _statisticsProps(){return{line:this.line,effectiveUnits:this.effectiveUnits}}_renderColorIndicator(){return X("div",{class:k1.colorIndicator,key:"color-indicator",styles:{backgroundColor:this.line.color.toCss()}})}_renderCollapseToggleButton(){const{expanded:e,messages:i}=this,r=e?i.hideDetails:i.showDetails;return X("calcite-action",{appearance:"transparent",bind:this,class:k1.collapseToggle,"data-testid":"legend-toggle",icon:e?"chevron-up":"chevron-down",key:"collapse-toggle",onclick:this._onCollapseToggleClick,scale:"s",text:r})}_onCollapseToggleClick(){this.onExpandedToggle()}_renderLabelWithCheckbox(){const{line:e,checkboxVisible:i,disabled:r,messages:n}=this,s=`label-${e.id}`;return X("calcite-label",{class:k1.label,disabled:r,key:s,layout:"inline"},i?this._renderCheckbox(e.id):null,l3e(e,n))}_renderCheckbox(e){const{disabled:i,line:r,messages:n}=this,s=r.visible,o=`${e}-checkbox`,l=s?n.hideProfile:n.showProfile,c=By(l,{name:l3e(r,n)});return X(WI,null,X("calcite-checkbox",{checked:s,class:k1.checkbox,disabled:i,id:o,key:"checkbox",onCalciteCheckboxChange:()=>r.toggleVisibility()}),X("calcite-tooltip",{overlayPositioning:"fixed",placement:"top",referenceElement:o},c))}};y([w()],J0.prototype,"checkboxVisible",void 0),y([w()],J0.prototype,"disabled",null),y([w({nonNullable:!0})],J0.prototype,"effectiveUnits",void 0),y([w()],J0.prototype,"expanded",void 0),y([w({nonNullable:!0})],J0.prototype,"line",void 0),y([w()],J0.prototype,"messages",void 0),y([w()],J0.prototype,"onExpandedToggle",void 0),y([w()],J0.prototype,"_statistics",void 0),J0=y([Z("esri.widgets.ElevationProfile.LegendItem")],J0);let yS=class extends cn{constructor(){super(...arguments),this._expandedLine=null}render(){const{profiles:e,messages:i,effectiveUnits:r,_expandedLine:n}=this;return X("div",{class:wHt.base},e.map(s=>X(J0,{checkboxVisible:e.length>1,effectiveUnits:r,expanded:s===n,line:s,messages:i,onExpandedToggle:()=>this._onExpandedToggle(s)})))}_onExpandedToggle(e){this._expandedLine=e===this._expandedLine?null:e}};y([w()],yS.prototype,"effectiveUnits",void 0),y([w()],yS.prototype,"messages",void 0),y([w()],yS.prototype,"profiles",void 0),y([w()],yS.prototype,"_expandedLine",void 0),yS=y([Z("esri.widgets.ElevationProfile.components.Legend")],yS);const kX="esri-unit-select",zX={base:kX,label:`${kX}__label`,select:`${kX}__select`};let Cw=class extends cn{constructor(e,i){super(e,i),this._onSelectChange=r=>{this.onChange(r.target.value)}}loadDependencies(){return Pl({label:()=>we(()=>import("./calcite-label-lSeWOYbm.js"),__vite__mapDeps([284,238])),option:()=>we(()=>import("./calcite-option-LMeeGK3H.js"),__vite__mapDeps([285,242])),select:()=>we(()=>import("./calcite-select-0Yw6DsYN.js"),__vite__mapDeps([286,236,237,238,239,242,243,245]))})}render(){const{messages:e,options:i,selectLabel:r,value:n,_onSelectChange:s}=this;return X("div",{class:zX.base,key:"units"},X("calcite-label",{class:zX.label},r,X("calcite-select",{class:zX.select,label:r,onCalciteSelectChange:s},i.map(o=>{var l;return X("calcite-option",{key:o,selected:o===n,value:o},$Ke(o)?e.systems[o]:(l=e.units[o])==null?void 0:l.pluralCapitalized)}))))}};y([w()],Cw.prototype,"options",void 0),y([w()],Cw.prototype,"onChange",void 0),y([w()],Cw.prototype,"selectLabel",void 0),y([w()],Cw.prototype,"value",void 0),y([w(),Gr("esri/core/t9n/Units")],Cw.prototype,"messages",void 0),Cw=y([Z("esri.widgets.support.UnitSelect")],Cw);let rf=class extends cn{constructor(){super(...arguments),this.messages=null,this._popover=null,this._popoverIsOpen=!1,this._onPopoverAfterCreate=e=>{this._popover=e},this._onUniformChartScalingChange=e=>{this.onUniformChartScalingChange(e.target.checked)}}loadDependencies(){return Pl({action:()=>we(()=>import("./calcite-action-mEzyoc-Z.js"),__vite__mapDeps([290,291,247,237,239,240,241,242,243,244,245,246])),checkbox:()=>we(()=>import("./calcite-checkbox-OaFCWd7i.js"),__vite__mapDeps([283,236,247,237,241,238,239])),label:()=>we(()=>import("./calcite-label-lSeWOYbm.js"),__vite__mapDeps([284,238])),popover:()=>we(()=>import("./calcite-popover-PeZ1jQob.js"),__vite__mapDeps([292,293,252,253,247,254,240,241,242,244,239,255,243,291,237,245,246])),tooltip:()=>we(()=>import("./calcite-tooltip-DucKIjb_.js"),__vite__mapDeps([251,252,253,247,254,255]))})}initialize(){const e=()=>this._popover;this.addHandles([Jr(e,"calcitePopoverOpen",()=>this._popoverIsOpen=!0),Jr(e,"calcitePopoverClose",()=>this._popoverIsOpen=!1)])}render(){const{id:e,messages:i,visibleElements:r}=this,{unitSelector:n,uniformChartScalingToggle:s}=r;if(!i||!n&&!s)return X("div",{key:`${e}-empty`});const o=`${e}__action`,l=this._popoverIsOpen?i.hideSettings:i.showSettings;return X("div",{class:a7.base,key:this},X("calcite-popover",{afterCreate:this._onPopoverAfterCreate,autoClose:!0,label:l,overlayPositioning:"fixed",placement:"bottom-end",referenceElement:o},this._renderPopoverContent()),X("calcite-action",{appearance:"transparent","data-testid":"settings-button",icon:"gear",id:o,label:l,scale:"s",text:l}))}_renderPopoverContent(){const{unitSelector:e,uniformChartScalingToggle:i}=this.visibleElements;return X("div",{class:a7.popoverContent},e?this._renderUnitSelector():null,i?this._renderUniformChartScalingToggle():null)}_renderUnitSelector(){const{messages:e}=this;return X(Cw,{key:"unit-selector-label",options:this.unitOptions,selectLabel:(e==null?void 0:e.unitSelectLabel)??"",value:this.unit,onChange:this.onUnitChange})}_renderUniformChartScalingToggle(){const{messages:e}=this,i=this.uniformChartScaling,r=`${this.id}__uniform-chart-scaling-toggle`,n=(e==null?void 0:e[i?"uniformChartScalingDisable":"uniformChartScalingEnable"])??"";return X("calcite-label",{class:a7.uniformChartScalingLabel,key:"uniform-chart-scaling-label",layout:"inline"},X("calcite-checkbox",{checked:i,class:a7.uniformChartScalingCheckbox,id:r,onCalciteCheckboxChange:this._onUniformChartScalingChange}),X("calcite-tooltip",{overlayPositioning:"fixed",referenceElement:r},n),e==null?void 0:e.uniformChartScalingLabel)}};y([w()],rf.prototype,"messages",void 0),y([w()],rf.prototype,"onUniformChartScalingChange",void 0),y([w()],rf.prototype,"onUnitChange",void 0),y([w()],rf.prototype,"uniformChartScaling",void 0),y([w()],rf.prototype,"unit",void 0),y([w()],rf.prototype,"unitOptions",void 0),y([w()],rf.prototype,"visibleElements",void 0),y([w()],rf.prototype,"_popover",void 0),y([w()],rf.prototype,"_popoverIsOpen",void 0),rf=y([Z("esri.widgets.ElevationProfile.components.SettingsButton")],rf);var Rh;(function(t){t.Sketch="sketch",t.SketchCancel="sketch-cancel",t.SketchDone="sketch-done",t.Select="select",t.SelectCancel="select-cancel"})(Rh||(Rh={}));const WR=[{type:Rh.Select},{type:Rh.Sketch}],yqt={[Ga.None]:null,[Ga.NoValidInput]:"noProfile",[Ga.NoVisibleProfiles]:"noProfile",[Ga.RefinedButNoChartData]:"noProfile",[Ga.TooComplex]:"tooComplex",[Ga.UnknownError]:"unknown",[Ga.InvalidGeometry]:"invalidGeometry",[Ga.InvalidElevationInfo]:"invalidElevationInfo"},c3e=Symbol("resize-observer-handle");let Ss=class extends cn{constructor(t,e){super(t,e),this.viewModel=null,this.visibleElements=new eje,this.iconClass=Ho.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this._chartContainer=null,this._chart=null,this._chartInitTask=null,this._chartIsRefined=!1,this._width=0,this._zoomOutButtonVisible=!1,this._getChartUpdateParamsMemoized=Sm((i,r,n,s)=>({chart:i,data:r,stationary:n,messages:s})),this._onZoomOutButtonClick=()=>{var i;(i=this._chart)==null||i.zoomOut()},this._onClearButtonClick=()=>{this.viewModel.clear()},t!=null&&t.viewModel||(this._defaultViewModel=new QBe({view:t==null?void 0:t.view}),this.viewModel=this._defaultViewModel)}loadDependencies(){return Pl({action:()=>we(()=>import("./calcite-action-mEzyoc-Z.js"),__vite__mapDeps([290,291,247,237,239,240,241,242,243,244,245,246])),button:()=>we(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([234,235,236,237,238,239,240,241,242,243,244,245,246,247])),loader:()=>we(()=>import("./calcite-loader-Z65agR8e.js"),__vite__mapDeps([294,246,247]))})}postInitialize(){this.addHandles([_e(()=>({container:this._chartContainer,width:this._width}),({container:t,width:e})=>{this._destroyChart(),t!=null&&e>0&&this._initializeChart(t)},ii),_e(()=>this._chartUpdateParams,()=>this._updateChart(this._chartUpdateParams),ii)])}destroy(){this._destroyChart(),this._defaultViewModel!=null&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}get input(){return this.viewModel.input}set input(t){this.viewModel.input=t}get profiles(){return this.viewModel.profiles}set profiles(t){this.viewModel.profiles=t}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(t){this.viewModel.unitOptions=t}get unit(){return this.viewModel.unit}set unit(t){this.viewModel.unit=t}get geodesicDistanceThreshold(){return this.viewModel.geodesicDistanceThreshold}set geodesicDistanceThreshold(t){this.viewModel.geodesicDistanceThreshold=t}get label(){var t;return((t=this.messages)==null?void 0:t.widgetLabel)??""}set label(t){this._overrideIfSome("label",t)}get visible(){return this.viewModel.visible}set visible(t){this.viewModel.visible=t}get _portrait(){return this._widthi.uniformChartScaling=n,onUnitChange:n=>i.unit=n}):null),X("div",{class:Ho.mainContainer,key:"main-container"},e),this.visibleElements.legend?X(yS,{effectiveUnits:i.effectiveUnits,messages:this.messages,profiles:this._profilesArray}):null,this._renderActions(t))}_renderZoomOutButton(){return X("calcite-action",{appearance:"transparent",class:Ho.zoomOutButton,"data-testid":"zoom-out-button",icon:"magnifying-glass-minus",key:"zoom-out",onclick:this._onZoomOutButtonClick,scale:"s",text:this.messages.zoomOut})}_renderClearButton(){return X("calcite-action",{appearance:"transparent",class:Ho.clearButton,"data-testid":"clear-button",icon:"trash",key:"clear-profile",onclick:this._onClearButtonClick,scale:"s",text:this.messages.clearProfile})}_renderPrompt(t){return[X("div",{bind:this,class:Ho.promptContainer,key:"prompt-container"},X("p",null,t))]}_renderChart(){if(!this.visibleElements.chart)return X("div",{class:Ho.chartContainer,key:"empty-chart-container"});const t=this._chartIsRefined||this._canRenderChart();if(!t)return X(WI,null,this._renderSpinner({size:"large"}),X("div",{class:Ho.chartContainer,key:"chart-container-empty"}));const{chartData:e,progress:i}=this.viewModel;return X(WI,null,e!=null&&i>0&&i<1?this._renderSpinner({size:t?"small":"large"}):null,X("div",{afterCreate:this._onChartContainerAfterCreate,afterRemoved:this._onChartContainerRemoved,bind:this,class:Ho.chartContainer,key:"chart-container"}))}_renderSpinner(t){const e=t.size==="small";return X("calcite-loader",{afterCreate:this._onSpinnerAfterCreate,class:this.classes(Ho.chartSpinner,e&&Ho.chartSpinnerSmall),exitAnimation:this._onSpinnerExit,inline:e,key:"spinner",label:"",scale:"s"})}_onSpinnerAfterCreate(t){requestAnimationFrame(()=>t.classList.add(Ho.chartSpinnerVisible))}_onSpinnerExit(t,e){t.classList.remove(Ho.chartSpinnerVisible),setTimeout(e,200)}_canRenderChart(){const t=this.viewModel.chartData;if(t==null)return!1;if(!this.viewModel.inputIsSketched)return t.refined;let e=0;for(const{samples:i}of t.lines)e+=i!=null?i.length:0;return t.refined||e<=kf().largeChartSamples}_renderActions({actions:t}){const e=t.map(i=>{switch(i.type){case Rh.Sketch:return this.visibleElements.sketchButton&&this._renderAction({action:i,className:Ho.sketchButton,label:this.messages.sketchButtonLabel,onClick:this._onSketchButtonClick,primary:!0});case Rh.SketchCancel:return this.visibleElements.sketchButton&&this._renderAction({action:i,onClick:this._onCancelButtonClick,className:Ho.sketchCancelButton,label:this.messagesCommon.cancel,primary:!1});case Rh.SketchDone:return this.visibleElements.sketchButton&&this._renderAction({action:i,onClick:this._onDoneButtonClick,className:Ho.sketchDoneButton,label:this.messagesCommon.done,primary:!0});case Rh.Select:return this.visibleElements.selectButton&&this._renderAction({action:i,onClick:this._onSelectButtonClick,className:Ho.selectButton,label:this.messages.selectButtonLabel,primary:!1});case Rh.SelectCancel:return this.visibleElements.selectButton&&this._renderAction({action:i,onClick:this._onCancelButtonClick,className:Ho.selectCancelButton,label:this.messagesCommon.cancel,primary:!1})}}).filter(Boolean);return e.length?X("footer",{class:Ho.footer,key:"footer"},e):null}_renderAction({action:t,className:e,label:i,onClick:r,primary:n}){return X("calcite-button",{appearance:n?"solid":"outline-fill",bind:this,class:this.classes(Ho.actionButton,e),disabled:t.disabled,key:`action-${t.type}`,onclick:r},i)}_onSketchButtonClick(){this.viewModel.start({mode:"sketch"})}_onSelectButtonClick(){this.viewModel.start({mode:"select"})}_onCancelButtonClick(){this.viewModel.cancel()}_onDoneButtonClick(){this.viewModel.stop()}_onContentWrapperAfterCreate(t){const e=aB(t,i=>{this._width=i.contentRect.width});this.addHandles(e,c3e)}_onContentWrapperRemoved(){this.removeHandles(c3e)}_updateChart(t){const{data:e,chart:i,messages:r,stationary:n}=t;i!=null&&r!=null&&n&&this._canRenderChart()&&(i.update(t),this._chartIsRefined=e!=null&&e.refined)}_onChartContainerAfterCreate(t){this._chartContainer=t}_onChartContainerRemoved(){this._chartContainer=null}_initializeChart(t){gn(this._chartInitTask),this._chartInitTask=Cc(async e=>{const{createChart:i}=await we(()=>import("./chartUtils-P39aKol1.js"),__vite__mapDeps([295,296,297,298,299,300,301,302,303,304]));St(e);const r=await i({container:t,abortOptions:{signal:e},onRangeChange:(n,s)=>{this._zoomOutButtonVisible=n!==1||s!==1},onCursorPositionChange:n=>{this.viewModel.hoveredChartPosition=n}});if(e.aborted)throw et(r),ur();this._chart=r,this._updateChart(this._chartUpdateParams)})}_destroyChart(){this._chartInitTask=gn(this._chartInitTask),this._chart=et(this._chart),this._chartIsRefined=!1}};y([w({type:QBe})],Ss.prototype,"viewModel",void 0),y([w()],Ss.prototype,"view",null),y([w()],Ss.prototype,"input",null),y([w()],Ss.prototype,"profiles",null),y([w()],Ss.prototype,"unitOptions",null),y([w()],Ss.prototype,"unit",null),y([w()],Ss.prototype,"geodesicDistanceThreshold",null),y([w({type:eje,nonNullable:!0})],Ss.prototype,"visibleElements",void 0),y([w()],Ss.prototype,"iconClass",void 0),y([w()],Ss.prototype,"icon",void 0),y([w()],Ss.prototype,"label",null),y([w()],Ss.prototype,"visible",null),y([w(),Gr("esri/widgets/ElevationProfile/t9n/ElevationProfile")],Ss.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],Ss.prototype,"messagesCommon",void 0),y([w(),Gr("esri/core/t9n/Units")],Ss.prototype,"messagesUnits",void 0),y([w()],Ss.prototype,"_chartContainer",void 0),y([w()],Ss.prototype,"_chart",void 0),y([w()],Ss.prototype,"_chartInitTask",void 0),y([w()],Ss.prototype,"_chartIsRefined",void 0),y([w()],Ss.prototype,"_width",void 0),y([w()],Ss.prototype,"_portrait",null),y([w()],Ss.prototype,"_zoomOutButtonVisible",void 0),y([w()],Ss.prototype,"_chartUpdateParams",null),y([w()],Ss.prototype,"_chartMessages",null),y([w()],Ss.prototype,"_profilesArray",null),Ss=y([Z("esri.widgets.ElevationProfile")],Ss);const vqt=Ss,_qt=t=>new vqt({view:t,container:"elevation-profile-container",profiles:[{type:"ground",title:"Maapind"},{type:"view",title:"Kihid"}],visibleElements:{selectButton:!0}}),bqt=t=>{const e=document.getElementById("distanceButton"),i=document.getElementById("areaButton"),r=document.getElementById("clearButton");e.addEventListener("click",()=>{e.active=!0,i.active=!1,t.activeTool="direct-line"}),i.addEventListener("click",()=>{e.active=!1,i.active=!0,t.activeTool="area"}),r.addEventListener("click",()=>{e.active=!1,i.active=!1,t.clear()})},mf="esri-shadow-cast",Fb={base:mf,widgetIcon:si.measureBuildingHeightShadow,timeRange:`${mf}__time-range`,timeRangeIndicator:`${mf}__time-range__indicator`,datePickerContainer:`${mf}__date-picker-container`,visualization:`${mf}__visualization`,visualizationSelect:`${mf}__visualization__select`,visualizationConfigHidden:`${mf}__visualization__config--hidden`},wqt=`${mf}__label`,u3e=`${mf}__threshold-config`,h3e={base:u3e,valueLabel:`${u3e}__value-label`},d3e=`${mf}__duration-config`,p3e={base:d3e,radioGroup:`${d3e}__radio-group`},xqt=`${mf}__discrete-config`,Sqt={base:xqt},f3e=`${mf}__tooltip`,m3e={base:f3e,content:`${f3e}__content`};var DO;(function(t){t.Disabled="disabled",t.Ready="ready"})(DO||(DO={}));let gM=class extends ze{constructor(){super({}),this.color=new qe([50,50,50,.7]),this.intervalOptions=new it([Gs(15,"minutes","milliseconds"),Gs(30,"minutes","milliseconds"),Gs(1,"hours","milliseconds"),Gs(2,"hours","milliseconds"),Gs(3,"hours","milliseconds")]),this.interval=this.intervalOptions.at(0)}set intervalOptions(e){this._set("intervalOptions",sd(e,this._get("intervalOptions")))}};y([w({type:qe})],gM.prototype,"color",void 0),y([w()],gM.prototype,"interval",void 0),y([w({type:it})],gM.prototype,"intervalOptions",null),gM=y([Z("esri.widgets.ShadowCast.DiscreteOptions")],gM);const rje=gM;var f2;(function(t){t.Continuous="continuous",t.Hourly="hourly"})(f2||(f2={}));let kI=class extends ze{constructor(){super(...arguments),this.color=new qe([0,0,255,.7]),this.mode=f2.Continuous}};y([w({type:qe})],kI.prototype,"color",void 0),y([w()],kI.prototype,"mode",void 0),kI=y([Z("esri.widgets.ShadowCast.DurationOptions")],kI);const nje=kI;var zw;(function(t){t.PointerMove="pointer-move",t.Main="main"})(zw||(zw={}));const Tqt=300;let K0=class extends ze{constructor(e){super(e),this._screenPoint=null,this._accumulatedShadowTime=null,this._shadowTimeTask=null,this._updateAccumulatedShadowTime=(i,r)=>{this._shadowTimeTask=gn(this._shadowTimeTask),this._shadowTimeTask=Cc(async n=>{const{results:s,ground:o}=await i.hitTest(r);if(s.length===0&&!o.mapPoint)return void(this._accumulatedShadowTime=null);const l=await this.getDuration(r,n);this._accumulatedShadowTime=l})},this._throttledUpdateAccumulatedShadowTime=kV(this._updateAccumulatedShadowTime,Tqt)}initialize(){this.addHandles(_e(()=>({enabled:this.enabled,view:this.view}),({enabled:e,view:i})=>{e&&i!=null?this._startTracking(i):this._stopTracking()},kt))}get screenPoint(){return this.enabled?this._screenPoint:null}get accumulatedShadowTime(){return this.enabled?this._accumulatedShadowTime:null}get testData(){return{setThrottleDelay:e=>{this._throttledUpdateAccumulatedShadowTime.remove(),this._throttledUpdateAccumulatedShadowTime=kV(this._updateAccumulatedShadowTime,e)}}}_startTracking(e){if(this.hasHandles(zw.Main))return;const i=()=>{this.hasHandles(zw.PointerMove)||this.addHandles(e.on("pointer-move",n=>{const s=Ku(n.x,n.y);this._screenPoint=s,this._throttledUpdateAccumulatedShadowTime(e,s)}),zw.PointerMove)},r=()=>{this.removeHandles(zw.PointerMove),this._screenPoint=null,this._accumulatedShadowTime=null};this.addHandles([this._throttledUpdateAccumulatedShadowTime,e.on("pointer-enter",i),e.on("pointer-leave",r),e.on("pointer-down",r),e.on("pointer-drag",r),e.on("pointer-up",i),e.on("click",n=>{const s=Ku(n.x,n.y);this._screenPoint=s,this._updateAccumulatedShadowTime(e,s)}),rr(()=>{this._shadowTimeTask=gn(this._shadowTimeTask)})],zw.Main),i()}_stopTracking(){this.removeHandles(zw.Main)}};y([w()],K0.prototype,"getDuration",void 0),y([w()],K0.prototype,"view",void 0),y([w()],K0.prototype,"enabled",void 0),y([w()],K0.prototype,"screenPoint",null),y([w()],K0.prototype,"accumulatedShadowTime",null),y([w()],K0.prototype,"_screenPoint",void 0),y([w()],K0.prototype,"_accumulatedShadowTime",void 0),y([w()],K0.prototype,"_shadowTimeTask",void 0),K0=y([Z("esri.widgets.ShadowCast.ShadowTooltipViewModel")],K0);var qa;(function(t){t.Threshold="threshold",t.Duration="duration",t.Discrete="discrete"})(qa||(qa={}));qa.Threshold,qa.Duration,qa.Discrete;let vS=class extends ze{constructor(){super(...arguments),this.color=new qe([255,0,0,.7]),this.value=Gs(4,"hours","milliseconds"),this.minValue=0,this.maxValue=Gs(8,"hours","milliseconds")}};y([w({type:qe})],vS.prototype,"color",void 0),y([w()],vS.prototype,"value",void 0),y([w()],vS.prototype,"minValue",void 0),y([w()],vS.prototype,"maxValue",void 0),vS=y([Z("esri.widgets.ShadowCast.ThresholdOptions")],vS);const sje=vS,g3e=[],Eqt=W(),y3e=[],v3e=255,Cqt=Gs(1,"hours","milliseconds"),Aqt=500;let an=class extends ze{constructor(t){super(t),this.view=null,this.tooltip=new K0({getDuration:(e,i)=>this.getDuration(e,i)}),this.startTimeOfDay=Gs(10,"hours","milliseconds"),this.endTimeOfDay=Gs(16,"hours","milliseconds"),this.visualizationType=qa.Threshold,this.thresholdOptions=new sje,this.durationOptions=new nje,this.discreteOptions=new rje,this._running=!0,this._stopPreviewingTask=null,this._forcePreview=!1,this._autoRestoreForcePreviewEnabled=!0,this._utcOffset=null,this.date=new Date}initialize(){this.addHandles([_e(()=>({view:this.view,tooltipEnabled:this._tooltipEnabled}),({view:t,tooltipEnabled:e})=>{this.tooltip.view=t,this.tooltip.enabled=e},kt),_e(()=>this._forcePreviewDependencies,()=>{gn(this._stopPreviewingTask),this._forcePreview=!0,this._autoRestoreForcePreviewEnabled&&(this._stopPreviewingTask=Cc(async t=>{await T2(Aqt,t),St(t),this._forcePreview=!1}))},kt),_e(()=>({renderer:this.renderer,parameters:this._visualizationParameters}),t=>YR(t.renderer,t.parameters),kt),_e(()=>({renderer:this.renderer,parameters:{lightDirections:this._lightDirections}}),t=>YR(t.renderer,t.parameters),kt),_e(()=>({renderer:this.renderer,parameters:{enabled:this._running}}),t=>YR(t.renderer,t.parameters),kt),_e(()=>({renderer:this.renderer,parameters:{previewing:this._previewing}}),t=>YR(t.renderer,t.parameters),kt)])}destroy(){this.stop(),YR(this.renderer,{enabled:!1}),et(this.tooltip)}get state(){return this.view!=null&&this.view.ready&&this._referencePosition!=null?DO.Ready:DO.Disabled}set date(t){const e=new Date(t);e.setHours(0,0,0,0),this._set("date",e)}get utcOffset(){return this._utcOffset??this._utcOffsetAuto}set utcOffset(t){this._utcOffset=t}get testData(){return{setAutoRestoreForcedPreviewEnabled:t=>{this._autoRestoreForcePreviewEnabled=t},setForcedPreview:t=>{this._forcePreview=t},isPreviewing:()=>this._previewing}}get _previewing(){const{view:t}=this;return(t==null?void 0:t.allLayerViews)==null||this._forcePreview||!t.stationary||t.allLayerViews.some(e=>Bre(e)&&e.updating)}get _utcOffsetAuto(){const t=this._referencePosition;return t!=null?k4e(t[0],!1):0}get _dateUTCOffset(){let t=this.date;return t=rD(t,-t.getTimezoneOffset(),"minutes"),t=rD(t,-this.utcOffset,"hours"),t}get _startDateTimeUTC(){return rD(this._dateUTCOffset,this.startTimeOfDay)}get _endDateTimeUTC(){return rD(this._dateUTCOffset,this.endTimeOfDay)}get _referencePosition(){var t,e;return(e=(t=this.view)==null?void 0:t.environmentManager)==null?void 0:e.referencePositionWGS84Comparable}get _interval(){const t=this._duration>0?Math.floor(this._duration/v3e):v3e,e=this.discreteOptions.interval;switch(this.visualizationType){case qa.Threshold:case qa.Duration:return t;case qa.Discrete:return e>0?e:t}}get _sampleCount(){return this._lightDirections.length}get _duration(){return this.endTimeOfDay-this.startTimeOfDay}get _lightDirections(){const{view:t}=this;if(t==null)return g3e;const e=t.viewingMode==="global"?Eqt:this._referencePosition;if(e==null)return g3e;const i=this._interval,r=jvt(this._startDateTimeUTC,this._endDateTimeUTC,i,e,t.state.viewingMode),n=r.length;y3e.length=0;const s=HBe(0,n,y3e),o=new Array(n);for(let l=0;l0?t/this._duration:0}}get _durationVisualizationParameters(){const{color:t,mode:e}=this.durationOptions,i=this._duration,r=i>0&&e===f2.Hourly?Cqt/i:0;return{color:qe.toUnitRGBA(t),visualization:s_.Gradient,bandsEnabled:r>0,bandSize:r}}get _discreteVisualizationParameters(){return{color:qe.toUnitRGBA(this.discreteOptions.color),visualization:s_.Gradient,bandsEnabled:!1,bandSize:0}}get _forcePreviewDependencies(){const{view:t}=this;if(t==null)return null;const e=t.slicePlane,i=t.allLayerViews.toArray().filter(Bre),r=i.map(f=>f.layer).filter(ys),n=i.map(f=>f.visible),s=r.map(f=>f.visible),o=r.map(f=>f.opacity),l=r.filter(f=>"definitionExpression"in f).map(f=>f.definitionExpression),c=i.filter(f=>"filter"in f).map(f=>f.filter);return{slicePlane:e,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewVisibilities:n,layerVisibilities:s,layerOpacities:o,filters:c,definitionExpressions:l}}get renderer(){const{view:t}=this;if(t==null)return null;const e=t._stage;return e==null?null:e.renderer}start(){this.setRunning(!0)}stop(){this.setRunning(!1)}setRunning(t){this._running=t}async getDuration(t,e){const{view:i,renderer:r}=this;if(i==null||r==null)return 0;const n=i.state.camera.screenToRender(ss(t.x,t.y),gse()),s=r.readAccumulatedShadow(n),o=this._sampleCount;return o===0?0:s*o*(this._duration/o)}};function YR(t,e){t!=null&&e!=null&&t.setParameters({shadowCastOptions:e})}function Bre(t){if(t.suspended)return!1;switch(t.type){case"building-scene-3d":case"csv-3d":case"elevation-3d":case"feature-3d":case"geojson-3d":case"graphics-3d":case"integrated-mesh-3d":case"ogc-feature-3d":case"route-3d":case"scene-layer-3d":case"scene-layer-graphics-3d":case"stream-3d":case"wms-3d":return!0;case"base-dynamic-3d":case"dimension-3d":case"imagery-3d":case"imagery-tile-3d":case"line-of-sight-3d":case"map-image-3d":case"point-cloud-3d":case"tile-3d":case"vector-tile-3d":case"voxel-3d":case"wfs-3d":case"wmts-3d":case"media-3d":default:return!1;case"group":return t.layerViews.toArray().some(e=>Bre(e))}}y([w()],an.prototype,"state",null),y([w()],an.prototype,"view",void 0),y([w()],an.prototype,"tooltip",void 0),y([w({nonNullable:!0})],an.prototype,"date",null),y([w({nonNullable:!0})],an.prototype,"utcOffset",null),y([w({nonNullable:!0})],an.prototype,"startTimeOfDay",void 0),y([w({nonNullable:!0})],an.prototype,"endTimeOfDay",void 0),y([w({nonNullable:!0})],an.prototype,"visualizationType",void 0),y([w({type:sje,nonNullable:!0})],an.prototype,"thresholdOptions",void 0),y([w({type:nje,nonNullable:!0})],an.prototype,"durationOptions",void 0),y([w({type:rje,nonNullable:!0})],an.prototype,"discreteOptions",void 0),y([w()],an.prototype,"_running",void 0),y([w()],an.prototype,"_stopPreviewingTask",void 0),y([w()],an.prototype,"_forcePreview",void 0),y([w()],an.prototype,"_autoRestoreForcePreviewEnabled",void 0),y([w()],an.prototype,"_previewing",null),y([w()],an.prototype,"_utcOffset",void 0),y([w()],an.prototype,"_utcOffsetAuto",null),y([w()],an.prototype,"_dateUTCOffset",null),y([w()],an.prototype,"_startDateTimeUTC",null),y([w()],an.prototype,"_endDateTimeUTC",null),y([w()],an.prototype,"_referencePosition",null),y([w()],an.prototype,"_interval",null),y([w()],an.prototype,"_sampleCount",null),y([w()],an.prototype,"_duration",null),y([w()],an.prototype,"_lightDirections",null),y([w()],an.prototype,"_tooltipEnabled",null),y([w()],an.prototype,"_visualizationParameters",null),y([w()],an.prototype,"_thresholdVisualizationParameters",null),y([w()],an.prototype,"_durationVisualizationParameters",null),y([w()],an.prototype,"_discreteVisualizationParameters",null),y([w()],an.prototype,"_forcePreviewDependencies",null),y([w()],an.prototype,"renderer",null),an=y([Z("esri.widgets.ShadowCast.ShadowCastViewModel")],an);const Mqt=an;let _v=class extends ze{constructor(){super(...arguments),this.timeRangeSlider=!0,this.timezone=!0,this.datePicker=!0,this.visualizationOptions=!0,this.colorPicker=!0,this.tooltip=!0}};y([w()],_v.prototype,"timeRangeSlider",void 0),y([w()],_v.prototype,"timezone",void 0),y([w()],_v.prototype,"datePicker",void 0),y([w()],_v.prototype,"visualizationOptions",void 0),y([w()],_v.prototype,"colorPicker",void 0),y([w()],_v.prototype,"tooltip",void 0),_v=y([Z("esri.widgets.ShadowCast.ShadowCastVisibleElements")],_v);const oje=_v;function aje(t,e="milliseconds",i={}){const r={locale:Oqt(),numberingSystem:"latn"};let n;return n=t?hn.fromMillis(Gs(t,e,"milliseconds"),r).rescale():hn.fromObject({seconds:0},r),n.toHuman({listStyle:"narrow",unitDisplay:"long",...i})}function Oqt(){return lne()==="bs"?"hr":fa()}function YG(t,e){const{for:i,label:r,tabIndex:n,...s}=t;return X("div",{class:GS(wqt,s==null?void 0:s.class),key:i,...s},X("calcite-label",{for:i,scale:"s",tabIndex:n},r),e)}const l3="esri-color-picker",c3={base:l3,backgroundPattern:`${l3}__bg-pattern`,toggleButton:`${l3}__toggle-button`,popover:`${l3}__popover`,opacitySliderContainer:`${l3}__opacity-slider-container`,opacitySlider:`${l3}__opacity-slider`,calciteColorPicker:`${l3}__calcite-color-picker`};var Uw;(function(t){t.ColorPickerFocus="hex-input-poll-timeout",t.ButtonFocusTimeout="button-focus-timeout"})(Uw||(Uw={}));let Vd=class extends cn{constructor(t,e){super(t,e),this.value=new qe,this.alphaEnabled=!0,this._containerElement=null,this._popover=null,this._popoverElement=null,this._buttonElement=null,this._colorPickerCreated=!1}initialize(){this.addHandles(_e(()=>({container:this._containerElement,value:this.value}),({container:t,value:e})=>{t==null||t.style.setProperty("--esri-color-picker-value",e.toCss(!0))},kt))}loadDependencies(){return Pl({button:()=>we(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([234,235,236,237,238,239,240,241,242,243,244,245,246,247])),"color-picker":()=>we(()=>import("./calcite-color-picker-iQ658ZQD.js"),__vite__mapDeps([305,239,245,242,236,237,241,238,240,244,243,306,307,235,246,247,253])),label:()=>we(()=>import("./calcite-label-lSeWOYbm.js"),__vite__mapDeps([284,238])),slider:()=>we(()=>import("./calcite-slider--uw2bYfU.js"),__vite__mapDeps([308,247,236,237,241,238,239,240,242,307]))})}destroy(){this._destroyPopover(),this._buttonElement=null}render(){const t=this._messages,e=this._popover!=null&&this._popover.open?t.close:t.open;return X("div",{afterCreate:this._onContainerAfterCreate,bind:this,class:this.classes(c3.base,this.class)},X("div",{class:c3.backgroundPattern}),X("calcite-button",{afterCreate:this._onButtonAfterCreate,appearance:"transparent",bind:this,class:c3.toggleButton,id:this.id,kind:"neutral",label:e,onclick:this._togglePopover,scale:"s",tabIndex:-1,title:e}))}_onContainerAfterCreate(t){this._containerElement=t}_onButtonAfterCreate(t){this._destroyPopover(),this._buttonElement=t,this._popover=new kBe({owner:this,anchorElement:t,placement:"bottom-start",renderContentFunction:this._renderPopoverContent})}_destroyPopover(){this.removeHandles(Uw.ColorPickerFocus),this._popover=et(this._popover),this._popoverElement=null}_renderPopoverContent(){const t=this.value,e=this._messages;return X("div",{afterCreate:this._onPopoverAfterCreate,bind:this,class:c3.popover,onfocusout:this._onPopoverFocusOut,onkeydown:this._onPopoverKeyDown,tabIndex:-1},X("calcite-color-picker",{afterCreate:this._onColorPickerAfterCreate,afterRemoved:()=>this._colorPickerCreated=!1,bind:this,class:c3.calciteColorPicker,hideChannels:!0,hideSaved:!0,scale:"m",value:this._colorPickerCreated?t.toCss():null,onCalciteColorPickerInput:this._onColorInput}),this.alphaEnabled?X("section",{class:c3.opacitySliderContainer},X("calcite-label",{scale:"s"},e.opacity,X("calcite-slider",{bind:this,class:c3.opacitySlider,labelHandles:!0,max:1,min:0,step:.01,value:t.a,onCalciteSliderInput:this._onOpacityChange}))):null)}_onColorInput(t){const e=t.target.value,i=typeof e=="string"?new qe(e):new qe;i.a=this.value.a,this._onChange(i)}_onOpacityChange(t){const e=this.value.clone();e.a=t.target.value,this._onChange(e)}_onChange(t){this.value=t,this.onChange!=null&&this.onChange(t)}_onColorPickerAfterCreate(t){this.removeHandles(Uw.ColorPickerFocus);const e=Cc(async i=>{t.componentOnReady&&await t.componentOnReady(),St(i),this._colorPickerCreated=!0,await new Promise(r=>requestAnimationFrame(r)),St(i),t.setFocus()});this.addHandles(rr(()=>{e.abort(),this._colorPickerCreated=!1}),Uw.ColorPickerFocus)}_togglePopover(t){this._popover!=null&&this._popover.open?this._closePopover():this._openPopover()}_openPopover(){const t=this._popover;t&&(t.open=!0)}_closePopover(){this.removeHandles(Uw.ColorPickerFocus);const t=this._popover;t&&(t.open=!1),this._setFocusOnButton()}_setFocusOnButton(){this.removeHandles(Uw.ButtonFocusTimeout),this.addHandles(Pqt(()=>{var t;return(t=this._buttonElement)==null?void 0:t.setFocus()}),Uw.ButtonFocusTimeout)}_onPopoverAfterCreate(t){this._popoverElement=t}_onPopoverFocusOut(t){const e=this._popoverElement;if(e==null)return;const i=t.relatedTarget;i&&i instanceof Node&&(e.contains(i)||i===this._buttonElement||this._isAssociatedLabel(i))||this._closePopover()}_isAssociatedLabel(t){var r;const e=this.id,i=(r=t.tagName)==null?void 0:r.toLowerCase();return i==="calcite-label"&&t.for===e||i==="label"&&t.htmlFor===e}_onPopoverKeyDown(t){t.key!=="Escape"&&t.key!=="Enter"||(t.stopPropagation(),this._closePopover())}};function Pqt(t,e){const i=setTimeout(t,e);return rr(()=>clearTimeout(i))}y([w()],Vd.prototype,"class",void 0),y([w()],Vd.prototype,"value",void 0),y([w()],Vd.prototype,"alphaEnabled",void 0),y([w()],Vd.prototype,"onChange",void 0),y([w()],Vd.prototype,"_containerElement",void 0),y([w()],Vd.prototype,"_popover",void 0),y([w()],Vd.prototype,"_popoverElement",void 0),y([w()],Vd.prototype,"_buttonElement",void 0),y([w(),Gr("esri/widgets/support/t9n/ColorPicker")],Vd.prototype,"_messages",void 0),y([w()],Vd.prototype,"_colorPickerCreated",void 0),Vd=y([Z("esri.widgets.support.ColorPicker")],Vd);function Yue(t){return X(YG,{for:t.id,label:t.label,tabIndex:-1},X(Vd,{id:t.id,value:t.value,onChange:t.onChange}))}let yM=class extends cn{constructor(e){super(e),this.colorPickerVisible=!0,this._selectId=`select-${Vf()}`,this._colorPickerId=`color-picker-${Vf()}`,this._onColorChange=i=>{this.options.color=i}}loadDependencies(){return Pl({label:()=>we(()=>import("./calcite-label-lSeWOYbm.js"),__vite__mapDeps([284,238])),option:()=>we(()=>import("./calcite-option-LMeeGK3H.js"),__vite__mapDeps([285,242])),select:()=>we(()=>import("./calcite-select-0Yw6DsYN.js"),__vite__mapDeps([286,236,237,238,239,242,243,245]))})}render(){const e=this._messages.discrete,i=e.intervalLabel,{color:r,interval:n,intervalOptions:s}=this.options;return X("div",{class:Sqt.base},X(YG,{for:this._selectId,label:i},X("calcite-select",{bind:this,id:this._selectId,label:i,onCalciteSelectChange:this._onIntervalChange},s.toArray().map(o=>X("calcite-option",{key:o,selected:o===n,value:String(o)},aje(o))))),this.colorPickerVisible?X(Yue,{id:this._colorPickerId,label:e.colorLabel,value:r,onChange:this._onColorChange}):null)}_onIntervalChange(e){var r;const i=parseInt((r=e.target.selectedOption)==null?void 0:r.value,10);Number.isFinite(i)&&(this.options.interval=i)}};y([w()],yM.prototype,"options",void 0),y([w()],yM.prototype,"colorPickerVisible",void 0),y([w(),Gr("esri/widgets/ShadowCast/t9n/ShadowCast")],yM.prototype,"_messages",void 0),yM=y([Z("esri.widgets.ShadowCast.components.DiscreteConfigurator")],yM);let vM=class extends cn{constructor(e){super(e),this.colorPickerVisible=!0,this._modeSelectorId=`mode-selector-${Vf()}`,this._colorPickerId=`color-picker-${Vf()}`,this._onColorChange=i=>{this.options.color=i},this._setContinuous=()=>{this.options.mode=f2.Continuous},this._setHourly=()=>{this.options.mode=f2.Hourly}}loadDependencies(){return Pl({button:()=>we(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([234,235,236,237,238,239,240,241,242,243,244,245,246,247])),label:()=>we(()=>import("./calcite-label-lSeWOYbm.js"),__vite__mapDeps([284,238]))})}render(){const e=this._messages.duration,{color:i,mode:r}=this.options;return X("div",{class:p3e.base},X(YG,{for:this._modeSelectorId,label:e.modeLabel},X("div",{class:p3e.radioGroup},X(_3e,{active:r===f2.Continuous,label:e.continuousLabel,onclick:this._setContinuous}),X(_3e,{active:r===f2.Hourly,label:e.hourlyLabel,onclick:this._setHourly}))),this.colorPickerVisible?X(Yue,{id:this._colorPickerId,label:e.colorLabel,value:i,onChange:this._onColorChange}):null)}};function _3e({active:t,label:e,...i}){return X("calcite-button",{alignment:"center",appearance:t?"solid":"outline",scale:"s",width:"half",...i},e)}y([w()],vM.prototype,"options",void 0),y([w()],vM.prototype,"colorPickerVisible",void 0),y([w(),Gr("esri/widgets/ShadowCast/t9n/ShadowCast")],vM.prototype,"_messages",void 0),vM=y([Z("esri.widgets.ShadowCast.components.DurationConfigurator")],vM);const Rqt=Gs(1,"minutes","milliseconds"),b3e=Gs(15,"minutes","milliseconds");let _S=class extends cn{constructor(e,i){super(e,i),this.accumulatedShadowTime=null,this._messages=null}render(){const e=this._formattedContent;return X("div",{class:m3e.base},e?X("div",{class:m3e.content},e):null)}get _formattedContent(){const e=this._messages,i=this.accumulatedShadowTime;if(e==null||i==null)return null;const r=yet(i,i{const e=this._contentContainer,{screenPoint:i,accumulatedShadowTime:r}=this.viewModel.tooltip;return{contentContainer:e,screenPoint:i,accumulatedShadowTime:r}},e=>this._update(e),kt)}destroy(){this._updateHandle=en(this._updateHandle),this._contentWidget=et(this._contentWidget),this.container.contains(this._contentContainer)&&this.container.removeChild(this._contentContainer)}get testData(){var e;return{displayedValue:this._contentContainer.style.display==="none"?null:(e=this._contentWidget.container)==null?void 0:e.innerText}}_update({contentContainer:e,screenPoint:i,accumulatedShadowTime:r}){const{style:n}=e;i!=null?(n.display="block",n.transform=`translate(${i.x}px, ${i.y}px)`,this._contentWidget.accumulatedShadowTime=r):n.display="none"}_createContainer(){const e=document.createElement("div"),{style:i}=e;return i.position="absolute",i.top="0",i.left="0",e}};y([w()],bS.prototype,"viewModel",void 0),y([w()],bS.prototype,"container",void 0),y([w()],bS.prototype,"_contentContainer",void 0),y([w()],bS.prototype,"_contentWidget",void 0),bS=y([Z("esri.widgets.ShadowCast.components.ShadowTooltip")],bS);let Aw=class extends cn{constructor(t){super(t),this.colorPickerVisible=!0,this._valueSliderId=`value-slider-${Vf()}`,this._colorPickerId=`color-picker-${Vf()}`,this._valueSlider=new NG({visibleElements:{labels:!1,rangeLabels:!1},steps:Gs(30,"minutes","milliseconds"),labelFormatFunction:(e,i)=>{const r=Gs(e,"milliseconds","hours");return i==="tick"?nd(r,{maximumFractionDigits:0}):""}}),this._onColorChange=e=>{this.options.color=e}}initialize(){const t=({value:e})=>{this.options.value=e};this.addHandles([_e(()=>{const{value:e,minValue:i,maxValue:r}=this.options;return{value:e,minValue:i,maxValue:r}},({value:e,minValue:i,maxValue:r})=>{const n=this._valueSlider;n.min=i,n.max=r,n.values=[e];const s=r-i,o=Math.floor(Gs(s,"milliseconds","hours"));n.tickConfigs=[{mode:"count",values:2*o+1,labelsVisible:!1},{mode:"count",values:o+1,labelsVisible:!0}]},kt),this._valueSlider.on("thumb-change",t),this._valueSlider.on("thumb-drag",t)])}loadDependencies(){return Pl({label:()=>we(()=>import("./calcite-label-lSeWOYbm.js"),__vite__mapDeps([284,238]))})}destroy(){this._valueSlider=et(this._valueSlider)}render(){const t=this._messages.threshold,{color:e}=this.options;return X("div",{class:h3e.base},X(YG,{class:h3e.valueLabel,for:this._valueSliderId,label:t.valueLabel},this._valueSlider.render()),this.colorPickerVisible?X(Yue,{id:this._colorPickerId,label:t.colorLabel,value:e,onChange:this._onColorChange}):null)}get testData(){return{valueSlider:this._valueSlider}}};y([w()],Aw.prototype,"options",void 0),y([w()],Aw.prototype,"colorPickerVisible",void 0),y([w()],Aw.prototype,"testData",null),y([w()],Aw.prototype,"_valueSlider",void 0),y([w(),Gr("esri/widgets/ShadowCast/t9n/ShadowCast")],Aw.prototype,"_messages",void 0),Aw=y([Z("esri.widgets.ShadowCast.components.ThresholdConfigurator")],Aw);var UV;(function(t){t.Slider="slider"})(UV||(UV={}));const Iqt={hour:"2-digit",minute:"2-digit",timeZone:"UTC"},$qt=/(.*)\s(.*)/,Lqt={labelFormatFunction:Lre,min:0,max:1439,steps:15,rangeLabelInputsEnabled:!1,visibleElements:{labels:!1,rangeLabels:!1},tickConfigs:[{mode:"position",values:[0,360,720,1080,1439],labelsVisible:!0,tickCreatedFunction:(t,e,i)=>{e.classList.add(tt.primaryTick),i.classList.add(tt.primaryTickLabel);const r=i.innerText.match($qt);r&&(i.innerHTML=`${r[1]}
${r[2]}
`)}},{mode:"position",values:[120,240,480,600,840,960,1200,1320],tickCreatedFunction:(t,e)=>{e.classList.add(tt.secondaryTick)}}]};let Eh=class extends cn{constructor(t,e){super(t,e),this.viewModel=null,this.headingLevel=4,this.iconClass=Fb.widgetIcon,this.icon=null,this.visibleElements=new oje,this._defaultViewModel=null,this._timeSlider=new NG({...Lqt,container:document.createElement("div")}),this._tooltip=null,this._onTimezoneChange=i=>{this.viewModel.utcOffset=i},this._onDateChange=i=>{this.viewModel.date=i},t!=null&&t.viewModel||(this._defaultViewModel=new Mqt({view:t==null?void 0:t.view}),this.viewModel=this._defaultViewModel)}initialize(){this.addHandles([_e(()=>({viewModel:this.viewModel,slider:this._timeSlider}),t=>this._connectTimeSlider(t),kt),_e(()=>{var t;return{container:(t=this.view)==null?void 0:t.surface,viewModel:this.viewModel,tooltipVisible:this.visibleElements.tooltip}},({container:t,viewModel:e,tooltipVisible:i})=>{this._tooltip=et(this._tooltip),t!=null&&i&&(this._tooltip=new bS({viewModel:e,container:t}))},kt),_e(()=>({viewModel:this.viewModel,visible:this.visible}),({viewModel:t,visible:e})=>t.setRunning(e),kt)])}destroy(){this._timeSlider=et(this._timeSlider),this._defaultViewModel!=null&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}loadDependencies(){return Pl({select:()=>we(()=>import("./calcite-select-0Yw6DsYN.js"),__vite__mapDeps([286,236,237,238,239,242,243,245])),option:()=>we(()=>import("./calcite-option-LMeeGK3H.js"),__vite__mapDeps([285,242]))})}render(){const{visibleElements:t,viewModel:e}=this,i=e.state===DO.Disabled;return X("div",{class:this.classes(Fb.base,tt.widget,tt.panel,{[tt.widgetDisabled]:i}),key:this},this._renderTimeRangeSection(),t.visualizationOptions?this._renderVisualizationOptionsSection():null)}get view(){var t;return(t=this.viewModel)==null?void 0:t.view}set view(t){this.viewModel&&(this.viewModel.view=t)}get label(){var t;return((t=this.messages)==null?void 0:t.widgetLabel)??""}set label(t){this._overrideIfSome("label",t)}get testData(){return{tooltip:this._tooltip}}_connectTimeSlider({viewModel:t,slider:e}){if(this.removeHandles(UV.Slider),e==null)return;const i=s=>Gs(s,"milliseconds","minutes"),r=s=>Gs(s,"minutes","milliseconds"),n=({index:s,value:o})=>{s===0?t.startTimeOfDay=r(o):t.endTimeOfDay=r(o)};this.addHandles([_e(()=>[t.startTimeOfDay,t.endTimeOfDay],s=>{e.values=s.map(i)},kt),e.on("thumb-change",n),e.on("thumb-drag",n),e.on("segment-drag",()=>{[t.startTimeOfDay,t.endTimeOfDay]=e.values.map(r)})],UV.Slider)}_renderTimeRangeSection(){const{visibleElements:t}=this;return t.timeRangeSlider||t.datePicker?X("section",{class:Fb.timeRange,key:"time-range"},X(Im,{level:this.headingLevel},this.messages.timeLabel),t.timeRangeSlider?this._renderTimeRange():null,t.datePicker?this._renderDatePicker():null):null}_renderTimeRange(){const{messages:t,viewModel:e,visibleElements:i}=this,{startTimeOfDay:r,endTimeOfDay:n}=e,[s,o]=[r,n].map(l=>js(new Date(l),Iqt));return[X("div",{class:Fb.timeRangeIndicator,key:"time-range-indicator"},By(t.timeRange,{start:s,end:o}),i.timezone?X(qd,{value:e.utcOffset,onChange:this._onTimezoneChange}):null),X("div",{afterCreate:this._timeSliderContainerAfterCreate,afterRemoved:this._timeSliderContainerAfterRemoved,bind:this,key:"time-slider-container"})]}_timeSliderContainerAfterCreate(t){var i;const e=(i=this._timeSlider)==null?void 0:i.container;e&&t.appendChild(e)}_timeSliderContainerAfterRemoved(t){var i;const e=(i=this._timeSlider)==null?void 0:i.container;e&&t.removeChild(e)}_renderDatePicker(){return X("div",{class:Fb.datePickerContainer,key:"date-picker"},X(zBe,{value:this.viewModel.date,onChange:this._onDateChange}))}_renderVisualizationOptionsSection(){const{headingLevel:t,messages:e,viewModel:i,visibleElements:r}=this,n=r.colorPicker,s=o=>this.classes(i.visualizationType===o?null:Fb.visualizationConfigHidden);return X("section",{class:Fb.visualization,key:"visualization"},X(Im,{level:t},e.visualizationLabel),this._renderVisualizationSelect(),X("div",{class:s(qa.Threshold),key:"threshold-configurator"},X(Aw,{colorPickerVisible:n,options:i.thresholdOptions})),X("div",{class:s(qa.Duration),key:"duration-configurator"},X(vM,{colorPickerVisible:n,options:i.durationOptions})),X("div",{class:s(qa.Discrete),key:"discrete-configurator"},X(yM,{colorPickerVisible:n,options:i.discreteOptions})))}_renderVisualizationSelect(){const t=this.messages,e=this.viewModel.visualizationType;return X("calcite-select",{bind:this,class:Fb.visualizationSelect,key:"visualization-select",label:t.visualizationLabel,onCalciteSelectChange:this._onVisualizationTypeChange},[{type:qa.Threshold,label:t.threshold.label},{type:qa.Duration,label:t.duration.label},{type:qa.Discrete,label:t.discrete.label}].map(({type:i,label:r})=>X("calcite-option",{selected:i===e,value:i},r)))}_onVisualizationTypeChange(t){var i;const e=(i=t.target.selectedOption)==null?void 0:i.value;this.viewModel.visualizationType=e??qa.Threshold}};y([w()],Eh.prototype,"viewModel",void 0),y([w()],Eh.prototype,"view",null),y([w()],Eh.prototype,"headingLevel",void 0),y([w()],Eh.prototype,"iconClass",void 0),y([w()],Eh.prototype,"icon",void 0),y([w()],Eh.prototype,"label",null),y([w({type:oje,nonNullable:!0})],Eh.prototype,"visibleElements",void 0),y([w(),Gr("esri/widgets/ShadowCast/t9n/ShadowCast")],Eh.prototype,"messages",void 0),y([w()],Eh.prototype,"_defaultViewModel",void 0),y([w()],Eh.prototype,"_timeSlider",void 0),y([w()],Eh.prototype,"_tooltip",void 0),Eh=y([Z("esri.widgets.ShadowCast")],Eh);const Dqt=Eh,Nqt=t=>new Dqt({view:t,visible:!1,container:"shadowcast-container"});let bv=class extends Xs(Ue){constructor(e){super(e),this.type="plane",this.position=null,this.heading=0,this.tilt=0,this.width=10,this.height=10}equals(e){return this.heading===e.heading&&this.tilt===e.tilt&&FO(this.position,e.position)&&this.width===e.width&&this.height===e.height}};y([w({readOnly:!0,json:{read:!1,write:!0}})],bv.prototype,"type",void 0),y([w({type:mt}),Dv()],bv.prototype,"position",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:360}}),Dv(),Ci(t=>d5.normalize(Vh(t),0,!0))],bv.prototype,"heading",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:360}}),Dv(),Ci(t=>d5.normalize(Vh(t),0,!0))],bv.prototype,"tilt",void 0),y([w({type:Number,nonNullable:!0}),Dv()],bv.prototype,"width",void 0),y([w({type:Number,nonNullable:!0}),Dv()],bv.prototype,"height",void 0),bv=y([Z("esri.analysis.SlicePlane")],bv);const Fqt=bv;let wv=class extends uVe{constructor(e){super(e),this.type="slice",this.tiltEnabled=!1,this.shape=null,this.excludeGroundSurface=!1}get excludedLayers(){return this._get("excludedLayers")||new it}set excludedLayers(e){this._set("excludedLayers",sd(e,this._get("excludedLayers")))}get requiredPropertiesForEditing(){var e;return[(e=this.shape)==null?void 0:e.position]}clear(){this.shape=null}};y([w({type:["slice"]})],wv.prototype,"type",void 0),y([w()],wv.prototype,"tiltEnabled",void 0),y([w({types:{key:"type",base:null,typeMap:{plane:Fqt},defaultKeyValue:"plane"}})],wv.prototype,"shape",void 0),y([w({cast:nP,clonable:t=>t.slice()})],wv.prototype,"excludedLayers",null),y([w({type:Boolean,nonNullable:!0})],wv.prototype,"excludeGroundSurface",void 0),y([w({readOnly:!0})],wv.prototype,"requiredPropertiesForEditing",null),wv=y([Z("esri.analysis.SliceAnalysis")],wv);const lje=wv,UX=new Set;let Wg=class extends hc{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="SliceViewModel is only supported in 3D views.",UX.add(this)}destroy(){UX.delete(this)}get state(){return this.disabled||!this.ready?"disabled":this.tool==null?"ready":this.tool.state}get shape(){return this.analysis.shape}set shape(e){this.analysis.shape=e}get tiltEnabled(){return this.analysis.tiltEnabled}set tiltEnabled(e){this.analysis.tiltEnabled=e}get layersMode(){var e;return((e=this.tool)==null?void 0:e.layersMode)??"none"}get excludedLayers(){return this.analysis.excludedLayers}set excludedLayers(e){this.analysis.excludedLayers=it.isCollection(e)?e:new it(e)}get excludeGroundSurface(){return this.analysis.excludeGroundSurface}set excludeGroundSurface(e){this.analysis.excludeGroundSurface=e}async start(){await super.start(),UX.forEach(e=>{e.view===this.view&&e!==this&&e.clear()}),this.analysisView!=null&&(this.analysisView.active=!0)}enterExcludeLayerMode(){this.tool!=null&&this.tool.enterExcludeLayerMode()}exitExcludeLayerMode(){this.tool!=null&&this.tool.exitExcludeLayerMode()}onConnectToAnalysisView(e){e.active=!0}constructAnalysis(){return new lje}};y([w({type:lje})],Wg.prototype,"analysis",void 0),y([w({readOnly:!0})],Wg.prototype,"state",null),y([w()],Wg.prototype,"shape",null),y([w()],Wg.prototype,"tiltEnabled",null),y([w()],Wg.prototype,"layersMode",null),y([w()],Wg.prototype,"excludedLayers",null),y([w({nonNullable:!0})],Wg.prototype,"excludeGroundSurface",null),Wg=y([Z("esri.widgets.Slice.SliceViewModel")],Wg);const cje=Wg,Up="esri-slice",vh={base:Up,widgetIcon:si.slice,actions:`${Up}__actions`,cancelButton:`${Up}__cancel-button`,container:`${Up}__container`,error:`${Up}__error`,excludeButton:`${Up}__exclude-button`,hint:`${Up}__hint`,hintText:`${Up}__hint-text`,layerItem:`${Up}__layer-item`,layerList:`${Up}__layer-list`,layerListHeading:`${Up}__layer-list-title`,newSliceButton:`${Up}__clear-button`};let Zc=class extends cn{constructor(e,i){super(e,i),this.headingLevel=3,this.iconClass=vh.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new cje,this._onNewSliceClick=()=>{$m(this.viewModel.start())}}loadDependencies(){return Pl({action:()=>we(()=>import("./calcite-action-mEzyoc-Z.js"),__vite__mapDeps([290,291,247,237,239,240,241,242,243,244,245,246])),button:()=>we(()=>import("./calcite-button-tOn16zeN.js"),__vite__mapDeps([234,235,236,237,238,239,240,241,242,243,244,245,246,247])),"list-item":()=>we(()=>import("./calcite-list-item-OtIyVNHT.js"),__vite__mapDeps([309,237,310,240,241,242,244,239,291,247,243,245,246])),list:()=>we(()=>import("./calcite-list-LJfGqLbO.js"),__vite__mapDeps([311,237,242,310,239,253,240,241,244,245,312,236,238,243,306,246,247,257]))})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get excludedLayers(){return this.viewModel.excludedLayers}set excludedLayers(e){this.viewModel.excludedLayers=e}get excludeGroundSurface(){return this.viewModel.excludeGroundSurface}set excludeGroundSurface(e){this.viewModel.excludeGroundSurface=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get hasVoxelLayers(){var i;const e=(i=this.viewModel)==null?void 0:i.view;return e!=null&&e.allLayerViews.some(r=>r.type==="voxel-3d")}render(){return X("div",{class:this.classes(vh.base,tt.widget,tt.panel),role:"presentation"},this.visible?X("div",{class:vh.container},this.viewModel.supported?[this._renderHint(),this._renderLayerList(),this._renderActions()]:this._renderUnsupported()):null)}_renderUnsupported(){return X("div",{class:vh.error,key:"unsupported"},X("p",null,this.messages.unsupported))}_renderHint(){const{hasVoxelLayers:e,messages:i,viewModel:r}=this,{active:n,layersMode:s,state:o}=r;let l=null;return n&&(s==="exclude"?l=i.excludeHint:o==="ready"&&(l=e?i.voxelHint:i.hint)),l?X("div",{class:vh.hint,key:"hint"},X("p",{class:vh.hintText},l),X("p",{class:vh.hintText},i.verticalHint)):null}_renderLayerList(){const{excludedLayers:e,excludeGroundSurface:i,headingLevel:r,messages:n,viewModel:s}=this,{layersMode:o,state:l}=s,c=l==="slicing"||l==="sliced",f=e?e.toArray().map(_=>this._renderLayerItem({uid:_.uid,title:_.title,onClick:()=>(this.excludedLayers.remove(_),!1)})):[];return i&&f.push(this._renderLayerItem({uid:"ground",title:n.ground,onClick:()=>(this.excludeGroundSurface=!1,!1)})),o!=="exclude"&&c&&f.length!==0?X("div",{class:vh.layerList,key:"settings"},X(Im,{class:vh.layerListHeading,level:r},n.excludedLayers),X("calcite-list",{selectionMode:"none"},f)):null}_renderActions(){const{messages:e,viewModel:i}=this,{active:r,state:n}=i,s=n==="disabled",o=n==="slicing"||n==="sliced",l=i.layersMode==="exclude",c=[];return r&&!o||l||c.push(X("calcite-button",{class:vh.newSliceButton,disabled:s,key:"new-slice",onclick:this._onNewSliceClick},e.newSlice)),o&&!l&&c.push(X("calcite-button",{appearance:"outline-fill",class:vh.excludeButton,disabled:s,key:"exclude",onclick:()=>i.enterExcludeLayerMode()},e.excludeLayer)),r&&l&&c.push(X("calcite-button",{appearance:"outline-fill",class:vh.cancelButton,disabled:s,key:"cancel-exclude",onclick:()=>i.exitExcludeLayerMode()},e.cancel)),c.length===0?null:X("div",{class:vh.actions},c)}_renderLayerItem(e){return X("calcite-list-item",{class:vh.layerItem,key:e.uid,label:e.title??""},X("calcite-action",{icon:"x",onclick:e.onClick,scale:"s",slot:"actions-end",text:this.messages.includeLayer}))}};y([w()],Zc.prototype,"active",null),y([w({constructOnly:!0,nonNullable:!0})],Zc.prototype,"analysis",null),y([w()],Zc.prototype,"excludedLayers",null),y([w()],Zc.prototype,"excludeGroundSurface",null),y([w()],Zc.prototype,"headingLevel",void 0),y([w()],Zc.prototype,"iconClass",void 0),y([w()],Zc.prototype,"icon",void 0),y([w()],Zc.prototype,"label",null),y([w(),Gr("esri/widgets/Slice/t9n/Slice")],Zc.prototype,"messages",void 0),y([w()],Zc.prototype,"view",null),y([w({type:cje})],Zc.prototype,"viewModel",void 0),y([w()],Zc.prototype,"visible",null),y([w()],Zc.prototype,"hasVoxelLayers",null),Zc=y([Z("esri.widgets.Slice")],Zc);const kqt=Zc,zqt=t=>new kqt({view:t,container:"slicing-container"}),n1i=it.ofType({key:"type",defaultKeyValue:"button",base:lP,typeMap:{button:cP,toggle:LB}}),s1i=new cP({icon:"magnifying-glass-plus",id:"zoom-to-feature",title:"{messages.zoom}",className:si.zoomInMagnifyingGlass}),Uqt=new cP({icon:"trash",id:"remove-selected-feature",title:"{messages.remove}",className:si.trash}),o1i=new cP({icon:"magnifying-glass-plus",id:"zoom-to-clustered-features",title:"{messages.zoom}",className:si.zoomInMagnifyingGlass}),a1i=new LB({icon:"table",id:"browse-clustered-features",title:"{messages.browseClusteredFeatures}",className:si.table,value:!1}),Vqt=2500,uje={type:"CIMPictureMarker",primitiveName:"headingOverride",enable:!0,anchorPoint:{x:0,y:-.5},anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:36,billboardMode3D:"FaceNearPlane",invertBackfaceTexture:!0,scaleX:1,textureFilter:"Picture",url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAkCAYAAACe0YppAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAYaSURBVHgBvVfNb1VFFD/nzP16xRYJKYREEiJoDLLShQkrSNzoHv8I2QgxwY8FJWHhxoVxISEu2AordWNiQjAxEBeEsKAmhCCwkPDRAn1t33v33jnH37n3Fam0pa8kTjOde+/MnN/5+J0z85jW08yYTpxgfzx0bS+fO0R0YHqyeb9w7YEtLTv+9rSdOH7ciNleJJJX/Do1JQ3AltdlT35fiN6gG8kD8akdmzO+6w/zM7wdw725rUY78DBXtmATA6PZntFgm9Kjm6o/HFJpdi5Xhp+16sDBC+H+gUmZfjIXHKC+35U42ZHZfpe30BZS7okNFnhu8wTRk2ek5LEV2q+N8nEj6yuNVRjHddftrt4ahyJbOxF+Uppi/Rf47NlA05Pp9vkyRNkkD8sqUJHwOGfSpYFQFXhTJryQBaZSeAxbFus+U1K0gJm2oy3QKwuZzqeuSK5kpW6BEsE6+nCsAHDXQWuaOljzU8uP/ToxUW4KcwKg8QzOSdFL6Swm0hurAC7N2qIW7ncwNgYKF4la3/w7RnzrUK29KseXWqmTKXGl45Zrd9CLrsSjr96fcw4kS46mTsJznSTrVBR6VQJQdDbpZTWexxgCYCFz30cquD8oYVQgtUAUzfo8wGtqGoNRFmFZ1KKulJMQu3Vpm/I8Pup3ekvES57GaabXo4lsszEA6zrkhcmAAkBNshi59O9wVsokBLZUCQAxllXVBkyCDRQuTlLLiLSEqw3gfUqU0kVdsKymsnzyPLm8fXZxDxVZgvUhg9QyaKDI7AhpSlRVEaA83JM+/V8pGO0PMTHyZwra9FQVk4i1e0D6dPK9v5agkmXAhc0Bw5MjlAQQE0lSDbUmbBX4kGfsiiQWuSZtdle1S4F73cUKJgviyw4mmmqlVSoR/FAK2d1noWQZ8N79MySw0tgNzhN00jRFaPM6y3IyLWBxXuOdvMfhaIy1MQctmvnEMGrMq2Y/ekC3dHF14I84gmZP2s0pgiJFHVwYhIIrMC1zgT4fQgsS0CG48LWtslAsgeKZK5U1c5Slj+nEvvJZqOWubr5ks8iE3bVqCMQCz4p5aiUqpMrOdHz2qLFTxAMSPLwY8WpmntNwrXIMCWvESGH+7n9hVi6ZJ6/sR5gnycFFQgsCQEEB8T9TbsCGy4PrZrEBjGyIt4EApoGRXWKP6Mt3fnvOvhWBjR4gdjtJEDmGQQkBSCS6Teys5qECABTPWOBwcPWgAPIU+E2+Rq3J8lsrQawMHNPbqAXvRqasWcMB/mK42N3twM6/FsbJTZK2Fru15K7niPVIp6RHn++9vRKErAg8ta+MFq4LBxAJKY1EajpxLj5KUzFzOMTni4btxoUzXPzIIOwLnEPxGVqlyWoTdO/WNRUXJhDmAgNAJVd0eABj8FTCvLbpEnxdOycJlFNXVq6MDvzthwOQ654LaMGGVofQWIWtXhM9xaCQp85QIZFMPXcpuUPH3uquJj6htVonvySD+KY6c2AulPAzHdVaZElvPCGBgvkIRUECr1J4qmV6LdGyJvAnu+94HZMla1Eg1AuGVyQWnNCwzqsUXK5+AIsUyPRc1Rbpi93X1xK9tsXtkj9U7INWSWvU0DaZ6OlVAmUDiqgbrwY2Z3ThRVKFXrgi/R0x9GMplxAyER6ynAtZin1DQoLVznLMU+/mywMf3dlDpbyMlbjLQDhLw/Sh24sm5dhTrlHKgS/T0X2zLw/sLeGr5OlEbg2uHwAFw5reKuKsJj8kcIj0zq9H5PqAj+z6E8y+YRIaUhnAEOrcWgv9m3shQ1H7mz5duVJtDLhZqZcNlrEDwXKwCzncdFg+PJeVf1m3uPUupLR7Hq6tHNyLhw1TCmdGbm0BmaUjr63LzaMBH943D9f+yO5uZ7HfcLktqdwqMU0jtPUDN6vDOfzgKFrXtta6q83vfHU4M5KoURbT4W3zsPIqrgQFO8GozV8ocZGOTN4dRdRowN6CnOLmKkk5t7H1i+HPNGJj2kj7buYajoRXh2+36eOt+2nENrrF3ozODEmFC0D4hjbQNgYc+DSYjd9qqGSJXqL/tZ16/DWdfvw9bbCt41hcpYn9RAEX9Q22fwC74ny5v9iplQAAAABJRU5ErkJggg=="},Bqt=new nx({data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:14,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:17,ymax:17},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[8.5,0],[7.02,.13],[5.59,.51],[4.25,1.14],[3.04,1.99],[1.99,3.04],[1.14,4.25],[.51,5.59],[.13,7.02],[0,8.5],[.13,9.98],[.51,11.41],[1.14,12.75],[1.99,13.96],[3.04,15.01],[4.25,15.86],[5.59,16.49],[7.02,16.87],[8.5,17],[9.98,16.87],[11.41,16.49],[12.75,15.86],[13.96,15.01],[15.01,13.96],[15.86,12.75],[16.49,11.41],[16.87,9.98],[17,8.5],[16.87,7.02],[16.49,5.59],[15.86,4.25],[15.01,3.04],[13.96,1.99],[12.75,1.14],[11.41,.51],[9.98,.13],[8.5,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Round",joinStyle:"Round",lineStyle3D:"Strip",miterLimit:10,width:2,color:[255,255,255,255]},{type:"CIMSolidFill",enable:!0,color:[0,122,194,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:16,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:17,ymax:17},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[8.5,0],[7.02,.13],[5.59,.51],[4.25,1.14],[3.04,1.99],[1.99,3.04],[1.14,4.25],[.51,5.59],[.13,7.02],[0,8.5],[.13,9.98],[.51,11.41],[1.14,12.75],[1.99,13.96],[3.04,15.01],[4.25,15.86],[5.59,16.49],[7.02,16.87],[8.5,17],[9.98,16.87],[11.41,16.49],[12.75,15.86],[13.96,15.01],[15.01,13.96],[15.86,12.75],[16.49,11.41],[16.87,9.98],[17,8.5],[16.87,7.02],[16.49,5.59],[15.86,4.25],[15.01,3.04],[13.96,1.99],[12.75,1.14],[11.41,.51],[9.98,.13],[8.5,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Round",joinStyle:"Round",lineStyle3D:"Strip",miterLimit:10,width:0,color:[255,255,255,255]},{type:"CIMSolidFill",enable:!0,color:[0,0,0,66]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,offsetX:0,offsetY:-1},uje],angleAlignment:"Map"},primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"headingOverride",propertyName:"Rotation",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Rotation override",expression:"360 - $feature.heading",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:"headingOverride",propertyName:"TintColor",valueExpressionInfo:{type:"CIMExpressionInfo",title:"TintColor override",expression:"IIF(IsEmpty($feature.heading), [255, 255, 255, 0], [255, 255, 255, 1])",returnType:"Default"}}]}});let Yg=class extends LG(Dn.EventedMixin(ze)){constructor(){super(...arguments),this._geolocationUsable=!0,this.geolocationOptions=null,this.goToLocationEnabled=!0,this.graphic=new Ml({symbol:Bqt}),this.scale=null,this.rotationEnabled=!0,this.view=null}initialize(){Are()||(this._geolocationUsable=!1),this.addHandles([_e(()=>{var e;return(e=this.view)==null?void 0:e.type},()=>this._handleViewTypeChange(),ii)])}destroy(){this._clearGraphic(),this.view=null}_clearGraphic(){const{view:e,graphic:i}=this;e&&i&&e.graphics.remove(i)}_addGraphic(){const{view:e,graphic:i}=this;e!=null&&e.graphics&&i&&!e.graphics.includes(i)&&e.graphics.push(i)}_handleViewTypeChange(){var e;uje.enable=((e=this.view)==null?void 0:e.type)==="2d"}_getScaleWithinConstraints(e,i){if(!i)return e;if(i.type==="2d"){const{effectiveMaxScale:r,effectiveMinScale:n}=i.constraints;return Math.min(n,Math.max(r,e))}return e}_getScale(e){const{scale:i}=this,r=typeof i=="number"?i:Vqt;return this._getScaleWithinConstraints(r,e)}_getHeading(e,i){var o;const r=i==null?void 0:i.spatialReference,n=(r==null?void 0:r.isWebMercator)||(r==null?void 0:r.isGeographic),s=(o=e.coords)==null?void 0:o.heading;return!n||typeof s!="number"||isNaN(s)||s<0||s>360?null:s}_addHeading(e){const{heading:i,target:r,view:n}=e;n&&i!==null&&(n.type!=="3d"?n.type==="2d"&&(r.rotation=360-i):r.heading=i)}async _animatePoint(e,i,r,n){const{view:s}=this;if(!this.goToLocationEnabled||!s)return;const o={target:e,scale:i};this.rotationEnabled&&this._addHeading({heading:r,target:o,view:s});const l={signal:n.signal};St(l),await this.callGoTo({target:o,options:l})}async updatePosition(e,i){try{const r=this.view,n=await VVe({position:e,view:r},{signal:i.signal}),{graphic:s}=this,{timestamp:o,coords:l}=e,{accuracy:c,altitude:f,altitudeAccuracy:_,latitude:x,longitude:T,speed:A}=l,M=this._getHeading(e,r),I={timestamp:o,accuracy:c,altitude:f,altitudeAccuracy:_,heading:M,latitude:x,longitude:T,speed:A};s&&(s.geometry=n,s.attributes=I);const L=this._getScale(r);await this._animatePoint(n,L,M,i)}catch(r){if(!sn(r))throw new se("geolocation-positioning:invalid-point","Cannot position invalid point",{error:r})}return e}};y([w()],Yg.prototype,"_geolocationUsable",void 0),y([w()],Yg.prototype,"geolocationOptions",void 0),y([w()],Yg.prototype,"goToLocationEnabled",void 0),y([w({type:Ml,nonNullable:!0})],Yg.prototype,"graphic",void 0),y([w()],Yg.prototype,"scale",void 0),y([w()],Yg.prototype,"rotationEnabled",void 0),y([w()],Yg.prototype,"view",void 0),Yg=y([Z("esri.widgets.support.GeolocationPositioning")],Yg);const jqt=Yg;async function Gqt(){const t=await lE("esri/widgets/Locate/t9n/Locate");return new hE({title:t.currentLocation,fieldInfos:[{fieldName:"timestamp",label:t.timestamp,format:{dateFormat:"short-date-short-time"}},{fieldName:"latitude",label:t.latitude,format:{places:4,digitSeparator:!0}},{fieldName:"longitude",label:t.longitude,format:{places:4,digitSeparator:!0}},{fieldName:"accuracy",label:t.accuracy,format:{places:0,digitSeparator:!0}},{fieldName:"altitude",label:t.altitude,format:{places:0,digitSeparator:!0}},{fieldName:"altitudeAccuracy",label:t.altitudeAccuracy,format:{places:0,digitSeparator:!0}},{fieldName:"heading",label:t.heading,format:{places:0,digitSeparator:!0}},{fieldName:"speed",label:t.speed,format:{places:0,digitSeparator:!0}}],actions:[Uqt.clone()],content:[{type:"fields"}]})}let Mw=class extends jqt{constructor(t){super(t),this._locateController=null,this.popupEnabled=!0,this.locate=this.locate.bind(this)}initialize(){this.addHandles([oE(()=>{var r;const{graphic:t,view:e}=this;if(!t)return;((r=e==null?void 0:e.graphics)==null?void 0:r.includes(t))&&this._updatePopupTemplate(t)})])}destroy(){this.cancelLocate()}get state(){var t;return this._geolocationUsable?(t=this.view)!=null&&t.ready?this._locateController?"locating":"ready":"disabled":"feature-unsupported"}async locate(){if(this.cancelLocate(),this.state==="disabled")throw new se("locate:disabled-state","Cannot locate when disabled.");if(this.state==="feature-unsupported")throw new se("locate:feature-unsupported-state","Cannot locate in unsecure domain.");const t=new AbortController;this._locateController=t;try{const e=await UVe(this.geolocationOptions);if(await this.updatePosition(e,t),this._locateController!==t)return null;const{graphic:i}=this;return i&&await this._updatePopupTemplate(i),this._addGraphic(),this.emit("locate",{position:e}),this._locateController=null,e}catch(e){if(sn(e))return null;throw t===this._locateController&&(this._locateController=null),this.emit("locate-error",{error:e}),e}}cancelLocate(){this._clearGraphic(),this._locateController&&this._locateController.abort(),this._locateController=null}async _updatePopupTemplate(t){if(!this.popupEnabled)return;const e=await Gqt(),i=t!==this.graphic;this.destroyed||i||(t.popupTemplate=e)}};y([w()],Mw.prototype,"_locateController",void 0),y([w()],Mw.prototype,"popupEnabled",void 0),y([w({readOnly:!0})],Mw.prototype,"state",null),y([w()],Mw.prototype,"locate",null),y([w()],Mw.prototype,"cancelLocate",null),Mw=y([Z("esri.widgets.Locate.LocateViewModel")],Mw);const hje=Mw,VX={base:"esri-locate",widgetIcon:si.northNavigation},Hqt="gps-off",dje="esri.widgets.Locate",w3e=Ce.getLogger(dje);let vl=class extends cn{constructor(t,e){super(t,e),this.iconClass=VX.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.viewModel=new hje}loadDependencies(){return Pl({icon:()=>we(()=>import("./calcite-icon-itD416se.js"),__vite__mapDeps([248,245,242])),loader:()=>we(()=>import("./calcite-loader-Z65agR8e.js"),__vite__mapDeps([294,246,247]))})}get geolocationOptions(){return this.viewModel.geolocationOptions}set geolocationOptions(t){this.viewModel.geolocationOptions=t}get goToLocationEnabled(){return this.viewModel.goToLocationEnabled}set goToLocationEnabled(t){this.viewModel.goToLocationEnabled=t}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(t){this.viewModel.goToOverride=t}get graphic(){return this.viewModel.graphic}set graphic(t){this.viewModel.graphic=t}get label(){var t;return((t=this.messages)==null?void 0:t.widgetLabel)??""}set label(t){this._overrideIfSome("label",t)}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(t){this.viewModel.popupEnabled=t}get rotationEnabled(){return this.viewModel.rotationEnabled}set rotationEnabled(t){this.viewModel.rotationEnabled=t}get scale(){return this.viewModel.scale}set scale(t){this.viewModel.scale=t}get useHeadingEnabled(){return pm(w3e,"useHeadingEnabled",{replacement:"rotationEnabled",version:"4.27",warnOnce:!0}),this.viewModel.rotationEnabled}set useHeadingEnabled(t){pm(w3e,"useHeadingEnabled",{replacement:"rotationEnabled",version:"4.27",warnOnce:!0}),this.viewModel.rotationEnabled=t}get view(){return this.viewModel.view}set view(t){this.viewModel.view=t}cancelLocate(){this.viewModel.cancelLocate()}locate(){return this.viewModel.locate()}render(){const{state:t}=this.viewModel,e=t==="locating"?this.messagesCommon.cancel:this.messages.title;return X("div",{"aria-label":e,bind:this,class:this.classes(VX.base,tt.widget,tt.widgetButton,{[tt.disabled]:t==="disabled",[tt.hidden]:t==="feature-unsupported"}),hidden:t==="feature-unsupported",onclick:this._locate,onkeydown:this._locate,role:"button",tabIndex:0,title:e},this._renderIcon(),X("span",{class:si.fontFallbackText},this.messages.title))}_renderIcon(){const{icon:t,iconClass:e,viewModel:i}=this;return(i==null?void 0:i.state)==="locating"?X("calcite-loader",{inline:!0,key:"loader",label:"",scale:"s",type:"indeterminate"}):t?this._renderCalciteIcon(t):e&&e!==VX.widgetIcon?this._renderLegacyIcon(e):this._renderCalciteIcon(Hqt)}_renderCalciteIcon(t){return X("calcite-icon",{icon:t,key:"icon",scale:"s"})}_renderLegacyIcon(t){return X("span",{"aria-hidden":"true",class:t,key:"legacy-icon"})}_locate(){const{viewModel:t}=this;t.state==="locating"?t.cancelLocate():t.locate()}};y([w()],vl.prototype,"geolocationOptions",null),y([w()],vl.prototype,"goToLocationEnabled",null),y([w()],vl.prototype,"goToOverride",null),y([w()],vl.prototype,"graphic",null),y([w()],vl.prototype,"iconClass",void 0),y([w()],vl.prototype,"icon",void 0),y([w()],vl.prototype,"label",null),y([w(),Gr("esri/widgets/Locate/t9n/Locate")],vl.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],vl.prototype,"messagesCommon",void 0),y([w()],vl.prototype,"popupEnabled",null),y([w()],vl.prototype,"rotationEnabled",null),y([w()],vl.prototype,"scale",null),y([w()],vl.prototype,"useHeadingEnabled",null),y([w()],vl.prototype,"view",null),y([w({type:hje}),Kce(["locate","locate-error"])],vl.prototype,"viewModel",void 0),y([bo()],vl.prototype,"_locate",null),vl=y([Z(dje)],vl);const qqt=vl,Wqt=t=>new qqt({view:t});class Yqt{constructor(e,i=0,r=e.lods[e.lods.length-1].level){this.tileInfo=e,this.minLOD=i,this.maxLOD=r,e.lodAt(i)||(this.minLOD=e.lods[0].level),e.lodAt(r)||(this.maxLOD=e.lods[e.lods.length-1].level)}get effectiveMinLOD(){return this.minLOD??this.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.tileInfo.lods[this.tileInfo.lods.length-1].level}getAvailability(e,i,r){var s;const n=(s=this.tileInfo)==null?void 0:s.lodAt(e);return!n||ethis.maxLOD?"unavailable":n.cols&&n.rows?r>=n.cols[0]&&r<=n.cols[1]&&i>=n.rows[0]&&i<=n.rows[1]?"unknown":"unavailable":"unknown"}async fetchAvailability(e,i,r,n){await Hk(n);const s=this.getAvailability(e,i,r);if(s==="unavailable")throw new se("tile-map:tile-unavailable","Tile is not available",{level:e,row:i,col:r});return s}async fetchAvailabilityUpsample(e,i,r,n,s){await Hk(s),n.level=e,n.row=i,n.col=r;const o=this.tileInfo;return o.updateTileInfo(n),this.fetchAvailability(e,i,r,s).catch(l=>{if(sn(l))throw l;if(o.upsampleTile(n))return this.fetchAvailabilityUpsample(n.level,n.row,n.col,n,s);throw l})}}function Xqt(t,e=!1){return t<=td?e?new Array(t).fill(0):new Array(t):new Uint32Array(t)}class l9{constructor(e){this._validateJSON(e);const{location:i,data:r}=e;this.location=Object.freeze(Re(i));const n=this.location.width,s=this.location.height;let o=!0,l=!0;const c=Math.ceil(n*s/32),f=Xqt(c);let _=0;for(let x=0;x>5,o=this._availability;return s<0||s>o.length?"unknown":o[s]&1<f.data).catch(f=>{if(f&&f.details&&f.details.httpStatus===422)return{location:{top:n,left:s,width:o,height:l},valid:!0,data:Mje(o*l,0)};throw f}).then(f=>{if(f.location&&(f.location.top!==n||f.location.left!==s||f.location.width!==o||f.location.height!==l))throw new se("tilemap:location-mismatch","Tilemap response for different location than requested",{response:f,definition:{top:n,left:s,width:o,height:l}});return l9.fromJSON(f)})}static fromJSON(e){return Object.freeze(new l9(e))}_validateJSON(e){if(!(e!=null&&e.location))throw new se("tilemap:missing-location","Location missing from tilemap response");if(e.valid===!1)throw new se("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new se("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new se("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new se("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}}function x3e(t){return`${t.level}/${t.row}/${t.col}/${t.width}/${t.height}`}function Zqt(t){var r;let e;if((r=t.service.tileServers)!=null&&r.length){const n=t.service.tileServers;e=`${n&&n.length?n[t.row%n.length]:t.service.url}/tilemap/${t.level}/${t.row}/${t.col}/${t.width}/${t.height}`}else e=`${t.service.url}/tilemap/${t.level}/${t.row}/${t.col}/${t.width}/${t.height}`;const i=t.service.query;return i&&(e=`${e}?${i}`),e}var VS;let Xg=VS=class extends ze{constructor(t){super(t),this._pendingTilemapRequests={},this.request=bi,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new qB(2*N2.MEGABYTES),this.addHandles([_e(()=>{const{layer:t}=this;return[t==null?void 0:t.parsedUrl,t==null?void 0:t.tileServers,t==null?void 0:t.apiKey,t==null?void 0:t.customParameters]},()=>this._initializeTilemapDefinition(),ii)])}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}fetchTilemap(t,e,i,r){if(!this.layer.tileInfo.lodAt(t)||tthis.effectiveMaxLOD)return Promise.reject(new se("tilemap-cache:level-unavailable",`Level ${t} is unavailable in the service`));const n=this._tmpTilemapDefinition,s=this._tilemapFromCache(t,e,i,n);if(s)return Promise.resolve(s);const o=r==null?void 0:r.signal;return r={...r,signal:null},new Promise((l,c)=>{Yl(o,()=>c(ur()));const f=x3e(n);let _=this._pendingTilemapRequests[f];if(!_){_=l9.fromDefinition(n,r).then(T=>(this._tilemapCache.put(f,T,T.byteSize),T));const x=()=>{delete this._pendingTilemapRequests[f]};this._pendingTilemapRequests[f]=_,_.then(x,x)}_.then(l,c)})}getAvailability(t,e,i){if(!this.layer.tileInfo.lodAt(t)||tthis.effectiveMaxLOD)return"unavailable";const r=this._tilemapFromCache(t,e,i,this._tmpTilemapDefinition);return r?r.getAvailability(e,i):"unknown"}fetchAvailability(t,e,i,r){return!this.layer.tileInfo.lodAt(t)||tthis.effectiveMaxLOD?Promise.reject(new se("tile-map:tile-unavailable","Tile is not available",{level:t,row:e,col:i})):this.fetchTilemap(t,e,i,r).catch(n=>n).then(n=>{if(n instanceof l9){const s=n.getAvailability(e,i);if(s==="unavailable")throw new se("tile-map:tile-unavailable","Tile is not available",{level:t,row:e,col:i});return s}if(sn(n))throw n;return"unknown"})}fetchAvailabilityUpsample(t,e,i,r,n){r.level=t,r.row=e,r.col=i;const s=this.layer.tileInfo;s.updateTileInfo(r);const o=this.fetchAvailability(t,e,i,n).catch(l=>{if(sn(l))throw l;if(s.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,n);throw l});return this._fetchAvailabilityUpsamplePrefetch(r.id,t,e,i,n,o),o}async _fetchAvailabilityUpsamplePrefetch(t,e,i,r,n,s){if(!this._prefetchingEnabled||t==null)return;const o=`prefetch-${t}`;if(this.hasHandles(o))return;const l=new AbortController;s.then(()=>l.abort(),()=>l.abort());let c=!1;const f=rr(()=>{c||(c=!0,l.abort())});if(this.addHandles(f,o),await OGe(10,l.signal).catch(()=>{}),c||(c=!0,this.removeHandles(o)),xo(l))return;const _=new Tj(t,e,i,r),x={...n,signal:l.signal},T=this.layer.tileInfo;for(let A=0;VS._prefetches.length{VS._prefetches.removeUnordered(M)};M.then(I,I)}}_initializeTilemapDefinition(){var r;if(!this.layer.parsedUrl)return;const{parsedUrl:t,apiKey:e,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:t.path,query:PT({...t.query,...i,token:e??((r=t.query)==null?void 0:r.token)}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(t,e,i,r){r.level=t,r.row=e-e%this.size,r.col=i-i%this.size;const n=x3e(r);return this._tilemapCache.get(n)}get test(){const t=this;return{get prefetchingEnabled(){return t._prefetchingEnabled},set prefetchingEnabled(e){t._prefetchingEnabled=e},hasTilemap:(e,i,r)=>!!t._tilemapFromCache(e,i,r,t._tmpTilemapDefinition)}}};Xg._maxPrefetch=4,Xg._prefetches=new Pi({initialSize:VS._maxPrefetch}),y([w({constructOnly:!0})],Xg.prototype,"layer",void 0),y([w({constructOnly:!0})],Xg.prototype,"minLOD",void 0),y([w({constructOnly:!0})],Xg.prototype,"maxLOD",void 0),y([w({constructOnly:!0})],Xg.prototype,"request",void 0),y([w({constructOnly:!0})],Xg.prototype,"size",void 0),Xg=VS=y([Z("esri.layers.support.TilemapCache")],Xg);const Jqt=t=>{let e=class extends t{constructor(){super(...arguments),this.copyright=null,this.minScale=0,this.maxScale=0,this.spatialReference=null,this.tileInfo=null,this.tilemapCache=null}destroy(){var i,r;(r=(i=this.tilemapCache)==null?void 0:i.destroy)==null||r.call(i)}readMinScale(i,r){return r.minLOD!=null&&r.maxLOD!=null?i:0}readMaxScale(i,r){return r.minLOD!=null&&r.maxLOD!=null?i:0}get supportsBlankTile(){return this.version>=10.2}readTilemapCache(i,r,n){var _;const s=(_=r.capabilities)==null?void 0:_.includes("Tilemap");let{minLOD:o,maxLOD:l,minScale:c,maxScale:f}=r;if(o==null&&l==null&&c!==0&&f!==0){const x=T=>Math.round(1e4*T)/1e4;c=x(c||r.tileInfo.lods[0].scale),f=x(f||r.tileInfo.lods[r.tileInfo.lods.length-1].scale);for(const T of r.tileInfo.lods){const A=x(T.scale);o=A>=c?T.level:o,l=A>=f?T.level:l}}if(s)return new Xg({layer:this,minLOD:o,maxLOD:l});if(r.tileInfo){const x=new pO;return x.read(r.tileInfo,n),new Yqt(x,o,l)}return null}};return y([w({json:{read:{source:"copyrightText"}}})],e.prototype,"copyright",void 0),y([w()],e.prototype,"minScale",void 0),y([$t("service","minScale")],e.prototype,"readMinScale",null),y([w()],e.prototype,"maxScale",void 0),y([$t("service","maxScale")],e.prototype,"readMaxScale",null),y([w({type:at})],e.prototype,"spatialReference",void 0),y([w({readOnly:!0})],e.prototype,"supportsBlankTile",null),y([w({type:pO})],e.prototype,"tileInfo",void 0),y([w()],e.prototype,"tilemapCache",void 0),y([$t("service","tilemapCache",["capabilities","tileInfo"])],e.prototype,"readTilemapCache",null),y([w()],e.prototype,"version",void 0),e=y([Z("esri.layers.mixins.ArcGISCachedService")],e),e};let bl=class extends Jqt(m5e(XB(JB(fP(uE))))){constructor(...t){super(...t),this.capabilities={operations:{supportsTileMap:!1}},this.copyright=null,this.heightModelInfo=null,this.path=null,this.minScale=void 0,this.maxScale=void 0,this.opacity=1,this.operationalLayerType="ArcGISTiledElevationServiceLayer",this.sourceJSON=null,this.type="elevation",this.url=null,this.version=null,this._lercDecoder=iFe()}normalizeCtorArgs(t,e){return typeof t=="string"?{url:t,...e}:t}destroy(){this._lercDecoder=ir(this._lercDecoder)}readCapabilities(t,e){const i=e.capabilities&&e.capabilities.split(",").map(r=>r.toLowerCase().trim());return i?{operations:{supportsTileMap:i.includes("tilemap")}}:{operations:{supportsTileMap:!1}}}readVersion(t,e){let i=e.currentVersion;return i||(i=9.3),i}load(t){const e=t!=null?t.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"],supportsData:!1,validateItem:i=>{for(let r=0;rthis._fetchImageService(e))),Promise.resolve(this)}fetchTile(t,e,i,r){const n=(r=r||{signal:null}).signal!=null?r.signal:r.signal=new AbortController().signal,s={responseType:"array-buffer",signal:n},o={noDataValue:r.noDataValue,returnFileInfo:!0};return this.load().then(()=>this._fetchTileAvailability(t,e,i,r)).then(()=>bi(this.getTileUrl(t,e,i),s)).then(l=>this._lercDecoder.decode(l.data,o,n)).then(l=>new eFe(l))}getTileUrl(t,e,i){const r=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,n=PT({...this.parsedUrl.query,blankTile:!r&&null});return`${this.parsedUrl.path}/tile/${t}/${e}/${i}${n?"?"+n:""}`}async queryElevation(t,e){const{ElevationQuery:i}=await we(()=>Promise.resolve().then(()=>zV),void 0);return St(e),new i().query(this,t,e)}async createElevationSampler(t,e){const{ElevationQuery:i}=await we(()=>Promise.resolve().then(()=>zV),void 0);return St(e),new i().createSampler(this,t,e)}_fetchTileAvailability(t,e,i,r){return this.tilemapCache?this.tilemapCache.fetchAvailability(t,e,i,r):Promise.resolve("unknown")}async _fetchImageService(t){var r;if(this.sourceJSON)return this.sourceJSON;const e={query:{f:"json",...this.parsedUrl.query},responseType:"json",signal:t},i=await bi(this.parsedUrl.path,e);i.ssl&&(this.url=(r=this.url)==null?void 0:r.replace(/^http:/i,"https:")),this.sourceJSON=i.data,this.read(i.data,{origin:"service",url:this.parsedUrl})}get hasOverriddenFetchTile(){return!this.fetchTile[pje]}};y([w({readOnly:!0})],bl.prototype,"capabilities",void 0),y([$t("service","capabilities",["capabilities"])],bl.prototype,"readCapabilities",null),y([w({json:{read:{source:"copyrightText"}}})],bl.prototype,"copyright",void 0),y([w({readOnly:!0,type:N_})],bl.prototype,"heightModelInfo",void 0),y([w({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],bl.prototype,"path",void 0),y([w({type:["show","hide"]})],bl.prototype,"listMode",void 0),y([w({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],bl.prototype,"minScale",void 0),y([w({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],bl.prototype,"maxScale",void 0),y([w({json:{read:!1,write:!1,origins:{"web-document":{read:!1,write:!1}}}})],bl.prototype,"opacity",void 0),y([w({type:["ArcGISTiledElevationServiceLayer"]})],bl.prototype,"operationalLayerType",void 0),y([w()],bl.prototype,"sourceJSON",void 0),y([w({json:{read:!1},value:"elevation",readOnly:!0})],bl.prototype,"type",void 0),y([w(soe)],bl.prototype,"url",void 0),y([w()],bl.prototype,"version",void 0),y([$t("version",["currentVersion"])],bl.prototype,"readVersion",null),bl=y([Z("esri.layers.ElevationLayer")],bl);const pje=Symbol("default-fetch-tile");bl.prototype.fetchTile[pje]=!0;const fje=bl,mje=Object.freeze(Object.defineProperty({__proto__:null,default:fje},Symbol.toStringTag,{value:"Module"})),Kqt=t=>{const e=document.getElementById("opacitySlider");e.addEventListener("calciteSliderInput",()=>{const o=e.value/100;t.map.ground.opacity=o});const i=document.getElementById("navigationUnderground");console.log(i);const r=document.getElementById("elevationInput");i.addEventListener("calciteCheckboxChange",o=>{t.map.ground.navigationConstraint.type=o.target.checked?"none":"stay-above"}),r.addEventListener("calciteCheckboxChange",n);function n(o){t.map.ground.layers.forEach(l=>{l.visible=o.target.checked})}const s=document.getElementById("elevationModels");s.addEventListener("calciteRadioButtonGroupChange",()=>{const o=s.selectedItem.value;t.map.ground.layers.forEach(l=>{l.visible=l.id===o})})},gje=(t,e)=>new fje({url:t,title:e,visible:!1}),Qqt=t=>{const e=new URL(window.location.href);new URLSearchParams(e.search).get("underground")==="true"&&(t.map.ground.navigationConstraint.type="none")},eWt=t=>{const e=new URL(window.location.href),r=new URLSearchParams(e.search).get("layers");if(r!==null){const n=r.split(",");t.map.allLayers.items.forEach(s=>{n.includes(s.title)&&(s.visible=!s.visible)})}},tWt=t=>{const e=new URL(window.location.href),r=new URLSearchParams(e.search).get("elevation");if(r!==null){const n=r.split(",");t.map.ground.layers.forEach(s=>{n.includes(s.title)&&(s.visible=!s.visible)})}},iWt=()=>{const t=new URL(window.location.href),i=new URLSearchParams(t.search).get("view");if(i){const[r,n,s,o,l,c,f]=i.split(","),_=parseFloat(r),x=parseFloat(n),T=parseFloat(s),A=parseFloat(o),M=parseFloat(l),I=parseFloat(c),L=parseFloat(f);return[_,x,T,A,M,I,L]}return null},rWt=async t=>{await navigator.clipboard.writeText(t)},nWt=(t,e,i)=>{const r=window.location.href,n=new URL(r.split("?")[0]),s=t.viewpoint,{rotation:o,scale:l}=s,{heading:c,tilt:f}=s.camera,{x:_,y:x,z:T}=s.camera.position,A=new URLSearchParams;if(A.set("view",`${_},${x},${T},${c},${f},${o},${l}`),t.map.ground.navigationConstraint.type==="none"&&A.set("underground","true"),e.length!==0){const M=e.join(",");A.set("layers",M)}if(i.length!==0){const M=i.join(",");A.set("elevation",M)}return n.search=A.toString(),n.toString()},sWt=t=>{const[e,i,r,n,s,o,l]=t;return new ih({camera:new cd({position:new mt({x:e,y:i,z:r,spatialReference:{wkid:3301}}),heading:n,tilt:s}),rotation:o,scale:l})},yje=ddt(),oWt=pdt("66e382030b224ffa999249a4d1cbbf4f","Sidemastid"),aWt=fdt(),vje=Mze("92d29869db444e28beab584f696b86c3",yje,aWt),lWt=Mze("da15a55042b54c31b0208ba98c1647fc"),cWt=Oze(lWt),uWt=gje("https://tiles.arcgis.com/tiles/ZYGCYltwz5ExeoGm/arcgis/rest/services/APR_50m_Eesti_tif/ImageServer","Aluspõhi 50m"),hWt=gje("https://tiles.arcgis.com/tiles/ZYGCYltwz5ExeoGm/arcgis/rest/services/AKR_50m_2/ImageServer","Aluskord 50m"),Fr=Oze(vje);Fr.when(()=>{const t=gdt(cWt),e=t.items.find(Y=>Y.title==="Puurkaevud/puuraugud"),i=t.items.find(Y=>Y.title==="Ehitusgeoloogia"),r=t.items.find(Y=>Y.title==="Geoloogia WMS");r.visible=!1,Fr.map.ground.layers.addMany([uWt,hWt]);const{description:n}=vje.portalItem,s=document.querySelector("#item-description");s.innerHTML=n,Fr.ui.move("zoom","top-right"),Fr.ui.move("navigation-toggle","top-right"),Fr.ui.move("compass","top-right"),PUt();const o=e0e("Taimkate","exclusive");mdt(o,Fr),Fr.map.add(o);const l=jzt(Fr);nxe(l,Fr);const c=Gzt(Fr);nxe(c,Fr);const f=Hzt(Fr);qzt(f,Fr);const _=e0e("Geoloogia","independent");_.addMany([e,i]),Fr.map.add(_),Fr.map.add(r),Kqt(Fr);const x=SUt(Fr),T=TUt();x.formats.add(T),x.conversions.splice(0,0,new BS({format:T})),Fr.ui.add(x,"bottom-right"),OUt(Fr);const A=CBt();ABt(Fr,A),_Ht(Fr),_qt(Fr);const M=new wQe({view:Fr,container:"measurement-container"});bqt(M),zqt(Fr);const I=Wqt(Fr);Fr.ui.add(I,"top-right"),Hjt(Fr,yje),Fr.map.reorder(o,6),Fr.map.reorder(_,6),Fr.map.reorder(r,-1),Fr.map.findLayerById("180fa46104d-layer-35").add(oWt);const F=t0e(Fr),z=Nqt(Fr);let k;const U=({target:Y})=>{if(Y.tagName!=="CALCITE-ACTION")return;k&&(document.querySelector(`[data-action-id=${k}]`).active=!1,document.querySelector(`[data-panel-id=${k}]`).hidden=!0);const Q=Y.dataset.actionId;if(Q!==k?(document.querySelector(`[data-action-id=${Q}]`).active=!0,document.querySelector(`[data-panel-id=${Q}]`).hidden=!1,k=Q):k=null,Q==="shadowCast"&&(z.visible=!z.visible),Q==="share"){const ne=t0e(Fr),[re,he]=ydt(F,ne);console.log(re),console.log(he);const ce=nWt(Fr,re,he);rWt(ce);const be=document.getElementById("share-map-alert");be.open="true"}};document.querySelector("calcite-action-bar").addEventListener("click",U);let j=!1;document.addEventListener("calciteActionBarToggle",Y=>{j=!j,Fr.padding={left:j?135:49}});const H=iWt();if(Qqt(Fr),eWt(Fr),tWt(Fr),H!==null){const Y=sWt(H);Fr.goTo(Y,{animate:!1}),console.log(f)}});const dWt=Object.freeze(Object.defineProperty({__proto__:null,betaRayleigh:fO,build:qIe},Symbol.toStringTag,{value:"Module"})),pWt=Object.freeze(Object.defineProperty({__proto__:null,AtmosphereCompositingPassParameters:_ae,build:d$e},Symbol.toStringTag,{value:"Module"})),fWt=Object.freeze(Object.defineProperty({__proto__:null,build:_$e},Symbol.toStringTag,{value:"Module"})),mWt=Object.freeze(Object.defineProperty({__proto__:null,CloudsDrawParameters:Cae,CloudsPassParameters:Eae,build:C$e},Symbol.toStringTag,{value:"Module"})),gWt=Object.freeze(Object.defineProperty({__proto__:null,NoiseTextureAtlasPassParameters:Aae,build:O$e},Symbol.toStringTag,{value:"Module"})),yWt=Object.freeze(Object.defineProperty({__proto__:null,FogPassParameters:Oae,build:G$e},Symbol.toStringTag,{value:"Module"})),vWt=Object.freeze(Object.defineProperty({__proto__:null,SilhouetteCircle:Iae,SimpleAtmospherePassParameters:Ij,build:K$e},Symbol.toStringTag,{value:"Module"})),_Wt=Object.freeze(Object.defineProperty({__proto__:null,build:TLe},Symbol.toStringTag,{value:"Module"})),bWt=Object.freeze(Object.defineProperty({__proto__:null,build:ALe},Symbol.toStringTag,{value:"Module"})),wWt=Object.freeze(Object.defineProperty({__proto__:null,build:d6e,calculateAnchorPosForRendering:FL},Symbol.toStringTag,{value:"Module"})),xWt=Object.freeze(Object.defineProperty({__proto__:null,build:nDe},Symbol.toStringTag,{value:"Module"})),SWt=Object.freeze(Object.defineProperty({__proto__:null,build:aDe,getRadius:aG},Symbol.toStringTag,{value:"Module"})),TWt=Object.freeze(Object.defineProperty({__proto__:null,build:dDe},Symbol.toStringTag,{value:"Module"})),EWt=Object.freeze(Object.defineProperty({__proto__:null,build:fDe},Symbol.toStringTag,{value:"Module"})),CWt=Object.freeze(Object.defineProperty({__proto__:null,build:ODe},Symbol.toStringTag,{value:"Module"})),AWt=Object.freeze(Object.defineProperty({__proto__:null,build:ONe,ribbonlineNumRoundJoinSubdivisions:jL},Symbol.toStringTag,{value:"Module"})),MWt=Object.freeze(Object.defineProperty({__proto__:null,build:kNe},Symbol.toStringTag,{value:"Module"})),OWt=Object.freeze(Object.defineProperty({__proto__:null,TextureOnlyPassParameters:Ble,build:sNe},Symbol.toStringTag,{value:"Module"})),PWt=Object.freeze(Object.defineProperty({__proto__:null,OverlayCompositingPassParameters:ece,build:HNe},Symbol.toStringTag,{value:"Module"})),RWt=Object.freeze(Object.defineProperty({__proto__:null,build:m8e},Symbol.toStringTag,{value:"Module"})),IWt=Object.freeze(Object.defineProperty({__proto__:null,build:U8e},Symbol.toStringTag,{value:"Module"})),$Wt=Object.freeze(Object.defineProperty({__proto__:null,build:g7e},Symbol.toStringTag,{value:"Module"})),LWt=Object.freeze(Object.defineProperty({__proto__:null,build:S7e},Symbol.toStringTag,{value:"Module"})),DWt=Object.freeze(Object.defineProperty({__proto__:null,build:C7e},Symbol.toStringTag,{value:"Module"})),NWt=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:Oce,build:xFe},Symbol.toStringTag,{value:"Module"})),FWt=Object.freeze(Object.defineProperty({__proto__:null,get BackgroundMode(){return K2},build:VFe},Symbol.toStringTag,{value:"Module"})),kWt=Object.freeze(Object.defineProperty({__proto__:null,ColorizerHillshadeUniforms:bFe,ColorizerStretchUniforms:_Fe,ColorizerUniforms:p6,build:wFe},Symbol.toStringTag,{value:"Module"})),zWt=Object.freeze(Object.defineProperty({__proto__:null,build:uke},Symbol.toStringTag,{value:"Module"})),UWt=Object.freeze(Object.defineProperty({__proto__:null,CompositingPassParameters:RG,build:_ke},Symbol.toStringTag,{value:"Module"})),VWt=Object.freeze(Object.defineProperty({__proto__:null,HUDCompositingPassParameters:Bce,build:wke},Symbol.toStringTag,{value:"Module"})),BWt=Object.freeze(Object.defineProperty({__proto__:null,OITCompositingPassParameters:jce,build:Tke},Symbol.toStringTag,{value:"Module"})),jWt=Object.freeze(Object.defineProperty({__proto__:null,build:Oke},Symbol.toStringTag,{value:"Module"})),GWt=Object.freeze(Object.defineProperty({__proto__:null,HighlightBlurDrawParameters:qce,build:Ike},Symbol.toStringTag,{value:"Module"})),HWt=Object.freeze(Object.defineProperty({__proto__:null,HighlightDownsampleDrawParameters:Gce,blurSize:Hce,build:Mke,gridCellPixelSize:tm,outlineSize:IG},Symbol.toStringTag,{value:"Module"})),qWt=Object.freeze(Object.defineProperty({__proto__:null,build:Fke},Symbol.toStringTag,{value:"Module"})),WWt=Object.freeze(Object.defineProperty({__proto__:null,build:Uke},Symbol.toStringTag,{value:"Module"})),YWt=Object.freeze(Object.defineProperty({__proto__:null,build:jke},Symbol.toStringTag,{value:"Module"})),XWt=Object.freeze(Object.defineProperty({__proto__:null,build:qke},Symbol.toStringTag,{value:"Module"})),ZWt=Object.freeze(Object.defineProperty({__proto__:null,ShadowCastVisualizePassParameters:Yce,build:Zke},Symbol.toStringTag,{value:"Module"})),JWt=Object.freeze(Object.defineProperty({__proto__:null,ShadowCastMaxSamples:m6,build:Xke},Symbol.toStringTag,{value:"Module"})),KWt=Object.freeze(Object.defineProperty({__proto__:null,build:ize},Symbol.toStringTag,{value:"Module"}));export{Es as $,kt as A,EXt as B,Li as C,mXt as D,se as E,Mo as F,b2 as G,aXt as H,Eyi as I,cu as J,Dn as K,ZVe as L,ZXt as M,xc as N,_t as O,ii as P,jse as Q,Zde as R,Ml as S,mt as T,LHe as U,it as V,eAe as W,Oa as X,Ku as Y,Ce as Z,wxe as _,gn as a,Oj as a$,Ps as a0,sgt as a1,rr as a2,nx as a3,ad as a4,a_ as a5,_be as a6,Sbe as a7,Oc as a8,yt as a9,Fmt as aA,_ue as aB,Nmt as aC,wBt as aD,Ne as aE,Ye as aF,Wt as aG,WVe as aH,Ko as aI,dm as aJ,xZt as aK,ZKt as aL,ele as aM,bE as aN,BKt as aO,_Pe as aP,rt as aQ,ss as aR,N5e as aS,Fi as aT,je as aU,z_ as aV,QKt as aW,Tp as aX,tl as aY,Gw as aZ,ms as a_,W as aa,qe as ab,JJe as ac,oXt as ad,Ni as ae,qO as af,pu as ag,X5 as ah,ni as ai,g5 as aj,en as ak,Zn as al,ma as am,Uxt as an,$m as ao,jG as ap,jr as aq,at as ar,Ie as as,Be as at,De as au,Co as av,iQt as aw,Ve as ax,ud as ay,Sn as az,Cc as b,Xrt as b$,jm as b0,nt as b1,Wn as b2,Doe as b3,rO as b4,mm as b5,zM as b6,$5 as b7,Lri as b8,gT as b9,Qe as bA,Xu as bB,Ao as bC,uNe as bD,X_ as bE,BJt as bF,VJt as bG,Jl as bH,Re as bI,Gnt as bJ,Bnt as bK,C2 as bL,tXt as bM,ILt as bN,FRe as bO,kRe as bP,RZt as bQ,Am as bR,os as bS,Zz as bT,Kz as bU,qs as bV,bi as bW,Bm as bX,t2 as bY,Bse as bZ,aOe as b_,t1t as ba,Sc as bb,Jii as bc,Xii as bd,Zii as be,J as bf,tce as bg,Tei as bh,Mi as bi,EEt as bj,CEt as bk,O5 as bl,Je as bm,el as bn,cp as bo,qxt as bp,VU as bq,xt as br,Rte as bs,qle as bt,$ve as bu,Ka as bv,L9 as bw,$9 as bx,Bo as by,It as bz,Z as c,qWe as c$,fE as c0,mE as c1,ui as c2,T$ as c3,vst as c4,Tai as c5,Eai as c6,uE as c7,Fxt as c8,S_ as c9,WG as cA,Myi as cB,Oyi as cC,Pyi as cD,Ryi as cE,Nyi as cF,Iyi as cG,$yi as cH,Lyi as cI,Dyi as cJ,Fyi as cK,NXt as cL,ao as cM,jl as cN,Rut as cO,El as cP,nQt as cQ,rQt as cR,Zme as cS,pqt as cT,R5 as cU,Kdt as cV,iei as cW,rP as cX,r4t as cY,S9 as cZ,h9 as c_,F_ as ca,qsi as cb,nci as cc,Pi as cd,GX as ce,N3e as cf,oP as cg,fXt as ch,BZe as ci,lXt as cj,TXt as ck,yXt as cl,bCe as cm,nXt as cn,AXt as co,dqt as cp,DXt as cq,LXt as cr,Zf as cs,th as ct,Dct as cu,HKt as cv,s3e as cw,kyi as cx,ex as cy,xyi as cz,_e as d,ox as d$,js as d0,LZt as d1,oA as d2,FFt as d3,CMe as d4,kFt as d5,p_ as d6,Xit as d7,nd as d8,UYt as d9,Bf as dA,Dot as dB,Dk as dC,sE as dD,Vtt as dE,Btt as dF,qat as dG,Wat as dH,Yat as dI,Le as dJ,Sse as dK,zht as dL,XB as dM,JB as dN,OB as dO,fP as dP,zo as dQ,cL as dR,Ar as dS,Vi as dT,_ot as dU,b5e as dV,soe as dW,fd as dX,dP as dY,d6 as dZ,Ec as d_,QWt as da,_Xt as db,wXt as dc,$de as dd,we as de,vE as df,Wst as dg,YYt as dh,uat as di,dPe as dj,fJt as dk,Alt as dl,Uf as dm,rdt as dn,yn as dp,Xs as dq,Ue as dr,yat as ds,$t as dt,Pt as du,qpe as dv,moe as dw,I9 as dx,O2 as dy,xB as dz,y as e,pO as e$,g_ as e0,rl as e1,ws as e2,ys as e3,pp as e4,aL as e5,to as e6,RZ as e7,$Z as e8,Ez as e9,$5e as eA,uT as eB,XZ as eC,bB as eD,sz as eE,LT as eF,v8 as eG,pse as eH,dse as eI,VAe as eJ,fse as eK,dZt as eL,JFe as eM,CQe as eN,rT as eO,foe as eP,Zse as eQ,Vy as eR,dai as eS,WSt as eT,qSt as eU,xKe as eV,PSt as eW,ait as eX,Cse as eY,QT as eZ,J2 as e_,D5e as ea,Dv as eb,U5e as ec,fVe as ed,mVe as ee,sd as ef,pVe as eg,ya as eh,JZt as ei,yai as ej,od as ek,Vht as el,m5e as em,Gst as en,kv as eo,Di as ep,xmi as eq,Fd as er,zfe as es,Cz as et,Ght as eu,D_ as ev,fj as ew,BWe as ex,$n as ey,g2 as ez,sn as f,bG as f$,cm as f0,Jqt as f1,GQt as f2,PT as f3,zJt as f4,Gh as f5,Ci as f6,tx as f7,eYt as f8,UYe as f9,Bi as fA,as as fB,WKt as fC,bfe as fD,qKt as fE,Jct as fF,xRe as fG,hit as fH,Eht as fI,Yit as fJ,dni as fK,NL as fL,pni as fM,Bn as fN,qf as fO,GT as fP,SQt as fQ,kQt as fR,MFt as fS,Upe as fT,cht as fU,_Qt as fV,iZt as fW,BL as fX,Unt as fY,Yl as fZ,_G as f_,UO as fa,Mne as fb,bje as fc,y_ as fd,UAe as fe,PZt as ff,v9 as fg,wi as fh,EIt as fi,hdi as fj,KL as fk,Jr as fl,tRe as fm,DJt as fn,Fy as fo,Mdt as fp,wn as fq,d7 as fr,nP as fs,cie as ft,ds as fu,id as fv,Jre as fw,pd as fx,ca as fy,OE as fz,xo as g,Eje as g$,MT as g0,pft as g1,f6t as g2,m6t as g3,a6t as g4,Yfi as g5,fV as g6,rfi as g7,y6t as g8,L8e as g9,$ue as gA,MP as gB,jKt as gC,Sm as gD,wgi as gE,bgi as gF,oT as gG,ZX as gH,Iue as gI,rci as gJ,Q$ as gK,kf as gL,vYt as gM,yAt as gN,Tr as gO,nl as gP,KCt as gQ,HL as gR,Y$ as gS,Ami as gT,_6 as gU,Kmt as gV,QCt as gW,QPt as gX,eJt as gY,ici as gZ,SZt as g_,Cit as ga,R9 as gb,QDe as gc,hai as gd,uai as ge,Vit as gf,$Zt as gg,kit as gh,Ase as gi,IZt as gj,wc as gk,wet as gl,XR as gm,vn as gn,pn as go,__ as gp,Of as gq,Cp as gr,Bs as gs,Xz as gt,qB as gu,Y6 as gv,Lrt as gw,vjt as gx,_jt as gy,Q2 as gz,HK as h,Ja as h$,tKt as h0,Zot as h1,tfe as h2,mJt as h3,$Ye as h4,ZYe as h5,s0 as h6,rKe as h7,rtt as h8,bt as h9,xHt as hA,tje as hB,Pje as hC,m5 as hD,sl as hE,Fjt as hF,e1 as hG,Ajt as hH,vBe as hI,w5 as hJ,Gu as hK,or as hL,df as hM,pgi as hN,$lt as hO,Qr as hP,GU as hQ,i0 as hR,Dti as hS,hgi as hT,Wl as hU,bjt as hV,Lue as hW,Njt as hX,X0 as hY,Sw as hZ,kO as h_,ix as ha,CJt as hb,eoe as hc,Mst as hd,toe as he,a5e as hf,hce as hg,f_ as hh,l5e as hi,uOt as hj,Cie as hk,cn as hl,Pl as hm,X as hn,Cw as ho,XI as hp,Cm as hq,tj as hr,BB as hs,kKt as ht,Jf as hu,_ze as hv,RT as hw,Ur as hx,By as hy,l3e as hz,Xot as i,qh as i$,A6e as i0,YB as i1,Ln as i2,Rri as i3,bL as i4,my as i5,U9 as i6,uci as i7,wie as i8,Jsi as i9,R2 as iA,P_ as iB,d5 as iC,Vh as iD,QZ as iE,upe as iF,uit as iG,yot as iH,got as iI,hPe as iJ,dfe as iK,kK as iL,Ist as iM,fot as iN,cat as iO,n5 as iP,pfe as iQ,GKt as iR,Ilt as iS,wKe as iT,Woi as iU,FK as iV,AJt as iW,hst as iX,ty as iY,ky as iZ,qye as i_,Zsi as ia,VKt as ib,dU as ic,Y2 as id,r6 as ie,Tj as ig,jJt as ih,Yz as ii,jf as ij,Kot as ik,Llt as il,fat as im,bRe as io,AS as ip,Hp as iq,D4 as ir,F4 as is,$st as it,mot as iu,hE as iv,Vt as iw,Iat as ix,$s as iy,kB as iz,G5e as j,CXt as j$,Xf as j0,s5 as j1,Glt as j2,Toe as j3,ase as j4,gZt as j5,m2 as j6,HYe as j7,jy as j8,Mf as j9,fKt as jA,mKt as jB,gKt as jC,yKt as jD,vKt as jE,Uht as jF,Uv as jG,GJt as jH,_c as jI,qu as jJ,Iri as jK,P9 as jL,Rs as jM,JV as jN,Tn as jO,ur as jP,d_ as jQ,Ju as jR,ko as jS,B0i as jT,WZ as jU,iht as jV,vot as jW,u$t as jX,F8t as jY,Sv as jZ,Za as j_,Ust as ja,TKt as jb,fy as jc,WJt as jd,qJt as je,Z5 as jf,Qse as jg,_Kt as jh,PB as ji,L_ as jj,ioe as jk,HOe as jl,tlt as jm,elt as jn,Qat as jo,not as jp,SKt as jq,Pat as jr,Yst as js,oKt as jt,aKt as ju,lKt as jv,uKt as jw,hKt as jx,dKt as jy,pKt as jz,Rf as k,KAt as k$,eUt as k0,xM as k1,GK as k2,Joi as k3,dJt as k4,Yoi as k5,hp as k6,YXt as k7,pZt as k8,Met as k9,Oee as kA,BG as kB,IBt as kC,vBt as kD,bBt as kE,iBt as kF,RBt as kG,igi as kH,xBt as kI,_Bt as kJ,ZCe as kK,RKe as kL,Gr as kM,tt as kN,si as kO,dL as kP,S5e as kQ,sgi as kR,sf as kS,Gsi as kT,R$ as kU,CL as kV,Ws as kW,Nti as kX,AL as kY,mci as kZ,QAt as k_,eZt as ka,XXt as kb,FZ as kc,co as kd,vut as ke,_m as kf,Sei as kg,Eut as kh,Xr as ki,Wr as kj,Uie as kk,Vie as kl,D8t as km,O_ as kn,jh as ko,xXt as kp,goe as kq,nKe as kr,vXt as ks,yr as kt,wEe as ku,Tse as kv,lE as kw,oE as kx,FB as ky,$ti as kz,Qa as l,bs as l$,xoe as l0,vs as l1,uVe as l2,L5e as l3,sai as l4,tO as l5,gpe as l6,fZt as l7,ZO as l8,KZt as l9,KKe as lA,BO as lB,eai as lC,l_ as lD,Gft as lE,D3e as lF,lht as lG,yP as lH,hae as lI,Ogi as lJ,j9 as lK,gse as lL,tQt as lM,Out as lN,YJe as lO,hXt as lP,qJe as lQ,cXt as lR,uXt as lS,yCe as lT,SOe as lU,Zre as lV,CE as lW,ke as lX,cr as lY,Zr as lZ,vm as l_,Gje as la,$2 as lb,eKt as lc,XV as ld,ene as le,Hy as lf,SA as lg,Zl as lh,Mat as li,zKt as lj,clt as lk,Smi as ll,Bk as lm,bMt as ln,xMt as lo,Ari as lp,Vm as lq,hG as lr,tFe as ls,rp as lt,dht as lu,gQt as lv,wQt as lw,KQt as lx,mRe as ly,yLe as lz,I_ as m,rTt as m$,Gt as m0,Rn as m1,c4t as m2,jft as m3,qw as m4,Zo as m5,iae as m6,F0i as m7,dgi as m8,YDt as m9,$i as mA,WB as mB,J5 as mC,bc as mD,wp as mE,fa as mF,A9 as mG,ose as mH,yH as mI,Sr as mJ,vQt as mK,Mr as mL,Lse as mM,Wme as mN,W8e as mO,X8e as mP,OMt as mQ,Np as mR,P$ as mS,I$ as mT,T8e as mU,HOt as mV,_Mt as mW,tTt as mX,v_ as mY,tNe as mZ,oZt as m_,kV as ma,gci as mb,jli as mc,Bli as md,Uli as me,SM as mf,qCt as mg,Vli as mh,Um as mi,DZ as mj,XYt as mk,UJt as ml,tot as mm,Qst as mn,T2 as mo,JQt as mp,BSe as mq,bKt as mr,wKt as ms,roe as mt,cKt as mu,py as mv,sKt as mw,Wf as mx,bot as my,DB as mz,et as n,uni as n$,_Ot as n0,pOt as n1,fOt as n2,wOt as n3,gOt as n4,yOt as n5,Fm as n6,mOt as n7,Ac as n8,bOt as n9,ae as nA,RXt as nB,u9 as nC,Yqt as nD,OFt as nE,z2e as nF,TRe as nG,fL as nH,td as nI,Qoi as nJ,RB as nK,OZt as nL,EZt as nM,AZt as nN,CZt as nO,MZt as nP,fp as nQ,w6e as nR,MHe as nS,Eat as nT,YV as nU,c_ as nV,XX as nW,U_ as nX,Fqt as nY,m9 as nZ,wE as n_,Y9 as na,Nj as nb,Ea as nc,iTt as nd,vOt as ne,kj as nf,e0 as ng,TE as nh,EO as ni,EC as nj,Uti as nk,kti as nl,zti as nm,gjt as nn,XVe as no,vPe as np,DI as nq,FO as nr,bPe as ns,mk as nt,bLt as nu,YFe as nv,Ms as nw,Oct as nx,gct as ny,RQ as nz,ipe as o,i1 as o$,b_ as o0,fn as o1,Xoe as o2,xp as o3,Loe as o4,AT as o5,Jet as o6,nn as o7,gp as o8,fSe as o9,c$ as oA,oJt as oB,Rat as oC,Yse as oD,EM as oE,EOe as oF,vnt as oG,glt as oH,irt as oI,Vv as oJ,B$ as oK,q3e as oL,xne as oM,HYt as oN,Y5 as oO,bYe as oP,nB as oQ,ZYt as oR,act as oS,_E as oT,cgt as oU,ju as oV,Ji as oW,nZt as oX,mB as oY,yZt as oZ,m_ as o_,_Yt as oa,ZQt as ob,Fti as oc,UPe as od,Uo as oe,OQ as of,rYt as og,vSe as oh,TYt as oi,SYt as oj,fai as ok,pai as ol,EYt as om,N2 as on,IGe as oo,z3e as op,Nje as oq,lZt as or,m4e as os,xft as ot,Xi as ou,V0i as ov,fc as ow,znt as ox,yjt as oy,Ppt as oz,ze as p,dxe as p$,E2 as p0,QMe as p1,JO as p2,Zh as p3,qYt as p4,Vf as p5,pQ as p6,pSe as p7,oQe as p8,G3e as p9,kft as pA,KBt as pB,dBe as pC,XBt as pD,Ayi as pE,Cyi as pF,wSe as pG,ogi as pH,gj as pI,YQe as pJ,dgt as pK,fs as pL,tgt as pM,igt as pN,wJt as pO,Ynt as pP,Xre as pQ,fu as pR,sO as pS,gnt as pT,M2 as pU,KKt as pV,$G as pW,iU as pX,eCt as pY,A8t as pZ,nai as p_,iE as pa,Xg as pb,mEe as pc,One as pd,GYt as pe,Ty as pf,SKe as pg,ide as ph,tOe as pi,i8e as pj,imt as pk,Ei as pl,L8t as pm,ZPe as pn,JXt as po,AQe as pp,WVt as pq,$Bt as pr,ugt as ps,hut as pt,Wue as pu,mqt as pv,$O as pw,w_ as px,fqt as py,Dft as pz,sXt as q,sTt as q$,U0i as q0,z0i as q1,O9 as q2,xn as q3,Olt as q4,mj as q5,uZt as q6,cZt as q7,ime as q8,eme as q9,YQt as qA,pXt as qB,dXt as qC,bXt as qD,Yt as qE,Act as qF,cct as qG,MPe as qH,Bv as qI,gs as qJ,$8e as qK,PMt as qL,Gre as qM,yct as qN,WYt as qO,gai as qP,Hye as qQ,vai as qR,lai as qS,XDe as qT,JDe as qU,WDe as qV,qI as qW,HI as qX,zit as qY,Uit as qZ,Jye as q_,mc as qa,DMe as qb,HJt as qc,D8e as qd,wci as qe,A8e as qf,Eie as qg,oce as qh,Ene as qi,uu as qj,Yf as qk,EMt as ql,M8e as qm,R8e as qn,CMt as qo,TMt as qp,AMt as qq,j_ as qr,SMt as qs,Dme as qt,$ii as qu,zee as qv,wMt as qw,Iii as qx,Aai as qy,XQt as qz,rXt as r,Xl as r$,qoi as r0,kAe as r1,mZt as r2,MQe as r3,QXt as r4,uB as r5,rQe as r6,uQe as r7,KDe as r8,Qne as r9,oj as rA,ggi as rB,lo as rC,y2 as rD,uj as rE,zoe as rF,uRe as rG,UB as rH,k9 as rI,F9 as rJ,uP as rK,lPe as rL,frt as rM,FKt as rN,xRt as rO,_St as rP,ySt as rQ,Bct as rR,Loi as rS,e5 as rT,$oi as rU,x_ as rV,wai as rW,Ya as rX,Hl as rY,shi as rZ,Yle as r_,BXt as ra,qOe as rb,qnt as rc,NB as rd,ou as re,DE as rf,xat as rg,NKe as rh,DKe as ri,vB as rj,DHe as rk,yQe as rl,tme as rm,LEt as rn,Hf as ro,Wre as rp,fti as rq,tMt as rr,eE as rs,Dm as rt,GPe as ru,Qo as rv,zIe as rw,_B as rx,VT as ry,R_ as rz,St as s,So as s$,OYt as s0,gm as s1,ep as s2,iD as s3,rai as s4,efe as s5,Kt as s6,Zoi as s7,c3t as s8,zB as s9,sZt as sA,s0t as sB,LQt as sC,mQt as sD,DQt as sE,D0i as sF,dj as sG,MQt as sH,TQt as sI,EQt as sJ,xQt as sK,i8 as sL,gNe as sM,md as sN,G9t as sO,Qct as sP,lct as sQ,uQt as sR,$Qt as sS,eut as sT,ZJt as sU,$fe as sV,AO as sW,Mri as sX,Py as sY,o5 as sZ,zz as s_,gE as sa,SRt as sb,wle as sc,dUe as sd,To as se,k7e as sf,Cmi as sg,Nz as sh,CAe as si,kRt as sj,Al as sk,Iti as sl,SE as sm,Zmt as sn,g_e as so,Bie as sp,x0 as sq,hV as sr,_L as ss,I5e as st,Lot as su,Oe as sv,Qpe as sw,WMe as sx,Z3e as sy,Ije as sz,JEe as t,dV as t$,tht as t0,ZS as t1,IQt as t2,rs as t3,hP as t4,RQt as t5,Wi as t6,$Oe as t7,LOe as t8,Wsi as t9,YKt as tA,g9 as tB,yYt as tC,OL as tD,uL as tE,Xsi as tF,L$e as tG,vht as tH,yRe as tI,fQt as tJ,c2 as tK,gut as tL,dy as tM,uht as tN,Opt as tO,Afe as tP,yQt as tQ,epe as tR,j0i as tS,h4t as tT,s_e as tU,Cat as tV,L3e as tW,k3e as tX,Hre as tY,JYt as tZ,adi as t_,OQt as ta,bQt as tb,R5e as tc,$ot as td,Qn as te,CM as tf,t5 as tg,X6e as th,Ale as ti,Tyt as tj,z8e as tk,xEe as tl,Noe as tm,t$ as tn,NJt as to,FQt as tp,NQt as tq,a5 as tr,Cut as ts,ir as tt,Jv as tu,sG as tv,UU as tw,mn as tx,Gpi as ty,LYt as tz,X5e as u,gat as u$,zh as u0,Uh as u1,Hie as u2,jie as u3,qie as u4,Gie as u5,y_e as u6,Xst as u7,Emi as u8,PXt as u9,zI as uA,tn as uB,ci as uC,Ai as uD,Qhi as uE,ldi as uF,hDe as uG,kS as uH,v_e as uI,Khi as uJ,tdi as uK,FS as uL,Zhi as uM,cpi as uN,mY as uO,tk as uP,Tc as uQ,ki as uR,sr as uS,Yr as uT,Pr as uU,Qf as uV,xDe as uW,vf as uX,st as uY,G4t as uZ,H4t as u_,au as ua,yue as ub,pP as uc,cnt as ud,unt as ue,OOe as uf,mAt as ug,Pnt as uh,gAt as ui,DOe as uj,Wz as uk,RYt as ul,pm as um,TOe as un,n$ as uo,wL as up,kQe as uq,nj as ur,Rz as us,gB as ut,hre as uu,kXt as uv,FXt as uw,zXt as ux,rHe as uy,Cj as uz,SXt as v,WAe as v$,LMe as v0,zy as v1,N_ as v2,EKt as v3,Zst as v4,Jst as v5,xKt as v6,GS as v7,LKe as v8,IXt as v9,Kit as vA,Omi as vB,Sf as vC,Jit as vD,jz as vE,Hz as vF,gL as vG,nYt as vH,c7t as vI,A7t as vJ,s1i as vK,o1i as vL,a1i as vM,Uqt as vN,LG as vO,n1i as vP,Mmi as vQ,Kce as vR,cP as vS,Mlt as vT,by as vU,Wje as vV,sYt as vW,ZZt as vX,wB as vY,Dri as vZ,Nri as v_,$Xt as va,WI as vb,X8t as vc,yst as vd,rit as ve,Uy as vf,OT as vg,Mrt as vh,_ai as vi,mai as vj,Kpt as vk,RJt as vl,wGe as vm,WFe as vn,gW as vo,yW as vp,ga as vq,cai as vr,oai as vs,wat as vt,kie as vu,iXt as vv,zyi as vw,Im as vx,Ose as vy,c9 as vz,rd as w,B1e as w$,dvt as w0,$ri as w1,Kme as w2,Lti as w3,Qu as w4,WO as w5,MBt as w6,Xn as w7,Tyi as w8,Ooe as w9,Zat as wA,Jat as wB,Kat as wC,vAt as wD,Jzt as wE,tUt as wF,dEe as wG,lbe as wH,rbe as wI,TQe as wJ,nbe as wK,bbe as wL,sbe as wM,hbe as wN,Mbe as wO,Obe as wP,Pbe as wQ,Rbe as wR,tZt as wS,Gli as wT,tci as wU,Jli as wV,Zli as wW,JPt as wX,Kli as wY,Qli as wZ,U1e as w_,KXt as wa,fG as wb,Uoe as wc,ngi as wd,X8 as we,Wh as wf,k2 as wg,pvt as wh,Sp as wi,dut as wj,Oyt as wk,YO as wl,Syi as wm,z2 as wn,kst as wo,uV as wp,sLt as wq,NS as wr,_Lt as ws,uw as wt,MG as wu,AG as wv,U_e as ww,CG as wx,B_e as wy,UCt as wz,YZe as x,yle as x$,V1e as x0,Yli as x1,Xli as x2,Q_e as x3,G_e as x4,H_e as x5,q_e as x6,dbe as x7,zbe as x8,Bbe as x9,ue as xA,Yu as xB,oo as xC,h1 as xD,Kh as xE,gr as xF,S5 as xG,dd as xH,Oi as xI,Cl as xJ,Jt as xK,fe as xL,Rr as xM,hu as xN,Hr as xO,Ir as xP,Ti as xQ,vp as xR,Y_ as xS,Mj as xT,rh as xU,Kj as xV,ji as xW,eG as xX,hx as xY,H9e as xZ,cx as x_,ebe as xa,Ube as xb,JU as xc,eci as xd,BCt as xe,jCt as xf,qli as xg,Wli as xh,KNe as xi,Hli as xj,tRt as xk,GCt as xl,Ese as xm,HZ as xn,$r as xo,ai as xp,Yoe as xq,bZt as xr,Eei as xs,s1 as xt,coe as xu,$Pe as xv,Nm as xw,ft as xx,V as xy,Cr as xz,w as y,D2 as y$,ls as y0,J2t as y1,Xt as y2,vle as y3,XZt as y4,Vo as y5,Er as y6,Ol as y7,_n as y8,Zle as y9,U3 as yA,EU as yB,QZt as yC,Isi as yD,W$e as yE,_s as yF,rDe as yG,ln as yH,yp as yI,XT as yJ,Rj as yK,o0 as yL,dx as yM,$Le as yN,GMe as yO,dQt as yP,pQt as yQ,$se as yR,qm as yS,$0i as yT,Qui as yU,CQt as yV,AQt as yW,tPe as yX,R4 as yY,cRe as yZ,Uee as y_,nh as ya,EP as yb,sCt as yc,xL as yd,wZt as ye,Lbt as yf,Zoe as yg,KPe as yh,Cft as yi,JKt as yj,Zt as yk,hd as yl,px as ym,Jy as yn,Z2 as yo,fx as yp,tG as yq,Qj as yr,wae as ys,$j as yt,Rsi as yu,r6e as yv,cQt as yw,hQt as yx,YZt as yy,Art as yz,gXt as z,eQt as z0,lRe as z1,nO as z2,rZt as z3,kKe as z4,FKe as z5,Zne as z6,Yne as z7,hqt as z8,Kf as z9,yE as zA,SJt as zB,JJt as zC,QJt as zD,nKt as zE,hdt as zF,Hsi as zG,xci as zH,kci as zI,tgi as zJ,oG as za,Pc as zb,lp as zc,PLe as zd,xei as ze,q2t as zf,mft as zg,tai as zh,hZt as zi,iYt as zj,Mdi as zk,aZt as zl,iai as zm,Bu as zn,gYt as zo,fnt as zp,v3t as zq,Bd as zr,Hm as zs,u1 as zt,In as zu,Kv as zv,Xy as zw,zt as zx,EJt as zy,EE as zz}; + 1px 1px 0 ${Q}`,border:G?`1px solid rgba(${F}, ${z}, ${k}, ${U})`:"none",filter:i9(i.effectList)??void 0};return X("div",{class:pi.layerRow,key:n},X("div",{class:pi.labelElement,styles:ne},a))}if(e.src){const C=this._renderImage(e,s,o);return X("div",{class:pi.layerRow,key:n},C,X("div",{class:pi.imageLabel},a))}}_renderImage(e,i,r){const{label:n,src:s,opacity:o}=e,a={[pi.imageryLayerStretchedImage]:r,[pi.symbol]:!r},c={opacity:`${o??i.opacity}`};return X("img",{alt:_2(this.messages,n,!1),"aria-label":_2(this.messages,n,!1),border:0,class:this.classes(a),height:e.height,src:s,styles:c,width:e.width})}_renderSizeRampLines(e){const i=e.infos,r=i[0],n=i[i.length-1],s=r.symbol,o=this._hasIndicators,a=Er(r.size+r.outlineSize)*oA,c=Er(n.size+n.outlineSize)*oA,p=o?a:a+50*oA,_=o?a/2+50*oA:a,x=_Ut(s),S=vUt(s),C=document.createElement("canvas");C.width=p,C.height=_,C.style.width=C.width/oA+"px",C.style.height=C.height/oA+"px";const M=C.getContext("2d");if(o){M.beginPath();const P=0,$=0,F=p/2-c/2,z=_;M.moveTo(P,$),M.lineTo(F,z);const k=p,U=0,j=p/2+c/2,G=_;M.moveTo(k,U),M.lineTo(j,G)}else{M.beginPath();const P=0,$=_/2-c/2,F=p,z=0;M.moveTo(P,$),M.lineTo(F,z);const k=0,U=_/2+c/2,j=p,G=_;M.moveTo(k,U),M.lineTo(j,G)}return M.strokeStyle=yUt,M.stroke(),X("div",{afterCreate:Tl,bind:C,styles:o?{display:"flex",marginTop:`-${x?0:S?a/2:0}px`,marginBottom:`-${x?c:S?c/2:0}px`}:{display:"flex",marginRight:`-${x?0:S?a/2:0}px`,marginLeft:`-${x?0:S?c/2:0}px`}})}_renderSizeRamp(e,i){const r=e.infos,n=r[0].label,s=r[r.length-1].label;let o=r[0].preview,a=r[r.length-1].preview;const c=this._hasIndicators,p={"flex-direction":c?"column":"row-reverse"};o&&(o=o.cloneNode(!0),o.style.display="flex"),a&&(a=a.cloneNode(!0),a.style.display="flex");const _={opacity:i!=null?`${i}`:""};return X("div",{class:this.classes(pi.layerRow,{[pi.sizeRampRow]:c})},X("div",{class:pi.rampLabel},c?n:s),X("div",{class:pi.sizeRampContainer,styles:p},X("div",{afterCreate:Tl,bind:o,class:pi.sizeRampPreview,styles:_}),this._renderSizeRampLines(e),X("div",{afterCreate:Tl,bind:a,class:pi.sizeRampContainer,styles:_})),X("div",{class:pi.rampLabel},c?s:n))}_getRampStopLabel(e,i){switch(i){case"heatmap-ramp":return this.messages[e.label];case"stretch-ramp":return DVe(e,this.messages);default:return e.label}}_renderLegendForRamp(e,i,r){const n=e.infos,s=e.type,o=s==="heatmap-ramp",a=n.length-1,c=fUt,p=a>2&&!o?pUt*a:gUt,_=p+20,x=10,S=n.slice(0).reverse(),C=S.length-1,M=S.length%2!=0?S[S.length/2|0]:null,P=M&&X("div",{class:pi.intervalSeparatorsContainer},X("div",{class:pi.intervalSeparator},"|"),X("div",{class:pi.rampLabel},this._getRampStopLabel(M,s))),$=[[{shape:{type:"path",path:`M0 ${c/2} L${x} 0 L${x} ${c} Z`},fill:S[0].color,stroke:{width:0}},{shape:{type:"rect",x,y:0,width:p,height:c},fill:{type:"linear",x1:x,y1:0,x2:p+x,y2:0,colors:S.map((U,j)=>({color:U.color,offset:o&&"ratio"in U?U.ratio:j/a}))},stroke:{width:0}},{shape:{type:"path",path:`M${p+x} 0 L${_} ${c/2} L${p+x} ${c} Z`},fill:S[C].color,stroke:{width:0}}]],F=KUe($,_,c),z={filter:i9(r)??void 0,opacity:i==null?void 0:`${i}`},k={justifyContent:"center"};return X("div",{class:pi.layerRow,styles:k},X("div",{class:pi.rampLabel},this._getRampStopLabel(S[0],s)),X("div",{class:pi.symbolContainer},X("div",{styles:z},F),P),X("div",{class:pi.rampLabel},this._getRampStopLabel(S[C],s)))}};y([w()],Z0.prototype,"activeLayerInfos",void 0),y([w()],Z0.prototype,"headingLevel",void 0),y([w()],Z0.prototype,"layout",void 0),y([w(),Gr("esri/widgets/Legend/t9n/Legend")],Z0.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],Z0.prototype,"messagesCommon",void 0),y([w({readOnly:!0})],Z0.prototype,"type",void 0),y([w()],Z0.prototype,"view",void 0),y([wo()],Z0.prototype,"_selectSection",null),Z0=y([Z("esri.widgets.Legend.styles.Card")],Z0);const PX=Z0,Un="esri-legend",qi={service:`${Un}__service`,label:`${Un}__service-label`,layer:`${Un}__layer`,groupLayer:`${Un}__group-layer`,groupLayerChild:`${Un}__group-layer-child`,layerTable:`${Un}__layer-table`,layerTableSizeRamp:`${Un}__layer-table--size-ramp`,layerChildTable:`${Un}__layer-child-table`,layerCaption:`${Un}__layer-caption`,layerBody:`${Un}__layer-body`,layerRow:`${Un}__layer-row`,layerCell:`${Un}__layer-cell`,layerInfo:`${Un}__layer-cell ${Un}__layer-cell--info`,imageryLayerStretchedImage:`${Un}__imagery-layer-image--stretched`,imageryLayerCellStretched:`${Un}__imagery-layer-cell--stretched`,imageryLayerInfoStretched:`${Un}__imagery-layer-info--stretched`,symbolContainer:`${Un}__layer-cell ${Un}__layer-cell--symbols`,symbol:`${Un}__symbol`,rampContainer:`${Un}__ramps`,sizeRamp:`${Un}__size-ramp`,colorRamp:`${Un}__color-ramp`,opacityRamp:`${Un}__opacity-ramp`,borderlessRamp:`${Un}__borderless-ramp`,rampTick:`${Un}__ramp-tick`,rampFirstTick:`${Un}__ramp-tick-first`,rampLastTick:`${Un}__ramp-tick-last`,rampLabelsContainer:`${Un}__ramp-labels`,rampLabel:`${Un}__ramp-label`,message:`${Un}__message`,univariateAboveAndBelowLabel:"esri-univariate-above-and-below-ramp__label"},bUt=`${Un}__`,wUt=24,_xe={display:"flex",alignItems:"flex-start"},RX={marginLeft:"3px"},aA={display:"table-cell",verticalAlign:"middle"};let yS=class extends hn{constructor(e,i){super(e,i),this.activeLayerInfos=null,this.headingLevel=3,this.messages=null,this.type="classic"}render(){const e=this.activeLayerInfos,i=e&&e.toArray().map(r=>this._renderLegendForLayer(r)).filter(r=>!!r);return X("div",null,i&&i.length?i:X("div",{class:qi.message},this.messages.noLegend))}_renderLegendForLayer(e){if(!e.ready)return null;const i=!!e.children.length,r=`${bUt}${e.layer.uid}-version-${e.version}`,n=e.title?Dm({level:this.headingLevel,class:this.classes(it.heading,qi.label)},e.title):null;if(i){const s=e.children.map(o=>this._renderLegendForLayer(o)).toArray();return X("div",{class:this.classes(qi.service,qi.groupLayer),key:r},n,s)}{const s=e.legendElements;if(s&&!s.length)return null;const o=s.map(c=>this._renderLegendForElement(c,e.layer,e.effectList)).filter(c=>!!c);if(!o.length)return null;const a={[qi.groupLayerChild]:!!e.parent};return X("div",{class:this.classes(qi.service,a),key:r},n,X("div",{class:qi.layer},o))}}_renderLegendForElement(e,i,r,n){const s=e.type==="color-ramp",o=e.type==="opacity-ramp",a=e.type==="size-ramp";let c=null;if(e.type==="symbol-table"||a){const M=e.infos.map(P=>this._renderLegendForElementInfo(P,i,r,a,e.legendType)).filter(P=>!!P);M.length&&(c=X("div",{class:qi.layerBody},M))}else e.type==="color-ramp"||e.type==="opacity-ramp"||e.type==="heatmap-ramp"||e.type==="stretch-ramp"?c=this._renderLegendForRamp(e,i.opacity):e.type==="relationship-ramp"?c=eVe(e,this.id,{opacity:i.opacity,effectList:r,ariaLabel:this.messages.previewRelationshipRampAriaLabel}):e.type==="pie-chart-ramp"?c=this._renderPieChartRamp(e):e.type==="univariate-above-and-below-ramp"?c=this._renderUnivariateAboveAndBelowRamp(e,i.opacity,r):e.type==="univariate-color-size-ramp"&&(c=this._renderUnivariateColorSizeRamp(e,i.opacity,r));if(!c)return null;const p=e.title;let _=null;if(typeof p=="string")_=p;else if(p){const M=_2(this.messages,p,s||o);_=$Ve(p,s||o)&&p.title?`${p.title} (${M})`:M}const x=n?qi.layerChildTable:qi.layerTable,S=_?X("div",{class:qi.layerCaption},_):null,C={[qi.layerTableSizeRamp]:a||!n};return X("div",{class:this.classes(x,C)},S,c)}_renderPieChartRamp(e){return X("div",{afterCreate:Tl,bind:e.preview})}_renderUnivariateAboveAndBelowRamp(e,i,r){var G;const{sizeRampElement:n,colorRampElement:s}=RVe(e,i);if(!n)return null;const o=(G=this.messages)==null?void 0:G.previewColorRampAriaLabel,a=kO(n,"above",!0),c=kO(n,"below",!0),p=12,_=FO(s,{width:p,height:a,rampAlignment:"vertical",opacity:i,type:"above",effectList:r,ariaLabel:o}),x=FO(s,{width:p,height:c,rampAlignment:"vertical",opacity:i,type:"below",effectList:r,ariaLabel:o}),S=UV(n),C=n.infos.map(Y=>Y.label),M=C.map((Y,Q)=>Q===0?X("div",{class:Y?_?qi.univariateAboveAndBelowLabel:qi.rampLabel:void 0,key:Q},Y):Q===2?X("div",null):null),P=C.length-1,$=Math.floor(C.length/2),F=C.map((Y,Q)=>Q===$||Q===P?X("div",{class:Y?_?qi.univariateAboveAndBelowLabel:qi.rampLabel:void 0,key:Q},Y):null),z={display:"table-cell",verticalAlign:"middle"},k={marginTop:`${S}px`},U={height:`${a}px`},j={height:`${c}px`};return X("div",{key:"univariate-above-and-below-ramp-preview",styles:_xe},X("div",{class:qi.layerBody},n.infos.map((Y,Q)=>X("div",{class:this.classes(qi.layerRow,qi.sizeRamp)},X("div",{afterCreate:Tl,bind:Y.preview,class:qi.symbol,styles:z}),_||Q%2!=0?null:X("div",{class:qi.layerInfo},C[Q])))),_?X("div",{key:"color-ramp-preview",styles:k},X("div",{styles:RX},X("div",{styles:aA},X("div",{afterCreate:Tl,bind:_,class:qi.rampContainer})),X("div",{styles:aA},X("div",{class:qi.rampLabelsContainer,styles:U},M))),X("div",{styles:RX},X("div",{styles:aA},X("div",{afterCreate:Tl,bind:x,class:qi.rampContainer})),X("div",{styles:aA},X("div",{class:qi.rampLabelsContainer,styles:j},F)))):null)}_renderUnivariateColorSizeRamp(e,i,r){var P;const{sizeRampElement:n,colorRampElement:s}=IVe(e);if(!n)return null;const o=UV(n),a=12,c=kO(n,"full",!1),p=FO(s,{width:a,height:c,rampAlignment:"vertical",opacity:i,type:"full",effectList:r,ariaLabel:(P=this.messages)==null?void 0:P.previewColorRampAriaLabel}),_=n.infos.length-1,x=n.infos.map(($,F)=>F===0||F===_?X("div",{class:$.label?s?qi.univariateAboveAndBelowLabel:qi.rampLabel:void 0,key:F},$.label):null),S={display:"table-cell",verticalAlign:"middle"},C={marginTop:`${o}px`},M={height:`${c}px`};return X("div",{key:"univariate-above-and-below-ramp-preview",styles:_xe},X("div",{class:qi.layerBody},n.infos.map($=>X("div",{class:this.classes(qi.layerRow,qi.sizeRamp)},X("div",{afterCreate:Tl,bind:$.preview,class:qi.symbol,styles:S})))),X("div",{key:"color-ramp-preview",styles:C},X("div",{styles:RX},X("div",{styles:aA},X("div",{afterCreate:Tl,bind:p,class:qi.rampContainer})),X("div",{styles:aA},X("div",{class:qi.rampLabelsContainer,styles:M},x)))))}_renderLegendForRamp(e,i){const r=e.infos,n=e.type==="opacity-ramp",s=e.type==="heatmap-ramp",o=e.type==="stretch-ramp",a=e.preview,c=n?qi.opacityRamp:"";a.className=`${qi.colorRamp} ${c}`,i!=null&&(a.style.opacity=i.toString());const p=r.map(S=>X("div",{class:S.label?qi.rampLabel:void 0},s?this.messages[S.label]||S.label:o?DVe(S,this.messages):S.label)),_={width:`${wUt}px`},x={height:a.style.height};return X("div",{class:qi.layerRow},X("div",{class:qi.symbolContainer,styles:_},X("div",{afterCreate:Tl,bind:a,class:qi.rampContainer})),X("div",{class:qi.layerInfo},X("div",{class:qi.rampLabelsContainer,styles:x},p)))}_renderLegendForElementInfo(e,i,r,n,s){if(e.type)return this._renderLegendForElement(e,i,r,!0);let o=null;const a=LVe(i,s);if(e.preview?o=X("div",{afterCreate:Tl,bind:e.preview,class:qi.symbol}):e.src&&(o=this._renderImage(e,i,a)),!o)return null;const c={[qi.imageryLayerInfoStretched]:a},p={[qi.imageryLayerInfoStretched]:a,[qi.sizeRamp]:!a&&n};return X("div",{class:qi.layerRow},X("div",{class:this.classes(qi.symbolContainer,p)},o),X("div",{class:this.classes(qi.layerInfo,c)},_2(this.messages,e.label,!1)||""))}_renderImage(e,i,r){const{label:n,src:s,opacity:o}=e,a={[qi.imageryLayerStretchedImage]:r,[qi.symbol]:!r},c={opacity:`${o??i.opacity}`};return X("img",{alt:_2(this.messages,n,!1),"aria-label":_2(this.messages,n,!1),border:0,class:this.classes(a),height:e.height,src:s,styles:c,width:e.width})}};y([w()],yS.prototype,"activeLayerInfos",void 0),y([w()],yS.prototype,"headingLevel",void 0),y([w(),Gr("esri/widgets/Legend/t9n/Legend")],yS.prototype,"messages",void 0),y([w({readOnly:!0})],yS.prototype,"type",void 0),yS=y([Z("esri.widgets.Legend.styles.Classic")],yS);const lA=yS,bxe={base:"esri-legend",widgetIcon:oi.layerList};let vl=class extends hn{constructor(e,i){super(e,i),this.headingLevel=3,this.iconClass=bxe.widgetIcon,this.icon=null,this.messages=null,this.style=new lA,this.viewModel=new lUt}initialize(){this.addHandles([Jr(()=>this.view,"resize",()=>this.scheduleRender()),Jr(()=>this.activeLayerInfos,"change",()=>this._refreshActiveLayerInfos(this.activeLayerInfos)),_e(()=>this.headingLevel,e=>{const{style:i}=this;i&&(i.headingLevel=e)}),_e(()=>this.style,(e,i)=>{i&&e!==i&&i.destroy(),e&&(e.activeLayerInfos=this.activeLayerInfos,e.type==="card"&&(e.view=this.view),e.headingLevel=this.headingLevel)},Qt)])}get activeLayerInfos(){return this.viewModel.activeLayerInfos}set activeLayerInfos(e){this.viewModel.activeLayerInfos=e}get basemapLegendVisible(){return this.viewModel.basemapLegendVisible}set basemapLegendVisible(e){this.viewModel.basemapLegendVisible=e}get groundLegendVisible(){return this.viewModel.groundLegendVisible}set groundLegendVisible(e){this.viewModel.groundLegendVisible=e}get hideLayersNotInCurrentView(){return this.viewModel.hideLayersNotInCurrentView}set hideLayersNotInCurrentView(e){this.viewModel.hideLayersNotInCurrentView=e}get keepCacheOnDestroy(){return this.viewModel.keepCacheOnDestroy}set keepCacheOnDestroy(e){this.viewModel.keepCacheOnDestroy=e}get respectLayerVisibility(){return this.viewModel.respectLayerVisibility}set respectLayerVisibility(e){this.viewModel.respectLayerVisibility=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}castStyle(e){if(e instanceof PX||e instanceof lA)return e;if(typeof e=="string")return e==="card"?new PX:new lA;if(e&&typeof e.type=="string"){const i={...e};return delete i.type,new(e.type==="card"?PX:lA)(i)}return new lA}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){return X("div",{class:this.classes(bxe.base,it.widget,this.style instanceof lA?it.panel:null)},this.style.render())}_refreshActiveLayerInfos(e){e.forEach(i=>{this.removeHandles(`version_${i.layer.uid}`),this._renderOnActiveLayerInfoChange(i)}),this.scheduleRender()}_renderOnActiveLayerInfoChange(e){const i=_e(()=>e.version,()=>this.scheduleRender());this.addHandles(i,`version_${e.layer.uid}`);const r=Jr(()=>e.children,"change",()=>e.children.forEach(n=>this._renderOnActiveLayerInfoChange(n)),Qt);this.addHandles(r,`version_${e.layer.uid}`),e.children.forEach(n=>this._renderOnActiveLayerInfoChange(n))}};y([w()],vl.prototype,"activeLayerInfos",null),y([w()],vl.prototype,"basemapLegendVisible",null),y([w()],vl.prototype,"groundLegendVisible",null),y([w()],vl.prototype,"headingLevel",void 0),y([w()],vl.prototype,"hideLayersNotInCurrentView",null),y([w()],vl.prototype,"keepCacheOnDestroy",null),y([w()],vl.prototype,"respectLayerVisibility",null),y([w()],vl.prototype,"iconClass",void 0),y([w()],vl.prototype,"icon",void 0),y([w()],vl.prototype,"label",null),y([w()],vl.prototype,"layerInfos",null),y([w(),Gr("esri/widgets/Legend/t9n/Legend")],vl.prototype,"messages",void 0),y([w()],vl.prototype,"style",void 0),y([Ci("style")],vl.prototype,"castStyle",null),y([w()],vl.prototype,"view",null),y([w()],vl.prototype,"viewModel",void 0),vl=y([Z("esri.widgets.Legend")],vl);const NVe=vl,xUt=Object.freeze(Object.defineProperty({__proto__:null,default:NVe},Symbol.toStringTag,{value:"Module"})),FVe=(t,e,i)=>new NVe({view:t,layerInfos:[{layer:e}],container:i}),kVe=()=>{const t=document.createElement("div");return t.classList.add("esri-widget"),t},SUt=["be99602fc02d448eb859a0b426c0d5b6","b6517d264b8f467fa5b14c382dfdf87a","c5773442e91c48c392f28af6600169d0","1bc7e98137fe44129dd6653bef1920d0","287be80ff31d4c8babc48b2f959214f5","4ee7ecad357844bba5b95001de39f1e3","e5c6a086a5ae4d1991d4ca35733fe0ed"],TUt=t=>new LUe({view:t,container:"layers-container",listItemCreatedFunction:async e=>{const i=e.item;await i.layer.when();const[r,n]=jUe(),s=kVe();FVe(t,i.layer,s),r.append(n,s),(i.title==="Kataster"||i.title==="Kitsendused"||i.title==="Kitsendusi põhjustavad objektid"||i.title==="Geoloogia WMS")&&(i.hidden=!0),(i.layer.type!=="group"||i.title==="Taimkate analüütiline"||i.title==="Taimkate realistlik")&&(i.panel={content:r,className:"esri-icon-legend",open:!1,title:"Legend and layer opacity"}),n.addEventListener("calciteSliderInput",()=>{const a=n.value/100;i.layer.opacity=a}),i.layer.type!=="group"&&(i.actionsSections=[[{title:"Layer information",className:"esri-icon-description",id:"information"}]]),["Nõmme","Pärnu","Tallinn","Tartu","Kuressaare","Kohtuhoone tekstuuriga (Tallinn)"].includes(i.title)&&i.actionsSections.items[0].push({title:"Zoom to extent",className:"esri-icon-zoom-out-fixed",id:"zoomTo"})}}),EUt=t=>new LUe({view:t,container:"wms-layers-container",listItemCreatedFunction:async e=>{const i=e.item;await i.layer.when();const[r,n]=jUe(),s=kVe();FVe(t,i.layer,s),r.append(n,s),i.title!=="Kataster"&&i.title!=="Kitsendused"&&i.title!=="Kitsendusi põhjustavad objektid"&&i.title!=="Geoloogia WMS"&&(i.hidden=!0),i.layer.type!=="group"&&(i.panel={content:r,className:"esri-icon-legend",open:!1,title:"Legend and layer opacity"}),n.addEventListener("calciteSliderInput",()=>{const o=n.value/100;i.layer.opacity=o}),i.title!=="Geoloogia WMS"&&(i.actionsSections=[[{title:"Layer information",className:"esri-icon-description",id:"information"}]])}}),CUt=t=>new tkt({view:t,container:"basemaps-container",icon:"layer-basemap",source:SUt.map(e=>new $y({portalItem:{id:e}}))}),AUt=(t,e)=>{t.watch("activeBasemap",()=>{const i=t.activeBasemap.title==="Ortofoto";e.watch("zoom",()=>{e.map.layers.forEach(r=>{r.title==="Ortofoto WMS"&&(r.visible=i&&e.zoom>=12.5)})})})},wxe=(t,e)=>{t.on("trigger-action",i=>{const r=i.item.layer,n=i.action.id;n==="information"&&window.open(r.url),n==="zoomTo"&&e.goTo(r.fullExtent.extent)})};function MUt(t,e){const i=zVe(e);return[t[0].toFixed(i),t[1].toFixed(i)]}function zVe(t){return t>=500?6:t<500&&t>=50?7:t<50&&t>=5?8:9}function OUt(t,e){const i=t.includes(",")?",":" ",[r,n,s]=t.split(i).map(a=>{const c=a.trim();return c?Number(c):null});if(!VV(r)||!VV(n))return null;const o=new mt({x:r,y:n,spatialReference:e||rt.WGS84});return s&&(o.z=s,o.hasZ=!0),o}function VV(t){return typeof t=="number"&&isFinite(t)}function $re(t){return!!t&&VV(t.x)&&VV(t.y)}function xxe(t,e){if(t.spatialReference.isGeographic&&e){const[i,r]=MUt([t.x,t.y],e);return`${i}, ${r}`}return`${t.x.toFixed(3)}, ${t.y.toFixed(3)}`}const PUt=["dd","dms","ddm","mgrs","usng","utm"];function RUt(t){return PUt.includes(t)}const IX={ar:[".",","],bg:[","," "],bs:[",","."],ca:[",","."],cs:[","," "],da:[",","."],de:[",","."],"de-ch":[".","’"],el:[",","."],en:[".",","],"en-au":[".",","],es:[",","."],"es-mx":[".",","],et:[","," "],fi:[","," "],fr:[","," "],"fr-ch":[","," "],he:[".",","],hi:[".",",","#,##,##0.###"],hr:[",","."],hu:[","," "],id:[",","."],it:[",","."],"it-ch":[".","’"],ja:[".",","],ko:[".",","],lt:[","," "],lv:[","," "],mk:[",","."],nb:[","," "],nl:[",","."],pl:[","," "],pt:[",","."],"pt-pt":[","," "],ro:[",","."],ru:[","," "],sk:[","," "],sl:[",","."],sr:[",","."],sv:[","," "],th:[".",","],tr:[",","."],uk:[","," "],vi:[",","."],zh:[".",","]};function ZG(t=ma()){let e=(t=t.toLowerCase())in IX;if(!e){const s=t.split("-");s.length>1&&s[0]in IX&&(t=s[0],e=!0),e||(t="en")}const[i,r,n="#,##0.###"]=IX[t];return{decimal:i,group:r,pattern:n}}function IUt(t,e){const i=ZG((e={...e}).locale);e.customs=i;const r=e.pattern||i.pattern;return isNaN(t)||Math.abs(t)===1/0?null:$Ut(t,r,e)}const UVe=/[#0,]*[#0](?:\.0*#*)?/;function $Ut(t,e,i){const r=(i=i||{}).customs.group,n=i.customs.decimal,s=e.split(";"),o=s[0];if((e=s[t<0?1:0]||"-"+o).includes("%"))t*=100;else if(e.includes("‰"))t*=1e3;else{if(e.includes("¤"))throw new Error("currency notation not supported");if(e.includes("E"))throw new Error("exponential notation not supported")}const a=UVe,c=o.match(a);if(!c)throw new Error("unable to find a number expression in pattern: "+e);return i.fractional===!1&&(i.places=0),e.replace(a,LUt(t,c[0],{decimal:n,group:r,places:i.places,round:i.round}))}function LUt(t,e,i){(i=i||{}).places===!0&&(i.places=0),i.places===1/0&&(i.places=6);const r=e.split("."),n=typeof i.places=="string"&&i.places.indexOf(",");let s=i.places;n?s=i.places.substring(n+1):+s>=0||(s=(r[1]||[]).length),i.round<0||(t=Number(t.toFixed(Number(s))));const o=String(Math.abs(t)).split("."),a=o[1]||"";if(r[1]||i.places){n&&(i.places=i.places.substring(0,n));const M=i.places!==void 0?i.places:r[1]&&r[1].lastIndexOf("0")+1;+M>a.length&&(o[1]=a.padEnd(Number(M),"0")),+so[0].length&&(o[0]=o[0].padStart(p,"0")),c.includes("#")||(o[0]=o[0].substr(o[0].length-p)));let _,x,S=r[0].lastIndexOf(",");if(S!==-1){_=r[0].length-S-1;const M=r[0].substr(0,S);S=M.lastIndexOf(","),S!==-1&&(x=M.length-S-1)}const C=[];for(let M=o[0];M;){const P=M.length-_;C.push(P>0?M.substr(P):M),M=P>0?M.slice(0,P):"",x&&(_=x,x=void 0)}return o[0]=C.reverse().join(i.group||","),o.join(i.decimal||".")}function DUt(t){const e=ZG((t=t||{}).locale),i=t.pattern||e.pattern,r=e.group,n=e.decimal;let s=1;if(i.includes("%"))s/=100;else if(i.includes("‰"))s/=1e3;else if(i.includes("¤"))throw new Error("currency notation not supported");const o=i.split(";");return o.length===1&&o.push("-"+o[0]),{regexp:m9(o,c=>(c="(?:"+fne(c,".")+")").replace(UVe,p=>{const _={signed:!1,separator:t.strict?r:[r,""],fractional:t.fractional,decimal:n,exponent:!1},x=p.split(".");let S=t.places;x.length===1&&s!==1&&(x[1]="###"),x.length===1||S===0?_.fractional=!1:(S===void 0&&(S=t.pattern?x[1].lastIndexOf("0")+1:1/0),S&&t.fractional==null&&(_.fractional=!0),!t.places&&+S1&&(_.groupSize=C.pop().length,C.length>1&&(_.groupSize2=C.pop().length)),"("+FUt(_)+")"}),!0).replaceAll(/[\xa0 ]/g,"[\\s\\xa0]"),group:r,decimal:n,factor:s}}function NUt(t,e){const i=DUt(e),r=new RegExp("^"+i.regexp+"$").exec(t);if(!r)return NaN;let n=r[1];if(!r[1]){if(!r[2])return NaN;n=r[2],i.factor*=-1}return n=n.replaceAll(new RegExp("["+i.group+"\\s\\xa0]","g"),"").replace(i.decimal,"."),Number(n)*i.factor}function FUt(t){"places"in(t=t||{})||(t.places=1/0),typeof t.decimal!="string"&&(t.decimal="."),"fractional"in t&&!String(t.places).startsWith("0")||(t.fractional=[!0,!1]),"exponent"in t||(t.exponent=[!0,!1]),"eSigned"in t||(t.eSigned=[!0,!1]);const e=Sxe(t),i=m9(t.fractional,n=>{let s="";return n&&t.places!==0&&(s="\\"+t.decimal,t.places===1/0?s="(?:"+s+"\\d+)?":s+="\\d{"+t.places+"}"),s},!0);let r=e+i;return i&&(r="(?:(?:"+r+")|(?:"+i+"))"),r+m9(t.exponent,n=>n?"([eE]"+Sxe({signed:t.eSigned})+")":"")}function Sxe(t){return"signed"in(t=t||{})||(t.signed=[!0,!1]),"separator"in t?"groupSize"in t||(t.groupSize=3):t.separator="",m9(t.signed,e=>e?"[-+]":"",!0)+m9(t.separator,e=>{if(!e)return"(?:\\d+)";(e=fne(e))===" "?e="\\s":e===" "&&(e="\\s\\xa0");const i=t.groupSize,r=t.groupSize2;if(r){const n="(?:0|[1-9]\\d{0,"+(r-1)+"}(?:["+e+"]\\d{"+r+"})*["+e+"]\\d{"+i+"})";return i-r>0?"(?:"+n+"|(?:0|[1-9]\\d{0,"+(i-1)+"}))":n}return"(?:0|[1-9]\\d{0,"+(i-1)+"}(?:["+e+"]\\d{"+i+"})*)"},!0)}const m9=(t,e,i)=>{if(!(t instanceof Array))return e(t);const r=[];for(let n=0;n"("+(e?"?:":"")+t+")";function zUt(t,e){const i=[];t=(t=(t=t.replaceAll(/[\u00B0\u00BA]/g,"^")).replaceAll("′","'")).replaceAll("″",'"');const r=wx(e);return pT.dmsToGeog(r,1,[t],i)?new mt(i[0][0],i[0][1],e||rt.WGS84):null}function UUt(t,e,i){const r=[],n=VVe(i);if(n===-1)return console.warn(`invalid conversionMode: ${i}`),null;const s=wx(e);return zh.mgrsToGeogExtended(s,1,[t],n,r)?new mt(r[0][0],r[0][1],e||rt.WGS84):null}function VUt(t,e){const i=[];!e&&/\(.+27/.test(t)&&(e=rt.GCS_NAD_1927);const r=wx(e);return mL.usngToGeog(r,1,[t],i)?new mt(i[0][0],i[0][1],e||rt.WGS84):null}function BUt(t,e,i){const r=[],n=BVe(i);if(n===-1)return console.warn(`invalid conversionMode: ${i}`),null;const s=wx(e);return v_.utmToGeog(s,1,[t],n,r)?new mt(r[0][0],r[0][1],e||rt.WGS84):null}function jUt(t,e,i=0){const r=[[t.x,t.y]],n=[],s=wx(t.spatialReference);let o=0;switch(e){case"dd":o=pT.geogToDd(s,1,r,i,n);break;case"ddm":o=pT.geogToDdm(s,1,r,i,n);break;case"dms":o=pT.geogToDms(s,1,r,i,n);break;default:return console.warn(`invalid format: ${e}`),null}return o?n[0]:null}function GUt(t,e,i=0,r=!1){const n=[[t.x,t.y]],s=[],o=wx(t.spatialReference);let a=VVe(e);return a===-1?(console.warn(`invalid conversionMode: ${e}`),null):(r&&(a|=zh.PE_MGRS_ADD_SPACES),zh.geogToMgrsExtended(o,1,n,i,!1,a,s)?s[0]:null)}function HUt(t,e=0,i=!1){const r=[[t.x,t.y]],n=[],s=wx(t.spatialReference);return mL.geogToUsng(s,1,r,e,!1,i,n)?n[0]:null}function qUt(t,e,i=!1){const r=[[t.x,t.y]],n=[],s=wx(t.spatialReference);let o=BVe(e);return o===-1?(console.warn(`invalid conversionMode: ${e}`),null):(i&&(o|=v_.PE_UTM_OPTS_ADD_SPACES),v_.geogToUtm(s,1,r,o,n)?n[0]:null)}function wx(t){let e=null;if(t||(t=rt.WGS84),t.wkid){if(e=fL.geogcs(t.wkid),!e)throw new se("coordinate-formatter:invalid-spatial-reference","wkid is not valid")}else{if(!t.wkt2&&!t.wkt)throw new se("coordinate-formatter:invalid-spatial-reference","wkid and wkt are missing");if(e=fL.fromString(io.PE_TYPE_GEOGCS,t.wkt2||t.wkt),!e)throw new se("coordinate-formatter:invalid-spatial-reference","wkt is not valid")}return e}function VVe(t){let e=-1;switch(t){case"automatic":e=zh.PE_MGRS_STYLE_AUTO;break;case"new-180-in-zone-01":e=zh.PE_MGRS_STYLE_NEW|zh.PE_MGRS_180_ZONE_1_PLUS;break;case"new-180-in-zone-60":e=zh.PE_MGRS_STYLE_NEW;break;case"old-180-in-zone-01":e=zh.PE_MGRS_STYLE_OLD|zh.PE_MGRS_180_ZONE_1_PLUS;break;case"old-180-in-zone-60":e=zh.PE_MGRS_STYLE_OLD}return e}function BVe(t){let e=-1;switch(t){case"latitude-band-indicators":e=v_.PE_UTM_OPTS_NONE;break;case"north-south-indicators":e=v_.PE_UTM_OPTS_NS}return e}let Nu=class extends ze{constructor(e){super(e),this.conversionInfo=null,this.coordinateSegments=null,this._currentPattern=void 0,this.defaultPattern=null,this.name=null,this.viewModel=null}get currentPattern(){return(this._currentPattern||this.defaultPattern)??""}set currentPattern(e){this._currentPattern=e}get label(){return this.name??""}set label(e){this._overrideIfSome("label",e)}get hasDisplayProperties(){return!(!this.defaultPattern||!this.coordinateSegments)}get spatialReference(){var e;return this.name==="basemap"?this._viewSpatialReference:((e=this.conversionInfo)==null?void 0:e.spatialReference)??rt.WGS84}set spatialReference(e){this._overrideIfSome("spatialReference",e)}get _viewSpatialReference(){var e,i;return((i=(e=this.viewModel)==null?void 0:e.view)==null?void 0:i.spatialReference)??rt.WGS84}get _additionalCharactersPattern(){const e=this.coordinateSegments;if(!e)return null;const i=e.map(n=>n.alias),r=this.currentPattern.replaceAll(new RegExp(`["nsew${i.join()}]`,"gi"),"").replaceAll(" ","");return new RegExp(`[${r}]`,"g")}get test(){return{additionalCharactersPattern:this._additionalCharactersPattern}}async convert(e){var n;if(!$re(e))throw new se("format:invalid-point","Could not convert invalid point.",{point:e});const i=(n=this.conversionInfo)==null?void 0:n.convert;if(i)return Promise.resolve().then(()=>i(e));const r=await this._project(e,this.spatialReference);return{location:r,coordinate:await this._getCoordinate(r)}}getConversionStrategy(){var i,r;const e=this._viewSpatialReference;return(i=this.conversionInfo)!=null&&i.convert||(r=this.viewModel)!=null&&r.formatterAvailable||this.name==="xy"&&(e.isWebMercator||e.isWGS84)||this.name==="basemap"?"client":"server"}getDisplayCoordinate(e){if(!e)return null;if(!this.coordinateSegments||!this.currentPattern)return e;let i=this.currentPattern;const r=this._getSegmentMatches(e,!1);for(let n=this.coordinateSegments.length-1;n>=0;n--){const s=this.coordinateSegments[n];i=i.replace(s.alias,r[n])}return i}parseUserInput(e){const{defaultPattern:i,_additionalCharactersPattern:r,coordinateSegments:n}=this;if(!i||!r)return"";let s=i.replace(r,"");e=e.replace(r,"");const o=this._getSegmentMatches(e,!0);if(n)for(let a=n.length-1;a>=0;a--){const c=n[a];s=s.replace(c.alias,o[a])}return s}_getSegmentMatches(e,i){const r=new Array,{coordinateSegments:n}=this;if(!n)return r;for(let s=0;sF!=null&&Object.keys(S).includes(F),P=new RegExp(`\\d{1,2}[\\.|\\${a}]?\\d*`,"i"),$=new RegExp(`\\d{1,3}[\\.|\\${a}]?\\d*`,"i");e.forEach(F=>{const{name:z}=F;if(z==="dd"?F.coordinateSegments=[{alias:"Y",description:"degrees latitude",searchPattern:P,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.north,description:"north/south indicator",searchPattern:_,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[cA[k]]}},{alias:"X",description:"degrees longitude",searchPattern:$,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.east,description:"east/west indicator",searchPattern:x,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[cA[k]]}}]:z==="ddm"?F.coordinateSegments=[{alias:"Y",description:"degrees latitude",searchPattern:P,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"A",description:"minutes latitude",searchPattern:P,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.north,description:"north/south indicator",searchPattern:_,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[cA[k]]}},{alias:"X",description:"degrees longitude",searchPattern:$,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"B",description:"minutes longitude",searchPattern:P,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.east,description:"east/west indicator",searchPattern:x,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[cA[k]]}}]:z==="dms"?F.coordinateSegments=[{alias:"Y",description:"degrees latitude",searchPattern:P,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"A",description:"minutes latitude",searchPattern:P,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"B",description:"seconds latitude",searchPattern:P,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.north,description:"north/south indicator",searchPattern:_,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[cA[k]]}},{alias:"X",description:"degrees longitude",searchPattern:$,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"C",description:"minutes longitude",searchPattern:P,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"D",description:"seconds longitude",searchPattern:P,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:t.abbreviatedDirections.east,description:"east/west indicator",searchPattern:x,substitution:{input:k=>c[k],output:k=>t.abbreviatedDirections[cA[k]]}}]:(F.name==="xy"||F.name==="basemap")&&(F.coordinateSegments=[{alias:"X",description:"easting",searchPattern:p,substitution:{input:k=>is(k),output:k=>ts(k)}},{alias:"Y",description:"northing",searchPattern:p,substitution:{input:k=>is(k),output:k=>ts(k)}}]),M(z)){const k=i?C[z]:S[z];F.defaultPattern=k,F.currentPattern=k}})}function YUt(){const t=new RegExp("N|S","i"),e=new RegExp("E|W","i");return[new mv({name:"basemap",coordinateSegments:[{alias:"X",description:"easting",searchPattern:K8,substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"Y",description:"northing",searchPattern:K8,substitution:{input:i=>is(i),output:i=>ts(i)}}],defaultPattern:"X, Y",viewModel:null}),new mv({name:"dd",coordinateSegments:[{alias:"Y",description:"degrees latitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\${vS}]?\\d*(?=\\D*?[N|S])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"N",description:"north/south indicator",searchPattern:t},{alias:"X",description:"degrees longitude",searchPattern:new RegExp(`\\d{1,3}[\\.|\\${vS}]?\\d*(?=\\D*?[E|W|])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"E",description:"east/west indicator",searchPattern:e}],defaultPattern:`Y${No}N, X${No}E`,viewModel:null}),new mv({name:"ddm",coordinateSegments:[{alias:"Y",description:"degrees latitude",searchPattern:new RegExp("\\d{1,2}(?=.*?\\s+.*?[N|S])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"A",description:"minutes latitude",searchPattern:new RegExp(`\\d{1,2}[\\.\\${vS}]?\\d*(?=.*?[N|S])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"N",description:"north/south indicator",searchPattern:t},{alias:"X",description:"degrees longitude",searchPattern:new RegExp("\\d{1,3}(?=\\D*?\\s+.*?[E|W])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"B",description:"minutes longitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\|${vS}]?\\d*(?=.*?[E|W])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"E",description:"east/west indicator",searchPattern:e}],defaultPattern:`Y${No} A'N, X${No} B'E`,viewModel:null}),new mv({name:"dms",coordinateSegments:[{alias:"Y",description:"degrees latitude",searchPattern:new RegExp("\\d{1,2}(?=.*?\\s+.*?[N|S])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"A",description:"minutes latitude",searchPattern:new RegExp("\\d{1,2}(?=.*?[N|S])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"B",description:"seconds latitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\${vS}]?\\d*(?=.*?[N|S])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"N",description:"north/south indicator",searchPattern:t},{alias:"X",description:"degrees longitude",searchPattern:new RegExp("\\d{1,3}(?=.*?\\s+.*?[E|W])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"C",description:"minutes longitude",searchPattern:new RegExp("\\d{1,2}(?=.*?[E|W])","i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"D",description:"seconds longitude",searchPattern:new RegExp(`\\d{1,2}[\\.|\\${vS}]?\\d*(?=.*?[E|W])`,"i"),substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"E",description:"east/west indicator",searchPattern:e}],defaultPattern:`Y${No} A' B"N, X${No} C' D"E`,viewModel:null}),new mv({name:"xy",coordinateSegments:[{alias:"X",description:"longitude",searchPattern:K8,substitution:{input:i=>is(i),output:i=>ts(i)}},{alias:"Y",description:"latitude",searchPattern:K8,substitution:{input:i=>is(i),output:i=>ts(i)}}],defaultPattern:`X${No}, Y${No}`,viewModel:null}),new mv({name:"mgrs",coordinateSegments:[{alias:"Z",description:"grid zone",searchPattern:/\d{1,2}\w|[abyz]/i},{alias:"S",description:"grid square",searchPattern:/\w{2}/},{alias:"X",description:"easting",searchPattern:/^\d{5}(?=.?\d{5}$)|^\d{4}(?=.?\d{4}$)|^\d{3}(?=.?\d{3}$)|^\d{2}(?=.?\d{2}$)|^\d(?=.?\d$)/},{alias:"Y",description:"northing",searchPattern:/^\d{1,5}/}],defaultPattern:"Z S X Y",viewModel:null}),new mv({name:"usng",coordinateSegments:[{alias:"Z",description:"grid zone",searchPattern:/\d{1,2}\w|[abyz]/i},{alias:"S",description:"grid square",searchPattern:/\w{2}/},{alias:"X",description:"easting",searchPattern:/^\d{5}(?=.?\d{5}$)|^\d{4}(?=.?\d{4}$)|^\d{3}(?=.?\d{3}$)|^\d{2}(?=.?\d{2}$)|^\d(?=.?\d$)/},{alias:"Y",description:"northing",searchPattern:/^\d{1,5}/}],defaultPattern:"Z S X Y",viewModel:null}),new mv({name:"utm",coordinateSegments:[{alias:"Z",description:"zone number",searchPattern:/\d{1,2}|[abyz]/i},{alias:"B",description:"latitude band",searchPattern:/^\D/},{alias:"X",description:"easting",searchPattern:/\d{1,7}(?=\s*\d{7}$)/},{alias:"Y",description:"northing",searchPattern:/\d{1,7}/}],defaultPattern:"ZB X Y",viewModel:null})]}function ts(t){const e=t.match(WUt),i=e?e[0]:"",r=t.includes(".")?t.split(".")[1].length:0;return i+IUt(Number(t),{pattern:"###0.###",places:r,round:-1})}function is(t){return NUt(t)}const Q8={default:"default",crosshair:"crosshair"},XUt=new mt([0,0,500]),ZUt="xy",JUt=["mgrs","utm","usng","dd","dms","ddm"],Exe="esri__coordinateConversionWidgetState",wg={conversions:"conversions",formats:"formats",view:"view",viewChange:"view-change"},KUt="esri/images/search/search-symbol-32.png";let uc=class extends HG(Dn.EventedAccessor){constructor(e){super(e),this._conversionPromise=null,this._locationGraphic=null,this._pointerCount=0,this.conversions=new tt,this.formats=new tt,this.formatterAvailable=!1,this.messages=null,this.filteredFormats=new tt,this.locationSymbol=new x5({url:Wr(KUt),width:24,height:24}),this.storageEnabled=!0,this.storageType="session",this.view=null,this._saveWidgetState=this._saveWidgetState.bind(this),this._handleFormatChange=this._handleFormatChange.bind(this),this._handleConversionChange=this._handleConversionChange.bind(this),this._handleViewChange=this._handleViewChange.bind(this),this._onClick=this._onClick.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this)}initialize(){const e=async()=>this.messages=await gE("esri/widgets/CoordinateConversion/t9n/CoordinateConversion");this.formats.addMany(YUt()),e().then(()=>{if(!this.destroyed&&(Txe(this.messages,this.formats),this.storageEnabled&&this._loadWidgetState(),this.formats.forEach(i=>{i.viewModel=this,this.addHandles(_e(()=>i.currentPattern,this._saveWidgetState),i.name??"unnamed-format")}),this.addHandles(this.conversions.on("change",this._handleConversionChange),wg.conversions),this.addHandles(this.formats.on("change",this._handleFormatChange),wg.formats),this.addHandles(fE(()=>{e().then(()=>{Txe(this.messages,this.formats)})})),S_().then(()=>{this.formatterAvailable=!0}).catch(i=>{Ce.getLogger(this).error(new se("coordinate-conversion:projection-load-failed","Failed to load the projection module.",{error:i})),this.formatterAvailable=!1,this._filterFormatsAndConversions()}).then(()=>this.addHandles(_e(()=>this.view,this._handleViewChange,Qt),wg.viewChange)),this.conversions.length===0)){const i=this.formats.find(r=>r.name===ZUt)||this.formats.at(0);this.conversions.add(new YS({format:i}))}})}destroy(){this.removeHandles(),this._cleanUpView(this.view),this.view=null}castConversions(e){return this._castToConversions(e)}set currentLocation(e){this._set("currentLocation",e),this._updateConversions()}get currentLocation(){return this._get("currentLocation")||null}set mode(e){switch(e){case"capture":this.currentLocation=null,this._startCaptureMode(),this._set("mode",e);break;case"live":this._startLiveMode(),this._set("mode",e)}}get mode(){return this._get("mode")||"live"}get state(){const{messages:e,view:i}=this,r=i==null?void 0:i.ready;return e?r?"ready":i?"loading":"disabled":"disabled"}get storage(){const{storageType:e}=this;return e==="session"?sessionStorage:localStorage}get waitingForConversions(){return this._conversionPromise!=null}setLocation(e){var r,n;if(this._locationGraphic&&((r=this.view)==null||r.graphics.remove(this._locationGraphic)),!e)return;const i=e.clone();i.hasZ&&(i.z=void 0),this._locationGraphic=new Ma({geometry:i,symbol:this.locationSymbol}),(n=this.view)==null||n.graphics.add(this._locationGraphic)}async convert(e,i){if(!$re(i))throw new se("coordinate-conversion:invalid-point","Invalid point cannot be converted.",{point:i});return Promise.resolve().then(()=>e.convert(i))}async goToLocation(e){var s,o,a;const{view:i}=this;if(!i)throw new se("coordinate-conversion:go-to-failed","no view");const r=i.type==="3d"?i.clippingArea:null,n=(o=(s=i.map)==null?void 0:s.basemap)==null?void 0:o.baseLayers;if(r||(n==null?void 0:n.length)>0){const c=r??((a=n.at(0))==null?void 0:a.fullExtent);if(c!=null&&!c.contains(e))throw new se("coordinate-conversion:go-to-failed","Point outside basemap extent.",{point:e})}return this.callGoTo({target:e})}pause(){this.currentLocation=null,this.removeHandles(wg.view),this.view&&(this.view.cursor=Q8.default,this._locationGraphic&&this.view.graphics.remove(this._locationGraphic))}async previewConversion(e,i=this.currentLocation||XUt){return(await Cxe(e,i)).displayCoordinate}resume(){this.mode==="capture"?this._startCaptureMode():this._startLiveMode()}reverseConvert(e,i){return i.reverseConvert(e)}async updateConversions(e,i){if((i==null?void 0:i.type)!=="point")throw this._clearConversions(this.conversions),new se("coordinate-conversion:invalid-input-point","Point is invalid, conversions cannot be updated.",{point:i});return this._convertMany(e,i)}_castToConversions(e){const i=new tt;return e.forEach(r=>{let n=null;if(r instanceof YS)n=r;else if(typeof r=="string"){const s=this.formats.find(o=>o.name===r);s&&(n=new YS({format:s}))}n&&i.add(n)}),i}_cleanUpView(e){e&&(this._locationGraphic&&e.graphics.remove(this._locationGraphic),this.removeHandles(wg.view),e.cursor=Q8.default)}_clearConversions(e){e.forEach(i=>{i.position={location:null,coordinate:null}})}async _convertMany(e,i){return Promise.all(e.map(r=>Cxe(r,i)))}_handleConversionChange(e){for(const i of e.added){const{format:r}=i;r&&(r.viewModel=this,this.currentLocation&&(this._set("waitingForConversions",!0),this.convert(r,this.currentLocation).then(n=>{i.position=n,this._set("waitingForConversions",!1)})))}this._saveWidgetState()}_handleFormatChange(e){e.added.forEach(i=>{this.addHandles(_e(()=>i.currentPattern,this._saveWidgetState),i.name??"unnamed-format"),i.viewModel=this}),e.removed.forEach(i=>{i.viewModel=null;const r=this.conversions.filter(n=>n.format===i);this.conversions.removeMany(r),i.name&&this.removeHandles(i.name)})}_loadWidgetState(){try{const e=JSON.parse(this.storage.getItem(Exe));e&&this._setWidgetState(e)}catch(e){Ce.getLogger(this).error(new se("coordinate-conversion:invalid-session-storage-json","Could not read from storage.",{error:e}))}}_startCaptureMode(){this.removeHandles(wg.view),this.view&&(this.view.cursor=Q8.crosshair,this.currentLocation&&this.setLocation(this.currentLocation),this.addHandles(this.view.on("click",this._onClick),wg.view))}_startLiveMode(){this._pointerCount=0,this.removeHandles(wg.view),this.view&&(this.view.cursor=Q8.default,this._locationGraphic&&this.view.graphics.remove(this._locationGraphic),this.addHandles([this.view.on("pointer-down",this._onPointerDown),this.view.on("pointer-up",this._onPointerUp),this.view.on("pointer-move",this._onPointerMove)],wg.view))}_handleViewChange(e,i){i&&i!==e&&this._cleanUpView(i),e&&(this.mode==="capture"?this._startCaptureMode():this._startLiveMode(),i&&this._filterFormatsAndConversions())}_onClick(e){var i;if(e.button===0){const r=(i=this.view)==null?void 0:i.toMap(e),n=r==null?void 0:r.normalize();this.setLocation(n),this.currentLocation=n}}_onPointerDown(e){var r;const{pointerType:i}=e;if(this._pointerCount++,(i==="touch"||i==="pen")&&this._pointerCount===1){const n=(r=this.view)==null?void 0:r.toMap(e);this.currentLocation=n==null?void 0:n.normalize()}}_onPointerMove(e){var r;const{pointerType:i}=e;if(i==="mouse"||this._pointerCount===1){const n=(r=this.view)==null?void 0:r.toMap(e);this.currentLocation=n==null?void 0:n.normalize()}}_onPointerUp(){this._pointerCount--}_setWidgetState(e){try{e.formats.forEach(i=>{const r=this.formats.find(n=>n.name===i.name);r&&e.locale===ma()&&i.currentPattern&&(r.currentPattern=i.currentPattern),r&&i.index>=0&&this.conversions.add(new YS({format:r}))})}catch(i){Ce.getLogger(this).warn(new se("coordinate-conversion:session-storage-read-error","Could not get widget state from stored JSON.",{error:i}))}}_saveWidgetState(){if(!this.storageEnabled)return;const e=this._toJSON();try{this.storage.setItem(Exe,JSON.stringify({formats:e,locale:ma()}))}catch(i){Ce.getLogger(this).error(new se("coordinate-conversion:local-storage-write-error","Could not write to localStorage.",{error:i}))}}async _updateConversions(){try{await this.updateConversions(this.conversions.toArray(),this.currentLocation)}catch{}}_toJSON(){return this.formats.filter(e=>{const i=e.name;return i==="xy"||i==="basemap"||RUt(i)}).map(e=>({name:e.name,currentPattern:e.currentPattern,defaultPattern:e.defaultPattern,index:this.conversions.findIndex(i=>i.format===e)})).sort((e,i)=>e.index-i.index).toArray()}_filterFormatsAndConversions(){const{formatterAvailable:e,conversions:i,formats:r}=this;e||this.addHandles(Oo(()=>{var n;return(n=this.view)==null?void 0:n.spatialReference},n=>{const s=n.isWebMercator||n.isWGS84,o=r.filter(p=>{const{name:_}=p;return!!QUt(_)||_==="xy"&&!s}),a=this.filteredFormats.filter(p=>p.name==="xy"&&s&&!this.formats.includes(p)),c=i.filter(p=>o.includes(p.format));r.removeMany(o),i.removeMany(c),this.filteredFormats.addMany(o.filter(p=>!this.filteredFormats.includes(p))),r.addMany(a)},{once:!0,initial:!0}),wg.view)}};async function Cxe(t,e){var i;try{t.position=await((i=t.format)==null?void 0:i.convert(e))}catch{t.position=null}return t}function QUt(t){return JUt.includes(t)}y([w()],uc.prototype,"conversions",void 0),y([Ci("conversions")],uc.prototype,"castConversions",null),y([w({type:mt})],uc.prototype,"currentLocation",null),y([w()],uc.prototype,"formats",void 0),y([w()],uc.prototype,"messages",void 0),y([w()],uc.prototype,"mode",null),y([w()],uc.prototype,"filteredFormats",void 0),y([w({readOnly:!0})],uc.prototype,"state",null),y([w()],uc.prototype,"locationSymbol",void 0),y([w({readOnly:!0,dependsOn:["storageType"]})],uc.prototype,"storage",null),y([w()],uc.prototype,"storageEnabled",void 0),y([w()],uc.prototype,"storageType",void 0),y([w({readOnly:!0})],uc.prototype,"waitingForConversions",null),y([w()],uc.prototype,"view",void 0),uc=y([Z("esri.widgets.CoordinateConversion.CoordinateConversionViewModel")],uc);const jVe=uc,Jn="esri-coordinate-conversion",Zi={base:Jn,captureMode:`${Jn}--capture-mode`,noBasemap:`${Jn}--no-basemap`,popup:`${Jn}__popup`,clipboardPopup:`${Jn}__clipboard-popup`,conversionList:`${Jn}__conversion-list`,conversionRow:`${Jn}__row`,coordDisplay:`${Jn}__display`,expanded:`${Jn}__conversions-view--expanded`,expandDown:`${Jn}__conversions-view--expand-down`,expandUp:`${Jn}__conversions-view--expand-up`,conversionsView:`${Jn}__conversions-view`,primarySelect:`${Jn}__select-primary`,rowSelect:`${Jn}__select-row`,toolDisplay:`${Jn}__tools`,modeToggle:`${Jn}__mode-toggle`,rowButton:`${Jn}__row-button`,backButton:`${Jn}__back-button`,convertButton:`${Jn}__button`,convertButtonSpan:`${Jn}__convert-button-span`,coordinateInput:`${Jn}__input-coordinate`,inputForm:`${Jn}__input-form`,inputFormGroup:`${Jn}__input-group`,rejectInput:`${Jn}__input-coordinate--rejected`,sectionHeading:`${Jn}__heading`,patternInput:`${Jn}__pattern-input`,settings:`${Jn}__settings`,settingsFormGroup:`${Jn}__settings-group`,settingsFormGroupHorizontal:`${Jn}__settings-group-horizontal`,previewCoordinate:`${Jn}__preview-coordinate`},Axe={settingsButton:!0,inputButton:!0,captureButton:!0,expandButton:!0},eVt=750,tVt=2500;let Ss=class extends hn{constructor(e,i){super(e,i),this._popupMessage=null,this._popupTimeoutId=void 0,this._clipboardPopupTimeoutId=void 0,this._coordinateInput=null,this._badInput=!1,this._goToEnabled=!1,this._conversionFormat=null,this._settingsFormat=null,this._previewConversion=null,this._expanded=!1,this._clipboardPopupVisible=!1,this._popupVisible=!1,this._settingsVisible=!1,this._inputVisible=!1,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.orientation="auto",this.viewModel=new jVe,this.visibleElements={...Axe}}get conversions(){return this.viewModel.conversions}set conversions(e){this.viewModel.conversions=e}get currentLocation(){return this.viewModel.currentLocation}set currentLocation(e){this.viewModel.currentLocation=e}get formats(){return this.viewModel.formats}set formats(e){this.viewModel.formats=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}set multipleConversions(e){e===!1&&(this._expanded=!1,this.conversions.splice(1,this.conversions.length-1)),this._set("multipleConversions",e)}get multipleConversions(){const e=this._get("multipleConversions");return typeof e!="boolean"||e}get locationSymbol(){return this.viewModel.locationSymbol}set locationSymbol(e){this.viewModel.locationSymbol=e}get storageEnabled(){return this.viewModel.storageEnabled}set storageEnabled(e){this.viewModel.storageEnabled=e}get storageType(){return this.viewModel.storageType}set storageType(e){this.viewModel.storageType=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...Axe,...e}}reverseConvert(e,i){return this.viewModel.reverseConvert(e,i)}render(){var c,p;const e=(c=this.viewModel)==null?void 0:c.state,i=e==="disabled"?X("div",{key:"esri-coordinate__no-basemap"},(p=this.messages)==null?void 0:p.noBasemap):null,r=!i&&this._inputVisible?this._renderInputForm():null,n=!i&&this._settingsVisible?this._renderSettings():null,s=i||r||n?null:this._renderConversionsView(),o=this._popupVisible?this._renderPopup():null,a={[Zi.captureMode]:this.mode==="capture",[it.disabled]:e==="loading",[Zi.noBasemap]:e==="disabled"};return X("div",{class:this.classes(Zi.base,it.widget,a)},o,i,s,n,r)}_addConversion(e){const i=e.target,r=e7(i.options[i.options.selectedIndex]),n=Mxe(i);if(r==null||n==null)return;const s=new YS({format:r});i.options.selectedIndex=0,n>=0?(this.conversions.removeAt(n),this.conversions.add(s,n)):this.conversions.add(s)}_findSettingsFormat(){return this._settingsFormat||this.conversions.reduceRight((e,i)=>{const r=i.format;return r!=null&&r.hasDisplayProperties?r:e},null)||this.formats.find(e=>e.hasDisplayProperties)}_hidePopup(){this._popupTimeoutId&&(clearTimeout(this._popupTimeoutId),this._popupTimeoutId=void 0),this._popupVisible=!1,this._popupMessage=null,this.scheduleRender()}_hideClipboardPopup(){this._clipboardPopupTimeoutId&&(clearTimeout(this._clipboardPopupTimeoutId),this._clipboardPopupTimeoutId=void 0),this._clipboardPopupVisible=!1,this.scheduleRender()}_onConvertComplete(){this._inputVisible=!1,this._coordinateInput.value=""}_onCopy(e){var r,n;const i=(r=iVt(e.currentTarget))==null?void 0:r.displayCoordinate;i!=null&&((n=e.clipboardData)==null||n.setData("text/plain",i),this._showClipboardPopup(),e.preventDefault())}_processUserInput(e){const i=Mf(e),r=this.viewModel;if(i!=="Enter"&&i)this._badInput&&(this._badInput=!1);else{const n=e7(this._coordinateInput);if(!n)return;const s=this._coordinateInput.value;this._reverseConvert(s,n).then(o=>{this.mode==="capture"?r.resume():this.mode="capture",this.currentLocation=o,r.setLocation(o),this._onConvertComplete()}).catch(o=>{var a;Ce.getLogger(this).error(o),this._showPopup((a=this.messages)==null?void 0:a.invalidCoordinate),this._badInput=!0})}}async _reverseConvert(e,i){const r=this.viewModel,n=await i.reverseConvert(e);return this._goToEnabled&&n&&r.goToLocation(n).catch(s=>{var o;Ce.getLogger(this).warn(s),this._showPopup((o=this.messages)==null?void 0:o.locationOffBasemap)}),n}_setInputFormat(e){const i=e.target,r=e7(i[i.options.selectedIndex]);r!=null&&(this._conversionFormat=r)}_setPreviewConversion(){var r,n;const e=this._findSettingsFormat(),i=this.viewModel;if(e){const s=this.conversions.find(o=>o.format===e);this._previewConversion=new YS({format:e,position:{location:this.currentLocation,coordinate:(r=s==null?void 0:s.position)==null?void 0:r.coordinate}}),(n=this._previewConversion.position)!=null&&n.coordinate||i.previewConversion(this._previewConversion)}}_setSettingsFormat(e){const i=e.target,r=e7(i[i.options.selectedIndex]);r!=null&&(this._settingsFormat=r,this._setPreviewConversion())}_showClipboardPopup(){this._clipboardPopupVisible?clearTimeout(this._clipboardPopupTimeoutId):this._clipboardPopupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hideClipboardPopup()},eVt)}_showPopup(e,i=tVt){this._popupMessage=e,this._popupVisible?clearTimeout(this._popupTimeoutId):this._popupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hidePopup()},i)}_toggleGoTo(){this._goToEnabled=!this._goToEnabled}_updateCurrentPattern(e){e.stopPropagation();const i=e.target,r=this._findSettingsFormat();r&&(r.currentPattern=i.value)}_renderConversion(e,i){const{messages:r}=this;if(!r)return X("li",null);const{format:n}=e,s=(n==null?void 0:n.label)??"",o=`${this.id}__list-item-${i}`,a=`${s} ${r.conversionOutputSuffix}`,c=i===0,p=c||this._expanded,_=c?this._renderFirstConversion(e):this._renderTools(i,e,o),x=c&&!e.displayCoordinate?r.noLocation:e.displayCoordinate,S=X("div",{"aria-label":x,class:Zi.coordDisplay,"data-conversion":e,role:"listitem",tabIndex:0,title:x??""},x),C=this._renderOptions(this.formats.filter(M=>M!==n));return p?X("li",{"aria-label":a,class:Zi.conversionRow,id:o,key:e,role:"group",tabIndex:0,title:a},X("select",{"aria-controls":o,"aria-label":r.selectFormat,bind:this,class:this.classes(it.select,Zi.rowSelect),"data-index":i,onchange:this._addConversion,title:r.selectFormat},X("option",{"aria-label":s,selected:!0,title:s},s.toUpperCase()),C),S,_):null}_renderCopyButton(e){const i=this._clipboardPopupVisible&&this._renderClipboardPopup(),{messagesCommon:r}=this;return r?X("li",{"aria-label":r.copy,bind:this,class:this.classes(it.widgetButton,Zi.rowButton),"data-conversion":e,onclick:this._copyCoordinateOutput,oncopy:this._onCopy,onkeydown:this._copyCoordinateOutput,role:"button",tabIndex:0,title:r.copy},i,X("span",{"aria-hidden":"true",class:oi.duplicate})):X("li",null)}_renderFirstConversion(e){const i=this.id,r={[oi.down]:!this._expanded,[oi.up]:this._expanded},{messages:n,messagesCommon:s,multipleConversions:o,visibleElements:a}=this;if(!s||!n)return X("ul",null);const c=this.mode==="live"?n.captureMode:n.liveMode,p=this._expanded?s.collapse:s.expand,_=e.displayCoordinate&&this.mode==="capture"?this._renderCopyButton(e):null,x=o&&a.expandButton&&X("li",{"aria-controls":`${i}__${Zi.conversionList}`,"aria-label":p,bind:this,class:it.widgetButton,key:"esri-coordinate-conversion__expand-button",onclick:this._toggleExpand,onkeydown:this._toggleExpand,role:"button",tabIndex:0,title:p},X("span",{"aria-hidden":"true",class:this.classes(r)})),S=!o&&a.captureButton&&X("li",{"aria-label":c,bind:this,class:this.classes(it.widgetButton,Zi.modeToggle),key:"esri-coordinate-conversion__mode-toggle",onclick:this._toggleMode,onkeydown:this._toggleMode,role:"button",tabIndex:0,title:c},X("span",{"aria-hidden":"true",class:oi.mapPin}));return X("ul",{class:Zi.toolDisplay},_,x,S)}_renderInputForm(){const e=this._conversionFormat||this.conversions.at(0).format,i=this.formats.findIndex(x=>x.name===(e==null?void 0:e.name)),r=this.id,n=`${r}__${Zi.coordinateInput}`,s=`${r}__${Zi.coordinateInput}__header`,o=this._renderOptions(this.formats,!0,i),a={[Zi.rejectInput]:this._badInput},{messages:c,messagesCommon:p,headingLevel:_}=this;return p&&c?X("div",{"aria-labelledby":s,class:Zi.inputForm,key:"esri-coordinate-conversion__input-form",role:"search"},X("div",{class:Zi.sectionHeading},X("div",{"aria-label":p.back,bind:this,class:this.classes(it.widgetButton,Zi.backButton),onclick:this._toggleInputVisibility,onkeydown:this._toggleInputVisibility,role:"button",tabIndex:0,title:p.back},this._renderBackIcon()),X(Dm,{class:it.heading,id:s,level:_},c.inputCoordTitle)),X("div",{class:Zi.inputFormGroup},X("select",{"aria-controls":n,"aria-label":c.selectFormat,bind:this,class:this.classes(it.select,Zi.rowSelect),onchange:this._setInputFormat,title:c.selectFormat},o),X("input",{afterCreate:Jv,"aria-labelledby":s,"aria-required":"true",bind:this,class:this.classes(Zi.coordinateInput,it.input,a),"data-format":e,"data-node-ref":"_coordinateInput",id:n,onkeydown:this._processUserInput,placeholder:c.inputCoordTitle,role:"textbox",spellcheck:!1,title:c.inputCoordTitle,type:"text"})),X("div",{class:Zi.inputFormGroup},X("label",{"aria-label":c.goTo},X("input",{bind:this,checked:this._goToEnabled,onclick:this._toggleGoTo,title:c.goTo,type:"checkbox"}),c.goTo),X("button",{"aria-label":c.convert,bind:this,class:this.classes(Zi.convertButton,it.button),onclick:this._processUserInput,title:c.convert,type:"button"},X("span",{class:Zi.convertButtonSpan},c.convert)))):X("div",null)}_renderConversionsView(){const{messages:e}=this;if(!e)return X("div",null);const i=`${this.id}__${Zi.conversionList}`,r=this._renderPrimaryTools(),n=this._renderOptions(this.formats),s=this.conversions.map((c,p)=>this._renderConversion(c,p)).toArray(),o=this._expanded?X("div",{class:Zi.conversionRow},X("select",{"aria-controls":i,"aria-label":e.addConversion,bind:this,class:this.classes(it.select,Zi.primarySelect),"data-index":-1,onchange:this._addConversion,title:e.addConversion},X("option",{disabled:!0,selected:!0,value:""},e.addConversion),n),r):null,a={[Zi.expanded]:this._expanded,[Zi.expandUp]:this.orientation==="expand-up",[Zi.expandDown]:this.orientation==="expand-down"};return X("div",{class:this.classes(Zi.conversionsView,a),key:"esri-coordinate-conversion__main-view"},X("ul",{"aria-expanded":this._expanded?"true":"false",class:Zi.conversionList,id:i},s),o)}_renderOptions(e,i,r){var o;const n=this.conversions.at(0),s=(o=n.format)==null?void 0:o.name;return e.map((a,c)=>{const p=!(i||!n)&&(s===a.name||this.conversions.map(_=>{var x;return(x=_.format)==null?void 0:x.name}).includes(a.name));return X("option",{"aria-label":a.label,"data-format":a,disabled:p,key:a.name??"unnamed-format",selected:c===r,value:a.label},a.label.toUpperCase())}).toArray()}_renderPopup(){return X("div",{class:Zi.popup,role:"alert"},this._popupMessage)}_renderClipboardPopup(){const{messages:e}=this;return e?X("div",{class:this.classes(Zi.popup,Zi.clipboardPopup),role:"alert"},e.copySuccessMessage):X("div",null)}_renderPrimaryTools(){const{messages:e,visibleElements:i}=this;if(!e)return X("ul",null);const r=this.mode==="live"?e.captureMode:e.liveMode,n=i.inputButton&&X("li",{bind:this,class:it.widgetButton,onclick:this._toggleInputVisibility,onkeydown:this._toggleInputVisibility,role:"button",tabIndex:0,title:e.inputCoordTitle},X("span",{"aria-hidden":"true",class:oi.edit})),s=i.captureButton&&X("li",{bind:this,class:this.classes(it.widgetButton,Zi.modeToggle),onclick:this._toggleMode,onkeydown:this._toggleMode,role:"button",tabIndex:0,title:r},X("span",{"aria-hidden":"true",class:oi.mapPin})),o=i.settingsButton&&X("li",{bind:this,class:it.widgetButton,onclick:this._toggleSettingsVisibility,onkeydown:this._toggleSettingsVisibility,role:"button",tabIndex:0,title:e.settingsTitle},X("span",{"aria-hidden":"true",class:oi.settings2}));return X("ul",{class:Zi.toolDisplay},n,s,o)}_renderSettings(){var C;const e=this.id,i=`${e}__${Zi.patternInput}`,r=`${e}__${Zi.patternInput}__header`,n=`${e}__${Zi.previewCoordinate}`,s=this.formats.filter(M=>M.hasDisplayProperties),o=this._findSettingsFormat(),a=o?s.indexOf(o):-1,c=this._renderOptions(s,!0,a),p=o==null?void 0:o.currentPattern,{messages:_,messagesCommon:x,headingLevel:S}=this;return x&&_?X("div",{"aria-labelledby":r,class:Zi.settings,key:Zi.settings},X("div",{class:Zi.sectionHeading},X("div",{bind:this,class:this.classes(it.widgetButton,Zi.backButton),onclick:this._toggleSettingsVisibility,onkeydown:this._toggleSettingsVisibility,role:"button",tabIndex:0,title:x.back},this._renderBackIcon()),X(Dm,{class:it.heading,id:r,level:S},_.settingsTitle)),X("div",{class:Zi.settingsFormGroup},X("label",{for:i},_.changeCoordinateDisplay),X("select",{"aria-label":_.selectFormat,bind:this,class:it.select,onchange:this._setSettingsFormat,title:_.selectFormat},c),X("div",{class:Zi.settingsFormGroupHorizontal},X("input",{"aria-controls":n,bind:this,class:this.classes(Zi.patternInput,it.input),id:i,oninput:this._updateCurrentPattern,spellcheck:!1,title:_.changeCoordinateDisplay,type:"text",value:p}),X("div",{"aria-controls":i,bind:this,class:it.widgetButton,onclick:this._setDefaultPattern,onkeydown:this._setDefaultPattern,role:"button",tabIndex:0,title:_.defaultPattern},X("span",{"aria-hidden":"true",class:oi.refresh})))),X("div",{class:Zi.settingsFormGroup},X("label",null,x.preview,X("div",{class:Zi.previewCoordinate,id:n,tabIndex:0},(C=this._previewConversion)==null?void 0:C.displayCoordinate)))):X("div",null)}_renderBackIcon(){return X("span",{"aria-hidden":"true",class:ZT(this.container)?oi.rightArrow:oi.leftArrows})}_renderTools(e,i,r){const n=i.displayCoordinate&&this.mode==="capture"?this._renderCopyButton(i):null,{messages:s}=this;return s?X("ul",{class:Zi.toolDisplay,role:"listitem"},n,X("li",{"aria-controls":r,"aria-label":s.removeConversion,bind:this,class:this.classes(it.widgetButton,Zi.rowButton),"data-index":e,key:`${r}__${it.widgetButton}`,onclick:this._removeConversion,onkeydown:this._removeConversion,role:"button",tabIndex:0,title:s.removeConversion},X("span",{"aria-hidden":"true",class:oi.close}))):X("ul",null)}_copyCoordinateOutput(e){const i=e.target;if(!("createTextRange"in document.body)){const r=window.getSelection(),n=document.createRange();n.selectNodeContents(i),r==null||r.removeAllRanges(),r==null||r.addRange(n)}document.execCommand("copy")}_removeConversion(e){const i=Mxe(e.currentTarget);i!=null&&this.conversions.removeAt(i)}_setDefaultPattern(e){e.stopPropagation();const i=this._findSettingsFormat();i&&(i.currentPattern=i.defaultPattern)}_toggleExpand(){this._expanded=!this._expanded}_toggleInputVisibility(){this._inputVisible=!this._inputVisible,this._popupVisible&&this._hidePopup(),this._inputVisible?this.viewModel.pause():this.viewModel.resume()}_toggleMode(){this.mode=this.mode==="live"?"capture":"live"}_toggleSettingsVisibility(){this._settingsVisible=!this._settingsVisible,this._popupVisible&&this._hidePopup(),this._settingsVisible?(this._setPreviewConversion(),this.viewModel.pause()):this.viewModel.resume()}};function Mxe(t){return t["data-index"]}function e7(t){return t["data-format"]}function iVt(t){return t["data-conversion"]}y([w()],Ss.prototype,"conversions",null),y([w()],Ss.prototype,"currentLocation",null),y([w()],Ss.prototype,"formats",null),y([w()],Ss.prototype,"goToOverride",null),y([w()],Ss.prototype,"headingLevel",void 0),y([w()],Ss.prototype,"label",null),y([w(),Gr("esri/widgets/CoordinateConversion/t9n/CoordinateConversion")],Ss.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],Ss.prototype,"messagesCommon",void 0),y([w()],Ss.prototype,"mode",null),y([w()],Ss.prototype,"orientation",void 0),y([w()],Ss.prototype,"multipleConversions",null),y([w()],Ss.prototype,"locationSymbol",null),y([w()],Ss.prototype,"storageEnabled",null),y([w()],Ss.prototype,"storageType",null),y([w()],Ss.prototype,"view",null),y([w({type:jVe})],Ss.prototype,"viewModel",void 0),y([w()],Ss.prototype,"visibleElements",void 0),y([Ci("visibleElements")],Ss.prototype,"castVisibleElements",null),y([wo()],Ss.prototype,"_copyCoordinateOutput",null),y([wo()],Ss.prototype,"_removeConversion",null),y([wo()],Ss.prototype,"_setDefaultPattern",null),y([wo()],Ss.prototype,"_toggleExpand",null),y([wo()],Ss.prototype,"_toggleInputVisibility",null),y([wo()],Ss.prototype,"_toggleMode",null),y([wo()],Ss.prototype,"_toggleSettingsVisibility",null),Ss=y([Z("esri.widgets.CoordinateConversion")],Ss);const rVt=Ss,$X=/-?\d+[\.]?\d*/,nVt=t=>new rVt({view:t}),sVt=()=>new mv({name:"XYZ",conversionInfo:{convert:function(t){const e=t,i=e.x.toFixed(2),r=e.y.toFixed(2),n=e.z.toFixed(2);return{location:e,coordinate:`${i}, ${r}, ${n}`}},reverseConvert:function(t){const e=t.split(",");return new mt({x:parseFloat(e[0]),y:parseFloat(e[1]),z:parseFloat(e[2]),spatialReference:{wkid:3301}})}},coordinateSegments:[{alias:"X",description:"Longitude",searchPattern:$X},{alias:"Y",description:"Latitude",searchPattern:$X},{alias:"Z",description:"Elevation",searchPattern:$X}],defaultPattern:"X, Y, Z"});let oVt=0,gv=class extends F_(Xs(z_(ze))){constructor(e){super(e),this.id=`${Date.now().toString(16)}-analysis-${oVt++}`,this.title=null}get parent(){return this._get("parent")}set parent(e){const i=this.parent;if(i!=null)switch(i.type){case"line-of-sight":case"dimension":i.releaseAnalysis(this);break;case"2d":case"3d":i.analyses.includes(this)&&i.analyses.remove(this)}this._set("parent",e)}get isEditable(){return this.requiredPropertiesForEditing.every(ys)}};y([w({type:String,constructOnly:!0,clonable:!1})],gv.prototype,"id",void 0),y([w({type:String})],gv.prototype,"title",void 0),y([w({constructOnly:!0})],gv.prototype,"type",void 0),y([w({clonable:!1,value:null})],gv.prototype,"parent",null),y([w({readOnly:!0})],gv.prototype,"isEditable",null),y([w({readOnly:!0})],gv.prototype,"requiredPropertiesForEditing",void 0),gv=y([Z("esri.analysis.Analysis")],gv);const GVe=gv;function HVe(t,e){return Oxe(t)===Oxe(e)}function Oxe(t){if(t==null)return null;const e=t.layer!=null?t.layer.id:"";let i=null;return i=t.objectId!=null?t.objectId:t.layer!=null&&"objectIdField"in t.layer&&t.layer.objectIdField!=null&&t.attributes!=null?t.attributes[t.layer.objectIdField]:t.uid,i==null?null:`o-${e}-${i}`}const qVe={json:{write:{writer:aVt,target:{"feature.layerId":{type:[Number,String]},"feature.objectId":{type:[Number,String]}}},origins:{"web-scene":{read:lVt}}}};function aVt(t,e){var i;((i=t==null?void 0:t.layer)==null?void 0:i.objectIdField)!=null&&t.attributes!=null&&(e.feature={layerId:t.layer.id,objectId:t.attributes[t.layer.objectIdField]})}function lVt(t){if(t.layerId!=null&&t.objectId!=null)return{uid:null,layer:{id:t.layerId,objectIdField:"ObjectId"},attributes:{ObjectId:t.objectId}}}let mM=class extends F_(Xs(ze)){constructor(e){super(e),this.position=null,this.elevationInfo=null,this.feature=null}equals(e){return HO(this.position,e.position)&&HO(this.elevationInfo,e.elevationInfo)&&HVe(this.feature,e.feature)}};y([w({type:mt,json:{write:{isRequired:!0}}})],mM.prototype,"position",void 0),y([w({type:WB}),jv()],mM.prototype,"elevationInfo",void 0),y([w(qVe)],mM.prototype,"feature",void 0),mM=y([Z("esri.analysis.LineOfSightAnalysisObserver")],mM);const WVe=mM;let gM=class extends F_(HZ){constructor(e){super(e),this.position=null,this.elevationInfo=null,this.feature=null}equals(e){return HO(this.position,e.position)&&HO(this.elevationInfo,e.elevationInfo)&&HVe(this.feature,e.feature)}};y([w({type:mt}),jv()],gM.prototype,"position",void 0),y([w({type:WB}),jv()],gM.prototype,"elevationInfo",void 0),y([w(qVe)],gM.prototype,"feature",void 0),gM=y([Z("esri.analysis.LineOfSightAnalysisTarget")],gM);const YVe=gM,Lre=tt.ofType(YVe);let yv=class extends GVe{constructor(e){super(e),this.type="line-of-sight",this.observer=null,this.extent=null}initialize(){this.addHandles(_e(()=>this._computeExtent(),e=>{(e==null?void 0:e.pending)==null&&this._set("extent",e!=null?e.extent:null)},kt))}get targets(){return this._get("targets")||new Lre}set targets(e){this._set("targets",od(e,this.targets,Lre))}get spatialReference(){var e;return((e=this.observer)==null?void 0:e.position)!=null?this.observer.position.spatialReference:null}get requiredPropertiesForEditing(){var e;return[(e=this.observer)==null?void 0:e.position]}async waitComputeExtent(){const e=this._computeExtent();return e!=null?e.pending:Promise.resolve()}_computeExtent(){var o;const e=this.spatialReference;if(((o=this.observer)==null?void 0:o.position)==null||e==null)return null;const i=a=>Ioe(a.position,a.elevationInfo)==="absolute-height",r=this.observer.position,n=D2(r.x,r.y,r.z,r.x,r.y,r.z);for(const a of this.targets)if(a.position!=null){const c=oPe(a.position,e);if(c.pending!=null)return{pending:c.pending,extent:null};if(c.geometry!=null){const{x:p,y:_,z:x}=c.geometry;Xf(n,[p,_,x])}}const s=Jet(n,e);return i(this.observer)&&this.targets.every(i)||(s.zmin=void 0,s.zmax=void 0),{pending:null,extent:s}}clear(){this.observer=null,this.targets.removeAll()}};y([w({type:["line-of-sight"]})],yv.prototype,"type",void 0),y([w({type:WVe,json:{read:!0,write:!0}})],yv.prototype,"observer",void 0),y([w({cast:o5,type:Lre,nonNullable:!0,json:{read:!0,write:!0}})],yv.prototype,"targets",null),y([w({value:null,readOnly:!0})],yv.prototype,"extent",void 0),y([w({readOnly:!0})],yv.prototype,"spatialReference",null),y([w({readOnly:!0})],yv.prototype,"requiredPropertiesForEditing",null),yv=y([Z("esri.analysis.LineOfSightAnalysis")],yv);const XVe=yv;let _S=class extends ze{constructor(e){super(e),this.location=null,this.intersectedLocation=null,this.intersectedGraphic=null,this.visible=void 0}};y([w({type:mt})],_S.prototype,"location",void 0),y([w({type:mt})],_S.prototype,"intersectedLocation",void 0),y([w({type:Ma})],_S.prototype,"intersectedGraphic",void 0),y([w({type:Boolean})],_S.prototype,"visible",void 0),_S=y([Z("esri.widgets.lineOfSight.LineOfSightTarget")],_S);const ZVe=_S;var zO;(function(t){t[t.PENDING=0]="PENDING",t[t.WAIT_FOR_VIEW_READY=1]="WAIT_FOR_VIEW_READY",t[t.RUNNING=2]="RUNNING"})(zO||(zO={}));let fc=class extends ze{constructor(e={}){super(e),this.view=null,this.analysisView=null,this._reconnectViewTask=null,this._forceInteractiveHandle=null,this._parentChangeFromReconnect=!1,this._startUserOperation=null,this.logger=Ce.getLogger(this);const i=e==null?void 0:e.analysis;i!=null?this.analysis=i:(this._set("analysis",this.constructAnalysis()),this._set("isAnalysisOwner",!0)),(e==null?void 0:e.visible)!=null&&(this.visible=e.visible)}normalizeCtorArgs(e){const{analysis:i,...r}=e;return r}initialize(){this.addHandles([_e(()=>({readyAndNotSupported:this.view!=null&&this.view.ready&&!this.supported}),({readyAndNotSupported:e})=>{e&&this.logger.errorOnce(this.unsupportedErrorMessage)},kt),_e(()=>{var e;return(e=this.analysis)==null?void 0:e.parent},e=>{this._parentChangeFromReconnect||e===this.view||this._set("isAnalysisOwner",!1);const i=!this._parentChangeFromReconnect;this._parentChangeFromReconnect=!1,i&&this._scheduleViewReconnect()},Li),_e(()=>({view:this.view,ready:this.view!=null&&this.view.ready,supported:this.supported}),({view:e},i)=>{const r=i==null?void 0:i.view;e!==r&&(this._startUserOperation=vn(this._startUserOperation),this._disconnectFromView(r)),this._scheduleViewReconnect()},kt)])}destroy(){this._reconnectViewTask=vn(this._reconnectViewTask),this._startUserOperation=vn(this._startUserOperation),this.analysisView!=null&&(this.analysisView.visible=void 0),this._disconnectFromView(this.view),this._set("view",null),this.analysis!=null&&this.isAnalysisOwner&&(this.analysis.destroy(),this._set("analysis",null))}get supported(){return this.view==null||this.view.type===this.supportedViewType}set visible(e){this._set("visible",e),this.analysisView!=null&&(this.analysisView.visible=e)}get active(){return this.tool!=null&&this.tool.active}get disabled(){return this.view==null||!this.view.ready||!this.supported}set analysis(e){e!==this._get("analysis")&&(this._startUserOperation=vn(this._startUserOperation),this._disconnectFromView(this.view),this._setExternalAnalysis(e),this._scheduleViewReconnect())}get ready(){return this.analysisView!=null&&!this.connectingToView}get connectingToView(){return this._reconnectViewTask!=null}get isAnalysisOwner(){return this._get("isAnalysisOwner")}get tool(){return this.analysisView!=null?this.analysisView.tool:null}clear(){this._startUserOperation=vn(this._startUserOperation),this._resetInteractiveCreationState(),this.tool!=null&&this.view!=null&&this.view.activeTool===this.tool&&(this.view.activeTool=null)}async start(){this.clear();const e={task:null,abort:null,state:zO.PENDING},i=Oc(async r=>{if(e.state=zO.WAIT_FOR_VIEW_READY,await dd(()=>this.ready,r),e.state=zO.RUNNING,this.analysisView==null||this.view==null)return;const n=this.analysisView.tool;n!=null&&(this.view.activeTool=n,Oo(()=>n.created,()=>{n.active&&this.view!=null&&(this.view.activeTool=null)},{initial:!0,once:!0}))});return e.task=i,e.abort=()=>i.abort(),this._startUserOperation=e,i.promise}onConnectToAnalysisView(e){}onDisconnectFromAnalysisView(){}_scheduleViewReconnect(){this._reconnectViewTask=vn(this._reconnectViewTask);const e=Oc(async i=>{try{await this._reconnectView(i)}catch(r){if(St(i),!on(r))return void this.logger.warn("Failed to use analysis in view model",r);throw r}finally{e===this._reconnectViewTask&&(this._reconnectViewTask=null)}});this._reconnectViewTask=e}async _reconnectView(e){const{view:i}=this,r=i!=null&&i.ready&&this.supported,n=this.analysis;if(this._startUserOperation=Pxe(this._startUserOperation),this._disconnectFromView(i),r&&i!=null&&n!=null){if(this.isAnalysisOwner){if(n.parent!=null)return void this.logger.errorOnce("expected owned analysis to have null parent when connecting to view");this._parentChangeFromReconnect=!0,i.analyses.add(n)}this.analysisView=await i.whenAnalysisView(n),So(e)?this._startUserOperation=Pxe(this._startUserOperation):(this.analysisView.visible=this.visible,this._forceInteractiveHandle=this.analysisView.forceInteractiveForViewModel(),this.addHandles(this._forceInteractiveHandle),this.onConnectToAnalysisView(this.analysisView))}}_disconnectFromView(e){e!=null&&this.isAnalysisOwner&&e.analyses.includes(this.analysis)&&(this._parentChangeFromReconnect=!0,this.analysis.clear(),e.analyses.remove(this.analysis)),this.onDisconnectFromAnalysisView(),this._forceInteractiveHandle=en(this._forceInteractiveHandle),this.analysisView=null}_setExternalAnalysis(e){this.analysisView==null||this.isAnalysisOwner||(this.analysisView.visible=void 0,this._forceInteractiveHandle=en(this._forceInteractiveHandle)),this.analysisView=null,this._set("isAnalysisOwner",!1),this._set("analysis",e),this._parentChangeFromReconnect=!1}_resetInteractiveCreationState(){this.analysis.clear(),this.tool!=null&&this.tool.resetCreated()}get testInfo(){return{analysisView:this.analysisView}}};function Pxe(t){return t!=null&&t.state>=zO.RUNNING?(t.abort(),null):t}y([w()],fc.prototype,"supported",null),y([w()],fc.prototype,"view",void 0),y([w({type:Boolean,value:!0})],fc.prototype,"visible",null),y([w()],fc.prototype,"active",null),y([w()],fc.prototype,"disabled",null),y([w({nonNullable:!0})],fc.prototype,"analysis",null),y([w()],fc.prototype,"analysisView",void 0),y([w()],fc.prototype,"ready",null),y([w()],fc.prototype,"connectingToView",null),y([w({readOnly:!0})],fc.prototype,"isAnalysisOwner",null),y([w()],fc.prototype,"_reconnectViewTask",void 0),y([w()],fc.prototype,"_forceInteractiveHandle",void 0),y([w()],fc.prototype,"tool",null),fc=y([Z("esri.widgets.support.AnalysisViewModel")],fc);const Dre=tt.ofType(ZVe);let bS=class extends fc{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="LineOfSightViewModel is only supported in 3D views.",this._vmTargetsToConnection=new Map,this._analysisTargetsToConnection=new Map}initialize(){this.addHandles([this.targets.on("after-add",e=>this._onViewModelTargetAdded(e.item)),this.targets.on("after-remove",e=>this._onViewModelTargetRemoved(e.item)),_e(()=>this.analysis,e=>this._onAnalysisChange(e),kt)])}destroy(){this._analysisTargetsToConnection.forEach(e=>e.remove())}get state(){return this.disabled||!this.ready?"disabled":this.tool==null?"ready":this.tool.state}get observer(){const{observer:e}=this.analysis;return(e==null?void 0:e.position)==null?null:this._convertAnalysisPointToAbsoluteHeight(e.position,e.elevationInfo)}set observer(e){let i=null;e&&(i=e.clone(),i.hasZ||(i.z=0)),this.analysis.observer=new WVe({position:i})}get targets(){return this._get("targets")||new Dre}set targets(e){this._set("targets",od(e,this.targets,Dre))}continue(){this.tool!=null&&this.tool.continue()}stop(){this.tool!=null&&this.tool.stop()}get testInfo(){return{analysisView:this.analysisView,getAnalysisTargetFromViewModelTarget:e=>{var i;return(i=this._vmTargetsToConnection.get(e))==null?void 0:i.analysisTarget}}}constructAnalysis(){return new XVe}async onConnectToAnalysisView(e){this.addHandles([e.on("result-changed",i=>{const r=this._analysisTargetsToConnection.get(i.target);r&&(i.result!=null?(r.viewModelTarget.intersectedGraphic=i.result.intersectedGraphic,r.viewModelTarget.intersectedLocation=i.result.intersectedLocation,r.viewModelTarget.visible=i.result.visible):(r.viewModelTarget.intersectedGraphic=null,r.viewModelTarget.intersectedLocation=null,r.viewModelTarget.visible=void 0))})],"view")}onDisconnectFromAnalysisView(){this.removeHandles("view")}_onViewModelTargetAdded(e){if(this._vmTargetsToConnection.get(e))return;const i=new YVe({position:e.location});this._connectViewModelWithAnalysisTarget(e,i),this.analysis.targets.add(i)}_onViewModelTargetRemoved(e){const i=this._vmTargetsToConnection.get(e);i&&(i.remove(),this.analysis.targets.remove(i.analysisTarget))}_onAnalysisTargetAdded(e){if(this._analysisTargetsToConnection.get(e))return;const{position:i}=e,r=new ZVe({location:i?this._convertAnalysisPointToAbsoluteHeight(i,e.elevationInfo):null});this._connectViewModelWithAnalysisTarget(r,e),this.targets.add(r)}_onAnalysisTargetRemoved(e){const i=this._analysisTargetsToConnection.get(e);i&&(i.remove(),this.targets.remove(i.viewModelTarget))}_connectViewModelWithAnalysisTarget(e,i){let r=!1;const n=sd([_e(()=>({position:i.position,elevationInfo:i.elevationInfo}),({position:o,elevationInfo:a})=>{r||(r=!0,e.location=o?this._convertAnalysisPointToAbsoluteHeight(o,a):null,r=!1)},Li),_e(()=>e.location,o=>{if(!r){r=!0;let a=null;o&&(a=o.clone(),a.hasZ||(a.z=0)),i.position=a,i.elevationInfo=null,r=!1}},Li)]),s={analysisTarget:i,viewModelTarget:e,remove:()=>{n.remove(),this._vmTargetsToConnection.delete(e),this._analysisTargetsToConnection.delete(i)}};this._vmTargetsToConnection.set(e,s),this._analysisTargetsToConnection.set(i,s)}_onAnalysisChange(e){const i="analysis";this.removeHandles(i),this.addHandles([this.analysis.targets.on("after-add",r=>this._onAnalysisTargetAdded(r.item)),this.analysis.targets.on("after-remove",r=>this._onAnalysisTargetRemoved(r.item))],i),this.targets.removeAll(),e.targets.forEach(r=>{this._onAnalysisTargetAdded(r)})}_convertAnalysisPointToAbsoluteHeight(e,i){const r=e.clone();if(this.view!=null){const n=HPe(e.hasZ,i);r.z=WPe(this.view,e,n,ga)}return r}};y([w({type:XVe})],bS.prototype,"analysis",void 0),y([w({readOnly:!0})],bS.prototype,"state",null),y([w()],bS.prototype,"observer",null),y([w({type:Dre,cast:o5,nonNullable:!0})],bS.prototype,"targets",null),bS=y([Z("esri.widgets.lineOfSight.LineOfSightViewModel")],bS);const JVe=bS,uy="esri-line-of-sight",Vb={base:uy,actions:`${uy}__actions`,container:`${uy}__container`,error:`${uy}__error`,hint:`${uy}__hint`,hintText:`${uy}__hint-text`,newAnalysisButton:`${uy}__new-analysis-button`,widgetIcon:oi.lineOfSight},t7={newAnalysisButton:`${uy}__new-button`,continueButton:`${uy}__continue-button`,doneButton:`${uy}__done-button`};let of=class extends hn{constructor(e,i){super(e,i),this.iconClass=Vb.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new JVe,this._onNewAnalysis=()=>{Nm(this.viewModel.start())},this._onDone=()=>{this.viewModel.stop()},this._onContinue=()=>{this.viewModel.continue()}}loadDependencies(){return Il({button:()=>we(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([214,215,216,217,218,219,220,221,222,223,224,225,226,227]))})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){return X("div",{class:this.classes(Vb.base,it.widget,it.panel),role:"presentation"},this._renderContainerNode())}_renderContainerNode(){if(!this.visible)return null;if(!this.viewModel.supported)return this._renderUnsupportedMessage();let e=null;const i=[this._renderNewAnalysisButton()];return this.viewModel.state==="creating"?(e=this._renderHint(),i.unshift(this._renderDoneButton())):this.viewModel.state==="created"&&this.viewModel.targets.length>0&&i.unshift(this._renderContinueButton()),X("div",{class:Vb.container},e,X("div",{class:Vb.actions},i))}_renderUnsupportedMessage(){return X("div",{class:Vb.error,key:"esri-line-of-sight__unsupported"},X("p",null,this.messages.unsupported))}_renderHint(){return X("div",{class:Vb.hint,key:"esri-line-of-sight__hint"},X("p",{class:Vb.hintText},this.messages.hint))}_renderNewAnalysisButton(){return this._renderButton({className:Vb.newAnalysisButton,id:t7.newAnalysisButton,label:this.messages.newAnalysis,onClick:this._onNewAnalysis,primary:!0})}_renderDoneButton(){return this._renderButton({id:t7.doneButton,label:this.messages.done,onClick:this._onDone,primary:!1})}_renderContinueButton(){return this._renderButton({id:t7.newAnalysisButton,label:this.messages.continueAnalysis,onClick:this._onContinue,primary:!1})}_renderButton({className:e,id:i,label:r,onClick:n,primary:s}){const o=this.viewModel.state==="disabled";return X("calcite-button",{appearance:s?"solid":"outline-fill",class:e,"data-id":i,disabled:o,key:i,onclick:n},r)}get test(){return{IDS:t7}}};y([w()],of.prototype,"active",null),y([w({constructOnly:!0,nonNullable:!0})],of.prototype,"analysis",null),y([w()],of.prototype,"iconClass",void 0),y([w()],of.prototype,"icon",void 0),y([w()],of.prototype,"label",null),y([w(),Gr("esri/widgets/LineOfSight/t9n/LineOfSight")],of.prototype,"messages",void 0),y([w()],of.prototype,"view",null),y([w({type:JVe})],of.prototype,"viewModel",void 0),y([w()],of.prototype,"visible",null),of=y([Z("esri.widgets.LineOfSight")],of);const cVt=of,uVt=t=>new cVt({view:t,container:"line-of-sight-container"}),hVt=t=>{document.getElementById("LoSstartBtn").addEventListener("click",i=>{const r=document.getElementById("xLOSstart").value,n=document.getElementById("yLOSstart").value,s=document.getElementById("zLoSstart").value;console.log("X-coordinate:",r),console.log("Y-coordinate:",n),console.log("Z-coordinate:",s)})},Ns="esri-search",Kn={base:Ns,widgetIcon:oi.search,hasMultipleSources:`${Ns}--multiple-sources`,isLoading:`${Ns}--loading`,isSearching:`${Ns}--searching`,showSuggestions:`${Ns}--show-suggestions`,showSources:`${Ns}--sources`,showWarning:`${Ns}--warning`,container:`${Ns}__container`,input:`${Ns}__input`,inputContainer:`${Ns}__input-container`,form:`${Ns}__form`,submitButton:`${Ns}__submit-button`,sourcesButton:`${Ns}__sources-button`,sourcesButtonDown:`${Ns}__sources-button--down`,sourcesButtonUp:`${Ns}__sources-button--up`,clearButton:`${Ns}__clear-button`,sourceName:`${Ns}__source-name`,suggestionsMenu:`${Ns}__suggestions-menu`,suggestionList:`${Ns}__suggestions-list`,suggestionListCurrentLocation:`${Ns}__suggestions-list--current-location`,sourcesMenu:`${Ns}__sources-menu`,source:`${Ns}__source`,warningMenu:`${Ns}__warning-menu`,warningMenuBody:`${Ns}__warning-body`,warningMenuHeader:`${Ns}__warning-header`,warningMenuText:`${Ns}__warning-text`,noValueText:`${Ns}__no-value-text`},h3="esri-search-result-renderer",d3={base:h3,showMoreResults:`${h3}__more-results--show-more-results`,moreResults:`${h3}__more-results`,moreResultsList:`${h3}__more-results-list`,moreResultsHeader:`${h3}__more-results-header`,moreResultsItem:`${h3}__more-results-item`,moreResultsListHeader:`${h3}__more-results-list-header`};let xa=class extends z_(Ue){constructor(e){super(e),this.autoNavigate=null,this.filter=null,this.getResults=null,this.getSuggestions=null,this.maxResults=null,this.maxSuggestions=null,this.minSuggestCharacters=null,this.outFields=null,this.placeholder="",this.popupEnabled=null,this.popupTemplate=null,this.prefix="",this.resultGraphicEnabled=null,this.resultSymbol=null,this.suggestionsEnabled=null,this.suffix="",this.withinViewEnabled=!1,this.zoomScale=null}};y([w()],xa.prototype,"autoNavigate",void 0),y([w()],xa.prototype,"filter",void 0),y([w()],xa.prototype,"getResults",void 0),y([w()],xa.prototype,"getSuggestions",void 0),y([w()],xa.prototype,"maxResults",void 0),y([w()],xa.prototype,"maxSuggestions",void 0),y([w()],xa.prototype,"minSuggestCharacters",void 0),y([w()],xa.prototype,"outFields",void 0),y([w()],xa.prototype,"placeholder",void 0),y([w()],xa.prototype,"popupEnabled",void 0),y([w()],xa.prototype,"popupTemplate",void 0),y([w()],xa.prototype,"prefix",void 0),y([w()],xa.prototype,"resultGraphicEnabled",void 0),y([w()],xa.prototype,"resultSymbol",void 0),y([w()],xa.prototype,"suggestionsEnabled",void 0),y([w()],xa.prototype,"suffix",void 0),y([w()],xa.prototype,"withinViewEnabled",void 0),y([w()],xa.prototype,"zoomScale",void 0),xa=y([Z("esri.widgets.Search.SearchSource")],xa);const JG=xa,Rxe=Ce.getLogger("esri.widgets.Search.support.geometryUtils");function dVt(t,e){var r,n;if(!e)return Rxe.error("missing-parameter: view is missing."),Promise.reject(new se("searchgeometryutils:missing-parameter","view is missing."));if(!t)return Rxe.error("missing-parameter: point is missing."),Promise.reject(new se("searchgeometryutils:missing-parameter","point is missing."));if(t.hasZ||e.type==="2d")return Promise.resolve(t);const i=(r=e==null?void 0:e.map)==null?void 0:r.ground;return i!=null&&i.layers.length?i.queryElevation(t,{cache:(n=e.basemapTerrain)==null?void 0:n.elevationQueryCache}).then(s=>s.geometry):Promise.resolve(t)}function Ixe(t){if(t==null)return null;switch(t.type){case"point":return t;case"extent":return t.center;case"polygon":return t.centroid;case"multipoint":return t.getPoint(0);case"polyline":return t.getPoint(0,0)}return null}function $ue(t,e,i){return t==null?null:t.type==="extent"?t:t.type==="multipoint"||t.type==="polygon"||t.type==="polyline"?t.extent:t.type==="point"?KVe(t,e,i):void 0}function Nre(t,e,i){return t==null||e==null?null:KVe(t.center,e,i)}function KVe(t,e,i){const r=t.hasZ?t.z:void 0;return e!=null&&e.map?(i!=null?yct(e,i):e.extent).clone().centerAt(t).set({zmax:r,zmin:r}):new Vi({xmin:t.x-.25,ymin:t.y-.25,xmax:t.x+.25,ymax:t.y+.25,spatialReference:t.spatialReference,zmin:r,zmax:r})}const pVt=/https?:\/\/services.*\.arcgis\.com/i,fVt=/(?:\{([^}]+)\})/g,UO=Ce.getLogger("esri.widgets.Search.support.layerSearchUtils");function mVt(t,e){const{exactMatch:i=!1,location:r,maxResults:n,spatialReference:s,source:o,sourceIndex:a,suggestResult:c,view:p}=t,{layer:_,filter:x,zoomScale:S}=o,C=p==null?void 0:p.scale,M=QVe(o,p),P=e==null?void 0:e.signal;return tBe(_).then(()=>{const $=_.popupTemplate;return $?$.getRequiredFields(_.fieldsIndex):null}).then($=>{var he,ce,ve,ge;const{objectIdField:F,returnZ:z}=_,k=aBe(o);if(!Lue(_,k))throw UO.error("invalid-field: displayField is invalid."),new se("getResults():invalid-field","displayField is invalid.");const U=$&&$.length?$:[k],j=o.outFields||U,G=eBe(j);if(j.includes(F)||G||j.push(F),(he=_.floorInfo)!=null&&he.floorField&&j.push(_.floorInfo.floorField),!(G||BV(_,j)))throw UO.error("invalid-field: outField is invalid."),new se("getResults():invalid-field","outField is invalid.");const Y=_.createQuery(),{orderByFields:Q}=o;if(Q&&(Y.orderByFields=Q),s){Y.outSpatialReference=s;const pe=1/xs(s);pe&&(Y.maxAllowableOffset=pe)}const ne=_.geometryType==="mesh"||_.geometryType==="multipatch",ie=((ve=(ce=_.capabilities)==null?void 0:ce.data)==null?void 0:ve.supportsZ)&&!ne;if(Y.returnZ=ie&&z!==!1,Y.returnGeometry=!0,Y.multipatchOption=ne?"xyFootprint":null,j&&(Y.outFields=j),r)Y.geometry=r;else if(c.key)Y.objectIds=[c.key];else{const pe=o.searchFields||[k];if(!BV(_,pe))throw UO.error("invalid-field: search field is invalid."),new se("getResults():invalid-field","search field is invalid.");if(oBe(_)&&(Y.num=n),M&&(Y.geometry=M),!((ge=c.text)==null?void 0:ge.trim()))return[];const te=c.text,{prefix:le="",suffix:de=""}=o,be=lBe(`${le}${te}${de}`);sBe(_)&&rBe(_,pe)&&!i&&te&&(Y.fullText=nBe({text:te,searchFields:pe}));const Se=cBe({searchTerm:be,layer:_,searchFields:pe,filter:x,exactMatch:i,query:Y,type:"search"});if(Y.where=Se,!iBe(Y))return[]}return _.queryFeatures(Y,{signal:P}).then(pe=>MVt(pe,p,o,a,k,C,S))})}function gVt(t,e){const{source:i,spatialReference:r,view:n,suggestTerm:s,maxSuggestions:o,sourceIndex:a,exactMatch:c}=t,{layer:p,filter:_}=i,x=e==null?void 0:e.signal,S=QVe(i,n);return tBe(p).then(()=>{if(!oBe(p))return[];const C=aBe(i),M=i.searchFields||[C],P=[];i.suggestionTemplate?i.suggestionTemplate.replaceAll(fVt,(ie,he)=>(P.push(he),ie)):P.push(C);const $=eBe(P);P.includes(p.objectIdField)||$||P.push(p.objectIdField);const F=Lue(p,C),z=$||BV(p,P),k=BV(p,M);if(!F)throw UO.error("invalid-field: displayField is invalid."),new se("getSuggestions():invalid-field","displayField is invalid.");if(!z)throw UO.error("invalid-field: outField is invalid."),new se("getSuggestions():invalid-field","outField is invalid.");if(!k)throw UO.error("invalid-field: search field is invalid."),new se("getSuggestions():invalid-field","search field is invalid.");const U=p.createQuery(),{orderByFields:j}=i;if(j&&(U.orderByFields=j),U.outSpatialReference=r,U.returnGeometry=!1,U.num=o,U.outFields=P,S&&(U.geometry=S),!s.trim())return[];const{prefix:G="",suffix:Y=""}=i,Q=lBe(`${G}${s}${Y}`);sBe(p)&&rBe(p,M)&&!c&&s&&(U.fullText=nBe({text:s,searchFields:M}));const ne=cBe({searchTerm:Q,layer:p,searchFields:M,filter:_,exactMatch:c,query:U,type:"suggest"});return U.where=ne,iBe(U)?p.queryFeatures(U,{signal:x}).then(ie=>EVt(ie,i,a,C)):[]})}function QVe(t,e){const{filter:i,withinViewEnabled:r}=t,n=e==null?void 0:e.extent;return(i==null?void 0:i.geometry)??(r&&n?n:void 0)}function eBe(t){return t&&t.includes("*")}async function tBe(t){t&&await t.load()}function iBe(t){return!(!t.fullText&&!t.where)}function rBe(t,e){const i=t==null?void 0:t.indexes;return!i||!(e!=null&&e.length)?!1:i.filter(r=>r.indexType==="FullText").some(r=>{var s;const n=((s=r.fields)==null?void 0:s.split(",").map(o=>o.trim().toLowerCase()))||[];return e.every(o=>n.includes(o.toLowerCase()))})}function nBe({text:t,searchFields:e}){return t.trim().split(" ").filter(i=>!!i.trim()).map(i=>new RPe({onFields:e,searchTerm:i,searchType:"prefix"}))}function sBe(t){var e,i;return((i=(e=t==null?void 0:t.capabilities)==null?void 0:e.query)==null?void 0:i.supportsFullTextSearch)??!1}function oBe(t){var e,i;return((i=(e=t==null?void 0:t.capabilities)==null?void 0:e.query)==null?void 0:i.supportsPagination)??!1}function yVt(t){var e,i,r;return((r=(i=(e=t==null?void 0:t.fieldsIndex)==null?void 0:e.fields)==null?void 0:i.find(n=>n.type==="string"))==null?void 0:r.name)??""}function aBe(t){return t.displayField||t.layer.displayField||yVt(t.layer)}function BV(t,e){return!(!t||!(e!=null&&e.length))&&e.every(i=>Lue(t,i))}function Lue(t,e){return!!t.getField(e)}function vVt(t){for(let e=0;e255)return!0;return!1}function _Vt(t,e,i){let r=null;const{codedValues:n}=t;return n&&n.some(s=>{const o=s.name,a=i?o:o.toLowerCase();return(i?e:e.toLowerCase())===a&&(r=s.code.toString(),!0)}),r}function lBe(t){return t.replaceAll("'","''")}function JR(t,e){const i=e==null?void 0:e.where;return i?`(${t}) AND (${i})`:t}function bVt({currentTerm:t,field:e,filter:i,exactMatch:r,url:n,type:s}){const o=e==null?void 0:e.type,a=e==null?void 0:e.name;if(o==="string"||o==="date"||o==="global-id"){const c=pVt.test(n??""),p=c&&vVt(t)?"N":"";return JR(r&&s==="search"?`${a} = ${p}'${t}'`:c?`${a} LIKE ${p}${`'${t}%'`}`:`${`LOWER(${a})`} LIKE ${p}${`'${t.toLowerCase()}%'`}`,i)}if(o==="oid"||o==="small-integer"||o==="integer"||o==="single"||o==="double"){const c=Number(t);return isNaN(c)?null:JR(`${a} = ${c}`,i)}return JR(`${a} = ${t}`,i)}function wVt(t,e){return t?` OR (${e})`:`(${e})`}function cBe({searchTerm:t,layer:e,searchFields:i,filter:r,exactMatch:n,query:s,type:o}){const{definitionExpression:a,url:c}=e;let p="";return!s.fullText&&t&&i&&i.forEach(_=>{const x=e.getField(_),S=typeof e.getFieldDomain=="function"&&e.getFieldDomain(_),C=(S&&S.type==="coded-value"?_Vt(S,t,n):null)||t||null;if(C!==null){const M=bVt({currentTerm:C,field:x,filter:r,exactMatch:n,url:c,type:o});M&&(p+=wVt(p,M))}}),a&&p?`(${a}) AND (${p})`:a||p}function xVt(t,e){let i=null;const{codedValues:r}=t;return r&&r.length&&r.some(n=>n.code===e&&(i=n.name,!0)),i}function SVt(t,e){return t[Object.keys(t).find(i=>i.toLowerCase()===e.toLowerCase())]}function uBe(t,e,i){const r=t.sourceLayer,{attributes:n}=t,s=typeof r.getFieldDomain=="function"&&r.getFieldDomain(i);if(e)return Zy(e,n);if(i&&n){const o=r.getField(i),a=SVt(n,i);return a==null?"":s&&s.type==="coded-value"?xVt(s,a)??"":(o==null?void 0:o.type)==="date"?Gs(new Date(a)):typeof a=="number"?a.toString():typeof a!="string"?"":a.trim()}return""}function TVt(t,e,i,r){const n=t.sourceLayer,{attributes:s}=t,{objectIdField:o}=n,a=o?s[o]:null;return{text:uBe(t,e.suggestionTemplate,r),key:a,sourceIndex:i}}function EVt(t,e,i,r){return t.features.map(n=>TVt(n,e,i,r))}function CVt(t){return t!=null&&t.minScale!=null&&t.maxScale!=null}function AVt(t,e,i,r,n,s,o){const a=t.clone(),c=t.sourceLayer,p=c==null?void 0:c.objectIdField,_=p?t.attributes[p]:null,x=uBe(t,i.searchTemplate,n);s!=null&&CVt(c)&&(c.minScale&&c.minScales&&(s=c.maxScale));const S=$ue(a.geometry,e,s),C=typeof o=="number"?Nre(Pe(S),e,o):S,M=t.clone();return C!=null&&(M.geometry=tl.fromExtent(C)),{extent:C,target:M,feature:a,key:_,name:x,sourceIndex:r}}function MVt(t,e,i,r,n,s,o){return t.features.map(a=>AVt(a,e,i,r,n,s,o))}var Fre;let J0=Fre=class extends JG{constructor(t){super(t),this.displayField=null,this.exactMatch=null,this.orderByFields=null,this.searchFields=null,this.searchTemplate=null,this.suggestionTemplate=null,this.getResults=(e,i)=>mVt({source:this,...e},i),this.getSuggestions=(e,i)=>gVt({source:this,...e},i)}set layer(t){this._set("layer",t),t&&t.load().catch(()=>{})}get name(){return this._getLayerTitle()??""}set name(t){this._overrideIfSome("name",t)}clone(){return new Fre({autoNavigate:this.autoNavigate,filter:this.filter,maxResults:this.maxResults,maxSuggestions:this.maxSuggestions,minSuggestCharacters:this.minSuggestCharacters,outFields:this.outFields?Pe(this.outFields):null,placeholder:this.placeholder,popupEnabled:this.popupEnabled,prefix:this.prefix,resultGraphicEnabled:this.resultGraphicEnabled,resultSymbol:this.resultSymbol?this.resultSymbol.clone():null,suggestionsEnabled:this.suggestionsEnabled,suffix:this.suffix,withinViewEnabled:this.withinViewEnabled,displayField:this.displayField,exactMatch:this.exactMatch,layer:this.layer,searchFields:this.searchFields?Pe(this.searchFields):null,suggestionTemplate:this.suggestionTemplate,zoomScale:this.zoomScale})}_getFirstStringField(){var t,e;return((e=(t=this.layer.fieldsIndex)==null?void 0:t.fields.find(i=>i.type==="string"))==null?void 0:e.name)??""}_getDisplayField(){return this.displayField||this.layer.displayField||this._getFirstStringField()}_getSearchFieldsString(){const{layer:t,searchFields:e}=this;return t.loaded?`: ${(e||[this._getDisplayField()]).map(i=>{const r=t.getField(i);return(r==null?void 0:r.alias)||i}).join(", ")}`:""}_getLayerTitle(){const{layer:t}=this;if(!t)return;const{title:e}=t;return e?`${e}${this._getSearchFieldsString()}`:void 0}};y([w({json:{read:{source:"field.name"},write:{target:"field.name"}}})],J0.prototype,"displayField",void 0),y([w({json:{read:{source:"field.exactMatch"},write:{target:"field.exactMatch"}}})],J0.prototype,"exactMatch",void 0),y([w({value:null})],J0.prototype,"layer",null),y([w()],J0.prototype,"name",null),y([w({type:[String],json:{write:!0}})],J0.prototype,"orderByFields",void 0),y([w()],J0.prototype,"searchFields",void 0),y([w()],J0.prototype,"searchTemplate",void 0),y([w()],J0.prototype,"suggestionTemplate",void 0),J0=Fre=y([Z("esri.widgets.Search.LayerSearchSource")],J0);const yM=J0;function OVt(t){return!!t&&typeof t.x=="number"&&typeof t.y=="number"}function PVt(t){return t&&typeof t.xmin=="number"&&typeof t.ymin=="number"&&typeof t.xmax=="number"&&typeof t.ymax=="number"}let Sw=class extends Ue{constructor(e){super(e),this.address=null,this.attributes=null,this.extent=null,this.location=null,this.score=null}};y([w({type:String,json:{write:!0}})],Sw.prototype,"address",void 0),y([w({type:Object,json:{write:!0}})],Sw.prototype,"attributes",void 0),y([w({type:Vi,json:{write:!0}})],Sw.prototype,"extent",void 0),y([w({type:mt,json:{write:!0}})],Sw.prototype,"location",void 0),y([w({type:Number,json:{write:!0}})],Sw.prototype,"score",void 0),Sw=y([Z("esri.rest.support.AddressCandidate")],Sw);const hBe=Sw,Due={type:String,json:{read:{source:"token"},write:{target:"token"}}};let hc=class extends Ue{constructor(e){super(e),this.address=null,this.apiKey=null,this.categories=null,this.countryCode=null,this.forStorage=null,this.location=null,this.locationType=null,this.magicKey=null,this.maxLocations=null,this.outFields=null,this.outSpatialReference=null,this.searchExtent=null}};y([w({type:Object,json:{write:!0}})],hc.prototype,"address",void 0),y([w(Due)],hc.prototype,"apiKey",void 0),y([w({type:[String],json:{read:{source:"category",reader:t=>t?t.split(","):null},write:{target:"category",writer:(t,e)=>{e.category=t?t.join(","):null}}}})],hc.prototype,"categories",void 0),y([w({type:String,json:{write:!0}})],hc.prototype,"countryCode",void 0),y([w({type:Boolean,json:{write:!0}})],hc.prototype,"forStorage",void 0),y([w({type:mt,json:{write:{writer:(t,e)=>{e.location=t?t.clone().normalize():null}}}})],hc.prototype,"location",void 0),y([w({type:String,json:{write:!0}})],hc.prototype,"locationType",void 0),y([w({type:String,json:{write:!0}})],hc.prototype,"magicKey",void 0),y([w({type:Number,json:{write:!0}})],hc.prototype,"maxLocations",void 0),y([w({type:[String],json:{write:{writer:(t,e)=>{e.outFields=t?t.join(","):null}}}})],hc.prototype,"outFields",void 0),y([w({type:rt,json:{read:{source:"outSR"},write:{target:"outSR"}}})],hc.prototype,"outSpatialReference",void 0),y([w({type:Vi,json:{write:{writer:(t,e)=>{const i=t?t.shiftCentralMeridian():null;e.searchExtent=i}}}})],hc.prototype,"searchExtent",void 0),hc=y([Z("esri.rest.support.AddressToLocationsParameters")],hc),hc.from=_s(hc);const dBe=hc;async function RVt(t,e,i){e=dBe.from(e);const r=F5(t),{address:n,...s}=e.toJSON(),o={...n,...s,f:"json"},a=PG({...r.query,...o}),c=OG(a,i),p=`${r.path}/findAddressCandidates`;return yi(p,c).then(IVt)}function IVt({data:t}){if(!t)return[];const{candidates:e,spatialReference:i}=t;return e?e.map(r=>{if(!r)return;const{extent:n,location:s}=r,o=!n||PVt(n);return OVt(s)&&o?(n&&(n.spatialReference=i),s&&(s.spatialReference=i),hBe.fromJSON(r)):void 0}):[]}let vv=class extends Ue{constructor(e){super(e),this.apiKey=null,this.location=null,this.locationType=null,this.outSpatialReference=null}};y([w(Due)],vv.prototype,"apiKey",void 0),y([w({type:mt,json:{write:{writer:(t,e)=>{const i=t?t.clone().normalize():null,r=i!==void 0;e.location=r?i:null}}}})],vv.prototype,"location",void 0),y([w({type:String,json:{write:!0}})],vv.prototype,"locationType",void 0),y([w({type:rt,json:{read:{source:"outSR"},write:{target:"outSR"}}})],vv.prototype,"outSpatialReference",void 0),vv=y([Z("esri.rest.support.LocationToAddressParameters")],vv),vv.from=_s(vv);const pBe=vv;async function $Vt(t,e,i){e=pBe.from(e);const r=F5(t),n={...e.toJSON(),f:"json"},s=PG({...r.query,...n}),o=OG(s,i),a=`${r.path}/reverseGeocode`;return yi(a,o).then(LVt)}function LVt({data:t}){if(!t)return;const{address:e,location:i}=t,r=(e==null?void 0:e.Match_addr)||"";return hBe.fromJSON({address:r,attributes:e||{},location:i,score:100})}let vM=class extends Ue{constructor(e){super(e),this.isCollection=null,this.magicKey=null,this.text=null}};y([w({type:Boolean,json:{write:!0}})],vM.prototype,"isCollection",void 0),y([w({type:String,json:{write:!0}})],vM.prototype,"magicKey",void 0),y([w({type:String,json:{write:!0}})],vM.prototype,"text",void 0),vM=y([Z("esri.rest.support.SuggestionCandidate")],vM);const DVt=vM;let Bd=class extends Ue{constructor(e){super(e),this.apiKey=null,this.categories=null,this.countryCode=null,this.location=null,this.maxSuggestions=null,this.outSpatialReference=null,this.searchExtent=null,this.text=null}};y([w(Due)],Bd.prototype,"apiKey",void 0),y([w({type:[String],json:{read:{source:"category",reader:t=>t?t.split(","):null},write:{target:"category",writer:(t,e)=>{e.category=t?t.join(","):null}}}})],Bd.prototype,"categories",void 0),y([w({type:String,json:{write:!0}})],Bd.prototype,"countryCode",void 0),y([w({type:mt,json:{write:{writer:(t,e)=>{e.location=t?t.clone().normalize():null}}}})],Bd.prototype,"location",void 0),y([w({type:Number,json:{write:!0}})],Bd.prototype,"maxSuggestions",void 0),y([w({type:rt,json:{read:{source:"outSR"},write:{target:"outSR"}}})],Bd.prototype,"outSpatialReference",void 0),y([w({type:Vi,json:{write:{writer:(t,e)=>{const i=t?t.shiftCentralMeridian():null;e.searchExtent=JSON.stringify(i)}}}})],Bd.prototype,"searchExtent",void 0),y([w({type:String,json:{write:!0}})],Bd.prototype,"text",void 0),Bd=y([Z("esri.rest.support.SuggestLocationsParameters")],Bd),Bd.from=_s(Bd);const fBe=Bd;async function NVt(t,e,i){const r=F5(t),n={...(e=fBe.from(e)).toJSON(),f:"json"},s=PG({...r.query,...n}),o=OG(s,i),a=`${r.path}/suggest`;return yi(a,o).then(FVt)}function FVt(t){const{data:e}=t;if(!e)return[];const{suggestions:i}=e;return i?i.map(r=>new DVt(r)):[]}const kVt="Single Line Input",zVt=3e5;function UVt(t,e){return t.location?HVt(t,e):qVt(t,e)}function mBe(t,e){var r;if(e.localSearchDisabled)return null;const i=t==null?void 0:t.scale;return typeof i=="number"&&i<=zVt?(r=t==null?void 0:t.extent)==null?void 0:r.center:null}async function VVt(t,e){const{source:i,spatialReference:r,view:n,suggestTerm:s,maxSuggestions:o,sourceIndex:a}=t,c=new fBe,{apiKey:p,url:_}=i,x=gBe(i,n),S=e==null?void 0:e.signal;if(!_)return null;p&&(c.apiKey=p),i.categories&&(c.categories=i.categories),r&&(c.outSpatialReference=r);const C=mBe(n,i);if(C&&(c.location=C),!s.trim())return null;const{prefix:M="",suffix:P=""}=i,$=`${M}${s}${P}`;return c.text=$,x&&(c.searchExtent=x),c.maxSuggestions=o,i.countryCode&&(c.countryCode=i.countryCode),NVt(_,c,{signal:S}).then(F=>YVt(F,a))}function BVt(t){return!!t&&/(?:geocode\-api\.arcgis\.com\/arcgis\/rest\/services\/world\/geocodeserver).*/i.test(t)}function jVt(t){return!!t&&/(?:\/servers\/[\da-z\.-]+\/rest\/services\/world\/geocodeserver).*/i.test(t)}function $xe(t){return!!t&&/(?:arcgis\.com\/arcgis\/rest\/services\/world\/geocodeserver).*/i.test(t)}const GVt="https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer";async function HVt(t,e){const{source:i,spatialReference:r,location:n,sourceIndex:s,view:o}=t,{apiKey:a,url:c,zoomScale:p,defaultZoomScale:_}=i;if(c==null)return[];const x=o==null?void 0:o.scale,S=e==null?void 0:e.signal,C=new pBe;C.location=n,a&&(C.apiKey=a),r&&(C.outSpatialReference=r);try{return yBe([await $Vt(c,C,{signal:S})],{sourceIndex:s,scale:x,view:o,zoomScale:p,defaultZoomScale:_})}catch{return[]}}function gBe(t,e){const{filter:i,withinViewEnabled:r}=t,n=e==null?void 0:e.scale,s=e==null?void 0:e.extent,o=i==null?void 0:i.geometry;return $ue(o,e,n)||(r&&s?s:void 0)}async function qVt(t,e){var Y;const{source:i,suggestResult:r,spatialReference:n,view:s,maxResults:o,sourceIndex:a}=t,c=i==null?void 0:i.zoomScale,p=i==null?void 0:i.defaultZoomScale;if(!((Y=r.text)==null?void 0:Y.trim()))return null;const x=!r.key&&i.prefix?i.prefix:"",S=!r.key&&i.suffix?i.suffix:"",C=`${x}${r.text}${S}`,M=new dBe,{apiKey:P,url:$}=i,F=s==null?void 0:s.scale,z=gBe(i,s),k=e==null?void 0:e.signal;if(P&&(M.apiKey=P),!$)return null;i.categories&&(M.categories=i.categories),i.locationType&&(M.locationType=i.locationType),n&&(M.outSpatialReference=n);const U=mBe(s,i);U&&(M.location=U),M.maxLocations=o,z&&(M.searchExtent=z),i.countryCode&&(M.countryCode=i.countryCode);const{key:j}=r,G=`${j}`;return j&&(M.magicKey=G),M.address={},M.address[i.singleLineFieldName||kVt]=C,i.outFields&&(M.outFields=i.outFields),RVt($,M,{signal:k}).then(Q=>yBe(Q,{key:G,scale:F,sourceIndex:a,view:s,zoomScale:c,defaultZoomScale:p}))}function WVt(t,e){return{text:t.text,key:t.magicKey,sourceIndex:e}}function YVt(t,e){return t.map(i=>WVt(i,e))}function XVt(t,e){const{key:i,scale:r,sourceIndex:n,view:s,zoomScale:o,defaultZoomScale:a}=e,{attributes:c,extent:p,location:_,address:x}=t,S=new Ma({geometry:_,attributes:c}),C=p||_,M=$ue(C,s,r),P=typeof o=="number"?Nre(M,s,o):typeof a=="number"&&(C==null?void 0:C.type)==="point"?Nre(M,s,a):M,$=_?`${_.x},${_.y}`:"",F=x||$,z=S.clone();return P!=null&&(z.geometry=tl.fromExtent(P)),{extent:P,feature:S,target:z,key:i,name:F,sourceIndex:n}}function yBe(t,e){return t.filter(Boolean).map(i=>XVt(i,e))}var kre;const ZVt="esri.widgets.Search.LocatorSearchSource";let Kc=kre=class extends JG{constructor(t){super(t),this.apiKey=null,this.categories=null,this.countryCode=null,this.defaultZoomScale=null,this.localSearchDisabled=!1,this.locationType=null,this.name="",this.placeholder="",this.searchTemplate="",this.singleLineFieldName=null,this.suggestionsEnabled=null,this.url=null,this.zoomScale=null,this.getResults=(e,i)=>UVt({source:this,...e},i),this.getSuggestions=(e,i)=>VVt({source:this,...e},i)}clone(){return new kre({apiKey:this.apiKey,autoNavigate:this.autoNavigate,filter:this.filter,maxResults:this.maxResults,maxSuggestions:this.maxSuggestions,minSuggestCharacters:this.minSuggestCharacters,outFields:this.outFields?Pe(this.outFields):null,placeholder:this.placeholder,popupEnabled:this.popupEnabled,prefix:this.prefix,resultGraphicEnabled:this.resultGraphicEnabled,resultSymbol:this.resultSymbol?this.resultSymbol.clone():null,suggestionsEnabled:this.suggestionsEnabled,suffix:this.suffix,withinViewEnabled:this.withinViewEnabled,categories:this.categories?Pe(this.categories):null,countryCode:this.countryCode,locationType:this.locationType,searchTemplate:this.searchTemplate,singleLineFieldName:this.singleLineFieldName,zoomScale:this.zoomScale})}};y([w()],Kc.prototype,"apiKey",void 0),y([w()],Kc.prototype,"categories",void 0),y([w()],Kc.prototype,"countryCode",void 0),y([w({json:{write:!0}})],Kc.prototype,"defaultZoomScale",void 0),y([w()],Kc.prototype,"localSearchDisabled",void 0),y([w()],Kc.prototype,"locationType",void 0),y([w({json:{write:!0}})],Kc.prototype,"name",void 0),y([w({json:{write:!0}})],Kc.prototype,"placeholder",void 0),y([w()],Kc.prototype,"searchTemplate",void 0),y([w({json:{write:!0}})],Kc.prototype,"singleLineFieldName",void 0),y([w({json:{read:{source:"suggest"},write:{target:"suggest"}}})],Kc.prototype,"suggestionsEnabled",void 0),y([w({json:{write:!0}})],Kc.prototype,"url",void 0),y([w({json:{write:!0}})],Kc.prototype,"zoomScale",void 0),Kc=kre=y([Z(ZVt)],Kc);const vBe=Kc,_Be=Ce.getLogger("esri.widgets.support.geolocationUtils"),JVt={maximumAge:0,timeout:15e3,enableHighAccuracy:!0};function KVt(){const t=$e("esri-geolocation");return t||_Be.warn("geolocation-unsupported","Geolocation unsupported."),t}function QVt(){const t=window.isSecureContext;return t||_Be.warn("insecure-context","Geolocation requires a secure origin."),t}function zre(){return KVt()&&QVt()}function bBe(t){return t||(t=JVt),new Promise((i,r)=>{setTimeout(()=>r(new se("geolocation:timeout","getting the current geolocation position timed out")),15e3),navigator.geolocation.getCurrentPosition(i,r,t??void 0)})}function wBe(t,e){const{position:i,view:r}=t,n=eBt(i),s=n==null?void 0:n.coords;if(!s)throw new se("geometry-service:no-coords","Geolocation has no coordinates");return iBt(tBt(s),r,e)}function eBt(t){const e=t&&t.coords||{},i={accuracy:e.accuracy,altitude:e.altitude,altitudeAccuracy:e.altitudeAccuracy,heading:e.heading,latitude:e.latitude,longitude:e.longitude,speed:e.speed};return t&&{coords:i,timestamp:t.timestamp}}function tBt({longitude:t,latitude:e,altitude:i}){return new mt({longitude:t,latitude:e,z:i||void 0,spatialReference:{wkid:4326}})}function iBt(t,e,i){if(!e)return Promise.resolve(t);const r=e.spatialReference;return r.isWGS84?Promise.resolve(t):r.isWebMercator?Promise.resolve(Py(t)):rBt(i).then(n=>{if(!n)throw new se("geometry-service:missing-url","Geometry service URL is missing");const s=new RG({geometries:[t],outSpatialReference:r});return Ice(n,s,i).then(o=>o[0])})}function rBt(t){if(Mr.geometryServiceUrl)return Promise.resolve(Mr.geometryServiceUrl);const e=os.getDefault();return e.load(t).catch(()=>{}).then(()=>{var i,r;return(r=(i=e.helperServices)==null?void 0:i.geometry)==null?void 0:r.url})}function Gc(t,e){return t.hasOwnProperty(e)&&t[e]!=null&&t[e]!==""}const nBt=()=>gE("esri/widgets/Search/t9n/Search"),xBe="esri.widgets.Search.SearchViewModel",j1=Ce.getLogger(xBe),Lxe="highlight",jk=tt.ofType({key:t=>t.layer?"layer":"locator",base:JG,typeMap:{layer:yM,locator:vBe}}),Dxe=rt.WGS84,sBt="esri/images/search/search-symbol-32.png",oBt=/<[\s\S]*?>/g,_M=-1;let vr=class extends HG(Dn.EventedMixin(ze)){constructor(e){super(e),this._gotoController=null,this._searching=null,this._updatingPromise=null,this._createdFeatureLayers=[],this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new jk,this.defaultSymbols={point:new x5({url:Wr(sBt),size:24,width:24,height:24}),polyline:new Ic({color:[130,130,130,1],width:2}),polygon:new qm({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=os.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new jk,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const i=await nBt();this.messages=i,this.defaultPopupTemplate=new yE({title:i.searchResult,content:"{Match_addr}"})};e(),this.addHandles([_e(()=>[this.includeDefaultSources,this.view,this.portal],()=>this._update(),Qt),fE(e)])}destroy(){this._destroyFeatureLayers(),this._abortGoTo(),this.clearGraphics()}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return this.allSources.length===1||!this.searchAllEnabled?0:_M}set activeSourceIndex(e){this._overrideIfSome("activeSourceIndex",e)}get allPlaceholder(){var e;return(e=this.messages)==null?void 0:e.allPlaceholder}set allPlaceholder(e){this._overrideIfSome("allPlaceholder",e)}get allSources(){const{sources:e,defaultSources:i,includeDefaultSources:r}=this,n=typeof r=="function"?r.call(null,{sources:e,defaultSources:i}):r?i.concat(e):e,s=this._get("allSources")||new jk;return s.removeAll(),s.addMany(n.filter(Boolean)),s}get locationEnabled(){return this._get("locationEnabled")||zre()}set locationEnabled(e){if(e===void 0)return void this._clearOverride("locationEnabled");const i=zre();if(e&&!i){const r=new se("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});j1.error(r)}this._override("locationEnabled",!!e&&i)}get placeholder(){const{allSources:e,activeSourceIndex:i,allPlaceholder:r}=this;if(i===_M)return r??"";const n=e.at(i);return(n==null?void 0:n.placeholder)??""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),e===""&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":this.allSources.length===0?"disabled":"ready"}get updating(){return this._updatingPromise!=null}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup();const{view:e,resultGraphic:i}=this;e&&i&&e.graphics.remove(i),this._set("resultGraphic",null)}search(e,i){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),n=(async()=>{var s;try{await this.when();const o=await this._getResultsFromSources(r,i);if((s=i==null?void 0:i.signal)!=null&&s.aborted)return null;const a={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(a,o,r);const c=this._getFirstResult(a.results),p=r.location&&c?c.name:r.text,_=p==null?void 0:p.replace(oBt,"");return this._set("searchTerm",_),(r.key&&typeof r.sourceIndex=="number"||r.location)&&this._set("selectedSuggestion",r),this._set("results",a.results),this._set("resultCount",a.results.reduce((x,S)=>{var C;return x+(((C=S.results)==null?void 0:C.length)??0)},0)),this.emit("search-complete",a),await this._selectFirstResult(c),a}finally{this._clearSearching()}})();return this._searching=n,n}async searchNearby(e){if(!this.locationEnabled){const r=new se("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});throw j1.error(r),r}const i=(async()=>{try{const r=await bBe(),n=await wBe({position:r,view:this.view},e);return await this.search(n,e)}finally{this._clearSearching()}})();return this._searching=i,i}async select(e){if(this.clearGraphics(),!e){const ne=new se("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});throw j1.error(ne),ne}const{view:i}=this,r=Gc(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),n=r!=null?this.allSources.at(r):null;if(!n){const ne=new se("select:missing-source","Cannot select without a source.",{source:n});throw j1.error(ne),ne}const s=n instanceof yM?this._getLayerSourcePopupTemplate(n):n.popupTemplate,o=n.resultSymbol||this._getDefaultSymbol(e),a=Gc(n,"resultGraphicEnabled")?n.resultGraphicEnabled:this.resultGraphicEnabled,c=Gc(n,"autoNavigate")?n.autoNavigate:this.autoNavigate,p=(Gc(n,"popupEnabled")?n.popupEnabled:this.popupEnabled)?s||this.popupTemplate||this.defaultPopupTemplate:null,{feature:_}=e;if(!_){const ne=new se("select:missing-feature","Cannot select without a feature.",{feature:_});throw j1.error(ne),ne}const{attributes:x,geometry:S,layer:C,sourceLayer:M}=_,P=Ixe(S),$={layerViewQuery:this._getLayerView(_),elevationQuery:i&&P!=null?dVt(P,i).catch(()=>P):Promise.resolve(P)},F=await vy($),z=F.layerViewQuery.value,k=F.elevationQuery.value;o instanceof wE&&(o.text=e.name);const U=i&&c?e.target||e.extent:null;await(U!=null?this._goToSearchResult(U):Promise.resolve());const G=z?_:new Ma({geometry:S,symbol:o,attributes:x,layer:C,sourceLayer:M,popupTemplate:p}),Y=i==null?void 0:i.popup,Q=Y&&G.getEffectivePopupTemplate(Y.defaultPopupTemplateEnabled);return Q&&await i.openPopup({features:[G],location:k}),z&&$Nt(z)&&!Q&&this._highlightFeature({graphic:G,layerView:z}),!z&&a&&i&&i.graphics.push(G),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",G),this.emit("select-result",{result:e,source:n,sourceIndex:r}),e}async suggest(e,i,r){const n=e||this.searchTerm;this.emit("suggest-start",{searchTerm:n}),await this._suggestTimer(i,r);const s=await this._suggestImmediate(n,r);return this._set("suggestions",s==null?void 0:s.results),this._set("suggestionCount",(s==null?void 0:s.results.reduce((o,a)=>{var c;return o+(((c=a.results)==null?void 0:c.length)??0)},0))??null),this.emit("suggest-complete",s),s}async when(){await dd(()=>!this.updating)}async _update(){const{portal:e,view:i}=this;if(this.includeDefaultSources){const r=this._updatingPromise=vy([e==null?void 0:e.load(),i==null?void 0:i.when()]);if(this.destroyed||(await r,r!==this._updatingPromise))return}await dd(()=>this.messages),this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){var i,r;const e=(r=(i=this.portal)==null?void 0:i.helperServices)==null?void 0:r.geocode;return e?e.map(n=>{var c;if(n.placefinding===!1)return;const s=Mr.apiKey&&$xe(n.url)?{url:GVt}:null,o=vBe.fromJSON({...n,...s}),a=o.url;if($xe(a)||jVt(a)||BVt(a)){const p=o.outFields??["Addr_type","Match_addr","StAddr","City"],_=(o.placeholder||((c=this.messages)==null?void 0:c.placeholder))??"",x=typeof o.defaultZoomScale=="number"?o.defaultZoomScale:2500;o.singleLineFieldName="SingleLine",o.outFields=p,o.placeholder=_,o.defaultZoomScale=x}return o.singleLineFieldName?o:void 0}).filter(ys):[]}_destroyFeatureLayers(){this._createdFeatureLayers.forEach(e=>e==null?void 0:e.destroy()),this._createdFeatureLayers=[]}_getLayerSources(e,i){var n;const r=(n=this.view)==null?void 0:n.map;return e.map(s=>{const o=r.findLayerById(s.id);if(!o)return;const a=this._getLayerJSON(s),c=yM.fromJSON(a);return c.placeholder=i,this._getLayer(o,a).then(p=>{c.layer=p}),c}).filter(ys).toArray()}_getTableSources(e,i){var n;const r=(n=this.view)==null?void 0:n.map;return e.map(s=>{if(!s.id)return;const o=r.findTableById(s.id);if(!o)return;const a=this._getLayerJSON(s),c=yM.fromJSON(a);return c.placeholder=i,this._getLayer(o,a).then(p=>{c.layer=p}),c}).filter(ys).toArray()}_convertApplicationProperties(){var a,c,p;const e=(a=this.view)==null?void 0:a.map,i=(p=(c=e==null?void 0:e.applicationProperties)==null?void 0:c.viewing)==null?void 0:p.search;if(!i)return[];const{enabled:r,hintText:n,layers:s,tables:o}=i;return r?[...this._getLayerSources(s,n),...this._getTableSources(o,n)]:[]}async _getSubLayer(e,i){var s;if(await e.load(),!e.allSublayers)throw new Error;const r=e.allSublayers.find(o=>o.id===i.subLayer);if(!r)throw new Error;const n=await((s=r.createFeatureLayer)==null?void 0:s.call(r));if(!n)throw new Error;return this._createdFeatureLayers.push(n),n}async _getBuildingSubLayer(e,i){await e.load();const r=e.allSublayers.find(n=>n.id===i.subLayer);if((r==null?void 0:r.type)!=="building-component")throw new Error;if(await r.load(),r.associatedLayer==null)throw new Error;return await r.associatedLayer.load(),r}async _getLayer(e,i){if(e.type==="feature"||e.type==="scene"||e.type==="csv"||e.type==="geojson"||e.type==="ogc-feature")return e;if(e.type==="map-image")try{return await this._getSubLayer(e,i)}catch{const n=new se("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return j1.error(n),null}return e.type==="building-scene"?this._getBuildingSubLayer(e,i):null}_getLayerJSON(e){return typeof e.toJSON=="function"?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:i}=this;this._destroyFeatureLayers(),e.removeAll(),i&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){var s;const e=(s=this.view)==null?void 0:s.popup,{resultGraphic:i}=this;if(!e||!i)return;const r="selectedFeature"in e,n=r?e.selectedFeature:null;r&&n&&n===i&&e.close()}_suggestTimer(e,i){const r=e??this.suggestionDelay;return P2(r,null,i==null?void 0:i.signal)}_createLocationForSearch(e){return e instanceof Ma?Ixe(e.geometry):e instanceof mt?e:Array.isArray(e)&&e.length===2?new mt({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&Gc(e,"key")&&Gc(e,"text")&&Gc(e,"sourceIndex"))return e;const i=this._createLocationForSearch(e),r=typeof e=="string"?e:this.searchTerm,{selectedSuggestion:n,selectedResult:s}=this,o=!e&&n&&s,a=o&&n.key===s.key&&n.sourceIndex===s.sourceIndex,c=o&&n.location;return a||c?n:{location:i,text:i?"":r,sourceIndex:null,key:null}}_getFirstResult(e){let i=null;return e&&e.some(r=>{const{results:n}=r,s=n==null?void 0:n[0],o=!!s;return o&&(i=s),o}),i}async _selectFirstResult(e){return this.autoSelect&&e?this.select(e):null}async _suggestImmediate(e,i){var s;await this.when();const r=await this._getSuggestionsFromSources(e,i);if((s=i==null?void 0:i.signal)!=null&&s.aborted)return null;const n={activeSourceIndex:this.activeSourceIndex,searchTerm:e??"",numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(n,r),n}_formatSourceResponse(e,i,r){const n=(i==null?void 0:i.value)||[],s=i==null?void 0:i.error,o=this.allSources.at(r);if(s){const a={sourceIndex:r,source:o,error:s};e.errors.push(a),j1.error(s),e.numErrors++}else{const a={sourceIndex:r,source:o,results:n};e.results.push(a),e.numResults+=n.length}}_formatResponse(e,i,r){if(i)if(e.activeSourceIndex===_M){const n=r&&Gc(r,"sourceIndex")&&r.sourceIndex!==-1?r.sourceIndex:void 0;i.forEach((s,o)=>{const a=n!==void 0?n:o;this._formatSourceResponse(e,s,a)})}else this._formatSourceResponse(e,i[0],e.activeSourceIndex)}async _getResultsFromSources(e,i){const{allSources:r}=this,n=!e.location&&Gc(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,s=[];if(!r.length){const o=new se("search:no-sources-defined","At least one source is required.",{allSources:r});throw j1.error(o),o}return n===_M?r.forEach((o,a)=>{s.push(this._getResultsFromSource(e,a,i))}):s.push(this._getResultsFromSource(e,n,i)),vy(s)}async _getSuggestionsFromSources(e,i){const{allSources:r,activeSourceIndex:n}=this,s=[];if(!r.length){const o=new se("suggest:no-sources-defined","At least one source is required.",{allSources:r});throw j1.error(o),o}return n===_M?r.forEach((o,a)=>{s.push(this._getSuggestionsFromSource(e,a,i))}):s.push(this._getSuggestionsFromSource(e,n,i)),vy(s)}async _getResultsFromSource(e,i,r){var _,x;const n=i!=null?this.allSources.at(i):null;if(!n)return null;const{location:s=null}=e,o=((_=this.view)==null?void 0:_.spatialReference)||Dxe,a=Gc(n,"maxResults")?n.maxResults:this.maxResults,c=!!(n instanceof yM&&Gc(n,"exactMatch"))&&n.exactMatch,{view:p}=this;return(x=n.getResults)==null?void 0:x.call(n,{view:p,sourceIndex:i,location:s,suggestResult:e,spatialReference:o,exactMatch:c,maxResults:a},r)}async _getSuggestionsFromSource(e,i,r){var c,p;const n=this.allSources.at(i);if(!n)return null;e??(e="");const s=Gc(n,"suggestionsEnabled")?n.suggestionsEnabled:this.suggestionsEnabled,o=e==null?void 0:e.length,a=Gc(n,"minSuggestCharacters")?n.minSuggestCharacters:this.minSuggestCharacters;if(s&&e.trim()&&o>=a){const _=((c=this.view)==null?void 0:c.spatialReference)||Dxe,x=Gc(n,"maxSuggestions")?n.maxSuggestions:this.maxSuggestions,{view:S}=this,C=!!(n instanceof yM&&Gc(n,"exactMatch"))&&n.exactMatch;return(p=n.getSuggestions)==null?void 0:p.call(n,{view:S,sourceIndex:i,suggestTerm:e,spatialReference:_,maxSuggestions:x,exactMatch:C},r)}return null}_getLayerSourcePopupTemplate(e){const{layer:i}=e;if(i)return Gc(e,"popupTemplate")?e.popupTemplate:i.popupTemplate}_getSourceIndexOfResult(e){const i=this.results;if(!i)return null;let r=null;return i.some(n=>n.results.some(s=>s===e&&(r=n.sourceIndex,!0))),r}async _goToSearchResult(e){this._abortGoTo();const i=new AbortController;this._gotoController=i;const r={target:{target:e},options:{signal:i.signal}};e||(r.options.animate=!1),await this.callGoTo(r),this._gotoController=null}_getDefaultSymbol(e){var n;const{defaultSymbols:i}=this,r=(n=e.feature)==null?void 0:n.geometry;if(r==null)return null;switch(r.type){case"point":case"multipoint":return i.point;case"polyline":return i.polyline;case"extent":case"polygon":return i.polygon;default:return null}}_removeHighlight(){this.removeHandles(Lxe)}async _getLayerView(e){var n,s;const{view:i}=this;if(!e||!i||((n=e.layer)==null?void 0:n.type)==="building-component"||((s=e.layer)==null?void 0:s.type)==="subtype-sublayer")return null;const{layer:r}=e;return r?(await i.when(),i.whenLayerView(r)):null}_highlightFeature(e){const{graphic:i,layerView:r}=e,{attributes:n,layer:s}=i,{objectIdField:o}=s,a=(o&&(n==null?void 0:n[o]))??null,c=r.highlight(a??i);this.addHandles(c,Lxe)}_setResultFloor(e){var s,o,a;const{view:i}=this,r=(s=e.feature)==null?void 0:s.attributes,n=(o=e.feature)==null?void 0:o.sourceLayer;if(n&&"floorInfo"in n&&((a=n==null?void 0:n.floorInfo)!=null&&a.floorField)&&r){const c=r[n.floorInfo.floorField];i==null||i.emit("select-result-floor",c)}}};vr.ALL_INDEX=_M,y([w()],vr.prototype,"_searching",void 0),y([w()],vr.prototype,"_updatingPromise",void 0),y([w({readOnly:!0,value:null})],vr.prototype,"activeSource",null),y([w()],vr.prototype,"activeSourceIndex",null),y([w()],vr.prototype,"allPlaceholder",null),y([w({readOnly:!0})],vr.prototype,"allSources",null),y([w()],vr.prototype,"autoNavigate",void 0),y([w()],vr.prototype,"autoSelect",void 0),y([w()],vr.prototype,"defaultPopupTemplate",void 0),y([w({readOnly:!0})],vr.prototype,"defaultSources",void 0),y([w()],vr.prototype,"defaultSymbols",void 0),y([w()],vr.prototype,"includeDefaultSources",void 0),y([w()],vr.prototype,"locationEnabled",null),y([w()],vr.prototype,"maxInputLength",void 0),y([w()],vr.prototype,"maxResults",void 0),y([w()],vr.prototype,"maxSuggestions",void 0),y([w()],vr.prototype,"messages",void 0),y([w()],vr.prototype,"minSuggestCharacters",void 0),y([w({readOnly:!0})],vr.prototype,"placeholder",null),y([w()],vr.prototype,"popupEnabled",void 0),y([w({type:yE})],vr.prototype,"popupTemplate",void 0),y([w({type:os})],vr.prototype,"portal",void 0),y([w()],vr.prototype,"resultCount",void 0),y([w()],vr.prototype,"resultGraphicEnabled",void 0),y([w({readOnly:!0})],vr.prototype,"resultGraphic",void 0),y([w({readOnly:!0})],vr.prototype,"results",void 0),y([w({readOnly:!0})],vr.prototype,"selectedSuggestion",void 0),y([w()],vr.prototype,"searchAllEnabled",void 0),y([w({readOnly:!0})],vr.prototype,"selectedResult",void 0),y([w()],vr.prototype,"searchTerm",null),y([w({type:jk})],vr.prototype,"sources",void 0),y([w({readOnly:!0})],vr.prototype,"state",null),y([w()],vr.prototype,"suggestionDelay",void 0),y([w()],vr.prototype,"suggestionCount",void 0),y([w({readOnly:!0})],vr.prototype,"suggestions",void 0),y([w()],vr.prototype,"suggestionsEnabled",void 0),y([w({readOnly:!0})],vr.prototype,"updating",null),y([w()],vr.prototype,"view",void 0),y([w()],vr.prototype,"clear",null),vr=y([Z(xBe)],vr);const rO=vr;let Tw=class extends hn{constructor(e,i){super(e,i),this.messages=null,this.showMoreResultsOpen=!1,this.viewModel=null}destroy(){this.viewModel=null}render(){const e={[d3.showMoreResults]:this.showMoreResultsOpen};return X("div",{class:this.classes(d3.base,it.widget)},X("div",{class:this.classes(d3.moreResults,e),key:"esri-search-renderer__container"},this._renderSearchResultName(),this._renderMoreResults()))}_renderMoreResults(){return X("div",{key:"esri-search-renderer__more-results"},this._renderMoreResultsButton(),this._renderMoreResultsLists())}_renderSearchResultName(){var r;const e=(r=this.viewModel)==null?void 0:r.selectedResult,i=(e==null?void 0:e.name)||"";return X("div",{class:d3.moreResultsItem,key:"esri-search-renderer__result-name"},i)}_renderMoreResultsLists(){const{viewModel:e}=this;if(!e)return[];const i=e.results;if((e.resultCount??0)<2)return null;const r=i==null?void 0:i.map(n=>this._renderMoreResultsList(n));return X("div",{class:d3.moreResultsList,key:"esri-search-renderer__more-results-container"},r)}_renderMoreResultsButton(){const{messages:e,viewModel:i}=this;return i?(i.resultCount??0)<2?null:X("div",{class:d3.moreResultsItem,key:"esri-search-renderer__more-results-button"},X("a",{bind:this,class:it.anchor,href:"#",onclick:this._showMoreResultsClick,onkeydown:this._showMoreResultsClick},this.showMoreResultsOpen?e.hideMoreResults:e.showMoreResults)):null}_renderMoreResultsHeader(e,i){return X("div",{class:d3.moreResultsListHeader,key:`esri-search-result-renderer__header-${i}`},e)}_renderMoreResultsList(e){var x,S,C;const{results:i}=e,r=(i==null?void 0:i.length)??0,n=r>0,s=(x=this.viewModel)==null?void 0:x.selectedResult,o=r===1&&i[0]===s,a=this._getSourceName(e.source,e.sourceIndex),c=(((C=(S=this.viewModel)==null?void 0:S.results)==null?void 0:C.length)??0)>1&&!o?this._renderMoreResultsHeader(a,e.sourceIndex):null,p=n&&i.map((M,P)=>this._renderMoreResultsListItem(M,P)),_=n&&!o?X("ul",{key:`esri-search-result-renderer__list-${e.sourceIndex}`},p):null;return n?X("div",{key:`esri-search-result-renderer__results-${e.sourceIndex}`},c,_):null}_renderMoreResultsListItem(e,i){var n;const r=(n=this.viewModel)==null?void 0:n.selectedResult;return e!==r?X("li",{key:`esri-search-result-renderer__list-item-${i}`},X("a",{bind:this,class:it.anchor,"data-result":e,href:"#",onclick:this._selectResultClick,onkeydown:this._selectResultClick,tabIndex:0},e.name)):null}_showMoreResultsClick(e){var r,n;e.preventDefault(),this.showMoreResultsOpen=!this.showMoreResultsOpen;const i=(n=(r=this.viewModel)==null?void 0:r.view)==null?void 0:n.popup;i&&"reposition"in i&&i.reposition()}_selectResultClick(e){var r;e.preventDefault();const i=e.currentTarget["data-result"];(r=this.viewModel)==null||r.select(i)}_getSourceName(e,i){return i===rO.ALL_INDEX?this.messages.all:e.name}};y([w(),Gr("esri/widgets/Search/t9n/Search")],Tw.prototype,"messages",void 0),y([w()],Tw.prototype,"showMoreResultsOpen",void 0),y([w()],Tw.prototype,"viewModel",void 0),y([wo()],Tw.prototype,"_showMoreResultsClick",null),y([wo()],Tw.prototype,"_selectResultClick",null),Tw=y([Z("esri.widgets.Search.SearchResultRenderer")],Tw);const aBt=Tw,lBt=/<[a-z/][\s\S]*>/i,cBt=(t,e)=>{const i=fne(e).split(/\s/),r=new RegExp(`(${i.join("|")})`,"gi");return t.replace(r,n=>`${n}`)};let _r=class extends hn{constructor(e,i){super(e,i),this._activeMenuItemIndex=-1,this._inputNode=null,this._menuItemCount=0,this._sourceMenuButtonNode=null,this._sourceListNode=null,this._suggestionListNode=null,this._searchResultRenderer=new aBt,this._suggestController=null,this._searchController=null,this._locateFailed=!1,this._container=null,this.activeMenu="none",this.disabled=!1,this.iconClass=Kn.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.viewModel=new rO,this._clearActiveMenu=()=>{this.activeMenu="none"},this._removeActiveMenu=r=>{var s;const n=r.relatedTarget;n&&((s=this._container)!=null&&s.contains(n))||this._clearActiveMenu()},this.addHandles([_e(()=>this.searchTerm,r=>{var n,s;(r&&this.activeMenu==="warning"||!r&&!((s=(n=this.viewModel)==null?void 0:n.selectedSuggestion)!=null&&s.location))&&this._clearActiveMenu()}),Jr(()=>{var r;return(r=this.viewModel)==null?void 0:r.allSources},"change",()=>this._watchSourceChanges()),_e(()=>this.activeMenu,()=>this._resetActiveMenuItemIndex(),Qt),_e(()=>{var r;return(r=this.viewModel)==null?void 0:r.defaultPopupTemplate},r=>{r&&(r.content=this._renderSearchResultsContent.bind(this))},Qt)])}destroy(){this._cancelSuggest(),this._cancelSearch(),this._searchResultRenderer=et(this._searchResultRenderer)}get displayedSearchTerm(){return`${this.viewModel.searchTerm}`.trim()}get inputId(){return this._buildId("input")}get suggestionsMenuId(){return this._buildId("suggest-menu")}get sourceMenuId(){return this._buildId("source-menu")}get sourceMenuButtonId(){return this._buildId("source-menu-button")}get activeSource(){var e;return(e=this.viewModel)==null?void 0:e.activeSource}get activeSourceIndex(){return this.viewModel.activeSourceIndex}set activeSourceIndex(e){this.viewModel.activeSourceIndex=e}get allPlaceholder(){return this.viewModel.allPlaceholder}set allPlaceholder(e){this.viewModel.allPlaceholder=e}get allSources(){return this.viewModel.allSources}get autoNavigate(){return this.viewModel.autoNavigate}set autoNavigate(e){this.viewModel.autoNavigate=e}get autoSelect(){return this.viewModel.autoSelect}set autoSelect(e){this.viewModel.autoSelect=e}get defaultSources(){return this.viewModel.defaultSources}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get includeDefaultSources(){return this.viewModel.includeDefaultSources}set includeDefaultSources(e){this.viewModel.includeDefaultSources=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get locationEnabled(){return this.viewModel.locationEnabled}set locationEnabled(e){this.viewModel.locationEnabled=e}get maxResults(){return this.viewModel.maxResults}set maxResults(e){this.viewModel.maxResults=e}get maxSuggestions(){return this.viewModel.maxSuggestions}set maxSuggestions(e){this.viewModel.maxSuggestions=e}get minSuggestCharacters(){return this.viewModel.minSuggestCharacters}set minSuggestCharacters(e){this.viewModel.minSuggestCharacters=e}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get portal(){var e;return(e=this.viewModel)==null?void 0:e.portal}set portal(e){this.viewModel&&(this.viewModel.portal=e)}get resultGraphic(){return this.viewModel.resultGraphic}set resultGraphic(e){this.viewModel.resultGraphic=e}get resultGraphicEnabled(){return this.viewModel.resultGraphicEnabled}set resultGraphicEnabled(e){this.viewModel.resultGraphicEnabled=e}get results(){return this.viewModel.results}get searchAllEnabled(){return this.viewModel.searchAllEnabled}set searchAllEnabled(e){this.viewModel.searchAllEnabled=e}get searchTerm(){return this.viewModel.searchTerm}set searchTerm(e){this.viewModel.searchTerm=e}get selectedResult(){return this.viewModel.selectedResult}get sources(){return this.viewModel.sources}set sources(e){this.viewModel.sources=e}get suggestions(){return this.viewModel.suggestions}get suggestionsEnabled(){return this.viewModel.suggestionsEnabled}set suggestionsEnabled(e){this.viewModel.suggestionsEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}clear(){this.viewModel.clear()}focus(){var e;(e=this._inputNode)==null||e.focus(),this.emit("search-focus")}blur(){var e;(e=this._inputNode)==null||e.blur(),this.emit("search-blur")}async search(e){this._clearActiveMenu(),this._cancelSuggest(),this._cancelSearch();const i=new AbortController,{signal:r}=i;this._searchController=i;try{const n=await this.viewModel.search(e,{signal:r});return this._searchController!==i?void 0:(this.activeMenu=n!=null&&n.numResults?"none":"warning",this._searchController=null,n)}catch{return this._searchController!==i?void 0:(this._clearActiveMenu(),void(this._searchController=null))}}async suggest(e){this._cancelSuggest();const i=new AbortController,{signal:r}=i;this._suggestController=i;try{const n=await this.viewModel.suggest(e,null,{signal:r});return this._suggestController!==i?void 0:(this._suggestController=null,n!=null&&n.numResults&&this._openSuggestionMenu(),this._scrollToTopSuggestion(),n)}catch{return this._suggestController!==i||(this._suggestController=null),null}}render(){const{state:e}=this.viewModel,i={[it.disabled]:e==="disabled",[it.widgetDisabled]:this.disabled};return X("div",{class:this.classes(Kn.base,it.widget,i)},e==="loading"?this._renderLoader():this._renderContainer())}_renderSubmitButton(){const{messages:e,disabled:i}=this;return X("button",{"aria-label":e.searchButtonTitle,bind:this,class:this.classes(Kn.submitButton,it.widgetButton),disabled:i,key:"esri-search__submit-button",onclick:this._handleSearchButtonClick,title:e.searchButtonTitle,type:"button"},X("span",{"aria-hidden":"true",class:oi.search}))}_renderWarningMenu(){return X("div",{class:this.classes(it.menu,Kn.warningMenu),key:"esri-search__error-menu"},X("div",{class:Kn.warningMenuBody},this._renderWarning()))}_renderSourceMenuButton(){const{messages:e,activeMenu:i,sourceMenuId:r,sourceMenuButtonId:n,disabled:s}=this,{activeSourceIndex:o,allSources:a}=this.viewModel;return a.length>1?X("button",{afterCreate:Jv,"aria-controls":r,"aria-expanded":(i==="source").toString(),"aria-haspopup":"true","aria-label":e.searchIn,bind:this,class:this.classes(Kn.sourcesButton,it.widgetButton),"data-node-ref":"_sourceMenuButtonNode",disabled:s,id:n,key:"esri-search__source-menu-button",onclick:this._handleSourcesMenuToggleClick,onfocus:this._handleSourcesMenuToggleFocus,title:e.searchIn,type:"button"},X("span",{"aria-hidden":"true",class:this.classes(oi.downArrow,Kn.sourcesButtonDown)}),X("span",{"aria-hidden":"true",class:this.classes(oi.upArrow,Kn.sourcesButtonUp)}),X("span",{class:Kn.sourceName},this._getSourceName(o))):null}_renderSourcesList(){const{allSources:e,searchAllEnabled:i}=this.viewModel,{_activeMenuItemIndex:r,activeMenu:n,sourceMenuId:s,sourceMenuButtonId:o}=this,a=n==="source"&&r>-1?this._buildId("source-item",r):null;return e.length>1?X("ul",{afterCreate:Jv,"aria-activedescendant":a,"aria-labelledby":o,bind:this,class:it.menuList,"data-node-ref":"_sourceListNode",id:s,onkeydown:this._handleSourceMenuKeydown,onkeyup:this._handleSourceMenuKeyup,role:"menu",tabIndex:-1},i?this._renderSource(rO.ALL_INDEX):null,e.map((c,p)=>this._renderSource(p)).toArray()):null}_renderSourcesMenu(){const{allSources:e}=this.viewModel;return e.length>1?X("div",{class:this.classes(it.menu,Kn.sourcesMenu),key:"esri-search__source-menu"},this._renderSourcesList()):null}_renderLoader(){const{messages:e,messagesCommon:i,disabled:r}=this;return X("div",{class:it.loader,key:"base-loader",tabIndex:r?-1:void 0},X("span",{"aria-hidden":"true",class:it.loaderAnimation}),X("span",{class:oi.fontFallbackText},e.searchButtonTitle),X("span",{class:it.loaderText},i.loading))}_renderContainer(){const{allSources:e,state:i}=this.viewModel,{activeMenu:r}=this,n={[Kn.hasMultipleSources]:e.length>1,[Kn.isLoading]:i==="loading",[Kn.isSearching]:i==="searching",[Kn.showWarning]:r==="warning",[Kn.showSources]:r==="source",[Kn.showSuggestions]:r==="suggestion"};return X("div",{afterCreate:s=>{this._container=s,s.addEventListener("focusout",this._removeActiveMenu)},afterRemoved:s=>{s.removeEventListener("focusout",this._removeActiveMenu)},class:this.classes(n,Kn.container),key:"base-container",tabIndex:-1},this._renderSourceMenuButton(),this._renderSourcesMenu(),this._renderInputContainer(),this._renderSubmitButton(),this._renderWarningMenu())}_renderClearButton(){return this.searchTerm?X("button",{bind:this,class:this.classes(Kn.clearButton,it.widgetButton),disabled:this.disabled,key:"esri-search__clear-button",onclick:this._handleClearButtonClick,onfocus:this._clearActiveMenu,title:this.messages.clearButtonTitle,type:"button"},X("span",{"aria-hidden":"true",class:oi.close})):null}_renderLocationGroup(){const{messages:e,locationEnabled:i,displayedSearchTerm:r}=this,n=i&&!r,s=this.activeMenu==="suggestion"&&this._activeMenuItemIndex===0;return n?X("ul",{class:this.classes(it.menuList,Kn.suggestionList,Kn.suggestionListCurrentLocation),key:"esri-search__suggestion-list-current-location",role:"group"},X("li",{"aria-selected":(this.activeMenu==="suggestion"&&this._activeMenuItemIndex===0).toString(),bind:this,class:this.classes(it.menuItem,s?it.menuItemFocus:null),"data-current-location-item":!0,id:this._buildId("suggestion-item",0),onclick:this._handleUseCurrentLocationClick,role:"option"},X("span",{"aria-hidden":"true",class:oi.locateCircled})," ",e.useCurrentLocation)):null}_renderInput(){const{activeMenu:e,locationEnabled:i,displayedSearchTerm:r,messages:n,suggestionsMenuId:s,inputId:o,_activeMenuItemIndex:a,disabled:c}=this,{maxInputLength:p,placeholder:_,searchTerm:x,suggestionCount:S}=this.viewModel,C=!(!(i&&!r)&&!S),M=e==="suggestion"&&a>-1?this._buildId("suggestion-item",a):null;return X("input",{afterCreate:Jv,"aria-activedescendant":M,"aria-autocomplete":"list","aria-controls":C?s:null,"aria-expanded":(C&&e==="suggestion").toString(),"aria-haspopup":"listbox","aria-label":n.searchButtonTitle,autocomplete:"off",bind:this,class:this.classes(it.input,Kn.input),"data-node-ref":"_inputNode",disabled:c,id:o,maxlength:p,onblur:this.blur,onclick:this._openSuggestionMenu,onfocus:this.focus,oninput:this._handleInputPaste,onkeyup:this._handleInputKeyup,onpaste:this._handleInputPaste,placeholder:_,role:"combobox",title:x?"":_,type:"text",value:x})}_renderForm(){return X("form",{bind:this,class:Kn.form,disabled:this.disabled,key:"esri-search__form",onsubmit:this._formSubmit,role:"search"},this._renderInput())}_renderSuggestList(e){const{sourceIndex:i}=e,{results:r}=e;return(r==null?void 0:r.length)?X("ul",{class:this.classes(it.menuList,Kn.suggestionList),key:`esri-search__suggestion-list-${i}`,role:"group"},r==null?void 0:r.map(s=>this._renderSuggestion(s,this._menuItemCount++))):null}_renderSuggestionsGroup(){const{suggestions:e}=this.viewModel;return e?e.map(i=>[this._renderSuggestionHeader(i),this._renderSuggestList(i)]):[]}_renderSuggestionsMenu(){const{displayedSearchTerm:e,locationEnabled:i,suggestionsMenuId:r,inputId:n}=this,{suggestionCount:s}=this.viewModel,o=i&&!e||s;return this._menuItemCount=0,o?X("div",{afterCreate:Jv,"aria-labelledby":n,bind:this,class:this.classes(it.menu,Kn.suggestionsMenu),"data-node-ref":"_suggestionListNode",id:r,key:"esri-search__suggestions-menu",role:"listbox"},this._renderLocationGroup(),this._renderSuggestionsGroup()):null}_renderInputContainer(){return X("div",{class:Kn.inputContainer,key:"esri-search__input-container"},this._renderForm(),this._renderSuggestionsMenu(),this._renderClearButton())}_renderSuggestionHeader(e){var a;const{allSources:i,activeSourceIndex:r}=this.viewModel,{sourceIndex:n}=e,s=(a=e.results)==null?void 0:a.length,o=i.length>1&&r===rO.ALL_INDEX;return s&&o?X("div",{class:it.menuHeader,key:`esri-search__suggestion-header-${n}`},this._getSourceName(n)):null}_renderSuggestion(e,i){const{_activeMenuItemIndex:r,viewModel:{searchTerm:n}}=this;if(!n)return;const s=this.activeMenu==="suggestion"&&r===i;return X("li",{"aria-selected":(this.activeMenu==="suggestion"&&this._activeMenuItemIndex===i).toString(),bind:this,class:this.classes(it.menuItem,s?it.menuItemFocus:null),"data-suggestion":e,id:this._buildId("suggestion-item",i),innerHTML:this._getSuggestResultHTML(e.text,n),key:`esri-search__suggestion_${i}`,onclick:this._handleSuggestionClick,role:"option"})}_renderSource(e){const{activeSourceIndex:i,searchAllEnabled:r}=this.viewModel,n={[it.menuItemActive]:e===i,[it.menuItemFocus]:this.activeMenu==="source"&&e===(r?this._activeMenuItemIndex-1:this._activeMenuItemIndex)},s=r?e+1:e;return X("li",{"aria-checked":(e===i).toString(),bind:this,class:this.classes(Kn.source,it.menuItem,n),"data-source-index":e,id:this._buildId("source-item",s),key:`esri-search__source-${e}`,onclick:this._handleSourceClick,role:"menuitemradio"},this._getSourceName(e))}_renderNoResultsWarning(e){const{messages:i}=this,r=e?Zy(i.noResultsFoundForValue,{value:`"${e}"`}):i.noResultsFound;return X("div",{key:"esri-search__no_results"},X("div",{class:Kn.warningMenuHeader},i.noResults),X("div",{class:Kn.warningMenuText},r))}_renderEmptySearchWarning(){const{messages:e}=this;return X("div",{key:"esri-search__empty-search"},X("span",{"aria-hidden":"true",class:oi.noticeTriangle}),X("span",{class:Kn.noValueText},e.emptyValue))}_renderLocateWarning(){const{messages:e}=this;return X("div",{key:"esri-search__locate-error"},X("span",{"aria-hidden":"true",class:oi.noticeTriangle}),X("span",{class:Kn.noValueText},e.locateError))}_renderWarning(){var n;const{displayedSearchTerm:e,_locateFailed:i}=this,{viewModel:r}=this;return i?this._renderLocateWarning():(n=r.selectedSuggestion)!=null&&n.location||e?this._renderNoResultsWarning(e):this._renderEmptySearchWarning()}_resetActiveMenuItemIndex(){this._activeMenuItemIndex=-1}_buildId(e,i){return`${this.id}-${e}${i===void 0?"":`-${i}`}`}_watchSourceChanges(){const{viewModel:{allSources:e}}=this,i="sources";this.removeHandles(i),e.forEach(r=>this.addHandles(_e(()=>r.name,()=>this.scheduleRender()),i))}_handleSourcesMenuToggleFocus(){this.activeMenu!=="source"&&this._clearActiveMenu()}_handleSourcesMenuToggleClick(){var i;const e=this.activeMenu==="source";this.activeMenu=e?"none":"source",this.renderNow(),this.activeMenu==="source"&&((i=this._sourceListNode)==null||i.focus())}_handleClearButtonClick(){this.viewModel.clear(),this._focus()}_handleSearchButtonClick(){this.search()}_handleSuggestionClick(e){const i=Nxe(e.currentTarget);i&&(this._focus(),this.search(i))}_handleUseCurrentLocationClick(){this._useCurrentLocation()}_useCurrentLocation(){this._focus("none"),this._cancelSuggest(),this._cancelSearch();const e=new AbortController,{signal:i}=e;this._searchController=e,(async()=>{try{const r=await this.viewModel.searchNearby({signal:i});this.activeMenu=r!=null&&r.numResults?"none":"warning"}catch{this._locateFailed=!0,this.activeMenu="warning"}finally{this._searchController=null}})()}_handleSourceClick(e){this._setSourceFromMenuItem(e.currentTarget)}_setSourceFromMenuItem(e){var r;if(!e)return;const i=uBt(e);i!=null&&(this.viewModel.activeSourceIndex=i,this._clearActiveMenu(),(r=this._sourceMenuButtonNode)==null||r.focus())}_cancelSuggest(){this._suggestController=vn(this._suggestController)}_cancelSearch(){this._searchController=vn(this._searchController),this._locateFailed=!1}_handleInputKeyup(e){var s;const i=Mf(e);if(e.ctrlKey||e.metaKey||i==="Copy"||i==="ArrowLeft"||i==="ArrowRight"||i==="Shift")return;if(i==="Tab"||i==="Escape"||e.shiftKey&&i==="Tab")return this._cancelSuggest(),void(i==="Escape"&&this._clearActiveMenu());const r=i==="Home"||i==="End"||i==="ArrowUp"||i==="ArrowDown";if(i==="Enter"&&this._activeMenuItemIndex<0)return void this._cancelSuggest();const n=(s=this._suggestionListNode)==null?void 0:s.getElementsByTagName("li");if(n!=null&&n.length){if(this.activeMenu!=="suggestion"&&this._openSuggestionMenu(),r)return e.preventDefault(),this._cancelSuggest(),void this._handleItemNavigation(i,n,this._suggestionListNode);const o=n[this._activeMenuItemIndex];if(i==="Enter"&&o){const a=Nxe(o);return void(a?(this._focus(),this.search(a)):hBt(o)&&this._useCurrentLocation())}}this.viewModel.searchTerm&&this.suggest()}_handleItemNavigation(e,i,r){const n=this._activeMenuItemIndex;e==="Home"&&(this._activeMenuItemIndex=0),e==="End"&&(this._activeMenuItemIndex=i.length-1),e==="ArrowUp"&&(this._activeMenuItemIndex=this._activeMenuItemIndex<=0?i.length-1:this._activeMenuItemIndex-1),e==="ArrowDown"&&(this._activeMenuItemIndex=this._activeMenuItemIndex===i.length-1?0:this._activeMenuItemIndex+1),n!==this._activeMenuItemIndex&&r&&Dpt(i[this._activeMenuItemIndex],r)}_scrollToTopSuggestion(){this._suggestionListNode&&(this._suggestionListNode.scrollTop=0)}_openSuggestionMenu(){this.activeMenu="suggestion"}_handleInputPaste(e){const i=e.target;this.viewModel.searchTerm!==i.value&&(this.viewModel.searchTerm=i.value),this.viewModel.searchTerm&&this.suggest()}_handleSourceMenuKeydown(e){var r;const i=Mf(e);if(NM(i)){e.preventDefault();const n=(r=this._sourceListNode)==null?void 0:r.getElementsByTagName("li"),s=n==null?void 0:n[this._activeMenuItemIndex];this._setSourceFromMenuItem(s)}else i!=="ArrowUp"&&i!=="ArrowDown"&&i!=="End"&&i!=="Home"||e.preventDefault()}_handleSourceMenuKeyup(e){var s,o,a;const i=Mf(e),r=i==="ArrowUp"||i==="ArrowDown"||i==="End"||i==="Home";if(r&&e.preventDefault(),i==="Escape")return this._clearActiveMenu(),void((s=this._sourceMenuButtonNode)==null?void 0:s.focus());const n=(o=this._sourceListNode)==null?void 0:o.getElementsByTagName("li");return n&&n.length!==0&&r?(this.activeMenu!=="source"&&(this.activeMenu="source"),void this._handleItemNavigation(i,n,(a=this._sourceListNode)==null?void 0:a.parentElement)):void 0}_focus(e){this.focus(),e&&(this.activeMenu=e)}_formSubmit(e){e.preventDefault(),this._activeMenuItemIndex===-1&&this.search()}_getSourceName(e){const{messages:i}=this,r=this.viewModel,{allSources:n}=r,s=n.at(e);return e===rO.ALL_INDEX?i.all:s&&s.name||i.untitledSource}_getSuggestResultHTML(e,i){return e?lBt.test(e)?e:cBt(e,i):this.messages.untitledResult}_renderSearchResultsContent(){return this._searchResultRenderer.showMoreResultsOpen=!1,this._searchResultRenderer.viewModel=this.viewModel,this._searchResultRenderer}};function Nxe(t){return t==null?void 0:t["data-suggestion"]}function uBt(t){return t==null?void 0:t["data-source-index"]}function hBt(t){return!!(t!=null&&t["data-current-location-item"])}y([w()],_r.prototype,"_activeMenuItemIndex",void 0),y([w()],_r.prototype,"displayedSearchTerm",null),y([w({readOnly:!0})],_r.prototype,"inputId",null),y([w({readOnly:!0})],_r.prototype,"suggestionsMenuId",null),y([w({readOnly:!0})],_r.prototype,"sourceMenuId",null),y([w({readOnly:!0})],_r.prototype,"sourceMenuButtonId",null),y([w()],_r.prototype,"activeMenu",void 0),y([w({readOnly:!0})],_r.prototype,"activeSource",null),y([w()],_r.prototype,"activeSourceIndex",null),y([w()],_r.prototype,"allPlaceholder",null),y([w({readOnly:!0})],_r.prototype,"allSources",null),y([w()],_r.prototype,"autoNavigate",null),y([w()],_r.prototype,"autoSelect",null),y([w({readOnly:!0})],_r.prototype,"defaultSources",null),y([w()],_r.prototype,"disabled",void 0),y([w()],_r.prototype,"goToOverride",null),y([w()],_r.prototype,"iconClass",void 0),y([w()],_r.prototype,"icon",void 0),y([w()],_r.prototype,"includeDefaultSources",null),y([w()],_r.prototype,"label",null),y([w()],_r.prototype,"locationEnabled",null),y([w()],_r.prototype,"maxResults",null),y([w()],_r.prototype,"maxSuggestions",null),y([w(),Gr("esri/widgets/Search/t9n/Search")],_r.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],_r.prototype,"messagesCommon",void 0),y([w()],_r.prototype,"minSuggestCharacters",null),y([w()],_r.prototype,"popupEnabled",null),y([w()],_r.prototype,"popupTemplate",null),y([w()],_r.prototype,"portal",null),y([w()],_r.prototype,"resultGraphic",null),y([w()],_r.prototype,"resultGraphicEnabled",null),y([w({readOnly:!0})],_r.prototype,"results",null),y([w()],_r.prototype,"searchAllEnabled",null),y([w()],_r.prototype,"searchTerm",null),y([w({readOnly:!0})],_r.prototype,"selectedResult",null),y([w()],_r.prototype,"sources",null),y([w({readOnly:!0})],_r.prototype,"suggestions",null),y([w()],_r.prototype,"suggestionsEnabled",null),y([w()],_r.prototype,"view",null),y([gue(["search-complete","search-clear","search-start","select-result","suggest-start","suggest-complete"]),w({type:rO})],_r.prototype,"viewModel",void 0),_r=y([Z("esri.widgets.Search")],_r);const dBt=_r;function pBt(t,e){for(var i=0;ir[n]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var SBe={exports:{}};(function(t,e){function i(){function n(m){if(typeof m=="number")return re.Tc.Zg(m);if(m==null)return null;if(mi[m]!=null)return re.Tc.Zg(mi[m]);throw Error("Unrecognised Unit Type")}function s(m){if(typeof m=="number")return re.Tc.Zg(m);if(m==null)return null;if(Dr[m]!=null)return re.Tc.Zg(Dr[m]);throw Error("Unrecognised Unit Type")}function o(m){if(m)switch(m){case"loxodrome":return 1;case"great-elliptic":return 2;case"normal-section":return 3;case"shape-preserving":return 4}return 0}function a(m,D,E,f){if(E==null||E.B())return null;switch(E.getType()){case re.qn.Point:return m.exportPoint(D,E,f);case re.qn.Polygon:return m.exportPolygon(D,E,f);case re.qn.Polyline:return m.exportPolyline(D,E,f);case re.qn.MultiPoint:return m.exportMultipoint(D,E,f);case re.qn.Envelope:return m.exportExtent(D,E,f)}return null}function c(m,D,E,f){if(E.getType()!==re.qn.Point)throw Error("Geometry not Point");return m.exportPoint(D,E,f)}function p(m,D,E){return m.convertToGEGeometry(D,E)}function _(m){var D=m.wkid;m=m.wkt2||m.wkt;var E=Nr.get(D||m);return E==null&&(D!==-1&&D!=null?(E=re.Eg.create(D),Nr.set(D,E)):m&&(E=re.Eg.qP(m),Nr.set(m,E)),xi.has(D||m)&&E.VW(xi.get(D||m))),E}function x(m){var D,E,f;if(m==null)return null;var h=_(m);return m=h.Hd(),h=h.Kn(),(D={}).tolerance=h,D.unitType=m==null?-1:m.od,D.unitID=m==null?-1:m.Ec(),D.unitBaseFactor=m==null?0:m.ai,D.unitSquareDerivative=m==null?0:(f=(E=re.Tc.aG(m))===null||E===void 0?void 0:E.Ec())!==null&&f!==void 0?f:0,D}function S(m,D,E,f){return E==null?null:(E=re.$b.clip(p(m,Ze,E),p(m,Ze,f),_(D)),a(m,Ze,E,D))}function C(m,D,E,f){E=re.$b.dl(p(m,Ze,E),p(m,Ze,f),_(D)),f=[];for(var h=0;h>6)>>1},f.Rn=function(h){return(32&h)!=0},f.US=function(h){return(128&h)!=0},f.yd=function(h){return(256&h)!=0},f.xj=function(h){return(512&h)!=0},f.Hc=function(h){return(1024&h)!=0},f.prototype.Of=function(){var h=this.Ia();return this.copyTo(h),h},f.prototype.mg=function(){return null},f.jg=function(h){var l=h.Ia();return h.copyTo(l),l},f.prototype.vc=function(){0<=this.VA&&(this.VA+=2147483649)},f.Ax=function(h){var l=h.getType();if(f.xj(l))return h.I();if(h.B())return 0;if(l==197)return 4;if(l==33)return 1;if(f.yd(l))return 2;throw m.i.fa("missing type")},f}();m.aa=E})(re||(re={})),Ht=re||(re={}),hr=function(){function m(){this.y=this.x=0}return m.construct=function(D,E){var f=new m;return f.x=D,f.y=E,f},m.al=function(D){var E=new m;return E.x=D.x,E.y=D.y,E},m.prototype.ma=function(D,E){this.x=D,this.y=E},m.prototype.L=function(D){this.x=D.x,this.y=D.y},m.prototype.fq=function(D,E){return this.x===D&&this.y===E},m.prototype.Rz=function(D){return 2220446049250313e-31>=Math.abs(this.x-D.x)&&2220446049250313e-31>=Math.abs(this.y-D.y)},m.prototype.qb=function(D){return this.x===D.x&&this.y===D.y},m.prototype.Nb=function(D){return D==this||D instanceof m&&this.x==D.x&&this.y==D.y},m.prototype.sub=function(D){this.x-=D.x,this.y-=D.y},m.prototype.uc=function(D,E){this.x=D.x-E.x,this.y=D.y-E.y},m.prototype.add=function(D,E){E!==void 0?(this.x=D.x+E.x,this.y=D.y+E.y):(this.x+=D.x,this.y+=D.y)},m.prototype.Sq=function(){this.x=-this.x,this.y=-this.y},m.prototype.mt=function(D){this.x=-D.x,this.y=-D.y},m.prototype.NS=function(D,E,f){this.x=D.x*(1-f)+E.x*f,this.y=D.y*(1-f)+E.y*f},m.prototype.Ct=function(D,E){this.x=this.x*D+E.x,this.y=this.y*D+E.y},m.prototype.HW=function(D,E,f){this.x=E.x*D+f.x,this.y=E.y*D+f.y},m.prototype.scale=function(D){this.x*=D,this.y*=D},m.prototype.compare=function(D){return this.yD.y?1:this.xD.x?1:0},m.prototype.normalize=function(){var D=this.length();D==0&&(this.x=1,this.y=0),this.x/=D,this.y/=D},m.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},m.prototype.Sk=function(){return this.x*this.x+this.y*this.y},m.tb=function(D,E){return Math.sqrt(this.yc(D,E))},m.Oy=function(D,E,f,h){return D-=f,E-=h,Math.sqrt(D*D+E*E)},m.prototype.Qh=function(D){return this.x*D.x+this.y*D.y},m.prototype.fD=function(D){return Math.abs(this.x*D.x)+Math.abs(this.y*D.y)},m.prototype.wi=function(D){return this.x*D.y-this.y*D.x},m.prototype.Bt=function(D,E){var f=-this.x*E+this.y*D;this.x=this.x*D+this.y*E,this.y=f},m.prototype.Hv=function(){var D=this.x;this.x=-this.y,this.y=D},m.prototype.MG=function(D){this.x=-D.y,this.y=D.x},m.prototype.ar=function(){var D=this.x;this.x=this.y,this.y=-D},m.prototype.qu=function(){return 0(D=D.wi(E))?1:0(f=h.value())?-1:0f?-1:0=l?f+(h-f)*l:h-(h-f)*(1-l)},E.OG=function(f,h,l,u){.5>=l?(u.x=f.x+(h.x-f.x)*l,u.y=f.y+(h.y-f.y)*l):(u.x=h.x-(h.x-f.x)*(1-l),u.y=h.y-(h.y-f.y)*(1-l))},E.lT=function(f,h,l,u,d,g){.5>=d?(g.x=f+(l-f)*d,g.y=h+(u-h)*d):(g.x=l-(l-f)*(1-d),g.y=u-(u-h)*(1-d))},E}()}(re||(re={})),function(m){var D=function(E){function f(){var h=E.call(this)||this;return h.sa=0,h.na=0,h.pa=0,h.la=0,h.ka=null,h}return Ke(f,E),f.prototype.ac=function(){return m.h.construct(this.sa,this.na)},f.prototype.Yp=function(h){h.x=this.sa,h.y=this.na},f.prototype.Dc=function(h){this.em(0,h)},f.prototype.ZB=function(h,l){this.em(0,m.h.construct(h,l))},f.prototype.To=function(h){this.hD(0,h)},f.prototype.setStart=function(h){this.uD(0,h)},f.prototype.wv=function(h,l){return this.Od(0,h,l)},f.prototype.YB=function(h,l,u){this.tn(0,h,l,u)},f.prototype.wc=function(){return m.h.construct(this.pa,this.la)},f.prototype.Tr=function(h){h.x=this.pa,h.y=this.la},f.prototype.Qc=function(h){this.em(1,h)},f.prototype.Ql=function(h,l){this.em(1,m.h.construct(h,l))},f.prototype.Po=function(h){this.hD(1,h)},f.prototype.setEnd=function(h){this.uD(1,h)},f.prototype.gv=function(h,l){return this.Od(1,h,l)},f.prototype.OB=function(h,l,u){this.tn(1,h,l,u)},f.prototype.Db=function(){return 1},f.prototype.B=function(){return this.Ac()},f.prototype.Oa=function(){},f.prototype.Ke=function(){return 0},f.prototype.Ea=function(h,l,u,d,g){return this.KM(h,l,u,d,g)},f.prototype.isIntersecting=function(h,l){return this.zr(h,l,!1)!=0},f.prototype.qs=function(h,l){return this.ru(h,l,!1)},f.prototype.ru=function(){return null},f.prototype.Ac=function(){return!1},f.prototype.ay=function(h){if(this.vc(),this.ka==null&&0=m.ra.Va(l))throw m.i.ce();var d=this.description.Pf(l);return 0<=d?(this.ka!=null&&this.ay(this.description.Ae.length-2),this.ka[f.Gg(this.description,h)+this.description.$j(d)-2+u]):m.ra.se(l)},f.prototype.tn=function(h,l,u,d){if(this.vc(),u>=m.ra.Va(l))throw m.i.ce();var g=this.description.Pf(l);0>g&&(this.re(l),g=this.description.Pf(l)),l==0?h!=0?u!=0?this.la=d:this.pa=d:u!=0?this.na=d:this.sa=d:(this.ka==null&&this.ay(this.description.Ae.length-2),this.ka[f.Gg(this.description,h)+this.description.$j(g)-2+u]=d)},f.prototype.copyTo=function(h){if(h.getType()!=this.getType())throw m.i.N();h.description=this.description,h.ay(this.description.Ae.length-2),f.gM(this.ka,h.ka,2*(this.description.Ae.length-2)),h.sa=this.sa,h.na=this.na,h.pa=this.pa,h.la=this.la,h.vc(),this.op(h)},f.prototype.Tg=function(h,l){var u=new m.Nc;return this.Ac()?(u.Oa(),u):(u.oa=this.Od(0,h,l),u.va=u.oa,u.Lk(this.Od(1,h,l)),u)},f.prototype.ZI=function(h){this.Ac()?h.Oa():(h.oa=this.Od(0,0,0),h.va=h.oa,h.Lk(this.Od(1,0,0)))},f.prototype.Tw=function(h,l){l.Nf(this.description),l.Cb(this.hc(h));for(var u=1,d=this.description.Aa;ul||l>=this.wa)throw m.i.fa("index out of bounds");this.mc(),u.Nf(this.description),u.B()&&u.un();for(var d=0;dl||l>=this.I())throw m.i.ce();this.mc(),this.za[0].tc(2*l,u)},h.prototype.Na=function(l){var u=new m.h;return this.D(l,u),u},h.prototype.Gc=function(l,u){this.za[0].tc(2*l,u)},h.prototype.Cb=function(l,u,d){if(0>l||l>=this.wa)throw m.i.ce();this.mc();var g=this.za[0];d!==void 0?(g.write(2*l,u),g.write(2*l+1,d)):g.Tt(2*l,u),this.Pc(1993)},h.prototype.Cz=function(){if(void 0>=this.I())throw m.i.ce();this.mc();var l=this.za[0],u=new m.Nd;return u.x=l.read(NaN),u.y=l.read(NaN),u.z=this.hasAttribute(1)?this.za[1].eg():m.ra.se(1),u},h.prototype.dC=function(l){if(0>l||l>=this.I())throw m.i.ce();this.re(1),this.mc(),this.Pc(1993);var u=this.za[0];u.write(2*l,(void 0).x),u.write(2*l+1,(void 0).y),this.za[1].pr(l,(void 0).z)},h.prototype.Uc=function(l,u,d){if(0>u||u>=this.wa)throw m.i.ce();var g=m.ra.Va(l);if(d>=g)throw m.i.ce();this.mc();var v=this.description.Pf(l);return 0<=v?this.za[v].eg(u*g+d):m.ra.se(l)},h.prototype.yF=function(l,u){return this.Uc(l,u)},h.prototype.setAttribute=function(l,u,d,g){if(0>u||u>=this.wa)throw m.i.ce();var v=m.ra.Va(l);if(d>=v)throw m.i.ce();this.re(l),this.mc(),l=this.description.Pf(l),this.Pc(1993),this.za[l].pr(u*v+d,g)},h.prototype.ub=function(l){return this.wx(),this.re(l),this.mc(),this.za[this.description.Pf(l)]},h.prototype.hn=function(l,u){if(u!=null&&m.ra.Tp(l)!=u.Tp())throw m.i.N();this.re(l),l=this.description.Pf(l),this.za==null&&(this.za=m.Yc.qI(this.description.Aa)),this.za[l]=u,this.Pc(16777215)},h.prototype.sn=function(l){var u=null;if(this.za!=null){var d=m.ee.Iw(l,this.description);u=[];for(var g=0,v=l.Aa;gthis.wa+5?(5*this.wa+3)/4:this.wa),this.za[l].resize(g*d,m.ra.se(u))),gl)throw m.i.N();l!=this.wa&&(this.wa=l,this.Pc(65535))},h.prototype.om=function(l){if(!this.ak(1)){if(!this.ak(2))return 0;if(this.QT>=l)return this.ak(8)?1:2}return-1},h.prototype.Ch=function(l,u){if(this.QT=u,l==-1)this.Lf(1,!0),this.Lf(8,!0);else if(this.Lf(1,!1),this.Lf(8,!0),l==0)this.Lf(2,!1),this.Lf(4,!1);else if(l==1)this.Lf(2,!0),this.Lf(4,!1);else{if(l!=2)throw m.i.fa("internal error.");this.Lf(2,!0),this.Lf(4,!0)}},h.prototype.lM=function(){this.Bb!=null&&(this.Bb=null)},h.prototype.kD=function(l,u,d,g){if(0>l||l>=this.wa||0>u||u>=this.wa)throw m.i.fa("index out of bounds");this.mc(),g.Nf(this.description),g.B()&&g.un();for(var v=0;vl||l>=this.wa)throw m.i.ce();this.mc();var u=new m.Sa;u.Nf(this.description),u.B()&&u.un();for(var d=0;dl||l>=this.wa)throw m.i.ce();if(u.B())throw m.i.N();this.mc();for(var d=u.description,g=0;gm.O.bB(this.Tm)>>1:h!=-1)?f=h:u=v,h=!0;;){if(0>u){if((v=g[7*f])==-1){u=f,l=this.ob.Ll([-1,-1,f,l,this.gl(),-1,-1]),(g=this.ob.o)[7*f]=l;break}f=v}else{if((v=g[7*f+1])==-1){u=g[7*f+6],l=this.ob.Ll([-1,-1,f,l,this.gl(),-1,-1]),(g=this.ob.o)[7*f+1]=l;break}f=v}h&&(u*=-1,h=!1)}return this.oy(l,g),g[7*l+2]===-1&&(g[7*d]=l),this.vp(u,l,d,g),l},E.prototype.FF=function(){return this.iR(this.Qe)},E.prototype.vd=function(f,h){h=h==-1?this.Qe:h,this.Rv?this.LP(f,h):this.iY(f,h)},E.prototype.search=function(f,h){for(h=this.sv(h);h!=-1;){var l=this.Zn.compare(this,f,h);if(l==0)return h;h=0>l?this.ll(h):this.Xp(h)}return-1},E.prototype.IW=function(f){for(var h=this.sv(-1),l=-1;h!=-1;){var u=f.compare(this,h);if(u==0)return h;0>u?h=this.ll(h):(l=h,h=this.Xp(h))}return l},E.prototype.uJ=function(f){for(var h=this.sv(-1),l=-1;h!=-1;){var u=f.compare(this,h);if(u==0)return h;0>u?(l=h,h=this.ll(h)):h=this.Xp(h)}return l},E.prototype.ja=function(f){return this.ob.T(f,3)},E.prototype.ll=function(f){return this.ob.T(f,0)},E.prototype.Xp=function(f){return this.ob.T(f,1)},E.prototype.getParent=function(f){return this.ob.T(f,2)},E.prototype.lb=function(f){return this.ob.T(f,6)},E.prototype.we=function(f){return this.ob.T(f,5)},E.prototype.rc=function(f){return f==-1?this.kl(this.Qe):this.kl(f)},E.prototype.Fc=function(f){return f==-1?this.Zr(this.Qe):this.Zr(f)},E.prototype.ZR=function(f){return f==-1?this.bG(this.Qe):this.bG(f)},E.prototype.Sj=function(f,h){this.NB(f,h)},E.prototype.sv=function(f){return f==-1?this.YF(this.Qe):this.YF(f)},E.prototype.clear=function(){this.ob.mj(!1),this.Qe=-1},E.prototype.size=function(f){return f==-1?this.$F(this.Qe):this.$F(f)},E.prototype.KN=function(f,h){for(var l=h[7*f],u=h[7*f+1],d=h[7*f+4];l!=-1||u!=-1;){var g=l!=-1?h[7*l+4]:2147483647;if(u=u!=-1?h[7*u+4]:2147483647,d<=Math.min(g,u))break;g<=u?this.sJ(l,h):this.rJ(f,h),l=h[7*f],u=h[7*f+1]}},E.prototype.oy=function(f,h){if(this.Rv)for(var l=h[7*f+4],u=h[7*f+2];u!=-1&&h[7*u+4]>l;)h[7*u]==f?this.sJ(f,h):this.rJ(u,h),u=h[7*f+2]},E.prototype.rJ=function(f,h){var l=h[7*f+1];h[7*l+2]=h[7*f+2],h[7*f+2]=l;var u=h[7*l];h[7*f+1]=u,u!=-1&&(h[7*u+2]=f),h[7*l]=f,(u=h[7*l+2])!=-1&&(h[7*u]==f?h[7*u]=l:h[7*u+1]=l)},E.prototype.sJ=function(f,h){var l=h[7*f+2];h[7*f+2]=h[7*l+2],h[7*l+2]=f;var u=h[7*f+1];h[7*l]=u,u!=-1&&(h[7*u+2]=l),h[7*f+1]=l,(u=h[7*f+2])!=-1&&(h[7*u]===l?h[7*u]=f:h[7*u+1]=f)},E.prototype.Pk=function(f,h){this.ob.S(f,2,h)},E.prototype.TB=function(f,h){this.ob.S(f,0,h)},E.prototype.XB=function(f,h){this.ob.S(f,1,h)},E.prototype.WB=function(f,h){this.ob.S(f,5,h)},E.prototype.ex=function(f,h){this.ob.S(f,6,h)},E.prototype.XJ=function(f,h){this.ob.S(h,0,f)},E.prototype.rX=function(f){this.ob.S(f,4,0)},E.prototype.uX=function(f,h){this.ob.S(h,5,f)},E.prototype.YF=function(f){return f==-1?-1:this.ob.T(f,0)},E.prototype.kl=function(f){return f==-1?-1:this.ob.T(f,1)},E.prototype.Zr=function(f){return f==-1?-1:this.ob.T(f,2)},E.prototype.iR=function(f){return f==-1?-1:this.ob.T(f,3)},E.prototype.$F=function(f){return f==-1?0:this.ob.T(f,4)},E.prototype.bG=function(f){return this.ob.T(f,5)},E.prototype.Pw=function(){return this.ob.Ll([-1,-1,-1,void 0,this.gl(),-1,-1])},E.prototype.fl=function(f){f!=-1&&this.ob.jd(f)},E.prototype.gl=function(){return this.Tm=m.O.bB(this.Tm),1073741823&this.Tm},E.prototype.FD=function(f,h,l){var u=this.ob.o;if(l==-1||u[7*l]==-1)return f=this.ob.Ll([-1,-1,-1,f,this.gl(),-1,-1]),(u=this.ob.o)[7*l]=f,this.vp(-1,f,l,u),f;for(var d=l==-1?-1:u[7*l];;){var g=h==-1?1:this.Zn.compare(this,f,d);if(0>g){if((g=this.ll(d))==-1){h=d,f=this.ob.Ll([-1,-1,d,f,this.gl(),-1,-1]),(u=this.ob.o)[7*d]=f;break}d=g}else{if(h==1&&g==0)return u[7*l+3]=d,-1;if((g=u[7*d+1])==-1){h=u[7*d+6],f=this.ob.Ll([-1,-1,d,f,this.gl(),-1,-1]),(u=this.ob.o)[7*d+1]=f;break}d=g}}return this.oy(f,u),u[7*f+2]===-1&&(u[7*l]=f),this.vp(h,f,l,u),f},E.prototype.vp=function(f,h,l,u){if(f!=-1){var d=u[7*f+5];u[7*f+5]=h}else d=l==-1?-1:u[7*l+2];u[7*h+5]=d,d!=-1&&(u[7*d+6]=h),u[7*h+6]=f,f==(l==-1?-1:u[7*l+1])&&(u[7*l+1]=h),f==-1&&(u[7*l+2]=h),u[7*l+4]=(l==-1?0:u[7*l+4])+1},E.prototype.AB=function(f,h){var l=this.ob.o,u=l[7*f+5];f=l[7*f+6],u!=-1?l[7*u+6]=f:l[7*h+1]=f,f!=-1?l[7*f+5]=u:l[7*h+2]=u,l[7*h+4]=h===-1?-1:l[7*h+4]-1},E.prototype.iY=function(f,h){this.AB(f,h);var l=this.ll(f),u=this.Xp(f),d=this.getParent(f),g=f;if(l!=-1&&u!=-1){this.Tm=m.O.bB(this.Tm);var v=1073741823=f.oa:f.va>=this.oa},E.prototype.move=function(f){this.B()||(this.oa+=f,this.va+=f)},E.prototype.normalize=function(){if(!isNaN(this.oa)){if(this.oa>this.va){var f=this.oa;this.oa=this.va,this.va=f}isNaN(this.va)&&this.Oa()}},E.prototype.Oa=function(){this.va=this.oa=NaN},E.prototype.B=function(){return isNaN(this.oa)},E.prototype.Zb=function(f){typeof f=="number"?this.B()?this.va=this.oa=f:this.Lk(f):f.B()||(this.B()?(this.oa=f.oa,this.va=f.va):(this.oa>f.oa&&(this.oa=f.oa),this.vathis.va&&this.Oa()))},E.prototype.Lk=function(f){fthis.va&&(this.va=f)},E.prototype.contains=function(f){return typeof f=="number"?f>=this.oa&&f<=this.va:f.oa>=this.oa&&f.va<=this.va},E.prototype.Ea=function(f){this.B()||f.B()?this.Oa():(this.oaf.va&&(this.va=f.va),this.oa>this.va&&this.Oa())},E.prototype.W=function(f){this.B()||(this.oa-=f,this.va+=f,this.vah?(this.oa=h,this.va=f):(this.oa=f,this.va=h)},E.prototype.It=function(f){return m.O.Rk(f,this.oa,this.va)},E.prototype.R=function(){return this.va-this.oa},E.prototype.sf=function(){return .5*(this.oa+this.va)},E.prototype.Nb=function(f){return f==this||f instanceof E&&(!(!this.B()||!f.B())||this.oa==f.oa&&this.va==f.va)},E.prototype.cc=function(){return m.O.uj(m.O.uj())},E}();m.Nc=D}(re||(re={})),function(m){var D=new m.Nc,E=new m.Nc,f=function(){this.ne=null,this.pb=-1,this.sb=new m.yb,this.qA=55555555,this.Tv=this.Vv=!1,this.Uf=new m.Nc,this.Uf.KB(0,0)};m.IY=f;var h=function(){function l(u,d,g){this.g=u,this.Hk=NaN,this.NH=this.Kq=0,this.OH=NaN,this.qa=d,this.Nq=10*d,this.PH=this.QH=NaN,this.rg=!1,this.Dm=this.gt=this.Lo=this.Xs=this.Ws=-1,this.gA=g,this.TA=new f,this.YH=new f,m.O.truncate(3*u.fd/2)}return l.prototype.mG=function(u,d,g,v){u.ne=v===null?null:v[g[5*d]],u.Tv=u.ne!=null,u.Tv||((v=g[5*d+2])!==-1&&this.g.mW(g[5*d],g[5*v],u.sb),u.ne=u.sb,u.Uf.KB(u.sb.sa,u.sb.pa),u.Uf.va+=this.qa,u.sb.rI(),u.Vv=u.sb.la==u.sb.na,u.Vv||(u.qA=(u.sb.pa-u.sb.sa)/(u.sb.la-u.sb.na)))},l.prototype.OO=function(u,d){var g=u.zr(d,this.qa,!0);return g!=0?g==2?this.Qy():this.xi():(u.Yp(vt),u.Tr(Bt),d.Yp(qt),d.Tr(li),Lt.ma(this.Kq,this.Hk),vt.qb(qt)&&this.Hk==vt.y?0>Bt.compare(li)?Lt.L(Bt):Lt.L(li):vt.qb(li)&&this.Hk==vt.y?0>Bt.compare(qt)?Lt.L(Bt):Lt.L(qt):qt.qb(Bt)&&this.Hk==qt.y?0>vt.compare(li)?Lt.L(vt):Lt.L(li):Bt.qb(li)&&this.Hk==Bt.y&&(0>vt.compare(qt)?Lt.L(vt):Lt.L(qt)),u.Pe(Lt.y,Lt.x)g&&0>u?-1:0d.pa){if(d.pa>d.sa&&d.la-d.na<2*this.qa&&u.vi(d.pa,d.la,this.qa))return this.xi()}else if((d.la-d.na)/(d.pa-d.sa)*(u.pa-u.sa)d.sa&&d.la-d.na<2*this.qa&&u.vi(d.pa,d.la,this.qa))return this.xi()}else if((d.la-d.na)/(d.pa-d.sa)*(u.sa-u.pa)v&&0>g?-1:0d+T?g:v.vi(u.sa,u.na,this.qa)?this.xi():bd+T?g:v.vi(u.pa,u.la,this.qa)?this.xi():bb?1:0)},l.prototype.Kr=function(){this.rg=!1},l.prototype.rm=function(){return this.Ni},l.prototype.$J=function(u,d){this.Hk=u,this.Kq=d,this.gt=this.Lo=this.Xs=this.Ws=-1},l.prototype.compare=function(u,d,g){return this.rg?-1:(u=u.ja(g),this.Dm=g,this.RE(d,d,u,u))},l.prototype.RE=function(u,d,g,v){if(this.Lo==d)var b=this.TA;else this.Lo=d,b=this.TA,this.TA.pb=u,this.mG(b,d,this.g.td.o,this.g.We);if(T==null){this.gt=v;var T=this.YH;this.YH.pb=g,this.mG(T,v,this.g.td.o,this.g.We)}return b.Tv||T.Tv?this.NO(d,v,b,T):b.Uf.vathis.Uf.va)return 1;if(this.ie.na==this.ie.la)return this.Dm=f,this.rg=!0,0;this.ie.rI(),l=this.ie.ac(),(h=new m.h).uc(this.ie.wc(),l),h.ar();var u=new m.h;return u.uc(this.Gq,l),l=h.Qh(u),(l/=h.length())<10*-this.qa?-1:l>10*this.qa?1:this.ie.qs(this.Gq,this.qa)&&((h=Math.abs(l))l?-1:1},E}();m.aM=D}(re||(re={})),function(m){function D(f,h,l,u){l=new Float64Array(f.subarray(l,u)),f.set(l,h)}var E=function(){function f(h){this.Pb=this.pk=!1,this.o=null;var l=h;2>l&&(l=2),this.o=new Float64Array(l),this.size=h}return f.prototype.rotate=function(h,l,u){if(this.Pb)throw m.i.fa("invalid_call");if(lu||h>u)throw m.i.N();h!=l&&u!=l&&(this.ni(h,l-h,1),this.ni(l,u-l,1),this.ni(h,u-h,1))},f.qf=function(h,l){var u=new f(h),d=u.o;if(2>h&&(h=2),l!==0)for(var g=0;gl&&(u.size=l),2>(l=u.size)&&(l=2),u.o=new Float64Array(l),u.o.set(h.o.length<=l?h.o:h.o.subarray(0,l),0),u},f.prototype.Jb=function(h){0>=h||(this.o==null?this.o=new Float64Array(h):h<=this.o.length||(0this.o.length&&(u=m.O.truncate(64>h?Math.max(2*h,4):5*h/4),(u=new Float64Array(u)).set(this.o),this.o=u),u=this.o;for(var d=this.size;dthis.o.length)&&this.resize(h),this.pk)throw m.i.fa("invalid call. Attribute Stream is locked and cannot be resized.");this.size=h},f.prototype.pr=function(h,l){this.write(h,l)},f.prototype.An=function(h,l,u){for(var d=this.size;ld||u>g&&d!=g)return!1;for(u>d&&(u=d);lg||u%g!=0))throw m.i.N();var v=this.size;if(this.resize(v+u),d)this.o.set(h.o.subarray(l,l+u),v);else{d=u;for(var b=0;bv||d%v!=0))throw m.i.N();var T=this.size-b;if(Tv&&(v=this.size),this.size+2*d>this.o.length?this.resize(this.size+2*d):this.size+=2*d,D(this.o,h+2*d,h,h+(v-h)),g)for(g=0;gh||0>l||0>d||!g&&(0>=v||l%v!=0)||u.sizethis.size)throw m.i.Hb();0u||l%u!=0)throw m.i.Hb();for(var d=l>>1,g=0;gl||0>u||0>l||u+l>this.size)throw m.i.N();for(var d=l;dh||0>l||0>d)throw m.i.N();if(l!=0)for(this.size<(l<<1)+h&&this.resize((l<<1)+h),g||(h+=l-1<<1),g=g?2:-2,l+=d;dh||0>l)throw m.i.N();if(l!=0){this.size<(l<<1)+h&&this.resize((l<<1)+h),l+=0;for(var d=0;dh||0>l||0>d||this.sizeh||0>l||this.size<(l>>1)+h)throw m.i.N();if(l!=0){l=0+l;for(var d=0;dl&&(l=2),this.o=new Int32Array(l),this.size=h}return f.prototype.rotate=function(h,l,u){if(this.Pb)throw m.i.fa("invalid_call");if(lu||h>u)throw m.i.N();h!=l&&u!=l&&(this.ni(h,l-h,1),this.ni(l,u-l,1),this.ni(h,u-h,1))},f.qf=function(h,l){var u=new f(h),d=u.o;if(2>h&&(h=2),l!==0)for(var g=0;gl&&(u.size=l),2>(l=u.size)&&(l=2),u.o=new Int32Array(l),u.o.set(h.o.length<=l?h.o:h.o.subarray(0,l),0),u},f.prototype.Jb=function(h){0>=h||(this.o==null?this.o=new Int32Array(h):h<=this.o.length||(0this.o.length&&(u=m.O.truncate(64>h?Math.max(2*h,4):5*h/4),(u=new Int32Array(u)).set(this.o),this.o=u),u=this.o;for(var d=this.size;dthis.o.length)&&this.resize(h),this.pk)throw m.i.fa("invalid call. Attribute Stream is locked and cannot be resized.");this.size=h},f.prototype.pr=function(h,l){this.write(h,l)},f.prototype.An=function(h,l,u){for(var d=this.size;ld||u>g&&d!=g)return!1;for(u>d&&(u=d);lg||u%g!=0))throw m.i.N();var v=this.size;if(this.resize(v+u),d)this.o.set(h.o.subarray(l,l+u),v);else{d=u;for(var b=0;bv||d%v!=0))throw m.i.N();if(D(this.o,h+d,h,h+(b-h)),this.o==l.o&&hv&&(v=this.size),this.size+2*d>this.o.length?this.resize(this.size+2*d):this.size+=2*d,D(this.o,h+2*d,h,h+(v-h)),g)for(g=0;gh||0>l||0>d||!g&&(0>=v||l%v!=0)||u.sizethis.size)throw m.i.Hb();0u||l%u!=0)throw m.i.Hb();for(var d=l>>1,g=0;gl||0>u||0>l||u+l>this.size)throw m.i.N();for(var d=l;dh||0>l||0>d)throw m.i.N();if(l!=0)for(this.size<(l<<1)+h&&this.resize((l<<1)+h),g||(h+=l-1<<1),g=g?2:-2,l+=d;dh||0>l||0>d||this.sizel-h?f.rG(this.o,h,l,u):f.qB(this.o,h,l-1,u)},f.prototype.Tp=function(){return 2},f.prototype.Fc=function(){return this.o[this.size-1]},f.prototype.If=function(){this.resize(this.size-1)},f.prototype.bX=function(h){this.o[this.size-1]=h},f.prototype.SV=function(h){h=l&&0=u))for(;;){if(9>u-l){f.rG(h,l,u+1,d);break}var g=h[l];f.tx(h,l,u);for(var v=l,b=l;b=d(h[b],g)&&(f.tx(h,v,b),v+=1);f.tx(h,v,u),v-ll&&(l=2),this.o=new Int8Array(l),this.size=h}return f.prototype.rotate=function(h,l,u){if(this.Pb)throw m.i.fa("invalid_call");if(lu||h>u)throw m.i.N();h!=l&&u!=l&&(this.ni(h,l-h,1),this.ni(l,u-l,1),this.ni(h,u-h,1))},f.qf=function(h,l){var u=new f(h),d=u.o;if(2>h&&(h=2),l!==0)for(var g=0;gl&&(u.size=l),2>(l=u.size)&&(l=2),u.o=new Int8Array(l),u.o.set(h.o.length<=l?h.o:h.o.subarray(0,l),0),u},f.prototype.Jb=function(h){0>=h||(this.o==null?this.o=new Int8Array(h):h<=this.o.length||(0this.o.length&&(u=m.O.truncate(64>h?Math.max(2*h,4):5*h/4),(u=new Int8Array(u)).set(this.o),this.o=u),u=this.o;for(var d=this.size;dthis.o.length)&&this.resize(h),this.pk)throw m.i.fa("invalid call. Attribute Stream is locked and cannot be resized.");this.size=h},f.prototype.pr=function(h,l){this.write(h,l)},f.prototype.An=function(h,l,u){for(var d=this.size;ld||u>g&&d!=g)return!1;for(u>d&&(u=d);lg||u%g!=0))throw m.i.N();var v=this.size;if(this.resize(v+u),d)this.o.set(h.o.subarray(l,l+u),v);else{d=u;for(var b=0;bv||d%v!=0))throw m.i.N();if(D(this.o,h+d,h,h+(b-h)),this.o==l.o&&hv&&(v=this.size),this.size+2*d>this.o.length?this.resize(this.size+2*d):this.size+=2*d,D(this.o,h+2*d,h,h+(v-h)),g)for(g=0;gh||0>l||0>d||!g&&(0>=v||l%v!=0)||u.sizethis.size)throw m.i.Hb();0u||l%u!=0)throw m.i.Hb();for(var d=l>>1,g=0;gl||0>u||0>l||u+l>this.size)throw m.i.N();for(var d=l;dh||0>l||0>d)throw m.i.N();if(l!=0)for(this.size<(l<<1)+h&&this.resize((l<<1)+h),g||(h+=l-1<<1),g=g?2:-2,l+=d;dh||0>l||0>d||this.sizef?-f:f},E.ti=function(f){return 3552713678800501e-30>f},E.KC=function(f,h,l){return E.P(f-h)<=l*(1+(E.P(f)+E.P(h))/2)},E.Y=function(f,h){return E.KC(f,h,3552713678800501e-30)},E.FL=function(f){return 3552713678800501e-30>=E.P(f)},E.Cd=function(f){return E.FL(f)},E}();m.s=D,m.F=function(){function E(){}return E.gp=function(f,h){var l=0;return(f=D.P(f))+(h=D.P(h))!=0&&(f>h?(l=h/f,l=f*Math.sqrt(1+l*l)):(l=f/h,l=h*Math.sqrt(1+l*l))),l},E.Wq=function(f,h,l,u,d){for(var g=[0,0,0],v=[0,0,0],b=0;2>=b;b++)h[b]-=f[b],l[b]-=h[b];l=g[1]*v[2]-g[2]*v[1],h=g[2]*v[0]-g[0]*v[2],g=g[0]*v[1]-g[1]*v[0],f=-1*(l*f[0]+h*f[1]+g*f[2]),u[0]=l,u[1]=h,u[2]=g,u[3]=f,v=E.on(u),u[0]/=v,u[1]/=v,u[2]/=v,u[3]/=v,d!=0&&(v=D.Cd(g)?D.Cd(f)?D.Mb(1,h):-D.Mb(1,f):D.Mb(1,g),v*=D.Mb(1,d),u[0]*=v,u[1]*=v,u[2]*=v,u[3]*=v)},E.zx=function(f,h,l){l[0]=f[1]*h[2]-h[1]*f[2],l[1]=f[2]*h[0]-h[2]*f[0],l[2]=f[0]*h[1]-h[0]*f[1]},E.St=function(f,h){return f[0]*h[0]+f[1]*h[1]+f[2]*h[2]},E.on=function(f){return E.gp(E.gp(f[0],f[1]),f[2])},E.cl=function(f,h,l,u,d,g,v,b){f=E.n(f,h,l);var T=Math.cos(l);g.u=(f+d)*T*Math.cos(u),v.u=(f+d)*T*Math.sin(u),b.u=(f*(1-h)+d)*Math.sin(l)},E.jO=function(f,h,l,u,d,g,v){var b=E.gp(h,l),T=1*Math.sqrt(1-f),A=T/1;if(D.Y(b,0))g.u=0,d.u=D.Mb(1.570796326794897,u),v.u=D.P(u)-T;else{g.u=Math.atan2(l,h),l=Math.atan2(1*u,T*b),g=Math.cos(l);var O=Math.sin(l);h=T*f/(1-f),f*=1,l=Math.atan2(u+h*O*O*O,b-f*g*g*g),3.141592653589793f){var l=Math.sqrt(1-f),u=(1-l)/(1+l),d=u*u,g=u*d,v=u*g,b=u*v,T=u*b,A=u*T,O=1.572916666666667*g-3.2578125*b+4.295068359375*A;f=2.142578125*v-6.071484375*T,l=3.129296875*b-11.249837239583334*A;var I=4.775276692708333*T,L=7.958636765252976*A,N=Math.cos(2*h);return h+Math.sin(2*h)*(1.5*u-.84375*g+.525390625*b-.2688395182291667*A-O+l-L+N*(2*(1.3125*d-1.71875*v+1.650146484375*T)-4*f+6*I+N*(4*O-12*l+24*L+N*(8*f-32*I+N*(16*l-80*L+N*(32*I+64*N*L))))))}for(l=1-f,u=f/2,g=(d=D.P(h))*E.Zu(f)/(1.570796326794897*l),v=9999,T=d,d=0;1e-16d;d++)A=E.w(f,T),b=T-(O=(b=(E.kG(T,f)-u*Math.sin(2*T)/A)/l-g)/(A=1/(A*A*A))),v=D.P(O),T=b;return 0<=h?T:-T},E.qW=function(f,h){return D.ti(h)?f:f*E.Zu(h)/1.570796326794897},E.ba=function(f){return 0>(f=E.pF(f,6.283185307179586))?f+6.283185307179586:3.141592653589793>D.P(f)||D.Y(D.P(f),3.141592653589793)?f:f-6.283185307179586},E.pF=function(f,h){return f-Math.floor(f/h)*h},E.Ah=function(f,h){if(.006884661117170036>h){var l=(h=(1-(h=Math.sqrt(1-h)))/(1+h))*h,u=l*l;return f/(1+h)*(1+.25*l+.015625*u+.00390625*l*u)*1.570796326794897}return f*E.Zu(h)},E.Vq=function(f,h){var l=D.Mb(1,Math.sin(h));return h=1.570796326794897>=(h=D.P(E.pF(h,3.141592653589793)))?h:3.141592653589793-h,(D.Y(h,1.570796326794897)?h:Math.atan(Math.sqrt(1-f)*Math.tan(h)))*l},E.q=function(f,h,l){if(.006884661117170036>h){var u=(h=(1-(h=Math.sqrt(1-h)))/(1+h))*h,d=h*u,g=h*d,v=h*g,b=h*v,T=h*b,A=-.7291666666666666*d+.2278645833333333*v+.03987630208333334*T,O=.615234375*g-.21533203125*b,I=-.54140625*v+.20302734375*T,L=.48876953125*b,N=-.4488699776785715*T,B=Math.cos(2*l);return f/(1+h)*((1+.25*u+.015625*g+.00390625*b)*l+Math.sin(2*l)*(-1.5*h+.1875*d+.0234375*v+.00732421875*T-A+I-N+B*(2*(.9375*u-.234375*g-.03662109375*b)-4*O+6*L+B*(4*A-12*I+24*N+B*(8*O-32*L+B*(16*I-80*N+B*(32*L+64*B*N)))))))}return f*(E.kG(l,h)-.5*h*Math.sin(2*l)/E.w(h,l))},E.w=function(f,h){return h=Math.sin(h),Math.sqrt(1-f*h*h)},E.Zu=function(f){return D.KC(f,1,2220446049250313e-31)?1:1>f?E.Xw(0,1-f)-f/3*E.Uw(0,1-f):NaN},E.kG=function(f,h){var l=D.Mb(1,f);f=D.P(f);var u=Math.floor(f/1.570796326794897);if(1D.P(u)&&1e-4>D.P(d)&&1e-4>D.P(g));)g=Math.sqrt(b),h+=f/((l=Math.sqrt(T))*(T+(g=Math.sqrt(v)*(g+l)+g*l))),f*=.25,v=.25*(v+g),b=.25*(b+g),T=.25*(T+g);return b=(v=u*d)-(T=g*g),3*h+f*(1+(T=v-6*T)*(.10227272727272728*T-.2142857142857143-.1730769230769231*g*(u=T+b+b))+g*(.1666666666666667*u+g*(-.4090909090909091*b+.1153846153846154*g*v)))/(l*Math.sqrt(l))},E.Xw=function(f,h){for(var l,u,d,g,v=1;u=2-((l=(f+h+v)/3)+f)/l,d=2-(l+h)/l,g=2-(l+v)/l,!(1e-4>D.P(u)&&1e-4>D.P(d)&&1e-4>D.P(g));v=.25*(v+l))l=Math.sqrt(h),u=Math.sqrt(v),f=.25*(f+(l=Math.sqrt(f)*(l+u)+l*u)),h=.25*(h+l);return(1+(.04166666666666666*(f=u*d-g*g)-.1-.06818181818181818*(h=u*d*g))*f+.07142857142857142*h)/Math.sqrt(l)},E.Qw=function(f,h){if(D.ti(f)||h==0||D.Y(D.P(h),1.570796326794897))return h;if(.006884661117170036>f){var l=f*f,u=f*l,d=f*u,g=f*d,v=f*g,b=f*v,T=-(.02708333333333333*u+.03430059523809524*d+.03149181547619048*g+.02634359154541446*v+.02156896735835538*b),A=.007669890873015873*d+.01299603174603175*g+.0148051353064374*v+.01454454953803912*b,O=-(.002275545634920635*g+.004830845032667949*v+.006558395368616723*b),I=.0006957236677288761*v+.001775193002406544*b,L=-.000217324089394402*b,N=Math.cos(2*h);return h+Math.sin(2*h)*(-(.5*f+.2083333333333333*l+.09375*u+.04878472222222222*d+.02916666666666667*g+.01938905423280423*v+.01388255931712963*b)-T+O-L+N*(2*(.1041666666666667*l+.0875*u+.06050347222222222*d+.04151785714285714*g+.02958958540013228*v+.02203667534722222*b)-4*A+6*I+N*(4*T-12*O+24*L+N*(8*A-32*I+N*(16*O-80*L+N*(32*I+64*N*L))))))}return h==0||D.Y(D.P(h),1.570796326794897)?l=h:(d=(u=Math.sqrt(f))*Math.sin(h),l=Math.tan(.7853981633974483+h/2)*Math.pow((1-d)/(1+d),u/2),l=2*Math.atan(l)-1.570796326794897),l},E.yO=function(f,h){if(D.ti(f)||h==0||D.Y(D.P(h),1.570796326794897))return h;if(.006884661117170036>f){var l=f*(I=f*(O=f*(N=f*f))),u=f*(L=f*l),d=.05833333333333333*O+.07232142857142858*I+.05634300595238095*l+.0355325796406526*L+.020235546186067*u,g=.02653149801587302*I+.04379960317460317*l+.0429211791776896*L+.03255384637546096*u,v=.01294022817460318*l+.02668104344536636*L+.03155651254609588*u,b=.00659454790965208*L+.0163075268674227*u,T=.003463473736911237*u,A=Math.cos(2*h);return h+Math.sin(2*h)*(.5*f+.2083333333333333*N+.08333333333333333*O+.03611111111111111*I+.01875*l+.01195601851851852*L+.008863673941798942*u-d+v-T+A*(2*(.1458333333333333*N+.1208333333333333*O+.07039930555555556*I+.03616071428571429*l+.01839451058201058*L+.01017113095238095*u)-4*g+6*b+A*(4*d-12*v+24*T+A*(8*g-32*b+A*(16*v-80*T+A*(32*b+64*A*T))))))}var O=Math.sqrt(f),I=O/2,L=Math.tan(.7853981633974483+h/2);f=0,d=1;for(var N=h;d!=0;N=u)l=O*Math.sin(N),u=L*Math.pow((1+l)/(1-l),I),u=2*Math.atan(u)-1.570796326794897,f++,(D.Y(u,N)||3e4this.Kk&&(this.Kk=0);var l=this.Ue.getType();if(this.jH=l==m.Sc.PE_TYPE_PROJCS?2:1,l==m.Sc.PE_TYPE_PROJCS&&!f.loadConstants())throw m.i.N("PeProjcs.loadConstants failed");h=l==m.Sc.PE_TYPE_GEOGCS?this.Ue:this.Ue.getGeogcs(),l!=m.Sc.PE_TYPE_GEOGCS&&m.pf.getCode(h),this.Eo=f.getUnit(),this.RH=h.getPrimem().getLongitude(),this.wH=f=h.getUnit().getUnitFactor(),f=Math.PI/(180*f),1e-10>Math.abs(f-1)&&(f=1),this.GA=f,l&m.Sc.PE_TYPE_PROJCS?(h=this.Ue,this.HA=1/h.getUnit().getUnitFactor(),this.sw=.001/this.Ue.getUnit().getUnitFactor(),this.tw=m.Cg.generate(h,m.Cg.PE_PCSINFO_OPTION_NONE),this.zl=this.tw.isPannableRectangle(),this.bA=m.zb.qN(this.tw.getCentralMeridian(),this.GA)):(this.KA=this.zl=!0,this.HA=0,l=1/h.getUnit().getUnitFactor(),this.sw=.001/h.getDatum().getSpheroid().getAxis()*l,this.bA=0),this.zl&&(this.xx(),this.DK(),this.nY(),this.CK(),this.lY(),this.mY())}return E.prototype.$r=function(){return this.Kk},E.prototype.kk=function(){return this.tw},E.Py=function(f,h){return f==h||f!=null&&h!=null&&f.Kk==0&&h.Kk==0&&f.As===h.As},E.prototype.Wc=function(){return this.zl},E.prototype.gh=function(f){f.K(this.so)},E.prototype.pv=function(){return this.so.v},E.prototype.ov=function(){return this.so.C},E.prototype.GR=function(f){f.K(this.uw)},E.prototype.lY=function(){var f=this.Ue.getType();if(f==m.Sc.PE_TYPE_PROJCS){f=this.Ue;var h=this.kk().getCentralMeridian(),l=f.getGeogcs();if(l==null)throw m.i.fa("internal error");h=[[h+(l=1/l.getUnit().getUnitFactor()*Math.PI),0]],m.ej.geogToProj(f,1,h),h=h[0][0],l=f.getParameters()[m.Sc.PE_PARM_X0].getValue();var u=this.ml();f=new m.l,u.A(f),h=(u=Math.abs(h-l))+l,l=-1*u+l,u=f.H,f=f.G;var d=new m.l;d.K(l,f,h,u),this.so==null&&(this.so=d)}else{if(f!=m.Sc.PE_TYPE_GEOGCS)throw m.i.fa("internal error");l=1/this.Ue.getUnit().getUnitFactor()*Math.PI,(f=new m.l).K(-l,-l/2,l,l/2),this.so==null&&(this.so=f)}},E.prototype.mY=function(){var f=this.Ue.getType();if(f==m.Sc.PE_TYPE_PROJCS){var h=this.Ue;if(f=this.kk().getCentralMeridian(),(h=h.getGeogcs())==null)throw m.i.fa("internal error");h=1/h.getUnit().getUnitFactor()*Math.PI;var l=this.Vr(),u=new m.l;l.A(u),(l=new m.l).K(f-h,u.G,f+h,u.H),this.uw==null&&(this.uw=l)}else{if(f!=m.Sc.PE_TYPE_GEOGCS)throw m.i.fa("internal error");h=1/this.Ue.getUnit().getUnitFactor()*Math.PI,(f=new m.l).K(-h,-h/2,h,h/2),this.uw==null&&(this.uw=f)}},E.prototype.bf=function(){return this.GA},E.prototype.pm=function(){return this.HA},E.prototype.Vr=function(){if(this.zl)return this.ul;var f=this.ul;return f??(this.xx(),this.ul)},E.prototype.Wr=function(){return this.zl?null:(this.ul!=null||this.xx(),this.YG)},E.prototype.xx=function(){if(this.Ue.getType()==m.Sc.PE_TYPE_PROJCS){var f=this.Ue,h=f.getGeogcs(),l=f.horizonGcsGenerate();if(l!=null){var u=l[0].getNump(),d=l[0].getKind();f=0T&&(l=-400*g,O.K(l,O.G,l+5*b,O.H)),l=new m.Fh(O),this.ul==null&&(this.ul=l,this.Iv=f);else{if(T=new m.Da,b=this.kk().isGcsHorizonMultiOverlap(),O=m.gu.bF(h,m.hu.Integer64),b){for(T=new m.gL,A=m.Gh.local().V(T,O,null),L=0;Lthis.ss&&(this.ss=0),this.Eo=h=this.KT.getUnit(),this.IH=1/h.getUnitFactor(),m.pf.getCode(f)}return E.Py=function(f,h){return f==h||f!=null&&h!=null&&f.ss==0&&h.ss==0&&f.As===h.As},E.prototype.$r=function(){return this.ss},E}();m.PL=D}(re||(re={})),function(m){m.Yg=function(){function D(){}return D.tb=function(E,f,h,l,u,d,g,v){if(d!=null||g!=null||v!=null){l=m.F.ba(l),f=m.F.ba(f),h=m.F.ba(h),u=m.F.ba(u),1.570796326794897h?l:m.F.ba(3.141592653589793-l):Math.atan2(O*N,T*I-A*O*L)),v!=null&&(m.s.Y(m.s.P(u),1.570796326794897)?v.u=0>u?f:m.F.ba(3.141592653589793-f):(v.u=Math.atan2(T*N,I*T*L-O*A),v.u=m.F.ba(v.u+3.141592653589793)))}}},D.rf=function(E,f,h,l,u,d,g){if(d!=null||g!=null){f=m.F.ba(f),h=m.F.ba(h),1.570796326794897I?u:m.F.ba(3.141592653589793-u):f:m.s.Y(m.s.P(h),1.570796326794897)&&m.s.Y(E,3.141592653589793)?0>h?u:m.F.ba(3.141592653589793-u):m.F.ba(f+Math.atan2(O*b,T*l-A*O*v)))}},D}()}(re||(re={})),function(m){m.Wk=function(){function D(){}return D.tb=function(E,f,h,l,u,d,g,v,b){var T=new m.ga(0),A=new m.ga(0),O=[0,0,0],I=[0,0,0],L=[0,0,0],N=new m.ga(0),B=new m.ga(0),H=new m.ga(0),K=new m.ga(0),ee=new m.ga(0);if(g!=null||v!=null||b!=null)if(m.s.ti(f))m.Yg.tb(E,h,l,u,d,g,v,b);else{u=m.F.ba(u),h=m.F.ba(h);var q=m.F.ba(u-h);if(m.s.Y(l,d)&&(m.s.Y(h,u)||m.s.Y(m.s.P(l),1.570796326794897)))g!=null&&(g.u=0),v!=null&&(v.u=0),b!=null&&(b.u=0);else{if(m.s.Y(l,-d)){if(m.s.Y(m.s.P(l),1.570796326794897))return g!=null&&(g.u=2*m.F.Ah(E,f)),v!=null&&(v.u=0q){oe=1;var ye=h;h=u,u=ye,ye=l,l=d,d=ye}q=m.F.ot(f,l);var me=m.F.ot(f,d);v==null&&b==null||(m.Yg.tb(E,h,q,u,me,null,T,A),T=Math.atan2(Math.sin(T.u)*Math.cos(l-q),Math.cos(T.u)),A=Math.atan2(Math.sin(A.u)*Math.cos(d-me),Math.cos(A.u)),oe!=0&&(ye=T,T=A,A=ye),v!=null&&(v.u=T),b!=null&&(b.u=A)),g!=null&&(m.F.cl(1,f,l,h,0,H,K,ee),O[0]=H.u,O[1]=K.u,O[2]=ee.u,m.F.cl(1,f,d,u,0,H,K,ee),I[0]=H.u,I[1]=K.u,I[2]=ee.u,L[0]=O[1]*I[2]-I[1]*O[2],L[1]=-(O[0]*I[2]-I[0]*O[2]),L[2]=O[0]*I[1]-I[0]*O[1],f=1-m.F.w(f,m.F.Vq(f,m.F.Qj(f,Math.acos(L[2]/Math.sqrt(L[0]*L[0]+L[1]*L[1]+L[2]*L[2]))))),f*=2-f,v=Math.atan2(-L[1],-L[0]),L=m.F.ba(v-1.570796326794897),v=m.F.ba(v+1.570796326794897),L=m.s.P(m.F.ba(h-L))<=m.s.P(m.F.ba(h-v))?L:v,m.Yg.tb(1,L,0,h,q,N,null,null),m.Yg.tb(1,L,0,u,me,B,null,null),3.141592653589793u&&(u=m.s.P(u),d=m.F.ba(d+3.141592653589793)),h=m.F.ba(h),l=m.F.ba(l),1.570796326794897=m.s.P(d)?1:-1);d=m.F.ba(h+Math.atan(Math.tan(d)*-Math.sin(H))),m.Yg.tb(E,d,0,h,H,null,A,null),H=m.s.P(1.570796326794897-m.s.P(A.u)),H=m.F.Qj(f,H),H=1-m.F.w(f,m.F.Vq(f,H)),H*=2-H,m.F.cl(1,f,0,d,0,L,N,B),O[0]=L.u,O[1]=N.u,O[2]=B.u,m.F.cl(1,f,l,h,0,L,N,B),I[0]=L.u,I[1]=N.u,I[2]=B.u,l=Math.acos((O[0]*I[0]+O[1]*I[1]+O[2]*I[2])/Math.sqrt(I[0]*I[0]+I[1]*I[1]+I[2]*I[2])),l=m.F.Qj(H,l),u=0<(l=m.F.q(E,H,l)+u*K)?A.u:m.F.ba(A.u+3.141592653589793),E=m.s.P(l)/m.F.Ah(E,H)*1.570796326794897,E=m.F.Rq(H,E),E=m.F.ot(H,E),m.Yg.rf(1,d,0,E,u,g,T),v!=null&&(b=T.u),v!=null&&(v.u=m.F.Qj(f,b))}},D}()}(re||(re={})),function(m){m.cu=function(){function D(){}return D.tb=function(E,f,h,l,u,d,g,v,b){var T=0,A=0,O=0;if(g!=null||v!=null||b!=null)if(m.s.ti(f))m.Yg.tb(E,h,l,u,d,g,v,b);else{var I=m.F.ba(u-h);if(m.s.Y(l,d)&&(m.s.Cd(I)||m.s.Y(m.s.P(l),1.570796326794897)))g!=null&&(g.u=0),v!=null&&(v.u=0),b!=null&&(b.u=0);else{if(m.s.Y(l,-d)){if(m.s.Y(m.s.P(l),1.570796326794897))return g!=null&&(g.u=2*m.F.Ah(E,f)),v!=null&&(v.u=0=Te&&!m.s.Y(Fe,oe));if(Me!=0)L=(N*=T)*(256+N*(N*(74-47*N)-128))/1024,g!=null&&(g.u=B*(1+N*(4096+N*(N*(320-175*N)-768))/16384)*(Ot-L*Xe*(A+L/4*(We*(2*O-1)-L/6*A*(4*Xe*Xe-3)*(4*O-3))))),v!=null&&(v.u=m.s.Y(m.s.P(l),1.570796326794897)?0>l?u:m.F.ba(3.141592653589793-u):Math.atan2(ee*me,f*q-K*ee*ye)),b!=null&&(m.s.Y(m.s.P(d),1.570796326794897)?b.u=0>d?h:m.F.ba(3.141592653589793-h):(b.u=Math.atan2(f*me,f*q*ye-K*ee),b.u=m.F.ba(b.u+3.141592653589793)));else{oe=m.s.Mb(3.141592653589793,I),We=K*q-f*ee,Ot=Math.acos(We),Xe=Math.sin(Ot),T=1,Te=lt=0;do O=lt,ye=1-.25*(lt=L*(T*=T)*(1+L+L*L))+.1875*(A=L*L*(ye=T*T)*(1+2.25*L))-.1953125*(Me=L*L*L*ye*T),lt=.25*lt-.25*A+.29296875*Me,me=.03125*A-.05859375*Me,Me*=.00651041666666667,A=We-2*K*q/T,1=Te&&!m.s.Y(O,lt));g!=null&&(ye=1+(N*=T*=T)*(4096+N*(N*(320-175*N)-768))/16384,m.s.Y(l,-d)?g.u=3.141592653589793*B*ye:(A=We-2*K*q/T,T=Math.acos(A),We=Math.cos(2*T),Fe=Math.cos(3*T),g.u=B*(ye*Ot+N*(N*(128+N*(35*N-60))-512)/2048*Xe*A+N*(5*N-4)/6144*N*N*Math.sin(2*Ot)*We+Me*Math.sin(3*Ot)*Fe+-762939453125e-16*N*N*N*N*Math.sin(4*Ot)*Math.cos(4*T)))),v!=null&&(m.s.Cd(l)&&m.s.Cd(d)?(T=Math.sqrt(1-lt*lt),v.u=Math.acos(T),0>I&&(v.u*=-1)):m.s.Y(m.s.P(l),1.570796326794897)?v.u=0>l?u:m.F.ba(3.141592653589793-u):(g=lt/f,B=Math.sqrt(1-g*g),0>f*q-K*ee*Math.cos(oe)&&(B*=-1),v.u=Math.atan2(g,B),m.s.Y(l,-d)&&m.s.P(m.F.ba(h-u))>3.141592653589793*(1-L*Math.cos(l))&&(0m.s.P(v.u)||0>l&&1.570796326794897d?h:m.F.ba(3.141592653589793-h):(I=lt/ee,g=Math.sqrt(1-I*I),B=Math.sin(oe/2),0>Math.sin(H-E)-2*f*q*B*B&&(g*=-1),b.u=Math.atan2(I,g),b.u=m.F.ba(b.u+3.141592653589793),m.s.Y(l,-d)&&!m.s.Cd(l)&&!m.s.Y(m.s.P(l),1.570796326794897)&&m.s.P(m.F.ba(h-u))>3.141592653589793*(1-L*Math.cos(l))&&(v!=null?B=v.u:(g=lt/f,B=Math.sqrt(1-g*g),0>f*q-K*ee*Math.cos(oe)&&(B*=-1),B=Math.atan2(g,B),m.s.Y(l,-d)&&m.s.P(m.F.ba(h-u))>3.141592653589793*(1-L*Math.cos(l))&&(0m.s.P(B)||0>l&&1.570796326794897=m.s.P(B)&&1.570796326794897m.s.P(b.u))&&(b.u=-1*m.F.ba(b.u+3.141592653589793))))}}}},D.rf=function(E,f,h,l,u,d,g,v){if(g!=null||v!=null)if(m.s.ti(f))m.Yg.rf(E,h,l,u,d,g,v);else if(d=m.F.ba(d),m.s.Y(m.s.P(l),1.570796326794897)||m.s.Cd(d)||m.s.Y(m.s.P(d),3.141592653589793))m.Wk.rf(E,f,h,l,u,d,g,v);else{var b=m.s.P(d)==1.570796326794897?0:Math.cos(d),T=m.s.P(d)==3.141592653589793?0:Math.sin(d);m.s.Y(m.s.P(l),1.570796326794897)&&(h=0),d=1-Math.sqrt(1-f);var A=m.F.Vq(f,l);l=m.s.P(A)==1.570796326794897?0:Math.cos(A);var O=Math.sin(A);A=Math.atan2(Math.tan(A),b);var I=l*T,L=I*I,N=1-L,B=f/(1-f)*N,H=(f=B*(256+B*(B*(74-47*B)-128))/1024)/4,K=f/6,ee=u/(E*(1-d)*(1+B*(4096+B*(B*(320-175*B)-768))/16384)),q=ee;do{var oe=q;u=m.s.P(q)==1.570796326794897?0:Math.cos(q);var ye=(B=m.s.P(q)==3.141592653589793?0:Math.sin(q))*B;q=f*B*((E=Math.cos(2*A+q))+H*(u*(2*(q=E*E)-1)-K*E*(4*ye-3)*(4*q-3)))+ee}while(!m.s.Y(oe,q));u=m.s.P(q)==1.570796326794897?0:Math.cos(q),B=m.s.P(q)==3.141592653589793?0:Math.sin(q),g!=null&&(T=Math.atan2(B*T,l*u-O*B*b),N=d/16*N*(4+d*(4-3*N)),E=Math.cos(2*A+q),g.u=m.F.ba(h+(T-(1-N)*d*I*(q+N*B*(E+N*u*(2*E*E-1)))))),v!=null&&(N=O*B-l*u*b,N=(1-d)*Math.sqrt(L+N*N),v.u=Math.atan2(O*u+l*B*b,N))}},D}()}(re||(re={})),function(m){m.PC=function(){function D(){}return D.tb=function(E,f,h,l,u,d,g,v,b){var T=m.F.ba(u-h),A=m.s.Y(m.s.P(l),1.570796326794897),O=m.s.Y(m.s.P(d),1.570796326794897);if(m.s.Y(l,d)&&(m.s.Cd(T)||A))g!=null&&(g.u=0),v!=null&&(v.u=0),b!=null&&(b.u=0);else{if(m.s.ti(f)){var I=Math.sin(l),L=Math.sin(d);I=Math.sqrt((1+I)/(1-I)),L=Math.sqrt((1+L)/(1-L)),I=Math.log(L)-Math.log(I),I=Math.atan2(T,I),g!=null&&(g.u=m.s.Y(l,d)?m.s.P(E*Math.cos(l)*T):m.s.P((E*d-E*l)/Math.cos(I)))}else L=m.F.Qw(f,d),I=Math.sin(m.F.Qw(f,l)),L=Math.sin(L),I=Math.sqrt((1+I)/(1-I)),L=Math.sqrt((1+L)/(1-L)),I=Math.log(L)-Math.log(I),I=Math.atan2(T,I),g!=null&&(m.s.Y(l,d)?g.u=m.s.P(E*T*Math.cos(l)/m.F.w(f,l)):(T=m.F.q(E,f,l),E=m.F.q(E,f,d),g.u=m.s.P((E-T)/Math.cos(I))));v==null&&b==null||(g=m.F.ba(I+3.141592653589793),A&&O||!A&&!O||(A?I=0>l?u:m.F.ba(3.141592653589793-u):O&&(g=0>d?h:m.F.ba(3.141592653589793-h))),v!=null&&(v.u=I),b!=null&&(b.u=g))}},D.rf=function(E,f,h,l,u,d,g,v){d=m.F.ba(d),0>u&&(u=m.s.P(u),d=m.F.ba(d+3.141592653589793)),m.s.ti(f)?m.s.Y(m.s.P(l),1.570796326794897)?(h=0>l?d:m.F.ba(3.141592653589793-d),3.141592653589793>=(d=u/E%6.283185307179586)?E=l-m.s.Mb(d,l):(h=m.F.ba(h+3.141592653589793),E=-l+m.s.Mb(d-3.141592653589793,l))):m.s.Y(m.s.P(d),1.570796326794897)?(h=m.F.ba(h+m.s.Mb(u,d)/(E*Math.cos(l))),E=l):(E=l+u*Math.cos(d)/E,1.570796326794897l?d:m.F.ba(3.141592653589793-d),d=u/m.F.qW(E,f),3.141592653589793>=(d%=6.283185307179586)?E=l-m.s.Mb(d,l):(h=m.F.ba(h+3.141592653589793),E=-l+m.s.Mb(d-3.141592653589793,l)),E=m.F.Rq(f,E)):m.s.Y(m.s.P(d),1.570796326794897)?(h=m.F.ba(h+m.s.Mb(u,d)*m.F.w(f,l)/(E*Math.cos(l))),E=l):(E=1.570796326794897*(u*Math.cos(d)+m.F.q(E,f,l))/m.F.Ah(E,f),1.570796326794897Math.PI||Math.abs(l.y)>.5*Math.PI||Math.abs(u.y)>.5*Math.PI||(Math.abs(l.y)==.5*Math.PI||Math.abs(u.y)==.5*Math.PI)&&l.x!=u.x)return NaN;if(d=f.cB(d,Math.min(l.x,u.x),Math.max(l.x,u.x)),!new m.Nc(l.x,u.x).contains(d))return NaN;var g=D.construct(l);if(u=D.construct(u),g=f.Yu(h,g),u=f.Yu(h,u),(u=g.cF(u)).z.qg())return l.y;var v=new m.Wb;v.set(u.x),v.jm(u.z),v.No(-1);var b=new m.Wb;b.set(u.y),b.jm(u.z),b.No(-1);var T=new m.Wb;return T.set(b),T.Ag(b),(g=new m.Wb).set(v),g.Ag(v),g.add(T),g.sqrt(),g.qg()||v.qg()&&b.qg()?l.y:(l=Math.atan2(b.value(),v.value()),l=Math.atan2(g.value()*Math.cos(l-d),1-h),d=f.DP(h,m.h.construct(d,l)),h=new m.Nd(d.x,d.y,-d.z),d=u.value().Qh(d),h=u.value().Qh(h),Math.abs(h)Math.PI||Math.abs(l.y)>.5*Math.PI||Math.abs(u.y)>.5*Math.PI||(Math.abs(l.y)==.5*Math.PI||Math.abs(u.y)==.5*Math.PI)&&l.x!=u.x||Math.abs(d)>=.5*Math.PI||0d&&u.y>d||0>l.y&&0>u.y&&l.yMath.abs(g[1]-l.x)&&(l=g[0],g[0]=g[1],g[1]=l)),d))},f.cB=function(h,l,u){return h>u?h-=2*(l=Math.ceil((h-u)/(2*Math.PI)))*Math.PI:hu.x?(u.x-=u.x%360,-180>u.x&&(u.x+=360)):180u.y&&(u.y=-90);for(var d=-180,g=180,v=(E=5*h)-1,b=(f=(E+31)/32)-1;0<=b;b--)for(var T=v-32*b,A=Math.min(32,E-32*b),O=1;O=I?(l[b]|=1<=I?(l[b]|=1<>d&31;if(31<(d+=5)){var b=37-d;v&=(1<f)for(g=0;g=f[0]?f:'"'+f.trim()+'"'}var E=[];m.XC=function(){function f(){}return f.EQ=function(h){try{for(var l=0;lh||h>this.Aa)throw m.i.N();return this.bg[h]},f.prototype.Pf=function(h){return this.uh[h]},f.lz=function(h){return f.JM[h]},f.Tp=function(h){return f.SM[h]},f.Va=function(h){return f.rM[h]},f.prototype.hasAttribute=function(h){return 0<=this.uh[h]},f.prototype.iG=function(){return this.hasAttribute(1)},f.se=function(h){return f.eD[h]},f.prototype.LR=function(h){return this.Vs[h]},f.DG=function(h,l){return f.eD[h]===l},f.prototype.Nb=function(h){return this===h},f.prototype.An=function(){for(var h=m.O.Th(this.bg[0]),l=1;l++v&&E(g,T,d.eu),A[0]?b?T=v:(A=g.c,T=g.e+T+1):++T;A.lengthg.Bd&&A[0]?"-":"")+(1T?"e":"e+")+T:g.toString()}function E(g,v,b,T){var A=g.c,O=g.e+v+1;if(b===1?T=5<=A[O]:b===2?T=5O||A[O+1]!==void 0||1&A[O-1]):b===3?T=T||A[O]!==void 0||0>O:(T=!1,b!==0&&f("!Big.RM!")),1>O||!A[0])T?(g.e=-v,g.c=[1]):g.c=[g.e=0];else{if(A.length=O--,T)for(;9<++A[O];)A[O]=0,O--||(++g.e,A.unshift(1));for(O=A.length;!A[--O];A.pop());}return g}function f(g){throw(g=Error(g)).name="BigError",g}var h=-7,l=21,u=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d=function(){function g(v){if(v instanceof g)this.Bd=v.Bd,this.e=v.e,this.c=v.c.slice();else{var b,T,A;for(v===0&&0>1/v?v="-0":u.test(v+="")||f(NaN),this.Bd=v.charAt(0)=="-"?(v=v.slice(1),-1):1,-1<(b=v.indexOf("."))&&(v=v.replace(".","")),0<(T=v.search(/e/i))?(0>b&&(b=T),b+=+v.slice(T+1),v=v.substring(0,T)):0>b&&(b=v.length),T=0;v.charAt(T)=="0";T++);if(T==(A=v.length))this.c=[this.e=0];else{for(;v.charAt(--A)=="0";);for(this.e=b-T-1,this.c=[],b=0;T<=A;this.c[b++]=+v.charAt(T++));}}}return g.prototype.abs=function(){var v=new g(this);return v.Bd=1,v},g.prototype.cmp=function(v){var b=this.c,T=(v=new g(v)).c,A=this.Bd,O=v.Bd,I=this.e,L=v.e;if(!b[0]||!T[0])return b[0]?A:T[0]?-O:0;if(A!=O)return A;if(v=0>A,I!=L)return I>(L^v)?1:-1;for(A=-1,O=(I=b.length)<(L=T.length)?I:L;++A(T[A]^v)?1:-1;return I==L?0:I>(L^v)?1:-1},g.prototype.jm=function(v){var b=this.c,T=(v=new g(v)).c,A=this.Bd==v.Bd?1:-1,O=g.rr;if((O!==~~O||0>O||1e6me?0:me,N.unshift(0);ee++L;L++){if(I!=(ee=K.length))var Me=I>ee?1:-1;else{var Te=-1;for(Me=0;++TeK[Te]?1:-1;break}}if(!(0>Me))break;for(v=ee==I?T:N;ee;){if(K[--ee]me&&E(q,O,g.eu,K[0]!==void 0),q},g.prototype.fS=function(){return 0this.cmp(0)},g.prototype.jt=function(v){var b,T=this.Bd,A=(v=new g(v)).Bd;if(T!=A)return v.Bd=-A,this.tI(v);var O=this.c.slice(),I=this.e,L=v.c,N=v.e;if(!O[0]||!L[0])return L[0]?(v.Bd=-A,v):new g(O[0]?this:0);if(T=I-N){for((b=0>T)?(T=-T,I=O):(N=I,I=L),I.reverse(),A=T;A--;I.push(0));I.reverse()}else for(I=((b=O.lengthT;){if(O[--I]A.length-I.length&&(T=I,I=A,A=T),b=I.length,T=0;b;)T=(A[--b]=A[b]+I[b]+T)/10|0,A[b]%=10;for(T&&(A.unshift(T),++O),b=A.length;A[--b]==0;A.pop());return v.c=A,v.e=O,v},g.prototype.pow=function(v){var b=this,T=new g(1),A=T,O=0>v;for((v!==~~v||-1e6>v||1e6>=1;)b=b.lr(b);return O?T.jm(A):A},g.prototype.round=function(v,b){var T=this;return v==null?v=0:(v!==~~v||0>v||1e6b&&f(NaN),(b=Math.sqrt(this.toString()))==0||b==1/0?((b=v.join("")).length+T&1||(b+="0"),(v=new g(Math.sqrt(b).toString())).e=((T+1)/2|0)-(0>T||1&T)):v=new g(b.toString()),b=v.e+(g.rr+=4);do T=v,v=A.lr(T.tI(this.jm(T)));while(T.c.slice(0,b).join("")!==v.c.slice(0,b).join(""));return E(v,g.rr-=4,g.eu),v},g.prototype.lr=function(v){var b=this.c,T=(v=new g(v)).c,A=b.length,O=T.length,I=this.e,L=v.e;if(v.Bd=this.Bd==v.Bd?1:-1,!b[0]||!T[0])return new g(0*v.Bd);if(v.e=I+L,AI;)O=N[L]+T[I]*b[L-I-1]+O,N[L--]=O%10,O=O/10|0;N[L]=(N[L]+O)%10}for(O&&++v.e,N[0]||N.shift(),I=N.length;!N[--I];N.pop());return v.c=N,v},g.prototype.toString=function(){var v=this.e,b=this.c.join(""),T=b.length;if(v<=h||v>=l)b=b.charAt(0)+(1v?"e":"e+")+v;else if(0>v){for(;++v;b="0"+b);b="0."+b}else if(0T)for(v-=T;v--;b+="0");else vthis.Bd&&this.c[0]?"-"+b:b},g.prototype.toExponential=function(v){return v==null?v=this.c.length-1:(v!==~~v||0>v||1e6=v&&(A=D(this,this.e+v),0>this.Bd&&this.c[0]&&0>A.indexOf("-")&&(A="-"+A));return h=b,l=T,A||f("!toFix!"),A},g.prototype.toPrecision=function(v){return v==null?this.toString():((v!==~~v||1>v||1e6d.get(I)?(d.set(b,2147483647),b=I):d.set(I,2147483647),T++;else{if(!(1&T))d.set(b,2147483647);else if(h)return l!=null&&(l[0]=!0),null;v.L(O),b=I,T=1}if(!(1&T))d.set(b,2147483647);else if(h)return l!=null&&(l[0]=!0),null;if(!h)for(d.Vd(0,d.size,function(N,B){return N-B}),I=0,L=d.size;Il-h)u.nr(h,l,f);else{var d=!0;try{for(var g=1/0,v=-1/0,b=h;bv&&(v=T)}if(this.reset(l-h,g,v,l-h)){for(b=h;bd&&u.nr(h+d,h+l,f);100f||l==h)&&(f=Math.min(E.hL,f),this.yf.Jb(f),this.yf.resize(f),this.yf.Wj(0,0,this.yf.size),this.EH=h,this.ys.resize(u),this.Es=(l-h)/(f-1),!0)},E.prototype.zF=function(f){return m.O.truncate((f-this.EH)/this.Es)},E.hL=65536,E}();m.Xt=D}(re||(re={})),function(m){var D,E;(E=D||(D={}))[E.enum_line=1]="enum_line",E[E.enum_arc=2]="enum_arc",E[E.enum_dummy=4]="enum_dummy",E[E.enum_concave_dip=8]="enum_concave_dip",E[E.enum_connection=3]="enum_connection";var f=function(){function g(){}return g.Qu=function(v,b,T,A,O,I){var L=new g;return L.Im=new m.h,L.Vm=new m.h,L.aw=new m.h,L.Im.L(v),L.Vm.L(b),L.aw.L(T),L.Co=A,L.qh=O,L.sh=I,L},g.construct=function(v,b,T,A){var O=new g;return O.Im=new m.h,O.Vm=new m.h,O.aw=new m.h,O.Im.L(v),O.Vm.L(b),O.aw.Rc(),O.Co=4,O.qh=T,O.sh=A,O},g}(),h=function(){function g(v,b,T,A,O,I){this.Yv=null,this.ya=0,this.EA=v,this.bI=this.$H=0,this.Ka=b,this.Mj=T,this.vk=A,this.Dq=O,this.Ub=I}return g.prototype.next=function(){for(var v=new m.Sa;;){if(this.ya==this.EA.I())return null;if(this.EA.ve(this.ya,v),this.ya++,!v.B())break}var b=!1;if(this.Yv==null&&(this.$H=v.Lg(),this.bI=v.ih(),this.Yv=d.buffer(v,this.Ka,this.Mj,this.vk,this.Dq,this.Ub),b=!0),this.yaA)throw m.i.N();if(v.B())return new m.Da(v.description);var L=new m.l;return v.xc(L),0=O&&(O=96),I.rb=Math.abs(I.Ka),I.Kv=I.rb!=0?1/I.rb:0,isNaN(A)||A==0?A=1e-5*I.rb:A>.5*I.rb&&(A=.5*I.rb),12>O&&(O=12),(v=Math.abs(b)*(1-Math.cos(Math.PI/O)))>A?A=v:(v=Math.PI/Math.acos(1-A/Math.abs(b)))(O=m.O.truncate(v))&&(O=12,A=Math.abs(b)*(1-Math.cos(Math.PI/O))),I.vk=A,I.Dq=O,I.tA=Math.min(I.ct,.25*A),I.lE()},g.prototype.cv=function(){if(this.Id==null)this.Id=[];else if(this.Id.length!==0)return;var v=this.qE();v=m.O.truncate((v+3)/4);var b=.5*Math.PI/v;this.oA=b;for(var T=0;T<4*v;T++)this.Id.push(null);var A=Math.cos(b);b=Math.sin(b);var O=m.h.construct(0,1);for(T=0;T=this.Ka&&(v=new m.l,this.X.A(v),v.R()<=2*-this.Ka||v.ca()<=2*this.Ka))return new m.Da(this.X.description)}switch(this.X.getType()){case 33:return this.PN();case 550:return this.ON();case 1607:return this.RN();case 1736:return this.QN();case 197:return this.LN();default:throw m.i.Qa()}},g.prototype.RN=function(){if(this.EG(this.X)){var v=new m.Sa;this.X.ve(0,v);var b=new m.l;return this.X.A(b),v.Cb(b.sf()),this.Gu(v)}return this.X=this.WV(this.X),v=new l(this,this.oq),m.Gh.local().V(v,this.Mj,this.Ub).next()},g.prototype.QN=function(){if(this.Ka==0)return this.X;var v=m.Yl.local();if(this.cv(),this.X=v.V(this.X,null,!1,this.Ub),0>this.Ka){var b=this.X;return b=this.py(b,0,b.da()),v.V(b,this.Mj,!1,this.Ub)}return this.EG(this.X)?(v=new m.Sa,this.X.ve(0,v),b=new m.l,this.X.A(b),v.Cb(b.sf()),this.Gu(v)):(v=new u(this),m.Gh.local().V(v,this.Mj,this.Ub).next())},g.prototype.py=function(v,b,T){for(var A=new m.Da(v.description);bv.Ja(b))){var O=v.Ir(b),I=new m.l;if(v.Rj(b,I),0=this.Ka){if(this.Ka==0)v.ad(this.X,!1);else{var b=new m.Fh;this.X.bn(b),b.W(this.Ka,this.Ka),v.ad(b,!1)}return v}return v.ad(this.X,!1),this.X=v,this.jE(v,0)},g.prototype.jE=function(v,b){this.cv();var T=new m.Da(v.description),A=new m.h,O=new m.h,I=new m.h,L=new m.h,N=new m.h,B=new m.h,H=new m.h,K=new m.h,ee=v.Ja(b),q=v.Ba(b),oe=0;for(b=v.Ja(b);oev.Ja(b))return null;if(this.FG(v,b)&&0(v=-1>v?4:2*Math.PI/Math.acos(v)+.5)?v=4:v>this.Dq&&(v=this.Dq),m.O.truncate(v)},g.prototype.GD=function(v,b,T,A,O){this.cv();var I=new m.h;I.uc(T,b),I.scale(this.Kv);var L=new m.h;L.uc(A,b),L.scale(this.Kv),0>(I=Math.atan2(I.y,I.x)/this.oA)&&(I=this.Id.length+I),I=this.Id.length-I,0>(L=Math.atan2(L.y,L.x)/this.oA)&&(L=this.Id.length+L),(L=this.Id.length-L)I.I(L))return 0>O||(O=v,I=new m.Sa,O.ve(O.Ba(b),I),this.yu(T,I)),1;var N=I.Na(I.Xa(I.Ob(L))),B=new m.Dd;if(B.gg(-N.x,-N.y),I.Oc(B),A&&(this.tQ(I,L,O),2>I.I(L)))return 0>O||(O=v,I=new m.Sa,O.ve(O.Ba(b),I),this.yu(T,I)),1;this.Zd.length=0;var H=I.Ob(L);b=I.Xa(H);var K=O==1?I.Ma(b):I.U(b);v=O==1?I.U(b):I.Ma(b);var ee=!0;A=new m.h,L=new m.h;var q=new m.h,oe=new m.h,ye=new m.h,me=new m.h,Me=new m.h,Te=new m.h,Fe=new m.h,Xe=new m.h,We=this.rb;H=I.Ja(H);for(var Ot=0;OtK||0>ee&&K==0?this.Zd.push(f.Qu(oe,ye,A,2,this.Zd.length+1,this.Zd.length-1)):oe.qb(ye)||(this.Zd.push(f.construct(oe,A,this.Zd.length+1,this.Zd.length-1,"dummy")),this.Zd.push(f.construct(A,ye,this.Zd.length+1,this.Zd.length-1,"dummy"))),me.add(L,Fe),this.Zd.push(f.Qu(ye,me,A,1,this.Zd.length+1,this.Zd.length-1)),oe.L(me),Xe.L(Fe),q.L(A),A.L(L),Te.L(Me),K=b,b=v,ee=!1,v=O==1?I.U(b):I.Ma(b);return this.Zd[this.Zd.length-1].qh=0,this.Zd[0].sh=this.Zd.length-1,this.YV(T),B.gg(N.x,N.y),T.YD(B,T.da()-1),1},g.prototype.YV=function(v){for(var b=this.zO(),T=!0,A=b+1,O=b;A!=b;O=A){var I=this.Zd[O];A=I.qh!=-1?I.qh:(O+1)%this.Zd.length,I.Co!=0&&(T&&v.Lt(I.Im),I.Co==2?this.GD(v,I.aw,I.Im,I.Vm,!0):v.Ci(I.Vm),T=!1)}},g.prototype.zO=function(){this.Ks==null&&(this.Ks=[null,null,null,null,null,null,null,null,null]);for(var v=0,b=0,T=this.Zd.length;b=this.rb)return!0}return!1},g.prototype.tQ=function(v,b,T){for(var A=0;1>A;A++){var O=!1,I=v.Ob(b),L=v.Ja(I);if(L==0)break;var N=L;if(3>L)break;!v.dc(I)&&(N=L-1),I=v.Xa(I),L=0di||0>At&&di==0||!this.Fv(oe,ee,q)||(Me.L(q),nn=!1,++lt,O=!0),nn){if(0.5*this.vk?(me.add(oe,ee),me.scale(.5),Xe.normalize(),Xe.ar(),We.L(Xe),We.scale(Ot-lt),me.add(We),v.mf(L,me)):v.pd(L,!0),lt=0}oe.L(ee),H=I}ee.L(q),L=I,I=B,B=0b?(this.oq=!1,v):(this.oq=!0,m.Fg.Mk(v,this.ct,!1,!0,this.Ub))},g.prototype.yu=function(v,b){if(b=b.D(),this.Id!=null&&this.Id.length!==0){var T=new m.h;T.L(this.Id[0]),T.Ct(this.rb,b),v.Lt(T);for(var A=1,O=this.Id.length;A=l?1:-1;case 1:if(f.G=l?1:-1;case 2:if(f.v>=l&&f.C>l)break;return f.C<=l?1:-1;case 3:if(!(f.G>=l&&f.H>l))return f.H<=l?1:-1}return 0},E.prototype.Ay=function(f,h){return f.getType()==1736?this.Cy(f,h):this.Dy(f)},E.prototype.Cy=function(f,h){if(this.Ca.R()==0||this.Ca.ca()==0)return f.Ia();var l=new m.l;f.xc(l),this.X=this.g.Ib(f);var u=new m.l,d=new m.l,g=new m.h,v=new m.h,b=[0,0,0,0,0,0,0,0,0],T=[0,0,0,0,0,0,0,0,0];new m.ig;var A=new m.yb,O=new m.ia(0);O.Jb(Math.min(100,f.I()));for(var I=!1,L=0;!I&&4>L;L++){var N=!1,B=(1&L)!=0,H=0;switch(L){case 0:H=this.Ca.v,N=l.v<=H&&l.C>=H;break;case 1:H=this.Ca.G,N=l.G<=H&&l.H>=H;break;case 2:H=this.Ca.C,N=l.v<=H&&l.C>=H;break;case 3:H=this.Ca.H,N=l.G<=H&&l.H>=H}if(N)for(I=!0,N=this.g.Ob(this.X);N!=-1;){var K=-1,ee=-1,q=this.g.Xa(N),oe=q;do{var ye=this.g.bc(oe);ye==null&&(ye=A,this.g.D(oe,g),ye.Dc(g),this.g.D(this.g.U(oe),v),ye.Qc(v)),ye.A(u);var me=this.Lh(u,L,H),Me=0,Te=-1;if(me==-1){Me=0<(ye=ye.cq(B,H,b,T))?this.g.Ul(oe,T,ye):0,Me+=1;var Fe=oe,Xe=this.g.U(Fe);for(ye=0;yethis.g.Ja(N)?this.g.Zq(N):this.g.Rb(N)}}return I?f.Ia():(this.FB(),0T;T++){var A=!1,O=(1&T)!=0,I=0;switch(T){case 0:I=this.Ca.v,A=b.v<=I&&b.C>=I;break;case 1:I=this.Ca.G,A=b.G<=I&&b.H>=I;break;case 2:I=this.Ca.C,A=b.v<=I&&b.C>=I;break;case 3:I=this.Ca.H,A=b.G<=I&&b.H>=I}if(A){A=v,v=f.Ia(),(A=A.Ga()).Zi();for(var L,N=new m.h;A.$a();)for(var B,H=!0;A.Ha();){var K=A.ha();K.A(h);var ee=this.Lh(h,T,I);if(ee==-1){if(0<(ee=K.cq(O,I,u,d))){var q=0;L=K.ac();for(var oe=0;oe<=ee;oe++)if(q!=(B=oe=(T=m.O.truncate(Math.min(Math.ceil(T/f),2048)))))){for(var A=1;Ad.size)){var O=this;d.Vd(0,d.size,function(me,Me){return O.Mh(me,Me)}),l=new m.h,g=new m.h,v=new m.h,g.Rc();var I=-1;b=new m.ia(0),T=new m.ia(0),A=this.g.Gd();for(var L=this.g.Gd(),N=0,B=d.size;Nthis.Mh(I,ee)&&(this.g.D(ee,l),f?l.y==h:l.x==h)&&(b.add(I),q=!0,this.g.Ra(I,L,1)),0>this.Mh(I,H)&&(this.g.D(H,l),f?l.y==h:l.x==h)&&(q||b.add(I),this.g.Ra(I,A,1))}for(K=0,q=b.size;Kthis.Mh(B,K)&&(this.g.D(K,b),f?b.y==h:b.x==h)&&(H=K),K=-1;var ee=this.g.Ma(B);if(0>this.Mh(B,ee)&&(this.g.D(ee,b),f?b.y==h:b.x==h)&&(K=ee),H!=-1&&K!=-1)this.Kh(B,u,d),this.g.pd(B,!1),this.Kh(H,u,d),this.g.pd(H,!1),O=!0;else if(H!=-1||K!=-1){for(ee=N+1;eethis.Mh(q,oe)&&(this.g.D(oe,b),f?b.y==h:b.x==h)&&(ye=oe),oe=this.g.Ma(q);var me=-1;if(0>this.Mh(q,oe)&&(this.g.D(oe,b),f?b.y==h:b.x==h)&&(me=oe),ye!=-1&&me!=-1){this.Kh(q,u,d),this.g.pd(q,!1),this.Kh(ye,u,d),this.g.pd(ye,!1),O=!0;break}if(H!=-1&&me!=-1){this.zt(u,B,H,q,me,d),O=!0;break}if(K!=-1&&ye!=-1){this.zt(u,q,ye,B,K,d),O=!0;break}}}if(O)break}}}if(!O)break}I=g,T.L(l)}}this.g.Td(d)},E.prototype.Kh=function(f,h,l){l=this.g.Pa(f,l),h.set(l,-1),l=this.g.Pa(f,this.ji),this.dd.set(l,-1),(h=this.g.bd(f))!=-1&&this.g.Xa(h)==f&&(this.g.Jf(h,-1),this.g.Wg(h,-1))},E.prototype.zt=function(f,h,l,u,d,g){this.g.Bc(h,u),this.g.Cc(u,h),this.g.Cc(l,d),this.g.Bc(d,l),this.Kh(u,f,g),this.g.mi(u,!1),this.Kh(d,f,g),this.g.mi(d,!0)},E.prototype.Ty=function(){for(var f=0,h=this.dd.size;f=b?(l=this.g.Pa(v,this.ji),this.dd.set(l,-1),v=this.g.pd(v,!1),b==2&&(l=this.g.Pa(v,this.ji),this.dd.set(l,-1),this.g.pd(v,!1)),b=g,g=this.g.Rb(g),this.g.Jf(b,-1),this.g.$q(b)):(this.g.cp(g,!1),this.g.Wg(g,this.g.Ma(v)),this.g.Vj(g,b),d+=b,u++,g=this.g.Rb(g))}}for(f=0,h=this.dd.size;f=b?(l=this.g.Pa(v,this.ji),this.dd.set(l,-1),v=this.g.pd(v,!1),b==2&&(0<=(l=this.g.Pa(v,this.ji))&&this.dd.set(l,-1),this.g.pd(v,!1)),b=g,this.g.Jf(b,-1),this.g.$q(b)):(this.g.kn(g,!0),this.g.Vj(g,b),this.g.Jf(g,v),this.g.Wg(g,this.g.Ma(v)),this.g.cp(g,!1),d+=b,u++)}for(this.g.Rl(this.X,u),this.g.Tj(this.X,d),f=0,h=this.g.ld;h!=-1;h=this.g.ue(h))f+=this.g.I(h);this.g.bC(f)},E.By=function(f,h,l){return new E(h).Ay(f,l)},E.clip=function(f,h,l,u){if(f.B())return f;if(h.B())return f.Ia();if((l=f.getType())==33)return u=f.D(),h.contains(u)?f:f.Ia();if(l==197)return u=new m.l,f.A(u),u.Ea(h)?(h=new m.Fh,f.copyTo(h),h.Xo(u),h):f.Ia();var d=new m.l;if(f.xc(d),h.contains(d))return f;if(!h.isIntersecting(d))return f.Ia();if((d=f.Bb)!=null&&(d=d.Fk)!=null){if((d=d.Ro(h))==1){if(l!=1736)throw m.i.Qa();return(f=new m.Da(f.description)).tp(h),f}if(d==0)return f.Ia()}switch(l){case 550:l=null,d=f.I();for(var g=f.ub(0),v=0,b=0;b=l?1:-1;case 1:if(f.G=l?1:-1;case 2:if(f.v>=l&&f.C>l)break;return f.C<=l?1:-1;case 3:if(!(f.G>=l&&f.H>l))return f.H<=l?1:-1}return 0},E.prototype.Ay=function(f,h){return f.getType()==1736?this.Cy(f,h):this.Dy(f)},E.prototype.Cy=function(f,h){if(this.Ca.R()==0||this.Ca.ca()==0)return f.Ia();var l=new m.l;f.xc(l),this.X=this.g.Ib(f);var u=new m.l,d=new m.l,g=new m.h,v=new m.h,b=[0,0,0,0,0,0,0,0,0],T=[0,0,0,0,0,0,0,0,0],A=new m.yb,O=new m.ia(0);O.Jb(256);for(var I=!1,L=0;!I&&4>L;L++){var N=!1,B=(1&L)!=0,H=0;switch(L){case 0:H=this.Ca.v,N=l.v<=H&&l.C>=H;break;case 1:H=this.Ca.G,N=l.G<=H&&l.H>=H;break;case 2:H=this.Ca.C,N=l.v<=H&&l.C>=H;break;case 3:H=this.Ca.H,N=l.G<=H&&l.H>=H}if(N)for(I=!0,N=this.g.Ob(this.X);N!=-1;){var K=!0,ee=-1,q=-1,oe=this.g.Xa(N),ye=oe;do{var me=this.g.bc(ye);me==null&&(me=A,this.g.D(ye,g),me.Dc(g),this.g.D(this.g.U(ye),v),me.Qc(v)),me.A(u);var Me=this.Lh(u,L,H),Te=0,Fe=-1;if(Me==-1){Te=0<(me=me.cq(B,H,b,T))?this.g.LX(ye,T,me):0,Te+=1;var Xe=ye,We=this.g.U(Xe);for(me=0;meL;L++){var N=!1,B=(1&L)!=0,H=0;switch(L){case 0:H=this.Ca.v,N=b.v<=H&&b.C>=H;break;case 1:H=this.Ca.G,N=b.G<=H&&b.H>=H;break;case 2:H=this.Ca.C,N=b.v<=H&&b.C>=H;break;case 3:H=this.Ca.H,N=b.G<=H&&b.H>=H}if(N)for(N=v,v=f.Ia(),(N=N.Ga()).Zi();N.$a();)for(var K,ee=!0;N.Ha();){var q=N.ha();q.A(h);var oe=this.Lh(h,L,H);if(oe==-1){if(0<(oe=q.cq(B,H,u,d))){var ye=0;q.Yp(T);for(var me=0;me<=oe;me++)if(ye!=(K=meu.x&&(u.x+=f)}else I=h.y-this.Ca.G,d.y=m.lc.sign(l.y-h.y),u.y=f*m.lc.Cn(Math.floor(Math.abs(I/f)),I)+this.Ca.G,0>u.y&&(u.y+=f);I=O!=0?l.y-h.y:l.x-h.x;var L=Math.abs(I);if(65536=B||(g[L]=B,L++)}L!=0&&this.g.Ul(T,g,L)}}T=A}while(T!=b)}},E.prototype.Vl=function(f,h){for(var l=-1,u=new m.h,d=null,g=this.g.Ob(this.X);g!=-1;g=this.g.Rb(g))for(var v=this.g.Xa(g),b=0,T=this.g.Ja(g);bd.size)){var O=this;d.Vd(0,d.size,function(me,Me){return O.Mh(me,Me)}),l=new m.h,g=new m.h,v=new m.h,g.Rc();var I=-1;b=new m.ia(0),T=new m.ia(0),A=null;for(var L=this.g.Gd(),N=this.g.Gd(),B=0,H=d.size;Bg.compare(l)&&(f?l.y==h:l.x==h)&&(b.add(I),oe=!0,this.g.Ra(I,N,1)),this.g.D(K,l),0>g.compare(l)&&(f?l.y==h:l.x==h)&&(oe||b.add(I),this.g.Ra(I,L,1))}for(ee=0,oe=b.size;eeT.compare(b)&&(f?b.y==h:b.x==h)&&(H=K),K=-1;var ee=this.g.Ma(B);if(this.g.D(ee,b),0>T.compare(b)&&(f?b.y==h:b.x==h)&&(K=ee),H!=-1&&K!=-1)this.Kh(B,u,d),this.g.pd(B,!1),this.Kh(H,u,d),this.g.pd(H,!1),O=!0;else if(H!=-1||K!=-1){for(ee=N+1;eeT.compare(b)&&(f?b.y==h:b.x==h)&&(ye=oe),oe=this.g.Ma(q);var me=-1;if(this.g.D(oe,b),0>T.compare(b)&&(f?b.y==h:b.x==h)&&(me=oe),ye!=-1&&me!=-1){this.Kh(q,u,d),this.g.pd(q,!1),this.Kh(ye,u,d),this.g.pd(ye,!1),O=!0;break}if(H!=-1&&me!=-1){this.zt(u,B,H,q,me,d),O=!0;break}if(K!=-1&&ye!=-1){this.zt(u,q,ye,B,K,d),O=!0;break}}}if(O)break}}}if(!O)break}I=g,T.L(l)}this.g.Td(d)}},E.prototype.Kh=function(f,h,l){l=this.g.Pa(f,l),h.set(l,-1),l=this.g.Pa(f,this.ji),this.dd.set(l,-1),(h=this.g.bd(f))!=-1&&this.g.Xa(h)==f&&(this.g.Jf(h,-1),this.g.Wg(h,-1))},E.prototype.zt=function(f,h,l,u,d,g){this.g.Bc(h,u),this.g.Cc(u,h),this.g.Cc(l,d),this.g.Bc(d,l),this.Kh(u,f,g),this.g.mi(u,!1),this.Kh(d,f,g),this.g.mi(d,!0)},E.prototype.Ty=function(){for(var f=0,h=this.dd.size;f=b?(l=this.g.Pa(v,this.ji),this.dd.set(l,-1),v=this.g.pd(v,!1),b==2&&(0<=(l=this.g.Pa(v,this.ji))&&this.dd.set(l,-1),this.g.pd(v,!1)),b=g,this.g.Jf(b,-1),this.g.$q(b)):(this.g.kn(g,!0),this.g.Vj(g,b),this.g.Jf(g,v),this.g.Wg(g,this.g.Ma(v)),this.g.cp(g,!1),d+=b,u++)}for(this.g.Rl(this.X,u),this.g.Tj(this.X,d),f=0,h=this.g.ld;h!=-1;h=this.g.ue(h))f+=this.g.I(h);this.g.bC(f)},E.By=function(f,h,l,u){return new E(h,u).Ay(f,l)},E.clip=function(f,h,l,u,d){return E.Nu(f,h,null,l,u,d)},E.Nu=function(f,h,l,u,d,g){var v=f.getType();if(v==33)return d=f.D(),h.contains(d)?f:f.Ia();if(v==197)return d=new m.l,f.A(d),d.Ea(h)?(h=new m.Fh,f.copyTo(h),h.Xo(d),h):f.Ia();if(f.B())return f;if(h.B())return f.Ia();var b=new m.l;if(f.xc(b),h.contains(b))return f;if(!h.isIntersecting(b))return f.Ia();if((l!=null||isNaN(u))&&m.ta.ty(l,h,!1),!m.aa.xj(v))throw m.i.N();if((l=f.Bb)!=null&&(l=l.Fk)!=null){if((l=l.Ro(h))==1){if(v!=1736)throw m.i.fa("internal error");return(f=new m.Da(f.description)).tp(h),f}if(l==0)return f.Ia()}switch(v){case 550:for(g=null,v=f.I(),l=f.ub(0),u=0,d=new m.h,b=0;b=b;b+=1)for(var T=0;1>=T;T+=1){var A=h.jG(g+b,v+T),O=this.xl.rR(A);O!=-1&&(this.pq[d]=O,this.xs[d]=A,d++)}for(g=d-1;1<=g;g--)for(O=this.pq[g],v=g-1;0<=v;v--)if(O==this.pq[v]){this.xs[v]=-1,g!=--d&&(this.xs[g]=this.xs[d],this.pq[g]=this.pq[d]);break}for(v=0;vv.Db())throw m.i.N();return b==0||v.B()?v:((I=new g(I)).ko=v,I.Ka=b,I.qa=O,I.Ki=T,I.CA=A,I.Rx())},g.prototype.eM=function(){var v=this.ko,b=v.ac(),T=v.wc(),A=new m.h;return A.uc(T,b),A.normalize(),A.Hv(),A.scale(this.Ka),b.add(A),T.add(A),A=v.Ia(),v.Dc(b),v.Qc(T),A},g.prototype.dM=function(){var v=this.ko;if(0I&&(0this.Ka?-E:E,-1B&&(.017453292519943295>(H=2*Math.acos(B))&&(H=.017453292519943295),1<(L=m.O.truncate(E/H+1.5))&&(N/=L)),H=q+h,q=l.Pd(I,this.Ka,H),v==0&&(q.type|=1024),this.fc(q,v),B=this.Ka/Math.cos(N/2),H+=N/2,(q=l.Pd(I,B,H)).type|=1024,this.fc(q);0<--L;)H+=N,(q=l.Pd(I,B,H)).type|=1024,this.fc(q);(q=l.Pd(I,this.Ka,oe-h)).type|=1024,this.fc(q)}else if(this.Ki==1)q=l.Pd(I,this.Ka,q+h),this.fc(q,v),q=l.Pd(I,this.Ka,oe-h),this.fc(q);else if(this.Ki==0)for(B=1-T/Math.abs(this.Ka),L=1,N=oe-h-(q+h),-1B&&(.017453292519943295>(H=2*Math.acos(B))&&(H=.017453292519943295),1<(L=m.O.truncate(Math.abs(N)/H+1.5))&&(N/=L)),B=this.Ka/Math.cos(.5*N),H=q+h+.5*N,q=l.Pd(I,B,H),this.fc(q,v);0<--L;)H+=N,q=l.Pd(I,B,H),this.fc(q);else this.Ki==2?(B=L.x-I.x,H=L.y-I.y,.99999999<(L=(B*(K=N.x-I.x)+H*(ee=N.y-I.y))/Math.sqrt(B*B+H*H)/Math.sqrt(K*K+ee*ee))?(q=l.Pd(I,1.4142135623730951*this.Ka,oe-.25*E),this.fc(q,v),q=l.Pd(I,1.4142135623730951*this.Ka,oe+.25*E),this.fc(q)):(L=Math.abs(this.Ka/Math.sin(.5*Math.acos(L))))>(N=Math.abs(this.CA*this.Ka))?(B=.5*(oe-q),B=this.Ka/Math.abs(Math.sin(B)),q=l.Pd(I,B,.5*(q+oe)),oe=m.h.construct(q.x,q.y),q=m.h.construct(I.x,I.y),(I=new m.h).uc(oe,q),(oe=new m.h).HW(N/I.length(),I,q),q=(L-N)*Math.abs(this.Ka)/Math.sqrt(L*L-this.Ka*this.Ka),0q&&(oe-=f),L=q-oe(B=1.4142135623730951*this.Ka)?q+.25*E:q+.75*E,q=l.Pd(I,B,H),this.fc(q,v),H=0>B?oe-.25*E:oe-.75*E,q=l.Pd(I,B,H),this.fc(q)):(B=.5*(oe-q),B=this.Ka/Math.abs(Math.sin(B)),oeb))for(var T=0;T=A+1;b--)(T=l.al(v.Na(b))).type|=1024,this.wg.push(T);if(this.mE())if(2<=this.Yb.length){for(v=-1,(O=(1024&this.Yb[this.gf-1].type)!=0)||(v=0),b=1;b=Math.min(T.x,A.x)&&Math.max(T.x,A.x)>=Math.min(v.x,b.x)&&Math.max(v.y,b.y)>=Math.min(T.y,A.y)&&Math.max(T.y,A.y)>=Math.min(v.y,b.y)},g.prototype.xQ=function(v,b,T,A,O){O.bE=!1;var I=(b.y-v.y)*(A.x-T.x)-(b.x-v.x)*(A.y-T.y),L=(T.y-v.y)*(b.x-v.x)-(T.x-v.x)*(b.y-v.y);if(0<=(I=I==0?2:L/I)&&1>=I){var N=I;if(I=(A.y-T.y)*(b.x-v.x)-(A.x-T.x)*(b.y-v.y),L=(v.y-T.y)*(A.x-T.x)-(v.x-T.x)*(A.y-T.y),0<=(I=I==0?2:L/I)&&1>=I)return O.an=l.TO(v.x+I*(b.x-v.x),v.y+I*(b.y-v.y)),O.an.Uh=T.Uh+N*(A.Uh-T.Uh),N!=0&&N!=1||I!=0&&I!=1||(O.bE=!0),O.VY=I,O.WY=N,!((N==0||N==1)&&0I||(I==0||I==1)&&0N)}return!1},g.prototype.QO=function(v){for(;this.Yb[v].shv-(g*=2))return!0;d=new m.h;var b=new m.h,T=new m.h;u.tc(g,d),u.tc(g+2,b),u.tc(g+4,T);var A=l.Wu(b,T,d);if(A.ps()||!l.um(A.value()))return!1;var O=m.h.construct(b.x,b.y),I=new m.h;for(g+=6;gv;v++){u.mB(v,g);var b=this.Cr(g);if(b!=-1){u.Hf(v,d);var T=this.g.fc(this.Ss,d);this.Fa.Sj(b,T)}}},l.prototype.oN=function(u){var d=new m.Sa,g=u.ac();if((g=this.Cr(g))!=-1){u.To(d);var v=this.g.fc(this.Ss,d);this.Fa.Sj(g,v)}g=u.wc(),(g=this.Cr(g))!=-1&&(u.Po(d),u=this.g.fc(this.Ss,d),this.Fa.Sj(g,u))},l.prototype.nN=function(u){var d=u.D();(d=this.Cr(d))!=-1&&(u=this.g.fc(this.Ss,u),this.Fa.Sj(d,u))},l.prototype.Cr=function(u){var d=-1;if(this.Fa.size(-1)==0)return this.Fa.addElement(-4,-1);if(this.Fa.size(-1)==1){var g=this.g.Na(this.Fa.ja(this.Fa.rc(-1)));return u.Rz(g)||(d=this.Fa.xn(-5)),d}return this.pC(u)},l.prototype.pC=function(u){var d=-1;do{var g=this.Fa.rc(-1),v=this.Fa.Fc(-1),b=this.Fa.ja(g),T=this.Fa.ja(v),A=new m.h,O=new m.h;if(this.Xh.D(b,A),this.Xh.D(T,O),b=m.h.Uq(O,u,A),l.um(b))d=this.Fa.xn(-1),(A=this.nC(u,v,g))!=g&&this.oC(u,g,this.Fa.we(A));else if(l.CG(b)){O=this.Fa.sv(-1);var I=this.Fa.rc(-1),L=this.Fa.Fc(-1);for(b=new m.h,T=new m.h;I!=this.Fa.we(L);){var N=this.Fa.ja(O);this.Xh.D(N,b),N=m.h.Uq(b,u,A),l.CG(N)?(L=O,O=this.Fa.ll(O)):(I=O,O=this.Fa.Xp(O))}if(O=L,A=I,N=this.Fa.ja(O),I=this.Fa.ja(A),this.Xh.D(N,b),this.Xh.D(I,T),A!=g&&(b=m.h.Uq(T,u,b),!l.um(b)))continue;d=this.Fa.zu(A,O,-2,!1),this.oC(u,O,v),this.nC(u,A,g)}else this.sb==null&&(this.sb=new m.yb),this.sb.Dc(O),this.sb.Qc(A),0>(A=this.sb.fe(u,!0))?(A=this.Fa.we(v),this.Fa.vd(v,-1),d=this.Fa.xn(-3),this.nC(u,A,g)):1u},l.CG=function(u){return 0d)throw m.i.fa("Internal Error: max number of iterations exceeded");var b=this.nM(h);if(u=u||b,this.tH&&(b=this.g.Gp(h,!0,!1)!=0,u=u||b),b=!1,(g==0||v||m.$t.kI(!0,this.g,f,null,this.nd))&&(b=this.sM(l),u=u||b),!b)break;m.mp.zp(this.nd)}return u},E}();m.Tk=D}(re||(re={})),function(m){var D=function(){function f(h){this.$d=this.Mc=null,this.Ys=0,this.Ub=h,this.cA=!0}return f.prototype.uv=function(h,l){var u=this.g.bc(h);if(u==null){if(!this.g.ed(h,l))return null;u=l}return u},f.prototype.Xq=function(){var h;h===void 0&&(h=!1),this.Ys++,(h||!(4095&this.Ys))&&(this.Ys=0,m.mp.zp(this.Ub))},f.prototype.nP=function(){var h=this.g.Yq(!1),l=!1,u=new m.yb,d=new m.yb,g=new m.l;g.Oa();var v=new m.l;v.Oa();for(var b=new m.Sa,T=new m.TC,A=h.next();A!=-1;A=h.next()){m.mp.zp(this.Ub);var O=null,I=!1;if(!m.aa.Rn(this.g.ic(h.ck))){if((O=this.uv(A,u))==null)continue;if(O.A(g),g.W(this.qa,this.qa),O.Bi(this.qa)){if(!O.Bi(0))continue;I=!0,O=null}}var L=this.g.Yq(h),N=L.next();for(N!=-1&&(N=L.next());N!=-1;N=L.next()){var B=null,H=!1;if(!m.aa.Rn(this.g.ic(L.ck))){if((B=this.uv(N,d))==null)continue;if(B.A(v),B.Bi(this.qa)){if(!B.Bi(0))continue;H=!0,B=null}}var K=0,ee=0;if(O!=null&&B!=null)g.HG(v)&&(T.Oo(O),T.Oo(B),T.Ea(this.qa,!1),0<(K=T.ol(0))+(ee=T.ol(1))&&(this.g.jr(A,T,0,!0),this.g.jr(N,T,1,!0)),T.clear());else if(O!=null){var q=new m.h;if(this.g.D(N,q),g.contains(q)){if(T.Oo(O),this.g.Vi(N,b),T.Kz(this.qa,b,!1),0<(K=T.ol(0)))if(this.g.jr(A,T,0,!0),H){for(H=-1,q=this.g.U(N);q!=-1&&q!=N&&(H=q,(B=this.uv(q,d))!=null&&B.Bi(0));q=this.g.U(q));for(q=N;q!=-1&&(this.g.Dh(q,T.Bf),q!=H);q=this.g.U(q));}else this.g.Dh(N,T.Bf);T.clear()}}else{if(B==null)continue;if(q=new m.h,this.g.D(A,q),v.W(this.qa,this.qa),v.contains(q)){if(T.Oo(B),this.g.Vi(A,b),T.Kz(this.qa,b,!1),0<(ee=T.ol(0)))if(this.g.jr(N,T,0,!0),I){for(H=-1,q=this.g.U(A);q!=-1&&q!=A&&(H=q,(B=this.uv(q,d))!=null&&B.Bi(0));q=this.g.U(q));for(q=A;q!=-1&&(this.g.Dh(q,T.Bf),q!=H);q=this.g.U(q));}else this.g.Dh(A,T.Bf);T.clear()}}if(K+ee!=0){if(K!=0){if((O=this.g.bc(A))==null){if(!this.g.ed(A,u))continue;O=u,u.A(g)}else O.A(g);if(O.Bi(this.qa))break}l=!0}}}return l},f.prototype.oP=function(){return this.QU()},f.prototype.QU=function(){return new m.RC().PX(this.g,this.qa)},f.prototype.lI=function(){var h=!1;this.Mc==null&&(this.Mc=new m.Yj);var l=new m.ia(0);l.Jb(this.g.fd+1);for(var u=this.g.Yq(),d=u.next();d!=-1;d=u.next())l.add(d);this.g.nx(l,l.size),l.add(-1),u=this.g.Gd(),d=this.g.Gd(),this.$d=new m.UC(this.g,this.qa,!this.cA),this.Mc.Vo(this.$d);var g=new m.ia(0),v=new m.ia(0),b=0;new m.h;var T=this.g.td;this.g.vb.mc();for(var A,O,I=this.g.vb.za[0].o,L=l.get(b++);L!=-1;){var N=A=I[2*(O=T.T(L,0))],B=O=I[2*O+1];do{var H=T.T(L,2),K=T.T(L,1);if(H!=-1){var ee=T.T(H,0),q=I[2*ee];0>(B<(ee=I[2*ee+1])?-1:B>ee?1:Nq?1:0)&&(v.add(L),v.add(H))}K!=-1&&(q=I[2*(ee=T.T(K,0))],0>(B<(ee=I[2*ee+1])?-1:B>ee?1:Nq?1:0)&&(v.add(K),v.add(K))),(q=this.g.Pa(L,u))!=-1&&(g.add(q),this.g.Ra(L,u,-1)),(q=this.g.Pa(L,d))!=-1&&(g.add(q),this.g.Ra(L,d,-1)),(L=l.get(b++))!==-1&&(N=I[2*(B=T.T(L,0))],B=I[2*B+1])}while(L!=-1&&N===A&&B===O);for(N=g.size==1&&v.size==2,q=B=-1,H=0,K=g.size;Hh.fd?h=l.nP():l.oP())},f.V=function(h,l,u){return f.fQ(h,h.IF(),l,u)},f.kI=function(h,l,u,d,g){if(!f.yE(l))return!1;var v=new f(g);if(v.g=l,v.qa=u,v.cA=h,v.lI())return d!=null&&d.Wt(v.Ni),!0;var b=new m.Dd;return b.$B(),l.Oc(b),(v=new f(g)).g=l,v.qa=u,v.cA=h,h=v.lI(),b.$B(),l.Oc(b),!!h&&(d!=null&&d.Wt(v.Ni),!0)},f.Ml=function(h,l){return!(16>(h=h.I()))&&2*h+Math.log(h)*Math.LOG10E/Math.log(2)*l<1*h*l},f.lP=function(h,l,u,d){var g=l.getType();if(m.aa.Hc(g))return new f(d).mP(h,l,u);throw m.i.fa("crack_A_with_B")},f.prototype.mP=function(h,l,u){var d=new m.l;h.xc(d);var g=new m.l;if(l.xc(g),g.W(u,u),!g.isIntersecting(d))return h;var v=h.Bb,b=null;v!=null&&(b=v.Fb),f.Ml(h,h.I())&&(b=m.ta.jj(h,g));var T=b!=null?b.getIterator():null,A=l.Ga();l=h.Ga();var O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(g=[];A.$a();)for(;A.Ha();){var I=A.ha();if(b!=null){for(T.Uo(I,u),v=T.next();v!=-1;v=T.next())if(this.Xq(),l.Vb(b.ja(v),-1),l.Ha()){var L=(v=l.ha()).Ea(I,null,O,null,u);for(v=0;vl.t?1:h.tl.index?1:-1},f}()}(re||(re={})),function(m){var D;(D=m.KK||(m.KK={}))[D.Left=0]="Left",D[D.Right=1]="Right",D[D.Coincident=2]="Coincident",D[D.Undefined=3]="Undefined",D[D.Uncut=4]="Uncut";var E=function(l,u,d,g,v,b,T,A,O,I,L){this.X=l,this.bt=u,this.Ns=d,this.tg=g,this.Lm=I,this.Al=L};m.uY=E;var f=function(){function l(u,d){this.JH=u,this.Hi=d}return l.prototype.qM=function(u,d){var g=new m.h;this.Hi.D(u,g);var v=new m.h;return this.Hi.D(d,v),(g=g.compare(v))!=0?g:(u=this.Hi.Pa(u,this.JH))<(d=this.Hi.Pa(d,this.JH))?-1:u==d?0:1},l}(),h=function(l,u,d,g,v,b,T,A,O){this.tg=l,this.Ns=u,this.OA=d,this.UH=g,this.Ei=v,this.Al=b,this.Lm=T,this.VH=A,this.OT=O};m.tY=h,m.LK=function(){function l(){}return l.JK=function(u,d,g,v,b,T){if(d.B())u=new E(d,4,-1,-1,NaN,4,-1,-1,NaN,-1,-1),b.push(u);else if(g.B())u=new E(d,4,-1,-1,NaN,4,-1,-1,NaN,-1,-1),b.push(u);else{var A=new m.gd;if(A.Ib(d),A.Ib(g),m.Tk.V(A,v,T,!0),A.fd==0)u=new E(d.Ia(),4,-1,-1,NaN,4,-1,-1,NaN,-1,-1),b.push(u);else{for(d=0,g=A.Gd(),v=A.ld;v!=-1;v=A.ue(v))for(T=A.Ob(v);T!=-1;T=A.Rb(T))for(var O=A.Xa(T),I=0,L=A.Ja(T);I(B=B.Ea(O,null,L,N,0))&&(v=new h(b,v,L[0],NaN,B,A,T,N[0],NaN),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1)),!0},l.wM=function(u,d,g,v,b,T,A){var O=new m.yb,I=new m.yb,L=[0,0],N=[0,0],B=d.bc(b);return B==null&&(d.ed(b,O),B=O),(O=d.bc(A))==null&&(d.ed(A,I),O=I),2>(B=B.Ea(O,null,L,N,0))&&(v=new h(b,v,L[0],NaN,B,A,T,N[0],NaN),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1),!0)},l.xM=function(u,d,g,v,b,T,A,O){var I=new m.yb,L=new m.yb,N=[0,0],B=[0,0],H=d.bc(b);return H==null&&(d.ed(b,I),H=I),(I=d.bc(A))==null&&(d.ed(A,L),I=L),(H=H.Ea(I,null,N,B,0))==2?(v=new h(b,v,N[0],N[1],H,A,T,B[0],B[1]),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1),!0):(L=!1,b==O&&(v=new h(b,v,N[0],NaN,H,A,T,B[0],NaN),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1),L=!0),L)},l.yM=function(u,d,g,v,b,T,A,O){var I=new m.yb,L=new m.yb,N=[0,0],B=[0,0],H=d.bc(b);return H==null&&(d.ed(b,I),H=I),(I=d.bc(A))==null&&(d.ed(A,L),I=L),(H=H.Ea(I,null,N,B,0))==2?(v=new h(b,v,N[0],N[1],H,A,T,B[0],B[1]),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1),!0):(L=!1,b==O&&(v=new h(b,v,N[0],NaN,H,A,T,B[0],NaN),g.push(v),0>(v=d.Pa(b,u))&&d.Ra(b,u,g.length-1),L=!0),L)},l.cM=function(u,d,g,v){var b=[];b[0]=new m.h,b[1]=new m.h,b[2]=new m.h,b[3]=new m.h;var T=new m.h,A=new m.h,O=new m.h,I=new m.h,L=null;v!=null&&(L=new m.ig).Or();var N=0,B=null,H=new m.yb;new m.yb;for(var K=g.Ob(g.ld);K!=-1;K=g.Rb(K)){for(var ee=4,q=-1,oe=-1,ye=-1,me=-1,Me=NaN,Te=!0,Fe=!1,Xe=!0,We=!0,Ot=!0,lt=0,vi=K,di=0,At=g.Xa(K),nn=g.Ja(K),cs=0;cs=d.length-2||d[N+2].Ns!=q)&&(ee=0):ee=1):((zi!=Gi||Kr&&Gi==0)&&(v!=null?(dr=new E(B,3,q,nr,zi,ee,vi,oe,di,pr,Ri),v.push(dr)):null.add(lt)),ee=1):ee!=0?((zi!=Gi||Kr&&Gi==0)&&(v!=null?(dr=new E(B,0,q,nr,zi,ee,vi,oe,di,pr,Ri),v.push(dr)):null.add(lt)),Go?(N>=d.length-2||d[N+2].Ns!=q)&&(ee=1):ee=0):((zi!=Gi||Kr&&Gi==0)&&(v!=null?(dr=new E(B,3,q,nr,zi,ee,vi,oe,di,pr,Ri),v.push(dr)):null.add(lt)),ee=0),(zi!=Gi||Kr&&Gi==0)&&(Gi=zi,vi=q,oe=nr,di=zi,ye=pr,me=Ri,Me=Oa,Te=Xe=!1,We=Ot=!0))}}N++}Gi!=1&&(Ot&&(v!=null?B=new m.Ta:lt=0),v!=null?(an.ah(Gi,1,L),B.oc(L.get(),We)):lt++,We=Ot=!1,Xe=!0)}Xe&&(zi=1,nr=g.rj(K),nr=g.Ma(nr),Ri=pr=-1,Oa=NaN,Te?v!=null?(dr=new E(B,4,q,nr,zi,ee,vi,oe,di,pr,Ri),v.push(dr)):null.add(lt):(Te=ee==1?0:ee==0?1:3,v!=null?(dr=new E(B,Te,q,nr,zi,ee,vi,oe,di,pr,Ri),v.push(dr)):null.add(lt)))}},l.CM=function(u,d,g,v,b,T){var A=g[v].VH;if(A==1)return l.AM(u,d,g,v,b,T);if(A==0)return l.BM(u,d,g,v,b,T);throw m.i.Qa()},l.AM=function(u,d,g,v,b,T){var A=new m.yb,O=g[v].tg,I=g[v].Lm,L=g[v].Al,N=-1,B=-1,H=-1,K=-1;if(!u&&0.01*h&&(u*=1+(1+(f=f.xb/h))*f),this.pb=l,this.xb=u+2220446049250313e-31*Math.abs(l)},E.prototype.sqrt=function(){if(0<=this.pb){var f=Math.sqrt(this.pb),h=this.pb>10*this.xb?.5*this.xb/f:this.pb>this.xb?f-Math.sqrt(this.pb-this.xb):Math.max(f,Math.sqrt(this.pb+this.xb)-f);h+=2220446049250313e-31*Math.abs(f)}else this.pb<-1*this.xb?h=f=NaN:(f=0,h=Math.sqrt(this.xb));this.pb=f,this.xb=h},E.prototype.sin=function(f){var h=Math.sin(f.pb),l=Math.cos(f.pb);this.pb=h,h=Math.abs(h),this.xb=(Math.abs(l)+.5*h*f.xb)*f.xb+2220446049250313e-31*h},E.prototype.cos=function(f){var h=Math.sin(f.pb),l=Math.cos(f.pb);this.pb=l,l=Math.abs(l),this.xb=(Math.abs(h)+.5*l*f.xb)*f.xb+2220446049250313e-31*l},E.prototype.qg=function(){return Math.abs(this.pb)<=this.xb},E.prototype.ps=function(){return this.qg()&&this.xb!=0},E}();m.Wb=D}(re||(re={}));var Lt=new re.h,vt=new re.h,Bt=new re.h,qt=new re.h,li=new re.h;(function(m){var D,E;(E=D||(D={}))[E.closedPath=1]="closedPath",E[E.exteriorPath=2]="exteriorPath",E[E.ringAreaValid=4]="ringAreaValid";var f=function(){function h(l,u,d,g,v,b,T){u!==void 0?(this.ib=l,this.ck=u,this.bl=d,this.ii=g,this.ya=b,this.hA=T,this.ew=v):(this.ib=l.ib,this.ck=l.ck,this.bl=l.bl,this.ii=l.ii,this.ya=l.ya,this.hA=l.hA,this.ew=l.ew),this.bH=!0}return h.prototype.next=function(){return this.bH?(this.bH=!1,this.ii):this.ii!=-1?(this.ii=this.ib.U(this.ii),this.ya++,this.ii!=-1&&this.ii!=this.ew?this.ii:this.$T()):-1},h.prototype.$T=function(){for(this.bl=this.ib.Rb(this.bl),this.ya=0;this.ck!=-1;){for(;this.bl!=-1;this.bl=this.ib.Rb(this.bl))if(this.ew=this.ii=this.ib.Xa(this.bl),this.ii!=-1)return this.ii;if(this.ck=this.ib.ue(this.ck),this.ck==-1)break;this.hA&&!m.aa.Hc(this.ib.ic(this.ck))||(this.bl=this.ib.Ob(this.ck))}return-1},h.AP=function(l,u,d,g,v,b,T){return new h(l,u,d,g,v,b,T)},h}();m.zY=f,D=function(){function h(){this.jo=this.Am=this.wk=this.cd=this.Ck=this.vo=this.Oi=this.md=this.bi=this.Sg=this.We=this.Il=null,this.qw=this.ld=-1,this.fd=0,this.fA=!1,this.ht=this.it=this.vb=null}return h.prototype.Sh=function(l){return this.We!=null?this.We[l]:null},h.prototype.Xg=function(l,u){if(this.We==null){if(u==null)return;this.We=[];for(var d=0,g=this.vb.I();d=this.Oi.size&&(l=16>u?16:m.O.truncate(3*u/2),this.Oi.resize(l),this.vo.resize(l)),this.Oi.set(u,0),this.vo.set(u,0),u},h.prototype.sF=function(l){this.md.jd(l)},h.prototype.Vy=function(l){this.td.jd(l),this.fd--},h.prototype.oI=function(l){this.md==null&&(this.md=new m.$c(8),this.td=new m.$c(5),this.Oi=new m.be(0),this.vo=new m.be(0));var u=this.td.Ce(),d=0<=l?l:u;if(this.td.S(u,0,d),0>l){if(d>=this.vb.I()){if(l=16>d?16:m.O.truncate(3*d/2),this.vb.resize(l),this.We!=null)for(var g=0;gu.Ja(g))){var b=this.vf(l,-1);this.kn(b,u.dc(g));for(var T=u.Ba(g),A=u.Vc(g);Tl.Ja(u))return d;this.Il.Fd(l,l.Ba(u),l.Vc(u)),this.it=this.vb.ub(0);var g=this.vf(d,-1);this.kn(g,l.dc(u)||!0);var v=this.We!=null&&l.Ve!=null,b=l.Ba(u);for(u=l.Vc(u);b=u.size&&u.resize(Math.max(m.O.truncate(1.25*l),16),-1),u.write(l,d)},h.prototype.KF=function(l,u){return(l=this.JF(l))<(u=this.wk[u]).size?u.read(l):-1},h.prototype.aF=function(){this.wk==null&&(this.wk=[]);for(var l=0;lO:2>O)?(T=this.Zq(T),g=0L){var N=L;A!=null&&(N=0N){var B=N;if(A!=null&&(B=0g||v>this.fd-1)throw m.i.N("invalid call");if(g>v&&!this.dc(l))throw m.i.N("cannot iterate across an open path");for(l=0;u!=d;u=this.U(u))g=this.Ua(u),(v=this.Sh(g))!=null?l+=v.Qb():(v=this.Ua(this.U(u)),l+=this.vb.yr(g,v));return l},h.prototype.Dh=function(l,u){var d=this.Ua(l);this.vb.Ht(d,u),(d=this.Sh(d))!=null&&d.setStart(u),(l=this.Ma(l))!=-1&&(l=this.Ua(l),this.Sh(l)!=null&&d.setEnd(u))},h.prototype.Vi=function(l,u){l=this.Ua(l),this.vb.ve(l,u)},h.prototype.mf=function(l,u){this.Cb(l,u.x,u.y)},h.prototype.Cb=function(l,u,d){var g=this.Ua(l);this.vb.Cb(g,u,d),(g=this.Sh(g))!=null&&g.ZB(u,d),(l=this.Ma(l))!=-1&&(l=this.Ua(l),this.Sh(l)!=null&&g.Ql(u,d))},h.prototype.D=function(l,u){this.vb.D(this.td.T(l,0),u)},h.prototype.Gc=function(l,u){this.vb.za[0].tc(2*this.td.T(l,0),u)},h.prototype.Na=function(l){var u=new m.h;return this.vb.D(this.td.T(l,0),u),u},h.prototype.dG=function(l,u){this.it.tc(2*l,u)},h.prototype.Uc=function(l,u,d){return this.vb.Uc(l,this.Ua(u),d)},h.prototype.setAttribute=function(l,u,d,g){this.vb.setAttribute(l,this.Ua(u),d,g)},h.prototype.Ua=function(l){return this.td.T(l,0)},h.prototype.ih=function(){var l=new m.h;return this.D(void 0,l),l.y},h.prototype.fq=function(l,u){l=this.Ua(l),u=this.Ua(u);var d=this.vb.za[0].o;return d[2*l]===d[2*u]&&d[2*l+1]===d[2*u+1]},h.prototype.Dv=function(l,u){l=this.Ua(l);var d=this.vb.za[0].o;return d[2*l]===u.x&&d[2*l+1]===u.y},h.prototype.vX=function(l,u){if(1>u&&(u=1),this.Sg==null){if(u==1)return;this.Sg=m.Yc.Dn(this.vb.I(),1)}(l=this.Ua(l))>=this.Sg.size&&this.Sg.resize(l+1,1),this.Sg.write(l,u)},h.prototype.cG=function(l){return l=this.Ua(l),this.Sg==null||l>=this.Sg.size?1:this.Sg.read(l)},h.prototype.Ra=function(l,u,d){u=this.bi[u],l=this.Ua(l),u.sizev?1:bA?1:0})},h.prototype.jS=function(){for(var l=this.ld;l!=-1;l=this.ue(l))if(!m.aa.Hc(this.ic(l)))return!0;return!1},h.prototype.hC=function(l,u){for(var d=this.Ob(l),g=this.Ob(u),v=this.kv(l),b=this.kv(u),T=this.Ob(l);T!=-1;T=this.Rb(T))this.gx(T,u);for(T=this.Ob(u);T!=-1;T=this.Rb(T))this.gx(T,l);this.Zo(l,g),this.Zo(u,d),this.$o(l,b),this.$o(u,v),d=this.I(l),g=this.da(l),v=this.da(u),this.Tj(l,this.I(u)),this.Tj(u,d),this.Rl(l,v),this.Rl(u,g),d=this.cd.T(l,2),this.cd.S(l,2,this.cd.T(u,2)),this.cd.S(u,2,d)},h}(),m.gd=D})(re||(re={})),function(m){var D=function(E){function f(h,l,u,d){var g=E.call(this)||this;return g.$=new m.l,h===void 0?g.UE():typeof h=="number"?g.VO(h,l,u,d):h instanceof m.Sa?l!==void 0?g.Qu(h,l,u):g.WO(h):h instanceof m.ra?l!==void 0?g.YO(h,l):g.XO(h):h instanceof m.l?g.UO(h):g.UE(),g}return Ke(f,E),f.prototype.Qu=function(h,l,u){this.description=m.ee.og(),this.$.Oa(),h.B()||this.tu(h,l,u)},f.prototype.UO=function(h){this.description=m.ee.og(),this.$.K(h),this.$.normalize()},f.prototype.XO=function(h){if(h==null)throw m.i.N();this.description=h,this.$.Oa()},f.prototype.YO=function(h,l){if(h==null)throw m.i.N();this.description=h,this.$.K(l),this.$.normalize()},f.prototype.UE=function(){this.description=m.ee.og(),this.$.Oa()},f.prototype.WO=function(h){this.description=m.ee.og(),this.$.Oa(),h.B()||this.tu(h)},f.prototype.VO=function(h,l,u,d){this.description=m.ee.og(),this.K(h,l,u,d)},f.prototype.K=function(h,l,u,d){if(this.vc(),typeof h=="number")this.$.K(h,l,u,d);else for(this.Oa(),l=0,u=h.length;l=m.ra.Va(l))throw m.i.N();var d=this.description.Pf(l);return this.ou(),0<=d?this.ka[this.kR(this.description,h)+this.description.LR(d)-2+u]:m.ra.se(l)},f.prototype.ou=function(){if(this.vc(),this.ka==null&&2=m.ra.Va(l))throw m.i.ce();var d=this.description.Pf(l);return 0<=d?(this.ou(),this.ka[f.Gg(this.description,h)+this.description.$j(d)-2+u]):m.ra.se(l)},f.prototype.vD=function(h,l,u,d){if(this.vc(),l==0)h!=0?u!=0?this.$.H=d:this.$.C=d:u!=0?this.$.G=d:this.$.v=d;else{if(u>=m.ra.Va(l))throw m.i.ce();if(!this.hasAttribute(l)){if(m.ra.DG(l,d))return;this.re(l)}l=this.description.Pf(l),this.ou(),this.ka[f.Gg(this.description,h)+this.description.$j(l)-2+u]=d}},f.Gg=function(h,l){return l*(h.Ae.length-2)},f.prototype.Ea=function(h){this.vc();var l=new m.l;return h.A(l),this.$.Ea(l)},f.prototype.isIntersecting=function(h){return h instanceof m.l?this.$.isIntersecting(h):this.$.isIntersecting(h.$)},f.prototype.Ju=function(h,l){this.vc(),h.B()?this.Oa():l!==void 0?this.tu(h,l):this.$.Ju(h.Lg(),h.ih())},f.prototype.offset=function(h,l){this.vc(),this.$.offset(h,l)},f.prototype.normalize=function(){this.vc(),this.$.normalize()},f.prototype.sf=function(h){if(h===void 0){if(h=new m.Sa(this.description),this.B())return h;for(l=this.description.Aa,u=1;uthis.C&&(this.C=u.x),u.ythis.H&&(this.H=u.y)}}else if(f==null||f.length==0)this.Oa();else for(u=f[0],this.K(u.x,u.y),l=1;lf?this.v=f:this.Ch?this.G=h:this.Hf?this.v=f:this.Ch?this.G=h:this.Hthis.C||this.G>this.H)&&this.Oa())},E.prototype.scale=function(f){0>f&&this.Oa(),this.B()||(this.v*=f,this.C*=f,this.G*=f,this.H*=f)},E.prototype.zoom=function(f,h){this.B()||this.K(this.sf(),f*this.R(),h*this.ca())},E.prototype.isIntersecting=function(f){return!this.B()&&!f.B()&&(this.v<=f.v?this.C>=f.v:f.C>=this.v)&&(this.G<=f.G?this.H>=f.G:f.H>=this.G)},E.prototype.HG=function(f){return(this.v<=f.v?this.C>=f.v:f.C>=this.v)&&(this.G<=f.G?this.H>=f.G:f.H>=this.G)},E.prototype.Ea=function(f){return!this.B()&&!f.B()&&(f.v>this.v&&(this.v=f.v),f.Cthis.G&&(this.G=f.G),f.Hf.length)throw m.i.N();f[0]!=null?f[0].ma(this.v,this.G):f[0]=m.h.construct(this.v,this.G),f[1]!=null?f[1].ma(this.v,this.H):f[1]=m.h.construct(this.v,this.H),f[2]!=null?f[2].ma(this.C,this.H):f[2]=m.h.construct(this.C,this.H),f[3]!=null?f[3].ma(this.C,this.G):f[3]=m.h.construct(this.C,this.G)},E.prototype.wF=function(){return this.B()?0:this.R()*this.ca()},E.prototype.yR=function(){return this.B()?0:2*(this.R()+this.ca())},E.prototype.gk=function(){return(this.C+this.v)/2},E.prototype.Jp=function(){return(this.H+this.G)/2},E.prototype.R=function(){return this.C-this.v},E.prototype.ca=function(){return this.H-this.G},E.prototype.move=function(f,h){this.B()||(this.v+=f,this.G+=h,this.C+=f,this.H+=h)},E.prototype.Ju=function(f,h){if(h!==void 0)this.move(f-this.gk(),h-this.Jp());else if(f instanceof m.h)this.Ju(f.x,f.y);else{if(!(f instanceof m.Sa))throw m.i.N();h=(this.C-this.v)/2;var l=(this.H-this.G)/2;this.v=f.Lg()-h,this.C=f.Lg()+h,this.G=f.ih()-l,this.H=f.ih()+l}},E.prototype.offset=function(f,h){this.v+=f,this.C+=f,this.G+=h,this.H+=h},E.prototype.normalize=function(){if(!this.B()){var f=Math.min(this.v,this.C),h=Math.max(this.v,this.C);this.v=f,this.C=h,f=Math.min(this.G,this.H),h=Math.max(this.G,this.H),this.G=f,this.H=h}},E.prototype.dn=function(f){f.ma(this.v,this.G)},E.prototype.$I=function(f){f.ma(this.C,this.G)},E.prototype.cJ=function(f){f.ma(this.v,this.H)},E.prototype.en=function(f){f.ma(this.C,this.H)},E.prototype.fT=function(){return this.B()||this.v<=this.C&&this.G<=this.H},E.prototype.sf=function(){return m.h.construct((this.C+this.v)/2,(this.H+this.G)/2)},E.prototype.mz=function(){return m.h.construct(this.v,this.G)},E.prototype.contains=function(f,h){if(h!==void 0)return f>=this.v&&f<=this.C&&h>=this.G&&h<=this.H;if(f instanceof m.Sa)return this.contains(f.Lg(),f.ih());if(f instanceof m.h)return this.contains(f.x,f.y);if(f instanceof E)return f.v>=this.v&&f.C<=this.C&&f.G>=this.G&&f.H<=this.H;throw m.i.N()},E.prototype.hm=function(f,h){if(h!==void 0)return f>this.v&&fthis.G&&hthis.v&&f.Cthis.G&&f.H>>32);var h=m.O.Th(f);return f=this.C,f=m.O.truncate(f^f>>>32),h=m.O.Th(f,h),f=this.G,f=m.O.truncate(f^f>>>32),h=m.O.Th(f,h),f=this.H,f=m.O.truncate(f^f>>>32),m.O.Th(f,h)},E.prototype.xr=function(){return this.B()?2220446049250313e-29:2220446049250313e-29*(Math.abs(this.v)+Math.abs(this.C)+Math.abs(this.G)+Math.abs(this.H)+1)},E.prototype.zy=function(f,h){var l=this.Zj(f),u=this.Zj(h);if(l&u)return 0;if(!(l|u))return 4;var d=(l!=0?1:0)|(u!=0?2:0);do{var g=h.x-f.x,v=h.y-f.y;if(g>v?l&E.YC?(l&E.ju?(f.y+=v*(this.v-f.x)/g,f.x=this.v):(f.y+=v*(this.C-f.x)/g,f.x=this.C),l=this.Zj(f)):u&E.YC?(u&E.ju?(h.y+=v*(this.v-h.x)/g,h.x=this.v):(h.y+=v*(this.C-h.x)/g,h.x=this.C),u=this.Zj(h)):l!=0?(l&E.ku?(f.x+=g*(this.G-f.y)/v,f.y=this.G):(f.x+=g*(this.H-f.y)/v,f.y=this.H),l=this.Zj(f)):(u&E.ku?(h.x+=g*(this.G-h.y)/v,h.y=this.G):(h.x+=g*(this.H-h.y)/v,h.y=this.H),u=this.Zj(h)):l&E.ZC?(l&E.ku?(f.x+=g*(this.G-f.y)/v,f.y=this.G):(f.x+=g*(this.H-f.y)/v,f.y=this.H),l=this.Zj(f)):u&E.ZC?(u&E.ku?(h.x+=g*(this.G-h.y)/v,h.y=this.G):(h.x+=g*(this.H-h.y)/v,h.y=this.H),u=this.Zj(h)):l!=0?(l&E.ju?(f.y+=v*(this.v-f.x)/g,f.x=this.v):(f.y+=v*(this.C-f.x)/g,f.x=this.C),l=this.Zj(f)):(u&E.ju?(h.y+=v*(this.v-h.x)/g,h.x=this.v):(h.y+=v*(this.C-h.x)/g,h.x=this.C),u=this.Zj(h)),(l&u)!=0)return 0}while(l|u);return d},E.prototype.Zj=function(f){return(f.xthis.C?1:0)<<1|(f.ythis.H?1:0)<<3},E.prototype.Bi=function(f){return!this.B()&&(this.R()<=f||this.ca()<=f)},E.prototype.tb=function(f){return f instanceof m.h?Math.sqrt(this.iK(f)):Math.sqrt(this.px(f))},E.prototype.px=function(f){var h=0,l=0,u=this.v-f.C;return u>h&&(h=u),(u=this.G-f.H)>l&&(l=u),(u=f.v-this.C)>h&&(h=u),(u=f.G-this.H)>l&&(l=u),h*h+l*l},E.prototype.iK=function(f){var h=0,l=0,u=this.v-f.x;return u>h&&(h=u),(u=this.G-f.y)>l&&(l=u),(u=f.x-this.C)>h&&(h=u),(u=f.y-this.H)>l&&(l=u),h*h+l*l},E.prototype.cn=function(f){this.B()?f.Oa():f.K(this.v,this.C)},E.ju=1,E.ku=4,E.YC=3,E.ZC=12,E}();m.l=D}(re||(re={})),function(m){var D,E;(E=D||(D={}))[E.initialize=0]="initialize",E[E.initializeRed=1]="initializeRed",E[E.initializeBlue=2]="initializeBlue",E[E.initializeRedBlue=3]="initializeRedBlue",E[E.sweep=4]="sweep",E[E.sweepBruteForce=5]="sweepBruteForce",E[E.sweepRedBlueBruteForce=6]="sweepRedBlueBruteForce",E[E.sweepRedBlue=7]="sweepRedBlue",E[E.sweepRed=8]="sweepRed",E[E.sweepBlue=9]="sweepBlue",E[E.iterate=10]="iterate",E[E.iterateRed=11]="iterateRed",E[E.iterateBlue=12]="iterateBlue",E[E.iterateBruteForce=13]="iterateBruteForce",E[E.iterateRedBlueBruteForce=14]="iterateRedBlueBruteForce",E[E.resetRed=15]="resetRed",E[E.resetBlue=16]="resetBlue";var f=function(){function h(l,u){this.ci=l,this.dH=u}return h.prototype.nr=function(l,u,d){this.ci.JX(d,l,u,this.dH)},h.prototype.$p=function(l){return this.ci.Rr(l,this.dH)},h}();D=function(){function h(){this.ow=this.oo=this.ff=this.rd=null,this.wq=new m.l,this.Am=this.Hj=this.Ij=this.Ad=this.Ef=this.Ld=this.cw=this.fo=this.qd=this.Eb=null,this.Xb=-1,this.qa=0,this.Nk()}return h.prototype.kr=function(){this.Nk(),this.Pv=!0,this.Eb==null?(this.fo=new m.ia(0),this.Eb=[]):(this.fo.Bh(0),this.Eb.length=0)},h.prototype.ad=function(l,u){if(!this.Pv)throw m.i.Hb();var d=new m.l;d.K(u),this.fo.add(l),this.Eb.push(d)},h.prototype.Fp=function(){if(!this.Pv)throw m.i.Hb();this.Pv=!1,this.Eb!=null&&0this.Eb.length)return this.pe=this.Eb.length,this.Xb=5,!0;this.rd==null&&(this.rd=new m.sr(!0),this.oo=this.rd.getIterator(),this.Ld=new m.ia(0)),this.rd.kr();for(var l=0;lthis.Eb.length||10>this.qd.length)return this.pe=this.Eb.length,this.Xb=6,!0;this.rd==null&&(this.rd=new m.sr(!0),this.oo=this.rd.getIterator(),this.Ld=new m.ia(0)),this.rd.kr();for(var l=0;lthis.Eb.length||10>this.qd.length)return this.pe=this.Eb.length,this.Xb=6,!0;this.ff==null&&(this.ff=new m.sr(!0),this.ow=this.ff.getIterator(),this.Ef=new m.ia(0)),this.ff.kr();for(var l=0;lthis.Eb.length||10>this.qd.length)return this.pe=this.Eb.length,this.Xb=6,!0;this.rd==null&&(this.rd=new m.sr(!0),this.oo=this.rd.getIterator(),this.Ld=new m.ia(0)),this.ff==null&&(this.ff=new m.sr(!0),this.ow=this.ff.getIterator(),this.Ef=new m.ia(0)),this.rd.kr();for(var l=0;l>1;return h.eq(l)?(this.rd.remove(u),this.pe!=0||(this.Af=this.Vf=-1,this.Ic=!0,!1)):(this.oo.EB(this.Eb[u].v,this.Eb[u].C,this.qa),this.Vf=u,this.Xb=10,!0)},h.prototype.QX=function(){return--this.pe==-1?(this.Af=this.Vf=-1,this.Ic=!0,!1):(this.Rg=this.Vf=this.pe,this.Xb=13,!0)},h.prototype.RX=function(){return--this.pe==-1?(this.Af=this.Vf=-1,this.Ic=!0,!1):(this.Vf=this.pe,this.Rg=this.qd.length,this.Xb=14,!0)},h.prototype.SX=function(){var l=this.Ld.get(this.pe-1),u=this.Ef.get(this.Rg-1),d=this.Rr(l,!0),g=this.Rr(u,!1);return d>g?this.ux():d>1;if(h.eq(l))return this.Df!=-1&&this.Ij.get(u)!=-1?(this.Ad.jd(this.Df,this.Ij.get(u)),this.Ij.set(u,-1)):this.rd.remove(u),this.pe!=0||(this.Af=this.Vf=-1,this.Ic=!0,!1);if(this.Cf!=-1&&0>1;if(h.eq(l))return this.Cf!=-1&&this.Hj.get(u)!=-1?(this.Ad.jd(this.Cf,this.Hj.get(u)),this.Hj.set(u,-1)):this.ff.remove(u),this.Rg!=0||(this.Af=this.Vf=-1,this.Ic=!0,!1);if(this.Df!=-1&&0>1;return this.rd.vj(l),this.Xb=4,!0},h.prototype.jT=function(){if(this.Vf=this.oo.next(),this.Vf!=-1)return!1;this.Af=this.Vf=-1;var l=this.Ef.get(this.Rg)>>1;return this.ff.vj(l),this.Xb=7,!0},h.prototype.gT=function(){if(this.Af=this.ow.next(),this.Af!=-1)return!1;var l=this.Ld.get(this.pe)>>1;return this.rd.vj(l),this.Xb=7,!0},h.prototype.hT=function(){if(--this.Rg==-1)return this.Xb=5,!0;this.wq.K(this.Eb[this.pe]);var l=this.Eb[this.Rg];return this.wq.W(this.qa,this.qa),!this.wq.isIntersecting(l)||(this.Af=this.Rg,!1)},h.prototype.iT=function(){if(--this.Rg==-1)return this.Xb=6,!0;this.wq.K(this.Eb[this.pe]);var l=this.qd[this.Rg];return this.wq.W(this.qa,this.qa),!this.wq.isIntersecting(l)||(this.Af=this.Rg,!1)},h.prototype.kJ=function(){return this.rd==null?(this.Ic=!0,!1):(this.pe=this.Ld.size,0>1],h.eq(l)?u.G-d:u.H+d):(u=this.qd[l>>1],h.eq(l)?u.G-d:u.H+d)},h}(),m.xC=D}(re||(re={})),function(m){var D=function(){function E(){}return E.construct=function(f,h,l,u,d,g){var v=new E;return v.v=f,v.G=h,v.Ye=l,v.C=u,v.H=d,v.Bg=g,v},E.prototype.Oa=function(){this.Ye=this.v=NaN},E.prototype.B=function(){return isNaN(this.v)},E.prototype.XS=function(){return isNaN(this.Ye)},E.prototype.K=function(f,h,l,u,d,g){u!==void 0?typeof f=="number"?(this.v=f,this.G=h,this.Ye=l,this.C=u,this.H=d,this.Bg=g):(this.v=f.x-.5*h,this.C=this.v+h,this.G=f.y-.5*l,this.H=this.G+l,this.Ye=f.z-.5*u,this.Bg=this.Ye+u):(this.v=f,this.G=h,this.Ye=l,this.C=f,this.H=h,this.Bg=l)},E.prototype.move=function(f){this.v+=f.x,this.G+=f.y,this.Ye+=f.z,this.C+=f.x,this.H+=f.y,this.Bg+=f.z},E.prototype.copyTo=function(f){f.v=this.v,f.G=this.G,f.C=this.C,f.H=this.H},E.prototype.Lk=function(f,h,l){this.v>f?this.v=f:this.Ch?this.G=h:this.Hl?this.Ye=l:this.Bgf.length)throw m.i.N();f[0]=new m.Nd(this.v,this.G,this.Ye),f[1]=new m.Nd(this.v,this.H,this.Ye),f[2]=new m.Nd(this.C,this.H,this.Ye),f[3]=new m.Nd(this.C,this.G,this.Ye),f[4]=new m.Nd(this.v,this.G,this.Bg),f[5]=new m.Nd(this.v,this.H,this.Bg),f[6]=new m.Nd(this.C,this.H,this.Bg),f[7]=new m.Nd(this.C,this.G,this.Bg)},E.prototype.Zw=function(f){if(f==null||f.length==0)this.Oa();else{var h=f[0];for(this.K(h.x,h.y,h.z),h=1;hthis.FA;){var b=this.sd.ha();if(d.L(b.ac()),g.L(b.wc()),d.scale(this.Wa.ec),g.scale(this.Wa.ec),m.cj.Mu(d,g)?d.x=g.x:m.cj.Ku(d,g)&&(g.x=d.x),this.uk.length=0,m.cj.tF(this.Wa.Tb,this.Wa.kc,this.Wa.ze,d,g,this.Wa.QA,this.Wa.Zs,v,this.Nj,this.Gs,this.uk,this.bw),this.co!=null&&(b=this.uk.slice(0),this.co.qG(this.co.da()-1,b,b.length-1)),m.cj.Lu(d,g)?(this.qq.Oa(),this.Wa.sy(d,this.sl,this.qq),this.Xn=!0):(this.qq.Oa(),this.Xn=this.xy(v[0],this.qq)),this.Xn){if(this.sd.li(),this.sd.Ez()){this.sd.li(),this.sd.ha();break}this.sd.DW();break}l==null&&(l=new m.Da).Yk(null,0),this.OD(l),u++}if(this.bw[0]=0,0=this.Nj[0]){var v=this.di+1.570796326794897;d=v+3.141592653589793-(this.di-this.Nj[0])}else d=(v=this.di+1.570796326794897)+3.141592653589793-(6.283185307179586-(this.Nj[0]-this.di));var b=!(this.di>=this.Nj[0]&&3.141592653589793>=this.di-this.Nj[0])&&!(this.div;)A-=6.283185307179586;Au.x-this.sk[0]?this.sk[0]-=6.283185307179586:3.141592653589793v?T.xX():T.$n=v,d=l.getType(),m.aa.yd(d)?((d=new m.Ta(l.description)).oc(l,!0),l=d,d=1607):d==197&&(d=new m.l,l.A(d),d.R()<=T.qa||d.ca()<=T.qa?((d=new m.Ta(l.description)).ad(l,!1),l=d,d=1607):((d=new m.Da(l.description)).ad(l,!1),l=d,d=1736)),T.yX(),m.aa.Rn(d)||T.zX(),T.rb<=.5*T.$n)return d!=1736?new m.Da(l.description):T.Wv?l:m.cj.Qr(l,T.Qg,T.ze,T.QA,-1,b);if(0>T.Ka&&d!=1736)return new m.Da(l.description);if(T.Wv&&m.aa.Hc(d)?(u=m.cj.Qr(l,u,4,NaN,T.$n,b),l=m.cb.zh(u,T.Qg,T.Jc)):l=m.cb.zh(l,T.Qg,T.Jc),(l=m.Hh.lj(l,T.Jc)).B())return new m.Da(l.description);switch(!T.Wv&&m.aa.Hc(d)&&(l=m.cj.pI(T.ec,l)),l=h.KX(l,T.Jc),d){case 1736:u=T.UN(l);break;case 1607:u=T.VN(l);break;case 550:u=T.SN(l);break;case 33:u=T.TN(l);break;default:throw m.i.fa("corrupted_geometry")}return(T=m.cb.zh(u,T.Jc,T.Qg)).Jl(l.description),T},h.prototype.UN=function(l){var u=new m.Da;l=new E(this,l,u),l=m.Gh.local().V(l,this.Jc,this.Ub).next(),l=m.ip.nj(l,this.Jc,2);var d=new m.Dd;return d.scale(1/this.ec,1/this.ec),u.Oc(d),u=m.ip.nj(u,this.Jc,2),0<=this.Ka?m.Gh.local().V(u,l,this.Jc,this.Ub):m.kp.local().V(u,l,this.Jc,this.Ub)},h.prototype.VN=function(l){return l=new E(this,l,null),l=m.Gh.local().V(l,this.Jc,this.Ub).next(),m.ip.nj(l,this.Jc,2)},h.prototype.SN=function(l){return l=new D(this,l),l=m.Gh.local().V(l,this.Jc,this.Ub).next(),m.ip.nj(l,this.Jc,2)},h.prototype.TN=function(l){(l=l.D()).scale(this.ec);var u=new m.Da;return this.sy(l,!1,u),m.ip.nj(u,this.Jc,2)},h.prototype.xy=function(l,u,d,g,v,b){var T=l[0],A=l[l.length-1],O=T.y>A.y?T.y:A.y,I=m.F.q(this.Tb,this.kc,T.yl.Ke()&&(this.UV(l),!0)},h.prototype.OI=function(l,u,d){var g=d.I(),v=0b.x?(b=this.zq,g.gg(-this.Js,0)):(b=-this.zq,g.gg(this.Js,0)),u.add(l,!1),l.Oa(),d.add(u,!1),d.Oc(g),v=new m.l,d.A(v),v.W((this.Js-v.R())/2,0),v.G=-this.zq,v.H=this.zq;for(var A=0;A=T));)m.kb.yi(l,u,v.x,v.y,g,me,H,K),O?q.ma(H.u,K.u):(ee.ma(H.u,K.u),h.gJ(v.x,ee.x,oe.x,I),q.ma(I[0]+ee.x,ee.y),oe.L(q)),q.scale(d),L.wf(0,-1,q),b=me,me=ye++*A}},h.dJ=function(l,u,d,g,v,b,T,A,O,I){var L=new m.h,N=new m.h,B=new m.ga(0),H=new m.ga(0);for(m.kb.yi(l,u,g.x,g.y,d,v,B,H),L.ma(B.u,H.u),m.kb.yi(l,u,g.x,g.y,d,b,B,H),N.ma(B.u,H.u),d=new m.ga(0),m.kb.Xy(l,u,T.x,T.y,L.x,L.y,d),O[0]=d.u,m.kb.Xy(l,u,T.x,T.y,N.x,N.y,d),I[0]=d.u;O[0]<=I[0];)O[0]+=6.283185307179586;for(;O[0]>I[0];)O[0]-=6.283185307179586;for(;O[0]>=A;)O[0]-=6.283185307179586,I[0]-=6.283185307179586;for(;O[0]b[L]?1:0}),u=l.Ia(),A=0;Athis.rb/l&&(l=this.rb/500),.01>l&&(l=.01),this.$n=l},h}();m.VK=f}(re||(re={})),function(m){var D=function(){function E(){}return E.Mf=function(f,h){var l=new m.h;l.L(h),f.push(l)},E.up=function(f,h){f.add(h.x),f.add(h.y)},E.hB=function(f){f.Bh(f.size-2)},E.oB=function(f,h){h.ma(f.get(f.size-2),f.get(f.size-1))},E.Qr=function(f,h,l,u,d,g){if(f==null)throw m.i.N();var v=f.getType();if(f.B()||m.aa.Rn(v))return f;var b=new E;b.Qg=h,b.Jc=m.cb.sc(h);var T=m.cb.vv(b.Jc);if(b.Ub=g,b.Tb=m.cb.ev(b.Jc),b.kc=T*(2-T),b.ec=b.Jc.Hd().ai,b.Aq=b.Jc.Kn(),b.Zs=b.Aq*b.ec,b.AA=u,b.zA=d,b.ze=l,v==197?(l=new m.Da(f.description)).ad(f,!1):m.aa.yd(v)?(l=new m.Ta(f.description)).oc(f,!0):l=f,b.ze!=4){if((h=b.Qg.Nb(b.Jc)==0?m.cb.zh(l,b.Qg,b.Jc):m.Hh.lj(l,b.Jc)).B())return h;h=E.pI(b.ec,h),h=b.Zy(h),h=m.ip.nj(h,b.Jc,b.ze),b=m.cb.zh(h,b.Jc,b.Qg)}else{if(m.Eg.Sb(h)==2?(f=m.cb.ml(),(h=m.Xj.local().V(l,f,h,g))==f&&(h=new m.Da,f.copyTo(h))):h=m.Hh.lj(l,b.Jc),h.B())return h;b=b.CX(h)}return b},E.pI=function(f,h){var l=new m.l;if(h.xc(l),3.141592653589793>l.R()*f)return h;var u=!1;l=h.Ga();for(var d=new m.h,g=new m.h;l.$a();)for(;l.Ha();){var v=l.ha();if(d.L(v.ac()),g.L(v.wc()),d.scale(f),g.scale(f),3.141592653589793g.x-d.x)for(;-6.283185307179586>g.x-d.x;)g.x+=6.283185307179586;E.Wi(g.x,NaN,H),I.L(g)}else A.L(g),E.AU(A),E.Wi(A.x,B,H),I.ma(H[0]+A.x,A.y);.5>Math.abs(I.x-g.x)&&I.L(g),T?(v.Tw(0,N),L.L(O),L.scale(1/f),N.Cb(L),(b=l.vm())?u.nf(N):u.lineTo(N),l.Qn()&&!h.dc(l.gb)&&(v.Tw(1,N),L.L(I),L.scale(1/f),N.Cb(L),u.lineTo(N))):((b=l.vm())&&u.Hz(null,0),v=u.da()-1,L.L(O),L.scale(1/f),u.wf(v,-1,L),l.Qn()&&!h.dc(l.gb)&&(L.L(I),L.scale(1/f),u.wf(v,-1,L)))}return u},E.tF=function(f,h,l,u,d,g,v,b,T,A,O,I){var L=new m.h,N=new m.h,B=0ee&&(ee+=6.283185307179586),0>(H=H.u)&&(H+=6.283185307179586),T!=null&&(T[0]=K),A!=null&&(A[0]=ee),O!=null&&(O[0]=H),A=T=NaN,I!=null&&(T=((A=m.F.Ah(f,h))-(O=m.F.q(f,h,u.y)))/K,A=(A+O)/K),O=E.Mu(u,d),H=E.Ku(u,d),ee=O||H;var q=E.FE(u,d,b),oe=new m.ga(0),ye=new m.ga(0),me=new m.h,Me=new m.h,Te=new m.h;E.Wi(u.x,NaN,N);var Fe=[N[0]];if(K<=g)E.Mf(L,u),E.Wi(d.x,NaN,N),I!=null&&I.add(0),ee?(O&&E.kB(u,d,I,L),H&&E.iB(u,d,I,L)):q?E.jB(u,d,B,T,A,I,L):0Te.x&&(N[0]+=6.283185307179586,Te.ma(N[0]+me.x,me.y)):We.xv.x?v.x+=6.283185307179586:3.141592653589793vi;vi++)if(We=Xe[vi]*A+(1-Xe[vi])*T,m.kb.oj(f,h,u.x,u.y,We*d,g,K,ee,l),me.ma(K.u,ee.u),vi==0&&(lt=We,Me.L(me)),E.WW(oe,me,ye,Fe),Fe.hc(Fe.fe(me,!0),Te),m.kb.wd(f,h,me.x,me.y,Te.x,Te.y,q,null,null,2),q.u>O){Ot=!0;break}Ot?(ye.L(Me),A=lt,E.up(v,ye),b.add(A)):(E.hB(v),b.En(b.size-1,1,b.size-1),0=v&&an.u<=g&&3.141592653589793>Math.abs(B.x-H.x)||u.Ux(Ot,lt)<=d));Fe++){var Kr=nn[Fe]*lt+(1-nn[Fe])*Ot;if(u.hc(Kr,I),Te?K.ma(I.x*l,I.y*l):(Me[0][0]=I.x,Me[0][1]=I.y,m.cb.vt(),K.x=Me[0][0]*l,K.y=Me[0][1]*l),Fe==0&&(Go=Kr,N.L(I),q.L(K),0g||3.141592653589793<=Math.abs(B.x-H.x)))){dr=!0;break}if(vi&&0g||3.141592653589793<=Math.abs(B.x-K.x)){dr=!0;break}}else if(0v){dr=!0;break}if(vi){if(m.kb.wd(f,h,me.x,me.y,ee.x,ee.y,Ri,null,null,2),Ri.u>v){dr=!0;break}if(m.kb.wd(f,h,ee.x,ee.y,K.x,K.y,Oa,null,null,2),Oa.u>v){dr=!0;break}}}}dr?(O.L(N),H.L(q),lt=Go,E.up(Xe,O),E.up(di,H),At.add(lt)):(E.hB(Xe),E.hB(di),At.En(At.size-1,1,At.size-1),E.Mf(T,O),We+=an.u,b!=null&&b.add(We),0Math.abs(h.x-f.x)?(u.Dc(f),3.141592653589793<=l.x-f.x?u.Ql(l.x-6.283185307179586,l.y):3.141592653589793<=f.x-l.x?u.Ql(l.x+6.283185307179586,l.y):u.Ql(l.x,l.y)):(u.Dc(l),3.141592653589793<=f.x-l.x?u.Ql(f.x-6.283185307179586,f.y):3.141592653589793<=l.x-f.x?u.Ql(f.x+6.283185307179586,f.y):u.Ql(f.x,f.y))},E.YJ=function(f,h){for(var l=0;lf.x)for(;-3.141592653589793>f.x;)f.x+=6.283185307179586;if(3.141592653589793E.v+u&&gE?-E:E},D.Mb=function(E,f){return 0<=f?D.P(E):-D.P(E)},D.Y=function(E,f){return E==f||D.P(E-f)<=D.JC*(1+(D.P(E)+D.P(f))/2)},D.Cd=function(E){return E==0||D.P(E)<=D.JC},D.Ah=function(E,f){var h=(f=(1-(f=Math.sqrt(1-f)))/(1+f))*f;return E/(1+f)*(1+h*(.25+h*(.015625+1/256*h)))*D.EL},D.EL=1.5707963267948966,D.JC=3552713678800501e-30,D}()}(re||(re={})),function(m){var D=function(f){this.Wf=f,this.Kk=this.Wf.getCode(),0>this.Kk&&(this.Kk=0)};m.DY=D;var E=function(){function f(h){h===void 0&&(h=null),this.Cj=null,this.Un=!1,h!==null&&(this.Cj=new D(h))}return f.prototype.Ec=function(){return this.Cj!=null?this.Cj.Kk:0},f.prototype.Of=function(){var h=new f;return this.copyTo(h),h},f.prototype.copyTo=function(h){h.Cj=this.Cj,h.Un=this.Un},f.prototype.Qz=function(){this.Un=!this.Un},f.prototype.qm=function(){return this.Cj!=null?this.Cj.Wf:null},f.prototype.LJ=function(h){if(0>=h)throw m.i.N();if(h!=this.Ec()){if((h=m.pf.geogtran(h))==null)throw m.i.N("Geogtran not found.");this.Cj=new D(h)}},f.prototype.Bz=function(){return this.Cj==null?null:this.Cj.Wf.toString()},f.prototype.tX=function(h){if(h==null)throw m.i.N();var l=null;try{l=m.pf.fromString(m.Sc.PE_TYPE_GEOGTRAN,h)}catch{throw m.i.N()}this.Cj=new D(l)},f.prototype.Nb=function(h){return h==this||!(!(h instanceof f)||(0>=this.Ec()||this.Ec()!=h.Ec())&&!this.qm().isEqual(h.qm()))&&this.Un==h.Un},f.prototype.toString=function(){var h="GeographicTransformation: "+this.Bz();return 200f.I())},E.BE=function(f){return!(f.B()||f.getType()!=1607&&f.getType()!=1736||20>f.I())},E}();m.Uk=D}(re||(re={})),function(m){m.$b=function(){function D(){}return D.TT=function(E){var f=new m.Da;return f.sx(E.es(),E.gs()),f.yj(E.es(),E.fs()),f.yj(E.ds(),E.fs()),f.yj(E.ds(),E.gs()),f},D.zh=function(E,f){return E===null?null:m.Hx.local().V(E,f,null)},D.jY=function(E,f){var h=m.Gh.local();return E=new m.Zc(E),h.V(E,f,null).next()},D.im=function(E,f,h){return m.kp.local().V(E,f,h,null)},D.ep=function(E,f,h){return m.Kx.local().V(E,f,h,null)},D.VX=function(E,f,h){var l=m.Kx.local();for(E=new m.Zc(E),f=new m.Zc(f),h=l.V(E,f,h,null),l=[];(f=h.next())!=null;)l.push(f);return l},D.Nb=function(E,f,h){return m.dj.local().V(3,E,f,h,null)},D.TP=function(E,f,h){return m.dj.local().V(4,E,f,h,null)},D.RS=function(E,f,h){var l=m.Xj.local();for(E=new m.Zc(E),f=new m.Zc(f),h=l.V(E,f,h,null),l=[];(f=h.next())!=null;)l.push(f);return l},D.QP=function(E,f,h){var l=m.kp.local();for(E=new m.Zc(E),f=new m.Zc(f),h=l.V(E,f,h,null),l=[];(f=h.next())!=null;)l.push(f);return l},D.Ea=function(E,f,h){return m.Xj.local().V(E,f,h,null)},D.QS=function(E,f,h){if((E=m.Xj.local().V(E,f,h,null,1))===null)return[];if(E.getType()===550){for(f=[],h=0;hE.Db())return 0;var l=null;if(f!=null){if(l=f.Hd(),h!=null&&l.Ec()!=h.Ec()&&l.od!=h.od)throw m.i.Xk()}else if(h!=null)throw m.i.N();E.getType()==1736||E.getType()==197?f=E.mg():m.aa.yd(E.getType())?(f=new m.Ta(E.description)).oc(E,!0):f=E,E=0,f=f.Ga();for(var u=new m.h,d=new m.h;f.$a();)for(;f.Ha();){var g=f.ha();g.Yp(u),g.Tr(d),E+=m.h.tb(u,d)}return l!==null&&h!==null&&(E=m.Tc.Nh(E,l,h)),E},D.fP=function(E){return E.points!==void 0?D.mS(E,E.hasZ!==void 0&&E.hasZ,E.hasM!==void 0&&E.hasM):E.rings!==void 0?D.lG(E.rings,E.hasZ!==void 0&&E.hasZ,E.hasM!==void 0&&E.hasM,"P"):E.paths!==void 0?D.lG(E.paths,E.hasZ!==void 0&&E.hasZ,E.hasM!==void 0&&E.hasM,"L"):E.x!==void 0?D.nS(E):E.xmin!==void 0?D.lS(E):null},D.nS=function(E){if(E.x==null||E.x=="NaN")return new m.Sa;var f=new m.Sa(E.x,E.y);return E.z!==void 0&&E.z!==null&&f.wX(E.z),E.m!==void 0&&E.m!==null&&f.hX(E.m),f},D.lS=function(E){if(E.xmin==null||E.xmin=="NaN")return new m.Fh;var f=new m.Fh(E.xmin,E.ymin,E.xmax,E.ymax);return E.zmin!==void 0&&E.zmin!==null&&f.setInterval(1,0,E.zmin,E.zmax),E.mmin!==void 0&&E.mmin!==null&&f.setInterval(2,0,E.mmin,E.mmax),f},D.mS=function(E,f,h){var l=0,u=new m.de,d=3*E.points.length;d%2!=0&&d++,2>d&&(d=2);var g=m.O.truncate(3*E.points.length/2);4>g?g=4:16>g&&(g=16),d=m.Yc.Dn(d,0);var v=m.Yc.Dn(g);g=m.Yc.Dn(g);for(var b=0;b=d?(I[L]=!1,A+=1,v.add(T),b.add(u),T+=N):I[L]=!0}for((l=3*T)%2!=0&&l++,2>l&&(l=2),4>(L=m.O.truncate(3*T/2))?L=4:16>L&&(L=16),l=m.Yc.Dn(l,0),u=m.Yc.Dn(L),d=m.Yc.Dn(L),L=N=0;Lv)throw m.i.N();this.Qi.oa=g-b,this.Qi.va=v+b,this.hi.resize(0),this.he=0,this.sg[0]=0},d.prototype.Uo=function(g,v){this.Qi.oa=g-v,this.Qi.va=g+v,this.hi.resize(0),this.he=0,this.sg[0]=0},d.prototype.next=function(){if(!this.Ya.lq)throw m.i.Hb();if(0>this.he)return-1;for(var g=!0;g;)switch(this.sg[this.he]){case 1:g=this.FU();break;case 2:g=this.GU();break;case 3:g=this.HU();break;case 4:g=this.IU();break;case 5:g=this.GW();break;case 6:g=this.kT();break;case 7:g=this.tN();break;case 0:g=this.Gz();break;default:throw m.i.Qa()}return this.Og!=-1?this.Mp()>>1:-1},d.construct=function(g){var v=new d;return v.Ya=g,v.hi.Jb(20),v.he=-1,v},d.prototype.Gz=function(){return this.Og=this.vH=this.Mi=this.Lc=-1,this.Ya.me!=null&&0=this.Qi.oa?(this.ei=this.QR(),!1):(this.he--,!0)},d.prototype.tN=function(){return this.Og=this.ei,this.Og!=-1&&u.gq(this.Mp())?(this.ei=this.SF(),!1):(this.he--,!0)},d.prototype.SF=function(){return this.Ya.Sf?this.Ya.$f.lb(this.Og):this.Ya.Ti.lb(this.Og)},d.prototype.QR=function(){return this.Ya.Sf?this.Ya.$f.we(this.Og):this.Ya.Ti.we(this.Og)},d.prototype.Mp=function(){return this.Ya.Sf?this.Ya.$f.ja(this.Og):this.Ya.Ti.getData(this.Og)},d}();m.EY=l;var u=function(){function d(g){this.Am=this.$h=this.$f=this.Ti=this.Km=this.Ej=this.me=this.Fj=null,this.Sf=g,this.lq=this.Sv=!1}return d.prototype.kr=function(){this.Nk(!0)},d.prototype.Br=function(g,v){if(!this.Sv)throw m.i.Hb();this.Fj.push(new m.Nc(g,v))},d.prototype.Fp=function(){if(!this.Sv)throw m.i.fa("invalid call");this.Sv=!1,this.lq=!0,this.Sf||(this.vS(),this.Zv=this.Fj.length)},d.prototype.vj=function(g){if(!this.Sf||!this.lq)throw m.i.N("invalid call");if(this.kf==-1){var v=this.Fj.length;if(this.iA){var b=new m.ia(0);b.Jb(2*v),this.bJ(b),this.$h.Jb(2*v),this.$h.resize(0),this.aJ(b),this.Km.resize(v,-1),this.Km.Wj(-1,0,v),this.iA=!1}else this.Km.Wj(-1,0,v);this.kf=this.Tu()}v=this.pG(g<<1,this.kf),b=this.$f.addElement(1+(g<<1),this.xz(v)),this.VJ(v,b),this.Km.set(g,v),this.Zv++},d.prototype.remove=function(g){if(!this.Sf||!this.lq)throw m.i.fa("invalid call");var v=this.Km.get(g);if(v==-1)throw m.i.N("the interval does not exist in the interval tree");this.Km.set(g,-1),this.Zv--;var b=this.xz(v),T=this.$f.ZR(b);this.$f.vd(this.wR(v),b),this.$f.vd(this.TR(v),b),(g=this.$f.size(b))==0&&(this.$f.MP(b),this.ZJ(T,-1)),this.Ej.jd(v),b=this.UF(T);var A=this.qj(T),O=this.lk(T);for(v=0;!(0>1);A!=-1?this.VJ(A,this.Ti.addElement(this.xz(A),T)):(A=this.pG(T,this.kf),b.set(T>>1,A))}},d.prototype.pG=function(g,v){var b=v,T=v,A=-1,O=0,I=this.$h.size-1,L=0,N=g>>1,B=NaN,H=NaN,K=!0,ee=this.DR(N);for(N=this.AR(N);K;){Oq&&(qq)v!=-1&&(v==b?(T=b,B=q,H=(v=this.lk(b))!=-1?this.Np(v):NaN):H>1];return d.gq(g)?v.oa:v.va},d}();m.sr=u}(re||(re={})),function(m){var D=function(){function E(f){if(f==null)throw m.i.fa("Invalid arguement");this.hf=f;var h=f.nR();h.hS()?f.ef.IG()?this.lo=m.si.PannableFold:this.lo=m.si.Clip:this.lo=m.si.DontClip,h.iS()?f.Yf.IG()?this.Qm=m.si.PannableFold:this.Qm=m.si.Clip:this.Qm=m.si.DontClip,this.Bm=h.Jr,this.mH=h.Vu,f=this.hf.sH,this.aH=f.hs(2147483648),this.Uv=f.hs(1073741824)}return E.zh=function(f,h,l){return h.ww.zh(f,l)},E.Rt=function(f,h,l,u){return f.ww.Rt(h,l,u)},E.Qt=function(f,h,l,u){if(l=0>l?h.length:l,(f=f.ww.Rt(h,l,u))==l)return f;for(var d=h=0;dd.H){var N=m.l.construct(b.v-1,d.G,b.C+1,d.H);if((L=m.ri.Nu(L,N,l,NaN,0,h)).B())return L}b.R()>2*d.R()&&(L=m.zb.Hp(L,-2*d.R(),2*d.R(),l,!0,0,!0,h))}b=this.mH,(d=!isNaN(b))&&(L=m.Xl.local().V(L,b,h)),N=A?u.kk():null;var B=NaN;T&&(B=l.zi());var H=u.Wr()!=null;if(this.aH)T&&(m.zb.ur(l,B,L,v),d&&(T=l.hh(),b*=(B=l.sc().hh())/T)),m.zb.tr(this.hf,L,I,v),d&&(T=l.sc().hh(),b*=(B=u.sc().hh())/T),l=L;else{var K=new m.Ta(L.description);K.DD(L),T&&(m.zb.ur(l,B,K,v),d&&(T=l.hh(),b*=(B=l.sc().hh())/T)),m.zb.tr(this.hf,K,I,v),d&&(T=l.sc().pm(),b*=(B=u.sc().pm())/T),I=NaN,A?(N=u.kk(),I=u.zi()):isNaN(this.Bm)||(I=this.Bm),T=E.tv(l)|E.tv(u),B=10*O.Xd(0),this.Uv&&(T=3,B=0),l=m.zb.UQ(L,l,K,O,I,h,T,B)}return H&&(l=m.zb.XD(l,u,h)),A&&(g||(A=O.Oe().R(),l.Tg(0,0).R()>=A-O.Xd(0)&&(O=N.getNorthPoleLocation(),A=N.getSouthPoleLocation(),L=N.getNorthPoleGeometry(),N=N.getSouthPoleGeometry(),I=0,L==m.Cg.PE_POLE_POINT&&O!=m.Cg.PE_POLE_OUTSIDE_BOUNDARY&&(I=1),N==m.Cg.PE_POLE_POINT&&A!=m.Cg.PE_POLE_OUTSIDE_BOUNDARY&&(I|=2),I!==0&&(g=!0))),l=m.zb.Mz(l,u,this.Qm,h),d&&(l=m.Xl.local().V(l,b,h)),m.zb.Lx(u,l,v)),l.B()||(g&&(l=m.Yl.local().V(l,u,!1,h)),f!=null&&(l=f.Zk(l,!1),this.wp(f,m.bm.reverse,l),l=f.$k(l,!1))),l},E.tv=function(f){if(f.Sb()!=2)return 0;var h=0,l=f.kk();f=l.getNorthPoleLocation();var u=l.getSouthPoleLocation(),d=l.getNorthPoleGeometry();return l=l.getSouthPoleGeometry(),d==m.Cg.PE_POLE_POINT&&f!=m.Cg.PE_POLE_OUTSIDE_BOUNDARY&&(h=1),l==m.Cg.PE_POLE_POINT&&u!=m.Cg.PE_POLE_OUTSIDE_BOUNDARY&&(h|=2),h},E.prototype.hW=function(f,h){var l=this.hf.ef,u=this.hf.Yf,d=l.Sb(),g=u.Sb(),v=m.O.Fu(Math.min(f.I(),64)),b=m.Ta.jg(f);d==3&&(d=(l=(f=l.Ji).fk()).Sb(),b=f.$k(b,!0),this.wp(f,m.bm.forward,b),b=f.Zk(b,!0)),f=null,g==3&&(g=(u=(f=u.Ji).fk()).Sb());var T=d==2;d=(g=g==2)?u.sc():u;var A=!g&&!this.Uv;if(T){if((b=m.zb.UI(b,l,this.lo,h)).B())return b}else{var O=new m.l;b.xc(O);var I=l.Oe();if((O.GI.H)&&(O=m.l.construct(O.v-1,I.G,O.C+1,I.H),(b=m.ri.Nu(b,O,l,NaN,0,h)).B()))return b}var L=NaN;T&&(L=l.zi()),O=u.Wr()!=null,I=this.mH;var N=!isNaN(I);if(N&&(b=m.Xl.local().V(b,I,h)),this.aH)T&&m.zb.ur(l,L,b,v),N&&(T=l.hh(),I*=(L=l.sc().hh())/T),m.zb.tr(this.hf,b,A,v),N&&(T=l.sc().hh(),I*=(L=u.sc().hh())/T),l=b;else{var B=new m.Ta(b.description);B.DD(b),T&&(m.zb.ur(l,L,B,v),N&&(T=l.hh(),I*=(L=l.sc().hh())/T)),m.zb.tr(this.hf,B,A,v),N&&(T=l.sc().hh(),I*=(L=u.sc().hh())/T),A=NaN,g?A=u.zi():isNaN(this.Bm)||(A=this.Bm),T=E.tv(l)|E.tv(u),L=10*d.Xd(0),this.Uv&&(T=3,L=0),l=m.zb.VQ(b,l,B,d,A,h,T,L)}return O&&(l=m.zb.XD(l,u,h)),g&&(l=m.zb.Mz(l,u,this.Qm,h),N&&(l=m.Xl.local().V(l,I,h)),m.zb.Lx(u,l,v)),l.B()||f!=null&&(l=f.Zk(l,!1),this.wp(f,m.bm.reverse,l),l=f.$k(l,!1)),l},E.prototype.eW=function(f,h){var l=(f.ca()+f.R())/400;return l!=0?(l=m.Xl.local().V(f,l,h),l=this.VI(l,h),h=f.Ia(),l.bn(h)):(h=new m.Sa(f.Ip()),l=this.XI(h),h=f.Ia(),l.B()?h.Oa():(f.copyTo(h),f=l.D(),h.K(f.x,f.y,f.x,f.y))),h},E.prototype.fW=function(f,h){f=m.aa.jg(f);var l=this.hf.ef,u=this.hf.Yf,d=l.Sb(),g=u.Sb(),v=m.O.Fu(Math.min(f.I(),64));if(d==3){var b=l.Ji;d=(l=b.fk()).Sb(),f=b.Zk(f,!0),this.wp(b,m.bm.forward,f),f=b.$k(f,!0)}if(d==2){if(this.lo==m.si.Clip?f=m.Xj.local().V(f,l.ml(),l,h):l.Wc()&&(d=new m.l,f.xc(d),l.Oe().contains(d)||(this.lo==m.si.PannableFold&&(f=m.zb.lj(f,l)),m.zb.Jt(f,l.Oe(),l.Xd(0),!0),f=m.zb.Fn(f,l,0,!0,0,h))),f.B())return f;m.zb.ur(l,0,f,v)}else m.zb.Jt(f,l.Oe(),l.Xd(0),!0);return m.zb.tr(this.hf,f,!1,v),l=0,d=!1,b=null,g==3&&(d=!0,g=(u=(b=u.Ji).fk()).Sb()),(g=g==2)?l=u.zi():isNaN(this.Bm)||(l=this.Bm),g&&this.Qm!=m.si.Clip||(f=m.zb.Fn(f,u.sc(),l,!1,0,h)),g&&(f=m.zb.Mz(f,u,this.Qm,h),m.zb.Lx(u,f,v),f.B())||d&&(f=b.Zk(f,!0),this.wp(b,m.bm.reverse,f),f=b.$k(f,!0)),f},E.prototype.wp=function(f,h,l){var u=l.I();if(u!=0){for(var d=l.ub(0),g=m.O.lg(200,0),v=[],b=0;bd.v+g&&bh?this.wv(l,u):this.gv(l,u);case 1:var d=this.wv(l,u);return l=this.gv(l,u),m.lc.hq(d,l,h);case 2:throw m.i.fa("not implemented")}throw m.i.Qa()},f.prototype.fe=function(h,l){var u=this.pa-this.sa,d=this.la-this.na,g=u*u+d*d;return g==0?.5:(h=((h.x-this.sa)*u+(h.y-this.na)*d)/g,l||(0>h?h=0:1(l=(l-this.na)/h)||1(l=(l-this.sa)/h)||1(l=8881784197001252e-31*(Math.abs(u.x*l.y)+Math.abs(u.y*l.x)))?-1:h<-l?1:0},f.prototype.rp=function(h,l,u,d){var g=this.sa,v=this.na,b=h-g,T=l-v;if((b=Math.sqrt(b*b+T*T))<=Math.max(u,6661338147750939e-31*b))return d&&b==0?NaN:0;if(b=h-this.pa,T=l-this.la,(b=Math.sqrt(b*b+T*T))<=Math.max(u,6661338147750939e-31*b))return d&&b==0?NaN:1;if(b=this.pa-this.sa,T=this.la-this.na,0<(d=Math.sqrt(b*b+T*T))){var A=1/d,O=h-g,I=l-v,L=O*(b*=A)+I*(T*=A),N=17763568394002505e-31*(Math.abs(O*b)+Math.abs(I*T)),B=b;if(b=-T,T=B,L<-(N=Math.max(u,N))||L>d+N)return NaN;if(Math.abs(O*b+I*T)<=Math.max(u,17763568394002505e-31*(Math.abs(O*b)+Math.abs(I*T)))&&(.5>=(b=m.O.Rk(L*A,0,1))?(T=this.sa+(this.pa-this.sa)*b,d=this.na+(this.la-this.na)*b):(T=this.pa-(this.pa-this.sa)*(1-b),d=this.la-(this.la-this.na)*(1-b)),m.h.Oy(T,d,h,l)<=u)){if(.5>b){if(m.h.Oy(T,d,g,v)<=u)return 0}else if(m.h.Oy(T,d,this.pa,this.la)<=u)return 1;return b}}return NaN},f.prototype.Nb=function(h){return h!=null&&(h==this||h.constructor===this.constructor&&this.FM(h))},f.prototype.rD=function(h,l,u){var d=u?this.sa:this.pa;u=u?this.na:this.la;var g=new m.h;return g.x=h.pa-d,g.y=h.la-u,!(l.Qh(g)>6661338147750939e-31*l.fD(g))||(g.x=h.sa-d,g.y=h.na-u,l.Qh(g)<=6661338147750939e-31*l.fD(g))},f.prototype.qD=function(h){var l=new m.h;return l.x=this.pa-this.sa,l.y=this.la-this.na,!!this.rD(h,l,!1)&&(l.Sq(),!!this.rD(h,l,!0))},f.NM=function(h,l){var u=h.uu(l.sa,l.na),d=h.uu(l.pa,l.la);return!(0>u&&0>d||0u&&0>d||0(d=l.Qb())?h.qD(l):l.qD(h)))},f.LM=function(h,l,u){var d=m.h.construct(NaN,NaN),g=h.pa-h.sa,v=h.la-h.na,b=l.pa-l.sa,T=l.la-l.na,A=b*v-g*T;if(A==0)return d;var O=8881784197001252e-31*(Math.abs(b*v)+Math.abs(g*T)),I=l.sa-h.sa,L=l.na-h.na,N=b*L-I*T,B=N/A,H=Math.abs(A);return B<-(b=(8881784197001252e-31*(Math.abs(b*L)+Math.abs(I*T))*H+O*Math.abs(N))/(A*A)+2220446049250313e-31*Math.abs(B))||B>1+b||(b=(T=g*L-I*v)/A)<-(g=(8881784197001252e-31*(Math.abs(g*L)+Math.abs(I*v))*H+O*Math.abs(T))/(A*A)+2220446049250313e-31*Math.abs(b))||b>1+g||(B=m.O.Rk(B,0,1),g=m.O.Rk(b,0,1),v=h.hc(B),A=l.hc(g),(O=new m.h).uc(v,A),O.length()>u&&(O.add(v,A),O.scale(.5),B=h.fe(O,!1),g=l.fe(O,!1),h=h.hc(B),l=l.hc(g),h.sub(l),h.length()>u)||d.ma(B,g)),d},f.OM=function(h,l,u,d){var g=0;if((h.sa==l.sa&&h.na==l.na||h.sa==l.pa&&h.na==l.la)&&(g++,!d))return 1;if(h.pa==l.sa&&h.la==l.na||h.pa==l.pa&&h.la==l.la){if(++g==2)return 2;if(!d)return 1}return l.vi(h.sa,h.na,u)||l.vi(h.pa,h.la,u)||h.vi(l.sa,l.na,u)||h.vi(l.pa,l.la,u)?1:d&&g!=0||f.NM(h,l)==0?0:1},f.Zx=function(h,l,u,d,g,v){var b=0,T=h.rp(l.sa,l.na,v,!1),A=h.rp(l.pa,l.la,v,!1),O=l.rp(h.sa,h.na,v,!1),I=l.rp(h.pa,h.la,v,!1);return isNaN(T)||(d!=null&&(d[b]=T),g!=null&&(g[b]=0),u!=null&&(u[b]=m.h.construct(l.sa,l.na)),b++),isNaN(A)||(d!=null&&(d[b]=A),g!=null&&(g[b]=1),u!=null&&(u[b]=m.h.construct(l.pa,l.la)),b++),b==2||isNaN(O)||T==0&&O==0||A==0&&O==1||(d!=null&&(d[b]=0),g!=null&&(g[b]=O),u!=null&&(u[b]=m.h.construct(h.sa,h.na)),b++),b==2||isNaN(I)||T==1&&I==0||A==1&&I==1||(d!=null&&(d[b]=1),g!=null&&(g[b]=I),u!=null&&(u[b]=m.h.construct(l.pa,l.la)),b++),0d[1]&&(h=d[0],d[0]=d[1],d[1]=h,g!=null&&(d=g[0],g[0]=g[1],g[1]=d),u!=null&&(g=m.h.construct(u[0].x,u[0].y),u[0]=u[1],u[1]=g)),b):(b=f.LM(h,l,v),isNaN(b.x)?0:(u!=null&&(u[0]=h.hc(b.x)),d!=null&&(d[0]=b.x),g!=null&&(g[0]=b.y),1))},f.prototype.eG=function(){return 0},f.prototype.op=function(){},f.prototype.toString=function(){return"Line: ["+this.sa.toString()+", "+this.na.toString()+", "+this.pa.toString()+", "+this.la.toString()+"]"},f}(m.SC);m.yb=D}(re||(re={})),function(m){var D=function(){function E(){this.Jm=[],this.ya=-1}return E.prototype.La=function(){return this.ya},E.prototype.next=function(){if(this.Jm!=null&&this.Jm.length!=0){this.ya++;var f=this.Jm[0];return this.Jm=1>=this.Jm.length?[]:this.Jm.slice(1),f}return this.Jm=null},E.prototype.ZX=function(f){this.Jm.push(f)},E.prototype.qe=function(){},E}();m.gL=D}(re||(re={})),function(m){var D;(D=m.SL||(m.SL={}))[D.enumFillRuleOddEven=0]="enumFillRuleOddEven",D[D.enumFillRuleWinding=1]="enumFillRuleWinding";var E=function(f){function h(l,u){var d=f.call(this)||this;if(d.xf=!1,d.Eq=null,d.sq=0,d.rq=0,d.Aj=null,d.Mg=!1,d.nb=null,d.mb=null,d.Ve=null,d.Lj=null,d.Sd=null,d.tq=0,d.gb=0,d.xq=0,u===void 0)d.xf=l,d.Mg=!1,d.tq=0,d.sq=0,d.rq=0,d.wa=0,d.description=m.ee.og();else{if(u==null)throw m.i.N();d.xf=l,d.Mg=!1,d.tq=0,d.sq=0,d.rq=0,d.wa=0,d.description=u}return d.Aj=null,d.gb=0,d}return Ke(h,f),h.prototype.tm=function(){return 0u)throw m.i.Qa();if(this.dc(l)){if(this.mb==null)throw m.i.Qa();var d=this.wa,g=this.Ba(l),v=this.Vc(l);this.dm(this.wa+1),this.mc();for(var b=0,T=this.description.Aa;bl;u--)d=this.nb.read(u),this.nb.write(u,d+1);this.mb.KE(l,1)}},h.prototype.Ap=function(){if(this.wx(),l===void 0){this.Mg=!1;var l=this.da()-1}var u=this.mb.read(l);this.mb.write(l,1|u),this.Ve!=null&&(l=this.Vc(l)-1,this.Ve.write(l,1),this.Lj.write(l,-1))},h.prototype.dc=function(l){return(1&this.mb.read(l))!=0},h.prototype.Nn=function(l){if(this.dc(l))return!0;var u=this.Ba(l);return!(u>(l=this.Vc(l)-1))&&(u=this.Na(u),l=this.Na(l),u.qb(l))},h.prototype.yv=function(l){return(2&this.mb.read(l))!=0},h.prototype.oc=function(l,u){if(this.Jl(l.description),l.getType()!=322)throw m.i.Qa();var d=new m.Sa;(u||this.B())&&(l.To(d),this.nf(d)),l.Po(d),this.lineTo(d)},h.prototype.tp=function(l){var u=this.wa==0;this.sx(l.v,l.G),this.yj(l.v,l.H),this.yj(l.C,l.H),this.yj(l.C,l.G),this.Ap(),this.Mg=!1,u&&this.Lf(256,!1)},h.prototype.ad=function(l,u){if(!l.B()){for(var d=this.wa==0,g=new m.Sa(this.description),v=0;4>v;v++)l.Hf(u?4-v-1:v,g),v==0?this.nf(g):this.lineTo(g);this.Ap(),this.Mg=!1,d&&!u&&this.Lf(256,!1)}},h.prototype.add=function(l,u){for(var d=0;du&&(u=l.da()-1),u>=l.da()||0>d||0>g||g>l.rv(u))throw m.i.fa("index out of bounds");if(g!=0){var b=l.dc(u)&&d+g==l.rv(u);if(!b||g!=1){if(this.Mg=!1,this.Jl(l.description),d=l.Ba(u)+d+1,v&&(g++,d--),b&&g--,b=this.wa,this.dm(this.wa+g),this.mc(),v){if(g==0)return;this.nb.add(this.wa),v=l.mb.read(u),v&=-5,this.xf&&(v|=1),this.mb.write(this.mb.size-1,v),this.mb.add(0)}else this.nb.write(this.mb.size-1,this.wa);v=0;for(var T=this.description.Aa;vI||l.za[I]==null?this.za[v].Ln(O*b,m.ra.se(A),g*O,O*b):this.za[v].Mn(O*b,l.za[I],O*d,g*O,!0,O,O*b)}if(this.tm()||l.yv(u))throw m.i.Qa();this.Pc(1993)}}},h.prototype.oJ=function(){for(var l=0,u=this.da();l=this.da())throw m.i.N();var u=this.Ba(l),d=this.Ja(l);l=this.dc(l)?1:0;for(var g=0,v=this.description.Aa;gl&&(l=u-1),l>=u)throw m.i.N();for(var d=this.Ba(l),g=this.Ja(l),v=0,b=this.description.Aa;v=u.da())throw m.i.N();var v=this.da();if(l>v)throw m.i.N();0>l&&(l=v),0>d&&(d=u.da()-1),this.Mg=!1,this.Jl(u.description),u.mc();var b=u.Ba(d),T=u.Ja(d),A=this.wa,O=u.dc(d)&&!g?1:0;this.dm(this.wa+T),this.mc();for(var I=l=l+1;g--)b=this.nb.read(g-1),this.nb.write(g,b+T);for(u.yv(d),this.mb.add(0),g=v-1;g>=l+1;g--)v=this.mb.read(g),v&=-5,this.mb.write(g+1,v);v=u.JR().read(d),v&=-5,this.xf&&(v|=1),this.mb.write(l,v)},h.prototype.Hz=function(l,u){var d=-1,g=this.da();if(d>g)throw m.i.N();0>d&&(d=g),this.Mg=!1;var v=this.wa;this.dm(this.wa+u),this.mc();var b=d=d+1;v--)b=this.nb.read(v-1),this.nb.write(v,b+u);for(this.mb.add(0),v=g-1;v>=d+1;v--)u=this.mb.read(v),u&=-5,this.mb.write(v+1,u);this.xf&&this.mb.write(d,1)},h.prototype.qG=function(l,u,d){var g=-1;if(0>l&&(l=this.da()),l>this.da()||g>this.Ja(l)||d>u.length)throw m.i.fa("index out of bounds");if(d!=0){l==this.da()&&(this.nb.add(this.wa),this.xf?this.mb.add(1):this.mb.add(0)),0>g&&(g=this.Ja(l)),this.mc();var v=this.wa;this.dm(this.wa+d),this.mc();for(var b=0,T=this.description.Aa;bl&&(l=this.da()),l>=g||u>this.Ja(l))throw m.i.fa("index out of bounds");l==this.da()&&(this.nb.add(this.wa),this.xf?this.mb.add(1):this.mb.add(0)),0>u&&(u=this.Ja(l));var v=this.wa;this.dm(this.wa+1),this.mc();var b=this.Ba(l);this.za[0].vj(2*(b+u),d,2*v),d=1;for(var T=this.description.Aa;dl&&(l=d-1),l>=d||u>=this.Ja(l))throw m.i.fa("index out of bounds");this.mc();var g=this.Ba(l);0>u&&(u=this.Ja(l)-1),u=g+u,g=0;for(var v=this.description.Aa;g=l+1;d--)u=this.nb.read(d),this.nb.write(d,u-1);this.wa--,this.Pg--,this.Pc(1993)},h.prototype.uE=function(l,u,d){var g=this.Ba(l)+u;if((d=this.Ba(d)+void 0)g||d>this.I()-1)throw m.i.N();u=0,(l=this.Ga()).Vb(g);do{for(;l.Ha()&&(g=l.ha(),l.wb()!=d);)u+=g=g.Qb();if(l.wb()==d)break}while(l.$a());return u},h.prototype.fO=function(l,u,d){if(u=this.Ba(l)+u,d=this.Ba(l)+d,0>u||d>this.I()-1)throw m.i.N();var g=this.Ga();if(u>d){if(!this.dc(l))throw m.i.N("cannot iterate across an open path");g.JB()}var v=l=0;g.Vb(u);do v+=l,l=g.ha().Qb();while(g.wb()!=d);return v},h.prototype.mg=function(){return m.pi.gm(this,null)},h.prototype.KS=function(l,u,d){for(var g=l;gu){var b=this.tm(),T=0;u=this.wa}else b=this.yv(u),T=this.Ba(u),u=this.Vc(u);for(;T=this.Ba(u))return u;u--}else u++;if(0<=u&&u=this.Ba(u)&&ld){for(u=0;uu;){var g=u+(d-u>>1);if(l=(u=this.Vc(g))))return this.gb=g;u=g+1}}return this.gb=u},h.prototype.yz=function(){var l=this.I();if(!this.xf){l-=this.da();for(var u=0,d=this.da();ud.RR()))return!0;this.Bb.yD(null)}return d=m.Nx.create(this,l,u),this.Bb.yD(d),!0},h.prototype.cc=function(){var l=f.prototype.cc.call(this);if(!this.Ac()){var u=this.da();this.nb!=null&&this.nb.An(l,0,u+1),this.mb!=null&&this.mb.An(l,0,u)}return l},h.prototype.ZF=function(l){return this.Ve!=null?this.Ve.read(l):1},h.prototype.bc=function(l,u,d){var g=this.sz(l);if(l==this.Vc(g)-1&&!this.dc(g))throw m.i.fa("index out of bounds");this.mc();var v=this.Ve,b=1;if(v!=null&&(b=7&v.read(l)),b!==1)throw m.i.Qa();if(u.Or(),u=u.get(),d?u.Nf(m.ee.og()):u.Nf(this.description),g=l==this.Vc(g)-1&&this.dc(g)?this.Ba(g):l+1,v=new m.h,this.D(l,v),u.Dc(v),this.D(g,v),u.Qc(v),!d)for(d=1,v=this.description.Aa;d=this.da())throw m.i.N();if(this.B())u.Oa();else{if(this.yv(l))throw m.i.fa("not implemented");var d=this.ub(0),g=new m.h,v=new m.l;v.Oa();var b=this.Ba(l);for(l=this.Vc(l);bthis.I())&&(l=m.ta.nE(this),this.Bb.WM(l),!0)},h.prototype.hM=function(){if(this.Bb==null&&(this.Bb=new m.Uk),this.Bb.zo==null){this.Bb.xD(null);var l=m.ta.YN(this);this.Bb.xD(l)}},h.prototype.Yo=function(l){this.xq=l},h.prototype.In=function(){return this.xq},h.prototype.DD=function(l){if(this==l)throw m.i.fa("MultiPathImpl.add");for(var u=this.da(),d=0;d=(u=this.Vc(u))||lu?h.I():u,0>l||l>h.I()||ul?u:l,0>u||0>l)throw m.i.N();if(l!=0){u=l-0,l=this.wa,this.resize(this.wa+u);for(var d=0;dh||h>=this.I())throw m.i.fa("index out of bounds");this.mc();for(var l=0,u=this.description.Aa;ll||l>=this.wa||uh?h:E},D.Th=function(E,f){var h=5381;return((h=((h=((h=f!==void 0?(f<<5)+f+(255&E):(h<<5)+h+(255&E))<<5)+h+(E>>8&255))<<5)+h+(E>>16&255))<<5)+h+(E>>24&255)&2147483647},D.uj=function(){throw Error("Not Implemented")},D.bB=function(E){return D.aU(E)+12345&2147483647},D.XG=function(E){var f=32,h=E%D.Qx|0,l=E/D.Qx|0;return(f&=63)==0?E:(32>f?(E=h>>>f|l<<32-f,f=l>>f):(E=l>>f-32,f=0<=l?0:-1),f*D.Qx+(E>>>0))},D.aU=function(E){var f=1103515245,h=65535&f;return((f-h)*(E|=0)|0)+(h*E|0)|0},D.truncate=function(E){return 0>E?-1*Math.floor(Math.abs(E)):Math.floor(E)},D.MAX_SAFE_INTEGER=Math.pow(2,53)-1,D.MIN_SAFE_INTEGER=-D.MAX_SAFE_INTEGER,D.VC=65536,D.Qx=D.VC*D.VC,D}()}(re||(re={})),function(m){var D;(D=m.CL||(m.CL={}))[D.Project=0]="Project",D[D.Union=1]="Union",D[D.Difference=2]="Difference",D[D.Proximity2D=3]="Proximity2D",D[D.Relate=4]="Relate",D[D.Equals=5]="Equals",D[D.Disjoint=6]="Disjoint",D[D.Intersects=7]="Intersects",D[D.Within=8]="Within",D[D.Contains=9]="Contains",D[D.Crosses=10]="Crosses",D[D.Touches=11]="Touches",D[D.Overlaps=12]="Overlaps",D[D.Buffer=13]="Buffer",D[D.Distance=14]="Distance",D[D.Intersection=15]="Intersection",D[D.Clip=16]="Clip",D[D.Cut=17]="Cut",D[D.DensifyByLength=18]="DensifyByLength",D[D.DensifyByAngle=19]="DensifyByAngle",D[D.LabelPoint=20]="LabelPoint",D[D.GeodesicBuffer=21]="GeodesicBuffer",D[D.GeodeticDensifyByLength=22]="GeodeticDensifyByLength",D[D.ShapePreservingDensify=23]="ShapePreservingDensify",D[D.GeodeticLength=24]="GeodeticLength",D[D.GeodeticArea=25]="GeodeticArea",D[D.Simplify=26]="Simplify",D[D.SimplifyOGC=27]="SimplifyOGC",D[D.Offset=28]="Offset",D[D.Generalize=29]="Generalize",D[D.SymmetricDifference=30]="SymmetricDifference",D[D.ConvexHull=31]="ConvexHull",D[D.Boundary=32]="Boundary",D[D.SimpleRelation=33]="SimpleRelation";var E=function(){function f(){}return f.prototype.getType=function(){return null},f.prototype.wn=function(){},f.prototype.Iu=function(){return!1},f}();m.Je=E}(re||(re={})),function(m){var D=function(E){function f(){return E!==null&&E.apply(this,arguments)||this}return Ke(f,E),f.prototype.getType=function(){return 13},f.local=function(){return f.instance===null&&(f.instance=new f),f.instance},f.prototype.V=function(h,l,u,d,g){return h instanceof m.aa?(g=new m.Zc(h),this.V(g,l,[u],!1,d).next()):d===!0?(u=new m.BC(h,l,u,!1,g),m.Gh.local().V(u,l,g)):new m.BC(h,l,u,!1,g)},f.instance=null,f}(m.Je);m.AC=D}(re||(re={})),function(m){var D=function(){function E(f,h,l,u,d){this.ya=-1,this.Rd=f,this.$z=h,this.Cs=l,this.tT=new m.l,this.tT.Oa(),this.eo=-1,this.Ub=d}return E.prototype.next=function(){for(var f;(f=this.Rd.next())!=null;)return this.ya=this.Rd.La(),this.eo+1=f.I():f.da()==1&&(2>=f.I()||m.Zt.JG(f,0)))},E}();m.DC=D}(re||(re={})),function(m){var D=function(E){function f(){return E!==null&&E.apply(this,arguments)||this}return Ke(f,E),f.prototype.getType=function(){return 17},f.local=function(){return f.instance===null&&(f.instance=new f),f.instance},f.prototype.V=function(h,l,u,d,g){return new m.nL(h,l,u,d,g)},f.instance=null,f}(m.Je);m.mL=D}(re||(re={})),function(m){var D=function(){function E(f,h,l,u,d){if(this.Tf=null,h==null||l==null)throw m.i.fa("invalid argument");this.qT=f,this.nA=h,this.lH=l,f=m.ta.mv(h,l),this.qa=m.ta.Wd(u,f,!0),this.kH=-1,this.nd=d}return E.prototype.La=function(){return 0},E.prototype.next=function(){return this.RQ(),++this.kHthis.Tf.length&&(this.Tf.length=0)},E.prototype.SQ=function(){var f=new m.ia(0),h=new m.gd,l=h.aF(),u=h.Ib(this.nA),d=h.Ib(this.lH),g=new m.Fg;try{g.Ft(h,this.qa,this.nd),g.dl(l,u,d,f);var v=h.Ne(u),b=new m.Da,T=new m.Da;for(this.Tf.length=0,this.Tf.push(b),this.Tf.push(T),u=0;u=l)throw m.i.N();return new m.oL(h,l,u)},f.instance=null,f}(m.Je);m.Xl=D}(re||(re={})),function(m){var D=function(){function E(f,h){this.ya=-1,this.Rd=f,this.Ps=h}return E.prototype.La=function(){return this.ya},E.prototype.next=function(){var f;return(f=this.Rd.next())!=null?(this.ya=this.Rd.La(),this.NP(f)):null},E.prototype.NP=function(f){if(f.B()||1>f.Db())return f;var h=f.getType();if(h==1736||h==1607)return this.Ny(f);if(m.aa.yd(h))return this.PP(f);if(h==197)return this.OP(f);throw m.i.Qa()},E.prototype.PP=function(f){if(f.Qb()<=this.Ps)return f;var h=new m.Ta(f.description);return h.oc(f,!0),this.Ny(h)},E.prototype.OP=function(f){var h=new m.Da(f.description);h.ad(f,!1);var l=new m.l;return f.A(l),f=l.ca(),l.R()<=this.Ps&&f<=this.Ps?h:this.Ny(h)},E.prototype.Ny=function(f){for(var h=f.Ia(),l=f.Ga();l.$a();)for(var u=!0;l.Ha();){var d=l.ha();if(d.getType()!=322)throw m.i.fa("not implemented");var g=l.On(),v=d.Qb();if(v>this.Ps){var b=Math.ceil(v/this.Ps);v=new m.Sa(f.description),u&&(d.To(v),h.nf(v));var T=u=1/b,A=0;for(--b;Av)return h;var b=h.getType(),T=l.getType(),A=new m.l,O=new m.l,I=new m.l;h.A(A),l.A(O),I.K(A),I.Zb(O);var L=(I=m.ta.Wd(u,I,!0))*Math.sqrt(2)*1.00001,N=new m.l;if(N.K(A),N.W(L,L),!N.isIntersecting(O))return h;if(g==1&&v==2)return f.KV(h,l,T,u,d);if(b==33)switch(m.Vk.yd(T)?(u=new m.Ta(l.description),u.oc(l,!0)):u=l,T){case 1736:return f.XU(h,u,I);case 1607:return f.YU(h,u,I);case 550:return f.VU(h,u,I);case 197:return f.UU(h,u,I);case 33:return f.WU(h,u,I);default:throw m.i.N()}else if(b==550)switch(T){case 1736:return f.nU(h,l,I);case 197:return f.lU(h,l,I);case 33:return f.mU(h,l,I)}return m.Fg.im(h,l,u,d)},f.XU=function(h,l,u){return m.hd.KG(l,h,u)==0?h:h.Ia()},f.YU=function(h,l,u){var d=h.D();l=l.Ga();for(var g=u*Math.sqrt(2)*1.00001,v=g*g,b=new m.l;l.$a();)for(;l.Ha();){var T=l.ha();if(T.A(b),b.W(g,g),b.contains(d)){if(T.qs(d,u))return h.Ia();var A=T.ac();if(m.h.yc(d,A)<=v||(A=T.wc(),m.h.yc(d,A)<=v))return h.Ia()}}return h},f.VU=function(h,l,u){var d=l.ub(0);l=l.I();var g=h.D(),v=new m.h;u=u*Math.sqrt(2)*1.00001,u*=u;for(var b=0;bl.I()?this.gE(h,l,u):(this.Nt(),h=this.gE(l,h,u),this.Nt(),h):h.getType()==550&&m.aa.Hc(l.getType())?(h=this.hE(l,h,u),this.Nt(),h):l.getType()==550&&m.aa.Hc(h.getType())?this.hE(h,l,u):h.getType()==550&&l.getType()==550?h.I()>l.I()?this.iE(h,l):(this.Nt(),h=this.iE(l,h),this.Nt(),h):0},f.prototype.gE=function(h,l,u){var d=h.Ga(),g=l.Ga(),v=new m.l,b=new m.l,T=17976931348623157e292;if(!u&&this.pY(h,l,d,g))return 0;for(;d.$a();)for(;d.Ha();)if((h=d.ha()).A(v),!(v.px(this.oh)>T)){for(;g.$a();)for(;g.Ha();)if((l=g.ha()).A(b),v.px(b)v)){for(var O=0;Od)){for(var O=0;Of.Ja(h))){var d=f.Ba(h),g=f.Vc(h)-1,v=f.ub(0),b=f.dc(h),T=new m.ia(0);T.Jb(f.Ja(h)+1);var A=new m.ia(0);for(A.Jb(f.Ja(h)+1),T.add(b?d:g),T.add(d),d=new m.h;1this.DH&&b>g&&(d=u,g=b)}return d},E.prototype.qe=function(){},E}();m.sL=D}(re||(re={})),function(m){var D=function(E){function f(){return E!==null&&E.apply(this,arguments)||this}return Ke(f,E),f.prototype.getType=function(){return 29},f.prototype.V=function(h,l,u,d){return h instanceof m.aa?(h=new m.Zc(h),this.V(h,l,u,d).next()):new m.sL(h,l,u,d)},f.local=function(){return f.instance===null&&(f.instance=new f),f.instance},f.instance=null,f}(m.Je);m.EC=D}(re||(re={})),function(m){var D=function(E){function f(){return E!==null&&E.apply(this,arguments)||this}return Ke(f,E),f.prototype.getType=function(){return 21},f.local=function(){return f.instance===null&&(f.instance=new f),f.instance},f.prototype.V=function(h,l,u,d,g,v,b,T){return h instanceof m.aa?(T=new m.Zc(h),this.V(T,l,u,[d],g,v,!1,b).next()):b===!0?(u=new m.GC(h,l,u,d,g,!1,!1,T),m.Gh.local().V(u,l,T)):new m.GC(h,l,u,d,g,!1,!1,T)},f.instance=null,f}(m.Je);m.FC=D}(re||(re={})),function(m){var D=function(){function E(f,h,l,u,d,g,v,b){if(g)throw m.i.Ie();if(h==null)throw m.i.N();this.ya=-1,this.Ms=f,this.vg=h,this.ze=l,this.Cs=u,this.$n=d,this.eo=-1,this.Ub=b,this.uT=new m.l,this.uT.Oa()}return E.prototype.next=function(){for(var f;(f=this.Ms.next())!=null;)return this.ya=this.Ms.La(),this.eo+1h.Db())return 0;if(u==4)throw m.i.Ie();var d=m.cb.sc(l),g=m.cb.vv(d),v=m.cb.ev(d);g*=2-g;var b=d.Hd().ai,T=h.getType();if(T==1736||T==197)var A=h.mg();else m.aa.yd(T)?(A=new m.Ta(h.description)).oc(h,!0):A=h;if(d.Nb(l)==0){if(m.cb.Wc(l)){A=m.Hh.lj(A,l),T==1607&&A==h&&(A=m.aa.jg(h)),h=new m.Nc,m.cb.gh(l).cn(h),T=0;for(var O=A.I();T=this.Fi||7d||l==0&&h==550&&this.Dj==33?this.nJ():E.HB(f,u);if((this.Fi==-1||this.Fi==4)&&h==197&&this.Dj==197)return l=this.Se,h=new m.l,f.A(h),u=new m.l,l.A(u),h.Ea(u),l=new m.Fh,f.copyTo(l),l.Xo(h),l;if(h==197&&m.aa.tf(this.Dj)==0||this.Dj==197&&m.aa.tf(h)==0)return u=h==197?f:this.Se,f=h==197?this.Se:f,h=new m.l,u.A(h),m.Ud.clip(f,h,l,0);if(m.aa.tf(h)==0&&0b&&(b=l.yz()),g=l.I()+u.I(),b*u.I()>Math.log(g)*g*4)return null;g=null,b=u.Ga(),T!=null&&T.Fb!=null&&(g=T.Fb),g==null&&20q){if(g!=null)for(u==null?u=g.vR(oe,d):u.Uo(oe,d),q=u.next();q!=-1;q=u.next()){b.Vb(g.ja(q)),q=b.ha();var ye=oe.Ea(q,null,A,null,d);for(q=0;qee?(L=T.wb()-l.Ba(K),N=1,ee=ee==0?3:2):N++:(f.oc(me,ee==0),ee=1);break;case 0:ee=0,L=-1,N=0;break;default:return null}me=Te}}}else{if(0>(q=this.QD(h,oe.ac(),d)))return null;q==1?(2>ee&&(L=T.wb()-l.Ba(K),ee=ee==0?3:2),N++):(L=-1,N=0)}O.clear(!1)}else q!=0&&q==1&&(ee==0?(ee=3,L=T.wb()-l.Ba(K)):ee==1?(ee=2,L=T.wb()-l.Ba(K)):N++)}2<=ee&&(f.Dr(l,K,L,N,ee==3),L=-1)}return f},E.prototype.QD=function(f,h,l){return m.Dg.wm(f,h,l)},E.prototype.RD=function(f,h,l){var u=h.ac();h=h.wc();var d=m.Dg.wm(f,u,l),g=m.Dg.wm(f,h,l);return d==1&&g==0||d==0&&g==1?-1:d==0||g==0?0:d==1||g==1?1:((d=new m.h).add(u,h),d.scale(.5),(f=m.Dg.wm(f,d,l))==0?0:f==1?1:-1)},E.HB=function(f,h){return h?f:f.Ia()},E.prototype.nJ=function(){return this.yH==null&&(this.yH=this.Se.Ia()),this.yH},E.prototype.qe=function(){},E}();m.HC=D}(re||(re={})),function(m){var D=function(E){function f(){return E!==null&&E.apply(this,arguments)||this}return Ke(f,E),f.prototype.getType=function(){return 28},f.local=function(){return f.instance===null&&(f.instance=new f),f.instance},f.prototype.V=function(h,l,u,d,g,v,b){return h instanceof m.aa?(h=new m.Zc(h),this.V(h,l,u,d,g,v,b).next()):new m.xL(h,l,u,d,g,v,b)},f.instance=null,f}(m.Je);m.IC=D}(re||(re={})),function(m){var D=function(){function E(f,h,l,u,d,g,v){this.ya=-1,this.Rd=f,this.Mj=h,this.Ka=l,this.Ki=u,this.CA=d,this.uH=g,this.nd=v}return E.prototype.next=function(){var f=this.Rd.next();return f!=null?(this.ya=this.Rd.La(),this.jL(f)):null},E.prototype.La=function(){return this.ya},E.prototype.jL=function(f){var h=0>=this.uH?m.ta.kj(this.Mj,f,!1):this.uH;return m.IK.V(f,this.Ka,this.Ki,this.CA,h,this.nd)},E.prototype.qe=function(){},E}();m.xL=D}(re||(re={})),function(m){var D;(D=m.NK||(m.NK={}))[D.clipToDomainOnly=1]="clipToDomainOnly",D[D.clipWithHorizon=2]="clipWithHorizon",D[D.foldAndClipWithHorizon=3]="foldAndClipWithHorizon";var E=function(f){function h(){return f!==null&&f.apply(this,arguments)||this}return Ke(h,f),h.prototype.getType=function(){return 0},h.local=function(){return h.instance===null&&(h.instance=new h),h.instance},h.prototype.V=function(l,u,d){return l instanceof m.aa?(l=new m.Zc(l),this.V(l,u,d).next()):new m.yL(l,u,d)},h.prototype.transform=function(l,u,d,g){return m.bu.transform(l,u,d,g,!0)},h.prototype.Qt=function(l,u,d,g){return m.bu.Qt(l,u,d,g)},h.instance=null,h}(m.Je);m.Hx=E}(re||(re={})),function(m){var D=function(){function E(f,h,l){this.ya=-1,this.Rd=f,this.MT=h,this.nd=l}return E.prototype.next=function(){var f=this.Rd.next();return f!=null?(this.ya=this.Rd.La(),m.bu.zh(f,this.MT,this.nd)):null},E.prototype.La=function(){return this.ya},E.prototype.qe=function(){},E}();m.yL=D}(re||(re={})),function(m){var D=function(){function f(){}return f.prototype.reset=function(){this.ph=this.xk=-1,this.us=this.kq=!1},f.prototype.AQ=function(h,l,u){for(h.Vb(l,u);h.Ha();){var d=h.ha();if((d=d.Qb())!=0)return h.wb()}for(h.Vb(l,u);h.Ez();)if((d=(d=h.li()).Qb())!=0)return h.wb();return-1},f.prototype.BQ=function(h,l){for(h.Vb(l,-1);h.Ez();)if(h.li().Qb()!=0)return h.wb();return-1},f.prototype.zQ=function(h,l){for(h.Vb(l,-1),h.ha();h.Ha();)if(h.ha().Qb()!=0)return h.wb();return-1},f.prototype.yQ=function(h,l,u,d){if(this.xk=this.AQ(l,u,d),this.xk!=-1){l.Vb(this.xk,-1);var g=l.ha(),v=g.hc(g.fe(h,!1));if(u=m.h.yc(v,h),(d=new m.h).L(v),d.sub(g.ac()),(v=new m.h).L(h),v.sub(g.ac()),this.kq=0>d.wi(v),this.ph=this.zQ(l,this.xk),this.ph!=-1){l.Vb(this.ph,-1);var b=(g=l.ha()).fe(h,!1);b=g.hc(b);var T=m.h.yc(b,h);T>u?this.ph=-1:(d.L(b),d.sub(g.ac()),v.L(h),v.sub(g.ac()),this.us=0>d.wi(v))}this.ph==-1&&(this.ph=this.BQ(l,this.xk),this.ph!=-1&&(l.Vb(this.ph,-1),b=(g=l.ha()).fe(h,!1),b=g.hc(b),(T=m.h.yc(b,h))>u?this.ph=-1:(d.L(b),d.sub(g.ac()),v.L(h),v.sub(g.ac()),this.us=0>d.wi(v),h=this.xk,this.xk=this.ph,this.ph=h,h=this.kq,this.kq=this.us,this.us=h)))}},f.prototype.cO=function(h,l,u,d,g){return u=u.Ga(),this.yQ(h,u,d,g),this.xk!=-1&&this.ph==-1?this.kq:this.xk!=-1&&this.ph!=-1?this.kq==this.us?this.kq:(u.Vb(this.xk,-1),h=u.ha().kg(),u.Vb(this.ph,-1),l=u.ha().kg(),0<=h.wi(l)):l},f}(),E=function(f){function h(){return f!==null&&f.apply(this,arguments)||this}return Ke(h,f),h.local=function(){return h.instance===null&&(h.instance=new h),h.instance},h.prototype.getType=function(){return 3},h.prototype.nz=function(l,u,d){var g;if(g===void 0&&(g=!1),l.B())return new m.$l;u=u.D();var v=l,b=l.getType();switch(b==197&&((v=new m.Da).ad(l,!1),b=1736),b){case 33:return this.xI(v,u);case 550:return this.jI(v,u);case 1607:case 1736:return this.bU(v,u,d,g);default:throw m.i.fa("not implemented")}},h.prototype.oz=function(l,u){if(l.B())return new m.$l;u=u.D();var d=l,g=l.getType();switch(g==197&&((d=new m.Da).ad(l,!1),g=1736),g){case 33:return this.xI(d,u);case 550:case 1607:case 1736:return this.jI(d,u);default:throw m.i.fa("not implemented")}},h.prototype.pz=function(l,u,d,g){if(0>g)throw m.i.N();if(l.B())return[];u=u.D();var v=l,b=l.getType();switch(b==197&&((v=new m.Da).ad(l,!1),b=1736),b){case 33:return this.TU(v,u,d,g);case 550:case 1607:case 1736:return this.tU(v,u,d,g);default:throw m.i.fa("not implemented")}},h.prototype.bU=function(l,u,d,g){if(l.getType()==1736&&d&&(d=new m.l,l.A(d),d=m.ta.Wd(null,d,!1),(g?m.hd.Yd(l,u,0):m.hd.Yd(l,u,d))!=0)){var v=new m.$l(u,0,0);return g&&v.WJ(!0),v}var b=l.Ga();v=new m.h;for(var T=d=-1,A=17976931348623157e292,O=0;b.$a();)for(;b.Ha();){var I=b.ha();I=I.hc(I.fe(u,!1));var L=m.h.yc(I,u);Lm.h.Uq(u,I.ac(),I.wc()),1=u||(l.length=g),l.slice(0)},h.instance=null,h}(m.Je);m.Ix=E}(re||(re={})),function(m){var D=function(E){function f(){return E!==null&&E.apply(this,arguments)||this}return Ke(f,E),f.prototype.getType=function(){return 4},f.prototype.V=function(h,l,u,d,g){return m.am.yB(h,l,u,d,g)},f.local=function(){return f.instance===null&&(f.instance=new f),f.instance},f.prototype.Iu=function(h){return m.Vt.wy(h)},f.prototype.wn=function(h,l,u){m.Vt.CD(h,l,u)},f.instance=null,f}(m.Je);m.zL=D}(re||(re={})),function(m){var D=function(E){function f(){return E!==null&&E.apply(this,arguments)||this}return Ke(f,E),f.prototype.getType=function(){return 33},f.prototype.V=function(h,l,u,d,g){return h===1073741824?!m.ud.zB(l,u,d,4,g):m.ud.zB(l,u,d,h,g)},f.local=function(){return f.instance===null&&(f.instance=new f),f.instance},f.prototype.Iu=function(h){return m.Vt.wy(h)},f.prototype.wn=function(h,l,u){m.Vt.CD(h,l,u)},f.instance=null,f}(m.Je);m.dj=D}(re||(re={})),function(m){var D=function(){function E(f,h,l,u){if(this.nd=u,this.rT=l,this.ya=-1,f==null)throw m.i.N();this.yk=f,this.Mj=h}return E.prototype.next=function(){var f;if((f=this.yk.next())!=null){if(this.ya=this.yk.La(),this.nd!=null&&!this.nd.progress(-1,-1))throw m.i.fu("user_canceled");return this.eC(f)}return null},E.prototype.La=function(){return this.ya},E.prototype.eC=function(f){if(f==null)throw m.i.N();return m.Jx.cK(f,this.Mj,this.rT,this.nd)},E.prototype.qe=function(){},E}();m.AL=D}(re||(re={})),function(m){var D=function(E){function f(){return E!==null&&E.apply(this,arguments)||this}return Ke(f,E),f.prototype.getType=function(){return 26},f.prototype.V=function(h,l,u,d){return h instanceof m.aa?(h=new m.Zc(h),this.V(h,l,u,d).next()):new m.AL(h,l,u,d)},f.prototype.rs=function(h,l,u,d,g){return 0<(d!==void 0?m.Jx.rs(h,l,u,d,g):m.Jx.rs(h,l,!1,null,u))},f.local=function(){return f.instance===null&&(f.instance=new f),f.instance},f.instance=null,f}(m.Je);m.Yl=D}(re||(re={})),function(m){var D=function(){function g(){this.yq=0}return g.prototype.nX=function(v){this.yq&=-2,this.yq|=v?1:0},g.prototype.Wp=function(){return(1&this.yq)!=0},g.prototype.XF=function(){return this.Wp()?0:1},g}();m.xY=D;var E=function(){},f=function(g,v,b,T){this.x=g,this.y=v,this.Ai=b,this.xm=T},h=function(){function g(v){this.Be=v}return g.prototype.compare=function(v,b,T){return v=v.ja(T),b=this.Be.lf.read(2*b),0>(b-=v=this.Be.lf.read(2*v))?-1:0I?1:0},g}(),u=function(){function g(v,b){this.YI=new m.h,this.parent=v,this.dS=b}return g.prototype.nr=function(v,b,T){var A=this.parent,O=this.dS;T.Vd(v,b,function(I,L){return A.Mh(I,L,O)})},g.prototype.$p=function(v){return v=this.parent.gi.get(v),this.parent.lf.tc(2*(v>>1),this.YI),this.YI.y+(1&v?this.parent.Oj:-this.parent.Oj)},g}(),d=function(){function g(v,b,T,A,O){this.nH=v.description,this.X=v,this.Qg=b,this.Oj=m.ta.kj(this.Qg,v,!1),this.Bo=m.ta.kj(this.Qg,v,!0),this.xA=T,this.oT=this.nH.Aa,this.hb=[],this.po=[],this.mh=new m.jp,this.fb=new m.Yj,this.ke=new m.Md,this.ZG=this.ql=O}return g.prototype.eT=function(){return this.ZG=!0,(!m.aa.Hc(this.X.getType())||this.GE()&&this.DE(!1))&&this.mO()?m.aa.Hc(this.X.getType())?this.pO()?this.X.getType()==1607?this.rO()?2:0:this.sO()?this.tO():0:0:2:0},g.prototype.kC=function(v,b){var T=this.lf.read(2*v);v=this.lf.read(2*v+1);var A=this.lf.read(2*b);b=this.lf.read(2*b+1);var O=!m.Yt.Cv(T,v,A,b,this.Oj*this.Oj);return O||this.X.Db()!=0&&T==A&&v==b},g.prototype.GE=function(){for(var v=this.X,b=v.xf?3:2,T=0,A=v.da();Tthis.Oj)){if(v&&A){var I=O.wv(1,0);if(O=O.wv(1,0),Math.abs(O-I)>b)continue}return this.ke=new m.Md(2,T.wb(),-1),!1}}return!0},g.prototype.mO=function(){var v=this.X,b=null;m.aa.Hc(this.X.getType())&&(b=this.X);var T=(this.ZG||this.ql)&&b!=null,A=v.I();this.lf=v.ub(0),this.gi=new m.ia(0),this.gi.Jb(2*A),this.fi=new m.ia(0),this.fi.Jb(2*A),T&&(this.Fl==null&&(this.Fl=new m.ia(0)),this.Fl.Jb(A));for(var O=v=0;O=b.Vc(v);)v++;this.Fl.add(v)}for(new m.Xt().sort(this.fi,0,2*A,new u(this,T)),this.fb.clear(),this.fb.Vo(new h(this)),this.fb.De(A),b=0,A*=2;b>1,(1&v)==0){if(v=this.fb.addElement(T,-1),(O=this.fb.we(v))!=-1&&!this.kC(this.fb.ja(O),T))return this.ke=new m.Md(3,T,this.fb.ja(O)),!1;var I=this.fb.lb(v);if(I!=-1&&!this.kC(this.fb.ja(I),T))return this.ke=new m.Md(3,T,this.fb.ja(I)),!1}else if(v=this.fb.search(T,-1),O=this.fb.we(v),I=this.fb.lb(v),this.fb.vd(v,-1),O!=-1&&I!=-1&&!this.kC(this.fb.ja(O),this.fb.ja(I)))return this.ke=new m.Md(3,this.fb.ja(O),this.fb.ja(I)),!1;return!0},g.prototype.pO=function(){return 10>this.X.I()?this.nO():this.oO()},g.prototype.oO=function(){var v=new m.gd;v.Ib(this.X);var b=new m.Md;return!m.$t.kI(!1,v,this.Oj,b,this.nd)||(b.Jo=v.Ua(b.Jo),b.Ko=v.Ua(b.Ko),this.ke.Wt(b),!1)},g.prototype.nO=function(){var v=this.X,b=v.Ga();for(v=v.Ga();b.$a();)for(;b.Ha();){var T=b.ha();if(!b.Qn()||!b.$S()){v.BW(b);do for(;v.Ha();){var A=v.ha();if((A=T.zr(A,this.Oj,!0))!=0)return this.ke=new m.Md(A==2?5:4,b.wb(),v.wb()),!1}while(v.$a())}}return!0},g.prototype.sO=function(){var v=this.X;this.hb.length=0,this.po.length=0,this.Zf=v.Ga(),this.Zf.JB();var b=new m.ia(0);b.Jb(10);var T=NaN,A=0,O=0;for(v=2*v.I();O>=1;var L=this.lf.read(2*I),N=this.lf.read(2*I+1);if(b.size!=0&&(L!=T||N!=A)){if(!this.RI(b))return!1;b!=null&&b.clear(!1)}b.add(I),T=L,A=N}}return!!this.RI(b)},g.prototype.rO=function(){for(var v=this.X,b=Array(v.da()),T=0,A=v.da();T>1;this.lf.tc(2*I,O);var L=b[T=this.Fl.get(I)],N=v.Ba(T),B=v.Vc(T)-1;A.el=I==N||I==B,A.ny=this.ql?!L&&A.el:A.el,A.Ai=T,A.x=O.x,A.y=O.y,A.xm=I;for(var H=new E,K=1,ee=this.fi.size;K>1,this.lf.tc(2*I,O),(T=this.Fl.get(I))!=A.Ai&&(L=b[T],N=v.Ba(T),B=v.Vc(T)-1);var q=I==N||I==B,oe=this.ql?!L&&A.el:A.el;if(H.x=O.x,H.y=O.y,H.Ai=T,H.xm=I,H.ny=oe,H.el=q,H.x==A.x&&H.y==A.y){if(this.ql){if(!(H.ny&&A.ny||H.Ai==A.Ai&&(H.el||A.el)))return this.ke=new m.Md(8,H.xm,A.xm),!1}else if(!H.el||!A.el)return this.ke=new m.Md(5,H.xm,A.xm),!1}T=A,A=H,H=T}return!0},g.prototype.JE=function(){for(var v=this.X,b=[],T=-1,A=!1,O=0,I=v.da();O>1;this.lf.tc(2*L,A),O=this.Fl.get(L),T=new f(A.x,A.y,O,L,b[O]),v=[];var N=1;for(I=this.fi.size;N>1,this.lf.tc(2*L,A),O=this.Fl.get(L),(O=new f(A.x,A.y,O,L,b[O])).x==T.x&&O.y==T.y){if(O.Ai==T.Ai)return this.ke=new m.Md(9,O.xm,T.xm),!1;0<=b[O.Ai]&&b[O.Ai]==b[T.Ai]&&(v.length!=0&&v[v.length-1]==T||v.push(T),v.push(O))}T=O}if(v.length==0)return!0;for(O=new m.jp(!0),m.O.$u(b,-1),A=-1,(N=new m.h).Rc(),T=0,I=v.length;T=v.Ke())return this.ke=new m.Md(6,v.da()==1?1:-1,-1),0;if(v.da()==1)return this.ql&&!this.JE()?0:2;this.to=m.ia.qf(v.da(),0),this.JA=m.ia.qf(v.da(),-1);for(var b=-1,T=0,A=0,O=v.da();AI?0:256),0b||T>=1,(A=this.lf.read(2*T+1))!=this.Mo&&v.size!=0){if(!this.ut(v))return 0;v!=null&&v.clear(!1)}v.add(T),this.Mo=A}return 0O.la){var L=this.Zf.wb(),N=this.Su(O,A,this.Zf.gb,!0);0v.Ja(b.gb))){T.EW();for(var H,K,ee=!0;b.Ha();){var q=b.ha(),oe=T.li();if(b.wb()>T.wb())break;ee&&(N.add(b.wb()),B.add(T.ik()),ee=!1),K=N.Fc();var ye=b.ik();if(1this.Bo?N.add(b.ik()):I&&(H=v.Uc(1,N.Fc(),0),q=q.gv(1,0),Math.abs(q-H)>L&&N.add(b.ik())),K>this.Bo?B.add(T.wb()):I&&(H=v.Uc(1,B.Fc(),0),q=oe.gv(1,0),Math.abs(q-H)>L&&B.add(T.wb()))}if(N.Fc()B.size?N.If():B.If():(N.Fc()!=B.Fc()&&B.If(),B.If()),2<=B.size+N.size){for(ee=new m.Sa,oe=0,q=N.size;oe>1;var O=A>>1,I=new m.h,L=new m.h;return this.lf.tc(2*b,I),I.y+=1&v?this.Oj:-this.Oj,this.lf.tc(2*O,L),L.y+=1&A?this.Oj:-this.Oj,(v=I.compare(L))==0&&T?0>(T=this.Fl.get(b)-this.Fl.get(O))?-1:0O.x)return 1;if(A.yO.y)return 1;for(A=1;AB)return 1}}return 0},g.prototype.PO=function(v,b){var T=this.Ou(v,b);return T==0?vb?1:0v?h:l;if(h.B())return l;if(l.B())return h;var b=new m.l,T=new m.l,A=new m.l;return h.A(b),l.A(T),A.K(b),A.Zb(T),b=m.ta.Wd(u,A,!0),T=h.getType(),A=l.getType(),T==33&&A==33?f.aV(h,l,b):T!=A?0v?h:l:T==550?f.iI(h,l,b):f.iI(l,h,b):m.Fg.ep(h,l,u,d)},f.aV=function(h,l,u){u=u*Math.sqrt(2)*1.00001,u*=u;var d=h.D(),g=l.D(),v=new m.de(h.description);return m.h.yc(d,g)>u&&(v.add(h),v.add(l)),v},f.iI=function(h,l,u){var d=h.ub(0),g=h.I(),v=l.D(),b=h.Ia();u=u*Math.sqrt(2)*1.00001;var T=new m.l;if(h.A(T),T.W(u,u),T.contains(v)){u*=u,T=!1;for(var A=[],O=0;Othis.zk||0>this.bo)throw m.i.Qa();if(this.AH[this.bo])break}return this.ya++,this.fG(this.bo)}return this.ya=0,this.bo=this.zk,this.fG(this.zk)},h.prototype.La=function(){return this.ya},h.prototype.qK=function(){if(this.Ic)return!0;var l=null;if(this.Rd!=null&&(l=this.Rd.next())==null&&(this.Ic=!0,this.Rd=null),m.mp.zp(this.Ub),l!=null){var u=l.Db();this.AH[u]=!0,u>=this.zk&&!this.jA&&(this.ND(u,!1,l),u>this.zk&&!this.jA&&this.zW(u))}if(0this.Do.length)for(var v=0,b=Math.max(2,l+1);vu?m.F.Wq(O,A,T,I,0):m.F.Wq(O,T,A,I,0),N=[0,0,0],B=[0,0,0];var ee=[0,0,0];T=[0,0,0],L=[0,0,0];var q=Math.acos(I[2]/1),oe=1-f,ye=Math.tan(q),me=1+ye*ye/oe,Me=2*O[2]*ye/oe;for(oe=(-Me+(ye=Math.sqrt(Me*Me-4*me*(O[2]*O[2]/oe-1))))/(me*=2),Me=(-Me-ye)/me,ye=Math.tan(q),q=(oe+Me)/2,O=((me=ye*oe+O[2])+(ye*Me+O[2]))/2,ye=m.F.gp(oe-q,me-O),oe=O/K*1.570796326794897,Me=0;100>Me&&(me=(me=m.F.w(f,oe))*me/Math.cos(oe)*(Math.sin(oe)-O*me/(1-f)),!m.s.Cd(me));Me++)oe-=me;O=m.F.n(1,f,oe)*Math.cos(oe),ye=1-ye/(O=Math.sqrt((O-q)*(O+q))),ye*=2-ye,me=m.F.on(N),q=m.F.on(B),oe=m.F.on(ee);var Te=m.F.St(ee,N);Me=m.F.St(ee,B),m.F.zx(ee,N,T),m.F.zx(ee,B,L),N=Math.acos(Te/(oe*me)),B=Math.acos(Me/(oe*q)),B*=m.s.Mb(1,m.F.St(T,L)),(1.570796326794897<=m.s.P(N)&&1.570796326794897<=m.s.P(B)||3.141592653589793L&&0>u)&&(u=m.F.ba(u+3.141592653589793)),g!=null&&(g.u=T),v!=null&&(v.u=L),b!=null&&(b.u=u)}}},D.rf=function(E,f,h,l,u,d,g,v){var b=[0,0,0],T=[0,0,0],A=[0,0,0],O=[0,0,0],I=[0,0,0],L=[0,0,0],N=[0,0,0],B=[0,0,0,0],H=new m.ga(0),K=new m.ga(0),ee=new m.ga(0),q=new m.ga(0),oe=new m.ga(0),ye=new m.ga(0);if(g!=null&&v!=null)if(m.s.ti(f))m.Yg.rf(E,h,l,u,d,g,v);else if(m.s.Cd(u))g!=null&&(g.u=h),v!=null&&(v.u=l);else if(d=m.F.ba(d),0>u&&(u=m.s.P(u),d=m.F.ba(d+3.141592653589793)),h=m.F.ba(h),l=m.F.ba(l),1.570796326794897d?m.F.Wq(N,I,b,B,0):m.F.Wq(N,b,I,B,0),b=Math.acos(B[2]/1),B=Math.atan2(-B[1],-B[0]),l=1-f,oe=1+(I=Math.tan(b))*I/l,l=(-(q=2*N[2]*I/l)+(I=Math.sqrt(q*q-4*oe*(N[2]*N[2]/l-1))))/(oe*=2),q=(-q-I)/oe,I=Math.tan(b),b=(l+q)/2,N=((oe=I*l+N[2])+(I*q+N[2]))/2,I=m.F.gp(l-b,oe-N),me=N/me*1.570796326794897,l=0;100>l&&(q=(q=m.F.w(f,me))*q/Math.cos(me)*(Math.sin(me)-N*q/(1-f)),!m.s.Cd(q));l++)me-=q;me=m.F.n(1,f,me)*Math.cos(me),N=1-I/(me=Math.sqrt((me-b)*(me+b))),N*=2-N,L=Math.acos(m.F.St(L,T)/(m.F.on(L)*m.F.on(T))),L*=m.s.Mb(1,T[0]),d=(m.F.q(me,N,m.F.Qj(N,L))+E*m.s.Mb(1,d))/m.F.Ah(me,N),d=m.F.ba(1.570796326794897*d),d=m.F.Rq(N,d),m.F.n(me,N,d),I=m.F.ba(B+h),h=Math.cos(I),d=Math.sin(I),A[0]=O[0]*h+O[1]*-d,A[1]=O[0]*d+O[1]*h,A[2]=O[2],m.F.jO(f,A[0],A[1],A[2],ee,K,H),g!=null&&(g.u=K.u),v!=null&&(v.u=ee.u)}},D}()}(re||(re={})),function(m){var D=function(){function u(d){this.Ya=null,this.wt=new m.h,this.xt=new m.h,this.g=d}return u.prototype.compare=function(d,g,v){return this.g.Gc(g,this.wt),this.g.Gc(d.ja(v),this.xt),this.wt.compare(this.xt)},u}(),E=function(){function u(d){this.Bf=new m.h,this.Dk=new m.h,this.g=d}return u.prototype.Dh=function(d){this.Bf.L(d)},u.prototype.compare=function(d,g){return this.g.Gc(d.ja(g),this.Dk),this.Bf.compare(this.Dk)},u}(),f=function(u){function d(g){var v=u.call(this,g.g,g.qa,!1)||this;return v.ib=g,v}return Ke(d,u),d.prototype.compare=function(g,v,b){if(this.rg)return-1;var T=this.ib.Qd.Jn(this.ib.Rh(v));g=g.ja(b);var A=this.ib.Qd.Jn(this.ib.Rh(g));return this.Dm=b,this.RE(v,T,g,A)},d}(m.UC),h=function(u){function d(g){var v=u.call(this,g.g,g.qa)||this;return v.ib=g,v}return Ke(d,u),d.prototype.compare=function(g,v){return this.rg?-1:(g=this.ib.Qd.Jn(this.ib.Rh(g.ja(v))),this.Dm=v,this.SE(v,g))},d}(m.aM),l=function(){function u(){this.Mc=this.df=this.jo=this.Qd=this.lh=this.zd=this.hb=this.g=null,this.Ng=!1,this.vh=this.Nm=this.ie=this.Gk=this.nh=this.Ak=this.Ff=this.$d=null,this.xh=this.Jq=this.UA=this.qa=0,this.Xv=this.Wn=!1,this.yo=new m.h,this.Pi=new m.h,this.hb=new m.$c(8),this.zd=new m.$c(5),this.lh=new m.au,this.Qd=new m.au,this.Ng=!1,this.vh=new m.h,this.vh.ma(0,0),this.qa=0,this.xh=-1,this.Wn=!1,this.g=null,this.df=new m.Yj,this.Mc=new m.Yj,this.nh=new m.ia(0),this.Gk=new m.TC,this.Ff=new m.ia(0),this.Ak=new m.ia(0),this.jo=new m.Sa}return u.prototype.PX=function(d,g){var v=new m.Dd;return v.$B(),d.Oc(v),this.er(d),this.Wn=!1,this.qa=g,this.UA=g*g,g=this.jC(),d.Oc(v),g||(this.qQ(),g||this.jC()),this.xh!=-1&&(this.g.Td(this.xh),this.xh=-1),this.g=null,this.Wn},u.prototype.TX=function(d,g){this.er(d),this.Wn=!1,this.qa=g,this.UA=g*g,this.Ng=!1,this.jC(),this.Ng||(this.Ng=d.Gp(g,!0,!1)==1),this.xh!=-1&&(this.g.Td(this.xh),this.xh=-1),this.g=null},u.prototype.pg=function(d,g){return this.hb.T(d,0+g)},u.prototype.LB=function(d,g,v){this.hb.S(d,0+g,v)},u.prototype.Rh=function(d){return this.hb.T(d,2)},u.prototype.ZW=function(d,g){this.hb.S(d,2,g)},u.prototype.RF=function(d,g){return this.hb.T(d,3+g)},u.prototype.Pp=function(d){return this.hb.T(d,7)},u.prototype.Pl=function(d,g){this.hb.S(d,7,g)},u.prototype.Rp=function(d,g){return this.hb.T(d,3+this.Op(d,g))},u.prototype.fr=function(d,g,v){this.hb.S(d,3+this.Op(d,g),v)},u.prototype.NR=function(d,g){return this.hb.T(d,5+this.Op(d,g))},u.prototype.hr=function(d,g,v){this.hb.S(d,5+this.Op(d,g),v)},u.prototype.Sr=function(d){return this.zd.T(d,0)},u.prototype.UW=function(d,g){this.zd.S(d,0,g)},u.prototype.ez=function(d){return this.zd.T(d,4)},u.prototype.cr=function(d,g){this.zd.S(d,4,g)},u.prototype.il=function(d){return this.zd.T(d,1)},u.prototype.ln=function(d,g){this.zd.S(d,1,g)},u.prototype.dz=function(d){return this.zd.T(d,3)},u.prototype.Et=function(d,g){this.zd.S(d,3,g)},u.prototype.Ym=function(d){var g=this.zd.Ce(),v=this.lh.Ph();return this.UW(g,v),d!=-1?(this.lh.addElement(v,d),this.g.Ra(d,this.xh,g),this.cr(g,this.g.Ua(d))):this.cr(g,-1),g},u.prototype.HP=function(d){this.zd.jd(d)},u.prototype.LD=function(d,g){this.lh.addElement(this.Sr(d),g),this.g.Ra(g,this.xh,d)},u.prototype.nt=function(d){var g=this.hb.Ce(),v=this.Qd.Ph();return this.ZW(g,v),d!=-1&&this.Qd.addElement(v,d),g},u.prototype.MD=function(d,g){this.Qd.addElement(this.Rh(d),g)},u.prototype.Uu=function(d){this.hb.jd(d),0<=(d=this.nh.lF(d))&&this.nh.SV(d)},u.prototype.hj=function(d,g){if(this.pg(d,0)==-1)this.LB(d,0,g);else{if(this.pg(d,1)!=-1)throw m.i.Qa();this.LB(d,1,g)}this.ky(d,g)},u.prototype.ky=function(d,g){var v=this.il(g);if(v!=-1){var b=this.Rp(v,g);this.hr(b,g,d),this.fr(d,g,b),this.fr(v,g,d),this.hr(d,g,v)}else this.hr(d,g,d),this.fr(d,g,d),this.ln(g,d)},u.prototype.Op=function(d,g){return this.pg(d,0)==g?0:1},u.prototype.Xm=function(d,g){var v,b=this.dz(g);if(b!=-1&&(this.df.vd(b,-1),this.Et(g,-1)),(b=this.il(g))!=-1){var T=v=b;do{var A=!1,O=this.Op(v,g),I=this.RF(v,O);if(this.pg(v,O+1&1)==d){if(this.Xu(v),this.Qd.bh(this.Rh(v)),this.Uu(v),v==I){b=-1;break}b==v&&(b=this.il(g),T=I,A=!0)}v=I}while(v!=T||A);if(b!=-1){do O=this.Op(v,g),I=this.RF(v,O),this.LB(v,O,d),v=I;while(v!=T);(v=this.il(d))!=-1?(T=this.Rp(v,d),A=this.Rp(b,d),T==v?(this.ln(d,b),this.ky(v,d),this.ln(d,v)):A==b&&this.ky(b,d),this.fr(b,d,T),this.hr(T,d,b),this.fr(v,d,A),this.hr(A,d,v)):this.ln(d,b)}}for(b=this.Sr(d),v=this.Sr(g),T=this.lh.rc(v);T!=-1;T=this.lh.lb(T))this.g.Ra(this.lh.ja(T),this.xh,d);this.lh.Hy(b,v),this.HP(g)},u.prototype.UT=function(d,g){var v=this.pg(d,0),b=this.pg(d,1),T=this.pg(g,0),A=this.pg(g,1);this.Qd.Hy(this.Rh(d),this.Rh(g)),g==this.il(v)&&this.ln(v,d),g==this.il(b)&&this.ln(b,d),this.Xu(g),this.Uu(g),v==T&&b==A||b==T&&v==A||(this.Hn(v,this.yo),this.Hn(T,this.Pi),this.yo.qb(this.Pi)?(v!=T&&this.Xm(v,T),b!=A&&this.Xm(b,A)):(b!=T&&this.Xm(b,T),v!=A&&this.Xm(v,A)))},u.prototype.Xu=function(d){var g=this.pg(d,1);this.dF(d,this.pg(d,0)),this.dF(d,g)},u.prototype.dF=function(d,g){var v=this.Rp(d,g),b=this.NR(d,g),T=this.il(g);v!=d?(this.fr(b,g,v),this.hr(v,g,b),T==d&&this.ln(g,v)):this.ln(g,-1)},u.prototype.WD=function(d,g,v){var b=this.Qd.rc(d),T=this.Qd.ja(b);d=this.Le(T);var A=this.Le(this.g.U(T));for(this.g.jr(T,g,v,!0),b=this.Qd.lb(b);b!=-1;b=this.Qd.lb(b)){T=this.Qd.ja(b);var O=this.Le(T)==d;this.g.jr(T,g,v,O)}b=g.Vp(v,0).ac(),g=g.Vp(v,g.ol(v)-1).wc(),this.BK(d,b),this.BK(A,g)},u.prototype.ZE=function(d,g,v){var b=this.Rh(d),T=this.pg(d,0),A=this.pg(d,1),O=this.nt(-1);for(this.nh.add(O),this.Pl(O,-3),this.Ff.add(O),this.hj(O,T),d=1,g=g.ol(v);dthis.ez(O)&&this.cr(O,this.g.Ua(A))),O=this.Ff.get(d),d-=2,this.MD(O,A),A=this.g.U(A);while(0<=d)}this.Ff.clear(!1)},u.prototype.Le=function(d){return this.g.Pa(d,this.xh)},u.prototype.TI=function(d,g,v){var b=this.pg(g,0),T=new m.h;this.Hn(b,T);var A=new m.h,O=this.pg(g,1);this.Hn(O,A);var I=v.ol(d),L=v.Vp(d,0),N=new m.h;if(L.Yp(N),!T.qb(N)){if(!this.Ng){var B=T.compare(this.vh);0>B*(N=N.compare(this.vh))&&(this.Ng=!0)}this.vF(b,this.Ff),this.Ak.add(b)}for(!this.Ng&&1L.compare(this.vh))&&(this.Ng=!0)),d=(L=v.Vp(d,I-1)).wc(),A.qb(d)||(this.Ng||0>(B=A.compare(this.vh))*(N=d.compare(this.vh))&&(this.Ng=!0),this.vF(O,this.Ff),this.Ak.add(O)),this.Ff.add(g),A=0,O=this.Ff.size;AMath.max(100,this.g.fd)){this.nh.clear(!1),this.Ng=!0;break}var d=this.nh.Fc();this.nh.If(),this.Pl(d,-1),this.WS(d)!=-1&&this.wS(d),this.Vn=!1}},u.prototype.wS=function(d){if(this.Vn){var g=this.Mc.zu(this.MH,this.GH,d,!0);this.Vn=!1}else g=this.Mc.KD(d);g==-1?this.UT(this.Mc.ja(this.Mc.FF()),d):(this.Pl(d,g),this.$d.rg&&(this.$d.Kr(),this.oF(this.$d.Dm,g)))},u.prototype.WS=function(d){var g=this.pg(d,0);if(d=this.pg(d,1),this.Hn(g,this.yo),this.Hn(d,this.Pi),m.h.yc(this.yo,this.Pi)<=this.UA)return this.Ng=!0,-1;var v=this.yo.compare(this.vh),b=this.Pi.compare(this.vh);return 0>=v&&0=b&&0d&&(this.re(h),d=this.description.Pf(h)),this.ka==null&&this.un(),this.ka[this.description.$j(d)+l]=u},f.prototype.getType=function(){return 33},f.prototype.Db=function(){return 0},f.prototype.Oa=function(){this.vc(),this.ka!=null&&(this.ka[0]=NaN,this.ka[1]=NaN)},f.prototype.sn=function(h){if(this.ka!=null){for(var l=m.ee.Iw(h,this.description),u=[],d=0,g=0,v=h.Aa;g>>32),h=m.O.Th(d,h)}return h},f.prototype.mg=function(){return null},f}(m.aa);m.Sa=D}(re||(re={})),function(m){var D=function(){function E(f,h,l){f!==void 0&&(this.x=f,this.y=h,this.z=l)}return E.construct=function(f,h,l){var u=new E;return u.x=f,u.y=h,u.z=l,u},E.prototype.K=function(f,h,l){this.x=f,this.y=h,this.z=l},E.prototype.lx=function(){this.z=this.y=this.x=0},E.prototype.normalize=function(){var f=this.length();f==0&&(this.x/=f,this.y/=f,this.z/=f)},E.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},E.prototype.sub=function(f){return new E(this.x-f.x,this.y-f.y,this.z-f.z)},E.prototype.Ag=function(f){new E(this.x*f,this.y*f,this.z*f)},E.prototype.Qh=function(f){return this.x*f.x+this.y*f.y+this.z*f.z},E}();m.Nd=D}(re||(re={})),function(m){var D=function(){function E(f,h,l){this.Gw=this.DA=null,this.Xf=h,this.FT=h.y-l,this.ET=h.y+l,this.Ew=0,this.dA=f,this.qa=l,this.RT=l*l,this.eA=l!=0,this.Lv=!1}return E.prototype.result=function(){return this.Ew!=0?1:0},E.prototype.ZM=function(f){return f=f.hc(f.fe(this.Xf,!1)),m.h.yc(f,this.Xf)<=this.RT},E.prototype.fF=function(f){if(!this.eA&&(this.dA&&this.Xf.qb(f.ac())||this.Xf.qb(f.wc())))this.Lv=!0;else if(f.na==this.Xf.y&&f.na==f.la){if(this.dA&&!this.eA){var h=Math.max(f.sa,f.pa);this.Xf.x>Math.min(f.sa,f.pa)&&this.Xf.xh?l=!0:this.Xf.x>=Math.min(f.sa,f.pa)&&(l=0f.wc().y?1:-1)}}},E.prototype.SI=function(f){var h=f.Tg(0,1);if(h.oa>this.ET||h.vathis.Xf.y||h.va(f=f.I()))&&2*f+Math.log(f)/Math.log(2)*h<1*f*h},E}();m.Dg=D}(re||(re={})),function(m){var D=function(E){function f(h){return E.call(this,!0,h)||this}return Ke(f,E),f.prototype.Ia=function(){return new f(this.description)},f.prototype.Db=function(){return 2},f.prototype.getType=function(){return 1736},f.prototype.xG=function(h,l,u){this.JS(h,l,u)},f.prototype.qR=function(){this.FR()},f}(m.Vk);m.Da=D}(re||(re={})),function(m){(function(D){D[D.PiPOutside=0]="PiPOutside",D[D.PiPInside=1]="PiPInside",D[D.PiPBoundary=2]="PiPBoundary"})(m.RL||(m.RL={})),m.hd=function(){function D(){}return D.KG=function(E,f,h){return(E=m.Dg.bT(E,f,h))==0?0:E==1?1:2},D.Yd=function(E,f,h){return(E=m.Dg.wm(E,f,h))==0?0:E==1?1:2},D.WX=function(E,f,h,l,u){if(f.lengthf?(0>f?f+=360:360<=f&&(f-=360),f):(0>(f=m.lc.RK(f))&&(f+=360),f)},E.gP=function(f){return 180<(f=E.hP(f))&&(f-=360),f},E.oW=57.29577951308232,E}();m.qr=D,m.Hh=function(){function E(){}return E.lj=function(f,h){var l=new m.l;f.A(l);var u=m.cb.gh(h),d=new m.l;return d.K(u),d.v=l.v,d.C=l.C,d.W(.01*d.ca(),0),h=m.ta.Wd(h,l,!1),d.contains(l)?f:m.Ud.clip(f,d,h,0)},E.ks=function(f,h,l,u,d){if(!m.cb.Wc(h))throw m.i.N();var g=m.ta.kj(h,f,!1),v=m.cb.gh(h),b=m.cb.sc(h),T=b.Hd().ai,A=m.cb.vv(b);b=m.cb.ev(b),A*=2-A;var O=new m.Nc;v.cn(O);var I=[[0,0],[0,0]];if(m.Eg.Sb(h)==2?u?(I[0][0]=E.Zm(d,O),I[0][1]=v.Jp(),m.cb.vt(),v=I[0][0]*T):(I[0][0]=v.gk(),I[0][1]=d,m.cb.vt(),v=I[0][1]*T):v=d*T,!u&&v!=0)throw m.i.N();var L=new m.ga,N=new m.gd;f=N.Ib(f);for(var B=[0],H=new m.h,K=new m.h,ee=new m.h,q=new m.h,oe=new m.h,ye=new m.h,me=N.Ob(f);me!=-1;me=N.Rb(me)){var Me=N.Xa(me);N.D(Me,ee);for(var Te=!1,Fe=Me=N.U(Me);Fe!=-1;Fe=N.U(Fe)){if(Fe==Me){if(Te)break;Te=!0}if(N.D(Fe,q),u&&gg||gg||!u&&g<-ee.y&&q.y>g||g<-q.y&&ee.y>g)do if(!(Math.abs(ee.x-q.x)>=.5*O.R())){if(m.Eg.Sb(h)==2?(I[0][0]=E.Zm(ee.x,O),I[0][1]=ee.y,I[1][0]=E.Zm(q.x,O),I[1][1]=q.y,m.cb.dW(),oe.x=I[0][0]*T,oe.y=I[0][1]*T,ye.x=I[1][0]*T,ye.y=I[1][1]*T):(oe.x=ee.x*T,oe.y=ee.y*T,ye.x=q.x*T,ye.y=q.y*T),ye.x=6.283185307179586*(q.x-ee.x)/O.R()+oe.x,u){if(K.x=v,K.y=E.Nz(b,A,oe,ye,v,l),isNaN(K.y))break}else{if(K.x=E.Lz(b,A,oe,ye,l),isNaN(K.x))break;K.y=0}m.kb.wd(b,A,oe.x,oe.y,ye.x,ye.y,L,null,null,l);var Xe=L.u;m.kb.wd(b,A,oe.x,oe.y,K.x,K.y,L,null,null,l);var We=L.u;m.Eg.Sb(h)==2?(I[0][0]=K.x/T,I[0][1]=K.y/T,m.cb.bR(),u?(H.y=I[0][1],H.x=d):(H.x=E.os(I[0][0],ee.x,q.x,O),H.y=d)):u?(H.x=d,H.y=K.y/T):(H.x=E.os(K.x/T,ee.x,q.x,O),H.y=d),B[0]=0u.x)var v=u;else v=l,l=u;u=new m.ga(0);var b=new m.ga(0),T=new m.ga(0);m.kb.wd(f,h,v.x,v.y,l.x,l.y,b,u,null,g);var A=b.u,O=0,I=1,L=new m.h;for(L.L(v);A*(I-O)>1e-12*f;){var N=.5*(O+I);if(m.kb.oj(f,h,v.x,v.y,A*N,u.u,b,T,g),L.x=b.u,L.y=T.u,L.x==d)break;if(E.Sn(v.x,L.x,d))I=N;else{if(!E.Sn(l.x,L.x,d))return NaN;O=N}}return L.y},E.Sn=function(f,h,l){return f=D.Cp(f),h=D.mx(f,D.Cp(h)),(l=D.mx(f,D.Cp(l)))==0||0h&&0>l&&l>=h},E.Zm=function(f,h){var l=h.va-h.oa;return h.It(f-Math.floor((f-h.oa)/l)*l)},E.os=function(f,h,l,u){var d=new m.Nc;for(d.K(h,l),l=u.R(),f=Math.floor((f-h)/l)*l+f,d=d.sf();Math.abs(f-d)>Math.abs(f+l-d);)f+=l;return f},E.Lz=function(f,h,l,u,d){if(l.y>u.y)var g=u;else g=l,l=u;if((u=new m.Nc).K(g.y,l.y),!u.contains(0)||3.141592653589793<=Math.abs(g.x-l.x))return NaN;if(g.x==l.x)return g.x;var v=new m.ga(0),b=new m.ga(0),T=new m.ga(0);m.kb.wd(f,h,g.x,g.y,l.x,l.y,b,v,null,d);var A=b.u,O=0,I=1,L=new m.h;for(L.L(g);A*(I-O)>1e-12*f;){var N=.5*(O+I);if(m.kb.oj(f,h,g.x,g.y,A*N,v.u,b,T,d),L.x=b.u,L.y=T.u,u.K(g.y,L.y),L.y==0)break;if(u.contains(0))I=N;else{if(u.K(l.y,L.y),!u.contains(0))return NaN;O=N}}return L.x},E.Hp=function(f,h,l,u,d,g,v){var b=new m.l;if(f.A(b),b.B())return f;var T=new m.Nc;b.cn(T);var A=new m.Nc;if(A.K(h,h+l),A.contains(T)&&A.va!=T.va)return f;var O=new m.l;O.K(b);var I=f.getType();if(I==33)return((b=(O=d?f:f.Of()).Lg())=A.va||v&&b==A.va)&&(b+=Math.ceil((A.oa-b)/l)*l,b=A.It(b),O.cC(b)),O;if(I==550){for(u=(O=d?f:f.Of()).ub(0),I=2*O.I(),f=!1,d=0;d=A.va||v&&b==A.va)&&(f=!0,b+=Math.ceil((A.oa-b)/l)*l,b=A.It(b),u.write(d,b));return f&&O.Pc(1993),O}if(A.contains(T))return f;if(I==197)return l=d?f:f.Of(),b.Ea(O),l.Xo(b),l;var L=.1*Math.max(b.ca(),b.R());for(O.W(0,L),v=f,A=u.Xd(0),f=m.Gh.local(),d=new m.Dd;;){var N=Math.floor((T.oa-h)/l),B=Math.ceil((T.va-h)/l);if(!(3O.v;)(L=m.Ud.clip(v,O,A,0)).A(T),(I==1607?!L.B()&&(T.R()>A||T.ca()>A):!L.B()&&(I!=1736||T.R()>A))&&(L.Oc(d),L.A(T),h.A(g),g.W(A,A),g.isIntersecting(T)&&I==1736?h=f.V(h,L,u,null):h.add(L,!1)),O.move(l,0),d.shift(-l,0);return h},E.WI=function(f,h,l,u){var d=new m.de(l.description);d.Fd(l,0,-1),d=m.cb.zh(d,f,h);var g=l.I();if(u.Oa(),!m.cb.Wc(f)||g!=d.I())return!1;var v=new m.l;l.A(v);var b=new m.l;if(d.A(b),v=v.R(),b=b.R(),v!=0&&b!=0){if(b/=v,f=m.cb.gh(h).R()/m.cb.gh(f).R(),1e-10=l[d]?u[d]=l[d].toUpperCase():l[d];return u.join()}return l.toString(m.Sc.PE_STR_AUTH_TOP)},h.ur=function(l,u,d,g){var v=g.length,b=d.I();if(b!=0){var T=d.ub(0),A=Math.min(b,v),O=0,I=l.eh();isNaN(u)&&(u=0);for(var L=l.Wc(),N=179*(l=L?l.sc().Oe().R():0)/360;0K*m.lc.sign(ee)&&Math.abs(H)>N&&(g[B][0]+=-K*l)}T.uC(O<<1,A,g),O+=A,b-=A,A=Math.min(b,v)}d.Pc(1993)}},h.IL=function(l,u,d,g){var v=0,b=l.eh();isNaN(v)&&(v=0);var T=l.Wc(),A=l.bf();l=360*A,A*=179;for(var O=g.length,I=0;Iee*m.lc.sign(H)&&Math.abs(K)>A&&(g[L][0]-=ee*l)}m.ta.Iy(u,I,g,N),I+=N}}},h.Lx=function(l,u,d){var g=d.length,v=u.I();if(!(1>v)){var b=u.ub(0),T=Math.min(v,g),A=0,O=l.eh(),I=l.Wc(),L=I?l.Oe().R():0,N=179*L/360,B=0;for(I&&(B=l.zi());0K*m.lc.sign(ee)&&Math.abs(H)>N&&(d[l][0]+=-K*L)}b.uC(A<<1,T,d),A+=T,v-=T,T=Math.min(v,g)}u.Pc(1993)}},h.HL=function(l,u,d,g){if(d!=0){var v=l.eh(),b=l.Wc(),T=b?l.Oe().R():0,A=179*T/360,O=0;for(b&&(O=l.zi()),l=0;lH*m.lc.sign(u[N].x-O)&&Math.abs(B)>A&&(g[I][0]-=H*T)}m.ta.Iy(u,l,g,L),l+=L}}}},h.tr=function(l,u,d,g){var v=u.I();if(v!=0){var b=u.ub(0),T=l.ef,A=l.Yf,O=T.sc().Qp(),I=A.sc().Qp(),L=T.bf(),N=A.bf();if((l=l.Wf)==null||l.count()==0){for(d=O/I,g=(T.Up()-A.Up())*N,I=-90*L,l=90*L,O=!1,N=1,T=2*v;Nq?g[N][1]=q:g[N][1]<-q&&(g[N][1]=-q));for(L=0;LN){if(me){var Ri=Fe+(an+11*L&&(me=!1)}me||(zi=nr+(Ot-=m.lc.Cn(I,zi-lt)),++vi,cs=Ot!=0,Gi.x=zi)}else di||m.ta.AG(nn,At,Gi,Te)&&(di=!0);cs&&Xe.write(2*an,zi),lt=zi,nn.L(At),At.L(Gi)}0l?T=1:0>=A&&0.99*A&&(T=-1)):T=-1),T!=0&&((u=new m.Da(v.description)).tp(O),(u=m.Xl.local().V(u,d,b)).add(v,!1),q=!0,v=u),q&&(v=m.Yl.local().V(v,g,!1,b)),v},h.vQ=function(l,u,d,g,v){var b=d.I(),T=d.Na(0),A=d.Na(b-1);v=(g=h.dv(g,v)).R(),T=m.lc.sign(A.x-T.x);var O=new m.l;d.xc(O);var I=g.gk();if(A=I-v,I+=v,0<=T){var L=Math.ceil((A-O.v)/v);for(L*=v;A>O.v+L;)L+=v;for(;AO.v+L;)L+=v;N=L,720A;)1024<=ee&&(ee=0),B.move(L,0),H.Gb=L,d.Oc(H),K+=L,g.v<=K&&g.C>=K&&(v=O.I()-1),d.Cb(0,N),N=d.Na(b-1),O.Dr(d,0,0,b-1,!1);return d=new m.Da(O.description),b=0T?b:!b)?(T=m.h.construct(A.x,g.H),d.Ci(T),T=m.h.construct(g.gk(),g.H),d.Ci(T),g=m.h.construct(l.x,g.H)):(T=m.h.construct(A.x,g.G),d.Ci(T),T=m.h.construct(g.gk(),g.G),d.Ci(T),g=m.h.construct(l.x,g.G)),d.Ci(g),d.xG(0,u,0),d.kO(v),d},h.uQ=function(l,u,d,g,v){var b=new m.Da(l.description);b.add(l,!1),b.DB(0,b.I()-1);var T=new m.l;b.xc(T);var A=(d=h.dv(u,d)).R(),O=Math.ceil((d.v-T.v)/A);for(O*=A;d.v>T.v+O;)O+=A;for(;d.vT.C)return v&&(v=b.Ke(),u=(b=m.Yl.local().V(b,u,!0,g)).Ke(),(u=m.lc.sign(v)!=m.lc.sign(u))&&b.oJ()),b;for((l=new m.Da(l.description)).add(b,!1),v=v||T.R()>A-u.Xd(0);T.v=d){A=!0;break}if(2&v&&I.y<=-d){A=!0;break}}if(!A)return!1;b=!1,l&&(b=u.Nn(0)),T=(l=new m.gd).Ib(u),A=l.Ob(T);var L=-1,N=!0,B=new m.h;B.Rc(),O=new m.Sa;for(var H=-1,K=l.Xa(A);K!=-1;K=l.U(K)){I=l.Na(K);var ee=1&v&&90<=I.y?1:0;if(ee|=2&v&&I.y<=-d?2:0,0A){if(new m.l().K(B.v-T,-A,B.C+T,A),(v=m.ri.Nu(v,u,l,NaN,0,g)).B())return v;v.A(B)}if(K&&(u.HB.H))return v.Ia();if(B.R()>I&&(v=h.Hp(v,L-O,I,l,!0,0,!0,g)).A(B),(A=h.eO(B.v,B.C,u.v,u.C,I))!=0&&B.move(A,0),B.C>u.C||B.vu.C)for(;B.v>=u.C;)B.move(-I,0),A-=I;for(;B.vA;A++){if(ee?T=m.aa.Hc(b)?m.ri.clip(v,u,d,N,g):m.ri.clip(v,u,d,0,g):(T=m.Xj.local().V(v,H,l,g))==H&&(T=m.aa.jg(T)),u.v<=B.v&&u.C>=B.C||u.v>=B.v&&u.C<=B.C)return T;K[A]=T,A==0&&(B.move(-I,0),(T=new m.Dd).gg(-I,0),v.Oc(T))}if(b==550)K[0].Fd(K[1],0,-1);else if(m.aa.Hc(b))K[0].add(K[1],!1);else{if(b!=33)throw m.i.fa("intersect_with_GCS_horizon: unexpected geometry type");K[0].B()&&(K[0]=K[1])}return K[0]}if(u.HB.H)return v;for(b=0;!v.B()&&B.C>u.v;)b!=0&&((T=new m.Dd).gg(b,0),v.Oc(T)),m.dj.local().V(4,v,H,l,g)||H==(v=m.kp.local().V(v,H,l,g))&&(v=m.aa.jg(v)),b!=0&&((N=new m.Dd).gg(-b,0),v.Oc(N)),b-=I,B.move(-I,0);return v},h.yG=function(l,u,d,g){if(u!=0&&g!=D.DontClip)if(g==D.PannableFold){g=d.HR();for(var v=u,b=0;bg.H||l[b].yT||l[b].y<-T)&&(l[b].Rc(),v--);if(v!=0){(v=new m.l).Zw(l,u),T=d.Vr();var O=d.hv();b=T.getType()==197;var I=new m.l;if(T.A(I),!O||!(I.Hv.H))if(O)if(h.av(l,u,I.gk()-A,g),v=u,b)for(b=0;b=I||T&&L==I)&&(L+=Math.ceil((u-L)/d)*d,L=m.O.Rk(L,u,I),g.cC(L)),g}if(l.B()||(L=new m.l,l.A(L),L.B()))return l;var N=new m.Nc;L.cn(N);var B=new m.Nc;if(B.K(u,I),B.contains(N))return l;if((I=new m.l).K(L),O===550){for(A=(g=v?l:l.Of()).ub(0),O=2*g.I(),I=!1,u=0;u=B.va||T&&L==B.va)&&(I=!0,L+=Math.ceil((B.oa-L)/d)*d,L=B.It(L),A.write(u,L));return I&&g.Pc(1993),g}if(O==197)return d=v?l:l.Of(),L.Ea(I),d.Xo(L),d;var H=.1*Math.max(L.ca(),L.R());for(I.W(0,H),T=l,B=g.Xd(0),l=m.Gh.local(),v=new m.Dd;;){var K=Math.floor((N.oa-u)/d),ee=Math.ceil((N.va-u)/d);if(!(3I.v;)(H=m.ri.clip(T,I,B,0,A)).A(N),(O==1607?!H.B()&&(N.R()>B||N.ca()>B):!H.B()&&(O!=1736||N.R()>B))&&(H.Oc(v),H.A(N),u.A(b),b.W(B,B),b.isIntersecting(N)&&O==1736?u=l.V(u,H,g,null):u.add(H,!1)),I.move(d,0),v.shift(-d,0);return u},h.av=function(l,u,d,g){for(var v=d+g,b=0;bv||T==v)||(T+=Math.ceil((d-T)/g)*g,T=m.O.Rk(T,d,v),l[b].x=T)}},h.Fn=function(l,u,d,g,v,b){if(!u.Wc())throw m.i.fa("fold_into_360_degree_range");if(l.B())return l;if(u.Sb()==2){d=u.pv();var T=u.ov()-d}else{var A=u.bf();T=360*A,d-=180*A}return h.Hp(l,d,T,u,g,v,!0,b)},h.qF=function(l,u,d,g){if(d.Sb()==2)g=d.pv(),d=d.ov()-g;else{var v=d.bf();d=360*v,g-=180*v}h.av(l,u,g,d)},h.lj=function(l,u){var d=u.Oe();if(l.getType()==33){var g=l.ih();return d.G<=g&&g<=d.H?l:l.Ia()}g=new m.l,l.A(g);var v=new m.l;return v.K(d),v.v=g.v,v.C=g.C,v.W(.01*v.ca(),0),d=m.ta.uy(u,g),v.contains(g)?l:m.ri.clip(l,v,d,0,null)},h.ir=function(l,u,d){return l>u.C&&l-u.Cd.H?l[v].Rc():l[v].x=h.ir(l[v].x,d,g)},h.Jt=function(l,u,d,g){if(!l.B()){var v=l.getType();if(!g||v!=1736)if(m.aa.xj(v)){g=l.ub(0),v=0;for(var b=l.I();vg||gg)||!b&&(T!=0||g<-Me.y&&Te.y>g||g<-Te.y&&Me.y>g))do if(!(Math.abs(Me.x-Te.x)>=.5*N.R())){if(d.Sb()==2?(H[0][0]=h.Zm(Me.x,N),H[0][1]=Me.y,H[1][0]=h.Zm(Te.x,N),H[1][1]=Te.y,m.ej.projToGeogCenter(B,2,H,0),Fe.x=H[0][0]*O,Fe.y=H[0][1]*O,Xe.y=H[1][1]*O):(Fe.x=Me.x*O,Fe.y=Me.y*O,Xe.y=Te.y*O),Xe.x=2*(Te.x-Me.x)*Math.PI/N.R()+Fe.x,b){if(oe.x=A,oe.y=h.Nz(I,L,Fe,Xe,A,v),isNaN(oe.y))break;me[0]=oe;var vi=1}else if(v==f.GreatElliptic){var di=[0,0];if((vi=m.Ox.Oz(L,Fe,Xe,A,di))==0)break;oe.x=di[0],oe.y=A,me[0]=oe,vi==2&&(ye.x=di[1],ye.y=A,me[1]=ye)}else{if(oe.x=h.Lz(I,L,Fe,Xe,v),isNaN(oe.x))break;oe.y=0,me[0]=oe,vi=1}var At=-1;for(di=0;diee[0]||(At=l.Ma(lt),l.Ul(At,ee,1),l.Cb(l.U(At),q.x,q.y),At=ee[0])}}while(!1);Me.L(Te)}}},h.Zm=function(l,u){var d=u.va-u.oa;return u.It(l-Math.floor((l-u.oa)/d)*d)},h.os=function(l,u,d,g){var v=new m.Nc;for(v.K(u,d),d=g.R(),l=Math.floor((l-u)/d)*d+l,v=v.sf();Math.abs(l-v)>Math.abs(l+d-v);)l+=d;return l},h.Sn=function(l,u,d){return l=m.qr.Cp(l),u=m.qr.mx(l,m.qr.Cp(u)),(d=m.qr.mx(l,m.qr.Cp(d)))==0||0u&&0>d&&d>=u},h.Nz=function(l,u,d,g,v,b){if(b==f.GreatElliptic)return m.Ox.SS(u,d,g,v);if(Math.abs(d.x-g.x)>=Math.PI||!h.Sn(d.x,g.x,v))return NaN;if(d.x>g.x)var T=g;else T=d,d=g;g=new m.ga;var A=new m.ga,O=new m.ga;m.kb.wd(l,u,T.x,T.y,d.x,d.y,A,g,null,b);var I=A.u,L=0,N=1,B=new m.h;for(B.L(T);I*(N-L)>1e-12*l;){var H=.5*(L+N);if(m.kb.oj(l,u,T.x,T.y,I*H,g.u,A,O,b),B.x=A.u,B.y=O.u,B.x==v)break;if(h.Sn(T.x,B.x,v))N=H;else{if(!h.Sn(d.x,B.x,v))return NaN;L=H}}return B.y},h.Lz=function(l,u,d,g,v){if(v==f.GreatElliptic)return l=[0,0],m.Ox.Oz(u,d,g,0,l),l[0];if(d.y>g.y)var b=g;else b=d,d=g;if((g=new m.Nc).K(b.y,d.y),!g.contains(0)||Math.abs(b.x-d.x)>=Math.PI)return NaN;if(b.x==d.x)return b.x;var T=new m.ga,A=new m.ga,O=new m.ga;m.kb.wd(l,u,b.x,b.y,d.x,d.y,A,T,null,v);var I=A.u,L=0,N=1,B=new m.h;for(B.L(b);I*(N-L)>1e-12*l;){var H=.5*(L+N);if(m.kb.oj(l,u,b.x,b.y,I*H,T.u,A,O,v),B.x=A.u,B.y=O.u,g.K(b.y,B.y),B.y==0)break;if(g.contains(0))N=H;else{if(g.K(d.y,B.y),!g.contains(0))return NaN;L=H}}return B.x},h.WI=function(l,u,d,g){if(!l.ef.Wc())return!1;var v=new m.de(u.description);if(v.Fd(u,0,-1),g=m.Hx.local().V(v,l,g),v=u.I(),d.Oa(),v!=g.I())return!1;var b=new m.l;u.A(b);var T=new m.l;if(g.A(T),b=b.R(),T=T.R(),b!=0&&T!=0){if(T/=b,l=l.Yf.gh().R()/l.ef.gh().R(),1e-10=180*u&&(l-=360*u),l},h.UI=function(l,u,d,g){if(d==D.Clip){var v=u.ml();v.getType()==197?(d=new m.l,v.A(d),v=m.ta.uy(u,d),l=m.ri.clip(l,d,v,5e4*u.pm(),g)):m.dj.local().V(1,v,l,u,g)||(l=m.Xj.local().V(l,v,u,g))==v&&(l=m.Vk.jg(l))}else u.Wc()&&(g=new m.l,l.xc(g),u.Oe().contains(g)||(h.Jt(l,u.Oe(),u.Xd(0),!0),d==D.PannableFold&&(l=h.lj(l,u)),l=h.Fn(l,u,0,!0,1e5*u.pm(),null)));return l},h.XD=function(l,u,d){var g=u.Wr();if(g==null)return l;var v=(u=u.sc()).Oe().R(),b=new m.l;l.xc(b);var T=new m.Nc;b.cn(T),b=g.Ga(),g=null;for(var A=new m.Dd;b.$a();)for(;b.Ha();){var O=b.ha(),I=O.Tg(0,0),L=new m.Nc;for(L.K(I.oa,I.va),I=0;L.va>T.oa;)L.move(-v),--I;for(;L.oa<=T.va;){if(L.isIntersecting(T)){g==null&&(g=new m.Ta);var N=m.yb.cP(O.ac(),O.wc());I!=0&&(A.gg(I*v,0),N.Oc(A)),g.oc(N,!0)}L.move(v),++I}}return g!=null?(u=m.ta.gO(u,g),u=m.ta.Er(u),m.$t.lP(l,g,u,d)):l},h.eO=function(l,u,d,g,v){return l>=d&&u<=g?0:h.tE(.5*(u+l),d,g,v)},h.tE=function(l,u,d,g){return m.lc.round((.5*(d+u)-l)/g)*g},h.VQ=function(l,u,d,g,v,b,T,A){var O=h.dv(g,v),I=O.R(),L=I/360,N=h.pE*L,B=l.ub(0),H=u.Wc(),K=H?I/u.Oe().R():0;u=l.Ia();for(var ee=0,q=d.da();eeN){if(oe){var pr=Me+cs-1,Ri=Me;(!Te||cs+11*L&&(H=!1)}oe||(nr=Gi+(Xe-=m.lc.Cn(I,nr-We)),++Ot,nn=Xe!=0,an.x=nr)}else vi||m.ta.AG(di,At,an,lt)&&(vi=!0);nn&&Fe.write(2*cs,nr),We=nr,di.L(At),At.L(an)}Ot!=0&&ye.Pc(1993),oe=ye.Na(0),me=ye.Na(me-1),m.h.tb(oe,me),ye=h.wQ(ye,g,isNaN(v)?0:v,b),u.add(ye,!1)}return l=g.Xd(0),d=O.R()/180,h.Jt(u,O,.1*l,!1),m.ri.clip(u,O,l,d,b)},h.wQ=function(l,u,d,g){return h.Fn(l,u,d,!0,0,g)},h.OS=function(l,u,d,g){var v=l.getType();if(v==1736)for(u=u!=null?u.Xd(0):0,v=0;vd)for(var v=new m.Sa,b=0;bd)for(var v=new m.Sa,b=0;bthis.Io},f.prototype.fz=function(){if(this.B())throw m.i.fa("invalid call");return new m.Sa(this.Bs.x,this.Bs.y)},f.prototype.Ua=function(){if(this.B())throw m.i.fa("invalid call");return this.Io},f.prototype.hz=function(){if(this.B())throw m.i.fa("invalid call");return this.Ka},f.prototype.Sz=function(){return(1&this.nw)!=0},f.prototype.ey=function(h,l,u,d){this.Bs.x=h,this.Bs.y=l,this.Io=u,this.Ka=d},f}();m.$l=E}(re||(re={})),function(m){var D=function(){function f(){}return f.prototype.Uo=function(h,l){if(this.th.resize(0),this.Ii.length=0,this.tk=-1,h.xc(this.Ek),this.Ek.W(l,l),this.Ek.isIntersecting(this.Fb.Ca)){var u=h.getType();(this.vs=m.aa.yd(u))?(this.TH=h.ac(),this.SH=h.wc(),this.qa=l):this.qa=NaN,this.th.add(this.Fb.kf),this.Ii.push(this.Fb.Ca),this.Qs=this.Fb.Ur(this.Fb.kf)}else this.Qs=-1},f.prototype.Xi=function(h,l){this.th.resize(0),this.Ii.length=0,this.tk=-1,this.Ek.K(h),this.Ek.W(l,l),this.qa=NaN,this.Ek.isIntersecting(this.Fb.Ca)?(this.th.add(this.Fb.kf),this.Ii.push(this.Fb.Ca),this.Qs=this.Fb.Ur(this.Fb.kf),this.vs=!1):this.Qs=-1},f.prototype.next=function(){if(this.th.size==0)return-1;this.tk=this.Qs;var h=null,l=null,u=null,d=null;this.vs&&(h=new m.h,l=new m.h,u=new m.l);for(var g=!1;!g;){for(;this.tk!=-1;){var v=this.Fb.bz(this.Fb.fv(this.tk));if(v.isIntersecting(this.Ek)){if(!this.vs){g=!0;break}if(h.L(this.TH),l.L(this.SH),u.K(v),u.W(this.qa,this.qa),0b;b++){var T=this.Fb.Lp(v,b);if(T!=-1&&0>d);g==0?(l.v=.5*(l.v+l.C),l.G=.5*(l.G+l.H)):g==1?(l.C=.5*(l.v+l.C),l.G=.5*(l.G+l.H)):(g==2?l.C=.5*(l.v+l.C):l.v=.5*(l.v+l.C),l.H=.5*(l.G+l.H))}return l},f.prototype.WR=function(h){return this.Az(h)},f.prototype.vR=function(h,l){return D.bP(this,h,l)},f.prototype.MF=function(h,l){return D.aP(this,h,l)},f.prototype.getIterator=function(){return D.$O(this)},f.prototype.Nk=function(h,l){if(0>l||32<2*l)throw m.i.N("invalid height");this.BT=l,this.Ca.K(h),this.kf=this.jf.Ce(),this.jx(this.kf,0),this.ax(this.kf,0),this.NJ(this.kf,0),this.KJ(this.kf,0)},f.prototype.zv=function(h,l,u,d,g,v,b){if(!d.contains(l))return u==0?-1:this.zv(h,l,0,this.Ca,this.kf,v,b);if(!v)for(var T=g;T!=-1;T=this.IR(T))this.jx(T,this.Az(T)+1);(T=new m.l).K(d),d=g;var A=[];for(A[0]=new m.l,A[1]=new m.l,A[2]=new m.l,A[3]=new m.l;uI;I++)if(A[I].contains(l)){O=!0;var L=this.Lp(d,I);L==-1&&(L=this.rP(d,I)),this.jx(L,this.Az(L)+1),d=L,T.K(A[I]);break}if(!O)break}return this.sS(h,l,u,T,d,v,g,b)},f.prototype.sS=function(h,l,u,d,g,v,b,T){var A=this.NF(g);if(v){if(g==b)return T;this.SP(T),v=T}else v=this.tP(),this.NB(v,h),this.KW(this.fv(v),l);return this.mX(v,g),A!=-1?(this.hx(v,A),this.bx(A,v)):this.GJ(g,v),this.SB(g,v),this.ax(g,this.lv(g)+1),this.hO(g)&&this.MQ(u,d,g),v},f.prototype.SP=function(h){var l=this.WF(h),u=this.NF(l),d=this.OR(h),g=this.nv(h);this.Ur(l)==h?(g!=-1?this.hx(g,-1):this.SB(l,-1),this.GJ(l,g)):u==h?(this.bx(d,-1),this.SB(l,d)):(this.hx(g,d),this.bx(d,g)),this.hx(h,-1),this.bx(h,-1),this.ax(l,this.lv(l)-1)},f.EJ=function(h,l){var u=.5*(h.v+h.C),d=.5*(h.G+h.H);l[0].K(u,d,h.C,h.H),l[1].K(h.v,d,u,h.H),l[2].K(h.v,h.G,u,d),l[3].K(u,h.G,h.C,d)},f.prototype.hO=function(h){return this.lv(h)==8&&!this.gG(h)},f.prototype.MQ=function(h,l,u){var d=this.Ur(u);do{var g=this.fv(d),v=this.Zh.T(d,0);g=this.bz(g),this.zv(v,g,h,l,u,!0,d),d=v=this.nv(d)}while(d!=-1)},f.prototype.iO=function(h){return 8<=this.lv(h)||this.gG(h)},f.prototype.gG=function(h){return this.Lp(h,0)!=-1||this.Lp(h,1)!=-1||this.Lp(h,2)!=-1||this.Lp(h,3)!=-1},f.prototype.rP=function(h,l){var u=this.jf.Ce();return this.OW(h,l,u),this.jx(u,0),this.ax(u,0),this.Pk(u,h),this.KJ(u,this.jv(h)+1),this.NJ(u,l<<2*this.jv(h)|this.QF(h)),u},f.prototype.tP=function(){var h=this.Zh.Ce();if(0>4)]|=this.iH<<2*(15&g)},h}();m.HY=E;var f=function(){function h(l,u,d){this.Vh=null,this.SA=this.Ik=this.cI=this.aI=this.Es=this.qH=this.Gf=this.Um=0,this.Ri=this.Jk=this.vl=null,this.Fz(l,u,d)}return h.create=function(l,u,d){if(!h.zE(l))throw m.i.N();return h.wP(l,u,d)},h.pW=function(l){switch(l){case 0:l=1024;break;case 1:l=16384;break;case 2:l=262144;break;default:throw m.i.fa("Internal Error")}return l},h.zE=function(l){return!(l.B()||l.getType()!=1607&&l.getType()!=1736)},h.prototype.rQ=function(l,u){u=u.Ga();for(var d=new m.h,g=new m.h;u.$a();)for(;u.Ha();){var v=u.ha();if(v.getType()!=322)throw m.i.fa("Internal Error");l.Eh(v.ac(),d),l.Eh(v.wc(),g),this.Ri.jy(d.x,d.y,g.x,g.y)}this.Ri.iJ(m.Px.Cx)},h.prototype.sQ=function(){throw m.i.fa("Internal Error")},h.prototype.Ry=function(l,u){for(var d=1;4>d;d++)l.jy(u[d-1].x,u[d-1].y,u[d].x,u[d].y);l.jy(u[3].x,u[3].y,u[0].x,u[0].y),this.Ri.iJ(m.Px.Cx)},h.prototype.rK=function(l,u,d){for(var g=[null,null,null,null],v=0;v(H=v.length());H==0?v.ma(1,0):(K||L.L(O),v.scale(d/H),b.ma(-v.y,v.x),T.ma(v.y,-v.x),A.sub(v),O.add(v),g[0].add(A,b),g[1].add(A,T),g[2].add(O,T),g[3].add(O,b),K?N=!0:this.Ry(l,g))}else N&&(this.Ry(l,g),N=!1),B=!0}N&&this.Ry(l,g)}},h.prototype.sC=function(l){return m.O.truncate(l*this.qH+this.aI)},h.prototype.tC=function(l){return m.O.truncate(l*this.Es+this.cI)},h.wP=function(l,u,d){return new h(l,u,d)},h.prototype.Fz=function(l,u,d){this.Gf=Math.max(m.O.truncate(2*Math.sqrt(d)+.5),64),this.Um=m.O.truncate((2*this.Gf+31)/32),this.vl=new m.l,this.Ik=u,d=0;for(var g=this.Gf,v=this.Um;8<=g;)d+=g*v,g=m.O.truncate(g/2),v=m.O.truncate((2*g+31)/32);this.Vh=m.O.lg(d,0),this.Ri=new m.Px,d=new E(this.Vh,this.Um,this),this.Ri.AX(this.Gf,this.Gf,d),l.A(this.vl),this.vl.W(u,u),g=new m.l;var b=u*(v=m.l.construct(1,1,this.Gf-2,this.Gf-2)).R();switch(u*=v.ca(),g.K(this.vl.sf(),Math.max(b,this.vl.R()),Math.max(u,this.vl.ca())),this.SA=this.Ik,this.Jk=new m.Dd,this.Jk.pS(g,v),new m.Dd,l.getType()){case 550:d.setColor(this.Ri,2),this.sQ();break;case 1607:d.setColor(this.Ri,2),this.rK(this.Ri,l,this.SA);break;case 1736:d.setColor(this.Ri,1),this.rQ(this.Jk,l),d.setColor(this.Ri,2),this.rK(this.Ri,l,this.SA)}this.qH=this.Jk.bb,this.Es=this.Jk.ab,this.aI=this.Jk.Gb,this.cI=this.Jk.Lb,this.XN()},h.prototype.XN=function(){this.Ri.flush();for(var l=0,u=this.Gf*this.Um,d=this.Gf,g=m.O.truncate(this.Gf/2),v=this.Um,b=m.O.truncate((2*g+31)/32);8>4;I=2*(15&I);var B=L>>4;L=2*(15&L);var H=this.Vh[l+v*T+N]>>I&3;H|=this.Vh[l+v*T+B]>>L&3,H|=this.Vh[l+v*A+N]>>I&3,H|=this.Vh[l+v*A+B]>>L&3,this.Vh[u+b*d+(O>>4)]|=H<<2*(15&O)}d=g,v=b,l=u,g=m.O.truncate(d/2),b=m.O.truncate((2*g+31)/32),u=l+v*d}},h.prototype.So=function(l,u){return this.vl.contains(l,u)?(l=this.sC(l),u=this.tC(u),0>l||l>=this.Gf||0>u||u>=this.Gf||(u=this.Vh[this.Um*u+(l>>4)]>>2*(15&l)&3)==0?0:u==1?1:2):0},h.prototype.Ro=function(l){if(!l.Ea(this.vl))return 0;var u=this.sC(l.v),d=this.sC(l.C),g=this.tC(l.G);if(l=this.tC(l.H),0>u&&(u=0),0>g&&(g=0),d>=this.Gf&&(d=this.Gf-1),l>=this.Gf&&(l=this.Gf-1),u>d||g>l)return 0;for(var v=Math.max(d-u,1)*Math.max(l-g,1),b=0,T=this.Um,A=this.Gf,O=0;;){if(32>v||16>A){for(v=g;v<=l;v++)for(var I=u;I<=d;I++)if(1<(O=this.Vh[b+T*v+(I>>4)]>>2*(15&I)&3))return 2;if(O==0)return 0;if(O==1)return 1}b+=T*A,A=m.O.truncate(A/2),T=m.O.truncate((2*A+31)/32),u=m.O.truncate(u/2),g=m.O.truncate(g/2),d=m.O.truncate(d/2),l=m.O.truncate(l/2),v=Math.max(d-u,1)*Math.max(l-g,1)}},h.prototype.RR=function(){return this.Gf*this.Um},h}();m.Nx=f}(re||(re={})),function(m){var D;(D=m.VL||(m.VL={}))[D.contains=1]="contains",D[D.within=2]="within",D[D.equals=3]="equals",D[D.disjoint=4]="disjoint",D[D.touches=8]="touches",D[D.crosses=16]="crosses",D[D.overlaps=32]="overlaps",D[D.unknown=0]="unknown",D[D.intersects=1073741824]="intersects";var E=function(){function h(){}return h.construct=function(l,u,d,g,v,b,T,A){var O=new h;return O.pw=l,O.Mm=u,O.Kj=d,O.Si=g,O.BH=v,O.SY=b,O.TY=T,O.UY=A,O},h}();m.Vt=function(){function h(){}return h.CD=function(l,u,d){if(h.wy(l)){var g=m.ta.kj(u,l,!1);u=!1,m.Uk.CE(l)&&(u=u||l.lu(g,d)),(g=l.getType())!=1736&&g!=1607||!m.Uk.AE(l)||d==0||(u=u||l.fj(d)),g!=1736&&g!=1607||!m.Uk.BE(l)||d==0||u||l.hM()}},h.wy=function(l){return m.Uk.CE(l)||m.Uk.AE(l)||m.Uk.BE(l)},h}();var f=function(){function h(){this.rh=[]}return h.zB=function(l,u,d,g,v){var b=l.getType(),T=u.getType();if(b==197){if(T==197)return h.tW(l,u,d,g);if(T==33)return g==2?g=1:g==1&&(g=2),h.hJ(u,l,d,g)}else if(b==33){if(T==197)return h.hJ(l,u,d,g);if(T==33)return h.vW(l,u,d,g)}if(l.B()||u.B())return g==4;var A=new m.l;l.A(A);var O=new m.l;u.A(O);var I=new m.l;if(I.K(A),I.Zb(O),d=m.ta.Wd(d,I,!1),h.dk(A,O,d))return g==4;switch(A=!1,m.Vk.yd(b)&&((b=new m.Ta(l.description)).oc(l,!0),l=b,b=1607),m.Vk.yd(T)&&((T=new m.Ta(u.description)).oc(u,!0),u=T,T=1607),b!=197&&T!=197?(l.Db()4*Math.max(l.I(),u.I())*d)&&h.Wz(l,u,d,!0)))},h.kV=function(l,u,d){var g=h.qc(l,u,!0);return g==4||g!=1&&g!=2&&g!=1073741824&&h.EI(l,u,d)},h.vV=function(l,u,d){var g=h.qc(l,u,!1);return g!=4&&g!=1&&g!=2&&h.II(l,u,d,null)},h.qV=function(l,u,d,g){var v=h.qc(l,u,!1);return v!=4&&v!=1&&v!=2&&h.FI(l,u,d,g)},h.Sw=function(l,u,d,g){var v=new m.l,b=new m.l;return l.A(v),u.A(b),!!h.zc(v,b,d)&&(v=h.qc(l,u,!1))!=4&&v!=2&&(v==1||h.BI(l,u,d,g))},h.lV=function(l,u,d){var g=h.qc(l,u,!0);return g==4||g!=1&&g!=1073741824&&h.EI(l,u,d)},h.wV=function(l,u,d,g){var v=h.qc(l,u,!1);return v!=4&&v!=1&&h.JI(l,u,d,g)},h.gV=function(l,u,d){var g=h.qc(l,u,!1);return g!=4&&g!=1&&h.DI(l,u,d,null)},h.fB=function(l,u,d,g){var v=new m.l,b=new m.l;return l.A(v),u.A(b),!!h.zc(v,b,d)&&(v=h.qc(l,u,!1))!=4&&(v==1||h.CI(l,u,d,g))},h.jV=function(l,u,d){return m.hd.KG(l,u,d)==0},h.uV=function(l,u,d){return u=u.D(),h.HI(l,u,d)},h.dV=function(l,u,d){return u=u.D(),h.AI(l,u,d)},h.iV=function(l,u,d){var g=h.qc(l,u,!1);if(g==4)return!0;if(g==1)return!1;g=new m.l,l.A(g),g.W(d,d);for(var v=new m.h,b=0;bd&&b.R()>d||b.ca()<=d&&b.R()<=d)&&(v=new m.Ta,b=new m.Sa,u.Hf(0,b),v.nf(b),u.Hf(2,b),v.lineTo(b),h.DI(l,v,d,g))},h.IV=function(l,u,d){var g=new m.l,v=new m.l;return l.A(g),u.A(v),!(!h.ek(g,v,d)||h.qc(l,u,!1)==4)&&(!!h.dI(l,u,d)||h.Wz(l,u,d,!1))},h.GV=function(l,u,d){return this.qc(l,u,!1)==4||!!new m.Zl(l,u,d,!0).next()&&!this.UG(l,u,d)},h.NI=function(l,u,d){if(h.qc(l,u,!1)==4)return!1;var g=new m.be(0);if(h.Xz(l,u,d,g)!=0)return!1;for(var v=new m.de,b=0;bd&&v.R()>d)&&h.ek(g,v,d)},h.DV=function(l,u,d){var g=new m.l,v=new m.l;return l.A(g),u.A(v),!h.zc(v,g,d)&&!h.TG(l,v,d)},h.OV=function(l,u,d){var g=new m.l,v=new m.l;if(l.A(g),u.A(v),v.ca()<=d&&v.R()<=d)return v=u.Ip(),h.Zz(l,v,d);if(v.ca()<=d||v.R()<=d)return v=new m.Ta,g=new m.Sa,u.Hf(0,g),v.nf(g),u.Hf(2,g),v.lineTo(g),h.NI(l,v,d);l=l.Ga(),u=new m.l,g=new m.l,u.K(v),g.K(v),u.W(-d,-d),g.W(d,d),v=!1;for(var b=new m.l,T=new m.l;l.$a();)for(;l.Ha();){if(l.ha().A(b),T.K(u),T.Ea(b),!T.B()&&(T.ca()>d||T.R()>d))return!1;T.K(g),T.Ea(b),T.B()||(v=!0)}return v},h.LV=function(l,u,d){var g=new m.l,v=new m.l;return l.A(g),u.A(v),!(h.zc(g,v,d)||h.zc(v,g,d)||h.zc(v,g,d)||v.ca()>d&&v.R()>d||v.ca()<=d&&v.R()<=d)&&(g=new m.Ta,v=new m.Sa,u.Hf(0,v),g.nf(v),u.Hf(2,v),g.lineTo(v),h.WG(l,g,d))},h.RV=function(l,u,d){var g=new m.l,v=new m.l;if(l.A(g),u.A(v),!h.zc(v,g,d)||v.ca()<=d&&v.R()<=d)return!1;if(v.ca()<=d||v.R()<=d)return h.zc(v,g,d);l=l.Ga(),(u=new m.l).K(v),u.W(-d,-d),v=!1,g=new m.l;for(var b=new m.l;l.$a();)for(;l.Ha();)l.ha().A(g),u.hm(g)?v=!0:(b.K(u),b.Ea(g),!b.B()&&(b.ca()>d||b.R()>d)&&(v=!0));return v},h.yV=function(l,u,d){var g=new m.l,v=new m.l;return u.A(v),l.A(g),!(!h.zc(g,v,d)||v.ca()>d&&v.R()>d)&&(v.ca()<=d&&v.R()<=d?(u=u.Ip(),h.SG(l,u,d)):(g=new m.Ta,v=new m.Sa,u.Hf(0,v),g.nf(v),u.Hf(2,v),g.lineTo(v),h.ym(g,l,d,!1)))},h.BV=function(l,u,d){var g=new m.l,v=new m.l;if(l.A(g),u.A(v),h.zc(v,g,d)||v.ca()<=d&&v.R()<=d)return!1;if(v.ca()<=d||v.R()<=d)return g=new m.Ta,v=new m.Sa,u.Hf(0,v),g.nf(v),u.Hf(2,v),g.lineTo(v),h.LI(l,g,d);l=l.Ga(),u=new m.l,(g=new m.l).K(v),u.K(v),g.W(-d,-d),u.W(d,d);for(var b=v=!1,T=new m.l,A=new m.l;l.$a();)for(;l.Ha();)if(l.ha().A(T),b||u.contains(T)||(b=!0),v||(A.K(g),A.Ea(T),!A.B()&&(A.ca()>d||A.R()>d)&&(v=!0)),v&&b)return!0;return!1},h.iU=function(l,u,d){var g=new m.l,v=new m.l;return l.A(g),u.A(v),!!h.ek(g,v,d)&&(!!h.jU(l,u,d)||h.YA(l,u,d,!1,!0,!1))},h.gU=function(l,u,d){return!h.gI(l,u,d)},h.oU=function(l,u,d){return h.YA(l,u,d,!1,!1,!0)},h.eI=function(l,u,d){var g=new m.l,v=new m.l;return l.A(g),u.A(v),!!h.zc(g,v,d)&&h.YA(u,l,d,!0,!1,!1)},h.Mw=function(l,u,d){d*=d;for(var g=new m.h,v=new m.h,b=0;bd||v.R()>d)&&h.ek(g,v,d)},h.fU=function(l,u,d){var g=new m.l,v=new m.l;if(l.A(g),u.A(v),h.zc(v,g,d))return!1;for((u=new m.l).K(v),u.W(d,d),d=new m.h,v=0;vd?b.W(0,-d):b.W(-d,0);for(var A=0;Ad){if(u.y>b.G&&u.yb.v&&u.xd?g.W(0,-d):g.W(-d,0),b.W(d,d);for(var T=new m.h,A=0;Ad?T.y>g.G&&T.yg.v&&T.xd||v.R()>d)&&(u=u.Ip(),!h.kt(l,u,d))},h.eU=function(l,u,d){var g=new m.l,v=new m.l;if(l.A(g),u.A(v),h.zc(v,g,d)||v.ca()<=d&&v.R()<=d)return!1;if(v.ca()<=d||v.R()<=d){u=new m.l,g=new m.l,u.K(v),v.ca()>d?u.W(0,-d):u.W(-d,0),g.K(v),g.W(d,d);for(var b=new m.h,T=!1,A=!1,O=0;Od?b.y>u.G&&b.yu.v&&b.xd*d},h.uI=function(l,u,d){return h.wI(l,u,d)},h.vI=function(l,u,d){var g=new m.l;return g.K(l),h.ek(g,u,d)},h.Rw=function(l,u,d){var g=new m.l;return g.K(u),g.W(d,d),!g.contains(l)},h.dB=function(l,u,d){if(u.ca()<=d&&u.R()<=d)return!1;var g=new m.l,v=new m.l;if(g.K(u),g.W(d,d),!g.contains(l))return!1;if(u.ca()<=d||u.R()<=d){if(v.K(u),u.ca()>d?v.W(0,-d):v.W(-d,0),u.ca()>d){if(l.y>v.G&&l.yv.v&&l.xd?g.W(0,-d):g.W(-d,0);var v=!1;return u.ca()>d?l.y>g.G&&l.yg.v&&l.xd&&l.R()>d&&(u.ca()<=d||u.R()<=d)?g=u:(g=l,l=u),g.ca()<=d||g.R()<=d){if(l.ca()<=d||l.R()<=d){u=new m.yb;var v=new m.yb,b=[0,0],T=[0,0],A=new m.h;return g.dn(A),u.Dc(A),g.en(A),u.Qc(A),l.dn(A),v.Dc(A),l.en(A),v.Qc(A),u.Ea(v,null,b,T,d),u.Ea(v,null,null,null,d)==1&&(b[0]==0||b[1]==1||T[0]==0||T[1]==1)}return u=new m.l,v=new m.l,u.K(l),u.W(-d,-d),v.K(u),v.Ea(g),!(!v.B()&&(v.ca()>d||v.R()>d))}return l.W(d,d),(v=new m.l).K(g),v.Ea(l),!(v.B()||!v.B()&&v.ca()>d&&v.R()>d)},h.bQ=function(l,u,d){if(h.zc(l,u,d)||h.zc(u,l,d)||l.ca()<=d&&l.R()<=d||u.ca()<=d&&u.R()<=d)return!1;if(l.ca()<=d||l.R()<=d){if(u.ca()>d&&u.R()>d)return!1;var g=new m.yb,v=new m.yb,b=[0,0],T=[0,0],A=new m.h;return l.dn(A),g.Dc(A),l.en(A),g.Qc(A),u.dn(A),v.Dc(A),u.en(A),v.Qc(A),g.Ea(v,null,b,T,d),g.Ea(v,null,null,null,d)==2&&(0b[1])&&(0T[1])}return!(u.ca()<=d||u.R()<=d)&&((g=new m.l).K(l),g.Ea(u),!(g.B()||g.ca()<=d||g.R()<=d))},h.jF=function(l,u,d){if(!h.zc(l,u,d))return!1;if(l.ca()<=d&&l.R()<=d)return l=l.sf(),h.eB(l,u,d);if(u.ca()<=d&&u.R()<=d)return u=u.sf(),h.eB(u,l,d);if(l.ca()<=d||l.R()<=d)return h.zc(l,u,d);if(u.ca()<=d||u.R()<=d){var g=new m.l;return g.K(l),g.W(-d,-d),g.hm(u)?!0:((l=new m.l).K(g),l.Ea(u),!(l.B()||l.ca()<=d&&l.R()<=d))}return h.zc(l,u,d)},h.aQ=function(l,u,d){if(h.zc(l,u,d)||h.zc(u,l,d)||l.ca()<=d&&l.R()<=d||u.ca()<=d&&u.R()<=d||u.ca()>d&&u.R()>d&&l.ca()>d&&l.R()>d)return!1;if(l.ca()>d&&l.R()>d)var g=u;else g=l,l=u;if(l.ca()>d&&l.R()>d){u=new m.l;var v=new m.l;return v.K(l),v.W(-d,-d),u.K(v),u.Ea(g),!(u.B()||u.ca()<=d&&u.R()<=d)}u=new m.yb,v=new m.yb;var b=[0,0],T=[0,0],A=new m.h;return g.dn(A),u.Dc(A),g.en(A),u.Qc(A),l.dn(A),v.Dc(A),l.en(A),v.Qc(A),u.Ea(v,null,b,T,d),u.Ea(v,null,null,null,d)==1&&0b[1]&&0T[1]},h.EI=function(l,u,d){var g=new m.l,v=new m.l,b=new m.Zl(l,u,d,!0);if(!b.next())return!0;if(this.UG(l,u,d))return!1;var T=l,A=null;u.getType()==1736&&(A=u);var O=!1,I=!1;do{var L=b.nl(),N=b.hl();if(N=u.Na(u.Ba(N)),g.K(b.uz()),g.W(d,d),g.contains(N)&&(N=m.hd.Yd(T,N,0))!=0||u.getType()==1736&&(L=l.Na(l.Ba(L)),v.K(b.az()),v.W(d,d),v.contains(L)&&(N=m.hd.Yd(A,L,0))!=0))return!1;O||(!m.Dg.Ml(l,u.da()-1)||l.Bb!=null&&l.Bb.Fb!=null?T=l:(T=new m.Da,l.copyTo(T),T.fj(1)),O=!0),u.getType()!=1736||I||(I=u,!m.Dg.Ml(I,l.da()-1)||u.Bb!=null&&u.Bb.Fb!=null?A=u:(A=new m.Da,I.copyTo(A),A.fj(1)),I=!0)}while(b.next());return!0},h.zc=function(l,u,d){var g=new m.l;return g.K(l),g.W(d,d),g.contains(u)},h.ls=function(l,u,d){var g=new m.l;return g.K(u),g.W(d,d),u=new m.h,l.dn(u),!g.contains(u)||(l.$I(u),!g.contains(u)||(l.cJ(u),!g.contains(u)||(l.en(u),!g.contains(u))))},h.dI=function(l,u,d){if(l.da()!=u.da()||l.I()!=u.I())return!1;var g=new m.h,v=new m.h,b=!0;d*=d;for(var T=0;Td){b=!1;break}if(!b)break}return!!b},h.jU=function(l,u,d){if(l.I()!=u.I())return!1;var g=new m.h,v=new m.h,b=!0;d*=d;for(var T=0;Td){b=!1;break}return!!b},h.YA=function(l,u,d,g,v,b){var T=!1;if(l.I()>u.I()){g&&(g=!1,T=!0);var A=u}else A=l,l=u;if(u=null,v||b||T){u=new m.pn(l.I());for(var O=0;Ou.I())var g=u;else g=l,l=u;u=new m.l;var v=new m.l,b=new m.l;g.A(u),l.A(v),u.W(d,d),v.W(d,d),b.K(u),b.Ea(v),v=new m.h;for(var T=new m.h,A=d*d,O=m.ta.oE(l,b),I=O.getIterator(),L=0;Ld)return!1;if(q*(1-(ye=b.Si))<=d||ye==1)break}if(q*(1-ye)>d)return!1;I=0,L.resize(0),N.rh.length=0}}return T},h.WG=function(l,u,d){if(1>h.Xz(l,u,d,null))return!1;var g=new m.l,v=new m.l;l.A(g),u.A(v);var b=h.ls(g,v,d);return g=h.ls(v,g,d),!(!b||!g)||(b&&!g?!h.ym(u,l,d,!1):g&&!b?!h.ym(l,u,d,!1):!h.ym(l,u,d,!1)&&!h.ym(u,l,d,!1))},h.Xz=function(l,u,d,g){function v(At,nn){return B.QE(At,nn)}if(l.yz()>u.yz())var b=u,T=l;else b=l,T=u;l=b.Ga(),u=T.Ga();var A=[0,0],O=[0,0],I=-1,L=0,N=new m.ia(0),B=new h,H=new m.l,K=new m.l,ee=new m.l;b.A(H),T.A(K),H.W(d,d),K.W(d,d),ee.K(H),ee.Ea(K),b=null,g!=null&&(b=new m.h);var q=K=K=null,oe=T.Bb;for(oe!=null?(K=oe.Fb,q=oe.zo,K==null&&(K=m.ta.jj(T,ee))):K=m.ta.jj(T,ee),T=K.getIterator(),oe=null,q!=null&&(oe=q.getIterator());l.$a();)for(q=0;l.Ha();){var ye=l.ha();if(ye.A(H),H.isIntersecting(ee)){if(oe!=null&&(oe.Xi(H,d),oe.next()==-1))continue;var me=ye.Qb();T.Uo(ye,d);for(var Me=T.next();Me!=-1;Me=T.next()){var Te=K.ja(Me);u.Vb(Te);var Fe=u.ha(),Xe=Fe.Qb(),We=ye.Ea(Fe,null,A,O,d);if(0d)return 1;var vi=me*(Ot-Me);if(u.Ha()){if(Fe=u.ha(),(We=ye.Ea(Fe,null,A,null,d))==2){We=A[0];var di=A[1];if(vi+(We=me*(di-We))>d)return 1}u.Vb(Te),u.ha()}if(!u.vm()){if(u.li(),Fe=u.li(),(We=ye.Ea(Fe,null,A,null,d))==2&&(We=A[0],vi+(We=me*((di=A[1])-We))>d))return 1;u.Vb(Te),u.ha()}if(l.Ha()){if(Te=l.wb(),(We=(ye=l.ha()).Ea(Fe,null,A,null,d))==2&&(We=A[0],vi+(We=me*((di=A[1])-We))>d))return 1;l.Vb(Te),l.ha()}if(!l.vm()){if(Te=l.wb(),l.li(),(We=(ye=l.li()).Ea(Fe,null,A,null,d))==2&&(We=A[0],vi+(We=Xe*((di=A[1])-We))>d))return 1;l.Vb(Te),l.ha()}Fe=E.construct(l.wb(),l.gb,Me,Ot,u.wb(),u.gb,I,lt),B.rh.push(Fe),N.add(N.size)}I=0,g!=null&&(ye.hc(Me,b),g.add(b.x),g.add(b.y))}}if(Ld)q=me*(Fe.Si-Fe.Kj),ye=Fe.Si,Me=Fe.Mm;else{if(Fe.Mm!=Me?(q=me*(Fe.Si-Fe.Kj),Me=Fe.Mm):q+=me*(Fe.Si-Fe.Kj),q>d)return 1;if((ye=Fe.Si)==1)break}me*(1-ye)>d&&(q=0),L=0,N.resize(0),B.rh.length=0}}}return I},h.UG=function(l,u,d){var g=l.Ga(),v=u.Ga();for(l=new m.Zl(l,u,d,!1);l.next();){u=l.nl();var b=l.hl();if(g.Vb(u),v.Vb(b),u=g.ha(),0d)return!1;L=!0}else if(B!=0){if(L=A[0],N=O[0],0L&&0N)return!1;L=!0}}return!!L&&(b=new m.l,T=new m.l,v=new m.l,l.A(b),u.A(T),b.W(1e3*d,1e3*d),T.W(1e3*d,1e3*d),v.K(b),v.Ea(T),!(10d&&(O=!0,I&&L))return!0}else if(q!=0&&(q=H[0],oe=K[0],0q&&0oe))return!0}if(v=new m.l,N=new m.l,v.K(b),v.W(1e3*d,1e3*d),N.K(T),N.W(1e3*d,1e3*d),A.K(v),A.Ea(N),b="",b=O?b+"**":b+"T*",I){if(10L&&0N)))return g[0]=!0,!1}if(!I){for(g[0]=!0,T=new m.l,l.A(T),T.W(d,d),O=l,I=!1,A=new m.l,g=0,v=u.da();gI&&0L)return!1;I=!0}}return!!I&&(b=new m.l,T=new m.l,v=new m.l,l.A(b),u.A(T),b.W(1e3*d,1e3*d),T.W(1e3*d,1e3*d),v.K(b),v.Ea(T),!(10I&&0L)return!0;I=!0}}return!!I&&(b=new m.l,T=new m.l,A=new m.l,O=new m.l,v=new m.l,l.A(b),u.A(T),h.ls(T,b,d)?(A.K(b),A.W(1e3*d,1e3*d),O.K(T),O.W(1e3*d,1e3*d),v.K(A),v.Ea(O),!(10b;b++){var T=g.charAt(b);if(T!="*"&&T!="T"&&T!="F"&&T!="0"&&T!="1"&&T!="2")throw m.i.fa("relation string")}if((b=this.MR(g,l.Db(),u.Db()))!=0)return m.ud.zB(l,u,d,b,v);b=new m.l,l.A(b),T=new m.l,u.A(T);var A=new m.l;if(A.K(b),A.Zb(T),d=m.ta.Wd(d,A,!1),l=this.WE(l,d),u=this.WE(u,d),l.B()||u.B())return this.uW(l,u,g);switch(b=l.getType(),T=u.getType(),A=!1,b){case 1736:switch(T){case 1736:A=this.rt(l,u,d,g,v);break;case 1607:A=this.$m(l,u,d,g,v);break;case 33:A=this.qt(l,u,d,g);break;case 550:A=this.pt(l,u,d,g,v)}break;case 1607:switch(T){case 1736:A=this.$m(u,l,d,this.Zp(g),v);break;case 1607:A=this.gB(l,u,d,g,v);break;case 33:A=this.tt(l,u,d,g,v);break;case 550:A=this.st(l,u,d,g,v)}break;case 33:switch(T){case 1736:A=this.qt(u,l,d,this.Zp(g));break;case 1607:A=this.tt(u,l,d,this.Zp(g),v);break;case 33:A=this.$U(l,u,d,g);break;case 550:A=this.lt(u,l,d,this.Zp(g))}break;case 550:switch(T){case 1736:A=this.pt(u,l,d,this.Zp(g),v);break;case 1607:A=this.st(u,l,d,this.Zp(g),v);break;case 550:A=this.ZA(l,u,d,g,v);break;case 33:A=this.lt(l,u,d,g)}break;default:A=!1}return A},h.rt=function(l,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.xJ();var T=new m.l,A=new m.l;return l.A(T),u.A(A),g=!1,m.ud.dk(T,A,d)&&(b.Cu(l,u),g=!0),g||((T=m.ud.qc(l,u,!1))==4?(b.Cu(l,u),g=!0):T==1?(b.ly(u),g=!0):T==2&&(b.ZD(l),g=!0)),g||(l=(g=new m.gd).Ib(l),u=g.Ib(u),b.Wo(g,d,v),b.Bp(l,u),b.j.Ug()),h.fg(b.J,b.Xc)},h.Sw=function(l,u,d,g){var v=new h;v.Yi(),v.bj("T*****F**"),v.xJ();var b=new m.l,T=new m.l;l.A(b),u.A(T);var A=!1;return m.ud.dk(b,T,d)&&(v.Cu(l,u),A=!0),A||((b=m.ud.qc(l,u,!1))==4?(v.Cu(l,u),A=!0):b==1?(v.ly(u),A=!0):b==2&&(v.ZD(l),A=!0)),A?this.fg(v.J,v.Xc):(l=(A=new m.gd).Ib(l),b=A.Ib(u),m.Tk.V(A,d,g,!1),d=A.Ne(b).mg(),A.Gp(0,!0,!0),m.rn.V(A,l,-1,!1,g),A.I(l)!=0&&(m.rn.V(A,b,-1,!1,g),v.er(A,g),(u=A.I(b)==0)||(v.Bp(l,b),v.j.Ug(),b=this.fg(v.J,v.Xc))?(l=A.Ne(l),l=(A=new m.gd).Ib(l),b=A.Ib(d),v.er(A,g),v.le=0,v.Yi(),v.bj(u?"T*****F**":"******F**"),v.IB(),v.Bp(l,b),v.j.Ug(),this.fg(v.J,v.Xc)):b))},h.$m=function(l,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.IB();var T=new m.l,A=new m.l;return l.A(T),u.A(A),g=!1,m.ud.dk(T,A,d)&&(b.Du(l,u),g=!0),g||((T=m.ud.qc(l,u,!1))==4?(b.Du(l,u),g=!0):T==1&&(b.$D(u),g=!0)),g||(l=(g=new m.gd).Ib(l),u=g.Ib(u),b.Wo(g,d,v),b.kh=b.j.Dp(),h.Jw(u,b.j,b.kh),b.Bp(l,u),b.j.Ep(b.kh),b.j.Ug()),h.fg(b.J,b.Xc)},h.fB=function(l,u,d,g){var v=new h;v.Yi(),v.bj("T*****F**"),v.IB();var b=new m.l,T=new m.l;l.A(b),u.A(T);var A=!1;return m.ud.dk(b,T,d)&&(v.Du(l,u),A=!0),A||((b=m.ud.qc(l,u,!1))==4?(v.Du(l,u),A=!0):b==1&&(v.$D(u),A=!0)),A?this.fg(v.J,v.Xc):(l=(A=new m.gd).Ib(l),u=A.Ib(u),v.Wo(A,d,g),A.I(l)!=0&&(v.Bp(l,u),v.j.Ug(),this.fg(v.J,v.Xc)))},h.pt=function(l,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.yJ();var T=new m.l,A=new m.l;return l.A(T),u.A(A),g=!1,m.ud.dk(T,A,d)&&(b.Eu(l),g=!0),g||((T=m.ud.qc(l,u,!1))==4?(b.Eu(l),g=!0):T==1&&(b.zN(),g=!0)),g||(l=(g=new m.gd).Ib(l),u=g.Ib(u),b.Wo(g,d,v),b.Gy(l,u),b.j.Ug()),h.fg(b.J,b.Xc)},h.gB=function(l,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.eX(),g=new m.l;var T=new m.l;l.A(g),u.A(T);var A=!1;return m.ud.dk(g,T,d)&&(b.PG(l,u),A=!0),A||m.ud.qc(l,u,!1)!=4||(b.PG(l,u),A=!0),A||(l=(g=new m.gd).Ib(l),u=g.Ib(u),b.Wo(g,d,v),b.Yh=b.j.Dp(),b.kh=b.j.Dp(),h.Jw(l,b.j,b.Yh),h.Jw(u,b.j,b.kh),b.Bp(l,u),b.j.Ep(b.Yh),b.j.Ep(b.kh),b.j.Ug()),h.fg(b.J,b.Xc)},h.st=function(l,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.MJ(),g=new m.l;var T=new m.l;l.A(g),u.A(T);var A=!1;return m.ud.dk(g,T,d)&&(b.Vz(l),A=!0),A||m.ud.qc(l,u,!1)!=4||(b.Vz(l),A=!0),A||(l=(g=new m.gd).Ib(l),u=g.Ib(u),b.Wo(g,d,v),b.Yh=b.j.Dp(),h.Jw(l,b.j,b.Yh),b.Gy(l,u),b.j.Ep(b.Yh),b.j.Ug()),h.fg(b.J,b.Xc)},h.ZA=function(l,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.RJ(),g=new m.l;var T=new m.l;l.A(g),u.A(T);var A=!1;return m.ud.dk(g,T,d)&&(b.yI(),A=!0),A||(l=(g=new m.gd).Ib(l),u=g.Ib(u),b.Wo(g,d,v),b.Gy(l,u),b.j.Ug()),h.fg(b.J,b.Xc)},h.qt=function(l,u,d,g){var v=new h;v.Yi(),v.bj(g),v.yJ();var b=new m.l;l.A(b),u=u.D();var T=!1;return m.ud.Rw(u,b,d)&&(v.Eu(l),T=!0),T||((d=m.hd.Yd(l,u,d))==1?(v.J[0]=0,v.J[2]=2,v.J[3]=-1,v.J[5]=1,v.J[6]=-1):d==2?(v.J[6]=-1,l.Ke()!=0?(v.J[0]=-1,v.J[3]=0,v.J[2]=2,v.J[5]=1):(v.J[0]=0,v.J[3]=-1,v.J[5]=-1,d=new m.l,l.A(d),v.J[2]=d.ca()==0&&d.R()==0?-1:1)):v.Eu(l)),this.fg(v.J,g)},h.tt=function(l,u,d,g,v){var b=new h;b.Yi(),b.bj(g),b.MJ();var T=new m.l;l.A(T),g=u.D();var A=!1;if(m.ud.Rw(g,T,d)&&(b.Vz(l),A=!0),!A){T=null;var O=A=!1;(b.ea[0]||b.ea[6])&&(m.ud.Yz(l,g,d)?(b.ea[0]&&(T=m.pi.gm(l,v),O=!m.ud.kt(T,g,d),A=!0,b.J[0]=O?-1:0),b.J[6]=-1):(b.J[0]=-1,b.J[6]=0)),b.ea[3]&&(T!=null&&T.B()?b.J[3]=-1:(A||(T==null&&(T=m.pi.gm(l,v)),O=!m.ud.kt(T,g,d),A=!0),b.J[3]=O?0:-1)),b.ea[5]&&(T!=null&&T.B()?b.J[5]=-1:A&&!O?b.J[5]=0:(T==null&&(T=m.pi.gm(l,v)),v=m.ud.Nw(T,u,d),b.J[5]=v?-1:0)),b.ea[2]&&(l.Qb()!=0?b.J[2]=1:((v=new m.de(l.description)).Fd(l,0,l.I()),l=m.ud.Nw(v,u,d),b.J[2]=l?-1:0))}return this.fg(b.J,b.Xc)},h.lt=function(l,u,d,g){var v=new h;v.Yi(),v.bj(g),v.RJ();var b=new m.l;l.A(b),u=u.D();var T=!1;if(m.ud.Rw(u,b,d)&&(v.yI(),T=!0),!T){b=!1,T=!0,d*=d;for(var A=0;Ab;b++)v[b]=-1;return m.h.yc(l,u)<=d*d?v[0]=0:(v[2]=0,v[6]=0),v[8]=2,h.fg(v,g)},h.fg=function(l,u){for(var d=0;9>d;d++)switch(u.charAt(d)){case"T":if(l[d]==-1)return!1;break;case"F":if(l[d]!=-1)return!1;break;case"0":if(l[d]!=0)return!1;break;case"1":if(l[d]!=1)return!1;break;case"2":if(l[d]!=2)return!1}return!0},h.uW=function(l,u,d){var g=[-1,-1,-1,-1,-1,-1,-1,-1,-1];if(l.B()&&u.B()){for(var v=0;9>v;v++)g[v]=-1;return this.fg(g,d)}return v=!1,l.B()&&(l=u,v=!0),g[0]=-1,g[1]=-1,g[3]=-1,g[4]=-1,g[6]=-1,g[7]=-1,g[8]=2,u=l.getType(),m.aa.Hc(u)?u==1736?l.Ke()!=0?(g[2]=2,g[5]=1):(g[5]=-1,u=new m.l,l.A(u),g[2]=u.ca()==0&&u.R()==0?0:1):(u=l.Qb()!=0,g[2]=u?1:0,g[5]=m.pi.aq(l)?0:-1):(g[2]=0,g[5]=-1),v&&this.vK(g),this.fg(g,d)},h.MR=function(l,u,d){return h.dQ(l)?3:h.UP(l)?4:h.cY(l,u,d)?8:h.CP(l,u,d)?16:h.eP(l)?1:h.EU(l,u,d)?32:0},h.dQ=function(l){return l.charAt(0)=="T"&&l.charAt(1)=="*"&&l.charAt(2)=="F"&&l.charAt(3)=="*"&&l.charAt(4)=="*"&&l.charAt(5)=="F"&&l.charAt(6)=="F"&&l.charAt(7)=="F"&&l.charAt(8)=="*"},h.UP=function(l){return l.charAt(0)=="F"&&l.charAt(1)=="F"&&l.charAt(2)=="*"&&l.charAt(3)=="F"&&l.charAt(4)=="F"&&l.charAt(5)=="*"&&l.charAt(6)=="*"&&l.charAt(7)=="*"&&l.charAt(8)=="*"},h.cY=function(l,u,d){return(u!=0||d!=0)&&((u!=2||d!=2)&&(l.charAt(0)=="F"&&l.charAt(1)=="*"&&l.charAt(2)=="*"&&l.charAt(3)=="T"&&l.charAt(4)=="*"&&l.charAt(5)=="*"&&l.charAt(6)=="*"&&l.charAt(7)=="*"&&l.charAt(8)=="*"||u==1&&d==1&&l.charAt(0)=="F"&&l.charAt(1)=="T"&&l.charAt(2)=="*"&&l.charAt(3)=="*"&&l.charAt(4)=="*"&&l.charAt(5)=="*"&&l.charAt(6)=="*"&&l.charAt(7)=="*"&&l.charAt(8)=="*")||d!=0&&l.charAt(0)=="F"&&l.charAt(1)=="*"&&l.charAt(2)=="*"&&l.charAt(3)=="*"&&l.charAt(4)=="T"&&l.charAt(5)=="*"&&l.charAt(6)=="*"&&l.charAt(7)=="*"&&l.charAt(8)=="*")},h.CP=function(l,u,d){return u>d?l.charAt(0)=="T"&&l.charAt(1)=="*"&&l.charAt(2)=="*"&&l.charAt(3)=="*"&&l.charAt(4)=="*"&&l.charAt(5)=="*"&&l.charAt(6)=="T"&&l.charAt(7)=="*"&&l.charAt(8)=="*":u==1&&d==1&&l.charAt(0)=="0"&&l.charAt(1)=="*"&&l.charAt(2)=="*"&&l.charAt(3)=="*"&&l.charAt(4)=="*"&&l.charAt(5)=="*"&&l.charAt(6)=="*"&&l.charAt(7)=="*"&&l.charAt(8)=="*"},h.eP=function(l){return l.charAt(0)=="T"&&l.charAt(1)=="*"&&l.charAt(2)=="*"&&l.charAt(3)=="*"&&l.charAt(4)=="*"&&l.charAt(5)=="*"&&l.charAt(6)=="F"&&l.charAt(7)=="F"&&l.charAt(8)=="*"},h.EU=function(l,u,d){if(u==d){if(u!=1)return l.charAt(0)=="T"&&l.charAt(1)=="*"&&l.charAt(2)=="T"&&l.charAt(3)=="*"&&l.charAt(4)=="*"&&l.charAt(5)=="*"&&l.charAt(6)=="T"&&l.charAt(7)=="*"&&l.charAt(8)=="*";if(l.charAt(0)=="1"&&l.charAt(1)=="*"&&l.charAt(2)=="T"&&l.charAt(3)=="*"&&l.charAt(4)=="*"&&l.charAt(5)=="*"&&l.charAt(6)=="T"&&l.charAt(7)=="*"&&l.charAt(8)=="*")return!0}return!1},h.Jw=function(l,u,d){l=u.La(l);for(var g=u.Re;g!=-1;g=u.Rf(g))if(u.xd(g)&l){var v=u.Me(g);if(v==-1)u.nn(g,d,0);else{var b=v,T=0;do u.dh(b)&l&&T++,b=u.jc(u.xa(b));while(b!=v);u.nn(g,d,T)}}},h.Zp=function(l){var u=""+l.charAt(0);return u+=l.charAt(3),u+=l.charAt(6),u+=l.charAt(1),u+=l.charAt(4),u+=l.charAt(7),u+=l.charAt(2),(u+=l.charAt(5))+l.charAt(8)},h.prototype.Yi=function(){for(var l=0;9>l;l++)this.J[l]=-2,this.Za[l]=-2},h.vK=function(l){var u=l[1],d=l[2],g=l[5];l[1]=l[3],l[2]=l[6],l[5]=l[7],l[3]=u,l[6]=d,l[7]=g},h.prototype.bj=function(l){for(this.Xc=l,l=0;9>l;l++)this.Xc.charAt(l)!="*"?(this.ea[l]=!0,this.le++):this.ea[l]=!1},h.prototype.UJ=function(){for(var l=0;9>l;l++)this.ea[l]&&this.J[l]==-2&&(this.J[l]=-1,this.ea[l]=!1)},h.prototype.pc=function(l){return this.J[l]!=-2&&(this.J[l]==-1?(this.ea[l]=!1,this.le--,!0):this.Xc.charAt(l)!="T"&&this.Xc.charAt(l)!="F"?!(this.J[l]b?1:0},h.prototype.reset=function(){this.yA=-1},h}(),f=function(){function h(){this.Wm=this.Gl=null,this.fb=new m.Yj,this.fb.RP(),this.$d=new E(this),this.fb.Vo(this.$d)}return h.prototype.HQ=function(){var l=!1;if(this.fw&&(l=this.IQ()),this.g.da(this.X)==1){var u=this.g.Ob(this.X);return l=this.g.wz(u),this.g.PB(u,!0),0>l&&(l=this.g.Xa(u),this.g.pJ(l),this.g.Wg(u,this.g.Ma(l)),!0)}for(this.El=this.g.Ky(),this.wo=this.g.Ky(),u=this.g.Ob(this.X);u!=-1;u=this.g.Rb(u))this.g.gr(u,this.El,0),this.g.gr(u,this.wo,-1);u=new m.ia(0),this.yh=NaN;var d=new m.h;this.et=this.g.da(this.X),this.ro=this.g.Gd(),this.Rs=this.g.Gd();for(var g=this.Gl.rc(this.Gl.je);g!=-1;g=this.Gl.lb(g)){var v=this.Gl.getData(g);if(this.g.Gc(v,d),d.y!=this.yh&&u.size!=0&&(l=this.ut(u)||l,this.$d.reset(),u.clear(!1)),u.add(v),this.yh=d.y,this.et==0)break}for(0=this.MA.length&&this.MA.push(new m.ig);var h=this.MA[this.Cw];return this.Cw++,h},f.prototype.clear=function(){this.wB(this.mo),this.wB(this.$s),this.wB(this.yw),this.Cw=0},f.prototype.Oo=function(h){this.mo.push(this.Ow(h))},f.prototype.ol=function(h){return h==0?this.$s.length:this.yw.length},f.prototype.Vp=function(h,l){return this.SR(h,l).$i},f.prototype.Ea=function(h,l){if(this.mo.length!=2)throw m.i.Qa();this.qa=h;var u=m.lc.ox(.01*h),d=!1,g=this.mo[0],v=this.mo[1];if(l||5&g.$i.zr(v.$i,h,!0)){if(g.$i.getType()==322){var b=g.$i;if(v.$i.getType()==322){l=v.$i;var T=m.yb.Zx(b,l,null,this.Fq,this.Bk,h);if(T==0)throw m.yb.Zx(b,l,null,this.Fq,this.Bk,h),m.i.Qa();h=Array(9),m.O.$u(h,null);for(var A=0;Au&&(d=!0)):L>B?(b.hc(O,K),O=new m.h,l.hc(I,O),m.h.yc(K,O)>u&&(d=!0)):(l.hc(I,K),L=new m.h,b.hc(O,L),m.h.yc(K,L)>u&&(d=!0)),h[A]=K}for(g=0,v=-1,A=0;A<=T;A++)(H=Athis.Bk[1]&&(H=this.Bk[0],this.Bk[0]=this.Bk[1],this.Bk[1]=H,A=b[0],b[0]=b[1],b[1]=A),g=0,v=-1,A=0;A<=T;A++)(H=A=v;v++){if((l=1>v?this.Fq[v]:1)!=u){var b=this.aB();h.ah(u,l,b),g!=-1&&b.get().Dc(d),v!=1&&b.get().Qc(d),u=l,this.$s.push(this.Ow(b.get()))}g=v}this.Bf.Cb(d)}},f}();m.TC=E}(re||(re={})),function(m){var D=function(){function E(f){this.Ds=this.rk=this.sb=null,this.ag=0,this.zm=!1,this.zf=-1,this.Cl=this.Jd=0,this.gb=-1,this.ib=f,this.ag=this.Wx(this.Cl),this.zm=!1,this.rk=null,this.Ds=new m.h}return E.prototype.BW=function(f){if(this.ib!=f.ib)throw m.i.Hb();this.zf=f.zf,this.Jd=f.Jd,this.gb=f.gb,this.Cl=f.Cl,this.ag=f.ag,this.zm=f.zm,this.rk=null},E.prototype.ha=function(){if(this.zf!=this.Jd&&this.BD(),this.zm)this.Jd=(this.Jd+1)%this.ag;else{if(this.Jd==this.ag)throw m.i.ce();this.Jd++}return this.rk},E.prototype.li=function(){if(this.zm)this.Jd=(this.ag+this.Jd-1)%this.ag;else{if(this.Jd==0)throw m.i.ce();this.Jd--}return this.Jd!=this.zf&&this.BD(),this.rk},E.prototype.DW=function(){this.zf=-1,this.Jd=0},E.prototype.EW=function(){this.Jd=this.ag,this.zf=-1},E.prototype.Vb=function(f,h){if(h===void 0&&(h=-1),0<=this.gb&&this.gb=l&&f=this.ib.Ba(h)&&f=this.ib.da())&&(this.zf=-1,this.Jd=0,this.ag=this.Wx(this.gb),this.ib.Ba(this.gb),this.ib.dc(this.gb),this.Cl++,!0)},E.prototype.Zi=function(){this.ag=this.Jd=this.zf=-1,this.Cl=0,this.gb=-1},E.prototype.Wx=function(f){if(this.ib.Ac())return 0;var h=1;return this.ib.dc(f)&&(h=0),this.ib.Ja(f)-h},E.prototype.On=function(){return this.zf==this.ag-1&&this.ib.dc(this.gb)},E.prototype.JB=function(){this.zm=!0},E.prototype.wb=function(){return this.ib.nb.o[this.gb]+this.zf},E.prototype.IM=function(){return this.ib.Ba(this.gb)},E.prototype.ik=function(){return this.On()?this.ib.Ba(this.gb):this.wb()+1},E.prototype.vm=function(){return this.zf==0},E.prototype.Qn=function(){return this.zf==this.ag-1},E.prototype.Ha=function(){return this.Jdthis.Jd||this.Jd>=this.ag)throw m.i.ce();this.zf=this.Jd;var f=this.wb();this.ib.mc();var h=this.ib.Ve,l=1;switch(h!=null&&(l=7&h.read(f)),h=this.ib.description,l){case 1:this.sb==null&&(this.sb=new m.yb),this.rk=this.sb;break;case 2:throw m.i.fa("internal error");default:throw m.i.Qa()}this.rk.Nf(h),l=this.ik(),this.ib.Gc(f,this.Ds),this.rk.Dc(this.Ds),this.ib.Gc(l,this.Ds),this.rk.Qc(this.Ds);for(var u=1,d=h.Aa;ud&&(g=h,h=u,u=g,g=l,l=d,d=g,g=-1),!(0>d||l>=this.pl)){0>h&&0>u?u=h=-1:h>=this.oi&&u>=this.oi&&(u=h=this.oi);var v=(u-h)/(d-l);d>this.pl&&(u=v*((d=this.pl)-l)+h),0>l&&(h=v*(0-l)+h,l=0);var b=Math.max(this.oi+1,8388607);-8388607>h?(l=(0-h)/v+l,h=0):h>b&&(l=(this.oi-h)/v+l,h=this.oi),-8388607>u?d=(0-h)/v+l:u>b&&(d=(this.oi-h)/v+l),(l=m.O.truncate(l))!=(d=m.O.truncate(d))&&((u=new D).x=m.O.truncate(4294967296*h),u.y=l,u.H=d,u.WP=m.O.truncate(4294967296*v),u.dir=g,this.Wl==null&&(this.Wl=m.O.lg(this.pl,null)),u.next=this.Wl[u.y],this.Wl[u.y]=u,u.ythis.Kw&&(this.Kw=u.H),this.Tq++)}}},f.prototype.sN=function(){if(this.Jh!=null){for(var h=!1,l=null,u=this.Jh;u!=null;)if(u.y++,u.y==u.H){var d=u;u=u.next,l!=null?l.next=u:this.Jh=u,d.next=null}else u.x+=u.WP,l!=null&&l.x>u.x&&(h=!0),l=u,u=u.next;h&&(this.Jh=this.fK(this.Jh))}},f.prototype.lN=function(h){if(!(h>=this.pl)){var l=this.Wl[h];if(l!=null){this.Wl[h]=null,l=this.fK(l),this.Tq-=this.gK,h=this.Jh;for(var u=!0,d=l,g=null;h!=null&&d!=null;)h.x>d.x?(u&&(this.Jh=d),u=d.next,d.next=h,g!=null&&(g.next=d),g=d,d=u):(u=h.next,h.next=d,g!=null&&(g.next=h),g=h,h=u),u=!1;this.Jh==null&&(this.Jh=l)}}},f.eK=function(h,l){return 0>h?0:h>l?l:h},f.prototype.ZP=function(){if(this.Jh!=null){for(var h=0,l=this.Jh,u=m.O.truncate(m.O.XG(l.x)),d=l.next;d!=null;d=d.next)if(h=this.kF?1^h:h+d.dir,d.x>l.x){var g=m.O.truncate(m.O.XG(d.x));h!=0&&(l=f.eK(u,this.oi),(u=f.eK(g,this.oi))>l&&lthis.Kf[1].x&&(h=this.Kf[0],this.Kf[0]=this.Kf[1],this.Kf[1]=h):f.AN(this.Kf,l,function(g,v){return g==v?0:g.xv.x?1:0}),h=this.Kf[0],this.Kf[0]=null,u=h,d=1;dthis.Wh.size)break;var T=this;for(this.xe.Vd(0,this.xe.size,function(A,O){return T.pM(A,O)}),l=0,u=this.xe.size;lH?1:Kee?1:0)==0&&(K=(L=T[A*L+3])<(N=T[A*N+3])?-1:L==N?0:1),K}),this.Pq=this.g.Gd(),this.oe=new m.jp,this.RA=this.oe.Ph(0),this.oe.fn(l),d=0;dT;T++){for(A=L[T],O=l[T],I=T-1;0<=I&&L[I]>A;)L[I+1]=L[I],l[I+1]=l[I],I--;L[I+1]=A,l[I+1]=O}return L=0,l[0]!=0&&(L|=1),l[1]!=0&&(L|=2),l[2]!=0&&(L|=4),l[3]!=0&&(L|=8),(L==5||L==10)&&(f==h?f?(this.g.Bc(b,u),this.g.Cc(u,b),this.g.Bc(d,v),this.g.Cc(v,d)):(this.g.Cc(b,u),this.g.Bc(u,b),this.g.Cc(d,v),this.g.Bc(v,d)):f?(this.g.Cc(u,g),this.g.Bc(g,u),this.g.Cc(v,d),this.g.Bc(d,v)):(this.g.Bc(u,g),this.g.Cc(g,u),this.g.Bc(v,d),this.g.Cc(d,v)),!0)},E.prototype.tD=function(f,h,l,u,d,g){this.MY?this.VM():this.UM(f,h,l,u,d,g)},E.prototype.VM=function(){throw m.i.fa("not implemented.")},E.prototype.UM=function(f,h,l,u,d,g){if(f!=h)f?(this.g.Bc(l,d),this.g.Cc(d,l),this.g.Bc(g,u),this.g.Cc(u,g),this.vn(d,l),this.ui(d,!0),this.g.mi(d,!0),this.bk(l),this.vn(g,u),this.ui(g,!0),this.g.mi(g,!1)):(this.g.Bc(d,l),this.g.Cc(l,d),this.g.Bc(u,g),this.g.Cc(g,u),this.vn(d,l),this.ui(d,!0),this.g.mi(d,!1),this.bk(l),this.vn(g,u),this.ui(g,!0),this.g.mi(g,!0)),this.bk(u);else{var v=f?l:u,b=h?d:g;for(f=f?u:l,h=h?g:d,d=!1,this.g.Bc(v,b),this.g.Bc(b,v),this.g.Cc(f,h),this.g.Cc(h,f),g=h;g!=b;)l=this.g.Ma(g),u=this.g.U(g),this.g.Cc(g,u),this.g.Bc(g,l),d=d||g==v,g=u;d||(l=this.g.Ma(b),u=this.g.U(b),this.g.Cc(b,u),this.g.Bc(b,l)),this.vn(b,v),this.ui(b,!0),this.g.mi(b,!1),this.bk(v),this.vn(h,f),this.ui(h,!0),this.g.mi(h,!1),this.bk(f)}},E.prototype.cD=function(){for(var f=!1,h=this.g.Ob(this.X);h!=-1;){for(var l=this.g.Xa(h),u=0,d=this.g.Ja(h);uthis.g.Ja(h)){for(f=this.g.Xa(h),u=0,d=this.g.Ja(h);u=h)throw m.i.N("Invalid or unsupported wkid: "+h);var l=new f;return l.dg=h,l},f.qP=function(h){if(h==null||h.length==0)throw m.i.N("Cannot create SpatialReference from null or empty text.");var l=new f;return l.wh=h,l},f.prototype.Nb=function(h){return this==h||h!=null&&this.constructor==h.constructor&&this.dg==h.dg&&(this.dg!=0||this.wh===h.wh)},f.prototype.toString=function(){return"[ tol: "+this.Kn()+"; wkid: "+this.Ec()+"; wkt: "+this.Bz()+"]"},f.prototype.cc=function(){if(this.pp!=="")return this.pp;var h=this.toString();if(Array.prototype.reduce)return this.pp="S"+h.split("").reduce(function(d,g){return(d=(d<<5)-d+g.charCodeAt(0))&d},0);var l=0;if(h.length===0)return"";for(var u=0;u=h.length)throw m.i.N();var l=null;try{l=m.NC.fromString(h)}catch{l=null}return l==null?null:f.bD(l,!0)},f.prototype.by=function(h){this.Kd=h,this.Eo=this.Kd.Hd()},f.prototype.gy=function(h){this.KH=h,this.ST=this.KH!=null?this.KH.Eo:null},f.prototype.Wc=function(){return this.Sb()!=0&&this.Sb()!=3&&this.Kd.Wc()},f.prototype.IG=function(){return this.Sb()!=0&&(this.Sb()==3?this.Ji.fk().Wc():this.Kd.Wc())},f.prototype.eh=function(){return this.Kd!=null?this.Kd.Ue:null},f.prototype.pm=function(){return this.Kd.pm()},f.prototype.bf=function(){return this.Kd.bf()},f.prototype.hh=function(){return this.Kd!=null?this.Kd.sw:NaN},f.prototype.Up=function(){return this.Kd.Up()},f.prototype.Wr=function(){return this.Kd.Wr()},f.prototype.kk=function(){return this.Kd.kk()},f.prototype.kS=function(h){return m.OC.Py(this.Kd,h.Kd)},f.prototype.ml=function(){return this.Kd.ml()},f.prototype.Vr=function(){return this.Kd.Vr()},f.prototype.zi=function(){return this.Sb()==3?this.Ji.fk().zi():this.Kd.zi()},f.prototype.gh=function(){if(!this.Wc())throw m.i.N("!isPannable()");var h=new m.l;return this.Kd.gh(h),h},f.prototype.Oe=function(){if(!this.Wc())throw m.i.N("!isPannable()");return this.Kd.so},f.prototype.HR=function(){if(!this.Wc())throw m.i.N("!isPannable()");var h=new m.l;return this.Kd.GR(h),h},f.prototype.pv=function(){if(!this.Wc())throw m.i.N("!isPannable()");return this.Kd.pv()},f.prototype.ov=function(){if(!this.Wc())throw m.i.N("!isPannable()");return this.Kd.ov()},f.prototype.Xr=function(){return this.Ji!=null?this.Ji.fk().Xr():this.Kd.Xr()},f.prototype.PQ=function(){return this.Kd.hv()},f.prototype.Qp=function(){return this.Eo.getUnitFactor()},f.prototype.vz=function(h){return this.Hq.vz(h)},f.prototype.sc=function(){var h=this.Sb();if(h==1)return this;if(h==3)return this.Ji.fk().sc();if(h==0||h===4)throw m.i.fa("invalid call");if(this.jw!==null)return this.jw;if((h=this.eh().getGeogcs())==null)throw m.i.Qa();return this.jw=f.bF(h,this.Hq.VF())},f.bF=function(h,l){if(h==null)throw m.i.N("null pointer.");var u=new f;return h=f.mu(h,!0),u.Hq.Xx(h,null,l),u.by(h),u.gy(null),u.dg=h.$r(),u},f.prototype.Sb=function(){var h=this.eh();if(h!=null)switch(h.getType()){case m.Sc.PE_TYPE_GEOGCS:return 1;case m.Sc.PE_TYPE_PROJCS:return 2}return 4},f.prototype.hv=function(){return this.Kd.hv()},f.mu=function(h,l){var u=h.getCode();if(0>=u&&0<(u=m.pf.getCode(h))){if((h=m.pf.coordsys(u))==null)throw m.i.N("Text to wkid mapping had failed: "+u);return f.mu(h,l)}if(l&&0=u?h:m.pf.coordsys(u),h=new m.OC(h),f.lK[l]=h,0=h)throw m.i.N("Invalid or unsupported wkid: "+h);var l=f.qx[h];if(l!=null)return l;if((l=m.pf.coordsys(h))==null)throw m.i.N("Invalid or unsupported wkid: "+h);return(l=f.mu(l,!1)).$r()!=h&&(f.qx[h]=l),l},f.kM=function(h){if(h==null||h===void 0||h.length==0)throw m.i.N("Cannot create SpatialReference from null or empty text.");var l=null;try{l=m.pf.fromString(m.Sc.PE_TYPE_COORDSYS,h)}catch(u){throw m.i.N("Cannot create SpatialReference from text. "+u.message)}if(l===null)throw m.i.N("Cannot create SpatialReference from text. ");return f.mu(l,!0)},f.bD=function(h,l){var u,d=h.getCode();if(0>=d&&0<(d=m.pf.getCode(h))){if((d=m.pf.vertcs(d))===null)throw m.i.N();return f.bD(d,l)}if(l&&0=d||(u=m.pf.vertcs(d)),u===null)throw m.i.N();return u=new m.PL(u),f.mK[h]=u,0l&&(this.Pj=l/(d-this.Fm)),u=this.Gm+u,(g=m.O.truncate((u-this.Gm)*this.Pj))>l&&(this.Pj=l/(u-this.Gm))}},h.prototype.aC=function(l){switch(l){case 0:this.Ik=void 0;case 1:this.Mq=void 0;case 2:this.Lq=void 0}},h.prototype.Kn=function(l){switch(l){case 0:return this.Ik;case 1:return this.Mq;case 2:return this.Lq}return 0},h.prototype.vz=function(l){if(this.Rm==D.FloatingPoint)return 0;switch(l){case 0:return 1/this.Pj;case 1:case 2:return 1/this.Fo;default:return 0}},h.prototype.toString=function(){var l="SRPD [m_toleranceXY: "+this.Ik.toString();return(l=(l=(l=(l=(l=(l=(l=(l=(l=l+";m_falseX: "+this.Fm.toString())+";m_falseY: "+this.Gm.toString())+";m_unitsXY: "+this.Pj.toString())+";m_falseZ: "+this.sA.toString())+";m_unitsZ: "+this.Fo.toString())+";m_falseM: "+this.rA.toString())+";m_toleranceZ: "+this.Mq.toString())+";m_toleranceM: "+this.Lq.toString())+";m_precision: "+this.Rm.toString())+"] "},h}();m.ZL=f}(re||(re={})),function(m){function D(d,g){return 89.99999g&&(g=-89.99999),g*=.017453292519943,[111319.49079327169*d,31890685e-1*Math.log((1+Math.sin(g))/(1-Math.sin(g)))]}function E(d,g,v){return d=d/6378137*57.29577951308232,v?[d,57.29577951308232*(1.5707963267948966-2*Math.atan(Math.exp(-1*g/6378137)))]:[d-360*Math.floor((d+180)/360),57.29577951308232*(1.5707963267948966-2*Math.atan(Math.exp(-1*g/6378137)))]}function f(d,g,v){var b=d.Of();if(d.getType()===33)g=g(b.Lg(),b.ih()),b.Cb(g[0],g[1]);else if(d.getType()===197){var T=g(d.es(),d.gs(),v);g=g(d.ds(),d.fs(),v),b.K(T[0],T[1],g[0],g[1])}else for(T=new m.h,d=0;dv&&(v=637.100877141506);for(var b,T=[],A=0;Athis.Hg&&this.Dz(f)},E.prototype.tx=function(f,h){f*=this.stride,h*=this.stride;for(var l=0;lthis.ns.va)return 1;g=d.na==d.la;var v=u.na==u.la;if(g||v){if(g&&v)return 0;if(d.na==u.na&&d.sa==u.sa)return g?1:-1;if(d.la==u.la&&d.pa==u.pa)return g?-1:1}return(g=d.Pe(this.yh,this.ms.oa))==(v=u.Pe(this.yh,this.ns.oa))&&((v=.5*((g=Math.min(d.la,u.la))+this.yh))==this.yh&&(v=g),g=d.Pe(v,this.ms.oa),v=u.Pe(v,this.ns.oa)),gv?1:0},l.prototype.aK=function(u){this.yh=u},l}(),h=function(){function l(u){this.ib=u,this.WH=new m.ig,this.Bf=new m.h,this.wA=new m.Nc}return l.prototype.kX=function(u){this.Bf.L(u)},l.prototype.compare=function(u,d){return this.ib.pB(u.ja(d),this.WH),u=this.WH.get(),this.wA.K(u.sa,u.pa),this.Bf.xthis.wA.va?1:(u=u.Pe(this.Bf.y,this.Bf.x),this.Bf.xu?1:0)},l}();D=function(){function l(){this.hH=this.Di=this.Gi=this.kA=this.Yn=this.ye=this.Kc=this.jh=this.ge=null,this.Go=this.xg=-1,this.gH=!0,this.pA=!1,this.lA=NaN,this.Ni=new m.Md,this.bO=2147483647,this.aO=m.O.truncate(-2147483648),this.cg=this.ae=this.Hl=this.Cq=this.Cm=this.Bq=this.Os=this.Re=-1,this.wa=0}return l.prototype.yy=function(u){this.lA=u},l.prototype.Ym=function(){this.ge==null&&(this.ge=new m.$c(8));var u=this.ge.Ce();return this.ge.S(u,1,0),u},l.prototype.vU=function(){this.Kc==null&&(this.Kc=new m.$c(8));var u=this.Kc.Ce();this.Kc.S(u,2,0),this.Kc.S(u,3,0);var d=this.Kc.Ce();return this.Kc.S(d,2,0),this.Kc.S(d,3,0),this.JJ(u,d),this.JJ(d,u),u},l.prototype.mI=function(){this.ye==null&&(this.ye=new m.$c(8));var u=this.ye.Ce();return this.ye.S(u,2,0),u},l.prototype.TW=function(u,d){this.ge.S(u,7,d)},l.prototype.mn=function(u,d){this.ge.S(u,2,d)},l.prototype.SW=function(u,d){this.ge.S(u,1,d)},l.prototype.lX=function(u,d){this.ge.S(u,3,d)},l.prototype.iX=function(u,d){this.ge.S(u,4,d)},l.prototype.cr=function(u,d){this.ge.S(u,5,d)},l.prototype.eR=function(u){return this.ge.T(u,5)},l.prototype.RW=function(u,d){this.ge.S(u,6,d)},l.prototype.cN=function(u,d){this.RW(d,u)},l.prototype.IJ=function(u,d){this.Kc.S(u,1,d)},l.prototype.JJ=function(u,d){this.Kc.S(u,4,d)},l.prototype.Tl=function(u,d){this.Kc.S(u,5,d)},l.prototype.Sl=function(u,d){this.Kc.S(u,6,d)},l.prototype.$W=function(u,d){this.Kc.S(u,2,d)},l.prototype.$w=function(u,d){this.Kc.S(u,3,d)},l.prototype.LF=function(u){return this.Kc.T(u,3)},l.prototype.Gt=function(u,d){this.Kc.S(u,7,d)},l.prototype.EK=function(u,d){if(this.mm(u)!=-1)for(d=d?-1:u,u=this.mm(u);u!=-1;u=this.js(u))this.g.Ra(this.tj(u),this.Cq,d)},l.prototype.yx=function(u,d){u!=-1&&(this.EK(u,d),this.EK(this.xa(u),d))},l.prototype.Dt=function(u,d){this.ye.S(u,1,d)},l.prototype.Vg=function(u,d){this.ye.S(u,2,d)},l.prototype.jn=function(u,d){this.ye.S(u,3,d),this.NW(u,this.dR(d)),this.MW(d,u)},l.prototype.MW=function(u,d){this.ye.S(u,4,d)},l.prototype.NW=function(u,d){this.ye.S(u,5,d)},l.prototype.DJ=function(u,d){this.ye.S(u,6,d)},l.prototype.BJ=function(u,d){this.ye.S(u,7,d)},l.prototype.AJ=function(u,d){this.Yn.write(u,d)},l.prototype.CJ=function(u,d){this.kA.write(u,d)},l.prototype.kY=function(u){var d=0,g=0,v=this.AF(u),b=new m.h,T=new m.h,A=new m.h;this.Yr(v,b),T.L(b);var O=v;do this.lm(O,A),g+=m.h.tb(T,A),this.$e(this.xa(O))!=u&&(d+=(A.x-b.x-(T.x-b.x))*(A.y-b.y+(T.y-b.y))*.5),T.L(A),O=this.jc(O);while(O!=v);this.Yn.write(u,d),this.kA.write(u,g)},l.prototype.PU=function(u,d){var g=new f(this),v=new m.Yj;v.De(m.O.truncate(this.wa/2)),v.Vo(g);for(var b=new m.ia(0),T=this.$g(),A=null,O=0,I=new m.h,L=this.Re;L!=-1;L=this.Rf(L)){if(!(255&++O)&&d!=null&&!d.progress(-1,-1))throw m.i.WC();var N=this.Me(L);if(N!=-1){if(b.Bh(0),!this.gY(v,T,b,N)){this.D(L,I),g.aK(I.y);var B=N;do{var H=this.Ab(B,T);H!=-1&&(v.vd(H,-1),this.Kb(B,T,-2)),B=this.jc(this.xa(B))}while(N!=B);B=N;do(H=this.Ab(B,T))==-1&&(H=v.addElement(B,-1),b.add(H)),B=this.jc(this.xa(B));while(N!=B)}for(N=b.size-1;0<=N;N--)H=b.get(N),B=v.ja(H),this.Kb(this.xa(B),T,H),this.OU(v,H,u)}else this.cz(L)==-1&&(A==null&&(A=new h(this)),this.D(L,I),A.kX(I),B=v.IW(A),N=this.Hl,B!=-1&&(H=v.ja(B),this.$e(H)==this.$e(this.xa(H))&&(H=this.OF(v,B)),H!=-1&&(N=this.$e(H))),this.cN(N,L))}this.Jg(T)},l.prototype.OU=function(u,d,g){var v=u.ja(d),b=this.$e(v);if(this.Gn(b)==-1){var T=this.OF(u,d),A=this.xa(v),O=this.$e(A);this.Kp(b),this.Kp(O);var I=this.Gn(b),L=this.Gn(O);if(T==-1&&I==-1&&(O==b?(this.jn(O,this.Hl),I=L=this.Hl):(L==-1&&(this.jn(O,this.Hl),L=this.Hl),this.jn(b,O),I=O)),T!=-1){var N=this.$e(T);L==-1&&(0>=this.Kp(N)?(L=this.Gn(N),this.jn(O,L)):(this.jn(O,N),L=N),O==b&&(I=L))}I==-1&&this.hY(b,O),g==0?this.jW(u,d,v,T,b,O):g==5?this.kW(u,d,v,A,b,O):g==4&&this.iW(v,T,b,O)}},l.prototype.jW=function(u,d,g,v,b,T){var A=this.hk(b);if(v!=-1){var O=this.hk(T),I=this.hk(this.$e(v));v=A&O&I,I^=I&this.dh(g),(I|=v)!=0&&(this.Vg(T,O|I),this.Vg(b,I|A),A=A||I)}for(d=u.lb(d);d!=-1&&(v=u.ja(d),g=this.$e(this.xa(v)),b=this.hk(g),T=this.dh(v),O=this.$e(v),v=b&(I=this.hk(O))&A,A^=A&T,(A|=v)!=0);d=u.lb(d))this.Vg(g,b|A),this.Vg(O,I|A)},l.prototype.kW=function(u,d,g,v,b,T){if(b!=T){g=this.Ab(g,this.cg),g+=this.Ab(v,this.cg),v=0;var A=new m.ia(0),O=new m.ia(0);O.add(0);for(var I=u.rc(-1);I!=d;I=u.lb(I)){var L=u.ja(I),N=this.xa(L),B=this.$e(L),H=this.$e(N);if(B!=H){if(L=this.Ab(L,this.cg),v+=L+=this.Ab(N,this.cg),N=!1,A.size!=0&&A.Fc()==H&&(O.If(),A.If(),N=!0),this.Gn(H)==-1)throw m.i.Qa();N&&this.Gn(H)==B||(O.add(v),A.add(B))}}v+=g,A.size!=0&&A.Fc()==T&&(O.If(),A.If()),v!=0?O.Fc()==0&&(u=this.g.ld,u=this.La(u),this.Vg(b,u)):O.Fc()!=0&&(u=this.g.ld,u=this.La(u),this.Vg(b,u))}},l.prototype.iW=function(u,d,g,v){var b=this.La(this.g.ld);if(d==-1)this.Vg(v,this.Go),1&(u=this.Ab(u,this.xg))?this.Vg(g,b):this.Vg(g,this.Go);else{var T=this.hk(v);T==0?(T=this.hk(this.$e(d)),this.Vg(v,T),1&(u=this.Ab(u,this.xg))?this.Vg(g,T==b?this.Go:b):this.Vg(g,T)):1&(u=this.Ab(u,this.xg))?this.Vg(g,T==b?this.Go:b):this.Vg(g,T)}},l.prototype.gY=function(u,d,g,v){var b=v,T=-1,A=-1,O=0;do{if(O==2)return!1;var I=this.Ab(b,d);if(I!=-1){if(T!=-1)return!1;T=I}else{if(A!=-1)return!1;A=b}O++,b=this.jc(this.xa(b))}while(v!=b);return A!=-1&&T!=-1&&(this.Kb(u.ja(T),d,-2),u.Sj(T,A),g.add(T),!0)},l.prototype.hY=function(u,d){var g=this.Kp(u);if(g!=0){var v=this.Kp(d);0v||0>g&&0L.compare(b)?I=1:T=-1,this.Kb(B,this.ae,0),this.Kb(N,this.ae,0),this.Kb(N,this.cg,I),this.Kb(B,this.cg,T)):u==7?(this.Kb(B,this.ae,this.Go),this.Kb(N,this.ae,O==1736?A:0)):u==4&&(this.Kb(B,this.ae,0),this.Kb(N,this.ae,0),this.Kb(N,this.xg,1),this.Kb(B,this.xg,1)),O=O==1736?this.aO:0,this.$w(N,A|O),this.$w(B,A|O)}}}}},l.prototype.VT=function(u,d){var g=this.mm(d);if(g!=-1){var v=this.mm(u);this.jh.S(g,1,v),this.Gt(u,g),this.Gt(d,-1)}u=this.xa(u),d=this.xa(d),(g=this.mm(d))!=-1&&(v=this.mm(u),this.jh.S(g,1,v),this.Gt(u,g),this.Gt(d,-1))},l.prototype.IX=function(u){function d(ye,me){return v.HO(ye,me)}var g=new m.ia(0);g.Jb(10);for(var v=this,b=this.Re;b!=-1;b=this.Rf(b)){g.clear(!1);var T=this.Me(b);if(T!=-1){var A=T;do g.add(A),A=this.jc(this.xa(A));while(A!=T);if(1h.Db())return E.ki(E.Xe(h.Ia()),f,"&")}return g=new E,v=(d=new m.gd).Ib(E.Xe(f)),h=d.Ib(E.Xe(h)),g.Ft(d,l,u),u=g.Av(v,h),f=E.ki(d.Ne(u),f,"&"),m.aa.Hc(f.getType())&&(f.Ch(2,l),f.getType()==1736&&f.fm()),f},E.bW=function(f,h,l){if(f.B()||h.B())return f.Ia();var u=[null],d=[0],g=h.Db()==2;if(h.Db()!=1&&h.Db()!=2)throw m.i.Qa();return u[0]=f.D(),g?m.hd.sK(h,u,1,l,d):m.hd.tK(h,u,1,l,d),d[0]==0?f.Ia():f},E.prototype.LU=function(f,h,l,u,d){if(f.B())return f;var g=new m.gd;return f=g.Ib(f),this.Mk(g,f,h,l,u,d)},E.prototype.NU=function(f,h,l,u,d,g){if(d&&f.ic(h)!=550){var v=new m.RC;v.TX(f,l),v.Ng?(m.Tk.V(f,l,g,!0),d=!1):this.j.yy(l)}else m.Tk.V(f,l,g,!0),d=!1;if(u&&f.ic(h)!=550?this.j.wJ(f,h,g):this.j.vJ(f,h,g),this.j.pA)return this.j.Ug(),this.j=null,this.Mk(f,h,l,u,!1,g);if(this.j.yy(NaN),g=this.j.La(h),this.bq(g+1),this.Gj[g]=!0,f.ic(h)==1736||u&&f.ic(h)!=550)return f.Yo(h,0),h=this.Ot(h,-1,-1),(f=f.Ne(h)).Yo(0),d?f.Ch(1,0):(f.Ch(2,l),f.fm()),f;if(f.ic(h)==1607)return h=this.Pt(-1),f=f.Ne(h),d||f.Ch(2,l),f;if(f.ic(h)==550)return h=this.mr(),f=f.Ne(h),d||f.Ch(2,l),f;throw m.i.Qa()},E.prototype.Mk=function(f,h,l,u,d,g){this.j=new m.iu;try{return this.NU(f,h,l,u,d,g)}finally{this.j.Ug()}},E.Mk=function(f,h,l,u,d){return new E().LU(f,h,l,u,d)},E.prototype.MU=function(f,h,l,u){this.Mv=f,this.j=new m.iu,f=h.In(l);var d=h.ic(l);if(f!=1||d==550?this.j.vJ(h,l,u):this.j.wJ(h,l,u),!this.j.pA)if(this.j.yy(NaN),u=this.j.La(l),this.bq(u+1),this.Gj[u]=!0,h.ic(l)==1736||f==1&&h.ic(l)!=550)h.Yo(l,0),u=this.Ot(l,-1,-1),h.hC(u,l),h.BB(u);else if(h.ic(l)==1607)u=this.Pt(-1),h.hC(u,l),h.BB(u);else{if(h.ic(l)!=550)throw m.i.fa("internal error");u=this.mr(),h.hC(u,l),h.BB(u)}},E.prototype.im=function(f,h){var l=m.aa.tf(this.j.g.ic(f)),u=m.aa.tf(this.j.g.ic(h));if(l>u)return f;var d=this.j.La(f),g=this.j.La(h);if(this.bq(1+(d|g)),this.Gj[this.j.La(f)]=!0,l==2&&u==2)return this.Ot(f,h,-1);if(l==1&&u==2||l==1&&u==1)return this.Pt(-1);if(l==0)return this.mr();throw m.i.Qa()},E.prototype.Av=function(f,h){var l=m.aa.tf(this.j.g.ic(f)),u=m.aa.tf(this.j.g.ic(h)),d=this.j.La(f),g=this.j.La(h);if(this.bq(1+(d|g)),this.Gj[this.j.La(f)|this.j.La(h)]=!0,d=-1,1h.Db())return E.ki(E.Xe(f),f,"-");var d=new m.l;f.A(d);var g=new m.l;if(h.A(g),!d.isIntersecting(g))return E.ki(E.Xe(f),f,"-");var v=new m.l;return v.K(d),v.Zb(g),l=m.ta.Wd(l,v,!0),g=new E,v=(d=new m.gd).Ib(E.Xe(f)),h=d.Ib(E.Xe(h)),g.Ft(d,l,u),u=g.im(v,h),u=d.Ne(u),f=E.ki(u,f,"-"),m.aa.Hc(f.getType())&&(f.Ch(2,l),f.getType()==1736&&f.fm()),f},E.VP=function(f,h,l){if(2>f.length)throw m.i.N("not enough geometries to dissolve");for(var u=0,d=0,g=f.length;dA?E.Xe(f[O]):(f=u==2,h=m.ta.Wd(u==0?h:null,v,!0),new E().Mk(b,T,h,f,!0,l))},E.Pz=function(f,h,l,u){var d=[null,null,null],g=new m.l;f.A(g);var v=new m.l;h.A(v);var b=new m.l;if(b.K(g),b.Zb(v),l=m.ta.Wd(l,b,!0),(b=new m.l).K(v),v=m.ta.Er(l),b.W(v,v),!g.isIntersecting(b)){if(f.Db()<=h.Db())return d[(f=E.ki(E.Xe(f.Ia()),f,"&")).Db()]=f,d;if(f.Db()>h.Db())return d[(f=E.ki(E.Xe(h.Ia()),f,"&")).Db()]=f,d}for(v=new E,b=(g=new m.gd).Ib(E.Xe(f)),h=g.Ib(E.Xe(h)),v.Ft(g,l,u),u=v.Pz(b,h),h=0;hh.Db())return E.ki(E.Xe(f),f,"^");if(f.Db()l;l++)h[l]=new m.h;f.nB(h),this.fY(h,h),f.Zw(h,4)}},E.prototype.fY=function(f,h){for(var l=0;l(h=.5*h.Sk())?Math.sqrt(u):Math.sqrt(h))},E.prototype.RB=function(){this.bb=1,this.jb=this.Gb=this.eb=0,this.ab=1,this.Lb=0},E.prototype.isIdentity=function(f){if(f!==void 0){var h=m.h.construct(0,1);return this.Eh(h,h),h.sub(m.h.construct(0,1)),h.Sk()>f*f?!1:(h.ma(0,0),this.Eh(h,h),!(h.Sk()>f*f)&&(h.ma(1,0),this.Eh(h,h),h.sub(m.h.construct(1,0)),h.Sk()<=f*f))}return this.bb==1&&this.ab==1&&this.eb==0&&this.Gb==0&&this.jb==0&&this.Lb==0},E.prototype.Bi=function(f){return Math.abs(this.bb*this.ab-this.jb*this.eb)<=2*f*(Math.abs(this.bb*this.ab)+Math.abs(this.jb*this.eb))},E.prototype.gg=function(f,h){this.bb=1,this.eb=0,this.Gb=f,this.jb=0,this.ab=1,this.Lb=h},E.prototype.setScale=function(f,h){h!==void 0?(this.bb=f,this.jb=this.Gb=this.eb=0,this.ab=h,this.Lb=0):this.setScale(f,f)},E.prototype.$B=function(){this.bb=0,this.eb=1,this.Gb=0,this.jb=1,this.Lb=this.ab=0},E.prototype.setRotate=function(f){this.pX(Math.cos(f),Math.sin(f))},E.prototype.pX=function(f,h){this.bb=f,this.eb=-h,this.Gb=0,this.jb=h,this.ab=f,this.Lb=0},E.prototype.shift=function(f,h){this.Gb+=f,this.Lb+=h},E.prototype.scale=function(f,h){this.bb*=f,this.eb*=f,this.Gb*=f,this.jb*=h,this.ab*=h,this.Lb*=h},E.prototype.flipX=function(f,h){this.bb=-this.bb,this.eb=-this.eb,this.Gb=f+h-this.Gb},E.prototype.flipY=function(f,h){this.jb=-this.jb,this.ab=-this.ab,this.Lb=f+h-this.Lb},E.prototype.rotate=function(f){var h=new E;h.setRotate(f),this.multiply(h)},E.prototype.inverse=function(f){if(f!==void 0){var h=this.bb*this.ab-this.eb*this.jb;h==0?f.lx():(h=1/h,f.Gb=(this.eb*this.Lb-this.Gb*this.ab)*h,f.Lb=(this.Gb*this.jb-this.bb*this.Lb)*h,f.bb=this.ab*h,f.eb=-this.eb*h,f.jb=-this.jb*h,f.ab=this.bb*h)}else this.inverse(this)},E}();m.Dd=D}(re||(re={})),function(m){var D=function(){function E(){}return E.prototype.lx=function(){this.hg=this.Lb=this.Gb=this.He=this.Fe=this.Ee=this.Ge=this.ab=this.eb=this.Ze=this.jb=this.bb=0},E.prototype.setScale=function(f,h,l){this.bb=f,this.eb=this.Ze=this.jb=0,this.ab=h,this.Fe=this.Ee=this.Ge=0,this.He=l,this.hg=this.Lb=this.Gb=0},E.prototype.setTranslate=function(f,h,l){this.bb=1,this.eb=this.Ze=this.jb=0,this.ab=1,this.Fe=this.Ee=this.Ge=0,this.He=1,this.Gb=f,this.Lb=h,this.hg=l},E.prototype.translate=function(f,h,l){this.Gb+=f,this.Lb+=h,this.hg+=l},E.prototype.mC=function(f){if(!f.B()){for(var h=new m.Nd[8],l=0;8>l;l++)h[l]=new m.Nd;f.nB(h),this.transform(h,8,h),f.Zw(h)}},E.prototype.transform=function(f,h,l){for(var u=0;uu;u++)l.uh[u]=-1;l.uh[l.bg[0]]=0}return l.jq=!0,l}return Ke(h,f),h.prototype.re=function(l){this.hasAttribute(l)||(this.uh[l]=0,this.jD())},h.prototype.removeAttribute=function(l){if(l==0)throw m.i.N("Position attribue cannot be removed");this.hasAttribute(l)&&(this.uh[l]=-1,this.jD())},h.prototype.reset=function(){this.bg[0]=0,this.Aa=1;for(var l=0;ll;l++)0<=this.uh[l]&&(this.bg[u]=l,this.uh[l]=u,u++,this.Aa++);this.jq=!0},h.prototype.cc=function(){return this.jq&&(this.wl=this.An(),this.jq=!1),this.wl},h.prototype.Nb=function(l){if(l==null)return!1;if(l==this)return!0;if(!(l instanceof h)||l.Aa!=this.Aa)return!1;for(var u=0;ug;g++)!l.hasAttribute(g)&&u.hasAttribute(g)&&(d==null&&(d=new h(l)),d.re(g));return d!=null?d.EF():l},h}(m.ra);m.ee=D;var E=function(){function f(){this.map=[];var h=new D;this.add(h),(h=new D).re(1),this.add(h)}return f.kz=function(){return f.bL},f.prototype.$R=function(){return f.ft},f.prototype.add=function(h){var l=h.cc();if(f.ft!=null&&f.ft.cc()==l&&h.GG(f.ft))return f.ft;if(f.Dw!=null&&f.Dw.cc()==l&&h.GG(f.Dw))return f.Dw;var u=null;return this.map[l]!==void 0&&(u=this.map[l]),u==null&&((u=h.tM()).Aa==1?f.ft=u:u.Aa==2&&u.kd(1)==1?f.Dw=u:this.map[l]=u),u},f.bL=new f,f}()}(re||(re={}));var mi={feet:9002,kilometers:9036,meters:9001,miles:9093,"nautical-miles":9030,yards:9096},Dr={acres:109402,ares:109463,hectares:109401,"square-feet":109405,"square-kilometers":109414,"square-meters":109404,"square-miles":109439,"square-yards":109442},Nr=new(function(){function m(){this.RM=50,this.np=new Map,this.gj=[]}return m.prototype.clear=function(){this.gj.length=0,this.np.clear()},m.prototype.delete=function(D){return!!this.np.delete(D)&&(this.gj.splice(this.gj.indexOf(D),1),!0)},m.prototype.get=function(D){var E=this.np.get(D);if(E!==void 0)return this.gj[0]!==D&&(this.gj.splice(this.gj.indexOf(D),1),this.gj.unshift(D)),E},m.prototype.has=function(D){return this.np.has(D)},m.prototype.set=function(D,E){return this.get(D)!==void 0&&this.delete(D),this.gj.unshift(D),this.np.set(D,E),this.oM(),this},m.prototype.oM=function(){for(;this.gj.length&&this.gj.length>this.RM;){var D=this.gj.pop();this.np.delete(D)}},m}()),Ze=((Tt={}).convertJSONToGeometry=function(m){return re.$b.fP(m)},Tt.hasM=function(m){return m.hasAttribute(re.Ih.M)},Tt.hasZ=function(m){return m.hasAttribute(re.Ih.Z)},Tt.getPointX=function(m){return m.Lg()},Tt.getPointY=function(m){return m.ih()},Tt.getPointZ=function(m){return m.bS()},Tt.getPointM=function(m){return m.zR()},Tt.getXMin=function(m){return m.es()},Tt.getYMin=function(m){return m.gs()},Tt.getXMax=function(m){return m.ds()},Tt.getYMax=function(m){return m.fs()},Tt.getZExtent=function(m){return m.Tg(re.Ih.Z,0)},Tt.getMExtent=function(m){return m.Tg(re.Ih.M,0)},Tt.exportPaths=function(m){var D=[],E=m.da(),f=null,h=null,l=m.hasAttribute(re.Ih.Z),u=m.hasAttribute(re.Ih.M);l&&(f=m.ub(re.Ih.Z)),u&&(h=m.ub(re.Ih.M));for(var d=new re.h,g=0;gnew JG({placeholder:"Search address",getSuggestions:async t=>{const e=t.suggestTerm,i=`${Fxe}?address=${encodeURIComponent(e)}`;return(await yi(i,{responseType:"json"})).data.addresses.map(n=>({text:n.pikkaadress,magicKey:n.unik}))},getResults:async t=>{const e=t.suggestResult.text,i=`${Fxe}?address=${encodeURIComponent(e)}`;return(await yi(i,{responseType:"json"})).data.addresses.map(s=>{const o=new Ma({geometry:new mt({x:s.viitepunkt_l,y:s.viitepunkt_b})});return{extent:EBe(o.geometry,30,"meters").extent,feature:o,name:`${s.pikkaadress}`}})}}),ljt=(t,e)=>new dBt({view:t,sources:[e],includeDefaultSources:!1,container:"in-ads-container"});function LX(t){switch(t){case Zn.SUPPORTED:break;case Zn.GRAPHICS_LAYER_MISSING:return"not owned by a graphics layer";case Zn.GEOMETRY_MISSING:return"no geometry";case Zn.GEOMETRY_TYPE_UNSUPPORTED:return"the geometry type is not supported";case Zn.ELEVATION_MODE_UNSUPPORTED:return"the elevation mode is not supported";case Zn.SYMBOL_TYPE_UNSUPPORTED:return"the symbol type is not supported"}return""}var Zn;(function(t){t[t.SUPPORTED=0]="SUPPORTED",t[t.GRAPHICS_LAYER_MISSING=1]="GRAPHICS_LAYER_MISSING",t[t.GEOMETRY_MISSING=2]="GEOMETRY_MISSING",t[t.GEOMETRY_TYPE_UNSUPPORTED=3]="GEOMETRY_TYPE_UNSUPPORTED",t[t.ELEVATION_MODE_UNSUPPORTED=4]="ELEVATION_MODE_UNSUPPORTED",t[t.SYMBOL_TYPE_UNSUPPORTED=5]="SYMBOL_TYPE_UNSUPPORTED"})(Zn||(Zn={}));function cjt(t){var e;if(((e=t.layer)==null?void 0:e.type)!=="graphics")return Zn.GRAPHICS_LAYER_MISSING;if(t.geometry==null)return Zn.GEOMETRY_MISSING;switch(t.geometry.type){case"polygon":case"point":case"polyline":case"mesh":break;default:return Zn.GEOMETRY_TYPE_UNSUPPORTED}return aj(t)!=="on-the-ground"&&lj(t)?Zn.ELEVATION_MODE_UNSUPPORTED:Zn.SUPPORTED}function CBe(t){if(!t)return null;if(cB(t)&&t.wkid){const i=fnt[t.wkid];if(i)return i}const e=t.wkt2||t.wkt;if(e){const i=ujt(e);if(i)return i}return null}function ujt(t){const e=dnt.exec(t);if(!e||e.length!==2)return null;const i=e[1].split(",");if(!i||i.length<3)return null;const r=parseFloat(i[1]),n=parseFloat(i[2]);return isNaN(r)||isNaN(n)?null:{a:r,f:n===0?0:1/n}}function KG(t){const e=CBe(t??rt.WGS84);if(hjt(e))return e;const i=e.a*(1-e.f);return Object.assign(e,{b:i,eSq:1-(i/e.a)**2,radius:(2*e.a+i)/3,densificationRatio:1e4/((2*e.a+i)/3)})}function hjt(t){return t!=null&&"b"in t&&"eSq"in t&&"radius"in t}function i7(t,e,i){const{a:r,eSq:n}=KG(i),s=Math.sqrt(n),o=Math.sin(e[1]*Vh),a=r*e[0]*Vh;let c;return n>0?c=r*((1-n)*(o/(1-n*(o*o))-1/(2*s)*Math.log((1-s*o)/(1+s*o))))*.5:c=r*o,t[0]=a,t[1]=c,t}function QG(t){return CBe(t)!==null}function Dyi(t,e="square-meters"){if(t.some(o=>!QG(o.spatialReference)))throw new se("geodesic-areas:invalid-spatial-reference","the input geometries spatial reference is not supported");const i=[];for(let o=0;o!QG(r.spatialReference)))throw new se("geodesic-lengths:invalid-spatial-reference","the input geometries spatial reference is not supported");const i=[];for(let r=0;r1){for(let z=1;z<=F-1;z++)VO(s,M,P,z*e,i),c.push(s.slice(0));VO(s,M,P,($+Math.floor(F-1)*e)/2,i),c.push(s.slice(0))}VO(s,M,P,$,i),c.push(s.slice(0)),x=s[0],S=s[1]}}return t.type==="polyline"?new Tc({paths:n,spatialReference:i}):new tl({rings:n,spatialReference:i})}let ABe=class{constructor(e=0,i=void 0,r=void 0){this.distance=e,this.azimuth=i,this.reverseAzimuth=r}};function VO(t,e,i,r,n){const s=e[0],o=e[1],a=s*Vh,c=o*Vh,p=(i??0)*Vh,{a:_,b:x,f:S}=KG(n),C=Math.sin(p),M=Math.cos(p),P=(1-S)*Math.tan(c),$=1/Math.sqrt(1+P*P),F=P*$,z=Math.atan2(P,M),k=$*C,U=k*k,j=1-U,G=j*(_*_-x*x)/(x*x),Y=1+G/16384*(4096+G*(G*(320-175*G)-768)),Q=G/1024*(256+G*(G*(74-47*G)-128));let ne,ie,he,ce,ve=r/(x*Y),ge=2*Math.PI;for(;Math.abs(ve-ge)>1e-12;)he=Math.cos(2*z+ve),ne=Math.sin(ve),ie=Math.cos(ve),ce=Q*ne*(he+Q/4*(ie*(2*he*he-1)-Q/6*he*(4*ne*ne-3)*(4*he*he-3))),ge=ve,ve=r/(x*Y)+ce;const pe=F*ne-$*ie*M,Ee=Math.atan2(F*ie+$*ne*M,(1-S)*Math.sqrt(U+pe*pe)),te=Math.atan2(ne*C,$*ie-F*ne*M),le=S/16*j*(4+S*(4-3*j)),de=Ee/Vh,be=(a+(te-(1-le)*S*k*(ve+le*ne*(he+le*ie*(2*he*he-1)))))/Vh;return t[0]=be,t[1]=de,t}function Fue(t,e,i,r){const n=e[0]*Vh,s=e[1]*Vh,o=i[0]*Vh,a=i[1]*Vh,{a:c,b:p,f:_,radius:x}=KG(r),S=o-n,C=Math.atan((1-_)*Math.tan(s)),M=Math.atan((1-_)*Math.tan(a)),P=Math.sin(C),$=Math.cos(C),F=Math.sin(M),z=Math.cos(M);let k,U,j,G,Y,Q,ne,ie,he,ce,ve=1e3,ge=S;do{if(ne=Math.sin(ge),ie=Math.cos(ge),j=Math.sqrt(z*ne*(z*ne)+($*F-P*z*ie)*($*F-P*z*ie)),j===0)return t.distance=0,t.azimuth=void 0,t.reverseAzimuth=void 0,t;Y=P*F+$*z*ie,Q=Math.atan2(j,Y),he=$*z*ne/j,U=1-he*he,G=Y-2*P*F/U,isNaN(G)&&(G=0),ce=_/16*U*(4+_*(4-3*U)),k=ge,ge=S+(1-ce)*_*he*(Q+ce*j*(G+ce*Y*(2*G*G-1)))}while(Math.abs(ge-k)>1e-12&&--ve>0);if(ve===0){const be=x,Se=Math.acos(Math.sin(s)*Math.sin(a)+Math.cos(s)*Math.cos(a)*Math.cos(o-n))*be,Ae=o-n,Re=Math.sin(Ae)*Math.cos(a),Ge=Math.cos(s)*Math.sin(a)-Math.sin(s)*Math.cos(a)*Math.cos(Ae),ut=Math.atan2(Re,Ge);return t.azimuth=ut/Vh,t.distance=Se,t.reverseAzimuth=void 0,t}const pe=U*(c*c-p*p)/(p*p),Ee=pe/1024*(256+pe*(pe*(74-47*pe)-128)),te=p*(1+pe/16384*(4096+pe*(pe*(320-175*pe)-768)))*(Q-Ee*j*(G+Ee/4*(Y*(2*G*G-1)-Ee/6*G*(4*j*j-3)*(4*G*G-3)))),le=Math.atan2(z*Math.sin(ge),$*F-P*z*Math.cos(ge)),de=Math.atan2($*Math.sin(ge),$*F*Math.cos(ge)-P*z);return t.azimuth=le/Vh,t.distance=te,t.reverseAzimuth=de/Vh,t}var Ure;let Ew=Ure=class extends tl{constructor(...t){super(...t),this.center=null,this.geodesic=!1,this.numberOfPoints=60,this.radius=1e3,this.radiusUnit="meters"}normalizeCtorArgs(t,e){let i;if(t!=null&&t.center)i=t;else{if(t!=null&&t.rings)return super.normalizeCtorArgs(t,e);i={center:t}}return{...super.normalizeCtorArgs(),...i,...e}}initialize(){const t=this.center,e=this.numberOfPoints;if(this.hasZ=(t==null?void 0:t.hasZ)??!1,this.rings.length!==0||!t)return;const i=Ur(this.radius,this.radiusUnit,"meters"),r=t.spatialReference;let n,s="geographic";if(r.isWebMercator?s="webMercator":((r.wkid&&ae[r.wkid])!=null||(r.wkt2||r.wkt)&&Yne(r.wkt2||r.wkt))&&(s="projected"),this.geodesic){let o;switch(s){case"webMercator":o=XS(t);break;case"projected":console.error("Creating a geodesic circle requires the center to be specified in web mercator or geographic coordinate system");break;case"geographic":o=t}n=this._createGeodesicCircle(o,i,e),s==="webMercator"&&(n=Py(n))}else{let o;s==="webMercator"||s==="projected"?o=i/lEe(t.spatialReference):s==="geographic"&&(o=sEe(i,"meters",Tr(t.spatialReference).radius)),n=this._createPlanarCircle(t,o,e)}this.spatialReference=n.spatialReference,this.addRing(n.rings[0])}clone(){const{center:t,numberOfPoints:e,radius:i,radiusUnit:r,geodesic:n}=this;return new Ure({center:t==null?void 0:t.clone(),numberOfPoints:e,radius:i,radiusUnit:r,geodesic:n})}_createGeodesicCircle(t,e,i){let r=0;const n=[];for(;r<360;){const s=[0,0],o=[t.x,t.y];VO(s,o,r,e),this.hasZ&&s.push(t.z),n.push(s),r+=360/i}return n.push(n[0]),new tl(n)}_createPlanarCircle(t,e,i){const r=[],n=2*Math.PI/i;for(let s=0;sr.type==="object")?Zn.SYMBOL_TYPE_UNSUPPORTED:aj(t)!=="on-the-ground"&&lj(t)?Zn.ELEVATION_MODE_UNSUPPORTED:Zn.SUPPORTED}function kxe(t,e,i){if(!e||!(t!=null&&t.map))return;const{map:r}=t,n=r.layers.find(s=>s===e);n||r.add(e,i),n&&i!=null&&r.layers.reorder(n,i)}function kyi(t,e){const i=(e==null?void 0:e.type)==="subtype-sublayer"?e.parent:e;return t.allLayerViews.find(r=>{const n=r.layer;return n===i||"sublayers"in n&&n.sublayers!=null&&n.sublayers.includes(i)})}const Ra={redo:"r",undo:"z",center:"Alt",constraint:"Shift",cancel:"Escape",delete:["Backspace","Delete"],complete:"Enter",vertexAdd:"f",pan:" "},zxe={toggle:"Control"},zyi={enterInputMode:"Tab",commit:"Enter",discard:"Escape",next:"Tab"};let Gk=class extends ze{constructor(e){super(e),this.enabled=!1}};y([w({type:Boolean,nonNullable:!0})],Gk.prototype,"enabled",void 0),Gk=y([Z("esri.views.interactive.sketch.SketchLabelOptions")],Gk);const OBe=Gk;let aL=class extends ze{constructor(e){super(e),this.mode="absolute-height"}toJSON(){return{mode:this.mode}}};y([w({type:String,nonNullable:!0})],aL.prototype,"mode",void 0),aL=y([Z("esri.widgets.Sketch.SketchTooltipOptions.ElevationOptions")],aL);let Ih=class extends ze{constructor(e){super(e),this.area=!0,this.distance=!0,this.elevation=!0,this.helpMessage=!1,this.orientation=!0,this.radius=!0,this.rotation=!0,this.scale=!0,this.size=!0,this.totalLength=!0}toJSON(){return{area:this.area,distance:this.distance,elevation:this.elevation,helpMessage:this.helpMessage,orientation:this.orientation,radius:this.radius,rotation:this.rotation,scale:this.scale,size:this.size,totalLength:this.totalLength}}};y([w({type:Boolean,nonNullable:!0})],Ih.prototype,"area",void 0),y([w({type:Boolean,nonNullable:!0})],Ih.prototype,"distance",void 0),y([w({type:Boolean,nonNullable:!0})],Ih.prototype,"elevation",void 0),y([w({type:Boolean,nonNullable:!0})],Ih.prototype,"helpMessage",void 0),y([w({type:Boolean,nonNullable:!0})],Ih.prototype,"orientation",void 0),y([w({type:Boolean,nonNullable:!0})],Ih.prototype,"radius",void 0),y([w({type:Boolean,nonNullable:!0})],Ih.prototype,"rotation",void 0),y([w({type:Boolean,nonNullable:!0})],Ih.prototype,"scale",void 0),y([w({type:Boolean,nonNullable:!0})],Ih.prototype,"size",void 0),y([w({type:Boolean,nonNullable:!0})],Ih.prototype,"totalLength",void 0),Ih=y([Z("esri.widgets.Sketch.SketchTooltipOptions.VisibleElements")],Ih);let Cw=class extends ze{constructor(e){super(e),this.enabled=!1,this.inputEnabled=!1,this.elevation=new aL,this.visibleElements=new Ih,this.visualVariables=null}toJSON(){return{enabled:this.enabled,elevation:this.elevation,visibleElements:this.visibleElements}}};y([w({type:Boolean,nonNullable:!0})],Cw.prototype,"enabled",void 0),y([w({type:Boolean,nonNullable:!0})],Cw.prototype,"inputEnabled",void 0),y([w({type:aL,nonNullable:!0})],Cw.prototype,"elevation",void 0),y([w({type:Ih,nonNullable:!0})],Cw.prototype,"visibleElements",void 0),y([w()],Cw.prototype,"visualVariables",void 0),Cw=y([Z("esri.widgets.Sketch.SketchTooltipOptions")],Cw);const PBe=Cw;function Gyi(t,e,i){return st(t,e,i)}function Hyi(t){return t}function nx(t,e,i){return st(t,e,i)}function YP(t){return Xr(t)}function oo(t,e,{coordinateHelper:i,elevationInfo:r}){return t?q4(i.vectorToDehydratedPoint(t,gjt),e,r):null}function q4(t,e,i){if(t==null)return null;if(e==null)return st(t.x,t.y,t.z??0);if(e.type==="2d")return st(t.x,t.y,0);const r=WPe(e,t,i,ga)??0;return st(t.x,t.y,r)}function qyi(t,e){return Ju(t[0],t[1],t[2],e)}const gjt=Ju(0,0,0,null);let Tm=class extends Ue{constructor(){super(...arguments),this.enabled=!0}};y([w({type:Boolean})],Tm.prototype,"enabled",void 0),Tm=y([Z("esri.views.interactive.snapping.Settings.DefaultSnappingAlgorithm")],Tm);let Js=class extends Ue{constructor(e){super(e),this.lineSnapper=new Tm,this.parallelLineSnapper=new Tm,this.rightAngleSnapper=new Tm,this.rightAngleTriangleSnapper=new Tm,this.shortLineThreshold=15,this.distance=5,this.pointThreshold=1e-6,this.intersectionParallelLineThreshold=1e-6,this.parallelLineThreshold=1e-6,this.verticalLineThreshold=.1,this.touchSensitivityMultiplier=1.5,this.pointOnLineThreshold=1e-6,this.orange=new qe([255,127,0]),this.orangeTransparent=new qe([255,127,0,.5]),this.lineHintWidthReference=3,this.lineHintWidthTarget=3,this.lineHintFadedExtensions=.3,this.parallelLineHintWidth=2,this.parallelLineHintLength=24,this.parallelLineHintOffset=1.5,this.rightAngleHintSize=24,this.rightAngleHintOutlineSize=1.5,this.satisfiesConstraintScreenThreshold=1}};y([w({type:Tm,constructOnly:!0,nonNullable:!0,json:{write:!0}})],Js.prototype,"lineSnapper",void 0),y([w({type:Tm,constructOnly:!0,nonNullable:!0,json:{write:!0}})],Js.prototype,"parallelLineSnapper",void 0),y([w({type:Tm,constructOnly:!0,nonNullable:!0,json:{write:!0}})],Js.prototype,"rightAngleSnapper",void 0),y([w({type:Tm,constructOnly:!0,nonNullable:!0,json:{write:!0}})],Js.prototype,"rightAngleTriangleSnapper",void 0),y([w({type:Number,nonNullable:!0,range:{min:-1,max:50,step:1},json:{write:!0}})],Js.prototype,"shortLineThreshold",void 0),y([w({type:Number,nonNullable:!0,range:{min:-1,max:50,step:1},json:{write:!0}})],Js.prototype,"distance",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1e-5},json:{write:!0}})],Js.prototype,"pointThreshold",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1e-5},json:{write:!0}})],Js.prototype,"intersectionParallelLineThreshold",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1e-5},json:{write:!0}})],Js.prototype,"parallelLineThreshold",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],Js.prototype,"verticalLineThreshold",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:10},json:{write:!0}})],Js.prototype,"touchSensitivityMultiplier",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1e-5},json:{write:!0}})],Js.prototype,"pointOnLineThreshold",void 0),y([w({type:qe,nonNullable:!0})],Js.prototype,"orange",void 0),y([w({type:qe,nonNullable:!0})],Js.prototype,"orangeTransparent",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:10},json:{write:!0}})],Js.prototype,"lineHintWidthReference",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:10},json:{write:!0}})],Js.prototype,"lineHintWidthTarget",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:1},json:{write:!0}})],Js.prototype,"lineHintFadedExtensions",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:10},json:{write:!0}})],Js.prototype,"parallelLineHintWidth",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:50},json:{write:!0}})],Js.prototype,"parallelLineHintLength",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:5},json:{write:!0}})],Js.prototype,"parallelLineHintOffset",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:46},json:{write:!0}})],Js.prototype,"rightAngleHintSize",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:6},json:{write:!0}})],Js.prototype,"rightAngleHintOutlineSize",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:5},json:{write:!0}})],Js.prototype,"satisfiesConstraintScreenThreshold",void 0),Js=y([Z("esri.views.interactive.snapping.Settings.Defaults")],Js);const f_=new Js;var Xl;(function(t){t[t.FEATURE=1]="FEATURE",t[t.SELF=2]="SELF",t[t.ALL=3]="ALL"})(Xl||(Xl={}));function DX(t,e){return t[0]*e[1]-t[1]*e[0]}function yjt(t,e,i){const r=fs(i,e)/t1(i);return qu(t,i,r)}function NX(t,e,i,r,n=i){return Rs(RT,r,i),Rs(jV,e,n),yjt(XP,jV,RT),yf(t,n,XP)}function vjt(t,e,i,r){Rs(RT,e,i);const n=r/Y9(RT);return Ff(t,i,RT,n)}function Xyi(t,e){const i=t.start,r=t.end,n=e.start,s=e.end,o=Rs(RT,r,i),a=Rs(RBe,s,n),c=DX(o,a);if(Math.abs(c)<=bjt)return[];const p=Rs(jV,i,n),_=DX(a,p)/c,x=DX(o,p)/c;if(_>=0){if(x>=0||e.type===co.LINE)return[Ff(XP,i,o,_)]}else if(t.type===co.LINE&&(x>=0||e.type===co.LINE))return[Ff(XP,i,o,_)];return[]}function _jt(t,e,i){const r=[],n=Rs(RT,t.end,t.start),s=Rs(RBe,t.start,e),o=t1(n),a=2*fs(n,s),c=a*a-4*o*(t1(s)-i*i);if(c===0){const p=-a/(2*o);(t.type===co.LINE||p>=0)&&r.push(Ff(XP,t.start,n,p))}else if(c>0){const p=Math.sqrt(c),_=(-a+p)/(2*o);(t.type===co.LINE||_>=0)&&r.push(Ff(XP,t.start,n,_));const x=(-a-p)/(2*o);(t.type===co.LINE||x>=0)&&r.push(Ff(jV,t.start,n,x))}return r}var co;(function(t){t[t.RAY=0]="RAY",t[t.LINE=1]="LINE"})(co||(co={}));const bjt=1e-6,RT=yt(),RBe=yt(),jV=yt(),XP=yt();function kue({start:t,end:e,type:i},r,n){const s=[],o=Rs(NE,e,t),a=Rs(k5,t,r),c=t1(o),p=2*fs(o,a),_=p*p-4*c*(t1(a)-n*n);if(_===0){const x=-p/(2*c);(i===Tp.PLANE||x>=0)&&s.push(Ff(yt(),t,o,x))}else if(_>0){const x=Math.sqrt(_),S=(-p+x)/(2*c);(i===Tp.PLANE||S>=0)&&s.push(Ff(yt(),t,o,S));const C=(-p-x)/(2*c);(i===Tp.PLANE||C>=0)&&s.push(Ff(yt(),t,o,C))}return s}function IBe(t,e){const i=t.start,r=t.end,n=Rs(NE,r,i),s=Ie(k5,-n[1],n[0],0),o=e.start,a=e.end,c=Sn(Vue,a,o),p=Ve(c,s),_=Ie(VBe,i[0],i[1],0),x=Sn(BBe,_,o),S=Ve(x,s);if(Math.abs(p){const t=W(),e=W(),i=W();return({start:r,end:n},{center:s,radius:o,normal:a,slicePlane:c})=>{const p=W(),_=G_(s,a,Cjt);if(Co(OQ(_,r),0)&&Co(OQ(_,n),0)){D5e(a,t,e);const x=(M,P)=>(je(i,P,s),or(M,Ve(i,t),Ve(i,e)),M),S=_jt({start:x(UBe,r),end:x(Ejt,n),type:co.LINE},e1,o),C=[];for(const[M,P]of S){const $=Ne(W(),s);lo($,$,t,M),lo($,$,e,P),c&&!O2(c,$)||C.push($)}return C}return F5e(_,r,n,p)?!Co(Tn(p,s),o)||c&&!O2(c,p)?[]:[p]:[]}})();function FBe({start:t,end:e,type:i},r,n){const s=[],o=je(NE,e,t),a=Rs(k5,t,r),c=t1(o),p=2*fs(o,a),_=p*p-4*c*(t1(a)-n*n);if(_===0){const x=-p/(2*c);(i===co.LINE||x>=0)&&s.push(lo(W(),t,o,x))}else if(_>0){const x=Math.sqrt(_),S=(-p+x)/(2*c);(i===co.LINE||S>=0)&&s.push(lo(W(),t,o,S));const C=(-p-x)/(2*c);(i===co.LINE||C>=0)&&s.push(lo(W(),t,o,C))}return s}function kBe(t,e){const i=t.start,r=t.end,n=e.start,s=e.end,o=Sn(NE,r,i),a=Sn(k5,s,n),c=Sn(Vue,n,i),p=Wt(VBe,o,a),_=Ve(c,p);if(!Ry(_,0,Cy))return[];const x=QO(p);if(Ry(x,0,Cy))return[];const S=Wt(BBe,c,a),C=Ve(S,p)/x,M=lo(jBe,i,o,C);if(t.type===co.RAY){const P=Sn(HV,M,i);if(Ve(o,P)<-Cy)return[]}if(e.type===co.RAY){const P=Sn(HV,M,n);if(Ve(a,P)<-Cy)return[]}return[Xr(M)]}function xjt({start:t,end:e,type:i},r){const n=Sn(NE,r,t),s=Sn(k5,e,t),o=Wt(Vue,s,n);if(QO(o)/QO(s)e+r)return[];if(xO2(t,i))}function O2(t,e){return Xoe(t,e)}var Tp;(function(t){t[t.PLANE=0]="PLANE",t[t.HALF_PLANE=1]="HALF_PLANE"})(Tp||(Tp={}));const Tjt={[Tp.PLANE]:co.LINE,[Tp.HALF_PLANE]:co.RAY},Cy=1e-6,UBe=yt(),Ejt=yt(),NE=W(),k5=W(),Vue=W(),VBe=W(),BBe=W(),jBe=W(),HV=W(),Cjt=Fi(),Bue={start:W(),end:W(),type:co.LINE},Ajt={start:W(),end:W(),type:co.LINE};class x1{intersect(e){return _v(this,e)}closestPoints(e){return[this.closestTo(e)]}}class z5 extends x1{constructor(e){super(),this.point=e}equals(e){return this===e||iy(e)&&jr(this.point,e.point)}closestTo(){return YP(this.point)}}class jue extends x1{constructor(e,i,r){super(),this.start=e,this.end=i,this.lineLike={start:e,end:i,type:r}}equals(e){return this===e||ry(e)&&this.lineLike.type===e.lineLike.type&&jr(this.start,e.start)&&jr(this.end,e.end)}closestTo(e){const i=zue(e,this.lineLike);return i}}let Gue=class extends jue{constructor(e,i){super(e,i,co.LINE)}},Mjt=class extends jue{constructor(e,i){super(e,i,co.RAY)}};class GBe extends x1{constructor(e){super(),this.constraints=e}equals(e){return this===e||Vre(e)&&jy(this.constraints,e.constraints,(i,r)=>i.equals(r))}closestTo(e){let i,r=1/0;for(const n of this.constraints){const s=n.closestTo(e),o=Ao(e,s);oi===this?[]:i.closestPoints(e))}}class HBe extends x1{constructor(e,i){super(),this.center=e,this.radius=i}equals(e){return this===e||sy(e)&&this.center[0]===e.center[0]&&this.center[1]===e.center[1]&&this.radius===e.radius}closestTo(e){const i=DBe(e,this.center,this.radius);return i}}let Hue=class extends x1{constructor(e,i){super(),this.center=e,this.radius=i}equals(e){return this===e||wv(e)&&jr(this.center,e.center)&&this.radius===e.radius}closestTo(e){const i=DBe(e,this.center,this.radius);return i[2]=this.center[2],i}asCircle(){return new que(YP(this.center),this.radius,nx(0,0,1))}};class que extends x1{constructor(e,i,r,n=void 0){super(),this.center=e,this.radius=i,this.normal=r,this.slicePlane=n}equals(e){return this===e||Aw(e)&&jr(this.center,e.center)&&jr(this.normal,e.normal)&&this.radius===e.radius}closestTo(e){const{center:i,radius:r}=this;Zoe(this.getPlane(Ojt),e,FX);const n=Sn(FX,FX,i),s=Al(n);if(Co(s,0))return YP(e);const o=r/Math.sqrt(s),a=lo(W(),i,n,o),{slicePlane:c}=this;if(c&&!O2(c,a)){const p=Yue(c,this);return(p==null?void 0:p.closestTo(e))??YP(e)}return a}getPlane(e=Fi()){return G_(this.center,this.normal,e)}}const FX=W(),Ojt=Fi();class Pjt extends x1{constructor(e){super(),this.z=e}equals(e){return this===e||bv(e)&&this.z===e.z}closestTo(e){return st(e[0],e[1],this.z)}getPlane(e=Fi()){return Ie(Uxe,0,0,this.z),G_(Uxe,pB,e)}}const Uxe=W();class Wue extends x1{constructor(e,i,r){super(),this.start=e,this.end=i,this.planeLike={start:e,end:i,type:r}}equals(e){return this===e||ny(e)&&this.planeLike.type===e.planeLike.type&&jr(this.start,e.start)&&jr(this.end,e.end)}closestTo(e){return LBe(e,this.planeLike)}closestEndTo(e){const{start:i,end:r}=this;return Math.sign(fs(Rs(Rjt,r,i),Rs(Ijt,e,i)))>0?r:i}getPlane(e=Fi()){const i=Ne(Vxe,this.end);return i[2]+=1,Hl(this.start,this.end,i,e)}getSlicePlane(e=Fi()){const{start:i,end:r,type:n}=this.planeLike;if(n===Tp.PLANE)return;const s=Ie(Vxe,i[0],i[1],0),o=Ie(Bxe,r[0],r[1],0),a=je(Bxe,o,s);return G_(s,a,e),e}}const Rjt=yt(),Ijt=yt(),Vxe=W(),Bxe=W();class qBe extends Wue{constructor(e,i){super(e,i,Tp.HALF_PLANE)}}class WBe extends Wue{constructor(e,i){super(e,i,Tp.PLANE)}}class $jt extends x1{constructor(e,i){super(),this.sphere=qoe(e,i)}equals(e){return this===e||xv(e)&&A5e(this.sphere,e.sphere)}closestTo(e){const i=fj(this.sphere,e,W());return i}get center(){return this.sphere}get radius(){return this.sphere[3]}}class YBe extends x1{constructor(e,i,r){super(),this.start=e,this.end=i,this.getZ=r,this.planeLike={start:e,end:i,type:Tp.PLANE}}equals(e){return this===e||qV(e)&&jr(this.start,e.start)&&jr(this.end,e.end)&&this.getZ===e.getZ}closestTo(e){return Ljt(this,e)}addIfOnTheGround(e,i){for(const r of i){const n=this.getZ(r[0],r[1])??0;Co(r[2],n)&&(r[2]=n,e.push(r))}}}function Ljt(t,e){const i=LBe(e,t.planeLike);return i[2]=t.getZ(i[0],i[1])??ZBe,i}function _v(t,e){if(Vre(t)){const i=[];for(const r of t.constraints){const n=r.intersect(e);n&&i.push(n)}return Xue(i)}if(Vre(e))return _v(e,t);if(qV(t))return jxe(t,e);if(qV(e))return jxe(e,t);if(iy(t)){const{point:i}=t,r=e.closestTo(i);return L2(r,i)?t:void 0}if(ry(t)){if(iy(e))return _v(e,t);if(ry(e))return Em(kBe(t.lineLike,e.lineLike));if(bv(e))return Djt(t,e);if(ny(e))return Em(IBe(e.planeLike,t.lineLike));if(sy(e))return Em(FBe(t.lineLike,e.center,e.radius));if(Aw(e))return Em(NBe(t.lineLike,e));if(wv(e))return Njt(t,e);if(xv(e))return Fjt(t,e)}else if(bv(t)){if(iy(e)||ry(e))return _v(e,t);if(bv(e))return kjt(t,e);if(ny(e))return zjt(t,e);if(sy(e))return Ujt(t,e);if(Aw(e))return Bjt(t,e);if(wv(e))return Vjt(t,e);if(xv(e))return jjt(t,e)}else if(ny(t)){if(iy(e)||ry(e)||bv(e))return _v(e,t);if(ny(e))return kX($Be(t.planeLike,e.planeLike));if(sy(e))return kX(kue(t.planeLike,e.center,e.radius));if(Aw(e))return Hjt(t,e);if(wv(e))return Gjt(t,e);if(xv(e))return qjt(t,e)}else if(sy(t)){if(iy(e)||ry(e)||bv(e)||ny(e))return _v(e,t);if(sy(e))return kX(Uue(t.center,t.radius,e.center,e.radius));if(Aw(e))return void 0;if(wv(e))return Wjt(t,e);if(xv(e))return void 0}else if(Aw(t)){if(iy(e)||ry(e)||bv(e)||ny(e)||sy(e))return _v(e,t);if(Aw(e))return void 0;if(wv(e))return e.asCircle(),void 0;if(xv(e))return void 0}else if(wv(t)){if(iy(e)||ry(e)||bv(e)||ny(e)||sy(e)||Aw(e))return _v(e,t);if(wv(e))return Yjt(e,t);if(xv(e))return void 0}else if(xv(t)){if(iy(e)||ry(e)||bv(e)||ny(e)||sy(e)||wv(e))return _v(e,t);if(xv(e))return void 0}}const Djt=(()=>{const t=Fi();return(e,i)=>{const{start:r,end:n}=e;if(zBe(r,n)&&Co(r[2],i.z))return e;const s=W();return F5e(i.getPlane(t),r,n,s)?new z5(s):void 0}})();function Njt({lineLike:t},{center:e,radius:i}){const r=e[2];return Em(FBe(t,e,i).filter(n=>Co(n[2],r)))}function Fjt({lineLike:t},{sphere:e}){return Em(O5e(e,t.start,t.end))}const Yue=(()=>{const t=Qo(),e=Fi(),i={start:W(),end:W(),type:co.LINE};return(r,n,s)=>{const{normal:o,center:a,radius:c}=n,p=Ve(o,r),_=Co(OQ(r,a),0);if(Co(p,1))return _?n:void 0;if(n.getPlane(e),_&&Co(p,0)&&yfe(r)&&yfe(e)){if(Co(c,0))return!s||O2(s,a)?new z5(YP(a)):void 0;const S=Xr(a);S[2]+=c;const C=Xr(a);C[2]-=c;const M=[];return s&&!O2(s,S)||M.push(S),s&&!O2(s,C)||M.push(C),Em(M)}if(!Slt(r,e,t))return;Ne(i.start,t.origin),Be(i.end,t.origin,t.direction);const x=NBe(i,n);return Em(s?Sjt(s,x):x)}})();function kjt(t,e){return Co(t.z,e.z)?t:void 0}function zjt({z:t},{planeLike:e}){const[i,r]=e.start,[n,s]=e.end,o=nx(i,r,t),a=nx(n,s,t);return e.type===Tp.PLANE?new Gue(o,a):new Mjt(o,a)}function Ujt(t,e){const[i,r]=e.center;return new Hue(nx(i,r,t.z),e.radius)}function Vjt(t,e){return Co(e.center[2],t.z)?e:void 0}const Bjt=(()=>{const t=Fi();return(e,i)=>Yue(e.getPlane(t),i)})();function jjt(t,{center:e,radius:i}){const r=Math.abs(e[2]-t.z);if(r>i&&!Co(r,i))return;const n=nx(e[0],e[1],t.z),s=Math.sqrt(i**2-r**2);return Co(s,0)?void 0:new Hue(n,s)}const Gjt=(()=>{const t=Fi();return(e,{center:i,radius:r})=>{const n=kue(e.planeLike,i,r),s=i[2];e.getSlicePlane(t);const o=[];for(const[a,c]of n){const p=[a,c,s];O2(t,p)&&o.push(p)}return Em(o)}})(),Hjt=(()=>{const t=Fi(),e=Fi();return(i,r)=>Yue(i.getPlane(t),r,i.getSlicePlane(e))})(),qjt=(()=>{const t=Fi();return(e,{center:i,radius:r})=>{const n=e.getPlane(t),s=gn(n,i),o=Math.abs(s);if(o>r&&!Co(o,r))return;const a=Xr(n),c=lo(W(),i,a,s),p=Math.sqrt(r**2-s**2);return Co(p,0)?new z5(Zoe(n,i,W())):new que(c,p,a,e.getSlicePlane())}})();function Wjt(t,e){const i=t0(t.center,e.center);return Co(i,0)&&Co(t.radius,e.radius)?e:XBe(Uue(t.center,t.radius,e.center,e.radius),e.center[2])}function Yjt(t,e){if(!zBe(t.center,e.center))return;const i=t0(t.center,e.center);return Co(i,0)&&Co(t.radius,e.radius)?t:XBe(Uue(t.center,t.radius,e.center,e.radius),t.center[2])}function jxe(t,e){const{planeLike:i,getZ:r}=t,n=[];if(iy(e))t.addIfOnTheGround(n,wjt(i,e.point));else if(ry(e))t.addIfOnTheGround(n,IBe(i,e.lineLike));else if(sy(e))for(const[s,o]of kue(i,e.center,e.radius)){const a=r(s,o);a!=null&&n.push(st(s,o,a))}else if(ny(e)||qV(e))for(const[s,o]of $Be(i,e.planeLike)){const a=r(s,o)??ZBe;n.push(st(s,o,a))}return Em(n)}function kX(t){return Xue(t.map(([e,i])=>{const r=nx(e,i,0),n=nx(e,i,1);return new Gue(r,n)}))}function Em(t){return Xue(t.map(e=>e?new z5(e):void 0))}function XBe(t,e){return Em(t.map(([i,r])=>[i,r,e]))}function Xue(t){if(t.length!==0)return t.length===1?t[0]??void 0:new GBe(t.filter(ys))}function Vre(t){return t instanceof GBe}function iy(t){return t instanceof z5}function ry(t){return t instanceof jue}function bv(t){return t instanceof Pjt}function ny(t){return t instanceof Wue}function sy(t){return t instanceof HBe}function wv(t){return t instanceof Hue}function Aw(t){return t instanceof que}function xv(t){return t instanceof $jt}function qV(t){return t instanceof YBe}const ZBe=0;var Bre;const zX=new tn({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),UX=new tn({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let Yg=Bre=class extends Ue{constructor(t){super(t),this.where=null,this.geometry=null,this.spatialRelationship="intersects",this.distance=void 0,this.objectIds=null,this.units=null,this.timeExtent=null}createQuery(t={}){const{where:e,geometry:i,spatialRelationship:r,timeExtent:n,objectIds:s,units:o,distance:a}=this;return new Wm({geometry:Pe(i),objectIds:Pe(s),spatialRelationship:r,timeExtent:Pe(n),where:e,units:o,distance:a,...t})}clone(){const{where:t,geometry:e,spatialRelationship:i,timeExtent:r,objectIds:n,units:s,distance:o}=this;return new Bre({geometry:Pe(e),objectIds:Pe(n),spatialRelationship:i,timeExtent:Pe(r),where:t,units:s,distance:o})}};y([w({type:String,json:{write:!0}})],Yg.prototype,"where",void 0),y([w({types:dE,json:{write:!0}})],Yg.prototype,"geometry",void 0),y([w({type:zX.apiValues,json:{name:"spatialRel",read:{reader:zX.read},write:{allowNull:!1,writer:zX.write,overridePolicy(){return{enabled:this.geometry!=null}}}}})],Yg.prototype,"spatialRelationship",void 0),y([w({type:Number,json:{write:{overridePolicy(t){return{enabled:t!=null&&this.geometry!=null}}}}})],Yg.prototype,"distance",void 0),y([w({type:[Number],json:{write:!0}})],Yg.prototype,"objectIds",void 0),y([w({type:UX.apiValues,json:{read:UX.read,write:{writer:UX.write,overridePolicy(t){return{enabled:t!=null&&this.geometry!=null}}}}})],Yg.prototype,"units",void 0),y([w({type:f1,json:{write:!0}})],Yg.prototype,"timeExtent",void 0),Yg=Bre=y([Z("esri.layers.support.FeatureFilter")],Yg);const Hk=Yg;function FE(t,e){const i=t.x-e.x,r=t.y-e.y;return i*i+r*r}function Xjt(t,e){return Math.sqrt(FE(t,e))}function Zue(t,e){e.sort((i,r)=>Ao(i.targetPoint,t)-Ao(r.targetPoint,t))}var o0;function Qyi({point:t,distance:e,returnEdge:i,vertexMode:r,coordinateHelper:{spatialReference:n},filter:s},o,a){return a=a!=null?a.clone():new Wm({where:"1=1"}),s&&(a.geometry=s.geometry,a.distance=s.distance,a.spatialRelationship=s.spatialRelationship,a.where=MB(a.where,s.where),a.timeExtent=Krt(a.timeExtent,s.timeExtent),a.objectIds=Zjt(a.objectIds,s.objectIds)),{point:Ju(t[0],t[1],t[2],n.toJSON()),mode:o,distance:e,returnEdge:i,vertexMode:r,query:a.toJSON()}}function Zjt(t,e){return t||e?e?t?Array.from(yHe(new Set(t),new Set(e))):e:t:null}function WV(t,e,i){return{left:oo(t.leftVertex.pos,e,i),right:oo(t.rightVertex.pos,e,i)}}function e1i(t){return t.createQuery()}function Jjt(t,e=()=>{}){const i=_e(()=>({view:t.view,snappingOptions:t.snappingOptions}),({view:r,snappingOptions:n})=>{const s="snapping-toggle",o=Cs.TOOL;if(t.removeHandles(s),r&&n!=null){const a=[r.on("key-down",c=>{c.key!==zxe.toggle||c.repeat||(n.enabledToggled=!0,e())},o),r.on("key-up",c=>{c.key===zxe.toggle&&(n.enabledToggled=!1,e())},o),r.on("pointer-move",c=>{const p=c.native.ctrlKey;n.enabledToggled!==p&&(n.enabledToggled=p,e())},o)];t.addHandles(a,s)}},kt);t.addHandles(i)}function Kjt(t){var e;return t!=null&&typeof t=="object"&&"declaredClass"in t&&t.declaredClass==="esri.WebMap"&&"utilityNetworks"in t&&!!((e=t==null?void 0:t.utilityNetworks)!=null&&e.length)}(function(t){t[t.TARGET=0]="TARGET",t[t.REFERENCE=1]="REFERENCE",t[t.REFERENCE_EXTENSION=2]="REFERENCE_EXTENSION"})(o0||(o0={}));let af=class extends ze{get layerView(){var e,i;return(i=(e=this.view)==null?void 0:e.allLayerViews)==null?void 0:i.find(r=>r.layer===this.layer)}get valid(){return this._valid}get subtypeFilter(){var n,s;const{layer:e}=this;if(!Eit(e)||!((n=e.subtypes)!=null&&n.length))return{mode:"not-in-use",filter:null};const i=((s=e.fieldsIndex.get(e.subtypeField))==null?void 0:s.name)??e.subtypeField,r=e.sublayers.filter(o=>o.visible).map(o=>o.subtypeCode);return r.length?r.length===e.subtypes.length?{mode:"all-visible",filter:null}:r.length===1?{mode:"in-use",filter:`${i} = ${r.getItemAt(0)}`}:{mode:"in-use",filter:`${i} IN (${r.join(", ")})`}:{mode:"none-visible",filter:null}}get floorFilter(){const{view:e,layer:i}=this;return e&&i?ckt({view:e,layer:i}):null}constructor(e){super(e),this.rulesTable=null,this._valid=!1}initialize(){if(!this.snappingSource||!this.layer)return;const{layer:e,snappingSource:i}=this;if("refresh"in e){const r=e;this.addHandles(r.on("refresh",()=>i.refresh()))}this.loadRules(),this.addHandles([_e(()=>i.updating,r=>i.layerSource.updating=r,kt),_e(()=>i.availability,r=>i.layerSource.availability=r,kt)])}getFetchCandidatesParameters(e,i,r){var _,x;if(!this.valid)return[];const{layer:n,layerView:s,floorFilter:o,rulesTable:a,subtypeFilter:c}=this,p={distance:r,mode:((_=this.view)==null?void 0:_.type)??"2d",point:e,coordinateHelper:i.coordinateHelper,...this._types,filter:s&&"filter"in s?s.filter:null};if(o&&(p.filter=VX(p.filter,o)),c.mode!=="not-in-use"&&c.mode!=="all-visible"){if(c.mode==="none-visible")return[];p.filter?p.filter.where=MB(p.filter.where,c.mode):p.filter=new Hk({where:c.filter})}if(a){const S=i.feature,C=S==null?void 0:S.sourceLayer;if(!(S&&iF(n)&&n.layerId&&iF(C)&&a.loadStatus==="loaded"))return[];const M=[],P=n.layerId,$=(x=a.getFeatureSQL(C,S))==null?void 0:x[P];if(!$)return[];const F=$.anyVertex;let z=$.endVertex;return z&&F&&z===F&&(z=""),z&&M.push({...p,returnEdge:!1,vertexMode:"ends",filter:VX(p.filter,z)}),F&&M.push({...p,returnEdge:!1,vertexMode:"all",filter:VX(p.filter,F)}),M}return[p]}async loadRules(){var r,n;const{layer:e,view:i}=this;if(e&&i&&Kjt(i==null?void 0:i.map)&&iF(e)){const s=(r=i.map.utilityNetworks)==null?void 0:r.find(o=>o.isUtilityLayer(e));if(s)try{this.rulesTable=await s.getRulesTable(),await((n=this.rulesTable)==null?void 0:n.load()),this._valid=!0}catch{return void Ce.getLogger("esri.views.interactive.snapping.FeatureSnappingSourceInfo").error("Failed to load rules table for snapping source",e.title)}}else this._valid=!0}get _types(){return{returnEdge:!0,vertexMode:"all"}}remove(){this.destroy()}destroy(){var e;(e=this.snappingSource)==null||e.destroy()}};function VX(t,e){return t==null?new Hk({where:e}):t.where?new Hk({where:MB(t.where,e)}):new Hk({where:e})}y([w({constructOnly:!0})],af.prototype,"layer",void 0),y([w({constructOnly:!0})],af.prototype,"snappingSource",void 0),y([w({constructOnly:!0})],af.prototype,"view",void 0),y([w()],af.prototype,"layerView",null),y([w()],af.prototype,"rulesTable",void 0),y([w()],af.prototype,"valid",null),y([w()],af.prototype,"subtypeFilter",null),y([w()],af.prototype,"floorFilter",null),y([w()],af.prototype,"_valid",void 0),af=y([Z("esri.views.interactive.snapping.FeatureSnappingSourceInfo")],af);let U5=class{constructor(e,i,r,n){this.targetPoint=e,this.constraint=i,this.isDraped=r,this.domain=n}},Jue=class extends U5{constructor({targetPoint:e,objectId:i,constraint:r,isDraped:n}){super(e,r,n,Xl.FEATURE),this.objectId=i}},eH=class{constructor(e,i){this.isDraped=e,this.domain=i}},a1=class JBe extends eH{constructor(e,i,r,n,s=Xl.ALL,o=!0,a=!0){super(n,s),this.type=e,this.lineStart=i,this.lineEnd=r,this.fadeLeft=o,this.fadeRight=a}equals(e){return e instanceof JBe&&this.type===e.type&&jr(this.lineStart,e.lineStart)&&jr(this.lineEnd,e.lineEnd)&&this.fadeLeft===e.fadeLeft&&this.fadeRight===e.fadeRight}get length(){return Tn(this.lineStart,this.lineEnd)}},Qjt=class extends Jue{constructor(e){super({...e,isDraped:!0,constraint:new YBe(e.edgeStart,e.edgeEnd,e.getGroundElevation)})}get hints(){return[new a1(o0.REFERENCE,this.constraint.start,this.constraint.end,this.isDraped,this.domain)]}},eGt=class extends Jue{constructor(e){super({...e,constraint:new Gue(e.edgeStart,e.edgeEnd)})}get hints(){return[new a1(o0.REFERENCE,this.constraint.start,this.constraint.end,this.isDraped,this.domain)]}},KBe=class QBe extends eH{constructor(e,i,r,n,s=Xl.ALL){super(n,s),this.previousVertex=e,this.centerVertex=i,this.nextVertex=r}equals(e){return e instanceof QBe&&jr(this.previousVertex,e.previousVertex)&&jr(this.centerVertex,e.centerVertex)&&jr(this.nextVertex,e.nextVertex)}},eje=class extends U5{constructor({targetPoint:e,constraint:i,previousVertex:r,otherVertex:n,otherVertexType:s,objectId:o,isDraped:a}){super(e,i,a,Xl.SELF),this.previousVertex=r,this.otherVertex=n,this.otherVertexType=s,this.objectId=o}get hints(){const e=this.previousVertex,i=this.otherVertexType===ZP.CENTER?this.otherVertex:this.targetPoint,r=this.otherVertexType===ZP.CENTER?this.targetPoint:this.otherVertex;return[new a1(o0.TARGET,i,r,this.isDraped,this.domain),new a1(o0.REFERENCE,e,i,this.isDraped,this.domain),new KBe(this.previousVertex,i,r,this.isDraped,this.domain)]}};var ZP;(function(t){t[t.NEXT=0]="NEXT",t[t.CENTER=1]="CENTER"})(ZP||(ZP={}));function l1i(t,e,i,r){i.projectToRenderScreen(t,Gxe),i.projectToRenderScreen(e,Hxe),Rs(r,Hxe,Gxe),PP(r,r)}function tGt(t,e,i,r,n=W()){const s=Ne(jre,t);return s[2]=YPe(r,s,e,i)||0,r.renderCoordsHelper.toRenderCoords(s,e,n),n}function fu(t,e,i,r){return r.type==="2d"?(n7.x=t[0],n7.y=t[1],n7.spatialReference=e,r.toScreen(n7)):(tGt(t,e,i,r,jre),r.state.camera.projectToScreen(jre,BX),Qu(BX[0],BX[1]))}const n7=Ju(0,0,0,null),jre=W(),Gxe=Ka(),Hxe=Ka(),BX=ss();let Mw=class extends ze{get updating(){return this._snappingSources.some(e=>e==null||e.valid&&e.snappingSource.updating)||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=Xl.FEATURE,this._updatingHandles=new Nf,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){const e=ztt(()=>{var i;return(i=this.options)==null?void 0:i.featureSources},(i,r)=>this._createSourceInfo(i,r));this._snappingSources=e,this.addHandles(gne(e))}destroy(){this._set("options",null),this._updatingHandles.destroy()}async fetchCandidates(e,i,r,n){var c;if(!(i&this._domain&&this.options!=null&&this.options.effectiveFeatureEnabled))return[];const s=[],o=this._computeScreenSizeDistanceParameters(e,r);for(const p of this._snappingSources){if(p==null||!p.valid||!p.snappingSource.layerSource.enabled||(c=p.layerView)!=null&&c.suspended)continue;const _=p.getFetchCandidatesParameters(e,r,o);for(const x of _)s.push(p.snappingSource.fetchCandidates(x,n).then(S=>S.filter(C=>!this._candidateIsExcluded(p.snappingSource,C,r.excludeFeature))))}const a=(await lZ(s)).flat();return this._addRightAngleCandidates(a,e,o,r),St(n),Zue(e,a),a}_addRightAngleCandidates(e,i,r,n){var x,S,C,M,P,$,F,z;const s=n.vertexHandle!=null?(S=(x=n.vertexHandle.rightEdge)==null?void 0:x.rightVertex)==null?void 0:S.pos:n.editGeometryOperations!=null&&n.editGeometryOperations.data.type==="polygon"?(M=(C=n.editGeometryOperations.data.components[0])==null?void 0:C.getFirstVertex())==null?void 0:M.pos:null,o=n.vertexHandle!=null?($=(P=n.vertexHandle.leftEdge)==null?void 0:P.leftVertex)==null?void 0:$.pos:n.editGeometryOperations!=null?(z=(F=n.editGeometryOperations.data.components[0])==null?void 0:F.getLastVertex())==null?void 0:z.pos:null,{view:a}=this,c=oo(s,a,n),p=oo(o,a,n),_=e.length;for(let k=0;k<_;k++)this._addRightAngleCandidate(e[k],p,i,r,e),this._addRightAngleCandidate(e[k],c,i,r,e)}_addRightAngleCandidate(e,i,r,n,s){if(i==null||!iGt(e))return;const o=e.constraint.closestTo(i),a=(o[0]-r[0])/n.x,c=(o[1]-r[1])/n.y,{start:p,end:_}=e.constraint;if(a*a+c*c<=1){const x=new eje({targetPoint:o,otherVertex:i,otherVertexType:ZP.NEXT,previousVertex:t0(o,p)>t0(o,_)?p:_,constraint:new qBe(i,o),objectId:e.objectId,isDraped:e.isDraped});s.push(x)}}_computeScreenSizeDistanceParameters(e,i){let r=this.options!=null?this.options.distance*(i.pointer==="touch"?this.options.touchSensitivityMultiplier:1):0;return this.view==null?{x:r,y:r,z:r,distance:r}:this.view.type==="2d"?(r*=this.view.resolution,{x:r,y:r,z:r,distance:r}):this._computeScreenSizeDistanceParameters3D(e,r,this.view,i)}_computeScreenSizeDistanceParameters3D(e,i,r,n){const{spatialReference:s}=n;r.renderCoordsHelper.toRenderCoords(e,s,qxe);const o=r.state.camera.computeScreenPixelSizeAt(qxe),a=o*r.renderCoordsHelper.unitInMeters,c=a/xs(s),p=a/ad(s),_=i*c,x=i*p,S=fu(e,s,ga,r),C=S?jX(S,e,c,0,0,r,n):0,M=S?jX(S,e,0,c,0,r,n):0,P=S?jX(S,e,0,0,p,r,n):0;return{x:C===0?0:_/C,y:M===0?0:_/M,z:P===0?0:x/P,distance:o*i}}_candidateIsExcluded(e,i,r){if(r==null)return!1;const n=this._getCandidateObjectId(i);if(n==null)return!1;const s=e.layerSource.layer;return s.type==="graphics"?r.uid===n:r.sourceLayer===s&&!(!r.attributes||!("objectIdField"in s))&&r.attributes[s.objectIdField]===n}_getCandidateObjectId(e){return e instanceof Jue?e.objectId:null}async _createSourceInfo(e,i){const r=e.layer;r.loaded||(await r.load(),St(i));const{view:n}=this,s=await this._createFeatureSnappingSourceType(e);return St(i),new af(s==null?{}:{snappingSource:s,view:n,layer:r})}async _createFeatureSnappingSourceType(e){switch(e.layer.type){case"feature":case"geojson":case"csv":case"oriented-imagery":case"subtype-group":case"wfs":return this._createFeatureSnappingSourceFeatureLayer(e);case"graphics":return this._createFeatureSnappingSourceGraphicsLayer(e);case"map-notes":return this._createFeatureSnappingSourceMapNotesLayer(e);case"scene":case"building-scene":return this._createFeatureSnappingSourceSceneLayer(e)}return null}async _createFeatureSnappingSourceSceneLayer(e){const{view:i}=this;return i==null||i.type!=="3d"?null:new(await this._getSourceModule("scene")).SceneLayerSnappingSource({layerSource:e,view:i})}async _createFeatureSnappingSourceFeatureLayer(e){var i;switch((i=e.layer.source)==null?void 0:i.type){case"feature-layer":case"oriented-imagery":return new(await this._getSourceModule("featureService")).FeatureServiceSnappingSource({spatialReference:this.spatialReference,view:this.view,layerSource:e});case"memory":case"csv":case"geojson":case"wfs":return e.layer.geometryType==="mesh"?null:new(await this._getSourceModule("featureCollection")).FeatureCollectionSnappingSource({layerSource:e,view:this.view})}return null}async _createFeatureSnappingSourceGraphicsLayer(e){return new(await this._getSourceModule("graphics")).GraphicsSnappingSource({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _createFeatureSnappingSourceMapNotesLayer(e){return new(await this._getSourceModule("notes")).GraphicsSnappingSource({getGraphicsLayers:()=>{var i;return((i=e.layer.sublayers)==null?void 0:i.toArray())??[]},spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _getSourceModule(e){const i=this._sourceModules[e];if(i.loader==null){const r=this._loadSourceModule(e),n={module:null,loader:r};this._sourceModules[e]=n;const s=await r,o={module:s,loader:r};return this._sourceModules[e]=o,s}return i.module==null?i.loader:i.module}_loadSourceModule(e){const i=this._updatingHandles;switch(e){case"featureService":return i.addPromise(we(()=>import("./FeatureServiceSnappingSource-LrGkMfSm.js"),__vite__mapDeps([241,242,243,197,213])));case"featureCollection":return i.addPromise(we(()=>import("./FeatureCollectionSnappingSource-noadiOim.js"),__vite__mapDeps([244,242,243,197,91])));case"graphics":case"notes":return i.addPromise(we(()=>import("./GraphicsSnappingSource-0y5Y2-KL.js"),__vite__mapDeps([245,60,44,45,46,47,48,4,5,49,28,50,35,51,242,243,197,91])));case"scene":return i.addPromise(we(()=>import("./SceneLayerSnappingSource-wfFr0F0T.js"),__vite__mapDeps([246,243,197])))}}get test(){return{snappingSources:this._snappingSources}}};function iGt(t){return(t instanceof eGt||t instanceof Qjt)&&!rGt(t)}function rGt({constraint:{start:t,end:e}}){const i=Ao(t,e),r=t0(t,e);return ithis.squaredShortLineThreshold}isVertical(e,i){return t0(e,i)new a1(o0.REFERENCE,e.edge.left,e.edge.right,this.isDraped,this.domain,e.fadeLeft,e.fadeRight))]}addReferenceLine(e){const i={edge:e,fadeLeft:!0,fadeRight:!0};this._referenceLines.forEach(r=>{jr(e.right,r.edge.left)&&(r.fadeLeft=!1,i.fadeRight=!1),jr(e.right,r.edge.right)&&(r.fadeRight=!1,i.fadeRight=!1),jr(e.left,r.edge.right)&&(r.fadeRight=!1,i.fadeLeft=!1),jr(e.left,r.edge.left)&&(r.fadeLeft=!1,i.fadeLeft=!1)}),this._referenceLines.push(i)}},uGt=class extends tH{snapNewVertex(e,i){const r=i.editGeometryOperations.data.components[0],n=r.edges.length,s=r.vertices.length,o=[];if(n<2)return o;const{view:a}=this,c=fu(e,i.spatialReference,ga,a),p=oo(r.vertices[s-1].pos,a,i),_=oo(r.vertices[0].pos,a,i),x=r.edges[n-1];let S=x;do{if(this.edgeExceedsShortLineThreshold(S,i)){const C=WV(S,a,i);this._checkEdgeForParallelLines(C,p,e,c,i,o),this._checkEdgeForParallelLines(C,_,e,c,i,o)}S=S.leftVertex.leftEdge}while(S&&S!==x);return o}snapExistingVertex(e,i){const r=[],n=i.vertexHandle,s=n.component;if(s.edges.length<3)return r;const{view:o}=this,a=fu(e,i.spatialReference,ga,o),c=n.leftEdge,p=n.rightEdge,_=s.vertices[0],x=oo(_.pos,o,i),S=s.vertices.length,C=s.vertices[S-1],M=oo(C.pos,o,i),P=s.edges[0];let $=P;do{if($!==c&&$!==p&&this.edgeExceedsShortLineThreshold($,i)){const F=WV($,o,i);c&&this._checkEdgeForParallelLines(F,oo(c.leftVertex.pos,o,i),e,a,i,r),p&&this._checkEdgeForParallelLines(F,oo(p.rightVertex.pos,o,i),e,a,i,r),n===_?this._checkEdgeForParallelLines(F,M,e,a,i,r):n===C&&this._checkEdgeForParallelLines(F,x,e,a,i,r)}$=$.rightVertex.rightEdge}while($&&$!==P);return r}_checkEdgeForParallelLines(e,i,r,n,s,o){var S;const a=e.left,c=e.right;if(NX(p3,i,a,c),t0(p3,i){const{effectiveFeatureEnabled:e,effectiveSelfEnabled:i,touchSensitivityMultiplier:r,distance:n}=this.options;return{effectiveFeatureEnabled:e,effectiveSelfEnabled:i,touchSensitivityMultiplier:r,distance:n}},()=>{this.doneSnapping(),this.emit("changed")},Li),_e(()=>this.options,e=>{for(const i of this._engines)i.options=e},Li),_e(()=>({viewReady:this.view.ready,viewSpatialReference:this.view.spatialReference,snappingEnginesFactory:this.snappingEnginesFactory}),({viewReady:e,snappingEnginesFactory:i})=>this._recreateEngines(e,i),kt)])}destroy(){this._destroyEngines()}get updating(){return this._engines.some(e=>e.updating)}_recreateEngines(e,i){if(this._destroyEngines(),!e)return;const{view:r,options:n}=this;this._engines=i(r,n)}_destroyEngines(){for(const e of this._engines)e.destroy();this._engines=[]}get _squaredMouseProximityTreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){const{distance:e,touchSensitivityMultiplier:i}=this.options,r=e*i;return r*r}get _squaredSatisfiesConstraintThreshold(){return f_.satisfiesConstraintScreenThreshold*f_.satisfiesConstraintScreenThreshold}snap(e){return _Gt(e)?this._snapMultiPoint(e):this._snapSinglePoint(e)}update(e){const{point:i,context:r}=e;this._removeVisualization();const n=this._currentMainCandidate;if(n==null)return i;const s=this._selectUpdateInput(e);if(s==null)return i;const{spatialReference:o}=r,a=sl(s,o);if(a==null)return i;const{view:c}=this,{elevationInfo:p,visualizer:_}=r,x=[],S=q4(a,c,p),C=n.constraint.closestTo(S);if(!this._arePointsWithinScreenThreshold(S,C,r))return this._resetSnappingState(),i;n.targetPoint=C,x.push(...n.hints);for(const M of this._currentOtherActiveCandidates)M.targetPoint=C,x.push(...M.hints);return _!=null&&this.addHandles(_.draw(x,{spatialReference:o,elevationInfo:bGt(r),view:c,selfSnappingZ:r.selfSnappingZ}),a7),Wxe(C,c,{z:i.z,m:i.m,spatialReference:i.spatialReference,elevationInfo:p})}doneSnapping(){this._removeVisualization(),this._resetSnappingState()}_selectUpdateInput({point:e,scenePoint:i}){switch(this._currentSnappedType){case Nv.MAIN:return e;case Nv.SCENE:return i}}_resetSnappingState(){this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=Nv.MAIN}_removeVisualization(){this.removeHandles(a7)}async _snapSinglePoint({point:e,context:i,signal:r}){const{view:n}=this,{elevationInfo:s}=i,o=q4(e,n,s),a=await this._fetchCandidates(o,Xl.ALL,i,r);return this._createSnapResult(o,Nv.MAIN,a,n,i,{z:e.z,m:e.m,spatialReference:e.spatialReference,elevationInfo:s},r)}async _snapMultiPoint({point:e,scenePoint:i,context:r,signal:n}){const{view:s}=this,{coordinateHelper:o,elevationInfo:a,spatialReference:c}=r;await T_(i.spatialReference,c);const p=sl(i,c),_=q4(p,s,a),x=await this._fetchCandidates(_,Xl.FEATURE,r,n);if(x.length>0){const M=await this._fetchCandidates(_,Xl.SELF,r,n);return this._createSnapResult(_,Nv.SCENE,[...x,...M],s,r,{z:p.z,m:p.m,spatialReference:p.spatialReference,elevationInfo:a},n)}const S=q4(e,s,a),C=await this._fetchCandidates(S,Xl.SELF,r,n);return this._createSnapResult(S,Nv.MAIN,C,s,r,{z:o.hasZ()&&e.hasZ?e.z??0:void 0,m:o.hasM()&&e.hasM?e.m??0:void 0,spatialReference:e.spatialReference,elevationInfo:a},n)}async _fetchCandidates(e,i,r,n){return(await Promise.all(this._engines.map(s=>s.fetchCandidates(e,i,r,n)))).flat()}_createSnapResult(e,i,r,n,s,o,a){return{get valid(){return!So(a)},apply:()=>{const{spatialReference:c}=s,{snappedPoint:p,hints:_}=this._processCandidates(e,i,r,s);return this._removeVisualization(),s.visualizer!=null&&this.addHandles(s.visualizer.draw(_,{spatialReference:c,elevationInfo:ga,view:n,selfSnappingZ:s.selfSnappingZ}),a7),Wxe(p,n,o)}}}_processCandidates(e,i,r,n){if(r.length<1)return this.doneSnapping(),{snappedPoint:e,hints:[]};this._currentSnappedType!==i&&this._resetSnappingState(),Zue(e,r);const s=this._currentMainCandidate;if(s!=null){const o=this._findOldConstraintInNewCandidates(s,r);if(o>=0){if(!(r[o]instanceof o7))return this._intersectWithOtherCandidates(o,r,e,i,n);if(this._arePointsWithinScreenThreshold(e,s.targetPoint,n))return this._updateSnappingCandidate(s,i,r,n)}}return this._intersectWithOtherCandidates(0,r,e,i,n)}_findOldConstraintInNewCandidates(e,i){return e instanceof o7?this._findOldCandidateIndex(i,e.first)>=0&&this._findOldCandidateIndex(i,e.second)>=0?0:-1:this._findOldCandidateIndex(i,e)}_intersectWithOtherCandidates(e,i,r,n,s){const{coordinateHelper:o}=s,a=i[e],c=[];for(let p=0;p0&&(c.sort((p,_)=>p[1]-_[1]),c[0][1]0}canRedo(){return this.history.redo.length>0}complete(){this._reset(),this.onEnd(),this.emit("complete")}cancel(){this.cancelled=!0,this.complete()}_reset(){var e;(e=this.activeComponent)==null||e.reset()}refreshComponent(){const e=this.activeComponent;e&&(e.type!=="box"&&e.type!=="reshape"&&e.type!=="graphic-mover"||e.refresh())}set undo(e){this._set("undo",()=>{this.canUndo()&&e()})}set redo(e){this._set("redo",()=>{this.canRedo()&&e()})}};y([w()],mc.prototype,"activeComponent",void 0),y([w()],mc.prototype,"cancelled",void 0),y([w()],mc.prototype,"history",void 0),y([w()],mc.prototype,"tool",null),y([w()],mc.prototype,"type",void 0),y([w()],mc.prototype,"canUndo",null),y([w()],mc.prototype,"canRedo",null),y([w()],mc.prototype,"onEnd",void 0),y([w()],mc.prototype,"undo",null),y([w()],mc.prototype,"redo",null),y([w()],mc.prototype,"toggleTool",void 0),y([w()],mc.prototype,"addToSelection",void 0),y([w()],mc.prototype,"removeFromSelection",void 0),mc=y([Z("esri.widgets.Sketch.support.OperationHandle")],mc);let qk=class extends mc{};y([w()],qk.prototype,"activeComponent",void 0),qk=y([Z("esri.widgets.Sketch.support.CreateOperationHandle")],qk);let Vv=class extends mc{};y([w()],Vv.prototype,"activeComponent",void 0),Vv=y([Z("esri.widgets.Sketch.support.UpdateOperationHandle")],Vv);const Yxe={defaultZ:0},KR={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0},tool:"transform"};let Vs=class extends Dn.EventedAccessor{constructor(e){super(e),this._numUpdating=0,this._internalGraphicsLayer=new eoe({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.labelOptions=new OBe,this.layer=null,this.pointSymbol=new du({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new qm({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new Ic({color:[130,130,130,1],width:2}),this.meshSymbol=new V9({symbolLayers:new tt([new b5])}),this._snappingManager=null,this.tooltipOptions=new PBe,this.updateGraphics=new tt,this.updateOnGraphicClick=!0,this.vertexSymbol=new du({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._originalPopupEnabled=null,this.defaultCreateOptions=Yxe,this.defaultUpdateOptions=KR,this.snappingOptions=new Kue}initialize(){this.addHandles([Jr(()=>{var e,i;return(i=(e=this.view)==null?void 0:e.map)==null?void 0:i.layers},"change",e=>{e.removed.includes(this.layer)&&this.cancel()}),Jr(()=>{var e;return(e=this.layer)==null?void 0:e.graphics},"change",e=>{if(this._operationHandle!=null)for(const i of e.removed)this.updateGraphics.includes(i)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(i):this._operationHandle.cancel())}),_e(()=>{var e;return((e=this.layer)==null?void 0:e.elevationInfo)??null},e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)},kt),_e(()=>this.view,e=>{et(this._snappingManager),e&&(this._snappingManager=new K0({view:e,options:this.snappingOptions}),e.type==="2d"?we(()=>import("./editingTools-KuLEWRoO.js"),__vite__mapDeps([247,248,196,197,249,250,135,179,187,188,200,201,175,251,184,180,252,174,253,121])):e.type==="3d"&&(we(()=>import("./editingTools-ht4PZFTE.js"),__vite__mapDeps([254,180,182,251,184,175,190,191,164,192,178,193,194,177,195,196,197,255,198,185,249,250,135,179,187,188,200,201,252,174,207,186,253,121,256,209,126,176,189,257])),we(()=>import("./GraphicsLayerView3D-WVV0TMGR.js"),__vite__mapDeps([144,116,136,145,137,51,46,47,125,118]))))},kt),_e(()=>{var e;return(e=this.view)==null?void 0:e.spatialReference},(e,i)=>{e&&i&&!e.equals(i)&&this.cancel()})]),Jjt(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._snappingManager=et(this._snappingManager),this._set("view",null),this.emit("destroy")}get _defaultUpdateTool(){var e;return((e=this.view)==null?void 0:e.type)==="3d"?"move":"transform"}get updating(){return this._numUpdating>0||this._snappingManager!=null&&this._snappingManager.updating}get activeTool(){var e;return((e=this._operationHandle)==null?void 0:e.tool)??null}get activeComponent(){var e;return((e=this._operationHandle)==null?void 0:e.activeComponent)??null}get createGraphic(){return this.activeComponent==null||this.activeComponent.type!=="draw-3d"&&this.activeComponent.type!=="draw-2d"?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...Yxe,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...KR,...e,reshapeOptions:{...KR.reshapeOptions,...e==null?void 0:e.reshapeOptions},highlightOptions:{...KR.highlightOptions,...e==null?void 0:e.highlightOptions}})}set snappingOptions(e){this._snappingManager!=null&&(this._snappingManager.options=e),this._set("snappingOptions",e)}get state(){var r;const e=!(!((r=this.view)!=null&&r.ready)||!this.layer),i=this._operationHandle;return e&&i?"active":e?"ready":"disabled"}get view(){return this._get("view")}set view(e){const i=this._get("view");if(i){const{container:n,map:s}=i;n&&(i.cursor=null),s==null||s.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const r="view-ready";this.removeHandles(r),e&&this.addHandles(Oo(()=>e.ready,n=>{this.removeHandles(this._viewHandlesKey),n&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},kt),r),this._set("view",e)}cancel(){this._moduleLoaderAbortController=vn(this._moduleLoaderAbortController),this._viewReadyAbortController=vn(this._viewReadyAbortController),this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle&&this._operationHandle.complete()}delete(){const{state:e,updateGraphics:i}=this;if(e==="active"&&i.length){const{activeTool:r,layer:n}=this,s=i.toArray();n.removeMany(s),this.cancel(),this._emitDeleteEvent({graphics:s,tool:r})}}duplicate(){if(this.state==="active"&&this.updateGraphics.length){const e=this.updateGraphics.map(i=>i.clone()).toArray();return this.layer.addMany(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,i){this.cancel(),await this._waitViewReady();const{view:r,layer:n}=this;if(!r||this.state==="disabled")throw n||this._logMissingLayer(),ur();if(r.activeTool!=null&&(r.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");kxe(r,this._internalGraphicsLayer);const s=await this._setupCreateOperation(e,i);if(s==null||this.destroyed)return void r.map.remove(this._internalGraphicsLayer);const o=()=>{var a;if(s===this._operationHandle){const c=this.createGraphic,p=this._operationHandle.cancelled;this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),(a=this.view)!=null&&a.map&&this.view.map.remove(this._internalGraphicsLayer),s.cancelled||c==null||n.add(c),this.emit("create",{graphic:c,state:p?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"})}};s.on("complete",o),this._operationHandle=s,r.ready&&r.focus()}async update(e,i){this.cancel(),await this._waitViewReady();const{layer:r,view:n,state:s}=this;if(!n||s==="disabled")throw r||this._logMissingLayer(),ur();n.activeTool!=null&&(n.activeTool=null);const o=Array.isArray(e)?e:[e];if(e==null||!(o!=null&&o.length))return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(o.some(c=>c.layer!==r?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):c.geometry==null&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0)))return;const a=await this._setupUpdateOperation(o,i);this.destroyed||a==null||Ia(a)||(kxe(n,this._internalGraphicsLayer),this._setUpdateOperationHandle(a,i),this.emit("update",{graphics:o,state:"start",aborted:!1,tool:a.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const i=this.view;if(i){this._beginAsyncOperation(),e=Array.isArray(e)?e:[e];for(const r of e)r.geometry==null||r.geometry.type==="mesh"||jn(r.geometry.spatialReference,i.spatialReference)||(rh(r.geometry.spatialReference,i.spatialReference)||hx()||await S_(),r.geometry=sl(r.geometry,i.spatialReference));this._endAsyncOperation()}else this._logMissingView()}undo(){var e;this.canUndo()&&((e=this._operationHandle)==null||e.undo())}redo(){var e;this.canRedo()&&((e=this._operationHandle)==null||e.redo())}canUndo(){return!(!this._operationHandle||!this._operationHandle.canUndo())}canRedo(){return!(!this._operationHandle||!this._operationHandle.canRedo())}toggleUpdateTool(){this._operationHandle&&this._operationHandle.toggleTool&&this._operationHandle.toggleTool()}async _getFirstHit(e){const i=this.view;if(!i)return this._logMissingView(),null;if(i.type==="2d"){const s=[];i.map.allLayers.forEach(a=>{a.type!=="vector-tile"&&a.type!=="imagery"||s.push(a)});const o=await i.hitTest(e,{exclude:s});return INt(o.results)}const r=[i.map.ground];i.map.allLayers.forEach(s=>{s.type==="integrated-mesh"&&r.push(s)});const n=await i.hitTest(e,{exclude:r});if(n.results.length>0){const s=n.results[0];if(s!=null&&s.type==="graphic"&&s.graphic&&(!n.ground.mapPoint||i.map.ground.opacity<1||n.ground.distance-(s.distance??0)>-Math.min(3*n.ground.distance,i.viewingMode==="global"?Tr(i.renderCoordsHelper.spatialReference).radius/i.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return s}return null}_generateViewHandles(e){return[e.on("immediate-click",async i=>{var o;const r=this.state==="active"&&((o=this._operationHandle)==null?void 0:o.type)==="create";if(this.state==="disabled"||r||!this.updateOnGraphicClick)return;this._beginAsyncOperation();const n=await i.async(()=>this._getFirstHit(uf(i)));let s=null;if(n!=null){const a=n.graphic;this.updateGraphics.includes(a)||a.layer===this.layer?(i.stopPropagation(),s=a):e.type!=="2d"||this._isComponentGraphic(a)||this.state!=="active"||this.cancel()}else this.state==="active"&&this.cancel();s==null||this.updateGraphics.includes(s)||await this.update([s],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}}),this._endAsyncOperation()},Cs.WIDGET)]}async _setupCreateOperation(e,i){const r=this.view;if(!r)return this._logMissingView(),null;const n={hasZ:r.type==="3d",...this.defaultCreateOptions,...i},s=await this._setupDrawGraphicTool(e,r,n);return s==null?null:(r.tools.add(s),r.activeTool=s,this._setupCreateOperationHandle(s))}async _setupDrawGraphicTool(e,i,r){if(e==="multipoint"&&i.type==="3d")return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!i)return this._logMissingView(),null;const n=e!=="rectangle",s=e!=="rectangle",o={view:i,mode:e==="rectangle"||e==="circle"?"hybrid":"click",...r,snapToScene:!1,geometryType:e,graphicSymbol:this._getGraphicSymbolFromTool(e),snappingManager:this._snappingManager,forceUniformSize:s,centered:n};return i.type==="2d"?this._makeDrawGraphicTool2D(o):this._makeDrawGraphicTool3D(o)}async _makeDrawGraphicTool2D(e){const i=await this._requireModule(we(()=>import("./editingTools-KuLEWRoO.js"),__vite__mapDeps([247,248,196,197,249,250,135,179,187,188,200,201,175,251,184,180,252,174,253,121])));return Ia(i)||this.destroyed?null:new i.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:xGt(e.geometryType)?this.activeFillSymbol:null,tooltipOptions:this.tooltipOptions})}async _makeDrawGraphicTool3D(e){const i=await this._requireModule(we(()=>import("./editingTools-ht4PZFTE.js"),__vite__mapDeps([254,180,182,251,184,175,190,191,164,192,178,193,194,177,195,196,197,255,198,185,249,250,135,179,187,188,200,201,252,174,207,186,253,121,256,209,126,176,189,257])));if(Ia(i)||this.destroyed)return null;const{elevationInfo:r}=this.layer;return new i.module.DrawGraphicTool3D({...e,elevationInfo:r,snapToScene:r==null||r.mode==="absolute-height",labelOptions:this.labelOptions,tooltipOptions:this.tooltipOptions})}_setupCreateOperationHandle(e){const i=this.view;if(!i)return this._logMissingView(),null;let r=null;const n=e.forceUniformSize,s=e.centered,o=[i.on("key-down",c=>{if(c.key===Ra.pan)c.stopPropagation(),c.repeat||(e.enabled=!1);else if(c.key===Ra.complete)c.stopPropagation(),e.completeCreateOperation();else if(c.key!==Ra.vertexAdd||c.repeat)c.key===Ra.undo?(c.stopPropagation(),a.undo()):c.key===Ra.redo?(c.stopPropagation(),a.redo()):c.key!==Ra.constraint||e.geometryType!=="rectangle"&&e.geometryType!=="circle"||c.repeat?c.key===Ra.center&&(c.repeat||(e.centered=!s,c.stopPropagation())):(e.forceUniformSize=!n,c.stopPropagation());else{const p=e.drawOperation.geometryType;p!=="polyline"&&p!=="polygon"&&p!=="multipoint"||(c.stopPropagation(),e.drawOperation.commitStagedVertex())}},Cs.WIDGET),i.on("key-up",c=>{c.key===Ra.pan?e.enabled=!0:c.key!==Ra.constraint||e.geometryType!=="rectangle"&&e.geometryType!=="circle"?c.key===Ra.center&&(e.centered=s,c.stopPropagation()):(e.forceUniformSize=n,c.stopPropagation())},Cs.WIDGET),e.on("vertex-add",c=>{switch(r=r==null?"start":"active",c.operation){case"apply":this.emit("create",{graphic:e.graphic,state:r,tool:this.activeTool,toolEventInfo:c,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",c=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:c.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",c=>{switch(c.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:c,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",c=>{this._set("createGraphic",c.graphic),r="complete",c.aborted?a&&a.cancel():a&&a.complete()}),_e(()=>this._getGraphicSymbolFromTool(e.geometryType),c=>{e.graphicSymbol=c})],a=new qk({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{var c;o.forEach(p=>p.remove()),o.length=0,(c=i.tools)==null||c.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return a}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":return this.polygonSymbol;case"mesh":return this.meshSymbol}}async _setupUpdateOperation(e,i){var a;const{layer:r,view:n}=this;if(!n)return this._logMissingView(),null;const s={tool:this._defaultUpdateTool,...this.defaultUpdateOptions,...i,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...i==null?void 0:i.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...i==null?void 0:i.highlightOptions}};let o=s.tool;for(const c of e)r.remove(c),r.add(c);if(n.type==="3d"){if(e.length===0)return null;switch(o){case"move":return this._setupMove3DOperation(e,s,n,o);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const c=r7(e[0]);return c===Zn.SUPPORTED?this._setupReshape3DOperation(e[0],s,n):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${LX(c)}).`),null)}case"transform":return this._setupGraphicTransform3DOperation(e,s,n)}}switch(o){case"move":return this._setupMove2DOperation(e,s,n);case"reshape":{if(e.length>1)return this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null;const c=r7(e[0]);return c===Zn.SUPPORTED?this._setupTransformOrReshape2DOperation(e,o,s,n):(this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${LX(c)}).`),null)}case"transform":if(e.length===1){const c=(a=e[0].geometry)==null?void 0:a.type;c!=="point"&&c!=="multipoint"||(o="reshape")}return this._setupTransformOrReshape2DOperation(e,o,s,n)}}async _setupMove3DOperation(e,i,r,n,s=!1){for(const _ of e){const x=cjt(_);if(x!==Zn.SUPPORTED)return this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${LX(x)}).`),null}const o=await this._requireModule(we(()=>import("./editingTools-ht4PZFTE.js"),__vite__mapDeps([254,180,182,251,184,175,190,191,164,192,178,193,194,177,195,196,197,255,198,185,249,250,135,179,187,188,200,201,252,174,207,186,253,121,256,209,126,176,189,257])));if(Ia(o))return o;const a=new o.module.GraphicMoveTool({view:r,enableZ:i.enableZ,snappingManager:this._snappingManager,tooltipOptions:this.tooltipOptions});r.tools.add(a),a.graphics.addMany(e),s||this.updateGraphics.addMany(e);const c=[],p=new Vv({activeComponent:a,tool:n,type:"update",onEnd:()=>{var _;c.forEach(x=>x.remove()),c.length=0,(_=r.tools)==null||_.remove(a),a.destroyed||a.destroy()},undo:()=>{l7(p,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:n})},redo:()=>{c7(p,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:n})},addToSelection:_=>{this.updateGraphics.push(_),a.graphics.push(_),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[_],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:_=>{const x=this.updateGraphics.indexOf(_);p.history.undo.forEach(S=>S.updates.splice(x,1)),p.history.redo.forEach(S=>S.updates.splice(x,1)),this.updateGraphics.remove(_),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[_],type:"selection-change"},type:"update"}),this.updateGraphics.length!==0?a.graphics.remove(_):p.complete()},toggleTool:async()=>{if(this.updateGraphics.length!==1||i.toggleToolOnClick===!1||n!=="transform")return;const _=this.updateGraphics.at(0);if(r7(_)!==Zn.SUPPORTED)return;p.onEnd(),p.destroy();const x=await this._setupReshape3DOperation(_,i,r,!0);Ia(x)||this._setUpdateOperationHandle(x,i)}});return c.push(...this._getHandlesForComponent(p,i),r.on("immediate-click",_=>this._getCommonUpdateOperationClickHandlers(p,_,i),Cs.WIDGET),r.on("key-down",_=>{this._getCommonUpdateOperationKeyDownHandlers(p,_)},Cs.WIDGET)),p}_setupGraphicTransform3DOperation(e,i,r,n=!1){if(e.length===1&&mjt(e[0])===Zn.SUPPORTED){const s=e[0],o=s.geometry;if(o!=null&&(o.type==="point"||o.type==="mesh"))return this._setupPointTransform3DOperation(s,i,r);if(o!=null&&(o.type==="polygon"||o.type==="polyline"))return this._setupPolyTransform3DOperation(s,i,r,n)}return this._setupMove3DOperation(e,i,r,"transform",n)}async _setupPointTransform3DOperation(e,i,r){const n="transform",{enableRotation:s,enableScaling:o,enableZ:a}=i,c=await this._requireModule(we(()=>import("./editingTools-ht4PZFTE.js"),__vite__mapDeps([254,180,182,251,184,175,190,191,164,192,178,193,194,177,195,196,197,255,198,185,249,250,135,179,187,188,200,201,252,174,207,186,253,121,256,209,126,176,189,257])));if(Ia(c))return c;const p=new c.module.GraphicTransformTool({graphic:e,view:r,enableRotation:s,enableScaling:o,enableZ:a,snappingManager:this._snappingManager,tooltipOptions:this.tooltipOptions});r.tools.add(p),this.updateGraphics.add(e);const _=[],x=new Vv({activeComponent:p,tool:n,type:"update",onEnd:()=>{var S;_.forEach(C=>C.remove()),_.length=0,(S=r.tools)==null||S.remove(p),p.destroyed||p.destroy()},undo:()=>{l7(x,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:n})},redo:()=>{c7(x,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:n})},addToSelection:async S=>{this.updateGraphics.add(S),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[S],removed:[],type:"selection-change"},type:"update"}),x.onEnd(),x.destroy();const C=await this._setupMove3DOperation(this.updateGraphics.toArray(),i,r,"transform",!0);Ia(C)||this._setUpdateOperationHandle(C,i)},removeFromSelection:S=>{this.updateGraphics.remove(S),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[S],type:"selection-change"},type:"update"}),x.complete()},toggleTool:()=>{}});return _.push(...this._getHandlesForComponent(x,i),r.on("immediate-click",S=>this._getCommonUpdateOperationClickHandlers(x,S,i),Cs.WIDGET),r.on("key-down",S=>{this._getCommonUpdateOperationKeyDownHandlers(x,S)},Cs.WIDGET)),x}async _setupPolyTransform3DOperation(e,i,r,n=!1){const s="transform",{enableRotation:o,enableScaling:a,enableZ:c,preserveAspectRatio:p}=i,_=await this._requireModule(we(()=>import("./editingTools-ht4PZFTE.js"),__vite__mapDeps([254,180,182,251,184,175,190,191,164,192,178,193,194,177,195,196,197,255,198,185,249,250,135,179,187,188,200,201,252,174,207,186,253,121,256,209,126,176,189,257])));if(Ia(_))return _;const x=new _.module.ExtentTransformTool({graphic:e,view:r,enableRotation:o,enableScaling:a,enableZ:c,preserveAspectRatio:p,tooltipOptions:this.tooltipOptions});r.tools.add(x),n||this.updateGraphics.add(e);const S=[],C=new Vv({activeComponent:x,tool:s,type:"update",onEnd:()=>{var M;S.forEach(P=>P.remove()),S.length=0,(M=r.tools)==null||M.remove(x),x.destroyed||x.destroy()},canUndo:()=>x.canUndo,undo:()=>{x.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s})},canRedo:()=>x.canRedo,redo:()=>{x.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s})},addToSelection:async M=>{this.updateGraphics.add(M),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[M],removed:[],type:"selection-change"},type:"update"}),C.onEnd(),C.destroy();const P=await this._setupMove3DOperation(this.updateGraphics.toArray(),i,r,"transform",!0);Ia(P)||this._setUpdateOperationHandle(P,i)},removeFromSelection:M=>{this.updateGraphics.remove(M),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[M],type:"selection-change"},type:"update"}),C.complete()},toggleTool:async()=>{if(this.updateGraphics.length!==1||i.toggleToolOnClick===!1)return;const M=this.updateGraphics.at(0);if(r7(M)!==Zn.SUPPORTED)return;C.onEnd(),C.destroy();const P=await this._setupReshape3DOperation(M,i,r,!0);Ia(P)||this._setUpdateOperationHandle(P,i)}});return S.push(...this._getHandlesForComponent(C,i),r.on("immediate-click",M=>this._getCommonUpdateOperationClickHandlers(C,M,i),Cs.WIDGET),r.on("key-down",M=>this._getCommonUpdateOperationKeyDownHandlers(C,M),Cs.WIDGET),r.on("key-down",M=>{M.key!==Ra.constraint||M.repeat||(x.preserveAspectRatio=!x.preserveAspectRatio,M.stopPropagation())},Cs.WIDGET),r.on("key-up",M=>{M.key===Ra.constraint&&(x.preserveAspectRatio=!x.preserveAspectRatio,M.stopPropagation())},Cs.WIDGET)),C}async _setupMove2DOperation(e,i,r){const n="move";this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const s=await this._getGraphicMover(e,i,r);if(Ia(s))return s;const o=new Vv({activeComponent:s,tool:n,type:"update",onEnd:()=>{var _;this._displayDefaultCursor(),p.forEach(x=>x.remove()),c.forEach(x=>x.remove()),p=[],c=[],s.destroy(),(_=this._internalGraphicsLayer)==null||_.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const _=this.updateGraphics.toArray();l7(o,_),o.refreshComponent(),this._emitUndoEvent({graphics:_,tool:n})},redo:()=>{const _=this.updateGraphics.toArray();c7(o,_),o.refreshComponent(),this._emitRedoEvent({graphics:_,tool:n})},addToSelection:async _=>{await this._updateSpatialReference(_),this.updateGraphics.push(_),s.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[_],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:_=>{const x=this.updateGraphics.indexOf(_);o.history.undo.forEach(C=>C.updates.splice(x,1)),o.history.redo.forEach(C=>C.updates.splice(x,1)),this.updateGraphics.remove(_);const S=this.updateGraphics.toArray();this.emit("update",{graphics:S,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[_],type:"selection-change"},type:"update"}),this.updateGraphics.length!==0?s.graphics=S:o.complete()}});let a=!1,c=[r.on("immediate-click",_=>this._getCommonUpdateOperationClickHandlers(o,_,i),Cs.WIDGET),r.on("key-down",_=>{this._getCommonUpdateOperationKeyDownHandlers(o,_),_.key!==Ra.constraint||_.repeat||(a=!0,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},Cs.WIDGET),r.on("key-up",_=>{_.key===Ra.constraint&&a&&(a=!1,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},Cs.WIDGET)],p=this._getHandlesForComponent(o,i);return o}async _setupReshape3DOperation(e,i,r,n=!1){const s="reshape",o=await this._requireModule(we(()=>import("./editingTools-ht4PZFTE.js"),__vite__mapDeps([254,180,182,251,184,175,190,191,164,192,178,193,194,177,195,196,197,255,198,185,249,250,135,179,187,188,200,201,252,174,207,186,253,121,256,209,126,176,189,257])));if(Ia(o))return o;const a=i.reshapeOptions,c=new o.module.GraphicReshapeTool({view:r,graphic:e,enableZVertex:i.enableZ&&(a==null?void 0:a.vertexOperation)==="move",enableZShape:i.enableZ&&(a==null?void 0:a.shapeOperation)==="move",enableMoveGraphic:(a==null?void 0:a.shapeOperation)==="move"||(a==null?void 0:a.shapeOperation)==="move-xy",enableMidpoints:(a==null?void 0:a.edgeOperation)==="split",enableEdgeOffset:(a==null?void 0:a.edgeOperation)==="offset",snappingManager:this._snappingManager,labelOptions:this.labelOptions,tooltipOptions:this.tooltipOptions});r.tools.add(c),n||this.updateGraphics.add(e);const p=[],_=new Vv({activeComponent:c,tool:s,type:"update",onEnd:()=>{var x;p.forEach(S=>S.remove()),p.length=0,(x=r.tools)==null||x.remove(c),c.destroyed||c.destroy()},canUndo:()=>c.canUndo,undo:()=>{c.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s})},canRedo:()=>c.canRedo,redo:()=>{c.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s})},addToSelection:async x=>{this.updateGraphics.add(x),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[x],removed:[],type:"selection-change"},type:"update"}),_.onEnd(),_.destroy();const S=await this._setupMove3DOperation(this.updateGraphics.toArray(),i,r,"transform",!0);Ia(S)||this._setUpdateOperationHandle(S,i)},removeFromSelection:x=>{this.updateGraphics.remove(x),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[x],type:"selection-change"},type:"update"}),_.complete()},toggleTool:async()=>{if(i.toggleToolOnClick===!1)return;_.onEnd(),_.destroy();const x=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),i,r,!0);Ia(x)||this._setUpdateOperationHandle(x,i)}});return p.push(...this._getHandlesForComponent(_,i),r.on("immediate-click",x=>this._getCommonUpdateOperationClickHandlers(_,x,i),Cs.WIDGET),r.on("key-down",x=>{this._getCommonUpdateOperationKeyDownHandlers(_,x)},Cs.WIDGET)),_}async _setupTransformOrReshape2DOperation(e,i,r,n){this.updateGraphics.addMany(e),await this._updateSpatialReference(e);const s=i==="transform"?await this._getBox(e,r,n):await this._getReshape(e,r,n);if(Ia(s))return s;const o=new Vv({activeComponent:s,type:"update",onEnd:()=>{c.forEach(p=>p.remove()),a.forEach(p=>p.remove()),c=[],a=[],o.activeComponent&&!o.activeComponent.destroyed&&o.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{l7(o,this.updateGraphics.toArray()),o.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:o.tool})},redo:()=>{c7(o,this.updateGraphics.toArray()),o.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:o.tool})},addToSelection:async p=>{let _=o.activeComponent;if((_==null?void 0:_.type)==="reshape"){const x=[...this.updateGraphics,p];this.updateGraphics.removeAll(),o.onEnd(),o.destroy();const S=await this._setupMove2DOperation(x,r,n);if(Ia(S))return;this._setUpdateOperationHandle(S,r)}else this.updateGraphics.add(p),_.graphics=this.updateGraphics.toArray(),_.refresh(),o.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[p],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async p=>{const _=this.updateGraphics.indexOf(p);o.history.undo.forEach(S=>S.updates.splice(_,1)),o.history.redo.forEach(S=>S.updates.splice(_,1)),this.updateGraphics.remove(p);const x=this.updateGraphics.toArray();if(x.length===0)o.complete();else{const S=x[0].geometry;x.length!==1||S==null||S.type!=="point"&&S.type!=="multipoint"?o.activeComponent.graphics=x:o.toggleTool()}this.emit("update",{graphics:x,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[p],type:"selection-change"},type:"update"})},toggleTool:async()=>{var S;if(this.updateGraphics.length>1)return;const p=this.updateGraphics.at(0),_=p.geometry;if(_!=null&&(o.tool==="reshape"&&(_.type==="point"||_.type==="multipoint")||o.tool==="transform"&&_.type==="extent"))return;let x=null;o.tool==="transform"?x=await this._getReshape([p],r,n):o.tool==="reshape"&&(x=await this._getBox([p],r,n)),Ia(x)||((S=o.activeComponent)==null||S.destroy(),o.activeComponent=x,o.activeComponent&&(c.forEach(C=>C.remove()),c=this._getHandlesForComponent(o,r)))}});let a=[n.on("immediate-click",p=>this._getCommonUpdateOperationClickHandlers(o,p,r),Cs.WIDGET),n.on("key-down",p=>{if(this._getCommonUpdateOperationKeyDownHandlers(o,p),p.key===Ra.constraint&&!p.repeat&&o){const _=o.activeComponent;_&&_.type==="box"&&(_.preserveAspectRatio=!_.preserveAspectRatio)}},Cs.WIDGET),n.on("key-up",p=>{if(p.key===Ra.constraint&&o){const _=o.activeComponent;_&&_.type==="box"&&(_.preserveAspectRatio=!_.preserveAspectRatio)}},Cs.WIDGET)],c=this._getHandlesForComponent(o,r);return o}async _getGraphicMover(e,i,r){const{enableMoveAllGraphics:n,highlightOptions:s}=i,o=await this._requireModule(we(()=>import("./GraphicMover-kaBR5sTE.js").then(a=>a.G),__vite__mapDeps([258,188,112,253,121])));return Ia(o)?o:new o.module.default({enableMoveAllGraphics:n,highlightsEnabled:!!(s!=null&&s.enabled),indicatorsEnabled:!1,graphics:e,view:r,callbacks:{onGraphicMoveStart:({dx:a,dy:c,graphic:p})=>{this._displayGrabbingCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:a,dy:c,mover:p,type:"move-start"},type:"update"})},onGraphicMove:({dx:a,dy:c,graphic:p})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:a,dy:c,mover:p,type:"move"},type:"update"}),onGraphicMoveStop:({dx:a,dy:c,graphic:p})=>{this._displayPointerCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:a,dy:c,mover:p,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayPointerCursor(),onGraphicPointerOut:()=>this._displayDefaultCursor()}})}async _getBox(e,i,r){const{enableRotation:n,enableScaling:s,highlightOptions:o,preserveAspectRatio:a}=i,c=await this._requireModule(we(()=>import("./Box-7JWnlTvk.js"),__vite__mapDeps([259,188,258,112,253,121,260,257,251,184,175,180,256])));return Ia(c)?c:new c.module.default({graphics:e,enableRotation:n,enableScaling:s,highlightsEnabled:!!(o!=null&&o.enabled),preserveAspectRatio:a,layer:this._internalGraphicsLayer,view:r,tooltipOptions:this.tooltipOptions,callbacks:{onMoveStart:p=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...p},type:"update"}),onMove:p=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...p},type:"update"}),onMoveStop:p=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...p},type:"update"}),onScaleStart:p=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...p},type:"update"}),onScale:p=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...p},type:"update"}),onScaleStop:p=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...p},type:"update"}),onRotateStart:p=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...p},type:"update"}),onRotate:p=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...p},type:"update"}),onRotateStop:p=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...p},type:"update"})}})}async _getReshape(e,i,r){var c,p,_;const n=((c=i.reshapeOptions)==null?void 0:c.edgeOperation)==="split",s=((p=i.reshapeOptions)==null?void 0:p.shapeOperation)==="move",o=!!((_=i.highlightOptions)!=null&&_.enabled),a=await this._requireModule(we(()=>import("./Reshape-c3RtsBQr.js"),__vite__mapDeps([261,248,196,197,188,258,112,253,121,260,179,251,184,175,180,256,252,174])));return Ia(a)?a:new a.module.default({enableMidpoints:n,enableMovement:s,graphic:e[0],highlightsEnabled:o,layer:this._internalGraphicsLayer,snappingManager:this._snappingManager,tooltipOptions:this.tooltipOptions,view:r,callbacks:{onReshapeStart:x=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...x},type:"update"}),onReshape:x=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...x},type:"update"}),onReshapeStop:({mover:x,type:S})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:x,type:S},type:"update"}),onMoveStart:({dx:x,dy:S,mover:C,type:M})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:x,dy:S,mover:C,type:M},type:"update"}),onMove:({dx:x,dy:S,mover:C,type:M})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:x,dy:S,mover:C,type:M},type:"update"}),onMoveStop:({dx:x,dy:S,mover:C,type:M})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:x,dy:S,mover:C,type:M},type:"update"}),onVertexAdd:({added:x,type:S,vertices:C})=>{const M=x.map(P=>ide(P.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:M,vertices:C,type:S},type:"update"})},onVertexRemove:({removed:x,type:S,vertices:C})=>{const M=x.map(P=>ide(P.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:M,vertices:C,type:S},type:"update"})}}})}_getHandlesForComponent(e,i){const r=e.activeComponent;if(!r)return[];switch(r.type){case"graphic-mover":return[r.on("graphic-click",({graphic:n,viewEvent:s})=>{var o;(o=s.native)!=null&&o.shiftKey&&(s.stopPropagation(),e.removeFromSelection(n))}),r.on("graphic-move-start",n=>e.addToHistory(G1(n.allGraphics)))];case"box":return[r.on("graphic-click",n=>this._onTransformOrReshape2DGraphicClick(e,i,n)),r.on("move-start",n=>e.addToHistory(G1(n.graphics))),r.on("rotate-start",n=>e.addToHistory(G1(n.graphics))),r.on("scale-start",n=>e.addToHistory(G1(n.graphics)))];case"reshape":return[r.on("graphic-click",n=>this._onTransformOrReshape2DGraphicClick(e,i,n)),r.on("move-start",n=>e.addToHistory(G1([n.mover]))),r.on("reshape-start",n=>e.addToHistory(G1([n.graphic]))),r.on("vertex-add",n=>e.addToHistory(G1([n.oldGraphic]))),r.on("vertex-remove",n=>e.addToHistory(G1([n.oldGraphic])))];case"move-3d":return[r.on("graphic-move-start",n=>{e.addToHistory(G1(n.allGraphics)),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:n.allGraphics.length>0?n.allGraphics[0]:null,type:"move-start"},type:"update"})}),r.on("graphic-move",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:n.dx,dy:n.dy,mover:n.allGraphics.length>0?n.allGraphics[0]:null,type:"move"},type:"update"})}),r.on("graphic-move-stop",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:n.allGraphics.length>0?n.allGraphics[0]:null,type:"move-stop"},type:"update"})}),r.on("immediate-click",n=>{n.shiftKey?this._toggleSelection([n.graphic],e,i):e.toggleTool()})];case"transform-3d":return[r.on("record-undo",({record:n})=>{e.addToHistory({updates:[n]})}),r.on("graphic-translate-start",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,dx:n.dxScreen,dy:n.dyScreen,type:"move-start"},type:"update"})}),r.on("graphic-translate-stop",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,dx:n.dxScreen,dy:n.dyScreen,type:"move-stop"},type:"update"})}),r.on("graphic-rotate-start",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,angle:n.angle,type:"rotate-start"},type:"update"})}),r.on("graphic-rotate-stop",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,angle:n.angle,type:"rotate-stop"},type:"update"})}),r.on("graphic-scale-start",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,xScale:n.xScale,yScale:n.yScale,type:"scale-start"},type:"update"})}),r.on("graphic-scale-stop",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,xScale:n.xScale,yScale:n.yScale,type:"scale-stop"},type:"update"})}),r.on("graphic-translate",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,dx:n.dxScreen,dy:n.dyScreen,type:"move"},type:"update"})}),r.on("graphic-rotate",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,angle:n.angle,type:"rotate"},type:"update"})}),r.on("graphic-scale",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:n.graphic,xScale:n.xScale,yScale:n.yScale,type:"scale"},type:"update"})}),r.on("immediate-click",n=>{n.shiftKey?this._toggleSelection([n.graphic],e,i):e.toggleTool()})];case"reshape-3d":return[r.on("reshape",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:n,type:"update"})}),r.on("move",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:n,type:"update"})}),r.on("vertex-add",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:n,type:"update"})}),r.on("vertex-remove",n=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:n,type:"update"})}),r.on("immediate-click",n=>{n.shiftKey?this._toggleSelection([n.graphic],e,i):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,i,r){var o;const{graphic:n,viewEvent:s}=r;return(o=s.native)!=null&&o.shiftKey&&n.layer===this.layer?(s.stopPropagation(),e.removeFromSelection(n)):i.toggleToolOnClick?(s.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,i){var s;this._operationHandle=e;const r=(s=this.view)==null?void 0:s.map;this._disablePopup(i);const n=()=>{if(e===this._operationHandle){const o=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),r&&r.remove(this._internalGraphicsLayer),this._restorePopup(i),this.emit("update",{graphics:o,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",n)}async _getCommonUpdateOperationClickHandlers(e,i,r){const n=uf(i),s=await i.async(()=>this._getFirstHit(n));if(s==null)return void e.complete();if(i.native.shiftKey&&this._toggleSelection([s.graphic],e,r))return void i.stopPropagation();this.updateGraphics.includes(s.graphic)?i.stopPropagation():e.complete()}_toggleSelection(e,i,r){const n=!!r.multipleSelectionEnabled;return e.some(s=>s!=null&&!(!n||s.layer!==this.layer)&&(this.updateGraphics.includes(s)?i.removeFromSelection(s):i.addToSelection(s),!0))}_getCommonUpdateOperationKeyDownHandlers(e,i){if(!e)return;const r=i.key;r===Ra.undo&&e.canUndo()?(i.stopPropagation(),e.undo()):r===Ra.redo&&e.canRedo()?(i.stopPropagation(),e.redo()):r===Ra.cancel?(i.stopPropagation(),e.cancel()):this.allowDeleteKey&&Ra.delete.includes(r)&&this._onDeleteKey(i)}_onDeleteKey(e){var n;if(!this._operationHandle||this._operationHandle.type!=="update")return;const i=this.activeComponent,r=this.updateGraphics.toArray();i!=null&&i.type!=="reshape-3d"&&(i.type!=="reshape"||r.length===1&&((n=r[0].geometry)==null?void 0:n.type)==="point")&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){var e,i;this._internalGraphicsLayer&&((i=(e=this.view)==null?void 0:e.map)==null||i.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=et(this._internalGraphicsLayer))}_isComponentGraphic(e){var r;const{activeComponent:i}=this;return!(!e||i==null)&&(((r=e.attributes)==null?void 0:r.esriSketchTool)||i.type==="draw-2d"&&i.graphic===e||(i.type==="box"||i.type==="reshape")&&i.isUIGraphic(e))}_displayPointerCursor(){var e;(e=this.view)!=null&&e.container&&this.view.cursor!=="pointer"&&(this.view.cursor="pointer")}_displayGrabbingCursor(){var e;(e=this.view)!=null&&e.container&&this.view.cursor!=="grabbing"&&(this.view.cursor="grabbing")}_displayDefaultCursor(){var e;(e=this.view)!=null&&e.container&&this.view.cursor!==null&&(this.view.cursor=null)}_logError(e,i,r){Ce.getLogger(this).error(new se(e,i,r))}async _requireModule(e){const i=new AbortController;this._moduleLoaderAbortController=i;const r=await e;return this._moduleLoaderAbortController!==i||i.signal.aborted?{requireError:"aborted"}:{module:r}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}get test(){return{operationHandle:this._operationHandle,snappingManager:this._snappingManager,defaultUpdateOptions:KR}}wait(){return dd(()=>!this.updating)}_beginAsyncOperation(){this._numUpdating+=1,this.notifyChange("updating")}_endAsyncOperation(){this._numUpdating-=1,this.notifyChange("updating")}_disablePopupEnabled(e){var i;return((i=this.view)==null?void 0:i.type)!=="3d"||this.updateOnGraphicClick||((e==null?void 0:e.toggleToolOnClick)??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&this._originalPopupEnabled==null&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&this._originalPopupEnabled!=null&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(vn(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await dT(dd(()=>e==null?void 0:e.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",Xxe("view"))}_logMissingLayer(){this._logError(wGt,Xxe("layer"))}};y([w()],Vs.prototype,"updating",null),y([w()],Vs.prototype,"_operationHandle",void 0),y([w({readOnly:!0})],Vs.prototype,"activeTool",null),y([w()],Vs.prototype,"activeFillSymbol",void 0),y([w()],Vs.prototype,"activeLineSymbol",void 0),y([w()],Vs.prototype,"activeVertexSymbol",void 0),y([w()],Vs.prototype,"allowDeleteKey",void 0),y([w({readOnly:!0})],Vs.prototype,"createGraphic",null),y([w()],Vs.prototype,"defaultCreateOptions",null),y([w()],Vs.prototype,"defaultUpdateOptions",null),y([w({type:OBe,nonNullable:!0})],Vs.prototype,"labelOptions",void 0),y([w()],Vs.prototype,"layer",void 0),y([w({types:_y})],Vs.prototype,"pointSymbol",void 0),y([w({types:_y})],Vs.prototype,"polygonSymbol",void 0),y([w({types:_y})],Vs.prototype,"polylineSymbol",void 0),y([w()],Vs.prototype,"meshSymbol",void 0),y([w({type:Kue,nonNullable:!0})],Vs.prototype,"snappingOptions",null),y([w()],Vs.prototype,"_snappingManager",void 0),y([w({readOnly:!0})],Vs.prototype,"state",null),y([w({type:PBe,nonNullable:!0})],Vs.prototype,"tooltipOptions",void 0),y([w({readOnly:!0})],Vs.prototype,"updateGraphics",void 0),y([w()],Vs.prototype,"updateOnGraphicClick",void 0),y([w({types:_y})],Vs.prototype,"vertexSymbol",void 0),y([w({value:null})],Vs.prototype,"view",null),Vs=y([Z("esri.widgets.Sketch.SketchViewModel")],Vs);const wGt="sketch:missing-property",Xxe=t=>`Property '${t}' is missing on SketchViewModel.`;function xGt(t){return t==="polygon"||t==="rectangle"||t==="circle"}function l7(t,e){rje("undo",t.history.undo,t.history.redo,e)}function c7(t,e){rje("redo",t.history.redo,t.history.undo,e)}function rje(t,e,i,r){const n=e.pop();if(!n)return;const s=n.updates,o=[];r.forEach((a,c)=>{const p=s[c];p!=null&&("geometry"in p&&p.geometry!=null&&(o.push({geometry:a.geometry}),a.geometry=p.geometry),"symbol"in p&&p.symbol!=null&&(o.push({symbol:a.symbol}),a.symbol=p.symbol),"undo"in p&&(o.push(p),p[t](a)))}),i.push({updates:o})}function G1(t){return{updates:t.map(e=>({geometry:e.geometry}))}}function Ia(t){return"requireError"in t&&t.requireError==="aborted"}const nje=Vs,Que=[82,82,122,.9],ehe=[255,255,255,.8],SGt={type:"polygon-3d",symbolLayers:[{type:"extrude",size:10,material:{color:ehe},edges:{type:"solid",size:"3px",color:Que}}]},TGt={type:"line-3d",symbolLayers:[{type:"line",size:"10px",material:{color:ehe}},{type:"line",size:"3px",material:{color:Que}}]},EGt={type:"point-3d",symbolLayers:[{type:"icon",size:"30px",resource:{primitive:"kite"},outline:{color:Que,size:"3px"},material:{color:ehe}}]},CGt=(t,e)=>{const i=document.getElementById("startbuttons"),r=document.getElementById("actionbuttons"),n=document.getElementById("edgeoperationbuttons"),s=document.getElementById("extrudeSliderContainer"),o=new WG({container:"extrudeSlider",precision:1,min:0,max:500,steps:1,values:[10],visibleElements:{rangeLabels:!0}}),a=new nje({layer:e,view:t,pointSymbol:EGt,polygonSymbol:SGt,polylineSymbol:TGt,defaultCreateOptions:{hasZ:!0},snappingOptions:{enabled:!0,featureSources:[{layer:e}]},tooltipOptions:{enabled:!0},labelOptions:{enabled:!0},defaultUpdateOptions:{tool:"transform",enableScaling:!0,enableZ:!0}});a.on("create",G=>{G.state==="complete"&&(i.style.display="inline",r.style.display="none",a.update(G.graphic)),G.state==="cancel"&&(i.style.display="inline",r.style.display="none")}),a.on("update",G=>{G.state==="start"&&(i.style.display="none",r.style.display="inline",(G.graphics[0].geometry.type==="polygon"||G.graphics[0].geometry.type==="polyline")&&(n.style.display="inline"),G.graphics[0].geometry.type==="polyline"&&(s.style.display="none")),G.state==="complete"&&(i.style.display="inline",r.style.display="none",n.style.display="none")});const c=Array.prototype.slice.call(document.getElementsByClassName("starttool")),p=document.getElementById("cancel"),_=document.getElementById("done");c.forEach(G=>{G.addEventListener("click",Y=>{a.create(Y.target.getAttribute("data-type")),i.style.display="none",r.style.display="inline"})}),p.addEventListener("click",G=>{a.cancel()}),_.addEventListener("click",G=>{a.updateGraphics.length!==0?a.complete():a.cancel()}),o.on(["thumb-change","thumb-drag"],x);function x(G){const Y=G.value;document.getElementById("extrude").innerHTML=Y;const Q=a.layer.graphics.getItemAt(a.layer.graphics.length-1),ne=Q.symbol.clone();ne.symbolLayers.items[0].size=Y,Q.symbol=ne}let S="split",C="move";const M=document.getElementById("none-edge-button"),P=document.getElementById("split-edge-button"),$=document.getElementById("offset-edge-button");M.onclick=F,P.onclick=F,$.onclick=F;function F(G){S=G.target.value;const Y=document.getElementsByClassName("edge-button");for(const Q of Y)Q.classList.remove("edge-button-selected");this.classList.add("edge-button-selected"),j({reshapeOptions:{edgeOperation:S,shapeOperation:C}})}const z=document.getElementById("none-shape-button"),k=document.getElementById("move-shape-button");z.onclick=U,k.onclick=U;function U(G){C=G.target.value;const Y=document.getElementsByClassName("shape-button");for(const Q of Y)Q.classList.remove("shape-button-selected");this.classList.add("shape-button-selected"),j({reshapeOptions:{edgeOperation:S,shapeOperation:C}})}function j(G){a.defaultUpdateOptions={...a.defaultUpdateOptions,...G},a.activeTool&&(a.activeTool==="transform"||a.activeTool==="move"||a.activeTool==="reshape")&&(G.tool=a.activeTool,a.update(a.updateGraphics.toArray(),G))}},Sv="esri-daylight",GX=`${Sv}__container`,uA="esri-slider",Hc={base:Sv,widgetIcon:oi.environmentSettings,datePickerCalendarToggle:"esri-date-picker__calendar-toggle",dayContainer:`${GX} ${Sv}__day-container`,dateContainer:`${GX} ${Sv}__date-container`,containerDisabled:`${GX}--disabled`,slider:uA,sliderShadowOff:`${uA}--shadow-off`,sliderShadowOn:`${uA}--shadow-on`,sliderAmPmOn:`${uA}--ampm-on`,sliderDateOff:`${uA}--date-off`,sliderDateOn:`${uA}--date-on`,playPauseButton:`${Sv}__play-pause-button`,seasonPicker:`${Sv}__season-picker`,panelError:`${Sv}__panel--error`,sunLightingCheckbox:`${Sv}__sun-lighting-checkbox`,shadowsCheckbox:`${Sv}__shadows-checkbox`};var Ay;(function(t){t[t.NORTHERN=0]="NORTHERN",t[t.SOUTHERN=1]="SOUTHERN"})(Ay||(Ay={}));const AGt={spring:{dayOfMonth:20,month:2},summer:{dayOfMonth:21,month:5},fall:{dayOfMonth:23,month:8},winter:{dayOfMonth:21,month:11}},Gre=["spring","summer","fall","winter"];function W4(t,e,i){const r=the(e,i),{dayOfMonth:n,month:s}=AGt[r],o=new Date(t.getTime());return o.setMonth(s,n),o}function MGt(t,e){return the(OGt(t),e)}function OGt(t){const e=t.getTime(),i=W4(t,"spring",Ay.NORTHERN).getTime(),r=W4(t,"summer",Ay.NORTHERN).getTime(),n=W4(t,"fall",Ay.NORTHERN).getTime(),s=W4(t,"winter",Ay.NORTHERN).getTime();return e>=i&&e=r&&e=n&&e=x&&c<=S?P=c-x<=12e5?18e5-(c-x)/12e5*16e5:S-c<=12e5/2?3e5-(S-c)/12e5*2*1e5:2e5:c>=C&&c<=M?P=c-C<=12e5/2?3e5-(c-C)/12e5*2*1e5:M-c<=12e5?18e5-(M-c)/12e5*16e5:2e5:(c_)&&(P=18e5),P}let uT=class extends BUe{constructor(){super(...arguments),this.utcOffset=null,this.timezonePickerOpen=!1}};y([w()],uT.prototype,"utcOffset",void 0),y([w()],uT.prototype,"timezonePickerOpen",void 0),uT=y([Z("esri.widgets.Daylight.support.SliderWithDropdownViewModel")],uT);let Y4=class extends ze{constructor(){super(...arguments),this.state="ready",this.value=new Date}};y([w()],Y4.prototype,"state",void 0),y([w()],Y4.prototype,"value",void 0),Y4=y([Z("esri.widgets.support.DateTimeElementViewModel")],Y4);const LGt=Y4;let Hre=class extends LGt{constructor(e){super(e)}};Hre=y([Z("esri.widgets.support.DatePickerViewModel")],Hre);const iH=Hre,DGt={hour:"2-digit",minute:"2-digit",timeZone:"UTC"},NGt={hour:"numeric",timeZone:"UTC"};function qre(t,e){let i;if(e==="tick"){const n=Math.round(Hs(t,"minutes","hours"));i=new Date(Hs(n,"hours","milliseconds"))}else i=new Date(6e4*t);let r=Gs(i,DGt);return t!==0&&r==="00:00"&&(r="24:00"),e==="tick"&&r.includes(" ")&&(r=Gs(i,NGt),r=r.replace(":00","")),r}function FGt(t,e,i,r){if(e==null||i==null)return null;const n=X2.getTimes(t,e,i),s=n.sunrise,o=n.sunset,a=Df(t,r,"hours"),c=Df(s,r,"hours"),p=Df(o,r,"hours");if(a.getUTCDate()!==c.getUTCDate()||a.getUTCDate()!==p.getUTCDate()){const _=a.getTime()-c.getTime()>0?1:-1;s.setUTCDate(s.getUTCDate()+_),o.setUTCDate(o.getUTCDate()+_)}return{sunrise:s,sunset:o}}function kGt(t){return[{utcOffset:-12,short:"UTC-12",long:t.timezoneDateline},{utcOffset:-11,short:"UTC-11",long:t.timezoneSamoa},{utcOffset:-10,short:t.timezoneHAST,long:t.timezoneHawaii},{utcOffset:-9,short:t.timezoneAKST,long:t.timezoneAlaska},{utcOffset:-8,short:t.timezonePST,long:t.timezoneBaja},{utcOffset:-7,short:t.timezoneMST,long:t.timezoneMountain},{utcOffset:-7,short:t.timezoneMST,long:t.timezoneLaPaz},{utcOffset:-7,short:t.timezoneMST,long:t.timezoneArizona},{utcOffset:-6,short:t.timezoneCST,long:t.timezoneSaskatchewan},{utcOffset:-6,short:t.timezoneCST,long:t.timezoneCentralAmerica},{utcOffset:-6,short:t.timezoneCST,long:t.timezoneCentralTime},{utcOffset:-6,short:t.timezoneCST,long:t.timezoneMexico},{utcOffset:-5,short:t.timezoneEST,long:t.timezoneEasternUS},{utcOffset:-5,short:t.timezoneEST,long:t.timezoneLima},{utcOffset:-5,short:t.timezoneEST,long:t.timezoneIndiana},{utcOffset:-4,short:null,long:t.timezoneAtlantic},{utcOffset:-4,short:null,long:t.timezoneCuiaba},{utcOffset:-4,short:null,long:t.timezoneSantiago},{utcOffset:-4,short:null,long:t.timezoneManaus},{utcOffset:-4,short:null,long:t.timezoneAsuncion},{utcOffset:-3,short:null,long:t.timezoneBrasilia},{utcOffset:-3,short:null,long:t.timezoneGreenland},{utcOffset:-3,short:null,long:t.timezoneMontevideo},{utcOffset:-3,short:null,long:t.timezoneCayenne},{utcOffset:-3,short:null,long:t.timezoneBuenosAires},{utcOffset:-2,short:null,long:t.timezoneMidAtlantic},{utcOffset:-1,short:null,long:t.timezoneAzores},{utcOffset:-1,short:null,long:t.timezoneCaboVerde},{utcOffset:0,short:null,long:t.timezoneDublin},{utcOffset:0,short:null,long:t.timezoneReykjavik},{utcOffset:0,short:null,long:t.timezoneCasablanca},{utcOffset:1,short:t.timezoneCET,long:t.timezoneBelgrade},{utcOffset:1,short:t.timezoneCET,long:t.timezoneSarajevo},{utcOffset:1,short:t.timezoneCET,long:t.timezoneBrussels},{utcOffset:1,short:t.timezoneCET,long:t.timezoneWCAfrica},{utcOffset:1,short:t.timezoneCET,long:t.timezoneAmsterdam},{utcOffset:1,short:t.timezoneCET,long:t.timezoneWindhoek},{utcOffset:2,short:t.timezoneEET,long:t.timezoneMinsk},{utcOffset:2,short:t.timezoneEET,long:t.timezoneCairo},{utcOffset:2,short:t.timezoneEET,long:t.timezoneHelsinki},{utcOffset:2,short:t.timezoneEET,long:t.timezoneAthens},{utcOffset:2,short:t.timezoneEET,long:t.timezoneJerusalem},{utcOffset:2,short:t.timezoneEET,long:t.timezoneAmman},{utcOffset:2,short:t.timezoneEET,long:t.timezoneBeirut},{utcOffset:2,short:t.timezoneEET,long:t.timezoneHarare},{utcOffset:2,short:t.timezoneEET,long:t.timezoneDamascus},{utcOffset:2,short:t.timezoneEET,long:t.timezoneIstanbul},{utcOffset:3,short:t.timezoneMSK,long:t.timezoneKuwait},{utcOffset:3,short:t.timezoneMSK,long:t.timezoneBaghdad},{utcOffset:3,short:t.timezoneMSK,long:t.timezoneNairobi},{utcOffset:3,short:t.timezoneMSK,long:t.timezoneKaliningrad},{utcOffset:4,short:t.timezoneGST,long:t.timezoneMoscow},{utcOffset:4,short:t.timezoneGST,long:t.timezoneMuscat},{utcOffset:4,short:t.timezoneGST,long:t.timezoneBaku},{utcOffset:4,short:t.timezoneGST,long:t.timezoneYerevan},{utcOffset:4,short:t.timezoneGST,long:t.timezoneTbilisi},{utcOffset:4,short:t.timezoneGST,long:t.timezonePortLouis},{utcOffset:5,short:null,long:t.timezoneTashkent},{utcOffset:5,short:null,long:t.timezoneIslamabad},{utcOffset:6,short:null,long:t.timezoneEkaterinburg},{utcOffset:6,short:null,long:t.timezoneAstana},{utcOffset:6,short:null,long:t.timezoneDhaka},{utcOffset:7,short:t.timezoneICT,long:t.timezoneNovosibirsk},{utcOffset:7,short:t.timezoneICT,long:t.timezoneBangkok},{utcOffset:8,short:t.timezoneCCT,long:t.timezoneKrasnoyarsk},{utcOffset:8,short:t.timezoneCCT,long:t.timezoneBeijing},{utcOffset:8,short:t.timezoneCCT,long:t.timezoneSingapore},{utcOffset:8,short:t.timezoneCCT,long:t.timezoneTaipei},{utcOffset:8,short:t.timezoneCCT,long:t.timezonePerth},{utcOffset:8,short:t.timezoneCCT,long:t.timezoneUlaanbaatar},{utcOffset:9,short:t.timezoneJST,long:t.timezoneIrkutsk},{utcOffset:9,short:t.timezoneJST,long:t.timezoneSeoul},{utcOffset:9,short:t.timezoneJST,long:t.timezoneOsaka},{utcOffset:10,short:t.timezoneAEST,long:t.timezoneYakutsk},{utcOffset:10,short:t.timezoneAEST,long:t.timezoneCanberra},{utcOffset:10,short:t.timezoneAEST,long:t.timezoneBrisbane},{utcOffset:10,short:t.timezoneAEST,long:t.timezoneHobart},{utcOffset:10,short:t.timezoneAEST,long:t.timezoneGuam},{utcOffset:11,short:null,long:t.timezoneVladivostok},{utcOffset:11,short:null,long:t.timezoneSolomon},{utcOffset:12,short:t.timezoneNZST,long:t.timezoneMagadan},{utcOffset:12,short:t.timezoneNZST,long:t.timezoneFiji},{utcOffset:12,short:t.timezoneNZST,long:t.timezoneAuckland},{utcOffset:12,short:t.timezoneNZST,long:t.timezoneNukualofa}].map(({utcOffset:e,short:i,long:r})=>{const n=e>0?`UTC+${e}`:e<0?`UTC${e}`:"GMT";return i?{utcOffset:e,short:i,shortWithUTC:`${n} (${i})`,long:r}:{utcOffset:e,short:n,shortWithUTC:n,long:r}})}const sje="esri.widgets.Daylight.DaylightViewModel";let hs=class extends ze{constructor(e){super(e),this.view=null,this.datePickerViewModel=new iH,this.timeSliderViewModel=new uT({min:0,max:1439,values:[0],labelFormatFunction:qre,inputFormatFunction:qre}),this.lightingUpdateInterval=200,this._oldLighting=null,this.playSpeedMultiplier=1,this._lastTime=null,this._sunrise=null,this._sunset=null,this._cachedLightingDateUTC=new Date(0),this._cachedDisplayUTCOffset=0,this._firstInteraction=!0,this._lastLightingUpdate=0,this._lightingUpdateHandle=null}initialize(){this.addHandles([Oo(()=>this.view,e=>e.when(()=>this._updateLighting()),Qt),_e(()=>{const e=this._lighting;return(e==null?void 0:e.type)==="sun"?u7(e):null},e=>this._scheduleLightingUpdate(e)),Jr(()=>this._lighting,"timezone-will-change",e=>this._timezoneWillChange(e),{onListenerAdd:()=>this._timezoneWillChange(null)}),_e(()=>{var e;return((e=this.view)==null?void 0:e.stationary)===!0},()=>{(this.dayPlaying||this.yearPlaying)&&this._updateSunriseAndSunset()},Qt),_e(()=>{const e=this.timeSliderViewModel;return{vm:e,state:e.state,sliderPosition:this.timeSliderPosition}},({vm:e,state:i,sliderPosition:r})=>{i==="ready"&&e.setValue(0,r)}),_e(()=>{var e;return(e=this.timeSliderViewModel)==null?void 0:e.utcOffset},e=>{e!=null&&(this.utcOffset=e)}),_e(()=>({utcOffset:this.utcOffset,sliderViewModel:this.timeSliderViewModel}),({utcOffset:e,sliderViewModel:i})=>{i&&(i.utcOffset=e)},kt),_e(()=>this.timeSliderViewModel.timezonePickerOpen,()=>this.stopPlaying()),_e(()=>this.timeSliderViewModel.values,e=>this._setTimeSliderPosition((e==null?void 0:e[0])??0,{forceLightingUpdate:!1})),_e(()=>this.datePickerViewModel.value,e=>{this.dayPlaying=!1,this.localDate=e}),_e(()=>this.localDate,e=>{this.datePickerViewModel.value.valueOf()!==e.getTime()&&this.datePickerViewModel.set("value",e)})])}destroy(){this._cancelLightingUpdate(),this.view=null}get isSupported(){return this.view==null||this.view.type==="3d"}get utcOffset(){return this._cachedDisplayUTCOffset}set utcOffset(e){e!==this.utcOffset&&this._lighting!=null&&this._lighting.type!=="virtual"&&(this._lighting.displayUTCOffset=e,this._updateLighting())}get localDate(){return Jrt(this._lightingDateDisplay)}set localDate(e){uF(e)&&e.getTime()!==this.localDate.getTime()&&(this._lightingDateDisplay=Zrt(this._lightingDateDisplay,e))}get timeSliderPosition(){return IGt(this._lightingDateDisplay)}set timeSliderPosition(e){this._setTimeSliderPosition(e,{forceLightingUpdate:!0})}_setTimeSliderPosition(e,i){Math.abs(e-this.timeSliderPosition)<=1/60||(this.stopPlaying(),this._enableDirectShadowsIfFirstInteraction(),i.forceLightingUpdate&&(this._cancelLightingUpdate(),this._updateLighting()),this._lightingDateDisplay=RGt(this._lightingDateDisplay,e))}_timezoneFromCamera(e,i){if(i==null||!e.cameraTrackingEnabled)return 0;const r=Mee([i.longitude,i.latitude]);return r==null?0:Math.round(r.hours+r.minutes/60+r.seconds/3600)}get directShadowsEnabled(){var e;return((e=this._lighting)==null?void 0:e.directShadowsEnabled)??!1}set directShadowsEnabled(e){const i=this._lighting;i&&(i.directShadowsEnabled=e)}get sunLightingEnabled(){return this._lightingType==="sun"}set sunLightingEnabled(e){const i=this._environment;if(e===this._get("sunLightingEnabled")||i==null)return;const r=i.lighting,n=this._oldLighting;this._oldLighting=r;const s={directShadowsEnabled:r.directShadowsEnabled,cameraTrackingEnabled:r.cameraTrackingEnabled},o=e?"sun":"virtual";let a;a=n!=null&&n.type===o?n:e?new zv:new VM,a.set(s),i.lighting=a,e||(this.stopPlaying(),this.timeSliderViewModel.timezonePickerOpen=!1)}set playingState(e){this.playingState!==e&&(this._set("playingState",e),e!=="none"&&this.sunLightingEnabled&&(this._updateSunriseAndSunset(),this._lastTime=Date.now(),this._play(),this._enableDirectShadowsIfFirstInteraction()))}get dayPlaying(){return this.playingState==="day"}set dayPlaying(e){e?this.playingState="day":this.dayPlaying&&(this.playingState="none")}get yearPlaying(){return this.playingState==="year"}set yearPlaying(e){e?this.playingState="year":this.yearPlaying&&(this.playingState="none")}get currentSeason(){return MGt(this.localDate,this._currentHemisphere)}set currentSeason(e){this.stopPlaying();const i=the(e,this._currentHemisphere);this.localDate=W4(this.localDate,i,Ay.NORTHERN)}get _currentHemisphere(){var i,r,n;const e=(n=(r=(i=this.view)==null?void 0:i.camera)==null?void 0:r.position)==null?void 0:n.latitude;return e==null||e>=0?Ay.NORTHERN:Ay.SOUTHERN}get _environment(){var e;return(e=this.view)==null?void 0:e.environment}get _lighting(){var e;return(e=this._environment)==null?void 0:e.lighting}get _lightingType(){var e;return(e=this._lighting)==null?void 0:e.type}get _lightingDateDisplay(){return Df(this._cachedLightingDateUTC,this._cachedDisplayUTCOffset,"hours")}set _lightingDateDisplay(e){const i=this._lighting;if(i==null||!this.sunLightingEnabled||i.type==="virtual"||!uF(e))return;const r=u7(i),n=Df(e,-this._cachedDisplayUTCOffset,"hours");n.getTime()!==r.getTime()&&(i.date=n,this._updateLighting())}stopPlaying(){this.playingState="none"}toggleDayPlaying(){this.dayPlaying=!this.dayPlaying}toggleYearPlaying(){this.yearPlaying=!this.yearPlaying}toggleSunLightingEnabled(){this.stopPlaying(),this.sunLightingEnabled=!this.sunLightingEnabled}toggleDirectShadowsEnabled(){this.stopPlaying(),this.directShadowsEnabled=!this.directShadowsEnabled}_enableDirectShadowsIfFirstInteraction(){this._firstInteraction&&(this._firstInteraction=!1,this.directShadowsEnabled=!0)}_updateLighting(e){var a;const i=Date.now();this._lastLightingUpdate=i;const{view:r}=this,n=this._lighting;if(r==null||n==null||n.type==="virtual")return;e??(e=u7(n));const s=n.displayUTCOffset,o=s!==null?s:this._timezoneFromCamera(n,(a=r.camera)==null?void 0:a.position);this._cachedLightingDateUTC.getTime()!==e.getTime()&&(this._cachedLightingDateUTC=new Date(e.getTime())),this._cachedDisplayUTCOffset!==o&&(this._cachedDisplayUTCOffset=o)}_timezoneWillChange(e){const i=this._lighting;if(i==null||i.type==="virtual"||!i.cameraTrackingEnabled)return;let r;if(e)r=e.timezoneOffset;else{if(i.displayUTCOffset!=null)return;r=zv.calculateTimezoneOffset(i.positionTimezoneInfo)}i.displayUTCOffset=r,this._scheduleLightingUpdate()}_scheduleLightingUpdate(e){if(e&&(this._lightingUpdateHandle=en(this._lightingUpdateHandle),!uF(e))||this._lightingUpdateHandle)return;const i=Date.now()-this._lastLightingUpdate,r=this.lightingUpdateInterval-i;let n=null;const s=()=>{this._updateLighting(e),this._lightingUpdateHandle===n&&(this._lightingUpdateHandle=null)};if(r<=0)this._lightingUpdateHandle=n=ox(s);else{const o=setTimeout(s,r);this._lightingUpdateHandle=n=rr(()=>clearTimeout(o))}}_cancelLightingUpdate(){this._lightingUpdateHandle=en(this._lightingUpdateHandle)}_play(){const e=this._lighting;if(e==null||!this.sunLightingEnabled||e.type==="virtual")return;const i=u7(e);if(this.dayPlaying||this.yearPlaying){const r=Date.now()-(this._lastTime??0);if(this.dayPlaying){this._lastTime=Date.now();const n=$Gt(this._sunrise,this._sunset,i)*this.playSpeedMultiplier/100*r;if(n>0){let s=new Date(i.getTime()+n);const o=e.displayUTCOffset??0;((s.getUTCHours()+o)%24+24)%24<((i.getUTCHours()+o)%24+24)%24&&(s=new Date(i.getTime()+n-864e5)),e.date=s}}else if(r>1e3){this._lastTime=Date.now();const n=(i.getUTCMonth()+1)%12,s=new Date(i.getTime());s.setUTCMonth(n),e.date=s}requestAnimationFrame(()=>this._play())}}_updateSunriseAndSunset(){var c,p;const e=this._lighting;if(e==null||e.type==="virtual"||!this.sunLightingEnabled)return;const i=(p=(c=this.view)==null?void 0:c.camera)==null?void 0:p.position;if(i==null)return;const{latitude:r,longitude:n}=i,{date:s,displayUTCOffset:o}=e,a=FGt(s,r,n,o??0);a&&(this._sunrise=new Date(a.sunrise),this._sunset=new Date(a.sunset))}};function u7(t){return uF(t.date)||(Ce.getLogger(sje).warn("Invalid date. Reverting to the current date/time."),t.date=new Date),t.date}y([w({type:aUe})],hs.prototype,"view",void 0),y([w({type:iH,nonNullable:!0})],hs.prototype,"datePickerViewModel",void 0),y([w({type:uT,nonNullable:!0})],hs.prototype,"timeSliderViewModel",void 0),y([w()],hs.prototype,"isSupported",null),y([w()],hs.prototype,"lightingUpdateInterval",void 0),y([w()],hs.prototype,"utcOffset",null),y([w()],hs.prototype,"localDate",null),y([w()],hs.prototype,"timeSliderPosition",null),y([w()],hs.prototype,"directShadowsEnabled",null),y([w()],hs.prototype,"sunLightingEnabled",null),y([w({type:["none","day","year"],value:"none"})],hs.prototype,"playingState",null),y([w()],hs.prototype,"dayPlaying",null),y([w()],hs.prototype,"yearPlaying",null),y([w()],hs.prototype,"playSpeedMultiplier",void 0),y([w()],hs.prototype,"currentSeason",null),y([w()],hs.prototype,"_lastTime",void 0),y([w()],hs.prototype,"_sunrise",void 0),y([w()],hs.prototype,"_sunset",void 0),y([w()],hs.prototype,"_cachedLightingDateUTC",void 0),y([w()],hs.prototype,"_cachedDisplayUTCOffset",void 0),y([w()],hs.prototype,"_firstInteraction",void 0),y([w()],hs.prototype,"_currentHemisphere",null),y([w()],hs.prototype,"_environment",null),y([w()],hs.prototype,"_lighting",null),y([w()],hs.prototype,"_lightingType",null),y([w()],hs.prototype,"_lightingDateDisplay",null),hs=y([Z(sje)],hs);const oje=hs;let Tv=class extends ze{constructor(e){super(e),this.header=!0,this.playButtons=!0,this.datePicker=!0,this.timezone=!0,this.sunLightingToggle=!0,this.shadowsToggle=!0}};y([w({type:Boolean,nonNullable:!0})],Tv.prototype,"header",void 0),y([w({type:Boolean,nonNullable:!0})],Tv.prototype,"playButtons",void 0),y([w({type:Boolean,nonNullable:!0})],Tv.prototype,"datePicker",void 0),y([w({type:Boolean,nonNullable:!0})],Tv.prototype,"timezone",void 0),y([w({type:Boolean,nonNullable:!0})],Tv.prototype,"sunLightingToggle",void 0),y([w({type:Boolean,nonNullable:!0})],Tv.prototype,"shadowsToggle",void 0),Tv=y([Z("esri.widgets.Daylight.VisibleElements")],Tv);const aje=Tv,h7="esri-timezone-picker",QR={base:h7,trigger:`${h7}__trigger`,itemTitle:`${h7}__item-title`,itemDescription:`${h7}__item_description`};let Zd=class extends hn{constructor(e,i){super(e,i),this.value=null,this.onChange=null,this.open=!1,this.onOpen=null,this.onClose=null,this._selectedId=null,this._onOpen=()=>{var r;this.open=!0,(r=this.onOpen)==null||r.call(this)},this._onClose=()=>{var r;this.open=!1,(r=this.onClose)==null||r.call(this)},this._killEvent=r=>(r.stopPropagation(),!0),this._onChange=r=>{var a,c,p;const n=r.target,s=(a=n.selectedItems)==null?void 0:a[0].getAttribute("data-id"),o=(c=Zxe(this._gmtOffsets,s))==null?void 0:c.utcOffset;o&&(this._selectedId=s,(p=this.onChange)==null||p.call(this,o))}}loadDependencies(){return Il({button:()=>we(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([214,215,216,217,218,219,220,221,222,223,224,225,226,227])),dropdown:()=>we(()=>import("./calcite-dropdown-r3pviJNw.js"),__vite__mapDeps([262,232,233,227,217,221,219,222,234])),"dropdown-group":()=>we(()=>import("./calcite-dropdown-group-5Uhho6JI.js"),__vite__mapDeps([263,222,264])),"dropdown-item":()=>we(()=>import("./calcite-dropdown-item-UdaqM-Sc.js"),__vite__mapDeps([265,264,219,223,225,222]))})}render(){const e=this._messages;if(!e)return X("div",{class:QR.base,key:"empty"});const i=this._selectedItem,r=Wre(i);return X("div",{class:QR.base,key:"container",onpointerdown:this._killEvent},X("calcite-dropdown",{open:this.open,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",onCalciteDropdownClose:this._onClose,onCalciteDropdownOpen:this._onOpen,onCalciteDropdownSelect:this._onChange},X("calcite-button",{appearance:"transparent",class:QR.trigger,key:"trigger",kind:"neutral",scale:"s",slot:"trigger",tabIndex:0,title:e.chooseTimezone},(i==null?void 0:i.short)??""),X("calcite-dropdown-group",{selectionMode:"single"},this._gmtOffsets.map(n=>{const s=Wre(n);return X("calcite-dropdown-item",{"data-id":s,key:s,selected:r===s},X("div",{class:QR.itemTitle,key:"title"},n.shortWithUTC),X("div",{class:QR.itemDescription,key:"description"},n.long))}))))}get _gmtOffsets(){const e=this._messages;return e?kGt(e):[]}get _selectedItem(){const e=this._gmtOffsets,i=this.value,r=Zxe(e,this._selectedId);return(r==null?void 0:r.utcOffset)===i?r:zGt(e,i)}};function Zxe(t,e){return t.find(i=>Wre(i)===e)}function zGt(t,e){return t.find(i=>i.utcOffset===e)}function Wre(t){return t?`${t.utcOffset}-${t.long}`:void 0}y([w()],Zd.prototype,"value",void 0),y([w()],Zd.prototype,"onChange",void 0),y([w()],Zd.prototype,"open",void 0),y([w()],Zd.prototype,"onOpen",void 0),y([w()],Zd.prototype,"onClose",void 0),y([w(),Gr("esri/widgets/support/t9n/timezone")],Zd.prototype,"_messages",void 0),y([w()],Zd.prototype,"_gmtOffsets",null),y([w()],Zd.prototype,"_selectedItem",null),y([w()],Zd.prototype,"_selectedId",void 0),Zd=y([Z("esri.widgets.support.TimezonePicker")],Zd);const HX="esri-slider-with-dropdown",d7={label:"esri-slider__label",box:`${HX}__box`,boxDropDownOn:`${HX}__box--drop-down-on`,boxDropDownOff:`${HX}__box--drop-down-off`};let wM=class extends WG{constructor(e,i){super(e,i),this.viewModel=new uT,this.showDropDown=!0,this._labelWidth=0,this._onLabelAfterCreate=r=>{const n="label-size-observer";this.removeHandles(n),this.addHandles(Cj(r,({contentRect:s})=>{this._labelWidth=s.width}),n)},this._getLabelStyles=()=>{if(!this.trackElement)return;const r=this._trackWidth,n=this._labelWidth/2,s=this.getCurrentPosition(),o=s-n,a=s+n;let c=-n;return o<0?c+=-o:a>r&&(c+=r-a),{left:`${c}px`}},this._onTimezoneChange=r=>{this.viewModel.utcOffset=r},this._onTimezonePickerOpen=()=>{this.viewModel.timezonePickerOpen=!0},this._onTimezonePickerClose=()=>{this.viewModel.timezonePickerOpen=!1}}renderThumbLabel(e){const{showDropDown:i,viewModel:r}=this;return X("div",{afterCreate:this._onLabelAfterCreate,class:this.classes({[d7.box]:!0,[d7.label]:!0,[d7.boxDropDownOn]:i,[d7.boxDropDownOff]:!i}),key:"thumb-label",styles:this._getLabelStyles()},super.renderThumbLabel(e),i?X(Zd,{open:r.timezonePickerOpen,value:r.utcOffset,onChange:this._onTimezoneChange,onClose:this._onTimezonePickerClose,onOpen:this._onTimezonePickerOpen}):null)}};y([w()],wM.prototype,"viewModel",void 0),y([w()],wM.prototype,"showDropDown",void 0),y([w()],wM.prototype,"_labelWidth",void 0),wM=y([Z("esri.widgets.Daylight.support.SliderWithDropdown")],wM);const UGt=wM;function VGt(t,e){const i=DAe(e),r=Date.now(),n=i.formatToParts(r),s=new Set;n.filter(({type:p})=>p==="literal").forEach(({value:p})=>s.add(p));let o=0;const a={};for(;n.length>0;){const{type:p,value:_}=n.shift();for(let x=0;x<_.length;x++,o++){const S=t.charAt(o);if(s.has(S)){o++;break}if(p==="literal")break;a[p]||(a[p]=[]),a[p].push(S)}}const c={};try{c.day=qX(a.day.join("")),c.month=qX(a.month.join("")),c.year=qX((a.year||a.relatedYear).join(""))}catch{throw Jxe(e)}if(isNaN(c.day)||isNaN(c.month)||isNaN(c.year))throw Jxe(e);return c}function qX(t){const e=[/٠/g,/١/g,/٢/g,/٣/g,/٤/g,/٥/g,/٦/g,/٧/g,/٨/g,/٩/g];for(let i=0;i<10;i++)t=t.replace(e[i],i.toString());return Number(t)}function Jxe(t){return new se(`could not parse date input, expecting the following format: ${Gs(Date.now(),t)}`)}const eI={ar:6,"ar-dz":6,"ar-kw":6,"ar-ly":6,"ar-ma":1,"ar-sa":7,"ar-tn":1,bg:1,bs:1,ca:1,cs:1,da:1,de:1,"de-at":1,"de-ch":1,el:1,"en-au":1,"en-ca":7,"en-gb":1,"en-ie":1,"en-il":7,"en-in":7,"en-nz":1,"en-sg":7,es:1,"es-do":7,"es-mx":7,"es-us":7,et:1,fi:1,fr:1,"fr-ca":7,"fr-ch":1,he:7,hr:1,hu:1,id:7,it:1,"it-ch":1,ja:7,ko:7,lt:1,lv:1,nb:1,nl:1,"nl-be":1,pl:1,pt:7,"pt-br":7,ro:1,ru:1,sk:1,sl:1,sr:1,"sr-cyrl":1,sv:1,th:7,tr:1,uk:1,vi:1,"zh-cn":1,"zh-hk":7,"zh-mo":7,"zh-tw":7},BGt="Locale"in Intl&&"weekInfo"in Intl.Locale.prototype;function lje(t){if(t=t.toLowerCase(),eI[t])return eI[t];if(BGt)try{const i=new Intl.Locale(t).weekInfo.firstDay;return eI[t]=i,i}catch{}const e=bse(t);return eI[e]?eI[e]:7}function jGt(t,e){return(e+7-lje(t))%7}var id="top",a0="bottom",l0="right",rd="left",ihe="auto",A6=[id,a0,l0,rd],JP="start",g9="end",GGt="clippingParents",cje="viewport",tI="popper",HGt="reference",Kxe=A6.reduce(function(t,e){return t.concat([e+"-"+JP,e+"-"+g9])},[]),uje=[].concat(A6,[ihe]).reduce(function(t,e){return t.concat([e,e+"-"+JP,e+"-"+g9])},[]),qGt="beforeRead",WGt="read",YGt="afterRead",XGt="beforeMain",ZGt="main",JGt="afterMain",KGt="beforeWrite",QGt="write",eHt="afterWrite",tHt=[qGt,WGt,YGt,XGt,ZGt,JGt,KGt,QGt,eHt];function l1(t){return t?(t.nodeName||"").toLowerCase():null}function Op(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function uE(t){var e=Op(t).Element;return t instanceof e||t instanceof Element}function Bf(t){var e=Op(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function rhe(t){if(typeof ShadowRoot>"u")return!1;var e=Op(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function iHt(t){var e=t.state;Object.keys(e.elements).forEach(function(i){var r=e.styles[i]||{},n=e.attributes[i]||{},s=e.elements[i];!Bf(s)||!l1(s)||(Object.assign(s.style,r),Object.keys(n).forEach(function(o){var a=n[o];a===!1?s.removeAttribute(o):s.setAttribute(o,a===!0?"":a)}))})}function rHt(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach(function(r){var n=e.elements[r],s=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:i[r]),a=o.reduce(function(c,p){return c[p]="",c},{});!Bf(n)||!l1(n)||(Object.assign(n.style,a),Object.keys(s).forEach(function(c){n.removeAttribute(c)}))})}}const nHt={name:"applyStyles",enabled:!0,phase:"write",fn:iHt,effect:rHt,requires:["computeStyles"]};function By(t){return t.split("-")[0]}var IT=Math.max,YV=Math.min,KP=Math.round;function Yre(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function hje(){return!/^((?!chrome|android).)*safari/i.test(Yre())}function QP(t,e,i){e===void 0&&(e=!1),i===void 0&&(i=!1);var r=t.getBoundingClientRect(),n=1,s=1;e&&Bf(t)&&(n=t.offsetWidth>0&&KP(r.width)/t.offsetWidth||1,s=t.offsetHeight>0&&KP(r.height)/t.offsetHeight||1);var o=uE(t)?Op(t):window,a=o.visualViewport,c=!hje()&&i,p=(r.left+(c&&a?a.offsetLeft:0))/n,_=(r.top+(c&&a?a.offsetTop:0))/s,x=r.width/n,S=r.height/s;return{width:x,height:S,top:_,right:p+x,bottom:_+S,left:p,x:p,y:_}}function nhe(t){var e=QP(t),i=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:r}}function dje(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&rhe(i)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function D_(t){return Op(t).getComputedStyle(t)}function sHt(t){return["table","td","th"].indexOf(l1(t))>=0}function xx(t){return((uE(t)?t.ownerDocument:t.document)||window.document).documentElement}function rH(t){return l1(t)==="html"?t:t.assignedSlot||t.parentNode||(rhe(t)?t.host:null)||xx(t)}function Qxe(t){return!Bf(t)||D_(t).position==="fixed"?null:t.offsetParent}function oHt(t){var e=/firefox/i.test(Yre()),i=/Trident/i.test(Yre());if(i&&Bf(t)){var r=D_(t);if(r.position==="fixed")return null}var n=rH(t);for(rhe(n)&&(n=n.host);Bf(n)&&["html","body"].indexOf(l1(n))<0;){var s=D_(n);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||e&&s.willChange==="filter"||e&&s.filter&&s.filter!=="none")return n;n=n.parentNode}return null}function M6(t){for(var e=Op(t),i=Qxe(t);i&&sHt(i)&&D_(i).position==="static";)i=Qxe(i);return i&&(l1(i)==="html"||l1(i)==="body"&&D_(i).position==="static")?e:i||oHt(t)||e}function she(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function lL(t,e,i){return IT(t,YV(e,i))}function aHt(t,e,i){var r=lL(t,e,i);return r>i?i:r}function pje(){return{top:0,right:0,bottom:0,left:0}}function fje(t){return Object.assign({},pje(),t)}function mje(t,e){return e.reduce(function(i,r){return i[r]=t,i},{})}var lHt=function(e,i){return e=typeof e=="function"?e(Object.assign({},i.rects,{placement:i.placement})):e,fje(typeof e!="number"?e:mje(e,A6))};function cHt(t){var e,i=t.state,r=t.name,n=t.options,s=i.elements.arrow,o=i.modifiersData.popperOffsets,a=By(i.placement),c=she(a),p=[rd,l0].indexOf(a)>=0,_=p?"height":"width";if(!(!s||!o)){var x=lHt(n.padding,i),S=nhe(s),C=c==="y"?id:rd,M=c==="y"?a0:l0,P=i.rects.reference[_]+i.rects.reference[c]-o[c]-i.rects.popper[_],$=o[c]-i.rects.reference[c],F=M6(s),z=F?c==="y"?F.clientHeight||0:F.clientWidth||0:0,k=P/2-$/2,U=x[C],j=z-S[_]-x[M],G=z/2-S[_]/2+k,Y=lL(U,G,j),Q=c;i.modifiersData[r]=(e={},e[Q]=Y,e.centerOffset=Y-G,e)}}function uHt(t){var e=t.state,i=t.options,r=i.element,n=r===void 0?"[data-popper-arrow]":r;n!=null&&(typeof n=="string"&&(n=e.elements.popper.querySelector(n),!n)||dje(e.elements.popper,n)&&(e.elements.arrow=n))}const hHt={name:"arrow",enabled:!0,phase:"main",fn:cHt,effect:uHt,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function e5(t){return t.split("-")[1]}var dHt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function pHt(t,e){var i=t.x,r=t.y,n=e.devicePixelRatio||1;return{x:KP(i*n)/n||0,y:KP(r*n)/n||0}}function e3e(t){var e,i=t.popper,r=t.popperRect,n=t.placement,s=t.variation,o=t.offsets,a=t.position,c=t.gpuAcceleration,p=t.adaptive,_=t.roundOffsets,x=t.isFixed,S=o.x,C=S===void 0?0:S,M=o.y,P=M===void 0?0:M,$=typeof _=="function"?_({x:C,y:P}):{x:C,y:P};C=$.x,P=$.y;var F=o.hasOwnProperty("x"),z=o.hasOwnProperty("y"),k=rd,U=id,j=window;if(p){var G=M6(i),Y="clientHeight",Q="clientWidth";if(G===Op(i)&&(G=xx(i),D_(G).position!=="static"&&a==="absolute"&&(Y="scrollHeight",Q="scrollWidth")),G=G,n===id||(n===rd||n===l0)&&s===g9){U=a0;var ne=x&&G===j&&j.visualViewport?j.visualViewport.height:G[Y];P-=ne-r.height,P*=c?1:-1}if(n===rd||(n===id||n===a0)&&s===g9){k=l0;var ie=x&&G===j&&j.visualViewport?j.visualViewport.width:G[Q];C-=ie-r.width,C*=c?1:-1}}var he=Object.assign({position:a},p&&dHt),ce=_===!0?pHt({x:C,y:P},Op(i)):{x:C,y:P};if(C=ce.x,P=ce.y,c){var ve;return Object.assign({},he,(ve={},ve[U]=z?"0":"",ve[k]=F?"0":"",ve.transform=(j.devicePixelRatio||1)<=1?"translate("+C+"px, "+P+"px)":"translate3d("+C+"px, "+P+"px, 0)",ve))}return Object.assign({},he,(e={},e[U]=z?P+"px":"",e[k]=F?C+"px":"",e.transform="",e))}function fHt(t){var e=t.state,i=t.options,r=i.gpuAcceleration,n=r===void 0?!0:r,s=i.adaptive,o=s===void 0?!0:s,a=i.roundOffsets,c=a===void 0?!0:a,p={placement:By(e.placement),variation:e5(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:n,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,e3e(Object.assign({},p,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,e3e(Object.assign({},p,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const mHt={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:fHt,data:{}};var p7={passive:!0};function gHt(t){var e=t.state,i=t.instance,r=t.options,n=r.scroll,s=n===void 0?!0:n,o=r.resize,a=o===void 0?!0:o,c=Op(e.elements.popper),p=[].concat(e.scrollParents.reference,e.scrollParents.popper);return s&&p.forEach(function(_){_.addEventListener("scroll",i.update,p7)}),a&&c.addEventListener("resize",i.update,p7),function(){s&&p.forEach(function(_){_.removeEventListener("scroll",i.update,p7)}),a&&c.removeEventListener("resize",i.update,p7)}}const yHt={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:gHt,data:{}};var vHt={left:"right",right:"left",bottom:"top",top:"bottom"};function Wk(t){return t.replace(/left|right|bottom|top/g,function(e){return vHt[e]})}var _Ht={start:"end",end:"start"};function t3e(t){return t.replace(/start|end/g,function(e){return _Ht[e]})}function ohe(t){var e=Op(t),i=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:i,scrollTop:r}}function ahe(t){return QP(xx(t)).left+ohe(t).scrollLeft}function bHt(t,e){var i=Op(t),r=xx(t),n=i.visualViewport,s=r.clientWidth,o=r.clientHeight,a=0,c=0;if(n){s=n.width,o=n.height;var p=hje();(p||!p&&e==="fixed")&&(a=n.offsetLeft,c=n.offsetTop)}return{width:s,height:o,x:a+ahe(t),y:c}}function wHt(t){var e,i=xx(t),r=ohe(t),n=(e=t.ownerDocument)==null?void 0:e.body,s=IT(i.scrollWidth,i.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),o=IT(i.scrollHeight,i.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),a=-r.scrollLeft+ahe(t),c=-r.scrollTop;return D_(n||i).direction==="rtl"&&(a+=IT(i.clientWidth,n?n.clientWidth:0)-s),{width:s,height:o,x:a,y:c}}function lhe(t){var e=D_(t),i=e.overflow,r=e.overflowX,n=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+n+r)}function gje(t){return["html","body","#document"].indexOf(l1(t))>=0?t.ownerDocument.body:Bf(t)&&lhe(t)?t:gje(rH(t))}function cL(t,e){var i;e===void 0&&(e=[]);var r=gje(t),n=r===((i=t.ownerDocument)==null?void 0:i.body),s=Op(r),o=n?[s].concat(s.visualViewport||[],lhe(r)?r:[]):r,a=e.concat(o);return n?a:a.concat(cL(rH(o)))}function Xre(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function xHt(t,e){var i=QP(t,!1,e==="fixed");return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}function i3e(t,e,i){return e===cje?Xre(bHt(t,i)):uE(e)?xHt(e,i):Xre(wHt(xx(t)))}function SHt(t){var e=cL(rH(t)),i=["absolute","fixed"].indexOf(D_(t).position)>=0,r=i&&Bf(t)?M6(t):t;return uE(r)?e.filter(function(n){return uE(n)&&dje(n,r)&&l1(n)!=="body"}):[]}function THt(t,e,i,r){var n=e==="clippingParents"?SHt(t):[].concat(e),s=[].concat(n,[i]),o=s[0],a=s.reduce(function(c,p){var _=i3e(t,p,r);return c.top=IT(_.top,c.top),c.right=YV(_.right,c.right),c.bottom=YV(_.bottom,c.bottom),c.left=IT(_.left,c.left),c},i3e(t,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function yje(t){var e=t.reference,i=t.element,r=t.placement,n=r?By(r):null,s=r?e5(r):null,o=e.x+e.width/2-i.width/2,a=e.y+e.height/2-i.height/2,c;switch(n){case id:c={x:o,y:e.y-i.height};break;case a0:c={x:o,y:e.y+e.height};break;case l0:c={x:e.x+e.width,y:a};break;case rd:c={x:e.x-i.width,y:a};break;default:c={x:e.x,y:e.y}}var p=n?she(n):null;if(p!=null){var _=p==="y"?"height":"width";switch(s){case JP:c[p]=c[p]-(e[_]/2-i[_]/2);break;case g9:c[p]=c[p]+(e[_]/2-i[_]/2);break}}return c}function y9(t,e){e===void 0&&(e={});var i=e,r=i.placement,n=r===void 0?t.placement:r,s=i.strategy,o=s===void 0?t.strategy:s,a=i.boundary,c=a===void 0?GGt:a,p=i.rootBoundary,_=p===void 0?cje:p,x=i.elementContext,S=x===void 0?tI:x,C=i.altBoundary,M=C===void 0?!1:C,P=i.padding,$=P===void 0?0:P,F=fje(typeof $!="number"?$:mje($,A6)),z=S===tI?HGt:tI,k=t.rects.popper,U=t.elements[M?z:S],j=THt(uE(U)?U:U.contextElement||xx(t.elements.popper),c,_,o),G=QP(t.elements.reference),Y=yje({reference:G,element:k,strategy:"absolute",placement:n}),Q=Xre(Object.assign({},k,Y)),ne=S===tI?Q:G,ie={top:j.top-ne.top+F.top,bottom:ne.bottom-j.bottom+F.bottom,left:j.left-ne.left+F.left,right:ne.right-j.right+F.right},he=t.modifiersData.offset;if(S===tI&&he){var ce=he[n];Object.keys(ie).forEach(function(ve){var ge=[l0,a0].indexOf(ve)>=0?1:-1,pe=[id,a0].indexOf(ve)>=0?"y":"x";ie[ve]+=ce[pe]*ge})}return ie}function EHt(t,e){e===void 0&&(e={});var i=e,r=i.placement,n=i.boundary,s=i.rootBoundary,o=i.padding,a=i.flipVariations,c=i.allowedAutoPlacements,p=c===void 0?uje:c,_=e5(r),x=_?a?Kxe:Kxe.filter(function(M){return e5(M)===_}):A6,S=x.filter(function(M){return p.indexOf(M)>=0});S.length===0&&(S=x);var C=S.reduce(function(M,P){return M[P]=y9(t,{placement:P,boundary:n,rootBoundary:s,padding:o})[By(P)],M},{});return Object.keys(C).sort(function(M,P){return C[M]-C[P]})}function CHt(t){if(By(t)===ihe)return[];var e=Wk(t);return[t3e(t),e,t3e(e)]}function AHt(t){var e=t.state,i=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var n=i.mainAxis,s=n===void 0?!0:n,o=i.altAxis,a=o===void 0?!0:o,c=i.fallbackPlacements,p=i.padding,_=i.boundary,x=i.rootBoundary,S=i.altBoundary,C=i.flipVariations,M=C===void 0?!0:C,P=i.allowedAutoPlacements,$=e.options.placement,F=By($),z=F===$,k=c||(z||!M?[Wk($)]:CHt($)),U=[$].concat(k).reduce(function(Ge,ut){return Ge.concat(By(ut)===ihe?EHt(e,{placement:ut,boundary:_,rootBoundary:x,padding:p,flipVariations:M,allowedAutoPlacements:P}):ut)},[]),j=e.rects.reference,G=e.rects.popper,Y=new Map,Q=!0,ne=U[0],ie=0;ie=0,pe=ge?"width":"height",Ee=y9(e,{placement:he,boundary:_,rootBoundary:x,altBoundary:S,padding:p}),te=ge?ve?l0:rd:ve?a0:id;j[pe]>G[pe]&&(te=Wk(te));var le=Wk(te),de=[];if(s&&de.push(Ee[ce]<=0),a&&de.push(Ee[te]<=0,Ee[le]<=0),de.every(function(Ge){return Ge})){ne=he,Q=!1;break}Y.set(he,de)}if(Q)for(var be=M?3:1,Se=function(ut){var Ft=U.find(function(ei){var Mt=Y.get(ei);if(Mt)return Mt.slice(0,ut).every(function(ri){return ri})});if(Ft)return ne=Ft,"break"},Ae=be;Ae>0;Ae--){var Re=Se(Ae);if(Re==="break")break}e.placement!==ne&&(e.modifiersData[r]._skip=!0,e.placement=ne,e.reset=!0)}}const MHt={name:"flip",enabled:!0,phase:"main",fn:AHt,requiresIfExists:["offset"],data:{_skip:!1}};function r3e(t,e,i){return i===void 0&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function n3e(t){return[id,l0,a0,rd].some(function(e){return t[e]>=0})}function OHt(t){var e=t.state,i=t.name,r=e.rects.reference,n=e.rects.popper,s=e.modifiersData.preventOverflow,o=y9(e,{elementContext:"reference"}),a=y9(e,{altBoundary:!0}),c=r3e(o,r),p=r3e(a,n,s),_=n3e(c),x=n3e(p);e.modifiersData[i]={referenceClippingOffsets:c,popperEscapeOffsets:p,isReferenceHidden:_,hasPopperEscaped:x},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":_,"data-popper-escaped":x})}const PHt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:OHt};function RHt(t,e,i){var r=By(t),n=[rd,id].indexOf(r)>=0?-1:1,s=typeof i=="function"?i(Object.assign({},e,{placement:t})):i,o=s[0],a=s[1];return o=o||0,a=(a||0)*n,[rd,l0].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function IHt(t){var e=t.state,i=t.options,r=t.name,n=i.offset,s=n===void 0?[0,0]:n,o=uje.reduce(function(_,x){return _[x]=RHt(x,e.rects,s),_},{}),a=o[e.placement],c=a.x,p=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=p),e.modifiersData[r]=o}const $Ht={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:IHt};function LHt(t){var e=t.state,i=t.name;e.modifiersData[i]=yje({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const DHt={name:"popperOffsets",enabled:!0,phase:"read",fn:LHt,data:{}};function NHt(t){return t==="x"?"y":"x"}function FHt(t){var e=t.state,i=t.options,r=t.name,n=i.mainAxis,s=n===void 0?!0:n,o=i.altAxis,a=o===void 0?!1:o,c=i.boundary,p=i.rootBoundary,_=i.altBoundary,x=i.padding,S=i.tether,C=S===void 0?!0:S,M=i.tetherOffset,P=M===void 0?0:M,$=y9(e,{boundary:c,rootBoundary:p,padding:x,altBoundary:_}),F=By(e.placement),z=e5(e.placement),k=!z,U=she(F),j=NHt(U),G=e.modifiersData.popperOffsets,Y=e.rects.reference,Q=e.rects.popper,ne=typeof P=="function"?P(Object.assign({},e.rects,{placement:e.placement})):P,ie=typeof ne=="number"?{mainAxis:ne,altAxis:ne}:Object.assign({mainAxis:0,altAxis:0},ne),he=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,ce={x:0,y:0};if(G){if(s){var ve,ge=U==="y"?id:rd,pe=U==="y"?a0:l0,Ee=U==="y"?"height":"width",te=G[U],le=te+$[ge],de=te-$[pe],be=C?-Q[Ee]/2:0,Se=z===JP?Y[Ee]:Q[Ee],Ae=z===JP?-Q[Ee]:-Y[Ee],Re=e.elements.arrow,Ge=C&&Re?nhe(Re):{width:0,height:0},ut=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:pje(),Ft=ut[ge],ei=ut[pe],Mt=lL(0,Y[Ee],Ge[Ee]),ri=k?Y[Ee]/2-be-Mt-Ft-ie.mainAxis:Se-Mt-Ft-ie.mainAxis,It=k?-Y[Ee]/2+be+Mt+ei+ie.mainAxis:Ae+Mt+ei+ie.mainAxis,dt=e.elements.arrow&&M6(e.elements.arrow),pt=dt?U==="y"?dt.clientTop||0:dt.clientLeft||0:0,ai=(ve=he==null?void 0:he[U])!=null?ve:0,ht=te+ri-ai-pt,Ct=te+It-ai,Dt=lL(C?YV(le,ht):le,te,C?IT(de,Ct):de);G[U]=Dt,ce[U]=Dt-te}if(a){var Tt,re=U==="x"?id:rd,Ht=U==="x"?a0:l0,hr=G[j],Ke=j==="y"?"height":"width",Lt=hr+$[re],vt=hr-$[Ht],Bt=[id,rd].indexOf(F)!==-1,qt=(Tt=he==null?void 0:he[j])!=null?Tt:0,li=Bt?Lt:hr-Y[Ke]-Q[Ke]-qt+ie.altAxis,mi=Bt?hr+Y[Ke]+Q[Ke]-qt-ie.altAxis:vt,Dr=C&&Bt?aHt(li,hr,mi):lL(C?li:Lt,hr,C?mi:vt);G[j]=Dr,ce[j]=Dr-hr}e.modifiersData[r]=ce}}const kHt={name:"preventOverflow",enabled:!0,phase:"main",fn:FHt,requiresIfExists:["offset"]};function zHt(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function UHt(t){return t===Op(t)||!Bf(t)?ohe(t):zHt(t)}function VHt(t){var e=t.getBoundingClientRect(),i=KP(e.width)/t.offsetWidth||1,r=KP(e.height)/t.offsetHeight||1;return i!==1||r!==1}function BHt(t,e,i){i===void 0&&(i=!1);var r=Bf(e),n=Bf(e)&&VHt(e),s=xx(e),o=QP(t,n,i),a={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!i)&&((l1(e)!=="body"||lhe(s))&&(a=UHt(e)),Bf(e)?(c=QP(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):s&&(c.x=ahe(s))),{x:o.left+a.scrollLeft-c.x,y:o.top+a.scrollTop-c.y,width:o.width,height:o.height}}function jHt(t){var e=new Map,i=new Set,r=[];t.forEach(function(s){e.set(s.name,s)});function n(s){i.add(s.name);var o=[].concat(s.requires||[],s.requiresIfExists||[]);o.forEach(function(a){if(!i.has(a)){var c=e.get(a);c&&n(c)}}),r.push(s)}return t.forEach(function(s){i.has(s.name)||n(s)}),r}function GHt(t){var e=jHt(t);return tHt.reduce(function(i,r){return i.concat(e.filter(function(n){return n.phase===r}))},[])}function HHt(t){var e;return function(){return e||(e=new Promise(function(i){Promise.resolve().then(function(){e=void 0,i(t())})})),e}}function qHt(t){var e=t.reduce(function(i,r){var n=i[r.name];return i[r.name]=n?Object.assign({},n,r,{options:Object.assign({},n.options,r.options),data:Object.assign({},n.data,r.data)}):r,i},{});return Object.keys(e).map(function(i){return e[i]})}var s3e={placement:"bottom",modifiers:[],strategy:"absolute"};function o3e(){for(var t=arguments.length,e=new Array(t),i=0;i{this._rootNode=r},this._afterContentCreate=r=>{this._contentNode=r},this._updatePosition=()=>{this._popper!=null&&this._popper.update()}}initialize(){this.when(()=>{this.destroyed||(this._projector.append(document.body,this.render),this._renderAttached=!0)}),this.addHandles([_e(()=>[this.open,this.anchorElement],()=>this._buildPopper(),Qt),_e(()=>[this.placement,this.offset],()=>this._setPopperOptions(),Qt)])}destroy(){this.owner=null,this.anchorElement=null,this.renderContentFunction=null,this._renderAttached&&(this._projector.detach(this.render),this._renderAttached=!1),this._rootNode!=null&&(Rht(this._rootNode),this._rootNode=null),this._contentNode=null,this._popper!=null&&(this._popper.destroy(),this._popper=null)}set container(e){}set owner(e){this._set("owner",e)}get placement(){return"top"}set placement(e){ZHt.has(e)?this._override("placement",e):this._clearOverride("placement")}get test(){return{rootNode:this._rootNode}}render(){var n;const{open:e,owner:i,renderContentFunction:r}=this;return X("div",{afterCreate:this._afterRootCreate,class:this.classes(l3e.base,e?l3e.open:null),lang:ma(),styles:JHt},X("div",{afterCreate:this._afterContentCreate,afterUpdate:this._updatePosition,dir:Rpt((n=this.owner)==null?void 0:n.container)},e?r==null?void 0:r.call(i):null))}_buildPopper(){this._popper!=null&&(this._popper.destroy(),this._popper=null);const e=this._contentNode;if(e==null||!this.open||!this.renderContentFunction)return;const i=this._getAnchor();i&&(this._popper=XHt(i,e),this._setPopperOptions())}_setPopperOptions(){const{placement:e,offset:i,_popper:r}=this;r!=null&&(r.setOptions({placement:e,modifiers:[{name:"offset",options:{offset:i}}]}),r.forceUpdate())}_getAnchor(){const{anchorElement:e}=this;return W9(typeof e=="function"?e():e)}};y([w()],Xg.prototype,"anchorElement",void 0),y([w()],Xg.prototype,"container",null),y([w()],Xg.prototype,"offset",void 0),y([w()],Xg.prototype,"open",void 0),y([w()],Xg.prototype,"owner",null),y([w()],Xg.prototype,"placement",null),y([w()],Xg.prototype,"renderContentFunction",void 0),Xg=y([Z("esri.widgets.support.Popover")],Xg);const vje=Xg,$a="esri-date-picker",Ro={base:$a,datePicker:`${$a}__calendar`,monthPicker:`${$a}__month-picker`,dayPicker:`${$a}__day-picker`,week:`${$a}__week-item`,nearbyMonth:`${$a}__day-item--nearby-month`,activeDay:`${$a}__day-item--active`,today:`${$a}__day-item--today`,selectedDay:`${$a}__day-item--selected`,day:`${$a}__day-item`,dayHeader:`${$a}__day-item--header`,yearPicker:`${$a}__year-picker`,selectedYear:`${$a}__year-picker-item--selected`,year:`${$a}__year-picker-item`,monthDropdown:`${$a}__month-dropdown`,date:`${$a}__date`,datePickerToggle:`${$a}__calendar-toggle`,dateInput:`${$a}__input`,dateTextInput:`${$a}__text-input`,leadingIcon:`${$a}__icon--leading`},KHt=new Set([" ","ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","Home","PageDown","PageUp"]);let _l=class extends hn{constructor(e,i){super(e,i),this._calendarNode=null,this._inputOrButtonNode=null,this._rootNode=null,this._requestDayPickerFocusOnCreate=!1,this._activeDate=null,this._calendarPopover=new vje({owner:this,placement:"bottom-start",anchorElement:()=>this._rootNode,renderContentFunction:this._renderCalendar}),this._isOpen=!1,this.dateInputEnabled=!1,this.messages=null,this.commitOnMonthChange=!1,this.viewModel=new iH,this.disabled=!1,this.timeZone=void 0,this.toggle=this.toggle.bind(this)}initialize(){this.addHandles(_e(()=>{var e;return{viewModel:this.viewModel,value:(e=this.viewModel)==null?void 0:e.value}},({viewModel:e,value:i})=>{!this.destroyed&&e&&this.onChange!=null&&this.onChange(i)},Li))}destroy(){this._calendarPopover.destroy()}get _dateTimeFormatOptions(){return{year:"numeric",month:"2-digit",day:"2-digit",timeZone:this.timeZone||void 0}}get value(){return this.viewModel.value}set value(e){this.viewModel.value=e}get isOpen(){return this._isOpen}render(){return X("div",{afterCreate:Jv,bind:this,class:this.classes(Ro.base,it.widget),"data-node-ref":"_rootNode"},this.dateInputEnabled?this._renderInputAndButtonMode():this._renderButtonOnlyMode())}toggle(){this._isOpen?this.close():this.open()}open(e=!0){this._activeDate=$i.fromJSDate(this.viewModel.value),this._isOpen=!0,this._calendarPopover.open=!0,this._requestDayPickerFocusOnCreate=e}close(e=!0){var i;this._activeDate=null,this._isOpen=!1,this._calendarPopover.open=!1,e&&((i=this._inputOrButtonNode)==null||i.focus())}_renderButtonOnlyMode(){const e=Gs(this.viewModel.value,this._dateTimeFormatOptions),{disabled:i,_isOpen:r,messages:n}=this;return X("div",{afterCreate:Jv,"aria-controls":r?this._getCalendarId():null,"aria-expanded":r.toString(),"aria-haspopup":"true","aria-label":n.setDate,"aria-pressed":r.toString(),bind:this,class:this.classes(it.widgetButton,it.select,Ro.datePickerToggle),"data-node-ref":"_inputOrButtonNode",key:`date-button-${i}`,onclick:this.toggle,onkeydown:this._handleDateButtonKeyDown,role:"button",tabIndex:i?void 0:0},X("span",{class:Ro.date},e))}_renderInputAndButtonMode(){const e=Gs(this.viewModel.value,this._dateTimeFormatOptions),{_isOpen:i,messages:r}=this;return X("div",{class:this.classes(Ro.dateInput)},X("input",{afterCreate:Jv,"aria-controls":i?this._getCalendarId():null,"aria-haspopup":"true","aria-label":r.setDate,bind:this,class:this.classes(Ro.dateTextInput,it.input),"data-node-ref":"_inputOrButtonNode",key:"date-input",onblur:this._handleDateInputBlur,onclick:this._handleDateInputClick,onkeydown:this._handleDateInputKeyDown,type:"text",value:e}),X("span",{"aria-hidden":"true",class:this.classes(Ro.leadingIcon,oi.calendar)}))}_handleDateInputClick(){this.open(!1)}_handleDateInputKeyDown(e){const{key:i}=e;this._isOpen?i==="Enter"?this._handleDateText(e):i==="Escape"&&this.close():i==="ArrowDown"&&(this.open(),e.preventDefault())}_handleDateButtonKeyDown(e){const{key:i,shiftKey:r}=e;this._isOpen&&i==="Tab"&&r?this.close():NM(i)&&this.toggle()}_handleDateInputBlur(e){this._isOpen||this._handleDateText(e)}_handleDateText(e){const i=e.currentTarget;let r;try{r=VGt(i.value,this._dateTimeFormatOptions)}catch(s){return Ce.getLogger(this).warn(s),void(i.value=Gs(this.viewModel.value,this._dateTimeFormatOptions))}const n=$i.fromObject(r);n.isValid?(this.viewModel.value=n.toJSDate(),this._activeDate=n):i.value=Gs(this.viewModel.value,this._dateTimeFormatOptions)}_handleDatePickerKeydown(e){Mf(e)==="Escape"&&(this.close(),e.preventDefault(),e.stopPropagation())}_renderCalendar(){const e=this._activeDate;if(!e)return null;const i=$i.fromJSDate(this.viewModel.value);return X("div",{afterCreate:Jv,bind:this,class:this.classes(Ro.datePicker,it.widget),"data-node-ref":"_calendarNode",id:this._getCalendarId(),key:"esri-date-picker__calendar",onfocusout:this._onCalendarFocusOut,onkeydown:this._handleDatePickerKeydown,tabIndex:-1},this._renderMonthPicker(e),this._renderDayPicker(e,i),this._renderYearPicker(e))}_getCalendarId(){return`date-picker__calendar--${this.id}`}_onCalendarFocusOut(e){var r,n;const i=e.relatedTarget;i&&i instanceof Node&&((r=this._calendarNode)!=null&&r.contains(i)||(n=this._rootNode)!=null&&n.contains(i))||this.close(!1)}_renderMonthPicker(e){const i=ZT(this.container),r=i?oi.right:oi.left,n=i?oi.left:oi.right,s=uI.months("long",{locale:ma()}).map((c,p)=>{const _=e.month-1===p;return X("option",{selected:_,value:p.toString()},c)}),{disabled:o,messages:a}=this;return X("div",{class:Ro.monthPicker},X("div",{"aria-label":a.goToPreviousMonth,bind:this,class:it.button,key:`previous-month-${o}`,onclick:this._setPreviousMonth,onkeydown:this._handlePreviousMonthKeyDown,role:"button",tabIndex:o?void 0:0,title:a.goToPreviousMonth},X("span",{"aria-hidden":"true",class:r})),X("select",{"aria-label":a.selectMonth,"aria-live":"assertive",bind:this,class:this.classes(Ro.monthDropdown,it.select),disabled:o,id:`${this.id}__month-picker`,onchange:this._setMonth,onkeydown:this._setMonth,title:a.selectMonth},s),X("div",{"aria-label":a.goToNextMonth,bind:this,class:it.button,key:`next-month-${o}`,onclick:this._setNextMonth,onkeydown:this._setNextMonth,role:"button",tabIndex:o?void 0:0,title:a.goToNextMonth},X("span",{"aria-hidden":"true",class:n})))}_renderDayPicker(e,i){const r=this._getWeekLabels(),n=this._getDayId(e),s=this._renderMonth(e,i),{id:o,disabled:a}=this;return X("div",{afterCreate:this._handleDayPickerCreate,"aria-activedescendant":n,"aria-labelledby":`${o}__month-picker ${o}__selected-year`,bind:this,class:Ro.dayPicker,id:`${o}__day-picker`,key:`day-picker-${a}`,onkeydown:this._handleDayPickerKeydown,role:"grid",tabIndex:a?void 0:0},X("div",{class:Ro.week,role:"row"},r.map(c=>X("div",{"aria-label":c.name,class:this.classes(Ro.day,Ro.dayHeader),role:"columnheader",title:c.name},c.abbr))),s)}_getDayId(e){return`${this.id}__${Gs(e.valueOf(),this._dateTimeFormatOptions)}`}_handleDayPickerCreate(e){this._requestDayPickerFocusOnCreate&&(this._requestDayPickerFocusOnCreate=!1,e.focus())}_getWeekLabels(){const e=[],i={weekday:"long"},r={weekday:"narrow"};let n=$i.now().set({weekday:lje(ma())});for(let s=0;s<7;s++)e.push({name:Gs(n.valueOf(),i),abbr:Gs(n.valueOf(),r)}),n=n.plus({day:1});return e}_handleDayPickerKeydown(e){const{ctrlKey:i,shiftKey:r}=e,n=Mf(e);if(!KHt.has(n))return;let s=this._activeDate;if(s){if(n==="ArrowLeft")s=s.minus({day:1});else if(n==="ArrowRight")s=s.plus({day:1});else if(n==="ArrowUp")s=s.minus({week:1});else if(n==="ArrowDown")s=s.plus({week:1});else if(n==="PageUp"){const o=r?"year":"month";s=s.minus({[o]:1})}else if(n==="PageDown"){const o=r?"year":"month";s=s.plus({[o]:1})}else if(n==="Home"){const o=i?"year":"month";s=s.startOf(o)}else if(n==="End"){const o=i?"year":"month";s=s.endOf(o)}else NM(n)&&(this.viewModel.value=s.toJSDate(),this.close());this._activeDate=s,e.preventDefault(),e.stopPropagation()}}_renderMonth(e,i){const r=$i.now(),n=e.startOf("month"),s=e.endOf("month"),o=6,a=7;let c=n.minus({day:jGt(ma(),n.weekday)});const p=[];for(let _=0;_{this.viewModel.toggleDayPlaying()},this._onYearPlayClick=()=>{this.viewModel.toggleYearPlaying()},this._onSeasonChange=r=>{this.viewModel.currentSeason=r.target.value},this._onSunLightingCheckboxChange=()=>{this.viewModel.toggleSunLightingEnabled()},this._onShadowCheckboxChange=()=>{this.viewModel.toggleDirectShadowsEnabled()}}get label(){var e;return((e=this.messages)==null?void 0:e.title)??""}set label(e){this._overrideIfSome("label",e)}get playSpeedMultiplier(){return this.viewModel.playSpeedMultiplier}set playSpeedMultiplier(e){this.viewModel.playSpeedMultiplier=e}get timeSliderSteps(){var e;return((e=this._timeSlider)==null?void 0:e.steps)??5}set timeSliderSteps(e){this._timeSlider.steps=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get test(){return{datePicker:this._datePicker}}get _useAmPm(){const e=this._timeSlider.viewModel.getLabelForValue(0,"tick");return e!=null&&c3e.test(e)}postInitialize(){this.viewModel.isSupported&&this.addHandles([_e(()=>this.viewModel.datePickerViewModel,e=>this._datePicker.viewModel=e,kt),_e(()=>this.viewModel.timeSliderViewModel,e=>this._timeSlider.viewModel=e,kt),_e(()=>{var e;return(e=this.visibleElements)==null?void 0:e.timezone},e=>this._timeSlider.showDropDown=e,kt),_e(()=>!this.viewModel.sunLightingEnabled,e=>{this._datePicker.disabled=e,this._timeSlider.disabled=e},kt),Oo(()=>!this.visible,()=>{var e;return(e=this._datePicker)==null?void 0:e.close(!1)},Li)])}destroy(){this._datePicker.destroy(),this._timeSlider.destroy()}render(){const{messages:e,viewModel:i,visibleElements:r}=this,n=i.isSupported;return X("div",{class:this.classes(Hc.base,it.widget)},n?X(J$,null,r.header?X(Dm,{level:this.headingLevel},e.title):null,this._renderTimeOptions(),r.datePicker?this._renderDateOrSeason():null,r.sunLightingToggle?this._renderSunLightingToggle():null,r.shadowsToggle?this._renderShadowsToggle():null):X("div",{class:Hc.panelError,key:"unsupported"},X("p",null,e.unsupported)))}loadDependencies(){return Il({button:()=>we(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([214,215,216,217,218,219,220,221,222,223,224,225,226,227])),checkbox:()=>we(()=>import("./calcite-checkbox-u3DU2spl.js"),__vite__mapDeps([266,216,227,217,221,218,219])),label:()=>we(()=>import("./calcite-label-DHrtVvrs.js"),__vite__mapDeps([267,218])),option:()=>we(()=>import("./calcite-option-XCvROySu.js"),__vite__mapDeps([268,222])),select:()=>we(()=>import("./calcite-select-h4uorzoD.js"),__vite__mapDeps([269,216,217,218,219,222,223,225]))})}_renderTimeOptions(){const{viewModel:e,visibleElements:i,messages:r}=this,{directShadowsEnabled:n,dayPlaying:s}=e,o=!e.sunLightingEnabled;return X("div",{class:this.classes(Hc.dayContainer,{[Hc.sliderShadowOn]:n,[Hc.sliderShadowOff]:!n,[Hc.sliderDateOn]:i.datePicker,[Hc.sliderDateOff]:!i.datePicker,[Hc.sliderAmPmOn]:this._useAmPm,[Hc.containerDisabled]:o}),key:"daylight-time-options"},this._timeSlider.render(),i.playButtons?this._renderPlayPauseButton({playing:s,disabled:o,label:r.playDay,onClick:this._onPlayDayClick}):null)}_renderDateOptions(){const{viewModel:e,visibleElements:i,messages:r}=this,{yearPlaying:n}=e,s=!e.sunLightingEnabled;return X("div",{class:this.classes(Hc.dateContainer,s&&Hc.containerDisabled),key:"daylight-date"},this._datePicker.render(),i.playButtons?this._renderPlayPauseButton({playing:n,disabled:s,label:r.playYear,onClick:this._onYearPlayClick}):null)}_renderPlayPauseButton({playing:e,disabled:i,label:r,onClick:n}){return X("calcite-button",{appearance:"solid",class:Hc.playPauseButton,disabled:i,iconStart:e?"pause-f":"play-f",label:r,onclick:n,round:!0,title:r,type:"button"})}_renderSeasonSelect(){const{messages:e,viewModel:i}=this,r=!i.sunLightingEnabled;return X("calcite-select",{class:this.classes(Hc.seasonPicker),disabled:r,label:e.season,onCalciteSelectChange:this._onSeasonChange},Gre.map(n=>X("calcite-option",{selected:i.currentSeason===n,value:n},e[n])))}_renderDateOrSeason(){return this.dateOrSeason==="date"?this._renderDateOptions():this._renderSeasonSelect()}_renderSunLightingToggle(){var i;const e=(i=this.messages)==null?void 0:i.sunLightingToggle;return X("calcite-label",{key:"date-time-toggle",layout:"inline",scale:"s",title:e==null?void 0:e.tooltip},X("calcite-checkbox",{checked:this.viewModel.sunLightingEnabled,class:Hc.sunLightingCheckbox,onCalciteCheckboxChange:this._onSunLightingCheckboxChange}),e==null?void 0:e.label)}_renderShadowsToggle(){const e=this.messages.shadowsToggle;return X("calcite-label",{key:"shadow-toggle",layout:"inline",scale:"s",title:e==null?void 0:e.tooltip},X("calcite-checkbox",{checked:this.viewModel.directShadowsEnabled,class:Hc.shadowsCheckbox,onCalciteCheckboxChange:this._onShadowCheckboxChange}),e.label)}_onPrimaryTickCreated(e,i,r){i.classList.add(...WX,it.primaryTick),r.classList.add(...WX,it.primaryTickLabel),r.onclick=i.onclick=this._makeGoToTime(e);const n=r.textContent,s=n!=null&&c3e.exec(n);s&&(r.innerHTML=`${s[1]}
${s[2]}
`)}_onSecondaryTickCreated(e,i){i.classList.add(...WX,it.secondaryTick),i.onclick=this._makeGoToTime(e)}_makeGoToTime(e){return()=>{this.viewModel.timeSliderPosition=e}}};y([w(),Gr("esri/widgets/Daylight/t9n/Daylight")],Ul.prototype,"messages",void 0),y([w(),Gr("esri/widgets/support/t9n/timezone")],Ul.prototype,"timezoneMessages",void 0),y([w()],Ul.prototype,"headingLevel",void 0),y([w()],Ul.prototype,"iconClass",void 0),y([w()],Ul.prototype,"icon",void 0),y([w()],Ul.prototype,"label",null),y([w()],Ul.prototype,"playSpeedMultiplier",null),y([w()],Ul.prototype,"timeSliderSteps",null),y([w()],Ul.prototype,"view",null),y([w({type:oje})],Ul.prototype,"viewModel",void 0),y([w({type:aje,nonNullable:!0})],Ul.prototype,"visibleElements",void 0),y([w({cast:t=>t==="season"||t==="date"?t:(Ce.getLogger(u3e).warn(`"${t}" is not a valid option. Acceptable values are only "date" or "season". Defaulting to "${Zre}".`),Zre)})],Ul.prototype,"dateOrSeason",void 0),y([w()],Ul.prototype,"_timeSlider",void 0),y([w()],Ul.prototype,"_useAmPm",null),y([w()],Ul.prototype,"_datePicker",void 0),Ul=y([Z(u3e)],Ul);const WX=["esri-interactive","esri-widget__anchor"],QHt=Ul,eqt=t=>new QHt({view:t,visible:!0,container:"daylight-container"});function Cm(t){let e,i,r=[],n=!1;function s(...o){return n&&e===this&&tqt(o,r)||(i=t.apply(this,o),e=this,r=o,n=!0),i}return s}function tqt(t,e){if(t.length!==e.length)return!1;for(let i=0;i{a=0,t.apply(r,o)},p=(..._)=>{n&&n.apply(r,_),o=_,s?a||(a=setTimeout(c,s)):c()};return p.remove=()=>{a&&(clearTimeout(a),a=0)},p.forceUpdate=()=>{a&&(clearTimeout(a),c())},p.hasPendingUpdates=()=>!!a,p}var qh,qa;(function(t){t.Disabled="disabled",t.Ready="ready",t.Creating="creating",t.Created="created",t.Selecting="selecting",t.Selected="selected"})(qh||(qh={})),function(t){t.NoValidInput="no-valid-input",t.NoVisibleProfiles="no-visible-profiles",t.InvalidGeometry="invalid-geometry",t.TooComplex="too-complex",t.InvalidElevationInfo="invalid-elevation-info",t.UnknownError="unknown-error",t.RefinedButNoChartData="refined-but-no-chart-data",t.None="none"}(qa||(qa={}));let wje={noDataValue:-5e5,defaultQueryOptions:()=>({noDataValue:wje.noDataValue,demResolution:"auto",maximumAutoTileRequests:150,ignoreInvisibleLayers:!0}),updateThrottleMillis:100,delayAfterPreviewMillis:500,defaultDemResolution:Ur(10,"centimeters","meters"),densificationMaxSamples:3e3,largeChartSamples:1e4,maxTotalSamples:1e5,maxChartRatio:300,minSlopeSampleDistance:10,formatPrecision:1,portraitModePixelBreakpoint:400,profileLinesStyle3D:{width:3,outlineSize:0,falloff:0,outlineColor:QB([1,1,1,0]),renderOccluded:Yn.Opaque},hoveredPointsStyle:{size:14,borderStyle:"solid",borderWidth:3,borderColor:"#ffffff",boxShadow:"0px 0px 0px 5px rgba(255,255,255,0.2)"}};function jf(){return wje}const nqt=" ― ",sqt={progress:1,hasZ:!1,samples:[],statistics:null,spatialReference:null},xje="ProfileGenerationError";var If;(function(t){t.TooComplex="too-complex",t.InvalidGeometry="invalid-geometry",t.InvalidElevationInfo="invalid-elevation-info",t.ElevationQueryError="elevation-query-error"})(If||(If={}));let BO=class extends Error{constructor(e){super("profile could not be generated",{cause:e}),this.type=xje}};function oqt(t){return t.type===xje}async function aqt(t,e,i,r,n,s,o){let a,c,p;const _=t.spatialReference,x=_.isGeographic||_.isWebMercator;let S=0;if(!x){const{planarLength:M}=await we(()=>import("./geometryEngineAsync-ly7k1Z_H.js"),__vite__mapDeps([]));St(o),S=await M(t,"meters"),St(o)}const C=1/xs(r);if(x||S>=n.geodesicDistanceThreshold){await T_([{source:_,dest:r},{source:_,dest:rt.WGS84}],o);const M=vqt(t);a=djt([M],"meters")[0];const P=h3e(a,n);if(f3e(t,a,P)>s)throw new BO(If.TooComplex);const $=d3e(M,e,i);({densifiedPath:c,distances:p}=hqt($,P,C)),c=sl(c,r)}else{await T_([{source:_,dest:r}],o),a=S;const M=h3e(a,n);if(f3e(t,a,M)>s)throw new BO(If.TooComplex);const P=d3e(t,e,i);({densifiedPath:c,distances:p}=uqt(P,M,C)),St(o),c=sl(c,r)}return{densifiedPath:c,pathLength:a*C,distances:p}}function h3e(t,e){const i=t/e.densificationMaxSamples;return Math.max(e.samplingDistance,i)}function d3e(t,e,i){if(e==null)return p3e(t);const r=t.spatialReference,n=e.mode,s=e.offset??0;let o=null;switch(i.type){case"2d":o=lqt(t,n,s);break;case"3d":o=cqt(t,n,s,i)}return o==null?p3e(t):new Tc({hasZ:!0,hasM:!1,spatialReference:r,paths:Sje(t.paths,o)})}function lqt({hasZ:t},e,i){return e==="absolute-height"?t?([r,n,s])=>[r,n,s+i]:([r,n])=>[r,n,i]:null}function cqt({spatialReference:t,hasZ:e},i,r,{elevationProvider:n}){const s=(o,a,c,p)=>(n==null?void 0:n.getElevation(o,a,c,t,p))??0;switch(i){case"on-the-ground":return([o,a])=>[o,a,s(o,a,0,"ground")];case"absolute-height":return e?([o,a,c])=>[o,a,c+r]:([o,a])=>[o,a,r];case"relative-to-ground":return e?([o,a,c])=>[o,a,c+s(o,a,c,"ground")+r]:([o,a])=>[o,a,s(o,a,0,"ground")+r];case"relative-to-scene":return e?([o,a,c])=>[o,a,c+s(o,a,c,"scene")+r]:([o,a])=>[o,a,s(o,a,0,"scene")+r];default:return null}}function p3e(t){return t.hasZ?new Tc({hasZ:!1,hasM:!1,spatialReference:t.spatialReference,paths:Sje(t.paths,([e,i])=>[e,i])}):t}function Sje(t,e){const i=t.length,r=new Array(i);for(let n=0;n0&&t.paths.every(e=>e.length>=2)}function O6(t){return t!=null&&t.type==="polyline"}function Tje(t,e,i,r,n){const{spatialReference:s,hasZ:o}=t,a={from:null,to:null,distance:0,azimuth:0,reverseAzimuth:0,spatialReference:s,metersPerSR:xs(s)},c=[],p=[];let _=0;for(let x=0;xe+i.length,0)}function f3e(t,e,i){return Eje(t)+Math.floor(e/i)+Math.max(0,t.paths.reduce(r=>1+r,0)-1)}function _qt(t,e){const i=t.length;if(i===0)return null;const r=t[0],n=r.sampledZ;let s=n,o=n,a=0,c=0,p=null,_=null,x=n??0,S=0,C=0,M=n!=null?1:0,P=0,$=0;const F=xs(e),z=ad(e),k=jf().minSlopeSampleDistance/F,U=2*k,j=new m3e,G=new m3e,Y=()=>{ne(),j.copy(G),G.reset()},Q=(ie,he)=>{Y(),ie>0&&ie-j.start<=U&&(ie=j.start+k),G.restart(ie,he)},ne=()=>{if(j.isHole||G.isHole)return;const ie=G.avgElevation-j.avgElevation,he=G.start-j.start,ce=ie*z,ve=he*F,ge=Ur(Math.atan2(ce,ve),"radians","degrees");ge>0?(S+=ge,p=e_(p,ge),P++):ge<0&&(C-=ge,_=e_(_,-ge),$++)};r.sampledZ!=null&&Q(r.distance,r.sampledZ);for(let ie=1;ie=k?Q(ce.distance,ve):G.insert(ve);const ge=he.sampledZ;if(ge!=null){const pe=ve-ge;pe>0?a+=pe:pe<0&&(c-=pe)}}return Y(),M===0?null:{maxDistance:t[i-1].distance,minElevation:s,maxElevation:o,avgElevation:M===0?null:x/M,elevationGain:a,elevationLoss:c,maxPositiveSlope:p,maxNegativeSlope:_,avgPositiveSlope:P===0?null:S/P,avgNegativeSlope:$===0?null:C/$}}function bqt(t){const e=t.filter(ys),i=e.length;if(i===0)return null;const r=e[0];if(i===1)return r;let n=r.maxDistance,s=r.minElevation,o=r.maxElevation,a=r.maxPositiveSlope,c=r.maxNegativeSlope;for(let p=1;p=e||(i.push(t),e-t<2))return i;const r=e-1;i.push(r);const n=Jre(t+1,r);for(;;){const s=n.next();if(s.done)break;i.push(s.value)}return i}function*Jre(t,e){if(t>=e)return;const i=t+Math.floor((e-t)/2);yield i;const r=Jre(t,i),n=Jre(i+1,e);for(;;){const s=r.next(),o=n.next();if(s.done&&o.done)break;s.done||(yield s.value),o.done||(yield o.value)}}async function*xqt(t,e){const{view:i,geometry:r,elevationInfo:n,providers:s,options:o}=t,a=i.spatialReference;if(!a||r==null||!che(r))throw new BO(If.InvalidGeometry);const c=s.length;if(c===0)return null;const p=Math.round(o.maxTotalSamples/c);if(Eje(r)>p)throw new BO(If.TooComplex);const _=await aqt(r,n,i,a,o,p,e);let x=0;const S=new Array(c),C=new Array(c);for(let $=0;$o.maxTotalSamples)throw new BO(If.TooComplex);const M=await Promise.all(C.map($=>{const F=$.next();return F.done===!0?Promise.resolve(null):F.value}));St(e);for(let $=0;${var F;return(F=$.return)==null?void 0:F.call($)})}for(const{resultPromise:$,index:F}of P)S[F]=await $,St(e),yield S;for(const $ of S)$!=null&&($.progress=1);yield S}function*Sqt(t,e){const{densificationResult:i}=t,r={...t,abortOptions:e,densificationResult:i},n=Cje(0,r.result.samples.length),s=n.slice(0,r.provider.numSamplesForPreview);yield g3e(r,s,!0);const o=pSe(n,r.provider.numSamplesPerChunk);for(const a of o)yield g3e(r,a,!1)}async function g3e({densificationResult:t,result:e,provider:i,queue:r,abortOptions:n,cache:s},o,a){const{densifiedPath:c,pathLength:p}=t,_=e.spatialReference,{samples:x}=e,S=[];for(let C=0;C{St(e.queryOptions);try{await Eqt(e)}catch(i){aZ(i)}}})}async function Eqt({geometry:t,provider:e,indices:i,preview:r,result:n,queryOptions:s}){if(i.length===0)return;const o=(await Rqt(e,t,s)).geometry,{hasZ:a,points:c}=o,p=s.noDataValue,{samples:_}=n;for(let x=0;x({stationary:i,visibleProfiles:r,generationParameters:n})),this._getGenerationParametersMemoized=Cm((i,r,n,s,o,a,c)=>O6(r)&&che(r)&&s!=null?{view:i,geometry:r,elevationInfo:n,options:a,queue:s,cache:o,slicePlane:c}:null),this._getElevationInfoMemoized=Cm((i,r)=>({mode:i,offset:r})),this._getOptionsMemoized=Cm((i,r,n)=>{const{densificationMaxSamples:s,maxTotalSamples:o}=jf();return{geodesicDistanceThreshold:i,samplingDistance:r,densificationMaxSamples:Math.round(s/n),maxTotalSamples:o}}),this._updateThrottled=XV(i=>Nm(this._update(i)),jf().updateThrottleMillis)}initialize(){const e=this.viewModel;this.addHandles([_e(()=>e.profiles.toArray(),i=>{this._abortUpdate(),this._paramsPerProfile.clear(),this.removeHandles(v3e),this.addHandles(i.map(r=>sd([r.attach(this.viewModel),r.on("change",()=>{this._invalidateProfile(r)})])),v3e)},kt),this._updateThrottled,_e(()=>this._updateParameters,this._updateThrottled,kt)])}destroy(){this._paramsPerProfile.clear()}get _updateParameters(){const{viewModel:e}=this,i=e.view;return this._getUpdateParametersMemoized(i==null||i.stationary,this.viewModel.visibleProfiles,this._generationParameters)}get _generationParameters(){const{view:e,input:i,queue:r,tileCache:n}=this.viewModel;return e!=null&&e.ready?this._getGenerationParametersMemoized(e,i==null?void 0:i.geometry,this._elevationInfo,r,n,this._options,e.type==="3d"?e.slicePlane:null):null}get _elevationInfo(){const e=this.viewModel.input,i=e?lj(e)?null:qPe(e):null;return i!=null?this._getElevationInfoMemoized(i.mode,i.offset):null}get _options(){const e=this.viewModel,i=e.visibleProfiles.length;let r=e.minDemResolution??jf().defaultDemResolution;return r=parseFloat(r.toFixed(2)),this._getOptionsMemoized(e.geodesicDistanceThreshold,r,i)}async _update({stationary:e,visibleProfiles:i,generationParameters:r}){this._abortUpdate(),e&&(r!=null?this._updateTask=Oc(async n=>{this.viewModel.error=null;const s=i.filter(a=>!this._isProfileValid(a,r)),o=xqt({...r,providers:s},{signal:n});try{for await(const a of o){St(n),this._clearInvalidResults(r);for(let c=0;c{c.result=null})}}):this._clearResults())}_abortUpdate(){this._updateTask=vn(this._updateTask)}_isProfileValid(e,i){return this._paramsPerProfile.has(e)&&this._paramsPerProfile.get(e)===i}_invalidateProfile(e){this._paramsPerProfile.delete(e),this._updateThrottled(this._updateParameters)}_clearInvalidResults(e){for(const i of this.viewModel.profiles.items)this._isProfileValid(i,e)||(i.result=null,this._paramsPerProfile.delete(i))}_clearResults(){for(const e of this.viewModel.profiles.items)e.result=null,this._paramsPerProfile.delete(e)}};y([w({nonNullable:!0})],Ow.prototype,"viewModel",void 0),y([w()],Ow.prototype,"_updateParameters",null),y([w()],Ow.prototype,"_generationParameters",null),y([w()],Ow.prototype,"_elevationInfo",null),y([w()],Ow.prototype,"_options",null),Ow=y([Z("esri.widgets.ElevationProfile.ElevationProfileController")],Ow);function Iqt(t,e){if(t==null||e==null)return null;const{samples:i,spatialReference:r}=t,{distance:n,elevation:s}=e,o=xs(r),a=ad(r),c=i.length,p=new Array(c);for(let _=0;_Iqt(i,r)),this._getStatisticsMemoized=Cm((i,r)=>$qt(i,r)),this.viewVisualizationEnabled=!0,this.result=null,this.effectiveUnits=null,this.numSamplesForPreview=30,this.numSamplesPerChunk=200,this.chartFillEnabled=!0,this.chartStrokeWidth=1.5,this.chartStrokeOffsetY=0,this._viewModel=null}get progress(){return this.result!=null&&this.visible?this.result.progress:0}get samples(){return this._getSamplesMemoized(this.result,this.effectiveUnits)}get statistics(){return this._getStatisticsMemoized(this.result,this.effectiveUnits)}get hoveredPoint(){var i;const e=(i=this._viewModel)==null?void 0:i.hoveredChartPosition;return e!=null?this._getPoint(e):null}get available(){return!0}get hasZ(){const e=this.result;return e!=null&&e.hasZ}get minDemResolution(){return jf().defaultDemResolution}queryElevation(){throw new Error("not implemented")}attach(e){return this._viewModel=e,sd([_e(()=>e.effectiveUnits,i=>{this.effectiveUnits=i},kt),_e(()=>[e.input],()=>this._onChange(),Li)])}toggleVisibility(e){this.visible=e===void 0?!this.visible:e}_onChange(){this.emit("change")}_getPoint(e){const{samples:i,result:r}=this;if(i==null||r==null)return null;const n=i.length;if(n===0)return null;const s=i[n-1].distance,o=mGe(i,e*s,_=>_.distance);if(o==null)return null;const{x:a,y:c,z:p}=o;return p==null?null:new mt({x:a,y:c,z:p,spatialReference:r.spatialReference})}};y([w({nonNullable:!0})],Yo.prototype,"id",void 0),y([w({nonNullable:!0})],Yo.prototype,"title",void 0),y([w({type:qe,nonNullable:!0})],Yo.prototype,"color",void 0),y([w({nonNullable:!0})],Yo.prototype,"visible",void 0),y([w({readOnly:!0})],Yo.prototype,"progress",null),y([w({readOnly:!0})],Yo.prototype,"samples",null),y([w({readOnly:!0})],Yo.prototype,"statistics",null),y([w()],Yo.prototype,"hoveredPoint",null),y([w()],Yo.prototype,"viewVisualizationEnabled",void 0),y([w()],Yo.prototype,"available",null),y([w()],Yo.prototype,"result",void 0),y([w()],Yo.prototype,"effectiveUnits",void 0),y([w()],Yo.prototype,"numSamplesForPreview",void 0),y([w()],Yo.prototype,"numSamplesPerChunk",void 0),y([w()],Yo.prototype,"chartFillEnabled",void 0),y([w()],Yo.prototype,"chartStrokeWidth",void 0),y([w()],Yo.prototype,"chartStrokeOffsetY",void 0),y([w({readOnly:!0})],Yo.prototype,"hasZ",null),y([w({readOnly:!0})],Yo.prototype,"minDemResolution",null),y([w()],Yo.prototype,"_viewModel",void 0),Yo=y([Z("esri.widgets.ElevationProfile.ElevationProfileLine")],Yo);const P6=Yo;function Mje(t){if(t==null)return null;if(t instanceof bP)return Oje(t);const e=t.tileInfo;if(e==null)return null;const i=lGe(e.lods);return i==null?null:i.resolution*xs(e.spatialReference)}function Oje(t){if(t==null)return null;const e=t.layers.items.map(Lqt).filter(ys);return dSe(e)??null}function Lqt(t){return t&&"tileInfo"in t?Mje(t):null}let Zg=class extends P6{constructor(e){super(e),this.type="ground",this.color=new qe("#ff7f00"),this.viewVisualizationEnabled=!0,this.numSamplesForPreview=50,this.numSamplesPerChunk=1e3,this._getQueryElevationDependencies=Cm((i,r)=>({ground:i,groundLayers:r}))}get available(){const e=this._ground;return e!=null&&e.layers.some(i=>i.visible)}get minDemResolution(){return Oje(this._ground)}get _queryElevationDependencies(){return this._getQueryElevationDependencies(this._ground,this._groundLayers)}get _ground(){var e,i,r;return(r=(i=(e=this._viewModel)==null?void 0:e.view)==null?void 0:i.map)==null?void 0:r.ground}get _groundLayers(){var e,i;return((i=(e=this._ground)==null?void 0:e.layers)==null?void 0:i.toArray())??[]}async queryElevation(e,i){const r=this._queryElevationDependencies;if(r==null)throw new Error("ElevationProfileLineGround: no dependencies");const{ground:n}=r;if(n==null)throw new Error("No ground configured in the view");const s=await n.queryElevation(e,i),o=ad(e.spatialReference),a=ad(n.layers.at(0).spatialReference);if(o!==a){const c=s.geometry;c.points=c.points.map(([p,_,x])=>[p,_,x===i.noDataValue?x:x*a/o])}return s}attach(e){return sd([super.attach(e),_e(()=>this._queryElevationDependencies,()=>this._onChange())])}};y([w({type:qe,nonNullable:!0})],Zg.prototype,"color",void 0),y([w()],Zg.prototype,"viewVisualizationEnabled",void 0),y([w()],Zg.prototype,"available",null),y([w({readOnly:!0})],Zg.prototype,"minDemResolution",null),y([w()],Zg.prototype,"_queryElevationDependencies",null),y([w()],Zg.prototype,"_ground",null),y([w()],Zg.prototype,"_groundLayers",null),Zg=y([Z("esri.widgets.ElevationProfile.ElevationProfileLineGround")],Zg);const Pje=Zg;let _3e=class{constructor(e,i=null){if(this.tile=e,i!=null&&e!=null){const r=e.extent;this._samplerData=new rFe(i,r)}}get zmin(){return this._samplerData!=null?this._samplerData.data.minValue:0}get zmax(){return this._samplerData!=null?this._samplerData.data.maxValue:0}sample(e,i){if(this._samplerData==null)return;const{safeWidth:r,data:n,dx:s,dy:o,y1:a,x0:c}=this._samplerData,{width:p,values:_,noDataValue:x}=n,S=b3e(o*(a-i),0,r),C=b3e(s*(e-c),0,r),M=Math.floor(S),P=Math.floor(C),$=M*p+P,F=$+p,z=_[$],k=_[F],U=_[$+1],j=_[F+1];if(z!==x&&k!==x&&U!==x&&j!==x){const G=C-P,Y=z+(U-z)*G;return Y+(k+(j-k)*G-Y)*(S-M)}}};function b3e(t,e,i){return ti?i:t}let Dqt=class{async queryAll(e,i,r){if(!(e=r&&r.ignoreInvisibleLayers?e.filter(p=>p.visible):e.slice()).length)throw new se("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");const n=hT.fromGeometry(i);let s=!1;r&&r.returnSampleInfo||(s=!0);const o={...g7,...r,returnSampleInfo:!0},a=await this.query(e[e.length-1],n,o),c=await this._queryAllContinue(e,a,o);return c.geometry=c.geometry.export(),s&&delete c.sampleInfo,c}async query(e,i,r){if(!e)throw new se("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||!(i instanceof hT)&&i.type!=="point"&&i.type!=="multipoint"&&i.type!=="polyline")throw new se("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const n={...g7,...r},s=new Nqt(e,i.spatialReference,n),o=n.signal;return await e.load({signal:o}),await this._createGeometryDescriptor(s,i,o),await this._selectTiles(s,o),await this._populateElevationTiles(s,o),this._sampleGeometryWithElevation(s),this._createQueryResult(s,o)}async createSampler(e,i,r){if(!e)throw new se("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||i.type!=="extent")throw new se("elevation-query:invalid-extent","Invalid or undefined extent");const n={...g7,...r};return this._createSampler(e,i,n)}async createSamplerAll(e,i,r){if(!(e=r&&r.ignoreInvisibleLayers?e.filter(o=>o.visible):e.slice()).length)throw new se("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");if(!i||i.type!=="extent")throw new se("elevation-query:invalid-extent","Invalid or undefined extent");const n={...g7,...r,returnSampleInfo:!0},s=await this._createSampler(e[e.length-1],i,n);return this._createSamplerAllContinue(e,i,s,n)}async _createSampler(e,i,r,n){const s=r.signal;await e.load({signal:s});const o=i.spatialReference,a=e.tileInfo.spatialReference;o.equals(a)||(await T_([{source:o,dest:a}],{signal:s}),i=sl(i,a));const c=new Fqt(e,i,r,n);return await this._selectTiles(c,s),await this._populateElevationTiles(c,s),new J0e(c.elevationTiles,c.layer.tileInfo,c.options.noDataValue)}async _createSamplerAllContinue(e,i,r,n){if(e.pop(),!e.length)return r;const s=r.samplers.map(p=>ise(p.extent)),o=await this._createSampler(e[e.length-1],i,n,s);if(o.samplers.length===0)return r;const a=r.samplers.concat(o.samplers),c=new J0e(a,n.noDataValue);return this._createSamplerAllContinue(e,i,c,n)}async _queryAllContinue(e,i,r){const n=e.pop(),s=i.geometry.coordinates,o=i.sampleInfo;Gy(o);const a=[],c=[];for(let S=0;S=0?C.source||(C.source=n):e.length&&(a.push(s[S]),c.push(S))}if(!e.length||a.length===0)return i;const p=i.geometry.clone(a),_=await this.query(e[e.length-1],p,r),x=_.sampleInfo;if(!x)throw new Error("no sampleInfo");return c.forEach((S,C)=>{s[S].z=_.geometry.coordinates[C].z,o[S].demResolution=x[C].demResolution}),this._queryAllContinue(e,i,r)}async _createQueryResult(e,i){const r=await e.geometry.project(e.outSpatialReference,i);Gy(r);const n={geometry:r.export(),noDataValue:e.options.noDataValue};return e.options.returnSampleInfo&&(n.sampleInfo=this._extractSampleInfo(e)),e.geometry.coordinates.forEach(s=>{s.tile=null,s.elevationTile=null}),n}async _createGeometryDescriptor(e,i,r){let n;const s=e.layer.tileInfo.spatialReference;if(i instanceof hT?n=await i.project(s,r):(await T_([{source:i.spatialReference,dest:s}],{signal:r}),n=sl(i,s)),!n)throw new se("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${s.wkid}'`);e.geometry=hT.fromGeometry(n)}async _selectTiles(e,i){e.type==="geometry"&&this._preselectOutsideLayerExtent(e);const r=e.options.demResolution;if(typeof r=="number")this._selectTilesClosestResolution(e,r);else if(r==="finest-contiguous")await this._selectTilesFinestContiguous(e,i);else{if(r!=="auto")throw new se("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${r}', expected a number, "finest-contiguous" or "auto"`);await this._selectTilesAuto(e,i)}}_preselectOutsideLayerExtent(e){if(e.layer.fullExtent==null)return;const i=new _3e(null);i.sample=()=>e.options.noDataValue,e.outsideExtentTile=i;const r=e.layer.fullExtent;e.geometry.coordinates.forEach(n=>{const s=n.x,o=n.y;(sr.xmax||or.ymax)&&(n.elevationTile=i)})}_selectTilesClosestResolution(e,i){const r=this._findNearestDemResolutionLODIndex(e,i);e.selectTilesAtLOD(r)}_findNearestDemResolutionLODIndex(e,i){const{tileInfo:r,tilemapCache:n}=e.layer,s=i/xs(r.spatialReference),o=v9(r,n);let a=o[0],c=0;for(let p=1;ps.fetchAvailability(a.level,a.row,a.col,{signal:r}))),r);else if(await this._populateElevationTiles(e,r),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new se("elevation-query:has-unavailable-tiles")}catch(a){Uo(a),await this._selectTilesFinestContiguousAt(e,i-1,r)}}async _populateElevationTiles(e,i){const r=e.getTilesToFetch(),n={},s=e.options.cache,o=e.options.noDataValue,a=r.map(async c=>{if(c.id==null)return;const p=`${e.layer.uid}:${c.id}:${o}`,_=s!=null?s.get(p):null,x=_??await e.layer.fetchTile(c.level,c.row,c.col,{noDataValue:o,signal:i});s!=null&&s.put(p,x),n[c.id]=new _3e(c,x)});await dT(Promise.allSettled(a),i),e.populateElevationTiles(n)}async _selectTilesAuto(e,i){this._selectTilesAutoFinest(e),this._reduceTilesForMaximumRequests(e);const r=e.layer.tilemapCache;if(!r||Qre(r))return this._selectTilesAutoPrefetchUpsample(e,i);const n=e.getTilesToFetch(),s={},o=n.map(async a=>{const c=new Lj(null,0,0,0,Ni()),p=await ih(r.fetchAvailabilityUpsample(a.level,a.row,a.col,c,{signal:i}));p.ok!==!1?a.id!=null&&(s[a.id]=c):Uo(p.error)});await dT(Promise.all(o),i),e.remapTiles(s)}_reduceTilesForMaximumRequests(e){const i=e.layer.tileInfo;let r=0;const n={},s=c=>{c.id!=null&&(c.id in n?n[c.id]++:(n[c.id]=1,r++))},o=c=>{if(c.id==null)return;const p=n[c.id];p===1?(delete n[c.id],r--):n[c.id]=p-1};e.forEachTileToFetch(s,o);let a=!0;for(;a&&(a=!1,e.forEachTileToFetch(c=>{r<=e.options.maximumAutoTileRequests||(o(c),i.upsampleTile(c)&&(a=!0),s(c))},o),a););}_selectTilesAutoFinest(e){const{tileInfo:i,tilemapCache:r}=e.layer,n=Kre(i,r,e.options.minDemResolution);e.selectTilesAtLOD(n,e.options.maximumAutoTileRequests)}async _selectTilesAutoPrefetchUpsample(e,i){const r=e.layer.tileInfo;await this._populateElevationTiles(e,i);let n=!1;e.forEachTileToFetch((s,o)=>{r.upsampleTile(s)?n=!0:o()}),n&&await this._selectTilesAutoPrefetchUpsample(e,i)}_sampleGeometryWithElevation(e){e.geometry.coordinates.forEach(i=>{const r=i.elevationTile;let n=e.options.noDataValue;if(r){const s=r.sample(i.x,i.y);s!=null?n=s:i.elevationTile=null}i.z=n})}_extractSampleInfo(e){const i=e.layer.tileInfo,r=xs(i.spatialReference);return e.geometry.coordinates.map(n=>{let s=-1;return n.elevationTile&&n.elevationTile!==e.outsideExtentTile&&(s=i.lodAt(n.elevationTile.tile.level).resolution*r),{demResolution:s}})}},hT=class Yk{export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const i=new Yk;return i.geometry=this.geometry,i.spatialReference=this.spatialReference,i.coordinates=e||this.coordinates.map(r=>r.clone()),i._exporter=this._exporter,i}async project(e,i){if(this.spatialReference.equals(e))return this.clone();await T_([{source:this.spatialReference,dest:e}],{signal:i});const r=new Mm({spatialReference:this.spatialReference,points:this.coordinates.map(a=>[a.x,a.y])}),n=sl(r,e);if(!n)return null;const s=this.coordinates.map((a,c)=>{const p=a.clone(),_=n.points[c];return p.x=_[0],p.y=_[1],p}),o=this.clone(s);return o.spatialReference=e,o}static fromGeometry(e){const i=new Yk;if(i.geometry=e,i.spatialReference=e.spatialReference,e instanceof Yk)i.coordinates=e.coordinates.map(r=>r.clone()),i._exporter=(r,n)=>{const s=e.clone(r);return s.spatialReference=n,s};else switch(e.type){case"point":{const r=e,{hasZ:n,hasM:s}=r;i.coordinates=n&&s?[new Gp(r.x,r.y,r.z,r.m)]:n?[new Gp(r.x,r.y,r.z)]:s?[new Gp(r.x,r.y,null,r.m)]:[new Gp(r.x,r.y)],i._exporter=(o,a)=>e.hasM?new mt(o[0].x,o[0].y,o[0].z,o[0].m,a):new mt(o[0].x,o[0].y,o[0].z,a);break}case"multipoint":{const r=e,{hasZ:n,hasM:s}=r;i.coordinates=n&&s?r.points.map(o=>new Gp(o[0],o[1],o[2],o[3])):n?r.points.map(o=>new Gp(o[0],o[1],o[2])):s?r.points.map(o=>new Gp(o[0],o[1],null,o[2])):r.points.map(o=>new Gp(o[0],o[1])),i._exporter=(o,a)=>e.hasM?new Mm({points:o.map(c=>[c.x,c.y,c.z,c.m]),hasZ:!0,hasM:!0,spatiaReference:a}):new Mm(o.map(c=>[c.x,c.y,c.z]),a);break}case"polyline":{const r=e,n=[],s=[],{hasZ:o,hasM:a}=e;let c=0;for(const p of r.paths)if(s.push([c,c+p.length]),c+=p.length,o&&a)for(const _ of p)n.push(new Gp(_[0],_[1],_[2],_[3]));else if(o)for(const _ of p)n.push(new Gp(_[0],_[1],_[2]));else if(a)for(const _ of p)n.push(new Gp(_[0],_[1],null,_[2]));else for(const _ of p)n.push(new Gp(_[0],_[1]));i.coordinates=n,i._exporter=(p,_)=>{const x=e.hasM?p.map(C=>[C.x,C.y,C.z,C.m]):p.map(C=>[C.x,C.y,C.z]),S=s.map(C=>x.slice(C[0],C[1]));return new Tc({paths:S,hasM:e.hasM,hasZ:!0,spatialReference:_})};break}}return i}},Gp=class Rje{constructor(e,i,r=null,n=null,s=null,o=null){this.x=e,this.y=i,this.z=r,this.m=n,this.tile=s,this.elevationTile=o}clone(){return new Rje(this.x,this.y,this.z,this.m)}},Ije=class{constructor(e,i){this.layer=e,this.options=i}},Nqt=class extends Ije{constructor(e,i,r){super(e,r),this.outSpatialReference=i,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach(i=>i.tile=null);else{const{tileInfo:i,tilemapCache:r}=this.layer,n=v9(i,r)[e].level;this.geometry.coordinates.forEach(s=>s.tile=i.tileAt(n,s.x,s.y))}}allElevationTilesFetched(){return!this.geometry.coordinates.some(e=>!e.elevationTile)}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){var i;for(const r of this.geometry.coordinates)!r.elevationTile&&((i=r.tile)!=null&&i.id)&&(r.elevationTile=e[r.tile.id])}remapTiles(e){var i;for(const r of this.geometry.coordinates){const n=(i=r.tile)==null?void 0:i.id;r.tile=n?e[n]:null}}getTilesToFetch(){var r;const e={},i=[];for(const n of this.geometry.coordinates){const s=n.tile;if(!s)continue;const o=(r=n.tile)==null?void 0:r.id;n.elevationTile||!o||e[o]||(e[o]=s,i.push(s))}return i}forEachTileToFetch(e){for(const i of this.geometry.coordinates)i.tile&&!i.elevationTile&&e(i.tile,()=>{i.tile=null})}},Fqt=class extends Ije{constructor(e,i,r,n){super(e,r),this.type="extent",this.elevationTiles=[],this._candidateTiles=[],this._fetchedCandidates=new Set,this.extent=i.intersection(e.fullExtent),this.maskExtents=n}selectTilesAtLOD(e,i){const r=this._maximumLodForRequests(i),n=Math.min(r,e);n<0?this._candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(n)}_maximumLodForRequests(e){const{tileInfo:i,tilemapCache:r}=this.layer,n=v9(i,r);if(!e)return n.length-1;const s=this.extent;if(s==null)return-1;for(let o=n.length-1;o>=0;o--){const a=n[o],c=a.resolution*i.size[0],p=a.resolution*i.size[1];if(Math.ceil(s.width/c)*Math.ceil(s.height/p)<=e)return o}return-1}allElevationTilesFetched(){return this._candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this._fetchedCandidates.clear()}populateElevationTiles(e){for(const i of this._candidateTiles){const r=i.id&&e[i.id];r&&(this._fetchedCandidates.add(i),this.elevationTiles.push(r))}}remapTiles(e){this._candidateTiles=this._uniqueNonOverlappingTiles(this._candidateTiles.map(i=>e[i.id]))}getTilesToFetch(){return this._candidateTiles}forEachTileToFetch(e,i){const r=this._candidateTiles;this._candidateTiles=[],r.forEach(n=>{if(this._fetchedCandidates.has(n))return void(i&&i(n));let s=!1;e(n,()=>s=!0),s?i&&i(n):this._candidateTiles.push(n)}),this._candidateTiles=this._uniqueNonOverlappingTiles(this._candidateTiles,i)}_uniqueNonOverlappingTiles(e,i){const r={},n=[];for(const o of e){const a=o.id;a&&!r[a]?(r[a]=o,n.push(o)):i&&i(o)}const s=n.sort((o,a)=>o.level-a.level);return s.filter((o,a)=>{for(let c=0;ce.extent&&Oz(i,e.extent))}};function Kre(t,e,i=0){const r=v9(t,e);let n=r.length-1;if(i>0){const s=i/xs(t.spatialReference),o=r.findIndex(a=>a.resolution0&&(n=o-1)}return n}const g7={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0};function v9(t,e){const i=t.lods;if(Qre(e)){const{effectiveMinLOD:r,effectiveMaxLOD:n}=e;return i.filter(s=>s.level>=r&&s.level<=n)}return i}function Qre(t){return(t==null?void 0:t.tileInfo)!=null}const ZV=Object.freeze(Object.defineProperty({__proto__:null,ElevationQuery:Dqt,GeometryDescriptor:hT,getFinestLodIndex:Kre},Symbol.toStringTag,{value:"Module"}));let Ev=class extends P6{constructor(e){super(e),this.type="input",this.color=new qe("#00c8c8"),this.viewVisualizationEnabled=!1,this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this.chartFillEnabled=!1,this.chartStrokeOffsetY=-1,this._getQueryElevationDependencies=Cm((i,r,n,s,o)=>i?{elevationInfo:i,visibleLayers:r,view:n,stationary:s,spatialReference:o}:null)}get queryElevationDependencies(){var i;const e=(i=this._viewModel)==null?void 0:i.view;return e==null?null:this._getQueryElevationDependencies(this._elevationInfo,this._visibleLayers,e,e.stationary,e.spatialReference)}get available(){var e;return!((e=this._viewModel)!=null&&e.inputIsSketched)}get _elevationInfo(){var i;const e=(i=this._viewModel)==null?void 0:i.input;return e?qPe(e):null}get _visibleLayers(){var e,i,r,n;return((n=(r=(i=(e=this._viewModel)==null?void 0:e.view)==null?void 0:i.map)==null?void 0:r.allLayers)==null?void 0:n.filter(s=>s.visible).toArray())??[]}async queryElevation(e,{noDataValue:i,signal:r}){const n=this.queryElevationDependencies;if(n==null)throw new Error("ElevationProfileLineInput: no dependencies");const{view:s,elevationInfo:o,spatialReference:a}=n;if(o.mode==="on-the-ground"&&s.type==="3d"&&a){const c=await hT.fromGeometry(e).project(a,r);if(!c)return{geometry:e,noDataValue:i};const p=s.elevationProvider;return c.coordinates.forEach(_=>{_.z=p.getElevation(_.x,_.y,0,a,"ground")??0}),{geometry:c.export(),noDataValue:i}}return{geometry:e,noDataValue:i}}attach(e){const i=()=>this._onChange();return sd([super.attach(e),_e(()=>this.queryElevationDependencies,i),Jr(()=>e.elevationProvider,"elevation-change",i,{onListenerAdd:i,onListenerRemove:i})])}};y([w({type:qe,nonNullable:!0})],Ev.prototype,"color",void 0),y([w()],Ev.prototype,"viewVisualizationEnabled",void 0),y([w()],Ev.prototype,"queryElevationDependencies",null),y([w()],Ev.prototype,"available",null),y([w()],Ev.prototype,"_elevationInfo",null),y([w()],Ev.prototype,"_visibleLayers",null),Ev=y([Z("esri.widgets.ElevationProfile.ElevationProfileLineInput")],Ev);const kqt=Ev;let Pw=class extends P6{constructor(e){super(e),this.type="query",this.color=new qe("#db334a"),this.viewVisualizationEnabled=!0,this.source=null,this.numSamplesForPreview=50,this.numSamplesPerChunk=500}get minDemResolution(){return Mje(this.source)}get available(){const e=this.source;return!!e&&(e.visible==null||e.visible)&&(e.layers==null||e.layers.some(i=>i.visible))}queryElevation(e,i){if(!this.source)throw new Error("No source configured for the elevation profile line");return this.source.queryElevation(e,i)}attach(e){return sd([super.attach(e),_e(()=>this.source,()=>this._onChange(),Li)])}};y([w({type:qe,nonNullable:!0})],Pw.prototype,"color",void 0),y([w()],Pw.prototype,"viewVisualizationEnabled",void 0),y([w()],Pw.prototype,"source",void 0),y([w({readOnly:!0})],Pw.prototype,"minDemResolution",null),y([w()],Pw.prototype,"available",null),Pw=y([Z("esri.widgets.ElevationProfile.ElevationProfileLineQuery")],Pw);const zqt=Pw,Uqt=2e5;let Fu=class extends P6{constructor(e){super(e),this.type="view",this.color=new qe("#cf4ccf"),this.viewVisualizationEnabled=!0,this.include=null,this.exclude=null,this.numSamplesForPreview=50,this.numSamplesPerChunk=25,this._getQueryElevationDependencies=Cm((i,r,n,s,o,a,c)=>({inputGraphicUid:i!=null?$je(i):null,visibleLayers:r,maxIntersectionDistance:n,intersectOptions:s,view:o,stationary:a,spatialReference:c})),this._vecA=Xi(),this._vecB=Xi(),this._ray=Qo()}get minDemResolution(){var r,n,s;const e=(r=this._viewModel)==null?void 0:r.view;if(e==null||e.type!=="3d")return null;const i=(s=(n=e.pointsOfInterest)==null?void 0:n.focus)==null?void 0:s.renderLocation;return i?e.state.camera.computeRenderPixelSizeAt(i)*ad(e.spatialReference):null}get queryElevationDependencies(){var i;const e=this._view;return e?this._getQueryElevationDependencies((i=this._viewModel)==null?void 0:i.input,this._visibleLayers,this._maxIntersectionDistance,this._intersectOptions,e,e.stationary,e.spatialReference):null}get _visibleLayers(){var e,i,r;return((r=(i=(e=this._view)==null?void 0:e.map)==null?void 0:i.allLayers)==null?void 0:r.filter(n=>n.visible).toArray())??[]}get _intersectOptions(){const e=this._view;if(e==null||e.destroyed)return{};const i=e.externalToInternalIntersectOptions({include:this.include,exclude:this.exclude}),r=e.externalToInternalIntersectOptions({exclude:this._pointCloudLayers});return i.exclude=JSe(i.exclude,r.exclude),i}get _pointCloudLayers(){const e=this._view;return e==null?[]:e.allLayerViews.toArray().filter(i=>{var r;return((r=i.layer)==null?void 0:r.type)==="point-cloud"}).map(i=>i.layer)}get _view(){var i;const e=(i=this._viewModel)==null?void 0:i.view;return e!=null&&e.type==="3d"?e:null}get _maxIntersectionDistance(){const e=this._view;return e!=null&&e.renderCoordsHelper?Tr(e.spatialReference).radius/e.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY}get _intersector(){const e=this._view;if(e==null)return null;const i=Mp(e.state.viewingMode),r=i.options;return r.hud=!1,r.invisibleTerrain=!1,r.backfacesTerrain=!1,r.selectionMode=!1,r.store=rl.ALL,i}async queryElevation(e,{noDataValue:i,signal:r}){const n=this.queryElevationDependencies;if(n==null)throw new Error("ElevationProfileLineInput: no dependencies");const s=this._intersector;if(s==null)throw new Error("ElevationProfileLineInput: no view");const{intersectOptions:o,view:a,spatialReference:c}=n,p=a.renderCoordsHelper,_=a.sceneIntersectionHelper,x=this._vecA,S=this._vecA,C=this._vecB,M=this._ray;if(!c)return{geometry:e,noDataValue:i};const P=await hT.fromGeometry(e).project(c,r);if(!P)return{geometry:e,noDataValue:i};const $=P.coordinates,F=$.length;for(let z=0;zthis._onChange();return sd([super.attach(e),_e(()=>this.queryElevationDependencies,i),Jr(()=>e.elevationProvider,"elevation-change",i,{onListenerAdd:i,onListenerRemove:i})])}};function Vqt({view:t,inputGraphicUid:e,maxIntersectionDistance:i},r){for(const n of r){if(n.distanceInRenderSpace!=null&&n.distanceInRenderSpace>i)continue;const s=ENt(n,t);if(s==null||$je(s)!==e)return n}return null}function $je(t){if(t.layer&&"objectIdField"in t.layer){const e=t.attributes[t.layer.objectIdField];if(e)return`o-${t.layer.id}-${e}`}return`u-${t.uid}`}y([w({type:qe,nonNullable:!0})],Fu.prototype,"color",void 0),y([w()],Fu.prototype,"viewVisualizationEnabled",void 0),y([w()],Fu.prototype,"include",void 0),y([w()],Fu.prototype,"exclude",void 0),y([w({readOnly:!0})],Fu.prototype,"minDemResolution",null),y([w()],Fu.prototype,"queryElevationDependencies",null),y([w()],Fu.prototype,"_visibleLayers",null),y([w()],Fu.prototype,"_intersectOptions",null),y([w()],Fu.prototype,"_pointCloudLayers",null),y([w()],Fu.prototype,"_view",null),y([w()],Fu.prototype,"_maxIntersectionDistance",null),y([w()],Fu.prototype,"_intersector",null),Fu=y([Z("esri.widgets.ElevationProfile.ElevationProfileLineView")],Fu);const Bqt=Fu,jqt={base:P6,key:"type",typeMap:{ground:Pje,input:kqt,query:zqt,view:Bqt},errorContext:"elevation-profile-line"},Gqt=tt.ofType(jqt);var ps,Jd;function Hqt(t){return t==="2d"?new cx({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5,color:[0,0,0,255]},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5,color:[255,255,255,255]}]}}}):new Ic({color:[0,0,0,0]})}(function(t){t.Ready="ready",t.Creating="creating",t.Reshaping="reshaping",t.ReshapingDisabled="rehsaping-disabled",t.Selecting="selecting",t.Selected="selected"})(ps||(ps={})),function(t){t.View="view",t.Main="main",t.Interaction="interaction"}(Jd||(Jd={}));let Gd=class extends ze{constructor(e){super(e),this.state=ps.Ready,this._pendingStartOptions=null,this._previousInputInfo=null,this._shouldRemoveLastPoint=!1,this._sketchedGraphics=new WeakSet,this._creationToolPromise=null,this._updateToolPromise=null,this._updateDisabled=!1}initialize(){this.addHandles(_e(()=>({view:this.tool.viewModel.view,visible:this.tool.visible}),({view:e,visible:i})=>{e!=null&&i?this._attach(e):this._detach()},kt),Jd.View)}destroy(){this._detach()}get canStopCreating(){const e=this._geometry,i=this._shouldRemoveLastPoint?3:2;return O6(e)&&e.paths.length>0&&e.paths[0].length>=i}get _input(){return this.tool.viewModel.input}set _input(e){this.tool.viewModel.input=e}get _geometry(){var e;return(e=this._input)==null?void 0:e.geometry}get _visibleAndEditable(){return this.tool.visible&&this.tool.editable}get _view(){return this.tool.viewModel.view}get test(){return{sketchVM:this._sketchVM,toolPromise:Promise.all([this._creationToolPromise??Promise.resolve(),this._updateToolPromise??Promise.resolve()])}}start(e={mode:"sketch"}){if(!this.tool.editable)return;const i=this._view;if(i!=null&&i.ready)switch(this._pendingStartOptions=null,this._stopInteraction(),this._previousInputInfo==null&&this._storePreviousInput(this._input),this._setSketchedGraphic(null),e.mode){case"sketch":this._set("state",ps.Creating),this._startCreationInteraction();break;case"select":this._set("state",ps.Selecting),this._startSelectionInteraction()}else this._pendingStartOptions=e}stop(){this._pendingStartOptions=null,this._stopInteractionAndUpdate(),this._clearPreviousInput()}cancel(){this._pendingStartOptions=null,this._stopInteractionAndUpdate(),this._restorePreviousInput()}clear(){this._stopInteractionAndUpdate(),this._set("state",ps.Ready),this._clearPreviousInput(),this._input=null,this._pendingStartOptions=null}isSketchedGraphic(e){return e!=null&&this._sketchedGraphics.has(e)}_attach(e){this._detach();const i={mode:e.type==="3d"?"relative-to-ground":"on-the-ground",offset:null};this._graphicsLayer=new eoe({listMode:"hide",internal:!0,elevationInfo:i});const r=Hqt(e.type);this._sketchVM=new nje({layer:this._graphicsLayer,view:e,defaultCreateOptions:{mode:"click",hasZ:!1},updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:"none"},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"reshape"},polylineSymbol:r,activeLineSymbol:r}),this.addHandles([Oo(()=>e.ready,()=>{const n=this._pendingStartOptions;n&&this.start(n)},kt),_e(()=>[this._input,this._visibleAndEditable],()=>this._update(),kt),_e(()=>({map:e.map,graphicsLayer:this._graphicsLayer}),({map:n,graphicsLayer:s})=>{n!=null&&s!=null&&n.add(s),this._update()},kt)],Jd.Main)}_detach(){var r;this.removeHandles(Jd.Main),this._sketchVM=et(this._sketchVM),this._creationToolPromise=null,this._updateToolPromise=null;const e=(r=this._view)==null?void 0:r.map,i=this._graphicsLayer;e!=null&&i!=null&&e.remove(i),this._graphicsLayer=et(this._graphicsLayer),this._shouldRemoveLastPoint=!1,this._set("state",ps.Ready)}_startCreationInteraction(){this._stopInteractionAndUpdate();const e=this._view,i=this._sketchVM;if(e==null||i==null)return;this._shouldRemoveLastPoint=!1;const r=i.on("create",s=>{var a;const o=s.graphic;switch(s.state){case"complete":this._shouldRemoveLastPoint=!1,this._setSketchedGraphic(o),this._stopInteractionAndUpdate(),this._clearPreviousInput();break;case"cancel":this.cancel();break;case"active":this._setSketchedGraphic(o),((a=s.toolEventInfo)==null?void 0:a.type)==="cursor-update"&&(this._shouldRemoveLastPoint=!0);break;case"start":this._setSketchedGraphic(o)}}),n=()=>{var a;r.remove();const s=this.canStopCreating,o=(a=this._geometry)==null?void 0:a.clone();i.cancel(),this._creationToolPromise=null,o!=null&&s?this._shouldRemoveLastPoint&&this._setSketchedGraphic(new Ma({geometry:qqt(o)})):this._input=null};this.removeHandles(Jd.Interaction),this.addHandles(rr(n),Jd.Interaction),this._creationToolPromise=Nm(i.create("polyline"))}_startReshapeInteraction(){this._stopInteraction();const e=this._view,i=this._sketchVM;if(e==null||i==null)return;const r=i.on("update",o=>{const a=o.graphics[0];switch(o.state){case"complete":this._setSketchedGraphic(a),this._stopInteractionAndUpdate(),this._clearPreviousInput();break;case"active":case"start":this._setSketchedGraphic(a)}}),n=()=>{r.remove(),i.cancel(),this._updateToolPromise=null};this.removeHandles(Jd.Interaction),this.addHandles(rr(n),Jd.Interaction);const s=this._input;s&&(s.visible=!0,this._updateToolPromise=Nm(i.update(s,{tool:"reshape"})))}_startSelectionInteraction(){this._stopInteraction();const e=this._view;if(e==null)return;const i=e.cursor,r=rr(()=>e.cursor=i);e.cursor="crosshair",e.closePopup();let n=null;const s=rr(()=>vn(n)),o=e.on("immediate-click",c=>{c.preventDefault(),c.stopPropagation(),vn(n),n=Oc(async p=>{const{results:_}=await e.hitTest(c);St(p);const x=_.filter(S=>S.type==="graphic"&&S.graphic!=null).map(S=>S.graphic).find(S=>S.geometry!=null&&S.geometry.type==="polyline");x&&(this._input=x,this._clearPreviousInput(),this._stopInteractionAndUpdate())})}),a=e.on("key-down",c=>{c.key==="Escape"&&this.cancel()});this.removeHandles(Jd.Interaction),this.addHandles([o,a,s,r],Jd.Interaction),e.ready&&e.focus()}_stopInteraction(){this.removeHandles(Jd.Interaction)}_stopInteractionAndUpdate(){this.hasHandles(Jd.Interaction)&&(this._updateDisabled=!0,this._stopInteraction(),this._updateDisabled=!1,this._triggerUpdate())}_triggerUpdate(){this._set("state",ps.Ready),this._update()}_update(){if(this._updateDisabled)return;const e=this.state;if(e!==ps.Selecting){if(this._visibleAndEditable){if(e===ps.Creating||e===ps.Reshaping&&this.isSketchedGraphic(this._input))return}else this.cancel();this._set("state",this._getNextState()),this._updateVisuals()}else this.stop()}_getNextState(){return this._input==null?ps.Ready:this.isSketchedGraphic(this._input)?this.state===ps.Creating?ps.Creating:this._visibleAndEditable?ps.Reshaping:ps.ReshapingDisabled:ps.Selected}_updateVisuals(){switch(this.state){case ps.Creating:break;case ps.Reshaping:this._startReshapeInteraction();break;case ps.ReshapingDisabled:{this._stopInteractionAndUpdate();const e=this._input;e!=null&&this.isSketchedGraphic(e)&&(e.visible=!1);break}case ps.Ready:case ps.Selected:this._stopInteractionAndUpdate();case ps.Selecting:}this._updateSketchedGraphic()}_storePreviousInput(e){this._previousInputInfo={graphic:e}}_restorePreviousInput(){const e=this._previousInputInfo;e!=null&&(this._clearPreviousInput(),this._input=e.graphic,this._triggerUpdate())}_clearPreviousInput(){this._previousInputInfo=null}_updateSketchedGraphic(){const e=this._graphicsLayer;if(e==null)return;const i=e.graphics,r=this._input;if(r==null||!this.isSketchedGraphic(r))return void i.removeAll();if(i.indexOf(r)===-1)i.removeAll(),i.add(r);else if(i.length!==1){const n=i.filter(s=>s!==r);i.removeMany(n)}}_setSketchedGraphic(e){e!=null&&this._sketchedGraphics.add(e),this._input=e,this._updateSketchedGraphic()}};function qqt(t){if(O6(t)){const e=t.clone();return e.paths=[e.paths[0].slice(0,-1)],e}return t}y([w({nonNullable:!0})],Gd.prototype,"state",void 0),y([w({nonNullable:!0})],Gd.prototype,"tool",void 0),y([w()],Gd.prototype,"canStopCreating",null),y([w()],Gd.prototype,"_graphicsLayer",void 0),y([w()],Gd.prototype,"_sketchVM",void 0),y([w()],Gd.prototype,"_input",null),y([w()],Gd.prototype,"_geometry",null),y([w()],Gd.prototype,"_visibleAndEditable",null),y([w()],Gd.prototype,"_view",null),y([w()],Gd.prototype,"_shouldRemoveLastPoint",void 0),Gd=y([Z("esri.widgets.ElevationProfile.ElevationProfileInteraction")],Gd);let Xk=class extends ze{constructor(e){super(e),this._implementation=null,this._loadingTask=null}initialize(){this.addHandles(_e(()=>{var e;return{tool:this.tool,view:this.tool.viewModel.view,visible:this.tool.visible&&!!((e=this.tool.viewModel.view)!=null&&e.ready)}},({tool:e,view:i,visible:r})=>{i!=null&&r?this._show(i,e):this._hide()},kt))}destroy(){this._hide()}_show(e,i){this._loadingTask=vn(this._loadingTask),this._loadingTask=Oc(async r=>{if(e.type==="2d"){const n=we(()=>import("./ElevationProfileView2D-5R-6KsXv.js"),__vite__mapDeps([270,271,113])),s=(await dT(n,r)).ElevationProfileView2D;this._implementation=new s(e,i)}else if(e.type==="3d"){const n=we(()=>import("./ElevationProfileView3D-ffQcLfOL.js"),__vite__mapDeps([272,271,113,255,191,164,192,178,193])),s=(await dT(n,r)).ElevationProfileView3D;this._implementation=new s(e,i)}})}_hide(){this._loadingTask=vn(this._loadingTask),this._implementation=et(this._implementation)}};y([w()],Xk.prototype,"tool",void 0),Xk=y([Z("esri.widgets.ElevationProfile.support.ElevationProfileView")],Xk);let Cv=class extends ze{constructor(e){super(e),this.editable=!0,this.visible=!0,this.highlightEnabled=!0}initialize(){this.view=new Xk({tool:this}),this.interaction=new Gd({tool:this})}destroy(){this.interaction.destroy(),this.view.destroy()}get state(){var i;switch((i=this.interaction)==null?void 0:i.state){case ps.Ready:return qh.Ready;case ps.Creating:return qh.Creating;case ps.Selecting:return qh.Selecting;case ps.Selected:return qh.Selected;case ps.Reshaping:case ps.ReshapingDisabled:return qh.Created}}};y([w({nonNullable:!0})],Cv.prototype,"viewModel",void 0),y([w()],Cv.prototype,"view",void 0),y([w()],Cv.prototype,"interaction",void 0),y([w()],Cv.prototype,"editable",void 0),y([w()],Cv.prototype,"visible",void 0),y([w()],Cv.prototype,"highlightEnabled",void 0),Cv=y([Z("esri.widgets.ElevationProfile.ElevationProfileTool")],Cv);let dn=class extends ze{constructor(e){super(e),this.view=null,this.input=null,this._getEffectiveUnitsMemoized=Cm((i,r)=>({distance:i,elevation:r})),this.geodesicDistanceThreshold=1e5,this.hoveredChartPosition=null,this.uniformChartScaling=!1,this.defaultUnit=null,this.queue=null,this._currentTileCache=null,this.error=null,this._defaultProfileLineGround=new Pje,this._userUnitOptions=null,this._userUnit=null,e!=null&&e.profiles||(this.profiles=new tt([this._defaultProfileLineGround]))}initialize(){this.addHandles(_e(()=>this.view,e=>{var n;if(e==null)return void Ce.getLogger(this).warnOnce("no view. Widget will be disabled until a view is provided.");this.removeHandles(w3e);const i=e.type==="3d"?e.resourceController:void 0;(n=this.queue)==null||n.destroy(),this.queue=Tqt(i==null?void 0:i.scheduler);const r=i==null?void 0:i.addUpdatingObject(this);r&&this.addHandles(r,w3e)},kt)),this.tool=new Cv({viewModel:this}),this._controller=new Ow({viewModel:this})}destroy(){this._defaultProfileLineGround=et(this._defaultProfileLineGround),this._controller=et(this._controller),this._currentTileCache=et(this._currentTileCache),this.tool=et(this.tool),this.queue=et(this.queue)}get profiles(){return this._get("profiles")}set profiles(e){const i=this._get("profiles"),r=e??new tt;this._set("profiles",od(r,i))}get state(){const e=this.view;return e!=null&&e.ready?this.tool.state:qh.Disabled}get progress(){let e=0,i=0;for(const r of this.visibleProfiles)e++,i+=r.progress;return e>0?i/e:0}set unitOptions(e){this._userUnitOptions=e,this._set("unitOptions",this._filteredOrAllUnits(this._userUnitOptions))}get unitOptions(){return this._filteredOrAllUnits(this._userUnitOptions)}set unit(e){this._userUnit=e?this._findSelectableUnit(e,this._userUnit):null,this.notifyChange("unit")}get unit(){return this._userUnit?(this._userUnit=this._findSelectableUnit(this._userUnit,this.defaultUnit),this._userUnit):this._findSelectableUnit(this.defaultUnit)}get effectiveUnits(){const e=wqt(this.visibleProfiles.map(n=>n.result)),i=zWe(e.maxDistance,"meters",this.unit),r=UWe(e.maxElevation,"meters",this.unit);return this._getEffectiveUnitsMemoized(i,r)}get highlightEnabled(){return this.tool.highlightEnabled}set highlightEnabled(e){this.tool.highlightEnabled=e}get hasVertices(){var i;const e=(i=this.input)==null?void 0:i.geometry;return O6(e)&&e.paths.reduce((r,n)=>r+n.length,0)>0}get hoveredPoints(){return this.input!=null&&this.visible&&this.tool.editable?this.visibleProfiles.map(e=>{const i=e.hoveredPoint;return i!=null?{hoveredPoint:i,color:e.color}:null}).filter(ys):[]}get statistics(){return bqt(this.visibleProfiles.map(e=>e.statistics))}get chartData(){if(this.input==null)return null;const{effectiveUnits:e,progress:i,statistics:r,visibleProfiles:n,uniformChartScaling:s}=this,o=n.filter(a=>a.hasZ).map(a=>({id:a.id,type:a.type,title:a.title,color:a.color,samples:a.samples,progress:a.progress,chartFillEnabled:a.chartFillEnabled,chartStrokeWidth:a.chartStrokeWidth,chartStrokeOffsetY:a.chartStrokeOffsetY,viewVisualizationEnabled:a.viewVisualizationEnabled}));return o.length===0?null:{lines:o,effectiveUnits:e,statistics:r,refined:i===1,dynamicElevationRange:n.some(a=>a.type==="view"),uniformScaling:s}}get visibleProfiles(){return this.profiles.toArray().filter(e=>e.available&&e.visible)}get minDemResolutions(){const e=[];for(const{minDemResolution:i}of this.visibleProfiles)i!=null&&e.push(i);return e}get minDemResolution(){return dSe(this.minDemResolutions)}get errorState(){var i;const e=(i=this.input)==null?void 0:i.geometry;if(!che(e))return qa.NoValidInput;if(this.error!=null){if(oqt(this.error))switch(this.error.cause){case If.TooComplex:return qa.TooComplex;case If.InvalidGeometry:return qa.InvalidGeometry;case If.InvalidElevationInfo:return qa.InvalidElevationInfo;case If.ElevationQueryError:return qa.NoValidInput}return qa.UnknownError}return this.visibleProfiles.length===0?qa.NoVisibleProfiles:this.chartData==null&&this.progress===1?qa.RefinedButNoChartData:qa.None}get tileCache(){var i;this._currentTileCache=et(this._currentTileCache);const e=this.view;if(e!=null&&(e==null?void 0:e.type)==="3d"){const r=(i=e.basemapTerrain)==null?void 0:i.elevationQueryCache;if(r!=null)return r}return this._currentTileCache==null&&(this._currentTileCache=new Z7e(new JB(20*V2.MEGABYTES))),this._currentTileCache}get visible(){return this.tool.visible}set visible(e){this.tool.visible=e}get inputIsSketched(){return this.tool.interaction.isSketchedGraphic(this.input)}get elevationProvider(){const e=this.view;return e!=null&&e.type==="3d"?e.elevationProvider:null}get updating(){var r;const{progress:e}=this,i=!!((r=this.queue)!=null&&r.updating);return e>0&&e<1||i}start(e){this.tool.interaction.start(e)}stop(){this.tool.interaction.stop()}cancel(){this.tool.interaction.cancel()}clear(){this.tool.interaction.clear()}_findSelectableUnit(e,i){const r=this.unitOptions;return e!=null&&r.includes(e)?e:i?this._findSelectableUnit(i):r[0]}_filteredOrAllUnits(e){const i=(e??[]).filter(r=>_L.includes(r));return i.length===0?_L.slice():i}};y([w()],dn.prototype,"view",void 0),y([w({type:Ma})],dn.prototype,"input",void 0),y([w({type:Gqt,nonNullable:!0})],dn.prototype,"profiles",null),y([w({readOnly:!0})],dn.prototype,"state",null),y([w({readOnly:!0})],dn.prototype,"progress",null),y([w()],dn.prototype,"unitOptions",null),y([w()],dn.prototype,"unit",null),y([w({readOnly:!0})],dn.prototype,"effectiveUnits",null),y([w({type:Number})],dn.prototype,"geodesicDistanceThreshold",void 0),y([w()],dn.prototype,"hoveredChartPosition",void 0),y([w()],dn.prototype,"uniformChartScaling",void 0),y([w()],dn.prototype,"highlightEnabled",null),y([w({readOnly:!0})],dn.prototype,"hoveredPoints",null),y([w({readOnly:!0})],dn.prototype,"statistics",null),y([w()],dn.prototype,"chartData",null),y([w()],dn.prototype,"visibleProfiles",null),y([w()],dn.prototype,"minDemResolutions",null),y([w({readOnly:!0})],dn.prototype,"minDemResolution",null),y([w({readOnly:!0})],dn.prototype,"errorState",null),y([w(bje)],dn.prototype,"defaultUnit",void 0),y([w()],dn.prototype,"queue",void 0),y([w()],dn.prototype,"tileCache",null),y([w()],dn.prototype,"tool",void 0),y([w()],dn.prototype,"visible",null),y([w()],dn.prototype,"error",void 0),y([w()],dn.prototype,"inputIsSketched",null),y([w()],dn.prototype,"elevationProvider",null),y([w()],dn.prototype,"updating",null),y([w()],dn.prototype,"_defaultProfileLineGround",void 0),y([w()],dn.prototype,"_userUnitOptions",void 0),y([w()],dn.prototype,"_controller",void 0),y([w()],dn.prototype,"_userUnit",void 0),dn=y([Z("esri.widgets.ElevationProfile.ElevationProfileViewModel")],dn);const w3e=Symbol("updating-object"),Lje=dn;let Q0=class extends ze{constructor(){super(...arguments),this.legend=!0,this.chart=!0,this.clearButton=!0,this.settingsButton=!0,this.sketchButton=!0,this.selectButton=!0,this.unitSelector=!0,this.uniformChartScalingToggle=!0}};y([w()],Q0.prototype,"legend",void 0),y([w()],Q0.prototype,"chart",void 0),y([w()],Q0.prototype,"clearButton",void 0),y([w()],Q0.prototype,"settingsButton",void 0),y([w()],Q0.prototype,"sketchButton",void 0),y([w()],Q0.prototype,"selectButton",void 0),y([w()],Q0.prototype,"unitSelector",void 0),y([w()],Q0.prototype,"uniformChartScalingToggle",void 0),Q0=y([Z("esri.widgets.ElevationProfile.ElevationProfileVisibleElements")],Q0);const Dje=Q0;function Wqt(t,e){return{type:kT(e),value:t,unit:e}}function Yqt(t,e){return{type:kT(e),value:t,unit:e}}function Xqt(t,e){return{type:kT(e),value:t,unit:e}}function hhe(t,e,i="arithmetic"){return{type:kT(e),value:t,unit:e,rotationType:i}}function tvi(t,e){const i=Zqt(t,e);return t.type==="angle"?hhe(i,e,t.rotationType):Wqt(i,e)}function Zqt(t,e){return Ur(t.value,t.unit,e)}function ivi(t,e){return t==null?e:e==null||t.value>Ur(e.value,e.unit,t.unit)?t:e}function rvi(t,e){return t==null?null:{...t,value:t.value*e}}function Jqt(t,e,i){if(e===i)return t;switch(i){case"arithmetic":case"geographic":return 90-t}}const nvi=Yqt(0,"meters"),svi=Xqt(0,"square-meters");hhe(0,"radians");const ovi=hhe(0,"degrees");function Nje(t,e,i){return t.units[e][i]}function sx(t,e,i,r=2,n="abbr"){return`${hd(e,{minimumFractionDigits:r,maximumFractionDigits:r,signDisplay:e>0?"never":"exceptZero"})} ${Nje(t,i,n)}`}function nH(t,e,i,r=2,n="abbr"){return`${hd(e,{minimumFractionDigits:r,maximumFractionDigits:r,signDisplay:"exceptZero"})} ${Nje(t,i,n)}`}function avi(t,e,i,r=2,n="abbr"){const s=Gne(e,i);return sx(t,Ur(e,i,s),s,r,n)}function lvi(t,e,i,r=2,n="abbr"){const s=Gne(e,i);return nH(t,Ur(e,i,s),s,r,n)}function cvi(t,e,i,r=2,n="abbr"){const s=Hne(e,i);return sx(t,Ur(e,i,s),s,r,n)}function uvi(t,e,i,r=2,n="abbr"){const s=Hne(e,i);return nH(t,Ur(e,i,s),s,r,n)}function hvi(t,e,i,r=2,n="abbr"){const s=qne(e,i);return sx(t,Ur(e,i,s),s,r,n)}function dvi(t,e,i,r=2,n="abbr"){const s=qne(e,i);return nH(t,Ur(e,i,s),s,r,n)}function pvi(t,e,i,r=2,n="abbr"){const s=Wne(e,i);return sx(t,Ur(e,i,s),s,r,n)}function fvi(t,e,i,r=2,n="abbr"){const s=Wne(e,i);return nH(t,Ur(e,i,s),s,r,n)}function mvi(t,e,i,r=2,n="abbr"){const s=VWe(e,i);return sx(t,Ur(e,i,s),s,r,n)}function gvi(t,e,i,r=2,n="abbr"){const s=BWe(e,i);return sx(t,Ur(e,i,s),s,r,n)}function x3e(t,e,i,r,n){n=n??2;let s=wP.normalize(Jqt(Ur(t,e,"degrees"),i,r),0,!0);const o={style:"unit",unitDisplay:"narrow",unit:"degree",maximumFractionDigits:n,minimumFractionDigits:n,signDisplay:s>0?"never":"exceptZero"};return s=Fje(s,o),hd(s,o)}function yvi(t,e,i,r,n){i!==r&&(t=-t);const s={style:"unit",unitDisplay:"narrow",unit:"degree",maximumFractionDigits:n=n??2,minimumFractionDigits:n,signDisplay:"exceptZero"};let o=Ur(t,e,"degrees")%360;return o=Fje(o,s),hd(o,s)}const S3e=new Map;function Fje(t,e){const i=JSON.stringify(e);let r=S3e.get(i);return r||(r=new Intl.NumberFormat("en-US",e),S3e.set(i,r)),/\-?\+?360/.test(r.format(t))?0:t}const T3e=["B","kB","MB","GB","TB"];function vvi(t,e){let i=(e=Math.round(e))===0?0:Math.floor(Math.log(e)/Math.log(V2.KILOBYTES));i=Je(i,0,T3e.length-1);const r=hd(e/V2.KILOBYTES**i,{maximumFractionDigits:2});return w9(t.units.bytes[T3e[i]],{fileSize:r})}const Kqt=100;let xS=class extends hn{constructor(e,i){super(e,i),this._updateLayout=r=>{const n=r.parentElement,s=r.style.display;n==null||n.removeChild(r),document.body.appendChild(r),r.style.display="block";let o=80;for(const a of r.childNodes)a instanceof HTMLElement&&(o=Math.max(o,a.offsetWidth));document.body.removeChild(r),n==null||n.appendChild(r),r.style.display=s,r.style.setProperty("--max-width",`${o}px`)},this._updateLayoutThrottled=XV(this._updateLayout,Kqt)}loadDependencies(){return Il({icon:()=>we(()=>import("./calcite-icon-ZhRmLRGh.js"),__vite__mapDeps([228,225,222]))})}initialize(){this.addHandles(this._updateLayoutThrottled)}render(){return X("div",{afterCreate:this._updateLayout,afterUpdate:this._updateLayoutThrottled,bind:this,class:rI.base},this._renderStatistics())}_renderStatistics(){var i;const e=(i=this._messages)==null?void 0:i.statistics;return e?[this._renderDistanceStatistic("maxDistance",e.maxDistance),this._renderElevationStatistic("elevationGain",e.gain),this._renderElevationStatistic("elevationLoss",e.loss),this._renderElevationStatistic("minElevation",e.minElevation),this._renderElevationStatistic("maxElevation",e.maxElevation),this._renderElevationStatistic("avgElevation",e.avgElevation),this._renderSlopeStatistic("maxPositiveSlope","maxNegativeSlope",e.maxSlope),this._renderSlopeStatistic("avgPositiveSlope","avgNegativeSlope",e.avgSlope)]:[]}_renderDistanceStatistic(e,i){const r=jf().formatPrecision,n=this._renderValue(e,s=>{const o=this.effectiveUnits.distance;return sx(this._messagesUnits,s,o,r)});return this._renderStatistic(i,n)}_renderElevationStatistic(e,i){const r=jf().formatPrecision,n=this._renderValue(e,s=>{const o=this.effectiveUnits.elevation;return sx(this._messagesUnits,s,o,r)});return this._renderStatistic(i,n)}_renderSlopeStatistic(e,i,r){const n=jf().formatPrecision,s=X("div",{class:rI.slopeValue,key:"slope-up"},X("calcite-icon",{icon:"arrow-up",scale:"s"}),this._renderValue(e,o=>x3e(o,"degrees","geographic","geographic",n)),X("calcite-icon",{icon:"arrow-down",scale:"s"}),this._renderValue(i,o=>x3e(o,"degrees","geographic","geographic",n)));return this._renderStatistic(r,s)}_renderStatistic(e,i){return X("div",{class:rI.statistic},X("label",{class:rI.statisticLabel},e),X("div",{class:rI.statisticValue},i))}_renderValue(e,i){const r=this.line,n=r.progress===1?r.statistics:null,s=n==null?void 0:n[e];return s!=null?i(s):nqt}};y([w()],xS.prototype,"effectiveUnits",void 0),y([w()],xS.prototype,"line",void 0),y([w(),Gr("esri/widgets/ElevationProfile/t9n/ElevationProfile")],xS.prototype,"_messages",void 0),y([w(),Gr("esri/core/t9n/Units")],xS.prototype,"_messagesUnits",void 0),xS=y([Z("esri.widgets.ElevationProfile.Statistics")],xS);function E3e(t,{profiles:e}){const i=t.title;if(i!=null)return i;switch(t.type){case"ground":return e.ground;case"input":return e.input;case"query":return e.query;case"view":return e.view;default:return""}}let em=class extends hn{constructor(e,i){super(e,i),this.checkboxVisible=!0,this.expanded=!1}loadDependencies(){return Il({action:()=>we(()=>import("./calcite-action-GYDrwtQs.js"),__vite__mapDeps([273,274,227,217,219,220,221,222,223,224,225,226])),checkbox:()=>we(()=>import("./calcite-checkbox-u3DU2spl.js"),__vite__mapDeps([266,216,227,217,221,218,219])),label:()=>we(()=>import("./calcite-label-DHrtVvrs.js"),__vite__mapDeps([267,218])),tooltip:()=>we(()=>import("./calcite-tooltip-ewJ_kzN3.js"),__vite__mapDeps([231,232,233,227,234,235]))})}initialize(){this._statistics=new xS(this._statisticsProps),this.addHandles(_e(()=>this._statisticsProps,e=>this._statistics.set(e)))}destroy(){this._statistics=et(this._statistics)}render(){const e=this.expanded;return X("div",{class:this.classes(q1.base,{[q1.disabled]:this.disabled,[q1.expanded]:e}),key:this},this._renderColorIndicator(),X("div",{class:q1.header,key:"header"},this._renderLabelWithCheckbox(),this._renderCollapseToggleButton()),e?X("div",{class:q1.content,key:"content"},this._statistics.render()):null)}get disabled(){return!this.line.available}get _statisticsProps(){return{line:this.line,effectiveUnits:this.effectiveUnits}}_renderColorIndicator(){return X("div",{class:q1.colorIndicator,key:"color-indicator",styles:{backgroundColor:this.line.color.toCss()}})}_renderCollapseToggleButton(){const{expanded:e,messages:i}=this,r=e?i.hideDetails:i.showDetails;return X("calcite-action",{appearance:"transparent",bind:this,class:q1.collapseToggle,"data-testid":"legend-toggle",icon:e?"chevron-up":"chevron-down",key:"collapse-toggle",onclick:this._onCollapseToggleClick,scale:"s",text:r})}_onCollapseToggleClick(){this.onExpandedToggle()}_renderLabelWithCheckbox(){const{line:e,checkboxVisible:i,disabled:r,messages:n}=this,s=`label-${e.id}`;return X("calcite-label",{class:q1.label,disabled:r,key:s,layout:"inline"},i?this._renderCheckbox(e.id):null,E3e(e,n))}_renderCheckbox(e){const{disabled:i,line:r,messages:n}=this,s=r.visible,o=`${e}-checkbox`,a=s?n.hideProfile:n.showProfile,c=Zy(a,{name:E3e(r,n)});return X(J$,null,X("calcite-checkbox",{checked:s,class:q1.checkbox,disabled:i,id:o,key:"checkbox",onCalciteCheckboxChange:()=>r.toggleVisibility()}),X("calcite-tooltip",{overlayPositioning:"fixed",placement:"top",referenceElement:o},c))}};y([w()],em.prototype,"checkboxVisible",void 0),y([w()],em.prototype,"disabled",null),y([w({nonNullable:!0})],em.prototype,"effectiveUnits",void 0),y([w()],em.prototype,"expanded",void 0),y([w({nonNullable:!0})],em.prototype,"line",void 0),y([w()],em.prototype,"messages",void 0),y([w()],em.prototype,"onExpandedToggle",void 0),y([w()],em.prototype,"_statistics",void 0),em=y([Z("esri.widgets.ElevationProfile.LegendItem")],em);let SS=class extends hn{constructor(){super(...arguments),this._expandedLine=null}render(){const{profiles:e,messages:i,effectiveUnits:r,_expandedLine:n}=this;return X("div",{class:iqt.base},e.map(s=>X(em,{checkboxVisible:e.length>1,effectiveUnits:r,expanded:s===n,line:s,messages:i,onExpandedToggle:()=>this._onExpandedToggle(s)})))}_onExpandedToggle(e){this._expandedLine=e===this._expandedLine?null:e}};y([w()],SS.prototype,"effectiveUnits",void 0),y([w()],SS.prototype,"messages",void 0),y([w()],SS.prototype,"profiles",void 0),y([w()],SS.prototype,"_expandedLine",void 0),SS=y([Z("esri.widgets.ElevationProfile.components.Legend")],SS);const XX="esri-unit-select",ZX={base:XX,label:`${XX}__label`,select:`${XX}__select`};let Rw=class extends hn{constructor(e,i){super(e,i),this._onSelectChange=r=>{this.onChange(r.target.value)}}loadDependencies(){return Il({label:()=>we(()=>import("./calcite-label-DHrtVvrs.js"),__vite__mapDeps([267,218])),option:()=>we(()=>import("./calcite-option-XCvROySu.js"),__vite__mapDeps([268,222])),select:()=>we(()=>import("./calcite-select-h4uorzoD.js"),__vite__mapDeps([269,216,217,218,219,222,223,225]))})}render(){const{messages:e,options:i,selectLabel:r,value:n,_onSelectChange:s}=this;return X("div",{class:ZX.base,key:"units"},X("calcite-label",{class:ZX.label},r,X("calcite-select",{class:ZX.select,label:r,onCalciteSelectChange:s},i.map(o=>{var a;return X("calcite-option",{key:o,selected:o===n,value:o},FWe(o)?e.systems[o]:(a=e.units[o])==null?void 0:a.pluralCapitalized)}))))}};y([w()],Rw.prototype,"options",void 0),y([w()],Rw.prototype,"onChange",void 0),y([w()],Rw.prototype,"selectLabel",void 0),y([w()],Rw.prototype,"value",void 0),y([w(),Gr("esri/core/t9n/Units")],Rw.prototype,"messages",void 0),Rw=y([Z("esri.widgets.support.UnitSelect")],Rw);let lf=class extends hn{constructor(){super(...arguments),this.messages=null,this._popover=null,this._popoverIsOpen=!1,this._onPopoverAfterCreate=e=>{this._popover=e},this._onUniformChartScalingChange=e=>{this.onUniformChartScalingChange(e.target.checked)}}loadDependencies(){return Il({action:()=>we(()=>import("./calcite-action-GYDrwtQs.js"),__vite__mapDeps([273,274,227,217,219,220,221,222,223,224,225,226])),checkbox:()=>we(()=>import("./calcite-checkbox-u3DU2spl.js"),__vite__mapDeps([266,216,227,217,221,218,219])),label:()=>we(()=>import("./calcite-label-DHrtVvrs.js"),__vite__mapDeps([267,218])),popover:()=>we(()=>import("./calcite-popover-Lvoq79Pm.js"),__vite__mapDeps([275,276,232,233,227,234,220,221,222,224,219,235,223,274,217,225,226])),tooltip:()=>we(()=>import("./calcite-tooltip-ewJ_kzN3.js"),__vite__mapDeps([231,232,233,227,234,235]))})}initialize(){const e=()=>this._popover;this.addHandles([Jr(e,"calcitePopoverOpen",()=>this._popoverIsOpen=!0),Jr(e,"calcitePopoverClose",()=>this._popoverIsOpen=!1)])}render(){const{id:e,messages:i,visibleElements:r}=this,{unitSelector:n,uniformChartScalingToggle:s}=r;if(!i||!n&&!s)return X("div",{key:`${e}-empty`});const o=`${e}__action`,a=this._popoverIsOpen?i.hideSettings:i.showSettings;return X("div",{class:m7.base,key:this},X("calcite-popover",{afterCreate:this._onPopoverAfterCreate,autoClose:!0,label:a,overlayPositioning:"fixed",placement:"bottom-end",referenceElement:o},this._renderPopoverContent()),X("calcite-action",{appearance:"transparent","data-testid":"settings-button",icon:"gear",id:o,label:a,scale:"s",text:a}))}_renderPopoverContent(){const{unitSelector:e,uniformChartScalingToggle:i}=this.visibleElements;return X("div",{class:m7.popoverContent},e?this._renderUnitSelector():null,i?this._renderUniformChartScalingToggle():null)}_renderUnitSelector(){const{messages:e}=this;return X(Rw,{key:"unit-selector-label",options:this.unitOptions,selectLabel:(e==null?void 0:e.unitSelectLabel)??"",value:this.unit,onChange:this.onUnitChange})}_renderUniformChartScalingToggle(){const{messages:e}=this,i=this.uniformChartScaling,r=`${this.id}__uniform-chart-scaling-toggle`,n=(e==null?void 0:e[i?"uniformChartScalingDisable":"uniformChartScalingEnable"])??"";return X("calcite-label",{class:m7.uniformChartScalingLabel,key:"uniform-chart-scaling-label",layout:"inline"},X("calcite-checkbox",{checked:i,class:m7.uniformChartScalingCheckbox,id:r,onCalciteCheckboxChange:this._onUniformChartScalingChange}),X("calcite-tooltip",{overlayPositioning:"fixed",referenceElement:r},n),e==null?void 0:e.uniformChartScalingLabel)}};y([w()],lf.prototype,"messages",void 0),y([w()],lf.prototype,"onUniformChartScalingChange",void 0),y([w()],lf.prototype,"onUnitChange",void 0),y([w()],lf.prototype,"uniformChartScaling",void 0),y([w()],lf.prototype,"unit",void 0),y([w()],lf.prototype,"unitOptions",void 0),y([w()],lf.prototype,"visibleElements",void 0),y([w()],lf.prototype,"_popover",void 0),y([w()],lf.prototype,"_popoverIsOpen",void 0),lf=y([Z("esri.widgets.ElevationProfile.components.SettingsButton")],lf);var Lh;(function(t){t.Sketch="sketch",t.SketchCancel="sketch-cancel",t.SketchDone="sketch-done",t.Select="select",t.SelectCancel="select-cancel"})(Lh||(Lh={}));const nI=[{type:Lh.Select},{type:Lh.Sketch}],Qqt={[qa.None]:null,[qa.NoValidInput]:"noProfile",[qa.NoVisibleProfiles]:"noProfile",[qa.RefinedButNoChartData]:"noProfile",[qa.TooComplex]:"tooComplex",[qa.UnknownError]:"unknown",[qa.InvalidGeometry]:"invalidGeometry",[qa.InvalidElevationInfo]:"invalidElevationInfo"},C3e=Symbol("resize-observer-handle");let Ts=class extends hn{constructor(e,i){super(e,i),this.viewModel=null,this.visibleElements=new Dje,this.iconClass=qo.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this._chartContainer=null,this._chart=null,this._chartInitTask=null,this._chartIsRefined=!1,this._width=0,this._zoomOutButtonVisible=!1,this._getChartUpdateParamsMemoized=Cm((r,n,s,o)=>({chart:r,data:n,stationary:s,messages:o})),this._onZoomOutButtonClick=()=>{var r;(r=this._chart)==null||r.zoomOut()},this._onClearButtonClick=()=>{this.viewModel.clear()},e!=null&&e.viewModel||(this._defaultViewModel=new Lje({view:e==null?void 0:e.view}),this.viewModel=this._defaultViewModel)}loadDependencies(){return Il({action:()=>we(()=>import("./calcite-action-GYDrwtQs.js"),__vite__mapDeps([273,274,227,217,219,220,221,222,223,224,225,226])),button:()=>we(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([214,215,216,217,218,219,220,221,222,223,224,225,226,227])),loader:()=>we(()=>import("./calcite-loader-IfjW-6zZ.js"),__vite__mapDeps([277,226,227]))})}postInitialize(){this.addHandles([_e(()=>({container:this._chartContainer,width:this._width}),({container:e,width:i})=>{this._destroyChart(),e!=null&&i>0&&this._initializeChart(e)},Qt),_e(()=>this._chartUpdateParams,()=>this._updateChart(this._chartUpdateParams),Qt)])}destroy(){this._destroyChart(),this._defaultViewModel!=null&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get input(){return this.viewModel.input}set input(e){this.viewModel.input=e}get profiles(){return this.viewModel.profiles}set profiles(e){this.viewModel.profiles=e}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}get geodesicDistanceThreshold(){return this.viewModel.geodesicDistanceThreshold}set geodesicDistanceThreshold(e){this.viewModel.geodesicDistanceThreshold=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get _portrait(){return this._widthr.uniformChartScaling=s,onUnitChange:s=>r.unit=s}):null),X("div",{class:qo.mainContainer,key:"main-container"},i),this.visibleElements.legend?X(SS,{effectiveUnits:r.effectiveUnits,messages:this.messages,profiles:this._profilesArray}):null,this._renderActions(e))}_renderZoomOutButton(){return X("calcite-action",{appearance:"transparent",class:qo.zoomOutButton,"data-testid":"zoom-out-button",icon:"magnifying-glass-minus",key:"zoom-out",onclick:this._onZoomOutButtonClick,scale:"s",text:this.messages.zoomOut})}_renderClearButton(){return X("calcite-action",{appearance:"transparent",class:qo.clearButton,"data-testid":"clear-button",icon:"trash",key:"clear-profile",onclick:this._onClearButtonClick,scale:"s",text:this.messages.clearProfile})}_renderPrompt(e){return[X("div",{bind:this,class:qo.promptContainer,key:"prompt-container"},X("p",null,e))]}_renderChart(){if(!this.visibleElements.chart)return X("div",{class:qo.chartContainer,key:"empty-chart-container"});const e=this._chartIsRefined||this._canRenderChart();if(!e)return X(J$,null,this._renderSpinner({size:"large"}),X("div",{class:qo.chartContainer,key:"chart-container-empty"}));const{chartData:i,progress:r}=this.viewModel;return X(J$,null,i!=null&&r>0&&r<1?this._renderSpinner({size:e?"small":"large"}):null,X("div",{afterCreate:this._onChartContainerAfterCreate,afterRemoved:this._onChartContainerRemoved,bind:this,class:qo.chartContainer,key:"chart-container"}))}_renderSpinner(e){const i=e.size==="small";return X("calcite-loader",{afterCreate:this._onSpinnerAfterCreate,class:this.classes(qo.chartSpinner,i&&qo.chartSpinnerSmall),exitAnimation:this._onSpinnerExit,inline:i,key:"spinner",label:"",scale:"s"})}_onSpinnerAfterCreate(e){requestAnimationFrame(()=>e.classList.add(qo.chartSpinnerVisible))}_onSpinnerExit(e,i){e.classList.remove(qo.chartSpinnerVisible),setTimeout(i,200)}_canRenderChart(){const e=this.viewModel.chartData;if(e==null)return!1;if(!this.viewModel.inputIsSketched)return e.refined;let i=0;for(const{samples:r}of e.lines)i+=r!=null?r.length:0;return e.refined||i<=jf().largeChartSamples}_renderActions({actions:e}){const i=e.map(r=>{switch(r.type){case Lh.Sketch:return this.visibleElements.sketchButton&&this._renderAction({action:r,className:qo.sketchButton,label:this.messages.sketchButtonLabel,onClick:this._onSketchButtonClick,primary:!0});case Lh.SketchCancel:return this.visibleElements.sketchButton&&this._renderAction({action:r,onClick:this._onCancelButtonClick,className:qo.sketchCancelButton,label:this.messagesCommon.cancel,primary:!1});case Lh.SketchDone:return this.visibleElements.sketchButton&&this._renderAction({action:r,onClick:this._onDoneButtonClick,className:qo.sketchDoneButton,label:this.messagesCommon.done,primary:!0});case Lh.Select:return this.visibleElements.selectButton&&this._renderAction({action:r,onClick:this._onSelectButtonClick,className:qo.selectButton,label:this.messages.selectButtonLabel,primary:!1});case Lh.SelectCancel:return this.visibleElements.selectButton&&this._renderAction({action:r,onClick:this._onCancelButtonClick,className:qo.selectCancelButton,label:this.messagesCommon.cancel,primary:!1})}}).filter(Boolean);return i.length?X("footer",{class:qo.footer,key:"footer"},i):null}_renderAction({action:e,className:i,label:r,onClick:n,primary:s}){return X("calcite-button",{appearance:s?"solid":"outline-fill",bind:this,class:this.classes(qo.actionButton,i),disabled:e.disabled,key:`action-${e.type}`,onclick:n},r)}_onSketchButtonClick(){this.viewModel.start({mode:"sketch"})}_onSelectButtonClick(){this.viewModel.start({mode:"select"})}_onCancelButtonClick(){this.viewModel.cancel()}_onDoneButtonClick(){this.viewModel.stop()}_onContentWrapperAfterCreate(e){const i=Cj(e,r=>{this._width=r.contentRect.width});this.addHandles(i,C3e)}_onContentWrapperRemoved(){this.removeHandles(C3e)}_updateChart(e){const{data:i,chart:r,messages:n,stationary:s}=e;r!=null&&n!=null&&s&&this._canRenderChart()&&(r.update(e),this._chartIsRefined=i!=null&&i.refined)}_onChartContainerAfterCreate(e){this._chartContainer=e}_onChartContainerRemoved(){this._chartContainer=null}_initializeChart(e){vn(this._chartInitTask),this._chartInitTask=Oc(async i=>{const{createChart:r}=await we(()=>import("./chartUtils-24xN4NV-.js"),__vite__mapDeps([278,279,280,281,282,283,284,285,286,287]));St(i);const n=await r({container:e,abortOptions:{signal:i},onRangeChange:(s,o)=>{this._zoomOutButtonVisible=s!==1||o!==1},onCursorPositionChange:s=>{this.viewModel.hoveredChartPosition=s}});if(i.aborted)throw et(n),ur();this._chart=n,this._updateChart(this._chartUpdateParams)})}_destroyChart(){this._chartInitTask=vn(this._chartInitTask),this._chart=et(this._chart),this._chartIsRefined=!1}};y([w({type:Lje})],Ts.prototype,"viewModel",void 0),y([w()],Ts.prototype,"view",null),y([w()],Ts.prototype,"input",null),y([w()],Ts.prototype,"profiles",null),y([w()],Ts.prototype,"unitOptions",null),y([w()],Ts.prototype,"unit",null),y([w()],Ts.prototype,"geodesicDistanceThreshold",null),y([w({type:Dje,nonNullable:!0})],Ts.prototype,"visibleElements",void 0),y([w()],Ts.prototype,"iconClass",void 0),y([w()],Ts.prototype,"icon",void 0),y([w()],Ts.prototype,"label",null),y([w()],Ts.prototype,"visible",null),y([w(),Gr("esri/widgets/ElevationProfile/t9n/ElevationProfile")],Ts.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],Ts.prototype,"messagesCommon",void 0),y([w(),Gr("esri/core/t9n/Units")],Ts.prototype,"messagesUnits",void 0),y([w()],Ts.prototype,"_chartContainer",void 0),y([w()],Ts.prototype,"_chart",void 0),y([w()],Ts.prototype,"_chartInitTask",void 0),y([w()],Ts.prototype,"_chartIsRefined",void 0),y([w()],Ts.prototype,"_width",void 0),y([w()],Ts.prototype,"_portrait",null),y([w()],Ts.prototype,"_zoomOutButtonVisible",void 0),y([w()],Ts.prototype,"_chartUpdateParams",null),y([w()],Ts.prototype,"_chartMessages",null),y([w()],Ts.prototype,"_profilesArray",null),Ts=y([Z("esri.widgets.ElevationProfile")],Ts);const eWt=Ts,tWt=t=>new eWt({view:t,container:"elevation-profile-container",profiles:[{type:"ground",title:"Maapind"},{type:"view",title:"Kihid"}],visibleElements:{selectButton:!0}});let Jg=class extends ze{constructor(e){super(e),this.activeTool=null,this.activeViewModel=null,this.view=null}get areaUnit(){return this.defaultUnit}set areaUnit(e){this._overrideIfSome("areaUnit",e)}get linearUnit(){return this.defaultUnit}set linearUnit(e){this._overrideIfSome("linearUnit",e)}get state(){const{activeViewModel:e}=this;return e?e.state:"disabled"}};y([w({type:["area","distance","direct-line"]})],Jg.prototype,"activeTool",void 0),y([w()],Jg.prototype,"activeViewModel",void 0),y([w({type:DWe})],Jg.prototype,"areaUnit",null),y([w(bje)],Jg.prototype,"defaultUnit",void 0),y([w({type:_L})],Jg.prototype,"linearUnit",null),y([w({readOnly:!0})],Jg.prototype,"state",null),y([w()],Jg.prototype,"view",void 0),Jg=y([Z("esri.widgets.Measurement.MeasurementViewModel")],Jg);const kje=Jg,A3e={base:"esri-measurement",widgetIcon:oi.measure};function iWt(t){return(t==null?void 0:t.declaredClass)==="esri.widgets.AreaMeasurement2D"||(t==null?void 0:t.declaredClass)==="esri.widgets.AreaMeasurement3D"}let Ch=class extends hn{constructor(e,i){super(e,i),this._widgets=new Map,this.activeWidget=null,this.iconClass=A3e.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new kje}initialize(){this.activeWidget&&this.viewModel.set("activeViewModel",this.activeWidget.viewModel),this.view&&this.activeTool&&this._getActiveWidget().then(e=>{this._set("activeWidget",e)}),this.addHandles([_e(()=>[this.view,this.activeTool],async()=>{this._set("activeWidget",await this._getActiveWidget())}),_e(()=>this.activeWidget,(e,i)=>{this.viewModel.set("activeViewModel",e?e.viewModel:null),i&&(i.visible=!1)}),_e(()=>[this.areaUnit,this.linearUnit,this.uiStrings],()=>this._updateSubWidgetProperties())])}destroy(){this._destroyWidgets()}get activeTool(){return this.viewModel.activeTool}set activeTool(e){this.viewModel.activeTool=e}get areaUnit(){return this.viewModel.areaUnit}set areaUnit(e){this.viewModel.areaUnit=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get linearUnit(){return this.viewModel.linearUnit}set linearUnit(e){this.viewModel.linearUnit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}render(){const{activeWidget:e}=this,i=e&&!e.destroyed?e.render():null;return X("div",{class:A3e.base},i)}clear(){this.activeTool=null,this._destroyWidgets()}startMeasurement(){const{activeViewModel:e}=this.viewModel;e&&Nm(e.start())}async _createWidget(e){const{areaUnit:i,linearUnit:r,view:n}=this;if(!n)return null;switch(e){case"area":{const{type:s}=n;switch(s){case"2d":return new(await we(()=>import("./AreaMeasurement2D-GQCBQvJv.js"),__vite__mapDeps([288,289,248,196,197,179,201,250,135,187,188,200,253,121,290]))).default({view:n,unit:i,uiStrings:this._createUIStringsForWidget(e)});case"3d":return new(await we(()=>import("./AreaMeasurement3D-ZnoqUVHu.js"),__vite__mapDeps([291,172,190,191,164,192,178,193,194,177,195,196,197,186,187,188,185,202,179,199,200,135,201,292,290]))).default({view:n,unit:i,uiStrings:this._createUIStringsForWidget(e)});default:return null}}case"distance":{const{type:s}=n;return s==="2d"?new(await we(()=>import("./DistanceMeasurement2D-Ss5XZk94.js"),__vite__mapDeps([293,289,248,196,197,179,201,250,135,187,188,200,253,121,290]))).default({view:n,unit:r,uiStrings:this._createUIStringsForWidget(e)}):null}case"direct-line":{const{type:s}=n;return s==="3d"?new(await we(()=>import("./DirectLineMeasurement3D-D1LkQv4r.js"),__vite__mapDeps([294,172,190,191,164,192,178,193,194,177,195,196,197,186,187,188,171,205,185,202,179,199,200,135,292,290]))).default({view:n,unit:r,uiStrings:this._createUIStringsForWidget(e)}):null}default:return null}}_destroyWidgets(){this._widgets.forEach(e=>e.destroy()),this._widgets.clear()}async _getActiveWidget(){const{activeTool:e,view:i}=this;if(!i||!e)return null;let r=null;if(this._widgets.has(e))r=this._widgets.get(e),r.visible=!0;else{if(r=await this._createWidget(e),!r)return null;await r.viewModel.start(),this._widgets.set(e,r)}return r}_createUIStringsForWidget(e){var r;if(!this.uiStrings)return;const i=e+"-"+((r=this.view)==null?void 0:r.type);return this.uiStrings[i]}_updateSubWidgetProperties(){this._widgets.forEach((e,i)=>{const{areaUnit:r,linearUnit:n}=this;e.unit=iWt(e)?r:n,e.uiStrings=this._createUIStringsForWidget(i)})}};y([w()],Ch.prototype,"activeTool",null),y([w({readOnly:!0})],Ch.prototype,"activeWidget",void 0),y([w()],Ch.prototype,"areaUnit",null),y([w()],Ch.prototype,"iconClass",void 0),y([w()],Ch.prototype,"icon",void 0),y([w()],Ch.prototype,"label",null),y([w()],Ch.prototype,"linearUnit",null),y([w(),Gr("esri/widgets/Measurement/t9n/Measurement")],Ch.prototype,"messages",void 0),y([w()],Ch.prototype,"uiStrings",void 0),y([w()],Ch.prototype,"view",null),y([w({type:kje})],Ch.prototype,"viewModel",void 0),Ch=y([Z("esri.widgets.Measurement")],Ch);const rWt=Ch,nWt=t=>{const e=new rWt({view:t,container:"measurement-container"}),i=document.getElementById("distanceButton"),r=document.getElementById("areaButton"),n=document.getElementById("clearButton");i.addEventListener("click",()=>{i.active=!0,r.active=!1,e.activeTool="direct-line"}),r.addEventListener("click",()=>{i.active=!1,r.active=!0,e.activeTool="area"}),n.addEventListener("click",()=>{i.active=!1,r.active=!1,e.clear()})},bf="esri-shadow-cast",Bb={base:bf,widgetIcon:oi.measureBuildingHeightShadow,timeRange:`${bf}__time-range`,timeRangeIndicator:`${bf}__time-range__indicator`,datePickerContainer:`${bf}__date-picker-container`,visualization:`${bf}__visualization`,visualizationSelect:`${bf}__visualization__select`,visualizationConfigHidden:`${bf}__visualization__config--hidden`},sWt=`${bf}__label`,M3e=`${bf}__threshold-config`,O3e={base:M3e,valueLabel:`${M3e}__value-label`},P3e=`${bf}__duration-config`,R3e={base:P3e,radioGroup:`${P3e}__radio-group`},oWt=`${bf}__discrete-config`,aWt={base:oWt},I3e=`${bf}__tooltip`,$3e={base:I3e,content:`${I3e}__content`};var jO;(function(t){t.Disabled="disabled",t.Ready="ready"})(jO||(jO={}));let SM=class extends ze{constructor(){super({}),this.color=new qe([50,50,50,.7]),this.intervalOptions=new tt([Hs(15,"minutes","milliseconds"),Hs(30,"minutes","milliseconds"),Hs(1,"hours","milliseconds"),Hs(2,"hours","milliseconds"),Hs(3,"hours","milliseconds")]),this.interval=this.intervalOptions.at(0)}set intervalOptions(e){this._set("intervalOptions",od(e,this._get("intervalOptions")))}};y([w({type:qe})],SM.prototype,"color",void 0),y([w()],SM.prototype,"interval",void 0),y([w({type:tt})],SM.prototype,"intervalOptions",null),SM=y([Z("esri.widgets.ShadowCast.DiscreteOptions")],SM);const zje=SM;var b2;(function(t){t.Continuous="continuous",t.Hourly="hourly"})(b2||(b2={}));let X4=class extends ze{constructor(){super(...arguments),this.color=new qe([0,0,255,.7]),this.mode=b2.Continuous}};y([w({type:qe})],X4.prototype,"color",void 0),y([w()],X4.prototype,"mode",void 0),X4=y([Z("esri.widgets.ShadowCast.DurationOptions")],X4);const Uje=X4;var Gw;(function(t){t.PointerMove="pointer-move",t.Main="main"})(Gw||(Gw={}));const lWt=300;let tm=class extends ze{constructor(e){super(e),this._screenPoint=null,this._accumulatedShadowTime=null,this._shadowTimeTask=null,this._updateAccumulatedShadowTime=(i,r)=>{this._shadowTimeTask=vn(this._shadowTimeTask),this._shadowTimeTask=Oc(async n=>{const{results:s,ground:o}=await i.hitTest(r);if(s.length===0&&!o.mapPoint)return void(this._accumulatedShadowTime=null);const a=await this.getDuration(r,n);this._accumulatedShadowTime=a})},this._throttledUpdateAccumulatedShadowTime=XV(this._updateAccumulatedShadowTime,lWt)}initialize(){this.addHandles(_e(()=>({enabled:this.enabled,view:this.view}),({enabled:e,view:i})=>{e&&i!=null?this._startTracking(i):this._stopTracking()},kt))}get screenPoint(){return this.enabled?this._screenPoint:null}get accumulatedShadowTime(){return this.enabled?this._accumulatedShadowTime:null}get testData(){return{setThrottleDelay:e=>{this._throttledUpdateAccumulatedShadowTime.remove(),this._throttledUpdateAccumulatedShadowTime=XV(this._updateAccumulatedShadowTime,e)}}}_startTracking(e){if(this.hasHandles(Gw.Main))return;const i=()=>{this.hasHandles(Gw.PointerMove)||this.addHandles(e.on("pointer-move",n=>{const s=Qu(n.x,n.y);this._screenPoint=s,this._throttledUpdateAccumulatedShadowTime(e,s)}),Gw.PointerMove)},r=()=>{this.removeHandles(Gw.PointerMove),this._screenPoint=null,this._accumulatedShadowTime=null};this.addHandles([this._throttledUpdateAccumulatedShadowTime,e.on("pointer-enter",i),e.on("pointer-leave",r),e.on("pointer-down",r),e.on("pointer-drag",r),e.on("pointer-up",i),e.on("click",n=>{const s=Qu(n.x,n.y);this._screenPoint=s,this._updateAccumulatedShadowTime(e,s)}),rr(()=>{this._shadowTimeTask=vn(this._shadowTimeTask)})],Gw.Main),i()}_stopTracking(){this.removeHandles(Gw.Main)}};y([w()],tm.prototype,"getDuration",void 0),y([w()],tm.prototype,"view",void 0),y([w()],tm.prototype,"enabled",void 0),y([w()],tm.prototype,"screenPoint",null),y([w()],tm.prototype,"accumulatedShadowTime",null),y([w()],tm.prototype,"_screenPoint",void 0),y([w()],tm.prototype,"_accumulatedShadowTime",void 0),y([w()],tm.prototype,"_shadowTimeTask",void 0),tm=y([Z("esri.widgets.ShadowCast.ShadowTooltipViewModel")],tm);var Ya;(function(t){t.Threshold="threshold",t.Duration="duration",t.Discrete="discrete"})(Ya||(Ya={}));Ya.Threshold,Ya.Duration,Ya.Discrete;let TS=class extends ze{constructor(){super(...arguments),this.color=new qe([255,0,0,.7]),this.value=Hs(4,"hours","milliseconds"),this.minValue=0,this.maxValue=Hs(8,"hours","milliseconds")}};y([w({type:qe})],TS.prototype,"color",void 0),y([w()],TS.prototype,"value",void 0),y([w()],TS.prototype,"minValue",void 0),y([w()],TS.prototype,"maxValue",void 0),TS=y([Z("esri.widgets.ShadowCast.ThresholdOptions")],TS);const Vje=TS,L3e=[],cWt=W(),D3e=[],N3e=255,uWt=Hs(1,"hours","milliseconds"),hWt=500;let ln=class extends ze{constructor(t){super(t),this.view=null,this.tooltip=new tm({getDuration:(e,i)=>this.getDuration(e,i)}),this.startTimeOfDay=Hs(10,"hours","milliseconds"),this.endTimeOfDay=Hs(16,"hours","milliseconds"),this.visualizationType=Ya.Threshold,this.thresholdOptions=new Vje,this.durationOptions=new Uje,this.discreteOptions=new zje,this._running=!0,this._stopPreviewingTask=null,this._forcePreview=!1,this._autoRestoreForcePreviewEnabled=!0,this._utcOffset=null,this.date=new Date}initialize(){this.addHandles([_e(()=>({view:this.view,tooltipEnabled:this._tooltipEnabled}),({view:t,tooltipEnabled:e})=>{this.tooltip.view=t,this.tooltip.enabled=e},kt),_e(()=>this._forcePreviewDependencies,()=>{vn(this._stopPreviewingTask),this._forcePreview=!0,this._autoRestoreForcePreviewEnabled&&(this._stopPreviewingTask=Oc(async t=>{await P2(hWt,t),St(t),this._forcePreview=!1}))},kt),_e(()=>({renderer:this.renderer,parameters:this._visualizationParameters}),t=>sI(t.renderer,t.parameters),kt),_e(()=>({renderer:this.renderer,parameters:{lightDirections:this._lightDirections}}),t=>sI(t.renderer,t.parameters),kt),_e(()=>({renderer:this.renderer,parameters:{enabled:this._running}}),t=>sI(t.renderer,t.parameters),kt),_e(()=>({renderer:this.renderer,parameters:{previewing:this._previewing}}),t=>sI(t.renderer,t.parameters),kt)])}destroy(){this.stop(),sI(this.renderer,{enabled:!1}),et(this.tooltip)}get state(){return this.view!=null&&this.view.ready&&this._referencePosition!=null?jO.Ready:jO.Disabled}set date(t){const e=new Date(t);e.setHours(0,0,0,0),this._set("date",e)}get utcOffset(){return this._utcOffset??this._utcOffsetAuto}set utcOffset(t){this._utcOffset=t}get testData(){return{setAutoRestoreForcedPreviewEnabled:t=>{this._autoRestoreForcePreviewEnabled=t},setForcedPreview:t=>{this._forcePreview=t},isPreviewing:()=>this._previewing}}get _previewing(){const{view:t}=this;return(t==null?void 0:t.allLayerViews)==null||this._forcePreview||!t.stationary||t.allLayerViews.some(e=>ene(e)&&e.updating)}get _utcOffsetAuto(){const t=this._referencePosition;return t!=null?LIe(t[0],!1):0}get _dateUTCOffset(){let t=this.date;return t=aD(t,-t.getTimezoneOffset(),"minutes"),t=aD(t,-this.utcOffset,"hours"),t}get _startDateTimeUTC(){return aD(this._dateUTCOffset,this.startTimeOfDay)}get _endDateTimeUTC(){return aD(this._dateUTCOffset,this.endTimeOfDay)}get _referencePosition(){var t,e;return(e=(t=this.view)==null?void 0:t.environmentManager)==null?void 0:e.referencePositionWGS84Comparable}get _interval(){const t=this._duration>0?Math.floor(this._duration/N3e):N3e,e=this.discreteOptions.interval;switch(this.visualizationType){case Ya.Threshold:case Ya.Duration:return t;case Ya.Discrete:return e>0?e:t}}get _sampleCount(){return this._lightDirections.length}get _duration(){return this.endTimeOfDay-this.startTimeOfDay}get _lightDirections(){const{view:t}=this;if(t==null)return L3e;const e=t.viewingMode==="global"?cWt:this._referencePosition;if(e==null)return L3e;const i=this._interval,r=B1t(this._startDateTimeUTC,this._endDateTimeUTC,i,e,t.state.viewingMode),n=r.length;D3e.length=0;const s=Cje(0,n,D3e),o=new Array(n);for(let a=0;a0?t/this._duration:0}}get _durationVisualizationParameters(){const{color:t,mode:e}=this.durationOptions,i=this._duration,r=i>0&&e===b2.Hourly?uWt/i:0;return{color:qe.toUnitRGBA(t),visualization:d_.Gradient,bandsEnabled:r>0,bandSize:r}}get _discreteVisualizationParameters(){return{color:qe.toUnitRGBA(this.discreteOptions.color),visualization:d_.Gradient,bandsEnabled:!1,bandSize:0}}get _forcePreviewDependencies(){const{view:t}=this;if(t==null)return null;const e=t.slicePlane,i=t.allLayerViews.toArray().filter(ene),r=i.map(p=>p.layer).filter(ys),n=i.map(p=>p.visible),s=r.map(p=>p.visible),o=r.map(p=>p.opacity),a=r.filter(p=>"definitionExpression"in p).map(p=>p.definitionExpression),c=i.filter(p=>"filter"in p).map(p=>p.filter);return{slicePlane:e,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewVisibilities:n,layerVisibilities:s,layerOpacities:o,filters:c,definitionExpressions:a}}get renderer(){const{view:t}=this;if(t==null)return null;const e=t._stage;return e==null?null:e.renderer}start(){this.setRunning(!0)}stop(){this.setRunning(!1)}setRunning(t){this._running=t}async getDuration(t,e){const{view:i,renderer:r}=this;if(i==null||r==null)return 0;const n=i.state.camera.screenToRender(ss(t.x,t.y),hse()),s=r.readAccumulatedShadow(n),o=this._sampleCount;return o===0?0:s*o*(this._duration/o)}};function sI(t,e){t!=null&&e!=null&&t.setParameters({shadowCastOptions:e})}function ene(t){if(t.suspended)return!1;switch(t.type){case"building-scene-3d":case"csv-3d":case"elevation-3d":case"feature-3d":case"geojson-3d":case"graphics-3d":case"integrated-mesh-3d":case"ogc-feature-3d":case"route-3d":case"scene-layer-3d":case"scene-layer-graphics-3d":case"stream-3d":case"wms-3d":return!0;case"base-dynamic-3d":case"dimension-3d":case"imagery-3d":case"imagery-tile-3d":case"line-of-sight-3d":case"map-image-3d":case"point-cloud-3d":case"tile-3d":case"vector-tile-3d":case"voxel-3d":case"wfs-3d":case"wmts-3d":case"media-3d":default:return!1;case"group":return t.layerViews.toArray().some(e=>ene(e))}}y([w()],ln.prototype,"state",null),y([w()],ln.prototype,"view",void 0),y([w()],ln.prototype,"tooltip",void 0),y([w({nonNullable:!0})],ln.prototype,"date",null),y([w({nonNullable:!0})],ln.prototype,"utcOffset",null),y([w({nonNullable:!0})],ln.prototype,"startTimeOfDay",void 0),y([w({nonNullable:!0})],ln.prototype,"endTimeOfDay",void 0),y([w({nonNullable:!0})],ln.prototype,"visualizationType",void 0),y([w({type:Vje,nonNullable:!0})],ln.prototype,"thresholdOptions",void 0),y([w({type:Uje,nonNullable:!0})],ln.prototype,"durationOptions",void 0),y([w({type:zje,nonNullable:!0})],ln.prototype,"discreteOptions",void 0),y([w()],ln.prototype,"_running",void 0),y([w()],ln.prototype,"_stopPreviewingTask",void 0),y([w()],ln.prototype,"_forcePreview",void 0),y([w()],ln.prototype,"_autoRestoreForcePreviewEnabled",void 0),y([w()],ln.prototype,"_previewing",null),y([w()],ln.prototype,"_utcOffset",void 0),y([w()],ln.prototype,"_utcOffsetAuto",null),y([w()],ln.prototype,"_dateUTCOffset",null),y([w()],ln.prototype,"_startDateTimeUTC",null),y([w()],ln.prototype,"_endDateTimeUTC",null),y([w()],ln.prototype,"_referencePosition",null),y([w()],ln.prototype,"_interval",null),y([w()],ln.prototype,"_sampleCount",null),y([w()],ln.prototype,"_duration",null),y([w()],ln.prototype,"_lightDirections",null),y([w()],ln.prototype,"_tooltipEnabled",null),y([w()],ln.prototype,"_visualizationParameters",null),y([w()],ln.prototype,"_thresholdVisualizationParameters",null),y([w()],ln.prototype,"_durationVisualizationParameters",null),y([w()],ln.prototype,"_discreteVisualizationParameters",null),y([w()],ln.prototype,"_forcePreviewDependencies",null),y([w()],ln.prototype,"renderer",null),ln=y([Z("esri.widgets.ShadowCast.ShadowCastViewModel")],ln);const dWt=ln;let Av=class extends ze{constructor(){super(...arguments),this.timeRangeSlider=!0,this.timezone=!0,this.datePicker=!0,this.visualizationOptions=!0,this.colorPicker=!0,this.tooltip=!0}};y([w()],Av.prototype,"timeRangeSlider",void 0),y([w()],Av.prototype,"timezone",void 0),y([w()],Av.prototype,"datePicker",void 0),y([w()],Av.prototype,"visualizationOptions",void 0),y([w()],Av.prototype,"colorPicker",void 0),y([w()],Av.prototype,"tooltip",void 0),Av=y([Z("esri.widgets.ShadowCast.ShadowCastVisibleElements")],Av);const Bje=Av;function jje(t,e="milliseconds",i={}){const r={locale:pWt(),numberingSystem:"latn"};let n;return n=t?pn.fromMillis(Hs(t,e,"milliseconds"),r).rescale():pn.fromObject({seconds:0},r),n.toHuman({listStyle:"narrow",unitDisplay:"long",...i})}function pWt(){return bse()==="bs"?"hr":ma()}function sH(t,e){const{for:i,label:r,tabIndex:n,...s}=t;return X("div",{class:rT(sWt,s==null?void 0:s.class),key:i,...s},X("calcite-label",{for:i,scale:"s",tabIndex:n},r),e)}const f3="esri-color-picker",m3={base:f3,backgroundPattern:`${f3}__bg-pattern`,toggleButton:`${f3}__toggle-button`,popover:`${f3}__popover`,opacitySliderContainer:`${f3}__opacity-slider-container`,opacitySlider:`${f3}__opacity-slider`,calciteColorPicker:`${f3}__calcite-color-picker`};var Hw;(function(t){t.ColorPickerFocus="hex-input-poll-timeout",t.ButtonFocusTimeout="button-focus-timeout"})(Hw||(Hw={}));let Hd=class extends hn{constructor(t,e){super(t,e),this.value=new qe,this.alphaEnabled=!0,this._containerElement=null,this._popover=null,this._popoverElement=null,this._buttonElement=null,this._colorPickerCreated=!1}initialize(){this.addHandles(_e(()=>({container:this._containerElement,value:this.value}),({container:t,value:e})=>{t==null||t.style.setProperty("--esri-color-picker-value",e.toCss(!0))},kt))}loadDependencies(){return Il({button:()=>we(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([214,215,216,217,218,219,220,221,222,223,224,225,226,227])),"color-picker":()=>we(()=>import("./calcite-color-picker--cLRGCVy.js"),__vite__mapDeps([295,219,225,222,216,217,221,218,220,224,223,296,297,215,226,227,233])),label:()=>we(()=>import("./calcite-label-DHrtVvrs.js"),__vite__mapDeps([267,218])),slider:()=>we(()=>import("./calcite-slider-czDRxbAt.js"),__vite__mapDeps([298,227,216,217,221,218,219,220,222,297]))})}destroy(){this._destroyPopover(),this._buttonElement=null}render(){const t=this._messages,e=this._popover!=null&&this._popover.open?t.close:t.open;return X("div",{afterCreate:this._onContainerAfterCreate,bind:this,class:this.classes(m3.base,this.class)},X("div",{class:m3.backgroundPattern}),X("calcite-button",{afterCreate:this._onButtonAfterCreate,appearance:"transparent",bind:this,class:m3.toggleButton,id:this.id,kind:"neutral",label:e,onclick:this._togglePopover,scale:"s",tabIndex:-1,title:e}))}_onContainerAfterCreate(t){this._containerElement=t}_onButtonAfterCreate(t){this._destroyPopover(),this._buttonElement=t,this._popover=new vje({owner:this,anchorElement:t,placement:"bottom-start",renderContentFunction:this._renderPopoverContent})}_destroyPopover(){this.removeHandles(Hw.ColorPickerFocus),this._popover=et(this._popover),this._popoverElement=null}_renderPopoverContent(){const t=this.value,e=this._messages;return X("div",{afterCreate:this._onPopoverAfterCreate,bind:this,class:m3.popover,onfocusout:this._onPopoverFocusOut,onkeydown:this._onPopoverKeyDown,tabIndex:-1},X("calcite-color-picker",{afterCreate:this._onColorPickerAfterCreate,afterRemoved:()=>this._colorPickerCreated=!1,bind:this,class:m3.calciteColorPicker,hideChannels:!0,hideSaved:!0,scale:"m",value:this._colorPickerCreated?t.toCss():null,onCalciteColorPickerInput:this._onColorInput}),this.alphaEnabled?X("section",{class:m3.opacitySliderContainer},X("calcite-label",{scale:"s"},e.opacity,X("calcite-slider",{bind:this,class:m3.opacitySlider,labelHandles:!0,max:1,min:0,step:.01,value:t.a,onCalciteSliderInput:this._onOpacityChange}))):null)}_onColorInput(t){const e=t.target.value,i=typeof e=="string"?new qe(e):new qe;i.a=this.value.a,this._onChange(i)}_onOpacityChange(t){const e=this.value.clone();e.a=t.target.value,this._onChange(e)}_onChange(t){this.value=t,this.onChange!=null&&this.onChange(t)}_onColorPickerAfterCreate(t){this.removeHandles(Hw.ColorPickerFocus);const e=Oc(async i=>{t.componentOnReady&&await t.componentOnReady(),St(i),this._colorPickerCreated=!0,await new Promise(r=>requestAnimationFrame(r)),St(i),t.setFocus()});this.addHandles(rr(()=>{e.abort(),this._colorPickerCreated=!1}),Hw.ColorPickerFocus)}_togglePopover(t){this._popover!=null&&this._popover.open?this._closePopover():this._openPopover()}_openPopover(){const t=this._popover;t&&(t.open=!0)}_closePopover(){this.removeHandles(Hw.ColorPickerFocus);const t=this._popover;t&&(t.open=!1),this._setFocusOnButton()}_setFocusOnButton(){this.removeHandles(Hw.ButtonFocusTimeout),this.addHandles(fWt(()=>{var t;return(t=this._buttonElement)==null?void 0:t.setFocus()}),Hw.ButtonFocusTimeout)}_onPopoverAfterCreate(t){this._popoverElement=t}_onPopoverFocusOut(t){const e=this._popoverElement;if(e==null)return;const i=t.relatedTarget;i&&i instanceof Node&&(e.contains(i)||i===this._buttonElement||this._isAssociatedLabel(i))||this._closePopover()}_isAssociatedLabel(t){var r;const e=this.id,i=(r=t.tagName)==null?void 0:r.toLowerCase();return i==="calcite-label"&&t.for===e||i==="label"&&t.htmlFor===e}_onPopoverKeyDown(t){t.key!=="Escape"&&t.key!=="Enter"||(t.stopPropagation(),this._closePopover())}};function fWt(t,e){const i=setTimeout(t,e);return rr(()=>clearTimeout(i))}y([w()],Hd.prototype,"class",void 0),y([w()],Hd.prototype,"value",void 0),y([w()],Hd.prototype,"alphaEnabled",void 0),y([w()],Hd.prototype,"onChange",void 0),y([w()],Hd.prototype,"_containerElement",void 0),y([w()],Hd.prototype,"_popover",void 0),y([w()],Hd.prototype,"_popoverElement",void 0),y([w()],Hd.prototype,"_buttonElement",void 0),y([w(),Gr("esri/widgets/support/t9n/ColorPicker")],Hd.prototype,"_messages",void 0),y([w()],Hd.prototype,"_colorPickerCreated",void 0),Hd=y([Z("esri.widgets.support.ColorPicker")],Hd);function dhe(t){return X(sH,{for:t.id,label:t.label,tabIndex:-1},X(Hd,{id:t.id,value:t.value,onChange:t.onChange}))}let TM=class extends hn{constructor(e){super(e),this.colorPickerVisible=!0,this._selectId=`select-${Zf()}`,this._colorPickerId=`color-picker-${Zf()}`,this._onColorChange=i=>{this.options.color=i}}loadDependencies(){return Il({label:()=>we(()=>import("./calcite-label-DHrtVvrs.js"),__vite__mapDeps([267,218])),option:()=>we(()=>import("./calcite-option-XCvROySu.js"),__vite__mapDeps([268,222])),select:()=>we(()=>import("./calcite-select-h4uorzoD.js"),__vite__mapDeps([269,216,217,218,219,222,223,225]))})}render(){const e=this._messages.discrete,i=e.intervalLabel,{color:r,interval:n,intervalOptions:s}=this.options;return X("div",{class:aWt.base},X(sH,{for:this._selectId,label:i},X("calcite-select",{bind:this,id:this._selectId,label:i,onCalciteSelectChange:this._onIntervalChange},s.toArray().map(o=>X("calcite-option",{key:o,selected:o===n,value:String(o)},jje(o))))),this.colorPickerVisible?X(dhe,{id:this._colorPickerId,label:e.colorLabel,value:r,onChange:this._onColorChange}):null)}_onIntervalChange(e){var r;const i=parseInt((r=e.target.selectedOption)==null?void 0:r.value,10);Number.isFinite(i)&&(this.options.interval=i)}};y([w()],TM.prototype,"options",void 0),y([w()],TM.prototype,"colorPickerVisible",void 0),y([w(),Gr("esri/widgets/ShadowCast/t9n/ShadowCast")],TM.prototype,"_messages",void 0),TM=y([Z("esri.widgets.ShadowCast.components.DiscreteConfigurator")],TM);let EM=class extends hn{constructor(e){super(e),this.colorPickerVisible=!0,this._modeSelectorId=`mode-selector-${Zf()}`,this._colorPickerId=`color-picker-${Zf()}`,this._onColorChange=i=>{this.options.color=i},this._setContinuous=()=>{this.options.mode=b2.Continuous},this._setHourly=()=>{this.options.mode=b2.Hourly}}loadDependencies(){return Il({button:()=>we(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([214,215,216,217,218,219,220,221,222,223,224,225,226,227])),label:()=>we(()=>import("./calcite-label-DHrtVvrs.js"),__vite__mapDeps([267,218]))})}render(){const e=this._messages.duration,{color:i,mode:r}=this.options;return X("div",{class:R3e.base},X(sH,{for:this._modeSelectorId,label:e.modeLabel},X("div",{class:R3e.radioGroup},X(F3e,{active:r===b2.Continuous,label:e.continuousLabel,onclick:this._setContinuous}),X(F3e,{active:r===b2.Hourly,label:e.hourlyLabel,onclick:this._setHourly}))),this.colorPickerVisible?X(dhe,{id:this._colorPickerId,label:e.colorLabel,value:i,onChange:this._onColorChange}):null)}};function F3e({active:t,label:e,...i}){return X("calcite-button",{alignment:"center",appearance:t?"solid":"outline",scale:"s",width:"half",...i},e)}y([w()],EM.prototype,"options",void 0),y([w()],EM.prototype,"colorPickerVisible",void 0),y([w(),Gr("esri/widgets/ShadowCast/t9n/ShadowCast")],EM.prototype,"_messages",void 0),EM=y([Z("esri.widgets.ShadowCast.components.DurationConfigurator")],EM);const mWt=Hs(1,"minutes","milliseconds"),k3e=Hs(15,"minutes","milliseconds");let ES=class extends hn{constructor(e,i){super(e,i),this.accumulatedShadowTime=null,this._messages=null}render(){const e=this._formattedContent;return X("div",{class:$3e.base},e?X("div",{class:$3e.content},e):null)}get _formattedContent(){const e=this._messages,i=this.accumulatedShadowTime;if(e==null||i==null)return null;const r=uXe(i,i{const e=this._contentContainer,{screenPoint:i,accumulatedShadowTime:r}=this.viewModel.tooltip;return{contentContainer:e,screenPoint:i,accumulatedShadowTime:r}},e=>this._update(e),kt)}destroy(){this._updateHandle=en(this._updateHandle),this._contentWidget=et(this._contentWidget),this.container.contains(this._contentContainer)&&this.container.removeChild(this._contentContainer)}get testData(){var e;return{displayedValue:this._contentContainer.style.display==="none"?null:(e=this._contentWidget.container)==null?void 0:e.innerText}}_update({contentContainer:e,screenPoint:i,accumulatedShadowTime:r}){const{style:n}=e;i!=null?(n.display="block",n.transform=`translate(${i.x}px, ${i.y}px)`,this._contentWidget.accumulatedShadowTime=r):n.display="none"}_createContainer(){const e=document.createElement("div"),{style:i}=e;return i.position="absolute",i.top="0",i.left="0",e}};y([w()],CS.prototype,"viewModel",void 0),y([w()],CS.prototype,"container",void 0),y([w()],CS.prototype,"_contentContainer",void 0),y([w()],CS.prototype,"_contentWidget",void 0),CS=y([Z("esri.widgets.ShadowCast.components.ShadowTooltip")],CS);let Iw=class extends hn{constructor(e){super(e),this.colorPickerVisible=!0,this._valueSliderId=`value-slider-${Zf()}`,this._colorPickerId=`color-picker-${Zf()}`,this._valueSlider=new WG({visibleElements:{labels:!1,rangeLabels:!1},steps:Hs(30,"minutes","milliseconds"),labelFormatFunction:(i,r)=>{const n=Hs(i,"milliseconds","hours");return r==="tick"?hd(n,{maximumFractionDigits:0}):""}}),this._onColorChange=i=>{this.options.color=i}}initialize(){const e=({value:i})=>{this.options.value=i};this.addHandles([_e(()=>{const{value:i,minValue:r,maxValue:n}=this.options;return{value:i,minValue:r,maxValue:n}},({value:i,minValue:r,maxValue:n})=>{const s=this._valueSlider;s.min=r,s.max=n,s.values=[i];const o=n-r,a=Math.floor(Hs(o,"milliseconds","hours"));s.tickConfigs=[{mode:"count",values:2*a+1,labelsVisible:!1},{mode:"count",values:a+1,labelsVisible:!0}]},kt),this._valueSlider.on("thumb-change",e),this._valueSlider.on("thumb-drag",e)])}loadDependencies(){return Il({label:()=>we(()=>import("./calcite-label-DHrtVvrs.js"),__vite__mapDeps([267,218]))})}destroy(){this._valueSlider=et(this._valueSlider)}render(){const e=this._messages.threshold,{color:i}=this.options;return X("div",{class:O3e.base},X(sH,{class:O3e.valueLabel,for:this._valueSliderId,label:e.valueLabel},this._valueSlider.render()),this.colorPickerVisible?X(dhe,{id:this._colorPickerId,label:e.colorLabel,value:i,onChange:this._onColorChange}):null)}get testData(){return{valueSlider:this._valueSlider}}};y([w()],Iw.prototype,"options",void 0),y([w()],Iw.prototype,"colorPickerVisible",void 0),y([w()],Iw.prototype,"testData",null),y([w()],Iw.prototype,"_valueSlider",void 0),y([w(),Gr("esri/widgets/ShadowCast/t9n/ShadowCast")],Iw.prototype,"_messages",void 0),Iw=y([Z("esri.widgets.ShadowCast.components.ThresholdConfigurator")],Iw);var JV;(function(t){t.Slider="slider"})(JV||(JV={}));const gWt={hour:"2-digit",minute:"2-digit",timeZone:"UTC"},yWt=/(.*)\s(.*)/,vWt={labelFormatFunction:qre,min:0,max:1439,steps:15,rangeLabelInputsEnabled:!1,visibleElements:{labels:!1,rangeLabels:!1},tickConfigs:[{mode:"position",values:[0,360,720,1080,1439],labelsVisible:!0,tickCreatedFunction:(t,e,i)=>{e.classList.add(it.primaryTick),i.classList.add(it.primaryTickLabel);const r=i.innerText.match(yWt);r&&(i.innerHTML=`${r[1]}
${r[2]}
`)}},{mode:"position",values:[120,240,480,600,840,960,1200,1320],tickCreatedFunction:(t,e)=>{e.classList.add(it.secondaryTick)}}]};let Ah=class extends hn{constructor(t,e){super(t,e),this.viewModel=null,this.headingLevel=4,this.iconClass=Bb.widgetIcon,this.icon=null,this.visibleElements=new Bje,this._defaultViewModel=null,this._timeSlider=new WG({...vWt,container:document.createElement("div")}),this._tooltip=null,this._onTimezoneChange=i=>{this.viewModel.utcOffset=i},this._onDateChange=i=>{this.viewModel.date=i},t!=null&&t.viewModel||(this._defaultViewModel=new dWt({view:t==null?void 0:t.view}),this.viewModel=this._defaultViewModel)}initialize(){this.addHandles([_e(()=>({viewModel:this.viewModel,slider:this._timeSlider}),t=>this._connectTimeSlider(t),kt),_e(()=>{var t;return{container:(t=this.view)==null?void 0:t.surface,viewModel:this.viewModel,tooltipVisible:this.visibleElements.tooltip}},({container:t,viewModel:e,tooltipVisible:i})=>{this._tooltip=et(this._tooltip),t!=null&&i&&(this._tooltip=new CS({viewModel:e,container:t}))},kt),_e(()=>({viewModel:this.viewModel,visible:this.visible}),({viewModel:t,visible:e})=>t.setRunning(e),kt)])}destroy(){this._timeSlider=et(this._timeSlider),this._defaultViewModel!=null&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy()}loadDependencies(){return Il({select:()=>we(()=>import("./calcite-select-h4uorzoD.js"),__vite__mapDeps([269,216,217,218,219,222,223,225])),option:()=>we(()=>import("./calcite-option-XCvROySu.js"),__vite__mapDeps([268,222]))})}render(){const{visibleElements:t,viewModel:e}=this,i=e.state===jO.Disabled;return X("div",{class:this.classes(Bb.base,it.widget,it.panel,{[it.widgetDisabled]:i}),key:this},this._renderTimeRangeSection(),t.visualizationOptions?this._renderVisualizationOptionsSection():null)}get view(){var t;return(t=this.viewModel)==null?void 0:t.view}set view(t){this.viewModel&&(this.viewModel.view=t)}get label(){var t;return((t=this.messages)==null?void 0:t.widgetLabel)??""}set label(t){this._overrideIfSome("label",t)}get testData(){return{tooltip:this._tooltip}}_connectTimeSlider({viewModel:t,slider:e}){if(this.removeHandles(JV.Slider),e==null)return;const i=s=>Hs(s,"milliseconds","minutes"),r=s=>Hs(s,"minutes","milliseconds"),n=({index:s,value:o})=>{s===0?t.startTimeOfDay=r(o):t.endTimeOfDay=r(o)};this.addHandles([_e(()=>[t.startTimeOfDay,t.endTimeOfDay],s=>{e.values=s.map(i)},kt),e.on("thumb-change",n),e.on("thumb-drag",n),e.on("segment-drag",()=>{[t.startTimeOfDay,t.endTimeOfDay]=e.values.map(r)})],JV.Slider)}_renderTimeRangeSection(){const{visibleElements:t}=this;return t.timeRangeSlider||t.datePicker?X("section",{class:Bb.timeRange,key:"time-range"},X(Dm,{level:this.headingLevel},this.messages.timeLabel),t.timeRangeSlider?this._renderTimeRange():null,t.datePicker?this._renderDatePicker():null):null}_renderTimeRange(){const{messages:t,viewModel:e,visibleElements:i}=this,{startTimeOfDay:r,endTimeOfDay:n}=e,[s,o]=[r,n].map(a=>Gs(new Date(a),gWt));return[X("div",{class:Bb.timeRangeIndicator,key:"time-range-indicator"},Zy(t.timeRange,{start:s,end:o}),i.timezone?X(Zd,{value:e.utcOffset,onChange:this._onTimezoneChange}):null),X("div",{afterCreate:this._timeSliderContainerAfterCreate,afterRemoved:this._timeSliderContainerAfterRemoved,bind:this,key:"time-slider-container"})]}_timeSliderContainerAfterCreate(t){var i;const e=(i=this._timeSlider)==null?void 0:i.container;e&&t.appendChild(e)}_timeSliderContainerAfterRemoved(t){var i;const e=(i=this._timeSlider)==null?void 0:i.container;e&&t.removeChild(e)}_renderDatePicker(){return X("div",{class:Bb.datePickerContainer,key:"date-picker"},X(_je,{value:this.viewModel.date,onChange:this._onDateChange}))}_renderVisualizationOptionsSection(){const{headingLevel:t,messages:e,viewModel:i,visibleElements:r}=this,n=r.colorPicker,s=o=>this.classes(i.visualizationType===o?null:Bb.visualizationConfigHidden);return X("section",{class:Bb.visualization,key:"visualization"},X(Dm,{level:t},e.visualizationLabel),this._renderVisualizationSelect(),X("div",{class:s(Ya.Threshold),key:"threshold-configurator"},X(Iw,{colorPickerVisible:n,options:i.thresholdOptions})),X("div",{class:s(Ya.Duration),key:"duration-configurator"},X(EM,{colorPickerVisible:n,options:i.durationOptions})),X("div",{class:s(Ya.Discrete),key:"discrete-configurator"},X(TM,{colorPickerVisible:n,options:i.discreteOptions})))}_renderVisualizationSelect(){const t=this.messages,e=this.viewModel.visualizationType;return X("calcite-select",{bind:this,class:Bb.visualizationSelect,key:"visualization-select",label:t.visualizationLabel,onCalciteSelectChange:this._onVisualizationTypeChange},[{type:Ya.Threshold,label:t.threshold.label},{type:Ya.Duration,label:t.duration.label},{type:Ya.Discrete,label:t.discrete.label}].map(({type:i,label:r})=>X("calcite-option",{selected:i===e,value:i},r)))}_onVisualizationTypeChange(t){var i;const e=(i=t.target.selectedOption)==null?void 0:i.value;this.viewModel.visualizationType=e??Ya.Threshold}};y([w()],Ah.prototype,"viewModel",void 0),y([w()],Ah.prototype,"view",null),y([w()],Ah.prototype,"headingLevel",void 0),y([w()],Ah.prototype,"iconClass",void 0),y([w()],Ah.prototype,"icon",void 0),y([w()],Ah.prototype,"label",null),y([w({type:Bje,nonNullable:!0})],Ah.prototype,"visibleElements",void 0),y([w(),Gr("esri/widgets/ShadowCast/t9n/ShadowCast")],Ah.prototype,"messages",void 0),y([w()],Ah.prototype,"_defaultViewModel",void 0),y([w()],Ah.prototype,"_timeSlider",void 0),y([w()],Ah.prototype,"_tooltip",void 0),Ah=y([Z("esri.widgets.ShadowCast")],Ah);const _Wt=Ah,bWt=t=>new _Wt({view:t,visible:!1,container:"shadowcast-container"});let Mv=class extends Xs(Ue){constructor(e){super(e),this.type="plane",this.position=null,this.heading=0,this.tilt=0,this.width=10,this.height=10}equals(e){return this.heading===e.heading&&this.tilt===e.tilt&&HO(this.position,e.position)&&this.width===e.width&&this.height===e.height}};y([w({readOnly:!0,json:{read:!1,write:!0}})],Mv.prototype,"type",void 0),y([w({type:mt}),jv()],Mv.prototype,"position",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:360}}),jv(),Ci(t=>wP.normalize(Gh(t),0,!0))],Mv.prototype,"heading",void 0),y([w({type:Number,nonNullable:!0,range:{min:0,max:360}}),jv(),Ci(t=>wP.normalize(Gh(t),0,!0))],Mv.prototype,"tilt",void 0),y([w({type:Number,nonNullable:!0}),jv()],Mv.prototype,"width",void 0),y([w({type:Number,nonNullable:!0}),jv()],Mv.prototype,"height",void 0),Mv=y([Z("esri.analysis.SlicePlane")],Mv);const wWt=Mv;let Ov=class extends GVe{constructor(e){super(e),this.type="slice",this.tiltEnabled=!1,this.shape=null,this.excludeGroundSurface=!1}get excludedLayers(){return this._get("excludedLayers")||new tt}set excludedLayers(e){this._set("excludedLayers",od(e,this._get("excludedLayers")))}get requiredPropertiesForEditing(){var e;return[(e=this.shape)==null?void 0:e.position]}clear(){this.shape=null}};y([w({type:["slice"]})],Ov.prototype,"type",void 0),y([w()],Ov.prototype,"tiltEnabled",void 0),y([w({types:{key:"type",base:null,typeMap:{plane:wWt},defaultKeyValue:"plane"}})],Ov.prototype,"shape",void 0),y([w({cast:o5,clonable:t=>t.slice()})],Ov.prototype,"excludedLayers",null),y([w({type:Boolean,nonNullable:!0})],Ov.prototype,"excludeGroundSurface",void 0),y([w({readOnly:!0})],Ov.prototype,"requiredPropertiesForEditing",null),Ov=y([Z("esri.analysis.SliceAnalysis")],Ov);const Gje=Ov,JX=new Set;let Kg=class extends fc{constructor(e){super(e),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="SliceViewModel is only supported in 3D views.",JX.add(this)}destroy(){JX.delete(this)}get state(){return this.disabled||!this.ready?"disabled":this.tool==null?"ready":this.tool.state}get shape(){return this.analysis.shape}set shape(e){this.analysis.shape=e}get tiltEnabled(){return this.analysis.tiltEnabled}set tiltEnabled(e){this.analysis.tiltEnabled=e}get layersMode(){var e;return((e=this.tool)==null?void 0:e.layersMode)??"none"}get excludedLayers(){return this.analysis.excludedLayers}set excludedLayers(e){this.analysis.excludedLayers=tt.isCollection(e)?e:new tt(e)}get excludeGroundSurface(){return this.analysis.excludeGroundSurface}set excludeGroundSurface(e){this.analysis.excludeGroundSurface=e}async start(){await super.start(),JX.forEach(e=>{e.view===this.view&&e!==this&&e.clear()}),this.analysisView!=null&&(this.analysisView.active=!0)}enterExcludeLayerMode(){this.tool!=null&&this.tool.enterExcludeLayerMode()}exitExcludeLayerMode(){this.tool!=null&&this.tool.exitExcludeLayerMode()}onConnectToAnalysisView(e){e.active=!0}constructAnalysis(){return new Gje}};y([w({type:Gje})],Kg.prototype,"analysis",void 0),y([w({readOnly:!0})],Kg.prototype,"state",null),y([w()],Kg.prototype,"shape",null),y([w()],Kg.prototype,"tiltEnabled",null),y([w()],Kg.prototype,"layersMode",null),y([w()],Kg.prototype,"excludedLayers",null),y([w({nonNullable:!0})],Kg.prototype,"excludeGroundSurface",null),Kg=y([Z("esri.widgets.Slice.SliceViewModel")],Kg);const Hje=Kg,Hp="esri-slice",bh={base:Hp,widgetIcon:oi.slice,actions:`${Hp}__actions`,cancelButton:`${Hp}__cancel-button`,container:`${Hp}__container`,error:`${Hp}__error`,excludeButton:`${Hp}__exclude-button`,hint:`${Hp}__hint`,hintText:`${Hp}__hint-text`,layerItem:`${Hp}__layer-item`,layerList:`${Hp}__layer-list`,layerListHeading:`${Hp}__layer-list-title`,newSliceButton:`${Hp}__clear-button`};let Qc=class extends hn{constructor(e,i){super(e,i),this.headingLevel=3,this.iconClass=bh.widgetIcon,this.icon=null,this.messages=null,this.viewModel=new Hje,this._onNewSliceClick=()=>{Nm(this.viewModel.start())}}loadDependencies(){return Il({action:()=>we(()=>import("./calcite-action-GYDrwtQs.js"),__vite__mapDeps([273,274,227,217,219,220,221,222,223,224,225,226])),button:()=>we(()=>import("./calcite-button-rIOy-85Y.js"),__vite__mapDeps([214,215,216,217,218,219,220,221,222,223,224,225,226,227])),"list-item":()=>we(()=>import("./calcite-list-item-ewhQm-Oo.js"),__vite__mapDeps([299,217,300,220,221,222,224,219,274,227,223,225,226])),list:()=>we(()=>import("./calcite-list-KbTGTbJq.js"),__vite__mapDeps([301,217,222,300,219,233,220,221,224,225,302,216,218,223,296,226,227,237]))})}get active(){return this.viewModel.active}get analysis(){return this.viewModel.analysis}set analysis(e){this.viewModel.analysis=e}get excludedLayers(){return this.viewModel.excludedLayers}set excludedLayers(e){this.viewModel.excludedLayers=e}get excludeGroundSurface(){return this.viewModel.excludeGroundSurface}set excludeGroundSurface(e){this.viewModel.excludeGroundSurface=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}get hasVoxelLayers(){var i;const e=(i=this.viewModel)==null?void 0:i.view;return e!=null&&e.allLayerViews.some(r=>r.type==="voxel-3d")}render(){return X("div",{class:this.classes(bh.base,it.widget,it.panel),role:"presentation"},this.visible?X("div",{class:bh.container},this.viewModel.supported?[this._renderHint(),this._renderLayerList(),this._renderActions()]:this._renderUnsupported()):null)}_renderUnsupported(){return X("div",{class:bh.error,key:"unsupported"},X("p",null,this.messages.unsupported))}_renderHint(){const{hasVoxelLayers:e,messages:i,viewModel:r}=this,{active:n,layersMode:s,state:o}=r;let a=null;return n&&(s==="exclude"?a=i.excludeHint:o==="ready"&&(a=e?i.voxelHint:i.hint)),a?X("div",{class:bh.hint,key:"hint"},X("p",{class:bh.hintText},a),X("p",{class:bh.hintText},i.verticalHint)):null}_renderLayerList(){const{excludedLayers:e,excludeGroundSurface:i,headingLevel:r,messages:n,viewModel:s}=this,{layersMode:o,state:a}=s,c=a==="slicing"||a==="sliced",p=e?e.toArray().map(_=>this._renderLayerItem({uid:_.uid,title:_.title,onClick:()=>(this.excludedLayers.remove(_),!1)})):[];return i&&p.push(this._renderLayerItem({uid:"ground",title:n.ground,onClick:()=>(this.excludeGroundSurface=!1,!1)})),o!=="exclude"&&c&&p.length!==0?X("div",{class:bh.layerList,key:"settings"},X(Dm,{class:bh.layerListHeading,level:r},n.excludedLayers),X("calcite-list",{selectionMode:"none"},p)):null}_renderActions(){const{messages:e,viewModel:i}=this,{active:r,state:n}=i,s=n==="disabled",o=n==="slicing"||n==="sliced",a=i.layersMode==="exclude",c=[];return r&&!o||a||c.push(X("calcite-button",{class:bh.newSliceButton,disabled:s,key:"new-slice",onclick:this._onNewSliceClick},e.newSlice)),o&&!a&&c.push(X("calcite-button",{appearance:"outline-fill",class:bh.excludeButton,disabled:s,key:"exclude",onclick:()=>i.enterExcludeLayerMode()},e.excludeLayer)),r&&a&&c.push(X("calcite-button",{appearance:"outline-fill",class:bh.cancelButton,disabled:s,key:"cancel-exclude",onclick:()=>i.exitExcludeLayerMode()},e.cancel)),c.length===0?null:X("div",{class:bh.actions},c)}_renderLayerItem(e){return X("calcite-list-item",{class:bh.layerItem,key:e.uid,label:e.title??""},X("calcite-action",{icon:"x",onclick:e.onClick,scale:"s",slot:"actions-end",text:this.messages.includeLayer}))}};y([w()],Qc.prototype,"active",null),y([w({constructOnly:!0,nonNullable:!0})],Qc.prototype,"analysis",null),y([w()],Qc.prototype,"excludedLayers",null),y([w()],Qc.prototype,"excludeGroundSurface",null),y([w()],Qc.prototype,"headingLevel",void 0),y([w()],Qc.prototype,"iconClass",void 0),y([w()],Qc.prototype,"icon",void 0),y([w()],Qc.prototype,"label",null),y([w(),Gr("esri/widgets/Slice/t9n/Slice")],Qc.prototype,"messages",void 0),y([w()],Qc.prototype,"view",null),y([w({type:Hje})],Qc.prototype,"viewModel",void 0),y([w()],Qc.prototype,"visible",null),y([w()],Qc.prototype,"hasVoxelLayers",null),Qc=y([Z("esri.widgets.Slice")],Qc);const xWt=Qc,SWt=t=>new xWt({view:t,container:"slicing-container"}),Vvi=tt.ofType({key:"type",defaultKeyValue:"button",base:v5,typeMap:{button:_5,toggle:kB}}),Bvi=new _5({icon:"magnifying-glass-plus",id:"zoom-to-feature",title:"{messages.zoom}",className:oi.zoomInMagnifyingGlass}),TWt=new _5({icon:"trash",id:"remove-selected-feature",title:"{messages.remove}",className:oi.trash}),jvi=new _5({icon:"magnifying-glass-plus",id:"zoom-to-clustered-features",title:"{messages.zoom}",className:oi.zoomInMagnifyingGlass}),Gvi=new kB({icon:"table",id:"browse-clustered-features",title:"{messages.browseClusteredFeatures}",className:oi.table,value:!1}),EWt=2500,qje={type:"CIMPictureMarker",primitiveName:"headingOverride",enable:!0,anchorPoint:{x:0,y:-.5},anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:36,billboardMode3D:"FaceNearPlane",invertBackfaceTexture:!0,scaleX:1,textureFilter:"Picture",url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAkCAYAAACe0YppAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAYaSURBVHgBvVfNb1VFFD/nzP16xRYJKYREEiJoDLLShQkrSNzoHv8I2QgxwY8FJWHhxoVxISEu2AordWNiQjAxEBeEsKAmhCCwkPDRAn1t33v33jnH37n3Fam0pa8kTjOde+/MnN/5+J0z85jW08yYTpxgfzx0bS+fO0R0YHqyeb9w7YEtLTv+9rSdOH7ciNleJJJX/Do1JQ3AltdlT35fiN6gG8kD8akdmzO+6w/zM7wdw725rUY78DBXtmATA6PZntFgm9Kjm6o/HFJpdi5Xhp+16sDBC+H+gUmZfjIXHKC+35U42ZHZfpe30BZS7okNFnhu8wTRk2ek5LEV2q+N8nEj6yuNVRjHddftrt4ahyJbOxF+Uppi/Rf47NlA05Pp9vkyRNkkD8sqUJHwOGfSpYFQFXhTJryQBaZSeAxbFus+U1K0gJm2oy3QKwuZzqeuSK5kpW6BEsE6+nCsAHDXQWuaOljzU8uP/ToxUW4KcwKg8QzOSdFL6Swm0hurAC7N2qIW7ncwNgYKF4la3/w7RnzrUK29KseXWqmTKXGl45Zrd9CLrsSjr96fcw4kS46mTsJznSTrVBR6VQJQdDbpZTWexxgCYCFz30cquD8oYVQgtUAUzfo8wGtqGoNRFmFZ1KKulJMQu3Vpm/I8Pup3ekvES57GaabXo4lsszEA6zrkhcmAAkBNshi59O9wVsokBLZUCQAxllXVBkyCDRQuTlLLiLSEqw3gfUqU0kVdsKymsnzyPLm8fXZxDxVZgvUhg9QyaKDI7AhpSlRVEaA83JM+/V8pGO0PMTHyZwra9FQVk4i1e0D6dPK9v5agkmXAhc0Bw5MjlAQQE0lSDbUmbBX4kGfsiiQWuSZtdle1S4F73cUKJgviyw4mmmqlVSoR/FAK2d1noWQZ8N79MySw0tgNzhN00jRFaPM6y3IyLWBxXuOdvMfhaIy1MQctmvnEMGrMq2Y/ekC3dHF14I84gmZP2s0pgiJFHVwYhIIrMC1zgT4fQgsS0CG48LWtslAsgeKZK5U1c5Slj+nEvvJZqOWubr5ks8iE3bVqCMQCz4p5aiUqpMrOdHz2qLFTxAMSPLwY8WpmntNwrXIMCWvESGH+7n9hVi6ZJ6/sR5gnycFFQgsCQEEB8T9TbsCGy4PrZrEBjGyIt4EApoGRXWKP6Mt3fnvOvhWBjR4gdjtJEDmGQQkBSCS6Teys5qECABTPWOBwcPWgAPIU+E2+Rq3J8lsrQawMHNPbqAXvRqasWcMB/mK42N3twM6/FsbJTZK2Fru15K7niPVIp6RHn++9vRKErAg8ta+MFq4LBxAJKY1EajpxLj5KUzFzOMTni4btxoUzXPzIIOwLnEPxGVqlyWoTdO/WNRUXJhDmAgNAJVd0eABj8FTCvLbpEnxdOycJlFNXVq6MDvzthwOQ654LaMGGVofQWIWtXhM9xaCQp85QIZFMPXcpuUPH3uquJj6htVonvySD+KY6c2AulPAzHdVaZElvPCGBgvkIRUECr1J4qmV6LdGyJvAnu+94HZMla1Eg1AuGVyQWnNCwzqsUXK5+AIsUyPRc1Rbpi93X1xK9tsXtkj9U7INWSWvU0DaZ6OlVAmUDiqgbrwY2Z3ThRVKFXrgi/R0x9GMplxAyER6ynAtZin1DQoLVznLMU+/mywMf3dlDpbyMlbjLQDhLw/Sh24sm5dhTrlHKgS/T0X2zLw/sLeGr5OlEbg2uHwAFw5reKuKsJj8kcIj0zq9H5PqAj+z6E8y+YRIaUhnAEOrcWgv9m3shQ1H7mz5duVJtDLhZqZcNlrEDwXKwCzncdFg+PJeVf1m3uPUupLR7Hq6tHNyLhw1TCmdGbm0BmaUjr63LzaMBH943D9f+yO5uZ7HfcLktqdwqMU0jtPUDN6vDOfzgKFrXtta6q83vfHU4M5KoURbT4W3zsPIqrgQFO8GozV8ocZGOTN4dRdRowN6CnOLmKkk5t7H1i+HPNGJj2kj7buYajoRXh2+36eOt+2nENrrF3ozODEmFC0D4hjbQNgYc+DSYjd9qqGSJXqL/tZ16/DWdfvw9bbCt41hcpYn9RAEX9Q22fwC74ny5v9iplQAAAABJRU5ErkJggg=="},CWt=new cx({data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:14,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:17,ymax:17},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[8.5,0],[7.02,.13],[5.59,.51],[4.25,1.14],[3.04,1.99],[1.99,3.04],[1.14,4.25],[.51,5.59],[.13,7.02],[0,8.5],[.13,9.98],[.51,11.41],[1.14,12.75],[1.99,13.96],[3.04,15.01],[4.25,15.86],[5.59,16.49],[7.02,16.87],[8.5,17],[9.98,16.87],[11.41,16.49],[12.75,15.86],[13.96,15.01],[15.01,13.96],[15.86,12.75],[16.49,11.41],[16.87,9.98],[17,8.5],[16.87,7.02],[16.49,5.59],[15.86,4.25],[15.01,3.04],[13.96,1.99],[12.75,1.14],[11.41,.51],[9.98,.13],[8.5,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Round",joinStyle:"Round",lineStyle3D:"Strip",miterLimit:10,width:2,color:[255,255,255,255]},{type:"CIMSolidFill",enable:!0,color:[0,122,194,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:16,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:17,ymax:17},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[8.5,0],[7.02,.13],[5.59,.51],[4.25,1.14],[3.04,1.99],[1.99,3.04],[1.14,4.25],[.51,5.59],[.13,7.02],[0,8.5],[.13,9.98],[.51,11.41],[1.14,12.75],[1.99,13.96],[3.04,15.01],[4.25,15.86],[5.59,16.49],[7.02,16.87],[8.5,17],[9.98,16.87],[11.41,16.49],[12.75,15.86],[13.96,15.01],[15.01,13.96],[15.86,12.75],[16.49,11.41],[16.87,9.98],[17,8.5],[16.87,7.02],[16.49,5.59],[15.86,4.25],[15.01,3.04],[13.96,1.99],[12.75,1.14],[11.41,.51],[9.98,.13],[8.5,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Round",joinStyle:"Round",lineStyle3D:"Strip",miterLimit:10,width:0,color:[255,255,255,255]},{type:"CIMSolidFill",enable:!0,color:[0,0,0,66]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,offsetX:0,offsetY:-1},qje],angleAlignment:"Map"},primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"headingOverride",propertyName:"Rotation",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Rotation override",expression:"360 - $feature.heading",returnType:"Default"}},{type:"CIMPrimitiveOverride",primitiveName:"headingOverride",propertyName:"TintColor",valueExpressionInfo:{type:"CIMExpressionInfo",title:"TintColor override",expression:"IIF(IsEmpty($feature.heading), [255, 255, 255, 0], [255, 255, 255, 1])",returnType:"Default"}}]}});let Qg=class extends HG(Dn.EventedMixin(ze)){constructor(){super(...arguments),this._geolocationUsable=!0,this.geolocationOptions=null,this.goToLocationEnabled=!0,this.graphic=new Ma({symbol:CWt}),this.scale=null,this.rotationEnabled=!0,this.view=null}initialize(){zre()||(this._geolocationUsable=!1),this.addHandles([_e(()=>{var e;return(e=this.view)==null?void 0:e.type},()=>this._handleViewTypeChange(),Qt)])}destroy(){this._clearGraphic(),this.view=null}_clearGraphic(){const{view:e,graphic:i}=this;e&&i&&e.graphics.remove(i)}_addGraphic(){const{view:e,graphic:i}=this;e!=null&&e.graphics&&i&&!e.graphics.includes(i)&&e.graphics.push(i)}_handleViewTypeChange(){var e;qje.enable=((e=this.view)==null?void 0:e.type)==="2d"}_getScaleWithinConstraints(e,i){if(!i)return e;if(i.type==="2d"){const{effectiveMaxScale:r,effectiveMinScale:n}=i.constraints;return Math.min(n,Math.max(r,e))}return e}_getScale(e){const{scale:i}=this,r=typeof i=="number"?i:EWt;return this._getScaleWithinConstraints(r,e)}_getHeading(e,i){var o;const r=i==null?void 0:i.spatialReference,n=(r==null?void 0:r.isWebMercator)||(r==null?void 0:r.isGeographic),s=(o=e.coords)==null?void 0:o.heading;return!n||typeof s!="number"||isNaN(s)||s<0||s>360?null:s}_addHeading(e){const{heading:i,target:r,view:n}=e;n&&i!==null&&(n.type!=="3d"?n.type==="2d"&&(r.rotation=360-i):r.heading=i)}async _animatePoint(e,i,r,n){const{view:s}=this;if(!this.goToLocationEnabled||!s)return;const o={target:e,scale:i};this.rotationEnabled&&this._addHeading({heading:r,target:o,view:s});const a={signal:n.signal};St(a),await this.callGoTo({target:o,options:a})}async updatePosition(e,i){try{const r=this.view,n=await wBe({position:e,view:r},{signal:i.signal}),{graphic:s}=this,{timestamp:o,coords:a}=e,{accuracy:c,altitude:p,altitudeAccuracy:_,latitude:x,longitude:S,speed:C}=a,M=this._getHeading(e,r),P={timestamp:o,accuracy:c,altitude:p,altitudeAccuracy:_,heading:M,latitude:x,longitude:S,speed:C};s&&(s.geometry=n,s.attributes=P);const $=this._getScale(r);await this._animatePoint(n,$,M,i)}catch(r){if(!on(r))throw new se("geolocation-positioning:invalid-point","Cannot position invalid point",{error:r})}return e}};y([w()],Qg.prototype,"_geolocationUsable",void 0),y([w()],Qg.prototype,"geolocationOptions",void 0),y([w()],Qg.prototype,"goToLocationEnabled",void 0),y([w({type:Ma,nonNullable:!0})],Qg.prototype,"graphic",void 0),y([w()],Qg.prototype,"scale",void 0),y([w()],Qg.prototype,"rotationEnabled",void 0),y([w()],Qg.prototype,"view",void 0),Qg=y([Z("esri.widgets.support.GeolocationPositioning")],Qg);const AWt=Qg;async function MWt(){const t=await gE("esri/widgets/Locate/t9n/Locate");return new yE({title:t.currentLocation,fieldInfos:[{fieldName:"timestamp",label:t.timestamp,format:{dateFormat:"short-date-short-time"}},{fieldName:"latitude",label:t.latitude,format:{places:4,digitSeparator:!0}},{fieldName:"longitude",label:t.longitude,format:{places:4,digitSeparator:!0}},{fieldName:"accuracy",label:t.accuracy,format:{places:0,digitSeparator:!0}},{fieldName:"altitude",label:t.altitude,format:{places:0,digitSeparator:!0}},{fieldName:"altitudeAccuracy",label:t.altitudeAccuracy,format:{places:0,digitSeparator:!0}},{fieldName:"heading",label:t.heading,format:{places:0,digitSeparator:!0}},{fieldName:"speed",label:t.speed,format:{places:0,digitSeparator:!0}}],actions:[TWt.clone()],content:[{type:"fields"}]})}let $w=class extends AWt{constructor(e){super(e),this._locateController=null,this.popupEnabled=!0,this.locate=this.locate.bind(this)}initialize(){this.addHandles([fE(()=>{var n;const{graphic:e,view:i}=this;if(!e)return;((n=i==null?void 0:i.graphics)==null?void 0:n.includes(e))&&this._updatePopupTemplate(e)})])}destroy(){this.cancelLocate()}get state(){var e;return this._geolocationUsable?(e=this.view)!=null&&e.ready?this._locateController?"locating":"ready":"disabled":"feature-unsupported"}async locate(){if(this.cancelLocate(),this.state==="disabled")throw new se("locate:disabled-state","Cannot locate when disabled.");if(this.state==="feature-unsupported")throw new se("locate:feature-unsupported-state","Cannot locate in unsecure domain.");const e=new AbortController;this._locateController=e;try{const i=await bBe(this.geolocationOptions);if(await this.updatePosition(i,e),this._locateController!==e)return null;const{graphic:r}=this;return r&&await this._updatePopupTemplate(r),this._addGraphic(),this.emit("locate",{position:i}),this._locateController=null,i}catch(i){if(on(i))return null;throw e===this._locateController&&(this._locateController=null),this.emit("locate-error",{error:i}),i}}cancelLocate(){this._clearGraphic(),this._locateController&&this._locateController.abort(),this._locateController=null}async _updatePopupTemplate(e){if(!this.popupEnabled)return;const i=await MWt(),r=e!==this.graphic;this.destroyed||r||(e.popupTemplate=i)}};y([w()],$w.prototype,"_locateController",void 0),y([w()],$w.prototype,"popupEnabled",void 0),y([w({readOnly:!0})],$w.prototype,"state",null),y([w()],$w.prototype,"locate",null),y([w()],$w.prototype,"cancelLocate",null),$w=y([Z("esri.widgets.Locate.LocateViewModel")],$w);const Wje=$w,KX={base:"esri-locate",widgetIcon:oi.northNavigation},OWt="gps-off",Yje="esri.widgets.Locate",z3e=Ce.getLogger(Yje);let bl=class extends hn{constructor(e,i){super(e,i),this.iconClass=KX.widgetIcon,this.icon=null,this.messages=null,this.messagesCommon=null,this.viewModel=new Wje}loadDependencies(){return Il({icon:()=>we(()=>import("./calcite-icon-ZhRmLRGh.js"),__vite__mapDeps([228,225,222])),loader:()=>we(()=>import("./calcite-loader-IfjW-6zZ.js"),__vite__mapDeps([277,226,227]))})}get geolocationOptions(){return this.viewModel.geolocationOptions}set geolocationOptions(e){this.viewModel.geolocationOptions=e}get goToLocationEnabled(){return this.viewModel.goToLocationEnabled}set goToLocationEnabled(e){this.viewModel.goToLocationEnabled=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get label(){var e;return((e=this.messages)==null?void 0:e.widgetLabel)??""}set label(e){this._overrideIfSome("label",e)}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(e){this.viewModel.popupEnabled=e}get rotationEnabled(){return this.viewModel.rotationEnabled}set rotationEnabled(e){this.viewModel.rotationEnabled=e}get scale(){return this.viewModel.scale}set scale(e){this.viewModel.scale=e}get useHeadingEnabled(){return gm(z3e,"useHeadingEnabled",{replacement:"rotationEnabled",version:"4.27",warnOnce:!0}),this.viewModel.rotationEnabled}set useHeadingEnabled(e){gm(z3e,"useHeadingEnabled",{replacement:"rotationEnabled",version:"4.27",warnOnce:!0}),this.viewModel.rotationEnabled=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}cancelLocate(){this.viewModel.cancelLocate()}locate(){return this.viewModel.locate()}render(){const{state:e}=this.viewModel,i=e==="locating"?this.messagesCommon.cancel:this.messages.title;return X("div",{"aria-label":i,bind:this,class:this.classes(KX.base,it.widget,it.widgetButton,{[it.disabled]:e==="disabled",[it.hidden]:e==="feature-unsupported"}),hidden:e==="feature-unsupported",onclick:this._locate,onkeydown:this._locate,role:"button",tabIndex:0,title:i},this._renderIcon(),X("span",{class:oi.fontFallbackText},this.messages.title))}_renderIcon(){const{icon:e,iconClass:i,viewModel:r}=this;return(r==null?void 0:r.state)==="locating"?X("calcite-loader",{inline:!0,key:"loader",label:"",scale:"s",type:"indeterminate"}):e?this._renderCalciteIcon(e):i&&i!==KX.widgetIcon?this._renderLegacyIcon(i):this._renderCalciteIcon(OWt)}_renderCalciteIcon(e){return X("calcite-icon",{icon:e,key:"icon",scale:"s"})}_renderLegacyIcon(e){return X("span",{"aria-hidden":"true",class:e,key:"legacy-icon"})}_locate(){const{viewModel:e}=this;e.state==="locating"?e.cancelLocate():e.locate()}};y([w()],bl.prototype,"geolocationOptions",null),y([w()],bl.prototype,"goToLocationEnabled",null),y([w()],bl.prototype,"goToOverride",null),y([w()],bl.prototype,"graphic",null),y([w()],bl.prototype,"iconClass",void 0),y([w()],bl.prototype,"icon",void 0),y([w()],bl.prototype,"label",null),y([w(),Gr("esri/widgets/Locate/t9n/Locate")],bl.prototype,"messages",void 0),y([w(),Gr("esri/t9n/common")],bl.prototype,"messagesCommon",void 0),y([w()],bl.prototype,"popupEnabled",null),y([w()],bl.prototype,"rotationEnabled",null),y([w()],bl.prototype,"scale",null),y([w()],bl.prototype,"useHeadingEnabled",null),y([w()],bl.prototype,"view",null),y([w({type:Wje}),gue(["locate","locate-error"])],bl.prototype,"viewModel",void 0),y([wo()],bl.prototype,"_locate",null),bl=y([Z(Yje)],bl);const PWt=bl,RWt=t=>new PWt({view:t});let IWt=class{constructor(e,i=0,r=e.lods[e.lods.length-1].level){this.tileInfo=e,this.minLOD=i,this.maxLOD=r,e.lodAt(i)||(this.minLOD=e.lods[0].level),e.lodAt(r)||(this.maxLOD=e.lods[e.lods.length-1].level)}get effectiveMinLOD(){return this.minLOD??this.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.tileInfo.lods[this.tileInfo.lods.length-1].level}getAvailability(e,i,r){var s;const n=(s=this.tileInfo)==null?void 0:s.lodAt(e);return!n||ethis.maxLOD?"unavailable":n.cols&&n.rows?r>=n.cols[0]&&r<=n.cols[1]&&i>=n.rows[0]&&i<=n.rows[1]?"unknown":"unavailable":"unknown"}async fetchAvailability(e,i,r,n){await rz(n);const s=this.getAvailability(e,i,r);if(s==="unavailable")throw new se("tile-map:tile-unavailable","Tile is not available",{level:e,row:i,col:r});return s}async fetchAvailabilityUpsample(e,i,r,n,s){await rz(s),n.level=e,n.row=i,n.col=r;const o=this.tileInfo;return o.updateTileInfo(n),this.fetchAvailability(e,i,r,s).catch(a=>{if(on(a))throw a;if(o.upsampleTile(n))return this.fetchAvailabilityUpsample(n.level,n.row,n.col,n,s);throw a})}};function $Wt(t,e=!1){return t<=nd?e?new Array(t).fill(0):new Array(t):new Uint32Array(t)}let U3e=class tne{constructor(e){this._validateJSON(e);const{location:i,data:r}=e;this.location=Object.freeze(Pe(i));const n=this.location.width,s=this.location.height;let o=!0,a=!0;const c=Math.ceil(n*s/32),p=$Wt(c);let _=0;for(let x=0;x>5,o=this._availability;return s<0||s>o.length?"unknown":o[s]&1<p.data).catch(p=>{if(p&&p.details&&p.details.httpStatus===422)return{location:{top:n,left:s,width:o,height:a},valid:!0,data:pGe(o*a,0)};throw p}).then(p=>{if(p.location&&(p.location.top!==n||p.location.left!==s||p.location.width!==o||p.location.height!==a))throw new se("tilemap:location-mismatch","Tilemap response for different location than requested",{response:p,definition:{top:n,left:s,width:o,height:a}});return tne.fromJSON(p)})}static fromJSON(e){return Object.freeze(new tne(e))}_validateJSON(e){if(!(e!=null&&e.location))throw new se("tilemap:missing-location","Location missing from tilemap response");if(e.valid===!1)throw new se("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new se("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new se("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new se("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}};function V3e(t){return`${t.level}/${t.row}/${t.col}/${t.width}/${t.height}`}function LWt(t){var r;let e;if((r=t.service.tileServers)!=null&&r.length){const n=t.service.tileServers;e=`${n&&n.length?n[t.row%n.length]:t.service.url}/tilemap/${t.level}/${t.row}/${t.col}/${t.width}/${t.height}`}else e=`${t.service.url}/tilemap/${t.level}/${t.row}/${t.col}/${t.width}/${t.height}`;const i=t.service.query;return i&&(e=`${e}?${i}`),e}var WS;let ey=WS=class extends ze{constructor(t){super(t),this._pendingTilemapRequests={},this.request=yi,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new JB(2*V2.MEGABYTES),this.addHandles([_e(()=>{const{layer:t}=this;return[t==null?void 0:t.parsedUrl,t==null?void 0:t.tileServers,t==null?void 0:t.apiKey,t==null?void 0:t.customParameters]},()=>this._initializeTilemapDefinition(),Qt)])}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}fetchTilemap(t,e,i,r){if(!this.layer.tileInfo.lodAt(t)||tthis.effectiveMaxLOD)return Promise.reject(new se("tilemap-cache:level-unavailable",`Level ${t} is unavailable in the service`));const n=this._tmpTilemapDefinition,s=this._tilemapFromCache(t,e,i,n);if(s)return Promise.resolve(s);const o=r==null?void 0:r.signal;return r={...r,signal:null},new Promise((a,c)=>{Zl(o,()=>c(ur()));const p=V3e(n);let _=this._pendingTilemapRequests[p];if(!_){_=U3e.fromDefinition(n,r).then(S=>(this._tilemapCache.put(p,S,S.byteSize),S));const x=()=>{delete this._pendingTilemapRequests[p]};this._pendingTilemapRequests[p]=_,_.then(x,x)}_.then(a,c)})}getAvailability(t,e,i){if(!this.layer.tileInfo.lodAt(t)||tthis.effectiveMaxLOD)return"unavailable";const r=this._tilemapFromCache(t,e,i,this._tmpTilemapDefinition);return r?r.getAvailability(e,i):"unknown"}fetchAvailability(t,e,i,r){return!this.layer.tileInfo.lodAt(t)||tthis.effectiveMaxLOD?Promise.reject(new se("tile-map:tile-unavailable","Tile is not available",{level:t,row:e,col:i})):this.fetchTilemap(t,e,i,r).catch(n=>n).then(n=>{if(n instanceof U3e){const s=n.getAvailability(e,i);if(s==="unavailable")throw new se("tile-map:tile-unavailable","Tile is not available",{level:t,row:e,col:i});return s}if(on(n))throw n;return"unknown"})}fetchAvailabilityUpsample(t,e,i,r,n){r.level=t,r.row=e,r.col=i;const s=this.layer.tileInfo;s.updateTileInfo(r);const o=this.fetchAvailability(t,e,i,n).catch(a=>{if(on(a))throw a;if(s.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,n);throw a});return this._fetchAvailabilityUpsamplePrefetch(r.id,t,e,i,n,o),o}async _fetchAvailabilityUpsamplePrefetch(t,e,i,r,n,s){if(!this._prefetchingEnabled||t==null)return;const o=`prefetch-${t}`;if(this.hasHandles(o))return;const a=new AbortController;s.then(()=>a.abort(),()=>a.abort());let c=!1;const p=rr(()=>{c||(c=!0,a.abort())});if(this.addHandles(p,o),await fHe(10,a.signal).catch(()=>{}),c||(c=!0,this.removeHandles(o)),So(a))return;const _=new Lj(t,e,i,r),x={...n,signal:a.signal},S=this.layer.tileInfo;for(let C=0;WS._prefetches.length{WS._prefetches.removeUnordered(M)};M.then(P,P)}}_initializeTilemapDefinition(){var r;if(!this.layer.parsedUrl)return;const{parsedUrl:t,apiKey:e,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:t.path,query:NT({...t.query,...i,token:e??((r=t.query)==null?void 0:r.token)}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(t,e,i,r){r.level=t,r.row=e-e%this.size,r.col=i-i%this.size;const n=V3e(r);return this._tilemapCache.get(n)}get test(){const t=this;return{get prefetchingEnabled(){return t._prefetchingEnabled},set prefetchingEnabled(e){t._prefetchingEnabled=e},hasTilemap:(e,i,r)=>!!t._tilemapFromCache(e,i,r,t._tmpTilemapDefinition)}}};ey._maxPrefetch=4,ey._prefetches=new Pi({initialSize:WS._maxPrefetch}),y([w({constructOnly:!0})],ey.prototype,"layer",void 0),y([w({constructOnly:!0})],ey.prototype,"minLOD",void 0),y([w({constructOnly:!0})],ey.prototype,"maxLOD",void 0),y([w({constructOnly:!0})],ey.prototype,"request",void 0),y([w({constructOnly:!0})],ey.prototype,"size",void 0),ey=WS=y([Z("esri.layers.support.TilemapCache")],ey);const DWt=t=>{let e=class extends t{constructor(){super(...arguments),this.copyright=null,this.minScale=0,this.maxScale=0,this.spatialReference=null,this.tileInfo=null,this.tilemapCache=null}destroy(){var i,r;(r=(i=this.tilemapCache)==null?void 0:i.destroy)==null||r.call(i)}readMinScale(i,r){return r.minLOD!=null&&r.maxLOD!=null?i:0}readMaxScale(i,r){return r.minLOD!=null&&r.maxLOD!=null?i:0}get supportsBlankTile(){return this.version>=10.2}readTilemapCache(i,r,n){var _;const s=(_=r.capabilities)==null?void 0:_.includes("Tilemap");let{minLOD:o,maxLOD:a,minScale:c,maxScale:p}=r;if(o==null&&a==null&&c!==0&&p!==0){const x=S=>Math.round(1e4*S)/1e4;c=x(c||r.tileInfo.lods[0].scale),p=x(p||r.tileInfo.lods[r.tileInfo.lods.length-1].scale);for(const S of r.tileInfo.lods){const C=x(S.scale);o=C>=c?S.level:o,a=C>=p?S.level:a}}if(s)return new ey({layer:this,minLOD:o,maxLOD:a});if(r.tileInfo){const x=new bO;return x.read(r.tileInfo,n),new IWt(x,o,a)}return null}};return y([w({json:{read:{source:"copyrightText"}}})],e.prototype,"copyright",void 0),y([w()],e.prototype,"minScale",void 0),y([Rt("service","minScale")],e.prototype,"readMinScale",null),y([w()],e.prototype,"maxScale",void 0),y([Rt("service","maxScale")],e.prototype,"readMaxScale",null),y([w({type:rt})],e.prototype,"spatialReference",void 0),y([w({readOnly:!0})],e.prototype,"supportsBlankTile",null),y([w({type:bO})],e.prototype,"tileInfo",void 0),y([w()],e.prototype,"tilemapCache",void 0),y([Rt("service","tilemapCache",["capabilities","tileInfo"])],e.prototype,"readTilemapCache",null),y([w()],e.prototype,"version",void 0),e=y([Z("esri.layers.mixins.ArcGISCachedService")],e),e};let xl=class extends DWt(VOe(ej(ij(T5(pE))))){constructor(...e){super(...e),this.capabilities={operations:{supportsTileMap:!1}},this.copyright=null,this.heightModelInfo=null,this.path=null,this.minScale=void 0,this.maxScale=void 0,this.opacity=1,this.operationalLayerType="ArcGISTiledElevationServiceLayer",this.sourceJSON=null,this.type="elevation",this.url=null,this.version=null,this._lercDecoder=Q7e()}normalizeCtorArgs(e,i){return typeof e=="string"?{url:e,...i}:e}destroy(){this._lercDecoder=ir(this._lercDecoder)}readCapabilities(e,i){const r=i.capabilities&&i.capabilities.split(",").map(n=>n.toLowerCase().trim());return r?{operations:{supportsTileMap:r.includes("tilemap")}}:{operations:{supportsTileMap:!1}}}readVersion(e,i){let r=i.currentVersion;return r||(r=9.3),r}load(e){const i=e!=null?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"],supportsData:!1,validateItem:r=>{for(let n=0;nthis._fetchImageService(i))),Promise.resolve(this)}fetchTile(e,i,r,n){const s=(n=n||{signal:null}).signal!=null?n.signal:n.signal=new AbortController().signal,o={responseType:"array-buffer",signal:s},a={noDataValue:n.noDataValue,returnFileInfo:!0};return this.load().then(()=>this._fetchTileAvailability(e,i,r,n)).then(()=>yi(this.getTileUrl(e,i,r),o)).then(c=>this._lercDecoder.decode(c.data,a,s)).then(c=>new J7e(c))}getTileUrl(e,i,r){const n=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,s=NT({...this.parsedUrl.query,blankTile:!n&&null});return`${this.parsedUrl.path}/tile/${e}/${i}/${r}${s?"?"+s:""}`}async queryElevation(e,i){const{ElevationQuery:r}=await we(()=>Promise.resolve().then(()=>ZV),void 0);return St(i),new r().query(this,e,i)}async createElevationSampler(e,i){const{ElevationQuery:r}=await we(()=>Promise.resolve().then(()=>ZV),void 0);return St(i),new r().createSampler(this,e,i)}_fetchTileAvailability(e,i,r,n){return this.tilemapCache?this.tilemapCache.fetchAvailability(e,i,r,n):Promise.resolve("unknown")}async _fetchImageService(e){var n;if(this.sourceJSON)return this.sourceJSON;const i={query:{f:"json",...this.parsedUrl.query},responseType:"json",signal:e},r=await yi(this.parsedUrl.path,i);r.ssl&&(this.url=(n=this.url)==null?void 0:n.replace(/^http:/i,"https:")),this.sourceJSON=r.data,this.read(r.data,{origin:"service",url:this.parsedUrl})}get hasOverriddenFetchTile(){return!this.fetchTile[Xje]}};y([w({readOnly:!0})],xl.prototype,"capabilities",void 0),y([Rt("service","capabilities",["capabilities"])],xl.prototype,"readCapabilities",null),y([w({json:{read:{source:"copyrightText"}}})],xl.prototype,"copyright",void 0),y([w({readOnly:!0,type:B_})],xl.prototype,"heightModelInfo",void 0),y([w({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],xl.prototype,"path",void 0),y([w({type:["show","hide"]})],xl.prototype,"listMode",void 0),y([w({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],xl.prototype,"minScale",void 0),y([w({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],xl.prototype,"maxScale",void 0),y([w({json:{read:!1,write:!1,origins:{"web-document":{read:!1,write:!1}}}})],xl.prototype,"opacity",void 0),y([w({type:["ArcGISTiledElevationServiceLayer"]})],xl.prototype,"operationalLayerType",void 0),y([w()],xl.prototype,"sourceJSON",void 0),y([w({json:{read:!1},value:"elevation",readOnly:!0})],xl.prototype,"type",void 0),y([w(goe)],xl.prototype,"url",void 0),y([w()],xl.prototype,"version",void 0),y([Rt("version",["currentVersion"])],xl.prototype,"readVersion",null),xl=y([Z("esri.layers.ElevationLayer")],xl);const Xje=Symbol("default-fetch-tile");xl.prototype.fetchTile[Xje]=!0;const Zje=xl,Jje=Object.freeze(Object.defineProperty({__proto__:null,default:Zje},Symbol.toStringTag,{value:"Module"})),NWt=t=>{const e=document.getElementById("opacitySlider");e.addEventListener("calciteSliderInput",()=>{const o=e.value/100;t.map.ground.opacity=o});const i=document.getElementById("navigationUnderground"),r=document.getElementById("elevationInput");i.addEventListener("calciteCheckboxChange",o=>{t.map.ground.navigationConstraint.type=o.target.checked?"none":"stay-above"}),r.addEventListener("calciteCheckboxChange",n);function n(o){t.map.ground.layers.forEach(a=>{a.visible=o.target.checked})}const s=document.getElementById("elevationModels");s.addEventListener("calciteRadioButtonGroupChange",()=>{const o=s.selectedItem.value;t.map.ground.layers.forEach(a=>{a.visible=a.id===o})})},Kje=(t,e)=>new Zje({url:t,title:e,visible:!1}),FWt=t=>{const e=new URL(window.location.href);if(new URLSearchParams(e.search).get("underground")==="true"){const n=document.getElementById("navigationUnderground");n.checked=!0,t.map.ground.navigationConstraint.type="none"}},kWt=t=>{const e=new URL(window.location.href),r=new URLSearchParams(e.search).get("layers");if(r!==null){const n=r.split(",");t.map.allLayers.items.forEach(s=>{n.includes(s.title)&&(s.visible=!s.visible)})}},zWt=t=>{const e=new URL(window.location.href),r=new URLSearchParams(e.search).get("elevation");if(r!==null){const n=r.split(",");n.forEach(s=>{if(s==="Kõrgusmudel"){const o=document.getElementById("dtmElevation");o.checked="false"}else if(s==="Aluspõhi 50m"){const o=document.getElementById("apElevation");o.checked="true"}else if(s==="Aluskord 50m"){const o=document.getElementById("akElevation");o.checked="true"}}),t.map.ground.layers.forEach(s=>{n.includes(s.title)&&(s.visible=!s.visible)})}},UWt=()=>{const t=new URL(window.location.href),i=new URLSearchParams(t.search).get("view");if(i){const[r,n,s,o,a,c,p]=i.split(","),_=parseFloat(r),x=parseFloat(n),S=parseFloat(s),C=parseFloat(o),M=parseFloat(a),P=parseFloat(c),$=parseFloat(p);return[_,x,S,C,M,P,$]}return null},VWt=async t=>{await navigator.clipboard.writeText(t)},BWt=(t,e,i)=>{const r=window.location.href,n=new URL(r.split("?")[0]),s=t.viewpoint,{rotation:o,scale:a}=s,{heading:c,tilt:p}=s.camera,{x:_,y:x,z:S}=s.camera.position,C=new URLSearchParams;if(C.set("view",`${_},${x},${S},${c},${p},${o},${a}`),t.map.ground.navigationConstraint.type==="none"&&C.set("underground","true"),e.length!==0){const M=e.join(",");C.set("layers",M)}if(i.length!==0){const M=i.join(",");C.set("elevation",M)}return n.search=C.toString(),n.toString()},jWt=t=>{const[e,i,r,n,s,o,a]=t;return new nh({camera:new pd({position:new mt({x:e,y:i,z:r,spatialReference:{wkid:3301}}),heading:n,tilt:s}),rotation:o,scale:a})};class GWt{get gl(){return this.rctx.gl}constructor(e){this.view=e,this.camera=new si,this._renderTargetHelper=null}resetWebGLState(){this.rctx!=null&&(this.rctx.enforceState(),this._renderTargetHelper&&this._renderTargetHelper.bindFbo())}bindRenderTarget(){this._renderTargetHelper&&this._renderTargetHelper.framebuffer.initializeAndBind()}}let Zk=class extends gx{constructor(e){super(e),this.produces=new Map([[ke.OPAQUE_MATERIAL,()=>this.renderers.some(i=>typeof i.render=="function")],[ke.TRANSPARENT_MATERIAL,()=>this.renderers.some(i=>typeof i.renderTransparent=="function")]]),this.renderers=new tt,this.context=null}initialize(){this.addHandles([_e(()=>this.view.ready,e=>{e?(this.context=new GWt(this.view),this.view._stage.addRenderPlugin(this)):(this.renderers.forEach(i=>hA(i,"dispose",this.context)),this.context=null)},Qt)])}destroy(){var e;this.renderers.drain(i=>{this.context&&hA(i,"dispose",this.context)}),(e=this.view._stage)==null||e.removeRenderPlugin(this),this.context=null}add(e){this.renderers.includes(e)?Ce.getLogger("esri.views.3d.externalRenderers.ExternalRendererStore").warn("add(): Cannot add external renderer: renderer has already been added"):(this.renderers.add(e),this.context&&(this._webglStateReset(),hA(e,"setup",this.context),this.view._stage.renderView.requestRender()))}remove(e){const i=this.renderers.indexOf(e);i!==-1&&(this.renderers.removeAt(i),this.context&&(hA(e,"dispose",this.context),this.view._stage.renderView.requestRender()))}initializeRenderContext(e){this.context.rctx=e.renderContext.rctx,this.renderers.length>0&&this._webglStateReset(),this.renderers.forEach(i=>hA(i,"setup",this.context))}uninitializeRenderContext(){}renderNode(e){if(this.renderers.length===0||e.output!==ue.Color)return;const i=r=>{this._updateContext(e),this._webglStateReset(),this.renderers.forEach(n=>hA(n,r,this.context))};e.bindParameters.slot===ke.OPAQUE_MATERIAL?i("render"):i("renderTransparent")}_updateContext(e){this.context.camera.copyFrom(e.bindParameters.camera),this.context.sunLight=e.bindParameters.lighting.legacy,this.context._renderTargetHelper=e.offscreenRenderingHelper}_webglStateReset(){var e;this.context.rctx.resetState(),(e=this.context._renderTargetHelper)==null||e.bindFbo()}};function hA(t,e,i){var r;typeof t[e]=="function"&&i!=null&&((r=t[e])==null||r.call(t,i))}y([w({constructOnly:!0})],Zk.prototype,"view",void 0),Zk=y([Z("esri.views.3d.externalRenderers.StageRenderer")],Zk);let HWt=class{constructor(){this._renderers=new tt}add(e,i){let r=this._findStageRenderer(e);r||(r=new Zk({view:e}),this._renderers.add(r)),r.add(i)}remove(e,i){const r=this._findStageRenderer(e);r&&(r.remove(i),r.renderers.length===0&&(r.destroy(),this._renderers.remove(r)))}_findStageRenderer(e){return this._renderers.find(i=>i.view===e)}};const qWt=new HWt;function WWt(t,e){qWt.add(t,e)}function YWt(t){t._stage.renderView.requestRender()}function XWt(t,e,i,r,n,s,o){return r=r||t.spatialReference,un(e,r,i,n,t.renderCoordsHelper.spatialReference,s,o)?n:null}function ZWt(t,e,i,r){return r||(r=Qe()),i=i||t.spatialReference,Ac(i,e,r,t.renderCoordsHelper.spatialReference)?r:null}function Qje(t){const e={};for(const i in t){if(i==="declaredClass")continue;const r=t[i];if(r!=null&&typeof r!="function")if(Array.isArray(r)){e[i]=[];for(let n=0;n>3,this._dataType=7&i,!e||e===this._tag)break;this.skip()}return!0}next(){if(this._pos===this._end)return!1;const e=this._decodeVarint();return this._tag=e>>3,this._dataType=7&e,!0}empty(){return this._pos>=this._end}tag(){return this._tag}getInt32(){return this._decodeVarint()}getInt64(){return this._decodeVarint()}getUInt32(){let e=4294967295;return e=(127&this._data[this._pos])>>>0,this._data[this._pos++]<128?e:(e=(e|(127&this._data[this._pos])<<7)>>>0,this._data[this._pos++]<128?e:(e=(e|(127&this._data[this._pos])<<14)>>>0,this._data[this._pos++]<128?e:(e=(e|(127&this._data[this._pos])<<21)>>>0,this._data[this._pos++]<128?e:(e=(e|(15&this._data[this._pos])<<28)>>>0,this._data[this._pos++]<128?e:void 0))))}getUInt64(){return this._decodeVarint()}getSInt32(){const e=this.getUInt32();if(e!==void 0)return e>>>1^-(1&e)|0}getSInt64(){return this._decodeSVarint()}getBool(){const e=this._data[this._pos]!==0;return this._skip(1),e}getEnum(){return this._decodeVarint()}getFixed64(){const e=this._dataView,i=this._pos,r=e.getUint32(i,!0)+e.getUint32(i+4,!0)*B3e;return this._skip(8),r}getSFixed64(){const e=this._dataView,i=this._pos,r=e.getUint32(i,!0)+e.getInt32(i+4,!0)*B3e;return this._skip(8),r}getDouble(){const e=this._dataView.getFloat64(this._pos,!0);return this._skip(8),e}getFixed32(){const e=this._dataView.getUint32(this._pos,!0);return this._skip(4),e}getSFixed32(){const e=this._dataView.getInt32(this._pos,!0);return this._skip(4),e}getFloat(){const e=this._dataView.getFloat32(this._pos,!0);return this._skip(4),e}getString(){const e=this._getLength(),i=this._pos,r=this._toString(this._data,i,i+e);return this._skip(e),r}getBytes(){const e=this._getLength(),i=this._pos,r=this._toBytes(this._data,i,i+e);return this._skip(e),r}getLength(){return this._getLengthUnsafe()}processMessageWithArgs(e,i,r,n){const s=this.getMessage(),o=e(s,i,r,n);return s.release(),o}processMessage(e){const i=this.getMessage(),r=e(i);return i.release(),r}getMessage(){const e=this._getLength(),i=Jk.pool.acquire();return i._init(this._data,this._dataView,this._pos,this._pos+e),this._skip(e),i}release(){Jk.pool.release(this)}dataType(){return this._dataType}skip(){switch(this._dataType){case qw.varint:this._decodeVarint();break;case qw.fixed64:this._skip(8);break;case qw.delimited:this._skip(this._getLength());break;case qw.fixed32:this._skip(4);break;default:throw new Error("Invalid data type!")}}skipLen(e){this._skip(e)}_skip(e){if(this._pos+e>this._end)throw new Error("Attempt to skip past the end of buffer!");this._pos+=e}_decodeVarint(){const e=this._data;let i=this._pos,r=0,n=0;if(this._end-i>=10)do{if(n=e[i++],r|=127&n,(128&n)==0||(n=e[i++],r|=(127&n)<<7,(128&n)==0)||(n=e[i++],r|=(127&n)<<14,(128&n)==0)||(n=e[i++],r|=(127&n)<<21,(128&n)==0)||(n=e[i++],r+=268435456*(127&n),(128&n)==0)||(n=e[i++],r+=34359738368*(127&n),(128&n)==0)||(n=e[i++],r+=4398046511104*(127&n),(128&n)==0)||(n=e[i++],r+=562949953421312*(127&n),(128&n)==0)||(n=e[i++],r+=72057594037927940*(127&n),(128&n)==0)||(n=e[i++],r+=9223372036854776e3*(127&n),(128&n)==0))break;throw new Error("Varint too long!")}while(!1);else{let s=1;for(;i!==this._end&&(n=e[i],(128&n)!=0);)++i,r+=(127&n)*s,s*=128;if(i===this._end)throw new Error("Varint overrun!");++i,r+=n*s}return this._pos=i,r}_decodeSVarint(){const e=this._data;let i,r=0,n=0;const s=1&e[this._pos];if(n=e[this._pos++],r|=127&n,(128&n)==0||(n=e[this._pos++],r|=(127&n)<<7,(128&n)==0)||(n=e[this._pos++],r|=(127&n)<<14,(128&n)==0)||(n=e[this._pos++],r|=(127&n)<<21,(128&n)==0)||(n=e[this._pos++],r+=268435456*(127&n),(128&n)==0)||(n=e[this._pos++],r+=34359738368*(127&n),(128&n)==0)||(n=e[this._pos++],r+=4398046511104*(127&n),(128&n)==0))return s?-(r+1)/2:r/2;if(i=BigInt(r),n=e[this._pos++],i+=0x2000000000000n*BigInt(127&n),(128&n)==0||(n=e[this._pos++],i+=0x100000000000000n*BigInt(127&n),(128&n)==0)||(n=e[this._pos++],i+=0x8000000000000000n*BigInt(127&n),(128&n)==0))return Number(s?-(i+1n)/2n:i/2n);throw new Error("Varint too long!")}_getLength(){if(this._dataType!==qw.delimited)throw new Error("Not a delimited data type!");return this._decodeVarint()}_getLengthUnsafe(){return this.getUInt32()}_toString(e,i,r){if((r=Math.min(this._end,r))-i>KWt){const o=e.subarray(i,r);return JWt.decode(o)}let n="",s="";for(let o=i;o{t._data=null,t._dataView=null});const eGe=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"];let Kvi=class{constructor(e){this._options=e,this.geometryTypes=eGe,this._coordinatePtr=0,this._vertexDimension=0}createFeatureResult(){return new UDe}prepareFeatures(e){this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++}finishFeatureResult(e){if(!(e!=null&&e.features)||!e.hasZ||!this._options.sourceSpatialReference||!e.spatialReference||jn(e.spatialReference,this._options.sourceSpatialReference)||e.spatialReference.vcsWkid)return;const i=ad(this._options.sourceSpatialReference)/ad(e.spatialReference);if(i!==1)for(const r of e.features){if(!O3t(r))continue;const n=r.geometry.coords;for(let s=2;si+r,0)*this._vertexDimension,this._coordinatePtr=0}addCoordinate(e,i){e.coords[this._coordinatePtr++]=i}addCoordinatePoint(e,i){e.coords.push(i)}addLength(e,i){e.lengths.push(i)}addQueryGeometry(e,i){e.queryGeometry=i.queryGeometry,e.queryGeometryType=i.queryGeometryType}createPointGeometry(){return new Bm}};const j3e=["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeString","esriFieldTypeDate","esriFieldTypeOID","esriFieldTypeGeometry","esriFieldTypeBlob","esriFieldTypeRaster","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeXML","esriFieldTypeBigInteger","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"],G3e=["sqlTypeBigInt","sqlTypeBinary","sqlTypeBit","sqlTypeChar","sqlTypeDate","sqlTypeDecimal","sqlTypeDouble","sqlTypeFloat","sqlTypeGeometry","sqlTypeGUID","sqlTypeInteger","sqlTypeLongNVarchar","sqlTypeLongVarbinary","sqlTypeLongVarchar","sqlTypeNChar","sqlTypeNVarchar","sqlTypeOther","sqlTypeReal","sqlTypeSmallInt","sqlTypeSqlXml","sqlTypeTime","sqlTypeTimestamp","sqlTypeTimestamp2","sqlTypeTinyInt","sqlTypeVarbinary","sqlTypeVarchar"],H3e=["upperLeft","lowerLeft"];function q3e(t){return t>=j3e.length?null:j3e[t]}function QWt(t){return t>=G3e.length?null:G3e[t]}function W3e(t){return t>=H3e.length?null:H3e[t]}function Y3e(t,e){return e>=t.geometryTypes.length?null:t.geometryTypes[e]}function eYt(t,e,i){const n=t.asUnsafe(),s=e.createPointGeometry(i);for(;n.next();)switch(n.tag()){case 3:{const o=n.getUInt32(),a=n.pos()+o;let c=0;for(;n.pos()0)for(let i=0;iMath.round((p-r)/e),o=p=>Math.round((n-p)/i),a=this.features,c=this._getQuantizationFunction(this.geometryType,s,o);for(let p=0,_=a.length;p<_;p++)c!=null&&c(a[p].geometry)||(a.splice(p,1),p--,_--);return this.transform=t,this}unquantize(){var S,C;const{geometryType:t,features:e,transform:i}=this;if(!i)return this;const{translate:[r,n],scale:[s,o]}=i,a=M=>M*s+r,c=M=>n-M*o;let p=null,_=null;if(this.hasZ&&((S=i==null?void 0:i.scale)==null?void 0:S[2])!=null){const{translate:[,,M],scale:[,,P]}=i;p=$=>$*P+M}if(this.hasM&&((C=i==null?void 0:i.scale)==null?void 0:C[3])!=null){const{translate:[,,,M],scale:[,,,P]}=i;_=$=>$==null?$:$*P+M}const x=this._getHydrationFunction(t,a,c,p,_);for(const{geometry:M}of e)M!=null&&x&&x(M);return this.transform=null,this}_quantizePoints(t,e,i){let r,n;const s=[];for(let o=0,a=t.length;o0){const p=e(c[0]),_=i(c[1]);p===r&&_===n||(s.push([p-r,_-n]),r=p,n=_)}else r=e(c[0]),n=i(c[1]),s.push([r,n])}return s.length>0?s:null}_getQuantizationFunction(t,e,i){return t==="point"?r=>(r.x=e(r.x),r.y=i(r.y),r):t==="polyline"||t==="polygon"?r=>{const n=gT(r)?r.rings:r.paths,s=[];for(let o=0,a=n.length;o0?(gT(r)?r.rings=s:r.paths=s,r):null}:t==="multipoint"?r=>{const n=this._quantizePoints(r.points,e,i);return n&&n.length>0?(r.points=n,r):null}:t==="extent"?r=>r:null}_getHydrationFunction(t,e,i,r,n){return t==="point"?s=>{s.x=e(s.x),s.y=i(s.y),r&&(s.z=r(s.z))}:t==="polyline"||t==="polygon"?s=>{const o=gT(s)?s.rings:s.paths;let a,c;for(let p=0,_=o.length;p<_;p++){const x=o[p];for(let S=0,C=x.length;S0?(a+=M[0],c+=M[1]):(a=M[0],c=M[1]),M[0]=e(a),M[1]=i(c)}}if(r&&n)for(let p=0,_=o.length;p<_;p++){const x=o[p];for(let S=0,C=x.length;S{s.xmin=e(s.xmin),s.ymin=i(s.ymin),s.xmax=e(s.xmax),s.ymax=i(s.ymax),r&&s.zmax!=null&&s.zmin!=null&&(s.zmax=r(s.zmax),s.zmin=r(s.zmin)),n&&s.mmax!=null&&s.mmin!=null&&(s.mmax=n(s.mmax),s.mmin=n(s.mmin))}:t==="multipoint"?s=>{const o=s.points;let a,c;for(let p=0,_=o.length;p<_;p++){const x=o[p];p>0?(a+=x[0],c+=x[1]):(a=x[0],c=x[1]),x[0]=e(a),x[1]=i(c)}if(r&&n)for(let p=0,_=o.length;p<_;p++){const x=o[p];x[2]=r(x[2]),x[3]=n(x[3])}else if(r)for(let p=0,_=o.length;p<_;p++){const x=o[p];x[2]=r(x[2])}else if(n)for(let p=0,_=o.length;p<_;p++){const x=o[p];x[2]=n(x[2])}}:null}};y([w({type:String,json:{write:!0}})],Vl.prototype,"displayFieldName",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Vl.prototype,"exceededTransferLimit",void 0),y([w({type:[Ma],json:{write:!0}})],Vl.prototype,"features",void 0),y([Rt("features")],Vl.prototype,"readFeatures",null),y([w({type:[nj],json:{write:!0}})],Vl.prototype,"fields",void 0),y([w({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:nne.read}}})],Vl.prototype,"geometryType",void 0),y([Et("geometryType")],Vl.prototype,"writeGeometryType",null),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Vl.prototype,"hasM",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Vl.prototype,"hasZ",void 0),y([w({types:dE,json:{write:!0}})],Vl.prototype,"queryGeometry",void 0),y([Rt("queryGeometry")],Vl.prototype,"readQueryGeometry",null),y([w({type:rt,json:{write:!0}})],Vl.prototype,"spatialReference",void 0),y([Et("spatialReference")],Vl.prototype,"writeSpatialReference",null),y([w({json:{write:!0}})],Vl.prototype,"transform",void 0),Vl=rne=y([Z("esri.rest.support.FeatureSet")],Vl),Vl.prototype.toJSON.isDefaultToJSON=!0;const xYt=Vl;async function SYt(t,e,i){const r=await TYt(t,e,i);return xYt.fromJSON(r)}async function TYt(t,e,i){const r=F5(t),n={...i},s=Wm.from(e),{data:o}=await _Yt(r,s,s.sourceSpatialReference,n);return o}function EYt(t){const{exifInfo:e,exifName:i,tagName:r}=t;if(!e||!i||!r)return null;const n=e.find(s=>s.name===i);return n?CYt({tagName:r,tags:n.tags}):null}function CYt(t){const{tagName:e,tags:i}=t;if(!i||!e)return null;const r=i.find(n=>n.name===e);return(r==null?void 0:r.value)||null}var sne;const AYt={1:{id:1,rotation:0,mirrored:!1},2:{id:2,rotation:0,mirrored:!0},3:{id:3,rotation:180,mirrored:!1},4:{id:4,rotation:180,mirrored:!0},5:{id:5,rotation:-90,mirrored:!0},6:{id:6,rotation:90,mirrored:!1},7:{id:7,rotation:90,mirrored:!0},8:{id:8,rotation:-90,mirrored:!1}};let Mh=sne=class extends Ue{constructor(t){super(t),this.contentType=null,this.exifInfo=null,this.id=null,this.globalId=null,this.keywords=null,this.name=null,this.parentGlobalId=null,this.parentObjectId=null,this.size=null,this.url=null}get orientationInfo(){const{exifInfo:t}=this,e=EYt({exifName:"Exif IFD0",tagName:"Orientation",exifInfo:t});return AYt[e]||null}clone(){return new sne({contentType:this.contentType,exifInfo:this.exifInfo,id:this.id,globalId:this.globalId,keywords:this.keywords,name:this.name,parentGlobalId:this.parentGlobalId,parentObjectId:this.parentObjectId,size:this.size,url:this.url})}};y([w({type:String})],Mh.prototype,"contentType",void 0),y([w()],Mh.prototype,"exifInfo",void 0),y([w({readOnly:!0})],Mh.prototype,"orientationInfo",null),y([w({type:_n})],Mh.prototype,"id",void 0),y([w({type:String})],Mh.prototype,"globalId",void 0),y([w({type:String})],Mh.prototype,"keywords",void 0),y([w({type:String})],Mh.prototype,"name",void 0),y([w({json:{read:!1}})],Mh.prototype,"parentGlobalId",void 0),y([w({json:{read:!1}})],Mh.prototype,"parentObjectId",void 0),y([w({type:_n})],Mh.prototype,"size",void 0),y([w({json:{read:!1}})],Mh.prototype,"url",void 0),Mh=sne=y([Z("esri.layers.support.AttachmentInfo")],Mh);const n_i=Mh;var one;let CM=one=class extends Ue{constructor(t){super(t),this.groupByFields=void 0,this.topCount=void 0,this.orderByFields=void 0}clone(){return new one({groupByFields:this.groupByFields,topCount:this.topCount,orderByFields:this.orderByFields})}};y([w({type:[String],json:{write:!0}})],CM.prototype,"groupByFields",void 0),y([w({type:Number,json:{write:!0}})],CM.prototype,"topCount",void 0),y([w({type:[String],json:{write:!0}})],CM.prototype,"orderByFields",void 0),CM=one=y([Z("esri.rest.support.TopFilter")],CM);const MYt=CM;var ane;const Z3e=new tn({esriSpatialRelIntersects:"intersects",esriSpatialRelContains:"contains",esriSpatialRelCrosses:"crosses",esriSpatialRelDisjoint:"disjoint",esriSpatialRelEnvelopeIntersects:"envelope-intersects",esriSpatialRelIndexIntersects:"index-intersects",esriSpatialRelOverlaps:"overlaps",esriSpatialRelTouches:"touches",esriSpatialRelWithin:"within",esriSpatialRelRelation:"relation"}),J3e=new tn({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"});let Ks=ane=class extends Ue{constructor(t){super(t),this.cacheHint=void 0,this.distance=void 0,this.geometry=null,this.geometryPrecision=void 0,this.maxAllowableOffset=void 0,this.num=void 0,this.objectIds=null,this.orderByFields=null,this.outFields=null,this.outSpatialReference=null,this.resultType=null,this.returnGeometry=!1,this.returnM=void 0,this.returnZ=void 0,this.start=void 0,this.spatialRelationship="intersects",this.timeExtent=null,this.topFilter=void 0,this.units=null,this.where="1=1"}writeStart(t,e){e.resultOffset=this.start,e.resultRecordCount=this.num||10}clone(){return new ane(Pe({cacheHint:this.cacheHint,distance:this.distance,geometry:this.geometry,geometryPrecision:this.geometryPrecision,maxAllowableOffset:this.maxAllowableOffset,num:this.num,objectIds:this.objectIds,orderByFields:this.orderByFields,outFields:this.outFields,outSpatialReference:this.outSpatialReference,resultType:this.resultType,returnGeometry:this.returnGeometry,returnZ:this.returnZ,returnM:this.returnM,start:this.start,spatialRelationship:this.spatialRelationship,timeExtent:this.timeExtent,topFilter:this.topFilter,units:this.units,where:this.where}))}};y([w({type:Boolean,json:{write:!0}})],Ks.prototype,"cacheHint",void 0),y([w({type:Number,json:{write:{overridePolicy:t=>({enabled:t>0})}}})],Ks.prototype,"distance",void 0),y([w({types:dE,json:{read:Wy,write:!0}})],Ks.prototype,"geometry",void 0),y([w({type:Number,json:{write:!0}})],Ks.prototype,"geometryPrecision",void 0),y([w({type:Number,json:{write:!0}})],Ks.prototype,"maxAllowableOffset",void 0),y([w({type:Number,json:{read:{source:"resultRecordCount"}}})],Ks.prototype,"num",void 0),y([w({json:{write:!0}})],Ks.prototype,"objectIds",void 0),y([w({type:[String],json:{write:!0}})],Ks.prototype,"orderByFields",void 0),y([w({type:[String],json:{write:!0}})],Ks.prototype,"outFields",void 0),y([w({type:rt,json:{read:{source:"outSR"},write:{target:"outSR"}}})],Ks.prototype,"outSpatialReference",void 0),y([w({type:String,json:{write:!0}})],Ks.prototype,"resultType",void 0),y([w({json:{write:!0}})],Ks.prototype,"returnGeometry",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Ks.prototype,"returnM",void 0),y([w({type:Boolean,json:{write:{overridePolicy:t=>({enabled:t})}}})],Ks.prototype,"returnZ",void 0),y([w({type:Number,json:{read:{source:"resultOffset"}}})],Ks.prototype,"start",void 0),y([Et("start"),Et("num")],Ks.prototype,"writeStart",null),y([w({type:String,json:{read:{source:"spatialRel",reader:Z3e.read},write:{target:"spatialRel",writer:Z3e.write}}})],Ks.prototype,"spatialRelationship",void 0),y([w({type:f1,json:{write:!0}})],Ks.prototype,"timeExtent",void 0),y([w({type:MYt,json:{write:!0}})],Ks.prototype,"topFilter",void 0),y([w({type:String,json:{read:J3e.read,write:{writer:J3e.write,overridePolicy(t){return{enabled:t!=null&&this.distance!=null&&this.distance>0}}}}})],Ks.prototype,"units",void 0),y([w({type:String,json:{write:!0}})],Ks.prototype,"where",void 0),Ks=ane=y([Z("esri.rest.support.TopFeaturesQuery")],Ks),Ks.from=_s(Ks);const s_i=Ks;var K3e=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function OYt(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function Q3e(t,e){var i=e[0],r=e[1],n=e[2],s=e[3],o=e[4],a=e[5],c=e[6],p=e[7],_=e[8],x=e[9],S=e[10],C=e[11],M=e[12],P=e[13],$=e[14],F=e[15],z=i*a-r*o,k=i*c-n*o,U=i*p-s*o,j=r*c-n*a,G=r*p-s*a,Y=n*p-s*c,Q=_*P-x*M,ne=_*$-S*M,ie=_*F-C*M,he=x*$-S*P,ce=x*F-C*P,ve=S*F-C*$,ge=z*ve-k*ce+U*he+j*ie-G*ne+Y*Q;return ge?(ge=1/ge,t[0]=(a*ve-c*ce+p*he)*ge,t[1]=(c*ie-o*ve-p*ne)*ge,t[2]=(o*ce-a*ie+p*Q)*ge,t[3]=(n*ce-r*ve-s*he)*ge,t[4]=(i*ve-n*ie+s*ne)*ge,t[5]=(r*ie-i*ce-s*Q)*ge,t[6]=(P*Y-$*G+F*j)*ge,t[7]=($*U-M*Y-F*k)*ge,t[8]=(M*G-P*U+F*z)*ge,t):null}function QX(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function y7(t,e,i){var r=e[0],n=e[1],s=e[2],o=e[3],a=e[4],c=e[5],p=e[6],_=e[7],x=e[8],S=e[9],C=e[10],M=e[11],P=e[12],$=e[13],F=e[14],z=e[15],k=i[0],U=i[1],j=i[2],G=i[3];return t[0]=k*r+U*a+j*x+G*P,t[1]=k*n+U*c+j*S+G*$,t[2]=k*s+U*p+j*C+G*F,t[3]=k*o+U*_+j*M+G*z,k=i[4],U=i[5],j=i[6],G=i[7],t[4]=k*r+U*a+j*x+G*P,t[5]=k*n+U*c+j*S+G*$,t[6]=k*s+U*p+j*C+G*F,t[7]=k*o+U*_+j*M+G*z,k=i[8],U=i[9],j=i[10],G=i[11],t[8]=k*r+U*a+j*x+G*P,t[9]=k*n+U*c+j*S+G*$,t[10]=k*s+U*p+j*C+G*F,t[11]=k*o+U*_+j*M+G*z,k=i[12],U=i[13],j=i[14],G=i[15],t[12]=k*r+U*a+j*x+G*P,t[13]=k*n+U*c+j*S+G*$,t[14]=k*s+U*p+j*C+G*F,t[15]=k*o+U*_+j*M+G*z,t}function eSe(t,e,i){var r=i[0],n=i[1],s=i[2],o,a,c,p,_,x,S,C,M,P,$,F;return e===t?(t[12]=e[0]*r+e[4]*n+e[8]*s+e[12],t[13]=e[1]*r+e[5]*n+e[9]*s+e[13],t[14]=e[2]*r+e[6]*n+e[10]*s+e[14],t[15]=e[3]*r+e[7]*n+e[11]*s+e[15]):(o=e[0],a=e[1],c=e[2],p=e[3],_=e[4],x=e[5],S=e[6],C=e[7],M=e[8],P=e[9],$=e[10],F=e[11],t[0]=o,t[1]=a,t[2]=c,t[3]=p,t[4]=_,t[5]=x,t[6]=S,t[7]=C,t[8]=M,t[9]=P,t[10]=$,t[11]=F,t[12]=o*r+_*n+M*s+e[12],t[13]=a*r+x*n+P*s+e[13],t[14]=c*r+S*n+$*s+e[14],t[15]=p*r+C*n+F*s+e[15]),t}function PYt(t,e,i){var r=i[0],n=i[1],s=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function RYt(t,e,i){var r=Math.sin(i),n=Math.cos(i),s=e[0],o=e[1],a=e[2],c=e[3],p=e[8],_=e[9],x=e[10],S=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*n-p*r,t[1]=o*n-_*r,t[2]=a*n-x*r,t[3]=c*n-S*r,t[8]=s*r+p*n,t[9]=o*r+_*n,t[10]=a*r+x*n,t[11]=c*r+S*n,t}function tSe(t,e,i){var r=Math.sin(i),n=Math.cos(i),s=e[0],o=e[1],a=e[2],c=e[3],p=e[4],_=e[5],x=e[6],S=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*n+p*r,t[1]=o*n+_*r,t[2]=a*n+x*r,t[3]=c*n+S*r,t[4]=p*n-s*r,t[5]=_*n-o*r,t[6]=x*n-a*r,t[7]=S*n-c*r,t}function tGe(){var t=new K3e(3);return K3e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function IYt(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function $Yt(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function LYt(t,e){var i=e[0],r=e[1],n=e[2],s=i*i+r*r+n*n;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function DYt(t,e,i){var r=e[0],n=e[1],s=e[2],o=i[3]*r+i[7]*n+i[11]*s+i[15];return o=o||1,t[0]=(i[0]*r+i[4]*n+i[8]*s+i[12])/o,t[1]=(i[1]*r+i[5]*n+i[9]*s+i[13])/o,t[2]=(i[2]*r+i[6]*n+i[10]*s+i[14])/o,t}function NYt(t,e,i){var r=e[0],n=e[1],s=e[2];return t[0]=r*i[0]+n*i[3]+s*i[6],t[1]=r*i[1]+n*i[4]+s*i[7],t[2]=r*i[2]+n*i[5]+s*i[8],t}var v7=function(){var t=tGe();return function(e,i,r,n,s,o){var a,c;for(i||(i=3),r||(r=0),n?c=Math.min(n*i+r,e.length):c=e.length,a=r;a{const t="https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/weather_stations_010417/FeatureServer/0/query",e=new Wm;e.returnGeometry=!0,e.outFields=["WIND_DIRECT","WIND_SPEED"],e.where="STATION_NAME = 'Amari Air Base'";const i=await SYt(t,e);return{direction:i.features[0].getAttribute("WIND_DIRECT")||0,speed:i.features[0].getAttribute("WIND_SPEED")||0}},UYt=async t=>{const e="https://gsavalik.envir.ee/geoserver/wfs?typename=etak:e_602_tehnopaigaldis_p&service=wfs&srs=EPSG:3301&request=getfeature&outputformat=json&cql_filter=tyyp=20 AND korgus IS NOT NULL";try{const i=await fetch(e);if(!i.ok)throw new Error("Network response was not ok.");const r=await i.json();let n;t.map.ground.layers.forEach(a=>{a.title==="Kõrgusmudel"&&(n=a)}),console.log("Start here",r.features);let s=[];const o=r.features.map(async a=>{const c=new mt({x:a.geometry.coordinates[0],y:a.geometry.coordinates[1],spatialReference:{wkid:3301}}),_=await(async x=>{try{return(await n.queryElevation(x)).geometry.z}catch(S){throw console.error("Error retrieving elevation:",S),S}})(c);a.geometry.coordinates.push(_),s.push(a)});return await Promise.all(o),console.log("Ended here",s),s}catch(i){throw console.error("Error fetching data:",i),i}},VYt=t=>vy([zYt(),UYt(t)]).then(e=>{const i=e[0].value,r=e[1].value;require(["esri/core/Accessor"],n=>{const s=n.createSubclass({wind:null,stations:null,view:null,numStations:null,localOrigin:null,localOriginRender:null,vboBasePositions:null,vboBaseNormals:null,iboBase:null,vboBladesPositions:null,vboBladesNormals:null,iboBlades:null,windmillBasePositions:null,windmillBaseNormals:null,windmillBaseIndices:null,windmillBladesPositions:null,windmillBladesNormals:null,windmillBladesIndices:null,program:null,programAttribVertexPosition:null,programAttribVertexNormal:null,programUniformProjectionMatrix:null,programUniformModelViewMatrix:null,programUniformNormalMatrix:null,programUniformAmbientColor:null,programUniformLightingDirection:null,programUniformDirectionalColor:null,windmillInstanceWindSpeed:null,windmillInstanceRPM:null,windmillInstanceWindDirection:null,windmillInstanceTowerScale:null,windmillInstanceBladeScale:null,windmillInstanceBladeOffset:null,windmillInstanceInputToRender:null,tempMatrix4:new Float32Array(16),tempMatrix3:new Float32Array(9),tempVec3:new Float32Array(3),constructor(a,c,p){this.view=a,this.wind=c,this.stations=p},setup(a){this.initShaders(a),this.initData(a,this.wind,this.stations),a.resetWebGLState()},render(a){const c=a.gl,p=Date.now()/1e3;c.enable(c.DEPTH_TEST),c.disable(c.CULL_FACE),c.disable(c.BLEND),c.useProgram(this.program),this.setCommonUniforms(a),this.bindWindmillBase(a),QX(this.tempMatrix4),eSe(this.tempMatrix4,this.tempMatrix4,this.localOriginRender),y7(this.tempMatrix4,a.camera.viewMatrix,this.tempMatrix4),c.uniformMatrix4fv(this.programUniformModelViewMatrix,!1,this.tempMatrix4),OYt(this.tempMatrix3),c.uniformMatrix3fv(this.programUniformNormalMatrix,!1,this.tempMatrix3),c.drawElements(c.TRIANGLES,this.windmillBaseIndices.length,c.UNSIGNED_SHORT,0),this.bindWindmillBlades(a);for(let _=0;_{console.log(e)}),iGe=Qct(),BYt=eut("66e382030b224ffa999249a4d1cbbf4f","Sidemastid"),jYt=tut(),rGe=lUe("92d29869db444e28beab584f696b86c3",iGe,jYt),GYt=lUe("da15a55042b54c31b0208ba98c1647fc"),HYt=cUe(GYt),qYt=Kje("https://tiles.arcgis.com/tiles/ZYGCYltwz5ExeoGm/arcgis/rest/services/APR_50m_Eesti_tif/ImageServer","Aluspõhi 50m"),WYt=Kje("https://tiles.arcgis.com/tiles/ZYGCYltwz5ExeoGm/arcgis/rest/services/AKR_50m_2/ImageServer","Aluskord 50m"),wr=cUe(rGe);wr.when(()=>{const t=rut(HYt),e=t.items.find(G=>G.title==="Puurkaevud/puuraugud"),i=t.items.find(G=>G.title==="Ehitusgeoloogia"),r=t.items.find(G=>G.title==="Geoloogia WMS");r.visible=!1,wr.map.ground.layers.addMany([qYt,WYt]);const{description:n}=rGe.portalItem,s=document.querySelector("#item-description");s.innerHTML=n,wr.ui.move("zoom","top-right"),wr.ui.move("navigation-toggle","top-right"),wr.ui.move("compass","top-right"),hVt();const o=Hfe("Taimkate","exclusive");iut(o,wr),wr.map.add(o);const a=TUt(wr);wxe(a,wr);const c=EUt(wr);wxe(c,wr);const p=CUt(wr);AUt(p,wr),sut(p,wr);const _=Hfe("Geoloogia","independent");_.addMany([e,i]),wr.map.add(_),wr.map.add(r),NWt(wr);const x=nVt(wr),S=sVt();x.formats.add(S),x.conversions.splice(0,0,new YS({format:S})),wr.ui.add(x,"bottom-right"),uVt(wr);const C=ajt();ljt(wr,C),eqt(wr),tWt(wr),nWt(wr),SWt(wr);const M=RWt(wr);wr.ui.add(M,"top-right"),CGt(wr,iGe),VYt(wr),wr.map.reorder(o,6),wr.map.reorder(_,6),wr.map.reorder(r,-1),wr.map.findLayerById("180fa46104d-layer-35").add(BYt);const $=qfe(wr),F=bWt(wr);let z;const k=({target:G})=>{if(G.tagName!=="CALCITE-ACTION")return;z&&(document.querySelector(`[data-action-id=${z}]`).active=!1,document.querySelector(`[data-panel-id=${z}]`).hidden=!0);const Y=G.dataset.actionId;if(Y!==z?(document.querySelector(`[data-action-id=${Y}]`).active=!0,document.querySelector(`[data-panel-id=${Y}]`).hidden=!1,z=Y):z=null,Y==="shadowCast"&&(F.visible=!F.visible),Y==="share"){const Q=qfe(wr),[ne,ie]=nut($,Q);console.log(ne),console.log(ie);const he=BWt(wr,ne,ie);VWt(he);const ce=document.getElementById("share-map-alert");ce.open="true"}};document.querySelector("calcite-action-bar").addEventListener("click",k);let U=!1;document.addEventListener("calciteActionBarToggle",G=>{U=!U,wr.padding={left:U?135:49}});const j=UWt();if(FWt(wr),kWt(wr),zWt(wr),j!==null){const G=jWt(j);wr.goTo(G,{animate:!1})}});const YYt=Object.freeze(Object.defineProperty({__proto__:null,betaRayleigh:wO,build:B4e},Symbol.toStringTag,{value:"Module"})),XYt=Object.freeze(Object.defineProperty({__proto__:null,AtmosphereCompositingPassParameters:Iae,build:l$e},Symbol.toStringTag,{value:"Module"})),ZYt=Object.freeze(Object.defineProperty({__proto__:null,build:m$e},Symbol.toStringTag,{value:"Module"})),JYt=Object.freeze(Object.defineProperty({__proto__:null,CloudsDrawParameters:zae,CloudsPassParameters:kae,build:x$e},Symbol.toStringTag,{value:"Module"})),KYt=Object.freeze(Object.defineProperty({__proto__:null,NoiseTextureAtlasPassParameters:Uae,build:E$e},Symbol.toStringTag,{value:"Module"})),QYt=Object.freeze(Object.defineProperty({__proto__:null,FogPassParameters:Bae,build:U$e},Symbol.toStringTag,{value:"Module"})),eXt=Object.freeze(Object.defineProperty({__proto__:null,SilhouetteCircle:Hae,SimpleAtmospherePassParameters:Bj,build:Y$e},Symbol.toStringTag,{value:"Module"})),tXt=Object.freeze(Object.defineProperty({__proto__:null,build:bLe},Symbol.toStringTag,{value:"Module"})),iXt=Object.freeze(Object.defineProperty({__proto__:null,build:SLe},Symbol.toStringTag,{value:"Module"})),rXt=Object.freeze(Object.defineProperty({__proto__:null,build:l6e,calculateAnchorPosForRendering:qL},Symbol.toStringTag,{value:"Module"})),nXt=Object.freeze(Object.defineProperty({__proto__:null,build:eDe},Symbol.toStringTag,{value:"Module"})),sXt=Object.freeze(Object.defineProperty({__proto__:null,build:rDe,getRadius:yG},Symbol.toStringTag,{value:"Module"})),oXt=Object.freeze(Object.defineProperty({__proto__:null,build:lDe},Symbol.toStringTag,{value:"Module"})),aXt=Object.freeze(Object.defineProperty({__proto__:null,build:uDe},Symbol.toStringTag,{value:"Module"})),lXt=Object.freeze(Object.defineProperty({__proto__:null,build:EDe},Symbol.toStringTag,{value:"Module"})),cXt=Object.freeze(Object.defineProperty({__proto__:null,build:CNe,ribbonlineNumRoundJoinSubdivisions:KL},Symbol.toStringTag,{value:"Module"})),uXt=Object.freeze(Object.defineProperty({__proto__:null,build:DNe},Symbol.toStringTag,{value:"Module"})),hXt=Object.freeze(Object.defineProperty({__proto__:null,TextureOnlyPassParameters:tce,build:iNe},Symbol.toStringTag,{value:"Module"})),dXt=Object.freeze(Object.defineProperty({__proto__:null,OverlayCompositingPassParameters:pce,build:BNe},Symbol.toStringTag,{value:"Module"})),pXt=Object.freeze(Object.defineProperty({__proto__:null,build:d8e},Symbol.toStringTag,{value:"Module"})),fXt=Object.freeze(Object.defineProperty({__proto__:null,build:F8e},Symbol.toStringTag,{value:"Module"})),mXt=Object.freeze(Object.defineProperty({__proto__:null,build:p7e},Symbol.toStringTag,{value:"Module"})),gXt=Object.freeze(Object.defineProperty({__proto__:null,build:b7e},Symbol.toStringTag,{value:"Module"})),yXt=Object.freeze(Object.defineProperty({__proto__:null,build:S7e},Symbol.toStringTag,{value:"Module"})),vXt=Object.freeze(Object.defineProperty({__proto__:null,TerrainPassParameters:Bce,build:_Fe},Symbol.toStringTag,{value:"Module"})),_Xt=Object.freeze(Object.defineProperty({__proto__:null,get BackgroundMode(){return rx},build:kFe},Symbol.toStringTag,{value:"Module"})),bXt=Object.freeze(Object.defineProperty({__proto__:null,ColorizerHillshadeUniforms:yFe,ColorizerStretchUniforms:gFe,ColorizerUniforms:y6,build:vFe},Symbol.toStringTag,{value:"Module"})),wXt=Object.freeze(Object.defineProperty({__proto__:null,build:lke},Symbol.toStringTag,{value:"Module"})),xXt=Object.freeze(Object.defineProperty({__proto__:null,CompositingPassParameters:VG,build:yke},Symbol.toStringTag,{value:"Module"})),SXt=Object.freeze(Object.defineProperty({__proto__:null,HUDCompositingPassParameters:tue,build:_ke},Symbol.toStringTag,{value:"Module"})),TXt=Object.freeze(Object.defineProperty({__proto__:null,OITCompositingPassParameters:iue,build:xke},Symbol.toStringTag,{value:"Module"})),EXt=Object.freeze(Object.defineProperty({__proto__:null,build:Ake},Symbol.toStringTag,{value:"Module"})),CXt=Object.freeze(Object.defineProperty({__proto__:null,HighlightBlurDrawParameters:sue,build:Pke},Symbol.toStringTag,{value:"Module"})),AXt=Object.freeze(Object.defineProperty({__proto__:null,HighlightDownsampleDrawParameters:rue,blurSize:nue,build:Cke,gridCellPixelSize:nm,outlineSize:BG},Symbol.toStringTag,{value:"Module"})),MXt=Object.freeze(Object.defineProperty({__proto__:null,build:Dke},Symbol.toStringTag,{value:"Module"})),OXt=Object.freeze(Object.defineProperty({__proto__:null,build:kke},Symbol.toStringTag,{value:"Module"})),PXt=Object.freeze(Object.defineProperty({__proto__:null,build:Vke},Symbol.toStringTag,{value:"Module"})),RXt=Object.freeze(Object.defineProperty({__proto__:null,build:Gke},Symbol.toStringTag,{value:"Module"})),IXt=Object.freeze(Object.defineProperty({__proto__:null,ShadowCastVisualizePassParameters:aue,build:Yke},Symbol.toStringTag,{value:"Module"})),$Xt=Object.freeze(Object.defineProperty({__proto__:null,ShadowCastMaxSamples:_6,build:Wke},Symbol.toStringTag,{value:"Module"})),LXt=Object.freeze(Object.defineProperty({__proto__:null,build:eze},Symbol.toStringTag,{value:"Module"}));export{nmt as $,PBe as A,Lyi as A0,_e as B,C2 as C,WZt as D,Tc as E,_t as F,eoe as G,ogi as H,vn as I,ide as J,Ma as K,mt as L,mEe as M,Oc as N,Ra as O,Qt as P,Qu as Q,Ce as R,kxe as S,kt as T,Ftt as U,tt as V,qe as W,p7t as X,sgi as Y,Rs as Z,Cs as _,z_ as a,Ym as a$,rr as a0,cx as a1,cd as a2,f_ as a3,bbe as a4,Tbe as a5,Ic as a6,yt as a7,W as a8,Li as a9,Att as aA,bE as aB,wE as aC,ui as aD,L$ as aE,nrt as aF,Rli as aG,Ili as aH,pE as aI,N2t as aJ,P_ as aK,Wm as aL,eai as aM,hui as aN,Pi as aO,iZ as aP,mSe as aQ,h5 as aR,pgi as aS,n8t as aT,agi as aU,Sgi as aV,ggi as aW,Gze as aX,rgi as aY,Cgi as aZ,zj as a_,dd as aa,St as ab,on as ac,So as ad,XKt as ae,YKt as af,ec as ag,Pe as ah,Pit as ai,Mit as aj,I2 as ak,qKt as al,ZFe as am,uRe as an,hRe as ao,$Jt as ap,Om as aq,os as ar,Yz as as,Zz as at,Is as au,yi as av,qm as aw,o2 as ax,Zse as ay,RMe as az,et as b,ple as b$,Qo as b0,st as b1,Yn as b2,Ne as b3,je as b4,Hoe as b5,jr as b6,aO as b7,ym as b8,WM as b9,Mi as bA,TTt as bB,ETt as bC,kP as bD,Je as bE,pp as bF,H2t as bG,BU as bH,xt as bI,zte as bJ,sce as bK,Ye as bL,Lve as bM,el as bN,Be as bO,D9 as bP,L9 as bQ,jo as bR,$t as bS,Qe as bT,Ju as bU,Mo as bV,aNe as bW,eb as bX,mm as bY,xJt as bZ,rei as b_,BP as ba,Bni as bb,ST as bc,eyt as bd,Cc as be,sni as bf,rni as bg,nni as bh,J as bi,fce as bj,Rti as bk,qPe as bl,ga as bm,ni as bn,EP as bo,z2t as bp,en as bq,Nm as br,n5 as bs,jn as bt,Yqt as bu,kZt as bv,FZt as bw,il as bx,Tn as by,Ie as bz,Z as c,hd as c$,CE as c0,XQt as c1,nt as c2,ss as c3,cPe as c4,Fi as c5,Wt as c6,G_ as c7,oei as c8,Ve as c9,gvi as cA,eH as cB,zZt as cC,lo as cD,Hl as cE,vlt as cF,Al as cG,hei as cH,uei as cI,Jme as cJ,Xqt as cK,UP as cL,Uut as cM,cti as cN,l5 as cO,iRt as cP,$9 as cQ,w9 as cR,QKe as cS,Gs as cT,NJt as cU,pA as cV,vkt as cW,ZAe as cX,_kt as cY,b_ as cZ,wet as c_,De as ca,Mp as cb,rl as cc,Zw as cd,ms as ce,Ni as cf,eP as cg,mu as ch,e0 as ci,rh as cj,xat as ck,KQt as cl,x3e as cm,yvi as cn,sx as co,tvi as cp,nH as cq,avi as cr,lvi as cs,cvi as ct,uvi as cu,mvi as cv,hvi as cw,dvi as cx,pvi as cy,fvi as cz,igi as d,io as d$,EJt as d0,DXt as d1,rt as d2,Ao as d3,cei as d4,fd as d5,N0t as d6,Fue as d7,D0t as d8,ijt as d9,kZe as dA,$st as dB,Lst as dC,Dst as dD,$e as dE,vse as dF,Cct as dG,ej as dH,ij as dI,AB as dJ,T5 as dK,Uo as dL,gL as dM,Mr as dN,Vi as dO,ant as dP,qOe as dQ,goe as dR,vd as dS,x5 as dT,hx as dU,S_ as dV,sl as dW,xs as dX,ys as dY,gp as dZ,fL as d_,ABe as da,vgi as db,bgi as dc,O2e as dd,we as de,TE as df,$rt as dg,OZt as dh,Jnt as di,zPe as dj,bKt as dk,fot as dl,Hf as dm,Gct as dn,tn as dp,Xs as dq,Ue as dr,nst as ds,Rt as dt,Et as du,Fpe as dv,ad as dw,Hk as dx,hE as dy,FZe as dz,y as e,HKt as e$,AZ as e0,OZ as e1,bz as e2,lPe as e3,jv as e4,pPe as e5,YVe as e6,XVe as e7,od as e8,WVe as e9,E8 as eA,lse as eB,ase as eC,iCe as eD,gT as eE,cse as eF,cJt as eG,YFe as eH,bYe as eI,cT as eJ,Eoe as eK,aoe as eL,Xy as eM,_li as eN,q3t as eO,H3t as eP,CWe as eQ,UDe as eR,IQe as eS,$se as eT,ix as eU,Bm as eV,bO as eW,hm as eX,DWt as eY,Jei as eZ,NT as e_,va as ea,QJt as eb,Tli as ec,ld as ed,Mct as ee,VOe as ef,Prt as eg,qv as eh,Di as ei,tyi as ej,Vd as ek,Pfe as el,YO as em,Rct as en,f1 as eo,bj as ep,XKe as eq,_n as er,nj as es,x2 as et,oPe as eu,mT as ev,VZ as ew,_B as ex,fz as ey,FT as ez,XK as f,d9t as f$,Wh as f0,Ci as f1,ox as f2,NXt as f3,qqe as f4,WO as f5,$ne as f6,sGe as f7,T_ as f8,tCe as f9,kat as fA,X5e as fB,NQe as fC,dct as fD,bet as fE,bsi as fF,HL as fG,wsi as fH,Bn as fI,Xf as fJ,YT as fK,Pei as fL,Hei as fM,ckt as fN,Rpe as fO,Zlt as fP,Cei as fQ,QZt as fR,JL as fS,Cit as fT,Zl as fU,F5 as fV,OG as fW,PG as fX,DT as fY,Wy as fZ,idt as f_,IJt as fa,M9 as fb,wi as fc,TIt as fd,vpi as fe,a9 as ff,Jr as fg,M5e as fh,VKt as fi,jy as fj,gut as fk,xn as fl,x7 as fm,o5 as fn,yie as fo,ds as fp,sd as fq,gne as fr,yd as fs,ua as ft,DE as fu,Bi as fv,as as fw,eei as fx,hfe as fy,QQt as fz,ze as g,qpe as g$,p9t as g0,s9t as g1,tmi as g2,mV as g3,u0i as g4,m9t as g5,R8e as g6,JQe as g7,c5 as g8,ZDe as g9,Cm as gA,e1i as gB,Qyi as gC,dT as gD,lZ as gE,Zue as gF,uui as gG,uL as gH,jf as gI,eZt as gJ,gCt as gK,Er as gL,ol as gM,JEt as gN,e9 as gO,sL as gP,oyi as gQ,C6 as gR,J0t as gS,KEt as gT,KPt as gU,iKt as gV,cui as gW,SJt as gX,uGe as gY,lQt as gZ,Fnt as g_,vli as ga,yli as gb,pet as gc,DJt as gd,uet as ge,Lse as gf,LJt as gg,Sc as gh,fXe as gi,oI as gj,un as gk,mn as gl,C_ as gm,Lf as gn,Rp as go,js as gp,Wz as gq,JB as gr,Z6 as gs,att as gt,Qjt as gu,eGt as gv,nx as gw,Jue as gx,z5 as gy,ZQt as gz,Nf as h,lGt as h$,wKt as h0,zqe as h1,iWe as h2,n_i as h3,Qje as h4,s_i as h5,xYt as h6,gYt as h7,Pp as h8,_7t as h9,WB as hA,HQt as hB,t0 as hC,hn as hD,Il as hE,X as hF,Rw as hG,PP as hH,qu as hI,or as hJ,yf as hK,a1 as hL,qyi as hM,bot as hN,Qr as hO,HU as hP,o0 as hQ,jii as hR,Gyi as hS,Xl as hT,tGt as hU,Qa as hV,S6e as hW,QB as hX,Ln as hY,zni as hZ,vGt as h_,QXe as ha,bt as hb,ax as hc,IKt as hd,hoe as he,frt as hf,doe as hg,$Oe as hh,Tce as hi,w_ as hj,LOe as hk,cMt as hl,Lie as hm,i$ as hn,Mm as ho,yze as hp,ZT as hq,Ur as hr,Zy as hs,E3e as ht,nqt as hu,Nje as hv,mGe as hw,TP as hx,al as hy,aj as hz,Nnt as i,r_i as i$,KBe as i0,ML as i1,wy as i2,G9 as i3,yui as i4,Oie as i5,sai as i6,nai as i7,YQt as i8,pU as i9,BB as iA,N2 as iB,F_ as iC,wP as iD,Gh as iE,HZ as iF,Qde as iG,DQe as iH,snt as iI,nnt as iJ,kPe as iK,rfe as iL,BK as iM,vrt as iN,int as iO,i_i as iP,t_i as iQ,Znt as iR,pP as iS,nfe as iT,JQt as iU,_ot as iV,EWe as iW,tli as iX,VK as iY,$Kt as iZ,Jit as i_,Q2 as ia,l6 as ib,Kue as ic,yGt as id,K0 as ie,Mw as ig,qO as ih,Lj as ii,ZKt as ij,qz as ik,Wf as il,znt as im,wot as io,tst as ip,W5e as iq,IS as ir,Zp as is,qI as it,YI as iu,_rt as iv,rnt as iw,yE as ix,Vt as iy,_st as iz,tl as j,zZ as j$,oy as j0,TYt as j1,sPe as j2,Gy as j3,Wye as j4,e_i as j5,Xh as j6,Qf as j7,fP as j8,Rot as j9,pQt as jA,fQt as jB,mQt as jC,yQt as jD,vQt as jE,_Qt as jF,bQt as jG,wQt as jH,xQt as jI,SQt as jJ,TQt as jK,EQt as jL,Act as jM,vy as jN,JKt as jO,xc as jP,Yu as jQ,Uni as jR,I9 as jS,$s as jT,HB as jU,En as jV,ur as jW,__ as jX,ih as jY,zo as jZ,Xmi as j_,Loe as ja,ise as jb,pJt as jc,w2 as jd,Jqe as je,qy as jf,$f as jg,Crt as jh,RQt as ji,by as jj,eQt as jk,QKt as jl,s5 as jm,uoe as jn,CQt as jo,MB as jp,V_ as jq,poe as jr,yOe as js,Bst as jt,Vst as ju,Ust as jv,qrt as jw,PQt as jx,yst as jy,Lrt as jz,wze as k,Gii as k$,jlt as k0,ont as k1,c4t as k2,DNt as k3,Rv as k4,Ka as k5,Egi as k6,DUt as k7,AM as k8,YK as k9,ygi as kA,yr as kB,GTe as kC,_se as kD,XOe as kE,Dyi as kF,kyi as kG,uf as kH,gE as kI,fE as kJ,VB as kK,Vii as kL,Fee as kM,QG as kN,pjt as kO,QBt as kP,tjt as kQ,FBt as kR,djt as kS,rjt as kT,ejt as kU,bje as kV,DWe as kW,Gr as kX,it as kY,oi as kZ,_L as k_,sli as ka,vKt as kb,ili as kc,mp as kd,mYt as ke,HZt as kf,uJt as kg,bXe as kh,JZt as ki,qZt as kj,$Z as kk,uo as kl,slt as km,xm as kn,Pti as ko,dlt as kp,Xr as kq,Wr as kr,Yie as ks,Xie as kt,$Nt as ku,N_ as kv,qh as kw,wgi as kx,Coe as ky,b7t as kz,u8t as l,Vze as l$,NL as l0,xui as l1,KCt as l2,JCt as l3,Ioe as l4,Koi as l5,V$ as l6,DL as l7,Ws as l8,vs as l9,K7e as lA,ap as lB,Qlt as lC,Sei as lD,Mei as lE,sti as lF,B5e as lG,pLe as lH,rYe as lI,ZO as lJ,lli as lK,m_ as lL,$dt as lM,fSe as lN,Xlt as lO,A5 as lP,Tae as lQ,l1i as lR,Y9 as lS,hse as lT,lei as lU,glt as lV,u7t as lW,ugi as lX,l7t as lY,lgi as lZ,cgi as l_,GVe as la,aPe as lb,oO as lc,spe as ld,hJt as le,sP as lf,eKt as lg,_s as lh,OGe as li,k2 as lj,aQt as lk,oB as ll,_ne as lm,Ky as ln,CA as lo,Kl as lp,mst as lq,qQt as lr,Zst as ls,iyi as lt,ez as lu,_At as lv,wAt as lw,Dni as lx,Hm as ly,wG as lz,Tgi as m,U$ as m$,XMe as m0,mne as m1,gx as m2,ke as m3,cr as m4,Zr as m5,wm as m6,ws as m7,Gt as m8,In as m9,AQt as mA,MQt as mB,foe as mC,gQt as mD,_y as mE,dQt as mF,Jf as mG,lnt as mH,zB as mI,$i as mJ,KB as mK,p5 as mL,Ec as mM,Cp as mN,ma as mO,O9 as mP,tse as mQ,yH as mR,Tr as mS,Eei as mT,Or as mU,Vse as mV,Yme as mW,G8e as mX,q8e as mY,MAt as mZ,Vp as m_,lRt as ma,Idt as mb,Kw as mc,Jo as md,mae as me,Gmi as mf,Hyi as mg,q6t as mh,XV as mi,Sui as mj,Zci as mk,Xci as ml,Wci as mm,OM as mn,HEt as mo,Yci as mp,Gm as mq,RZ as mr,PZt as ms,WKt as mt,jrt as mu,Vrt as mv,P2 as mw,nti as mx,SYt as my,wTe as mz,fgi as n,PJt as n$,B$ as n0,w8e as n1,GMt as n2,vAt as n3,eSt as n4,E_ as n5,KDe as n6,rJt as n7,iSt as n8,vMt as n9,HPe as nA,Jjt as nB,q4 as nC,HO as nD,WPe as nE,Yii as nF,qii as nG,Wii as nH,DQ as nI,ae as nJ,LZt as nK,b9 as nL,IWt as nM,ukt as nN,ixe as nO,dE as nP,J5e as nQ,xL as nR,nd as nS,R6 as nT,_Yt as nU,ali as nV,DB as nW,RJt as nX,AJt as nY,OJt as nZ,MJt as n_,dMt as na,pMt as nb,bMt as nc,mMt as nd,gMt as ne,Um as nf,fMt as ng,Pc as nh,_Mt as ni,Q9 as nj,qj as nk,Ca as nl,tSt as nm,yMt as nn,Yj as no,n0 as np,RE as nq,IO as nr,RC as ns,Ek as nt,_$t as nu,HFe as nv,Os as nw,gat as nx,rat as ny,OBe as nz,lde as o,r5 as o$,vp as o0,y6e as o1,Dtt as o2,dst as o3,sB as o4,g_ as o5,aZ as o6,H_ as o7,wWt as o8,E9 as o9,V2 as oA,yHe as oB,vSe as oC,wGe as oD,sJt as oE,jRe as oF,hdt as oG,Xi as oH,Ymi as oI,yc as oJ,Eit as oK,Kjt as oL,vht as oM,_$ as oN,dKt as oO,vst as oP,soe as oQ,RM as oR,JMe as oS,nit as oT,rot as oU,Oet as oV,Jv as oW,Q$ as oX,ESe as oY,Ane as oZ,CZt as o_,AE as oa,vsi as ob,A_ as oc,gn as od,sae as oe,Ep as of,Goe as og,LT as oh,WXe as oi,sn as oj,bp as ok,WSe as ol,tZt as om,rti as on,Hii as oo,p5e as op,Vo as oq,$Q as or,zXt as os,JSe as ot,oZt as ou,sZt as ov,Kvi as ow,wli as ox,bli as oy,aZt as oz,ngi as p,AKt as p$,Cqe as p0,lB as p1,RZt as p2,Yot as p3,EE as p4,lmt as p5,Hu as p6,Ji as p7,tJt as p8,fB as p9,S5e as pA,YZt as pB,wYe as pC,MBt as pD,fjt as pE,cmt as pF,Kat as pG,hhe as pH,Jqt as pI,VO as pJ,M_ as pK,Zqt as pL,Tdt as pM,Adt as pN,$jt as pO,qBe as pP,Pjt as pQ,ovi as pR,svi as pS,eTe as pT,zyi as pU,xj as pV,BYe as pW,hmt as pX,fs as pY,emt as pZ,tmt as p_,fJt as pa,x_ as pb,c1 as pc,R2 as pd,SMe as pe,oP as pf,Qh as pg,AZt as ph,Zf as pi,yQ as pj,qSe as pk,hYe as pl,SSe as pm,oE as pn,ey as po,kTe as pp,Lne as pq,EZt as pr,Py as ps,AWe as pt,Uhe as pu,EMe as pv,QNe as pw,t0t as px,Ei as py,INt as pz,mgi as q,MZt as q$,Lit as q0,fne as q1,gu as q2,dO as q3,iit as q4,L2 as q5,sei as q6,jG as q7,eU as q8,QTt as q9,M8e as qA,EAt as qB,SAt as qC,CAt as qD,Y_ as qE,xAt as qF,Nme as qG,Vri as qH,Wee as qI,bAt as qJ,Uri as qK,Lli as qL,iti as qM,tti as qN,dgi as qO,hgi as qP,_gi as qQ,Yt as qR,fat as qS,Zot as qT,t5e as qU,Yv as qV,gs as qW,P8e as qX,OAt as qY,cne as qZ,nat as q_,ENt as qa,dli as qb,Oxe as qc,Wmi as qd,qmi as qe,R9 as qf,Sn as qg,got as qh,wj as qi,aJt as qj,oJt as qk,rme as ql,tme as qm,vc as qn,sMe as qo,KKt as qp,I8e as qq,Mui as qr,T8e as qs,$ie as qt,_ce as qu,Pne as qv,Ac as qw,Kf as qx,TAt as qy,E8e as qz,se as r,hZt as r$,Sli as r0,qye as r1,Eli as r2,mli as r3,qDe as r4,YDe as r5,GDe as r6,t$ as r7,e$ as r8,het as r9,$Tt as rA,Yf as rB,dne as rC,xii as rD,eAt as rE,nE as rF,GB as rG,B9 as rH,V9 as rI,b5 as rJ,DPe as rK,Vet as rL,GQt as rM,w5t as rN,v3t as rO,g3t as rP,Oat as rQ,Bai as rR,cP as rS,Vai as rT,O_ as rU,Mli as rV,Za as rW,Wl as rX,ddi as rY,ace as rZ,Jl as r_,det as ra,Kye as rb,nSt as rc,eli as rd,QEe as re,dJt as rf,xYe as rg,ZZt as rh,cB as ri,lYe as rj,mYe as rk,XDe as rl,Xne as rm,GZt as rn,vOe as ro,Iit as rp,UB as rq,cu as rr,VE as rs,cst as rt,UWe as ru,zWe as rv,yB as rw,ktt as rx,rqt as ry,ime as rz,yPe as s,BLt as s$,_m as s0,np as s1,oD as s2,hli as s3,Hpe as s4,Kt as s5,nli as s6,lxt as s7,jB as s8,xE as s9,X0t as sA,y_e as sB,Zie as sC,E0 as sD,dV as sE,AL as sF,nPe as sG,xnt as sH,Oe as sI,Gpe as sJ,yMe as sK,OSe as sL,yGe as sM,iJt as sN,nft as sO,Vei as sP,xei as sQ,Bei as sR,Bmi as sS,vj as sT,Dei as sU,Rei as sV,Iei as sW,Oei as sX,c8 as sY,pNe as sZ,_d as s_,x5t as sa,Lle as sb,qUe as sc,Eo as sd,D7e as se,syi as sf,Oz as sg,VEe as sh,F5t as si,km as sj,y5e as sk,ea as sl,D4e as sm,vB as sn,GT as so,k_ as sp,dj as sq,Xyi as sr,co as ss,S2 as st,gj as su,Xoe as sv,F5e as sw,Ol as sx,Uii as sy,PE as sz,xgi as t,yht as t$,Uat as t0,Xot as t1,yei as t2,Uei as t3,Vat as t4,rQt as t5,Tfe as t6,LO as t7,Nni as t8,Ny as t9,h$ as tA,BKt as tB,Gei as tC,jei as tD,gP as tE,plt as tF,ir as tG,n_ as tH,mG as tI,VU as tJ,yn as tK,Jfi as tL,uKt as tM,tei as tN,C9 as tO,QXt as tP,kL as tQ,yL as tR,rai as tS,P$e as tT,sct as tU,G5e as tV,wei as tW,m2 as tX,rlt as tY,yy as tZ,Jlt as t_,mP as ta,$z as tb,To as tc,Blt as td,tT as te,zei as tf,rs as tg,w5 as th,kei as ti,Wi as tj,sOe as tk,oOe as tl,tai as tm,Nei as tn,Aei as to,rPe as tp,wnt as tq,Qn as tr,IM as ts,uP as tt,H6e as tu,Ule as tv,Sgt as tw,N8e as tx,HTe as ty,qoe as tz,xPe as u,gfi as u$,vfe as u0,Tei as u1,ode as u2,Zmi as u3,uRt as u4,o_e as u5,pst as u6,pSe as u7,ySe as u8,une as u9,gm as uA,ZMe as uB,f$ as uC,OL as uD,IYe as uE,uj as uF,Tz as uG,mB as uH,Sre as uI,VZt as uJ,UZt as uK,BZt as uL,BHe as uM,Nj as uN,Z4 as uO,rn as uP,ci as uQ,Ai as uR,opi as uS,mpi as uT,aDe as uU,GS as uV,__e as uW,spi as uX,lpi as uY,jS as uZ,rpi as u_,IZt as ua,fpi as ub,pV as uc,Bh as ud,jh as ue,Qie as uf,Jie as ug,ere as uh,Kie as ui,ine as uj,v_e as uk,Drt as ul,nyi as um,$Zt as un,uu as uo,Due as up,S5 as uq,Xtt as ur,Ztt as us,tOe as ut,fCt as uu,git as uv,mCt as uw,aOe as ux,Hz as uy,pZt as uz,Oo as v,lFt as v$,EY as v0,hk as v1,Mc as v2,ki as v3,sr as v4,Yr as v5,Rr as v6,r0 as v7,vDe as v8,Sf as v9,bYt as vA,xli as vB,Vht as vC,FKt as vD,oHe as vE,GFe as vF,CW as vG,AW as vH,ya as vI,gli as vJ,pli as vK,lst as vL,qie as vM,Nti as vN,vvi as vO,Dm as vP,Nse as vQ,_9 as vR,Eet as vS,lyi as vT,Mf as vU,Tet as vV,Vz as vW,jz as vX,TL as vY,UXt as vZ,G7t as v_,ot as va,jRt as vb,GRt as vc,rst as vd,nMe as ve,Hy as vf,B_ as vg,IQt as vh,Nrt as vi,Frt as vj,OQt as vk,rT as vl,kWe as vm,DZt as vn,NZt as vo,J$ as vp,WNt as vq,rrt as vr,MQe as vs,Yy as vt,qT as vu,ttt as vv,O3t as vw,Cli as vx,nYt as vy,cYt as vz,nvi as w,vYe as w$,Bvi as w0,jvi as w1,Gvi as w2,TWt as w3,HG as w4,Vvi as w5,ayi as w6,gue as w7,_5 as w8,mot as w9,Ap as wA,Qat as wB,Mgt as wC,iP as wD,ivi as wE,G2 as wF,Trt as wG,hV as wH,n$t as wI,BS as wJ,v$t as wK,mw as wL,kG as wM,FG as wN,V_e as wO,NG as wP,j_e as wQ,zEt as wR,Fst as wS,kst as wT,zst as wU,yCt as wV,IUt as wW,NUt as wX,DTe as wY,cbe as wZ,nbe as w_,Cy as wa,IGe as wb,VXt as wc,KJt as wd,bB as we,jni as wf,Gni as wg,cCe as wh,h1t as wi,Vni as wj,Qme as wk,Bii as wl,eh as wm,tP as wn,cjt as wo,Zn as wp,rvi as wq,zoe as wr,XZt as ws,TG as wt,Zoe as wu,Fyi as wv,r7 as ww,Zh as wx,j2 as wy,d1t as wz,du as x,Oi as x$,sbe as x0,wbe as x1,obe as x2,dbe as x3,Obe as x4,Pbe as x5,Rbe as x6,Ibe as x7,KZt as x8,Jci as x9,eui as xA,XNe as xB,Kci as xC,e5t as xD,jEt as xE,Ise as xF,FZ as xG,Lr as xH,si as xI,nae as xJ,bJt as xK,Iti as xL,d1 as xM,boe as xN,o5e as xO,zm as xP,ft as xQ,V as xR,Ar as xS,ue as xT,Zu as xU,ao as xV,_1 as xW,td as xX,gr as xY,IP as xZ,gd as x_,lui as xa,nui as xb,rui as xc,ZPt as xd,sui as xe,oui as xf,V1e as xg,j1e as xh,B1e as xi,tui as xj,iui as xk,Ql as xl,ebe as xm,H_e as xn,q_e as xo,W_e as xp,pbe as xq,Ube as xr,jbe as xs,tbe as xt,Vbe as xu,KU as xv,aui as xw,VEt as xx,BEt as xy,Qci as xz,w as y,wp as y$,Ml as y0,Jt as y1,fe as y2,Ir as y3,pu as y4,Hr as y5,$r as y6,Ti as y7,xp as y8,Q_ as y9,E5e as yA,mdt as yB,nei as yC,Zt as yD,md as yE,_x as yF,n1 as yG,tx as yH,bx as yI,hG as yJ,cG as yK,Lae as yL,jj as yM,zoi as yN,Q9e as yO,gei as yP,vei as yQ,ZJt as yR,ett as yS,q3 as yT,CU as yU,tKt as yV,Uoi as yW,j$e as yX,bs as yY,Q6e as yZ,cn as y_,kj as ya,sh as yb,lG as yc,ji as yd,uG as ye,yx as yf,V9e as yg,fx as yh,Ple as yi,ls as yj,Zwt as yk,Xt as yl,Rle as ym,JJt as yn,Bo as yo,Cr as yp,Pl as yq,bn as yr,cce as ys,oh as yt,D5 as yu,nEt as yv,PL as yw,wJt as yx,$_t as yy,oae as yz,Dn as z,Hui as z$,eE as z0,Vj as z1,c0 as z2,vx as z3,OLe as z4,fMe as z5,_ei as z6,bei as z7,Use as z8,Jm as z9,cli as zA,lJt as zB,kXt as zC,Dpi as zD,nJt as zE,uli as zF,Gu as zG,KXt as zH,eit as zI,yxt as zJ,qd as zK,Zm as zL,v1 as zM,$n as zN,s_ as zO,i1 as zP,zt as zQ,RKt as zR,IE as zS,SE as zT,OKt as zU,nQt as zV,oQt as zW,hQt as zX,Kct as zY,Qoi as zZ,Oui as z_,Umi as za,odi as zb,$ei as zc,Lei as zd,MPe as ze,BI as zf,N5e as zg,Yee as zh,U2 as zi,aei as zj,D5e as zk,lO as zl,eJt as zm,BWe as zn,VWe as zo,qne as zp,Gne as zq,Wqt as zr,i0 as zs,gG as zt,$c as zu,dp as zv,CLe as zw,Oti as zx,Hwt as zy,ndt as zz}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/AreaMeasurement2D-5lnD5-Sk.js","assets/Draw-DYxsSuyr.js","assets/SnappingVisualizer2D-NnEm1PvQ.js","assets/SnappingContext-6K6JmvvY.js","assets/PointSnappingHint-ULetRXiW.js","assets/EditGeometryOperations-TPE5Wzab.js","assets/SnappingOperation-2U48wt1k.js","assets/surfaceCoordinateSystems-siQq4eBA.js","assets/dehydratedFeatureComparison-hdPq-zad.js","assets/InteractiveToolBase-WDic4GPF.js","assets/drawUtils-woTYaREB.js","assets/SnappingDragPipelineStep-THHIXt-p.js","assets/GraphicManipulator-ku6oRBpa.js","assets/drapedUtils-9db1OpTX.js","assets/MeasurementWidgetContent-d8uX7Gw_.js","assets/AreaMeasurement3D-GOBHGg9B.js","assets/measurementUtils-St7B-HxA.js","assets/SnappingVisualizer3D-KWlqByBu.js","assets/ExtendedLineVisualElement-YbjiXiBG.js","assets/vec4f32-NvfHy9q7.js","assets/EngineVisualElement-eZNKTKsI.js","assets/VisualElement-kjYXz27t.js","assets/Laserlines.glsl-nvjcCsAw.js","assets/PointVisualElement-bX-_4FqS.js","assets/Object3DVisualElement-TMb7y_wl.js","assets/RightAngleQuadVisualElement-y_W8r903.js","assets/dragEventPipeline3D-4CqrlxD2.js","assets/ShadedColorMaterial.glsl-Fp4o6LjC.js","assets/AnalysisToolBase-3A13PdgS.js","assets/SceneSnappingManagerPool-OpebO9Di.js","assets/InteractiveAnalysisViewModel-RI-qFGDH.js","assets/DistanceMeasurement2D-0EP_w-h3.js","assets/DirectLineMeasurement3D-3Pkkgamv.js","assets/interfaces-tkyofe_Z.js","assets/interfaces-lHX1zDRv.js","assets/portalLayers-AqjAd9kT.js","assets/requestPresets-18nzHK5y.js","assets/arcgisLayers-Ja4-CB3n.js","assets/fetchService-wPWKuma6.js","assets/WhereClause-XAMIZ4-B.js","assets/TimeOnly-ljWtUK7N.js","assets/arcadeUtils-OUqwHs4P.js","assets/hash-SS5GKVPY.js","assets/layersLoader-5063dwjn.js","assets/layersCreator-aC1PvuFa.js","assets/jsonContext-cWV_-jAj.js","assets/BuildingSceneLayer-YaRBOuhA.js","assets/BuildingComponentSublayer-j8wian8V.js","assets/FeatureLayer--S4epFk-.js","assets/FeatureLayerBase-jpFp8gE3.js","assets/serviceCapabilitiesUtils-26KpT1VN.js","assets/editsZScale-Wgw9kbYG.js","assets/queryZScale-IaMm02_2.js","assets/FeatureSet-d4S1oKME.js","assets/CustomParametersMixin-Y1bOcayO.js","assets/FeatureEffectLayer-oBa8pIG5.js","assets/FeatureEffect-5bEV-xG1.js","assets/FeatureReductionLayer-RlitE1N6.js","assets/OrderedLayer-M7k5gLgx.js","assets/FeatureTemplate-kUgbbA00.js","assets/FeatureType-MpRe7WJj.js","assets/versionUtils-4v9zIDlv.js","assets/TopFeaturesQuery-E6D2tV-x.js","assets/BuildingGroupSublayer-xf_JzVTh.js","assets/CSVLayer-tIBvmg-7.js","assets/clientSideDefaults-F-CNnR0g.js","assets/QueryEngineCapabilities-PzVpW5yD.js","assets/DimensionLayer-WWUzEsQc.js","assets/LengthDimension-A_HnPDNi.js","assets/GeoJSONLayer-T9kwyVNs.js","assets/ImageryLayer-G7gb-fJC.js","assets/ImageHistogramParameters-sFtZwJ9j.js","assets/dataUtils-s_UKlouc.js","assets/generateRendererUtils-_1jVE02H.js","assets/executeQueryJSON-ACj9qY0y.js","assets/query-rG0aX6cE.js","assets/pbfQueryUtils-pWizwTQZ.js","assets/pbf-o0zzptPp.js","assets/AttachmentInfo-kbEMEIl0.js","assets/executeForIds-wXO8-pll.js","assets/ImageryTileLayer-ce5u7kmi.js","assets/rasterProjectionHelper-KvYWHIT_.js","assets/utils-4xKNo3Tf.js","assets/IntegratedMeshLayer-T6vTIezB.js","assets/SceneModification-dyp2M_Yg.js","assets/KMLLayer-c7r_kLDp.js","assets/LinkChartLayer-uIn6uT3L.js","assets/geohashUtils-U0jvYCSY.js","assets/FeatureStore-X-AIJLo2.js","assets/BoundsStore-wmwfHjhp.js","assets/PooledRBush-o8tLYBG5.js","assets/quickselect-UFB0jJTZ.js","assets/QueryEngine-8tLWlkSE.js","assets/json-v6EOeNTY.js","assets/utils-P5wTOmqv.js","assets/optimizedFeatureQueryEngineAdapter-KnoSHZzG.js","assets/MapImageLayer-qMOOMfH7.js","assets/SublayersOwner-8xrm3MkT.js","assets/QueryTask-91TvtrTt.js","assets/executeQueryPBF-vdaOUMid.js","assets/MapNotesLayer-CdG3vHcH.js","assets/objectIdUtils-GktMsX8e.js","assets/MediaLayer-39dmiD7K.js","assets/MediaElementView-ezYHddnZ.js","assets/normalizeUtilsSync-zfJiThlh.js","assets/OGCFeatureLayer--w0HTnNu.js","assets/ogcFeatureUtils-dtzP0u64.js","assets/geojson-fSjaGZrp.js","assets/date-be_IQzZd.js","assets/OpenStreetMapLayer-6XrQQ-kN.js","assets/WebTileLayer-JxqArsF7.js","assets/OrientedImageryLayer-LKoItije.js","assets/PointCloudLayer-qVzMPRjJ.js","assets/PointCloudUniqueValueRenderer-RbbyNiwC.js","assets/RouteLayer-GamYzZdr.js","assets/Stop-W76EJiT2.js","assets/StreamLayer-KHxHoWyI.js","assets/SubtypeGroupLayer-xK5RtU9X.js","assets/TileLayer-bPSfr5GU.js","assets/VectorTileLayer-0SVRfneU.js","assets/StyleRepository-UhXfhILC.js","assets/TileClipper-NSFZXMR1.js","assets/definitions-DqQMJYPH.js","assets/WFSLayer-VPxAc_vg.js","assets/wfsUtils-6CAR46-c.js","assets/xmlUtils-Q_9cB30b.js","assets/WMTSLayer-Qx8zOTb2.js","assets/groupLayerUtils-ciLlAkrK.js","assets/utils-rBsg-VY8.js","assets/statsWorker-HfKfr9Es.js","assets/geometryEngineWorker-yTomxYzK.js","assets/geometryEngineJSON-FxYgI0L3.js","assets/CSVSourceWorker-GlkXsKJn.js","assets/ElevationSamplerWorker-_kiMcA-u.js","assets/FeatureServiceSnappingSourceWorker-TBw9rhlL.js","assets/symbologySnappingCandidates-Sz0MFOvR.js","assets/GeoJSONSourceWorker-Sd5A35h-.js","assets/sourceUtils-zbywPEXK.js","assets/MemorySourceWorker-K3WXTL5J.js","assets/PBFDecoderWorker--NqrOA1Y.js","assets/Pipeline--6jAENf8.js","assets/StreamFeatureManager-QrKJ84_c.js","assets/labelPoint-ysDT9nFH.js","assets/createConnection-4ppGVnSc.js","assets/enums-uQoFEhYh.js","assets/number-sTjsTbdA.js","assets/PointCloudWorker-UgniuzRB.js","assets/PointCloudWorkerUtil-q8ml4JQu.js","assets/RasterWorker-0s4_fI9v.js","assets/SceneLayerWorker-o7OZRrjZ.js","assets/I3SNode-5SPByfpU.js","assets/WFSSourceWorker-iUwpu94Y.js","assets/WorkerTileHandler-9KieSe2P.js","assets/Rect-bBBxMtVp.js","assets/TurboLine-SWK4qRwh.js","assets/BidiEngine-8z8MVveq.js","assets/Popup-aRK3Vd3w.js","assets/featureUtils-itZGjo5c.js","assets/AnchorElementViewModel-SDYg-P9c.js","assets/ReactiveSet-HLstcUcf.js","assets/TileLayerView3D-5Hf3FIEh.js","assets/LayerView3D-iOx2MD1g.js","assets/TiledLayerView3D-Av58zTxG.js","assets/LayerView-efDufa6j.js","assets/RefreshableLayerView-Pd4dLcWr.js","assets/MapServiceLayerViewHelper-a8WMaeWS.js","assets/ElevationLayerView3D-aDJhr4Zv.js","assets/BaseDynamicLayerView3D-aiAW9HKo.js","assets/DynamicLayerView3D-4lztpXo0.js","assets/projectExtentUtils-TwA6ooHn.js","assets/ImageMaterial.glsl-TdPtjVc_.js","assets/BuildingSceneLayerView3D-jychJ4lg.js","assets/I3SMeshView3D-OXYwZo0p.js","assets/I3SOverrides-5dCbMm3h.js","assets/meshFeatureSet-Mcou8mDC.js","assets/External-GV0jSEES.js","assets/FeatureLayerView3D-t6NDkLO0.js","assets/FeatureLayerViewBase3D-VurTj7t3.js","assets/HeatmapDensity.glsl-y7dUg--m.js","assets/queryForSymbologySnapping-I1fFQTD_.js","assets/Graphics3DObjectStates--mMi4sdi.js","assets/EventedSet-JGlFrfoR.js","assets/I3SQueryFeatureStore-CLo7XXT-.js","assets/DefinitionExpressionSceneLayerView-oAOUEjm-.js","assets/CSVLayerView3D-t0wtEtZq.js","assets/DimensionLayerView3D-sKnmIRMF.js","assets/GeoJSONLayerView3D-4MSCbPJp.js","assets/GraphicsLayerView3D-TqJxY2EU.js","assets/GraphicsProcessor-rh5nA4fc.js","assets/GroupLayerView-do80uFuS.js","assets/ImageryLayerView3D-Ajt9-b41.js","assets/IntegratedMeshLayerView3D-EW3nzBgf.js","assets/LineOfSightLayerView3D-rUjgrEFl.js","assets/MapImageLayerView3D-GIO-oWiM.js","assets/MediaLayerView3D-CIdxGOiQ.js","assets/OGCFeatureLayerView3D-FLI41Ca4.js","assets/PointCloudLayerView3D-KHREaqUZ.js","assets/PopupSceneLayerView-cRxapYqF.js","assets/VoxelLayerView3D-FruX8zyo.js","assets/RouteLayerView3D-tOy-WtTD.js","assets/SceneLayerView3D-7NpyxR5M.js","assets/SceneLayerView-MZstNOoI.js","assets/SceneLayerGraphicsView3D-Abn6jwJk.js","assets/StreamLayerView3D-nu_wqFzJ.js","assets/ImageryTileLayerView3D-kyd0hRhY.js","assets/VectorTileLayerView3D-eexSRj3E.js","assets/rasterizingUtils-6P0UGdzr.js","assets/GeometryUtils-K2DOc0l8.js","assets/WFSLayerView3D-OjHmKjv_.js","assets/WMSLayerView3D-HO_hwLwX.js","assets/WMTSLayerView3D-oO1etwl-.js","assets/AreaMeasurementAnalysisView3D-AasBQOV-.js","assets/AnalysisView3D-jkk3JIRT.js","assets/UnitNormalizer-19C91v_m.js","assets/euclideanAreaMeasurementUtils-zmzttSyV.js","assets/measurementUtils-84-ZBArh.js","assets/LineVisualElement-4BP10o6v.js","assets/quantityFormatUtils-NiAiojad.js","assets/Segment-hN2uWAPW.js","assets/TextOverlayItem-eCjvS6IO.js","assets/DimensionAnalysisView3D-W2fgoQBr.js","assets/euclideanLengthMeasurementUtils-VQw5qWk6.js","assets/Factory-m-O4WAoG.js","assets/VerticesVisualElement-oQAA_hbc.js","assets/analysisViewUtils-AQaQeJpR.js","assets/DirectLineMeasurementAnalysisView3D-AgdgP6Nj.js","assets/LineOfSightAnalysisView3D-lX-OBMBB.js","assets/manipulatorUtils-1y2yxq3d.js","assets/SliceAnalysisView3D--IcVdus9.js","assets/SlicePlaneMaterial.glsl-RxywoUhm.js","assets/CIMSymbolRasterizer-o8gx_uXl.js","assets/cimAnalyzer-DtyBzAGI.js","assets/TerrainTileTree3DDebugger-Or7WvqAU.js","assets/TileTreeDebugger-2DVbY5sQ.js","assets/calcite-button-tOn16zeN.js","assets/button-dkwNndhL.js","assets/form-2Iq0hI3D.js","assets/interactive-NKzPUNL4.js","assets/label2-d2vWQ7x7.js","assets/loadable-sxY2K1G3.js","assets/locale-pfkq1d6A.js","assets/key-qdHumIlA.js","assets/observers-JyBmMU24.js","assets/component-dtiBfYiX.js","assets/t9n-od6MEnI1.js","assets/icon-ZwpY5ksA.js","assets/loader-QqciGs1c.js","assets/guid-6vN-YNJI.js","assets/calcite-icon-itD416se.js","assets/FeatureTileTree3DDebugger-ZBfyCqfy.js","assets/GraphicsView3D-6FUUKif_.js","assets/calcite-tooltip-DucKIjb_.js","assets/floating-ui-McpI0u1Z.js","assets/debounce-HnHf1UOZ.js","assets/openCloseComponent-yw47Oy2q.js","assets/FloatingArrow-BghsONry.js","assets/calcite-scrim-iUD6Tmec.js","assets/scrim-OeyGkB0-.js","assets/calcite-chip-MkTbFpRn.js","assets/conditionalSlot-e55zipTI.js","assets/previewCIMSymbol-ZetpgWRs.js","assets/FeatureServiceSnappingSource-El1DZ1LB.js","assets/queryEngineUtils-0F1SWi13.js","assets/VertexSnappingCandidate-sgrBHAMS.js","assets/FeatureCollectionSnappingSource-AwpfuxVk.js","assets/GraphicsSnappingSource-FqTOI9A3.js","assets/SceneLayerSnappingSource-u6yw_bMd.js","assets/editingTools-1yHclJT1.js","assets/editPlaneUtils-4qxd7h1E.js","assets/Tooltip-ON77BKb3.js","assets/automaticAreaMeasurementUtils-nVd6Y5mX.js","assets/editingTools-eh7FxppI.js","assets/GraphicState-2UcU5UAX.js","assets/TranslateTooltipInfos-J6BygtUO.js","assets/ExtentTooltipInfos-LPjFe37b.js","assets/GraphicMover-DhG5Ib7v.js","assets/Box-gJ8-sOXE.js","assets/settings-YeKUIkGh.js","assets/Reshape-J0NI6bzM.js","assets/calcite-dropdown-caxGPYrb.js","assets/calcite-dropdown-group-bJt5U1w-.js","assets/resources2-gI505pgk.js","assets/calcite-dropdown-item-HvBJs5CH.js","assets/calcite-checkbox-OaFCWd7i.js","assets/calcite-label-lSeWOYbm.js","assets/calcite-option-LMeeGK3H.js","assets/calcite-select-0Yw6DsYN.js","assets/ElevationProfileView2D-KdZmS2un.js","assets/HoveredPoints-BD2phuV6.js","assets/ElevationProfileView3D-bd56oGje.js","assets/calcite-action-mEzyoc-Z.js","assets/action-W5zDPNjG.js","assets/calcite-popover-PeZ1jQob.js","assets/popover-Jm1QI0N1.js","assets/calcite-loader-Z65agR8e.js","assets/chartUtils-P39aKol1.js","assets/Responsive-QKXcW_1q.js","assets/Theme-QNc_77AM.js","assets/chartUtilsAm5-QfmFJ3lc.js","assets/Tooltip-lrFZgXdG.js","assets/DefaultTheme-T7-VnRhA.js","assets/LineSeries-VcEznTH7.js","assets/ColorSet-j9kKRPwP.js","assets/Tick-WQ_bPwW2.js","assets/Button-1STHXt3M.js","assets/calcite-color-picker-iQ658ZQD.js","assets/progress-puB9lhY4.js","assets/math-SoUQJWjz.js","assets/calcite-slider--uw2bYfU.js","assets/calcite-list-item-OtIyVNHT.js","assets/utils3-_ao2jQXg.js","assets/calcite-list-LJfGqLbO.js","assets/input-9jE7tcJD.js"] + __vite__mapDeps.viteFileDeps = ["assets/portalLayers-Au1cdQPl.js","assets/requestPresets-f6ZAWLqV.js","assets/arcgisLayers-SSMNCJNX.js","assets/fetchService-cGWNcQnc.js","assets/WhereClause-FOYoIAAW.js","assets/TimeOnly-gkehHHJx.js","assets/arcadeUtils-vGyJZHQt.js","assets/hash-SS5GKVPY.js","assets/layersLoader-zT5u6Dmk.js","assets/layersCreator-kgscMbpL.js","assets/jsonContext-EgdQULbU.js","assets/BuildingSceneLayer-Bnoa9yAy.js","assets/BuildingComponentSublayer-0DIX8n0s.js","assets/FeatureLayer-9tNCmEbA.js","assets/FeatureLayerBase-mvqC7cJs.js","assets/serviceCapabilitiesUtils-f-iBP4uh.js","assets/editsZScale-4-dTv58d.js","assets/CustomParametersMixin-7nmugR3Y.js","assets/FeatureEffectLayer-OK0TB5f6.js","assets/FeatureEffect-0Jn9Z0sQ.js","assets/FeatureReductionLayer-2X2_PJv9.js","assets/OrderedLayer-XNaJwl_G.js","assets/FeatureTemplate-vSzbyslg.js","assets/FeatureType-0WPvBvpQ.js","assets/versionUtils-idhrDltC.js","assets/BuildingGroupSublayer-UJvyv8qt.js","assets/CSVLayer-iQyfu2e9.js","assets/clientSideDefaults-63pOkJ4Y.js","assets/QueryEngineCapabilities-PzVpW5yD.js","assets/DimensionLayer-pDBYhz_R.js","assets/LengthDimension-tb0JjnxZ.js","assets/GeoJSONLayer--Go-c1Ql.js","assets/ImageryLayer-STU2SwYQ.js","assets/ImageHistogramParameters-qqqpsay3.js","assets/dataUtils-_QoSHbCE.js","assets/generateRendererUtils-3JJTfr19.js","assets/executeForIds-PXSIkRGk.js","assets/ImageryTileLayer-7zhL4pR_.js","assets/rasterProjectionHelper-3sL58SxG.js","assets/utils-7NyN8ES_.js","assets/IntegratedMeshLayer-cHWMTQWg.js","assets/SceneModification-E4lNPbBQ.js","assets/LinkChartLayer-bx0B-Kgd.js","assets/geohashUtils-U0jvYCSY.js","assets/FeatureStore-PXMUgn0j.js","assets/BoundsStore-_-dPK5c-.js","assets/PooledRBush-rhLtoPG7.js","assets/quickselect-0UUnLNDW.js","assets/QueryEngine-uvDs-vBe.js","assets/json-v6EOeNTY.js","assets/utils-jVYIoPxv.js","assets/optimizedFeatureQueryEngineAdapter-46ccFTR0.js","assets/MapImageLayer-oZq_Q4o2.js","assets/SublayersOwner-Hx1szNtg.js","assets/QueryTask-Di0fqnMV.js","assets/executeQueryPBF-P21isUTI.js","assets/MapNotesLayer-ldLz1FWK.js","assets/objectIdUtils-GktMsX8e.js","assets/MediaLayer-PKp6pKCX.js","assets/MediaElementView-pYfW8oR4.js","assets/normalizeUtilsSync-GeARMwm8.js","assets/OGCFeatureLayer-hko6jm86.js","assets/ogcFeatureUtils-8dWL_GtH.js","assets/geojson-162a_hNo.js","assets/date-be_IQzZd.js","assets/OpenStreetMapLayer-qslplUAm.js","assets/WebTileLayer-jfo0VJmw.js","assets/OrientedImageryLayer-F57-BGcl.js","assets/PointCloudLayer-EgPyZPkK.js","assets/PointCloudUniqueValueRenderer-mGlOSV4H.js","assets/RouteLayer-HsRHI0PF.js","assets/Stop-d3MLMjE8.js","assets/StreamLayer-FMdUAhtW.js","assets/SubtypeGroupLayer-lkxtOZrq.js","assets/TileLayer-RB9GhSe4.js","assets/VectorTileLayer-3l6dancR.js","assets/StyleRepository-TpBuuKhf.js","assets/TileClipper-NSFZXMR1.js","assets/definitions-SVBNHUSH.js","assets/WFSLayer-8l6HCYA6.js","assets/wfsUtils-vzWdLJRB.js","assets/xmlUtils-Q_9cB30b.js","assets/WMTSLayer-TE5fyme_.js","assets/groupLayerUtils-dIBU5FCY.js","assets/utils-YxtTVBu2.js","assets/statsWorker-Z_8Cn8It.js","assets/geometryEngineWorker-8ZL1nHC2.js","assets/geometryEngineJSON-0_tJeUzi.js","assets/CSVSourceWorker-4-dU7rZu.js","assets/ElevationSamplerWorker-k8_PEq10.js","assets/FeatureServiceSnappingSourceWorker-GdDLcUBl.js","assets/symbologySnappingCandidates-d1xE3f-Q.js","assets/GeoJSONSourceWorker-KDFieIXt.js","assets/sourceUtils-nEhsDpwC.js","assets/MemorySourceWorker-6wu4D2bo.js","assets/Pipeline-PlEwhMAg.js","assets/StreamFeatureManager-Iguqr18K.js","assets/labelPoint-1MOq4I_J.js","assets/createConnection-iXdhuUHv.js","assets/enums-uQoFEhYh.js","assets/number-sTjsTbdA.js","assets/PointCloudWorker-rfPDyXh6.js","assets/PointCloudWorkerUtil-uutRAft1.js","assets/RasterWorker-dDXhiR2p.js","assets/SceneLayerWorker-fjNBmTGi.js","assets/I3SNode-A9aOJfXV.js","assets/WFSSourceWorker-AqESE9b6.js","assets/WorkerTileHandler-znQwxG7k.js","assets/Rect-bBBxMtVp.js","assets/TurboLine-cWldrV9L.js","assets/BidiEngine-8z8MVveq.js","assets/Popup-a4-j6aRT.js","assets/featureUtils-aSzMyCi0.js","assets/AnchorElementViewModel-7brFN9z4.js","assets/ReactiveSet-_4-UpKXZ.js","assets/TileLayerView3D-KbvgzCEw.js","assets/LayerView3D-57OghbRh.js","assets/TiledLayerView3D-_U1Q993H.js","assets/LayerView-ixwLVnzr.js","assets/RefreshableLayerView-DVYs7L04.js","assets/MapServiceLayerViewHelper-45ApjWde.js","assets/drapedUtils-F1ywqHD-.js","assets/ElevationLayerView3D-fn8Lf5lz.js","assets/BaseDynamicLayerView3D-HrHMPsDQ.js","assets/DynamicLayerView3D-XykdNh09.js","assets/projectExtentUtils-Q4rXasWA.js","assets/ImageMaterial.glsl-PU0wbmEN.js","assets/BuildingSceneLayerView3D-9E-CA71T.js","assets/I3SMeshView3D-frxYFPRW.js","assets/I3SOverrides-XXafrk1K.js","assets/meshFeatureSet-42GYfSGc.js","assets/External-Pb5poJ0S.js","assets/FeatureLayerView3D-vzwVkoh-.js","assets/FeatureLayerViewBase3D-W0Qwl4g_.js","assets/HeatmapDensity.glsl-de3m0xZZ.js","assets/dehydratedFeatureComparison-IJSogXWn.js","assets/queryForSymbologySnapping-MXWRIdj-.js","assets/Graphics3DObjectStates-JUKhPt0b.js","assets/EventedSet-TJfupI82.js","assets/I3SQueryFeatureStore-LSdoLFw0.js","assets/DefinitionExpressionSceneLayerView-Z1V4X6Kq.js","assets/CSVLayerView3D-WZv0l0uX.js","assets/DimensionLayerView3D-fNUV7ooO.js","assets/GeoJSONLayerView3D-lumzM4UY.js","assets/GraphicsLayerView3D-WVV0TMGR.js","assets/GraphicsProcessor-QBvSewdt.js","assets/GroupLayerView-Ck4zCvvf.js","assets/ImageryLayerView3D-BaVb1zzV.js","assets/IntegratedMeshLayerView3D-3obO3XcM.js","assets/LineOfSightLayerView3D-uRdo1RJr.js","assets/MapImageLayerView3D-XQURj3BI.js","assets/MediaLayerView3D-LfY78zh1.js","assets/OGCFeatureLayerView3D-a9b4I66a.js","assets/PointCloudLayerView3D-LHTTpHpk.js","assets/PopupSceneLayerView-1BvuVn-Q.js","assets/VoxelLayerView3D-4VCjvhwH.js","assets/RouteLayerView3D-EnI30QTX.js","assets/SceneLayerView3D-wSIS3UPq.js","assets/SceneLayerView-Z2vMKB9z.js","assets/SceneLayerGraphicsView3D-KM9RpQwS.js","assets/StreamLayerView3D-kATjjzFd.js","assets/ImageryTileLayerView3D-OR6Vjdkd.js","assets/VectorTileLayerView3D-eTryeubP.js","assets/rasterizingUtils-_-kX1RtA.js","assets/vec4f32-NvfHy9q7.js","assets/GeometryUtils-K2DOc0l8.js","assets/WFSLayerView3D-_qadKQVq.js","assets/WMSLayerView3D-OqbPQcsr.js","assets/WMTSLayerView3D-6XYesvf9.js","assets/AreaMeasurementAnalysisView3D-RBc-E7CZ.js","assets/AnalysisView3D-XCzG0Hzh.js","assets/interfaces-tkyofe_Z.js","assets/measurementUtils-U47xEmCr.js","assets/UnitNormalizer-RQizSo9a.js","assets/euclideanAreaMeasurementUtils-jpli3_gk.js","assets/measurementUtils-69EiqRp6.js","assets/LineVisualElement-iKo1s90I.js","assets/Object3DVisualElement-8HoU366x.js","assets/VisualElement--2Scr6Yq.js","assets/EditGeometryOperations-vpHcsZOg.js","assets/quantityFormatUtils-oYgdvR_2.js","assets/Segment-TQS1M_Ix.js","assets/TextOverlayItem-YHZxWGyg.js","assets/DimensionAnalysisView3D-6H84TLcJ.js","assets/euclideanLengthMeasurementUtils-Kj2RYqri.js","assets/ShadedColorMaterial.glsl-L0JVQzbX.js","assets/dragEventPipeline3D-H_IlIVP7.js","assets/InteractiveToolBase-6mltmL27.js","assets/drawUtils-0wb2c6-q.js","assets/Factory-EVPOwZPk.js","assets/SnappingVisualizer3D-PUGfSdbO.js","assets/ExtendedLineVisualElement-VJvEdv3K.js","assets/EngineVisualElement-u0-BOxGn.js","assets/Laserlines.glsl-U7nZFq0e.js","assets/PointVisualElement-m9C0-AJh.js","assets/RightAngleQuadVisualElement-Jj11oqLR.js","assets/SnappingContext-ax0tf6c6.js","assets/PointSnappingHint-bwlQAyn6.js","assets/VerticesVisualElement-QZStMB48.js","assets/SceneSnappingManagerPool-V-V1M2q0.js","assets/SnappingDragPipelineStep-HDAWWRgo.js","assets/SnappingOperation-hED0OM8D.js","assets/AnalysisToolBase-olyQy6lh.js","assets/analysisViewUtils-lJExoyyw.js","assets/DirectLineMeasurementAnalysisView3D-iWb0_QxT.js","assets/interfaces-lHX1zDRv.js","assets/LineOfSightAnalysisView3D-oCrG9jF8.js","assets/manipulatorUtils-165rCtzd.js","assets/SliceAnalysisView3D--Kqu5Yhm.js","assets/SlicePlaneMaterial.glsl-xVEc2mct.js","assets/CIMSymbolRasterizer-uvvL-Oh3.js","assets/cimAnalyzer-X6MTpVAO.js","assets/TerrainTileTree3DDebugger-3kUE1gqF.js","assets/TileTreeDebugger-MxH50s1q.js","assets/calcite-button-rIOy-85Y.js","assets/button-4hsayCiP.js","assets/form-1U5Kiwxm.js","assets/interactive-9W9APeiw.js","assets/label2-JXqLMBYY.js","assets/loadable-uNbe2Ndt.js","assets/locale-tKMV0J87.js","assets/key-qdHumIlA.js","assets/observers-eNe735aq.js","assets/component-dtiBfYiX.js","assets/t9n-KLe7iM0R.js","assets/icon-BW6RCrUr.js","assets/loader-plQ4Tft5.js","assets/guid-6vN-YNJI.js","assets/calcite-icon-ZhRmLRGh.js","assets/FeatureTileTree3DDebugger-y_91jAgc.js","assets/GraphicsView3D-o82vqKJR.js","assets/calcite-tooltip-ewJ_kzN3.js","assets/floating-ui-C10Xvlxv.js","assets/debounce-HnHf1UOZ.js","assets/openCloseComponent-lU2sdEaR.js","assets/FloatingArrow-FUeqM5kw.js","assets/calcite-scrim-eUqm3Zfl.js","assets/scrim-yAG2Pcs1.js","assets/calcite-chip-SaUQXOua.js","assets/conditionalSlot-OgY0Ln74.js","assets/previewCIMSymbol-mCxoLtDl.js","assets/FeatureServiceSnappingSource-LrGkMfSm.js","assets/queryEngineUtils-bbt-XRJJ.js","assets/VertexSnappingCandidate-YEvkEqQJ.js","assets/FeatureCollectionSnappingSource-noadiOim.js","assets/GraphicsSnappingSource-0y5Y2-KL.js","assets/SceneLayerSnappingSource-wfFr0F0T.js","assets/editingTools-KuLEWRoO.js","assets/SnappingVisualizer2D-JqQy3X5x.js","assets/editPlaneUtils-TRKNVTzb.js","assets/drawSurfaces-t1mGEx1r.js","assets/Tooltip-a9KqLK1p.js","assets/automaticAreaMeasurementUtils-kRuWnHc-.js","assets/GraphicManipulator-59Uc2I6c.js","assets/editingTools-ht4PZFTE.js","assets/GraphicState-JOHpeXmF.js","assets/TranslateTooltipInfos-DywsDtXz.js","assets/ExtentTooltipInfos-EukgtOIT.js","assets/GraphicMover-kaBR5sTE.js","assets/Box-7JWnlTvk.js","assets/settings-QjT8PN4S.js","assets/Reshape-c3RtsBQr.js","assets/calcite-dropdown-r3pviJNw.js","assets/calcite-dropdown-group-5Uhho6JI.js","assets/resources2-gI505pgk.js","assets/calcite-dropdown-item-UdaqM-Sc.js","assets/calcite-checkbox-u3DU2spl.js","assets/calcite-label-DHrtVvrs.js","assets/calcite-option-XCvROySu.js","assets/calcite-select-h4uorzoD.js","assets/ElevationProfileView2D-5R-6KsXv.js","assets/HoveredPoints-dZcdNiOr.js","assets/ElevationProfileView3D-ffQcLfOL.js","assets/calcite-action-GYDrwtQs.js","assets/action-bN6v5--b.js","assets/calcite-popover-Lvoq79Pm.js","assets/popover-QEcoULsC.js","assets/calcite-loader-IfjW-6zZ.js","assets/chartUtils-24xN4NV-.js","assets/Responsive-QlPOQ03r.js","assets/Theme-5CV7oVsW.js","assets/chartUtilsAm5-owLhGEU2.js","assets/Tooltip-4JsqFz5S.js","assets/DefaultTheme-uOYPzulo.js","assets/LineSeries-yr_9erUD.js","assets/ColorSet-tH4rJdGx.js","assets/Tick-bu1aEuYp.js","assets/Button-HXGuX8_s.js","assets/AreaMeasurement2D-GQCBQvJv.js","assets/Draw-yCejAdh-.js","assets/MeasurementWidgetContent-PH9XFoV4.js","assets/AreaMeasurement3D-ZnoqUVHu.js","assets/InteractiveAnalysisViewModel-jrNLjGZR.js","assets/DistanceMeasurement2D-Ss5XZk94.js","assets/DirectLineMeasurement3D-D1LkQv4r.js","assets/calcite-color-picker--cLRGCVy.js","assets/progress-TBzcAK5D.js","assets/math-SoUQJWjz.js","assets/calcite-slider-czDRxbAt.js","assets/calcite-list-item-ewhQm-Oo.js","assets/utils3--QEgMxFs.js","assets/calcite-list-KbTGTbJq.js","assets/input-_z9XIoLu.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/input-9jE7tcJD.js b/dist/assets/input-_z9XIoLu.js similarity index 98% rename from dist/assets/input-9jE7tcJD.js rename to dist/assets/input-_z9XIoLu.js index 341b567..4b976ac 100644 --- a/dist/assets/input-9jE7tcJD.js +++ b/dist/assets/input-_z9XIoLu.js @@ -1,4 +1,4 @@ -import{q as k,H as z,r as g,db as y,B as I,dc as x,ch as V,t as n,dd as E,x as H}from"./index-J0iiHjMT.js";import{s as C,c as S,d as D,H as L}from"./form-2Iq0hI3D.js";import{c as N,d as O,u as B}from"./interactive-NKzPUNL4.js";import{n as T}from"./key-qdHumIlA.js";import{c as F,d as A,g as v}from"./label2-d2vWQ7x7.js";import{s as P,a as K,c as U}from"./loadable-sxY2K1G3.js";import{n as o,i as p,p as j,s as M,a as W,c as R,d as q,B as $}from"./locale-pfkq1d6A.js";import{c as _}from"./observers-JyBmMU24.js";import{u as G,c as Y,d as Z,s as J}from"./t9n-od6MEnI1.js";import{g as f}from"./component-dtiBfYiX.js";import{d as Q}from"./icon-ZwpY5ksA.js";import{d as X}from"./progress-puB9lhY4.js";/*! +import{p as k,H as z,d as g,db as y,m as I,dc as x,aS as V,k as n,dd as E,l as H}from"./index-pCX-0tJH.js";import{s as C,c as S,d as D,H as L}from"./form-1U5Kiwxm.js";import{c as N,d as O,u as B}from"./interactive-9W9APeiw.js";import{n as T}from"./key-qdHumIlA.js";import{c as F,d as A,g as v}from"./label2-JXqLMBYY.js";import{s as P,a as K,c as U}from"./loadable-uNbe2Ndt.js";import{n as o,i as p,p as j,s as M,a as W,c as R,d as q,B as $}from"./locale-tKMV0J87.js";import{c as _}from"./observers-eNe735aq.js";import{u as G,c as Y,d as Z,s as J}from"./t9n-KLe7iM0R.js";import{g as f}from"./component-dtiBfYiX.js";import{d as Q}from"./icon-BW6RCrUr.js";import{d as X}from"./progress-TBzcAK5D.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/interactive-NKzPUNL4.js b/dist/assets/interactive-9W9APeiw.js similarity index 98% rename from dist/assets/interactive-NKzPUNL4.js rename to dist/assets/interactive-9W9APeiw.js index aebe550..1b51bb6 100644 --- a/dist/assets/interactive-NKzPUNL4.js +++ b/dist/assets/interactive-9W9APeiw.js @@ -1,4 +1,4 @@ -import"./index-J0iiHjMT.js";/*! +import"./index-pCX-0tJH.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/jsonContext-cWV_-jAj.js b/dist/assets/jsonContext-EgdQULbU.js similarity index 92% rename from dist/assets/jsonContext-cWV_-jAj.js rename to dist/assets/jsonContext-EgdQULbU.js index 187bd09..07785e0 100644 --- a/dist/assets/jsonContext-cWV_-jAj.js +++ b/dist/assets/jsonContext-EgdQULbU.js @@ -1 +1 @@ -import{bV as e,bS as o}from"./index-J0iiHjMT.js";function i(t){return{origin:"portal-item",url:e(t.itemUrl),portal:t.portal||o.getDefault(),portalItem:t,readResourcePaths:[]}}function n(t){const r=e(t.itemUrl);return{origin:"portal-item",messages:[],writtenProperties:[],url:r,portal:t.portal||o.getDefault(),portalItem:t,verifyItemRelativeUrls:r?{rootPath:r.path,writtenUrls:[]}:null,blockedRelativeUrls:[]}}function p(t){return{origin:"web-map",url:e(t.itemUrl),portal:t.portal||o.getDefault(),portalItem:t,readResourcePaths:[]}}function s(t,r){const l=e(t.itemUrl);return{origin:"web-map",messages:[],writtenProperties:[],url:l,portal:t.portal||o.getDefault(),portalItem:t,initiator:r,verifyItemRelativeUrls:l?{rootPath:l.path,writtenUrls:[]}:null,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}}export{s as a,i as e,p as l,n as o}; +import{au as e,ar as o}from"./index-pCX-0tJH.js";function i(t){return{origin:"portal-item",url:e(t.itemUrl),portal:t.portal||o.getDefault(),portalItem:t,readResourcePaths:[]}}function n(t){const r=e(t.itemUrl);return{origin:"portal-item",messages:[],writtenProperties:[],url:r,portal:t.portal||o.getDefault(),portalItem:t,verifyItemRelativeUrls:r?{rootPath:r.path,writtenUrls:[]}:null,blockedRelativeUrls:[]}}function p(t){return{origin:"web-map",url:e(t.itemUrl),portal:t.portal||o.getDefault(),portalItem:t,readResourcePaths:[]}}function s(t,r){const l=e(t.itemUrl);return{origin:"web-map",messages:[],writtenProperties:[],url:l,portal:t.portal||o.getDefault(),portalItem:t,initiator:r,verifyItemRelativeUrls:l?{rootPath:l.path,writtenUrls:[]}:null,blockedRelativeUrls:[],resources:{toAdd:[],toUpdate:[],toKeep:[],pendingOperations:[]}}}export{s as a,i as e,p as l,n as o}; diff --git a/dist/assets/label2-d2vWQ7x7.js b/dist/assets/label2-JXqLMBYY.js similarity index 58% rename from dist/assets/label2-d2vWQ7x7.js rename to dist/assets/label2-JXqLMBYY.js index 6c382e7..99ef3a6 100644 --- a/dist/assets/label2-d2vWQ7x7.js +++ b/dist/assets/label2-JXqLMBYY.js @@ -1,5 +1,5 @@ -import{co as g,z as k,cm as m}from"./index-J0iiHjMT.js";/*! +import{aZ as g,q as k,aX as M}from"./index-pCX-0tJH.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const C="calciteInternalLabelClick",f="calciteInternalLabelConnected",E="calciteInternalLabelDisconnected",L="calcite-label",c=new WeakMap,r=new WeakMap,b=new WeakMap,d=new WeakMap,i=new WeakSet,M=e=>{const{id:t}=e,l=t&&k(e,{selector:`${L}[for="${t}"]`});if(l)return l;const s=m(e,L);return!s||w(s,e)?null:s};function w(e,t){let l;const s="custom-element-ancestor-check",o=a=>{a.stopImmediatePropagation();const n=a.composedPath();l=n.slice(n.indexOf(t),n.indexOf(e))};return e.addEventListener(s,o,{once:!0}),t.dispatchEvent(new CustomEvent(s,{composed:!0,bubbles:!0})),e.removeEventListener(s,o),l.filter(a=>a!==t&&a!==e).filter(a=>{var n;return(n=a.tagName)==null?void 0:n.includes("-")}).length>0}function D(e){const t=M(e.el);if(r.has(t)&&t===e.labelEl||!t&&i.has(e))return;const l=x.bind(e);if(t){e.labelEl=t;const s=c.get(t)||[];s.push(e),c.set(t,s.sort(v)),r.has(e.labelEl)||(r.set(e.labelEl,h),e.labelEl.addEventListener(C,h)),i.delete(e),document.removeEventListener(f,b.get(e)),d.set(e,l),document.addEventListener(E,l)}else i.has(e)||(l(),document.removeEventListener(E,d.get(e)))}function W(e){if(i.delete(e),document.removeEventListener(f,b.get(e)),document.removeEventListener(E,d.get(e)),b.delete(e),d.delete(e),!e.labelEl)return;const t=c.get(e.labelEl);t.length===1&&(e.labelEl.removeEventListener(C,r.get(e.labelEl)),r.delete(e.labelEl)),c.set(e.labelEl,t.filter(l=>l!==e).sort(v)),e.labelEl=null}function v(e,t){return g(e.el,t.el)?-1:1}function y(e){var t,l;return e.label||((l=(t=e.labelEl)==null?void 0:t.textContent)==null?void 0:l.trim())||""}function h(e){const t=e.detail.sourceEvent.target,l=c.get(this),s=l.find(a=>a.el===t);if(l.includes(s))return;const u=l[0];u.disabled||u.onLabelClick(e)}function O(){i.has(this)&&D(this)}function x(){i.add(this);const e=b.get(this)||O.bind(this);b.set(this,e),document.addEventListener(f,e)}export{E as a,D as c,W as d,y as g,f as l}; + */const C="calciteInternalLabelClick",f="calciteInternalLabelConnected",E="calciteInternalLabelDisconnected",L="calcite-label",c=new WeakMap,r=new WeakMap,b=new WeakMap,d=new WeakMap,i=new WeakSet,m=e=>{const{id:t}=e,l=t&&k(e,{selector:`${L}[for="${t}"]`});if(l)return l;const a=M(e,L);return!a||w(a,e)?null:a};function w(e,t){let l;const a="custom-element-ancestor-check",o=s=>{s.stopImmediatePropagation();const n=s.composedPath();l=n.slice(n.indexOf(t),n.indexOf(e))};return e.addEventListener(a,o,{once:!0}),t.dispatchEvent(new CustomEvent(a,{composed:!0,bubbles:!0})),e.removeEventListener(a,o),l.filter(s=>s!==t&&s!==e).filter(s=>{var n;return(n=s.tagName)==null?void 0:n.includes("-")}).length>0}function D(e){const t=m(e.el);if(r.has(t)&&t===e.labelEl||!t&&i.has(e))return;const l=x.bind(e);if(t){e.labelEl=t;const a=c.get(t)||[];a.push(e),c.set(t,a.sort(v)),r.has(e.labelEl)||(r.set(e.labelEl,h),e.labelEl.addEventListener(C,h)),i.delete(e),document.removeEventListener(f,b.get(e)),d.set(e,l),document.addEventListener(E,l)}else i.has(e)||(l(),document.removeEventListener(E,d.get(e)))}function W(e){if(i.delete(e),document.removeEventListener(f,b.get(e)),document.removeEventListener(E,d.get(e)),b.delete(e),d.delete(e),!e.labelEl)return;const t=c.get(e.labelEl);t.length===1&&(e.labelEl.removeEventListener(C,r.get(e.labelEl)),r.delete(e.labelEl)),c.set(e.labelEl,t.filter(l=>l!==e).sort(v)),e.labelEl=null}function v(e,t){return g(e.el,t.el)?-1:1}function y(e){var t,l;return e.label||((l=(t=e.labelEl)==null?void 0:t.textContent)==null?void 0:l.trim())||""}function h(e){const t=e.detail.sourceEvent.target,l=c.get(this),a=l.find(s=>s.el===t);if(l.includes(a))return;const u=l[0];u.disabled||u.onLabelClick(e)}function O(){i.has(this)&&D(this)}function x(){i.add(this);const e=b.get(this)||O.bind(this);b.set(this,e),document.addEventListener(f,e)}export{E as a,D as c,W as d,y as g,f as l}; diff --git a/dist/assets/labelPoint-ysDT9nFH.js b/dist/assets/labelPoint-1MOq4I_J.js similarity index 85% rename from dist/assets/labelPoint-ysDT9nFH.js rename to dist/assets/labelPoint-1MOq4I_J.js index 948baba..ce2a4a4 100644 --- a/dist/assets/labelPoint-ysDT9nFH.js +++ b/dist/assets/labelPoint-1MOq4I_J.js @@ -1 +1 @@ -import{e_ as $,k7 as H,dz as et,eK as st,eI as it,eJ as ht,eH as nt,bI as K,k8 as rt,k9 as ot,ka as at,ae as Z,kb as pt,kc as ut}from"./index-J0iiHjMT.js";class Q{static fromOptimized(t,e,i=!1,h=!1){return new T().initialize(t,e,i,h,1)}static fromJSON(t,e=!1,i=!1){const[h,n]=Y(t);return new G().initialize(h,n,e,i,1)}static fromOptimizedCIM(t,e,i=!1,h=!1){return new L().initialize(t,e,i,h,1)}static fromJSONCIM(t,e=!1,i=!1){const[h,n]=Y(t);return new X().initialize(h,n,e,i,1)}static fromFeatureSetReader(t){const e=t.readGeometryForDisplay(),i=t.geometryType;return e&&i?this.fromOptimized(e,i):null}static fromFeatureSetReaderCIM(t){const e=t.readGeometryForDisplay(),i=t.geometryType;return e&&i?this.fromOptimizedCIM(e,i):null}static createEmptyOptimized(t,e=!1,i=!1){return new T().initialize(new $,t,e,i,1)}static createEmptyJSON(t,e=!1,i=!1){return new G().initialize([],t,e,i,1)}static createEmptyOptimizedCIM(t,e=!1,i=!1){return new L().initialize(new $,t,e,i,1)}static createEmptyJSONCIM(t,e=!1,i=!1){return new X().initialize([],t,e,i,1)}asJSON(){const t=H(this);return this.geometryType==="esriGeometryEnvelope"?{xmin:t[0][0][0],ymin:t[0][0][1],xmax:t[0][2][0],ymax:t[0][2][1]}:this.geometryType==="esriGeometryMultipoint"?{points:t.flat()}:this.geometryType==="esriGeometryPoint"?{x:t[0][0][0],y:t[0][0][1]}:this.geometryType==="esriGeometryPolygon"?{rings:t}:{paths:t}}getCurrentRingArea(){if(!this||this.pathSize<3)return 0;let t,e,i=0;if(this.seekPathStart(),!this.nextPoint())return 0;t=this.x,e=this.y;const h=t,n=e;for(;this.nextPoint();)i+=(t-this.x)*(e+this.y),t=this.x,e=this.y;return i+=(t-h)*(e+n),-.5*i}invertY(){this.yFactor*=-1}}let T=class U extends Q{constructor(){super(...arguments),this._end=-1}initialize(t,e,i,h,n){return this.hasZ=i,this.hasM=h,this.geometryType=e,this._stride=2+Number(i)+Number(h),this._geometry=t,this._pathIndex=-1,this._pathOffset=0,this._pointOffset=-this._stride,this._end=-1,this.yFactor=n,this}reset(){this.initialize(this._geometry,this.geometryType,this.hasZ,this.hasM,this.yFactor)}seekPath(t){if(t>=0&&tt)for(;this._pathIndex>t&&this.prevPath(););return!0}return!1}seekPathStart(){this._pointOffset=this._pathOffset-this._stride}seekPathEnd(){this._pointOffset=this._end}seekInPath(t){const e=this._pathOffset+t*this._stride;return e>=0&&e=this._pathOffset}nextPath(){if(this._pathIndex>=0){const e=this._geometry.isPoint?1:this._geometry.lengths[this._pathIndex];this._pathOffset+=this._stride*e}this._pointOffset=this._pathOffset-this._stride;const t=this._geometry.isPoint?1:this._geometry.lengths[this._pathIndex+1];return this._end=this._pointOffset+this._stride+this._stride*t,++this._pathIndex=0}pathLength(){const t=this._end,e=this._stride,i=this._geometry.coords;let h=0;for(let n=this._pathOffset+e;nt.length-1?0:t[this._pathIndex]}get totalSize(){return this._geometry.lengths.length}get x(){return this._geometry.coords[this._pointOffset]}set x(t){this._geometry.coords[this._pointOffset]=t}get y(){return this.yFactor*this._geometry.coords[this._pointOffset+1]}set y(t){this._geometry.coords[this._pointOffset+1]=this.yFactor*t}get z(){return this._geometry.coords[this._pointOffset+2]}set z(t){this._geometry.coords[this._pointOffset+2]=t}get m(){const t=this.hasZ?3:2;return this._geometry.coords[this._pointOffset+t]}set m(t){this._geometry.coords[this._pointOffset+3]=t}get pathIndex(){return this._pathIndex}get _coordIndex(){return this._pointOffset/this._stride}};function _t(s){const t=[s.x,s.y];return s.z&&t.push(s.z),s.m&&t.push(s.m),t}function Y(s){return et(s)?[s.rings,"esriGeometryPolygon"]:st(s)?[s.paths,"esriGeometryPolyline"]:it(s)?[[s.points],"esriGeometryMultipoint"]:ht(s)?[[[[s.xmin,s.ymin],[s.xmin,s.ymax],[s.xmax,s.ymax],[s.xmax,s.ymin],[s.xmin,s.ymin]]],"esriGeometryEnvelope"]:nt(s)?[[[_t(s)]],"esriGeometryPoint"]:[[],"esriGeometryPolyline"]}let G=class V extends Q{initialize(t,e,i,h,n){return this._paths=t,this.geometryType=e,this.hasZ=i,this.hasM=h,this._pathIndex=this._pointIndex=-1,this.yFactor=n,this._mIndex=this.hasZ?3:2,this}reset(){this._pathIndex=this._pointIndex=-1}seekPath(t){return t>=0&&t=0&&t=0}nextPath(){return this._pointIndex=-1,this._currentPath=this._paths[++this._pathIndex],this._pathIndex=0}pathLength(){const t=this._currentPath.length,e=this._currentPath;let i=0;for(let h=1;ht.length).reduce((t,e)=>t+e)}get pathSize(){return this._pathIndex<0||this._pathIndex>this.totalSize-1?-1:this._paths[this._pathIndex].length}get totalSize(){return this._paths.length}get x(){return this._currentPoint[0]}set x(t){this._currentPoint[0]=t}get y(){return this.yFactor*this._currentPoint[1]}set y(t){this._currentPoint[1]=this.yFactor*t}get z(){return this._currentPoint[2]}set z(t){this._currentPoint[2]=t}get m(){return this._currentPoint[this._mIndex]}set m(t){this._currentPoint[this._mIndex]=t}get pathIndex(){return this._pathIndex}};const S=4,M=1;let L=class W extends T{initialize(t,e,i,h,n){return super.initialize(t,e,i,h,n),this._controlPoints||(this._controlPoints=this._controlPoints=new Array(this.totalSize).fill(void 0).map(o=>new Set)),this}startPath(){super.startPath(),this._controlPoints.push(new Set)}clone(){const t=new W().initialize(this._geometry.clone(),this.geometryType,this.hasZ,this.hasM,this.yFactor);return t._controlPoints=this._controlPoints,t}setControlPoint(){this._controlPoints[this.pathIndex].add(this._coordIndex)}getControlPoint(){return this._controlPoints[this.pathIndex].has(this._coordIndex)}setControlPointAt(t){this._controlPoints[this.pathIndex].add(t)}getControlPointAt(t){return this._controlPoints[this.pathIndex].has(t)}},X=class tt extends G{initialize(t,e,i,h,n){return super.initialize(t,e,i,h,n)}clone(){return new tt().initialize(K(this._paths),this.geometryType,this.hasZ,this.hasM,1)}setControlPoint(){this._paths[this.pathIndex][this._pointIndex][S]=M}getControlPoint(){return this._paths[this.pathIndex][this._pointIndex][S]===M}setControlPointAt(t){this._paths[this.pathIndex][t][S]=M}getControlPointAt(t){return this._paths[this.pathIndex][t][S]===M}};const ct=100*222045e-21;function mt(s){if(s.totalSize===0)return null;const t=rt(s);if(!t)return null;const e=4*(Math.abs(t[0])+Math.abs(t[2])+Math.abs(t[1])+Math.abs(t[3])+1)*ct;let i=0,h=0;s.reset();for(let m=0;s.nextPath();m++){const g=s.getCurrentRingArea();g>h&&(h=g,i=m)}if(s.seekPath(i),s.pathSize===0)return null;s.seekPathStart();const n=ot(s);if(Math.abs(h)<=2*e*e)return[(n[0]+n[2])/2,(n[1]+n[3])/2];s.seekPathStart();const o=at(s,Z());if(o===null)return null;if(s.totalPoints<4)return o;const r=[[NaN,NaN],[NaN,NaN],[NaN,NaN],[NaN,NaN]],a=[NaN,NaN,NaN,NaN],u=[NaN,NaN,NaN,NaN];let _=!1,p=z(o,s,!0);p.distance===0&&(_=!0,r[0][0]=o[0],r[0][1]=o[1],p=z(o,s,!1)),a[0]=p.distance,u[0]=0;const f=[NaN,NaN];let l=!1,y=.25,d=-1,c=NaN;do if(c=NaN,r[1]=F(s,b(n[0],n[2],y),e,t),isNaN(r[1][0])||isNaN(r[1][1])||(p=z(r[1],s,!1),c=p.distance),!isNaN(c)&&c>e&&C(r[1],s))l=!0,a[1]=c,u[1]=N(r[1],o);else if(!isNaN(c)&&c>d&&(d=c,f[0]=r[1][0],f[1]=r[1][1]),y-=.01,y<.1){if(!(d>=0))break;l=!0,a[1]=d,r[1][0]=f[0],r[1][1]=f[1],u[1]=N(r[1],o)}while(!l);l=!1,y=.5,d=-1;let v=.01,E=1;do if(c=NaN,r[2]=F(s,b(n[0],n[2],y),e,t),isNaN(r[2][0])||isNaN(r[2][1])||(p=z(r[2],s,!1),c=p.distance),!isNaN(c)&&c>e&&C(r[2],s))l=!0,a[2]=c,u[2]=N(r[2],o);else if(!isNaN(c)&&c>d)d=c,f[0]=r[2][0],f[1]=r[2][1];else if(c>d&&(d=c,f[0]=r[2][0],f[1]=r[2][1]),y=.5+v*E,v+=.01,E*=-1,y<.3||y>.7){if(!(d>=0))break;l=!0,a[2]=d,r[2][0]=f[0],r[2][1]=f[1],u[2]=N(r[2],o)}while(!l);l=!1,y=.75,d=-1;do if(c=NaN,r[3]=F(s,b(n[0],n[2],y),e,t),isNaN(r[3][0])||isNaN(r[3][1])||(p=z(r[3],s,!1),c=p.distance),!isNaN(c)&&c>e&&C(r[3],s))l=!0,a[3]=c,u[3]=N(r[3],o);else if(c>d&&(d=c,f[0]=r[3][0],f[1]=r[3][1]),y+=.01,y>.9){if(!(d>=0))break;l=!0,a[3]=d,r[3][0]=f[0],r[3][1]=f[1],u[3]=N(r[3],o)}while(!l);const P=[0,1,2,3],O=_?0:1;let A;for(let m=O;m<4;m++)for(let g=O;g<3;g++){const q=u[g],D=u[g+1];ft(q,D)>0&&(A=P[g],P[g]=P[g+1],P[g+1]=A,u[g]=D,u[g+1]=q)}let J=O,R=0,I=0;for(let m=O;m<4;m++){switch(m){case 0:I=2*a[P[m]];break;case 1:I=1.66666666*a[P[m]];break;case 2:I=1.33333333*a[P[m]];break;case 3:I=a[P[m]]}I>R&&(R=I,J=P[m])}return r[J]}function C(s,t){let e,i,h,n,o=0;for(t.reset();t.nextPath()&&t.nextPoint();)for(e=t.x,i=t.y;t.nextPoint();e=h,i=n)h=t.x,n=t.y,i>s[1]!=n>s[1]&&((h-e)*(s[1]-i)-(n-i)*(s[0]-e)>0?o++:o--);return o!==0}function z(s,t,e){if(e&&C(s,t))return{coord:s,distance:0};let i=1/0,h=0,n=0,o=[0,0],r=[0,0];const a=[0,0];for(t.reset();t.nextPath()&&t.nextPoint();)if(!(t.pathSize<2))for(o[0]=t.x,o[1]=t.y;t.nextPoint();o=r){r=[t.x,t.y],pt(a,s,o,r);const u=N(s,a);uo?dp)i&j?(i&k?(t[1]+=p*(n-t[0])/_,t[0]=n):(t[1]+=p*(r-t[0])/_,t[0]=r),i=x(t,s)):h&j?(h&k?(e[1]+=p*(n-e[0])/_,e[0]=n):(e[1]+=p*(r-e[0])/_,e[0]=r),h=x(e,s)):i?(i&w?(t[0]+=_*(o-t[1])/p,t[1]=o):(t[0]+=_*(a-t[1])/p,t[1]=a),i=x(t,s)):(h&w?(e[0]+=_*(o-e[1])/p,e[1]=o):(e[0]+=_*(a-e[1])/p,e[1]=a),h=x(e,s));else if(i&B?(i&w?(t[0]+=_*(o-t[1])/p,t[1]=o):(t[0]+=_*(a-t[1])/p,t[1]=a),i=x(t,s)):h&B?(h&w?(e[0]+=_*(o-e[1])/p,e[1]=o):(e[0]+=_*(a-e[1])/p,e[1]=a),h=x(e,s)):i?(i&k?(t[1]+=p*(n-t[0])/_,t[0]=n):(t[1]+=p*(r-t[0])/_,t[0]=r),i=x(t,s)):(h&k?(e[1]+=p*(n-e[0])/_,e[0]=n):(e[1]+=p*(r-e[0])/_,e[0]=r),h=x(e,s)),i&h)return 0}while(i|h);return u}function x(s,t){return(s[0]t[2]?1:0)<<1|(s[1]t[3]?1:0)<<3}function b(s,t,e){return s+(t-s)*e}function N(s,t){return(s[0]-t[0])*(s[0]-t[0])+(s[1]-t[1])*(s[1]-t[1])}function ft(s,t){if(st)return 1;if(s===t)return 0;const e=isNaN(s),i=isNaN(t);return ei?1:0}export{Q as a,mt as l}; +import{eV as T,kf as Q,eE as et,eF as st,eC as it,eD as ht,eB as nt,ah as U,kg as rt,kh as ot,ki as at,cf as Z,kj as pt,kk as ut}from"./index-pCX-0tJH.js";class V{static fromOptimized(t,e,i=!1,h=!1){return new b().initialize(t,e,i,h,1)}static fromJSON(t,e=!1,i=!1){const[h,n]=Y(t);return new G().initialize(h,n,e,i,1)}static fromOptimizedCIM(t,e,i=!1,h=!1){return new j().initialize(t,e,i,h,1)}static fromJSONCIM(t,e=!1,i=!1){const[h,n]=Y(t);return new B().initialize(h,n,e,i,1)}static fromFeatureSetReader(t){const e=t.readGeometryForDisplay(),i=t.geometryType;return e&&i?this.fromOptimized(e,i):null}static fromFeatureSetReaderCIM(t){const e=t.readGeometryForDisplay(),i=t.geometryType;return e&&i?this.fromOptimizedCIM(e,i):null}static createEmptyOptimized(t,e=!1,i=!1){return new b().initialize(new T,t,e,i,1)}static createEmptyJSON(t,e=!1,i=!1){return new G().initialize([],t,e,i,1)}static createEmptyOptimizedCIM(t,e=!1,i=!1){return new j().initialize(new T,t,e,i,1)}static createEmptyJSONCIM(t,e=!1,i=!1){return new B().initialize([],t,e,i,1)}asJSON(){const t=Q(this);return this.geometryType==="esriGeometryEnvelope"?{xmin:t[0][0][0],ymin:t[0][0][1],xmax:t[0][2][0],ymax:t[0][2][1]}:this.geometryType==="esriGeometryMultipoint"?{points:t.flat()}:this.geometryType==="esriGeometryPoint"?{x:t[0][0][0],y:t[0][0][1]}:this.geometryType==="esriGeometryPolygon"?{rings:t}:{paths:t}}getCurrentRingArea(){if(!this||this.pathSize<3)return 0;let t,e,i=0;if(this.seekPathStart(),!this.nextPoint())return 0;t=this.x,e=this.y;const h=t,n=e;for(;this.nextPoint();)i+=(t-this.x)*(e+this.y),t=this.x,e=this.y;return i+=(t-h)*(e+n),-.5*i}invertY(){this.yFactor*=-1}}let b=class H extends V{constructor(){super(...arguments),this._end=-1}initialize(t,e,i,h,n){return this.hasZ=i,this.hasM=h,this.geometryType=e,this._stride=2+Number(i)+Number(h),this._geometry=t,this._pathIndex=-1,this._pathOffset=0,this._pointOffset=-this._stride,this._end=-1,this.yFactor=n,this}reset(){this.initialize(this._geometry,this.geometryType,this.hasZ,this.hasM,this.yFactor)}seekPath(t){if(t>=0&&tt)for(;this._pathIndex>t&&this.prevPath(););return!0}return!1}seekPathStart(){this._pointOffset=this._pathOffset-this._stride}seekPathEnd(){this._pointOffset=this._end}seekInPath(t){const e=this._pathOffset+t*this._stride;return e>=0&&e=this._pathOffset}nextPath(){if(this._pathIndex>=0){const e=this._geometry.isPoint?1:this._geometry.lengths[this._pathIndex];this._pathOffset+=this._stride*e}this._pointOffset=this._pathOffset-this._stride;const t=this._geometry.isPoint?1:this._geometry.lengths[this._pathIndex+1];return this._end=this._pointOffset+this._stride+this._stride*t,++this._pathIndex=0}pathLength(){const t=this._end,e=this._stride,i=this._geometry.coords;let h=0;for(let n=this._pathOffset+e;nt.length-1?0:t[this._pathIndex]}get totalSize(){return this._geometry.lengths.length}get x(){return this._geometry.coords[this._pointOffset]}set x(t){this._geometry.coords[this._pointOffset]=t}get y(){return this.yFactor*this._geometry.coords[this._pointOffset+1]}set y(t){this._geometry.coords[this._pointOffset+1]=this.yFactor*t}get z(){return this._geometry.coords[this._pointOffset+2]}set z(t){this._geometry.coords[this._pointOffset+2]=t}get m(){const t=this.hasZ?3:2;return this._geometry.coords[this._pointOffset+t]}set m(t){this._geometry.coords[this._pointOffset+3]=t}get pathIndex(){return this._pathIndex}get _coordIndex(){return this._pointOffset/this._stride}};function _t(s){const t=[s.x,s.y];return s.z&&t.push(s.z),s.m&&t.push(s.m),t}function Y(s){return et(s)?[s.rings,"esriGeometryPolygon"]:st(s)?[s.paths,"esriGeometryPolyline"]:it(s)?[[s.points],"esriGeometryMultipoint"]:ht(s)?[[[[s.xmin,s.ymin],[s.xmin,s.ymax],[s.xmax,s.ymax],[s.xmax,s.ymin],[s.xmin,s.ymin]]],"esriGeometryEnvelope"]:nt(s)?[[[_t(s)]],"esriGeometryPoint"]:[[],"esriGeometryPolyline"]}let G=class K extends V{initialize(t,e,i,h,n){return this._paths=t,this.geometryType=e,this.hasZ=i,this.hasM=h,this._pathIndex=this._pointIndex=-1,this.yFactor=n,this._mIndex=this.hasZ?3:2,this}reset(){this._pathIndex=this._pointIndex=-1}seekPath(t){return t>=0&&t=0&&t=0}nextPath(){return this._pointIndex=-1,this._currentPath=this._paths[++this._pathIndex],this._pathIndex=0}pathLength(){const t=this._currentPath.length,e=this._currentPath;let i=0;for(let h=1;ht.length).reduce((t,e)=>t+e)}get pathSize(){return this._pathIndex<0||this._pathIndex>this.totalSize-1?-1:this._paths[this._pathIndex].length}get totalSize(){return this._paths.length}get x(){return this._currentPoint[0]}set x(t){this._currentPoint[0]=t}get y(){return this.yFactor*this._currentPoint[1]}set y(t){this._currentPoint[1]=this.yFactor*t}get z(){return this._currentPoint[2]}set z(t){this._currentPoint[2]=t}get m(){return this._currentPoint[this._mIndex]}set m(t){this._currentPoint[this._mIndex]=t}get pathIndex(){return this._pathIndex}};const S=4,M=1;let j=class W extends b{initialize(t,e,i,h,n){return super.initialize(t,e,i,h,n),this._controlPoints||(this._controlPoints=this._controlPoints=new Array(this.totalSize).fill(void 0).map(o=>new Set)),this}startPath(){super.startPath(),this._controlPoints.push(new Set)}clone(){const t=new W().initialize(this._geometry.clone(),this.geometryType,this.hasZ,this.hasM,this.yFactor);return t._controlPoints=this._controlPoints,t}setControlPoint(){this._controlPoints[this.pathIndex].add(this._coordIndex)}getControlPoint(){return this._controlPoints[this.pathIndex].has(this._coordIndex)}setControlPointAt(t){this._controlPoints[this.pathIndex].add(t)}getControlPointAt(t){return this._controlPoints[this.pathIndex].has(t)}},B=class tt extends G{initialize(t,e,i,h,n){return super.initialize(t,e,i,h,n)}clone(){return new tt().initialize(U(this._paths),this.geometryType,this.hasZ,this.hasM,1)}setControlPoint(){this._paths[this.pathIndex][this._pointIndex][S]=M}getControlPoint(){return this._paths[this.pathIndex][this._pointIndex][S]===M}setControlPointAt(t){this._paths[this.pathIndex][t][S]=M}getControlPointAt(t){return this._paths[this.pathIndex][t][S]===M}};const ct=100*222045e-21;function mt(s){if(s.totalSize===0)return null;const t=rt(s);if(!t)return null;const e=4*(Math.abs(t[0])+Math.abs(t[2])+Math.abs(t[1])+Math.abs(t[3])+1)*ct;let i=0,h=0;s.reset();for(let m=0;s.nextPath();m++){const g=s.getCurrentRingArea();g>h&&(h=g,i=m)}if(s.seekPath(i),s.pathSize===0)return null;s.seekPathStart();const n=ot(s);if(Math.abs(h)<=2*e*e)return[(n[0]+n[2])/2,(n[1]+n[3])/2];s.seekPathStart();const o=at(s,Z());if(o===null)return null;if(s.totalPoints<4)return o;const r=[[NaN,NaN],[NaN,NaN],[NaN,NaN],[NaN,NaN]],a=[NaN,NaN,NaN,NaN],u=[NaN,NaN,NaN,NaN];let _=!1,p=z(o,s,!0);p.distance===0&&(_=!0,r[0][0]=o[0],r[0][1]=o[1],p=z(o,s,!1)),a[0]=p.distance,u[0]=0;const f=[NaN,NaN];let l=!1,y=.25,d=-1,c=NaN;do if(c=NaN,r[1]=F(s,$(n[0],n[2],y),e,t),isNaN(r[1][0])||isNaN(r[1][1])||(p=z(r[1],s,!1),c=p.distance),!isNaN(c)&&c>e&&C(r[1],s))l=!0,a[1]=c,u[1]=N(r[1],o);else if(!isNaN(c)&&c>d&&(d=c,f[0]=r[1][0],f[1]=r[1][1]),y-=.01,y<.1){if(!(d>=0))break;l=!0,a[1]=d,r[1][0]=f[0],r[1][1]=f[1],u[1]=N(r[1],o)}while(!l);l=!1,y=.5,d=-1;let v=.01,E=1;do if(c=NaN,r[2]=F(s,$(n[0],n[2],y),e,t),isNaN(r[2][0])||isNaN(r[2][1])||(p=z(r[2],s,!1),c=p.distance),!isNaN(c)&&c>e&&C(r[2],s))l=!0,a[2]=c,u[2]=N(r[2],o);else if(!isNaN(c)&&c>d)d=c,f[0]=r[2][0],f[1]=r[2][1];else if(c>d&&(d=c,f[0]=r[2][0],f[1]=r[2][1]),y=.5+v*E,v+=.01,E*=-1,y<.3||y>.7){if(!(d>=0))break;l=!0,a[2]=d,r[2][0]=f[0],r[2][1]=f[1],u[2]=N(r[2],o)}while(!l);l=!1,y=.75,d=-1;do if(c=NaN,r[3]=F(s,$(n[0],n[2],y),e,t),isNaN(r[3][0])||isNaN(r[3][1])||(p=z(r[3],s,!1),c=p.distance),!isNaN(c)&&c>e&&C(r[3],s))l=!0,a[3]=c,u[3]=N(r[3],o);else if(c>d&&(d=c,f[0]=r[3][0],f[1]=r[3][1]),y+=.01,y>.9){if(!(d>=0))break;l=!0,a[3]=d,r[3][0]=f[0],r[3][1]=f[1],u[3]=N(r[3],o)}while(!l);const P=[0,1,2,3],O=_?0:1;let A;for(let m=O;m<4;m++)for(let g=O;g<3;g++){const q=u[g],D=u[g+1];ft(q,D)>0&&(A=P[g],P[g]=P[g+1],P[g+1]=A,u[g]=D,u[g+1]=q)}let J=O,R=0,I=0;for(let m=O;m<4;m++){switch(m){case 0:I=2*a[P[m]];break;case 1:I=1.66666666*a[P[m]];break;case 2:I=1.33333333*a[P[m]];break;case 3:I=a[P[m]]}I>R&&(R=I,J=P[m])}return r[J]}function C(s,t){let e,i,h,n,o=0;for(t.reset();t.nextPath()&&t.nextPoint();)for(e=t.x,i=t.y;t.nextPoint();e=h,i=n)h=t.x,n=t.y,i>s[1]!=n>s[1]&&((h-e)*(s[1]-i)-(n-i)*(s[0]-e)>0?o++:o--);return o!==0}function z(s,t,e){if(e&&C(s,t))return{coord:s,distance:0};let i=1/0,h=0,n=0,o=[0,0],r=[0,0];const a=[0,0];for(t.reset();t.nextPath()&&t.nextPoint();)if(!(t.pathSize<2))for(o[0]=t.x,o[1]=t.y;t.nextPoint();o=r){r=[t.x,t.y],pt(a,s,o,r);const u=N(s,a);uo?dp)i&L?(i&k?(t[1]+=p*(n-t[0])/_,t[0]=n):(t[1]+=p*(r-t[0])/_,t[0]=r),i=x(t,s)):h&L?(h&k?(e[1]+=p*(n-e[0])/_,e[0]=n):(e[1]+=p*(r-e[0])/_,e[0]=r),h=x(e,s)):i?(i&w?(t[0]+=_*(o-t[1])/p,t[1]=o):(t[0]+=_*(a-t[1])/p,t[1]=a),i=x(t,s)):(h&w?(e[0]+=_*(o-e[1])/p,e[1]=o):(e[0]+=_*(a-e[1])/p,e[1]=a),h=x(e,s));else if(i&X?(i&w?(t[0]+=_*(o-t[1])/p,t[1]=o):(t[0]+=_*(a-t[1])/p,t[1]=a),i=x(t,s)):h&X?(h&w?(e[0]+=_*(o-e[1])/p,e[1]=o):(e[0]+=_*(a-e[1])/p,e[1]=a),h=x(e,s)):i?(i&k?(t[1]+=p*(n-t[0])/_,t[0]=n):(t[1]+=p*(r-t[0])/_,t[0]=r),i=x(t,s)):(h&k?(e[1]+=p*(n-e[0])/_,e[0]=n):(e[1]+=p*(r-e[0])/_,e[0]=r),h=x(e,s)),i&h)return 0}while(i|h);return u}function x(s,t){return(s[0]t[2]?1:0)<<1|(s[1]t[3]?1:0)<<3}function $(s,t,e){return s+(t-s)*e}function N(s,t){return(s[0]-t[0])*(s[0]-t[0])+(s[1]-t[1])*(s[1]-t[1])}function ft(s,t){if(st)return 1;if(s===t)return 0;const e=isNaN(s),i=isNaN(t);return ei?1:0}export{V as a,mt as l}; diff --git a/dist/assets/layersCreator-aC1PvuFa.js b/dist/assets/layersCreator-kgscMbpL.js similarity index 95% rename from dist/assets/layersCreator-aC1PvuFa.js rename to dist/assets/layersCreator-kgscMbpL.js index c33253a..10fc39e 100644 --- a/dist/assets/layersCreator-aC1PvuFa.js +++ b/dist/assets/layersCreator-kgscMbpL.js @@ -1 +1 @@ -import{dl as M,dj as L,bR as I,V as A}from"./index-J0iiHjMT.js";import{L as b,e as v}from"./portalLayers-AqjAd9kT.js";import"./requestPresets-18nzHK5y.js";function w(e){return S(e,"notes")}function h(e){return S(e,"markup")}function F(e){return S(e,"route")}function S(e,r){return!(!e.layerType||e.layerType!=="ArcGISFeatureLayer")&&e.featureCollectionType===r}async function C(e,r,a){if(!r)return;const t=[];for(const y of r)t.push(x(y,a));const i=await Promise.allSettled(t);for(const y of i)y.status==="rejected"||y.value&&e.add(y.value)}const W={ArcGISDimensionLayer:"DimensionLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",PointCloudLayer:"PointCloudLayer",ArcGISSceneServiceLayer:"SceneLayer",IntegratedMeshLayer:"IntegratedMeshLayer",OGCFeatureLayer:"OGCFeatureLayer",BuildingSceneLayer:"BuildingSceneLayer",ArcGISTiledElevationServiceLayer:"ElevationLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",GroupLayer:"GroupLayer",GeoJSON:"GeoJSONLayer",WebTiledLayer:"WebTileLayer",CSV:"CSVLayer",VectorTileLayer:"VectorTileLayer",WFS:"WFSLayer",WMS:"WMSLayer",DefaultTileLayer:"TileLayer",KML:"KMLLayer",RasterDataLayer:"UnsupportedLayer",Voxel:"VoxelLayer",LineOfSightLayer:"LineOfSightLayer"},O={ArcGISTiledElevationServiceLayer:"ElevationLayer",DefaultTileLayer:"ElevationLayer",RasterDataElevationLayer:"UnsupportedLayer"},V={ArcGISFeatureLayer:"FeatureLayer"},k={ArcGISTiledMapServiceLayer:"TileLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",OpenStreetMap:"OpenStreetMapLayer",WebTiledLayer:"WebTileLayer",VectorTileLayer:"VectorTileLayer",ArcGISImageServiceLayer:"UnsupportedLayer",WMS:"UnsupportedLayer",ArcGISMapServiceLayer:"UnsupportedLayer",ArcGISSceneServiceLayer:"SceneLayer",DefaultTileLayer:"TileLayer"},T={ArcGISAnnotationLayer:"UnsupportedLayer",ArcGISDimensionLayer:"UnsupportedLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISStreamLayer:"StreamLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BingMapsAerial:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",CSV:"CSVLayer",DefaultTileLayer:"TileLayer",GeoRSS:"GeoRSSLayer",GeoJSON:"GeoJSONLayer",GroupLayer:"GroupLayer",KML:"KMLLayer",MediaLayer:"MediaLayer",OGCFeatureLayer:"OGCFeatureLayer",OrientedImageryLayer:"OrientedImageryLayer",SubtypeGroupLayer:"SubtypeGroupLayer",VectorTileLayer:"VectorTileLayer",WFS:"WFSLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},f={ArcGISFeatureLayer:"FeatureLayer"},G={ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",OpenStreetMap:"OpenStreetMapLayer",VectorTileLayer:"VectorTileLayer",WebTiledLayer:"WebTileLayer",BingMapsAerial:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",WMS:"WMSLayer",DefaultTileLayer:"TileLayer"},B={...T,LinkChartLayer:"LinkChartLayer"},D={...f},U={...G};async function x(e,r){return E(await R(e,r),e,r)}async function E(e,r,a){const t=new e;return t.read(r,a.context),t.type==="group"&&(r.layerType==="GroupLayer"?await J(t,r,a):p(r)?K(t,r,a.context):g(r)&&await P(t,r,a.context)),await M(t,a.context),t}async function R(e,r){var c,o;const a=r.context,t=N(a);let i=e.layerType||e.type;!i&&(r!=null&&r.defaultLayerType)&&(i=r.defaultLayerType);const y=t[i];let n=y?L[y]:L.UnknownLayer;if(p(e)){const s=a==null?void 0:a.portal;if(e.itemId){const l=new I({id:e.itemId,portal:s});await l.load();const u=(await b(l,new v)).className||"UnknownLayer";n=L[u]}}else i==="ArcGISFeatureLayer"?w(e)||h(e)?n=L.MapNotesLayer:F(e)?n=L.RouteLayer:g(e)&&(n=L.GroupLayer):(c=e.wmtsInfo)!=null&&c.url&&e.wmtsInfo.layerIdentifier?n=L.WMTSLayer:i==="WFS"&&((o=e.wfsInfo)==null?void 0:o.version)!=="2.0.0"&&(n=L.UnsupportedLayer);return n()}function g(e){var r,a;return e.layerType!=="ArcGISFeatureLayer"||p(e)?!1:(((a=(r=e.featureCollection)==null?void 0:r.layers)==null?void 0:a.length)??0)>1}function p(e){return e.type==="Feature Collection"}function N(e){let r;switch(e.origin){case"web-scene":switch(e.layerContainerType){case"basemap":r=k;break;case"ground":r=O;break;case"tables":r=V;break;default:r=W}break;case"link-chart":switch(e.layerContainerType){case"basemap":r=U;break;case"tables":r=D;break;default:r=B}break;default:switch(e.layerContainerType){case"basemap":r=G;break;case"tables":r=f;break;default:r=T}}return r}async function J(e,r,a){const t=new A,i=C(t,Array.isArray(r.layers)?r.layers:[],a);try{try{if(await i,e.type==="group")return e.layers.addMany(t),e}catch(y){e.destroy();for(const n of t)n.destroy();throw y}}catch(y){throw y}}function K(e,r,a){r.itemId&&(e.portalItem=new I({id:r.itemId,portal:a==null?void 0:a.portal}),e.when(()=>{var i,y;const t=n=>{var s,l;const c=n.layerId;m(n,e,r,c,a);const o=(l=(s=r.featureCollection)==null?void 0:s.layers)==null?void 0:l[c];o&&n.read(o,a)};(i=e.layers)==null||i.forEach(t),(y=e.tables)==null||y.forEach(t)}))}async function P(e,r,a){var o;const t=L.FeatureLayer,i=await t(),y=r.featureCollection,n=y==null?void 0:y.showLegend,c=(o=y==null?void 0:y.layers)==null?void 0:o.map((s,l)=>{const u=new i;u.read(s,a);const d={...a,ignoreDefaults:!0};return m(u,e,r,l,d),n!=null&&u.read({showLegend:n},d),u});e.layers.addMany(c??[])}function m(e,r,a,t,i){var y;e.read({id:`${r.id}-sublayer-${t}`,visibility:((y=a.visibleLayers)==null?void 0:y.includes(t))??!0},i)}export{J as populateGroupLayer,C as populateOperationalLayers}; +import{dl as M,dj as L,aq as I,V as A}from"./index-pCX-0tJH.js";import{L as v,e as b}from"./portalLayers-Au1cdQPl.js";import"./requestPresets-f6ZAWLqV.js";function w(e){return S(e,"notes")}function h(e){return S(e,"markup")}function F(e){return S(e,"route")}function S(e,r){return!(!e.layerType||e.layerType!=="ArcGISFeatureLayer")&&e.featureCollectionType===r}async function C(e,r,a){if(!r)return;const t=[];for(const y of r)t.push(x(y,a));const i=await Promise.allSettled(t);for(const y of i)y.status==="rejected"||y.value&&e.add(y.value)}const W={ArcGISDimensionLayer:"DimensionLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",PointCloudLayer:"PointCloudLayer",ArcGISSceneServiceLayer:"SceneLayer",IntegratedMeshLayer:"IntegratedMeshLayer",OGCFeatureLayer:"OGCFeatureLayer",BuildingSceneLayer:"BuildingSceneLayer",ArcGISTiledElevationServiceLayer:"ElevationLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",GroupLayer:"GroupLayer",GeoJSON:"GeoJSONLayer",WebTiledLayer:"WebTileLayer",CSV:"CSVLayer",VectorTileLayer:"VectorTileLayer",WFS:"WFSLayer",WMS:"WMSLayer",DefaultTileLayer:"TileLayer",KML:"KMLLayer",RasterDataLayer:"UnsupportedLayer",Voxel:"VoxelLayer",LineOfSightLayer:"LineOfSightLayer"},O={ArcGISTiledElevationServiceLayer:"ElevationLayer",DefaultTileLayer:"ElevationLayer",RasterDataElevationLayer:"UnsupportedLayer"},V={ArcGISFeatureLayer:"FeatureLayer"},k={ArcGISTiledMapServiceLayer:"TileLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",OpenStreetMap:"OpenStreetMapLayer",WebTiledLayer:"WebTileLayer",VectorTileLayer:"VectorTileLayer",ArcGISImageServiceLayer:"UnsupportedLayer",WMS:"UnsupportedLayer",ArcGISMapServiceLayer:"UnsupportedLayer",ArcGISSceneServiceLayer:"SceneLayer",DefaultTileLayer:"TileLayer"},T={ArcGISAnnotationLayer:"UnsupportedLayer",ArcGISDimensionLayer:"UnsupportedLayer",ArcGISFeatureLayer:"FeatureLayer",ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISStreamLayer:"StreamLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",BingMapsAerial:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",CSV:"CSVLayer",DefaultTileLayer:"TileLayer",GeoRSS:"GeoRSSLayer",GeoJSON:"GeoJSONLayer",GroupLayer:"GroupLayer",KML:"KMLLayer",MediaLayer:"MediaLayer",OGCFeatureLayer:"OGCFeatureLayer",OrientedImageryLayer:"OrientedImageryLayer",SubtypeGroupLayer:"SubtypeGroupLayer",VectorTileLayer:"VectorTileLayer",WFS:"WFSLayer",WMS:"WMSLayer",WebTiledLayer:"WebTileLayer"},f={ArcGISFeatureLayer:"FeatureLayer"},G={ArcGISImageServiceLayer:"ImageryLayer",ArcGISImageServiceVectorLayer:"ImageryLayer",ArcGISMapServiceLayer:"MapImageLayer",ArcGISTiledImageServiceLayer:"ImageryTileLayer",ArcGISTiledMapServiceLayer:"TileLayer",OpenStreetMap:"OpenStreetMapLayer",VectorTileLayer:"VectorTileLayer",WebTiledLayer:"WebTileLayer",BingMapsAerial:"BingMapsLayer",BingMapsRoad:"BingMapsLayer",BingMapsHybrid:"BingMapsLayer",WMS:"WMSLayer",DefaultTileLayer:"TileLayer"},B={...T,LinkChartLayer:"LinkChartLayer"},D={...f},U={...G};async function x(e,r){return E(await R(e,r),e,r)}async function E(e,r,a){const t=new e;return t.read(r,a.context),t.type==="group"&&(r.layerType==="GroupLayer"?await J(t,r,a):p(r)?K(t,r,a.context):g(r)&&await P(t,r,a.context)),await M(t,a.context),t}async function R(e,r){var c,o;const a=r.context,t=N(a);let i=e.layerType||e.type;!i&&(r!=null&&r.defaultLayerType)&&(i=r.defaultLayerType);const y=t[i];let n=y?L[y]:L.UnknownLayer;if(p(e)){const s=a==null?void 0:a.portal;if(e.itemId){const l=new I({id:e.itemId,portal:s});await l.load();const u=(await v(l,new b)).className||"UnknownLayer";n=L[u]}}else i==="ArcGISFeatureLayer"?w(e)||h(e)?n=L.MapNotesLayer:F(e)?n=L.RouteLayer:g(e)&&(n=L.GroupLayer):(c=e.wmtsInfo)!=null&&c.url&&e.wmtsInfo.layerIdentifier?n=L.WMTSLayer:i==="WFS"&&((o=e.wfsInfo)==null?void 0:o.version)!=="2.0.0"&&(n=L.UnsupportedLayer);return n()}function g(e){var r,a;return e.layerType!=="ArcGISFeatureLayer"||p(e)?!1:(((a=(r=e.featureCollection)==null?void 0:r.layers)==null?void 0:a.length)??0)>1}function p(e){return e.type==="Feature Collection"}function N(e){let r;switch(e.origin){case"web-scene":switch(e.layerContainerType){case"basemap":r=k;break;case"ground":r=O;break;case"tables":r=V;break;default:r=W}break;case"link-chart":switch(e.layerContainerType){case"basemap":r=U;break;case"tables":r=D;break;default:r=B}break;default:switch(e.layerContainerType){case"basemap":r=G;break;case"tables":r=f;break;default:r=T}}return r}async function J(e,r,a){const t=new A,i=C(t,Array.isArray(r.layers)?r.layers:[],a);try{try{if(await i,e.type==="group")return e.layers.addMany(t),e}catch(y){e.destroy();for(const n of t)n.destroy();throw y}}catch(y){throw y}}function K(e,r,a){r.itemId&&(e.portalItem=new I({id:r.itemId,portal:a==null?void 0:a.portal}),e.when(()=>{var i,y;const t=n=>{var s,l;const c=n.layerId;m(n,e,r,c,a);const o=(l=(s=r.featureCollection)==null?void 0:s.layers)==null?void 0:l[c];o&&n.read(o,a)};(i=e.layers)==null||i.forEach(t),(y=e.tables)==null||y.forEach(t)}))}async function P(e,r,a){var o;const t=L.FeatureLayer,i=await t(),y=r.featureCollection,n=y==null?void 0:y.showLegend,c=(o=y==null?void 0:y.layers)==null?void 0:o.map((s,l)=>{const u=new i;u.read(s,a);const d={...a,ignoreDefaults:!0};return m(u,e,r,l,d),n!=null&&u.read({showLegend:n},d),u});e.layers.addMany(c??[])}function m(e,r,a,t,i){var y;e.read({id:`${r.id}-sublayer-${t}`,visibility:((y=a.visibleLayers)==null?void 0:y.includes(t))??!0},i)}export{J as populateGroupLayer,C as populateOperationalLayers}; diff --git a/dist/assets/layersLoader-5063dwjn.js b/dist/assets/layersLoader-5063dwjn.js deleted file mode 100644 index 485ba55..0000000 --- a/dist/assets/layersLoader-5063dwjn.js +++ /dev/null @@ -1 +0,0 @@ -import{E as h,dl as F,j,dj as D,bS as k,df as x}from"./index-J0iiHjMT.js";import{t as E}from"./fetchService-wPWKuma6.js";import{a as G,n as S,s as P,i as C,l as T,t as g,r as O,e as $}from"./portalLayers-AqjAd9kT.js";import{populateGroupLayer as R}from"./layersCreator-aC1PvuFa.js";import{e as J,l as N}from"./jsonContext-cWV_-jAj.js";import{t as q}from"./requestPresets-18nzHK5y.js";async function ne(t,a){const r=t.instance.portalItem;if(r!=null&&r.id)return await r.load(a),z(t),A(t,a)}function z(t){const a=t.instance.portalItem;if(!(a!=null&&a.type)||!t.supportedTypes.includes(a.type))throw new h("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:a==null?void 0:a.type,expectedType:t.supportedTypes.join(", ")})}async function A(t,a){const r=t.instance,e=r.portalItem;if(!e)return;const{url:s,title:n}=e,i=J(e);if(r.type==="group")return B(r,i,t);s&&r.read({url:s},i);const o=new $,l=await L(t,o,a);return l&&r.read(l,i),r.resourceReferences={portalItem:e,paths:i.readResourcePaths??[]},r.type!=="subtype-group"&&r.read({title:n},i),F(r,i)}async function B(t,a,r){const e=t.portalItem;if(!t.sourceIsPortalItem)return;const{title:s,type:n}=e;if(n==="Group Layer"){if(!j(e,"Map"))throw new h("portal:invalid-layer-item-typekeyword","'Group Layer' item without 'Map' type keyword is not supported");return H(t)}return t.read({title:s},a),K(t,r)}async function H(t){const a=t.portalItem,r=await a.fetchData("json");if(!r)return;const e=N(a);t.read(r,e),await R(t,r,{context:e}),t.resourceReferences={portalItem:a,paths:e.readResourcePaths??[]}}async function K(t,a){let r;const{portalItem:e}=t;if(!e)return;const s=e.type,n=a.layerModuleTypeMap;switch(s){case"Feature Service":case"Feature Collection":r=n.FeatureLayer;break;case"Stream Service":r=n.StreamLayer;break;case"Scene Service":r=n.SceneLayer;break;default:throw new h("portal:unsupported-item-type-as-group",`The item type '${s}' is not supported as a 'IGroupLayer'`)}const i=new $;let[o,l]=await Promise.all([r(),L(a,i)]),u=()=>o;if(s==="Feature Service"){l=e.url?await G(l,e.url,i):{};const y=S(l),c=P(l),f=[];if(y.length||c!=null&&c.length){y.length&&f.push("SubtypeGroupLayer"),c!=null&&c.length&&f.push("OrientedImageryLayer");const w=[];for(const p of f){const d=n[p];w.push(d())}const M=await Promise.all(w),b=new Map;f.forEach((p,d)=>{b.set(p,M[d])}),u=p=>p.layerType?b.get(p.layerType)??o:o}const v=await Y(e.url);return await m(t,u,l,v)}return s==="Scene Service"&&e.url&&(l=await C(e,l,i)),T(l)>0?await m(t,u,l):await Q(t,u)}async function Q(t,a){var s,n;const{portalItem:r}=t;if(!(r!=null&&r.url))return;const e=await q(r.url);e&&m(t,a,{layers:(s=e.layers)==null?void 0:s.map(g),tables:(n=e.tables)==null?void 0:n.map(g)})}async function m(t,a,r,e){var i;let s=r.layers||[];const n=r.tables||[];if(((i=t.portalItem)==null?void 0:i.type)==="Feature Collection"?(s.forEach((o,l)=>{var u;o.id=l,((u=o==null?void 0:o.layerDefinition)==null?void 0:u.type)==="Table"&&n.push(o)}),s=s.filter(o=>{var l;return((l=o==null?void 0:o.layerDefinition)==null?void 0:l.type)!=="Table"})):(s.reverse(),n.reverse()),s.forEach(o=>{const l=e==null?void 0:e(o);if(l||!e){const u=I(t,a(o),r,o,l);t.add(u)}}),n.length){const o=await D.FeatureLayer();n.forEach(l=>{const u=e==null?void 0:e(l);if(u||!e){const y=I(t,o,r,l,u);t.tables.add(y)}})}}function I(t,a,r,e,s){const n=t.portalItem,i={portalItem:n.clone(),layerId:e.id};e.url!=null&&(i.url=e.url);const o=new a(i);if("sourceJSON"in o&&(o.sourceJSON=s),o.type!=="subtype-group"&&(o.sublayerTitleMode="service-name"),n.type==="Feature Collection"){const l={origin:"portal-item",portal:n.portal||k.getDefault()};o.read(e,l);const u=r.showLegend;u!=null&&o.read({showLegend:u},l)}return o}async function L(t,a,r){if(t.supportsData===!1)return;const e=t.instance,s=e.portalItem;if(!s)return;let n=null;try{n=await s.fetchData("json",r)}catch{}if(W(e)){let i=null;const o=await U(s,n,a);if((n!=null&&n.layers||n!=null&&n.tables)&&o>0){if(e.layerId==null){const l=S(n);e.layerId=e.type==="subtype-group"?l==null?void 0:l[0]:O(n)}i=V(n,e),i&&n.showLegend!=null&&(i.showLegend=n.showLegend)}return o>1&&"sublayerTitleMode"in e&&e.sublayerTitleMode!=="service-name"&&(e.sublayerTitleMode="item-title-and-service-name"),i}return n}async function U(t,a,r){var n,i,o,l;if(a!=null&&a.layers&&(a!=null&&a.tables))return T(a);const e=x(t.url);if(!e)return 1;const s=await r.fetchServiceMetadata(e.url.path).catch(()=>null);return(((n=a==null?void 0:a.layers)==null?void 0:n.length)??((i=s==null?void 0:s.layers)==null?void 0:i.length)??0)+(((o=a==null?void 0:a.tables)==null?void 0:o.length)??((l=s==null?void 0:s.tables)==null?void 0:l.length)??0)}function V(t,a){var s,n;const{layerId:r}=a,e=((s=t.layers)==null?void 0:s.find(i=>i.id===r))||((n=t.tables)==null?void 0:n.find(i=>i.id===r));return e&&X(e,a)?e:null}function W(t){return t.type!=="stream"&&"layerId"in t}function X(t,a){return!(a.type==="feature"&&"layerType"in t&&t.layerType==="SubtypeGroupLayer"||a.type==="subtype-group"&&!("layerType"in t))}async function Y(t){const{layersJSON:a}=await E(t);if(!a)return null;const r=[...a.layers,...a.tables];return e=>r.find(s=>s.id===e.id)}export{ne as load}; diff --git a/dist/assets/layersLoader-zT5u6Dmk.js b/dist/assets/layersLoader-zT5u6Dmk.js new file mode 100644 index 0000000..12817f0 --- /dev/null +++ b/dist/assets/layersLoader-zT5u6Dmk.js @@ -0,0 +1 @@ +import{r as h,dl as F,s as D,dj as j,ar as k,df as x}from"./index-pCX-0tJH.js";import{t as G}from"./fetchService-cGWNcQnc.js";import{a as P,n as T,s as E,i as C,l as $,t as g,r as O,e as L}from"./portalLayers-Au1cdQPl.js";import{populateGroupLayer as R}from"./layersCreator-kgscMbpL.js";import{e as J,l as N}from"./jsonContext-EgdQULbU.js";import{t as q}from"./requestPresets-f6ZAWLqV.js";async function ne(t,a){const r=t.instance.portalItem;if(r!=null&&r.id)return await r.load(a),z(t),A(t,a)}function z(t){const a=t.instance.portalItem;if(!(a!=null&&a.type)||!t.supportedTypes.includes(a.type))throw new h("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:a==null?void 0:a.type,expectedType:t.supportedTypes.join(", ")})}async function A(t,a){const r=t.instance,e=r.portalItem;if(!e)return;const{url:o,title:n}=e,i=J(e);if(r.type==="group")return B(r,i,t);o&&r.read({url:o},i);const s=new L,l=await S(t,s,a);return l&&r.read(l,i),r.resourceReferences={portalItem:e,paths:i.readResourcePaths??[]},r.type!=="subtype-group"&&r.read({title:n},i),F(r,i)}async function B(t,a,r){const e=t.portalItem;if(!t.sourceIsPortalItem)return;const{title:o,type:n}=e;if(n==="Group Layer"){if(!D(e,"Map"))throw new h("portal:invalid-layer-item-typekeyword","'Group Layer' item without 'Map' type keyword is not supported");return H(t)}return t.read({title:o},a),K(t,r)}async function H(t){const a=t.portalItem,r=await a.fetchData("json");if(!r)return;const e=N(a);t.read(r,e),await R(t,r,{context:e}),t.resourceReferences={portalItem:a,paths:e.readResourcePaths??[]}}async function K(t,a){let r;const{portalItem:e}=t;if(!e)return;const o=e.type,n=a.layerModuleTypeMap;switch(o){case"Feature Service":case"Feature Collection":r=n.FeatureLayer;break;case"Stream Service":r=n.StreamLayer;break;case"Scene Service":r=n.SceneLayer;break;default:throw new h("portal:unsupported-item-type-as-group",`The item type '${o}' is not supported as a 'IGroupLayer'`)}const i=new L;let[s,l]=await Promise.all([r(),S(a,i)]),u=()=>s;if(o==="Feature Service"){l=e.url?await P(l,e.url,i):{};const y=T(l),c=E(l),f=[];if(y.length||c!=null&&c.length){y.length&&f.push("SubtypeGroupLayer"),c!=null&&c.length&&f.push("OrientedImageryLayer");const w=[];for(const p of f){const d=n[p];w.push(d())}const M=await Promise.all(w),b=new Map;f.forEach((p,d)=>{b.set(p,M[d])}),u=p=>p.layerType?b.get(p.layerType)??s:s}const v=await Y(e.url);return await m(t,u,l,v)}return o==="Scene Service"&&e.url&&(l=await C(e,l,i)),$(l)>0?await m(t,u,l):await Q(t,u)}async function Q(t,a){var o,n;const{portalItem:r}=t;if(!(r!=null&&r.url))return;const e=await q(r.url);e&&m(t,a,{layers:(o=e.layers)==null?void 0:o.map(g),tables:(n=e.tables)==null?void 0:n.map(g)})}async function m(t,a,r,e){var i;let o=r.layers||[];const n=r.tables||[];if(((i=t.portalItem)==null?void 0:i.type)==="Feature Collection"?(o.forEach((s,l)=>{var u;s.id=l,((u=s==null?void 0:s.layerDefinition)==null?void 0:u.type)==="Table"&&n.push(s)}),o=o.filter(s=>{var l;return((l=s==null?void 0:s.layerDefinition)==null?void 0:l.type)!=="Table"})):(o.reverse(),n.reverse()),o.forEach(s=>{const l=e==null?void 0:e(s);if(l||!e){const u=I(t,a(s),r,s,l);t.add(u)}}),n.length){const s=await j.FeatureLayer();n.forEach(l=>{const u=e==null?void 0:e(l);if(u||!e){const y=I(t,s,r,l,u);t.tables.add(y)}})}}function I(t,a,r,e,o){const n=t.portalItem,i={portalItem:n.clone(),layerId:e.id};e.url!=null&&(i.url=e.url);const s=new a(i);if("sourceJSON"in s&&(s.sourceJSON=o),s.type!=="subtype-group"&&(s.sublayerTitleMode="service-name"),n.type==="Feature Collection"){const l={origin:"portal-item",portal:n.portal||k.getDefault()};s.read(e,l);const u=r.showLegend;u!=null&&s.read({showLegend:u},l)}return s}async function S(t,a,r){if(t.supportsData===!1)return;const e=t.instance,o=e.portalItem;if(!o)return;let n=null;try{n=await o.fetchData("json",r)}catch{}if(W(e)){let i=null;const s=await U(o,n,a);if((n!=null&&n.layers||n!=null&&n.tables)&&s>0){if(e.layerId==null){const l=T(n);e.layerId=e.type==="subtype-group"?l==null?void 0:l[0]:O(n)}i=V(n,e),i&&n.showLegend!=null&&(i.showLegend=n.showLegend)}return s>1&&"sublayerTitleMode"in e&&e.sublayerTitleMode!=="service-name"&&(e.sublayerTitleMode="item-title-and-service-name"),i}return n}async function U(t,a,r){var n,i,s,l;if(a!=null&&a.layers&&(a!=null&&a.tables))return $(a);const e=x(t.url);if(!e)return 1;const o=await r.fetchServiceMetadata(e.url.path).catch(()=>null);return(((n=a==null?void 0:a.layers)==null?void 0:n.length)??((i=o==null?void 0:o.layers)==null?void 0:i.length)??0)+(((s=a==null?void 0:a.tables)==null?void 0:s.length)??((l=o==null?void 0:o.tables)==null?void 0:l.length)??0)}function V(t,a){var o,n;const{layerId:r}=a,e=((o=t.layers)==null?void 0:o.find(i=>i.id===r))||((n=t.tables)==null?void 0:n.find(i=>i.id===r));return e&&X(e,a)?e:null}function W(t){return t.type!=="stream"&&"layerId"in t}function X(t,a){return!(a.type==="feature"&&"layerType"in t&&t.layerType==="SubtypeGroupLayer"||a.type==="subtype-group"&&!("layerType"in t))}async function Y(t){const{layersJSON:a}=await G(t);if(!a)return null;const r=[...a.layers,...a.tables];return e=>r.find(o=>o.id===e.id)}export{ne as load}; diff --git a/dist/assets/lclayout-osE6VX-O.js b/dist/assets/lclayout-28FIPR98.js similarity index 89% rename from dist/assets/lclayout-osE6VX-O.js rename to dist/assets/lclayout-28FIPR98.js index c53af24..369f7af 100644 --- a/dist/assets/lclayout-osE6VX-O.js +++ b/dist/assets/lclayout-28FIPR98.js @@ -1,3 +1,3 @@ -import{cg as Tr}from"./index-J0iiHjMT.js";function Cr(R,Y){for(var x=0;xi[M]})}}}return Object.freeze(Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}))}var Zt,N,$t,it={exports:{}};it.exports,Zt=it,it.exports,N=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(N=N||__filename),$t=function(R){var Y,x,i=(R=R||{})!==void 0?R:{};i.ready=new Promise(function(t,n){Y=t,x=n});var M,D,X,vt=Object.assign({},i),ot="./this.program",_t=typeof window=="object",z=typeof importScripts=="function",at=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",F="";function Qt(t){return i.locateFile?i.locateFile(t,F):F+t}if(at){var wt=require("fs"),ut=require("path");F=z?ut.dirname(F)+"/":__dirname+"/",M=(t,n)=>(t=$(t)?new URL(t):ut.normalize(t),wt.readFileSync(t,n?void 0:"utf8")),X=t=>{var n=M(t,!0);return n.buffer||(n=new Uint8Array(n)),n},D=(t,n,r)=>{t=$(t)?new URL(t):ut.normalize(t),wt.readFile(t,function(e,o){e?r(e):n(o.buffer)})},process.argv.length>1&&(ot=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(t){if(!(t instanceof hn))throw t}),process.on("unhandledRejection",function(t){throw t}),i.inspect=function(){return"[Emscripten Module object]"}}else(_t||z)&&(z?F=self.location.href:typeof document<"u"&&document.currentScript&&(F=document.currentScript.src),N&&(F=N),F=F.indexOf("blob:")!==0?F.substr(0,F.replace(/[?#].*/,"").lastIndexOf("/")+1):"",M=t=>{var n=new XMLHttpRequest;return n.open("GET",t,!1),n.send(null),n.responseText},z&&(X=t=>{var n=new XMLHttpRequest;return n.open("GET",t,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),D=(t,n,r)=>{var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=()=>{e.status==200||e.status==0&&e.response?n(e.response):r()},e.onerror=r,e.send(null)});i.print||console.log.bind(console);var V,ct,B=i.printErr||console.warn.bind(console);Object.assign(i,vt),vt=null,i.arguments&&i.arguments,i.thisProgram&&(ot=i.thisProgram),i.quit&&i.quit,i.wasmBinary&&(V=i.wasmBinary),i.noExitRuntime,typeof WebAssembly!="object"&&Z("no native wasm support detected");var ft,P,_,U,J,h,g,bt,At,Tt,Ct=!1,Et=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function tn(t,n,r){for(var e=n+r,o=n;t[o]&&!(o>=e);)++o;if(o-n>16&&t.buffer&&Et)return Et.decode(t.subarray(n,o));for(var a="";n>10,56320|1023&p)}}else a+=String.fromCharCode((31&c)<<6|f)}else a+=String.fromCharCode(c)}return a}function st(t,n){return t?tn(_,t,n):""}function Ft(t,n,r,e){if(!(e>0))return 0;for(var o=r,a=r+e-1,c=0;c=55296&&f<=57343&&(f=65536+((1023&f)<<10)|1023&t.charCodeAt(++c)),f<=127){if(r>=a)break;n[r++]=f}else if(f<=2047){if(r+1>=a)break;n[r++]=192|f>>6,n[r++]=128|63&f}else if(f<=65535){if(r+2>=a)break;n[r++]=224|f>>12,n[r++]=128|f>>6&63,n[r++]=128|63&f}else{if(r+3>=a)break;n[r++]=240|f>>18,n[r++]=128|f>>12&63,n[r++]=128|f>>6&63,n[r++]=128|63&f}}return n[r]=0,r-o}function nn(t,n,r){return Ft(t,_,n,r)}function Pt(t){for(var n=0,r=0;r=55296&&e<=57343?(n+=4,++r):n+=3}return n}function St(t){ft=t,i.HEAP8=P=new Int8Array(t),i.HEAP16=U=new Int16Array(t),i.HEAP32=h=new Int32Array(t),i.HEAPU8=_=new Uint8Array(t),i.HEAPU16=J=new Uint16Array(t),i.HEAPU32=g=new Uint32Array(t),i.HEAPF32=bt=new Float32Array(t),i.HEAPF64=At=new Float64Array(t)}i.INITIAL_MEMORY;var Wt=[],Mt=[],jt=[];function rn(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)an(i.preRun.shift());lt(Wt)}function en(){lt(Mt)}function on(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)cn(i.postRun.shift());lt(jt)}function an(t){Wt.unshift(t)}function un(t){Mt.unshift(t)}function cn(t){jt.unshift(t)}var k=0,q=null;function fn(t){k++,i.monitorRunDependencies&&i.monitorRunDependencies(k)}function sn(t){if(k--,i.monitorRunDependencies&&i.monitorRunDependencies(k),k==0&&q){var n=q;q=null,n()}}function Z(t){i.onAbort&&i.onAbort(t),B(t="Aborted("+t+")"),Ct=!0,t+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(t);throw x(n),n}var w,ln="data:application/octet-stream;base64,";function Ot(t){return t.startsWith(ln)}function $(t){return t.startsWith("file://")}function Rt(t){try{if(t==w&&V)return new Uint8Array(V);if(X)return X(t);throw"both async and sync fetching of the wasm failed"}catch(n){Z(n)}}function pn(){if(!V&&(_t||z)){if(typeof fetch=="function"&&!$(w))return fetch(w,{credentials:"same-origin"}).then(function(t){if(!t.ok)throw"failed to load wasm binary file at '"+w+"'";return t.arrayBuffer()}).catch(function(){return Rt(w)});if(D)return new Promise(function(t,n){D(w,function(r){t(new Uint8Array(r))},n)})}return Promise.resolve().then(function(){return Rt(w)})}function dn(){var t={a:br};function n(a,c){var f=a.exports;i.asm=f,St((ct=i.asm.w).buffer),Tt=i.asm.y,un(i.asm.x),sn()}function r(a){n(a.instance)}function e(a){return pn().then(function(c){return WebAssembly.instantiate(c,t)}).then(function(c){return c}).then(a,function(c){B("failed to asynchronously prepare wasm: "+c),Z(c)})}function o(){return V||typeof WebAssembly.instantiateStreaming!="function"||Ot(w)||$(w)||at||typeof fetch!="function"?e(r):fetch(w,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,t).then(r,function(c){return B("wasm streaming compile failed: "+c),B("falling back to ArrayBuffer instantiation"),e(r)})})}if(fn(),i.instantiateWasm)try{return i.instantiateWasm(t,n)}catch(a){B("Module.instantiateWasm callback failed with error: "+a),x(a)}return o().catch(x),{}}function hn(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function lt(t){for(;t.length>0;)t.shift()(i)}function mn(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(n){g[this.ptr+4>>2]=n},this.get_type=function(){return g[this.ptr+4>>2]},this.set_destructor=function(n){g[this.ptr+8>>2]=n},this.get_destructor=function(){return g[this.ptr+8>>2]},this.set_refcount=function(n){h[this.ptr>>2]=n},this.set_caught=function(n){n=n?1:0,P[this.ptr+12>>0]=n},this.get_caught=function(){return P[this.ptr+12>>0]!=0},this.set_rethrown=function(n){n=n?1:0,P[this.ptr+13>>0]=n},this.get_rethrown=function(){return P[this.ptr+13>>0]!=0},this.init=function(n,r){this.set_adjusted_ptr(0),this.set_type(n),this.set_destructor(r),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var n=h[this.ptr>>2];h[this.ptr>>2]=n+1},this.release_ref=function(){var n=h[this.ptr>>2];return h[this.ptr>>2]=n-1,n===1},this.set_adjusted_ptr=function(n){g[this.ptr+16>>2]=n},this.get_adjusted_ptr=function(){return g[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Xt(this.get_type()))return g[this.excPtr>>2];var n=this.get_adjusted_ptr();return n!==0?n:this.excPtr}}function yn(t,n,r){throw new mn(t).init(n,r),t}function gn(t,n,r,e,o){}function pt(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}function vn(){for(var t=new Array(256),n=0;n<256;++n)t[n]=String.fromCharCode(n);xt=t}Ot(w="lclayout.wasm")||(w=Qt(w));var xt=void 0;function b(t){for(var n="",r=t;_[r];)n+=xt[_[r++]];return n}var I={},H={},K={},_n=48,wn=57;function bn(t){if(t===void 0)return"_unknown";var n=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return n>=_n&&n<=wn?"_"+t:t}function An(t,n){return t=bn(t),function(){return n.apply(this,arguments)}}function dt(t,n){var r=An(n,function(e){this.name=n,this.message=e;var o=new Error(e).stack;o!==void 0&&(this.stack=this.toString()+` -`+o.replace(/^Error(:[^\n]*)?\n/,""))});return r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},r}var Dt=void 0;function A(t){throw new Dt(t)}var kt=void 0;function Ut(t){throw new kt(t)}function It(t,n,r){function e(f){var s=r(f);s.length!==t.length&&Ut("Mismatched type converter count");for(var p=0;p{H.hasOwnProperty(f)?o[s]=H[f]:(a.push(f),I.hasOwnProperty(f)||(I[f]=[]),I[f].push(()=>{o[s]=H[f],++c===a.length&&e(o)}))}),a.length===0&&e(o)}function j(t,n,r={}){if(!("argPackAdvance"in n))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=n.name;if(t||A('type "'+e+'" must have a positive integer typeid pointer'),H.hasOwnProperty(t)){if(r.ignoreDuplicateRegistrations)return;A("Cannot register type '"+e+"' twice")}if(H[t]=n,delete K[t],I.hasOwnProperty(t)){var o=I[t];delete I[t],o.forEach(a=>a())}}function Tn(t,n,r,e,o){var a=pt(r);j(t,{name:n=b(n),fromWireType:function(c){return!!c},toWireType:function(c,f){return f?e:o},argPackAdvance:8,readValueFromPointer:function(c){var f;if(r===1)f=P;else if(r===2)f=U;else{if(r!==4)throw new TypeError("Unknown boolean type size: "+n);f=h}return this.fromWireType(f[c>>a])},destructorFunction:null})}function Cn(t,n,r){t=b(t),It([],[n],function(e){return e=e[0],i[t]=e.fromWireType(r),[]})}var ht=[],S=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function En(t){t>4&&--S[t].refcount==0&&(S[t]=void 0,ht.push(t))}function Fn(){for(var t=0,n=5;n(t||A("Cannot use deleted val. handle = "+t),S[t].value),toHandle:t=>{switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var n=ht.length?ht.pop():S.length;return S[n]={refcount:1,value:t},n}}};function mt(t){return this.fromWireType(h[t>>2])}function Wn(t,n){j(t,{name:n=b(n),fromWireType:function(r){var e=Ht.toValue(r);return En(r),e},toWireType:function(r,e){return Ht.toHandle(e)},argPackAdvance:8,readValueFromPointer:mt,destructorFunction:null})}function Mn(t,n){switch(n){case 2:return function(r){return this.fromWireType(bt[r>>2])};case 3:return function(r){return this.fromWireType(At[r>>3])};default:throw new TypeError("Unknown float type: "+t)}}function jn(t,n,r){var e=pt(r);j(t,{name:n=b(n),fromWireType:function(o){return o},toWireType:function(o,a){return a},argPackAdvance:8,readValueFromPointer:Mn(n,e),destructorFunction:null})}function On(t){for(;t.length;){var n=t.pop();t.pop()(n)}}function Rn(t,n,r,e,o){var a=n.length;a<2&&A("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var c=n[1]!==null&&r!==null,f=!1,s=1;s>2]);return r}function Un(t,n,r){i.hasOwnProperty(t)||Ut("Replacing nonexistant public symbol"),i[t].overloadTable!==void 0&&r!==void 0?i[t].overloadTable[r]=n:(i[t]=n,i[t].argCount=r)}function In(t,n,r){var e=i["dynCall_"+t];return r&&r.length?e.apply(null,[n].concat(r)):e.call(null,n)}var Q=[];function Yt(t){var n=Q[t];return n||(t>=Q.length&&(Q.length=t+1),Q[t]=n=Tt.get(t)),n}function Hn(t,n,r){return t.includes("j")?In(t,n,r):Yt(n).apply(null,r)}function Yn(t,n){var r=[];return function(){return r.length=0,Object.assign(r,arguments),Hn(t,n,r)}}function zn(t,n){function r(){return t.includes("j")?Yn(t,n):Yt(n)}t=b(t);var e=r();return typeof e!="function"&&A("unknown function pointer with signature "+t+": "+n),e}var zt=void 0;function Vn(t){var n=Nt(t),r=b(n);return O(n),r}function Bn(t,n){var r=[],e={};function o(a){e[a]||H[a]||(K[a]?K[a].forEach(o):(r.push(a),e[a]=!0))}throw n.forEach(o),new zt(t+": "+r.map(Vn).join([", "]))}function qn(t,n,r,e,o,a){var c=kn(n,r);t=b(t),o=zn(e,o),Dn(t,function(){Bn("Cannot call "+t+" due to unbound types",c)},n-1),It([],c,function(f){var s=[f[0],null].concat(f.slice(1));return Un(t,Rn(t,s,null,o,a),n-1),[]})}function Ln(t,n,r){switch(n){case 0:return r?function(e){return P[e]}:function(e){return _[e]};case 1:return r?function(e){return U[e>>1]}:function(e){return J[e>>1]};case 2:return r?function(e){return h[e>>2]}:function(e){return g[e>>2]};default:throw new TypeError("Unknown integer type: "+t)}}function Gn(t,n,r,e,o){n=b(n);var a=pt(r),c=d=>d;if(e===0){var f=32-8*r;c=d=>d<>>f}var s=n.includes("unsigned"),p=(d,m)=>{};j(t,{name:n,fromWireType:c,toWireType:s?function(d,m){return p(m,this.name),m>>>0}:function(d,m){return p(m,this.name),m},argPackAdvance:8,readValueFromPointer:Ln(n,a,e!==0),destructorFunction:null})}function Nn(t,n,r){var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][n];function o(a){var c=g,f=c[a>>=2],s=c[a+1];return new e(ft,s,f)}j(t,{name:r=b(r),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})}function Xn(t,n){var r=(n=b(n))==="std::string";j(t,{name:n,fromWireType:function(e){var o,a=g[e>>2],c=e+4;if(r)for(var f=c,s=0;s<=a;++s){var p=c+s;if(s==a||_[p]==0){var d=st(f,p-f);o===void 0?o=d:(o+="\0",o+=d),f=p+1}}else{var m=new Array(a);for(s=0;s>2]=a,r&&c)nn(o,s,a+1);else if(c)for(var p=0;p255&&(O(s),A("String has UTF-16 code units that do not fit in 8 bits")),_[s+p]=d}else for(p=0;p>1,o=e+n/2;!(e>=o)&&J[e];)++e;if((r=e<<1)-t>32&&Vt)return Vt.decode(_.subarray(t,r));for(var a="",c=0;!(c>=n/2);++c){var f=U[t+2*c>>1];if(f==0)break;a+=String.fromCharCode(f)}return a}function Zn(t,n,r){if(r===void 0&&(r=2147483647),r<2)return 0;for(var e=n,o=(r-=2)<2*t.length?r/2:t.length,a=0;a>1]=c,n+=2}return U[n>>1]=0,n-e}function $n(t){return 2*t.length}function Kn(t,n){for(var r=0,e="";!(r>=n/4);){var o=h[t+4*r>>2];if(o==0)break;if(++r,o>=65536){var a=o-65536;e+=String.fromCharCode(55296|a>>10,56320|1023&a)}else e+=String.fromCharCode(o)}return e}function Qn(t,n,r){if(r===void 0&&(r=2147483647),r<4)return 0;for(var e=n,o=e+r-4,a=0;a=55296&&c<=57343&&(c=65536+((1023&c)<<10)|1023&t.charCodeAt(++a)),h[n>>2]=c,(n+=4)+4>o)break}return h[n>>2]=0,n-e}function tr(t){for(var n=0,r=0;r=55296&&e<=57343&&++r,n+=4}return n}function nr(t,n,r){var e,o,a,c,f;r=b(r),n===2?(e=Jn,o=Zn,c=$n,a=()=>J,f=1):n===4&&(e=Kn,o=Qn,c=tr,a=()=>g,f=2),j(t,{name:r,fromWireType:function(s){for(var p,d=g[s>>2],m=a(),y=s+4,T=0;T<=d;++T){var W=s+4+T*n;if(T==d||m[W>>f]==0){var C=e(y,W-y);p===void 0?p=C:(p+="\0",p+=C),y=W+n}}return O(s),p},toWireType:function(s,p){typeof p!="string"&&A("Cannot pass non-string to C++ string type "+r);var d=c(p),m=gt(4+d+n);return g[m>>2]=d>>f,o(p,m+4,d+n),s!==null&&s.push(O,m),m},argPackAdvance:8,readValueFromPointer:mt,destructorFunction:function(s){O(s)}})}function rr(t,n){j(t,{isVoid:!0,name:n=b(n),argPackAdvance:0,fromWireType:function(){},toWireType:function(r,e){}})}var Bt,er=!0;function ir(){return er}function or(){Z("")}function ar(){return Date.now()}function qt(){return 2147483648}function ur(){return qt()}function cr(t,n,r){_.copyWithin(t,n,n+r)}function fr(t){try{return ct.grow(t-ft.byteLength+65535>>>16),St(ct.buffer),1}catch{}}function sr(t){var n=_.length;t>>>=0;var r=qt();if(t>r)return!1;let e=(c,f)=>c+(f-c%f)%f;for(var o=1;o<=4;o*=2){var a=n*(1+.2/o);if(a=Math.min(a,t+100663296),fr(Math.min(r,e(Math.max(t,a),65536))))return!0}return!1}Bt=at?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now();var yt={};function lr(){return ot||"./this.program"}function L(){if(!L.strings){var t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:lr()};for(var n in yt)yt[n]===void 0?delete t[n]:t[n]=yt[n];var r=[];for(var n in t)r.push(n+"="+t[n]);L.strings=r}return L.strings}function pr(t,n,r){for(var e=0;e>0]=t.charCodeAt(e);r||(P[n>>0]=0)}function dr(t,n){var r=0;return L().forEach(function(e,o){var a=n+r;g[t+4*o>>2]=a,pr(e,a),r+=e.length+1}),0}function hr(t,n){var r=L();g[t>>2]=r.length;var e=0;return r.forEach(function(o){e+=o.length+1}),g[n>>2]=e,0}function tt(t){return t%4==0&&(t%100!=0||t%400==0)}function mr(t,n){for(var r=0,e=0;e<=n;r+=t[e++]);return r}var Lt=[31,29,31,30,31,30,31,31,30,31,30,31],Gt=[31,28,31,30,31,30,31,31,30,31,30,31];function yr(t,n){for(var r=new Date(t.getTime());n>0;){var e=tt(r.getFullYear()),o=r.getMonth(),a=(e?Lt:Gt)[o];if(!(n>a-r.getDate()))return r.setDate(r.getDate()+n),r;n-=a-r.getDate()+1,r.setDate(1),o<11?r.setMonth(o+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r}function gr(t,n,r){var e=r>0?r:Pt(t)+1,o=new Array(e),a=Ft(t,o,0,o.length);return n&&(o.length=a),o}function vr(t,n){P.set(t,n)}function _r(t,n,r,e){var o=h[e+40>>2],a={tm_sec:h[e>>2],tm_min:h[e+4>>2],tm_hour:h[e+8>>2],tm_mday:h[e+12>>2],tm_mon:h[e+16>>2],tm_year:h[e+20>>2],tm_wday:h[e+24>>2],tm_yday:h[e+28>>2],tm_isdst:h[e+32>>2],tm_gmtoff:h[e+36>>2],tm_zone:o?st(o):""},c=st(r),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var s in f)c=c.replace(new RegExp(s,"g"),f[s]);var p=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],d=["January","February","March","April","May","June","July","August","September","October","November","December"];function m(u,l,E){for(var v=typeof u=="number"?u.toString():u||"";v.length0?1:0}var v;return(v=E(u.getFullYear()-l.getFullYear()))===0&&(v=E(u.getMonth()-l.getMonth()))===0&&(v=E(u.getDate()-l.getDate())),v}function W(u){switch(u.getDay()){case 0:return new Date(u.getFullYear()-1,11,29);case 1:return u;case 2:return new Date(u.getFullYear(),0,3);case 3:return new Date(u.getFullYear(),0,2);case 4:return new Date(u.getFullYear(),0,1);case 5:return new Date(u.getFullYear()-1,11,31);case 6:return new Date(u.getFullYear()-1,11,30)}}function C(u){var l=yr(new Date(u.tm_year+1900,0,1),u.tm_yday),E=new Date(l.getFullYear(),0,4),v=new Date(l.getFullYear()+1,0,4),et=W(E),Ar=W(v);return T(et,l)<=0?T(Ar,l)<=0?l.getFullYear()+1:l.getFullYear():l.getFullYear()-1}var rt={"%a":function(u){return p[u.tm_wday].substring(0,3)},"%A":function(u){return p[u.tm_wday]},"%b":function(u){return d[u.tm_mon].substring(0,3)},"%B":function(u){return d[u.tm_mon]},"%C":function(u){return y((u.tm_year+1900)/100|0,2)},"%d":function(u){return y(u.tm_mday,2)},"%e":function(u){return m(u.tm_mday,2," ")},"%g":function(u){return C(u).toString().substring(2)},"%G":function(u){return C(u)},"%H":function(u){return y(u.tm_hour,2)},"%I":function(u){var l=u.tm_hour;return l==0?l=12:l>12&&(l-=12),y(l,2)},"%j":function(u){return y(u.tm_mday+mr(tt(u.tm_year+1900)?Lt:Gt,u.tm_mon-1),3)},"%m":function(u){return y(u.tm_mon+1,2)},"%M":function(u){return y(u.tm_min,2)},"%n":function(){return` -`},"%p":function(u){return u.tm_hour>=0&&u.tm_hour<12?"AM":"PM"},"%S":function(u){return y(u.tm_sec,2)},"%t":function(){return" "},"%u":function(u){return u.tm_wday||7},"%U":function(u){var l=u.tm_yday+7-u.tm_wday;return y(Math.floor(l/7),2)},"%V":function(u){var l=Math.floor((u.tm_yday+7-(u.tm_wday+6)%7)/7);if((u.tm_wday+371-u.tm_yday-2)%7<=2&&l++,l){if(l==53){var E=(u.tm_wday+371-u.tm_yday)%7;E==4||E==3&&tt(u.tm_year)||(l=1)}}else{l=52;var v=(u.tm_wday+7-u.tm_yday-1)%7;(v==4||v==5&&tt(u.tm_year%400-1))&&l++}return y(l,2)},"%w":function(u){return u.tm_wday},"%W":function(u){var l=u.tm_yday+7-(u.tm_wday+6)%7;return y(Math.floor(l/7),2)},"%y":function(u){return(u.tm_year+1900).toString().substring(2)},"%Y":function(u){return u.tm_year+1900},"%z":function(u){var l=u.tm_gmtoff,E=l>=0;return l=(l=Math.abs(l)/60)/60*100+l%60,(E?"+":"-")+("0000"+l).slice(-4)},"%Z":function(u){return u.tm_zone},"%%":function(){return"%"}};for(var s in c=c.replace(/%%/g,"\0\0"),rt)c.includes(s)&&(c=c.replace(new RegExp(s,"g"),rt[s](a)));var G=gr(c=c.replace(/\0\0/g,"%"),!1);return G.length>n?0:(vr(G,t),G.length-1)}function wr(t,n,r,e,o){return _r(t,n,r,e)}vn(),Dt=i.BindingError=dt(Error,"BindingError"),kt=i.InternalError=dt(Error,"InternalError"),Sn(),zt=i.UnboundTypeError=dt(Error,"UnboundTypeError");var br={a:yn,m:gn,k:Tn,i:Cn,j:Wn,h:jn,c:qn,d:Gn,b:Nn,g:Xn,e:nr,l:rr,r:ir,f:or,s:ar,n:ur,u:Bt,v:cr,t:sr,p:dr,q:hr,o:wr};dn(),i.___wasm_call_ctors=function(){return(i.___wasm_call_ctors=i.asm.x).apply(null,arguments)};var Nt=i.___getTypeName=function(){return(Nt=i.___getTypeName=i.asm.z).apply(null,arguments)};i.__embind_initialize_bindings=function(){return(i.__embind_initialize_bindings=i.asm.A).apply(null,arguments)};var nt,gt=i._malloc=function(){return(gt=i._malloc=i.asm.B).apply(null,arguments)},O=i._free=function(){return(O=i._free=i.asm.C).apply(null,arguments)},Xt=i.___cxa_is_pointer_type=function(){return(Xt=i.___cxa_is_pointer_type=i.asm.D).apply(null,arguments)};function Jt(t){function n(){nt||(nt=!0,i.calledRun=!0,Ct||(en(),Y(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),on()))}k>0||(rn(),k>0||(i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("")},1),n()},1)):n()))}if(i.dynCall_viijii=function(){return(i.dynCall_viijii=i.asm.E).apply(null,arguments)},i.dynCall_iiiiij=function(){return(i.dynCall_iiiiij=i.asm.F).apply(null,arguments)},i.dynCall_iiiiijj=function(){return(i.dynCall_iiiiijj=i.asm.G).apply(null,arguments)},i.dynCall_iiiiiijj=function(){return(i.dynCall_iiiiiijj=i.asm.H).apply(null,arguments)},q=function t(){nt||Jt(),nt||(q=t)},i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Jt(),R.ready},Zt.exports=$t;var Kt=it.exports;const Fr=Cr({__proto__:null,default:Tr(Kt)},[Kt]);export{Fr as l}; +import{aR as Tr}from"./index-pCX-0tJH.js";function Cr(O,Y){for(var x=0;xi[M]})}}}return Object.freeze(Object.defineProperty(O,Symbol.toStringTag,{value:"Module"}))}var Zt,N,$t,it={exports:{}};it.exports,Zt=it,it.exports,N=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(N=N||__filename),$t=function(O){var Y,x,i=(O=O||{})!==void 0?O:{};i.ready=new Promise(function(t,n){Y=t,x=n});var M,D,X,vt=Object.assign({},i),ot="./this.program",_t=typeof window=="object",z=typeof importScripts=="function",at=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",F="";function Qt(t){return i.locateFile?i.locateFile(t,F):F+t}if(at){var wt=require("fs"),ut=require("path");F=z?ut.dirname(F)+"/":__dirname+"/",M=(t,n)=>(t=$(t)?new URL(t):ut.normalize(t),wt.readFileSync(t,n?void 0:"utf8")),X=t=>{var n=M(t,!0);return n.buffer||(n=new Uint8Array(n)),n},D=(t,n,r)=>{t=$(t)?new URL(t):ut.normalize(t),wt.readFile(t,function(e,o){e?r(e):n(o.buffer)})},process.argv.length>1&&(ot=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(t){if(!(t instanceof hn))throw t}),process.on("unhandledRejection",function(t){throw t}),i.inspect=function(){return"[Emscripten Module object]"}}else(_t||z)&&(z?F=self.location.href:typeof document<"u"&&document.currentScript&&(F=document.currentScript.src),N&&(F=N),F=F.indexOf("blob:")!==0?F.substr(0,F.replace(/[?#].*/,"").lastIndexOf("/")+1):"",M=t=>{var n=new XMLHttpRequest;return n.open("GET",t,!1),n.send(null),n.responseText},z&&(X=t=>{var n=new XMLHttpRequest;return n.open("GET",t,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),D=(t,n,r)=>{var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=()=>{e.status==200||e.status==0&&e.response?n(e.response):r()},e.onerror=r,e.send(null)});i.print||console.log.bind(console);var V,ct,B=i.printErr||console.warn.bind(console);Object.assign(i,vt),vt=null,i.arguments&&i.arguments,i.thisProgram&&(ot=i.thisProgram),i.quit&&i.quit,i.wasmBinary&&(V=i.wasmBinary),i.noExitRuntime,typeof WebAssembly!="object"&&Z("no native wasm support detected");var ft,P,_,U,J,h,g,bt,At,Tt,Ct=!1,Et=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function tn(t,n,r){for(var e=n+r,o=n;t[o]&&!(o>=e);)++o;if(o-n>16&&t.buffer&&Et)return Et.decode(t.subarray(n,o));for(var a="";n>10,56320|1023&p)}}else a+=String.fromCharCode((31&c)<<6|f)}else a+=String.fromCharCode(c)}return a}function st(t,n){return t?tn(_,t,n):""}function Ft(t,n,r,e){if(!(e>0))return 0;for(var o=r,a=r+e-1,c=0;c=55296&&f<=57343&&(f=65536+((1023&f)<<10)|1023&t.charCodeAt(++c)),f<=127){if(r>=a)break;n[r++]=f}else if(f<=2047){if(r+1>=a)break;n[r++]=192|f>>6,n[r++]=128|63&f}else if(f<=65535){if(r+2>=a)break;n[r++]=224|f>>12,n[r++]=128|f>>6&63,n[r++]=128|63&f}else{if(r+3>=a)break;n[r++]=240|f>>18,n[r++]=128|f>>12&63,n[r++]=128|f>>6&63,n[r++]=128|63&f}}return n[r]=0,r-o}function nn(t,n,r){return Ft(t,_,n,r)}function Pt(t){for(var n=0,r=0;r=55296&&e<=57343?(n+=4,++r):n+=3}return n}function St(t){ft=t,i.HEAP8=P=new Int8Array(t),i.HEAP16=U=new Int16Array(t),i.HEAP32=h=new Int32Array(t),i.HEAPU8=_=new Uint8Array(t),i.HEAPU16=J=new Uint16Array(t),i.HEAPU32=g=new Uint32Array(t),i.HEAPF32=bt=new Float32Array(t),i.HEAPF64=At=new Float64Array(t)}i.INITIAL_MEMORY;var Wt=[],Mt=[],Rt=[];function rn(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)an(i.preRun.shift());lt(Wt)}function en(){lt(Mt)}function on(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)cn(i.postRun.shift());lt(Rt)}function an(t){Wt.unshift(t)}function un(t){Mt.unshift(t)}function cn(t){Rt.unshift(t)}var k=0,q=null;function fn(t){k++,i.monitorRunDependencies&&i.monitorRunDependencies(k)}function sn(t){if(k--,i.monitorRunDependencies&&i.monitorRunDependencies(k),k==0&&q){var n=q;q=null,n()}}function Z(t){i.onAbort&&i.onAbort(t),B(t="Aborted("+t+")"),Ct=!0,t+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(t);throw x(n),n}var w,ln="data:application/octet-stream;base64,";function jt(t){return t.startsWith(ln)}function $(t){return t.startsWith("file://")}function Ot(t){try{if(t==w&&V)return new Uint8Array(V);if(X)return X(t);throw"both async and sync fetching of the wasm failed"}catch(n){Z(n)}}function pn(){if(!V&&(_t||z)){if(typeof fetch=="function"&&!$(w))return fetch(w,{credentials:"same-origin"}).then(function(t){if(!t.ok)throw"failed to load wasm binary file at '"+w+"'";return t.arrayBuffer()}).catch(function(){return Ot(w)});if(D)return new Promise(function(t,n){D(w,function(r){t(new Uint8Array(r))},n)})}return Promise.resolve().then(function(){return Ot(w)})}function dn(){var t={a:br};function n(a,c){var f=a.exports;i.asm=f,St((ct=i.asm.w).buffer),Tt=i.asm.y,un(i.asm.x),sn()}function r(a){n(a.instance)}function e(a){return pn().then(function(c){return WebAssembly.instantiate(c,t)}).then(function(c){return c}).then(a,function(c){B("failed to asynchronously prepare wasm: "+c),Z(c)})}function o(){return V||typeof WebAssembly.instantiateStreaming!="function"||jt(w)||$(w)||at||typeof fetch!="function"?e(r):fetch(w,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,t).then(r,function(c){return B("wasm streaming compile failed: "+c),B("falling back to ArrayBuffer instantiation"),e(r)})})}if(fn(),i.instantiateWasm)try{return i.instantiateWasm(t,n)}catch(a){B("Module.instantiateWasm callback failed with error: "+a),x(a)}return o().catch(x),{}}function hn(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function lt(t){for(;t.length>0;)t.shift()(i)}function mn(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(n){g[this.ptr+4>>2]=n},this.get_type=function(){return g[this.ptr+4>>2]},this.set_destructor=function(n){g[this.ptr+8>>2]=n},this.get_destructor=function(){return g[this.ptr+8>>2]},this.set_refcount=function(n){h[this.ptr>>2]=n},this.set_caught=function(n){n=n?1:0,P[this.ptr+12>>0]=n},this.get_caught=function(){return P[this.ptr+12>>0]!=0},this.set_rethrown=function(n){n=n?1:0,P[this.ptr+13>>0]=n},this.get_rethrown=function(){return P[this.ptr+13>>0]!=0},this.init=function(n,r){this.set_adjusted_ptr(0),this.set_type(n),this.set_destructor(r),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var n=h[this.ptr>>2];h[this.ptr>>2]=n+1},this.release_ref=function(){var n=h[this.ptr>>2];return h[this.ptr>>2]=n-1,n===1},this.set_adjusted_ptr=function(n){g[this.ptr+16>>2]=n},this.get_adjusted_ptr=function(){return g[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Xt(this.get_type()))return g[this.excPtr>>2];var n=this.get_adjusted_ptr();return n!==0?n:this.excPtr}}function yn(t,n,r){throw new mn(t).init(n,r),t}function gn(t,n,r,e,o){}function pt(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}function vn(){for(var t=new Array(256),n=0;n<256;++n)t[n]=String.fromCharCode(n);xt=t}jt(w="lclayout.wasm")||(w=Qt(w));var xt=void 0;function b(t){for(var n="",r=t;_[r];)n+=xt[_[r++]];return n}var I={},H={},K={},_n=48,wn=57;function bn(t){if(t===void 0)return"_unknown";var n=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return n>=_n&&n<=wn?"_"+t:t}function An(t,n){return t=bn(t),function(){return n.apply(this,arguments)}}function dt(t,n){var r=An(n,function(e){this.name=n,this.message=e;var o=new Error(e).stack;o!==void 0&&(this.stack=this.toString()+` +`+o.replace(/^Error(:[^\n]*)?\n/,""))});return r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},r}var Dt=void 0;function A(t){throw new Dt(t)}var kt=void 0;function Ut(t){throw new kt(t)}function It(t,n,r){function e(f){var s=r(f);s.length!==t.length&&Ut("Mismatched type converter count");for(var p=0;p{H.hasOwnProperty(f)?o[s]=H[f]:(a.push(f),I.hasOwnProperty(f)||(I[f]=[]),I[f].push(()=>{o[s]=H[f],++c===a.length&&e(o)}))}),a.length===0&&e(o)}function R(t,n,r={}){if(!("argPackAdvance"in n))throw new TypeError("registerType registeredInstance requires argPackAdvance");var e=n.name;if(t||A('type "'+e+'" must have a positive integer typeid pointer'),H.hasOwnProperty(t)){if(r.ignoreDuplicateRegistrations)return;A("Cannot register type '"+e+"' twice")}if(H[t]=n,delete K[t],I.hasOwnProperty(t)){var o=I[t];delete I[t],o.forEach(a=>a())}}function Tn(t,n,r,e,o){var a=pt(r);R(t,{name:n=b(n),fromWireType:function(c){return!!c},toWireType:function(c,f){return f?e:o},argPackAdvance:8,readValueFromPointer:function(c){var f;if(r===1)f=P;else if(r===2)f=U;else{if(r!==4)throw new TypeError("Unknown boolean type size: "+n);f=h}return this.fromWireType(f[c>>a])},destructorFunction:null})}function Cn(t,n,r){t=b(t),It([],[n],function(e){return e=e[0],i[t]=e.fromWireType(r),[]})}var ht=[],S=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function En(t){t>4&&--S[t].refcount==0&&(S[t]=void 0,ht.push(t))}function Fn(){for(var t=0,n=5;n(t||A("Cannot use deleted val. handle = "+t),S[t].value),toHandle:t=>{switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var n=ht.length?ht.pop():S.length;return S[n]={refcount:1,value:t},n}}};function mt(t){return this.fromWireType(h[t>>2])}function Wn(t,n){R(t,{name:n=b(n),fromWireType:function(r){var e=Ht.toValue(r);return En(r),e},toWireType:function(r,e){return Ht.toHandle(e)},argPackAdvance:8,readValueFromPointer:mt,destructorFunction:null})}function Mn(t,n){switch(n){case 2:return function(r){return this.fromWireType(bt[r>>2])};case 3:return function(r){return this.fromWireType(At[r>>3])};default:throw new TypeError("Unknown float type: "+t)}}function Rn(t,n,r){var e=pt(r);R(t,{name:n=b(n),fromWireType:function(o){return o},toWireType:function(o,a){return a},argPackAdvance:8,readValueFromPointer:Mn(n,e),destructorFunction:null})}function jn(t){for(;t.length;){var n=t.pop();t.pop()(n)}}function On(t,n,r,e,o){var a=n.length;a<2&&A("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var c=n[1]!==null&&r!==null,f=!1,s=1;s>2]);return r}function Un(t,n,r){i.hasOwnProperty(t)||Ut("Replacing nonexistant public symbol"),i[t].overloadTable!==void 0&&r!==void 0?i[t].overloadTable[r]=n:(i[t]=n,i[t].argCount=r)}function In(t,n,r){var e=i["dynCall_"+t];return r&&r.length?e.apply(null,[n].concat(r)):e.call(null,n)}var Q=[];function Yt(t){var n=Q[t];return n||(t>=Q.length&&(Q.length=t+1),Q[t]=n=Tt.get(t)),n}function Hn(t,n,r){return t.includes("j")?In(t,n,r):Yt(n).apply(null,r)}function Yn(t,n){var r=[];return function(){return r.length=0,Object.assign(r,arguments),Hn(t,n,r)}}function zn(t,n){function r(){return t.includes("j")?Yn(t,n):Yt(n)}t=b(t);var e=r();return typeof e!="function"&&A("unknown function pointer with signature "+t+": "+n),e}var zt=void 0;function Vn(t){var n=Nt(t),r=b(n);return j(n),r}function Bn(t,n){var r=[],e={};function o(a){e[a]||H[a]||(K[a]?K[a].forEach(o):(r.push(a),e[a]=!0))}throw n.forEach(o),new zt(t+": "+r.map(Vn).join([", "]))}function qn(t,n,r,e,o,a){var c=kn(n,r);t=b(t),o=zn(e,o),Dn(t,function(){Bn("Cannot call "+t+" due to unbound types",c)},n-1),It([],c,function(f){var s=[f[0],null].concat(f.slice(1));return Un(t,On(t,s,null,o,a),n-1),[]})}function Ln(t,n,r){switch(n){case 0:return r?function(e){return P[e]}:function(e){return _[e]};case 1:return r?function(e){return U[e>>1]}:function(e){return J[e>>1]};case 2:return r?function(e){return h[e>>2]}:function(e){return g[e>>2]};default:throw new TypeError("Unknown integer type: "+t)}}function Gn(t,n,r,e,o){n=b(n);var a=pt(r),c=d=>d;if(e===0){var f=32-8*r;c=d=>d<>>f}var s=n.includes("unsigned"),p=(d,m)=>{};R(t,{name:n,fromWireType:c,toWireType:s?function(d,m){return p(m,this.name),m>>>0}:function(d,m){return p(m,this.name),m},argPackAdvance:8,readValueFromPointer:Ln(n,a,e!==0),destructorFunction:null})}function Nn(t,n,r){var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][n];function o(a){var c=g,f=c[a>>=2],s=c[a+1];return new e(ft,s,f)}R(t,{name:r=b(r),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})}function Xn(t,n){var r=(n=b(n))==="std::string";R(t,{name:n,fromWireType:function(e){var o,a=g[e>>2],c=e+4;if(r)for(var f=c,s=0;s<=a;++s){var p=c+s;if(s==a||_[p]==0){var d=st(f,p-f);o===void 0?o=d:(o+="\0",o+=d),f=p+1}}else{var m=new Array(a);for(s=0;s>2]=a,r&&c)nn(o,s,a+1);else if(c)for(var p=0;p255&&(j(s),A("String has UTF-16 code units that do not fit in 8 bits")),_[s+p]=d}else for(p=0;p>1,o=e+n/2;!(e>=o)&&J[e];)++e;if((r=e<<1)-t>32&&Vt)return Vt.decode(_.subarray(t,r));for(var a="",c=0;!(c>=n/2);++c){var f=U[t+2*c>>1];if(f==0)break;a+=String.fromCharCode(f)}return a}function Zn(t,n,r){if(r===void 0&&(r=2147483647),r<2)return 0;for(var e=n,o=(r-=2)<2*t.length?r/2:t.length,a=0;a>1]=c,n+=2}return U[n>>1]=0,n-e}function $n(t){return 2*t.length}function Kn(t,n){for(var r=0,e="";!(r>=n/4);){var o=h[t+4*r>>2];if(o==0)break;if(++r,o>=65536){var a=o-65536;e+=String.fromCharCode(55296|a>>10,56320|1023&a)}else e+=String.fromCharCode(o)}return e}function Qn(t,n,r){if(r===void 0&&(r=2147483647),r<4)return 0;for(var e=n,o=e+r-4,a=0;a=55296&&c<=57343&&(c=65536+((1023&c)<<10)|1023&t.charCodeAt(++a)),h[n>>2]=c,(n+=4)+4>o)break}return h[n>>2]=0,n-e}function tr(t){for(var n=0,r=0;r=55296&&e<=57343&&++r,n+=4}return n}function nr(t,n,r){var e,o,a,c,f;r=b(r),n===2?(e=Jn,o=Zn,c=$n,a=()=>J,f=1):n===4&&(e=Kn,o=Qn,c=tr,a=()=>g,f=2),R(t,{name:r,fromWireType:function(s){for(var p,d=g[s>>2],m=a(),y=s+4,T=0;T<=d;++T){var W=s+4+T*n;if(T==d||m[W>>f]==0){var C=e(y,W-y);p===void 0?p=C:(p+="\0",p+=C),y=W+n}}return j(s),p},toWireType:function(s,p){typeof p!="string"&&A("Cannot pass non-string to C++ string type "+r);var d=c(p),m=gt(4+d+n);return g[m>>2]=d>>f,o(p,m+4,d+n),s!==null&&s.push(j,m),m},argPackAdvance:8,readValueFromPointer:mt,destructorFunction:function(s){j(s)}})}function rr(t,n){R(t,{isVoid:!0,name:n=b(n),argPackAdvance:0,fromWireType:function(){},toWireType:function(r,e){}})}var Bt,er=!0;function ir(){return er}function or(){Z("")}function ar(){return Date.now()}function qt(){return 2147483648}function ur(){return qt()}function cr(t,n,r){_.copyWithin(t,n,n+r)}function fr(t){try{return ct.grow(t-ft.byteLength+65535>>>16),St(ct.buffer),1}catch{}}function sr(t){var n=_.length;t>>>=0;var r=qt();if(t>r)return!1;let e=(c,f)=>c+(f-c%f)%f;for(var o=1;o<=4;o*=2){var a=n*(1+.2/o);if(a=Math.min(a,t+100663296),fr(Math.min(r,e(Math.max(t,a),65536))))return!0}return!1}Bt=at?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now();var yt={};function lr(){return ot||"./this.program"}function L(){if(!L.strings){var t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:lr()};for(var n in yt)yt[n]===void 0?delete t[n]:t[n]=yt[n];var r=[];for(var n in t)r.push(n+"="+t[n]);L.strings=r}return L.strings}function pr(t,n,r){for(var e=0;e>0]=t.charCodeAt(e);r||(P[n>>0]=0)}function dr(t,n){var r=0;return L().forEach(function(e,o){var a=n+r;g[t+4*o>>2]=a,pr(e,a),r+=e.length+1}),0}function hr(t,n){var r=L();g[t>>2]=r.length;var e=0;return r.forEach(function(o){e+=o.length+1}),g[n>>2]=e,0}function tt(t){return t%4==0&&(t%100!=0||t%400==0)}function mr(t,n){for(var r=0,e=0;e<=n;r+=t[e++]);return r}var Lt=[31,29,31,30,31,30,31,31,30,31,30,31],Gt=[31,28,31,30,31,30,31,31,30,31,30,31];function yr(t,n){for(var r=new Date(t.getTime());n>0;){var e=tt(r.getFullYear()),o=r.getMonth(),a=(e?Lt:Gt)[o];if(!(n>a-r.getDate()))return r.setDate(r.getDate()+n),r;n-=a-r.getDate()+1,r.setDate(1),o<11?r.setMonth(o+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r}function gr(t,n,r){var e=r>0?r:Pt(t)+1,o=new Array(e),a=Ft(t,o,0,o.length);return n&&(o.length=a),o}function vr(t,n){P.set(t,n)}function _r(t,n,r,e){var o=h[e+40>>2],a={tm_sec:h[e>>2],tm_min:h[e+4>>2],tm_hour:h[e+8>>2],tm_mday:h[e+12>>2],tm_mon:h[e+16>>2],tm_year:h[e+20>>2],tm_wday:h[e+24>>2],tm_yday:h[e+28>>2],tm_isdst:h[e+32>>2],tm_gmtoff:h[e+36>>2],tm_zone:o?st(o):""},c=st(r),f={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var s in f)c=c.replace(new RegExp(s,"g"),f[s]);var p=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],d=["January","February","March","April","May","June","July","August","September","October","November","December"];function m(u,l,E){for(var v=typeof u=="number"?u.toString():u||"";v.length0?1:0}var v;return(v=E(u.getFullYear()-l.getFullYear()))===0&&(v=E(u.getMonth()-l.getMonth()))===0&&(v=E(u.getDate()-l.getDate())),v}function W(u){switch(u.getDay()){case 0:return new Date(u.getFullYear()-1,11,29);case 1:return u;case 2:return new Date(u.getFullYear(),0,3);case 3:return new Date(u.getFullYear(),0,2);case 4:return new Date(u.getFullYear(),0,1);case 5:return new Date(u.getFullYear()-1,11,31);case 6:return new Date(u.getFullYear()-1,11,30)}}function C(u){var l=yr(new Date(u.tm_year+1900,0,1),u.tm_yday),E=new Date(l.getFullYear(),0,4),v=new Date(l.getFullYear()+1,0,4),et=W(E),Ar=W(v);return T(et,l)<=0?T(Ar,l)<=0?l.getFullYear()+1:l.getFullYear():l.getFullYear()-1}var rt={"%a":function(u){return p[u.tm_wday].substring(0,3)},"%A":function(u){return p[u.tm_wday]},"%b":function(u){return d[u.tm_mon].substring(0,3)},"%B":function(u){return d[u.tm_mon]},"%C":function(u){return y((u.tm_year+1900)/100|0,2)},"%d":function(u){return y(u.tm_mday,2)},"%e":function(u){return m(u.tm_mday,2," ")},"%g":function(u){return C(u).toString().substring(2)},"%G":function(u){return C(u)},"%H":function(u){return y(u.tm_hour,2)},"%I":function(u){var l=u.tm_hour;return l==0?l=12:l>12&&(l-=12),y(l,2)},"%j":function(u){return y(u.tm_mday+mr(tt(u.tm_year+1900)?Lt:Gt,u.tm_mon-1),3)},"%m":function(u){return y(u.tm_mon+1,2)},"%M":function(u){return y(u.tm_min,2)},"%n":function(){return` +`},"%p":function(u){return u.tm_hour>=0&&u.tm_hour<12?"AM":"PM"},"%S":function(u){return y(u.tm_sec,2)},"%t":function(){return" "},"%u":function(u){return u.tm_wday||7},"%U":function(u){var l=u.tm_yday+7-u.tm_wday;return y(Math.floor(l/7),2)},"%V":function(u){var l=Math.floor((u.tm_yday+7-(u.tm_wday+6)%7)/7);if((u.tm_wday+371-u.tm_yday-2)%7<=2&&l++,l){if(l==53){var E=(u.tm_wday+371-u.tm_yday)%7;E==4||E==3&&tt(u.tm_year)||(l=1)}}else{l=52;var v=(u.tm_wday+7-u.tm_yday-1)%7;(v==4||v==5&&tt(u.tm_year%400-1))&&l++}return y(l,2)},"%w":function(u){return u.tm_wday},"%W":function(u){var l=u.tm_yday+7-(u.tm_wday+6)%7;return y(Math.floor(l/7),2)},"%y":function(u){return(u.tm_year+1900).toString().substring(2)},"%Y":function(u){return u.tm_year+1900},"%z":function(u){var l=u.tm_gmtoff,E=l>=0;return l=(l=Math.abs(l)/60)/60*100+l%60,(E?"+":"-")+("0000"+l).slice(-4)},"%Z":function(u){return u.tm_zone},"%%":function(){return"%"}};for(var s in c=c.replace(/%%/g,"\0\0"),rt)c.includes(s)&&(c=c.replace(new RegExp(s,"g"),rt[s](a)));var G=gr(c=c.replace(/\0\0/g,"%"),!1);return G.length>n?0:(vr(G,t),G.length-1)}function wr(t,n,r,e,o){return _r(t,n,r,e)}vn(),Dt=i.BindingError=dt(Error,"BindingError"),kt=i.InternalError=dt(Error,"InternalError"),Sn(),zt=i.UnboundTypeError=dt(Error,"UnboundTypeError");var br={a:yn,m:gn,k:Tn,i:Cn,j:Wn,h:Rn,c:qn,d:Gn,b:Nn,g:Xn,e:nr,l:rr,r:ir,f:or,s:ar,n:ur,u:Bt,v:cr,t:sr,p:dr,q:hr,o:wr};dn(),i.___wasm_call_ctors=function(){return(i.___wasm_call_ctors=i.asm.x).apply(null,arguments)};var Nt=i.___getTypeName=function(){return(Nt=i.___getTypeName=i.asm.z).apply(null,arguments)};i.__embind_initialize_bindings=function(){return(i.__embind_initialize_bindings=i.asm.A).apply(null,arguments)};var nt,gt=i._malloc=function(){return(gt=i._malloc=i.asm.B).apply(null,arguments)},j=i._free=function(){return(j=i._free=i.asm.C).apply(null,arguments)},Xt=i.___cxa_is_pointer_type=function(){return(Xt=i.___cxa_is_pointer_type=i.asm.D).apply(null,arguments)};function Jt(t){function n(){nt||(nt=!0,i.calledRun=!0,Ct||(en(),Y(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),on()))}k>0||(rn(),k>0||(i.setStatus?(i.setStatus("Running..."),setTimeout(function(){setTimeout(function(){i.setStatus("")},1),n()},1)):n()))}if(i.dynCall_viijii=function(){return(i.dynCall_viijii=i.asm.E).apply(null,arguments)},i.dynCall_iiiiij=function(){return(i.dynCall_iiiiij=i.asm.F).apply(null,arguments)},i.dynCall_iiiiijj=function(){return(i.dynCall_iiiiijj=i.asm.G).apply(null,arguments)},i.dynCall_iiiiiijj=function(){return(i.dynCall_iiiiiijj=i.asm.H).apply(null,arguments)},q=function t(){nt||Jt(),nt||(q=t)},i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Jt(),O.ready},Zt.exports=$t;var Kt=it.exports;const Fr=Cr({__proto__:null,default:Tr(Kt)},[Kt]);export{Fr as l}; diff --git a/dist/assets/lerc-wasm-v7WMG2so.js b/dist/assets/lerc-wasm-WW-RihuZ.js similarity index 99% rename from dist/assets/lerc-wasm-v7WMG2so.js rename to dist/assets/lerc-wasm-WW-RihuZ.js index 2c74c0a..c254664 100644 --- a/dist/assets/lerc-wasm-v7WMG2so.js +++ b/dist/assets/lerc-wasm-WW-RihuZ.js @@ -1 +1 @@ -import{cg as Tn}from"./index-J0iiHjMT.js";function Dn(e,g){for(var m=0;mp[f]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var tn,S,rn,T={exports:{}};T.exports,tn=T,T.exports,S=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(S=S||__filename),rn=function(e){var g,m;(e=(e=e||{})!==void 0?e:{}).ready=new Promise(function(n,t){g=n,m=t});var p,f,h,D,P,H,q=Object.assign({},e),C=typeof window=="object",v=typeof importScripts=="function",F=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",c="";function sn(n){return e.locateFile?e.locateFile(n,c):c+n}F?(c=v?require("path").dirname(c)+"/":__dirname+"/",H=()=>{P||(D=require("fs"),P=require("path"))},p=function(n,t){return H(),n=P.normalize(n),D.readFileSync(n,t?void 0:"utf8")},h=n=>{var t=p(n,!0);return t.buffer||(t=new Uint8Array(t)),t},f=(n,t,r)=>{H(),n=P.normalize(n),D.readFile(n,function(o,u){o?r(o):t(u.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(n){if(!(n instanceof jn))throw n}),process.on("unhandledRejection",function(n){throw n}),e.inspect=function(){return"[Emscripten Module object]"}):(C||v)&&(v?c=self.location.href:typeof document<"u"&&document.currentScript&&(c=document.currentScript.src),S&&(c=S),c=c.indexOf("blob:")!==0?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",p=n=>{var t=new XMLHttpRequest;return t.open("GET",n,!1),t.send(null),t.responseText},v&&(h=n=>{var t=new XMLHttpRequest;return t.open("GET",n,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),f=(n,t,r)=>{var o=new XMLHttpRequest;o.open("GET",n,!0),o.responseType="arraybuffer",o.onload=()=>{o.status==200||o.status==0&&o.response?t(o.response):r()},o.onerror=r,o.send(null)}),e.print||console.log.bind(console);var w,M,b=e.printErr||console.warn.bind(console);Object.assign(e,q),q=null,e.arguments&&e.arguments,e.thisProgram&&e.thisProgram,e.quit&&e.quit,e.wasmBinary&&(w=e.wasmBinary),e.noExitRuntime,typeof WebAssembly!="object"&&x("no native wasm support detected");var B,A,E,y,d,k,z=!1,L=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function un(n,t,r){for(var o=t+r,u=t;n[u]&&!(u>=o);)++u;if(u-t>16&&n.buffer&&L)return L.decode(n.subarray(t,u));for(var s="";t>10,56320|1023&en)}}else s+=String.fromCharCode((31&i)<<6|l)}else s+=String.fromCharCode(i)}return s}function O(n,t){return n?un(E,n,t):""}function G(n){B=n,e.HEAP8=A=new Int8Array(n),e.HEAP16=new Int16Array(n),e.HEAP32=y=new Int32Array(n),e.HEAPU8=E=new Uint8Array(n),e.HEAPU16=new Uint16Array(n),e.HEAPU32=d=new Uint32Array(n),e.HEAPF32=new Float32Array(n),e.HEAPF64=new Float64Array(n)}e.INITIAL_MEMORY;var X=[],N=[],Y=[];function an(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)pn(e.preRun.shift());W(X)}function cn(){W(N)}function fn(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)hn(e.postRun.shift());W(Y)}function pn(n){X.unshift(n)}function ln(n){N.unshift(n)}function hn(n){Y.unshift(n)}var _=0,R=null;function dn(n){_++,e.monitorRunDependencies&&e.monitorRunDependencies(_)}function mn(n){if(_--,e.monitorRunDependencies&&e.monitorRunDependencies(_),_==0&&R){var t=R;R=null,t()}}function x(n){e.onAbort&&e.onAbort(n),b(n="Aborted("+n+")"),z=!0,n+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(n);throw m(t),t}var a,_n="data:application/octet-stream;base64,";function $(n){return n.startsWith(_n)}function J(n){return n.startsWith("file://")}function K(n){try{if(n==a&&w)return new Uint8Array(w);if(h)return h(n);throw"both async and sync fetching of the wasm failed"}catch(t){x(t)}}function yn(){if(!w&&(C||v)){if(typeof fetch=="function"&&!J(a))return fetch(a,{credentials:"same-origin"}).then(function(n){if(!n.ok)throw"failed to load wasm binary file at '"+a+"'";return n.arrayBuffer()}).catch(function(){return K(a)});if(f)return new Promise(function(n,t){f(a,function(r){n(new Uint8Array(r))},t)})}return Promise.resolve().then(function(){return K(a)})}function gn(){var n={a:In};function t(s,i){var l=s.exports;e.asm=l,G((M=e.asm.g).buffer),k=e.asm.m,ln(e.asm.h),mn()}function r(s){t(s.instance)}function o(s){return yn().then(function(i){return WebAssembly.instantiate(i,n)}).then(function(i){return i}).then(s,function(i){b("failed to asynchronously prepare wasm: "+i),x(i)})}function u(){return w||typeof WebAssembly.instantiateStreaming!="function"||$(a)||J(a)||F||typeof fetch!="function"?o(r):fetch(a,{credentials:"same-origin"}).then(function(s){return WebAssembly.instantiateStreaming(s,n).then(r,function(i){return b("wasm streaming compile failed: "+i),b("falling back to ArrayBuffer instantiation"),o(r)})})}if(dn(),e.instantiateWasm)try{return e.instantiateWasm(n,t)}catch(s){return b("Module.instantiateWasm callback failed with error: "+s),!1}return u().catch(m),{}}function W(n){for(;n.length>0;){var t=n.shift();if(typeof t!="function"){var r=t.func;typeof r=="number"?t.arg===void 0?Q(r)():Q(r)(t.arg):r(t.arg===void 0?null:t.arg)}else t(e)}}$(a="lerc-wasm.wasm")||(a=sn(a));var I=[];function Q(n){var t=I[n];return t||(n>=I.length&&(I.length=n+1),I[n]=t=k.get(n)),t}function vn(n,t,r,o){x("Assertion failed: "+O(n)+", at: "+[t?O(t):"unknown filename",r,o?O(o):"unknown function"])}function wn(n){return V(n+24)+24}function bn(n){this.excPtr=n,this.ptr=n-24,this.set_type=function(t){d[this.ptr+4>>2]=t},this.get_type=function(){return d[this.ptr+4>>2]},this.set_destructor=function(t){d[this.ptr+8>>2]=t},this.get_destructor=function(){return d[this.ptr+8>>2]},this.set_refcount=function(t){y[this.ptr>>2]=t},this.set_caught=function(t){t=t?1:0,A[this.ptr+12>>0]=t},this.get_caught=function(){return A[this.ptr+12>>0]!=0},this.set_rethrown=function(t){t=t?1:0,A[this.ptr+13>>0]=t},this.get_rethrown=function(){return A[this.ptr+13>>0]!=0},this.init=function(t,r){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(r),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=y[this.ptr>>2];y[this.ptr>>2]=t+1},this.release_ref=function(){var t=y[this.ptr>>2];return y[this.ptr>>2]=t-1,t===1},this.set_adjusted_ptr=function(t){d[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return d[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Z(this.get_type()))return d[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}function An(n,t,r){throw new bn(n).init(t,r),n}function Rn(){x("")}function xn(n,t,r){E.copyWithin(n,t,t+r)}function Sn(){return 2147483648}function Pn(n){try{return M.grow(n-B.byteLength+65535>>>16),G(M.buffer),1}catch{}}function En(n){var t=E.length;n>>>=0;var r=Sn();if(n>r)return!1;let o=(i,l)=>i+(l-i%l)%l;for(var u=1;u<=4;u*=2){var s=t*(1+.2/u);if(s=Math.min(s,n+100663296),Pn(Math.min(r,o(Math.max(n,s),65536))))return!0}return!1}var In={a:vn,c:wn,b:An,d:Rn,f:xn,e:En};gn(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.h).apply(null,arguments)},e._lerc_getBlobInfo=function(){return(e._lerc_getBlobInfo=e.asm.i).apply(null,arguments)},e._lerc_getDataRanges=function(){return(e._lerc_getDataRanges=e.asm.j).apply(null,arguments)},e._lerc_decode=function(){return(e._lerc_decode=e.asm.k).apply(null,arguments)},e._lerc_decode_4D=function(){return(e._lerc_decode_4D=e.asm.l).apply(null,arguments)};var V=e._malloc=function(){return(V=e._malloc=e.asm.n).apply(null,arguments)};e._free=function(){return(e._free=e.asm.o).apply(null,arguments)};var j,Z=e.___cxa_is_pointer_type=function(){return(Z=e.___cxa_is_pointer_type=e.asm.p).apply(null,arguments)};function jn(n){this.name="ExitStatus",this.message="Program terminated with exit("+n+")",this.status=n}function U(n){function t(){j||(j=!0,e.calledRun=!0,z||(cn(),g(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),fn()))}_>0||(an(),_>0||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),t()},1)):t()))}if(R=function n(){j||U(),j||(R=n)},e.run=U,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return U(),e.ready},tn.exports=rn;var on=T.exports;const Mn=Dn({__proto__:null,default:Tn(on)},[on]);export{Mn as l}; +import{aR as Tn}from"./index-pCX-0tJH.js";function Dn(e,g){for(var m=0;mp[f]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var tn,S,rn,T={exports:{}};T.exports,tn=T,T.exports,S=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(S=S||__filename),rn=function(e){var g,m;(e=(e=e||{})!==void 0?e:{}).ready=new Promise(function(n,t){g=n,m=t});var p,f,h,D,P,H,q=Object.assign({},e),C=typeof window=="object",v=typeof importScripts=="function",F=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",c="";function sn(n){return e.locateFile?e.locateFile(n,c):c+n}F?(c=v?require("path").dirname(c)+"/":__dirname+"/",H=()=>{P||(D=require("fs"),P=require("path"))},p=function(n,t){return H(),n=P.normalize(n),D.readFileSync(n,t?void 0:"utf8")},h=n=>{var t=p(n,!0);return t.buffer||(t=new Uint8Array(t)),t},f=(n,t,r)=>{H(),n=P.normalize(n),D.readFile(n,function(o,u){o?r(o):t(u.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(n){if(!(n instanceof jn))throw n}),process.on("unhandledRejection",function(n){throw n}),e.inspect=function(){return"[Emscripten Module object]"}):(C||v)&&(v?c=self.location.href:typeof document<"u"&&document.currentScript&&(c=document.currentScript.src),S&&(c=S),c=c.indexOf("blob:")!==0?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",p=n=>{var t=new XMLHttpRequest;return t.open("GET",n,!1),t.send(null),t.responseText},v&&(h=n=>{var t=new XMLHttpRequest;return t.open("GET",n,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),f=(n,t,r)=>{var o=new XMLHttpRequest;o.open("GET",n,!0),o.responseType="arraybuffer",o.onload=()=>{o.status==200||o.status==0&&o.response?t(o.response):r()},o.onerror=r,o.send(null)}),e.print||console.log.bind(console);var w,M,b=e.printErr||console.warn.bind(console);Object.assign(e,q),q=null,e.arguments&&e.arguments,e.thisProgram&&e.thisProgram,e.quit&&e.quit,e.wasmBinary&&(w=e.wasmBinary),e.noExitRuntime,typeof WebAssembly!="object"&&x("no native wasm support detected");var B,A,E,y,d,k,z=!1,L=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function un(n,t,r){for(var o=t+r,u=t;n[u]&&!(u>=o);)++u;if(u-t>16&&n.buffer&&L)return L.decode(n.subarray(t,u));for(var s="";t>10,56320|1023&en)}}else s+=String.fromCharCode((31&i)<<6|l)}else s+=String.fromCharCode(i)}return s}function O(n,t){return n?un(E,n,t):""}function G(n){B=n,e.HEAP8=A=new Int8Array(n),e.HEAP16=new Int16Array(n),e.HEAP32=y=new Int32Array(n),e.HEAPU8=E=new Uint8Array(n),e.HEAPU16=new Uint16Array(n),e.HEAPU32=d=new Uint32Array(n),e.HEAPF32=new Float32Array(n),e.HEAPF64=new Float64Array(n)}e.INITIAL_MEMORY;var X=[],N=[],Y=[];function an(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)pn(e.preRun.shift());W(X)}function cn(){W(N)}function fn(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)hn(e.postRun.shift());W(Y)}function pn(n){X.unshift(n)}function ln(n){N.unshift(n)}function hn(n){Y.unshift(n)}var _=0,R=null;function dn(n){_++,e.monitorRunDependencies&&e.monitorRunDependencies(_)}function mn(n){if(_--,e.monitorRunDependencies&&e.monitorRunDependencies(_),_==0&&R){var t=R;R=null,t()}}function x(n){e.onAbort&&e.onAbort(n),b(n="Aborted("+n+")"),z=!0,n+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(n);throw m(t),t}var a,_n="data:application/octet-stream;base64,";function $(n){return n.startsWith(_n)}function J(n){return n.startsWith("file://")}function K(n){try{if(n==a&&w)return new Uint8Array(w);if(h)return h(n);throw"both async and sync fetching of the wasm failed"}catch(t){x(t)}}function yn(){if(!w&&(C||v)){if(typeof fetch=="function"&&!J(a))return fetch(a,{credentials:"same-origin"}).then(function(n){if(!n.ok)throw"failed to load wasm binary file at '"+a+"'";return n.arrayBuffer()}).catch(function(){return K(a)});if(f)return new Promise(function(n,t){f(a,function(r){n(new Uint8Array(r))},t)})}return Promise.resolve().then(function(){return K(a)})}function gn(){var n={a:In};function t(s,i){var l=s.exports;e.asm=l,G((M=e.asm.g).buffer),k=e.asm.m,ln(e.asm.h),mn()}function r(s){t(s.instance)}function o(s){return yn().then(function(i){return WebAssembly.instantiate(i,n)}).then(function(i){return i}).then(s,function(i){b("failed to asynchronously prepare wasm: "+i),x(i)})}function u(){return w||typeof WebAssembly.instantiateStreaming!="function"||$(a)||J(a)||F||typeof fetch!="function"?o(r):fetch(a,{credentials:"same-origin"}).then(function(s){return WebAssembly.instantiateStreaming(s,n).then(r,function(i){return b("wasm streaming compile failed: "+i),b("falling back to ArrayBuffer instantiation"),o(r)})})}if(dn(),e.instantiateWasm)try{return e.instantiateWasm(n,t)}catch(s){return b("Module.instantiateWasm callback failed with error: "+s),!1}return u().catch(m),{}}function W(n){for(;n.length>0;){var t=n.shift();if(typeof t!="function"){var r=t.func;typeof r=="number"?t.arg===void 0?Q(r)():Q(r)(t.arg):r(t.arg===void 0?null:t.arg)}else t(e)}}$(a="lerc-wasm.wasm")||(a=sn(a));var I=[];function Q(n){var t=I[n];return t||(n>=I.length&&(I.length=n+1),I[n]=t=k.get(n)),t}function vn(n,t,r,o){x("Assertion failed: "+O(n)+", at: "+[t?O(t):"unknown filename",r,o?O(o):"unknown function"])}function wn(n){return V(n+24)+24}function bn(n){this.excPtr=n,this.ptr=n-24,this.set_type=function(t){d[this.ptr+4>>2]=t},this.get_type=function(){return d[this.ptr+4>>2]},this.set_destructor=function(t){d[this.ptr+8>>2]=t},this.get_destructor=function(){return d[this.ptr+8>>2]},this.set_refcount=function(t){y[this.ptr>>2]=t},this.set_caught=function(t){t=t?1:0,A[this.ptr+12>>0]=t},this.get_caught=function(){return A[this.ptr+12>>0]!=0},this.set_rethrown=function(t){t=t?1:0,A[this.ptr+13>>0]=t},this.get_rethrown=function(){return A[this.ptr+13>>0]!=0},this.init=function(t,r){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(r),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=y[this.ptr>>2];y[this.ptr>>2]=t+1},this.release_ref=function(){var t=y[this.ptr>>2];return y[this.ptr>>2]=t-1,t===1},this.set_adjusted_ptr=function(t){d[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return d[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Z(this.get_type()))return d[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}function An(n,t,r){throw new bn(n).init(t,r),n}function Rn(){x("")}function xn(n,t,r){E.copyWithin(n,t,t+r)}function Sn(){return 2147483648}function Pn(n){try{return M.grow(n-B.byteLength+65535>>>16),G(M.buffer),1}catch{}}function En(n){var t=E.length;n>>>=0;var r=Sn();if(n>r)return!1;let o=(i,l)=>i+(l-i%l)%l;for(var u=1;u<=4;u*=2){var s=t*(1+.2/u);if(s=Math.min(s,n+100663296),Pn(Math.min(r,o(Math.max(n,s),65536))))return!0}return!1}var In={a:vn,c:wn,b:An,d:Rn,f:xn,e:En};gn(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.h).apply(null,arguments)},e._lerc_getBlobInfo=function(){return(e._lerc_getBlobInfo=e.asm.i).apply(null,arguments)},e._lerc_getDataRanges=function(){return(e._lerc_getDataRanges=e.asm.j).apply(null,arguments)},e._lerc_decode=function(){return(e._lerc_decode=e.asm.k).apply(null,arguments)},e._lerc_decode_4D=function(){return(e._lerc_decode_4D=e.asm.l).apply(null,arguments)};var V=e._malloc=function(){return(V=e._malloc=e.asm.n).apply(null,arguments)};e._free=function(){return(e._free=e.asm.o).apply(null,arguments)};var j,Z=e.___cxa_is_pointer_type=function(){return(Z=e.___cxa_is_pointer_type=e.asm.p).apply(null,arguments)};function jn(n){this.name="ExitStatus",this.message="Program terminated with exit("+n+")",this.status=n}function U(n){function t(){j||(j=!0,e.calledRun=!0,z||(cn(),g(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),fn()))}_>0||(an(),_>0||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),t()},1)):t()))}if(R=function n(){j||U(),j||(R=n)},e.run=U,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return U(),e.ready},tn.exports=rn;var on=T.exports;const Mn=Dn({__proto__:null,default:Tn(on)},[on]);export{Mn as l}; diff --git a/dist/assets/libtess-R_Me7Q5k.js b/dist/assets/libtess-TicJCr20.js similarity index 78% rename from dist/assets/libtess-R_Me7Q5k.js rename to dist/assets/libtess-TicJCr20.js index dec8218..d1ab438 100644 --- a/dist/assets/libtess-R_Me7Q5k.js +++ b/dist/assets/libtess-TicJCr20.js @@ -1 +1 @@ -import{cg as Zn}from"./index-J0iiHjMT.js";function nt(S,O){for(var T=0;Tf[t]})}}}return Object.freeze(Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}))}var $,pn,J={exports:{}};J.exports,$=J,(pn=function(){function S(O){const T=O.locateFile,f={};var t=t!==void 0?t:{};const _=(()=>{let n;return{resolve:e=>n(e),promise:new Promise(e=>n=e)}})(),hn=()=>_.promise;t.locateFile=T,t.onRuntimeInitialized=()=>{_.resolve(f)},f.Module=t,f.whenLoaded=hn;var h,j={};for(h in t)t.hasOwnProperty(h)&&(j[h]=t[h]);var D,W,U,E,R,K=typeof window=="object",x=typeof importScripts=="function",gn=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",p="";function dn(n){return t.locateFile?t.locateFile(n,p):p+n}gn?(p=x?require("path").dirname(p)+"/":__dirname+"/",D=function(n,e){return E||(E=require("fs")),R||(R=require("path")),n=R.normalize(n),E.readFileSync(n,e?null:"utf8")},U=function(n){var e=D(n,!0);return e.buffer||(e=new Uint8Array(e)),bn(e.buffer),e},W=function(n,e,r){E||(E=require("fs")),R||(R=require("path")),n=R.normalize(n),E.readFile(n,function(o,i){o?r(o):e(i.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),$.exports=t,process.on("uncaughtException",function(n){if(!(n instanceof $n))throw n}),process.on("unhandledRejection",q),t.inspect=function(){return"[Emscripten Module object]"}):(K||x)&&(x?p=self.location.href:typeof document<"u"&&document.currentScript&&(p=document.currentScript.src),p=p.indexOf("blob:")!==0?p.substr(0,p.lastIndexOf("/")+1):"",D=function(n){var e=new XMLHttpRequest;return e.open("GET",n,!1),e.send(null),e.responseText},x&&(U=function(n){var e=new XMLHttpRequest;return e.open("GET",n,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),W=function(n,e,r){var o=new XMLHttpRequest;o.open("GET",n,!0),o.responseType="arraybuffer",o.onload=function(){o.status==200||o.status==0&&o.response?e(o.response):r()},o.onerror=r,o.send(null)});var yn=t.print||console.log.bind(console),P=t.printErr||console.warn.bind(console);for(h in j)j.hasOwnProperty(h)&&(t[h]=j[h]);j=null,t.arguments&&t.arguments,t.thisProgram&&t.thisProgram,t.quit&&t.quit;var I,z,Q=0,vn=function(n){Q=n},wn=function(){return Q};t.wasmBinary&&(I=t.wasmBinary),t.noExitRuntime,typeof WebAssembly!="object"&&q("no native wasm support detected");var V=!1;function bn(n,e){n||q("Assertion failed: "+e)}var Z,H,M,m,nn=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function tn(n,e,r){for(var o=e+r,i=e;n[i]&&!(i>=o);)++i;if(i-e>16&&n.subarray&&nn)return nn.decode(n.subarray(e,i));for(var u="";e>10,56320|1023&C)}}else u+=String.fromCharCode((31&a)<<6|l)}else u+=String.fromCharCode(a)}return u}function An(n,e){return n?tn(H,n,e):""}function _n(n,e){return n%e>0&&(n+=e-n%e),n}function en(n){Z=n,t.HEAP8=new Int8Array(n),t.HEAP16=new Int16Array(n),t.HEAP32=M=new Int32Array(n),t.HEAPU8=H=new Uint8Array(n),t.HEAPU16=new Uint16Array(n),t.HEAPU32=new Uint32Array(n),t.HEAPF32=new Float32Array(n),t.HEAPF64=new Float64Array(n)}t.INITIAL_MEMORY;var rn=[],on=[],un=[];function En(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)Sn(t.preRun.shift());N(rn)}function Rn(){N(on)}function Pn(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)jn(t.postRun.shift());N(un)}function Sn(n){rn.unshift(n)}function Tn(n){on.unshift(n)}function jn(n){un.unshift(n)}var y=0,F=null;function xn(n){y++,t.monitorRunDependencies&&t.monitorRunDependencies(y)}function In(n){if(y--,t.monitorRunDependencies&&t.monitorRunDependencies(y),y==0&&F){var e=F;F=null,e()}}function q(n){throw t.onAbort&&t.onAbort(n),P(n+=""),V=!0,n="abort("+n+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(n)}t.preloadedImages={},t.preloadedAudios={};var s,Hn="data:application/octet-stream;base64,";function an(n){return n.startsWith(Hn)}function sn(n){return n.startsWith("file://")}function fn(n){try{if(n==s&&I)return new Uint8Array(I);if(U)return U(n);throw"both async and sync fetching of the wasm failed"}catch(e){q(e)}}function Mn(){if(!I&&(K||x)){if(typeof fetch=="function"&&!sn(s))return fetch(s,{credentials:"same-origin"}).then(function(n){if(!n.ok)throw"failed to load wasm binary file at '"+s+"'";return n.arrayBuffer()}).catch(function(){return fn(s)});if(W)return new Promise(function(n,e){W(s,function(r){n(new Uint8Array(r))},e)})}return Promise.resolve().then(function(){return fn(s)})}function Fn(){var n={a:Bn};function e(u,a){var l=u.exports;t.asm=l,en((z=t.asm.m).buffer),m=t.asm.q,Tn(t.asm.n),In()}function r(u){e(u.instance)}function o(u){return Mn().then(function(a){return WebAssembly.instantiate(a,n)}).then(u,function(a){P("failed to asynchronously prepare wasm: "+a),q(a)})}function i(){return I||typeof WebAssembly.instantiateStreaming!="function"||an(s)||sn(s)||typeof fetch!="function"?o(r):fetch(s,{credentials:"same-origin"}).then(function(u){return WebAssembly.instantiateStreaming(u,n).then(r,function(a){return P("wasm streaming compile failed: "+a),P("falling back to ArrayBuffer instantiation"),o(r)})})}if(xn(),t.instantiateWasm)try{return t.instantiateWasm(n,e)}catch(u){return P("Module.instantiateWasm callback failed with error: "+u),!1}return i(),{}}function N(n){for(;n.length>0;){var e=n.shift();if(typeof e!="function"){var r=e.func;typeof r=="number"?e.arg===void 0?m.get(r)():m.get(r)(e.arg):r(e.arg===void 0?null:e.arg)}else e(t)}}function qn(){throw"longjmp"}function Cn(n,e,r){H.copyWithin(n,e,e+r)}function On(n){try{return z.grow(n-Z.byteLength+65535>>>16),en(z.buffer),1}catch{}}function Wn(n){var e=H.length,r=2147483648;if((n>>>=0)>r)return!1;for(var o=1;o<=4;o*=2){var i=e*(1+.2/o);if(i=Math.min(i,n+100663296),On(Math.min(r,_n(Math.max(n,i),65536))))return!0}return!1}an(s="libtess.wasm")||(s=dn(s));var L={mappings:{},buffers:[null,[],[]],printChar:function(n,e){var r=L.buffers[n];e===0||e===10?((n===1?yn:P)(tn(r,0)),r.length=0):r.push(e)},varargs:void 0,get:function(){return L.varargs+=4,M[L.varargs-4>>2]},getStr:function(n){return An(n)},get64:function(n,e){return n}};function Un(n,e,r,o){for(var i=0,u=0;u>2],l=M[e+(8*u+4)>>2],d=0;d>2]=i,0}function Ln(){return wn()}function kn(n){vn(n)}var Bn={h:qn,l:Cn,g:Wn,f:Un,b:Ln,k:Gn,d:Nn,j:Xn,i:Yn,e:zn,c:Dn,a:kn};Fn(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.n).apply(null,arguments)},t._malloc=function(){return(t._malloc=t.asm.o).apply(null,arguments)},t._free=function(){return(t._free=t.asm.p).apply(null,arguments)},t._triangulate=function(){return(t._triangulate=t.asm.r).apply(null,arguments)};var k,v=t.stackSave=function(){return(v=t.stackSave=t.asm.s).apply(null,arguments)},w=t.stackRestore=function(){return(w=t.stackRestore=t.asm.t).apply(null,arguments)},b=t._setThrew=function(){return(b=t._setThrew=t.asm.u).apply(null,arguments)};function Dn(n,e,r){var o=v();try{m.get(n)(e,r)}catch(i){if(w(o),i!==i+0&&i!=="longjmp")throw i;b(1,0)}}function zn(n,e){var r=v();try{m.get(n)(e)}catch(o){if(w(r),o!==o+0&&o!=="longjmp")throw o;b(1,0)}}function Nn(n,e){var r=v();try{return m.get(n)(e)}catch(o){if(w(r),o!==o+0&&o!=="longjmp")throw o;b(1,0)}}function Gn(n){var e=v();try{return m.get(n)()}catch(r){if(w(e),r!==r+0&&r!=="longjmp")throw r;b(1,0)}}function Xn(n,e,r){var o=v();try{return m.get(n)(e,r)}catch(i){if(w(o),i!==i+0&&i!=="longjmp")throw i;b(1,0)}}function Yn(n,e,r,o){var i=v();try{return m.get(n)(e,r,o)}catch(u){if(w(i),u!==u+0&&u!=="longjmp")throw u;b(1,0)}}function $n(n){this.name="ExitStatus",this.message="Program terminated with exit("+n+")",this.status=n}function G(n){function e(){k||(k=!0,t.calledRun=!0,V||(Rn(),t.onRuntimeInitialized&&t.onRuntimeInitialized(),Pn()))}y>0||(En(),y>0||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),e()},1)):e()))}if(F=function n(){k||G(),k||(F=n)},t.run=G,t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();G();let X=null,g=null,A=null,B=null;const c=f.Module,Jn=2,cn=4e3;let ln=0;const Kn=(n,e,r)=>{X||(X=c._triangulate);let o=c.HEAPF32;const i=c.HEAP32.BYTES_PER_ELEMENT,u=2,a=o.BYTES_PER_ELEMENT;r>ln&&(ln=r,A&&(c._free(A),A=0),g&&(c._free(g),g=0)),A||(A=c._malloc(r*a)),B||(B=c._malloc(cn*i));const l=r*Jn;g||(g=c._malloc(l*a)),o=c.HEAPF32,o.set(n,A/a),c.HEAP32.set(e,B/i);const d=l/u,C=X(A,B,Math.min(e.length,cn),u,g,d),Qn=C*u;o=c.HEAPF32;const Vn=o.slice(g/a,g/a+Qn),Y={};return Y.buffer=Vn,Y.vertexCount=C,Y};return f.triangulate=Kn,f.whenLoaded()}return{load:S}}())!==void 0&&($.exports=pn);var mn=J.exports;const et=nt({__proto__:null,default:Zn(mn)},[mn]);export{et as l}; +import{aR as Zn}from"./index-pCX-0tJH.js";function nt(S,O){for(var T=0;Tf[t]})}}}return Object.freeze(Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}))}var $,pn,J={exports:{}};J.exports,$=J,(pn=function(){function S(O){const T=O.locateFile,f={};var t=t!==void 0?t:{};const _=(()=>{let n;return{resolve:e=>n(e),promise:new Promise(e=>n=e)}})(),hn=()=>_.promise;t.locateFile=T,t.onRuntimeInitialized=()=>{_.resolve(f)},f.Module=t,f.whenLoaded=hn;var h,j={};for(h in t)t.hasOwnProperty(h)&&(j[h]=t[h]);var D,W,U,E,R,K=typeof window=="object",x=typeof importScripts=="function",gn=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",p="";function dn(n){return t.locateFile?t.locateFile(n,p):p+n}gn?(p=x?require("path").dirname(p)+"/":__dirname+"/",D=function(n,e){return E||(E=require("fs")),R||(R=require("path")),n=R.normalize(n),E.readFileSync(n,e?null:"utf8")},U=function(n){var e=D(n,!0);return e.buffer||(e=new Uint8Array(e)),bn(e.buffer),e},W=function(n,e,r){E||(E=require("fs")),R||(R=require("path")),n=R.normalize(n),E.readFile(n,function(o,i){o?r(o):e(i.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),$.exports=t,process.on("uncaughtException",function(n){if(!(n instanceof $n))throw n}),process.on("unhandledRejection",q),t.inspect=function(){return"[Emscripten Module object]"}):(K||x)&&(x?p=self.location.href:typeof document<"u"&&document.currentScript&&(p=document.currentScript.src),p=p.indexOf("blob:")!==0?p.substr(0,p.lastIndexOf("/")+1):"",D=function(n){var e=new XMLHttpRequest;return e.open("GET",n,!1),e.send(null),e.responseText},x&&(U=function(n){var e=new XMLHttpRequest;return e.open("GET",n,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),W=function(n,e,r){var o=new XMLHttpRequest;o.open("GET",n,!0),o.responseType="arraybuffer",o.onload=function(){o.status==200||o.status==0&&o.response?e(o.response):r()},o.onerror=r,o.send(null)});var yn=t.print||console.log.bind(console),P=t.printErr||console.warn.bind(console);for(h in j)j.hasOwnProperty(h)&&(t[h]=j[h]);j=null,t.arguments&&t.arguments,t.thisProgram&&t.thisProgram,t.quit&&t.quit;var I,z,Q=0,vn=function(n){Q=n},wn=function(){return Q};t.wasmBinary&&(I=t.wasmBinary),t.noExitRuntime,typeof WebAssembly!="object"&&q("no native wasm support detected");var V=!1;function bn(n,e){n||q("Assertion failed: "+e)}var Z,H,M,m,nn=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function tn(n,e,r){for(var o=e+r,i=e;n[i]&&!(i>=o);)++i;if(i-e>16&&n.subarray&&nn)return nn.decode(n.subarray(e,i));for(var a="";e>10,56320|1023&C)}}else a+=String.fromCharCode((31&u)<<6|l)}else a+=String.fromCharCode(u)}return a}function An(n,e){return n?tn(H,n,e):""}function _n(n,e){return n%e>0&&(n+=e-n%e),n}function en(n){Z=n,t.HEAP8=new Int8Array(n),t.HEAP16=new Int16Array(n),t.HEAP32=M=new Int32Array(n),t.HEAPU8=H=new Uint8Array(n),t.HEAPU16=new Uint16Array(n),t.HEAPU32=new Uint32Array(n),t.HEAPF32=new Float32Array(n),t.HEAPF64=new Float64Array(n)}t.INITIAL_MEMORY;var rn=[],on=[],an=[];function En(){if(t.preRun)for(typeof t.preRun=="function"&&(t.preRun=[t.preRun]);t.preRun.length;)Sn(t.preRun.shift());N(rn)}function Rn(){N(on)}function Pn(){if(t.postRun)for(typeof t.postRun=="function"&&(t.postRun=[t.postRun]);t.postRun.length;)jn(t.postRun.shift());N(an)}function Sn(n){rn.unshift(n)}function Tn(n){on.unshift(n)}function jn(n){an.unshift(n)}var y=0,F=null;function xn(n){y++,t.monitorRunDependencies&&t.monitorRunDependencies(y)}function In(n){if(y--,t.monitorRunDependencies&&t.monitorRunDependencies(y),y==0&&F){var e=F;F=null,e()}}function q(n){throw t.onAbort&&t.onAbort(n),P(n+=""),V=!0,n="abort("+n+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(n)}t.preloadedImages={},t.preloadedAudios={};var s,Hn="data:application/octet-stream;base64,";function un(n){return n.startsWith(Hn)}function sn(n){return n.startsWith("file://")}function fn(n){try{if(n==s&&I)return new Uint8Array(I);if(U)return U(n);throw"both async and sync fetching of the wasm failed"}catch(e){q(e)}}function Mn(){if(!I&&(K||x)){if(typeof fetch=="function"&&!sn(s))return fetch(s,{credentials:"same-origin"}).then(function(n){if(!n.ok)throw"failed to load wasm binary file at '"+s+"'";return n.arrayBuffer()}).catch(function(){return fn(s)});if(W)return new Promise(function(n,e){W(s,function(r){n(new Uint8Array(r))},e)})}return Promise.resolve().then(function(){return fn(s)})}function Fn(){var n={a:Bn};function e(a,u){var l=a.exports;t.asm=l,en((z=t.asm.m).buffer),m=t.asm.q,Tn(t.asm.n),In()}function r(a){e(a.instance)}function o(a){return Mn().then(function(u){return WebAssembly.instantiate(u,n)}).then(a,function(u){P("failed to asynchronously prepare wasm: "+u),q(u)})}function i(){return I||typeof WebAssembly.instantiateStreaming!="function"||un(s)||sn(s)||typeof fetch!="function"?o(r):fetch(s,{credentials:"same-origin"}).then(function(a){return WebAssembly.instantiateStreaming(a,n).then(r,function(u){return P("wasm streaming compile failed: "+u),P("falling back to ArrayBuffer instantiation"),o(r)})})}if(xn(),t.instantiateWasm)try{return t.instantiateWasm(n,e)}catch(a){return P("Module.instantiateWasm callback failed with error: "+a),!1}return i(),{}}function N(n){for(;n.length>0;){var e=n.shift();if(typeof e!="function"){var r=e.func;typeof r=="number"?e.arg===void 0?m.get(r)():m.get(r)(e.arg):r(e.arg===void 0?null:e.arg)}else e(t)}}function qn(){throw"longjmp"}function Cn(n,e,r){H.copyWithin(n,e,e+r)}function On(n){try{return z.grow(n-Z.byteLength+65535>>>16),en(z.buffer),1}catch{}}function Wn(n){var e=H.length,r=2147483648;if((n>>>=0)>r)return!1;for(var o=1;o<=4;o*=2){var i=e*(1+.2/o);if(i=Math.min(i,n+100663296),On(Math.min(r,_n(Math.max(n,i),65536))))return!0}return!1}un(s="libtess.wasm")||(s=dn(s));var L={mappings:{},buffers:[null,[],[]],printChar:function(n,e){var r=L.buffers[n];e===0||e===10?((n===1?yn:P)(tn(r,0)),r.length=0):r.push(e)},varargs:void 0,get:function(){return L.varargs+=4,M[L.varargs-4>>2]},getStr:function(n){return An(n)},get64:function(n,e){return n}};function Un(n,e,r,o){for(var i=0,a=0;a>2],l=M[e+(8*a+4)>>2],d=0;d>2]=i,0}function Ln(){return wn()}function kn(n){vn(n)}var Bn={h:qn,l:Cn,g:Wn,f:Un,b:Ln,k:Gn,d:Nn,j:Xn,i:Yn,e:zn,c:Dn,a:kn};Fn(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.n).apply(null,arguments)},t._malloc=function(){return(t._malloc=t.asm.o).apply(null,arguments)},t._free=function(){return(t._free=t.asm.p).apply(null,arguments)},t._triangulate=function(){return(t._triangulate=t.asm.r).apply(null,arguments)};var k,v=t.stackSave=function(){return(v=t.stackSave=t.asm.s).apply(null,arguments)},w=t.stackRestore=function(){return(w=t.stackRestore=t.asm.t).apply(null,arguments)},b=t._setThrew=function(){return(b=t._setThrew=t.asm.u).apply(null,arguments)};function Dn(n,e,r){var o=v();try{m.get(n)(e,r)}catch(i){if(w(o),i!==i+0&&i!=="longjmp")throw i;b(1,0)}}function zn(n,e){var r=v();try{m.get(n)(e)}catch(o){if(w(r),o!==o+0&&o!=="longjmp")throw o;b(1,0)}}function Nn(n,e){var r=v();try{return m.get(n)(e)}catch(o){if(w(r),o!==o+0&&o!=="longjmp")throw o;b(1,0)}}function Gn(n){var e=v();try{return m.get(n)()}catch(r){if(w(e),r!==r+0&&r!=="longjmp")throw r;b(1,0)}}function Xn(n,e,r){var o=v();try{return m.get(n)(e,r)}catch(i){if(w(o),i!==i+0&&i!=="longjmp")throw i;b(1,0)}}function Yn(n,e,r,o){var i=v();try{return m.get(n)(e,r,o)}catch(a){if(w(i),a!==a+0&&a!=="longjmp")throw a;b(1,0)}}function $n(n){this.name="ExitStatus",this.message="Program terminated with exit("+n+")",this.status=n}function G(n){function e(){k||(k=!0,t.calledRun=!0,V||(Rn(),t.onRuntimeInitialized&&t.onRuntimeInitialized(),Pn()))}y>0||(En(),y>0||(t.setStatus?(t.setStatus("Running..."),setTimeout(function(){setTimeout(function(){t.setStatus("")},1),e()},1)):e()))}if(F=function n(){k||G(),k||(F=n)},t.run=G,t.preInit)for(typeof t.preInit=="function"&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();G();let X=null,g=null,A=null,B=null;const c=f.Module,Jn=2,cn=4e3;let ln=0;const Kn=(n,e,r)=>{X||(X=c._triangulate);let o=c.HEAPF32;const i=c.HEAP32.BYTES_PER_ELEMENT,a=2,u=o.BYTES_PER_ELEMENT;r>ln&&(ln=r,A&&(c._free(A),A=0),g&&(c._free(g),g=0)),A||(A=c._malloc(r*u)),B||(B=c._malloc(cn*i));const l=r*Jn;g||(g=c._malloc(l*u)),o=c.HEAPF32,o.set(n,A/u),c.HEAP32.set(e,B/i);const d=l/a,C=X(A,B,Math.min(e.length,cn),a,g,d),Qn=C*a;o=c.HEAPF32;const Vn=o.slice(g/u,g/u+Qn),Y={};return Y.buffer=Vn,Y.vertexCount=C,Y};return f.triangulate=Kn,f.whenLoaded()}return{load:S}}())!==void 0&&($.exports=pn);var mn=J.exports;const et=nt({__proto__:null,default:Zn(mn)},[mn]);export{et as l}; diff --git a/dist/assets/libtess-asm-MMunuWgb.js b/dist/assets/libtess-asm-k59Sl_HW.js similarity index 88% rename from dist/assets/libtess-asm-MMunuWgb.js rename to dist/assets/libtess-asm-k59Sl_HW.js index a734c8f..5f85b9f 100644 --- a/dist/assets/libtess-asm-MMunuWgb.js +++ b/dist/assets/libtess-asm-k59Sl_HW.js @@ -1 +1 @@ -import{cg as K4}from"./index-J0iiHjMT.js";function Y4(z2,t0){for(var K2=0;K2u2[C]})}}}return Object.freeze(Object.defineProperty(z2,Symbol.toStringTag,{value:"Module"}))}var D0,I1,_1,H0={exports:{}};H0.exports,D0=H0,I1=function(){function z2(t0){const K2=t0.locateFile,u2={};var C=C!==void 0?C:{};const F2=(()=>{let d;return{resolve:y=>d(y),promise:new Promise(y=>d=y)}})(),x1=()=>F2.promise;C.locateFile=K2,C.onRuntimeInitialized=()=>{F2.resolve(u2)},u2.Module=C,u2.whenLoaded=x1;var w2,Y2={};for(w2 in C)C.hasOwnProperty(w2)&&(Y2[w2]=C[w2]);var d0,e0,o0,U2,O2,Q0=typeof window=="object",N2=typeof importScripts=="function",p0=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",A2="";function L1(d){return C.locateFile?C.locateFile(d,A2):A2+d}p0?(A2=N2?require("path").dirname(A2)+"/":__dirname+"/",d0=function(d,y){var I=Q2(d);return I?y?I:I.toString():(U2||(U2=require("fs")),O2||(O2=require("path")),d=O2.normalize(d),U2.readFileSync(d,y?null:"utf8"))},o0=function(d){var y=d0(d,!0);return y.buffer||(y=new Uint8Array(y)),T1(y.buffer),y},e0=function(d,y,I){var x=Q2(d);x&&y(x),U2||(U2=require("fs")),O2||(O2=require("path")),d=O2.normalize(d),U2.readFile(d,function(S,T){S?I(S):y(T.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),D0.exports=C,process.on("uncaughtException",function(d){if(!(d instanceof k4))throw d}),process.on("unhandledRejection",$2),C.inspect=function(){return"[Emscripten Module object]"}):(Q0||N2)&&(N2?A2=self.location.href:typeof document<"u"&&document.currentScript&&(A2=document.currentScript.src),A2=A2.indexOf("blob:")!==0?A2.substr(0,A2.lastIndexOf("/")+1):"",d0=function(d){try{var y=new XMLHttpRequest;return y.open("GET",d,!1),y.send(null),y.responseText}catch(x){var I=Q2(d);if(I)return $1(I);throw x}},N2&&(o0=function(d){try{var y=new XMLHttpRequest;return y.open("GET",d,!1),y.responseType="arraybuffer",y.send(null),new Uint8Array(y.response)}catch(x){var I=Q2(d);if(I)return I;throw x}}),e0=function(d,y,I){var x=new XMLHttpRequest;x.open("GET",d,!0),x.responseType="arraybuffer",x.onload=function(){if(x.status==200||x.status==0&&x.response)y(x.response);else{var S=Q2(d);S?y(S.buffer):I()}},x.onerror=I,x.send(null)});var P1=C.print||console.log.bind(console),D2=C.printErr||console.warn.bind(console);for(w2 in Y2)Y2.hasOwnProperty(w2)&&(C[w2]=Y2[w2]);Y2=null,C.arguments&&C.arguments,C.thisProgram&&C.thisProgram,C.quit&&C.quit;var H2,W0=0,B1=function(d){W0=d},j1=function(){return W0};C.wasmBinary&&(H2=C.wasmBinary),C.noExitRuntime;var V2,g2={Memory:function(d){this.buffer=new ArrayBuffer(65536*d.initial)},Module:function(d){},Instance:function(d,y){this.exports=function(I){function x(Q){return Q.set=function(c2,N){this[c2]=N},Q.get=function(c2){return this[c2]},Q}for(var S,T=new Uint8Array(123),O=25;O>=0;--O)T[48+O]=52+O,T[65+O]=O,T[97+O]=26+O;function D(Q,c2,N){for(var p,r2,i=0,w=c2,L2=N.length,P2=c2+(3*L2>>2)-(N[L2-2]=="=")-(N[L2-1]=="=");i>4,w>2),w>>0<=244){if(3&(f=(b=i[614])>>>(a=(r=n>>>0<11?16:n+11&-8)>>>3|0)|0)){n=(e=i[2504+(f=(t=a+(1&(-1^f))|0)<<3)>>2])+8|0,(0|(a=i[e+8>>2]))!=(0|(f=f+2496|0))?(i[a+12>>2]=f,i[f+8>>2]=a):(h=2456,m=f2(t)&b,i[h>>2]=m),f=t<<3,i[e+4>>2]=3|f,i[4+(f=f+e|0)>>2]=1|i[f+4>>2];break i}if((A=i[616])>>>0>=r>>>0)break s;if(f){a=n=(f=(0-(n=(0-(n=2<>>12&16,a|=n=(f=f>>>n|0)>>>5&8,a|=n=(f=f>>>n|0)>>>2&4,o=i[2504+(n=(a=((a|=n=(f=f>>>n|0)>>>1&2)|(n=(f=f>>>n|0)>>>1&1))+(f>>>n|0)|0)<<3)>>2],(0|(f=i[o+8>>2]))!=(0|(n=n+2496|0))?(i[f+12>>2]=n,i[n+8>>2]=f):(b=f2(a)&b,i[614]=b),n=o+8|0,i[o+4>>2]=3|r,e=(f=a<<3)-r|0,i[4+(t=o+r|0)>>2]=1|e,i[f+o>>2]=e,A&&(a=2496+((f=A>>>3|0)<<3)|0,o=i[619],(f=1<>2]:(i[614]=f|b,f=a),i[a+8>>2]=o,i[f+12>>2]=o,i[o+12>>2]=a,i[o+8>>2]=f),i[619]=t,i[616]=e;break i}if(!(k=i[615]))break s;for(a=n=(f=(k&0-k)-1|0)>>>12&16,a|=n=(f=f>>>n|0)>>>5&8,a|=n=(f=f>>>n|0)>>>2&4,f=i[2760+(((a|=n=(f=f>>>n|0)>>>1&2)|(n=(f=f>>>n|0)>>>1&1))+(f>>>n|0)<<2)>>2],t=(-8&i[f+4>>2])-r|0,a=f;(n=i[a+16>>2])||(n=i[a+20>>2]);)t=(e=(a=(-8&i[n+4>>2])-r|0)>>>0>>0)?a:t,f=e?n:f,a=n;if((s=f+r|0)>>>0<=f>>>0)break A;if(l=i[f+24>>2],(0|(e=i[f+12>>2]))!=(0|f)){n=i[f+8>>2],i[n+12>>2]=e,i[e+8>>2]=n;break f}if(!(n=i[(a=f+20|0)>>2])){if(!(n=i[f+16>>2]))break o;a=f+16|0}for(;o=a,e=n,(n=i[(a=n+20|0)>>2])||(a=e+16|0,n=i[e+16>>2]););i[o>>2]=0;break f}if(r=-1,!(n>>>0>4294967231)&&(r=-8&(n=n+11|0),s=i[615])){t=0-r|0,b=0,r>>>0<256||(b=31,r>>>0>16777215||(n=n>>>8|0,n<<=o=n+1048320>>>16&8,b=28+((n=((n<<=a=n+520192>>>16&4)<<(f=n+245760>>>16&2)>>>15|0)-(f|a|o)|0)<<1|r>>>n+21&1)|0));k:{r:{if(a=i[2760+(b<<2)>>2])for(n=0,f=r<<((0|b)==31?0:25-(b>>>1|0)|0);;){if(!((o=(-8&i[a+4>>2])-r|0)>>>0>=t>>>0||(e=a,t=o))){t=0,n=a;break r}if(o=i[a+20>>2],a=i[16+((f>>>29&4)+a|0)>>2],n=o?(0|o)==(0|a)?n:o:n,f<<=1,!a)break}else n=0;if(!(n|e)){if(e=0,!(n=(0-(n=2<>>12&16,a|=n=(f=f>>>n|0)>>>5&8,a|=n=(f=f>>>n|0)>>>2&4,n=i[2760+(((a|=n=(f=f>>>n|0)>>>1&2)|(n=(f=f>>>n|0)>>>1&1))+(f>>>n|0)<<2)>>2]}if(!n)break k}for(;t=(a=(f=(-8&i[n+4>>2])-r|0)>>>0>>0)?f:t,e=a?n:e,n=(f=i[n+16>>2])||i[n+20>>2];);}if(!(!e|i[616]-r>>>0<=t>>>0)){if((k=e+r|0)>>>0<=e>>>0)break A;if(b=i[e+24>>2],(0|e)!=(0|(f=i[e+12>>2]))){n=i[e+8>>2],i[n+12>>2]=f,i[f+8>>2]=n;break a}if(!(n=i[(a=e+20|0)>>2])){if(!(n=i[e+16>>2]))break u;a=e+16|0}for(;o=a,f=n,(n=i[(a=n+20|0)>>2])||(a=f+16|0,n=i[f+16>>2]););i[o>>2]=0;break a}}}if((a=i[616])>>>0>=r>>>0){t=i[619],(f=a-r|0)>>>0>=16?(i[616]=f,n=t+r|0,i[619]=n,i[n+4>>2]=1|f,i[a+t>>2]=f,i[t+4>>2]=3|r):(i[619]=0,i[616]=0,i[t+4>>2]=3|a,i[4+(n=a+t|0)>>2]=1|i[n+4>>2]),n=t+8|0;break i}if((k=i[617])>>>0>r>>>0){f=k-r|0,i[617]=f,n=(a=i[620])+r|0,i[620]=n,i[n+4>>2]=1|f,i[a+4>>2]=3|r,n=a+8|0;break i}if(n=0,f=s=r+47|0,i[732]?a=i[734]:(i[735]=-1,i[736]=-1,i[733]=4096,i[734]=4096,i[732]=v+12&-16^1431655768,i[737]=0,i[725]=0,a=4096),(a=(o=f+a|0)&(e=0-a|0))>>>0<=r>>>0||(t=i[724])&&t>>>0<(b=(f=i[722])+a|0)>>>0|f>>>0>=b>>>0)break i;if(4&w[2900])break b;s:{k:{if(t=i[620])for(n=2904;;){if(t>>>0<(f=i[n>>2])+i[n+4>>2]>>>0&&f>>>0<=t>>>0)break k;if(!(n=i[n+8>>2]))break}if((0|(f=T2(0)))==-1||(b=a,(n=(t=i[733])-1|0)&f&&(b=(a-f|0)+(n+f&0-t)|0),b>>>0<=r>>>0|b>>>0>2147483646)||(t=i[724])&&t>>>0<(e=(n=i[722])+b|0)>>>0|n>>>0>=e>>>0)break e;if((0|f)!=(0|(n=T2(b))))break s;break t}if((b=e&o-k)>>>0>2147483646)break e;if((0|(f=T2(b)))==(i[n>>2]+i[n+4>>2]|0))break c;n=f}if(!((0|n)==-1|r+48>>>0<=b>>>0)){if((f=(f=i[734])+(s-b|0)&0-f)>>>0>2147483646){f=n;break t}if((0|T2(f))!=-1){b=f+b|0,f=n;break t}T2(0-b|0);break e}if(f=n,(0|n)!=-1)break t;break e}o2()}e=0;break f}f=0;break a}if((0|f)!=-1)break t}i[725]=4|i[725]}if(a>>>0>2147483646||(0|(f=T2(a)))==-1|(0|(n=T2(0)))==-1|n>>>0<=f>>>0||(b=n-f|0)>>>0<=r+40>>>0)break n}n=i[722]+b|0,i[722]=n,n>>>0>P2[723]&&(i[723]=n);t:{b:{e:{if(o=i[620]){for(n=2904;;){if(((t=i[n>>2])+(a=i[n+4>>2])|0)==(0|f))break e;if(!(n=i[n+8>>2]))break}break b}for((n=i[618])>>>0<=f>>>0&&n||(i[618]=f),n=0,i[727]=b,i[726]=f,i[622]=-1,i[623]=i[732],i[729]=0;a=2496+(t=n<<3)|0,i[t+2504>>2]=a,i[t+2508>>2]=a,(0|(n=n+1|0))!=32;);a=(t=b-40|0)-(n=f+8&7?-8-f&7:0)|0,i[617]=a,n=n+f|0,i[620]=n,i[n+4>>2]=1|a,i[4+(f+t|0)>>2]=40,i[621]=i[736];break t}if(!(8&w[n+12|0]|t>>>0>o>>>0|f>>>0<=o>>>0)){i[n+4>>2]=a+b,a=(n=o+8&7?-8-o&7:0)+o|0,i[620]=a,n=(f=i[617]+b|0)-n|0,i[617]=n,i[a+4>>2]=1|n,i[4+(f+o|0)>>2]=40,i[621]=i[736];break t}}P2[618]>f>>>0&&(i[618]=f),a=f+b|0,n=2904;b:{e:{c:{u:{o:{A:{for(;;){if((0|a)!=i[n>>2]){if(n=i[n+8>>2])continue;break A}break}if(!(8&w[n+12|0]))break o}for(n=2904;;){if((a=i[n>>2])>>>0<=o>>>0&&(e=a+i[n+4>>2]|0)>>>0>o>>>0)break u;n=i[n+8>>2]}}if(i[n>>2]=f,i[n+4>>2]=i[n+4>>2]+b,i[4+(s=(f+8&7?-8-f&7:0)+f|0)>>2]=3|r,a=(b=a+(a+8&7?-8-a&7:0)|0)-(k=r+s|0)|0,(0|o)==(0|b)){i[620]=k,n=i[617]+a|0,i[617]=n,i[k+4>>2]=1|n;break e}if(i[619]==(0|b)){i[619]=k,n=i[616]+a|0,i[616]=n,i[k+4>>2]=1|n,i[n+k>>2]=n;break e}if((3&(n=i[b+4>>2]))==1){o=-8&n;o:if(n>>>0<=255){if(t=i[b+8>>2],n=n>>>3|0,(0|(f=i[b+12>>2]))==(0|t)){h=2456,m=i[614]&f2(n),i[h>>2]=m;break o}i[t+12>>2]=f,i[f+8>>2]=t}else{if(r=i[b+24>>2],(0|b)==(0|(f=i[b+12>>2])))if((t=i[(n=b+20|0)>>2])||(t=i[(n=b+16|0)>>2])){for(;e=n,(t=i[(n=(f=t)+20|0)>>2])||(n=f+16|0,t=i[f+16>>2]););i[e>>2]=0}else f=0;else n=i[b+8>>2],i[n+12>>2]=f,i[f+8>>2]=n;if(r){t=i[b+28>>2];A:{if(i[(n=2760+(t<<2)|0)>>2]==(0|b)){if(i[n>>2]=f,f)break A;h=2460,m=i[615]&f2(t),i[h>>2]=m;break o}if(i[r+(i[r+16>>2]==(0|b)?16:20)>>2]=f,!f)break o}i[f+24>>2]=r,(n=i[b+16>>2])&&(i[f+16>>2]=n,i[n+24>>2]=f),(n=i[b+20>>2])&&(i[f+20>>2]=n,i[n+24>>2]=f)}}b=o+b|0,a=a+o|0}if(i[b+4>>2]=-2&i[b+4>>2],i[k+4>>2]=1|a,i[a+k>>2]=a,a>>>0<=255){f=2496+((n=a>>>3|0)<<3)|0,(a=i[614])&(n=1<>2]:(i[614]=n|a,n=f),i[f+8>>2]=k,i[n+12>>2]=k,i[k+12>>2]=f,i[k+8>>2]=n;break e}if(n=31,a>>>0<=16777215&&(n=a>>>8|0,n<<=e=n+1048320>>>16&8,n=28+((n=((n<<=t=n+520192>>>16&4)<<(f=n+245760>>>16&2)>>>15|0)-(f|t|e)|0)<<1|a>>>n+21&1)|0),i[k+28>>2]=n,i[k+16>>2]=0,i[k+20>>2]=0,e=2760+(n<<2)|0,(t=i[615])&(f=1<>>1|0)|0),f=i[e>>2];;){if(t=f,(-8&i[f+4>>2])==(0|a))break c;if(f=n>>>29|0,n<<=1,!(f=i[16+(e=t+(4&f)|0)>>2]))break}i[e+16>>2]=k,i[k+24>>2]=t}else i[615]=f|t,i[e>>2]=k,i[k+24>>2]=e;i[k+12>>2]=k,i[k+8>>2]=k;break e}for(a=(t=b-40|0)-(n=f+8&7?-8-f&7:0)|0,i[617]=a,n=n+f|0,i[620]=n,i[n+4>>2]=1|a,i[4+(f+t|0)>>2]=40,i[621]=i[736],i[(a=(n=(e+(e-39&7?39-e&7:0)|0)-47|0)>>>0>>0?o:n)+4>>2]=27,n=i[729],i[a+16>>2]=i[728],i[a+20>>2]=n,n=i[727],i[a+8>>2]=i[726],i[a+12>>2]=n,i[728]=a+8,i[727]=b,i[726]=f,i[729]=0,n=a+24|0;i[n+4>>2]=7,f=n+8|0,n=n+4|0,f>>>0>>0;);if((0|a)==(0|o))break t;if(i[a+4>>2]=-2&i[a+4>>2],e=a-o|0,i[o+4>>2]=1|e,i[a>>2]=e,e>>>0<=255){f=2496+((n=e>>>3|0)<<3)|0,(a=i[614])&(n=1<>2]:(i[614]=n|a,n=f),i[f+8>>2]=o,i[n+12>>2]=o,i[o+12>>2]=f,i[o+8>>2]=n;break t}if(n=31,i[o+16>>2]=0,i[o+20>>2]=0,e>>>0<=16777215&&(n=e>>>8|0,n<<=t=n+1048320>>>16&8,n=28+((n=((n<<=a=n+520192>>>16&4)<<(f=n+245760>>>16&2)>>>15|0)-(f|a|t)|0)<<1|e>>>n+21&1)|0),i[o+28>>2]=n,t=2760+(n<<2)|0,(a=i[615])&(f=1<>>1|0)|0),f=i[t>>2];;){if(a=f,(0|e)==(-8&i[f+4>>2]))break b;if(f=n>>>29|0,n<<=1,!(f=i[16+(t=a+(4&f)|0)>>2]))break}i[t+16>>2]=o,i[o+24>>2]=a}else i[615]=f|a,i[t>>2]=o,i[o+24>>2]=t;i[o+12>>2]=o,i[o+8>>2]=o;break t}n=i[t+8>>2],i[n+12>>2]=k,i[t+8>>2]=k,i[k+24>>2]=0,i[k+12>>2]=t,i[k+8>>2]=n}n=s+8|0;break i}n=i[a+8>>2],i[n+12>>2]=o,i[a+8>>2]=o,i[o+24>>2]=0,i[o+12>>2]=a,i[o+8>>2]=n}if(!((n=i[617])>>>0<=r>>>0)){f=n-r|0,i[617]=f,n=(a=i[620])+r|0,i[620]=n,i[n+4>>2]=1|f,i[a+4>>2]=3|r,n=a+8|0;break i}}i[613]=48,n=0;break i}a:if(b){a=i[e+28>>2];n:{if(i[(n=2760+(a<<2)|0)>>2]==(0|e)){if(i[n>>2]=f,f)break n;s=f2(a)&s,i[615]=s;break a}if(i[b+(i[b+16>>2]==(0|e)?16:20)>>2]=f,!f)break a}i[f+24>>2]=b,(n=i[e+16>>2])&&(i[f+16>>2]=n,i[n+24>>2]=f),(n=i[e+20>>2])&&(i[f+20>>2]=n,i[n+24>>2]=f)}a:if(t>>>0<=15)n=t+r|0,i[e+4>>2]=3|n,i[4+(n=n+e|0)>>2]=1|i[n+4>>2];else if(i[e+4>>2]=3|r,i[k+4>>2]=1|t,i[t+k>>2]=t,t>>>0<=255)f=2496+((n=t>>>3|0)<<3)|0,(a=i[614])&(n=1<>2]:(i[614]=n|a,n=f),i[f+8>>2]=k,i[n+12>>2]=k,i[k+12>>2]=f,i[k+8>>2]=n;else{n=31,t>>>0<=16777215&&(n=t>>>8|0,n<<=o=n+1048320>>>16&8,n=28+((n=((n<<=a=n+520192>>>16&4)<<(f=n+245760>>>16&2)>>>15|0)-(f|a|o)|0)<<1|t>>>n+21&1)|0),i[k+28>>2]=n,i[k+16>>2]=0,i[k+20>>2]=0,a=2760+(n<<2)|0;n:{if((f=1<>>1|0)|0),r=i[a>>2];;){if((-8&i[(f=r)+4>>2])==(0|t))break n;if(a=n>>>29|0,n<<=1,!(r=i[16+(a=f+(4&a)|0)>>2]))break}i[a+16>>2]=k,i[k+24>>2]=f}else i[615]=f|s,i[a>>2]=k,i[k+24>>2]=a;i[k+12>>2]=k,i[k+8>>2]=k;break a}n=i[f+8>>2],i[n+12>>2]=k,i[f+8>>2]=k,i[k+24>>2]=0,i[k+12>>2]=f,i[k+8>>2]=n}n=e+8|0;break i}f:if(l){a=i[f+28>>2];a:{if(i[(n=2760+(a<<2)|0)>>2]==(0|f)){if(i[n>>2]=e,e)break a;h=2460,m=f2(a)&k,i[h>>2]=m;break f}if(i[(i[l+16>>2]==(0|f)?16:20)+l>>2]=e,!e)break f}i[e+24>>2]=l,(n=i[f+16>>2])&&(i[e+16>>2]=n,i[n+24>>2]=e),(n=i[f+20>>2])&&(i[e+20>>2]=n,i[n+24>>2]=e)}t>>>0<=15?(n=t+r|0,i[f+4>>2]=3|n,i[4+(n=n+f|0)>>2]=1|i[n+4>>2]):(i[f+4>>2]=3|r,i[s+4>>2]=1|t,i[t+s>>2]=t,A&&(a=2496+((n=A>>>3|0)<<3)|0,e=i[619],(n=1<>2]:(i[614]=n|b,n=a),i[a+8>>2]=e,i[n+12>>2]=e,i[e+12>>2]=a,i[e+8>>2]=n),i[619]=s,i[616]=t),n=f+8|0}return B=v+16|0,0|n}function w4(n,f,a,t,e,b){n|=0,f|=0,a|=0,t|=0,e|=0,b|=0;for(var o=0,k=0,r=0,s=0,A=0,l=u(0),v=0,h=u(0),m=u(0),g=0,E=0,R=0,_=0,L=0,P=0,F=0,U=0;(r=i[2032+(o=k<<2)>>2])&&(i[r>>2]=0),(r=i[2032+(4|o)>>2])&&(i[r>>2]=0),(r=i[2032+(8|o)>>2])&&(i[r>>2]=0),(o=i[2032+(12|o)>>2])&&(i[o>>2]=0),(0|(k=k+4|0))!=100;);if((k=i[608])||(k=H(16),i[608]=k),i[k+8>>2]=b,i[k+4>>2]=0,i[k+12>>2]=t,i[k>>2]=e,(k=i[609])||((e=H(1900))?(i[e+100>>2]=12,i[e+96>>2]=13,i[e+92>>2]=14,i[e+88>>2]=15,r2[e+80>>1]=0,i[e+52>>2]=0,i[e+56>>2]=100130,i[e+16>>2]=0,i[e+20>>2]=0,i[e>>2]=0,i[e+1896>>2]=0,i[e+1736>>2]=8,i[e+1732>>2]=11,i[e+1728>>2]=6,i[e+1724>>2]=5,i[e+1720>>2]=4,i[e+1716>>2]=3,i[e+104>>2]=16,i[e+76>>2]=17,i[e+12>>2]=18,i[e+24>>2]=0):e=0,i[609]=e,W2(e,100107,34),W2(i[609],100100,35),W2(i[609],100102,36),W2(i[609],100105,37),W2(i[609],100103,38),W2(i[609],100104,39),i[i[609]+56>>2]=100130,e=i[609],c[e+16>>2]=0,c[e+24>>2]=1,c[e+20>>2]=0,k=i[609]),e=0,b=i[608],i[k>>2]&&E2(k,0),i[k+112>>2]=0,i[k>>2]=1,p[k+108|0]=0,i[k+1896>>2]=b,i[k+8>>2]=0,(0|a)>0)for(b=0;;){if(g=i[(b<<2)+f>>2],o=i[609],i[o>>2]!=1&&E2(o,1),i[o>>2]=2,i[o+4>>2]=0,i[o+112>>2]>=1&&(p[o+108|0]=1),k=0,(0|g)>0)for(;;){A=E=(W(e+k|0,t)<<2)+n|0,r=i[609],i[r>>2]!=2&&E2(r,2);i:{f:{a:{if(w[r+108|0]){if(o=M0(),i[r+8>>2]=o,!o)break a;if((0|(o=i[r+112>>2]))>=1)for(R=116+(r+(o<<4)|0)|0,s=r+116|0,o=i[r+4>>2];;){U=i[s+12>>2];n:{if(!o){if(!(o=f0(i[r+8>>2])))break a;if(z(o,i[o+4>>2]))break n;break a}if(!n2(o))break a;o=i[o+12>>2]}if(v=i[o+16>>2],i[v+12>>2]=U,c[v+16>>2]=c[s>>2],l=c[s+4>>2],i[v+24>>2]=0,c[v+20>>2]=l,i[o+28>>2]=1,i[i[o+4>>2]+28>>2]=-1,i[r+4>>2]=o,!(R>>>0>(s=s+16|0)>>>0))break}p[r+108|0]=0,i[r+112>>2]=0,i[r+4>>2]=0}s=(L=+(l=(_=+(l=c[A+4>>2]))<-1e37?u(-9999999933815813e21):l))>1e37,v=(F=+(h=(P=+(h=c[A>>2]))<-1e37?u(-9999999933815813e21):h))>1e37,((o=+(m=c[A+8>>2])<-1e37)|(A=+(m=o?u(-9999999933815813e21):m)>1e37)|_<-1e37|L>1e37||F>1e37||P<-1e37)&&((0|(o=i[r+1732>>2]))==11?M[i[r+12>>2]](100155):M[0|o](100155,i[r+1896>>2])),l=s?u(9999999933815813e21):l,h=v?u(9999999933815813e21):h;n:{if(!i[r+8>>2]){if((0|(s=i[r+112>>2]))<=99){c[124+(o=r+(s<<4)|0)>>2]=A?u(9999999933815813e21):m,c[o+120>>2]=l,c[o+116>>2]=h,i[o+128>>2]=E,i[r+112>>2]=s+1;break i}if(o=M0(),i[r+8>>2]=o,!o)break n;if((0|(o=i[r+112>>2]))>=1)for(v=116+(r+(o<<4)|0)|0,s=r+116|0,o=i[r+4>>2];;){R=i[s+12>>2];t:{if(!o){if(!(o=f0(i[r+8>>2])))break n;if(z(o,i[o+4>>2]))break t;break n}if(!n2(o))break n;o=i[o+12>>2]}if(A=i[o+16>>2],i[A+12>>2]=R,c[A+16>>2]=c[s>>2],m=c[s+4>>2],i[A+24>>2]=0,c[A+20>>2]=m,i[o+28>>2]=1,i[i[o+4>>2]+28>>2]=-1,i[r+4>>2]=o,!(v>>>0>(s=s+16|0)>>>0))break}p[r+108|0]=0,i[r+112>>2]=0}t:{b:{if(!(o=i[r+4>>2])){if(!(o=f0(i[r+8>>2])))break t;if(z(o,i[o+4>>2]))break b;break t}if(!n2(o))break t;o=i[o+12>>2]}s=i[o+16>>2],c[s+16>>2]=h,i[s+12>>2]=E,i[s+24>>2]=0,c[s+20>>2]=l,i[o+28>>2]=1,i[i[o+4>>2]+28>>2]=-1,i[r+4>>2]=o;break i}if((0|(o=i[r+1732>>2]))!=11)break f;M[i[r+12>>2]](100902);break i}if((0|(o=i[r+1732>>2]))!=11)break f;M[i[r+12>>2]](100902);break i}if((0|(o=i[r+1732>>2]))==11){M[i[r+12>>2]](100902);break i}}M[0|o](100902,i[r+1896>>2])}if((0|g)==(0|(k=k+1|0)))break}if(o=i[609],i[o>>2]!=2&&E2(o,2),i[o>>2]=1,e=e+g|0,(0|(b=b+1|0))==(0|a))break}a=i[609],n=0,f=H(40),i[f>>2]=0,e=g1(r=a+1740|0,1,f,4),b=0|V();i:{f:{a:{n:{t:{b:for(;;){e:{c:{u:{o:{A:{s:{k:{if(n){if((0|(n=i[a+1732>>2]))!=11){if(f=i[a+1896>>2],i[611]=0,B2(0|n,100902,0|f),n=i[611],i[611]=0,f=-1,!n||!(t=i[612]))break s;if(f=J(i[n>>2],e,b))break k;break t}if(n=i[a+12>>2],i[611]=0,t1(0|n,100902),n=i[611],i[611]=0,f=-1,!n||!(t=i[612]))break o;if(f=J(i[n>>2],e,b))break A;break t}if(i[a>>2]==1)break e;if(i[611]=0,B2(19,0|a,1),n=i[611],i[611]=0,f=-1,!n||!(t=i[612]))break c;if(f=J(i[n>>2],e,b))break u;break t}K(0|t)}if(n=0|V(),(0|f)==1)continue;break i}K(0|t)}if(n=0|V(),(0|f)==1)continue;break i}K(0|t)}if(n=0|V(),(0|f)==1)continue}i[a>>2]=0;e:{c:{u:{if(!i[a+8>>2]){if(!(w[a+80|0]|i[a+104>>2]!=16)){if(i[611]=0,o=0|i0(20,0|a),n=i[611],i[611]=0,f=-1,n&&(t=i[612])){if(!(f=J(i[n>>2],e,b)))break t;K(0|t)}if(n=0|V(),(0|f)==1)continue;if(o){i[a+1896>>2]=0;break i}}if(i[611]=0,t=0|h4(21),n=i[611],i[611]=0,f=-1,n&&(k=i[612])){if(!(f=J(i[n>>2],e,b)))break n;K(0|k)}if(n=0|V(),(0|f)==1)continue;if(i[a+8>>2]=t,!t)break u;if((0|(n=i[a+112>>2]))>=1)for(s=116+(a+(n<<4)|0)|0,t=a+116|0,f=i[a+4>>2];;){g=i[t+12>>2];o:{A:{s:{k:{r:{l:{if(!f){if(n=i[a+8>>2],i[611]=0,f=0|i0(22,0|n),n=i[611],i[611]=0,k=-1,!n||!(o=i[612]))break r;if(k=J(i[n>>2],e,b))break l;break a}if(i[611]=0,A=0|i0(23,0|f),n=i[611],i[611]=0,k=-1,!n||!(o=i[612]))break s;if(k=J(i[n>>2],e,b))break k;break a}K(0|o)}if(n=0|V(),(0|k)!=1)break A;continue b}K(0|o)}if(n=0|V(),(0|k)==1)continue b;if(!A)break u;f=i[f+12>>2];break o}if(!f)break u;if(n=i[f+4>>2],i[611]=0,A=0|p4(24,0|f,0|n),n=i[611],i[611]=0,k=-1,n&&(o=i[612])){if(!(k=J(i[n>>2],e,b)))break a;K(0|o)}if(n=0|V(),(0|k)==1)continue b;if(!A)break u}if(n=i[f+16>>2],i[n+12>>2]=g,c[n+16>>2]=c[t>>2],l=c[t+4>>2],i[n+24>>2]=0,c[n+20>>2]=l,i[f+28>>2]=1,i[i[f+4>>2]+28>>2]=-1,i[a+4>>2]=f,!(s>>>0>(t=t+16|0)>>>0))break}p[a+108|0]=0,i[a+112>>2]=0}if(i[611]=0,b1(a),n=i[611],i[611]=0,f=-1,!n||!(t=i[612]))break e;if(f=J(i[n>>2],e,b))break c;break t}if(i[611]=0,B2(26,0|r,1),f=i[611],i[611]=0,f&&(n=i[612])){if(!J(i[f>>2],e,b))break f;K(0|n)}n=0|V();continue}K(0|t)}if(n=0|V(),(0|f)!=1){if(i[611]=0,o=0|i0(27,0|a),n=i[611],i[611]=0,f=-1,n&&(t=i[612])){if(!(f=J(i[n>>2],e,b)))break t;K(0|t)}if(n=0|V(),(0|f)!=1){e:{c:{u:{o:{A:{s:{k:{r:{l:{v:{d:{if(!o){if(i[611]=0,B2(26,0|r,1),f=i[611],i[611]=0,!f||!(n=i[612]))break v;if(J(i[f>>2],e,b))break d;break f}if(f=i[a+8>>2],w[a+60|0])break s;if(w[a+81|0]){if(i[611]=0,k=0|d4(28,0|f,1,1),n=i[611],i[611]=0,t=-1,!n||!(o=i[612]))break k;if(t=J(i[n>>2],e,b))break l;break a}if(i[611]=0,k=0|i0(29,0|f),n=i[611],i[611]=0,t=-1,!n||!(o=i[612]))break k;if(t=J(i[n>>2],e,b))break r;break a}K(0|n)}n=0|V();continue}K(0|o);break k}K(0|o)}if(n=0|V(),(0|t)==1)continue;k:{r:{l:{v:{d:{p:{h:{if(!k){if(i[611]=0,B2(26,0|r,1),f=i[611],i[611]=0,!f||!(n=i[612]))break p;if(J(i[f>>2],e,b))break h;break f}if(!(i[a+88>>2]!=15|i[a+100>>2]!=12|i[a+96>>2]!=13|i[a+92>>2]!=14||i[a+1716>>2]!=3|i[a+1728>>2]!=6|i[a+1724>>2]!=5||i[a+1720>>2]!=4))break k;if(w[a+81|0]){if(i[611]=0,B2(30,0|a,0|f),n=i[611],i[611]=0,t=-1,!n||!(k=i[612]))break v;if(t=J(i[n>>2],e,b))break d;break n}if(i[611]=0,B2(31,0|a,0|f),n=i[611],i[611]=0,t=-1,!n||!(k=i[612]))break r;if(t=J(i[n>>2],e,b))break l;break n}K(0|n)}n=0|V();continue}K(0|k)}if(n=0|V(),(0|t)==1)continue;break k}K(0|k)}if(n=0|V(),(0|t)==1)continue}if(i[a+104>>2]!=16){if(i[611]=0,r1(f),n=i[611],i[611]=0,t=-1,!n||!(k=i[612]))break o;if(t=J(i[n>>2],e,b))break A;break n}}if(i[611]=0,_0(f),n=i[611],i[611]=0,f=-1,!n||!(t=i[612]))break c;if(f=J(i[n>>2],e,b))break u;break t}K(0|k)}if(n=0|V(),(0|t)!=1)break e;continue}K(0|t)}if(n=0|V(),(0|f)==1)continue;i[a+8>>2]=0,i[a+1896>>2]=0;break i}if(n=i[a+104>>2],i[611]=0,t1(0|n,0|f),n=i[611],i[611]=0,f=-1,n&&(t=i[612])){if(!(f=J(i[n>>2],e,b)))break t;K(0|t)}if(n=0|V(),(0|f)!=1)break}}}i[a+1896>>2]=0,i[a+8>>2]=0;break i}b2(n,t),o2()}b2(n,k),o2()}b2(n,o),o2()}b2(f,n),o2()}return j(e),i[i[608]+4>>2]}function o1(n,f){var a=u(0),t=u(0),e=0,b=u(0),o=u(0),k=0,r=0,s=u(0),A=0,l=0,v=0,h=u(0),m=u(0),g=u(0),E=0,R=0,_=0,L=0,P=0,F=0,U=0,q=0,Y=0,k2=u(0),m2=0,n0=u(0);B=k=B-144|0,Y=i[i[i[f+4>>2]+8>>2]>>2],U=i[Y>>2],_=i[U+16>>2],P=i[i[U+4>>2]+16>>2],F=i[f>>2],L=i[i[F+4>>2]+16>>2],E=i[F+16>>2],G(L,i[n+72>>2],E)>u(0)&&(a=c[L+28>>2],t=c[L+32>>2],e=i[n+72>>2],b=c[e+28>>2],o=c[e+32>>2],s=c[E+28>>2],X[k+40>>3]=c[E+32>>2],X[k+32>>3]=s,X[k+24>>3]=o,X[k+16>>3]=b,X[k+8>>3]=t,X[k>>3]=a,R1(1098,k));i:{f:{a:if((0|E)!=(0|_)&&!((m=(a=c[E+32>>2])<=(t=c[L+32>>2])?a:t)>((t=c[_+32>>2])>=(b=c[P+32>>2])?t:b))){n:{if(!(!(a<=t)|(b=c[E+28>>2])!=(o=c[_+28>>2]))||bu(0)))break n;break a}if(G(L,_,E)>2])<(t=c[E+28>>2])|(c[A+32>>2]<=c[l+32>>2]?a==t:0)?(r=l,l=A):r=A,(a=c[e+28>>2])>(t=c[v+28>>2])|(c[v+32>>2]<=c[e+32>>2]?a==t:0)?(a=t,A=e,e=v):A=v,a>(t=c[l+28>>2])|(c[l+32>>2]<=c[e+32>>2]?a==t:0)?(t=a,v=A,R=e,A=r,e=l):(v=r,R=l),r=k;n:if((o=c[A+28>>2])>t|(c[R+32>>2]<=c[A+32>>2]?t==o:0))if(h=c[v+28>>2],!(c[A+32>>2]<=c[v+32>>2])|o!=h&&!(h>o))if(t=G(e,R,A),a=G(e,v,A),l=u(t-a)>2],s=c[v+28>>2],a=u(u(o+s)*u(.5)),t==u(0))break n;a=u(o+u(u(b/u(b+t))*u(s-o)))}else a=c[v+28>>2],a=u(a+u(u(t/u(b+t))*u(c[R+28>>2]-a)));else{if(a=u(0),s=u(o-t),b=u(t-c[e+28>>2]),(m=u(s+b))>u(0)&&(a=c[((l=b>2],a=u(u(c[R+32>>2]-a)+u(u((l?b:s)/m)*u(a-c[(l?A:e)+32>>2])))),k2=u(-a),m=a,h=u(h-o),(b=u(s+h))>u(0)&&(g=c[((l=s>2],g=u(u(c[A+32>>2]-g)+u(u((l?s:h)/b)*u(g-c[(l?v:R)+32>>2])))),l=u(a+g)>2]=a,(a=c[e+32>>2])<(t=c[A+32>>2])|(c[e+28>>2]<=c[A+28>>2]?a==t:0)?(r=A,A=e):r=e,(t=c[v+32>>2])>(a=c[R+32>>2])|(c[R+28>>2]<=c[v+28>>2]?a==t:0)?(t=a,e=v,v=R):e=R,(a=c[A+32>>2])>2]<=c[v+28>>2]?a==t:0)?(R=e,l=v,e=r,v=A):(R=r,l=A);n:{t:if((o=c[l+32>>2])<(s=c[e+32>>2])|(c[l+28>>2]<=c[e+28>>2]?o==s:0)){if(g=c[R+32>>2],!(!(c[e+28>>2]<=c[R+28>>2])|s!=g)||g>s){if(a=u(0),t=u(0),h=u(s-o),b=u(o-c[v+32>>2]),(m=u(h+b))>u(0)&&(t=c[((r=b>2],t=u(u(c[l+28>>2]-t)+u(u((r?b:h)/m)*u(t-c[(r?e:v)+28>>2])))),n0=u(-t),m=t,g=u(g-s),(b=u(h+g))>u(0)&&(k2=c[e+28>>2],a=c[((e=h>2],a=u(u(k2-a)+u(u((e?h:g)/b)*u(a-c[(e?R:l)+28>>2])))),e=u(t+a)>2]=o+u(h*u(t/u(t+a)));break n}c[k+88>>2]=s+u(u(o-s)*u(a/u(t+a)));break n}if(a=u(0),t=u(0),b=u(s-o),h=c[v+32>>2],m=u(o-h),u(b+m)>u(0)&&(t=c[l+28>>2],t=u(u(m*u(t-c[e+28>>2]))+u(b*u(t-c[v+28>>2])))),m=u(-t),b=t,s=u(s-g),h=u(g-h),u(s+h)>u(0)&&(a=c[R+28>>2],a=u(u(h*u(a-c[e+28>>2]))+u(s*u(a-c[v+28>>2])))),e=u(t-a)>2]=u(o+g)*u(.5);break n}c[k+88>>2]=o+u(u(g-o)*u(t/u(t+a)));break n}c[k+88>>2]=g+u(u(o-g)*u(a/u(t+a)));break n}c[k+88>>2]=u(o+s)*u(.5)}a=c[k+84>>2],r=i[n+72>>2];n:{if(a<(b=c[r+28>>2]))t=c[r+32>>2];else if(a!=b||!((t=c[r+32>>2])>=c[k+88>>2]))break n;c[k+88>>2]=t,c[k+84>>2]=b,a=b}A=e=E,(t=b=c[e+28>>2])<(o=c[_+28>>2])||b==o&&(t=b,A=E,c[e+32>>2]<=c[_+32>>2])||(t=o,A=_),e=A;n:{if(a>t)o=c[e+32>>2];else if(a!=t||!((o=c[e+32>>2])<=c[k+88>>2]))break n;c[k+88>>2]=o,c[k+84>>2]=t,b=c[E+28>>2],a=t}if(c[_+28>>2]!=a|c[k+88>>2]!=c[_+32>>2]&&(c[k+88>>2]!=c[E+32>>2]||a!=b)){n:{a=c[r+28>>2];t:{if(c[L+32>>2]!=c[r+32>>2]||a!=c[L+28>>2]){if(G(L,r,k+56|0)>=u(0))break t;r=i[n+72>>2],a=c[r+28>>2]}if(c[P+32>>2]==c[r+32>>2]&&a==c[P+28>>2]||!(G(P,r,k+56|0)<=u(0)))break n}if((0|(e=i[n+72>>2]))==(0|P)){if(!n2(i[F+4>>2])||!z(i[U+4>>2],F))break i;for(e=i[i[f>>2]+16>>2];f=i[i[i[f+4>>2]+4>>2]>>2],A=i[f>>2],(0|e)==i[A+16>>2];);if(r=f,w[f+15|0]&&(r=0,(e=d2(i[i[i[i[i[f+4>>2]+8>>2]>>2]>>2]+4>>2],i[A+12>>2]))&&$(i[f>>2])&&(i[f>>2]=e,p[f+15|0]=0,i[e+24>>2]=f,r=i[i[i[f+4>>2]+4>>2]>>2])),!r)break i;e=i[i[i[r+4>>2]+8>>2]>>2],f=i[e>>2],a0(n,e,Y),m2=1,j2(n,r,i[i[f+4>>2]+12>>2],f,f,1);break a}if((0|e)==(0|L)){if(!n2(i[U+4>>2])||!z(i[F+12>>2],i[i[U+4>>2]+12>>2]))break i;for(r=i[i[i[f>>2]+4>>2]+16>>2],e=f;e=i[i[i[e+4>>2]+4>>2]>>2],(0|r)==i[i[i[e>>2]+4>>2]+16>>2];);r=i[i[i[i[i[i[e+4>>2]+8>>2]>>2]>>2]+4>>2]+8>>2],i[f>>2]=i[i[U+4>>2]+12>>2],m2=1,j2(n,e,i[a0(n,f,0)+8>>2],i[i[F+4>>2]+8>>2],r,1);break a}if(G(L,e,k+56|0)>=u(0)){if(p[f+14|0]=1,p[i[i[i[f+4>>2]+4>>2]>>2]+14|0]=1,!n2(i[F+4>>2]))break i;r=i[F+16>>2],e=i[n+72>>2],c[r+28>>2]=c[e+28>>2],c[r+32>>2]=c[e+32>>2]}else e=i[n+72>>2];if(!(G(P,e,k+56|0)<=u(0)))break a;if(p[Y+14|0]=1,p[f+14|0]=1,!n2(i[U+4>>2]))break i;f=i[U+16>>2],n=i[n+72>>2],c[f+28>>2]=c[n+28>>2],c[f+32>>2]=c[n+32>>2];break a}if(!n2(i[F+4>>2])||!n2(i[U+4>>2])||!z(i[i[U+4>>2]+12>>2],F))break i;if(e=i[F+16>>2],c[e+28>>2]=c[k+84>>2],c[e+32>>2]=c[k+88>>2],r=s1(i[n+68>>2],e),e=i[F+16>>2],i[e+36>>2]=r,(0|r)==2147483647)break f;i[k+112>>2]=i[E+12>>2],i[k+116>>2]=i[L+12>>2],i[k+120>>2]=i[_+12>>2],i[k+124>>2]=i[P+12>>2],i[e+24>>2]=0,i[e+16>>2]=0,i[e+20>>2]=0,a=c[e+28>>2],m=(t=u(c[L+28>>2]-a))>2],b=u(c[L+32>>2]-t),o=u(m+(b>2]-a))>2]-t),s=u(m+(b>2]=b,o=u(.5*+s/q),c[k+100>>2]=o,s=u(u(u(c[E+16>>2]*b)+u(c[L+16>>2]*o))+u(0)),c[e+16>>2]=s,g=u(u(u(c[E+20>>2]*b)+u(c[L+20>>2]*o))+u(0)),c[e+20>>2]=g,o=u(u(u(c[E+24>>2]*b)+u(c[L+24>>2]*o))+u(0)),c[e+24>>2]=o,m=(b=u(c[_+28>>2]-a))>2]-t),b=u(m+(b>2]-a))>2]-t),a=u(m+(a>2]=a,t=u(.5*+b/q),c[k+108>>2]=t,b=u(s+u(u(c[_+16>>2]*a)+u(c[P+16>>2]*t))),c[e+16>>2]=b,s=u(g+u(u(c[_+20>>2]*a)+u(c[P+20>>2]*t))),c[e+20>>2]=s,a=u(o+u(u(c[_+24>>2]*a)+u(c[P+24>>2]*t))),c[e+24>>2]=a,c[k+140>>2]=a,c[k+136>>2]=s,c[k+132>>2]=b,i[e+12>>2]=0,e=e+12|0,(0|(r=i[n+1736>>2]))==8?M[i[n+76>>2]](k+132|0,k+112|0,k+96|0,e):M[0|r](k+132|0,k+112|0,k+96|0,e,i[n+1896>>2]),i[e>>2]|w[n+60|0]||((0|(e=i[n+1732>>2]))==11?M[i[n+12>>2]](100156):M[0|e](100156,i[n+1896>>2]),p[n+60|0]=1),p[Y+14|0]=1,p[f+14|0]=1,p[i[i[i[f+4>>2]+4>>2]>>2]+14|0]=1}else E0(n,f)}return B=k+144|0,m2}L0(i[n+68>>2]),i[n+68>>2]=0}b2(n+1740|0,1),o2()}function g4(n){n|=0;var f=0,a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=u(0),A=u(0),l=0,v=0,h=0,m=0,g=0,E=0,R=0,_=0,L=0,P=0;B=b=B-48|0,p[n+60|0]=0;i:{if(a=i[n+8>>2],(0|(f=i[a+64>>2]))!=(0|(k=a- -64|0)))for(;;){a=i[f+12>>2],e=i[f>>2],o=i[f+16>>2],t=i[i[f+4>>2]+16>>2];f:{if(!(c[o+28>>2]!=c[t+28>>2]|c[o+32>>2]!=c[t+32>>2]|i[a+12>>2]==(0|f))){i[b+24>>2]=0,i[b+28>>2]=0,i[b+16>>2]=0,i[b+20>>2]=0,t=i[287],i[b+8>>2]=i[286],i[b+12>>2]=t,t=i[285],i[b>>2]=i[284],i[b+4>>2]=t,t=i[a+16>>2],i[b+16>>2]=i[t+12>>2],i[b+20>>2]=i[o+12>>2],c[b+36>>2]=c[t+16>>2],c[b+40>>2]=c[t+20>>2],c[b+44>>2]=c[t+24>>2],i[t+12>>2]=0,t=t+12|0,(0|(o=i[n+1736>>2]))==8?M[i[n+76>>2]](b+36|0,b+16|0,b,t):M[0|o](b+36|0,b+16|0,b,t,i[n+1896>>2]),i[t>>2]||(i[t>>2]=i[b+16>>2]);a:{if(z(a,f)){if(!$(f))break a;t=i[a+12>>2];break f}break i}break i}t=a,a=f}if(i[t+12>>2]==(0|a)){if((0|a)!=(0|t)&&(e=i[e+4>>2]!=(0|t)&&(0|t)!=(0|e)?e:i[e>>2],!$(t))||(f=(0|a)==(0|e)|i[e+4>>2]==(0|a)?i[e>>2]:e,!$(a)))break i}else f=e;if((0|f)==(0|k))break}e=n,(f=H(28))?(t=f,(a=H(28))?(i[a+8>>2]=0,i[a+12>>2]=32,o=H(132),i[a>>2]=o,o?(k=H(264),i[a+4>>2]=k,k?(i[a+24>>2]=9,i[a+16>>2]=0,i[a+20>>2]=0,i[o+4>>2]=1,i[k+8>>2]=0):(j(o),j(a),a=0)):(j(a),a=0)):a=0,i[t>>2]=a,a?(t=H(128),i[f+4>>2]=t,t?(i[f+24>>2]=9,i[f+20>>2]=0,i[f+12>>2]=0,i[f+16>>2]=32):(j(i[a+4>>2]),j(i[a>>2]),j(a),j(f),f=0)):(j(f),f=0)):f=0,h=f,i[e+68>>2]=f;f:if(f){a:{a=i[n+8>>2];n:{if((0|(f=i[a>>2]))!=(0|a))for(;;){if(e=s1(h,f),i[f+36>>2]=e,(0|e)==2147483647)break n;if((0|a)==(0|(f=i[f>>2])))break}if(B=E=B-400|0,e=H(4+(f=(g=i[h+12>>2])<<2)|0),i[h+8>>2]=e,B=E+400|0,e){if(!((o=(f+e|0)-4|0)>>>0>>0)){if(a=i[h+4>>2],t=1+((k=(g<<2)-4|0)>>>2|0)&7)for(f=e;i[f>>2]=a,f=f+4|0,a=a+4|0,t=t-1|0;);else f=e;if(!(k>>>0<28))for(;i[f>>2]=a,i[f+28>>2]=a+28,i[f+24>>2]=a+24,i[f+20>>2]=a+20,i[f+16>>2]=a+16,i[f+12>>2]=a+12,i[f+8>>2]=a+8,i[f+4>>2]=a+4,a=a+32|0,o>>>0>=(f=f+32|0)>>>0;);}for(i[E+4>>2]=o,i[E>>2]=e,R=2016473283,r=1;;){if((l=i[((r<<3)+E|0)-4>>2])>>>0>(k=i[(m<<3)+E>>2])+40>>>0)for(;;){for(R=W(R,1539415821)+1|0,L=i[(f=((R>>>0)%(1+(l-k>>2)>>>0)<<2)+k|0)>>2],i[f>>2]=i[k>>2],i[k>>2]=L,t=l+4|0,a=k-4|0;;){e=t,v=i[a+4>>2],o=a,f=a+4|0,t=i[v>>2],s=c[t+28>>2],_=i[L>>2],r=f;t:if(!(s<(A=c[_+28>>2]))){for(;;){if(a=f,r=f,c[t+32>>2]<=c[_+32>>2]&&s==A)break t;if(f=a+4|0,o=a,v=i[a+4>>2],t=i[v>>2],A>(s=c[t+28>>2]))break}r=f}a=r,r=i[(t=e-4|0)>>2],f=i[r>>2];t:if(!(A<(s=c[f+28>>2])))for(;;){if(!(!(c[_+32>>2]<=c[f+32>>2])|s!=A))break t;if(e=t,r=i[(t=t-4|0)>>2],f=i[r>>2],A<(s=c[f+28>>2]))break}if(i[a>>2]=r,i[t>>2]=v,!(a>>>0>>0))break}if(f=i[a>>2],i[a>>2]=v,i[t>>2]=f,(a-k|0)<(l-t|0)?(f=e,t=l,l=o):(f=k,t=o,k=e),i[4+(a=(m<<3)+E|0)>>2]=t,i[a>>2]=f,m=m+1|0,!(k+40>>>0>>0))break}if(r=m,l>>>0>=(e=k+4|0)>>>0)for(;;){t=i[e>>2],a=f=e;t:if(!(k>>>0>=f>>>0))for(;;){if(o=i[t>>2],s=c[o+28>>2],m=i[(a=f-4|0)>>2],v=i[m>>2],s<(A=c[v+28>>2])){a=f;break t}if(!(!(c[o+32>>2]<=c[v+32>>2])|s!=A)){a=f;break t}if(i[f>>2]=m,!(k>>>0<(f=a)>>>0))break}if(i[a>>2]=t,!(l>>>0>=(e=e+4|0)>>>0))break}if(m=r-1|0,!((0|r)>=1))break}if(i[h+20>>2]=1,i[h+16>>2]=g,h=i[h>>2],(0|(e=i[h+8>>2]))>=1)for(l=i[h+4>>2],k=i[h>>2],a=e;;){for(t=a,r=l+((m=i[k+(a<<2)>>2])<<3)|0,f=a;(0|e)<=(0|(a=f<<1))||(v=i[l+(i[k+((o=1|a)<<2)>>2]<<3)>>2],s=c[v+28>>2],g=i[l+(i[k+(a<<2)>>2]<<3)>>2],A=c[g+28>>2],!(c[v+32>>2]<=c[g+32>>2])|s!=A&&!(s(0|e)||(o=i[r>>2],s=c[o+28>>2],v=i[k+(a<<2)>>2],R=i[(g=l+(v<<3)|0)>>2],s<(A=c[R+28>>2])|(c[o+32>>2]<=c[R+32>>2]?s==A:0)));)i[k+(f<<2)>>2]=v,i[g+4>>2]=f,f=a;if(i[k+(f<<2)>>2]=m,i[r+4>>2]=f,a=t-1|0,!((0|t)>1))break}i[h+20>>2]=1,f=1}else f=0;if(f)break a}L0(i[n+68>>2]),i[n+68>>2]=0;break f}if(a=n- -64|0,(f=H(20))?(i[f+16>>2]=10,i[f+12>>2]=n,i[f>>2]=0,i[f+8>>2]=f,i[f+4>>2]=f):f=0,i[a>>2]=f,!f)break i;if(m1(n,u(-3999999973526325e22)),m1(n,u(3999999973526325e22)),a=I0(i[n+68>>2]))for(;;){a:if(f=w1(i[n+68>>2]))for(;;){if(c[f+28>>2]!=c[a+28>>2]|c[f+32>>2]!=c[a+32>>2])break a;if(e=i[I0(i[n+68>>2])+8>>2],t=i[a+8>>2],i[b+24>>2]=0,i[b+28>>2]=0,i[b+16>>2]=0,i[b+20>>2]=0,f=i[287],i[b+8>>2]=i[286],i[b+12>>2]=f,f=i[285],i[b>>2]=i[284],i[b+4>>2]=f,f=i[t+16>>2],i[b+16>>2]=i[f+12>>2],i[b+20>>2]=i[i[e+16>>2]+12>>2],c[b+36>>2]=c[f+16>>2],c[b+40>>2]=c[f+20>>2],c[b+44>>2]=c[f+24>>2],i[f+12>>2]=0,f=f+12|0,(0|(o=i[n+1736>>2]))==8?M[i[n+76>>2]](b+36|0,b+16|0,b,f):M[0|o](b+36|0,b+16|0,b,f,i[n+1896>>2]),i[f>>2]||(i[f>>2]=i[b+16>>2]),!z(t,e))break i;if(!(f=w1(i[n+68>>2])))break}if(A0(n,a),!(a=I0(i[n+68>>2])))break}if(f=i[i[i[(e=n- -64|0)>>2]+4>>2]>>2],a=i[f>>2],i[n+72>>2]=i[a+16>>2],i[a+24>>2]=0,h2(i[f+4>>2]),j(f),a=i[e>>2],f=i[i[a+4>>2]>>2])for(;i[i[f>>2]+24>>2]=0,h2(i[f+4>>2]),j(f),a=i[e>>2],f=i[i[a+4>>2]>>2];);if((0|a)!=(0|(f=i[a+4>>2])))for(;j(f),(0|a)!=(0|(f=i[f+4>>2])););if(j(a),L0(i[n+68>>2]),P=1,n=i[n+8>>2],(0|(a=i[n+40>>2]))!=(0|(e=n+40|0)))for(;;){if(n=i[a+8>>2],a=i[a>>2],(0|n)==i[i[n+12>>2]+12>>2]&&(f=i[n+8>>2],i[f+28>>2]=i[f+28>>2]+i[n+28>>2],f=i[f+4>>2],i[f+28>>2]=i[f+28>>2]+i[i[n+4>>2]+28>>2],!$(n))){P=0;break f}if((0|a)==(0|e))break}}return B=b+48|0,0|P}b2(n+1740|0,1),o2()}function C0(n,f,a,t,e,b){var o=0,k=0,r=0,s=0,A=0,l=0,v=0,h=0,m=0,g=0,E=0,R=0,_=0,L=0,P=0,F=0,U=0;B=k=B-80|0,i[k+76>>2]=f,P=k+55|0,_=k+56|0,f=0;i:{f:for(;;){(0|m)<0||((2147483647-m|0)<(0|f)?(i[613]=61,m=-1):m=f+m|0);a:{n:{t:{if(A=i[k+76>>2],o=w[0|(f=A)])for(;;){b:{e:if(o&=255){if((0|o)!=37)break b;for(o=f;;){if(w[f+1|0]!=37)break e;if(r=f+2|0,i[k+76>>2]=r,o=o+1|0,l=w[f+2|0],f=r,(0|l)!=37)break}}else o=f;if(f=o-A|0,n&&Z(n,A,f),f)continue f;E=-1,o=1,r=k,f=i[k+76>>2],w[f+2|0]!=36|p[i[k+76>>2]+1|0]-48>>>0>=10||(E=p[f+1|0]-48|0,L=1,o=3),f=o+f|0,i[r+76>>2]=f,g=0;e:if((r=(s=p[0|f])-32|0)>>>0>31)o=f;else if(o=f,75913&(r=1<>2]=o,g|=r,(r=(s=p[f+1|0])-32|0)>>>0>=32)break e;if(f=o,!(75913&(r=1<>2]}else{if(r=k,p[o+1|0]-48>>>0>=10||(f=i[k+76>>2],w[f+2|0]!=36)){if(L)break t;L=0,v=0,n&&(f=i[a>>2],i[a>>2]=f+4,v=i[f>>2]),f=i[k+76>>2]+1|0}else i[((p[f+1|0]<<2)+e|0)-192>>2]=10,v=i[((p[f+1|0]<<3)+t|0)-384>>2],L=1,f=f+3|0;if(i[r+76>>2]=f,(0|v)>-1)break e;v=0-v|0,g|=8192}l=-1;e:if(w[0|f]==46)if(w[f+1|0]!=42)i[k+76>>2]=f+1,l=E1(k+76|0),f=i[k+76>>2];else{if(!(p[f+2|0]-48>>>0>=10)&&(f=i[k+76>>2],w[f+3|0]==36)){i[((p[f+2|0]<<2)+e|0)-192>>2]=10,l=i[((p[f+2|0]<<3)+t|0)-384>>2],f=f+4|0,i[k+76>>2]=f;break e}if(L)break t;n?(f=i[a>>2],i[a>>2]=f+4,l=i[f>>2]):l=0,f=i[k+76>>2]+2|0,i[k+76>>2]=f}for(o=0;;){if(R=o,h=-1,p[0|f]-65>>>0>57)break i;if(s=f+1|0,i[k+76>>2]=s,o=p[0|f],f=s,!((o=w[1103+(o+W(R,58)|0)|0])-1>>>0<8))break}e:{c:{if((0|o)!=19){if(!o)break i;if((0|E)>=0){i[(E<<2)+e>>2]=o,o=i[4+(f=(E<<3)+t|0)>>2],i[k+64>>2]=i[f>>2],i[k+68>>2]=o;break c}if(!n)break a;d1(k- -64|0,o,a),s=i[k+76>>2];break e}if((0|E)>-1)break i}if(f=0,!n)continue f}r=-65537&g,o=8192&g?r:g,h=0,E=1024,g=_;e:{c:{u:{o:{A:{s:{k:{r:{l:{v:{d:{p:{h:{m:{w:{switch(f=p[s-1|0],(f=R&&(15&f)==3?-33&f:f)-88|0){case 11:break e;case 9:case 13:case 14:case 15:break c;case 27:break k;case 12:case 17:break v;case 23:break d;case 0:case 32:break p;case 24:break h;case 22:break m;case 29:break w;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 10:case 16:case 18:case 19:case 20:case 21:case 25:case 26:case 28:case 30:case 31:break n}switch(f-65|0){case 0:case 4:case 5:case 6:break c;case 2:break A;case 1:case 3:break n}if((0|f)==83)break s;break n}s=i[k+64>>2],r=i[k+68>>2],E=1024;break l}f=0;m:switch(255&R){case 0:case 1:case 6:i[i[k+64>>2]>>2]=m;continue f;case 2:o=i[k+64>>2],i[o>>2]=m,i[o+4>>2]=m>>31;continue f;case 3:r2[i[k+64>>2]>>1]=m;continue f;case 4:p[i[k+64>>2]]=m;continue f;case 7:break m;default:continue f}o=i[k+64>>2],i[o>>2]=m,i[o+4>>2]=m>>31;continue f}l=l>>>0>8?l:8,o|=8,f=120}if(A=_,F=32&f,(r=R=i[k+68>>2])|(s=i[k+64>>2]))for(;p[0|(A=A-1|0)]=F|w[1632+(15&s)|0],U=!r&s>>>0>15|(0|r)!=0,R=r,r=r>>>4|0,s=(15&R)<<28|s>>>4,U;);if(!(i[k+64>>2]|i[k+68>>2])|!(8&o))break r;E=1024+(f>>>4|0)|0,h=2;break r}if(f=_,(r=A=i[k+68>>2])|(s=i[k+64>>2]))for(;p[0|(f=f-1|0)]=7&s|48,R=!r&s>>>0>7|(0|r)!=0,A=r,r=r>>>3|0,s=(7&A)<<29|s>>>3,R;);if(A=f,!(8&o))break r;l=(0|(f=_-A|0))<(0|l)?l:f+1|0;break r}r=f=i[k+68>>2],s=i[k+64>>2],(0|f)<-1||(0|f)<=-1?(r=0-(r+((0|s)!=0)|0)|0,s=0-s|0,i[k+64>>2]=s,i[k+68>>2]=r,h=1,E=1024):2048&o?(h=1,E=1025):E=(h=1&o)?1026:1024}A=q2(s,r,_)}if(o=(0|l)>-1?-65537&o:o,r=f=i[k+68>>2],!(l|(0|(s=i[k+64>>2]))!=0|(0|f)!=0)){l=0,A=_;break n}l=(0|(f=!(r|s)+(_-A|0)|0))<(0|l)?l:f;break n}g=(0|(f=l))!=0;k:{r:{l:{v:if(!(!(3&(o=A=(o=i[k+64>>2])||1071))|!f))for(;;){if(!w[0|o])break l;if(g=(0|(f=f-1|0))!=0,!(3&(o=o+1|0)))break v;if(!f)break}if(!g)break r}l:if(!(!w[0|o]|f>>>0<4))for(;;){if((-1^(s=i[o>>2]))&s-16843009&-2139062144)break l;if(o=o+4|0,!((f=f-4|0)>>>0>3))break}if(f)for(;;){if(s=o,!w[0|o])break k;if(o=o+1|0,!(f=f-1|0))break}}s=0}g=s||l+A|0,o=r,l=s?s-A|0:l;break n}if(r=i[k+64>>2],l)break o;f=0,i2(n,32,v,0,o);break u}i[k+12>>2]=0,i[k+8>>2]=i[k+64>>2],i[k+64>>2]=k+8,l=-1,r=k+8|0}f=0;o:{for(;;){if(!(A=i[r>>2]))break o;if(!((s=(0|(A=h1(k+4|0,A)))<0)|A>>>0>l-f>>>0)){if(r=r+4|0,l>>>0>(f=f+A|0)>>>0)continue;break o}break}if(h=-1,s)break i}if(i2(n,32,v,f,o),f)for(r=0,s=i[k+64>>2];;){if(!(A=i[s>>2])||(0|(r=(A=h1(k+4|0,A))+r|0))>(0|f))break u;if(Z(n,k+4|0,A),s=s+4|0,!(f>>>0>r>>>0))break}else f=0}i2(n,32,v,f,8192^o),f=(0|f)<(0|v)?v:f;continue f}f=0|M[0|b](n,X[k+64>>3],v,l,o,f);continue f}p[k+55|0]=i[k+64>>2],l=1,A=P,o=r;break n}r=f+1|0,i[k+76>>2]=r,o=w[f+1|0],f=r}if(h=m,n)break i;if(!L)break a;for(f=1;;){if(n=i[(f<<2)+e>>2]){if(d1((f<<3)+t|0,n,a),h=1,(0|(f=f+1|0))!=10)continue;break i}break}if(h=1,f>>>0>=10)break i;for(;;){if(i[(f<<2)+e>>2])break t;if((0|(f=f+1|0))==10)break}break i}h=-1;break i}i2(n,32,f=(0|(r=(l=(0|(s=g-A|0))>(0|l)?s:l)+h|0))>(0|v)?r:v,r,o),Z(n,E,h),i2(n,48,f,r,65536^o),i2(n,48,l,s,0),Z(n,A,s),i2(n,32,f,r,8192^o);continue}break}h=0}return B=k+80|0,h}function y4(n,f,a,t,e,b){n|=0,f=+f,a|=0,t|=0,e|=0,b|=0;var o=0,k=0,r=0,s=0,A=0,l=0,v=0,h=0,m=0,g=0,E=0,R=0,_=0,L=0,P=0,F=0,U=0,q=0,Y=0,k2=0,m2=0;B=s=B-560|0,i[s+44>>2]=0,y0(+f),o=0|l2(1),l2(0),(0|o)<-1||(0|o)<=-1?(P=1,F=1034,y0(+(f=-f)),o=0|l2(1),l2(0)):2048&e?(P=1,F=1037):(F=(P=1&e)?1040:1035,m2=!P);i:if((2146435072&o)!=2146435072){_=s+16|0;f:{a:{n:{if(f=y1(f,s+44|0),(f+=f)!=0){if(o=i[s+44>>2],i[s+44>>2]=o-1,(0|(U=32|b))!=97)break n;break f}if((0|(U=32|b))==97)break f;A=i[s+44>>2],v=(0|t)<0?6:t;break a}A=o-29|0,i[s+44>>2]=A,f*=268435456,v=(0|t)<0?6:t}for(k=E=(0|A)<0?s+48|0:s+336|0;o=f<4294967296&f>=0?~~f>>>0:0,i[(t=k)>>2]=o,k=k+4|0,(f=1e9*(f-+(o>>>0)))!=0;);if((0|A)<1)t=A,o=k,r=E;else for(r=E,t=A;;){if(R=(0|t)<29?t:29,!(r>>>0>(o=k-4|0)>>>0)){for(t=R,m=0;g=o,h=0,Y=m,m=i[o>>2],l=31&t,(63&t)>>>0>=32?(k2=m<>>32-l,l=m<>>0>(m=Y+l|0)>>>0?h+1|0:h,Y=g,g=x0(m=A1(l=m,h,1e9),v2,1e9,0),i[Y>>2]=l-g,r>>>0<=(o=o-4|0)>>>0;);(t=m)&&(i[(r=r-4|0)>>2]=t)}for(;r>>>0<(o=k)>>>0&&!i[(k=o-4|0)>>2];);if(t=i[s+44>>2]-R|0,i[s+44>>2]=t,k=o,!((0|t)>0))break}if(k=(v+25|0)/9|0,(0|t)<=-1)for(R=k+1|0,q=(0|U)==102;;){m=(0|t)<-9?9:0-t|0;a:if(o>>>0>r>>>0){for(g=1e9>>>m|0,l=-1<>2],i[k>>2]=Y+(t>>>m|0),t=W(g,t&l),(k=k+4|0)>>>0>>0;);if(r=i[r>>2]?r:r+4|0,!t)break a;i[o>>2]=t,o=o+4|0}else r=i[r>>2]?r:r+4|0;if(t=i[s+44>>2]+m|0,i[s+44>>2]=t,o=(0|R)>2?k+(R<<2)|0:o,!((0|t)<0))break}if(k=0,!(o>>>0<=r>>>0||(k=W(E-r>>2,9),t=10,(l=i[r>>2])>>>0<10)))for(;k=k+1|0,l>>>0>=(t=W(t,10))>>>0;);if((0|(t=(v-((0|U)==102?0:k)|0)-((0|U)==103&(0|v)!=0)|0))<(W(o-E>>2,9)-9|0)){if(h=(((l=(0|(g=t+9216|0))/9|0)<<2)+((0|A)<0?s+48|4:s+340|0)|0)-4096|0,t=10,(0|(g=g-W(l,9)|0))<=7)for(;t=W(t,10),(0|(g=g+1|0))!=8;);if(R=(g=i[h>>2])-W(t,l=(g>>>0)/(t>>>0)|0)|0,((0|(A=h+4|0))!=(0|o)||R)&&(f=(0|o)==(0|A)?1:1.5,L=(A=t>>>1|0)>>>0>R>>>0?.5:(0|A)==(0|R)?f:1.5,f=1&l?9007199254740994:9007199254740992,w[0|F]!=45|m2||(L=-L,f=-f),A=g-R|0,i[h>>2]=A,f+L!=f)){if(t=t+A|0,i[h>>2]=t,t>>>0>=1e9)for(;i[h>>2]=0,(h=h-4|0)>>>0>>0&&(i[(r=r-4|0)>>2]=0),t=i[h>>2]+1|0,i[h>>2]=t,t>>>0>999999999;);if(k=W(E-r>>2,9),t=10,!((A=i[r>>2])>>>0<10))for(;k=k+1|0,A>>>0>=(t=W(t,10))>>>0;);}o=(t=h+4|0)>>>0>>0?t:o}for(;l=o,!(A=o>>>0<=r>>>0)&&!i[(o=l-4|0)>>2];);if((0|U)==103){if(v=((t=(0|(o=v||1))>(0|k)&(0|k)>-5)?-1^k:-1)+o|0,b=(t?-1:-2)+b|0,!(m=8&e)){if(o=-9,!A&&(A=i[l-4>>2])&&(g=10,o=0,!((A>>>0)%10|0))){for(;t=o,o=o+1|0,!((A>>>0)%((g=W(g,10))>>>0)|0););o=-1^t}t=W(l-E>>2,9),(-33&b)!=70?(m=0,v=(0|(t=(0|(t=((t+k|0)+o|0)-9|0))>0?t:0))>(0|v)?v:t):(m=0,v=(0|(t=(0|(t=(t+o|0)-9|0))>0?t:0))>(0|v)?v:t)}}else m=8&e;if(R=(v|m)!=0,t=n,A=a,(0|(g=-33&b))==70)b=(0|k)>0?k:0;else{if((_-(o=q2((o=k>>31)+k^o,0,_))|0)<=1)for(;p[0|(o=o-1|0)]=48,(_-o|0)<2;);p[0|(q=o-2|0)]=b,p[o-1|0]=(0|k)<0?45:43,b=_-q|0}i2(t,32,A,h=1+(b+(R+(v+P|0)|0)|0)|0,e),Z(n,F,P),i2(n,48,a,h,65536^e);a:{n:{t:{if((0|g)==70){for(t=s+16|8,k=s+16|9,r=b=r>>>0>E>>>0?E:r;;){o=q2(i[r>>2],0,k);b:if((0|b)==(0|r))(0|o)==(0|k)&&(p[s+24|0]=48,o=t);else{if(s+16>>>0>=o>>>0)break b;for(;p[0|(o=o-1|0)]=48,s+16>>>0>>0;);}if(Z(n,o,k-o|0),!(E>>>0>=(r=r+4|0)>>>0))break}if(o=0,!R)break n;if(Z(n,1069,1),(0|v)<1|r>>>0>=l>>>0)break t;for(;;){if((o=q2(i[r>>2],0,k))>>>0>s+16>>>0)for(;p[0|(o=o-1|0)]=48,s+16>>>0>>0;);if(Z(n,o,(0|v)<9?v:9),o=v-9|0,l>>>0<=(r=r+4|0)>>>0)break n;if(t=(0|v)>9,v=o,!t)break}break n}b:if(!((0|v)<0))for(b=r>>>0>>0?l:r+4|0,A=s+16|9,t=s+16|8,k=r;;){(0|A)==(0|(o=q2(i[k>>2],0,A)))&&(p[s+24|0]=48,o=t);e:if((0|k)==(0|r))Z(n,o,1),o=o+1|0,!m&&(0|v)<=0||Z(n,1069,1);else{if(s+16>>>0>=o>>>0)break e;for(;p[0|(o=o-1|0)]=48,s+16>>>0>>0;);}if(Z(n,l=o,(0|(o=A-o|0))<(0|v)?o:v),v=v-o|0,b>>>0<=(k=k+4|0)>>>0)break b;if(!((0|v)>-1))break}i2(n,48,v+18|0,18,0),Z(n,q,_-q|0);break a}o=v}i2(n,48,o+9|0,9,0)}break i}if(E=(A=32&b)?F+9|0:F,!(t>>>0>11)&&(o=12-t|0)){for(L=8;L*=16,o=o-1|0;);f=w[0|E]!=45?f+L-L:-(L+(-f-L))}for((0|_)==(0|(o=q2((k=(o=i[s+44>>2])>>31)^o+k,0,_)))&&(p[s+15|0]=48,o=s+15|0),v=2|P,k=i[s+44>>2],p[0|(l=o-2|0)]=b+15,p[o-1|0]=(0|k)<0?45:43,o=8&e,r=s+16|0;b=r,m=A,k=A4(f)<2147483648?~~f:-2147483648,p[0|r]=m|w[k+1632|0],f=16*(f-+(0|k)),!(o||(0|t)>0|f!=0)|((r=b+1|0)-(s+16|0)|0)!=1||(p[b+1|0]=46,r=b+2|0),f!=0;);i2(b=n,32,o=a,h=(A=!t|((r-s|0)-18|0)>=(0|t)?(_-(l+(s+16|0)|0)|0)+r|0:2+((t+_|0)-l|0)|0)+v|0,e),Z(n,E,v),i2(n,48,a,h,65536^e),Z(n,s+16|0,t=r-(s+16|0)|0),i2(n,48,A-((b=t)+(t=_-l|0)|0)|0,0,0),Z(n,l,t)}else i2(n,32,a,h=P+3|0,-65537&e),Z(n,F,P),t=32&b,Z(n,f!=f?t?1053:1061:t?1057:1065,3);return i2(n,32,a,h,8192^e),B=s+560|0,0|((0|a)>(0|h)?a:h)}function A0(n,f){var a=0,t=0,e=0,b=0,o=0,k=u(0),r=0,s=u(0),A=0,l=0,v=0;B=o=B+-64|0,i[n+72>>2]=f,a=e=i[f+8>>2];i:{f:{a:{for(;;){if(t=i[a+24>>2])break a;if((0|e)==(0|(a=i[a+8>>2])))break}for(i[o>>2]=i[e+4>>2],e=a=i[n- -64>>2];e=i[e+4>>2],(t=i[e>>2])&&!(0|M[i[a+16>>2]](i[a+12>>2],o,t)););if(t=i[e>>2],e=i[i[i[t+4>>2]+8>>2]>>2],r=i[e>>2],b=i[t>>2],G(i[i[b+4>>2]+16>>2],f,i[b+16>>2])==u(0)){if(k=c[f+28>>2],e=i[t>>2],a=i[e+16>>2],!(k!=c[a+28>>2]|c[a+32>>2]!=c[f+32>>2])){if(t=i[f+8>>2],i[o+40>>2]=0,i[o+44>>2]=0,i[o+32>>2]=0,i[o+36>>2]=0,f=i[287],i[o+24>>2]=i[286],i[o+28>>2]=f,f=i[285],i[o+16>>2]=i[284],i[o+20>>2]=f,i[o+32>>2]=i[a+12>>2],i[o+36>>2]=i[i[t+16>>2]+12>>2],c[o+52>>2]=c[a+16>>2],c[o+56>>2]=c[a+20>>2],c[o+60>>2]=c[a+24>>2],i[a+12>>2]=0,f=a+12|0,(0|(a=i[n+1736>>2]))==8?M[i[n+76>>2]](o+52|0,o+32|0,o+16|0,f):M[0|a](o+52|0,o+32|0,o+16|0,f,i[n+1896>>2]),i[f>>2]||(i[f>>2]=i[o+32>>2]),z(e,t))break f;break i}if(b=i[e+4>>2],a=i[b+16>>2],c[a+32>>2]!=c[f+32>>2]||k!=c[a+28>>2]){if(!n2(b))break i;if(w[t+15|0]){if(!$(i[e+8>>2]))break i;p[t+15|0]=0}if(!z(i[f+8>>2],e))break i;A0(n,f);break f}for(;t=i[i[i[t+4>>2]+4>>2]>>2],(0|a)==i[i[i[t>>2]+4>>2]+16>>2];);if(e=i[i[i[t+4>>2]+8>>2]>>2],r=i[e>>2],b=i[r+4>>2],a=i[b+8>>2],w[e+15|0]){if(i[r+24>>2]=0,h2(i[e+4>>2]),j(e),!$(b))break i;b=i[i[a+4>>2]+12>>2]}if(!z(i[f+8>>2],b))break i;A=i[b+8>>2],b=a,f=a,e=i[i[a+4>>2]+16>>2],k=c[e+28>>2],r=i[a+16>>2],k<(s=c[r+28>>2])|(c[e+32>>2]<=c[r+32>>2]?k==s:0)||(f=0),j2(n,t,A,b,f,1);break f}if(l=w[t+12|0],r=i[r+4>>2],A=i[r+16>>2],k=c[A+28>>2],v=i[i[b+4>>2]+16>>2],a=t,k<(s=c[v+28>>2])||k==s&&(a=t,c[A+32>>2]<=c[v+32>>2])||(a=e),w[a+15|0]||l){n:{if((0|a)==(0|t)){if(e=d2(i[i[f+8>>2]+4>>2],i[b+12>>2]))break n;break i}if(!(e=d2(i[i[r+8>>2]+4>>2],i[f+8>>2])))break i;e=i[e+4>>2]}if(w[a+15|0]){if($(i[a>>2])){i[a>>2]=e,p[a+15|0]=0,i[e+24>>2]=a,A0(n,f);break f}break i}if(!(a=H(16))||(i[a>>2]=e,t=S0(i[n- -64>>2],i[t+4>>2],a),i[a+4>>2]=t,!t))break i;p[a+13|0]=0,p[a+14|0]=0,p[a+15|0]=0,i[e+24>>2]=a,b=i[n+56>>2],e=i[i[a>>2]+28>>2]+i[i[i[t+4>>2]>>2]+8>>2]|0,i[a+8>>2]=e;n:{t:switch(b-100130|0){case 0:t=1&e;break n;case 1:t=(0|e)!=0;break n;case 2:t=(0|e)>0;break n;case 3:t=e>>>31|0;break n;case 4:break t;default:break n}t=e+1>>>0>2}p[a+12|0]=t,A0(n,f);break f}j2(a=n,t,n=i[f+8>>2],n,0,1);break f}for(f=i[i[t>>2]+16>>2];t=i[i[i[t+4>>2]+4>>2]>>2],a=i[t>>2],(0|f)==i[a+16>>2];);if(w[t+15|0]&&(!(f=d2(i[i[i[i[i[t+4>>2]+8>>2]>>2]>>2]+4>>2],i[a+12>>2]))||!$(i[t>>2])||(i[t>>2]=f,p[t+15|0]=0,i[f+24>>2]=t,!(t=i[i[i[t+4>>2]+4>>2]>>2]))))break i;if(f=i[i[i[t+4>>2]+8>>2]>>2],a=i[f>>2],f=a0(n,f,0),(0|a)!=(0|(e=i[f+8>>2])))j2(n,t,e,a,a,1);else{if(e=i[t>>2],A=i[i[i[t+4>>2]+8>>2]>>2],r=i[A>>2],i[i[e+4>>2]+16>>2]!=i[i[r+4>>2]+16>>2]&&o1(n,t),v=1,b=i[n+72>>2],k=c[b+28>>2],l=i[e+16>>2],!(k!=c[l+28>>2]|c[l+32>>2]!=c[b+32>>2])){if(!z(i[i[a+4>>2]+12>>2],e))break i;for(a=i[i[t>>2]+16>>2];t=i[i[i[t+4>>2]+4>>2]>>2],b=i[t>>2],(0|a)==i[b+16>>2];);if(w[t+15|0]&&(!(a=d2(i[i[i[i[i[t+4>>2]+8>>2]>>2]>>2]+4>>2],i[b+12>>2]))||!$(i[t>>2])||(i[t>>2]=a,p[t+15|0]=0,i[a+24>>2]=t,!(t=i[i[i[t+4>>2]+4>>2]>>2]))))break i;b=i[i[i[t+4>>2]+8>>2]>>2],a=i[b>>2],a0(n,b,A),b=i[n+72>>2],k=c[b+28>>2],v=0}a:{if(s=k,l=i[r+16>>2],s!=(k=c[l+28>>2])|c[l+32>>2]!=c[b+32>>2]){if(v)break a}else{if(!z(f,i[i[r+4>>2]+12>>2]))break i;f=a0(n,A,0)}j2(n,t,i[f+8>>2],a,a,1);break f}if(a=i[e+16>>2],s=c[a+28>>2],!(c[l+32>>2]<=c[a+32>>2])|k!=s&&!(s>k)||(e=i[i[r+4>>2]+12>>2]),!(f=d2(i[i[f+8>>2]+4>>2],e)))break i;j2(n,t,f,a=i[f+8>>2],a,0),p[i[i[f+4>>2]+24>>2]+15|0]=1,u1(n,t)}}return void(B=o- -64|0)}b2(n+1740|0,1),o2()}function b1(n){n|=0;var f=0,a=0,t=0,e=u(0),b=u(0),o=0,k=0,r=u(0),s=u(0),A=u(0),l=u(0),v=0,h=u(0),m=0,g=u(0),E=u(0),R=u(0),_=u(0),L=u(0),P=u(0),F=u(0),U=0,q=0,Y=u(0),k2=u(0),m2=0,n0=0,B0=0,j0=0,T0=0,F0=0,U0=0,O0=0;m=i[n+8>>2],f=B-80|0,b=c[n+16>>2],c[f+8>>2]=b,E=c[n+20>>2],c[f+12>>2]=E,R=c[n+24>>2],c[f+16>>2]=R;i:if(m2=b==u(0)&E==u(0)&R==u(0)){if(i[f+76>>2]=-42943038,i[f+68>>2]=-42943038,i[f+72>>2]=-42943038,i[f+64>>2]=2104540610,i[f+56>>2]=2104540610,i[f+60>>2]=2104540610,n0=(0|(v=i[m>>2]))==(0|m))g=u(-19999999867631625e21),r=u(19999999867631625e21),s=u(19999999867631625e21),h=u(-19999999867631625e21),A=u(19999999867631625e21),l=u(-19999999867631625e21);else{for(_=u(19999999867631625e21),L=u(-19999999867631625e21),P=u(-19999999867631625e21),F=u(19999999867631625e21),Y=u(-19999999867631625e21),k2=u(19999999867631625e21),g=u(-19999999867631625e21),r=u(19999999867631625e21),l=u(-19999999867631625e21),A=u(19999999867631625e21),h=u(-19999999867631625e21),s=u(19999999867631625e21),a=v;g=(t=(e=c[a+24>>2])>g)?e:g,L=t?e:L,r=(U=e>2])>l)?e:l,P=o?e:P,A=(q=e>2])>h)?e:h,Y=k?e:Y,B0=k?a:B0,s=(k=e>2])););i[f+20>>2]=j0,c[f+56>>2]=k2,c[f+68>>2]=Y,i[f+32>>2]=B0,c[f+60>>2]=F,i[f+24>>2]=O0,c[f+72>>2]=P,i[f+36>>2]=U0,c[f+64>>2]=_,i[f+28>>2]=F0,c[f+76>>2]=L,i[f+40>>2]=T0}if(a=2,t=(o=u(l-A)>u(h-s))<<2,t=u(g-r)>u(c[t+(f+68|0)>>2]-c[t+(f+56|0)>>2])?2:o,c[(o=t<<2)+(f+56|0)>>2]>=c[o+(f+68|0)>>2])i[f+8>>2]=0,i[f+12>>2]=0;else{if(a=i[(t<<=2)+(f+20|0)>>2],t=i[t+(f+32|0)>>2],L=c[t+16>>2],A=u(c[a+16>>2]-L),c[f+44>>2]=A,P=c[t+20>>2],l=u(c[a+20>>2]-P),c[f+48>>2]=l,F=c[t+24>>2],e=u(c[a+24>>2]-F),c[f+52>>2]=e,!n0){for(_=u(0),a=v;r=u(c[a+20>>2]-P),s=u(c[a+16>>2]-L),g=u(u(A*r)-u(l*s)),h=u(c[a+24>>2]-F),r=u(u(l*h)-u(e*r)),s=u(u(e*s)-u(A*h)),(h=u(u(g*g)+u(u(r*r)+u(s*s))))>_&&(R=g,E=s,_=h,b=r),(0|m)!=(0|(a=i[a>>2])););if(c[f+16>>2]=R,c[f+12>>2]=E,c[f+8>>2]=b,!(_<=u(0)))break i}i[f+16>>2]=0,i[f+8>>2]=0,i[f+12>>2]=0,a=(l(A>2],a=(e(b>2]=1065353216,R=c[f+16>>2],b=c[f+8>>2],E=c[f+12>>2]}else v=i[m>>2];if(t=(E(b>2],a=n+28|0,t=(R(b>2]=0,i[(k=(t+1>>>0)%3<<2)+a>>2]=1065353216,i[(t=(t+2>>>0)%3<<2)+a>>2]=0,i[(a=n+40|0)+o>>2]=0,f=c[o+(f+8|0)>>2]>u(0),c[a+k>>2]=u(f?-0:0),c[a+t>>2]=u(f?1:-1),!(t=(0|m)==(0|v)))for(a=v;f=i[a+20>>2],i[a+28>>2]=i[a+16>>2],i[a+32>>2]=f,(0|m)!=(0|(a=i[a>>2])););if(m2&&(0|(f=i[m+40>>2]))!=(0|(o=m+40|0))){for(b=u(0);;){if(k=i[f+8>>2],i[(a=k)+28>>2]>=1)for(;U=i[a+16>>2],q=i[i[a+4>>2]+16>>2],b=u(b+u(u(c[U+28>>2]-c[q+28>>2])*u(c[U+32>>2]+c[q+32>>2]))),(0|k)!=(0|(a=i[a+12>>2])););if((0|o)==(0|(f=i[f>>2])))break}if(b>2]=-c[v+32>>2],(0|(v=i[v>>2]))!=(0|m););c[n+40>>2]=-c[n+40>>2],c[n+44>>2]=-c[n+44>>2],c[n+48>>2]=-c[n+48>>2]}}}function j(n){var f=0,a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0;i:if(n|=0){b=(t=n-8|0)+(n=-8&(f=i[n-4>>2]))|0;f:if(!(1&f)){if(!(3&f)||(t=t-(f=i[t>>2])|0)>>>0>2]))==3)return i[616]=n,i[b+4>>2]=-2&f,i[t+4>>2]=1|n,void(i[n+t>>2]=n)}else{if(f>>>0<=255){if(e=i[t+8>>2],f=f>>>3|0,(0|(a=i[t+12>>2]))==(0|e)){r=2456,s=i[614]&f2(f),i[r>>2]=s;break f}i[e+12>>2]=a,i[a+8>>2]=e;break f}if(k=i[t+24>>2],(0|t)==(0|(f=i[t+12>>2])))if((a=i[(e=t+20|0)>>2])||(a=i[(e=t+16|0)>>2])){for(;o=e,(a=i[(e=(f=a)+20|0)>>2])||(e=f+16|0,a=i[f+16>>2]););i[o>>2]=0}else f=0;else a=i[t+8>>2],i[a+12>>2]=f,i[f+8>>2]=a;if(!k)break f;e=i[t+28>>2];a:{if(i[(a=2760+(e<<2)|0)>>2]==(0|t)){if(i[a>>2]=f,f)break a;r=2460,s=i[615]&f2(e),i[r>>2]=s;break f}if(i[k+(i[k+16>>2]==(0|t)?16:20)>>2]=f,!f)break f}if(i[f+24>>2]=k,(a=i[t+16>>2])&&(i[f+16>>2]=a,i[a+24>>2]=f),!(a=i[t+20>>2]))break f;i[f+20>>2]=a,i[a+24>>2]=f}}if(!(t>>>0>=b>>>0)&&1&(f=i[b+4>>2])){f:{if(!(2&f)){if(i[620]==(0|b)){if(i[620]=t,n=i[617]+n|0,i[617]=n,i[t+4>>2]=1|n,i[619]!=(0|t))break i;return i[616]=0,void(i[619]=0)}if(i[619]==(0|b))return i[619]=t,n=i[616]+n|0,i[616]=n,i[t+4>>2]=1|n,void(i[n+t>>2]=n);n=(-8&f)+n|0;a:if(f>>>0<=255){if(e=i[b+8>>2],f=f>>>3|0,(0|(a=i[b+12>>2]))==(0|e)){r=2456,s=i[614]&f2(f),i[r>>2]=s;break a}i[e+12>>2]=a,i[a+8>>2]=e}else{if(k=i[b+24>>2],(0|b)==(0|(f=i[b+12>>2])))if((a=i[(e=b+20|0)>>2])||(a=i[(e=b+16|0)>>2])){for(;o=e,(a=i[(e=(f=a)+20|0)>>2])||(e=f+16|0,a=i[f+16>>2]););i[o>>2]=0}else f=0;else a=i[b+8>>2],i[a+12>>2]=f,i[f+8>>2]=a;if(k){e=i[b+28>>2];n:{if(i[(a=2760+(e<<2)|0)>>2]==(0|b)){if(i[a>>2]=f,f)break n;r=2460,s=i[615]&f2(e),i[r>>2]=s;break a}if(i[k+(i[k+16>>2]==(0|b)?16:20)>>2]=f,!f)break a}i[f+24>>2]=k,(a=i[b+16>>2])&&(i[f+16>>2]=a,i[a+24>>2]=f),(a=i[b+20>>2])&&(i[f+20>>2]=a,i[a+24>>2]=f)}}if(i[t+4>>2]=1|n,i[n+t>>2]=n,i[619]!=(0|t))break f;return void(i[616]=n)}i[b+4>>2]=-2&f,i[t+4>>2]=1|n,i[n+t>>2]=n}if(n>>>0<=255)return f=2496+((n=n>>>3|0)<<3)|0,(a=i[614])&(n=1<>2]:(i[614]=n|a,n=f),i[f+8>>2]=t,i[n+12>>2]=t,i[t+12>>2]=f,void(i[t+8>>2]=n);e=31,i[t+16>>2]=0,i[t+20>>2]=0,n>>>0<=16777215&&(f=n>>>8|0,f<<=o=f+1048320>>>16&8,e=28+((f=((f<<=e=f+520192>>>16&4)<<(a=f+245760>>>16&2)>>>15|0)-(a|e|o)|0)<<1|n>>>f+21&1)|0),i[t+28>>2]=e,o=2760+(e<<2)|0;f:{a:{if((a=i[615])&(f=1<>>1|0)|0),f=i[o>>2];;){if(a=f,(-8&i[f+4>>2])==(0|n))break a;if(f=e>>>29|0,e<<=1,!(f=i[16+(o=a+(4&f)|0)>>2]))break}i[o+16>>2]=t,i[t+24>>2]=a}else i[615]=f|a,i[o>>2]=t,i[t+24>>2]=o;i[t+12>>2]=t,i[t+8>>2]=t;break f}n=i[a+8>>2],i[n+12>>2]=t,i[a+8>>2]=t,i[t+24>>2]=0,i[t+12>>2]=a,i[t+8>>2]=n}n=i[622]-1|0,i[622]=n||-1}}}function C4(n,f){f|=0;var a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0,A=0,l=0,v=0,h=0,m=0,g=0,E=0,R=0,_=0;if(B=k=B-16|0,i[84+(n|=0)>>2]=0,(0|(s=i[f+40>>2]))!=(0|(m=f+40|0)))for(f=s;p[f+20|0]=0,(0|m)!=(0|(f=i[f>>2])););if((0|s)!=(0|m)){for(;;){if(!(w[s+20|0]|!w[s+21|0])){if(o=i[s+8>>2],w[n+80|0])f=1,a=1;else{e=0,t=0,f=0,b=i[(a=o)+20>>2];i:if(w[b+21|0])for(;;){if(w[(f=b)+20|0]){f=t;break i}if(p[f+20|0]=1,i[f+16>>2]=t,e=e+1|0,t=f,a=i[a+8>>2],b=i[a+20>>2],!w[b+21|0])break}t=i[o+4>>2],b=i[t+20>>2];i:{f:if(!w[b+21|0]|w[b+20|0]){if(E=o,!f)break i}else for(a=f;;){if(p[(f=b)+20|0]=1,i[f+16>>2]=a,e=e+1|0,E=i[t+12>>2],t=i[E+4>>2],b=i[t+20>>2],!w[b+21|0])break f;if(a=f,w[b+20|0])break}for(;p[f+20|0]=0,f=i[f+16>>2];);}R=(0|e)>1,b=0,a=0,f=0,v=i[o+12>>2],t=i[(r=v)+20>>2];i:if(w[t+21|0])for(;;){if(w[(f=t)+20|0]){f=a;break i}if(p[f+20|0]=1,i[f+16>>2]=a,b=b+1|0,a=f,r=i[r+8>>2],t=i[r+20>>2],!w[t+21|0])break}g=R?e:1,t=i[v+4>>2],e=i[t+20>>2];i:{f:if(!w[e+21|0]|w[e+20|0]){if(!f)break i}else for(a=f;;){if(p[(f=e)+20|0]=1,i[f+16>>2]=a,b=b+1|0,v=i[t+12>>2],t=i[v+4>>2],e=i[t+20>>2],!w[e+21|0])break f;if(a=f,w[e+20|0])break}for(;p[f+20|0]=0,f=i[f+16>>2];);}_=(0|b)>(0|g),e=0,a=0,f=0,h=i[i[o+8>>2]+4>>2],t=i[(r=h)+20>>2];i:if(w[t+21|0])for(;;){if(w[(f=t)+20|0]){f=a;break i}if(p[f+20|0]=1,i[f+16>>2]=a,e=e+1|0,a=f,r=i[r+8>>2],t=i[r+20>>2],!w[t+21|0])break}A=_?b:g,t=i[h+4>>2],b=i[t+20>>2];i:{f:if(!w[b+21|0]|w[b+20|0]){if(!f)break i}else for(a=f;;){if(p[(f=b)+20|0]=1,i[f+16>>2]=a,e=e+1|0,h=i[t+12>>2],t=i[h+4>>2],b=i[t+20>>2],!w[b+21|0])break f;if(a=f,w[b+20|0])break}for(;p[f+20|0]=0,f=i[f+16>>2];);}R0(k,o),r=i[k+8>>2],g=i[k+4>>2],l=i[k>>2],R0(k,i[o+12>>2]),b=i[k+8>>2],t=i[k+4>>2],a=i[k>>2],R0(k,i[i[o+8>>2]+4>>2]),f=e,(0|(f=(l=(0|(f=(A=(0|(f=(e=(0|e)>(0|A))?f:A))<(0|l))?l:f))<(0|a))?a:f))>=(0|(a=i[k>>2]))?(o=l?t:A?g:e?h:_?v:R?E:o,a=l?b:A?r:e||R|_?2:1):(o=i[k+4>>2],f=a,a=i[k+8>>2])}M[0|a](n,o,f)}if((0|m)==(0|(s=i[s>>2])))break}if(e=i[n+84>>2]){for((0|(f=i[n+1716>>2]))==3?M[i[n+88>>2]](4):M[0|f](4,i[n+1896>>2]),b=-1;;){for(f=i[e+8>>2];w[n+80|0]&&(0|(a=!(o=w[i[i[f+4>>2]+20>>2]+21|0])))!=(0|b)&&((0|(t=i[n+1720>>2]))==4?M[i[n+92>>2]](!o):M[0|t](!o,i[n+1896>>2]),b=a),(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[f+16>>2]+12>>2]):M[0|a](i[i[f+16>>2]+12>>2],i[n+1896>>2]),(0|(f=i[f+12>>2]))!=i[e+8>>2];);if(!(e=i[e+16>>2]))break}(0|(f=i[n+1728>>2]))==6?M[i[n+100>>2]]():M[0|f](i[n+1896>>2]),i[n+84>>2]=0}}B=k+16|0}function k1(n,f){var a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0;b=n+f|0;i:{f:if(!(1&(a=i[n+4>>2]))){if(!(3&a))break i;f=(a=i[n>>2])+f|0;a:{if((0|(n=n-a|0))!=i[619]){if(a>>>0<=255){if(e=i[n+8>>2],a=a>>>3|0,(0|(t=i[n+12>>2]))!=(0|e))break a;r=2456,s=i[614]&f2(a),i[r>>2]=s;break f}if(k=i[n+24>>2],(0|(a=i[n+12>>2]))==(0|n))if((t=i[(e=n+20|0)>>2])||(t=i[(e=n+16|0)>>2])){for(;o=e,(t=i[(e=(a=t)+20|0)>>2])||(e=a+16|0,t=i[a+16>>2]););i[o>>2]=0}else a=0;else t=i[n+8>>2],i[t+12>>2]=a,i[a+8>>2]=t;if(!k)break f;e=i[n+28>>2];n:{if(i[(t=2760+(e<<2)|0)>>2]==(0|n)){if(i[t>>2]=a,a)break n;r=2460,s=i[615]&f2(e),i[r>>2]=s;break f}if(i[k+(i[k+16>>2]==(0|n)?16:20)>>2]=a,!a)break f}if(i[a+24>>2]=k,(t=i[n+16>>2])&&(i[a+16>>2]=t,i[t+24>>2]=a),!(t=i[n+20>>2]))break f;i[a+20>>2]=t,i[t+24>>2]=a;break f}if((3&(a=i[b+4>>2]))!=3)break f;return i[616]=f,i[b+4>>2]=-2&a,i[n+4>>2]=1|f,void(i[b>>2]=f)}i[e+12>>2]=t,i[t+8>>2]=e}f:{if(!(2&(a=i[b+4>>2]))){if(i[620]==(0|b)){if(i[620]=n,f=i[617]+f|0,i[617]=f,i[n+4>>2]=1|f,i[619]!=(0|n))break i;return i[616]=0,void(i[619]=0)}if(i[619]==(0|b))return i[619]=n,f=i[616]+f|0,i[616]=f,i[n+4>>2]=1|f,void(i[n+f>>2]=f);f=(-8&a)+f|0;a:if(a>>>0<=255){if(e=i[b+8>>2],a=a>>>3|0,(0|(t=i[b+12>>2]))==(0|e)){r=2456,s=i[614]&f2(a),i[r>>2]=s;break a}i[e+12>>2]=t,i[t+8>>2]=e}else{if(k=i[b+24>>2],(0|b)==(0|(a=i[b+12>>2])))if((e=i[(t=b+20|0)>>2])||(e=i[(t=b+16|0)>>2])){for(;o=t,(e=i[(t=(a=e)+20|0)>>2])||(t=a+16|0,e=i[a+16>>2]););i[o>>2]=0}else a=0;else t=i[b+8>>2],i[t+12>>2]=a,i[a+8>>2]=t;if(k){e=i[b+28>>2];n:{if(i[(t=2760+(e<<2)|0)>>2]==(0|b)){if(i[t>>2]=a,a)break n;r=2460,s=i[615]&f2(e),i[r>>2]=s;break a}if(i[k+(i[k+16>>2]==(0|b)?16:20)>>2]=a,!a)break a}i[a+24>>2]=k,(t=i[b+16>>2])&&(i[a+16>>2]=t,i[t+24>>2]=a),(t=i[b+20>>2])&&(i[a+20>>2]=t,i[t+24>>2]=a)}}if(i[n+4>>2]=1|f,i[n+f>>2]=f,i[619]!=(0|n))break f;return void(i[616]=f)}i[b+4>>2]=-2&a,i[n+4>>2]=1|f,i[n+f>>2]=f}if(f>>>0<=255)return a=2496+((f=f>>>3|0)<<3)|0,(t=i[614])&(f=1<>2]:(i[614]=f|t,f=a),i[a+8>>2]=n,i[f+12>>2]=n,i[n+12>>2]=a,void(i[n+8>>2]=f);e=31,i[n+16>>2]=0,i[n+20>>2]=0,f>>>0<=16777215&&(a=f>>>8|0,a<<=o=a+1048320>>>16&8,e=28+((a=((a<<=e=a+520192>>>16&4)<<(t=a+245760>>>16&2)>>>15|0)-(t|e|o)|0)<<1|f>>>a+21&1)|0),i[n+28>>2]=e,o=2760+(e<<2)|0;f:{if((t=i[615])&(a=1<>>1|0)|0),a=i[o>>2];;){if(t=a,(-8&i[a+4>>2])==(0|f))break f;if(a=e>>>29|0,e<<=1,!(a=i[16+(o=t+(4&a)|0)>>2]))break}i[o+16>>2]=n,i[n+24>>2]=t}else i[615]=a|t,i[o>>2]=n,i[n+24>>2]=o;return i[n+12>>2]=n,void(i[n+8>>2]=n)}f=i[t+8>>2],i[f+12>>2]=n,i[t+8>>2]=n,i[n+24>>2]=0,i[n+12>>2]=t,i[n+8>>2]=f}}function E0(n,f){var a=0,t=0,e=0,b=u(0),o=0,k=0,r=u(0),s=0,A=0,l=0,v=0,h=0,m=0,g=0,E=0,R=0,_=0,L=0,P=0,F=0,U=0;B=e=B-48|0;i:{l=i[f>>2],k=i[l+16>>2],r=c[k+28>>2],a=i[i[i[f+4>>2]+8>>2]>>2],h=i[a>>2],t=i[h+16>>2],b=c[t+28>>2];f:{if(!(!(c[k+32>>2]<=c[t+32>>2])|r!=b)||r>2]+16>>2],k,t)>u(0))break f;if(k=i[l+16>>2],t=i[h+16>>2],c[k+32>>2]!=c[t+32>>2]||c[k+28>>2]!=c[t+28>>2]){if(!n2(i[h+4>>2])||!z(l,i[i[h+4>>2]+12>>2]))break i;_=1,p[a+14|0]=1,p[f+14|0]=1;break f}if(_=1,(0|t)==(0|k))break f;if(o=i[n+68>>2],(0|(f=i[k+36>>2]))>=0){if(m=i[o>>2],s=i[m>>2],k=f,A=i[m+4>>2],f=i[4+(L=A+(f<<3)|0)>>2],R=i[m+8>>2],E=i[s+(R<<2)>>2],i[s+(f<<2)>>2]=E,i[4+(P=(E<<3)+A|0)>>2]=f,F=R-1|0,i[m+8>>2]=F,(0|f)<(0|R)){a:{if((0|f)<2||(a=i[(i[s+(f<<1&-4)>>2]<<3)+A>>2],b=c[a+28>>2],g=i[(E<<3)+A>>2],b<(r=c[g+28>>2])||!(!(c[a+32>>2]<=c[g+32>>2])|r!=b)))for(U=(E<<3)+A|0;;){if((0|F)<=(0|(a=f<<1))||(v=i[(i[s+((t=1|a)<<2)>>2]<<3)+A>>2],r=c[v+28>>2],o=i[(i[s+(a<<2)>>2]<<3)+A>>2],b=c[o+28>>2],!(c[v+32>>2]<=c[o+32>>2])|r!=b&&!(r=(0|R)){a=f;break a}if(g=i[U>>2],r=c[g+28>>2],v=i[s+(a<<2)>>2],t=i[(o=(v<<3)+A|0)>>2],r<(b=c[t+28>>2])){a=f;break a}if(!(!(c[g+32>>2]<=c[t+32>>2])|r!=b)){a=f;break a}i[s+(f<<2)>>2]=v,i[o+4>>2]=f,f=a}for(;;){if(v=i[s+((a=f>>1)<<2)>>2],t=i[(o=(v<<3)+A|0)>>2],(b=c[t+28>>2])>2]<=c[g+32>>2])|r!=b)){a=f;break a}if(i[s+(f<<2)>>2]=v,i[o+4>>2]=f,!((f=a)>>>0>1))break}}i[s+(a<<2)>>2]=E,i[P+4>>2]=a}i[L>>2]=0,i[L+4>>2]=i[m+16>>2],i[m+16>>2]=k}else{i[i[o+4>>2]+((-1^f)<<2)>>2]=0;a:if(!((0|(f=i[o+12>>2]))<1))for(k=i[o+8>>2];;){if(i[i[k+((a=f-1|0)<<2)>>2]>>2])break a;if(i[o+12>>2]=a,t=(0|f)>1,f=a,!t)break}}if(a=i[i[h+4>>2]+12>>2],i[e+24>>2]=0,i[e+28>>2]=0,i[e+16>>2]=0,i[e+20>>2]=0,f=i[287],i[e+8>>2]=i[286],i[e+12>>2]=f,f=i[285],i[e>>2]=i[284],i[e+4>>2]=f,f=i[a+16>>2],i[e+16>>2]=i[f+12>>2],i[e+20>>2]=i[i[l+16>>2]+12>>2],c[e+36>>2]=c[f+16>>2],c[e+40>>2]=c[f+20>>2],c[e+44>>2]=c[f+24>>2],i[f+12>>2]=0,t=f+12|0,(0|(f=i[n+1736>>2]))==8?M[i[n+76>>2]](e+36|0,e+16|0,e,t):M[0|f](e+36|0,e+16|0,e,t,i[n+1896>>2]),i[t>>2]||(i[t>>2]=i[e+16>>2]),z(a,l))break f;break i}if(!(G(i[i[l+4>>2]+16>>2],t,k)>2]+4>>2]>>2]+14|0]=1,!n2(i[l+4>>2])||!z(i[i[h+4>>2]+12>>2],l)))break i}return B=e+48|0,_}b2(n+1740|0,1),o2()}function E4(n){n|=0;var f=0,a=0,t=u(0),e=u(0),b=u(0),o=u(0),k=u(0),r=u(0),s=0,A=0,l=0,v=u(0),h=u(0),m=0,g=u(0),E=u(0),R=u(0),_=u(0),L=u(0),P=0,F=0,U=u(0),q=u(0),Y=u(0);i:{f:if(!((0|(l=i[n+112>>2]))<3)){if(s=(F=n+116|0)+(l<<4)|0,o=c[n+24>>2],k=c[n+16>>2],r=c[n+20>>2],o!=u(0)||k!=u(0)|r!=u(0))g=c[n+124>>2],b=u(c[n+140>>2]-g),E=c[n+120>>2],v=u(c[n+136>>2]-E),R=c[n+116>>2],h=u(c[n+132>>2]-R);else{for(a=n+148|0,o=u(0),r=u(0),k=u(0),f=n+132|0,R=c[n+116>>2],t=h=u(c[f>>2]-R),E=c[n+120>>2],e=v=u(c[n+136>>2]-E),g=c[n+124>>2],_=b=u(c[n+140>>2]-g);L=u(c[f+20>>2]-E),U=u(c[a>>2]-R),q=u(u(t*L)-u(e*U)),Y=u(c[f+24>>2]-g),e=u(u(e*Y)-u(_*L)),t=u(u(_*U)-u(t*Y)),u(u(o*q)+u(u(k*e)+u(r*t)))>=u(0)?(r=u(r+t),k=u(k+e),o=u(o+q)):(r=u(r-t),k=u(k-e),o=u(o-q)),t=U,e=L,_=Y,s>>>0>(a=(f=a)+16|0)>>>0;);if((0|l)<3)break f}for(a=n+148|0,f=m=n+132|0;;){t=b,b=v,P=f,e=h,v=u(c[f+20>>2]-E),h=u(c[(f=a)>>2]-R),L=u(o*u(u(e*v)-u(b*h))),_=b,b=u(c[P+24>>2]-g);a:if((t=u(L+u(u(k*u(u(_*b)-u(t*v)))+u(r*u(u(t*h)-u(e*b))))))!=u(0)){if(t>u(0)){if(a=0,P=(0|A)<0,A=1,!P)break a;break i}if(a=0,P=(0|A)>0,A=-1,P)break i}if(!(s>>>0>(a=f+16|0)>>>0))break}switch(a=0,0|A){case 2:break i;case 0:break f}a=1;a:{n:switch(i[n+56>>2]-100132|0){case 0:if((0|A)>=0)break a;break f;case 2:break i;case 1:break n;default:break a}if((0|A)>0)break f}(0|(f=i[n+1716>>2]))==3?M[i[n+88>>2]](w[n+81|0]?2:(0|l)<4?4:6):M[0|f](w[n+81|0]?2:(0|l)<4?4:6,i[n+1896>>2]),(0|(f=i[n+1724>>2]))==5?M[i[n+96>>2]](i[n+128>>2]):M[0|f](i[n+128>>2],i[n+1896>>2]);a:if((0|A)<=0){if(F>>>0>=(f=s-16|0)>>>0)break a;for(;(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[s-4>>2]):M[0|a](i[s-4>>2],i[n+1896>>2]),s=f,F>>>0<(f=f-16|0)>>>0;);}else if(!((0|l)<2))for(;(0|(f=i[n+1724>>2]))==5?M[i[n+96>>2]](i[m+12>>2]):M[0|f](i[m+12>>2],i[n+1896>>2]),(m=m+16|0)>>>0>>0;);(0|(f=i[n+1728>>2]))==6?M[i[n+100>>2]]():M[0|f](i[n+1896>>2])}a=1}return 0|a}function l0(n,f){var a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0,A=0,l=0,v=0,h=0,m=0;if(!n)return H(f);if(f>>>0>=4294967232)return i[613]=48,0;o=f>>>0<11?16:f+11&-8,e=-8&(s=i[4+(b=n-8|0)>>2]);i:if(3&s){k=e+b|0;f:if(e>>>0>=o>>>0){if((t=e-o|0)>>>0<16)break f;i[b+4>>2]=1&s|o|2,i[4+(a=b+o|0)>>2]=3|t,i[k+4>>2]=1|i[k+4>>2],k1(a,t)}else if(i[620]!=(0|k))if(i[619]!=(0|k)){if(2&(t=i[k+4>>2])||(A=e+(-8&t)|0)>>>0>>0)break i;v=A-o|0;a:if(t>>>0<=255){if(e=i[k+8>>2],a=t>>>3|0,(0|(t=i[k+12>>2]))==(0|e)){h=2456,m=i[614]&f2(a),i[h>>2]=m;break a}i[e+12>>2]=t,i[t+8>>2]=e}else{if(l=i[k+24>>2],(0|(r=i[k+12>>2]))==(0|k))if((a=i[(e=k+20|0)>>2])||(a=i[(e=k+16|0)>>2])){for(;t=e,r=a,(a=i[(e=a+20|0)>>2])||(e=r+16|0,a=i[r+16>>2]););i[t>>2]=0}else r=0;else a=i[k+8>>2],i[a+12>>2]=r,i[r+8>>2]=a;if(l){t=i[k+28>>2];n:{if(i[(a=2760+(t<<2)|0)>>2]==(0|k)){if(i[a>>2]=r,r)break n;h=2460,m=i[615]&f2(t),i[h>>2]=m;break a}if(i[(i[l+16>>2]==(0|k)?16:20)+l>>2]=r,!r)break a}i[r+24>>2]=l,(a=i[k+16>>2])&&(i[r+16>>2]=a,i[a+24>>2]=r),(a=i[k+20>>2])&&(i[r+20>>2]=a,i[a+24>>2]=r)}}v>>>0<=15?(i[b+4>>2]=1&s|A|2,i[4+(a=b+A|0)>>2]=1|i[a+4>>2]):(i[b+4>>2]=1&s|o|2,i[4+(t=b+o|0)>>2]=3|v,i[4+(a=b+A|0)>>2]=1|i[a+4>>2],k1(t,v))}else{if((t=e+i[616]|0)>>>0>>0)break i;(a=t-o|0)>>>0>=16?(i[b+4>>2]=1&s|o|2,i[4+(e=b+o|0)>>2]=1|a,i[(t=t+b|0)>>2]=a,i[t+4>>2]=-2&i[t+4>>2]):(i[b+4>>2]=t|1&s|2,i[4+(a=t+b|0)>>2]=1|i[a+4>>2],a=0,e=0),i[619]=e,i[616]=a}else{if((e=e+i[617]|0)>>>0<=o>>>0)break i;i[b+4>>2]=1&s|o|2,a=e-o|0,i[4+(t=b+o|0)>>2]=1|a,i[617]=a,i[620]=t}a=b}else{if(o>>>0<256||e>>>0>=o+4>>>0&&(a=b,e-o>>>0<=i[734]<<1>>>0))break i;a=0}return a?a+8|0:(b=H(f))?(c1(b,n,f>>>0>(a=(3&(a=i[n-4>>2])?-4:-8)+(-8&a)|0)>>>0?a:f),j(n),b):0}function u1(n,f){var a=0,t=0,e=0,b=0,o=0,k=0,r=u(0),s=0,A=u(0);for(t=i[i[i[f+4>>2]+8>>2]>>2];;){i:{if(w[t+14|0])for(;t=i[i[i[(f=t)+4>>2]+8>>2]>>2],w[t+14|0];);f:{a:{n:{t:{if(w[f+14|0])a=f;else if(!(a=i[i[i[f+4>>2]+4>>2]>>2])||(t=f,!w[a+14|0]))break t;p[a+14|0]=0,e=i[a>>2],f=i[i[e+4>>2]+16>>2],o=i[t>>2];b:if((0|f)!=i[i[o+4>>2]+16>>2]){r=c[f+28>>2],s=i[i[i[a+4>>2]+8>>2]>>2],b=i[s>>2],k=i[i[b+4>>2]+16>>2],A=c[k+28>>2];e:{if(!(!(c[f+32>>2]<=c[k+32>>2])|r!=A)||r>2])>2]+4>>2]>>2]+14|0]=1,!(f=n2(e)))break f;if(z(i[b+4>>2],f))break e;break i}if(G(k,f,i[b+16>>2])>u(0)){f=a;break b}if(p[s+14|0]=1,p[a+14|0]=1,!(f=n2(b))||!z(i[e+12>>2],i[b+4>>2]))break i;f=i[f+4>>2]}if(p[i[f+20>>2]+21|0]=w[a+12|0],w[t+15|0]){if(i[i[t>>2]+24>>2]=0,h2(i[t+4>>2]),j(t),!$(o))break i;t=i[i[i[a+4>>2]+8>>2]>>2],o=i[t>>2],f=a}else if(w[a+15|0]){if(i[i[a>>2]+24>>2]=0,h2(i[a+4>>2]),j(a),!$(e))break i;f=i[i[i[t+4>>2]+4>>2]>>2],e=i[f>>2]}else f=a}else f=a;if(i[e+16>>2]==i[o+16>>2])break a;if(a=i[i[e+4>>2]+16>>2],b=i[i[o+4>>2]+16>>2],w[t+15|0]|w[f+15|0]|(0|a)==(0|b)||(k=a,(0|(a=i[n+72>>2]))!=(0|b)&&(0|k)!=(0|a)))break n;if(!o1(n,f))break a}return}E0(n,f)}if(i[e+16>>2]!=i[o+16>>2]||(b=i[e+4>>2],a=i[o+4>>2],i[b+16>>2]!=i[a+16>>2]))continue;if(i[o+28>>2]=i[o+28>>2]+i[e+28>>2],i[a+28>>2]=i[a+28>>2]+i[b+28>>2],i[i[f>>2]+24>>2]=0,h2(i[f+4>>2]),j(f),!$(e))break i;f=i[i[i[t+4>>2]+4>>2]>>2];continue}}break}b2(n+1740|0,1),o2()}function R4(n){n|=0;var f=0,a=0,t=0,e=u(0),b=u(0),o=0,k=0,r=0,s=0;if((0|(f=i[n+40>>2]))!=(0|(r=n+40|0)))for(;;){if(n=i[f>>2],w[f+21|0]){for(f=f+8|0;f=i[f>>2],a=i[i[f+4>>2]+16>>2],e=c[a+28>>2],t=i[f+16>>2],b=c[t+28>>2],!(!(c[a+32>>2]<=c[t+32>>2])|e!=b)||e>2]+4|0;for(;!(!(c[t+32>>2]<=c[a+32>>2])|e!=b)||e>b;)f=i[f+12>>2],t=i[f+16>>2],b=c[t+28>>2],a=i[i[f+4>>2]+16>>2],e=c[a+28>>2];i:{f:if((0|(t=i[i[f+8>>2]+4>>2]))!=i[f+12>>2])for(;;){if(o=i[t+16>>2],b=c[o+28>>2],!(c[a+32>>2]<=c[o+32>>2])|e!=b&&!(b>e)){a:if(i[t+12>>2]!=(0|f))for(;;){if(a=i[i[f+8>>2]+4>>2],o=i[a+16>>2],e=c[o+28>>2],k=i[i[a+4>>2]+16>>2],!(e<(b=c[k+28>>2])|(c[o+32>>2]<=c[k+32>>2]?e==b:0))){if(!(G(i[i[f+4>>2]+16>>2],i[f+16>>2],o)>=u(0)))break a;a=i[i[f+8>>2]+4>>2]}if(f=d2(f,a),a=0,!f)break i;if((0|(f=i[f+4>>2]))==i[t+12>>2])break}f=i[f+12>>2]}else{a:if((0|(a=i[t+12>>2]))!=(0|f))for(o=t+12|0;;){if(k=i[i[a+4>>2]+16>>2],e=c[k+28>>2],s=i[a+16>>2],!(e<(b=c[s+28>>2])|(c[k+32>>2]<=c[s+32>>2]?e==b:0))){if(!(G(i[t+16>>2],i[i[t+4>>2]+16>>2],k)<=u(0)))break a;a=i[o>>2]}if(t=d2(a,t),a=0,!t)break i;if(o=(t=i[t+4>>2])+12|0,(0|(a=i[t+12>>2]))==(0|f))break}t=i[i[t+8>>2]+4>>2]}if(i[f+12>>2]==(0|t))break f;a=i[i[f+4>>2]+16>>2],e=c[a+28>>2]}if(a=i[t+12>>2],i[a+12>>2]!=(0|f))for(;;){if(t=d2(a,t),a=0,!t)break i;if(t=i[t+4>>2],a=i[t+12>>2],i[a+12>>2]==(0|f))break}a=1}if(!a)return 0}if((0|r)==(0|(f=n)))break}return 1}function $(n){var f=0,a=0,t=0,e=0,b=0,o=0;if(e=i[n+4>>2],(0|(o=i[e+20>>2]))!=(0|(a=i[n+20>>2]))){for(f=t=i[a+8>>2];i[f+20>>2]=o,(0|t)!=(0|(f=i[f+12>>2])););f=i[a>>2],t=i[a+4>>2],i[f+4>>2]=t,i[t>>2]=f,j(a)}if((0|(t=i[n+8>>2]))!=(0|n)){if(b=i[n+4>>2],f=i[b+12>>2],i[i[b+20>>2]+8>>2]=f,i[i[n+16>>2]+8>>2]=t,b=i[f+8>>2],i[i[t+4>>2]+12>>2]=f,i[i[b+4>>2]+12>>2]=n,i[n+8>>2]=b,i[f+8>>2]=t,(0|a)==(0|o)){if(!(a=H(24)))return 0;for(f=i[n+20>>2],t=i[f+4>>2],i[a+4>>2]=t,i[t>>2]=a,i[a>>2]=f,i[f+4>>2]=a,i[a+12>>2]=0,i[a+16>>2]=0,i[a+8>>2]=n,p[a+20|0]=0,p[a+21|0]=w[f+21|0],f=n;i[f+20>>2]=a,(0|(f=i[f+12>>2]))!=(0|n););}}else{for(a=i[n+16>>2],f=t=i[a+8>>2];i[f+16>>2]=0,(0|t)!=(0|(f=i[f+8>>2])););f=i[a>>2],t=i[a+4>>2],i[f+4>>2]=t,i[t>>2]=f,j(a)}if((0|(f=i[e+8>>2]))!=(0|e))a=i[i[e+4>>2]+12>>2],i[i[n+20>>2]+8>>2]=a,i[i[e+16>>2]+8>>2]=f,t=i[a+8>>2],i[i[f+4>>2]+12>>2]=a,i[i[t+4>>2]+12>>2]=e,i[e+8>>2]=t,i[a+8>>2]=f;else{for(a=i[e+16>>2],f=t=i[a+8>>2];i[f+16>>2]=0,(0|t)!=(0|(f=i[f+8>>2])););for(f=i[a>>2],t=i[a+4>>2],i[f+4>>2]=t,i[t>>2]=f,j(a),a=i[e+20>>2],f=e=i[a+8>>2];i[f+20>>2]=0,(0|e)!=(0|(f=i[f+12>>2])););f=i[a>>2],e=i[a+4>>2],i[f+4>>2]=e,i[e>>2]=f,j(a)}return f=i[n+4>>2],f=i[(n=n>>>0>f>>>0?f:n)>>2],a=i[i[n+4>>2]>>2],i[i[f+4>>2]>>2]=a,i[i[a+4>>2]>>2]=f,j(n),1}function d2(n,f){var a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0;if(t=0,a=H(64)){if(k=i[n+4>>2],b=i[(t=n>>>0>k>>>0?k:n)+4>>2],e=i[b>>2],i[a+32>>2]=e,i[i[e+4>>2]>>2]=a,i[a>>2]=t,o=a+32|0,i[b>>2]=o,i[a+16>>2]=0,i[a+20>>2]=0,i[a+12>>2]=o,i[a+4>>2]=o,i[a+24>>2]=0,i[a+28>>2]=0,i[a+48>>2]=0,i[a+52>>2]=0,i[a+44>>2]=a,i[a+40>>2]=o,i[a+36>>2]=a,i[a+56>>2]=0,i[a+60>>2]=0,i[a+8>>2]=a,(0|(r=i[n+20>>2]))!=(0|(b=i[f+20>>2]))){for(t=e=i[b+8>>2];i[t+20>>2]=r,(0|e)!=(0|(t=i[t+12>>2])););t=i[b>>2],e=i[b+4>>2],i[t+4>>2]=e,i[e>>2]=t,j(b),k=i[n+4>>2],e=i[a+8>>2],t=i[n+20>>2]}else e=a,t=b;if(n=i[n+12>>2],s=i[n+8>>2],i[i[e+4>>2]+12>>2]=n,i[i[s+4>>2]+12>>2]=a,i[a+8>>2]=s,i[n+8>>2]=e,n=i[f+8>>2],e=i[a+40>>2],i[i[e+4>>2]+12>>2]=f,i[i[n+4>>2]+12>>2]=o,i[a+40>>2]=n,i[f+8>>2]=e,i[a+16>>2]=i[k+16>>2],f=i[f+16>>2],n=t,i[a+52>>2]=n,i[a+48>>2]=f,i[a+20>>2]=n,i[n+8>>2]=o,t=a,(0|b)==(0|r)&&(t=0,f=H(24))){for(t=i[n+4>>2],i[f+4>>2]=t,i[t>>2]=f,i[f>>2]=n,i[n+4>>2]=f,i[f+12>>2]=0,i[f+16>>2]=0,i[f+8>>2]=a,p[f+20|0]=0,p[f+21|0]=w[n+21|0],t=a;i[t+20>>2]=f,(0|(t=i[t+12>>2]))!=(0|a););t=a}}return t}function c1(n,f,a){var t=0,e=0;if(a>>>0>=512)m4(0|n,0|f,0|a);else{t=n+a|0;i:if(3&(n^f))if(t>>>0<4)a=n;else if((e=t-4|0)>>>0>>0)a=n;else for(a=n;p[0|a]=w[0|f],p[a+1|0]=w[f+1|0],p[a+2|0]=w[f+2|0],p[a+3|0]=w[f+3|0],f=f+4|0,e>>>0>=(a=a+4|0)>>>0;);else{f:if(3&n)if((0|a)<1)a=n;else for(a=n;;){if(p[0|a]=w[0|f],f=f+1|0,!(3&(a=a+1|0)))break f;if(!(a>>>0>>0))break}else a=n;if(!((n=-4&t)>>>0<64||(e=n+-64|0)>>>0
>>0))for(;i[a>>2]=i[f>>2],i[a+4>>2]=i[f+4>>2],i[a+8>>2]=i[f+8>>2],i[a+12>>2]=i[f+12>>2],i[a+16>>2]=i[f+16>>2],i[a+20>>2]=i[f+20>>2],i[a+24>>2]=i[f+24>>2],i[a+28>>2]=i[f+28>>2],i[a+32>>2]=i[f+32>>2],i[a+36>>2]=i[f+36>>2],i[a+40>>2]=i[f+40>>2],i[a+44>>2]=i[f+44>>2],i[a+48>>2]=i[f+48>>2],i[a+52>>2]=i[f+52>>2],i[a+56>>2]=i[f+56>>2],i[a+60>>2]=i[f+60>>2],f=f- -64|0,e>>>0>=(a=a- -64|0)>>>0;);if(n>>>0<=a>>>0)break i;for(;i[a>>2]=i[f>>2],f=f+4|0,n>>>0>(a=a+4|0)>>>0;);}if(a>>>0>>0)for(;p[0|a]=w[0|f],f=f+1|0,(0|t)!=(0|(a=a+1|0)););}}function n2(n){var f=0,a=0,t=0,e=0,b=0,o=0;if(b=n|=0,n=0,(f=H(64))&&(t=i[b+4>>2],e=i[(a=t>>>0>>0?t:b)+4>>2],o=i[e>>2],i[f+32>>2]=o,i[i[o+4>>2]>>2]=f,i[f>>2]=a,a=f+32|0,i[e>>2]=a,i[f+16>>2]=0,i[f+20>>2]=0,i[f+12>>2]=a,i[f+4>>2]=a,i[f+24>>2]=0,i[f+28>>2]=0,i[f+48>>2]=0,i[f+52>>2]=0,i[f+40>>2]=a,i[f+36>>2]=f,i[f+56>>2]=0,i[f+60>>2]=0,i[f+8>>2]=f,e=i[b+12>>2],o=i[e+8>>2],i[f+44>>2]=e,i[i[o+4>>2]+12>>2]=f,i[f+8>>2]=o,i[e+8>>2]=f,e=i[t+16>>2],i[f+16>>2]=e,t=H(40))){for(n=i[e+4>>2],i[t+4>>2]=n,i[n>>2]=t,i[t>>2]=e,i[e+4>>2]=t,i[t+12>>2]=0,i[t+8>>2]=a,n=a;i[n+16>>2]=t,(0|a)!=(0|(n=i[n+8>>2])););n=i[b+20>>2],i[f+20>>2]=n,i[f+52>>2]=n,n=f}return n?(f=i[n+4>>2],n=i[b+4>>2],a=i[i[n+4>>2]+12>>2],t=i[a+8>>2],e=i[n+8>>2],i[i[e+4>>2]+12>>2]=a,i[i[t+4>>2]+12>>2]=n,i[n+8>>2]=t,i[a+8>>2]=e,a=i[f+8>>2],t=i[n+8>>2],i[i[t+4>>2]+12>>2]=f,i[i[a+4>>2]+12>>2]=n,i[n+8>>2]=a,i[f+8>>2]=t,i[n+16>>2]=i[f+16>>2],a=i[f+4>>2],i[i[a+16>>2]+8>>2]=a,i[a+20>>2]=i[n+20>>2],i[f+28>>2]=i[b+28>>2],i[a+28>>2]=i[n+28>>2],0|f):0}function j2(n,f,a,t,e,b){var o=0,k=0,r=0,s=0,A=0;s=f+4|0,r=n- -64|0;i:{for(;;){if(k=i[a+4>>2],!(o=H(16))||(i[o>>2]=k,A=S0(i[r>>2],i[f+4>>2],o),i[o+4>>2]=A,!A))break i;if(p[o+13|0]=0,p[o+14|0]=0,p[o+15|0]=0,i[k+24>>2]=o,(0|t)==(0|(a=i[a+8>>2])))break}if(o=i[i[i[f+4>>2]+8>>2]>>2],a=i[i[o>>2]+4>>2],e=e||i[a+8>>2],i[a+16>>2]==i[e+16>>2])for(r=0;;){if(t=f,f=o,(0|(o=e))!=i[(e=a)+8>>2]&&(!z(i[i[e+4>>2]+12>>2],e)||!z(i[i[o+4>>2]+12>>2],e)))break i;k=i[t+8>>2]-i[e+28>>2]|0,i[f+8>>2]=k;f:{a:switch(i[n+56>>2]-100130|0){case 0:a=1&k;break f;case 1:a=(0|k)!=0;break f;case 2:a=(0|k)>0;break f;case 3:a=k>>>31|0;break f;case 4:break a;default:break f}a=k+1>>>0>2}if(p[f+12|0]=a,p[t+14|0]=1,r&&E0(n,t)&&(i[e+28>>2]=i[e+28>>2]+i[o+28>>2],a=i[e+4>>2],i[a+28>>2]=i[a+28>>2]+i[i[o+4>>2]+28>>2],i[i[t>>2]+24>>2]=0,h2(i[s>>2]),j(t),!$(o)))break i;if(s=f+4|0,r=1,o=i[i[i[f+4>>2]+8>>2]>>2],a=i[i[o>>2]+4>>2],i[a+16>>2]!=i[e+16>>2])break}return p[f+14|0]=1,void(b&&u1(n,f))}b2(n+1740|0,1),o2()}function r1(n){var f=0,a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0;if((0|(e=i[40+(n|=0)>>2]))!=(0|(k=n+40|0)))for(;;){if(s=i[e>>2],!w[e+21|0]){for(r=i[e+8>>2],n=i[r+12>>2];;){if(i[n+20>>2]=0,o=i[n+12>>2],f=i[n+4>>2],!i[f+20>>2]){if(t=i[n+16>>2],(0|(a=i[n+8>>2]))!=(0|n))i[t+8>>2]=a,t=i[f+12>>2],b=i[t+8>>2],i[i[a+4>>2]+12>>2]=t,i[i[b+4>>2]+12>>2]=n,i[n+8>>2]=b,i[t+8>>2]=a;else{for(f=a=i[t+8>>2];i[f+16>>2]=0,(0|a)!=(0|(f=i[f+8>>2])););f=i[t>>2],a=i[t+4>>2],i[f+4>>2]=a,i[a>>2]=f,j(t),f=i[n+4>>2]}if(t=i[f+16>>2],(0|(a=i[f+8>>2]))!=(0|f))i[t+8>>2]=a,t=i[i[f+4>>2]+12>>2],b=i[t+8>>2],i[i[a+4>>2]+12>>2]=t,i[i[b+4>>2]+12>>2]=f,i[f+8>>2]=b,i[t+8>>2]=a;else{for(f=a=i[t+8>>2];i[f+16>>2]=0,(0|a)!=(0|(f=i[f+8>>2])););f=i[t>>2],a=i[t+4>>2],i[f+4>>2]=a,i[a>>2]=f,j(t),f=i[n+4>>2]}t=i[(f=n>>>0>f>>>0?f:n)>>2],a=i[i[f+4>>2]>>2],i[i[t+4>>2]>>2]=a,i[i[a+4>>2]>>2]=t,j(f)}if(f=(0|n)!=(0|r),n=o,!f)break}n=i[e>>2],o=i[e+4>>2],i[n+4>>2]=o,i[o>>2]=n,j(e)}if((0|k)==(0|(e=s)))break}}function z(n,f){var a=0,t=0,e=0,b=0,o=0,k=0;if((0|(n|=0))!=(0|(f|=0))){if((0|(t=i[f+16>>2]))!=(0|(o=i[n+16>>2]))){for(a=e=i[t+8>>2];i[a+16>>2]=o,(0|e)!=(0|(a=i[a+8>>2])););a=i[t>>2],e=i[t+4>>2],i[a+4>>2]=e,i[e>>2]=a,j(t)}if((0|(k=i[n+20>>2]))!=(0|(e=i[f+20>>2]))){for(a=b=i[e+8>>2];i[a+20>>2]=k,(0|b)!=(0|(a=i[a+12>>2])););a=i[e>>2],b=i[e+4>>2],i[a+4>>2]=b,i[b>>2]=a,j(e)}if(a=i[n+8>>2],b=i[f+8>>2],i[i[b+4>>2]+12>>2]=n,i[i[a+4>>2]+12>>2]=f,i[f+8>>2]=a,i[n+8>>2]=b,(0|t)==(0|o)){if(!(t=H(40)))return 0;for(a=i[n+16>>2],o=i[a+4>>2],i[t+4>>2]=o,i[o>>2]=t,i[t>>2]=a,i[a+4>>2]=t,i[t+12>>2]=0,i[t+8>>2]=f,a=f;i[a+16>>2]=t,(0|(a=i[a+8>>2]))!=(0|f););i[i[n+16>>2]+8>>2]=n}if((0|e)==(0|k)){if(!(t=H(24)))return 0;for(a=i[n+20>>2],e=i[a+4>>2],i[t+4>>2]=e,i[e>>2]=t,i[t>>2]=a,i[a+4>>2]=t,i[t+12>>2]=0,i[t+16>>2]=0,i[t+8>>2]=f,p[t+20|0]=0,p[t+21|0]=w[a+21|0],a=f;i[a+20>>2]=t,(0|(a=i[a+12>>2]))!=(0|f););i[i[n+20>>2]+8>>2]=n}}return 1}function s1(n,f){var a=0,t=0,e=0,b=0,o=0,k=0,r=u(0),s=0,A=0,l=u(0);if(i[n+20>>2]){t=f,a=i[n>>2],n=i[a+8>>2]+1|0,i[a+8>>2]=n;i:{if(!((0|(f=i[a+12>>2]))>=n<<1)){if(i[a+12>>2]=f<<1,e=i[a+4>>2],f=l0(b=i[a>>2],f<<3|4),i[a>>2]=f,!f){i[a>>2]=b,e=2147483647;break i}if(f=l0(i[a+4>>2],8+(i[a+12>>2]<<3)|0),i[a+4>>2]=f,!f){i[a+4>>2]=e,e=2147483647;break i}}if(b=i[a+4>>2],e=n,(f=i[a+16>>2])&&(i[a+16>>2]=i[4+(b+(f<<3)|0)>>2],e=f),o=i[a>>2],i[o+(n<<2)>>2]=e,i[(k=b+(e<<3)|0)>>2]=t,i[k+4>>2]=n,i[a+20>>2]){f:if(n>>>0<2)f=n;else for(r=c[t+28>>2];;){if(a=i[((f=n>>1)<<2)+o>>2],A=i[(s=b+(a<<3)|0)>>2],(l=c[A+28>>2])>2]<=c[t+32>>2])|r!=l)){f=n;break f}if(i[(n<<2)+o>>2]=a,i[s+4>>2]=n,!((n=f)>>>0>1))break}i[(f<<2)+o>>2]=e,i[k+4>>2]=f}}return e}if(t=(a=i[n+12>>2])+1|0,i[n+12>>2]=t,e=i[n+4>>2],(0|(b=t))<(0|(t=i[n+16>>2])))t=e;else if(i[n+16>>2]=t<<1,t=l0(e,t<<3),i[n+4>>2]=t,!t)return i[n+4>>2]=e,2147483647;return i[(a<<2)+t>>2]=f,-1^a}function f0(n){n|=0;var f=0,a=0,t=0,e=0,b=0,o=0,k=0;b=H(40),o=H(40);i:{if(!(t=H(24))||!b|!o){if(b&&j(b),o&&j(o),!t)break i;return j(t),0}if(!(f=H(64)))return 0;for(a=i[n+68>>2],e=i[(a=a>>>0<(e=n- -64|0)>>>0?a:e)+4>>2],k=i[e>>2],i[f+32>>2]=k,i[i[k+4>>2]>>2]=f,i[f>>2]=a,a=e,e=f+32|0,i[a>>2]=e,i[f+16>>2]=0,i[f+20>>2]=0,i[f+12>>2]=e,i[f+4>>2]=e,i[f+24>>2]=0,i[f+28>>2]=0,i[f+48>>2]=0,i[f+52>>2]=0,i[f+44>>2]=f,i[f+40>>2]=e,i[f+36>>2]=f,i[f+56>>2]=0,i[f+60>>2]=0,i[f+8>>2]=f,a=i[n+4>>2],i[b+4>>2]=a,i[a>>2]=b,i[b+12>>2]=0,i[b+8>>2]=f,a=f;i[a+16>>2]=b,(0|(a=i[a+8>>2]))!=(0|f););for(i[o+4>>2]=b,i[b>>2]=o,i[o>>2]=n,i[n+4>>2]=o,i[o+12>>2]=0,i[o+8>>2]=e,a=e;i[a+16>>2]=o,(0|e)!=(0|(a=i[a+8>>2])););for(a=i[n+44>>2],i[t+4>>2]=a,i[a>>2]=t,i[t>>2]=n+40,i[n+44>>2]=t,i[t+12>>2]=0,i[t+16>>2]=0,i[t+8>>2]=f,p[t+20|0]=0,p[t+21|0]=w[n+61|0],a=f;i[a+20>>2]=t,(0|(a=i[a+12>>2]))!=(0|f););}return 0|f}function R0(n,f){var a=0,t=0,e=0,b=0,o=0,k=0;i[n+8>>2]=i[283],a=i[282],i[n>>2]=i[281],i[n+4>>2]=a,a=i[f+20>>2];i:if(w[a+21|0]){e=f;f:{a:{for(;;){if(w[a+20|0])break i;if(p[a+20|0]=1,i[a+16>>2]=t,e=i[i[e+12>>2]+4>>2],t=i[e+20>>2],w[t+21|0]){if(w[t+20|0])break a;if(p[t+20|0]=1,i[t+16>>2]=a,b=b+2|0,e=i[e+8>>2],a=i[e+20>>2],w[a+21|0])continue;break i}break}b|=1;break f}b|=1}t=a}else e=f;o=i[f+4>>2],a=i[o+20>>2];i:if(!(!w[a+21|0]|w[a+20|0])){f:{a:{for(;;){if(p[a+20|0]=1,i[a+16>>2]=t,f=i[o+12>>2],o=i[f+4>>2],t=i[o+20>>2],w[t+21|0]){if(w[t+20|0])break a;if(p[t+20|0]=1,i[t+16>>2]=a,k=k+2|0,f=i[i[o+8>>2]+4>>2],o=i[f+4>>2],a=i[o+20>>2],!w[a+21|0])break i;if(!w[a+20|0])continue;break i}break}k|=1;break f}k|=1}t=a}a=b+k|0,i[n>>2]=a;i:{if(1&b){if(!(1&k))break i;i[n>>2]=a-1,f=f+8|0}else f=e+4|0;f=i[f>>2]}if(i[n+4>>2]=f,t)for(;p[t+20|0]=0,t=i[t+16>>2];);}function M4(n,f,a){f|=0,a|=0,(0|(a=i[1716+(n|=0)>>2]))==3?M[i[n+88>>2]](5):M[0|a](5,i[n+1896>>2]),(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[f+16>>2]+12>>2]):M[0|a](i[i[f+16>>2]+12>>2],i[n+1896>>2]),(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[i[f+4>>2]+16>>2]+12>>2]):M[0|a](i[i[i[f+4>>2]+16>>2]+12>>2],i[n+1896>>2]),a=i[f+20>>2];i:if(w[a+21|0])for(;;){if(w[a+20|0]||(p[a+20|0]=1,f=i[i[f+12>>2]+4>>2],(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[f+16>>2]+12>>2]):M[0|a](i[i[f+16>>2]+12>>2],i[n+1896>>2]),a=i[f+20>>2],!w[a+21|0]|w[a+20|0]))break i;if(p[a+20|0]=1,f=i[f+8>>2],(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[i[f+4>>2]+16>>2]+12>>2]):M[0|a](i[i[i[f+4>>2]+16>>2]+12>>2],i[n+1896>>2]),a=i[f+20>>2],!w[a+21|0])break}(0|(f=i[n+1728>>2]))==6?M[i[n+100>>2]]():M[0|f](i[n+1896>>2])}function E2(n,f){f|=0;var a=0;if((0|(a=i[(n|=0)>>2]))!=(0|f))for(;;){i:if(f>>>0>a>>>0){f:switch(0|a){case 0:(0|(a=i[n+1732>>2]))==11?M[i[n+12>>2]](100151):M[0|a](100151,i[n+1896>>2]),i[n>>2]&&E2(n,0),i[n+112>>2]=0,a=1,i[n>>2]=1,p[n+108|0]=0,i[n+1896>>2]=0,i[n+8>>2]=0;break i;case 1:break f;default:break i}if((0|(a=i[n+1732>>2]))==11?M[i[n+12>>2]](100152):M[0|a](100152,i[n+1896>>2]),i[n>>2]!=1&&E2(n,1),i[n>>2]=2,i[n+4>>2]=0,a=2,i[n+112>>2]<1)break i;p[n+108|0]=1}else{f:switch(a-1|0){case 1:(0|(a=i[n+1732>>2]))==11?M[i[n+12>>2]](100154):M[0|a](100154,i[n+1896>>2]),i[n>>2]!=2&&E2(n,2),a=1,i[n>>2]=1;break i;case 0:break f;default:break i}(0|(a=i[n+1732>>2]))==11?M[i[n+12>>2]](100153):M[0|a](100153,i[n+1896>>2]),(a=i[n+8>>2])&&_0(a),a=0,i[n+8>>2]=0,i[n>>2]=0,i[n+4>>2]=0}if((0|f)==(0|a))break}}function A1(n,f,a){var t=0,e=0,b=0,o=0,k=0,r=0,s=0,A=0,l=0;i:{f:{a:{n:{t:{b:{e:{c:{u:{o:{if(e=f,f){if(!(t=a))break o;break u}n=(n>>>0)/(a>>>0)|0,v2=0;break i}if(!n)break c;break e}if(!(t-1&t))break b;r=0-(k=(s0(t)+33|0)-s0(e)|0)|0;break n}n=(e>>>0)/0|0,v2=0;break i}if((t=32-s0(e)|0)>>>0<31)break t;break a}if((0|t)==1)break f;a=31&(t=t?31-s0(t-1^t)|0:32),(63&t)>>>0>=32?(e=0,n=f>>>a|0):(e=f>>>a|0,n=((1<>>a),v2=e;break i}k=t+1|0,r=63-t|0}if(t=f,b=31&(e=63&k),e>>>0>=32?(e=0,b=t>>>b|0):(e=t>>>b|0,b=((1<>>b),t=31&(r&=63),r>>>0>=32?(f=n<>>32-t|f<>>31)-(A=a&(o=r-((e=e<<1|b>>>31)+(t>>>0>>0)|0)>>31))|0,e=e-(s>>>0>>0)|0,f=f<<1|n>>>31,n=l|n<<1,l=o&=1,k=k-1|0;);v2=f<<1|n>>>31,n=o|n<<1;break i}n=0,f=0}v2=f}return n}function I4(n,f,a){f|=0,a|=0;var t=0,e=0,b=0,o=0,k=0,r=0,s=0;B=e=B-32|0,b=i[28+(n|=0)>>2],i[e+16>>2]=b,t=i[n+20>>2],i[e+28>>2]=a,i[e+24>>2]=f,f=t-b|0,i[e+20>>2]=f,b=f+a|0,s=2,f=e+16|0;i:{f:{(t=0|e1(i[n+60>>2],e+16|0,2,e+12|0))?(i[613]=t,t=-1):t=0;a:{if(!t)for(;;){if((0|(t=i[e+12>>2]))==(0|b))break a;if((0|t)<=-1)break f;if(o=t-((k=(o=i[f+4>>2])>>>0>>0)?o:0)|0,i[(r=(k<<3)+f|0)>>2]=o+i[r>>2],i[(r=(k?12:4)+f|0)>>2]=i[r>>2]-o,b=b-t|0,f=k?f+8|0:f,s=s-k|0,(t=0|e1(i[n+60>>2],0|f,0|s,e+12|0))?(i[613]=t,t=-1):t=0,t)break}if((0|b)!=-1)break f}f=i[n+44>>2],i[n+28>>2]=f,i[n+20>>2]=f,i[n+16>>2]=f+i[n+48>>2],n=a;break i}i[n+28>>2]=0,i[n+16>>2]=0,i[n+20>>2]=0,i[n>>2]=32|i[n>>2],n=0,(0|s)!=2&&(n=a-i[f+4>>2]|0)}return B=e+32|0,0|n}function l1(n){var f=0,a=0,t=0,e=0,b=0,o=0,k=u(0),r=0,s=u(0),A=0,l=0,v=0,h=0,m=0,g=0;if(e=i[n+4>>2],a=i[n>>2],t=i[a+4>>2],m=i[(f=e+(t<<3)|0)>>2],!((0|(b=i[n+8>>2]))<1)&&(A=i[(b<<2)+a>>2],i[a+4>>2]=A,i[4+(l=(A<<3)+e|0)>>2]=1,i[f>>2]=0,i[f+4>>2]=i[n+16>>2],v=b-1|0,i[n+8>>2]=v,i[n+16>>2]=t,(0|b)!=1)){for(g=(A<<3)+e|0,f=1;(0|v)<=(0|(n=f<<1))||(o=i[(i[((t=1|n)<<2)+a>>2]<<3)+e>>2],k=c[o+28>>2],r=i[(i[(n<<2)+a>>2]<<3)+e>>2],s=c[r+28>>2],!(c[o+32>>2]<=c[r+32>>2])|k!=s&&!(k=(0|b)||(t=i[g>>2],k=c[t+28>>2],o=i[(n<<2)+a>>2],h=i[(r=(o<<3)+e|0)>>2],k<(s=c[h+28>>2])|(c[t+32>>2]<=c[h+32>>2]?k==s:0)));)i[(f<<2)+a>>2]=o,i[r+4>>2]=f,f=n;i[(f<<2)+a>>2]=A,i[l+4>>2]=f}return m}function _4(n,f,a){f|=0,a|=0,(0|(a=i[1716+(n|=0)>>2]))==3?M[i[n+88>>2]](6):M[0|a](6,i[n+1896>>2]),(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[f+16>>2]+12>>2]):M[0|a](i[i[f+16>>2]+12>>2],i[n+1896>>2]),(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[i[f+4>>2]+16>>2]+12>>2]):M[0|a](i[i[i[f+4>>2]+16>>2]+12>>2],i[n+1896>>2]),a=i[f+20>>2];i:if(w[a+21|0])for(;;){if(w[a+20|0])break i;if(p[a+20|0]=1,f=i[f+8>>2],(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[i[f+4>>2]+16>>2]+12>>2]):M[0|a](i[i[i[f+4>>2]+16>>2]+12>>2],i[n+1896>>2]),a=i[f+20>>2],!w[a+21|0])break}(0|(f=i[n+1728>>2]))==6?M[i[n+100>>2]]():M[0|f](i[n+1896>>2])}function v1(n,f,a){var t=0,e=0;if(a&&(p[(t=n+a|0)-1|0]=f,p[0|n]=f,!(a>>>0<3||(p[t-2|0]=f,p[n+1|0]=f,p[t-3|0]=f,p[n+2|0]=f,a>>>0<7||(p[t-4|0]=f,p[n+3|0]=f,a>>>0<9||(t=(t=n)+(n=0-n&3)|0,e=W(255&f,16843009),i[t>>2]=e,i[(f=(n=a-n&-4)+t|0)-4>>2]=e,n>>>0<9||(i[t+8>>2]=e,i[t+4>>2]=e,i[f-8>>2]=e,i[f-12>>2]=e,n>>>0<25||(i[t+24>>2]=e,i[t+20>>2]=e,i[t+16>>2]=e,i[t+12>>2]=e,i[f-16>>2]=e,i[f-20>>2]=e,i[f-24>>2]=e,i[f-28>>2]=e,(a=n-(f=4&t|24)|0)>>>0<32))))))))for(e=x0(e,0,1,1),n=v2,f=f+t|0;i[f+24>>2]=e,t=n,i[f+28>>2]=t,i[f+16>>2]=e,i[f+20>>2]=t,i[f+8>>2]=e,i[f+12>>2]=t,i[f>>2]=e,i[f+4>>2]=t,f=f+32|0,(a=a-32|0)>>>0>31;);}function d1(n,f,a){i:if(!(f>>>0>20)){f:switch(f-9|0){case 0:return f=i[a>>2],i[a>>2]=f+4,void(i[n>>2]=i[f>>2]);case 1:return f=i[a>>2],i[a>>2]=f+4,f=i[f>>2],i[n>>2]=f,void(i[n+4>>2]=f>>31);case 2:return f=i[a>>2],i[a>>2]=f+4,i[n>>2]=i[f>>2],void(i[n+4>>2]=0);case 3:return f=i[a>>2]+7&-8,i[a>>2]=f+8,a=i[f+4>>2],i[n>>2]=i[f>>2],void(i[n+4>>2]=a);case 4:return f=i[a>>2],i[a>>2]=f+4,f=r2[f>>1],i[n>>2]=f,void(i[n+4>>2]=f>>31);case 5:return f=i[a>>2],i[a>>2]=f+4,i[n>>2]=L2[f>>1],void(i[n+4>>2]=0);case 6:return f=i[a>>2],i[a>>2]=f+4,f=p[0|f],i[n>>2]=f,void(i[n+4>>2]=f>>31);case 7:return f=i[a>>2],i[a>>2]=f+4,i[n>>2]=w[0|f],void(i[n+4>>2]=0);case 8:return f=i[a>>2]+7&-8,i[a>>2]=f+8,void(X[n>>3]=X[f>>3]);case 9:break f;default:break i}M[0](n,a)}}function G(n,f,a){var t=u(0),e=u(0),b=0,o=0,k=u(0),r=u(0),s=0,A=u(0),l=u(0);B=o=B+-64|0,s=(t=c[f+28>>2])>(e=c[n+28>>2]);i:{f:{if(!(!(c[n+32>>2]<=c[f+32>>2])|t!=e)||s){if((k=c[a+28>>2])>t|(c[f+32>>2]<=c[a+32>>2]?t==k:0))break i;if(b=1,s)break f}b=0,t==e&&(b=c[n+32>>2]<=c[f+32>>2])}s=b,b=1,(k=c[a+28>>2])>t||(b=0,t==k&&(b=c[f+32>>2]<=c[a+32>>2])),r=c[n+32>>2],A=c[f+32>>2],l=c[a+32>>2],X[o+40>>3]=k,X[o+24>>3]=t,X[o+48>>3]=l,X[o+32>>3]=A,X[o+16>>3]=r,X[o+8>>3]=e,i[o+4>>2]=b,i[o>>2]=s,R1(1092,o),k=c[a+28>>2],e=c[n+28>>2],t=c[f+28>>2]}return r=u(0),B=o- -64|0,e=u(t-e),t=u(k-t),u(e+t)>u(0)&&(r=e,e=c[f+32>>2],r=u(u(r*u(e-c[a+32>>2]))+u(t*u(e-c[n+32>>2])))),r}function a0(n,f,a){var t=0,e=0,b=0,o=0;t=i[f>>2];i:{if((0|f)!=(0|a))for(;;){if(p[f+15|0]=0,o=i[f+4>>2],b=i[i[o+8>>2]>>2],e=i[b>>2],i[e+16>>2]!=i[t+16>>2]){if(!w[b+15|0])return n=w[f+12|0],a=i[t+20>>2],i[a+8>>2]=t,p[a+21|0]=n,i[t+24>>2]=0,h2(o),j(f),t;if(!(e=d2(i[i[t+8>>2]+4>>2],i[e+4>>2]))||!$(i[b>>2]))break i;i[b>>2]=e,p[b+15|0]=0,i[e+24>>2]=b}if(i[t+8>>2]!=(0|e)&&(!z(i[i[e+4>>2]+12>>2],e)||!z(t,e)))break i;if(e=w[f+12|0],t=i[f>>2],o=i[t+20>>2],i[o+8>>2]=t,p[o+21|0]=e,i[t+24>>2]=0,h2(i[f+4>>2]),j(f),t=i[b>>2],(0|a)==(0|(f=b)))break}return t}b2(n+1740|0,1),o2()}function W2(n,f,a){switch(f-100100|0){case 0:return void(i[n+88>>2]=a||15);case 6:return void(i[n+1716>>2]=a||3);case 4:return p[n+80|0]=(0|a)!=0,void(i[n+92>>2]=a||14);case 10:return p[n+80|0]=(0|a)!=0,void(i[n+1720>>2]=a||4);case 1:return void(i[n+96>>2]=a||13);case 7:return void(i[n+1724>>2]=a||5);case 2:return void(i[n+100>>2]=a||12);case 8:return void(i[n+1728>>2]=a||6);case 3:return void(i[n+12>>2]=a||18);case 9:return void(i[n+1732>>2]=a||11);case 5:return void(i[n+76>>2]=a||17);case 11:return void(i[n+1736>>2]=a||8);case 12:return void(i[n+104>>2]=a||16)}(0|(f=i[n+1732>>2]))==11?M[i[n+12>>2]](100900):M[0|f](100900,i[n+1896>>2])}function Z(n,f,a){var t=0,e=0,b=0;if(!(32&w[0|n]))i:{e=f,t=a;f:{if(!(n=i[(f=n)+16>>2])){if(n=w[f+74|0],p[f+74|0]=n-1|n,8&(n=i[f>>2])?(i[f>>2]=32|n,n=-1):(i[f+4>>2]=0,i[f+8>>2]=0,n=i[f+44>>2],i[f+28>>2]=n,i[f+20>>2]=n,i[f+16>>2]=n+i[f+48>>2],n=0),n)break f;n=i[f+16>>2]}if(n-(b=i[f+20>>2])>>>0>>0){M[i[f+36>>2]](f,e,a);break i}a:if(!(p[f+75|0]<0)){for(n=a;;){if(t=n,!n)break a;if(w[e+(n=t-1|0)|0]==10)break}if(M[i[f+36>>2]](f,e,t)>>>0>>0)break f;e=t+e|0,a=a-t|0,b=i[f+20>>2]}c1(b,e,a),i[f+20>>2]=i[f+20>>2]+a}}}function p1(n,f,a,t){var e=0,b=0;B=e=B-208|0,i[e+204>>2]=a,v1(e+160|0,0,40),i[e+200>>2]=i[e+204>>2],(0|C0(0,f,e+200|0,e+80|0,e+160|0,t))<0||(i[n+76>>2],a=i[n>>2],p[n+74|0]<=0&&(i[n>>2]=-33&a),b=32&a,i[n+48>>2]?C0(n,f,e+200|0,e+80|0,e+160|0,t):(i[n+48>>2]=80,i[n+16>>2]=e+80,i[n+28>>2]=e,i[n+20>>2]=e,a=i[n+44>>2],i[n+44>>2]=e,C0(n,f,e+200|0,e+80|0,e+160|0,t),a&&(M[i[n+36>>2]](n,0,0),i[n+48>>2]=0,i[n+44>>2]=a,i[n+28>>2]=0,i[n+16>>2]=0,i[n+20>>2]=0)),i[n>>2]=i[n>>2]|b),B=e+208|0}function S4(n,f){n|=0;var a=0,t=0,e=0;if((0|(a=i[40+(f|=0)>>2]))!=(0|(t=f+40|0)))for(;;){if(w[a+21|0]){for((0|(f=i[n+1716>>2]))==3?M[i[n+88>>2]](2):M[0|f](2,i[n+1896>>2]),f=i[a+8>>2];(0|(e=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[f+16>>2]+12>>2]):M[0|e](i[i[f+16>>2]+12>>2],i[n+1896>>2]),(0|(f=i[f+12>>2]))!=i[a+8>>2];);(0|(f=i[n+1728>>2]))==6?M[i[n+100>>2]]():M[0|f](i[n+1896>>2])}if((0|t)==(0|(a=i[a>>2])))break}}function h1(n,f){if(!n)return 0;i:{f:{if(n){if(f>>>0<=127)break f;if(i[i[493]>>2]){if(f>>>0<=2047){p[n+1|0]=63&f|128,p[0|n]=f>>>6|192,n=2;break i}if(!((-8192&f)!=57344&&f>>>0>=55296)){p[n+2|0]=63&f|128,p[0|n]=f>>>12|224,p[n+1|0]=f>>>6&63|128,n=3;break i}if(f-65536>>>0<=1048575){p[n+3|0]=63&f|128,p[0|n]=f>>>18|240,p[n+2|0]=f>>>6&63|128,p[n+1|0]=f>>>12&63|128,n=4;break i}}else if((-128&f)==57216)break f;i[613]=25,n=-1}else n=1;break i}p[0|n]=f,n=1}return n}function M0(){var n=0,f=0,a=0;return(n=H(128))?(i[n+8>>2]=0,i[n+12>>2]=0,f=n+40|0,i[n+44>>2]=f,i[n+48>>2]=0,i[n+52>>2]=0,i[n+40>>2]=f,r2[n+54>>1]=0,r2[n+56>>1]=0,r2[n+58>>1]=0,r2[n+60>>1]=0,i[n+72>>2]=0,i[n+76>>2]=0,f=n+96|0,i[n+68>>2]=f,a=n- -64|0,i[n+64>>2]=a,i[n+80>>2]=0,i[n+84>>2]=0,i[n+88>>2]=0,i[n+92>>2]=0,i[n+104>>2]=0,i[n+108>>2]=0,i[n+100>>2]=a,i[n+96>>2]=f,i[n+112>>2]=0,i[n+116>>2]=0,i[n+120>>2]=0,i[n+124>>2]=0,i[n>>2]=n,i[n+4>>2]=n,0|n):0}function x4(n,f,a){n|=0,f|=0,a|=0;var t=0,e=0,b=u(0),o=u(0);return a=i[a>>2],t=i[i[a+4>>2]+16>>2],f=i[f>>2],(0|(e=i[i[f+4>>2]+16>>2]))==(0|(n=i[n+72>>2]))?(0|n)==(0|t)?(f=i[f+16>>2],b=c[f+28>>2],a=i[a+16>>2],o=c[a+28>>2],!(!(c[f+32>>2]<=c[a+32>>2])|b!=o)||b=u(0)|0):G(t,n,i[a+16>>2])<=u(0)|0:(f=i[f+16>>2],(0|n)==(0|t)?G(e,n,f)>=u(0)|0:C1(e,n,f)>=C1(i[i[a+4>>2]+16>>2],n,i[a+16>>2])|0)}function I0(n){var f=0,a=0,t=0,e=0,b=0,o=u(0),k=u(0),r=0;if(!(f=i[n+12>>2]))return l1(i[n>>2]);if(b=i[n+8>>2],t=i[i[(b+(f<<2)|0)-4>>2]>>2],a=i[n>>2],i[a+8>>2]&&(e=i[i[a+4>>2]+(i[i[a>>2]+4>>2]<<3)>>2],o=c[e+28>>2],k=c[t+28>>2],!(!(c[e+32>>2]<=c[t+32>>2])|o!=k)||o>2]=a,t;if(e=f<<2,f=r=f-1|0,i[i[(e+b|0)-8>>2]>>2])break}return i[n+12>>2]=r,t}function L4(n,f,a){f|=0,a|=0;var t=0,e=0,b=0,o=0;b=1;i:if((0|(t=i[64+(n|=0)>>2]))!=(0|(e=n- -64|0))){if(o=0-f|0,!a){for(;;)if(n=w[i[t+20>>2]+21|0],i[t+28>>2]=(0|n)==w[i[i[t+4>>2]+20>>2]+21|0]?0:n?f:o,(0|e)==(0|(t=i[t>>2])))break i}for(;;){if(n=i[t>>2],(0|(a=w[i[t+20>>2]+21|0]))==w[i[i[t+4>>2]+20>>2]+21|0]){if(!$(t)){b=0;break i}}else i[t+28>>2]=a?f:o;if((0|e)==(0|(t=n)))break}}return 0|b}function m1(n,f){var a=0,t=0,e=0;(a=H(16))&&(e=f0(i[n+8>>2]))&&(t=i[e+16>>2],c[t+32>>2]=f,i[t+28>>2]=2112929218,t=i[i[e+4>>2]+16>>2],c[t+32>>2]=f,i[t+28>>2]=-34554430,i[n+72>>2]=t,p[a+15|0]=0,p[a+12|0]=0,i[a+8>>2]=0,i[a>>2]=e,p[a+13|0]=1,p[a+14|0]=0,t=a,a=S0(e=i[n+64>>2],e,a),i[t+4>>2]=a,a)||(b2(n+1740|0,1),o2())}function _0(n){var f=0,a=0,t=0;if((0|(f=i[40+(n|=0)>>2]))!=(0|(a=n+40|0)))for(;t=i[f>>2],j(f),(0|a)!=(0|(f=t)););if((0|(f=i[n>>2]))!=(0|n))for(;t=i[f>>2],j(f),(0|(f=t))!=(0|n););if((0|(f=i[n+64>>2]))!=(0|(a=n- -64|0)))for(;t=i[f>>2],j(f),(0|a)!=(0|(f=t)););j(n)}function w1(n){var f=0,a=u(0),t=u(0);if(!(f=i[n+12>>2]))return n=i[n>>2],i[i[n+4>>2]+(i[i[n>>2]+4>>2]<<3)>>2];f=i[i[(i[n+8>>2]+(f<<2)|0)-4>>2]>>2],n=i[n>>2];i:{if(i[n+8>>2]&&(n=i[i[n+4>>2]+(i[i[n>>2]+4>>2]<<3)>>2],(a=c[n+28>>2])<(t=c[f+28>>2])||a==t&&c[n+32>>2]<=c[f+32>>2]))break i;n=f}return n}function P4(n,f,a,t){n|=0,f|=0,a|=0,t|=0,a=0;i:{if(f=i[520]){if(!((a=i[f>>2])>>>0<100001)){f=H(12);break i}}else f=H(1200008),i[f+4>>2]=12,i[f>>2]=0,i[520]=f;i[f>>2]=a+1,f=8+(W(a,12)+f|0)|0}c[f>>2]=c[n>>2],c[f+4>>2]=c[n+4>>2],c[f+8>>2]=c[n+8>>2],i[t>>2]=f}function q2(n,f,a){var t=0,e=0,b=0;if(f>>>0<1)t=n;else for(;t=A1(n,f,10),b=e=v2,e=x0(t,e,10,0),p[0|(a=a-1|0)]=n-e|48,e=f>>>0>9,n=t,f=b,e;);if(t)for(;n=(t>>>0)/10|0,p[0|(a=a-1|0)]=t-W(n,10)|48,f=t>>>0>9,t=n,f;);return a}function g1(n,f,a,t){var e=0,b=0,o=0;if(b=i[610]+1|0,i[610]=b,i[n>>2]=b,t)for(;;){if(!i[(o=(e<<3)+a|0)>>2])return i[o>>2]=b,i[4+(n=(e<<3)+a|0)>>2]=f,i[n+8>>2]=0,K(0|t),a;if((0|(e=e+1|0))==(0|t))break}return e=n,n=t<<1,f=g1(e,f,l0(a,t<<4|8),n),K(0|n),f}function y1(n,f){var a=0,t=0,e=0;if(y0(+n),a=0|l2(1),t=0|l2(0),e=a,(0|(a=a>>>20&2047))!=2047){if(!a)return a=f,n==0?f=0:(n=y1(18446744073709552e3*n,f),f=i[f>>2]+-64|0),i[a>>2]=f,n;i[f>>2]=a-1022,n1(0,0|t),n1(1,-2146435073&e|1071644672),n=+r4()}return n}function C1(n,f,a){var t=u(0),e=u(0),b=u(0),o=u(0),k=u(0);return t=c[f+28>>2],e=u(t-c[n+28>>2]),t=u(c[a+28>>2]-t),(b=u(e+t))>u(0)?(k=c[f+32>>2],o=c[((f=t>e)?n:a)+32>>2],t=u(u(k-o)+u(u((f?e:t)/b)*u(o-c[(f?a:n)+32>>2])))):t=u(0),t}function S0(n,f,a){for(var t=0;f=i[f+8>>2],(t=i[f>>2])&&!(0|M[i[n+16>>2]](i[n+12>>2],t,a)););return(n=H(12))?(i[n>>2]=a,i[n+4>>2]=i[f+4>>2],i[i[f+4>>2]+8>>2]=n,i[n+8>>2]=f,i[f+4>>2]=n,n):0}function x0(n,f,a,t){var e=0,b=0,o=0,k=0,r=0,s=0;return s=W(e=a>>>16|0,b=n>>>16|0),e=(65535&(b=((r=W(o=65535&a,k=65535&n))>>>16|0)+W(b,o)|0))+W(e,k)|0,v2=(W(f,a)+s|0)+W(n,t)+(b>>>16)+(e>>>16)|0,65535&r|e<<16}function i2(n,f,a,t,e){var b=0;if(B=b=B-256|0,!(73728&e|(0|a)<=(0|t))){if(v1(b,255&f,(t=(a=a-t|0)>>>0<256)?a:256),!t)for(;Z(n,b,256),(a=a-256|0)>>>0>255;);Z(n,b,a)}B=b+256|0}function J(n,f,a){var t=0,e=0;i:if(a)for(;;){if(!(e=i[(t<<3)+f>>2]))break i;if((0|n)==(0|e))return i[4+((t<<3)+f|0)>>2];if((0|(t=t+1|0))==(0|a))break}return 0}function T2(n){var f=0,a=0;return(n=(f=i[412])+(a=n+3&-4)|0)>>>0<=f>>>0&&a||n>>>0>M1()<<16>>>0&&!(0|l4(0|n))?(i[613]=48,-1):(i[412]=n,f)}function E1(n){var f=0,a=0,t=0;if(p[i[n>>2]]-48>>>0<10)for(;f=i[n>>2],t=p[0|f],i[n>>2]=f+1,a=(W(a,10)+t|0)-48|0,p[f+1|0]-48>>>0<10;);return a}function B4(n,f){n|=0;var a=0,t=0;(0|(a=i[4+(f|=0)>>2]))>2]&&(t=i[f>>2]+(W(i[f+12>>2],a)<<2)|0,c[t>>2]=c[n>>2],c[t+4>>2]=c[n+4>>2],i[f+4>>2]=a+1)}function j4(n,f){n|=0,f|=0;var a=u(0),t=u(0);if((a=c[n+28>>2])<(t=c[f+28>>2]))n=1;else{if(a!=t)return 0;n=c[n+32>>2]<=c[f+32>>2]}return 0|n}function L0(n){var f=0;(f=i[n>>2])&&(j(i[f+4>>2]),j(i[f>>2]),j(f)),(f=i[n+8>>2])&&j(f),(f=i[n+4>>2])&&j(f),j(n)}function T4(n){n|=0;var f=0;B=f=B-16|0,i[f>>2]=n,B=n=B-16|0,i[n+12>>2]=f,p1(i[288],1078,f,0),B=n+16|0,B=f+16|0}function F4(n,f,a){n|=0,f=i[20+(f|=0)>>2],i[f+16>>2]=i[n+84>>2],i[n+84>>2]=f,p[f+20|0]=1}function h2(n){var f=0;f=i[n+4>>2],i[f+8>>2]=i[n+8>>2],i[i[n+8>>2]+4>>2]=f,j(n)}function R1(n,f){var a=0;B=a=B-16|0,i[a+12>>2]=f,p1(i[288],n,f,43),B=a+16|0}function f2(n){var f=0;return(-1>>>(f=31&n)&-2)<>>n}function b2(n,f){n|=0,f|=0,i[611]||(i[612]=f,i[611]=n),v4()}function U4(n,f){n|=0,f|=0,i[611]||(i[612]=f,i[611]=n)}function O4(n,f,a,t){return v2=0,0}function D4(n,f,a,t,e){}function H4(n,f,a,t){}function Q4(n){return 0}function v0(n,f){}function W4(){return 0|B}function q4(n){B=n|=0}function R2(n){}function P0(){}S=w,a2();var M=x([null,F4,_4,v0,v0,v0,R2,M4,D4,j4,x4,v0,P0,R2,R2,R2,R2,H4,R2,E2,E4,M0,f0,n2,z,b1,b2,g4,L4,R4,S4,C4,r1,_0,B4,R2,P0,P4,T4,R2,Q4,I4,O4,y4]);function M1(){return N.byteLength/65536|0}function z4(n){n|=0;var f=0|M1(),a=f+n|0;if(f=x);)++S;if(S-y>16&&d.subarray&&z0)return z0.decode(d.subarray(y,S));for(var T="";y>10,56320|1023&t2)}}else T+=String.fromCharCode((31&O)<<6|D)}else T+=String.fromCharCode(O)}return T}function F1(d,y){return d?K0(J2,d,y):""}function U1(d,y){return d%y>0&&(d+=y-d%y),d}function Y0(d){G2=d,C.HEAP8=new Int8Array(d),C.HEAP16=new Int16Array(d),C.HEAP32=Z2=new Int32Array(d),C.HEAPU8=J2=new Uint8Array(d),C.HEAPU16=new Uint16Array(d),C.HEAPU32=new Uint32Array(d),C.HEAPF32=new Float32Array(d),C.HEAPF64=new Float64Array(d)}var p2,N0=C.INITIAL_MEMORY||4194304;(V2=C.wasmMemory?C.wasmMemory:new g2.Memory({initial:N0/65536,maximum:32768}))&&(G2=V2.buffer),N0=G2.byteLength,Y0(G2);var V0=[],G0=[],J0=[];function O1(){if(C.preRun)for(typeof C.preRun=="function"&&(C.preRun=[C.preRun]);C.preRun.length;)Q1(C.preRun.shift());m0(V0)}function D1(){m0(G0)}function H1(){if(C.postRun)for(typeof C.postRun=="function"&&(C.postRun=[C.postRun]);C.postRun.length;)q1(C.postRun.shift());m0(J0)}function Q1(d){V0.unshift(d)}function W1(d){G0.unshift(d)}function q1(d){J0.unshift(d)}var M2=0,X2=null;function z1(d){M2++,C.monitorRunDependencies&&C.monitorRunDependencies(M2)}function K1(d){if(M2--,C.monitorRunDependencies&&C.monitorRunDependencies(M2),M2==0&&X2){var y=X2;X2=null,y()}}function $2(d){throw C.onAbort&&C.onAbort(d),D2(d+=""),q0=!0,d="abort("+d+"). Build with -s ASSERTIONS=1 for more info.",new g2.RuntimeError(d)}C.preloadedImages={},C.preloadedAudios={};var e2,Z0="data:application/octet-stream;base64,";function h0(d){return d.startsWith(Z0)}function X0(d){return d.startsWith("file://")}function $0(d){try{if(d==e2&&H2)return new Uint8Array(H2);var y=Q2(d);if(y)return y;if(o0)return o0(d);throw"both async and sync fetching of the wasm failed"}catch(I){$2(I)}}function Y1(){if(!H2&&(Q0||N2)){if(typeof fetch=="function"&&!X0(e2))return fetch(e2,{credentials:"same-origin"}).then(function(d){if(!d.ok)throw"failed to load wasm binary file at '"+e2+"'";return d.arrayBuffer()}).catch(function(){return $0(e2)});if(e0)return new Promise(function(d,y){e0(e2,function(I){d(new Uint8Array(I))},y)})}return Promise.resolve().then(function(){return $0(e2)})}function N1(){var d={a:i1};function y(T,O){var D=T.exports;C.asm=D,p2=C.asm.q,W1(C.asm.n),K1()}function I(T){y(T.instance)}function x(T){return Y1().then(function(O){return g2.instantiate(O,d)}).then(T,function(O){D2("failed to asynchronously prepare wasm: "+O),$2(O)})}function S(){return H2||typeof g2.instantiateStreaming!="function"||h0(e2)||X0(e2)||typeof fetch!="function"?x(I):fetch(e2,{credentials:"same-origin"}).then(function(T){return g2.instantiateStreaming(T,d).then(I,function(O){return D2("wasm streaming compile failed: "+O),D2("falling back to ArrayBuffer instantiation"),x(I)})})}if(z1(),C.instantiateWasm)try{return C.instantiateWasm(d,y)}catch(T){return D2("Module.instantiateWasm callback failed with error: "+T),!1}return S(),{}}function m0(d){for(;d.length>0;){var y=d.shift();if(typeof y!="function"){var I=y.func;typeof I=="number"?y.arg===void 0?p2.get(I)():p2.get(I)(y.arg):I(y.arg===void 0?null:y.arg)}else y(C)}}function V1(){throw"longjmp"}function G1(d,y,I){J2.copyWithin(d,y,y+I)}function J1(d){try{return V2.grow(d-G2.byteLength+65535>>>16),Y0(V2.buffer),1}catch{}}function Z1(d){var y=J2.length,I=2147483648;if((d>>>=0)>I)return!1;for(var x=1;x<=4;x*=2){var S=y*(1+.2/x);if(S=Math.min(S,d+100663296),J1(Math.min(I,U1(Math.max(d,S),65536))))return!0}return!1}h0(e2="libtess-asm.wasm")||(e2=L1(e2));var b0={mappings:{},buffers:[null,[],[]],printChar:function(d,y){var I=b0.buffers[d];y===0||y===10?((d===1?P1:D2)(K0(I,0)),I.length=0):I.push(y)},varargs:void 0,get:function(){return b0.varargs+=4,Z2[b0.varargs-4>>2]},getStr:function(d){return F1(d)},get64:function(d,y){return d}};function X1(d,y,I,x){for(var S=0,T=0;T>2],D=Z2[y+(8*T+4)>>2],a2=0;a2>2]=S,0}function $1(d){for(var y=[],I=0;I255&&(x&=255),y.push(String.fromCharCode(x))}return y.join("")}var i4=typeof atob=="function"?atob:function(d){var y,I,x,S,T,O,D="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a2="",t2=0;d=d.replace(/[^A-Za-z0-9\+\/\=]/g,"");do y=D.indexOf(d.charAt(t2++))<<2|(S=D.indexOf(d.charAt(t2++)))>>4,I=(15&S)<<4|(T=D.indexOf(d.charAt(t2++)))>>2,x=(3&T)<<6|(O=D.indexOf(d.charAt(t2++))),a2+=String.fromCharCode(y),T!==64&&(a2+=String.fromCharCode(I)),O!==64&&(a2+=String.fromCharCode(x));while(t20||(O1(),M2>0||(C.setStatus?(C.setStatus("Running..."),setTimeout(function(){setTimeout(function(){C.setStatus("")},1),y()},1)):y()))}if(X2=function d(){k0||w0(),k0||(X2=d)},C.run=w0,C.preInit)for(typeof C.preInit=="function"&&(C.preInit=[C.preInit]);C.preInit.length>0;)C.preInit.pop()();w0();let g0=null,y2=null,x2=null,u0=null;const s2=u2.Module,u4=2,f1=4e3;let a1=0;const c4=(d,y,I)=>{g0||(g0=s2._triangulate);let x=s2.HEAPF32;const S=s2.HEAP32.BYTES_PER_ELEMENT,T=2,O=x.BYTES_PER_ELEMENT;I>a1&&(a1=I,x2&&(s2._free(x2),x2=0),y2&&(s2._free(y2),y2=0)),x2||(x2=s2._malloc(I*O)),u0||(u0=s2._malloc(f1*S));const D=I*u4;y2||(y2=s2._malloc(D*O)),x=s2.HEAPF32,x.set(d,x2/O),s2.HEAP32.set(y,u0/S);const a2=D/T,t2=g0(x2,u0,Math.min(y.length,f1),T,y2,a2),c0=t2*T;x=s2.HEAPF32;const r0=x.slice(y2/O,y2/O+c0),l2={};return l2.buffer=r0,l2.vertexCount=t2,l2};return u2.triangulate=c4,u2.whenLoaded()}return{load:z2}},(_1=I1())!==void 0&&(D0.exports=_1);var S1=H0.exports;const V4=Y4({__proto__:null,default:K4(S1)},[S1]);export{V4 as l}; +import{aR as K4}from"./index-pCX-0tJH.js";function Y4(z2,t0){for(var K2=0;K2u2[C]})}}}return Object.freeze(Object.defineProperty(z2,Symbol.toStringTag,{value:"Module"}))}var D0,I1,_1,H0={exports:{}};H0.exports,D0=H0,I1=function(){function z2(t0){const K2=t0.locateFile,u2={};var C=C!==void 0?C:{};const F2=(()=>{let d;return{resolve:g=>d(g),promise:new Promise(g=>d=g)}})(),x1=()=>F2.promise;C.locateFile=K2,C.onRuntimeInitialized=()=>{F2.resolve(u2)},u2.Module=C,u2.whenLoaded=x1;var w2,Y2={};for(w2 in C)C.hasOwnProperty(w2)&&(Y2[w2]=C[w2]);var d0,e0,o0,U2,O2,Q0=typeof window=="object",N2=typeof importScripts=="function",p0=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",A2="";function L1(d){return C.locateFile?C.locateFile(d,A2):A2+d}p0?(A2=N2?require("path").dirname(A2)+"/":__dirname+"/",d0=function(d,g){var I=Q2(d);return I?g?I:I.toString():(U2||(U2=require("fs")),O2||(O2=require("path")),d=O2.normalize(d),U2.readFileSync(d,g?null:"utf8"))},o0=function(d){var g=d0(d,!0);return g.buffer||(g=new Uint8Array(g)),T1(g.buffer),g},e0=function(d,g,I){var x=Q2(d);x&&g(x),U2||(U2=require("fs")),O2||(O2=require("path")),d=O2.normalize(d),U2.readFile(d,function(S,T){S?I(S):g(T.buffer)})},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),D0.exports=C,process.on("uncaughtException",function(d){if(!(d instanceof k4))throw d}),process.on("unhandledRejection",$2),C.inspect=function(){return"[Emscripten Module object]"}):(Q0||N2)&&(N2?A2=self.location.href:typeof document<"u"&&document.currentScript&&(A2=document.currentScript.src),A2=A2.indexOf("blob:")!==0?A2.substr(0,A2.lastIndexOf("/")+1):"",d0=function(d){try{var g=new XMLHttpRequest;return g.open("GET",d,!1),g.send(null),g.responseText}catch(x){var I=Q2(d);if(I)return $1(I);throw x}},N2&&(o0=function(d){try{var g=new XMLHttpRequest;return g.open("GET",d,!1),g.responseType="arraybuffer",g.send(null),new Uint8Array(g.response)}catch(x){var I=Q2(d);if(I)return I;throw x}}),e0=function(d,g,I){var x=new XMLHttpRequest;x.open("GET",d,!0),x.responseType="arraybuffer",x.onload=function(){if(x.status==200||x.status==0&&x.response)g(x.response);else{var S=Q2(d);S?g(S.buffer):I()}},x.onerror=I,x.send(null)});var P1=C.print||console.log.bind(console),D2=C.printErr||console.warn.bind(console);for(w2 in Y2)Y2.hasOwnProperty(w2)&&(C[w2]=Y2[w2]);Y2=null,C.arguments&&C.arguments,C.thisProgram&&C.thisProgram,C.quit&&C.quit;var H2,W0=0,B1=function(d){W0=d},j1=function(){return W0};C.wasmBinary&&(H2=C.wasmBinary),C.noExitRuntime;var V2,y2={Memory:function(d){this.buffer=new ArrayBuffer(65536*d.initial)},Module:function(d){},Instance:function(d,g){this.exports=function(I){function x(Q){return Q.set=function(c2,N){this[c2]=N},Q.get=function(c2){return this[c2]},Q}for(var S,T=new Uint8Array(123),O=25;O>=0;--O)T[48+O]=52+O,T[65+O]=O,T[97+O]=26+O;function D(Q,c2,N){for(var p,r2,i=0,w=c2,L2=N.length,P2=c2+(3*L2>>2)-(N[L2-2]=="=")-(N[L2-1]=="=");i>4,w>2),w>>0<=244){if(3&(f=(b=i[614])>>>(a=(r=n>>>0<11?16:n+11&-8)>>>3|0)|0)){n=(e=i[2504+(f=(t=a+(1&(-1^f))|0)<<3)>>2])+8|0,(0|(a=i[e+8>>2]))!=(0|(f=f+2496|0))?(i[a+12>>2]=f,i[f+8>>2]=a):(h=2456,m=f2(t)&b,i[h>>2]=m),f=t<<3,i[e+4>>2]=3|f,i[4+(f=f+e|0)>>2]=1|i[f+4>>2];break i}if((A=i[616])>>>0>=r>>>0)break s;if(f){a=n=(f=(0-(n=(0-(n=2<>>12&16,a|=n=(f=f>>>n|0)>>>5&8,a|=n=(f=f>>>n|0)>>>2&4,o=i[2504+(n=(a=((a|=n=(f=f>>>n|0)>>>1&2)|(n=(f=f>>>n|0)>>>1&1))+(f>>>n|0)|0)<<3)>>2],(0|(f=i[o+8>>2]))!=(0|(n=n+2496|0))?(i[f+12>>2]=n,i[n+8>>2]=f):(b=f2(a)&b,i[614]=b),n=o+8|0,i[o+4>>2]=3|r,e=(f=a<<3)-r|0,i[4+(t=o+r|0)>>2]=1|e,i[f+o>>2]=e,A&&(a=2496+((f=A>>>3|0)<<3)|0,o=i[619],(f=1<>2]:(i[614]=f|b,f=a),i[a+8>>2]=o,i[f+12>>2]=o,i[o+12>>2]=a,i[o+8>>2]=f),i[619]=t,i[616]=e;break i}if(!(k=i[615]))break s;for(a=n=(f=(k&0-k)-1|0)>>>12&16,a|=n=(f=f>>>n|0)>>>5&8,a|=n=(f=f>>>n|0)>>>2&4,f=i[2760+(((a|=n=(f=f>>>n|0)>>>1&2)|(n=(f=f>>>n|0)>>>1&1))+(f>>>n|0)<<2)>>2],t=(-8&i[f+4>>2])-r|0,a=f;(n=i[a+16>>2])||(n=i[a+20>>2]);)t=(e=(a=(-8&i[n+4>>2])-r|0)>>>0>>0)?a:t,f=e?n:f,a=n;if((s=f+r|0)>>>0<=f>>>0)break A;if(l=i[f+24>>2],(0|(e=i[f+12>>2]))!=(0|f)){n=i[f+8>>2],i[n+12>>2]=e,i[e+8>>2]=n;break f}if(!(n=i[(a=f+20|0)>>2])){if(!(n=i[f+16>>2]))break o;a=f+16|0}for(;o=a,e=n,(n=i[(a=n+20|0)>>2])||(a=e+16|0,n=i[e+16>>2]););i[o>>2]=0;break f}if(r=-1,!(n>>>0>4294967231)&&(r=-8&(n=n+11|0),s=i[615])){t=0-r|0,b=0,r>>>0<256||(b=31,r>>>0>16777215||(n=n>>>8|0,n<<=o=n+1048320>>>16&8,b=28+((n=((n<<=a=n+520192>>>16&4)<<(f=n+245760>>>16&2)>>>15|0)-(f|a|o)|0)<<1|r>>>n+21&1)|0));k:{r:{if(a=i[2760+(b<<2)>>2])for(n=0,f=r<<((0|b)==31?0:25-(b>>>1|0)|0);;){if(!((o=(-8&i[a+4>>2])-r|0)>>>0>=t>>>0||(e=a,t=o))){t=0,n=a;break r}if(o=i[a+20>>2],a=i[16+((f>>>29&4)+a|0)>>2],n=o?(0|o)==(0|a)?n:o:n,f<<=1,!a)break}else n=0;if(!(n|e)){if(e=0,!(n=(0-(n=2<>>12&16,a|=n=(f=f>>>n|0)>>>5&8,a|=n=(f=f>>>n|0)>>>2&4,n=i[2760+(((a|=n=(f=f>>>n|0)>>>1&2)|(n=(f=f>>>n|0)>>>1&1))+(f>>>n|0)<<2)>>2]}if(!n)break k}for(;t=(a=(f=(-8&i[n+4>>2])-r|0)>>>0>>0)?f:t,e=a?n:e,n=(f=i[n+16>>2])||i[n+20>>2];);}if(!(!e|i[616]-r>>>0<=t>>>0)){if((k=e+r|0)>>>0<=e>>>0)break A;if(b=i[e+24>>2],(0|e)!=(0|(f=i[e+12>>2]))){n=i[e+8>>2],i[n+12>>2]=f,i[f+8>>2]=n;break a}if(!(n=i[(a=e+20|0)>>2])){if(!(n=i[e+16>>2]))break u;a=e+16|0}for(;o=a,f=n,(n=i[(a=n+20|0)>>2])||(a=f+16|0,n=i[f+16>>2]););i[o>>2]=0;break a}}}if((a=i[616])>>>0>=r>>>0){t=i[619],(f=a-r|0)>>>0>=16?(i[616]=f,n=t+r|0,i[619]=n,i[n+4>>2]=1|f,i[a+t>>2]=f,i[t+4>>2]=3|r):(i[619]=0,i[616]=0,i[t+4>>2]=3|a,i[4+(n=a+t|0)>>2]=1|i[n+4>>2]),n=t+8|0;break i}if((k=i[617])>>>0>r>>>0){f=k-r|0,i[617]=f,n=(a=i[620])+r|0,i[620]=n,i[n+4>>2]=1|f,i[a+4>>2]=3|r,n=a+8|0;break i}if(n=0,f=s=r+47|0,i[732]?a=i[734]:(i[735]=-1,i[736]=-1,i[733]=4096,i[734]=4096,i[732]=v+12&-16^1431655768,i[737]=0,i[725]=0,a=4096),(a=(o=f+a|0)&(e=0-a|0))>>>0<=r>>>0||(t=i[724])&&t>>>0<(b=(f=i[722])+a|0)>>>0|f>>>0>=b>>>0)break i;if(4&w[2900])break b;s:{k:{if(t=i[620])for(n=2904;;){if(t>>>0<(f=i[n>>2])+i[n+4>>2]>>>0&&f>>>0<=t>>>0)break k;if(!(n=i[n+8>>2]))break}if((0|(f=T2(0)))==-1||(b=a,(n=(t=i[733])-1|0)&f&&(b=(a-f|0)+(n+f&0-t)|0),b>>>0<=r>>>0|b>>>0>2147483646)||(t=i[724])&&t>>>0<(e=(n=i[722])+b|0)>>>0|n>>>0>=e>>>0)break e;if((0|f)!=(0|(n=T2(b))))break s;break t}if((b=e&o-k)>>>0>2147483646)break e;if((0|(f=T2(b)))==(i[n>>2]+i[n+4>>2]|0))break c;n=f}if(!((0|n)==-1|r+48>>>0<=b>>>0)){if((f=(f=i[734])+(s-b|0)&0-f)>>>0>2147483646){f=n;break t}if((0|T2(f))!=-1){b=f+b|0,f=n;break t}T2(0-b|0);break e}if(f=n,(0|n)!=-1)break t;break e}o2()}e=0;break f}f=0;break a}if((0|f)!=-1)break t}i[725]=4|i[725]}if(a>>>0>2147483646||(0|(f=T2(a)))==-1|(0|(n=T2(0)))==-1|n>>>0<=f>>>0||(b=n-f|0)>>>0<=r+40>>>0)break n}n=i[722]+b|0,i[722]=n,n>>>0>P2[723]&&(i[723]=n);t:{b:{e:{if(o=i[620]){for(n=2904;;){if(((t=i[n>>2])+(a=i[n+4>>2])|0)==(0|f))break e;if(!(n=i[n+8>>2]))break}break b}for((n=i[618])>>>0<=f>>>0&&n||(i[618]=f),n=0,i[727]=b,i[726]=f,i[622]=-1,i[623]=i[732],i[729]=0;a=2496+(t=n<<3)|0,i[t+2504>>2]=a,i[t+2508>>2]=a,(0|(n=n+1|0))!=32;);a=(t=b-40|0)-(n=f+8&7?-8-f&7:0)|0,i[617]=a,n=n+f|0,i[620]=n,i[n+4>>2]=1|a,i[4+(f+t|0)>>2]=40,i[621]=i[736];break t}if(!(8&w[n+12|0]|t>>>0>o>>>0|f>>>0<=o>>>0)){i[n+4>>2]=a+b,a=(n=o+8&7?-8-o&7:0)+o|0,i[620]=a,n=(f=i[617]+b|0)-n|0,i[617]=n,i[a+4>>2]=1|n,i[4+(f+o|0)>>2]=40,i[621]=i[736];break t}}P2[618]>f>>>0&&(i[618]=f),a=f+b|0,n=2904;b:{e:{c:{u:{o:{A:{for(;;){if((0|a)!=i[n>>2]){if(n=i[n+8>>2])continue;break A}break}if(!(8&w[n+12|0]))break o}for(n=2904;;){if((a=i[n>>2])>>>0<=o>>>0&&(e=a+i[n+4>>2]|0)>>>0>o>>>0)break u;n=i[n+8>>2]}}if(i[n>>2]=f,i[n+4>>2]=i[n+4>>2]+b,i[4+(s=(f+8&7?-8-f&7:0)+f|0)>>2]=3|r,a=(b=a+(a+8&7?-8-a&7:0)|0)-(k=r+s|0)|0,(0|o)==(0|b)){i[620]=k,n=i[617]+a|0,i[617]=n,i[k+4>>2]=1|n;break e}if(i[619]==(0|b)){i[619]=k,n=i[616]+a|0,i[616]=n,i[k+4>>2]=1|n,i[n+k>>2]=n;break e}if((3&(n=i[b+4>>2]))==1){o=-8&n;o:if(n>>>0<=255){if(t=i[b+8>>2],n=n>>>3|0,(0|(f=i[b+12>>2]))==(0|t)){h=2456,m=i[614]&f2(n),i[h>>2]=m;break o}i[t+12>>2]=f,i[f+8>>2]=t}else{if(r=i[b+24>>2],(0|b)==(0|(f=i[b+12>>2])))if((t=i[(n=b+20|0)>>2])||(t=i[(n=b+16|0)>>2])){for(;e=n,(t=i[(n=(f=t)+20|0)>>2])||(n=f+16|0,t=i[f+16>>2]););i[e>>2]=0}else f=0;else n=i[b+8>>2],i[n+12>>2]=f,i[f+8>>2]=n;if(r){t=i[b+28>>2];A:{if(i[(n=2760+(t<<2)|0)>>2]==(0|b)){if(i[n>>2]=f,f)break A;h=2460,m=i[615]&f2(t),i[h>>2]=m;break o}if(i[r+(i[r+16>>2]==(0|b)?16:20)>>2]=f,!f)break o}i[f+24>>2]=r,(n=i[b+16>>2])&&(i[f+16>>2]=n,i[n+24>>2]=f),(n=i[b+20>>2])&&(i[f+20>>2]=n,i[n+24>>2]=f)}}b=o+b|0,a=a+o|0}if(i[b+4>>2]=-2&i[b+4>>2],i[k+4>>2]=1|a,i[a+k>>2]=a,a>>>0<=255){f=2496+((n=a>>>3|0)<<3)|0,(a=i[614])&(n=1<>2]:(i[614]=n|a,n=f),i[f+8>>2]=k,i[n+12>>2]=k,i[k+12>>2]=f,i[k+8>>2]=n;break e}if(n=31,a>>>0<=16777215&&(n=a>>>8|0,n<<=e=n+1048320>>>16&8,n=28+((n=((n<<=t=n+520192>>>16&4)<<(f=n+245760>>>16&2)>>>15|0)-(f|t|e)|0)<<1|a>>>n+21&1)|0),i[k+28>>2]=n,i[k+16>>2]=0,i[k+20>>2]=0,e=2760+(n<<2)|0,(t=i[615])&(f=1<>>1|0)|0),f=i[e>>2];;){if(t=f,(-8&i[f+4>>2])==(0|a))break c;if(f=n>>>29|0,n<<=1,!(f=i[16+(e=t+(4&f)|0)>>2]))break}i[e+16>>2]=k,i[k+24>>2]=t}else i[615]=f|t,i[e>>2]=k,i[k+24>>2]=e;i[k+12>>2]=k,i[k+8>>2]=k;break e}for(a=(t=b-40|0)-(n=f+8&7?-8-f&7:0)|0,i[617]=a,n=n+f|0,i[620]=n,i[n+4>>2]=1|a,i[4+(f+t|0)>>2]=40,i[621]=i[736],i[(a=(n=(e+(e-39&7?39-e&7:0)|0)-47|0)>>>0>>0?o:n)+4>>2]=27,n=i[729],i[a+16>>2]=i[728],i[a+20>>2]=n,n=i[727],i[a+8>>2]=i[726],i[a+12>>2]=n,i[728]=a+8,i[727]=b,i[726]=f,i[729]=0,n=a+24|0;i[n+4>>2]=7,f=n+8|0,n=n+4|0,f>>>0>>0;);if((0|a)==(0|o))break t;if(i[a+4>>2]=-2&i[a+4>>2],e=a-o|0,i[o+4>>2]=1|e,i[a>>2]=e,e>>>0<=255){f=2496+((n=e>>>3|0)<<3)|0,(a=i[614])&(n=1<>2]:(i[614]=n|a,n=f),i[f+8>>2]=o,i[n+12>>2]=o,i[o+12>>2]=f,i[o+8>>2]=n;break t}if(n=31,i[o+16>>2]=0,i[o+20>>2]=0,e>>>0<=16777215&&(n=e>>>8|0,n<<=t=n+1048320>>>16&8,n=28+((n=((n<<=a=n+520192>>>16&4)<<(f=n+245760>>>16&2)>>>15|0)-(f|a|t)|0)<<1|e>>>n+21&1)|0),i[o+28>>2]=n,t=2760+(n<<2)|0,(a=i[615])&(f=1<>>1|0)|0),f=i[t>>2];;){if(a=f,(0|e)==(-8&i[f+4>>2]))break b;if(f=n>>>29|0,n<<=1,!(f=i[16+(t=a+(4&f)|0)>>2]))break}i[t+16>>2]=o,i[o+24>>2]=a}else i[615]=f|a,i[t>>2]=o,i[o+24>>2]=t;i[o+12>>2]=o,i[o+8>>2]=o;break t}n=i[t+8>>2],i[n+12>>2]=k,i[t+8>>2]=k,i[k+24>>2]=0,i[k+12>>2]=t,i[k+8>>2]=n}n=s+8|0;break i}n=i[a+8>>2],i[n+12>>2]=o,i[a+8>>2]=o,i[o+24>>2]=0,i[o+12>>2]=a,i[o+8>>2]=n}if(!((n=i[617])>>>0<=r>>>0)){f=n-r|0,i[617]=f,n=(a=i[620])+r|0,i[620]=n,i[n+4>>2]=1|f,i[a+4>>2]=3|r,n=a+8|0;break i}}i[613]=48,n=0;break i}a:if(b){a=i[e+28>>2];n:{if(i[(n=2760+(a<<2)|0)>>2]==(0|e)){if(i[n>>2]=f,f)break n;s=f2(a)&s,i[615]=s;break a}if(i[b+(i[b+16>>2]==(0|e)?16:20)>>2]=f,!f)break a}i[f+24>>2]=b,(n=i[e+16>>2])&&(i[f+16>>2]=n,i[n+24>>2]=f),(n=i[e+20>>2])&&(i[f+20>>2]=n,i[n+24>>2]=f)}a:if(t>>>0<=15)n=t+r|0,i[e+4>>2]=3|n,i[4+(n=n+e|0)>>2]=1|i[n+4>>2];else if(i[e+4>>2]=3|r,i[k+4>>2]=1|t,i[t+k>>2]=t,t>>>0<=255)f=2496+((n=t>>>3|0)<<3)|0,(a=i[614])&(n=1<>2]:(i[614]=n|a,n=f),i[f+8>>2]=k,i[n+12>>2]=k,i[k+12>>2]=f,i[k+8>>2]=n;else{n=31,t>>>0<=16777215&&(n=t>>>8|0,n<<=o=n+1048320>>>16&8,n=28+((n=((n<<=a=n+520192>>>16&4)<<(f=n+245760>>>16&2)>>>15|0)-(f|a|o)|0)<<1|t>>>n+21&1)|0),i[k+28>>2]=n,i[k+16>>2]=0,i[k+20>>2]=0,a=2760+(n<<2)|0;n:{if((f=1<>>1|0)|0),r=i[a>>2];;){if((-8&i[(f=r)+4>>2])==(0|t))break n;if(a=n>>>29|0,n<<=1,!(r=i[16+(a=f+(4&a)|0)>>2]))break}i[a+16>>2]=k,i[k+24>>2]=f}else i[615]=f|s,i[a>>2]=k,i[k+24>>2]=a;i[k+12>>2]=k,i[k+8>>2]=k;break a}n=i[f+8>>2],i[n+12>>2]=k,i[f+8>>2]=k,i[k+24>>2]=0,i[k+12>>2]=f,i[k+8>>2]=n}n=e+8|0;break i}f:if(l){a=i[f+28>>2];a:{if(i[(n=2760+(a<<2)|0)>>2]==(0|f)){if(i[n>>2]=e,e)break a;h=2460,m=f2(a)&k,i[h>>2]=m;break f}if(i[(i[l+16>>2]==(0|f)?16:20)+l>>2]=e,!e)break f}i[e+24>>2]=l,(n=i[f+16>>2])&&(i[e+16>>2]=n,i[n+24>>2]=e),(n=i[f+20>>2])&&(i[e+20>>2]=n,i[n+24>>2]=e)}t>>>0<=15?(n=t+r|0,i[f+4>>2]=3|n,i[4+(n=n+f|0)>>2]=1|i[n+4>>2]):(i[f+4>>2]=3|r,i[s+4>>2]=1|t,i[t+s>>2]=t,A&&(a=2496+((n=A>>>3|0)<<3)|0,e=i[619],(n=1<>2]:(i[614]=n|b,n=a),i[a+8>>2]=e,i[n+12>>2]=e,i[e+12>>2]=a,i[e+8>>2]=n),i[619]=s,i[616]=t),n=f+8|0}return B=v+16|0,0|n}function w4(n,f,a,t,e,b){n|=0,f|=0,a|=0,t|=0,e|=0,b|=0;for(var o=0,k=0,r=0,s=0,A=0,l=u(0),v=0,h=u(0),m=u(0),y=0,E=0,R=0,_=0,L=0,P=0,F=0,U=0;(r=i[2032+(o=k<<2)>>2])&&(i[r>>2]=0),(r=i[2032+(4|o)>>2])&&(i[r>>2]=0),(r=i[2032+(8|o)>>2])&&(i[r>>2]=0),(o=i[2032+(12|o)>>2])&&(i[o>>2]=0),(0|(k=k+4|0))!=100;);if((k=i[608])||(k=H(16),i[608]=k),i[k+8>>2]=b,i[k+4>>2]=0,i[k+12>>2]=t,i[k>>2]=e,(k=i[609])||((e=H(1900))?(i[e+100>>2]=12,i[e+96>>2]=13,i[e+92>>2]=14,i[e+88>>2]=15,r2[e+80>>1]=0,i[e+52>>2]=0,i[e+56>>2]=100130,i[e+16>>2]=0,i[e+20>>2]=0,i[e>>2]=0,i[e+1896>>2]=0,i[e+1736>>2]=8,i[e+1732>>2]=11,i[e+1728>>2]=6,i[e+1724>>2]=5,i[e+1720>>2]=4,i[e+1716>>2]=3,i[e+104>>2]=16,i[e+76>>2]=17,i[e+12>>2]=18,i[e+24>>2]=0):e=0,i[609]=e,W2(e,100107,34),W2(i[609],100100,35),W2(i[609],100102,36),W2(i[609],100105,37),W2(i[609],100103,38),W2(i[609],100104,39),i[i[609]+56>>2]=100130,e=i[609],c[e+16>>2]=0,c[e+24>>2]=1,c[e+20>>2]=0,k=i[609]),e=0,b=i[608],i[k>>2]&&E2(k,0),i[k+112>>2]=0,i[k>>2]=1,p[k+108|0]=0,i[k+1896>>2]=b,i[k+8>>2]=0,(0|a)>0)for(b=0;;){if(y=i[(b<<2)+f>>2],o=i[609],i[o>>2]!=1&&E2(o,1),i[o>>2]=2,i[o+4>>2]=0,i[o+112>>2]>=1&&(p[o+108|0]=1),k=0,(0|y)>0)for(;;){A=E=(W(e+k|0,t)<<2)+n|0,r=i[609],i[r>>2]!=2&&E2(r,2);i:{f:{a:{if(w[r+108|0]){if(o=M0(),i[r+8>>2]=o,!o)break a;if((0|(o=i[r+112>>2]))>=1)for(R=116+(r+(o<<4)|0)|0,s=r+116|0,o=i[r+4>>2];;){U=i[s+12>>2];n:{if(!o){if(!(o=f0(i[r+8>>2])))break a;if(z(o,i[o+4>>2]))break n;break a}if(!n2(o))break a;o=i[o+12>>2]}if(v=i[o+16>>2],i[v+12>>2]=U,c[v+16>>2]=c[s>>2],l=c[s+4>>2],i[v+24>>2]=0,c[v+20>>2]=l,i[o+28>>2]=1,i[i[o+4>>2]+28>>2]=-1,i[r+4>>2]=o,!(R>>>0>(s=s+16|0)>>>0))break}p[r+108|0]=0,i[r+112>>2]=0,i[r+4>>2]=0}s=(L=+(l=(_=+(l=c[A+4>>2]))<-1e37?u(-9999999933815813e21):l))>1e37,v=(F=+(h=(P=+(h=c[A>>2]))<-1e37?u(-9999999933815813e21):h))>1e37,((o=+(m=c[A+8>>2])<-1e37)|(A=+(m=o?u(-9999999933815813e21):m)>1e37)|_<-1e37|L>1e37||F>1e37||P<-1e37)&&((0|(o=i[r+1732>>2]))==11?M[i[r+12>>2]](100155):M[0|o](100155,i[r+1896>>2])),l=s?u(9999999933815813e21):l,h=v?u(9999999933815813e21):h;n:{if(!i[r+8>>2]){if((0|(s=i[r+112>>2]))<=99){c[124+(o=r+(s<<4)|0)>>2]=A?u(9999999933815813e21):m,c[o+120>>2]=l,c[o+116>>2]=h,i[o+128>>2]=E,i[r+112>>2]=s+1;break i}if(o=M0(),i[r+8>>2]=o,!o)break n;if((0|(o=i[r+112>>2]))>=1)for(v=116+(r+(o<<4)|0)|0,s=r+116|0,o=i[r+4>>2];;){R=i[s+12>>2];t:{if(!o){if(!(o=f0(i[r+8>>2])))break n;if(z(o,i[o+4>>2]))break t;break n}if(!n2(o))break n;o=i[o+12>>2]}if(A=i[o+16>>2],i[A+12>>2]=R,c[A+16>>2]=c[s>>2],m=c[s+4>>2],i[A+24>>2]=0,c[A+20>>2]=m,i[o+28>>2]=1,i[i[o+4>>2]+28>>2]=-1,i[r+4>>2]=o,!(v>>>0>(s=s+16|0)>>>0))break}p[r+108|0]=0,i[r+112>>2]=0}t:{b:{if(!(o=i[r+4>>2])){if(!(o=f0(i[r+8>>2])))break t;if(z(o,i[o+4>>2]))break b;break t}if(!n2(o))break t;o=i[o+12>>2]}s=i[o+16>>2],c[s+16>>2]=h,i[s+12>>2]=E,i[s+24>>2]=0,c[s+20>>2]=l,i[o+28>>2]=1,i[i[o+4>>2]+28>>2]=-1,i[r+4>>2]=o;break i}if((0|(o=i[r+1732>>2]))!=11)break f;M[i[r+12>>2]](100902);break i}if((0|(o=i[r+1732>>2]))!=11)break f;M[i[r+12>>2]](100902);break i}if((0|(o=i[r+1732>>2]))==11){M[i[r+12>>2]](100902);break i}}M[0|o](100902,i[r+1896>>2])}if((0|y)==(0|(k=k+1|0)))break}if(o=i[609],i[o>>2]!=2&&E2(o,2),i[o>>2]=1,e=e+y|0,(0|(b=b+1|0))==(0|a))break}a=i[609],n=0,f=H(40),i[f>>2]=0,e=y1(r=a+1740|0,1,f,4),b=0|V();i:{f:{a:{n:{t:{b:for(;;){e:{c:{u:{o:{A:{s:{k:{if(n){if((0|(n=i[a+1732>>2]))!=11){if(f=i[a+1896>>2],i[611]=0,B2(0|n,100902,0|f),n=i[611],i[611]=0,f=-1,!n||!(t=i[612]))break s;if(f=J(i[n>>2],e,b))break k;break t}if(n=i[a+12>>2],i[611]=0,t1(0|n,100902),n=i[611],i[611]=0,f=-1,!n||!(t=i[612]))break o;if(f=J(i[n>>2],e,b))break A;break t}if(i[a>>2]==1)break e;if(i[611]=0,B2(19,0|a,1),n=i[611],i[611]=0,f=-1,!n||!(t=i[612]))break c;if(f=J(i[n>>2],e,b))break u;break t}K(0|t)}if(n=0|V(),(0|f)==1)continue;break i}K(0|t)}if(n=0|V(),(0|f)==1)continue;break i}K(0|t)}if(n=0|V(),(0|f)==1)continue}i[a>>2]=0;e:{c:{u:{if(!i[a+8>>2]){if(!(w[a+80|0]|i[a+104>>2]!=16)){if(i[611]=0,o=0|i0(20,0|a),n=i[611],i[611]=0,f=-1,n&&(t=i[612])){if(!(f=J(i[n>>2],e,b)))break t;K(0|t)}if(n=0|V(),(0|f)==1)continue;if(o){i[a+1896>>2]=0;break i}}if(i[611]=0,t=0|h4(21),n=i[611],i[611]=0,f=-1,n&&(k=i[612])){if(!(f=J(i[n>>2],e,b)))break n;K(0|k)}if(n=0|V(),(0|f)==1)continue;if(i[a+8>>2]=t,!t)break u;if((0|(n=i[a+112>>2]))>=1)for(s=116+(a+(n<<4)|0)|0,t=a+116|0,f=i[a+4>>2];;){y=i[t+12>>2];o:{A:{s:{k:{r:{l:{if(!f){if(n=i[a+8>>2],i[611]=0,f=0|i0(22,0|n),n=i[611],i[611]=0,k=-1,!n||!(o=i[612]))break r;if(k=J(i[n>>2],e,b))break l;break a}if(i[611]=0,A=0|i0(23,0|f),n=i[611],i[611]=0,k=-1,!n||!(o=i[612]))break s;if(k=J(i[n>>2],e,b))break k;break a}K(0|o)}if(n=0|V(),(0|k)!=1)break A;continue b}K(0|o)}if(n=0|V(),(0|k)==1)continue b;if(!A)break u;f=i[f+12>>2];break o}if(!f)break u;if(n=i[f+4>>2],i[611]=0,A=0|p4(24,0|f,0|n),n=i[611],i[611]=0,k=-1,n&&(o=i[612])){if(!(k=J(i[n>>2],e,b)))break a;K(0|o)}if(n=0|V(),(0|k)==1)continue b;if(!A)break u}if(n=i[f+16>>2],i[n+12>>2]=y,c[n+16>>2]=c[t>>2],l=c[t+4>>2],i[n+24>>2]=0,c[n+20>>2]=l,i[f+28>>2]=1,i[i[f+4>>2]+28>>2]=-1,i[a+4>>2]=f,!(s>>>0>(t=t+16|0)>>>0))break}p[a+108|0]=0,i[a+112>>2]=0}if(i[611]=0,b1(a),n=i[611],i[611]=0,f=-1,!n||!(t=i[612]))break e;if(f=J(i[n>>2],e,b))break c;break t}if(i[611]=0,B2(26,0|r,1),f=i[611],i[611]=0,f&&(n=i[612])){if(!J(i[f>>2],e,b))break f;K(0|n)}n=0|V();continue}K(0|t)}if(n=0|V(),(0|f)!=1){if(i[611]=0,o=0|i0(27,0|a),n=i[611],i[611]=0,f=-1,n&&(t=i[612])){if(!(f=J(i[n>>2],e,b)))break t;K(0|t)}if(n=0|V(),(0|f)!=1){e:{c:{u:{o:{A:{s:{k:{r:{l:{v:{d:{if(!o){if(i[611]=0,B2(26,0|r,1),f=i[611],i[611]=0,!f||!(n=i[612]))break v;if(J(i[f>>2],e,b))break d;break f}if(f=i[a+8>>2],w[a+60|0])break s;if(w[a+81|0]){if(i[611]=0,k=0|d4(28,0|f,1,1),n=i[611],i[611]=0,t=-1,!n||!(o=i[612]))break k;if(t=J(i[n>>2],e,b))break l;break a}if(i[611]=0,k=0|i0(29,0|f),n=i[611],i[611]=0,t=-1,!n||!(o=i[612]))break k;if(t=J(i[n>>2],e,b))break r;break a}K(0|n)}n=0|V();continue}K(0|o);break k}K(0|o)}if(n=0|V(),(0|t)==1)continue;k:{r:{l:{v:{d:{p:{h:{if(!k){if(i[611]=0,B2(26,0|r,1),f=i[611],i[611]=0,!f||!(n=i[612]))break p;if(J(i[f>>2],e,b))break h;break f}if(!(i[a+88>>2]!=15|i[a+100>>2]!=12|i[a+96>>2]!=13|i[a+92>>2]!=14||i[a+1716>>2]!=3|i[a+1728>>2]!=6|i[a+1724>>2]!=5||i[a+1720>>2]!=4))break k;if(w[a+81|0]){if(i[611]=0,B2(30,0|a,0|f),n=i[611],i[611]=0,t=-1,!n||!(k=i[612]))break v;if(t=J(i[n>>2],e,b))break d;break n}if(i[611]=0,B2(31,0|a,0|f),n=i[611],i[611]=0,t=-1,!n||!(k=i[612]))break r;if(t=J(i[n>>2],e,b))break l;break n}K(0|n)}n=0|V();continue}K(0|k)}if(n=0|V(),(0|t)==1)continue;break k}K(0|k)}if(n=0|V(),(0|t)==1)continue}if(i[a+104>>2]!=16){if(i[611]=0,r1(f),n=i[611],i[611]=0,t=-1,!n||!(k=i[612]))break o;if(t=J(i[n>>2],e,b))break A;break n}}if(i[611]=0,_0(f),n=i[611],i[611]=0,f=-1,!n||!(t=i[612]))break c;if(f=J(i[n>>2],e,b))break u;break t}K(0|k)}if(n=0|V(),(0|t)!=1)break e;continue}K(0|t)}if(n=0|V(),(0|f)==1)continue;i[a+8>>2]=0,i[a+1896>>2]=0;break i}if(n=i[a+104>>2],i[611]=0,t1(0|n,0|f),n=i[611],i[611]=0,f=-1,n&&(t=i[612])){if(!(f=J(i[n>>2],e,b)))break t;K(0|t)}if(n=0|V(),(0|f)!=1)break}}}i[a+1896>>2]=0,i[a+8>>2]=0;break i}b2(n,t),o2()}b2(n,k),o2()}b2(n,o),o2()}b2(f,n),o2()}return j(e),i[i[608]+4>>2]}function o1(n,f){var a=u(0),t=u(0),e=0,b=u(0),o=u(0),k=0,r=0,s=u(0),A=0,l=0,v=0,h=u(0),m=u(0),y=u(0),E=0,R=0,_=0,L=0,P=0,F=0,U=0,q=0,Y=0,k2=u(0),m2=0,n0=u(0);B=k=B-144|0,Y=i[i[i[f+4>>2]+8>>2]>>2],U=i[Y>>2],_=i[U+16>>2],P=i[i[U+4>>2]+16>>2],F=i[f>>2],L=i[i[F+4>>2]+16>>2],E=i[F+16>>2],G(L,i[n+72>>2],E)>u(0)&&(a=c[L+28>>2],t=c[L+32>>2],e=i[n+72>>2],b=c[e+28>>2],o=c[e+32>>2],s=c[E+28>>2],X[k+40>>3]=c[E+32>>2],X[k+32>>3]=s,X[k+24>>3]=o,X[k+16>>3]=b,X[k+8>>3]=t,X[k>>3]=a,R1(1098,k));i:{f:{a:if((0|E)!=(0|_)&&!((m=(a=c[E+32>>2])<=(t=c[L+32>>2])?a:t)>((t=c[_+32>>2])>=(b=c[P+32>>2])?t:b))){n:{if(!(!(a<=t)|(b=c[E+28>>2])!=(o=c[_+28>>2]))||bu(0)))break n;break a}if(G(L,_,E)>2])<(t=c[E+28>>2])|(c[A+32>>2]<=c[l+32>>2]?a==t:0)?(r=l,l=A):r=A,(a=c[e+28>>2])>(t=c[v+28>>2])|(c[v+32>>2]<=c[e+32>>2]?a==t:0)?(a=t,A=e,e=v):A=v,a>(t=c[l+28>>2])|(c[l+32>>2]<=c[e+32>>2]?a==t:0)?(t=a,v=A,R=e,A=r,e=l):(v=r,R=l),r=k;n:if((o=c[A+28>>2])>t|(c[R+32>>2]<=c[A+32>>2]?t==o:0))if(h=c[v+28>>2],!(c[A+32>>2]<=c[v+32>>2])|o!=h&&!(h>o))if(t=G(e,R,A),a=G(e,v,A),l=u(t-a)>2],s=c[v+28>>2],a=u(u(o+s)*u(.5)),t==u(0))break n;a=u(o+u(u(b/u(b+t))*u(s-o)))}else a=c[v+28>>2],a=u(a+u(u(t/u(b+t))*u(c[R+28>>2]-a)));else{if(a=u(0),s=u(o-t),b=u(t-c[e+28>>2]),(m=u(s+b))>u(0)&&(a=c[((l=b>2],a=u(u(c[R+32>>2]-a)+u(u((l?b:s)/m)*u(a-c[(l?A:e)+32>>2])))),k2=u(-a),m=a,h=u(h-o),(b=u(s+h))>u(0)&&(y=c[((l=s>2],y=u(u(c[A+32>>2]-y)+u(u((l?s:h)/b)*u(y-c[(l?v:R)+32>>2])))),l=u(a+y)>2]=a,(a=c[e+32>>2])<(t=c[A+32>>2])|(c[e+28>>2]<=c[A+28>>2]?a==t:0)?(r=A,A=e):r=e,(t=c[v+32>>2])>(a=c[R+32>>2])|(c[R+28>>2]<=c[v+28>>2]?a==t:0)?(t=a,e=v,v=R):e=R,(a=c[A+32>>2])>2]<=c[v+28>>2]?a==t:0)?(R=e,l=v,e=r,v=A):(R=r,l=A);n:{t:if((o=c[l+32>>2])<(s=c[e+32>>2])|(c[l+28>>2]<=c[e+28>>2]?o==s:0)){if(y=c[R+32>>2],!(!(c[e+28>>2]<=c[R+28>>2])|s!=y)||y>s){if(a=u(0),t=u(0),h=u(s-o),b=u(o-c[v+32>>2]),(m=u(h+b))>u(0)&&(t=c[((r=b>2],t=u(u(c[l+28>>2]-t)+u(u((r?b:h)/m)*u(t-c[(r?e:v)+28>>2])))),n0=u(-t),m=t,y=u(y-s),(b=u(h+y))>u(0)&&(k2=c[e+28>>2],a=c[((e=h>2],a=u(u(k2-a)+u(u((e?h:y)/b)*u(a-c[(e?R:l)+28>>2])))),e=u(t+a)>2]=o+u(h*u(t/u(t+a)));break n}c[k+88>>2]=s+u(u(o-s)*u(a/u(t+a)));break n}if(a=u(0),t=u(0),b=u(s-o),h=c[v+32>>2],m=u(o-h),u(b+m)>u(0)&&(t=c[l+28>>2],t=u(u(m*u(t-c[e+28>>2]))+u(b*u(t-c[v+28>>2])))),m=u(-t),b=t,s=u(s-y),h=u(y-h),u(s+h)>u(0)&&(a=c[R+28>>2],a=u(u(h*u(a-c[e+28>>2]))+u(s*u(a-c[v+28>>2])))),e=u(t-a)>2]=u(o+y)*u(.5);break n}c[k+88>>2]=o+u(u(y-o)*u(t/u(t+a)));break n}c[k+88>>2]=y+u(u(o-y)*u(a/u(t+a)));break n}c[k+88>>2]=u(o+s)*u(.5)}a=c[k+84>>2],r=i[n+72>>2];n:{if(a<(b=c[r+28>>2]))t=c[r+32>>2];else if(a!=b||!((t=c[r+32>>2])>=c[k+88>>2]))break n;c[k+88>>2]=t,c[k+84>>2]=b,a=b}A=e=E,(t=b=c[e+28>>2])<(o=c[_+28>>2])||b==o&&(t=b,A=E,c[e+32>>2]<=c[_+32>>2])||(t=o,A=_),e=A;n:{if(a>t)o=c[e+32>>2];else if(a!=t||!((o=c[e+32>>2])<=c[k+88>>2]))break n;c[k+88>>2]=o,c[k+84>>2]=t,b=c[E+28>>2],a=t}if(c[_+28>>2]!=a|c[k+88>>2]!=c[_+32>>2]&&(c[k+88>>2]!=c[E+32>>2]||a!=b)){n:{a=c[r+28>>2];t:{if(c[L+32>>2]!=c[r+32>>2]||a!=c[L+28>>2]){if(G(L,r,k+56|0)>=u(0))break t;r=i[n+72>>2],a=c[r+28>>2]}if(c[P+32>>2]==c[r+32>>2]&&a==c[P+28>>2]||!(G(P,r,k+56|0)<=u(0)))break n}if((0|(e=i[n+72>>2]))==(0|P)){if(!n2(i[F+4>>2])||!z(i[U+4>>2],F))break i;for(e=i[i[f>>2]+16>>2];f=i[i[i[f+4>>2]+4>>2]>>2],A=i[f>>2],(0|e)==i[A+16>>2];);if(r=f,w[f+15|0]&&(r=0,(e=d2(i[i[i[i[i[f+4>>2]+8>>2]>>2]>>2]+4>>2],i[A+12>>2]))&&$(i[f>>2])&&(i[f>>2]=e,p[f+15|0]=0,i[e+24>>2]=f,r=i[i[i[f+4>>2]+4>>2]>>2])),!r)break i;e=i[i[i[r+4>>2]+8>>2]>>2],f=i[e>>2],a0(n,e,Y),m2=1,j2(n,r,i[i[f+4>>2]+12>>2],f,f,1);break a}if((0|e)==(0|L)){if(!n2(i[U+4>>2])||!z(i[F+12>>2],i[i[U+4>>2]+12>>2]))break i;for(r=i[i[i[f>>2]+4>>2]+16>>2],e=f;e=i[i[i[e+4>>2]+4>>2]>>2],(0|r)==i[i[i[e>>2]+4>>2]+16>>2];);r=i[i[i[i[i[i[e+4>>2]+8>>2]>>2]>>2]+4>>2]+8>>2],i[f>>2]=i[i[U+4>>2]+12>>2],m2=1,j2(n,e,i[a0(n,f,0)+8>>2],i[i[F+4>>2]+8>>2],r,1);break a}if(G(L,e,k+56|0)>=u(0)){if(p[f+14|0]=1,p[i[i[i[f+4>>2]+4>>2]>>2]+14|0]=1,!n2(i[F+4>>2]))break i;r=i[F+16>>2],e=i[n+72>>2],c[r+28>>2]=c[e+28>>2],c[r+32>>2]=c[e+32>>2]}else e=i[n+72>>2];if(!(G(P,e,k+56|0)<=u(0)))break a;if(p[Y+14|0]=1,p[f+14|0]=1,!n2(i[U+4>>2]))break i;f=i[U+16>>2],n=i[n+72>>2],c[f+28>>2]=c[n+28>>2],c[f+32>>2]=c[n+32>>2];break a}if(!n2(i[F+4>>2])||!n2(i[U+4>>2])||!z(i[i[U+4>>2]+12>>2],F))break i;if(e=i[F+16>>2],c[e+28>>2]=c[k+84>>2],c[e+32>>2]=c[k+88>>2],r=s1(i[n+68>>2],e),e=i[F+16>>2],i[e+36>>2]=r,(0|r)==2147483647)break f;i[k+112>>2]=i[E+12>>2],i[k+116>>2]=i[L+12>>2],i[k+120>>2]=i[_+12>>2],i[k+124>>2]=i[P+12>>2],i[e+24>>2]=0,i[e+16>>2]=0,i[e+20>>2]=0,a=c[e+28>>2],m=(t=u(c[L+28>>2]-a))>2],b=u(c[L+32>>2]-t),o=u(m+(b>2]-a))>2]-t),s=u(m+(b>2]=b,o=u(.5*+s/q),c[k+100>>2]=o,s=u(u(u(c[E+16>>2]*b)+u(c[L+16>>2]*o))+u(0)),c[e+16>>2]=s,y=u(u(u(c[E+20>>2]*b)+u(c[L+20>>2]*o))+u(0)),c[e+20>>2]=y,o=u(u(u(c[E+24>>2]*b)+u(c[L+24>>2]*o))+u(0)),c[e+24>>2]=o,m=(b=u(c[_+28>>2]-a))>2]-t),b=u(m+(b>2]-a))>2]-t),a=u(m+(a>2]=a,t=u(.5*+b/q),c[k+108>>2]=t,b=u(s+u(u(c[_+16>>2]*a)+u(c[P+16>>2]*t))),c[e+16>>2]=b,s=u(y+u(u(c[_+20>>2]*a)+u(c[P+20>>2]*t))),c[e+20>>2]=s,a=u(o+u(u(c[_+24>>2]*a)+u(c[P+24>>2]*t))),c[e+24>>2]=a,c[k+140>>2]=a,c[k+136>>2]=s,c[k+132>>2]=b,i[e+12>>2]=0,e=e+12|0,(0|(r=i[n+1736>>2]))==8?M[i[n+76>>2]](k+132|0,k+112|0,k+96|0,e):M[0|r](k+132|0,k+112|0,k+96|0,e,i[n+1896>>2]),i[e>>2]|w[n+60|0]||((0|(e=i[n+1732>>2]))==11?M[i[n+12>>2]](100156):M[0|e](100156,i[n+1896>>2]),p[n+60|0]=1),p[Y+14|0]=1,p[f+14|0]=1,p[i[i[i[f+4>>2]+4>>2]>>2]+14|0]=1}else E0(n,f)}return B=k+144|0,m2}L0(i[n+68>>2]),i[n+68>>2]=0}b2(n+1740|0,1),o2()}function y4(n){n|=0;var f=0,a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=u(0),A=u(0),l=0,v=0,h=0,m=0,y=0,E=0,R=0,_=0,L=0,P=0;B=b=B-48|0,p[n+60|0]=0;i:{if(a=i[n+8>>2],(0|(f=i[a+64>>2]))!=(0|(k=a- -64|0)))for(;;){a=i[f+12>>2],e=i[f>>2],o=i[f+16>>2],t=i[i[f+4>>2]+16>>2];f:{if(!(c[o+28>>2]!=c[t+28>>2]|c[o+32>>2]!=c[t+32>>2]|i[a+12>>2]==(0|f))){i[b+24>>2]=0,i[b+28>>2]=0,i[b+16>>2]=0,i[b+20>>2]=0,t=i[287],i[b+8>>2]=i[286],i[b+12>>2]=t,t=i[285],i[b>>2]=i[284],i[b+4>>2]=t,t=i[a+16>>2],i[b+16>>2]=i[t+12>>2],i[b+20>>2]=i[o+12>>2],c[b+36>>2]=c[t+16>>2],c[b+40>>2]=c[t+20>>2],c[b+44>>2]=c[t+24>>2],i[t+12>>2]=0,t=t+12|0,(0|(o=i[n+1736>>2]))==8?M[i[n+76>>2]](b+36|0,b+16|0,b,t):M[0|o](b+36|0,b+16|0,b,t,i[n+1896>>2]),i[t>>2]||(i[t>>2]=i[b+16>>2]);a:{if(z(a,f)){if(!$(f))break a;t=i[a+12>>2];break f}break i}break i}t=a,a=f}if(i[t+12>>2]==(0|a)){if((0|a)!=(0|t)&&(e=i[e+4>>2]!=(0|t)&&(0|t)!=(0|e)?e:i[e>>2],!$(t))||(f=(0|a)==(0|e)|i[e+4>>2]==(0|a)?i[e>>2]:e,!$(a)))break i}else f=e;if((0|f)==(0|k))break}e=n,(f=H(28))?(t=f,(a=H(28))?(i[a+8>>2]=0,i[a+12>>2]=32,o=H(132),i[a>>2]=o,o?(k=H(264),i[a+4>>2]=k,k?(i[a+24>>2]=9,i[a+16>>2]=0,i[a+20>>2]=0,i[o+4>>2]=1,i[k+8>>2]=0):(j(o),j(a),a=0)):(j(a),a=0)):a=0,i[t>>2]=a,a?(t=H(128),i[f+4>>2]=t,t?(i[f+24>>2]=9,i[f+20>>2]=0,i[f+12>>2]=0,i[f+16>>2]=32):(j(i[a+4>>2]),j(i[a>>2]),j(a),j(f),f=0)):(j(f),f=0)):f=0,h=f,i[e+68>>2]=f;f:if(f){a:{a=i[n+8>>2];n:{if((0|(f=i[a>>2]))!=(0|a))for(;;){if(e=s1(h,f),i[f+36>>2]=e,(0|e)==2147483647)break n;if((0|a)==(0|(f=i[f>>2])))break}if(B=E=B-400|0,e=H(4+(f=(y=i[h+12>>2])<<2)|0),i[h+8>>2]=e,B=E+400|0,e){if(!((o=(f+e|0)-4|0)>>>0>>0)){if(a=i[h+4>>2],t=1+((k=(y<<2)-4|0)>>>2|0)&7)for(f=e;i[f>>2]=a,f=f+4|0,a=a+4|0,t=t-1|0;);else f=e;if(!(k>>>0<28))for(;i[f>>2]=a,i[f+28>>2]=a+28,i[f+24>>2]=a+24,i[f+20>>2]=a+20,i[f+16>>2]=a+16,i[f+12>>2]=a+12,i[f+8>>2]=a+8,i[f+4>>2]=a+4,a=a+32|0,o>>>0>=(f=f+32|0)>>>0;);}for(i[E+4>>2]=o,i[E>>2]=e,R=2016473283,r=1;;){if((l=i[((r<<3)+E|0)-4>>2])>>>0>(k=i[(m<<3)+E>>2])+40>>>0)for(;;){for(R=W(R,1539415821)+1|0,L=i[(f=((R>>>0)%(1+(l-k>>2)>>>0)<<2)+k|0)>>2],i[f>>2]=i[k>>2],i[k>>2]=L,t=l+4|0,a=k-4|0;;){e=t,v=i[a+4>>2],o=a,f=a+4|0,t=i[v>>2],s=c[t+28>>2],_=i[L>>2],r=f;t:if(!(s<(A=c[_+28>>2]))){for(;;){if(a=f,r=f,c[t+32>>2]<=c[_+32>>2]&&s==A)break t;if(f=a+4|0,o=a,v=i[a+4>>2],t=i[v>>2],A>(s=c[t+28>>2]))break}r=f}a=r,r=i[(t=e-4|0)>>2],f=i[r>>2];t:if(!(A<(s=c[f+28>>2])))for(;;){if(!(!(c[_+32>>2]<=c[f+32>>2])|s!=A))break t;if(e=t,r=i[(t=t-4|0)>>2],f=i[r>>2],A<(s=c[f+28>>2]))break}if(i[a>>2]=r,i[t>>2]=v,!(a>>>0>>0))break}if(f=i[a>>2],i[a>>2]=v,i[t>>2]=f,(a-k|0)<(l-t|0)?(f=e,t=l,l=o):(f=k,t=o,k=e),i[4+(a=(m<<3)+E|0)>>2]=t,i[a>>2]=f,m=m+1|0,!(k+40>>>0>>0))break}if(r=m,l>>>0>=(e=k+4|0)>>>0)for(;;){t=i[e>>2],a=f=e;t:if(!(k>>>0>=f>>>0))for(;;){if(o=i[t>>2],s=c[o+28>>2],m=i[(a=f-4|0)>>2],v=i[m>>2],s<(A=c[v+28>>2])){a=f;break t}if(!(!(c[o+32>>2]<=c[v+32>>2])|s!=A)){a=f;break t}if(i[f>>2]=m,!(k>>>0<(f=a)>>>0))break}if(i[a>>2]=t,!(l>>>0>=(e=e+4|0)>>>0))break}if(m=r-1|0,!((0|r)>=1))break}if(i[h+20>>2]=1,i[h+16>>2]=y,h=i[h>>2],(0|(e=i[h+8>>2]))>=1)for(l=i[h+4>>2],k=i[h>>2],a=e;;){for(t=a,r=l+((m=i[k+(a<<2)>>2])<<3)|0,f=a;(0|e)<=(0|(a=f<<1))||(v=i[l+(i[k+((o=1|a)<<2)>>2]<<3)>>2],s=c[v+28>>2],y=i[l+(i[k+(a<<2)>>2]<<3)>>2],A=c[y+28>>2],!(c[v+32>>2]<=c[y+32>>2])|s!=A&&!(s(0|e)||(o=i[r>>2],s=c[o+28>>2],v=i[k+(a<<2)>>2],R=i[(y=l+(v<<3)|0)>>2],s<(A=c[R+28>>2])|(c[o+32>>2]<=c[R+32>>2]?s==A:0)));)i[k+(f<<2)>>2]=v,i[y+4>>2]=f,f=a;if(i[k+(f<<2)>>2]=m,i[r+4>>2]=f,a=t-1|0,!((0|t)>1))break}i[h+20>>2]=1,f=1}else f=0;if(f)break a}L0(i[n+68>>2]),i[n+68>>2]=0;break f}if(a=n- -64|0,(f=H(20))?(i[f+16>>2]=10,i[f+12>>2]=n,i[f>>2]=0,i[f+8>>2]=f,i[f+4>>2]=f):f=0,i[a>>2]=f,!f)break i;if(m1(n,u(-3999999973526325e22)),m1(n,u(3999999973526325e22)),a=I0(i[n+68>>2]))for(;;){a:if(f=w1(i[n+68>>2]))for(;;){if(c[f+28>>2]!=c[a+28>>2]|c[f+32>>2]!=c[a+32>>2])break a;if(e=i[I0(i[n+68>>2])+8>>2],t=i[a+8>>2],i[b+24>>2]=0,i[b+28>>2]=0,i[b+16>>2]=0,i[b+20>>2]=0,f=i[287],i[b+8>>2]=i[286],i[b+12>>2]=f,f=i[285],i[b>>2]=i[284],i[b+4>>2]=f,f=i[t+16>>2],i[b+16>>2]=i[f+12>>2],i[b+20>>2]=i[i[e+16>>2]+12>>2],c[b+36>>2]=c[f+16>>2],c[b+40>>2]=c[f+20>>2],c[b+44>>2]=c[f+24>>2],i[f+12>>2]=0,f=f+12|0,(0|(o=i[n+1736>>2]))==8?M[i[n+76>>2]](b+36|0,b+16|0,b,f):M[0|o](b+36|0,b+16|0,b,f,i[n+1896>>2]),i[f>>2]||(i[f>>2]=i[b+16>>2]),!z(t,e))break i;if(!(f=w1(i[n+68>>2])))break}if(A0(n,a),!(a=I0(i[n+68>>2])))break}if(f=i[i[i[(e=n- -64|0)>>2]+4>>2]>>2],a=i[f>>2],i[n+72>>2]=i[a+16>>2],i[a+24>>2]=0,h2(i[f+4>>2]),j(f),a=i[e>>2],f=i[i[a+4>>2]>>2])for(;i[i[f>>2]+24>>2]=0,h2(i[f+4>>2]),j(f),a=i[e>>2],f=i[i[a+4>>2]>>2];);if((0|a)!=(0|(f=i[a+4>>2])))for(;j(f),(0|a)!=(0|(f=i[f+4>>2])););if(j(a),L0(i[n+68>>2]),P=1,n=i[n+8>>2],(0|(a=i[n+40>>2]))!=(0|(e=n+40|0)))for(;;){if(n=i[a+8>>2],a=i[a>>2],(0|n)==i[i[n+12>>2]+12>>2]&&(f=i[n+8>>2],i[f+28>>2]=i[f+28>>2]+i[n+28>>2],f=i[f+4>>2],i[f+28>>2]=i[f+28>>2]+i[i[n+4>>2]+28>>2],!$(n))){P=0;break f}if((0|a)==(0|e))break}}return B=b+48|0,0|P}b2(n+1740|0,1),o2()}function C0(n,f,a,t,e,b){var o=0,k=0,r=0,s=0,A=0,l=0,v=0,h=0,m=0,y=0,E=0,R=0,_=0,L=0,P=0,F=0,U=0;B=k=B-80|0,i[k+76>>2]=f,P=k+55|0,_=k+56|0,f=0;i:{f:for(;;){(0|m)<0||((2147483647-m|0)<(0|f)?(i[613]=61,m=-1):m=f+m|0);a:{n:{t:{if(A=i[k+76>>2],o=w[0|(f=A)])for(;;){b:{e:if(o&=255){if((0|o)!=37)break b;for(o=f;;){if(w[f+1|0]!=37)break e;if(r=f+2|0,i[k+76>>2]=r,o=o+1|0,l=w[f+2|0],f=r,(0|l)!=37)break}}else o=f;if(f=o-A|0,n&&Z(n,A,f),f)continue f;E=-1,o=1,r=k,f=i[k+76>>2],w[f+2|0]!=36|p[i[k+76>>2]+1|0]-48>>>0>=10||(E=p[f+1|0]-48|0,L=1,o=3),f=o+f|0,i[r+76>>2]=f,y=0;e:if((r=(s=p[0|f])-32|0)>>>0>31)o=f;else if(o=f,75913&(r=1<>2]=o,y|=r,(r=(s=p[f+1|0])-32|0)>>>0>=32)break e;if(f=o,!(75913&(r=1<>2]}else{if(r=k,p[o+1|0]-48>>>0>=10||(f=i[k+76>>2],w[f+2|0]!=36)){if(L)break t;L=0,v=0,n&&(f=i[a>>2],i[a>>2]=f+4,v=i[f>>2]),f=i[k+76>>2]+1|0}else i[((p[f+1|0]<<2)+e|0)-192>>2]=10,v=i[((p[f+1|0]<<3)+t|0)-384>>2],L=1,f=f+3|0;if(i[r+76>>2]=f,(0|v)>-1)break e;v=0-v|0,y|=8192}l=-1;e:if(w[0|f]==46)if(w[f+1|0]!=42)i[k+76>>2]=f+1,l=E1(k+76|0),f=i[k+76>>2];else{if(!(p[f+2|0]-48>>>0>=10)&&(f=i[k+76>>2],w[f+3|0]==36)){i[((p[f+2|0]<<2)+e|0)-192>>2]=10,l=i[((p[f+2|0]<<3)+t|0)-384>>2],f=f+4|0,i[k+76>>2]=f;break e}if(L)break t;n?(f=i[a>>2],i[a>>2]=f+4,l=i[f>>2]):l=0,f=i[k+76>>2]+2|0,i[k+76>>2]=f}for(o=0;;){if(R=o,h=-1,p[0|f]-65>>>0>57)break i;if(s=f+1|0,i[k+76>>2]=s,o=p[0|f],f=s,!((o=w[1103+(o+W(R,58)|0)|0])-1>>>0<8))break}e:{c:{if((0|o)!=19){if(!o)break i;if((0|E)>=0){i[(E<<2)+e>>2]=o,o=i[4+(f=(E<<3)+t|0)>>2],i[k+64>>2]=i[f>>2],i[k+68>>2]=o;break c}if(!n)break a;d1(k- -64|0,o,a),s=i[k+76>>2];break e}if((0|E)>-1)break i}if(f=0,!n)continue f}r=-65537&y,o=8192&y?r:y,h=0,E=1024,y=_;e:{c:{u:{o:{A:{s:{k:{r:{l:{v:{d:{p:{h:{m:{w:{switch(f=p[s-1|0],(f=R&&(15&f)==3?-33&f:f)-88|0){case 11:break e;case 9:case 13:case 14:case 15:break c;case 27:break k;case 12:case 17:break v;case 23:break d;case 0:case 32:break p;case 24:break h;case 22:break m;case 29:break w;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 10:case 16:case 18:case 19:case 20:case 21:case 25:case 26:case 28:case 30:case 31:break n}switch(f-65|0){case 0:case 4:case 5:case 6:break c;case 2:break A;case 1:case 3:break n}if((0|f)==83)break s;break n}s=i[k+64>>2],r=i[k+68>>2],E=1024;break l}f=0;m:switch(255&R){case 0:case 1:case 6:i[i[k+64>>2]>>2]=m;continue f;case 2:o=i[k+64>>2],i[o>>2]=m,i[o+4>>2]=m>>31;continue f;case 3:r2[i[k+64>>2]>>1]=m;continue f;case 4:p[i[k+64>>2]]=m;continue f;case 7:break m;default:continue f}o=i[k+64>>2],i[o>>2]=m,i[o+4>>2]=m>>31;continue f}l=l>>>0>8?l:8,o|=8,f=120}if(A=_,F=32&f,(r=R=i[k+68>>2])|(s=i[k+64>>2]))for(;p[0|(A=A-1|0)]=F|w[1632+(15&s)|0],U=!r&s>>>0>15|(0|r)!=0,R=r,r=r>>>4|0,s=(15&R)<<28|s>>>4,U;);if(!(i[k+64>>2]|i[k+68>>2])|!(8&o))break r;E=1024+(f>>>4|0)|0,h=2;break r}if(f=_,(r=A=i[k+68>>2])|(s=i[k+64>>2]))for(;p[0|(f=f-1|0)]=7&s|48,R=!r&s>>>0>7|(0|r)!=0,A=r,r=r>>>3|0,s=(7&A)<<29|s>>>3,R;);if(A=f,!(8&o))break r;l=(0|(f=_-A|0))<(0|l)?l:f+1|0;break r}r=f=i[k+68>>2],s=i[k+64>>2],(0|f)<-1||(0|f)<=-1?(r=0-(r+((0|s)!=0)|0)|0,s=0-s|0,i[k+64>>2]=s,i[k+68>>2]=r,h=1,E=1024):2048&o?(h=1,E=1025):E=(h=1&o)?1026:1024}A=q2(s,r,_)}if(o=(0|l)>-1?-65537&o:o,r=f=i[k+68>>2],!(l|(0|(s=i[k+64>>2]))!=0|(0|f)!=0)){l=0,A=_;break n}l=(0|(f=!(r|s)+(_-A|0)|0))<(0|l)?l:f;break n}y=(0|(f=l))!=0;k:{r:{l:{v:if(!(!(3&(o=A=(o=i[k+64>>2])||1071))|!f))for(;;){if(!w[0|o])break l;if(y=(0|(f=f-1|0))!=0,!(3&(o=o+1|0)))break v;if(!f)break}if(!y)break r}l:if(!(!w[0|o]|f>>>0<4))for(;;){if((-1^(s=i[o>>2]))&s-16843009&-2139062144)break l;if(o=o+4|0,!((f=f-4|0)>>>0>3))break}if(f)for(;;){if(s=o,!w[0|o])break k;if(o=o+1|0,!(f=f-1|0))break}}s=0}y=s||l+A|0,o=r,l=s?s-A|0:l;break n}if(r=i[k+64>>2],l)break o;f=0,i2(n,32,v,0,o);break u}i[k+12>>2]=0,i[k+8>>2]=i[k+64>>2],i[k+64>>2]=k+8,l=-1,r=k+8|0}f=0;o:{for(;;){if(!(A=i[r>>2]))break o;if(!((s=(0|(A=h1(k+4|0,A)))<0)|A>>>0>l-f>>>0)){if(r=r+4|0,l>>>0>(f=f+A|0)>>>0)continue;break o}break}if(h=-1,s)break i}if(i2(n,32,v,f,o),f)for(r=0,s=i[k+64>>2];;){if(!(A=i[s>>2])||(0|(r=(A=h1(k+4|0,A))+r|0))>(0|f))break u;if(Z(n,k+4|0,A),s=s+4|0,!(f>>>0>r>>>0))break}else f=0}i2(n,32,v,f,8192^o),f=(0|f)<(0|v)?v:f;continue f}f=0|M[0|b](n,X[k+64>>3],v,l,o,f);continue f}p[k+55|0]=i[k+64>>2],l=1,A=P,o=r;break n}r=f+1|0,i[k+76>>2]=r,o=w[f+1|0],f=r}if(h=m,n)break i;if(!L)break a;for(f=1;;){if(n=i[(f<<2)+e>>2]){if(d1((f<<3)+t|0,n,a),h=1,(0|(f=f+1|0))!=10)continue;break i}break}if(h=1,f>>>0>=10)break i;for(;;){if(i[(f<<2)+e>>2])break t;if((0|(f=f+1|0))==10)break}break i}h=-1;break i}i2(n,32,f=(0|(r=(l=(0|(s=y-A|0))>(0|l)?s:l)+h|0))>(0|v)?r:v,r,o),Z(n,E,h),i2(n,48,f,r,65536^o),i2(n,48,l,s,0),Z(n,A,s),i2(n,32,f,r,8192^o);continue}break}h=0}return B=k+80|0,h}function g4(n,f,a,t,e,b){n|=0,f=+f,a|=0,t|=0,e|=0,b|=0;var o=0,k=0,r=0,s=0,A=0,l=0,v=0,h=0,m=0,y=0,E=0,R=0,_=0,L=0,P=0,F=0,U=0,q=0,Y=0,k2=0,m2=0;B=s=B-560|0,i[s+44>>2]=0,g0(+f),o=0|l2(1),l2(0),(0|o)<-1||(0|o)<=-1?(P=1,F=1034,g0(+(f=-f)),o=0|l2(1),l2(0)):2048&e?(P=1,F=1037):(F=(P=1&e)?1040:1035,m2=!P);i:if((2146435072&o)!=2146435072){_=s+16|0;f:{a:{n:{if(f=g1(f,s+44|0),(f+=f)!=0){if(o=i[s+44>>2],i[s+44>>2]=o-1,(0|(U=32|b))!=97)break n;break f}if((0|(U=32|b))==97)break f;A=i[s+44>>2],v=(0|t)<0?6:t;break a}A=o-29|0,i[s+44>>2]=A,f*=268435456,v=(0|t)<0?6:t}for(k=E=(0|A)<0?s+48|0:s+336|0;o=f<4294967296&f>=0?~~f>>>0:0,i[(t=k)>>2]=o,k=k+4|0,(f=1e9*(f-+(o>>>0)))!=0;);if((0|A)<1)t=A,o=k,r=E;else for(r=E,t=A;;){if(R=(0|t)<29?t:29,!(r>>>0>(o=k-4|0)>>>0)){for(t=R,m=0;y=o,h=0,Y=m,m=i[o>>2],l=31&t,(63&t)>>>0>=32?(k2=m<>>32-l,l=m<>>0>(m=Y+l|0)>>>0?h+1|0:h,Y=y,y=x0(m=A1(l=m,h,1e9),v2,1e9,0),i[Y>>2]=l-y,r>>>0<=(o=o-4|0)>>>0;);(t=m)&&(i[(r=r-4|0)>>2]=t)}for(;r>>>0<(o=k)>>>0&&!i[(k=o-4|0)>>2];);if(t=i[s+44>>2]-R|0,i[s+44>>2]=t,k=o,!((0|t)>0))break}if(k=(v+25|0)/9|0,(0|t)<=-1)for(R=k+1|0,q=(0|U)==102;;){m=(0|t)<-9?9:0-t|0;a:if(o>>>0>r>>>0){for(y=1e9>>>m|0,l=-1<>2],i[k>>2]=Y+(t>>>m|0),t=W(y,t&l),(k=k+4|0)>>>0>>0;);if(r=i[r>>2]?r:r+4|0,!t)break a;i[o>>2]=t,o=o+4|0}else r=i[r>>2]?r:r+4|0;if(t=i[s+44>>2]+m|0,i[s+44>>2]=t,o=(0|R)>2?k+(R<<2)|0:o,!((0|t)<0))break}if(k=0,!(o>>>0<=r>>>0||(k=W(E-r>>2,9),t=10,(l=i[r>>2])>>>0<10)))for(;k=k+1|0,l>>>0>=(t=W(t,10))>>>0;);if((0|(t=(v-((0|U)==102?0:k)|0)-((0|U)==103&(0|v)!=0)|0))<(W(o-E>>2,9)-9|0)){if(h=(((l=(0|(y=t+9216|0))/9|0)<<2)+((0|A)<0?s+48|4:s+340|0)|0)-4096|0,t=10,(0|(y=y-W(l,9)|0))<=7)for(;t=W(t,10),(0|(y=y+1|0))!=8;);if(R=(y=i[h>>2])-W(t,l=(y>>>0)/(t>>>0)|0)|0,((0|(A=h+4|0))!=(0|o)||R)&&(f=(0|o)==(0|A)?1:1.5,L=(A=t>>>1|0)>>>0>R>>>0?.5:(0|A)==(0|R)?f:1.5,f=1&l?9007199254740994:9007199254740992,w[0|F]!=45|m2||(L=-L,f=-f),A=y-R|0,i[h>>2]=A,f+L!=f)){if(t=t+A|0,i[h>>2]=t,t>>>0>=1e9)for(;i[h>>2]=0,(h=h-4|0)>>>0>>0&&(i[(r=r-4|0)>>2]=0),t=i[h>>2]+1|0,i[h>>2]=t,t>>>0>999999999;);if(k=W(E-r>>2,9),t=10,!((A=i[r>>2])>>>0<10))for(;k=k+1|0,A>>>0>=(t=W(t,10))>>>0;);}o=(t=h+4|0)>>>0>>0?t:o}for(;l=o,!(A=o>>>0<=r>>>0)&&!i[(o=l-4|0)>>2];);if((0|U)==103){if(v=((t=(0|(o=v||1))>(0|k)&(0|k)>-5)?-1^k:-1)+o|0,b=(t?-1:-2)+b|0,!(m=8&e)){if(o=-9,!A&&(A=i[l-4>>2])&&(y=10,o=0,!((A>>>0)%10|0))){for(;t=o,o=o+1|0,!((A>>>0)%((y=W(y,10))>>>0)|0););o=-1^t}t=W(l-E>>2,9),(-33&b)!=70?(m=0,v=(0|(t=(0|(t=((t+k|0)+o|0)-9|0))>0?t:0))>(0|v)?v:t):(m=0,v=(0|(t=(0|(t=(t+o|0)-9|0))>0?t:0))>(0|v)?v:t)}}else m=8&e;if(R=(v|m)!=0,t=n,A=a,(0|(y=-33&b))==70)b=(0|k)>0?k:0;else{if((_-(o=q2((o=k>>31)+k^o,0,_))|0)<=1)for(;p[0|(o=o-1|0)]=48,(_-o|0)<2;);p[0|(q=o-2|0)]=b,p[o-1|0]=(0|k)<0?45:43,b=_-q|0}i2(t,32,A,h=1+(b+(R+(v+P|0)|0)|0)|0,e),Z(n,F,P),i2(n,48,a,h,65536^e);a:{n:{t:{if((0|y)==70){for(t=s+16|8,k=s+16|9,r=b=r>>>0>E>>>0?E:r;;){o=q2(i[r>>2],0,k);b:if((0|b)==(0|r))(0|o)==(0|k)&&(p[s+24|0]=48,o=t);else{if(s+16>>>0>=o>>>0)break b;for(;p[0|(o=o-1|0)]=48,s+16>>>0>>0;);}if(Z(n,o,k-o|0),!(E>>>0>=(r=r+4|0)>>>0))break}if(o=0,!R)break n;if(Z(n,1069,1),(0|v)<1|r>>>0>=l>>>0)break t;for(;;){if((o=q2(i[r>>2],0,k))>>>0>s+16>>>0)for(;p[0|(o=o-1|0)]=48,s+16>>>0>>0;);if(Z(n,o,(0|v)<9?v:9),o=v-9|0,l>>>0<=(r=r+4|0)>>>0)break n;if(t=(0|v)>9,v=o,!t)break}break n}b:if(!((0|v)<0))for(b=r>>>0>>0?l:r+4|0,A=s+16|9,t=s+16|8,k=r;;){(0|A)==(0|(o=q2(i[k>>2],0,A)))&&(p[s+24|0]=48,o=t);e:if((0|k)==(0|r))Z(n,o,1),o=o+1|0,!m&&(0|v)<=0||Z(n,1069,1);else{if(s+16>>>0>=o>>>0)break e;for(;p[0|(o=o-1|0)]=48,s+16>>>0>>0;);}if(Z(n,l=o,(0|(o=A-o|0))<(0|v)?o:v),v=v-o|0,b>>>0<=(k=k+4|0)>>>0)break b;if(!((0|v)>-1))break}i2(n,48,v+18|0,18,0),Z(n,q,_-q|0);break a}o=v}i2(n,48,o+9|0,9,0)}break i}if(E=(A=32&b)?F+9|0:F,!(t>>>0>11)&&(o=12-t|0)){for(L=8;L*=16,o=o-1|0;);f=w[0|E]!=45?f+L-L:-(L+(-f-L))}for((0|_)==(0|(o=q2((k=(o=i[s+44>>2])>>31)^o+k,0,_)))&&(p[s+15|0]=48,o=s+15|0),v=2|P,k=i[s+44>>2],p[0|(l=o-2|0)]=b+15,p[o-1|0]=(0|k)<0?45:43,o=8&e,r=s+16|0;b=r,m=A,k=A4(f)<2147483648?~~f:-2147483648,p[0|r]=m|w[k+1632|0],f=16*(f-+(0|k)),!(o||(0|t)>0|f!=0)|((r=b+1|0)-(s+16|0)|0)!=1||(p[b+1|0]=46,r=b+2|0),f!=0;);i2(b=n,32,o=a,h=(A=!t|((r-s|0)-18|0)>=(0|t)?(_-(l+(s+16|0)|0)|0)+r|0:2+((t+_|0)-l|0)|0)+v|0,e),Z(n,E,v),i2(n,48,a,h,65536^e),Z(n,s+16|0,t=r-(s+16|0)|0),i2(n,48,A-((b=t)+(t=_-l|0)|0)|0,0,0),Z(n,l,t)}else i2(n,32,a,h=P+3|0,-65537&e),Z(n,F,P),t=32&b,Z(n,f!=f?t?1053:1061:t?1057:1065,3);return i2(n,32,a,h,8192^e),B=s+560|0,0|((0|a)>(0|h)?a:h)}function A0(n,f){var a=0,t=0,e=0,b=0,o=0,k=u(0),r=0,s=u(0),A=0,l=0,v=0;B=o=B+-64|0,i[n+72>>2]=f,a=e=i[f+8>>2];i:{f:{a:{for(;;){if(t=i[a+24>>2])break a;if((0|e)==(0|(a=i[a+8>>2])))break}for(i[o>>2]=i[e+4>>2],e=a=i[n- -64>>2];e=i[e+4>>2],(t=i[e>>2])&&!(0|M[i[a+16>>2]](i[a+12>>2],o,t)););if(t=i[e>>2],e=i[i[i[t+4>>2]+8>>2]>>2],r=i[e>>2],b=i[t>>2],G(i[i[b+4>>2]+16>>2],f,i[b+16>>2])==u(0)){if(k=c[f+28>>2],e=i[t>>2],a=i[e+16>>2],!(k!=c[a+28>>2]|c[a+32>>2]!=c[f+32>>2])){if(t=i[f+8>>2],i[o+40>>2]=0,i[o+44>>2]=0,i[o+32>>2]=0,i[o+36>>2]=0,f=i[287],i[o+24>>2]=i[286],i[o+28>>2]=f,f=i[285],i[o+16>>2]=i[284],i[o+20>>2]=f,i[o+32>>2]=i[a+12>>2],i[o+36>>2]=i[i[t+16>>2]+12>>2],c[o+52>>2]=c[a+16>>2],c[o+56>>2]=c[a+20>>2],c[o+60>>2]=c[a+24>>2],i[a+12>>2]=0,f=a+12|0,(0|(a=i[n+1736>>2]))==8?M[i[n+76>>2]](o+52|0,o+32|0,o+16|0,f):M[0|a](o+52|0,o+32|0,o+16|0,f,i[n+1896>>2]),i[f>>2]||(i[f>>2]=i[o+32>>2]),z(e,t))break f;break i}if(b=i[e+4>>2],a=i[b+16>>2],c[a+32>>2]!=c[f+32>>2]||k!=c[a+28>>2]){if(!n2(b))break i;if(w[t+15|0]){if(!$(i[e+8>>2]))break i;p[t+15|0]=0}if(!z(i[f+8>>2],e))break i;A0(n,f);break f}for(;t=i[i[i[t+4>>2]+4>>2]>>2],(0|a)==i[i[i[t>>2]+4>>2]+16>>2];);if(e=i[i[i[t+4>>2]+8>>2]>>2],r=i[e>>2],b=i[r+4>>2],a=i[b+8>>2],w[e+15|0]){if(i[r+24>>2]=0,h2(i[e+4>>2]),j(e),!$(b))break i;b=i[i[a+4>>2]+12>>2]}if(!z(i[f+8>>2],b))break i;A=i[b+8>>2],b=a,f=a,e=i[i[a+4>>2]+16>>2],k=c[e+28>>2],r=i[a+16>>2],k<(s=c[r+28>>2])|(c[e+32>>2]<=c[r+32>>2]?k==s:0)||(f=0),j2(n,t,A,b,f,1);break f}if(l=w[t+12|0],r=i[r+4>>2],A=i[r+16>>2],k=c[A+28>>2],v=i[i[b+4>>2]+16>>2],a=t,k<(s=c[v+28>>2])||k==s&&(a=t,c[A+32>>2]<=c[v+32>>2])||(a=e),w[a+15|0]||l){n:{if((0|a)==(0|t)){if(e=d2(i[i[f+8>>2]+4>>2],i[b+12>>2]))break n;break i}if(!(e=d2(i[i[r+8>>2]+4>>2],i[f+8>>2])))break i;e=i[e+4>>2]}if(w[a+15|0]){if($(i[a>>2])){i[a>>2]=e,p[a+15|0]=0,i[e+24>>2]=a,A0(n,f);break f}break i}if(!(a=H(16))||(i[a>>2]=e,t=S0(i[n- -64>>2],i[t+4>>2],a),i[a+4>>2]=t,!t))break i;p[a+13|0]=0,p[a+14|0]=0,p[a+15|0]=0,i[e+24>>2]=a,b=i[n+56>>2],e=i[i[a>>2]+28>>2]+i[i[i[t+4>>2]>>2]+8>>2]|0,i[a+8>>2]=e;n:{t:switch(b-100130|0){case 0:t=1&e;break n;case 1:t=(0|e)!=0;break n;case 2:t=(0|e)>0;break n;case 3:t=e>>>31|0;break n;case 4:break t;default:break n}t=e+1>>>0>2}p[a+12|0]=t,A0(n,f);break f}j2(a=n,t,n=i[f+8>>2],n,0,1);break f}for(f=i[i[t>>2]+16>>2];t=i[i[i[t+4>>2]+4>>2]>>2],a=i[t>>2],(0|f)==i[a+16>>2];);if(w[t+15|0]&&(!(f=d2(i[i[i[i[i[t+4>>2]+8>>2]>>2]>>2]+4>>2],i[a+12>>2]))||!$(i[t>>2])||(i[t>>2]=f,p[t+15|0]=0,i[f+24>>2]=t,!(t=i[i[i[t+4>>2]+4>>2]>>2]))))break i;if(f=i[i[i[t+4>>2]+8>>2]>>2],a=i[f>>2],f=a0(n,f,0),(0|a)!=(0|(e=i[f+8>>2])))j2(n,t,e,a,a,1);else{if(e=i[t>>2],A=i[i[i[t+4>>2]+8>>2]>>2],r=i[A>>2],i[i[e+4>>2]+16>>2]!=i[i[r+4>>2]+16>>2]&&o1(n,t),v=1,b=i[n+72>>2],k=c[b+28>>2],l=i[e+16>>2],!(k!=c[l+28>>2]|c[l+32>>2]!=c[b+32>>2])){if(!z(i[i[a+4>>2]+12>>2],e))break i;for(a=i[i[t>>2]+16>>2];t=i[i[i[t+4>>2]+4>>2]>>2],b=i[t>>2],(0|a)==i[b+16>>2];);if(w[t+15|0]&&(!(a=d2(i[i[i[i[i[t+4>>2]+8>>2]>>2]>>2]+4>>2],i[b+12>>2]))||!$(i[t>>2])||(i[t>>2]=a,p[t+15|0]=0,i[a+24>>2]=t,!(t=i[i[i[t+4>>2]+4>>2]>>2]))))break i;b=i[i[i[t+4>>2]+8>>2]>>2],a=i[b>>2],a0(n,b,A),b=i[n+72>>2],k=c[b+28>>2],v=0}a:{if(s=k,l=i[r+16>>2],s!=(k=c[l+28>>2])|c[l+32>>2]!=c[b+32>>2]){if(v)break a}else{if(!z(f,i[i[r+4>>2]+12>>2]))break i;f=a0(n,A,0)}j2(n,t,i[f+8>>2],a,a,1);break f}if(a=i[e+16>>2],s=c[a+28>>2],!(c[l+32>>2]<=c[a+32>>2])|k!=s&&!(s>k)||(e=i[i[r+4>>2]+12>>2]),!(f=d2(i[i[f+8>>2]+4>>2],e)))break i;j2(n,t,f,a=i[f+8>>2],a,0),p[i[i[f+4>>2]+24>>2]+15|0]=1,u1(n,t)}}return void(B=o- -64|0)}b2(n+1740|0,1),o2()}function b1(n){n|=0;var f=0,a=0,t=0,e=u(0),b=u(0),o=0,k=0,r=u(0),s=u(0),A=u(0),l=u(0),v=0,h=u(0),m=0,y=u(0),E=u(0),R=u(0),_=u(0),L=u(0),P=u(0),F=u(0),U=0,q=0,Y=u(0),k2=u(0),m2=0,n0=0,B0=0,j0=0,T0=0,F0=0,U0=0,O0=0;m=i[n+8>>2],f=B-80|0,b=c[n+16>>2],c[f+8>>2]=b,E=c[n+20>>2],c[f+12>>2]=E,R=c[n+24>>2],c[f+16>>2]=R;i:if(m2=b==u(0)&E==u(0)&R==u(0)){if(i[f+76>>2]=-42943038,i[f+68>>2]=-42943038,i[f+72>>2]=-42943038,i[f+64>>2]=2104540610,i[f+56>>2]=2104540610,i[f+60>>2]=2104540610,n0=(0|(v=i[m>>2]))==(0|m))y=u(-19999999867631625e21),r=u(19999999867631625e21),s=u(19999999867631625e21),h=u(-19999999867631625e21),A=u(19999999867631625e21),l=u(-19999999867631625e21);else{for(_=u(19999999867631625e21),L=u(-19999999867631625e21),P=u(-19999999867631625e21),F=u(19999999867631625e21),Y=u(-19999999867631625e21),k2=u(19999999867631625e21),y=u(-19999999867631625e21),r=u(19999999867631625e21),l=u(-19999999867631625e21),A=u(19999999867631625e21),h=u(-19999999867631625e21),s=u(19999999867631625e21),a=v;y=(t=(e=c[a+24>>2])>y)?e:y,L=t?e:L,r=(U=e>2])>l)?e:l,P=o?e:P,A=(q=e>2])>h)?e:h,Y=k?e:Y,B0=k?a:B0,s=(k=e>2])););i[f+20>>2]=j0,c[f+56>>2]=k2,c[f+68>>2]=Y,i[f+32>>2]=B0,c[f+60>>2]=F,i[f+24>>2]=O0,c[f+72>>2]=P,i[f+36>>2]=U0,c[f+64>>2]=_,i[f+28>>2]=F0,c[f+76>>2]=L,i[f+40>>2]=T0}if(a=2,t=(o=u(l-A)>u(h-s))<<2,t=u(y-r)>u(c[t+(f+68|0)>>2]-c[t+(f+56|0)>>2])?2:o,c[(o=t<<2)+(f+56|0)>>2]>=c[o+(f+68|0)>>2])i[f+8>>2]=0,i[f+12>>2]=0;else{if(a=i[(t<<=2)+(f+20|0)>>2],t=i[t+(f+32|0)>>2],L=c[t+16>>2],A=u(c[a+16>>2]-L),c[f+44>>2]=A,P=c[t+20>>2],l=u(c[a+20>>2]-P),c[f+48>>2]=l,F=c[t+24>>2],e=u(c[a+24>>2]-F),c[f+52>>2]=e,!n0){for(_=u(0),a=v;r=u(c[a+20>>2]-P),s=u(c[a+16>>2]-L),y=u(u(A*r)-u(l*s)),h=u(c[a+24>>2]-F),r=u(u(l*h)-u(e*r)),s=u(u(e*s)-u(A*h)),(h=u(u(y*y)+u(u(r*r)+u(s*s))))>_&&(R=y,E=s,_=h,b=r),(0|m)!=(0|(a=i[a>>2])););if(c[f+16>>2]=R,c[f+12>>2]=E,c[f+8>>2]=b,!(_<=u(0)))break i}i[f+16>>2]=0,i[f+8>>2]=0,i[f+12>>2]=0,a=(l(A>2],a=(e(b>2]=1065353216,R=c[f+16>>2],b=c[f+8>>2],E=c[f+12>>2]}else v=i[m>>2];if(t=(E(b>2],a=n+28|0,t=(R(b>2]=0,i[(k=(t+1>>>0)%3<<2)+a>>2]=1065353216,i[(t=(t+2>>>0)%3<<2)+a>>2]=0,i[(a=n+40|0)+o>>2]=0,f=c[o+(f+8|0)>>2]>u(0),c[a+k>>2]=u(f?-0:0),c[a+t>>2]=u(f?1:-1),!(t=(0|m)==(0|v)))for(a=v;f=i[a+20>>2],i[a+28>>2]=i[a+16>>2],i[a+32>>2]=f,(0|m)!=(0|(a=i[a>>2])););if(m2&&(0|(f=i[m+40>>2]))!=(0|(o=m+40|0))){for(b=u(0);;){if(k=i[f+8>>2],i[(a=k)+28>>2]>=1)for(;U=i[a+16>>2],q=i[i[a+4>>2]+16>>2],b=u(b+u(u(c[U+28>>2]-c[q+28>>2])*u(c[U+32>>2]+c[q+32>>2]))),(0|k)!=(0|(a=i[a+12>>2])););if((0|o)==(0|(f=i[f>>2])))break}if(b>2]=-c[v+32>>2],(0|(v=i[v>>2]))!=(0|m););c[n+40>>2]=-c[n+40>>2],c[n+44>>2]=-c[n+44>>2],c[n+48>>2]=-c[n+48>>2]}}}function j(n){var f=0,a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0;i:if(n|=0){b=(t=n-8|0)+(n=-8&(f=i[n-4>>2]))|0;f:if(!(1&f)){if(!(3&f)||(t=t-(f=i[t>>2])|0)>>>0>2]))==3)return i[616]=n,i[b+4>>2]=-2&f,i[t+4>>2]=1|n,void(i[n+t>>2]=n)}else{if(f>>>0<=255){if(e=i[t+8>>2],f=f>>>3|0,(0|(a=i[t+12>>2]))==(0|e)){r=2456,s=i[614]&f2(f),i[r>>2]=s;break f}i[e+12>>2]=a,i[a+8>>2]=e;break f}if(k=i[t+24>>2],(0|t)==(0|(f=i[t+12>>2])))if((a=i[(e=t+20|0)>>2])||(a=i[(e=t+16|0)>>2])){for(;o=e,(a=i[(e=(f=a)+20|0)>>2])||(e=f+16|0,a=i[f+16>>2]););i[o>>2]=0}else f=0;else a=i[t+8>>2],i[a+12>>2]=f,i[f+8>>2]=a;if(!k)break f;e=i[t+28>>2];a:{if(i[(a=2760+(e<<2)|0)>>2]==(0|t)){if(i[a>>2]=f,f)break a;r=2460,s=i[615]&f2(e),i[r>>2]=s;break f}if(i[k+(i[k+16>>2]==(0|t)?16:20)>>2]=f,!f)break f}if(i[f+24>>2]=k,(a=i[t+16>>2])&&(i[f+16>>2]=a,i[a+24>>2]=f),!(a=i[t+20>>2]))break f;i[f+20>>2]=a,i[a+24>>2]=f}}if(!(t>>>0>=b>>>0)&&1&(f=i[b+4>>2])){f:{if(!(2&f)){if(i[620]==(0|b)){if(i[620]=t,n=i[617]+n|0,i[617]=n,i[t+4>>2]=1|n,i[619]!=(0|t))break i;return i[616]=0,void(i[619]=0)}if(i[619]==(0|b))return i[619]=t,n=i[616]+n|0,i[616]=n,i[t+4>>2]=1|n,void(i[n+t>>2]=n);n=(-8&f)+n|0;a:if(f>>>0<=255){if(e=i[b+8>>2],f=f>>>3|0,(0|(a=i[b+12>>2]))==(0|e)){r=2456,s=i[614]&f2(f),i[r>>2]=s;break a}i[e+12>>2]=a,i[a+8>>2]=e}else{if(k=i[b+24>>2],(0|b)==(0|(f=i[b+12>>2])))if((a=i[(e=b+20|0)>>2])||(a=i[(e=b+16|0)>>2])){for(;o=e,(a=i[(e=(f=a)+20|0)>>2])||(e=f+16|0,a=i[f+16>>2]););i[o>>2]=0}else f=0;else a=i[b+8>>2],i[a+12>>2]=f,i[f+8>>2]=a;if(k){e=i[b+28>>2];n:{if(i[(a=2760+(e<<2)|0)>>2]==(0|b)){if(i[a>>2]=f,f)break n;r=2460,s=i[615]&f2(e),i[r>>2]=s;break a}if(i[k+(i[k+16>>2]==(0|b)?16:20)>>2]=f,!f)break a}i[f+24>>2]=k,(a=i[b+16>>2])&&(i[f+16>>2]=a,i[a+24>>2]=f),(a=i[b+20>>2])&&(i[f+20>>2]=a,i[a+24>>2]=f)}}if(i[t+4>>2]=1|n,i[n+t>>2]=n,i[619]!=(0|t))break f;return void(i[616]=n)}i[b+4>>2]=-2&f,i[t+4>>2]=1|n,i[n+t>>2]=n}if(n>>>0<=255)return f=2496+((n=n>>>3|0)<<3)|0,(a=i[614])&(n=1<>2]:(i[614]=n|a,n=f),i[f+8>>2]=t,i[n+12>>2]=t,i[t+12>>2]=f,void(i[t+8>>2]=n);e=31,i[t+16>>2]=0,i[t+20>>2]=0,n>>>0<=16777215&&(f=n>>>8|0,f<<=o=f+1048320>>>16&8,e=28+((f=((f<<=e=f+520192>>>16&4)<<(a=f+245760>>>16&2)>>>15|0)-(a|e|o)|0)<<1|n>>>f+21&1)|0),i[t+28>>2]=e,o=2760+(e<<2)|0;f:{a:{if((a=i[615])&(f=1<>>1|0)|0),f=i[o>>2];;){if(a=f,(-8&i[f+4>>2])==(0|n))break a;if(f=e>>>29|0,e<<=1,!(f=i[16+(o=a+(4&f)|0)>>2]))break}i[o+16>>2]=t,i[t+24>>2]=a}else i[615]=f|a,i[o>>2]=t,i[t+24>>2]=o;i[t+12>>2]=t,i[t+8>>2]=t;break f}n=i[a+8>>2],i[n+12>>2]=t,i[a+8>>2]=t,i[t+24>>2]=0,i[t+12>>2]=a,i[t+8>>2]=n}n=i[622]-1|0,i[622]=n||-1}}}function C4(n,f){f|=0;var a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0,A=0,l=0,v=0,h=0,m=0,y=0,E=0,R=0,_=0;if(B=k=B-16|0,i[84+(n|=0)>>2]=0,(0|(s=i[f+40>>2]))!=(0|(m=f+40|0)))for(f=s;p[f+20|0]=0,(0|m)!=(0|(f=i[f>>2])););if((0|s)!=(0|m)){for(;;){if(!(w[s+20|0]|!w[s+21|0])){if(o=i[s+8>>2],w[n+80|0])f=1,a=1;else{e=0,t=0,f=0,b=i[(a=o)+20>>2];i:if(w[b+21|0])for(;;){if(w[(f=b)+20|0]){f=t;break i}if(p[f+20|0]=1,i[f+16>>2]=t,e=e+1|0,t=f,a=i[a+8>>2],b=i[a+20>>2],!w[b+21|0])break}t=i[o+4>>2],b=i[t+20>>2];i:{f:if(!w[b+21|0]|w[b+20|0]){if(E=o,!f)break i}else for(a=f;;){if(p[(f=b)+20|0]=1,i[f+16>>2]=a,e=e+1|0,E=i[t+12>>2],t=i[E+4>>2],b=i[t+20>>2],!w[b+21|0])break f;if(a=f,w[b+20|0])break}for(;p[f+20|0]=0,f=i[f+16>>2];);}R=(0|e)>1,b=0,a=0,f=0,v=i[o+12>>2],t=i[(r=v)+20>>2];i:if(w[t+21|0])for(;;){if(w[(f=t)+20|0]){f=a;break i}if(p[f+20|0]=1,i[f+16>>2]=a,b=b+1|0,a=f,r=i[r+8>>2],t=i[r+20>>2],!w[t+21|0])break}y=R?e:1,t=i[v+4>>2],e=i[t+20>>2];i:{f:if(!w[e+21|0]|w[e+20|0]){if(!f)break i}else for(a=f;;){if(p[(f=e)+20|0]=1,i[f+16>>2]=a,b=b+1|0,v=i[t+12>>2],t=i[v+4>>2],e=i[t+20>>2],!w[e+21|0])break f;if(a=f,w[e+20|0])break}for(;p[f+20|0]=0,f=i[f+16>>2];);}_=(0|b)>(0|y),e=0,a=0,f=0,h=i[i[o+8>>2]+4>>2],t=i[(r=h)+20>>2];i:if(w[t+21|0])for(;;){if(w[(f=t)+20|0]){f=a;break i}if(p[f+20|0]=1,i[f+16>>2]=a,e=e+1|0,a=f,r=i[r+8>>2],t=i[r+20>>2],!w[t+21|0])break}A=_?b:y,t=i[h+4>>2],b=i[t+20>>2];i:{f:if(!w[b+21|0]|w[b+20|0]){if(!f)break i}else for(a=f;;){if(p[(f=b)+20|0]=1,i[f+16>>2]=a,e=e+1|0,h=i[t+12>>2],t=i[h+4>>2],b=i[t+20>>2],!w[b+21|0])break f;if(a=f,w[b+20|0])break}for(;p[f+20|0]=0,f=i[f+16>>2];);}R0(k,o),r=i[k+8>>2],y=i[k+4>>2],l=i[k>>2],R0(k,i[o+12>>2]),b=i[k+8>>2],t=i[k+4>>2],a=i[k>>2],R0(k,i[i[o+8>>2]+4>>2]),f=e,(0|(f=(l=(0|(f=(A=(0|(f=(e=(0|e)>(0|A))?f:A))<(0|l))?l:f))<(0|a))?a:f))>=(0|(a=i[k>>2]))?(o=l?t:A?y:e?h:_?v:R?E:o,a=l?b:A?r:e||R|_?2:1):(o=i[k+4>>2],f=a,a=i[k+8>>2])}M[0|a](n,o,f)}if((0|m)==(0|(s=i[s>>2])))break}if(e=i[n+84>>2]){for((0|(f=i[n+1716>>2]))==3?M[i[n+88>>2]](4):M[0|f](4,i[n+1896>>2]),b=-1;;){for(f=i[e+8>>2];w[n+80|0]&&(0|(a=!(o=w[i[i[f+4>>2]+20>>2]+21|0])))!=(0|b)&&((0|(t=i[n+1720>>2]))==4?M[i[n+92>>2]](!o):M[0|t](!o,i[n+1896>>2]),b=a),(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[f+16>>2]+12>>2]):M[0|a](i[i[f+16>>2]+12>>2],i[n+1896>>2]),(0|(f=i[f+12>>2]))!=i[e+8>>2];);if(!(e=i[e+16>>2]))break}(0|(f=i[n+1728>>2]))==6?M[i[n+100>>2]]():M[0|f](i[n+1896>>2]),i[n+84>>2]=0}}B=k+16|0}function k1(n,f){var a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0;b=n+f|0;i:{f:if(!(1&(a=i[n+4>>2]))){if(!(3&a))break i;f=(a=i[n>>2])+f|0;a:{if((0|(n=n-a|0))!=i[619]){if(a>>>0<=255){if(e=i[n+8>>2],a=a>>>3|0,(0|(t=i[n+12>>2]))!=(0|e))break a;r=2456,s=i[614]&f2(a),i[r>>2]=s;break f}if(k=i[n+24>>2],(0|(a=i[n+12>>2]))==(0|n))if((t=i[(e=n+20|0)>>2])||(t=i[(e=n+16|0)>>2])){for(;o=e,(t=i[(e=(a=t)+20|0)>>2])||(e=a+16|0,t=i[a+16>>2]););i[o>>2]=0}else a=0;else t=i[n+8>>2],i[t+12>>2]=a,i[a+8>>2]=t;if(!k)break f;e=i[n+28>>2];n:{if(i[(t=2760+(e<<2)|0)>>2]==(0|n)){if(i[t>>2]=a,a)break n;r=2460,s=i[615]&f2(e),i[r>>2]=s;break f}if(i[k+(i[k+16>>2]==(0|n)?16:20)>>2]=a,!a)break f}if(i[a+24>>2]=k,(t=i[n+16>>2])&&(i[a+16>>2]=t,i[t+24>>2]=a),!(t=i[n+20>>2]))break f;i[a+20>>2]=t,i[t+24>>2]=a;break f}if((3&(a=i[b+4>>2]))!=3)break f;return i[616]=f,i[b+4>>2]=-2&a,i[n+4>>2]=1|f,void(i[b>>2]=f)}i[e+12>>2]=t,i[t+8>>2]=e}f:{if(!(2&(a=i[b+4>>2]))){if(i[620]==(0|b)){if(i[620]=n,f=i[617]+f|0,i[617]=f,i[n+4>>2]=1|f,i[619]!=(0|n))break i;return i[616]=0,void(i[619]=0)}if(i[619]==(0|b))return i[619]=n,f=i[616]+f|0,i[616]=f,i[n+4>>2]=1|f,void(i[n+f>>2]=f);f=(-8&a)+f|0;a:if(a>>>0<=255){if(e=i[b+8>>2],a=a>>>3|0,(0|(t=i[b+12>>2]))==(0|e)){r=2456,s=i[614]&f2(a),i[r>>2]=s;break a}i[e+12>>2]=t,i[t+8>>2]=e}else{if(k=i[b+24>>2],(0|b)==(0|(a=i[b+12>>2])))if((e=i[(t=b+20|0)>>2])||(e=i[(t=b+16|0)>>2])){for(;o=t,(e=i[(t=(a=e)+20|0)>>2])||(t=a+16|0,e=i[a+16>>2]););i[o>>2]=0}else a=0;else t=i[b+8>>2],i[t+12>>2]=a,i[a+8>>2]=t;if(k){e=i[b+28>>2];n:{if(i[(t=2760+(e<<2)|0)>>2]==(0|b)){if(i[t>>2]=a,a)break n;r=2460,s=i[615]&f2(e),i[r>>2]=s;break a}if(i[k+(i[k+16>>2]==(0|b)?16:20)>>2]=a,!a)break a}i[a+24>>2]=k,(t=i[b+16>>2])&&(i[a+16>>2]=t,i[t+24>>2]=a),(t=i[b+20>>2])&&(i[a+20>>2]=t,i[t+24>>2]=a)}}if(i[n+4>>2]=1|f,i[n+f>>2]=f,i[619]!=(0|n))break f;return void(i[616]=f)}i[b+4>>2]=-2&a,i[n+4>>2]=1|f,i[n+f>>2]=f}if(f>>>0<=255)return a=2496+((f=f>>>3|0)<<3)|0,(t=i[614])&(f=1<>2]:(i[614]=f|t,f=a),i[a+8>>2]=n,i[f+12>>2]=n,i[n+12>>2]=a,void(i[n+8>>2]=f);e=31,i[n+16>>2]=0,i[n+20>>2]=0,f>>>0<=16777215&&(a=f>>>8|0,a<<=o=a+1048320>>>16&8,e=28+((a=((a<<=e=a+520192>>>16&4)<<(t=a+245760>>>16&2)>>>15|0)-(t|e|o)|0)<<1|f>>>a+21&1)|0),i[n+28>>2]=e,o=2760+(e<<2)|0;f:{if((t=i[615])&(a=1<>>1|0)|0),a=i[o>>2];;){if(t=a,(-8&i[a+4>>2])==(0|f))break f;if(a=e>>>29|0,e<<=1,!(a=i[16+(o=t+(4&a)|0)>>2]))break}i[o+16>>2]=n,i[n+24>>2]=t}else i[615]=a|t,i[o>>2]=n,i[n+24>>2]=o;return i[n+12>>2]=n,void(i[n+8>>2]=n)}f=i[t+8>>2],i[f+12>>2]=n,i[t+8>>2]=n,i[n+24>>2]=0,i[n+12>>2]=t,i[n+8>>2]=f}}function E0(n,f){var a=0,t=0,e=0,b=u(0),o=0,k=0,r=u(0),s=0,A=0,l=0,v=0,h=0,m=0,y=0,E=0,R=0,_=0,L=0,P=0,F=0,U=0;B=e=B-48|0;i:{l=i[f>>2],k=i[l+16>>2],r=c[k+28>>2],a=i[i[i[f+4>>2]+8>>2]>>2],h=i[a>>2],t=i[h+16>>2],b=c[t+28>>2];f:{if(!(!(c[k+32>>2]<=c[t+32>>2])|r!=b)||r>2]+16>>2],k,t)>u(0))break f;if(k=i[l+16>>2],t=i[h+16>>2],c[k+32>>2]!=c[t+32>>2]||c[k+28>>2]!=c[t+28>>2]){if(!n2(i[h+4>>2])||!z(l,i[i[h+4>>2]+12>>2]))break i;_=1,p[a+14|0]=1,p[f+14|0]=1;break f}if(_=1,(0|t)==(0|k))break f;if(o=i[n+68>>2],(0|(f=i[k+36>>2]))>=0){if(m=i[o>>2],s=i[m>>2],k=f,A=i[m+4>>2],f=i[4+(L=A+(f<<3)|0)>>2],R=i[m+8>>2],E=i[s+(R<<2)>>2],i[s+(f<<2)>>2]=E,i[4+(P=(E<<3)+A|0)>>2]=f,F=R-1|0,i[m+8>>2]=F,(0|f)<(0|R)){a:{if((0|f)<2||(a=i[(i[s+(f<<1&-4)>>2]<<3)+A>>2],b=c[a+28>>2],y=i[(E<<3)+A>>2],b<(r=c[y+28>>2])||!(!(c[a+32>>2]<=c[y+32>>2])|r!=b)))for(U=(E<<3)+A|0;;){if((0|F)<=(0|(a=f<<1))||(v=i[(i[s+((t=1|a)<<2)>>2]<<3)+A>>2],r=c[v+28>>2],o=i[(i[s+(a<<2)>>2]<<3)+A>>2],b=c[o+28>>2],!(c[v+32>>2]<=c[o+32>>2])|r!=b&&!(r=(0|R)){a=f;break a}if(y=i[U>>2],r=c[y+28>>2],v=i[s+(a<<2)>>2],t=i[(o=(v<<3)+A|0)>>2],r<(b=c[t+28>>2])){a=f;break a}if(!(!(c[y+32>>2]<=c[t+32>>2])|r!=b)){a=f;break a}i[s+(f<<2)>>2]=v,i[o+4>>2]=f,f=a}for(;;){if(v=i[s+((a=f>>1)<<2)>>2],t=i[(o=(v<<3)+A|0)>>2],(b=c[t+28>>2])>2]<=c[y+32>>2])|r!=b)){a=f;break a}if(i[s+(f<<2)>>2]=v,i[o+4>>2]=f,!((f=a)>>>0>1))break}}i[s+(a<<2)>>2]=E,i[P+4>>2]=a}i[L>>2]=0,i[L+4>>2]=i[m+16>>2],i[m+16>>2]=k}else{i[i[o+4>>2]+((-1^f)<<2)>>2]=0;a:if(!((0|(f=i[o+12>>2]))<1))for(k=i[o+8>>2];;){if(i[i[k+((a=f-1|0)<<2)>>2]>>2])break a;if(i[o+12>>2]=a,t=(0|f)>1,f=a,!t)break}}if(a=i[i[h+4>>2]+12>>2],i[e+24>>2]=0,i[e+28>>2]=0,i[e+16>>2]=0,i[e+20>>2]=0,f=i[287],i[e+8>>2]=i[286],i[e+12>>2]=f,f=i[285],i[e>>2]=i[284],i[e+4>>2]=f,f=i[a+16>>2],i[e+16>>2]=i[f+12>>2],i[e+20>>2]=i[i[l+16>>2]+12>>2],c[e+36>>2]=c[f+16>>2],c[e+40>>2]=c[f+20>>2],c[e+44>>2]=c[f+24>>2],i[f+12>>2]=0,t=f+12|0,(0|(f=i[n+1736>>2]))==8?M[i[n+76>>2]](e+36|0,e+16|0,e,t):M[0|f](e+36|0,e+16|0,e,t,i[n+1896>>2]),i[t>>2]||(i[t>>2]=i[e+16>>2]),z(a,l))break f;break i}if(!(G(i[i[l+4>>2]+16>>2],t,k)>2]+4>>2]>>2]+14|0]=1,!n2(i[l+4>>2])||!z(i[i[h+4>>2]+12>>2],l)))break i}return B=e+48|0,_}b2(n+1740|0,1),o2()}function E4(n){n|=0;var f=0,a=0,t=u(0),e=u(0),b=u(0),o=u(0),k=u(0),r=u(0),s=0,A=0,l=0,v=u(0),h=u(0),m=0,y=u(0),E=u(0),R=u(0),_=u(0),L=u(0),P=0,F=0,U=u(0),q=u(0),Y=u(0);i:{f:if(!((0|(l=i[n+112>>2]))<3)){if(s=(F=n+116|0)+(l<<4)|0,o=c[n+24>>2],k=c[n+16>>2],r=c[n+20>>2],o!=u(0)||k!=u(0)|r!=u(0))y=c[n+124>>2],b=u(c[n+140>>2]-y),E=c[n+120>>2],v=u(c[n+136>>2]-E),R=c[n+116>>2],h=u(c[n+132>>2]-R);else{for(a=n+148|0,o=u(0),r=u(0),k=u(0),f=n+132|0,R=c[n+116>>2],t=h=u(c[f>>2]-R),E=c[n+120>>2],e=v=u(c[n+136>>2]-E),y=c[n+124>>2],_=b=u(c[n+140>>2]-y);L=u(c[f+20>>2]-E),U=u(c[a>>2]-R),q=u(u(t*L)-u(e*U)),Y=u(c[f+24>>2]-y),e=u(u(e*Y)-u(_*L)),t=u(u(_*U)-u(t*Y)),u(u(o*q)+u(u(k*e)+u(r*t)))>=u(0)?(r=u(r+t),k=u(k+e),o=u(o+q)):(r=u(r-t),k=u(k-e),o=u(o-q)),t=U,e=L,_=Y,s>>>0>(a=(f=a)+16|0)>>>0;);if((0|l)<3)break f}for(a=n+148|0,f=m=n+132|0;;){t=b,b=v,P=f,e=h,v=u(c[f+20>>2]-E),h=u(c[(f=a)>>2]-R),L=u(o*u(u(e*v)-u(b*h))),_=b,b=u(c[P+24>>2]-y);a:if((t=u(L+u(u(k*u(u(_*b)-u(t*v)))+u(r*u(u(t*h)-u(e*b))))))!=u(0)){if(t>u(0)){if(a=0,P=(0|A)<0,A=1,!P)break a;break i}if(a=0,P=(0|A)>0,A=-1,P)break i}if(!(s>>>0>(a=f+16|0)>>>0))break}switch(a=0,0|A){case 2:break i;case 0:break f}a=1;a:{n:switch(i[n+56>>2]-100132|0){case 0:if((0|A)>=0)break a;break f;case 2:break i;case 1:break n;default:break a}if((0|A)>0)break f}(0|(f=i[n+1716>>2]))==3?M[i[n+88>>2]](w[n+81|0]?2:(0|l)<4?4:6):M[0|f](w[n+81|0]?2:(0|l)<4?4:6,i[n+1896>>2]),(0|(f=i[n+1724>>2]))==5?M[i[n+96>>2]](i[n+128>>2]):M[0|f](i[n+128>>2],i[n+1896>>2]);a:if((0|A)<=0){if(F>>>0>=(f=s-16|0)>>>0)break a;for(;(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[s-4>>2]):M[0|a](i[s-4>>2],i[n+1896>>2]),s=f,F>>>0<(f=f-16|0)>>>0;);}else if(!((0|l)<2))for(;(0|(f=i[n+1724>>2]))==5?M[i[n+96>>2]](i[m+12>>2]):M[0|f](i[m+12>>2],i[n+1896>>2]),(m=m+16|0)>>>0>>0;);(0|(f=i[n+1728>>2]))==6?M[i[n+100>>2]]():M[0|f](i[n+1896>>2])}a=1}return 0|a}function l0(n,f){var a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0,A=0,l=0,v=0,h=0,m=0;if(!n)return H(f);if(f>>>0>=4294967232)return i[613]=48,0;o=f>>>0<11?16:f+11&-8,e=-8&(s=i[4+(b=n-8|0)>>2]);i:if(3&s){k=e+b|0;f:if(e>>>0>=o>>>0){if((t=e-o|0)>>>0<16)break f;i[b+4>>2]=1&s|o|2,i[4+(a=b+o|0)>>2]=3|t,i[k+4>>2]=1|i[k+4>>2],k1(a,t)}else if(i[620]!=(0|k))if(i[619]!=(0|k)){if(2&(t=i[k+4>>2])||(A=e+(-8&t)|0)>>>0>>0)break i;v=A-o|0;a:if(t>>>0<=255){if(e=i[k+8>>2],a=t>>>3|0,(0|(t=i[k+12>>2]))==(0|e)){h=2456,m=i[614]&f2(a),i[h>>2]=m;break a}i[e+12>>2]=t,i[t+8>>2]=e}else{if(l=i[k+24>>2],(0|(r=i[k+12>>2]))==(0|k))if((a=i[(e=k+20|0)>>2])||(a=i[(e=k+16|0)>>2])){for(;t=e,r=a,(a=i[(e=a+20|0)>>2])||(e=r+16|0,a=i[r+16>>2]););i[t>>2]=0}else r=0;else a=i[k+8>>2],i[a+12>>2]=r,i[r+8>>2]=a;if(l){t=i[k+28>>2];n:{if(i[(a=2760+(t<<2)|0)>>2]==(0|k)){if(i[a>>2]=r,r)break n;h=2460,m=i[615]&f2(t),i[h>>2]=m;break a}if(i[(i[l+16>>2]==(0|k)?16:20)+l>>2]=r,!r)break a}i[r+24>>2]=l,(a=i[k+16>>2])&&(i[r+16>>2]=a,i[a+24>>2]=r),(a=i[k+20>>2])&&(i[r+20>>2]=a,i[a+24>>2]=r)}}v>>>0<=15?(i[b+4>>2]=1&s|A|2,i[4+(a=b+A|0)>>2]=1|i[a+4>>2]):(i[b+4>>2]=1&s|o|2,i[4+(t=b+o|0)>>2]=3|v,i[4+(a=b+A|0)>>2]=1|i[a+4>>2],k1(t,v))}else{if((t=e+i[616]|0)>>>0>>0)break i;(a=t-o|0)>>>0>=16?(i[b+4>>2]=1&s|o|2,i[4+(e=b+o|0)>>2]=1|a,i[(t=t+b|0)>>2]=a,i[t+4>>2]=-2&i[t+4>>2]):(i[b+4>>2]=t|1&s|2,i[4+(a=t+b|0)>>2]=1|i[a+4>>2],a=0,e=0),i[619]=e,i[616]=a}else{if((e=e+i[617]|0)>>>0<=o>>>0)break i;i[b+4>>2]=1&s|o|2,a=e-o|0,i[4+(t=b+o|0)>>2]=1|a,i[617]=a,i[620]=t}a=b}else{if(o>>>0<256||e>>>0>=o+4>>>0&&(a=b,e-o>>>0<=i[734]<<1>>>0))break i;a=0}return a?a+8|0:(b=H(f))?(c1(b,n,f>>>0>(a=(3&(a=i[n-4>>2])?-4:-8)+(-8&a)|0)>>>0?a:f),j(n),b):0}function u1(n,f){var a=0,t=0,e=0,b=0,o=0,k=0,r=u(0),s=0,A=u(0);for(t=i[i[i[f+4>>2]+8>>2]>>2];;){i:{if(w[t+14|0])for(;t=i[i[i[(f=t)+4>>2]+8>>2]>>2],w[t+14|0];);f:{a:{n:{t:{if(w[f+14|0])a=f;else if(!(a=i[i[i[f+4>>2]+4>>2]>>2])||(t=f,!w[a+14|0]))break t;p[a+14|0]=0,e=i[a>>2],f=i[i[e+4>>2]+16>>2],o=i[t>>2];b:if((0|f)!=i[i[o+4>>2]+16>>2]){r=c[f+28>>2],s=i[i[i[a+4>>2]+8>>2]>>2],b=i[s>>2],k=i[i[b+4>>2]+16>>2],A=c[k+28>>2];e:{if(!(!(c[f+32>>2]<=c[k+32>>2])|r!=A)||r>2])>2]+4>>2]>>2]+14|0]=1,!(f=n2(e)))break f;if(z(i[b+4>>2],f))break e;break i}if(G(k,f,i[b+16>>2])>u(0)){f=a;break b}if(p[s+14|0]=1,p[a+14|0]=1,!(f=n2(b))||!z(i[e+12>>2],i[b+4>>2]))break i;f=i[f+4>>2]}if(p[i[f+20>>2]+21|0]=w[a+12|0],w[t+15|0]){if(i[i[t>>2]+24>>2]=0,h2(i[t+4>>2]),j(t),!$(o))break i;t=i[i[i[a+4>>2]+8>>2]>>2],o=i[t>>2],f=a}else if(w[a+15|0]){if(i[i[a>>2]+24>>2]=0,h2(i[a+4>>2]),j(a),!$(e))break i;f=i[i[i[t+4>>2]+4>>2]>>2],e=i[f>>2]}else f=a}else f=a;if(i[e+16>>2]==i[o+16>>2])break a;if(a=i[i[e+4>>2]+16>>2],b=i[i[o+4>>2]+16>>2],w[t+15|0]|w[f+15|0]|(0|a)==(0|b)||(k=a,(0|(a=i[n+72>>2]))!=(0|b)&&(0|k)!=(0|a)))break n;if(!o1(n,f))break a}return}E0(n,f)}if(i[e+16>>2]!=i[o+16>>2]||(b=i[e+4>>2],a=i[o+4>>2],i[b+16>>2]!=i[a+16>>2]))continue;if(i[o+28>>2]=i[o+28>>2]+i[e+28>>2],i[a+28>>2]=i[a+28>>2]+i[b+28>>2],i[i[f>>2]+24>>2]=0,h2(i[f+4>>2]),j(f),!$(e))break i;f=i[i[i[t+4>>2]+4>>2]>>2];continue}}break}b2(n+1740|0,1),o2()}function R4(n){n|=0;var f=0,a=0,t=0,e=u(0),b=u(0),o=0,k=0,r=0,s=0;if((0|(f=i[n+40>>2]))!=(0|(r=n+40|0)))for(;;){if(n=i[f>>2],w[f+21|0]){for(f=f+8|0;f=i[f>>2],a=i[i[f+4>>2]+16>>2],e=c[a+28>>2],t=i[f+16>>2],b=c[t+28>>2],!(!(c[a+32>>2]<=c[t+32>>2])|e!=b)||e>2]+4|0;for(;!(!(c[t+32>>2]<=c[a+32>>2])|e!=b)||e>b;)f=i[f+12>>2],t=i[f+16>>2],b=c[t+28>>2],a=i[i[f+4>>2]+16>>2],e=c[a+28>>2];i:{f:if((0|(t=i[i[f+8>>2]+4>>2]))!=i[f+12>>2])for(;;){if(o=i[t+16>>2],b=c[o+28>>2],!(c[a+32>>2]<=c[o+32>>2])|e!=b&&!(b>e)){a:if(i[t+12>>2]!=(0|f))for(;;){if(a=i[i[f+8>>2]+4>>2],o=i[a+16>>2],e=c[o+28>>2],k=i[i[a+4>>2]+16>>2],!(e<(b=c[k+28>>2])|(c[o+32>>2]<=c[k+32>>2]?e==b:0))){if(!(G(i[i[f+4>>2]+16>>2],i[f+16>>2],o)>=u(0)))break a;a=i[i[f+8>>2]+4>>2]}if(f=d2(f,a),a=0,!f)break i;if((0|(f=i[f+4>>2]))==i[t+12>>2])break}f=i[f+12>>2]}else{a:if((0|(a=i[t+12>>2]))!=(0|f))for(o=t+12|0;;){if(k=i[i[a+4>>2]+16>>2],e=c[k+28>>2],s=i[a+16>>2],!(e<(b=c[s+28>>2])|(c[k+32>>2]<=c[s+32>>2]?e==b:0))){if(!(G(i[t+16>>2],i[i[t+4>>2]+16>>2],k)<=u(0)))break a;a=i[o>>2]}if(t=d2(a,t),a=0,!t)break i;if(o=(t=i[t+4>>2])+12|0,(0|(a=i[t+12>>2]))==(0|f))break}t=i[i[t+8>>2]+4>>2]}if(i[f+12>>2]==(0|t))break f;a=i[i[f+4>>2]+16>>2],e=c[a+28>>2]}if(a=i[t+12>>2],i[a+12>>2]!=(0|f))for(;;){if(t=d2(a,t),a=0,!t)break i;if(t=i[t+4>>2],a=i[t+12>>2],i[a+12>>2]==(0|f))break}a=1}if(!a)return 0}if((0|r)==(0|(f=n)))break}return 1}function $(n){var f=0,a=0,t=0,e=0,b=0,o=0;if(e=i[n+4>>2],(0|(o=i[e+20>>2]))!=(0|(a=i[n+20>>2]))){for(f=t=i[a+8>>2];i[f+20>>2]=o,(0|t)!=(0|(f=i[f+12>>2])););f=i[a>>2],t=i[a+4>>2],i[f+4>>2]=t,i[t>>2]=f,j(a)}if((0|(t=i[n+8>>2]))!=(0|n)){if(b=i[n+4>>2],f=i[b+12>>2],i[i[b+20>>2]+8>>2]=f,i[i[n+16>>2]+8>>2]=t,b=i[f+8>>2],i[i[t+4>>2]+12>>2]=f,i[i[b+4>>2]+12>>2]=n,i[n+8>>2]=b,i[f+8>>2]=t,(0|a)==(0|o)){if(!(a=H(24)))return 0;for(f=i[n+20>>2],t=i[f+4>>2],i[a+4>>2]=t,i[t>>2]=a,i[a>>2]=f,i[f+4>>2]=a,i[a+12>>2]=0,i[a+16>>2]=0,i[a+8>>2]=n,p[a+20|0]=0,p[a+21|0]=w[f+21|0],f=n;i[f+20>>2]=a,(0|(f=i[f+12>>2]))!=(0|n););}}else{for(a=i[n+16>>2],f=t=i[a+8>>2];i[f+16>>2]=0,(0|t)!=(0|(f=i[f+8>>2])););f=i[a>>2],t=i[a+4>>2],i[f+4>>2]=t,i[t>>2]=f,j(a)}if((0|(f=i[e+8>>2]))!=(0|e))a=i[i[e+4>>2]+12>>2],i[i[n+20>>2]+8>>2]=a,i[i[e+16>>2]+8>>2]=f,t=i[a+8>>2],i[i[f+4>>2]+12>>2]=a,i[i[t+4>>2]+12>>2]=e,i[e+8>>2]=t,i[a+8>>2]=f;else{for(a=i[e+16>>2],f=t=i[a+8>>2];i[f+16>>2]=0,(0|t)!=(0|(f=i[f+8>>2])););for(f=i[a>>2],t=i[a+4>>2],i[f+4>>2]=t,i[t>>2]=f,j(a),a=i[e+20>>2],f=e=i[a+8>>2];i[f+20>>2]=0,(0|e)!=(0|(f=i[f+12>>2])););f=i[a>>2],e=i[a+4>>2],i[f+4>>2]=e,i[e>>2]=f,j(a)}return f=i[n+4>>2],f=i[(n=n>>>0>f>>>0?f:n)>>2],a=i[i[n+4>>2]>>2],i[i[f+4>>2]>>2]=a,i[i[a+4>>2]>>2]=f,j(n),1}function d2(n,f){var a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0;if(t=0,a=H(64)){if(k=i[n+4>>2],b=i[(t=n>>>0>k>>>0?k:n)+4>>2],e=i[b>>2],i[a+32>>2]=e,i[i[e+4>>2]>>2]=a,i[a>>2]=t,o=a+32|0,i[b>>2]=o,i[a+16>>2]=0,i[a+20>>2]=0,i[a+12>>2]=o,i[a+4>>2]=o,i[a+24>>2]=0,i[a+28>>2]=0,i[a+48>>2]=0,i[a+52>>2]=0,i[a+44>>2]=a,i[a+40>>2]=o,i[a+36>>2]=a,i[a+56>>2]=0,i[a+60>>2]=0,i[a+8>>2]=a,(0|(r=i[n+20>>2]))!=(0|(b=i[f+20>>2]))){for(t=e=i[b+8>>2];i[t+20>>2]=r,(0|e)!=(0|(t=i[t+12>>2])););t=i[b>>2],e=i[b+4>>2],i[t+4>>2]=e,i[e>>2]=t,j(b),k=i[n+4>>2],e=i[a+8>>2],t=i[n+20>>2]}else e=a,t=b;if(n=i[n+12>>2],s=i[n+8>>2],i[i[e+4>>2]+12>>2]=n,i[i[s+4>>2]+12>>2]=a,i[a+8>>2]=s,i[n+8>>2]=e,n=i[f+8>>2],e=i[a+40>>2],i[i[e+4>>2]+12>>2]=f,i[i[n+4>>2]+12>>2]=o,i[a+40>>2]=n,i[f+8>>2]=e,i[a+16>>2]=i[k+16>>2],f=i[f+16>>2],n=t,i[a+52>>2]=n,i[a+48>>2]=f,i[a+20>>2]=n,i[n+8>>2]=o,t=a,(0|b)==(0|r)&&(t=0,f=H(24))){for(t=i[n+4>>2],i[f+4>>2]=t,i[t>>2]=f,i[f>>2]=n,i[n+4>>2]=f,i[f+12>>2]=0,i[f+16>>2]=0,i[f+8>>2]=a,p[f+20|0]=0,p[f+21|0]=w[n+21|0],t=a;i[t+20>>2]=f,(0|(t=i[t+12>>2]))!=(0|a););t=a}}return t}function c1(n,f,a){var t=0,e=0;if(a>>>0>=512)m4(0|n,0|f,0|a);else{t=n+a|0;i:if(3&(n^f))if(t>>>0<4)a=n;else if((e=t-4|0)>>>0>>0)a=n;else for(a=n;p[0|a]=w[0|f],p[a+1|0]=w[f+1|0],p[a+2|0]=w[f+2|0],p[a+3|0]=w[f+3|0],f=f+4|0,e>>>0>=(a=a+4|0)>>>0;);else{f:if(3&n)if((0|a)<1)a=n;else for(a=n;;){if(p[0|a]=w[0|f],f=f+1|0,!(3&(a=a+1|0)))break f;if(!(a>>>0>>0))break}else a=n;if(!((n=-4&t)>>>0<64||(e=n+-64|0)>>>0>>0))for(;i[a>>2]=i[f>>2],i[a+4>>2]=i[f+4>>2],i[a+8>>2]=i[f+8>>2],i[a+12>>2]=i[f+12>>2],i[a+16>>2]=i[f+16>>2],i[a+20>>2]=i[f+20>>2],i[a+24>>2]=i[f+24>>2],i[a+28>>2]=i[f+28>>2],i[a+32>>2]=i[f+32>>2],i[a+36>>2]=i[f+36>>2],i[a+40>>2]=i[f+40>>2],i[a+44>>2]=i[f+44>>2],i[a+48>>2]=i[f+48>>2],i[a+52>>2]=i[f+52>>2],i[a+56>>2]=i[f+56>>2],i[a+60>>2]=i[f+60>>2],f=f- -64|0,e>>>0>=(a=a- -64|0)>>>0;);if(n>>>0<=a>>>0)break i;for(;i[a>>2]=i[f>>2],f=f+4|0,n>>>0>(a=a+4|0)>>>0;);}if(a>>>0>>0)for(;p[0|a]=w[0|f],f=f+1|0,(0|t)!=(0|(a=a+1|0)););}}function n2(n){var f=0,a=0,t=0,e=0,b=0,o=0;if(b=n|=0,n=0,(f=H(64))&&(t=i[b+4>>2],e=i[(a=t>>>0>>0?t:b)+4>>2],o=i[e>>2],i[f+32>>2]=o,i[i[o+4>>2]>>2]=f,i[f>>2]=a,a=f+32|0,i[e>>2]=a,i[f+16>>2]=0,i[f+20>>2]=0,i[f+12>>2]=a,i[f+4>>2]=a,i[f+24>>2]=0,i[f+28>>2]=0,i[f+48>>2]=0,i[f+52>>2]=0,i[f+40>>2]=a,i[f+36>>2]=f,i[f+56>>2]=0,i[f+60>>2]=0,i[f+8>>2]=f,e=i[b+12>>2],o=i[e+8>>2],i[f+44>>2]=e,i[i[o+4>>2]+12>>2]=f,i[f+8>>2]=o,i[e+8>>2]=f,e=i[t+16>>2],i[f+16>>2]=e,t=H(40))){for(n=i[e+4>>2],i[t+4>>2]=n,i[n>>2]=t,i[t>>2]=e,i[e+4>>2]=t,i[t+12>>2]=0,i[t+8>>2]=a,n=a;i[n+16>>2]=t,(0|a)!=(0|(n=i[n+8>>2])););n=i[b+20>>2],i[f+20>>2]=n,i[f+52>>2]=n,n=f}return n?(f=i[n+4>>2],n=i[b+4>>2],a=i[i[n+4>>2]+12>>2],t=i[a+8>>2],e=i[n+8>>2],i[i[e+4>>2]+12>>2]=a,i[i[t+4>>2]+12>>2]=n,i[n+8>>2]=t,i[a+8>>2]=e,a=i[f+8>>2],t=i[n+8>>2],i[i[t+4>>2]+12>>2]=f,i[i[a+4>>2]+12>>2]=n,i[n+8>>2]=a,i[f+8>>2]=t,i[n+16>>2]=i[f+16>>2],a=i[f+4>>2],i[i[a+16>>2]+8>>2]=a,i[a+20>>2]=i[n+20>>2],i[f+28>>2]=i[b+28>>2],i[a+28>>2]=i[n+28>>2],0|f):0}function j2(n,f,a,t,e,b){var o=0,k=0,r=0,s=0,A=0;s=f+4|0,r=n- -64|0;i:{for(;;){if(k=i[a+4>>2],!(o=H(16))||(i[o>>2]=k,A=S0(i[r>>2],i[f+4>>2],o),i[o+4>>2]=A,!A))break i;if(p[o+13|0]=0,p[o+14|0]=0,p[o+15|0]=0,i[k+24>>2]=o,(0|t)==(0|(a=i[a+8>>2])))break}if(o=i[i[i[f+4>>2]+8>>2]>>2],a=i[i[o>>2]+4>>2],e=e||i[a+8>>2],i[a+16>>2]==i[e+16>>2])for(r=0;;){if(t=f,f=o,(0|(o=e))!=i[(e=a)+8>>2]&&(!z(i[i[e+4>>2]+12>>2],e)||!z(i[i[o+4>>2]+12>>2],e)))break i;k=i[t+8>>2]-i[e+28>>2]|0,i[f+8>>2]=k;f:{a:switch(i[n+56>>2]-100130|0){case 0:a=1&k;break f;case 1:a=(0|k)!=0;break f;case 2:a=(0|k)>0;break f;case 3:a=k>>>31|0;break f;case 4:break a;default:break f}a=k+1>>>0>2}if(p[f+12|0]=a,p[t+14|0]=1,r&&E0(n,t)&&(i[e+28>>2]=i[e+28>>2]+i[o+28>>2],a=i[e+4>>2],i[a+28>>2]=i[a+28>>2]+i[i[o+4>>2]+28>>2],i[i[t>>2]+24>>2]=0,h2(i[s>>2]),j(t),!$(o)))break i;if(s=f+4|0,r=1,o=i[i[i[f+4>>2]+8>>2]>>2],a=i[i[o>>2]+4>>2],i[a+16>>2]!=i[e+16>>2])break}return p[f+14|0]=1,void(b&&u1(n,f))}b2(n+1740|0,1),o2()}function r1(n){var f=0,a=0,t=0,e=0,b=0,o=0,k=0,r=0,s=0;if((0|(e=i[40+(n|=0)>>2]))!=(0|(k=n+40|0)))for(;;){if(s=i[e>>2],!w[e+21|0]){for(r=i[e+8>>2],n=i[r+12>>2];;){if(i[n+20>>2]=0,o=i[n+12>>2],f=i[n+4>>2],!i[f+20>>2]){if(t=i[n+16>>2],(0|(a=i[n+8>>2]))!=(0|n))i[t+8>>2]=a,t=i[f+12>>2],b=i[t+8>>2],i[i[a+4>>2]+12>>2]=t,i[i[b+4>>2]+12>>2]=n,i[n+8>>2]=b,i[t+8>>2]=a;else{for(f=a=i[t+8>>2];i[f+16>>2]=0,(0|a)!=(0|(f=i[f+8>>2])););f=i[t>>2],a=i[t+4>>2],i[f+4>>2]=a,i[a>>2]=f,j(t),f=i[n+4>>2]}if(t=i[f+16>>2],(0|(a=i[f+8>>2]))!=(0|f))i[t+8>>2]=a,t=i[i[f+4>>2]+12>>2],b=i[t+8>>2],i[i[a+4>>2]+12>>2]=t,i[i[b+4>>2]+12>>2]=f,i[f+8>>2]=b,i[t+8>>2]=a;else{for(f=a=i[t+8>>2];i[f+16>>2]=0,(0|a)!=(0|(f=i[f+8>>2])););f=i[t>>2],a=i[t+4>>2],i[f+4>>2]=a,i[a>>2]=f,j(t),f=i[n+4>>2]}t=i[(f=n>>>0>f>>>0?f:n)>>2],a=i[i[f+4>>2]>>2],i[i[t+4>>2]>>2]=a,i[i[a+4>>2]>>2]=t,j(f)}if(f=(0|n)!=(0|r),n=o,!f)break}n=i[e>>2],o=i[e+4>>2],i[n+4>>2]=o,i[o>>2]=n,j(e)}if((0|k)==(0|(e=s)))break}}function z(n,f){var a=0,t=0,e=0,b=0,o=0,k=0;if((0|(n|=0))!=(0|(f|=0))){if((0|(t=i[f+16>>2]))!=(0|(o=i[n+16>>2]))){for(a=e=i[t+8>>2];i[a+16>>2]=o,(0|e)!=(0|(a=i[a+8>>2])););a=i[t>>2],e=i[t+4>>2],i[a+4>>2]=e,i[e>>2]=a,j(t)}if((0|(k=i[n+20>>2]))!=(0|(e=i[f+20>>2]))){for(a=b=i[e+8>>2];i[a+20>>2]=k,(0|b)!=(0|(a=i[a+12>>2])););a=i[e>>2],b=i[e+4>>2],i[a+4>>2]=b,i[b>>2]=a,j(e)}if(a=i[n+8>>2],b=i[f+8>>2],i[i[b+4>>2]+12>>2]=n,i[i[a+4>>2]+12>>2]=f,i[f+8>>2]=a,i[n+8>>2]=b,(0|t)==(0|o)){if(!(t=H(40)))return 0;for(a=i[n+16>>2],o=i[a+4>>2],i[t+4>>2]=o,i[o>>2]=t,i[t>>2]=a,i[a+4>>2]=t,i[t+12>>2]=0,i[t+8>>2]=f,a=f;i[a+16>>2]=t,(0|(a=i[a+8>>2]))!=(0|f););i[i[n+16>>2]+8>>2]=n}if((0|e)==(0|k)){if(!(t=H(24)))return 0;for(a=i[n+20>>2],e=i[a+4>>2],i[t+4>>2]=e,i[e>>2]=t,i[t>>2]=a,i[a+4>>2]=t,i[t+12>>2]=0,i[t+16>>2]=0,i[t+8>>2]=f,p[t+20|0]=0,p[t+21|0]=w[a+21|0],a=f;i[a+20>>2]=t,(0|(a=i[a+12>>2]))!=(0|f););i[i[n+20>>2]+8>>2]=n}}return 1}function s1(n,f){var a=0,t=0,e=0,b=0,o=0,k=0,r=u(0),s=0,A=0,l=u(0);if(i[n+20>>2]){t=f,a=i[n>>2],n=i[a+8>>2]+1|0,i[a+8>>2]=n;i:{if(!((0|(f=i[a+12>>2]))>=n<<1)){if(i[a+12>>2]=f<<1,e=i[a+4>>2],f=l0(b=i[a>>2],f<<3|4),i[a>>2]=f,!f){i[a>>2]=b,e=2147483647;break i}if(f=l0(i[a+4>>2],8+(i[a+12>>2]<<3)|0),i[a+4>>2]=f,!f){i[a+4>>2]=e,e=2147483647;break i}}if(b=i[a+4>>2],e=n,(f=i[a+16>>2])&&(i[a+16>>2]=i[4+(b+(f<<3)|0)>>2],e=f),o=i[a>>2],i[o+(n<<2)>>2]=e,i[(k=b+(e<<3)|0)>>2]=t,i[k+4>>2]=n,i[a+20>>2]){f:if(n>>>0<2)f=n;else for(r=c[t+28>>2];;){if(a=i[((f=n>>1)<<2)+o>>2],A=i[(s=b+(a<<3)|0)>>2],(l=c[A+28>>2])>2]<=c[t+32>>2])|r!=l)){f=n;break f}if(i[(n<<2)+o>>2]=a,i[s+4>>2]=n,!((n=f)>>>0>1))break}i[(f<<2)+o>>2]=e,i[k+4>>2]=f}}return e}if(t=(a=i[n+12>>2])+1|0,i[n+12>>2]=t,e=i[n+4>>2],(0|(b=t))<(0|(t=i[n+16>>2])))t=e;else if(i[n+16>>2]=t<<1,t=l0(e,t<<3),i[n+4>>2]=t,!t)return i[n+4>>2]=e,2147483647;return i[(a<<2)+t>>2]=f,-1^a}function f0(n){n|=0;var f=0,a=0,t=0,e=0,b=0,o=0,k=0;b=H(40),o=H(40);i:{if(!(t=H(24))||!b|!o){if(b&&j(b),o&&j(o),!t)break i;return j(t),0}if(!(f=H(64)))return 0;for(a=i[n+68>>2],e=i[(a=a>>>0<(e=n- -64|0)>>>0?a:e)+4>>2],k=i[e>>2],i[f+32>>2]=k,i[i[k+4>>2]>>2]=f,i[f>>2]=a,a=e,e=f+32|0,i[a>>2]=e,i[f+16>>2]=0,i[f+20>>2]=0,i[f+12>>2]=e,i[f+4>>2]=e,i[f+24>>2]=0,i[f+28>>2]=0,i[f+48>>2]=0,i[f+52>>2]=0,i[f+44>>2]=f,i[f+40>>2]=e,i[f+36>>2]=f,i[f+56>>2]=0,i[f+60>>2]=0,i[f+8>>2]=f,a=i[n+4>>2],i[b+4>>2]=a,i[a>>2]=b,i[b+12>>2]=0,i[b+8>>2]=f,a=f;i[a+16>>2]=b,(0|(a=i[a+8>>2]))!=(0|f););for(i[o+4>>2]=b,i[b>>2]=o,i[o>>2]=n,i[n+4>>2]=o,i[o+12>>2]=0,i[o+8>>2]=e,a=e;i[a+16>>2]=o,(0|e)!=(0|(a=i[a+8>>2])););for(a=i[n+44>>2],i[t+4>>2]=a,i[a>>2]=t,i[t>>2]=n+40,i[n+44>>2]=t,i[t+12>>2]=0,i[t+16>>2]=0,i[t+8>>2]=f,p[t+20|0]=0,p[t+21|0]=w[n+61|0],a=f;i[a+20>>2]=t,(0|(a=i[a+12>>2]))!=(0|f););}return 0|f}function R0(n,f){var a=0,t=0,e=0,b=0,o=0,k=0;i[n+8>>2]=i[283],a=i[282],i[n>>2]=i[281],i[n+4>>2]=a,a=i[f+20>>2];i:if(w[a+21|0]){e=f;f:{a:{for(;;){if(w[a+20|0])break i;if(p[a+20|0]=1,i[a+16>>2]=t,e=i[i[e+12>>2]+4>>2],t=i[e+20>>2],w[t+21|0]){if(w[t+20|0])break a;if(p[t+20|0]=1,i[t+16>>2]=a,b=b+2|0,e=i[e+8>>2],a=i[e+20>>2],w[a+21|0])continue;break i}break}b|=1;break f}b|=1}t=a}else e=f;o=i[f+4>>2],a=i[o+20>>2];i:if(!(!w[a+21|0]|w[a+20|0])){f:{a:{for(;;){if(p[a+20|0]=1,i[a+16>>2]=t,f=i[o+12>>2],o=i[f+4>>2],t=i[o+20>>2],w[t+21|0]){if(w[t+20|0])break a;if(p[t+20|0]=1,i[t+16>>2]=a,k=k+2|0,f=i[i[o+8>>2]+4>>2],o=i[f+4>>2],a=i[o+20>>2],!w[a+21|0])break i;if(!w[a+20|0])continue;break i}break}k|=1;break f}k|=1}t=a}a=b+k|0,i[n>>2]=a;i:{if(1&b){if(!(1&k))break i;i[n>>2]=a-1,f=f+8|0}else f=e+4|0;f=i[f>>2]}if(i[n+4>>2]=f,t)for(;p[t+20|0]=0,t=i[t+16>>2];);}function M4(n,f,a){f|=0,a|=0,(0|(a=i[1716+(n|=0)>>2]))==3?M[i[n+88>>2]](5):M[0|a](5,i[n+1896>>2]),(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[f+16>>2]+12>>2]):M[0|a](i[i[f+16>>2]+12>>2],i[n+1896>>2]),(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[i[f+4>>2]+16>>2]+12>>2]):M[0|a](i[i[i[f+4>>2]+16>>2]+12>>2],i[n+1896>>2]),a=i[f+20>>2];i:if(w[a+21|0])for(;;){if(w[a+20|0]||(p[a+20|0]=1,f=i[i[f+12>>2]+4>>2],(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[f+16>>2]+12>>2]):M[0|a](i[i[f+16>>2]+12>>2],i[n+1896>>2]),a=i[f+20>>2],!w[a+21|0]|w[a+20|0]))break i;if(p[a+20|0]=1,f=i[f+8>>2],(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[i[f+4>>2]+16>>2]+12>>2]):M[0|a](i[i[i[f+4>>2]+16>>2]+12>>2],i[n+1896>>2]),a=i[f+20>>2],!w[a+21|0])break}(0|(f=i[n+1728>>2]))==6?M[i[n+100>>2]]():M[0|f](i[n+1896>>2])}function E2(n,f){f|=0;var a=0;if((0|(a=i[(n|=0)>>2]))!=(0|f))for(;;){i:if(f>>>0>a>>>0){f:switch(0|a){case 0:(0|(a=i[n+1732>>2]))==11?M[i[n+12>>2]](100151):M[0|a](100151,i[n+1896>>2]),i[n>>2]&&E2(n,0),i[n+112>>2]=0,a=1,i[n>>2]=1,p[n+108|0]=0,i[n+1896>>2]=0,i[n+8>>2]=0;break i;case 1:break f;default:break i}if((0|(a=i[n+1732>>2]))==11?M[i[n+12>>2]](100152):M[0|a](100152,i[n+1896>>2]),i[n>>2]!=1&&E2(n,1),i[n>>2]=2,i[n+4>>2]=0,a=2,i[n+112>>2]<1)break i;p[n+108|0]=1}else{f:switch(a-1|0){case 1:(0|(a=i[n+1732>>2]))==11?M[i[n+12>>2]](100154):M[0|a](100154,i[n+1896>>2]),i[n>>2]!=2&&E2(n,2),a=1,i[n>>2]=1;break i;case 0:break f;default:break i}(0|(a=i[n+1732>>2]))==11?M[i[n+12>>2]](100153):M[0|a](100153,i[n+1896>>2]),(a=i[n+8>>2])&&_0(a),a=0,i[n+8>>2]=0,i[n>>2]=0,i[n+4>>2]=0}if((0|f)==(0|a))break}}function A1(n,f,a){var t=0,e=0,b=0,o=0,k=0,r=0,s=0,A=0,l=0;i:{f:{a:{n:{t:{b:{e:{c:{u:{o:{if(e=f,f){if(!(t=a))break o;break u}n=(n>>>0)/(a>>>0)|0,v2=0;break i}if(!n)break c;break e}if(!(t-1&t))break b;r=0-(k=(s0(t)+33|0)-s0(e)|0)|0;break n}n=(e>>>0)/0|0,v2=0;break i}if((t=32-s0(e)|0)>>>0<31)break t;break a}if((0|t)==1)break f;a=31&(t=t?31-s0(t-1^t)|0:32),(63&t)>>>0>=32?(e=0,n=f>>>a|0):(e=f>>>a|0,n=((1<>>a),v2=e;break i}k=t+1|0,r=63-t|0}if(t=f,b=31&(e=63&k),e>>>0>=32?(e=0,b=t>>>b|0):(e=t>>>b|0,b=((1<>>b),t=31&(r&=63),r>>>0>=32?(f=n<>>32-t|f<>>31)-(A=a&(o=r-((e=e<<1|b>>>31)+(t>>>0>>0)|0)>>31))|0,e=e-(s>>>0>>0)|0,f=f<<1|n>>>31,n=l|n<<1,l=o&=1,k=k-1|0;);v2=f<<1|n>>>31,n=o|n<<1;break i}n=0,f=0}v2=f}return n}function I4(n,f,a){f|=0,a|=0;var t=0,e=0,b=0,o=0,k=0,r=0,s=0;B=e=B-32|0,b=i[28+(n|=0)>>2],i[e+16>>2]=b,t=i[n+20>>2],i[e+28>>2]=a,i[e+24>>2]=f,f=t-b|0,i[e+20>>2]=f,b=f+a|0,s=2,f=e+16|0;i:{f:{(t=0|e1(i[n+60>>2],e+16|0,2,e+12|0))?(i[613]=t,t=-1):t=0;a:{if(!t)for(;;){if((0|(t=i[e+12>>2]))==(0|b))break a;if((0|t)<=-1)break f;if(o=t-((k=(o=i[f+4>>2])>>>0>>0)?o:0)|0,i[(r=(k<<3)+f|0)>>2]=o+i[r>>2],i[(r=(k?12:4)+f|0)>>2]=i[r>>2]-o,b=b-t|0,f=k?f+8|0:f,s=s-k|0,(t=0|e1(i[n+60>>2],0|f,0|s,e+12|0))?(i[613]=t,t=-1):t=0,t)break}if((0|b)!=-1)break f}f=i[n+44>>2],i[n+28>>2]=f,i[n+20>>2]=f,i[n+16>>2]=f+i[n+48>>2],n=a;break i}i[n+28>>2]=0,i[n+16>>2]=0,i[n+20>>2]=0,i[n>>2]=32|i[n>>2],n=0,(0|s)!=2&&(n=a-i[f+4>>2]|0)}return B=e+32|0,0|n}function l1(n){var f=0,a=0,t=0,e=0,b=0,o=0,k=u(0),r=0,s=u(0),A=0,l=0,v=0,h=0,m=0,y=0;if(e=i[n+4>>2],a=i[n>>2],t=i[a+4>>2],m=i[(f=e+(t<<3)|0)>>2],!((0|(b=i[n+8>>2]))<1)&&(A=i[(b<<2)+a>>2],i[a+4>>2]=A,i[4+(l=(A<<3)+e|0)>>2]=1,i[f>>2]=0,i[f+4>>2]=i[n+16>>2],v=b-1|0,i[n+8>>2]=v,i[n+16>>2]=t,(0|b)!=1)){for(y=(A<<3)+e|0,f=1;(0|v)<=(0|(n=f<<1))||(o=i[(i[((t=1|n)<<2)+a>>2]<<3)+e>>2],k=c[o+28>>2],r=i[(i[(n<<2)+a>>2]<<3)+e>>2],s=c[r+28>>2],!(c[o+32>>2]<=c[r+32>>2])|k!=s&&!(k=(0|b)||(t=i[y>>2],k=c[t+28>>2],o=i[(n<<2)+a>>2],h=i[(r=(o<<3)+e|0)>>2],k<(s=c[h+28>>2])|(c[t+32>>2]<=c[h+32>>2]?k==s:0)));)i[(f<<2)+a>>2]=o,i[r+4>>2]=f,f=n;i[(f<<2)+a>>2]=A,i[l+4>>2]=f}return m}function _4(n,f,a){f|=0,a|=0,(0|(a=i[1716+(n|=0)>>2]))==3?M[i[n+88>>2]](6):M[0|a](6,i[n+1896>>2]),(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[f+16>>2]+12>>2]):M[0|a](i[i[f+16>>2]+12>>2],i[n+1896>>2]),(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[i[f+4>>2]+16>>2]+12>>2]):M[0|a](i[i[i[f+4>>2]+16>>2]+12>>2],i[n+1896>>2]),a=i[f+20>>2];i:if(w[a+21|0])for(;;){if(w[a+20|0])break i;if(p[a+20|0]=1,f=i[f+8>>2],(0|(a=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[i[f+4>>2]+16>>2]+12>>2]):M[0|a](i[i[i[f+4>>2]+16>>2]+12>>2],i[n+1896>>2]),a=i[f+20>>2],!w[a+21|0])break}(0|(f=i[n+1728>>2]))==6?M[i[n+100>>2]]():M[0|f](i[n+1896>>2])}function v1(n,f,a){var t=0,e=0;if(a&&(p[(t=n+a|0)-1|0]=f,p[0|n]=f,!(a>>>0<3||(p[t-2|0]=f,p[n+1|0]=f,p[t-3|0]=f,p[n+2|0]=f,a>>>0<7||(p[t-4|0]=f,p[n+3|0]=f,a>>>0<9||(t=(t=n)+(n=0-n&3)|0,e=W(255&f,16843009),i[t>>2]=e,i[(f=(n=a-n&-4)+t|0)-4>>2]=e,n>>>0<9||(i[t+8>>2]=e,i[t+4>>2]=e,i[f-8>>2]=e,i[f-12>>2]=e,n>>>0<25||(i[t+24>>2]=e,i[t+20>>2]=e,i[t+16>>2]=e,i[t+12>>2]=e,i[f-16>>2]=e,i[f-20>>2]=e,i[f-24>>2]=e,i[f-28>>2]=e,(a=n-(f=4&t|24)|0)>>>0<32))))))))for(e=x0(e,0,1,1),n=v2,f=f+t|0;i[f+24>>2]=e,t=n,i[f+28>>2]=t,i[f+16>>2]=e,i[f+20>>2]=t,i[f+8>>2]=e,i[f+12>>2]=t,i[f>>2]=e,i[f+4>>2]=t,f=f+32|0,(a=a-32|0)>>>0>31;);}function d1(n,f,a){i:if(!(f>>>0>20)){f:switch(f-9|0){case 0:return f=i[a>>2],i[a>>2]=f+4,void(i[n>>2]=i[f>>2]);case 1:return f=i[a>>2],i[a>>2]=f+4,f=i[f>>2],i[n>>2]=f,void(i[n+4>>2]=f>>31);case 2:return f=i[a>>2],i[a>>2]=f+4,i[n>>2]=i[f>>2],void(i[n+4>>2]=0);case 3:return f=i[a>>2]+7&-8,i[a>>2]=f+8,a=i[f+4>>2],i[n>>2]=i[f>>2],void(i[n+4>>2]=a);case 4:return f=i[a>>2],i[a>>2]=f+4,f=r2[f>>1],i[n>>2]=f,void(i[n+4>>2]=f>>31);case 5:return f=i[a>>2],i[a>>2]=f+4,i[n>>2]=L2[f>>1],void(i[n+4>>2]=0);case 6:return f=i[a>>2],i[a>>2]=f+4,f=p[0|f],i[n>>2]=f,void(i[n+4>>2]=f>>31);case 7:return f=i[a>>2],i[a>>2]=f+4,i[n>>2]=w[0|f],void(i[n+4>>2]=0);case 8:return f=i[a>>2]+7&-8,i[a>>2]=f+8,void(X[n>>3]=X[f>>3]);case 9:break f;default:break i}M[0](n,a)}}function G(n,f,a){var t=u(0),e=u(0),b=0,o=0,k=u(0),r=u(0),s=0,A=u(0),l=u(0);B=o=B+-64|0,s=(t=c[f+28>>2])>(e=c[n+28>>2]);i:{f:{if(!(!(c[n+32>>2]<=c[f+32>>2])|t!=e)||s){if((k=c[a+28>>2])>t|(c[f+32>>2]<=c[a+32>>2]?t==k:0))break i;if(b=1,s)break f}b=0,t==e&&(b=c[n+32>>2]<=c[f+32>>2])}s=b,b=1,(k=c[a+28>>2])>t||(b=0,t==k&&(b=c[f+32>>2]<=c[a+32>>2])),r=c[n+32>>2],A=c[f+32>>2],l=c[a+32>>2],X[o+40>>3]=k,X[o+24>>3]=t,X[o+48>>3]=l,X[o+32>>3]=A,X[o+16>>3]=r,X[o+8>>3]=e,i[o+4>>2]=b,i[o>>2]=s,R1(1092,o),k=c[a+28>>2],e=c[n+28>>2],t=c[f+28>>2]}return r=u(0),B=o- -64|0,e=u(t-e),t=u(k-t),u(e+t)>u(0)&&(r=e,e=c[f+32>>2],r=u(u(r*u(e-c[a+32>>2]))+u(t*u(e-c[n+32>>2])))),r}function a0(n,f,a){var t=0,e=0,b=0,o=0;t=i[f>>2];i:{if((0|f)!=(0|a))for(;;){if(p[f+15|0]=0,o=i[f+4>>2],b=i[i[o+8>>2]>>2],e=i[b>>2],i[e+16>>2]!=i[t+16>>2]){if(!w[b+15|0])return n=w[f+12|0],a=i[t+20>>2],i[a+8>>2]=t,p[a+21|0]=n,i[t+24>>2]=0,h2(o),j(f),t;if(!(e=d2(i[i[t+8>>2]+4>>2],i[e+4>>2]))||!$(i[b>>2]))break i;i[b>>2]=e,p[b+15|0]=0,i[e+24>>2]=b}if(i[t+8>>2]!=(0|e)&&(!z(i[i[e+4>>2]+12>>2],e)||!z(t,e)))break i;if(e=w[f+12|0],t=i[f>>2],o=i[t+20>>2],i[o+8>>2]=t,p[o+21|0]=e,i[t+24>>2]=0,h2(i[f+4>>2]),j(f),t=i[b>>2],(0|a)==(0|(f=b)))break}return t}b2(n+1740|0,1),o2()}function W2(n,f,a){switch(f-100100|0){case 0:return void(i[n+88>>2]=a||15);case 6:return void(i[n+1716>>2]=a||3);case 4:return p[n+80|0]=(0|a)!=0,void(i[n+92>>2]=a||14);case 10:return p[n+80|0]=(0|a)!=0,void(i[n+1720>>2]=a||4);case 1:return void(i[n+96>>2]=a||13);case 7:return void(i[n+1724>>2]=a||5);case 2:return void(i[n+100>>2]=a||12);case 8:return void(i[n+1728>>2]=a||6);case 3:return void(i[n+12>>2]=a||18);case 9:return void(i[n+1732>>2]=a||11);case 5:return void(i[n+76>>2]=a||17);case 11:return void(i[n+1736>>2]=a||8);case 12:return void(i[n+104>>2]=a||16)}(0|(f=i[n+1732>>2]))==11?M[i[n+12>>2]](100900):M[0|f](100900,i[n+1896>>2])}function Z(n,f,a){var t=0,e=0,b=0;if(!(32&w[0|n]))i:{e=f,t=a;f:{if(!(n=i[(f=n)+16>>2])){if(n=w[f+74|0],p[f+74|0]=n-1|n,8&(n=i[f>>2])?(i[f>>2]=32|n,n=-1):(i[f+4>>2]=0,i[f+8>>2]=0,n=i[f+44>>2],i[f+28>>2]=n,i[f+20>>2]=n,i[f+16>>2]=n+i[f+48>>2],n=0),n)break f;n=i[f+16>>2]}if(n-(b=i[f+20>>2])>>>0>>0){M[i[f+36>>2]](f,e,a);break i}a:if(!(p[f+75|0]<0)){for(n=a;;){if(t=n,!n)break a;if(w[e+(n=t-1|0)|0]==10)break}if(M[i[f+36>>2]](f,e,t)>>>0>>0)break f;e=t+e|0,a=a-t|0,b=i[f+20>>2]}c1(b,e,a),i[f+20>>2]=i[f+20>>2]+a}}}function p1(n,f,a,t){var e=0,b=0;B=e=B-208|0,i[e+204>>2]=a,v1(e+160|0,0,40),i[e+200>>2]=i[e+204>>2],(0|C0(0,f,e+200|0,e+80|0,e+160|0,t))<0||(i[n+76>>2],a=i[n>>2],p[n+74|0]<=0&&(i[n>>2]=-33&a),b=32&a,i[n+48>>2]?C0(n,f,e+200|0,e+80|0,e+160|0,t):(i[n+48>>2]=80,i[n+16>>2]=e+80,i[n+28>>2]=e,i[n+20>>2]=e,a=i[n+44>>2],i[n+44>>2]=e,C0(n,f,e+200|0,e+80|0,e+160|0,t),a&&(M[i[n+36>>2]](n,0,0),i[n+48>>2]=0,i[n+44>>2]=a,i[n+28>>2]=0,i[n+16>>2]=0,i[n+20>>2]=0)),i[n>>2]=i[n>>2]|b),B=e+208|0}function S4(n,f){n|=0;var a=0,t=0,e=0;if((0|(a=i[40+(f|=0)>>2]))!=(0|(t=f+40|0)))for(;;){if(w[a+21|0]){for((0|(f=i[n+1716>>2]))==3?M[i[n+88>>2]](2):M[0|f](2,i[n+1896>>2]),f=i[a+8>>2];(0|(e=i[n+1724>>2]))==5?M[i[n+96>>2]](i[i[f+16>>2]+12>>2]):M[0|e](i[i[f+16>>2]+12>>2],i[n+1896>>2]),(0|(f=i[f+12>>2]))!=i[a+8>>2];);(0|(f=i[n+1728>>2]))==6?M[i[n+100>>2]]():M[0|f](i[n+1896>>2])}if((0|t)==(0|(a=i[a>>2])))break}}function h1(n,f){if(!n)return 0;i:{f:{if(n){if(f>>>0<=127)break f;if(i[i[493]>>2]){if(f>>>0<=2047){p[n+1|0]=63&f|128,p[0|n]=f>>>6|192,n=2;break i}if(!((-8192&f)!=57344&&f>>>0>=55296)){p[n+2|0]=63&f|128,p[0|n]=f>>>12|224,p[n+1|0]=f>>>6&63|128,n=3;break i}if(f-65536>>>0<=1048575){p[n+3|0]=63&f|128,p[0|n]=f>>>18|240,p[n+2|0]=f>>>6&63|128,p[n+1|0]=f>>>12&63|128,n=4;break i}}else if((-128&f)==57216)break f;i[613]=25,n=-1}else n=1;break i}p[0|n]=f,n=1}return n}function M0(){var n=0,f=0,a=0;return(n=H(128))?(i[n+8>>2]=0,i[n+12>>2]=0,f=n+40|0,i[n+44>>2]=f,i[n+48>>2]=0,i[n+52>>2]=0,i[n+40>>2]=f,r2[n+54>>1]=0,r2[n+56>>1]=0,r2[n+58>>1]=0,r2[n+60>>1]=0,i[n+72>>2]=0,i[n+76>>2]=0,f=n+96|0,i[n+68>>2]=f,a=n- -64|0,i[n+64>>2]=a,i[n+80>>2]=0,i[n+84>>2]=0,i[n+88>>2]=0,i[n+92>>2]=0,i[n+104>>2]=0,i[n+108>>2]=0,i[n+100>>2]=a,i[n+96>>2]=f,i[n+112>>2]=0,i[n+116>>2]=0,i[n+120>>2]=0,i[n+124>>2]=0,i[n>>2]=n,i[n+4>>2]=n,0|n):0}function x4(n,f,a){n|=0,f|=0,a|=0;var t=0,e=0,b=u(0),o=u(0);return a=i[a>>2],t=i[i[a+4>>2]+16>>2],f=i[f>>2],(0|(e=i[i[f+4>>2]+16>>2]))==(0|(n=i[n+72>>2]))?(0|n)==(0|t)?(f=i[f+16>>2],b=c[f+28>>2],a=i[a+16>>2],o=c[a+28>>2],!(!(c[f+32>>2]<=c[a+32>>2])|b!=o)||b=u(0)|0):G(t,n,i[a+16>>2])<=u(0)|0:(f=i[f+16>>2],(0|n)==(0|t)?G(e,n,f)>=u(0)|0:C1(e,n,f)>=C1(i[i[a+4>>2]+16>>2],n,i[a+16>>2])|0)}function I0(n){var f=0,a=0,t=0,e=0,b=0,o=u(0),k=u(0),r=0;if(!(f=i[n+12>>2]))return l1(i[n>>2]);if(b=i[n+8>>2],t=i[i[(b+(f<<2)|0)-4>>2]>>2],a=i[n>>2],i[a+8>>2]&&(e=i[i[a+4>>2]+(i[i[a>>2]+4>>2]<<3)>>2],o=c[e+28>>2],k=c[t+28>>2],!(!(c[e+32>>2]<=c[t+32>>2])|o!=k)||o>2]=a,t;if(e=f<<2,f=r=f-1|0,i[i[(e+b|0)-8>>2]>>2])break}return i[n+12>>2]=r,t}function L4(n,f,a){f|=0,a|=0;var t=0,e=0,b=0,o=0;b=1;i:if((0|(t=i[64+(n|=0)>>2]))!=(0|(e=n- -64|0))){if(o=0-f|0,!a){for(;;)if(n=w[i[t+20>>2]+21|0],i[t+28>>2]=(0|n)==w[i[i[t+4>>2]+20>>2]+21|0]?0:n?f:o,(0|e)==(0|(t=i[t>>2])))break i}for(;;){if(n=i[t>>2],(0|(a=w[i[t+20>>2]+21|0]))==w[i[i[t+4>>2]+20>>2]+21|0]){if(!$(t)){b=0;break i}}else i[t+28>>2]=a?f:o;if((0|e)==(0|(t=n)))break}}return 0|b}function m1(n,f){var a=0,t=0,e=0;(a=H(16))&&(e=f0(i[n+8>>2]))&&(t=i[e+16>>2],c[t+32>>2]=f,i[t+28>>2]=2112929218,t=i[i[e+4>>2]+16>>2],c[t+32>>2]=f,i[t+28>>2]=-34554430,i[n+72>>2]=t,p[a+15|0]=0,p[a+12|0]=0,i[a+8>>2]=0,i[a>>2]=e,p[a+13|0]=1,p[a+14|0]=0,t=a,a=S0(e=i[n+64>>2],e,a),i[t+4>>2]=a,a)||(b2(n+1740|0,1),o2())}function _0(n){var f=0,a=0,t=0;if((0|(f=i[40+(n|=0)>>2]))!=(0|(a=n+40|0)))for(;t=i[f>>2],j(f),(0|a)!=(0|(f=t)););if((0|(f=i[n>>2]))!=(0|n))for(;t=i[f>>2],j(f),(0|(f=t))!=(0|n););if((0|(f=i[n+64>>2]))!=(0|(a=n- -64|0)))for(;t=i[f>>2],j(f),(0|a)!=(0|(f=t)););j(n)}function w1(n){var f=0,a=u(0),t=u(0);if(!(f=i[n+12>>2]))return n=i[n>>2],i[i[n+4>>2]+(i[i[n>>2]+4>>2]<<3)>>2];f=i[i[(i[n+8>>2]+(f<<2)|0)-4>>2]>>2],n=i[n>>2];i:{if(i[n+8>>2]&&(n=i[i[n+4>>2]+(i[i[n>>2]+4>>2]<<3)>>2],(a=c[n+28>>2])<(t=c[f+28>>2])||a==t&&c[n+32>>2]<=c[f+32>>2]))break i;n=f}return n}function P4(n,f,a,t){n|=0,f|=0,a|=0,t|=0,a=0;i:{if(f=i[520]){if(!((a=i[f>>2])>>>0<100001)){f=H(12);break i}}else f=H(1200008),i[f+4>>2]=12,i[f>>2]=0,i[520]=f;i[f>>2]=a+1,f=8+(W(a,12)+f|0)|0}c[f>>2]=c[n>>2],c[f+4>>2]=c[n+4>>2],c[f+8>>2]=c[n+8>>2],i[t>>2]=f}function q2(n,f,a){var t=0,e=0,b=0;if(f>>>0<1)t=n;else for(;t=A1(n,f,10),b=e=v2,e=x0(t,e,10,0),p[0|(a=a-1|0)]=n-e|48,e=f>>>0>9,n=t,f=b,e;);if(t)for(;n=(t>>>0)/10|0,p[0|(a=a-1|0)]=t-W(n,10)|48,f=t>>>0>9,t=n,f;);return a}function y1(n,f,a,t){var e=0,b=0,o=0;if(b=i[610]+1|0,i[610]=b,i[n>>2]=b,t)for(;;){if(!i[(o=(e<<3)+a|0)>>2])return i[o>>2]=b,i[4+(n=(e<<3)+a|0)>>2]=f,i[n+8>>2]=0,K(0|t),a;if((0|(e=e+1|0))==(0|t))break}return e=n,n=t<<1,f=y1(e,f,l0(a,t<<4|8),n),K(0|n),f}function g1(n,f){var a=0,t=0,e=0;if(g0(+n),a=0|l2(1),t=0|l2(0),e=a,(0|(a=a>>>20&2047))!=2047){if(!a)return a=f,n==0?f=0:(n=g1(18446744073709552e3*n,f),f=i[f>>2]+-64|0),i[a>>2]=f,n;i[f>>2]=a-1022,n1(0,0|t),n1(1,-2146435073&e|1071644672),n=+r4()}return n}function C1(n,f,a){var t=u(0),e=u(0),b=u(0),o=u(0),k=u(0);return t=c[f+28>>2],e=u(t-c[n+28>>2]),t=u(c[a+28>>2]-t),(b=u(e+t))>u(0)?(k=c[f+32>>2],o=c[((f=t>e)?n:a)+32>>2],t=u(u(k-o)+u(u((f?e:t)/b)*u(o-c[(f?a:n)+32>>2])))):t=u(0),t}function S0(n,f,a){for(var t=0;f=i[f+8>>2],(t=i[f>>2])&&!(0|M[i[n+16>>2]](i[n+12>>2],t,a)););return(n=H(12))?(i[n>>2]=a,i[n+4>>2]=i[f+4>>2],i[i[f+4>>2]+8>>2]=n,i[n+8>>2]=f,i[f+4>>2]=n,n):0}function x0(n,f,a,t){var e=0,b=0,o=0,k=0,r=0,s=0;return s=W(e=a>>>16|0,b=n>>>16|0),e=(65535&(b=((r=W(o=65535&a,k=65535&n))>>>16|0)+W(b,o)|0))+W(e,k)|0,v2=(W(f,a)+s|0)+W(n,t)+(b>>>16)+(e>>>16)|0,65535&r|e<<16}function i2(n,f,a,t,e){var b=0;if(B=b=B-256|0,!(73728&e|(0|a)<=(0|t))){if(v1(b,255&f,(t=(a=a-t|0)>>>0<256)?a:256),!t)for(;Z(n,b,256),(a=a-256|0)>>>0>255;);Z(n,b,a)}B=b+256|0}function J(n,f,a){var t=0,e=0;i:if(a)for(;;){if(!(e=i[(t<<3)+f>>2]))break i;if((0|n)==(0|e))return i[4+((t<<3)+f|0)>>2];if((0|(t=t+1|0))==(0|a))break}return 0}function T2(n){var f=0,a=0;return(n=(f=i[412])+(a=n+3&-4)|0)>>>0<=f>>>0&&a||n>>>0>M1()<<16>>>0&&!(0|l4(0|n))?(i[613]=48,-1):(i[412]=n,f)}function E1(n){var f=0,a=0,t=0;if(p[i[n>>2]]-48>>>0<10)for(;f=i[n>>2],t=p[0|f],i[n>>2]=f+1,a=(W(a,10)+t|0)-48|0,p[f+1|0]-48>>>0<10;);return a}function B4(n,f){n|=0;var a=0,t=0;(0|(a=i[4+(f|=0)>>2]))>2]&&(t=i[f>>2]+(W(i[f+12>>2],a)<<2)|0,c[t>>2]=c[n>>2],c[t+4>>2]=c[n+4>>2],i[f+4>>2]=a+1)}function j4(n,f){n|=0,f|=0;var a=u(0),t=u(0);if((a=c[n+28>>2])<(t=c[f+28>>2]))n=1;else{if(a!=t)return 0;n=c[n+32>>2]<=c[f+32>>2]}return 0|n}function L0(n){var f=0;(f=i[n>>2])&&(j(i[f+4>>2]),j(i[f>>2]),j(f)),(f=i[n+8>>2])&&j(f),(f=i[n+4>>2])&&j(f),j(n)}function T4(n){n|=0;var f=0;B=f=B-16|0,i[f>>2]=n,B=n=B-16|0,i[n+12>>2]=f,p1(i[288],1078,f,0),B=n+16|0,B=f+16|0}function F4(n,f,a){n|=0,f=i[20+(f|=0)>>2],i[f+16>>2]=i[n+84>>2],i[n+84>>2]=f,p[f+20|0]=1}function h2(n){var f=0;f=i[n+4>>2],i[f+8>>2]=i[n+8>>2],i[i[n+8>>2]+4>>2]=f,j(n)}function R1(n,f){var a=0;B=a=B-16|0,i[a+12>>2]=f,p1(i[288],n,f,43),B=a+16|0}function f2(n){var f=0;return(-1>>>(f=31&n)&-2)<>>n}function b2(n,f){n|=0,f|=0,i[611]||(i[612]=f,i[611]=n),v4()}function U4(n,f){n|=0,f|=0,i[611]||(i[612]=f,i[611]=n)}function O4(n,f,a,t){return v2=0,0}function D4(n,f,a,t,e){}function H4(n,f,a,t){}function Q4(n){return 0}function v0(n,f){}function W4(){return 0|B}function q4(n){B=n|=0}function R2(n){}function P0(){}S=w,a2();var M=x([null,F4,_4,v0,v0,v0,R2,M4,D4,j4,x4,v0,P0,R2,R2,R2,R2,H4,R2,E2,E4,M0,f0,n2,z,b1,b2,y4,L4,R4,S4,C4,r1,_0,B4,R2,P0,P4,T4,R2,Q4,I4,O4,g4]);function M1(){return N.byteLength/65536|0}function z4(n){n|=0;var f=0|M1(),a=f+n|0;if(f=x);)++S;if(S-g>16&&d.subarray&&z0)return z0.decode(d.subarray(g,S));for(var T="";g>10,56320|1023&t2)}}else T+=String.fromCharCode((31&O)<<6|D)}else T+=String.fromCharCode(O)}return T}function F1(d,g){return d?K0(J2,d,g):""}function U1(d,g){return d%g>0&&(d+=g-d%g),d}function Y0(d){G2=d,C.HEAP8=new Int8Array(d),C.HEAP16=new Int16Array(d),C.HEAP32=Z2=new Int32Array(d),C.HEAPU8=J2=new Uint8Array(d),C.HEAPU16=new Uint16Array(d),C.HEAPU32=new Uint32Array(d),C.HEAPF32=new Float32Array(d),C.HEAPF64=new Float64Array(d)}var p2,N0=C.INITIAL_MEMORY||4194304;(V2=C.wasmMemory?C.wasmMemory:new y2.Memory({initial:N0/65536,maximum:32768}))&&(G2=V2.buffer),N0=G2.byteLength,Y0(G2);var V0=[],G0=[],J0=[];function O1(){if(C.preRun)for(typeof C.preRun=="function"&&(C.preRun=[C.preRun]);C.preRun.length;)Q1(C.preRun.shift());m0(V0)}function D1(){m0(G0)}function H1(){if(C.postRun)for(typeof C.postRun=="function"&&(C.postRun=[C.postRun]);C.postRun.length;)q1(C.postRun.shift());m0(J0)}function Q1(d){V0.unshift(d)}function W1(d){G0.unshift(d)}function q1(d){J0.unshift(d)}var M2=0,X2=null;function z1(d){M2++,C.monitorRunDependencies&&C.monitorRunDependencies(M2)}function K1(d){if(M2--,C.monitorRunDependencies&&C.monitorRunDependencies(M2),M2==0&&X2){var g=X2;X2=null,g()}}function $2(d){throw C.onAbort&&C.onAbort(d),D2(d+=""),q0=!0,d="abort("+d+"). Build with -s ASSERTIONS=1 for more info.",new y2.RuntimeError(d)}C.preloadedImages={},C.preloadedAudios={};var e2,Z0="data:application/octet-stream;base64,";function h0(d){return d.startsWith(Z0)}function X0(d){return d.startsWith("file://")}function $0(d){try{if(d==e2&&H2)return new Uint8Array(H2);var g=Q2(d);if(g)return g;if(o0)return o0(d);throw"both async and sync fetching of the wasm failed"}catch(I){$2(I)}}function Y1(){if(!H2&&(Q0||N2)){if(typeof fetch=="function"&&!X0(e2))return fetch(e2,{credentials:"same-origin"}).then(function(d){if(!d.ok)throw"failed to load wasm binary file at '"+e2+"'";return d.arrayBuffer()}).catch(function(){return $0(e2)});if(e0)return new Promise(function(d,g){e0(e2,function(I){d(new Uint8Array(I))},g)})}return Promise.resolve().then(function(){return $0(e2)})}function N1(){var d={a:i1};function g(T,O){var D=T.exports;C.asm=D,p2=C.asm.q,W1(C.asm.n),K1()}function I(T){g(T.instance)}function x(T){return Y1().then(function(O){return y2.instantiate(O,d)}).then(T,function(O){D2("failed to asynchronously prepare wasm: "+O),$2(O)})}function S(){return H2||typeof y2.instantiateStreaming!="function"||h0(e2)||X0(e2)||typeof fetch!="function"?x(I):fetch(e2,{credentials:"same-origin"}).then(function(T){return y2.instantiateStreaming(T,d).then(I,function(O){return D2("wasm streaming compile failed: "+O),D2("falling back to ArrayBuffer instantiation"),x(I)})})}if(z1(),C.instantiateWasm)try{return C.instantiateWasm(d,g)}catch(T){return D2("Module.instantiateWasm callback failed with error: "+T),!1}return S(),{}}function m0(d){for(;d.length>0;){var g=d.shift();if(typeof g!="function"){var I=g.func;typeof I=="number"?g.arg===void 0?p2.get(I)():p2.get(I)(g.arg):I(g.arg===void 0?null:g.arg)}else g(C)}}function V1(){throw"longjmp"}function G1(d,g,I){J2.copyWithin(d,g,g+I)}function J1(d){try{return V2.grow(d-G2.byteLength+65535>>>16),Y0(V2.buffer),1}catch{}}function Z1(d){var g=J2.length,I=2147483648;if((d>>>=0)>I)return!1;for(var x=1;x<=4;x*=2){var S=g*(1+.2/x);if(S=Math.min(S,d+100663296),J1(Math.min(I,U1(Math.max(d,S),65536))))return!0}return!1}h0(e2="libtess-asm.wasm")||(e2=L1(e2));var b0={mappings:{},buffers:[null,[],[]],printChar:function(d,g){var I=b0.buffers[d];g===0||g===10?((d===1?P1:D2)(K0(I,0)),I.length=0):I.push(g)},varargs:void 0,get:function(){return b0.varargs+=4,Z2[b0.varargs-4>>2]},getStr:function(d){return F1(d)},get64:function(d,g){return d}};function X1(d,g,I,x){for(var S=0,T=0;T>2],D=Z2[g+(8*T+4)>>2],a2=0;a2>2]=S,0}function $1(d){for(var g=[],I=0;I255&&(x&=255),g.push(String.fromCharCode(x))}return g.join("")}var i4=typeof atob=="function"?atob:function(d){var g,I,x,S,T,O,D="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a2="",t2=0;d=d.replace(/[^A-Za-z0-9\+\/\=]/g,"");do g=D.indexOf(d.charAt(t2++))<<2|(S=D.indexOf(d.charAt(t2++)))>>4,I=(15&S)<<4|(T=D.indexOf(d.charAt(t2++)))>>2,x=(3&T)<<6|(O=D.indexOf(d.charAt(t2++))),a2+=String.fromCharCode(g),T!==64&&(a2+=String.fromCharCode(I)),O!==64&&(a2+=String.fromCharCode(x));while(t20||(O1(),M2>0||(C.setStatus?(C.setStatus("Running..."),setTimeout(function(){setTimeout(function(){C.setStatus("")},1),g()},1)):g()))}if(X2=function d(){k0||w0(),k0||(X2=d)},C.run=w0,C.preInit)for(typeof C.preInit=="function"&&(C.preInit=[C.preInit]);C.preInit.length>0;)C.preInit.pop()();w0();let y0=null,g2=null,x2=null,u0=null;const s2=u2.Module,u4=2,f1=4e3;let a1=0;const c4=(d,g,I)=>{y0||(y0=s2._triangulate);let x=s2.HEAPF32;const S=s2.HEAP32.BYTES_PER_ELEMENT,T=2,O=x.BYTES_PER_ELEMENT;I>a1&&(a1=I,x2&&(s2._free(x2),x2=0),g2&&(s2._free(g2),g2=0)),x2||(x2=s2._malloc(I*O)),u0||(u0=s2._malloc(f1*S));const D=I*u4;g2||(g2=s2._malloc(D*O)),x=s2.HEAPF32,x.set(d,x2/O),s2.HEAP32.set(g,u0/S);const a2=D/T,t2=y0(x2,u0,Math.min(g.length,f1),T,g2,a2),c0=t2*T;x=s2.HEAPF32;const r0=x.slice(g2/O,g2/O+c0),l2={};return l2.buffer=r0,l2.vertexCount=t2,l2};return u2.triangulate=c4,u2.whenLoaded()}return{load:z2}},(_1=I1())!==void 0&&(D0.exports=_1);var S1=H0.exports;const V4=Y4({__proto__:null,default:K4(S1)},[S1]);export{V4 as l}; diff --git a/dist/assets/loadGLTFMesh-g6BxZi9G.js b/dist/assets/loadGLTFMesh-g6BxZi9G.js deleted file mode 100644 index 1a6cc28..0000000 --- a/dist/assets/loadGLTFMesh-g6BxZi9G.js +++ /dev/null @@ -1,8 +0,0 @@ -import{mN as P,mO as z,mP as L,mQ as N,mR as D,bW as q,ld as O,mS as G,mT as Q,ab as B,mU as U,mV as V,mW as W,mX as K,mY as S,fB as A,mZ as X,m_ as C,m$ as Y,n0 as Z,n1 as k,n2 as H,n3 as v,n4 as J,n5 as ee,n6 as I,n7 as E,n8 as j,n9 as te,na as ne,nb as M,nc as F,nd as _,ne as re,nf as oe,fA as w,bi as se,b1 as ae,ng as le,nh as ue,ni as ie,ag as ce,nj as fe}from"./index-J0iiHjMT.js";function me(e,n,t){const u=e.typedBuffer,a=e.typedBufferStride,o=n.typedBuffer,c=n.typedBufferStride,l=t?t.count:n.count;let s=((t==null?void 0:t.dstIndex)??0)*a,f=((t==null?void 0:t.srcIndex)??0)*c;for(let i=0;il.set(h,Te(x))),o.materials.forEach((x,h)=>s.set(h,$e(x,l)));const f=xe(c);for(const x of f.parts)ye(f,x,s);const{position:i,normal:r,tangent:m,color:p,texCoord0:y}=f.vertexAttributes,b={position:i.typedBuffer,normal:r!=null?r.typedBuffer:null,tangent:m!=null?m.typedBuffer:null,uv:y!=null?y.typedBuffer:null,color:p!=null?p.typedBuffer:null},g=N(b,e,u);return{transform:g.transform,vertexSpace:g.vertexSpace,components:f.components,spatialReference:e.spatialReference,vertexAttributes:new D({position:g.vertexAttributes.position,normal:g.vertexAttributes.normal,tangent:g.vertexAttributes.tangent,color:b.color,uv:b.uv})}}function de(e){const n=e==null?void 0:e.resolveFile,t=e==null?void 0:e.requestFile;return n||t?{busy:!1,request:async(u,a,o)=>{const c=(n==null?void 0:n(u))??u;if(t){const s=await t(c,a,o==null?void 0:o.signal);if(s!==void 0)return s}return(await q(c,{responseType:a==="image"?"image":a==="binary"?"array-buffer":"json",signal:o!=null?o.signal:null})).data}}:null}function $(e,n){if(e==null)return"-";const t=e.typedBuffer;return`${O(n,t.buffer,()=>n.size)}/${t.byteOffset}/${t.byteLength}`}function ge(e){return e!=null?e.toString():"-"}function xe(e){let n=0;const t={color:!1,tangent:!1,normal:!1,texCoord0:!1},u=new Map,a=new Map,o=[];for(const c of e.parts){const{attributes:{position:l,normal:s,color:f,tangent:i,texCoord0:r}}=c,m=` - ${$(l,u)}/ - ${$(s,u)}/ - ${$(f,u)}/ - ${$(i,u)}/ - ${$(r,u)}/ - ${ge(c.transform)} - `;let p=!1;const y=O(a,m,()=>(p=!0,{start:n,length:l.count}));p&&(n+=l.count),s&&(t.normal=!0),f&&(t.color=!0),i&&(t.tangent=!0),r&&(t.texCoord0=!0),o.push({gltf:c,writeVertices:p,region:y})}return{vertexAttributes:{position:T(le,n),normal:t.normal?T(F,n):null,tangent:t.tangent?T(I,n):null,color:t.color?T(j,n):null,texCoord0:t.texCoord0?T(ue,n):null},parts:o,components:[]}}function Te(e){return new G({data:(Q(e.data),e.data),wrap:ve(e.parameters.wrap)})}function $e(e,n){const t=new B(we(e.color,e.opacity)),u=e.emissiveFactor?new B(Be(e.emissiveFactor)):null,a=o=>o?new ie({scale:o.scale?[o.scale[0],o.scale[1]]:[1,1],rotation:ce(o.rotation??0),offset:o.offset?[o.offset[0],o.offset[1]]:[0,0]}):null;return new U({color:t,colorTexture:n.get(e.textureColor),normalTexture:n.get(e.textureNormal),emissiveColor:u,emissiveTexture:n.get(e.textureEmissive),occlusionTexture:n.get(e.textureOcclusion),alphaMode:he(e.alphaMode),alphaCutoff:e.alphaCutoff,doubleSided:e.doubleSided,metallic:e.metallicFactor,roughness:e.roughnessFactor,metallicRoughnessTexture:n.get(e.textureMetallicRoughness),colorTextureTransform:a(e.colorTextureTransform),normalTextureTransform:a(e.normalTextureTransform),occlusionTextureTransform:a(e.occlusionTextureTransform),emissiveTextureTransform:a(e.emissiveTextureTransform),metallicRoughnessTextureTransform:a(e.metallicRoughnessTextureTransform)})}function ye(e,n,t){n.writeVertices&&be(e,n);const{indices:u,attributes:a,primitiveType:o,material:c}=n.gltf;let l=V(u||a.position.count,o);const s=n.region.start;if(s){const f=new Uint32Array(l);for(let i=0;il.set(v,Te(x))),o.materials.forEach((x,v)=>s.set(v,$e(x,l)));const f=xe(c);for(const x of f.parts)ye(f,x,s);const{position:i,normal:r,tangent:m,color:p,texCoord0:y}=f.vertexAttributes,b={position:i.typedBuffer,normal:r!=null?r.typedBuffer:null,tangent:m!=null?m.typedBuffer:null,uv:y!=null?y.typedBuffer:null,color:p!=null?p.typedBuffer:null},g=q(b,e,u);return{transform:g.transform,vertexSpace:g.vertexSpace,components:f.components,spatialReference:e.spatialReference,vertexAttributes:new D({position:g.vertexAttributes.position,normal:g.vertexAttributes.normal,tangent:g.vertexAttributes.tangent,color:b.color,uv:b.uv})}}function de(e){const t=e==null?void 0:e.resolveFile,n=e==null?void 0:e.requestFile;return t||n?{busy:!1,request:async(u,a,o)=>{const c=(t==null?void 0:t(u))??u;if(n){const s=await n(c,a,o==null?void 0:o.signal);if(s!==void 0)return s}return(await N(c,{responseType:a==="image"?"image":a==="binary"?"array-buffer":"json",signal:o!=null?o.signal:null})).data}}:null}function $(e,t){if(e==null)return"-";const n=e.typedBuffer;return`${O(t,n.buffer,()=>t.size)}/${n.byteOffset}/${n.byteLength}`}function ge(e){return e!=null?e.toString():"-"}function xe(e){let t=0;const n={color:!1,tangent:!1,normal:!1,texCoord0:!1},u=new Map,a=new Map,o=[];for(const c of e.parts){const{attributes:{position:l,normal:s,color:f,tangent:i,texCoord0:r}}=c,m=` + ${$(l,u)}/ + ${$(s,u)}/ + ${$(f,u)}/ + ${$(i,u)}/ + ${$(r,u)}/ + ${ge(c.transform)} + `;let p=!1;const y=O(a,m,()=>(p=!0,{start:t,length:l.count}));p&&(t+=l.count),s&&(n.normal=!0),f&&(n.color=!0),i&&(n.tangent=!0),r&&(n.texCoord0=!0),o.push({gltf:c,writeVertices:p,region:y})}return{vertexAttributes:{position:T(le,t),normal:n.normal?T(F,t):null,tangent:n.tangent?T(I,t):null,color:n.color?T(j,t):null,texCoord0:n.texCoord0?T(ue,t):null},parts:o,components:[]}}function Te(e){return new G({data:(W(e.data),e.data),wrap:he(e.parameters.wrap)})}function $e(e,t){const n=new B(we(e.color,e.opacity)),u=e.emissiveFactor?new B(Be(e.emissiveFactor)):null,a=o=>o?new ie({scale:o.scale?[o.scale[0],o.scale[1]]:[1,1],rotation:ce(o.rotation??0),offset:o.offset?[o.offset[0],o.offset[1]]:[0,0]}):null;return new k({color:n,colorTexture:t.get(e.textureColor),normalTexture:t.get(e.textureNormal),emissiveColor:u,emissiveTexture:t.get(e.textureEmissive),occlusionTexture:t.get(e.textureOcclusion),alphaMode:ve(e.alphaMode),alphaCutoff:e.alphaCutoff,doubleSided:e.doubleSided,metallic:e.metallicFactor,roughness:e.roughnessFactor,metallicRoughnessTexture:t.get(e.textureMetallicRoughness),colorTextureTransform:a(e.colorTextureTransform),normalTextureTransform:a(e.normalTextureTransform),occlusionTextureTransform:a(e.occlusionTextureTransform),emissiveTextureTransform:a(e.emissiveTextureTransform),metallicRoughnessTextureTransform:a(e.metallicRoughnessTextureTransform)})}function ye(e,t,n){t.writeVertices&&be(e,t);const{indices:u,attributes:a,primitiveType:o,material:c}=t.gltf;let l=K(u||a.position.count,o);const s=t.region.start;if(s){const f=new Uint32Array(l);for(let i=0;io.set(e,n)))}function i(e){o.get(e)()}function s(e){return a.get(e)}async function p(e){return await s(e),t(e),new Promise(n=>requestAnimationFrame(()=>n()))}export{i as a,p as c,c as s}; diff --git a/dist/assets/loadable-uNbe2Ndt.js b/dist/assets/loadable-uNbe2Ndt.js new file mode 100644 index 0000000..18f4828 --- /dev/null +++ b/dist/assets/loadable-uNbe2Ndt.js @@ -0,0 +1,5 @@ +import{aY as t}from"./index-pCX-0tJH.js";/*! + * All material copyright ESRI, All Rights Reserved, unless otherwise specified. + * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. + * v1.11.0 + */const n=new WeakMap,o=new WeakMap;function i(e){o.set(e,new Promise(a=>n.set(e,a)))}function p(e){n.get(e)()}function s(e){return o.get(e)}async function c(e){return await s(e),t(e),new Promise(a=>requestAnimationFrame(()=>a()))}export{p as a,c,i as s}; diff --git a/dist/assets/loader-QqciGs1c.js b/dist/assets/loader-plQ4Tft5.js similarity index 98% rename from dist/assets/loader-QqciGs1c.js rename to dist/assets/loader-plQ4Tft5.js index 85f90aa..177779d 100644 --- a/dist/assets/loader-QqciGs1c.js +++ b/dist/assets/loader-plQ4Tft5.js @@ -1,4 +1,4 @@ -import{q as y,H as b,t as e,x}from"./index-J0iiHjMT.js";import{g as w}from"./guid-6vN-YNJI.js";/*! +import{p as y,H as b,k as e,l as x}from"./index-pCX-0tJH.js";import{g as w}from"./guid-6vN-YNJI.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/locale-pfkq1d6A.js b/dist/assets/locale-tKMV0J87.js similarity index 98% rename from dist/assets/locale-pfkq1d6A.js rename to dist/assets/locale-tKMV0J87.js index 3f5b814..7b887a9 100644 --- a/dist/assets/locale-pfkq1d6A.js +++ b/dist/assets/locale-tKMV0J87.js @@ -1,4 +1,4 @@ -import{cl as O,cm as v}from"./index-J0iiHjMT.js";import{n as I}from"./key-qdHumIlA.js";import{c as L}from"./observers-JyBmMU24.js";/*! +import{aW as O,aX as v}from"./index-pCX-0tJH.js";import{n as I}from"./key-qdHumIlA.js";import{c as L}from"./observers-eNe735aq.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/manipulatorUtils-165rCtzd.js b/dist/assets/manipulatorUtils-165rCtzd.js new file mode 100644 index 0000000..48c8990 --- /dev/null +++ b/dist/assets/manipulatorUtils-165rCtzd.js @@ -0,0 +1 @@ +import{bl as l,a0 as a}from"./index-pCX-0tJH.js";function u(r,n=l(r)){return n.mode!=="on-the-ground"&&!(r.geometry==null||!r.geometry.hasZ)}function m(r,n){let e=null;const t=r.events.on("grab-changed",o=>{e!=null&&(e.remove(),e=null),o.action==="start"&&(e=r.disableDisplay()),n&&n(o)});return a(()=>{e==null||e.remove(),t.remove()})}export{u as n,m as t}; diff --git a/dist/assets/manipulatorUtils-1y2yxq3d.js b/dist/assets/manipulatorUtils-1y2yxq3d.js deleted file mode 100644 index bf080ef..0000000 --- a/dist/assets/manipulatorUtils-1y2yxq3d.js +++ /dev/null @@ -1 +0,0 @@ -import{aP as a,a2 as l}from"./index-J0iiHjMT.js";function u(r,n=a(r)){return n.mode!=="on-the-ground"&&!(r.geometry==null||!r.geometry.hasZ)}function m(r,n){let e=null;const t=r.events.on("grab-changed",o=>{e!=null&&(e.remove(),e=null),o.action==="start"&&(e=r.disableDisplay()),n&&n(o)});return l(()=>{e==null||e.remove(),t.remove()})}export{u as n,m as t}; diff --git a/dist/assets/measurementUtils-69EiqRp6.js b/dist/assets/measurementUtils-69EiqRp6.js new file mode 100644 index 0000000..72db9ad --- /dev/null +++ b/dist/assets/measurementUtils-69EiqRp6.js @@ -0,0 +1 @@ +import{ci as o,cj as r,ck as s,cl as t}from"./index-pCX-0tJH.js";function m(c){const a=o(c),n=a===s?t:a;return r(c,n)?n:c}export{m as i}; diff --git a/dist/assets/measurementUtils-84-ZBArh.js b/dist/assets/measurementUtils-84-ZBArh.js deleted file mode 100644 index 38fd223..0000000 --- a/dist/assets/measurementUtils-84-ZBArh.js +++ /dev/null @@ -1 +0,0 @@ -import{cs as a,ct as n,cu as o,cv as r}from"./index-J0iiHjMT.js";function m(c){const s=a(c),t=s===o?r:s;return n(c,t)?t:c}export{m as i}; diff --git a/dist/assets/measurementUtils-St7B-HxA.js b/dist/assets/measurementUtils-St7B-HxA.js deleted file mode 100644 index cb24548..0000000 --- a/dist/assets/measurementUtils-St7B-HxA.js +++ /dev/null @@ -1 +0,0 @@ -import{l as G,ar as k,aa as l,as as x,at as b,au as v,av as y,aw as z,ax as M,ay as w,az as C,aA as m,aB as P,aC as h,aD as E,aE as g,aF as d,aG as R,aH as q}from"./index-J0iiHjMT.js";function W(t,n){const e=n.center;x(e,0,0,0);for(let a=0;a{if(o[0]===0&&o[1]===0&&o[2]===0)return!1;for(let c=0;c{if(o[0]===0&&o[1]===0&&o[2]===0)return!1;for(let l=0;limport("./loadGLTFMesh-lqLpAMsK.js"),__vite__mapDeps([0,1,2])),n),o=await Ht(r,n);fe(n);const i=s(new F({x:0,y:0,z:0,spatialReference:e.spatialReference}),o.url,{resolveFile:Yt(o),requestFile:void 0,useTransform:!0,signal:n==null?void 0:n.signal,expectedType:o.type});i.then(()=>o.dispose(),()=>o.dispose());const{vertexAttributes:l,components:c}=await i;e.vertexAttributes=l,e.components=c}function Yt(e){const t=ot(e.url);return n=>{const r=it(n,t,t),s=r?r.replace(/^ *\.\//,""):null;return(s?e.files.get(s):null)??n}}async function Ht(e,t){if(Array.isArray(e)){if(!e.length)throw new R("mesh-load-external:missing-assets","There must be at least one file to load");return e[0]instanceof File?Qt(e):en(e,t)}return Ge(e)}async function Kt(e,t){const{parts:n,assetMimeType:r,assetName:s}=e;if(n.length===1)return new ne(n[0].partUrl);const o=await e.toBlob(t);return fe(t),ne.fromBlob(o,Ye(s,r))}function Ge(e){return ne.fromBlob(e,Ye(e.name,e.type))}function Qt(e){return Je(e.map(t=>({name:t.name,mimeType:t.type,source:Ge(t)})))}async function en(e,t){const n=await at(e.map(async r=>{const s=await Kt(r);return fe(t),{name:r.assetName,mimeType:r.assetMimeType,source:s}}));if(lt(t))throw n.forEach(r=>r.source.dispose()),ct();return Je(n)}const We=/^model\/gltf\+json$/,Ze=/^model\/gltf-binary$/,ce=/\.gltf$/i,tn=/\.glb$/i;function Je(e){const t=new Map;let n,r=null;for(const{name:s,mimeType:o,source:i}of e)r===null&&(We.test(o)||ce.test(s)?(r=i.url,n="gltf"):(Ze.test(o)||tn.test(s))&&(r=i.url,n="glb")),t.set(s,i.url),i.files.forEach((l,c)=>t.set(c,l));if(r==null)throw new R("mesh-load-external:missing-files","Missing files to load external mesh source");return new ne(r,()=>e.forEach(({source:s})=>s.dispose()),t,n)}let ne=class Xe{constructor(t,n=()=>{},r=new Map,s){this.url=t,this.dispose=n,this.files=r,this.type=s}static fromBlob(t,n){const r=URL.createObjectURL(t);return new Xe(r,()=>URL.revokeObjectURL(r),void 0,n)}};function Ye(e,t){return We.test(t)||ce.test(e)?"gltf":Ze.test(t)||ce.test(e)?"glb":void 0}let _=class extends ut{constructor(){super(),this.externalSources=new pt,this._explicitDisplaySource=null,this.addHandles(ft(()=>this.externalSources,"after-remove",({item:e})=>{e===this._explicitDisplaySource&&(this._explicitDisplaySource=null)},{sync:!0,onListenerRemove:()=>this._explicitDisplaySource=null}))}get displaySource(){return this._explicitDisplaySource??this._implicitDisplaySource}set displaySource(e){if(e!=null&&!be(e))throw new Error("Cannot use this source for display: it is not in a supported format.");this._explicitDisplaySource=e,e&&this.externalSources.every(t=>!Ot(t,e))&&this.externalSources.add(e)}clearSources(){this.externalSources.removeAll()}getExternalSourcesOnService(e){return this.externalSources.items.filter(t=>Dt(t,e))}get _implicitDisplaySource(){return this.externalSources.find(be)}};d([x()],_.prototype,"externalSources",void 0),d([x()],_.prototype,"displaySource",null),d([x()],_.prototype,"_implicitDisplaySource",null),d([x()],_.prototype,"_explicitDisplaySource",void 0),_=d([Te("esri.geometry.support.meshUtils.Metadata")],_);const nn="esri.geometry.support.meshUtils.offset";function rn(e,t,n){var s;if(!((s=e.vertexAttributes)!=null&&s.position))return;const{vertexSpace:r}=e;r.isRelative?(se(r,nn,n),sn(r,t)):oe(e.spatialReference,n)?on(e,t):an(e,t)}function sn(e,t){const n=e.origin;e.origin=ie(y(),n,t)}function on(e,t){const n=e.spatialReference,r=e.vertexAttributes.position,s=e.vertexAttributes.normal,o=e.vertexAttributes.tangent,i=new Float64Array(r.length),l=s!=null?new Float32Array(s.length):null,c=o!=null?new Float32Array(o.length):null,a=e.extent.center,u=ln;Ce(n,[a.x,a.y,a.z],Re,he(n)),ke(Fe,Re),Q(u,t,Fe),me(r,n,i),s!=null&&l!=null&&ge(s,r,i,n,l),o!=null&&c!=null&&de(o,r,i,n,c),He(i,u),xe(i,r,n),s!=null&&l!=null&&ye(l,r,i,n,s),o!=null&&c!=null&&we(c,r,i,n,o),e.vertexAttributesChanged()}function an(e,t){He(e.vertexAttributes.position,t),e.vertexAttributesChanged()}function He(e,t){if(e)for(let n=0;n=o&&u=4,A=h===2||h===4,j=M?n-1:n;for(let $=0;$<=j;$++){const b=$/j*2*Math.PI,E=M?0:.5;g[0]=E*Math.sin(b),g[1]=E*-Math.cos(b),g[2]=h<=2?.5:-.5;for(let O=0;O<3;O++)s[c++]=g[O],o[a++]=B?O===2?h<=1?1:-1:0:O===2?0:g[O]/E;i[u++]=($+(M?.5:0))/n,i[u++]=h<=1?1*h/3:h<=3?1*(h-2)/3+1/3:1*(h-4)/3+2/3,A||h===0||$===n||(h!==5&&(l[p++]=f,l[p++]=f+1,l[p++]=f-n),h!==1&&(l[p++]=f,l[p++]=f-n,l[p++]=f-n-1)),f++}}return{position:s,normal:o,uv:i,faces:l}}function hn(e,t){const n=typeof t=="number"?t:t!=null?t.width:1,r=typeof t=="number"?t:t!=null?t.height:1;switch(e){case"up":case"down":return{width:n,depth:r};case"north":case"south":return{width:n,height:r};case"east":case"west":return{depth:n,height:r}}}function mn(e){const t=W.facingAxisOrderSwap[e],n=W.position,r=W.normal,s=new Float64Array(n.length),o=new Float32Array(r.length);let i=0;for(let l=0;l<4;l++){const c=i;for(let a=0;a<3;a++){const u=t[a],p=Math.abs(u)-1,f=u>=0?1:-1;s[i]=n[c+p]*f,o[i]=r[c+p]*f,i++}}return{position:s,normal:o,uv:new Float32Array(W.uv),faces:new Uint32Array(W.faces),isPlane:!0}}const T=1,C=2,k=3,W={position:[-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0],normal:[0,0,1,0,0,1,0,0,1,0,0,1],uv:[0,1,1,1,1,0,0,0],faces:[0,1,2,0,2,3],facingAxisOrderSwap:{east:[k,T,C],west:[-k,-T,C],north:[-T,k,C],south:[T,-k,C],up:[T,C,k],down:[T,-C,-k]}};function X(e,t,n){e.isPlane||gn(e),dn(e,n==null?void 0:n.size);const{vertexAttributes:r,vertexSpace:s,transform:o}=ht(e,t,n);return{vertexAttributes:new ee({...r,uv:e.uv}),vertexSpace:s,transform:o,components:[new U({faces:e.faces,material:(n==null?void 0:n.material)||null})],spatialReference:t.spatialReference}}function gn(e){for(let t=0;timport("./zipjs-wrapper-Ui4c_elP.js"),__vite__mapDeps([])),s=[];return(await new n(new t(e)).getEntries()).forEach(i=>{var a;if(i.directory||/^__MACOS/i.test(i.filename))return;const l=new r,c=(a=i.getData)==null?void 0:a.call(i,l).then(u=>new File([u],i.filename));c&&s.push(c)}),Promise.all(s)}var v;const P="esri.geometry.Mesh",Ln={base:null,key:"type",defaultKeyValue:"georeferenced",typeMap:{georeferenced:le,"georeferenced-relative":Ue,local:te}};let w=v=class extends wt.LoadableMixin(vt($t)){constructor(e){super(e),this.components=null,this.vertexSpace=new le,this.transform=null,this.metadata=new _,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new ee,this.type="mesh"}initialize(){(this.metadata.externalSources.length===0||this.vertexAttributes.position.length)&&(this.loadStatus="loaded"),this.when(()=>{this.addHandles(At(()=>{var e;return{vertexAttributes:this.vertexAttributes,components:(e=this.components)==null?void 0:e.map(t=>t.clone())}},()=>this._clearSources(),{once:!0,sync:!0}))})}get hasExtent(){var e;return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):((e=this.metadata.displaySource)==null?void 0:e.extent)!=null}get _transformedExtent(){const{components:e,spatialReference:t,vertexAttributes:n,vertexSpace:r}=this,s=n.position;if(s.length===0||e&&e.length===0)return new pe({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0,spatialReference:t});if(r.type==="local"){const{_untransformedExtent:o,transform:i}=this;return Ut(o,i,r,t)}if(r.type==="georeferenced-relative"){const{transform:o}=this,i=Oe({positions:s,transform:o,vertexSpace:r,inSpatialReference:t,outSpatialReference:t});return H(i,t)}return H(s,t)}get _untransformedExtent(){return H(this.vertexAttributes.position,this.spatialReference)}get anchor(){const{vertexSpace:e}=this;if(e.isRelative)return e.getOriginPoint(this.spatialReference);const{center:t,zmin:n}=this._transformedExtent;return new F({x:t.x,y:t.y,z:n,spatialReference:this.spatialReference})}get origin(){const{vertexSpace:e}=this;return e.isRelative?e.getOriginPoint(this.spatialReference):this._transformedExtent.center}get extent(){var e,t;return this.loaded||((t=(e=this.metadata)==null?void 0:e.displaySource)==null?void 0:t.extent)==null?this._transformedExtent:this.metadata.displaySource.extent.clone()}addComponent(e){if(!this.loaded)return m.getLogger(this).error("addComponent()",new G().message);this.components||(this.components=[]),this.components.push(U.from(e)),this.notifyChange("components")}removeComponent(e){if(!this.loaded)return m.getLogger(this).error("removeComponent()",new G().message);if(this.components){const t=this.components.indexOf(e);if(t!==-1)return this.components.splice(t,1),void this.notifyChange("components")}m.getLogger(this).error("removeComponent()",new kt().message)}rotate(e,t,n,r){return bt(e,t,n,_e),wn(this,_e,r),this}offset(e,t,n,r){return this.loaded?(Y[0]=e,Y[1]=t,Y[2]=n,rn(this,Y,r),this):(m.getLogger(this).error("offset()",new G().message),this)}scale(e,t){return this.loaded?(bn(this,e,t),this):(m.getLogger(this).error("scale()",new G().message),this)}centerAt(e,t){return this.loaded?(Vt(this,e,t),this):(m.getLogger(this).error("centerAt()",new G().message),this)}load(e){const{metadata:{displaySource:t}}=this;return t&&this.addResolvingPromise(Xt(this,t,e)),Promise.resolve(this)}addExternalSources(e){this.metadata.externalSources.addMany(e)}updateDisplaySource(e){this.metadata.displaySource=e}clone(){return this.cloneWithVertexSpace(this.vertexSpace.clone())}cloneWithVertexSpace(e){var r;let t=null;if(this.components){const s=new Map,o=new Map;t=this.components.map(i=>i.cloneWithDeduplication(s,o))}const n={components:t,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes.clone(),vertexSpace:e,transform:((r=this.transform)==null?void 0:r.clone())??null,metadata:this.metadata.clone()};return new v(n)}cloneShallow(){return new v({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange("vertexAttributes")}async toBinaryGLTF(e){const t=K(()=>import("./gltfexport-W1GDjMOr.js"),__vite__mapDeps([3,1,2])),n=this.load(),r=await Promise.all([t,n]),{toBinaryGLTF:s}=r[0];return s(this,e)}get memoryUsage(){let e=0;if(e+=this.vertexAttributes.memoryUsage,this.components!=null)for(const t of this.components)e+=t.memoryUsage;return e}_clearSources(){this.metadata.clearSources()}static createBox(e,t){if(!(e instanceof F))return m.getLogger(P).error(".createBox()",new D().message),null;const n=new v(X(cn(),e,t));return t!=null&&t.imageFace&&t.imageFace!=="all"?un(n,t.imageFace):n}static createSphere(e,t){return e instanceof F?new v(X(pn((t==null?void 0:t.densificationFactor)||0),e,t)):(m.getLogger(P).error(".createSphere()",new D().message),null)}static createCylinder(e,t){return e instanceof F?new v(X(fn((t==null?void 0:t.densificationFactor)||0),e,t)):(m.getLogger(P).error(".createCylinder()",new D().message),null)}static createPlane(e,t){if(!(e instanceof F))return m.getLogger(P).error(".createPlane()",new D().message),null;const n=(t==null?void 0:t.facing)??"up",r=hn(n,t==null?void 0:t.size);return new v(X(mn(n),e,{...t,size:r}))}static createFromPolygon(e,t){if(!(e instanceof St))return m.getLogger(P).error(".createFromPolygon()",new qt().message),null;const n=Rt(e);return new v({vertexAttributes:new ee({position:n.position}),components:[new U({faces:n.faces,shading:"flat",material:(t==null?void 0:t.material)??null})],spatialReference:e.spatialReference,vertexSpace:new le})}static async createFromGLTF(e,t,n){if(!(e instanceof F)){const s=new D;throw m.getLogger(P).error(".createfromGLTF()",s.message),s}const{loadGLTFMesh:r}=await De(K(()=>import("./loadGLTFMesh-lqLpAMsK.js"),__vite__mapDeps([0,1,2])),n);return new v(await r(e,t,n))}static async createFromFiles(e,t,n){const r=a=>m.getLogger(P).error(".createFromFiles()",a.message);if(!(e instanceof F)){const a=new D;throw r(a),a}const s=n==null?void 0:n.layer;if(!s){const a=new zt;throw r(a),a}const o=await v.extractAndFilterFiles(t,s),i=o.reduce((a,u)=>Ft(s.infoFor3D,u)?a+1:a,0);if(i===0){const a=new It;throw r(a),a}if(i>1){const a=new Nt;throw r(a),a}const l=v.createWithExternalSource(e,o),[c]=await s.uploadAssets([l],n);return c}static async extractAndFilterFiles(e,t){const n=t==null?void 0:t.infoFor3D;return n?(await Mn(e)).filter(r=>Mt(n,r)):e}static createWithExternalSource(e,t,n){var f;const r=(n==null?void 0:n.extent)??null,{x:s,y:o,z:i,spatialReference:l}=e,c=((f=n==null?void 0:n.transform)==null?void 0:f.clone())??new V,a=(n==null?void 0:n.vertexSpace)??new te({origin:[s,o,i??0]}),u={source:t,extent:r},p=new _;return p.externalSources.push(u),new v({metadata:p,transform:c,vertexSpace:a,spatialReference:l})}static createIncomplete(e,t){var a;const{x:n,y:r,z:s,spatialReference:o}=e,i=((a=t==null?void 0:t.transform)==null?void 0:a.clone())??new V,l=(t==null?void 0:t.vertexSpace)??new te({origin:[n,r,s??0]}),c=new v({transform:i,vertexSpace:l,spatialReference:o});return c.addResolvingPromise(Promise.reject(new R("mesh-incomplete","Mesh resources are not complete"))),c}};d([x({type:[U],json:{write:!0}})],w.prototype,"components",void 0),d([x({nonNullable:!0,types:Ln,constructOnly:!0,json:{write:!0}})],w.prototype,"vertexSpace",void 0),d([x({type:V,json:{write:!0}})],w.prototype,"transform",void 0),d([x({constructOnly:!0})],w.prototype,"metadata",void 0),d([x()],w.prototype,"hasExtent",null),d([x()],w.prototype,"_transformedExtent",null),d([x()],w.prototype,"_untransformedExtent",null),d([x()],w.prototype,"anchor",null),d([x()],w.prototype,"origin",null),d([x({readOnly:!0,json:{read:!1}})],w.prototype,"extent",null),d([x({readOnly:!0,json:{read:!1,write:!0,default:!0}})],w.prototype,"hasZ",void 0),d([x({readOnly:!0,json:{read:!1,write:!0,default:!1}})],w.prototype,"hasM",void 0),d([x({type:ee,nonNullable:!0,json:{write:!0}})],w.prototype,"vertexAttributes",void 0),w=v=d([Te(P)],w);const Y=y(),_e=$e(),je=w,ue=()=>m.getLogger("esri.rest.support.meshFeatureSet");function Bn(e,t,n){const r=n.features;n.features=[],delete n.geometryType;const s=Et.fromJSON(n);if(s.geometryType="mesh",!n.assetMaps)return s;const o=Dn(t,n.assetMaps),i=e.sourceSpatialReference??Lt.WGS84,l=n.globalIdFieldName,{outFields:c}=e,a=c!=null&&c.length>0?Pn(c.includes("*")?null:new Set(c)):()=>({});for(const u of r){const p=_n(u,l,i,t,o);p!=null&&s.features.push(new Pt({geometry:p,attributes:a(u)}))}return s}function Pn(e){return({attributes:t})=>{if(!t)return{};if(!e)return t;for(const n in t)e.has(n)||delete t[n];return t}}function _n(e,t,n,r,s){const o=e.attributes[t],i=s.get(o);if(i==null)return ue().error("mesh-feature-set:asset-not-found","Service returned a feature which was not found in the asset map",e),null;if(!e.geometry)return ue().error("mesh-feature-set:no-geometry","Service returned a feature without geometry",e),null;const{originPoint:l,originVector:c}=jn(e,n,r),a=pe.fromJSON(e.geometry);a.spatialReference=n;const u=On(e.attributes,r),p=i.projectVertices?new Ue({origin:c}):new te({origin:c}),f=Tn(i);return f?je.createWithExternalSource(l,f,{extent:a,transform:u,vertexSpace:p}):je.createIncomplete(l,{extent:a,transform:u,vertexSpace:p})}function jn({attributes:e},t,{transformFieldRoles:n}){const r=e[n.originX],s=e[n.originY],o=e[n.originZ];return{originPoint:new F({x:r,y:s,z:o,spatialReference:t}),originVector:_t(r,s,o)}}function On(e,{transformFieldRoles:t}){return new V({translation:[e[t.translationX],-e[t.translationZ],e[t.translationY]],rotationAxis:[e[t.rotationX],-e[t.rotationZ],e[t.rotationY]],rotationAngle:e[t.rotationDeg],scale:[e[t.scaleX],e[t.scaleZ],e[t.scaleY]]})}var N;function Dn(e,t){const n=new Map;for(const r of t){const s=r.parentGlobalId;if(s==null)continue;const o=r.assetName,i=r.assetType,l=r.assetHash,c=r.assetURL,a=r.conversionStatus,u=r.seqNo,p=jt(i,e.supportedFormats);if(!p){ue().error("mesh-feature-set:unknown-format",`Service returned an asset of type ${i}, but it does not list it as a supported type`);continue}const f=Ae(n,s,()=>({projectVertices:kn(r.flags).projectVertices,files:new Map}));Ae(f.files,o,()=>({name:o,type:i,mimeType:p,status:Cn(a),parts:[]})).parts[u]={hash:l,url:c}}return n}function Tn(e){const t=Array.from(e.files.values()),n=new Array;for(const r of t){if(r.status!==N.COMPLETED)return null;const s=new Array;for(const o of r.parts){if(!o)return null;s.push(new Tt(o.url,o.hash))}n.push(new Ct(r.name,r.mimeType,s))}return n}function Cn(e){switch(e){case"COMPLETED":case"SUBMITTED":return N.COMPLETED;case"INPROGRESS":return N.PENDING;default:return N.FAILED}}function kn(e){return{projectVertices:e.includes("PROJECT_VERTICES")}}(function(e){e[e.FAILED=0]="FAILED",e[e.PENDING=1]="PENDING",e[e.COMPLETED=2]="COMPLETED"})(N||(N={}));export{Dn as assetMapFromAssetMapsJSON,_n as extractMesh,Bn as meshFeatureSetFromJSON}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/loadGLTFMesh-lqLpAMsK.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/gltfexport-W1GDjMOr.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} \ No newline at end of file diff --git a/dist/assets/meshFeatureSet-Mcou8mDC.js b/dist/assets/meshFeatureSet-Mcou8mDC.js deleted file mode 100644 index 85e70ae..0000000 --- a/dist/assets/meshFeatureSet-Mcou8mDC.js +++ /dev/null @@ -1,7 +0,0 @@ -import{E as R,qd as Oe,dT as pe,qe as se,qf as oe,ay as S,Z as m,aU as Z,at as ie,aa as x,qg as rt,qh as st,gG as Te,de as Q,s as fe,T as F,pd as ot,qi as it,gH as at,g as lt,jP as ct,e as g,y,c as De,iE as ut,V as pt,fl as ft,qj as ke,cs as he,qk as Ce,i$ as K,ql as me,qm as de,qn as ge,qo as ye,qp as xe,qq as we,bA as qe,fB as ve,mW as N,mQ as ht,mR as ee,aF as mt,qr as $e,qs as V,as as ze,qt as dt,qu as ae,o3 as gt,qv as yt,h9 as xt,bv as Ie,au as Ue,ij as wt,cZ as vt,ha as $t,qw as le,d as At,qx as bt,l as St,qy as Rt,qz as Ft,qA as Et,lo as te,ln as Ne,ar as Mt,S as Lt,b1 as Pt,ob as _t,ld as Ae}from"./index-J0iiHjMT.js";import{u as be,y as jt,h as Ot,o as Tt,i as Dt}from"./External-GV0jSEES.js";import{d as kt}from"./FeatureSet-d4S1oKME.js";let B=class extends R{constructor(){super("mesh-not-loaded","Mesh must be loaded before applying operations")}},Ct=class extends R{constructor(){super("component-not-found","Provided component is not part of the list of components")}};class qt extends R{constructor(){super("invalid-polygon","expected polygon to be a Polygon instance")}}class T extends R{constructor(){super("invalid-input:location","Expected location to be a Point instance")}}class zt extends R{constructor(){super("invalid-input:no-layer","A layer is needed to convert the files")}}let It=class extends R{constructor(){super("invalid-input:no-model","No supported model found")}},Ut=class extends R{constructor(){super("invalid-input:multiple-models","Multiple supported models found")}};function Nt({xmin:e,xmax:t,ymin:n,ymax:r,zmin:s,zmax:o},i,l,c){s??(s=0),o??(o=0),Se??(Se=new Float64Array(24));const a=Se;return a[0]=e,a[1]=n,a[2]=s,a[3]=e,a[4]=r,a[5]=s,a[6]=t,a[7]=r,a[8]=s,a[9]=t,a[10]=n,a[11]=s,a[12]=e,a[13]=n,a[14]=o,a[15]=e,a[16]=r,a[17]=o,a[18]=t,a[19]=r,a[20]=o,a[21]=t,a[22]=n,a[23]=o,Oe({positions:a,transform:i,vertexSpace:l,inSpatialReference:c,outSpatialReference:c,outPositions:a}),H(a,c)}let Se=null;function H(e,t){let n=1/0,r=1/0,s=1/0,o=-1/0,i=-1/0,l=-1/0;const c=e.length;let a=0;for(;aimport("./loadGLTFMesh-g6BxZi9G.js"),__vite__mapDeps([0,1,2])),n),o=await Ht(r,n);fe(n);const i=s(new F({x:0,y:0,z:0,spatialReference:e.spatialReference}),o.url,{resolveFile:Yt(o),requestFile:void 0,useTransform:!0,signal:n==null?void 0:n.signal,expectedType:o.type});i.then(()=>o.dispose(),()=>o.dispose());const{vertexAttributes:l,components:c}=await i;e.vertexAttributes=l,e.components=c}function Yt(e){const t=ot(e.url);return n=>{const r=it(n,t,t),s=r?r.replace(/^ *\.\//,""):null;return(s?e.files.get(s):null)??n}}async function Ht(e,t){if(Array.isArray(e)){if(!e.length)throw new R("mesh-load-external:missing-assets","There must be at least one file to load");return e[0]instanceof File?Kt(e):en(e,t)}return Be(e)}async function Qt(e,t){const{parts:n,assetMimeType:r,assetName:s}=e;if(n.length===1)return new ne(n[0].partUrl);const o=await e.toBlob(t);return fe(t),ne.fromBlob(o,Ye(s,r))}function Be(e){return ne.fromBlob(e,Ye(e.name,e.type))}function Kt(e){return Je(e.map(t=>({name:t.name,mimeType:t.type,source:Be(t)})))}async function en(e,t){const n=await at(e.map(async r=>{const s=await Qt(r);return fe(t),{name:r.assetName,mimeType:r.assetMimeType,source:s}}));if(lt(t))throw n.forEach(r=>r.source.dispose()),ct();return Je(n)}const We=/^model\/gltf\+json$/,Ze=/^model\/gltf-binary$/,ce=/\.gltf$/i,tn=/\.glb$/i;function Je(e){const t=new Map;let n,r=null;for(const{name:s,mimeType:o,source:i}of e)r===null&&(We.test(o)||ce.test(s)?(r=i.url,n="gltf"):(Ze.test(o)||tn.test(s))&&(r=i.url,n="glb")),t.set(s,i.url),i.files.forEach((l,c)=>t.set(c,l));if(r==null)throw new R("mesh-load-external:missing-files","Missing files to load external mesh source");return new ne(r,()=>e.forEach(({source:s})=>s.dispose()),t,n)}let ne=class Xe{constructor(t,n=()=>{},r=new Map,s){this.url=t,this.dispose=n,this.files=r,this.type=s}static fromBlob(t,n){const r=URL.createObjectURL(t);return new Xe(r,()=>URL.revokeObjectURL(r),void 0,n)}};function Ye(e,t){return We.test(t)||ce.test(e)?"gltf":Ze.test(t)||ce.test(e)?"glb":void 0}let _=class extends ut{constructor(){super(),this.externalSources=new pt,this._explicitDisplaySource=null,this.addHandles(ft(()=>this.externalSources,"after-remove",({item:e})=>{e===this._explicitDisplaySource&&(this._explicitDisplaySource=null)},{sync:!0,onListenerRemove:()=>this._explicitDisplaySource=null}))}get displaySource(){return this._explicitDisplaySource??this._implicitDisplaySource}set displaySource(e){if(e!=null&&!be(e))throw new Error("Cannot use this source for display: it is not in a supported format.");this._explicitDisplaySource=e,e&&this.externalSources.every(t=>!jt(t,e))&&this.externalSources.add(e)}clearSources(){this.externalSources.removeAll()}getExternalSourcesOnService(e){return this.externalSources.items.filter(t=>Ot(t,e))}get _implicitDisplaySource(){return this.externalSources.find(be)}};g([y()],_.prototype,"externalSources",void 0),g([y()],_.prototype,"displaySource",null),g([y()],_.prototype,"_implicitDisplaySource",null),g([y()],_.prototype,"_explicitDisplaySource",void 0),_=g([De("esri.geometry.support.meshUtils.Metadata")],_);const nn="esri.geometry.support.meshUtils.offset";function rn(e,t,n){var s;if(!((s=e.vertexAttributes)!=null&&s.position))return;const{vertexSpace:r}=e;r.isRelative?(se(r,nn,n),sn(r,t)):oe(e.spatialReference,n)?on(e,t):an(e,t)}function sn(e,t){const n=e.origin;e.origin=ie(x(),n,t)}function on(e,t){const n=e.spatialReference,r=e.vertexAttributes.position,s=e.vertexAttributes.normal,o=e.vertexAttributes.tangent,i=new Float64Array(r.length),l=s!=null?new Float32Array(s.length):null,c=o!=null?new Float32Array(o.length):null,a=e.extent.center,u=ln;ke(n,[a.x,a.y,a.z],Re,he(n)),Ce(Fe,Re),K(u,t,Fe),me(r,n,i),s!=null&&l!=null&&de(s,r,i,n,l),o!=null&&c!=null&&ge(o,r,i,n,c),He(i,u),ye(i,r,n),s!=null&&l!=null&&xe(l,r,i,n,s),o!=null&&c!=null&&we(c,r,i,n,o),e.vertexAttributesChanged()}function an(e,t){He(e.vertexAttributes.position,t),e.vertexAttributesChanged()}function He(e,t){if(e)for(let n=0;n=o&&u=4,A=h===2||h===4,j=E?n-1:n;for(let $=0;$<=j;$++){const b=$/j*2*Math.PI,M=E?0:.5;d[0]=M*Math.sin(b),d[1]=M*-Math.cos(b),d[2]=h<=2?.5:-.5;for(let O=0;O<3;O++)s[c++]=d[O],o[a++]=G?O===2?h<=1?1:-1:0:O===2?0:d[O]/M;i[u++]=($+(E?.5:0))/n,i[u++]=h<=1?1*h/3:h<=3?1*(h-2)/3+1/3:1*(h-4)/3+2/3,A||h===0||$===n||(h!==5&&(l[p++]=f,l[p++]=f+1,l[p++]=f-n),h!==1&&(l[p++]=f,l[p++]=f-n,l[p++]=f-n-1)),f++}}return{position:s,normal:o,uv:i,faces:l}}function hn(e,t){const n=typeof t=="number"?t:t!=null?t.width:1,r=typeof t=="number"?t:t!=null?t.height:1;switch(e){case"up":case"down":return{width:n,depth:r};case"north":case"south":return{width:n,height:r};case"east":case"west":return{depth:n,height:r}}}function mn(e){const t=W.facingAxisOrderSwap[e],n=W.position,r=W.normal,s=new Float64Array(n.length),o=new Float32Array(r.length);let i=0;for(let l=0;l<4;l++){const c=i;for(let a=0;a<3;a++){const u=t[a],p=Math.abs(u)-1,f=u>=0?1:-1;s[i]=n[c+p]*f,o[i]=r[c+p]*f,i++}}return{position:s,normal:o,uv:new Float32Array(W.uv),faces:new Uint32Array(W.faces),isPlane:!0}}const D=1,k=2,C=3,W={position:[-.5,-.5,0,.5,-.5,0,.5,.5,0,-.5,.5,0],normal:[0,0,1,0,0,1,0,0,1,0,0,1],uv:[0,1,1,1,1,0,0,0],faces:[0,1,2,0,2,3],facingAxisOrderSwap:{east:[C,D,k],west:[-C,-D,k],north:[-D,C,k],south:[D,-C,k],up:[D,k,C],down:[D,-k,-C]}};function X(e,t,n){e.isPlane||dn(e),gn(e,n==null?void 0:n.size);const{vertexAttributes:r,vertexSpace:s,transform:o}=ht(e,t,n);return{vertexAttributes:new ee({...r,uv:e.uv}),vertexSpace:s,transform:o,components:[new N({faces:e.faces,material:(n==null?void 0:n.material)||null})],spatialReference:t.spatialReference}}function dn(e){for(let t=0;timport("./zipjs-wrapper-Ui4c_elP.js"),__vite__mapDeps([])),s=[];return(await new n(new t(e)).getEntries()).forEach(i=>{var a;if(i.directory||/^__MACOS/i.test(i.filename))return;const l=new r,c=(a=i.getData)==null?void 0:a.call(i,l).then(u=>new File([u],i.filename));c&&s.push(c)}),Promise.all(s)}var v;const P="esri.geometry.Mesh",Ln={base:null,key:"type",defaultKeyValue:"georeferenced",typeMap:{georeferenced:le,"georeferenced-relative":Ne,local:te}};let w=v=class extends wt.LoadableMixin(vt($t)){constructor(e){super(e),this.components=null,this.vertexSpace=new le,this.transform=null,this.metadata=new _,this.hasZ=!0,this.hasM=!1,this.vertexAttributes=new ee,this.type="mesh"}initialize(){(this.metadata.externalSources.length===0||this.vertexAttributes.position.length)&&(this.loadStatus="loaded"),this.when(()=>{this.addHandles(At(()=>{var e;return{vertexAttributes:this.vertexAttributes,components:(e=this.components)==null?void 0:e.map(t=>t.clone())}},()=>this._clearSources(),{once:!0,sync:!0}))})}get hasExtent(){var e;return this.loaded?this.vertexAttributes.position.length>0&&(!this.components||this.components.length>0):((e=this.metadata.displaySource)==null?void 0:e.extent)!=null}get _transformedExtent(){const{components:e,spatialReference:t,vertexAttributes:n,vertexSpace:r}=this,s=n.position;if(s.length===0||e&&e.length===0)return new pe({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0,spatialReference:t});if(r.type==="local"){const{_untransformedExtent:o,transform:i}=this;return Nt(o,i,r,t)}if(r.type==="georeferenced-relative"){const{transform:o}=this,i=Oe({positions:s,transform:o,vertexSpace:r,inSpatialReference:t,outSpatialReference:t});return H(i,t)}return H(s,t)}get _untransformedExtent(){return H(this.vertexAttributes.position,this.spatialReference)}get anchor(){const{vertexSpace:e}=this;if(e.isRelative)return e.getOriginPoint(this.spatialReference);const{center:t,zmin:n}=this._transformedExtent;return new F({x:t.x,y:t.y,z:n,spatialReference:this.spatialReference})}get origin(){const{vertexSpace:e}=this;return e.isRelative?e.getOriginPoint(this.spatialReference):this._transformedExtent.center}get extent(){var e,t;return this.loaded||((t=(e=this.metadata)==null?void 0:e.displaySource)==null?void 0:t.extent)==null?this._transformedExtent:this.metadata.displaySource.extent.clone()}addComponent(e){if(!this.loaded)return m.getLogger(this).error("addComponent()",new B().message);this.components||(this.components=[]),this.components.push(N.from(e)),this.notifyChange("components")}removeComponent(e){if(!this.loaded)return m.getLogger(this).error("removeComponent()",new B().message);if(this.components){const t=this.components.indexOf(e);if(t!==-1)return this.components.splice(t,1),void this.notifyChange("components")}m.getLogger(this).error("removeComponent()",new Ct().message)}rotate(e,t,n,r){return bt(e,t,n,_e),wn(this,_e,r),this}offset(e,t,n,r){return this.loaded?(Y[0]=e,Y[1]=t,Y[2]=n,rn(this,Y,r),this):(m.getLogger(this).error("offset()",new B().message),this)}scale(e,t){return this.loaded?(bn(this,e,t),this):(m.getLogger(this).error("scale()",new B().message),this)}centerAt(e,t){return this.loaded?(Vt(this,e,t),this):(m.getLogger(this).error("centerAt()",new B().message),this)}load(e){const{metadata:{displaySource:t}}=this;return t&&this.addResolvingPromise(Xt(this,t,e)),Promise.resolve(this)}addExternalSources(e){this.metadata.externalSources.addMany(e)}updateDisplaySource(e){this.metadata.displaySource=e}clone(){return this.cloneWithVertexSpace(this.vertexSpace.clone())}cloneWithVertexSpace(e){var r;let t=null;if(this.components){const s=new Map,o=new Map;t=this.components.map(i=>i.cloneWithDeduplication(s,o))}const n={components:t,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes.clone(),vertexSpace:e,transform:((r=this.transform)==null?void 0:r.clone())??null,metadata:this.metadata.clone()};return new v(n)}cloneShallow(){return new v({components:this.components,spatialReference:this.spatialReference,vertexAttributes:this.vertexAttributes,vertexSpace:this.vertexSpace.clone(),transform:this.transform,metadata:this.metadata})}vertexAttributesChanged(){this.notifyChange("vertexAttributes")}async toBinaryGLTF(e){const t=Q(()=>import("./gltfexport-gleus-sO.js"),__vite__mapDeps([3,1,2])),n=this.load(),r=await Promise.all([t,n]),{toBinaryGLTF:s}=r[0];return s(this,e)}get memoryUsage(){let e=0;if(e+=this.vertexAttributes.memoryUsage,this.components!=null)for(const t of this.components)e+=t.memoryUsage;return e}_clearSources(){this.metadata.clearSources()}static createBox(e,t){if(!(e instanceof F))return m.getLogger(P).error(".createBox()",new T().message),null;const n=new v(X(cn(),e,t));return t!=null&&t.imageFace&&t.imageFace!=="all"?un(n,t.imageFace):n}static createSphere(e,t){return e instanceof F?new v(X(pn((t==null?void 0:t.densificationFactor)||0),e,t)):(m.getLogger(P).error(".createSphere()",new T().message),null)}static createCylinder(e,t){return e instanceof F?new v(X(fn((t==null?void 0:t.densificationFactor)||0),e,t)):(m.getLogger(P).error(".createCylinder()",new T().message),null)}static createPlane(e,t){if(!(e instanceof F))return m.getLogger(P).error(".createPlane()",new T().message),null;const n=(t==null?void 0:t.facing)??"up",r=hn(n,t==null?void 0:t.size);return new v(X(mn(n),e,{...t,size:r}))}static createFromPolygon(e,t){if(!(e instanceof St))return m.getLogger(P).error(".createFromPolygon()",new qt().message),null;const n=Rt(e);return new v({vertexAttributes:new ee({position:n.position}),components:[new N({faces:n.faces,shading:"flat",material:(t==null?void 0:t.material)??null})],spatialReference:e.spatialReference,vertexSpace:new le})}static async createFromGLTF(e,t,n){if(!(e instanceof F)){const s=new T;throw m.getLogger(P).error(".createfromGLTF()",s.message),s}const{loadGLTFMesh:r}=await Te(Q(()=>import("./loadGLTFMesh-g6BxZi9G.js"),__vite__mapDeps([0,1,2])),n);return new v(await r(e,t,n))}static async createFromFiles(e,t,n){const r=a=>m.getLogger(P).error(".createFromFiles()",a.message);if(!(e instanceof F)){const a=new T;throw r(a),a}const s=n==null?void 0:n.layer;if(!s){const a=new zt;throw r(a),a}const o=await v.extractAndFilterFiles(t,s),i=o.reduce((a,u)=>Ft(s.infoFor3D,u)?a+1:a,0);if(i===0){const a=new It;throw r(a),a}if(i>1){const a=new Ut;throw r(a),a}const l=v.createWithExternalSource(e,o),[c]=await s.uploadAssets([l],n);return c}static async extractAndFilterFiles(e,t){const n=t==null?void 0:t.infoFor3D;return n?(await En(e)).filter(r=>Et(n,r)):e}static createWithExternalSource(e,t,n){var f;const r=(n==null?void 0:n.extent)??null,{x:s,y:o,z:i,spatialReference:l}=e,c=((f=n==null?void 0:n.transform)==null?void 0:f.clone())??new V,a=(n==null?void 0:n.vertexSpace)??new te({origin:[s,o,i??0]}),u={source:t,extent:r},p=new _;return p.externalSources.push(u),new v({metadata:p,transform:c,vertexSpace:a,spatialReference:l})}static createIncomplete(e,t){var a;const{x:n,y:r,z:s,spatialReference:o}=e,i=((a=t==null?void 0:t.transform)==null?void 0:a.clone())??new V,l=(t==null?void 0:t.vertexSpace)??new te({origin:[n,r,s??0]}),c=new v({transform:i,vertexSpace:l,spatialReference:o});return c.addResolvingPromise(Promise.reject(new R("mesh-incomplete","Mesh resources are not complete"))),c}};g([y({type:[N],json:{write:!0}})],w.prototype,"components",void 0),g([y({nonNullable:!0,types:Ln,constructOnly:!0,json:{write:!0}})],w.prototype,"vertexSpace",void 0),g([y({type:V,json:{write:!0}})],w.prototype,"transform",void 0),g([y({constructOnly:!0})],w.prototype,"metadata",void 0),g([y()],w.prototype,"hasExtent",null),g([y()],w.prototype,"_transformedExtent",null),g([y()],w.prototype,"_untransformedExtent",null),g([y()],w.prototype,"anchor",null),g([y()],w.prototype,"origin",null),g([y({readOnly:!0,json:{read:!1}})],w.prototype,"extent",null),g([y({readOnly:!0,json:{read:!1,write:!0,default:!0}})],w.prototype,"hasZ",void 0),g([y({readOnly:!0,json:{read:!1,write:!0,default:!1}})],w.prototype,"hasM",void 0),g([y({type:ee,nonNullable:!0,json:{write:!0}})],w.prototype,"vertexAttributes",void 0),w=v=g([De(P)],w);const Y=x(),_e=$e(),je=w,ue=()=>m.getLogger("esri.rest.support.meshFeatureSet");function Bn(e,t,n){const r=n.features;n.features=[],delete n.geometryType;const s=kt.fromJSON(n);if(s.geometryType="mesh",!n.assetMaps)return s;const o=Tn(t,n.assetMaps),i=e.sourceSpatialReference??Mt.WGS84,l=n.globalIdFieldName,{outFields:c}=e,a=c!=null&&c.length>0?Pn(c.includes("*")?null:new Set(c)):()=>({});for(const u of r){const p=_n(u,l,i,t,o);p!=null&&s.features.push(new Lt({geometry:p,attributes:a(u)}))}return s}function Pn(e){return({attributes:t})=>{if(!t)return{};if(!e)return t;for(const n in t)e.has(n)||delete t[n];return t}}function _n(e,t,n,r,s){const o=e.attributes[t],i=s.get(o);if(i==null)return ue().error("mesh-feature-set:asset-not-found","Service returned a feature which was not found in the asset map",e),null;if(!e.geometry)return ue().error("mesh-feature-set:no-geometry","Service returned a feature without geometry",e),null;const{originPoint:l,originVector:c}=jn(e,n,r),a=pe.fromJSON(e.geometry);a.spatialReference=n;const u=On(e.attributes,r),p=i.projectVertices?new Ne({origin:c}):new te({origin:c}),f=Dn(i);return f?je.createWithExternalSource(l,f,{extent:a,transform:u,vertexSpace:p}):je.createIncomplete(l,{extent:a,transform:u,vertexSpace:p})}function jn({attributes:e},t,{transformFieldRoles:n}){const r=e[n.originX],s=e[n.originY],o=e[n.originZ];return{originPoint:new F({x:r,y:s,z:o,spatialReference:t}),originVector:Pt(r,s,o)}}function On(e,{transformFieldRoles:t}){return new V({translation:[e[t.translationX],-e[t.translationZ],e[t.translationY]],rotationAxis:[e[t.rotationX],-e[t.rotationZ],e[t.rotationY]],rotationAngle:e[t.rotationDeg],scale:[e[t.scaleX],e[t.scaleZ],e[t.scaleY]]})}var U;function Tn(e,t){const n=new Map;for(const r of t){const s=r.parentGlobalId;if(s==null)continue;const o=r.assetName,i=r.assetType,l=r.assetHash,c=r.assetURL,a=r.conversionStatus,u=r.seqNo,p=_t(i,e.supportedFormats);if(!p){ue().error("mesh-feature-set:unknown-format",`Service returned an asset of type ${i}, but it does not list it as a supported type`);continue}const f=Ae(n,s,()=>({projectVertices:Cn(r.flags).projectVertices,files:new Map}));Ae(f.files,o,()=>({name:o,type:i,mimeType:p,status:kn(a),parts:[]})).parts[u]={hash:l,url:c}}return n}function Dn(e){const t=Array.from(e.files.values()),n=new Array;for(const r of t){if(r.status!==U.COMPLETED)return null;const s=new Array;for(const o of r.parts){if(!o)return null;s.push(new Tt(o.url,o.hash))}n.push(new Dt(r.name,r.mimeType,s))}return n}function kn(e){switch(e){case"COMPLETED":case"SUBMITTED":return U.COMPLETED;case"INPROGRESS":return U.PENDING;default:return U.FAILED}}function Cn(e){return{projectVertices:e.includes("PROJECT_VERTICES")}}(function(e){e[e.FAILED=0]="FAILED",e[e.PENDING=1]="PENDING",e[e.COMPLETED=2]="COMPLETED"})(U||(U={}));export{Tn as assetMapFromAssetMapsJSON,_n as extractMesh,Bn as meshFeatureSetFromJSON}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/loadGLTFMesh-g6BxZi9G.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/gltfexport-gleus-sO.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} \ No newline at end of file diff --git a/dist/assets/normalizeUtilsSync-zfJiThlh.js b/dist/assets/normalizeUtilsSync-GeARMwm8.js similarity index 78% rename from dist/assets/normalizeUtilsSync-zfJiThlh.js rename to dist/assets/normalizeUtilsSync-GeARMwm8.js index a5e1f42..3098b25 100644 --- a/dist/assets/normalizeUtilsSync-zfJiThlh.js +++ b/dist/assets/normalizeUtilsSync-GeARMwm8.js @@ -1 +1 @@ -import{ae as b,e4 as A,eE as G,eF as J,eG as T,eH as N,eI as X,eJ as z,dz as E,eK as M,eL as F,eM as H,eN as K,eO as p}from"./index-J0iiHjMT.js";function D(e){return k(e,!0)}function Q(e){return k(e,!1)}function k(e,s){if(e==null)return null;const i=e.spatialReference,n=A(i),t=G(e)?e.toJSON():e;if(!n)return t;const h=J(i)?102100:4326,u=T[h].maxX,_=T[h].minX;if(N(t))return S(t,u,_);if(X(t))return t.points=t.points.map(o=>S(o,u,_)),t;if(z(t))return R(t,n);if(E(t)||M(t)){const o=F(j,t),r={xmin:o[0],ymin:o[1],xmax:o[2],ymax:o[3]},x=p(r.xmin,_)*(2*u),m=x===0?t:H(t,x);return r.xmin+=x,r.xmax+=x,r.xmax>u?w(m,u,s):r.xmin<_?w(m,_,s):m}return t}function R(e,s){if(!s)return e;const i=$(e,s).map(n=>n.extent);return i.length<2?i[0]||e:i.length>2?(e.xmin=s.valid[0],e.xmax=s.valid[1],e):{rings:i.map(n=>[[n.xmin,n.ymin],[n.xmin,n.ymax],[n.xmax,n.ymax],[n.xmax,n.ymin],[n.xmin,n.ymin]])}}function S(e,s,i){if(Array.isArray(e)){const n=e[0];if(n>s){const t=p(n,s);e[0]=n+t*(-2*s)}else if(ns){const t=p(n,s);e.x+=t*(-2*s)}else if(n0;if(_>2*r){const v={xmin:ha||V?i.push(new l({xmin:x,ymin:n,xmax:r,ymax:t},[m]),new l({xmin:o,ymin:n,xmax:a,ymax:t},[c])):i.push(new l({xmin:x,ymin:n,xmax:a,ymax:t},[m]));return i}function L(e,s){const[i,n]=s.valid,t=2*n;let h,u=0;return e>n?(h=Math.ceil(Math.abs(e-n)/t),e-=h*t,u=h):e=e.xmin&&s<=e.xmax&&i>=e.ymin&&i<=e.ymax}function w(e,s,i=!0){const n=!M(e);if(n&&K(e),i)return new q().cut(e,s);const t=n?e.rings:e.paths,h=n?4:2,u=t.length,_=-2*s;for(let o=0;o=h){const x=[];for(const m of r)x.push([m[0]+_,m[1]]);t.push(x)}}return n?e.rings=t:e.paths=t,e}class l{constructor(s,i){this.extent=s,this.frameIds=i}}const j=b();class q{constructor(){this._linesIn=[],this._linesOut=[]}cut(s,i){let n;if(this._xCut=i,s.rings)this._closed=!0,n=s.rings,this._minPts=4;else{if(!s.paths)return null;this._closed=!1,n=s.paths,this._minPts=2}for(const h of n){if(!h||h.length=this._minPts&&n.push(h);const t=-2*this._xCut;for(const h of this._linesOut)if(h&&h.length>=this._minPts){for(const u of h)u[0]+=t;n.push(h)}return this._closed?s.rings=n:s.paths=n,s}moveTo(s){this._pushLineIn(),this._pushLineOut(),this._prevSide=this._side(s[0]),this._moveTo(s[0],s[1],this._prevSide),this._prevPt=s,this._firstPt=s}lineTo(s){const i=this._side(s[0]);if(i*this._prevSide==-1){const n=this._intersect(this._prevPt,s);this._lineTo(this._xCut,n,0),this._prevSide=0,this._lineTo(s[0],s[1],i)}else this._lineTo(s[0],s[1],i);this._prevSide=i,this._prevPt=s}close(){const s=this._firstPt,i=this._prevPt;s[0]===i[0]&&s[1]===i[1]||this.lineTo(s),this._checkClosingPt(this._lineIn),this._checkClosingPt(this._lineOut)}_moveTo(s,i,n){this._closed?(this._lineIn.push([n<=0?s:this._xCut,i]),this._lineOut.push([n>=0?s:this._xCut,i])):(n<=0&&this._lineIn.push([s,i]),n>=0&&this._lineOut.push([s,i]))}_lineTo(s,i,n){this._closed?(this._addPolyVertex(this._lineIn,n<=0?s:this._xCut,i),this._addPolyVertex(this._lineOut,n>=0?s:this._xCut,i)):n<0?(this._prevSide===0&&this._pushLineOut(),this._lineIn.push([s,i])):n>0?(this._prevSide===0&&this._pushLineIn(),this._lineOut.push([s,i])):this._prevSide<0?(this._lineIn.push([s,i]),this._lineOut.push([s,i])):this._prevSide>0&&(this._lineOut.push([s,i]),this._lineIn.push([s,i]))}_addPolyVertex(s,i,n){const t=s.length;t>1&&s[t-1][0]===i&&s[t-2][0]===i?s[t-1][1]=n:s.push([i,n])}_checkClosingPt(s){const i=s.length;i>3&&s[0][0]===this._xCut&&s[i-2][0]===this._xCut&&s[1][0]===this._xCut&&(s[0][1]=s[i-2][1],s.pop())}_side(s){return sthis._xCut?1:0}_intersect(s,i){const n=(this._xCut-s[0])/(i[0]-s[0]);return s[1]+n*(i[1]-s[1])}_pushLineIn(){this._lineIn&&this._lineIn.length>=this._minPts&&this._linesIn.push(this._lineIn),this._lineIn=[]}_pushLineOut(){this._lineOut&&this._lineOut.length>=this._minPts&&this._linesOut.push(this._lineOut),this._lineOut=[]}}export{Q as a,D as p}; +import{cf as V,dZ as b,ey as G,ez as J,eA as T,eB as X,eC as z,eD as B,eE as D,eF as M,eG as E,eH as F,eI as H,eJ as p}from"./index-pCX-0tJH.js";function q(e){return k(e,!0)}function K(e){return k(e,!1)}function k(e,s){if(e==null)return null;const i=e.spatialReference,n=b(i),t=G(e)?e.toJSON():e;if(!n)return t;const h=J(i)?102100:4326,u=T[h].maxX,_=T[h].minX;if(X(t))return S(t,u,_);if(z(t))return t.points=t.points.map(o=>S(o,u,_)),t;if(B(t))return N(t,n);if(D(t)||M(t)){const o=E(Z,t),r={xmin:o[0],ymin:o[1],xmax:o[2],ymax:o[3]},x=p(r.xmin,_)*(2*u),m=x===0?t:F(t,x);return r.xmin+=x,r.xmax+=x,r.xmax>u?L(m,u,s):r.xmin<_?L(m,_,s):m}return t}function N(e,s){if(!s)return e;const i=R(e,s).map(n=>n.extent);return i.length<2?i[0]||e:i.length>2?(e.xmin=s.valid[0],e.xmax=s.valid[1],e):{rings:i.map(n=>[[n.xmin,n.ymin],[n.xmin,n.ymax],[n.xmax,n.ymax],[n.xmax,n.ymin],[n.xmin,n.ymin]])}}function S(e,s,i){if(Array.isArray(e)){const n=e[0];if(n>s){const t=p(n,s);e[0]=n+t*(-2*s)}else if(ns){const t=p(n,s);e.x+=t*(-2*s)}else if(n0;if(_>2*r){const v={xmin:ha||A?i.push(new l({xmin:x,ymin:n,xmax:r,ymax:t},[m]),new l({xmin:o,ymin:n,xmax:a,ymax:t},[c])):i.push(new l({xmin:x,ymin:n,xmax:a,ymax:t},[m]));return i}function w(e,s){const[i,n]=s.valid,t=2*n;let h,u=0;return e>n?(h=Math.ceil(Math.abs(e-n)/t),e-=h*t,u=h):e=e.xmin&&s<=e.xmax&&i>=e.ymin&&i<=e.ymax}function L(e,s,i=!0){const n=!M(e);if(n&&H(e),i)return new $().cut(e,s);const t=n?e.rings:e.paths,h=n?4:2,u=t.length,_=-2*s;for(let o=0;o=h){const x=[];for(const m of r)x.push([m[0]+_,m[1]]);t.push(x)}}return n?e.rings=t:e.paths=t,e}class l{constructor(s,i){this.extent=s,this.frameIds=i}}const Z=V();class ${constructor(){this._linesIn=[],this._linesOut=[]}cut(s,i){let n;if(this._xCut=i,s.rings)this._closed=!0,n=s.rings,this._minPts=4;else{if(!s.paths)return null;this._closed=!1,n=s.paths,this._minPts=2}for(const h of n){if(!h||h.length=this._minPts&&n.push(h);const t=-2*this._xCut;for(const h of this._linesOut)if(h&&h.length>=this._minPts){for(const u of h)u[0]+=t;n.push(h)}return this._closed?s.rings=n:s.paths=n,s}moveTo(s){this._pushLineIn(),this._pushLineOut(),this._prevSide=this._side(s[0]),this._moveTo(s[0],s[1],this._prevSide),this._prevPt=s,this._firstPt=s}lineTo(s){const i=this._side(s[0]);if(i*this._prevSide==-1){const n=this._intersect(this._prevPt,s);this._lineTo(this._xCut,n,0),this._prevSide=0,this._lineTo(s[0],s[1],i)}else this._lineTo(s[0],s[1],i);this._prevSide=i,this._prevPt=s}close(){const s=this._firstPt,i=this._prevPt;s[0]===i[0]&&s[1]===i[1]||this.lineTo(s),this._checkClosingPt(this._lineIn),this._checkClosingPt(this._lineOut)}_moveTo(s,i,n){this._closed?(this._lineIn.push([n<=0?s:this._xCut,i]),this._lineOut.push([n>=0?s:this._xCut,i])):(n<=0&&this._lineIn.push([s,i]),n>=0&&this._lineOut.push([s,i]))}_lineTo(s,i,n){this._closed?(this._addPolyVertex(this._lineIn,n<=0?s:this._xCut,i),this._addPolyVertex(this._lineOut,n>=0?s:this._xCut,i)):n<0?(this._prevSide===0&&this._pushLineOut(),this._lineIn.push([s,i])):n>0?(this._prevSide===0&&this._pushLineIn(),this._lineOut.push([s,i])):this._prevSide<0?(this._lineIn.push([s,i]),this._lineOut.push([s,i])):this._prevSide>0&&(this._lineOut.push([s,i]),this._lineIn.push([s,i]))}_addPolyVertex(s,i,n){const t=s.length;t>1&&s[t-1][0]===i&&s[t-2][0]===i?s[t-1][1]=n:s.push([i,n])}_checkClosingPt(s){const i=s.length;i>3&&s[0][0]===this._xCut&&s[i-2][0]===this._xCut&&s[1][0]===this._xCut&&(s[0][1]=s[i-2][1],s.pop())}_side(s){return sthis._xCut?1:0}_intersect(s,i){const n=(this._xCut-s[0])/(i[0]-s[0]);return s[1]+n*(i[1]-s[1])}_pushLineIn(){this._lineIn&&this._lineIn.length>=this._minPts&&this._linesIn.push(this._lineIn),this._lineIn=[]}_pushLineOut(){this._lineOut&&this._lineOut.length>=this._minPts&&this._linesOut.push(this._lineOut),this._lineOut=[]}}export{K as a,q as p}; diff --git a/dist/assets/observers-JyBmMU24.js b/dist/assets/observers-eNe735aq.js similarity index 95% rename from dist/assets/observers-JyBmMU24.js rename to dist/assets/observers-eNe735aq.js index 26d896e..33469dc 100644 --- a/dist/assets/observers-JyBmMU24.js +++ b/dist/assets/observers-eNe735aq.js @@ -1,4 +1,4 @@ -import"./index-J0iiHjMT.js";/*! +import"./index-pCX-0tJH.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/ogcFeatureUtils-dtzP0u64.js b/dist/assets/ogcFeatureUtils-8dWL_GtH.js similarity index 80% rename from dist/assets/ogcFeatureUtils-dtzP0u64.js rename to dist/assets/ogcFeatureUtils-8dWL_GtH.js index 8dd0e12..72a7204 100644 --- a/dist/assets/ogcFeatureUtils-dtzP0u64.js +++ b/dist/assets/ogcFeatureUtils-8dWL_GtH.js @@ -1 +1 @@ -import{Z as L,E as g,bW as F,eP as z,eQ as Q,eR as U,ar as I,eS as V,eT as _,eU as B,cX as O,eV as X,eW as H}from"./index-J0iiHjMT.js";import{E as Y,I as ee,N as ne}from"./geojson-fSjaGZrp.js";import{o as te}from"./clientSideDefaults-F-CNnR0g.js";const $=L.getLogger("esri.layers.graphics.sources.ogcfeature"),C="http://www.opengis.net/def/crs/",fe=`${C}OGC/1.3/CRS84`;async function me(n,t,e={},i=5){const{links:s}=n,l=f(s,"items","application/geo+json")||f(s,"http://www.opengis.net/def/rel/ogc/1.0/items","application/geo+json");if(l==null)throw new g("ogc-feature-layer:missing-items-page","Missing items url");const{data:u}=await F(l.href,{signal:e.signal,query:{limit:i,...e.customParameters,token:e.apiKey},headers:{accept:"application/geo+json"}});Y(u);const o=ee(u,{geometryType:t.geometryType}),d=t.fields||o.fields||[],T=t.hasZ!=null?t.hasZ:o.hasZ,b=o.geometryType,m=t.objectIdField||o.objectIdFieldName||"OBJECTID";let r=t.timeInfo;const j=d.find(({name:a})=>a===m);if(j)j.editable=!1,j.nullable=!1;else{if(!o.objectIdFieldType)throw new g("ogc-feature-layer:missing-feature-id","Collection geojson require a feature id as a unique identifier");d.unshift({name:m,alias:m,type:o.objectIdFieldType==="number"?"esriFieldTypeOID":"esriFieldTypeString",editable:!1,nullable:!1})}if(m!==o.objectIdFieldName){const a=d.find(({name:c})=>c===o.objectIdFieldName);a&&(a.type="esriFieldTypeInteger")}d===o.fields&&o.unknownFields.length>0&&$.warn({name:"ogc-feature-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:o.unknownFields}});for(const a of d){if(a.name==null&&(a.name=a.alias),a.alias==null&&(a.alias=a.name),a.type!=="esriFieldTypeOID"&&a.type!=="esriFieldTypeGlobalID"&&(a.editable=a.editable==null||!!a.editable,a.nullable=a.nullable==null||!!a.nullable),!a.name)throw new g("ogc-feature-layer:invalid-field-name","field name is missing",{field:a});if(!z.jsonValues.includes(a.type))throw new g("ogc-feature-layer:invalid-field-type",`invalid type for field "${a.name}"`,{field:a})}if(r){const a=new Q(d);if(r.startTimeField){const c=a.get(r.startTimeField);c?(r.startTimeField=c.name,c.type="esriFieldTypeDate"):r.startTimeField=null}if(r.endTimeField){const c=a.get(r.endTimeField);c?(r.endTimeField=c.name,c.type="esriFieldTypeDate"):r.endTimeField=null}if(r.trackIdField){const c=a.get(r.trackIdField);c?r.trackIdField=c.name:(r.trackIdField=null,$.warn({name:"ogc-feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:r}}))}r.timeReference||(r.timeReference={timeZoneIANA:U}),r.startTimeField||r.endTimeField||($.warn({name:"ogc-feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:r}}),r=null)}return{drawingInfo:b?te(b):null,extent:le(n),geometryType:b,fields:d,hasZ:!!T,objectIdField:m,timeInfo:r}}async function pe(n,t={}){const{links:e}=n,i=f(e,"data","application/json")||f(e,"http://www.opengis.net/def/rel/ogc/1.0/data","application/json");if(i==null)throw new g("ogc-feature-layer:missing-collections-page","Missing collections url");const{apiKey:s,customParameters:l,signal:u}=t,{data:o}=await F(i.href,{signal:u,headers:{accept:"application/json"},query:{...l,token:s}});return o}async function ge(n,t={}){const{links:e}=n,i=f(e,"conformance","application/json")||f(e,"http://www.opengis.net/def/rel/ogc/1.0/conformance","application/json");if(i==null)throw new g("ogc-feature-layer:missing-conformance-page","Missing conformance url");const{apiKey:s,customParameters:l,signal:u}=t,{data:o}=await F(i.href,{signal:u,headers:{accept:"application/json"},query:{...l,token:s}});return o}async function ye(n,t={}){const{apiKey:e,customParameters:i,signal:s}=t,{data:l}=await F(n,{signal:s,headers:{accept:"application/json"},query:{...i,token:e}});return l}async function we(n,t={}){const e="application/vnd.oai.openapi+json;version=3.0",i=f(n.links,"service-desc",e);if(i==null)return $.warn("ogc-feature-layer:missing-openapi-page","The OGC API-Features server does not have an OpenAPI page."),null;const{apiKey:s,customParameters:l,signal:u}=t,{data:o}=await F(i.href,{signal:u,headers:{accept:e},query:{...l,token:s}});return o}function be(n){const t=/^http:\/\/www\.opengis.net\/def\/crs\/(?.*)\/(?.*)\/(?.*)$/i.exec(n),e=t==null?void 0:t.groups;if(!e)return null;const{authority:i,code:s}=e;switch(i.toLowerCase()){case"ogc":switch(s.toLowerCase()){case"crs27":return I.GCS_NAD_1927.wkid;case"crs83":return 4269;case"crs84":case"crs84h":return I.WGS84.wkid;default:return null}case"esri":case"epsg":{const l=Number.parseInt(s,10);return Number.isNaN(l)?null:l}default:return null}}async function he(n,t,e){const i=await ie(n,t,e);return V(i)}async function ie(n,t,e){const{collection:i,layerDefinition:s,maxRecordCount:l,queryParameters:{apiKey:u,customParameters:o},spatialReference:d,supportedCrs:T}=n,{links:b}=i,m=f(b,"items","application/geo+json")||f(b,"http://www.opengis.net/def/rel/ogc/1.0/items","application/geo+json");if(m==null)throw new g("ogc-feature-layer:missing-items-page","Missing items url");const{geometry:r,num:j,start:a,timeExtent:c,where:M}=t;if(t.objectIds)throw new g("ogc-feature-layer:query-by-objectids-not-supported","Queries with objectids are not supported");const P=I.fromJSON(d),h=t.outSpatialReference??P,k=h.isWGS84?null:G(h,T),Z=oe(r,T),D=re(c),K=se(M),A=j??(a!=null&&a!==void 0?10:l),{data:y}=await F(m.href,{...e,query:{...o,...Z,crs:k,datetime:D,query:K,limit:A,startindex:a,token:u},headers:{accept:"application/geo+json"}});let x=!1;y.links&&(x=!!y.links.find(N=>N.rel==="next")),!x&&Number.isInteger(y.numberMatched)&&Number.isInteger(y.numberReturned)&&(x=y.numberReturnedi.rel===t&&i.type===e)||n.find(i=>i.rel===t&&!i.type)}export{pe as F,ge as I,he as S,ye as T,C as b,fe as h,me as j,we as k,ie as v,be as x}; +import{R as E,r as g,av as F,eK as z,eL as Q,eM as _,d2 as I,eN as B,eO as U,eP as V,cO as M,eQ as H,eR as X}from"./index-pCX-0tJH.js";import{E as Y,I as ee,N as ne}from"./geojson-162a_hNo.js";import{o as te}from"./clientSideDefaults-63pOkJ4Y.js";const $=E.getLogger("esri.layers.graphics.sources.ogcfeature"),C="http://www.opengis.net/def/crs/",fe=`${C}OGC/1.3/CRS84`;async function me(n,t,e={},i=5){const{links:s}=n,l=f(s,"items","application/geo+json")||f(s,"http://www.opengis.net/def/rel/ogc/1.0/items","application/geo+json");if(l==null)throw new g("ogc-feature-layer:missing-items-page","Missing items url");const{data:u}=await F(l.href,{signal:e.signal,query:{limit:i,...e.customParameters,token:e.apiKey},headers:{accept:"application/geo+json"}});Y(u);const o=ee(u,{geometryType:t.geometryType}),d=t.fields||o.fields||[],T=t.hasZ!=null?t.hasZ:o.hasZ,b=o.geometryType,m=t.objectIdField||o.objectIdFieldName||"OBJECTID";let r=t.timeInfo;const j=d.find(({name:a})=>a===m);if(j)j.editable=!1,j.nullable=!1;else{if(!o.objectIdFieldType)throw new g("ogc-feature-layer:missing-feature-id","Collection geojson require a feature id as a unique identifier");d.unshift({name:m,alias:m,type:o.objectIdFieldType==="number"?"esriFieldTypeOID":"esriFieldTypeString",editable:!1,nullable:!1})}if(m!==o.objectIdFieldName){const a=d.find(({name:c})=>c===o.objectIdFieldName);a&&(a.type="esriFieldTypeInteger")}d===o.fields&&o.unknownFields.length>0&&$.warn({name:"ogc-feature-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:o.unknownFields}});for(const a of d){if(a.name==null&&(a.name=a.alias),a.alias==null&&(a.alias=a.name),a.type!=="esriFieldTypeOID"&&a.type!=="esriFieldTypeGlobalID"&&(a.editable=a.editable==null||!!a.editable,a.nullable=a.nullable==null||!!a.nullable),!a.name)throw new g("ogc-feature-layer:invalid-field-name","field name is missing",{field:a});if(!z.jsonValues.includes(a.type))throw new g("ogc-feature-layer:invalid-field-type",`invalid type for field "${a.name}"`,{field:a})}if(r){const a=new Q(d);if(r.startTimeField){const c=a.get(r.startTimeField);c?(r.startTimeField=c.name,c.type="esriFieldTypeDate"):r.startTimeField=null}if(r.endTimeField){const c=a.get(r.endTimeField);c?(r.endTimeField=c.name,c.type="esriFieldTypeDate"):r.endTimeField=null}if(r.trackIdField){const c=a.get(r.trackIdField);c?r.trackIdField=c.name:(r.trackIdField=null,$.warn({name:"ogc-feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:r}}))}r.timeReference||(r.timeReference={timeZoneIANA:_}),r.startTimeField||r.endTimeField||($.warn({name:"ogc-feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:r}}),r=null)}return{drawingInfo:b?te(b):null,extent:le(n),geometryType:b,fields:d,hasZ:!!T,objectIdField:m,timeInfo:r}}async function pe(n,t={}){const{links:e}=n,i=f(e,"data","application/json")||f(e,"http://www.opengis.net/def/rel/ogc/1.0/data","application/json");if(i==null)throw new g("ogc-feature-layer:missing-collections-page","Missing collections url");const{apiKey:s,customParameters:l,signal:u}=t,{data:o}=await F(i.href,{signal:u,headers:{accept:"application/json"},query:{...l,token:s}});return o}async function ge(n,t={}){const{links:e}=n,i=f(e,"conformance","application/json")||f(e,"http://www.opengis.net/def/rel/ogc/1.0/conformance","application/json");if(i==null)throw new g("ogc-feature-layer:missing-conformance-page","Missing conformance url");const{apiKey:s,customParameters:l,signal:u}=t,{data:o}=await F(i.href,{signal:u,headers:{accept:"application/json"},query:{...l,token:s}});return o}async function ye(n,t={}){const{apiKey:e,customParameters:i,signal:s}=t,{data:l}=await F(n,{signal:s,headers:{accept:"application/json"},query:{...i,token:e}});return l}async function we(n,t={}){const e="application/vnd.oai.openapi+json;version=3.0",i=f(n.links,"service-desc",e);if(i==null)return $.warn("ogc-feature-layer:missing-openapi-page","The OGC API-Features server does not have an OpenAPI page."),null;const{apiKey:s,customParameters:l,signal:u}=t,{data:o}=await F(i.href,{signal:u,headers:{accept:e},query:{...l,token:s}});return o}function be(n){const t=/^http:\/\/www\.opengis.net\/def\/crs\/(?.*)\/(?.*)\/(?.*)$/i.exec(n),e=t==null?void 0:t.groups;if(!e)return null;const{authority:i,code:s}=e;switch(i.toLowerCase()){case"ogc":switch(s.toLowerCase()){case"crs27":return I.GCS_NAD_1927.wkid;case"crs83":return 4269;case"crs84":case"crs84h":return I.WGS84.wkid;default:return null}case"esri":case"epsg":{const l=Number.parseInt(s,10);return Number.isNaN(l)?null:l}default:return null}}async function he(n,t,e){const i=await ie(n,t,e);return B(i)}async function ie(n,t,e){const{collection:i,layerDefinition:s,maxRecordCount:l,queryParameters:{apiKey:u,customParameters:o},spatialReference:d,supportedCrs:T}=n,{links:b}=i,m=f(b,"items","application/geo+json")||f(b,"http://www.opengis.net/def/rel/ogc/1.0/items","application/geo+json");if(m==null)throw new g("ogc-feature-layer:missing-items-page","Missing items url");const{geometry:r,num:j,start:a,timeExtent:c,where:P}=t;if(t.objectIds)throw new g("ogc-feature-layer:query-by-objectids-not-supported","Queries with objectids are not supported");const W=I.fromJSON(d),h=t.outSpatialReference??W,k=h.isWGS84?null:G(h,T),Z=oe(r,T),D=re(c),K=se(P),A=j??(a!=null&&a!==void 0?10:l),{data:y}=await F(m.href,{...e,query:{...o,...Z,crs:k,datetime:D,query:K,limit:A,startindex:a,token:u},headers:{accept:"application/geo+json"}});let x=!1;y.links&&(x=!!y.links.find(S=>S.rel==="next")),!x&&Number.isInteger(y.numberMatched)&&Number.isInteger(y.numberReturned)&&(x=y.numberReturnedi.rel===t&&i.type===e)||n.find(i=>i.rel===t&&!i.type)}export{pe as F,ge as I,he as S,ye as T,C as b,fe as h,me as j,we as k,ie as v,be as x}; diff --git a/dist/assets/openCloseComponent-yw47Oy2q.js b/dist/assets/openCloseComponent-lU2sdEaR.js similarity index 97% rename from dist/assets/openCloseComponent-yw47Oy2q.js rename to dist/assets/openCloseComponent-lU2sdEaR.js index 55a7081..7e7f6e6 100644 --- a/dist/assets/openCloseComponent-yw47Oy2q.js +++ b/dist/assets/openCloseComponent-lU2sdEaR.js @@ -1,4 +1,4 @@ -import{cj as v}from"./index-J0iiHjMT.js";/*! +import{aU as v}from"./index-pCX-0tJH.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/optimizedFeatureQueryEngineAdapter-KnoSHZzG.js b/dist/assets/optimizedFeatureQueryEngineAdapter-46ccFTR0.js similarity index 79% rename from dist/assets/optimizedFeatureQueryEngineAdapter-KnoSHZzG.js rename to dist/assets/optimizedFeatureQueryEngineAdapter-46ccFTR0.js index e27163a..f48ea6a 100644 --- a/dist/assets/optimizedFeatureQueryEngineAdapter-KnoSHZzG.js +++ b/dist/assets/optimizedFeatureQueryEngineAdapter-46ccFTR0.js @@ -1 +1 @@ -import{eZ as G,e_ as O}from"./index-J0iiHjMT.js";function Y(t,e){return t?e?4:3:e?3:2}function P(t,e,o,s,c){if(!(e!=null&&e.lengths.length))return null;const l=(c==null?void 0:c.originPosition)==="upperLeft"?-1:1;t.lengths.length&&(t.lengths.length=0),t.coords.length&&(t.coords.length=0);const r=t.coords,I=[],u=o?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],{lengths:g,coords:T}=e,d=Y(o,s);let m=0;for(const n of g){const i=p(u,T,m,n,o,s,l);i&&I.push(i),m+=n*d}if(I.sort((n,i)=>{let f=l*n[2]-l*i[2];return f===0&&o&&(f=n[4]-i[4]),f}),I.length){let n=6*I[0][2];r[0]=I[0][0]/n,r[1]=I[0][1]/n,o&&(n=6*I[0][4],r[2]=n!==0?I[0][3]/n:0),(r[0]u[1]||r[1]u[3]||o&&(r[2]u[5]))&&(r.length=0)}if(!r.length){const n=e.lengths[0]?S(T,0,g[0],o,s):null;if(!n)return null;r[0]=n[0],r[1]=n[1],o&&n.length>2&&(r[2]=n[2])}return t}function p(t,e,o,s,c,l,r=1){const I=Y(c,l);let u=o,g=o+I,T=0,d=0,m=0,n=0,i=0;for(let V=0,_=s-1;V<_;V++,u+=I,g+=I){const h=e[u],E=e[u+1],N=e[u+2],b=e[g],a=e[g+1],A=e[g+2];let F=h*a-b*E;n+=F,T+=(h+b)*F,d+=(E+a)*F,c&&(F=h*A-b*N,m+=(N+A)*F,i+=F),ht[1]&&(t[1]=h),Et[3]&&(t[3]=E),c&&(Nt[5]&&(t[5]=N))}if(n*r>0&&(n*=-1),i*r>0&&(i*=-1),!n)return null;const f=[T,d,.5*n];return c&&(f[3]=m,f[4]=.5*i),f}function S(t,e,o,s,c){const l=Y(s,c);let r=e,I=e+l,u=0,g=0,T=0,d=0;for(let m=0,n=o-1;m0?s?[g/u,T/u,d/u]:[g/u,T/u]:o>0?s?[t[e],t[e+1],t[e+2]]:[t[e],t[e+1]]:null}function y(t,e,o,s){const c=o-t,l=s-e;return Math.sqrt(c*c+l*l)}function j(t,e,o,s,c,l){const r=s-t,I=c-e,u=l-o;return Math.sqrt(r*r+I*I+u*u)}function M(t,e,o,s){return[t+.5*(o-t),e+.5*(s-e)]}function $(t,e,o,s,c,l){return[t+.5*(s-t),e+.5*(c-e),o+.5*(l-o)]}const w={getObjectId:t=>t.objectId,getAttributes:t=>t.attributes,getAttribute:(t,e)=>t.attributes[e],cloneWithGeometry:(t,e)=>new G(e,t.attributes,null,t.objectId),getGeometry:t=>t.geometry,getCentroid:(t,e)=>(t.centroid==null&&(t.centroid=P(new O,t.geometry,e.hasZ,e.hasM)),t.centroid)};export{P as n,w as o}; +import{eU as G,eV as O}from"./index-pCX-0tJH.js";function _(t,e){return t?e?4:3:e?3:2}function P(t,e,o,s,c){if(!(e!=null&&e.lengths.length))return null;const l=(c==null?void 0:c.originPosition)==="upperLeft"?-1:1;t.lengths.length&&(t.lengths.length=0),t.coords.length&&(t.coords.length=0);const r=t.coords,I=[],u=o?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY],{lengths:g,coords:T}=e,d=_(o,s);let m=0;for(const n of g){const i=p(u,T,m,n,o,s,l);i&&I.push(i),m+=n*d}if(I.sort((n,i)=>{let f=l*n[2]-l*i[2];return f===0&&o&&(f=n[4]-i[4]),f}),I.length){let n=6*I[0][2];r[0]=I[0][0]/n,r[1]=I[0][1]/n,o&&(n=6*I[0][4],r[2]=n!==0?I[0][3]/n:0),(r[0]u[1]||r[1]u[3]||o&&(r[2]u[5]))&&(r.length=0)}if(!r.length){const n=e.lengths[0]?S(T,0,g[0],o,s):null;if(!n)return null;r[0]=n[0],r[1]=n[1],o&&n.length>2&&(r[2]=n[2])}return t}function p(t,e,o,s,c,l,r=1){const I=_(c,l);let u=o,g=o+I,T=0,d=0,m=0,n=0,i=0;for(let Y=0,V=s-1;Yt[1]&&(t[1]=h),Et[3]&&(t[3]=E),c&&(Nt[5]&&(t[5]=N))}if(n*r>0&&(n*=-1),i*r>0&&(i*=-1),!n)return null;const f=[T,d,.5*n];return c&&(f[3]=m,f[4]=.5*i),f}function S(t,e,o,s,c){const l=_(s,c);let r=e,I=e+l,u=0,g=0,T=0,d=0;for(let m=0,n=o-1;m0?s?[g/u,T/u,d/u]:[g/u,T/u]:o>0?s?[t[e],t[e+1],t[e+2]]:[t[e],t[e+1]]:null}function y(t,e,o,s){const c=o-t,l=s-e;return Math.sqrt(c*c+l*l)}function j(t,e,o,s,c,l){const r=s-t,I=c-e,u=l-o;return Math.sqrt(r*r+I*I+u*u)}function M(t,e,o,s){return[t+.5*(o-t),e+.5*(s-e)]}function $(t,e,o,s,c,l){return[t+.5*(s-t),e+.5*(c-e),o+.5*(l-o)]}const w={getObjectId:t=>t.objectId,getAttributes:t=>t.attributes,getAttribute:(t,e)=>t.attributes[e],cloneWithGeometry:(t,e)=>new G(e,t.attributes,null,t.objectId),getGeometry:t=>t.geometry,getCentroid:(t,e)=>(t.centroid==null&&(t.centroid=P(new O,t.geometry,e.hasZ,e.hasM)),t.centroid)};export{P as n,w as o}; diff --git a/dist/assets/pbf-o0zzptPp.js b/dist/assets/pbf-o0zzptPp.js deleted file mode 100644 index 9a704f7..0000000 --- a/dist/assets/pbf-o0zzptPp.js +++ /dev/null @@ -1 +0,0 @@ -import{dJ as d,d_ as u}from"./index-J0iiHjMT.js";var h;(function(r){r[r.varint=0]="varint",r[r.fixed64=1]="fixed64",r[r.delimited=2]="delimited",r[r.fixed32=5]="fixed32",r[r.unknown=99]="unknown"})(h||(h={}));const p=4294967296,f=new TextDecoder("utf-8"),c=d("safari")||d("ios")?6:d("ff")?12:32;let g=class o{constructor(t,s,i=0,e=t?t.byteLength:0){this._tag=0,this._dataType=h.unknown,this._init(t,s,i,e)}_init(t,s,i,e){this._data=t,this._dataView=s,this._pos=i,this._end=e}asUnsafe(){return this}clone(){return new o(this._data,this._dataView,this._pos,this._end)}pos(){return this._pos}move(t){this._pos=t}nextTag(t){for(;;){if(this._pos===this._end)return!1;const s=this._decodeVarint();if(this._tag=s>>3,this._dataType=7&s,!t||t===this._tag)break;this.skip()}return!0}next(){if(this._pos===this._end)return!1;const t=this._decodeVarint();return this._tag=t>>3,this._dataType=7&t,!0}empty(){return this._pos>=this._end}tag(){return this._tag}getInt32(){return this._decodeVarint()}getInt64(){return this._decodeVarint()}getUInt32(){let t=4294967295;return t=(127&this._data[this._pos])>>>0,this._data[this._pos++]<128?t:(t=(t|(127&this._data[this._pos])<<7)>>>0,this._data[this._pos++]<128?t:(t=(t|(127&this._data[this._pos])<<14)>>>0,this._data[this._pos++]<128?t:(t=(t|(127&this._data[this._pos])<<21)>>>0,this._data[this._pos++]<128?t:(t=(t|(15&this._data[this._pos])<<28)>>>0,this._data[this._pos++]<128?t:void 0))))}getUInt64(){return this._decodeVarint()}getSInt32(){const t=this.getUInt32();if(t!==void 0)return t>>>1^-(1&t)|0}getSInt64(){return this._decodeSVarint()}getBool(){const t=this._data[this._pos]!==0;return this._skip(1),t}getEnum(){return this._decodeVarint()}getFixed64(){const t=this._dataView,s=this._pos,i=t.getUint32(s,!0)+t.getUint32(s+4,!0)*p;return this._skip(8),i}getSFixed64(){const t=this._dataView,s=this._pos,i=t.getUint32(s,!0)+t.getInt32(s+4,!0)*p;return this._skip(8),i}getDouble(){const t=this._dataView.getFloat64(this._pos,!0);return this._skip(8),t}getFixed32(){const t=this._dataView.getUint32(this._pos,!0);return this._skip(4),t}getSFixed32(){const t=this._dataView.getInt32(this._pos,!0);return this._skip(4),t}getFloat(){const t=this._dataView.getFloat32(this._pos,!0);return this._skip(4),t}getString(){const t=this._getLength(),s=this._pos,i=this._toString(this._data,s,s+t);return this._skip(t),i}getBytes(){const t=this._getLength(),s=this._pos,i=this._toBytes(this._data,s,s+t);return this._skip(t),i}getLength(){return this._getLengthUnsafe()}processMessageWithArgs(t,s,i,e){const n=this.getMessage(),a=t(n,s,i,e);return n.release(),a}processMessage(t){const s=this.getMessage(),i=t(s);return s.release(),i}getMessage(){const t=this._getLength(),s=o.pool.acquire();return s._init(this._data,this._dataView,this._pos,this._pos+t),this._skip(t),s}release(){o.pool.release(this)}dataType(){return this._dataType}skip(){switch(this._dataType){case h.varint:this._decodeVarint();break;case h.fixed64:this._skip(8);break;case h.delimited:this._skip(this._getLength());break;case h.fixed32:this._skip(4);break;default:throw new Error("Invalid data type!")}}skipLen(t){this._skip(t)}_skip(t){if(this._pos+t>this._end)throw new Error("Attempt to skip past the end of buffer!");this._pos+=t}_decodeVarint(){const t=this._data;let s=this._pos,i=0,e=0;if(this._end-s>=10)do{if(e=t[s++],i|=127&e,(128&e)==0||(e=t[s++],i|=(127&e)<<7,(128&e)==0)||(e=t[s++],i|=(127&e)<<14,(128&e)==0)||(e=t[s++],i|=(127&e)<<21,(128&e)==0)||(e=t[s++],i+=268435456*(127&e),(128&e)==0)||(e=t[s++],i+=34359738368*(127&e),(128&e)==0)||(e=t[s++],i+=4398046511104*(127&e),(128&e)==0)||(e=t[s++],i+=562949953421312*(127&e),(128&e)==0)||(e=t[s++],i+=72057594037927940*(127&e),(128&e)==0)||(e=t[s++],i+=9223372036854776e3*(127&e),(128&e)==0))break;throw new Error("Varint too long!")}while(!1);else{let n=1;for(;s!==this._end&&(e=t[s],(128&e)!=0);)++s,i+=(127&e)*n,n*=128;if(s===this._end)throw new Error("Varint overrun!");++s,i+=e*n}return this._pos=s,i}_decodeSVarint(){const t=this._data;let s,i=0,e=0;const n=1&t[this._pos];if(e=t[this._pos++],i|=127&e,(128&e)==0||(e=t[this._pos++],i|=(127&e)<<7,(128&e)==0)||(e=t[this._pos++],i|=(127&e)<<14,(128&e)==0)||(e=t[this._pos++],i|=(127&e)<<21,(128&e)==0)||(e=t[this._pos++],i+=268435456*(127&e),(128&e)==0)||(e=t[this._pos++],i+=34359738368*(127&e),(128&e)==0)||(e=t[this._pos++],i+=4398046511104*(127&e),(128&e)==0))return n?-(i+1)/2:i/2;if(s=BigInt(i),e=t[this._pos++],s+=0x2000000000000n*BigInt(127&e),(128&e)==0||(e=t[this._pos++],s+=0x100000000000000n*BigInt(127&e),(128&e)==0)||(e=t[this._pos++],s+=0x8000000000000000n*BigInt(127&e),(128&e)==0))return Number(n?-(s+1n)/2n:s/2n);throw new Error("Varint too long!")}_getLength(){if(this._dataType!==h.delimited)throw new Error("Not a delimited data type!");return this._decodeVarint()}_getLengthUnsafe(){return this.getUInt32()}_toString(t,s,i){if((i=Math.min(this._end,i))-s>c){const a=t.subarray(s,i);return f.decode(a)}let e="",n="";for(let a=s;a{r._data=null,r._dataView=null});export{g as r}; diff --git a/dist/assets/pbfQueryUtils-pWizwTQZ.js b/dist/assets/pbfQueryUtils-pWizwTQZ.js deleted file mode 100644 index 6d8ed97..0000000 --- a/dist/assets/pbfQueryUtils-pWizwTQZ.js +++ /dev/null @@ -1 +0,0 @@ -import{eW as I,al as w,dA as d,l4 as S,eZ as U,e_ as y,E as G}from"./index-J0iiHjMT.js";import{r as D}from"./pbf-o0zzptPp.js";const F=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"];let J=class{constructor(e){this._options=e,this.geometryTypes=F,this._coordinatePtr=0,this._vertexDimension=0}createFeatureResult(){return new I}prepareFeatures(e){this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&this._vertexDimension++}finishFeatureResult(e){if(!(e!=null&&e.features)||!e.hasZ||!this._options.sourceSpatialReference||!e.spatialReference||w(e.spatialReference,this._options.sourceSpatialReference)||e.spatialReference.vcsWkid)return;const a=d(this._options.sourceSpatialReference)/d(e.spatialReference);if(a!==1)for(const n of e.features){if(!S(n))continue;const r=n.geometry.coords;for(let s=2;sa+n,0)*this._vertexDimension,this._coordinatePtr=0}addCoordinate(e,a){e.coords[this._coordinatePtr++]=a}addCoordinatePoint(e,a){e.coords.push(a)}addLength(e,a){e.lengths.push(a)}addQueryGeometry(e,a){e.queryGeometry=a.queryGeometry,e.queryGeometryType=a.queryGeometryType}createPointGeometry(){return new y}};const h=["esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeString","esriFieldTypeDate","esriFieldTypeOID","esriFieldTypeGeometry","esriFieldTypeBlob","esriFieldTypeRaster","esriFieldTypeGUID","esriFieldTypeGlobalID","esriFieldTypeXML","esriFieldTypeBigInteger","esriFieldTypeDateOnly","esriFieldTypeTimeOnly","esriFieldTypeTimestampOffset"],b=["sqlTypeBigInt","sqlTypeBinary","sqlTypeBit","sqlTypeChar","sqlTypeDate","sqlTypeDecimal","sqlTypeDouble","sqlTypeFloat","sqlTypeGeometry","sqlTypeGUID","sqlTypeInteger","sqlTypeLongNVarchar","sqlTypeLongVarbinary","sqlTypeLongVarchar","sqlTypeNChar","sqlTypeNVarchar","sqlTypeOther","sqlTypeReal","sqlTypeSmallInt","sqlTypeSqlXml","sqlTypeTime","sqlTypeTimestamp","sqlTypeTimestamp2","sqlTypeTinyInt","sqlTypeVarbinary","sqlTypeVarchar"],k=["upperLeft","lowerLeft"];function m(t){return t>=h.length?null:h[t]}function R(t){return t>=b.length?null:b[t]}function T(t){return t>=k.length?null:k[t]}function q(t,e){return e>=t.geometryTypes.length?null:t.geometryTypes[e]}function x(t,e,a){const r=t.asUnsafe(),s=e.createPointGeometry(a);for(;r.next();)switch(r.tag()){case 3:{const o=r.getUInt32(),i=r.pos()+o;let c=0;for(;r.pos()t[x]})}}}return Object.freeze(Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}))}var ur,re,dr,ge={exports:{}};ge.exports,ur=ge,ge.exports,re=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(re=re||__filename),dr=function(K={}){var k,W,t=K;t.ready=new Promise((e,_)=>{k=e,W=_});var x,z,oe,me=Object.assign({},t),Te="./this.program",Oe=typeof window=="object",$=typeof importScripts=="function",Se=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",Y="";function Er(e){return t.locateFile?t.locateFile(e,Y):Y+e}if(Se){var Ne=require("fs"),ye=require("path");Y=$?ye.dirname(Y)+"/":__dirname+"/",x=(e,_)=>(e=Pe(e)?new URL(e):ye.normalize(e),Ne.readFileSync(e,_?void 0:"utf8")),oe=e=>{var _=x(e,!0);return _.buffer||(_=new Uint8Array(_)),_},z=(e,_,r,p=!0)=>{e=Pe(e)?new URL(e):ye.normalize(e),Ne.readFile(e,p?void 0:"utf8",(i,c)=>{i?r(i):_(p?c.buffer:c)})},!t.thisProgram&&process.argv.length>1&&(Te=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),t.inspect=()=>"[Emscripten Module object]"}else(Oe||$)&&($?Y=self.location.href:typeof document<"u"&&document.currentScript&&(Y=document.currentScript.src),re&&(Y=re),Y=Y.indexOf("blob:")!==0?Y.substr(0,Y.replace(/[?#].*/,"").lastIndexOf("/")+1):"",x=e=>{var _=new XMLHttpRequest;return _.open("GET",e,!1),_.send(null),_.responseText},$&&(oe=e=>{var _=new XMLHttpRequest;return _.open("GET",e,!1),_.responseType="arraybuffer",_.send(null),new Uint8Array(_.response)}),z=(e,_,r)=>{var p=new XMLHttpRequest;p.open("GET",e,!0),p.responseType="arraybuffer",p.onload=()=>{p.status==200||p.status==0&&p.response?_(p.response):r()},p.onerror=r,p.send(null)});var ue,ne,br=console.log.bind(console),J=console.error.bind(console);Object.assign(t,me),me=null,typeof WebAssembly!="object"&&q("no native wasm support detected");var Z,V,pe,D,j,ie,ce,he=!1;function de(e,_){e||q(_)}function le(){var e=ne.buffer;t.HEAP8=Z=new Int8Array(e),t.HEAP16=pe=new Int16Array(e),t.HEAPU8=V=new Uint8Array(e),t.HEAPU16=new Uint16Array(e),t.HEAP32=D=new Int32Array(e),t.HEAPU32=j=new Uint32Array(e),t.HEAPF32=ie=new Float32Array(e),t.HEAPF64=ce=new Float64Array(e)}var mr=[],Me=[],Tr=[];function Or(){fe(mr)}function Sr(){fe(Me)}function Nr(){fe(Tr)}function hr(e){Me.unshift(e)}var se=0,Q=null;function lr(e){se++}function Mr(e){if(--se==0&&Q){var _=Q;Q=null,_()}}function q(e){J(e="Aborted("+e+")"),he=!0,e+=". Build with -sASSERTIONS for more info.";var _=new WebAssembly.RuntimeError(e);throw W(_),_}var ee,vr="data:application/octet-stream;base64,";function ve(e){return e.startsWith(vr)}function Pe(e){return e.startsWith("file://")}function De(e){if(e==ee&&ue)return new Uint8Array(ue);if(oe)return oe(e);throw"both async and sync fetching of the wasm failed"}function Dr(e){if(Oe||$){if(typeof fetch=="function"&&!Pe(e))return fetch(e,{credentials:"same-origin"}).then(_=>{if(!_.ok)throw"failed to load wasm binary file at '"+e+"'";return _.arrayBuffer()}).catch(()=>De(e));if(z)return new Promise((_,r)=>{z(e,p=>_(new Uint8Array(p)),r)})}return Promise.resolve().then(()=>De(e))}function Ae(e,_,r){return Dr(e).then(p=>WebAssembly.instantiate(p,_)).then(p=>p).then(r,p=>{J(`failed to asynchronously prepare wasm: ${p}`),q(p)})}function Ar(e,_,r,p){return e||typeof WebAssembly.instantiateStreaming!="function"||ve(_)||Pe(_)||Se||typeof fetch!="function"?Ae(_,r,p):fetch(_,{credentials:"same-origin"}).then(i=>WebAssembly.instantiateStreaming(i,r).then(p,function(c){return J(`wasm streaming compile failed: ${c}`),J("falling back to ArrayBuffer instantiation"),Ae(_,r,p)}))}function Rr(){var e={a:kr};function _(p,i){return o=p.exports,ne=o.t,le(),hr(o.u),Mr(),o}function r(p){_(p.instance)}return lr(),Ar(ue,ee,e,r).catch(W),{}}ve(ee="pe-wasm.wasm")||(ee=Er(ee));var fe=e=>{for(;e.length>0;)e.shift()(t)};function Gr(e,_="i8"){switch(_.endsWith("*")&&(_="*"),_){case"i1":case"i8":return Z[e>>0];case"i16":return pe[e>>1];case"i32":return D[e>>2];case"i64":q("to do getValue(i64) use WASM_BIGINT");case"float":return ie[e>>2];case"double":return ce[e>>3];case"*":return j[e>>2];default:q(`invalid type for getValue: ${_}`)}}var Re=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Ge=(e,_,r)=>{for(var p=_+r,i=_;e[i]&&!(i>=p);)++i;if(i-_>16&&e.buffer&&Re)return Re.decode(e.subarray(_,i));for(var c="";_>10,56320|1023&B)}}else c+=String.fromCharCode((31&g)<<6|a)}else c+=String.fromCharCode(g)}return c},L=(e,_)=>e?Ge(V,e,_):"";function Cr(e,_,r){return 0}var Ce=(e,_,r,p)=>{if(!(p>0))return 0;for(var i=r,c=r+p-1,g=0;g=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++g)),a<=127){if(r>=c)break;_[r++]=a}else if(a<=2047){if(r+1>=c)break;_[r++]=192|a>>6,_[r++]=128|63&a}else if(a<=65535){if(r+2>=c)break;_[r++]=224|a>>12,_[r++]=128|a>>6&63,_[r++]=128|63&a}else{if(r+3>=c)break;_[r++]=240|a>>18,_[r++]=128|a>>12&63,_[r++]=128|a>>6&63,_[r++]=128|63&a}}return _[r]=0,r-i},Ir=(e,_,r)=>Ce(e,V,_,r);function jr(e,_,r){return 0}function Ur(e,_,r,p){}var Lr=e=>e%4==0&&(e%100!=0||e%400==0),Fr=[0,31,60,91,121,152,182,213,244,274,305,335],Yr=[0,31,59,90,120,151,181,212,243,273,304,334],wr=e=>(Lr(e.getFullYear())?Fr:Yr)[e.getMonth()]+e.getDate()-1,xr=(e,_)=>_+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*_:NaN;function Hr(e,_,r){var p=xr(e,_),i=new Date(1e3*p);D[r>>2]=i.getSeconds(),D[r+4>>2]=i.getMinutes(),D[r+8>>2]=i.getHours(),D[r+12>>2]=i.getDate(),D[r+16>>2]=i.getMonth(),D[r+20>>2]=i.getFullYear()-1900,D[r+24>>2]=i.getDay();var c=0|wr(i);D[r+28>>2]=c,D[r+36>>2]=-60*i.getTimezoneOffset();var g=new Date(i.getFullYear(),0,1),a=new Date(i.getFullYear(),6,1).getTimezoneOffset(),C=g.getTimezoneOffset(),B=0|(a!=C&&i.getTimezoneOffset()==Math.min(C,a));D[r+32>>2]=B}var Ie=e=>{for(var _=0,r=0;r=55296&&p<=57343?(_+=4,++r):_+=3}return _},je=e=>{var _=Ie(e)+1,r=Ue(_);return r&&Ir(e,r,_),r},Xr=()=>2147483648,zr=e=>{var _=(e-ne.buffer.byteLength+65535)/65536;try{return ne.grow(_),le(),1}catch{}},Ee={},Zr=()=>Te||"./this.program",te=()=>{if(!te.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:Zr()};for(var _ in Ee)Ee[_]===void 0?delete e[_]:e[_]=Ee[_];var r=[];for(var _ in e)r.push(`${_}=${e[_]}`);te.strings=r}return te.strings},Wr=(e,_)=>{for(var r=0;r>0]=e.charCodeAt(r);Z[_>>0]=0};function Br(e,_,r,p,i){return 70}var Kr=[null,[],[]],Vr=(e,_)=>{var r=Kr[e];_===0||_===10?((e===1?br:J)(Ge(r,0)),r.length=0):r.push(_)};function qr(e,_,r){var p=r>0?r:Ie(e)+1,i=new Array(p),c=Ce(e,i,0,i.length);return _&&(i.length=c),i}var kr={c:Cr,r:(e,_,r)=>{},h:jr,d:Ur,p:e=>{},o:(e,_)=>{},q:(e,_,r)=>{},j:Hr,n:(e,_,r)=>{var p=new Date().getFullYear(),i=new Date(p,0,1),c=new Date(p,6,1),g=i.getTimezoneOffset(),a=c.getTimezoneOffset(),C=Math.max(g,a);function B(co){var yr=co.toTimeString().match(/\(([A-Za-z ]+)\)$/);return yr?yr[1]:"GMT"}j[e>>2]=60*C,D[_>>2]=+(g!=a);var po=B(i),io=B(c),ar=je(po),gr=je(io);a>2]=ar,j[r+4>>2]=gr):(j[r>>2]=gr,j[r+4>>2]=ar)},l:()=>{q("")},i:()=>Date.now(),s:(e,_,r)=>V.copyWithin(e,_,_+r),m:e=>{var _=V.length;e>>>=0;var r=Xr();if(e>r)return!1;for(var p=(a,C)=>a+(C-a%C)%C,i=1;i<=4;i*=2){var c=_*(1+.2/i);c=Math.min(c,e+100663296);var g=Math.min(r,p(Math.max(e,c),65536));if(zr(g))return!0}return!1},e:(e,_)=>{var r=0;return te().forEach((p,i)=>{var c=_+r;j[e+4*i>>2]=c,Wr(p,c),r+=p.length+1}),0},f:(e,_)=>{var r=te();j[e>>2]=r.length;var p=0;return r.forEach(i=>p+=i.length+1),j[_>>2]=p,0},a:e=>52,g:(e,_,r,p)=>52,k:Br,b:(e,_,r,p)=>{for(var i=0,c=0;c>2],a=j[_+4>>2];_+=8;for(var C=0;C>2]=i,0}},o=Rr();t._webidl_free=e=>(t._webidl_free=o.v)(e),t._webidl_malloc=e=>(t._webidl_malloc=o.w)(e);var ae,Ue=e=>(Ue=o.x)(e),Le=t._emscripten_bind_PeObject_getCode_0=e=>(Le=t._emscripten_bind_PeObject_getCode_0=o.y)(e),Fe=t._emscripten_bind_PeObject_getName_1=(e,_)=>(Fe=t._emscripten_bind_PeObject_getName_1=o.z)(e,_),Ye=t._emscripten_bind_PeObject_getType_0=e=>(Ye=t._emscripten_bind_PeObject_getType_0=o.A)(e),we=t._emscripten_bind_PeCoordsys_getCode_0=e=>(we=t._emscripten_bind_PeCoordsys_getCode_0=o.B)(e),xe=t._emscripten_bind_PeCoordsys_getName_1=(e,_)=>(xe=t._emscripten_bind_PeCoordsys_getName_1=o.C)(e,_),He=t._emscripten_bind_PeCoordsys_getType_0=e=>(He=t._emscripten_bind_PeCoordsys_getType_0=o.D)(e),Xe=t._emscripten_bind_VoidPtr___destroy___0=e=>(Xe=t._emscripten_bind_VoidPtr___destroy___0=o.E)(e),ze=t._emscripten_bind_PeDatum_getSpheroid_0=e=>(ze=t._emscripten_bind_PeDatum_getSpheroid_0=o.F)(e),Ze=t._emscripten_bind_PeDatum_getCode_0=e=>(Ze=t._emscripten_bind_PeDatum_getCode_0=o.G)(e),We=t._emscripten_bind_PeDatum_getName_1=(e,_)=>(We=t._emscripten_bind_PeDatum_getName_1=o.H)(e,_),Be=t._emscripten_bind_PeDatum_getType_0=e=>(Be=t._emscripten_bind_PeDatum_getType_0=o.I)(e),Ke=t._emscripten_bind_PeDefs_get_PE_BUFFER_MAX_0=e=>(Ke=t._emscripten_bind_PeDefs_get_PE_BUFFER_MAX_0=o.J)(e),Ve=t._emscripten_bind_PeDefs_get_PE_NAME_MAX_0=e=>(Ve=t._emscripten_bind_PeDefs_get_PE_NAME_MAX_0=o.K)(e),qe=t._emscripten_bind_PeDefs_get_PE_MGRS_MAX_0=e=>(qe=t._emscripten_bind_PeDefs_get_PE_MGRS_MAX_0=o.L)(e),ke=t._emscripten_bind_PeDefs_get_PE_USNG_MAX_0=e=>(ke=t._emscripten_bind_PeDefs_get_PE_USNG_MAX_0=o.M)(e),$e=t._emscripten_bind_PeDefs_get_PE_DD_MAX_0=e=>($e=t._emscripten_bind_PeDefs_get_PE_DD_MAX_0=o.N)(e),Je=t._emscripten_bind_PeDefs_get_PE_DMS_MAX_0=e=>(Je=t._emscripten_bind_PeDefs_get_PE_DMS_MAX_0=o.O)(e),Qe=t._emscripten_bind_PeDefs_get_PE_DDM_MAX_0=e=>(Qe=t._emscripten_bind_PeDefs_get_PE_DDM_MAX_0=o.P)(e),et=t._emscripten_bind_PeDefs_get_PE_UTM_MAX_0=e=>(et=t._emscripten_bind_PeDefs_get_PE_UTM_MAX_0=o.Q)(e),tt=t._emscripten_bind_PeDefs_get_PE_PARM_MAX_0=e=>(tt=t._emscripten_bind_PeDefs_get_PE_PARM_MAX_0=o.R)(e),_t=t._emscripten_bind_PeDefs_get_PE_TYPE_NONE_0=e=>(_t=t._emscripten_bind_PeDefs_get_PE_TYPE_NONE_0=o.S)(e),rt=t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGCS_0=e=>(rt=t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGCS_0=o.T)(e),ot=t._emscripten_bind_PeDefs_get_PE_TYPE_PROJCS_0=e=>(ot=t._emscripten_bind_PeDefs_get_PE_TYPE_PROJCS_0=o.U)(e),nt=t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGTRAN_0=e=>(nt=t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGTRAN_0=o.V)(e),pt=t._emscripten_bind_PeDefs_get_PE_TYPE_COORDSYS_0=e=>(pt=t._emscripten_bind_PeDefs_get_PE_TYPE_COORDSYS_0=o.W)(e),it=t._emscripten_bind_PeDefs_get_PE_TYPE_UNIT_0=e=>(it=t._emscripten_bind_PeDefs_get_PE_TYPE_UNIT_0=o.X)(e),ct=t._emscripten_bind_PeDefs_get_PE_TYPE_LINUNIT_0=e=>(ct=t._emscripten_bind_PeDefs_get_PE_TYPE_LINUNIT_0=o.Y)(e),st=t._emscripten_bind_PeDefs_get_PE_STR_OPTS_NONE_0=e=>(st=t._emscripten_bind_PeDefs_get_PE_STR_OPTS_NONE_0=o.Z)(e),Pt=t._emscripten_bind_PeDefs_get_PE_STR_AUTH_NONE_0=e=>(Pt=t._emscripten_bind_PeDefs_get_PE_STR_AUTH_NONE_0=o._)(e),at=t._emscripten_bind_PeDefs_get_PE_STR_AUTH_TOP_0=e=>(at=t._emscripten_bind_PeDefs_get_PE_STR_AUTH_TOP_0=o.$)(e),gt=t._emscripten_bind_PeDefs_get_PE_STR_NAME_CANON_0=e=>(gt=t._emscripten_bind_PeDefs_get_PE_STR_NAME_CANON_0=o.aa)(e),yt=t._emscripten_bind_PeDefs_get_PE_STR_FMT_WKT_0=e=>(yt=t._emscripten_bind_PeDefs_get_PE_STR_FMT_WKT_0=o.ba)(e),ut=t._emscripten_bind_PeDefs_get_PE_STR_FMT_WKT2_0=e=>(ut=t._emscripten_bind_PeDefs_get_PE_STR_FMT_WKT2_0=o.ca)(e),dt=t._emscripten_bind_PeDefs_get_PE_PARM_X0_0=e=>(dt=t._emscripten_bind_PeDefs_get_PE_PARM_X0_0=o.da)(e),ft=t._emscripten_bind_PeDefs_get_PE_PARM_ND_0=e=>(ft=t._emscripten_bind_PeDefs_get_PE_PARM_ND_0=o.ea)(e),Et=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_1_TO_2_0=e=>(Et=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_1_TO_2_0=o.fa)(e),bt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_2_TO_1_0=e=>(bt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_2_TO_1_0=o.ga)(e),mt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_P_TO_G_0=e=>(mt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_P_TO_G_0=o.ha)(e),Tt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_G_TO_P_0=e=>(Tt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_G_TO_P_0=o.ia)(e),Ot=t._emscripten_bind_PeDefs_get_PE_HORIZON_RECT_0=e=>(Ot=t._emscripten_bind_PeDefs_get_PE_HORIZON_RECT_0=o.ja)(e),St=t._emscripten_bind_PeDefs_get_PE_HORIZON_POLY_0=e=>(St=t._emscripten_bind_PeDefs_get_PE_HORIZON_POLY_0=o.ka)(e),Nt=t._emscripten_bind_PeDefs_get_PE_HORIZON_LINE_0=e=>(Nt=t._emscripten_bind_PeDefs_get_PE_HORIZON_LINE_0=o.la)(e),ht=t._emscripten_bind_PeDefs_get_PE_HORIZON_DELTA_0=e=>(ht=t._emscripten_bind_PeDefs_get_PE_HORIZON_DELTA_0=o.ma)(e),lt=t._emscripten_bind_PeFactory_initialize_1=(e,_)=>(lt=t._emscripten_bind_PeFactory_initialize_1=o.na)(e,_),Mt=t._emscripten_bind_PeFactory_factoryByType_2=(e,_,r)=>(Mt=t._emscripten_bind_PeFactory_factoryByType_2=o.oa)(e,_,r),vt=t._emscripten_bind_PeFactory_fromString_2=(e,_,r)=>(vt=t._emscripten_bind_PeFactory_fromString_2=o.pa)(e,_,r),Dt=t._emscripten_bind_PeFactory_getCode_1=(e,_)=>(Dt=t._emscripten_bind_PeFactory_getCode_1=o.qa)(e,_),At=t._emscripten_bind_PeGCSExtent_PeGCSExtent_6=(e,_,r,p,i,c)=>(At=t._emscripten_bind_PeGCSExtent_PeGCSExtent_6=o.ra)(e,_,r,p,i,c),Rt=t._emscripten_bind_PeGCSExtent_getLLon_0=e=>(Rt=t._emscripten_bind_PeGCSExtent_getLLon_0=o.sa)(e),Gt=t._emscripten_bind_PeGCSExtent_getSLat_0=e=>(Gt=t._emscripten_bind_PeGCSExtent_getSLat_0=o.ta)(e),Ct=t._emscripten_bind_PeGCSExtent_getRLon_0=e=>(Ct=t._emscripten_bind_PeGCSExtent_getRLon_0=o.ua)(e),It=t._emscripten_bind_PeGCSExtent_getNLat_0=e=>(It=t._emscripten_bind_PeGCSExtent_getNLat_0=o.va)(e),jt=t._emscripten_bind_PeGCSExtent___destroy___0=e=>(jt=t._emscripten_bind_PeGCSExtent___destroy___0=o.wa)(e),Ut=t._emscripten_bind_PeGeogcs_getDatum_0=e=>(Ut=t._emscripten_bind_PeGeogcs_getDatum_0=o.xa)(e),Lt=t._emscripten_bind_PeGeogcs_getPrimem_0=e=>(Lt=t._emscripten_bind_PeGeogcs_getPrimem_0=o.ya)(e),Ft=t._emscripten_bind_PeGeogcs_getUnit_0=e=>(Ft=t._emscripten_bind_PeGeogcs_getUnit_0=o.za)(e),Yt=t._emscripten_bind_PeGeogcs_getCode_0=e=>(Yt=t._emscripten_bind_PeGeogcs_getCode_0=o.Aa)(e),wt=t._emscripten_bind_PeGeogcs_getName_1=(e,_)=>(wt=t._emscripten_bind_PeGeogcs_getName_1=o.Ba)(e,_),xt=t._emscripten_bind_PeGeogcs_getType_0=e=>(xt=t._emscripten_bind_PeGeogcs_getType_0=o.Ca)(e),Ht=t._emscripten_bind_PeGeogtran_isEqual_1=(e,_)=>(Ht=t._emscripten_bind_PeGeogtran_isEqual_1=o.Da)(e,_),Xt=t._emscripten_bind_PeGeogtran_getGeogcs1_0=e=>(Xt=t._emscripten_bind_PeGeogtran_getGeogcs1_0=o.Ea)(e),zt=t._emscripten_bind_PeGeogtran_getGeogcs2_0=e=>(zt=t._emscripten_bind_PeGeogtran_getGeogcs2_0=o.Fa)(e),Zt=t._emscripten_bind_PeGeogtran_getParameters_0=e=>(Zt=t._emscripten_bind_PeGeogtran_getParameters_0=o.Ga)(e),Wt=t._emscripten_bind_PeGeogtran_loadConstants_0=e=>(Wt=t._emscripten_bind_PeGeogtran_loadConstants_0=o.Ha)(e),Bt=t._emscripten_bind_PeGeogtran_getCode_0=e=>(Bt=t._emscripten_bind_PeGeogtran_getCode_0=o.Ia)(e),Kt=t._emscripten_bind_PeGeogtran_getName_1=(e,_)=>(Kt=t._emscripten_bind_PeGeogtran_getName_1=o.Ja)(e,_),Vt=t._emscripten_bind_PeGeogtran_getType_0=e=>(Vt=t._emscripten_bind_PeGeogtran_getType_0=o.Ka)(e),qt=t._emscripten_bind_PeGTlistExtended_getGTlist_6=(e,_,r,p,i,c,g)=>(qt=t._emscripten_bind_PeGTlistExtended_getGTlist_6=o.La)(e,_,r,p,i,c,g),kt=t._emscripten_bind_PeGTlistExtended_get_PE_GTLIST_OPTS_COMMON_0=e=>(kt=t._emscripten_bind_PeGTlistExtended_get_PE_GTLIST_OPTS_COMMON_0=o.Ma)(e),$t=t._emscripten_bind_PeGTlistExtendedEntry_getEntries_0=e=>($t=t._emscripten_bind_PeGTlistExtendedEntry_getEntries_0=o.Na)(e),Jt=t._emscripten_bind_PeGTlistExtendedEntry_getSteps_0=e=>(Jt=t._emscripten_bind_PeGTlistExtendedEntry_getSteps_0=o.Oa)(e),Qt=t._emscripten_bind_PeGTlistExtendedEntry_Delete_1=(e,_)=>(Qt=t._emscripten_bind_PeGTlistExtendedEntry_Delete_1=o.Pa)(e,_),e_=t._emscripten_bind_PeGTlistExtendedGTs_getDirection_0=e=>(e_=t._emscripten_bind_PeGTlistExtendedGTs_getDirection_0=o.Qa)(e),t_=t._emscripten_bind_PeGTlistExtendedGTs_getGeogtran_0=e=>(t_=t._emscripten_bind_PeGTlistExtendedGTs_getGeogtran_0=o.Ra)(e),__=t._emscripten_bind_PeHorizon_getNump_0=e=>(__=t._emscripten_bind_PeHorizon_getNump_0=o.Sa)(e),r_=t._emscripten_bind_PeHorizon_getKind_0=e=>(r_=t._emscripten_bind_PeHorizon_getKind_0=o.Ta)(e),o_=t._emscripten_bind_PeHorizon_getInclusive_0=e=>(o_=t._emscripten_bind_PeHorizon_getInclusive_0=o.Ua)(e),n_=t._emscripten_bind_PeHorizon_getSize_0=e=>(n_=t._emscripten_bind_PeHorizon_getSize_0=o.Va)(e),p_=t._emscripten_bind_PeHorizon_getCoord_0=e=>(p_=t._emscripten_bind_PeHorizon_getCoord_0=o.Wa)(e),i_=t._emscripten_bind_PeInteger_PeInteger_1=e=>(i_=t._emscripten_bind_PeInteger_PeInteger_1=o.Xa)(e),c_=t._emscripten_bind_PeInteger_get_val_0=e=>(c_=t._emscripten_bind_PeInteger_get_val_0=o.Ya)(e),s_=t._emscripten_bind_PeInteger_set_val_1=(e,_)=>(s_=t._emscripten_bind_PeInteger_set_val_1=o.Za)(e,_),P_=t._emscripten_bind_PeInteger___destroy___0=e=>(P_=t._emscripten_bind_PeInteger___destroy___0=o._a)(e),a_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_NEW_0=e=>(a_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_NEW_0=o.$a)(e),g_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_OLD_0=e=>(g_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_OLD_0=o.ab)(e),y_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_AUTO_0=e=>(y_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_AUTO_0=o.bb)(e),u_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_180_ZONE_1_PLUS_0=e=>(u_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_180_ZONE_1_PLUS_0=o.cb)(e),d_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_ADD_SPACES_0=e=>(d_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_ADD_SPACES_0=o.db)(e),f_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NONE_0=e=>(f_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NONE_0=o.eb)(e),E_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_0=e=>(E_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_0=o.fb)(e),b_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_STRICT_0=e=>(b_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_STRICT_0=o.gb)(e),m_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_ADD_SPACES_0=e=>(m_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_ADD_SPACES_0=o.hb)(e),T_=t._emscripten_bind_PeParameter_getValue_0=e=>(T_=t._emscripten_bind_PeParameter_getValue_0=o.ib)(e),O_=t._emscripten_bind_PeParameter_getCode_0=e=>(O_=t._emscripten_bind_PeParameter_getCode_0=o.jb)(e),S_=t._emscripten_bind_PeParameter_getName_1=(e,_)=>(S_=t._emscripten_bind_PeParameter_getName_1=o.kb)(e,_),N_=t._emscripten_bind_PeParameter_getType_0=e=>(N_=t._emscripten_bind_PeParameter_getType_0=o.lb)(e),h_=t._emscripten_bind_PePCSInfo_getCentralMeridian_0=e=>(h_=t._emscripten_bind_PePCSInfo_getCentralMeridian_0=o.mb)(e),l_=t._emscripten_bind_PePCSInfo_getDomainMinx_0=e=>(l_=t._emscripten_bind_PePCSInfo_getDomainMinx_0=o.nb)(e),M_=t._emscripten_bind_PePCSInfo_getDomainMiny_0=e=>(M_=t._emscripten_bind_PePCSInfo_getDomainMiny_0=o.ob)(e),v_=t._emscripten_bind_PePCSInfo_getDomainMaxx_0=e=>(v_=t._emscripten_bind_PePCSInfo_getDomainMaxx_0=o.pb)(e),D_=t._emscripten_bind_PePCSInfo_getDomainMaxy_0=e=>(D_=t._emscripten_bind_PePCSInfo_getDomainMaxy_0=o.qb)(e),A_=t._emscripten_bind_PePCSInfo_getNorthPoleLocation_0=e=>(A_=t._emscripten_bind_PePCSInfo_getNorthPoleLocation_0=o.rb)(e),R_=t._emscripten_bind_PePCSInfo_getNorthPoleGeometry_0=e=>(R_=t._emscripten_bind_PePCSInfo_getNorthPoleGeometry_0=o.sb)(e),G_=t._emscripten_bind_PePCSInfo_getSouthPoleLocation_0=e=>(G_=t._emscripten_bind_PePCSInfo_getSouthPoleLocation_0=o.tb)(e),C_=t._emscripten_bind_PePCSInfo_getSouthPoleGeometry_0=e=>(C_=t._emscripten_bind_PePCSInfo_getSouthPoleGeometry_0=o.ub)(e),I_=t._emscripten_bind_PePCSInfo_isDensificationNeeded_0=e=>(I_=t._emscripten_bind_PePCSInfo_isDensificationNeeded_0=o.vb)(e),j_=t._emscripten_bind_PePCSInfo_isGcsHorizonMultiOverlap_0=e=>(j_=t._emscripten_bind_PePCSInfo_isGcsHorizonMultiOverlap_0=o.wb)(e),U_=t._emscripten_bind_PePCSInfo_isPannableRectangle_0=e=>(U_=t._emscripten_bind_PePCSInfo_isPannableRectangle_0=o.xb)(e),L_=t._emscripten_bind_PePCSInfo_generate_2=(e,_,r)=>(L_=t._emscripten_bind_PePCSInfo_generate_2=o.yb)(e,_,r),F_=t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_NONE_0=e=>(F_=t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_NONE_0=o.zb)(e),Y_=t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_DOMAIN_0=e=>(Y_=t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_DOMAIN_0=o.Ab)(e),w_=t._emscripten_bind_PePCSInfo_get_PE_POLE_OUTSIDE_BOUNDARY_0=e=>(w_=t._emscripten_bind_PePCSInfo_get_PE_POLE_OUTSIDE_BOUNDARY_0=o.Bb)(e),x_=t._emscripten_bind_PePCSInfo_get_PE_POLE_POINT_0=e=>(x_=t._emscripten_bind_PePCSInfo_get_PE_POLE_POINT_0=o.Cb)(e),H_=t._emscripten_bind_PePrimem_getLongitude_0=e=>(H_=t._emscripten_bind_PePrimem_getLongitude_0=o.Db)(e),X_=t._emscripten_bind_PePrimem_getCode_0=e=>(X_=t._emscripten_bind_PePrimem_getCode_0=o.Eb)(e),z_=t._emscripten_bind_PePrimem_getName_1=(e,_)=>(z_=t._emscripten_bind_PePrimem_getName_1=o.Fb)(e,_),Z_=t._emscripten_bind_PePrimem_getType_0=e=>(Z_=t._emscripten_bind_PePrimem_getType_0=o.Gb)(e),W_=t._emscripten_bind_PeProjcs_getGeogcs_0=e=>(W_=t._emscripten_bind_PeProjcs_getGeogcs_0=o.Hb)(e),B_=t._emscripten_bind_PeProjcs_getParameters_0=e=>(B_=t._emscripten_bind_PeProjcs_getParameters_0=o.Ib)(e),K_=t._emscripten_bind_PeProjcs_getUnit_0=e=>(K_=t._emscripten_bind_PeProjcs_getUnit_0=o.Jb)(e),V_=t._emscripten_bind_PeProjcs_loadConstants_0=e=>(V_=t._emscripten_bind_PeProjcs_loadConstants_0=o.Kb)(e),q_=t._emscripten_bind_PeProjcs_horizonGcsGenerate_0=e=>(q_=t._emscripten_bind_PeProjcs_horizonGcsGenerate_0=o.Lb)(e),k_=t._emscripten_bind_PeProjcs_horizonPcsGenerate_0=e=>(k_=t._emscripten_bind_PeProjcs_horizonPcsGenerate_0=o.Mb)(e),$_=t._emscripten_bind_PeProjcs_getCode_0=e=>($_=t._emscripten_bind_PeProjcs_getCode_0=o.Nb)(e),J_=t._emscripten_bind_PeProjcs_getName_1=(e,_)=>(J_=t._emscripten_bind_PeProjcs_getName_1=o.Ob)(e,_),Q_=t._emscripten_bind_PeProjcs_getType_0=e=>(Q_=t._emscripten_bind_PeProjcs_getType_0=o.Pb)(e),er=t._emscripten_bind_PeSpheroid_getAxis_0=e=>(er=t._emscripten_bind_PeSpheroid_getAxis_0=o.Qb)(e),tr=t._emscripten_bind_PeSpheroid_getFlattening_0=e=>(tr=t._emscripten_bind_PeSpheroid_getFlattening_0=o.Rb)(e),_r=t._emscripten_bind_PeSpheroid_getCode_0=e=>(_r=t._emscripten_bind_PeSpheroid_getCode_0=o.Sb)(e),rr=t._emscripten_bind_PeSpheroid_getName_1=(e,_)=>(rr=t._emscripten_bind_PeSpheroid_getName_1=o.Tb)(e,_),or=t._emscripten_bind_PeSpheroid_getType_0=e=>(or=t._emscripten_bind_PeSpheroid_getType_0=o.Ub)(e),nr=t._emscripten_bind_PeUnit_getUnitFactor_0=e=>(nr=t._emscripten_bind_PeUnit_getUnitFactor_0=o.Vb)(e),pr=t._emscripten_bind_PeUnit_getCode_0=e=>(pr=t._emscripten_bind_PeUnit_getCode_0=o.Wb)(e),ir=t._emscripten_bind_PeUnit_getName_1=(e,_)=>(ir=t._emscripten_bind_PeUnit_getName_1=o.Xb)(e,_),cr=t._emscripten_bind_PeUnit_getType_0=e=>(cr=t._emscripten_bind_PeUnit_getType_0=o.Yb)(e),sr=t._emscripten_bind_PeVersion_version_string_0=e=>(sr=t._emscripten_bind_PeVersion_version_string_0=o.Zb)(e);function Pr(){function e(){ae||(ae=!0,t.calledRun=!0,he||(Sr(),k(t),Nr()))}se>0||(Or(),se>0||e())}function d(){}function _e(e){return(e||d).__cache__}function T(e,_){var r=_e(_),p=r[e];return p||((p=Object.create((_||d).prototype)).ptr=e,r[e]=p)}function $r(e,_){return T(e.ptr,_)}function Jr(e){if(!e.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";e.__destroy__(),delete _e(e.__class__)[e.ptr]}function Qr(e,_){return e.ptr===_.ptr}function eo(e){return e.ptr}function to(e){return e.__class__}t._pe_getPeGTlistExtendedEntrySize=()=>(t._pe_getPeGTlistExtendedEntrySize=o._b)(),t._pe_getPeGTlistExtendedGTsSize=()=>(t._pe_getPeGTlistExtendedGTsSize=o.$b)(),t._pe_getPeHorizonSize=()=>(t._pe_getPeHorizonSize=o.ac)(),t._pe_geog_to_geog=(e,_,r,p,i)=>(t._pe_geog_to_geog=o.cc)(e,_,r,p,i),t._pe_geog_to_proj=(e,_,r)=>(t._pe_geog_to_proj=o.dc)(e,_,r),t._pe_geog_to_dd=(e,_,r,p,i)=>(t._pe_geog_to_dd=o.ec)(e,_,r,p,i),t._pe_dd_to_geog=(e,_,r,p)=>(t._pe_dd_to_geog=o.fc)(e,_,r,p),t._pe_geog_to_ddm=(e,_,r,p,i)=>(t._pe_geog_to_ddm=o.gc)(e,_,r,p,i),t._pe_ddm_to_geog=(e,_,r,p)=>(t._pe_ddm_to_geog=o.hc)(e,_,r,p),t._pe_geog_to_dms=(e,_,r,p,i)=>(t._pe_geog_to_dms=o.ic)(e,_,r,p,i),t._pe_dms_to_geog=(e,_,r,p)=>(t._pe_dms_to_geog=o.jc)(e,_,r,p),t._pe_geog_to_mgrs_extended=(e,_,r,p,i,c,g)=>(t._pe_geog_to_mgrs_extended=o.kc)(e,_,r,p,i,c,g),t._pe_mgrs_to_geog_extended=(e,_,r,p,i)=>(t._pe_mgrs_to_geog_extended=o.lc)(e,_,r,p,i),t._pe_geog_to_usng=(e,_,r,p,i,c,g)=>(t._pe_geog_to_usng=o.mc)(e,_,r,p,i,c,g),t._pe_usng_to_geog=(e,_,r,p)=>(t._pe_usng_to_geog=o.nc)(e,_,r,p),t._pe_geog_to_utm=(e,_,r,p,i)=>(t._pe_geog_to_utm=o.oc)(e,_,r,p,i),t._pe_utm_to_geog=(e,_,r,p,i)=>(t._pe_utm_to_geog=o.pc)(e,_,r,p,i),t._pe_object_to_string_ext=(e,_,r)=>(t._pe_object_to_string_ext=o.qc)(e,_,r),t._pe_proj_to_geog_center=(e,_,r,p)=>(t._pe_proj_to_geog_center=o.rc)(e,_,r,p),t.___start_em_js=2033306,t.___stop_em_js=2033404,t.getValue=Gr,t.UTF8ToString=L,Q=function e(){ae||Pr(),ae||(Q=e)},Pr(),d.prototype=Object.create(d.prototype),d.prototype.constructor=d,d.prototype.__class__=d,d.__cache__={},t.WrapperObject=d,t.getCache=_e,t.wrapPointer=T,t.castObject=$r,t.NULL=T(0),t.destroy=Jr,t.compare=Qr,t.getPointer=eo,t.getClass=to;var P={buffer:0,size:0,pos:0,temps:[],needed:0,prepare(){if(P.needed){for(var e=0;e=P.size?(de(i>0),P.needed+=i,r=t._webidl_malloc(i),P.temps.push(r)):(r=P.buffer+P.pos,P.pos+=i),r},copy(e,_,r){switch(r>>>=0,_.BYTES_PER_ELEMENT){case 2:r>>>=1;break;case 4:r>>>=2;break;case 8:r>>>=3}for(var p=0;pt[x]})}}}return Object.freeze(Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}))}var ur,re,dr,ge={exports:{}};ge.exports,ur=ge,ge.exports,re=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(re=re||__filename),dr=function(K={}){var k,W,t=K;t.ready=new Promise((e,_)=>{k=e,W=_});var x,z,oe,me=Object.assign({},t),Te="./this.program",Oe=typeof window=="object",$=typeof importScripts=="function",Se=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",Y="";function Er(e){return t.locateFile?t.locateFile(e,Y):Y+e}if(Se){var Ne=require("fs"),ye=require("path");Y=$?ye.dirname(Y)+"/":__dirname+"/",x=(e,_)=>(e=Pe(e)?new URL(e):ye.normalize(e),Ne.readFileSync(e,_?void 0:"utf8")),oe=e=>{var _=x(e,!0);return _.buffer||(_=new Uint8Array(_)),_},z=(e,_,r,p=!0)=>{e=Pe(e)?new URL(e):ye.normalize(e),Ne.readFile(e,p?void 0:"utf8",(i,c)=>{i?r(i):_(p?c.buffer:c)})},!t.thisProgram&&process.argv.length>1&&(Te=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),t.inspect=()=>"[Emscripten Module object]"}else(Oe||$)&&($?Y=self.location.href:typeof document<"u"&&document.currentScript&&(Y=document.currentScript.src),re&&(Y=re),Y=Y.indexOf("blob:")!==0?Y.substr(0,Y.replace(/[?#].*/,"").lastIndexOf("/")+1):"",x=e=>{var _=new XMLHttpRequest;return _.open("GET",e,!1),_.send(null),_.responseText},$&&(oe=e=>{var _=new XMLHttpRequest;return _.open("GET",e,!1),_.responseType="arraybuffer",_.send(null),new Uint8Array(_.response)}),z=(e,_,r)=>{var p=new XMLHttpRequest;p.open("GET",e,!0),p.responseType="arraybuffer",p.onload=()=>{p.status==200||p.status==0&&p.response?_(p.response):r()},p.onerror=r,p.send(null)});var ue,ne,br=console.log.bind(console),J=console.error.bind(console);Object.assign(t,me),me=null,typeof WebAssembly!="object"&&q("no native wasm support detected");var Z,V,pe,D,j,ie,ce,he=!1;function de(e,_){e||q(_)}function le(){var e=ne.buffer;t.HEAP8=Z=new Int8Array(e),t.HEAP16=pe=new Int16Array(e),t.HEAPU8=V=new Uint8Array(e),t.HEAPU16=new Uint16Array(e),t.HEAP32=D=new Int32Array(e),t.HEAPU32=j=new Uint32Array(e),t.HEAPF32=ie=new Float32Array(e),t.HEAPF64=ce=new Float64Array(e)}var mr=[],Me=[],Tr=[];function Or(){fe(mr)}function Sr(){fe(Me)}function Nr(){fe(Tr)}function hr(e){Me.unshift(e)}var se=0,Q=null;function lr(e){se++}function Mr(e){if(--se==0&&Q){var _=Q;Q=null,_()}}function q(e){J(e="Aborted("+e+")"),he=!0,e+=". Build with -sASSERTIONS for more info.";var _=new WebAssembly.RuntimeError(e);throw W(_),_}var ee,vr="data:application/octet-stream;base64,";function ve(e){return e.startsWith(vr)}function Pe(e){return e.startsWith("file://")}function De(e){if(e==ee&&ue)return new Uint8Array(ue);if(oe)return oe(e);throw"both async and sync fetching of the wasm failed"}function Dr(e){if(Oe||$){if(typeof fetch=="function"&&!Pe(e))return fetch(e,{credentials:"same-origin"}).then(_=>{if(!_.ok)throw"failed to load wasm binary file at '"+e+"'";return _.arrayBuffer()}).catch(()=>De(e));if(z)return new Promise((_,r)=>{z(e,p=>_(new Uint8Array(p)),r)})}return Promise.resolve().then(()=>De(e))}function Ae(e,_,r){return Dr(e).then(p=>WebAssembly.instantiate(p,_)).then(p=>p).then(r,p=>{J(`failed to asynchronously prepare wasm: ${p}`),q(p)})}function Ar(e,_,r,p){return e||typeof WebAssembly.instantiateStreaming!="function"||ve(_)||Pe(_)||Se||typeof fetch!="function"?Ae(_,r,p):fetch(_,{credentials:"same-origin"}).then(i=>WebAssembly.instantiateStreaming(i,r).then(p,function(c){return J(`wasm streaming compile failed: ${c}`),J("falling back to ArrayBuffer instantiation"),Ae(_,r,p)}))}function Rr(){var e={a:kr};function _(p,i){return o=p.exports,ne=o.t,le(),hr(o.u),Mr(),o}function r(p){_(p.instance)}return lr(),Ar(ue,ee,e,r).catch(W),{}}ve(ee="pe-wasm.wasm")||(ee=Er(ee));var fe=e=>{for(;e.length>0;)e.shift()(t)};function Gr(e,_="i8"){switch(_.endsWith("*")&&(_="*"),_){case"i1":case"i8":return Z[e>>0];case"i16":return pe[e>>1];case"i32":return D[e>>2];case"i64":q("to do getValue(i64) use WASM_BIGINT");case"float":return ie[e>>2];case"double":return ce[e>>3];case"*":return j[e>>2];default:q(`invalid type for getValue: ${_}`)}}var Re=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Ge=(e,_,r)=>{for(var p=_+r,i=_;e[i]&&!(i>=p);)++i;if(i-_>16&&e.buffer&&Re)return Re.decode(e.subarray(_,i));for(var c="";_>10,56320|1023&B)}}else c+=String.fromCharCode((31&g)<<6|a)}else c+=String.fromCharCode(g)}return c},L=(e,_)=>e?Ge(V,e,_):"";function Cr(e,_,r){return 0}var Ce=(e,_,r,p)=>{if(!(p>0))return 0;for(var i=r,c=r+p-1,g=0;g=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++g)),a<=127){if(r>=c)break;_[r++]=a}else if(a<=2047){if(r+1>=c)break;_[r++]=192|a>>6,_[r++]=128|63&a}else if(a<=65535){if(r+2>=c)break;_[r++]=224|a>>12,_[r++]=128|a>>6&63,_[r++]=128|63&a}else{if(r+3>=c)break;_[r++]=240|a>>18,_[r++]=128|a>>12&63,_[r++]=128|a>>6&63,_[r++]=128|63&a}}return _[r]=0,r-i},Ir=(e,_,r)=>Ce(e,V,_,r);function jr(e,_,r){return 0}function Ur(e,_,r,p){}var Lr=e=>e%4==0&&(e%100!=0||e%400==0),Fr=[0,31,60,91,121,152,182,213,244,274,305,335],Yr=[0,31,59,90,120,151,181,212,243,273,304,334],wr=e=>(Lr(e.getFullYear())?Fr:Yr)[e.getMonth()]+e.getDate()-1,xr=(e,_)=>_+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*_:NaN;function Hr(e,_,r){var p=xr(e,_),i=new Date(1e3*p);D[r>>2]=i.getSeconds(),D[r+4>>2]=i.getMinutes(),D[r+8>>2]=i.getHours(),D[r+12>>2]=i.getDate(),D[r+16>>2]=i.getMonth(),D[r+20>>2]=i.getFullYear()-1900,D[r+24>>2]=i.getDay();var c=0|wr(i);D[r+28>>2]=c,D[r+36>>2]=-60*i.getTimezoneOffset();var g=new Date(i.getFullYear(),0,1),a=new Date(i.getFullYear(),6,1).getTimezoneOffset(),C=g.getTimezoneOffset(),B=0|(a!=C&&i.getTimezoneOffset()==Math.min(C,a));D[r+32>>2]=B}var Ie=e=>{for(var _=0,r=0;r=55296&&p<=57343?(_+=4,++r):_+=3}return _},je=e=>{var _=Ie(e)+1,r=Ue(_);return r&&Ir(e,r,_),r},Xr=()=>2147483648,zr=e=>{var _=(e-ne.buffer.byteLength+65535)/65536;try{return ne.grow(_),le(),1}catch{}},Ee={},Zr=()=>Te||"./this.program",te=()=>{if(!te.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:Zr()};for(var _ in Ee)Ee[_]===void 0?delete e[_]:e[_]=Ee[_];var r=[];for(var _ in e)r.push(`${_}=${e[_]}`);te.strings=r}return te.strings},Wr=(e,_)=>{for(var r=0;r>0]=e.charCodeAt(r);Z[_>>0]=0};function Br(e,_,r,p,i){return 70}var Kr=[null,[],[]],Vr=(e,_)=>{var r=Kr[e];_===0||_===10?((e===1?br:J)(Ge(r,0)),r.length=0):r.push(_)};function qr(e,_,r){var p=r>0?r:Ie(e)+1,i=new Array(p),c=Ce(e,i,0,i.length);return _&&(i.length=c),i}var kr={c:Cr,r:(e,_,r)=>{},h:jr,d:Ur,p:e=>{},o:(e,_)=>{},q:(e,_,r)=>{},j:Hr,n:(e,_,r)=>{var p=new Date().getFullYear(),i=new Date(p,0,1),c=new Date(p,6,1),g=i.getTimezoneOffset(),a=c.getTimezoneOffset(),C=Math.max(g,a);function B(co){var yr=co.toTimeString().match(/\(([A-Za-z ]+)\)$/);return yr?yr[1]:"GMT"}j[e>>2]=60*C,D[_>>2]=+(g!=a);var po=B(i),io=B(c),ar=je(po),gr=je(io);a>2]=ar,j[r+4>>2]=gr):(j[r>>2]=gr,j[r+4>>2]=ar)},l:()=>{q("")},i:()=>Date.now(),s:(e,_,r)=>V.copyWithin(e,_,_+r),m:e=>{var _=V.length;e>>>=0;var r=Xr();if(e>r)return!1;for(var p=(a,C)=>a+(C-a%C)%C,i=1;i<=4;i*=2){var c=_*(1+.2/i);c=Math.min(c,e+100663296);var g=Math.min(r,p(Math.max(e,c),65536));if(zr(g))return!0}return!1},e:(e,_)=>{var r=0;return te().forEach((p,i)=>{var c=_+r;j[e+4*i>>2]=c,Wr(p,c),r+=p.length+1}),0},f:(e,_)=>{var r=te();j[e>>2]=r.length;var p=0;return r.forEach(i=>p+=i.length+1),j[_>>2]=p,0},a:e=>52,g:(e,_,r,p)=>52,k:Br,b:(e,_,r,p)=>{for(var i=0,c=0;c>2],a=j[_+4>>2];_+=8;for(var C=0;C>2]=i,0}},o=Rr();t._webidl_free=e=>(t._webidl_free=o.v)(e),t._webidl_malloc=e=>(t._webidl_malloc=o.w)(e);var ae,Ue=e=>(Ue=o.x)(e),Le=t._emscripten_bind_PeObject_getCode_0=e=>(Le=t._emscripten_bind_PeObject_getCode_0=o.y)(e),Fe=t._emscripten_bind_PeObject_getName_1=(e,_)=>(Fe=t._emscripten_bind_PeObject_getName_1=o.z)(e,_),Ye=t._emscripten_bind_PeObject_getType_0=e=>(Ye=t._emscripten_bind_PeObject_getType_0=o.A)(e),we=t._emscripten_bind_PeCoordsys_getCode_0=e=>(we=t._emscripten_bind_PeCoordsys_getCode_0=o.B)(e),xe=t._emscripten_bind_PeCoordsys_getName_1=(e,_)=>(xe=t._emscripten_bind_PeCoordsys_getName_1=o.C)(e,_),He=t._emscripten_bind_PeCoordsys_getType_0=e=>(He=t._emscripten_bind_PeCoordsys_getType_0=o.D)(e),Xe=t._emscripten_bind_VoidPtr___destroy___0=e=>(Xe=t._emscripten_bind_VoidPtr___destroy___0=o.E)(e),ze=t._emscripten_bind_PeDatum_getSpheroid_0=e=>(ze=t._emscripten_bind_PeDatum_getSpheroid_0=o.F)(e),Ze=t._emscripten_bind_PeDatum_getCode_0=e=>(Ze=t._emscripten_bind_PeDatum_getCode_0=o.G)(e),We=t._emscripten_bind_PeDatum_getName_1=(e,_)=>(We=t._emscripten_bind_PeDatum_getName_1=o.H)(e,_),Be=t._emscripten_bind_PeDatum_getType_0=e=>(Be=t._emscripten_bind_PeDatum_getType_0=o.I)(e),Ke=t._emscripten_bind_PeDefs_get_PE_BUFFER_MAX_0=e=>(Ke=t._emscripten_bind_PeDefs_get_PE_BUFFER_MAX_0=o.J)(e),Ve=t._emscripten_bind_PeDefs_get_PE_NAME_MAX_0=e=>(Ve=t._emscripten_bind_PeDefs_get_PE_NAME_MAX_0=o.K)(e),qe=t._emscripten_bind_PeDefs_get_PE_MGRS_MAX_0=e=>(qe=t._emscripten_bind_PeDefs_get_PE_MGRS_MAX_0=o.L)(e),ke=t._emscripten_bind_PeDefs_get_PE_USNG_MAX_0=e=>(ke=t._emscripten_bind_PeDefs_get_PE_USNG_MAX_0=o.M)(e),$e=t._emscripten_bind_PeDefs_get_PE_DD_MAX_0=e=>($e=t._emscripten_bind_PeDefs_get_PE_DD_MAX_0=o.N)(e),Je=t._emscripten_bind_PeDefs_get_PE_DMS_MAX_0=e=>(Je=t._emscripten_bind_PeDefs_get_PE_DMS_MAX_0=o.O)(e),Qe=t._emscripten_bind_PeDefs_get_PE_DDM_MAX_0=e=>(Qe=t._emscripten_bind_PeDefs_get_PE_DDM_MAX_0=o.P)(e),et=t._emscripten_bind_PeDefs_get_PE_UTM_MAX_0=e=>(et=t._emscripten_bind_PeDefs_get_PE_UTM_MAX_0=o.Q)(e),tt=t._emscripten_bind_PeDefs_get_PE_PARM_MAX_0=e=>(tt=t._emscripten_bind_PeDefs_get_PE_PARM_MAX_0=o.R)(e),_t=t._emscripten_bind_PeDefs_get_PE_TYPE_NONE_0=e=>(_t=t._emscripten_bind_PeDefs_get_PE_TYPE_NONE_0=o.S)(e),rt=t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGCS_0=e=>(rt=t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGCS_0=o.T)(e),ot=t._emscripten_bind_PeDefs_get_PE_TYPE_PROJCS_0=e=>(ot=t._emscripten_bind_PeDefs_get_PE_TYPE_PROJCS_0=o.U)(e),nt=t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGTRAN_0=e=>(nt=t._emscripten_bind_PeDefs_get_PE_TYPE_GEOGTRAN_0=o.V)(e),pt=t._emscripten_bind_PeDefs_get_PE_TYPE_COORDSYS_0=e=>(pt=t._emscripten_bind_PeDefs_get_PE_TYPE_COORDSYS_0=o.W)(e),it=t._emscripten_bind_PeDefs_get_PE_TYPE_UNIT_0=e=>(it=t._emscripten_bind_PeDefs_get_PE_TYPE_UNIT_0=o.X)(e),ct=t._emscripten_bind_PeDefs_get_PE_TYPE_LINUNIT_0=e=>(ct=t._emscripten_bind_PeDefs_get_PE_TYPE_LINUNIT_0=o.Y)(e),st=t._emscripten_bind_PeDefs_get_PE_STR_OPTS_NONE_0=e=>(st=t._emscripten_bind_PeDefs_get_PE_STR_OPTS_NONE_0=o.Z)(e),Pt=t._emscripten_bind_PeDefs_get_PE_STR_AUTH_NONE_0=e=>(Pt=t._emscripten_bind_PeDefs_get_PE_STR_AUTH_NONE_0=o._)(e),at=t._emscripten_bind_PeDefs_get_PE_STR_AUTH_TOP_0=e=>(at=t._emscripten_bind_PeDefs_get_PE_STR_AUTH_TOP_0=o.$)(e),gt=t._emscripten_bind_PeDefs_get_PE_STR_NAME_CANON_0=e=>(gt=t._emscripten_bind_PeDefs_get_PE_STR_NAME_CANON_0=o.aa)(e),yt=t._emscripten_bind_PeDefs_get_PE_STR_FMT_WKT_0=e=>(yt=t._emscripten_bind_PeDefs_get_PE_STR_FMT_WKT_0=o.ba)(e),ut=t._emscripten_bind_PeDefs_get_PE_STR_FMT_WKT2_0=e=>(ut=t._emscripten_bind_PeDefs_get_PE_STR_FMT_WKT2_0=o.ca)(e),dt=t._emscripten_bind_PeDefs_get_PE_PARM_X0_0=e=>(dt=t._emscripten_bind_PeDefs_get_PE_PARM_X0_0=o.da)(e),ft=t._emscripten_bind_PeDefs_get_PE_PARM_ND_0=e=>(ft=t._emscripten_bind_PeDefs_get_PE_PARM_ND_0=o.ea)(e),Et=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_1_TO_2_0=e=>(Et=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_1_TO_2_0=o.fa)(e),bt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_2_TO_1_0=e=>(bt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_2_TO_1_0=o.ga)(e),mt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_P_TO_G_0=e=>(mt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_P_TO_G_0=o.ha)(e),Tt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_G_TO_P_0=e=>(Tt=t._emscripten_bind_PeDefs_get_PE_TRANSFORM_G_TO_P_0=o.ia)(e),Ot=t._emscripten_bind_PeDefs_get_PE_HORIZON_RECT_0=e=>(Ot=t._emscripten_bind_PeDefs_get_PE_HORIZON_RECT_0=o.ja)(e),St=t._emscripten_bind_PeDefs_get_PE_HORIZON_POLY_0=e=>(St=t._emscripten_bind_PeDefs_get_PE_HORIZON_POLY_0=o.ka)(e),Nt=t._emscripten_bind_PeDefs_get_PE_HORIZON_LINE_0=e=>(Nt=t._emscripten_bind_PeDefs_get_PE_HORIZON_LINE_0=o.la)(e),ht=t._emscripten_bind_PeDefs_get_PE_HORIZON_DELTA_0=e=>(ht=t._emscripten_bind_PeDefs_get_PE_HORIZON_DELTA_0=o.ma)(e),lt=t._emscripten_bind_PeFactory_initialize_1=(e,_)=>(lt=t._emscripten_bind_PeFactory_initialize_1=o.na)(e,_),Mt=t._emscripten_bind_PeFactory_factoryByType_2=(e,_,r)=>(Mt=t._emscripten_bind_PeFactory_factoryByType_2=o.oa)(e,_,r),vt=t._emscripten_bind_PeFactory_fromString_2=(e,_,r)=>(vt=t._emscripten_bind_PeFactory_fromString_2=o.pa)(e,_,r),Dt=t._emscripten_bind_PeFactory_getCode_1=(e,_)=>(Dt=t._emscripten_bind_PeFactory_getCode_1=o.qa)(e,_),At=t._emscripten_bind_PeGCSExtent_PeGCSExtent_6=(e,_,r,p,i,c)=>(At=t._emscripten_bind_PeGCSExtent_PeGCSExtent_6=o.ra)(e,_,r,p,i,c),Rt=t._emscripten_bind_PeGCSExtent_getLLon_0=e=>(Rt=t._emscripten_bind_PeGCSExtent_getLLon_0=o.sa)(e),Gt=t._emscripten_bind_PeGCSExtent_getSLat_0=e=>(Gt=t._emscripten_bind_PeGCSExtent_getSLat_0=o.ta)(e),Ct=t._emscripten_bind_PeGCSExtent_getRLon_0=e=>(Ct=t._emscripten_bind_PeGCSExtent_getRLon_0=o.ua)(e),It=t._emscripten_bind_PeGCSExtent_getNLat_0=e=>(It=t._emscripten_bind_PeGCSExtent_getNLat_0=o.va)(e),jt=t._emscripten_bind_PeGCSExtent___destroy___0=e=>(jt=t._emscripten_bind_PeGCSExtent___destroy___0=o.wa)(e),Ut=t._emscripten_bind_PeGeogcs_getDatum_0=e=>(Ut=t._emscripten_bind_PeGeogcs_getDatum_0=o.xa)(e),Lt=t._emscripten_bind_PeGeogcs_getPrimem_0=e=>(Lt=t._emscripten_bind_PeGeogcs_getPrimem_0=o.ya)(e),Ft=t._emscripten_bind_PeGeogcs_getUnit_0=e=>(Ft=t._emscripten_bind_PeGeogcs_getUnit_0=o.za)(e),Yt=t._emscripten_bind_PeGeogcs_getCode_0=e=>(Yt=t._emscripten_bind_PeGeogcs_getCode_0=o.Aa)(e),wt=t._emscripten_bind_PeGeogcs_getName_1=(e,_)=>(wt=t._emscripten_bind_PeGeogcs_getName_1=o.Ba)(e,_),xt=t._emscripten_bind_PeGeogcs_getType_0=e=>(xt=t._emscripten_bind_PeGeogcs_getType_0=o.Ca)(e),Ht=t._emscripten_bind_PeGeogtran_isEqual_1=(e,_)=>(Ht=t._emscripten_bind_PeGeogtran_isEqual_1=o.Da)(e,_),Xt=t._emscripten_bind_PeGeogtran_getGeogcs1_0=e=>(Xt=t._emscripten_bind_PeGeogtran_getGeogcs1_0=o.Ea)(e),zt=t._emscripten_bind_PeGeogtran_getGeogcs2_0=e=>(zt=t._emscripten_bind_PeGeogtran_getGeogcs2_0=o.Fa)(e),Zt=t._emscripten_bind_PeGeogtran_getParameters_0=e=>(Zt=t._emscripten_bind_PeGeogtran_getParameters_0=o.Ga)(e),Wt=t._emscripten_bind_PeGeogtran_loadConstants_0=e=>(Wt=t._emscripten_bind_PeGeogtran_loadConstants_0=o.Ha)(e),Bt=t._emscripten_bind_PeGeogtran_getCode_0=e=>(Bt=t._emscripten_bind_PeGeogtran_getCode_0=o.Ia)(e),Kt=t._emscripten_bind_PeGeogtran_getName_1=(e,_)=>(Kt=t._emscripten_bind_PeGeogtran_getName_1=o.Ja)(e,_),Vt=t._emscripten_bind_PeGeogtran_getType_0=e=>(Vt=t._emscripten_bind_PeGeogtran_getType_0=o.Ka)(e),qt=t._emscripten_bind_PeGTlistExtended_getGTlist_6=(e,_,r,p,i,c,g)=>(qt=t._emscripten_bind_PeGTlistExtended_getGTlist_6=o.La)(e,_,r,p,i,c,g),kt=t._emscripten_bind_PeGTlistExtended_get_PE_GTLIST_OPTS_COMMON_0=e=>(kt=t._emscripten_bind_PeGTlistExtended_get_PE_GTLIST_OPTS_COMMON_0=o.Ma)(e),$t=t._emscripten_bind_PeGTlistExtendedEntry_getEntries_0=e=>($t=t._emscripten_bind_PeGTlistExtendedEntry_getEntries_0=o.Na)(e),Jt=t._emscripten_bind_PeGTlistExtendedEntry_getSteps_0=e=>(Jt=t._emscripten_bind_PeGTlistExtendedEntry_getSteps_0=o.Oa)(e),Qt=t._emscripten_bind_PeGTlistExtendedEntry_Delete_1=(e,_)=>(Qt=t._emscripten_bind_PeGTlistExtendedEntry_Delete_1=o.Pa)(e,_),e_=t._emscripten_bind_PeGTlistExtendedGTs_getDirection_0=e=>(e_=t._emscripten_bind_PeGTlistExtendedGTs_getDirection_0=o.Qa)(e),t_=t._emscripten_bind_PeGTlistExtendedGTs_getGeogtran_0=e=>(t_=t._emscripten_bind_PeGTlistExtendedGTs_getGeogtran_0=o.Ra)(e),__=t._emscripten_bind_PeHorizon_getNump_0=e=>(__=t._emscripten_bind_PeHorizon_getNump_0=o.Sa)(e),r_=t._emscripten_bind_PeHorizon_getKind_0=e=>(r_=t._emscripten_bind_PeHorizon_getKind_0=o.Ta)(e),o_=t._emscripten_bind_PeHorizon_getInclusive_0=e=>(o_=t._emscripten_bind_PeHorizon_getInclusive_0=o.Ua)(e),n_=t._emscripten_bind_PeHorizon_getSize_0=e=>(n_=t._emscripten_bind_PeHorizon_getSize_0=o.Va)(e),p_=t._emscripten_bind_PeHorizon_getCoord_0=e=>(p_=t._emscripten_bind_PeHorizon_getCoord_0=o.Wa)(e),i_=t._emscripten_bind_PeInteger_PeInteger_1=e=>(i_=t._emscripten_bind_PeInteger_PeInteger_1=o.Xa)(e),c_=t._emscripten_bind_PeInteger_get_val_0=e=>(c_=t._emscripten_bind_PeInteger_get_val_0=o.Ya)(e),s_=t._emscripten_bind_PeInteger_set_val_1=(e,_)=>(s_=t._emscripten_bind_PeInteger_set_val_1=o.Za)(e,_),P_=t._emscripten_bind_PeInteger___destroy___0=e=>(P_=t._emscripten_bind_PeInteger___destroy___0=o._a)(e),a_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_NEW_0=e=>(a_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_NEW_0=o.$a)(e),g_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_OLD_0=e=>(g_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_OLD_0=o.ab)(e),y_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_AUTO_0=e=>(y_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_STYLE_AUTO_0=o.bb)(e),u_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_180_ZONE_1_PLUS_0=e=>(u_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_180_ZONE_1_PLUS_0=o.cb)(e),d_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_ADD_SPACES_0=e=>(d_=t._emscripten_bind_PeNotationMgrs_get_PE_MGRS_ADD_SPACES_0=o.db)(e),f_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NONE_0=e=>(f_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NONE_0=o.eb)(e),E_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_0=e=>(E_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_0=o.fb)(e),b_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_STRICT_0=e=>(b_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_NS_STRICT_0=o.gb)(e),m_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_ADD_SPACES_0=e=>(m_=t._emscripten_bind_PeNotationUtm_get_PE_UTM_OPTS_ADD_SPACES_0=o.hb)(e),T_=t._emscripten_bind_PeParameter_getValue_0=e=>(T_=t._emscripten_bind_PeParameter_getValue_0=o.ib)(e),O_=t._emscripten_bind_PeParameter_getCode_0=e=>(O_=t._emscripten_bind_PeParameter_getCode_0=o.jb)(e),S_=t._emscripten_bind_PeParameter_getName_1=(e,_)=>(S_=t._emscripten_bind_PeParameter_getName_1=o.kb)(e,_),N_=t._emscripten_bind_PeParameter_getType_0=e=>(N_=t._emscripten_bind_PeParameter_getType_0=o.lb)(e),h_=t._emscripten_bind_PePCSInfo_getCentralMeridian_0=e=>(h_=t._emscripten_bind_PePCSInfo_getCentralMeridian_0=o.mb)(e),l_=t._emscripten_bind_PePCSInfo_getDomainMinx_0=e=>(l_=t._emscripten_bind_PePCSInfo_getDomainMinx_0=o.nb)(e),M_=t._emscripten_bind_PePCSInfo_getDomainMiny_0=e=>(M_=t._emscripten_bind_PePCSInfo_getDomainMiny_0=o.ob)(e),v_=t._emscripten_bind_PePCSInfo_getDomainMaxx_0=e=>(v_=t._emscripten_bind_PePCSInfo_getDomainMaxx_0=o.pb)(e),D_=t._emscripten_bind_PePCSInfo_getDomainMaxy_0=e=>(D_=t._emscripten_bind_PePCSInfo_getDomainMaxy_0=o.qb)(e),A_=t._emscripten_bind_PePCSInfo_getNorthPoleLocation_0=e=>(A_=t._emscripten_bind_PePCSInfo_getNorthPoleLocation_0=o.rb)(e),R_=t._emscripten_bind_PePCSInfo_getNorthPoleGeometry_0=e=>(R_=t._emscripten_bind_PePCSInfo_getNorthPoleGeometry_0=o.sb)(e),G_=t._emscripten_bind_PePCSInfo_getSouthPoleLocation_0=e=>(G_=t._emscripten_bind_PePCSInfo_getSouthPoleLocation_0=o.tb)(e),C_=t._emscripten_bind_PePCSInfo_getSouthPoleGeometry_0=e=>(C_=t._emscripten_bind_PePCSInfo_getSouthPoleGeometry_0=o.ub)(e),I_=t._emscripten_bind_PePCSInfo_isDensificationNeeded_0=e=>(I_=t._emscripten_bind_PePCSInfo_isDensificationNeeded_0=o.vb)(e),j_=t._emscripten_bind_PePCSInfo_isGcsHorizonMultiOverlap_0=e=>(j_=t._emscripten_bind_PePCSInfo_isGcsHorizonMultiOverlap_0=o.wb)(e),U_=t._emscripten_bind_PePCSInfo_isPannableRectangle_0=e=>(U_=t._emscripten_bind_PePCSInfo_isPannableRectangle_0=o.xb)(e),L_=t._emscripten_bind_PePCSInfo_generate_2=(e,_,r)=>(L_=t._emscripten_bind_PePCSInfo_generate_2=o.yb)(e,_,r),F_=t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_NONE_0=e=>(F_=t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_NONE_0=o.zb)(e),Y_=t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_DOMAIN_0=e=>(Y_=t._emscripten_bind_PePCSInfo_get_PE_PCSINFO_OPTION_DOMAIN_0=o.Ab)(e),w_=t._emscripten_bind_PePCSInfo_get_PE_POLE_OUTSIDE_BOUNDARY_0=e=>(w_=t._emscripten_bind_PePCSInfo_get_PE_POLE_OUTSIDE_BOUNDARY_0=o.Bb)(e),x_=t._emscripten_bind_PePCSInfo_get_PE_POLE_POINT_0=e=>(x_=t._emscripten_bind_PePCSInfo_get_PE_POLE_POINT_0=o.Cb)(e),H_=t._emscripten_bind_PePrimem_getLongitude_0=e=>(H_=t._emscripten_bind_PePrimem_getLongitude_0=o.Db)(e),X_=t._emscripten_bind_PePrimem_getCode_0=e=>(X_=t._emscripten_bind_PePrimem_getCode_0=o.Eb)(e),z_=t._emscripten_bind_PePrimem_getName_1=(e,_)=>(z_=t._emscripten_bind_PePrimem_getName_1=o.Fb)(e,_),Z_=t._emscripten_bind_PePrimem_getType_0=e=>(Z_=t._emscripten_bind_PePrimem_getType_0=o.Gb)(e),W_=t._emscripten_bind_PeProjcs_getGeogcs_0=e=>(W_=t._emscripten_bind_PeProjcs_getGeogcs_0=o.Hb)(e),B_=t._emscripten_bind_PeProjcs_getParameters_0=e=>(B_=t._emscripten_bind_PeProjcs_getParameters_0=o.Ib)(e),K_=t._emscripten_bind_PeProjcs_getUnit_0=e=>(K_=t._emscripten_bind_PeProjcs_getUnit_0=o.Jb)(e),V_=t._emscripten_bind_PeProjcs_loadConstants_0=e=>(V_=t._emscripten_bind_PeProjcs_loadConstants_0=o.Kb)(e),q_=t._emscripten_bind_PeProjcs_horizonGcsGenerate_0=e=>(q_=t._emscripten_bind_PeProjcs_horizonGcsGenerate_0=o.Lb)(e),k_=t._emscripten_bind_PeProjcs_horizonPcsGenerate_0=e=>(k_=t._emscripten_bind_PeProjcs_horizonPcsGenerate_0=o.Mb)(e),$_=t._emscripten_bind_PeProjcs_getCode_0=e=>($_=t._emscripten_bind_PeProjcs_getCode_0=o.Nb)(e),J_=t._emscripten_bind_PeProjcs_getName_1=(e,_)=>(J_=t._emscripten_bind_PeProjcs_getName_1=o.Ob)(e,_),Q_=t._emscripten_bind_PeProjcs_getType_0=e=>(Q_=t._emscripten_bind_PeProjcs_getType_0=o.Pb)(e),er=t._emscripten_bind_PeSpheroid_getAxis_0=e=>(er=t._emscripten_bind_PeSpheroid_getAxis_0=o.Qb)(e),tr=t._emscripten_bind_PeSpheroid_getFlattening_0=e=>(tr=t._emscripten_bind_PeSpheroid_getFlattening_0=o.Rb)(e),_r=t._emscripten_bind_PeSpheroid_getCode_0=e=>(_r=t._emscripten_bind_PeSpheroid_getCode_0=o.Sb)(e),rr=t._emscripten_bind_PeSpheroid_getName_1=(e,_)=>(rr=t._emscripten_bind_PeSpheroid_getName_1=o.Tb)(e,_),or=t._emscripten_bind_PeSpheroid_getType_0=e=>(or=t._emscripten_bind_PeSpheroid_getType_0=o.Ub)(e),nr=t._emscripten_bind_PeUnit_getUnitFactor_0=e=>(nr=t._emscripten_bind_PeUnit_getUnitFactor_0=o.Vb)(e),pr=t._emscripten_bind_PeUnit_getCode_0=e=>(pr=t._emscripten_bind_PeUnit_getCode_0=o.Wb)(e),ir=t._emscripten_bind_PeUnit_getName_1=(e,_)=>(ir=t._emscripten_bind_PeUnit_getName_1=o.Xb)(e,_),cr=t._emscripten_bind_PeUnit_getType_0=e=>(cr=t._emscripten_bind_PeUnit_getType_0=o.Yb)(e),sr=t._emscripten_bind_PeVersion_version_string_0=e=>(sr=t._emscripten_bind_PeVersion_version_string_0=o.Zb)(e);function Pr(){function e(){ae||(ae=!0,t.calledRun=!0,he||(Sr(),k(t),Nr()))}se>0||(Or(),se>0||e())}function d(){}function _e(e){return(e||d).__cache__}function T(e,_){var r=_e(_),p=r[e];return p||((p=Object.create((_||d).prototype)).ptr=e,r[e]=p)}function $r(e,_){return T(e.ptr,_)}function Jr(e){if(!e.__destroy__)throw"Error: Cannot destroy object. (Did you create it yourself?)";e.__destroy__(),delete _e(e.__class__)[e.ptr]}function Qr(e,_){return e.ptr===_.ptr}function eo(e){return e.ptr}function to(e){return e.__class__}t._pe_getPeGTlistExtendedEntrySize=()=>(t._pe_getPeGTlistExtendedEntrySize=o._b)(),t._pe_getPeGTlistExtendedGTsSize=()=>(t._pe_getPeGTlistExtendedGTsSize=o.$b)(),t._pe_getPeHorizonSize=()=>(t._pe_getPeHorizonSize=o.ac)(),t._pe_geog_to_geog=(e,_,r,p,i)=>(t._pe_geog_to_geog=o.cc)(e,_,r,p,i),t._pe_geog_to_proj=(e,_,r)=>(t._pe_geog_to_proj=o.dc)(e,_,r),t._pe_geog_to_dd=(e,_,r,p,i)=>(t._pe_geog_to_dd=o.ec)(e,_,r,p,i),t._pe_dd_to_geog=(e,_,r,p)=>(t._pe_dd_to_geog=o.fc)(e,_,r,p),t._pe_geog_to_ddm=(e,_,r,p,i)=>(t._pe_geog_to_ddm=o.gc)(e,_,r,p,i),t._pe_ddm_to_geog=(e,_,r,p)=>(t._pe_ddm_to_geog=o.hc)(e,_,r,p),t._pe_geog_to_dms=(e,_,r,p,i)=>(t._pe_geog_to_dms=o.ic)(e,_,r,p,i),t._pe_dms_to_geog=(e,_,r,p)=>(t._pe_dms_to_geog=o.jc)(e,_,r,p),t._pe_geog_to_mgrs_extended=(e,_,r,p,i,c,g)=>(t._pe_geog_to_mgrs_extended=o.kc)(e,_,r,p,i,c,g),t._pe_mgrs_to_geog_extended=(e,_,r,p,i)=>(t._pe_mgrs_to_geog_extended=o.lc)(e,_,r,p,i),t._pe_geog_to_usng=(e,_,r,p,i,c,g)=>(t._pe_geog_to_usng=o.mc)(e,_,r,p,i,c,g),t._pe_usng_to_geog=(e,_,r,p)=>(t._pe_usng_to_geog=o.nc)(e,_,r,p),t._pe_geog_to_utm=(e,_,r,p,i)=>(t._pe_geog_to_utm=o.oc)(e,_,r,p,i),t._pe_utm_to_geog=(e,_,r,p,i)=>(t._pe_utm_to_geog=o.pc)(e,_,r,p,i),t._pe_object_to_string_ext=(e,_,r)=>(t._pe_object_to_string_ext=o.qc)(e,_,r),t._pe_proj_to_geog_center=(e,_,r,p)=>(t._pe_proj_to_geog_center=o.rc)(e,_,r,p),t.___start_em_js=2033306,t.___stop_em_js=2033404,t.getValue=Gr,t.UTF8ToString=L,Q=function e(){ae||Pr(),ae||(Q=e)},Pr(),d.prototype=Object.create(d.prototype),d.prototype.constructor=d,d.prototype.__class__=d,d.__cache__={},t.WrapperObject=d,t.getCache=_e,t.wrapPointer=T,t.castObject=$r,t.NULL=T(0),t.destroy=Jr,t.compare=Qr,t.getPointer=eo,t.getClass=to;var P={buffer:0,size:0,pos:0,temps:[],needed:0,prepare(){if(P.needed){for(var e=0;e=P.size?(de(i>0),P.needed+=i,r=t._webidl_malloc(i),P.temps.push(r)):(r=P.buffer+P.pos,P.pos+=i),r},copy(e,_,r){switch(r>>>=0,_.BYTES_PER_ELEMENT){case 2:r>>>=1;break;case 4:r>>>=2;break;case 8:r>>>=3}for(var p=0;p270||i!="auto"?(this._display.angle=s,this._flipped=!1):(this._display.angle=s+180,this._flipped=!0),this._dirty.rotation=!1):t=="adjusted"?(this.setRaw("centerX",v),this.setRaw("centerY",v),this.setRaw("x",o),this.setRaw("y",n)):t=="regular"&&(this.setRaw("x",o),this.setRaw("y",n))}this.markDirtyPosition(),this.markDirtyBounds()}}_updatePosition(){const t=this.get("textType","regular"),e=this.get("inside",!1);let i=0,s=0,r=this.get("labelAngle",0),l=this.localBounds(),a=l.right-l.left,y=l.bottom-l.top;if(t=="radial"){if(this._flipped){let o=this.get("centerX");o instanceof ae&&(a*=1-2*o.value),i=a*X(r),s=a*O(r)}}else e||t!="adjusted"||(i=a/2*X(r),s=y/2*O(r));this.setRaw("dx",i),this.setRaw("dy",s),super._updatePosition()}get text(){return this._text}}Object.defineProperty(ie,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RadialLabel"}),Object.defineProperty(ie,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Ce.classNames.concat([ie.className])});const Ae=Math.abs,_=Math.atan2,B=Math.cos,Ve=Math.max,fe=Math.min,C=Math.sin,U=Math.sqrt,x=1e-12,q=Math.PI,ne=q/2,ze=2*q;function We(d){return d>1?0:d<-1?q:Math.acos(d)}function Pe(d){return d>=1?ne:d<=-1?-ne:Math.asin(d)}function Ue(d){return d.innerRadius}function Ke(d){return d.outerRadius}function Qe(d){return d.startAngle}function qe(d){return d.endAngle}function Ge(d){return d&&d.padAngle}function Je(d,t,e,i,s,r,l,a){var y=e-d,o=i-t,n=l-s,g=a-r,h=g*y-n*o;if(!(h*hk*k+V*V&&(S=Y,I=H),{cx:S,cy:I,x01:-n,y01:-g,x11:S*(s/T-1),y11:I*(s/T-1)}}function $e(){var d=Ue,t=Ke,e=M(0),i=null,s=Qe,r=qe,l=Ge,a=null,y=Ie(o);function o(){var n,g,h=+d.apply(this,arguments),c=+t.apply(this,arguments),m=s.apply(this,arguments)-ne,f=r.apply(this,arguments)-ne,P=Ae(f-m),b=f>m;if(a||(a=n=y()),cx)if(P>ze-x)a.moveTo(c*B(m),c*C(m)),a.arc(0,0,c,m,f,!b),h>x&&(a.moveTo(h*B(f),h*C(f)),a.arc(0,0,h,f,m,b));else{var u,p,R=m,T=f,w=m,N=f,S=P,I=P,Y=l.apply(this,arguments)/2,H=Y>x&&(i?+i.apply(this,arguments):U(h*h+c*c)),L=fe(Ae(c-h)/2,+e.apply(this,arguments)),D=L,k=L;if(H>x){var V=Pe(H/h*C(Y)),le=Pe(H/c*C(Y));(S-=2*V)>x?(w+=V*=b?1:-1,N-=V):(S=0,w=N=(m+f)/2),(I-=2*le)>x?(R+=le*=b?1:-1,T-=le):(I=0,R=T=(m+f)/2)}var z=c*B(R),W=c*C(R),G=h*B(N),J=h*C(N);if(L>x){var j,$=c*B(T),Z=c*C(T),oe=h*B(w),ue=h*C(w);if(Px?k>x?(u=ee(oe,ue,z,W,c,k,b),p=ee($,Z,G,J,c,k,b),a.moveTo(u.cx+u.x01,u.cy+u.y01),kx&&S>x?D>x?(u=ee(G,J,$,Z,h,-D,b),p=ee(z,W,oe,ue,h,-D,b),a.lineTo(u.cx+u.x01,u.cy+u.y01),D=360&&l==0&&(i=0,s=0),{x:i,y:s}}_beforeChanged(){super._beforeChanged(),(this.isDirty("radius")||this.isDirty("arc")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("dRadius")||this.isDirty("dInnerRadius")||this.isDirty("cornerRadius"))&&(this._clear=!0)}_changed(){if(super._changed(),this._clear){let t=this.get("startAngle",0),e=this.get("arc",0);const i=this._generator;e<0&&(t+=e,e*=-1),e>.1&&i.cornerRadius(this.get("cornerRadius",0)),i.context(this._display);let s=this.get("radius",0),r=this.get("innerRadius",0);s+=this.get("dRadius",0),r+=this.get("dInnerRadius",0),r<0&&(r=s+r),i({innerRadius:r,outerRadius:s,startAngle:(t+90)*ve,endAngle:(t+e+90)*ve});let l=t+e/2;this.ix=X(l),this.iy=O(l)}if(this.isDirty("shiftRadius")){const t=this.get("shiftRadius",0);this.setRaw("dx",this.ix*t),this.setRaw("dy",this.iy*t),this.markDirtyPosition()}}}Object.defineProperty(se,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Slice"}),Object.defineProperty(se,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:je.classNames.concat([se.className])});class Ze extends Fe{setupDefaultRules(){super.setupDefaultRules();const t=this._root.interfaceColors,e=this.rule.bind(this);e("PercentSeries").setAll({legendLabelText:"{category}",legendValueText:"{valuePercentTotal.formatNumber('0.00p')}",colors:Ye.new(this._root,{}),width:we,height:we}),e("PieChart").setAll({radius:Xe(80),startAngle:-90,endAngle:270}),e("PieSeries").setAll({alignLabels:!0,startAngle:-90,endAngle:270}),e("PieSeries").states.create("hidden",{endAngle:-90,opacity:0}),e("Slice",["pie"]).setAll({position:"absolute",isMeasured:!1,x:0,y:0,toggleKey:"active",tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}",strokeWidth:1,strokeOpacity:1,role:"figure",lineJoin:"round"}),e("Slice",["pie"]).states.create("active",{shiftRadius:20,scale:1}),e("Slice",["pie"]).states.create("hoverActive",{scale:1.04}),e("Slice",["pie"]).states.create("hover",{scale:1.04}),e("RadialLabel",["pie"]).setAll({textType:"aligned",radius:10,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",paddingTop:5,paddingBottom:5,populateText:!0}),e("Tick",["pie"]).setAll({location:1}),e("SlicedChart").setAll({paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10}),e("FunnelSeries").setAll({startLocation:0,endLocation:1,orientation:"vertical",alignLabels:!0,sequencedInterpolation:!0}),e("FunnelSlice").setAll({interactive:!0,expandDistance:0}),e("FunnelSlice").states.create("hover",{expandDistance:.15}),e("Label",["funnel"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:v}),e("Label",["funnel","horizontal"]).setAll({centerX:0,centerY:v,rotation:-90}),e("Label",["funnel","vertical"]).setAll({centerY:v,centerX:0}),e("Tick",["funnel"]).setAll({location:1}),e("FunnelSlice",["funnel","link"]).setAll({fillOpacity:.5,strokeOpacity:0,expandDistance:-.1}),e("FunnelSlice",["funnel","link","vertical"]).setAll({height:10}),e("FunnelSlice",["funnel","link","horizontal"]).setAll({width:10}),e("PyramidSeries").setAll({valueIs:"area"}),e("FunnelSlice",["pyramid","link"]).setAll({fillOpacity:.5}),e("FunnelSlice",["pyramid","link","vertical"]).setAll({height:0}),e("FunnelSlice",["pyramid","link","horizontal"]).setAll({width:0}),e("FunnelSlice",["pyramid"]).setAll({interactive:!0,expandDistance:0}),e("FunnelSlice",["pyramid"]).states.create("hover",{expandDistance:.15}),e("Label",["pyramid"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:v}),e("Label",["pyramid","horizontal"]).setAll({centerX:0,centerY:v,rotation:-90}),e("Label",["pyramid","vertical"]).setAll({centerY:v,centerX:0}),e("Tick",["pyramid"]).setAll({location:1}),e("FunnelSlice",["pictorial"]).setAll({interactive:!0,tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}"}),e("Label",["pictorial"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:v}),e("Label",["pictorial","horizontal"]).setAll({centerX:0,centerY:v,rotation:-90}),e("Label",["pictorial","vertical"]).setAll({centerY:v,centerX:0}),e("FunnelSlice",["pictorial","link"]).setAll({fillOpacity:.5,width:0,height:0}),e("Tick",["pictorial"]).setAll({location:.5});{const i=e("Graphics",["pictorial","background"]);i.setAll({fillOpacity:.2}),He(i,"fill",t,"alternativeBackground")}}}class K extends Te{_afterNew(){this._defaultThemes.push(Ze.new(this._root)),super._afterNew(),this.chartContainer.children.push(this.seriesContainer),this.seriesContainer.children.push(this.bulletsContainer)}_processSeries(t){super._processSeries(t),this.seriesContainer.children.moveValue(this.bulletsContainer,this.seriesContainer.children.length-1)}}Object.defineProperty(K,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentChart"}),Object.defineProperty(K,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Te.classNames.concat([K.className])});class Q extends Ne{constructor(){super(...arguments),Object.defineProperty(this,"slicesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(me.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"labelsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(me.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"ticksContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(me.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"_lLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_hLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"slices",{enumerable:!0,configurable:!0,writable:!0,value:this._makeSlices()}),Object.defineProperty(this,"labels",{enumerable:!0,configurable:!0,writable:!0,value:this._makeLabels()}),Object.defineProperty(this,"ticks",{enumerable:!0,configurable:!0,writable:!0,value:this._makeTicks()})}makeSlice(t){const e=this.slicesContainer.children.push(this.slices.make());return e.on("fill",()=>{this.updateLegendMarker(t)}),e.on("stroke",()=>{this.updateLegendMarker(t)}),e._setDataItem(t),t.set("slice",e),this.slices.push(e),e}makeLabel(t){const e=this.labelsContainer.children.push(this.labels.make());return e._setDataItem(t),t.set("label",e),this.labels.push(e),e}_shouldMakeBullet(t){return t.get("value")!=null}makeTick(t){const e=this.ticksContainer.children.push(this.ticks.make());return e._setDataItem(t),t.set("tick",e),this.ticks.push(e),e}_afterNew(){this.fields.push("category","fill"),super._afterNew()}_onDataClear(){const t=this.get("colors");t&&t.reset()}_prepareChildren(){if(super._prepareChildren(),this._lLabels=[],this._rLabels=[],this._hLabels=[],this._valuesDirty){let t=0,e=0,i=0,s=1/0,r=0;A(this._dataItems,l=>{let a=l.get("valueWorking",0);t+=a,e+=Math.abs(a)}),A(this._dataItems,l=>{let a=l.get("valueWorking",0);a>i&&(i=a),asuper.show}});return E(this,void 0,void 0,function*(){let i=[];i.push(e.show.call(this,t)),i.push(this._sequencedShowHide(!0,t)),yield Promise.all(i)})}hide(t){const e=Object.create(null,{hide:{get:()=>super.hide}});return E(this,void 0,void 0,function*(){let i=[];i.push(e.hide.call(this,t)),i.push(this._sequencedShowHide(!1,t)),yield Promise.all(i)})}_updateChildren(){super._updateChildren(),this._valuesDirty&&A(this._dataItems,t=>{t.get("label").text.markDirtyText()}),(this.isDirty("legendLabelText")||this.isDirty("legendValueText"))&&A(this._dataItems,t=>{this.updateLegendValue(t)}),this._arrange()}_arrange(){this._arrangeDown(this._lLabels),this._arrangeUp(this._lLabels),this._arrangeDown(this._rLabels),this._arrangeUp(this._rLabels),this._arrangeLeft(this._hLabels),this._arrangeRight(this._hLabels),A(this.dataItems,t=>{this._updateTick(t)})}_afterChanged(){super._afterChanged(),this._arrange()}processDataItem(t){if(super.processDataItem(t),t.get("fill")==null){let e=this.get("colors");e&&t.setRaw("fill",e.next())}}showDataItem(t,e){const i=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return E(this,void 0,void 0,function*(){const s=[i.showDataItem.call(this,t,e)];re(e)||(e=this.get("stateAnimationDuration",0));const r=this.get("stateAnimationEasing");let l=t.get("value");const a=t.animate({key:"valueWorking",to:l,duration:e,easing:r});a&&s.push(a.waitForStop());const y=t.get("tick");y&&s.push(y.show(e));const o=t.get("label");o&&s.push(o.show(e));const n=t.get("slice");n&&s.push(n.show(e)),n.get("active")&&n.states.applyAnimate("active"),yield Promise.all(s)})}hideDataItem(t,e){const i=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return E(this,void 0,void 0,function*(){const s=[i.hideDataItem.call(this,t,e)],r=this.states.create("hidden",{});re(e)||(e=r.get("stateAnimationDuration",this.get("stateAnimationDuration",0)));const l=r.get("stateAnimationEasing",this.get("stateAnimationEasing")),a=t.animate({key:"valueWorking",to:0,duration:e,easing:l});a&&s.push(a.waitForStop());const y=t.get("tick");y&&s.push(y.hide(e));const o=t.get("label");o&&s.push(o.hide(e));const n=t.get("slice");n.hideTooltip(),n&&s.push(n.hide(e)),yield Promise.all(s)})}disposeDataItem(t){super.disposeDataItem(t);let e=t.get("label");e&&(this.labels.removeValue(e),e.dispose());let i=t.get("tick");i&&(this.ticks.removeValue(i),i.dispose());let s=t.get("slice");s&&(this.slices.removeValue(s),s.dispose())}hoverDataItem(t){const e=t.get("slice");e&&!e.isHidden()&&e.hover()}unhoverDataItem(t){const e=t.get("slice");e&&e.unhover()}updateLegendMarker(t){if(t){const e=t.get("slice");if(e){const i=t.get("legendDataItem");if(i){const s=i.get("markerRectangle");A(Be,r=>{e.get(r)!=null&&s.set(r,e.get(r))})}}}}_arrangeDown(t){if(t){let e=this._getNextDown();t.sort((i,s)=>i.y>s.y?1:i.y{const s=i.label.adjustedLocalBounds();let r=s.top;i.y+ri.ys.y?-1:0),A(t,i=>{const s=i.label.adjustedLocalBounds();let r=s.bottom;i.y+r>e&&(i.y=e-r),i.label.set("y",i.y),e=i.y+s.top})}}_arrangeRight(t){if(t){let e=0;t.sort((i,s)=>i.y>s.y?1:i.y{const s=i.label.adjustedLocalBounds();let r=s.left;i.y+ri.ys.y?-1:0),A(t,i=>{const s=i.label.adjustedLocalBounds();let r=s.right;i.y+r>e&&(i.y=e-r),i.label.set("x",i.y),e=i.y+s.left})}}_updateSize(){super._updateSize(),this.markDirty()}_updateTick(t){}_dispose(){super._dispose();const t=this.chart;t&&t.series.removeValue(this)}}Object.defineProperty(Q,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentSeries"}),Object.defineProperty(Q,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Ne.classNames.concat([Q.className])});class _e extends K{constructor(){super(...arguments),Object.defineProperty(this,"_maxRadius",{enumerable:!0,configurable:!0,writable:!0,value:1})}_afterNew(){super._afterNew(),this.seriesContainer.setAll({x:v,y:v})}_prepareChildren(){super._prepareChildren();const t=this.chartContainer,e=t.innerWidth(),i=t.innerHeight(),s=this.get("startAngle",0),r=this.get("endAngle",0),l=this.get("innerRadius");let a=Re(0,0,s,r,1);const y=e/(a.right-a.left),o=i/(a.bottom-a.top);let n={left:0,right:0,top:0,bottom:0};if(l instanceof ae){let c=l.value,m=Math.min(y,o);c=Math.max(m*c,m-Math.min(i,e))/m,n=Re(0,0,s,r,c),this.setPrivateRaw("irModifyer",c/l.value)}a=Me([a,n]);const g=this._maxRadius;this._maxRadius=Math.min(y,o);const h=F(this.get("radius",0),this._maxRadius);this.seriesContainer.setAll({dy:-h*(a.bottom+a.top)/2,dx:-h*(a.right+a.left)/2}),(this.isDirty("startAngle")||this.isDirty("endAngle")||g!=this._maxRadius)&&this.series.each(c=>{c._markDirtyKey("startAngle")}),(this.isDirty("innerRadius")||this.isDirty("radius"))&&this.series.each(c=>{c._markDirtyKey("innerRadius")})}radius(t){let e=F(this.get("radius",0),this._maxRadius),i=F(this.get("innerRadius",0),e);if(t){let s=this.series.indexOf(t),r=this.series.length,l=t.get("radius");return l!=null?i+F(l,e-i):i+(e-i)/r*(s+1)}return e}innerRadius(t){const e=this.radius();let i=F(this.get("innerRadius",0),e);if(i<0&&(i=e+i),t){let s=this.series.indexOf(t),r=this.series.length,l=t.get("innerRadius");return l!=null?i+F(l,e-i):i+(e-i)/r*s}return i}}Object.defineProperty(_e,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieChart"}),Object.defineProperty(_e,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:K.classNames.concat([_e.className])});class xe extends Q{_makeSlices(){return new pe(ye.new({}),()=>se._new(this._root,{themeTags:be(this.slices.template.get("themeTags",[]),["pie","series"])},[this.slices.template]))}_makeLabels(){return new pe(ye.new({}),()=>ie._new(this._root,{themeTags:be(this.labels.template.get("themeTags",[]),["pie","series"])},[this.labels.template]))}_makeTicks(){return new pe(ye.new({}),()=>Se._new(this._root,{themeTags:be(this.ticks.template.get("themeTags",[]),["pie","series"])},[this.ticks.template]))}processDataItem(t){super.processDataItem(t);const e=this.makeSlice(t);e.on("scale",()=>{this._updateTick(t)}),e.on("shiftRadius",()=>{this._updateTick(t)}),e.events.on("positionchanged",()=>{this._updateTick(t)});const i=this.makeLabel(t);i.events.on("positionchanged",()=>{this._updateTick(t)}),this.makeTick(t),e.events.on("positionchanged",()=>{i.markDirty()})}_getNextUp(){const t=this.chart;return t?t._maxRadius:this.labelsContainer.maxHeight()/2}_getNextDown(){const t=this.chart;return t?-t._maxRadius:-this.labelsContainer.maxHeight()/2}_prepareChildren(){super._prepareChildren();const t=this.chart;if(t){if(this.isDirty("alignLabels")){let e=this.labels.template;if(this.get("alignLabels"))e.set("textType","aligned");else{let i=e.get("textType");i!=null&&i!="aligned"||e.set("textType","adjusted")}}if(this._valuesDirty||this.isDirty("radius")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("endAngle")||this.isDirty("alignLabels")){this.markDirtyBounds();const e=this.get("startAngle",t.get("startAngle",-90)),i=this.get("endAngle",t.get("endAngle",270))-e;let s=e;const r=t.radius(this);this.setPrivateRaw("radius",r);let l=t.innerRadius(this)*t.getPrivate("irModifyer",1);l<0&&(l=r+l),A(this._dataItems,a=>{this.updateLegendValue(a);let y=i*a.get("valuePercentTotal")/100;const o=a.get("slice");if(o){o.set("radius",r),o.set("innerRadius",l),o.set("startAngle",s),o.set("arc",y);const h=a.get("fill");o._setDefault("fill",h),o._setDefault("stroke",h)}let n=Oe(s+y/2);const g=a.get("label");if(g&&(g.setPrivate("radius",r),g.setPrivate("innerRadius",l),g.set("labelAngle",n),g.get("textType")=="aligned")){let h=r+g.get("radius",0),c=r*O(n);n>90&&n<=270?(g.isHidden()||g.isHiding()||this._lLabels.push({label:g,y:c}),h*=-1,h-=this.labelsContainer.get("paddingLeft",0),g.set("centerX",we),g.setPrivateRaw("left",!0)):(g.isHidden()||g.isHiding()||this._rLabels.push({label:g,y:c}),h+=this.labelsContainer.get("paddingRight",0),g.set("centerX",0),g.setPrivateRaw("left",!1)),g.set("x",h),g.set("y",r*O(n))}s+=y,this._updateTick(a)})}}}_updateTick(t){const e=t.get("tick"),i=t.get("label"),s=t.get("slice"),r=e.get("location",1);if(e&&i&&s){const l=(s.get("shiftRadius",0)+s.get("radius",0))*s.get("scale",1)*r,a=i.get("labelAngle",0),y=X(a),o=O(a),n=this.labelsContainer,g=n.get("paddingLeft",0),h=n.get("paddingRight",0);let c=0,m=0;if(c=i.x(),m=i.y(),i.get("textType")=="circular"){const P=i.radius()-i.get("paddingBottom",0),b=i.get("labelAngle",0);c=P*X(b),m=P*O(b)}let f=-h;i.getPrivate("left")&&(f=g),e.set("points",[{x:s.x()+l*y,y:s.y()+l*o},{x:c+f,y:m},{x:c,y:m}])}}_positionBullet(t){const e=t.get("sprite");if(e){const i=e.dataItem.get("slice");if(i){const s=i.get("innerRadius",0),r=i.get("radius",0),l=i.get("startAngle",0)+i.get("arc",0)*t.get("locationX",.5),a=s+(r-s)*t.get("locationY",.5);e.setAll({x:X(l)*a,y:O(l)*a})}}}}Object.defineProperty(xe,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieSeries"}),Object.defineProperty(xe,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Q.classNames.concat([xe.className])});export{_e as PieChartAm5,xe as PieSeriesAm5}; +import{d1 as E}from"./index-pCX-0tJH.js";import{U as Te,D as Ne,B as Se,V as Ie,k as M}from"./Tick-bu1aEuYp.js";import{M as Le,e as Ce,W as je,X as v,N as Re,K as ae,O as Me,j as F,s as pe,B as ye,b as be,m as A,P as X,R as O,T as ve,U as Oe,Q as me,l as re,a0 as Be,Y as we,i as Fe,z as Xe}from"./Theme-5CV7oVsW.js";import{s as Ye}from"./ColorSet-tH4rJdGx.js";import{l as He}from"./DefaultTheme-uOYPzulo.js";class te extends Le{constructor(){super(...arguments),Object.defineProperty(this,"_display",{enumerable:!0,configurable:!0,writable:!0,value:this._root._renderer.makeRadialText("",this.textStyle)})}_afterNew(){super._afterNew()}_beforeChanged(){super._beforeChanged(),this._display.clear(),this.isDirty("textType")&&(this._display.textType=this.get("textType"),this.markDirtyBounds()),this.isDirty("radius")&&(this._display.radius=this.get("radius"),this.markDirtyBounds()),this.isDirty("startAngle")&&(this._display.startAngle=(this.get("startAngle",0)+90)*ve,this.markDirtyBounds()),this.isDirty("inside")&&(this._display.inside=this.get("inside"),this.markDirtyBounds()),this.isDirty("orientation")&&(this._display.orientation=this.get("orientation"),this.markDirtyBounds()),this.isDirty("kerning")&&(this._display.kerning=this.get("kerning"),this.markDirtyBounds())}}Object.defineProperty(te,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RadialText"}),Object.defineProperty(te,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Le.classNames.concat([te.className])});class ie extends Ce{constructor(){super(...arguments),Object.defineProperty(this,"_flipped",{enumerable:!0,configurable:!0,writable:!0,value:!1})}_afterNew(){this._textKeys.push("textType","kerning"),super._afterNew()}_makeText(){this._text=this.children.push(te.new(this._root,{}))}baseRadius(){const t=this.getPrivate("radius",0),e=this.getPrivate("innerRadius",0),i=this.get("baseRadius",0);return e+F(i,t-e)}radius(){const t=this.get("inside",!1);return this.baseRadius()+this.get("radius",0)*(t?-1:1)}_updateChildren(){if(super._updateChildren(),this.isDirty("baseRadius")||this.isPrivateDirty("radius")||this.isPrivateDirty("innerRadius")||this.isDirty("labelAngle")||this.isDirty("radius")||this.isDirty("inside")||this.isDirty("orientation")||this.isDirty("textType")){const t=this.get("textType","adjusted"),e=this.get("inside",!1),i=this.get("orientation");let s=Oe(this.get("labelAngle",0));this._text.set("startAngle",this.get("labelAngle",0)),this._text.set("inside",e);const r=O(s),l=X(s);let a=this.baseRadius(),y=this.radius();if(this._display.angle=0,t=="circular")this.setAll({paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}),this._text.set("orientation",i),this._text.set("radius",y);else{a==0&&(s=0,y=0);let o=y*l,n=y*r;t=="radial"?(this.setRaw("x",o),this.setRaw("y",n),s<90||s>270||i!="auto"?(this._display.angle=s,this._flipped=!1):(this._display.angle=s+180,this._flipped=!0),this._dirty.rotation=!1):t=="adjusted"?(this.setRaw("centerX",v),this.setRaw("centerY",v),this.setRaw("x",o),this.setRaw("y",n)):t=="regular"&&(this.setRaw("x",o),this.setRaw("y",n))}this.markDirtyPosition(),this.markDirtyBounds()}}_updatePosition(){const t=this.get("textType","regular"),e=this.get("inside",!1);let i=0,s=0,r=this.get("labelAngle",0),l=this.localBounds(),a=l.right-l.left,y=l.bottom-l.top;if(t=="radial"){if(this._flipped){let o=this.get("centerX");o instanceof ae&&(a*=1-2*o.value),i=a*X(r),s=a*O(r)}}else e||t!="adjusted"||(i=a/2*X(r),s=y/2*O(r));this.setRaw("dx",i),this.setRaw("dy",s),super._updatePosition()}get text(){return this._text}}Object.defineProperty(ie,"className",{enumerable:!0,configurable:!0,writable:!0,value:"RadialLabel"}),Object.defineProperty(ie,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Ce.classNames.concat([ie.className])});const Ae=Math.abs,_=Math.atan2,B=Math.cos,Ve=Math.max,fe=Math.min,C=Math.sin,U=Math.sqrt,x=1e-12,q=Math.PI,ne=q/2,ze=2*q;function We(d){return d>1?0:d<-1?q:Math.acos(d)}function Pe(d){return d>=1?ne:d<=-1?-ne:Math.asin(d)}function Ue(d){return d.innerRadius}function Ke(d){return d.outerRadius}function Qe(d){return d.startAngle}function qe(d){return d.endAngle}function Ge(d){return d&&d.padAngle}function Je(d,t,e,i,s,r,l,a){var y=e-d,o=i-t,n=l-s,g=a-r,h=g*y-n*o;if(!(h*hk*k+V*V&&(S=Y,I=H),{cx:S,cy:I,x01:-n,y01:-g,x11:S*(s/T-1),y11:I*(s/T-1)}}function $e(){var d=Ue,t=Ke,e=M(0),i=null,s=Qe,r=qe,l=Ge,a=null,y=Ie(o);function o(){var n,g,h=+d.apply(this,arguments),c=+t.apply(this,arguments),m=s.apply(this,arguments)-ne,f=r.apply(this,arguments)-ne,P=Ae(f-m),b=f>m;if(a||(a=n=y()),cx)if(P>ze-x)a.moveTo(c*B(m),c*C(m)),a.arc(0,0,c,m,f,!b),h>x&&(a.moveTo(h*B(f),h*C(f)),a.arc(0,0,h,f,m,b));else{var u,p,R=m,T=f,w=m,N=f,S=P,I=P,Y=l.apply(this,arguments)/2,H=Y>x&&(i?+i.apply(this,arguments):U(h*h+c*c)),L=fe(Ae(c-h)/2,+e.apply(this,arguments)),D=L,k=L;if(H>x){var V=Pe(H/h*C(Y)),le=Pe(H/c*C(Y));(S-=2*V)>x?(w+=V*=b?1:-1,N-=V):(S=0,w=N=(m+f)/2),(I-=2*le)>x?(R+=le*=b?1:-1,T-=le):(I=0,R=T=(m+f)/2)}var z=c*B(R),W=c*C(R),G=h*B(N),J=h*C(N);if(L>x){var j,$=c*B(T),Z=c*C(T),oe=h*B(w),ue=h*C(w);if(Px?k>x?(u=ee(oe,ue,z,W,c,k,b),p=ee($,Z,G,J,c,k,b),a.moveTo(u.cx+u.x01,u.cy+u.y01),kx&&S>x?D>x?(u=ee(G,J,$,Z,h,-D,b),p=ee(z,W,oe,ue,h,-D,b),a.lineTo(u.cx+u.x01,u.cy+u.y01),D=360&&l==0&&(i=0,s=0),{x:i,y:s}}_beforeChanged(){super._beforeChanged(),(this.isDirty("radius")||this.isDirty("arc")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("dRadius")||this.isDirty("dInnerRadius")||this.isDirty("cornerRadius"))&&(this._clear=!0)}_changed(){if(super._changed(),this._clear){let t=this.get("startAngle",0),e=this.get("arc",0);const i=this._generator;e<0&&(t+=e,e*=-1),e>.1&&i.cornerRadius(this.get("cornerRadius",0)),i.context(this._display);let s=this.get("radius",0),r=this.get("innerRadius",0);s+=this.get("dRadius",0),r+=this.get("dInnerRadius",0),r<0&&(r=s+r),i({innerRadius:r,outerRadius:s,startAngle:(t+90)*ve,endAngle:(t+e+90)*ve});let l=t+e/2;this.ix=X(l),this.iy=O(l)}if(this.isDirty("shiftRadius")){const t=this.get("shiftRadius",0);this.setRaw("dx",this.ix*t),this.setRaw("dy",this.iy*t),this.markDirtyPosition()}}}Object.defineProperty(se,"className",{enumerable:!0,configurable:!0,writable:!0,value:"Slice"}),Object.defineProperty(se,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:je.classNames.concat([se.className])});class Ze extends Fe{setupDefaultRules(){super.setupDefaultRules();const t=this._root.interfaceColors,e=this.rule.bind(this);e("PercentSeries").setAll({legendLabelText:"{category}",legendValueText:"{valuePercentTotal.formatNumber('0.00p')}",colors:Ye.new(this._root,{}),width:we,height:we}),e("PieChart").setAll({radius:Xe(80),startAngle:-90,endAngle:270}),e("PieSeries").setAll({alignLabels:!0,startAngle:-90,endAngle:270}),e("PieSeries").states.create("hidden",{endAngle:-90,opacity:0}),e("Slice",["pie"]).setAll({position:"absolute",isMeasured:!1,x:0,y:0,toggleKey:"active",tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}",strokeWidth:1,strokeOpacity:1,role:"figure",lineJoin:"round"}),e("Slice",["pie"]).states.create("active",{shiftRadius:20,scale:1}),e("Slice",["pie"]).states.create("hoverActive",{scale:1.04}),e("Slice",["pie"]).states.create("hover",{scale:1.04}),e("RadialLabel",["pie"]).setAll({textType:"aligned",radius:10,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",paddingTop:5,paddingBottom:5,populateText:!0}),e("Tick",["pie"]).setAll({location:1}),e("SlicedChart").setAll({paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10}),e("FunnelSeries").setAll({startLocation:0,endLocation:1,orientation:"vertical",alignLabels:!0,sequencedInterpolation:!0}),e("FunnelSlice").setAll({interactive:!0,expandDistance:0}),e("FunnelSlice").states.create("hover",{expandDistance:.15}),e("Label",["funnel"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:v}),e("Label",["funnel","horizontal"]).setAll({centerX:0,centerY:v,rotation:-90}),e("Label",["funnel","vertical"]).setAll({centerY:v,centerX:0}),e("Tick",["funnel"]).setAll({location:1}),e("FunnelSlice",["funnel","link"]).setAll({fillOpacity:.5,strokeOpacity:0,expandDistance:-.1}),e("FunnelSlice",["funnel","link","vertical"]).setAll({height:10}),e("FunnelSlice",["funnel","link","horizontal"]).setAll({width:10}),e("PyramidSeries").setAll({valueIs:"area"}),e("FunnelSlice",["pyramid","link"]).setAll({fillOpacity:.5}),e("FunnelSlice",["pyramid","link","vertical"]).setAll({height:0}),e("FunnelSlice",["pyramid","link","horizontal"]).setAll({width:0}),e("FunnelSlice",["pyramid"]).setAll({interactive:!0,expandDistance:0}),e("FunnelSlice",["pyramid"]).states.create("hover",{expandDistance:.15}),e("Label",["pyramid"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:v}),e("Label",["pyramid","horizontal"]).setAll({centerX:0,centerY:v,rotation:-90}),e("Label",["pyramid","vertical"]).setAll({centerY:v,centerX:0}),e("Tick",["pyramid"]).setAll({location:1}),e("FunnelSlice",["pictorial"]).setAll({interactive:!0,tooltipText:"{category}: {valuePercentTotal.formatNumber('0.00p')}"}),e("Label",["pictorial"]).setAll({populateText:!0,text:"{category}: {valuePercentTotal.formatNumber('0.00p')}",centerY:v}),e("Label",["pictorial","horizontal"]).setAll({centerX:0,centerY:v,rotation:-90}),e("Label",["pictorial","vertical"]).setAll({centerY:v,centerX:0}),e("FunnelSlice",["pictorial","link"]).setAll({fillOpacity:.5,width:0,height:0}),e("Tick",["pictorial"]).setAll({location:.5});{const i=e("Graphics",["pictorial","background"]);i.setAll({fillOpacity:.2}),He(i,"fill",t,"alternativeBackground")}}}class K extends Te{_afterNew(){this._defaultThemes.push(Ze.new(this._root)),super._afterNew(),this.chartContainer.children.push(this.seriesContainer),this.seriesContainer.children.push(this.bulletsContainer)}_processSeries(t){super._processSeries(t),this.seriesContainer.children.moveValue(this.bulletsContainer,this.seriesContainer.children.length-1)}}Object.defineProperty(K,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentChart"}),Object.defineProperty(K,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Te.classNames.concat([K.className])});class Q extends Ne{constructor(){super(...arguments),Object.defineProperty(this,"slicesContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(me.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"labelsContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(me.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"ticksContainer",{enumerable:!0,configurable:!0,writable:!0,value:this.children.push(me.new(this._root,{position:"absolute",isMeasured:!1}))}),Object.defineProperty(this,"_lLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_hLabels",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"slices",{enumerable:!0,configurable:!0,writable:!0,value:this._makeSlices()}),Object.defineProperty(this,"labels",{enumerable:!0,configurable:!0,writable:!0,value:this._makeLabels()}),Object.defineProperty(this,"ticks",{enumerable:!0,configurable:!0,writable:!0,value:this._makeTicks()})}makeSlice(t){const e=this.slicesContainer.children.push(this.slices.make());return e.on("fill",()=>{this.updateLegendMarker(t)}),e.on("stroke",()=>{this.updateLegendMarker(t)}),e._setDataItem(t),t.set("slice",e),this.slices.push(e),e}makeLabel(t){const e=this.labelsContainer.children.push(this.labels.make());return e._setDataItem(t),t.set("label",e),this.labels.push(e),e}_shouldMakeBullet(t){return t.get("value")!=null}makeTick(t){const e=this.ticksContainer.children.push(this.ticks.make());return e._setDataItem(t),t.set("tick",e),this.ticks.push(e),e}_afterNew(){this.fields.push("category","fill"),super._afterNew()}_onDataClear(){const t=this.get("colors");t&&t.reset()}_prepareChildren(){if(super._prepareChildren(),this._lLabels=[],this._rLabels=[],this._hLabels=[],this._valuesDirty){let t=0,e=0,i=0,s=1/0,r=0;A(this._dataItems,l=>{let a=l.get("valueWorking",0);t+=a,e+=Math.abs(a)}),A(this._dataItems,l=>{let a=l.get("valueWorking",0);a>i&&(i=a),asuper.show}});return E(this,void 0,void 0,function*(){let i=[];i.push(e.show.call(this,t)),i.push(this._sequencedShowHide(!0,t)),yield Promise.all(i)})}hide(t){const e=Object.create(null,{hide:{get:()=>super.hide}});return E(this,void 0,void 0,function*(){let i=[];i.push(e.hide.call(this,t)),i.push(this._sequencedShowHide(!1,t)),yield Promise.all(i)})}_updateChildren(){super._updateChildren(),this._valuesDirty&&A(this._dataItems,t=>{t.get("label").text.markDirtyText()}),(this.isDirty("legendLabelText")||this.isDirty("legendValueText"))&&A(this._dataItems,t=>{this.updateLegendValue(t)}),this._arrange()}_arrange(){this._arrangeDown(this._lLabels),this._arrangeUp(this._lLabels),this._arrangeDown(this._rLabels),this._arrangeUp(this._rLabels),this._arrangeLeft(this._hLabels),this._arrangeRight(this._hLabels),A(this.dataItems,t=>{this._updateTick(t)})}_afterChanged(){super._afterChanged(),this._arrange()}processDataItem(t){if(super.processDataItem(t),t.get("fill")==null){let e=this.get("colors");e&&t.setRaw("fill",e.next())}}showDataItem(t,e){const i=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return E(this,void 0,void 0,function*(){const s=[i.showDataItem.call(this,t,e)];re(e)||(e=this.get("stateAnimationDuration",0));const r=this.get("stateAnimationEasing");let l=t.get("value");const a=t.animate({key:"valueWorking",to:l,duration:e,easing:r});a&&s.push(a.waitForStop());const y=t.get("tick");y&&s.push(y.show(e));const o=t.get("label");o&&s.push(o.show(e));const n=t.get("slice");n&&s.push(n.show(e)),n.get("active")&&n.states.applyAnimate("active"),yield Promise.all(s)})}hideDataItem(t,e){const i=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return E(this,void 0,void 0,function*(){const s=[i.hideDataItem.call(this,t,e)],r=this.states.create("hidden",{});re(e)||(e=r.get("stateAnimationDuration",this.get("stateAnimationDuration",0)));const l=r.get("stateAnimationEasing",this.get("stateAnimationEasing")),a=t.animate({key:"valueWorking",to:0,duration:e,easing:l});a&&s.push(a.waitForStop());const y=t.get("tick");y&&s.push(y.hide(e));const o=t.get("label");o&&s.push(o.hide(e));const n=t.get("slice");n.hideTooltip(),n&&s.push(n.hide(e)),yield Promise.all(s)})}disposeDataItem(t){super.disposeDataItem(t);let e=t.get("label");e&&(this.labels.removeValue(e),e.dispose());let i=t.get("tick");i&&(this.ticks.removeValue(i),i.dispose());let s=t.get("slice");s&&(this.slices.removeValue(s),s.dispose())}hoverDataItem(t){const e=t.get("slice");e&&!e.isHidden()&&e.hover()}unhoverDataItem(t){const e=t.get("slice");e&&e.unhover()}updateLegendMarker(t){if(t){const e=t.get("slice");if(e){const i=t.get("legendDataItem");if(i){const s=i.get("markerRectangle");A(Be,r=>{e.get(r)!=null&&s.set(r,e.get(r))})}}}}_arrangeDown(t){if(t){let e=this._getNextDown();t.sort((i,s)=>i.y>s.y?1:i.y{const s=i.label.adjustedLocalBounds();let r=s.top;i.y+ri.ys.y?-1:0),A(t,i=>{const s=i.label.adjustedLocalBounds();let r=s.bottom;i.y+r>e&&(i.y=e-r),i.label.set("y",i.y),e=i.y+s.top})}}_arrangeRight(t){if(t){let e=0;t.sort((i,s)=>i.y>s.y?1:i.y{const s=i.label.adjustedLocalBounds();let r=s.left;i.y+ri.ys.y?-1:0),A(t,i=>{const s=i.label.adjustedLocalBounds();let r=s.right;i.y+r>e&&(i.y=e-r),i.label.set("x",i.y),e=i.y+s.left})}}_updateSize(){super._updateSize(),this.markDirty()}_updateTick(t){}_dispose(){super._dispose();const t=this.chart;t&&t.series.removeValue(this)}}Object.defineProperty(Q,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PercentSeries"}),Object.defineProperty(Q,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Ne.classNames.concat([Q.className])});class _e extends K{constructor(){super(...arguments),Object.defineProperty(this,"_maxRadius",{enumerable:!0,configurable:!0,writable:!0,value:1})}_afterNew(){super._afterNew(),this.seriesContainer.setAll({x:v,y:v})}_prepareChildren(){super._prepareChildren();const t=this.chartContainer,e=t.innerWidth(),i=t.innerHeight(),s=this.get("startAngle",0),r=this.get("endAngle",0),l=this.get("innerRadius");let a=Re(0,0,s,r,1);const y=e/(a.right-a.left),o=i/(a.bottom-a.top);let n={left:0,right:0,top:0,bottom:0};if(l instanceof ae){let c=l.value,m=Math.min(y,o);c=Math.max(m*c,m-Math.min(i,e))/m,n=Re(0,0,s,r,c),this.setPrivateRaw("irModifyer",c/l.value)}a=Me([a,n]);const g=this._maxRadius;this._maxRadius=Math.min(y,o);const h=F(this.get("radius",0),this._maxRadius);this.seriesContainer.setAll({dy:-h*(a.bottom+a.top)/2,dx:-h*(a.right+a.left)/2}),(this.isDirty("startAngle")||this.isDirty("endAngle")||g!=this._maxRadius)&&this.series.each(c=>{c._markDirtyKey("startAngle")}),(this.isDirty("innerRadius")||this.isDirty("radius"))&&this.series.each(c=>{c._markDirtyKey("innerRadius")})}radius(t){let e=F(this.get("radius",0),this._maxRadius),i=F(this.get("innerRadius",0),e);if(t){let s=this.series.indexOf(t),r=this.series.length,l=t.get("radius");return l!=null?i+F(l,e-i):i+(e-i)/r*(s+1)}return e}innerRadius(t){const e=this.radius();let i=F(this.get("innerRadius",0),e);if(i<0&&(i=e+i),t){let s=this.series.indexOf(t),r=this.series.length,l=t.get("innerRadius");return l!=null?i+F(l,e-i):i+(e-i)/r*s}return i}}Object.defineProperty(_e,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieChart"}),Object.defineProperty(_e,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:K.classNames.concat([_e.className])});class xe extends Q{_makeSlices(){return new pe(ye.new({}),()=>se._new(this._root,{themeTags:be(this.slices.template.get("themeTags",[]),["pie","series"])},[this.slices.template]))}_makeLabels(){return new pe(ye.new({}),()=>ie._new(this._root,{themeTags:be(this.labels.template.get("themeTags",[]),["pie","series"])},[this.labels.template]))}_makeTicks(){return new pe(ye.new({}),()=>Se._new(this._root,{themeTags:be(this.ticks.template.get("themeTags",[]),["pie","series"])},[this.ticks.template]))}processDataItem(t){super.processDataItem(t);const e=this.makeSlice(t);e.on("scale",()=>{this._updateTick(t)}),e.on("shiftRadius",()=>{this._updateTick(t)}),e.events.on("positionchanged",()=>{this._updateTick(t)});const i=this.makeLabel(t);i.events.on("positionchanged",()=>{this._updateTick(t)}),this.makeTick(t),e.events.on("positionchanged",()=>{i.markDirty()})}_getNextUp(){const t=this.chart;return t?t._maxRadius:this.labelsContainer.maxHeight()/2}_getNextDown(){const t=this.chart;return t?-t._maxRadius:-this.labelsContainer.maxHeight()/2}_prepareChildren(){super._prepareChildren();const t=this.chart;if(t){if(this.isDirty("alignLabels")){let e=this.labels.template;if(this.get("alignLabels"))e.set("textType","aligned");else{let i=e.get("textType");i!=null&&i!="aligned"||e.set("textType","adjusted")}}if(this._valuesDirty||this.isDirty("radius")||this.isDirty("innerRadius")||this.isDirty("startAngle")||this.isDirty("endAngle")||this.isDirty("alignLabels")){this.markDirtyBounds();const e=this.get("startAngle",t.get("startAngle",-90)),i=this.get("endAngle",t.get("endAngle",270))-e;let s=e;const r=t.radius(this);this.setPrivateRaw("radius",r);let l=t.innerRadius(this)*t.getPrivate("irModifyer",1);l<0&&(l=r+l),A(this._dataItems,a=>{this.updateLegendValue(a);let y=i*a.get("valuePercentTotal")/100;const o=a.get("slice");if(o){o.set("radius",r),o.set("innerRadius",l),o.set("startAngle",s),o.set("arc",y);const h=a.get("fill");o._setDefault("fill",h),o._setDefault("stroke",h)}let n=Oe(s+y/2);const g=a.get("label");if(g&&(g.setPrivate("radius",r),g.setPrivate("innerRadius",l),g.set("labelAngle",n),g.get("textType")=="aligned")){let h=r+g.get("radius",0),c=r*O(n);n>90&&n<=270?(g.isHidden()||g.isHiding()||this._lLabels.push({label:g,y:c}),h*=-1,h-=this.labelsContainer.get("paddingLeft",0),g.set("centerX",we),g.setPrivateRaw("left",!0)):(g.isHidden()||g.isHiding()||this._rLabels.push({label:g,y:c}),h+=this.labelsContainer.get("paddingRight",0),g.set("centerX",0),g.setPrivateRaw("left",!1)),g.set("x",h),g.set("y",r*O(n))}s+=y,this._updateTick(a)})}}}_updateTick(t){const e=t.get("tick"),i=t.get("label"),s=t.get("slice"),r=e.get("location",1);if(e&&i&&s){const l=(s.get("shiftRadius",0)+s.get("radius",0))*s.get("scale",1)*r,a=i.get("labelAngle",0),y=X(a),o=O(a),n=this.labelsContainer,g=n.get("paddingLeft",0),h=n.get("paddingRight",0);let c=0,m=0;if(c=i.x(),m=i.y(),i.get("textType")=="circular"){const P=i.radius()-i.get("paddingBottom",0),b=i.get("labelAngle",0);c=P*X(b),m=P*O(b)}let f=-h;i.getPrivate("left")&&(f=g),e.set("points",[{x:s.x()+l*y,y:s.y()+l*o},{x:c+f,y:m},{x:c,y:m}])}}_positionBullet(t){const e=t.get("sprite");if(e){const i=e.dataItem.get("slice");if(i){const s=i.get("innerRadius",0),r=i.get("radius",0),l=i.get("startAngle",0)+i.get("arc",0)*t.get("locationX",.5),a=s+(r-s)*t.get("locationY",.5);e.setAll({x:X(l)*a,y:O(l)*a})}}}}Object.defineProperty(xe,"className",{enumerable:!0,configurable:!0,writable:!0,value:"PieSeries"}),Object.defineProperty(xe,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:Q.classNames.concat([xe.className])});export{_e as PieChartAm5,xe as PieSeriesAm5}; diff --git a/dist/assets/popover-Jm1QI0N1.js b/dist/assets/popover-QEcoULsC.js similarity index 92% rename from dist/assets/popover-Jm1QI0N1.js rename to dist/assets/popover-QEcoULsC.js index 87d863d..8c77958 100644 --- a/dist/assets/popover-Jm1QI0N1.js +++ b/dist/assets/popover-QEcoULsC.js @@ -1,11 +1,11 @@ -import{ac as ve,lO as pe,lP as U,lQ as he,lR as be,lS as T,lT as L,t as y,q as me,H as ge,r as z,v as Z,cn as ye,ks as Ee,z as we,x as Pe,B as ke}from"./index-J0iiHjMT.js";import{f as Fe,c as Te,d as De,a as Ne,r as Ce,F as _}from"./floating-ui-McpI0u1Z.js";import{g as xe}from"./guid-6vN-YNJI.js";import{o as ee}from"./openCloseComponent-yw47Oy2q.js";import{c as Re,d as Oe}from"./locale-pfkq1d6A.js";import{u as Le,c as Ae,s as Be,d as He}from"./t9n-od6MEnI1.js";import{i as ze}from"./key-qdHumIlA.js";import{s as Se,a as Ke,c as Ie}from"./loadable-sxY2K1G3.js";import{c as je}from"./observers-JyBmMU24.js";import{F as Ue}from"./FloatingArrow-BghsONry.js";import{g as Me}from"./component-dtiBfYiX.js";import{d as $e}from"./action-W5zDPNjG.js";import{d as Ge}from"./icon-ZwpY5ksA.js";import{d as qe}from"./loader-QqciGs1c.js";/*! +import{X as ve,lW as pe,lX as U,lY as he,lZ as be,l_ as T,l$ as L,k as y,p as me,H as ge,d as z,t as Q,aY as ye,kA as Ee,q as we,l as Pe,m as ke}from"./index-pCX-0tJH.js";import{f as Fe,c as Te,d as De,a as Ne,r as Ce,F as _}from"./floating-ui-C10Xvlxv.js";import{g as xe}from"./guid-6vN-YNJI.js";import{o as ee}from"./openCloseComponent-lU2sdEaR.js";import{c as Re,d as Oe}from"./locale-tKMV0J87.js";import{u as Le,c as Ae,s as Be,d as He}from"./t9n-KLe7iM0R.js";import{i as ze}from"./key-qdHumIlA.js";import{s as Se,a as Ke,c as Ie}from"./loadable-uNbe2Ndt.js";import{c as je}from"./observers-eNe735aq.js";import{F as Ue}from"./FloatingArrow-FUeqM5kw.js";import{g as Me}from"./component-dtiBfYiX.js";import{d as $e}from"./action-bN6v5--b.js";import{d as Ge}from"./icon-BW6RCrUr.js";import{d as qe}from"./loader-plQ4Tft5.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 *//*! * focus-trap 7.5.4 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE -*/function te(i,e){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(i);e&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable})),r.push.apply(r,o)}return r}function ie(i){for(var e=1;e0){var o=e[e.length-1];o!==r&&o.pause()}var l=e.indexOf(r);l===-1||e.splice(l,1),e.push(r)},deactivateTrap:function(e,r){var o=e.indexOf(r);o!==-1&&e.splice(o,1),e.length>0&&e[e.length-1].unpause()}},Ve=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},We=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},B=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},Je=function(e){return B(e)&&!e.shiftKey},Ze=function(e){return B(e)&&e.shiftKey},ae=function(e){return setTimeout(e,0)},re=function(e,r){var o=-1;return e.every(function(l,c){return r(l)?(o=c,!1):!0}),o},A=function(e){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l1?s-1:0),u=1;u=0)n=o.activeElement;else{var t=a.tabbableGroups[0],s=t&&t.firstTabbableNode;n=s||D("fallbackFocus")}if(!n)throw new Error("Your focus-trap needs to have at least one focusable element");return n},C=function(){if(a.containerGroups=a.containers.map(function(n){var t=he(n,c.tabbableOptions),s=be(n,c.tabbableOptions),d=t.length>0?t[0]:void 0,u=t.length>0?t[t.length-1]:void 0,v=s.find(function(h){return T(h)}),p=s.slice().reverse().find(function(h){return T(h)}),m=!!t.find(function(h){return L(h)>0});return{container:n,tabbableNodes:t,focusableNodes:s,posTabIndexesFound:m,firstTabbableNode:d,lastTabbableNode:u,firstDomTabbableNode:v,lastDomTabbableNode:p,nextTabbableNode:function(F){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,P=t.indexOf(F);return P<0?R?s.slice(s.indexOf(F)+1).find(function(O){return T(O)}):s.slice(0,s.indexOf(F)).reverse().find(function(O){return T(O)}):t[P+(R?1:-1)]}}}),a.tabbableGroups=a.containerGroups.filter(function(n){return n.tabbableNodes.length>0}),a.tabbableGroups.length<=0&&!D("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(a.containerGroups.find(function(n){return n.posTabIndexesFound})&&a.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},de=function f(n){var t=n.activeElement;if(t)return t.shadowRoot&&t.shadowRoot.activeElement!==null?f(t.shadowRoot):t},k=function f(n){if(n!==!1&&n!==de(document)){if(!n||!n.focus){f(N());return}n.focus({preventScroll:!!c.preventScroll}),a.mostRecentlyFocusedNode=n,Ve(n)&&n.select()}},G=function(n){var t=D("setReturnFocus",n);return t||(t===!1?!1:n)},q=function(n){var t=n.target,s=n.event,d=n.isBackward,u=d===void 0?!1:d;t=t||S(s),C();var v=null;if(a.tabbableGroups.length>0){var p=w(t,s),m=p>=0?a.containerGroups[p]:void 0;if(p<0)u?v=a.tabbableGroups[a.tabbableGroups.length-1].lastTabbableNode:v=a.tabbableGroups[0].firstTabbableNode;else if(u){var h=re(a.tabbableGroups,function(I){var j=I.firstTabbableNode;return t===j});if(h<0&&(m.container===t||U(t,c.tabbableOptions)&&!T(t,c.tabbableOptions)&&!m.nextTabbableNode(t,!1))&&(h=p),h>=0){var F=h===0?a.tabbableGroups.length-1:h-1,R=a.tabbableGroups[F];v=L(t)>=0?R.lastTabbableNode:R.lastDomTabbableNode}else B(s)||(v=m.nextTabbableNode(t,!1))}else{var P=re(a.tabbableGroups,function(I){var j=I.lastTabbableNode;return t===j});if(P<0&&(m.container===t||U(t,c.tabbableOptions)&&!T(t,c.tabbableOptions)&&!m.nextTabbableNode(t))&&(P=p),P>=0){var O=P===a.tabbableGroups.length-1?0:P+1,J=a.tabbableGroups[O];v=L(t)>=0?J.firstTabbableNode:J.firstDomTabbableNode}else B(s)||(v=m.nextTabbableNode(t))}}else v=D("fallbackFocus");return v},H=function(n){var t=S(n);if(!(w(t,n)>=0)){if(A(c.clickOutsideDeactivates,n)){g.deactivate({returnFocus:c.returnFocusOnDeactivate});return}A(c.allowOutsideClick,n)||n.preventDefault()}},Y=function(n){var t=S(n),s=w(t,n)>=0;if(s||t instanceof Document)s&&(a.mostRecentlyFocusedNode=t);else{n.stopImmediatePropagation();var d,u=!0;if(a.mostRecentlyFocusedNode)if(L(a.mostRecentlyFocusedNode)>0){var v=w(a.mostRecentlyFocusedNode),p=a.containerGroups[v].tabbableNodes;if(p.length>0){var m=p.findIndex(function(h){return h===a.mostRecentlyFocusedNode});m>=0&&(c.isKeyForward(a.recentNavEvent)?m+1=0&&(d=p[m-1],u=!1))}}else a.containerGroups.some(function(h){return h.tabbableNodes.some(function(F){return L(F)>0})})||(u=!1);else u=!1;u&&(d=q({target:a.mostRecentlyFocusedNode,isBackward:c.isKeyBackward(a.recentNavEvent)})),k(d||a.mostRecentlyFocusedNode||N())}a.recentNavEvent=void 0},ue=function(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;a.recentNavEvent=n;var s=q({event:n,isBackward:t});s&&(B(n)&&n.preventDefault(),k(s))},X=function(n){if(We(n)&&A(c.escapeDeactivates,n)!==!1){n.preventDefault(),g.deactivate();return}(c.isKeyForward(n)||c.isKeyBackward(n))&&ue(n,c.isKeyBackward(n))},Q=function(n){var t=S(n);w(t,n)>=0||A(c.clickOutsideDeactivates,n)||A(c.allowOutsideClick,n)||(n.preventDefault(),n.stopImmediatePropagation())},V=function(){if(a.active)return ne.activateTrap(l,g),a.delayInitialFocusTimer=c.delayInitialFocus?ae(function(){k(N())}):k(N()),o.addEventListener("focusin",Y,!0),o.addEventListener("mousedown",H,{capture:!0,passive:!1}),o.addEventListener("touchstart",H,{capture:!0,passive:!1}),o.addEventListener("click",Q,{capture:!0,passive:!1}),o.addEventListener("keydown",X,{capture:!0,passive:!1}),g},W=function(){if(a.active)return o.removeEventListener("focusin",Y,!0),o.removeEventListener("mousedown",H,!0),o.removeEventListener("touchstart",H,!0),o.removeEventListener("click",Q,!0),o.removeEventListener("keydown",X,!0),g},fe=function(n){var t=n.some(function(s){var d=Array.from(s.removedNodes);return d.some(function(u){return u===a.mostRecentlyFocusedNode})});t&&k(N())},K=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(fe):void 0,x=function(){K&&(K.disconnect(),a.active&&!a.paused&&a.containers.map(function(n){K.observe(n,{subtree:!0,childList:!0})}))};return g={get active(){return a.active},get paused(){return a.paused},activate:function(n){if(a.active)return this;var t=b(n,"onActivate"),s=b(n,"onPostActivate"),d=b(n,"checkCanFocusTrap");d||C(),a.active=!0,a.paused=!1,a.nodeFocusedBeforeActivation=o.activeElement,t==null||t();var u=function(){d&&C(),V(),x(),s==null||s()};return d?(d(a.containers.concat()).then(u,u),this):(u(),this)},deactivate:function(n){if(!a.active)return this;var t=ie({onDeactivate:c.onDeactivate,onPostDeactivate:c.onPostDeactivate,checkCanReturnFocus:c.checkCanReturnFocus},n);clearTimeout(a.delayInitialFocusTimer),a.delayInitialFocusTimer=void 0,W(),a.active=!1,a.paused=!1,x(),ne.deactivateTrap(l,g);var s=b(t,"onDeactivate"),d=b(t,"onPostDeactivate"),u=b(t,"checkCanReturnFocus"),v=b(t,"returnFocus","returnFocusOnDeactivate");s==null||s();var p=function(){ae(function(){v&&k(G(a.nodeFocusedBeforeActivation)),d==null||d()})};return v&&u?(u(G(a.nodeFocusedBeforeActivation)).then(p,p),this):(p(),this)},pause:function(n){if(a.paused||!a.active)return this;var t=b(n,"onPause"),s=b(n,"onPostPause");return a.paused=!0,t==null||t(),W(),x(),s==null||s(),this},unpause:function(n){if(!a.paused||!a.active)return this;var t=b(n,"onUnpause"),s=b(n,"onPostUnpause");return a.paused=!1,t==null||t(),C(),V(),x(),s==null||s(),this},updateContainerElements:function(n){var t=[].concat(n).filter(Boolean);return a.containers=t.map(function(s){return typeof s=="string"?o.querySelector(s):s}),a.active&&C(),x(),this}},g.updateContainerElements(e),g};const M=globalThis.calciteConfig,tt=(M==null?void 0:M.focusTrapStack)||[];function it(i,e){const{el:r}=i,o=(e==null?void 0:e.focusTrapEl)||r;if(!o)return;const l={clickOutsideDeactivates:!0,escapeDeactivates:!1,fallbackFocus:o,setReturnFocus:c=>(ve(c),!1),...e==null?void 0:e.focusTrapOptions,document:r.ownerDocument,tabbableOptions:pe,trapStack:tt};i.focusTrap=et(o,l)}function oe(i,e){var r;i.focusTrapDisabled||(r=i.focusTrap)==null||r.activate(e)}function $(i,e){var r;(r=i.focusTrap)==null||r.deactivate(e)}function nt(i){var e;(e=i.focusTrap)==null||e.updateContainerElements(i.el)}/*! +*/function te(i,e){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(i);e&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(i,l).enumerable})),r.push.apply(r,o)}return r}function ie(i){for(var e=1;e0){var o=e[e.length-1];o!==r&&o.pause()}var l=e.indexOf(r);l===-1||e.splice(l,1),e.push(r)},deactivateTrap:function(e,r){var o=e.indexOf(r);o!==-1&&e.splice(o,1),e.length>0&&e[e.length-1].unpause()}},Ve=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Ze=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},B=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},Je=function(e){return B(e)&&!e.shiftKey},Qe=function(e){return B(e)&&e.shiftKey},ae=function(e){return setTimeout(e,0)},re=function(e,r){var o=-1;return e.every(function(l,c){return r(l)?(o=c,!1):!0}),o},A=function(e){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l1?s-1:0),u=1;u=0)n=o.activeElement;else{var t=a.tabbableGroups[0],s=t&&t.firstTabbableNode;n=s||D("fallbackFocus")}if(!n)throw new Error("Your focus-trap needs to have at least one focusable element");return n},C=function(){if(a.containerGroups=a.containers.map(function(n){var t=he(n,c.tabbableOptions),s=be(n,c.tabbableOptions),d=t.length>0?t[0]:void 0,u=t.length>0?t[t.length-1]:void 0,v=s.find(function(h){return T(h)}),p=s.slice().reverse().find(function(h){return T(h)}),m=!!t.find(function(h){return L(h)>0});return{container:n,tabbableNodes:t,focusableNodes:s,posTabIndexesFound:m,firstTabbableNode:d,lastTabbableNode:u,firstDomTabbableNode:v,lastDomTabbableNode:p,nextTabbableNode:function(F){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,P=t.indexOf(F);return P<0?R?s.slice(s.indexOf(F)+1).find(function(O){return T(O)}):s.slice(0,s.indexOf(F)).reverse().find(function(O){return T(O)}):t[P+(R?1:-1)]}}}),a.tabbableGroups=a.containerGroups.filter(function(n){return n.tabbableNodes.length>0}),a.tabbableGroups.length<=0&&!D("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(a.containerGroups.find(function(n){return n.posTabIndexesFound})&&a.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},de=function f(n){var t=n.activeElement;if(t)return t.shadowRoot&&t.shadowRoot.activeElement!==null?f(t.shadowRoot):t},k=function f(n){if(n!==!1&&n!==de(document)){if(!n||!n.focus){f(N());return}n.focus({preventScroll:!!c.preventScroll}),a.mostRecentlyFocusedNode=n,Ve(n)&&n.select()}},G=function(n){var t=D("setReturnFocus",n);return t||(t===!1?!1:n)},q=function(n){var t=n.target,s=n.event,d=n.isBackward,u=d===void 0?!1:d;t=t||S(s),C();var v=null;if(a.tabbableGroups.length>0){var p=w(t,s),m=p>=0?a.containerGroups[p]:void 0;if(p<0)u?v=a.tabbableGroups[a.tabbableGroups.length-1].lastTabbableNode:v=a.tabbableGroups[0].firstTabbableNode;else if(u){var h=re(a.tabbableGroups,function(I){var j=I.firstTabbableNode;return t===j});if(h<0&&(m.container===t||U(t,c.tabbableOptions)&&!T(t,c.tabbableOptions)&&!m.nextTabbableNode(t,!1))&&(h=p),h>=0){var F=h===0?a.tabbableGroups.length-1:h-1,R=a.tabbableGroups[F];v=L(t)>=0?R.lastTabbableNode:R.lastDomTabbableNode}else B(s)||(v=m.nextTabbableNode(t,!1))}else{var P=re(a.tabbableGroups,function(I){var j=I.lastTabbableNode;return t===j});if(P<0&&(m.container===t||U(t,c.tabbableOptions)&&!T(t,c.tabbableOptions)&&!m.nextTabbableNode(t))&&(P=p),P>=0){var O=P===a.tabbableGroups.length-1?0:P+1,J=a.tabbableGroups[O];v=L(t)>=0?J.firstTabbableNode:J.firstDomTabbableNode}else B(s)||(v=m.nextTabbableNode(t))}}else v=D("fallbackFocus");return v},H=function(n){var t=S(n);if(!(w(t,n)>=0)){if(A(c.clickOutsideDeactivates,n)){g.deactivate({returnFocus:c.returnFocusOnDeactivate});return}A(c.allowOutsideClick,n)||n.preventDefault()}},Y=function(n){var t=S(n),s=w(t,n)>=0;if(s||t instanceof Document)s&&(a.mostRecentlyFocusedNode=t);else{n.stopImmediatePropagation();var d,u=!0;if(a.mostRecentlyFocusedNode)if(L(a.mostRecentlyFocusedNode)>0){var v=w(a.mostRecentlyFocusedNode),p=a.containerGroups[v].tabbableNodes;if(p.length>0){var m=p.findIndex(function(h){return h===a.mostRecentlyFocusedNode});m>=0&&(c.isKeyForward(a.recentNavEvent)?m+1=0&&(d=p[m-1],u=!1))}}else a.containerGroups.some(function(h){return h.tabbableNodes.some(function(F){return L(F)>0})})||(u=!1);else u=!1;u&&(d=q({target:a.mostRecentlyFocusedNode,isBackward:c.isKeyBackward(a.recentNavEvent)})),k(d||a.mostRecentlyFocusedNode||N())}a.recentNavEvent=void 0},ue=function(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;a.recentNavEvent=n;var s=q({event:n,isBackward:t});s&&(B(n)&&n.preventDefault(),k(s))},X=function(n){if(Ze(n)&&A(c.escapeDeactivates,n)!==!1){n.preventDefault(),g.deactivate();return}(c.isKeyForward(n)||c.isKeyBackward(n))&&ue(n,c.isKeyBackward(n))},W=function(n){var t=S(n);w(t,n)>=0||A(c.clickOutsideDeactivates,n)||A(c.allowOutsideClick,n)||(n.preventDefault(),n.stopImmediatePropagation())},V=function(){if(a.active)return ne.activateTrap(l,g),a.delayInitialFocusTimer=c.delayInitialFocus?ae(function(){k(N())}):k(N()),o.addEventListener("focusin",Y,!0),o.addEventListener("mousedown",H,{capture:!0,passive:!1}),o.addEventListener("touchstart",H,{capture:!0,passive:!1}),o.addEventListener("click",W,{capture:!0,passive:!1}),o.addEventListener("keydown",X,{capture:!0,passive:!1}),g},Z=function(){if(a.active)return o.removeEventListener("focusin",Y,!0),o.removeEventListener("mousedown",H,!0),o.removeEventListener("touchstart",H,!0),o.removeEventListener("click",W,!0),o.removeEventListener("keydown",X,!0),g},fe=function(n){var t=n.some(function(s){var d=Array.from(s.removedNodes);return d.some(function(u){return u===a.mostRecentlyFocusedNode})});t&&k(N())},K=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(fe):void 0,x=function(){K&&(K.disconnect(),a.active&&!a.paused&&a.containers.map(function(n){K.observe(n,{subtree:!0,childList:!0})}))};return g={get active(){return a.active},get paused(){return a.paused},activate:function(n){if(a.active)return this;var t=b(n,"onActivate"),s=b(n,"onPostActivate"),d=b(n,"checkCanFocusTrap");d||C(),a.active=!0,a.paused=!1,a.nodeFocusedBeforeActivation=o.activeElement,t==null||t();var u=function(){d&&C(),V(),x(),s==null||s()};return d?(d(a.containers.concat()).then(u,u),this):(u(),this)},deactivate:function(n){if(!a.active)return this;var t=ie({onDeactivate:c.onDeactivate,onPostDeactivate:c.onPostDeactivate,checkCanReturnFocus:c.checkCanReturnFocus},n);clearTimeout(a.delayInitialFocusTimer),a.delayInitialFocusTimer=void 0,Z(),a.active=!1,a.paused=!1,x(),ne.deactivateTrap(l,g);var s=b(t,"onDeactivate"),d=b(t,"onPostDeactivate"),u=b(t,"checkCanReturnFocus"),v=b(t,"returnFocus","returnFocusOnDeactivate");s==null||s();var p=function(){ae(function(){v&&k(G(a.nodeFocusedBeforeActivation)),d==null||d()})};return v&&u?(u(G(a.nodeFocusedBeforeActivation)).then(p,p),this):(p(),this)},pause:function(n){if(a.paused||!a.active)return this;var t=b(n,"onPause"),s=b(n,"onPostPause");return a.paused=!0,t==null||t(),Z(),x(),s==null||s(),this},unpause:function(n){if(!a.paused||!a.active)return this;var t=b(n,"onUnpause"),s=b(n,"onPostUnpause");return a.paused=!1,t==null||t(),C(),V(),x(),s==null||s(),this},updateContainerElements:function(n){var t=[].concat(n).filter(Boolean);return a.containers=t.map(function(s){return typeof s=="string"?o.querySelector(s):s}),a.active&&C(),x(),this}},g.updateContainerElements(e),g};const M=globalThis.calciteConfig,tt=(M==null?void 0:M.focusTrapStack)||[];function it(i,e){const{el:r}=i,o=(e==null?void 0:e.focusTrapEl)||r;if(!o)return;const l={clickOutsideDeactivates:!0,escapeDeactivates:!1,fallbackFocus:o,setReturnFocus:c=>(ve(c),!1),...e==null?void 0:e.focusTrapOptions,document:r.ownerDocument,tabbableOptions:pe,trapStack:tt};i.focusTrap=et(o,l)}function oe(i,e){var r;i.focusTrapDisabled||(r=i.focusTrap)==null||r.activate(e)}function $(i,e){var r;(r=i.focusTrap)==null||r.deactivate(e)}function nt(i){var e;(e=i.focusTrap)==null||e.updateContainerElements(i.el)}/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 @@ -13,4 +13,4 @@ import{ac as ve,lO as pe,lP as U,lQ as he,lR as be,lS as T,lT as L,t as y,q as m * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 - */const E={container:"container",imageContainer:"image-container",closeButtonContainer:"close-button-container",closeButton:"close-button",content:"content",hasHeader:"has-header",header:"header",headerContent:"header-content",heading:"heading"},rt="auto",se="aria-controls",ce="aria-expanded";class ot{constructor(){this.registeredElements=new Map,this.registeredElementCount=0,this.queryPopover=e=>{const{registeredElements:r}=this,o=e.find(l=>r.has(l));return r.get(o)},this.togglePopovers=e=>{const r=e.composedPath(),o=this.queryPopover(r);o&&!o.triggerDisabled&&(o.open=!o.open),Array.from(this.registeredElements.values()).filter(l=>l!==o&&l.autoClose&&l.open&&!r.includes(l)).forEach(l=>l.open=!1)},this.keyHandler=e=>{e.defaultPrevented||(e.key==="Escape"?this.closeAllPopovers():ze(e.key)&&this.togglePopovers(e))},this.clickHandler=e=>{ke(e)&&this.togglePopovers(e)}}registerElement(e,r){this.registeredElementCount++,this.registeredElements.set(e,r),this.registeredElementCount===1&&this.addListeners()}unregisterElement(e){this.registeredElements.delete(e)&&this.registeredElementCount--,this.registeredElementCount===0&&this.removeListeners()}closeAllPopovers(){Array.from(this.registeredElements.values()).forEach(e=>e.open=!1)}addListeners(){document.addEventListener("pointerdown",this.clickHandler,{capture:!0}),document.addEventListener("keydown",this.keyHandler,{capture:!0})}removeListeners(){document.removeEventListener("pointerdown",this.clickHandler,{capture:!0}),document.removeEventListener("keydown",this.keyHandler,{capture:!0})}}const st=":host{--calcite-floating-ui-z-index:var(--calcite-popover-z-index, var(--calcite-app-z-index-popup));display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index)}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-app-z-index) * -1);fill:var(--calcite-ui-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-ui-border-3)}:host([scale=s]) .heading{padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) .heading{padding-inline:1rem;padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) .heading{padding-inline:1.25rem;padding-block:1rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host{pointer-events:none}:host([open]){pointer-events:initial}.calcite-floating-ui-anim{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}.arrow::before{outline:1px solid var(--calcite-ui-border-3)}.header{display:flex;flex:1 1 auto;align-items:stretch;justify-content:flex-start;border-width:0px;border-block-end-width:1px;border-style:solid;border-block-end-color:var(--calcite-ui-border-3)}.heading{margin:0px;display:block;flex:1 1 auto;align-self:center;white-space:normal;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);word-wrap:break-word;word-break:break-word}.container{position:relative;display:flex;block-size:100%;flex-direction:row;flex-wrap:nowrap;border-radius:0.25rem;color:var(--calcite-ui-text-1)}.container.has-header{flex-direction:column}.content{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;align-self:center;word-wrap:break-word;word-break:break-word}.close-button-container{display:flex;overflow:hidden;flex:0 0 auto;border-start-end-radius:0.25rem;border-end-end-radius:0.25rem}::slotted(calcite-panel),::slotted(calcite-flow){block-size:100%}:host([hidden]){display:none}[hidden]{display:none}",le=new ot,ct=me(class extends ge{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calcitePopoverBeforeClose=z(this,"calcitePopoverBeforeClose",6),this.calcitePopoverClose=z(this,"calcitePopoverClose",6),this.calcitePopoverBeforeOpen=z(this,"calcitePopoverBeforeOpen",6),this.calcitePopoverOpen=z(this,"calcitePopoverOpen",6),this.mutationObserver=je("mutation",()=>this.updateFocusTrapElements()),this.guid=`calcite-popover-${xe()}`,this.openTransitionProp="opacity",this.hasLoaded=!1,this.setTransitionEl=i=>{this.transitionEl=i},this.setFilteredPlacements=()=>{const{el:i,flipPlacements:e}=this;this.filteredFlipPlacements=e?Fe(e,i):null},this.setUpReferenceElement=(i=!0)=>{this.removeReferences(),this.effectiveReferenceElement=this.getReferenceElement(),Te(this,this.effectiveReferenceElement,this.el);const{el:e,referenceElement:r,effectiveReferenceElement:o}=this;i&&r&&!o&&console.warn(`${e.tagName}: reference-element id "${r}" was not found.`,{el:e}),this.addReferences()},this.getId=()=>this.el.id||this.guid,this.setExpandedAttr=()=>{const{effectiveReferenceElement:i,open:e}=this;i&&"setAttribute"in i&&i.setAttribute(ce,Z(e))},this.addReferences=()=>{const{effectiveReferenceElement:i}=this;if(!i)return;const e=this.getId();"setAttribute"in i&&i.setAttribute(se,e),le.registerElement(i,this.el),this.setExpandedAttr()},this.removeReferences=()=>{const{effectiveReferenceElement:i}=this;i&&("removeAttribute"in i&&(i.removeAttribute(se),i.removeAttribute(ce)),le.unregisterElement(i))},this.hide=()=>{this.open=!1},this.storeArrowEl=i=>{this.arrowEl=i,this.reposition(!0)},this.autoClose=!1,this.closable=!1,this.flipDisabled=!1,this.focusTrapDisabled=!1,this.pointerDisabled=!1,this.flipPlacements=void 0,this.heading=void 0,this.headingLevel=void 0,this.label=void 0,this.messageOverrides=void 0,this.messages=void 0,this.offsetDistance=De,this.offsetSkidding=0,this.open=!1,this.overlayPositioning="absolute",this.placement=rt,this.referenceElement=void 0,this.scale="m",this.triggerDisabled=!1,this.effectiveLocale="",this.floatingLayout="vertical",this.effectiveReferenceElement=void 0,this.defaultMessages=void 0}handleFocusTrapDisabled(i){this.open&&(i?$(this):oe(this))}flipPlacementsHandler(){this.setFilteredPlacements(),this.reposition(!0)}onMessagesChange(){}offsetDistanceOffsetHandler(){this.reposition(!0)}offsetSkiddingHandler(){this.reposition(!0)}openHandler(i){ee(this),i&&this.reposition(!0),this.setExpandedAttr()}overlayPositioningHandler(){this.reposition(!0)}placementHandler(){this.reposition(!0)}referenceElementHandler(){this.setUpReferenceElement(),this.reposition(!0)}effectiveLocaleChange(){Le(this,this.effectiveLocale)}connectedCallback(){this.setFilteredPlacements(),Re(this),Ae(this),this.setUpReferenceElement(this.hasLoaded),it(this),this.open&&ee(this)}async componentWillLoad(){await Be(this),Se(this)}componentDidLoad(){Ke(this),this.referenceElement&&!this.effectiveReferenceElement&&this.setUpReferenceElement(),this.reposition(),this.hasLoaded=!0}disconnectedCallback(){this.removeReferences(),Oe(this),He(this),Ne(this,this.effectiveReferenceElement,this.el),$(this)}async reposition(i=!1){const{el:e,effectiveReferenceElement:r,placement:o,overlayPositioning:l,flipDisabled:c,filteredFlipPlacements:a,offsetDistance:g,offsetSkidding:b,arrowEl:w}=this;return Ce(this,{floatingEl:e,referenceEl:r,overlayPositioning:l,placement:o,flipDisabled:c,flipPlacements:a,offsetDistance:g,offsetSkidding:b,arrowEl:w,type:"popover"},i)}async setFocus(){await Ie(this),ye(this.el),Ee(this.el)}async updateFocusTrapElements(){nt(this)}getReferenceElement(){const{referenceElement:i,el:e}=this;return(typeof i=="string"?we(e,{id:i}):i)||null}onBeforeOpen(){this.calcitePopoverBeforeOpen.emit()}onOpen(){this.calcitePopoverOpen.emit(),oe(this)}onBeforeClose(){this.calcitePopoverBeforeClose.emit()}onClose(){this.calcitePopoverClose.emit(),$(this)}renderCloseButton(){const{messages:i,closable:e}=this;return e?y("div",{class:E.closeButtonContainer,key:E.closeButtonContainer},y("calcite-action",{appearance:"transparent",class:E.closeButton,onClick:this.hide,scale:this.scale,text:i.close,ref:r=>this.closeButtonEl=r},y("calcite-icon",{icon:"x",scale:Me(this.scale)}))):null}renderHeader(){const{heading:i,headingLevel:e}=this,r=i?y(at,{class:E.heading,level:e},i):null;return r?y("div",{class:E.header,key:E.header},r,this.renderCloseButton()):null}render(){const{effectiveReferenceElement:i,heading:e,label:r,open:o,pointerDisabled:l,floatingLayout:c}=this,a=i&&o,g=!a,b=l?null:y(Ue,{floatingLayout:c,key:"floating-arrow",ref:this.storeArrowEl});return y(Pe,{"aria-hidden":Z(g),"aria-label":r,"aria-live":"polite","calcite-hydrated-hidden":g,id:this.getId(),role:"dialog"},y("div",{class:{[_.animation]:!0,[_.animationActive]:a},ref:this.setTransitionEl},b,y("div",{class:{[E.hasHeader]:!!e,[E.container]:!0}},this.renderHeader(),y("div",{class:E.content},y("slot",null)),e?null:this.renderCloseButton())))}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{focusTrapDisabled:["handleFocusTrapDisabled"],flipPlacements:["flipPlacementsHandler"],messageOverrides:["onMessagesChange"],offsetDistance:["offsetDistanceOffsetHandler"],offsetSkidding:["offsetSkiddingHandler"],open:["openHandler"],overlayPositioning:["overlayPositioningHandler"],placement:["placementHandler"],referenceElement:["referenceElementHandler"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return st}},[1,"calcite-popover",{autoClose:[516,"auto-close"],closable:[516],flipDisabled:[516,"flip-disabled"],focusTrapDisabled:[516,"focus-trap-disabled"],pointerDisabled:[516,"pointer-disabled"],flipPlacements:[16],heading:[1],headingLevel:[514,"heading-level"],label:[1],messageOverrides:[1040],messages:[1040],offsetDistance:[514,"offset-distance"],offsetSkidding:[514,"offset-skidding"],open:[1540],overlayPositioning:[513,"overlay-positioning"],placement:[513],referenceElement:[1,"reference-element"],scale:[513],triggerDisabled:[516,"trigger-disabled"],effectiveLocale:[32],floatingLayout:[32],effectiveReferenceElement:[32],defaultMessages:[32],reposition:[64],setFocus:[64],updateFocusTrapElements:[64]}]);function lt(){if(typeof customElements>"u")return;["calcite-popover","calcite-action","calcite-icon","calcite-loader"].forEach(e=>{switch(e){case"calcite-popover":customElements.get(e)||customElements.define(e,ct);break;case"calcite-action":customElements.get(e)||$e();break;case"calcite-icon":customElements.get(e)||Ge();break;case"calcite-loader":customElements.get(e)||qe();break}})}lt();export{at as H,ct as P,lt as d}; + */const E={container:"container",imageContainer:"image-container",closeButtonContainer:"close-button-container",closeButton:"close-button",content:"content",hasHeader:"has-header",header:"header",headerContent:"header-content",heading:"heading"},rt="auto",se="aria-controls",ce="aria-expanded";class ot{constructor(){this.registeredElements=new Map,this.registeredElementCount=0,this.queryPopover=e=>{const{registeredElements:r}=this,o=e.find(l=>r.has(l));return r.get(o)},this.togglePopovers=e=>{const r=e.composedPath(),o=this.queryPopover(r);o&&!o.triggerDisabled&&(o.open=!o.open),Array.from(this.registeredElements.values()).filter(l=>l!==o&&l.autoClose&&l.open&&!r.includes(l)).forEach(l=>l.open=!1)},this.keyHandler=e=>{e.defaultPrevented||(e.key==="Escape"?this.closeAllPopovers():ze(e.key)&&this.togglePopovers(e))},this.clickHandler=e=>{ke(e)&&this.togglePopovers(e)}}registerElement(e,r){this.registeredElementCount++,this.registeredElements.set(e,r),this.registeredElementCount===1&&this.addListeners()}unregisterElement(e){this.registeredElements.delete(e)&&this.registeredElementCount--,this.registeredElementCount===0&&this.removeListeners()}closeAllPopovers(){Array.from(this.registeredElements.values()).forEach(e=>e.open=!1)}addListeners(){document.addEventListener("pointerdown",this.clickHandler,{capture:!0}),document.addEventListener("keydown",this.keyHandler,{capture:!0})}removeListeners(){document.removeEventListener("pointerdown",this.clickHandler,{capture:!0}),document.removeEventListener("keydown",this.keyHandler,{capture:!0})}}const st=":host{--calcite-floating-ui-z-index:var(--calcite-popover-z-index, var(--calcite-app-z-index-popup));display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index)}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-app-z-index) * -1);fill:var(--calcite-ui-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-ui-border-3)}:host([scale=s]) .heading{padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) .heading{padding-inline:1rem;padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) .heading{padding-inline:1.25rem;padding-block:1rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host{pointer-events:none}:host([open]){pointer-events:initial}.calcite-floating-ui-anim{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}.arrow::before{outline:1px solid var(--calcite-ui-border-3)}.header{display:flex;flex:1 1 auto;align-items:stretch;justify-content:flex-start;border-width:0px;border-block-end-width:1px;border-style:solid;border-block-end-color:var(--calcite-ui-border-3)}.heading{margin:0px;display:block;flex:1 1 auto;align-self:center;white-space:normal;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);word-wrap:break-word;word-break:break-word}.container{position:relative;display:flex;block-size:100%;flex-direction:row;flex-wrap:nowrap;border-radius:0.25rem;color:var(--calcite-ui-text-1)}.container.has-header{flex-direction:column}.content{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;align-self:center;word-wrap:break-word;word-break:break-word}.close-button-container{display:flex;overflow:hidden;flex:0 0 auto;border-start-end-radius:0.25rem;border-end-end-radius:0.25rem}::slotted(calcite-panel),::slotted(calcite-flow){block-size:100%}:host([hidden]){display:none}[hidden]{display:none}",le=new ot,ct=me(class extends ge{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.calcitePopoverBeforeClose=z(this,"calcitePopoverBeforeClose",6),this.calcitePopoverClose=z(this,"calcitePopoverClose",6),this.calcitePopoverBeforeOpen=z(this,"calcitePopoverBeforeOpen",6),this.calcitePopoverOpen=z(this,"calcitePopoverOpen",6),this.mutationObserver=je("mutation",()=>this.updateFocusTrapElements()),this.guid=`calcite-popover-${xe()}`,this.openTransitionProp="opacity",this.hasLoaded=!1,this.setTransitionEl=i=>{this.transitionEl=i},this.setFilteredPlacements=()=>{const{el:i,flipPlacements:e}=this;this.filteredFlipPlacements=e?Fe(e,i):null},this.setUpReferenceElement=(i=!0)=>{this.removeReferences(),this.effectiveReferenceElement=this.getReferenceElement(),Te(this,this.effectiveReferenceElement,this.el);const{el:e,referenceElement:r,effectiveReferenceElement:o}=this;i&&r&&!o&&console.warn(`${e.tagName}: reference-element id "${r}" was not found.`,{el:e}),this.addReferences()},this.getId=()=>this.el.id||this.guid,this.setExpandedAttr=()=>{const{effectiveReferenceElement:i,open:e}=this;i&&"setAttribute"in i&&i.setAttribute(ce,Q(e))},this.addReferences=()=>{const{effectiveReferenceElement:i}=this;if(!i)return;const e=this.getId();"setAttribute"in i&&i.setAttribute(se,e),le.registerElement(i,this.el),this.setExpandedAttr()},this.removeReferences=()=>{const{effectiveReferenceElement:i}=this;i&&("removeAttribute"in i&&(i.removeAttribute(se),i.removeAttribute(ce)),le.unregisterElement(i))},this.hide=()=>{this.open=!1},this.storeArrowEl=i=>{this.arrowEl=i,this.reposition(!0)},this.autoClose=!1,this.closable=!1,this.flipDisabled=!1,this.focusTrapDisabled=!1,this.pointerDisabled=!1,this.flipPlacements=void 0,this.heading=void 0,this.headingLevel=void 0,this.label=void 0,this.messageOverrides=void 0,this.messages=void 0,this.offsetDistance=De,this.offsetSkidding=0,this.open=!1,this.overlayPositioning="absolute",this.placement=rt,this.referenceElement=void 0,this.scale="m",this.triggerDisabled=!1,this.effectiveLocale="",this.floatingLayout="vertical",this.effectiveReferenceElement=void 0,this.defaultMessages=void 0}handleFocusTrapDisabled(i){this.open&&(i?$(this):oe(this))}flipPlacementsHandler(){this.setFilteredPlacements(),this.reposition(!0)}onMessagesChange(){}offsetDistanceOffsetHandler(){this.reposition(!0)}offsetSkiddingHandler(){this.reposition(!0)}openHandler(i){ee(this),i&&this.reposition(!0),this.setExpandedAttr()}overlayPositioningHandler(){this.reposition(!0)}placementHandler(){this.reposition(!0)}referenceElementHandler(){this.setUpReferenceElement(),this.reposition(!0)}effectiveLocaleChange(){Le(this,this.effectiveLocale)}connectedCallback(){this.setFilteredPlacements(),Re(this),Ae(this),this.setUpReferenceElement(this.hasLoaded),it(this),this.open&&ee(this)}async componentWillLoad(){await Be(this),Se(this)}componentDidLoad(){Ke(this),this.referenceElement&&!this.effectiveReferenceElement&&this.setUpReferenceElement(),this.reposition(),this.hasLoaded=!0}disconnectedCallback(){this.removeReferences(),Oe(this),He(this),Ne(this,this.effectiveReferenceElement,this.el),$(this)}async reposition(i=!1){const{el:e,effectiveReferenceElement:r,placement:o,overlayPositioning:l,flipDisabled:c,filteredFlipPlacements:a,offsetDistance:g,offsetSkidding:b,arrowEl:w}=this;return Ce(this,{floatingEl:e,referenceEl:r,overlayPositioning:l,placement:o,flipDisabled:c,flipPlacements:a,offsetDistance:g,offsetSkidding:b,arrowEl:w,type:"popover"},i)}async setFocus(){await Ie(this),ye(this.el),Ee(this.el)}async updateFocusTrapElements(){nt(this)}getReferenceElement(){const{referenceElement:i,el:e}=this;return(typeof i=="string"?we(e,{id:i}):i)||null}onBeforeOpen(){this.calcitePopoverBeforeOpen.emit()}onOpen(){this.calcitePopoverOpen.emit(),oe(this)}onBeforeClose(){this.calcitePopoverBeforeClose.emit()}onClose(){this.calcitePopoverClose.emit(),$(this)}renderCloseButton(){const{messages:i,closable:e}=this;return e?y("div",{class:E.closeButtonContainer,key:E.closeButtonContainer},y("calcite-action",{appearance:"transparent",class:E.closeButton,onClick:this.hide,scale:this.scale,text:i.close,ref:r=>this.closeButtonEl=r},y("calcite-icon",{icon:"x",scale:Me(this.scale)}))):null}renderHeader(){const{heading:i,headingLevel:e}=this,r=i?y(at,{class:E.heading,level:e},i):null;return r?y("div",{class:E.header,key:E.header},r,this.renderCloseButton()):null}render(){const{effectiveReferenceElement:i,heading:e,label:r,open:o,pointerDisabled:l,floatingLayout:c}=this,a=i&&o,g=!a,b=l?null:y(Ue,{floatingLayout:c,key:"floating-arrow",ref:this.storeArrowEl});return y(Pe,{"aria-hidden":Q(g),"aria-label":r,"aria-live":"polite","calcite-hydrated-hidden":g,id:this.getId(),role:"dialog"},y("div",{class:{[_.animation]:!0,[_.animationActive]:a},ref:this.setTransitionEl},b,y("div",{class:{[E.hasHeader]:!!e,[E.container]:!0}},this.renderHeader(),y("div",{class:E.content},y("slot",null)),e?null:this.renderCloseButton())))}static get assetsDirs(){return["assets"]}get el(){return this}static get watchers(){return{focusTrapDisabled:["handleFocusTrapDisabled"],flipPlacements:["flipPlacementsHandler"],messageOverrides:["onMessagesChange"],offsetDistance:["offsetDistanceOffsetHandler"],offsetSkidding:["offsetSkiddingHandler"],open:["openHandler"],overlayPositioning:["overlayPositioningHandler"],placement:["placementHandler"],referenceElement:["referenceElementHandler"],effectiveLocale:["effectiveLocaleChange"]}}static get style(){return st}},[1,"calcite-popover",{autoClose:[516,"auto-close"],closable:[516],flipDisabled:[516,"flip-disabled"],focusTrapDisabled:[516,"focus-trap-disabled"],pointerDisabled:[516,"pointer-disabled"],flipPlacements:[16],heading:[1],headingLevel:[514,"heading-level"],label:[1],messageOverrides:[1040],messages:[1040],offsetDistance:[514,"offset-distance"],offsetSkidding:[514,"offset-skidding"],open:[1540],overlayPositioning:[513,"overlay-positioning"],placement:[513],referenceElement:[1,"reference-element"],scale:[513],triggerDisabled:[516,"trigger-disabled"],effectiveLocale:[32],floatingLayout:[32],effectiveReferenceElement:[32],defaultMessages:[32],reposition:[64],setFocus:[64],updateFocusTrapElements:[64]}]);function lt(){if(typeof customElements>"u")return;["calcite-popover","calcite-action","calcite-icon","calcite-loader"].forEach(e=>{switch(e){case"calcite-popover":customElements.get(e)||customElements.define(e,ct);break;case"calcite-action":customElements.get(e)||$e();break;case"calcite-icon":customElements.get(e)||Ge();break;case"calcite-loader":customElements.get(e)||qe();break}})}lt();export{at as H,ct as P,lt as d}; diff --git a/dist/assets/portalLayers-AqjAd9kT.js b/dist/assets/portalLayers-Au1cdQPl.js similarity index 89% rename from dist/assets/portalLayers-AqjAd9kT.js rename to dist/assets/portalLayers-Au1cdQPl.js index c7a3ab6..6cdb137 100644 --- a/dist/assets/portalLayers-AqjAd9kT.js +++ b/dist/assets/portalLayers-Au1cdQPl.js @@ -1 +1 @@ -import{di as w,bR as L,E as I,dj as v,dk as y,j as f}from"./index-J0iiHjMT.js";import{t as b}from"./requestPresets-18nzHK5y.js";class M{constructor(){this._serviceMetadatas=new Map}async fetchServiceMetadata(a,t){const r=this._serviceMetadatas.get(a);if(r)return r;const n=await b(a,t);return this._serviceMetadatas.set(a,n),n}}function u(e){const a={id:e.id,name:e.name};return e.type==="Oriented Imagery Layer"&&(a.layerType="OrientedImageryLayer"),a}async function g(e,a,t){var r,n;if((e==null?void 0:e.layers)==null||(e==null?void 0:e.tables)==null){const s=await t.fetchServiceMetadata(a);(e=e||{}).layers=e.layers||((r=s==null?void 0:s.layers)==null?void 0:r.map(u)),e.tables=e.tables||((n=s==null?void 0:s.tables)==null?void 0:n.map(u))}return e}function T(e){const a=e.layers;if(a!=null&&a.length)return a[0].id;const t=e.tables;return t!=null&&t.length?t[0].id:null}function p(e){var a,t;return(((a=e==null?void 0:e.layers)==null?void 0:a.length)??0)+(((t=e==null?void 0:e.tables)==null?void 0:t.length)??0)}function G(e){var t;const a=[];return(t=e==null?void 0:e.layers)==null||t.forEach(r=>{r.layerType==="SubtypeGroupLayer"&&a.push(r.id)}),a}function $(e){var a;return(a=e==null?void 0:e.layers)==null?void 0:a.filter(({layerType:t})=>t==="OrientedImageryLayer").map(({id:t})=>t)}async function F(e,a,t){var s,i;if(!(e!=null&&e.url))return a??{};if(a??(a={}),!a.layers){const c=await t.fetchServiceMetadata(e.url);a.layers=(s=c.layers)==null?void 0:s.map(u)}const{serverUrl:r,portalItem:n}=await w(e.url,{sceneLayerItem:e}).catch(()=>({serverUrl:null,portalItem:null}));if(r==null)return a.tables=[],a;if(!a.tables&&n){const c=await n.fetchData();if(c!=null&&c.tables)a.tables=c.tables.map(u);else{const l=await t.fetchServiceMetadata(r);a.tables=(i=l==null?void 0:l.tables)==null?void 0:i.map(u)}}if(a.tables)for(const c of a.tables)c.url=`${r}/${c.id}`;return a}async function j(e){!e.portalItem||e.portalItem instanceof L||(e={...e,portalItem:new L(e.portalItem)});const a=await C(e.portalItem);return new a.constructor({portalItem:e.portalItem,...a.properties})}async function C(e){await e.load();const a=new M;return O(await S(e,a))}async function S(e,a){switch(e.type){case"Map Service":return V(e,a);case"Feature Service":return W(e,a);case"Feature Collection":return K(e);case"Scene Service":return _(e,a);case"Image Service":return k(e,a);case"Stream Service":return U();case"Vector Tile Service":return D();case"GeoJson":return x();case"CSV":return E();case"KML":return R();case"WFS":return A();case"WMTS":return P();case"WMS":return J();case"Feed":return z();case"Group Layer":return q();default:throw new I("portal:unknown-item-type","Unknown item type '${type}'",{type:e.type})}}async function O(e){const a=e.className,t=v[a];return{constructor:await t(),properties:e.properties}}async function V(e,a){return await B(e,a)?{className:"TileLayer"}:{className:"MapImageLayer"}}async function W(e,a){const t=await N(e,a);if(typeof t=="object"){const r={};return t.id!=null&&(r.layerId=t.id),{className:t.className||"FeatureLayer",properties:r}}return{className:"GroupLayer"}}async function _(e,a){var r;const t=await N(e,a,async()=>{try{if(!e.url)return[];const{serverUrl:n}=await w(e.url,{sceneLayerItem:e}),s=await a.fetchServiceMetadata(n);return(s==null?void 0:s.tables)??[]}catch{return[]}});if(typeof t=="object"){const n={};let s;if(t.id!=null?(n.layerId=t.id,s=`${e.url}/layers/${t.id}`):s=e.url,(r=e.typeKeywords)==null?void 0:r.length){for(const c of Object.keys(y))if(e.typeKeywords.includes(c))return{className:y[c]}}const i=await a.fetchServiceMetadata(s);return{className:y[i==null?void 0:i.layerType]||"SceneLayer",properties:n}}if(t===!1){const n=await a.fetchServiceMetadata(e.url);if((n==null?void 0:n.layerType)==="Voxel")return{className:"VoxelLayer"}}return{className:"GroupLayer"}}async function K(e){await e.load();const a=f(e,"Map Notes"),t=f(e,"Markup");if(a||t)return{className:"MapNotesLayer"};if(f(e,"Route Layer"))return{className:"RouteLayer"};const r=await e.fetchData();return p(r)===1?{className:"FeatureLayer"}:{className:"GroupLayer"}}async function k(e,a){var l,o,d;await e.load();const t=((l=e.typeKeywords)==null?void 0:l.map(h=>h.toLowerCase()))??[];if(t.includes("elevation 3d layer"))return{className:"ElevationLayer"};if(t.includes("tiled imagery"))return{className:"ImageryTileLayer"};const r=await e.fetchData(),n=r==null?void 0:r.layerType;if(n==="ArcGISTiledImageServiceLayer")return{className:"ImageryTileLayer"};if(n==="ArcGISImageServiceLayer")return{className:"ImageryLayer"};const s=await a.fetchServiceMetadata(e.url),i=(o=s.cacheType)==null?void 0:o.toLowerCase(),c=(d=s.capabilities)==null?void 0:d.toLowerCase().includes("tilesonly");return i==="map"||c?{className:"ImageryTileLayer"}:{className:"ImageryLayer"}}function U(){return{className:"StreamLayer"}}function D(){return{className:"VectorTileLayer"}}function x(){return{className:"GeoJSONLayer"}}function E(){return{className:"CSVLayer"}}function R(){return{className:"KMLLayer"}}function A(){return{className:"WFSLayer"}}function J(){return{className:"WMSLayer"}}function P(){return{className:"WMTSLayer"}}function z(){return{className:"StreamLayer"}}function q(){return{className:"GroupLayer"}}async function B(e,a){return(await a.fetchServiceMetadata(e.url)).tileInfo}async function N(e,a,t){const r=e.url;if(!r||/\/\d+$/.test(r))return{};await e.load();let n=await e.fetchData();if(e.type==="Feature Service"){const i=await g(n,r,a),c=m(i);if(typeof c=="object"){const l=G(i),o=$(i);c.className=c.id!=null&&l.includes(c.id)?"SubtypeGroupLayer":c.id!=null&&(o!=null&&o.includes(c.id))?"OrientedImageryLayer":"FeatureLayer"}return c}if(e.type==="Scene Service"&&(n=await F(e,n,a)),p(n)>0)return m(n);const s=await a.fetchServiceMetadata(r);return t&&(s.tables=await t()),m(s)}function m(e){return p(e)===1&&{id:T(e)}}const X=Object.freeze(Object.defineProperty({__proto__:null,fromItem:j,selectLayerClassPath:S},Symbol.toStringTag,{value:"Module"}));export{S as L,g as a,M as e,F as i,p as l,G as n,X as p,T as r,$ as s,u as t}; +import{di as w,aq as L,r as I,dj as v,dk as y,s as f}from"./index-pCX-0tJH.js";import{t as b}from"./requestPresets-f6ZAWLqV.js";class M{constructor(){this._serviceMetadatas=new Map}async fetchServiceMetadata(a,t){const r=this._serviceMetadatas.get(a);if(r)return r;const n=await b(a,t);return this._serviceMetadatas.set(a,n),n}}function u(e){const a={id:e.id,name:e.name};return e.type==="Oriented Imagery Layer"&&(a.layerType="OrientedImageryLayer"),a}async function g(e,a,t){var r,n;if((e==null?void 0:e.layers)==null||(e==null?void 0:e.tables)==null){const s=await t.fetchServiceMetadata(a);(e=e||{}).layers=e.layers||((r=s==null?void 0:s.layers)==null?void 0:r.map(u)),e.tables=e.tables||((n=s==null?void 0:s.tables)==null?void 0:n.map(u))}return e}function T(e){const a=e.layers;if(a!=null&&a.length)return a[0].id;const t=e.tables;return t!=null&&t.length?t[0].id:null}function p(e){var a,t;return(((a=e==null?void 0:e.layers)==null?void 0:a.length)??0)+(((t=e==null?void 0:e.tables)==null?void 0:t.length)??0)}function G(e){var t;const a=[];return(t=e==null?void 0:e.layers)==null||t.forEach(r=>{r.layerType==="SubtypeGroupLayer"&&a.push(r.id)}),a}function $(e){var a;return(a=e==null?void 0:e.layers)==null?void 0:a.filter(({layerType:t})=>t==="OrientedImageryLayer").map(({id:t})=>t)}async function F(e,a,t){var s,i;if(!(e!=null&&e.url))return a??{};if(a??(a={}),!a.layers){const c=await t.fetchServiceMetadata(e.url);a.layers=(s=c.layers)==null?void 0:s.map(u)}const{serverUrl:r,portalItem:n}=await w(e.url,{sceneLayerItem:e}).catch(()=>({serverUrl:null,portalItem:null}));if(r==null)return a.tables=[],a;if(!a.tables&&n){const c=await n.fetchData();if(c!=null&&c.tables)a.tables=c.tables.map(u);else{const l=await t.fetchServiceMetadata(r);a.tables=(i=l==null?void 0:l.tables)==null?void 0:i.map(u)}}if(a.tables)for(const c of a.tables)c.url=`${r}/${c.id}`;return a}async function j(e){!e.portalItem||e.portalItem instanceof L||(e={...e,portalItem:new L(e.portalItem)});const a=await C(e.portalItem);return new a.constructor({portalItem:e.portalItem,...a.properties})}async function C(e){await e.load();const a=new M;return O(await S(e,a))}async function S(e,a){switch(e.type){case"Map Service":return V(e,a);case"Feature Service":return W(e,a);case"Feature Collection":return K(e);case"Scene Service":return _(e,a);case"Image Service":return k(e,a);case"Stream Service":return U();case"Vector Tile Service":return D();case"GeoJson":return x();case"CSV":return A();case"KML":return E();case"WFS":return J();case"WMTS":return R();case"WMS":return P();case"Feed":return q();case"Group Layer":return z();default:throw new I("portal:unknown-item-type","Unknown item type '${type}'",{type:e.type})}}async function O(e){const a=e.className,t=v[a];return{constructor:await t(),properties:e.properties}}async function V(e,a){return await B(e,a)?{className:"TileLayer"}:{className:"MapImageLayer"}}async function W(e,a){const t=await N(e,a);if(typeof t=="object"){const r={};return t.id!=null&&(r.layerId=t.id),{className:t.className||"FeatureLayer",properties:r}}return{className:"GroupLayer"}}async function _(e,a){var r;const t=await N(e,a,async()=>{try{if(!e.url)return[];const{serverUrl:n}=await w(e.url,{sceneLayerItem:e}),s=await a.fetchServiceMetadata(n);return(s==null?void 0:s.tables)??[]}catch{return[]}});if(typeof t=="object"){const n={};let s;if(t.id!=null?(n.layerId=t.id,s=`${e.url}/layers/${t.id}`):s=e.url,(r=e.typeKeywords)==null?void 0:r.length){for(const c of Object.keys(y))if(e.typeKeywords.includes(c))return{className:y[c]}}const i=await a.fetchServiceMetadata(s);return{className:y[i==null?void 0:i.layerType]||"SceneLayer",properties:n}}if(t===!1){const n=await a.fetchServiceMetadata(e.url);if((n==null?void 0:n.layerType)==="Voxel")return{className:"VoxelLayer"}}return{className:"GroupLayer"}}async function K(e){await e.load();const a=f(e,"Map Notes"),t=f(e,"Markup");if(a||t)return{className:"MapNotesLayer"};if(f(e,"Route Layer"))return{className:"RouteLayer"};const r=await e.fetchData();return p(r)===1?{className:"FeatureLayer"}:{className:"GroupLayer"}}async function k(e,a){var l,o,d;await e.load();const t=((l=e.typeKeywords)==null?void 0:l.map(h=>h.toLowerCase()))??[];if(t.includes("elevation 3d layer"))return{className:"ElevationLayer"};if(t.includes("tiled imagery"))return{className:"ImageryTileLayer"};const r=await e.fetchData(),n=r==null?void 0:r.layerType;if(n==="ArcGISTiledImageServiceLayer")return{className:"ImageryTileLayer"};if(n==="ArcGISImageServiceLayer")return{className:"ImageryLayer"};const s=await a.fetchServiceMetadata(e.url),i=(o=s.cacheType)==null?void 0:o.toLowerCase(),c=(d=s.capabilities)==null?void 0:d.toLowerCase().includes("tilesonly");return i==="map"||c?{className:"ImageryTileLayer"}:{className:"ImageryLayer"}}function U(){return{className:"StreamLayer"}}function D(){return{className:"VectorTileLayer"}}function x(){return{className:"GeoJSONLayer"}}function A(){return{className:"CSVLayer"}}function E(){return{className:"KMLLayer"}}function J(){return{className:"WFSLayer"}}function P(){return{className:"WMSLayer"}}function R(){return{className:"WMTSLayer"}}function q(){return{className:"StreamLayer"}}function z(){return{className:"GroupLayer"}}async function B(e,a){return(await a.fetchServiceMetadata(e.url)).tileInfo}async function N(e,a,t){const r=e.url;if(!r||/\/\d+$/.test(r))return{};await e.load();let n=await e.fetchData();if(e.type==="Feature Service"){const i=await g(n,r,a),c=m(i);if(typeof c=="object"){const l=G(i),o=$(i);c.className=c.id!=null&&l.includes(c.id)?"SubtypeGroupLayer":c.id!=null&&(o!=null&&o.includes(c.id))?"OrientedImageryLayer":"FeatureLayer"}return c}if(e.type==="Scene Service"&&(n=await F(e,n,a)),p(n)>0)return m(n);const s=await a.fetchServiceMetadata(r);return t&&(s.tables=await t()),m(s)}function m(e){return p(e)===1&&{id:T(e)}}const X=Object.freeze(Object.defineProperty({__proto__:null,fromItem:j,selectLayerClassPath:S},Symbol.toStringTag,{value:"Module"}));export{S as L,g as a,M as e,F as i,p as l,G as n,X as p,T as r,$ as s,u as t}; diff --git a/dist/assets/portalUtils-MqaWunxU.js b/dist/assets/portalUtils-MqaWunxU.js deleted file mode 100644 index a7a0bc6..0000000 --- a/dist/assets/portalUtils-MqaWunxU.js +++ /dev/null @@ -1 +0,0 @@ -import{bS as u}from"./index-J0iiHjMT.js";function l(r,n){return r===null?n:new u({url:r.field("url")})}export{l}; diff --git a/dist/assets/portalUtils-siGJ35LN.js b/dist/assets/portalUtils-siGJ35LN.js new file mode 100644 index 0000000..a4c5e2f --- /dev/null +++ b/dist/assets/portalUtils-siGJ35LN.js @@ -0,0 +1 @@ +import{ar as u}from"./index-pCX-0tJH.js";function l(r,n){return r===null?n:new u({url:r.field("url")})}export{l}; diff --git a/dist/assets/previewCIMSymbol-ZetpgWRs.js b/dist/assets/previewCIMSymbol-ZetpgWRs.js deleted file mode 100644 index e80bd67..0000000 --- a/dist/assets/previewCIMSymbol-ZetpgWRs.js +++ /dev/null @@ -1 +0,0 @@ -import{a4 as w,gP as b,gZ as F,gO as v,gU as j}from"./index-J0iiHjMT.js";import{l as G,n as d}from"./cimAnalyzer-DtyBzAGI.js";import{CIMSymbolRasterizer as R}from"./CIMSymbolRasterizer-o8gx_uXl.js";import"./labelPoint-ysDT9nFH.js";import"./TileClipper-NSFZXMR1.js";import"./definitions-DqQMJYPH.js";import"./number-sTjsTbdA.js";import"./BidiEngine-8z8MVveq.js";import"./rasterizingUtils-6P0UGdzr.js";const h=new R(null,!0),u=w(b.size),S=w(b.maxSize),C=w(b.lineWidth),U=1;async function V(i,e,r){const l=e==null?void 0:e.size;let t=l!=null&&typeof l=="object"&&"width"in l?l.width:l,n=l!=null&&typeof l=="object"&&"height"in l?l.height:l;if(t==null||n==null)if(r==="esriGeometryPolygon")t=u,n=u;else{const a=await $(i,e,r);a&&(t=a.width,n=a.height),r==="esriGeometryPolyline"&&(t=C),t=t!=null&&isFinite(t)?Math.min(t,S):u,n=n!=null&&isFinite(n)?Math.max(Math.min(n,S),U):u}return e.style==="legend"&&r==="esriGeometryPolyline"&&(t=C),{width:t,height:n}}async function $(i,e,r){const{feature:l,fieldMap:t,viewParams:n}=e.cimOptions||e,a=await G.resolveSymbolOverrides(i.data,l,null,t,r,null,n);if(!a)return null;(i=i.clone()).data={type:"CIMSymbolReference",symbol:a},i.data.primitiveOverrides=void 0;const o=[];return d.fetchResources(a,h.resourceManager,o),d.fetchFonts(a,h.resourceManager,o),o.length>0&&await Promise.all(o),d.getEnvelope(a,null,h.resourceManager)}async function H(i,e={}){var M;const{node:r,opacity:l,symbolConfig:t}=e,n=t!=null&&typeof t=="object"&&"isSquareFill"in t&&t.isSquareFill,a=e.cimOptions||e,o=a.geometryType||F((M=i==null?void 0:i.data)==null?void 0:M.symbol),y=await V(i,e,o),{feature:P,fieldMap:I}=a,L=n||o!=="esriGeometryPolygon"?"preview":"legend",f=await h.rasterizeCIMSymbolAsync(i,P,y,L,I,o,null,a.viewParams,a.allowScalingUp);if(!f)return null;const{width:O,height:x}=f,c=document.createElement("canvas");c.width=O,c.height=x,c.getContext("2d").putImageData(f,0,0);const p=v(y.width),g=v(y.height),s=new Image(p,g);s.src=c.toDataURL(),s.ariaLabel=e.ariaLabel??null,s.alt=e.ariaLabel??"",l!=null&&(s.style.opacity=`${l}`);let m=s;if(e.effectView!=null){const z={shape:{type:"image",x:0,y:0,width:p,height:g,src:s.src},fill:null,stroke:null,offset:[0,0]};m=j([[z]],[p,g],{effectView:e.effectView,ariaLabel:e.ariaLabel})}return r&&m&&r.appendChild(m),m}export{H as previewCIMSymbol}; diff --git a/dist/assets/previewCIMSymbol-mCxoLtDl.js b/dist/assets/previewCIMSymbol-mCxoLtDl.js new file mode 100644 index 0000000..cb137fc --- /dev/null +++ b/dist/assets/previewCIMSymbol-mCxoLtDl.js @@ -0,0 +1 @@ +import{a2 as w,gM as b,gW as O,gL as v,gR as R}from"./index-pCX-0tJH.js";import{l as j,n as d}from"./cimAnalyzer-X6MTpVAO.js";import{CIMSymbolRasterizer as G}from"./CIMSymbolRasterizer-uvvL-Oh3.js";import"./labelPoint-1MOq4I_J.js";import"./TileClipper-NSFZXMR1.js";import"./definitions-SVBNHUSH.js";import"./number-sTjsTbdA.js";import"./BidiEngine-8z8MVveq.js";import"./rasterizingUtils-_-kX1RtA.js";const h=new G(null,!0),u=w(b.size),S=w(b.maxSize),C=w(b.lineWidth),V=1;async function $(i,e,r){const l=e==null?void 0:e.size;let t=l!=null&&typeof l=="object"&&"width"in l?l.width:l,n=l!=null&&typeof l=="object"&&"height"in l?l.height:l;if(t==null||n==null)if(r==="esriGeometryPolygon")t=u,n=u;else{const a=await q(i,e,r);a&&(t=a.width,n=a.height),r==="esriGeometryPolyline"&&(t=C),t=t!=null&&isFinite(t)?Math.min(t,S):u,n=n!=null&&isFinite(n)?Math.max(Math.min(n,S),V):u}return e.style==="legend"&&r==="esriGeometryPolyline"&&(t=C),{width:t,height:n}}async function q(i,e,r){const{feature:l,fieldMap:t,viewParams:n}=e.cimOptions||e,a=await j.resolveSymbolOverrides(i.data,l,null,t,r,null,n);if(!a)return null;(i=i.clone()).data={type:"CIMSymbolReference",symbol:a},i.data.primitiveOverrides=void 0;const o=[];return d.fetchResources(a,h.resourceManager,o),d.fetchFonts(a,h.resourceManager,o),o.length>0&&await Promise.all(o),d.getEnvelope(a,null,h.resourceManager)}async function J(i,e={}){var M;const{node:r,opacity:l,symbolConfig:t}=e,n=t!=null&&typeof t=="object"&&"isSquareFill"in t&&t.isSquareFill,a=e.cimOptions||e,o=a.geometryType||O((M=i==null?void 0:i.data)==null?void 0:M.symbol),y=await $(i,e,o),{feature:L,fieldMap:P}=a,I=n||o!=="esriGeometryPolygon"?"preview":"legend",f=await h.rasterizeCIMSymbolAsync(i,L,y,I,P,o,null,a.viewParams,a.allowScalingUp);if(!f)return null;const{width:x,height:z}=f,c=document.createElement("canvas");c.width=x,c.height=z,c.getContext("2d").putImageData(f,0,0);const p=v(y.width),g=v(y.height),s=new Image(p,g);s.src=c.toDataURL(),s.ariaLabel=e.ariaLabel??null,s.alt=e.ariaLabel??"",l!=null&&(s.style.opacity=`${l}`);let m=s;if(e.effectView!=null){const F={shape:{type:"image",x:0,y:0,width:p,height:g,src:s.src},fill:null,stroke:null,offset:[0,0]};m=R([[F]],[p,g],{effectView:e.effectView,ariaLabel:e.ariaLabel})}return r&&m&&r.appendChild(m),m}export{J as previewCIMSymbol}; diff --git a/dist/assets/previewSymbol2D-GOMXlSDG.js b/dist/assets/previewSymbol2D-GOMXlSDG.js new file mode 100644 index 0000000..fc7ac1f --- /dev/null +++ b/dist/assets/previewSymbol2D-GOMXlSDG.js @@ -0,0 +1 @@ +import{gM as z,gL as w,gN as P,gO as Z,gP as V,r as W,gQ as j,gR as B,W as E,gS as T,gT as H,gU as U,gV as x,a2 as N}from"./index-pCX-0tJH.js";const q="picture-fill",Q="picture-marker",G="simple-fill",I="simple-line",J="simple-marker",K="text",X="Aa",Y=z.size,L=z.maxSize,_=z.maxOutlineSize,$=z.lineWidth,D=225,ee=document.createElement("canvas");function A(a,e){const n=ee.getContext("2d"),l=[];return e&&(e.weight&&l.push(e.weight),e.size&&l.push(e.size+"px"),e.family&&l.push(e.family)),n.font=l.join(" "),n.measureText(a).width}const ae=7.2/2.54,le=72/2.54;function ne(a){if(a.length===0)return 0;if(a.length>2){const e=N(1),n=parseFloat(a);switch(a.slice(-2)){case"px":return n;case"pt":return n*e;case"in":return 72*n*e;case"pc":return 12*n*e;case"mm":return n*ae*e;case"cm":return n*le*e}}return parseFloat(a)}function k(a){const e=a==null?void 0:a.size;return{width:e!=null&&typeof e=="object"&&"width"in e?w(e.width):null,height:e!=null&&typeof e=="object"&&"height"in e?w(e.height):null}}async function ie(a,e){const n=e.fill,l=a.color;if((n==null?void 0:n.type)==="pattern"&&l&&a.type!==q){const c=await H(n.src,l.toCss(!0));n.src=c,e.fill=n}}async function se(a,e,n,l){var p,t,r;if(!("font"in a)||!a.font||e.shape.type!=="text")return;try{await U(a.font)}catch{}const{width:c}=k(l),u=/[\uE600-\uE6FF]/.test(e.shape.text);c!=null||u||(n[0]=A(e.shape.text,{weight:(p=e.font)==null?void 0:p.weight,size:(t=e.font)==null?void 0:t.size,family:(r=e.font)==null?void 0:r.family}))}function oe(a,e,n,l,c){var u;if(a.haloColor!=null&&a.haloSize!=null){c.masking??(c.masking=n.map(()=>[]));const p=w(a.haloSize);l[0]+=p,l[1]+=p,n.unshift([{...e,fill:null,stroke:{color:a.haloColor,width:2*p,join:"round",cap:"round"}}]),c.masking.unshift([{shape:{type:"rect",x:0,y:0,width:l[0]+2*x,height:l[1]+2*x},fill:[255,255,255],stroke:null},{...e,fill:[0,0,0,0],stroke:null}])}a.backgroundColor==null&&a.borderLineColor==null||(l[0]+=2*x,l[1]+=2*x,n.unshift([{shape:{type:"rect",x:0,y:0,width:l[0],height:l[1]},fill:a.backgroundColor,stroke:{color:a.borderLineColor,width:w(a.borderLineSize)}}]),(u=c.masking)==null||u.unshift([]))}function O(a,e){return a>e?"dark":"light"}function te(a,e){var M,S;const n=typeof(e==null?void 0:e.size)=="number"?e==null?void 0:e.size:null,l=n!=null?w(n):null,c=(e==null?void 0:e.maxSize)!=null?w(e.maxSize):null,u=(e==null?void 0:e.rotation)!=null?e.rotation:"angle"in a?a.angle:null,p=P(a);let t=Z(a);ce(a,245)!=="dark"||e!=null&&e.ignoreWhiteSymbols||(t={width:.75,...t,color:"#bdc3c7"});const r={shape:null,fill:p,stroke:t,offset:[0,0]};t!=null&&t.width&&(t.width=Math.min(t.width,_));const d=(t==null?void 0:t.width)||0;let y=(e==null?void 0:e.size)!=null&&((e==null?void 0:e.scale)==null||(e==null?void 0:e.scale)),i=0,s=0,b=!1;switch(a.type){case J:{const h=a.style,{width:m,height:o}=k(e),v=m===o&&m!=null?m:l??Math.min(w(a.size),c||L);switch(i=v,s=v,h){case"circle":r.shape={type:"circle",cx:0,cy:0,r:.5*v},y||(i+=d,s+=d);break;case"cross":r.shape={type:"path",path:[{command:"M",values:[0,.5*s]},{command:"L",values:[i,.5*s]},{command:"M",values:[.5*i,0]},{command:"L",values:[.5*i,s]}]};break;case"diamond":r.shape={type:"path",path:[{command:"M",values:[0,.5*s]},{command:"L",values:[.5*i,0]},{command:"L",values:[i,.5*s]},{command:"L",values:[.5*i,s]},{command:"Z",values:[]}]},y||(i+=d,s+=d);break;case"square":r.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[i,0]},{command:"L",values:[i,s]},{command:"L",values:[0,s]},{command:"Z",values:[]}]},y||(i+=d,s+=d),u&&(b=!0);break;case"triangle":r.shape={type:"path",path:[{command:"M",values:[.5*i,0]},{command:"L",values:[i,s]},{command:"L",values:[0,s]},{command:"Z",values:[]}]},y||(i+=d,s+=d),u&&(b=!0);break;case"x":r.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[i,s]},{command:"M",values:[i,0]},{command:"L",values:[0,s]}]},u&&(b=!0);break;case"path":r.shape={type:"path",path:a.path||""},y||(i+=d,s+=d),u&&(b=!0),y=!0}break}case I:{const{width:h,height:m}=k(e),o=m??l??d,v=h??$;t&&(t.width=o),i=v,s=o;const g=((M=r==null?void 0:r.stroke)==null?void 0:M.cap)||"butt",f=g==="round";y=!0,r.stroke&&(r.stroke.cap=g==="butt"?"square":g),r.shape={type:"path",path:[{command:"M",values:[f?o/2:0,s/2]},{command:"L",values:[f?i-o/2:i,s/2]}]};break}case q:case G:{const h=typeof(e==null?void 0:e.symbolConfig)=="object"&&!!((S=e==null?void 0:e.symbolConfig)!=null&&S.isSquareFill),{width:m,height:o}=k(e);i=!h&&m!==o||m==null?l??Y:m,s=!h&&m!==o||o==null?i:o,y||(i+=d,s+=d),y=!0,r.shape=h?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[i,0]},{command:"L",values:[i,s]},{command:"L",values:[0,s]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:V.fill[0];break}case Q:{const h=Math.min(w(a.width),c||L),m=Math.min(w(a.height),c||L),{width:o,height:v}=k(e),g=o===v&&o!=null?o:l??Math.max(h,m),f=h/m;i=f<=1?Math.ceil(g*f):g,s=f<=1?g:Math.ceil(g/f),r.shape={type:"image",x:-Math.round(i/2),y:-Math.round(s/2),width:i,height:s,src:a.url||""},u&&(b=!0);break}case K:{const h=a,m=(e==null?void 0:e.overrideText)||h.text||X,o=h.font,{width:v,height:g}=k(e),f=g??l??Math.min(w(o.size),c||L),R=A(m,{weight:o.weight,size:f,family:o.family}),C=/[\uE600-\uE6FF]/.test(m);i=v??(C?f:R),s=f;let F=.25*ne((o?f:0).toString());C&&(F+=5),r.shape={type:"text",text:m,x:h.xoffset||0,y:h.yoffset||F,align:"middle",alignBaseline:h.verticalAlignment,decoration:o&&o.decoration,rotated:h.rotated,kerning:h.kerning},r.font=o&&{size:f,style:o.style,decoration:o.decoration,weight:o.weight,family:o.family};break}}return{shapeDescriptor:r,size:[i,s],renderOptions:{node:e==null?void 0:e.node,scale:y,opacity:e==null?void 0:e.opacity,rotation:u,useRotationSize:b,effectView:e==null?void 0:e.effectView,ariaLabel:e==null?void 0:e.ariaLabel}}}async function ue(a,e){var p;const{shapeDescriptor:n,size:l,renderOptions:c}=te(a,e);if(!n.shape)throw new W("symbolPreview: renderPreviewHTML2D","symbol not supported.");await ie(a,n),await se(a,n,l,e);const u=[[n]];if(typeof(e==null?void 0:e.symbolConfig)=="object"&&((p=e==null?void 0:e.symbolConfig)!=null&&p.applyColorModulation)){const t=.6*l[0];u.unshift([{...n,offset:[-t,0],fill:j(n.fill,-.3)}]),u.push([{...n,offset:[t,0],fill:j(n.fill,.3)}]),l[0]+=2*t,c.scale=!1}return a.type==="text"&&oe(a,n,u,l,c),B(u,l,c)}function ce(a,e=D){const n=P(a),l=Z(a),c=!n||"type"in n?null:new E(n),u=l!=null&&l.color?new E(l==null?void 0:l.color):null,p=c?O(T(c),e):null,t=u?O(T(u),e):null;return t?p?p===t?p:e>=D?"light":"dark":t:p}export{ce as getContrastingBackgroundTheme,te as getRenderSymbolParameters,ue as previewSymbol2D}; diff --git a/dist/assets/previewSymbol2D-V05bql6S.js b/dist/assets/previewSymbol2D-V05bql6S.js deleted file mode 100644 index 9f060be..0000000 --- a/dist/assets/previewSymbol2D-V05bql6S.js +++ /dev/null @@ -1 +0,0 @@ -import{gP as L,gO as w,gQ as P,gR as Z,gS as V,E as W,gT as j,gU as B,ab as E,gV as T,gW as H,gX as U,gY as x,a4 as Q}from"./index-J0iiHjMT.js";const q="picture-fill",X="picture-marker",Y="simple-fill",G="simple-line",I="simple-marker",J="text",K="Aa",N=L.size,z=L.maxSize,_=L.maxOutlineSize,$=L.lineWidth,D=225,ee=document.createElement("canvas");function A(a,e){const n=ee.getContext("2d"),l=[];return e&&(e.weight&&l.push(e.weight),e.size&&l.push(e.size+"px"),e.family&&l.push(e.family)),n.font=l.join(" "),n.measureText(a).width}const ae=7.2/2.54,le=72/2.54;function ne(a){if(a.length===0)return 0;if(a.length>2){const e=Q(1),n=parseFloat(a);switch(a.slice(-2)){case"px":return n;case"pt":return n*e;case"in":return 72*n*e;case"pc":return 12*n*e;case"mm":return n*ae*e;case"cm":return n*le*e}}return parseFloat(a)}function k(a){const e=a==null?void 0:a.size;return{width:e!=null&&typeof e=="object"&&"width"in e?w(e.width):null,height:e!=null&&typeof e=="object"&&"height"in e?w(e.height):null}}async function ie(a,e){const n=e.fill,l=a.color;if((n==null?void 0:n.type)==="pattern"&&l&&a.type!==q){const c=await H(n.src,l.toCss(!0));n.src=c,e.fill=n}}async function se(a,e,n,l){var p,t,r;if(!("font"in a)||!a.font||e.shape.type!=="text")return;try{await U(a.font)}catch{}const{width:c}=k(l),u=/[\uE600-\uE6FF]/.test(e.shape.text);c!=null||u||(n[0]=A(e.shape.text,{weight:(p=e.font)==null?void 0:p.weight,size:(t=e.font)==null?void 0:t.size,family:(r=e.font)==null?void 0:r.family}))}function oe(a,e,n,l,c){var u;if(a.haloColor!=null&&a.haloSize!=null){c.masking??(c.masking=n.map(()=>[]));const p=w(a.haloSize);l[0]+=p,l[1]+=p,n.unshift([{...e,fill:null,stroke:{color:a.haloColor,width:2*p,join:"round",cap:"round"}}]),c.masking.unshift([{shape:{type:"rect",x:0,y:0,width:l[0]+2*x,height:l[1]+2*x},fill:[255,255,255],stroke:null},{...e,fill:[0,0,0,0],stroke:null}])}a.backgroundColor==null&&a.borderLineColor==null||(l[0]+=2*x,l[1]+=2*x,n.unshift([{shape:{type:"rect",x:0,y:0,width:l[0],height:l[1]},fill:a.backgroundColor,stroke:{color:a.borderLineColor,width:w(a.borderLineSize)}}]),(u=c.masking)==null||u.unshift([]))}function O(a,e){return a>e?"dark":"light"}function te(a,e){var M,S;const n=typeof(e==null?void 0:e.size)=="number"?e==null?void 0:e.size:null,l=n!=null?w(n):null,c=(e==null?void 0:e.maxSize)!=null?w(e.maxSize):null,u=(e==null?void 0:e.rotation)!=null?e.rotation:"angle"in a?a.angle:null,p=P(a);let t=Z(a);ce(a,245)!=="dark"||e!=null&&e.ignoreWhiteSymbols||(t={width:.75,...t,color:"#bdc3c7"});const r={shape:null,fill:p,stroke:t,offset:[0,0]};t!=null&&t.width&&(t.width=Math.min(t.width,_));const d=(t==null?void 0:t.width)||0;let y=(e==null?void 0:e.size)!=null&&((e==null?void 0:e.scale)==null||(e==null?void 0:e.scale)),i=0,s=0,v=!1;switch(a.type){case I:{const h=a.style,{width:m,height:o}=k(e),b=m===o&&m!=null?m:l??Math.min(w(a.size),c||z);switch(i=b,s=b,h){case"circle":r.shape={type:"circle",cx:0,cy:0,r:.5*b},y||(i+=d,s+=d);break;case"cross":r.shape={type:"path",path:[{command:"M",values:[0,.5*s]},{command:"L",values:[i,.5*s]},{command:"M",values:[.5*i,0]},{command:"L",values:[.5*i,s]}]};break;case"diamond":r.shape={type:"path",path:[{command:"M",values:[0,.5*s]},{command:"L",values:[.5*i,0]},{command:"L",values:[i,.5*s]},{command:"L",values:[.5*i,s]},{command:"Z",values:[]}]},y||(i+=d,s+=d);break;case"square":r.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[i,0]},{command:"L",values:[i,s]},{command:"L",values:[0,s]},{command:"Z",values:[]}]},y||(i+=d,s+=d),u&&(v=!0);break;case"triangle":r.shape={type:"path",path:[{command:"M",values:[.5*i,0]},{command:"L",values:[i,s]},{command:"L",values:[0,s]},{command:"Z",values:[]}]},y||(i+=d,s+=d),u&&(v=!0);break;case"x":r.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[i,s]},{command:"M",values:[i,0]},{command:"L",values:[0,s]}]},u&&(v=!0);break;case"path":r.shape={type:"path",path:a.path||""},y||(i+=d,s+=d),u&&(v=!0),y=!0}break}case G:{const{width:h,height:m}=k(e),o=m??l??d,b=h??$;t&&(t.width=o),i=b,s=o;const g=((M=r==null?void 0:r.stroke)==null?void 0:M.cap)||"butt",f=g==="round";y=!0,r.stroke&&(r.stroke.cap=g==="butt"?"square":g),r.shape={type:"path",path:[{command:"M",values:[f?o/2:0,s/2]},{command:"L",values:[f?i-o/2:i,s/2]}]};break}case q:case Y:{const h=typeof(e==null?void 0:e.symbolConfig)=="object"&&!!((S=e==null?void 0:e.symbolConfig)!=null&&S.isSquareFill),{width:m,height:o}=k(e);i=!h&&m!==o||m==null?l??N:m,s=!h&&m!==o||o==null?i:o,y||(i+=d,s+=d),y=!0,r.shape=h?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[i,0]},{command:"L",values:[i,s]},{command:"L",values:[0,s]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:V.fill[0];break}case X:{const h=Math.min(w(a.width),c||z),m=Math.min(w(a.height),c||z),{width:o,height:b}=k(e),g=o===b&&o!=null?o:l??Math.max(h,m),f=h/m;i=f<=1?Math.ceil(g*f):g,s=f<=1?g:Math.ceil(g/f),r.shape={type:"image",x:-Math.round(i/2),y:-Math.round(s/2),width:i,height:s,src:a.url||""},u&&(v=!0);break}case J:{const h=a,m=(e==null?void 0:e.overrideText)||h.text||K,o=h.font,{width:b,height:g}=k(e),f=g??l??Math.min(w(o.size),c||z),R=A(m,{weight:o.weight,size:f,family:o.family}),C=/[\uE600-\uE6FF]/.test(m);i=b??(C?f:R),s=f;let F=.25*ne((o?f:0).toString());C&&(F+=5),r.shape={type:"text",text:m,x:h.xoffset||0,y:h.yoffset||F,align:"middle",alignBaseline:h.verticalAlignment,decoration:o&&o.decoration,rotated:h.rotated,kerning:h.kerning},r.font=o&&{size:f,style:o.style,decoration:o.decoration,weight:o.weight,family:o.family};break}}return{shapeDescriptor:r,size:[i,s],renderOptions:{node:e==null?void 0:e.node,scale:y,opacity:e==null?void 0:e.opacity,rotation:u,useRotationSize:v,effectView:e==null?void 0:e.effectView,ariaLabel:e==null?void 0:e.ariaLabel}}}async function ue(a,e){var p;const{shapeDescriptor:n,size:l,renderOptions:c}=te(a,e);if(!n.shape)throw new W("symbolPreview: renderPreviewHTML2D","symbol not supported.");await ie(a,n),await se(a,n,l,e);const u=[[n]];if(typeof(e==null?void 0:e.symbolConfig)=="object"&&((p=e==null?void 0:e.symbolConfig)!=null&&p.applyColorModulation)){const t=.6*l[0];u.unshift([{...n,offset:[-t,0],fill:j(n.fill,-.3)}]),u.push([{...n,offset:[t,0],fill:j(n.fill,.3)}]),l[0]+=2*t,c.scale=!1}return a.type==="text"&&oe(a,n,u,l,c),B(u,l,c)}function ce(a,e=D){const n=P(a),l=Z(a),c=!n||"type"in n?null:new E(n),u=l!=null&&l.color?new E(l==null?void 0:l.color):null,p=c?O(T(c),e):null,t=u?O(T(u),e):null;return t?p?p===t?p:e>=D?"light":"dark":t:p}export{ce as getContrastingBackgroundTheme,te as getRenderSymbolParameters,ue as previewSymbol2D}; diff --git a/dist/assets/previewWebStyleSymbol--GeGTS2s.js b/dist/assets/previewWebStyleSymbol--GeGTS2s.js deleted file mode 100644 index 8311002..0000000 --- a/dist/assets/previewWebStyleSymbol--GeGTS2s.js +++ /dev/null @@ -1 +0,0 @@ -import{bW as m,gN as u,gO as r,gP as d}from"./index-J0iiHjMT.js";function p(e,i,t){const a=e.thumbnail&&e.thumbnail.url;return a?m(a,{responseType:"image"}).then(s=>{const h=n(s.data,t);return t!=null&&t.node?(t.node.appendChild(h),t.node):h}):u(e).then(s=>s?i(s,t):null)}function n(e,i){const t=!/\\.svg$/i.test(e.src)&&i&&i.disableUpsampling,a=Math.max(e.width,e.height);let s=(i==null?void 0:i.maxSize)!=null?r(i.maxSize):d.maxSize;t&&(s=Math.min(a,s));const h=typeof(i==null?void 0:i.size)=="number"?i==null?void 0:i.size:null,l=Math.min(s,h!=null?r(h):a);if(l!==a){const o=e.width!==0&&e.height!==0?e.width/e.height:1;o>=1?(e.width=l,e.height=l/o):(e.width=l*o,e.height=l)}return e}export{p as previewWebStyleSymbol}; diff --git a/dist/assets/previewWebStyleSymbol-UL5fXUcj.js b/dist/assets/previewWebStyleSymbol-UL5fXUcj.js new file mode 100644 index 0000000..78b02a1 --- /dev/null +++ b/dist/assets/previewWebStyleSymbol-UL5fXUcj.js @@ -0,0 +1 @@ +import{av as m,gK as u,gL as r,gM as d}from"./index-pCX-0tJH.js";function p(e,i,t){const s=e.thumbnail&&e.thumbnail.url;return s?m(s,{responseType:"image"}).then(a=>{const h=n(a.data,t);return t!=null&&t.node?(t.node.appendChild(h),t.node):h}):u(e).then(a=>a?i(a,t):null)}function n(e,i){const t=!/\\.svg$/i.test(e.src)&&i&&i.disableUpsampling,s=Math.max(e.width,e.height);let a=(i==null?void 0:i.maxSize)!=null?r(i.maxSize):d.maxSize;t&&(a=Math.min(s,a));const h=typeof(i==null?void 0:i.size)=="number"?i==null?void 0:i.size:null,l=Math.min(a,h!=null?r(h):s);if(l!==s){const o=e.width!==0&&e.height!==0?e.width/e.height:1;o>=1?(e.width=l,e.height=l/o):(e.width=l*o,e.height=l)}return e}export{p as previewWebStyleSymbol}; diff --git a/dist/assets/progress-puB9lhY4.js b/dist/assets/progress-TBzcAK5D.js similarity index 96% rename from dist/assets/progress-puB9lhY4.js rename to dist/assets/progress-TBzcAK5D.js index 0ce7917..adc43dd 100644 --- a/dist/assets/progress-puB9lhY4.js +++ b/dist/assets/progress-TBzcAK5D.js @@ -1,4 +1,4 @@ -import{q as a,H as n,ch as s,t,dd as o}from"./index-J0iiHjMT.js";/*! +import{p as a,H as n,aS as s,k as t,dd as o}from"./index-pCX-0tJH.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/projectExtentUtils-TwA6ooHn.js b/dist/assets/projectExtentUtils-Q4rXasWA.js similarity index 84% rename from dist/assets/projectExtentUtils-TwA6ooHn.js rename to dist/assets/projectExtentUtils-Q4rXasWA.js index b0e73ca..f617e46 100644 --- a/dist/assets/projectExtentUtils-TwA6ooHn.js +++ b/dist/assets/projectExtentUtils-Q4rXasWA.js @@ -1 +1 @@ -import{cX as s,cY as a}from"./index-J0iiHjMT.js";function u(l){const r=l.view.spatialReference,e=l.layer.fullExtent,n=e!=null&&e.spatialReference;if(e==null||!n)return Promise.resolve(null);if(n.equals(r))return Promise.resolve(e.clone());const t=s(e,r);return t!=null?Promise.resolve(t):l.view.state.isLocal?a(e,r,l.layer.portalItem).then(o=>!l.destroyed&&o?o:null).catch(()=>null):Promise.resolve(null)}export{u as l}; +import{cO as s,cP as a}from"./index-pCX-0tJH.js";function u(l){const r=l.view.spatialReference,e=l.layer.fullExtent,n=e!=null&&e.spatialReference;if(e==null||!n)return Promise.resolve(null);if(n.equals(r))return Promise.resolve(e.clone());const t=s(e,r);return t!=null?Promise.resolve(t):l.view.state.isLocal?a(e,r,l.layer.portalItem).then(o=>!l.destroyed&&o?o:null).catch(()=>null):Promise.resolve(null)}export{u as l}; diff --git a/dist/assets/quantityFormatUtils-NiAiojad.js b/dist/assets/quantityFormatUtils-NiAiojad.js deleted file mode 100644 index 94a60a9..0000000 --- a/dist/assets/quantityFormatUtils-NiAiojad.js +++ /dev/null @@ -1 +0,0 @@ -import{cw as b,cx as s,cy as f,cz as c,cA as o,cB as l,cC as v,cD as m,cE as $,cF as p,cG as w,cH as d,cI as h,cJ as y,cK as x}from"./index-J0iiHjMT.js";function a(r,u,t,n=2,e="abbr"){return f(r,c(u,t).value,t,n,e)}function i(r,u,t,n=2,e="abbr"){return o(r,c(u,t).value,t,n,e)}function D(r,u,t=2,n="abbr"){return l(r,u.value,u.unit,t,n)}function F(r,u,t=2,n="abbr"){return v(r,u.value,u.unit,t,n)}function T(r,u,t=2,n="abbr"){return m(r,u.value,u.unit,t,n)}function g(r,u,t=2,n="abbr"){return $(r,u.value,u.unit,t,n)}function j(r,u,t=2,n="abbr"){return p(r,u.value,u.unit,t,n)}function B(r,u,t=2,n="abbr"){return w(r,u.value,u.unit,t,n)}function I(r,u,t=2,n="abbr"){return d(r,u.value,u.unit,t,n)}function M(r,u,t=2,n="abbr"){return h(r,u.value,u.unit,t,n)}function U(r,u,t=2,n="abbr"){return y(r,u.value,u.unit,t,n)}function k(r,u,t=2,n="abbr"){return x(r,u.value,u.unit,t,n)}function z(r,u,t){return b(r.value,r.unit,r.rotationType,u,t)}function A(r,u,t){return s(r.value,r.unit,r.rotationType,u,t)}function C(r,u,t,n,e="abbr"){switch(n=n??2,t){case"imperial":return B(r,u,n,e);case"metric":return D(r,u,n,e);default:return a(r,u,t,n,e)}}function E(r,u,t,n=2,e="abbr"){switch(t){case"imperial":return I(r,u,n,e);case"metric":return F(r,u,n,e);default:return i(r,u,t,n,e)}}function G(r,u,t,n=2,e="abbr"){switch(t){case"imperial":return M(r,u,n,e);case"metric":return T(r,u,n,e);default:return a(r,u,t,n,e)}}function H(r,u,t,n=2,e="abbr"){switch(t){case"imperial":return U(r,u,n,e);case"metric":return g(r,u,n,e);default:return i(r,u,t,n,e)}}function J(r,u,t,n=2,e="abbr"){switch(t){case"imperial":return k(r,u,n,e);case"metric":return j(r,u,n,e);default:return a(r,u,t,n,e)}}export{G as F,D as L,B as R,H as S,z as T,A as U,T as d,a as h,J as k,C as q,E as x,M as y}; diff --git a/dist/assets/quantityFormatUtils-oYgdvR_2.js b/dist/assets/quantityFormatUtils-oYgdvR_2.js new file mode 100644 index 0000000..fb74944 --- /dev/null +++ b/dist/assets/quantityFormatUtils-oYgdvR_2.js @@ -0,0 +1 @@ +import{cm as b,cn as s,co as o,cp as c,cq as f,cr as l,cs as v,ct as m,cu as $,cv as p,cw as w,cx as d,cy as h,cz as y,cA as x}from"./index-pCX-0tJH.js";function a(r,u,t,n=2,e="abbr"){return o(r,c(u,t).value,t,n,e)}function i(r,u,t,n=2,e="abbr"){return f(r,c(u,t).value,t,n,e)}function T(r,u,t=2,n="abbr"){return l(r,u.value,u.unit,t,n)}function g(r,u,t=2,n="abbr"){return v(r,u.value,u.unit,t,n)}function j(r,u,t=2,n="abbr"){return m(r,u.value,u.unit,t,n)}function q(r,u,t=2,n="abbr"){return $(r,u.value,u.unit,t,n)}function D(r,u,t=2,n="abbr"){return p(r,u.value,u.unit,t,n)}function F(r,u,t=2,n="abbr"){return w(r,u.value,u.unit,t,n)}function M(r,u,t=2,n="abbr"){return d(r,u.value,u.unit,t,n)}function U(r,u,t=2,n="abbr"){return h(r,u.value,u.unit,t,n)}function k(r,u,t=2,n="abbr"){return y(r,u.value,u.unit,t,n)}function z(r,u,t=2,n="abbr"){return x(r,u.value,u.unit,t,n)}function B(r,u,t){return b(r.value,r.unit,r.rotationType,u,t)}function I(r,u,t){return s(r.value,r.unit,r.rotationType,u,t)}function L(r,u,t,n,e="abbr"){switch(n=n??2,t){case"imperial":return F(r,u,n,e);case"metric":return T(r,u,n,e);default:return a(r,u,t,n,e)}}function R(r,u,t,n=2,e="abbr"){switch(t){case"imperial":return M(r,u,n,e);case"metric":return g(r,u,n,e);default:return i(r,u,t,n,e)}}function S(r,u,t,n=2,e="abbr"){switch(t){case"imperial":return U(r,u,n,e);case"metric":return j(r,u,n,e);default:return a(r,u,t,n,e)}}function V(r,u,t,n=2,e="abbr"){switch(t){case"imperial":return k(r,u,n,e);case"metric":return q(r,u,n,e);default:return i(r,u,t,n,e)}}function C(r,u,t,n=2,e="abbr"){switch(t){case"imperial":return z(r,u,n,e);case"metric":return D(r,u,n,e);default:return a(r,u,t,n,e)}}export{S as F,T as L,F as R,V as S,B as T,I as U,j as d,a as h,C as k,L as q,R as x,U as y}; diff --git a/dist/assets/query-rG0aX6cE.js b/dist/assets/query-rG0aX6cE.js deleted file mode 100644 index 4806a0a..0000000 --- a/dist/assets/query-rG0aX6cE.js +++ /dev/null @@ -1 +0,0 @@ -import{bV as S,bN as x,bW as E,h6 as g,et as f,gb as O}from"./index-J0iiHjMT.js";import{t as R}from"./pbfQueryUtils-pWizwTQZ.js";import{t as b}from"./queryZScale-IaMm02_2.js";function p(r){const e={};for(const i in r){if(i==="declaredClass")continue;const t=r[i];if(t!=null&&typeof t!="function")if(Array.isArray(t)){e[i]=[];for(let n=0;no.data.attachmentGroups)}async function w(n,t,e){const{objectIds:a}=t,o=[];for(const s of a)o.push(p(n.path+"/"+s+"/attachments",e));return Promise.all(o).then(s=>a.map((c,r)=>({parentObjectId:c,attachmentInfos:s[r].data.attachmentInfos})))}export{k as executeAttachmentQuery,w as fetchAttachments,g as processAttachmentQueryResult}; diff --git a/dist/assets/queryAttachments-cBLHPfAO.js b/dist/assets/queryAttachments-cBLHPfAO.js new file mode 100644 index 0000000..30cbda5 --- /dev/null +++ b/dist/assets/queryAttachments-cBLHPfAO.js @@ -0,0 +1 @@ +import{h1 as d,h2 as f,h3 as i,h4 as l,av as m}from"./index-pCX-0tJH.js";function y(n){const t=n.toJSON();return t.attachmentTypes&&(t.attachmentTypes=t.attachmentTypes.join(",")),t.keywords&&(t.keywords=t.keywords.join(",")),t.globalIds&&(t.globalIds=t.globalIds.join(",")),t.objectIds&&(t.objectIds=t.objectIds.join(",")),t.size&&(t.size=t.size.join(",")),t}function j(n,t){const e={};for(const s of t){const{parentObjectId:a,parentGlobalId:o,attachmentInfos:r}=s;for(const c of r){const{id:u}=c,p=d(f(`${n.path}/${a}/attachments/${u}`)),h=i.fromJSON(c);h.set({url:p,parentObjectId:a,parentGlobalId:o}),e[a]?e[a].push(h):e[a]=[h]}}return e}function b(n,t,e){let s={query:l({...n.query,f:"json",...y(t)})};return e&&(s={...e,...s,query:{...e.query,...s.query}}),m(n.path+"/queryAttachments",s).then(a=>a.data.attachmentGroups)}async function q(n,t,e){const{objectIds:s}=t,a=[];for(const o of s)a.push(m(n.path+"/"+o+"/attachments",e));return Promise.all(a).then(o=>s.map((r,c)=>({parentObjectId:r,attachmentInfos:o[c].data.attachmentInfos})))}export{b as executeAttachmentQuery,q as fetchAttachments,j as processAttachmentQueryResult}; diff --git a/dist/assets/queryEngineUtils-0F1SWi13.js b/dist/assets/queryEngineUtils-bbt-XRJJ.js similarity index 60% rename from dist/assets/queryEngineUtils-0F1SWi13.js rename to dist/assets/queryEngineUtils-bbt-XRJJ.js index c44c84a..a5c428a 100644 --- a/dist/assets/queryEngineUtils-0F1SWi13.js +++ b/dist/assets/queryEngineUtils-bbt-XRJJ.js @@ -1 +1 @@ -import{gx as a,gy as d,gz as g}from"./index-J0iiHjMT.js";import{r as i}from"./VertexSnappingCandidate-sgrBHAMS.js";function r({x:t,y:e,z:n}){return g(t,e,n??0)}function u(t,e){switch(t.type){case"edge":return t.draped?new a({edgeStart:r(t.start),edgeEnd:r(t.end),targetPoint:r(t.target),objectId:t.objectId,getGroundElevation:e}):new d({edgeStart:r(t.start),edgeEnd:r(t.end),targetPoint:r(t.target),objectId:t.objectId,isDraped:!1});case"vertex":return new i({targetPoint:r(t.target),objectId:t.objectId,isDraped:!1})}}function p(t,e){return t!=null&&t.type==="3d"?(n,o)=>t.elevationProvider.getElevation(n,o,0,e,"ground"):()=>null}export{u as a,p as o}; +import{gu as a,gv as d,gw as g}from"./index-pCX-0tJH.js";import{r as i}from"./VertexSnappingCandidate-YEvkEqQJ.js";function r({x:t,y:e,z:n}){return g(t,e,n??0)}function s(t,e){switch(t.type){case"edge":return t.draped?new a({edgeStart:r(t.start),edgeEnd:r(t.end),targetPoint:r(t.target),objectId:t.objectId,getGroundElevation:e}):new d({edgeStart:r(t.start),edgeEnd:r(t.end),targetPoint:r(t.target),objectId:t.objectId,isDraped:!1});case"vertex":return new i({targetPoint:r(t.target),objectId:t.objectId,isDraped:!1})}}function p(t,e){return t!=null&&t.type==="3d"?(n,o)=>t.elevationProvider.getElevation(n,o,0,e,"ground"):()=>null}export{s as a,p as o}; diff --git a/dist/assets/queryForSymbologySnapping-I1fFQTD_.js b/dist/assets/queryForSymbologySnapping-I1fFQTD_.js deleted file mode 100644 index 8086798..0000000 --- a/dist/assets/queryForSymbologySnapping-I1fFQTD_.js +++ /dev/null @@ -1 +0,0 @@ -import{bB as O,ar as D,i9 as P,ia as E,s as z,ib as G,ic as B,id as A,bq as H,ie as J,d6 as N}from"./index-J0iiHjMT.js";async function $(a,d,l,p,o){const{elevationProvider:u,renderCoordsHelper:r}=a,{elevationInfo:g}=d,{pointsInFeatures:w,spatialReference:h}=p,y=D.fromJSON(h),I=P(g,!0),b=await E(I,y,o);z(o);const c=[],e=new Set,t=new Set;f.spatialReference=y;const s=a.elevationProvider.spatialReference??a.spatialReference;for(const{objectId:n,points:i}of w){const m=l(n);if(m==null){for(const R of i)c.push(R.z??0);e.add(n);continue}m.isDraped&&t.add(n);const q=m.graphic.geometry;S.setFromElevationInfo(G(q,g)),S.updateFeatureExpressionInfoContext(b,m.graphic,d);for(const{x:R,y:C,z:F}of i)f.x=R,f.y=C,f.z=F??0,await B(f,j,s,0,{signal:o}),A(j,u,S,r,v),c.push(v.z)}return{elevations:c,drapedObjectIds:t,failedObjectIds:e}}const S=new H,f=O(0,0,0,D.WGS84),v=new J,j=[0,0,0];async function k(a,d,l){if(a==null||d.candidates.length===0)return x;const p=a.graphics3DGraphicsByObjectID??a.graphics3DGraphics,o=[],u=[],{renderer:r}=a,g=r!=null&&"arcadeRequired"in r&&r.arcadeRequired?N():null,w=async(e,{graphic:t,graphics3DSymbol:s})=>{const n=await g,i=await a.getRenderingInfoAsync(t,r,n,{signal:l});return i==null?[]:s.queryForSnapping(e,y,i,l)},{candidates:h,spatialReference:y}=d;for(let e=0;e{const n=await g,i=await a.getRenderingInfoAsync(t,r,n,{signal:l});return i==null?[]:s.queryForSnapping(e,y,i,l)},{candidates:h,spatialReference:y}=d;for(let e=0;e{const r=t.data;if(r.hasOwnProperty("extent"))return t;if(r.features)throw new Error(m);if(r.hasOwnProperty("count"))throw new Error(m);return t})}function R(o,e,n){return e.timeExtent!=null&&e.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):d(o,e,"json",n,{returnIdsOnly:!0,returnCountOnly:!0})}function d(o,e,n,t={},r={}){const u=typeof o=="string"?p(o):o,y=e.geometry?[e.geometry]:[];return t.responseType=n==="pbf"?"array-buffer":"json",c(y,null,t).then(i=>{const s=i==null?void 0:i[0];s!=null&&((e=e.clone()).geometry=s);const l=j({...u.query,f:n,...r,...g(e,r)});return F(f(u.path,"queryTopFeatures"),{...t,query:{...l,...t.query}})})}export{R as a,I as d,h as m,S as p}; diff --git a/dist/assets/queryTopFeatures-WO1xu2NM.js b/dist/assets/queryTopFeatures-WO1xu2NM.js new file mode 100644 index 0000000..8cf09ab --- /dev/null +++ b/dist/assets/queryTopFeatures-WO1xu2NM.js @@ -0,0 +1 @@ +import{h7 as m,au as p,am as F,h4 as f,av as E,h8 as j,g8 as x,em as a}from"./index-pCX-0tJH.js";const c="Layer does not support extent calculation.";function g(o,e){var u,y;const r=o.geometry,t=o.toJSON(),n=t;if(r!=null&&(n.geometry=JSON.stringify(r),n.geometryType=x(r),n.inSR=a(r.spatialReference)),(u=t.topFilter)!=null&&u.groupByFields&&(n.topFilter.groupByFields=t.topFilter.groupByFields.join(",")),(y=t.topFilter)!=null&&y.orderByFields&&(n.topFilter.orderByFields=t.topFilter.orderByFields.join(",")),t.topFilter&&(n.topFilter=JSON.stringify(n.topFilter)),t.objectIds&&(n.objectIds=t.objectIds.join(",")),t.orderByFields&&(n.orderByFields=t.orderByFields.join(",")),t.outFields&&!(e!=null&&e.returnCountOnly||e!=null&&e.returnExtentOnly||e!=null&&e.returnIdsOnly)?t.outFields.includes("*")?n.outFields="*":n.outFields=t.outFields.join(","):delete n.outFields,t.outSR?n.outSR=a(t.outSR):r&&t.returnGeometry&&(n.outSR=n.inSR),t.returnGeometry&&delete t.returnGeometry,t.timeExtent){const l=t.timeExtent,{start:s,end:i}=l;s==null&&i==null||(n.time=s===i?s:`${s??"null"},${i??"null"}`),delete t.timeExtent}return n}async function h(o,e,r,t){const n=await d(o,e,"json",t);return m(e,r,n.data),n}async function B(o,e,r){return e.timeExtent!=null&&e.timeExtent.isEmpty?{data:{objectIds:[]}}:d(o,e,"json",r,{returnIdsOnly:!0})}async function S(o,e,r){return e.timeExtent!=null&&e.timeExtent.isEmpty?{data:{count:0,extent:null}}:d(o,e,"json",r,{returnExtentOnly:!0,returnCountOnly:!0}).then(t=>{const n=t.data;if(n.hasOwnProperty("extent"))return t;if(n.features)throw new Error(c);if(n.hasOwnProperty("count"))throw new Error(c);return t})}function I(o,e,r){return e.timeExtent!=null&&e.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):d(o,e,"json",r,{returnIdsOnly:!0,returnCountOnly:!0})}function d(o,e,r,t={},n={}){const u=typeof o=="string"?p(o):o,y=e.geometry?[e.geometry]:[];return t.responseType=r==="pbf"?"array-buffer":"json",F(y,null,t).then(l=>{const s=l==null?void 0:l[0];s!=null&&((e=e.clone()).geometry=s);const i=f({...u.query,f:r,...n,...g(e,n)});return E(j(u.path,"queryTopFeatures"),{...t,query:{...i,...t.query}})})}export{I as a,S as d,B as m,h as p}; diff --git a/dist/assets/queryZScale-IaMm02_2.js b/dist/assets/queryZScale-IaMm02_2.js deleted file mode 100644 index 4d9fc9e..0000000 --- a/dist/assets/queryZScale-IaMm02_2.js +++ /dev/null @@ -1 +0,0 @@ -import{dB as a}from"./index-J0iiHjMT.js";function u(o,f,e){if(!(e!=null&&e.features)||!e.hasZ)return;const t=a(e.geometryType,f,o.outSpatialReference);if(t!=null)for(const n of e.features)t(n.geometry)}export{u as t}; diff --git a/dist/assets/quickselect-0UUnLNDW.js b/dist/assets/quickselect-0UUnLNDW.js new file mode 100644 index 0000000..9d6c37c --- /dev/null +++ b/dist/assets/quickselect-0UUnLNDW.js @@ -0,0 +1 @@ +import{aR as b}from"./index-pCX-0tJH.js";var g,d,q,m={exports:{}};m.exports,g=m,d=function(){function s(t,r,n,o,i){p(t,r,n||0,o||t.length-1,i||R)}function p(t,r,n,o,i){for(;o>n;){if(o-n>600){var f=o-n+1,l=r-n+1,u=Math.log(f),e=.5*Math.exp(2*u/3),x=.5*Math.sqrt(u*e*(f-e)/f)*(l-f/2<0?-1:1);p(t,r,Math.max(n,Math.floor(r-l*e/f+x)),Math.min(o,Math.floor(r+(f-l)*e/f+x)),i)}var v=t[r],c=n,h=o;for(a(t,n,r),i(t[o],v)>0&&a(t,n,o);c0;)h--}i(t[n],v)===0?a(t,n,h):a(t,++h,o),h<=r&&(n=h+1),r<=h&&(o=h-1)}}function a(t,r,n){var o=t[r];t[r]=t[n],t[n]=o}function R(t,r){return tr?1:0}return s},(q=d())!==void 0&&(g.exports=q);const k=b(m.exports);export{k as f}; diff --git a/dist/assets/quickselect-UFB0jJTZ.js b/dist/assets/quickselect-UFB0jJTZ.js deleted file mode 100644 index f5e093a..0000000 --- a/dist/assets/quickselect-UFB0jJTZ.js +++ /dev/null @@ -1 +0,0 @@ -import{cg as j}from"./index-J0iiHjMT.js";var x,d,q,m={exports:{}};m.exports,x=m,d=function(){function s(t,r,n,o,i){p(t,r,n||0,o||t.length-1,i||b)}function p(t,r,n,o,i){for(;o>n;){if(o-n>600){var c=o-n+1,l=r-n+1,u=Math.log(c),v=.5*Math.exp(2*u/3),g=.5*Math.sqrt(u*v*(c-v)/c)*(l-c/2<0?-1:1);p(t,r,Math.max(n,Math.floor(r-l*v/c+g)),Math.min(o,Math.floor(r+(c-l)*v/c+g)),i)}var a=t[r],e=n,h=o;for(f(t,n,r),i(t[o],a)>0&&f(t,n,o);e0;)h--}i(t[n],a)===0?f(t,n,h):f(t,++h,o),h<=r&&(n=h+1),r<=h&&(o=h-1)}}function f(t,r,n){var o=t[r];t[r]=t[n],t[n]=o}function b(t,r){return tr?1:0}return s},(q=d())!==void 0&&(x.exports=q);const w=j(m.exports);export{w as f}; diff --git a/dist/assets/rasterProjectionHelper-KvYWHIT_.js b/dist/assets/rasterProjectionHelper-3sL58SxG.js similarity index 81% rename from dist/assets/rasterProjectionHelper-KvYWHIT_.js rename to dist/assets/rasterProjectionHelper-3sL58SxG.js index 177eb14..f9affba 100644 --- a/dist/assets/rasterProjectionHelper-KvYWHIT_.js +++ b/dist/assets/rasterProjectionHelper-3sL58SxG.js @@ -1 +1 @@ -import{d$ as U,e0 as Rn,dT as W,e1 as v,e2 as O,e3 as Pn,l as un,T as k,e4 as bn,ct as Sn,E as kn,e5 as N,e6 as E,e7 as tn,e8 as En,e9 as Nn,ar as Gn,ea as en}from"./index-J0iiHjMT.js";var D;function xn(n,e,i){return!Sn(n,e,i)}function $(n,e,i){const s=xn(n,e,i);if(s&&!U())throw new kn("rasterprojectionhelper-project","projection engine is not loaded");return s}(function(n){n[n.None=0]="None",n[n.North=1]="North",n[n.South=2]="South",n[n.Both=3]="Both"})(D||(D={}));const on=(n,e,i,s=0)=>{if(i[0]===1)return[0,0];let r=1,t=-1,o=1,c=-1;for(let u=0;un[u]?n[u]:r,t=t>n[u]?t:n[u],o=o>n[u+1]?n[u+1]:o,c=c>n[u+1]?c:n[u+1]);const{cols:f,rows:a}=e,l=(t-r)/f/i[0],d=(c-o)/a/i[1],y=2*s;let x=0,m=!1,h=[0,0];for(let u=0;ux&&(x=M+P,h=[M,P]),y&&x>y){m=!0;break}}if(m)break}return h},Tn={3395:20037508342789244e-9,3410:17334193943686873e-9,3857:20037508342788905e-9,3975:17367530445161372e-9,4087:20037508342789244e-9,4088:20015108787169147e-9,6933:17367530445161372e-9,32662:20037508342789244e-9,53001:2001508679602057e-8,53002:1000754339801029e-8,53003:2001508679602057e-8,53004:2001508679602057e-8,53016:14152803599503474e-9,53017:17333573624304302e-9,53034:2001508679602057e-8,53079:20015114352186374e-9,53080:20015114352186374e-9,54001:20037508342789244e-9,54002:10018754171394624e-9,54003:20037508342789244e-9,54004:20037508342789244e-9,54016:14168658027268292e-9,54017:1736753044516137e-8,54034:20037508342789244e-9,54079:20037508342789244e-9,54080:20037508342789244e-9,54100:20037508342789244e-9,54101:20037508342789244e-9},I=32,j=4,q=j,J=new Map,K=new Map,B=500;async function Bn(){U()||await Rn()}function Cn(n,e,i){return $(n.spatialReference,e),i?en(e,n.spatialReference,n):en(n.spatialReference,e,n)}function An(n,e,i,s=null){const r=n.spatialReference;if(r.equals(e))return n;$(r,e,s);const t=i.center,o=new W({xmin:t.x-n.x/2,xmax:t.x+n.x/2,ymin:t.y-n.y/2,ymax:t.y+n.y/2,spatialReference:r}),c=v(o,e,s),f=G(e);let a;if(c==null||f!=null&&c.width>=f){const l=O(r)/O(e);a={x:n.x*l,y:n.y*l}}else a={x:c.width,y:c.height};return a}function S(n,e=.01){return O(n)?e/O(n):0}function sn(n,e,i=null,s=!0){const r=n.spatialReference;if(r.equals(e))return n;$(r,e,i);const t=v(n,e,i);return s&&t&&mn([n],[t],r,e),t}function mn(n,e,i,s){const r=A(i,!0),t=A(s,!0),o=S(i,B),c=S(s,B);if(o&&r!=null&&t!=null)for(let f=0;f=t[1]-c&&Math.abs(l-r[0])new k(c[0],c[1],i)),o=v(t,s,r);return r&&mn(t,o,i,s),o.map(c=>c?[c.x,c.y]:[NaN,NaN])}function rn(n){const{inSR:e,outSR:i,datumTransformation:s}=n,r=_(e),{points:t,mask:o}=V(n,r);if(!e.isGeographic){const f=e.wkid?N.coordsys(e.wkid):N.fromString(e.isGeographic?E.PE_TYPE_GEOGCS:E.PE_TYPE_PROJCS,e.wkt2||e.wkt);tn.projToGeog(f,t.length,t)}if(s!=null&&s.steps.length){let f;if(i.isGeographic&&(f=t.map(([l])=>l>179.9955?1:l<-179.9955?-1:0)),s.steps.forEach(l=>{const d=l.wkid?N.geogtran(l.wkid):N.fromString(E.PE_TYPE_GEOGTRAN,l.wkt);En.geogToGeog(d,t.length,t,null,l.isInverse?E.PE_TRANSFORM_2_TO_1:E.PE_TRANSFORM_1_TO_2)}),f)for(let l=0;l179.9955?1:y<-179.9955?-1:0;d&&x&&d!==x&&(t[l][0]=d>0?y+360:y-360)}}if(!i.isGeographic){const f=_(i,!0),a=f!=null&&f.isEnvelope?[f.bbox[1],f.bbox[3]]:[-90,90];zn(t,a);const l=i.wkid?N.coordsys(i.wkid):N.fromString(i.isGeographic?E.PE_TYPE_GEOGCS:E.PE_TYPE_PROJCS,i.wkt2||i.wkt);tn.geogToProj(l,t.length,t)}let c=t;if(o&&t.length!==o.length){c=[];for(let f=0,a=0;fu.getInclusive()===1&&u.getKind()===1);if(!o){if(o=r.find(u=>u.getInclusive()===1&&u.getKind()===0),!o)return null;t=!0}const c=i?0:(s.getNorthPoleLocation()===2?1:0)|(s.getSouthPoleLocation()===2?2:0),f=s.isPannableRectangle(),a=o.getCoord();if(t)return{isEnvelope:t,isPannable:f,vertices:a,coef:null,bbox:[a[0][0]-e,a[0][1]-e,a[1][0]+e,a[1][1]+e],poleLocation:c};let l=0;const d=[];let[y,x]=a[0],[m,h]=a[0];for(let u=0,R=a.length;ug?m:g,h=h>p?h:p}return{isEnvelope:!1,isPannable:f,vertices:a,coef:d,bbox:[y,x,m,h],poleLocation:c}}function V(n,e){const i=[],{cols:s,rows:r,xres:t,yres:o,usePixelCenter:c}=n;let{xmin:f,ymax:a}=n;if(c&&(f+=t/2,a-=o/2),e==null){for(let x=0;x=x&&p<=h;for(let M=0;M=m&&P<=u&&(i.push([p,P]),l[g]=1)}}return{points:i,mask:l}}const d=e.coef,y=[];for(let x=0;x=M&&m<=P){const L=p*m+w;h.push(L),u.push(T)}}let R=h;if(h.length>2){let g=u[0]===2?0:u[0],p=h[0];R=[];for(let w=1;ww-M)}else h[0]>h[1]&&(R=[h[1],h[0]]);y.push(R)}for(let x=0,m=0;x=g[0]&&h<=g[1]&&(i.push([h,R]),l[m]=1);else if(g.length>2){let p=!1;for(let w=0;w=g[w]&&h<=g[w+1]){p=!0;break}p&&(i.push([h,R]),l[m]=1)}}}return{points:i,mask:l}}function zn(n,e){const[i,s]=e;for(let r=0;rs)&&(n[r]=[NaN,NaN])}}function hn(n,e){const i=G(n[0].spatialReference);if(n.length<2||i==null||(e=e??S(n[0].spatialReference),(n=n.filter(c=>c.width>e)).length===1))return n[0];let{xmin:s,xmax:r,ymin:t,ymax:o}=n[0];for(let c=1;cS(r)){const{xmin:a,xmax:l}=n;for(let d=0;d<=t;d++){const y=d===0?a:-o/2,x=d===t?l-o*d:o/2;f[d]=new W({xmin:y,xmax:x,ymin:n.ymin,ymax:n.ymax,spatialReference:r})}}return hn(f.map(a=>ln(a,e,i,s)).filter(Pn))}function Fn(n,e,i){if(n.type==="extent"){const{xmin:s,ymin:r,xmax:t,ymax:o,spatialReference:c}=n;n=new un({rings:[[[s,o],[t,o],[t,r],[s,r],[s,o]]],spatialReference:c})}return n.spatialReference.equals(e)?n:($(n.spatialReference,e,i),v(n,e,i))}function On(n,e){const i=G(e);if(i==null)return null;let{xmin:s,ymin:r,xmax:t,ymax:o}=n;const c=n.spatialReference,f=new un({spatialReference:c,rings:[[[s,r],[t,r],[t,o],[s,o],[s,r]]]}),a=v(f,e);if(a.rings.length!==2||!a.rings[0].length||!a.rings[1].length)return null;const{rings:l}=a,d=S(c),y=new W({spatialReference:e});for(let x=0;x<2;x++){s=t=l[x][0][0],r=o=l[x][0][1];for(let m=0;ml[x][m][0]?l[x][m][0]:s,t=tl[x][m][1]?l[x][m][1]:r,o=o=o.ymax))return null;if(!s||!o)return o;const c=A(t,!0),f=A(e,!0);if(c==null||f==null)return o;const a=S(t,.001),l=S(t,B),d=S(e,.001);if(Math.abs(o.xmin-f[0])l){o.xmin=f[0];const m=[];m.push(new k(n.xmax,n.ymin,t)),m.push(new k(n.xmax,(n.ymin+n.ymax)/2,t)),m.push(new k(n.xmax,n.ymax,t));const h=m.map(u=>sn(u,e,i)).filter(u=>!isNaN(u==null?void 0:u.x)).map(u=>u.x);o.xmax=Math.max.apply(null,h)}if(xl){o.xmax=f[1];const m=[];m.push(new k(n.xmin,n.ymin,t)),m.push(new k(n.xmin,(n.ymin+n.ymax)/2,t)),m.push(new k(n.xmin,n.ymax,t));const h=m.map(u=>sn(u,e,i)).filter(u=>!isNaN(u==null?void 0:u.x)).map(u=>u.x);o.xmin=Math.min.apply(null,h)}}else{const y=S(e,.001);Math.abs(o.xmin-f[0])0&&s.outofBoundPointCountq)&&(xn(f,a,n.datumTransformation)&&(f.isGeographic||_(f)),i=[j,j],s=X({...n,spacing:i}),r={cols:s.size[0]+1,rows:s.size[1]+1},o=on(s.offsets,r,i,q)),s.error=o,i[0]>1&&(s.coefficients=fn(s.offsets,r,t)),n.includeGCSGrid&&!f.isGeographic&&!f.isWebMercator)if(a.isGeographic)s.gcsGrid={offsets:s.offsets,coefficients:s.coefficients,spacing:i};else{const l=_(f);if(l!=null&&!l.isEnvelope){const d=Ln(f),y=pn(n.projectedExtent,d),{offsets:x}=X({...n,srcBufferExtent:y,spacing:i}),m=fn(x,r,t);s.gcsGrid={offsets:x,coefficients:m,spacing:i}}}return s}function X(n){const{projectedExtent:e,srcBufferExtent:i,pixelSize:s,datumTransformation:r,rasterTransform:t}=n,o=e.spatialReference,c=i.spatialReference,f=$(o,c),{xmin:a,ymin:l,xmax:d,ymax:y}=e,x=G(c),m=x!=null&&(n.hasWrapAround||(t==null?void 0:t.type)==="gcs-shift"),h=n.spacing||[I,I],u=h[0]*s.x,R=h[1]*s.y,g=h[0]===1,p=Math.ceil((d-a)/u-.1/h[0])+(g?0:1),w=Math.ceil((y-l)/R-.1/h[1])+(g?0:1),M=_n({cols:p,rows:w,xmin:a,ymax:y,xres:u,yres:R,inSR:o,outSR:c,datumTransformation:r,preferPE:h[0]<=j,usePixelCenter:g}),P=[];let T,L=0;const H=g?-1:NaN,{xmin:Q,xmax:F,ymax:gn,width:yn,height:dn}=i,wn=S(c,B),Mn=x!=null&&Q>0&&F>x/2;let Z=!1;if(f){const C=_(o);Z=C!=null&&C.poleLocation>0}for(let C=0;CF&&b[0]>x/2-wn?b[0]-=x:m&&C===0&&b[0]<0&&Mn&&!t&&(b[0]+=x),!b||isNaN(b[0])||isNaN(b[1]))P.push(H),P.push(H),Y.push(null),L++;else{if(t){const nn=t.inverseTransform(new k({x:b[0],y:b[1],spatialReference:c}));b=[nn.x,nn.y]}Y.push(b),C>0&&m&&T[z]&&b[0]F&&b[0]>x&&(b[0]-=x)),P.push((b[0]-Q)/yn),P.push((gn-b[1])/dn)}}T=Y}return{offsets:P,error:null,coefficients:null,outofBoundPointCount:L,spacing:h,size:g?[p,w]:[p-1,w-1]}}function fn(n,e,i){const{cols:s,rows:r}=e,t=new Float32Array((s-1)*(r-1)*2*6),o=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),c=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let f=0;fr){const c=n.xmin-r;o=-Math.ceil(c/t)}return new W({spatialReference:n.spatialReference,xmin:n.xmin+o*t,ymin:n.ymin,xmax:n.xmax+o*t,ymax:n.ymax})}function Kn(n,e,i){var m;const{storageInfo:s,pixelSize:r}=e;let t=0,o=!1;const{pyramidResolutions:c}=s,f=((m=s.tileInfo.format)==null?void 0:m.toLowerCase())==="mixed"?Math.max(1,Math.min(3,s.tileInfo.dpi/96)):1,a=(n.x+n.y)/2/f;if(c!=null&&c.length){const h=c[c.length-1],u=(h.x+h.y)/2,R=(r.x+r.y)/2;if(a<=R)t=0;else if(a>=u)t=c.length,o=a/u>8;else{let p,w=R;for(let M=1;M<=c.length;M++){if(p=(c[M-1].x+c[M-1].y)/2,a<=p){a===p?t=M:i==="down"?(t=M-1,o=a/w>8):t=i==="up"||a-w>p-a||a/w>2?M:M-1;break}w=p}}const g=t===0?r:c[t-1];return o&&Math.min(g.x,g.y)*O(e.spatialReference)>19567&&(o=!1),{pyramidLevel:t,pyramidResolution:new k({x:g.x,y:g.y,spatialReference:e.spatialReference}),excessiveReading:o}}const l=Math.log(n.x/r.x)/Math.LN2,d=Math.log(n.y/r.y)/Math.LN2,y=e.storageInfo.maximumPyramidLevel||0;t=i==="down"?Math.floor(Math.min(l,d)):i==="up"?Math.ceil(Math.max(l,d)):Math.round((l+d)/2),t<0?t=0:t>y&&(o=t>y+3,t=y);const x=2**t;return{pyramidLevel:t,pyramidResolution:new k({x:x*e.nativePixelSize.x,y:x*e.nativePixelSize.y,spatialReference:e.spatialReference}),excessiveReading:o}}function Xn(n,e){const{pixelSize:i,extent:s}=n,r=Cn(s,e,!1);return pn(In(s,(i.x+i.y)/16),e,r)}export{An as C,G as D,pn as J,xn as M,Bn as T,Fn as U,Wn as V,Yn as Z,qn as e,sn as j,Jn as o,Kn as r,Xn as s,Cn as v}; +import{dU as V,dV as Rn,dO as W,dW as v,dX as O,dY as Pn,j as un,L as k,dZ as bn,cj as Sn,r as kn,d_ as N,d$ as E,e0 as tn,e1 as En,e2 as Nn,d2 as Gn,e3 as en}from"./index-pCX-0tJH.js";var U;function xn(n,e,i){return!Sn(n,e,i)}function $(n,e,i){const s=xn(n,e,i);if(s&&!V())throw new kn("rasterprojectionhelper-project","projection engine is not loaded");return s}(function(n){n[n.None=0]="None",n[n.North=1]="North",n[n.South=2]="South",n[n.Both=3]="Both"})(U||(U={}));const on=(n,e,i,s=0)=>{if(i[0]===1)return[0,0];let r=1,t=-1,o=1,c=-1;for(let u=0;un[u]?n[u]:r,t=t>n[u]?t:n[u],o=o>n[u+1]?n[u+1]:o,c=c>n[u+1]?c:n[u+1]);const{cols:f,rows:a}=e,l=(t-r)/f/i[0],d=(c-o)/a/i[1],y=2*s;let x=0,m=!1,h=[0,0];for(let u=0;ux&&(x=M+P,h=[M,P]),y&&x>y){m=!0;break}}if(m)break}return h},Tn={3395:20037508342789244e-9,3410:17334193943686873e-9,3857:20037508342788905e-9,3975:17367530445161372e-9,4087:20037508342789244e-9,4088:20015108787169147e-9,6933:17367530445161372e-9,32662:20037508342789244e-9,53001:2001508679602057e-8,53002:1000754339801029e-8,53003:2001508679602057e-8,53004:2001508679602057e-8,53016:14152803599503474e-9,53017:17333573624304302e-9,53034:2001508679602057e-8,53079:20015114352186374e-9,53080:20015114352186374e-9,54001:20037508342789244e-9,54002:10018754171394624e-9,54003:20037508342789244e-9,54004:20037508342789244e-9,54016:14168658027268292e-9,54017:1736753044516137e-8,54034:20037508342789244e-9,54079:20037508342789244e-9,54080:20037508342789244e-9,54100:20037508342789244e-9,54101:20037508342789244e-9},j=32,I=4,q=I,J=new Map,X=new Map,B=500;async function Bn(){V()||await Rn()}function _n(n,e,i){return $(n.spatialReference,e),i?en(e,n.spatialReference,n):en(n.spatialReference,e,n)}function An(n,e,i,s=null){const r=n.spatialReference;if(r.equals(e))return n;$(r,e,s);const t=i.center,o=new W({xmin:t.x-n.x/2,xmax:t.x+n.x/2,ymin:t.y-n.y/2,ymax:t.y+n.y/2,spatialReference:r}),c=v(o,e,s),f=G(e);let a;if(c==null||f!=null&&c.width>=f){const l=O(r)/O(e);a={x:n.x*l,y:n.y*l}}else a={x:c.width,y:c.height};return a}function S(n,e=.01){return O(n)?e/O(n):0}function sn(n,e,i=null,s=!0){const r=n.spatialReference;if(r.equals(e))return n;$(r,e,i);const t=v(n,e,i);return s&&t&&mn([n],[t],r,e),t}function mn(n,e,i,s){const r=A(i,!0),t=A(s,!0),o=S(i,B),c=S(s,B);if(o&&r!=null&&t!=null)for(let f=0;f=t[1]-c&&Math.abs(l-r[0])new k(c[0],c[1],i)),o=v(t,s,r);return r&&mn(t,o,i,s),o.map(c=>c?[c.x,c.y]:[NaN,NaN])}function rn(n){const{inSR:e,outSR:i,datumTransformation:s}=n,r=C(e),{points:t,mask:o}=D(n,r);if(!e.isGeographic){const f=e.wkid?N.coordsys(e.wkid):N.fromString(e.isGeographic?E.PE_TYPE_GEOGCS:E.PE_TYPE_PROJCS,e.wkt2||e.wkt);tn.projToGeog(f,t.length,t)}if(s!=null&&s.steps.length){let f;if(i.isGeographic&&(f=t.map(([l])=>l>179.9955?1:l<-179.9955?-1:0)),s.steps.forEach(l=>{const d=l.wkid?N.geogtran(l.wkid):N.fromString(E.PE_TYPE_GEOGTRAN,l.wkt);En.geogToGeog(d,t.length,t,null,l.isInverse?E.PE_TRANSFORM_2_TO_1:E.PE_TRANSFORM_1_TO_2)}),f)for(let l=0;l179.9955?1:y<-179.9955?-1:0;d&&x&&d!==x&&(t[l][0]=d>0?y+360:y-360)}}if(!i.isGeographic){const f=C(i,!0),a=f!=null&&f.isEnvelope?[f.bbox[1],f.bbox[3]]:[-90,90];zn(t,a);const l=i.wkid?N.coordsys(i.wkid):N.fromString(i.isGeographic?E.PE_TYPE_GEOGCS:E.PE_TYPE_PROJCS,i.wkt2||i.wkt);tn.geogToProj(l,t.length,t)}let c=t;if(o&&t.length!==o.length){c=[];for(let f=0,a=0;fu.getInclusive()===1&&u.getKind()===1);if(!o){if(o=r.find(u=>u.getInclusive()===1&&u.getKind()===0),!o)return null;t=!0}const c=i?0:(s.getNorthPoleLocation()===2?1:0)|(s.getSouthPoleLocation()===2?2:0),f=s.isPannableRectangle(),a=o.getCoord();if(t)return{isEnvelope:t,isPannable:f,vertices:a,coef:null,bbox:[a[0][0]-e,a[0][1]-e,a[1][0]+e,a[1][1]+e],poleLocation:c};let l=0;const d=[];let[y,x]=a[0],[m,h]=a[0];for(let u=0,R=a.length;ug?m:g,h=h>p?h:p}return{isEnvelope:!1,isPannable:f,vertices:a,coef:d,bbox:[y,x,m,h],poleLocation:c}}function D(n,e){const i=[],{cols:s,rows:r,xres:t,yres:o,usePixelCenter:c}=n;let{xmin:f,ymax:a}=n;if(c&&(f+=t/2,a-=o/2),e==null){for(let x=0;x=x&&p<=h;for(let M=0;M=m&&P<=u&&(i.push([p,P]),l[g]=1)}}return{points:i,mask:l}}const d=e.coef,y=[];for(let x=0;x=M&&m<=P){const L=p*m+w;h.push(L),u.push(T)}}let R=h;if(h.length>2){let g=u[0]===2?0:u[0],p=h[0];R=[];for(let w=1;ww-M)}else h[0]>h[1]&&(R=[h[1],h[0]]);y.push(R)}for(let x=0,m=0;x=g[0]&&h<=g[1]&&(i.push([h,R]),l[m]=1);else if(g.length>2){let p=!1;for(let w=0;w=g[w]&&h<=g[w+1]){p=!0;break}p&&(i.push([h,R]),l[m]=1)}}}return{points:i,mask:l}}function zn(n,e){const[i,s]=e;for(let r=0;rs)&&(n[r]=[NaN,NaN])}}function hn(n,e){const i=G(n[0].spatialReference);if(n.length<2||i==null||(e=e??S(n[0].spatialReference),(n=n.filter(c=>c.width>e)).length===1))return n[0];let{xmin:s,xmax:r,ymin:t,ymax:o}=n[0];for(let c=1;cS(r)){const{xmin:a,xmax:l}=n;for(let d=0;d<=t;d++){const y=d===0?a:-o/2,x=d===t?l-o*d:o/2;f[d]=new W({xmin:y,xmax:x,ymin:n.ymin,ymax:n.ymax,spatialReference:r})}}return hn(f.map(a=>ln(a,e,i,s)).filter(Pn))}function Yn(n,e,i){if(n.type==="extent"){const{xmin:s,ymin:r,xmax:t,ymax:o,spatialReference:c}=n;n=new un({rings:[[[s,o],[t,o],[t,r],[s,r],[s,o]]],spatialReference:c})}return n.spatialReference.equals(e)?n:($(n.spatialReference,e,i),v(n,e,i))}function On(n,e){const i=G(e);if(i==null)return null;let{xmin:s,ymin:r,xmax:t,ymax:o}=n;const c=n.spatialReference,f=new un({spatialReference:c,rings:[[[s,r],[t,r],[t,o],[s,o],[s,r]]]}),a=v(f,e);if(a.rings.length!==2||!a.rings[0].length||!a.rings[1].length)return null;const{rings:l}=a,d=S(c),y=new W({spatialReference:e});for(let x=0;x<2;x++){s=t=l[x][0][0],r=o=l[x][0][1];for(let m=0;ml[x][m][0]?l[x][m][0]:s,t=tl[x][m][1]?l[x][m][1]:r,o=o=o.ymax))return null;if(!s||!o)return o;const c=A(t,!0),f=A(e,!0);if(c==null||f==null)return o;const a=S(t,.001),l=S(t,B),d=S(e,.001);if(Math.abs(o.xmin-f[0])l){o.xmin=f[0];const m=[];m.push(new k(n.xmax,n.ymin,t)),m.push(new k(n.xmax,(n.ymin+n.ymax)/2,t)),m.push(new k(n.xmax,n.ymax,t));const h=m.map(u=>sn(u,e,i)).filter(u=>!isNaN(u==null?void 0:u.x)).map(u=>u.x);o.xmax=Math.max.apply(null,h)}if(xl){o.xmax=f[1];const m=[];m.push(new k(n.xmin,n.ymin,t)),m.push(new k(n.xmin,(n.ymin+n.ymax)/2,t)),m.push(new k(n.xmin,n.ymax,t));const h=m.map(u=>sn(u,e,i)).filter(u=>!isNaN(u==null?void 0:u.x)).map(u=>u.x);o.xmin=Math.min.apply(null,h)}}else{const y=S(e,.001);Math.abs(o.xmin-f[0])0&&s.outofBoundPointCountq)&&(xn(f,a,n.datumTransformation)&&(f.isGeographic||C(f)),i=[I,I],s=K({...n,spacing:i}),r={cols:s.size[0]+1,rows:s.size[1]+1},o=on(s.offsets,r,i,q)),s.error=o,i[0]>1&&(s.coefficients=fn(s.offsets,r,t)),n.includeGCSGrid&&!f.isGeographic&&!f.isWebMercator)if(a.isGeographic)s.gcsGrid={offsets:s.offsets,coefficients:s.coefficients,spacing:i};else{const l=C(f);if(l!=null&&!l.isEnvelope){const d=Ln(f),y=pn(n.projectedExtent,d),{offsets:x}=K({...n,srcBufferExtent:y,spacing:i}),m=fn(x,r,t);s.gcsGrid={offsets:x,coefficients:m,spacing:i}}}return s}function K(n){const{projectedExtent:e,srcBufferExtent:i,pixelSize:s,datumTransformation:r,rasterTransform:t}=n,o=e.spatialReference,c=i.spatialReference,f=$(o,c),{xmin:a,ymin:l,xmax:d,ymax:y}=e,x=G(c),m=x!=null&&(n.hasWrapAround||(t==null?void 0:t.type)==="gcs-shift"),h=n.spacing||[j,j],u=h[0]*s.x,R=h[1]*s.y,g=h[0]===1,p=Math.ceil((d-a)/u-.1/h[0])+(g?0:1),w=Math.ceil((y-l)/R-.1/h[1])+(g?0:1),M=Cn({cols:p,rows:w,xmin:a,ymax:y,xres:u,yres:R,inSR:o,outSR:c,datumTransformation:r,preferPE:h[0]<=I,usePixelCenter:g}),P=[];let T,L=0;const Z=g?-1:NaN,{xmin:H,xmax:Y,ymax:gn,width:yn,height:dn}=i,wn=S(c,B),Mn=x!=null&&H>0&&Y>x/2;let Q=!1;if(f){const _=C(o);Q=_!=null&&_.poleLocation>0}for(let _=0;_Y&&b[0]>x/2-wn?b[0]-=x:m&&_===0&&b[0]<0&&Mn&&!t&&(b[0]+=x),!b||isNaN(b[0])||isNaN(b[1]))P.push(Z),P.push(Z),F.push(null),L++;else{if(t){const nn=t.inverseTransform(new k({x:b[0],y:b[1],spatialReference:c}));b=[nn.x,nn.y]}F.push(b),_>0&&m&&T[z]&&b[0]Y&&b[0]>x&&(b[0]-=x)),P.push((b[0]-H)/yn),P.push((gn-b[1])/dn)}}T=F}return{offsets:P,error:null,coefficients:null,outofBoundPointCount:L,spacing:h,size:g?[p,w]:[p-1,w-1]}}function fn(n,e,i){const{cols:s,rows:r}=e,t=new Float32Array((s-1)*(r-1)*2*6),o=new Float32Array([-0,-1,1,-1,1,-0,1,-0,-0]),c=new Float32Array([-1,1,0,0,-1,1,1,0,0]);for(let f=0;fr){const c=n.xmin-r;o=-Math.ceil(c/t)}return new W({spatialReference:n.spatialReference,xmin:n.xmin+o*t,ymin:n.ymin,xmax:n.xmax+o*t,ymax:n.ymax})}function Xn(n,e,i){var m;const{storageInfo:s,pixelSize:r}=e;let t=0,o=!1;const{pyramidResolutions:c}=s,f=((m=s.tileInfo.format)==null?void 0:m.toLowerCase())==="mixed"?Math.max(1,Math.min(3,s.tileInfo.dpi/96)):1,a=(n.x+n.y)/2/f;if(c!=null&&c.length){const h=c[c.length-1],u=(h.x+h.y)/2,R=(r.x+r.y)/2;if(a<=R)t=0;else if(a>=u)t=c.length,o=a/u>8;else{let p,w=R;for(let M=1;M<=c.length;M++){if(p=(c[M-1].x+c[M-1].y)/2,a<=p){a===p?t=M:i==="down"?(t=M-1,o=a/w>8):t=i==="up"||a-w>p-a||a/w>2?M:M-1;break}w=p}}const g=t===0?r:c[t-1];return o&&Math.min(g.x,g.y)*O(e.spatialReference)>19567&&(o=!1),{pyramidLevel:t,pyramidResolution:new k({x:g.x,y:g.y,spatialReference:e.spatialReference}),excessiveReading:o}}const l=Math.log(n.x/r.x)/Math.LN2,d=Math.log(n.y/r.y)/Math.LN2,y=e.storageInfo.maximumPyramidLevel||0;t=i==="down"?Math.floor(Math.min(l,d)):i==="up"?Math.ceil(Math.max(l,d)):Math.round((l+d)/2),t<0?t=0:t>y&&(o=t>y+3,t=y);const x=2**t;return{pyramidLevel:t,pyramidResolution:new k({x:x*e.nativePixelSize.x,y:x*e.nativePixelSize.y,spatialReference:e.spatialReference}),excessiveReading:o}}function Kn(n,e){const{pixelSize:i,extent:s}=n,r=_n(s,e,!1);return pn(jn(s,(i.x+i.y)/16),e,r)}export{An as C,G as D,pn as J,xn as M,Bn as T,Yn as U,Wn as V,Fn as Z,qn as e,sn as j,Jn as o,Xn as r,Kn as s,_n as v}; diff --git a/dist/assets/rasterizingUtils-6P0UGdzr.js b/dist/assets/rasterizingUtils-_-kX1RtA.js similarity index 96% rename from dist/assets/rasterizingUtils-6P0UGdzr.js rename to dist/assets/rasterizingUtils-_-kX1RtA.js index 5d5907d..db90749 100644 --- a/dist/assets/rasterizingUtils-6P0UGdzr.js +++ b/dist/assets/rasterizingUtils-_-kX1RtA.js @@ -1 +1 @@ -import{fW as x,fX as u}from"./index-J0iiHjMT.js";const C=e=>e==="vertical"||e==="horizontal"||e==="cross"||e==="esriSFSCross"||e==="esriSFSVertical"||e==="esriSFSHorizontal";function k(e,i,T){const F=x(Math.ceil(T)),a=C(i)?8*F:16*F,o=2*F;e.width=a,e.height=a;const t=e.getContext("2d");t.strokeStyle="#FFFFFF",t.lineWidth=F,t.beginPath(),i!=="vertical"&&i!=="cross"&&i!=="esriSFSCross"&&i!=="esriSFSVertical"||(t.moveTo(a/2,-o),t.lineTo(a/2,a+o)),i!=="horizontal"&&i!=="cross"&&i!=="esriSFSCross"&&i!=="esriSFSHorizontal"||(t.moveTo(-o,a/2),t.lineTo(a+o,a/2)),i!=="forward-diagonal"&&i!=="diagonal-cross"&&i!=="esriSFSDiagonalCross"&&i!=="esriSFSForwardDiagonal"||(t.moveTo(-o,-o),t.lineTo(a+o,a+o),t.moveTo(a-o,-o),t.lineTo(a+o,o),t.moveTo(-o,a-o),t.lineTo(o,a+o)),i!=="backward-diagonal"&&i!=="diagonal-cross"&&i!=="esriSFSBackwardDiagonal"&&i!=="esriSFSDiagonalCross"||(t.moveTo(a+o,-o),t.lineTo(-o,a+o),t.moveTo(o,-o),t.lineTo(-o,o),t.moveTo(a+o,a-o),t.lineTo(a-o,a+o)),t.stroke();const d=t.getImageData(0,0,e.width,e.height),s=new Uint8Array(d.data);let l;for(let n=0;ne==="vertical"||e==="horizontal"||e==="cross"||e==="esriSFSCross"||e==="esriSFSVertical"||e==="esriSFSHorizontal";function k(e,i,T){const F=x(Math.ceil(T)),a=C(i)?8*F:16*F,o=2*F;e.width=a,e.height=a;const t=e.getContext("2d");t.strokeStyle="#FFFFFF",t.lineWidth=F,t.beginPath(),i!=="vertical"&&i!=="cross"&&i!=="esriSFSCross"&&i!=="esriSFSVertical"||(t.moveTo(a/2,-o),t.lineTo(a/2,a+o)),i!=="horizontal"&&i!=="cross"&&i!=="esriSFSCross"&&i!=="esriSFSHorizontal"||(t.moveTo(-o,a/2),t.lineTo(a+o,a/2)),i!=="forward-diagonal"&&i!=="diagonal-cross"&&i!=="esriSFSDiagonalCross"&&i!=="esriSFSForwardDiagonal"||(t.moveTo(-o,-o),t.lineTo(a+o,a+o),t.moveTo(a-o,-o),t.lineTo(a+o,o),t.moveTo(-o,a-o),t.lineTo(o,a+o)),i!=="backward-diagonal"&&i!=="diagonal-cross"&&i!=="esriSFSBackwardDiagonal"&&i!=="esriSFSDiagonalCross"||(t.moveTo(a+o,-o),t.lineTo(-o,a+o),t.moveTo(o,-o),t.lineTo(-o,o),t.moveTo(a+o,a-o),t.lineTo(a-o,a+o)),t.stroke();const d=t.getImageData(0,0,e.width,e.height),s=new Uint8Array(d.data);let l;for(let n=0;n{let n,r,l,u,s;if(e.data)if(e.data instanceof ArrayBuffer){if(!(t!=="json"&&t!=="text"&&t!=="blob"||(n=new Blob([e.data]),t!=="json"&&t!=="text"||(u=await n.text(),t!=="json")))){try{r=JSON.parse(u||null)}catch(i){const b={...i,url:o,requestOptions:a};throw new p("request:server",i.message,b)}if(r.error){const i={...r.error,url:o,requestOptions:a};throw new p("request:server",r.error.message,i)}}}else t==="native"&&(e.data.signal=c,l=await fetch(e.data.url,e.data),e.httpStatus=l.status);switch(t){case"blob":s=n;break;case"json":s=r;break;case"native":s=l;break;case"text":s=u;break;default:s=e.data}return{data:s,httpStatus:e.httpStatus,requestOptions:a,ssl:e.ssl,url:o}})}export{d as execute}; +import{r as p}from"./index-pCX-0tJH.js";function d(o,a){let t=a.responseType;t?t!=="array-buffer"&&t!=="blob"&&t!=="json"&&t!=="native"&&t!=="native-request-init"&&t!=="text"&&(t="text"):t="json",a.responseType=t;const c=a.signal;return delete a.signal,globalThis.invokeStaticMessage("request",{url:o,options:a},{signal:c}).then(async e=>{let n,r,l,u,s;if(e.data)if(e.data instanceof ArrayBuffer){if(!(t!=="json"&&t!=="text"&&t!=="blob"||(n=new Blob([e.data]),t!=="json"&&t!=="text"||(u=await n.text(),t!=="json")))){try{r=JSON.parse(u||null)}catch(i){const b={...i,url:o,requestOptions:a};throw new p("request:server",i.message,b)}if(r.error){const i={...r.error,url:o,requestOptions:a};throw new p("request:server",r.error.message,i)}}}else t==="native"&&(e.data.signal=c,l=await fetch(e.data.url,e.data),e.httpStatus=l.status);switch(t){case"blob":s=n;break;case"json":s=r;break;case"native":s=l;break;case"text":s=u;break;default:s=e.data}return{data:s,httpStatus:e.httpStatus,requestOptions:a,ssl:e.ssl,url:o}})}export{d as execute}; diff --git a/dist/assets/requestPresets-18nzHK5y.js b/dist/assets/requestPresets-18nzHK5y.js deleted file mode 100644 index 14d6d7b..0000000 --- a/dist/assets/requestPresets-18nzHK5y.js +++ /dev/null @@ -1 +0,0 @@ -import{bW as a}from"./index-J0iiHjMT.js";async function s(e,t){const{data:r}=await a(e,{responseType:"json",query:{f:"json",...t==null?void 0:t.customParameters,token:t==null?void 0:t.apiKey}});return r}export{s as t}; diff --git a/dist/assets/requestPresets-f6ZAWLqV.js b/dist/assets/requestPresets-f6ZAWLqV.js new file mode 100644 index 0000000..c2969da --- /dev/null +++ b/dist/assets/requestPresets-f6ZAWLqV.js @@ -0,0 +1 @@ +import{av as r}from"./index-pCX-0tJH.js";async function s(a,t){const{data:e}=await r(a,{responseType:"json",query:{f:"json",...t==null?void 0:t.customParameters,token:t==null?void 0:t.apiKey}});return e}export{s as t}; diff --git a/dist/assets/scrim-OeyGkB0-.js b/dist/assets/scrim-yAG2Pcs1.js similarity index 91% rename from dist/assets/scrim-OeyGkB0-.js rename to dist/assets/scrim-yAG2Pcs1.js index db41fb3..116af29 100644 --- a/dist/assets/scrim-OeyGkB0-.js +++ b/dist/assets/scrim-yAG2Pcs1.js @@ -1,4 +1,4 @@ -import{q as c,H as o,ck as l,t}from"./index-J0iiHjMT.js";import{c as r,d}from"./locale-pfkq1d6A.js";import{u as h,c as m,s as f,d as g}from"./t9n-od6MEnI1.js";import{c as u}from"./observers-JyBmMU24.js";import{d as p}from"./loader-QqciGs1c.js";/*! +import{p as c,H as o,aV as l,k as t}from"./index-pCX-0tJH.js";import{c as r,d}from"./locale-tKMV0J87.js";import{u as h,c as m,s as f,d as g}from"./t9n-KLe7iM0R.js";import{c as u}from"./observers-eNe735aq.js";import{d as p}from"./loader-plQ4Tft5.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/serviceCapabilitiesUtils-26KpT1VN.js b/dist/assets/serviceCapabilitiesUtils-f-iBP4uh.js similarity index 95% rename from dist/assets/serviceCapabilitiesUtils-26KpT1VN.js rename to dist/assets/serviceCapabilitiesUtils-f-iBP4uh.js index c4e4b06..eb5eff9 100644 --- a/dist/assets/serviceCapabilitiesUtils-26KpT1VN.js +++ b/dist/assets/serviceCapabilitiesUtils-f-iBP4uh.js @@ -1 +1 @@ -import{df as g,dJ as S,dv as A}from"./index-J0iiHjMT.js";function t(s,e,r){return!!h(s,e,r)}function c(s,e,r){return h(s,e,r)}function h(s,e,r){return s&&s.hasOwnProperty(e)?s[e]:r}const Q={name:"supportsName",size:"supportsSize",contentType:"supportsContentType",keywords:"supportsKeywords",exifInfo:"supportsExifInfo"};function v(s){var r;const e=(r=s==null?void 0:s.supportedSpatialAggregationStatistics)==null?void 0:r.map(p=>p.toLowerCase());return{envelope:!!(e!=null&&e.includes("envelopeaggregate")),centroid:!!(e!=null&&e.includes("centroidaggregate")),convexHull:!!(e!=null&&e.includes("convexhullaggregate"))}}function d(s,e){var p;const r=(p=s==null?void 0:s.supportedOperationsWithCacheHint)==null?void 0:p.map(o=>o.toLowerCase());return!!(r!=null&&r.includes(e.toLowerCase()))}function b(s,e){return{analytics:R(s),attachment:f(s),data:x(s),metadata:T(s),operations:F(s.capabilities,s,e),query:w(s,e),queryRelated:D(s),queryTopFeatures:E(s),editing:z(s)}}function R(s){return{supportsCacheHint:d(s.advancedQueryCapabilities,"queryAnalytics")}}function f(s){const e=s.attachmentProperties,r={supportsName:!1,supportsSize:!1,supportsContentType:!1,supportsKeywords:!1,supportsExifInfo:!1,supportsCacheHint:d(s.advancedQueryCapabilities,"queryAttachments"),supportsResize:t(s,"supportsAttachmentsResizing",!1)};return e&&Array.isArray(e)&&e.forEach(p=>{const o=Q[p.name];o&&(r[o]=!!p.isEnabled)}),r}function x(s){return{isVersioned:t(s,"isDataVersioned",!1),supportsAttachment:t(s,"hasAttachments",!1),supportsM:t(s,"hasM",!1),supportsZ:t(s,"hasZ",!1)}}function T(s){return{supportsAdvancedFieldProperties:t(s,"supportsFieldDescriptionProperty",!1)}}function F(s,e,r){const p=s?s.toLowerCase().split(",").map(C=>C.trim()):[],o=r?g(r):null,l=p.includes(o!=null&&o.serverType==="MapServer"?"data":"query"),u=p.includes("editing")&&!e.datesInUnknownTimezone;let a=u&&p.includes("create"),n=u&&p.includes("delete"),i=u&&p.includes("update");const y=p.includes("changetracking"),m=e.advancedQueryCapabilities;return u&&!(a||n||i)&&(a=n=i=!0),{supportsCalculate:t(e,"supportsCalculate",!1),supportsTruncate:t(e,"supportsTruncate",!1),supportsValidateSql:t(e,"supportsValidateSql",!1),supportsAdd:a,supportsDelete:n,supportsEditing:u,supportsChangeTracking:y,supportsQuery:l,supportsQueryAnalytics:t(m,"supportsQueryAnalytic",!1),supportsQueryAttachments:t(m,"supportsQueryAttachments",!1),supportsQueryTopFeatures:t(m,"supportsTopFeaturesQuery",!1),supportsResizeAttachments:t(e,"supportsAttachmentsResizing",!1),supportsSync:p.includes("sync"),supportsUpdate:i,supportsExceedsLimitStatistics:t(e,"supportsExceedsLimitStatistics",!1),supportsAsyncConvert3D:t(e,"supportsAsyncConvert3D",!1)}}function w(s,e){const r=s.advancedQueryCapabilities,p=s.ownershipBasedAccessControlForFeatures,o=s.archivingInfo,l=s.currentVersion,u=e==null?void 0:e.includes("MapServer"),a=!u||l>=S("mapserver-pbf-version-support"),n=A(e),i=new Set((s.supportedQueryFormats??"").split(",").map(y=>y.toLowerCase().trim()));return{supportsStatistics:t(r,"supportsStatistics",s.supportsStatistics),supportsPercentileStatistics:t(r,"supportsPercentileStatistics",!1),supportsSpatialAggregationStatistics:t(r,"supportsSpatialAggregationStatistics",!1),supportedSpatialAggregationStatistics:v(r),supportsCentroid:t(r,"supportsReturningGeometryCentroid",!1),supportsDistance:t(r,"supportsQueryWithDistance",!1),supportsDistinct:t(r,"supportsDistinct",s.supportsAdvancedQueries),supportsExtent:t(r,"supportsReturningQueryExtent",!1),supportsGeometryProperties:t(r,"supportsReturningGeometryProperties",!1),supportsHavingClause:t(r,"supportsHavingClause",!1),supportsOrderBy:t(r,"supportsOrderBy",s.supportsAdvancedQueries),supportsPagination:t(r,"supportsPagination",!1),supportsQuantization:t(s,"supportsCoordinatesQuantization",!1),supportsQuantizationEditMode:t(s,"supportsQuantizationEditMode",!1),supportsQueryGeometry:t(s,"supportsReturningQueryGeometry",!1),supportsResultType:t(r,"supportsQueryWithResultType",!1),supportsMaxRecordCountFactor:t(r,"supportsMaxRecordCountFactor",!1),supportsSqlExpression:t(r,"supportsSqlExpression",!1),supportsStandardizedQueriesOnly:t(s,"useStandardizedQueries",!1),supportsTopFeaturesQuery:t(r,"supportsTopFeaturesQuery",!1),supportsQueryByAnonymous:t(p,"allowAnonymousToQuery",!0),supportsQueryByOthers:t(p,"allowOthersToQuery",!0),supportsHistoricMoment:t(o,"supportsQueryWithHistoricMoment",!1),supportsFormatPBF:a&&i.has("pbf"),supportsDisjointSpatialRelationship:t(r,"supportsDisjointSpatialRel",!1),supportsCacheHint:t(r,"supportsQueryWithCacheHint",!1)||d(r,"query"),supportsDefaultSpatialReference:t(r,"supportsDefaultSR",!1),supportsCompactGeometry:n,supportsFullTextSearch:t(r,"supportsFullTextSearch",!1),maxRecordCountFactor:c(s,"maxRecordCountFactor",void 0),maxRecordCount:c(s,"maxRecordCount",void 0),standardMaxRecordCount:c(s,"standardMaxRecordCount",void 0),tileMaxRecordCount:c(s,"tileMaxRecordCount",void 0)}}function D(s){const e=s.advancedQueryCapabilities,r=t(e,"supportsAdvancedQueryRelated",!1);return{supportsPagination:t(e,"supportsQueryRelatedPagination",!1),supportsCount:r,supportsOrderBy:r,supportsCacheHint:d(e,"queryRelated")}}function E(s){return{supportsCacheHint:d(s.advancedQueryCapabilities,"queryTopFilter")}}function z(s){const e=s.ownershipBasedAccessControlForFeatures,r=s?s.advancedEditingCapabilities:void 0;return{supportsGeometryUpdate:t(s,"allowGeometryUpdates",!0),supportsGlobalId:t(s,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:t(s,"supportsReturnServiceEditsInSourceSR",!1),supportsRollbackOnFailure:t(s,"supportsRollbackOnFailureParameter",!1),supportsUpdateWithoutM:t(s,"allowUpdateWithoutMValues",!1),supportsUploadWithItemId:t(s,"supportsAttachmentsByUploadId",!1),supportsDeleteByAnonymous:t(e,"allowAnonymousToDelete",!0),supportsDeleteByOthers:t(e,"allowOthersToDelete",!0),supportsUpdateByAnonymous:t(e,"allowAnonymousToUpdate",!0),supportsUpdateByOthers:t(e,"allowOthersToUpdate",!0),supportsAsyncApplyEdits:t(r,"supportsAsyncApplyEdits",!1),zDefault:c(s,"zDefault",void 0)}}export{b as a}; +import{df as g,dE as S,dv as A}from"./index-pCX-0tJH.js";function t(s,e,r){return!!h(s,e,r)}function c(s,e,r){return h(s,e,r)}function h(s,e,r){return s&&s.hasOwnProperty(e)?s[e]:r}const Q={name:"supportsName",size:"supportsSize",contentType:"supportsContentType",keywords:"supportsKeywords",exifInfo:"supportsExifInfo"};function v(s){var r;const e=(r=s==null?void 0:s.supportedSpatialAggregationStatistics)==null?void 0:r.map(p=>p.toLowerCase());return{envelope:!!(e!=null&&e.includes("envelopeaggregate")),centroid:!!(e!=null&&e.includes("centroidaggregate")),convexHull:!!(e!=null&&e.includes("convexhullaggregate"))}}function d(s,e){var p;const r=(p=s==null?void 0:s.supportedOperationsWithCacheHint)==null?void 0:p.map(o=>o.toLowerCase());return!!(r!=null&&r.includes(e.toLowerCase()))}function b(s,e){return{analytics:R(s),attachment:f(s),data:x(s),metadata:T(s),operations:F(s.capabilities,s,e),query:w(s,e),queryRelated:E(s),queryTopFeatures:D(s),editing:z(s)}}function R(s){return{supportsCacheHint:d(s.advancedQueryCapabilities,"queryAnalytics")}}function f(s){const e=s.attachmentProperties,r={supportsName:!1,supportsSize:!1,supportsContentType:!1,supportsKeywords:!1,supportsExifInfo:!1,supportsCacheHint:d(s.advancedQueryCapabilities,"queryAttachments"),supportsResize:t(s,"supportsAttachmentsResizing",!1)};return e&&Array.isArray(e)&&e.forEach(p=>{const o=Q[p.name];o&&(r[o]=!!p.isEnabled)}),r}function x(s){return{isVersioned:t(s,"isDataVersioned",!1),supportsAttachment:t(s,"hasAttachments",!1),supportsM:t(s,"hasM",!1),supportsZ:t(s,"hasZ",!1)}}function T(s){return{supportsAdvancedFieldProperties:t(s,"supportsFieldDescriptionProperty",!1)}}function F(s,e,r){const p=s?s.toLowerCase().split(",").map(C=>C.trim()):[],o=r?g(r):null,l=p.includes(o!=null&&o.serverType==="MapServer"?"data":"query"),u=p.includes("editing")&&!e.datesInUnknownTimezone;let a=u&&p.includes("create"),n=u&&p.includes("delete"),i=u&&p.includes("update");const y=p.includes("changetracking"),m=e.advancedQueryCapabilities;return u&&!(a||n||i)&&(a=n=i=!0),{supportsCalculate:t(e,"supportsCalculate",!1),supportsTruncate:t(e,"supportsTruncate",!1),supportsValidateSql:t(e,"supportsValidateSql",!1),supportsAdd:a,supportsDelete:n,supportsEditing:u,supportsChangeTracking:y,supportsQuery:l,supportsQueryAnalytics:t(m,"supportsQueryAnalytic",!1),supportsQueryAttachments:t(m,"supportsQueryAttachments",!1),supportsQueryTopFeatures:t(m,"supportsTopFeaturesQuery",!1),supportsResizeAttachments:t(e,"supportsAttachmentsResizing",!1),supportsSync:p.includes("sync"),supportsUpdate:i,supportsExceedsLimitStatistics:t(e,"supportsExceedsLimitStatistics",!1),supportsAsyncConvert3D:t(e,"supportsAsyncConvert3D",!1)}}function w(s,e){const r=s.advancedQueryCapabilities,p=s.ownershipBasedAccessControlForFeatures,o=s.archivingInfo,l=s.currentVersion,u=e==null?void 0:e.includes("MapServer"),a=!u||l>=S("mapserver-pbf-version-support"),n=A(e),i=new Set((s.supportedQueryFormats??"").split(",").map(y=>y.toLowerCase().trim()));return{supportsStatistics:t(r,"supportsStatistics",s.supportsStatistics),supportsPercentileStatistics:t(r,"supportsPercentileStatistics",!1),supportsSpatialAggregationStatistics:t(r,"supportsSpatialAggregationStatistics",!1),supportedSpatialAggregationStatistics:v(r),supportsCentroid:t(r,"supportsReturningGeometryCentroid",!1),supportsDistance:t(r,"supportsQueryWithDistance",!1),supportsDistinct:t(r,"supportsDistinct",s.supportsAdvancedQueries),supportsExtent:t(r,"supportsReturningQueryExtent",!1),supportsGeometryProperties:t(r,"supportsReturningGeometryProperties",!1),supportsHavingClause:t(r,"supportsHavingClause",!1),supportsOrderBy:t(r,"supportsOrderBy",s.supportsAdvancedQueries),supportsPagination:t(r,"supportsPagination",!1),supportsQuantization:t(s,"supportsCoordinatesQuantization",!1),supportsQuantizationEditMode:t(s,"supportsQuantizationEditMode",!1),supportsQueryGeometry:t(s,"supportsReturningQueryGeometry",!1),supportsResultType:t(r,"supportsQueryWithResultType",!1),supportsMaxRecordCountFactor:t(r,"supportsMaxRecordCountFactor",!1),supportsSqlExpression:t(r,"supportsSqlExpression",!1),supportsStandardizedQueriesOnly:t(s,"useStandardizedQueries",!1),supportsTopFeaturesQuery:t(r,"supportsTopFeaturesQuery",!1),supportsQueryByAnonymous:t(p,"allowAnonymousToQuery",!0),supportsQueryByOthers:t(p,"allowOthersToQuery",!0),supportsHistoricMoment:t(o,"supportsQueryWithHistoricMoment",!1),supportsFormatPBF:a&&i.has("pbf"),supportsDisjointSpatialRelationship:t(r,"supportsDisjointSpatialRel",!1),supportsCacheHint:t(r,"supportsQueryWithCacheHint",!1)||d(r,"query"),supportsDefaultSpatialReference:t(r,"supportsDefaultSR",!1),supportsCompactGeometry:n,supportsFullTextSearch:t(r,"supportsFullTextSearch",!1),maxRecordCountFactor:c(s,"maxRecordCountFactor",void 0),maxRecordCount:c(s,"maxRecordCount",void 0),standardMaxRecordCount:c(s,"standardMaxRecordCount",void 0),tileMaxRecordCount:c(s,"tileMaxRecordCount",void 0)}}function E(s){const e=s.advancedQueryCapabilities,r=t(e,"supportsAdvancedQueryRelated",!1);return{supportsPagination:t(e,"supportsQueryRelatedPagination",!1),supportsCount:r,supportsOrderBy:r,supportsCacheHint:d(e,"queryRelated")}}function D(s){return{supportsCacheHint:d(s.advancedQueryCapabilities,"queryTopFilter")}}function z(s){const e=s.ownershipBasedAccessControlForFeatures,r=s?s.advancedEditingCapabilities:void 0;return{supportsGeometryUpdate:t(s,"allowGeometryUpdates",!0),supportsGlobalId:t(s,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:t(s,"supportsReturnServiceEditsInSourceSR",!1),supportsRollbackOnFailure:t(s,"supportsRollbackOnFailureParameter",!1),supportsUpdateWithoutM:t(s,"allowUpdateWithoutMValues",!1),supportsUploadWithItemId:t(s,"supportsAttachmentsByUploadId",!1),supportsDeleteByAnonymous:t(e,"allowAnonymousToDelete",!0),supportsDeleteByOthers:t(e,"allowOthersToDelete",!0),supportsUpdateByAnonymous:t(e,"allowAnonymousToUpdate",!0),supportsUpdateByOthers:t(e,"allowOthersToUpdate",!0),supportsAsyncApplyEdits:t(r,"supportsAsyncApplyEdits",!1),zDefault:c(s,"zDefault",void 0)}}export{b as a}; diff --git a/dist/assets/settings-QjT8PN4S.js b/dist/assets/settings-QjT8PN4S.js new file mode 100644 index 0000000..7e99cdd --- /dev/null +++ b/dist/assets/settings-QjT8PN4S.js @@ -0,0 +1 @@ +import{W as t}from"./index-pCX-0tJH.js";const e={main:new t([255,127,0]),selected:new t([255,255,255]),outline:new t([0,0,0,.5]),selectedOutline:new t([255,255,255]),hoverOutline:new t([255,255,255]),secondary:new t([255,255,255]),secondaryOutline:new t([100,100,100]),transparent:new t([0,0,0,0])};function n(s,o){Object.assign(s,o)}class r{constructor(o){this.size=8,this.hoverSize=10,this.color=e.main,this.hoverColor=e.main,this.outlineColor=e.outline,this.hoverOutlineColor=e.hoverOutline,n(this,o)}}class i{constructor(o){this.color=e.secondary,this.hoverColor=e.main,n(this,o)}}class l{constructor(o){this.color=e.transparent,this.hoverColor=e.transparent,this.outlineColor=e.main,this.hoverOutlineColor=e.main,this.stagedColor=e.transparent,this.stagedOutlineColor=e.secondary,n(this,o)}}class c{constructor(o){this.vertex=new r,this.midpoint=new r({color:e.secondary,outlineColor:e.secondaryOutline,size:6}),this.selected=new r({color:e.selected,hoverColor:e.selected,hoverOutlineColor:e.hoverOutline}),n(this,o)}}class h{constructor(o){this.center=new r({color:e.secondaryOutline}),this.fill=new l,this.line=new i,this.vertex=new r({color:e.selected,outlineColor:e.main,hoverColor:e.selected,hoverOutlineColor:e.secondaryOutline}),n(this,o)}}class a{constructor(o){this.reshapeGraphics=new c,this.transformGraphics=new h,n(this,o)}}const d=new a;export{d}; diff --git a/dist/assets/settings-YeKUIkGh.js b/dist/assets/settings-YeKUIkGh.js deleted file mode 100644 index dbcecc8..0000000 --- a/dist/assets/settings-YeKUIkGh.js +++ /dev/null @@ -1 +0,0 @@ -import{ab as t}from"./index-J0iiHjMT.js";const e={main:new t([255,127,0]),selected:new t([255,255,255]),outline:new t([0,0,0,.5]),selectedOutline:new t([255,255,255]),hoverOutline:new t([255,255,255]),secondary:new t([255,255,255]),secondaryOutline:new t([100,100,100]),transparent:new t([0,0,0,0])};function n(s,o){Object.assign(s,o)}class r{constructor(o){this.size=8,this.hoverSize=10,this.color=e.main,this.hoverColor=e.main,this.outlineColor=e.outline,this.hoverOutlineColor=e.hoverOutline,n(this,o)}}class i{constructor(o){this.color=e.secondary,this.hoverColor=e.main,n(this,o)}}class l{constructor(o){this.color=e.transparent,this.hoverColor=e.transparent,this.outlineColor=e.main,this.hoverOutlineColor=e.main,this.stagedColor=e.transparent,this.stagedOutlineColor=e.secondary,n(this,o)}}class c{constructor(o){this.vertex=new r,this.midpoint=new r({color:e.secondary,outlineColor:e.secondaryOutline,size:6}),this.selected=new r({color:e.selected,hoverColor:e.selected,hoverOutlineColor:e.hoverOutline}),n(this,o)}}class h{constructor(o){this.center=new r({color:e.secondaryOutline}),this.fill=new l,this.line=new i,this.vertex=new r({color:e.selected,outlineColor:e.main,hoverColor:e.selected,hoverOutlineColor:e.secondaryOutline}),n(this,o)}}class a{constructor(o){this.reshapeGraphics=new c,this.transformGraphics=new h,n(this,o)}}const d=new a;export{d}; diff --git a/dist/assets/sourceUtils-zbywPEXK.js b/dist/assets/sourceUtils-nEhsDpwC.js similarity index 50% rename from dist/assets/sourceUtils-zbywPEXK.js rename to dist/assets/sourceUtils-nEhsDpwC.js index 3324782..4fb2644 100644 --- a/dist/assets/sourceUtils-zbywPEXK.js +++ b/dist/assets/sourceUtils-nEhsDpwC.js @@ -1,7 +1,7 @@ -import{gf as d,gg as g,eY as h,gh as m,gi as p,gj as y,gk as a,de as w}from"./index-J0iiHjMT.js";import{n as I}from"./date-be_IQzZd.js";class _{constructor(){this.code=null,this.description=null}}class b{constructor(e){this.error=new _,this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error.description=e}}function c(n){return new b(n)}class j{constructor(e){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=e}}function A(n){return new j(n)}const u=new Set;function F(n,e,t,f=!1){u.clear();for(const i in t){const r=n.get(i);if(!r)continue;const o=q(r,t[i]);if(u.add(r.name),r&&(f||r.editable)){const l=d(r,o);if(l)return c(g(l,r,o));e[r.name]=o}}for(const i of(n==null?void 0:n.requiredFields)??[])if(!u.has(i.name))return c(`missing required field "${i.name}"`);return null}function q(n,e){let t=e;return h(n)&&typeof e=="string"?t=parseFloat(e):m(n)&&e!=null&&typeof e!="string"?t=String(e):p(n)&&typeof e=="string"&&(t=I(e)),y(t)}let s;function G(n,e){if(!n||!a(e))return n;if("rings"in n||"paths"in n){if(s==null)throw new TypeError("geometry engine not loaded");return s.simplify(e,n)}return n}async function P(){return s==null&&(s=await w(()=>import("./geometryEngineJSON-FxYgI0L3.js").then(n=>n.g),__vite__mapDeps([0,1,2,3]))),s}async function S(n,e){!a(n)||e!=="esriGeometryPolygon"&&e!=="esriGeometryPolyline"||await P()}export{S as I,A as d,c as f,F as p,G as w}; +import{gc as d,gd as g,eT as h,ge as m,gf as p,gg as y,gh as a,de as w}from"./index-pCX-0tJH.js";import{n as I}from"./date-be_IQzZd.js";class _{constructor(){this.code=null,this.description=null}}class b{constructor(e){this.error=new _,this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error.description=e}}function c(n){return new b(n)}class q{constructor(e){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=e}}function v(n){return new q(n)}const u=new Set;function A(n,e,t,f=!1){u.clear();for(const i in t){const r=n.get(i);if(!r)continue;const o=P(r,t[i]);if(u.add(r.name),r&&(f||r.editable)){const l=d(r,o);if(l)return c(g(l,r,o));e[r.name]=o}}for(const i of(n==null?void 0:n.requiredFields)??[])if(!u.has(i.name))return c(`missing required field "${i.name}"`);return null}function P(n,e){let t=e;return h(n)&&typeof e=="string"?t=parseFloat(e):m(n)&&e!=null&&typeof e!="string"?t=String(e):p(n)&&typeof e=="string"&&(t=I(e)),y(t)}let s;function F(n,e){if(!n||!a(e))return n;if("rings"in n||"paths"in n){if(s==null)throw new TypeError("geometry engine not loaded");return s.simplify(e,n)}return n}async function j(){return s==null&&(s=await w(()=>import("./geometryEngineJSON-0_tJeUzi.js").then(n=>n.g),__vite__mapDeps([0,1,2,3]))),s}async function G(n,e){!a(n)||e!=="esriGeometryPolygon"&&e!=="esriGeometryPolyline"||await j()}export{G as I,v as d,c as f,A as p,F as w}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/geometryEngineJSON-FxYgI0L3.js","assets/index-J0iiHjMT.js","assets/index-PpMPqKeV.css","assets/json-v6EOeNTY.js"] + __vite__mapDeps.viteFileDeps = ["assets/geometryEngineJSON-0_tJeUzi.js","assets/index-pCX-0tJH.js","assets/index-4b4radwv.css","assets/json-v6EOeNTY.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/statsWorker-HfKfr9Es.js b/dist/assets/statsWorker-Z_8Cn8It.js similarity index 95% rename from dist/assets/statsWorker-HfKfr9Es.js rename to dist/assets/statsWorker-Z_8Cn8It.js index 2259dae..d237df5 100644 --- a/dist/assets/statsWorker-HfKfr9Es.js +++ b/dist/assets/statsWorker-Z_8Cn8It.js @@ -1 +1 @@ -import{b as d,f as z,d as T,p as I,C as x,k as y,$ as V,E as w,P as F,U as P,j as D,x as E}from"./utils-P5wTOmqv.js";import"./index-J0iiHjMT.js";import"./generateRendererUtils-_1jVE02H.js";async function C(s){const{attribute:a,features:r}=s,{normalizationType:i,normalizationField:e,minValue:n,maxValue:t,fieldType:o}=a,l=await d({field:a.field,valueExpression:a.valueExpression,normalizationType:i,normalizationField:e,normalizationTotal:a.normalizationTotal,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},r),m=z({normalizationType:i,normalizationField:e,minValue:n,maxValue:t}),u={value:.5,fieldType:o},f=o==="esriFieldTypeString"?T({values:l,supportsNullCount:m,percentileParams:u}):I({values:l,minValue:n,maxValue:t,useSampleStdDev:!i,supportsNullCount:m,percentileParams:u});return x(f,o==="esriFieldTypeDate")}async function S(s){const{attribute:a,features:r}=s,i=await d({field:a.field,field2:a.field2,field3:a.field3,fieldDelimiter:a.fieldDelimiter,valueExpression:a.valueExpression,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},r,!1),e=y(i);return V(e,a.domains,a.returnAllCodedValues,a.fieldDelimiter)}async function M(s){const{attribute:a,features:r}=s,{field:i,normalizationType:e,normalizationField:n,normalizationTotal:t,classificationMethod:o}=a,l=await d({field:i,valueExpression:a.valueExpression,normalizationType:e,normalizationField:n,normalizationTotal:t,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},r),m=w(l,{field:i,normalizationType:e,normalizationField:n,normalizationTotal:t,classificationMethod:o,standardDeviationInterval:a.standardDeviationInterval,numClasses:a.numClasses,minValue:a.minValue,maxValue:a.maxValue});return F(m,o)}async function $(s){const{attribute:a,features:r}=s,{field:i,normalizationType:e,normalizationField:n,normalizationTotal:t,classificationMethod:o}=a,l=await d({field:i,valueExpression:a.valueExpression,normalizationType:e,normalizationField:n,normalizationTotal:t,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},r);return P(l,{field:i,normalizationType:e,normalizationField:n,normalizationTotal:t,classificationMethod:o,standardDeviationInterval:a.standardDeviationInterval,numBins:a.numBins,minValue:a.minValue,maxValue:a.maxValue})}async function g(s){const{attribute:a,features:r}=s,{field:i,radius:e,fieldOffset:n,transform:t,spatialReference:o}=a,l=a.size??[0,0],m=D(r??[],t,o,l),{count:u,min:f,max:p,mean:v,stdDev:c}=E(m,e??void 0,n,i,l[0],l[1]);return{count:u,min:f,max:p,avg:v,stddev:c}}export{M as classBreaks,g as heatmapStatistics,$ as histogram,C as summaryStatistics,S as uniqueValues}; +import{b as d,f as z,d as T,p as I,C as x,k as y,$ as V,E as w,P as F,U as P,j as D,x as E}from"./utils-jVYIoPxv.js";import"./index-pCX-0tJH.js";import"./generateRendererUtils-3JJTfr19.js";async function C(s){const{attribute:a,features:r}=s,{normalizationType:i,normalizationField:e,minValue:n,maxValue:t,fieldType:o}=a,l=await d({field:a.field,valueExpression:a.valueExpression,normalizationType:i,normalizationField:e,normalizationTotal:a.normalizationTotal,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},r),m=z({normalizationType:i,normalizationField:e,minValue:n,maxValue:t}),u={value:.5,fieldType:o},f=o==="esriFieldTypeString"?T({values:l,supportsNullCount:m,percentileParams:u}):I({values:l,minValue:n,maxValue:t,useSampleStdDev:!i,supportsNullCount:m,percentileParams:u});return x(f,o==="esriFieldTypeDate")}async function S(s){const{attribute:a,features:r}=s,i=await d({field:a.field,field2:a.field2,field3:a.field3,fieldDelimiter:a.fieldDelimiter,valueExpression:a.valueExpression,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},r,!1),e=y(i);return V(e,a.domains,a.returnAllCodedValues,a.fieldDelimiter)}async function M(s){const{attribute:a,features:r}=s,{field:i,normalizationType:e,normalizationField:n,normalizationTotal:t,classificationMethod:o}=a,l=await d({field:i,valueExpression:a.valueExpression,normalizationType:e,normalizationField:n,normalizationTotal:t,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},r),m=w(l,{field:i,normalizationType:e,normalizationField:n,normalizationTotal:t,classificationMethod:o,standardDeviationInterval:a.standardDeviationInterval,numClasses:a.numClasses,minValue:a.minValue,maxValue:a.maxValue});return F(m,o)}async function $(s){const{attribute:a,features:r}=s,{field:i,normalizationType:e,normalizationField:n,normalizationTotal:t,classificationMethod:o}=a,l=await d({field:i,valueExpression:a.valueExpression,normalizationType:e,normalizationField:n,normalizationTotal:t,viewInfoParams:a.viewInfoParams,timeZone:a.timeZone,fieldInfos:a.fieldInfos},r);return P(l,{field:i,normalizationType:e,normalizationField:n,normalizationTotal:t,classificationMethod:o,standardDeviationInterval:a.standardDeviationInterval,numBins:a.numBins,minValue:a.minValue,maxValue:a.maxValue})}async function g(s){const{attribute:a,features:r}=s,{field:i,radius:e,fieldOffset:n,transform:t,spatialReference:o}=a,l=a.size??[0,0],m=D(r??[],t,o,l),{count:u,min:f,max:p,mean:v,stdDev:c}=E(m,e??void 0,n,i,l[0],l[1]);return{count:u,min:f,max:p,avg:v,stddev:c}}export{M as classBreaks,g as heatmapStatistics,$ as histogram,C as summaryStatistics,S as uniqueValues}; diff --git a/dist/assets/streamLayerUtils-j16jl5bN.js b/dist/assets/streamLayerUtils-NpNI_H_p.js similarity index 64% rename from dist/assets/streamLayerUtils-j16jl5bN.js rename to dist/assets/streamLayerUtils-NpNI_H_p.js index 4fa2204..fe43d23 100644 --- a/dist/assets/streamLayerUtils-j16jl5bN.js +++ b/dist/assets/streamLayerUtils-NpNI_H_p.js @@ -1 +1 @@ -import{I as o,b as m}from"./utils-rBsg-VY8.js";import{h0 as c,i as u,h as y}from"./index-J0iiHjMT.js";import"./jsonContext-cWV_-jAj.js";const s="Stream Service",f="stream-layer-save",p="stream-layer-save-as";function n(r){return{isValid:r.type==="stream"&&!!r.url&&!r.webSocketUrl,errorMessage:"Stream layer should be created using a url to a stream service"}}function l(r){const e=r.layerJSON;return Promise.resolve(e&&Object.keys(e).length?e:null)}async function v(r,e){const{parsedUrl:a,title:i,fullExtent:t}=r;e.url=a.path,e.title||(e.title=i),e.extent=null,t!=null&&(e.extent=await c(t)),u(e,y.SINGLE_LAYER)}async function S(r,e){return o({layer:r,itemType:s,validateLayer:n,createItemData:l,errorNamePrefix:f},e)}async function h(r,e,a){return m({layer:r,itemType:s,validateLayer:n,createItemData:l,errorNamePrefix:p,newItem:e,setItemProperties:v},a)}export{S as save,h as saveAs}; +import{I as o,b as m}from"./utils-YxtTVBu2.js";import{gZ as c,i as u,f as y}from"./index-pCX-0tJH.js";import"./jsonContext-EgdQULbU.js";const s="Stream Service",f="stream-layer-save",p="stream-layer-save-as";function n(r){return{isValid:r.type==="stream"&&!!r.url&&!r.webSocketUrl,errorMessage:"Stream layer should be created using a url to a stream service"}}function l(r){const e=r.layerJSON;return Promise.resolve(e&&Object.keys(e).length?e:null)}async function v(r,e){const{parsedUrl:a,title:i,fullExtent:t}=r;e.url=a.path,e.title||(e.title=i),e.extent=null,t!=null&&(e.extent=await c(t)),u(e,y.SINGLE_LAYER)}async function S(r,e){return o({layer:r,itemType:s,validateLayer:n,createItemData:l,errorNamePrefix:f},e)}async function b(r,e,a){return m({layer:r,itemType:s,validateLayer:n,createItemData:l,errorNamePrefix:p,newItem:e,setItemProperties:v},a)}export{S as save,b as saveAs}; diff --git a/dist/assets/surfaceCoordinateSystems-siQq4eBA.js b/dist/assets/surfaceCoordinateSystems-siQq4eBA.js deleted file mode 100644 index c95ecbe..0000000 --- a/dist/assets/surfaceCoordinateSystems-siQq4eBA.js +++ /dev/null @@ -1 +0,0 @@ -import{K as D,p as G,k as z,no as H,L as $,np as L,O as A,d as g,nn as U,n as _,nq as q,hN as B,bI as Y,Y as j,ao as T,e as a,nr as K,A as V,y as p,c as N,c4 as Q,aR as b,bB as R,ns as E,an as F,aO as X,T as m,nt as M,nu as J,nv as ee,aa as d,gr as O,nw as x,au as te,ax as ie,aU as ne,aF as se,aG as re,nx as oe,ny as ae,gq as C,e3 as pe}from"./index-J0iiHjMT.js";import{r as I}from"./dehydratedFeatureComparison-hdPq-zad.js";import{w as le,V as he,p as ce,l as de}from"./EditGeometryOperations-TPE5Wzab.js";import{d as w,C as ue}from"./InteractiveToolBase-WDic4GPF.js";import{e as P}from"./SnappingContext-6K6JmvvY.js";import{f as ge}from"./SnappingDragPipelineStep-THHIXt-p.js";import{p as me}from"./SnappingOperation-2U48wt1k.js";const Ie=["freehand","hybrid","click"],Z="click";class ve{constructor({grabbableForEvent:e}){this.events=new D,this.interactive=!0,this.selectable=!1,this.cursor=null,this.grabbable=!0,this.consumesClicks=!0,this.grabbableForEvent=e}destroy(){}intersectionDistance(e,i){return 0}attach(){}detach(){}onElevationChange(){}onViewChange(){}}const ye="crosshair",fe="progress";let o=class extends D.EventedMixin(G){constructor(t){super(t),this._createOperationCompleted=!1,this._hideDefaultCursor=!1,this._pointerDownStates=new Set,this._stagedScreenPoint=null,this._stagedPointerType=null,this._stagedPointerId=null,this._updatingHandles=new z,this.constraint=void 0,this.isDraped=!0,this.labelOptions=new H,this.tooltipOptions=new $,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.lastVertex=null,t.elevationInfo==null&&(this.elevationInfo=L(!!t.hasZ))}initialize(){const{geometryType:t,view:e}=this,i=e.spatialReference,n="viewingMode"in e.state?e.state.viewingMode:A.Local,l=t==="segment"||t==="multipoint"?"polyline":t;this.coordinateHelper=le(this.hasZ,this.hasM,i),this._editGeometryOperations=new he(new ce(l,this.coordinateHelper)),this._snappingOperation=new me({view:e,constrainResult:s=>{var r;return s?(r=this._getEffectiveDrawSurface())==null?void 0:r.constrainZ(s):void 0}}),this.addHandles([g(()=>this.stagedVertex,s=>{s!=null&&this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activeComponent.vertices.length,coordinates:this.coordinateHelper.pointToArray(s)}],operation:"apply",type:"vertex-update"})},{sync:!0,equals:(s,r)=>K(s,r,I)}),g(()=>this.view.viewpoint,(s,r)=>{s&&r&&Q(s,r)&&this._onViewpointChange()})]),this._activeComponent=new de(i,n),this._editGeometryOperations.data.components.push(this._activeComponent);const h=this.segmentLabels;h!=null&&(h.context={view:e,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.addHandles([g(()=>this.labelOptions.enabled,s=>{h.visible=s},V),this.on("cursor-update",()=>{const s=this.stagedVertex;h.stagedVertex=s!=null?this.coordinateHelper.pointToVector(s):null})])),this.addHandles(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],s=>{const r=s.vertices.map(u=>({componentIndex:0,vertexIndex:u.index,coordinates:this.coordinateHelper.vectorToArray(u.pos)})),y=r.map(u=>u.coordinates);switch(s.type){case"vertex-add":this.emit(s.type,{...s,added:y,vertices:r});break;case"vertex-update":this.emit(s.type,{...s,updated:y,vertices:r});break;case"vertex-remove":this.emit(s.type,{...s,removed:y,vertices:r})}const S=this._activeComponent.getLastVertex(),f=S!=null?this.coordinateHelper.vectorToDehydratedPoint(S.pos):null;f!=null&&this.lastVertex!=null&&I(this.lastVertex,f)||(this.lastVertex=f)}));const c=this._manipulator=new ve({grabbableForEvent:s=>this.drawingMode!=="click"||s.pointerType==="touch"&&this._snappingEnabled&&this._pointerDownStates.size===1});this.manipulators.add(c),c.grabbable=t!=="point",this.addHandles([this._createManipulatorDragPipeline(c),c.events.on("immediate-click",s=>this._onImmediateClick(s)),c.events.on("immediate-double-click",s=>this._onImmediateDoubleClick(s)),g(()=>({effectiveCursor:this.effectiveCursor}),({effectiveCursor:s})=>{c.cursor=s},V)]),U(this,()=>{const s=this.view.inputManager.latestPointerType??"mouse",r=this._getSnappingContext(s);this.snappingManager!=null&&this._updatingHandles.addPromise(T(this._snappingOperation.resnap(this.snappingManager,r)))})}destroy(){_(this.segmentLabels),_(this._snappingOperation),this._editGeometryOperations=_(this._editGeometryOperations),this._updatingHandles.destroy()}get _snappingEnabled(){return this.snappingManager!=null&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const t=this._getEffectiveDrawSurface();return this.view.type==="3d"&&this.drawSurface!==t}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activeComponent.vertices.map(t=>this.coordinateHelper.vectorToArray(t.pos))}set drawingMode(t){this._set("drawingMode",t??Z)}get effectiveCursor(){return this.loading?fe:this._hideDefaultCursor?null:this.cursor||ye}get interactive(){return this._manipulator.interactive}set interactive(t){this._manipulator.interactive=t}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activeComponent.vertices.length}get numVertices(){return this.stagedVertex!=null?this._activeComponent.vertices.length+1:this._activeComponent.vertices.length}get snappingOptions(){return this.snappingManager!=null?this.snappingManager.options:null}get stagedVertex(){const t=this._snappingOperation.stagedPoint,{constraint:e,elevationInfo:i,view:n}=this;if(!t||!e)return t;const l=q(t,n,i),h=l?e.closestTo(l):void 0;return h?B(h,t.spatialReference):t}set stagedVertex(t){this._snappingOperation.stagedPoint=Y(t)}get updating(){return this._updatingHandles.updating}get vertices(){const t=this.committedVertices;return this.stagedVertex!=null&&t.push(this.coordinateHelper.pointToArray(this.stagedVertex)),t}cancel(){this.complete({aborted:!0})}commitStagedVertex(){if(this._snappingOperation.abort(),this.stagedVertex!=null){const{stagedVertex:t}=this;this.stagedVertex=null,this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(t))}}complete(t){const e=t&&t.aborted||!1;this._snappingOperation.abort(),this.snappingManager!=null&&this.snappingManager.doneSnapping(),this.geometryType==="segment"||this.geometryType==="point"?this.commitStagedVertex():this.stagedVertex=null;const i=this.geometryType==="multipoint"&&this.numVertices===0||this.geometryType==="polyline"&&this.numVertices<2||this.geometryType==="polygon"&&this.numVertices<3;this._createOperationCompleted=!i,(this.isCompleted||e)&&this.emit("complete",{vertices:this.vertices.map((n,l)=>({componentIndex:0,vertexIndex:l,coordinates:n})),aborted:e,type:"complete"})}onInputEvent(t){switch(t.type){case"pointer-down":this._pointerDownStates.add(t.pointerId);break;case"pointer-up":this._pointerDownStates.delete(t.pointerId)}switch(t.type){case"pointer-move":return this._onPointerMove(t);case"hold":return this._onHold(t)}}redo(){this._editGeometryOperations.redo()}undo(){this.snappingManager!=null&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_closeOnClickVertexIndex(t){const e=this._activeComponent;if(this.geometryType==="polygon"&&e.vertices.length>2){if(this._vertexWithinPointerDistance(e.vertices[0].pos,t))return 0;if(this._vertexWithinPointerDistance(e.vertices[e.vertices.length-1].pos,t))return e.vertices.length-1}return null}_createManipulatorDragPipeline(t){switch(this.drawingMode){case"click":return this._createManipulatorDragPipelineClick(t);case"freehand":return this._createManipulatorDragPipelineFreehand(t);case"hybrid":return this._createManipulatorDragPipelineHybrid(t)}}_createManipulatorDragPipelineClick(t){return w(t,(e,i,n,l)=>{const h=l==="touch"&&this._snappingEnabled;if(this.isCompleted||!h)return;const{snappingStep:c,cancelSnapping:s}=ge({predicate:()=>h,snappingManager:this.snappingManager,snappingContext:new P({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,feature:this.graphic,pointer:l,visualizer:this.snappingVisualizer}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});n=n.next(r=>(h&&this.snappingManager!=null&&this.snappingManager.doneSnapping(),r)).next(s),i.next(this._screenToMapDragEventStep()).next(r=>(r.action==="start"&&(this.stagedVertex=r.mapStart,(this.geometryType==="segment"||h&&this.numVertices===0)&&this.commitStagedVertex()),r)).next(ue(this.view,this.elevationInfo)).next(...c).next(r=>(h&&(this.stagedVertex=r.mapEnd,r.action==="end"&&this.commitStagedVertex()),r)).next(r=>(r.action==="end"&&(this.geometryType!=="segment"&&this.geometryType!=="point"||this.complete()),r))})}_createManipulatorDragPipelineFreehand(t){return w(t,(e,i)=>{this.isCompleted||i.next(this._screenToMapDragEventStep()).next(n=>(n.action==="start"&&(this.stagedVertex==null&&(this.stagedVertex=n.mapStart),this.geometryType==="segment"&&this.commitStagedVertex()),n)).next(n=>{switch(n.action){case"start":case"update":this.stagedVertex=n.mapEnd,this.geometryType!=="polygon"&&this.geometryType!=="polyline"||this.commitStagedVertex();break;case"end":this.complete()}return n})})}_createManipulatorDragPipelineHybrid(t){return w(t,(e,i)=>{this.isCompleted||i.next(this._screenToMapDragEventStep()).next(n=>(n.action==="start"&&(this.stagedVertex==null&&(this.stagedVertex=n.mapStart),this.commitStagedVertex()),n)).next(n=>{switch(n.action){case"start":case"update":this.stagedVertex=n.mapEnd,this.geometryType!=="polygon"&&this.geometryType!=="polyline"||this.commitStagedVertex();break;case"end":this.geometryType!=="segment"&&this.geometryType!=="point"||this.complete()}return n})})}get _drawAtFixedElevation(){return(this.geometryType==="segment"||this.geometryType==="polygon")&&this.numCommittedVertices>0}_getEffectiveDrawSurface(){if(this.elevationDrawSurface==null)return this.drawSurface;if(!this.coordinateHelper.hasZ())return this.elevationDrawSurface.defaultZ=null,this.elevationDrawSurface;let t=this.defaultZ,e=!1;return this.elevationInfo!=null&&this.elevationInfo.mode==="absolute-height"&&(e=!0),this.snapToSceneEnabled!=null&&(e=this.snapToSceneEnabled),this.elevationInfo!=null&&this.elevationInfo.mode==="on-the-ground"&&(e=!1),this._drawAtFixedElevation&&(t=this.coordinateHelper.getZ(this._activeComponent.vertices[0].pos),e=!1),e?this.drawSurface:(this.elevationDrawSurface.defaultZ=t,this.elevationDrawSurface)}_mapToScreen(t){var e;return(e=this._getEffectiveDrawSurface())==null?void 0:e.mapToScreen(t)}_onHold(t){this._snappingOperation.abort(),this.drawingMode==="click"&&t.pointerType==="touch"&&this._snappingEnabled&&(this.stagedVertex=t.mapPoint),t.stopPropagation()}_onImmediateClick(t){if(t.pointerType==="mouse"&&t.button===2||this._manipulator.dragging)return;const e=this._activeComponent;if(this._closeOnClickVertexIndex(t.screenPoint)!=null)return t.stopPropagation(),void this.complete();const i=this._screenToMap(t.screenPoint);if(i!=null)switch(this.drawingMode){case"freehand":this.geometryType==="point"&&(this.stagedVertex!=null?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),this.complete());break;case"click":case"hybrid":this._snappingOperation.abort(),this.stagedVertex!=null?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),(this.geometryType==="point"||this.geometryType==="segment"&&e.vertices.length===2||this.geometryType==="segment"&&this.drawingMode==="hybrid"&&e.vertices.length===1)&&this.complete()}t.stopPropagation()}_onImmediateDoubleClick(t){this._manipulator.dragging||this.geometryType==="point"||(this.complete(),t.stopPropagation())}_onPointerMove(t){const e=j(t.x,t.y);this._stagedScreenPoint=e,this._stagedPointerType=t.pointerType,this._stagedPointerId=t.pointerId;const i=this._snappingOperation,n=this._manipulator;this._pointerDownStates.has(t.pointerId)||n.grabbing||!n.interactive?i.abort():(t.stopPropagation(),this._updateStagedVertexOnPointerMove(e,t.pointerType))}_onViewpointChange(){const t=this._manipulator;this._stagedPointerType==="mouse"&&this._stagedScreenPoint&&this._stagedPointerId!=null&&!this._pointerDownStates.has(this._stagedPointerId)&&!t.grabbing&&t.interactive?this._updateStagedVertexOnPointerMove(this._stagedScreenPoint,this._stagedPointerType??"mouse"):this._snappingOperation.abort()}_updateStagedVertexOnPointerMove(t,e){var r;const i=this._snappingOperation,n=this._closeOnClickVertexIndex(t);if(n!=null)return this._closeOnVertex(n),void i.abort();const l=this._screenToMap(t),h=this._requiresScenePoint?(r=this.drawSurface)==null?void 0:r.screenToMap(t):null;if(l==null)return this._hideDefaultCursor=!0,void i.abort();this._hideDefaultCursor=!1;const c=this.snappingManager;if(c==null)return this.stagedVertex=l,void i.abort();const s=this._getSnappingContext(e);this._updatingHandles.addPromise(T(i.snap({point:l,scenePoint:h},c,s)))}_closeOnVertex(t){this.stagedVertex=null;const e={componentIndex:0,vertexIndex:t,coordinates:this.coordinateHelper.vectorToArray(this._activeComponent.vertices[t].pos)};this.emit("cursor-update",{updated:null,vertices:[e],operation:"apply",type:"vertex-update"})}_screenToMap(t){var e;return(e=this._getEffectiveDrawSurface())==null?void 0:e.screenToMap(t)}_screenToMapDragEventStep(){let t=null;return e=>{if(e.action==="start"&&(t=this._screenToMap(e.screenStart)),t==null)return null;const i=this._screenToMap(e.screenEnd);return i!=null?{...e,mapStart:t,mapEnd:i}:null}}_vertexWithinPointerDistance(t,e){const n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(t));return n!=null&&_e(n,e,25)}_getSnappingContext(t){var i;const e=this._drawAtFixedElevation?(i=this.elevationDrawSurface)==null?void 0:i.defaultZ:null;return new P({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:t,feature:this.graphic,visualizer:this.snappingVisualizer,selfSnappingZ:e!=null?{value:e,elevationInfo:this.elevationInfo}:null})}};function _e(t,e,i){const n=t.x-e.x,l=t.y-e.y;return n*n+l*l<=i}a([p()],o.prototype,"_hideDefaultCursor",void 0),a([p()],o.prototype,"_snappingOperation",void 0),a([p()],o.prototype,"_snappingEnabled",null),a([p({constructOnly:!0})],o.prototype,"graphic",void 0),a([p()],o.prototype,"constraint",void 0),a([p()],o.prototype,"defaultZ",void 0),a([p()],o.prototype,"isDraped",void 0),a([p({value:Z})],o.prototype,"drawingMode",null),a([p({constructOnly:!0})],o.prototype,"elevationDrawSurface",void 0),a([p({constructOnly:!0})],o.prototype,"elevationInfo",void 0),a([p({constructOnly:!0,type:H})],o.prototype,"labelOptions",void 0),a([p({constructOnly:!0,type:$})],o.prototype,"tooltipOptions",void 0),a([p({constructOnly:!0})],o.prototype,"geometryType",void 0),a([p({constructOnly:!0})],o.prototype,"hasM",void 0),a([p({constructOnly:!0})],o.prototype,"hasZ",void 0),a([p()],o.prototype,"cursor",void 0),a([p()],o.prototype,"effectiveCursor",null),a([p()],o.prototype,"loading",void 0),a([p({constructOnly:!0})],o.prototype,"manipulators",void 0),a([p({constructOnly:!0})],o.prototype,"drawSurface",void 0),a([p({constructOnly:!0})],o.prototype,"segmentLabels",void 0),a([p({constructOnly:!0})],o.prototype,"snappingManager",void 0),a([p({constructOnly:!0})],o.prototype,"snappingVisualizer",void 0),a([p()],o.prototype,"snapToSceneEnabled",void 0),a([p()],o.prototype,"stagedVertex",null),a([p()],o.prototype,"lastVertex",void 0),a([p()],o.prototype,"updating",null),a([p({constructOnly:!0})],o.prototype,"view",void 0),o=a([N("esri.views.draw.DrawOperation")],o);class Pe{constructor(e,i,n,l=null){this._elevationInfo=e,this.defaultZ=i,this._view=n,this._excludeGraphics=l}screenToMap(e){if(this.defaultZ!=null)return this._view.sceneIntersectionHelper.intersectElevationFromScreen(b(e.x,e.y),this._elevationInfo,this.defaultZ,this._excludeGraphics);const i=this._view.sceneIntersectionHelper.intersectElevationFromScreen(b(e.x,e.y),this._elevationInfo,0,this._excludeGraphics);return i!=null&&(i.z=void 0),i}mapToScreen(e){const i=R(e.x,e.y,E(this._view,e,this._elevationInfo),e.spatialReference);return this._view.toScreen(i)}constrainZ(e){const{defaultZ:i}=this;return i!=null&&e.z!==i&&((e=F(e)).z=i),e}}class De{constructor(e,i,n=[]){this.view=e,this.elevationInfo=i,this.exclude=n}screenToMap(e){const i=this.view.toMap(e,{exclude:this.exclude});return i!=null&&(i.z=X(i,this.view,this.elevationInfo)),i}mapToScreen(e){let i=e;return this.elevationInfo!=null&&(i=R(e.x,e.y,E(this.view,e,this.elevationInfo),e.spatialReference)),this.view.toScreen(i)}constrainZ(e){return e}}class He{constructor(e,i=!1,n=0){this.view=e,this.hasZ=i,this.defaultZ=n,this.mapToScreen=l=>e.toScreen(l),this.screenToMap=i?l=>{const h=e.toMap(l);return h.z=n,h}:l=>e.toMap(l)}constrainZ(e){const{defaultZ:i}=this;return this.hasZ&&e.z!==i&&((e=F(e)).z=i),e}}function v(t,e,i=null){return i!=null?[t,e,i]:[t,e]}function W(t,e,i=null){return i!=null?{x:t,y:e,z:i}:{x:t,y:e}}class k{constructor(e){this.spatialReference=e}mapToLocalMultiple(e){return e.map(i=>this.mapToLocal(i)).filter(pe)}get doUnnormalization(){return!1}}class xe extends k{constructor(e,i,n=null){super(i),this._defaultZ=n,this.transform=M(),this.transformInv=M(),this.transform=J(e),ee(this.transformInv,this.transform)}makeMapPoint(e,i){return v(e,i,this._defaultZ)}mapToLocal(e){return W(this.transform[0]*e[0]+this.transform[2]*e[1]+this.transform[4],this.transform[1]*e[0]+this.transform[3]*e[1]+this.transform[5])}localToMap(e){return v(this.transformInv[0]*e.x+this.transformInv[2]*e.y+this.transformInv[4],this.transformInv[1]*e.x+this.transformInv[3]*e.y+this.transformInv[5],this._defaultZ)}}class we extends k{constructor(e,i){super(e.spatialReference),this.view=e,this.defaultZ=null,this.pWS=d(),this.tangentFrameUpWS=d(),this.tangentFrameRightWS=d(),this.tangentFrameForwardWS=d(),this.localFrameRightWS=d(),this.localFrameUpWS=d(),this.worldToLocalTransform=O(),this.localToWorldTransform=O(),this.scale=1,this.scale=e.resolution,this.referenceMapPoint=i,this.defaultZ=i.hasZ?i.z:null;const n=e.state.camera.viewRight;this.view.renderCoordsHelper.toRenderCoords(this.referenceMapPoint,this.pWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,x.X,this.tangentFrameRightWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,x.Y,this.tangentFrameUpWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,x.Z,this.tangentFrameForwardWS);const l=d();te(l,this.tangentFrameForwardWS,ie(n,this.tangentFrameForwardWS)),ne(this.localFrameRightWS,n,l),se(this.localFrameRightWS,this.localFrameRightWS),re(this.localFrameUpWS,this.tangentFrameForwardWS,this.localFrameRightWS),oe(this.worldToLocalTransform,this.localFrameRightWS,this.tangentFrameRightWS),ae(this.localToWorldTransform,this.worldToLocalTransform)}get doUnnormalization(){return this.view.viewingMode==="global"}makeMapPoint(e,i){return v(e,i,this.defaultZ)}mapToLocal(e){const i=d();this.view.renderCoordsHelper.toRenderCoords(new m({x:e[0],y:e[1],spatialReference:this.spatialReference}),i),C(i,i,this.worldToLocalTransform);const n=this.view.renderCoordsHelper.fromRenderCoords(i,this.view.spatialReference);return n!=null?W(n.x/this.scale,n.y/this.scale):null}localToMap(e){const i=d();this.view.renderCoordsHelper.toRenderCoords(new m({x:e.x*this.scale,y:e.y*this.scale,spatialReference:this.spatialReference}),i),C(i,i,this.localToWorldTransform);const n=this.view.renderCoordsHelper.fromRenderCoords(i,this.view.spatialReference);return n!=null?v(n.x,n.y,this.defaultZ):null}}function $e(t,e){if(t.type==="2d")return new xe(t.state.transform,t.spatialReference,e.length>2?e[2]:null);if(t.type==="3d"){const i=e.length>2?new m({x:e[0],y:e[1],z:e[2],spatialReference:t.spatialReference}):new m({x:e[0],y:e[1],spatialReference:t.spatialReference});return new we(t,i)}return null}export{$e as F,He as a,Ie as c,Z as e,W as g,o as k,De as o,Pe as r}; diff --git a/dist/assets/symbolLayerUtils-VVngrYnW.js b/dist/assets/symbolLayerUtils-5Hw4LbZb.js similarity index 67% rename from dist/assets/symbolLayerUtils-VVngrYnW.js rename to dist/assets/symbolLayerUtils-5Hw4LbZb.js index 9218470..bb57871 100644 --- a/dist/assets/symbolLayerUtils-VVngrYnW.js +++ b/dist/assets/symbolLayerUtils-5Hw4LbZb.js @@ -1,7 +1,7 @@ -import{gu as v,E as n,bW as y,de as p,gv as c,eh as w,gw as b,aa as l}from"./index-J0iiHjMT.js";let s=h();function h(){return new v(50)}function T(){s=h()}async function x(r,i){var o,t;if((o=r.resource)!=null&&o.href)return g(r.resource.href).then(e=>[e.width,e.height]);if((t=r.resource)!=null&&t.primitive)return i!=null?[i,i]:[256,256];throw new n("symbol3d:invalid-symbol-layer","symbol layers of type Icon must have either an href or a primitive resource")}function g(r){return y(r,{responseType:"image"}).then(i=>i.data)}async function B(r,i=null){var t;if(!r.isPrimitive){const e=r.resource.href;if(!e)throw new n("symbol:invalid-resource","The symbol does not have a valid resource");const a=s.get(e);if(a!==void 0)return a;const{fetch:f}=await p(()=>import("./index-J0iiHjMT.js").then(d=>d.zI),__vite__mapDeps([0,1])),m=await f(e,{disableTextures:!0}),u=c(m.referenceBoundingBox,l());return s.put(e,u),u}if(!((t=r.resource)!=null&&t.primitive))throw new n("symbol:invalid-resource","The symbol does not have a valid resource");const o=w(b(r.resource.primitive));if(i!=null)for(let e=0;e[e.width,e.height]);if((t=r.resource)!=null&&t.primitive)return i!=null?[i,i]:[256,256];throw new n("symbol3d:invalid-symbol-layer","symbol layers of type Icon must have either an href or a primitive resource")}function g(r){return y(r,{responseType:"image"}).then(i=>i.data)}async function B(r,i=null){var t;if(!r.isPrimitive){const e=r.resource.href;if(!e)throw new n("symbol:invalid-resource","The symbol does not have a valid resource");const a=s.get(e);if(a!==void 0)return a;const{fetch:h}=await p(()=>import("./index-pCX-0tJH.js").then(d=>d.z$),__vite__mapDeps([0,1])),m=await h(e,{disableTextures:!0}),u=c(m.referenceBoundingBox,l());return s.put(e,u),u}if(!((t=r.resource)!=null&&t.primitive))throw new n("symbol:invalid-resource","The symbol does not have a valid resource");const o=w(b(r.resource.primitive));if(i!=null)for(let e=0;e __vite__mapDeps.viteFileDeps[i]) } \ No newline at end of file diff --git a/dist/assets/symbologySnappingCandidates-Sz0MFOvR.js b/dist/assets/symbologySnappingCandidates-Sz0MFOvR.js deleted file mode 100644 index 0a857ba..0000000 --- a/dist/assets/symbologySnappingCandidates-Sz0MFOvR.js +++ /dev/null @@ -1 +0,0 @@ -import{gu as $,dA as z,ld as I,s as x,lU as b,bI as g,lV as y}from"./index-J0iiHjMT.js";function D(a=!1,e){if(a){const{elevationInfo:t,alignPointsInFeatures:n}=e;return new v(t,n)}return new m}let m=class{async alignCandidates(e,t,n){return e}notifyElevationSourceChange(){}};const w=1024;let v=class{constructor(e,t){this._elevationInfo=e,this._alignPointsInFeatures=t,this._alignmentsCache=new $(w),this._cacheVersion=0}async alignCandidates(e,t,n){const s=this._elevationInfo;return s==null||s.mode!=="absolute-height"||s.featureExpressionInfo?this._alignComputedElevationCandidates(e,t,n):(this._alignAbsoluteElevationCandidates(e,t,s),e)}notifyElevationSourceChange(){this._alignmentsCache.clear(),this._cacheVersion++}_alignAbsoluteElevationCandidates(e,t,n){const{offset:s,unit:i}=n;if(s==null)return;const r=z(t),o=s*(b(i??"meters")/r);for(const c of e)switch(c.type){case"edge":c.start.z+=o,c.end.z+=o;continue;case"vertex":c.target.z+=o;continue}}async _alignComputedElevationCandidates(e,t,n){const s=new Map;for(const u of e)I(s,u.objectId,S).push(u);const[i,r,o]=this._prepareQuery(s,t),c=await this._alignPointsInFeatures(i,n);if(x(n),o!==this._cacheVersion)return this._alignComputedElevationCandidates(e,t,n);this._applyCacheAndResponse(i,c,r);const{drapedObjectIds:d,failedObjectIds:f}=c,h=[];for(const u of e){const{objectId:l}=u;d.has(l)&&u.type==="edge"&&(u.draped=!0),f.has(l)||h.push(u)}return h}_prepareQuery(e,t){const n=[],s=[];for(const[i,r]of e){const o=[];for(const c of r)this._addToQueriesOrCachedResult(i,c.target,o,s),c.type==="edge"&&(this._addToQueriesOrCachedResult(i,c.start,o,s),this._addToQueriesOrCachedResult(i,c.end,o,s));o.length!==0&&n.push({objectId:i,points:o})}return[{spatialReference:t.toJSON(),pointsInFeatures:n},s,this._cacheVersion]}_addToQueriesOrCachedResult(e,t,n,s){const i=_(e,t),r=this._alignmentsCache.get(i);r==null?n.push(t):s.push(new j(t,r))}_applyCacheAndResponse(e,{elevations:t,drapedObjectIds:n,failedObjectIds:s},i){for(const c of i)c.apply();let r=0;const o=this._alignmentsCache;for(const{objectId:c,points:d}of e.pointsInFeatures){if(s.has(c)){r+=d.length;continue}const f=!n.has(c);for(const h of d){const u=_(c,h),l=t[r++];h.z=l,f&&o.put(u,l,1)}}}};class j{constructor(e,t){this.point=e,this.z=t}apply(){this.point.z=this.z}}function _(a,{x:e,y:t,z:n,spatialReference:s}){return`${a}-${e}-${t}-${n??0}}-wkid:${s==null?void 0:s.wkid}`}function S(){return[]}class E{filter(e,t){return t}notifyElevationSourceChange(){}}let O=class{filter(e,t){const{point:n,distance:s}=e,{z:i}=n;if(i==null||t.length===0)return t;const r=A(s),o=this._updateCandidatesTo3D(t,n,r).filter(V);return o.sort(F),o}_updateCandidatesTo3D(e,t,n){for(const s of e)switch(s.type){case"edge":R(s,t,n);continue;case"vertex":T(s,t,n);continue}return e}};function V(a){return a.distance<=1}function W(a=!1){return a?new O:new E}function R(a,e,{x:t,y:n,z:s}){const{start:i,end:r,target:o}=a;a.draped||Q(o,e,i,r);const c=(e.x-o.x)/t,d=(e.y-o.y)/n,f=(e.z-o.z)/s;a.distance=Math.sqrt(c*c+d*d+f*f)}function Q(a,e,t,n){const s=n.x-t.x,i=n.y-t.y,r=n.z-t.z,o=s*s+i*i+r*r,c=(e.x-t.x)*s+(e.y-t.y)*i+r*(e.z-t.z),d=Math.min(1,Math.max(0,c/o)),f=t.x+s*d,h=t.y+i*d,u=t.z+r*d;a.x=f,a.y=h,a.z=u}function T(a,e,{x:t,y:n,z:s}){const{target:i}=a,r=(e.x-i.x)/t,o=(e.y-i.y)/n,c=(e.z-i.z)/s,d=Math.sqrt(r*r+o*o+c*c);a.distance=d}function A(a){return typeof a=="number"?{x:a,y:a,z:a}:a}function F(a,e){return a.distance-e.distance}function B(a=!1,e){return a?new k(e):new M}class M{async fetch(){return[]}notifySymbologyChange(){}}const P=1024;class k{constructor(e){this._getSymbologyCandidates=e,this._candidatesCache=new $(P),this._cacheVersion=0}async fetch(e,t){if(e.length===0)return[];const n=[],s=[],i=this._candidatesCache;for(const h of e){const u=C(h),l=i.get(u);if(l)for(const p of l)s.push(g(p));else n.push(h),i.put(u,[],1)}if(n.length===0)return s;const r=this._cacheVersion,{candidates:o,sourceCandidateIndices:c}=await this._getSymbologyCandidates(n,t);if(x(t),r!==this._cacheVersion)return this.fetch(e,t);const d=[],{length:f}=o;for(let h=0;hnew Error;class fs extends h{constructor(){super(`${w}:unsupported`,"Layer does not support asset uploads.",y())}}class gs extends h{constructor(){super(`${w}:no-glb-support`,"Layer does not support glb.",y())}}let hs=class extends h{constructor(){super(`${w}:no-supported-source`,"No supported external source found",y())}},ws=class extends h{constructor(){super(`${w}:not-base-64`,"Expected gltf data in base64 format after conversion.",y())}},ys=class extends h{constructor(){super(`${w}:unable-to-prepare-options`,"Unable to prepare uploadAsset request options.",y())}};class bs extends h{constructor(t,s){super(`${w}:bad-response`,`Bad response. Uploaded ${t} items and received ${s} results.`,y())}}let Ps=class extends h{constructor(t,s){super(`${w}-layer:upload-failed`,`Failed to upload mesh file ${t}. Error code: ${(s==null?void 0:s.code)??"-1"}. Error message: ${(s==null?void 0:s.messages)??"unknown"}`,y())}};class O extends h{constructor(t){super(`${w}-layer:unsupported-format`,`The service allowed us to upload an asset of FormatID ${t}, but it does not list it in its supported formats.`,y())}}let Ts=class extends h{constructor(){super(`${w}:convert3D-failed`,"convert3D failed.")}};const M={upload:{createFromFiles:.8,loadMesh:.2},uploadAssetBlobs:{prepareAssetItems:.9,uploadAssetItems:.1},uploadConvertibleSource:{uploadEditSource:.5,serviceAssetsToGlb:.5},uploadLocalMesh:{meshToAssetBlob:.5,uploadAssetBlobs:.5}};function b(e,t=o=>{},s){return new As(e,t,s)}class As{constructor(t,s=a=>{},o){if(this.onProgress=s,this.taskName=o,this._progressMap=new Map,this._startTime=void 0,this._timingsMap=new Map,typeof t=="number"){this._weights={};for(let a=0;a({start:o,end:0}));s===1&&(a.end=o)}this.emitProgress()}simulate(t,s){return q(o=>this.setProgress(t,o),s)}makeOnProgress(t){return s=>this.setProgress(t,s)}}function q(e=s=>{},t=Es){const s=performance.now();e(0);const o=setInterval(()=>{const a=performance.now()-s,n=1-Math.exp(-a/t);e(n)},Fs);return ts(()=>{clearInterval(o),e(1)})}function $s(e,t=vs){return D(S(e*C/t))}function xs(e,t=Ms){return D(S(e*C/t))}const vs=10,Ms=10,C=8e-6,Fs=v(50),Es=v(1e3),L=1e6,_=20*L,js=2e9,Is=3;async function Ns({data:e,name:t,description:s},o,a){let n=null;try{const r=g(o,"uploads"),i=g(r,"info"),{data:c}=await m(i,{query:{f:"json"},responseType:"json"});u(a);const p=os(o),l=c.maxUploadFileSize*L,f=p?js:l,x=p?Math.min(_,l):_;if(e.size>f)throw new Error("Data too large");const J=g(r,"register"),{data:F}=await m(J,{query:{f:"json",itemName:_s(t),description:s},responseType:"json",method:"post"});if(u(a),!F.success)throw new Error("Registration failed");const{itemID:W}=F.item;n=g(r,W);const K=g(n,"uploadPart"),E=Math.ceil(e.size/x),P=new Array;for(let d=0;d{for(;T.length!==0;){const d=P.length-T.length,A=T.pop(),$=new FormData,X=Q.simulate(d,$s(A.size));try{const Y=A;$.append("f","json"),$.append("file",Y),$.append("partId",`${d}`);const{data:ss}=await m(K,{timeout:0,body:$,responseType:"json",method:"post"});if(u(a),!ss.success)throw new Error("Part upload failed")}finally{X.remove()}}};for(let d=0;dA).join(",")},responseType:"json",method:"post"});if(u(a),!I.success)throw new Error("Commit failed");return I.item}catch(r){if(n!=null){const i=g(n,"delete");await m(i,{query:{f:"json"},responseType:"json",method:"post"})}throw r}}function _s(e){return e.replaceAll("/","_").replaceAll("\\","_")}async function re(e,t,s){var n;const o=e.length;if(!o)return(n=s==null?void 0:s.onProgress)==null||n.call(s,1),[];const a=b(o,s==null?void 0:s.onProgress,"uploadAssets");return Promise.all(e.map((r,i)=>Ds(r,t,{...s,onProgress:a.makeOnProgress(i)})))}async function Ds(e,{layer:t,ongoingUploads:s},o){var r;const a=s.get(e);if(a)return a;if(!Vs(t))throw new fs;if(Ss(e,t))return(r=o==null?void 0:o.onProgress)==null||r.call(o,1),e;const n=ks(e,t,o);s.set(e,n);try{await n}finally{s.delete(e)}return e}function Ss(e,t){const{parsedUrl:s}=t;return s!=null&&e.metadata.externalSources.some(o=>ps(o,s))}async function ks(e,t,s){const{metadata:o}=e,{displaySource:a}=o,n=R(a==null?void 0:a.source,t),r=!!n,i=o.externalSources.length>0,c=r?Us(n,t,s):i?Bs(e,t,s):Os(e,t,s),p=await c;return u(s),e.addExternalSources([p]),e}async function Us(e,t,s){return{source:await z(e,t,s),original:!0}}async function Bs(e,t,s){const o=G(t),{externalSources:a}=e.metadata,n=Cs(a,t);if(!n)throw new hs;const r=b(M.uploadConvertibleSource,s==null?void 0:s.onProgress,"uploadConvertibleSource"),i=await z(n,t,{onProgress:r.makeOnProgress("uploadEditSource")});e.addExternalSources([{source:i,original:!0}]);const c=n.reduce((l,{asset:f})=>f instanceof File?l+f.size:l,0),p=r.simulate("serviceAssetsToGlb",xs(c));try{return{source:await Ws(i,t,o)}}finally{p.remove()}}async function Os(e,t,s){const o=b(M.uploadLocalMesh,s==null?void 0:s.onProgress,"uploadLocalMesh"),a=qs(e,t,{...s,onProgress:o.makeOnProgress("meshToAssetBlob")});return{source:await H([a],t,{...s,onProgress:o.makeOnProgress("uploadAssetBlobs")}),extent:e.extent.clone(),original:!0}}async function qs(e,t,s){const o=G(t),a=await e.load(s),n=await a.toBinaryGLTF({ignoreLocalTransform:!0});u(s);const r=await n.buffer();return u(s),{blob:new Blob([r.data],{type:r.type}),assetName:`${as()}.glb`,assetType:o}}function Cs(e,t){for(const s of e){const o=R(s.source,t);if(o)return o}return null}function R(e,t){if(!e)return null;const{infoFor3D:{supportedFormats:s,editFormats:o}}=t,a=ms(e),n=new Array;let r=!1;for(let i=0;iRs(o,s)),t,s)}async function H(e,t,s){const o=b(M.uploadAssetBlobs,s==null?void 0:s.onProgress,"uploadAssetBlobs"),a=await Hs(e,t,{...s,onProgress:o.makeOnProgress("prepareAssetItems")});u(s);const n=a.map(({item:i})=>i),{uploadResults:r}=await Gs(n,t,{...s,onProgress:o.makeOnProgress("uploadAssetItems")});return u(s),e.map((i,c)=>Js(a[c],r[c],t))}async function Rs(e,t){const{asset:s,assetType:o}=e;if(s instanceof File)return{blob:s,assetName:s.name,assetType:o};const a=await s.toBlob(t);return u(t),{blob:a,assetName:s.assetName,assetType:o}}async function zs(e,t,s){const{blob:o,assetType:a,assetName:n}=e;let r=null;try{const i=await Ns({data:o,name:n},t.url,s);u(s),r={assetType:a,assetUploadId:i.itemID}}catch(i){cs(i),Zs().warnOnce(`Service ${t.url} does not support the REST Uploads API.`)}if(!r){const i=await ls(o);if(u(s),!i.isBase64)throw new ws;r={assetType:a,assetData:i.data}}if(!r)throw new ys;return{item:r,assetName:n}}function Hs(e,t,s){const o=b(e.length,s==null?void 0:s.onProgress,"prepareAssetItems");return Promise.all(e.map(async(a,n)=>{const r=zs(await a,t,{...s,onProgress:o.makeOnProgress(n)});return u(s),r}))}async function Gs(e,t,s){const o=q(s==null?void 0:s.onProgress);try{const a=await m(g(t.parsedUrl.path,"uploadAssets"),{timeout:0,query:{f:"json",assets:JSON.stringify(e)},method:"post",responseType:"json"});if(u(s),a.data.uploadResults.length!==e.length)throw new bs(e.length,a.data.uploadResults.length);return a.data}finally{o.remove()}}function Js(e,t,s){const{success:o}=t;if(!o){const{error:p}=t;throw new Ps(e.assetName,p)}const{assetHash:a}=t,{assetName:n,item:{assetType:r}}=e,{infoFor3D:{supportedFormats:i}}=s,c=ns(r,i);if(!c)throw new O(r);return new U(n,c,[new B(`${s.parsedUrl.path}/assets/${a}`,a)])}async function Ws(e,t,s){var p;const o=e.map(({assetName:l,parts:f})=>({assetName:l,assetHash:f[0].partHash})),a=(p=t.capabilities)==null?void 0:p.operations.supportsAsyncConvert3D,n={f:"json",assets:JSON.stringify(o),transportType:"esriTransportTypeUrl",targetFormat:s,async:a},r=g(t.parsedUrl.path,"convert3D");let i;try{i=(await(a?Qs:Ks)(r,{query:n,responseType:"json",timeout:0})).data}catch{throw new Ts}const{supportedFormats:c}=t.infoFor3D;return i.assets.map(l=>{const f=k(l.contentType,c);if(!f)throw new O(f);return new U(l.assetName,l.contentType,[new B(l.assetURL,l.assetHash)])})}function Ks(e,t){return m(e,t)}async function Qs(e,t){const s=(await m(e,t)).data.statusUrl;for(;;){const o=(await m(s,{query:{f:"json"},responseType:"json"})).data;switch(o.status){case"Completed":return m(o.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new Error(o.status);case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new Error}await rs(Xs)}}function Vs(e){return!!e.infoFor3D&&!!e.url}function G(e){const{infoFor3D:t}=e,s=k("model/gltf-binary",t.supportedFormats)??is("glb",t.supportedFormats);if(!s)throw new gs;return s}function Zs(){return us.getLogger("esri.layers.graphics.sources.support.uploadAssets")}const Xs=v(1e3);export{re as uploadAssets}; diff --git a/dist/assets/uploadAssets-e680_sb_.js b/dist/assets/uploadAssets-e680_sb_.js new file mode 100644 index 0000000..822a4f7 --- /dev/null +++ b/dist/assets/uploadAssets-e680_sb_.js @@ -0,0 +1 @@ +import{r as h,dE as N,ll as es,a0 as ts,ol as D,gJ as x,om as S,h8 as g,av as m,ab as u,dv as os,al as as,on as ns,an as U,mw as rs,ao as is,dL as cs,ms as ls,R as us}from"./index-pCX-0tJH.js";import{h as ps,N as ds,i as k,o as B,A as ms}from"./External-Pb5poJ0S.js";const w="upload-assets",y=()=>new Error;class fs extends h{constructor(){super(`${w}:unsupported`,"Layer does not support asset uploads.",y())}}class gs extends h{constructor(){super(`${w}:no-glb-support`,"Layer does not support glb.",y())}}let hs=class extends h{constructor(){super(`${w}:no-supported-source`,"No supported external source found",y())}},ws=class extends h{constructor(){super(`${w}:not-base-64`,"Expected gltf data in base64 format after conversion.",y())}},ys=class extends h{constructor(){super(`${w}:unable-to-prepare-options`,"Unable to prepare uploadAsset request options.",y())}};class bs extends h{constructor(t,s){super(`${w}:bad-response`,`Bad response. Uploaded ${t} items and received ${s} results.`,y())}}let Ps=class extends h{constructor(t,s){super(`${w}-layer:upload-failed`,`Failed to upload mesh file ${t}. Error code: ${(s==null?void 0:s.code)??"-1"}. Error message: ${(s==null?void 0:s.messages)??"unknown"}`,y())}};class O extends h{constructor(t){super(`${w}-layer:unsupported-format`,`The service allowed us to upload an asset of FormatID ${t}, but it does not list it in its supported formats.`,y())}}let Ts=class extends h{constructor(){super(`${w}:convert3D-failed`,"convert3D failed.")}};const F={upload:{createFromFiles:.8,loadMesh:.2},uploadAssetBlobs:{prepareAssetItems:.9,uploadAssetItems:.1},uploadConvertibleSource:{uploadEditSource:.5,serviceAssetsToGlb:.5},uploadLocalMesh:{meshToAssetBlob:.5,uploadAssetBlobs:.5}};function b(e,t=o=>{},s){return new As(e,t,s)}class As{constructor(t,s=a=>{},o){if(this.onProgress=s,this.taskName=o,this._progressMap=new Map,this._startTime=void 0,this._timingsMap=new Map,typeof t=="number"){this._weights={};for(let a=0;a({start:o,end:0}));s===1&&(a.end=o)}this.emitProgress()}simulate(t,s){return q(o=>this.setProgress(t,o),s)}makeOnProgress(t){return s=>this.setProgress(t,s)}}function q(e=s=>{},t=Ms){const s=performance.now();e(0);const o=setInterval(()=>{const a=performance.now()-s,n=1-Math.exp(-a/t);e(n)},Es);return ts(()=>{clearInterval(o),e(1)})}function $s(e,t=xs){return D(S(e*C/t))}function vs(e,t=Fs){return D(S(e*C/t))}const xs=10,Fs=10,C=8e-6,Es=x(50),Ms=x(1e3),L=1e6,_=20*L,js=2e9,Is=3;async function Ns({data:e,name:t,description:s},o,a){let n=null;try{const r=g(o,"uploads"),i=g(r,"info"),{data:c}=await m(i,{query:{f:"json"},responseType:"json"});u(a);const p=os(o),l=c.maxUploadFileSize*L,f=p?js:l,v=p?Math.min(_,l):_;if(e.size>f)throw new Error("Data too large");const J=g(r,"register"),{data:E}=await m(J,{query:{f:"json",itemName:_s(t),description:s},responseType:"json",method:"post"});if(u(a),!E.success)throw new Error("Registration failed");const{itemID:W}=E.item;n=g(r,W);const K=g(n,"uploadPart"),M=Math.ceil(e.size/v),P=new Array;for(let d=0;d{for(;T.length!==0;){const d=P.length-T.length,A=T.pop(),$=new FormData,Y=V.simulate(d,$s(A.size));try{const Z=A;$.append("f","json"),$.append("file",Z),$.append("partId",`${d}`);const{data:ss}=await m(K,{timeout:0,body:$,responseType:"json",method:"post"});if(u(a),!ss.success)throw new Error("Part upload failed")}finally{Y.remove()}}};for(let d=0;dA).join(",")},responseType:"json",method:"post"});if(u(a),!I.success)throw new Error("Commit failed");return I.item}catch(r){if(n!=null){const i=g(n,"delete");await m(i,{query:{f:"json"},responseType:"json",method:"post"})}throw r}}function _s(e){return e.replaceAll("/","_").replaceAll("\\","_")}async function re(e,t,s){var n;const o=e.length;if(!o)return(n=s==null?void 0:s.onProgress)==null||n.call(s,1),[];const a=b(o,s==null?void 0:s.onProgress,"uploadAssets");return Promise.all(e.map((r,i)=>Ds(r,t,{...s,onProgress:a.makeOnProgress(i)})))}async function Ds(e,{layer:t,ongoingUploads:s},o){var r;const a=s.get(e);if(a)return a;if(!Qs(t))throw new fs;if(Ss(e,t))return(r=o==null?void 0:o.onProgress)==null||r.call(o,1),e;const n=Us(e,t,o);s.set(e,n);try{await n}finally{s.delete(e)}return e}function Ss(e,t){const{parsedUrl:s}=t;return s!=null&&e.metadata.externalSources.some(o=>ps(o,s))}async function Us(e,t,s){const{metadata:o}=e,{displaySource:a}=o,n=R(a==null?void 0:a.source,t),r=!!n,i=o.externalSources.length>0,c=r?ks(n,t,s):i?Bs(e,t,s):Os(e,t,s),p=await c;return u(s),e.addExternalSources([p]),e}async function ks(e,t,s){return{source:await z(e,t,s),original:!0}}async function Bs(e,t,s){const o=G(t),{externalSources:a}=e.metadata,n=Cs(a,t);if(!n)throw new hs;const r=b(F.uploadConvertibleSource,s==null?void 0:s.onProgress,"uploadConvertibleSource"),i=await z(n,t,{onProgress:r.makeOnProgress("uploadEditSource")});e.addExternalSources([{source:i,original:!0}]);const c=n.reduce((l,{asset:f})=>f instanceof File?l+f.size:l,0),p=r.simulate("serviceAssetsToGlb",vs(c));try{return{source:await Ws(i,t,o)}}finally{p.remove()}}async function Os(e,t,s){const o=b(F.uploadLocalMesh,s==null?void 0:s.onProgress,"uploadLocalMesh"),a=qs(e,t,{...s,onProgress:o.makeOnProgress("meshToAssetBlob")});return{source:await H([a],t,{...s,onProgress:o.makeOnProgress("uploadAssetBlobs")}),extent:e.extent.clone(),original:!0}}async function qs(e,t,s){const o=G(t),a=await e.load(s),n=await a.toBinaryGLTF({ignoreLocalTransform:!0});u(s);const r=await n.buffer();return u(s),{blob:new Blob([r.data],{type:r.type}),assetName:`${as()}.glb`,assetType:o}}function Cs(e,t){for(const s of e){const o=R(s.source,t);if(o)return o}return null}function R(e,t){if(!e)return null;const{infoFor3D:{supportedFormats:s,editFormats:o}}=t,a=ms(e),n=new Array;let r=!1;for(let i=0;iRs(o,s)),t,s)}async function H(e,t,s){const o=b(F.uploadAssetBlobs,s==null?void 0:s.onProgress,"uploadAssetBlobs"),a=await Hs(e,t,{...s,onProgress:o.makeOnProgress("prepareAssetItems")});u(s);const n=a.map(({item:i})=>i),{uploadResults:r}=await Gs(n,t,{...s,onProgress:o.makeOnProgress("uploadAssetItems")});return u(s),e.map((i,c)=>Js(a[c],r[c],t))}async function Rs(e,t){const{asset:s,assetType:o}=e;if(s instanceof File)return{blob:s,assetName:s.name,assetType:o};const a=await s.toBlob(t);return u(t),{blob:a,assetName:s.assetName,assetType:o}}async function zs(e,t,s){const{blob:o,assetType:a,assetName:n}=e;let r=null;try{const i=await Ns({data:o,name:n},t.url,s);u(s),r={assetType:a,assetUploadId:i.itemID}}catch(i){cs(i),Xs().warnOnce(`Service ${t.url} does not support the REST Uploads API.`)}if(!r){const i=await ls(o);if(u(s),!i.isBase64)throw new ws;r={assetType:a,assetData:i.data}}if(!r)throw new ys;return{item:r,assetName:n}}function Hs(e,t,s){const o=b(e.length,s==null?void 0:s.onProgress,"prepareAssetItems");return Promise.all(e.map(async(a,n)=>{const r=zs(await a,t,{...s,onProgress:o.makeOnProgress(n)});return u(s),r}))}async function Gs(e,t,s){const o=q(s==null?void 0:s.onProgress);try{const a=await m(g(t.parsedUrl.path,"uploadAssets"),{timeout:0,query:{f:"json",assets:JSON.stringify(e)},method:"post",responseType:"json"});if(u(s),a.data.uploadResults.length!==e.length)throw new bs(e.length,a.data.uploadResults.length);return a.data}finally{o.remove()}}function Js(e,t,s){const{success:o}=t;if(!o){const{error:p}=t;throw new Ps(e.assetName,p)}const{assetHash:a}=t,{assetName:n,item:{assetType:r}}=e,{infoFor3D:{supportedFormats:i}}=s,c=ns(r,i);if(!c)throw new O(r);return new k(n,c,[new B(`${s.parsedUrl.path}/assets/${a}`,a)])}async function Ws(e,t,s){var p;const o=e.map(({assetName:l,parts:f})=>({assetName:l,assetHash:f[0].partHash})),a=(p=t.capabilities)==null?void 0:p.operations.supportsAsyncConvert3D,n={f:"json",assets:JSON.stringify(o),transportType:"esriTransportTypeUrl",targetFormat:s,async:a},r=g(t.parsedUrl.path,"convert3D");let i;try{i=(await(a?Vs:Ks)(r,{query:n,responseType:"json",timeout:0})).data}catch{throw new Ts}const{supportedFormats:c}=t.infoFor3D;return i.assets.map(l=>{const f=U(l.contentType,c);if(!f)throw new O(f);return new k(l.assetName,l.contentType,[new B(l.assetURL,l.assetHash)])})}function Ks(e,t){return m(e,t)}async function Vs(e,t){const s=(await m(e,t)).data.statusUrl;for(;;){const o=(await m(s,{query:{f:"json"},responseType:"json"})).data;switch(o.status){case"Completed":return m(o.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new Error(o.status);case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new Error}await rs(Ys)}}function Qs(e){return!!e.infoFor3D&&!!e.url}function G(e){const{infoFor3D:t}=e,s=U("model/gltf-binary",t.supportedFormats)??is("glb",t.supportedFormats);if(!s)throw new gs;return s}function Xs(){return us.getLogger("esri.layers.graphics.sources.support.uploadAssets")}const Ys=x(1e3);export{re as uploadAssets}; diff --git a/dist/assets/utils-4xKNo3Tf.js b/dist/assets/utils-7NyN8ES_.js similarity index 92% rename from dist/assets/utils-4xKNo3Tf.js rename to dist/assets/utils-7NyN8ES_.js index ff9c703..1f39bc7 100644 --- a/dist/assets/utils-4xKNo3Tf.js +++ b/dist/assets/utils-7NyN8ES_.js @@ -1 +1 @@ -import{e as c,y as f,c as A,dr as de,f6 as We,dp as Mt,iw as Z,bI as W,ud as rs,dt as Nt,ue as os,du as Ft,uu as Dt,xn as $t,E as It,sm as Ae,T as Te,dT as is}from"./index-J0iiHjMT.js";import{b as as,u as x,M as us,O as ls,Q as St,S as cs,V as qe,o as Pe,X as ps,Y as hs,Z as fs,_ as ge,$ as Vt,a0 as ms,a1 as Xe,a2 as He,a3 as ds,a4 as K,a5 as gs,a6 as ys,a7 as ws,a8 as bs,a9 as xs,aa as Ut,ab as vs,ac as As,ad as Ts}from"./dataUtils-s_UKlouc.js";let Ot=class extends de{constructor(){super(...arguments),this.raster=void 0}};c([f({json:{write:!0}})],Ot.prototype,"raster",void 0),Ot=c([A("esri.layers.support.rasterFunctions.AspectFunctionArguments")],Ot);const U=Ot;var Lt;let Wt=Lt=class extends U{clone(){return new Lt({raster:this.raster})}};Wt=Lt=c([A("esri.layers.support.rasterFunctions.AspectFunctionArguments")],Wt);const Ps=Wt,$s=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let S=class extends de{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const e=[t],{parameters:s}=t;let o=s.rasters||s.raster&&[s.raster];for(;o!=null&&o.length;){e.unshift(...o);const n=[];for(let u=0;u=0;n--)e[n].isNoopProcess&&e.splice(n,1);let r=!1;for(let n=0;n1}const a=e.some(({name:n})=>$s.has(n.toLowerCase()));return{functions:e,hasBranches:r,hasFocalFunction:a}}bind(t,e=!1,s=-1){this.id=s+1;const o=this._getRasterValues();let r=!0;for(let a=0;athis._readRasterValue(o,t));return this._processPixels({...t,pixelBlocks:s})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);let e;if(t.length>1){const r=t.map(n=>n.processInputBandIds()[0]);this.rawInputBandIds=r,this.isInputBandIdsSwizzled=this.rawInputBandIds.some((n,u)=>n!==u);const a=t.filter(n=>n.functionName==="ExtractBand");return a.length&&a.forEach((n,u)=>{n.isInputBandIdsSwizzled=!0,n.swizzledBandSelection=[u,u,u]}),this.rawInputBandIds}const s=t[0];if(s){if(e=s.processInputBandIds(),s.isInputBandIdsSwizzled)return this.rawInputBandIds=e,e}else{e=[];const{bandCount:r}=this.sourceRasterInfos[0];for(let a=0;ar!==a),this.rawInputBandIds=o,this.rawInputBandIds}getPrimaryRasters(){const t=[],e=[];return this._getPrimaryRasters(this,t,e),{rasters:t,rasterIds:e}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:e,rasters:s}=this.functionArguments;return s&&Array.isArray(s)&&s.length?(t.rasters=s.map(o=>this._isRasterFunctionValue(o)?o.getWebGLProcessorDefinition():typeof o=="number"?{name:"Constant",parameters:{value:o},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:o},pixelType:"f32",id:-1,isNoopProcess:!1}),t.rasters.some(o=>o!=null)||(t.rasters=null)):this._isRasterFunctionValue(e)&&(t.raster=e.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}_getOutputPixelType(t){return this.outputPixelType==="unknown"?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_isOutputRoundingNeeded(){const{outputPixelType:t}=this;return((t==null?void 0:t.startsWith("u"))||(t==null?void 0:t.startsWith("s")))??!1}_getRasterValues(){const{rasterArgumentNames:t}=this;return t[0]==="rasters"?this.functionArguments.rasters??[]:t.flatMap(e=>this.functionArguments[e])}_getSourceRasterInfos(t){const e=this._getRasterValues(),{rasterInfos:s,rasterIds:o}=t;if(e.length===0)return s;const r=e.map(n=>n&&typeof n=="object"&&"bind"in n&&n.rasterInfo?n.rasterInfo:typeof n=="string"&&o.includes(n)?s[o.indexOf(n)]:typeof n!="number"?s[0]:void 0),a=r.find(n=>n)??s[0];return r.forEach((n,u)=>{n===void 0&&(r[u]=a)}),r}_getPrimaryRasterId(t){return t==null?void 0:t.url}_getPrimaryRasters(t,e=[],s=[]){for(let o=0;oe?o.slice(0,e):null),r&&r.length!==e&&(t.histograms=r.length>e?r.slice(0,e):null),s.BAND_COUNT&&Number(s.BAND_COUNT)!==e&&(t.keyProperties={...s,BAND_COUNT:typeof s.BAND_COUNT=="string"?String(e):e})}};c([f({json:{write:!0}})],S.prototype,"functionName",void 0),c([f({json:{write:!0}})],S.prototype,"functionArguments",void 0),c([f()],S.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}}),We(i=>i==null?void 0:i.toLowerCase())],S.prototype,"outputPixelType",void 0),c([f({json:{write:!0}})],S.prototype,"mainPrimaryRasterId",void 0),c([f()],S.prototype,"sourceRasters",void 0),c([f({type:[as],json:{write:!0}})],S.prototype,"sourceRasterInfos",void 0),c([f({json:{write:!0}})],S.prototype,"rasterInfo",void 0),c([f({json:{write:!0}})],S.prototype,"readingBufferSize",void 0),c([f({json:{write:!0}})],S.prototype,"id",void 0),c([f()],S.prototype,"isNoopProcess",void 0),c([f()],S.prototype,"supportsGPU",null),c([f()],S.prototype,"rawInputBandIds",void 0),c([f()],S.prototype,"isInputBandIdsSwizzled",void 0),c([f()],S.prototype,"swizzledBandSelection",void 0),c([f()],S.prototype,"isBranch",void 0),c([f()],S.prototype,"flatWebGLFunctionChain",null),c([f()],S.prototype,"_bindingResult",void 0),S=c([A("esri.layers.support.rasterFunctions.BaseRasterFunction")],S);const V=S;let rt=class extends V{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){var s;const t=this.sourceRasterInfos[0];this.isGCS=((s=t.spatialReference)==null?void 0:s.isGeographic)??!1,this.outputPixelType=this._getOutputPixelType("f32");const e=t.clone();return e.pixelType=this.outputPixelType,e.statistics=[{min:-1,max:360,avg:180,stddev:30}],e.histograms=null,e.colormap=null,e.attributeTable=null,e.bandCount=1,this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){var n;const e=(n=t.pixelBlocks)==null?void 0:n[0];if(e==null)return null;const{extent:s,primaryPixelSizes:o}=t,r=o==null?void 0:o[0],a=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1});return us(e,{resolution:a})}};c([f({json:{write:!0,name:"rasterFunction"}})],rt.prototype,"functionName",void 0),c([f({type:Ps,json:{write:!0,name:"rasterFunctionArguments"}})],rt.prototype,"functionArguments",void 0),c([f()],rt.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],rt.prototype,"isGCS",void 0),rt=c([A("esri.layers.support.rasterFunctions.AspectFunction")],rt);const Ns=rt,Fs=new Set(["+","-","*","/","(",")"]);function Is(i,t){(i=i.replaceAll(" ","")).startsWith("-")&&(i="0"+i),i.startsWith("+")&&(i=i.slice(1,i.length));const e=i.split(""),s=[],o=[];let r="";for(let a=0;a-1)e>0&&(o+=t+1);else{for(let a=0;a0&&(o+=t+1)}let r=0;for(let a=0;a0;){const{numIndex:a,opIndex:n}=Cs(o);if(s=Rs(i,o[n],r[a],r[a+1]),o.length===1)break;o=ks(o,n),r.splice(a,2,s)}return[s]}const js=new Mt({0:"custom",1:"ndvi",2:"savi",3:"tsavi",4:"msavi",5:"gemi",6:"pvi",7:"gvitm",8:"sultan",9:"vari",10:"gndvi",11:"sr",12:"ndvi-re",13:"sr-re",14:"mtvi2",15:"rtvi-core",16:"ci-re",17:"ci-g",18:"ndwi",19:"evi",20:"iron-oxide",21:"ferrous-minerals",22:"clay-minerals",23:"wndwi",24:"bai",25:"nbr",26:"ndbi",27:"ndmi",28:"ndsi",29:"mndwi"},{useNumericKeys:!0});function _s(i,t){if(!ls(i))return i;const{equation:e,method:s}=t,o=t.bandIndexes.map(p=>p-1),{pixels:r,mask:a}=i;let n;switch(s){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":n=$e(a,r[o[0]],r[o[1]]);break;case"ndwi":n=$e(a,r[o[1]],r[o[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":n=Ms(a,r[o[0]],r[o[1]]);break;case"ci-g":case"ci-re":n=Ds(a,r[o[0]],r[o[1]]);break;case"savi":n=Os(a,r[o[0]],r[o[1]],o[2]+1);break;case"tsavi":n=Es(a,r[o[0]],r[o[1]],o[2]+1,o[3]+1,o[4]+1);break;case"msavi":n=Gs(a,r[o[0]],r[o[1]]);break;case"gemi":n=zs(a,r[o[0]],r[o[1]]);break;case"pvi":n=Us(a,r[o[0]],r[o[1]],o[2]+1,o[3]+1);break;case"gvitm":n=Vs(a,[r[o[0]],r[o[1]],r[o[2]],r[o[3]],r[o[4]],r[o[5]]]);break;case"sultan":n=Ls(a,[r[o[0]],r[o[1]],r[o[2]],r[o[3]],r[o[4]],r[o[5]]]);break;case"vari":n=Ws(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"mtvi2":n=qs(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"rtvi-core":n=Xs(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"evi":n=Hs(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"wndwi":n=Js(a,[r[o[0]],r[o[1]],r[o[2]]],o[3]?o[3]+1:.5);break;case"bai":n=Ys(a,r[o[0]],r[o[1]]);break;case"custom":n=Bs(a,r,e);break;default:return i}const u=a!=null?new Uint8Array(a.length):null;a!=null&&u!=null&&u.set(a);const l=new x({width:i.width,height:i.height,pixelType:"f32",pixels:n,mask:u});return l.updateStatistics(),l}function Ss(i,t,e,s){const{mask:o,pixels:r,width:a,height:n}=i,u=r[e],l=r[t],p=l.length,h=s?new Uint8Array(p):new Float32Array(p),m=s?100:1,g=s?100.5:0;for(let y=0;yparseFloat(n));return _s(e,{method:s,bandIndexes:r,equation:o})}_getWebGLParameters(){const t=this.functionArguments.bandIndexes.split(" ").map(n=>parseFloat(n)-1);t.length===2&&t.push(0);const e=this.isInputBandIdsSwizzled?[0,1,2]:t;let s,o;const r=new Float32Array(3),{method:a}=this.functionArguments;switch(a){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":s=O([e[0],e[1],0]),o="ndxi";break;case"ndwi":s=O([e[1],e[0],0]),o="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":s=O([e[0],e[1],0]),o="sr";break;case"ci-g":case"ci-re":s=O([e[0],e[1],0]),o="ci";break;case"savi":s=O([e[0],e[1],0]),o="savi",r[0]=t[2]+1;break;case"tsavi":s=O([e[0],e[1],0]),o="tsavi",r[0]=t[2]+1,r[1]=t[3]+1,r[2]=t[4]+1;break;case"msavi":s=O([e[0],e[1],0]),o="msavi";break;case"gemi":s=O([e[0],e[1],0]),o="gemi";break;case"pvi":s=O([e[0],e[1],0]),o="tsavi",r[0]=t[2]+1,r[1]=t[3]+1;break;case"vari":s=O([e[0],e[1],e[2]]),o="vari";break;case"mtvi2":s=O([e[0],e[1],e[2]]),o="mtvi2";break;case"rtvi-core":s=O([e[0],e[1],e[2]]),o="rtvicore";break;case"evi":s=O([e[0],e[1],e[2]]),o="evi";break;case"wndwi":s=O([e[0],e[1],0]),o="wndwi",r[0]=t[3]?t[3]+1:.5;break;case"bai":s=O([e[1],e[0],0]),o="bai";break;default:s=O([0,1,2]),o="custom"}return{bandIndexMat3:s,indexType:o,adjustments:r}}_getInputBandIds(t){if(this.functionArguments.method==="custom")return t;const e=this.functionArguments.bandIndexes.split(" ").map(n=>parseFloat(n)-1),s=t.length,o=e.map(n=>n>=s?s-1:n),r=Zs.has(this.functionArguments.method)?3:2,a=o.slice(0,r).map(n=>t[n]);return a.length===2&&a.push(0),a}};c([f({json:{write:!0,name:"rasterFunction"}})],gt.prototype,"functionName",void 0),c([f({type:Ks,json:{write:!0,name:"rasterFunctionArguments"}})],gt.prototype,"functionArguments",void 0),c([f()],gt.prototype,"rasterArgumentNames",void 0),gt=c([A("esri.layers.support.rasterFunctions.BandArithmeticFunction")],gt);const Qs=gt;var Xt;let J=Xt=class extends U{castColormapName(i){if(!i)return null;const t=i.toLowerCase();return cs.includes(t)?t:null}readColorRamp(i){return os(i)}readColorRampName(i,t){if(!i)return null;const e=St.jsonValues.find(s=>s.toLowerCase()===i.toLowerCase());return e?St.fromJSON(e):null}clone(){var i;return new Xt({colormap:W(this.colormap),colormapName:this.colormapName,colorRamp:(i=this.colorRamp)==null?void 0:i.clone(),colorRampName:this.colorRampName})}};c([f({type:[[Number]],json:{write:!0}})],J.prototype,"colormap",void 0),c([f({type:String,json:{write:!0}})],J.prototype,"colormapName",void 0),c([We("colormapName")],J.prototype,"castColormapName",null),c([f({types:rs,json:{write:!0}})],J.prototype,"colorRamp",void 0),c([Nt("colorRamp")],J.prototype,"readColorRamp",null),c([f({type:St.apiValues,json:{type:St.jsonValues,write:St.write}})],J.prototype,"colorRampName",void 0),c([Nt("colorRampName")],J.prototype,"readColorRampName",null),J=Xt=c([A("esri.layers.support.rasterFunctions.ColormapFunctionArguments")],J);const tn=J,en=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[112,75,3],[113,76,3],[114,77,3],[115,77,3],[116,78,3],[117,79,3],[118,79,3],[119,80,3],[121,81,4],[122,82,4],[123,82,4],[124,83,4],[125,84,4],[126,84,4],[127,85,4],[128,86,4],[129,86,4],[130,87,4],[131,88,4],[132,89,4],[133,89,4],[134,90,4],[135,91,4],[136,91,4],[137,92,4],[138,93,4],[139,94,4],[140,94,4],[142,95,5],[143,96,5],[144,96,5],[145,97,5],[146,98,5],[147,99,5],[148,99,5],[149,100,5],[150,101,5],[151,101,5],[152,102,5],[153,103,5],[154,104,5],[155,104,5],[156,105,5],[157,106,5],[158,106,5],[159,107,5],[160,108,5],[161,108,5],[162,109,5],[164,110,6],[165,111,6],[166,111,6],[167,112,6],[168,113,6],[169,113,6],[170,114,6],[171,115,6],[172,116,6],[173,116,6],[174,117,6],[245,0,0],[245,5,0],[245,10,0],[246,15,0],[246,20,0],[246,25,0],[246,30,0],[247,35,0],[247,40,0],[247,45,0],[247,50,0],[247,55,0],[248,60,0],[248,65,0],[248,70,0],[248,75,0],[249,81,0],[249,86,0],[249,91,0],[249,96,0],[250,101,0],[250,106,0],[250,111,0],[250,116,0],[250,121,0],[251,126,0],[251,131,0],[251,136,0],[251,141,0],[252,146,0],[252,151,0],[252,156,0],[252,156,0],[251,159,0],[250,162,0],[249,165,0],[248,168,0],[247,171,0],[246,174,0],[245,177,0],[245,179,0],[244,182,0],[243,185,0],[242,188,0],[241,191,0],[240,194,0],[239,197,0],[238,200,0],[237,203,0],[236,206,0],[235,209,0],[234,212,0],[233,215,0],[232,218,0],[231,221,0],[230,224,0],[230,226,0],[229,229,0],[228,232,0],[227,235,0],[226,238,0],[225,241,0],[224,244,0],[223,247,0],[165,247,0],[163,244,0],[161,240,0],[158,237,0],[156,233,1],[154,230,1],[152,227,1],[149,223,1],[147,220,1],[145,216,1],[143,213,1],[140,210,2],[138,206,2],[136,203,2],[134,200,2],[132,196,2],[129,193,2],[127,189,2],[125,186,3],[123,183,3],[120,179,3],[118,176,3],[116,172,3],[114,169,3],[111,166,3],[109,162,4],[107,159,4],[105,155,4],[103,152,4],[100,149,4],[98,145,4],[96,142,4],[94,138,5],[91,135,5],[89,132,5],[87,128,5],[85,125,5],[82,121,5],[80,118,5],[78,115,6],[76,111,6],[73,108,6],[71,105,6],[69,101,6],[67,98,6],[65,94,6],[62,91,7],[60,88,7],[58,84,7],[56,81,7],[53,77,7],[51,74,7],[49,71,7],[47,67,8],[44,64,8],[42,60,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8]],sn=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[245,20,0],[245,24,0],[245,29,0],[245,31,0],[247,33,0],[247,33,0],[247,37,0],[247,41,0],[247,41,0],[247,41,0],[247,45,0],[247,45,0],[247,47,0],[247,49,0],[247,49,0],[247,54,0],[247,54,0],[247,56,0],[247,58,0],[247,58,0],[250,62,0],[250,62,0],[250,62,0],[250,67,0],[250,67,0],[250,67,0],[250,69,0],[250,71,0],[250,71,0],[250,75,0],[250,75,0],[250,78,0],[250,79,0],[250,79,0],[250,79,0],[250,81,0],[250,83,0],[250,83,0],[250,87,0],[250,87,0],[250,90,0],[250,92,0],[252,93,0],[252,93,0],[252,97,0],[252,97,0],[252,97,0],[252,97,0],[252,101,0],[252,101,0],[252,101,0],[252,101,0],[252,105,0],[252,105,0],[252,107,0],[252,109,0],[252,109,0],[252,113,13],[255,118,20],[255,119,23],[255,121,25],[255,126,33],[255,132,38],[255,133,40],[255,135,43],[255,141,48],[255,144,54],[255,150,59],[255,152,61],[255,153,64],[255,159,69],[255,163,77],[255,165,79],[255,168,82],[255,174,87],[255,176,92],[255,181,97],[255,183,99],[255,186,102],[255,191,107],[255,197,115],[255,201,120],[255,203,123],[255,205,125],[255,209,130],[255,214,138],[255,216,141],[255,218,143],[255,224,150],[255,228,156],[255,234,163],[255,236,165],[255,238,168],[255,243,173],[255,248,181],[255,252,186],[253,252,186],[250,252,187],[244,250,180],[238,247,176],[234,246,173],[231,245,169],[223,240,163],[217,237,157],[211,235,150],[205,233,146],[200,230,142],[195,227,136],[189,224,132],[184,222,126],[180,220,123],[174,217,119],[169,214,114],[163,212,108],[160,210,105],[154,207,101],[148,204,96],[143,201,93],[138,199,88],[134,197,84],[130,194,81],[126,191,77],[117,189,70],[115,186,68],[112,184,64],[106,181,60],[100,179,55],[94,176,49],[92,174,47],[90,173,45],[81,168,37],[75,166,33],[71,163,28],[66,160,24],[62,158,21],[56,156,14],[51,153,0],[51,153,0],[51,153,0],[50,150,0],[50,150,0],[50,150,0],[50,150,0],[49,148,0],[49,148,0],[49,148,0],[48,145,0],[48,145,0],[48,145,0],[48,145,0],[48,143,0],[48,143,0],[48,143,0],[48,143,0],[47,140,0],[47,140,0],[47,140,0],[47,140,0],[46,138,0],[46,138,0],[46,138,0],[46,138,0],[45,135,0],[45,135,0],[45,135,0],[45,135,0],[44,133,0],[44,133,0],[44,133,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[42,128,0],[42,128,0],[42,128,0],[42,125,0],[42,125,0],[42,125,0],[42,125,0],[41,122,0],[41,122,0],[41,122,0],[41,122,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[39,117,0],[39,117,0],[39,117,0],[39,117,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0]];function ye(i,t){const e=[],s=[];for(let r=0;r[s,...e]),t):null}let Q=class extends V{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:e,colormapName:s,colorRamp:o,colorRampName:r}=this.functionArguments;if(!(e!=null&&e.length))if(o)e=Pe(o,{interpolateAlpha:!0});else if(r){const n=ps(r);n&&(e=Pe(n))}else s&&(e=ln(s));if(!(e!=null&&e.length))return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};this.outputPixelType=this._getOutputPixelType("u8");const a=t.clone();return a.pixelType=this.outputPixelType,a.colormap=e,a.bandCount=1,this.rasterInfo=a,{success:!0,supportsGPU:!0}}_processPixels(t){var e;return(e=t.pixelBlocks)==null?void 0:e[0]}};c([f({json:{write:!0,name:"rasterFunction"}})],Q.prototype,"functionName",void 0),c([f({type:tn,json:{write:!0,name:"rasterFunctionArguments"}})],Q.prototype,"functionArguments",void 0),c([f()],Q.prototype,"rasterArgumentNames",void 0),c([f()],Q.prototype,"isNoopProcess",void 0),c([f({json:{write:!0}})],Q.prototype,"indexedColormap",void 0),Q=c([A("esri.layers.support.rasterFunctions.ColormapFunction")],Q);const cn=Q;var Ht;let Ct=Ht=class extends U{constructor(){super(...arguments),this.rasters=[]}writeRasters(i,t){t.rasters=i.map(e=>typeof e=="number"||typeof e=="string"?e:e.toJSON())}clone(){return new Ht({rasters:W(this.rasters)})}};c([f({json:{write:!0}})],Ct.prototype,"rasters",void 0),c([Ft("rasters")],Ct.prototype,"writeRasters",null),Ct=Ht=c([A("esri.layers.support.rasterFunctions.CompositeBandFunctionArguments")],Ct);const pn=Ct;let yt=class extends V{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();if(s.attributeTable=null,s.colormap=null,s.pixelType=this.outputPixelType,s.bandCount=t.map(({bandCount:r})=>r).reduce((r,a)=>r+a),t.every(({statistics:r})=>r!=null&&r.length)){const r=[];t.forEach(({statistics:a})=>a!=null&&r.push(...a)),s.statistics=r}if(t.every(({histograms:r})=>r!=null&&r.length)){const r=[];t.forEach(({histograms:a})=>a!=null&&r.push(...a)),s.histograms=r}s.bandCount>1&&(s.colormap=null,s.attributeTable=null);const o=t.every(r=>{var a;return(a=r.keyProperties.BandProperties)==null?void 0:a.length})?t.flatMap(r=>r.keyProperties.BandProperties):void 0;return s.keyProperties={...s.keyProperties,BandProperties:o},this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;return e?(e==null?void 0:e[0])==null?null:hs(e):null}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};c([f({json:{write:!0,name:"rasterFunction"}})],yt.prototype,"functionName",void 0),c([f({type:pn,json:{write:!0,name:"rasterFunctionArguments"}})],yt.prototype,"functionArguments",void 0),c([f()],yt.prototype,"rasterArgumentNames",void 0),yt=c([A("esri.layers.support.rasterFunctions.CompositeBandFunction")],yt);const hn=yt;var Jt;let Bt=Jt=class extends U{constructor(){super(...arguments),this.contrastOffset=0,this.brightnessOffset=0}clone(){return new Jt({contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset,raster:this.raster})}};c([f({json:{write:!0}})],Bt.prototype,"contrastOffset",void 0),c([f({json:{write:!0}})],Bt.prototype,"brightnessOffset",void 0),Bt=Jt=c([A("esri.layers.support.rasterFunctions.ContrastBrightnessFunctionArguments")],Bt);const fn=Bt;let ot=class extends V{constructor(){super(...arguments),this.functionName="ContrastBrightness",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];if(e.pixelType!=="u8")return{success:!1,supportsGPU:!1,error:"Only unsigned 8 bit raster is supported by ContrastBrightness function."};this.outputPixelType=this._getOutputPixelType("u8");const s=e.clone();s.colormap=null,s.statistics=null,s.histograms=null,this.rasterInfo=s;const{contrastOffset:o,brightnessOffset:r}=this.functionArguments;return this.lookup=fs(o,r),{success:!0,supportsGPU:!0}}_processPixels(t){var s;const e=(s=t.pixelBlocks)==null?void 0:s[0];return e==null?null:ge(e,{lut:e.pixels.map(()=>this.lookup),offset:0,outputPixelType:"u8"})}_getWebGLParameters(){const{contrastOffset:t,brightnessOffset:e}=this.functionArguments;return{contrastOffset:t,brightnessOffset:e}}};c([f({json:{write:!0,name:"rasterFunction"}})],ot.prototype,"functionName",void 0),c([f({type:fn,json:{write:!0,name:"rasterFunctionArguments"}})],ot.prototype,"functionArguments",void 0),c([f()],ot.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],ot.prototype,"lookup",void 0),ot=c([A("esri.layers.support.rasterFunctions.ContrastBrightnessFunction")],ot);const mn=ot,N={userDefined:-1,lineDetectionHorizontal:0,lineDetectionVertical:1,lineDetectionLeftDiagonal:2,lineDetectionRightDiagonal:3,gradientNorth:4,gradientWest:5,gradientEast:6,gradientSouth:7,gradientNorthEast:8,gradientNorthWest:9,smoothArithmeticMean:10,smoothing3x3:11,smoothing5x5:12,sharpening3x3:13,sharpening5x5:14,laplacian3x3:15,laplacian5x5:16,sobelHorizontal:17,sobelVertical:18,sharpen:19,sharpen2:20,pointSpread:21,none:255},dn={plus:1,minus:2,times:3,sqrt:4,power:5,abs:10,divide:23,exp:25,exp10:26,exp2:27,int:30,float:32,ln:35,log10:36,log2:37,mod:44,negate:45,roundDown:48,roundUp:49,square:53,floatDivide:64,floorDivide:65},L={bitwiseAnd:11,bitwiseLeftShift:12,bitwiseNot:13,bitwiseOr:14,bitwiseRightShift:15,bitwiseXOr:16,booleanAnd:17,booleanNot:18,booleanOr:19,booleanXOr:20,equalTo:24,greaterThan:28,greaterThanEqual:29,lessThan:33,lessThanEqual:34,isNull:31,notEqual:46},H={acos:6,asin:7,atan:8,atanh:9,cos:21,cosh:22,sin:51,sinh:52,tan:56,tanh:57,acosh:59,asinh:60,atan2:61},gn={majority:38,max:39,mean:40,med:41,min:42,minority:43,range:47,stddev:54,sum:55,variety:58,majorityIgnoreNoData:66,maxIgnoreNoData:67,meanIgnoreNoData:68,medIgnoreNoData:69,minIgnoreNoData:70,minorityIgnoreNoData:71,rangeIgnoreNoData:72,stddevIgnoreNoData:73,sumIgnoreNoData:74,varietyIgnoreNoData:75},Je={setNull:50,conditional:78},Ne={...dn,...L,...H,...gn,...Je};function we(i,t,e,s,o){const r=Math.floor(s/2);for(let n=0;nu+l);return a!==0&&a!==1&&(s=s.map(u=>u/a)),vn(e,{kernel:s,rows:o,cols:r,outputPixelType:this.outputPixelType})}_getWebGLParameters(){let{kernel:t}=this.functionArguments;const e=t.reduce((o,r)=>o+r);e!==0&&e!==1&&(t=t.map(o=>o/e));const s=new Float32Array(Ie);return s.set(t),{kernelRows:this.functionArguments.rows,kernelCols:this.functionArguments.cols,kernel:s,clampRange:Dt(this.outputPixelType)}}};c([f({json:{write:!0,name:"rasterFunction"}})],wt.prototype,"functionName",void 0),c([f({type:An,json:{write:!0,name:"rasterFunctionArguments"}})],wt.prototype,"functionArguments",void 0),c([f()],wt.prototype,"rasterArgumentNames",void 0),wt=c([A("esri.layers.support.rasterFunctions.ConvolutionFunction")],wt);const Tn=wt;var Kt;const Ye=new Mt({0:"standard",1:"platform",2:"profile"},{useNumericKeys:!0});let bt=Kt=class extends U{constructor(){super(...arguments),this.curvatureType="standard",this.zFactor=1}readCurvatureType(i,t){return Ye.fromJSON(t.type??t.curvatureType??0)}clone(){return new Kt({curvatureType:this.curvatureType,zFactor:this.zFactor,raster:this.raster})}};c([f({json:{write:{target:"type"}}}),Z(Ye)],bt.prototype,"curvatureType",void 0),c([Nt("curvatureType",["type","curvatureType"])],bt.prototype,"readCurvatureType",null),c([f({type:Number,json:{write:!0}})],bt.prototype,"zFactor",void 0),bt=Kt=c([A("esri.layers.support.rasterFunctions.CurvatureFunctionArguments")],bt);const Pn=bt;let at=class extends V{constructor(){super(...arguments),this.functionName="Curvature",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){var e;this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.bandCount=1,this.rasterInfo=t,this.isGCS=((e=t.spatialReference)==null?void 0:e.isGeographic)??!1,{success:!0,supportsGPU:!0}}_processPixels(t){var p;const e=(p=t.pixelBlocks)==null?void 0:p[0];if(e==null)return null;const{zFactor:s,curvatureType:o}=this.functionArguments,{extent:r,primaryPixelSizes:a}=t,n=a==null?void 0:a[0],u=n??(r?{x:r.width/e.width,y:r.height/e.height}:{x:1,y:1}),l=this.isGCS&&s>=1?s*Vt:s;return ms(e,{zFactor:l,curvatureType:o,resolution:u})}_getWebGLParameters(){const{zFactor:t,curvatureType:e}=this.functionArguments;return{curvatureType:e,zFactor:this.isGCS&&t>=1?t*Vt:t}}};c([f({json:{write:!0,name:"rasterFunction"}})],at.prototype,"functionName",void 0),c([f({type:Pn,json:{write:!0,name:"rasterFunctionArguments"}})],at.prototype,"functionArguments",void 0),c([f()],at.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],at.prototype,"isGCS",void 0),at=c([A("esri.layers.support.rasterFunctions.CurvatureFunction")],at);const $n=at;var Zt;let Y=Zt=class extends U{constructor(){super(...arguments),this.bandIds=[],this.bandNames=[],this.bandWavelengths=[],this.missingBandAction=Xe.bestMatch}clone(){var i,t,e;return new Zt({bandIds:(i=this.bandIds)==null?void 0:i.slice(),bandNames:(t=this.bandNames)==null?void 0:t.slice(),bandWavelengths:(e=this.bandWavelengths)==null?void 0:e.slice(),missingBandAction:this.missingBandAction,method:this.method,wavelengthMatchTolerance:this.wavelengthMatchTolerance})}};c([f({json:{write:!0}})],Y.prototype,"bandIds",void 0),c([f({json:{write:!0}})],Y.prototype,"bandNames",void 0),c([f({json:{write:!0}})],Y.prototype,"bandWavelengths",void 0),c([Z({0:"name",1:"wavelength",2:"id"})],Y.prototype,"method",void 0),c([f({json:{write:!0}})],Y.prototype,"missingBandAction",void 0),c([f({json:{write:!0}})],Y.prototype,"wavelengthMatchTolerance",void 0),Y=Zt=c([A("esri.layers.support.rasterFunctions.ExtractBandFunctionArguments")],Y);const Nn=Y;let xt=class extends V{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){var v;const{functionArguments:t,sourceRasterInfos:e}=this,s=e[0],{method:o,bandNames:r,bandWavelengths:a,bandIds:n,missingBandAction:u}=t,l=(r==null?void 0:r.length)&&(o==="name"||o!=="id"&&!(n!=null&&n.length)),p=(a==null?void 0:a.length)&&(o==="wavelength"||o!=="id"&&!(n!=null&&n.length)),h=u===Xe.fail,m=l?this._matchBandNames(s,r):p?this._matchBandWavelengths(s,a,h):this._matchBandIds(s,n,h);if(m==null)return{success:!1,supportsGPU:!1,error:`extract-band-function: Invalid ${l?"band names":p?"band wavelengths":"band ids"} for the imagery data source`};this.functionArguments.bandIds=m,this.functionArguments.method="id",this.outputPixelType=this._getOutputPixelType("f32");const g=s.clone();g.pixelType=this.outputPixelType,g.bandCount=m.length;const{statistics:w,histograms:y}=g;w!=null&&w.length&&(g.statistics=m.map(b=>w[b]||w[w.length-1])),y!=null&&y.length&&(g.histograms=m.map(b=>y[b]||y[y.length-1]));let d=(v=g.keyProperties)==null?void 0:v.BandProperties;return d!=null&&d.length&&(d=m.map(b=>b>=d.length?d[d.length-1]:d[b]),g.keyProperties={...g.keyProperties,BandProperties:d}),this.rasterInfo=g,{success:!0,supportsGPU:g.bandCount<=3}}_processPixels(t){var r;const e=(r=t.pixelBlocks)==null?void 0:r[0];if(e==null)return null;const s=e.pixels.length,o=this.functionArguments.bandIds.map(a=>a>=s?s-1:a);return e.extractBands(o)}_getWebGLParameters(){let t;if(this.isInputBandIdsSwizzled)t=this.swizzledBandSelection.length?this.swizzledBandSelection:[0,1,2];else{t=[...this.functionArguments.bandIds],t.length===0?t=[0,1,2]:t.length<3&&(t[1]=t[1]??t[0],t[2]=t[2]??t[1]);for(let e=0;e<3;e++)t[e]=Math.min(t[e],2)}return{bandIndexMat3:O(t)}}_getInputBandIds(t){const e=t.length;return this.functionArguments.bandIds.map(s=>s>=e?e-1:s).map(s=>t[s])}_matchBandNames(t,e){const s=t.bandInfos.map(({name:r})=>r.toLowerCase()),o=[];for(let r=0;ru.startsWith("nearinfrared_1")),n===-1&&(n=s.findIndex(u=>u.startsWith("nearinfrared")))),n===-1)return null;o.push(n)}return o}_matchBandIds(t,e,s){const{bandCount:o}=t;return!(e!=null&&e.length)||s&&e.some(r=>r<0||r>=o)?null:e}_matchBandWavelengths(t,e,s){const{bandInfos:o}=t,r=[];for(let u=0;u=w.minWavelength&&l<=w.maxWavelength,d=Math.abs(l-(w.minWavelength+w.maxWavelength)/2);y?dtypeof e=="number"||typeof e=="string"?e:e.toJSON())}clone(){return new Qt({operation:this.operation,processAsMultiband:this.processAsMultiband,rasters:W(this.rasters)})}};c([f({json:{write:!0}})],ut.prototype,"operation",void 0),c([f({json:{write:!0}})],ut.prototype,"rasters",void 0),c([Ft("rasters")],ut.prototype,"writeRasters",null),c([f({json:{write:!0}})],ut.prototype,"processAsMultiband",void 0),ut=Qt=c([A("esri.layers.support.rasterFunctions.LocalFunctionArguments")],ut);const In=ut,E=new Map;function Rn(i){return E.get(i)}E.set(H.acos,[0,Math.PI]),E.set(H.asin,[-Math.PI/2,Math.PI/2]),E.set(H.atan,[-Math.PI/2,Math.PI/2]),E.set(H.cos,[-1,1]),E.set(H.sin,[-1,1]),E.set(L.booleanAnd,[0,1]),E.set(L.booleanNot,[0,1]),E.set(L.booleanOr,[0,1]),E.set(L.booleanXOr,[0,1]),E.set(L.equalTo,[0,1]),E.set(L.notEqual,[0,1]),E.set(L.greaterThan,[0,1]),E.set(L.greaterThanEqual,[0,1]),E.set(L.lessThan,[0,1]),E.set(L.lessThanEqual,[0,1]),E.set(L.isNull,[0,1]);const Re=[0,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,2,1,1,1,999,999,1,1,999,1,1,2,999,999,2,2,999,999,999,999,999,999,999,999,999,999,3,999,3];function kn(i,t=!1){const e=i.map(n=>n.mask),s=e.filter(n=>n!=null),o=i[0].pixels[0].length;if(s.length===0)return new Uint8Array(o).fill(255);const r=s[0],a=new Uint8Array(r);if(s.length===1)return a;if(!t){for(let n=1;n=1?t[u]=0:a[u]=Math.atanh(l)}return a}const n=s===H.asin?Math.asin:Math.acos;for(let u=0;u1?t[u]=0:a[u]=n(l)}return a}function En(i,t,e,s){const[o]=i,r=o.length,a=x.createEmptyBand(e,r);for(let n=0;n>o[n]);return a}function qn(i,t,e){const[s,o]=i,r=s.length,a=x.createEmptyBand(e,r);for(let n=0;no[n]?1:0);return a}function or(i,t,e){const[s,o]=i,r=s.length,a=x.createEmptyBand(e,r);for(let n=0;n=o[n]?1:0);return a}function ir(i,t,e){const[s,o]=i,r=s.length,a=x.createEmptyBand(e,r);for(let n=0;np&&(u=p)}a[n]=u}return a}function je(i,t,e){const s=i.length;if(s<2)return i[0];const[o]=i,r=o.length,a=x.createEmptyBand(e,r);for(let n=0;nh&&(u=h)}a[n]=l-u}return a}function _e(i,t,e){const s=i.length;if(s<2)return i[0];const[o]=i,r=o.length,a=x.createEmptyBand(e,r);for(let n=0;np&&(p=l,u=h);r[n]=u}return r}function Ee(i,t,e){const s=i.length;if(s<=2)return Ze(i,t,e);const o=i[0].length,r=x.createEmptyBand(e,o),a=new Map;for(let n=0;nr?t[n]=0:s[n]=a?Math.round(u):u}}function dr(i,t,e={}){fr();let s=kn(i,t>=66&&t<=75);const{outputPixelType:o="f32"}=e,r=!_.has(t)||e.processAsMultiband,a=r?i[0].pixels.length:1,n=[];for(let l=0;lg.pixels):i.map(g=>g.pixels[l]);let h,m=!0;if(t===Je.setNull){const g=hr(p,s,o);h=g.band,s=g.mask,m=!1}else T.has(t)?h=T.get(t)(p,s,"f64"):M.has(t)?h=t===H.asin||t===H.acos||t===H.atanh?On(p,s,"f64",t):En(p,s,"f64",M.get(t)):zt.has(t)?h=Gn(p,s,"f64",zt.get(t)):_.has(t)?h=_.get(t)(p,s,"f64"):(h=p[0],m=!1);if(m&&t!==L.isNull&&!E.has(t)){const g=x.createEmptyBand(o,h.length);s||(s=new Uint8Array(h.length).fill(255)),mr(h,s,o,g),h=g}n.push(h)}const u=i[0];return new x({width:u.width,height:u.height,pixelType:o,mask:t===L.isNull?null:s,pixels:n})}let vt=class extends V{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0],{bandCount:s}=e,{processAsMultiband:o}=this.functionArguments;if(t.some(p=>p.bandCount!==s))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:r,rasters:a}=this.functionArguments,n=Re[r];if(!(n===999||a.length===n||a.length<=1&&n===1))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${n}`};this.outputPixelType=this._getOutputPixelType("f32");const u=e.clone();u.pixelType=this.outputPixelType,u.statistics=null,u.histograms=null,u.colormap=null,u.attributeTable=null,u.bandCount=n!==999||o?s:1;const l=Rn(r);if(l){u.statistics=[];for(let p=0;p16)}}_processPixels(t){const{pixelBlocks:e}=t;return e==null||e.some(s=>s==null)?null:dr(e,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){var u;const{operation:t}=this.functionArguments,e=Re[t],s=((u=Object.keys(Ne).find(l=>Ne[l]===t))==null?void 0:u.toLowerCase())??"undefined",o=this.outputPixelType??"f32";let[r,a]=Dt(o);const n=o.startsWith("u")||o.startsWith("s");return n&&(r-=1e-4,a+=1e-4),{imageCount:e,operationName:s,domainRange:[r,a],isOutputRounded:n}}};c([f({json:{write:!0,name:"rasterFunction"}})],vt.prototype,"functionName",void 0),c([f({type:In,json:{write:!0,name:"rasterFunctionArguments"}})],vt.prototype,"functionArguments",void 0),c([f()],vt.prototype,"rasterArgumentNames",void 0),vt=c([A("esri.layers.support.rasterFunctions.LocalFunction")],vt);const gr=vt;var te;let lt=te=class extends U{constructor(){super(...arguments),this.includedRanges=null,this.noDataValues=null,this.noDataInterpretation=He.matchAny}get normalizedNoDataValues(){const{noDataValues:i}=this;if(!(i!=null&&i.length))return null;let t=!1;const e=i.map(s=>{if(typeof s=="number")return t=!0,[s];if(typeof s=="string"){const o=s.trim().split(" ").filter(r=>r.trim()!=="").map(r=>Number(r));return t=t||o.length>0,o.length===0?null:o}return null});return t?e:null}clone(){var i,t;return new te({includedRanges:((i=this.includedRanges)==null?void 0:i.slice())??[],noDataValues:((t=this.noDataValues)==null?void 0:t.slice())??[],noDataInterpretation:this.noDataInterpretation})}};c([f({json:{write:!0}})],lt.prototype,"includedRanges",void 0),c([f({json:{write:!0}})],lt.prototype,"noDataValues",void 0),c([f()],lt.prototype,"normalizedNoDataValues",null),c([f({json:{write:!0}})],lt.prototype,"noDataInterpretation",void 0),lt=te=c([A("esri.layers.support.rasterFunctions.MaskFunctionArguments")],lt);const yr=lt;let ct=class extends V{constructor(){super(...arguments),this.functionName="Mask",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;this.outputPixelType=this._getOutputPixelType(e),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{includedRanges:s,normalizedNoDataValues:o}=this.functionArguments;if(!(s!=null&&s.length)&&!(o!=null&&o.length))return{success:!1,supportsGPU:!1,error:"missing includedRanges or noDataValues argument"};let r=[];for(let n=0;n{var u;return(n==null?void 0:n.length)===((u=o[0])==null?void 0:u.length)});return{success:!0,supportsGPU:(!s||s.length<=2*K)&&(!o||a&&o[0].length<=K)}}_processPixels(t){var l;const e=(l=t.pixelBlocks)==null?void 0:l[0];if(e==null)return null;const{outputPixelType:s,lookups:o}=this,{includedRanges:r,noDataInterpretation:a,normalizedNoDataValues:n}=this.functionArguments,u=a===He.matchAll;return gs(e,{includedRanges:r,noDataValues:n,outputPixelType:s,matchAll:u,lookups:o})}_getWebGLParameters(){var r;const{includedRanges:t,normalizedNoDataValues:e}=this.functionArguments,s=new Float32Array(K);s.fill($t),(r=e==null?void 0:e[0])!=null&&r.length&&s.set(e[0]);const o=new Float32Array(K);for(let a=0;a=o.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};const a=o.clone();a.pixelType=this.outputPixelType,a.colormap=null,a.histograms=null,a.bandCount=1,a.keyProperties={...a.keyProperties,BandProperties:void 0};const[n,u,l,p]=t?[-1,1,0,.1]:[0,200,100,10];return a.statistics=[{min:n,max:u,avg:l,stddev:p}],this.rasterInfo=a,{success:!0,supportsGPU:!0}}_processPixels(t){var a;const e=(a=t.pixelBlocks)==null?void 0:a[0];if(e==null)return null;const{visibleBandID:s,infraredBandID:o,scientificOutput:r}=this.functionArguments;return Ss(e,s,o,!r)}_getWebGLParameters(){const{visibleBandID:t,infraredBandID:e,scientificOutput:s}=this.functionArguments,o=this.isInputBandIdsSwizzled?[0,1,2]:[e,t,0];return{bandIndexMat3:O(o),scaled:!s}}_getInputBandIds(t){const{visibleBandID:e,infraredBandID:s}=this.functionArguments;return[s,e,0].map(o=>t[o])}};c([f({json:{write:!0,name:"rasterFunction"}})],Tt.prototype,"functionName",void 0),c([f({type:br,json:{write:!0,name:"rasterFunctionArguments"}})],Tt.prototype,"functionArguments",void 0),c([f()],Tt.prototype,"rasterArgumentNames",void 0),Tt=c([A("esri.layers.support.rasterFunctions.NDVIFunction")],Tt);const xr=Tt;var se;let tt=se=class extends U{constructor(){super(...arguments),this.inputRanges=null,this.outputValues=null,this.noDataRanges=null,this.allowUnmatched=!1,this.isLastInputRangeInclusive=!1}clone(){return new se({inputRanges:[...this.inputRanges],outputValues:[...this.outputValues],noDataRanges:[...this.noDataRanges],allowUnmatched:this.allowUnmatched,isLastInputRangeInclusive:this.isLastInputRangeInclusive})}};c([f({json:{write:!0}})],tt.prototype,"inputRanges",void 0),c([f({json:{write:!0}})],tt.prototype,"outputValues",void 0),c([f({json:{write:!0}})],tt.prototype,"noDataRanges",void 0),c([f({json:{write:!0}})],tt.prototype,"allowUnmatched",void 0),c([f({json:{write:!0}})],tt.prototype,"isLastInputRangeInclusive",void 0),tt=se=c([A("esri.layers.support.rasterFunctions.RemapFunctionArguments")],tt);const vr=tt;let pt=class extends V{constructor(){super(...arguments),this.functionName="Remap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;this.outputPixelType=this._getOutputPixelType(e),t.pixelType=this.outputPixelType,t.colormap=null,t.histograms=null,t.bandCount=1,t.attributeTable=null;const{statistics:s}=t,{allowUnmatched:o,outputValues:r,inputRanges:a,noDataRanges:n,isLastInputRangeInclusive:u}=this.functionArguments;if(s!=null&&s.length&&(r!=null&&r.length))if(o){const l=Math.min.apply(null,[...r,s[0].min]),p=Math.max.apply(null,[...r,s[0].max]);t.statistics=[{...s[0],min:l,max:p}]}else{let l=r[0],p=l;for(let h=0;hr[h]?r[h]:l,p=p>r[h]?p:r[h];t.statistics=[{...s[0],min:l,max:p}]}return this.rasterInfo=t,this.lookup=o?null:ys({srcPixelType:e,inputRanges:a,outputValues:r,noDataRanges:n,allowUnmatched:o,isLastInputRangeInclusive:u,outputPixelType:this.outputPixelType}),{success:!0,supportsGPU:(!r||r.length<=K)&&(!n||n.length<=K)}}_processPixels(t){var p;const e=(p=t.pixelBlocks)==null?void 0:p[0];if(e==null)return null;const{lookup:s,outputPixelType:o}=this;if(s){const h=ge(e,{lut:[s.lut],offset:s.offset,outputPixelType:o});return h!=null&&s.mask&&(h.mask=ws(e.pixels[0],e.mask,s.mask,s.offset,"u8")),h}const{inputRanges:r,outputValues:a,noDataRanges:n,allowUnmatched:u,isLastInputRangeInclusive:l}=this.functionArguments;return bs(e,{inputRanges:r,outputValues:a,noDataRanges:n,outputPixelType:o,allowUnmatched:u,isLastInputRangeInclusive:l})}_getWebGLParameters(){const{allowUnmatched:t,noDataRanges:e,isLastInputRangeInclusive:s}=this.functionArguments,o=new Float32Array(3*K),r=1e-5,a=this.functionArguments.inputRanges??[],n=this.functionArguments.outputValues??[],u=n.length;for(let p=0;p0&&(o[3*p]-=r),(p=1?t*Vt:t,slopeType:e,pixelSizeFactor:s??0,pixelSizePower:o??0}}};c([f({json:{write:!0,name:"rasterFunction"}})],ht.prototype,"functionName",void 0),c([f({type:Pr,json:{write:!0,name:"rasterFunctionArguments"}})],ht.prototype,"functionArguments",void 0),c([f()],ht.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],ht.prototype,"isGCS",void 0),ht=c([A("esri.layers.support.rasterFunctions.SlopeFunction")],ht);const $r=ht,ze=new Mt({1:"min",2:"max",3:"mean",4:"stddev",5:"median",6:"majority",7:"minority"},{useNumericKeys:!0});function Nr(i,t){const{fillNoDataOnly:e}=t,{band:s,width:o,height:r,mask:a,outBand:n}=i;if(e&&!a)return void n.set(s);const{statisticsType:u,kernelRows:l,kernelCols:p}=t,h=u==="stddev",m=o*r,g=new Float64Array(m),w=new Float64Array(m),y=new Uint32Array(m);for(let P=0;Pb-R),a?(m[y+d]=v[Math.floor((v.length-1)/2)],g[y+d]=v.length):n[y+d]=v[Math.floor((v.length-1)/2)])}}if(a)for(let w=p;wP&&(P=G,k=$);a?(w[v+b]=k,y[v+b]=R.size):n[v+b]=k}}if(a)for(let d=p;d1&&(n==null?void 0:n.length)){b=new Uint8Array(p),b.set(v[0]);for(let k=1;kNumber(i??(t==null?void 0:t.kernelRows)??3)}}})],ft.prototype,"rows",void 0),c([f({json:{write:!0,read:{source:["kernelCols","cols"],reader:(i,t)=>Number(i??(t==null?void 0:t.kernelCols)??3)}}})],ft.prototype,"cols",void 0),c([f({json:{write:!0}})],ft.prototype,"fillNoDataOnly",void 0),c([f({json:{read:{source:["statisticsType","type"],reader:(i,t)=>ze.fromJSON((t==null?void 0:t.statisticsType)??(t==null?void 0:t.type))??"min"},write:{target:"type"}}}),Z(ze)],ft.prototype,"statisticsType",void 0),ft=re=c([A("esri.layers.support.rasterFunctions.StatisticsFunctionArguments")],ft);const Cr=ft,Br=new Set(["min","max","mean","median","majority","minority"]);let Pt=class extends V{constructor(){super(...arguments),this.functionName="Statistics",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{type:t}=this.functionArguments.toJSON();if(t<1||t>7)return{success:!1,supportsGPU:!1,error:`statistics-function: the given statistics type is not supported ${t}`};const e=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();s.pixelType=this.outputPixelType;const{statisticsType:o}=this.functionArguments;return Br.has(o)||(s.statistics=null,s.histograms=null,s.colormap=null,s.attributeTable=null),this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3&&t<5}}_processPixels(t){var n;const e=(n=t.pixelBlocks)==null?void 0:n[0];if(e==null)return e;const{statisticsType:s,rows:o,cols:r,fillNoDataOnly:a}=this.functionArguments;return kr(e,{kernelRows:o,kernelCols:r,fillNoDataOnly:a,outputPixelType:this.outputPixelType,statisticsType:s,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:e,statisticsType:s,fillNoDataOnly:o}=this.functionArguments;return{fillNoDataOnly:o,kernelRows:t,kernelCols:e,statisticsType:s,clampRange:Dt(this.outputPixelType)}}};c([f({json:{write:!0,name:"rasterFunction"}})],Pt.prototype,"functionName",void 0),c([f({type:Cr,json:{write:!0,name:"rasterFunctionArguments"}})],Pt.prototype,"functionArguments",void 0),c([f()],Pt.prototype,"rasterArgumentNames",void 0),Pt=c([A("esri.layers.support.rasterFunctions.StatisticsFunction")],Pt);const jr=Pt;var oe;let mt=oe=class extends U{constructor(){super(...arguments),this.statistics=null,this.histograms=null}readStatistics(i,t){if(!(i!=null&&i.length))return null;const e=[];return i.forEach(s=>{const o={min:s.min,max:s.max,avg:s.avg??s.mean,stddev:s.stddev??s.standardDeviation};e.push(o)}),e}writeStatistics(i,t,e){if(!(i!=null&&i.length))return;const s=[];i.forEach(o=>{const r={...o,mean:o.avg,standardDeviation:o.stddev};delete r.avg,delete r.stddev,s.push(r)}),t[e]=s}clone(){return new oe({statistics:W(this.statistics),histograms:W(this.histograms)})}};c([f({json:{write:!0}})],mt.prototype,"statistics",void 0),c([Nt("statistics")],mt.prototype,"readStatistics",null),c([Ft("statistics")],mt.prototype,"writeStatistics",null),c([f({json:{write:!0}})],mt.prototype,"histograms",void 0),mt=oe=c([A("esri.layers.support.rasterFunctions.StatisticsHistogramFunctionArguments")],mt);const _r=mt;let st=class extends V{constructor(){super(...arguments),this.functionName="StatisticsHistogram",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone(),{statistics:s,histograms:o}=this.functionArguments;return o&&(e.histograms=o),s&&(e.statistics=s),this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){var e;return(e=t.pixelBlocks)==null?void 0:e[0]}};c([f({json:{write:!0,name:"rasterFunction"}})],st.prototype,"functionName",void 0),c([f({type:_r,json:{write:!0,name:"rasterFunctionArguments"}})],st.prototype,"functionArguments",void 0),c([f()],st.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],st.prototype,"indexedColormap",void 0),c([f()],st.prototype,"isNoopProcess",void 0),st=c([A("esri.layers.support.rasterFunctions.StatisticsHistogramFunction")],st);const Sr=st;var ie;const Mr=new Mt({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",9:"sigmoid"},{useNumericKeys:!0});let z=ie=class extends U{constructor(){super(...arguments),this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.histograms=null,this.statistics=null,this.stretchType="none",this.useGamma=!1}writeStatistics(i,t,e){i!=null&&i.length&&(Array.isArray(i[0])||(i=i.map(s=>[s.min,s.max,s.avg,s.stddev])),t[e]=i)}clone(){return new ie({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:W(this.statistics),gamma:W(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:W(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};c([f({type:Boolean,json:{write:!0}})],z.prototype,"computeGamma",void 0),c([f({type:Boolean,json:{name:"dra",write:!0}})],z.prototype,"dynamicRangeAdjustment",void 0),c([f({type:[Number],json:{write:!0}})],z.prototype,"gamma",void 0),c([f()],z.prototype,"histograms",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"maxPercent",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"minPercent",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"numberOfStandardDeviations",void 0),c([f({type:Number,json:{name:"max",write:!0}})],z.prototype,"outputMax",void 0),c([f({type:Number,json:{name:"min",write:!0}})],z.prototype,"outputMin",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"sigmoidStrengthLevel",void 0),c([f({json:{type:[[Number]],write:!0}})],z.prototype,"statistics",void 0),c([Ft("statistics")],z.prototype,"writeStatistics",null),c([Z(Mr)],z.prototype,"stretchType",void 0),c([f({type:Boolean,json:{write:!0}})],z.prototype,"useGamma",void 0),z=ie=c([A("esri.layers.support.rasterFunctions.StretchFunctionArguments")],z);const Dr=z;let nt=class extends V{constructor(){super(...arguments),this.functionName="Stretch",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null,this.cutOffs=null}_bindSourceRasters(){this.lookup=null,this.cutOffs=null;const t=this.sourceRasterInfos[0],{pixelType:e}=t,{functionArguments:s}=this,{dynamicRangeAdjustment:o,gamma:r,useGamma:a}=s;if(!o&&["u8","u16","s8","s16"].includes(e)){const u=Ut(s.toJSON(),{rasterInfo:t}),l=this._isOutputRoundingNeeded()?"round":"float";this.lookup=vs({pixelType:e,...u,gamma:a?r:null,rounding:l}),this.cutOffs=u}else o||(this.cutOffs=Ut(s.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(e);const n=t.clone();return n.pixelType=this.outputPixelType,n.statistics=null,n.histograms=null,n.colormap=null,n.attributeTable=null,this.outputPixelType==="u8"&&(n.keyProperties.DataType="processed"),this.rasterInfo=n,{success:!0,supportsGPU:!o}}_processPixels(t){var n;const e=(n=t.pixelBlocks)==null?void 0:n[0];if(e==null)return e;const{lookup:s}=this;if(s)return ge(e,{...s,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:o}=this,r=this.cutOffs||Ut(o.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:e}),a=o.useGamma?o.gamma:null;return As(e,{...r,gamma:a,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const{outputMin:t=0,outputMax:e=255,gamma:s,useGamma:o}=this.functionArguments,r=this.rasterInfo.bandCount>=2?3:1,a=o&&(s!=null&&s.length)?Ts(r,s):[1,1,1],{minCutOff:n,maxCutOff:u}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};n.length===1&&(n[1]=n[2]=n[0],u[1]=u[2]=u[0]);const l=new Float32Array(r);let p;for(p=0;p1||t.pixelType.startsWith("f"))return{success:!1,supportsGPU:!1,error:"table-function: Source data must be single band and integer pixel type."};const{attributeTableAsRecordSet:e}=this.functionArguments;if(!e)return{success:!1,supportsGPU:!1,error:"table-function: Missing attributeTableAsRecordSet argument."};this.outputPixelType=this._getOutputPixelType(t.pixelType);const s=t.clone();return s.pixelType=this.outputPixelType,s.bandCount=1,s.dataType!=="thematic"&&(s.keyProperties=s.keyProperties?{...s.keyProperties,DataType:"thematic"}:{DataType:"thematic"}),this.rasterInfo=s,{success:!0,supportsGPU:!0}}_processPixels(t){var e;return(e=t.pixelBlocks)==null?void 0:e[0]}};c([f({json:{write:!0,name:"rasterFunction"}})],dt.prototype,"functionName",void 0),c([f({type:Er,json:{write:!0,name:"rasterFunctionArguments"}})],dt.prototype,"functionArguments",void 0),c([f()],dt.prototype,"rasterArgumentNames",void 0),c([f()],dt.prototype,"isNoopProcess",void 0),dt=c([A("esri.layers.support.rasterFunctions.TableFunction")],dt);const Gr=dt,D=new Map;function zr(i,t){const{rasterFunctionArguments:e}=i;e&&(e.rasters||[e.raster]).forEach(s=>{s&&typeof s!="number"&&(typeof s=="string"?s.startsWith("http")&&(t.includes(s)||t.push(s)):"rasterFunctionArguments"in s&&zr(s,t))})}function xo(i,t){if(t=t??{},"function"in(i=W(i))&&"arguments"in i&&i.arguments){const e=es(i,new Map,t);if(ce(e),!e.renderingRule)throw new It("raster-function-helper","Unsupported raster function json.");i=e.renderingRule}if("rasterFunction"in i)return Qe(i=ue(i),t);throw new It("raster-function-helper","unsupported raster function json.")}function Ur(i,t){return t[0]==="rasters"&&Array.isArray(i.rasters)?i.rasters:t.map(e=>i[e])}function Ue(i){return!!(i&&typeof i=="object"&&i.rasterFunction&&i.rasterFunctionArguments)}function ue(i){var o;const{rasterFunction:t,rasterFunctionArguments:e}=i,s={};for(const r in e){let a=e[r];const n=r.toLowerCase();if(n==="rasters"&&Array.isArray(a))s.rasters=a.map(u=>Ue(u)?ue(u):u);else switch(Ue(a)&&(a=ue(a)),n){case"dra":s.dra=a;break;case"pspower":s.psPower=a;break;case"pszfactor":s.psZFactor=a;break;case"bandids":s.bandIds=a;break;default:s[r[0].toLowerCase()+r.slice(1)]=a}}return t!=="Local"||(o=s.rasters)!=null&&o.length||(s.rasters=["$$"]),{...i,rasterFunctionArguments:s}}function Qe(i,t){var m,g;const{rasterFunction:e,rasterFunctionArguments:s}=i,o=(m=i.outputPixelType)==null?void 0:m.toLowerCase();if(e==null||!D.has(e))throw new It("raster-function-helper",`unsupported raster function: ${e}`);const r=D.get(e),a=(typeof r.ctor=="function"?r.ctor:r.ctor.default).fromJSON({...i,outputPixelType:o}),{rasterArgumentNames:n}=a,u=[],l=Ur(s,n),p=n[0]==="rasters",h=[];for(let w=0;wtypeof r=="object"&&r.type==="RasterFunctionVariable"?le(r,t):r);if("value"in e&&["number","string","boolean"].includes(typeof e.value))return e.value;if(i.isDataset&&e.type!=="Scalar")return"$$";if(!("type"in e))return e;let s=e;switch(e.type){case"Scalar":s=e.value;break;case"AlgorithmicColorRamp":s=Ve(e);break;case"MultiPartColorRamp":s={type:"multipart",colorRamps:e.ArrayOfColorRamp.map(Ve)};break;case"ArgumentArray":if((o=e.elements)!=null&&o.length&&e.elements[0].type!=="RasterStatistics"){const r=[];for(let a=0;a{if(typeof n=="object")if(n._object_ref_id!=null){if(!e.has(n._object_ref_id))throw new It("raster-function-helper",`unsupported raster function json. _object_ref_id: ${r} does not exist`);const l=e.get(a);l&&typeof l=="object"?Object.assign(n,l):r[u]=l}else ce({renderingRule:n,templates:e})}));else{if(!e.has(a))throw new It("raster-function-helper",`unsupported raster function json. _object_ref_id: ${a} does not exist`);const n=e.get(a);o!=="_object_ref_id"?s[o]=n:n&&typeof n=="object"&&Object.assign(s,n)}}}function Vr(i){var t;(t=i.Statistics)!=null&&t.length&&typeof i.Statistics=="object"&&(i.Statistics=i.Statistics.map(e=>[e.min,e.max,e.mean,e.standardDeviation])),i.NumberOfStandardDeviation!=null&&(i.NumberOfStandardDeviations=i.NumberOfStandardDeviation,delete i.NumberOfStandardDeviation)}function Lr(i){var t,e;((e=(t=i.ColorRamp)==null?void 0:t.type)==null?void 0:e.toLowerCase())==="randomcolorramp"&&(delete i.ColorRamp,i.ColormapName="Random"),i.ColorSchemeType===0&&delete i.ColorRamp}function Wr(i){i.ConvolutionType!=null&&(i.Type=i.ConvolutionType,delete i.ConvolutionType)}function qr(i){var t;(t=i.NoDataValues)!=null&&t.length&&typeof i.NoDataValues[0]=="string"&&(i.NoDataValues=i.NoDataValues.filter(e=>e!=="").map(e=>Number(e)))}D.set("Aspect",{desc:"Aspect Function",ctor:Ns,rasterArgumentNames:["raster"]}),D.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:Qs,rasterArgumentNames:["raster"]}),D.set("Colormap",{desc:"Colormap Function",ctor:cn,rasterArgumentNames:["raster"]}),D.set("CompositeBand",{desc:"CompositeBand Function",ctor:hn,rasterArgumentNames:["rasters"]}),D.set("Convolution",{desc:"Convolution Function",ctor:Tn,rasterArgumentNames:["raster"]}),D.set("ContrastBrightness",{desc:"Contrast Brightness Function",ctor:mn,rasterArgumentNames:["raster"]}),D.set("ExtractBand",{desc:"ExtractBand Function",ctor:Fn,rasterArgumentNames:["raster"]}),D.set("Curvature",{desc:"Curvature Function",ctor:$n,rasterArgumentNames:["raster"]}),D.set("Local",{desc:"Local Function",ctor:gr,rasterArgumentNames:["rasters"]}),D.set("Mask",{desc:"Mask Function",ctor:wr,rasterArgumentNames:["raster"]}),D.set("NDVI",{desc:"NDVI Function",ctor:xr,rasterArgumentNames:["raster"]}),D.set("Remap",{desc:"Remap Function",ctor:Ar,rasterArgumentNames:["raster"]}),D.set("Slope",{desc:"Slope Function",ctor:$r,rasterArgumentNames:["raster"]}),D.set("Statistics",{desc:"Focal Statistics Function",ctor:jr,rasterArgumentNames:["raster"]}),D.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:Sr,rasterArgumentNames:["raster"]}),D.set("Stretch",{desc:"Stretch Function",ctor:Or,rasterArgumentNames:["raster"]}),D.set("Table",{desc:"Attribute Table Function",ctor:Gr,rasterArgumentNames:["raster"]});let jt=class extends de{get affectsPixelSize(){return!1}forwardTransform(i){return i}inverseTransform(i){return i}};c([f()],jt.prototype,"affectsPixelSize",null),c([f({json:{write:!0}})],jt.prototype,"spatialReference",void 0),jt=c([A("esri.layers.support.rasterTransforms.BaseRasterTransform")],jt);const ve=jt;var pe;let _t=pe=class extends ve{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(i){return(i=i.clone()).type==="point"?(i.x>180+this.tolerance&&(i.x-=360),i):(i.xmin>=180-this.tolerance?(i.xmax-=360,i.xmin-=360):i.xmax>180+this.tolerance&&(i.xmin=-180,i.xmax=180),i)}inverseTransform(i){return(i=i.clone()).type==="point"?(i.x<-this.tolerance&&(i.x+=360),i):(i.xmin<-this.tolerance&&(i.xmin+=360,i.xmax+=360),i)}clone(){return new pe({tolerance:this.tolerance})}};c([Z({GCSShiftXform:"gcs-shift"})],_t.prototype,"type",void 0),c([f()],_t.prototype,"tolerance",void 0),_t=pe=c([A("esri.layers.support.rasterTransforms.GCSShiftTransform")],_t);const Xr=_t;var he;let Gt=he=class extends ve{constructor(){super(...arguments),this.type="identity"}clone(){return new he}};c([Z({IdentityXform:"identity"})],Gt.prototype,"type",void 0),Gt=he=c([A("esri.layers.support.rasterTransforms.IdentityTransform")],Gt);const Hr=Gt;var fe;function me(i,t,e){const{x:s,y:o}=t;if(e<2)return{x:i[0]+s*i[2]+o*i[4],y:i[1]+s*i[3]+o*i[5]};if(e===2){const m=s*s,g=o*o,w=s*o;return{x:i[0]+s*i[2]+o*i[4]+m*i[6]+w*i[8]+g*i[10],y:i[1]+s*i[3]+o*i[5]+m*i[7]+w*i[9]+g*i[11]}}const r=s*s,a=o*o,n=s*o,u=r*s,l=r*o,p=s*a,h=o*a;return{x:i[0]+s*i[2]+o*i[4]+r*i[6]+n*i[8]+a*i[10]+u*i[12]+l*i[14]+p*i[16]+h*i[18],y:i[1]+s*i[3]+o*i[5]+r*i[7]+n*i[9]+a*i[11]+u*i[13]+l*i[15]+p*i[17]+h*i[19]}}function Le(i,t,e){const{xmin:s,ymin:o,xmax:r,ymax:a,spatialReference:n}=t;let u=[];if(e<2)u.push({x:s,y:a}),u.push({x:r,y:a}),u.push({x:s,y:o}),u.push({x:r,y:o});else{let h=10;for(let m=0;mme(i,h,e));const l=u.map(h=>h.x),p=u.map(h=>h.y);return new is({xmin:Math.min.apply(null,l),xmax:Math.max.apply(null,l),ymin:Math.min.apply(null,p),ymax:Math.max.apply(null,p),spatialReference:n})}function Jr(i){const[t,e,s,o,r,a]=i,n=s*a-r*o,u=r*o-s*a;return[(r*e-t*a)/n,(s*e-t*o)/u,a/n,o/u,-r/n,-s/u]}let X=fe=class extends ve{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(i,t){const{coeffX:e,coeffY:s}=t;if(!(e!=null&&e.length)||!(s!=null&&s.length)||e.length!==s.length)return null;const o=[];for(let r=0;r0}forwardTransform(i){if(i.type==="point"){const t=me(this.forwardCoefficients,i,this.polynomialOrder);return new Te({x:t.x,y:t.y,spatialReference:i.spatialReference})}return Le(this.forwardCoefficients,i,this.polynomialOrder)}inverseTransform(i){if(i.type==="point"){const t=me(this.inverseCoefficients,i,this.polynomialOrder);return new Te({x:t.x,y:t.y,spatialReference:i.spatialReference})}return Le(this.inverseCoefficients,i,this.polynomialOrder)}clone(){return new fe({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};c([f({json:{write:!0}})],X.prototype,"polynomialOrder",void 0),c([f()],X.prototype,"forwardCoefficients",void 0),c([Nt("forwardCoefficients",["coeffX","coeffY"])],X.prototype,"readForwardCoefficients",null),c([Ft("forwardCoefficients")],X.prototype,"writeForwardCoefficients",null),c([f({json:{write:!0}})],X.prototype,"inverseCoefficients",null),c([Nt("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],X.prototype,"readInverseCoefficients",null),c([Ft("inverseCoefficients")],X.prototype,"writeInverseCoefficients",null),c([f()],X.prototype,"affectsPixelSize",null),c([Z({PolynomialXform:"polynomial"})],X.prototype,"type",void 0),X=fe=c([A("esri.layers.support.rasterTransforms.PolynomialTransform")],X);const Yr=X,ns={GCSShiftXform:Xr,IdentityXform:Hr,PolynomialXform:Yr},Kr=Object.keys(ns);function vo(i){const t=i==null?void 0:i.type;return!i||Kr.includes(t)}function Ao(i){if(!(i==null?void 0:i.type))return null;const e=ns[i==null?void 0:i.type];if(e){const s=new e;return s.read(i),s}return null}export{zr as C,xo as R,vo as f,Ao as i,Xr as n,Yr as y}; +import{e as c,y as f,c as A,dr as de,f1 as We,dp as Mt,iy as Z,ah as W,ur as rs,dt as Nt,us as os,du as Ft,uI as Dt,xG as Tt,r as It,sz as Ae,L as Pe,dO as is}from"./index-pCX-0tJH.js";import{b as as,u as x,M as us,O as ls,Q as St,S as cs,V as qe,o as $e,X as ps,Y as hs,Z as fs,_ as ge,$ as Vt,a0 as ms,a1 as Xe,a2 as He,a3 as ds,a4 as K,a5 as gs,a6 as ys,a7 as ws,a8 as bs,a9 as xs,aa as Ut,ab as vs,ac as As,ad as Ps}from"./dataUtils-_QoSHbCE.js";let Ot=class extends de{constructor(){super(...arguments),this.raster=void 0}};c([f({json:{write:!0}})],Ot.prototype,"raster",void 0),Ot=c([A("esri.layers.support.rasterFunctions.AspectFunctionArguments")],Ot);const U=Ot;var Lt;let Wt=Lt=class extends U{clone(){return new Lt({raster:this.raster})}};Wt=Lt=c([A("esri.layers.support.rasterFunctions.AspectFunctionArguments")],Wt);const $s=Wt,Ts=new Set(["slope","aspect","curvature","hillshade","shadedrelief","statistics"]);let S=class extends de{constructor(){super(...arguments),this.functionArguments=null,this.readingBufferSize=0,this.id=-1,this.isNoopProcess=!1,this.rawInputBandIds=[],this.isInputBandIdsSwizzled=!1,this.swizzledBandSelection=[],this.isBranch=!1,this._bindingResult=null}get supportsGPU(){return this._bindingResult.supportsGPU}get flatWebGLFunctionChain(){const t=this.getWebGLProcessorDefinition();if(!t)return null;const e=[t],{parameters:s}=t;let o=s.rasters||s.raster&&[s.raster];for(;o!=null&&o.length;){e.unshift(...o);const n=[];for(let u=0;u=0;n--)e[n].isNoopProcess&&e.splice(n,1);let r=!1;for(let n=0;n1}const a=e.some(({name:n})=>Ts.has(n.toLowerCase()));return{functions:e,hasBranches:r,hasFocalFunction:a}}bind(t,e=!1,s=-1){this.id=s+1;const o=this._getRasterValues();let r=!0;for(let a=0;athis._readRasterValue(o,t));return this._processPixels({...t,pixelBlocks:s})}processInputBandIds(){const t=this._getRasterValues().filter(this._isRasterFunctionValue);let e;if(t.length>1){const r=t.map(n=>n.processInputBandIds()[0]);this.rawInputBandIds=r,this.isInputBandIdsSwizzled=this.rawInputBandIds.some((n,u)=>n!==u);const a=t.filter(n=>n.functionName==="ExtractBand");return a.length&&a.forEach((n,u)=>{n.isInputBandIdsSwizzled=!0,n.swizzledBandSelection=[u,u,u]}),this.rawInputBandIds}const s=t[0];if(s){if(e=s.processInputBandIds(),s.isInputBandIdsSwizzled)return this.rawInputBandIds=e,e}else{e=[];const{bandCount:r}=this.sourceRasterInfos[0];for(let a=0;ar!==a),this.rawInputBandIds=o,this.rawInputBandIds}getPrimaryRasters(){const t=[],e=[];return this._getPrimaryRasters(this,t,e),{rasters:t,rasterIds:e}}getWebGLProcessorDefinition(){const t=this._getWebGLParameters(),{raster:e,rasters:s}=this.functionArguments;return s&&Array.isArray(s)&&s.length?(t.rasters=s.map(o=>this._isRasterFunctionValue(o)?o.getWebGLProcessorDefinition():typeof o=="number"?{name:"Constant",parameters:{value:o},pixelType:"f32",id:-1,isNoopProcess:!1}:{name:"Identity",parameters:{value:o},pixelType:"f32",id:-1,isNoopProcess:!1}),t.rasters.some(o=>o!=null)||(t.rasters=null)):this._isRasterFunctionValue(e)&&(t.raster=e.getWebGLProcessorDefinition()),{name:this.functionName,parameters:t,pixelType:this.outputPixelType,id:this.id,isNoopProcess:this.isNoopProcess}}_getOutputPixelType(t){return this.outputPixelType==="unknown"?t:this.outputPixelType??t}_getWebGLParameters(){return{}}_getInputBandIds(t){return t}_isOutputRoundingNeeded(){const{outputPixelType:t}=this;return((t==null?void 0:t.startsWith("u"))||(t==null?void 0:t.startsWith("s")))??!1}_getRasterValues(){const{rasterArgumentNames:t}=this;return t[0]==="rasters"?this.functionArguments.rasters??[]:t.flatMap(e=>this.functionArguments[e])}_getSourceRasterInfos(t){const e=this._getRasterValues(),{rasterInfos:s,rasterIds:o}=t;if(e.length===0)return s;const r=e.map(n=>n&&typeof n=="object"&&"bind"in n&&n.rasterInfo?n.rasterInfo:typeof n=="string"&&o.includes(n)?s[o.indexOf(n)]:typeof n!="number"?s[0]:void 0),a=r.find(n=>n)??s[0];return r.forEach((n,u)=>{n===void 0&&(r[u]=a)}),r}_getPrimaryRasterId(t){return t==null?void 0:t.url}_getPrimaryRasters(t,e=[],s=[]){for(let o=0;oe?o.slice(0,e):null),r&&r.length!==e&&(t.histograms=r.length>e?r.slice(0,e):null),s.BAND_COUNT&&Number(s.BAND_COUNT)!==e&&(t.keyProperties={...s,BAND_COUNT:typeof s.BAND_COUNT=="string"?String(e):e})}};c([f({json:{write:!0}})],S.prototype,"functionName",void 0),c([f({json:{write:!0}})],S.prototype,"functionArguments",void 0),c([f()],S.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}}),We(i=>i==null?void 0:i.toLowerCase())],S.prototype,"outputPixelType",void 0),c([f({json:{write:!0}})],S.prototype,"mainPrimaryRasterId",void 0),c([f()],S.prototype,"sourceRasters",void 0),c([f({type:[as],json:{write:!0}})],S.prototype,"sourceRasterInfos",void 0),c([f({json:{write:!0}})],S.prototype,"rasterInfo",void 0),c([f({json:{write:!0}})],S.prototype,"readingBufferSize",void 0),c([f({json:{write:!0}})],S.prototype,"id",void 0),c([f()],S.prototype,"isNoopProcess",void 0),c([f()],S.prototype,"supportsGPU",null),c([f()],S.prototype,"rawInputBandIds",void 0),c([f()],S.prototype,"isInputBandIdsSwizzled",void 0),c([f()],S.prototype,"swizzledBandSelection",void 0),c([f()],S.prototype,"isBranch",void 0),c([f()],S.prototype,"flatWebGLFunctionChain",null),c([f()],S.prototype,"_bindingResult",void 0),S=c([A("esri.layers.support.rasterFunctions.BaseRasterFunction")],S);const V=S;let rt=class extends V{constructor(){super(...arguments),this.functionName="Aspect",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){var s;const t=this.sourceRasterInfos[0];this.isGCS=((s=t.spatialReference)==null?void 0:s.isGeographic)??!1,this.outputPixelType=this._getOutputPixelType("f32");const e=t.clone();return e.pixelType=this.outputPixelType,e.statistics=[{min:-1,max:360,avg:180,stddev:30}],e.histograms=null,e.colormap=null,e.attributeTable=null,e.bandCount=1,this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){var n;const e=(n=t.pixelBlocks)==null?void 0:n[0];if(e==null)return null;const{extent:s,primaryPixelSizes:o}=t,r=o==null?void 0:o[0],a=r??(s?{x:s.width/e.width,y:s.height/e.height}:{x:1,y:1});return us(e,{resolution:a})}};c([f({json:{write:!0,name:"rasterFunction"}})],rt.prototype,"functionName",void 0),c([f({type:$s,json:{write:!0,name:"rasterFunctionArguments"}})],rt.prototype,"functionArguments",void 0),c([f()],rt.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],rt.prototype,"isGCS",void 0),rt=c([A("esri.layers.support.rasterFunctions.AspectFunction")],rt);const Ns=rt,Fs=new Set(["+","-","*","/","(",")"]);function Is(i,t){(i=i.replaceAll(" ","")).startsWith("-")&&(i="0"+i),i.startsWith("+")&&(i=i.slice(1,i.length));const e=i.split(""),s=[],o=[];let r="";for(let a=0;a-1)e>0&&(o+=t+1);else{for(let a=0;a0&&(o+=t+1)}let r=0;for(let a=0;a0;){const{numIndex:a,opIndex:n}=Cs(o);if(s=Rs(i,o[n],r[a],r[a+1]),o.length===1)break;o=ks(o,n),r.splice(a,2,s)}return[s]}const js=new Mt({0:"custom",1:"ndvi",2:"savi",3:"tsavi",4:"msavi",5:"gemi",6:"pvi",7:"gvitm",8:"sultan",9:"vari",10:"gndvi",11:"sr",12:"ndvi-re",13:"sr-re",14:"mtvi2",15:"rtvi-core",16:"ci-re",17:"ci-g",18:"ndwi",19:"evi",20:"iron-oxide",21:"ferrous-minerals",22:"clay-minerals",23:"wndwi",24:"bai",25:"nbr",26:"ndbi",27:"ndmi",28:"ndsi",29:"mndwi"},{useNumericKeys:!0});function _s(i,t){if(!ls(i))return i;const{equation:e,method:s}=t,o=t.bandIndexes.map(p=>p-1),{pixels:r,mask:a}=i;let n;switch(s){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":n=Te(a,r[o[0]],r[o[1]]);break;case"ndwi":n=Te(a,r[o[1]],r[o[0]]);break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":n=Ms(a,r[o[0]],r[o[1]]);break;case"ci-g":case"ci-re":n=Ds(a,r[o[0]],r[o[1]]);break;case"savi":n=Os(a,r[o[0]],r[o[1]],o[2]+1);break;case"tsavi":n=Gs(a,r[o[0]],r[o[1]],o[2]+1,o[3]+1,o[4]+1);break;case"msavi":n=Es(a,r[o[0]],r[o[1]]);break;case"gemi":n=zs(a,r[o[0]],r[o[1]]);break;case"pvi":n=Us(a,r[o[0]],r[o[1]],o[2]+1,o[3]+1);break;case"gvitm":n=Vs(a,[r[o[0]],r[o[1]],r[o[2]],r[o[3]],r[o[4]],r[o[5]]]);break;case"sultan":n=Ls(a,[r[o[0]],r[o[1]],r[o[2]],r[o[3]],r[o[4]],r[o[5]]]);break;case"vari":n=Ws(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"mtvi2":n=qs(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"rtvi-core":n=Xs(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"evi":n=Hs(a,[r[o[0]],r[o[1]],r[o[2]]]);break;case"wndwi":n=Js(a,[r[o[0]],r[o[1]],r[o[2]]],o[3]?o[3]+1:.5);break;case"bai":n=Ys(a,r[o[0]],r[o[1]]);break;case"custom":n=Bs(a,r,e);break;default:return i}const u=a!=null?new Uint8Array(a.length):null;a!=null&&u!=null&&u.set(a);const l=new x({width:i.width,height:i.height,pixelType:"f32",pixels:n,mask:u});return l.updateStatistics(),l}function Ss(i,t,e,s){const{mask:o,pixels:r,width:a,height:n}=i,u=r[e],l=r[t],p=l.length,h=s?new Uint8Array(p):new Float32Array(p),m=s?100:1,g=s?100.5:0;for(let y=0;yparseFloat(n));return _s(e,{method:s,bandIndexes:r,equation:o})}_getWebGLParameters(){const t=this.functionArguments.bandIndexes.split(" ").map(n=>parseFloat(n)-1);t.length===2&&t.push(0);const e=this.isInputBandIdsSwizzled?[0,1,2]:t;let s,o;const r=new Float32Array(3),{method:a}=this.functionArguments;switch(a){case"gndvi":case"nbr":case"ndbi":case"ndvi":case"ndvi-re":case"ndsi":case"ndmi":case"mndwi":s=O([e[0],e[1],0]),o="ndxi";break;case"ndwi":s=O([e[1],e[0],0]),o="ndxi";break;case"sr":case"sr-re":case"iron-oxide":case"ferrous-minerals":case"clay-minerals":s=O([e[0],e[1],0]),o="sr";break;case"ci-g":case"ci-re":s=O([e[0],e[1],0]),o="ci";break;case"savi":s=O([e[0],e[1],0]),o="savi",r[0]=t[2]+1;break;case"tsavi":s=O([e[0],e[1],0]),o="tsavi",r[0]=t[2]+1,r[1]=t[3]+1,r[2]=t[4]+1;break;case"msavi":s=O([e[0],e[1],0]),o="msavi";break;case"gemi":s=O([e[0],e[1],0]),o="gemi";break;case"pvi":s=O([e[0],e[1],0]),o="tsavi",r[0]=t[2]+1,r[1]=t[3]+1;break;case"vari":s=O([e[0],e[1],e[2]]),o="vari";break;case"mtvi2":s=O([e[0],e[1],e[2]]),o="mtvi2";break;case"rtvi-core":s=O([e[0],e[1],e[2]]),o="rtvicore";break;case"evi":s=O([e[0],e[1],e[2]]),o="evi";break;case"wndwi":s=O([e[0],e[1],0]),o="wndwi",r[0]=t[3]?t[3]+1:.5;break;case"bai":s=O([e[1],e[0],0]),o="bai";break;default:s=O([0,1,2]),o="custom"}return{bandIndexMat3:s,indexType:o,adjustments:r}}_getInputBandIds(t){if(this.functionArguments.method==="custom")return t;const e=this.functionArguments.bandIndexes.split(" ").map(n=>parseFloat(n)-1),s=t.length,o=e.map(n=>n>=s?s-1:n),r=Zs.has(this.functionArguments.method)?3:2,a=o.slice(0,r).map(n=>t[n]);return a.length===2&&a.push(0),a}};c([f({json:{write:!0,name:"rasterFunction"}})],gt.prototype,"functionName",void 0),c([f({type:Ks,json:{write:!0,name:"rasterFunctionArguments"}})],gt.prototype,"functionArguments",void 0),c([f()],gt.prototype,"rasterArgumentNames",void 0),gt=c([A("esri.layers.support.rasterFunctions.BandArithmeticFunction")],gt);const Qs=gt;var Xt;let J=Xt=class extends U{castColormapName(i){if(!i)return null;const t=i.toLowerCase();return cs.includes(t)?t:null}readColorRamp(i){return os(i)}readColorRampName(i,t){if(!i)return null;const e=St.jsonValues.find(s=>s.toLowerCase()===i.toLowerCase());return e?St.fromJSON(e):null}clone(){var i;return new Xt({colormap:W(this.colormap),colormapName:this.colormapName,colorRamp:(i=this.colorRamp)==null?void 0:i.clone(),colorRampName:this.colorRampName})}};c([f({type:[[Number]],json:{write:!0}})],J.prototype,"colormap",void 0),c([f({type:String,json:{write:!0}})],J.prototype,"colormapName",void 0),c([We("colormapName")],J.prototype,"castColormapName",null),c([f({types:rs,json:{write:!0}})],J.prototype,"colorRamp",void 0),c([Nt("colorRamp")],J.prototype,"readColorRamp",null),c([f({type:St.apiValues,json:{type:St.jsonValues,write:St.write}})],J.prototype,"colorRampName",void 0),c([Nt("colorRampName")],J.prototype,"readColorRampName",null),J=Xt=c([A("esri.layers.support.rasterFunctions.ColormapFunctionArguments")],J);const tn=J,en=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[112,75,3],[113,76,3],[114,77,3],[115,77,3],[116,78,3],[117,79,3],[118,79,3],[119,80,3],[121,81,4],[122,82,4],[123,82,4],[124,83,4],[125,84,4],[126,84,4],[127,85,4],[128,86,4],[129,86,4],[130,87,4],[131,88,4],[132,89,4],[133,89,4],[134,90,4],[135,91,4],[136,91,4],[137,92,4],[138,93,4],[139,94,4],[140,94,4],[142,95,5],[143,96,5],[144,96,5],[145,97,5],[146,98,5],[147,99,5],[148,99,5],[149,100,5],[150,101,5],[151,101,5],[152,102,5],[153,103,5],[154,104,5],[155,104,5],[156,105,5],[157,106,5],[158,106,5],[159,107,5],[160,108,5],[161,108,5],[162,109,5],[164,110,6],[165,111,6],[166,111,6],[167,112,6],[168,113,6],[169,113,6],[170,114,6],[171,115,6],[172,116,6],[173,116,6],[174,117,6],[245,0,0],[245,5,0],[245,10,0],[246,15,0],[246,20,0],[246,25,0],[246,30,0],[247,35,0],[247,40,0],[247,45,0],[247,50,0],[247,55,0],[248,60,0],[248,65,0],[248,70,0],[248,75,0],[249,81,0],[249,86,0],[249,91,0],[249,96,0],[250,101,0],[250,106,0],[250,111,0],[250,116,0],[250,121,0],[251,126,0],[251,131,0],[251,136,0],[251,141,0],[252,146,0],[252,151,0],[252,156,0],[252,156,0],[251,159,0],[250,162,0],[249,165,0],[248,168,0],[247,171,0],[246,174,0],[245,177,0],[245,179,0],[244,182,0],[243,185,0],[242,188,0],[241,191,0],[240,194,0],[239,197,0],[238,200,0],[237,203,0],[236,206,0],[235,209,0],[234,212,0],[233,215,0],[232,218,0],[231,221,0],[230,224,0],[230,226,0],[229,229,0],[228,232,0],[227,235,0],[226,238,0],[225,241,0],[224,244,0],[223,247,0],[165,247,0],[163,244,0],[161,240,0],[158,237,0],[156,233,1],[154,230,1],[152,227,1],[149,223,1],[147,220,1],[145,216,1],[143,213,1],[140,210,2],[138,206,2],[136,203,2],[134,200,2],[132,196,2],[129,193,2],[127,189,2],[125,186,3],[123,183,3],[120,179,3],[118,176,3],[116,172,3],[114,169,3],[111,166,3],[109,162,4],[107,159,4],[105,155,4],[103,152,4],[100,149,4],[98,145,4],[96,142,4],[94,138,5],[91,135,5],[89,132,5],[87,128,5],[85,125,5],[82,121,5],[80,118,5],[78,115,6],[76,111,6],[73,108,6],[71,105,6],[69,101,6],[67,98,6],[65,94,6],[62,91,7],[60,88,7],[58,84,7],[56,81,7],[53,77,7],[51,74,7],[49,71,7],[47,67,8],[44,64,8],[42,60,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8],[40,57,8]],sn=[[36,0,255],[36,0,255],[36,0,255],[36,0,255],[245,20,0],[245,24,0],[245,29,0],[245,31,0],[247,33,0],[247,33,0],[247,37,0],[247,41,0],[247,41,0],[247,41,0],[247,45,0],[247,45,0],[247,47,0],[247,49,0],[247,49,0],[247,54,0],[247,54,0],[247,56,0],[247,58,0],[247,58,0],[250,62,0],[250,62,0],[250,62,0],[250,67,0],[250,67,0],[250,67,0],[250,69,0],[250,71,0],[250,71,0],[250,75,0],[250,75,0],[250,78,0],[250,79,0],[250,79,0],[250,79,0],[250,81,0],[250,83,0],[250,83,0],[250,87,0],[250,87,0],[250,90,0],[250,92,0],[252,93,0],[252,93,0],[252,97,0],[252,97,0],[252,97,0],[252,97,0],[252,101,0],[252,101,0],[252,101,0],[252,101,0],[252,105,0],[252,105,0],[252,107,0],[252,109,0],[252,109,0],[252,113,13],[255,118,20],[255,119,23],[255,121,25],[255,126,33],[255,132,38],[255,133,40],[255,135,43],[255,141,48],[255,144,54],[255,150,59],[255,152,61],[255,153,64],[255,159,69],[255,163,77],[255,165,79],[255,168,82],[255,174,87],[255,176,92],[255,181,97],[255,183,99],[255,186,102],[255,191,107],[255,197,115],[255,201,120],[255,203,123],[255,205,125],[255,209,130],[255,214,138],[255,216,141],[255,218,143],[255,224,150],[255,228,156],[255,234,163],[255,236,165],[255,238,168],[255,243,173],[255,248,181],[255,252,186],[253,252,186],[250,252,187],[244,250,180],[238,247,176],[234,246,173],[231,245,169],[223,240,163],[217,237,157],[211,235,150],[205,233,146],[200,230,142],[195,227,136],[189,224,132],[184,222,126],[180,220,123],[174,217,119],[169,214,114],[163,212,108],[160,210,105],[154,207,101],[148,204,96],[143,201,93],[138,199,88],[134,197,84],[130,194,81],[126,191,77],[117,189,70],[115,186,68],[112,184,64],[106,181,60],[100,179,55],[94,176,49],[92,174,47],[90,173,45],[81,168,37],[75,166,33],[71,163,28],[66,160,24],[62,158,21],[56,156,14],[51,153,0],[51,153,0],[51,153,0],[50,150,0],[50,150,0],[50,150,0],[50,150,0],[49,148,0],[49,148,0],[49,148,0],[48,145,0],[48,145,0],[48,145,0],[48,145,0],[48,143,0],[48,143,0],[48,143,0],[48,143,0],[47,140,0],[47,140,0],[47,140,0],[47,140,0],[46,138,0],[46,138,0],[46,138,0],[46,138,0],[45,135,0],[45,135,0],[45,135,0],[45,135,0],[44,133,0],[44,133,0],[44,133,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[43,130,0],[42,128,0],[42,128,0],[42,128,0],[42,125,0],[42,125,0],[42,125,0],[42,125,0],[41,122,0],[41,122,0],[41,122,0],[41,122,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[40,120,0],[39,117,0],[39,117,0],[39,117,0],[39,117,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0],[38,115,0]];function ye(i,t){const e=[],s=[];for(let r=0;r[s,...e]),t):null}let Q=class extends V{constructor(){super(...arguments),this.functionName="Colormap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];if(t.bandCount>1)return{success:!1,supportsGPU:!1,error:"colormap-function: source data must be single band"};let{colormap:e,colormapName:s,colorRamp:o,colorRampName:r}=this.functionArguments;if(!(e!=null&&e.length))if(o)e=$e(o,{interpolateAlpha:!0});else if(r){const n=ps(r);n&&(e=$e(n))}else s&&(e=ln(s));if(!(e!=null&&e.length))return{success:!1,supportsGPU:!1,error:"colormap-function: missing colormap argument"};this.outputPixelType=this._getOutputPixelType("u8");const a=t.clone();return a.pixelType=this.outputPixelType,a.colormap=e,a.bandCount=1,this.rasterInfo=a,{success:!0,supportsGPU:!0}}_processPixels(t){var e;return(e=t.pixelBlocks)==null?void 0:e[0]}};c([f({json:{write:!0,name:"rasterFunction"}})],Q.prototype,"functionName",void 0),c([f({type:tn,json:{write:!0,name:"rasterFunctionArguments"}})],Q.prototype,"functionArguments",void 0),c([f()],Q.prototype,"rasterArgumentNames",void 0),c([f()],Q.prototype,"isNoopProcess",void 0),c([f({json:{write:!0}})],Q.prototype,"indexedColormap",void 0),Q=c([A("esri.layers.support.rasterFunctions.ColormapFunction")],Q);const cn=Q;var Ht;let Ct=Ht=class extends U{constructor(){super(...arguments),this.rasters=[]}writeRasters(i,t){t.rasters=i.map(e=>typeof e=="number"||typeof e=="string"?e:e.toJSON())}clone(){return new Ht({rasters:W(this.rasters)})}};c([f({json:{write:!0}})],Ct.prototype,"rasters",void 0),c([Ft("rasters")],Ct.prototype,"writeRasters",null),Ct=Ht=c([A("esri.layers.support.rasterFunctions.CompositeBandFunctionArguments")],Ct);const pn=Ct;let yt=class extends V{constructor(){super(...arguments),this.functionName="CompositeBand",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();if(s.attributeTable=null,s.colormap=null,s.pixelType=this.outputPixelType,s.bandCount=t.map(({bandCount:r})=>r).reduce((r,a)=>r+a),t.every(({statistics:r})=>r!=null&&r.length)){const r=[];t.forEach(({statistics:a})=>a!=null&&r.push(...a)),s.statistics=r}if(t.every(({histograms:r})=>r!=null&&r.length)){const r=[];t.forEach(({histograms:a})=>a!=null&&r.push(...a)),s.histograms=r}s.bandCount>1&&(s.colormap=null,s.attributeTable=null);const o=t.every(r=>{var a;return(a=r.keyProperties.BandProperties)==null?void 0:a.length})?t.flatMap(r=>r.keyProperties.BandProperties):void 0;return s.keyProperties={...s.keyProperties,BandProperties:o},this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3}}_processPixels(t){const{pixelBlocks:e}=t;return e?(e==null?void 0:e[0])==null?null:hs(e):null}_getWebGLParameters(){return{bandCount:this.rasterInfo.bandCount}}};c([f({json:{write:!0,name:"rasterFunction"}})],yt.prototype,"functionName",void 0),c([f({type:pn,json:{write:!0,name:"rasterFunctionArguments"}})],yt.prototype,"functionArguments",void 0),c([f()],yt.prototype,"rasterArgumentNames",void 0),yt=c([A("esri.layers.support.rasterFunctions.CompositeBandFunction")],yt);const hn=yt;var Jt;let Bt=Jt=class extends U{constructor(){super(...arguments),this.contrastOffset=0,this.brightnessOffset=0}clone(){return new Jt({contrastOffset:this.contrastOffset,brightnessOffset:this.brightnessOffset,raster:this.raster})}};c([f({json:{write:!0}})],Bt.prototype,"contrastOffset",void 0),c([f({json:{write:!0}})],Bt.prototype,"brightnessOffset",void 0),Bt=Jt=c([A("esri.layers.support.rasterFunctions.ContrastBrightnessFunctionArguments")],Bt);const fn=Bt;let ot=class extends V{constructor(){super(...arguments),this.functionName="ContrastBrightness",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0];if(e.pixelType!=="u8")return{success:!1,supportsGPU:!1,error:"Only unsigned 8 bit raster is supported by ContrastBrightness function."};this.outputPixelType=this._getOutputPixelType("u8");const s=e.clone();s.colormap=null,s.statistics=null,s.histograms=null,this.rasterInfo=s;const{contrastOffset:o,brightnessOffset:r}=this.functionArguments;return this.lookup=fs(o,r),{success:!0,supportsGPU:!0}}_processPixels(t){var s;const e=(s=t.pixelBlocks)==null?void 0:s[0];return e==null?null:ge(e,{lut:e.pixels.map(()=>this.lookup),offset:0,outputPixelType:"u8"})}_getWebGLParameters(){const{contrastOffset:t,brightnessOffset:e}=this.functionArguments;return{contrastOffset:t,brightnessOffset:e}}};c([f({json:{write:!0,name:"rasterFunction"}})],ot.prototype,"functionName",void 0),c([f({type:fn,json:{write:!0,name:"rasterFunctionArguments"}})],ot.prototype,"functionArguments",void 0),c([f()],ot.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],ot.prototype,"lookup",void 0),ot=c([A("esri.layers.support.rasterFunctions.ContrastBrightnessFunction")],ot);const mn=ot,N={userDefined:-1,lineDetectionHorizontal:0,lineDetectionVertical:1,lineDetectionLeftDiagonal:2,lineDetectionRightDiagonal:3,gradientNorth:4,gradientWest:5,gradientEast:6,gradientSouth:7,gradientNorthEast:8,gradientNorthWest:9,smoothArithmeticMean:10,smoothing3x3:11,smoothing5x5:12,sharpening3x3:13,sharpening5x5:14,laplacian3x3:15,laplacian5x5:16,sobelHorizontal:17,sobelVertical:18,sharpen:19,sharpen2:20,pointSpread:21,none:255},dn={plus:1,minus:2,times:3,sqrt:4,power:5,abs:10,divide:23,exp:25,exp10:26,exp2:27,int:30,float:32,ln:35,log10:36,log2:37,mod:44,negate:45,roundDown:48,roundUp:49,square:53,floatDivide:64,floorDivide:65},L={bitwiseAnd:11,bitwiseLeftShift:12,bitwiseNot:13,bitwiseOr:14,bitwiseRightShift:15,bitwiseXOr:16,booleanAnd:17,booleanNot:18,booleanOr:19,booleanXOr:20,equalTo:24,greaterThan:28,greaterThanEqual:29,lessThan:33,lessThanEqual:34,isNull:31,notEqual:46},H={acos:6,asin:7,atan:8,atanh:9,cos:21,cosh:22,sin:51,sinh:52,tan:56,tanh:57,acosh:59,asinh:60,atan2:61},gn={majority:38,max:39,mean:40,med:41,min:42,minority:43,range:47,stddev:54,sum:55,variety:58,majorityIgnoreNoData:66,maxIgnoreNoData:67,meanIgnoreNoData:68,medIgnoreNoData:69,minIgnoreNoData:70,minorityIgnoreNoData:71,rangeIgnoreNoData:72,stddevIgnoreNoData:73,sumIgnoreNoData:74,varietyIgnoreNoData:75},Je={setNull:50,conditional:78},Ne={...dn,...L,...H,...gn,...Je};function we(i,t,e,s,o){const r=Math.floor(s/2);for(let n=0;nu+l);return a!==0&&a!==1&&(s=s.map(u=>u/a)),vn(e,{kernel:s,rows:o,cols:r,outputPixelType:this.outputPixelType})}_getWebGLParameters(){let{kernel:t}=this.functionArguments;const e=t.reduce((o,r)=>o+r);e!==0&&e!==1&&(t=t.map(o=>o/e));const s=new Float32Array(Ie);return s.set(t),{kernelRows:this.functionArguments.rows,kernelCols:this.functionArguments.cols,kernel:s,clampRange:Dt(this.outputPixelType)}}};c([f({json:{write:!0,name:"rasterFunction"}})],wt.prototype,"functionName",void 0),c([f({type:An,json:{write:!0,name:"rasterFunctionArguments"}})],wt.prototype,"functionArguments",void 0),c([f()],wt.prototype,"rasterArgumentNames",void 0),wt=c([A("esri.layers.support.rasterFunctions.ConvolutionFunction")],wt);const Pn=wt;var Kt;const Ye=new Mt({0:"standard",1:"platform",2:"profile"},{useNumericKeys:!0});let bt=Kt=class extends U{constructor(){super(...arguments),this.curvatureType="standard",this.zFactor=1}readCurvatureType(i,t){return Ye.fromJSON(t.type??t.curvatureType??0)}clone(){return new Kt({curvatureType:this.curvatureType,zFactor:this.zFactor,raster:this.raster})}};c([f({json:{write:{target:"type"}}}),Z(Ye)],bt.prototype,"curvatureType",void 0),c([Nt("curvatureType",["type","curvatureType"])],bt.prototype,"readCurvatureType",null),c([f({type:Number,json:{write:!0}})],bt.prototype,"zFactor",void 0),bt=Kt=c([A("esri.layers.support.rasterFunctions.CurvatureFunctionArguments")],bt);const $n=bt;let at=class extends V{constructor(){super(...arguments),this.functionName="Curvature",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isGCS=!1}_bindSourceRasters(){var e;this.outputPixelType=this._getOutputPixelType("f32");const t=this.sourceRasterInfos[0].clone();return t.pixelType=this.outputPixelType,t.statistics=null,t.histograms=null,t.colormap=null,t.attributeTable=null,t.bandCount=1,this.rasterInfo=t,this.isGCS=((e=t.spatialReference)==null?void 0:e.isGeographic)??!1,{success:!0,supportsGPU:!0}}_processPixels(t){var p;const e=(p=t.pixelBlocks)==null?void 0:p[0];if(e==null)return null;const{zFactor:s,curvatureType:o}=this.functionArguments,{extent:r,primaryPixelSizes:a}=t,n=a==null?void 0:a[0],u=n??(r?{x:r.width/e.width,y:r.height/e.height}:{x:1,y:1}),l=this.isGCS&&s>=1?s*Vt:s;return ms(e,{zFactor:l,curvatureType:o,resolution:u})}_getWebGLParameters(){const{zFactor:t,curvatureType:e}=this.functionArguments;return{curvatureType:e,zFactor:this.isGCS&&t>=1?t*Vt:t}}};c([f({json:{write:!0,name:"rasterFunction"}})],at.prototype,"functionName",void 0),c([f({type:$n,json:{write:!0,name:"rasterFunctionArguments"}})],at.prototype,"functionArguments",void 0),c([f()],at.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],at.prototype,"isGCS",void 0),at=c([A("esri.layers.support.rasterFunctions.CurvatureFunction")],at);const Tn=at;var Zt;let Y=Zt=class extends U{constructor(){super(...arguments),this.bandIds=[],this.bandNames=[],this.bandWavelengths=[],this.missingBandAction=Xe.bestMatch}clone(){var i,t,e;return new Zt({bandIds:(i=this.bandIds)==null?void 0:i.slice(),bandNames:(t=this.bandNames)==null?void 0:t.slice(),bandWavelengths:(e=this.bandWavelengths)==null?void 0:e.slice(),missingBandAction:this.missingBandAction,method:this.method,wavelengthMatchTolerance:this.wavelengthMatchTolerance})}};c([f({json:{write:!0}})],Y.prototype,"bandIds",void 0),c([f({json:{write:!0}})],Y.prototype,"bandNames",void 0),c([f({json:{write:!0}})],Y.prototype,"bandWavelengths",void 0),c([Z({0:"name",1:"wavelength",2:"id"})],Y.prototype,"method",void 0),c([f({json:{write:!0}})],Y.prototype,"missingBandAction",void 0),c([f({json:{write:!0}})],Y.prototype,"wavelengthMatchTolerance",void 0),Y=Zt=c([A("esri.layers.support.rasterFunctions.ExtractBandFunctionArguments")],Y);const Nn=Y;let xt=class extends V{constructor(){super(...arguments),this.functionName="ExtractBand",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){var v;const{functionArguments:t,sourceRasterInfos:e}=this,s=e[0],{method:o,bandNames:r,bandWavelengths:a,bandIds:n,missingBandAction:u}=t,l=(r==null?void 0:r.length)&&(o==="name"||o!=="id"&&!(n!=null&&n.length)),p=(a==null?void 0:a.length)&&(o==="wavelength"||o!=="id"&&!(n!=null&&n.length)),h=u===Xe.fail,m=l?this._matchBandNames(s,r):p?this._matchBandWavelengths(s,a,h):this._matchBandIds(s,n,h);if(m==null)return{success:!1,supportsGPU:!1,error:`extract-band-function: Invalid ${l?"band names":p?"band wavelengths":"band ids"} for the imagery data source`};this.functionArguments.bandIds=m,this.functionArguments.method="id",this.outputPixelType=this._getOutputPixelType("f32");const g=s.clone();g.pixelType=this.outputPixelType,g.bandCount=m.length;const{statistics:w,histograms:y}=g;w!=null&&w.length&&(g.statistics=m.map(b=>w[b]||w[w.length-1])),y!=null&&y.length&&(g.histograms=m.map(b=>y[b]||y[y.length-1]));let d=(v=g.keyProperties)==null?void 0:v.BandProperties;return d!=null&&d.length&&(d=m.map(b=>b>=d.length?d[d.length-1]:d[b]),g.keyProperties={...g.keyProperties,BandProperties:d}),this.rasterInfo=g,{success:!0,supportsGPU:g.bandCount<=3}}_processPixels(t){var r;const e=(r=t.pixelBlocks)==null?void 0:r[0];if(e==null)return null;const s=e.pixels.length,o=this.functionArguments.bandIds.map(a=>a>=s?s-1:a);return e.extractBands(o)}_getWebGLParameters(){let t;if(this.isInputBandIdsSwizzled)t=this.swizzledBandSelection.length?this.swizzledBandSelection:[0,1,2];else{t=[...this.functionArguments.bandIds],t.length===0?t=[0,1,2]:t.length<3&&(t[1]=t[1]??t[0],t[2]=t[2]??t[1]);for(let e=0;e<3;e++)t[e]=Math.min(t[e],2)}return{bandIndexMat3:O(t)}}_getInputBandIds(t){const e=t.length;return this.functionArguments.bandIds.map(s=>s>=e?e-1:s).map(s=>t[s])}_matchBandNames(t,e){const s=t.bandInfos.map(({name:r})=>r.toLowerCase()),o=[];for(let r=0;ru.startsWith("nearinfrared_1")),n===-1&&(n=s.findIndex(u=>u.startsWith("nearinfrared")))),n===-1)return null;o.push(n)}return o}_matchBandIds(t,e,s){const{bandCount:o}=t;return!(e!=null&&e.length)||s&&e.some(r=>r<0||r>=o)?null:e}_matchBandWavelengths(t,e,s){const{bandInfos:o}=t,r=[];for(let u=0;u=w.minWavelength&&l<=w.maxWavelength,d=Math.abs(l-(w.minWavelength+w.maxWavelength)/2);y?dtypeof e=="number"||typeof e=="string"?e:e.toJSON())}clone(){return new Qt({operation:this.operation,processAsMultiband:this.processAsMultiband,rasters:W(this.rasters)})}};c([f({json:{write:!0}})],ut.prototype,"operation",void 0),c([f({json:{write:!0}})],ut.prototype,"rasters",void 0),c([Ft("rasters")],ut.prototype,"writeRasters",null),c([f({json:{write:!0}})],ut.prototype,"processAsMultiband",void 0),ut=Qt=c([A("esri.layers.support.rasterFunctions.LocalFunctionArguments")],ut);const In=ut,G=new Map;function Rn(i){return G.get(i)}G.set(H.acos,[0,Math.PI]),G.set(H.asin,[-Math.PI/2,Math.PI/2]),G.set(H.atan,[-Math.PI/2,Math.PI/2]),G.set(H.cos,[-1,1]),G.set(H.sin,[-1,1]),G.set(L.booleanAnd,[0,1]),G.set(L.booleanNot,[0,1]),G.set(L.booleanOr,[0,1]),G.set(L.booleanXOr,[0,1]),G.set(L.equalTo,[0,1]),G.set(L.notEqual,[0,1]),G.set(L.greaterThan,[0,1]),G.set(L.greaterThanEqual,[0,1]),G.set(L.lessThan,[0,1]),G.set(L.lessThanEqual,[0,1]),G.set(L.isNull,[0,1]);const Re=[0,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,2,2,1,2,2,1,1,2,2,1,1,1,2,2,1,1,1,2,2,1,1,1,999,999,999,999,999,999,2,1,2,999,1,1,2,1,1,1,999,999,1,1,999,1,1,2,999,999,2,2,999,999,999,999,999,999,999,999,999,999,3,999,3];function kn(i,t=!1){const e=i.map(n=>n.mask),s=e.filter(n=>n!=null),o=i[0].pixels[0].length;if(s.length===0)return new Uint8Array(o).fill(255);const r=s[0],a=new Uint8Array(r);if(s.length===1)return a;if(!t){for(let n=1;n=1?t[u]=0:a[u]=Math.atanh(l)}return a}const n=s===H.asin?Math.asin:Math.acos;for(let u=0;u1?t[u]=0:a[u]=n(l)}return a}function Gn(i,t,e,s){const[o]=i,r=o.length,a=x.createEmptyBand(e,r);for(let n=0;n>o[n]);return a}function qn(i,t,e){const[s,o]=i,r=s.length,a=x.createEmptyBand(e,r);for(let n=0;no[n]?1:0);return a}function or(i,t,e){const[s,o]=i,r=s.length,a=x.createEmptyBand(e,r);for(let n=0;n=o[n]?1:0);return a}function ir(i,t,e){const[s,o]=i,r=s.length,a=x.createEmptyBand(e,r);for(let n=0;np&&(u=p)}a[n]=u}return a}function je(i,t,e){const s=i.length;if(s<2)return i[0];const[o]=i,r=o.length,a=x.createEmptyBand(e,r);for(let n=0;nh&&(u=h)}a[n]=l-u}return a}function _e(i,t,e){const s=i.length;if(s<2)return i[0];const[o]=i,r=o.length,a=x.createEmptyBand(e,r);for(let n=0;np&&(p=l,u=h);r[n]=u}return r}function Ge(i,t,e){const s=i.length;if(s<=2)return Ze(i,t,e);const o=i[0].length,r=x.createEmptyBand(e,o),a=new Map;for(let n=0;nr?t[n]=0:s[n]=a?Math.round(u):u}}function dr(i,t,e={}){fr();let s=kn(i,t>=66&&t<=75);const{outputPixelType:o="f32"}=e,r=!_.has(t)||e.processAsMultiband,a=r?i[0].pixels.length:1,n=[];for(let l=0;lg.pixels):i.map(g=>g.pixels[l]);let h,m=!0;if(t===Je.setNull){const g=hr(p,s,o);h=g.band,s=g.mask,m=!1}else P.has(t)?h=P.get(t)(p,s,"f64"):M.has(t)?h=t===H.asin||t===H.acos||t===H.atanh?On(p,s,"f64",t):Gn(p,s,"f64",M.get(t)):zt.has(t)?h=En(p,s,"f64",zt.get(t)):_.has(t)?h=_.get(t)(p,s,"f64"):(h=p[0],m=!1);if(m&&t!==L.isNull&&!G.has(t)){const g=x.createEmptyBand(o,h.length);s||(s=new Uint8Array(h.length).fill(255)),mr(h,s,o,g),h=g}n.push(h)}const u=i[0];return new x({width:u.width,height:u.height,pixelType:o,mask:t===L.isNull?null:s,pixels:n})}let vt=class extends V{constructor(){super(...arguments),this.functionName="Local",this.functionArguments=null,this.rasterArgumentNames=["rasters"]}_bindSourceRasters(){const{sourceRasterInfos:t}=this,e=t[0],{bandCount:s}=e,{processAsMultiband:o}=this.functionArguments;if(t.some(p=>p.bandCount!==s))return{success:!1,supportsGPU:!1,error:"local-function: input rasters do not have same band count"};const{operation:r,rasters:a}=this.functionArguments,n=Re[r];if(!(n===999||a.length===n||a.length<=1&&n===1))return{success:!1,supportsGPU:!1,error:`local-function: the length of functionArguments.rasters does not match operation's requirement: ${n}`};this.outputPixelType=this._getOutputPixelType("f32");const u=e.clone();u.pixelType=this.outputPixelType,u.statistics=null,u.histograms=null,u.colormap=null,u.attributeTable=null,u.bandCount=n!==999||o?s:1;const l=Rn(r);if(l){u.statistics=[];for(let p=0;p16)}}_processPixels(t){const{pixelBlocks:e}=t;return e==null||e.some(s=>s==null)?null:dr(e,this.functionArguments.operation,{processAsMultiband:this.functionArguments.processAsMultiband,outputPixelType:this.outputPixelType??void 0})}_getWebGLParameters(){var u;const{operation:t}=this.functionArguments,e=Re[t],s=((u=Object.keys(Ne).find(l=>Ne[l]===t))==null?void 0:u.toLowerCase())??"undefined",o=this.outputPixelType??"f32";let[r,a]=Dt(o);const n=o.startsWith("u")||o.startsWith("s");return n&&(r-=1e-4,a+=1e-4),{imageCount:e,operationName:s,domainRange:[r,a],isOutputRounded:n}}};c([f({json:{write:!0,name:"rasterFunction"}})],vt.prototype,"functionName",void 0),c([f({type:In,json:{write:!0,name:"rasterFunctionArguments"}})],vt.prototype,"functionArguments",void 0),c([f()],vt.prototype,"rasterArgumentNames",void 0),vt=c([A("esri.layers.support.rasterFunctions.LocalFunction")],vt);const gr=vt;var te;let lt=te=class extends U{constructor(){super(...arguments),this.includedRanges=null,this.noDataValues=null,this.noDataInterpretation=He.matchAny}get normalizedNoDataValues(){const{noDataValues:i}=this;if(!(i!=null&&i.length))return null;let t=!1;const e=i.map(s=>{if(typeof s=="number")return t=!0,[s];if(typeof s=="string"){const o=s.trim().split(" ").filter(r=>r.trim()!=="").map(r=>Number(r));return t=t||o.length>0,o.length===0?null:o}return null});return t?e:null}clone(){var i,t;return new te({includedRanges:((i=this.includedRanges)==null?void 0:i.slice())??[],noDataValues:((t=this.noDataValues)==null?void 0:t.slice())??[],noDataInterpretation:this.noDataInterpretation})}};c([f({json:{write:!0}})],lt.prototype,"includedRanges",void 0),c([f({json:{write:!0}})],lt.prototype,"noDataValues",void 0),c([f()],lt.prototype,"normalizedNoDataValues",null),c([f({json:{write:!0}})],lt.prototype,"noDataInterpretation",void 0),lt=te=c([A("esri.layers.support.rasterFunctions.MaskFunctionArguments")],lt);const yr=lt;let ct=class extends V{constructor(){super(...arguments),this.functionName="Mask",this.functionArguments=null,this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;this.outputPixelType=this._getOutputPixelType(e),t.pixelType=this.outputPixelType,this.rasterInfo=t;const{includedRanges:s,normalizedNoDataValues:o}=this.functionArguments;if(!(s!=null&&s.length)&&!(o!=null&&o.length))return{success:!1,supportsGPU:!1,error:"missing includedRanges or noDataValues argument"};let r=[];for(let n=0;n{var u;return(n==null?void 0:n.length)===((u=o[0])==null?void 0:u.length)});return{success:!0,supportsGPU:(!s||s.length<=2*K)&&(!o||a&&o[0].length<=K)}}_processPixels(t){var l;const e=(l=t.pixelBlocks)==null?void 0:l[0];if(e==null)return null;const{outputPixelType:s,lookups:o}=this,{includedRanges:r,noDataInterpretation:a,normalizedNoDataValues:n}=this.functionArguments,u=a===He.matchAll;return gs(e,{includedRanges:r,noDataValues:n,outputPixelType:s,matchAll:u,lookups:o})}_getWebGLParameters(){var r;const{includedRanges:t,normalizedNoDataValues:e}=this.functionArguments,s=new Float32Array(K);s.fill(Tt),(r=e==null?void 0:e[0])!=null&&r.length&&s.set(e[0]);const o=new Float32Array(K);for(let a=0;a=o.bandCount)return{success:!1,supportsGPU:!1,error:"ndvi-function: source raster has insufficient amount of raster bands"};const a=o.clone();a.pixelType=this.outputPixelType,a.colormap=null,a.histograms=null,a.bandCount=1,a.keyProperties={...a.keyProperties,BandProperties:void 0};const[n,u,l,p]=t?[-1,1,0,.1]:[0,200,100,10];return a.statistics=[{min:n,max:u,avg:l,stddev:p}],this.rasterInfo=a,{success:!0,supportsGPU:!0}}_processPixels(t){var a;const e=(a=t.pixelBlocks)==null?void 0:a[0];if(e==null)return null;const{visibleBandID:s,infraredBandID:o,scientificOutput:r}=this.functionArguments;return Ss(e,s,o,!r)}_getWebGLParameters(){const{visibleBandID:t,infraredBandID:e,scientificOutput:s}=this.functionArguments,o=this.isInputBandIdsSwizzled?[0,1,2]:[e,t,0];return{bandIndexMat3:O(o),scaled:!s}}_getInputBandIds(t){const{visibleBandID:e,infraredBandID:s}=this.functionArguments;return[s,e,0].map(o=>t[o])}};c([f({json:{write:!0,name:"rasterFunction"}})],Pt.prototype,"functionName",void 0),c([f({type:br,json:{write:!0,name:"rasterFunctionArguments"}})],Pt.prototype,"functionArguments",void 0),c([f()],Pt.prototype,"rasterArgumentNames",void 0),Pt=c([A("esri.layers.support.rasterFunctions.NDVIFunction")],Pt);const xr=Pt;var se;let tt=se=class extends U{constructor(){super(...arguments),this.inputRanges=null,this.outputValues=null,this.noDataRanges=null,this.allowUnmatched=!1,this.isLastInputRangeInclusive=!1}clone(){return new se({inputRanges:[...this.inputRanges],outputValues:[...this.outputValues],noDataRanges:[...this.noDataRanges],allowUnmatched:this.allowUnmatched,isLastInputRangeInclusive:this.isLastInputRangeInclusive})}};c([f({json:{write:!0}})],tt.prototype,"inputRanges",void 0),c([f({json:{write:!0}})],tt.prototype,"outputValues",void 0),c([f({json:{write:!0}})],tt.prototype,"noDataRanges",void 0),c([f({json:{write:!0}})],tt.prototype,"allowUnmatched",void 0),c([f({json:{write:!0}})],tt.prototype,"isLastInputRangeInclusive",void 0),tt=se=c([A("esri.layers.support.rasterFunctions.RemapFunctionArguments")],tt);const vr=tt;let pt=class extends V{constructor(){super(...arguments),this.functionName="Remap",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null}_bindSourceRasters(){const t=this.sourceRasterInfos[0].clone(),{pixelType:e}=t;this.outputPixelType=this._getOutputPixelType(e),t.pixelType=this.outputPixelType,t.colormap=null,t.histograms=null,t.bandCount=1,t.attributeTable=null;const{statistics:s}=t,{allowUnmatched:o,outputValues:r,inputRanges:a,noDataRanges:n,isLastInputRangeInclusive:u}=this.functionArguments;if(s!=null&&s.length&&(r!=null&&r.length))if(o){const l=Math.min.apply(null,[...r,s[0].min]),p=Math.max.apply(null,[...r,s[0].max]);t.statistics=[{...s[0],min:l,max:p}]}else{let l=r[0],p=l;for(let h=0;hr[h]?r[h]:l,p=p>r[h]?p:r[h];t.statistics=[{...s[0],min:l,max:p}]}return this.rasterInfo=t,this.lookup=o?null:ys({srcPixelType:e,inputRanges:a,outputValues:r,noDataRanges:n,allowUnmatched:o,isLastInputRangeInclusive:u,outputPixelType:this.outputPixelType}),{success:!0,supportsGPU:(!r||r.length<=K)&&(!n||n.length<=K)}}_processPixels(t){var p;const e=(p=t.pixelBlocks)==null?void 0:p[0];if(e==null)return null;const{lookup:s,outputPixelType:o}=this;if(s){const h=ge(e,{lut:[s.lut],offset:s.offset,outputPixelType:o});return h!=null&&s.mask&&(h.mask=ws(e.pixels[0],e.mask,s.mask,s.offset,"u8")),h}const{inputRanges:r,outputValues:a,noDataRanges:n,allowUnmatched:u,isLastInputRangeInclusive:l}=this.functionArguments;return bs(e,{inputRanges:r,outputValues:a,noDataRanges:n,outputPixelType:o,allowUnmatched:u,isLastInputRangeInclusive:l})}_getWebGLParameters(){const{allowUnmatched:t,noDataRanges:e,isLastInputRangeInclusive:s}=this.functionArguments,o=new Float32Array(3*K),r=1e-5,a=this.functionArguments.inputRanges??[],n=this.functionArguments.outputValues??[],u=n.length;for(let p=0;p0&&(o[3*p]-=r),(p=1?t*Vt:t,slopeType:e,pixelSizeFactor:s??0,pixelSizePower:o??0}}};c([f({json:{write:!0,name:"rasterFunction"}})],ht.prototype,"functionName",void 0),c([f({type:$r,json:{write:!0,name:"rasterFunctionArguments"}})],ht.prototype,"functionArguments",void 0),c([f()],ht.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],ht.prototype,"isGCS",void 0),ht=c([A("esri.layers.support.rasterFunctions.SlopeFunction")],ht);const Tr=ht,ze=new Mt({1:"min",2:"max",3:"mean",4:"stddev",5:"median",6:"majority",7:"minority"},{useNumericKeys:!0});function Nr(i,t){const{fillNoDataOnly:e}=t,{band:s,width:o,height:r,mask:a,outBand:n}=i;if(e&&!a)return void n.set(s);const{statisticsType:u,kernelRows:l,kernelCols:p}=t,h=u==="stddev",m=o*r,g=new Float64Array(m),w=new Float64Array(m),y=new Uint32Array(m);for(let $=0;$b-R),a?(m[y+d]=v[Math.floor((v.length-1)/2)],g[y+d]=v.length):n[y+d]=v[Math.floor((v.length-1)/2)])}}if(a)for(let w=p;w$&&($=E,k=T);a?(w[v+b]=k,y[v+b]=R.size):n[v+b]=k}}if(a)for(let d=p;d1&&(n==null?void 0:n.length)){b=new Uint8Array(p),b.set(v[0]);for(let k=1;kNumber(i??(t==null?void 0:t.kernelRows)??3)}}})],ft.prototype,"rows",void 0),c([f({json:{write:!0,read:{source:["kernelCols","cols"],reader:(i,t)=>Number(i??(t==null?void 0:t.kernelCols)??3)}}})],ft.prototype,"cols",void 0),c([f({json:{write:!0}})],ft.prototype,"fillNoDataOnly",void 0),c([f({json:{read:{source:["statisticsType","type"],reader:(i,t)=>ze.fromJSON((t==null?void 0:t.statisticsType)??(t==null?void 0:t.type))??"min"},write:{target:"type"}}}),Z(ze)],ft.prototype,"statisticsType",void 0),ft=re=c([A("esri.layers.support.rasterFunctions.StatisticsFunctionArguments")],ft);const Cr=ft,Br=new Set(["min","max","mean","median","majority","minority"]);let $t=class extends V{constructor(){super(...arguments),this.functionName="Statistics",this.rasterArgumentNames=["raster"]}_bindSourceRasters(){const{type:t}=this.functionArguments.toJSON();if(t<1||t>7)return{success:!1,supportsGPU:!1,error:`statistics-function: the given statistics type is not supported ${t}`};const e=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType(e.pixelType);const s=e.clone();s.pixelType=this.outputPixelType;const{statisticsType:o}=this.functionArguments;return Br.has(o)||(s.statistics=null,s.histograms=null,s.colormap=null,s.attributeTable=null),this.rasterInfo=s,{success:!0,supportsGPU:s.bandCount<=3&&t<5}}_processPixels(t){var n;const e=(n=t.pixelBlocks)==null?void 0:n[0];if(e==null)return e;const{statisticsType:s,rows:o,cols:r,fillNoDataOnly:a}=this.functionArguments;return kr(e,{kernelRows:o,kernelCols:r,fillNoDataOnly:a,outputPixelType:this.outputPixelType,statisticsType:s,mirrorEdges:!0})}_getWebGLParameters(){const{rows:t,cols:e,statisticsType:s,fillNoDataOnly:o}=this.functionArguments;return{fillNoDataOnly:o,kernelRows:t,kernelCols:e,statisticsType:s,clampRange:Dt(this.outputPixelType)}}};c([f({json:{write:!0,name:"rasterFunction"}})],$t.prototype,"functionName",void 0),c([f({type:Cr,json:{write:!0,name:"rasterFunctionArguments"}})],$t.prototype,"functionArguments",void 0),c([f()],$t.prototype,"rasterArgumentNames",void 0),$t=c([A("esri.layers.support.rasterFunctions.StatisticsFunction")],$t);const jr=$t;var oe;let mt=oe=class extends U{constructor(){super(...arguments),this.statistics=null,this.histograms=null}readStatistics(i,t){if(!(i!=null&&i.length))return null;const e=[];return i.forEach(s=>{const o={min:s.min,max:s.max,avg:s.avg??s.mean,stddev:s.stddev??s.standardDeviation};e.push(o)}),e}writeStatistics(i,t,e){if(!(i!=null&&i.length))return;const s=[];i.forEach(o=>{const r={...o,mean:o.avg,standardDeviation:o.stddev};delete r.avg,delete r.stddev,s.push(r)}),t[e]=s}clone(){return new oe({statistics:W(this.statistics),histograms:W(this.histograms)})}};c([f({json:{write:!0}})],mt.prototype,"statistics",void 0),c([Nt("statistics")],mt.prototype,"readStatistics",null),c([Ft("statistics")],mt.prototype,"writeStatistics",null),c([f({json:{write:!0}})],mt.prototype,"histograms",void 0),mt=oe=c([A("esri.layers.support.rasterFunctions.StatisticsHistogramFunctionArguments")],mt);const _r=mt;let st=class extends V{constructor(){super(...arguments),this.functionName="StatisticsHistogram",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.isNoopProcess=!0}_bindSourceRasters(){const t=this.sourceRasterInfos[0];this.outputPixelType=this._getOutputPixelType("u8");const e=t.clone(),{statistics:s,histograms:o}=this.functionArguments;return o&&(e.histograms=o),s&&(e.statistics=s),this.rasterInfo=e,{success:!0,supportsGPU:!0}}_processPixels(t){var e;return(e=t.pixelBlocks)==null?void 0:e[0]}};c([f({json:{write:!0,name:"rasterFunction"}})],st.prototype,"functionName",void 0),c([f({type:_r,json:{write:!0,name:"rasterFunctionArguments"}})],st.prototype,"functionArguments",void 0),c([f()],st.prototype,"rasterArgumentNames",void 0),c([f({json:{write:!0}})],st.prototype,"indexedColormap",void 0),c([f()],st.prototype,"isNoopProcess",void 0),st=c([A("esri.layers.support.rasterFunctions.StatisticsHistogramFunction")],st);const Sr=st;var ie;const Mr=new Mt({0:"none",3:"standard-deviation",4:"histogram-equalization",5:"min-max",6:"percent-clip",9:"sigmoid"},{useNumericKeys:!0});let z=ie=class extends U{constructor(){super(...arguments),this.computeGamma=!1,this.dynamicRangeAdjustment=!1,this.gamma=[],this.histograms=null,this.statistics=null,this.stretchType="none",this.useGamma=!1}writeStatistics(i,t,e){i!=null&&i.length&&(Array.isArray(i[0])||(i=i.map(s=>[s.min,s.max,s.avg,s.stddev])),t[e]=i)}clone(){return new ie({stretchType:this.stretchType,outputMin:this.outputMin,outputMax:this.outputMax,useGamma:this.useGamma,computeGamma:this.computeGamma,statistics:W(this.statistics),gamma:W(this.gamma),sigmoidStrengthLevel:this.sigmoidStrengthLevel,numberOfStandardDeviations:this.numberOfStandardDeviations,minPercent:this.minPercent,maxPercent:this.maxPercent,histograms:W(this.histograms),dynamicRangeAdjustment:this.dynamicRangeAdjustment,raster:this.raster})}};c([f({type:Boolean,json:{write:!0}})],z.prototype,"computeGamma",void 0),c([f({type:Boolean,json:{name:"dra",write:!0}})],z.prototype,"dynamicRangeAdjustment",void 0),c([f({type:[Number],json:{write:!0}})],z.prototype,"gamma",void 0),c([f()],z.prototype,"histograms",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"maxPercent",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"minPercent",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"numberOfStandardDeviations",void 0),c([f({type:Number,json:{name:"max",write:!0}})],z.prototype,"outputMax",void 0),c([f({type:Number,json:{name:"min",write:!0}})],z.prototype,"outputMin",void 0),c([f({type:Number,json:{write:!0}})],z.prototype,"sigmoidStrengthLevel",void 0),c([f({json:{type:[[Number]],write:!0}})],z.prototype,"statistics",void 0),c([Ft("statistics")],z.prototype,"writeStatistics",null),c([Z(Mr)],z.prototype,"stretchType",void 0),c([f({type:Boolean,json:{write:!0}})],z.prototype,"useGamma",void 0),z=ie=c([A("esri.layers.support.rasterFunctions.StretchFunctionArguments")],z);const Dr=z;let nt=class extends V{constructor(){super(...arguments),this.functionName="Stretch",this.functionArguments=null,this.rasterArgumentNames=["raster"],this.lookup=null,this.cutOffs=null}_bindSourceRasters(){this.lookup=null,this.cutOffs=null;const t=this.sourceRasterInfos[0],{pixelType:e}=t,{functionArguments:s}=this,{dynamicRangeAdjustment:o,gamma:r,useGamma:a}=s;if(!o&&["u8","u16","s8","s16"].includes(e)){const u=Ut(s.toJSON(),{rasterInfo:t}),l=this._isOutputRoundingNeeded()?"round":"float";this.lookup=vs({pixelType:e,...u,gamma:a?r:null,rounding:l}),this.cutOffs=u}else o||(this.cutOffs=Ut(s.toJSON(),{rasterInfo:t}));this.outputPixelType=this._getOutputPixelType(e);const n=t.clone();return n.pixelType=this.outputPixelType,n.statistics=null,n.histograms=null,n.colormap=null,n.attributeTable=null,this.outputPixelType==="u8"&&(n.keyProperties.DataType="processed"),this.rasterInfo=n,{success:!0,supportsGPU:!o}}_processPixels(t){var n;const e=(n=t.pixelBlocks)==null?void 0:n[0];if(e==null)return e;const{lookup:s}=this;if(s)return ge(e,{...s,outputPixelType:this.rasterInfo.pixelType});const{functionArguments:o}=this,r=this.cutOffs||Ut(o.toJSON(),{rasterInfo:this.sourceRasterInfos[0],pixelBlock:e}),a=o.useGamma?o.gamma:null;return As(e,{...r,gamma:a,outputPixelType:this.outputPixelType})}_getWebGLParameters(){const{outputMin:t=0,outputMax:e=255,gamma:s,useGamma:o}=this.functionArguments,r=this.rasterInfo.bandCount>=2?3:1,a=o&&(s!=null&&s.length)?Ps(r,s):[1,1,1],{minCutOff:n,maxCutOff:u}=this.cutOffs??{minCutOff:[0,0,0],maxCutOff:[255,255,255]};n.length===1&&(n[1]=n[2]=n[0],u[1]=u[2]=u[0]);const l=new Float32Array(r);let p;for(p=0;p1||t.pixelType.startsWith("f"))return{success:!1,supportsGPU:!1,error:"table-function: Source data must be single band and integer pixel type."};const{attributeTableAsRecordSet:e}=this.functionArguments;if(!e)return{success:!1,supportsGPU:!1,error:"table-function: Missing attributeTableAsRecordSet argument."};this.outputPixelType=this._getOutputPixelType(t.pixelType);const s=t.clone();return s.pixelType=this.outputPixelType,s.bandCount=1,s.dataType!=="thematic"&&(s.keyProperties=s.keyProperties?{...s.keyProperties,DataType:"thematic"}:{DataType:"thematic"}),this.rasterInfo=s,{success:!0,supportsGPU:!0}}_processPixels(t){var e;return(e=t.pixelBlocks)==null?void 0:e[0]}};c([f({json:{write:!0,name:"rasterFunction"}})],dt.prototype,"functionName",void 0),c([f({type:Gr,json:{write:!0,name:"rasterFunctionArguments"}})],dt.prototype,"functionArguments",void 0),c([f()],dt.prototype,"rasterArgumentNames",void 0),c([f()],dt.prototype,"isNoopProcess",void 0),dt=c([A("esri.layers.support.rasterFunctions.TableFunction")],dt);const Er=dt,D=new Map;function zr(i,t){const{rasterFunctionArguments:e}=i;e&&(e.rasters||[e.raster]).forEach(s=>{s&&typeof s!="number"&&(typeof s=="string"?s.startsWith("http")&&(t.includes(s)||t.push(s)):"rasterFunctionArguments"in s&&zr(s,t))})}function xo(i,t){if(t=t??{},"function"in(i=W(i))&&"arguments"in i&&i.arguments){const e=es(i,new Map,t);if(ce(e),!e.renderingRule)throw new It("raster-function-helper","Unsupported raster function json.");i=e.renderingRule}if("rasterFunction"in i)return Qe(i=ue(i),t);throw new It("raster-function-helper","unsupported raster function json.")}function Ur(i,t){return t[0]==="rasters"&&Array.isArray(i.rasters)?i.rasters:t.map(e=>i[e])}function Ue(i){return!!(i&&typeof i=="object"&&i.rasterFunction&&i.rasterFunctionArguments)}function ue(i){var o;const{rasterFunction:t,rasterFunctionArguments:e}=i,s={};for(const r in e){let a=e[r];const n=r.toLowerCase();if(n==="rasters"&&Array.isArray(a))s.rasters=a.map(u=>Ue(u)?ue(u):u);else switch(Ue(a)&&(a=ue(a)),n){case"dra":s.dra=a;break;case"pspower":s.psPower=a;break;case"pszfactor":s.psZFactor=a;break;case"bandids":s.bandIds=a;break;default:s[r[0].toLowerCase()+r.slice(1)]=a}}return t!=="Local"||(o=s.rasters)!=null&&o.length||(s.rasters=["$$"]),{...i,rasterFunctionArguments:s}}function Qe(i,t){var m,g;const{rasterFunction:e,rasterFunctionArguments:s}=i,o=(m=i.outputPixelType)==null?void 0:m.toLowerCase();if(e==null||!D.has(e))throw new It("raster-function-helper",`unsupported raster function: ${e}`);const r=D.get(e),a=(typeof r.ctor=="function"?r.ctor:r.ctor.default).fromJSON({...i,outputPixelType:o}),{rasterArgumentNames:n}=a,u=[],l=Ur(s,n),p=n[0]==="rasters",h=[];for(let w=0;wtypeof r=="object"&&r.type==="RasterFunctionVariable"?le(r,t):r);if("value"in e&&["number","string","boolean"].includes(typeof e.value))return e.value;if(i.isDataset&&e.type!=="Scalar")return"$$";if(!("type"in e))return e;let s=e;switch(e.type){case"Scalar":s=e.value;break;case"AlgorithmicColorRamp":s=Ve(e);break;case"MultiPartColorRamp":s={type:"multipart",colorRamps:e.ArrayOfColorRamp.map(Ve)};break;case"ArgumentArray":if((o=e.elements)!=null&&o.length&&e.elements[0].type!=="RasterStatistics"){const r=[];for(let a=0;a{if(typeof n=="object")if(n._object_ref_id!=null){if(!e.has(n._object_ref_id))throw new It("raster-function-helper",`unsupported raster function json. _object_ref_id: ${r} does not exist`);const l=e.get(a);l&&typeof l=="object"?Object.assign(n,l):r[u]=l}else ce({renderingRule:n,templates:e})}));else{if(!e.has(a))throw new It("raster-function-helper",`unsupported raster function json. _object_ref_id: ${a} does not exist`);const n=e.get(a);o!=="_object_ref_id"?s[o]=n:n&&typeof n=="object"&&Object.assign(s,n)}}}function Vr(i){var t;(t=i.Statistics)!=null&&t.length&&typeof i.Statistics=="object"&&(i.Statistics=i.Statistics.map(e=>[e.min,e.max,e.mean,e.standardDeviation])),i.NumberOfStandardDeviation!=null&&(i.NumberOfStandardDeviations=i.NumberOfStandardDeviation,delete i.NumberOfStandardDeviation)}function Lr(i){var t,e;((e=(t=i.ColorRamp)==null?void 0:t.type)==null?void 0:e.toLowerCase())==="randomcolorramp"&&(delete i.ColorRamp,i.ColormapName="Random"),i.ColorSchemeType===0&&delete i.ColorRamp}function Wr(i){i.ConvolutionType!=null&&(i.Type=i.ConvolutionType,delete i.ConvolutionType)}function qr(i){var t;(t=i.NoDataValues)!=null&&t.length&&typeof i.NoDataValues[0]=="string"&&(i.NoDataValues=i.NoDataValues.filter(e=>e!=="").map(e=>Number(e)))}D.set("Aspect",{desc:"Aspect Function",ctor:Ns,rasterArgumentNames:["raster"]}),D.set("BandArithmetic",{desc:"Band Arithmetic Function",ctor:Qs,rasterArgumentNames:["raster"]}),D.set("Colormap",{desc:"Colormap Function",ctor:cn,rasterArgumentNames:["raster"]}),D.set("CompositeBand",{desc:"CompositeBand Function",ctor:hn,rasterArgumentNames:["rasters"]}),D.set("Convolution",{desc:"Convolution Function",ctor:Pn,rasterArgumentNames:["raster"]}),D.set("ContrastBrightness",{desc:"Contrast Brightness Function",ctor:mn,rasterArgumentNames:["raster"]}),D.set("ExtractBand",{desc:"ExtractBand Function",ctor:Fn,rasterArgumentNames:["raster"]}),D.set("Curvature",{desc:"Curvature Function",ctor:Tn,rasterArgumentNames:["raster"]}),D.set("Local",{desc:"Local Function",ctor:gr,rasterArgumentNames:["rasters"]}),D.set("Mask",{desc:"Mask Function",ctor:wr,rasterArgumentNames:["raster"]}),D.set("NDVI",{desc:"NDVI Function",ctor:xr,rasterArgumentNames:["raster"]}),D.set("Remap",{desc:"Remap Function",ctor:Ar,rasterArgumentNames:["raster"]}),D.set("Slope",{desc:"Slope Function",ctor:Tr,rasterArgumentNames:["raster"]}),D.set("Statistics",{desc:"Focal Statistics Function",ctor:jr,rasterArgumentNames:["raster"]}),D.set("StatisticsHistogram",{desc:"Statistics Histogram Function",ctor:Sr,rasterArgumentNames:["raster"]}),D.set("Stretch",{desc:"Stretch Function",ctor:Or,rasterArgumentNames:["raster"]}),D.set("Table",{desc:"Attribute Table Function",ctor:Er,rasterArgumentNames:["raster"]});let jt=class extends de{get affectsPixelSize(){return!1}forwardTransform(i){return i}inverseTransform(i){return i}};c([f()],jt.prototype,"affectsPixelSize",null),c([f({json:{write:!0}})],jt.prototype,"spatialReference",void 0),jt=c([A("esri.layers.support.rasterTransforms.BaseRasterTransform")],jt);const ve=jt;var pe;let _t=pe=class extends ve{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(i){return(i=i.clone()).type==="point"?(i.x>180+this.tolerance&&(i.x-=360),i):(i.xmin>=180-this.tolerance?(i.xmax-=360,i.xmin-=360):i.xmax>180+this.tolerance&&(i.xmin=-180,i.xmax=180),i)}inverseTransform(i){return(i=i.clone()).type==="point"?(i.x<-this.tolerance&&(i.x+=360),i):(i.xmin<-this.tolerance&&(i.xmin+=360,i.xmax+=360),i)}clone(){return new pe({tolerance:this.tolerance})}};c([Z({GCSShiftXform:"gcs-shift"})],_t.prototype,"type",void 0),c([f()],_t.prototype,"tolerance",void 0),_t=pe=c([A("esri.layers.support.rasterTransforms.GCSShiftTransform")],_t);const Xr=_t;var he;let Et=he=class extends ve{constructor(){super(...arguments),this.type="identity"}clone(){return new he}};c([Z({IdentityXform:"identity"})],Et.prototype,"type",void 0),Et=he=c([A("esri.layers.support.rasterTransforms.IdentityTransform")],Et);const Hr=Et;var fe;function me(i,t,e){const{x:s,y:o}=t;if(e<2)return{x:i[0]+s*i[2]+o*i[4],y:i[1]+s*i[3]+o*i[5]};if(e===2){const m=s*s,g=o*o,w=s*o;return{x:i[0]+s*i[2]+o*i[4]+m*i[6]+w*i[8]+g*i[10],y:i[1]+s*i[3]+o*i[5]+m*i[7]+w*i[9]+g*i[11]}}const r=s*s,a=o*o,n=s*o,u=r*s,l=r*o,p=s*a,h=o*a;return{x:i[0]+s*i[2]+o*i[4]+r*i[6]+n*i[8]+a*i[10]+u*i[12]+l*i[14]+p*i[16]+h*i[18],y:i[1]+s*i[3]+o*i[5]+r*i[7]+n*i[9]+a*i[11]+u*i[13]+l*i[15]+p*i[17]+h*i[19]}}function Le(i,t,e){const{xmin:s,ymin:o,xmax:r,ymax:a,spatialReference:n}=t;let u=[];if(e<2)u.push({x:s,y:a}),u.push({x:r,y:a}),u.push({x:s,y:o}),u.push({x:r,y:o});else{let h=10;for(let m=0;mme(i,h,e));const l=u.map(h=>h.x),p=u.map(h=>h.y);return new is({xmin:Math.min.apply(null,l),xmax:Math.max.apply(null,l),ymin:Math.min.apply(null,p),ymax:Math.max.apply(null,p),spatialReference:n})}function Jr(i){const[t,e,s,o,r,a]=i,n=s*a-r*o,u=r*o-s*a;return[(r*e-t*a)/n,(s*e-t*o)/u,a/n,o/u,-r/n,-s/u]}let X=fe=class extends ve{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(i,t){const{coeffX:e,coeffY:s}=t;if(!(e!=null&&e.length)||!(s!=null&&s.length)||e.length!==s.length)return null;const o=[];for(let r=0;r0}forwardTransform(i){if(i.type==="point"){const t=me(this.forwardCoefficients,i,this.polynomialOrder);return new Pe({x:t.x,y:t.y,spatialReference:i.spatialReference})}return Le(this.forwardCoefficients,i,this.polynomialOrder)}inverseTransform(i){if(i.type==="point"){const t=me(this.inverseCoefficients,i,this.polynomialOrder);return new Pe({x:t.x,y:t.y,spatialReference:i.spatialReference})}return Le(this.inverseCoefficients,i,this.polynomialOrder)}clone(){return new fe({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};c([f({json:{write:!0}})],X.prototype,"polynomialOrder",void 0),c([f()],X.prototype,"forwardCoefficients",void 0),c([Nt("forwardCoefficients",["coeffX","coeffY"])],X.prototype,"readForwardCoefficients",null),c([Ft("forwardCoefficients")],X.prototype,"writeForwardCoefficients",null),c([f({json:{write:!0}})],X.prototype,"inverseCoefficients",null),c([Nt("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],X.prototype,"readInverseCoefficients",null),c([Ft("inverseCoefficients")],X.prototype,"writeInverseCoefficients",null),c([f()],X.prototype,"affectsPixelSize",null),c([Z({PolynomialXform:"polynomial"})],X.prototype,"type",void 0),X=fe=c([A("esri.layers.support.rasterTransforms.PolynomialTransform")],X);const Yr=X,ns={GCSShiftXform:Xr,IdentityXform:Hr,PolynomialXform:Yr},Kr=Object.keys(ns);function vo(i){const t=i==null?void 0:i.type;return!i||Kr.includes(t)}function Ao(i){if(!(i==null?void 0:i.type))return null;const e=ns[i==null?void 0:i.type];if(e){const s=new e;return s.read(i),s}return null}export{zr as C,xo as R,vo as f,Ao as i,Xr as n,Yr as y}; diff --git a/dist/assets/utils-rBsg-VY8.js b/dist/assets/utils-YxtTVBu2.js similarity index 71% rename from dist/assets/utils-rBsg-VY8.js rename to dist/assets/utils-YxtTVBu2.js index c369f0f..e862a22 100644 --- a/dist/assets/utils-rBsg-VY8.js +++ b/dist/assets/utils-YxtTVBu2.js @@ -1 +1 @@ -import{bR as v,bS as I,i as h,h as S,bT as c,E as l,bU as g}from"./index-J0iiHjMT.js";import{o as m}from"./jsonContext-cWV_-jAj.js";function x(t,r,a){const e=a(t);if(!e.isValid)throw new l(`${r}:invalid-parameters`,e.errorMessage,{layer:t})}async function f(t){const{layer:r,errorNamePrefix:a,validateLayer:e}=t;await r.load(),x(r,a,e)}function u(t,r){return`Layer (title: ${t.title}, id: ${t.id}) of type '${t.declaredClass}' ${r}`}function y(t){const{item:r,itemType:a,errorNamePrefix:e,layer:o,validateItem:s}=t;if(g(r),r.type!==a)throw new l(`${e}:portal-item-wrong-type`,`Portal item type should be "${a}"`,{item:r,layer:o});if(s){const i=s(r);if(!i.isValid)throw new l(`${e}:invalid-parameters`,i.errorMessage,{layer:o})}}function N(t){const{layer:r,errorNamePrefix:a}=t,{portalItem:e}=r;if(!e)throw new l(`${a}:portal-item-not-set`,u(r,"requires the portalItem property to be set"));if(!e.loaded)throw new l(`${a}:portal-item-not-loaded`,u(r,"cannot be saved to a portal item that does not exist or is inaccessible"));y({...t,item:e})}function P(t){const{newItem:r,itemType:a}=t;let e=v.from(r);return e.id&&(e=e.clone(),e.id=null),e.type??(e.type=a),e.portal??(e.portal=I.getDefault()),y({...t,item:e}),e}function O(t,r){let a=(t.messages??[]).filter(({type:e})=>e==="error").map(({name:e,message:o,details:s})=>new l(e,o,s));if(t.blockedRelativeUrls&&(a=a.concat(t.blockedRelativeUrls.map(e=>new l("url:unsupported",`Relative url '${e}' is not supported`)))),r!=null&&r.ignoreUnsupported&&(a=a.filter(({name:e})=>e!=="layer:unsupported"&&e!=="symbol:unsupported"&&e!=="symbol-layer:unsupported"&&e!=="property:unsupported"&&e!=="url:unsupported")),a.length>0)throw new l("layer-write:unsupported","Failed to save layer due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:a})}async function w(t,r,a){var o;"beforeSave"in t&&typeof t.beforeSave=="function"&&await t.beforeSave();const e=t.write({},r);return await Promise.all(((o=r.resources)==null?void 0:o.pendingOperations)??[]),O(r,a),e}function $(t){h(t,S.JSAPI),t.typeKeywords&&(t.typeKeywords=t.typeKeywords.filter((r,a,e)=>e.indexOf(r)===a))}async function R(t,r,a){var o;const e=t.portal;await e.signIn(),await((o=e.user)==null?void 0:o.addItem({item:t,data:r,folder:a==null?void 0:a.folder}))}async function C(t,r){const{layer:a,createItemData:e,createJSONContext:o,saveResources:s}=t;await f(t),N(t);const i=a.portalItem,n=o?o(i):m(i),p=await w(a,n,r),d=await e({layer:a,layerJSON:p},i);return $(i),await i.update({data:d}),c(n),await(s==null?void 0:s(i,n)),i}async function D(t,r){const{layer:a,createItemData:e,createJSONContext:o,setItemProperties:s,saveResources:i}=t;await f(t);const n=P(t),p=o?o(n):m(n),d=await w(a,p,r),b=await e({layer:a,layerJSON:d},n);return await s(a,n),$(n),await R(n,b,r),a.portalItem=n,c(p),await(i==null?void 0:i(n,p)),n}export{C as I,D as b,N as d,x as l,u as m,P as u,R as v,$ as w,w as y}; +import{aq as I,ar as b,i as g,f as h,as as c,r as l,at as S}from"./index-pCX-0tJH.js";import{o as m}from"./jsonContext-EgdQULbU.js";function x(t,r,a){const e=a(t);if(!e.isValid)throw new l(`${r}:invalid-parameters`,e.errorMessage,{layer:t})}async function f(t){const{layer:r,errorNamePrefix:a,validateLayer:e}=t;await r.load(),x(r,a,e)}function u(t,r){return`Layer (title: ${t.title}, id: ${t.id}) of type '${t.declaredClass}' ${r}`}function y(t){const{item:r,itemType:a,errorNamePrefix:e,layer:o,validateItem:s}=t;if(S(r),r.type!==a)throw new l(`${e}:portal-item-wrong-type`,`Portal item type should be "${a}"`,{item:r,layer:o});if(s){const i=s(r);if(!i.isValid)throw new l(`${e}:invalid-parameters`,i.errorMessage,{layer:o})}}function N(t){const{layer:r,errorNamePrefix:a}=t,{portalItem:e}=r;if(!e)throw new l(`${a}:portal-item-not-set`,u(r,"requires the portalItem property to be set"));if(!e.loaded)throw new l(`${a}:portal-item-not-loaded`,u(r,"cannot be saved to a portal item that does not exist or is inaccessible"));y({...t,item:e})}function P(t){const{newItem:r,itemType:a}=t;let e=I.from(r);return e.id&&(e=e.clone(),e.id=null),e.type??(e.type=a),e.portal??(e.portal=b.getDefault()),y({...t,item:e}),e}function O(t,r){let a=(t.messages??[]).filter(({type:e})=>e==="error").map(({name:e,message:o,details:s})=>new l(e,o,s));if(t.blockedRelativeUrls&&(a=a.concat(t.blockedRelativeUrls.map(e=>new l("url:unsupported",`Relative url '${e}' is not supported`)))),r!=null&&r.ignoreUnsupported&&(a=a.filter(({name:e})=>e!=="layer:unsupported"&&e!=="symbol:unsupported"&&e!=="symbol-layer:unsupported"&&e!=="property:unsupported"&&e!=="url:unsupported")),a.length>0)throw new l("layer-write:unsupported","Failed to save layer due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:a})}async function w(t,r,a){var o;"beforeSave"in t&&typeof t.beforeSave=="function"&&await t.beforeSave();const e=t.write({},r);return await Promise.all(((o=r.resources)==null?void 0:o.pendingOperations)??[]),O(r,a),e}function $(t){g(t,h.JSAPI),t.typeKeywords&&(t.typeKeywords=t.typeKeywords.filter((r,a,e)=>e.indexOf(r)===a))}async function J(t,r,a){var o;const e=t.portal;await e.signIn(),await((o=e.user)==null?void 0:o.addItem({item:t,data:r,folder:a==null?void 0:a.folder}))}async function D(t,r){const{layer:a,createItemData:e,createJSONContext:o,saveResources:s}=t;await f(t),N(t);const i=a.portalItem,n=o?o(i):m(i),p=await w(a,n,r),d=await e({layer:a,layerJSON:p},i);return $(i),await i.update({data:d}),c(n),await(s==null?void 0:s(i,n)),i}async function K(t,r){const{layer:a,createItemData:e,createJSONContext:o,setItemProperties:s,saveResources:i}=t;await f(t);const n=P(t),p=o?o(n):m(n),d=await w(a,p,r),v=await e({layer:a,layerJSON:d},n);return await s(a,n),$(n),await J(n,v,r),a.portalItem=n,c(p),await(i==null?void 0:i(n,p)),n}export{D as I,K as b,N as d,x as l,u as m,P as u,J as v,$ as w,w as y}; diff --git a/dist/assets/utils-P5wTOmqv.js b/dist/assets/utils-jVYIoPxv.js similarity index 53% rename from dist/assets/utils-P5wTOmqv.js rename to dist/assets/utils-jVYIoPxv.js index cc00e9e..7eed42f 100644 --- a/dist/assets/utils-P5wTOmqv.js +++ b/dist/assets/utils-jVYIoPxv.js @@ -1 +1 @@ -import{iT as B,e4 as L,T as j,iU as A,iV as C,d4 as Y,d3 as _,d6 as Z,ar as R,gO as Q,iW as W,iX as X}from"./index-J0iiHjMT.js";import{a as H,d as J}from"./generateRendererUtils-_1jVE02H.js";const K="",tt="equal-interval",et=1,nt=5,lt=10,it=/\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*/gi,at=new Set(["esriFieldTypeDate","esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong","esriFieldTypeOID","esriFieldTypeBigInteger"]),ot=new Set(["esriFieldTypeTimeOnly","esriFieldTypeDateOnly"]),rt=["min","max","avg","stddev","count","sum","variance","nullcount","median"];function V(t){return t==null||typeof t=="string"&&!t?K:t}function st(t){const e=t.normalizationField!=null||t.normalizationType!=null,n=t.minValue!=null||t.maxValue!=null,l=!!t.sqlExpression&&t.supportsSQLExpression;return!e&&!n&&!l}function St(t){const e=t.returnDistinct?[...new Set(t.values)]:t.values,n=e.filter(a=>a!=null).sort(),l=n.length,i={count:l,min:n[0],max:n[l-1]};return t.supportsNullCount&&(i.nullcount=e.length-l),t.percentileParams&&(i.median=P(e,t.percentileParams)),i}function ut(t){const{values:e,useSampleStdDev:n,supportsNullCount:l}=t;let i=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=null,r=null,s=null,f=null,c=0;const d=t.minValue==null?-1/0:t.minValue,m=t.maxValue==null?1/0:t.maxValue;for(const u of e)Number.isFinite(u)?u>=d&&u<=m&&(o=o===null?u:o+u,i=Math.min(i,u),a=Math.max(a,u),c++):typeof u=="string"&&c++;if(c&&o!=null){r=o/c;let u=0;for(const v of e)Number.isFinite(v)&&v>=d&&v<=m&&(u+=(v-r)**2);f=n?c>1?u/(c-1):0:c>0?u/c:0,s=Math.sqrt(f)}else i=null,a=null;const h={avg:r,count:c,max:a,min:i,stddev:s,sum:o,variance:f};return l&&(h.nullcount=e.length-c),t.percentileParams&&(h.median=P(e,t.percentileParams)),h}function P(t,e){const{fieldType:n,value:l,orderBy:i,isDiscrete:a}=e,o=mt(n,i==="desc");if((t=[...t].filter(h=>h!=null).sort((h,u)=>o(h,u))).length===0)return null;if(l<=0)return t[0];if(l>=1)return t[t.length-1];const r=(t.length-1)*l,s=Math.floor(r),f=s+1,c=r%1,d=t[s],m=t[f];return f>=t.length||a||typeof d=="string"||typeof m=="string"?d:d*(1-c)+m*c}function mt(t,e){if(t){if(at.has(t))return O(e);if(ot.has(t))return E(e,!1);if(t==="esriFieldTypeTimestampOffset")return pt(e);const a=E(e,!0);if(t==="esriFieldTypeString")return a;if(t==="esriFieldTypeGUID"||t==="esriFieldTypeGlobalID")return(o,r)=>a(G(o),G(r))}const n=e?1:-1,l=O(e),i=E(e,!0);return(a,o)=>typeof a=="number"&&typeof o=="number"?l(a,o):typeof a=="string"&&typeof o=="string"?i(a,o):n}const M=(t,e)=>t==null?e==null?0:1:e==null?-1:null,w=(t,e)=>t==null?e==null?0:-1:e==null?1:null;function ct(t){return t?M:w}const ft=(t,e)=>w(t,e)??(t===e?0:new Date(t).getTime()-new Date(e).getTime()),dt=(t,e)=>M(t,e)??(t===e?0:new Date(e).getTime()-new Date(t).getTime());function pt(t){return t?dt:ft}const ht=(t,e)=>w(t,e)??(t===e?0:tM(t,e)??(t===e?0:t{const a=n(l,i);return a??((l=l.toUpperCase())>(i=i.toUpperCase())?-1:l{const a=n(l,i);return a??((l=l.toUpperCase())<(i=i.toUpperCase())?-1:l>i?1:0)}}const yt=(t,e)=>M(t,e)??e-t,Tt=(t,e)=>w(t,e)??t-e;function O(t){return t?yt:Tt}function G(t){return t.substr(24,12)+t.substr(19,4)+t.substr(16,2)+t.substr(14,2)+t.substr(11,2)+t.substr(9,2)+t.substr(6,2)+t.substr(4,2)+t.substr(2,2)+t.substr(0,2)}function Ct(t,e){let n;for(n in t)rt.includes(n)&&(Number.isFinite(t[n])||(t[n]=null));return e&&["avg","stddev","variance"].forEach(l=>{t[l]!=null&&(t[l]=Math.ceil(t[l]??0))}),t}function Et(t){const e={};for(let n of t)(n==null||typeof n=="string"&&n.trim()==="")&&(n=null),e[n]==null?e[n]={count:1,data:n}:e[n].count++;return{count:e}}function k(t){return(t==null?void 0:t.type)!=="coded-value"?[]:t.codedValues.map(e=>e.code)}function kt(t,e,n,l){const i=t.count,a=[];if(n&&e){const o=[],r=k(e[0]);for(const s of r)if(e[1]){const f=k(e[1]);for(const c of f)if(e[2]){const d=k(e[2]);for(const m of d)o.push(`${V(s)}${l}${V(c)}${l}${V(m)}`)}else o.push(`${V(s)}${l}${V(c)}`)}else o.push(s);for(const s of o)i.hasOwnProperty(s)||(i[s]={data:s,count:0})}for(const o in i){const r=i[o];a.push({value:r.data,count:r.count,label:r.label})}return{uniqueValueInfos:a}}function gt(t,e,n,l){let i=null;switch(e){case"log":t!==0&&(i=Math.log(t)*Math.LOG10E);break;case"percent-of-total":Number.isFinite(l)&&l!==0&&(i=t/l*100);break;case"field":Number.isFinite(n)&&n!==0&&(i=t/n);break;case"natural-log":t>0&&(i=Math.log(t));break;case"square-root":t>0&&(i=t**.5)}return i}function bt(t,e){const n=Vt({field:e.field,normalizationType:e.normalizationType,normalizationField:e.normalizationField,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||nt});return t=xt(t,e.minValue,e.maxValue),H({definition:n,values:t,normalizationTotal:e.normalizationTotal})}function xt(t,e,n){const l=e??-1/0,i=n??1/0;return t.filter(a=>Number.isFinite(a)&&a>=l&&a<=i)}function Vt(t){const{breakCount:e,field:n,normalizationField:l,normalizationType:i}=t,a=t.classificationMethod||tt,o=a==="standard-deviation"?t.standardDeviationInterval||et:void 0;return new J({breakCount:e,classificationField:n,classificationMethod:a,normalizationField:i==="field"?l:void 0,normalizationType:i,standardDeviationInterval:o})}function Ot(t,e){var s,f;let n=t.classBreaks;const l=n.length,i=(s=n[0])==null?void 0:s.minValue,a=(f=n[l-1])==null?void 0:f.maxValue,o=e==="standard-deviation",r=it;return n=n.map(c=>{const d=c.label,m={minValue:c.minValue,maxValue:c.maxValue,label:d};if(o&&d){const h=d.match(r),u=(h==null?void 0:h.map(v=>+v.trim()))??[];u.length===2?(m.minStdDev=u[0],m.maxStdDev=u[1],u[0]<0&&u[1]>0&&(m.hasAvg=!0)):u.length===1&&(d.includes("<")?(m.minStdDev=null,m.maxStdDev=u[0]):d.includes(">")&&(m.minStdDev=u[0],m.maxStdDev=null))}return m}),{minValue:i,maxValue:a,classBreakInfos:n,normalizationTotal:t.normalizationTotal}}function Gt(t,e){const n=Ft(t,e);if(n.min==null&&n.max==null)return{bins:[],minValue:n.min,maxValue:n.max,normalizationTotal:e.normalizationTotal};const l=n.intervals,i=n.min??0,a=n.max??0,o=l.map((r,s)=>({minValue:l[s][0],maxValue:l[s][1],count:0}));for(const r of t)if(r!=null&&r>=i&&r<=a){const s=$t(l,r);s>-1&&o[s].count++}return{bins:o,minValue:i,maxValue:a,normalizationTotal:e.normalizationTotal}}function Ft(t,e){const{field:n,classificationMethod:l,standardDeviationInterval:i,normalizationType:a,normalizationField:o,normalizationTotal:r,minValue:s,maxValue:f}=e,c=e.numBins||lt;let d=null,m=null,h=null;if((!l||l==="equal-interval")&&!a){if(s!=null&&f!=null)d=s,m=f;else{const u=ut({values:t,minValue:s,maxValue:f,useSampleStdDev:!a,supportsNullCount:st({normalizationType:a,normalizationField:o,minValue:s,maxValue:f})});d=u.min??null,m=u.max??null}h=It(d??0,m??0,c)}else{const{classBreaks:u}=bt(t,{field:n,normalizationType:a,normalizationField:o,normalizationTotal:r,classificationMethod:l,standardDeviationInterval:i,minValue:s,maxValue:f,numClasses:c});d=u[0].minValue,m=u[u.length-1].maxValue,h=u.map(v=>[v.minValue,v.maxValue])}return{min:d,max:m,intervals:h}}function $t(t,e){let n=-1;for(let l=t.length-1;l>=0;l--)if(e>=t[l][0]){n=l;break}return n}function It(t,e,n){const l=(e-t)/n,i=[];let a,o=t;for(let r=1;r<=n;r++)a=o+l,a=Number(a.toFixed(16)),i.push([o,r===n?e:a]),o=a;return i}let x=null;const Nt=/^(?([0-1][0-9])|([2][0-3])):(?[0-5][0-9])(:(?[0-5][0-9]))?([.](?\d+))?$/;function zt(t,e,n){return t.x<0?t.x+=e:t.x>n&&(t.x-=e),t}function Pt(t,e,n,l){const i=B(n)?L(n):null,a=i?Math.round((i.valid[1]-i.valid[0])/e.scale[0]):null;return t.map(o=>{const r=new j(o.geometry);return A(e,r,r,r.hasZ,r.hasM),o.geometry=i?zt(r,a??0,l[0]):r,o})}function Ut(t,e=18,n,l,i,a){const o=new Float64Array(i*a);e=Math.round(Q(e));let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,f=0,c=0,d=0,m=0;const h=W(l,n);for(const{geometry:v,attributes:$}of t){const{x:T,y:F}=v,I=Math.max(0,T-e),N=Math.max(0,F-e),z=Math.min(a,F+e),y=Math.min(i,T+e),g=+h($);for(let p=N;ps&&(s=f),m++}}if(!m)return{mean:0,stddev:0,min:0,max:0,mid:0,count:0};const u=(s-r)/2;return{mean:c/m,stdDev:Math.sqrt((d-c*c/m)/m),min:r,max:s,mid:u,count:m}}function Dt(t){const e=Nt.exec(t);if(!e)return null;const{hh:n,mm:l,ss:i,ms:a}=e.groups;return Number(n)*C.hours+Number(l)*C.minutes+Number(i)*C.seconds+Number(a||0)}async function qt(t,e,n=!0){if(!e)return[];const{field:l,field2:i,field3:a,fieldDelimiter:o,fieldInfos:r,timeZone:s}=t,f=l&&(r==null?void 0:r.find(y=>y.name.toLowerCase()===l.toLowerCase())),c=!!f&&Y(f),d=!!f&&_(f),m=t.valueExpression,h=t.normalizationType,u=t.normalizationField,v=t.normalizationTotal,$=[],T=t.viewInfoParams;let F=null,I=null;if(m){if(!x){const{arcadeUtils:y}=await Z();x=y}x.hasGeometryOperations(m)&&await x.enableGeometryOperations(),F=x.createFunction(m),I=T?x.getViewInfo({viewingMode:T.viewingMode,scale:T.scale,spatialReference:new R(T.spatialReference)}):null}const N=t.fieldInfos,z=!(e[0]&&"declaredClass"in e[0]&&e[0].declaredClass==="esri.Graphic")&&N?{fields:N}:null;return e.forEach(y=>{const g=y.attributes;let p;if(m){const b=z?{...y,layer:z}:y,D=x.createExecContext(b,I,s);p=x.executeFunction(F,D)}else g&&(p=g[l],i?(p=`${V(p)}${o}${V(g[i])}`,a&&(p=`${p}${o}${V(g[a])}`)):typeof p=="string"&&n&&(d?p=p?new Date(p).getTime():null:c&&(p=p?Dt(p):null)));if(h&&typeof p=="number"&&isFinite(p)){const b=g&&parseFloat(g[u]);p=gt(p,h,b,v)}$.push(p)}),$}export{kt as $,gt as B,Ct as C,bt as E,Ot as P,mt as T,Gt as U,qt as b,V as c,St as d,st as f,Pt as j,Et as k,ut as p,P as v,Dt as w,Ut as x}; +import{iW as U,dZ as B,L as Z,iX as Y,iY as C,cX as _,cW as j,cZ as A,d2 as R,gL as W,iZ as X,i_ as Q}from"./index-pCX-0tJH.js";import{a as H,d as J}from"./generateRendererUtils-3JJTfr19.js";const K="",tt="equal-interval",et=1,nt=5,lt=10,it=/\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*/gi,at=new Set(["esriFieldTypeDate","esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeSingle","esriFieldTypeDouble","esriFieldTypeLong","esriFieldTypeOID","esriFieldTypeBigInteger"]),ot=new Set(["esriFieldTypeTimeOnly","esriFieldTypeDateOnly"]),rt=["min","max","avg","stddev","count","sum","variance","nullcount","median"];function F(t){return t==null||typeof t=="string"&&!t?K:t}function st(t){const e=t.normalizationField!=null||t.normalizationType!=null,n=t.minValue!=null||t.maxValue!=null,l=!!t.sqlExpression&&t.supportsSQLExpression;return!e&&!n&&!l}function St(t){const e=t.returnDistinct?[...new Set(t.values)]:t.values,n=e.filter(a=>a!=null).sort(),l=n.length,i={count:l,min:n[0],max:n[l-1]};return t.supportsNullCount&&(i.nullcount=e.length-l),t.percentileParams&&(i.median=L(e,t.percentileParams)),i}function ut(t){const{values:e,useSampleStdDev:n,supportsNullCount:l}=t;let i=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=null,r=null,s=null,f=null,m=0;const d=t.minValue==null?-1/0:t.minValue,c=t.maxValue==null?1/0:t.maxValue;for(const u of e)Number.isFinite(u)?u>=d&&u<=c&&(o=o===null?u:o+u,i=Math.min(i,u),a=Math.max(a,u),m++):typeof u=="string"&&m++;if(m&&o!=null){r=o/m;let u=0;for(const v of e)Number.isFinite(v)&&v>=d&&v<=c&&(u+=(v-r)**2);f=n?m>1?u/(m-1):0:m>0?u/m:0,s=Math.sqrt(f)}else i=null,a=null;const h={avg:r,count:m,max:a,min:i,stddev:s,sum:o,variance:f};return l&&(h.nullcount=e.length-m),t.percentileParams&&(h.median=L(e,t.percentileParams)),h}function L(t,e){const{fieldType:n,value:l,orderBy:i,isDiscrete:a}=e,o=ct(n,i==="desc");if((t=[...t].filter(h=>h!=null).sort((h,u)=>o(h,u))).length===0)return null;if(l<=0)return t[0];if(l>=1)return t[t.length-1];const r=(t.length-1)*l,s=Math.floor(r),f=s+1,m=r%1,d=t[s],c=t[f];return f>=t.length||a||typeof d=="string"||typeof c=="string"?d:d*(1-m)+c*m}function ct(t,e){if(t){if(at.has(t))return O(e);if(ot.has(t))return E(e,!1);if(t==="esriFieldTypeTimestampOffset")return pt(e);const a=E(e,!0);if(t==="esriFieldTypeString")return a;if(t==="esriFieldTypeGUID"||t==="esriFieldTypeGlobalID")return(o,r)=>a(G(o),G(r))}const n=e?1:-1,l=O(e),i=E(e,!0);return(a,o)=>typeof a=="number"&&typeof o=="number"?l(a,o):typeof a=="string"&&typeof o=="string"?i(a,o):n}const M=(t,e)=>t==null?e==null?0:1:e==null?-1:null,w=(t,e)=>t==null?e==null?0:-1:e==null?1:null;function mt(t){return t?M:w}const ft=(t,e)=>w(t,e)??(t===e?0:new Date(t).getTime()-new Date(e).getTime()),dt=(t,e)=>M(t,e)??(t===e?0:new Date(e).getTime()-new Date(t).getTime());function pt(t){return t?dt:ft}const ht=(t,e)=>w(t,e)??(t===e?0:tM(t,e)??(t===e?0:t{const a=n(l,i);return a??((l=l.toUpperCase())>(i=i.toUpperCase())?-1:l{const a=n(l,i);return a??((l=l.toUpperCase())<(i=i.toUpperCase())?-1:l>i?1:0)}}const yt=(t,e)=>M(t,e)??e-t,gt=(t,e)=>w(t,e)??t-e;function O(t){return t?yt:gt}function G(t){return t.substr(24,12)+t.substr(19,4)+t.substr(16,2)+t.substr(14,2)+t.substr(11,2)+t.substr(9,2)+t.substr(6,2)+t.substr(4,2)+t.substr(2,2)+t.substr(0,2)}function Ct(t,e){let n;for(n in t)rt.includes(n)&&(Number.isFinite(t[n])||(t[n]=null));return e&&["avg","stddev","variance"].forEach(l=>{t[l]!=null&&(t[l]=Math.ceil(t[l]??0))}),t}function Et(t){const e={};for(let n of t)(n==null||typeof n=="string"&&n.trim()==="")&&(n=null),e[n]==null?e[n]={count:1,data:n}:e[n].count++;return{count:e}}function k(t){return(t==null?void 0:t.type)!=="coded-value"?[]:t.codedValues.map(e=>e.code)}function kt(t,e,n,l){const i=t.count,a=[];if(n&&e){const o=[],r=k(e[0]);for(const s of r)if(e[1]){const f=k(e[1]);for(const m of f)if(e[2]){const d=k(e[2]);for(const c of d)o.push(`${F(s)}${l}${F(m)}${l}${F(c)}`)}else o.push(`${F(s)}${l}${F(m)}`)}else o.push(s);for(const s of o)i.hasOwnProperty(s)||(i[s]={data:s,count:0})}for(const o in i){const r=i[o];a.push({value:r.data,count:r.count,label:r.label})}return{uniqueValueInfos:a}}function Tt(t,e,n,l){let i=null;switch(e){case"log":t!==0&&(i=Math.log(t)*Math.LOG10E);break;case"percent-of-total":Number.isFinite(l)&&l!==0&&(i=t/l*100);break;case"field":Number.isFinite(n)&&n!==0&&(i=t/n);break;case"natural-log":t>0&&(i=Math.log(t));break;case"square-root":t>0&&(i=t**.5)}return i}function bt(t,e){const n=Ft({field:e.field,normalizationType:e.normalizationType,normalizationField:e.normalizationField,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||nt});return t=xt(t,e.minValue,e.maxValue),H({definition:n,values:t,normalizationTotal:e.normalizationTotal})}function xt(t,e,n){const l=e??-1/0,i=n??1/0;return t.filter(a=>Number.isFinite(a)&&a>=l&&a<=i)}function Ft(t){const{breakCount:e,field:n,normalizationField:l,normalizationType:i}=t,a=t.classificationMethod||tt,o=a==="standard-deviation"?t.standardDeviationInterval||et:void 0;return new J({breakCount:e,classificationField:n,classificationMethod:a,normalizationField:i==="field"?l:void 0,normalizationType:i,standardDeviationInterval:o})}function Ot(t,e){var s,f;let n=t.classBreaks;const l=n.length,i=(s=n[0])==null?void 0:s.minValue,a=(f=n[l-1])==null?void 0:f.maxValue,o=e==="standard-deviation",r=it;return n=n.map(m=>{const d=m.label,c={minValue:m.minValue,maxValue:m.maxValue,label:d};if(o&&d){const h=d.match(r),u=(h==null?void 0:h.map(v=>+v.trim()))??[];u.length===2?(c.minStdDev=u[0],c.maxStdDev=u[1],u[0]<0&&u[1]>0&&(c.hasAvg=!0)):u.length===1&&(d.includes("<")?(c.minStdDev=null,c.maxStdDev=u[0]):d.includes(">")&&(c.minStdDev=u[0],c.maxStdDev=null))}return c}),{minValue:i,maxValue:a,classBreakInfos:n,normalizationTotal:t.normalizationTotal}}function Gt(t,e){const n=Vt(t,e);if(n.min==null&&n.max==null)return{bins:[],minValue:n.min,maxValue:n.max,normalizationTotal:e.normalizationTotal};const l=n.intervals,i=n.min??0,a=n.max??0,o=l.map((r,s)=>({minValue:l[s][0],maxValue:l[s][1],count:0}));for(const r of t)if(r!=null&&r>=i&&r<=a){const s=$t(l,r);s>-1&&o[s].count++}return{bins:o,minValue:i,maxValue:a,normalizationTotal:e.normalizationTotal}}function Vt(t,e){const{field:n,classificationMethod:l,standardDeviationInterval:i,normalizationType:a,normalizationField:o,normalizationTotal:r,minValue:s,maxValue:f}=e,m=e.numBins||lt;let d=null,c=null,h=null;if((!l||l==="equal-interval")&&!a){if(s!=null&&f!=null)d=s,c=f;else{const u=ut({values:t,minValue:s,maxValue:f,useSampleStdDev:!a,supportsNullCount:st({normalizationType:a,normalizationField:o,minValue:s,maxValue:f})});d=u.min??null,c=u.max??null}h=It(d??0,c??0,m)}else{const{classBreaks:u}=bt(t,{field:n,normalizationType:a,normalizationField:o,normalizationTotal:r,classificationMethod:l,standardDeviationInterval:i,minValue:s,maxValue:f,numClasses:m});d=u[0].minValue,c=u[u.length-1].maxValue,h=u.map(v=>[v.minValue,v.maxValue])}return{min:d,max:c,intervals:h}}function $t(t,e){let n=-1;for(let l=t.length-1;l>=0;l--)if(e>=t[l][0]){n=l;break}return n}function It(t,e,n){const l=(e-t)/n,i=[];let a,o=t;for(let r=1;r<=n;r++)a=o+l,a=Number(a.toFixed(16)),i.push([o,r===n?e:a]),o=a;return i}let x=null;const Nt=/^(?([0-1][0-9])|([2][0-3])):(?[0-5][0-9])(:(?[0-5][0-9]))?([.](?\d+))?$/;function zt(t,e,n){return t.x<0?t.x+=e:t.x>n&&(t.x-=e),t}function Lt(t,e,n,l){const i=U(n)?B(n):null,a=i?Math.round((i.valid[1]-i.valid[0])/e.scale[0]):null;return t.map(o=>{const r=new Z(o.geometry);return Y(e,r,r,r.hasZ,r.hasM),o.geometry=i?zt(r,a??0,l[0]):r,o})}function Pt(t,e=18,n,l,i,a){const o=new Float64Array(i*a);e=Math.round(W(e));let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,f=0,m=0,d=0,c=0;const h=X(l,n);for(const{geometry:v,attributes:$}of t){const{x:g,y:V}=v,I=Math.max(0,g-e),N=Math.max(0,V-e),z=Math.min(a,V+e),y=Math.min(i,g+e),T=+h($);for(let p=N;ps&&(s=f),c++}}if(!c)return{mean:0,stddev:0,min:0,max:0,mid:0,count:0};const u=(s-r)/2;return{mean:m/c,stdDev:Math.sqrt((d-m*m/c)/c),min:r,max:s,mid:u,count:c}}function Dt(t){const e=Nt.exec(t);if(!e)return null;const{hh:n,mm:l,ss:i,ms:a}=e.groups;return Number(n)*C.hours+Number(l)*C.minutes+Number(i)*C.seconds+Number(a||0)}async function qt(t,e,n=!0){if(!e)return[];const{field:l,field2:i,field3:a,fieldDelimiter:o,fieldInfos:r,timeZone:s}=t,f=l&&(r==null?void 0:r.find(y=>y.name.toLowerCase()===l.toLowerCase())),m=!!f&&_(f),d=!!f&&j(f),c=t.valueExpression,h=t.normalizationType,u=t.normalizationField,v=t.normalizationTotal,$=[],g=t.viewInfoParams;let V=null,I=null;if(c){if(!x){const{arcadeUtils:y}=await A();x=y}x.hasGeometryOperations(c)&&await x.enableGeometryOperations(),V=x.createFunction(c),I=g?x.getViewInfo({viewingMode:g.viewingMode,scale:g.scale,spatialReference:new R(g.spatialReference)}):null}const N=t.fieldInfos,z=!(e[0]&&"declaredClass"in e[0]&&e[0].declaredClass==="esri.Graphic")&&N?{fields:N}:null;return e.forEach(y=>{const T=y.attributes;let p;if(c){const b=z?{...y,layer:z}:y,D=x.createExecContext(b,I,s);p=x.executeFunction(V,D)}else T&&(p=T[l],i?(p=`${F(p)}${o}${F(T[i])}`,a&&(p=`${p}${o}${F(T[a])}`)):typeof p=="string"&&n&&(d?p=p?new Date(p).getTime():null:m&&(p=p?Dt(p):null)));if(h&&typeof p=="number"&&isFinite(p)){const b=T&&parseFloat(T[u]);p=Tt(p,h,b,v)}$.push(p)}),$}export{kt as $,Tt as B,Ct as C,bt as E,Ot as P,ct as T,Gt as U,qt as b,F as c,St as d,st as f,Lt as j,Et as k,ut as p,L as v,Dt as w,Pt as x}; diff --git a/dist/assets/utils3-_ao2jQXg.js b/dist/assets/utils3--QEgMxFs.js similarity index 98% rename from dist/assets/utils3-_ao2jQXg.js rename to dist/assets/utils3--QEgMxFs.js index 3017e9f..c3e8c5b 100644 --- a/dist/assets/utils3-_ao2jQXg.js +++ b/dist/assets/utils3--QEgMxFs.js @@ -1,4 +1,4 @@ -import"./index-J0iiHjMT.js";/*! +import"./index-pCX-0tJH.js";/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details. * v1.11.0 diff --git a/dist/assets/versionUtils-4v9zIDlv.js b/dist/assets/versionUtils-idhrDltC.js similarity index 98% rename from dist/assets/versionUtils-4v9zIDlv.js rename to dist/assets/versionUtils-idhrDltC.js index e554eea..d527b66 100644 --- a/dist/assets/versionUtils-4v9zIDlv.js +++ b/dist/assets/versionUtils-idhrDltC.js @@ -1 +1 @@ -import{dv as f}from"./index-J0iiHjMT.js";const e=[];function l(d,t){if(f(d.url??""))return!0;const{wkid:o}=t;for(const r of e){if((d.version??0)>=r[0])return!0;if(typeof r[1]=="function"&&(r[1]=r[1]()),r[1].has(o))return!1}return!0}e.push([10.91,()=>{const d=new Set([9709,9716,9741,9761,9766]);for(let t=9712;t<=9713;t++)d.add(t);for(let t=9748;t<=9749;t++)d.add(t);for(let t=20904;t<=20932;t++)d.add(t);for(let t=21004;t<=21032;t++)d.add(t);for(let t=21207;t<=21264;t++)d.add(t);for(let t=21307;t<=21364;t++)d.add(t);for(let t=23301;t<=23333;t++)d.add(t);for(let t=102759;t<=102760;t++)d.add(t);for(let t=102934;t<=102955;t++)d.add(t);return d}]),e.push([10.9,()=>{const d=new Set([9300,9354,9364,9367,9373,9377,9387,9456,9473,9498,9678,9680,29874,103599,103872,104028]);for(let t=9356;t<=9360;t++)d.add(t);for(let t=9404;t<=9407;t++)d.add(t);for(let t=9476;t<=9482;t++)d.add(t);for(let t=9487;t<=9494;t++)d.add(t);for(let t=9697;t<=9699;t++)d.add(t);return d}]),e.push([10.81,()=>{const d=new Set([9265,9333,103598,103699]);for(let t=9248;t<=9254;t++)d.add(t);for(let t=9271;t<=9273;t++)d.add(t);for(let t=9284;t<=9285;t++)d.add(t);for(let t=21453;t<=21463;t++)d.add(t);return d}]),e.push([10.8,()=>{const d=new Set([8088,8395,8428,8433,8531,8687,8692,8694,8699,8900,9003,9006,9009,9012,9017,9191]);for(let t=8035;t<=8036;t++)d.add(t);for(let t=8455;t<=8456;t++)d.add(t);for(let t=8518;t<=8529;t++)d.add(t);for(let t=8533;t<=8536;t++)d.add(t);for(let t=8538;t<=8540;t++)d.add(t);for(let t=8677;t<=8679;t++)d.add(t);for(let t=8902;t<=8903;t++)d.add(t);for(let t=8907;t<=8910;t++)d.add(t);for(let t=8949;t<=8951;t++)d.add(t);for(let t=8972;t<=8987;t++)d.add(t);for(let t=9039;t<=9040;t++)d.add(t);for(let t=9068;t<=9069;t++)d.add(t);for(let t=9140;t<=9141;t++)d.add(t);for(let t=9148;t<=9150;t++)d.add(t);for(let t=9153;t<=9159;t++)d.add(t);for(let t=9205;t<=9218;t++)d.add(t);for(let t=9221;t<=9222;t++)d.add(t);for(let t=54098;t<=54101;t++)d.add(t);return d}]),e.push([10.71,()=>{const d=new Set([6316]);for(let t=8351;t<=8353;t++)d.add(t);for(let t=9294;t<=9297;t++)d.add(t);for(let t=22619;t<=22621;t++)d.add(t);for(let t=103586;t<=103594;t++)d.add(t);return d}]),e.push([10.7,()=>{const d=new Set([8387,8391,8427,8545,8682,8685,8818,31370,104022,104024,104975]);for(let t=8065;t<=8068;t++)d.add(t);for(let t=8082;t<=8083;t++)d.add(t);for(let t=8379;t<=8385;t++)d.add(t);for(let t=8836;t<=8840;t++)d.add(t);for(let t=8857;t<=8860;t++)d.add(t);for(let t=53035;t<=53037;t++)d.add(t);for(let t=54090;t<=54091;t++)d.add(t);for(let t=102498;t<=102499;t++)d.add(t);return d}]),e.push([10.61,()=>new Set([102497])]),e.push([10.6,()=>{const d=new Set([7803,7805,7887,8086,8232,8237,8240,8246,8249,8252,8255,9019,9391]);for(let t=7755;t<=7787;t++)d.add(t);for(let t=7791;t<=7795;t++)d.add(t);for(let t=7799;t<=7801;t++)d.add(t);for(let t=7825;t<=7831;t++)d.add(t);for(let t=7877;t<=7878;t++)d.add(t);for(let t=7882;t<=7883;t++)d.add(t);for(let t=7991;t<=7992;t++)d.add(t);for(let t=8042;t<=8043;t++)d.add(t);for(let t=8058;t<=8059;t++)d.add(t);for(let t=8311;t<=8348;t++)d.add(t);for(let t=9060;t<=9067;t++)d.add(t);for(let t=102562;t<=102568;t++)d.add(t);for(let t=102799;t<=102900;t++)d.add(t);return d}]);export{l as e}; +import{dv as f}from"./index-pCX-0tJH.js";const e=[];function l(d,t){if(f(d.url??""))return!0;const{wkid:o}=t;for(const r of e){if((d.version??0)>=r[0])return!0;if(typeof r[1]=="function"&&(r[1]=r[1]()),r[1].has(o))return!1}return!0}e.push([10.91,()=>{const d=new Set([9709,9716,9741,9761,9766]);for(let t=9712;t<=9713;t++)d.add(t);for(let t=9748;t<=9749;t++)d.add(t);for(let t=20904;t<=20932;t++)d.add(t);for(let t=21004;t<=21032;t++)d.add(t);for(let t=21207;t<=21264;t++)d.add(t);for(let t=21307;t<=21364;t++)d.add(t);for(let t=23301;t<=23333;t++)d.add(t);for(let t=102759;t<=102760;t++)d.add(t);for(let t=102934;t<=102955;t++)d.add(t);return d}]),e.push([10.9,()=>{const d=new Set([9300,9354,9364,9367,9373,9377,9387,9456,9473,9498,9678,9680,29874,103599,103872,104028]);for(let t=9356;t<=9360;t++)d.add(t);for(let t=9404;t<=9407;t++)d.add(t);for(let t=9476;t<=9482;t++)d.add(t);for(let t=9487;t<=9494;t++)d.add(t);for(let t=9697;t<=9699;t++)d.add(t);return d}]),e.push([10.81,()=>{const d=new Set([9265,9333,103598,103699]);for(let t=9248;t<=9254;t++)d.add(t);for(let t=9271;t<=9273;t++)d.add(t);for(let t=9284;t<=9285;t++)d.add(t);for(let t=21453;t<=21463;t++)d.add(t);return d}]),e.push([10.8,()=>{const d=new Set([8088,8395,8428,8433,8531,8687,8692,8694,8699,8900,9003,9006,9009,9012,9017,9191]);for(let t=8035;t<=8036;t++)d.add(t);for(let t=8455;t<=8456;t++)d.add(t);for(let t=8518;t<=8529;t++)d.add(t);for(let t=8533;t<=8536;t++)d.add(t);for(let t=8538;t<=8540;t++)d.add(t);for(let t=8677;t<=8679;t++)d.add(t);for(let t=8902;t<=8903;t++)d.add(t);for(let t=8907;t<=8910;t++)d.add(t);for(let t=8949;t<=8951;t++)d.add(t);for(let t=8972;t<=8987;t++)d.add(t);for(let t=9039;t<=9040;t++)d.add(t);for(let t=9068;t<=9069;t++)d.add(t);for(let t=9140;t<=9141;t++)d.add(t);for(let t=9148;t<=9150;t++)d.add(t);for(let t=9153;t<=9159;t++)d.add(t);for(let t=9205;t<=9218;t++)d.add(t);for(let t=9221;t<=9222;t++)d.add(t);for(let t=54098;t<=54101;t++)d.add(t);return d}]),e.push([10.71,()=>{const d=new Set([6316]);for(let t=8351;t<=8353;t++)d.add(t);for(let t=9294;t<=9297;t++)d.add(t);for(let t=22619;t<=22621;t++)d.add(t);for(let t=103586;t<=103594;t++)d.add(t);return d}]),e.push([10.7,()=>{const d=new Set([8387,8391,8427,8545,8682,8685,8818,31370,104022,104024,104975]);for(let t=8065;t<=8068;t++)d.add(t);for(let t=8082;t<=8083;t++)d.add(t);for(let t=8379;t<=8385;t++)d.add(t);for(let t=8836;t<=8840;t++)d.add(t);for(let t=8857;t<=8860;t++)d.add(t);for(let t=53035;t<=53037;t++)d.add(t);for(let t=54090;t<=54091;t++)d.add(t);for(let t=102498;t<=102499;t++)d.add(t);return d}]),e.push([10.61,()=>new Set([102497])]),e.push([10.6,()=>{const d=new Set([7803,7805,7887,8086,8232,8237,8240,8246,8249,8252,8255,9019,9391]);for(let t=7755;t<=7787;t++)d.add(t);for(let t=7791;t<=7795;t++)d.add(t);for(let t=7799;t<=7801;t++)d.add(t);for(let t=7825;t<=7831;t++)d.add(t);for(let t=7877;t<=7878;t++)d.add(t);for(let t=7882;t<=7883;t++)d.add(t);for(let t=7991;t<=7992;t++)d.add(t);for(let t=8042;t<=8043;t++)d.add(t);for(let t=8058;t<=8059;t++)d.add(t);for(let t=8311;t<=8348;t++)d.add(t);for(let t=9060;t<=9067;t++)d.add(t);for(let t=102562;t<=102568;t++)d.add(t);for(let t=102799;t<=102900;t++)d.add(t);return d}]);export{l as e}; diff --git a/dist/assets/vxlLayer-oRewqFuR.js b/dist/assets/vxlLayer-t5pvmNBM.js similarity index 99% rename from dist/assets/vxlLayer-oRewqFuR.js rename to dist/assets/vxlLayer-t5pvmNBM.js index ab7311e..b610277 100644 --- a/dist/assets/vxlLayer-oRewqFuR.js +++ b/dist/assets/vxlLayer-t5pvmNBM.js @@ -1,4 +1,4 @@ -import{cg as Xo}from"./index-J0iiHjMT.js";function Qo(G,sr){for(var Q=0;Qs[Z]})}}}return Object.freeze(Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}))}var Ae,zr,Pe,Tr={exports:{}};Tr.exports,Ae=Tr,Tr.exports,zr=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,Pe=function(G){var sr,Q,s=(G=G||{})!==void 0?G:{};s.ready=new Promise(function(r,e){sr=r,Q=e});var Z,tr,Te,Ur=Object.assign({},s),Hr="./this.program",je=!0,Y="";function Be(r){return s.locateFile?s.locateFile(r,Y):Y+r}typeof document<"u"&&document.currentScript&&(Y=document.currentScript.src),zr&&(Y=zr),Y=Y.indexOf("blob:")!==0?Y.substr(0,Y.replace(/[?#].*/,"").lastIndexOf("/")+1):"",Z=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},tr=(r,e,n)=>{var t=new XMLHttpRequest;t.open("GET",r,!0),t.responseType="arraybuffer",t.onload=()=>{t.status==200||t.status==0&&t.response?e(t.response):n()},t.onerror=n,t.send(null)};var cr,jr,Br=s.print||console.log.bind(console),R=s.printErr||console.warn.bind(console);Object.assign(s,Ur),Ur=null,s.arguments&&s.arguments,s.thisProgram&&(Hr=s.thisProgram),s.quit&&s.quit,s.wasmBinary&&(cr=s.wasmBinary),s.noExitRuntime,typeof WebAssembly!="object"&&U("no native wasm support detected");var Vr=!1;function Me(r,e){r||U(e)}var hr,D,P,z,or,v,k,ar,qr,J,Gr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ir(r,e,n){for(var t=e+n,a=e;r[a]&&!(a>=t);)++a;if(a-e>16&&r.buffer&&Gr)return Gr.decode(r.subarray(e,a));for(var i="";e>10,56320|1023&l)}}else i+=String.fromCharCode((31&u)<<6|c)}else i+=String.fromCharCode(u)}return i}function M(r,e){return r?ir(P,r,e):""}function Mr(r,e,n,t){if(!(t>0))return 0;for(var a=n,i=n+t-1,u=0;u=55296&&c<=57343&&(c=65536+((1023&c)<<10)|1023&r.charCodeAt(++u)),c<=127){if(n>=i)break;e[n++]=c}else if(c<=2047){if(n+1>=i)break;e[n++]=192|c>>6,e[n++]=128|63&c}else if(c<=65535){if(n+2>=i)break;e[n++]=224|c>>12,e[n++]=128|c>>6&63,e[n++]=128|63&c}else{if(n+3>=i)break;e[n++]=240|c>>18,e[n++]=128|c>>12&63,e[n++]=128|c>>6&63,e[n++]=128|63&c}}return e[n]=0,n-a}function Yr(r,e,n){return Mr(r,P,e,n)}function gr(r){for(var e=0,n=0;n=55296&&t<=57343&&(t=65536+((1023&t)<<10)|1023&r.charCodeAt(++n)),t<=127?++e:e+=t<=2047?2:t<=65535?3:4}return e}function Xr(r){hr=r,s.HEAP8=D=new Int8Array(r),s.HEAP16=z=new Int16Array(r),s.HEAP32=v=new Int32Array(r),s.HEAPU8=P=new Uint8Array(r),s.HEAPU16=or=new Uint16Array(r),s.HEAPU32=k=new Uint32Array(r),s.HEAPF32=ar=new Float32Array(r),s.HEAPF64=qr=new Float64Array(r)}s.INITIAL_MEMORY;var Qr=[],Jr=[],Kr=[];function Ie(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)Re(s.preRun.shift());Ir(Qr)}function Ne(){s.noFSInit||o.init.initialized||o.init(),o.ignorePermissions=!1,Ir(Jr)}function Le(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)We(s.postRun.shift());Ir(Kr)}function Re(r){Qr.unshift(r)}function Oe(r){Jr.unshift(r)}function We(r){Kr.unshift(r)}var K=0,fr=null;function Jo(r){return r}function _r(r){K++,s.monitorRunDependencies&&s.monitorRunDependencies(K)}function lr(r){if(K--,s.monitorRunDependencies&&s.monitorRunDependencies(K),K==0&&fr){var e=fr;fr=null,e()}}function U(r){s.onAbort&&s.onAbort(r),R(r="Aborted("+r+")"),Vr=!0,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw Q(e),e}var O,C,H,Ze="data:application/octet-stream;base64,";function $r(r){return r.startsWith(Ze)}function re(r){try{if(r==O&&cr)return new Uint8Array(cr);if(!Te)throw"both async and sync fetching of the wasm failed"}catch(e){U(e)}}function ze(){return!cr&&je&&typeof fetch=="function"?fetch(O,{credentials:"same-origin"}).then(function(r){if(!r.ok)throw"failed to load wasm binary file at '"+O+"'";return r.arrayBuffer()}).catch(function(){return re(O)}):Promise.resolve().then(function(){return re(O)})}function Ue(){var r={a:Go};function e(i,u){var c=i.exports;s.asm=c,Xr((jr=s.asm.Za).buffer),J=s.asm.$a,Oe(s.asm._a),lr()}function n(i){e(i.instance)}function t(i){return ze().then(function(u){return WebAssembly.instantiate(u,r)}).then(function(u){return u}).then(i,function(u){R("failed to asynchronously prepare wasm: "+u),U(u)})}function a(){return cr||typeof WebAssembly.instantiateStreaming!="function"||$r(O)||typeof fetch!="function"?t(n):fetch(O,{credentials:"same-origin"}).then(function(i){return WebAssembly.instantiateStreaming(i,r).then(n,function(u){return R("wasm streaming compile failed: "+u),R("falling back to ArrayBuffer instantiation"),t(n)})})}if(_r(),s.instantiateWasm)try{return s.instantiateWasm(r,e)}catch(i){return R("Module.instantiateWasm callback failed with error: "+i),!1}return a().catch(Q),{}}function Ir(r){for(;r.length>0;)r.shift()(s)}function He(r,e){D.set(r,e)}function Ve(r,e,n,t){U("Assertion failed: "+M(r)+", at: "+[e?M(e):"unknown filename",n,t?M(t):"unknown function"])}function qe(r){return Ar(r+24)+24}function Ge(r){this.excPtr=r,this.ptr=r-24,this.set_type=function(e){k[this.ptr+4>>2]=e},this.get_type=function(){return k[this.ptr+4>>2]},this.set_destructor=function(e){k[this.ptr+8>>2]=e},this.get_destructor=function(){return k[this.ptr+8>>2]},this.set_refcount=function(e){v[this.ptr>>2]=e},this.set_caught=function(e){e=e?1:0,D[this.ptr+12>>0]=e},this.get_caught=function(){return D[this.ptr+12>>0]!=0},this.set_rethrown=function(e){e=e?1:0,D[this.ptr+13>>0]=e},this.get_rethrown=function(){return D[this.ptr+13>>0]!=0},this.init=function(e,n){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(n),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=v[this.ptr>>2];v[this.ptr>>2]=e+1},this.release_ref=function(){var e=v[this.ptr>>2];return v[this.ptr>>2]=e-1,e===1},this.set_adjusted_ptr=function(e){k[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return k[this.ptr+16>>2]},this.get_exception_ptr=function(){if(De(this.get_type()))return k[this.excPtr>>2];var e=this.get_adjusted_ptr();return e!==0?e:this.excPtr}}function Ye(r,e,n){throw new Ge(r).init(e,n),r}function Xe(r){return v[Fe()>>2]=r,r}$r(O="vxlLayer.wasm")||(O=Be(O));var x={isAbs:r=>r.charAt(0)==="/",splitPath:r=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(r).slice(1),normalizeArray:(r,e)=>{for(var n=0,t=r.length-1;t>=0;t--){var a=r[t];a==="."?r.splice(t,1):a===".."?(r.splice(t,1),n++):n&&(r.splice(t,1),n--)}if(e)for(;n;n--)r.unshift("..");return r},normalize:r=>{var e=x.isAbs(r),n=r.substr(-1)==="/";return(r=x.normalizeArray(r.split("/").filter(t=>!!t),!e).join("/"))||e||(r="."),r&&n&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=x.splitPath(r),n=e[0],t=e[1];return n||t?(t&&(t=t.substr(0,t.length-1)),n+t):"."},basename:r=>{if(r==="/")return"/";var e=(r=(r=x.normalize(r)).replace(/\/$/,"")).lastIndexOf("/");return e===-1?r:r.substr(e+1)},join:function(){var r=Array.prototype.slice.call(arguments,0);return x.normalize(r.join("/"))},join2:(r,e)=>x.normalize(r+"/"+e)};function Qe(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var r=new Uint8Array(1);return function(){return crypto.getRandomValues(r),r[0]}}return function(){U("randomDevice")}}var V={resolve:function(){for(var r="",e=!1,n=arguments.length-1;n>=-1&&!e;n--){var t=n>=0?arguments[n]:o.cwd();if(typeof t!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";r=t+"/"+r,e=x.isAbs(t)}return(e?"/":"")+(r=x.normalizeArray(r.split("/").filter(a=>!!a),!e).join("/"))||"."},relative:(r,e)=>{function n(l){for(var h=0;h=0&&l[_]==="";_--);return h>_?[]:l.slice(h,_-h+1)}r=V.resolve(r).substr(1),e=V.resolve(e).substr(1);for(var t=n(r.split("/")),a=n(e.split("/")),i=Math.min(t.length,a.length),u=i,c=0;c0?n:gr(r)+1,a=new Array(t),i=Mr(r,a,0,a.length);return e&&(a.length=i),a}var $={ttys:[],init:function(){},shutdown:function(){},register:function(r,e){$.ttys[r]={input:[],output:[],ops:e},o.registerDevice(r,$.stream_ops)},stream_ops:{open:function(r){var e=$.ttys[r.node.rdev];if(!e)throw new o.ErrnoError(43);r.tty=e,r.seekable=!1},close:function(r){r.tty.ops.flush(r.tty)},flush:function(r){r.tty.ops.flush(r.tty)},read:function(r,e,n,t,a){if(!r.tty||!r.tty.ops.get_char)throw new o.ErrnoError(60);for(var i=0,u=0;us[Z]})}}}return Object.freeze(Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}))}var Ae,zr,Pe,Tr={exports:{}};Tr.exports,Ae=Tr,Tr.exports,zr=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,Pe=function(G){var sr,Q,s=(G=G||{})!==void 0?G:{};s.ready=new Promise(function(r,e){sr=r,Q=e});var Z,tr,Te,Ur=Object.assign({},s),Hr="./this.program",je=!0,Y="";function Be(r){return s.locateFile?s.locateFile(r,Y):Y+r}typeof document<"u"&&document.currentScript&&(Y=document.currentScript.src),zr&&(Y=zr),Y=Y.indexOf("blob:")!==0?Y.substr(0,Y.replace(/[?#].*/,"").lastIndexOf("/")+1):"",Z=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},tr=(r,e,n)=>{var t=new XMLHttpRequest;t.open("GET",r,!0),t.responseType="arraybuffer",t.onload=()=>{t.status==200||t.status==0&&t.response?e(t.response):n()},t.onerror=n,t.send(null)};var cr,jr,Br=s.print||console.log.bind(console),R=s.printErr||console.warn.bind(console);Object.assign(s,Ur),Ur=null,s.arguments&&s.arguments,s.thisProgram&&(Hr=s.thisProgram),s.quit&&s.quit,s.wasmBinary&&(cr=s.wasmBinary),s.noExitRuntime,typeof WebAssembly!="object"&&U("no native wasm support detected");var Vr=!1;function Me(r,e){r||U(e)}var hr,D,P,z,or,v,k,ar,qr,J,Gr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ir(r,e,n){for(var t=e+n,a=e;r[a]&&!(a>=t);)++a;if(a-e>16&&r.buffer&&Gr)return Gr.decode(r.subarray(e,a));for(var i="";e>10,56320|1023&l)}}else i+=String.fromCharCode((31&u)<<6|c)}else i+=String.fromCharCode(u)}return i}function M(r,e){return r?ir(P,r,e):""}function Mr(r,e,n,t){if(!(t>0))return 0;for(var a=n,i=n+t-1,u=0;u=55296&&c<=57343&&(c=65536+((1023&c)<<10)|1023&r.charCodeAt(++u)),c<=127){if(n>=i)break;e[n++]=c}else if(c<=2047){if(n+1>=i)break;e[n++]=192|c>>6,e[n++]=128|63&c}else if(c<=65535){if(n+2>=i)break;e[n++]=224|c>>12,e[n++]=128|c>>6&63,e[n++]=128|63&c}else{if(n+3>=i)break;e[n++]=240|c>>18,e[n++]=128|c>>12&63,e[n++]=128|c>>6&63,e[n++]=128|63&c}}return e[n]=0,n-a}function Yr(r,e,n){return Mr(r,P,e,n)}function gr(r){for(var e=0,n=0;n=55296&&t<=57343&&(t=65536+((1023&t)<<10)|1023&r.charCodeAt(++n)),t<=127?++e:e+=t<=2047?2:t<=65535?3:4}return e}function Xr(r){hr=r,s.HEAP8=D=new Int8Array(r),s.HEAP16=z=new Int16Array(r),s.HEAP32=v=new Int32Array(r),s.HEAPU8=P=new Uint8Array(r),s.HEAPU16=or=new Uint16Array(r),s.HEAPU32=k=new Uint32Array(r),s.HEAPF32=ar=new Float32Array(r),s.HEAPF64=qr=new Float64Array(r)}s.INITIAL_MEMORY;var Qr=[],Jr=[],Kr=[];function Ie(){if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)Re(s.preRun.shift());Ir(Qr)}function Ne(){s.noFSInit||o.init.initialized||o.init(),o.ignorePermissions=!1,Ir(Jr)}function Le(){if(s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;)We(s.postRun.shift());Ir(Kr)}function Re(r){Qr.unshift(r)}function Oe(r){Jr.unshift(r)}function We(r){Kr.unshift(r)}var K=0,fr=null;function Jo(r){return r}function _r(r){K++,s.monitorRunDependencies&&s.monitorRunDependencies(K)}function lr(r){if(K--,s.monitorRunDependencies&&s.monitorRunDependencies(K),K==0&&fr){var e=fr;fr=null,e()}}function U(r){s.onAbort&&s.onAbort(r),R(r="Aborted("+r+")"),Vr=!0,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw Q(e),e}var O,C,H,Ze="data:application/octet-stream;base64,";function $r(r){return r.startsWith(Ze)}function re(r){try{if(r==O&&cr)return new Uint8Array(cr);if(!Te)throw"both async and sync fetching of the wasm failed"}catch(e){U(e)}}function ze(){return!cr&&je&&typeof fetch=="function"?fetch(O,{credentials:"same-origin"}).then(function(r){if(!r.ok)throw"failed to load wasm binary file at '"+O+"'";return r.arrayBuffer()}).catch(function(){return re(O)}):Promise.resolve().then(function(){return re(O)})}function Ue(){var r={a:Go};function e(i,u){var c=i.exports;s.asm=c,Xr((jr=s.asm.Za).buffer),J=s.asm.$a,Oe(s.asm._a),lr()}function n(i){e(i.instance)}function t(i){return ze().then(function(u){return WebAssembly.instantiate(u,r)}).then(function(u){return u}).then(i,function(u){R("failed to asynchronously prepare wasm: "+u),U(u)})}function a(){return cr||typeof WebAssembly.instantiateStreaming!="function"||$r(O)||typeof fetch!="function"?t(n):fetch(O,{credentials:"same-origin"}).then(function(i){return WebAssembly.instantiateStreaming(i,r).then(n,function(u){return R("wasm streaming compile failed: "+u),R("falling back to ArrayBuffer instantiation"),t(n)})})}if(_r(),s.instantiateWasm)try{return s.instantiateWasm(r,e)}catch(i){return R("Module.instantiateWasm callback failed with error: "+i),!1}return a().catch(Q),{}}function Ir(r){for(;r.length>0;)r.shift()(s)}function He(r,e){D.set(r,e)}function Ve(r,e,n,t){U("Assertion failed: "+M(r)+", at: "+[e?M(e):"unknown filename",n,t?M(t):"unknown function"])}function qe(r){return Ar(r+24)+24}function Ge(r){this.excPtr=r,this.ptr=r-24,this.set_type=function(e){k[this.ptr+4>>2]=e},this.get_type=function(){return k[this.ptr+4>>2]},this.set_destructor=function(e){k[this.ptr+8>>2]=e},this.get_destructor=function(){return k[this.ptr+8>>2]},this.set_refcount=function(e){v[this.ptr>>2]=e},this.set_caught=function(e){e=e?1:0,D[this.ptr+12>>0]=e},this.get_caught=function(){return D[this.ptr+12>>0]!=0},this.set_rethrown=function(e){e=e?1:0,D[this.ptr+13>>0]=e},this.get_rethrown=function(){return D[this.ptr+13>>0]!=0},this.init=function(e,n){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(n),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=v[this.ptr>>2];v[this.ptr>>2]=e+1},this.release_ref=function(){var e=v[this.ptr>>2];return v[this.ptr>>2]=e-1,e===1},this.set_adjusted_ptr=function(e){k[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return k[this.ptr+16>>2]},this.get_exception_ptr=function(){if(De(this.get_type()))return k[this.excPtr>>2];var e=this.get_adjusted_ptr();return e!==0?e:this.excPtr}}function Ye(r,e,n){throw new Ge(r).init(e,n),r}function Xe(r){return v[Fe()>>2]=r,r}$r(O="vxlLayer.wasm")||(O=Be(O));var x={isAbs:r=>r.charAt(0)==="/",splitPath:r=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(r).slice(1),normalizeArray:(r,e)=>{for(var n=0,t=r.length-1;t>=0;t--){var a=r[t];a==="."?r.splice(t,1):a===".."?(r.splice(t,1),n++):n&&(r.splice(t,1),n--)}if(e)for(;n;n--)r.unshift("..");return r},normalize:r=>{var e=x.isAbs(r),n=r.substr(-1)==="/";return(r=x.normalizeArray(r.split("/").filter(t=>!!t),!e).join("/"))||e||(r="."),r&&n&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=x.splitPath(r),n=e[0],t=e[1];return n||t?(t&&(t=t.substr(0,t.length-1)),n+t):"."},basename:r=>{if(r==="/")return"/";var e=(r=(r=x.normalize(r)).replace(/\/$/,"")).lastIndexOf("/");return e===-1?r:r.substr(e+1)},join:function(){var r=Array.prototype.slice.call(arguments,0);return x.normalize(r.join("/"))},join2:(r,e)=>x.normalize(r+"/"+e)};function Qe(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var r=new Uint8Array(1);return function(){return crypto.getRandomValues(r),r[0]}}return function(){U("randomDevice")}}var V={resolve:function(){for(var r="",e=!1,n=arguments.length-1;n>=-1&&!e;n--){var t=n>=0?arguments[n]:o.cwd();if(typeof t!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";r=t+"/"+r,e=x.isAbs(t)}return(e?"/":"")+(r=x.normalizeArray(r.split("/").filter(a=>!!a),!e).join("/"))||"."},relative:(r,e)=>{function n(l){for(var h=0;h=0&&l[_]==="";_--);return h>_?[]:l.slice(h,_-h+1)}r=V.resolve(r).substr(1),e=V.resolve(e).substr(1);for(var t=n(r.split("/")),a=n(e.split("/")),i=Math.min(t.length,a.length),u=i,c=0;c0?n:gr(r)+1,a=new Array(t),i=Mr(r,a,0,a.length);return e&&(a.length=i),a}var $={ttys:[],init:function(){},shutdown:function(){},register:function(r,e){$.ttys[r]={input:[],output:[],ops:e},o.registerDevice(r,$.stream_ops)},stream_ops:{open:function(r){var e=$.ttys[r.node.rdev];if(!e)throw new o.ErrnoError(43);r.tty=e,r.seekable=!1},close:function(r){r.tty.ops.flush(r.tty)},flush:function(r){r.tty.ops.flush(r.tty)},read:function(r,e,n,t,a){if(!r.tty||!r.tty.ops.get_char)throw new o.ErrnoError(60);for(var i=0,u=0;u0&&(Br(ir(r.output,0)),r.output=[])}},default_tty1_ops:{put_char:function(r,e){e===null||e===10?(R(ir(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},flush:function(r){r.output&&r.output.length>0&&(R(ir(r.output,0)),r.output=[])}}};function ee(r){U()}var y={ops_table:null,mount:function(r){return y.createNode(null,"/",16895,0)},createNode:function(r,e,n,t){if(o.isBlkdev(n)||o.isFIFO(n))throw new o.ErrnoError(63);y.ops_table||(y.ops_table={dir:{node:{getattr:y.node_ops.getattr,setattr:y.node_ops.setattr,lookup:y.node_ops.lookup,mknod:y.node_ops.mknod,rename:y.node_ops.rename,unlink:y.node_ops.unlink,rmdir:y.node_ops.rmdir,readdir:y.node_ops.readdir,symlink:y.node_ops.symlink},stream:{llseek:y.stream_ops.llseek}},file:{node:{getattr:y.node_ops.getattr,setattr:y.node_ops.setattr},stream:{llseek:y.stream_ops.llseek,read:y.stream_ops.read,write:y.stream_ops.write,allocate:y.stream_ops.allocate,mmap:y.stream_ops.mmap,msync:y.stream_ops.msync}},link:{node:{getattr:y.node_ops.getattr,setattr:y.node_ops.setattr,readlink:y.node_ops.readlink},stream:{}},chrdev:{node:{getattr:y.node_ops.getattr,setattr:y.node_ops.setattr},stream:o.chrdev_stream_ops}});var a=o.createNode(r,e,n,t);return o.isDir(a.mode)?(a.node_ops=y.ops_table.dir.node,a.stream_ops=y.ops_table.dir.stream,a.contents={}):o.isFile(a.mode)?(a.node_ops=y.ops_table.file.node,a.stream_ops=y.ops_table.file.stream,a.usedBytes=0,a.contents=null):o.isLink(a.mode)?(a.node_ops=y.ops_table.link.node,a.stream_ops=y.ops_table.link.stream):o.isChrdev(a.mode)&&(a.node_ops=y.ops_table.chrdev.node,a.stream_ops=y.ops_table.chrdev.stream),a.timestamp=Date.now(),r&&(r.contents[e]=a,r.timestamp=a.timestamp),a},getFileDataAsTypedArray:function(r){return r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0)},expandFileStorage:function(r,e){var n=r.contents?r.contents.length:0;if(!(n>=e)){var t=1048576;e=Math.max(e,n*(n>>0),n!=0&&(e=Math.max(e,256));var a=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(a.subarray(0,r.usedBytes),0)}},resizeFileStorage:function(r,e){if(r.usedBytes!=e)if(e==0)r.contents=null,r.usedBytes=0;else{var n=r.contents;r.contents=new Uint8Array(e),n&&r.contents.set(n.subarray(0,Math.min(e,r.usedBytes))),r.usedBytes=e}},node_ops:{getattr:function(r){var e={};return e.dev=o.isChrdev(r.mode)?r.id:1,e.ino=r.id,e.mode=r.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=r.rdev,o.isDir(r.mode)?e.size=4096:o.isFile(r.mode)?e.size=r.usedBytes:o.isLink(r.mode)?e.size=r.link.length:e.size=0,e.atime=new Date(r.timestamp),e.mtime=new Date(r.timestamp),e.ctime=new Date(r.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr:function(r,e){e.mode!==void 0&&(r.mode=e.mode),e.timestamp!==void 0&&(r.timestamp=e.timestamp),e.size!==void 0&&y.resizeFileStorage(r,e.size)},lookup:function(r,e){throw o.genericErrors[44]},mknod:function(r,e,n,t){return y.createNode(r,e,n,t)},rename:function(r,e,n){if(o.isDir(r.mode)){var t;try{t=o.lookupNode(e,n)}catch{}if(t)for(var a in t.contents)throw new o.ErrnoError(55)}delete r.parent.contents[r.name],r.parent.timestamp=Date.now(),r.name=n,e.contents[n]=r,e.timestamp=r.parent.timestamp,r.parent=e},unlink:function(r,e){delete r.contents[e],r.timestamp=Date.now()},rmdir:function(r,e){var n=o.lookupNode(r,e);for(var t in n.contents)throw new o.ErrnoError(55);delete r.contents[e],r.timestamp=Date.now()},readdir:function(r){var e=[".",".."];for(var n in r.contents)r.contents.hasOwnProperty(n)&&e.push(n);return e},symlink:function(r,e,n){var t=y.createNode(r,e,41471,0);return t.link=n,t},readlink:function(r){if(!o.isLink(r.mode))throw new o.ErrnoError(28);return r.link}},stream_ops:{read:function(r,e,n,t,a){var i=r.node.contents;if(a>=r.node.usedBytes)return 0;var u=Math.min(r.node.usedBytes-a,t);if(u>8&&i.subarray)e.set(i.subarray(a,a+u),n);else for(var c=0;c0||n+e{if(!(r=V.resolve(o.cwd(),r)))return{path:"",node:null};var n={follow_mount:!0,recurse_count:0};if((e=Object.assign(n,e)).recurse_count>8)throw new o.ErrnoError(32);for(var t=x.normalizeArray(r.split("/").filter(h=>!!h),!1),a=o.root,i="/",u=0;u40)throw new o.ErrnoError(32)}}return{path:i,node:a}},getPath:r=>{for(var e;;){if(o.isRoot(r)){var n=r.mount.mountpoint;return e?n[n.length-1]!=="/"?n+"/"+e:n+e:n}e=e?r.name+"/"+e:r.name,r=r.parent}},hashName:(r,e)=>{for(var n=0,t=0;t>>0)%o.nameTable.length},hashAddNode:r=>{var e=o.hashName(r.parent.id,r.name);r.name_next=o.nameTable[e],o.nameTable[e]=r},hashRemoveNode:r=>{var e=o.hashName(r.parent.id,r.name);if(o.nameTable[e]===r)o.nameTable[e]=r.name_next;else for(var n=o.nameTable[e];n;){if(n.name_next===r){n.name_next=r.name_next;break}n=n.name_next}},lookupNode:(r,e)=>{var n=o.mayLookup(r);if(n)throw new o.ErrnoError(n,r);for(var t=o.hashName(r.id,e),a=o.nameTable[t];a;a=a.name_next){var i=a.name;if(a.parent.id===r.id&&i===e)return a}return o.lookup(r,e)},createNode:(r,e,n,t)=>{var a=new o.FSNode(r,e,n,t);return o.hashAddNode(a),a},destroyNode:r=>{o.hashRemoveNode(r)},isRoot:r=>r===r.parent,isMountpoint:r=>!!r.mounted,isFile:r=>(61440&r)==32768,isDir:r=>(61440&r)==16384,isLink:r=>(61440&r)==40960,isChrdev:r=>(61440&r)==8192,isBlkdev:r=>(61440&r)==24576,isFIFO:r=>(61440&r)==4096,isSocket:r=>(49152&r)==49152,flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:r=>{var e=o.flagModes[r];if(e===void 0)throw new Error("Unknown file open mode: "+r);return e},flagsToPermissionString:r=>{var e=["r","w","rw"][3&r];return 512&r&&(e+="w"),e},nodePermissions:(r,e)=>o.ignorePermissions||(!e.includes("r")||292&r.mode)&&(!e.includes("w")||146&r.mode)&&(!e.includes("x")||73&r.mode)?0:2,mayLookup:r=>{var e=o.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate:(r,e)=>{try{return o.lookupNode(r,e),20}catch{}return o.nodePermissions(r,"wx")},mayDelete:(r,e,n)=>{var t;try{t=o.lookupNode(r,e)}catch(i){return i.errno}var a=o.nodePermissions(r,"wx");if(a)return a;if(n){if(!o.isDir(t.mode))return 54;if(o.isRoot(t)||o.getPath(t)===o.cwd())return 10}else if(o.isDir(t.mode))return 31;return 0},mayOpen:(r,e)=>r?o.isLink(r.mode)?32:o.isDir(r.mode)&&(o.flagsToPermissionString(e)!=="r"||512&e)?31:o.nodePermissions(r,o.flagsToPermissionString(e)):44,MAX_OPEN_FDS:4096,nextfd:(r=0,e=o.MAX_OPEN_FDS)=>{for(var n=r;n<=e;n++)if(!o.streams[n])return n;throw new o.ErrnoError(33)},getStream:r=>o.streams[r],createStream:(r,e,n)=>{o.FSStream||(o.FSStream=function(){this.shared={}},o.FSStream.prototype={},Object.defineProperties(o.FSStream.prototype,{object:{get:function(){return this.node},set:function(a){this.node=a}},isRead:{get:function(){return(2097155&this.flags)!=1}},isWrite:{get:function(){return(2097155&this.flags)!=0}},isAppend:{get:function(){return 1024&this.flags}},flags:{get:function(){return this.shared.flags},set:function(a){this.shared.flags=a}},position:{get:function(){return this.shared.position},set:function(a){this.shared.position=a}}})),r=Object.assign(new o.FSStream,r);var t=o.nextfd(e,n);return r.fd=t,o.streams[t]=r,r},closeStream:r=>{o.streams[r]=null},chrdev_stream_ops:{open:r=>{var e=o.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open&&r.stream_ops.open(r)},llseek:()=>{throw new o.ErrnoError(70)}},major:r=>r>>8,minor:r=>255&r,makedev:(r,e)=>r<<8|e,registerDevice:(r,e)=>{o.devices[r]={stream_ops:e}},getDevice:r=>o.devices[r],getMounts:r=>{for(var e=[],n=[r];n.length;){var t=n.pop();e.push(t),n.push.apply(n,t.mounts)}return e},syncfs:(r,e)=>{typeof r=="function"&&(e=r,r=!1),o.syncFSRequests++,o.syncFSRequests>1&&R("warning: "+o.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var n=o.getMounts(o.root.mount),t=0;function a(u){return o.syncFSRequests--,e(u)}function i(u){if(u)return i.errored?void 0:(i.errored=!0,a(u));++t>=n.length&&a(null)}n.forEach(u=>{if(!u.type.syncfs)return i(null);u.type.syncfs(u,r,i)})},mount:(r,e,n)=>{var t,a=n==="/",i=!n;if(a&&o.root)throw new o.ErrnoError(10);if(!a&&!i){var u=o.lookupPath(n,{follow_mount:!1});if(n=u.path,t=u.node,o.isMountpoint(t))throw new o.ErrnoError(10);if(!o.isDir(t.mode))throw new o.ErrnoError(54)}var c={type:r,opts:e,mountpoint:n,mounts:[]},f=r.mount(c);return f.mount=c,c.root=f,a?o.root=f:t&&(t.mounted=c,t.mount&&t.mount.mounts.push(c)),f},unmount:r=>{var e=o.lookupPath(r,{follow_mount:!1});if(!o.isMountpoint(e.node))throw new o.ErrnoError(28);var n=e.node,t=n.mounted,a=o.getMounts(t);Object.keys(o.nameTable).forEach(u=>{for(var c=o.nameTable[u];c;){var f=c.name_next;a.includes(c.mount)&&o.destroyNode(c),c=f}}),n.mounted=null;var i=n.mount.mounts.indexOf(t);n.mount.mounts.splice(i,1)},lookup:(r,e)=>r.node_ops.lookup(r,e),mknod:(r,e,n)=>{var t=o.lookupPath(r,{parent:!0}).node,a=x.basename(r);if(!a||a==="."||a==="..")throw new o.ErrnoError(28);var i=o.mayCreate(t,a);if(i)throw new o.ErrnoError(i);if(!t.node_ops.mknod)throw new o.ErrnoError(63);return t.node_ops.mknod(t,a,e,n)},create:(r,e)=>(e=e!==void 0?e:438,e&=4095,e|=32768,o.mknod(r,e,0)),mkdir:(r,e)=>(e=e!==void 0?e:511,e&=1023,e|=16384,o.mknod(r,e,0)),mkdirTree:(r,e)=>{for(var n=r.split("/"),t="",a=0;a(n===void 0&&(n=e,e=438),e|=8192,o.mknod(r,e,n)),symlink:(r,e)=>{if(!V.resolve(r))throw new o.ErrnoError(44);var n=o.lookupPath(e,{parent:!0}).node;if(!n)throw new o.ErrnoError(44);var t=x.basename(e),a=o.mayCreate(n,t);if(a)throw new o.ErrnoError(a);if(!n.node_ops.symlink)throw new o.ErrnoError(63);return n.node_ops.symlink(n,t,r)},rename:(r,e)=>{var n,t,a=x.dirname(r),i=x.dirname(e),u=x.basename(r),c=x.basename(e);if(n=o.lookupPath(r,{parent:!0}).node,t=o.lookupPath(e,{parent:!0}).node,!n||!t)throw new o.ErrnoError(44);if(n.mount!==t.mount)throw new o.ErrnoError(75);var f,l=o.lookupNode(n,u),h=V.relative(r,i);if(h.charAt(0)!==".")throw new o.ErrnoError(28);if((h=V.relative(e,a)).charAt(0)!==".")throw new o.ErrnoError(55);try{f=o.lookupNode(t,c)}catch{}if(l!==f){var _=o.isDir(l.mode),g=o.mayDelete(n,u,_);if(g)throw new o.ErrnoError(g);if(g=f?o.mayDelete(t,c,_):o.mayCreate(t,c))throw new o.ErrnoError(g);if(!n.node_ops.rename)throw new o.ErrnoError(63);if(o.isMountpoint(l)||f&&o.isMountpoint(f))throw new o.ErrnoError(10);if(t!==n&&(g=o.nodePermissions(n,"w")))throw new o.ErrnoError(g);o.hashRemoveNode(l);try{n.node_ops.rename(l,t,c)}catch(b){throw b}finally{o.hashAddNode(l)}}},rmdir:r=>{var e=o.lookupPath(r,{parent:!0}).node,n=x.basename(r),t=o.lookupNode(e,n),a=o.mayDelete(e,n,!0);if(a)throw new o.ErrnoError(a);if(!e.node_ops.rmdir)throw new o.ErrnoError(63);if(o.isMountpoint(t))throw new o.ErrnoError(10);e.node_ops.rmdir(e,n),o.destroyNode(t)},readdir:r=>{var e=o.lookupPath(r,{follow:!0}).node;if(!e.node_ops.readdir)throw new o.ErrnoError(54);return e.node_ops.readdir(e)},unlink:r=>{var e=o.lookupPath(r,{parent:!0}).node;if(!e)throw new o.ErrnoError(44);var n=x.basename(r),t=o.lookupNode(e,n),a=o.mayDelete(e,n,!1);if(a)throw new o.ErrnoError(a);if(!e.node_ops.unlink)throw new o.ErrnoError(63);if(o.isMountpoint(t))throw new o.ErrnoError(10);e.node_ops.unlink(e,n),o.destroyNode(t)},readlink:r=>{var e=o.lookupPath(r).node;if(!e)throw new o.ErrnoError(44);if(!e.node_ops.readlink)throw new o.ErrnoError(28);return V.resolve(o.getPath(e.parent),e.node_ops.readlink(e))},stat:(r,e)=>{var n=o.lookupPath(r,{follow:!e}).node;if(!n)throw new o.ErrnoError(44);if(!n.node_ops.getattr)throw new o.ErrnoError(63);return n.node_ops.getattr(n)},lstat:r=>o.stat(r,!0),chmod:(r,e,n)=>{var t;if(!(t=typeof r=="string"?o.lookupPath(r,{follow:!n}).node:r).node_ops.setattr)throw new o.ErrnoError(63);t.node_ops.setattr(t,{mode:4095&e|-4096&t.mode,timestamp:Date.now()})},lchmod:(r,e)=>{o.chmod(r,e,!0)},fchmod:(r,e)=>{var n=o.getStream(r);if(!n)throw new o.ErrnoError(8);o.chmod(n.node,e)},chown:(r,e,n,t)=>{var a;if(!(a=typeof r=="string"?o.lookupPath(r,{follow:!t}).node:r).node_ops.setattr)throw new o.ErrnoError(63);a.node_ops.setattr(a,{timestamp:Date.now()})},lchown:(r,e,n)=>{o.chown(r,e,n,!0)},fchown:(r,e,n)=>{var t=o.getStream(r);if(!t)throw new o.ErrnoError(8);o.chown(t.node,e,n)},truncate:(r,e)=>{if(e<0)throw new o.ErrnoError(28);var n;if(!(n=typeof r=="string"?o.lookupPath(r,{follow:!0}).node:r).node_ops.setattr)throw new o.ErrnoError(63);if(o.isDir(n.mode))throw new o.ErrnoError(31);if(!o.isFile(n.mode))throw new o.ErrnoError(28);var t=o.nodePermissions(n,"w");if(t)throw new o.ErrnoError(t);n.node_ops.setattr(n,{size:e,timestamp:Date.now()})},ftruncate:(r,e)=>{var n=o.getStream(r);if(!n)throw new o.ErrnoError(8);if(!(2097155&n.flags))throw new o.ErrnoError(28);o.truncate(n.node,e)},utime:(r,e,n)=>{var t=o.lookupPath(r,{follow:!0}).node;t.node_ops.setattr(t,{timestamp:Math.max(e,n)})},open:(r,e,n)=>{if(r==="")throw new o.ErrnoError(44);var t;if(n=n===void 0?438:n,n=64&(e=typeof e=="string"?o.modeStringToFlags(e):e)?4095&n|32768:0,typeof r=="object")t=r;else{r=x.normalize(r);try{t=o.lookupPath(r,{follow:!(131072&e)}).node}catch{}}var a=!1;if(64&e)if(t){if(128&e)throw new o.ErrnoError(20)}else t=o.mknod(r,n,0),a=!0;if(!t)throw new o.ErrnoError(44);if(o.isChrdev(t.mode)&&(e&=-513),65536&e&&!o.isDir(t.mode))throw new o.ErrnoError(54);if(!a){var i=o.mayOpen(t,e);if(i)throw new o.ErrnoError(i)}512&e&&!a&&o.truncate(t,0),e&=-131713;var u=o.createStream({node:t,path:o.getPath(t),flags:e,seekable:!0,position:0,stream_ops:t.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),!s.logReadFiles||1&e||(o.readFiles||(o.readFiles={}),r in o.readFiles||(o.readFiles[r]=1)),u},close:r=>{if(o.isClosed(r))throw new o.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{o.closeStream(r.fd)}r.fd=null},isClosed:r=>r.fd===null,llseek:(r,e,n)=>{if(o.isClosed(r))throw new o.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new o.ErrnoError(70);if(n!=0&&n!=1&&n!=2)throw new o.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,n),r.ungotten=[],r.position},read:(r,e,n,t,a)=>{if(t<0||a<0)throw new o.ErrnoError(28);if(o.isClosed(r))throw new o.ErrnoError(8);if((2097155&r.flags)==1)throw new o.ErrnoError(8);if(o.isDir(r.node.mode))throw new o.ErrnoError(31);if(!r.stream_ops.read)throw new o.ErrnoError(28);var i=a!==void 0;if(i){if(!r.seekable)throw new o.ErrnoError(70)}else a=r.position;var u=r.stream_ops.read(r,e,n,t,a);return i||(r.position+=u),u},write:(r,e,n,t,a,i)=>{if(t<0||a<0)throw new o.ErrnoError(28);if(o.isClosed(r))throw new o.ErrnoError(8);if(!(2097155&r.flags))throw new o.ErrnoError(8);if(o.isDir(r.node.mode))throw new o.ErrnoError(31);if(!r.stream_ops.write)throw new o.ErrnoError(28);r.seekable&&1024&r.flags&&o.llseek(r,0,2);var u=a!==void 0;if(u){if(!r.seekable)throw new o.ErrnoError(70)}else a=r.position;var c=r.stream_ops.write(r,e,n,t,a,i);return u||(r.position+=c),c},allocate:(r,e,n)=>{if(o.isClosed(r))throw new o.ErrnoError(8);if(e<0||n<=0)throw new o.ErrnoError(28);if(!(2097155&r.flags))throw new o.ErrnoError(8);if(!o.isFile(r.node.mode)&&!o.isDir(r.node.mode))throw new o.ErrnoError(43);if(!r.stream_ops.allocate)throw new o.ErrnoError(138);r.stream_ops.allocate(r,e,n)},mmap:(r,e,n,t,a)=>{if(2&t&&!(2&a)&&(2097155&r.flags)!=2)throw new o.ErrnoError(2);if((2097155&r.flags)==1)throw new o.ErrnoError(2);if(!r.stream_ops.mmap)throw new o.ErrnoError(43);return r.stream_ops.mmap(r,e,n,t,a)},msync:(r,e,n,t,a)=>r&&r.stream_ops.msync?r.stream_ops.msync(r,e,n,t,a):0,munmap:r=>0,ioctl:(r,e,n)=>{if(!r.stream_ops.ioctl)throw new o.ErrnoError(59);return r.stream_ops.ioctl(r,e,n)},readFile:(r,e={})=>{if(e.flags=e.flags||0,e.encoding=e.encoding||"binary",e.encoding!=="utf8"&&e.encoding!=="binary")throw new Error('Invalid encoding type "'+e.encoding+'"');var n,t=o.open(r,e.flags),a=o.stat(r).size,i=new Uint8Array(a);return o.read(t,i,0,a,0),e.encoding==="utf8"?n=ir(i,0):e.encoding==="binary"&&(n=i),o.close(t),n},writeFile:(r,e,n={})=>{n.flags=n.flags||577;var t=o.open(r,n.flags,n.mode);if(typeof e=="string"){var a=new Uint8Array(gr(e)+1),i=Mr(e,a,0,a.length);o.write(t,a,0,i,void 0,n.canOwn)}else{if(!ArrayBuffer.isView(e))throw new Error("Unsupported data type");o.write(t,e,0,e.byteLength,void 0,n.canOwn)}o.close(t)},cwd:()=>o.currentPath,chdir:r=>{var e=o.lookupPath(r,{follow:!0});if(e.node===null)throw new o.ErrnoError(44);if(!o.isDir(e.node.mode))throw new o.ErrnoError(54);var n=o.nodePermissions(e.node,"x");if(n)throw new o.ErrnoError(n);o.currentPath=e.path},createDefaultDirectories:()=>{o.mkdir("/tmp"),o.mkdir("/home"),o.mkdir("/home/web_user")},createDefaultDevices:()=>{o.mkdir("/dev"),o.registerDevice(o.makedev(1,3),{read:()=>0,write:(e,n,t,a,i)=>a}),o.mkdev("/dev/null",o.makedev(1,3)),$.register(o.makedev(5,0),$.default_tty_ops),$.register(o.makedev(6,0),$.default_tty1_ops),o.mkdev("/dev/tty",o.makedev(5,0)),o.mkdev("/dev/tty1",o.makedev(6,0));var r=Qe();o.createDevice("/dev","random",r),o.createDevice("/dev","urandom",r),o.mkdir("/dev/shm"),o.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{o.mkdir("/proc");var r=o.mkdir("/proc/self");o.mkdir("/proc/self/fd"),o.mount({mount:()=>{var e=o.createNode(r,"fd",16895,73);return e.node_ops={lookup:(n,t)=>{var a=+t,i=o.getStream(a);if(!i)throw new o.ErrnoError(8);var u={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return u.parent=u,u}},e}},{},"/proc/self/fd")},createStandardStreams:()=>{s.stdin?o.createDevice("/dev","stdin",s.stdin):o.symlink("/dev/tty","/dev/stdin"),s.stdout?o.createDevice("/dev","stdout",null,s.stdout):o.symlink("/dev/tty","/dev/stdout"),s.stderr?o.createDevice("/dev","stderr",null,s.stderr):o.symlink("/dev/tty1","/dev/stderr"),o.open("/dev/stdin",0),o.open("/dev/stdout",1),o.open("/dev/stderr",1)},ensureErrnoError:()=>{o.ErrnoError||(o.ErrnoError=function(r,e){this.node=e,this.setErrno=function(n){this.errno=n},this.setErrno(r),this.message="FS error"},o.ErrnoError.prototype=new Error,o.ErrnoError.prototype.constructor=o.ErrnoError,[44].forEach(r=>{o.genericErrors[r]=new o.ErrnoError(r),o.genericErrors[r].stack=""}))},staticInit:()=>{o.ensureErrnoError(),o.nameTable=new Array(4096),o.mount(y,{},"/"),o.createDefaultDirectories(),o.createDefaultDevices(),o.createSpecialDirectories(),o.filesystems={MEMFS:y}},init:(r,e,n)=>{o.init.initialized=!0,o.ensureErrnoError(),s.stdin=r||s.stdin,s.stdout=e||s.stdout,s.stderr=n||s.stderr,o.createStandardStreams()},quit:()=>{o.init.initialized=!1;for(var r=0;r{var n=0;return r&&(n|=365),e&&(n|=146),n},findObject:(r,e)=>{var n=o.analyzePath(r,e);return n.exists?n.object:null},analyzePath:(r,e)=>{try{r=(t=o.lookupPath(r,{follow:!e})).path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=o.lookupPath(r,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=x.basename(r),t=o.lookupPath(r,{follow:!e}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(a){n.error=a.errno}return n},createPath:(r,e,n,t)=>{r=typeof r=="string"?r:o.getPath(r);for(var a=e.split("/").reverse();a.length;){var i=a.pop();if(i){var u=x.join2(r,i);try{o.mkdir(u)}catch{}r=u}}return u},createFile:(r,e,n,t,a)=>{var i=x.join2(typeof r=="string"?r:o.getPath(r),e),u=o.getMode(t,a);return o.create(i,u)},createDataFile:(r,e,n,t,a,i)=>{var u=e;r&&(r=typeof r=="string"?r:o.getPath(r),u=e?x.join2(r,e):r);var c=o.getMode(t,a),f=o.create(u,c);if(n){if(typeof n=="string"){for(var l=new Array(n.length),h=0,_=n.length;h<_;++h)l[h]=n.charCodeAt(h);n=l}o.chmod(f,146|c);var g=o.open(f,577);o.write(g,n,0,n.length,0,i),o.close(g),o.chmod(f,c)}return f},createDevice:(r,e,n,t)=>{var a=x.join2(typeof r=="string"?r:o.getPath(r),e),i=o.getMode(!!n,!!t);o.createDevice.major||(o.createDevice.major=64);var u=o.makedev(o.createDevice.major++,0);return o.registerDevice(u,{open:c=>{c.seekable=!1},close:c=>{t&&t.buffer&&t.buffer.length&&t(10)},read:(c,f,l,h,_)=>{for(var g=0,b=0;b{for(var g=0;g{if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!Z)throw new Error("Cannot load without read() or XMLHttpRequest.");try{r.contents=Nr(Z(r.url),!0),r.usedBytes=r.contents.length}catch{throw new o.ErrnoError(29)}},createLazyFile:(r,e,n,t,a)=>{if(typeof XMLHttpRequest<"u")throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i={isDevice:!1,url:n},u=o.createFile(r,e,i,t,a);i.contents?u.contents=i.contents:i.url&&(u.contents=null,u.url=i.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var c={};function f(l,h,_,g,b){var F=l.node.contents;if(b>=F.length)return 0;var A=Math.min(F.length-b,g);if(F.slice)for(var T=0;T{var h=u.stream_ops[l];c[l]=function(){return o.forceLoadFile(u),h.apply(null,arguments)}}),c.read=(l,h,_,g,b)=>(o.forceLoadFile(u),f(l,h,_,g,b)),c.mmap=(l,h,_,g,b)=>{o.forceLoadFile(u);var F=ee();if(!F)throw new o.ErrnoError(48);return f(l,D,F,h,_),{ptr:F,allocated:!0}},u.stream_ops=c,u},createPreloadedFile:(r,e,n,t,a,i,u,c,f,l)=>{var h=e?V.resolve(x.join2(r,e)):r;function _(g){function b(F){l&&l(),c||o.createDataFile(r,e,F,t,a,f),i&&i(),lr()}Browser.handledByPreloadPlugin(g,h,b,()=>{u&&u(),lr()})||b(g)}_r(),typeof n=="string"?Je(n,g=>_(g),u):_(n)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(r,e,n)=>{e=e||(()=>{}),n=n||(()=>{});var t=o.indexedDB();try{var a=t.open(o.DB_NAME(),o.DB_VERSION)}catch(i){return n(i)}a.onupgradeneeded=()=>{Br("creating db"),a.result.createObjectStore(o.DB_STORE_NAME)},a.onsuccess=()=>{var i=a.result.transaction([o.DB_STORE_NAME],"readwrite"),u=i.objectStore(o.DB_STORE_NAME),c=0,f=0,l=r.length;function h(){f==0?e():n()}r.forEach(_=>{var g=u.put(o.analyzePath(_).object.contents,_);g.onsuccess=()=>{++c+f==l&&h()},g.onerror=()=>{f++,c+f==l&&h()}}),i.onerror=n},a.onerror=n},loadFilesFromDB:(r,e,n)=>{e=e||(()=>{}),n=n||(()=>{});var t=o.indexedDB();try{var a=t.open(o.DB_NAME(),o.DB_VERSION)}catch(i){return n(i)}a.onupgradeneeded=n,a.onsuccess=()=>{var i=a.result;try{var u=i.transaction([o.DB_STORE_NAME],"readonly")}catch(g){return void n(g)}var c=u.objectStore(o.DB_STORE_NAME),f=0,l=0,h=r.length;function _(){l==0?e():n()}r.forEach(g=>{var b=c.get(g);b.onsuccess=()=>{o.analyzePath(g).exists&&o.unlink(g),o.createDataFile(x.dirname(g),x.basename(g),b.result,!0,!0,!0),++f+l==h&&_()},b.onerror=()=>{l++,f+l==h&&_()}}),u.onerror=n},a.onerror=n}},S={DEFAULT_POLLMASK:5,calculateAt:function(r,e,n){if(x.isAbs(e))return e;var t;if(r===-100)t=o.cwd();else{var a=o.getStream(r);if(!a)throw new o.ErrnoError(8);t=a.path}if(e.length==0){if(!n)throw new o.ErrnoError(44);return t}return x.join2(t,e)},doStat:function(r,e,n){try{var t=r(e)}catch(a){if(a&&a.node&&x.normalize(e)!==x.normalize(o.getPath(a.node)))return-54;throw a}return v[n>>2]=t.dev,v[n+4>>2]=0,v[n+8>>2]=t.ino,v[n+12>>2]=t.mode,v[n+16>>2]=t.nlink,v[n+20>>2]=t.uid,v[n+24>>2]=t.gid,v[n+28>>2]=t.rdev,v[n+32>>2]=0,H=[t.size>>>0,(C=t.size,+Math.abs(C)>=1?C>0?(0|Math.min(+Math.floor(C/4294967296),4294967295))>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)],v[n+40>>2]=H[0],v[n+44>>2]=H[1],v[n+48>>2]=4096,v[n+52>>2]=t.blocks,v[n+56>>2]=t.atime.getTime()/1e3|0,v[n+64>>2]=0,v[n+72>>2]=t.mtime.getTime()/1e3|0,v[n+80>>2]=0,v[n+88>>2]=t.ctime.getTime()/1e3|0,v[n+96>>2]=0,H=[t.ino>>>0,(C=t.ino,+Math.abs(C)>=1?C>0?(0|Math.min(+Math.floor(C/4294967296),4294967295))>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)],v[n+104>>2]=H[0],v[n+108>>2]=H[1],0},doMsync:function(r,e,n,t,a){var i=P.slice(r,r+n);o.msync(e,i,a,n,t)},varargs:void 0,get:function(){return S.varargs+=4,v[S.varargs-4>>2]},getStr:function(r){return M(r)},getStreamFromFD:function(r){var e=o.getStream(r);if(!e)throw new o.ErrnoError(8);return e}};function Ke(r,e,n){S.varargs=n;try{var t=S.getStreamFromFD(r);switch(e){case 0:return(a=S.get())<0?-28:o.createStream(t,a).fd;case 1:case 2:case 6:case 7:return 0;case 3:return t.flags;case 4:var a=S.get();return t.flags|=a,0;case 5:return a=S.get(),z[a+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return Xe(28),-1}}catch(i){if(o===void 0||!(i instanceof o.ErrnoError))throw i;return-i.errno}}function $e(r,e,n){S.varargs=n;try{var t=S.getStreamFromFD(r);switch(e){case 21509:case 21505:case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:case 21523:case 21524:return t.tty?0:-59;case 21519:if(!t.tty)return-59;var a=S.get();return v[a>>2]=0,0;case 21520:return t.tty?-28:-59;case 21531:return a=S.get(),o.ioctl(t,e,a);default:U("bad ioctl syscall "+e)}}catch(i){if(o===void 0||!(i instanceof o.ErrnoError))throw i;return-i.errno}}function rn(r,e,n,t){S.varargs=t;try{e=S.getStr(e),e=S.calculateAt(r,e);var a=t?S.get():0;return o.open(e,n,a).fd}catch(i){if(o===void 0||!(i instanceof o.ErrnoError))throw i;return-i.errno}}var yr={};function ne(r){for(;r.length;){var e=r.pop();r.pop()(e)}}function wr(r){return this.fromWireType(v[r>>2])}var ur={},rr={},Er={},en=48,nn=57;function tn(r){if(r===void 0)return"_unknown";var e=(r=r.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=en&&e<=nn?"_"+r:r}function te(r,e){return r=tn(r),function(){return e.apply(this,arguments)}}function Lr(r,e){var n=te(e,function(t){this.name=e,this.message=t;var a=new Error(t).stack;a!==void 0&&(this.stack=this.toString()+` `+a.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(r.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},n}var oe=void 0;function ae(r){throw new oe(r)}function ie(r,e,n){function t(c){var f=n(c);f.length!==r.length&&ae("Mismatched type converter count");for(var l=0;l{rr.hasOwnProperty(c)?a[f]=rr[c]:(i.push(c),ur.hasOwnProperty(c)||(ur[c]=[]),ur[c].push(()=>{a[f]=rr[c],++u===i.length&&t(a)}))}),i.length===0&&t(a)}function on(r){var e=yr[r];delete yr[r];var n=e.rawConstructor,t=e.rawDestructor,a=e.fields;ie([r],a.map(i=>i.getterReturnType).concat(a.map(i=>i.setterArgumentType)),i=>{var u={};return a.forEach((c,f)=>{var l=c.fieldName,h=i[f],_=c.getter,g=c.getterContext,b=i[f+a.length],F=c.setter,A=c.setterContext;u[l]={read:T=>h.fromWireType(_(g,T)),write:(T,nr)=>{var d=[];F(A,T,b.toWireType(d,nr)),ne(d)}}}),[{name:e.name,fromWireType:function(c){var f={};for(var l in u)f[l]=u[l].read(c);return t(c),f},toWireType:function(c,f){for(var l in u)if(!(l in f))throw new TypeError('Missing field: "'+l+'"');var h=n();for(l in u)u[l].write(h,f[l]);return c!==null&&c.push(t,h),h},argPackAdvance:8,readValueFromPointer:wr,destructorFunction:t}]})}function an(r,e,n,t,a){}function br(r){switch(r){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+r)}}function un(){for(var r=new Array(256),e=0;e<256;++e)r[e]=String.fromCharCode(e);ue=r}var ue=void 0;function j(r){for(var e="",n=r;P[n];)e+=ue[P[n++]];return e}var se=void 0;function I(r){throw new se(r)}function W(r,e,n={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var t=e.name;if(r||I('type "'+t+'" must have a positive integer typeid pointer'),rr.hasOwnProperty(r)){if(n.ignoreDuplicateRegistrations)return;I("Cannot register type '"+t+"' twice")}if(rr[r]=e,delete Er[r],ur.hasOwnProperty(r)){var a=ur[r];delete ur[r],a.forEach(i=>i())}}function sn(r,e,n,t,a){var i=br(n);W(r,{name:e=j(e),fromWireType:function(u){return!!u},toWireType:function(u,c){return c?t:a},argPackAdvance:8,readValueFromPointer:function(u){var c;if(n===1)c=D;else if(n===2)c=z;else{if(n!==4)throw new TypeError("Unknown boolean type size: "+e);c=v}return this.fromWireType(c[u>>i])},destructorFunction:null})}var Rr=[],L=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function ce(r){r>4&&--L[r].refcount==0&&(L[r]=void 0,Rr.push(r))}function cn(){for(var r=0,e=5;e(r||I("Cannot use deleted val. handle = "+r),L[r].value),toHandle:r=>{switch(r){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var e=Rr.length?Rr.pop():L.length;return L[e]={refcount:1,value:r},e}}};function dn(r,e){W(r,{name:e=j(e),fromWireType:function(n){var t=X.toValue(n);return ce(n),t},toWireType:function(n,t){return X.toHandle(t)},argPackAdvance:8,readValueFromPointer:wr,destructorFunction:null})}function mn(r,e,n){if(r[e].overloadTable===void 0){var t=r[e];r[e]=function(){return r[e].overloadTable.hasOwnProperty(arguments.length)||I("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+r[e].overloadTable+")!"),r[e].overloadTable[arguments.length].apply(this,arguments)},r[e].overloadTable=[],r[e].overloadTable[t.argCount]=t}}function fe(r,e,n){s.hasOwnProperty(r)?((n===void 0||s[r].overloadTable!==void 0&&s[r].overloadTable[n]!==void 0)&&I("Cannot register public name '"+r+"' twice"),mn(s,r,r),s.hasOwnProperty(n)&&I("Cannot register multiple overloads of a function with the same number of arguments ("+n+")!"),s[r].overloadTable[n]=e):(s[r]=e,n!==void 0&&(s[r].numArguments=n))}function pn(r,e,n){switch(e){case 0:return function(t){var a=n?D:P;return this.fromWireType(a[t])};case 1:return function(t){var a=n?z:or;return this.fromWireType(a[t>>1])};case 2:return function(t){var a=n?v:k;return this.fromWireType(a[t>>2])};default:throw new TypeError("Unknown integer type: "+r)}}function vn(r,e,n,t){var a=br(n);function i(){}e=j(e),i.values={},W(r,{name:e,constructor:i,fromWireType:function(u){return this.constructor.values[u]},toWireType:function(u,c){return c.value},argPackAdvance:8,readValueFromPointer:pn(e,a,t),destructorFunction:null}),fe(e,i)}function le(r){var e=xe(r),n=j(e);return q(e),n}function de(r,e){var n=rr[r];return n===void 0&&I(e+" has unknown type "+le(r)),n}function hn(r,e,n){var t=de(r,"enum");e=j(e);var a=t.constructor,i=Object.create(t.constructor.prototype,{value:{value:n},constructor:{value:te(t.name+"_"+e,function(){})}});a.values[n]=i,a[e]=i}function gn(r,e){switch(e){case 2:return function(n){return this.fromWireType(ar[n>>2])};case 3:return function(n){return this.fromWireType(qr[n>>3])};default:throw new TypeError("Unknown float type: "+r)}}function _n(r,e,n){var t=br(n);W(r,{name:e=j(e),fromWireType:function(a){return a},toWireType:function(a,i){return i},argPackAdvance:8,readValueFromPointer:gn(e,t),destructorFunction:null})}function yn(r,e,n,t,a){var i=e.length;i<2&&I("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var u=e[1]!==null&&n!==null,c=!1,f=1;f>2]);return n}function En(r,e,n){s.hasOwnProperty(r)||ae("Replacing nonexistant public symbol"),s[r].overloadTable!==void 0&&n!==void 0?s[r].overloadTable[n]=e:(s[r]=e,s[r].argCount=n)}function bn(r,e,n){var t=s["dynCall_"+r];return n&&n.length?t.apply(null,[e].concat(n)):t.call(null,e)}var dr=[];function Or(r){var e=dr[r];return e||(r>=dr.length&&(dr.length=r+1),dr[r]=e=J.get(r)),e}function kn(r,e,n){return r.includes("j")?bn(r,e,n):Or(e).apply(null,n)}function xn(r,e){var n=[];return function(){return n.length=0,Object.assign(n,arguments),kn(r,e,n)}}function mr(r,e){function n(){return r.includes("j")?xn(r,e):Or(e)}r=j(r);var t=n();return typeof t!="function"&&I("unknown function pointer with signature "+r+": "+e),t}var me=void 0;function Fn(r,e){var n=[],t={};function a(i){t[i]||rr[i]||(Er[i]?Er[i].forEach(a):(n.push(i),t[i]=!0))}throw e.forEach(a),new me(r+": "+n.map(le).join([", "]))}function Dn(r,e,n,t,a,i){var u=wn(e,n);r=j(r),a=mr(t,a),fe(r,function(){Fn("Cannot call "+r+" due to unbound types",u)},e-1),ie([],u,function(c){var f=[c[0],null].concat(c.slice(1));return En(r,yn(r,f,null,a,i),e-1),[]})}function Sn(r,e,n){switch(e){case 0:return n?function(t){return D[t]}:function(t){return P[t]};case 1:return n?function(t){return z[t>>1]}:function(t){return or[t>>1]};case 2:return n?function(t){return v[t>>2]}:function(t){return k[t>>2]};default:throw new TypeError("Unknown integer type: "+r)}}function An(r,e,n,t,a){e=j(e);var i=br(n),u=h=>h;if(t===0){var c=32-8*n;u=h=>h<>>c}var f=e.includes("unsigned"),l=(h,_)=>{};W(r,{name:e,fromWireType:u,toWireType:f?function(h,_){return l(_,this.name),_>>>0}:function(h,_){return l(_,this.name),_},argPackAdvance:8,readValueFromPointer:Sn(e,i,t!==0),destructorFunction:null})}function Pn(r,e,n){var t=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function a(i){var u=k,c=u[i>>=2],f=u[i+1];return new t(hr,f,c)}W(r,{name:n=j(n),fromWireType:a,argPackAdvance:8,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})}function Cn(r,e){var n=(e=j(e))==="std::string";W(r,{name:e,fromWireType:function(t){var a,i=k[t>>2],u=t+4;if(n)for(var c=u,f=0;f<=i;++f){var l=u+f;if(f==i||P[l]==0){var h=M(c,l-c);a===void 0?a=h:(a+="\0",a+=h),c=l+1}}else{var _=new Array(i);for(f=0;f>2]=i,n&&u)Yr(a,f,i+1);else if(u)for(var l=0;l255&&(q(f),I("String has UTF-16 code units that do not fit in 8 bits")),P[f+l]=h}else for(l=0;l>1,a=t+e/2;!(t>=a)&&or[t];)++t;if((n=t<<1)-r>32&&pe)return pe.decode(P.subarray(r,n));for(var i="",u=0;!(u>=e/2);++u){var c=z[r+2*u>>1];if(c==0)break;i+=String.fromCharCode(c)}return i}function jn(r,e,n){if(n===void 0&&(n=2147483647),n<2)return 0;for(var t=e,a=(n-=2)<2*r.length?n/2:r.length,i=0;i>1]=u,e+=2}return z[e>>1]=0,e-t}function Bn(r){return 2*r.length}function Mn(r,e){for(var n=0,t="";!(n>=e/4);){var a=v[r+4*n>>2];if(a==0)break;if(++n,a>=65536){var i=a-65536;t+=String.fromCharCode(55296|i>>10,56320|1023&i)}else t+=String.fromCharCode(a)}return t}function In(r,e,n){if(n===void 0&&(n=2147483647),n<4)return 0;for(var t=e,a=t+n-4,i=0;i=55296&&u<=57343&&(u=65536+((1023&u)<<10)|1023&r.charCodeAt(++i)),v[e>>2]=u,(e+=4)+4>a)break}return v[e>>2]=0,e-t}function Nn(r){for(var e=0,n=0;n=55296&&t<=57343&&++n,e+=4}return e}function Ln(r,e,n){var t,a,i,u,c;n=j(n),e===2?(t=Tn,a=jn,u=Bn,i=()=>or,c=1):e===4&&(t=Mn,a=In,u=Nn,i=()=>k,c=2),W(r,{name:n,fromWireType:function(f){for(var l,h=k[f>>2],_=i(),g=f+4,b=0;b<=h;++b){var F=f+4+b*e;if(b==h||_[F>>c]==0){var A=t(g,F-g);l===void 0?l=A:(l+="\0",l+=A),g=F+e}}return q(f),l},toWireType:function(f,l){typeof l!="string"&&I("Cannot pass non-string to C++ string type "+n);var h=u(l),_=Ar(4+h+e);return k[_>>2]=h>>c,a(l,_+4,h+e),f!==null&&f.push(q,_),_},argPackAdvance:8,readValueFromPointer:wr,destructorFunction:function(f){q(f)}})}function Rn(r,e,n,t,a,i){yr[r]={name:j(e),rawConstructor:mr(n,t),rawDestructor:mr(a,i),fields:[]}}function On(r,e,n,t,a,i,u,c,f,l){yr[r].fields.push({fieldName:j(e),getterReturnType:n,getter:mr(t,a),getterContext:i,setterArgumentType:u,setter:mr(c,f),setterContext:l})}function Wn(r,e){W(r,{isVoid:!0,name:e=j(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(n,t){}})}function Zn(r){do{var e=k[r>>2],n=k[(r+=4)>>2],t=k[(r+=4)>>2];r+=4;var a=M(e);o.createPath("/",x.dirname(a),!0,!0),o.createDataFile(a,null,D.subarray(t,t+n),!0,!0,!0)}while(k[r>>2])}function zn(r){r>4&&(L[r].refcount+=1)}var Un={};function Hn(r){var e=Un[r];return e===void 0?j(r):e}function Vn(r){return X.toHandle(Hn(r))}function qn(){return X.toHandle({})}function Gn(r,e,n){r=X.toValue(r),e=X.toValue(e),n=X.toValue(n),r[e]=n}function Yn(r,e){var n=(r=de(r,"_emval_take_value")).readValueFromPointer(e);return X.toHandle(n)}function Xn(){U("")}function Qn(r,e,n){P.copyWithin(r,e,e+n)}function Jn(){return 2147483648}function Kn(r){try{return jr.grow(r-hr.byteLength+65535>>>16),Xr(jr.buffer),1}catch{}}function $n(r){var e=P.length;r>>>=0;var n=Jn();if(r>n)return!1;let t=(u,c)=>u+(c-u%c)%c;for(var a=1;a<=4;a*=2){var i=e*(1+.2/a);if(i=Math.min(i,r+100663296),Kn(Math.min(n,t(Math.max(r,i),65536))))return!0}return!1}function rt(r){return!!(r.dibvbi=r.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"))}function et(r){return!!(r.mdibvbi=r.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance"))}function nt(r){return!!(r.multiDrawWebgl=r.getExtension("WEBGL_multi_draw"))}var m={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],stringCache:{},stringiCache:{},unpackAlignment:4,recordError:function(r){m.lastError||(m.lastError=r)},getNewId:function(r){for(var e=m.counter++,n=r.length;n>2]:-1;a+=M(v[n+4*i>>2],u<0?void 0:u)}return a},createContext:function(r,e){if(s.preinitializedWebGLContext){var n=s.preinitializedWebGLContext;e.majorVersion=typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext?2:1}else{if(!r.getContextSafariWebGL2Fixed){let t=function(a,i){var u=r.getContextSafariWebGL2Fixed(a,i);return a=="webgl"==u instanceof WebGLRenderingContext?u:null};r.getContextSafariWebGL2Fixed=r.getContext,r.getContext=t}n=r.getContext("webgl2",e)}return n?m.registerContext(n,e):0},registerContext:function(r,e){var n=m.getNewId(m.contexts),t={handle:n,attributes:e,version:e.majorVersion,GLctx:r};return r.canvas&&(r.canvas.GLctxObject=t),m.contexts[n]=t,(e.enableExtensionsByDefault===void 0||e.enableExtensionsByDefault)&&m.initExtensions(t),n},makeContextCurrent:function(r){return m.currentContext=m.contexts[r],s.ctx=p=m.currentContext&&m.currentContext.GLctx,!(r&&!p)},getContext:function(r){return m.contexts[r]},deleteContext:function(r){m.currentContext===m.contexts[r]&&(m.currentContext=null),typeof E=="object"&&E.removeAllHandlersOnTarget(m.contexts[r].GLctx.canvas),m.contexts[r]&&m.contexts[r].GLctx.canvas&&(m.contexts[r].GLctx.canvas.GLctxObject=void 0),m.contexts[r]=null},initExtensions:function(r){if(r||(r=m.currentContext),!r.initExtensionsDone){r.initExtensionsDone=!0;var e=r.GLctx;rt(e),et(e),r.version>=2&&(e.disjointTimerQueryExt=e.getExtension("EXT_disjoint_timer_query_webgl2")),(r.version<2||!e.disjointTimerQueryExt)&&(e.disjointTimerQueryExt=e.getExtension("EXT_disjoint_timer_query")),nt(e),(e.getSupportedExtensions()||[]).forEach(function(n){n.includes("lose_context")||n.includes("debug")||e.getExtension(n)})}}},E={inEventHandler:0,removeAllEventListeners:function(){for(var r=E.eventHandlers.length-1;r>=0;--r)E._removeHandler(r);E.eventHandlers=[],E.deferredCalls=[]},registerRemoveEventListeners:function(){E.removeEventListenersRegistered||(E.removeEventListenersRegistered=!0)},deferredCalls:[],deferCall:function(r,e,n){function t(u,c){if(u.length!=c.length)return!1;for(var f in u)if(u[f]!=c[f])return!1;return!0}for(var a in E.deferredCalls){var i=E.deferredCalls[a];if(i.targetFunction==r&&t(i.argsList,n))return}E.deferredCalls.push({targetFunction:r,precedence:e,argsList:n}),E.deferredCalls.sort(function(u,c){return u.precedence2?M(r):r}var at=[0,document,window];function it(r){return r=ot(r),at[r]||document.querySelector(r)}function ut(r){return it(r)}function st(r,e){var n=e>>2,t=v[n+6],a={alpha:!!v[n+0],depth:!!v[n+1],stencil:!!v[n+2],antialias:!!v[n+3],premultipliedAlpha:!!v[n+4],preserveDrawingBuffer:!!v[n+5],powerPreference:tt[t],failIfMajorPerformanceCaveat:!!v[n+7],majorVersion:v[n+8],minorVersion:v[n+9],enableExtensionsByDefault:v[n+10],explicitSwapControl:v[n+11],proxyContextToMainThread:v[n+12],renderViaOffscreenBackBuffer:v[n+13]},i=ut(r);return i?a.explicitSwapControl?0:m.createContext(i,a):0}var ct=st;function ft(r){for(var e=r>>2,n=0;n<14;++n)v[e+n]=0;v[e+0]=v[e+1]=v[e+3]=v[e+4]=v[e+8]=v[e+10]=1}function lt(r){return m.makeContextCurrent(r)?0:-5}var Wr={};function dt(){return Hr||"./this.program"}function pr(){if(!pr.strings){var r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:dt()};for(var e in Wr)Wr[e]===void 0?delete r[e]:r[e]=Wr[e];var n=[];for(var e in r)n.push(e+"="+r[e]);pr.strings=n}return pr.strings}function mt(r,e,n){for(var t=0;t>0]=r.charCodeAt(t);n||(D[e>>0]=0)}function pt(r,e){var n=0;return pr().forEach(function(t,a){var i=e+n;k[r+4*a>>2]=i,mt(t,i),n+=t.length+1}),0}function vt(r,e){var n=pr();k[r>>2]=n.length;var t=0;return n.forEach(function(a){t+=a.length+1}),k[e>>2]=t,0}function ht(r){try{var e=S.getStreamFromFD(r);return o.close(e),0}catch(n){if(o===void 0||!(n instanceof o.ErrnoError))throw n;return n.errno}}function gt(r,e,n,t){for(var a=0,i=0;i>2],c=k[e+4>>2];e+=8;var f=o.read(r,D,u,c,t);if(f<0)return-1;if(a+=f,f>2]=a,0}catch(i){if(o===void 0||!(i instanceof o.ErrnoError))throw i;return i.errno}}function yt(r,e){return e+2097152>>>0<4194305-!!r?(r>>>0)+4294967296*e:NaN}function wt(r,e,n,t,a){try{var i=yt(e,n);if(isNaN(i))return 61;var u=S.getStreamFromFD(r);return o.llseek(u,i,t),H=[u.position>>>0,(C=u.position,+Math.abs(C)>=1?C>0?(0|Math.min(+Math.floor(C/4294967296),4294967295))>>>0:~~+Math.ceil((C-+(~~C>>>0))/4294967296)>>>0:0)],v[a>>2]=H[0],v[a+4>>2]=H[1],u.getdents&&i===0&&t===0&&(u.getdents=null),0}catch(c){if(o===void 0||!(c instanceof o.ErrnoError))throw c;return c.errno}}function Et(r,e,n,t){for(var a=0,i=0;i>2],c=k[e+4>>2];e+=8;var f=o.write(r,D,u,c,t);if(f<0)return-1;a+=f}return a}function bt(r,e,n,t){try{var a=Et(S.getStreamFromFD(r),e,n);return k[t>>2]=a,0}catch(i){if(o===void 0||!(i instanceof o.ErrnoError))throw i;return i.errno}}function kt(r){p.activeTexture(r)}function xt(r,e){p.attachShader(m.programs[r],m.shaders[e])}function Ft(r,e,n){p.bindAttribLocation(m.programs[r],e,M(n))}function Dt(r,e){r==35051?p.currentPixelPackBufferBinding=e:r==35052&&(p.currentPixelUnpackBufferBinding=e),p.bindBuffer(r,m.buffers[e])}function St(r,e,n){p.bindBufferBase(r,e,m.buffers[n])}function At(r,e,n,t,a){p.bindBufferRange(r,e,m.buffers[n],t,a)}function Pt(r,e){p.bindFramebuffer(r,m.framebuffers[e])}function Ct(r,e){p.bindTexture(r,m.textures[e])}function Tt(r){p.bindVertexArray(m.vaos[r])}function jt(r,e,n,t){n&&e?p.bufferData(r,P,t,n,e):p.bufferData(r,e,t)}function Bt(r,e,n,t){n&&p.bufferSubData(r,e,P,t,n)}function Mt(r){p.clear(r)}function It(r,e,n,t){p.clearBufferfi(r,e,n,t)}function Nt(r,e,n){p.clearBufferfv(r,e,ar,n>>2)}function Lt(r,e,n){p.clearBufferiv(r,e,v,n>>2)}function Rt(r,e,n){p.clearBufferuiv(r,e,k,n>>2)}function Ot(r,e,n,t){p.clearColor(r,e,n,t)}function Wt(r){p.clearDepth(r)}function Zt(r){p.clearStencil(r)}function zt(r,e,n,t){p.colorMask(!!r,!!e,!!n,!!t)}function Ut(r){p.compileShader(m.shaders[r])}function Ht(){var r=m.getNewId(m.programs),e=p.createProgram();return e.name=r,e.maxUniformLength=e.maxAttributeLength=e.maxUniformBlockNameLength=0,e.uniformIdCounter=1,m.programs[r]=e,r}function Vt(r){var e=m.getNewId(m.shaders);return m.shaders[e]=p.createShader(r),e}function qt(r,e){for(var n=0;n>2],a=m.buffers[t];a&&(p.deleteBuffer(a),a.name=0,m.buffers[t]=null,t==p.currentPixelPackBufferBinding&&(p.currentPixelPackBufferBinding=0),t==p.currentPixelUnpackBufferBinding&&(p.currentPixelUnpackBufferBinding=0))}}function Gt(r,e){for(var n=0;n>2],a=m.framebuffers[t];a&&(p.deleteFramebuffer(a),a.name=0,m.framebuffers[t]=null)}}function Yt(r){if(r){var e=m.programs[r];e?(p.deleteProgram(e),e.name=0,m.programs[r]=null):m.recordError(1281)}}function Xt(r,e){for(var n=0;n>2],a=m.queries[t];a&&(p.deleteQuery(a),m.queries[t]=null)}}function Qt(r){if(r){var e=m.shaders[r];e?(p.deleteShader(e),m.shaders[r]=null):m.recordError(1281)}}function Jt(r,e){for(var n=0;n>2],a=m.textures[t];a&&(p.deleteTexture(a),a.name=0,m.textures[t]=null)}}function Kt(r,e){for(var n=0;n>2];p.deleteVertexArray(m.vaos[t]),m.vaos[t]=null}}function $t(r,e,n){p.drawArrays(r,e,n)}var ve=[];function ro(r,e){for(var n=ve[r],t=0;t>2];p.drawBuffers(n)}function eo(r,e,n,t){p.drawElements(r,e,n,t)}function no(r,e,n,t,a){p.drawElementsInstanced(r,e,n,t,a)}function to(r){p.enableVertexAttribArray(r)}function oo(r,e,n,t,a){p.framebufferTexture2D(r,e,n,m.textures[t],a)}function vr(r,e,n,t){for(var a=0;a>2]=u}}function ao(r,e){vr(r,e,"createBuffer",m.buffers)}function io(r,e){vr(r,e,"createFramebuffer",m.framebuffers)}function uo(r,e){vr(r,e,"createQuery",m.queries)}function so(r,e){vr(r,e,"createTexture",m.textures)}function co(r,e){vr(r,e,"createVertexArray",m.vaos)}function fo(r){p.generateMipmap(r)}function he(r,e){k[r>>2]=e,k[r+4>>2]=(e-k[r>>2])/4294967296}function lo(r,e,n){if(e){var t=void 0;switch(r){case 36346:t=1;break;case 36344:return void(n!=0&&n!=1&&m.recordError(1280));case 34814:case 36345:t=0;break;case 34466:var a=p.getParameter(34467);t=a?a.length:0;break;case 33309:if(m.currentContext.version<2)return void m.recordError(1282);t=2*(p.getSupportedExtensions()||[]).length;break;case 33307:case 33308:if(m.currentContext.version<2)return void m.recordError(1280);t=r==33307?3:0}if(t===void 0){var i=p.getParameter(r);switch(typeof i){case"number":t=i;break;case"boolean":t=i?1:0;break;case"string":return void m.recordError(1280);case"object":if(i===null)switch(r){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:t=0;break;default:return void m.recordError(1280)}else{if(i instanceof Float32Array||i instanceof Uint32Array||i instanceof Int32Array||i instanceof Array){for(var u=0;u>2]=i[u];break;case 2:ar[e+4*u>>2]=i[u];break;case 4:D[e+u>>0]=i[u]?1:0}return}try{t=0|i.name}catch(c){return m.recordError(1280),void R("GL_INVALID_ENUM in glGet"+n+"v: Unknown object returned from WebGL getParameter("+r+")! (error: "+c+")")}}break;default:return m.recordError(1280),void R("GL_INVALID_ENUM in glGet"+n+"v: Native code calling glGet"+n+"v("+r+") and it returns "+i+" of type "+typeof i+"!")}}switch(n){case 1:he(e,t);break;case 0:v[e>>2]=t;break;case 2:ar[e>>2]=t;break;case 4:D[e>>0]=t?1:0}}else m.recordError(1281)}function mo(r,e){lo(r,e,0)}function po(r,e,n){if(n){var t,a=m.queries[r];he(n,typeof(t=m.currentContext.version<2?p.disjointTimerQueryExt.getQueryObjectEXT(a,e):p.getQueryParameter(a,e))=="boolean"?t?1:0:t)}else m.recordError(1281)}function vo(r,e,n){if(n){var t,a=m.queries[r],i=p.disjointTimerQueryExt.getQueryObjectEXT(a,e);t=typeof i=="boolean"?i?1:0:i,v[n>>2]=t}else m.recordError(1281)}function ho(r,e){return p.getUniformBlockIndex(m.programs[r],M(e))}function go(r){return parseInt(r)}function ge(r){return r.slice(-1)=="]"&&r.lastIndexOf("[")}function _o(r){var e,n,t=r.uniformLocsById,a=r.uniformSizeAndIdsByName;if(!t)for(r.uniformLocsById=t={},r.uniformArrayNamesById={},e=0;e0?u.slice(0,f):u,h=r.uniformIdCounter;for(r.uniformIdCounter+=c,a[l]=[c,h],n=0;n0&&(t=go(e.slice(i+1))>>>0,a=e.slice(0,i));var u=r.uniformSizeAndIdsByName[a];if(u&&t>xr(c))}}function Fo(r,e,n,t){var a=m.getSource(r,e,n,t);p.shaderSource(m.shaders[r],a)}function Do(r,e,n,t,a,i,u,c,f,l){if(p.currentPixelUnpackBufferBinding)p.texImage3D(r,e,n,t,a,i,u,c,f,l);else if(l){var h=kr(f);p.texImage3D(r,e,n,t,a,i,u,c,f,h,l>>xr(h))}else p.texImage3D(r,e,n,t,a,i,u,c,f,null)}function So(r,e,n){p.texParameteri(r,e,n)}function Ao(r,e,n,t,a){p.texStorage2D(r,e,n,t,a)}function Po(r,e,n,t,a,i,u,c,f){if(p.currentPixelUnpackBufferBinding)p.texSubImage2D(r,e,n,t,a,i,u,c,f);else if(f){var l=kr(c);p.texSubImage2D(r,e,n,t,a,i,u,c,l,f>>xr(l))}else p.texSubImage2D(r,e,n,t,a,i,u,c,null)}function Co(r,e,n,t,a,i,u,c,f,l,h){if(p.currentPixelUnpackBufferBinding)p.texSubImage3D(r,e,n,t,a,i,u,c,f,l,h);else if(h){var _=kr(l);p.texSubImage3D(r,e,n,t,a,i,u,c,f,l,_,h>>xr(_))}else p.texSubImage3D(r,e,n,t,a,i,u,c,f,l,null)}function To(r){var e=p.currentProgram;if(e){var n=e.uniformLocsById[r];return typeof n=="number"&&(e.uniformLocsById[r]=n=p.getUniformLocation(e,e.uniformArrayNamesById[r]+(n>0?"["+n+"]":""))),n}m.recordError(1282)}function jo(r,e){p.uniform1i(To(r),e)}function Bo(r,e,n){r=m.programs[r],p.uniformBlockBinding(r,e,n)}function Mo(r){r=m.programs[r],p.useProgram(r),p.currentProgram=r}function Io(r,e,n,t,a){p.vertexAttribIPointer(r,e,n,t,a)}function No(r,e,n,t,a,i){p.vertexAttribPointer(r,e,n,!!t,a,i)}function Lo(r){}function Fr(r){return r%4==0&&(r%100!=0||r%400==0)}function Ro(r,e){for(var n=0,t=0;t<=e;n+=r[t++]);return n}var _e=[31,29,31,30,31,30,31,31,30,31,30,31],ye=[31,28,31,30,31,30,31,31,30,31,30,31];function Oo(r,e){for(var n=new Date(r.getTime());e>0;){var t=Fr(n.getFullYear()),a=n.getMonth(),i=(t?_e:ye)[a];if(!(e>i-n.getDate()))return n.setDate(n.getDate()+e),n;e-=i-n.getDate()+1,n.setDate(1),a<11?n.setMonth(a+1):(n.setMonth(0),n.setFullYear(n.getFullYear()+1))}return n}function Wo(r,e,n,t){var a=v[t+40>>2],i={tm_sec:v[t>>2],tm_min:v[t+4>>2],tm_hour:v[t+8>>2],tm_mday:v[t+12>>2],tm_mon:v[t+16>>2],tm_year:v[t+20>>2],tm_wday:v[t+24>>2],tm_yday:v[t+28>>2],tm_isdst:v[t+32>>2],tm_gmtoff:v[t+36>>2],tm_zone:a?M(a):""},u=M(n),c={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var f in c)u=u.replace(new RegExp(f,"g"),c[f]);var l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],h=["January","February","March","April","May","June","July","August","September","October","November","December"];function _(d,w,N){for(var B=typeof d=="number"?d.toString():d||"";B.length0?1:0}var B;return(B=N(d.getFullYear()-w.getFullYear()))===0&&(B=N(d.getMonth()-w.getMonth()))===0&&(B=N(d.getDate()-w.getDate())),B}function F(d){switch(d.getDay()){case 0:return new Date(d.getFullYear()-1,11,29);case 1:return d;case 2:return new Date(d.getFullYear(),0,3);case 3:return new Date(d.getFullYear(),0,2);case 4:return new Date(d.getFullYear(),0,1);case 5:return new Date(d.getFullYear()-1,11,31);case 6:return new Date(d.getFullYear()-1,11,30)}}function A(d){var w=Oo(new Date(d.tm_year+1900,0,1),d.tm_yday),N=new Date(w.getFullYear(),0,4),B=new Date(w.getFullYear()+1,0,4),Cr=F(N),Yo=F(B);return b(Cr,w)<=0?b(Yo,w)<=0?w.getFullYear()+1:w.getFullYear():w.getFullYear()-1}var T={"%a":function(d){return l[d.tm_wday].substring(0,3)},"%A":function(d){return l[d.tm_wday]},"%b":function(d){return h[d.tm_mon].substring(0,3)},"%B":function(d){return h[d.tm_mon]},"%C":function(d){return g((d.tm_year+1900)/100|0,2)},"%d":function(d){return g(d.tm_mday,2)},"%e":function(d){return _(d.tm_mday,2," ")},"%g":function(d){return A(d).toString().substring(2)},"%G":function(d){return A(d)},"%H":function(d){return g(d.tm_hour,2)},"%I":function(d){var w=d.tm_hour;return w==0?w=12:w>12&&(w-=12),g(w,2)},"%j":function(d){return g(d.tm_mday+Ro(Fr(d.tm_year+1900)?_e:ye,d.tm_mon-1),3)},"%m":function(d){return g(d.tm_mon+1,2)},"%M":function(d){return g(d.tm_min,2)},"%n":function(){return` diff --git a/dist/assets/webStyleUtils-0RWyEn-J.js b/dist/assets/webStyleUtils-0RWyEn-J.js new file mode 100644 index 0000000..800b178 --- /dev/null +++ b/dist/assets/webStyleUtils-0RWyEn-J.js @@ -0,0 +1 @@ +import{r as c,he as y,dL as r,hf as h,hg as i,hh as m,ar as b,au as f,hi as p,hj as w,hk as d,hl as g,hm as $}from"./index-pCX-0tJH.js";async function D(a,t,e){if(!a.name)throw new c("style-symbol-reference-name-missing","Missing name in style symbol reference");if(a.styleName&&a.styleName==="Esri2DPointSymbolsStyle")return j(a,e);try{return N(await y(a,t,e),a.name,t,e)}catch(n){return r(n),null}}async function j(a,t){const e=h.replaceAll(/\{SymbolName\}/gi,a.name);try{const n=await i(e,t);return m(n.data)}catch(n){return r(n),null}}async function N(a,t,e,n){const u={portal:(e==null?void 0:e.portal)!=null?e.portal:b.getDefault(),url:f(a.baseUrl),origin:"portal-item"},o=p(t,a.data);if(!o)throw new c("symbolstyleutils:symbol-name-not-found",`The symbol name '${t}' could not be found`,{symbolName:t});let s=w(d(o,"cimRef"),u);g()&&(s=$(s));try{const l=await i(s,n);return m(l.data)}catch(l){return r(l),null}}export{D as fetchCIMSymbolReference}; diff --git a/dist/assets/webStyleUtils-7PxVkooF.js b/dist/assets/webStyleUtils-7PxVkooF.js deleted file mode 100644 index 59c9dd9..0000000 --- a/dist/assets/webStyleUtils-7PxVkooF.js +++ /dev/null @@ -1 +0,0 @@ -import{E as c,hc as u,dQ as r,hd as h,he as i,hf as m,bS as b,bV as f,hg as d,hh as p,hi as w,hj as g,hk as $}from"./index-J0iiHjMT.js";async function D(e,t,a){if(!e.name)throw new c("style-symbol-reference-name-missing","Missing name in style symbol reference");if(e.styleName&&e.styleName==="Esri2DPointSymbolsStyle")return S(e,a);try{return j(await u(e,t,a),e.name,t,a)}catch(n){return r(n),null}}async function S(e,t){const a=h.replaceAll(/\{SymbolName\}/gi,e.name);try{const n=await i(a,t);return m(n.data)}catch(n){return r(n),null}}async function j(e,t,a,n){const y={portal:(a==null?void 0:a.portal)!=null?a.portal:b.getDefault(),url:f(e.baseUrl),origin:"portal-item"},o=d(t,e.data);if(!o)throw new c("symbolstyleutils:symbol-name-not-found",`The symbol name '${t}' could not be found`,{symbolName:t});let s=p(w(o,"cimRef"),y);g()&&(s=$(s));try{const l=await i(s,n);return m(l.data)}catch(l){return r(l),null}}export{D as fetchCIMSymbolReference}; diff --git a/dist/assets/wfsUtils-6CAR46-c.js b/dist/assets/wfsUtils-vzWdLJRB.js similarity index 73% rename from dist/assets/wfsUtils-6CAR46-c.js rename to dist/assets/wfsUtils-vzWdLJRB.js index 7a77f48..773b3fc 100644 --- a/dist/assets/wfsUtils-6CAR46-c.js +++ b/dist/assets/wfsUtils-vzWdLJRB.js @@ -1 +1 @@ -import{bW as h,f8 as I,E as l,f9 as U,fa as R,fb as $,fc as C,ar as k,dT as L,al as M,fd as O,e1 as V,dw as m,fe as W,f4 as X,eV as z,ff as F}from"./index-J0iiHjMT.js";import{u as Y}from"./geojson-fSjaGZrp.js";import{o as S,n as T}from"./xmlUtils-Q_9cB30b.js";const x="xlink:href",d="2.0.0",E="__esri_wfs_id__",q="wfs-layer:getWFSLayerTypeInfo-error",_="wfs-layer:empty-service",A="wfs-layer:feature-type-not-found",H="wfs-layer:geojson-not-supported",J="wfs-layer:kvp-encoding-not-supported",K="wfs-layer:malformed-json",N="wfs-layer:unknown-geometry-type",Q="wfs-layer:unknown-field-type",B="wfs-layer:unsupported-spatial-reference",Z="wfs-layer:unsupported-wfs-version";async function he(r,t){const e=ee((await h(r,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"GetCapabilities",VERSION:d,...t==null?void 0:t.customParameters},signal:t==null?void 0:t.signal})).data);return ne(r,e),e}function ee(r){const t=G(r);ge(t),D(t);const e=t.firstElementChild,a=I(re(e));return{operations:ae(e),get featureTypes(){return Array.from(a())},readFeatureTypes:a}}const te=new Set(["json","application/json","geojson","application/json; subtype=geojson"]);function ae(r){let t=!1;const e={GetCapabilities:{url:""},DescribeFeatureType:{url:""},GetFeature:{url:"",outputFormat:null,supportsPagination:!1}};if(S(r,{OperationsMetadata:{Operation:a=>{switch(a.getAttribute("name")){case"GetCapabilities":return{DCP:{HTTP:{Get:n=>{e.GetCapabilities.url=n.getAttribute(x)}}}};case"DescribeFeatureType":return{DCP:{HTTP:{Get:n=>{e.DescribeFeatureType.url=n.getAttribute(x)}}}};case"GetFeature":return{DCP:{HTTP:{Get:n=>{e.GetFeature.url=n.getAttribute(x)}}},Parameter:n=>{if(n.getAttribute("name")==="outputFormat")return{AllowedValues:{Value:s=>{const o=s.textContent;o&&te.has(o.toLowerCase())&&(e.GetFeature.outputFormat=o)}}}}}}},Constraint:a=>{switch(a.getAttribute("name")){case"KVPEncoding":return{DefaultValue:n=>{t=n.textContent.toLowerCase()==="true"}};case"ImplementsResultPaging":return{DefaultValue:n=>{e.GetFeature.supportsPagination=n.textContent.toLowerCase()==="true"}}}}}}),!t)throw new l(J,"WFS service doesn't support key/value pair (KVP) encoding");if(e.GetFeature.outputFormat==null)throw new l(H,"WFS service doesn't support GeoJSON output format");return e}function ne(r,t){U(r)&&(R(r,t.operations.DescribeFeatureType.url,!0)&&(t.operations.DescribeFeatureType.url=$(t.operations.DescribeFeatureType.url)),R(r,t.operations.GetFeature.url,!0)&&(t.operations.GetFeature.url=$(t.operations.GetFeature.url)))}function P(r){var e,a,n;const t=parseInt(((n=(a=(e=r.textContent)==null?void 0:e.match(/(?\d+$)/i))==null?void 0:a.groups)==null?void 0:n.wkid)??"",10);if(!Number.isNaN(t))return t}function re(r){return T(r,{FeatureTypeList:{FeatureType:t=>{const e={typeName:"undefined:undefined",name:"",title:"",description:"",extent:null,namespacePrefix:"",namespaceUri:"",defaultSpatialReference:4326,supportedSpatialReferences:[]},a=new Set;return S(t,{Name:n=>{const{name:s,prefix:o}=g(n.textContent);e.typeName=`${o}:${s}`,e.name=s,e.namespacePrefix=o,e.namespaceUri=n.lookupNamespaceURI(o)},Abstract:n=>{e.description=n.textContent},Title:n=>{e.title=n.textContent},WGS84BoundingBox:n=>{e.extent=se(n)},DefaultCRS:n=>{const s=P(n);s&&(e.defaultSpatialReference=s,a.add(s))},OtherCRS:n=>{const s=P(n);s&&a.add(s)}}),e.title||(e.title=e.name),a.add(4326),e.supportedSpatialReferences.push(...a),e}}})}function se(r){let t,e,a,n;for(const s of r.children)switch(s.localName){case"LowerCorner":[t,e]=s.textContent.split(" ").map(o=>Number.parseFloat(o));break;case"UpperCorner":[a,n]=s.textContent.split(" ").map(o=>Number.parseFloat(o))}return{xmin:t,ymin:e,xmax:a,ymax:n,spatialReference:z}}function oe(r,t,e){return C(r,a=>e?a.name===t&&a.namespaceUri===e:a.typeName===t||a.name===t)}async function Se(r,t,e,a={}){const{featureType:n,extent:s}=await ie(r,t,e,a),{spatialReference:o}=we(r.operations.GetFeature.url,n,a.spatialReference),{fields:i,geometryType:p,swapXY:c,objectIdField:u,geometryField:f}=await ue(r,n,o,a);return{url:r.operations.GetCapabilities.url,name:n.name,namespaceUri:n.namespaceUri,fields:i,geometryField:f,geometryType:p,objectIdField:u,spatialReference:a.spatialReference??new k({wkid:n.defaultSpatialReference}),extent:s,swapXY:c,wfsCapabilities:r,customParameters:a.customParameters}}async function ie(r,t,e,a={}){const n=r.readFeatureTypes(),s=t?oe(n,t,e):n.next().value,{spatialReference:o=new k({wkid:s==null?void 0:s.defaultSpatialReference})}=a;if(s==null)throw t?new l(A,`The type '${t}' could not be found in the service`):new l(_,"The service is empty");let i=new L({...s.extent,spatialReference:k.WGS84});if(!M(i.spatialReference,o))try{await O(i.spatialReference,o,void 0,a),i=V(i,o)}catch{throw new l(B,"Projection not supported")}return{extent:i,spatialReference:o,featureType:s}}async function ue(r,t,e,a={}){var y,w,b;const{typeName:n}=t,[s,o]=await Promise.allSettled([ce(r.operations.DescribeFeatureType.url,n,a),le(r,n,e,a)]),i=j=>new l(q,`An error occurred while getting info about the feature type '${n}'`,{error:j});if(s.status==="rejected")throw i(s.reason);if(o.status==="rejected")throw i(o.reason);const{fields:p,errors:c}=s.value??{},u=((y=s.value)==null?void 0:y.geometryType)||((w=o.value)==null?void 0:w.geometryType),f=((b=o.value)==null?void 0:b.swapXY)??!1;if(u==null)throw new l(N,`The geometry type could not be determined for type '${n}`,{typeName:n,geometryType:u,fields:p,errors:c});return{...pe(p??[]),geometryType:u,swapXY:f}}function pe(r){const t=r.find(a=>a.type==="geometry");let e=r.find(a=>a.type==="oid");return r=r.filter(a=>a.type!=="geometry"),e||(e=new m({name:E,type:"oid",alias:E}),r.unshift(e)),{geometryField:(t==null?void 0:t.name)??null,objectIdField:e.name,fields:r}}async function le(r,t,e,a={}){var c;let n,s=!1;const[o,i]=await Promise.all([de(r.operations.GetFeature.url,t,e,r.operations.GetFeature.outputFormat,{...a,count:1}),h(r.operations.GetFeature.url,{responseType:"text",query:v(t,e,void 0,{...a,count:1}),signal:a==null?void 0:a.signal})]),p=o.type==="FeatureCollection"&&((c=o.features[0])==null?void 0:c.geometry);if(p){let u;switch(n=W.fromJSON(Y(p.type)),p.type){case"Point":u=p.coordinates;break;case"LineString":case"MultiPoint":u=p.coordinates[0];break;case"MultiLineString":case"Polygon":u=p.coordinates[0][0];break;case"MultiPolygon":u=p.coordinates[0][0][0]}const f=/<[^>]*pos[^>]*> *(-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?)/.exec(i.data);if(f){const y=u[0].toFixed(3),w=u[1].toFixed(3),b=parseFloat(f[1]).toFixed(3);y===parseFloat(f[2]).toFixed(3)&&w===b&&(s=!0)}}return{geometryType:n,swapXY:s}}async function ce(r,t,e){return fe(t,(await h(r,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"DescribeFeatureType",VERSION:d,TYPENAME:t,...e==null?void 0:e.customParameters},signal:e==null?void 0:e.signal})).data)}function fe(r,t){const{name:e}=g(r),a=G(t);D(a);const n=C(T(a.firstElementChild,{element:s=>({name:s.getAttribute("name"),typeName:g(s.getAttribute("type")).name})}),({name:s})=>s===e);if(n!=null){const s=C(T(a.firstElementChild,{complexType:o=>o}),o=>o.getAttribute("name")===n.typeName);if(s!=null)return me(s)}throw new l(A,`Type '${r}' not found in document`,{document:new XMLSerializer().serializeToString(a)})}const ye=new Set(["objectid","fid"]);function me(r){const t=[],e=[];let a;const n=T(r,{complexContent:{extension:{sequence:{element:s=>s}}}});for(const s of n){const o=s.getAttribute("name");if(!o)continue;let i,p;if(s.hasAttribute("type")?i=g(s.getAttribute("type")).name:S(s,{simpleType:{restriction:f=>(i=g(f.getAttribute("base")).name,{maxLength:y=>{p=+y.getAttribute("value")}})}}),!i)continue;const c=s.getAttribute("nillable")==="true";let u=!1;switch(i.toLowerCase()){case"integer":case"nonpositiveinteger":case"negativeinteger":case"long":case"int":case"short":case"byte":case"nonnegativeinteger":case"unsignedlong":case"unsignedint":case"unsignedshort":case"unsignedbyte":case"positiveinteger":e.push(new m({name:o,alias:o,type:"integer",nullable:c,length:F("integer")}));break;case"float":case"double":case"decimal":e.push(new m({name:o,alias:o,type:"double",nullable:c,length:F("double")}));break;case"boolean":case"string":case"gyearmonth":case"gyear":case"gmonthday":case"gday":case"gmonth":case"anyuri":case"qname":case"notation":case"normalizedstring":case"token":case"language":case"idrefs":case"entities":case"nmtoken":case"nmtokens":case"name":case"ncname":case"id":case"idref":case"entity":case"duration":case"time":e.push(new m({name:o,alias:o,type:"string",nullable:c,length:p??F("string")}));break;case"datetime":case"date":e.push(new m({name:o,alias:o,type:"date",nullable:c,length:p??F("date")}));break;case"pointpropertytype":a="point",u=!0;break;case"multipointpropertytype":a="multipoint",u=!0;break;case"curvepropertytype":case"multicurvepropertytype":case"multilinestringpropertytype":a="polyline",u=!0;break;case"surfacepropertytype":case"multisurfacepropertytype":case"multipolygonpropertytype":a="polygon",u=!0;break;case"geometrypropertytype":case"multigeometrypropertytype":u=!0,t.push(new l(N,`geometry type '${i}' is not supported`,{type:new XMLSerializer().serializeToString(r)}));break;default:t.push(new l(Q,`Unknown field type '${i}'`,{type:new XMLSerializer().serializeToString(r)}))}u&&e.push(new m({name:o,alias:o,type:"geometry",nullable:c}))}for(const s of e)if(s.type==="integer"&&!s.nullable&&ye.has(s.name.toLowerCase())){s.type="oid";break}return{geometryType:a,fields:e,errors:t}}async function de(r,t,e,a,n){let{data:s}=await h(r,{responseType:"text",query:v(t,e,a,n),signal:n==null?void 0:n.signal});s=s.replaceAll(/": +(-?\d+),(\d+)(,)?/g,'": $1.$2$3');try{return JSON.parse(s)}catch(o){throw new l(K,"Error while parsing the response",{response:s,error:o})}}function v(r,t,e,a){const n=typeof t=="number"?t:t.wkid;return{SERVICE:"WFS",REQUEST:"GetFeature",VERSION:d,TYPENAMES:r,OUTPUTFORMAT:e,SRSNAME:"EPSG:"+n,STARTINDEX:a==null?void 0:a.startIndex,COUNT:a==null?void 0:a.count,...a==null?void 0:a.customParameters}}function G(r){return new DOMParser().parseFromString(r.trim(),"text/xml")}function g(r){const[t,e]=r.split(":");return{prefix:e?t:"",name:e??t}}function ge(r){var e;const t=(e=r.firstElementChild)==null?void 0:e.getAttribute("version");if(t&&t!==d)throw new l(Z,`Unsupported WFS version ${t}. Supported version: ${d}`)}function D(r){let t="",e="";if(S(r.firstElementChild,{Exception:a=>(t=a.getAttribute("exceptionCode"),{ExceptionText:n=>{e=n.textContent}})}),t)throw new l(`wfs-layer:${t}`,e)}function we(r,t,e){const a={wkid:t.defaultSpatialReference},n=(e==null?void 0:e.wkid)!=null?{wkid:e.wkid}:a;return{spatialReference:n,getFeatureSpatialReference:X(r)||n.wkid&&t.supportedSpatialReferences.includes(n.wkid)?{wkid:n.wkid}:{wkid:t.defaultSpatialReference}}}export{de as B,E as S,oe as V,Se as W,we as a,pe as q,he as v}; +import{av as T,f3 as I,r as l,f4 as U,f5 as R,f6 as $,f7 as C,d2 as k,dO as L,bt as O,f8 as M,dW as V,es as m,f9 as W,e$ as X,eQ as z,fa as F}from"./index-pCX-0tJH.js";import{u as Y}from"./geojson-162a_hNo.js";import{o as S,n as h}from"./xmlUtils-Q_9cB30b.js";const x="xlink:href",d="2.0.0",E="__esri_wfs_id__",q="wfs-layer:getWFSLayerTypeInfo-error",_="wfs-layer:empty-service",v="wfs-layer:feature-type-not-found",Q="wfs-layer:geojson-not-supported",H="wfs-layer:kvp-encoding-not-supported",J="wfs-layer:malformed-json",A="wfs-layer:unknown-geometry-type",K="wfs-layer:unknown-field-type",B="wfs-layer:unsupported-spatial-reference",Z="wfs-layer:unsupported-wfs-version";async function Te(r,t){const e=ee((await T(r,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"GetCapabilities",VERSION:d,...t==null?void 0:t.customParameters},signal:t==null?void 0:t.signal})).data);return ne(r,e),e}function ee(r){const t=G(r);ge(t),D(t);const e=t.firstElementChild,a=I(re(e));return{operations:ae(e),get featureTypes(){return Array.from(a())},readFeatureTypes:a}}const te=new Set(["json","application/json","geojson","application/json; subtype=geojson"]);function ae(r){let t=!1;const e={GetCapabilities:{url:""},DescribeFeatureType:{url:""},GetFeature:{url:"",outputFormat:null,supportsPagination:!1}};if(S(r,{OperationsMetadata:{Operation:a=>{switch(a.getAttribute("name")){case"GetCapabilities":return{DCP:{HTTP:{Get:n=>{e.GetCapabilities.url=n.getAttribute(x)}}}};case"DescribeFeatureType":return{DCP:{HTTP:{Get:n=>{e.DescribeFeatureType.url=n.getAttribute(x)}}}};case"GetFeature":return{DCP:{HTTP:{Get:n=>{e.GetFeature.url=n.getAttribute(x)}}},Parameter:n=>{if(n.getAttribute("name")==="outputFormat")return{AllowedValues:{Value:s=>{const o=s.textContent;o&&te.has(o.toLowerCase())&&(e.GetFeature.outputFormat=o)}}}}}}},Constraint:a=>{switch(a.getAttribute("name")){case"KVPEncoding":return{DefaultValue:n=>{t=n.textContent.toLowerCase()==="true"}};case"ImplementsResultPaging":return{DefaultValue:n=>{e.GetFeature.supportsPagination=n.textContent.toLowerCase()==="true"}}}}}}),!t)throw new l(H,"WFS service doesn't support key/value pair (KVP) encoding");if(e.GetFeature.outputFormat==null)throw new l(Q,"WFS service doesn't support GeoJSON output format");return e}function ne(r,t){U(r)&&(R(r,t.operations.DescribeFeatureType.url,!0)&&(t.operations.DescribeFeatureType.url=$(t.operations.DescribeFeatureType.url)),R(r,t.operations.GetFeature.url,!0)&&(t.operations.GetFeature.url=$(t.operations.GetFeature.url)))}function P(r){var e,a,n;const t=parseInt(((n=(a=(e=r.textContent)==null?void 0:e.match(/(?\d+$)/i))==null?void 0:a.groups)==null?void 0:n.wkid)??"",10);if(!Number.isNaN(t))return t}function re(r){return h(r,{FeatureTypeList:{FeatureType:t=>{const e={typeName:"undefined:undefined",name:"",title:"",description:"",extent:null,namespacePrefix:"",namespaceUri:"",defaultSpatialReference:4326,supportedSpatialReferences:[]},a=new Set;return S(t,{Name:n=>{const{name:s,prefix:o}=g(n.textContent);e.typeName=`${o}:${s}`,e.name=s,e.namespacePrefix=o,e.namespaceUri=n.lookupNamespaceURI(o)},Abstract:n=>{e.description=n.textContent},Title:n=>{e.title=n.textContent},WGS84BoundingBox:n=>{e.extent=se(n)},DefaultCRS:n=>{const s=P(n);s&&(e.defaultSpatialReference=s,a.add(s))},OtherCRS:n=>{const s=P(n);s&&a.add(s)}}),e.title||(e.title=e.name),a.add(4326),e.supportedSpatialReferences.push(...a),e}}})}function se(r){let t,e,a,n;for(const s of r.children)switch(s.localName){case"LowerCorner":[t,e]=s.textContent.split(" ").map(o=>Number.parseFloat(o));break;case"UpperCorner":[a,n]=s.textContent.split(" ").map(o=>Number.parseFloat(o))}return{xmin:t,ymin:e,xmax:a,ymax:n,spatialReference:z}}function oe(r,t,e){return C(r,a=>e?a.name===t&&a.namespaceUri===e:a.typeName===t||a.name===t)}async function Se(r,t,e,a={}){const{featureType:n,extent:s}=await ie(r,t,e,a),{spatialReference:o}=we(r.operations.GetFeature.url,n,a.spatialReference),{fields:i,geometryType:p,swapXY:c,objectIdField:u,geometryField:y}=await ue(r,n,o,a);return{url:r.operations.GetCapabilities.url,name:n.name,namespaceUri:n.namespaceUri,fields:i,geometryField:y,geometryType:p,objectIdField:u,spatialReference:a.spatialReference??new k({wkid:n.defaultSpatialReference}),extent:s,swapXY:c,wfsCapabilities:r,customParameters:a.customParameters}}async function ie(r,t,e,a={}){const n=r.readFeatureTypes(),s=t?oe(n,t,e):n.next().value,{spatialReference:o=new k({wkid:s==null?void 0:s.defaultSpatialReference})}=a;if(s==null)throw t?new l(v,`The type '${t}' could not be found in the service`):new l(_,"The service is empty");let i=new L({...s.extent,spatialReference:k.WGS84});if(!O(i.spatialReference,o))try{await M(i.spatialReference,o,void 0,a),i=V(i,o)}catch{throw new l(B,"Projection not supported")}return{extent:i,spatialReference:o,featureType:s}}async function ue(r,t,e,a={}){var f,w,b;const{typeName:n}=t,[s,o]=await Promise.allSettled([ce(r.operations.DescribeFeatureType.url,n,a),le(r,n,e,a)]),i=j=>new l(q,`An error occurred while getting info about the feature type '${n}'`,{error:j});if(s.status==="rejected")throw i(s.reason);if(o.status==="rejected")throw i(o.reason);const{fields:p,errors:c}=s.value??{},u=((f=s.value)==null?void 0:f.geometryType)||((w=o.value)==null?void 0:w.geometryType),y=((b=o.value)==null?void 0:b.swapXY)??!1;if(u==null)throw new l(A,`The geometry type could not be determined for type '${n}`,{typeName:n,geometryType:u,fields:p,errors:c});return{...pe(p??[]),geometryType:u,swapXY:y}}function pe(r){const t=r.find(a=>a.type==="geometry");let e=r.find(a=>a.type==="oid");return r=r.filter(a=>a.type!=="geometry"),e||(e=new m({name:E,type:"oid",alias:E}),r.unshift(e)),{geometryField:(t==null?void 0:t.name)??null,objectIdField:e.name,fields:r}}async function le(r,t,e,a={}){var c;let n,s=!1;const[o,i]=await Promise.all([de(r.operations.GetFeature.url,t,e,r.operations.GetFeature.outputFormat,{...a,count:1}),T(r.operations.GetFeature.url,{responseType:"text",query:N(t,e,void 0,{...a,count:1}),signal:a==null?void 0:a.signal})]),p=o.type==="FeatureCollection"&&((c=o.features[0])==null?void 0:c.geometry);if(p){let u;switch(n=W.fromJSON(Y(p.type)),p.type){case"Point":u=p.coordinates;break;case"LineString":case"MultiPoint":u=p.coordinates[0];break;case"MultiLineString":case"Polygon":u=p.coordinates[0][0];break;case"MultiPolygon":u=p.coordinates[0][0][0]}const y=/<[^>]*pos[^>]*> *(-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?)/.exec(i.data);if(y){const f=u[0].toFixed(3),w=u[1].toFixed(3),b=parseFloat(y[1]).toFixed(3);f===parseFloat(y[2]).toFixed(3)&&w===b&&(s=!0)}}return{geometryType:n,swapXY:s}}async function ce(r,t,e){return ye(t,(await T(r,{responseType:"text",query:{SERVICE:"WFS",REQUEST:"DescribeFeatureType",VERSION:d,TYPENAME:t,...e==null?void 0:e.customParameters},signal:e==null?void 0:e.signal})).data)}function ye(r,t){const{name:e}=g(r),a=G(t);D(a);const n=C(h(a.firstElementChild,{element:s=>({name:s.getAttribute("name"),typeName:g(s.getAttribute("type")).name})}),({name:s})=>s===e);if(n!=null){const s=C(h(a.firstElementChild,{complexType:o=>o}),o=>o.getAttribute("name")===n.typeName);if(s!=null)return me(s)}throw new l(v,`Type '${r}' not found in document`,{document:new XMLSerializer().serializeToString(a)})}const fe=new Set(["objectid","fid"]);function me(r){const t=[],e=[];let a;const n=h(r,{complexContent:{extension:{sequence:{element:s=>s}}}});for(const s of n){const o=s.getAttribute("name");if(!o)continue;let i,p;if(s.hasAttribute("type")?i=g(s.getAttribute("type")).name:S(s,{simpleType:{restriction:y=>(i=g(y.getAttribute("base")).name,{maxLength:f=>{p=+f.getAttribute("value")}})}}),!i)continue;const c=s.getAttribute("nillable")==="true";let u=!1;switch(i.toLowerCase()){case"integer":case"nonpositiveinteger":case"negativeinteger":case"long":case"int":case"short":case"byte":case"nonnegativeinteger":case"unsignedlong":case"unsignedint":case"unsignedshort":case"unsignedbyte":case"positiveinteger":e.push(new m({name:o,alias:o,type:"integer",nullable:c,length:F("integer")}));break;case"float":case"double":case"decimal":e.push(new m({name:o,alias:o,type:"double",nullable:c,length:F("double")}));break;case"boolean":case"string":case"gyearmonth":case"gyear":case"gmonthday":case"gday":case"gmonth":case"anyuri":case"qname":case"notation":case"normalizedstring":case"token":case"language":case"idrefs":case"entities":case"nmtoken":case"nmtokens":case"name":case"ncname":case"id":case"idref":case"entity":case"duration":case"time":e.push(new m({name:o,alias:o,type:"string",nullable:c,length:p??F("string")}));break;case"datetime":case"date":e.push(new m({name:o,alias:o,type:"date",nullable:c,length:p??F("date")}));break;case"pointpropertytype":a="point",u=!0;break;case"multipointpropertytype":a="multipoint",u=!0;break;case"curvepropertytype":case"multicurvepropertytype":case"multilinestringpropertytype":a="polyline",u=!0;break;case"surfacepropertytype":case"multisurfacepropertytype":case"multipolygonpropertytype":a="polygon",u=!0;break;case"geometrypropertytype":case"multigeometrypropertytype":u=!0,t.push(new l(A,`geometry type '${i}' is not supported`,{type:new XMLSerializer().serializeToString(r)}));break;default:t.push(new l(K,`Unknown field type '${i}'`,{type:new XMLSerializer().serializeToString(r)}))}u&&e.push(new m({name:o,alias:o,type:"geometry",nullable:c}))}for(const s of e)if(s.type==="integer"&&!s.nullable&&fe.has(s.name.toLowerCase())){s.type="oid";break}return{geometryType:a,fields:e,errors:t}}async function de(r,t,e,a,n){let{data:s}=await T(r,{responseType:"text",query:N(t,e,a,n),signal:n==null?void 0:n.signal});s=s.replaceAll(/": +(-?\d+),(\d+)(,)?/g,'": $1.$2$3');try{return JSON.parse(s)}catch(o){throw new l(J,"Error while parsing the response",{response:s,error:o})}}function N(r,t,e,a){const n=typeof t=="number"?t:t.wkid;return{SERVICE:"WFS",REQUEST:"GetFeature",VERSION:d,TYPENAMES:r,OUTPUTFORMAT:e,SRSNAME:"EPSG:"+n,STARTINDEX:a==null?void 0:a.startIndex,COUNT:a==null?void 0:a.count,...a==null?void 0:a.customParameters}}function G(r){return new DOMParser().parseFromString(r.trim(),"text/xml")}function g(r){const[t,e]=r.split(":");return{prefix:e?t:"",name:e??t}}function ge(r){var e;const t=(e=r.firstElementChild)==null?void 0:e.getAttribute("version");if(t&&t!==d)throw new l(Z,`Unsupported WFS version ${t}. Supported version: ${d}`)}function D(r){let t="",e="";if(S(r.firstElementChild,{Exception:a=>(t=a.getAttribute("exceptionCode"),{ExceptionText:n=>{e=n.textContent}})}),t)throw new l(`wfs-layer:${t}`,e)}function we(r,t,e){const a={wkid:t.defaultSpatialReference},n=(e==null?void 0:e.wkid)!=null?{wkid:e.wkid}:a;return{spatialReference:n,getFeatureSpatialReference:X(r)||n.wkid&&t.supportedSpatialReferences.includes(n.wkid)?{wkid:n.wkid}:{wkid:t.defaultSpatialReference}}}export{de as B,E as S,oe as V,Se as W,we as a,pe as q,Te as v}; diff --git a/dist/assets/xyChart-pkay2Qkc.js b/dist/assets/xyChart-CbyBbMYg.js similarity index 97% rename from dist/assets/xyChart-pkay2Qkc.js rename to dist/assets/xyChart-CbyBbMYg.js index c8394df..cd74f68 100644 --- a/dist/assets/xyChart-pkay2Qkc.js +++ b/dist/assets/xyChart-CbyBbMYg.js @@ -1 +1 @@ -import{d as W,c as $}from"./LineSeries-VcEznTH7.js";import{_ as le,b as he,x as ge,u as de,o as me,r as ce}from"./LineSeries-VcEznTH7.js";import{b as j,m as D,l as A,p as K,a1 as Z,s as z,B,K as O,n as q,a0 as J}from"./Theme-QNc_77AM.js";import{da as E}from"./index-J0iiHjMT.js";import{n as H}from"./Button-1STHXt3M.js";import"./ColorSet-j9kKRPwP.js";import"./DefaultTheme-T7-VnRhA.js";import"./Tick-WQ_bPwW2.js";class k extends W{constructor(){super(...arguments),Object.defineProperty(this,"_ph",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_pw",{enumerable:!0,configurable:!0,writable:!0,value:0})}_makeGraphics(e,t){return this.makeColumn(t,e)}_makeFieldNames(){super._makeFieldNames();const e=this.get("xAxis"),t=this.get("yAxis"),i="CategoryAxis",s="ValueAxis";e.isType(i)&&(this.get("openCategoryXField")||(this._xOpenField=this._xField)),e.isType(s)&&(this.get("openValueXField")||(this._xOpenField=this._xField)),t.isType(i)&&(this.get("openCategoryYField")||(this._yOpenField=this._yField)),t.isType(s)&&(this.get("openValueYField")||(this._yOpenField=this._yField))}_prepareChildren(){super._prepareChildren();const e=this.get("xAxis"),t=this.get("yAxis"),i=this.dataItems.length,s=Math.max(0,this.startIndex()-2),a=Math.min(this.endIndex()+2,i-1);if(e.inited&&t.inited)for(let o=s;o<=a;o++){let n=this.dataItems[o];this._createGraphics(n)}}_updateChildren(){const e=this.chart;e&&(this._ph=e.plotContainer.height(),this._pw=e.plotContainer.width());const t=this.get("xAxis"),i=this.get("yAxis"),s=this.get("baseAxis"),a=this.columns.template;this.isDirty("fill")&&a.get("fill")==null&&a.set("fill",this.get("fill")),this.isDirty("stroke")&&a.get("stroke")==null&&a.set("stroke",this.get("stroke"));let o=0,n=0,r=0;D(s.series,h=>{if(h instanceof k){const x=h.get("stacked");x&&r==0&&n++,!x&&h.get("clustered")&&n++}h===this&&(o=n-1),r++}),this.get("clustered")||(o=0,n=1),n===0&&(n=1,o=0);const g=t.get("renderer"),c=i.get("renderer"),p="cellStartLocation",u="cellEndLocation",m=g.get(p,0),f=g.get(u,1),d=c.get(p,0),l=c.get(u,1);if(this._aLocationX0=m+o/n*(f-m),this._aLocationX1=m+(o+1)/n*(f-m),this._aLocationY0=d+o/n*(l-d),this._aLocationY1=d+(o+1)/n*(l-d),t.inited&&i.inited){if(this._axesDirty||this._valuesDirty||this._stackDirty||this.isDirty("vcx")||this.isDirty("vcy")||this._sizeDirty){const h=this.dataItems.length;let x=Math.max(0,this.startIndex()-2),M=Math.min(this.endIndex()+2,h-1);for(let _=0;_0&&x>0)for(let X=_-1;X>=0;X--){let y=this.dataItems[X];if(y.get("valueX")!=null&&y.get("valueY")!=null){F=y;break}}break}this._toggleColumn(T,!1)}for(let _=x;_<=M;_++){let T=this.dataItems[_];this._updateGraphics(T,F),T.get("valueX")!=null&&T.get("valueY")!=null&&(F=T)}for(let _=M+1;_{const a=s.container,o=e.get("rangeGraphics",[]);e.set("rangeGraphics",o);const n=this._makeGraphics(s.columns,e);o.push(n),n.setPrivate("list",s.columns),a.children.push(n)})}}_updateGraphics(e,t){let i=e.get("graphics");const s=this._xField,a=this._yField,o=e.get(s),n=e.get(a);if(o!=null&&n!=null){const r=this._xOpenField,g=this._yOpenField,c=this.get("locationX",e.get("locationX",.5)),p=this.get("locationY",e.get("locationY",.5)),u=this.get("openLocationX",e.get("openLocationX",c)),m=this.get("openLocationY",e.get("openLocationY",p)),f=i.get("width"),d=i.get("height"),l=this.get("stacked"),h=this.get("xAxis"),x=this.get("yAxis"),M=this.get("baseAxis"),F=h.get("start"),_=h.get("end"),T=x.get("start"),X=x.get("end");let y,w,v,C,Y=this.get("vcy",1),L=this.get("vcx",1),R=!1,G=!1;if(x.isType("CategoryAxis")&&h.isType("CategoryAxis")){let P=this._aLocationX0+u-.5,b=this._aLocationX1+c-.5;if(f instanceof O){let I=(b-P)*(1-f.value)/2;P+=I,b-=I}if(y=h.getDataItemPositionX(e,r,P,L),w=h.getDataItemPositionX(e,s,b,L),P=this._aLocationY0+m-.5,b=this._aLocationY1+p-.5,d instanceof O){let I=(b-P)*(1-d.value)/2;P+=I,b-=I}v=x.getDataItemPositionY(e,g,P,Y),C=x.getDataItemPositionY(e,a,b,Y),e.setRaw("point",{x:y+(w-y)/2,y:v+(C-v)/2})}else if(h===M){let P=this._aLocationX0+u-.5,b=this._aLocationX1+c-.5;if(f instanceof O){let I=(b-P)*(1-f.value)/2;P+=I,b-=I}if(y=h.getDataItemPositionX(e,r,P,L),w=h.getDataItemPositionX(e,s,b,L),v=x.getDataItemPositionY(e,a,p,Y),this._yOpenField!==this._yField)C=x.getDataItemPositionY(e,g,m,Y);else if(l){let I=e.get("stackToItemY");C=I?x.getDataItemPositionY(I,a,m,I.component.get("vcy")):x.basePosition()}else C=x.basePosition();e.setRaw("point",{x:y+(w-y)/2,y:v}),G=!0}else if(x===M){let P=this._aLocationY0+m-.5,b=this._aLocationY1+p-.5;if(d instanceof O){let I=(b-P)*(1-d.value)/2;P+=I,b-=I}if(v=x.getDataItemPositionY(e,g,P,Y),C=x.getDataItemPositionY(e,a,b,Y),w=h.getDataItemPositionX(e,s,c,L),this._xOpenField!==this._xField)y=h.getDataItemPositionX(e,r,u,L);else if(l){let I=e.get("stackToItemX");y=I?h.getDataItemPositionX(I,s,u,I.component.get("vcx")):h.basePosition()}else y=h.basePosition();R=!0,e.setRaw("point",{x:w,y:v+(C-v)/2})}this._updateSeriesGraphics(e,i,y,w,v,C,R,G),y_&&w>_||v=X&&C>X||q(y)||q(v)?this._toggleColumn(e,!1):this._toggleColumn(e,!0);let V=e.get("rangeGraphics");V&&D(V,P=>{this._updateSeriesGraphics(e,P,y,w,v,C,R,G)}),this._applyGraphicsStates(e,t)}}_updateSeriesGraphics(e,t,i,s,a,o,n,r){const g=t.get("width"),c=t.get("height"),p=t.get("maxWidth"),u=t.get("maxHeight"),m=this.getPoint(i,a),f=this.getPoint(s,o),d=e.get("point");if(d){const l=this.getPoint(d.x,d.y);d.x=l.x+this._x,d.y=l.y+this._y}if(i=m.x,s=f.x,a=m.y,o=f.y,A(g)){const l=(s-i-g)/2;i+=l,s-=l}if(A(p)&&p{this._toggleColumn(e,!1)})}_applyGraphicsStates(e,t){const i=e.get("graphics"),s=i.states.lookup("dropFromOpen"),a=i.states.lookup("riseFromOpen"),o=i.states.lookup("dropFromPrevious"),n=i.states.lookup("riseFromPrevious");if(s||o||a||n){const r=this.get("xAxis"),g=this.get("yAxis"),c=this.get("baseAxis");let p,u,m;c===r&&g.isType("ValueAxis")?(p=e.get(this._yOpenField),u=e.get(this._yField),m=t.get(this._yField)):c===g&&r.isType("ValueAxis")&&(p=e.get(this._xOpenField),u=e.get(this._xField),m=t.get(this._xField)),A(p)&&A(u)&&(u{const a=s.getPrivate("list");a&&a.removeValue(s),s.dispose()})}hideDataItem(e,t){const i=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return E(this,void 0,void 0,function*(){const s=[i.hideDataItem.call(this,e,t)],a=e.get("graphics");a&&s.push(a.hide(t));const o=e.get("rangeGraphics");o&&D(o,n=>{s.push(n.hide(t))}),yield Promise.all(s)})}_toggleColumn(e,t){const i=e.get("graphics");i&&i.setPrivate("visible",t);const s=e.get("rangeGraphics");s&&D(s,o=>{o.setPrivate("visible",t)});const a=e.bullets;a&&D(a,o=>{o.setPrivate("hidden",!t)})}showDataItem(e,t){const i=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return E(this,void 0,void 0,function*(){const s=[i.showDataItem.call(this,e,t)],a=e.get("graphics");a&&s.push(a.show(t));const o=e.get("rangeGraphics");o&&D(o,n=>{s.push(n.show(t))}),yield Promise.all(s)})}updateLegendMarker(e){let t=this.get("legendDataItem");if(this.get("useLastColorForLegendMarker")&&!e){const i=this.dataItems[this.endIndex()-1];i&&(e=i)}if(t){let i=this.columns.template;if(e){let a=e.get("graphics");a&&(i=a)}const s=t.get("markerRectangle");s&&(t.get("itemContainer").get("disabled")||D(J,a=>{s.set(a,i.get(a,this.get(a)))}))}}_getTooltipTarget(e){return this.get("seriesTooltipTarget")=="bullet"?super._getTooltipTarget(e):e.get("graphics")||this}}Object.defineProperty(k,"className",{enumerable:!0,configurable:!0,writable:!0,value:"BaseColumnSeries"}),Object.defineProperty(k,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:W.classNames.concat([k.className])});class N extends ${constructor(){super(...arguments),Object.defineProperty(this,"_frequency",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_itemMap",{enumerable:!0,configurable:!0,writable:!0,value:{}})}_afterNew(){this._settings.themeTags=j(this._settings.themeTags,["axis"]),this.fields.push("category"),this.setPrivateRaw("name","category"),this.addTag("category"),super._afterNew()}_prepareChildren(){super._prepareChildren();const e=this.dataItems.length;let t=0;this._valuesDirty&&(this._itemMap={},D(this.dataItems,i=>{i.setRaw("index",t),this._itemMap[i.get("category")]=i,t++}),this.setPrivateRaw("maxZoomFactor",e)),this.setPrivateRaw("startIndex",Math.max(Math.round(this.get("start",0)*e),0)),this.setPrivateRaw("endIndex",Math.min(Math.round(this.get("end",1)*e),e)),(this._sizeDirty||this._valuesDirty||this.isDirty("start")||this.isDirty("end")||this.isPrivateDirty("endIndex")||this.isPrivateDirty("startIndex")||this.isPrivateDirty("width")||this.isPrivateDirty("height"))&&this.dataItems.length>0&&(this._handleRangeChange(),this._prepareAxisItems(),this._updateAxisRanges())}_handleRangeChange(){D(this.series,e=>{let t=this.dataItems[this.startIndex()].get("category"),i=this.dataItems[this.endIndex()-1].get("category"),s=e.get("baseAxis"),a=e.get("xAxis"),o=e.get("yAxis");if(a instanceof N&&o instanceof N)e._markDirtyAxes();else if(s===this){let n,r,g=o;if(a===s?(e.get("categoryXField")&&(n="categoryX"),e.get("openCategoryXField")&&(r="openCategoryX")):o===s&&(e.get("categoryYField")&&(n="categoryY"),e.get("openCategoryYField")&&(r="openCategoryY"),g=a),g.className=="ValueAxis"&&(n||r)){let c,p;for(let d=0,l=e.dataItems.length;d=0;d--){let l=e.dataItems[d];if(n&&l.get(n)===i){p=l;break}if(r&&l.get(r)===i){p=l;break}}let u=0,m=e.dataItems.length;c&&(u=e.dataItems.indexOf(c)),p&&(m=e.dataItems.indexOf(p)+1),e.setPrivate("startIndex",u),e.setPrivate("endIndex",m);let f=!1;for(let d=u;d{l.get(h)!=null&&(f=!0)}),D(e.__valueYShowFields,h=>{l.get(h)!=null&&(f=!0)}),f)break}e.setPrivate("outOfSelection",!f)}e._markDirtyAxes()}})}_prepareAxisItems(){const e=this.get("renderer"),t=this.dataItems.length;let i=this.startIndex();i>0&&i--;let s=this.endIndex();s0){let i=this.getPrivate("name")+this.get("renderer").getPrivate("letter"),s=this.axisPositionToIndex(t),a=e.dataItems[s],o=this.dataItems[s],n=o.get("category");if(a&&o&&a.get(i)===n)return a;for(let r=0,g=e.dataItems.length;rH._new(this._root,{position:"absolute",themeTags:j(this.columns.template.get("themeTags",[]),["series","column"])},[this.columns.template]))})}makeColumn(e,t){const i=this.mainContainer.children.push(t.make());return i._setDataItem(e),t.push(i),i}_processAxisRange(e){super._processAxisRange(e),e.columns=new z(B.new({}),()=>H._new(this._root,{position:"absolute",themeTags:j(e.columns.template.get("themeTags",[]),["series","column"])},[this.columns.template,e.columns.template]))}}Object.defineProperty(S,"className",{enumerable:!0,configurable:!0,writable:!0,value:"ColumnSeries"}),Object.defineProperty(S,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:k.classNames.concat([S.className])});export{le as AxisRendererXAm5,he as AxisRendererYAm5,N as CategoryAxisAm5,S as ColumnSeriesAm5,ge as LineSeriesAm5,de as ValueAxisAm5,me as XYChartAm5,ce as XYCursorAm5}; +import{d as W,c as $}from"./LineSeries-yr_9erUD.js";import{_ as le,b as he,x as ge,u as de,o as me,r as ce}from"./LineSeries-yr_9erUD.js";import{b as j,m as D,l as A,p as K,a1 as Z,s as z,B,K as O,n as q,a0 as J}from"./Theme-5CV7oVsW.js";import{d1 as E}from"./index-pCX-0tJH.js";import{n as H}from"./Button-HXGuX8_s.js";import"./ColorSet-tH4rJdGx.js";import"./DefaultTheme-uOYPzulo.js";import"./Tick-bu1aEuYp.js";class k extends W{constructor(){super(...arguments),Object.defineProperty(this,"_ph",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_pw",{enumerable:!0,configurable:!0,writable:!0,value:0})}_makeGraphics(e,t){return this.makeColumn(t,e)}_makeFieldNames(){super._makeFieldNames();const e=this.get("xAxis"),t=this.get("yAxis"),i="CategoryAxis",s="ValueAxis";e.isType(i)&&(this.get("openCategoryXField")||(this._xOpenField=this._xField)),e.isType(s)&&(this.get("openValueXField")||(this._xOpenField=this._xField)),t.isType(i)&&(this.get("openCategoryYField")||(this._yOpenField=this._yField)),t.isType(s)&&(this.get("openValueYField")||(this._yOpenField=this._yField))}_prepareChildren(){super._prepareChildren();const e=this.get("xAxis"),t=this.get("yAxis"),i=this.dataItems.length,s=Math.max(0,this.startIndex()-2),a=Math.min(this.endIndex()+2,i-1);if(e.inited&&t.inited)for(let o=s;o<=a;o++){let n=this.dataItems[o];this._createGraphics(n)}}_updateChildren(){const e=this.chart;e&&(this._ph=e.plotContainer.height(),this._pw=e.plotContainer.width());const t=this.get("xAxis"),i=this.get("yAxis"),s=this.get("baseAxis"),a=this.columns.template;this.isDirty("fill")&&a.get("fill")==null&&a.set("fill",this.get("fill")),this.isDirty("stroke")&&a.get("stroke")==null&&a.set("stroke",this.get("stroke"));let o=0,n=0,r=0;D(s.series,h=>{if(h instanceof k){const x=h.get("stacked");x&&r==0&&n++,!x&&h.get("clustered")&&n++}h===this&&(o=n-1),r++}),this.get("clustered")||(o=0,n=1),n===0&&(n=1,o=0);const g=t.get("renderer"),c=i.get("renderer"),p="cellStartLocation",u="cellEndLocation",m=g.get(p,0),f=g.get(u,1),d=c.get(p,0),l=c.get(u,1);if(this._aLocationX0=m+o/n*(f-m),this._aLocationX1=m+(o+1)/n*(f-m),this._aLocationY0=d+o/n*(l-d),this._aLocationY1=d+(o+1)/n*(l-d),t.inited&&i.inited){if(this._axesDirty||this._valuesDirty||this._stackDirty||this.isDirty("vcx")||this.isDirty("vcy")||this._sizeDirty){const h=this.dataItems.length;let x=Math.max(0,this.startIndex()-2),M=Math.min(this.endIndex()+2,h-1);for(let _=0;_0&&x>0)for(let X=_-1;X>=0;X--){let y=this.dataItems[X];if(y.get("valueX")!=null&&y.get("valueY")!=null){F=y;break}}break}this._toggleColumn(T,!1)}for(let _=x;_<=M;_++){let T=this.dataItems[_];this._updateGraphics(T,F),T.get("valueX")!=null&&T.get("valueY")!=null&&(F=T)}for(let _=M+1;_{const a=s.container,o=e.get("rangeGraphics",[]);e.set("rangeGraphics",o);const n=this._makeGraphics(s.columns,e);o.push(n),n.setPrivate("list",s.columns),a.children.push(n)})}}_updateGraphics(e,t){let i=e.get("graphics");const s=this._xField,a=this._yField,o=e.get(s),n=e.get(a);if(o!=null&&n!=null){const r=this._xOpenField,g=this._yOpenField,c=this.get("locationX",e.get("locationX",.5)),p=this.get("locationY",e.get("locationY",.5)),u=this.get("openLocationX",e.get("openLocationX",c)),m=this.get("openLocationY",e.get("openLocationY",p)),f=i.get("width"),d=i.get("height"),l=this.get("stacked"),h=this.get("xAxis"),x=this.get("yAxis"),M=this.get("baseAxis"),F=h.get("start"),_=h.get("end"),T=x.get("start"),X=x.get("end");let y,w,v,C,Y=this.get("vcy",1),L=this.get("vcx",1),R=!1,G=!1;if(x.isType("CategoryAxis")&&h.isType("CategoryAxis")){let P=this._aLocationX0+u-.5,b=this._aLocationX1+c-.5;if(f instanceof O){let I=(b-P)*(1-f.value)/2;P+=I,b-=I}if(y=h.getDataItemPositionX(e,r,P,L),w=h.getDataItemPositionX(e,s,b,L),P=this._aLocationY0+m-.5,b=this._aLocationY1+p-.5,d instanceof O){let I=(b-P)*(1-d.value)/2;P+=I,b-=I}v=x.getDataItemPositionY(e,g,P,Y),C=x.getDataItemPositionY(e,a,b,Y),e.setRaw("point",{x:y+(w-y)/2,y:v+(C-v)/2})}else if(h===M){let P=this._aLocationX0+u-.5,b=this._aLocationX1+c-.5;if(f instanceof O){let I=(b-P)*(1-f.value)/2;P+=I,b-=I}if(y=h.getDataItemPositionX(e,r,P,L),w=h.getDataItemPositionX(e,s,b,L),v=x.getDataItemPositionY(e,a,p,Y),this._yOpenField!==this._yField)C=x.getDataItemPositionY(e,g,m,Y);else if(l){let I=e.get("stackToItemY");C=I?x.getDataItemPositionY(I,a,m,I.component.get("vcy")):x.basePosition()}else C=x.basePosition();e.setRaw("point",{x:y+(w-y)/2,y:v}),G=!0}else if(x===M){let P=this._aLocationY0+m-.5,b=this._aLocationY1+p-.5;if(d instanceof O){let I=(b-P)*(1-d.value)/2;P+=I,b-=I}if(v=x.getDataItemPositionY(e,g,P,Y),C=x.getDataItemPositionY(e,a,b,Y),w=h.getDataItemPositionX(e,s,c,L),this._xOpenField!==this._xField)y=h.getDataItemPositionX(e,r,u,L);else if(l){let I=e.get("stackToItemX");y=I?h.getDataItemPositionX(I,s,u,I.component.get("vcx")):h.basePosition()}else y=h.basePosition();R=!0,e.setRaw("point",{x:w,y:v+(C-v)/2})}this._updateSeriesGraphics(e,i,y,w,v,C,R,G),y_&&w>_||v=X&&C>X||q(y)||q(v)?this._toggleColumn(e,!1):this._toggleColumn(e,!0);let V=e.get("rangeGraphics");V&&D(V,P=>{this._updateSeriesGraphics(e,P,y,w,v,C,R,G)}),this._applyGraphicsStates(e,t)}}_updateSeriesGraphics(e,t,i,s,a,o,n,r){const g=t.get("width"),c=t.get("height"),p=t.get("maxWidth"),u=t.get("maxHeight"),m=this.getPoint(i,a),f=this.getPoint(s,o),d=e.get("point");if(d){const l=this.getPoint(d.x,d.y);d.x=l.x+this._x,d.y=l.y+this._y}if(i=m.x,s=f.x,a=m.y,o=f.y,A(g)){const l=(s-i-g)/2;i+=l,s-=l}if(A(p)&&p{this._toggleColumn(e,!1)})}_applyGraphicsStates(e,t){const i=e.get("graphics"),s=i.states.lookup("dropFromOpen"),a=i.states.lookup("riseFromOpen"),o=i.states.lookup("dropFromPrevious"),n=i.states.lookup("riseFromPrevious");if(s||o||a||n){const r=this.get("xAxis"),g=this.get("yAxis"),c=this.get("baseAxis");let p,u,m;c===r&&g.isType("ValueAxis")?(p=e.get(this._yOpenField),u=e.get(this._yField),m=t.get(this._yField)):c===g&&r.isType("ValueAxis")&&(p=e.get(this._xOpenField),u=e.get(this._xField),m=t.get(this._xField)),A(p)&&A(u)&&(u{const a=s.getPrivate("list");a&&a.removeValue(s),s.dispose()})}hideDataItem(e,t){const i=Object.create(null,{hideDataItem:{get:()=>super.hideDataItem}});return E(this,void 0,void 0,function*(){const s=[i.hideDataItem.call(this,e,t)],a=e.get("graphics");a&&s.push(a.hide(t));const o=e.get("rangeGraphics");o&&D(o,n=>{s.push(n.hide(t))}),yield Promise.all(s)})}_toggleColumn(e,t){const i=e.get("graphics");i&&i.setPrivate("visible",t);const s=e.get("rangeGraphics");s&&D(s,o=>{o.setPrivate("visible",t)});const a=e.bullets;a&&D(a,o=>{o.setPrivate("hidden",!t)})}showDataItem(e,t){const i=Object.create(null,{showDataItem:{get:()=>super.showDataItem}});return E(this,void 0,void 0,function*(){const s=[i.showDataItem.call(this,e,t)],a=e.get("graphics");a&&s.push(a.show(t));const o=e.get("rangeGraphics");o&&D(o,n=>{s.push(n.show(t))}),yield Promise.all(s)})}updateLegendMarker(e){let t=this.get("legendDataItem");if(this.get("useLastColorForLegendMarker")&&!e){const i=this.dataItems[this.endIndex()-1];i&&(e=i)}if(t){let i=this.columns.template;if(e){let a=e.get("graphics");a&&(i=a)}const s=t.get("markerRectangle");s&&(t.get("itemContainer").get("disabled")||D(J,a=>{s.set(a,i.get(a,this.get(a)))}))}}_getTooltipTarget(e){return this.get("seriesTooltipTarget")=="bullet"?super._getTooltipTarget(e):e.get("graphics")||this}}Object.defineProperty(k,"className",{enumerable:!0,configurable:!0,writable:!0,value:"BaseColumnSeries"}),Object.defineProperty(k,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:W.classNames.concat([k.className])});class N extends ${constructor(){super(...arguments),Object.defineProperty(this,"_frequency",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_itemMap",{enumerable:!0,configurable:!0,writable:!0,value:{}})}_afterNew(){this._settings.themeTags=j(this._settings.themeTags,["axis"]),this.fields.push("category"),this.setPrivateRaw("name","category"),this.addTag("category"),super._afterNew()}_prepareChildren(){super._prepareChildren();const e=this.dataItems.length;let t=0;this._valuesDirty&&(this._itemMap={},D(this.dataItems,i=>{i.setRaw("index",t),this._itemMap[i.get("category")]=i,t++}),this.setPrivateRaw("maxZoomFactor",e)),this.setPrivateRaw("startIndex",Math.max(Math.round(this.get("start",0)*e),0)),this.setPrivateRaw("endIndex",Math.min(Math.round(this.get("end",1)*e),e)),(this._sizeDirty||this._valuesDirty||this.isDirty("start")||this.isDirty("end")||this.isPrivateDirty("endIndex")||this.isPrivateDirty("startIndex")||this.isPrivateDirty("width")||this.isPrivateDirty("height"))&&this.dataItems.length>0&&(this._handleRangeChange(),this._prepareAxisItems(),this._updateAxisRanges())}_handleRangeChange(){D(this.series,e=>{let t=this.dataItems[this.startIndex()].get("category"),i=this.dataItems[this.endIndex()-1].get("category"),s=e.get("baseAxis"),a=e.get("xAxis"),o=e.get("yAxis");if(a instanceof N&&o instanceof N)e._markDirtyAxes();else if(s===this){let n,r,g=o;if(a===s?(e.get("categoryXField")&&(n="categoryX"),e.get("openCategoryXField")&&(r="openCategoryX")):o===s&&(e.get("categoryYField")&&(n="categoryY"),e.get("openCategoryYField")&&(r="openCategoryY"),g=a),g.className=="ValueAxis"&&(n||r)){let c,p;for(let d=0,l=e.dataItems.length;d=0;d--){let l=e.dataItems[d];if(n&&l.get(n)===i){p=l;break}if(r&&l.get(r)===i){p=l;break}}let u=0,m=e.dataItems.length;c&&(u=e.dataItems.indexOf(c)),p&&(m=e.dataItems.indexOf(p)+1),e.setPrivate("startIndex",u),e.setPrivate("endIndex",m);let f=!1;for(let d=u;d{l.get(h)!=null&&(f=!0)}),D(e.__valueYShowFields,h=>{l.get(h)!=null&&(f=!0)}),f)break}e.setPrivate("outOfSelection",!f)}e._markDirtyAxes()}})}_prepareAxisItems(){const e=this.get("renderer"),t=this.dataItems.length;let i=this.startIndex();i>0&&i--;let s=this.endIndex();s0){let i=this.getPrivate("name")+this.get("renderer").getPrivate("letter"),s=this.axisPositionToIndex(t),a=e.dataItems[s],o=this.dataItems[s],n=o.get("category");if(a&&o&&a.get(i)===n)return a;for(let r=0,g=e.dataItems.length;rH._new(this._root,{position:"absolute",themeTags:j(this.columns.template.get("themeTags",[]),["series","column"])},[this.columns.template]))})}makeColumn(e,t){const i=this.mainContainer.children.push(t.make());return i._setDataItem(e),t.push(i),i}_processAxisRange(e){super._processAxisRange(e),e.columns=new z(B.new({}),()=>H._new(this._root,{position:"absolute",themeTags:j(e.columns.template.get("themeTags",[]),["series","column"])},[this.columns.template,e.columns.template]))}}Object.defineProperty(S,"className",{enumerable:!0,configurable:!0,writable:!0,value:"ColumnSeries"}),Object.defineProperty(S,"classNames",{enumerable:!0,configurable:!0,writable:!0,value:k.classNames.concat([S.className])});export{le as AxisRendererXAm5,he as AxisRendererYAm5,N as CategoryAxisAm5,S as ColumnSeriesAm5,ge as LineSeriesAm5,de as ValueAxisAm5,me as XYChartAm5,ce as XYCursorAm5}; diff --git a/dist/index.html b/dist/index.html index 352bdb7..fc21596 100644 --- a/dist/index.html +++ b/dist/index.html @@ -12,9 +12,45 @@ - - - + + + + + + + + + + + + + + + @@ -75,21 +111,26 @@

+ + + No basemap + +